diff --git a/TTS/Kokoro/.venv/Lib/site-packages/spacy-3.8.11.dist-info/licenses/LICENSE b/TTS/Kokoro/.venv/Lib/site-packages/spacy-3.8.11.dist-info/licenses/LICENSE new file mode 100644 index 0000000000000000000000000000000000000000..4dcd5b22a92b27c143a8ee8aa5e5878bee133c0f --- /dev/null +++ b/TTS/Kokoro/.venv/Lib/site-packages/spacy-3.8.11.dist-info/licenses/LICENSE @@ -0,0 +1,21 @@ +The MIT License (MIT) + +Copyright (C) 2016-2024 ExplosionAI GmbH, 2016 spaCy GmbH, 2015 Matthew Honnibal + +Permission is hereby granted, free of charge, to any person obtaining a copy +of this software and associated documentation files (the "Software"), to deal +in the Software without restriction, including without limitation the rights +to use, copy, modify, merge, publish, distribute, sublicense, and/or sell +copies of the Software, and to permit persons to whom the Software is +furnished to do so, subject to the following conditions: + +The above copyright notice and this permission notice shall be included in +all copies or substantial portions of the Software. + +THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR +IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY, +FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE +AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER +LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, +OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN +THE SOFTWARE. diff --git a/TTS/Kokoro/.venv/Lib/site-packages/spacy/lang/ta/__pycache__/__init__.cpython-312.pyc b/TTS/Kokoro/.venv/Lib/site-packages/spacy/lang/ta/__pycache__/__init__.cpython-312.pyc new file mode 100644 index 0000000000000000000000000000000000000000..0d239503e3f351c53d7d481ff215ab0878403d4a Binary files /dev/null and b/TTS/Kokoro/.venv/Lib/site-packages/spacy/lang/ta/__pycache__/__init__.cpython-312.pyc differ diff --git a/TTS/Kokoro/.venv/Lib/site-packages/spacy/lang/ta/__pycache__/examples.cpython-312.pyc b/TTS/Kokoro/.venv/Lib/site-packages/spacy/lang/ta/__pycache__/examples.cpython-312.pyc new file mode 100644 index 0000000000000000000000000000000000000000..4406634882d01c23c35955b31d8cc91043b23a5e Binary files /dev/null and b/TTS/Kokoro/.venv/Lib/site-packages/spacy/lang/ta/__pycache__/examples.cpython-312.pyc differ diff --git a/TTS/Kokoro/.venv/Lib/site-packages/spacy/lang/ta/__pycache__/lex_attrs.cpython-312.pyc b/TTS/Kokoro/.venv/Lib/site-packages/spacy/lang/ta/__pycache__/lex_attrs.cpython-312.pyc new file mode 100644 index 0000000000000000000000000000000000000000..5a5139263095a63328eca5227d2ca708d9c43657 Binary files /dev/null and b/TTS/Kokoro/.venv/Lib/site-packages/spacy/lang/ta/__pycache__/lex_attrs.cpython-312.pyc differ diff --git a/TTS/Kokoro/.venv/Lib/site-packages/spacy/lang/ta/__pycache__/stop_words.cpython-312.pyc b/TTS/Kokoro/.venv/Lib/site-packages/spacy/lang/ta/__pycache__/stop_words.cpython-312.pyc new file mode 100644 index 0000000000000000000000000000000000000000..1acbfc9956e21fa7dae04b538d15468da2fe1ae4 Binary files /dev/null and b/TTS/Kokoro/.venv/Lib/site-packages/spacy/lang/ta/__pycache__/stop_words.cpython-312.pyc differ diff --git a/TTS/Kokoro/.venv/Lib/site-packages/spacy/lang/te/__pycache__/__init__.cpython-312.pyc b/TTS/Kokoro/.venv/Lib/site-packages/spacy/lang/te/__pycache__/__init__.cpython-312.pyc new file mode 100644 index 0000000000000000000000000000000000000000..e20fc58fe44739ccb8ae7bc9cfdd3a952cac0f7e Binary files /dev/null and b/TTS/Kokoro/.venv/Lib/site-packages/spacy/lang/te/__pycache__/__init__.cpython-312.pyc differ diff --git a/TTS/Kokoro/.venv/Lib/site-packages/spacy/lang/te/__pycache__/examples.cpython-312.pyc b/TTS/Kokoro/.venv/Lib/site-packages/spacy/lang/te/__pycache__/examples.cpython-312.pyc new file mode 100644 index 0000000000000000000000000000000000000000..f2ff70ca6effb3d2797c506083c72307d8569dc8 Binary files /dev/null and b/TTS/Kokoro/.venv/Lib/site-packages/spacy/lang/te/__pycache__/examples.cpython-312.pyc differ diff --git a/TTS/Kokoro/.venv/Lib/site-packages/spacy/lang/te/__pycache__/lex_attrs.cpython-312.pyc b/TTS/Kokoro/.venv/Lib/site-packages/spacy/lang/te/__pycache__/lex_attrs.cpython-312.pyc new file mode 100644 index 0000000000000000000000000000000000000000..38b530a34743a282ba4a902e2aaedd0bd29f0ed5 Binary files /dev/null and b/TTS/Kokoro/.venv/Lib/site-packages/spacy/lang/te/__pycache__/lex_attrs.cpython-312.pyc differ diff --git a/TTS/Kokoro/.venv/Lib/site-packages/spacy/lang/te/__pycache__/stop_words.cpython-312.pyc b/TTS/Kokoro/.venv/Lib/site-packages/spacy/lang/te/__pycache__/stop_words.cpython-312.pyc new file mode 100644 index 0000000000000000000000000000000000000000..86e8e6bedec30808913df15d55cc50c730ea42c5 Binary files /dev/null and b/TTS/Kokoro/.venv/Lib/site-packages/spacy/lang/te/__pycache__/stop_words.cpython-312.pyc differ diff --git a/TTS/Kokoro/.venv/Lib/site-packages/spacy/lang/th/__pycache__/__init__.cpython-312.pyc b/TTS/Kokoro/.venv/Lib/site-packages/spacy/lang/th/__pycache__/__init__.cpython-312.pyc new file mode 100644 index 0000000000000000000000000000000000000000..0bc422a4355d427be2fb229f465c17773fb74c37 Binary files /dev/null and b/TTS/Kokoro/.venv/Lib/site-packages/spacy/lang/th/__pycache__/__init__.cpython-312.pyc differ diff --git a/TTS/Kokoro/.venv/Lib/site-packages/spacy/lang/th/__pycache__/lex_attrs.cpython-312.pyc b/TTS/Kokoro/.venv/Lib/site-packages/spacy/lang/th/__pycache__/lex_attrs.cpython-312.pyc new file mode 100644 index 0000000000000000000000000000000000000000..8f4edb17337871d235ae4c8dcde032ac1247fa4c Binary files /dev/null and b/TTS/Kokoro/.venv/Lib/site-packages/spacy/lang/th/__pycache__/lex_attrs.cpython-312.pyc differ diff --git a/TTS/Kokoro/.venv/Lib/site-packages/spacy/lang/th/__pycache__/stop_words.cpython-312.pyc b/TTS/Kokoro/.venv/Lib/site-packages/spacy/lang/th/__pycache__/stop_words.cpython-312.pyc new file mode 100644 index 0000000000000000000000000000000000000000..8d33c908cd63c54755b9fabf12562b4f8310eab5 Binary files /dev/null and b/TTS/Kokoro/.venv/Lib/site-packages/spacy/lang/th/__pycache__/stop_words.cpython-312.pyc differ diff --git a/TTS/Kokoro/.venv/Lib/site-packages/spacy/lang/th/__pycache__/tokenizer_exceptions.cpython-312.pyc b/TTS/Kokoro/.venv/Lib/site-packages/spacy/lang/th/__pycache__/tokenizer_exceptions.cpython-312.pyc new file mode 100644 index 0000000000000000000000000000000000000000..0628726bf86b7829728acfbf5232886cc9e7d566 Binary files /dev/null and b/TTS/Kokoro/.venv/Lib/site-packages/spacy/lang/th/__pycache__/tokenizer_exceptions.cpython-312.pyc differ diff --git a/TTS/Kokoro/.venv/Lib/site-packages/spacy/lang/ti/__pycache__/__init__.cpython-312.pyc b/TTS/Kokoro/.venv/Lib/site-packages/spacy/lang/ti/__pycache__/__init__.cpython-312.pyc new file mode 100644 index 0000000000000000000000000000000000000000..fd30efd0c5de299717f1ab6241a0fafa9c03216a Binary files /dev/null and b/TTS/Kokoro/.venv/Lib/site-packages/spacy/lang/ti/__pycache__/__init__.cpython-312.pyc differ diff --git a/TTS/Kokoro/.venv/Lib/site-packages/spacy/lang/ti/__pycache__/examples.cpython-312.pyc b/TTS/Kokoro/.venv/Lib/site-packages/spacy/lang/ti/__pycache__/examples.cpython-312.pyc new file mode 100644 index 0000000000000000000000000000000000000000..a178579e9bf75a2dfbd56fbde18a29dfa2e71541 Binary files /dev/null and b/TTS/Kokoro/.venv/Lib/site-packages/spacy/lang/ti/__pycache__/examples.cpython-312.pyc differ diff --git a/TTS/Kokoro/.venv/Lib/site-packages/spacy/lang/ti/__pycache__/lex_attrs.cpython-312.pyc b/TTS/Kokoro/.venv/Lib/site-packages/spacy/lang/ti/__pycache__/lex_attrs.cpython-312.pyc new file mode 100644 index 0000000000000000000000000000000000000000..5cdf2a689ca557d93dcabfe2783a5f4d29f46579 Binary files /dev/null and b/TTS/Kokoro/.venv/Lib/site-packages/spacy/lang/ti/__pycache__/lex_attrs.cpython-312.pyc differ diff --git a/TTS/Kokoro/.venv/Lib/site-packages/spacy/lang/ti/__pycache__/punctuation.cpython-312.pyc b/TTS/Kokoro/.venv/Lib/site-packages/spacy/lang/ti/__pycache__/punctuation.cpython-312.pyc new file mode 100644 index 0000000000000000000000000000000000000000..887491499b867b66f50ad8d0137664188d58c89d Binary files /dev/null and b/TTS/Kokoro/.venv/Lib/site-packages/spacy/lang/ti/__pycache__/punctuation.cpython-312.pyc differ diff --git a/TTS/Kokoro/.venv/Lib/site-packages/spacy/lang/ti/__pycache__/stop_words.cpython-312.pyc b/TTS/Kokoro/.venv/Lib/site-packages/spacy/lang/ti/__pycache__/stop_words.cpython-312.pyc new file mode 100644 index 0000000000000000000000000000000000000000..879a4803a1f08e86dc46f51ce711c4b4fd60ae37 Binary files /dev/null and b/TTS/Kokoro/.venv/Lib/site-packages/spacy/lang/ti/__pycache__/stop_words.cpython-312.pyc differ diff --git a/TTS/Kokoro/.venv/Lib/site-packages/spacy/lang/ti/__pycache__/tokenizer_exceptions.cpython-312.pyc b/TTS/Kokoro/.venv/Lib/site-packages/spacy/lang/ti/__pycache__/tokenizer_exceptions.cpython-312.pyc new file mode 100644 index 0000000000000000000000000000000000000000..0e60fb603a917ff2623fb7e25055081901858584 Binary files /dev/null and b/TTS/Kokoro/.venv/Lib/site-packages/spacy/lang/ti/__pycache__/tokenizer_exceptions.cpython-312.pyc differ diff --git a/TTS/Kokoro/.venv/Lib/site-packages/spacy/lang/tl/__pycache__/__init__.cpython-312.pyc b/TTS/Kokoro/.venv/Lib/site-packages/spacy/lang/tl/__pycache__/__init__.cpython-312.pyc new file mode 100644 index 0000000000000000000000000000000000000000..855f3897d15c8a30ac427d91d334299b569f413d Binary files /dev/null and b/TTS/Kokoro/.venv/Lib/site-packages/spacy/lang/tl/__pycache__/__init__.cpython-312.pyc differ diff --git a/TTS/Kokoro/.venv/Lib/site-packages/spacy/lang/tl/__pycache__/lex_attrs.cpython-312.pyc b/TTS/Kokoro/.venv/Lib/site-packages/spacy/lang/tl/__pycache__/lex_attrs.cpython-312.pyc new file mode 100644 index 0000000000000000000000000000000000000000..a2e9d50c57e1c4f371983fb93a3937567f7638dc Binary files /dev/null and b/TTS/Kokoro/.venv/Lib/site-packages/spacy/lang/tl/__pycache__/lex_attrs.cpython-312.pyc differ diff --git a/TTS/Kokoro/.venv/Lib/site-packages/spacy/lang/tl/__pycache__/stop_words.cpython-312.pyc b/TTS/Kokoro/.venv/Lib/site-packages/spacy/lang/tl/__pycache__/stop_words.cpython-312.pyc new file mode 100644 index 0000000000000000000000000000000000000000..1107fbf3224aec761b3424c12b1a157bd4ea8e9b Binary files /dev/null and b/TTS/Kokoro/.venv/Lib/site-packages/spacy/lang/tl/__pycache__/stop_words.cpython-312.pyc differ diff --git a/TTS/Kokoro/.venv/Lib/site-packages/spacy/lang/tl/__pycache__/tokenizer_exceptions.cpython-312.pyc b/TTS/Kokoro/.venv/Lib/site-packages/spacy/lang/tl/__pycache__/tokenizer_exceptions.cpython-312.pyc new file mode 100644 index 0000000000000000000000000000000000000000..5b5c10af35573aeb48bc3d21900e89028a20277c Binary files /dev/null and b/TTS/Kokoro/.venv/Lib/site-packages/spacy/lang/tl/__pycache__/tokenizer_exceptions.cpython-312.pyc differ diff --git a/TTS/Kokoro/.venv/Lib/site-packages/spacy/lang/tn/__pycache__/__init__.cpython-312.pyc b/TTS/Kokoro/.venv/Lib/site-packages/spacy/lang/tn/__pycache__/__init__.cpython-312.pyc new file mode 100644 index 0000000000000000000000000000000000000000..2b6736153c5719be2c86d6f8806eb60bd6b07d78 Binary files /dev/null and b/TTS/Kokoro/.venv/Lib/site-packages/spacy/lang/tn/__pycache__/__init__.cpython-312.pyc differ diff --git a/TTS/Kokoro/.venv/Lib/site-packages/spacy/lang/tn/__pycache__/examples.cpython-312.pyc b/TTS/Kokoro/.venv/Lib/site-packages/spacy/lang/tn/__pycache__/examples.cpython-312.pyc new file mode 100644 index 0000000000000000000000000000000000000000..4e394340c36e7fbc192678f636dc33995c1613d0 Binary files /dev/null and b/TTS/Kokoro/.venv/Lib/site-packages/spacy/lang/tn/__pycache__/examples.cpython-312.pyc differ diff --git a/TTS/Kokoro/.venv/Lib/site-packages/spacy/lang/tn/__pycache__/lex_attrs.cpython-312.pyc b/TTS/Kokoro/.venv/Lib/site-packages/spacy/lang/tn/__pycache__/lex_attrs.cpython-312.pyc new file mode 100644 index 0000000000000000000000000000000000000000..f083f5be4bcff90dd5b4e13b3a9448d2298af10b Binary files /dev/null and b/TTS/Kokoro/.venv/Lib/site-packages/spacy/lang/tn/__pycache__/lex_attrs.cpython-312.pyc differ diff --git a/TTS/Kokoro/.venv/Lib/site-packages/spacy/lang/tn/__pycache__/punctuation.cpython-312.pyc b/TTS/Kokoro/.venv/Lib/site-packages/spacy/lang/tn/__pycache__/punctuation.cpython-312.pyc new file mode 100644 index 0000000000000000000000000000000000000000..db39234d7c8322ab06d126cc113312cdd4f7a9cd Binary files /dev/null and b/TTS/Kokoro/.venv/Lib/site-packages/spacy/lang/tn/__pycache__/punctuation.cpython-312.pyc differ diff --git a/TTS/Kokoro/.venv/Lib/site-packages/spacy/lang/tn/__pycache__/stop_words.cpython-312.pyc b/TTS/Kokoro/.venv/Lib/site-packages/spacy/lang/tn/__pycache__/stop_words.cpython-312.pyc new file mode 100644 index 0000000000000000000000000000000000000000..8cef9197ea37e03e2a259aa2e219bd3a0f87ec1f Binary files /dev/null and b/TTS/Kokoro/.venv/Lib/site-packages/spacy/lang/tn/__pycache__/stop_words.cpython-312.pyc differ diff --git a/TTS/Kokoro/.venv/Lib/site-packages/spacy/lang/tr/__pycache__/__init__.cpython-312.pyc b/TTS/Kokoro/.venv/Lib/site-packages/spacy/lang/tr/__pycache__/__init__.cpython-312.pyc new file mode 100644 index 0000000000000000000000000000000000000000..47c616f58fcdce070bca6161757a78ac1c2fb700 Binary files /dev/null and b/TTS/Kokoro/.venv/Lib/site-packages/spacy/lang/tr/__pycache__/__init__.cpython-312.pyc differ diff --git a/TTS/Kokoro/.venv/Lib/site-packages/spacy/lang/tr/__pycache__/examples.cpython-312.pyc b/TTS/Kokoro/.venv/Lib/site-packages/spacy/lang/tr/__pycache__/examples.cpython-312.pyc new file mode 100644 index 0000000000000000000000000000000000000000..d45fe5adefda8023c5cc359b5664992887000047 Binary files /dev/null and b/TTS/Kokoro/.venv/Lib/site-packages/spacy/lang/tr/__pycache__/examples.cpython-312.pyc differ diff --git a/TTS/Kokoro/.venv/Lib/site-packages/spacy/lang/tr/__pycache__/lex_attrs.cpython-312.pyc b/TTS/Kokoro/.venv/Lib/site-packages/spacy/lang/tr/__pycache__/lex_attrs.cpython-312.pyc new file mode 100644 index 0000000000000000000000000000000000000000..1be96d0e35b8b63045a40d686cff92c6ba3d24e2 Binary files /dev/null and b/TTS/Kokoro/.venv/Lib/site-packages/spacy/lang/tr/__pycache__/lex_attrs.cpython-312.pyc differ diff --git a/TTS/Kokoro/.venv/Lib/site-packages/spacy/lang/tr/__pycache__/stop_words.cpython-312.pyc b/TTS/Kokoro/.venv/Lib/site-packages/spacy/lang/tr/__pycache__/stop_words.cpython-312.pyc new file mode 100644 index 0000000000000000000000000000000000000000..78c21ce70ef858d7bd654be0da444d068a5a29bf Binary files /dev/null and b/TTS/Kokoro/.venv/Lib/site-packages/spacy/lang/tr/__pycache__/stop_words.cpython-312.pyc differ diff --git a/TTS/Kokoro/.venv/Lib/site-packages/spacy/lang/tr/__pycache__/syntax_iterators.cpython-312.pyc b/TTS/Kokoro/.venv/Lib/site-packages/spacy/lang/tr/__pycache__/syntax_iterators.cpython-312.pyc new file mode 100644 index 0000000000000000000000000000000000000000..6c2bc8c4b7268d7415acb4e40dce14581950ccfe Binary files /dev/null and b/TTS/Kokoro/.venv/Lib/site-packages/spacy/lang/tr/__pycache__/syntax_iterators.cpython-312.pyc differ diff --git a/TTS/Kokoro/.venv/Lib/site-packages/spacy/lang/tr/__pycache__/tokenizer_exceptions.cpython-312.pyc b/TTS/Kokoro/.venv/Lib/site-packages/spacy/lang/tr/__pycache__/tokenizer_exceptions.cpython-312.pyc new file mode 100644 index 0000000000000000000000000000000000000000..64809cbfc27a0d193c7c2ca48fbc09229e1429fe Binary files /dev/null and b/TTS/Kokoro/.venv/Lib/site-packages/spacy/lang/tr/__pycache__/tokenizer_exceptions.cpython-312.pyc differ diff --git a/TTS/Kokoro/.venv/Lib/site-packages/spacy/lang/tt/__pycache__/__init__.cpython-312.pyc b/TTS/Kokoro/.venv/Lib/site-packages/spacy/lang/tt/__pycache__/__init__.cpython-312.pyc new file mode 100644 index 0000000000000000000000000000000000000000..304b95bbf81fe3c9fcf3f6fdccb2153ba68eb206 Binary files /dev/null and b/TTS/Kokoro/.venv/Lib/site-packages/spacy/lang/tt/__pycache__/__init__.cpython-312.pyc differ diff --git a/TTS/Kokoro/.venv/Lib/site-packages/spacy/lang/tt/__pycache__/examples.cpython-312.pyc b/TTS/Kokoro/.venv/Lib/site-packages/spacy/lang/tt/__pycache__/examples.cpython-312.pyc new file mode 100644 index 0000000000000000000000000000000000000000..79245fbfad36002c7a6575cd312f3096977d3d7b Binary files /dev/null and b/TTS/Kokoro/.venv/Lib/site-packages/spacy/lang/tt/__pycache__/examples.cpython-312.pyc differ diff --git a/TTS/Kokoro/.venv/Lib/site-packages/spacy/lang/tt/__pycache__/lex_attrs.cpython-312.pyc b/TTS/Kokoro/.venv/Lib/site-packages/spacy/lang/tt/__pycache__/lex_attrs.cpython-312.pyc new file mode 100644 index 0000000000000000000000000000000000000000..61075f4b3f0ff9a906019b83b362beda96118b8f Binary files /dev/null and b/TTS/Kokoro/.venv/Lib/site-packages/spacy/lang/tt/__pycache__/lex_attrs.cpython-312.pyc differ diff --git a/TTS/Kokoro/.venv/Lib/site-packages/spacy/lang/tt/__pycache__/punctuation.cpython-312.pyc b/TTS/Kokoro/.venv/Lib/site-packages/spacy/lang/tt/__pycache__/punctuation.cpython-312.pyc new file mode 100644 index 0000000000000000000000000000000000000000..5cf3c6245fbc9f52f66389a16382f9502b544db5 Binary files /dev/null and b/TTS/Kokoro/.venv/Lib/site-packages/spacy/lang/tt/__pycache__/punctuation.cpython-312.pyc differ diff --git a/TTS/Kokoro/.venv/Lib/site-packages/spacy/lang/tt/__pycache__/stop_words.cpython-312.pyc b/TTS/Kokoro/.venv/Lib/site-packages/spacy/lang/tt/__pycache__/stop_words.cpython-312.pyc new file mode 100644 index 0000000000000000000000000000000000000000..4f20b841e97c8b41a2f3382d419674637f3cd923 Binary files /dev/null and b/TTS/Kokoro/.venv/Lib/site-packages/spacy/lang/tt/__pycache__/stop_words.cpython-312.pyc differ diff --git a/TTS/Kokoro/.venv/Lib/site-packages/spacy/lang/tt/__pycache__/tokenizer_exceptions.cpython-312.pyc b/TTS/Kokoro/.venv/Lib/site-packages/spacy/lang/tt/__pycache__/tokenizer_exceptions.cpython-312.pyc new file mode 100644 index 0000000000000000000000000000000000000000..c8b8b49d528414f4be181ded83f702c47769811b Binary files /dev/null and b/TTS/Kokoro/.venv/Lib/site-packages/spacy/lang/tt/__pycache__/tokenizer_exceptions.cpython-312.pyc differ diff --git a/TTS/Kokoro/.venv/Lib/site-packages/spacy/lang/uk/__pycache__/__init__.cpython-312.pyc b/TTS/Kokoro/.venv/Lib/site-packages/spacy/lang/uk/__pycache__/__init__.cpython-312.pyc new file mode 100644 index 0000000000000000000000000000000000000000..a947739abe747353e14bce2cb9d8a90a07f83caf Binary files /dev/null and b/TTS/Kokoro/.venv/Lib/site-packages/spacy/lang/uk/__pycache__/__init__.cpython-312.pyc differ diff --git a/TTS/Kokoro/.venv/Lib/site-packages/spacy/lang/uk/__pycache__/examples.cpython-312.pyc b/TTS/Kokoro/.venv/Lib/site-packages/spacy/lang/uk/__pycache__/examples.cpython-312.pyc new file mode 100644 index 0000000000000000000000000000000000000000..25edaec4a2bdc81f2895ef0fc9dc065db21fcc0f Binary files /dev/null and b/TTS/Kokoro/.venv/Lib/site-packages/spacy/lang/uk/__pycache__/examples.cpython-312.pyc differ diff --git a/TTS/Kokoro/.venv/Lib/site-packages/spacy/lang/uk/__pycache__/lemmatizer.cpython-312.pyc b/TTS/Kokoro/.venv/Lib/site-packages/spacy/lang/uk/__pycache__/lemmatizer.cpython-312.pyc new file mode 100644 index 0000000000000000000000000000000000000000..f1d024ef90721db3b5e86594b7e70875b3b0890d Binary files /dev/null and b/TTS/Kokoro/.venv/Lib/site-packages/spacy/lang/uk/__pycache__/lemmatizer.cpython-312.pyc differ diff --git a/TTS/Kokoro/.venv/Lib/site-packages/spacy/lang/uk/__pycache__/lex_attrs.cpython-312.pyc b/TTS/Kokoro/.venv/Lib/site-packages/spacy/lang/uk/__pycache__/lex_attrs.cpython-312.pyc new file mode 100644 index 0000000000000000000000000000000000000000..548979200579762248ad7d7bddc720d64cc66035 Binary files /dev/null and b/TTS/Kokoro/.venv/Lib/site-packages/spacy/lang/uk/__pycache__/lex_attrs.cpython-312.pyc differ diff --git a/TTS/Kokoro/.venv/Lib/site-packages/spacy/lang/uk/__pycache__/stop_words.cpython-312.pyc b/TTS/Kokoro/.venv/Lib/site-packages/spacy/lang/uk/__pycache__/stop_words.cpython-312.pyc new file mode 100644 index 0000000000000000000000000000000000000000..ad4edf63fea9f0e59654bf5bf9ac1a55ba639db5 Binary files /dev/null and b/TTS/Kokoro/.venv/Lib/site-packages/spacy/lang/uk/__pycache__/stop_words.cpython-312.pyc differ diff --git a/TTS/Kokoro/.venv/Lib/site-packages/spacy/lang/uk/__pycache__/tokenizer_exceptions.cpython-312.pyc b/TTS/Kokoro/.venv/Lib/site-packages/spacy/lang/uk/__pycache__/tokenizer_exceptions.cpython-312.pyc new file mode 100644 index 0000000000000000000000000000000000000000..4d3de1eb022ae919db436c45b5eb98e64fb24256 Binary files /dev/null and b/TTS/Kokoro/.venv/Lib/site-packages/spacy/lang/uk/__pycache__/tokenizer_exceptions.cpython-312.pyc differ diff --git a/TTS/Kokoro/.venv/Lib/site-packages/spacy/lang/ur/__pycache__/__init__.cpython-312.pyc b/TTS/Kokoro/.venv/Lib/site-packages/spacy/lang/ur/__pycache__/__init__.cpython-312.pyc new file mode 100644 index 0000000000000000000000000000000000000000..7923f53140649e2491e81e14002150fcaf578ee4 Binary files /dev/null and b/TTS/Kokoro/.venv/Lib/site-packages/spacy/lang/ur/__pycache__/__init__.cpython-312.pyc differ diff --git a/TTS/Kokoro/.venv/Lib/site-packages/spacy/lang/ur/__pycache__/examples.cpython-312.pyc b/TTS/Kokoro/.venv/Lib/site-packages/spacy/lang/ur/__pycache__/examples.cpython-312.pyc new file mode 100644 index 0000000000000000000000000000000000000000..ef51562bdf81964791fb05af59cc4e50d06aeb97 Binary files /dev/null and b/TTS/Kokoro/.venv/Lib/site-packages/spacy/lang/ur/__pycache__/examples.cpython-312.pyc differ diff --git a/TTS/Kokoro/.venv/Lib/site-packages/spacy/lang/ur/__pycache__/lex_attrs.cpython-312.pyc b/TTS/Kokoro/.venv/Lib/site-packages/spacy/lang/ur/__pycache__/lex_attrs.cpython-312.pyc new file mode 100644 index 0000000000000000000000000000000000000000..faf0e5e71f2f3f158239eb4c79fbb6c44a0d74b8 Binary files /dev/null and b/TTS/Kokoro/.venv/Lib/site-packages/spacy/lang/ur/__pycache__/lex_attrs.cpython-312.pyc differ diff --git a/TTS/Kokoro/.venv/Lib/site-packages/spacy/lang/ur/__pycache__/punctuation.cpython-312.pyc b/TTS/Kokoro/.venv/Lib/site-packages/spacy/lang/ur/__pycache__/punctuation.cpython-312.pyc new file mode 100644 index 0000000000000000000000000000000000000000..10cb28f17e7cf26c1aefd023acfae8dc1a57527c Binary files /dev/null and b/TTS/Kokoro/.venv/Lib/site-packages/spacy/lang/ur/__pycache__/punctuation.cpython-312.pyc differ diff --git a/TTS/Kokoro/.venv/Lib/site-packages/spacy/lang/ur/__pycache__/stop_words.cpython-312.pyc b/TTS/Kokoro/.venv/Lib/site-packages/spacy/lang/ur/__pycache__/stop_words.cpython-312.pyc new file mode 100644 index 0000000000000000000000000000000000000000..763874b78a8710f012f1973d187d4fd367fee662 Binary files /dev/null and b/TTS/Kokoro/.venv/Lib/site-packages/spacy/lang/ur/__pycache__/stop_words.cpython-312.pyc differ diff --git a/TTS/Kokoro/.venv/Lib/site-packages/spacy/lang/vi/__pycache__/__init__.cpython-312.pyc b/TTS/Kokoro/.venv/Lib/site-packages/spacy/lang/vi/__pycache__/__init__.cpython-312.pyc new file mode 100644 index 0000000000000000000000000000000000000000..55903acd66183f6033ec8fb2dbdab6fdf678ffbb Binary files /dev/null and b/TTS/Kokoro/.venv/Lib/site-packages/spacy/lang/vi/__pycache__/__init__.cpython-312.pyc differ diff --git a/TTS/Kokoro/.venv/Lib/site-packages/spacy/lang/vi/__pycache__/examples.cpython-312.pyc b/TTS/Kokoro/.venv/Lib/site-packages/spacy/lang/vi/__pycache__/examples.cpython-312.pyc new file mode 100644 index 0000000000000000000000000000000000000000..03241198a769d566aae9c2ef0c60c0e1fdd17561 Binary files /dev/null and b/TTS/Kokoro/.venv/Lib/site-packages/spacy/lang/vi/__pycache__/examples.cpython-312.pyc differ diff --git a/TTS/Kokoro/.venv/Lib/site-packages/spacy/lang/vi/__pycache__/lex_attrs.cpython-312.pyc b/TTS/Kokoro/.venv/Lib/site-packages/spacy/lang/vi/__pycache__/lex_attrs.cpython-312.pyc new file mode 100644 index 0000000000000000000000000000000000000000..a00aa3f6ac36454aa3b6cb9d746dec3ad0d1371c Binary files /dev/null and b/TTS/Kokoro/.venv/Lib/site-packages/spacy/lang/vi/__pycache__/lex_attrs.cpython-312.pyc differ diff --git a/TTS/Kokoro/.venv/Lib/site-packages/spacy/lang/vi/__pycache__/stop_words.cpython-312.pyc b/TTS/Kokoro/.venv/Lib/site-packages/spacy/lang/vi/__pycache__/stop_words.cpython-312.pyc new file mode 100644 index 0000000000000000000000000000000000000000..05ebf4fbd4cfca08723c92e7264838a53c595d62 Binary files /dev/null and b/TTS/Kokoro/.venv/Lib/site-packages/spacy/lang/vi/__pycache__/stop_words.cpython-312.pyc differ diff --git a/TTS/Kokoro/.venv/Lib/site-packages/spacy/lang/xx/__pycache__/__init__.cpython-312.pyc b/TTS/Kokoro/.venv/Lib/site-packages/spacy/lang/xx/__pycache__/__init__.cpython-312.pyc new file mode 100644 index 0000000000000000000000000000000000000000..787fb9c8eeeb0bce5ebf214c72a34f9012c52b21 Binary files /dev/null and b/TTS/Kokoro/.venv/Lib/site-packages/spacy/lang/xx/__pycache__/__init__.cpython-312.pyc differ diff --git a/TTS/Kokoro/.venv/Lib/site-packages/spacy/lang/xx/__pycache__/examples.cpython-312.pyc b/TTS/Kokoro/.venv/Lib/site-packages/spacy/lang/xx/__pycache__/examples.cpython-312.pyc new file mode 100644 index 0000000000000000000000000000000000000000..7e02cc8b1c80a2ca91b2234a5d0730e3a74bfdbb Binary files /dev/null and b/TTS/Kokoro/.venv/Lib/site-packages/spacy/lang/xx/__pycache__/examples.cpython-312.pyc differ diff --git a/TTS/Kokoro/.venv/Lib/site-packages/spacy/lang/yo/__pycache__/__init__.cpython-312.pyc b/TTS/Kokoro/.venv/Lib/site-packages/spacy/lang/yo/__pycache__/__init__.cpython-312.pyc new file mode 100644 index 0000000000000000000000000000000000000000..1ed5d7976d67482b1c019d94d0f9a971884d04f4 Binary files /dev/null and b/TTS/Kokoro/.venv/Lib/site-packages/spacy/lang/yo/__pycache__/__init__.cpython-312.pyc differ diff --git a/TTS/Kokoro/.venv/Lib/site-packages/spacy/lang/yo/__pycache__/examples.cpython-312.pyc b/TTS/Kokoro/.venv/Lib/site-packages/spacy/lang/yo/__pycache__/examples.cpython-312.pyc new file mode 100644 index 0000000000000000000000000000000000000000..10aae831f7911a620d37f99be11cd258cea90160 Binary files /dev/null and b/TTS/Kokoro/.venv/Lib/site-packages/spacy/lang/yo/__pycache__/examples.cpython-312.pyc differ diff --git a/TTS/Kokoro/.venv/Lib/site-packages/spacy/lang/yo/__pycache__/lex_attrs.cpython-312.pyc b/TTS/Kokoro/.venv/Lib/site-packages/spacy/lang/yo/__pycache__/lex_attrs.cpython-312.pyc new file mode 100644 index 0000000000000000000000000000000000000000..a6b7abe07867f750b80967b50e626ea81e46bfe5 Binary files /dev/null and b/TTS/Kokoro/.venv/Lib/site-packages/spacy/lang/yo/__pycache__/lex_attrs.cpython-312.pyc differ diff --git a/TTS/Kokoro/.venv/Lib/site-packages/spacy/lang/yo/__pycache__/stop_words.cpython-312.pyc b/TTS/Kokoro/.venv/Lib/site-packages/spacy/lang/yo/__pycache__/stop_words.cpython-312.pyc new file mode 100644 index 0000000000000000000000000000000000000000..d9a9220e183bd6937d017a28e35919724b7a4ac1 Binary files /dev/null and b/TTS/Kokoro/.venv/Lib/site-packages/spacy/lang/yo/__pycache__/stop_words.cpython-312.pyc differ diff --git a/TTS/Kokoro/.venv/Lib/site-packages/spacy/lang/zh/__pycache__/__init__.cpython-312.pyc b/TTS/Kokoro/.venv/Lib/site-packages/spacy/lang/zh/__pycache__/__init__.cpython-312.pyc new file mode 100644 index 0000000000000000000000000000000000000000..45348251804a0e14d7bf5d67702a306f1ab06b10 Binary files /dev/null and b/TTS/Kokoro/.venv/Lib/site-packages/spacy/lang/zh/__pycache__/__init__.cpython-312.pyc differ diff --git a/TTS/Kokoro/.venv/Lib/site-packages/spacy/lang/zh/__pycache__/examples.cpython-312.pyc b/TTS/Kokoro/.venv/Lib/site-packages/spacy/lang/zh/__pycache__/examples.cpython-312.pyc new file mode 100644 index 0000000000000000000000000000000000000000..a2669acacaa94dc47bb0e006d6c2ae0219274087 Binary files /dev/null and b/TTS/Kokoro/.venv/Lib/site-packages/spacy/lang/zh/__pycache__/examples.cpython-312.pyc differ diff --git a/TTS/Kokoro/.venv/Lib/site-packages/spacy/lang/zh/__pycache__/lex_attrs.cpython-312.pyc b/TTS/Kokoro/.venv/Lib/site-packages/spacy/lang/zh/__pycache__/lex_attrs.cpython-312.pyc new file mode 100644 index 0000000000000000000000000000000000000000..85fe0edd39b1b08ec9a7236de7660250d1b30436 Binary files /dev/null and b/TTS/Kokoro/.venv/Lib/site-packages/spacy/lang/zh/__pycache__/lex_attrs.cpython-312.pyc differ diff --git a/TTS/Kokoro/.venv/Lib/site-packages/spacy/lang/zh/__pycache__/stop_words.cpython-312.pyc b/TTS/Kokoro/.venv/Lib/site-packages/spacy/lang/zh/__pycache__/stop_words.cpython-312.pyc new file mode 100644 index 0000000000000000000000000000000000000000..d8002f9f863296cce1271aec7d11a8a66d23bb6b Binary files /dev/null and b/TTS/Kokoro/.venv/Lib/site-packages/spacy/lang/zh/__pycache__/stop_words.cpython-312.pyc differ diff --git a/TTS/Kokoro/.venv/Lib/site-packages/spacy/matcher/__pycache__/__init__.cpython-312.pyc b/TTS/Kokoro/.venv/Lib/site-packages/spacy/matcher/__pycache__/__init__.cpython-312.pyc new file mode 100644 index 0000000000000000000000000000000000000000..07d84fe2831b4019fc22aac9391bfe999d5d70a0 Binary files /dev/null and b/TTS/Kokoro/.venv/Lib/site-packages/spacy/matcher/__pycache__/__init__.cpython-312.pyc differ diff --git a/TTS/Kokoro/.venv/Lib/site-packages/spacy/ml/__pycache__/__init__.cpython-312.pyc b/TTS/Kokoro/.venv/Lib/site-packages/spacy/ml/__pycache__/__init__.cpython-312.pyc new file mode 100644 index 0000000000000000000000000000000000000000..a30d7a38209dffd23782139ce44c94c0a4986351 Binary files /dev/null and b/TTS/Kokoro/.venv/Lib/site-packages/spacy/ml/__pycache__/__init__.cpython-312.pyc differ diff --git a/TTS/Kokoro/.venv/Lib/site-packages/spacy/ml/__pycache__/_character_embed.cpython-312.pyc b/TTS/Kokoro/.venv/Lib/site-packages/spacy/ml/__pycache__/_character_embed.cpython-312.pyc new file mode 100644 index 0000000000000000000000000000000000000000..3b5cd0eafdccac1b391917325643ad7131ebb571 Binary files /dev/null and b/TTS/Kokoro/.venv/Lib/site-packages/spacy/ml/__pycache__/_character_embed.cpython-312.pyc differ diff --git a/TTS/Kokoro/.venv/Lib/site-packages/spacy/ml/__pycache__/_precomputable_affine.cpython-312.pyc b/TTS/Kokoro/.venv/Lib/site-packages/spacy/ml/__pycache__/_precomputable_affine.cpython-312.pyc new file mode 100644 index 0000000000000000000000000000000000000000..b9bf8d4cb271b10af425b3c2e8796b6f4105a8ab Binary files /dev/null and b/TTS/Kokoro/.venv/Lib/site-packages/spacy/ml/__pycache__/_precomputable_affine.cpython-312.pyc differ diff --git a/TTS/Kokoro/.venv/Lib/site-packages/spacy/ml/__pycache__/callbacks.cpython-312.pyc b/TTS/Kokoro/.venv/Lib/site-packages/spacy/ml/__pycache__/callbacks.cpython-312.pyc new file mode 100644 index 0000000000000000000000000000000000000000..5aa54458f765303cf502cbff3500dd3aa594a31d Binary files /dev/null and b/TTS/Kokoro/.venv/Lib/site-packages/spacy/ml/__pycache__/callbacks.cpython-312.pyc differ diff --git a/TTS/Kokoro/.venv/Lib/site-packages/spacy/ml/__pycache__/extract_ngrams.cpython-312.pyc b/TTS/Kokoro/.venv/Lib/site-packages/spacy/ml/__pycache__/extract_ngrams.cpython-312.pyc new file mode 100644 index 0000000000000000000000000000000000000000..13363063d3fafca59ac8918e3e4a8f1a8881dc5d Binary files /dev/null and b/TTS/Kokoro/.venv/Lib/site-packages/spacy/ml/__pycache__/extract_ngrams.cpython-312.pyc differ diff --git a/TTS/Kokoro/.venv/Lib/site-packages/spacy/ml/__pycache__/extract_spans.cpython-312.pyc b/TTS/Kokoro/.venv/Lib/site-packages/spacy/ml/__pycache__/extract_spans.cpython-312.pyc new file mode 100644 index 0000000000000000000000000000000000000000..930a568337172d6740fa6cd503508cd42cd97900 Binary files /dev/null and b/TTS/Kokoro/.venv/Lib/site-packages/spacy/ml/__pycache__/extract_spans.cpython-312.pyc differ diff --git a/TTS/Kokoro/.venv/Lib/site-packages/spacy/ml/__pycache__/featureextractor.cpython-312.pyc b/TTS/Kokoro/.venv/Lib/site-packages/spacy/ml/__pycache__/featureextractor.cpython-312.pyc new file mode 100644 index 0000000000000000000000000000000000000000..adee04ff6150fbfbec0629f61d4a60b85d4f35cc Binary files /dev/null and b/TTS/Kokoro/.venv/Lib/site-packages/spacy/ml/__pycache__/featureextractor.cpython-312.pyc differ diff --git a/TTS/Kokoro/.venv/Lib/site-packages/spacy/ml/__pycache__/staticvectors.cpython-312.pyc b/TTS/Kokoro/.venv/Lib/site-packages/spacy/ml/__pycache__/staticvectors.cpython-312.pyc new file mode 100644 index 0000000000000000000000000000000000000000..a36544258e48e605d7001c3b1145e31f189bfbbd Binary files /dev/null and b/TTS/Kokoro/.venv/Lib/site-packages/spacy/ml/__pycache__/staticvectors.cpython-312.pyc differ diff --git a/TTS/Kokoro/.venv/Lib/site-packages/spacy/ml/__pycache__/tb_framework.cpython-312.pyc b/TTS/Kokoro/.venv/Lib/site-packages/spacy/ml/__pycache__/tb_framework.cpython-312.pyc new file mode 100644 index 0000000000000000000000000000000000000000..c7af0a23d8d918e78aa3db4441921b0ffeb657b3 Binary files /dev/null and b/TTS/Kokoro/.venv/Lib/site-packages/spacy/ml/__pycache__/tb_framework.cpython-312.pyc differ diff --git a/TTS/Kokoro/.venv/Lib/site-packages/spacy/ml/models/__init__.py b/TTS/Kokoro/.venv/Lib/site-packages/spacy/ml/models/__init__.py new file mode 100644 index 0000000000000000000000000000000000000000..75697b606196369fc4f38acf420bb78e80d1f10d --- /dev/null +++ b/TTS/Kokoro/.venv/Lib/site-packages/spacy/ml/models/__init__.py @@ -0,0 +1,8 @@ +from .entity_linker import * # noqa +from .multi_task import * # noqa +from .parser import * # noqa +from .span_finder import * # noqa +from .spancat import * # noqa +from .tagger import * # noqa +from .textcat import * # noqa +from .tok2vec import * # noqa diff --git a/TTS/Kokoro/.venv/Lib/site-packages/spacy/ml/models/__pycache__/__init__.cpython-312.pyc b/TTS/Kokoro/.venv/Lib/site-packages/spacy/ml/models/__pycache__/__init__.cpython-312.pyc new file mode 100644 index 0000000000000000000000000000000000000000..6390d9b6d1ca3dbdd13150fb30f98ee656b5e9d3 Binary files /dev/null and b/TTS/Kokoro/.venv/Lib/site-packages/spacy/ml/models/__pycache__/__init__.cpython-312.pyc differ diff --git a/TTS/Kokoro/.venv/Lib/site-packages/spacy/ml/models/__pycache__/entity_linker.cpython-312.pyc b/TTS/Kokoro/.venv/Lib/site-packages/spacy/ml/models/__pycache__/entity_linker.cpython-312.pyc new file mode 100644 index 0000000000000000000000000000000000000000..e4ca7b823a05383776c700f20667cfb9cb4b5c8c Binary files /dev/null and b/TTS/Kokoro/.venv/Lib/site-packages/spacy/ml/models/__pycache__/entity_linker.cpython-312.pyc differ diff --git a/TTS/Kokoro/.venv/Lib/site-packages/spacy/ml/models/__pycache__/multi_task.cpython-312.pyc b/TTS/Kokoro/.venv/Lib/site-packages/spacy/ml/models/__pycache__/multi_task.cpython-312.pyc new file mode 100644 index 0000000000000000000000000000000000000000..964c8d57ef502780e8c242db0eda59b905ddc9ca Binary files /dev/null and b/TTS/Kokoro/.venv/Lib/site-packages/spacy/ml/models/__pycache__/multi_task.cpython-312.pyc differ diff --git a/TTS/Kokoro/.venv/Lib/site-packages/spacy/ml/models/__pycache__/parser.cpython-312.pyc b/TTS/Kokoro/.venv/Lib/site-packages/spacy/ml/models/__pycache__/parser.cpython-312.pyc new file mode 100644 index 0000000000000000000000000000000000000000..c4f1e7a0819b9b134f02945f3c72e76a208a63aa Binary files /dev/null and b/TTS/Kokoro/.venv/Lib/site-packages/spacy/ml/models/__pycache__/parser.cpython-312.pyc differ diff --git a/TTS/Kokoro/.venv/Lib/site-packages/spacy/ml/models/__pycache__/span_finder.cpython-312.pyc b/TTS/Kokoro/.venv/Lib/site-packages/spacy/ml/models/__pycache__/span_finder.cpython-312.pyc new file mode 100644 index 0000000000000000000000000000000000000000..869a2a4c7a95ec811cde7885e36e1573ec123342 Binary files /dev/null and b/TTS/Kokoro/.venv/Lib/site-packages/spacy/ml/models/__pycache__/span_finder.cpython-312.pyc differ diff --git a/TTS/Kokoro/.venv/Lib/site-packages/spacy/ml/models/__pycache__/spancat.cpython-312.pyc b/TTS/Kokoro/.venv/Lib/site-packages/spacy/ml/models/__pycache__/spancat.cpython-312.pyc new file mode 100644 index 0000000000000000000000000000000000000000..700c9818a3e1be11414a9cadc6ef98b4d95c196b Binary files /dev/null and b/TTS/Kokoro/.venv/Lib/site-packages/spacy/ml/models/__pycache__/spancat.cpython-312.pyc differ diff --git a/TTS/Kokoro/.venv/Lib/site-packages/spacy/ml/models/__pycache__/tagger.cpython-312.pyc b/TTS/Kokoro/.venv/Lib/site-packages/spacy/ml/models/__pycache__/tagger.cpython-312.pyc new file mode 100644 index 0000000000000000000000000000000000000000..09063ac60dddb3982a14ddf20e95436f244b42a7 Binary files /dev/null and b/TTS/Kokoro/.venv/Lib/site-packages/spacy/ml/models/__pycache__/tagger.cpython-312.pyc differ diff --git a/TTS/Kokoro/.venv/Lib/site-packages/spacy/ml/models/__pycache__/textcat.cpython-312.pyc b/TTS/Kokoro/.venv/Lib/site-packages/spacy/ml/models/__pycache__/textcat.cpython-312.pyc new file mode 100644 index 0000000000000000000000000000000000000000..e775673d05d41bf7dd1165056170c29f89f1b58b Binary files /dev/null and b/TTS/Kokoro/.venv/Lib/site-packages/spacy/ml/models/__pycache__/textcat.cpython-312.pyc differ diff --git a/TTS/Kokoro/.venv/Lib/site-packages/spacy/ml/models/__pycache__/tok2vec.cpython-312.pyc b/TTS/Kokoro/.venv/Lib/site-packages/spacy/ml/models/__pycache__/tok2vec.cpython-312.pyc new file mode 100644 index 0000000000000000000000000000000000000000..0f2c912ab2bea9ec53b83636fadfccb5fde043a4 Binary files /dev/null and b/TTS/Kokoro/.venv/Lib/site-packages/spacy/ml/models/__pycache__/tok2vec.cpython-312.pyc differ diff --git a/TTS/Kokoro/.venv/Lib/site-packages/spacy/ml/models/entity_linker.py b/TTS/Kokoro/.venv/Lib/site-packages/spacy/ml/models/entity_linker.py new file mode 100644 index 0000000000000000000000000000000000000000..38e5015d062cf938349343954b6e04df72580284 --- /dev/null +++ b/TTS/Kokoro/.venv/Lib/site-packages/spacy/ml/models/entity_linker.py @@ -0,0 +1,128 @@ +from pathlib import Path +from typing import Callable, Iterable, List, Optional, Tuple + +from thinc.api import ( + Linear, + Maxout, + Model, + Ragged, + chain, + list2ragged, + reduce_mean, + residual, + tuplify, +) +from thinc.types import Floats2d + +from ...errors import Errors +from ...kb import ( + Candidate, + InMemoryLookupKB, + KnowledgeBase, + get_candidates, + get_candidates_batch, +) +from ...tokens import Doc, Span +from ...util import registry +from ...vocab import Vocab +from ..extract_spans import extract_spans + + +def build_nel_encoder( + tok2vec: Model, nO: Optional[int] = None +) -> Model[List[Doc], Floats2d]: + with Model.define_operators({">>": chain, "&": tuplify}): + token_width = tok2vec.maybe_get_dim("nO") + output_layer = Linear(nO=nO, nI=token_width) + model = ( + ((tok2vec >> list2ragged()) & build_span_maker()) + >> extract_spans() + >> reduce_mean() + >> residual(Maxout(nO=token_width, nI=token_width, nP=2, dropout=0.0)) # type: ignore + >> output_layer + ) + model.set_ref("output_layer", output_layer) + model.set_ref("tok2vec", tok2vec) + # flag to show this isn't legacy + model.attrs["include_span_maker"] = True + return model + + +def build_span_maker(n_sents: int = 0) -> Model: + model: Model = Model("span_maker", forward=span_maker_forward) + model.attrs["n_sents"] = n_sents + return model + + +def span_maker_forward(model, docs: List[Doc], is_train) -> Tuple[Ragged, Callable]: + ops = model.ops + n_sents = model.attrs["n_sents"] + candidates = [] + for doc in docs: + cands = [] + try: + sentences = [s for s in doc.sents] + except ValueError: + # no sentence info, normal in initialization + for tok in doc: + tok.is_sent_start = tok.i == 0 + sentences = [doc[:]] + for ent in doc.ents: + try: + # find the sentence in the list of sentences. + sent_index = sentences.index(ent.sent) + except AttributeError: + # Catch the exception when ent.sent is None and provide a user-friendly warning + raise RuntimeError(Errors.E030) from None + # get n previous sentences, if there are any + start_sentence = max(0, sent_index - n_sents) + # get n posterior sentences, or as many < n as there are + end_sentence = min(len(sentences) - 1, sent_index + n_sents) + # get token positions + start_token = sentences[start_sentence].start + end_token = sentences[end_sentence].end + # save positions for extraction + cands.append((start_token, end_token)) + + candidates.append(ops.asarray2i(cands)) + lengths = model.ops.asarray1i([len(cands) for cands in candidates]) + out = Ragged(model.ops.flatten(candidates), lengths) + # because this is just rearranging docs, the backprop does nothing + return out, lambda x: [] + + +def load_kb( + kb_path: Path, +) -> Callable[[Vocab], KnowledgeBase]: + def kb_from_file(vocab: Vocab): + kb = InMemoryLookupKB(vocab, entity_vector_length=1) + kb.from_disk(kb_path) + return kb + + return kb_from_file + + +def empty_kb_for_config() -> Callable[[Vocab, int], KnowledgeBase]: + def empty_kb_factory(vocab: Vocab, entity_vector_length: int): + return InMemoryLookupKB(vocab=vocab, entity_vector_length=entity_vector_length) + + return empty_kb_factory + + +def empty_kb( + entity_vector_length: int, +) -> Callable[[Vocab], KnowledgeBase]: + def empty_kb_factory(vocab: Vocab): + return InMemoryLookupKB(vocab=vocab, entity_vector_length=entity_vector_length) + + return empty_kb_factory + + +def create_candidates() -> Callable[[KnowledgeBase, Span], Iterable[Candidate]]: + return get_candidates + + +def create_candidates_batch() -> ( + Callable[[KnowledgeBase, Iterable[Span]], Iterable[Iterable[Candidate]]] +): + return get_candidates_batch diff --git a/TTS/Kokoro/.venv/Lib/site-packages/spacy/ml/models/multi_task.py b/TTS/Kokoro/.venv/Lib/site-packages/spacy/ml/models/multi_task.py new file mode 100644 index 0000000000000000000000000000000000000000..c81b3dd43b0101d5cc25b694eff06366ea76f012 --- /dev/null +++ b/TTS/Kokoro/.venv/Lib/site-packages/spacy/ml/models/multi_task.py @@ -0,0 +1,270 @@ +from functools import partial +from typing import TYPE_CHECKING, Any, Callable, Iterable, List, Optional, Tuple, cast + +import numpy +from thinc.api import ( + CosineDistance, + L2Distance, + LayerNorm, + Linear, + Maxout, + Model, + MultiSoftmax, + Softmax, + chain, + list2array, + to_categorical, + zero_init, +) +from thinc.loss import Loss +from thinc.types import Floats2d, Ints1d + +from ...attrs import ID, ORTH +from ...errors import Errors +from ...util import OOV_RANK, registry +from ...vectors import Mode as VectorsMode + +if TYPE_CHECKING: + # This lets us add type hints for mypy etc. without causing circular imports + from ...tokens.doc import Doc # noqa: F401 + from ...vocab import Vocab # noqa: F401 + + +def create_pretrain_vectors( + maxout_pieces: int, hidden_size: int, loss: str +) -> Callable[["Vocab", Model], Model]: + def create_vectors_objective(vocab: "Vocab", tok2vec: Model) -> Model: + if vocab.vectors.shape[1] == 0: + raise ValueError(Errors.E875) + model = build_cloze_multi_task_model( + vocab, tok2vec, hidden_size=hidden_size, maxout_pieces=maxout_pieces + ) + model.attrs["loss"] = create_vectors_loss() + return model + + def create_vectors_loss() -> Callable: + distance: Loss + if loss == "cosine": + distance = CosineDistance(normalize=True, ignore_zeros=True) + return partial(get_vectors_loss, distance=distance) + elif loss == "L2": + distance = L2Distance(normalize=True) + return partial(get_vectors_loss, distance=distance) + else: + raise ValueError(Errors.E906.format(found=loss, supported="'cosine', 'L2'")) + + return create_vectors_objective + + +def create_pretrain_characters( + maxout_pieces: int, hidden_size: int, n_characters: int +) -> Callable[["Vocab", Model], Model]: + def create_characters_objective(vocab: "Vocab", tok2vec: Model) -> Model: + model = build_cloze_characters_multi_task_model( + vocab, + tok2vec, + hidden_size=hidden_size, + maxout_pieces=maxout_pieces, + nr_char=n_characters, + ) + model.attrs["loss"] = partial(get_characters_loss, nr_char=n_characters) + return model + + return create_characters_objective + + +def get_vectors_loss(ops, docs, prediction, distance): + """Compute a loss based on a distance between the documents' vectors and + the prediction. + """ + vocab = docs[0].vocab + if vocab.vectors.mode == VectorsMode.default: + # The simplest way to implement this would be to vstack the + # token.vector values, but that's a bit inefficient, especially on GPU. + # Instead we fetch the index into the vectors table for each of our + # tokens, and look them up all at once. This prevents data copying. + ids = ops.flatten([doc.to_array(ID).ravel() for doc in docs]) + target = docs[0].vocab.vectors.data[ids] + target[ids == OOV_RANK] = 0 + d_target, loss = distance(prediction, target) + elif vocab.vectors.mode == VectorsMode.floret: + keys = ops.flatten([cast(Ints1d, doc.to_array(ORTH)) for doc in docs]) + target = vocab.vectors.get_batch(keys) + target = ops.as_contig(target) + d_target, loss = distance(prediction, target) + else: + raise ValueError(Errors.E850.format(mode=vocab.vectors.mode)) + return loss, d_target + + +def get_characters_loss(ops, docs, prediction, nr_char): + """Compute a loss based on a number of characters predicted from the docs.""" + target_ids = numpy.vstack([doc.to_utf8_array(nr_char=nr_char) for doc in docs]) + target_ids = target_ids.reshape((-1,)) + target = ops.asarray(to_categorical(target_ids, n_classes=256), dtype="f") + target = target.reshape((-1, 256 * nr_char)) + diff = prediction - target + loss = (diff**2).sum() + d_target = diff / float(prediction.shape[0]) + return loss, d_target + + +def build_multi_task_model( + tok2vec: Model, + maxout_pieces: int, + token_vector_width: int, + nO: Optional[int] = None, +) -> Model: + softmax = Softmax(nO=nO, nI=token_vector_width * 2) + model = chain( + tok2vec, + Maxout( + nO=token_vector_width * 2, + nI=token_vector_width, + nP=maxout_pieces, + dropout=0.0, + ), + LayerNorm(token_vector_width * 2), + softmax, + ) + model.set_ref("tok2vec", tok2vec) + model.set_ref("output_layer", softmax) + return model + + +def build_cloze_multi_task_model( + vocab: "Vocab", tok2vec: Model, maxout_pieces: int, hidden_size: int +) -> Model: + nO = vocab.vectors.shape[1] + output_layer = chain( + cast(Model[List["Floats2d"], Floats2d], list2array()), + Maxout( + nO=hidden_size, + nI=tok2vec.get_dim("nO"), + nP=maxout_pieces, + normalize=True, + dropout=0.0, + ), + Linear(nO=nO, nI=hidden_size, init_W=zero_init), + ) + model = chain(tok2vec, output_layer) + model = build_masked_language_model(vocab, model) + model.set_ref("tok2vec", tok2vec) + model.set_ref("output_layer", output_layer) + return model + + +def build_cloze_characters_multi_task_model( + vocab: "Vocab", tok2vec: Model, maxout_pieces: int, hidden_size: int, nr_char: int +) -> Model: + output_layer = chain( + cast(Model[List["Floats2d"], Floats2d], list2array()), + Maxout(nO=hidden_size, nP=maxout_pieces), + LayerNorm(nI=hidden_size), + MultiSoftmax([256] * nr_char, nI=hidden_size), # type: ignore[arg-type] + ) + model = build_masked_language_model(vocab, chain(tok2vec, output_layer)) + model.set_ref("tok2vec", tok2vec) + model.set_ref("output_layer", output_layer) + return model + + +def build_masked_language_model( + vocab: "Vocab", wrapped_model: Model, mask_prob: float = 0.15 +) -> Model: + """Convert a model into a BERT-style masked language model""" + random_words = _RandomWords(vocab) + + def mlm_forward(model, docs, is_train): + mask, docs = _apply_mask(docs, random_words, mask_prob=mask_prob) + mask = model.ops.asarray(mask).reshape((mask.shape[0], 1)) + output, backprop = model.layers[0](docs, is_train) + + def mlm_backward(d_output): + d_output *= 1 - mask + return backprop(d_output) + + return output, mlm_backward + + def mlm_initialize(model: Model, X=None, Y=None): + wrapped = model.layers[0] + wrapped.initialize(X=X, Y=Y) + for dim in wrapped.dim_names: + if wrapped.has_dim(dim): + model.set_dim(dim, wrapped.get_dim(dim)) + + mlm_model: Model = Model( + "masked-language-model", + mlm_forward, + layers=[wrapped_model], + init=mlm_initialize, + refs={"wrapped": wrapped_model}, + dims={dim: None for dim in wrapped_model.dim_names}, + ) + mlm_model.set_ref("wrapped", wrapped_model) + return mlm_model + + +class _RandomWords: + def __init__(self, vocab: "Vocab") -> None: + # Extract lexeme representations + self.words = [lex.text for lex in vocab if lex.prob != 0.0] + self.words = self.words[:10000] + + # Compute normalized lexeme probabilities + probs = [lex.prob for lex in vocab if lex.prob != 0.0] + probs = probs[:10000] + probs: numpy.ndarray = numpy.exp(numpy.array(probs, dtype="f")) + probs /= probs.sum() + self.probs = probs + + # Initialize cache + self._cache: List[int] = [] + + def next(self) -> str: + if not self._cache: + self._cache.extend( + numpy.random.choice(len(self.words), 10000, p=self.probs) + ) + index = self._cache.pop() + return self.words[index] + + +def _apply_mask( + docs: Iterable["Doc"], random_words: _RandomWords, mask_prob: float = 0.15 +) -> Tuple[numpy.ndarray, List["Doc"]]: + # This needs to be here to avoid circular imports + from ...tokens.doc import Doc # noqa: F811 + + N = sum(len(doc) for doc in docs) + mask = numpy.random.uniform(0.0, 1.0, (N,)) + mask = mask >= mask_prob + i = 0 + masked_docs = [] + for doc in docs: + words = [] + for token in doc: + if not mask[i]: + word = _replace_word(token.text, random_words) + else: + word = token.text + words.append(word) + i += 1 + spaces = [bool(w.whitespace_) for w in doc] + # NB: If you change this implementation to instead modify + # the docs in place, take care that the IDs reflect the original + # words. Currently we use the original docs to make the vectors + # for the target, so we don't lose the original tokens. But if + # you modified the docs in place here, you would. + masked_docs.append(Doc(doc.vocab, words=words, spaces=spaces)) + return mask, masked_docs + + +def _replace_word(word: str, random_words: _RandomWords, mask: str = "[MASK]") -> str: + roll = numpy.random.random() + if roll < 0.8: + return mask + elif roll < 0.9: + return random_words.next() + else: + return word diff --git a/TTS/Kokoro/.venv/Lib/site-packages/spacy/ml/models/parser.py b/TTS/Kokoro/.venv/Lib/site-packages/spacy/ml/models/parser.py new file mode 100644 index 0000000000000000000000000000000000000000..011874140ef488353c56e4de829b470d43138c54 --- /dev/null +++ b/TTS/Kokoro/.venv/Lib/site-packages/spacy/ml/models/parser.py @@ -0,0 +1,174 @@ +from typing import List, Optional, cast + +from thinc.api import Linear, Model, chain, list2array, use_ops, zero_init +from thinc.types import Floats2d + +from ...compat import Literal +from ...errors import Errors +from ...tokens import Doc +from ...util import registry +from .._precomputable_affine import PrecomputableAffine +from ..tb_framework import TransitionModel + + +def build_tb_parser_model( + tok2vec: Model[List[Doc], List[Floats2d]], + state_type: Literal["parser", "ner"], + extra_state_tokens: bool, + hidden_width: int, + maxout_pieces: int, + use_upper: bool, + nO: Optional[int] = None, +) -> Model: + """ + Build a transition-based parser model. Can apply to NER or dependency-parsing. + + Transition-based parsing is an approach to structured prediction where the + task of predicting the structure is mapped to a series of state transitions. + You might find this tutorial helpful as background: + https://explosion.ai/blog/parsing-english-in-python + + The neural network state prediction model consists of either two or three + subnetworks: + + * tok2vec: Map each token into a vector representations. This subnetwork + is run once for each batch. + * lower: Construct a feature-specific vector for each (token, feature) pair. + This is also run once for each batch. Constructing the state + representation is then simply a matter of summing the component features + and applying the non-linearity. + * upper (optional): A feed-forward network that predicts scores from the + state representation. If not present, the output from the lower model is + used as action scores directly. + + tok2vec (Model[List[Doc], List[Floats2d]]): + Subnetwork to map tokens into vector representations. + state_type (str): + String value denoting the type of parser model: "parser" or "ner" + extra_state_tokens (bool): Whether or not to use additional tokens in the context + to construct the state vector. Defaults to `False`, which means 3 and 8 + for the NER and parser respectively. When set to `True`, this would become 6 + feature sets (for the NER) or 13 (for the parser). + hidden_width (int): The width of the hidden layer. + maxout_pieces (int): How many pieces to use in the state prediction layer. + Recommended values are 1, 2 or 3. If 1, the maxout non-linearity + is replaced with a ReLu non-linearity if use_upper=True, and no + non-linearity if use_upper=False. + use_upper (bool): Whether to use an additional hidden layer after the state + vector in order to predict the action scores. It is recommended to set + this to False for large pretrained models such as transformers, and True + for smaller networks. The upper layer is computed on CPU, which becomes + a bottleneck on larger GPU-based models, where it's also less necessary. + nO (int or None): The number of actions the model will predict between. + Usually inferred from data at the beginning of training, or loaded from + disk. + """ + if state_type == "parser": + nr_feature_tokens = 13 if extra_state_tokens else 8 + elif state_type == "ner": + nr_feature_tokens = 6 if extra_state_tokens else 3 + else: + raise ValueError(Errors.E917.format(value=state_type)) + t2v_width = tok2vec.get_dim("nO") if tok2vec.has_dim("nO") else None + tok2vec = chain( + tok2vec, + list2array(), + Linear(hidden_width, t2v_width), + ) + tok2vec.set_dim("nO", hidden_width) + lower = _define_lower( + nO=hidden_width if use_upper else nO, + nF=nr_feature_tokens, + nI=tok2vec.get_dim("nO"), + nP=maxout_pieces, + ) + upper = None + if use_upper: + with use_ops("cpu"): + # Initialize weights at zero, as it's a classification layer. + upper = _define_upper(nO=nO, nI=None) + return TransitionModel(tok2vec, lower, upper, resize_output) + + +def _define_upper(nO, nI): + return Linear(nO=nO, nI=nI, init_W=zero_init) + + +def _define_lower(nO, nF, nI, nP): + return PrecomputableAffine(nO=nO, nF=nF, nI=nI, nP=nP) + + +def resize_output(model, new_nO): + if model.attrs["has_upper"]: + return _resize_upper(model, new_nO) + return _resize_lower(model, new_nO) + + +def _resize_upper(model, new_nO): + upper = model.get_ref("upper") + if upper.has_dim("nO") is None: + upper.set_dim("nO", new_nO) + return model + elif new_nO == upper.get_dim("nO"): + return model + + smaller = upper + nI = smaller.maybe_get_dim("nI") + with use_ops("cpu"): + larger = _define_upper(nO=new_nO, nI=nI) + # it could be that the model is not initialized yet, then skip this bit + if smaller.has_param("W"): + larger_W = larger.ops.alloc2f(new_nO, nI) + larger_b = larger.ops.alloc1f(new_nO) + smaller_W = smaller.get_param("W") + smaller_b = smaller.get_param("b") + # Weights are stored in (nr_out, nr_in) format, so we're basically + # just adding rows here. + if smaller.has_dim("nO"): + old_nO = smaller.get_dim("nO") + larger_W[:old_nO] = smaller_W + larger_b[:old_nO] = smaller_b + for i in range(old_nO, new_nO): + model.attrs["unseen_classes"].add(i) + + larger.set_param("W", larger_W) + larger.set_param("b", larger_b) + model._layers[-1] = larger + model.set_ref("upper", larger) + return model + + +def _resize_lower(model, new_nO): + lower = model.get_ref("lower") + if lower.has_dim("nO") is None: + lower.set_dim("nO", new_nO) + return model + + smaller = lower + nI = smaller.maybe_get_dim("nI") + nF = smaller.maybe_get_dim("nF") + nP = smaller.maybe_get_dim("nP") + larger = _define_lower(nO=new_nO, nI=nI, nF=nF, nP=nP) + # it could be that the model is not initialized yet, then skip this bit + if smaller.has_param("W"): + larger_W = larger.ops.alloc4f(nF, new_nO, nP, nI) + larger_b = larger.ops.alloc2f(new_nO, nP) + larger_pad = larger.ops.alloc4f(1, nF, new_nO, nP) + smaller_W = smaller.get_param("W") + smaller_b = smaller.get_param("b") + smaller_pad = smaller.get_param("pad") + # Copy the old weights and padding into the new layer + if smaller.has_dim("nO"): + old_nO = smaller.get_dim("nO") + larger_W[:, 0:old_nO, :, :] = smaller_W + larger_pad[:, :, 0:old_nO, :] = smaller_pad + larger_b[0:old_nO, :] = smaller_b + for i in range(old_nO, new_nO): + model.attrs["unseen_classes"].add(i) + + larger.set_param("W", larger_W) + larger.set_param("b", larger_b) + larger.set_param("pad", larger_pad) + model._layers[1] = larger + model.set_ref("lower", larger) + return model diff --git a/TTS/Kokoro/.venv/Lib/site-packages/spacy/ml/models/span_finder.py b/TTS/Kokoro/.venv/Lib/site-packages/spacy/ml/models/span_finder.py new file mode 100644 index 0000000000000000000000000000000000000000..3710e9fe03e15b672bfad52eeca7d18c57c595a4 --- /dev/null +++ b/TTS/Kokoro/.venv/Lib/site-packages/spacy/ml/models/span_finder.py @@ -0,0 +1,40 @@ +from typing import Callable, List, Tuple + +from thinc.api import Model, chain, with_array +from thinc.types import Floats1d, Floats2d + +from ...tokens import Doc +from ...util import registry + +InT = List[Doc] +OutT = Floats2d + + +def build_finder_model( + tok2vec: Model[InT, List[Floats2d]], scorer: Model[OutT, OutT] +) -> Model[InT, OutT]: + + logistic_layer: Model[List[Floats2d], List[Floats2d]] = with_array(scorer) + model: Model[InT, OutT] = chain(tok2vec, logistic_layer, flattener()) + model.set_ref("tok2vec", tok2vec) + model.set_ref("scorer", scorer) + model.set_ref("logistic_layer", logistic_layer) + + return model + + +def flattener() -> Model[List[Floats2d], Floats2d]: + """Flattens the input to a 1-dimensional list of scores""" + + def forward( + model: Model[Floats1d, Floats1d], X: List[Floats2d], is_train: bool + ) -> Tuple[Floats2d, Callable[[Floats2d], List[Floats2d]]]: + lens = model.ops.asarray1i([len(doc) for doc in X]) + Y = model.ops.flatten(X) + + def backprop(dY: Floats2d) -> List[Floats2d]: + return model.ops.unflatten(dY, lens) + + return Y, backprop + + return Model("Flattener", forward=forward) diff --git a/TTS/Kokoro/.venv/Lib/site-packages/spacy/ml/models/spancat.py b/TTS/Kokoro/.venv/Lib/site-packages/spacy/ml/models/spancat.py new file mode 100644 index 0000000000000000000000000000000000000000..5dbf3c70e56a143f48f124f02d5d55f38bab29ed --- /dev/null +++ b/TTS/Kokoro/.venv/Lib/site-packages/spacy/ml/models/spancat.py @@ -0,0 +1,74 @@ +from typing import List, Tuple, cast + +from thinc.api import ( + Linear, + Logistic, + Maxout, + Model, + chain, + concatenate, + glorot_uniform_init, + list2ragged, + reduce_first, + reduce_last, + reduce_max, + reduce_mean, + with_getitem, +) +from thinc.types import Floats2d, Ragged + +from ...tokens import Doc +from ...util import registry +from ..extract_spans import extract_spans + + +def build_linear_logistic(nO=None, nI=None) -> Model[Floats2d, Floats2d]: + """An output layer for multi-label classification. It uses a linear layer + followed by a logistic activation. + """ + return chain(Linear(nO=nO, nI=nI, init_W=glorot_uniform_init), Logistic()) + + +def build_mean_max_reducer(hidden_size: int) -> Model[Ragged, Floats2d]: + """Reduce sequences by concatenating their mean and max pooled vectors, + and then combine the concatenated vectors with a hidden layer. + """ + return chain( + concatenate( + cast(Model[Ragged, Floats2d], reduce_last()), + cast(Model[Ragged, Floats2d], reduce_first()), + reduce_mean(), + reduce_max(), + ), + Maxout(nO=hidden_size, normalize=True, dropout=0.0), + ) + + +def build_spancat_model( + tok2vec: Model[List[Doc], List[Floats2d]], + reducer: Model[Ragged, Floats2d], + scorer: Model[Floats2d, Floats2d], +) -> Model[Tuple[List[Doc], Ragged], Floats2d]: + """Build a span categorizer model, given a token-to-vector model, a + reducer model to map the sequence of vectors for each span down to a single + vector, and a scorer model to map the vectors to probabilities. + + tok2vec (Model[List[Doc], List[Floats2d]]): The tok2vec model. + reducer (Model[Ragged, Floats2d]): The reducer model. + scorer (Model[Floats2d, Floats2d]): The scorer model. + """ + model = chain( + cast( + Model[Tuple[List[Doc], Ragged], Tuple[Ragged, Ragged]], + with_getitem( + 0, chain(tok2vec, cast(Model[List[Floats2d], Ragged], list2ragged())) + ), + ), + extract_spans(), + reducer, + scorer, + ) + model.set_ref("tok2vec", tok2vec) + model.set_ref("reducer", reducer) + model.set_ref("scorer", scorer) + return model diff --git a/TTS/Kokoro/.venv/Lib/site-packages/spacy/ml/models/tagger.py b/TTS/Kokoro/.venv/Lib/site-packages/spacy/ml/models/tagger.py new file mode 100644 index 0000000000000000000000000000000000000000..e7756984d0a3d8b2bfddcd76f03b6063289f7d3c --- /dev/null +++ b/TTS/Kokoro/.venv/Lib/site-packages/spacy/ml/models/tagger.py @@ -0,0 +1,30 @@ +from typing import List, Optional + +from thinc.api import Model, Softmax_v2, chain, with_array, zero_init +from thinc.types import Floats2d + +from ...tokens import Doc +from ...util import registry + + +def build_tagger_model( + tok2vec: Model[List[Doc], List[Floats2d]], nO: Optional[int] = None, normalize=False +) -> Model[List[Doc], List[Floats2d]]: + """Build a tagger model, using a provided token-to-vector component. The tagger + model simply adds a linear layer with softmax activation to predict scores + given the token vectors. + + tok2vec (Model[List[Doc], List[Floats2d]]): The token-to-vector subnetwork. + nO (int or None): The number of tags to output. Inferred from the data if None. + """ + # TODO: glorot_uniform_init seems to work a bit better than zero_init here?! + t2v_width = tok2vec.get_dim("nO") if tok2vec.has_dim("nO") else None + output_layer = Softmax_v2( + nO, t2v_width, init_W=zero_init, normalize_outputs=normalize + ) + softmax = with_array(output_layer) # type: ignore + model = chain(tok2vec, softmax) + model.set_ref("tok2vec", tok2vec) + model.set_ref("softmax", output_layer) + model.set_ref("output_layer", output_layer) + return model diff --git a/TTS/Kokoro/.venv/Lib/site-packages/spacy/ml/models/textcat.py b/TTS/Kokoro/.venv/Lib/site-packages/spacy/ml/models/textcat.py new file mode 100644 index 0000000000000000000000000000000000000000..a14a4ac8d3fa0a323e8e1a53d8458b35b8a261e4 --- /dev/null +++ b/TTS/Kokoro/.venv/Lib/site-packages/spacy/ml/models/textcat.py @@ -0,0 +1,364 @@ +from functools import partial +from typing import List, Optional, Tuple, cast + +from thinc.api import ( + Dropout, + Gelu, + LayerNorm, + Linear, + Logistic, + Maxout, + Model, + ParametricAttention, + ParametricAttention_v2, + Relu, + Softmax, + SparseLinear, + SparseLinear_v2, + chain, + clone, + concatenate, + list2ragged, + reduce_first, + reduce_last, + reduce_max, + reduce_mean, + reduce_sum, + residual, + resizable, + softmax_activation, + with_cpu, +) +from thinc.layers.chain import init as init_chain +from thinc.layers.resizable import resize_linear_weighted, resize_model +from thinc.types import ArrayXd, Floats2d + +from ...attrs import ORTH +from ...errors import Errors +from ...tokens import Doc +from ...util import registry +from ..extract_ngrams import extract_ngrams +from ..staticvectors import StaticVectors +from .tok2vec import get_tok2vec_width + +NEG_VALUE = -5000 + + +def build_simple_cnn_text_classifier( + tok2vec: Model, exclusive_classes: bool, nO: Optional[int] = None +) -> Model[List[Doc], Floats2d]: + """ + Build a simple CNN text classifier, given a token-to-vector model as inputs. + If exclusive_classes=True, a softmax non-linearity is applied, so that the + outputs sum to 1. If exclusive_classes=False, a logistic non-linearity + is applied instead, so that outputs are in the range [0, 1]. + """ + return build_reduce_text_classifier( + tok2vec=tok2vec, + exclusive_classes=exclusive_classes, + use_reduce_first=False, + use_reduce_last=False, + use_reduce_max=False, + use_reduce_mean=True, + nO=nO, + ) + + +def resize_and_set_ref(model, new_nO, resizable_layer): + resizable_layer = resize_model(resizable_layer, new_nO) + model.set_ref("output_layer", resizable_layer.layers[0]) + model.set_dim("nO", new_nO, force=True) + return model + + +def build_bow_text_classifier( + exclusive_classes: bool, + ngram_size: int, + no_output_layer: bool, + nO: Optional[int] = None, +) -> Model[List[Doc], Floats2d]: + return _build_bow_text_classifier( + exclusive_classes=exclusive_classes, + ngram_size=ngram_size, + no_output_layer=no_output_layer, + nO=nO, + sparse_linear=SparseLinear(nO=nO), + ) + + +def build_bow_text_classifier_v3( + exclusive_classes: bool, + ngram_size: int, + no_output_layer: bool, + length: int = 262144, + nO: Optional[int] = None, +) -> Model[List[Doc], Floats2d]: + if length < 1: + raise ValueError(Errors.E1056.format(length=length)) + + # Find k such that 2**(k-1) < length <= 2**k. + length = 2 ** (length - 1).bit_length() + + return _build_bow_text_classifier( + exclusive_classes=exclusive_classes, + ngram_size=ngram_size, + no_output_layer=no_output_layer, + nO=nO, + sparse_linear=SparseLinear_v2(nO=nO, length=length), + ) + + +def _build_bow_text_classifier( + exclusive_classes: bool, + ngram_size: int, + no_output_layer: bool, + sparse_linear: Model[Tuple[ArrayXd, ArrayXd, ArrayXd], ArrayXd], + nO: Optional[int] = None, +) -> Model[List[Doc], Floats2d]: + fill_defaults = {"b": 0, "W": 0} + with Model.define_operators({">>": chain}): + output_layer = None + if not no_output_layer: + fill_defaults["b"] = NEG_VALUE + output_layer = softmax_activation() if exclusive_classes else Logistic() + resizable_layer: Model[Floats2d, Floats2d] = resizable( + sparse_linear, + resize_layer=partial(resize_linear_weighted, fill_defaults=fill_defaults), + ) + model = extract_ngrams(ngram_size, attr=ORTH) >> resizable_layer + model = with_cpu(model, model.ops) + if output_layer: + model = model >> with_cpu(output_layer, output_layer.ops) + if nO is not None: + model.set_dim("nO", cast(int, nO)) + model.set_ref("output_layer", sparse_linear) + model.attrs["multi_label"] = not exclusive_classes + model.attrs["resize_output"] = partial( + resize_and_set_ref, resizable_layer=resizable_layer + ) + return model + + +def build_text_classifier_v2( + tok2vec: Model[List[Doc], List[Floats2d]], + linear_model: Model[List[Doc], Floats2d], + nO: Optional[int] = None, +) -> Model[List[Doc], Floats2d]: + # TODO: build the model with _build_parametric_attention_with_residual_nonlinear + # in spaCy v4. We don't do this in spaCy v3 to preserve model + # compatibility. + exclusive_classes = not linear_model.attrs["multi_label"] + with Model.define_operators({">>": chain, "|": concatenate}): + width = tok2vec.maybe_get_dim("nO") + attention_layer = ParametricAttention(width) + maxout_layer = Maxout(nO=width, nI=width) + norm_layer = LayerNorm(nI=width) + cnn_model = ( + tok2vec + >> list2ragged() + >> attention_layer + >> reduce_sum() + >> residual(maxout_layer >> norm_layer >> Dropout(0.0)) + ) + + nO_double = nO * 2 if nO else None + if exclusive_classes: + output_layer = Softmax(nO=nO, nI=nO_double) + else: + output_layer = Linear(nO=nO, nI=nO_double) >> Logistic() + model = (linear_model | cnn_model) >> output_layer + model.set_ref("tok2vec", tok2vec) + if model.has_dim("nO") is not False and nO is not None: + model.set_dim("nO", cast(int, nO)) + model.set_ref("output_layer", linear_model.get_ref("output_layer")) + model.set_ref("attention_layer", attention_layer) + model.set_ref("maxout_layer", maxout_layer) + model.set_ref("norm_layer", norm_layer) + model.attrs["multi_label"] = not exclusive_classes + + model.init = init_ensemble_textcat # type: ignore[assignment] + return model + + +def init_ensemble_textcat(model, X, Y) -> Model: + # When tok2vec is lazily initialized, we need to initialize it before + # the rest of the chain to ensure that we can get its width. + tok2vec = model.get_ref("tok2vec") + tok2vec.initialize(X) + + tok2vec_width = get_tok2vec_width(model) + model.get_ref("attention_layer").set_dim("nO", tok2vec_width) + model.get_ref("maxout_layer").set_dim("nO", tok2vec_width) + model.get_ref("maxout_layer").set_dim("nI", tok2vec_width) + model.get_ref("norm_layer").set_dim("nI", tok2vec_width) + model.get_ref("norm_layer").set_dim("nO", tok2vec_width) + init_chain(model, X, Y) + return model + + +def build_text_classifier_lowdata( + width: int, dropout: Optional[float], nO: Optional[int] = None +) -> Model[List[Doc], Floats2d]: + # Don't document this yet, I'm not sure it's right. + # Note, before v.3, this was the default if setting "low_data" and "pretrained_dims" + with Model.define_operators({">>": chain, "**": clone}): + model = ( + StaticVectors(width) + >> list2ragged() + >> ParametricAttention(width) + >> reduce_sum() + >> residual(Relu(width, width)) ** 2 + >> Linear(nO, width) + ) + if dropout: + model = model >> Dropout(dropout) + model = model >> Logistic() + return model + + +def build_textcat_parametric_attention_v1( + tok2vec: Model[List[Doc], List[Floats2d]], + exclusive_classes: bool, + nO: Optional[int] = None, +) -> Model[List[Doc], Floats2d]: + width = tok2vec.maybe_get_dim("nO") + parametric_attention = _build_parametric_attention_with_residual_nonlinear( + tok2vec=tok2vec, + nonlinear_layer=Maxout(nI=width, nO=width), + key_transform=Gelu(nI=width, nO=width), + ) + with Model.define_operators({">>": chain}): + if exclusive_classes: + output_layer = Softmax(nO=nO) + else: + output_layer = Linear(nO=nO) >> Logistic() + model = parametric_attention >> output_layer + if model.has_dim("nO") is not False and nO is not None: + model.set_dim("nO", cast(int, nO)) + model.set_ref("output_layer", output_layer) + model.attrs["multi_label"] = not exclusive_classes + + return model + + +def _build_parametric_attention_with_residual_nonlinear( + *, + tok2vec: Model[List[Doc], List[Floats2d]], + nonlinear_layer: Model[Floats2d, Floats2d], + key_transform: Optional[Model[Floats2d, Floats2d]] = None, +) -> Model[List[Doc], Floats2d]: + with Model.define_operators({">>": chain, "|": concatenate}): + width = tok2vec.maybe_get_dim("nO") + attention_layer = ParametricAttention_v2(nO=width, key_transform=key_transform) + norm_layer = LayerNorm(nI=width) + parametric_attention = ( + tok2vec + >> list2ragged() + >> attention_layer + >> reduce_sum() + >> residual(nonlinear_layer >> norm_layer >> Dropout(0.0)) + ) + + parametric_attention.init = _init_parametric_attention_with_residual_nonlinear + + parametric_attention.set_ref("tok2vec", tok2vec) + parametric_attention.set_ref("attention_layer", attention_layer) + parametric_attention.set_ref("key_transform", key_transform) + parametric_attention.set_ref("nonlinear_layer", nonlinear_layer) + parametric_attention.set_ref("norm_layer", norm_layer) + + return parametric_attention + + +def _init_parametric_attention_with_residual_nonlinear(model, X, Y) -> Model: + # When tok2vec is lazily initialized, we need to initialize it before + # the rest of the chain to ensure that we can get its width. + tok2vec = model.get_ref("tok2vec") + tok2vec.initialize(X) + + tok2vec_width = get_tok2vec_width(model) + model.get_ref("attention_layer").set_dim("nO", tok2vec_width) + model.get_ref("key_transform").set_dim("nI", tok2vec_width) + model.get_ref("key_transform").set_dim("nO", tok2vec_width) + model.get_ref("nonlinear_layer").set_dim("nI", tok2vec_width) + model.get_ref("nonlinear_layer").set_dim("nO", tok2vec_width) + model.get_ref("norm_layer").set_dim("nI", tok2vec_width) + model.get_ref("norm_layer").set_dim("nO", tok2vec_width) + init_chain(model, X, Y) + return model + + +def build_reduce_text_classifier( + tok2vec: Model, + exclusive_classes: bool, + use_reduce_first: bool, + use_reduce_last: bool, + use_reduce_max: bool, + use_reduce_mean: bool, + nO: Optional[int] = None, +) -> Model[List[Doc], Floats2d]: + """Build a model that classifies pooled `Doc` representations. + + Pooling is performed using reductions. Reductions are concatenated when + multiple reductions are used. + + tok2vec (Model): the tok2vec layer to pool over. + exclusive_classes (bool): Whether or not classes are mutually exclusive. + use_reduce_first (bool): Pool by using the hidden representation of the + first token of a `Doc`. + use_reduce_last (bool): Pool by using the hidden representation of the + last token of a `Doc`. + use_reduce_max (bool): Pool by taking the maximum values of the hidden + representations of a `Doc`. + use_reduce_mean (bool): Pool by taking the mean of all hidden + representations of a `Doc`. + nO (Optional[int]): Number of classes. + """ + + fill_defaults = {"b": 0, "W": 0} + reductions = [] + if use_reduce_first: + reductions.append(reduce_first()) + if use_reduce_last: + reductions.append(reduce_last()) + if use_reduce_max: + reductions.append(reduce_max()) + if use_reduce_mean: + reductions.append(reduce_mean()) + + if not len(reductions): + raise ValueError(Errors.E1057) + + with Model.define_operators({">>": chain}): + cnn = tok2vec >> list2ragged() >> concatenate(*reductions) + nO_tok2vec = tok2vec.maybe_get_dim("nO") + nI = nO_tok2vec * len(reductions) if nO_tok2vec is not None else None + if exclusive_classes: + output_layer = Softmax(nO=nO, nI=nI) + fill_defaults["b"] = NEG_VALUE + resizable_layer: Model = resizable( + output_layer, + resize_layer=partial( + resize_linear_weighted, fill_defaults=fill_defaults + ), + ) + model = cnn >> resizable_layer + else: + output_layer = Linear(nO=nO, nI=nI) + resizable_layer = resizable( + output_layer, + resize_layer=partial( + resize_linear_weighted, fill_defaults=fill_defaults + ), + ) + model = cnn >> resizable_layer >> Logistic() + model.set_ref("output_layer", output_layer) + model.attrs["resize_output"] = partial( + resize_and_set_ref, + resizable_layer=resizable_layer, + ) + model.set_ref("tok2vec", tok2vec) + if nO is not None: + model.set_dim("nO", cast(int, nO)) + model.attrs["multi_label"] = not exclusive_classes + return model diff --git a/TTS/Kokoro/.venv/Lib/site-packages/spacy/ml/models/tok2vec.py b/TTS/Kokoro/.venv/Lib/site-packages/spacy/ml/models/tok2vec.py new file mode 100644 index 0000000000000000000000000000000000000000..327b85359b63c7fc4c78b0bfc700564e17517720 --- /dev/null +++ b/TTS/Kokoro/.venv/Lib/site-packages/spacy/ml/models/tok2vec.py @@ -0,0 +1,343 @@ +from typing import List, Optional, Union, cast + +from thinc.api import ( + HashEmbed, + Maxout, + Mish, + Model, + PyTorchLSTM, + chain, + clone, + concatenate, + expand_window, + list2ragged, + noop, + ragged2list, + residual, + with_array, + with_padded, +) +from thinc.types import Floats2d, Ints1d, Ints2d, Ragged + +from ...attrs import intify_attr +from ...errors import Errors +from ...ml import _character_embed +from ...pipeline.tok2vec import Tok2VecListener +from ...tokens import Doc +from ...util import registry +from ..featureextractor import FeatureExtractor +from ..staticvectors import StaticVectors + + +def tok2vec_listener_v1(width: int, upstream: str = "*"): + tok2vec = Tok2VecListener(upstream_name=upstream, width=width) + return tok2vec + + +def get_tok2vec_width(model: Model): + nO = None + if model.has_ref("tok2vec"): + tok2vec = model.get_ref("tok2vec") + if tok2vec.has_dim("nO"): + nO = tok2vec.get_dim("nO") + elif tok2vec.has_ref("listener"): + nO = tok2vec.get_ref("listener").get_dim("nO") + return nO + + +def build_hash_embed_cnn_tok2vec( + *, + width: int, + depth: int, + embed_size: int, + window_size: int, + maxout_pieces: int, + subword_features: bool, + pretrained_vectors: Optional[bool], +) -> Model[List[Doc], List[Floats2d]]: + """Build spaCy's 'standard' tok2vec layer, which uses hash embedding + with subword features and a CNN with layer-normalized maxout. + + width (int): The width of the input and output. These are required to be the + same, so that residual connections can be used. Recommended values are + 96, 128 or 300. + depth (int): The number of convolutional layers to use. Recommended values + are between 2 and 8. + window_size (int): The number of tokens on either side to concatenate during + the convolutions. The receptive field of the CNN will be + depth * window_size * 2 + 1, so a 4-layer network with window_size of + 2 will be sensitive to 17 words at a time. Recommended value is 1. + embed_size (int): The number of rows in the hash embedding tables. This can + be surprisingly small, due to the use of the hash embeddings. Recommended + values are between 2000 and 10000. + maxout_pieces (int): The number of pieces to use in the maxout non-linearity. + If 1, the Mish non-linearity is used instead. Recommended values are 1-3. + subword_features (bool): Whether to also embed subword features, specifically + the prefix, suffix and word shape. This is recommended for alphabetic + languages like English, but not if single-character tokens are used for + a language such as Chinese. + pretrained_vectors (bool): Whether to also use static vectors. + """ + if subword_features: + attrs = ["NORM", "PREFIX", "SUFFIX", "SHAPE"] + row_sizes = [embed_size, embed_size // 2, embed_size // 2, embed_size // 2] + else: + attrs = ["NORM"] + row_sizes = [embed_size] + return build_Tok2Vec_model( + embed=MultiHashEmbed( + width=width, + rows=row_sizes, + attrs=attrs, + include_static_vectors=bool(pretrained_vectors), + ), + encode=MaxoutWindowEncoder( + width=width, + depth=depth, + window_size=window_size, + maxout_pieces=maxout_pieces, + ), + ) + + +def build_Tok2Vec_model( + embed: Model[List[Doc], List[Floats2d]], + encode: Model[List[Floats2d], List[Floats2d]], +) -> Model[List[Doc], List[Floats2d]]: + """Construct a tok2vec model out of embedding and encoding subnetworks. + See https://explosion.ai/blog/deep-learning-formula-nlp + + embed (Model[List[Doc], List[Floats2d]]): Embed tokens into context-independent + word vector representations. + encode (Model[List[Floats2d], List[Floats2d]]): Encode context into the + embeddings, using an architecture such as a CNN, BiLSTM or transformer. + """ + tok2vec = chain(embed, encode) + if encode.has_dim("nO"): + tok2vec.set_dim("nO", encode.get_dim("nO")) + tok2vec.set_ref("embed", embed) + tok2vec.set_ref("encode", encode) + return tok2vec + + +def MultiHashEmbed( + width: int, + attrs: Union[List[str], List[int], List[Union[str, int]]], + rows: List[int], + include_static_vectors: bool, +) -> Model[List[Doc], List[Floats2d]]: + """Construct an embedding layer that separately embeds a number of lexical + attributes using hash embedding, concatenates the results, and passes it + through a feed-forward subnetwork to build a mixed representation. + + The features used can be configured with the 'attrs' argument. The suggested + attributes are NORM, PREFIX, SUFFIX and SHAPE. This lets the model take into + account some subword information, without constructing a fully character-based + representation. If pretrained vectors are available, they can be included in + the representation as well, with the vectors table kept static + (i.e. it's not updated). + + The `width` parameter specifies the output width of the layer and the widths + of all embedding tables. If static vectors are included, a learned linear + layer is used to map the vectors to the specified width before concatenating + it with the other embedding outputs. A single Maxout layer is then used to + reduce the concatenated vectors to the final width. + + The `rows` parameter controls the number of rows used by the `HashEmbed` + tables. The HashEmbed layer needs surprisingly few rows, due to its use of + the hashing trick. Generally between 2000 and 10000 rows is sufficient, + even for very large vocabularies. A number of rows must be specified for each + table, so the `rows` list must be of the same length as the `attrs` parameter. + + width (int): The output width. Also used as the width of the embedding tables. + Recommended values are between 64 and 300. + attrs (list of attr IDs): The token attributes to embed. A separate + embedding table will be constructed for each attribute. + rows (List[int]): The number of rows in the embedding tables. Must have the + same length as attrs. + include_static_vectors (bool): Whether to also use static word vectors. + Requires a vectors table to be loaded in the Doc objects' vocab. + """ + if len(rows) != len(attrs): + raise ValueError(f"Mismatched lengths: {len(rows)} vs {len(attrs)}") + seed = 7 + + def make_hash_embed(index): + nonlocal seed + seed += 1 + return HashEmbed(width, rows[index], column=index, seed=seed, dropout=0.0) + + embeddings = [make_hash_embed(i) for i in range(len(attrs))] + concat_size = width * (len(embeddings) + include_static_vectors) + max_out: Model[Ragged, Ragged] = with_array( + Maxout(width, concat_size, nP=3, dropout=0.0, normalize=True) + ) + if include_static_vectors: + feature_extractor: Model[List[Doc], Ragged] = chain( + FeatureExtractor(attrs), + cast(Model[List[Ints2d], Ragged], list2ragged()), + with_array(concatenate(*embeddings)), + ) + model = chain( + concatenate( + feature_extractor, + StaticVectors(width, dropout=0.0), + ), + max_out, + ragged2list(), + ) + else: + model = chain( + FeatureExtractor(attrs), + cast(Model[List[Ints2d], Ragged], list2ragged()), + with_array(concatenate(*embeddings)), + max_out, + ragged2list(), + ) + return model + + +def CharacterEmbed( + width: int, + rows: int, + nM: int, + nC: int, + include_static_vectors: bool, + feature: Union[int, str] = "LOWER", +) -> Model[List[Doc], List[Floats2d]]: + """Construct an embedded representation based on character embeddings, using + a feed-forward network. A fixed number of UTF-8 byte characters are used for + each word, taken from the beginning and end of the word equally. Padding is + used in the centre for words that are too short. + + For instance, let's say nC=4, and the word is "jumping". The characters + used will be jung (two from the start, two from the end). If we had nC=8, + the characters would be "jumpping": 4 from the start, 4 from the end. This + ensures that the final character is always in the last position, instead + of being in an arbitrary position depending on the word length. + + The characters are embedded in a embedding table with a given number of rows, + and the vectors concatenated. A hash-embedded vector of the LOWER of the word is + also concatenated on, and the result is then passed through a feed-forward + network to construct a single vector to represent the information. + + feature (int or str): An attribute to embed, to concatenate with the characters. + width (int): The width of the output vector and the feature embedding. + rows (int): The number of rows in the LOWER hash embedding table. + nM (int): The dimensionality of the character embeddings. Recommended values + are between 16 and 64. + nC (int): The number of UTF-8 bytes to embed per word. Recommended values + are between 3 and 8, although it may depend on the length of words in the + language. + include_static_vectors (bool): Whether to also use static word vectors. + Requires a vectors table to be loaded in the Doc objects' vocab. + """ + feature = intify_attr(feature) + if feature is None: + raise ValueError(Errors.E911.format(feat=feature)) + char_embed = chain( + _character_embed.CharacterEmbed(nM=nM, nC=nC), + cast(Model[List[Floats2d], Ragged], list2ragged()), + ) + feature_extractor: Model[List[Doc], Ragged] = chain( + FeatureExtractor([feature]), + cast(Model[List[Ints2d], Ragged], list2ragged()), + with_array(HashEmbed(nO=width, nV=rows, column=0, seed=5)), # type: ignore[misc] + ) + max_out: Model[Ragged, Ragged] + if include_static_vectors: + max_out = with_array( + Maxout(width, nM * nC + (2 * width), nP=3, normalize=True, dropout=0.0) + ) + model = chain( + concatenate( + char_embed, + feature_extractor, + StaticVectors(width, dropout=0.0), + ), + max_out, + ragged2list(), + ) + else: + max_out = with_array( + Maxout(width, nM * nC + width, nP=3, normalize=True, dropout=0.0) + ) + model = chain( + concatenate( + char_embed, + feature_extractor, + ), + max_out, + ragged2list(), + ) + return model + + +def MaxoutWindowEncoder( + width: int, window_size: int, maxout_pieces: int, depth: int +) -> Model[List[Floats2d], List[Floats2d]]: + """Encode context using convolutions with maxout activation, layer + normalization and residual connections. + + width (int): The input and output width. These are required to be the same, + to allow residual connections. This value will be determined by the + width of the inputs. Recommended values are between 64 and 300. + window_size (int): The number of words to concatenate around each token + to construct the convolution. Recommended value is 1. + maxout_pieces (int): The number of maxout pieces to use. Recommended + values are 2 or 3. + depth (int): The number of convolutional layers. Recommended value is 4. + """ + cnn = chain( + expand_window(window_size=window_size), + Maxout( + nO=width, + nI=width * ((window_size * 2) + 1), + nP=maxout_pieces, + dropout=0.0, + normalize=True, + ), + ) + model = clone(residual(cnn), depth) + model.set_dim("nO", width) + receptive_field = window_size * depth + return with_array(model, pad=receptive_field) + + +def MishWindowEncoder( + width: int, window_size: int, depth: int +) -> Model[List[Floats2d], List[Floats2d]]: + """Encode context using convolutions with mish activation, layer + normalization and residual connections. + + width (int): The input and output width. These are required to be the same, + to allow residual connections. This value will be determined by the + width of the inputs. Recommended values are between 64 and 300. + window_size (int): The number of words to concatenate around each token + to construct the convolution. Recommended value is 1. + depth (int): The number of convolutional layers. Recommended value is 4. + """ + cnn = chain( + expand_window(window_size=window_size), + Mish(nO=width, nI=width * ((window_size * 2) + 1), dropout=0.0, normalize=True), + ) + model = clone(residual(cnn), depth) + model.set_dim("nO", width) + return with_array(model) + + +def BiLSTMEncoder( + width: int, depth: int, dropout: float +) -> Model[List[Floats2d], List[Floats2d]]: + """Encode context using bidirectonal LSTM layers. Requires PyTorch. + + width (int): The input and output width. These are required to be the same, + to allow residual connections. This value will be determined by the + width of the inputs. Recommended values are between 64 and 300. + depth (int): The number of recurrent layers. + dropout (float): Creates a Dropout layer on the outputs of each LSTM layer + except the last layer. Set to 0 to disable this functionality. + """ + if depth == 0: + return noop() + return with_padded(PyTorchLSTM(width, width, bi=True, depth=depth, dropout=dropout)) diff --git a/TTS/Kokoro/.venv/Lib/site-packages/spacy/pipeline/__pycache__/__init__.cpython-312.pyc b/TTS/Kokoro/.venv/Lib/site-packages/spacy/pipeline/__pycache__/__init__.cpython-312.pyc new file mode 100644 index 0000000000000000000000000000000000000000..95bd8b2cf718ab1d652bc09677aeab90de48b141 Binary files /dev/null and b/TTS/Kokoro/.venv/Lib/site-packages/spacy/pipeline/__pycache__/__init__.cpython-312.pyc differ diff --git a/TTS/Kokoro/.venv/Lib/site-packages/spacy/pipeline/__pycache__/attributeruler.cpython-312.pyc b/TTS/Kokoro/.venv/Lib/site-packages/spacy/pipeline/__pycache__/attributeruler.cpython-312.pyc new file mode 100644 index 0000000000000000000000000000000000000000..84f80cefd1fe1660fd5d9bcda2741951e2d903fc Binary files /dev/null and b/TTS/Kokoro/.venv/Lib/site-packages/spacy/pipeline/__pycache__/attributeruler.cpython-312.pyc differ diff --git a/TTS/Kokoro/.venv/Lib/site-packages/spacy/pipeline/__pycache__/edit_tree_lemmatizer.cpython-312.pyc b/TTS/Kokoro/.venv/Lib/site-packages/spacy/pipeline/__pycache__/edit_tree_lemmatizer.cpython-312.pyc new file mode 100644 index 0000000000000000000000000000000000000000..b02db2df64fba37a013a2f9838d6c98ef45ee750 Binary files /dev/null and b/TTS/Kokoro/.venv/Lib/site-packages/spacy/pipeline/__pycache__/edit_tree_lemmatizer.cpython-312.pyc differ diff --git a/TTS/Kokoro/.venv/Lib/site-packages/spacy/pipeline/__pycache__/entity_linker.cpython-312.pyc b/TTS/Kokoro/.venv/Lib/site-packages/spacy/pipeline/__pycache__/entity_linker.cpython-312.pyc new file mode 100644 index 0000000000000000000000000000000000000000..3f3dcd39f83374c1554ffc8b11b263cde76dd78a Binary files /dev/null and b/TTS/Kokoro/.venv/Lib/site-packages/spacy/pipeline/__pycache__/entity_linker.cpython-312.pyc differ diff --git a/TTS/Kokoro/.venv/Lib/site-packages/spacy/pipeline/__pycache__/entityruler.cpython-312.pyc b/TTS/Kokoro/.venv/Lib/site-packages/spacy/pipeline/__pycache__/entityruler.cpython-312.pyc new file mode 100644 index 0000000000000000000000000000000000000000..0a656859712d483e15e0bc04c954cf27346ca275 Binary files /dev/null and b/TTS/Kokoro/.venv/Lib/site-packages/spacy/pipeline/__pycache__/entityruler.cpython-312.pyc differ diff --git a/TTS/Kokoro/.venv/Lib/site-packages/spacy/pipeline/__pycache__/factories.cpython-312.pyc b/TTS/Kokoro/.venv/Lib/site-packages/spacy/pipeline/__pycache__/factories.cpython-312.pyc new file mode 100644 index 0000000000000000000000000000000000000000..b5198f1b565476f8b7f152fd87ba7a0276a3056b Binary files /dev/null and b/TTS/Kokoro/.venv/Lib/site-packages/spacy/pipeline/__pycache__/factories.cpython-312.pyc differ diff --git a/TTS/Kokoro/.venv/Lib/site-packages/spacy/pipeline/__pycache__/functions.cpython-312.pyc b/TTS/Kokoro/.venv/Lib/site-packages/spacy/pipeline/__pycache__/functions.cpython-312.pyc new file mode 100644 index 0000000000000000000000000000000000000000..9da966276b7a6c9cb9372b38cb4a2231eb3708d1 Binary files /dev/null and b/TTS/Kokoro/.venv/Lib/site-packages/spacy/pipeline/__pycache__/functions.cpython-312.pyc differ diff --git a/TTS/Kokoro/.venv/Lib/site-packages/spacy/pipeline/__pycache__/lemmatizer.cpython-312.pyc b/TTS/Kokoro/.venv/Lib/site-packages/spacy/pipeline/__pycache__/lemmatizer.cpython-312.pyc new file mode 100644 index 0000000000000000000000000000000000000000..5d660ef96d15d16b5c408c0a26d0bc149e58aa7f Binary files /dev/null and b/TTS/Kokoro/.venv/Lib/site-packages/spacy/pipeline/__pycache__/lemmatizer.cpython-312.pyc differ diff --git a/TTS/Kokoro/.venv/Lib/site-packages/spacy/pipeline/__pycache__/span_finder.cpython-312.pyc b/TTS/Kokoro/.venv/Lib/site-packages/spacy/pipeline/__pycache__/span_finder.cpython-312.pyc new file mode 100644 index 0000000000000000000000000000000000000000..c3a3662ba852b9d29bec00e2779075e6b8bad3b3 Binary files /dev/null and b/TTS/Kokoro/.venv/Lib/site-packages/spacy/pipeline/__pycache__/span_finder.cpython-312.pyc differ diff --git a/TTS/Kokoro/.venv/Lib/site-packages/spacy/pipeline/__pycache__/span_ruler.cpython-312.pyc b/TTS/Kokoro/.venv/Lib/site-packages/spacy/pipeline/__pycache__/span_ruler.cpython-312.pyc new file mode 100644 index 0000000000000000000000000000000000000000..55d768d16d588e7fa0b7b59669c072d00022de17 Binary files /dev/null and b/TTS/Kokoro/.venv/Lib/site-packages/spacy/pipeline/__pycache__/span_ruler.cpython-312.pyc differ diff --git a/TTS/Kokoro/.venv/Lib/site-packages/spacy/pipeline/__pycache__/spancat.cpython-312.pyc b/TTS/Kokoro/.venv/Lib/site-packages/spacy/pipeline/__pycache__/spancat.cpython-312.pyc new file mode 100644 index 0000000000000000000000000000000000000000..50d763bea4e32e00404407239868d912c6f45e9c Binary files /dev/null and b/TTS/Kokoro/.venv/Lib/site-packages/spacy/pipeline/__pycache__/spancat.cpython-312.pyc differ diff --git a/TTS/Kokoro/.venv/Lib/site-packages/spacy/pipeline/__pycache__/textcat.cpython-312.pyc b/TTS/Kokoro/.venv/Lib/site-packages/spacy/pipeline/__pycache__/textcat.cpython-312.pyc new file mode 100644 index 0000000000000000000000000000000000000000..54aeb6cc2d8bc48f5dbbe419bbb3e6213b4e2681 Binary files /dev/null and b/TTS/Kokoro/.venv/Lib/site-packages/spacy/pipeline/__pycache__/textcat.cpython-312.pyc differ diff --git a/TTS/Kokoro/.venv/Lib/site-packages/spacy/pipeline/__pycache__/textcat_multilabel.cpython-312.pyc b/TTS/Kokoro/.venv/Lib/site-packages/spacy/pipeline/__pycache__/textcat_multilabel.cpython-312.pyc new file mode 100644 index 0000000000000000000000000000000000000000..cda4f4fba0b84865acb10762157917b19da34728 Binary files /dev/null and b/TTS/Kokoro/.venv/Lib/site-packages/spacy/pipeline/__pycache__/textcat_multilabel.cpython-312.pyc differ diff --git a/TTS/Kokoro/.venv/Lib/site-packages/spacy/pipeline/__pycache__/tok2vec.cpython-312.pyc b/TTS/Kokoro/.venv/Lib/site-packages/spacy/pipeline/__pycache__/tok2vec.cpython-312.pyc new file mode 100644 index 0000000000000000000000000000000000000000..a80574d67b1de41af4608d8ca477faa311a56ce9 Binary files /dev/null and b/TTS/Kokoro/.venv/Lib/site-packages/spacy/pipeline/__pycache__/tok2vec.cpython-312.pyc differ diff --git a/TTS/Kokoro/.venv/Lib/site-packages/spacy/pipeline/_edit_tree_internals/__init__.py b/TTS/Kokoro/.venv/Lib/site-packages/spacy/pipeline/_edit_tree_internals/__init__.py new file mode 100644 index 0000000000000000000000000000000000000000..e69de29bb2d1d6434b8b29ae775ad8c2e48c5391 diff --git a/TTS/Kokoro/.venv/Lib/site-packages/spacy/pipeline/_edit_tree_internals/__pycache__/__init__.cpython-312.pyc b/TTS/Kokoro/.venv/Lib/site-packages/spacy/pipeline/_edit_tree_internals/__pycache__/__init__.cpython-312.pyc new file mode 100644 index 0000000000000000000000000000000000000000..9e5f363395c2bbd5ed7ff873ee44f0ffdbb3e6d1 Binary files /dev/null and b/TTS/Kokoro/.venv/Lib/site-packages/spacy/pipeline/_edit_tree_internals/__pycache__/__init__.cpython-312.pyc differ diff --git a/TTS/Kokoro/.venv/Lib/site-packages/spacy/pipeline/_edit_tree_internals/__pycache__/schemas.cpython-312.pyc b/TTS/Kokoro/.venv/Lib/site-packages/spacy/pipeline/_edit_tree_internals/__pycache__/schemas.cpython-312.pyc new file mode 100644 index 0000000000000000000000000000000000000000..bfa3e9b398618e7e562bef8a4077da0f74872468 Binary files /dev/null and b/TTS/Kokoro/.venv/Lib/site-packages/spacy/pipeline/_edit_tree_internals/__pycache__/schemas.cpython-312.pyc differ diff --git a/TTS/Kokoro/.venv/Lib/site-packages/spacy/pipeline/_edit_tree_internals/edit_trees.cpp b/TTS/Kokoro/.venv/Lib/site-packages/spacy/pipeline/_edit_tree_internals/edit_trees.cpp new file mode 100644 index 0000000000000000000000000000000000000000..89cfa329aa4477132e92f7623f785d33f51a37bc --- /dev/null +++ b/TTS/Kokoro/.venv/Lib/site-packages/spacy/pipeline/_edit_tree_internals/edit_trees.cpp @@ -0,0 +1,20560 @@ +/* Generated by Cython 3.2.1 */ + +/* BEGIN: Cython Metadata +{ + "distutils": { + "depends": [], + "extra_compile_args": [ + "-std=c++11" + ], + "include_dirs": [ + "C:\\Users\\runneradmin\\AppData\\Local\\Temp\\build-env-ej_q3m8u\\Lib\\site-packages\\numpy\\_core\\include", + "C:\\Users\\runneradmin\\AppData\\Local\\pypa\\cibuildwheel\\Cache\\nuget-cpython\\python.3.12.10\\tools\\Include" + ], + "language": "c++", + "name": "spacy.pipeline._edit_tree_internals.edit_trees", + "sources": [ + "spacy/pipeline/_edit_tree_internals/edit_trees.pyx" + ] + }, + "module_name": "spacy.pipeline._edit_tree_internals.edit_trees" +} +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_1" +#define CYTHON_HEX_VERSION 0x030201F0 +#define CYTHON_FUTURE_DIVISION 0 +/* 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)) + +/* CppInitCode */ +#ifndef __cplusplus + #error "Cython files generated with the C++ option must be compiled with a C++ compiler." +#endif +#ifndef CYTHON_INLINE + #if defined(__clang__) + #define CYTHON_INLINE __inline__ __attribute__ ((__unused__)) + #else + #define CYTHON_INLINE inline + #endif +#endif +template +void __Pyx_call_destructor(T& x) { + x.~T(); +} +template +class __Pyx_FakeReference { + public: + __Pyx_FakeReference() : ptr(NULL) { } + __Pyx_FakeReference(const T& ref) : ptr(const_cast(&ref)) { } + T *operator->() { return ptr; } + T *operator&() { return ptr; } + operator T&() { return *ptr; } + template bool operator ==(const U& other) const { return *ptr == other; } + template bool operator !=(const U& other) const { return *ptr != other; } + template bool operator==(const __Pyx_FakeReference& other) const { return *ptr == *other.ptr; } + template bool operator!=(const __Pyx_FakeReference& other) const { return *ptr != *other.ptr; } + private: + T *ptr; +}; + +/* 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 + #define __PYX_EXTERN_C extern "C++" +#endif + +#define __PYX_HAVE__spacy__pipeline___edit_tree_internals__edit_trees +#define __PYX_HAVE_API__spacy__pipeline___edit_tree_internals__edit_trees +/* Early includes */ +#include +#include "ios" +#include "new" +#include "stdexcept" +#include "typeinfo" +#include + + #if __cplusplus >= 201103L || (defined(_MSC_VER) && _MSC_VER >= 1600) + // move should be defined for these versions of MSVC, but __cplusplus isn't set usefully + #include + + namespace cython_std { + template typename std::remove_reference::type&& move(T& t) noexcept { return std::move(t); } + template typename std::remove_reference::type&& move(T&& t) noexcept { return std::move(t); } + } + + #endif + +#include +#include +#include +#include +#include +#ifdef _OPENMP +#include +#endif /* _OPENMP */ + +#if defined(PYREX_WITHOUT_ASSERTIONS) && !defined(CYTHON_WITHOUT_ASSERTIONS) +#define CYTHON_WITHOUT_ASSERTIONS +#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[] = { + "spacy/pipeline/_edit_tree_internals/edit_trees.pyx", + "", + "spacy/pipeline/_edit_tree_internals/edit_trees.pxd", + "cymem/cymem.pxd", + "preshed/maps.pxd", + "spacy/strings.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 ### */ + +/* "preshed/maps.pxd":5 + * + * + * ctypedef uint64_t key_t # <<<<<<<<<<<<<< + * + * +*/ +typedef uint64_t __pyx_t_7preshed_4maps_key_t; + +/* "typedefs.pxd":3 + * from libc.stdint cimport int32_t, uint8_t, uint16_t, uint32_t, uint64_t, uintptr_t + * + * ctypedef float weight_t # <<<<<<<<<<<<<< + * ctypedef uint64_t hash_t + * ctypedef uint64_t class_t +*/ +typedef float __pyx_t_5spacy_8typedefs_weight_t; + +/* "typedefs.pxd":4 + * + * ctypedef float weight_t + * ctypedef uint64_t hash_t # <<<<<<<<<<<<<< + * ctypedef uint64_t class_t + * ctypedef uint64_t attr_t +*/ +typedef uint64_t __pyx_t_5spacy_8typedefs_hash_t; + +/* "typedefs.pxd":5 + * ctypedef float weight_t + * ctypedef uint64_t hash_t + * ctypedef uint64_t class_t # <<<<<<<<<<<<<< + * ctypedef uint64_t attr_t + * ctypedef uint64_t flags_t +*/ +typedef uint64_t __pyx_t_5spacy_8typedefs_class_t; + +/* "typedefs.pxd":6 + * ctypedef uint64_t hash_t + * ctypedef uint64_t class_t + * ctypedef uint64_t attr_t # <<<<<<<<<<<<<< + * ctypedef uint64_t flags_t + * ctypedef uint16_t len_t +*/ +typedef uint64_t __pyx_t_5spacy_8typedefs_attr_t; + +/* "typedefs.pxd":7 + * ctypedef uint64_t class_t + * ctypedef uint64_t attr_t + * ctypedef uint64_t flags_t # <<<<<<<<<<<<<< + * ctypedef uint16_t len_t + * ctypedef uint16_t tag_t +*/ +typedef uint64_t __pyx_t_5spacy_8typedefs_flags_t; + +/* "typedefs.pxd":8 + * ctypedef uint64_t attr_t + * ctypedef uint64_t flags_t + * ctypedef uint16_t len_t # <<<<<<<<<<<<<< + * ctypedef uint16_t tag_t +*/ +typedef uint16_t __pyx_t_5spacy_8typedefs_len_t; + +/* "typedefs.pxd":9 + * ctypedef uint64_t flags_t + * ctypedef uint16_t len_t + * ctypedef uint16_t tag_t # <<<<<<<<<<<<<< +*/ +typedef uint16_t __pyx_t_5spacy_8typedefs_tag_t; +/* #### Code section: complex_type_declarations ### */ +/* #### Code section: type_declarations ### */ + +/*--- Type declarations ---*/ +struct __pyx_obj_5cymem_5cymem_PyMalloc; +struct __pyx_obj_5cymem_5cymem_PyFree; +struct __pyx_obj_5cymem_5cymem_Pool; +struct __pyx_obj_5cymem_5cymem_Address; +struct __pyx_obj_7preshed_4maps_PreshMap; +struct __pyx_obj_7preshed_4maps_PreshMapArray; +struct __pyx_obj_5spacy_7strings_StringStore; +struct __pyx_obj_5spacy_8pipeline_20_edit_tree_internals_10edit_trees_EditTrees; +struct __pyx_obj_5spacy_8pipeline_20_edit_tree_internals_10edit_trees___pyx_scope_struct__from_bytes; +struct __pyx_obj_5spacy_8pipeline_20_edit_tree_internals_10edit_trees___pyx_scope_struct_1_to_bytes; + +/* "cymem/cymem.pxd":1 + * ctypedef void* (*malloc_t)(size_t n) # <<<<<<<<<<<<<< + * ctypedef void (*free_t)(void *p) + * +*/ +typedef void *(*__pyx_t_5cymem_5cymem_malloc_t)(size_t); + +/* "cymem/cymem.pxd":2 + * ctypedef void* (*malloc_t)(size_t n) + * ctypedef void (*free_t)(void *p) # <<<<<<<<<<<<<< + * + * cdef class PyMalloc: +*/ +typedef void (*__pyx_t_5cymem_5cymem_free_t)(void *); +struct __pyx_t_7preshed_4maps_Cell; +struct __pyx_t_7preshed_4maps_Result; +struct __pyx_t_7preshed_4maps_MapStruct; + +/* "preshed/maps.pxd":8 + * + * + * cdef struct Cell: # <<<<<<<<<<<<<< + * key_t key + * void* value +*/ +struct __pyx_t_7preshed_4maps_Cell { + __pyx_t_7preshed_4maps_key_t key; + void *value; +}; + +/* "preshed/maps.pxd":13 + * + * + * cdef struct Result: # <<<<<<<<<<<<<< + * int found + * void* value +*/ +struct __pyx_t_7preshed_4maps_Result { + int found; + void *value; +}; + +/* "preshed/maps.pxd":18 + * + * + * cdef struct MapStruct: # <<<<<<<<<<<<<< + * Cell* cells + * void* value_for_empty_key +*/ +struct __pyx_t_7preshed_4maps_MapStruct { + struct __pyx_t_7preshed_4maps_Cell *cells; + void *value_for_empty_key; + void *value_for_del_key; + __pyx_t_7preshed_4maps_key_t length; + __pyx_t_7preshed_4maps_key_t filled; + int is_empty_key_set; + int is_del_key_set; +}; +union __pyx_t_5spacy_7strings_Utf8Str; +typedef union __pyx_t_5spacy_7strings_Utf8Str __pyx_t_5spacy_7strings_Utf8Str; + +/* "strings.pxd":17 + * + * + * ctypedef union Utf8Str: # <<<<<<<<<<<<<< + * unsigned char[8] s + * unsigned char* p +*/ +union __pyx_t_5spacy_7strings_Utf8Str { + unsigned char s[8]; + unsigned char *p; +}; +struct __pyx_t_5spacy_8pipeline_20_edit_tree_internals_10edit_trees_MatchNodeC; +struct __pyx_t_5spacy_8pipeline_20_edit_tree_internals_10edit_trees_SubstNodeC; +union __pyx_t_5spacy_8pipeline_20_edit_tree_internals_10edit_trees_NodeC; +struct __pyx_t_5spacy_8pipeline_20_edit_tree_internals_10edit_trees_EditTreeC; +struct __pyx_t_5spacy_8pipeline_20_edit_tree_internals_10edit_trees_LCS; + +/* "spacy/pipeline/_edit_tree_internals/edit_trees.pxd":31 + * cdef uint32_t NULL_TREE_ID + * + * cdef struct MatchNodeC: # <<<<<<<<<<<<<< + * len_t prefix_len + * len_t suffix_len +*/ +struct __pyx_t_5spacy_8pipeline_20_edit_tree_internals_10edit_trees_MatchNodeC { + __pyx_t_5spacy_8typedefs_len_t prefix_len; + __pyx_t_5spacy_8typedefs_len_t suffix_len; + uint32_t prefix_tree; + uint32_t suffix_tree; +}; + +/* "spacy/pipeline/_edit_tree_internals/edit_trees.pxd":37 + * uint32_t suffix_tree + * + * cdef struct SubstNodeC: # <<<<<<<<<<<<<< + * attr_t orig + * attr_t subst +*/ +struct __pyx_t_5spacy_8pipeline_20_edit_tree_internals_10edit_trees_SubstNodeC { + __pyx_t_5spacy_8typedefs_attr_t orig; + __pyx_t_5spacy_8typedefs_attr_t subst; +}; + +/* "spacy/pipeline/_edit_tree_internals/edit_trees.pxd":41 + * attr_t subst + * + * cdef union NodeC: # <<<<<<<<<<<<<< + * MatchNodeC match_node + * SubstNodeC subst_node +*/ +union __pyx_t_5spacy_8pipeline_20_edit_tree_internals_10edit_trees_NodeC { + struct __pyx_t_5spacy_8pipeline_20_edit_tree_internals_10edit_trees_MatchNodeC match_node; + struct __pyx_t_5spacy_8pipeline_20_edit_tree_internals_10edit_trees_SubstNodeC subst_node; +}; + +/* "spacy/pipeline/_edit_tree_internals/edit_trees.pxd":45 + * SubstNodeC subst_node + * + * cdef struct EditTreeC: # <<<<<<<<<<<<<< + * bint is_match_node + * NodeC inner +*/ +struct __pyx_t_5spacy_8pipeline_20_edit_tree_internals_10edit_trees_EditTreeC { + int is_match_node; + union __pyx_t_5spacy_8pipeline_20_edit_tree_internals_10edit_trees_NodeC inner; +}; + +/* "spacy/pipeline/_edit_tree_internals/edit_trees.pxd":81 + * return hash((subst_node.orig, subst_node.subst)) + * + * cdef struct LCS: # <<<<<<<<<<<<<< + * int source_begin + * int source_end +*/ +struct __pyx_t_5spacy_8pipeline_20_edit_tree_internals_10edit_trees_LCS { + int source_begin; + int source_end; + int target_begin; + int target_end; +}; + +/* "cymem/cymem.pxd":4 + * ctypedef void (*free_t)(void *p) + * + * cdef class PyMalloc: # <<<<<<<<<<<<<< + * cdef malloc_t malloc + * cdef void _set(self, malloc_t malloc) +*/ +struct __pyx_obj_5cymem_5cymem_PyMalloc { + PyObject_HEAD + struct __pyx_vtabstruct_5cymem_5cymem_PyMalloc *__pyx_vtab; + __pyx_t_5cymem_5cymem_malloc_t malloc; +}; + + +/* "cymem/cymem.pxd":10 + * cdef PyMalloc WrapMalloc(malloc_t malloc) + * + * cdef class PyFree: # <<<<<<<<<<<<<< + * cdef free_t free + * cdef void _set(self, free_t free) +*/ +struct __pyx_obj_5cymem_5cymem_PyFree { + PyObject_HEAD + struct __pyx_vtabstruct_5cymem_5cymem_PyFree *__pyx_vtab; + __pyx_t_5cymem_5cymem_free_t free; +}; + + +/* "cymem/cymem.pxd":16 + * cdef PyFree WrapFree(free_t free) + * + * cdef class Pool: # <<<<<<<<<<<<<< + * cdef readonly size_t size + * cdef readonly dict addresses +*/ +struct __pyx_obj_5cymem_5cymem_Pool { + PyObject_HEAD + struct __pyx_vtabstruct_5cymem_5cymem_Pool *__pyx_vtab; + size_t size; + PyObject *addresses; + PyObject *refs; + struct __pyx_obj_5cymem_5cymem_PyMalloc *pymalloc; + struct __pyx_obj_5cymem_5cymem_PyFree *pyfree; +}; + + +/* "cymem/cymem.pxd":28 + * + * + * cdef class Address: # <<<<<<<<<<<<<< + * cdef void* ptr + * cdef readonly PyMalloc pymalloc +*/ +struct __pyx_obj_5cymem_5cymem_Address { + PyObject_HEAD + void *ptr; + struct __pyx_obj_5cymem_5cymem_PyMalloc *pymalloc; + struct __pyx_obj_5cymem_5cymem_PyFree *pyfree; +}; + + +/* "preshed/maps.pxd":45 + * + * + * cdef class PreshMap: # <<<<<<<<<<<<<< + * cdef MapStruct* c_map + * cdef Pool mem +*/ +struct __pyx_obj_7preshed_4maps_PreshMap { + PyObject_HEAD + struct __pyx_vtabstruct_7preshed_4maps_PreshMap *__pyx_vtab; + struct __pyx_t_7preshed_4maps_MapStruct *c_map; + struct __pyx_obj_5cymem_5cymem_Pool *mem; +}; + + +/* "preshed/maps.pxd":53 + * + * + * cdef class PreshMapArray: # <<<<<<<<<<<<<< + * cdef Pool mem + * cdef MapStruct* maps +*/ +struct __pyx_obj_7preshed_4maps_PreshMapArray { + PyObject_HEAD + struct __pyx_vtabstruct_7preshed_4maps_PreshMapArray *__pyx_vtab; + struct __pyx_obj_5cymem_5cymem_Pool *mem; + struct __pyx_t_7preshed_4maps_MapStruct *maps; + size_t length; +}; + + +/* "strings.pxd":22 + * + * + * cdef class StringStore: # <<<<<<<<<<<<<< + * cdef Pool mem + * +*/ +struct __pyx_obj_5spacy_7strings_StringStore { + PyObject_HEAD + struct __pyx_vtabstruct_5spacy_7strings_StringStore *__pyx_vtab; + struct __pyx_obj_5cymem_5cymem_Pool *mem; + std::vector<__pyx_t_5spacy_8typedefs_hash_t> keys; + struct __pyx_obj_7preshed_4maps_PreshMap *_map; + std::vector<__pyx_t_5spacy_8typedefs_hash_t> _transient_keys; + struct __pyx_obj_5cymem_5cymem_Pool *_non_temp_mem; +}; + + +/* "spacy/pipeline/_edit_tree_internals/edit_trees.pxd":90 + * return lcs.source_begin == 0 and lcs.source_end == 0 and lcs.target_begin == 0 and lcs.target_end == 0 + * + * cdef class EditTrees: # <<<<<<<<<<<<<< + * cdef vector[EditTreeC] trees + * cdef unordered_map[hash_t, uint32_t] map +*/ +struct __pyx_obj_5spacy_8pipeline_20_edit_tree_internals_10edit_trees_EditTrees { + PyObject_HEAD + struct __pyx_vtabstruct_5spacy_8pipeline_20_edit_tree_internals_10edit_trees_EditTrees *__pyx_vtab; + std::vector trees; + std::unordered_map<__pyx_t_5spacy_8typedefs_hash_t,uint32_t> map; + struct __pyx_obj_5spacy_7strings_StringStore *strings; +}; + + +/* "spacy/pipeline/_edit_tree_internals/edit_trees.pyx":216 + * self._rebuild_tree_map() + * + * def from_bytes(self, bytes_data: bytes, *) -> "EditTrees": # <<<<<<<<<<<<<< + * def deserialize_trees(tree_dicts): + * cdef EditTreeC c_tree +*/ +struct __pyx_obj_5spacy_8pipeline_20_edit_tree_internals_10edit_trees___pyx_scope_struct__from_bytes { + PyObject_HEAD + PyObject *__pyx_v_deserialize_trees; + struct __pyx_obj_5spacy_8pipeline_20_edit_tree_internals_10edit_trees_EditTrees *__pyx_v_self; +}; + + +/* "spacy/pipeline/_edit_tree_internals/edit_trees.pyx":231 + * return self + * + * def to_bytes(self, **kwargs) -> bytes: # <<<<<<<<<<<<<< + * tree_dicts = [] + * for tree in self.trees: +*/ +struct __pyx_obj_5spacy_8pipeline_20_edit_tree_internals_10edit_trees___pyx_scope_struct_1_to_bytes { + PyObject_HEAD + PyObject *__pyx_v_tree_dicts; +}; + + + +/* "cymem/cymem.pxd":4 + * ctypedef void (*free_t)(void *p) + * + * cdef class PyMalloc: # <<<<<<<<<<<<<< + * cdef malloc_t malloc + * cdef void _set(self, malloc_t malloc) +*/ + +struct __pyx_vtabstruct_5cymem_5cymem_PyMalloc { + void (*_set)(struct __pyx_obj_5cymem_5cymem_PyMalloc *, __pyx_t_5cymem_5cymem_malloc_t); +}; +static struct __pyx_vtabstruct_5cymem_5cymem_PyMalloc *__pyx_vtabptr_5cymem_5cymem_PyMalloc; + + +/* "cymem/cymem.pxd":10 + * cdef PyMalloc WrapMalloc(malloc_t malloc) + * + * cdef class PyFree: # <<<<<<<<<<<<<< + * cdef free_t free + * cdef void _set(self, free_t free) +*/ + +struct __pyx_vtabstruct_5cymem_5cymem_PyFree { + void (*_set)(struct __pyx_obj_5cymem_5cymem_PyFree *, __pyx_t_5cymem_5cymem_free_t); +}; +static struct __pyx_vtabstruct_5cymem_5cymem_PyFree *__pyx_vtabptr_5cymem_5cymem_PyFree; + + +/* "cymem/cymem.pxd":16 + * cdef PyFree WrapFree(free_t free) + * + * cdef class Pool: # <<<<<<<<<<<<<< + * cdef readonly size_t size + * cdef readonly dict addresses +*/ + +struct __pyx_vtabstruct_5cymem_5cymem_Pool { + void *(*alloc)(struct __pyx_obj_5cymem_5cymem_Pool *, size_t, size_t); + void (*free)(struct __pyx_obj_5cymem_5cymem_Pool *, void *); + void *(*realloc)(struct __pyx_obj_5cymem_5cymem_Pool *, void *, size_t); +}; +static struct __pyx_vtabstruct_5cymem_5cymem_Pool *__pyx_vtabptr_5cymem_5cymem_Pool; + + +/* "preshed/maps.pxd":45 + * + * + * cdef class PreshMap: # <<<<<<<<<<<<<< + * cdef MapStruct* c_map + * cdef Pool mem +*/ + +struct __pyx_vtabstruct_7preshed_4maps_PreshMap { + void *(*get)(struct __pyx_obj_7preshed_4maps_PreshMap *, __pyx_t_7preshed_4maps_key_t); + void (*set)(struct __pyx_obj_7preshed_4maps_PreshMap *, __pyx_t_7preshed_4maps_key_t, void *); +}; +static struct __pyx_vtabstruct_7preshed_4maps_PreshMap *__pyx_vtabptr_7preshed_4maps_PreshMap; + + +/* "preshed/maps.pxd":53 + * + * + * cdef class PreshMapArray: # <<<<<<<<<<<<<< + * cdef Pool mem + * cdef MapStruct* maps +*/ + +struct __pyx_vtabstruct_7preshed_4maps_PreshMapArray { + void *(*get)(struct __pyx_obj_7preshed_4maps_PreshMapArray *, size_t, __pyx_t_7preshed_4maps_key_t); + void (*set)(struct __pyx_obj_7preshed_4maps_PreshMapArray *, size_t, __pyx_t_7preshed_4maps_key_t, void *); +}; +static struct __pyx_vtabstruct_7preshed_4maps_PreshMapArray *__pyx_vtabptr_7preshed_4maps_PreshMapArray; + + +/* "strings.pxd":22 + * + * + * cdef class StringStore: # <<<<<<<<<<<<<< + * cdef Pool mem + * +*/ + +struct __pyx_vtabstruct_5spacy_7strings_StringStore { + __pyx_t_5spacy_7strings_Utf8Str const *(*intern_unicode)(struct __pyx_obj_5spacy_7strings_StringStore *, PyObject *, int); + __pyx_t_5spacy_7strings_Utf8Str const *(*_intern_utf8)(struct __pyx_obj_5spacy_7strings_StringStore *, char *, int, __pyx_t_5spacy_8typedefs_hash_t *, int); +}; +static struct __pyx_vtabstruct_5spacy_7strings_StringStore *__pyx_vtabptr_5spacy_7strings_StringStore; + + +/* "spacy/pipeline/_edit_tree_internals/edit_trees.pyx":61 + * return lcs + * + * cdef class EditTrees: # <<<<<<<<<<<<<< + * """Container for constructing and storing edit trees.""" + * def __init__(self, strings: StringStore): +*/ + +struct __pyx_vtabstruct_5spacy_8pipeline_20_edit_tree_internals_10edit_trees_EditTrees { + uint32_t (*add)(struct __pyx_obj_5spacy_8pipeline_20_edit_tree_internals_10edit_trees_EditTrees *, PyObject *, PyObject *, int __pyx_skip_dispatch); + PyObject *(*apply)(struct __pyx_obj_5spacy_8pipeline_20_edit_tree_internals_10edit_trees_EditTrees *, uint32_t, PyObject *, int __pyx_skip_dispatch); + PyObject *(*tree_to_str)(struct __pyx_obj_5spacy_8pipeline_20_edit_tree_internals_10edit_trees_EditTrees *, uint32_t, int __pyx_skip_dispatch); + uint32_t (*_add)(struct __pyx_obj_5spacy_8pipeline_20_edit_tree_internals_10edit_trees_EditTrees *, PyObject *, PyObject *); + PyObject *(*_apply)(struct __pyx_obj_5spacy_8pipeline_20_edit_tree_internals_10edit_trees_EditTrees *, uint32_t, PyObject *, PyObject *); + uint32_t (*_tree_id)(struct __pyx_obj_5spacy_8pipeline_20_edit_tree_internals_10edit_trees_EditTrees *, struct __pyx_t_5spacy_8pipeline_20_edit_tree_internals_10edit_trees_EditTreeC); +}; +static struct __pyx_vtabstruct_5spacy_8pipeline_20_edit_tree_internals_10edit_trees_EditTrees *__pyx_vtabptr_5spacy_8pipeline_20_edit_tree_internals_10edit_trees_EditTrees; +/* #### 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); + +/* 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 + +/* 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 + +/* PyKeyError_Check.proto */ +#define __Pyx_PyExc_KeyError_Check(obj) __Pyx_TypeCheck(obj, PyExc_KeyError) + +/* 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) + +/* 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 */ +#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); + +/* RaiseException.export */ +static void __Pyx_Raise(PyObject *type, PyObject *value, PyObject *tb, PyObject *cause); + +/* PySequenceContains.proto */ +static CYTHON_INLINE int __Pyx_PySequence_ContainsTF(PyObject* item, PyObject* seq, int eq) { + int result = PySequence_Contains(seq, item); + return unlikely(result < 0) ? result : (result == (eq == Py_EQ)); +} + +/* PyUnicode_Unicode.proto */ +static CYTHON_INLINE PyObject* __Pyx_PyUnicode_Unicode(PyObject *obj); + +/* IncludeStringH.proto (used by JoinPyUnicode) */ +#include + +/* JoinPyUnicode.export */ +static PyObject* __Pyx_PyUnicode_Join(PyObject** values, Py_ssize_t value_count, Py_ssize_t result_ulength, + Py_UCS4 max_char); + +/* MoveIfSupported.proto */ +#if CYTHON_USE_CPP_STD_MOVE + #include + #define __PYX_STD_MOVE_IF_SUPPORTED(x) std::move(x) +#else + #define __PYX_STD_MOVE_IF_SUPPORTED(x) x +#endif + +/* unicode_iter.proto */ +static CYTHON_INLINE int __Pyx_init_unicode_iteration( + PyObject* ustring, Py_ssize_t *length, void** data, int *kind); + +/* 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 + +/* 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) + +/* 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); + +/* ExtTypeTest.proto */ +static CYTHON_INLINE int __Pyx_TypeTest(PyObject *obj, PyTypeObject *type); + +/* PyDictVersioning.proto */ +#if CYTHON_USE_DICT_VERSIONS && CYTHON_USE_TYPE_SLOTS +#define __PYX_DICT_VERSION_INIT ((PY_UINT64_T) -1) +#define __PYX_GET_DICT_VERSION(dict) (((PyDictObject*)(dict))->ma_version_tag) +#define __PYX_UPDATE_DICT_CACHE(dict, value, cache_var, version_var)\ + (version_var) = __PYX_GET_DICT_VERSION(dict);\ + (cache_var) = (value); +#define __PYX_PY_DICT_LOOKUP_IF_MODIFIED(VAR, DICT, LOOKUP) {\ + static PY_UINT64_T __pyx_dict_version = 0;\ + static PyObject *__pyx_dict_cached_value = NULL;\ + if (likely(__PYX_GET_DICT_VERSION(DICT) == __pyx_dict_version)) {\ + (VAR) = __Pyx_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 + +/* 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)) + +/* 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_Substring.proto */ +static CYTHON_INLINE PyObject* __Pyx_PyUnicode_Substring( + PyObject* text, Py_ssize_t start, Py_ssize_t stop); + +/* RaiseUnexpectedTypeError.proto */ +static int __Pyx_RaiseUnexpectedTypeError(const char *expected, PyObject *obj); + +/* PyIndexError_Check.proto */ +#define __Pyx_PyExc_IndexError_Check(obj) __Pyx_TypeCheck(obj, PyExc_IndexError) + +/* 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 + +/* AssertionsEnabled.proto */ +#if CYTHON_COMPILING_IN_LIMITED_API || PY_VERSION_HEX >= 0x030C0000 + static int __pyx_assertions_enabled_flag; + #define __pyx_assertions_enabled() (__pyx_assertions_enabled_flag) + static int __Pyx_init_assertions_enabled(void) { + PyObject *builtins, *debug, *debug_str; + int flag; + builtins = PyEval_GetBuiltins(); + if (!builtins) goto bad; + debug_str = PyUnicode_FromStringAndSize("__debug__", 9); + if (!debug_str) goto bad; + debug = PyObject_GetItem(builtins, debug_str); + Py_DECREF(debug_str); + if (!debug) goto bad; + flag = PyObject_IsTrue(debug); + Py_DECREF(debug); + if (flag == -1) goto bad; + __pyx_assertions_enabled_flag = flag; + return 0; + bad: + __pyx_assertions_enabled_flag = 1; + return -1; + } +#else + #define __Pyx_init_assertions_enabled() (0) + #define __pyx_assertions_enabled() (!Py_OptimizeFlag) +#endif + +/* PyAssertionError_Check.proto */ +#define __Pyx_PyExc_AssertionError_Check(obj) __Pyx_TypeCheck(obj, PyExc_AssertionError) + +/* 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 + +/* GetItemInt.proto */ +#define __Pyx_GetItemInt(o, i, type, is_signed, to_py_func, is_list, wraparound, boundscheck, has_gil, unsafe_shared)\ + (__Pyx_fits_Py_ssize_t(i, type, is_signed) ?\ + __Pyx_GetItemInt_Fast(o, (Py_ssize_t)i, is_list, wraparound, boundscheck, unsafe_shared) :\ + (is_list ? (PyErr_SetString(PyExc_IndexError, "list index out of range"), (PyObject*)NULL) :\ + __Pyx_GetItemInt_Generic(o, to_py_func(i)))) +#define __Pyx_GetItemInt_List(o, i, type, is_signed, to_py_func, is_list, wraparound, boundscheck, has_gil, unsafe_shared)\ + (__Pyx_fits_Py_ssize_t(i, type, is_signed) ?\ + __Pyx_GetItemInt_List_Fast(o, (Py_ssize_t)i, wraparound, boundscheck, unsafe_shared) :\ + (PyErr_SetString(PyExc_IndexError, "list index out of range"), (PyObject*)NULL)) +static CYTHON_INLINE PyObject *__Pyx_GetItemInt_List_Fast(PyObject *o, Py_ssize_t i, + int wraparound, int boundscheck, int unsafe_shared); +#define __Pyx_GetItemInt_Tuple(o, i, type, is_signed, to_py_func, is_list, wraparound, boundscheck, has_gil, unsafe_shared)\ + (__Pyx_fits_Py_ssize_t(i, type, is_signed) ?\ + __Pyx_GetItemInt_Tuple_Fast(o, (Py_ssize_t)i, wraparound, boundscheck, unsafe_shared) :\ + (PyErr_SetString(PyExc_IndexError, "tuple index out of range"), (PyObject*)NULL)) +static CYTHON_INLINE PyObject *__Pyx_GetItemInt_Tuple_Fast(PyObject *o, Py_ssize_t i, + int wraparound, int boundscheck, int unsafe_shared); +static PyObject *__Pyx_GetItemInt_Generic(PyObject *o, PyObject* j); +static CYTHON_INLINE PyObject *__Pyx_GetItemInt_Fast(PyObject *o, Py_ssize_t i, + int is_list, int wraparound, int boundscheck, int unsafe_shared); + +/* 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 + +/* 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_uint16_t(value, width, padding_char, format_char) (\ + ((format_char) == ('c')) ?\ + __Pyx_uchar___Pyx_PyUnicode_From_uint16_t(value, width, padding_char) :\ + __Pyx____Pyx_PyUnicode_From_uint16_t(value, width, padding_char, format_char)\ + ) +static CYTHON_INLINE PyObject* __Pyx_uchar___Pyx_PyUnicode_From_uint16_t(uint16_t value, Py_ssize_t width, char padding_char); +static CYTHON_INLINE PyObject* __Pyx____Pyx_PyUnicode_From_uint16_t(uint16_t value, Py_ssize_t width, char padding_char, char format_char); + +/* RaiseClosureNameError.proto */ +static void __Pyx_RaiseClosureNameError(const char *varname); + +/* 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); + +/* KeywordStringCheck.proto */ +static CYTHON_INLINE int __Pyx_CheckKeywordStrings(const char* function_name, PyObject *kw); + +/* PyObjectLookupSpecial.proto */ +#if CYTHON_USE_PYTYPE_LOOKUP && CYTHON_USE_TYPE_SLOTS +#define __Pyx_PyObject_LookupSpecialNoError(obj, attr_name) __Pyx__PyObject_LookupSpecial(obj, attr_name, 0) +#define __Pyx_PyObject_LookupSpecial(obj, attr_name) __Pyx__PyObject_LookupSpecial(obj, attr_name, 1) +static CYTHON_INLINE PyObject* __Pyx__PyObject_LookupSpecial(PyObject* obj, PyObject* attr_name, int with_error); +#else +#define __Pyx_PyObject_LookupSpecialNoError(o,n) __Pyx_PyObject_GetAttrStrNoError(o,n) +#define __Pyx_PyObject_LookupSpecial(o,n) __Pyx_PyObject_GetAttrStr(o,n) +#endif + +/* RaiseUnboundLocalError.proto */ +static void __Pyx_RaiseUnboundLocalError(const char *varname); + +/* 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 + +/* AllocateExtensionType.proto */ +static PyObject *__Pyx_AllocateExtensionType(PyTypeObject *t, int is_final); + +/* DefaultPlacementNew.proto */ +#include +template +void __Pyx_default_placement_construct(T* x) { + new (static_cast(x)) T(); +} + +/* CheckTypeForFreelists.proto */ +#if CYTHON_USE_FREELISTS +#if CYTHON_USE_TYPE_SPECS +#define __PYX_CHECK_FINAL_TYPE_FOR_FREELISTS(t, expected_tp, expected_size) ((int) ((t) == (expected_tp))) +#define __PYX_CHECK_TYPE_FOR_FREELIST_FLAGS Py_TPFLAGS_IS_ABSTRACT +#else +#define __PYX_CHECK_FINAL_TYPE_FOR_FREELISTS(t, expected_tp, expected_size) ((int) ((t)->tp_basicsize == (expected_size))) +#define __PYX_CHECK_TYPE_FOR_FREELIST_FLAGS (Py_TPFLAGS_IS_ABSTRACT | Py_TPFLAGS_HEAPTYPE) +#endif +#define __PYX_CHECK_TYPE_FOR_FREELISTS(t, expected_tp, expected_size)\ + (__PYX_CHECK_FINAL_TYPE_FOR_FREELISTS((t), (expected_tp), (expected_size)) &\ + (int) (!__Pyx_PyType_HasFeature((t), __PYX_CHECK_TYPE_FOR_FREELIST_FLAGS))) +#endif + +/* VoidPtrExport.proto */ +static int __Pyx_ExportVoidPtr(PyObject *api_dict, const char *name, void *p, const char *sig); + +/* GetApiDict.proto */ +static PyObject *__Pyx_ApiExport_GetApiDict(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 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); + +/* SetVTable.proto */ +static int __Pyx_SetVtable(PyTypeObject* typeptr , void* vtable); + +/* GetVTable.proto (used by MergeVTables) */ +static void* __Pyx_GetVtable(PyTypeObject *type); + +/* MergeVTables.proto */ +static int __Pyx_MergeVtables(PyTypeObject *type); + +/* TypeImport.proto */ +#ifndef __PYX_HAVE_RT_ImportType_proto_3_2_1 +#define __PYX_HAVE_RT_ImportType_proto_3_2_1 +#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_1(s) alignof(s) +#else +#define __PYX_GET_STRUCT_ALIGNMENT_3_2_1(s) sizeof(void*) +#endif +enum __Pyx_ImportType_CheckSize_3_2_1 { + __Pyx_ImportType_CheckSize_Error_3_2_1 = 0, + __Pyx_ImportType_CheckSize_Warn_3_2_1 = 1, + __Pyx_ImportType_CheckSize_Ignore_3_2_1 = 2 +}; +static PyTypeObject *__Pyx_ImportType_3_2_1(PyObject* module, const char *module_name, const char *class_name, size_t size, size_t alignment, enum __Pyx_ImportType_CheckSize_3_2_1 check_size); +#endif + +/* FunctionImport.proto */ +static int __Pyx_ImportFunction_3_2_1(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); + +/* 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); + +struct __pyx_t_5spacy_8pipeline_20_edit_tree_internals_10edit_trees_MatchNodeC; +static PyObject* __pyx_convert__to_py_struct____pyx_t_5spacy_8pipeline_20_edit_tree_internals_10edit_trees_MatchNodeC(struct __pyx_t_5spacy_8pipeline_20_edit_tree_internals_10edit_trees_MatchNodeC s); +struct __pyx_t_5spacy_8pipeline_20_edit_tree_internals_10edit_trees_SubstNodeC; +static PyObject* __pyx_convert__to_py_struct____pyx_t_5spacy_8pipeline_20_edit_tree_internals_10edit_trees_SubstNodeC(struct __pyx_t_5spacy_8pipeline_20_edit_tree_internals_10edit_trees_SubstNodeC s); +union __pyx_t_5spacy_8pipeline_20_edit_tree_internals_10edit_trees_NodeC; +static PyObject* __pyx_convert__to_py_union____pyx_t_5spacy_8pipeline_20_edit_tree_internals_10edit_trees_NodeC(union __pyx_t_5spacy_8pipeline_20_edit_tree_internals_10edit_trees_NodeC s); +/* CppExceptionConversion.proto */ +#ifndef __Pyx_CppExn2PyErr +#include +#include +#include +#include +static void __Pyx_CppExn2PyErr() { + try { + if (PyErr_Occurred()) + ; // let the latest Python exn pass through and ignore the current one + else + throw; + } catch (const std::bad_alloc& exn) { + PyErr_SetString(PyExc_MemoryError, exn.what()); + } catch (const std::bad_cast& exn) { + PyErr_SetString(PyExc_TypeError, exn.what()); + } catch (const std::bad_typeid& exn) { + PyErr_SetString(PyExc_TypeError, exn.what()); + } catch (const std::domain_error& exn) { + PyErr_SetString(PyExc_ValueError, exn.what()); + } catch (const std::invalid_argument& exn) { + PyErr_SetString(PyExc_ValueError, exn.what()); + } catch (const std::ios_base::failure& exn) { + PyErr_SetString(PyExc_IOError, exn.what()); + } catch (const std::out_of_range& exn) { + PyErr_SetString(PyExc_IndexError, exn.what()); + } catch (const std::overflow_error& exn) { + PyErr_SetString(PyExc_OverflowError, exn.what()); + } catch (const std::range_error& exn) { + PyErr_SetString(PyExc_ArithmeticError, exn.what()); + } catch (const std::underflow_error& exn) { + PyErr_SetString(PyExc_ArithmeticError, exn.what()); + } catch (const std::exception& exn) { + PyErr_SetString(PyExc_RuntimeError, exn.what()); + } + catch (...) + { + PyErr_SetString(PyExc_RuntimeError, "Unknown exception"); + } +} +#endif + +/* UnicodeAsUCS4.proto */ +static CYTHON_INLINE Py_UCS4 __Pyx_PyUnicode_AsPy_UCS4(PyObject*); + +struct __pyx_t_5spacy_8pipeline_20_edit_tree_internals_10edit_trees_EditTreeC; +static PyObject* __pyx_convert__to_py_struct____pyx_t_5spacy_8pipeline_20_edit_tree_internals_10edit_trees_EditTreeC(struct __pyx_t_5spacy_8pipeline_20_edit_tree_internals_10edit_trees_EditTreeC s); +/* CIntToPy.proto */ +static CYTHON_INLINE PyObject* __Pyx_PyLong_From_uint16_t(uint16_t value); + +/* CIntToPy.proto */ +static CYTHON_INLINE PyObject* __Pyx_PyLong_From_uint32_t(uint32_t value); + +/* CIntToPy.proto */ +static CYTHON_INLINE PyObject* __Pyx_PyLong_From_uint64_t(uint64_t value); + +/* CIntFromPy.proto */ +static CYTHON_INLINE uint32_t __Pyx_PyLong_As_uint32_t(PyObject *); + +/* CIntFromPy.proto */ +static CYTHON_INLINE int __Pyx_PyLong_As_int(PyObject *); + +/* CIntFromPy.proto */ +static CYTHON_INLINE uint64_t __Pyx_PyLong_As_uint64_t(PyObject *); + +/* CIntFromPy.proto */ +static CYTHON_INLINE uint16_t __Pyx_PyLong_As_uint16_t(PyObject *); + +/* CIntFromPy.proto */ +static CYTHON_INLINE size_t __Pyx_PyLong_As_size_t(PyObject *); + +/* ObjectAsUCS4.proto */ +static Py_UCS4 __Pyx__PyObject_AsPy_UCS4(PyObject*); +static CYTHON_INLINE Py_UCS4 __Pyx_PyObject_AsPy_UCS4(PyObject *x) { + return (likely(PyUnicode_Check(x)) ? __Pyx_PyUnicode_AsPy_UCS4(x) : __Pyx__PyObject_AsPy_UCS4(x)); +} + +/* 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 "." + +static uint32_t __pyx_f_5spacy_8pipeline_20_edit_tree_internals_10edit_trees_9EditTrees_add(struct __pyx_obj_5spacy_8pipeline_20_edit_tree_internals_10edit_trees_EditTrees *__pyx_v_self, PyObject *__pyx_v_form, PyObject *__pyx_v_lemma, int __pyx_skip_dispatch); /* proto*/ +static uint32_t __pyx_f_5spacy_8pipeline_20_edit_tree_internals_10edit_trees_9EditTrees__add(struct __pyx_obj_5spacy_8pipeline_20_edit_tree_internals_10edit_trees_EditTrees *__pyx_v_self, PyObject *__pyx_v_form, PyObject *__pyx_v_lemma); /* proto*/ +static uint32_t __pyx_f_5spacy_8pipeline_20_edit_tree_internals_10edit_trees_9EditTrees__tree_id(struct __pyx_obj_5spacy_8pipeline_20_edit_tree_internals_10edit_trees_EditTrees *__pyx_v_self, struct __pyx_t_5spacy_8pipeline_20_edit_tree_internals_10edit_trees_EditTreeC __pyx_v_tree); /* proto*/ +static PyObject *__pyx_f_5spacy_8pipeline_20_edit_tree_internals_10edit_trees_9EditTrees_apply(struct __pyx_obj_5spacy_8pipeline_20_edit_tree_internals_10edit_trees_EditTrees *__pyx_v_self, uint32_t __pyx_v_tree_id, PyObject *__pyx_v_form, int __pyx_skip_dispatch); /* proto*/ +static PyObject *__pyx_f_5spacy_8pipeline_20_edit_tree_internals_10edit_trees_9EditTrees__apply(struct __pyx_obj_5spacy_8pipeline_20_edit_tree_internals_10edit_trees_EditTrees *__pyx_v_self, uint32_t __pyx_v_tree_id, PyObject *__pyx_v_form_part, PyObject *__pyx_v_lemma_pieces); /* proto*/ +static PyObject *__pyx_f_5spacy_8pipeline_20_edit_tree_internals_10edit_trees_9EditTrees_tree_to_str(struct __pyx_obj_5spacy_8pipeline_20_edit_tree_internals_10edit_trees_EditTrees *__pyx_v_self, uint32_t __pyx_v_tree_id, int __pyx_skip_dispatch); /* proto*/ + +/* Module declarations from "libc.stdint" */ + +/* Module declarations from "libcpp.utility" */ + +/* Module declarations from "libcpp.unordered_map" */ + +/* Module declarations from "libcpp.vector" */ + +/* Module declarations from "cymem.cymem" */ + +/* Module declarations from "libcpp.set" */ + +/* Module declarations from "murmurhash.mrmr" */ +static uint64_t (*__pyx_f_10murmurhash_4mrmr_hash64)(void *, int, uint64_t); /*proto*/ + +/* Module declarations from "preshed.maps" */ + +/* Module declarations from "spacy.typedefs" */ + +/* Module declarations from "spacy.strings" */ + +/* Module declarations from "libc.string" */ + +/* Module declarations from "libcpp.pair" */ + +/* Module declarations from "spacy.pipeline._edit_tree_internals.edit_trees" */ +static uint32_t __pyx_v_5spacy_8pipeline_20_edit_tree_internals_10edit_trees_NULL_TREE_ID; +static CYTHON_INLINE struct __pyx_t_5spacy_8pipeline_20_edit_tree_internals_10edit_trees_EditTreeC __pyx_f_5spacy_8pipeline_20_edit_tree_internals_10edit_trees_edittree_new_match(__pyx_t_5spacy_8typedefs_len_t, __pyx_t_5spacy_8typedefs_len_t, uint32_t, uint32_t); /*proto*/ +static CYTHON_INLINE struct __pyx_t_5spacy_8pipeline_20_edit_tree_internals_10edit_trees_EditTreeC __pyx_f_5spacy_8pipeline_20_edit_tree_internals_10edit_trees_edittree_new_subst(__pyx_t_5spacy_8typedefs_attr_t, __pyx_t_5spacy_8typedefs_attr_t); /*proto*/ +static CYTHON_INLINE uint64_t __pyx_f_5spacy_8pipeline_20_edit_tree_internals_10edit_trees_edittree_hash(struct __pyx_t_5spacy_8pipeline_20_edit_tree_internals_10edit_trees_EditTreeC); /*proto*/ +static CYTHON_INLINE int __pyx_f_5spacy_8pipeline_20_edit_tree_internals_10edit_trees_lcs_is_empty(struct __pyx_t_5spacy_8pipeline_20_edit_tree_internals_10edit_trees_LCS); /*proto*/ +static struct __pyx_t_5spacy_8pipeline_20_edit_tree_internals_10edit_trees_LCS __pyx_f_5spacy_8pipeline_20_edit_tree_internals_10edit_trees_find_lcs(PyObject *, PyObject *); /*proto*/ +static struct __pyx_t_5spacy_8pipeline_20_edit_tree_internals_10edit_trees_MatchNodeC __pyx_convert__from_py_struct____pyx_t_5spacy_8pipeline_20_edit_tree_internals_10edit_trees_MatchNodeC(PyObject *); /*proto*/ +static struct __pyx_t_5spacy_8pipeline_20_edit_tree_internals_10edit_trees_SubstNodeC __pyx_convert__from_py_struct____pyx_t_5spacy_8pipeline_20_edit_tree_internals_10edit_trees_SubstNodeC(PyObject *); /*proto*/ +static union __pyx_t_5spacy_8pipeline_20_edit_tree_internals_10edit_trees_NodeC __pyx_convert__from_py_union____pyx_t_5spacy_8pipeline_20_edit_tree_internals_10edit_trees_NodeC(PyObject *); /*proto*/ +static struct __pyx_t_5spacy_8pipeline_20_edit_tree_internals_10edit_trees_EditTreeC __pyx_convert__from_py_struct____pyx_t_5spacy_8pipeline_20_edit_tree_internals_10edit_trees_EditTreeC(PyObject *); /*proto*/ +/* #### Code section: typeinfo ### */ +/* #### Code section: before_global_var ### */ +#define __Pyx_MODULE_NAME "spacy.pipeline._edit_tree_internals.edit_trees" +extern int __pyx_module_is_main_spacy__pipeline___edit_tree_internals__edit_trees; +int __pyx_module_is_main_spacy__pipeline___edit_tree_internals__edit_trees = 0; + +/* Implementation of "spacy.pipeline._edit_tree_internals.edit_trees" */ +/* #### Code section: global_var ### */ +static PyObject *__pyx_builtin_enumerate; +/* #### Code section: string_decls ### */ +/* #### Code section: decls ### */ +static int __pyx_pf_5spacy_8pipeline_20_edit_tree_internals_10edit_trees_9EditTrees___init__(struct __pyx_obj_5spacy_8pipeline_20_edit_tree_internals_10edit_trees_EditTrees *__pyx_v_self, PyObject *__pyx_v_strings); /* proto */ +static PyObject *__pyx_pf_5spacy_8pipeline_20_edit_tree_internals_10edit_trees_9EditTrees_2add(struct __pyx_obj_5spacy_8pipeline_20_edit_tree_internals_10edit_trees_EditTrees *__pyx_v_self, PyObject *__pyx_v_form, PyObject *__pyx_v_lemma); /* proto */ +static PyObject *__pyx_pf_5spacy_8pipeline_20_edit_tree_internals_10edit_trees_9EditTrees_4apply(struct __pyx_obj_5spacy_8pipeline_20_edit_tree_internals_10edit_trees_EditTrees *__pyx_v_self, uint32_t __pyx_v_tree_id, PyObject *__pyx_v_form); /* proto */ +static PyObject *__pyx_pf_5spacy_8pipeline_20_edit_tree_internals_10edit_trees_9EditTrees_6tree_to_str(struct __pyx_obj_5spacy_8pipeline_20_edit_tree_internals_10edit_trees_EditTrees *__pyx_v_self, uint32_t __pyx_v_tree_id); /* proto */ +static PyObject *__pyx_pf_5spacy_8pipeline_20_edit_tree_internals_10edit_trees_9EditTrees_8from_json(struct __pyx_obj_5spacy_8pipeline_20_edit_tree_internals_10edit_trees_EditTrees *__pyx_v_self, PyObject *__pyx_v_trees); /* proto */ +static PyObject *__pyx_pf_5spacy_8pipeline_20_edit_tree_internals_10edit_trees_9EditTrees_10from_bytes_deserialize_trees(PyObject *__pyx_self, PyObject *__pyx_v_tree_dicts); /* proto */ +static PyObject *__pyx_lambda_funcdef_lambda(PyObject *__pyx_self, PyObject *__pyx_v_n); /* proto */ +static PyObject *__pyx_pf_5spacy_8pipeline_20_edit_tree_internals_10edit_trees_9EditTrees_10from_bytes(struct __pyx_obj_5spacy_8pipeline_20_edit_tree_internals_10edit_trees_EditTrees *__pyx_v_self, PyObject *__pyx_v_bytes_data); /* proto */ +static PyObject *__pyx_lambda_funcdef_lambda1(PyObject *__pyx_self); /* proto */ +static PyObject *__pyx_pf_5spacy_8pipeline_20_edit_tree_internals_10edit_trees_9EditTrees_12to_bytes(struct __pyx_obj_5spacy_8pipeline_20_edit_tree_internals_10edit_trees_EditTrees *__pyx_v_self, CYTHON_UNUSED PyObject *__pyx_v_kwargs); /* proto */ +static PyObject *__pyx_pf_5spacy_8pipeline_20_edit_tree_internals_10edit_trees_9EditTrees_14to_disk(struct __pyx_obj_5spacy_8pipeline_20_edit_tree_internals_10edit_trees_EditTrees *__pyx_v_self, PyObject *__pyx_v_path, CYTHON_UNUSED PyObject *__pyx_v_kwargs); /* proto */ +static PyObject *__pyx_pf_5spacy_8pipeline_20_edit_tree_internals_10edit_trees_9EditTrees_16from_disk(struct __pyx_obj_5spacy_8pipeline_20_edit_tree_internals_10edit_trees_EditTrees *__pyx_v_self, PyObject *__pyx_v_path, CYTHON_UNUSED PyObject *__pyx_v_kwargs); /* proto */ +static PyObject *__pyx_pf_5spacy_8pipeline_20_edit_tree_internals_10edit_trees_9EditTrees_18__getitem__(struct __pyx_obj_5spacy_8pipeline_20_edit_tree_internals_10edit_trees_EditTrees *__pyx_v_self, PyObject *__pyx_v_idx); /* proto */ +static Py_ssize_t __pyx_pf_5spacy_8pipeline_20_edit_tree_internals_10edit_trees_9EditTrees_20__len__(struct __pyx_obj_5spacy_8pipeline_20_edit_tree_internals_10edit_trees_EditTrees *__pyx_v_self); /* proto */ +static PyObject *__pyx_pf_5spacy_8pipeline_20_edit_tree_internals_10edit_trees_9EditTrees_22_rebuild_tree_map(struct __pyx_obj_5spacy_8pipeline_20_edit_tree_internals_10edit_trees_EditTrees *__pyx_v_self); /* proto */ +static PyObject *__pyx_pf_5spacy_8pipeline_20_edit_tree_internals_10edit_trees_9EditTrees_24__reduce__(struct __pyx_obj_5spacy_8pipeline_20_edit_tree_internals_10edit_trees_EditTrees *__pyx_v_self); /* proto */ +static PyObject *__pyx_pf_5spacy_8pipeline_20_edit_tree_internals_10edit_trees_unpickle_edittrees(CYTHON_UNUSED PyObject *__pyx_self, PyObject *__pyx_v_strings, PyObject *__pyx_v_trees_data); /* proto */ +static PyObject *__pyx_pf_5spacy_8pipeline_20_edit_tree_internals_10edit_trees_2_tree2dict(CYTHON_UNUSED PyObject *__pyx_self, PyObject *__pyx_v_tree); /* proto */ +static PyObject *__pyx_pf_5spacy_8pipeline_20_edit_tree_internals_10edit_trees_4_dict2tree(CYTHON_UNUSED PyObject *__pyx_self, PyObject *__pyx_v_tree); /* proto */ +static PyObject *__pyx_tp_new_5spacy_8pipeline_20_edit_tree_internals_10edit_trees_EditTrees(PyTypeObject *t, PyObject *a, PyObject *k); /*proto*/ +static PyObject *__pyx_tp_new_5spacy_8pipeline_20_edit_tree_internals_10edit_trees___pyx_scope_struct__from_bytes(PyTypeObject *t, PyObject *a, PyObject *k); /*proto*/ +static PyObject *__pyx_tp_new_5spacy_8pipeline_20_edit_tree_internals_10edit_trees___pyx_scope_struct_1_to_bytes(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_5cymem_5cymem_PyMalloc; + PyTypeObject *__pyx_ptype_5cymem_5cymem_PyFree; + PyTypeObject *__pyx_ptype_5cymem_5cymem_Pool; + PyTypeObject *__pyx_ptype_5cymem_5cymem_Address; + PyTypeObject *__pyx_ptype_7preshed_4maps_PreshMap; + PyTypeObject *__pyx_ptype_7preshed_4maps_PreshMapArray; + PyTypeObject *__pyx_ptype_5spacy_7strings_StringStore; + PyObject *__pyx_type_5spacy_8pipeline_20_edit_tree_internals_10edit_trees_EditTrees; + PyObject *__pyx_type_5spacy_8pipeline_20_edit_tree_internals_10edit_trees___pyx_scope_struct__from_bytes; + PyObject *__pyx_type_5spacy_8pipeline_20_edit_tree_internals_10edit_trees___pyx_scope_struct_1_to_bytes; + PyTypeObject *__pyx_ptype_5spacy_8pipeline_20_edit_tree_internals_10edit_trees_EditTrees; + PyTypeObject *__pyx_ptype_5spacy_8pipeline_20_edit_tree_internals_10edit_trees___pyx_scope_struct__from_bytes; + PyTypeObject *__pyx_ptype_5spacy_8pipeline_20_edit_tree_internals_10edit_trees___pyx_scope_struct_1_to_bytes; + __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[16]; + PyObject *__pyx_string_tab[156]; +/* #### 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; + + +#if CYTHON_USE_FREELISTS +struct __pyx_obj_5spacy_8pipeline_20_edit_tree_internals_10edit_trees___pyx_scope_struct__from_bytes *__pyx_freelist_5spacy_8pipeline_20_edit_tree_internals_10edit_trees___pyx_scope_struct__from_bytes[8]; +int __pyx_freecount_5spacy_8pipeline_20_edit_tree_internals_10edit_trees___pyx_scope_struct__from_bytes; +#endif + +#if CYTHON_USE_FREELISTS +struct __pyx_obj_5spacy_8pipeline_20_edit_tree_internals_10edit_trees___pyx_scope_struct_1_to_bytes *__pyx_freelist_5spacy_8pipeline_20_edit_tree_internals_10edit_trees___pyx_scope_struct_1_to_bytes[8]; +int __pyx_freecount_5spacy_8pipeline_20_edit_tree_internals_10edit_trees___pyx_scope_struct_1_to_bytes; +#endif +/* 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_EditTrees_2 __pyx_string_tab[1] +#define __pyx_kp_u_More_than_one_union_attribute_pa __pyx_string_tab[2] +#define __pyx_kp_u_No_value_specified_for_any_of_th __pyx_string_tab[3] +#define __pyx_kp_u_No_value_specified_for_struct_at __pyx_string_tab[4] +#define __pyx_kp_u_No_value_specified_for_struct_at_2 __pyx_string_tab[5] +#define __pyx_kp_u_No_value_specified_for_struct_at_3 __pyx_string_tab[6] +#define __pyx_kp_u_No_value_specified_for_struct_at_4 __pyx_string_tab[7] +#define __pyx_kp_u_No_value_specified_for_struct_at_5 __pyx_string_tab[8] +#define __pyx_kp_u_No_value_specified_for_struct_at_6 __pyx_string_tab[9] +#define __pyx_kp_u_No_value_specified_for_struct_at_7 __pyx_string_tab[10] +#define __pyx_kp_u_No_value_specified_for_struct_at_8 __pyx_string_tab[11] +#define __pyx_kp_u_None __pyx_string_tab[12] +#define __pyx_kp_u_Note_that_Cython_is_deliberately __pyx_string_tab[13] +#define __pyx_kp_u__2 __pyx_string_tab[14] +#define __pyx_kp_u__3 __pyx_string_tab[15] +#define __pyx_kp_u__4 __pyx_string_tab[16] +#define __pyx_kp_u__5 __pyx_string_tab[17] +#define __pyx_kp_u__6 __pyx_string_tab[18] +#define __pyx_kp_u__7 __pyx_string_tab[19] +#define __pyx_kp_u__8 __pyx_string_tab[20] +#define __pyx_kp_u__9 __pyx_string_tab[21] +#define __pyx_kp_u_add_note __pyx_string_tab[22] +#define __pyx_kp_u_and_match_node __pyx_string_tab[23] +#define __pyx_kp_u_and_subst_node __pyx_string_tab[24] +#define __pyx_kp_u_disable __pyx_string_tab[25] +#define __pyx_kp_u_enable __pyx_string_tab[26] +#define __pyx_kp_u_gc __pyx_string_tab[27] +#define __pyx_kp_u_isenabled __pyx_string_tab[28] +#define __pyx_kp_u_m __pyx_string_tab[29] +#define __pyx_kp_u_match_node_subst_node __pyx_string_tab[30] +#define __pyx_kp_u_s __pyx_string_tab[31] +#define __pyx_kp_u_spacy __pyx_string_tab[32] +#define __pyx_kp_u_spacy_errors __pyx_string_tab[33] +#define __pyx_kp_u_spacy_pipeline__edit_tree_intern_2 __pyx_string_tab[34] +#define __pyx_kp_u_spacy_pipeline__edit_tree_intern_3 __pyx_string_tab[35] +#define __pyx_kp_u_spacy_strings __pyx_string_tab[36] +#define __pyx_n_u_ __pyx_string_tab[37] +#define __pyx_n_u_E1026 __pyx_string_tab[38] +#define __pyx_n_u_E1029 __pyx_string_tab[39] +#define __pyx_n_u_E1030 __pyx_string_tab[40] +#define __pyx_n_u_EditTrees __pyx_string_tab[41] +#define __pyx_n_u_EditTrees___reduce __pyx_string_tab[42] +#define __pyx_n_u_EditTrees__rebuild_tree_map __pyx_string_tab[43] +#define __pyx_n_u_EditTrees_add __pyx_string_tab[44] +#define __pyx_n_u_EditTrees_apply __pyx_string_tab[45] +#define __pyx_n_u_EditTrees_from_bytes __pyx_string_tab[46] +#define __pyx_n_u_EditTrees_from_disk __pyx_string_tab[47] +#define __pyx_n_u_EditTrees_from_json __pyx_string_tab[48] +#define __pyx_n_u_EditTrees_to_bytes __pyx_string_tab[49] +#define __pyx_n_u_EditTrees_to_disk __pyx_string_tab[50] +#define __pyx_n_u_EditTrees_tree_to_str __pyx_string_tab[51] +#define __pyx_n_u_Errors __pyx_string_tab[52] +#define __pyx_n_u_Pyx_PyDict_NextRef __pyx_string_tab[53] +#define __pyx_n_u_StringStore __pyx_string_tab[54] +#define __pyx_n_u_add __pyx_string_tab[55] +#define __pyx_n_u_apply __pyx_string_tab[56] +#define __pyx_n_u_asyncio_coroutines __pyx_string_tab[57] +#define __pyx_n_u_bytes __pyx_string_tab[58] +#define __pyx_n_u_bytes_data __pyx_string_tab[59] +#define __pyx_n_u_c_tree __pyx_string_tab[60] +#define __pyx_n_u_cline_in_traceback __pyx_string_tab[61] +#define __pyx_n_u_data __pyx_string_tab[62] +#define __pyx_n_u_deserialize_trees __pyx_string_tab[63] +#define __pyx_n_u_deserializers __pyx_string_tab[64] +#define __pyx_n_u_dict2tree __pyx_string_tab[65] +#define __pyx_n_u_ensure_path __pyx_string_tab[66] +#define __pyx_n_u_enter __pyx_string_tab[67] +#define __pyx_n_u_enumerate __pyx_string_tab[68] +#define __pyx_n_u_errors __pyx_string_tab[69] +#define __pyx_n_u_exists __pyx_string_tab[70] +#define __pyx_n_u_exit __pyx_string_tab[71] +#define __pyx_n_u_file __pyx_string_tab[72] +#define __pyx_n_u_form __pyx_string_tab[73] +#define __pyx_n_u_format __pyx_string_tab[74] +#define __pyx_n_u_from_bytes __pyx_string_tab[75] +#define __pyx_n_u_from_bytes_locals_deserialize_tr __pyx_string_tab[76] +#define __pyx_n_u_from_bytes_locals_lambda __pyx_string_tab[77] +#define __pyx_n_u_from_disk __pyx_string_tab[78] +#define __pyx_n_u_from_json __pyx_string_tab[79] +#define __pyx_n_u_func __pyx_string_tab[80] +#define __pyx_n_u_inner __pyx_string_tab[81] +#define __pyx_n_u_is_coroutine __pyx_string_tab[82] +#define __pyx_n_u_is_match_node __pyx_string_tab[83] +#define __pyx_n_u_items __pyx_string_tab[84] +#define __pyx_n_u_kwargs __pyx_string_tab[85] +#define __pyx_n_u_lambda __pyx_string_tab[86] +#define __pyx_n_u_lemma __pyx_string_tab[87] +#define __pyx_n_u_list __pyx_string_tab[88] +#define __pyx_n_u_main __pyx_string_tab[89] +#define __pyx_n_u_match_node __pyx_string_tab[90] +#define __pyx_n_u_module __pyx_string_tab[91] +#define __pyx_n_u_n __pyx_string_tab[92] +#define __pyx_n_u_name __pyx_string_tab[93] +#define __pyx_n_u_open __pyx_string_tab[94] +#define __pyx_n_u_orig __pyx_string_tab[95] +#define __pyx_n_u_path __pyx_string_tab[96] +#define __pyx_n_u_pop __pyx_string_tab[97] +#define __pyx_n_u_prefix_len __pyx_string_tab[98] +#define __pyx_n_u_prefix_tree __pyx_string_tab[99] +#define __pyx_n_u_pyx_capi __pyx_string_tab[100] +#define __pyx_n_u_pyx_vtable __pyx_string_tab[101] +#define __pyx_n_u_qualname __pyx_string_tab[102] +#define __pyx_n_u_rb __pyx_string_tab[103] +#define __pyx_n_u_read __pyx_string_tab[104] +#define __pyx_n_u_rebuild_tree_map __pyx_string_tab[105] +#define __pyx_n_u_reduce __pyx_string_tab[106] +#define __pyx_n_u_return __pyx_string_tab[107] +#define __pyx_n_u_schemas __pyx_string_tab[108] +#define __pyx_n_u_self __pyx_string_tab[109] +#define __pyx_n_u_serializers __pyx_string_tab[110] +#define __pyx_n_u_set_name __pyx_string_tab[111] +#define __pyx_n_u_setdefault __pyx_string_tab[112] +#define __pyx_n_u_spacy_pipeline__edit_tree_intern __pyx_string_tab[113] +#define __pyx_n_u_strings __pyx_string_tab[114] +#define __pyx_n_u_subst __pyx_string_tab[115] +#define __pyx_n_u_subst_node __pyx_string_tab[116] +#define __pyx_n_u_suffix_len __pyx_string_tab[117] +#define __pyx_n_u_suffix_tree __pyx_string_tab[118] +#define __pyx_n_u_test __pyx_string_tab[119] +#define __pyx_n_u_to_bytes __pyx_string_tab[120] +#define __pyx_n_u_to_bytes_locals_lambda __pyx_string_tab[121] +#define __pyx_n_u_to_disk __pyx_string_tab[122] +#define __pyx_n_u_tree __pyx_string_tab[123] +#define __pyx_n_u_tree2dict __pyx_string_tab[124] +#define __pyx_n_u_tree_dict __pyx_string_tab[125] +#define __pyx_n_u_tree_dicts __pyx_string_tab[126] +#define __pyx_n_u_tree_hash __pyx_string_tab[127] +#define __pyx_n_u_tree_id __pyx_string_tab[128] +#define __pyx_n_u_tree_to_str __pyx_string_tab[129] +#define __pyx_n_u_trees __pyx_string_tab[130] +#define __pyx_n_u_trees_data __pyx_string_tab[131] +#define __pyx_n_u_unpickle_edittrees __pyx_string_tab[132] +#define __pyx_n_u_util __pyx_string_tab[133] +#define __pyx_n_u_validate_edit_tree __pyx_string_tab[134] +#define __pyx_n_u_values __pyx_string_tab[135] +#define __pyx_n_u_wb __pyx_string_tab[136] +#define __pyx_n_u_write __pyx_string_tab[137] +#define __pyx_kp_b_iso88591_1_t_q_4wa_U_9A_uE_4_1_q __pyx_string_tab[138] +#define __pyx_kp_b_iso88591_9AX __pyx_string_tab[139] +#define __pyx_kp_b_iso88591_AQ __pyx_string_tab[140] +#define __pyx_kp_b_iso88591_A_3avS_c_A_Qc_N_4y_t5_q __pyx_string_tab[141] +#define __pyx_kp_b_iso88591_A_83d_Q_AV1_d_4t1_V1_6_haz_1D_ST __pyx_string_tab[142] +#define __pyx_kp_b_iso88591_A_83d_Q_AV1_q_q_q_1_r_aq __pyx_string_tab[143] +#define __pyx_kp_b_iso88591_A_D_a_KuAT_uA_T_q_Qa_G5_2_a __pyx_string_tab[144] +#define __pyx_kp_b_iso88591_A_Q_HD_Qa_gQa_a_1Kq_t9A __pyx_string_tab[145] +#define __pyx_kp_b_iso88591_A_T_4y __pyx_string_tab[146] +#define __pyx_kp_b_iso88591_Q_1A_F_AQ __pyx_string_tab[147] +#define __pyx_kp_b_iso88591_Qk_Kq_O1_a_q __pyx_string_tab[148] +#define __pyx_kp_b_iso88591_q_q_j_vWAWD_Qa_4q_Cq_z_q_1 __pyx_string_tab[149] +#define __pyx_kp_b_iso88591_t1A_t1HAQ_t1HAQ_4q __pyx_string_tab[150] +#define __pyx_kp_b_iso88591_t_q_ay_q_IQ __pyx_string_tab[151] +#define __pyx_kp_b_iso88591_xq __pyx_string_tab[152] +#define __pyx_kp_b_iso88591_y_F_HA_Qa_j_a __pyx_string_tab[153] +#define __pyx_kp_b_uint32_t_NULL_TREE_ID __pyx_string_tab[154] +#define __pyx_kp_b_uint64_t_void_int_uint64_t_hash6 __pyx_string_tab[155] +/* #### 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_5cymem_5cymem_PyMalloc); + Py_CLEAR(clear_module_state->__pyx_ptype_5cymem_5cymem_PyFree); + Py_CLEAR(clear_module_state->__pyx_ptype_5cymem_5cymem_Pool); + Py_CLEAR(clear_module_state->__pyx_ptype_5cymem_5cymem_Address); + Py_CLEAR(clear_module_state->__pyx_ptype_7preshed_4maps_PreshMap); + Py_CLEAR(clear_module_state->__pyx_ptype_7preshed_4maps_PreshMapArray); + Py_CLEAR(clear_module_state->__pyx_ptype_5spacy_7strings_StringStore); + Py_CLEAR(clear_module_state->__pyx_ptype_5spacy_8pipeline_20_edit_tree_internals_10edit_trees_EditTrees); + Py_CLEAR(clear_module_state->__pyx_type_5spacy_8pipeline_20_edit_tree_internals_10edit_trees_EditTrees); + Py_CLEAR(clear_module_state->__pyx_ptype_5spacy_8pipeline_20_edit_tree_internals_10edit_trees___pyx_scope_struct__from_bytes); + Py_CLEAR(clear_module_state->__pyx_type_5spacy_8pipeline_20_edit_tree_internals_10edit_trees___pyx_scope_struct__from_bytes); + Py_CLEAR(clear_module_state->__pyx_ptype_5spacy_8pipeline_20_edit_tree_internals_10edit_trees___pyx_scope_struct_1_to_bytes); + Py_CLEAR(clear_module_state->__pyx_type_5spacy_8pipeline_20_edit_tree_internals_10edit_trees___pyx_scope_struct_1_to_bytes); + for (int i=0; i<1; ++i) { Py_CLEAR(clear_module_state->__pyx_tuple[i]); } + for (int i=0; i<16; ++i) { Py_CLEAR(clear_module_state->__pyx_codeobj_tab[i]); } + for (int i=0; i<156; ++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_5cymem_5cymem_PyMalloc); + Py_VISIT(traverse_module_state->__pyx_ptype_5cymem_5cymem_PyFree); + Py_VISIT(traverse_module_state->__pyx_ptype_5cymem_5cymem_Pool); + Py_VISIT(traverse_module_state->__pyx_ptype_5cymem_5cymem_Address); + Py_VISIT(traverse_module_state->__pyx_ptype_7preshed_4maps_PreshMap); + Py_VISIT(traverse_module_state->__pyx_ptype_7preshed_4maps_PreshMapArray); + Py_VISIT(traverse_module_state->__pyx_ptype_5spacy_7strings_StringStore); + Py_VISIT(traverse_module_state->__pyx_ptype_5spacy_8pipeline_20_edit_tree_internals_10edit_trees_EditTrees); + Py_VISIT(traverse_module_state->__pyx_type_5spacy_8pipeline_20_edit_tree_internals_10edit_trees_EditTrees); + Py_VISIT(traverse_module_state->__pyx_ptype_5spacy_8pipeline_20_edit_tree_internals_10edit_trees___pyx_scope_struct__from_bytes); + Py_VISIT(traverse_module_state->__pyx_type_5spacy_8pipeline_20_edit_tree_internals_10edit_trees___pyx_scope_struct__from_bytes); + Py_VISIT(traverse_module_state->__pyx_ptype_5spacy_8pipeline_20_edit_tree_internals_10edit_trees___pyx_scope_struct_1_to_bytes); + Py_VISIT(traverse_module_state->__pyx_type_5spacy_8pipeline_20_edit_tree_internals_10edit_trees___pyx_scope_struct_1_to_bytes); + for (int i=0; i<1; ++i) { __Pyx_VISIT_CONST(traverse_module_state->__pyx_tuple[i]); } + for (int i=0; i<16; ++i) { __Pyx_VISIT_CONST(traverse_module_state->__pyx_codeobj_tab[i]); } + for (int i=0; i<156; ++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 ### */ + +/* "FromPyStructUtility":11 + * int __Pyx_RaiseUnexpectedTypeError(const char *expected, object obj) except 0 + * + * @cname("__pyx_convert__from_py_struct____pyx_t_5spacy_8pipeline_20_edit_tree_internals_10edit_trees_MatchNodeC") # <<<<<<<<<<<<<< + * cdef struct_type __pyx_convert__from_py_struct____pyx_t_5spacy_8pipeline_20_edit_tree_internals_10edit_trees_MatchNodeC(obj) except *: + * cdef struct_type result +*/ + +static struct __pyx_t_5spacy_8pipeline_20_edit_tree_internals_10edit_trees_MatchNodeC __pyx_convert__from_py_struct____pyx_t_5spacy_8pipeline_20_edit_tree_internals_10edit_trees_MatchNodeC(PyObject *__pyx_v_obj) { + struct __pyx_t_5spacy_8pipeline_20_edit_tree_internals_10edit_trees_MatchNodeC __pyx_v_result; + PyObject *__pyx_v_value = NULL; + struct __pyx_t_5spacy_8pipeline_20_edit_tree_internals_10edit_trees_MatchNodeC __pyx_r; + __Pyx_RefNannyDeclarations + int __pyx_t_1; + int __pyx_t_2; + PyObject *__pyx_t_3 = NULL; + PyObject *__pyx_t_4 = NULL; + PyObject *__pyx_t_5 = NULL; + PyObject *__pyx_t_6 = NULL; + PyObject *__pyx_t_7 = NULL; + PyObject *__pyx_t_8 = NULL; + PyObject *__pyx_t_9 = NULL; + PyObject *__pyx_t_10 = NULL; + size_t __pyx_t_11; + __pyx_t_5spacy_8typedefs_len_t __pyx_t_12; + uint32_t __pyx_t_13; + int __pyx_lineno = 0; + const char *__pyx_filename = NULL; + int __pyx_clineno = 0; + __Pyx_RefNannySetupContext("__pyx_convert__from_py_struct____pyx_t_5spacy_8pipeline_20_edit_tree_internals_10edit_trees_MatchNodeC", 0); + + /* "FromPyStructUtility":14 + * cdef struct_type __pyx_convert__from_py_struct____pyx_t_5spacy_8pipeline_20_edit_tree_internals_10edit_trees_MatchNodeC(obj) except *: + * cdef struct_type result + * if not PyMapping_Check(obj): # <<<<<<<<<<<<<< + * __Pyx_RaiseUnexpectedTypeError(b"a mapping", obj) + * +*/ + __pyx_t_1 = (!PyMapping_Check(__pyx_v_obj)); + if (__pyx_t_1) { + + /* "FromPyStructUtility":15 + * cdef struct_type result + * if not PyMapping_Check(obj): + * __Pyx_RaiseUnexpectedTypeError(b"a mapping", obj) # <<<<<<<<<<<<<< + * + * try: +*/ + __pyx_t_2 = __Pyx_RaiseUnexpectedTypeError(((char const *)"a mapping"), __pyx_v_obj); if (unlikely(__pyx_t_2 == ((int)0))) __PYX_ERR(1, 15, __pyx_L1_error) + + /* "FromPyStructUtility":14 + * cdef struct_type __pyx_convert__from_py_struct____pyx_t_5spacy_8pipeline_20_edit_tree_internals_10edit_trees_MatchNodeC(obj) except *: + * cdef struct_type result + * if not PyMapping_Check(obj): # <<<<<<<<<<<<<< + * __Pyx_RaiseUnexpectedTypeError(b"a mapping", obj) + * +*/ + } + + /* "FromPyStructUtility":17 + * __Pyx_RaiseUnexpectedTypeError(b"a mapping", obj) + * + * try: # <<<<<<<<<<<<<< + * value = obj['prefix_len'] + * except KeyError: +*/ + { + __Pyx_PyThreadState_declare + __Pyx_PyThreadState_assign + __Pyx_ExceptionSave(&__pyx_t_3, &__pyx_t_4, &__pyx_t_5); + __Pyx_XGOTREF(__pyx_t_3); + __Pyx_XGOTREF(__pyx_t_4); + __Pyx_XGOTREF(__pyx_t_5); + /*try:*/ { + + /* "FromPyStructUtility":18 + * + * try: + * value = obj['prefix_len'] # <<<<<<<<<<<<<< + * except KeyError: + * raise ValueError("No value specified for struct attribute 'prefix_len'") +*/ + __pyx_t_6 = __Pyx_PyObject_Dict_GetItem(__pyx_v_obj, __pyx_mstate_global->__pyx_n_u_prefix_len); if (unlikely(!__pyx_t_6)) __PYX_ERR(1, 18, __pyx_L4_error) + __Pyx_GOTREF(__pyx_t_6); + __pyx_v_value = __pyx_t_6; + __pyx_t_6 = 0; + + /* "FromPyStructUtility":17 + * __Pyx_RaiseUnexpectedTypeError(b"a mapping", obj) + * + * try: # <<<<<<<<<<<<<< + * value = obj['prefix_len'] + * except KeyError: +*/ + } + __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; + goto __pyx_L9_try_end; + __pyx_L4_error:; + __Pyx_XDECREF(__pyx_t_6); __pyx_t_6 = 0; + + /* "FromPyStructUtility":19 + * try: + * value = obj['prefix_len'] + * except KeyError: # <<<<<<<<<<<<<< + * raise ValueError("No value specified for struct attribute 'prefix_len'") + * result.prefix_len = value +*/ + __pyx_t_2 = __Pyx_PyErr_ExceptionMatches(((PyObject *)(((PyTypeObject*)PyExc_KeyError)))); + if (__pyx_t_2) { + __Pyx_AddTraceback("FromPyStructUtility.__pyx_convert__from_py_struct____pyx_t_5spacy_8pipeline_20_edit_tree_internals_10edit_trees_MatchNodeC", __pyx_clineno, __pyx_lineno, __pyx_filename); + if (__Pyx_GetException(&__pyx_t_6, &__pyx_t_7, &__pyx_t_8) < 0) __PYX_ERR(1, 19, __pyx_L6_except_error) + __Pyx_XGOTREF(__pyx_t_6); + __Pyx_XGOTREF(__pyx_t_7); + __Pyx_XGOTREF(__pyx_t_8); + + /* "FromPyStructUtility":20 + * value = obj['prefix_len'] + * except KeyError: + * raise ValueError("No value specified for struct attribute 'prefix_len'") # <<<<<<<<<<<<<< + * result.prefix_len = value + * try: +*/ + __pyx_t_10 = NULL; + __pyx_t_11 = 1; + { + PyObject *__pyx_callargs[2] = {__pyx_t_10, __pyx_mstate_global->__pyx_kp_u_No_value_specified_for_struct_at}; + __pyx_t_9 = __Pyx_PyObject_FastCall((PyObject*)(((PyTypeObject*)PyExc_ValueError)), __pyx_callargs+__pyx_t_11, (2-__pyx_t_11) | (__pyx_t_11*__Pyx_PY_VECTORCALL_ARGUMENTS_OFFSET)); + __Pyx_XDECREF(__pyx_t_10); __pyx_t_10 = 0; + if (unlikely(!__pyx_t_9)) __PYX_ERR(1, 20, __pyx_L6_except_error) + __Pyx_GOTREF(__pyx_t_9); + } + __Pyx_Raise(__pyx_t_9, 0, 0, 0); + __Pyx_DECREF(__pyx_t_9); __pyx_t_9 = 0; + __PYX_ERR(1, 20, __pyx_L6_except_error) + } + goto __pyx_L6_except_error; + + /* "FromPyStructUtility":17 + * __Pyx_RaiseUnexpectedTypeError(b"a mapping", obj) + * + * try: # <<<<<<<<<<<<<< + * value = obj['prefix_len'] + * except KeyError: +*/ + __pyx_L6_except_error:; + __Pyx_XGIVEREF(__pyx_t_3); + __Pyx_XGIVEREF(__pyx_t_4); + __Pyx_XGIVEREF(__pyx_t_5); + __Pyx_ExceptionReset(__pyx_t_3, __pyx_t_4, __pyx_t_5); + goto __pyx_L1_error; + __pyx_L9_try_end:; + } + + /* "FromPyStructUtility":21 + * except KeyError: + * raise ValueError("No value specified for struct attribute 'prefix_len'") + * result.prefix_len = value # <<<<<<<<<<<<<< + * try: + * value = obj['suffix_len'] +*/ + __pyx_t_12 = __Pyx_PyLong_As_uint16_t(__pyx_v_value); if (unlikely((__pyx_t_12 == ((uint16_t)-1)) && PyErr_Occurred())) __PYX_ERR(1, 21, __pyx_L1_error) + __pyx_v_result.prefix_len = __pyx_t_12; + + /* "FromPyStructUtility":22 + * raise ValueError("No value specified for struct attribute 'prefix_len'") + * result.prefix_len = value + * try: # <<<<<<<<<<<<<< + * value = obj['suffix_len'] + * except KeyError: +*/ + { + __Pyx_PyThreadState_declare + __Pyx_PyThreadState_assign + __Pyx_ExceptionSave(&__pyx_t_5, &__pyx_t_4, &__pyx_t_3); + __Pyx_XGOTREF(__pyx_t_5); + __Pyx_XGOTREF(__pyx_t_4); + __Pyx_XGOTREF(__pyx_t_3); + /*try:*/ { + + /* "FromPyStructUtility":23 + * result.prefix_len = value + * try: + * value = obj['suffix_len'] # <<<<<<<<<<<<<< + * except KeyError: + * raise ValueError("No value specified for struct attribute 'suffix_len'") +*/ + __pyx_t_8 = __Pyx_PyObject_Dict_GetItem(__pyx_v_obj, __pyx_mstate_global->__pyx_n_u_suffix_len); if (unlikely(!__pyx_t_8)) __PYX_ERR(1, 23, __pyx_L12_error) + __Pyx_GOTREF(__pyx_t_8); + __Pyx_DECREF_SET(__pyx_v_value, __pyx_t_8); + __pyx_t_8 = 0; + + /* "FromPyStructUtility":22 + * raise ValueError("No value specified for struct attribute 'prefix_len'") + * result.prefix_len = value + * try: # <<<<<<<<<<<<<< + * value = obj['suffix_len'] + * except KeyError: +*/ + } + __Pyx_XDECREF(__pyx_t_5); __pyx_t_5 = 0; + __Pyx_XDECREF(__pyx_t_4); __pyx_t_4 = 0; + __Pyx_XDECREF(__pyx_t_3); __pyx_t_3 = 0; + goto __pyx_L17_try_end; + __pyx_L12_error:; + __Pyx_XDECREF(__pyx_t_10); __pyx_t_10 = 0; + __Pyx_XDECREF(__pyx_t_6); __pyx_t_6 = 0; + __Pyx_XDECREF(__pyx_t_7); __pyx_t_7 = 0; + __Pyx_XDECREF(__pyx_t_8); __pyx_t_8 = 0; + __Pyx_XDECREF(__pyx_t_9); __pyx_t_9 = 0; + + /* "FromPyStructUtility":24 + * try: + * value = obj['suffix_len'] + * except KeyError: # <<<<<<<<<<<<<< + * raise ValueError("No value specified for struct attribute 'suffix_len'") + * result.suffix_len = value +*/ + __pyx_t_2 = __Pyx_PyErr_ExceptionMatches(((PyObject *)(((PyTypeObject*)PyExc_KeyError)))); + if (__pyx_t_2) { + __Pyx_AddTraceback("FromPyStructUtility.__pyx_convert__from_py_struct____pyx_t_5spacy_8pipeline_20_edit_tree_internals_10edit_trees_MatchNodeC", __pyx_clineno, __pyx_lineno, __pyx_filename); + if (__Pyx_GetException(&__pyx_t_8, &__pyx_t_7, &__pyx_t_6) < 0) __PYX_ERR(1, 24, __pyx_L14_except_error) + __Pyx_XGOTREF(__pyx_t_8); + __Pyx_XGOTREF(__pyx_t_7); + __Pyx_XGOTREF(__pyx_t_6); + + /* "FromPyStructUtility":25 + * value = obj['suffix_len'] + * except KeyError: + * raise ValueError("No value specified for struct attribute 'suffix_len'") # <<<<<<<<<<<<<< + * result.suffix_len = value + * try: +*/ + __pyx_t_10 = NULL; + __pyx_t_11 = 1; + { + PyObject *__pyx_callargs[2] = {__pyx_t_10, __pyx_mstate_global->__pyx_kp_u_No_value_specified_for_struct_at_2}; + __pyx_t_9 = __Pyx_PyObject_FastCall((PyObject*)(((PyTypeObject*)PyExc_ValueError)), __pyx_callargs+__pyx_t_11, (2-__pyx_t_11) | (__pyx_t_11*__Pyx_PY_VECTORCALL_ARGUMENTS_OFFSET)); + __Pyx_XDECREF(__pyx_t_10); __pyx_t_10 = 0; + if (unlikely(!__pyx_t_9)) __PYX_ERR(1, 25, __pyx_L14_except_error) + __Pyx_GOTREF(__pyx_t_9); + } + __Pyx_Raise(__pyx_t_9, 0, 0, 0); + __Pyx_DECREF(__pyx_t_9); __pyx_t_9 = 0; + __PYX_ERR(1, 25, __pyx_L14_except_error) + } + goto __pyx_L14_except_error; + + /* "FromPyStructUtility":22 + * raise ValueError("No value specified for struct attribute 'prefix_len'") + * result.prefix_len = value + * try: # <<<<<<<<<<<<<< + * value = obj['suffix_len'] + * except KeyError: +*/ + __pyx_L14_except_error:; + __Pyx_XGIVEREF(__pyx_t_5); + __Pyx_XGIVEREF(__pyx_t_4); + __Pyx_XGIVEREF(__pyx_t_3); + __Pyx_ExceptionReset(__pyx_t_5, __pyx_t_4, __pyx_t_3); + goto __pyx_L1_error; + __pyx_L17_try_end:; + } + + /* "FromPyStructUtility":26 + * except KeyError: + * raise ValueError("No value specified for struct attribute 'suffix_len'") + * result.suffix_len = value # <<<<<<<<<<<<<< + * try: + * value = obj['prefix_tree'] +*/ + __pyx_t_12 = __Pyx_PyLong_As_uint16_t(__pyx_v_value); if (unlikely((__pyx_t_12 == ((uint16_t)-1)) && PyErr_Occurred())) __PYX_ERR(1, 26, __pyx_L1_error) + __pyx_v_result.suffix_len = __pyx_t_12; + + /* "FromPyStructUtility":27 + * raise ValueError("No value specified for struct attribute 'suffix_len'") + * result.suffix_len = value + * try: # <<<<<<<<<<<<<< + * value = obj['prefix_tree'] + * except KeyError: +*/ + { + __Pyx_PyThreadState_declare + __Pyx_PyThreadState_assign + __Pyx_ExceptionSave(&__pyx_t_3, &__pyx_t_4, &__pyx_t_5); + __Pyx_XGOTREF(__pyx_t_3); + __Pyx_XGOTREF(__pyx_t_4); + __Pyx_XGOTREF(__pyx_t_5); + /*try:*/ { + + /* "FromPyStructUtility":28 + * result.suffix_len = value + * try: + * value = obj['prefix_tree'] # <<<<<<<<<<<<<< + * except KeyError: + * raise ValueError("No value specified for struct attribute 'prefix_tree'") +*/ + __pyx_t_6 = __Pyx_PyObject_Dict_GetItem(__pyx_v_obj, __pyx_mstate_global->__pyx_n_u_prefix_tree); if (unlikely(!__pyx_t_6)) __PYX_ERR(1, 28, __pyx_L20_error) + __Pyx_GOTREF(__pyx_t_6); + __Pyx_DECREF_SET(__pyx_v_value, __pyx_t_6); + __pyx_t_6 = 0; + + /* "FromPyStructUtility":27 + * raise ValueError("No value specified for struct attribute 'suffix_len'") + * result.suffix_len = value + * try: # <<<<<<<<<<<<<< + * value = obj['prefix_tree'] + * except KeyError: +*/ + } + __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; + goto __pyx_L25_try_end; + __pyx_L20_error:; + __Pyx_XDECREF(__pyx_t_10); __pyx_t_10 = 0; + __Pyx_XDECREF(__pyx_t_6); __pyx_t_6 = 0; + __Pyx_XDECREF(__pyx_t_7); __pyx_t_7 = 0; + __Pyx_XDECREF(__pyx_t_8); __pyx_t_8 = 0; + __Pyx_XDECREF(__pyx_t_9); __pyx_t_9 = 0; + + /* "FromPyStructUtility":29 + * try: + * value = obj['prefix_tree'] + * except KeyError: # <<<<<<<<<<<<<< + * raise ValueError("No value specified for struct attribute 'prefix_tree'") + * result.prefix_tree = value +*/ + __pyx_t_2 = __Pyx_PyErr_ExceptionMatches(((PyObject *)(((PyTypeObject*)PyExc_KeyError)))); + if (__pyx_t_2) { + __Pyx_AddTraceback("FromPyStructUtility.__pyx_convert__from_py_struct____pyx_t_5spacy_8pipeline_20_edit_tree_internals_10edit_trees_MatchNodeC", __pyx_clineno, __pyx_lineno, __pyx_filename); + if (__Pyx_GetException(&__pyx_t_6, &__pyx_t_7, &__pyx_t_8) < 0) __PYX_ERR(1, 29, __pyx_L22_except_error) + __Pyx_XGOTREF(__pyx_t_6); + __Pyx_XGOTREF(__pyx_t_7); + __Pyx_XGOTREF(__pyx_t_8); + + /* "FromPyStructUtility":30 + * value = obj['prefix_tree'] + * except KeyError: + * raise ValueError("No value specified for struct attribute 'prefix_tree'") # <<<<<<<<<<<<<< + * result.prefix_tree = value + * try: +*/ + __pyx_t_10 = NULL; + __pyx_t_11 = 1; + { + PyObject *__pyx_callargs[2] = {__pyx_t_10, __pyx_mstate_global->__pyx_kp_u_No_value_specified_for_struct_at_3}; + __pyx_t_9 = __Pyx_PyObject_FastCall((PyObject*)(((PyTypeObject*)PyExc_ValueError)), __pyx_callargs+__pyx_t_11, (2-__pyx_t_11) | (__pyx_t_11*__Pyx_PY_VECTORCALL_ARGUMENTS_OFFSET)); + __Pyx_XDECREF(__pyx_t_10); __pyx_t_10 = 0; + if (unlikely(!__pyx_t_9)) __PYX_ERR(1, 30, __pyx_L22_except_error) + __Pyx_GOTREF(__pyx_t_9); + } + __Pyx_Raise(__pyx_t_9, 0, 0, 0); + __Pyx_DECREF(__pyx_t_9); __pyx_t_9 = 0; + __PYX_ERR(1, 30, __pyx_L22_except_error) + } + goto __pyx_L22_except_error; + + /* "FromPyStructUtility":27 + * raise ValueError("No value specified for struct attribute 'suffix_len'") + * result.suffix_len = value + * try: # <<<<<<<<<<<<<< + * value = obj['prefix_tree'] + * except KeyError: +*/ + __pyx_L22_except_error:; + __Pyx_XGIVEREF(__pyx_t_3); + __Pyx_XGIVEREF(__pyx_t_4); + __Pyx_XGIVEREF(__pyx_t_5); + __Pyx_ExceptionReset(__pyx_t_3, __pyx_t_4, __pyx_t_5); + goto __pyx_L1_error; + __pyx_L25_try_end:; + } + + /* "FromPyStructUtility":31 + * except KeyError: + * raise ValueError("No value specified for struct attribute 'prefix_tree'") + * result.prefix_tree = value # <<<<<<<<<<<<<< + * try: + * value = obj['suffix_tree'] +*/ + __pyx_t_13 = __Pyx_PyLong_As_uint32_t(__pyx_v_value); if (unlikely((__pyx_t_13 == ((uint32_t)-1)) && PyErr_Occurred())) __PYX_ERR(1, 31, __pyx_L1_error) + __pyx_v_result.prefix_tree = __pyx_t_13; + + /* "FromPyStructUtility":32 + * raise ValueError("No value specified for struct attribute 'prefix_tree'") + * result.prefix_tree = value + * try: # <<<<<<<<<<<<<< + * value = obj['suffix_tree'] + * except KeyError: +*/ + { + __Pyx_PyThreadState_declare + __Pyx_PyThreadState_assign + __Pyx_ExceptionSave(&__pyx_t_5, &__pyx_t_4, &__pyx_t_3); + __Pyx_XGOTREF(__pyx_t_5); + __Pyx_XGOTREF(__pyx_t_4); + __Pyx_XGOTREF(__pyx_t_3); + /*try:*/ { + + /* "FromPyStructUtility":33 + * result.prefix_tree = value + * try: + * value = obj['suffix_tree'] # <<<<<<<<<<<<<< + * except KeyError: + * raise ValueError("No value specified for struct attribute 'suffix_tree'") +*/ + __pyx_t_8 = __Pyx_PyObject_Dict_GetItem(__pyx_v_obj, __pyx_mstate_global->__pyx_n_u_suffix_tree); if (unlikely(!__pyx_t_8)) __PYX_ERR(1, 33, __pyx_L28_error) + __Pyx_GOTREF(__pyx_t_8); + __Pyx_DECREF_SET(__pyx_v_value, __pyx_t_8); + __pyx_t_8 = 0; + + /* "FromPyStructUtility":32 + * raise ValueError("No value specified for struct attribute 'prefix_tree'") + * result.prefix_tree = value + * try: # <<<<<<<<<<<<<< + * value = obj['suffix_tree'] + * except KeyError: +*/ + } + __Pyx_XDECREF(__pyx_t_5); __pyx_t_5 = 0; + __Pyx_XDECREF(__pyx_t_4); __pyx_t_4 = 0; + __Pyx_XDECREF(__pyx_t_3); __pyx_t_3 = 0; + goto __pyx_L33_try_end; + __pyx_L28_error:; + __Pyx_XDECREF(__pyx_t_10); __pyx_t_10 = 0; + __Pyx_XDECREF(__pyx_t_6); __pyx_t_6 = 0; + __Pyx_XDECREF(__pyx_t_7); __pyx_t_7 = 0; + __Pyx_XDECREF(__pyx_t_8); __pyx_t_8 = 0; + __Pyx_XDECREF(__pyx_t_9); __pyx_t_9 = 0; + + /* "FromPyStructUtility":34 + * try: + * value = obj['suffix_tree'] + * except KeyError: # <<<<<<<<<<<<<< + * raise ValueError("No value specified for struct attribute 'suffix_tree'") + * result.suffix_tree = value +*/ + __pyx_t_2 = __Pyx_PyErr_ExceptionMatches(((PyObject *)(((PyTypeObject*)PyExc_KeyError)))); + if (__pyx_t_2) { + __Pyx_AddTraceback("FromPyStructUtility.__pyx_convert__from_py_struct____pyx_t_5spacy_8pipeline_20_edit_tree_internals_10edit_trees_MatchNodeC", __pyx_clineno, __pyx_lineno, __pyx_filename); + if (__Pyx_GetException(&__pyx_t_8, &__pyx_t_7, &__pyx_t_6) < 0) __PYX_ERR(1, 34, __pyx_L30_except_error) + __Pyx_XGOTREF(__pyx_t_8); + __Pyx_XGOTREF(__pyx_t_7); + __Pyx_XGOTREF(__pyx_t_6); + + /* "FromPyStructUtility":35 + * value = obj['suffix_tree'] + * except KeyError: + * raise ValueError("No value specified for struct attribute 'suffix_tree'") # <<<<<<<<<<<<<< + * result.suffix_tree = value + * return result +*/ + __pyx_t_10 = NULL; + __pyx_t_11 = 1; + { + PyObject *__pyx_callargs[2] = {__pyx_t_10, __pyx_mstate_global->__pyx_kp_u_No_value_specified_for_struct_at_4}; + __pyx_t_9 = __Pyx_PyObject_FastCall((PyObject*)(((PyTypeObject*)PyExc_ValueError)), __pyx_callargs+__pyx_t_11, (2-__pyx_t_11) | (__pyx_t_11*__Pyx_PY_VECTORCALL_ARGUMENTS_OFFSET)); + __Pyx_XDECREF(__pyx_t_10); __pyx_t_10 = 0; + if (unlikely(!__pyx_t_9)) __PYX_ERR(1, 35, __pyx_L30_except_error) + __Pyx_GOTREF(__pyx_t_9); + } + __Pyx_Raise(__pyx_t_9, 0, 0, 0); + __Pyx_DECREF(__pyx_t_9); __pyx_t_9 = 0; + __PYX_ERR(1, 35, __pyx_L30_except_error) + } + goto __pyx_L30_except_error; + + /* "FromPyStructUtility":32 + * raise ValueError("No value specified for struct attribute 'prefix_tree'") + * result.prefix_tree = value + * try: # <<<<<<<<<<<<<< + * value = obj['suffix_tree'] + * except KeyError: +*/ + __pyx_L30_except_error:; + __Pyx_XGIVEREF(__pyx_t_5); + __Pyx_XGIVEREF(__pyx_t_4); + __Pyx_XGIVEREF(__pyx_t_3); + __Pyx_ExceptionReset(__pyx_t_5, __pyx_t_4, __pyx_t_3); + goto __pyx_L1_error; + __pyx_L33_try_end:; + } + + /* "FromPyStructUtility":36 + * except KeyError: + * raise ValueError("No value specified for struct attribute 'suffix_tree'") + * result.suffix_tree = value # <<<<<<<<<<<<<< + * return result + * +*/ + __pyx_t_13 = __Pyx_PyLong_As_uint32_t(__pyx_v_value); if (unlikely((__pyx_t_13 == ((uint32_t)-1)) && PyErr_Occurred())) __PYX_ERR(1, 36, __pyx_L1_error) + __pyx_v_result.suffix_tree = __pyx_t_13; + + /* "FromPyStructUtility":37 + * raise ValueError("No value specified for struct attribute 'suffix_tree'") + * result.suffix_tree = value + * return result # <<<<<<<<<<<<<< + * +*/ + __pyx_r = __pyx_v_result; + goto __pyx_L0; + + /* "FromPyStructUtility":11 + * int __Pyx_RaiseUnexpectedTypeError(const char *expected, object obj) except 0 + * + * @cname("__pyx_convert__from_py_struct____pyx_t_5spacy_8pipeline_20_edit_tree_internals_10edit_trees_MatchNodeC") # <<<<<<<<<<<<<< + * cdef struct_type __pyx_convert__from_py_struct____pyx_t_5spacy_8pipeline_20_edit_tree_internals_10edit_trees_MatchNodeC(obj) except *: + * cdef struct_type result +*/ + + /* function exit code */ + __pyx_L1_error:; + __Pyx_XDECREF(__pyx_t_6); + __Pyx_XDECREF(__pyx_t_7); + __Pyx_XDECREF(__pyx_t_8); + __Pyx_XDECREF(__pyx_t_9); + __Pyx_XDECREF(__pyx_t_10); + __Pyx_AddTraceback("FromPyStructUtility.__pyx_convert__from_py_struct____pyx_t_5spacy_8pipeline_20_edit_tree_internals_10edit_trees_MatchNodeC", __pyx_clineno, __pyx_lineno, __pyx_filename); + __Pyx_pretend_to_initialize(&__pyx_r); + __pyx_L0:; + __Pyx_XDECREF(__pyx_v_value); + __Pyx_RefNannyFinishContext(); + return __pyx_r; +} + +static struct __pyx_t_5spacy_8pipeline_20_edit_tree_internals_10edit_trees_SubstNodeC __pyx_convert__from_py_struct____pyx_t_5spacy_8pipeline_20_edit_tree_internals_10edit_trees_SubstNodeC(PyObject *__pyx_v_obj) { + struct __pyx_t_5spacy_8pipeline_20_edit_tree_internals_10edit_trees_SubstNodeC __pyx_v_result; + PyObject *__pyx_v_value = NULL; + struct __pyx_t_5spacy_8pipeline_20_edit_tree_internals_10edit_trees_SubstNodeC __pyx_r; + __Pyx_RefNannyDeclarations + int __pyx_t_1; + int __pyx_t_2; + PyObject *__pyx_t_3 = NULL; + PyObject *__pyx_t_4 = NULL; + PyObject *__pyx_t_5 = NULL; + PyObject *__pyx_t_6 = NULL; + PyObject *__pyx_t_7 = NULL; + PyObject *__pyx_t_8 = NULL; + PyObject *__pyx_t_9 = NULL; + PyObject *__pyx_t_10 = NULL; + size_t __pyx_t_11; + __pyx_t_5spacy_8typedefs_attr_t __pyx_t_12; + int __pyx_lineno = 0; + const char *__pyx_filename = NULL; + int __pyx_clineno = 0; + __Pyx_RefNannySetupContext("__pyx_convert__from_py_struct____pyx_t_5spacy_8pipeline_20_edit_tree_internals_10edit_trees_SubstNodeC", 0); + + /* "FromPyStructUtility":14 + * cdef struct_type __pyx_convert__from_py_struct____pyx_t_5spacy_8pipeline_20_edit_tree_internals_10edit_trees_SubstNodeC(obj) except *: + * cdef struct_type result + * if not PyMapping_Check(obj): # <<<<<<<<<<<<<< + * __Pyx_RaiseUnexpectedTypeError(b"a mapping", obj) + * +*/ + __pyx_t_1 = (!PyMapping_Check(__pyx_v_obj)); + if (__pyx_t_1) { + + /* "FromPyStructUtility":15 + * cdef struct_type result + * if not PyMapping_Check(obj): + * __Pyx_RaiseUnexpectedTypeError(b"a mapping", obj) # <<<<<<<<<<<<<< + * + * try: +*/ + __pyx_t_2 = __Pyx_RaiseUnexpectedTypeError(((char const *)"a mapping"), __pyx_v_obj); if (unlikely(__pyx_t_2 == ((int)0))) __PYX_ERR(1, 15, __pyx_L1_error) + + /* "FromPyStructUtility":14 + * cdef struct_type __pyx_convert__from_py_struct____pyx_t_5spacy_8pipeline_20_edit_tree_internals_10edit_trees_SubstNodeC(obj) except *: + * cdef struct_type result + * if not PyMapping_Check(obj): # <<<<<<<<<<<<<< + * __Pyx_RaiseUnexpectedTypeError(b"a mapping", obj) + * +*/ + } + + /* "FromPyStructUtility":17 + * __Pyx_RaiseUnexpectedTypeError(b"a mapping", obj) + * + * try: # <<<<<<<<<<<<<< + * value = obj['orig'] + * except KeyError: +*/ + { + __Pyx_PyThreadState_declare + __Pyx_PyThreadState_assign + __Pyx_ExceptionSave(&__pyx_t_3, &__pyx_t_4, &__pyx_t_5); + __Pyx_XGOTREF(__pyx_t_3); + __Pyx_XGOTREF(__pyx_t_4); + __Pyx_XGOTREF(__pyx_t_5); + /*try:*/ { + + /* "FromPyStructUtility":18 + * + * try: + * value = obj['orig'] # <<<<<<<<<<<<<< + * except KeyError: + * raise ValueError("No value specified for struct attribute 'orig'") +*/ + __pyx_t_6 = __Pyx_PyObject_Dict_GetItem(__pyx_v_obj, __pyx_mstate_global->__pyx_n_u_orig); if (unlikely(!__pyx_t_6)) __PYX_ERR(1, 18, __pyx_L4_error) + __Pyx_GOTREF(__pyx_t_6); + __pyx_v_value = __pyx_t_6; + __pyx_t_6 = 0; + + /* "FromPyStructUtility":17 + * __Pyx_RaiseUnexpectedTypeError(b"a mapping", obj) + * + * try: # <<<<<<<<<<<<<< + * value = obj['orig'] + * except KeyError: +*/ + } + __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; + goto __pyx_L9_try_end; + __pyx_L4_error:; + __Pyx_XDECREF(__pyx_t_6); __pyx_t_6 = 0; + + /* "FromPyStructUtility":19 + * try: + * value = obj['orig'] + * except KeyError: # <<<<<<<<<<<<<< + * raise ValueError("No value specified for struct attribute 'orig'") + * result.orig = value +*/ + __pyx_t_2 = __Pyx_PyErr_ExceptionMatches(((PyObject *)(((PyTypeObject*)PyExc_KeyError)))); + if (__pyx_t_2) { + __Pyx_AddTraceback("FromPyStructUtility.__pyx_convert__from_py_struct____pyx_t_5spacy_8pipeline_20_edit_tree_internals_10edit_trees_SubstNodeC", __pyx_clineno, __pyx_lineno, __pyx_filename); + if (__Pyx_GetException(&__pyx_t_6, &__pyx_t_7, &__pyx_t_8) < 0) __PYX_ERR(1, 19, __pyx_L6_except_error) + __Pyx_XGOTREF(__pyx_t_6); + __Pyx_XGOTREF(__pyx_t_7); + __Pyx_XGOTREF(__pyx_t_8); + + /* "FromPyStructUtility":20 + * value = obj['orig'] + * except KeyError: + * raise ValueError("No value specified for struct attribute 'orig'") # <<<<<<<<<<<<<< + * result.orig = value + * try: +*/ + __pyx_t_10 = NULL; + __pyx_t_11 = 1; + { + PyObject *__pyx_callargs[2] = {__pyx_t_10, __pyx_mstate_global->__pyx_kp_u_No_value_specified_for_struct_at_5}; + __pyx_t_9 = __Pyx_PyObject_FastCall((PyObject*)(((PyTypeObject*)PyExc_ValueError)), __pyx_callargs+__pyx_t_11, (2-__pyx_t_11) | (__pyx_t_11*__Pyx_PY_VECTORCALL_ARGUMENTS_OFFSET)); + __Pyx_XDECREF(__pyx_t_10); __pyx_t_10 = 0; + if (unlikely(!__pyx_t_9)) __PYX_ERR(1, 20, __pyx_L6_except_error) + __Pyx_GOTREF(__pyx_t_9); + } + __Pyx_Raise(__pyx_t_9, 0, 0, 0); + __Pyx_DECREF(__pyx_t_9); __pyx_t_9 = 0; + __PYX_ERR(1, 20, __pyx_L6_except_error) + } + goto __pyx_L6_except_error; + + /* "FromPyStructUtility":17 + * __Pyx_RaiseUnexpectedTypeError(b"a mapping", obj) + * + * try: # <<<<<<<<<<<<<< + * value = obj['orig'] + * except KeyError: +*/ + __pyx_L6_except_error:; + __Pyx_XGIVEREF(__pyx_t_3); + __Pyx_XGIVEREF(__pyx_t_4); + __Pyx_XGIVEREF(__pyx_t_5); + __Pyx_ExceptionReset(__pyx_t_3, __pyx_t_4, __pyx_t_5); + goto __pyx_L1_error; + __pyx_L9_try_end:; + } + + /* "FromPyStructUtility":21 + * except KeyError: + * raise ValueError("No value specified for struct attribute 'orig'") + * result.orig = value # <<<<<<<<<<<<<< + * try: + * value = obj['subst'] +*/ + __pyx_t_12 = __Pyx_PyLong_As_uint64_t(__pyx_v_value); if (unlikely((__pyx_t_12 == ((uint64_t)-1)) && PyErr_Occurred())) __PYX_ERR(1, 21, __pyx_L1_error) + __pyx_v_result.orig = __pyx_t_12; + + /* "FromPyStructUtility":22 + * raise ValueError("No value specified for struct attribute 'orig'") + * result.orig = value + * try: # <<<<<<<<<<<<<< + * value = obj['subst'] + * except KeyError: +*/ + { + __Pyx_PyThreadState_declare + __Pyx_PyThreadState_assign + __Pyx_ExceptionSave(&__pyx_t_5, &__pyx_t_4, &__pyx_t_3); + __Pyx_XGOTREF(__pyx_t_5); + __Pyx_XGOTREF(__pyx_t_4); + __Pyx_XGOTREF(__pyx_t_3); + /*try:*/ { + + /* "FromPyStructUtility":23 + * result.orig = value + * try: + * value = obj['subst'] # <<<<<<<<<<<<<< + * except KeyError: + * raise ValueError("No value specified for struct attribute 'subst'") +*/ + __pyx_t_8 = __Pyx_PyObject_Dict_GetItem(__pyx_v_obj, __pyx_mstate_global->__pyx_n_u_subst); if (unlikely(!__pyx_t_8)) __PYX_ERR(1, 23, __pyx_L12_error) + __Pyx_GOTREF(__pyx_t_8); + __Pyx_DECREF_SET(__pyx_v_value, __pyx_t_8); + __pyx_t_8 = 0; + + /* "FromPyStructUtility":22 + * raise ValueError("No value specified for struct attribute 'orig'") + * result.orig = value + * try: # <<<<<<<<<<<<<< + * value = obj['subst'] + * except KeyError: +*/ + } + __Pyx_XDECREF(__pyx_t_5); __pyx_t_5 = 0; + __Pyx_XDECREF(__pyx_t_4); __pyx_t_4 = 0; + __Pyx_XDECREF(__pyx_t_3); __pyx_t_3 = 0; + goto __pyx_L17_try_end; + __pyx_L12_error:; + __Pyx_XDECREF(__pyx_t_10); __pyx_t_10 = 0; + __Pyx_XDECREF(__pyx_t_6); __pyx_t_6 = 0; + __Pyx_XDECREF(__pyx_t_7); __pyx_t_7 = 0; + __Pyx_XDECREF(__pyx_t_8); __pyx_t_8 = 0; + __Pyx_XDECREF(__pyx_t_9); __pyx_t_9 = 0; + + /* "FromPyStructUtility":24 + * try: + * value = obj['subst'] + * except KeyError: # <<<<<<<<<<<<<< + * raise ValueError("No value specified for struct attribute 'subst'") + * result.subst = value +*/ + __pyx_t_2 = __Pyx_PyErr_ExceptionMatches(((PyObject *)(((PyTypeObject*)PyExc_KeyError)))); + if (__pyx_t_2) { + __Pyx_AddTraceback("FromPyStructUtility.__pyx_convert__from_py_struct____pyx_t_5spacy_8pipeline_20_edit_tree_internals_10edit_trees_SubstNodeC", __pyx_clineno, __pyx_lineno, __pyx_filename); + if (__Pyx_GetException(&__pyx_t_8, &__pyx_t_7, &__pyx_t_6) < 0) __PYX_ERR(1, 24, __pyx_L14_except_error) + __Pyx_XGOTREF(__pyx_t_8); + __Pyx_XGOTREF(__pyx_t_7); + __Pyx_XGOTREF(__pyx_t_6); + + /* "FromPyStructUtility":25 + * value = obj['subst'] + * except KeyError: + * raise ValueError("No value specified for struct attribute 'subst'") # <<<<<<<<<<<<<< + * result.subst = value + * return result +*/ + __pyx_t_10 = NULL; + __pyx_t_11 = 1; + { + PyObject *__pyx_callargs[2] = {__pyx_t_10, __pyx_mstate_global->__pyx_kp_u_No_value_specified_for_struct_at_6}; + __pyx_t_9 = __Pyx_PyObject_FastCall((PyObject*)(((PyTypeObject*)PyExc_ValueError)), __pyx_callargs+__pyx_t_11, (2-__pyx_t_11) | (__pyx_t_11*__Pyx_PY_VECTORCALL_ARGUMENTS_OFFSET)); + __Pyx_XDECREF(__pyx_t_10); __pyx_t_10 = 0; + if (unlikely(!__pyx_t_9)) __PYX_ERR(1, 25, __pyx_L14_except_error) + __Pyx_GOTREF(__pyx_t_9); + } + __Pyx_Raise(__pyx_t_9, 0, 0, 0); + __Pyx_DECREF(__pyx_t_9); __pyx_t_9 = 0; + __PYX_ERR(1, 25, __pyx_L14_except_error) + } + goto __pyx_L14_except_error; + + /* "FromPyStructUtility":22 + * raise ValueError("No value specified for struct attribute 'orig'") + * result.orig = value + * try: # <<<<<<<<<<<<<< + * value = obj['subst'] + * except KeyError: +*/ + __pyx_L14_except_error:; + __Pyx_XGIVEREF(__pyx_t_5); + __Pyx_XGIVEREF(__pyx_t_4); + __Pyx_XGIVEREF(__pyx_t_3); + __Pyx_ExceptionReset(__pyx_t_5, __pyx_t_4, __pyx_t_3); + goto __pyx_L1_error; + __pyx_L17_try_end:; + } + + /* "FromPyStructUtility":26 + * except KeyError: + * raise ValueError("No value specified for struct attribute 'subst'") + * result.subst = value # <<<<<<<<<<<<<< + * return result + * +*/ + __pyx_t_12 = __Pyx_PyLong_As_uint64_t(__pyx_v_value); if (unlikely((__pyx_t_12 == ((uint64_t)-1)) && PyErr_Occurred())) __PYX_ERR(1, 26, __pyx_L1_error) + __pyx_v_result.subst = __pyx_t_12; + + /* "FromPyStructUtility":27 + * raise ValueError("No value specified for struct attribute 'subst'") + * result.subst = value + * return result # <<<<<<<<<<<<<< + * +*/ + __pyx_r = __pyx_v_result; + goto __pyx_L0; + + /* "FromPyStructUtility":11 + * int __Pyx_RaiseUnexpectedTypeError(const char *expected, object obj) except 0 + * + * @cname("__pyx_convert__from_py_struct____pyx_t_5spacy_8pipeline_20_edit_tree_internals_10edit_trees_SubstNodeC") # <<<<<<<<<<<<<< + * cdef struct_type __pyx_convert__from_py_struct____pyx_t_5spacy_8pipeline_20_edit_tree_internals_10edit_trees_SubstNodeC(obj) except *: + * cdef struct_type result +*/ + + /* function exit code */ + __pyx_L1_error:; + __Pyx_XDECREF(__pyx_t_6); + __Pyx_XDECREF(__pyx_t_7); + __Pyx_XDECREF(__pyx_t_8); + __Pyx_XDECREF(__pyx_t_9); + __Pyx_XDECREF(__pyx_t_10); + __Pyx_AddTraceback("FromPyStructUtility.__pyx_convert__from_py_struct____pyx_t_5spacy_8pipeline_20_edit_tree_internals_10edit_trees_SubstNodeC", __pyx_clineno, __pyx_lineno, __pyx_filename); + __Pyx_pretend_to_initialize(&__pyx_r); + __pyx_L0:; + __Pyx_XDECREF(__pyx_v_value); + __Pyx_RefNannyFinishContext(); + return __pyx_r; +} + +/* "FromPyUnionUtility":37 + * int __Pyx_RaiseUnexpectedTypeError(const char *expected, object obj) except 0 + * + * @cname("__pyx_convert__from_py_union____pyx_t_5spacy_8pipeline_20_edit_tree_internals_10edit_trees_NodeC") # <<<<<<<<<<<<<< + * cdef struct_type __pyx_convert__from_py_union____pyx_t_5spacy_8pipeline_20_edit_tree_internals_10edit_trees_NodeC(obj) except *: + * cdef struct_type result +*/ + +static union __pyx_t_5spacy_8pipeline_20_edit_tree_internals_10edit_trees_NodeC __pyx_convert__from_py_union____pyx_t_5spacy_8pipeline_20_edit_tree_internals_10edit_trees_NodeC(PyObject *__pyx_v_obj) { + union __pyx_t_5spacy_8pipeline_20_edit_tree_internals_10edit_trees_NodeC __pyx_v_result; + Py_ssize_t __pyx_v_length; + PyObject *__pyx_v_last_found = NULL; + union __pyx_t_5spacy_8pipeline_20_edit_tree_internals_10edit_trees_NodeC __pyx_r; + __Pyx_RefNannyDeclarations + int __pyx_t_1; + int __pyx_t_2; + Py_ssize_t __pyx_t_3; + PyObject *__pyx_t_4 = NULL; + PyObject *__pyx_t_5 = NULL; + PyObject *__pyx_t_6 = NULL; + PyObject *__pyx_t_7[3]; + PyObject *__pyx_t_8 = NULL; + size_t __pyx_t_9; + struct __pyx_t_5spacy_8pipeline_20_edit_tree_internals_10edit_trees_MatchNodeC __pyx_t_10; + struct __pyx_t_5spacy_8pipeline_20_edit_tree_internals_10edit_trees_SubstNodeC __pyx_t_11; + int __pyx_lineno = 0; + const char *__pyx_filename = NULL; + int __pyx_clineno = 0; + __Pyx_RefNannySetupContext("__pyx_convert__from_py_union____pyx_t_5spacy_8pipeline_20_edit_tree_internals_10edit_trees_NodeC", 0); + + /* "FromPyUnionUtility":41 + * cdef struct_type result + * cdef Py_ssize_t length + * if not PyMapping_Check(obj): # <<<<<<<<<<<<<< + * __Pyx_RaiseUnexpectedTypeError(b"a mapping", obj) + * +*/ + __pyx_t_1 = (!PyMapping_Check(__pyx_v_obj)); + if (__pyx_t_1) { + + /* "FromPyUnionUtility":42 + * cdef Py_ssize_t length + * if not PyMapping_Check(obj): + * __Pyx_RaiseUnexpectedTypeError(b"a mapping", obj) # <<<<<<<<<<<<<< + * + * last_found = None +*/ + __pyx_t_2 = __Pyx_RaiseUnexpectedTypeError(((char const *)"a mapping"), __pyx_v_obj); if (unlikely(__pyx_t_2 == ((int)0))) __PYX_ERR(1, 42, __pyx_L1_error) + + /* "FromPyUnionUtility":41 + * cdef struct_type result + * cdef Py_ssize_t length + * if not PyMapping_Check(obj): # <<<<<<<<<<<<<< + * __Pyx_RaiseUnexpectedTypeError(b"a mapping", obj) + * +*/ + } + + /* "FromPyUnionUtility":44 + * __Pyx_RaiseUnexpectedTypeError(b"a mapping", obj) + * + * last_found = None # <<<<<<<<<<<<<< + * length = len(obj) + * if length: +*/ + __Pyx_INCREF(Py_None); + __pyx_v_last_found = ((PyObject*)Py_None); + + /* "FromPyUnionUtility":45 + * + * last_found = None + * length = len(obj) # <<<<<<<<<<<<<< + * if length: + * if 'match_node' in obj: +*/ + __pyx_t_3 = PyObject_Length(__pyx_v_obj); if (unlikely(__pyx_t_3 == ((Py_ssize_t)-1))) __PYX_ERR(1, 45, __pyx_L1_error) + __pyx_v_length = __pyx_t_3; + + /* "FromPyUnionUtility":46 + * last_found = None + * length = len(obj) + * if length: # <<<<<<<<<<<<<< + * if 'match_node' in obj: + * if last_found is not None: +*/ + __pyx_t_1 = (__pyx_v_length != 0); + if (__pyx_t_1) { + + /* "FromPyUnionUtility":47 + * length = len(obj) + * if length: + * if 'match_node' in obj: # <<<<<<<<<<<<<< + * if last_found is not None: + * raise ValueError("More than one union attribute passed: '%s' and '%s'" % (last_found, 'match_node')) +*/ + __pyx_t_1 = (__Pyx_PySequence_ContainsTF(__pyx_mstate_global->__pyx_n_u_match_node, __pyx_v_obj, Py_EQ)); if (unlikely((__pyx_t_1 < 0))) __PYX_ERR(1, 47, __pyx_L1_error) + if (__pyx_t_1) { + + /* "FromPyUnionUtility":48 + * if length: + * if 'match_node' in obj: + * if last_found is not None: # <<<<<<<<<<<<<< + * raise ValueError("More than one union attribute passed: '%s' and '%s'" % (last_found, 'match_node')) + * last_found = 'match_node' +*/ + __pyx_t_1 = (__pyx_v_last_found != ((PyObject*)Py_None)); + if (unlikely(__pyx_t_1)) { + + /* "FromPyUnionUtility":49 + * if 'match_node' in obj: + * if last_found is not None: + * raise ValueError("More than one union attribute passed: '%s' and '%s'" % (last_found, 'match_node')) # <<<<<<<<<<<<<< + * last_found = 'match_node' + * result.match_node = obj['match_node'] +*/ + __pyx_t_5 = NULL; + __pyx_t_6 = __Pyx_PyUnicode_Unicode(__pyx_v_last_found); if (unlikely(!__pyx_t_6)) __PYX_ERR(1, 49, __pyx_L1_error) + __Pyx_GOTREF(__pyx_t_6); + __pyx_t_7[0] = __pyx_mstate_global->__pyx_kp_u_More_than_one_union_attribute_pa; + __pyx_t_7[1] = __pyx_t_6; + __pyx_t_7[2] = __pyx_mstate_global->__pyx_kp_u_and_match_node; + __pyx_t_8 = __Pyx_PyUnicode_Join(__pyx_t_7, 3, 39 + __Pyx_PyUnicode_GET_LENGTH(__pyx_t_6) + 18, 127 | __Pyx_PyUnicode_MAX_CHAR_VALUE(__pyx_t_6)); + if (unlikely(!__pyx_t_8)) __PYX_ERR(1, 49, __pyx_L1_error) + __Pyx_GOTREF(__pyx_t_8); + __Pyx_DECREF(__pyx_t_6); __pyx_t_6 = 0; + __pyx_t_9 = 1; + { + PyObject *__pyx_callargs[2] = {__pyx_t_5, __pyx_t_8}; + __pyx_t_4 = __Pyx_PyObject_FastCall((PyObject*)(((PyTypeObject*)PyExc_ValueError)), __pyx_callargs+__pyx_t_9, (2-__pyx_t_9) | (__pyx_t_9*__Pyx_PY_VECTORCALL_ARGUMENTS_OFFSET)); + __Pyx_XDECREF(__pyx_t_5); __pyx_t_5 = 0; + __Pyx_DECREF(__pyx_t_8); __pyx_t_8 = 0; + if (unlikely(!__pyx_t_4)) __PYX_ERR(1, 49, __pyx_L1_error) + __Pyx_GOTREF(__pyx_t_4); + } + __Pyx_Raise(__pyx_t_4, 0, 0, 0); + __Pyx_DECREF(__pyx_t_4); __pyx_t_4 = 0; + __PYX_ERR(1, 49, __pyx_L1_error) + + /* "FromPyUnionUtility":48 + * if length: + * if 'match_node' in obj: + * if last_found is not None: # <<<<<<<<<<<<<< + * raise ValueError("More than one union attribute passed: '%s' and '%s'" % (last_found, 'match_node')) + * last_found = 'match_node' +*/ + } + + /* "FromPyUnionUtility":50 + * if last_found is not None: + * raise ValueError("More than one union attribute passed: '%s' and '%s'" % (last_found, 'match_node')) + * last_found = 'match_node' # <<<<<<<<<<<<<< + * result.match_node = obj['match_node'] + * length -= 1 +*/ + __Pyx_INCREF(__pyx_mstate_global->__pyx_n_u_match_node); + __Pyx_DECREF_SET(__pyx_v_last_found, __pyx_mstate_global->__pyx_n_u_match_node); + + /* "FromPyUnionUtility":51 + * raise ValueError("More than one union attribute passed: '%s' and '%s'" % (last_found, 'match_node')) + * last_found = 'match_node' + * result.match_node = obj['match_node'] # <<<<<<<<<<<<<< + * length -= 1 + * if not length: +*/ + __pyx_t_4 = __Pyx_PyObject_Dict_GetItem(__pyx_v_obj, __pyx_mstate_global->__pyx_n_u_match_node); if (unlikely(!__pyx_t_4)) __PYX_ERR(1, 51, __pyx_L1_error) + __Pyx_GOTREF(__pyx_t_4); + __pyx_t_10 = __pyx_convert__from_py_struct____pyx_t_5spacy_8pipeline_20_edit_tree_internals_10edit_trees_MatchNodeC(__pyx_t_4); if (unlikely(PyErr_Occurred())) __PYX_ERR(1, 51, __pyx_L1_error) + __Pyx_DECREF(__pyx_t_4); __pyx_t_4 = 0; + __pyx_v_result.match_node = __pyx_t_10; + + /* "FromPyUnionUtility":52 + * last_found = 'match_node' + * result.match_node = obj['match_node'] + * length -= 1 # <<<<<<<<<<<<<< + * if not length: + * return result +*/ + __pyx_v_length = (__pyx_v_length - 1); + + /* "FromPyUnionUtility":53 + * result.match_node = obj['match_node'] + * length -= 1 + * if not length: # <<<<<<<<<<<<<< + * return result + * if 'subst_node' in obj: +*/ + __pyx_t_1 = (!(__pyx_v_length != 0)); + if (__pyx_t_1) { + + /* "FromPyUnionUtility":54 + * length -= 1 + * if not length: + * return result # <<<<<<<<<<<<<< + * if 'subst_node' in obj: + * if last_found is not None: +*/ + __pyx_r = __pyx_v_result; + goto __pyx_L0; + + /* "FromPyUnionUtility":53 + * result.match_node = obj['match_node'] + * length -= 1 + * if not length: # <<<<<<<<<<<<<< + * return result + * if 'subst_node' in obj: +*/ + } + + /* "FromPyUnionUtility":47 + * length = len(obj) + * if length: + * if 'match_node' in obj: # <<<<<<<<<<<<<< + * if last_found is not None: + * raise ValueError("More than one union attribute passed: '%s' and '%s'" % (last_found, 'match_node')) +*/ + } + + /* "FromPyUnionUtility":55 + * if not length: + * return result + * if 'subst_node' in obj: # <<<<<<<<<<<<<< + * if last_found is not None: + * raise ValueError("More than one union attribute passed: '%s' and '%s'" % (last_found, 'subst_node')) +*/ + __pyx_t_1 = (__Pyx_PySequence_ContainsTF(__pyx_mstate_global->__pyx_n_u_subst_node, __pyx_v_obj, Py_EQ)); if (unlikely((__pyx_t_1 < 0))) __PYX_ERR(1, 55, __pyx_L1_error) + if (__pyx_t_1) { + + /* "FromPyUnionUtility":56 + * return result + * if 'subst_node' in obj: + * if last_found is not None: # <<<<<<<<<<<<<< + * raise ValueError("More than one union attribute passed: '%s' and '%s'" % (last_found, 'subst_node')) + * last_found = 'subst_node' +*/ + __pyx_t_1 = (__pyx_v_last_found != ((PyObject*)Py_None)); + if (unlikely(__pyx_t_1)) { + + /* "FromPyUnionUtility":57 + * if 'subst_node' in obj: + * if last_found is not None: + * raise ValueError("More than one union attribute passed: '%s' and '%s'" % (last_found, 'subst_node')) # <<<<<<<<<<<<<< + * last_found = 'subst_node' + * result.subst_node = obj['subst_node'] +*/ + __pyx_t_8 = NULL; + __pyx_t_5 = __Pyx_PyUnicode_Unicode(__pyx_v_last_found); if (unlikely(!__pyx_t_5)) __PYX_ERR(1, 57, __pyx_L1_error) + __Pyx_GOTREF(__pyx_t_5); + __pyx_t_7[0] = __pyx_mstate_global->__pyx_kp_u_More_than_one_union_attribute_pa; + __pyx_t_7[1] = __pyx_t_5; + __pyx_t_7[2] = __pyx_mstate_global->__pyx_kp_u_and_subst_node; + __pyx_t_6 = __Pyx_PyUnicode_Join(__pyx_t_7, 3, 39 + __Pyx_PyUnicode_GET_LENGTH(__pyx_t_5) + 18, 127 | __Pyx_PyUnicode_MAX_CHAR_VALUE(__pyx_t_5)); + if (unlikely(!__pyx_t_6)) __PYX_ERR(1, 57, __pyx_L1_error) + __Pyx_GOTREF(__pyx_t_6); + __Pyx_DECREF(__pyx_t_5); __pyx_t_5 = 0; + __pyx_t_9 = 1; + { + PyObject *__pyx_callargs[2] = {__pyx_t_8, __pyx_t_6}; + __pyx_t_4 = __Pyx_PyObject_FastCall((PyObject*)(((PyTypeObject*)PyExc_ValueError)), __pyx_callargs+__pyx_t_9, (2-__pyx_t_9) | (__pyx_t_9*__Pyx_PY_VECTORCALL_ARGUMENTS_OFFSET)); + __Pyx_XDECREF(__pyx_t_8); __pyx_t_8 = 0; + __Pyx_DECREF(__pyx_t_6); __pyx_t_6 = 0; + if (unlikely(!__pyx_t_4)) __PYX_ERR(1, 57, __pyx_L1_error) + __Pyx_GOTREF(__pyx_t_4); + } + __Pyx_Raise(__pyx_t_4, 0, 0, 0); + __Pyx_DECREF(__pyx_t_4); __pyx_t_4 = 0; + __PYX_ERR(1, 57, __pyx_L1_error) + + /* "FromPyUnionUtility":56 + * return result + * if 'subst_node' in obj: + * if last_found is not None: # <<<<<<<<<<<<<< + * raise ValueError("More than one union attribute passed: '%s' and '%s'" % (last_found, 'subst_node')) + * last_found = 'subst_node' +*/ + } + + /* "FromPyUnionUtility":58 + * if last_found is not None: + * raise ValueError("More than one union attribute passed: '%s' and '%s'" % (last_found, 'subst_node')) + * last_found = 'subst_node' # <<<<<<<<<<<<<< + * result.subst_node = obj['subst_node'] + * length -= 1 +*/ + __Pyx_INCREF(__pyx_mstate_global->__pyx_n_u_subst_node); + __Pyx_DECREF_SET(__pyx_v_last_found, __pyx_mstate_global->__pyx_n_u_subst_node); + + /* "FromPyUnionUtility":59 + * raise ValueError("More than one union attribute passed: '%s' and '%s'" % (last_found, 'subst_node')) + * last_found = 'subst_node' + * result.subst_node = obj['subst_node'] # <<<<<<<<<<<<<< + * length -= 1 + * if not length: +*/ + __pyx_t_4 = __Pyx_PyObject_Dict_GetItem(__pyx_v_obj, __pyx_mstate_global->__pyx_n_u_subst_node); if (unlikely(!__pyx_t_4)) __PYX_ERR(1, 59, __pyx_L1_error) + __Pyx_GOTREF(__pyx_t_4); + __pyx_t_11 = __pyx_convert__from_py_struct____pyx_t_5spacy_8pipeline_20_edit_tree_internals_10edit_trees_SubstNodeC(__pyx_t_4); if (unlikely(PyErr_Occurred())) __PYX_ERR(1, 59, __pyx_L1_error) + __Pyx_DECREF(__pyx_t_4); __pyx_t_4 = 0; + __pyx_v_result.subst_node = __pyx_t_11; + + /* "FromPyUnionUtility":60 + * last_found = 'subst_node' + * result.subst_node = obj['subst_node'] + * length -= 1 # <<<<<<<<<<<<<< + * if not length: + * return result +*/ + __pyx_v_length = (__pyx_v_length - 1); + + /* "FromPyUnionUtility":61 + * result.subst_node = obj['subst_node'] + * length -= 1 + * if not length: # <<<<<<<<<<<<<< + * return result + * if last_found is None: +*/ + __pyx_t_1 = (!(__pyx_v_length != 0)); + if (__pyx_t_1) { + + /* "FromPyUnionUtility":62 + * length -= 1 + * if not length: + * return result # <<<<<<<<<<<<<< + * if last_found is None: + * raise ValueError("No value specified for any of the union attributes (%s)" % +*/ + __pyx_r = __pyx_v_result; + goto __pyx_L0; + + /* "FromPyUnionUtility":61 + * result.subst_node = obj['subst_node'] + * length -= 1 + * if not length: # <<<<<<<<<<<<<< + * return result + * if last_found is None: +*/ + } + + /* "FromPyUnionUtility":55 + * if not length: + * return result + * if 'subst_node' in obj: # <<<<<<<<<<<<<< + * if last_found is not None: + * raise ValueError("More than one union attribute passed: '%s' and '%s'" % (last_found, 'subst_node')) +*/ + } + + /* "FromPyUnionUtility":46 + * last_found = None + * length = len(obj) + * if length: # <<<<<<<<<<<<<< + * if 'match_node' in obj: + * if last_found is not None: +*/ + } + + /* "FromPyUnionUtility":63 + * if not length: + * return result + * if last_found is None: # <<<<<<<<<<<<<< + * raise ValueError("No value specified for any of the union attributes (%s)" % + * 'match_node, subst_node') +*/ + __pyx_t_1 = (__pyx_v_last_found == ((PyObject*)Py_None)); + if (unlikely(__pyx_t_1)) { + + /* "FromPyUnionUtility":64 + * return result + * if last_found is None: + * raise ValueError("No value specified for any of the union attributes (%s)" % # <<<<<<<<<<<<<< + * 'match_node, subst_node') + * return result +*/ + __pyx_t_6 = NULL; + __pyx_t_8 = PyUnicode_Format(__pyx_mstate_global->__pyx_kp_u_No_value_specified_for_any_of_th, __pyx_mstate_global->__pyx_kp_u_match_node_subst_node); if (unlikely(!__pyx_t_8)) __PYX_ERR(1, 64, __pyx_L1_error) + __Pyx_GOTREF(__pyx_t_8); + __pyx_t_9 = 1; + { + PyObject *__pyx_callargs[2] = {__pyx_t_6, __pyx_t_8}; + __pyx_t_4 = __Pyx_PyObject_FastCall((PyObject*)(((PyTypeObject*)PyExc_ValueError)), __pyx_callargs+__pyx_t_9, (2-__pyx_t_9) | (__pyx_t_9*__Pyx_PY_VECTORCALL_ARGUMENTS_OFFSET)); + __Pyx_XDECREF(__pyx_t_6); __pyx_t_6 = 0; + __Pyx_DECREF(__pyx_t_8); __pyx_t_8 = 0; + if (unlikely(!__pyx_t_4)) __PYX_ERR(1, 64, __pyx_L1_error) + __Pyx_GOTREF(__pyx_t_4); + } + __Pyx_Raise(__pyx_t_4, 0, 0, 0); + __Pyx_DECREF(__pyx_t_4); __pyx_t_4 = 0; + __PYX_ERR(1, 64, __pyx_L1_error) + + /* "FromPyUnionUtility":63 + * if not length: + * return result + * if last_found is None: # <<<<<<<<<<<<<< + * raise ValueError("No value specified for any of the union attributes (%s)" % + * 'match_node, subst_node') +*/ + } + + /* "FromPyUnionUtility":66 + * raise ValueError("No value specified for any of the union attributes (%s)" % + * 'match_node, subst_node') + * return result # <<<<<<<<<<<<<< + * +*/ + __pyx_r = __pyx_v_result; + goto __pyx_L0; + + /* "FromPyUnionUtility":37 + * int __Pyx_RaiseUnexpectedTypeError(const char *expected, object obj) except 0 + * + * @cname("__pyx_convert__from_py_union____pyx_t_5spacy_8pipeline_20_edit_tree_internals_10edit_trees_NodeC") # <<<<<<<<<<<<<< + * cdef struct_type __pyx_convert__from_py_union____pyx_t_5spacy_8pipeline_20_edit_tree_internals_10edit_trees_NodeC(obj) except *: + * cdef struct_type result +*/ + + /* function exit code */ + __pyx_L1_error:; + __Pyx_XDECREF(__pyx_t_4); + __Pyx_XDECREF(__pyx_t_5); + __Pyx_XDECREF(__pyx_t_6); + __Pyx_XDECREF(__pyx_t_8); + __Pyx_AddTraceback("FromPyUnionUtility.__pyx_convert__from_py_union____pyx_t_5spacy_8pipeline_20_edit_tree_internals_10edit_trees_NodeC", __pyx_clineno, __pyx_lineno, __pyx_filename); + __Pyx_pretend_to_initialize(&__pyx_r); + __pyx_L0:; + __Pyx_XDECREF(__pyx_v_last_found); + __Pyx_RefNannyFinishContext(); + return __pyx_r; +} + +/* "FromPyStructUtility":11 + * int __Pyx_RaiseUnexpectedTypeError(const char *expected, object obj) except 0 + * + * @cname("__pyx_convert__from_py_struct____pyx_t_5spacy_8pipeline_20_edit_tree_internals_10edit_trees_EditTreeC") # <<<<<<<<<<<<<< + * cdef struct_type __pyx_convert__from_py_struct____pyx_t_5spacy_8pipeline_20_edit_tree_internals_10edit_trees_EditTreeC(obj) except *: + * cdef struct_type result +*/ + +static struct __pyx_t_5spacy_8pipeline_20_edit_tree_internals_10edit_trees_EditTreeC __pyx_convert__from_py_struct____pyx_t_5spacy_8pipeline_20_edit_tree_internals_10edit_trees_EditTreeC(PyObject *__pyx_v_obj) { + struct __pyx_t_5spacy_8pipeline_20_edit_tree_internals_10edit_trees_EditTreeC __pyx_v_result; + PyObject *__pyx_v_value = NULL; + struct __pyx_t_5spacy_8pipeline_20_edit_tree_internals_10edit_trees_EditTreeC __pyx_r; + __Pyx_RefNannyDeclarations + int __pyx_t_1; + int __pyx_t_2; + PyObject *__pyx_t_3 = NULL; + PyObject *__pyx_t_4 = NULL; + PyObject *__pyx_t_5 = NULL; + PyObject *__pyx_t_6 = NULL; + PyObject *__pyx_t_7 = NULL; + PyObject *__pyx_t_8 = NULL; + PyObject *__pyx_t_9 = NULL; + PyObject *__pyx_t_10 = NULL; + size_t __pyx_t_11; + union __pyx_t_5spacy_8pipeline_20_edit_tree_internals_10edit_trees_NodeC __pyx_t_12; + int __pyx_lineno = 0; + const char *__pyx_filename = NULL; + int __pyx_clineno = 0; + __Pyx_RefNannySetupContext("__pyx_convert__from_py_struct____pyx_t_5spacy_8pipeline_20_edit_tree_internals_10edit_trees_EditTreeC", 0); + + /* "FromPyStructUtility":14 + * cdef struct_type __pyx_convert__from_py_struct____pyx_t_5spacy_8pipeline_20_edit_tree_internals_10edit_trees_EditTreeC(obj) except *: + * cdef struct_type result + * if not PyMapping_Check(obj): # <<<<<<<<<<<<<< + * __Pyx_RaiseUnexpectedTypeError(b"a mapping", obj) + * +*/ + __pyx_t_1 = (!PyMapping_Check(__pyx_v_obj)); + if (__pyx_t_1) { + + /* "FromPyStructUtility":15 + * cdef struct_type result + * if not PyMapping_Check(obj): + * __Pyx_RaiseUnexpectedTypeError(b"a mapping", obj) # <<<<<<<<<<<<<< + * + * try: +*/ + __pyx_t_2 = __Pyx_RaiseUnexpectedTypeError(((char const *)"a mapping"), __pyx_v_obj); if (unlikely(__pyx_t_2 == ((int)0))) __PYX_ERR(1, 15, __pyx_L1_error) + + /* "FromPyStructUtility":14 + * cdef struct_type __pyx_convert__from_py_struct____pyx_t_5spacy_8pipeline_20_edit_tree_internals_10edit_trees_EditTreeC(obj) except *: + * cdef struct_type result + * if not PyMapping_Check(obj): # <<<<<<<<<<<<<< + * __Pyx_RaiseUnexpectedTypeError(b"a mapping", obj) + * +*/ + } + + /* "FromPyStructUtility":17 + * __Pyx_RaiseUnexpectedTypeError(b"a mapping", obj) + * + * try: # <<<<<<<<<<<<<< + * value = obj['is_match_node'] + * except KeyError: +*/ + { + __Pyx_PyThreadState_declare + __Pyx_PyThreadState_assign + __Pyx_ExceptionSave(&__pyx_t_3, &__pyx_t_4, &__pyx_t_5); + __Pyx_XGOTREF(__pyx_t_3); + __Pyx_XGOTREF(__pyx_t_4); + __Pyx_XGOTREF(__pyx_t_5); + /*try:*/ { + + /* "FromPyStructUtility":18 + * + * try: + * value = obj['is_match_node'] # <<<<<<<<<<<<<< + * except KeyError: + * raise ValueError("No value specified for struct attribute 'is_match_node'") +*/ + __pyx_t_6 = __Pyx_PyObject_Dict_GetItem(__pyx_v_obj, __pyx_mstate_global->__pyx_n_u_is_match_node); if (unlikely(!__pyx_t_6)) __PYX_ERR(1, 18, __pyx_L4_error) + __Pyx_GOTREF(__pyx_t_6); + __pyx_v_value = __pyx_t_6; + __pyx_t_6 = 0; + + /* "FromPyStructUtility":17 + * __Pyx_RaiseUnexpectedTypeError(b"a mapping", obj) + * + * try: # <<<<<<<<<<<<<< + * value = obj['is_match_node'] + * except KeyError: +*/ + } + __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; + goto __pyx_L9_try_end; + __pyx_L4_error:; + __Pyx_XDECREF(__pyx_t_6); __pyx_t_6 = 0; + + /* "FromPyStructUtility":19 + * try: + * value = obj['is_match_node'] + * except KeyError: # <<<<<<<<<<<<<< + * raise ValueError("No value specified for struct attribute 'is_match_node'") + * result.is_match_node = value +*/ + __pyx_t_2 = __Pyx_PyErr_ExceptionMatches(((PyObject *)(((PyTypeObject*)PyExc_KeyError)))); + if (__pyx_t_2) { + __Pyx_AddTraceback("FromPyStructUtility.__pyx_convert__from_py_struct____pyx_t_5spacy_8pipeline_20_edit_tree_internals_10edit_trees_EditTreeC", __pyx_clineno, __pyx_lineno, __pyx_filename); + if (__Pyx_GetException(&__pyx_t_6, &__pyx_t_7, &__pyx_t_8) < 0) __PYX_ERR(1, 19, __pyx_L6_except_error) + __Pyx_XGOTREF(__pyx_t_6); + __Pyx_XGOTREF(__pyx_t_7); + __Pyx_XGOTREF(__pyx_t_8); + + /* "FromPyStructUtility":20 + * value = obj['is_match_node'] + * except KeyError: + * raise ValueError("No value specified for struct attribute 'is_match_node'") # <<<<<<<<<<<<<< + * result.is_match_node = value + * try: +*/ + __pyx_t_10 = NULL; + __pyx_t_11 = 1; + { + PyObject *__pyx_callargs[2] = {__pyx_t_10, __pyx_mstate_global->__pyx_kp_u_No_value_specified_for_struct_at_7}; + __pyx_t_9 = __Pyx_PyObject_FastCall((PyObject*)(((PyTypeObject*)PyExc_ValueError)), __pyx_callargs+__pyx_t_11, (2-__pyx_t_11) | (__pyx_t_11*__Pyx_PY_VECTORCALL_ARGUMENTS_OFFSET)); + __Pyx_XDECREF(__pyx_t_10); __pyx_t_10 = 0; + if (unlikely(!__pyx_t_9)) __PYX_ERR(1, 20, __pyx_L6_except_error) + __Pyx_GOTREF(__pyx_t_9); + } + __Pyx_Raise(__pyx_t_9, 0, 0, 0); + __Pyx_DECREF(__pyx_t_9); __pyx_t_9 = 0; + __PYX_ERR(1, 20, __pyx_L6_except_error) + } + goto __pyx_L6_except_error; + + /* "FromPyStructUtility":17 + * __Pyx_RaiseUnexpectedTypeError(b"a mapping", obj) + * + * try: # <<<<<<<<<<<<<< + * value = obj['is_match_node'] + * except KeyError: +*/ + __pyx_L6_except_error:; + __Pyx_XGIVEREF(__pyx_t_3); + __Pyx_XGIVEREF(__pyx_t_4); + __Pyx_XGIVEREF(__pyx_t_5); + __Pyx_ExceptionReset(__pyx_t_3, __pyx_t_4, __pyx_t_5); + goto __pyx_L1_error; + __pyx_L9_try_end:; + } + + /* "FromPyStructUtility":21 + * except KeyError: + * raise ValueError("No value specified for struct attribute 'is_match_node'") + * result.is_match_node = value # <<<<<<<<<<<<<< + * try: + * value = obj['inner'] +*/ + __pyx_t_1 = __Pyx_PyObject_IsTrue(__pyx_v_value); if (unlikely((__pyx_t_1 == (int)-1) && PyErr_Occurred())) __PYX_ERR(1, 21, __pyx_L1_error) + __pyx_v_result.is_match_node = __pyx_t_1; + + /* "FromPyStructUtility":22 + * raise ValueError("No value specified for struct attribute 'is_match_node'") + * result.is_match_node = value + * try: # <<<<<<<<<<<<<< + * value = obj['inner'] + * except KeyError: +*/ + { + __Pyx_PyThreadState_declare + __Pyx_PyThreadState_assign + __Pyx_ExceptionSave(&__pyx_t_5, &__pyx_t_4, &__pyx_t_3); + __Pyx_XGOTREF(__pyx_t_5); + __Pyx_XGOTREF(__pyx_t_4); + __Pyx_XGOTREF(__pyx_t_3); + /*try:*/ { + + /* "FromPyStructUtility":23 + * result.is_match_node = value + * try: + * value = obj['inner'] # <<<<<<<<<<<<<< + * except KeyError: + * raise ValueError("No value specified for struct attribute 'inner'") +*/ + __pyx_t_8 = __Pyx_PyObject_Dict_GetItem(__pyx_v_obj, __pyx_mstate_global->__pyx_n_u_inner); if (unlikely(!__pyx_t_8)) __PYX_ERR(1, 23, __pyx_L12_error) + __Pyx_GOTREF(__pyx_t_8); + __Pyx_DECREF_SET(__pyx_v_value, __pyx_t_8); + __pyx_t_8 = 0; + + /* "FromPyStructUtility":22 + * raise ValueError("No value specified for struct attribute 'is_match_node'") + * result.is_match_node = value + * try: # <<<<<<<<<<<<<< + * value = obj['inner'] + * except KeyError: +*/ + } + __Pyx_XDECREF(__pyx_t_5); __pyx_t_5 = 0; + __Pyx_XDECREF(__pyx_t_4); __pyx_t_4 = 0; + __Pyx_XDECREF(__pyx_t_3); __pyx_t_3 = 0; + goto __pyx_L17_try_end; + __pyx_L12_error:; + __Pyx_XDECREF(__pyx_t_10); __pyx_t_10 = 0; + __Pyx_XDECREF(__pyx_t_6); __pyx_t_6 = 0; + __Pyx_XDECREF(__pyx_t_7); __pyx_t_7 = 0; + __Pyx_XDECREF(__pyx_t_8); __pyx_t_8 = 0; + __Pyx_XDECREF(__pyx_t_9); __pyx_t_9 = 0; + + /* "FromPyStructUtility":24 + * try: + * value = obj['inner'] + * except KeyError: # <<<<<<<<<<<<<< + * raise ValueError("No value specified for struct attribute 'inner'") + * result.inner = value +*/ + __pyx_t_2 = __Pyx_PyErr_ExceptionMatches(((PyObject *)(((PyTypeObject*)PyExc_KeyError)))); + if (__pyx_t_2) { + __Pyx_AddTraceback("FromPyStructUtility.__pyx_convert__from_py_struct____pyx_t_5spacy_8pipeline_20_edit_tree_internals_10edit_trees_EditTreeC", __pyx_clineno, __pyx_lineno, __pyx_filename); + if (__Pyx_GetException(&__pyx_t_8, &__pyx_t_7, &__pyx_t_6) < 0) __PYX_ERR(1, 24, __pyx_L14_except_error) + __Pyx_XGOTREF(__pyx_t_8); + __Pyx_XGOTREF(__pyx_t_7); + __Pyx_XGOTREF(__pyx_t_6); + + /* "FromPyStructUtility":25 + * value = obj['inner'] + * except KeyError: + * raise ValueError("No value specified for struct attribute 'inner'") # <<<<<<<<<<<<<< + * result.inner = value + * return result +*/ + __pyx_t_10 = NULL; + __pyx_t_11 = 1; + { + PyObject *__pyx_callargs[2] = {__pyx_t_10, __pyx_mstate_global->__pyx_kp_u_No_value_specified_for_struct_at_8}; + __pyx_t_9 = __Pyx_PyObject_FastCall((PyObject*)(((PyTypeObject*)PyExc_ValueError)), __pyx_callargs+__pyx_t_11, (2-__pyx_t_11) | (__pyx_t_11*__Pyx_PY_VECTORCALL_ARGUMENTS_OFFSET)); + __Pyx_XDECREF(__pyx_t_10); __pyx_t_10 = 0; + if (unlikely(!__pyx_t_9)) __PYX_ERR(1, 25, __pyx_L14_except_error) + __Pyx_GOTREF(__pyx_t_9); + } + __Pyx_Raise(__pyx_t_9, 0, 0, 0); + __Pyx_DECREF(__pyx_t_9); __pyx_t_9 = 0; + __PYX_ERR(1, 25, __pyx_L14_except_error) + } + goto __pyx_L14_except_error; + + /* "FromPyStructUtility":22 + * raise ValueError("No value specified for struct attribute 'is_match_node'") + * result.is_match_node = value + * try: # <<<<<<<<<<<<<< + * value = obj['inner'] + * except KeyError: +*/ + __pyx_L14_except_error:; + __Pyx_XGIVEREF(__pyx_t_5); + __Pyx_XGIVEREF(__pyx_t_4); + __Pyx_XGIVEREF(__pyx_t_3); + __Pyx_ExceptionReset(__pyx_t_5, __pyx_t_4, __pyx_t_3); + goto __pyx_L1_error; + __pyx_L17_try_end:; + } + + /* "FromPyStructUtility":26 + * except KeyError: + * raise ValueError("No value specified for struct attribute 'inner'") + * result.inner = value # <<<<<<<<<<<<<< + * return result + * +*/ + __pyx_t_12 = __pyx_convert__from_py_union____pyx_t_5spacy_8pipeline_20_edit_tree_internals_10edit_trees_NodeC(__pyx_v_value); if (unlikely(PyErr_Occurred())) __PYX_ERR(1, 26, __pyx_L1_error) + __pyx_v_result.inner = __pyx_t_12; + + /* "FromPyStructUtility":27 + * raise ValueError("No value specified for struct attribute 'inner'") + * result.inner = value + * return result # <<<<<<<<<<<<<< + * +*/ + __pyx_r = __pyx_v_result; + goto __pyx_L0; + + /* "FromPyStructUtility":11 + * int __Pyx_RaiseUnexpectedTypeError(const char *expected, object obj) except 0 + * + * @cname("__pyx_convert__from_py_struct____pyx_t_5spacy_8pipeline_20_edit_tree_internals_10edit_trees_EditTreeC") # <<<<<<<<<<<<<< + * cdef struct_type __pyx_convert__from_py_struct____pyx_t_5spacy_8pipeline_20_edit_tree_internals_10edit_trees_EditTreeC(obj) except *: + * cdef struct_type result +*/ + + /* function exit code */ + __pyx_L1_error:; + __Pyx_XDECREF(__pyx_t_6); + __Pyx_XDECREF(__pyx_t_7); + __Pyx_XDECREF(__pyx_t_8); + __Pyx_XDECREF(__pyx_t_9); + __Pyx_XDECREF(__pyx_t_10); + __Pyx_AddTraceback("FromPyStructUtility.__pyx_convert__from_py_struct____pyx_t_5spacy_8pipeline_20_edit_tree_internals_10edit_trees_EditTreeC", __pyx_clineno, __pyx_lineno, __pyx_filename); + __Pyx_pretend_to_initialize(&__pyx_r); + __pyx_L0:; + __Pyx_XDECREF(__pyx_v_value); + __Pyx_RefNannyFinishContext(); + return __pyx_r; +} + +/* "spacy/pipeline/_edit_tree_internals/edit_trees.pxd":49 + * NodeC inner + * + * cdef inline EditTreeC edittree_new_match( # <<<<<<<<<<<<<< + * len_t prefix_len, + * len_t suffix_len, +*/ + +static CYTHON_INLINE struct __pyx_t_5spacy_8pipeline_20_edit_tree_internals_10edit_trees_EditTreeC __pyx_f_5spacy_8pipeline_20_edit_tree_internals_10edit_trees_edittree_new_match(__pyx_t_5spacy_8typedefs_len_t __pyx_v_prefix_len, __pyx_t_5spacy_8typedefs_len_t __pyx_v_suffix_len, uint32_t __pyx_v_prefix_tree, uint32_t __pyx_v_suffix_tree) { + struct __pyx_t_5spacy_8pipeline_20_edit_tree_internals_10edit_trees_MatchNodeC __pyx_v_match_node; + union __pyx_t_5spacy_8pipeline_20_edit_tree_internals_10edit_trees_NodeC __pyx_v_inner; + struct __pyx_t_5spacy_8pipeline_20_edit_tree_internals_10edit_trees_EditTreeC __pyx_r; + struct __pyx_t_5spacy_8pipeline_20_edit_tree_internals_10edit_trees_MatchNodeC __pyx_t_1; + union __pyx_t_5spacy_8pipeline_20_edit_tree_internals_10edit_trees_NodeC __pyx_t_2; + struct __pyx_t_5spacy_8pipeline_20_edit_tree_internals_10edit_trees_EditTreeC __pyx_t_3; + + /* "spacy/pipeline/_edit_tree_internals/edit_trees.pxd":56 + * ): + * cdef MatchNodeC match_node = MatchNodeC( + * prefix_len=prefix_len, # <<<<<<<<<<<<<< + * suffix_len=suffix_len, + * prefix_tree=prefix_tree, +*/ + __pyx_t_1.prefix_len = __pyx_v_prefix_len; + + /* "spacy/pipeline/_edit_tree_internals/edit_trees.pxd":57 + * cdef MatchNodeC match_node = MatchNodeC( + * prefix_len=prefix_len, + * suffix_len=suffix_len, # <<<<<<<<<<<<<< + * prefix_tree=prefix_tree, + * suffix_tree=suffix_tree +*/ + __pyx_t_1.suffix_len = __pyx_v_suffix_len; + + /* "spacy/pipeline/_edit_tree_internals/edit_trees.pxd":58 + * prefix_len=prefix_len, + * suffix_len=suffix_len, + * prefix_tree=prefix_tree, # <<<<<<<<<<<<<< + * suffix_tree=suffix_tree + * ) +*/ + __pyx_t_1.prefix_tree = __pyx_v_prefix_tree; + + /* "spacy/pipeline/_edit_tree_internals/edit_trees.pxd":59 + * suffix_len=suffix_len, + * prefix_tree=prefix_tree, + * suffix_tree=suffix_tree # <<<<<<<<<<<<<< + * ) + * cdef NodeC inner = NodeC(match_node=match_node) +*/ + __pyx_t_1.suffix_tree = __pyx_v_suffix_tree; + __pyx_v_match_node = __pyx_t_1; + + /* "spacy/pipeline/_edit_tree_internals/edit_trees.pxd":61 + * suffix_tree=suffix_tree + * ) + * cdef NodeC inner = NodeC(match_node=match_node) # <<<<<<<<<<<<<< + * return EditTreeC(is_match_node=True, inner=inner) + * +*/ + __pyx_t_2.match_node = __pyx_v_match_node; + __pyx_v_inner = __pyx_t_2; + + /* "spacy/pipeline/_edit_tree_internals/edit_trees.pxd":62 + * ) + * cdef NodeC inner = NodeC(match_node=match_node) + * return EditTreeC(is_match_node=True, inner=inner) # <<<<<<<<<<<<<< + * + * cdef inline EditTreeC edittree_new_subst(attr_t orig, attr_t subst): +*/ + __pyx_t_3.is_match_node = 1; + __pyx_t_3.inner = __pyx_v_inner; + __pyx_r = __pyx_t_3; + goto __pyx_L0; + + /* "spacy/pipeline/_edit_tree_internals/edit_trees.pxd":49 + * NodeC inner + * + * cdef inline EditTreeC edittree_new_match( # <<<<<<<<<<<<<< + * len_t prefix_len, + * len_t suffix_len, +*/ + + /* function exit code */ + __pyx_L0:; + return __pyx_r; +} + +/* "spacy/pipeline/_edit_tree_internals/edit_trees.pxd":64 + * return EditTreeC(is_match_node=True, inner=inner) + * + * cdef inline EditTreeC edittree_new_subst(attr_t orig, attr_t subst): # <<<<<<<<<<<<<< + * cdef EditTreeC node + * cdef SubstNodeC subst_node = SubstNodeC(orig=orig, subst=subst) +*/ + +static CYTHON_INLINE struct __pyx_t_5spacy_8pipeline_20_edit_tree_internals_10edit_trees_EditTreeC __pyx_f_5spacy_8pipeline_20_edit_tree_internals_10edit_trees_edittree_new_subst(__pyx_t_5spacy_8typedefs_attr_t __pyx_v_orig, __pyx_t_5spacy_8typedefs_attr_t __pyx_v_subst) { + struct __pyx_t_5spacy_8pipeline_20_edit_tree_internals_10edit_trees_SubstNodeC __pyx_v_subst_node; + union __pyx_t_5spacy_8pipeline_20_edit_tree_internals_10edit_trees_NodeC __pyx_v_inner; + struct __pyx_t_5spacy_8pipeline_20_edit_tree_internals_10edit_trees_EditTreeC __pyx_r; + struct __pyx_t_5spacy_8pipeline_20_edit_tree_internals_10edit_trees_SubstNodeC __pyx_t_1; + union __pyx_t_5spacy_8pipeline_20_edit_tree_internals_10edit_trees_NodeC __pyx_t_2; + struct __pyx_t_5spacy_8pipeline_20_edit_tree_internals_10edit_trees_EditTreeC __pyx_t_3; + + /* "spacy/pipeline/_edit_tree_internals/edit_trees.pxd":66 + * cdef inline EditTreeC edittree_new_subst(attr_t orig, attr_t subst): + * cdef EditTreeC node + * cdef SubstNodeC subst_node = SubstNodeC(orig=orig, subst=subst) # <<<<<<<<<<<<<< + * cdef NodeC inner = NodeC(subst_node=subst_node) + * return EditTreeC(is_match_node=False, inner=inner) +*/ + __pyx_t_1.orig = __pyx_v_orig; + __pyx_t_1.subst = __pyx_v_subst; + __pyx_v_subst_node = __pyx_t_1; + + /* "spacy/pipeline/_edit_tree_internals/edit_trees.pxd":67 + * cdef EditTreeC node + * cdef SubstNodeC subst_node = SubstNodeC(orig=orig, subst=subst) + * cdef NodeC inner = NodeC(subst_node=subst_node) # <<<<<<<<<<<<<< + * return EditTreeC(is_match_node=False, inner=inner) + * +*/ + __pyx_t_2.subst_node = __pyx_v_subst_node; + __pyx_v_inner = __pyx_t_2; + + /* "spacy/pipeline/_edit_tree_internals/edit_trees.pxd":68 + * cdef SubstNodeC subst_node = SubstNodeC(orig=orig, subst=subst) + * cdef NodeC inner = NodeC(subst_node=subst_node) + * return EditTreeC(is_match_node=False, inner=inner) # <<<<<<<<<<<<<< + * + * cdef inline uint64_t edittree_hash(EditTreeC tree): +*/ + __pyx_t_3.is_match_node = 0; + __pyx_t_3.inner = __pyx_v_inner; + __pyx_r = __pyx_t_3; + goto __pyx_L0; + + /* "spacy/pipeline/_edit_tree_internals/edit_trees.pxd":64 + * return EditTreeC(is_match_node=True, inner=inner) + * + * cdef inline EditTreeC edittree_new_subst(attr_t orig, attr_t subst): # <<<<<<<<<<<<<< + * cdef EditTreeC node + * cdef SubstNodeC subst_node = SubstNodeC(orig=orig, subst=subst) +*/ + + /* function exit code */ + __pyx_L0:; + return __pyx_r; +} + +/* "spacy/pipeline/_edit_tree_internals/edit_trees.pxd":70 + * return EditTreeC(is_match_node=False, inner=inner) + * + * cdef inline uint64_t edittree_hash(EditTreeC tree): # <<<<<<<<<<<<<< + * cdef MatchNodeC match_node + * cdef SubstNodeC subst_node +*/ + +static CYTHON_INLINE uint64_t __pyx_f_5spacy_8pipeline_20_edit_tree_internals_10edit_trees_edittree_hash(struct __pyx_t_5spacy_8pipeline_20_edit_tree_internals_10edit_trees_EditTreeC __pyx_v_tree) { + struct __pyx_t_5spacy_8pipeline_20_edit_tree_internals_10edit_trees_MatchNodeC __pyx_v_match_node; + struct __pyx_t_5spacy_8pipeline_20_edit_tree_internals_10edit_trees_SubstNodeC __pyx_v_subst_node; + uint64_t __pyx_r; + __Pyx_RefNannyDeclarations + struct __pyx_t_5spacy_8pipeline_20_edit_tree_internals_10edit_trees_MatchNodeC __pyx_t_1; + PyObject *__pyx_t_2 = NULL; + PyObject *__pyx_t_3 = NULL; + PyObject *__pyx_t_4 = NULL; + PyObject *__pyx_t_5 = NULL; + PyObject *__pyx_t_6 = NULL; + Py_hash_t __pyx_t_7; + struct __pyx_t_5spacy_8pipeline_20_edit_tree_internals_10edit_trees_SubstNodeC __pyx_t_8; + int __pyx_lineno = 0; + const char *__pyx_filename = NULL; + int __pyx_clineno = 0; + __Pyx_RefNannySetupContext("edittree_hash", 0); + + /* "spacy/pipeline/_edit_tree_internals/edit_trees.pxd":74 + * cdef SubstNodeC subst_node + * + * if tree.is_match_node: # <<<<<<<<<<<<<< + * match_node = tree.inner.match_node + * return hash((match_node.prefix_len, match_node.suffix_len, match_node.prefix_tree, match_node.suffix_tree)) +*/ + if (__pyx_v_tree.is_match_node) { + + /* "spacy/pipeline/_edit_tree_internals/edit_trees.pxd":75 + * + * if tree.is_match_node: + * match_node = tree.inner.match_node # <<<<<<<<<<<<<< + * return hash((match_node.prefix_len, match_node.suffix_len, match_node.prefix_tree, match_node.suffix_tree)) + * else: +*/ + __pyx_t_1 = __pyx_v_tree.inner.match_node; + __pyx_v_match_node = __pyx_t_1; + + /* "spacy/pipeline/_edit_tree_internals/edit_trees.pxd":76 + * if tree.is_match_node: + * match_node = tree.inner.match_node + * return hash((match_node.prefix_len, match_node.suffix_len, match_node.prefix_tree, match_node.suffix_tree)) # <<<<<<<<<<<<<< + * else: + * subst_node = tree.inner.subst_node +*/ + __pyx_t_2 = __Pyx_PyLong_From_uint16_t(__pyx_v_match_node.prefix_len); if (unlikely(!__pyx_t_2)) __PYX_ERR(2, 76, __pyx_L1_error) + __Pyx_GOTREF(__pyx_t_2); + __pyx_t_3 = __Pyx_PyLong_From_uint16_t(__pyx_v_match_node.suffix_len); if (unlikely(!__pyx_t_3)) __PYX_ERR(2, 76, __pyx_L1_error) + __Pyx_GOTREF(__pyx_t_3); + __pyx_t_4 = __Pyx_PyLong_From_uint32_t(__pyx_v_match_node.prefix_tree); if (unlikely(!__pyx_t_4)) __PYX_ERR(2, 76, __pyx_L1_error) + __Pyx_GOTREF(__pyx_t_4); + __pyx_t_5 = __Pyx_PyLong_From_uint32_t(__pyx_v_match_node.suffix_tree); if (unlikely(!__pyx_t_5)) __PYX_ERR(2, 76, __pyx_L1_error) + __Pyx_GOTREF(__pyx_t_5); + __pyx_t_6 = PyTuple_New(4); if (unlikely(!__pyx_t_6)) __PYX_ERR(2, 76, __pyx_L1_error) + __Pyx_GOTREF(__pyx_t_6); + __Pyx_GIVEREF(__pyx_t_2); + if (__Pyx_PyTuple_SET_ITEM(__pyx_t_6, 0, __pyx_t_2) != (0)) __PYX_ERR(2, 76, __pyx_L1_error); + __Pyx_GIVEREF(__pyx_t_3); + if (__Pyx_PyTuple_SET_ITEM(__pyx_t_6, 1, __pyx_t_3) != (0)) __PYX_ERR(2, 76, __pyx_L1_error); + __Pyx_GIVEREF(__pyx_t_4); + if (__Pyx_PyTuple_SET_ITEM(__pyx_t_6, 2, __pyx_t_4) != (0)) __PYX_ERR(2, 76, __pyx_L1_error); + __Pyx_GIVEREF(__pyx_t_5); + if (__Pyx_PyTuple_SET_ITEM(__pyx_t_6, 3, __pyx_t_5) != (0)) __PYX_ERR(2, 76, __pyx_L1_error); + __pyx_t_2 = 0; + __pyx_t_3 = 0; + __pyx_t_4 = 0; + __pyx_t_5 = 0; + __pyx_t_7 = PyObject_Hash(__pyx_t_6); if (unlikely(__pyx_t_7 == ((Py_hash_t)-1))) __PYX_ERR(2, 76, __pyx_L1_error) + __Pyx_DECREF(__pyx_t_6); __pyx_t_6 = 0; + __pyx_r = __pyx_t_7; + goto __pyx_L0; + + /* "spacy/pipeline/_edit_tree_internals/edit_trees.pxd":74 + * cdef SubstNodeC subst_node + * + * if tree.is_match_node: # <<<<<<<<<<<<<< + * match_node = tree.inner.match_node + * return hash((match_node.prefix_len, match_node.suffix_len, match_node.prefix_tree, match_node.suffix_tree)) +*/ + } + + /* "spacy/pipeline/_edit_tree_internals/edit_trees.pxd":78 + * return hash((match_node.prefix_len, match_node.suffix_len, match_node.prefix_tree, match_node.suffix_tree)) + * else: + * subst_node = tree.inner.subst_node # <<<<<<<<<<<<<< + * return hash((subst_node.orig, subst_node.subst)) + * +*/ + /*else*/ { + __pyx_t_8 = __pyx_v_tree.inner.subst_node; + __pyx_v_subst_node = __pyx_t_8; + + /* "spacy/pipeline/_edit_tree_internals/edit_trees.pxd":79 + * else: + * subst_node = tree.inner.subst_node + * return hash((subst_node.orig, subst_node.subst)) # <<<<<<<<<<<<<< + * + * cdef struct LCS: +*/ + __pyx_t_6 = __Pyx_PyLong_From_uint64_t(__pyx_v_subst_node.orig); if (unlikely(!__pyx_t_6)) __PYX_ERR(2, 79, __pyx_L1_error) + __Pyx_GOTREF(__pyx_t_6); + __pyx_t_5 = __Pyx_PyLong_From_uint64_t(__pyx_v_subst_node.subst); if (unlikely(!__pyx_t_5)) __PYX_ERR(2, 79, __pyx_L1_error) + __Pyx_GOTREF(__pyx_t_5); + __pyx_t_4 = PyTuple_New(2); if (unlikely(!__pyx_t_4)) __PYX_ERR(2, 79, __pyx_L1_error) + __Pyx_GOTREF(__pyx_t_4); + __Pyx_GIVEREF(__pyx_t_6); + if (__Pyx_PyTuple_SET_ITEM(__pyx_t_4, 0, __pyx_t_6) != (0)) __PYX_ERR(2, 79, __pyx_L1_error); + __Pyx_GIVEREF(__pyx_t_5); + if (__Pyx_PyTuple_SET_ITEM(__pyx_t_4, 1, __pyx_t_5) != (0)) __PYX_ERR(2, 79, __pyx_L1_error); + __pyx_t_6 = 0; + __pyx_t_5 = 0; + __pyx_t_7 = PyObject_Hash(__pyx_t_4); if (unlikely(__pyx_t_7 == ((Py_hash_t)-1))) __PYX_ERR(2, 79, __pyx_L1_error) + __Pyx_DECREF(__pyx_t_4); __pyx_t_4 = 0; + __pyx_r = __pyx_t_7; + goto __pyx_L0; + } + + /* "spacy/pipeline/_edit_tree_internals/edit_trees.pxd":70 + * return EditTreeC(is_match_node=False, inner=inner) + * + * cdef inline uint64_t edittree_hash(EditTreeC tree): # <<<<<<<<<<<<<< + * cdef MatchNodeC match_node + * cdef SubstNodeC subst_node +*/ + + /* function exit code */ + __pyx_L1_error:; + __Pyx_XDECREF(__pyx_t_2); + __Pyx_XDECREF(__pyx_t_3); + __Pyx_XDECREF(__pyx_t_4); + __Pyx_XDECREF(__pyx_t_5); + __Pyx_XDECREF(__pyx_t_6); + __Pyx_AddTraceback("spacy.pipeline._edit_tree_internals.edit_trees.edittree_hash", __pyx_clineno, __pyx_lineno, __pyx_filename); + __pyx_r = -1LL; + __pyx_L0:; + __Pyx_RefNannyFinishContext(); + return __pyx_r; +} + +/* "spacy/pipeline/_edit_tree_internals/edit_trees.pxd":87 + * int target_end + * + * cdef inline bint lcs_is_empty(LCS lcs): # <<<<<<<<<<<<<< + * return lcs.source_begin == 0 and lcs.source_end == 0 and lcs.target_begin == 0 and lcs.target_end == 0 + * +*/ + +static CYTHON_INLINE int __pyx_f_5spacy_8pipeline_20_edit_tree_internals_10edit_trees_lcs_is_empty(struct __pyx_t_5spacy_8pipeline_20_edit_tree_internals_10edit_trees_LCS __pyx_v_lcs) { + int __pyx_r; + int __pyx_t_1; + int __pyx_t_2; + + /* "spacy/pipeline/_edit_tree_internals/edit_trees.pxd":88 + * + * cdef inline bint lcs_is_empty(LCS lcs): + * return lcs.source_begin == 0 and lcs.source_end == 0 and lcs.target_begin == 0 and lcs.target_end == 0 # <<<<<<<<<<<<<< + * + * cdef class EditTrees: +*/ + __pyx_t_2 = (__pyx_v_lcs.source_begin == 0); + if (__pyx_t_2) { + } else { + __pyx_t_1 = __pyx_t_2; + goto __pyx_L3_bool_binop_done; + } + __pyx_t_2 = (__pyx_v_lcs.source_end == 0); + if (__pyx_t_2) { + } else { + __pyx_t_1 = __pyx_t_2; + goto __pyx_L3_bool_binop_done; + } + __pyx_t_2 = (__pyx_v_lcs.target_begin == 0); + if (__pyx_t_2) { + } else { + __pyx_t_1 = __pyx_t_2; + goto __pyx_L3_bool_binop_done; + } + __pyx_t_2 = (__pyx_v_lcs.target_end == 0); + __pyx_t_1 = __pyx_t_2; + __pyx_L3_bool_binop_done:; + __pyx_r = __pyx_t_1; + goto __pyx_L0; + + /* "spacy/pipeline/_edit_tree_internals/edit_trees.pxd":87 + * int target_end + * + * cdef inline bint lcs_is_empty(LCS lcs): # <<<<<<<<<<<<<< + * return lcs.source_begin == 0 and lcs.source_end == 0 and lcs.target_begin == 0 and lcs.target_end == 0 + * +*/ + + /* function exit code */ + __pyx_L0:; + return __pyx_r; +} + +/* "spacy/pipeline/_edit_tree_internals/edit_trees.pyx":18 + * NULL_TREE_ID = UINT32_MAX + * + * cdef LCS find_lcs(str source, str target): # <<<<<<<<<<<<<< + * """ + * Find the longest common subsequence (LCS) between two strings. If there are +*/ + +static struct __pyx_t_5spacy_8pipeline_20_edit_tree_internals_10edit_trees_LCS __pyx_f_5spacy_8pipeline_20_edit_tree_internals_10edit_trees_find_lcs(PyObject *__pyx_v_source, PyObject *__pyx_v_target) { + Py_ssize_t __pyx_v_target_len; + size_t __pyx_v_longest_align; + int __pyx_v_source_idx; + int __pyx_v_target_idx; + struct __pyx_t_5spacy_8pipeline_20_edit_tree_internals_10edit_trees_LCS __pyx_v_lcs; + Py_UCS4 __pyx_v_source_cp; + Py_UCS4 __pyx_v_target_cp; + std::vector __pyx_v_prev_aligns; + std::vector __pyx_v_cur_aligns; + struct __pyx_t_5spacy_8pipeline_20_edit_tree_internals_10edit_trees_LCS __pyx_r; + __Pyx_RefNannyDeclarations + Py_ssize_t __pyx_t_1; + std::vector __pyx_t_2; + int __pyx_t_3; + PyObject *__pyx_t_4 = NULL; + Py_ssize_t __pyx_t_5; + void *__pyx_t_6; + int __pyx_t_7; + int __pyx_t_8; + Py_ssize_t __pyx_t_9; + PyObject *__pyx_t_10 = NULL; + Py_ssize_t __pyx_t_11; + Py_ssize_t __pyx_t_12; + void *__pyx_t_13; + int __pyx_t_14; + int __pyx_t_15; + Py_ssize_t __pyx_t_16; + int __pyx_t_17; + int __pyx_t_18; + int __pyx_lineno = 0; + const char *__pyx_filename = NULL; + int __pyx_clineno = 0; + __Pyx_RefNannySetupContext("find_lcs", 0); + + /* "spacy/pipeline/_edit_tree_internals/edit_trees.pyx":27 + * RETURNS (LCS): The spans of the longest common subsequences. + * """ + * cdef Py_ssize_t target_len = len(target) # <<<<<<<<<<<<<< + * cdef size_t longest_align = 0 + * cdef int source_idx, target_idx +*/ + if (unlikely(__pyx_v_target == Py_None)) { + PyErr_SetString(PyExc_TypeError, "object of type 'NoneType' has no len()"); + __PYX_ERR(0, 27, __pyx_L1_error) + } + __pyx_t_1 = __Pyx_PyUnicode_GET_LENGTH(__pyx_v_target); if (unlikely(__pyx_t_1 == ((Py_ssize_t)-1))) __PYX_ERR(0, 27, __pyx_L1_error) + __pyx_v_target_len = __pyx_t_1; + + /* "spacy/pipeline/_edit_tree_internals/edit_trees.pyx":28 + * """ + * cdef Py_ssize_t target_len = len(target) + * cdef size_t longest_align = 0 # <<<<<<<<<<<<<< + * cdef int source_idx, target_idx + * cdef LCS lcs +*/ + __pyx_v_longest_align = 0; + + /* "spacy/pipeline/_edit_tree_internals/edit_trees.pyx":33 + * cdef Py_UCS4 source_cp, target_cp + * + * memset(&lcs, 0, sizeof(lcs)) # <<<<<<<<<<<<<< + * + * cdef vector[size_t] prev_aligns = vector[size_t](target_len) +*/ + (void)(memset((&__pyx_v_lcs), 0, (sizeof(__pyx_v_lcs)))); + + /* "spacy/pipeline/_edit_tree_internals/edit_trees.pyx":35 + * memset(&lcs, 0, sizeof(lcs)) + * + * cdef vector[size_t] prev_aligns = vector[size_t](target_len) # <<<<<<<<<<<<<< + * cdef vector[size_t] cur_aligns = vector[size_t](target_len) + * +*/ + try { + __pyx_t_2 = std::vector (__pyx_v_target_len); + } catch(...) { + __Pyx_CppExn2PyErr(); + __PYX_ERR(0, 35, __pyx_L1_error) + } + __pyx_v_prev_aligns = __PYX_STD_MOVE_IF_SUPPORTED(__pyx_t_2); + + /* "spacy/pipeline/_edit_tree_internals/edit_trees.pyx":36 + * + * cdef vector[size_t] prev_aligns = vector[size_t](target_len) + * cdef vector[size_t] cur_aligns = vector[size_t](target_len) # <<<<<<<<<<<<<< + * + * for (source_idx, source_cp) in enumerate(source): +*/ + try { + __pyx_t_2 = std::vector (__pyx_v_target_len); + } catch(...) { + __Pyx_CppExn2PyErr(); + __PYX_ERR(0, 36, __pyx_L1_error) + } + __pyx_v_cur_aligns = __PYX_STD_MOVE_IF_SUPPORTED(__pyx_t_2); + + /* "spacy/pipeline/_edit_tree_internals/edit_trees.pyx":38 + * cdef vector[size_t] cur_aligns = vector[size_t](target_len) + * + * for (source_idx, source_cp) in enumerate(source): # <<<<<<<<<<<<<< + * for (target_idx, target_cp) in enumerate(target): + * if source_cp == target_cp: +*/ + __pyx_t_3 = 0; + if (unlikely(__pyx_v_source == Py_None)) { + PyErr_SetString(PyExc_TypeError, "'NoneType' is not iterable"); + __PYX_ERR(0, 38, __pyx_L1_error) + } + __Pyx_INCREF(__pyx_v_source); + __pyx_t_4 = __pyx_v_source; + __pyx_t_8 = __Pyx_init_unicode_iteration(__pyx_t_4, (&__pyx_t_5), (&__pyx_t_6), (&__pyx_t_7)); if (unlikely(__pyx_t_8 == ((int)-1))) __PYX_ERR(0, 38, __pyx_L1_error) + for (__pyx_t_9 = 0; __pyx_t_9 < __pyx_t_5; __pyx_t_9++) { + __pyx_t_1 = __pyx_t_9; + __pyx_v_source_cp = __Pyx_PyUnicode_READ(__pyx_t_7, __pyx_t_6, __pyx_t_1); + + /* "spacy/pipeline/_edit_tree_internals/edit_trees.pyx":39 + * + * for (source_idx, source_cp) in enumerate(source): + * for (target_idx, target_cp) in enumerate(target): # <<<<<<<<<<<<<< + * if source_cp == target_cp: + * if source_idx == 0 or target_idx == 0: +*/ + __pyx_v_source_idx = __pyx_t_3; + + /* "spacy/pipeline/_edit_tree_internals/edit_trees.pyx":38 + * cdef vector[size_t] cur_aligns = vector[size_t](target_len) + * + * for (source_idx, source_cp) in enumerate(source): # <<<<<<<<<<<<<< + * for (target_idx, target_cp) in enumerate(target): + * if source_cp == target_cp: +*/ + __pyx_t_3 = (__pyx_t_3 + 1); + + /* "spacy/pipeline/_edit_tree_internals/edit_trees.pyx":39 + * + * for (source_idx, source_cp) in enumerate(source): + * for (target_idx, target_cp) in enumerate(target): # <<<<<<<<<<<<<< + * if source_cp == target_cp: + * if source_idx == 0 or target_idx == 0: +*/ + __pyx_t_8 = 0; + if (unlikely(__pyx_v_target == Py_None)) { + PyErr_SetString(PyExc_TypeError, "'NoneType' is not iterable"); + __PYX_ERR(0, 39, __pyx_L1_error) + } + __Pyx_INCREF(__pyx_v_target); + __pyx_t_10 = __pyx_v_target; + __pyx_t_15 = __Pyx_init_unicode_iteration(__pyx_t_10, (&__pyx_t_12), (&__pyx_t_13), (&__pyx_t_14)); if (unlikely(__pyx_t_15 == ((int)-1))) __PYX_ERR(0, 39, __pyx_L1_error) + for (__pyx_t_16 = 0; __pyx_t_16 < __pyx_t_12; __pyx_t_16++) { + __pyx_t_11 = __pyx_t_16; + __pyx_v_target_cp = __Pyx_PyUnicode_READ(__pyx_t_14, __pyx_t_13, __pyx_t_11); + + /* "spacy/pipeline/_edit_tree_internals/edit_trees.pyx":40 + * for (source_idx, source_cp) in enumerate(source): + * for (target_idx, target_cp) in enumerate(target): + * if source_cp == target_cp: # <<<<<<<<<<<<<< + * if source_idx == 0 or target_idx == 0: + * cur_aligns[target_idx] = 1 +*/ + __pyx_v_target_idx = __pyx_t_8; + + /* "spacy/pipeline/_edit_tree_internals/edit_trees.pyx":39 + * + * for (source_idx, source_cp) in enumerate(source): + * for (target_idx, target_cp) in enumerate(target): # <<<<<<<<<<<<<< + * if source_cp == target_cp: + * if source_idx == 0 or target_idx == 0: +*/ + __pyx_t_8 = (__pyx_t_8 + 1); + + /* "spacy/pipeline/_edit_tree_internals/edit_trees.pyx":40 + * for (source_idx, source_cp) in enumerate(source): + * for (target_idx, target_cp) in enumerate(target): + * if source_cp == target_cp: # <<<<<<<<<<<<<< + * if source_idx == 0 or target_idx == 0: + * cur_aligns[target_idx] = 1 +*/ + __pyx_t_17 = (__pyx_v_source_cp == __pyx_v_target_cp); + if (__pyx_t_17) { + + /* "spacy/pipeline/_edit_tree_internals/edit_trees.pyx":41 + * for (target_idx, target_cp) in enumerate(target): + * if source_cp == target_cp: + * if source_idx == 0 or target_idx == 0: # <<<<<<<<<<<<<< + * cur_aligns[target_idx] = 1 + * else: +*/ + __pyx_t_18 = (__pyx_v_source_idx == 0); + if (!__pyx_t_18) { + } else { + __pyx_t_17 = __pyx_t_18; + goto __pyx_L9_bool_binop_done; + } + __pyx_t_18 = (__pyx_v_target_idx == 0); + __pyx_t_17 = __pyx_t_18; + __pyx_L9_bool_binop_done:; + if (__pyx_t_17) { + + /* "spacy/pipeline/_edit_tree_internals/edit_trees.pyx":42 + * if source_cp == target_cp: + * if source_idx == 0 or target_idx == 0: + * cur_aligns[target_idx] = 1 # <<<<<<<<<<<<<< + * else: + * cur_aligns[target_idx] = prev_aligns[target_idx - 1] + 1 +*/ + (__pyx_v_cur_aligns[__pyx_v_target_idx]) = 1; + + /* "spacy/pipeline/_edit_tree_internals/edit_trees.pyx":41 + * for (target_idx, target_cp) in enumerate(target): + * if source_cp == target_cp: + * if source_idx == 0 or target_idx == 0: # <<<<<<<<<<<<<< + * cur_aligns[target_idx] = 1 + * else: +*/ + goto __pyx_L8; + } + + /* "spacy/pipeline/_edit_tree_internals/edit_trees.pyx":44 + * cur_aligns[target_idx] = 1 + * else: + * cur_aligns[target_idx] = prev_aligns[target_idx - 1] + 1 # <<<<<<<<<<<<<< + * + * # Check if this is the longest alignment and replace previous +*/ + /*else*/ { + (__pyx_v_cur_aligns[__pyx_v_target_idx]) = ((__pyx_v_prev_aligns[(__pyx_v_target_idx - 1)]) + 1); + } + __pyx_L8:; + + /* "spacy/pipeline/_edit_tree_internals/edit_trees.pyx":48 + * # Check if this is the longest alignment and replace previous + * # best alignment when this is the case. + * if cur_aligns[target_idx] > longest_align: # <<<<<<<<<<<<<< + * longest_align = cur_aligns[target_idx] + * lcs.source_begin = source_idx - longest_align + 1 +*/ + __pyx_t_17 = ((__pyx_v_cur_aligns[__pyx_v_target_idx]) > __pyx_v_longest_align); + if (__pyx_t_17) { + + /* "spacy/pipeline/_edit_tree_internals/edit_trees.pyx":49 + * # best alignment when this is the case. + * if cur_aligns[target_idx] > longest_align: + * longest_align = cur_aligns[target_idx] # <<<<<<<<<<<<<< + * lcs.source_begin = source_idx - longest_align + 1 + * lcs.source_end = source_idx + 1 +*/ + __pyx_v_longest_align = (__pyx_v_cur_aligns[__pyx_v_target_idx]); + + /* "spacy/pipeline/_edit_tree_internals/edit_trees.pyx":50 + * if cur_aligns[target_idx] > longest_align: + * longest_align = cur_aligns[target_idx] + * lcs.source_begin = source_idx - longest_align + 1 # <<<<<<<<<<<<<< + * lcs.source_end = source_idx + 1 + * lcs.target_begin = target_idx - longest_align + 1 +*/ + __pyx_v_lcs.source_begin = ((__pyx_v_source_idx - __pyx_v_longest_align) + 1); + + /* "spacy/pipeline/_edit_tree_internals/edit_trees.pyx":51 + * longest_align = cur_aligns[target_idx] + * lcs.source_begin = source_idx - longest_align + 1 + * lcs.source_end = source_idx + 1 # <<<<<<<<<<<<<< + * lcs.target_begin = target_idx - longest_align + 1 + * lcs.target_end = target_idx + 1 +*/ + __pyx_v_lcs.source_end = (__pyx_v_source_idx + 1); + + /* "spacy/pipeline/_edit_tree_internals/edit_trees.pyx":52 + * lcs.source_begin = source_idx - longest_align + 1 + * lcs.source_end = source_idx + 1 + * lcs.target_begin = target_idx - longest_align + 1 # <<<<<<<<<<<<<< + * lcs.target_end = target_idx + 1 + * else: +*/ + __pyx_v_lcs.target_begin = ((__pyx_v_target_idx - __pyx_v_longest_align) + 1); + + /* "spacy/pipeline/_edit_tree_internals/edit_trees.pyx":53 + * lcs.source_end = source_idx + 1 + * lcs.target_begin = target_idx - longest_align + 1 + * lcs.target_end = target_idx + 1 # <<<<<<<<<<<<<< + * else: + * # No match, we start with a zero-length alignment. +*/ + __pyx_v_lcs.target_end = (__pyx_v_target_idx + 1); + + /* "spacy/pipeline/_edit_tree_internals/edit_trees.pyx":48 + * # Check if this is the longest alignment and replace previous + * # best alignment when this is the case. + * if cur_aligns[target_idx] > longest_align: # <<<<<<<<<<<<<< + * longest_align = cur_aligns[target_idx] + * lcs.source_begin = source_idx - longest_align + 1 +*/ + } + + /* "spacy/pipeline/_edit_tree_internals/edit_trees.pyx":40 + * for (source_idx, source_cp) in enumerate(source): + * for (target_idx, target_cp) in enumerate(target): + * if source_cp == target_cp: # <<<<<<<<<<<<<< + * if source_idx == 0 or target_idx == 0: + * cur_aligns[target_idx] = 1 +*/ + goto __pyx_L7; + } + + /* "spacy/pipeline/_edit_tree_internals/edit_trees.pyx":56 + * else: + * # No match, we start with a zero-length alignment. + * cur_aligns[target_idx] = 0 # <<<<<<<<<<<<<< + * swap(prev_aligns, cur_aligns) + * +*/ + /*else*/ { + (__pyx_v_cur_aligns[__pyx_v_target_idx]) = 0; + } + __pyx_L7:; + } + __Pyx_DECREF(__pyx_t_10); __pyx_t_10 = 0; + + /* "spacy/pipeline/_edit_tree_internals/edit_trees.pyx":57 + * # No match, we start with a zero-length alignment. + * cur_aligns[target_idx] = 0 + * swap(prev_aligns, cur_aligns) # <<<<<<<<<<<<<< + * + * return lcs +*/ + try { + std::swap >(__pyx_v_prev_aligns, __pyx_v_cur_aligns); + } catch(...) { + __Pyx_CppExn2PyErr(); + __PYX_ERR(0, 57, __pyx_L1_error) + } + } + __Pyx_DECREF(__pyx_t_4); __pyx_t_4 = 0; + + /* "spacy/pipeline/_edit_tree_internals/edit_trees.pyx":59 + * swap(prev_aligns, cur_aligns) + * + * return lcs # <<<<<<<<<<<<<< + * + * cdef class EditTrees: +*/ + __pyx_r = __pyx_v_lcs; + goto __pyx_L0; + + /* "spacy/pipeline/_edit_tree_internals/edit_trees.pyx":18 + * NULL_TREE_ID = UINT32_MAX + * + * cdef LCS find_lcs(str source, str target): # <<<<<<<<<<<<<< + * """ + * Find the longest common subsequence (LCS) between two strings. If there are +*/ + + /* function exit code */ + __pyx_L1_error:; + __Pyx_XDECREF(__pyx_t_4); + __Pyx_XDECREF(__pyx_t_10); + __Pyx_AddTraceback("spacy.pipeline._edit_tree_internals.edit_trees.find_lcs", __pyx_clineno, __pyx_lineno, __pyx_filename); + __Pyx_pretend_to_initialize(&__pyx_r); + __pyx_L0:; + __Pyx_RefNannyFinishContext(); + return __pyx_r; +} + +/* "spacy/pipeline/_edit_tree_internals/edit_trees.pyx":63 + * cdef class EditTrees: + * """Container for constructing and storing edit trees.""" + * def __init__(self, strings: StringStore): # <<<<<<<<<<<<<< + * """Create a container for edit trees. + * +*/ + +/* Python wrapper */ +static int __pyx_pw_5spacy_8pipeline_20_edit_tree_internals_10edit_trees_9EditTrees_1__init__(PyObject *__pyx_v_self, PyObject *__pyx_args, PyObject *__pyx_kwds); /*proto*/ +PyDoc_STRVAR(__pyx_doc_5spacy_8pipeline_20_edit_tree_internals_10edit_trees_9EditTrees___init__, "Create a container for edit trees.\n\n strings (StringStore): the string store to use."); +#if CYTHON_UPDATE_DESCRIPTOR_DOC +struct wrapperbase __pyx_wrapperbase_5spacy_8pipeline_20_edit_tree_internals_10edit_trees_9EditTrees___init__; +#endif +static int __pyx_pw_5spacy_8pipeline_20_edit_tree_internals_10edit_trees_9EditTrees_1__init__(PyObject *__pyx_v_self, PyObject *__pyx_args, PyObject *__pyx_kwds) { + PyObject *__pyx_v_strings = 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_strings,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, 63, __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, 63, __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, 63, __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, 63, __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, 63, __pyx_L3_error) + } + __pyx_v_strings = values[0]; + } + goto __pyx_L6_skip; + __pyx_L5_argtuple_error:; + __Pyx_RaiseArgtupleInvalid("__init__", 1, 1, 1, __pyx_nargs); __PYX_ERR(0, 63, __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("spacy.pipeline._edit_tree_internals.edit_trees.EditTrees.__init__", __pyx_clineno, __pyx_lineno, __pyx_filename); + __Pyx_RefNannyFinishContext(); + return -1; + __pyx_L4_argument_unpacking_done:; + __pyx_r = __pyx_pf_5spacy_8pipeline_20_edit_tree_internals_10edit_trees_9EditTrees___init__(((struct __pyx_obj_5spacy_8pipeline_20_edit_tree_internals_10edit_trees_EditTrees *)__pyx_v_self), __pyx_v_strings); + + /* 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_5spacy_8pipeline_20_edit_tree_internals_10edit_trees_9EditTrees___init__(struct __pyx_obj_5spacy_8pipeline_20_edit_tree_internals_10edit_trees_EditTrees *__pyx_v_self, PyObject *__pyx_v_strings) { + int __pyx_r; + __Pyx_RefNannyDeclarations + PyObject *__pyx_t_1 = NULL; + int __pyx_lineno = 0; + const char *__pyx_filename = NULL; + int __pyx_clineno = 0; + __Pyx_RefNannySetupContext("__init__", 0); + + /* "spacy/pipeline/_edit_tree_internals/edit_trees.pyx":67 + * + * strings (StringStore): the string store to use.""" + * self.strings = strings # <<<<<<<<<<<<<< + * + * cpdef uint32_t add(self, str form, str lemma): +*/ + __pyx_t_1 = __pyx_v_strings; + __Pyx_INCREF(__pyx_t_1); + if (!(likely(((__pyx_t_1) == Py_None) || likely(__Pyx_TypeTest(__pyx_t_1, __pyx_mstate_global->__pyx_ptype_5spacy_7strings_StringStore))))) __PYX_ERR(0, 67, __pyx_L1_error) + __Pyx_GIVEREF(__pyx_t_1); + __Pyx_GOTREF((PyObject *)__pyx_v_self->strings); + __Pyx_DECREF((PyObject *)__pyx_v_self->strings); + __pyx_v_self->strings = ((struct __pyx_obj_5spacy_7strings_StringStore *)__pyx_t_1); + __pyx_t_1 = 0; + + /* "spacy/pipeline/_edit_tree_internals/edit_trees.pyx":63 + * cdef class EditTrees: + * """Container for constructing and storing edit trees.""" + * def __init__(self, strings: StringStore): # <<<<<<<<<<<<<< + * """Create a container for edit trees. + * +*/ + + /* function exit code */ + __pyx_r = 0; + goto __pyx_L0; + __pyx_L1_error:; + __Pyx_XDECREF(__pyx_t_1); + __Pyx_AddTraceback("spacy.pipeline._edit_tree_internals.edit_trees.EditTrees.__init__", __pyx_clineno, __pyx_lineno, __pyx_filename); + __pyx_r = -1; + __pyx_L0:; + __Pyx_RefNannyFinishContext(); + return __pyx_r; +} + +/* "spacy/pipeline/_edit_tree_internals/edit_trees.pyx":69 + * self.strings = strings + * + * cpdef uint32_t add(self, str form, str lemma): # <<<<<<<<<<<<<< + * """Add an edit tree that rewrites the given string into the given lemma. + * +*/ + +static PyObject *__pyx_pw_5spacy_8pipeline_20_edit_tree_internals_10edit_trees_9EditTrees_3add(PyObject *__pyx_v_self, +#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*/ +static uint32_t __pyx_f_5spacy_8pipeline_20_edit_tree_internals_10edit_trees_9EditTrees_add(struct __pyx_obj_5spacy_8pipeline_20_edit_tree_internals_10edit_trees_EditTrees *__pyx_v_self, PyObject *__pyx_v_form, PyObject *__pyx_v_lemma, int __pyx_skip_dispatch) { + struct __pyx_t_5spacy_8pipeline_20_edit_tree_internals_10edit_trees_EditTreeC __pyx_v_tree; + uint32_t __pyx_r; + __Pyx_RefNannyDeclarations + PyObject *__pyx_t_1 = NULL; + PyObject *__pyx_t_2 = NULL; + PyObject *__pyx_t_3 = NULL; + PyObject *__pyx_t_4 = NULL; + size_t __pyx_t_5; + uint32_t __pyx_t_6; + int __pyx_t_7; + Py_ssize_t __pyx_t_8; + int __pyx_t_9; + struct __pyx_t_5spacy_8pipeline_20_edit_tree_internals_10edit_trees_EditTreeC __pyx_t_10; + int __pyx_lineno = 0; + const char *__pyx_filename = NULL; + int __pyx_clineno = 0; + __Pyx_RefNannySetupContext("add", 0); + /* Check if called by wrapper */ + if (unlikely(__pyx_skip_dispatch)) ; + /* Check if overridden in Python */ + else if ( + #if !CYTHON_USE_TYPE_SLOTS + unlikely(Py_TYPE(((PyObject *)__pyx_v_self)) != __pyx_mstate_global->__pyx_ptype_5spacy_8pipeline_20_edit_tree_internals_10edit_trees_EditTrees && + __Pyx_PyType_HasFeature(Py_TYPE(((PyObject *)__pyx_v_self)), Py_TPFLAGS_HAVE_GC)) + #else + unlikely(Py_TYPE(((PyObject *)__pyx_v_self))->tp_dictoffset != 0 || __Pyx_PyType_HasFeature(Py_TYPE(((PyObject *)__pyx_v_self)), (Py_TPFLAGS_IS_ABSTRACT | Py_TPFLAGS_HEAPTYPE))) + #endif + ) { + #if CYTHON_USE_DICT_VERSIONS && CYTHON_USE_PYTYPE_LOOKUP && CYTHON_USE_TYPE_SLOTS + static PY_UINT64_T __pyx_tp_dict_version = __PYX_DICT_VERSION_INIT, __pyx_obj_dict_version = __PYX_DICT_VERSION_INIT; + if (unlikely(!__Pyx_object_dict_version_matches(((PyObject *)__pyx_v_self), __pyx_tp_dict_version, __pyx_obj_dict_version))) { + PY_UINT64_T __pyx_typedict_guard = __Pyx_get_tp_dict_version(((PyObject *)__pyx_v_self)); + #endif + __pyx_t_1 = __Pyx_PyObject_GetAttrStr(((PyObject *)__pyx_v_self), __pyx_mstate_global->__pyx_n_u_add); if (unlikely(!__pyx_t_1)) __PYX_ERR(0, 69, __pyx_L1_error) + __Pyx_GOTREF(__pyx_t_1); + if (!__Pyx_IsSameCFunction(__pyx_t_1, (void(*)(void)) __pyx_pw_5spacy_8pipeline_20_edit_tree_internals_10edit_trees_9EditTrees_3add)) { + __pyx_t_3 = NULL; + __Pyx_INCREF(__pyx_t_1); + __pyx_t_4 = __pyx_t_1; + __pyx_t_5 = 1; + #if CYTHON_UNPACK_METHODS + if (unlikely(PyMethod_Check(__pyx_t_4))) { + __pyx_t_3 = PyMethod_GET_SELF(__pyx_t_4); + assert(__pyx_t_3); + PyObject* __pyx__function = PyMethod_GET_FUNCTION(__pyx_t_4); + __Pyx_INCREF(__pyx_t_3); + __Pyx_INCREF(__pyx__function); + __Pyx_DECREF_SET(__pyx_t_4, __pyx__function); + __pyx_t_5 = 0; + } + #endif + { + PyObject *__pyx_callargs[3] = {__pyx_t_3, __pyx_v_form, __pyx_v_lemma}; + __pyx_t_2 = __Pyx_PyObject_FastCall((PyObject*)__pyx_t_4, __pyx_callargs+__pyx_t_5, (3-__pyx_t_5) | (__pyx_t_5*__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, 69, __pyx_L1_error) + __Pyx_GOTREF(__pyx_t_2); + } + __pyx_t_6 = __Pyx_PyLong_As_uint32_t(__pyx_t_2); if (unlikely((__pyx_t_6 == ((uint32_t)-1)) && PyErr_Occurred())) __PYX_ERR(0, 69, __pyx_L1_error) + __Pyx_DECREF(__pyx_t_2); __pyx_t_2 = 0; + __pyx_r = __pyx_t_6; + __Pyx_DECREF(__pyx_t_1); __pyx_t_1 = 0; + goto __pyx_L0; + } + #if CYTHON_USE_DICT_VERSIONS && CYTHON_USE_PYTYPE_LOOKUP && CYTHON_USE_TYPE_SLOTS + __pyx_tp_dict_version = __Pyx_get_tp_dict_version(((PyObject *)__pyx_v_self)); + __pyx_obj_dict_version = __Pyx_get_object_dict_version(((PyObject *)__pyx_v_self)); + if (unlikely(__pyx_typedict_guard != __pyx_tp_dict_version)) { + __pyx_tp_dict_version = __pyx_obj_dict_version = __PYX_DICT_VERSION_INIT; + } + #endif + __Pyx_DECREF(__pyx_t_1); __pyx_t_1 = 0; + #if CYTHON_USE_DICT_VERSIONS && CYTHON_USE_PYTYPE_LOOKUP && CYTHON_USE_TYPE_SLOTS + } + #endif + } + + /* "spacy/pipeline/_edit_tree_internals/edit_trees.pyx":80 + * # recursive tree construction with logic for this case, handle + * # it in this wrapper method. + * if len(form) == 0 and len(lemma) == 0: # <<<<<<<<<<<<<< + * tree = edittree_new_match(0, 0, NULL_TREE_ID, NULL_TREE_ID) + * return self._tree_id(tree) +*/ + if (unlikely(__pyx_v_form == Py_None)) { + PyErr_SetString(PyExc_TypeError, "object of type 'NoneType' has no len()"); + __PYX_ERR(0, 80, __pyx_L1_error) + } + __pyx_t_8 = __Pyx_PyUnicode_GET_LENGTH(__pyx_v_form); if (unlikely(__pyx_t_8 == ((Py_ssize_t)-1))) __PYX_ERR(0, 80, __pyx_L1_error) + __pyx_t_9 = (__pyx_t_8 == 0); + if (__pyx_t_9) { + } else { + __pyx_t_7 = __pyx_t_9; + goto __pyx_L4_bool_binop_done; + } + if (unlikely(__pyx_v_lemma == Py_None)) { + PyErr_SetString(PyExc_TypeError, "object of type 'NoneType' has no len()"); + __PYX_ERR(0, 80, __pyx_L1_error) + } + __pyx_t_8 = __Pyx_PyUnicode_GET_LENGTH(__pyx_v_lemma); if (unlikely(__pyx_t_8 == ((Py_ssize_t)-1))) __PYX_ERR(0, 80, __pyx_L1_error) + __pyx_t_9 = (__pyx_t_8 == 0); + __pyx_t_7 = __pyx_t_9; + __pyx_L4_bool_binop_done:; + if (__pyx_t_7) { + + /* "spacy/pipeline/_edit_tree_internals/edit_trees.pyx":81 + * # it in this wrapper method. + * if len(form) == 0 and len(lemma) == 0: + * tree = edittree_new_match(0, 0, NULL_TREE_ID, NULL_TREE_ID) # <<<<<<<<<<<<<< + * return self._tree_id(tree) + * +*/ + __pyx_t_10 = __pyx_f_5spacy_8pipeline_20_edit_tree_internals_10edit_trees_edittree_new_match(0, 0, __pyx_v_5spacy_8pipeline_20_edit_tree_internals_10edit_trees_NULL_TREE_ID, __pyx_v_5spacy_8pipeline_20_edit_tree_internals_10edit_trees_NULL_TREE_ID); if (unlikely(PyErr_Occurred())) __PYX_ERR(0, 81, __pyx_L1_error) + __pyx_v_tree = __pyx_t_10; + + /* "spacy/pipeline/_edit_tree_internals/edit_trees.pyx":82 + * if len(form) == 0 and len(lemma) == 0: + * tree = edittree_new_match(0, 0, NULL_TREE_ID, NULL_TREE_ID) + * return self._tree_id(tree) # <<<<<<<<<<<<<< + * + * return self._add(form, lemma) +*/ + __pyx_t_6 = ((struct __pyx_vtabstruct_5spacy_8pipeline_20_edit_tree_internals_10edit_trees_EditTrees *)__pyx_v_self->__pyx_vtab)->_tree_id(__pyx_v_self, __pyx_v_tree); if (unlikely(PyErr_Occurred())) __PYX_ERR(0, 82, __pyx_L1_error) + __pyx_r = __pyx_t_6; + goto __pyx_L0; + + /* "spacy/pipeline/_edit_tree_internals/edit_trees.pyx":80 + * # recursive tree construction with logic for this case, handle + * # it in this wrapper method. + * if len(form) == 0 and len(lemma) == 0: # <<<<<<<<<<<<<< + * tree = edittree_new_match(0, 0, NULL_TREE_ID, NULL_TREE_ID) + * return self._tree_id(tree) +*/ + } + + /* "spacy/pipeline/_edit_tree_internals/edit_trees.pyx":84 + * return self._tree_id(tree) + * + * return self._add(form, lemma) # <<<<<<<<<<<<<< + * + * cdef uint32_t _add(self, str form, str lemma): +*/ + __pyx_t_6 = ((struct __pyx_vtabstruct_5spacy_8pipeline_20_edit_tree_internals_10edit_trees_EditTrees *)__pyx_v_self->__pyx_vtab)->_add(__pyx_v_self, __pyx_v_form, __pyx_v_lemma); if (unlikely(PyErr_Occurred())) __PYX_ERR(0, 84, __pyx_L1_error) + __pyx_r = __pyx_t_6; + goto __pyx_L0; + + /* "spacy/pipeline/_edit_tree_internals/edit_trees.pyx":69 + * self.strings = strings + * + * cpdef uint32_t add(self, str form, str lemma): # <<<<<<<<<<<<<< + * """Add an edit tree that rewrites the given string into the given lemma. + * +*/ + + /* function exit code */ + __pyx_L1_error:; + __Pyx_XDECREF(__pyx_t_1); + __Pyx_XDECREF(__pyx_t_2); + __Pyx_XDECREF(__pyx_t_3); + __Pyx_XDECREF(__pyx_t_4); + __Pyx_AddTraceback("spacy.pipeline._edit_tree_internals.edit_trees.EditTrees.add", __pyx_clineno, __pyx_lineno, __pyx_filename); + __pyx_r = 0; + __pyx_L0:; + __Pyx_RefNannyFinishContext(); + return __pyx_r; +} + +/* Python wrapper */ +static PyObject *__pyx_pw_5spacy_8pipeline_20_edit_tree_internals_10edit_trees_9EditTrees_3add(PyObject *__pyx_v_self, +#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_5spacy_8pipeline_20_edit_tree_internals_10edit_trees_9EditTrees_2add, "EditTrees.add(self, str form, str lemma) -> uint32_t\n\nAdd an edit tree that rewrites the given string into the given lemma.\n\nRETURNS (int): identifier of the edit tree in the container."); +static PyMethodDef __pyx_mdef_5spacy_8pipeline_20_edit_tree_internals_10edit_trees_9EditTrees_3add = {"add", (PyCFunction)(void(*)(void))(__Pyx_PyCFunction_FastCallWithKeywords)__pyx_pw_5spacy_8pipeline_20_edit_tree_internals_10edit_trees_9EditTrees_3add, __Pyx_METH_FASTCALL|METH_KEYWORDS, __pyx_doc_5spacy_8pipeline_20_edit_tree_internals_10edit_trees_9EditTrees_2add}; +static PyObject *__pyx_pw_5spacy_8pipeline_20_edit_tree_internals_10edit_trees_9EditTrees_3add(PyObject *__pyx_v_self, +#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_form = 0; + PyObject *__pyx_v_lemma = 0; + #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("add (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_form,&__pyx_mstate_global->__pyx_n_u_lemma,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, 69, __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, 69, __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, 69, __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, "add", 0) < (0)) __PYX_ERR(0, 69, __pyx_L3_error) + for (Py_ssize_t i = __pyx_nargs; i < 2; i++) { + if (unlikely(!values[i])) { __Pyx_RaiseArgtupleInvalid("add", 1, 2, 2, i); __PYX_ERR(0, 69, __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, 69, __pyx_L3_error) + values[1] = __Pyx_ArgRef_FASTCALL(__pyx_args, 1); + if (!CYTHON_ASSUME_SAFE_MACROS && unlikely(!values[1])) __PYX_ERR(0, 69, __pyx_L3_error) + } + __pyx_v_form = ((PyObject*)values[0]); + __pyx_v_lemma = ((PyObject*)values[1]); + } + goto __pyx_L6_skip; + __pyx_L5_argtuple_error:; + __Pyx_RaiseArgtupleInvalid("add", 1, 2, 2, __pyx_nargs); __PYX_ERR(0, 69, __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("spacy.pipeline._edit_tree_internals.edit_trees.EditTrees.add", __pyx_clineno, __pyx_lineno, __pyx_filename); + __Pyx_RefNannyFinishContext(); + return NULL; + __pyx_L4_argument_unpacking_done:; + if (unlikely(!__Pyx_ArgTypeTest(((PyObject *)__pyx_v_form), (&PyUnicode_Type), 1, "form", 1))) __PYX_ERR(0, 69, __pyx_L1_error) + if (unlikely(!__Pyx_ArgTypeTest(((PyObject *)__pyx_v_lemma), (&PyUnicode_Type), 1, "lemma", 1))) __PYX_ERR(0, 69, __pyx_L1_error) + __pyx_r = __pyx_pf_5spacy_8pipeline_20_edit_tree_internals_10edit_trees_9EditTrees_2add(((struct __pyx_obj_5spacy_8pipeline_20_edit_tree_internals_10edit_trees_EditTrees *)__pyx_v_self), __pyx_v_form, __pyx_v_lemma); + + /* 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_5spacy_8pipeline_20_edit_tree_internals_10edit_trees_9EditTrees_2add(struct __pyx_obj_5spacy_8pipeline_20_edit_tree_internals_10edit_trees_EditTrees *__pyx_v_self, PyObject *__pyx_v_form, PyObject *__pyx_v_lemma) { + PyObject *__pyx_r = NULL; + __Pyx_RefNannyDeclarations + uint32_t __pyx_t_1; + PyObject *__pyx_t_2 = NULL; + int __pyx_lineno = 0; + const char *__pyx_filename = NULL; + int __pyx_clineno = 0; + __Pyx_RefNannySetupContext("add", 0); + __Pyx_XDECREF(__pyx_r); + __pyx_t_1 = __pyx_f_5spacy_8pipeline_20_edit_tree_internals_10edit_trees_9EditTrees_add(__pyx_v_self, __pyx_v_form, __pyx_v_lemma, 1); if (unlikely(PyErr_Occurred())) __PYX_ERR(0, 69, __pyx_L1_error) + __pyx_t_2 = __Pyx_PyLong_From_uint32_t(__pyx_t_1); if (unlikely(!__pyx_t_2)) __PYX_ERR(0, 69, __pyx_L1_error) + __Pyx_GOTREF(__pyx_t_2); + __pyx_r = __pyx_t_2; + __pyx_t_2 = 0; + goto __pyx_L0; + + /* function exit code */ + __pyx_L1_error:; + __Pyx_XDECREF(__pyx_t_2); + __Pyx_AddTraceback("spacy.pipeline._edit_tree_internals.edit_trees.EditTrees.add", __pyx_clineno, __pyx_lineno, __pyx_filename); + __pyx_r = NULL; + __pyx_L0:; + __Pyx_XGIVEREF(__pyx_r); + __Pyx_RefNannyFinishContext(); + return __pyx_r; +} + +/* "spacy/pipeline/_edit_tree_internals/edit_trees.pyx":86 + * return self._add(form, lemma) + * + * cdef uint32_t _add(self, str form, str lemma): # <<<<<<<<<<<<<< + * cdef LCS lcs = find_lcs(form, lemma) + * +*/ + +static uint32_t __pyx_f_5spacy_8pipeline_20_edit_tree_internals_10edit_trees_9EditTrees__add(struct __pyx_obj_5spacy_8pipeline_20_edit_tree_internals_10edit_trees_EditTrees *__pyx_v_self, PyObject *__pyx_v_form, PyObject *__pyx_v_lemma) { + struct __pyx_t_5spacy_8pipeline_20_edit_tree_internals_10edit_trees_LCS __pyx_v_lcs; + struct __pyx_t_5spacy_8pipeline_20_edit_tree_internals_10edit_trees_EditTreeC __pyx_v_tree; + uint32_t __pyx_v_prefix_tree; + uint32_t __pyx_v_suffix_tree; + uint32_t __pyx_r; + __Pyx_RefNannyDeclarations + struct __pyx_t_5spacy_8pipeline_20_edit_tree_internals_10edit_trees_LCS __pyx_t_1; + int __pyx_t_2; + PyObject *__pyx_t_3 = NULL; + PyObject *__pyx_t_4 = NULL; + size_t __pyx_t_5; + __pyx_t_5spacy_8typedefs_attr_t __pyx_t_6; + __pyx_t_5spacy_8typedefs_attr_t __pyx_t_7; + struct __pyx_t_5spacy_8pipeline_20_edit_tree_internals_10edit_trees_EditTreeC __pyx_t_8; + int __pyx_t_9; + uint32_t __pyx_t_10; + Py_ssize_t __pyx_t_11; + int __pyx_lineno = 0; + const char *__pyx_filename = NULL; + int __pyx_clineno = 0; + __Pyx_RefNannySetupContext("_add", 0); + + /* "spacy/pipeline/_edit_tree_internals/edit_trees.pyx":87 + * + * cdef uint32_t _add(self, str form, str lemma): + * cdef LCS lcs = find_lcs(form, lemma) # <<<<<<<<<<<<<< + * + * cdef EditTreeC tree +*/ + __pyx_t_1 = __pyx_f_5spacy_8pipeline_20_edit_tree_internals_10edit_trees_find_lcs(__pyx_v_form, __pyx_v_lemma); if (unlikely(PyErr_Occurred())) __PYX_ERR(0, 87, __pyx_L1_error) + __pyx_v_lcs = __pyx_t_1; + + /* "spacy/pipeline/_edit_tree_internals/edit_trees.pyx":91 + * cdef EditTreeC tree + * cdef uint32_t prefix_tree, suffix_tree + * if lcs_is_empty(lcs): # <<<<<<<<<<<<<< + * tree = edittree_new_subst(self.strings.add(form), self.strings.add(lemma)) + * else: +*/ + __pyx_t_2 = __pyx_f_5spacy_8pipeline_20_edit_tree_internals_10edit_trees_lcs_is_empty(__pyx_v_lcs); if (unlikely(__pyx_t_2 == ((int)-1) && PyErr_Occurred())) __PYX_ERR(0, 91, __pyx_L1_error) + if (__pyx_t_2) { + + /* "spacy/pipeline/_edit_tree_internals/edit_trees.pyx":92 + * cdef uint32_t prefix_tree, suffix_tree + * if lcs_is_empty(lcs): + * tree = edittree_new_subst(self.strings.add(form), self.strings.add(lemma)) # <<<<<<<<<<<<<< + * else: + * # If we have a non-empty LCS, such as "gooi" in "ge[gooi]d" and "[gooi]en", +*/ + __pyx_t_4 = ((PyObject *)__pyx_v_self->strings); + __Pyx_INCREF(__pyx_t_4); + __pyx_t_5 = 0; + { + PyObject *__pyx_callargs[2] = {__pyx_t_4, __pyx_v_form}; + __pyx_t_3 = __Pyx_PyObject_FastCallMethod((PyObject*)__pyx_mstate_global->__pyx_n_u_add, __pyx_callargs+__pyx_t_5, (2-__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, 92, __pyx_L1_error) + __Pyx_GOTREF(__pyx_t_3); + } + __pyx_t_6 = __Pyx_PyLong_As_uint64_t(__pyx_t_3); if (unlikely((__pyx_t_6 == ((uint64_t)-1)) && PyErr_Occurred())) __PYX_ERR(0, 92, __pyx_L1_error) + __Pyx_DECREF(__pyx_t_3); __pyx_t_3 = 0; + __pyx_t_4 = ((PyObject *)__pyx_v_self->strings); + __Pyx_INCREF(__pyx_t_4); + __pyx_t_5 = 0; + { + PyObject *__pyx_callargs[2] = {__pyx_t_4, __pyx_v_lemma}; + __pyx_t_3 = __Pyx_PyObject_FastCallMethod((PyObject*)__pyx_mstate_global->__pyx_n_u_add, __pyx_callargs+__pyx_t_5, (2-__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, 92, __pyx_L1_error) + __Pyx_GOTREF(__pyx_t_3); + } + __pyx_t_7 = __Pyx_PyLong_As_uint64_t(__pyx_t_3); if (unlikely((__pyx_t_7 == ((uint64_t)-1)) && PyErr_Occurred())) __PYX_ERR(0, 92, __pyx_L1_error) + __Pyx_DECREF(__pyx_t_3); __pyx_t_3 = 0; + __pyx_t_8 = __pyx_f_5spacy_8pipeline_20_edit_tree_internals_10edit_trees_edittree_new_subst(__pyx_t_6, __pyx_t_7); if (unlikely(PyErr_Occurred())) __PYX_ERR(0, 92, __pyx_L1_error) + __pyx_v_tree = __pyx_t_8; + + /* "spacy/pipeline/_edit_tree_internals/edit_trees.pyx":91 + * cdef EditTreeC tree + * cdef uint32_t prefix_tree, suffix_tree + * if lcs_is_empty(lcs): # <<<<<<<<<<<<<< + * tree = edittree_new_subst(self.strings.add(form), self.strings.add(lemma)) + * else: +*/ + goto __pyx_L3; + } + + /* "spacy/pipeline/_edit_tree_internals/edit_trees.pyx":96 + * # If we have a non-empty LCS, such as "gooi" in "ge[gooi]d" and "[gooi]en", + * # create edit trees for the prefix pair ("ge"/"") and the suffix pair ("d"/"en"). + * prefix_tree = NULL_TREE_ID # <<<<<<<<<<<<<< + * if lcs.source_begin != 0 or lcs.target_begin != 0: + * prefix_tree = self.add(form[:lcs.source_begin], lemma[:lcs.target_begin]) +*/ + /*else*/ { + __pyx_v_prefix_tree = __pyx_v_5spacy_8pipeline_20_edit_tree_internals_10edit_trees_NULL_TREE_ID; + + /* "spacy/pipeline/_edit_tree_internals/edit_trees.pyx":97 + * # create edit trees for the prefix pair ("ge"/"") and the suffix pair ("d"/"en"). + * prefix_tree = NULL_TREE_ID + * if lcs.source_begin != 0 or lcs.target_begin != 0: # <<<<<<<<<<<<<< + * prefix_tree = self.add(form[:lcs.source_begin], lemma[:lcs.target_begin]) + * +*/ + __pyx_t_9 = (__pyx_v_lcs.source_begin != 0); + if (!__pyx_t_9) { + } else { + __pyx_t_2 = __pyx_t_9; + goto __pyx_L5_bool_binop_done; + } + __pyx_t_9 = (__pyx_v_lcs.target_begin != 0); + __pyx_t_2 = __pyx_t_9; + __pyx_L5_bool_binop_done:; + if (__pyx_t_2) { + + /* "spacy/pipeline/_edit_tree_internals/edit_trees.pyx":98 + * prefix_tree = NULL_TREE_ID + * if lcs.source_begin != 0 or lcs.target_begin != 0: + * prefix_tree = self.add(form[:lcs.source_begin], lemma[:lcs.target_begin]) # <<<<<<<<<<<<<< + * + * suffix_tree = NULL_TREE_ID +*/ + if (unlikely(__pyx_v_form == Py_None)) { + PyErr_SetString(PyExc_TypeError, "'NoneType' object is not subscriptable"); + __PYX_ERR(0, 98, __pyx_L1_error) + } + __pyx_t_3 = __Pyx_PyUnicode_Substring(__pyx_v_form, 0, __pyx_v_lcs.source_begin); if (unlikely(!__pyx_t_3)) __PYX_ERR(0, 98, __pyx_L1_error) + __Pyx_GOTREF(__pyx_t_3); + if (unlikely(__pyx_v_lemma == Py_None)) { + PyErr_SetString(PyExc_TypeError, "'NoneType' object is not subscriptable"); + __PYX_ERR(0, 98, __pyx_L1_error) + } + __pyx_t_4 = __Pyx_PyUnicode_Substring(__pyx_v_lemma, 0, __pyx_v_lcs.target_begin); if (unlikely(!__pyx_t_4)) __PYX_ERR(0, 98, __pyx_L1_error) + __Pyx_GOTREF(__pyx_t_4); + __pyx_t_10 = ((struct __pyx_vtabstruct_5spacy_8pipeline_20_edit_tree_internals_10edit_trees_EditTrees *)__pyx_v_self->__pyx_vtab)->add(__pyx_v_self, ((PyObject*)__pyx_t_3), ((PyObject*)__pyx_t_4), 0); if (unlikely(PyErr_Occurred())) __PYX_ERR(0, 98, __pyx_L1_error) + __Pyx_DECREF(__pyx_t_3); __pyx_t_3 = 0; + __Pyx_DECREF(__pyx_t_4); __pyx_t_4 = 0; + __pyx_v_prefix_tree = __pyx_t_10; + + /* "spacy/pipeline/_edit_tree_internals/edit_trees.pyx":97 + * # create edit trees for the prefix pair ("ge"/"") and the suffix pair ("d"/"en"). + * prefix_tree = NULL_TREE_ID + * if lcs.source_begin != 0 or lcs.target_begin != 0: # <<<<<<<<<<<<<< + * prefix_tree = self.add(form[:lcs.source_begin], lemma[:lcs.target_begin]) + * +*/ + } + + /* "spacy/pipeline/_edit_tree_internals/edit_trees.pyx":100 + * prefix_tree = self.add(form[:lcs.source_begin], lemma[:lcs.target_begin]) + * + * suffix_tree = NULL_TREE_ID # <<<<<<<<<<<<<< + * if lcs.source_end != len(form) or lcs.target_end != len(lemma): + * suffix_tree = self.add(form[lcs.source_end:], lemma[lcs.target_end:]) +*/ + __pyx_v_suffix_tree = __pyx_v_5spacy_8pipeline_20_edit_tree_internals_10edit_trees_NULL_TREE_ID; + + /* "spacy/pipeline/_edit_tree_internals/edit_trees.pyx":101 + * + * suffix_tree = NULL_TREE_ID + * if lcs.source_end != len(form) or lcs.target_end != len(lemma): # <<<<<<<<<<<<<< + * suffix_tree = self.add(form[lcs.source_end:], lemma[lcs.target_end:]) + * +*/ + if (unlikely(__pyx_v_form == Py_None)) { + PyErr_SetString(PyExc_TypeError, "object of type 'NoneType' has no len()"); + __PYX_ERR(0, 101, __pyx_L1_error) + } + __pyx_t_11 = __Pyx_PyUnicode_GET_LENGTH(__pyx_v_form); if (unlikely(__pyx_t_11 == ((Py_ssize_t)-1))) __PYX_ERR(0, 101, __pyx_L1_error) + __pyx_t_9 = (__pyx_v_lcs.source_end != __pyx_t_11); + if (!__pyx_t_9) { + } else { + __pyx_t_2 = __pyx_t_9; + goto __pyx_L8_bool_binop_done; + } + if (unlikely(__pyx_v_lemma == Py_None)) { + PyErr_SetString(PyExc_TypeError, "object of type 'NoneType' has no len()"); + __PYX_ERR(0, 101, __pyx_L1_error) + } + __pyx_t_11 = __Pyx_PyUnicode_GET_LENGTH(__pyx_v_lemma); if (unlikely(__pyx_t_11 == ((Py_ssize_t)-1))) __PYX_ERR(0, 101, __pyx_L1_error) + __pyx_t_9 = (__pyx_v_lcs.target_end != __pyx_t_11); + __pyx_t_2 = __pyx_t_9; + __pyx_L8_bool_binop_done:; + if (__pyx_t_2) { + + /* "spacy/pipeline/_edit_tree_internals/edit_trees.pyx":102 + * suffix_tree = NULL_TREE_ID + * if lcs.source_end != len(form) or lcs.target_end != len(lemma): + * suffix_tree = self.add(form[lcs.source_end:], lemma[lcs.target_end:]) # <<<<<<<<<<<<<< + * + * tree = edittree_new_match(lcs.source_begin, len(form) - lcs.source_end, prefix_tree, suffix_tree) +*/ + if (unlikely(__pyx_v_form == Py_None)) { + PyErr_SetString(PyExc_TypeError, "'NoneType' object is not subscriptable"); + __PYX_ERR(0, 102, __pyx_L1_error) + } + __pyx_t_4 = __Pyx_PyUnicode_Substring(__pyx_v_form, __pyx_v_lcs.source_end, PY_SSIZE_T_MAX); if (unlikely(!__pyx_t_4)) __PYX_ERR(0, 102, __pyx_L1_error) + __Pyx_GOTREF(__pyx_t_4); + if (unlikely(__pyx_v_lemma == Py_None)) { + PyErr_SetString(PyExc_TypeError, "'NoneType' object is not subscriptable"); + __PYX_ERR(0, 102, __pyx_L1_error) + } + __pyx_t_3 = __Pyx_PyUnicode_Substring(__pyx_v_lemma, __pyx_v_lcs.target_end, PY_SSIZE_T_MAX); if (unlikely(!__pyx_t_3)) __PYX_ERR(0, 102, __pyx_L1_error) + __Pyx_GOTREF(__pyx_t_3); + __pyx_t_10 = ((struct __pyx_vtabstruct_5spacy_8pipeline_20_edit_tree_internals_10edit_trees_EditTrees *)__pyx_v_self->__pyx_vtab)->add(__pyx_v_self, ((PyObject*)__pyx_t_4), ((PyObject*)__pyx_t_3), 0); if (unlikely(PyErr_Occurred())) __PYX_ERR(0, 102, __pyx_L1_error) + __Pyx_DECREF(__pyx_t_4); __pyx_t_4 = 0; + __Pyx_DECREF(__pyx_t_3); __pyx_t_3 = 0; + __pyx_v_suffix_tree = __pyx_t_10; + + /* "spacy/pipeline/_edit_tree_internals/edit_trees.pyx":101 + * + * suffix_tree = NULL_TREE_ID + * if lcs.source_end != len(form) or lcs.target_end != len(lemma): # <<<<<<<<<<<<<< + * suffix_tree = self.add(form[lcs.source_end:], lemma[lcs.target_end:]) + * +*/ + } + + /* "spacy/pipeline/_edit_tree_internals/edit_trees.pyx":104 + * suffix_tree = self.add(form[lcs.source_end:], lemma[lcs.target_end:]) + * + * tree = edittree_new_match(lcs.source_begin, len(form) - lcs.source_end, prefix_tree, suffix_tree) # <<<<<<<<<<<<<< + * + * return self._tree_id(tree) +*/ + if (unlikely(__pyx_v_form == Py_None)) { + PyErr_SetString(PyExc_TypeError, "object of type 'NoneType' has no len()"); + __PYX_ERR(0, 104, __pyx_L1_error) + } + __pyx_t_11 = __Pyx_PyUnicode_GET_LENGTH(__pyx_v_form); if (unlikely(__pyx_t_11 == ((Py_ssize_t)-1))) __PYX_ERR(0, 104, __pyx_L1_error) + __pyx_t_8 = __pyx_f_5spacy_8pipeline_20_edit_tree_internals_10edit_trees_edittree_new_match(__pyx_v_lcs.source_begin, (__pyx_t_11 - __pyx_v_lcs.source_end), __pyx_v_prefix_tree, __pyx_v_suffix_tree); if (unlikely(PyErr_Occurred())) __PYX_ERR(0, 104, __pyx_L1_error) + __pyx_v_tree = __pyx_t_8; + } + __pyx_L3:; + + /* "spacy/pipeline/_edit_tree_internals/edit_trees.pyx":106 + * tree = edittree_new_match(lcs.source_begin, len(form) - lcs.source_end, prefix_tree, suffix_tree) + * + * return self._tree_id(tree) # <<<<<<<<<<<<<< + * + * cdef uint32_t _tree_id(self, EditTreeC tree): +*/ + __pyx_t_10 = ((struct __pyx_vtabstruct_5spacy_8pipeline_20_edit_tree_internals_10edit_trees_EditTrees *)__pyx_v_self->__pyx_vtab)->_tree_id(__pyx_v_self, __pyx_v_tree); if (unlikely(PyErr_Occurred())) __PYX_ERR(0, 106, __pyx_L1_error) + __pyx_r = __pyx_t_10; + goto __pyx_L0; + + /* "spacy/pipeline/_edit_tree_internals/edit_trees.pyx":86 + * return self._add(form, lemma) + * + * cdef uint32_t _add(self, str form, str lemma): # <<<<<<<<<<<<<< + * cdef LCS lcs = find_lcs(form, lemma) + * +*/ + + /* function exit code */ + __pyx_L1_error:; + __Pyx_XDECREF(__pyx_t_3); + __Pyx_XDECREF(__pyx_t_4); + __Pyx_AddTraceback("spacy.pipeline._edit_tree_internals.edit_trees.EditTrees._add", __pyx_clineno, __pyx_lineno, __pyx_filename); + __pyx_r = 0; + __pyx_L0:; + __Pyx_RefNannyFinishContext(); + return __pyx_r; +} + +/* "spacy/pipeline/_edit_tree_internals/edit_trees.pyx":108 + * return self._tree_id(tree) + * + * cdef uint32_t _tree_id(self, EditTreeC tree): # <<<<<<<<<<<<<< + * # If this tree has been constructed before, return its identifier. + * cdef hash_t hash = edittree_hash(tree) +*/ + +static uint32_t __pyx_f_5spacy_8pipeline_20_edit_tree_internals_10edit_trees_9EditTrees__tree_id(struct __pyx_obj_5spacy_8pipeline_20_edit_tree_internals_10edit_trees_EditTrees *__pyx_v_self, struct __pyx_t_5spacy_8pipeline_20_edit_tree_internals_10edit_trees_EditTreeC __pyx_v_tree) { + __pyx_t_5spacy_8typedefs_hash_t __pyx_v_hash; + std::unordered_map<__pyx_t_5spacy_8typedefs_hash_t,uint32_t> ::iterator __pyx_v_iter; + uint32_t __pyx_v_tree_id; + uint32_t __pyx_r; + uint64_t __pyx_t_1; + int __pyx_t_2; + std::pair<__pyx_t_5spacy_8typedefs_hash_t,uint32_t> __pyx_t_3; + int __pyx_lineno = 0; + const char *__pyx_filename = NULL; + int __pyx_clineno = 0; + + /* "spacy/pipeline/_edit_tree_internals/edit_trees.pyx":110 + * cdef uint32_t _tree_id(self, EditTreeC tree): + * # If this tree has been constructed before, return its identifier. + * cdef hash_t hash = edittree_hash(tree) # <<<<<<<<<<<<<< + * cdef unordered_map[hash_t, uint32_t].iterator iter = self.map.find(hash) + * if iter != self.map.end(): +*/ + __pyx_t_1 = __pyx_f_5spacy_8pipeline_20_edit_tree_internals_10edit_trees_edittree_hash(__pyx_v_tree); if (unlikely(__pyx_t_1 == ((uint64_t)-1LL) && PyErr_Occurred())) __PYX_ERR(0, 110, __pyx_L1_error) + __pyx_v_hash = __pyx_t_1; + + /* "spacy/pipeline/_edit_tree_internals/edit_trees.pyx":111 + * # If this tree has been constructed before, return its identifier. + * cdef hash_t hash = edittree_hash(tree) + * cdef unordered_map[hash_t, uint32_t].iterator iter = self.map.find(hash) # <<<<<<<<<<<<<< + * if iter != self.map.end(): + * return deref(iter).second +*/ + __pyx_v_iter = __pyx_v_self->map.find(__pyx_v_hash); + + /* "spacy/pipeline/_edit_tree_internals/edit_trees.pyx":112 + * cdef hash_t hash = edittree_hash(tree) + * cdef unordered_map[hash_t, uint32_t].iterator iter = self.map.find(hash) + * if iter != self.map.end(): # <<<<<<<<<<<<<< + * return deref(iter).second + * +*/ + __pyx_t_2 = (__pyx_v_iter != __pyx_v_self->map.end()); + if (__pyx_t_2) { + + /* "spacy/pipeline/_edit_tree_internals/edit_trees.pyx":113 + * cdef unordered_map[hash_t, uint32_t].iterator iter = self.map.find(hash) + * if iter != self.map.end(): + * return deref(iter).second # <<<<<<<<<<<<<< + * + * # The tree hasn't been seen before, store it. +*/ + __pyx_r = (*__pyx_v_iter).second; + goto __pyx_L0; + + /* "spacy/pipeline/_edit_tree_internals/edit_trees.pyx":112 + * cdef hash_t hash = edittree_hash(tree) + * cdef unordered_map[hash_t, uint32_t].iterator iter = self.map.find(hash) + * if iter != self.map.end(): # <<<<<<<<<<<<<< + * return deref(iter).second + * +*/ + } + + /* "spacy/pipeline/_edit_tree_internals/edit_trees.pyx":116 + * + * # The tree hasn't been seen before, store it. + * cdef uint32_t tree_id = self.trees.size() # <<<<<<<<<<<<<< + * self.trees.push_back(tree) + * self.map.insert(pair[hash_t, uint32_t](hash, tree_id)) +*/ + __pyx_v_tree_id = __pyx_v_self->trees.size(); + + /* "spacy/pipeline/_edit_tree_internals/edit_trees.pyx":117 + * # The tree hasn't been seen before, store it. + * cdef uint32_t tree_id = self.trees.size() + * self.trees.push_back(tree) # <<<<<<<<<<<<<< + * self.map.insert(pair[hash_t, uint32_t](hash, tree_id)) + * +*/ + try { + __pyx_v_self->trees.push_back(__pyx_v_tree); + } catch(...) { + __Pyx_CppExn2PyErr(); + __PYX_ERR(0, 117, __pyx_L1_error) + } + + /* "spacy/pipeline/_edit_tree_internals/edit_trees.pyx":118 + * cdef uint32_t tree_id = self.trees.size() + * self.trees.push_back(tree) + * self.map.insert(pair[hash_t, uint32_t](hash, tree_id)) # <<<<<<<<<<<<<< + * + * return tree_id +*/ + try { + __pyx_t_3 = std::pair<__pyx_t_5spacy_8typedefs_hash_t,uint32_t> (__pyx_v_hash, __pyx_v_tree_id); + } catch(...) { + __Pyx_CppExn2PyErr(); + __PYX_ERR(0, 118, __pyx_L1_error) + } + try { + __pyx_v_self->map.insert(__pyx_t_3); + } catch(...) { + __Pyx_CppExn2PyErr(); + __PYX_ERR(0, 118, __pyx_L1_error) + } + + /* "spacy/pipeline/_edit_tree_internals/edit_trees.pyx":120 + * self.map.insert(pair[hash_t, uint32_t](hash, tree_id)) + * + * return tree_id # <<<<<<<<<<<<<< + * + * cpdef str apply(self, uint32_t tree_id, str form): +*/ + __pyx_r = __pyx_v_tree_id; + goto __pyx_L0; + + /* "spacy/pipeline/_edit_tree_internals/edit_trees.pyx":108 + * return self._tree_id(tree) + * + * cdef uint32_t _tree_id(self, EditTreeC tree): # <<<<<<<<<<<<<< + * # If this tree has been constructed before, return its identifier. + * cdef hash_t hash = edittree_hash(tree) +*/ + + /* function exit code */ + __pyx_L1_error:; + __Pyx_AddTraceback("spacy.pipeline._edit_tree_internals.edit_trees.EditTrees._tree_id", __pyx_clineno, __pyx_lineno, __pyx_filename); + __pyx_r = 0; + __pyx_L0:; + return __pyx_r; +} + +/* "spacy/pipeline/_edit_tree_internals/edit_trees.pyx":122 + * return tree_id + * + * cpdef str apply(self, uint32_t tree_id, str form): # <<<<<<<<<<<<<< + * """Apply an edit tree to a form. + * +*/ + +static PyObject *__pyx_pw_5spacy_8pipeline_20_edit_tree_internals_10edit_trees_9EditTrees_5apply(PyObject *__pyx_v_self, +#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*/ +static PyObject *__pyx_f_5spacy_8pipeline_20_edit_tree_internals_10edit_trees_9EditTrees_apply(struct __pyx_obj_5spacy_8pipeline_20_edit_tree_internals_10edit_trees_EditTrees *__pyx_v_self, uint32_t __pyx_v_tree_id, PyObject *__pyx_v_form, int __pyx_skip_dispatch) { + PyObject *__pyx_v_lemma_pieces = NULL; + PyObject *__pyx_r = NULL; + __Pyx_RefNannyDeclarations + PyObject *__pyx_t_1 = NULL; + PyObject *__pyx_t_2 = NULL; + PyObject *__pyx_t_3 = NULL; + PyObject *__pyx_t_4 = NULL; + PyObject *__pyx_t_5 = NULL; + 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; + int __pyx_lineno = 0; + const char *__pyx_filename = NULL; + int __pyx_clineno = 0; + __Pyx_RefNannySetupContext("apply", 0); + /* Check if called by wrapper */ + if (unlikely(__pyx_skip_dispatch)) ; + /* Check if overridden in Python */ + else if ( + #if !CYTHON_USE_TYPE_SLOTS + unlikely(Py_TYPE(((PyObject *)__pyx_v_self)) != __pyx_mstate_global->__pyx_ptype_5spacy_8pipeline_20_edit_tree_internals_10edit_trees_EditTrees && + __Pyx_PyType_HasFeature(Py_TYPE(((PyObject *)__pyx_v_self)), Py_TPFLAGS_HAVE_GC)) + #else + unlikely(Py_TYPE(((PyObject *)__pyx_v_self))->tp_dictoffset != 0 || __Pyx_PyType_HasFeature(Py_TYPE(((PyObject *)__pyx_v_self)), (Py_TPFLAGS_IS_ABSTRACT | Py_TPFLAGS_HEAPTYPE))) + #endif + ) { + #if CYTHON_USE_DICT_VERSIONS && CYTHON_USE_PYTYPE_LOOKUP && CYTHON_USE_TYPE_SLOTS + static PY_UINT64_T __pyx_tp_dict_version = __PYX_DICT_VERSION_INIT, __pyx_obj_dict_version = __PYX_DICT_VERSION_INIT; + if (unlikely(!__Pyx_object_dict_version_matches(((PyObject *)__pyx_v_self), __pyx_tp_dict_version, __pyx_obj_dict_version))) { + PY_UINT64_T __pyx_typedict_guard = __Pyx_get_tp_dict_version(((PyObject *)__pyx_v_self)); + #endif + __pyx_t_1 = __Pyx_PyObject_GetAttrStr(((PyObject *)__pyx_v_self), __pyx_mstate_global->__pyx_n_u_apply); if (unlikely(!__pyx_t_1)) __PYX_ERR(0, 122, __pyx_L1_error) + __Pyx_GOTREF(__pyx_t_1); + if (!__Pyx_IsSameCFunction(__pyx_t_1, (void(*)(void)) __pyx_pw_5spacy_8pipeline_20_edit_tree_internals_10edit_trees_9EditTrees_5apply)) { + __Pyx_XDECREF(__pyx_r); + __pyx_t_3 = NULL; + __Pyx_INCREF(__pyx_t_1); + __pyx_t_4 = __pyx_t_1; + __pyx_t_5 = __Pyx_PyLong_From_uint32_t(__pyx_v_tree_id); if (unlikely(!__pyx_t_5)) __PYX_ERR(0, 122, __pyx_L1_error) + __Pyx_GOTREF(__pyx_t_5); + __pyx_t_6 = 1; + #if CYTHON_UNPACK_METHODS + if (unlikely(PyMethod_Check(__pyx_t_4))) { + __pyx_t_3 = PyMethod_GET_SELF(__pyx_t_4); + assert(__pyx_t_3); + PyObject* __pyx__function = PyMethod_GET_FUNCTION(__pyx_t_4); + __Pyx_INCREF(__pyx_t_3); + __Pyx_INCREF(__pyx__function); + __Pyx_DECREF_SET(__pyx_t_4, __pyx__function); + __pyx_t_6 = 0; + } + #endif + { + PyObject *__pyx_callargs[3] = {__pyx_t_3, __pyx_t_5, __pyx_v_form}; + __pyx_t_2 = __Pyx_PyObject_FastCall((PyObject*)__pyx_t_4, __pyx_callargs+__pyx_t_6, (3-__pyx_t_6) | (__pyx_t_6*__Pyx_PY_VECTORCALL_ARGUMENTS_OFFSET)); + __Pyx_XDECREF(__pyx_t_3); __pyx_t_3 = 0; + __Pyx_DECREF(__pyx_t_5); __pyx_t_5 = 0; + __Pyx_DECREF(__pyx_t_4); __pyx_t_4 = 0; + if (unlikely(!__pyx_t_2)) __PYX_ERR(0, 122, __pyx_L1_error) + __Pyx_GOTREF(__pyx_t_2); + } + if (!(likely(PyUnicode_CheckExact(__pyx_t_2))||((__pyx_t_2) == Py_None) || __Pyx_RaiseUnexpectedTypeError("str", __pyx_t_2))) __PYX_ERR(0, 122, __pyx_L1_error) + __pyx_r = ((PyObject*)__pyx_t_2); + __pyx_t_2 = 0; + __Pyx_DECREF(__pyx_t_1); __pyx_t_1 = 0; + goto __pyx_L0; + } + #if CYTHON_USE_DICT_VERSIONS && CYTHON_USE_PYTYPE_LOOKUP && CYTHON_USE_TYPE_SLOTS + __pyx_tp_dict_version = __Pyx_get_tp_dict_version(((PyObject *)__pyx_v_self)); + __pyx_obj_dict_version = __Pyx_get_object_dict_version(((PyObject *)__pyx_v_self)); + if (unlikely(__pyx_typedict_guard != __pyx_tp_dict_version)) { + __pyx_tp_dict_version = __pyx_obj_dict_version = __PYX_DICT_VERSION_INIT; + } + #endif + __Pyx_DECREF(__pyx_t_1); __pyx_t_1 = 0; + #if CYTHON_USE_DICT_VERSIONS && CYTHON_USE_PYTYPE_LOOKUP && CYTHON_USE_TYPE_SLOTS + } + #endif + } + + /* "spacy/pipeline/_edit_tree_internals/edit_trees.pyx":130 + * could not be applied to the form. + * """ + * if tree_id >= self.trees.size(): # <<<<<<<<<<<<<< + * raise IndexError(Errors.E1030) + * +*/ + __pyx_t_7 = (__pyx_v_tree_id >= __pyx_v_self->trees.size()); + if (unlikely(__pyx_t_7)) { + + /* "spacy/pipeline/_edit_tree_internals/edit_trees.pyx":131 + * """ + * if tree_id >= self.trees.size(): + * raise IndexError(Errors.E1030) # <<<<<<<<<<<<<< + * + * lemma_pieces = [] +*/ + __pyx_t_2 = NULL; + __Pyx_GetModuleGlobalName(__pyx_t_4, __pyx_mstate_global->__pyx_n_u_Errors); if (unlikely(!__pyx_t_4)) __PYX_ERR(0, 131, __pyx_L1_error) + __Pyx_GOTREF(__pyx_t_4); + __pyx_t_5 = __Pyx_PyObject_GetAttrStr(__pyx_t_4, __pyx_mstate_global->__pyx_n_u_E1030); if (unlikely(!__pyx_t_5)) __PYX_ERR(0, 131, __pyx_L1_error) + __Pyx_GOTREF(__pyx_t_5); + __Pyx_DECREF(__pyx_t_4); __pyx_t_4 = 0; + __pyx_t_6 = 1; + { + PyObject *__pyx_callargs[2] = {__pyx_t_2, __pyx_t_5}; + __pyx_t_1 = __Pyx_PyObject_FastCall((PyObject*)(((PyTypeObject*)PyExc_IndexError)), __pyx_callargs+__pyx_t_6, (2-__pyx_t_6) | (__pyx_t_6*__Pyx_PY_VECTORCALL_ARGUMENTS_OFFSET)); + __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, 131, __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, 131, __pyx_L1_error) + + /* "spacy/pipeline/_edit_tree_internals/edit_trees.pyx":130 + * could not be applied to the form. + * """ + * if tree_id >= self.trees.size(): # <<<<<<<<<<<<<< + * raise IndexError(Errors.E1030) + * +*/ + } + + /* "spacy/pipeline/_edit_tree_internals/edit_trees.pyx":133 + * raise IndexError(Errors.E1030) + * + * lemma_pieces = [] # <<<<<<<<<<<<<< + * try: + * self._apply(tree_id, form, lemma_pieces) +*/ + __pyx_t_1 = PyList_New(0); if (unlikely(!__pyx_t_1)) __PYX_ERR(0, 133, __pyx_L1_error) + __Pyx_GOTREF(__pyx_t_1); + __pyx_v_lemma_pieces = ((PyObject*)__pyx_t_1); + __pyx_t_1 = 0; + + /* "spacy/pipeline/_edit_tree_internals/edit_trees.pyx":134 + * + * lemma_pieces = [] + * try: # <<<<<<<<<<<<<< + * self._apply(tree_id, form, lemma_pieces) + * except ValueError: +*/ + { + __Pyx_PyThreadState_declare + __Pyx_PyThreadState_assign + __Pyx_ExceptionSave(&__pyx_t_8, &__pyx_t_9, &__pyx_t_10); + __Pyx_XGOTREF(__pyx_t_8); + __Pyx_XGOTREF(__pyx_t_9); + __Pyx_XGOTREF(__pyx_t_10); + /*try:*/ { + + /* "spacy/pipeline/_edit_tree_internals/edit_trees.pyx":135 + * lemma_pieces = [] + * try: + * self._apply(tree_id, form, lemma_pieces) # <<<<<<<<<<<<<< + * except ValueError: + * return None +*/ + __pyx_t_1 = ((struct __pyx_vtabstruct_5spacy_8pipeline_20_edit_tree_internals_10edit_trees_EditTrees *)__pyx_v_self->__pyx_vtab)->_apply(__pyx_v_self, __pyx_v_tree_id, __pyx_v_form, __pyx_v_lemma_pieces); if (unlikely(!__pyx_t_1)) __PYX_ERR(0, 135, __pyx_L4_error) + __Pyx_GOTREF(__pyx_t_1); + __Pyx_DECREF(__pyx_t_1); __pyx_t_1 = 0; + + /* "spacy/pipeline/_edit_tree_internals/edit_trees.pyx":134 + * + * lemma_pieces = [] + * try: # <<<<<<<<<<<<<< + * self._apply(tree_id, form, lemma_pieces) + * except ValueError: +*/ + } + __Pyx_XDECREF(__pyx_t_8); __pyx_t_8 = 0; + __Pyx_XDECREF(__pyx_t_9); __pyx_t_9 = 0; + __Pyx_XDECREF(__pyx_t_10); __pyx_t_10 = 0; + goto __pyx_L9_try_end; + __pyx_L4_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; + __Pyx_XDECREF(__pyx_t_4); __pyx_t_4 = 0; + __Pyx_XDECREF(__pyx_t_5); __pyx_t_5 = 0; + + /* "spacy/pipeline/_edit_tree_internals/edit_trees.pyx":136 + * try: + * self._apply(tree_id, form, lemma_pieces) + * except ValueError: # <<<<<<<<<<<<<< + * return None + * return "".join(lemma_pieces) +*/ + __pyx_t_11 = __Pyx_PyErr_ExceptionMatches(((PyObject *)(((PyTypeObject*)PyExc_ValueError)))); + if (__pyx_t_11) { + __Pyx_ErrRestore(0,0,0); + + /* "spacy/pipeline/_edit_tree_internals/edit_trees.pyx":137 + * self._apply(tree_id, form, lemma_pieces) + * except ValueError: + * return None # <<<<<<<<<<<<<< + * return "".join(lemma_pieces) + * +*/ + __Pyx_XDECREF(__pyx_r); + __pyx_r = ((PyObject*)Py_None); __Pyx_INCREF(Py_None); + goto __pyx_L7_except_return; + } + goto __pyx_L6_except_error; + + /* "spacy/pipeline/_edit_tree_internals/edit_trees.pyx":134 + * + * lemma_pieces = [] + * try: # <<<<<<<<<<<<<< + * self._apply(tree_id, form, lemma_pieces) + * except ValueError: +*/ + __pyx_L6_except_error:; + __Pyx_XGIVEREF(__pyx_t_8); + __Pyx_XGIVEREF(__pyx_t_9); + __Pyx_XGIVEREF(__pyx_t_10); + __Pyx_ExceptionReset(__pyx_t_8, __pyx_t_9, __pyx_t_10); + goto __pyx_L1_error; + __pyx_L7_except_return:; + __Pyx_XGIVEREF(__pyx_t_8); + __Pyx_XGIVEREF(__pyx_t_9); + __Pyx_XGIVEREF(__pyx_t_10); + __Pyx_ExceptionReset(__pyx_t_8, __pyx_t_9, __pyx_t_10); + goto __pyx_L0; + __pyx_L9_try_end:; + } + + /* "spacy/pipeline/_edit_tree_internals/edit_trees.pyx":138 + * except ValueError: + * return None + * return "".join(lemma_pieces) # <<<<<<<<<<<<<< + * + * cdef _apply(self, uint32_t tree_id, str form_part, list lemma_pieces): +*/ + __Pyx_XDECREF(__pyx_r); + __pyx_t_1 = PyUnicode_Join(__pyx_mstate_global->__pyx_kp_u_, __pyx_v_lemma_pieces); if (unlikely(!__pyx_t_1)) __PYX_ERR(0, 138, __pyx_L1_error) + __Pyx_GOTREF(__pyx_t_1); + __pyx_r = ((PyObject*)__pyx_t_1); + __pyx_t_1 = 0; + goto __pyx_L0; + + /* "spacy/pipeline/_edit_tree_internals/edit_trees.pyx":122 + * return tree_id + * + * cpdef str apply(self, uint32_t tree_id, str form): # <<<<<<<<<<<<<< + * """Apply an edit tree to a form. + * +*/ + + /* function exit code */ + __pyx_L1_error:; + __Pyx_XDECREF(__pyx_t_1); + __Pyx_XDECREF(__pyx_t_2); + __Pyx_XDECREF(__pyx_t_3); + __Pyx_XDECREF(__pyx_t_4); + __Pyx_XDECREF(__pyx_t_5); + __Pyx_AddTraceback("spacy.pipeline._edit_tree_internals.edit_trees.EditTrees.apply", __pyx_clineno, __pyx_lineno, __pyx_filename); + __pyx_r = 0; + __pyx_L0:; + __Pyx_XDECREF(__pyx_v_lemma_pieces); + __Pyx_XGIVEREF(__pyx_r); + __Pyx_RefNannyFinishContext(); + return __pyx_r; +} + +/* Python wrapper */ +static PyObject *__pyx_pw_5spacy_8pipeline_20_edit_tree_internals_10edit_trees_9EditTrees_5apply(PyObject *__pyx_v_self, +#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_5spacy_8pipeline_20_edit_tree_internals_10edit_trees_9EditTrees_4apply, "EditTrees.apply(self, uint32_t tree_id, str form) -> str\n\nApply an edit tree to a form.\n\ntree_id (uint32_t): the identifier of the edit tree to apply.\nform (str): the form to apply the edit tree to.\nRETURNS (str): the transformer form or None if the edit tree\n could not be applied to the form."); +static PyMethodDef __pyx_mdef_5spacy_8pipeline_20_edit_tree_internals_10edit_trees_9EditTrees_5apply = {"apply", (PyCFunction)(void(*)(void))(__Pyx_PyCFunction_FastCallWithKeywords)__pyx_pw_5spacy_8pipeline_20_edit_tree_internals_10edit_trees_9EditTrees_5apply, __Pyx_METH_FASTCALL|METH_KEYWORDS, __pyx_doc_5spacy_8pipeline_20_edit_tree_internals_10edit_trees_9EditTrees_4apply}; +static PyObject *__pyx_pw_5spacy_8pipeline_20_edit_tree_internals_10edit_trees_9EditTrees_5apply(PyObject *__pyx_v_self, +#if CYTHON_METH_FASTCALL +PyObject *const *__pyx_args, Py_ssize_t __pyx_nargs, PyObject *__pyx_kwds +#else +PyObject *__pyx_args, PyObject *__pyx_kwds +#endif +) { + uint32_t __pyx_v_tree_id; + PyObject *__pyx_v_form = 0; + #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("apply (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_tree_id,&__pyx_mstate_global->__pyx_n_u_form,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, 122, __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, 122, __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, 122, __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, "apply", 0) < (0)) __PYX_ERR(0, 122, __pyx_L3_error) + for (Py_ssize_t i = __pyx_nargs; i < 2; i++) { + if (unlikely(!values[i])) { __Pyx_RaiseArgtupleInvalid("apply", 1, 2, 2, i); __PYX_ERR(0, 122, __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, 122, __pyx_L3_error) + values[1] = __Pyx_ArgRef_FASTCALL(__pyx_args, 1); + if (!CYTHON_ASSUME_SAFE_MACROS && unlikely(!values[1])) __PYX_ERR(0, 122, __pyx_L3_error) + } + __pyx_v_tree_id = __Pyx_PyLong_As_uint32_t(values[0]); if (unlikely((__pyx_v_tree_id == ((uint32_t)-1)) && PyErr_Occurred())) __PYX_ERR(0, 122, __pyx_L3_error) + __pyx_v_form = ((PyObject*)values[1]); + } + goto __pyx_L6_skip; + __pyx_L5_argtuple_error:; + __Pyx_RaiseArgtupleInvalid("apply", 1, 2, 2, __pyx_nargs); __PYX_ERR(0, 122, __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("spacy.pipeline._edit_tree_internals.edit_trees.EditTrees.apply", __pyx_clineno, __pyx_lineno, __pyx_filename); + __Pyx_RefNannyFinishContext(); + return NULL; + __pyx_L4_argument_unpacking_done:; + if (unlikely(!__Pyx_ArgTypeTest(((PyObject *)__pyx_v_form), (&PyUnicode_Type), 1, "form", 1))) __PYX_ERR(0, 122, __pyx_L1_error) + __pyx_r = __pyx_pf_5spacy_8pipeline_20_edit_tree_internals_10edit_trees_9EditTrees_4apply(((struct __pyx_obj_5spacy_8pipeline_20_edit_tree_internals_10edit_trees_EditTrees *)__pyx_v_self), __pyx_v_tree_id, __pyx_v_form); + + /* 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_5spacy_8pipeline_20_edit_tree_internals_10edit_trees_9EditTrees_4apply(struct __pyx_obj_5spacy_8pipeline_20_edit_tree_internals_10edit_trees_EditTrees *__pyx_v_self, uint32_t __pyx_v_tree_id, PyObject *__pyx_v_form) { + 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("apply", 0); + __Pyx_XDECREF(__pyx_r); + __pyx_t_1 = __pyx_f_5spacy_8pipeline_20_edit_tree_internals_10edit_trees_9EditTrees_apply(__pyx_v_self, __pyx_v_tree_id, __pyx_v_form, 1); if (unlikely(!__pyx_t_1)) __PYX_ERR(0, 122, __pyx_L1_error) + __Pyx_GOTREF(__pyx_t_1); + __pyx_r = __pyx_t_1; + __pyx_t_1 = 0; + goto __pyx_L0; + + /* function exit code */ + __pyx_L1_error:; + __Pyx_XDECREF(__pyx_t_1); + __Pyx_AddTraceback("spacy.pipeline._edit_tree_internals.edit_trees.EditTrees.apply", __pyx_clineno, __pyx_lineno, __pyx_filename); + __pyx_r = NULL; + __pyx_L0:; + __Pyx_XGIVEREF(__pyx_r); + __Pyx_RefNannyFinishContext(); + return __pyx_r; +} + +/* "spacy/pipeline/_edit_tree_internals/edit_trees.pyx":140 + * return "".join(lemma_pieces) + * + * cdef _apply(self, uint32_t tree_id, str form_part, list lemma_pieces): # <<<<<<<<<<<<<< + * """Recursively apply an edit tree to a form, adding pieces to + * the lemma_pieces list.""" +*/ + +static PyObject *__pyx_f_5spacy_8pipeline_20_edit_tree_internals_10edit_trees_9EditTrees__apply(struct __pyx_obj_5spacy_8pipeline_20_edit_tree_internals_10edit_trees_EditTrees *__pyx_v_self, uint32_t __pyx_v_tree_id, PyObject *__pyx_v_form_part, PyObject *__pyx_v_lemma_pieces) { + struct __pyx_t_5spacy_8pipeline_20_edit_tree_internals_10edit_trees_EditTreeC __pyx_v_tree; + struct __pyx_t_5spacy_8pipeline_20_edit_tree_internals_10edit_trees_MatchNodeC __pyx_v_match_node; + int __pyx_v_suffix_start; + PyObject *__pyx_r = NULL; + __Pyx_RefNannyDeclarations + int __pyx_t_1; + struct __pyx_t_5spacy_8pipeline_20_edit_tree_internals_10edit_trees_MatchNodeC __pyx_t_2; + Py_ssize_t __pyx_t_3; + PyObject *__pyx_t_4 = NULL; + PyObject *__pyx_t_5 = NULL; + PyObject *__pyx_t_6 = NULL; + PyObject *__pyx_t_7 = NULL; + size_t __pyx_t_8; + int __pyx_t_9; + int __pyx_lineno = 0; + const char *__pyx_filename = NULL; + int __pyx_clineno = 0; + __Pyx_RefNannySetupContext("_apply", 0); + + /* "spacy/pipeline/_edit_tree_internals/edit_trees.pyx":143 + * """Recursively apply an edit tree to a form, adding pieces to + * the lemma_pieces list.""" + * assert tree_id <= self.trees.size() # <<<<<<<<<<<<<< + * + * cdef EditTreeC tree = self.trees[tree_id] +*/ + #ifndef CYTHON_WITHOUT_ASSERTIONS + if (unlikely(__pyx_assertions_enabled())) { + __pyx_t_1 = (__pyx_v_tree_id <= __pyx_v_self->trees.size()); + if (unlikely(!__pyx_t_1)) { + __Pyx_Raise(((PyObject *)(((PyTypeObject*)PyExc_AssertionError))), 0, 0, 0); + __PYX_ERR(0, 143, __pyx_L1_error) + } + } + #else + if ((1)); else __PYX_ERR(0, 143, __pyx_L1_error) + #endif + + /* "spacy/pipeline/_edit_tree_internals/edit_trees.pyx":145 + * assert tree_id <= self.trees.size() + * + * cdef EditTreeC tree = self.trees[tree_id] # <<<<<<<<<<<<<< + * cdef MatchNodeC match_node + * cdef int suffix_start +*/ + __pyx_v_tree = (__pyx_v_self->trees[__pyx_v_tree_id]); + + /* "spacy/pipeline/_edit_tree_internals/edit_trees.pyx":149 + * cdef int suffix_start + * + * if tree.is_match_node: # <<<<<<<<<<<<<< + * match_node = tree.inner.match_node + * +*/ + if (__pyx_v_tree.is_match_node) { + + /* "spacy/pipeline/_edit_tree_internals/edit_trees.pyx":150 + * + * if tree.is_match_node: + * match_node = tree.inner.match_node # <<<<<<<<<<<<<< + * + * if match_node.prefix_len + match_node.suffix_len > len(form_part): +*/ + __pyx_t_2 = __pyx_v_tree.inner.match_node; + __pyx_v_match_node = __pyx_t_2; + + /* "spacy/pipeline/_edit_tree_internals/edit_trees.pyx":152 + * match_node = tree.inner.match_node + * + * if match_node.prefix_len + match_node.suffix_len > len(form_part): # <<<<<<<<<<<<<< + * raise ValueError(Errors.E1029) + * +*/ + if (unlikely(__pyx_v_form_part == Py_None)) { + PyErr_SetString(PyExc_TypeError, "object of type 'NoneType' has no len()"); + __PYX_ERR(0, 152, __pyx_L1_error) + } + __pyx_t_3 = __Pyx_PyUnicode_GET_LENGTH(__pyx_v_form_part); if (unlikely(__pyx_t_3 == ((Py_ssize_t)-1))) __PYX_ERR(0, 152, __pyx_L1_error) + __pyx_t_1 = ((__pyx_v_match_node.prefix_len + __pyx_v_match_node.suffix_len) > __pyx_t_3); + if (unlikely(__pyx_t_1)) { + + /* "spacy/pipeline/_edit_tree_internals/edit_trees.pyx":153 + * + * if match_node.prefix_len + match_node.suffix_len > len(form_part): + * raise ValueError(Errors.E1029) # <<<<<<<<<<<<<< + * + * suffix_start = len(form_part) - match_node.suffix_len +*/ + __pyx_t_5 = NULL; + __Pyx_GetModuleGlobalName(__pyx_t_6, __pyx_mstate_global->__pyx_n_u_Errors); if (unlikely(!__pyx_t_6)) __PYX_ERR(0, 153, __pyx_L1_error) + __Pyx_GOTREF(__pyx_t_6); + __pyx_t_7 = __Pyx_PyObject_GetAttrStr(__pyx_t_6, __pyx_mstate_global->__pyx_n_u_E1029); if (unlikely(!__pyx_t_7)) __PYX_ERR(0, 153, __pyx_L1_error) + __Pyx_GOTREF(__pyx_t_7); + __Pyx_DECREF(__pyx_t_6); __pyx_t_6 = 0; + __pyx_t_8 = 1; + { + PyObject *__pyx_callargs[2] = {__pyx_t_5, __pyx_t_7}; + __pyx_t_4 = __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_5); __pyx_t_5 = 0; + __Pyx_DECREF(__pyx_t_7); __pyx_t_7 = 0; + if (unlikely(!__pyx_t_4)) __PYX_ERR(0, 153, __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, 153, __pyx_L1_error) + + /* "spacy/pipeline/_edit_tree_internals/edit_trees.pyx":152 + * match_node = tree.inner.match_node + * + * if match_node.prefix_len + match_node.suffix_len > len(form_part): # <<<<<<<<<<<<<< + * raise ValueError(Errors.E1029) + * +*/ + } + + /* "spacy/pipeline/_edit_tree_internals/edit_trees.pyx":155 + * raise ValueError(Errors.E1029) + * + * suffix_start = len(form_part) - match_node.suffix_len # <<<<<<<<<<<<<< + * + * if match_node.prefix_tree != NULL_TREE_ID: +*/ + if (unlikely(__pyx_v_form_part == Py_None)) { + PyErr_SetString(PyExc_TypeError, "object of type 'NoneType' has no len()"); + __PYX_ERR(0, 155, __pyx_L1_error) + } + __pyx_t_3 = __Pyx_PyUnicode_GET_LENGTH(__pyx_v_form_part); if (unlikely(__pyx_t_3 == ((Py_ssize_t)-1))) __PYX_ERR(0, 155, __pyx_L1_error) + __pyx_v_suffix_start = (__pyx_t_3 - __pyx_v_match_node.suffix_len); + + /* "spacy/pipeline/_edit_tree_internals/edit_trees.pyx":157 + * suffix_start = len(form_part) - match_node.suffix_len + * + * if match_node.prefix_tree != NULL_TREE_ID: # <<<<<<<<<<<<<< + * self._apply(match_node.prefix_tree, form_part[:match_node.prefix_len], lemma_pieces) + * +*/ + __pyx_t_1 = (__pyx_v_match_node.prefix_tree != __pyx_v_5spacy_8pipeline_20_edit_tree_internals_10edit_trees_NULL_TREE_ID); + if (__pyx_t_1) { + + /* "spacy/pipeline/_edit_tree_internals/edit_trees.pyx":158 + * + * if match_node.prefix_tree != NULL_TREE_ID: + * self._apply(match_node.prefix_tree, form_part[:match_node.prefix_len], lemma_pieces) # <<<<<<<<<<<<<< + * + * lemma_pieces.append(form_part[match_node.prefix_len:suffix_start]) +*/ + if (unlikely(__pyx_v_form_part == Py_None)) { + PyErr_SetString(PyExc_TypeError, "'NoneType' object is not subscriptable"); + __PYX_ERR(0, 158, __pyx_L1_error) + } + __pyx_t_4 = __Pyx_PyUnicode_Substring(__pyx_v_form_part, 0, __pyx_v_match_node.prefix_len); if (unlikely(!__pyx_t_4)) __PYX_ERR(0, 158, __pyx_L1_error) + __Pyx_GOTREF(__pyx_t_4); + __pyx_t_7 = ((struct __pyx_vtabstruct_5spacy_8pipeline_20_edit_tree_internals_10edit_trees_EditTrees *)__pyx_v_self->__pyx_vtab)->_apply(__pyx_v_self, __pyx_v_match_node.prefix_tree, ((PyObject*)__pyx_t_4), __pyx_v_lemma_pieces); if (unlikely(!__pyx_t_7)) __PYX_ERR(0, 158, __pyx_L1_error) + __Pyx_GOTREF(__pyx_t_7); + __Pyx_DECREF(__pyx_t_4); __pyx_t_4 = 0; + __Pyx_DECREF(__pyx_t_7); __pyx_t_7 = 0; + + /* "spacy/pipeline/_edit_tree_internals/edit_trees.pyx":157 + * suffix_start = len(form_part) - match_node.suffix_len + * + * if match_node.prefix_tree != NULL_TREE_ID: # <<<<<<<<<<<<<< + * self._apply(match_node.prefix_tree, form_part[:match_node.prefix_len], lemma_pieces) + * +*/ + } + + /* "spacy/pipeline/_edit_tree_internals/edit_trees.pyx":160 + * self._apply(match_node.prefix_tree, form_part[:match_node.prefix_len], lemma_pieces) + * + * lemma_pieces.append(form_part[match_node.prefix_len:suffix_start]) # <<<<<<<<<<<<<< + * + * if match_node.suffix_tree != NULL_TREE_ID: +*/ + if (unlikely(__pyx_v_lemma_pieces == Py_None)) { + PyErr_Format(PyExc_AttributeError, "'NoneType' object has no attribute '%.30s'", "append"); + __PYX_ERR(0, 160, __pyx_L1_error) + } + if (unlikely(__pyx_v_form_part == Py_None)) { + PyErr_SetString(PyExc_TypeError, "'NoneType' object is not subscriptable"); + __PYX_ERR(0, 160, __pyx_L1_error) + } + __pyx_t_7 = __Pyx_PyUnicode_Substring(__pyx_v_form_part, __pyx_v_match_node.prefix_len, __pyx_v_suffix_start); if (unlikely(!__pyx_t_7)) __PYX_ERR(0, 160, __pyx_L1_error) + __Pyx_GOTREF(__pyx_t_7); + __pyx_t_9 = __Pyx_PyList_Append(__pyx_v_lemma_pieces, __pyx_t_7); if (unlikely(__pyx_t_9 == ((int)-1))) __PYX_ERR(0, 160, __pyx_L1_error) + __Pyx_DECREF(__pyx_t_7); __pyx_t_7 = 0; + + /* "spacy/pipeline/_edit_tree_internals/edit_trees.pyx":162 + * lemma_pieces.append(form_part[match_node.prefix_len:suffix_start]) + * + * if match_node.suffix_tree != NULL_TREE_ID: # <<<<<<<<<<<<<< + * self._apply(match_node.suffix_tree, form_part[suffix_start:], lemma_pieces) + * else: +*/ + __pyx_t_1 = (__pyx_v_match_node.suffix_tree != __pyx_v_5spacy_8pipeline_20_edit_tree_internals_10edit_trees_NULL_TREE_ID); + if (__pyx_t_1) { + + /* "spacy/pipeline/_edit_tree_internals/edit_trees.pyx":163 + * + * if match_node.suffix_tree != NULL_TREE_ID: + * self._apply(match_node.suffix_tree, form_part[suffix_start:], lemma_pieces) # <<<<<<<<<<<<<< + * else: + * if form_part == self.strings[tree.inner.subst_node.orig]: +*/ + if (unlikely(__pyx_v_form_part == Py_None)) { + PyErr_SetString(PyExc_TypeError, "'NoneType' object is not subscriptable"); + __PYX_ERR(0, 163, __pyx_L1_error) + } + __pyx_t_7 = __Pyx_PyUnicode_Substring(__pyx_v_form_part, __pyx_v_suffix_start, PY_SSIZE_T_MAX); if (unlikely(!__pyx_t_7)) __PYX_ERR(0, 163, __pyx_L1_error) + __Pyx_GOTREF(__pyx_t_7); + __pyx_t_4 = ((struct __pyx_vtabstruct_5spacy_8pipeline_20_edit_tree_internals_10edit_trees_EditTrees *)__pyx_v_self->__pyx_vtab)->_apply(__pyx_v_self, __pyx_v_match_node.suffix_tree, ((PyObject*)__pyx_t_7), __pyx_v_lemma_pieces); if (unlikely(!__pyx_t_4)) __PYX_ERR(0, 163, __pyx_L1_error) + __Pyx_GOTREF(__pyx_t_4); + __Pyx_DECREF(__pyx_t_7); __pyx_t_7 = 0; + __Pyx_DECREF(__pyx_t_4); __pyx_t_4 = 0; + + /* "spacy/pipeline/_edit_tree_internals/edit_trees.pyx":162 + * lemma_pieces.append(form_part[match_node.prefix_len:suffix_start]) + * + * if match_node.suffix_tree != NULL_TREE_ID: # <<<<<<<<<<<<<< + * self._apply(match_node.suffix_tree, form_part[suffix_start:], lemma_pieces) + * else: +*/ + } + + /* "spacy/pipeline/_edit_tree_internals/edit_trees.pyx":149 + * cdef int suffix_start + * + * if tree.is_match_node: # <<<<<<<<<<<<<< + * match_node = tree.inner.match_node + * +*/ + goto __pyx_L3; + } + + /* "spacy/pipeline/_edit_tree_internals/edit_trees.pyx":165 + * self._apply(match_node.suffix_tree, form_part[suffix_start:], lemma_pieces) + * else: + * if form_part == self.strings[tree.inner.subst_node.orig]: # <<<<<<<<<<<<<< + * lemma_pieces.append(self.strings[tree.inner.subst_node.subst]) + * else: +*/ + /*else*/ { + __pyx_t_4 = __Pyx_GetItemInt(((PyObject *)__pyx_v_self->strings), __pyx_v_tree.inner.subst_node.orig, __pyx_t_5spacy_8typedefs_attr_t, 0, __Pyx_PyLong_From_uint64_t, 0, 0, 1, 1, __Pyx_ReferenceSharing_SharedReference); if (unlikely(!__pyx_t_4)) __PYX_ERR(0, 165, __pyx_L1_error) + __Pyx_GOTREF(__pyx_t_4); + __pyx_t_1 = (__Pyx_PyUnicode_Equals(__pyx_v_form_part, __pyx_t_4, Py_EQ)); if (unlikely((__pyx_t_1 < 0))) __PYX_ERR(0, 165, __pyx_L1_error) + __Pyx_DECREF(__pyx_t_4); __pyx_t_4 = 0; + if (likely(__pyx_t_1)) { + + /* "spacy/pipeline/_edit_tree_internals/edit_trees.pyx":166 + * else: + * if form_part == self.strings[tree.inner.subst_node.orig]: + * lemma_pieces.append(self.strings[tree.inner.subst_node.subst]) # <<<<<<<<<<<<<< + * else: + * raise ValueError(Errors.E1029) +*/ + if (unlikely(__pyx_v_lemma_pieces == Py_None)) { + PyErr_Format(PyExc_AttributeError, "'NoneType' object has no attribute '%.30s'", "append"); + __PYX_ERR(0, 166, __pyx_L1_error) + } + __pyx_t_4 = __Pyx_GetItemInt(((PyObject *)__pyx_v_self->strings), __pyx_v_tree.inner.subst_node.subst, __pyx_t_5spacy_8typedefs_attr_t, 0, __Pyx_PyLong_From_uint64_t, 0, 0, 1, 1, __Pyx_ReferenceSharing_SharedReference); if (unlikely(!__pyx_t_4)) __PYX_ERR(0, 166, __pyx_L1_error) + __Pyx_GOTREF(__pyx_t_4); + __pyx_t_9 = __Pyx_PyList_Append(__pyx_v_lemma_pieces, __pyx_t_4); if (unlikely(__pyx_t_9 == ((int)-1))) __PYX_ERR(0, 166, __pyx_L1_error) + __Pyx_DECREF(__pyx_t_4); __pyx_t_4 = 0; + + /* "spacy/pipeline/_edit_tree_internals/edit_trees.pyx":165 + * self._apply(match_node.suffix_tree, form_part[suffix_start:], lemma_pieces) + * else: + * if form_part == self.strings[tree.inner.subst_node.orig]: # <<<<<<<<<<<<<< + * lemma_pieces.append(self.strings[tree.inner.subst_node.subst]) + * else: +*/ + goto __pyx_L7; + } + + /* "spacy/pipeline/_edit_tree_internals/edit_trees.pyx":168 + * lemma_pieces.append(self.strings[tree.inner.subst_node.subst]) + * else: + * raise ValueError(Errors.E1029) # <<<<<<<<<<<<<< + * + * cpdef unicode tree_to_str(self, uint32_t tree_id): +*/ + /*else*/ { + __pyx_t_7 = NULL; + __Pyx_GetModuleGlobalName(__pyx_t_5, __pyx_mstate_global->__pyx_n_u_Errors); if (unlikely(!__pyx_t_5)) __PYX_ERR(0, 168, __pyx_L1_error) + __Pyx_GOTREF(__pyx_t_5); + __pyx_t_6 = __Pyx_PyObject_GetAttrStr(__pyx_t_5, __pyx_mstate_global->__pyx_n_u_E1029); if (unlikely(!__pyx_t_6)) __PYX_ERR(0, 168, __pyx_L1_error) + __Pyx_GOTREF(__pyx_t_6); + __Pyx_DECREF(__pyx_t_5); __pyx_t_5 = 0; + __pyx_t_8 = 1; + { + PyObject *__pyx_callargs[2] = {__pyx_t_7, __pyx_t_6}; + __pyx_t_4 = __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_7); __pyx_t_7 = 0; + __Pyx_DECREF(__pyx_t_6); __pyx_t_6 = 0; + if (unlikely(!__pyx_t_4)) __PYX_ERR(0, 168, __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, 168, __pyx_L1_error) + } + __pyx_L7:; + } + __pyx_L3:; + + /* "spacy/pipeline/_edit_tree_internals/edit_trees.pyx":140 + * return "".join(lemma_pieces) + * + * cdef _apply(self, uint32_t tree_id, str form_part, list lemma_pieces): # <<<<<<<<<<<<<< + * """Recursively apply an edit tree to a form, adding pieces to + * the lemma_pieces list.""" +*/ + + /* function exit code */ + __pyx_r = Py_None; __Pyx_INCREF(Py_None); + goto __pyx_L0; + __pyx_L1_error:; + __Pyx_XDECREF(__pyx_t_4); + __Pyx_XDECREF(__pyx_t_5); + __Pyx_XDECREF(__pyx_t_6); + __Pyx_XDECREF(__pyx_t_7); + __Pyx_AddTraceback("spacy.pipeline._edit_tree_internals.edit_trees.EditTrees._apply", __pyx_clineno, __pyx_lineno, __pyx_filename); + __pyx_r = 0; + __pyx_L0:; + __Pyx_XGIVEREF(__pyx_r); + __Pyx_RefNannyFinishContext(); + return __pyx_r; +} + +/* "spacy/pipeline/_edit_tree_internals/edit_trees.pyx":170 + * raise ValueError(Errors.E1029) + * + * cpdef unicode tree_to_str(self, uint32_t tree_id): # <<<<<<<<<<<<<< + * """Return the tree as a string. The tree tree string is formatted + * like an S-expression. This is primarily useful for debugging. Match +*/ + +static PyObject *__pyx_pw_5spacy_8pipeline_20_edit_tree_internals_10edit_trees_9EditTrees_7tree_to_str(PyObject *__pyx_v_self, +#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*/ +static PyObject *__pyx_f_5spacy_8pipeline_20_edit_tree_internals_10edit_trees_9EditTrees_tree_to_str(struct __pyx_obj_5spacy_8pipeline_20_edit_tree_internals_10edit_trees_EditTrees *__pyx_v_self, uint32_t __pyx_v_tree_id, int __pyx_skip_dispatch) { + struct __pyx_t_5spacy_8pipeline_20_edit_tree_internals_10edit_trees_EditTreeC __pyx_v_tree; + struct __pyx_t_5spacy_8pipeline_20_edit_tree_internals_10edit_trees_SubstNodeC __pyx_v_subst_node; + struct __pyx_t_5spacy_8pipeline_20_edit_tree_internals_10edit_trees_MatchNodeC __pyx_v_match_node; + PyObject *__pyx_v_prefix_tree = NULL; + PyObject *__pyx_v_suffix_tree = NULL; + PyObject *__pyx_r = NULL; + __Pyx_RefNannyDeclarations + PyObject *__pyx_t_1 = NULL; + PyObject *__pyx_t_2 = NULL; + PyObject *__pyx_t_3 = NULL; + PyObject *__pyx_t_4 = NULL; + PyObject *__pyx_t_5 = NULL; + size_t __pyx_t_6; + int __pyx_t_7; + struct __pyx_t_5spacy_8pipeline_20_edit_tree_internals_10edit_trees_SubstNodeC __pyx_t_8; + PyObject *__pyx_t_9[5]; + struct __pyx_t_5spacy_8pipeline_20_edit_tree_internals_10edit_trees_MatchNodeC __pyx_t_10; + PyObject *__pyx_t_11[9]; + int __pyx_lineno = 0; + const char *__pyx_filename = NULL; + int __pyx_clineno = 0; + __Pyx_RefNannySetupContext("tree_to_str", 0); + /* Check if called by wrapper */ + if (unlikely(__pyx_skip_dispatch)) ; + /* Check if overridden in Python */ + else if ( + #if !CYTHON_USE_TYPE_SLOTS + unlikely(Py_TYPE(((PyObject *)__pyx_v_self)) != __pyx_mstate_global->__pyx_ptype_5spacy_8pipeline_20_edit_tree_internals_10edit_trees_EditTrees && + __Pyx_PyType_HasFeature(Py_TYPE(((PyObject *)__pyx_v_self)), Py_TPFLAGS_HAVE_GC)) + #else + unlikely(Py_TYPE(((PyObject *)__pyx_v_self))->tp_dictoffset != 0 || __Pyx_PyType_HasFeature(Py_TYPE(((PyObject *)__pyx_v_self)), (Py_TPFLAGS_IS_ABSTRACT | Py_TPFLAGS_HEAPTYPE))) + #endif + ) { + #if CYTHON_USE_DICT_VERSIONS && CYTHON_USE_PYTYPE_LOOKUP && CYTHON_USE_TYPE_SLOTS + static PY_UINT64_T __pyx_tp_dict_version = __PYX_DICT_VERSION_INIT, __pyx_obj_dict_version = __PYX_DICT_VERSION_INIT; + if (unlikely(!__Pyx_object_dict_version_matches(((PyObject *)__pyx_v_self), __pyx_tp_dict_version, __pyx_obj_dict_version))) { + PY_UINT64_T __pyx_typedict_guard = __Pyx_get_tp_dict_version(((PyObject *)__pyx_v_self)); + #endif + __pyx_t_1 = __Pyx_PyObject_GetAttrStr(((PyObject *)__pyx_v_self), __pyx_mstate_global->__pyx_n_u_tree_to_str); if (unlikely(!__pyx_t_1)) __PYX_ERR(0, 170, __pyx_L1_error) + __Pyx_GOTREF(__pyx_t_1); + if (!__Pyx_IsSameCFunction(__pyx_t_1, (void(*)(void)) __pyx_pw_5spacy_8pipeline_20_edit_tree_internals_10edit_trees_9EditTrees_7tree_to_str)) { + __Pyx_XDECREF(__pyx_r); + __pyx_t_3 = NULL; + __Pyx_INCREF(__pyx_t_1); + __pyx_t_4 = __pyx_t_1; + __pyx_t_5 = __Pyx_PyLong_From_uint32_t(__pyx_v_tree_id); if (unlikely(!__pyx_t_5)) __PYX_ERR(0, 170, __pyx_L1_error) + __Pyx_GOTREF(__pyx_t_5); + __pyx_t_6 = 1; + #if CYTHON_UNPACK_METHODS + if (unlikely(PyMethod_Check(__pyx_t_4))) { + __pyx_t_3 = PyMethod_GET_SELF(__pyx_t_4); + assert(__pyx_t_3); + PyObject* __pyx__function = PyMethod_GET_FUNCTION(__pyx_t_4); + __Pyx_INCREF(__pyx_t_3); + __Pyx_INCREF(__pyx__function); + __Pyx_DECREF_SET(__pyx_t_4, __pyx__function); + __pyx_t_6 = 0; + } + #endif + { + PyObject *__pyx_callargs[2] = {__pyx_t_3, __pyx_t_5}; + __pyx_t_2 = __Pyx_PyObject_FastCall((PyObject*)__pyx_t_4, __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; + __Pyx_DECREF(__pyx_t_5); __pyx_t_5 = 0; + __Pyx_DECREF(__pyx_t_4); __pyx_t_4 = 0; + if (unlikely(!__pyx_t_2)) __PYX_ERR(0, 170, __pyx_L1_error) + __Pyx_GOTREF(__pyx_t_2); + } + if (!(likely(PyUnicode_CheckExact(__pyx_t_2))||((__pyx_t_2) == Py_None) || __Pyx_RaiseUnexpectedTypeError("str", __pyx_t_2))) __PYX_ERR(0, 170, __pyx_L1_error) + __pyx_r = ((PyObject*)__pyx_t_2); + __pyx_t_2 = 0; + __Pyx_DECREF(__pyx_t_1); __pyx_t_1 = 0; + goto __pyx_L0; + } + #if CYTHON_USE_DICT_VERSIONS && CYTHON_USE_PYTYPE_LOOKUP && CYTHON_USE_TYPE_SLOTS + __pyx_tp_dict_version = __Pyx_get_tp_dict_version(((PyObject *)__pyx_v_self)); + __pyx_obj_dict_version = __Pyx_get_object_dict_version(((PyObject *)__pyx_v_self)); + if (unlikely(__pyx_typedict_guard != __pyx_tp_dict_version)) { + __pyx_tp_dict_version = __pyx_obj_dict_version = __PYX_DICT_VERSION_INIT; + } + #endif + __Pyx_DECREF(__pyx_t_1); __pyx_t_1 = 0; + #if CYTHON_USE_DICT_VERSIONS && CYTHON_USE_PYTYPE_LOOKUP && CYTHON_USE_TYPE_SLOTS + } + #endif + } + + /* "spacy/pipeline/_edit_tree_internals/edit_trees.pyx":185 + * """ + * + * if tree_id >= self.trees.size(): # <<<<<<<<<<<<<< + * raise IndexError(Errors.E1030) + * +*/ + __pyx_t_7 = (__pyx_v_tree_id >= __pyx_v_self->trees.size()); + if (unlikely(__pyx_t_7)) { + + /* "spacy/pipeline/_edit_tree_internals/edit_trees.pyx":186 + * + * if tree_id >= self.trees.size(): + * raise IndexError(Errors.E1030) # <<<<<<<<<<<<<< + * + * cdef EditTreeC tree = self.trees[tree_id] +*/ + __pyx_t_2 = NULL; + __Pyx_GetModuleGlobalName(__pyx_t_4, __pyx_mstate_global->__pyx_n_u_Errors); if (unlikely(!__pyx_t_4)) __PYX_ERR(0, 186, __pyx_L1_error) + __Pyx_GOTREF(__pyx_t_4); + __pyx_t_5 = __Pyx_PyObject_GetAttrStr(__pyx_t_4, __pyx_mstate_global->__pyx_n_u_E1030); if (unlikely(!__pyx_t_5)) __PYX_ERR(0, 186, __pyx_L1_error) + __Pyx_GOTREF(__pyx_t_5); + __Pyx_DECREF(__pyx_t_4); __pyx_t_4 = 0; + __pyx_t_6 = 1; + { + PyObject *__pyx_callargs[2] = {__pyx_t_2, __pyx_t_5}; + __pyx_t_1 = __Pyx_PyObject_FastCall((PyObject*)(((PyTypeObject*)PyExc_IndexError)), __pyx_callargs+__pyx_t_6, (2-__pyx_t_6) | (__pyx_t_6*__Pyx_PY_VECTORCALL_ARGUMENTS_OFFSET)); + __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, 186, __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, 186, __pyx_L1_error) + + /* "spacy/pipeline/_edit_tree_internals/edit_trees.pyx":185 + * """ + * + * if tree_id >= self.trees.size(): # <<<<<<<<<<<<<< + * raise IndexError(Errors.E1030) + * +*/ + } + + /* "spacy/pipeline/_edit_tree_internals/edit_trees.pyx":188 + * raise IndexError(Errors.E1030) + * + * cdef EditTreeC tree = self.trees[tree_id] # <<<<<<<<<<<<<< + * cdef SubstNodeC subst_node + * +*/ + __pyx_v_tree = (__pyx_v_self->trees[__pyx_v_tree_id]); + + /* "spacy/pipeline/_edit_tree_internals/edit_trees.pyx":191 + * cdef SubstNodeC subst_node + * + * if not tree.is_match_node: # <<<<<<<<<<<<<< + * subst_node = tree.inner.subst_node + * return f"(s '{self.strings[subst_node.orig]}' '{self.strings[subst_node.subst]}')" +*/ + __pyx_t_7 = (!__pyx_v_tree.is_match_node); + if (__pyx_t_7) { + + /* "spacy/pipeline/_edit_tree_internals/edit_trees.pyx":192 + * + * if not tree.is_match_node: + * subst_node = tree.inner.subst_node # <<<<<<<<<<<<<< + * return f"(s '{self.strings[subst_node.orig]}' '{self.strings[subst_node.subst]}')" + * +*/ + __pyx_t_8 = __pyx_v_tree.inner.subst_node; + __pyx_v_subst_node = __pyx_t_8; + + /* "spacy/pipeline/_edit_tree_internals/edit_trees.pyx":193 + * if not tree.is_match_node: + * subst_node = tree.inner.subst_node + * return f"(s '{self.strings[subst_node.orig]}' '{self.strings[subst_node.subst]}')" # <<<<<<<<<<<<<< + * + * cdef MatchNodeC match_node = tree.inner.match_node +*/ + __Pyx_XDECREF(__pyx_r); + __pyx_t_1 = __Pyx_GetItemInt(((PyObject *)__pyx_v_self->strings), __pyx_v_subst_node.orig, __pyx_t_5spacy_8typedefs_attr_t, 0, __Pyx_PyLong_From_uint64_t, 0, 0, 1, 1, __Pyx_ReferenceSharing_SharedReference); if (unlikely(!__pyx_t_1)) __PYX_ERR(0, 193, __pyx_L1_error) + __Pyx_GOTREF(__pyx_t_1); + __pyx_t_5 = __Pyx_PyObject_FormatSimple(__pyx_t_1, __pyx_mstate_global->__pyx_empty_unicode); if (unlikely(!__pyx_t_5)) __PYX_ERR(0, 193, __pyx_L1_error) + __Pyx_GOTREF(__pyx_t_5); + __Pyx_DECREF(__pyx_t_1); __pyx_t_1 = 0; + __pyx_t_1 = __Pyx_GetItemInt(((PyObject *)__pyx_v_self->strings), __pyx_v_subst_node.subst, __pyx_t_5spacy_8typedefs_attr_t, 0, __Pyx_PyLong_From_uint64_t, 0, 0, 1, 1, __Pyx_ReferenceSharing_SharedReference); if (unlikely(!__pyx_t_1)) __PYX_ERR(0, 193, __pyx_L1_error) + __Pyx_GOTREF(__pyx_t_1); + __pyx_t_2 = __Pyx_PyObject_FormatSimple(__pyx_t_1, __pyx_mstate_global->__pyx_empty_unicode); if (unlikely(!__pyx_t_2)) __PYX_ERR(0, 193, __pyx_L1_error) + __Pyx_GOTREF(__pyx_t_2); + __Pyx_DECREF(__pyx_t_1); __pyx_t_1 = 0; + __pyx_t_9[0] = __pyx_mstate_global->__pyx_kp_u_s; + __pyx_t_9[1] = __pyx_t_5; + __pyx_t_9[2] = __pyx_mstate_global->__pyx_kp_u__2; + __pyx_t_9[3] = __pyx_t_2; + __pyx_t_9[4] = __pyx_mstate_global->__pyx_kp_u__3; + __pyx_t_1 = __Pyx_PyUnicode_Join(__pyx_t_9, 5, 4 + __Pyx_PyUnicode_GET_LENGTH(__pyx_t_5) + 3 + __Pyx_PyUnicode_GET_LENGTH(__pyx_t_2) + 2, 127 | __Pyx_PyUnicode_MAX_CHAR_VALUE(__pyx_t_5) | __Pyx_PyUnicode_MAX_CHAR_VALUE(__pyx_t_2)); + if (unlikely(!__pyx_t_1)) __PYX_ERR(0, 193, __pyx_L1_error) + __Pyx_GOTREF(__pyx_t_1); + __Pyx_DECREF(__pyx_t_5); __pyx_t_5 = 0; + __Pyx_DECREF(__pyx_t_2); __pyx_t_2 = 0; + __pyx_r = ((PyObject*)__pyx_t_1); + __pyx_t_1 = 0; + goto __pyx_L0; + + /* "spacy/pipeline/_edit_tree_internals/edit_trees.pyx":191 + * cdef SubstNodeC subst_node + * + * if not tree.is_match_node: # <<<<<<<<<<<<<< + * subst_node = tree.inner.subst_node + * return f"(s '{self.strings[subst_node.orig]}' '{self.strings[subst_node.subst]}')" +*/ + } + + /* "spacy/pipeline/_edit_tree_internals/edit_trees.pyx":195 + * return f"(s '{self.strings[subst_node.orig]}' '{self.strings[subst_node.subst]}')" + * + * cdef MatchNodeC match_node = tree.inner.match_node # <<<<<<<<<<<<<< + * + * prefix_tree = "()" +*/ + __pyx_t_10 = __pyx_v_tree.inner.match_node; + __pyx_v_match_node = __pyx_t_10; + + /* "spacy/pipeline/_edit_tree_internals/edit_trees.pyx":197 + * cdef MatchNodeC match_node = tree.inner.match_node + * + * prefix_tree = "()" # <<<<<<<<<<<<<< + * if match_node.prefix_tree != NULL_TREE_ID: + * prefix_tree = self.tree_to_str(match_node.prefix_tree) +*/ + __Pyx_INCREF(__pyx_mstate_global->__pyx_kp_u__4); + __pyx_v_prefix_tree = __pyx_mstate_global->__pyx_kp_u__4; + + /* "spacy/pipeline/_edit_tree_internals/edit_trees.pyx":198 + * + * prefix_tree = "()" + * if match_node.prefix_tree != NULL_TREE_ID: # <<<<<<<<<<<<<< + * prefix_tree = self.tree_to_str(match_node.prefix_tree) + * +*/ + __pyx_t_7 = (__pyx_v_match_node.prefix_tree != __pyx_v_5spacy_8pipeline_20_edit_tree_internals_10edit_trees_NULL_TREE_ID); + if (__pyx_t_7) { + + /* "spacy/pipeline/_edit_tree_internals/edit_trees.pyx":199 + * prefix_tree = "()" + * if match_node.prefix_tree != NULL_TREE_ID: + * prefix_tree = self.tree_to_str(match_node.prefix_tree) # <<<<<<<<<<<<<< + * + * suffix_tree = "()" +*/ + __pyx_t_1 = ((struct __pyx_vtabstruct_5spacy_8pipeline_20_edit_tree_internals_10edit_trees_EditTrees *)__pyx_v_self->__pyx_vtab)->tree_to_str(__pyx_v_self, __pyx_v_match_node.prefix_tree, 0); if (unlikely(!__pyx_t_1)) __PYX_ERR(0, 199, __pyx_L1_error) + __Pyx_GOTREF(__pyx_t_1); + __Pyx_DECREF_SET(__pyx_v_prefix_tree, ((PyObject*)__pyx_t_1)); + __pyx_t_1 = 0; + + /* "spacy/pipeline/_edit_tree_internals/edit_trees.pyx":198 + * + * prefix_tree = "()" + * if match_node.prefix_tree != NULL_TREE_ID: # <<<<<<<<<<<<<< + * prefix_tree = self.tree_to_str(match_node.prefix_tree) + * +*/ + } + + /* "spacy/pipeline/_edit_tree_internals/edit_trees.pyx":201 + * prefix_tree = self.tree_to_str(match_node.prefix_tree) + * + * suffix_tree = "()" # <<<<<<<<<<<<<< + * if match_node.suffix_tree != NULL_TREE_ID: + * suffix_tree = self.tree_to_str(match_node.suffix_tree) +*/ + __Pyx_INCREF(__pyx_mstate_global->__pyx_kp_u__4); + __pyx_v_suffix_tree = __pyx_mstate_global->__pyx_kp_u__4; + + /* "spacy/pipeline/_edit_tree_internals/edit_trees.pyx":202 + * + * suffix_tree = "()" + * if match_node.suffix_tree != NULL_TREE_ID: # <<<<<<<<<<<<<< + * suffix_tree = self.tree_to_str(match_node.suffix_tree) + * +*/ + __pyx_t_7 = (__pyx_v_match_node.suffix_tree != __pyx_v_5spacy_8pipeline_20_edit_tree_internals_10edit_trees_NULL_TREE_ID); + if (__pyx_t_7) { + + /* "spacy/pipeline/_edit_tree_internals/edit_trees.pyx":203 + * suffix_tree = "()" + * if match_node.suffix_tree != NULL_TREE_ID: + * suffix_tree = self.tree_to_str(match_node.suffix_tree) # <<<<<<<<<<<<<< + * + * return f"(m {match_node.prefix_len} {match_node.suffix_len} {prefix_tree} {suffix_tree})" +*/ + __pyx_t_1 = ((struct __pyx_vtabstruct_5spacy_8pipeline_20_edit_tree_internals_10edit_trees_EditTrees *)__pyx_v_self->__pyx_vtab)->tree_to_str(__pyx_v_self, __pyx_v_match_node.suffix_tree, 0); if (unlikely(!__pyx_t_1)) __PYX_ERR(0, 203, __pyx_L1_error) + __Pyx_GOTREF(__pyx_t_1); + __Pyx_DECREF_SET(__pyx_v_suffix_tree, ((PyObject*)__pyx_t_1)); + __pyx_t_1 = 0; + + /* "spacy/pipeline/_edit_tree_internals/edit_trees.pyx":202 + * + * suffix_tree = "()" + * if match_node.suffix_tree != NULL_TREE_ID: # <<<<<<<<<<<<<< + * suffix_tree = self.tree_to_str(match_node.suffix_tree) + * +*/ + } + + /* "spacy/pipeline/_edit_tree_internals/edit_trees.pyx":205 + * suffix_tree = self.tree_to_str(match_node.suffix_tree) + * + * return f"(m {match_node.prefix_len} {match_node.suffix_len} {prefix_tree} {suffix_tree})" # <<<<<<<<<<<<<< + * + * def from_json(self, trees: list) -> "EditTrees": +*/ + __Pyx_XDECREF(__pyx_r); + __pyx_t_1 = __Pyx_PyUnicode_From_uint16_t(__pyx_v_match_node.prefix_len, 0, ' ', 'd'); if (unlikely(!__pyx_t_1)) __PYX_ERR(0, 205, __pyx_L1_error) + __Pyx_GOTREF(__pyx_t_1); + __pyx_t_2 = __Pyx_PyUnicode_From_uint16_t(__pyx_v_match_node.suffix_len, 0, ' ', 'd'); if (unlikely(!__pyx_t_2)) __PYX_ERR(0, 205, __pyx_L1_error) + __Pyx_GOTREF(__pyx_t_2); + __pyx_t_5 = __Pyx_PyUnicode_Unicode(__pyx_v_prefix_tree); if (unlikely(!__pyx_t_5)) __PYX_ERR(0, 205, __pyx_L1_error) + __Pyx_GOTREF(__pyx_t_5); + __pyx_t_4 = __Pyx_PyUnicode_Unicode(__pyx_v_suffix_tree); if (unlikely(!__pyx_t_4)) __PYX_ERR(0, 205, __pyx_L1_error) + __Pyx_GOTREF(__pyx_t_4); + __pyx_t_11[0] = __pyx_mstate_global->__pyx_kp_u_m; + __pyx_t_11[1] = __pyx_t_1; + __pyx_t_11[2] = __pyx_mstate_global->__pyx_kp_u__5; + __pyx_t_11[3] = __pyx_t_2; + __pyx_t_11[4] = __pyx_mstate_global->__pyx_kp_u__5; + __pyx_t_11[5] = __pyx_t_5; + __pyx_t_11[6] = __pyx_mstate_global->__pyx_kp_u__5; + __pyx_t_11[7] = __pyx_t_4; + __pyx_t_11[8] = __pyx_mstate_global->__pyx_kp_u__6; + __pyx_t_3 = __Pyx_PyUnicode_Join(__pyx_t_11, 9, 3 + __Pyx_PyUnicode_GET_LENGTH(__pyx_t_1) + 1 * 4 + __Pyx_PyUnicode_GET_LENGTH(__pyx_t_2) + __Pyx_PyUnicode_GET_LENGTH(__pyx_t_5) + __Pyx_PyUnicode_GET_LENGTH(__pyx_t_4), 127 | __Pyx_PyUnicode_MAX_CHAR_VALUE(__pyx_t_5) | __Pyx_PyUnicode_MAX_CHAR_VALUE(__pyx_t_4)); + if (unlikely(!__pyx_t_3)) __PYX_ERR(0, 205, __pyx_L1_error) + __Pyx_GOTREF(__pyx_t_3); + __Pyx_DECREF(__pyx_t_1); __pyx_t_1 = 0; + __Pyx_DECREF(__pyx_t_2); __pyx_t_2 = 0; + __Pyx_DECREF(__pyx_t_5); __pyx_t_5 = 0; + __Pyx_DECREF(__pyx_t_4); __pyx_t_4 = 0; + __pyx_r = ((PyObject*)__pyx_t_3); + __pyx_t_3 = 0; + goto __pyx_L0; + + /* "spacy/pipeline/_edit_tree_internals/edit_trees.pyx":170 + * raise ValueError(Errors.E1029) + * + * cpdef unicode tree_to_str(self, uint32_t tree_id): # <<<<<<<<<<<<<< + * """Return the tree as a string. The tree tree string is formatted + * like an S-expression. This is primarily useful for debugging. Match +*/ + + /* function exit code */ + __pyx_L1_error:; + __Pyx_XDECREF(__pyx_t_1); + __Pyx_XDECREF(__pyx_t_2); + __Pyx_XDECREF(__pyx_t_3); + __Pyx_XDECREF(__pyx_t_4); + __Pyx_XDECREF(__pyx_t_5); + __Pyx_AddTraceback("spacy.pipeline._edit_tree_internals.edit_trees.EditTrees.tree_to_str", __pyx_clineno, __pyx_lineno, __pyx_filename); + __pyx_r = 0; + __pyx_L0:; + __Pyx_XDECREF(__pyx_v_prefix_tree); + __Pyx_XDECREF(__pyx_v_suffix_tree); + __Pyx_XGIVEREF(__pyx_r); + __Pyx_RefNannyFinishContext(); + return __pyx_r; +} + +/* Python wrapper */ +static PyObject *__pyx_pw_5spacy_8pipeline_20_edit_tree_internals_10edit_trees_9EditTrees_7tree_to_str(PyObject *__pyx_v_self, +#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_5spacy_8pipeline_20_edit_tree_internals_10edit_trees_9EditTrees_6tree_to_str, "EditTrees.tree_to_str(self, uint32_t tree_id) -> str\n\nReturn the tree as a string. The tree tree string is formatted\nlike an S-expression. This is primarily useful for debugging. Match\nnodes have the following format:\n\n(m prefix_len suffix_len prefix_tree suffix_tree)\n\nSubstitution nodes have the following format:\n\n(s original substitute)\n\ntree_id (uint32_t): the identifier of the edit tree.\nRETURNS (str): the tree as an S-expression."); +static PyMethodDef __pyx_mdef_5spacy_8pipeline_20_edit_tree_internals_10edit_trees_9EditTrees_7tree_to_str = {"tree_to_str", (PyCFunction)(void(*)(void))(__Pyx_PyCFunction_FastCallWithKeywords)__pyx_pw_5spacy_8pipeline_20_edit_tree_internals_10edit_trees_9EditTrees_7tree_to_str, __Pyx_METH_FASTCALL|METH_KEYWORDS, __pyx_doc_5spacy_8pipeline_20_edit_tree_internals_10edit_trees_9EditTrees_6tree_to_str}; +static PyObject *__pyx_pw_5spacy_8pipeline_20_edit_tree_internals_10edit_trees_9EditTrees_7tree_to_str(PyObject *__pyx_v_self, +#if CYTHON_METH_FASTCALL +PyObject *const *__pyx_args, Py_ssize_t __pyx_nargs, PyObject *__pyx_kwds +#else +PyObject *__pyx_args, PyObject *__pyx_kwds +#endif +) { + uint32_t __pyx_v_tree_id; + #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("tree_to_str (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_tree_id,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, 170, __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, 170, __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, "tree_to_str", 0) < (0)) __PYX_ERR(0, 170, __pyx_L3_error) + for (Py_ssize_t i = __pyx_nargs; i < 1; i++) { + if (unlikely(!values[i])) { __Pyx_RaiseArgtupleInvalid("tree_to_str", 1, 1, 1, i); __PYX_ERR(0, 170, __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, 170, __pyx_L3_error) + } + __pyx_v_tree_id = __Pyx_PyLong_As_uint32_t(values[0]); if (unlikely((__pyx_v_tree_id == ((uint32_t)-1)) && PyErr_Occurred())) __PYX_ERR(0, 170, __pyx_L3_error) + } + goto __pyx_L6_skip; + __pyx_L5_argtuple_error:; + __Pyx_RaiseArgtupleInvalid("tree_to_str", 1, 1, 1, __pyx_nargs); __PYX_ERR(0, 170, __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("spacy.pipeline._edit_tree_internals.edit_trees.EditTrees.tree_to_str", __pyx_clineno, __pyx_lineno, __pyx_filename); + __Pyx_RefNannyFinishContext(); + return NULL; + __pyx_L4_argument_unpacking_done:; + __pyx_r = __pyx_pf_5spacy_8pipeline_20_edit_tree_internals_10edit_trees_9EditTrees_6tree_to_str(((struct __pyx_obj_5spacy_8pipeline_20_edit_tree_internals_10edit_trees_EditTrees *)__pyx_v_self), __pyx_v_tree_id); + + /* 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_5spacy_8pipeline_20_edit_tree_internals_10edit_trees_9EditTrees_6tree_to_str(struct __pyx_obj_5spacy_8pipeline_20_edit_tree_internals_10edit_trees_EditTrees *__pyx_v_self, uint32_t __pyx_v_tree_id) { + 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("tree_to_str", 0); + __Pyx_XDECREF(__pyx_r); + __pyx_t_1 = __pyx_f_5spacy_8pipeline_20_edit_tree_internals_10edit_trees_9EditTrees_tree_to_str(__pyx_v_self, __pyx_v_tree_id, 1); if (unlikely(!__pyx_t_1)) __PYX_ERR(0, 170, __pyx_L1_error) + __Pyx_GOTREF(__pyx_t_1); + __pyx_r = __pyx_t_1; + __pyx_t_1 = 0; + goto __pyx_L0; + + /* function exit code */ + __pyx_L1_error:; + __Pyx_XDECREF(__pyx_t_1); + __Pyx_AddTraceback("spacy.pipeline._edit_tree_internals.edit_trees.EditTrees.tree_to_str", __pyx_clineno, __pyx_lineno, __pyx_filename); + __pyx_r = NULL; + __pyx_L0:; + __Pyx_XGIVEREF(__pyx_r); + __Pyx_RefNannyFinishContext(); + return __pyx_r; +} + +/* "spacy/pipeline/_edit_tree_internals/edit_trees.pyx":207 + * return f"(m {match_node.prefix_len} {match_node.suffix_len} {prefix_tree} {suffix_tree})" + * + * def from_json(self, trees: list) -> "EditTrees": # <<<<<<<<<<<<<< + * self.trees.clear() + * +*/ + +/* Python wrapper */ +static PyObject *__pyx_pw_5spacy_8pipeline_20_edit_tree_internals_10edit_trees_9EditTrees_9from_json(PyObject *__pyx_v_self, +#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_5spacy_8pipeline_20_edit_tree_internals_10edit_trees_9EditTrees_8from_json, "EditTrees.from_json(self, trees: list) -> 'EditTrees'"); +static PyMethodDef __pyx_mdef_5spacy_8pipeline_20_edit_tree_internals_10edit_trees_9EditTrees_9from_json = {"from_json", (PyCFunction)(void(*)(void))(__Pyx_PyCFunction_FastCallWithKeywords)__pyx_pw_5spacy_8pipeline_20_edit_tree_internals_10edit_trees_9EditTrees_9from_json, __Pyx_METH_FASTCALL|METH_KEYWORDS, __pyx_doc_5spacy_8pipeline_20_edit_tree_internals_10edit_trees_9EditTrees_8from_json}; +static PyObject *__pyx_pw_5spacy_8pipeline_20_edit_tree_internals_10edit_trees_9EditTrees_9from_json(PyObject *__pyx_v_self, +#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_trees = 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("from_json (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_trees,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, "from_json", 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("from_json", 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_trees = values[0]; + } + goto __pyx_L6_skip; + __pyx_L5_argtuple_error:; + __Pyx_RaiseArgtupleInvalid("from_json", 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("spacy.pipeline._edit_tree_internals.edit_trees.EditTrees.from_json", __pyx_clineno, __pyx_lineno, __pyx_filename); + __Pyx_RefNannyFinishContext(); + return NULL; + __pyx_L4_argument_unpacking_done:; + __pyx_r = __pyx_pf_5spacy_8pipeline_20_edit_tree_internals_10edit_trees_9EditTrees_8from_json(((struct __pyx_obj_5spacy_8pipeline_20_edit_tree_internals_10edit_trees_EditTrees *)__pyx_v_self), __pyx_v_trees); + + /* 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_5spacy_8pipeline_20_edit_tree_internals_10edit_trees_9EditTrees_8from_json(struct __pyx_obj_5spacy_8pipeline_20_edit_tree_internals_10edit_trees_EditTrees *__pyx_v_self, PyObject *__pyx_v_trees) { + PyObject *__pyx_v_tree = NULL; + PyObject *__pyx_r = NULL; + __Pyx_RefNannyDeclarations + PyObject *__pyx_t_1 = NULL; + Py_ssize_t __pyx_t_2; + PyObject *(*__pyx_t_3)(PyObject *); + PyObject *__pyx_t_4 = NULL; + PyObject *__pyx_t_5 = NULL; + PyObject *__pyx_t_6 = NULL; + size_t __pyx_t_7; + struct __pyx_t_5spacy_8pipeline_20_edit_tree_internals_10edit_trees_EditTreeC __pyx_t_8; + int __pyx_lineno = 0; + const char *__pyx_filename = NULL; + int __pyx_clineno = 0; + __Pyx_RefNannySetupContext("from_json", 0); + + /* "spacy/pipeline/_edit_tree_internals/edit_trees.pyx":208 + * + * def from_json(self, trees: list) -> "EditTrees": + * self.trees.clear() # <<<<<<<<<<<<<< + * + * for tree in trees: +*/ + __pyx_v_self->trees.clear(); + + /* "spacy/pipeline/_edit_tree_internals/edit_trees.pyx":210 + * self.trees.clear() + * + * for tree in trees: # <<<<<<<<<<<<<< + * tree = _dict2tree(tree) + * self.trees.push_back(tree) +*/ + if (likely(PyList_CheckExact(__pyx_v_trees)) || PyTuple_CheckExact(__pyx_v_trees)) { + __pyx_t_1 = __pyx_v_trees; __Pyx_INCREF(__pyx_t_1); + __pyx_t_2 = 0; + __pyx_t_3 = NULL; + } else { + __pyx_t_2 = -1; __pyx_t_1 = PyObject_GetIter(__pyx_v_trees); if (unlikely(!__pyx_t_1)) __PYX_ERR(0, 210, __pyx_L1_error) + __Pyx_GOTREF(__pyx_t_1); + __pyx_t_3 = (CYTHON_COMPILING_IN_LIMITED_API) ? PyIter_Next : __Pyx_PyObject_GetIterNextFunc(__pyx_t_1); if (unlikely(!__pyx_t_3)) __PYX_ERR(0, 210, __pyx_L1_error) + } + for (;;) { + if (likely(!__pyx_t_3)) { + if (likely(PyList_CheckExact(__pyx_t_1))) { + { + Py_ssize_t __pyx_temp = __Pyx_PyList_GET_SIZE(__pyx_t_1); + #if !CYTHON_ASSUME_SAFE_SIZE + if (unlikely((__pyx_temp < 0))) __PYX_ERR(0, 210, __pyx_L1_error) + #endif + if (__pyx_t_2 >= __pyx_temp) break; + } + __pyx_t_4 = __Pyx_PyList_GetItemRefFast(__pyx_t_1, __pyx_t_2, __Pyx_ReferenceSharing_OwnStrongReference); + ++__pyx_t_2; + } else { + { + Py_ssize_t __pyx_temp = __Pyx_PyTuple_GET_SIZE(__pyx_t_1); + #if !CYTHON_ASSUME_SAFE_SIZE + if (unlikely((__pyx_temp < 0))) __PYX_ERR(0, 210, __pyx_L1_error) + #endif + if (__pyx_t_2 >= __pyx_temp) break; + } + #if CYTHON_ASSUME_SAFE_MACROS && !CYTHON_AVOID_BORROWED_REFS + __pyx_t_4 = __Pyx_NewRef(PyTuple_GET_ITEM(__pyx_t_1, __pyx_t_2)); + #else + __pyx_t_4 = __Pyx_PySequence_ITEM(__pyx_t_1, __pyx_t_2); + #endif + ++__pyx_t_2; + } + if (unlikely(!__pyx_t_4)) __PYX_ERR(0, 210, __pyx_L1_error) + } else { + __pyx_t_4 = __pyx_t_3(__pyx_t_1); + if (unlikely(!__pyx_t_4)) { + PyObject* exc_type = PyErr_Occurred(); + if (exc_type) { + if (unlikely(!__Pyx_PyErr_GivenExceptionMatches(exc_type, PyExc_StopIteration))) __PYX_ERR(0, 210, __pyx_L1_error) + PyErr_Clear(); + } + break; + } + } + __Pyx_GOTREF(__pyx_t_4); + __Pyx_XDECREF_SET(__pyx_v_tree, __pyx_t_4); + __pyx_t_4 = 0; + + /* "spacy/pipeline/_edit_tree_internals/edit_trees.pyx":211 + * + * for tree in trees: + * tree = _dict2tree(tree) # <<<<<<<<<<<<<< + * self.trees.push_back(tree) + * +*/ + __pyx_t_5 = NULL; + __Pyx_GetModuleGlobalName(__pyx_t_6, __pyx_mstate_global->__pyx_n_u_dict2tree); if (unlikely(!__pyx_t_6)) __PYX_ERR(0, 211, __pyx_L1_error) + __Pyx_GOTREF(__pyx_t_6); + __pyx_t_7 = 1; + #if CYTHON_UNPACK_METHODS + if (unlikely(PyMethod_Check(__pyx_t_6))) { + __pyx_t_5 = PyMethod_GET_SELF(__pyx_t_6); + assert(__pyx_t_5); + PyObject* __pyx__function = PyMethod_GET_FUNCTION(__pyx_t_6); + __Pyx_INCREF(__pyx_t_5); + __Pyx_INCREF(__pyx__function); + __Pyx_DECREF_SET(__pyx_t_6, __pyx__function); + __pyx_t_7 = 0; + } + #endif + { + PyObject *__pyx_callargs[2] = {__pyx_t_5, __pyx_v_tree}; + __pyx_t_4 = __Pyx_PyObject_FastCall((PyObject*)__pyx_t_6, __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; + __Pyx_DECREF(__pyx_t_6); __pyx_t_6 = 0; + if (unlikely(!__pyx_t_4)) __PYX_ERR(0, 211, __pyx_L1_error) + __Pyx_GOTREF(__pyx_t_4); + } + __Pyx_DECREF_SET(__pyx_v_tree, __pyx_t_4); + __pyx_t_4 = 0; + + /* "spacy/pipeline/_edit_tree_internals/edit_trees.pyx":212 + * for tree in trees: + * tree = _dict2tree(tree) + * self.trees.push_back(tree) # <<<<<<<<<<<<<< + * + * self._rebuild_tree_map() +*/ + __pyx_t_8 = __pyx_convert__from_py_struct____pyx_t_5spacy_8pipeline_20_edit_tree_internals_10edit_trees_EditTreeC(__pyx_v_tree); if (unlikely(PyErr_Occurred())) __PYX_ERR(0, 212, __pyx_L1_error) + try { + __pyx_v_self->trees.push_back(__pyx_t_8); + } catch(...) { + __Pyx_CppExn2PyErr(); + __PYX_ERR(0, 212, __pyx_L1_error) + } + + /* "spacy/pipeline/_edit_tree_internals/edit_trees.pyx":210 + * self.trees.clear() + * + * for tree in trees: # <<<<<<<<<<<<<< + * tree = _dict2tree(tree) + * self.trees.push_back(tree) +*/ + } + __Pyx_DECREF(__pyx_t_1); __pyx_t_1 = 0; + + /* "spacy/pipeline/_edit_tree_internals/edit_trees.pyx":214 + * self.trees.push_back(tree) + * + * self._rebuild_tree_map() # <<<<<<<<<<<<<< + * + * def from_bytes(self, bytes_data: bytes, *) -> "EditTrees": +*/ + __pyx_t_4 = ((PyObject *)__pyx_v_self); + __Pyx_INCREF(__pyx_t_4); + __pyx_t_7 = 0; + { + PyObject *__pyx_callargs[2] = {__pyx_t_4, NULL}; + __pyx_t_1 = __Pyx_PyObject_FastCallMethod((PyObject*)__pyx_mstate_global->__pyx_n_u_rebuild_tree_map, __pyx_callargs+__pyx_t_7, (1-__pyx_t_7) | (1*__Pyx_PY_VECTORCALL_ARGUMENTS_OFFSET)); + __Pyx_XDECREF(__pyx_t_4); __pyx_t_4 = 0; + if (unlikely(!__pyx_t_1)) __PYX_ERR(0, 214, __pyx_L1_error) + __Pyx_GOTREF(__pyx_t_1); + } + __Pyx_DECREF(__pyx_t_1); __pyx_t_1 = 0; + + /* "spacy/pipeline/_edit_tree_internals/edit_trees.pyx":207 + * return f"(m {match_node.prefix_len} {match_node.suffix_len} {prefix_tree} {suffix_tree})" + * + * def from_json(self, trees: list) -> "EditTrees": # <<<<<<<<<<<<<< + * self.trees.clear() + * +*/ + + /* function exit code */ + __pyx_r = Py_None; __Pyx_INCREF(Py_None); + goto __pyx_L0; + __pyx_L1_error:; + __Pyx_XDECREF(__pyx_t_1); + __Pyx_XDECREF(__pyx_t_4); + __Pyx_XDECREF(__pyx_t_5); + __Pyx_XDECREF(__pyx_t_6); + __Pyx_AddTraceback("spacy.pipeline._edit_tree_internals.edit_trees.EditTrees.from_json", __pyx_clineno, __pyx_lineno, __pyx_filename); + __pyx_r = NULL; + __pyx_L0:; + __Pyx_XDECREF(__pyx_v_tree); + __Pyx_XGIVEREF(__pyx_r); + __Pyx_RefNannyFinishContext(); + return __pyx_r; +} + +/* "spacy/pipeline/_edit_tree_internals/edit_trees.pyx":216 + * self._rebuild_tree_map() + * + * def from_bytes(self, bytes_data: bytes, *) -> "EditTrees": # <<<<<<<<<<<<<< + * def deserialize_trees(tree_dicts): + * cdef EditTreeC c_tree +*/ + +/* Python wrapper */ +static PyObject *__pyx_pw_5spacy_8pipeline_20_edit_tree_internals_10edit_trees_9EditTrees_11from_bytes(PyObject *__pyx_v_self, +#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_5spacy_8pipeline_20_edit_tree_internals_10edit_trees_9EditTrees_10from_bytes, "EditTrees.from_bytes(self, bytes_data: bytes) -> 'EditTrees'"); +static PyMethodDef __pyx_mdef_5spacy_8pipeline_20_edit_tree_internals_10edit_trees_9EditTrees_11from_bytes = {"from_bytes", (PyCFunction)(void(*)(void))(__Pyx_PyCFunction_FastCallWithKeywords)__pyx_pw_5spacy_8pipeline_20_edit_tree_internals_10edit_trees_9EditTrees_11from_bytes, __Pyx_METH_FASTCALL|METH_KEYWORDS, __pyx_doc_5spacy_8pipeline_20_edit_tree_internals_10edit_trees_9EditTrees_10from_bytes}; +static PyObject *__pyx_pw_5spacy_8pipeline_20_edit_tree_internals_10edit_trees_9EditTrees_11from_bytes(PyObject *__pyx_v_self, +#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_bytes_data = 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("from_bytes (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_bytes_data,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, 216, __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, 216, __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, "from_bytes", 0) < (0)) __PYX_ERR(0, 216, __pyx_L3_error) + for (Py_ssize_t i = __pyx_nargs; i < 1; i++) { + if (unlikely(!values[i])) { __Pyx_RaiseArgtupleInvalid("from_bytes", 1, 1, 1, i); __PYX_ERR(0, 216, __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, 216, __pyx_L3_error) + } + __pyx_v_bytes_data = values[0]; + } + goto __pyx_L6_skip; + __pyx_L5_argtuple_error:; + __Pyx_RaiseArgtupleInvalid("from_bytes", 1, 1, 1, __pyx_nargs); __PYX_ERR(0, 216, __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("spacy.pipeline._edit_tree_internals.edit_trees.EditTrees.from_bytes", __pyx_clineno, __pyx_lineno, __pyx_filename); + __Pyx_RefNannyFinishContext(); + return NULL; + __pyx_L4_argument_unpacking_done:; + __pyx_r = __pyx_pf_5spacy_8pipeline_20_edit_tree_internals_10edit_trees_9EditTrees_10from_bytes(((struct __pyx_obj_5spacy_8pipeline_20_edit_tree_internals_10edit_trees_EditTrees *)__pyx_v_self), __pyx_v_bytes_data); + + /* 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; +} + +/* "spacy/pipeline/_edit_tree_internals/edit_trees.pyx":217 + * + * def from_bytes(self, bytes_data: bytes, *) -> "EditTrees": + * def deserialize_trees(tree_dicts): # <<<<<<<<<<<<<< + * cdef EditTreeC c_tree + * for tree_dict in tree_dicts: +*/ + +/* Python wrapper */ +static PyObject *__pyx_pw_5spacy_8pipeline_20_edit_tree_internals_10edit_trees_9EditTrees_10from_bytes_1deserialize_trees(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*/ +static PyMethodDef __pyx_mdef_5spacy_8pipeline_20_edit_tree_internals_10edit_trees_9EditTrees_10from_bytes_1deserialize_trees = {"deserialize_trees", (PyCFunction)(void(*)(void))(__Pyx_PyCFunction_FastCallWithKeywords)__pyx_pw_5spacy_8pipeline_20_edit_tree_internals_10edit_trees_9EditTrees_10from_bytes_1deserialize_trees, __Pyx_METH_FASTCALL|METH_KEYWORDS, 0}; +static PyObject *__pyx_pw_5spacy_8pipeline_20_edit_tree_internals_10edit_trees_9EditTrees_10from_bytes_1deserialize_trees(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 +) { + PyObject *__pyx_v_tree_dicts = 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("deserialize_trees (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_tree_dicts,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, 217, __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, 217, __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, "deserialize_trees", 0) < (0)) __PYX_ERR(0, 217, __pyx_L3_error) + for (Py_ssize_t i = __pyx_nargs; i < 1; i++) { + if (unlikely(!values[i])) { __Pyx_RaiseArgtupleInvalid("deserialize_trees", 1, 1, 1, i); __PYX_ERR(0, 217, __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, 217, __pyx_L3_error) + } + __pyx_v_tree_dicts = values[0]; + } + goto __pyx_L6_skip; + __pyx_L5_argtuple_error:; + __Pyx_RaiseArgtupleInvalid("deserialize_trees", 1, 1, 1, __pyx_nargs); __PYX_ERR(0, 217, __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("spacy.pipeline._edit_tree_internals.edit_trees.EditTrees.from_bytes.deserialize_trees", __pyx_clineno, __pyx_lineno, __pyx_filename); + __Pyx_RefNannyFinishContext(); + return NULL; + __pyx_L4_argument_unpacking_done:; + __pyx_r = __pyx_pf_5spacy_8pipeline_20_edit_tree_internals_10edit_trees_9EditTrees_10from_bytes_deserialize_trees(__pyx_self, __pyx_v_tree_dicts); + + /* 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_5spacy_8pipeline_20_edit_tree_internals_10edit_trees_9EditTrees_10from_bytes_deserialize_trees(PyObject *__pyx_self, PyObject *__pyx_v_tree_dicts) { + struct __pyx_obj_5spacy_8pipeline_20_edit_tree_internals_10edit_trees___pyx_scope_struct__from_bytes *__pyx_cur_scope; + struct __pyx_obj_5spacy_8pipeline_20_edit_tree_internals_10edit_trees___pyx_scope_struct__from_bytes *__pyx_outer_scope; + struct __pyx_t_5spacy_8pipeline_20_edit_tree_internals_10edit_trees_EditTreeC __pyx_v_c_tree; + PyObject *__pyx_v_tree_dict = NULL; + PyObject *__pyx_r = NULL; + __Pyx_RefNannyDeclarations + PyObject *__pyx_t_1 = NULL; + Py_ssize_t __pyx_t_2; + PyObject *(*__pyx_t_3)(PyObject *); + PyObject *__pyx_t_4 = NULL; + PyObject *__pyx_t_5 = NULL; + PyObject *__pyx_t_6 = NULL; + size_t __pyx_t_7; + struct __pyx_t_5spacy_8pipeline_20_edit_tree_internals_10edit_trees_EditTreeC __pyx_t_8; + int __pyx_lineno = 0; + const char *__pyx_filename = NULL; + int __pyx_clineno = 0; + __Pyx_RefNannySetupContext("deserialize_trees", 0); + __pyx_outer_scope = (struct __pyx_obj_5spacy_8pipeline_20_edit_tree_internals_10edit_trees___pyx_scope_struct__from_bytes *) __Pyx_CyFunction_GetClosure(__pyx_self); + __pyx_cur_scope = __pyx_outer_scope; + + /* "spacy/pipeline/_edit_tree_internals/edit_trees.pyx":219 + * def deserialize_trees(tree_dicts): + * cdef EditTreeC c_tree + * for tree_dict in tree_dicts: # <<<<<<<<<<<<<< + * c_tree = _dict2tree(tree_dict) + * self.trees.push_back(c_tree) +*/ + if (likely(PyList_CheckExact(__pyx_v_tree_dicts)) || PyTuple_CheckExact(__pyx_v_tree_dicts)) { + __pyx_t_1 = __pyx_v_tree_dicts; __Pyx_INCREF(__pyx_t_1); + __pyx_t_2 = 0; + __pyx_t_3 = NULL; + } else { + __pyx_t_2 = -1; __pyx_t_1 = PyObject_GetIter(__pyx_v_tree_dicts); if (unlikely(!__pyx_t_1)) __PYX_ERR(0, 219, __pyx_L1_error) + __Pyx_GOTREF(__pyx_t_1); + __pyx_t_3 = (CYTHON_COMPILING_IN_LIMITED_API) ? PyIter_Next : __Pyx_PyObject_GetIterNextFunc(__pyx_t_1); if (unlikely(!__pyx_t_3)) __PYX_ERR(0, 219, __pyx_L1_error) + } + for (;;) { + if (likely(!__pyx_t_3)) { + if (likely(PyList_CheckExact(__pyx_t_1))) { + { + Py_ssize_t __pyx_temp = __Pyx_PyList_GET_SIZE(__pyx_t_1); + #if !CYTHON_ASSUME_SAFE_SIZE + if (unlikely((__pyx_temp < 0))) __PYX_ERR(0, 219, __pyx_L1_error) + #endif + if (__pyx_t_2 >= __pyx_temp) break; + } + __pyx_t_4 = __Pyx_PyList_GetItemRefFast(__pyx_t_1, __pyx_t_2, __Pyx_ReferenceSharing_OwnStrongReference); + ++__pyx_t_2; + } else { + { + Py_ssize_t __pyx_temp = __Pyx_PyTuple_GET_SIZE(__pyx_t_1); + #if !CYTHON_ASSUME_SAFE_SIZE + if (unlikely((__pyx_temp < 0))) __PYX_ERR(0, 219, __pyx_L1_error) + #endif + if (__pyx_t_2 >= __pyx_temp) break; + } + #if CYTHON_ASSUME_SAFE_MACROS && !CYTHON_AVOID_BORROWED_REFS + __pyx_t_4 = __Pyx_NewRef(PyTuple_GET_ITEM(__pyx_t_1, __pyx_t_2)); + #else + __pyx_t_4 = __Pyx_PySequence_ITEM(__pyx_t_1, __pyx_t_2); + #endif + ++__pyx_t_2; + } + if (unlikely(!__pyx_t_4)) __PYX_ERR(0, 219, __pyx_L1_error) + } else { + __pyx_t_4 = __pyx_t_3(__pyx_t_1); + if (unlikely(!__pyx_t_4)) { + PyObject* exc_type = PyErr_Occurred(); + if (exc_type) { + if (unlikely(!__Pyx_PyErr_GivenExceptionMatches(exc_type, PyExc_StopIteration))) __PYX_ERR(0, 219, __pyx_L1_error) + PyErr_Clear(); + } + break; + } + } + __Pyx_GOTREF(__pyx_t_4); + __Pyx_XDECREF_SET(__pyx_v_tree_dict, __pyx_t_4); + __pyx_t_4 = 0; + + /* "spacy/pipeline/_edit_tree_internals/edit_trees.pyx":220 + * cdef EditTreeC c_tree + * for tree_dict in tree_dicts: + * c_tree = _dict2tree(tree_dict) # <<<<<<<<<<<<<< + * self.trees.push_back(c_tree) + * +*/ + __pyx_t_5 = NULL; + __Pyx_GetModuleGlobalName(__pyx_t_6, __pyx_mstate_global->__pyx_n_u_dict2tree); if (unlikely(!__pyx_t_6)) __PYX_ERR(0, 220, __pyx_L1_error) + __Pyx_GOTREF(__pyx_t_6); + __pyx_t_7 = 1; + #if CYTHON_UNPACK_METHODS + if (unlikely(PyMethod_Check(__pyx_t_6))) { + __pyx_t_5 = PyMethod_GET_SELF(__pyx_t_6); + assert(__pyx_t_5); + PyObject* __pyx__function = PyMethod_GET_FUNCTION(__pyx_t_6); + __Pyx_INCREF(__pyx_t_5); + __Pyx_INCREF(__pyx__function); + __Pyx_DECREF_SET(__pyx_t_6, __pyx__function); + __pyx_t_7 = 0; + } + #endif + { + PyObject *__pyx_callargs[2] = {__pyx_t_5, __pyx_v_tree_dict}; + __pyx_t_4 = __Pyx_PyObject_FastCall((PyObject*)__pyx_t_6, __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; + __Pyx_DECREF(__pyx_t_6); __pyx_t_6 = 0; + if (unlikely(!__pyx_t_4)) __PYX_ERR(0, 220, __pyx_L1_error) + __Pyx_GOTREF(__pyx_t_4); + } + __pyx_t_8 = __pyx_convert__from_py_struct____pyx_t_5spacy_8pipeline_20_edit_tree_internals_10edit_trees_EditTreeC(__pyx_t_4); if (unlikely(PyErr_Occurred())) __PYX_ERR(0, 220, __pyx_L1_error) + __Pyx_DECREF(__pyx_t_4); __pyx_t_4 = 0; + __pyx_v_c_tree = __pyx_t_8; + + /* "spacy/pipeline/_edit_tree_internals/edit_trees.pyx":221 + * for tree_dict in tree_dicts: + * c_tree = _dict2tree(tree_dict) + * self.trees.push_back(c_tree) # <<<<<<<<<<<<<< + * + * deserializers = {} +*/ + if (unlikely(!__pyx_cur_scope->__pyx_v_self)) { __Pyx_RaiseClosureNameError("self"); __PYX_ERR(0, 221, __pyx_L1_error) } + try { + __pyx_cur_scope->__pyx_v_self->trees.push_back(__pyx_v_c_tree); + } catch(...) { + __Pyx_CppExn2PyErr(); + __PYX_ERR(0, 221, __pyx_L1_error) + } + + /* "spacy/pipeline/_edit_tree_internals/edit_trees.pyx":219 + * def deserialize_trees(tree_dicts): + * cdef EditTreeC c_tree + * for tree_dict in tree_dicts: # <<<<<<<<<<<<<< + * c_tree = _dict2tree(tree_dict) + * self.trees.push_back(c_tree) +*/ + } + __Pyx_DECREF(__pyx_t_1); __pyx_t_1 = 0; + + /* "spacy/pipeline/_edit_tree_internals/edit_trees.pyx":217 + * + * def from_bytes(self, bytes_data: bytes, *) -> "EditTrees": + * def deserialize_trees(tree_dicts): # <<<<<<<<<<<<<< + * cdef EditTreeC c_tree + * for tree_dict in tree_dicts: +*/ + + /* function exit code */ + __pyx_r = Py_None; __Pyx_INCREF(Py_None); + goto __pyx_L0; + __pyx_L1_error:; + __Pyx_XDECREF(__pyx_t_1); + __Pyx_XDECREF(__pyx_t_4); + __Pyx_XDECREF(__pyx_t_5); + __Pyx_XDECREF(__pyx_t_6); + __Pyx_AddTraceback("spacy.pipeline._edit_tree_internals.edit_trees.EditTrees.from_bytes.deserialize_trees", __pyx_clineno, __pyx_lineno, __pyx_filename); + __pyx_r = NULL; + __pyx_L0:; + __Pyx_XDECREF(__pyx_v_tree_dict); + __Pyx_XGIVEREF(__pyx_r); + __Pyx_RefNannyFinishContext(); + return __pyx_r; +} + +/* "spacy/pipeline/_edit_tree_internals/edit_trees.pyx":224 + * + * deserializers = {} + * deserializers["trees"] = lambda n: deserialize_trees(n) # <<<<<<<<<<<<<< + * util.from_bytes(bytes_data, deserializers, []) + * +*/ + +/* Python wrapper */ +static PyObject *__pyx_pw_5spacy_8pipeline_20_edit_tree_internals_10edit_trees_9EditTrees_10from_bytes_2lambda(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*/ +static PyMethodDef __pyx_mdef_5spacy_8pipeline_20_edit_tree_internals_10edit_trees_9EditTrees_10from_bytes_2lambda = {"lambda", (PyCFunction)(void(*)(void))(__Pyx_PyCFunction_FastCallWithKeywords)__pyx_pw_5spacy_8pipeline_20_edit_tree_internals_10edit_trees_9EditTrees_10from_bytes_2lambda, __Pyx_METH_FASTCALL|METH_KEYWORDS, 0}; +static PyObject *__pyx_pw_5spacy_8pipeline_20_edit_tree_internals_10edit_trees_9EditTrees_10from_bytes_2lambda(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 +) { + PyObject *__pyx_v_n = 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("lambda (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, 224, __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, 224, __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, "lambda", 0) < (0)) __PYX_ERR(0, 224, __pyx_L3_error) + for (Py_ssize_t i = __pyx_nargs; i < 1; i++) { + if (unlikely(!values[i])) { __Pyx_RaiseArgtupleInvalid("lambda", 1, 1, 1, i); __PYX_ERR(0, 224, __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, 224, __pyx_L3_error) + } + __pyx_v_n = values[0]; + } + goto __pyx_L6_skip; + __pyx_L5_argtuple_error:; + __Pyx_RaiseArgtupleInvalid("lambda", 1, 1, 1, __pyx_nargs); __PYX_ERR(0, 224, __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("spacy.pipeline._edit_tree_internals.edit_trees.EditTrees.from_bytes.lambda", __pyx_clineno, __pyx_lineno, __pyx_filename); + __Pyx_RefNannyFinishContext(); + return NULL; + __pyx_L4_argument_unpacking_done:; + __pyx_r = __pyx_lambda_funcdef_lambda(__pyx_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_lambda_funcdef_lambda(PyObject *__pyx_self, PyObject *__pyx_v_n) { + struct __pyx_obj_5spacy_8pipeline_20_edit_tree_internals_10edit_trees___pyx_scope_struct__from_bytes *__pyx_cur_scope; + struct __pyx_obj_5spacy_8pipeline_20_edit_tree_internals_10edit_trees___pyx_scope_struct__from_bytes *__pyx_outer_scope; + 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("lambda", 0); + __pyx_outer_scope = (struct __pyx_obj_5spacy_8pipeline_20_edit_tree_internals_10edit_trees___pyx_scope_struct__from_bytes *) __Pyx_CyFunction_GetClosure(__pyx_self); + __pyx_cur_scope = __pyx_outer_scope; + __Pyx_XDECREF(__pyx_r); + if (unlikely(!__pyx_cur_scope->__pyx_v_deserialize_trees)) { __Pyx_RaiseClosureNameError("deserialize_trees"); __PYX_ERR(0, 224, __pyx_L1_error) } + __pyx_t_1 = __pyx_pf_5spacy_8pipeline_20_edit_tree_internals_10edit_trees_9EditTrees_10from_bytes_deserialize_trees(__pyx_cur_scope->__pyx_v_deserialize_trees, __pyx_v_n); if (unlikely(!__pyx_t_1)) __PYX_ERR(0, 224, __pyx_L1_error) + __Pyx_GOTREF(__pyx_t_1); + __pyx_r = __pyx_t_1; + __pyx_t_1 = 0; + goto __pyx_L0; + + /* function exit code */ + __pyx_L1_error:; + __Pyx_XDECREF(__pyx_t_1); + __Pyx_AddTraceback("spacy.pipeline._edit_tree_internals.edit_trees.EditTrees.from_bytes.lambda", __pyx_clineno, __pyx_lineno, __pyx_filename); + __pyx_r = NULL; + __pyx_L0:; + __Pyx_XGIVEREF(__pyx_r); + __Pyx_RefNannyFinishContext(); + return __pyx_r; +} + +/* "spacy/pipeline/_edit_tree_internals/edit_trees.pyx":216 + * self._rebuild_tree_map() + * + * def from_bytes(self, bytes_data: bytes, *) -> "EditTrees": # <<<<<<<<<<<<<< + * def deserialize_trees(tree_dicts): + * cdef EditTreeC c_tree +*/ + +static PyObject *__pyx_pf_5spacy_8pipeline_20_edit_tree_internals_10edit_trees_9EditTrees_10from_bytes(struct __pyx_obj_5spacy_8pipeline_20_edit_tree_internals_10edit_trees_EditTrees *__pyx_v_self, PyObject *__pyx_v_bytes_data) { + struct __pyx_obj_5spacy_8pipeline_20_edit_tree_internals_10edit_trees___pyx_scope_struct__from_bytes *__pyx_cur_scope; + PyObject *__pyx_v_deserializers = NULL; + PyObject *__pyx_r = NULL; + __Pyx_RefNannyDeclarations + PyObject *__pyx_t_1 = NULL; + PyObject *__pyx_t_2 = NULL; + PyObject *__pyx_t_3 = NULL; + PyObject *__pyx_t_4 = NULL; + size_t __pyx_t_5; + int __pyx_lineno = 0; + const char *__pyx_filename = NULL; + int __pyx_clineno = 0; + __Pyx_RefNannySetupContext("from_bytes", 0); + __pyx_cur_scope = (struct __pyx_obj_5spacy_8pipeline_20_edit_tree_internals_10edit_trees___pyx_scope_struct__from_bytes *)__pyx_tp_new_5spacy_8pipeline_20_edit_tree_internals_10edit_trees___pyx_scope_struct__from_bytes(__pyx_mstate_global->__pyx_ptype_5spacy_8pipeline_20_edit_tree_internals_10edit_trees___pyx_scope_struct__from_bytes, __pyx_mstate_global->__pyx_empty_tuple, NULL); + if (unlikely(!__pyx_cur_scope)) { + __pyx_cur_scope = ((struct __pyx_obj_5spacy_8pipeline_20_edit_tree_internals_10edit_trees___pyx_scope_struct__from_bytes *)Py_None); + __Pyx_INCREF(Py_None); + __PYX_ERR(0, 216, __pyx_L1_error) + } else { + __Pyx_GOTREF((PyObject *)__pyx_cur_scope); + } + __pyx_cur_scope->__pyx_v_self = __pyx_v_self; + __Pyx_INCREF((PyObject *)__pyx_cur_scope->__pyx_v_self); + __Pyx_GIVEREF((PyObject *)__pyx_cur_scope->__pyx_v_self); + + /* "spacy/pipeline/_edit_tree_internals/edit_trees.pyx":217 + * + * def from_bytes(self, bytes_data: bytes, *) -> "EditTrees": + * def deserialize_trees(tree_dicts): # <<<<<<<<<<<<<< + * cdef EditTreeC c_tree + * for tree_dict in tree_dicts: +*/ + __pyx_t_1 = __Pyx_CyFunction_New(&__pyx_mdef_5spacy_8pipeline_20_edit_tree_internals_10edit_trees_9EditTrees_10from_bytes_1deserialize_trees, 0, __pyx_mstate_global->__pyx_n_u_from_bytes_locals_deserialize_tr, ((PyObject*)__pyx_cur_scope), __pyx_mstate_global->__pyx_n_u_spacy_pipeline__edit_tree_intern, __pyx_mstate_global->__pyx_d, ((PyObject *)__pyx_mstate_global->__pyx_codeobj_tab[0])); if (unlikely(!__pyx_t_1)) __PYX_ERR(0, 217, __pyx_L1_error) + __Pyx_GOTREF(__pyx_t_1); + __Pyx_GIVEREF(__pyx_t_1); + __pyx_cur_scope->__pyx_v_deserialize_trees = __pyx_t_1; + __pyx_t_1 = 0; + + /* "spacy/pipeline/_edit_tree_internals/edit_trees.pyx":223 + * self.trees.push_back(c_tree) + * + * deserializers = {} # <<<<<<<<<<<<<< + * deserializers["trees"] = lambda n: deserialize_trees(n) + * util.from_bytes(bytes_data, deserializers, []) +*/ + __pyx_t_1 = __Pyx_PyDict_NewPresized(0); if (unlikely(!__pyx_t_1)) __PYX_ERR(0, 223, __pyx_L1_error) + __Pyx_GOTREF(__pyx_t_1); + __pyx_v_deserializers = ((PyObject*)__pyx_t_1); + __pyx_t_1 = 0; + + /* "spacy/pipeline/_edit_tree_internals/edit_trees.pyx":224 + * + * deserializers = {} + * deserializers["trees"] = lambda n: deserialize_trees(n) # <<<<<<<<<<<<<< + * util.from_bytes(bytes_data, deserializers, []) + * +*/ + __pyx_t_1 = __Pyx_CyFunction_New(&__pyx_mdef_5spacy_8pipeline_20_edit_tree_internals_10edit_trees_9EditTrees_10from_bytes_2lambda, 0, __pyx_mstate_global->__pyx_n_u_from_bytes_locals_lambda, ((PyObject*)__pyx_cur_scope), __pyx_mstate_global->__pyx_n_u_spacy_pipeline__edit_tree_intern, __pyx_mstate_global->__pyx_d, ((PyObject *)__pyx_mstate_global->__pyx_codeobj_tab[1])); if (unlikely(!__pyx_t_1)) __PYX_ERR(0, 224, __pyx_L1_error) + __Pyx_GOTREF(__pyx_t_1); + if (unlikely((PyDict_SetItem(__pyx_v_deserializers, __pyx_mstate_global->__pyx_n_u_trees, __pyx_t_1) < 0))) __PYX_ERR(0, 224, __pyx_L1_error) + __Pyx_DECREF(__pyx_t_1); __pyx_t_1 = 0; + + /* "spacy/pipeline/_edit_tree_internals/edit_trees.pyx":225 + * deserializers = {} + * deserializers["trees"] = lambda n: deserialize_trees(n) + * util.from_bytes(bytes_data, deserializers, []) # <<<<<<<<<<<<<< + * + * self._rebuild_tree_map() +*/ + __pyx_t_2 = NULL; + __Pyx_GetModuleGlobalName(__pyx_t_3, __pyx_mstate_global->__pyx_n_u_util); if (unlikely(!__pyx_t_3)) __PYX_ERR(0, 225, __pyx_L1_error) + __Pyx_GOTREF(__pyx_t_3); + __pyx_t_4 = __Pyx_PyObject_GetAttrStr(__pyx_t_3, __pyx_mstate_global->__pyx_n_u_from_bytes); if (unlikely(!__pyx_t_4)) __PYX_ERR(0, 225, __pyx_L1_error) + __Pyx_GOTREF(__pyx_t_4); + __Pyx_DECREF(__pyx_t_3); __pyx_t_3 = 0; + __pyx_t_3 = PyList_New(0); if (unlikely(!__pyx_t_3)) __PYX_ERR(0, 225, __pyx_L1_error) + __Pyx_GOTREF(__pyx_t_3); + __pyx_t_5 = 1; + #if CYTHON_UNPACK_METHODS + if (unlikely(PyMethod_Check(__pyx_t_4))) { + __pyx_t_2 = PyMethod_GET_SELF(__pyx_t_4); + assert(__pyx_t_2); + PyObject* __pyx__function = PyMethod_GET_FUNCTION(__pyx_t_4); + __Pyx_INCREF(__pyx_t_2); + __Pyx_INCREF(__pyx__function); + __Pyx_DECREF_SET(__pyx_t_4, __pyx__function); + __pyx_t_5 = 0; + } + #endif + { + PyObject *__pyx_callargs[4] = {__pyx_t_2, __pyx_v_bytes_data, __pyx_v_deserializers, __pyx_t_3}; + __pyx_t_1 = __Pyx_PyObject_FastCall((PyObject*)__pyx_t_4, __pyx_callargs+__pyx_t_5, (4-__pyx_t_5) | (__pyx_t_5*__Pyx_PY_VECTORCALL_ARGUMENTS_OFFSET)); + __Pyx_XDECREF(__pyx_t_2); __pyx_t_2 = 0; + __Pyx_DECREF(__pyx_t_3); __pyx_t_3 = 0; + __Pyx_DECREF(__pyx_t_4); __pyx_t_4 = 0; + if (unlikely(!__pyx_t_1)) __PYX_ERR(0, 225, __pyx_L1_error) + __Pyx_GOTREF(__pyx_t_1); + } + __Pyx_DECREF(__pyx_t_1); __pyx_t_1 = 0; + + /* "spacy/pipeline/_edit_tree_internals/edit_trees.pyx":227 + * util.from_bytes(bytes_data, deserializers, []) + * + * self._rebuild_tree_map() # <<<<<<<<<<<<<< + * + * return self +*/ + __pyx_t_4 = ((PyObject *)__pyx_cur_scope->__pyx_v_self); + __Pyx_INCREF(__pyx_t_4); + __pyx_t_5 = 0; + { + PyObject *__pyx_callargs[2] = {__pyx_t_4, NULL}; + __pyx_t_1 = __Pyx_PyObject_FastCallMethod((PyObject*)__pyx_mstate_global->__pyx_n_u_rebuild_tree_map, __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_1)) __PYX_ERR(0, 227, __pyx_L1_error) + __Pyx_GOTREF(__pyx_t_1); + } + __Pyx_DECREF(__pyx_t_1); __pyx_t_1 = 0; + + /* "spacy/pipeline/_edit_tree_internals/edit_trees.pyx":229 + * self._rebuild_tree_map() + * + * return self # <<<<<<<<<<<<<< + * + * def to_bytes(self, **kwargs) -> bytes: +*/ + __Pyx_XDECREF(__pyx_r); + __Pyx_INCREF((PyObject *)__pyx_cur_scope->__pyx_v_self); + __pyx_r = ((PyObject *)__pyx_cur_scope->__pyx_v_self); + goto __pyx_L0; + + /* "spacy/pipeline/_edit_tree_internals/edit_trees.pyx":216 + * self._rebuild_tree_map() + * + * def from_bytes(self, bytes_data: bytes, *) -> "EditTrees": # <<<<<<<<<<<<<< + * def deserialize_trees(tree_dicts): + * cdef EditTreeC c_tree +*/ + + /* function exit code */ + __pyx_L1_error:; + __Pyx_XDECREF(__pyx_t_1); + __Pyx_XDECREF(__pyx_t_2); + __Pyx_XDECREF(__pyx_t_3); + __Pyx_XDECREF(__pyx_t_4); + __Pyx_AddTraceback("spacy.pipeline._edit_tree_internals.edit_trees.EditTrees.from_bytes", __pyx_clineno, __pyx_lineno, __pyx_filename); + __pyx_r = NULL; + __pyx_L0:; + __Pyx_XDECREF(__pyx_v_deserializers); + __Pyx_DECREF((PyObject *)__pyx_cur_scope); + __Pyx_XGIVEREF(__pyx_r); + __Pyx_RefNannyFinishContext(); + return __pyx_r; +} + +/* "spacy/pipeline/_edit_tree_internals/edit_trees.pyx":231 + * return self + * + * def to_bytes(self, **kwargs) -> bytes: # <<<<<<<<<<<<<< + * tree_dicts = [] + * for tree in self.trees: +*/ + +/* Python wrapper */ +static PyObject *__pyx_pw_5spacy_8pipeline_20_edit_tree_internals_10edit_trees_9EditTrees_13to_bytes(PyObject *__pyx_v_self, +#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_5spacy_8pipeline_20_edit_tree_internals_10edit_trees_9EditTrees_12to_bytes, "EditTrees.to_bytes(self, **kwargs) -> bytes"); +static PyMethodDef __pyx_mdef_5spacy_8pipeline_20_edit_tree_internals_10edit_trees_9EditTrees_13to_bytes = {"to_bytes", (PyCFunction)(void(*)(void))(__Pyx_PyCFunction_FastCallWithKeywords)__pyx_pw_5spacy_8pipeline_20_edit_tree_internals_10edit_trees_9EditTrees_13to_bytes, __Pyx_METH_FASTCALL|METH_KEYWORDS, __pyx_doc_5spacy_8pipeline_20_edit_tree_internals_10edit_trees_9EditTrees_12to_bytes}; +static PyObject *__pyx_pw_5spacy_8pipeline_20_edit_tree_internals_10edit_trees_9EditTrees_13to_bytes(PyObject *__pyx_v_self, +#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_kwargs = 0; + #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("to_bytes (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("to_bytes", 1, 0, 0, __pyx_nargs); return NULL; } + const Py_ssize_t __pyx_kwds_len = (__pyx_kwds) ? __Pyx_NumKwargs_FASTCALL(__pyx_kwds) : 0; + if (unlikely(__pyx_kwds_len < 0)) return NULL; + if (__pyx_kwds_len > 0) { + if (unlikely(__Pyx_CheckKeywordStrings("to_bytes", __pyx_kwds) == -1)) return NULL; + } + __pyx_r = __pyx_pf_5spacy_8pipeline_20_edit_tree_internals_10edit_trees_9EditTrees_12to_bytes(((struct __pyx_obj_5spacy_8pipeline_20_edit_tree_internals_10edit_trees_EditTrees *)__pyx_v_self), __pyx_v_kwargs); + + /* function exit code */ + __Pyx_XDECREF(__pyx_v_kwargs); + __Pyx_RefNannyFinishContext(); + return __pyx_r; +} + +/* "spacy/pipeline/_edit_tree_internals/edit_trees.pyx":238 + * + * serializers = {} + * serializers["trees"] = lambda: tree_dicts # <<<<<<<<<<<<<< + * + * return util.to_bytes(serializers, []) +*/ + +/* Python wrapper */ +static PyObject *__pyx_pw_5spacy_8pipeline_20_edit_tree_internals_10edit_trees_9EditTrees_8to_bytes_lambda1(PyObject *__pyx_self, CYTHON_UNUSED PyObject *unused); /*proto*/ +static PyMethodDef __pyx_mdef_5spacy_8pipeline_20_edit_tree_internals_10edit_trees_9EditTrees_8to_bytes_lambda1 = {"lambda1", (PyCFunction)__pyx_pw_5spacy_8pipeline_20_edit_tree_internals_10edit_trees_9EditTrees_8to_bytes_lambda1, METH_NOARGS, 0}; +static PyObject *__pyx_pw_5spacy_8pipeline_20_edit_tree_internals_10edit_trees_9EditTrees_8to_bytes_lambda1(PyObject *__pyx_self, CYTHON_UNUSED PyObject *unused) { + CYTHON_UNUSED PyObject *const *__pyx_kwvalues; + PyObject *__pyx_r = 0; + __Pyx_RefNannyDeclarations + __Pyx_RefNannySetupContext("lambda1 (wrapper)", 0); + __pyx_kwvalues = __Pyx_KwValues_VARARGS(__pyx_args, __pyx_nargs); + __pyx_r = __pyx_lambda_funcdef_lambda1(__pyx_self); + + /* function exit code */ + __Pyx_RefNannyFinishContext(); + return __pyx_r; +} + +static PyObject *__pyx_lambda_funcdef_lambda1(PyObject *__pyx_self) { + struct __pyx_obj_5spacy_8pipeline_20_edit_tree_internals_10edit_trees___pyx_scope_struct_1_to_bytes *__pyx_cur_scope; + struct __pyx_obj_5spacy_8pipeline_20_edit_tree_internals_10edit_trees___pyx_scope_struct_1_to_bytes *__pyx_outer_scope; + PyObject *__pyx_r = NULL; + __Pyx_RefNannyDeclarations + int __pyx_lineno = 0; + const char *__pyx_filename = NULL; + int __pyx_clineno = 0; + __Pyx_RefNannySetupContext("lambda1", 0); + __pyx_outer_scope = (struct __pyx_obj_5spacy_8pipeline_20_edit_tree_internals_10edit_trees___pyx_scope_struct_1_to_bytes *) __Pyx_CyFunction_GetClosure(__pyx_self); + __pyx_cur_scope = __pyx_outer_scope; + __Pyx_XDECREF(__pyx_r); + if (unlikely(!__pyx_cur_scope->__pyx_v_tree_dicts)) { __Pyx_RaiseClosureNameError("tree_dicts"); __PYX_ERR(0, 238, __pyx_L1_error) } + __Pyx_INCREF(__pyx_cur_scope->__pyx_v_tree_dicts); + __pyx_r = __pyx_cur_scope->__pyx_v_tree_dicts; + goto __pyx_L0; + + /* function exit code */ + __pyx_L1_error:; + __Pyx_AddTraceback("spacy.pipeline._edit_tree_internals.edit_trees.EditTrees.to_bytes.lambda1", __pyx_clineno, __pyx_lineno, __pyx_filename); + __pyx_r = NULL; + __pyx_L0:; + __Pyx_XGIVEREF(__pyx_r); + __Pyx_RefNannyFinishContext(); + return __pyx_r; +} + +/* "spacy/pipeline/_edit_tree_internals/edit_trees.pyx":231 + * return self + * + * def to_bytes(self, **kwargs) -> bytes: # <<<<<<<<<<<<<< + * tree_dicts = [] + * for tree in self.trees: +*/ + +static PyObject *__pyx_pf_5spacy_8pipeline_20_edit_tree_internals_10edit_trees_9EditTrees_12to_bytes(struct __pyx_obj_5spacy_8pipeline_20_edit_tree_internals_10edit_trees_EditTrees *__pyx_v_self, CYTHON_UNUSED PyObject *__pyx_v_kwargs) { + struct __pyx_obj_5spacy_8pipeline_20_edit_tree_internals_10edit_trees___pyx_scope_struct_1_to_bytes *__pyx_cur_scope; + PyObject *__pyx_v_tree = NULL; + PyObject *__pyx_v_serializers = NULL; + PyObject *__pyx_r = NULL; + __Pyx_RefNannyDeclarations + PyObject *__pyx_t_1 = NULL; + std::vector ::iterator __pyx_t_2; + struct __pyx_t_5spacy_8pipeline_20_edit_tree_internals_10edit_trees_EditTreeC __pyx_t_3; + PyObject *__pyx_t_4 = NULL; + PyObject *__pyx_t_5 = NULL; + size_t __pyx_t_6; + int __pyx_t_7; + PyObject *__pyx_t_8 = NULL; + int __pyx_lineno = 0; + const char *__pyx_filename = NULL; + int __pyx_clineno = 0; + __Pyx_RefNannySetupContext("to_bytes", 0); + __pyx_cur_scope = (struct __pyx_obj_5spacy_8pipeline_20_edit_tree_internals_10edit_trees___pyx_scope_struct_1_to_bytes *)__pyx_tp_new_5spacy_8pipeline_20_edit_tree_internals_10edit_trees___pyx_scope_struct_1_to_bytes(__pyx_mstate_global->__pyx_ptype_5spacy_8pipeline_20_edit_tree_internals_10edit_trees___pyx_scope_struct_1_to_bytes, __pyx_mstate_global->__pyx_empty_tuple, NULL); + if (unlikely(!__pyx_cur_scope)) { + __pyx_cur_scope = ((struct __pyx_obj_5spacy_8pipeline_20_edit_tree_internals_10edit_trees___pyx_scope_struct_1_to_bytes *)Py_None); + __Pyx_INCREF(Py_None); + __PYX_ERR(0, 231, __pyx_L1_error) + } else { + __Pyx_GOTREF((PyObject *)__pyx_cur_scope); + } + + /* "spacy/pipeline/_edit_tree_internals/edit_trees.pyx":232 + * + * def to_bytes(self, **kwargs) -> bytes: + * tree_dicts = [] # <<<<<<<<<<<<<< + * for tree in self.trees: + * tree = _tree2dict(tree) +*/ + __pyx_t_1 = PyList_New(0); if (unlikely(!__pyx_t_1)) __PYX_ERR(0, 232, __pyx_L1_error) + __Pyx_GOTREF(__pyx_t_1); + __Pyx_GIVEREF(__pyx_t_1); + __pyx_cur_scope->__pyx_v_tree_dicts = ((PyObject*)__pyx_t_1); + __pyx_t_1 = 0; + + /* "spacy/pipeline/_edit_tree_internals/edit_trees.pyx":233 + * def to_bytes(self, **kwargs) -> bytes: + * tree_dicts = [] + * for tree in self.trees: # <<<<<<<<<<<<<< + * tree = _tree2dict(tree) + * tree_dicts.append(tree) +*/ + __pyx_t_2 = __pyx_v_self->trees.begin(); + for (; __pyx_t_2 != __pyx_v_self->trees.end(); ++__pyx_t_2) { + __pyx_t_3 = *__pyx_t_2; + __pyx_t_1 = __pyx_convert__to_py_struct____pyx_t_5spacy_8pipeline_20_edit_tree_internals_10edit_trees_EditTreeC(__pyx_t_3); if (unlikely(!__pyx_t_1)) __PYX_ERR(0, 233, __pyx_L1_error) + __Pyx_GOTREF(__pyx_t_1); + __Pyx_XDECREF_SET(__pyx_v_tree, __pyx_t_1); + __pyx_t_1 = 0; + + /* "spacy/pipeline/_edit_tree_internals/edit_trees.pyx":234 + * tree_dicts = [] + * for tree in self.trees: + * tree = _tree2dict(tree) # <<<<<<<<<<<<<< + * tree_dicts.append(tree) + * +*/ + __pyx_t_4 = NULL; + __Pyx_GetModuleGlobalName(__pyx_t_5, __pyx_mstate_global->__pyx_n_u_tree2dict); if (unlikely(!__pyx_t_5)) __PYX_ERR(0, 234, __pyx_L1_error) + __Pyx_GOTREF(__pyx_t_5); + __pyx_t_6 = 1; + #if CYTHON_UNPACK_METHODS + if (unlikely(PyMethod_Check(__pyx_t_5))) { + __pyx_t_4 = PyMethod_GET_SELF(__pyx_t_5); + assert(__pyx_t_4); + PyObject* __pyx__function = PyMethod_GET_FUNCTION(__pyx_t_5); + __Pyx_INCREF(__pyx_t_4); + __Pyx_INCREF(__pyx__function); + __Pyx_DECREF_SET(__pyx_t_5, __pyx__function); + __pyx_t_6 = 0; + } + #endif + { + PyObject *__pyx_callargs[2] = {__pyx_t_4, __pyx_v_tree}; + __pyx_t_1 = __Pyx_PyObject_FastCall((PyObject*)__pyx_t_5, __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; + __Pyx_DECREF(__pyx_t_5); __pyx_t_5 = 0; + if (unlikely(!__pyx_t_1)) __PYX_ERR(0, 234, __pyx_L1_error) + __Pyx_GOTREF(__pyx_t_1); + } + __Pyx_DECREF_SET(__pyx_v_tree, __pyx_t_1); + __pyx_t_1 = 0; + + /* "spacy/pipeline/_edit_tree_internals/edit_trees.pyx":235 + * for tree in self.trees: + * tree = _tree2dict(tree) + * tree_dicts.append(tree) # <<<<<<<<<<<<<< + * + * serializers = {} +*/ + __pyx_t_7 = __Pyx_PyList_Append(__pyx_cur_scope->__pyx_v_tree_dicts, __pyx_v_tree); if (unlikely(__pyx_t_7 == ((int)-1))) __PYX_ERR(0, 235, __pyx_L1_error) + + /* "spacy/pipeline/_edit_tree_internals/edit_trees.pyx":233 + * def to_bytes(self, **kwargs) -> bytes: + * tree_dicts = [] + * for tree in self.trees: # <<<<<<<<<<<<<< + * tree = _tree2dict(tree) + * tree_dicts.append(tree) +*/ + } + + /* "spacy/pipeline/_edit_tree_internals/edit_trees.pyx":237 + * tree_dicts.append(tree) + * + * serializers = {} # <<<<<<<<<<<<<< + * serializers["trees"] = lambda: tree_dicts + * +*/ + __pyx_t_1 = __Pyx_PyDict_NewPresized(0); if (unlikely(!__pyx_t_1)) __PYX_ERR(0, 237, __pyx_L1_error) + __Pyx_GOTREF(__pyx_t_1); + __pyx_v_serializers = ((PyObject*)__pyx_t_1); + __pyx_t_1 = 0; + + /* "spacy/pipeline/_edit_tree_internals/edit_trees.pyx":238 + * + * serializers = {} + * serializers["trees"] = lambda: tree_dicts # <<<<<<<<<<<<<< + * + * return util.to_bytes(serializers, []) +*/ + __pyx_t_1 = __Pyx_CyFunction_New(&__pyx_mdef_5spacy_8pipeline_20_edit_tree_internals_10edit_trees_9EditTrees_8to_bytes_lambda1, 0, __pyx_mstate_global->__pyx_n_u_to_bytes_locals_lambda, ((PyObject*)__pyx_cur_scope), __pyx_mstate_global->__pyx_n_u_spacy_pipeline__edit_tree_intern, __pyx_mstate_global->__pyx_d, ((PyObject *)__pyx_mstate_global->__pyx_codeobj_tab[2])); if (unlikely(!__pyx_t_1)) __PYX_ERR(0, 238, __pyx_L1_error) + __Pyx_GOTREF(__pyx_t_1); + if (unlikely((PyDict_SetItem(__pyx_v_serializers, __pyx_mstate_global->__pyx_n_u_trees, __pyx_t_1) < 0))) __PYX_ERR(0, 238, __pyx_L1_error) + __Pyx_DECREF(__pyx_t_1); __pyx_t_1 = 0; + + /* "spacy/pipeline/_edit_tree_internals/edit_trees.pyx":240 + * serializers["trees"] = lambda: tree_dicts + * + * return util.to_bytes(serializers, []) # <<<<<<<<<<<<<< + * + * def to_disk(self, path, **kwargs) -> "EditTrees": +*/ + __Pyx_XDECREF(__pyx_r); + __pyx_t_5 = NULL; + __Pyx_GetModuleGlobalName(__pyx_t_4, __pyx_mstate_global->__pyx_n_u_util); if (unlikely(!__pyx_t_4)) __PYX_ERR(0, 240, __pyx_L1_error) + __Pyx_GOTREF(__pyx_t_4); + __pyx_t_8 = __Pyx_PyObject_GetAttrStr(__pyx_t_4, __pyx_mstate_global->__pyx_n_u_to_bytes); if (unlikely(!__pyx_t_8)) __PYX_ERR(0, 240, __pyx_L1_error) + __Pyx_GOTREF(__pyx_t_8); + __Pyx_DECREF(__pyx_t_4); __pyx_t_4 = 0; + __pyx_t_4 = PyList_New(0); if (unlikely(!__pyx_t_4)) __PYX_ERR(0, 240, __pyx_L1_error) + __Pyx_GOTREF(__pyx_t_4); + __pyx_t_6 = 1; + #if CYTHON_UNPACK_METHODS + if (unlikely(PyMethod_Check(__pyx_t_8))) { + __pyx_t_5 = PyMethod_GET_SELF(__pyx_t_8); + assert(__pyx_t_5); + PyObject* __pyx__function = PyMethod_GET_FUNCTION(__pyx_t_8); + __Pyx_INCREF(__pyx_t_5); + __Pyx_INCREF(__pyx__function); + __Pyx_DECREF_SET(__pyx_t_8, __pyx__function); + __pyx_t_6 = 0; + } + #endif + { + PyObject *__pyx_callargs[3] = {__pyx_t_5, __pyx_v_serializers, __pyx_t_4}; + __pyx_t_1 = __Pyx_PyObject_FastCall((PyObject*)__pyx_t_8, __pyx_callargs+__pyx_t_6, (3-__pyx_t_6) | (__pyx_t_6*__Pyx_PY_VECTORCALL_ARGUMENTS_OFFSET)); + __Pyx_XDECREF(__pyx_t_5); __pyx_t_5 = 0; + __Pyx_DECREF(__pyx_t_4); __pyx_t_4 = 0; + __Pyx_DECREF(__pyx_t_8); __pyx_t_8 = 0; + if (unlikely(!__pyx_t_1)) __PYX_ERR(0, 240, __pyx_L1_error) + __Pyx_GOTREF(__pyx_t_1); + } + __pyx_r = __pyx_t_1; + __pyx_t_1 = 0; + goto __pyx_L0; + + /* "spacy/pipeline/_edit_tree_internals/edit_trees.pyx":231 + * return self + * + * def to_bytes(self, **kwargs) -> bytes: # <<<<<<<<<<<<<< + * tree_dicts = [] + * for tree in self.trees: +*/ + + /* function exit code */ + __pyx_L1_error:; + __Pyx_XDECREF(__pyx_t_1); + __Pyx_XDECREF(__pyx_t_4); + __Pyx_XDECREF(__pyx_t_5); + __Pyx_XDECREF(__pyx_t_8); + __Pyx_AddTraceback("spacy.pipeline._edit_tree_internals.edit_trees.EditTrees.to_bytes", __pyx_clineno, __pyx_lineno, __pyx_filename); + __pyx_r = NULL; + __pyx_L0:; + __Pyx_XDECREF(__pyx_v_tree); + __Pyx_XDECREF(__pyx_v_serializers); + __Pyx_DECREF((PyObject *)__pyx_cur_scope); + __Pyx_XGIVEREF(__pyx_r); + __Pyx_RefNannyFinishContext(); + return __pyx_r; +} + +/* "spacy/pipeline/_edit_tree_internals/edit_trees.pyx":242 + * return util.to_bytes(serializers, []) + * + * def to_disk(self, path, **kwargs) -> "EditTrees": # <<<<<<<<<<<<<< + * path = util.ensure_path(path) + * with path.open("wb") as file_: +*/ + +/* Python wrapper */ +static PyObject *__pyx_pw_5spacy_8pipeline_20_edit_tree_internals_10edit_trees_9EditTrees_15to_disk(PyObject *__pyx_v_self, +#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_5spacy_8pipeline_20_edit_tree_internals_10edit_trees_9EditTrees_14to_disk, "EditTrees.to_disk(self, path, **kwargs) -> 'EditTrees'"); +static PyMethodDef __pyx_mdef_5spacy_8pipeline_20_edit_tree_internals_10edit_trees_9EditTrees_15to_disk = {"to_disk", (PyCFunction)(void(*)(void))(__Pyx_PyCFunction_FastCallWithKeywords)__pyx_pw_5spacy_8pipeline_20_edit_tree_internals_10edit_trees_9EditTrees_15to_disk, __Pyx_METH_FASTCALL|METH_KEYWORDS, __pyx_doc_5spacy_8pipeline_20_edit_tree_internals_10edit_trees_9EditTrees_14to_disk}; +static PyObject *__pyx_pw_5spacy_8pipeline_20_edit_tree_internals_10edit_trees_9EditTrees_15to_disk(PyObject *__pyx_v_self, +#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; + CYTHON_UNUSED PyObject *__pyx_v_kwargs = 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("to_disk (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, 242, __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, 242, __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, __pyx_v_kwargs, values, kwd_pos_args, __pyx_kwds_len, "to_disk", 1) < (0)) __PYX_ERR(0, 242, __pyx_L3_error) + for (Py_ssize_t i = __pyx_nargs; i < 1; i++) { + if (unlikely(!values[i])) { __Pyx_RaiseArgtupleInvalid("to_disk", 1, 1, 1, i); __PYX_ERR(0, 242, __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, 242, __pyx_L3_error) + } + __pyx_v_path = values[0]; + } + goto __pyx_L6_skip; + __pyx_L5_argtuple_error:; + __Pyx_RaiseArgtupleInvalid("to_disk", 1, 1, 1, __pyx_nargs); __PYX_ERR(0, 242, __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_XDECREF(__pyx_v_kwargs); __pyx_v_kwargs = 0; + __Pyx_AddTraceback("spacy.pipeline._edit_tree_internals.edit_trees.EditTrees.to_disk", __pyx_clineno, __pyx_lineno, __pyx_filename); + __Pyx_RefNannyFinishContext(); + return NULL; + __pyx_L4_argument_unpacking_done:; + __pyx_r = __pyx_pf_5spacy_8pipeline_20_edit_tree_internals_10edit_trees_9EditTrees_14to_disk(((struct __pyx_obj_5spacy_8pipeline_20_edit_tree_internals_10edit_trees_EditTrees *)__pyx_v_self), __pyx_v_path, __pyx_v_kwargs); + + /* 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_XDECREF(__pyx_v_kwargs); + __Pyx_RefNannyFinishContext(); + return __pyx_r; +} + +static PyObject *__pyx_pf_5spacy_8pipeline_20_edit_tree_internals_10edit_trees_9EditTrees_14to_disk(struct __pyx_obj_5spacy_8pipeline_20_edit_tree_internals_10edit_trees_EditTrees *__pyx_v_self, PyObject *__pyx_v_path, CYTHON_UNUSED PyObject *__pyx_v_kwargs) { + PyObject *__pyx_v_file_ = NULL; + PyObject *__pyx_r = NULL; + __Pyx_RefNannyDeclarations + PyObject *__pyx_t_1 = NULL; + PyObject *__pyx_t_2 = NULL; + PyObject *__pyx_t_3 = NULL; + PyObject *__pyx_t_4 = NULL; + size_t __pyx_t_5; + PyObject *__pyx_t_6 = NULL; + PyObject *__pyx_t_7 = NULL; + PyObject *__pyx_t_8 = NULL; + PyObject *__pyx_t_9 = NULL; + PyObject *__pyx_t_10 = NULL; + int __pyx_t_11; + int __pyx_t_12; + int __pyx_lineno = 0; + const char *__pyx_filename = NULL; + int __pyx_clineno = 0; + __Pyx_RefNannySetupContext("to_disk", 0); + __Pyx_INCREF(__pyx_v_path); + + /* "spacy/pipeline/_edit_tree_internals/edit_trees.pyx":243 + * + * def to_disk(self, path, **kwargs) -> "EditTrees": + * path = util.ensure_path(path) # <<<<<<<<<<<<<< + * with path.open("wb") as file_: + * file_.write(self.to_bytes()) +*/ + __pyx_t_2 = NULL; + __Pyx_GetModuleGlobalName(__pyx_t_3, __pyx_mstate_global->__pyx_n_u_util); if (unlikely(!__pyx_t_3)) __PYX_ERR(0, 243, __pyx_L1_error) + __Pyx_GOTREF(__pyx_t_3); + __pyx_t_4 = __Pyx_PyObject_GetAttrStr(__pyx_t_3, __pyx_mstate_global->__pyx_n_u_ensure_path); if (unlikely(!__pyx_t_4)) __PYX_ERR(0, 243, __pyx_L1_error) + __Pyx_GOTREF(__pyx_t_4); + __Pyx_DECREF(__pyx_t_3); __pyx_t_3 = 0; + __pyx_t_5 = 1; + #if CYTHON_UNPACK_METHODS + if (unlikely(PyMethod_Check(__pyx_t_4))) { + __pyx_t_2 = PyMethod_GET_SELF(__pyx_t_4); + assert(__pyx_t_2); + PyObject* __pyx__function = PyMethod_GET_FUNCTION(__pyx_t_4); + __Pyx_INCREF(__pyx_t_2); + __Pyx_INCREF(__pyx__function); + __Pyx_DECREF_SET(__pyx_t_4, __pyx__function); + __pyx_t_5 = 0; + } + #endif + { + PyObject *__pyx_callargs[2] = {__pyx_t_2, __pyx_v_path}; + __pyx_t_1 = __Pyx_PyObject_FastCall((PyObject*)__pyx_t_4, __pyx_callargs+__pyx_t_5, (2-__pyx_t_5) | (__pyx_t_5*__Pyx_PY_VECTORCALL_ARGUMENTS_OFFSET)); + __Pyx_XDECREF(__pyx_t_2); __pyx_t_2 = 0; + __Pyx_DECREF(__pyx_t_4); __pyx_t_4 = 0; + if (unlikely(!__pyx_t_1)) __PYX_ERR(0, 243, __pyx_L1_error) + __Pyx_GOTREF(__pyx_t_1); + } + __Pyx_DECREF_SET(__pyx_v_path, __pyx_t_1); + __pyx_t_1 = 0; + + /* "spacy/pipeline/_edit_tree_internals/edit_trees.pyx":244 + * def to_disk(self, path, **kwargs) -> "EditTrees": + * path = util.ensure_path(path) + * with path.open("wb") as file_: # <<<<<<<<<<<<<< + * file_.write(self.to_bytes()) + * +*/ + /*with:*/ { + __pyx_t_4 = __pyx_v_path; + __Pyx_INCREF(__pyx_t_4); + __pyx_t_5 = 0; + { + PyObject *__pyx_callargs[2] = {__pyx_t_4, __pyx_mstate_global->__pyx_n_u_wb}; + __pyx_t_1 = __Pyx_PyObject_FastCallMethod((PyObject*)__pyx_mstate_global->__pyx_n_u_open, __pyx_callargs+__pyx_t_5, (2-__pyx_t_5) | (1*__Pyx_PY_VECTORCALL_ARGUMENTS_OFFSET)); + __Pyx_XDECREF(__pyx_t_4); __pyx_t_4 = 0; + if (unlikely(!__pyx_t_1)) __PYX_ERR(0, 244, __pyx_L1_error) + __Pyx_GOTREF(__pyx_t_1); + } + __pyx_t_6 = __Pyx_PyObject_LookupSpecial(__pyx_t_1, __pyx_mstate_global->__pyx_n_u_exit); if (unlikely(!__pyx_t_6)) __PYX_ERR(0, 244, __pyx_L1_error) + __Pyx_GOTREF(__pyx_t_6); + __pyx_t_2 = NULL; + __pyx_t_3 = __Pyx_PyObject_LookupSpecial(__pyx_t_1, __pyx_mstate_global->__pyx_n_u_enter); if (unlikely(!__pyx_t_3)) __PYX_ERR(0, 244, __pyx_L3_error) + __Pyx_GOTREF(__pyx_t_3); + __pyx_t_5 = 1; + #if CYTHON_UNPACK_METHODS + if (likely(PyMethod_Check(__pyx_t_3))) { + __pyx_t_2 = PyMethod_GET_SELF(__pyx_t_3); + assert(__pyx_t_2); + PyObject* __pyx__function = PyMethod_GET_FUNCTION(__pyx_t_3); + __Pyx_INCREF(__pyx_t_2); + __Pyx_INCREF(__pyx__function); + __Pyx_DECREF_SET(__pyx_t_3, __pyx__function); + __pyx_t_5 = 0; + } + #endif + { + PyObject *__pyx_callargs[2] = {__pyx_t_2, NULL}; + __pyx_t_4 = __Pyx_PyObject_FastCall((PyObject*)__pyx_t_3, __pyx_callargs+__pyx_t_5, (1-__pyx_t_5) | (__pyx_t_5*__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_4)) __PYX_ERR(0, 244, __pyx_L3_error) + __Pyx_GOTREF(__pyx_t_4); + } + __pyx_t_3 = __pyx_t_4; + __pyx_t_4 = 0; + __Pyx_DECREF(__pyx_t_1); __pyx_t_1 = 0; + /*try:*/ { + { + __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:*/ { + __pyx_v_file_ = __pyx_t_3; + __pyx_t_3 = 0; + + /* "spacy/pipeline/_edit_tree_internals/edit_trees.pyx":245 + * path = util.ensure_path(path) + * with path.open("wb") as file_: + * file_.write(self.to_bytes()) # <<<<<<<<<<<<<< + * + * def from_disk(self, path, **kwargs) -> "EditTrees": +*/ + __pyx_t_1 = __pyx_v_file_; + __Pyx_INCREF(__pyx_t_1); + __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_4 = __Pyx_PyObject_FastCallMethod((PyObject*)__pyx_mstate_global->__pyx_n_u_to_bytes, __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_4)) __PYX_ERR(0, 245, __pyx_L7_error) + __Pyx_GOTREF(__pyx_t_4); + } + __pyx_t_5 = 0; + { + PyObject *__pyx_callargs[2] = {__pyx_t_1, __pyx_t_4}; + __pyx_t_3 = __Pyx_PyObject_FastCallMethod((PyObject*)__pyx_mstate_global->__pyx_n_u_write, __pyx_callargs+__pyx_t_5, (2-__pyx_t_5) | (1*__Pyx_PY_VECTORCALL_ARGUMENTS_OFFSET)); + __Pyx_XDECREF(__pyx_t_1); __pyx_t_1 = 0; + __Pyx_DECREF(__pyx_t_4); __pyx_t_4 = 0; + if (unlikely(!__pyx_t_3)) __PYX_ERR(0, 245, __pyx_L7_error) + __Pyx_GOTREF(__pyx_t_3); + } + __Pyx_DECREF(__pyx_t_3); __pyx_t_3 = 0; + + /* "spacy/pipeline/_edit_tree_internals/edit_trees.pyx":244 + * def to_disk(self, path, **kwargs) -> "EditTrees": + * path = util.ensure_path(path) + * with path.open("wb") as file_: # <<<<<<<<<<<<<< + * file_.write(self.to_bytes()) + * +*/ + } + __Pyx_XDECREF(__pyx_t_7); __pyx_t_7 = 0; + __Pyx_XDECREF(__pyx_t_8); __pyx_t_8 = 0; + __Pyx_XDECREF(__pyx_t_9); __pyx_t_9 = 0; + goto __pyx_L12_try_end; + __pyx_L7_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; + __Pyx_XDECREF(__pyx_t_4); __pyx_t_4 = 0; + /*except:*/ { + __Pyx_AddTraceback("spacy.pipeline._edit_tree_internals.edit_trees.EditTrees.to_disk", __pyx_clineno, __pyx_lineno, __pyx_filename); + if (__Pyx_GetException(&__pyx_t_3, &__pyx_t_4, &__pyx_t_1) < 0) __PYX_ERR(0, 244, __pyx_L9_except_error) + __Pyx_XGOTREF(__pyx_t_3); + __Pyx_XGOTREF(__pyx_t_4); + __Pyx_XGOTREF(__pyx_t_1); + __pyx_t_2 = PyTuple_Pack(3, __pyx_t_3, __pyx_t_4, __pyx_t_1); if (unlikely(!__pyx_t_2)) __PYX_ERR(0, 244, __pyx_L9_except_error) + __Pyx_GOTREF(__pyx_t_2); + __pyx_t_10 = __Pyx_PyObject_Call(__pyx_t_6, __pyx_t_2, NULL); + __Pyx_DECREF(__pyx_t_6); __pyx_t_6 = 0; + __Pyx_DECREF(__pyx_t_2); __pyx_t_2 = 0; + if (unlikely(!__pyx_t_10)) __PYX_ERR(0, 244, __pyx_L9_except_error) + __Pyx_GOTREF(__pyx_t_10); + __pyx_t_11 = __Pyx_PyObject_IsTrue(__pyx_t_10); + __Pyx_DECREF(__pyx_t_10); __pyx_t_10 = 0; + if (__pyx_t_11 < (0)) __PYX_ERR(0, 244, __pyx_L9_except_error) + __pyx_t_12 = (!__pyx_t_11); + if (unlikely(__pyx_t_12)) { + __Pyx_GIVEREF(__pyx_t_3); + __Pyx_GIVEREF(__pyx_t_4); + __Pyx_XGIVEREF(__pyx_t_1); + __Pyx_ErrRestoreWithState(__pyx_t_3, __pyx_t_4, __pyx_t_1); + __pyx_t_3 = 0; __pyx_t_4 = 0; __pyx_t_1 = 0; + __PYX_ERR(0, 244, __pyx_L9_except_error) + } + __Pyx_XDECREF(__pyx_t_3); __pyx_t_3 = 0; + __Pyx_XDECREF(__pyx_t_4); __pyx_t_4 = 0; + __Pyx_XDECREF(__pyx_t_1); __pyx_t_1 = 0; + goto __pyx_L8_exception_handled; + } + __pyx_L9_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_exception_handled:; + __Pyx_XGIVEREF(__pyx_t_7); + __Pyx_XGIVEREF(__pyx_t_8); + __Pyx_XGIVEREF(__pyx_t_9); + __Pyx_ExceptionReset(__pyx_t_7, __pyx_t_8, __pyx_t_9); + __pyx_L12_try_end:; + } + } + /*finally:*/ { + /*normal exit:*/{ + if (__pyx_t_6) { + __pyx_t_9 = __Pyx_PyObject_Call(__pyx_t_6, __pyx_mstate_global->__pyx_tuple[0], NULL); + __Pyx_DECREF(__pyx_t_6); __pyx_t_6 = 0; + if (unlikely(!__pyx_t_9)) __PYX_ERR(0, 244, __pyx_L1_error) + __Pyx_GOTREF(__pyx_t_9); + __Pyx_DECREF(__pyx_t_9); __pyx_t_9 = 0; + } + goto __pyx_L6; + } + __pyx_L6:; + } + goto __pyx_L16; + __pyx_L3_error:; + __Pyx_DECREF(__pyx_t_6); __pyx_t_6 = 0; + goto __pyx_L1_error; + __pyx_L16:; + } + + /* "spacy/pipeline/_edit_tree_internals/edit_trees.pyx":242 + * return util.to_bytes(serializers, []) + * + * def to_disk(self, path, **kwargs) -> "EditTrees": # <<<<<<<<<<<<<< + * path = util.ensure_path(path) + * with path.open("wb") as file_: +*/ + + /* function exit code */ + __pyx_r = Py_None; __Pyx_INCREF(Py_None); + goto __pyx_L0; + __pyx_L1_error:; + __Pyx_XDECREF(__pyx_t_1); + __Pyx_XDECREF(__pyx_t_2); + __Pyx_XDECREF(__pyx_t_3); + __Pyx_XDECREF(__pyx_t_4); + __Pyx_AddTraceback("spacy.pipeline._edit_tree_internals.edit_trees.EditTrees.to_disk", __pyx_clineno, __pyx_lineno, __pyx_filename); + __pyx_r = NULL; + __pyx_L0:; + __Pyx_XDECREF(__pyx_v_file_); + __Pyx_XDECREF(__pyx_v_path); + __Pyx_XGIVEREF(__pyx_r); + __Pyx_RefNannyFinishContext(); + return __pyx_r; +} + +/* "spacy/pipeline/_edit_tree_internals/edit_trees.pyx":247 + * file_.write(self.to_bytes()) + * + * def from_disk(self, path, **kwargs) -> "EditTrees": # <<<<<<<<<<<<<< + * path = util.ensure_path(path) + * if path.exists(): +*/ + +/* Python wrapper */ +static PyObject *__pyx_pw_5spacy_8pipeline_20_edit_tree_internals_10edit_trees_9EditTrees_17from_disk(PyObject *__pyx_v_self, +#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_5spacy_8pipeline_20_edit_tree_internals_10edit_trees_9EditTrees_16from_disk, "EditTrees.from_disk(self, path, **kwargs) -> 'EditTrees'"); +static PyMethodDef __pyx_mdef_5spacy_8pipeline_20_edit_tree_internals_10edit_trees_9EditTrees_17from_disk = {"from_disk", (PyCFunction)(void(*)(void))(__Pyx_PyCFunction_FastCallWithKeywords)__pyx_pw_5spacy_8pipeline_20_edit_tree_internals_10edit_trees_9EditTrees_17from_disk, __Pyx_METH_FASTCALL|METH_KEYWORDS, __pyx_doc_5spacy_8pipeline_20_edit_tree_internals_10edit_trees_9EditTrees_16from_disk}; +static PyObject *__pyx_pw_5spacy_8pipeline_20_edit_tree_internals_10edit_trees_9EditTrees_17from_disk(PyObject *__pyx_v_self, +#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; + CYTHON_UNUSED PyObject *__pyx_v_kwargs = 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("from_disk (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, 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, __pyx_v_kwargs, values, kwd_pos_args, __pyx_kwds_len, "from_disk", 1) < (0)) __PYX_ERR(0, 247, __pyx_L3_error) + for (Py_ssize_t i = __pyx_nargs; i < 1; i++) { + if (unlikely(!values[i])) { __Pyx_RaiseArgtupleInvalid("from_disk", 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_path = values[0]; + } + goto __pyx_L6_skip; + __pyx_L5_argtuple_error:; + __Pyx_RaiseArgtupleInvalid("from_disk", 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_XDECREF(__pyx_v_kwargs); __pyx_v_kwargs = 0; + __Pyx_AddTraceback("spacy.pipeline._edit_tree_internals.edit_trees.EditTrees.from_disk", __pyx_clineno, __pyx_lineno, __pyx_filename); + __Pyx_RefNannyFinishContext(); + return NULL; + __pyx_L4_argument_unpacking_done:; + __pyx_r = __pyx_pf_5spacy_8pipeline_20_edit_tree_internals_10edit_trees_9EditTrees_16from_disk(((struct __pyx_obj_5spacy_8pipeline_20_edit_tree_internals_10edit_trees_EditTrees *)__pyx_v_self), __pyx_v_path, __pyx_v_kwargs); + + /* 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_XDECREF(__pyx_v_kwargs); + __Pyx_RefNannyFinishContext(); + return __pyx_r; +} + +static PyObject *__pyx_pf_5spacy_8pipeline_20_edit_tree_internals_10edit_trees_9EditTrees_16from_disk(struct __pyx_obj_5spacy_8pipeline_20_edit_tree_internals_10edit_trees_EditTrees *__pyx_v_self, PyObject *__pyx_v_path, CYTHON_UNUSED PyObject *__pyx_v_kwargs) { + PyObject *__pyx_v_file_ = NULL; + PyObject *__pyx_v_data = NULL; + PyObject *__pyx_r = NULL; + __Pyx_RefNannyDeclarations + PyObject *__pyx_t_1 = NULL; + PyObject *__pyx_t_2 = NULL; + PyObject *__pyx_t_3 = NULL; + PyObject *__pyx_t_4 = NULL; + size_t __pyx_t_5; + int __pyx_t_6; + PyObject *__pyx_t_7 = NULL; + PyObject *__pyx_t_8 = NULL; + PyObject *__pyx_t_9 = NULL; + PyObject *__pyx_t_10 = NULL; + PyObject *__pyx_t_11 = NULL; + int __pyx_t_12; + int __pyx_lineno = 0; + const char *__pyx_filename = NULL; + int __pyx_clineno = 0; + __Pyx_RefNannySetupContext("from_disk", 0); + __Pyx_INCREF(__pyx_v_path); + + /* "spacy/pipeline/_edit_tree_internals/edit_trees.pyx":248 + * + * def from_disk(self, path, **kwargs) -> "EditTrees": + * path = util.ensure_path(path) # <<<<<<<<<<<<<< + * if path.exists(): + * with path.open("rb") as file_: +*/ + __pyx_t_2 = NULL; + __Pyx_GetModuleGlobalName(__pyx_t_3, __pyx_mstate_global->__pyx_n_u_util); if (unlikely(!__pyx_t_3)) __PYX_ERR(0, 248, __pyx_L1_error) + __Pyx_GOTREF(__pyx_t_3); + __pyx_t_4 = __Pyx_PyObject_GetAttrStr(__pyx_t_3, __pyx_mstate_global->__pyx_n_u_ensure_path); if (unlikely(!__pyx_t_4)) __PYX_ERR(0, 248, __pyx_L1_error) + __Pyx_GOTREF(__pyx_t_4); + __Pyx_DECREF(__pyx_t_3); __pyx_t_3 = 0; + __pyx_t_5 = 1; + #if CYTHON_UNPACK_METHODS + if (unlikely(PyMethod_Check(__pyx_t_4))) { + __pyx_t_2 = PyMethod_GET_SELF(__pyx_t_4); + assert(__pyx_t_2); + PyObject* __pyx__function = PyMethod_GET_FUNCTION(__pyx_t_4); + __Pyx_INCREF(__pyx_t_2); + __Pyx_INCREF(__pyx__function); + __Pyx_DECREF_SET(__pyx_t_4, __pyx__function); + __pyx_t_5 = 0; + } + #endif + { + PyObject *__pyx_callargs[2] = {__pyx_t_2, __pyx_v_path}; + __pyx_t_1 = __Pyx_PyObject_FastCall((PyObject*)__pyx_t_4, __pyx_callargs+__pyx_t_5, (2-__pyx_t_5) | (__pyx_t_5*__Pyx_PY_VECTORCALL_ARGUMENTS_OFFSET)); + __Pyx_XDECREF(__pyx_t_2); __pyx_t_2 = 0; + __Pyx_DECREF(__pyx_t_4); __pyx_t_4 = 0; + if (unlikely(!__pyx_t_1)) __PYX_ERR(0, 248, __pyx_L1_error) + __Pyx_GOTREF(__pyx_t_1); + } + __Pyx_DECREF_SET(__pyx_v_path, __pyx_t_1); + __pyx_t_1 = 0; + + /* "spacy/pipeline/_edit_tree_internals/edit_trees.pyx":249 + * def from_disk(self, path, **kwargs) -> "EditTrees": + * path = util.ensure_path(path) + * if path.exists(): # <<<<<<<<<<<<<< + * with path.open("rb") as file_: + * data = file_.read() +*/ + __pyx_t_4 = __pyx_v_path; + __Pyx_INCREF(__pyx_t_4); + __pyx_t_5 = 0; + { + PyObject *__pyx_callargs[2] = {__pyx_t_4, NULL}; + __pyx_t_1 = __Pyx_PyObject_FastCallMethod((PyObject*)__pyx_mstate_global->__pyx_n_u_exists, __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_1)) __PYX_ERR(0, 249, __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, 249, __pyx_L1_error) + __Pyx_DECREF(__pyx_t_1); __pyx_t_1 = 0; + if (__pyx_t_6) { + + /* "spacy/pipeline/_edit_tree_internals/edit_trees.pyx":250 + * path = util.ensure_path(path) + * if path.exists(): + * with path.open("rb") as file_: # <<<<<<<<<<<<<< + * data = file_.read() + * return self.from_bytes(data) +*/ + /*with:*/ { + __pyx_t_4 = __pyx_v_path; + __Pyx_INCREF(__pyx_t_4); + __pyx_t_5 = 0; + { + PyObject *__pyx_callargs[2] = {__pyx_t_4, __pyx_mstate_global->__pyx_n_u_rb}; + __pyx_t_1 = __Pyx_PyObject_FastCallMethod((PyObject*)__pyx_mstate_global->__pyx_n_u_open, __pyx_callargs+__pyx_t_5, (2-__pyx_t_5) | (1*__Pyx_PY_VECTORCALL_ARGUMENTS_OFFSET)); + __Pyx_XDECREF(__pyx_t_4); __pyx_t_4 = 0; + if (unlikely(!__pyx_t_1)) __PYX_ERR(0, 250, __pyx_L1_error) + __Pyx_GOTREF(__pyx_t_1); + } + __pyx_t_7 = __Pyx_PyObject_LookupSpecial(__pyx_t_1, __pyx_mstate_global->__pyx_n_u_exit); if (unlikely(!__pyx_t_7)) __PYX_ERR(0, 250, __pyx_L1_error) + __Pyx_GOTREF(__pyx_t_7); + __pyx_t_2 = NULL; + __pyx_t_3 = __Pyx_PyObject_LookupSpecial(__pyx_t_1, __pyx_mstate_global->__pyx_n_u_enter); if (unlikely(!__pyx_t_3)) __PYX_ERR(0, 250, __pyx_L4_error) + __Pyx_GOTREF(__pyx_t_3); + __pyx_t_5 = 1; + #if CYTHON_UNPACK_METHODS + if (likely(PyMethod_Check(__pyx_t_3))) { + __pyx_t_2 = PyMethod_GET_SELF(__pyx_t_3); + assert(__pyx_t_2); + PyObject* __pyx__function = PyMethod_GET_FUNCTION(__pyx_t_3); + __Pyx_INCREF(__pyx_t_2); + __Pyx_INCREF(__pyx__function); + __Pyx_DECREF_SET(__pyx_t_3, __pyx__function); + __pyx_t_5 = 0; + } + #endif + { + PyObject *__pyx_callargs[2] = {__pyx_t_2, NULL}; + __pyx_t_4 = __Pyx_PyObject_FastCall((PyObject*)__pyx_t_3, __pyx_callargs+__pyx_t_5, (1-__pyx_t_5) | (__pyx_t_5*__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_4)) __PYX_ERR(0, 250, __pyx_L4_error) + __Pyx_GOTREF(__pyx_t_4); + } + __pyx_t_3 = __pyx_t_4; + __pyx_t_4 = 0; + __Pyx_DECREF(__pyx_t_1); __pyx_t_1 = 0; + /*try:*/ { + { + __Pyx_PyThreadState_declare + __Pyx_PyThreadState_assign + __Pyx_ExceptionSave(&__pyx_t_8, &__pyx_t_9, &__pyx_t_10); + __Pyx_XGOTREF(__pyx_t_8); + __Pyx_XGOTREF(__pyx_t_9); + __Pyx_XGOTREF(__pyx_t_10); + /*try:*/ { + __pyx_v_file_ = __pyx_t_3; + __pyx_t_3 = 0; + + /* "spacy/pipeline/_edit_tree_internals/edit_trees.pyx":251 + * if path.exists(): + * with path.open("rb") as file_: + * data = file_.read() # <<<<<<<<<<<<<< + * return self.from_bytes(data) + * +*/ + __pyx_t_1 = __pyx_v_file_; + __Pyx_INCREF(__pyx_t_1); + __pyx_t_5 = 0; + { + PyObject *__pyx_callargs[2] = {__pyx_t_1, NULL}; + __pyx_t_3 = __Pyx_PyObject_FastCallMethod((PyObject*)__pyx_mstate_global->__pyx_n_u_read, __pyx_callargs+__pyx_t_5, (1-__pyx_t_5) | (1*__Pyx_PY_VECTORCALL_ARGUMENTS_OFFSET)); + __Pyx_XDECREF(__pyx_t_1); __pyx_t_1 = 0; + if (unlikely(!__pyx_t_3)) __PYX_ERR(0, 251, __pyx_L8_error) + __Pyx_GOTREF(__pyx_t_3); + } + __pyx_v_data = __pyx_t_3; + __pyx_t_3 = 0; + + /* "spacy/pipeline/_edit_tree_internals/edit_trees.pyx":250 + * path = util.ensure_path(path) + * if path.exists(): + * with path.open("rb") as file_: # <<<<<<<<<<<<<< + * data = file_.read() + * return self.from_bytes(data) +*/ + } + __Pyx_XDECREF(__pyx_t_8); __pyx_t_8 = 0; + __Pyx_XDECREF(__pyx_t_9); __pyx_t_9 = 0; + __Pyx_XDECREF(__pyx_t_10); __pyx_t_10 = 0; + goto __pyx_L13_try_end; + __pyx_L8_error:; + __Pyx_XDECREF(__pyx_t_1); __pyx_t_1 = 0; + __Pyx_XDECREF(__pyx_t_2); __pyx_t_2 = 0; + __Pyx_XDECREF(__pyx_t_3); __pyx_t_3 = 0; + __Pyx_XDECREF(__pyx_t_4); __pyx_t_4 = 0; + /*except:*/ { + __Pyx_AddTraceback("spacy.pipeline._edit_tree_internals.edit_trees.EditTrees.from_disk", __pyx_clineno, __pyx_lineno, __pyx_filename); + if (__Pyx_GetException(&__pyx_t_3, &__pyx_t_1, &__pyx_t_4) < 0) __PYX_ERR(0, 250, __pyx_L10_except_error) + __Pyx_XGOTREF(__pyx_t_3); + __Pyx_XGOTREF(__pyx_t_1); + __Pyx_XGOTREF(__pyx_t_4); + __pyx_t_2 = PyTuple_Pack(3, __pyx_t_3, __pyx_t_1, __pyx_t_4); if (unlikely(!__pyx_t_2)) __PYX_ERR(0, 250, __pyx_L10_except_error) + __Pyx_GOTREF(__pyx_t_2); + __pyx_t_11 = __Pyx_PyObject_Call(__pyx_t_7, __pyx_t_2, NULL); + __Pyx_DECREF(__pyx_t_7); __pyx_t_7 = 0; + __Pyx_DECREF(__pyx_t_2); __pyx_t_2 = 0; + if (unlikely(!__pyx_t_11)) __PYX_ERR(0, 250, __pyx_L10_except_error) + __Pyx_GOTREF(__pyx_t_11); + __pyx_t_6 = __Pyx_PyObject_IsTrue(__pyx_t_11); + __Pyx_DECREF(__pyx_t_11); __pyx_t_11 = 0; + if (__pyx_t_6 < (0)) __PYX_ERR(0, 250, __pyx_L10_except_error) + __pyx_t_12 = (!__pyx_t_6); + if (unlikely(__pyx_t_12)) { + __Pyx_GIVEREF(__pyx_t_3); + __Pyx_GIVEREF(__pyx_t_1); + __Pyx_XGIVEREF(__pyx_t_4); + __Pyx_ErrRestoreWithState(__pyx_t_3, __pyx_t_1, __pyx_t_4); + __pyx_t_3 = 0; __pyx_t_1 = 0; __pyx_t_4 = 0; + __PYX_ERR(0, 250, __pyx_L10_except_error) + } + __Pyx_XDECREF(__pyx_t_3); __pyx_t_3 = 0; + __Pyx_XDECREF(__pyx_t_1); __pyx_t_1 = 0; + __Pyx_XDECREF(__pyx_t_4); __pyx_t_4 = 0; + goto __pyx_L9_exception_handled; + } + __pyx_L10_except_error:; + __Pyx_XGIVEREF(__pyx_t_8); + __Pyx_XGIVEREF(__pyx_t_9); + __Pyx_XGIVEREF(__pyx_t_10); + __Pyx_ExceptionReset(__pyx_t_8, __pyx_t_9, __pyx_t_10); + goto __pyx_L1_error; + __pyx_L9_exception_handled:; + __Pyx_XGIVEREF(__pyx_t_8); + __Pyx_XGIVEREF(__pyx_t_9); + __Pyx_XGIVEREF(__pyx_t_10); + __Pyx_ExceptionReset(__pyx_t_8, __pyx_t_9, __pyx_t_10); + __pyx_L13_try_end:; + } + } + /*finally:*/ { + /*normal exit:*/{ + if (__pyx_t_7) { + __pyx_t_10 = __Pyx_PyObject_Call(__pyx_t_7, __pyx_mstate_global->__pyx_tuple[0], NULL); + __Pyx_DECREF(__pyx_t_7); __pyx_t_7 = 0; + if (unlikely(!__pyx_t_10)) __PYX_ERR(0, 250, __pyx_L1_error) + __Pyx_GOTREF(__pyx_t_10); + __Pyx_DECREF(__pyx_t_10); __pyx_t_10 = 0; + } + goto __pyx_L7; + } + __pyx_L7:; + } + goto __pyx_L17; + __pyx_L4_error:; + __Pyx_DECREF(__pyx_t_7); __pyx_t_7 = 0; + goto __pyx_L1_error; + __pyx_L17:; + } + + /* "spacy/pipeline/_edit_tree_internals/edit_trees.pyx":252 + * with path.open("rb") as file_: + * data = file_.read() + * return self.from_bytes(data) # <<<<<<<<<<<<<< + * + * return self +*/ + __Pyx_XDECREF(__pyx_r); + __pyx_t_1 = ((PyObject *)__pyx_v_self); + __Pyx_INCREF(__pyx_t_1); + if (unlikely(!__pyx_v_data)) { __Pyx_RaiseUnboundLocalError("data"); __PYX_ERR(0, 252, __pyx_L1_error) } + __pyx_t_5 = 0; + { + PyObject *__pyx_callargs[2] = {__pyx_t_1, __pyx_v_data}; + __pyx_t_4 = __Pyx_PyObject_FastCallMethod((PyObject*)__pyx_mstate_global->__pyx_n_u_from_bytes, __pyx_callargs+__pyx_t_5, (2-__pyx_t_5) | (1*__Pyx_PY_VECTORCALL_ARGUMENTS_OFFSET)); + __Pyx_XDECREF(__pyx_t_1); __pyx_t_1 = 0; + if (unlikely(!__pyx_t_4)) __PYX_ERR(0, 252, __pyx_L1_error) + __Pyx_GOTREF(__pyx_t_4); + } + __pyx_r = __pyx_t_4; + __pyx_t_4 = 0; + goto __pyx_L0; + + /* "spacy/pipeline/_edit_tree_internals/edit_trees.pyx":249 + * def from_disk(self, path, **kwargs) -> "EditTrees": + * path = util.ensure_path(path) + * if path.exists(): # <<<<<<<<<<<<<< + * with path.open("rb") as file_: + * data = file_.read() +*/ + } + + /* "spacy/pipeline/_edit_tree_internals/edit_trees.pyx":254 + * return self.from_bytes(data) + * + * return self # <<<<<<<<<<<<<< + * + * def __getitem__(self, idx): +*/ + __Pyx_XDECREF(__pyx_r); + __Pyx_INCREF((PyObject *)__pyx_v_self); + __pyx_r = ((PyObject *)__pyx_v_self); + goto __pyx_L0; + + /* "spacy/pipeline/_edit_tree_internals/edit_trees.pyx":247 + * file_.write(self.to_bytes()) + * + * def from_disk(self, path, **kwargs) -> "EditTrees": # <<<<<<<<<<<<<< + * path = util.ensure_path(path) + * if path.exists(): +*/ + + /* function exit code */ + __pyx_L1_error:; + __Pyx_XDECREF(__pyx_t_1); + __Pyx_XDECREF(__pyx_t_2); + __Pyx_XDECREF(__pyx_t_3); + __Pyx_XDECREF(__pyx_t_4); + __Pyx_AddTraceback("spacy.pipeline._edit_tree_internals.edit_trees.EditTrees.from_disk", __pyx_clineno, __pyx_lineno, __pyx_filename); + __pyx_r = NULL; + __pyx_L0:; + __Pyx_XDECREF(__pyx_v_file_); + __Pyx_XDECREF(__pyx_v_data); + __Pyx_XDECREF(__pyx_v_path); + __Pyx_XGIVEREF(__pyx_r); + __Pyx_RefNannyFinishContext(); + return __pyx_r; +} + +/* "spacy/pipeline/_edit_tree_internals/edit_trees.pyx":256 + * return self + * + * def __getitem__(self, idx): # <<<<<<<<<<<<<< + * return _tree2dict(self.trees[idx]) + * +*/ + +/* Python wrapper */ +static PyObject *__pyx_pw_5spacy_8pipeline_20_edit_tree_internals_10edit_trees_9EditTrees_19__getitem__(PyObject *__pyx_v_self, PyObject *__pyx_v_idx); /*proto*/ +static PyObject *__pyx_pw_5spacy_8pipeline_20_edit_tree_internals_10edit_trees_9EditTrees_19__getitem__(PyObject *__pyx_v_self, PyObject *__pyx_v_idx) { + CYTHON_UNUSED PyObject *const *__pyx_kwvalues; + PyObject *__pyx_r = 0; + __Pyx_RefNannyDeclarations + __Pyx_RefNannySetupContext("__getitem__ (wrapper)", 0); + __pyx_kwvalues = __Pyx_KwValues_VARARGS(__pyx_args, __pyx_nargs); + __pyx_r = __pyx_pf_5spacy_8pipeline_20_edit_tree_internals_10edit_trees_9EditTrees_18__getitem__(((struct __pyx_obj_5spacy_8pipeline_20_edit_tree_internals_10edit_trees_EditTrees *)__pyx_v_self), ((PyObject *)__pyx_v_idx)); + + /* function exit code */ + __Pyx_RefNannyFinishContext(); + return __pyx_r; +} + +static PyObject *__pyx_pf_5spacy_8pipeline_20_edit_tree_internals_10edit_trees_9EditTrees_18__getitem__(struct __pyx_obj_5spacy_8pipeline_20_edit_tree_internals_10edit_trees_EditTrees *__pyx_v_self, PyObject *__pyx_v_idx) { + PyObject *__pyx_r = NULL; + __Pyx_RefNannyDeclarations + PyObject *__pyx_t_1 = NULL; + PyObject *__pyx_t_2 = NULL; + PyObject *__pyx_t_3 = NULL; + std::vector ::size_type __pyx_t_4; + PyObject *__pyx_t_5 = NULL; + size_t __pyx_t_6; + int __pyx_lineno = 0; + const char *__pyx_filename = NULL; + int __pyx_clineno = 0; + __Pyx_RefNannySetupContext("__getitem__", 0); + + /* "spacy/pipeline/_edit_tree_internals/edit_trees.pyx":257 + * + * def __getitem__(self, idx): + * return _tree2dict(self.trees[idx]) # <<<<<<<<<<<<<< + * + * def __len__(self): +*/ + __Pyx_XDECREF(__pyx_r); + __pyx_t_2 = NULL; + __Pyx_GetModuleGlobalName(__pyx_t_3, __pyx_mstate_global->__pyx_n_u_tree2dict); if (unlikely(!__pyx_t_3)) __PYX_ERR(0, 257, __pyx_L1_error) + __Pyx_GOTREF(__pyx_t_3); + __pyx_t_4 = __Pyx_PyLong_As_size_t(__pyx_v_idx); if (unlikely((__pyx_t_4 == (size_t)-1) && PyErr_Occurred())) __PYX_ERR(0, 257, __pyx_L1_error) + __pyx_t_5 = __pyx_convert__to_py_struct____pyx_t_5spacy_8pipeline_20_edit_tree_internals_10edit_trees_EditTreeC((__pyx_v_self->trees[__pyx_t_4])); if (unlikely(!__pyx_t_5)) __PYX_ERR(0, 257, __pyx_L1_error) + __Pyx_GOTREF(__pyx_t_5); + __pyx_t_6 = 1; + #if CYTHON_UNPACK_METHODS + if (unlikely(PyMethod_Check(__pyx_t_3))) { + __pyx_t_2 = PyMethod_GET_SELF(__pyx_t_3); + assert(__pyx_t_2); + PyObject* __pyx__function = PyMethod_GET_FUNCTION(__pyx_t_3); + __Pyx_INCREF(__pyx_t_2); + __Pyx_INCREF(__pyx__function); + __Pyx_DECREF_SET(__pyx_t_3, __pyx__function); + __pyx_t_6 = 0; + } + #endif + { + PyObject *__pyx_callargs[2] = {__pyx_t_2, __pyx_t_5}; + __pyx_t_1 = __Pyx_PyObject_FastCall((PyObject*)__pyx_t_3, __pyx_callargs+__pyx_t_6, (2-__pyx_t_6) | (__pyx_t_6*__Pyx_PY_VECTORCALL_ARGUMENTS_OFFSET)); + __Pyx_XDECREF(__pyx_t_2); __pyx_t_2 = 0; + __Pyx_DECREF(__pyx_t_5); __pyx_t_5 = 0; + __Pyx_DECREF(__pyx_t_3); __pyx_t_3 = 0; + if (unlikely(!__pyx_t_1)) __PYX_ERR(0, 257, __pyx_L1_error) + __Pyx_GOTREF(__pyx_t_1); + } + __pyx_r = __pyx_t_1; + __pyx_t_1 = 0; + goto __pyx_L0; + + /* "spacy/pipeline/_edit_tree_internals/edit_trees.pyx":256 + * return self + * + * def __getitem__(self, idx): # <<<<<<<<<<<<<< + * return _tree2dict(self.trees[idx]) + * +*/ + + /* function exit code */ + __pyx_L1_error:; + __Pyx_XDECREF(__pyx_t_1); + __Pyx_XDECREF(__pyx_t_2); + __Pyx_XDECREF(__pyx_t_3); + __Pyx_XDECREF(__pyx_t_5); + __Pyx_AddTraceback("spacy.pipeline._edit_tree_internals.edit_trees.EditTrees.__getitem__", __pyx_clineno, __pyx_lineno, __pyx_filename); + __pyx_r = NULL; + __pyx_L0:; + __Pyx_XGIVEREF(__pyx_r); + __Pyx_RefNannyFinishContext(); + return __pyx_r; +} + +/* "spacy/pipeline/_edit_tree_internals/edit_trees.pyx":259 + * return _tree2dict(self.trees[idx]) + * + * def __len__(self): # <<<<<<<<<<<<<< + * return self.trees.size() + * +*/ + +/* Python wrapper */ +static Py_ssize_t __pyx_pw_5spacy_8pipeline_20_edit_tree_internals_10edit_trees_9EditTrees_21__len__(PyObject *__pyx_v_self); /*proto*/ +static Py_ssize_t __pyx_pw_5spacy_8pipeline_20_edit_tree_internals_10edit_trees_9EditTrees_21__len__(PyObject *__pyx_v_self) { + CYTHON_UNUSED PyObject *const *__pyx_kwvalues; + Py_ssize_t __pyx_r; + __Pyx_RefNannyDeclarations + __Pyx_RefNannySetupContext("__len__ (wrapper)", 0); + __pyx_kwvalues = __Pyx_KwValues_VARARGS(__pyx_args, __pyx_nargs); + __pyx_r = __pyx_pf_5spacy_8pipeline_20_edit_tree_internals_10edit_trees_9EditTrees_20__len__(((struct __pyx_obj_5spacy_8pipeline_20_edit_tree_internals_10edit_trees_EditTrees *)__pyx_v_self)); + + /* function exit code */ + __Pyx_RefNannyFinishContext(); + return __pyx_r; +} + +static Py_ssize_t __pyx_pf_5spacy_8pipeline_20_edit_tree_internals_10edit_trees_9EditTrees_20__len__(struct __pyx_obj_5spacy_8pipeline_20_edit_tree_internals_10edit_trees_EditTrees *__pyx_v_self) { + Py_ssize_t __pyx_r; + + /* "spacy/pipeline/_edit_tree_internals/edit_trees.pyx":260 + * + * def __len__(self): + * return self.trees.size() # <<<<<<<<<<<<<< + * + * def _rebuild_tree_map(self): +*/ + __pyx_r = __pyx_v_self->trees.size(); + goto __pyx_L0; + + /* "spacy/pipeline/_edit_tree_internals/edit_trees.pyx":259 + * return _tree2dict(self.trees[idx]) + * + * def __len__(self): # <<<<<<<<<<<<<< + * return self.trees.size() + * +*/ + + /* function exit code */ + __pyx_L0:; + return __pyx_r; +} + +/* "spacy/pipeline/_edit_tree_internals/edit_trees.pyx":262 + * return self.trees.size() + * + * def _rebuild_tree_map(self): # <<<<<<<<<<<<<< + * """Rebuild the tree hash -> tree id mapping""" + * cdef EditTreeC c_tree +*/ + +/* Python wrapper */ +static PyObject *__pyx_pw_5spacy_8pipeline_20_edit_tree_internals_10edit_trees_9EditTrees_23_rebuild_tree_map(PyObject *__pyx_v_self, +#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_5spacy_8pipeline_20_edit_tree_internals_10edit_trees_9EditTrees_22_rebuild_tree_map, "EditTrees._rebuild_tree_map(self)\n\nRebuild the tree hash -> tree id mapping"); +static PyMethodDef __pyx_mdef_5spacy_8pipeline_20_edit_tree_internals_10edit_trees_9EditTrees_23_rebuild_tree_map = {"_rebuild_tree_map", (PyCFunction)(void(*)(void))(__Pyx_PyCFunction_FastCallWithKeywords)__pyx_pw_5spacy_8pipeline_20_edit_tree_internals_10edit_trees_9EditTrees_23_rebuild_tree_map, __Pyx_METH_FASTCALL|METH_KEYWORDS, __pyx_doc_5spacy_8pipeline_20_edit_tree_internals_10edit_trees_9EditTrees_22_rebuild_tree_map}; +static PyObject *__pyx_pw_5spacy_8pipeline_20_edit_tree_internals_10edit_trees_9EditTrees_23_rebuild_tree_map(PyObject *__pyx_v_self, +#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("_rebuild_tree_map (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("_rebuild_tree_map", 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("_rebuild_tree_map", __pyx_kwds); return NULL;} + __pyx_r = __pyx_pf_5spacy_8pipeline_20_edit_tree_internals_10edit_trees_9EditTrees_22_rebuild_tree_map(((struct __pyx_obj_5spacy_8pipeline_20_edit_tree_internals_10edit_trees_EditTrees *)__pyx_v_self)); + + /* function exit code */ + __Pyx_RefNannyFinishContext(); + return __pyx_r; +} + +static PyObject *__pyx_pf_5spacy_8pipeline_20_edit_tree_internals_10edit_trees_9EditTrees_22_rebuild_tree_map(struct __pyx_obj_5spacy_8pipeline_20_edit_tree_internals_10edit_trees_EditTrees *__pyx_v_self) { + struct __pyx_t_5spacy_8pipeline_20_edit_tree_internals_10edit_trees_EditTreeC __pyx_v_c_tree; + uint32_t __pyx_v_tree_id; + __pyx_t_5spacy_8typedefs_hash_t __pyx_v_tree_hash; + PyObject *__pyx_r = NULL; + __Pyx_RefNannyDeclarations + std::vector ::size_type __pyx_t_1; + std::vector ::size_type __pyx_t_2; + uint32_t __pyx_t_3; + uint64_t __pyx_t_4; + std::pair<__pyx_t_5spacy_8typedefs_hash_t,uint32_t> __pyx_t_5; + int __pyx_lineno = 0; + const char *__pyx_filename = NULL; + int __pyx_clineno = 0; + __Pyx_RefNannySetupContext("_rebuild_tree_map", 0); + + /* "spacy/pipeline/_edit_tree_internals/edit_trees.pyx":268 + * cdef hash_t tree_hash + * + * self.map.clear() # <<<<<<<<<<<<<< + * + * for tree_id in range(self.trees.size()): +*/ + __pyx_v_self->map.clear(); + + /* "spacy/pipeline/_edit_tree_internals/edit_trees.pyx":270 + * self.map.clear() + * + * for tree_id in range(self.trees.size()): # <<<<<<<<<<<<<< + * c_tree = self.trees[tree_id] + * tree_hash = edittree_hash(c_tree) +*/ + __pyx_t_1 = __pyx_v_self->trees.size(); + __pyx_t_2 = __pyx_t_1; + for (__pyx_t_3 = 0; __pyx_t_3 < __pyx_t_2; __pyx_t_3+=1) { + __pyx_v_tree_id = __pyx_t_3; + + /* "spacy/pipeline/_edit_tree_internals/edit_trees.pyx":271 + * + * for tree_id in range(self.trees.size()): + * c_tree = self.trees[tree_id] # <<<<<<<<<<<<<< + * tree_hash = edittree_hash(c_tree) + * self.map.insert(pair[hash_t, uint32_t](tree_hash, tree_id)) +*/ + __pyx_v_c_tree = (__pyx_v_self->trees[__pyx_v_tree_id]); + + /* "spacy/pipeline/_edit_tree_internals/edit_trees.pyx":272 + * for tree_id in range(self.trees.size()): + * c_tree = self.trees[tree_id] + * tree_hash = edittree_hash(c_tree) # <<<<<<<<<<<<<< + * self.map.insert(pair[hash_t, uint32_t](tree_hash, tree_id)) + * +*/ + __pyx_t_4 = __pyx_f_5spacy_8pipeline_20_edit_tree_internals_10edit_trees_edittree_hash(__pyx_v_c_tree); if (unlikely(__pyx_t_4 == ((uint64_t)-1LL) && PyErr_Occurred())) __PYX_ERR(0, 272, __pyx_L1_error) + __pyx_v_tree_hash = __pyx_t_4; + + /* "spacy/pipeline/_edit_tree_internals/edit_trees.pyx":273 + * c_tree = self.trees[tree_id] + * tree_hash = edittree_hash(c_tree) + * self.map.insert(pair[hash_t, uint32_t](tree_hash, tree_id)) # <<<<<<<<<<<<<< + * + * def __reduce__(self): +*/ + try { + __pyx_t_5 = std::pair<__pyx_t_5spacy_8typedefs_hash_t,uint32_t> (__pyx_v_tree_hash, __pyx_v_tree_id); + } catch(...) { + __Pyx_CppExn2PyErr(); + __PYX_ERR(0, 273, __pyx_L1_error) + } + try { + __pyx_v_self->map.insert(__pyx_t_5); + } catch(...) { + __Pyx_CppExn2PyErr(); + __PYX_ERR(0, 273, __pyx_L1_error) + } + } + + /* "spacy/pipeline/_edit_tree_internals/edit_trees.pyx":262 + * return self.trees.size() + * + * def _rebuild_tree_map(self): # <<<<<<<<<<<<<< + * """Rebuild the tree hash -> tree id mapping""" + * cdef EditTreeC c_tree +*/ + + /* function exit code */ + __pyx_r = Py_None; __Pyx_INCREF(Py_None); + goto __pyx_L0; + __pyx_L1_error:; + __Pyx_AddTraceback("spacy.pipeline._edit_tree_internals.edit_trees.EditTrees._rebuild_tree_map", __pyx_clineno, __pyx_lineno, __pyx_filename); + __pyx_r = NULL; + __pyx_L0:; + __Pyx_XGIVEREF(__pyx_r); + __Pyx_RefNannyFinishContext(); + return __pyx_r; +} + +/* "spacy/pipeline/_edit_tree_internals/edit_trees.pyx":275 + * self.map.insert(pair[hash_t, uint32_t](tree_hash, tree_id)) + * + * def __reduce__(self): # <<<<<<<<<<<<<< + * return (unpickle_edittrees, (self.strings, self.to_bytes())) + * +*/ + +/* Python wrapper */ +static PyObject *__pyx_pw_5spacy_8pipeline_20_edit_tree_internals_10edit_trees_9EditTrees_25__reduce__(PyObject *__pyx_v_self, +#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_5spacy_8pipeline_20_edit_tree_internals_10edit_trees_9EditTrees_24__reduce__, "EditTrees.__reduce__(self)"); +static PyMethodDef __pyx_mdef_5spacy_8pipeline_20_edit_tree_internals_10edit_trees_9EditTrees_25__reduce__ = {"__reduce__", (PyCFunction)(void(*)(void))(__Pyx_PyCFunction_FastCallWithKeywords)__pyx_pw_5spacy_8pipeline_20_edit_tree_internals_10edit_trees_9EditTrees_25__reduce__, __Pyx_METH_FASTCALL|METH_KEYWORDS, __pyx_doc_5spacy_8pipeline_20_edit_tree_internals_10edit_trees_9EditTrees_24__reduce__}; +static PyObject *__pyx_pw_5spacy_8pipeline_20_edit_tree_internals_10edit_trees_9EditTrees_25__reduce__(PyObject *__pyx_v_self, +#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__ (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__", 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__", __pyx_kwds); return NULL;} + __pyx_r = __pyx_pf_5spacy_8pipeline_20_edit_tree_internals_10edit_trees_9EditTrees_24__reduce__(((struct __pyx_obj_5spacy_8pipeline_20_edit_tree_internals_10edit_trees_EditTrees *)__pyx_v_self)); + + /* function exit code */ + __Pyx_RefNannyFinishContext(); + return __pyx_r; +} + +static PyObject *__pyx_pf_5spacy_8pipeline_20_edit_tree_internals_10edit_trees_9EditTrees_24__reduce__(struct __pyx_obj_5spacy_8pipeline_20_edit_tree_internals_10edit_trees_EditTrees *__pyx_v_self) { + 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_lineno = 0; + const char *__pyx_filename = NULL; + int __pyx_clineno = 0; + __Pyx_RefNannySetupContext("__reduce__", 0); + + /* "spacy/pipeline/_edit_tree_internals/edit_trees.pyx":276 + * + * def __reduce__(self): + * return (unpickle_edittrees, (self.strings, self.to_bytes())) # <<<<<<<<<<<<<< + * + * +*/ + __Pyx_XDECREF(__pyx_r); + __Pyx_GetModuleGlobalName(__pyx_t_1, __pyx_mstate_global->__pyx_n_u_unpickle_edittrees); if (unlikely(!__pyx_t_1)) __PYX_ERR(0, 276, __pyx_L1_error) + __Pyx_GOTREF(__pyx_t_1); + __pyx_t_3 = ((PyObject *)__pyx_v_self); + __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_to_bytes, __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, 276, __pyx_L1_error) + __Pyx_GOTREF(__pyx_t_2); + } + __pyx_t_3 = PyTuple_New(2); if (unlikely(!__pyx_t_3)) __PYX_ERR(0, 276, __pyx_L1_error) + __Pyx_GOTREF(__pyx_t_3); + __Pyx_INCREF((PyObject *)__pyx_v_self->strings); + __Pyx_GIVEREF((PyObject *)__pyx_v_self->strings); + if (__Pyx_PyTuple_SET_ITEM(__pyx_t_3, 0, ((PyObject *)__pyx_v_self->strings)) != (0)) __PYX_ERR(0, 276, __pyx_L1_error); + __Pyx_GIVEREF(__pyx_t_2); + if (__Pyx_PyTuple_SET_ITEM(__pyx_t_3, 1, __pyx_t_2) != (0)) __PYX_ERR(0, 276, __pyx_L1_error); + __pyx_t_2 = 0; + __pyx_t_2 = PyTuple_New(2); if (unlikely(!__pyx_t_2)) __PYX_ERR(0, 276, __pyx_L1_error) + __Pyx_GOTREF(__pyx_t_2); + __Pyx_GIVEREF(__pyx_t_1); + if (__Pyx_PyTuple_SET_ITEM(__pyx_t_2, 0, __pyx_t_1) != (0)) __PYX_ERR(0, 276, __pyx_L1_error); + __Pyx_GIVEREF(__pyx_t_3); + if (__Pyx_PyTuple_SET_ITEM(__pyx_t_2, 1, __pyx_t_3) != (0)) __PYX_ERR(0, 276, __pyx_L1_error); + __pyx_t_1 = 0; + __pyx_t_3 = 0; + __pyx_r = __pyx_t_2; + __pyx_t_2 = 0; + goto __pyx_L0; + + /* "spacy/pipeline/_edit_tree_internals/edit_trees.pyx":275 + * self.map.insert(pair[hash_t, uint32_t](tree_hash, tree_id)) + * + * def __reduce__(self): # <<<<<<<<<<<<<< + * return (unpickle_edittrees, (self.strings, self.to_bytes())) + * +*/ + + /* function exit code */ + __pyx_L1_error:; + __Pyx_XDECREF(__pyx_t_1); + __Pyx_XDECREF(__pyx_t_2); + __Pyx_XDECREF(__pyx_t_3); + __Pyx_AddTraceback("spacy.pipeline._edit_tree_internals.edit_trees.EditTrees.__reduce__", __pyx_clineno, __pyx_lineno, __pyx_filename); + __pyx_r = NULL; + __pyx_L0:; + __Pyx_XGIVEREF(__pyx_r); + __Pyx_RefNannyFinishContext(); + return __pyx_r; +} + +/* "spacy/pipeline/_edit_tree_internals/edit_trees.pyx":279 + * + * + * def unpickle_edittrees(strings, trees_data): # <<<<<<<<<<<<<< + * return EditTrees(strings).from_bytes(trees_data) + * +*/ + +/* Python wrapper */ +static PyObject *__pyx_pw_5spacy_8pipeline_20_edit_tree_internals_10edit_trees_1unpickle_edittrees(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_5spacy_8pipeline_20_edit_tree_internals_10edit_trees_unpickle_edittrees, "unpickle_edittrees(strings, trees_data)"); +static PyMethodDef __pyx_mdef_5spacy_8pipeline_20_edit_tree_internals_10edit_trees_1unpickle_edittrees = {"unpickle_edittrees", (PyCFunction)(void(*)(void))(__Pyx_PyCFunction_FastCallWithKeywords)__pyx_pw_5spacy_8pipeline_20_edit_tree_internals_10edit_trees_1unpickle_edittrees, __Pyx_METH_FASTCALL|METH_KEYWORDS, __pyx_doc_5spacy_8pipeline_20_edit_tree_internals_10edit_trees_unpickle_edittrees}; +static PyObject *__pyx_pw_5spacy_8pipeline_20_edit_tree_internals_10edit_trees_1unpickle_edittrees(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 +) { + PyObject *__pyx_v_strings = 0; + PyObject *__pyx_v_trees_data = 0; + #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("unpickle_edittrees (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_strings,&__pyx_mstate_global->__pyx_n_u_trees_data,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, 279, __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, 279, __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, 279, __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, "unpickle_edittrees", 0) < (0)) __PYX_ERR(0, 279, __pyx_L3_error) + for (Py_ssize_t i = __pyx_nargs; i < 2; i++) { + if (unlikely(!values[i])) { __Pyx_RaiseArgtupleInvalid("unpickle_edittrees", 1, 2, 2, i); __PYX_ERR(0, 279, __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, 279, __pyx_L3_error) + values[1] = __Pyx_ArgRef_FASTCALL(__pyx_args, 1); + if (!CYTHON_ASSUME_SAFE_MACROS && unlikely(!values[1])) __PYX_ERR(0, 279, __pyx_L3_error) + } + __pyx_v_strings = values[0]; + __pyx_v_trees_data = values[1]; + } + goto __pyx_L6_skip; + __pyx_L5_argtuple_error:; + __Pyx_RaiseArgtupleInvalid("unpickle_edittrees", 1, 2, 2, __pyx_nargs); __PYX_ERR(0, 279, __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("spacy.pipeline._edit_tree_internals.edit_trees.unpickle_edittrees", __pyx_clineno, __pyx_lineno, __pyx_filename); + __Pyx_RefNannyFinishContext(); + return NULL; + __pyx_L4_argument_unpacking_done:; + __pyx_r = __pyx_pf_5spacy_8pipeline_20_edit_tree_internals_10edit_trees_unpickle_edittrees(__pyx_self, __pyx_v_strings, __pyx_v_trees_data); + + /* 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_5spacy_8pipeline_20_edit_tree_internals_10edit_trees_unpickle_edittrees(CYTHON_UNUSED PyObject *__pyx_self, PyObject *__pyx_v_strings, PyObject *__pyx_v_trees_data) { + PyObject *__pyx_r = NULL; + __Pyx_RefNannyDeclarations + PyObject *__pyx_t_1 = NULL; + PyObject *__pyx_t_2 = NULL; + PyObject *__pyx_t_3 = NULL; + PyObject *__pyx_t_4 = NULL; + size_t __pyx_t_5; + int __pyx_lineno = 0; + const char *__pyx_filename = NULL; + int __pyx_clineno = 0; + __Pyx_RefNannySetupContext("unpickle_edittrees", 0); + + /* "spacy/pipeline/_edit_tree_internals/edit_trees.pyx":280 + * + * def unpickle_edittrees(strings, trees_data): + * return EditTrees(strings).from_bytes(trees_data) # <<<<<<<<<<<<<< + * + * +*/ + __Pyx_XDECREF(__pyx_r); + __pyx_t_4 = NULL; + __pyx_t_5 = 1; + { + PyObject *__pyx_callargs[2] = {__pyx_t_4, __pyx_v_strings}; + __pyx_t_3 = __Pyx_PyObject_FastCall((PyObject*)__pyx_mstate_global->__pyx_ptype_5spacy_8pipeline_20_edit_tree_internals_10edit_trees_EditTrees, __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, 280, __pyx_L1_error) + __Pyx_GOTREF((PyObject *)__pyx_t_3); + } + __pyx_t_2 = ((PyObject *)__pyx_t_3); + __Pyx_INCREF(__pyx_t_2); + __pyx_t_5 = 0; + { + PyObject *__pyx_callargs[2] = {__pyx_t_2, __pyx_v_trees_data}; + __pyx_t_1 = __Pyx_PyObject_FastCallMethod((PyObject*)__pyx_mstate_global->__pyx_n_u_from_bytes, __pyx_callargs+__pyx_t_5, (2-__pyx_t_5) | (1*__Pyx_PY_VECTORCALL_ARGUMENTS_OFFSET)); + __Pyx_XDECREF(__pyx_t_2); __pyx_t_2 = 0; + __Pyx_DECREF((PyObject *)__pyx_t_3); __pyx_t_3 = 0; + if (unlikely(!__pyx_t_1)) __PYX_ERR(0, 280, __pyx_L1_error) + __Pyx_GOTREF(__pyx_t_1); + } + __pyx_r = __pyx_t_1; + __pyx_t_1 = 0; + goto __pyx_L0; + + /* "spacy/pipeline/_edit_tree_internals/edit_trees.pyx":279 + * + * + * def unpickle_edittrees(strings, trees_data): # <<<<<<<<<<<<<< + * return EditTrees(strings).from_bytes(trees_data) + * +*/ + + /* function exit code */ + __pyx_L1_error:; + __Pyx_XDECREF(__pyx_t_1); + __Pyx_XDECREF(__pyx_t_2); + __Pyx_XDECREF(__pyx_t_3); + __Pyx_XDECREF(__pyx_t_4); + __Pyx_AddTraceback("spacy.pipeline._edit_tree_internals.edit_trees.unpickle_edittrees", __pyx_clineno, __pyx_lineno, __pyx_filename); + __pyx_r = NULL; + __pyx_L0:; + __Pyx_XGIVEREF(__pyx_r); + __Pyx_RefNannyFinishContext(); + return __pyx_r; +} + +/* "spacy/pipeline/_edit_tree_internals/edit_trees.pyx":283 + * + * + * def _tree2dict(tree): # <<<<<<<<<<<<<< + * if tree["is_match_node"]: + * tree = tree["inner"]["match_node"] +*/ + +/* Python wrapper */ +static PyObject *__pyx_pw_5spacy_8pipeline_20_edit_tree_internals_10edit_trees_3_tree2dict(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_5spacy_8pipeline_20_edit_tree_internals_10edit_trees_2_tree2dict, "_tree2dict(tree)"); +static PyMethodDef __pyx_mdef_5spacy_8pipeline_20_edit_tree_internals_10edit_trees_3_tree2dict = {"_tree2dict", (PyCFunction)(void(*)(void))(__Pyx_PyCFunction_FastCallWithKeywords)__pyx_pw_5spacy_8pipeline_20_edit_tree_internals_10edit_trees_3_tree2dict, __Pyx_METH_FASTCALL|METH_KEYWORDS, __pyx_doc_5spacy_8pipeline_20_edit_tree_internals_10edit_trees_2_tree2dict}; +static PyObject *__pyx_pw_5spacy_8pipeline_20_edit_tree_internals_10edit_trees_3_tree2dict(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 +) { + PyObject *__pyx_v_tree = 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("_tree2dict (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_tree,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, 283, __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, 283, __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, "_tree2dict", 0) < (0)) __PYX_ERR(0, 283, __pyx_L3_error) + for (Py_ssize_t i = __pyx_nargs; i < 1; i++) { + if (unlikely(!values[i])) { __Pyx_RaiseArgtupleInvalid("_tree2dict", 1, 1, 1, i); __PYX_ERR(0, 283, __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, 283, __pyx_L3_error) + } + __pyx_v_tree = values[0]; + } + goto __pyx_L6_skip; + __pyx_L5_argtuple_error:; + __Pyx_RaiseArgtupleInvalid("_tree2dict", 1, 1, 1, __pyx_nargs); __PYX_ERR(0, 283, __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("spacy.pipeline._edit_tree_internals.edit_trees._tree2dict", __pyx_clineno, __pyx_lineno, __pyx_filename); + __Pyx_RefNannyFinishContext(); + return NULL; + __pyx_L4_argument_unpacking_done:; + __pyx_r = __pyx_pf_5spacy_8pipeline_20_edit_tree_internals_10edit_trees_2_tree2dict(__pyx_self, __pyx_v_tree); + + /* 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_5spacy_8pipeline_20_edit_tree_internals_10edit_trees_2_tree2dict(CYTHON_UNUSED PyObject *__pyx_self, PyObject *__pyx_v_tree) { + PyObject *__pyx_r = NULL; + __Pyx_RefNannyDeclarations + PyObject *__pyx_t_1 = NULL; + int __pyx_t_2; + 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("_tree2dict", 0); + __Pyx_INCREF(__pyx_v_tree); + + /* "spacy/pipeline/_edit_tree_internals/edit_trees.pyx":284 + * + * def _tree2dict(tree): + * if tree["is_match_node"]: # <<<<<<<<<<<<<< + * tree = tree["inner"]["match_node"] + * else: +*/ + __pyx_t_1 = __Pyx_PyObject_Dict_GetItem(__pyx_v_tree, __pyx_mstate_global->__pyx_n_u_is_match_node); if (unlikely(!__pyx_t_1)) __PYX_ERR(0, 284, __pyx_L1_error) + __Pyx_GOTREF(__pyx_t_1); + __pyx_t_2 = __Pyx_PyObject_IsTrue(__pyx_t_1); if (unlikely((__pyx_t_2 < 0))) __PYX_ERR(0, 284, __pyx_L1_error) + __Pyx_DECREF(__pyx_t_1); __pyx_t_1 = 0; + if (__pyx_t_2) { + + /* "spacy/pipeline/_edit_tree_internals/edit_trees.pyx":285 + * def _tree2dict(tree): + * if tree["is_match_node"]: + * tree = tree["inner"]["match_node"] # <<<<<<<<<<<<<< + * else: + * tree = tree["inner"]["subst_node"] +*/ + __pyx_t_1 = __Pyx_PyObject_Dict_GetItem(__pyx_v_tree, __pyx_mstate_global->__pyx_n_u_inner); if (unlikely(!__pyx_t_1)) __PYX_ERR(0, 285, __pyx_L1_error) + __Pyx_GOTREF(__pyx_t_1); + __pyx_t_3 = __Pyx_PyObject_Dict_GetItem(__pyx_t_1, __pyx_mstate_global->__pyx_n_u_match_node); if (unlikely(!__pyx_t_3)) __PYX_ERR(0, 285, __pyx_L1_error) + __Pyx_GOTREF(__pyx_t_3); + __Pyx_DECREF(__pyx_t_1); __pyx_t_1 = 0; + __Pyx_DECREF_SET(__pyx_v_tree, __pyx_t_3); + __pyx_t_3 = 0; + + /* "spacy/pipeline/_edit_tree_internals/edit_trees.pyx":284 + * + * def _tree2dict(tree): + * if tree["is_match_node"]: # <<<<<<<<<<<<<< + * tree = tree["inner"]["match_node"] + * else: +*/ + goto __pyx_L3; + } + + /* "spacy/pipeline/_edit_tree_internals/edit_trees.pyx":287 + * tree = tree["inner"]["match_node"] + * else: + * tree = tree["inner"]["subst_node"] # <<<<<<<<<<<<<< + * return(dict(tree)) + * +*/ + /*else*/ { + __pyx_t_3 = __Pyx_PyObject_Dict_GetItem(__pyx_v_tree, __pyx_mstate_global->__pyx_n_u_inner); if (unlikely(!__pyx_t_3)) __PYX_ERR(0, 287, __pyx_L1_error) + __Pyx_GOTREF(__pyx_t_3); + __pyx_t_1 = __Pyx_PyObject_Dict_GetItem(__pyx_t_3, __pyx_mstate_global->__pyx_n_u_subst_node); if (unlikely(!__pyx_t_1)) __PYX_ERR(0, 287, __pyx_L1_error) + __Pyx_GOTREF(__pyx_t_1); + __Pyx_DECREF(__pyx_t_3); __pyx_t_3 = 0; + __Pyx_DECREF_SET(__pyx_v_tree, __pyx_t_1); + __pyx_t_1 = 0; + } + __pyx_L3:; + + /* "spacy/pipeline/_edit_tree_internals/edit_trees.pyx":288 + * else: + * tree = tree["inner"]["subst_node"] + * return(dict(tree)) # <<<<<<<<<<<<<< + * + * +*/ + __Pyx_XDECREF(__pyx_r); + __pyx_t_3 = NULL; + __pyx_t_4 = 1; + { + PyObject *__pyx_callargs[2] = {__pyx_t_3, __pyx_v_tree}; + __pyx_t_1 = __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_3); __pyx_t_3 = 0; + if (unlikely(!__pyx_t_1)) __PYX_ERR(0, 288, __pyx_L1_error) + __Pyx_GOTREF(__pyx_t_1); + } + __pyx_r = __pyx_t_1; + __pyx_t_1 = 0; + goto __pyx_L0; + + /* "spacy/pipeline/_edit_tree_internals/edit_trees.pyx":283 + * + * + * def _tree2dict(tree): # <<<<<<<<<<<<<< + * if tree["is_match_node"]: + * tree = tree["inner"]["match_node"] +*/ + + /* function exit code */ + __pyx_L1_error:; + __Pyx_XDECREF(__pyx_t_1); + __Pyx_XDECREF(__pyx_t_3); + __Pyx_AddTraceback("spacy.pipeline._edit_tree_internals.edit_trees._tree2dict", __pyx_clineno, __pyx_lineno, __pyx_filename); + __pyx_r = NULL; + __pyx_L0:; + __Pyx_XDECREF(__pyx_v_tree); + __Pyx_XGIVEREF(__pyx_r); + __Pyx_RefNannyFinishContext(); + return __pyx_r; +} + +/* "spacy/pipeline/_edit_tree_internals/edit_trees.pyx":291 + * + * + * def _dict2tree(tree): # <<<<<<<<<<<<<< + * errors = validate_edit_tree(tree) + * if errors: +*/ + +/* Python wrapper */ +static PyObject *__pyx_pw_5spacy_8pipeline_20_edit_tree_internals_10edit_trees_5_dict2tree(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_5spacy_8pipeline_20_edit_tree_internals_10edit_trees_4_dict2tree, "_dict2tree(tree)"); +static PyMethodDef __pyx_mdef_5spacy_8pipeline_20_edit_tree_internals_10edit_trees_5_dict2tree = {"_dict2tree", (PyCFunction)(void(*)(void))(__Pyx_PyCFunction_FastCallWithKeywords)__pyx_pw_5spacy_8pipeline_20_edit_tree_internals_10edit_trees_5_dict2tree, __Pyx_METH_FASTCALL|METH_KEYWORDS, __pyx_doc_5spacy_8pipeline_20_edit_tree_internals_10edit_trees_4_dict2tree}; +static PyObject *__pyx_pw_5spacy_8pipeline_20_edit_tree_internals_10edit_trees_5_dict2tree(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 +) { + PyObject *__pyx_v_tree = 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("_dict2tree (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_tree,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, 291, __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, 291, __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, "_dict2tree", 0) < (0)) __PYX_ERR(0, 291, __pyx_L3_error) + for (Py_ssize_t i = __pyx_nargs; i < 1; i++) { + if (unlikely(!values[i])) { __Pyx_RaiseArgtupleInvalid("_dict2tree", 1, 1, 1, i); __PYX_ERR(0, 291, __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, 291, __pyx_L3_error) + } + __pyx_v_tree = values[0]; + } + goto __pyx_L6_skip; + __pyx_L5_argtuple_error:; + __Pyx_RaiseArgtupleInvalid("_dict2tree", 1, 1, 1, __pyx_nargs); __PYX_ERR(0, 291, __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("spacy.pipeline._edit_tree_internals.edit_trees._dict2tree", __pyx_clineno, __pyx_lineno, __pyx_filename); + __Pyx_RefNannyFinishContext(); + return NULL; + __pyx_L4_argument_unpacking_done:; + __pyx_r = __pyx_pf_5spacy_8pipeline_20_edit_tree_internals_10edit_trees_4_dict2tree(__pyx_self, __pyx_v_tree); + + /* 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_5spacy_8pipeline_20_edit_tree_internals_10edit_trees_4_dict2tree(CYTHON_UNUSED PyObject *__pyx_self, PyObject *__pyx_v_tree) { + PyObject *__pyx_v_errors = 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; + PyObject *__pyx_t_6 = NULL; + PyObject *__pyx_t_7 = NULL; + PyObject *__pyx_t_8 = NULL; + PyObject *__pyx_t_9 = NULL; + int __pyx_lineno = 0; + const char *__pyx_filename = NULL; + int __pyx_clineno = 0; + __Pyx_RefNannySetupContext("_dict2tree", 0); + __Pyx_INCREF(__pyx_v_tree); + + /* "spacy/pipeline/_edit_tree_internals/edit_trees.pyx":292 + * + * def _dict2tree(tree): + * errors = validate_edit_tree(tree) # <<<<<<<<<<<<<< + * if errors: + * raise ValueError(Errors.E1026.format(errors="\n".join(errors))) +*/ + __pyx_t_2 = NULL; + __Pyx_GetModuleGlobalName(__pyx_t_3, __pyx_mstate_global->__pyx_n_u_validate_edit_tree); if (unlikely(!__pyx_t_3)) __PYX_ERR(0, 292, __pyx_L1_error) + __Pyx_GOTREF(__pyx_t_3); + __pyx_t_4 = 1; + #if CYTHON_UNPACK_METHODS + if (unlikely(PyMethod_Check(__pyx_t_3))) { + __pyx_t_2 = PyMethod_GET_SELF(__pyx_t_3); + assert(__pyx_t_2); + PyObject* __pyx__function = PyMethod_GET_FUNCTION(__pyx_t_3); + __Pyx_INCREF(__pyx_t_2); + __Pyx_INCREF(__pyx__function); + __Pyx_DECREF_SET(__pyx_t_3, __pyx__function); + __pyx_t_4 = 0; + } + #endif + { + PyObject *__pyx_callargs[2] = {__pyx_t_2, __pyx_v_tree}; + __pyx_t_1 = __Pyx_PyObject_FastCall((PyObject*)__pyx_t_3, __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, 292, __pyx_L1_error) + __Pyx_GOTREF(__pyx_t_1); + } + __pyx_v_errors = __pyx_t_1; + __pyx_t_1 = 0; + + /* "spacy/pipeline/_edit_tree_internals/edit_trees.pyx":293 + * def _dict2tree(tree): + * errors = validate_edit_tree(tree) + * if errors: # <<<<<<<<<<<<<< + * raise ValueError(Errors.E1026.format(errors="\n".join(errors))) + * +*/ + __pyx_t_5 = __Pyx_PyObject_IsTrue(__pyx_v_errors); if (unlikely((__pyx_t_5 < 0))) __PYX_ERR(0, 293, __pyx_L1_error) + if (unlikely(__pyx_t_5)) { + + /* "spacy/pipeline/_edit_tree_internals/edit_trees.pyx":294 + * errors = validate_edit_tree(tree) + * if errors: + * raise ValueError(Errors.E1026.format(errors="\n".join(errors))) # <<<<<<<<<<<<<< + * + * tree = dict(tree) +*/ + __pyx_t_3 = NULL; + __Pyx_GetModuleGlobalName(__pyx_t_7, __pyx_mstate_global->__pyx_n_u_Errors); if (unlikely(!__pyx_t_7)) __PYX_ERR(0, 294, __pyx_L1_error) + __Pyx_GOTREF(__pyx_t_7); + __pyx_t_8 = __Pyx_PyObject_GetAttrStr(__pyx_t_7, __pyx_mstate_global->__pyx_n_u_E1026); if (unlikely(!__pyx_t_8)) __PYX_ERR(0, 294, __pyx_L1_error) + __Pyx_GOTREF(__pyx_t_8); + __Pyx_DECREF(__pyx_t_7); __pyx_t_7 = 0; + __pyx_t_6 = __pyx_t_8; + __Pyx_INCREF(__pyx_t_6); + __pyx_t_7 = PyUnicode_Join(__pyx_mstate_global->__pyx_kp_u__7, __pyx_v_errors); if (unlikely(!__pyx_t_7)) __PYX_ERR(0, 294, __pyx_L1_error) + __Pyx_GOTREF(__pyx_t_7); + __pyx_t_4 = 0; + { + PyObject *__pyx_callargs[2 + ((CYTHON_VECTORCALL) ? 1 : 0)] = {__pyx_t_6, NULL}; + __pyx_t_9 = __Pyx_MakeVectorcallBuilderKwds(1); if (unlikely(!__pyx_t_9)) __PYX_ERR(0, 294, __pyx_L1_error) + __Pyx_GOTREF(__pyx_t_9); + if (__Pyx_VectorcallBuilder_AddArg(__pyx_mstate_global->__pyx_n_u_errors, __pyx_t_7, __pyx_t_9, __pyx_callargs+1, 0) < (0)) __PYX_ERR(0, 294, __pyx_L1_error) + __pyx_t_2 = __Pyx_Object_VectorcallMethod_CallFromBuilder((PyObject*)__pyx_mstate_global->__pyx_n_u_format, __pyx_callargs+__pyx_t_4, (1-__pyx_t_4) | (1*__Pyx_PY_VECTORCALL_ARGUMENTS_OFFSET), __pyx_t_9); + __Pyx_XDECREF(__pyx_t_6); __pyx_t_6 = 0; + __Pyx_DECREF(__pyx_t_7); __pyx_t_7 = 0; + __Pyx_DECREF(__pyx_t_9); __pyx_t_9 = 0; + __Pyx_DECREF(__pyx_t_8); __pyx_t_8 = 0; + if (unlikely(!__pyx_t_2)) __PYX_ERR(0, 294, __pyx_L1_error) + __Pyx_GOTREF(__pyx_t_2); + } + __pyx_t_4 = 1; + { + PyObject *__pyx_callargs[2] = {__pyx_t_3, __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_3); __pyx_t_3 = 0; + __Pyx_DECREF(__pyx_t_2); __pyx_t_2 = 0; + if (unlikely(!__pyx_t_1)) __PYX_ERR(0, 294, __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, 294, __pyx_L1_error) + + /* "spacy/pipeline/_edit_tree_internals/edit_trees.pyx":293 + * def _dict2tree(tree): + * errors = validate_edit_tree(tree) + * if errors: # <<<<<<<<<<<<<< + * raise ValueError(Errors.E1026.format(errors="\n".join(errors))) + * +*/ + } + + /* "spacy/pipeline/_edit_tree_internals/edit_trees.pyx":296 + * raise ValueError(Errors.E1026.format(errors="\n".join(errors))) + * + * tree = dict(tree) # <<<<<<<<<<<<<< + * if "prefix_len" in tree: + * tree = {"is_match_node": True, "inner": {"match_node": tree}} +*/ + __pyx_t_2 = NULL; + __pyx_t_4 = 1; + { + PyObject *__pyx_callargs[2] = {__pyx_t_2, __pyx_v_tree}; + __pyx_t_1 = __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; + if (unlikely(!__pyx_t_1)) __PYX_ERR(0, 296, __pyx_L1_error) + __Pyx_GOTREF(__pyx_t_1); + } + __Pyx_DECREF_SET(__pyx_v_tree, __pyx_t_1); + __pyx_t_1 = 0; + + /* "spacy/pipeline/_edit_tree_internals/edit_trees.pyx":297 + * + * tree = dict(tree) + * if "prefix_len" in tree: # <<<<<<<<<<<<<< + * tree = {"is_match_node": True, "inner": {"match_node": tree}} + * else: +*/ + __pyx_t_5 = (__Pyx_PySequence_ContainsTF(__pyx_mstate_global->__pyx_n_u_prefix_len, __pyx_v_tree, Py_EQ)); if (unlikely((__pyx_t_5 < 0))) __PYX_ERR(0, 297, __pyx_L1_error) + if (__pyx_t_5) { + + /* "spacy/pipeline/_edit_tree_internals/edit_trees.pyx":298 + * tree = dict(tree) + * if "prefix_len" in tree: + * tree = {"is_match_node": True, "inner": {"match_node": tree}} # <<<<<<<<<<<<<< + * else: + * tree = {"is_match_node": False, "inner": {"subst_node": tree}} +*/ + __pyx_t_1 = __Pyx_PyDict_NewPresized(2); if (unlikely(!__pyx_t_1)) __PYX_ERR(0, 298, __pyx_L1_error) + __Pyx_GOTREF(__pyx_t_1); + if (PyDict_SetItem(__pyx_t_1, __pyx_mstate_global->__pyx_n_u_is_match_node, Py_True) < (0)) __PYX_ERR(0, 298, __pyx_L1_error) + __pyx_t_2 = __Pyx_PyDict_NewPresized(1); if (unlikely(!__pyx_t_2)) __PYX_ERR(0, 298, __pyx_L1_error) + __Pyx_GOTREF(__pyx_t_2); + if (PyDict_SetItem(__pyx_t_2, __pyx_mstate_global->__pyx_n_u_match_node, __pyx_v_tree) < (0)) __PYX_ERR(0, 298, __pyx_L1_error) + if (PyDict_SetItem(__pyx_t_1, __pyx_mstate_global->__pyx_n_u_inner, __pyx_t_2) < (0)) __PYX_ERR(0, 298, __pyx_L1_error) + __Pyx_DECREF(__pyx_t_2); __pyx_t_2 = 0; + __Pyx_DECREF_SET(__pyx_v_tree, __pyx_t_1); + __pyx_t_1 = 0; + + /* "spacy/pipeline/_edit_tree_internals/edit_trees.pyx":297 + * + * tree = dict(tree) + * if "prefix_len" in tree: # <<<<<<<<<<<<<< + * tree = {"is_match_node": True, "inner": {"match_node": tree}} + * else: +*/ + goto __pyx_L4; + } + + /* "spacy/pipeline/_edit_tree_internals/edit_trees.pyx":300 + * tree = {"is_match_node": True, "inner": {"match_node": tree}} + * else: + * tree = {"is_match_node": False, "inner": {"subst_node": tree}} # <<<<<<<<<<<<<< + * + * return tree +*/ + /*else*/ { + __pyx_t_1 = __Pyx_PyDict_NewPresized(2); if (unlikely(!__pyx_t_1)) __PYX_ERR(0, 300, __pyx_L1_error) + __Pyx_GOTREF(__pyx_t_1); + if (PyDict_SetItem(__pyx_t_1, __pyx_mstate_global->__pyx_n_u_is_match_node, Py_False) < (0)) __PYX_ERR(0, 300, __pyx_L1_error) + __pyx_t_2 = __Pyx_PyDict_NewPresized(1); if (unlikely(!__pyx_t_2)) __PYX_ERR(0, 300, __pyx_L1_error) + __Pyx_GOTREF(__pyx_t_2); + if (PyDict_SetItem(__pyx_t_2, __pyx_mstate_global->__pyx_n_u_subst_node, __pyx_v_tree) < (0)) __PYX_ERR(0, 300, __pyx_L1_error) + if (PyDict_SetItem(__pyx_t_1, __pyx_mstate_global->__pyx_n_u_inner, __pyx_t_2) < (0)) __PYX_ERR(0, 300, __pyx_L1_error) + __Pyx_DECREF(__pyx_t_2); __pyx_t_2 = 0; + __Pyx_DECREF_SET(__pyx_v_tree, __pyx_t_1); + __pyx_t_1 = 0; + } + __pyx_L4:; + + /* "spacy/pipeline/_edit_tree_internals/edit_trees.pyx":302 + * tree = {"is_match_node": False, "inner": {"subst_node": tree}} + * + * return tree # <<<<<<<<<<<<<< +*/ + __Pyx_XDECREF(__pyx_r); + __Pyx_INCREF(__pyx_v_tree); + __pyx_r = __pyx_v_tree; + goto __pyx_L0; + + /* "spacy/pipeline/_edit_tree_internals/edit_trees.pyx":291 + * + * + * def _dict2tree(tree): # <<<<<<<<<<<<<< + * errors = validate_edit_tree(tree) + * if errors: +*/ + + /* function exit code */ + __pyx_L1_error:; + __Pyx_XDECREF(__pyx_t_1); + __Pyx_XDECREF(__pyx_t_2); + __Pyx_XDECREF(__pyx_t_3); + __Pyx_XDECREF(__pyx_t_6); + __Pyx_XDECREF(__pyx_t_7); + __Pyx_XDECREF(__pyx_t_8); + __Pyx_XDECREF(__pyx_t_9); + __Pyx_AddTraceback("spacy.pipeline._edit_tree_internals.edit_trees._dict2tree", __pyx_clineno, __pyx_lineno, __pyx_filename); + __pyx_r = NULL; + __pyx_L0:; + __Pyx_XDECREF(__pyx_v_errors); + __Pyx_XDECREF(__pyx_v_tree); + __Pyx_XGIVEREF(__pyx_r); + __Pyx_RefNannyFinishContext(); + return __pyx_r; +} +/* #### Code section: module_exttypes ### */ +static struct __pyx_vtabstruct_5spacy_8pipeline_20_edit_tree_internals_10edit_trees_EditTrees __pyx_vtable_5spacy_8pipeline_20_edit_tree_internals_10edit_trees_EditTrees; + +static PyObject *__pyx_tp_new_5spacy_8pipeline_20_edit_tree_internals_10edit_trees_EditTrees(PyTypeObject *t, CYTHON_UNUSED PyObject *a, CYTHON_UNUSED PyObject *k) { + struct __pyx_obj_5spacy_8pipeline_20_edit_tree_internals_10edit_trees_EditTrees *p; + PyObject *o; + o = __Pyx_AllocateExtensionType(t, 0); + if (unlikely(!o)) return 0; + p = ((struct __pyx_obj_5spacy_8pipeline_20_edit_tree_internals_10edit_trees_EditTrees *)o); + p->__pyx_vtab = __pyx_vtabptr_5spacy_8pipeline_20_edit_tree_internals_10edit_trees_EditTrees; + __Pyx_default_placement_construct(&(p->trees)); + __Pyx_default_placement_construct(&(p->map)); + p->strings = ((struct __pyx_obj_5spacy_7strings_StringStore *)Py_None); Py_INCREF(Py_None); + return o; +} + +static void __pyx_tp_dealloc_5spacy_8pipeline_20_edit_tree_internals_10edit_trees_EditTrees(PyObject *o) { + struct __pyx_obj_5spacy_8pipeline_20_edit_tree_internals_10edit_trees_EditTrees *p = (struct __pyx_obj_5spacy_8pipeline_20_edit_tree_internals_10edit_trees_EditTrees *)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_5spacy_8pipeline_20_edit_tree_internals_10edit_trees_EditTrees) { + if (PyObject_CallFinalizerFromDealloc(o)) return; + } + } + #endif + PyObject_GC_UnTrack(o); + __Pyx_call_destructor(p->trees); + __Pyx_call_destructor(p->map); + Py_CLEAR(p->strings); + 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_5spacy_8pipeline_20_edit_tree_internals_10edit_trees_EditTrees(PyObject *o, visitproc v, void *a) { + int e; + struct __pyx_obj_5spacy_8pipeline_20_edit_tree_internals_10edit_trees_EditTrees *p = (struct __pyx_obj_5spacy_8pipeline_20_edit_tree_internals_10edit_trees_EditTrees *)o; + { + e = __Pyx_call_type_traverse(o, 1, v, a); + if (e) return e; + } + if (p->strings) { + e = (*v)(((PyObject *)p->strings), a); if (e) return e; + } + return 0; +} + +static int __pyx_tp_clear_5spacy_8pipeline_20_edit_tree_internals_10edit_trees_EditTrees(PyObject *o) { + PyObject* tmp; + struct __pyx_obj_5spacy_8pipeline_20_edit_tree_internals_10edit_trees_EditTrees *p = (struct __pyx_obj_5spacy_8pipeline_20_edit_tree_internals_10edit_trees_EditTrees *)o; + tmp = ((PyObject*)p->strings); + p->strings = ((struct __pyx_obj_5spacy_7strings_StringStore *)Py_None); Py_INCREF(Py_None); + Py_XDECREF(tmp); + return 0; +} + +static PyObject *__pyx_sq_item_5spacy_8pipeline_20_edit_tree_internals_10edit_trees_EditTrees(PyObject *o, Py_ssize_t i) { + PyObject *r; + PyObject *x = PyLong_FromSsize_t(i); if(!x) return 0; + #if CYTHON_USE_TYPE_SLOTS || (!CYTHON_USE_TYPE_SPECS && __PYX_LIMITED_VERSION_HEX < 0x030A0000) + r = Py_TYPE(o)->tp_as_mapping->mp_subscript(o, x); + #else + r = ((binaryfunc)PyType_GetSlot(Py_TYPE(o), Py_mp_subscript))(o, x); + #endif + Py_DECREF(x); + return r; +} + +static PyMethodDef __pyx_methods_5spacy_8pipeline_20_edit_tree_internals_10edit_trees_EditTrees[] = { + {"from_json", (PyCFunction)(void(*)(void))(__Pyx_PyCFunction_FastCallWithKeywords)__pyx_pw_5spacy_8pipeline_20_edit_tree_internals_10edit_trees_9EditTrees_9from_json, __Pyx_METH_FASTCALL|METH_KEYWORDS, __pyx_doc_5spacy_8pipeline_20_edit_tree_internals_10edit_trees_9EditTrees_8from_json}, + {"from_bytes", (PyCFunction)(void(*)(void))(__Pyx_PyCFunction_FastCallWithKeywords)__pyx_pw_5spacy_8pipeline_20_edit_tree_internals_10edit_trees_9EditTrees_11from_bytes, __Pyx_METH_FASTCALL|METH_KEYWORDS, __pyx_doc_5spacy_8pipeline_20_edit_tree_internals_10edit_trees_9EditTrees_10from_bytes}, + {"to_bytes", (PyCFunction)(void(*)(void))(__Pyx_PyCFunction_FastCallWithKeywords)__pyx_pw_5spacy_8pipeline_20_edit_tree_internals_10edit_trees_9EditTrees_13to_bytes, __Pyx_METH_FASTCALL|METH_KEYWORDS, __pyx_doc_5spacy_8pipeline_20_edit_tree_internals_10edit_trees_9EditTrees_12to_bytes}, + {"to_disk", (PyCFunction)(void(*)(void))(__Pyx_PyCFunction_FastCallWithKeywords)__pyx_pw_5spacy_8pipeline_20_edit_tree_internals_10edit_trees_9EditTrees_15to_disk, __Pyx_METH_FASTCALL|METH_KEYWORDS, __pyx_doc_5spacy_8pipeline_20_edit_tree_internals_10edit_trees_9EditTrees_14to_disk}, + {"from_disk", (PyCFunction)(void(*)(void))(__Pyx_PyCFunction_FastCallWithKeywords)__pyx_pw_5spacy_8pipeline_20_edit_tree_internals_10edit_trees_9EditTrees_17from_disk, __Pyx_METH_FASTCALL|METH_KEYWORDS, __pyx_doc_5spacy_8pipeline_20_edit_tree_internals_10edit_trees_9EditTrees_16from_disk}, + {"_rebuild_tree_map", (PyCFunction)(void(*)(void))(__Pyx_PyCFunction_FastCallWithKeywords)__pyx_pw_5spacy_8pipeline_20_edit_tree_internals_10edit_trees_9EditTrees_23_rebuild_tree_map, __Pyx_METH_FASTCALL|METH_KEYWORDS, __pyx_doc_5spacy_8pipeline_20_edit_tree_internals_10edit_trees_9EditTrees_22_rebuild_tree_map}, + {"__reduce__", (PyCFunction)(void(*)(void))(__Pyx_PyCFunction_FastCallWithKeywords)__pyx_pw_5spacy_8pipeline_20_edit_tree_internals_10edit_trees_9EditTrees_25__reduce__, __Pyx_METH_FASTCALL|METH_KEYWORDS, __pyx_doc_5spacy_8pipeline_20_edit_tree_internals_10edit_trees_9EditTrees_24__reduce__}, + {0, 0, 0, 0} +}; +#if CYTHON_USE_TYPE_SPECS +static PyType_Slot __pyx_type_5spacy_8pipeline_20_edit_tree_internals_10edit_trees_EditTrees_slots[] = { + {Py_tp_dealloc, (void *)__pyx_tp_dealloc_5spacy_8pipeline_20_edit_tree_internals_10edit_trees_EditTrees}, + {Py_sq_length, (void *)__pyx_pw_5spacy_8pipeline_20_edit_tree_internals_10edit_trees_9EditTrees_21__len__}, + {Py_sq_item, (void *)__pyx_sq_item_5spacy_8pipeline_20_edit_tree_internals_10edit_trees_EditTrees}, + {Py_mp_length, (void *)__pyx_pw_5spacy_8pipeline_20_edit_tree_internals_10edit_trees_9EditTrees_21__len__}, + {Py_mp_subscript, (void *)__pyx_pw_5spacy_8pipeline_20_edit_tree_internals_10edit_trees_9EditTrees_19__getitem__}, + {Py_tp_doc, (void *)PyDoc_STR("EditTrees(strings: StringStore)\n\nContainer for constructing and storing edit trees.")}, + {Py_tp_traverse, (void *)__pyx_tp_traverse_5spacy_8pipeline_20_edit_tree_internals_10edit_trees_EditTrees}, + {Py_tp_clear, (void *)__pyx_tp_clear_5spacy_8pipeline_20_edit_tree_internals_10edit_trees_EditTrees}, + {Py_tp_methods, (void *)__pyx_methods_5spacy_8pipeline_20_edit_tree_internals_10edit_trees_EditTrees}, + {Py_tp_init, (void *)__pyx_pw_5spacy_8pipeline_20_edit_tree_internals_10edit_trees_9EditTrees_1__init__}, + {Py_tp_new, (void *)__pyx_tp_new_5spacy_8pipeline_20_edit_tree_internals_10edit_trees_EditTrees}, + {0, 0}, +}; +static PyType_Spec __pyx_type_5spacy_8pipeline_20_edit_tree_internals_10edit_trees_EditTrees_spec = { + "spacy.pipeline._edit_tree_internals.edit_trees.EditTrees", + sizeof(struct __pyx_obj_5spacy_8pipeline_20_edit_tree_internals_10edit_trees_EditTrees), + 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_5spacy_8pipeline_20_edit_tree_internals_10edit_trees_EditTrees_slots, +}; +#else + +static PySequenceMethods __pyx_tp_as_sequence_EditTrees = { + __pyx_pw_5spacy_8pipeline_20_edit_tree_internals_10edit_trees_9EditTrees_21__len__, /*sq_length*/ + 0, /*sq_concat*/ + 0, /*sq_repeat*/ + __pyx_sq_item_5spacy_8pipeline_20_edit_tree_internals_10edit_trees_EditTrees, /*sq_item*/ + 0, /*sq_slice*/ + 0, /*sq_ass_item*/ + 0, /*sq_ass_slice*/ + 0, /*sq_contains*/ + 0, /*sq_inplace_concat*/ + 0, /*sq_inplace_repeat*/ +}; + +static PyMappingMethods __pyx_tp_as_mapping_EditTrees = { + __pyx_pw_5spacy_8pipeline_20_edit_tree_internals_10edit_trees_9EditTrees_21__len__, /*mp_length*/ + __pyx_pw_5spacy_8pipeline_20_edit_tree_internals_10edit_trees_9EditTrees_19__getitem__, /*mp_subscript*/ + 0, /*mp_ass_subscript*/ +}; + +static PyTypeObject __pyx_type_5spacy_8pipeline_20_edit_tree_internals_10edit_trees_EditTrees = { + PyVarObject_HEAD_INIT(0, 0) + "spacy.pipeline._edit_tree_internals.edit_trees.""EditTrees", /*tp_name*/ + sizeof(struct __pyx_obj_5spacy_8pipeline_20_edit_tree_internals_10edit_trees_EditTrees), /*tp_basicsize*/ + 0, /*tp_itemsize*/ + __pyx_tp_dealloc_5spacy_8pipeline_20_edit_tree_internals_10edit_trees_EditTrees, /*tp_dealloc*/ + 0, /*tp_vectorcall_offset*/ + 0, /*tp_getattr*/ + 0, /*tp_setattr*/ + 0, /*tp_as_async*/ + 0, /*tp_repr*/ + 0, /*tp_as_number*/ + &__pyx_tp_as_sequence_EditTrees, /*tp_as_sequence*/ + &__pyx_tp_as_mapping_EditTrees, /*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("EditTrees(strings: StringStore)\n\nContainer for constructing and storing edit trees."), /*tp_doc*/ + __pyx_tp_traverse_5spacy_8pipeline_20_edit_tree_internals_10edit_trees_EditTrees, /*tp_traverse*/ + __pyx_tp_clear_5spacy_8pipeline_20_edit_tree_internals_10edit_trees_EditTrees, /*tp_clear*/ + 0, /*tp_richcompare*/ + 0, /*tp_weaklistoffset*/ + 0, /*tp_iter*/ + 0, /*tp_iternext*/ + __pyx_methods_5spacy_8pipeline_20_edit_tree_internals_10edit_trees_EditTrees, /*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_5spacy_8pipeline_20_edit_tree_internals_10edit_trees_9EditTrees_1__init__, /*tp_init*/ + 0, /*tp_alloc*/ + __pyx_tp_new_5spacy_8pipeline_20_edit_tree_internals_10edit_trees_EditTrees, /*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_5spacy_8pipeline_20_edit_tree_internals_10edit_trees___pyx_scope_struct__from_bytes(PyTypeObject *t, CYTHON_UNUSED PyObject *a, CYTHON_UNUSED PyObject *k) { + PyObject *o; + #if CYTHON_USE_FREELISTS + if (likely((int)(__pyx_mstate_global->__pyx_freecount_5spacy_8pipeline_20_edit_tree_internals_10edit_trees___pyx_scope_struct__from_bytes > 0) & __PYX_CHECK_FINAL_TYPE_FOR_FREELISTS(t, __pyx_mstate_global->__pyx_ptype_5spacy_8pipeline_20_edit_tree_internals_10edit_trees___pyx_scope_struct__from_bytes, sizeof(struct __pyx_obj_5spacy_8pipeline_20_edit_tree_internals_10edit_trees___pyx_scope_struct__from_bytes)))) + { + o = (PyObject*)__pyx_mstate_global->__pyx_freelist_5spacy_8pipeline_20_edit_tree_internals_10edit_trees___pyx_scope_struct__from_bytes[--__pyx_mstate_global->__pyx_freecount_5spacy_8pipeline_20_edit_tree_internals_10edit_trees___pyx_scope_struct__from_bytes]; + #if CYTHON_USE_TYPE_SPECS + Py_DECREF(Py_TYPE(o)); + #endif + memset(o, 0, sizeof(struct __pyx_obj_5spacy_8pipeline_20_edit_tree_internals_10edit_trees___pyx_scope_struct__from_bytes)); + #if CYTHON_COMPILING_IN_LIMITED_API + (void) PyObject_Init(o, t); + #else + (void) PyObject_INIT(o, t); + #endif + PyObject_GC_Track(o); + } else + #endif + { + o = __Pyx_AllocateExtensionType(t, 1); + if (unlikely(!o)) return 0; + } + return o; +} + +static void __pyx_tp_dealloc_5spacy_8pipeline_20_edit_tree_internals_10edit_trees___pyx_scope_struct__from_bytes(PyObject *o) { + struct __pyx_obj_5spacy_8pipeline_20_edit_tree_internals_10edit_trees___pyx_scope_struct__from_bytes *p = (struct __pyx_obj_5spacy_8pipeline_20_edit_tree_internals_10edit_trees___pyx_scope_struct__from_bytes *)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_5spacy_8pipeline_20_edit_tree_internals_10edit_trees___pyx_scope_struct__from_bytes) { + if (PyObject_CallFinalizerFromDealloc(o)) return; + } + } + #endif + PyObject_GC_UnTrack(o); + Py_CLEAR(p->__pyx_v_deserialize_trees); + Py_CLEAR(p->__pyx_v_self); + #if CYTHON_USE_FREELISTS + if (likely((int)(__pyx_mstate_global->__pyx_freecount_5spacy_8pipeline_20_edit_tree_internals_10edit_trees___pyx_scope_struct__from_bytes < 8) & __PYX_CHECK_FINAL_TYPE_FOR_FREELISTS(Py_TYPE(o), __pyx_mstate_global->__pyx_ptype_5spacy_8pipeline_20_edit_tree_internals_10edit_trees___pyx_scope_struct__from_bytes, sizeof(struct __pyx_obj_5spacy_8pipeline_20_edit_tree_internals_10edit_trees___pyx_scope_struct__from_bytes)))) + { + __pyx_mstate_global->__pyx_freelist_5spacy_8pipeline_20_edit_tree_internals_10edit_trees___pyx_scope_struct__from_bytes[__pyx_mstate_global->__pyx_freecount_5spacy_8pipeline_20_edit_tree_internals_10edit_trees___pyx_scope_struct__from_bytes++] = ((struct __pyx_obj_5spacy_8pipeline_20_edit_tree_internals_10edit_trees___pyx_scope_struct__from_bytes *)o); + } else + #endif + { + 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_5spacy_8pipeline_20_edit_tree_internals_10edit_trees___pyx_scope_struct__from_bytes(PyObject *o, visitproc v, void *a) { + int e; + struct __pyx_obj_5spacy_8pipeline_20_edit_tree_internals_10edit_trees___pyx_scope_struct__from_bytes *p = (struct __pyx_obj_5spacy_8pipeline_20_edit_tree_internals_10edit_trees___pyx_scope_struct__from_bytes *)o; + { + e = __Pyx_call_type_traverse(o, 1, v, a); + if (e) return e; + } + if (p->__pyx_v_deserialize_trees) { + e = (*v)(p->__pyx_v_deserialize_trees, a); if (e) return e; + } + if (p->__pyx_v_self) { + e = (*v)(((PyObject *)p->__pyx_v_self), a); if (e) return e; + } + return 0; +} + +static int __pyx_tp_clear_5spacy_8pipeline_20_edit_tree_internals_10edit_trees___pyx_scope_struct__from_bytes(PyObject *o) { + PyObject* tmp; + struct __pyx_obj_5spacy_8pipeline_20_edit_tree_internals_10edit_trees___pyx_scope_struct__from_bytes *p = (struct __pyx_obj_5spacy_8pipeline_20_edit_tree_internals_10edit_trees___pyx_scope_struct__from_bytes *)o; + tmp = ((PyObject*)p->__pyx_v_deserialize_trees); + p->__pyx_v_deserialize_trees = Py_None; Py_INCREF(Py_None); + Py_XDECREF(tmp); + tmp = ((PyObject*)p->__pyx_v_self); + p->__pyx_v_self = ((struct __pyx_obj_5spacy_8pipeline_20_edit_tree_internals_10edit_trees_EditTrees *)Py_None); Py_INCREF(Py_None); + Py_XDECREF(tmp); + return 0; +} +#if CYTHON_USE_TYPE_SPECS +static PyType_Slot __pyx_type_5spacy_8pipeline_20_edit_tree_internals_10edit_trees___pyx_scope_struct__from_bytes_slots[] = { + {Py_tp_dealloc, (void *)__pyx_tp_dealloc_5spacy_8pipeline_20_edit_tree_internals_10edit_trees___pyx_scope_struct__from_bytes}, + {Py_tp_traverse, (void *)__pyx_tp_traverse_5spacy_8pipeline_20_edit_tree_internals_10edit_trees___pyx_scope_struct__from_bytes}, + {Py_tp_clear, (void *)__pyx_tp_clear_5spacy_8pipeline_20_edit_tree_internals_10edit_trees___pyx_scope_struct__from_bytes}, + {Py_tp_new, (void *)__pyx_tp_new_5spacy_8pipeline_20_edit_tree_internals_10edit_trees___pyx_scope_struct__from_bytes}, + {0, 0}, +}; +static PyType_Spec __pyx_type_5spacy_8pipeline_20_edit_tree_internals_10edit_trees___pyx_scope_struct__from_bytes_spec = { + "spacy.pipeline._edit_tree_internals.edit_trees.__pyx_scope_struct__from_bytes", + sizeof(struct __pyx_obj_5spacy_8pipeline_20_edit_tree_internals_10edit_trees___pyx_scope_struct__from_bytes), + 0, + Py_TPFLAGS_DEFAULT|Py_TPFLAGS_HAVE_VERSION_TAG|Py_TPFLAGS_CHECKTYPES|Py_TPFLAGS_HAVE_NEWBUFFER|Py_TPFLAGS_HAVE_GC, + __pyx_type_5spacy_8pipeline_20_edit_tree_internals_10edit_trees___pyx_scope_struct__from_bytes_slots, +}; +#else + +static PyTypeObject __pyx_type_5spacy_8pipeline_20_edit_tree_internals_10edit_trees___pyx_scope_struct__from_bytes = { + PyVarObject_HEAD_INIT(0, 0) + "spacy.pipeline._edit_tree_internals.edit_trees.""__pyx_scope_struct__from_bytes", /*tp_name*/ + sizeof(struct __pyx_obj_5spacy_8pipeline_20_edit_tree_internals_10edit_trees___pyx_scope_struct__from_bytes), /*tp_basicsize*/ + 0, /*tp_itemsize*/ + __pyx_tp_dealloc_5spacy_8pipeline_20_edit_tree_internals_10edit_trees___pyx_scope_struct__from_bytes, /*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_HAVE_GC, /*tp_flags*/ + 0, /*tp_doc*/ + __pyx_tp_traverse_5spacy_8pipeline_20_edit_tree_internals_10edit_trees___pyx_scope_struct__from_bytes, /*tp_traverse*/ + __pyx_tp_clear_5spacy_8pipeline_20_edit_tree_internals_10edit_trees___pyx_scope_struct__from_bytes, /*tp_clear*/ + 0, /*tp_richcompare*/ + 0, /*tp_weaklistoffset*/ + 0, /*tp_iter*/ + 0, /*tp_iternext*/ + 0, /*tp_methods*/ + 0, /*tp_members*/ + 0, /*tp_getset*/ + 0, /*tp_base*/ + 0, /*tp_dict*/ + 0, /*tp_descr_get*/ + 0, /*tp_descr_set*/ + #if !CYTHON_USE_TYPE_SPECS + 0, /*tp_dictoffset*/ + #endif + 0, /*tp_init*/ + 0, /*tp_alloc*/ + __pyx_tp_new_5spacy_8pipeline_20_edit_tree_internals_10edit_trees___pyx_scope_struct__from_bytes, /*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_5spacy_8pipeline_20_edit_tree_internals_10edit_trees___pyx_scope_struct_1_to_bytes(PyTypeObject *t, CYTHON_UNUSED PyObject *a, CYTHON_UNUSED PyObject *k) { + PyObject *o; + #if CYTHON_USE_FREELISTS + if (likely((int)(__pyx_mstate_global->__pyx_freecount_5spacy_8pipeline_20_edit_tree_internals_10edit_trees___pyx_scope_struct_1_to_bytes > 0) & __PYX_CHECK_FINAL_TYPE_FOR_FREELISTS(t, __pyx_mstate_global->__pyx_ptype_5spacy_8pipeline_20_edit_tree_internals_10edit_trees___pyx_scope_struct_1_to_bytes, sizeof(struct __pyx_obj_5spacy_8pipeline_20_edit_tree_internals_10edit_trees___pyx_scope_struct_1_to_bytes)))) + { + o = (PyObject*)__pyx_mstate_global->__pyx_freelist_5spacy_8pipeline_20_edit_tree_internals_10edit_trees___pyx_scope_struct_1_to_bytes[--__pyx_mstate_global->__pyx_freecount_5spacy_8pipeline_20_edit_tree_internals_10edit_trees___pyx_scope_struct_1_to_bytes]; + #if CYTHON_USE_TYPE_SPECS + Py_DECREF(Py_TYPE(o)); + #endif + memset(o, 0, sizeof(struct __pyx_obj_5spacy_8pipeline_20_edit_tree_internals_10edit_trees___pyx_scope_struct_1_to_bytes)); + #if CYTHON_COMPILING_IN_LIMITED_API + (void) PyObject_Init(o, t); + #else + (void) PyObject_INIT(o, t); + #endif + PyObject_GC_Track(o); + } else + #endif + { + o = __Pyx_AllocateExtensionType(t, 1); + if (unlikely(!o)) return 0; + } + return o; +} + +static void __pyx_tp_dealloc_5spacy_8pipeline_20_edit_tree_internals_10edit_trees___pyx_scope_struct_1_to_bytes(PyObject *o) { + struct __pyx_obj_5spacy_8pipeline_20_edit_tree_internals_10edit_trees___pyx_scope_struct_1_to_bytes *p = (struct __pyx_obj_5spacy_8pipeline_20_edit_tree_internals_10edit_trees___pyx_scope_struct_1_to_bytes *)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_5spacy_8pipeline_20_edit_tree_internals_10edit_trees___pyx_scope_struct_1_to_bytes) { + if (PyObject_CallFinalizerFromDealloc(o)) return; + } + } + #endif + PyObject_GC_UnTrack(o); + Py_CLEAR(p->__pyx_v_tree_dicts); + #if CYTHON_USE_FREELISTS + if (likely((int)(__pyx_mstate_global->__pyx_freecount_5spacy_8pipeline_20_edit_tree_internals_10edit_trees___pyx_scope_struct_1_to_bytes < 8) & __PYX_CHECK_FINAL_TYPE_FOR_FREELISTS(Py_TYPE(o), __pyx_mstate_global->__pyx_ptype_5spacy_8pipeline_20_edit_tree_internals_10edit_trees___pyx_scope_struct_1_to_bytes, sizeof(struct __pyx_obj_5spacy_8pipeline_20_edit_tree_internals_10edit_trees___pyx_scope_struct_1_to_bytes)))) + { + __pyx_mstate_global->__pyx_freelist_5spacy_8pipeline_20_edit_tree_internals_10edit_trees___pyx_scope_struct_1_to_bytes[__pyx_mstate_global->__pyx_freecount_5spacy_8pipeline_20_edit_tree_internals_10edit_trees___pyx_scope_struct_1_to_bytes++] = ((struct __pyx_obj_5spacy_8pipeline_20_edit_tree_internals_10edit_trees___pyx_scope_struct_1_to_bytes *)o); + } else + #endif + { + 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_5spacy_8pipeline_20_edit_tree_internals_10edit_trees___pyx_scope_struct_1_to_bytes(PyObject *o, visitproc v, void *a) { + int e; + struct __pyx_obj_5spacy_8pipeline_20_edit_tree_internals_10edit_trees___pyx_scope_struct_1_to_bytes *p = (struct __pyx_obj_5spacy_8pipeline_20_edit_tree_internals_10edit_trees___pyx_scope_struct_1_to_bytes *)o; + { + e = __Pyx_call_type_traverse(o, 1, v, a); + if (e) return e; + } + if (p->__pyx_v_tree_dicts) { + e = (*v)(p->__pyx_v_tree_dicts, a); if (e) return e; + } + return 0; +} + +static int __pyx_tp_clear_5spacy_8pipeline_20_edit_tree_internals_10edit_trees___pyx_scope_struct_1_to_bytes(PyObject *o) { + PyObject* tmp; + struct __pyx_obj_5spacy_8pipeline_20_edit_tree_internals_10edit_trees___pyx_scope_struct_1_to_bytes *p = (struct __pyx_obj_5spacy_8pipeline_20_edit_tree_internals_10edit_trees___pyx_scope_struct_1_to_bytes *)o; + tmp = ((PyObject*)p->__pyx_v_tree_dicts); + p->__pyx_v_tree_dicts = ((PyObject*)Py_None); Py_INCREF(Py_None); + Py_XDECREF(tmp); + return 0; +} +#if CYTHON_USE_TYPE_SPECS +static PyType_Slot __pyx_type_5spacy_8pipeline_20_edit_tree_internals_10edit_trees___pyx_scope_struct_1_to_bytes_slots[] = { + {Py_tp_dealloc, (void *)__pyx_tp_dealloc_5spacy_8pipeline_20_edit_tree_internals_10edit_trees___pyx_scope_struct_1_to_bytes}, + {Py_tp_traverse, (void *)__pyx_tp_traverse_5spacy_8pipeline_20_edit_tree_internals_10edit_trees___pyx_scope_struct_1_to_bytes}, + {Py_tp_clear, (void *)__pyx_tp_clear_5spacy_8pipeline_20_edit_tree_internals_10edit_trees___pyx_scope_struct_1_to_bytes}, + {Py_tp_new, (void *)__pyx_tp_new_5spacy_8pipeline_20_edit_tree_internals_10edit_trees___pyx_scope_struct_1_to_bytes}, + {0, 0}, +}; +static PyType_Spec __pyx_type_5spacy_8pipeline_20_edit_tree_internals_10edit_trees___pyx_scope_struct_1_to_bytes_spec = { + "spacy.pipeline._edit_tree_internals.edit_trees.__pyx_scope_struct_1_to_bytes", + sizeof(struct __pyx_obj_5spacy_8pipeline_20_edit_tree_internals_10edit_trees___pyx_scope_struct_1_to_bytes), + 0, + Py_TPFLAGS_DEFAULT|Py_TPFLAGS_HAVE_VERSION_TAG|Py_TPFLAGS_CHECKTYPES|Py_TPFLAGS_HAVE_NEWBUFFER|Py_TPFLAGS_HAVE_GC, + __pyx_type_5spacy_8pipeline_20_edit_tree_internals_10edit_trees___pyx_scope_struct_1_to_bytes_slots, +}; +#else + +static PyTypeObject __pyx_type_5spacy_8pipeline_20_edit_tree_internals_10edit_trees___pyx_scope_struct_1_to_bytes = { + PyVarObject_HEAD_INIT(0, 0) + "spacy.pipeline._edit_tree_internals.edit_trees.""__pyx_scope_struct_1_to_bytes", /*tp_name*/ + sizeof(struct __pyx_obj_5spacy_8pipeline_20_edit_tree_internals_10edit_trees___pyx_scope_struct_1_to_bytes), /*tp_basicsize*/ + 0, /*tp_itemsize*/ + __pyx_tp_dealloc_5spacy_8pipeline_20_edit_tree_internals_10edit_trees___pyx_scope_struct_1_to_bytes, /*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_HAVE_GC, /*tp_flags*/ + 0, /*tp_doc*/ + __pyx_tp_traverse_5spacy_8pipeline_20_edit_tree_internals_10edit_trees___pyx_scope_struct_1_to_bytes, /*tp_traverse*/ + __pyx_tp_clear_5spacy_8pipeline_20_edit_tree_internals_10edit_trees___pyx_scope_struct_1_to_bytes, /*tp_clear*/ + 0, /*tp_richcompare*/ + 0, /*tp_weaklistoffset*/ + 0, /*tp_iter*/ + 0, /*tp_iternext*/ + 0, /*tp_methods*/ + 0, /*tp_members*/ + 0, /*tp_getset*/ + 0, /*tp_base*/ + 0, /*tp_dict*/ + 0, /*tp_descr_get*/ + 0, /*tp_descr_set*/ + #if !CYTHON_USE_TYPE_SPECS + 0, /*tp_dictoffset*/ + #endif + 0, /*tp_init*/ + 0, /*tp_alloc*/ + __pyx_tp_new_5spacy_8pipeline_20_edit_tree_internals_10edit_trees___pyx_scope_struct_1_to_bytes, /*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); + PyObject *__pyx_t_1 = NULL; + int __pyx_lineno = 0; + const char *__pyx_filename = NULL; + int __pyx_clineno = 0; + __Pyx_RefNannySetupContext("__Pyx_modinit_variable_export_code", 0); + /*--- Variable 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_uint32_t_NULL_TREE_ID); + #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 + 9; + void *const __pyx_export_pointers[] = {(void *)&__pyx_v_5spacy_8pipeline_20_edit_tree_internals_10edit_trees_NULL_TREE_ID, (void *) NULL}; + void *const *__pyx_export_pointer = __pyx_export_pointers; + const char *__pyx_export_current_signature = __pyx_export_signature; + while (*__pyx_export_pointer) { + if (__Pyx_ExportVoidPtr(__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_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 ---*/ + __pyx_vtabptr_5spacy_8pipeline_20_edit_tree_internals_10edit_trees_EditTrees = &__pyx_vtable_5spacy_8pipeline_20_edit_tree_internals_10edit_trees_EditTrees; + __pyx_vtable_5spacy_8pipeline_20_edit_tree_internals_10edit_trees_EditTrees.add = (uint32_t (*)(struct __pyx_obj_5spacy_8pipeline_20_edit_tree_internals_10edit_trees_EditTrees *, PyObject *, PyObject *, int __pyx_skip_dispatch))__pyx_f_5spacy_8pipeline_20_edit_tree_internals_10edit_trees_9EditTrees_add; + __pyx_vtable_5spacy_8pipeline_20_edit_tree_internals_10edit_trees_EditTrees.apply = (PyObject *(*)(struct __pyx_obj_5spacy_8pipeline_20_edit_tree_internals_10edit_trees_EditTrees *, uint32_t, PyObject *, int __pyx_skip_dispatch))__pyx_f_5spacy_8pipeline_20_edit_tree_internals_10edit_trees_9EditTrees_apply; + __pyx_vtable_5spacy_8pipeline_20_edit_tree_internals_10edit_trees_EditTrees.tree_to_str = (PyObject *(*)(struct __pyx_obj_5spacy_8pipeline_20_edit_tree_internals_10edit_trees_EditTrees *, uint32_t, int __pyx_skip_dispatch))__pyx_f_5spacy_8pipeline_20_edit_tree_internals_10edit_trees_9EditTrees_tree_to_str; + __pyx_vtable_5spacy_8pipeline_20_edit_tree_internals_10edit_trees_EditTrees._add = (uint32_t (*)(struct __pyx_obj_5spacy_8pipeline_20_edit_tree_internals_10edit_trees_EditTrees *, PyObject *, PyObject *))__pyx_f_5spacy_8pipeline_20_edit_tree_internals_10edit_trees_9EditTrees__add; + __pyx_vtable_5spacy_8pipeline_20_edit_tree_internals_10edit_trees_EditTrees._apply = (PyObject *(*)(struct __pyx_obj_5spacy_8pipeline_20_edit_tree_internals_10edit_trees_EditTrees *, uint32_t, PyObject *, PyObject *))__pyx_f_5spacy_8pipeline_20_edit_tree_internals_10edit_trees_9EditTrees__apply; + __pyx_vtable_5spacy_8pipeline_20_edit_tree_internals_10edit_trees_EditTrees._tree_id = (uint32_t (*)(struct __pyx_obj_5spacy_8pipeline_20_edit_tree_internals_10edit_trees_EditTrees *, struct __pyx_t_5spacy_8pipeline_20_edit_tree_internals_10edit_trees_EditTreeC))__pyx_f_5spacy_8pipeline_20_edit_tree_internals_10edit_trees_9EditTrees__tree_id; + #if CYTHON_USE_TYPE_SPECS + __pyx_mstate->__pyx_ptype_5spacy_8pipeline_20_edit_tree_internals_10edit_trees_EditTrees = (PyTypeObject *) __Pyx_PyType_FromModuleAndSpec(__pyx_m, &__pyx_type_5spacy_8pipeline_20_edit_tree_internals_10edit_trees_EditTrees_spec, NULL); if (unlikely(!__pyx_mstate->__pyx_ptype_5spacy_8pipeline_20_edit_tree_internals_10edit_trees_EditTrees)) __PYX_ERR(0, 61, __pyx_L1_error) + if (__Pyx_fix_up_extension_type_from_spec(&__pyx_type_5spacy_8pipeline_20_edit_tree_internals_10edit_trees_EditTrees_spec, __pyx_mstate->__pyx_ptype_5spacy_8pipeline_20_edit_tree_internals_10edit_trees_EditTrees) < (0)) __PYX_ERR(0, 61, __pyx_L1_error) + #else + __pyx_mstate->__pyx_ptype_5spacy_8pipeline_20_edit_tree_internals_10edit_trees_EditTrees = &__pyx_type_5spacy_8pipeline_20_edit_tree_internals_10edit_trees_EditTrees; + #endif + #if !CYTHON_COMPILING_IN_LIMITED_API + #endif + #if !CYTHON_USE_TYPE_SPECS + if (__Pyx_PyType_Ready(__pyx_mstate->__pyx_ptype_5spacy_8pipeline_20_edit_tree_internals_10edit_trees_EditTrees) < (0)) __PYX_ERR(0, 61, __pyx_L1_error) + #endif + #if CYTHON_COMPILING_IN_CPYTHON && PY_VERSION_HEX >= 0x030E0000 + PyUnstable_Object_EnableDeferredRefcount((PyObject*)__pyx_mstate->__pyx_ptype_5spacy_8pipeline_20_edit_tree_internals_10edit_trees_EditTrees); + #endif + #if !CYTHON_COMPILING_IN_LIMITED_API + if ((CYTHON_USE_TYPE_SLOTS && CYTHON_USE_PYTYPE_LOOKUP) && likely(!__pyx_mstate->__pyx_ptype_5spacy_8pipeline_20_edit_tree_internals_10edit_trees_EditTrees->tp_dictoffset && __pyx_mstate->__pyx_ptype_5spacy_8pipeline_20_edit_tree_internals_10edit_trees_EditTrees->tp_getattro == PyObject_GenericGetAttr)) { + __pyx_mstate->__pyx_ptype_5spacy_8pipeline_20_edit_tree_internals_10edit_trees_EditTrees->tp_getattro = PyObject_GenericGetAttr; + } + #endif + #if CYTHON_UPDATE_DESCRIPTOR_DOC + { + PyObject *wrapper = PyObject_GetAttrString((PyObject *)__pyx_mstate->__pyx_ptype_5spacy_8pipeline_20_edit_tree_internals_10edit_trees_EditTrees, "__init__"); if (unlikely(!wrapper)) __PYX_ERR(0, 61, __pyx_L1_error) + if (__Pyx_IS_TYPE(wrapper, &PyWrapperDescr_Type)) { + __pyx_wrapperbase_5spacy_8pipeline_20_edit_tree_internals_10edit_trees_9EditTrees___init__ = *((PyWrapperDescrObject *)wrapper)->d_base; + __pyx_wrapperbase_5spacy_8pipeline_20_edit_tree_internals_10edit_trees_9EditTrees___init__.doc = __pyx_doc_5spacy_8pipeline_20_edit_tree_internals_10edit_trees_9EditTrees___init__; + ((PyWrapperDescrObject *)wrapper)->d_base = &__pyx_wrapperbase_5spacy_8pipeline_20_edit_tree_internals_10edit_trees_9EditTrees___init__; + } + } + #endif + if (__Pyx_SetVtable(__pyx_mstate->__pyx_ptype_5spacy_8pipeline_20_edit_tree_internals_10edit_trees_EditTrees, __pyx_vtabptr_5spacy_8pipeline_20_edit_tree_internals_10edit_trees_EditTrees) < (0)) __PYX_ERR(0, 61, __pyx_L1_error) + if (__Pyx_MergeVtables(__pyx_mstate->__pyx_ptype_5spacy_8pipeline_20_edit_tree_internals_10edit_trees_EditTrees) < (0)) __PYX_ERR(0, 61, __pyx_L1_error) + if (PyObject_SetAttr(__pyx_m, __pyx_mstate_global->__pyx_n_u_EditTrees, (PyObject *) __pyx_mstate->__pyx_ptype_5spacy_8pipeline_20_edit_tree_internals_10edit_trees_EditTrees) < (0)) __PYX_ERR(0, 61, __pyx_L1_error) + #if CYTHON_USE_TYPE_SPECS + __pyx_mstate->__pyx_ptype_5spacy_8pipeline_20_edit_tree_internals_10edit_trees___pyx_scope_struct__from_bytes = (PyTypeObject *) __Pyx_PyType_FromModuleAndSpec(__pyx_m, &__pyx_type_5spacy_8pipeline_20_edit_tree_internals_10edit_trees___pyx_scope_struct__from_bytes_spec, NULL); if (unlikely(!__pyx_mstate->__pyx_ptype_5spacy_8pipeline_20_edit_tree_internals_10edit_trees___pyx_scope_struct__from_bytes)) __PYX_ERR(0, 216, __pyx_L1_error) + if (__Pyx_fix_up_extension_type_from_spec(&__pyx_type_5spacy_8pipeline_20_edit_tree_internals_10edit_trees___pyx_scope_struct__from_bytes_spec, __pyx_mstate->__pyx_ptype_5spacy_8pipeline_20_edit_tree_internals_10edit_trees___pyx_scope_struct__from_bytes) < (0)) __PYX_ERR(0, 216, __pyx_L1_error) + #else + __pyx_mstate->__pyx_ptype_5spacy_8pipeline_20_edit_tree_internals_10edit_trees___pyx_scope_struct__from_bytes = &__pyx_type_5spacy_8pipeline_20_edit_tree_internals_10edit_trees___pyx_scope_struct__from_bytes; + #endif + #if !CYTHON_COMPILING_IN_LIMITED_API + #endif + #if !CYTHON_USE_TYPE_SPECS + if (__Pyx_PyType_Ready(__pyx_mstate->__pyx_ptype_5spacy_8pipeline_20_edit_tree_internals_10edit_trees___pyx_scope_struct__from_bytes) < (0)) __PYX_ERR(0, 216, __pyx_L1_error) + #endif + #if CYTHON_COMPILING_IN_CPYTHON && PY_VERSION_HEX >= 0x030E0000 + PyUnstable_Object_EnableDeferredRefcount((PyObject*)__pyx_mstate->__pyx_ptype_5spacy_8pipeline_20_edit_tree_internals_10edit_trees___pyx_scope_struct__from_bytes); + #endif + #if !CYTHON_COMPILING_IN_LIMITED_API + if ((CYTHON_USE_TYPE_SLOTS && CYTHON_USE_PYTYPE_LOOKUP) && likely(!__pyx_mstate->__pyx_ptype_5spacy_8pipeline_20_edit_tree_internals_10edit_trees___pyx_scope_struct__from_bytes->tp_dictoffset && __pyx_mstate->__pyx_ptype_5spacy_8pipeline_20_edit_tree_internals_10edit_trees___pyx_scope_struct__from_bytes->tp_getattro == PyObject_GenericGetAttr)) { + __pyx_mstate->__pyx_ptype_5spacy_8pipeline_20_edit_tree_internals_10edit_trees___pyx_scope_struct__from_bytes->tp_getattro = PyObject_GenericGetAttr; + } + #endif + #if CYTHON_USE_TYPE_SPECS + __pyx_mstate->__pyx_ptype_5spacy_8pipeline_20_edit_tree_internals_10edit_trees___pyx_scope_struct_1_to_bytes = (PyTypeObject *) __Pyx_PyType_FromModuleAndSpec(__pyx_m, &__pyx_type_5spacy_8pipeline_20_edit_tree_internals_10edit_trees___pyx_scope_struct_1_to_bytes_spec, NULL); if (unlikely(!__pyx_mstate->__pyx_ptype_5spacy_8pipeline_20_edit_tree_internals_10edit_trees___pyx_scope_struct_1_to_bytes)) __PYX_ERR(0, 231, __pyx_L1_error) + if (__Pyx_fix_up_extension_type_from_spec(&__pyx_type_5spacy_8pipeline_20_edit_tree_internals_10edit_trees___pyx_scope_struct_1_to_bytes_spec, __pyx_mstate->__pyx_ptype_5spacy_8pipeline_20_edit_tree_internals_10edit_trees___pyx_scope_struct_1_to_bytes) < (0)) __PYX_ERR(0, 231, __pyx_L1_error) + #else + __pyx_mstate->__pyx_ptype_5spacy_8pipeline_20_edit_tree_internals_10edit_trees___pyx_scope_struct_1_to_bytes = &__pyx_type_5spacy_8pipeline_20_edit_tree_internals_10edit_trees___pyx_scope_struct_1_to_bytes; + #endif + #if !CYTHON_COMPILING_IN_LIMITED_API + #endif + #if !CYTHON_USE_TYPE_SPECS + if (__Pyx_PyType_Ready(__pyx_mstate->__pyx_ptype_5spacy_8pipeline_20_edit_tree_internals_10edit_trees___pyx_scope_struct_1_to_bytes) < (0)) __PYX_ERR(0, 231, __pyx_L1_error) + #endif + #if CYTHON_COMPILING_IN_CPYTHON && PY_VERSION_HEX >= 0x030E0000 + PyUnstable_Object_EnableDeferredRefcount((PyObject*)__pyx_mstate->__pyx_ptype_5spacy_8pipeline_20_edit_tree_internals_10edit_trees___pyx_scope_struct_1_to_bytes); + #endif + #if !CYTHON_COMPILING_IN_LIMITED_API + if ((CYTHON_USE_TYPE_SLOTS && CYTHON_USE_PYTYPE_LOOKUP) && likely(!__pyx_mstate->__pyx_ptype_5spacy_8pipeline_20_edit_tree_internals_10edit_trees___pyx_scope_struct_1_to_bytes->tp_dictoffset && __pyx_mstate->__pyx_ptype_5spacy_8pipeline_20_edit_tree_internals_10edit_trees___pyx_scope_struct_1_to_bytes->tp_getattro == PyObject_GenericGetAttr)) { + __pyx_mstate->__pyx_ptype_5spacy_8pipeline_20_edit_tree_internals_10edit_trees___pyx_scope_struct_1_to_bytes->tp_getattro = PyObject_GenericGetAttr; + } + #endif + __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("cymem.cymem"); if (unlikely(!__pyx_t_1)) __PYX_ERR(3, 4, __pyx_L1_error) + __Pyx_GOTREF(__pyx_t_1); + __pyx_mstate->__pyx_ptype_5cymem_5cymem_PyMalloc = __Pyx_ImportType_3_2_1(__pyx_t_1, "cymem.cymem", "PyMalloc", + #if defined(PYPY_VERSION_NUM) && PYPY_VERSION_NUM < 0x050B0000 + sizeof(struct __pyx_obj_5cymem_5cymem_PyMalloc), __PYX_GET_STRUCT_ALIGNMENT_3_2_1(struct __pyx_obj_5cymem_5cymem_PyMalloc), + #elif CYTHON_COMPILING_IN_LIMITED_API + sizeof(struct __pyx_obj_5cymem_5cymem_PyMalloc), __PYX_GET_STRUCT_ALIGNMENT_3_2_1(struct __pyx_obj_5cymem_5cymem_PyMalloc), + #else + sizeof(struct __pyx_obj_5cymem_5cymem_PyMalloc), __PYX_GET_STRUCT_ALIGNMENT_3_2_1(struct __pyx_obj_5cymem_5cymem_PyMalloc), + #endif + __Pyx_ImportType_CheckSize_Warn_3_2_1); if (!__pyx_mstate->__pyx_ptype_5cymem_5cymem_PyMalloc) __PYX_ERR(3, 4, __pyx_L1_error) + __pyx_vtabptr_5cymem_5cymem_PyMalloc = (struct __pyx_vtabstruct_5cymem_5cymem_PyMalloc*)__Pyx_GetVtable(__pyx_mstate->__pyx_ptype_5cymem_5cymem_PyMalloc); if (unlikely(!__pyx_vtabptr_5cymem_5cymem_PyMalloc)) __PYX_ERR(3, 4, __pyx_L1_error) + __pyx_mstate->__pyx_ptype_5cymem_5cymem_PyFree = __Pyx_ImportType_3_2_1(__pyx_t_1, "cymem.cymem", "PyFree", + #if defined(PYPY_VERSION_NUM) && PYPY_VERSION_NUM < 0x050B0000 + sizeof(struct __pyx_obj_5cymem_5cymem_PyFree), __PYX_GET_STRUCT_ALIGNMENT_3_2_1(struct __pyx_obj_5cymem_5cymem_PyFree), + #elif CYTHON_COMPILING_IN_LIMITED_API + sizeof(struct __pyx_obj_5cymem_5cymem_PyFree), __PYX_GET_STRUCT_ALIGNMENT_3_2_1(struct __pyx_obj_5cymem_5cymem_PyFree), + #else + sizeof(struct __pyx_obj_5cymem_5cymem_PyFree), __PYX_GET_STRUCT_ALIGNMENT_3_2_1(struct __pyx_obj_5cymem_5cymem_PyFree), + #endif + __Pyx_ImportType_CheckSize_Warn_3_2_1); if (!__pyx_mstate->__pyx_ptype_5cymem_5cymem_PyFree) __PYX_ERR(3, 10, __pyx_L1_error) + __pyx_vtabptr_5cymem_5cymem_PyFree = (struct __pyx_vtabstruct_5cymem_5cymem_PyFree*)__Pyx_GetVtable(__pyx_mstate->__pyx_ptype_5cymem_5cymem_PyFree); if (unlikely(!__pyx_vtabptr_5cymem_5cymem_PyFree)) __PYX_ERR(3, 10, __pyx_L1_error) + __pyx_mstate->__pyx_ptype_5cymem_5cymem_Pool = __Pyx_ImportType_3_2_1(__pyx_t_1, "cymem.cymem", "Pool", + #if defined(PYPY_VERSION_NUM) && PYPY_VERSION_NUM < 0x050B0000 + sizeof(struct __pyx_obj_5cymem_5cymem_Pool), __PYX_GET_STRUCT_ALIGNMENT_3_2_1(struct __pyx_obj_5cymem_5cymem_Pool), + #elif CYTHON_COMPILING_IN_LIMITED_API + sizeof(struct __pyx_obj_5cymem_5cymem_Pool), __PYX_GET_STRUCT_ALIGNMENT_3_2_1(struct __pyx_obj_5cymem_5cymem_Pool), + #else + sizeof(struct __pyx_obj_5cymem_5cymem_Pool), __PYX_GET_STRUCT_ALIGNMENT_3_2_1(struct __pyx_obj_5cymem_5cymem_Pool), + #endif + __Pyx_ImportType_CheckSize_Warn_3_2_1); if (!__pyx_mstate->__pyx_ptype_5cymem_5cymem_Pool) __PYX_ERR(3, 16, __pyx_L1_error) + __pyx_vtabptr_5cymem_5cymem_Pool = (struct __pyx_vtabstruct_5cymem_5cymem_Pool*)__Pyx_GetVtable(__pyx_mstate->__pyx_ptype_5cymem_5cymem_Pool); if (unlikely(!__pyx_vtabptr_5cymem_5cymem_Pool)) __PYX_ERR(3, 16, __pyx_L1_error) + __pyx_mstate->__pyx_ptype_5cymem_5cymem_Address = __Pyx_ImportType_3_2_1(__pyx_t_1, "cymem.cymem", "Address", + #if defined(PYPY_VERSION_NUM) && PYPY_VERSION_NUM < 0x050B0000 + sizeof(struct __pyx_obj_5cymem_5cymem_Address), __PYX_GET_STRUCT_ALIGNMENT_3_2_1(struct __pyx_obj_5cymem_5cymem_Address), + #elif CYTHON_COMPILING_IN_LIMITED_API + sizeof(struct __pyx_obj_5cymem_5cymem_Address), __PYX_GET_STRUCT_ALIGNMENT_3_2_1(struct __pyx_obj_5cymem_5cymem_Address), + #else + sizeof(struct __pyx_obj_5cymem_5cymem_Address), __PYX_GET_STRUCT_ALIGNMENT_3_2_1(struct __pyx_obj_5cymem_5cymem_Address), + #endif + __Pyx_ImportType_CheckSize_Warn_3_2_1); if (!__pyx_mstate->__pyx_ptype_5cymem_5cymem_Address) __PYX_ERR(3, 28, __pyx_L1_error) + __Pyx_DECREF(__pyx_t_1); __pyx_t_1 = 0; + __pyx_t_1 = PyImport_ImportModule("preshed.maps"); if (unlikely(!__pyx_t_1)) __PYX_ERR(4, 45, __pyx_L1_error) + __Pyx_GOTREF(__pyx_t_1); + __pyx_mstate->__pyx_ptype_7preshed_4maps_PreshMap = __Pyx_ImportType_3_2_1(__pyx_t_1, "preshed.maps", "PreshMap", + #if defined(PYPY_VERSION_NUM) && PYPY_VERSION_NUM < 0x050B0000 + sizeof(struct __pyx_obj_7preshed_4maps_PreshMap), __PYX_GET_STRUCT_ALIGNMENT_3_2_1(struct __pyx_obj_7preshed_4maps_PreshMap), + #elif CYTHON_COMPILING_IN_LIMITED_API + sizeof(struct __pyx_obj_7preshed_4maps_PreshMap), __PYX_GET_STRUCT_ALIGNMENT_3_2_1(struct __pyx_obj_7preshed_4maps_PreshMap), + #else + sizeof(struct __pyx_obj_7preshed_4maps_PreshMap), __PYX_GET_STRUCT_ALIGNMENT_3_2_1(struct __pyx_obj_7preshed_4maps_PreshMap), + #endif + __Pyx_ImportType_CheckSize_Warn_3_2_1); if (!__pyx_mstate->__pyx_ptype_7preshed_4maps_PreshMap) __PYX_ERR(4, 45, __pyx_L1_error) + __pyx_vtabptr_7preshed_4maps_PreshMap = (struct __pyx_vtabstruct_7preshed_4maps_PreshMap*)__Pyx_GetVtable(__pyx_mstate->__pyx_ptype_7preshed_4maps_PreshMap); if (unlikely(!__pyx_vtabptr_7preshed_4maps_PreshMap)) __PYX_ERR(4, 45, __pyx_L1_error) + __pyx_mstate->__pyx_ptype_7preshed_4maps_PreshMapArray = __Pyx_ImportType_3_2_1(__pyx_t_1, "preshed.maps", "PreshMapArray", + #if defined(PYPY_VERSION_NUM) && PYPY_VERSION_NUM < 0x050B0000 + sizeof(struct __pyx_obj_7preshed_4maps_PreshMapArray), __PYX_GET_STRUCT_ALIGNMENT_3_2_1(struct __pyx_obj_7preshed_4maps_PreshMapArray), + #elif CYTHON_COMPILING_IN_LIMITED_API + sizeof(struct __pyx_obj_7preshed_4maps_PreshMapArray), __PYX_GET_STRUCT_ALIGNMENT_3_2_1(struct __pyx_obj_7preshed_4maps_PreshMapArray), + #else + sizeof(struct __pyx_obj_7preshed_4maps_PreshMapArray), __PYX_GET_STRUCT_ALIGNMENT_3_2_1(struct __pyx_obj_7preshed_4maps_PreshMapArray), + #endif + __Pyx_ImportType_CheckSize_Warn_3_2_1); if (!__pyx_mstate->__pyx_ptype_7preshed_4maps_PreshMapArray) __PYX_ERR(4, 53, __pyx_L1_error) + __pyx_vtabptr_7preshed_4maps_PreshMapArray = (struct __pyx_vtabstruct_7preshed_4maps_PreshMapArray*)__Pyx_GetVtable(__pyx_mstate->__pyx_ptype_7preshed_4maps_PreshMapArray); if (unlikely(!__pyx_vtabptr_7preshed_4maps_PreshMapArray)) __PYX_ERR(4, 53, __pyx_L1_error) + __Pyx_DECREF(__pyx_t_1); __pyx_t_1 = 0; + __pyx_t_1 = PyImport_ImportModule("spacy.strings"); if (unlikely(!__pyx_t_1)) __PYX_ERR(5, 22, __pyx_L1_error) + __Pyx_GOTREF(__pyx_t_1); + __pyx_mstate->__pyx_ptype_5spacy_7strings_StringStore = __Pyx_ImportType_3_2_1(__pyx_t_1, "spacy.strings", "StringStore", + #if defined(PYPY_VERSION_NUM) && PYPY_VERSION_NUM < 0x050B0000 + sizeof(struct __pyx_obj_5spacy_7strings_StringStore), __PYX_GET_STRUCT_ALIGNMENT_3_2_1(struct __pyx_obj_5spacy_7strings_StringStore), + #elif CYTHON_COMPILING_IN_LIMITED_API + sizeof(struct __pyx_obj_5spacy_7strings_StringStore), __PYX_GET_STRUCT_ALIGNMENT_3_2_1(struct __pyx_obj_5spacy_7strings_StringStore), + #else + sizeof(struct __pyx_obj_5spacy_7strings_StringStore), __PYX_GET_STRUCT_ALIGNMENT_3_2_1(struct __pyx_obj_5spacy_7strings_StringStore), + #endif + __Pyx_ImportType_CheckSize_Warn_3_2_1); if (!__pyx_mstate->__pyx_ptype_5spacy_7strings_StringStore) __PYX_ERR(5, 22, __pyx_L1_error) + __pyx_vtabptr_5spacy_7strings_StringStore = (struct __pyx_vtabstruct_5spacy_7strings_StringStore*)__Pyx_GetVtable(__pyx_mstate->__pyx_ptype_5spacy_7strings_StringStore); if (unlikely(!__pyx_vtabptr_5spacy_7strings_StringStore)) __PYX_ERR(5, 22, __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("murmurhash.mrmr"); 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_uint64_t_void_int_uint64_t_hash6); + #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 + 33; + void (**const __pyx_import_pointers[])(void) = {(void (**)(void))&__pyx_f_10murmurhash_4mrmr_hash64, (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_1(__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_edit_trees(PyObject* module); /*proto*/ +static PyModuleDef_Slot __pyx_moduledef_slots[] = { + {Py_mod_create, (void*)__pyx_pymod_create}, + {Py_mod_exec, (void*)__pyx_pymod_exec_edit_trees}, + #if CYTHON_COMPILING_IN_CPYTHON_FREETHREADING + {Py_mod_gil, Py_MOD_GIL_USED}, + #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, + "edit_trees", + 0, /* 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_edit_trees(void) CYTHON_SMALL_CODE; /*proto*/ +__Pyx_PyMODINIT_FUNC PyInit_edit_trees(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_edit_trees(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 'edit_trees' 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 "edit_trees" 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_edit_trees", 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_spacy__pipeline___edit_tree_internals__edit_trees) { + 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, "spacy.pipeline._edit_tree_internals.edit_trees")) { + if (unlikely((PyDict_SetItemString(modules, "spacy.pipeline._edit_tree_internals.edit_trees", __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); + if (unlikely((__Pyx_modinit_variable_export_code(__pyx_mstate) < 0))) __PYX_ERR(0, 1, __pyx_L1_error) + (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 ---*/ + + /* "spacy/pipeline/_edit_tree_internals/edit_trees.pyx":11 + * from ...typedefs cimport hash_t + * + * from ... import util # <<<<<<<<<<<<<< + * from ...errors import Errors + * from ...strings import StringStore +*/ + { + PyObject* const __pyx_imported_names[] = {__pyx_mstate_global->__pyx_n_u_util}; + __pyx_t_1 = __Pyx_Import(__pyx_mstate_global->__pyx_n_u_, __pyx_imported_names, 1, __pyx_mstate_global->__pyx_kp_u_spacy, 3); if (unlikely(!__pyx_t_1)) __PYX_ERR(0, 11, __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_util}; + __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, 11, __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, 11, __pyx_L1_error) + __Pyx_DECREF(__pyx_t_4); __pyx_t_4 = 0; + } + } + __Pyx_DECREF(__pyx_t_2); __pyx_t_2 = 0; + + /* "spacy/pipeline/_edit_tree_internals/edit_trees.pyx":12 + * + * from ... import util + * from ...errors import Errors # <<<<<<<<<<<<<< + * from ...strings import StringStore + * from .schemas import validate_edit_tree +*/ + { + PyObject* const __pyx_imported_names[] = {__pyx_mstate_global->__pyx_n_u_Errors}; + __pyx_t_1 = __Pyx_Import(__pyx_mstate_global->__pyx_n_u_errors, __pyx_imported_names, 1, __pyx_mstate_global->__pyx_kp_u_spacy_errors, 3); if (unlikely(!__pyx_t_1)) __PYX_ERR(0, 12, __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_Errors}; + __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, 12, __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, 12, __pyx_L1_error) + __Pyx_DECREF(__pyx_t_4); __pyx_t_4 = 0; + } + } + __Pyx_DECREF(__pyx_t_2); __pyx_t_2 = 0; + + /* "spacy/pipeline/_edit_tree_internals/edit_trees.pyx":13 + * from ... import util + * from ...errors import Errors + * from ...strings import StringStore # <<<<<<<<<<<<<< + * from .schemas import validate_edit_tree + * +*/ + { + PyObject* const __pyx_imported_names[] = {__pyx_mstate_global->__pyx_n_u_StringStore}; + __pyx_t_1 = __Pyx_Import(__pyx_mstate_global->__pyx_n_u_strings, __pyx_imported_names, 1, __pyx_mstate_global->__pyx_kp_u_spacy_strings, 3); if (unlikely(!__pyx_t_1)) __PYX_ERR(0, 13, __pyx_L1_error) + } + __pyx_t_2 = __pyx_t_1; + __Pyx_GOTREF(__pyx_t_2); + __Pyx_DECREF(__pyx_t_2); __pyx_t_2 = 0; + + /* "spacy/pipeline/_edit_tree_internals/edit_trees.pyx":14 + * from ...errors import Errors + * from ...strings import StringStore + * from .schemas import validate_edit_tree # <<<<<<<<<<<<<< + * + * NULL_TREE_ID = UINT32_MAX +*/ + { + PyObject* const __pyx_imported_names[] = {__pyx_mstate_global->__pyx_n_u_validate_edit_tree}; + __pyx_t_1 = __Pyx_Import(__pyx_mstate_global->__pyx_n_u_schemas, __pyx_imported_names, 1, __pyx_mstate_global->__pyx_kp_u_spacy_pipeline__edit_tree_intern_2, 1); 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_validate_edit_tree}; + __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; + + /* "spacy/pipeline/_edit_tree_internals/edit_trees.pyx":16 + * from .schemas import validate_edit_tree + * + * NULL_TREE_ID = UINT32_MAX # <<<<<<<<<<<<<< + * + * cdef LCS find_lcs(str source, str target): +*/ + __pyx_v_5spacy_8pipeline_20_edit_tree_internals_10edit_trees_NULL_TREE_ID = UINT32_MAX; + + /* "spacy/pipeline/_edit_tree_internals/edit_trees.pyx":69 + * self.strings = strings + * + * cpdef uint32_t add(self, str form, str lemma): # <<<<<<<<<<<<<< + * """Add an edit tree that rewrites the given string into the given lemma. + * +*/ + __pyx_t_2 = __Pyx_CyFunction_New(&__pyx_mdef_5spacy_8pipeline_20_edit_tree_internals_10edit_trees_9EditTrees_3add, __Pyx_CYFUNCTION_CCLASS, __pyx_mstate_global->__pyx_n_u_EditTrees_add, NULL, __pyx_mstate_global->__pyx_n_u_spacy_pipeline__edit_tree_intern, __pyx_mstate_global->__pyx_d, ((PyObject *)__pyx_mstate_global->__pyx_codeobj_tab[3])); if (unlikely(!__pyx_t_2)) __PYX_ERR(0, 69, __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_5spacy_8pipeline_20_edit_tree_internals_10edit_trees_EditTrees, __pyx_mstate_global->__pyx_n_u_add, __pyx_t_2) < (0)) __PYX_ERR(0, 69, __pyx_L1_error) + __Pyx_DECREF(__pyx_t_2); __pyx_t_2 = 0; + + /* "spacy/pipeline/_edit_tree_internals/edit_trees.pyx":122 + * return tree_id + * + * cpdef str apply(self, uint32_t tree_id, str form): # <<<<<<<<<<<<<< + * """Apply an edit tree to a form. + * +*/ + __pyx_t_2 = __Pyx_CyFunction_New(&__pyx_mdef_5spacy_8pipeline_20_edit_tree_internals_10edit_trees_9EditTrees_5apply, __Pyx_CYFUNCTION_CCLASS, __pyx_mstate_global->__pyx_n_u_EditTrees_apply, NULL, __pyx_mstate_global->__pyx_n_u_spacy_pipeline__edit_tree_intern, __pyx_mstate_global->__pyx_d, ((PyObject *)__pyx_mstate_global->__pyx_codeobj_tab[4])); if (unlikely(!__pyx_t_2)) __PYX_ERR(0, 122, __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_5spacy_8pipeline_20_edit_tree_internals_10edit_trees_EditTrees, __pyx_mstate_global->__pyx_n_u_apply, __pyx_t_2) < (0)) __PYX_ERR(0, 122, __pyx_L1_error) + __Pyx_DECREF(__pyx_t_2); __pyx_t_2 = 0; + + /* "spacy/pipeline/_edit_tree_internals/edit_trees.pyx":170 + * raise ValueError(Errors.E1029) + * + * cpdef unicode tree_to_str(self, uint32_t tree_id): # <<<<<<<<<<<<<< + * """Return the tree as a string. The tree tree string is formatted + * like an S-expression. This is primarily useful for debugging. Match +*/ + __pyx_t_2 = __Pyx_CyFunction_New(&__pyx_mdef_5spacy_8pipeline_20_edit_tree_internals_10edit_trees_9EditTrees_7tree_to_str, __Pyx_CYFUNCTION_CCLASS, __pyx_mstate_global->__pyx_n_u_EditTrees_tree_to_str, NULL, __pyx_mstate_global->__pyx_n_u_spacy_pipeline__edit_tree_intern, __pyx_mstate_global->__pyx_d, ((PyObject *)__pyx_mstate_global->__pyx_codeobj_tab[5])); if (unlikely(!__pyx_t_2)) __PYX_ERR(0, 170, __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_5spacy_8pipeline_20_edit_tree_internals_10edit_trees_EditTrees, __pyx_mstate_global->__pyx_n_u_tree_to_str, __pyx_t_2) < (0)) __PYX_ERR(0, 170, __pyx_L1_error) + __Pyx_DECREF(__pyx_t_2); __pyx_t_2 = 0; + + /* "spacy/pipeline/_edit_tree_internals/edit_trees.pyx":207 + * return f"(m {match_node.prefix_len} {match_node.suffix_len} {prefix_tree} {suffix_tree})" + * + * def from_json(self, trees: list) -> "EditTrees": # <<<<<<<<<<<<<< + * self.trees.clear() + * +*/ + __pyx_t_2 = __Pyx_PyDict_NewPresized(2); 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_trees, __pyx_mstate_global->__pyx_n_u_list) < (0)) __PYX_ERR(0, 207, __pyx_L1_error) + if (PyDict_SetItem(__pyx_t_2, __pyx_mstate_global->__pyx_n_u_return, __pyx_mstate_global->__pyx_kp_u_EditTrees_2) < (0)) __PYX_ERR(0, 207, __pyx_L1_error) + __pyx_t_4 = __Pyx_CyFunction_New(&__pyx_mdef_5spacy_8pipeline_20_edit_tree_internals_10edit_trees_9EditTrees_9from_json, __Pyx_CYFUNCTION_CCLASS, __pyx_mstate_global->__pyx_n_u_EditTrees_from_json, NULL, __pyx_mstate_global->__pyx_n_u_spacy_pipeline__edit_tree_intern, __pyx_mstate_global->__pyx_d, ((PyObject *)__pyx_mstate_global->__pyx_codeobj_tab[6])); 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_5spacy_8pipeline_20_edit_tree_internals_10edit_trees_EditTrees, __pyx_mstate_global->__pyx_n_u_from_json, __pyx_t_4) < (0)) __PYX_ERR(0, 207, __pyx_L1_error) + __Pyx_DECREF(__pyx_t_4); __pyx_t_4 = 0; + + /* "spacy/pipeline/_edit_tree_internals/edit_trees.pyx":216 + * self._rebuild_tree_map() + * + * def from_bytes(self, bytes_data: bytes, *) -> "EditTrees": # <<<<<<<<<<<<<< + * def deserialize_trees(tree_dicts): + * cdef EditTreeC c_tree +*/ + __pyx_t_4 = __Pyx_PyDict_NewPresized(2); if (unlikely(!__pyx_t_4)) __PYX_ERR(0, 216, __pyx_L1_error) + __Pyx_GOTREF(__pyx_t_4); + if (PyDict_SetItem(__pyx_t_4, __pyx_mstate_global->__pyx_n_u_bytes_data, __pyx_mstate_global->__pyx_n_u_bytes) < (0)) __PYX_ERR(0, 216, __pyx_L1_error) + if (PyDict_SetItem(__pyx_t_4, __pyx_mstate_global->__pyx_n_u_return, __pyx_mstate_global->__pyx_kp_u_EditTrees_2) < (0)) __PYX_ERR(0, 216, __pyx_L1_error) + __pyx_t_2 = __Pyx_CyFunction_New(&__pyx_mdef_5spacy_8pipeline_20_edit_tree_internals_10edit_trees_9EditTrees_11from_bytes, __Pyx_CYFUNCTION_CCLASS, __pyx_mstate_global->__pyx_n_u_EditTrees_from_bytes, NULL, __pyx_mstate_global->__pyx_n_u_spacy_pipeline__edit_tree_intern, __pyx_mstate_global->__pyx_d, ((PyObject *)__pyx_mstate_global->__pyx_codeobj_tab[7])); if (unlikely(!__pyx_t_2)) __PYX_ERR(0, 216, __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_5spacy_8pipeline_20_edit_tree_internals_10edit_trees_EditTrees, __pyx_mstate_global->__pyx_n_u_from_bytes, __pyx_t_2) < (0)) __PYX_ERR(0, 216, __pyx_L1_error) + __Pyx_DECREF(__pyx_t_2); __pyx_t_2 = 0; + + /* "spacy/pipeline/_edit_tree_internals/edit_trees.pyx":231 + * return self + * + * def to_bytes(self, **kwargs) -> bytes: # <<<<<<<<<<<<<< + * tree_dicts = [] + * for tree in self.trees: +*/ + __pyx_t_2 = __Pyx_PyDict_NewPresized(1); if (unlikely(!__pyx_t_2)) __PYX_ERR(0, 231, __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_bytes) < (0)) __PYX_ERR(0, 231, __pyx_L1_error) + __pyx_t_4 = __Pyx_CyFunction_New(&__pyx_mdef_5spacy_8pipeline_20_edit_tree_internals_10edit_trees_9EditTrees_13to_bytes, __Pyx_CYFUNCTION_CCLASS, __pyx_mstate_global->__pyx_n_u_EditTrees_to_bytes, NULL, __pyx_mstate_global->__pyx_n_u_spacy_pipeline__edit_tree_intern, __pyx_mstate_global->__pyx_d, ((PyObject *)__pyx_mstate_global->__pyx_codeobj_tab[8])); if (unlikely(!__pyx_t_4)) __PYX_ERR(0, 231, __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_5spacy_8pipeline_20_edit_tree_internals_10edit_trees_EditTrees, __pyx_mstate_global->__pyx_n_u_to_bytes, __pyx_t_4) < (0)) __PYX_ERR(0, 231, __pyx_L1_error) + __Pyx_DECREF(__pyx_t_4); __pyx_t_4 = 0; + + /* "spacy/pipeline/_edit_tree_internals/edit_trees.pyx":242 + * return util.to_bytes(serializers, []) + * + * def to_disk(self, path, **kwargs) -> "EditTrees": # <<<<<<<<<<<<<< + * path = util.ensure_path(path) + * with path.open("wb") as file_: +*/ + __pyx_t_4 = __Pyx_PyDict_NewPresized(1); if (unlikely(!__pyx_t_4)) __PYX_ERR(0, 242, __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_kp_u_EditTrees_2) < (0)) __PYX_ERR(0, 242, __pyx_L1_error) + __pyx_t_2 = __Pyx_CyFunction_New(&__pyx_mdef_5spacy_8pipeline_20_edit_tree_internals_10edit_trees_9EditTrees_15to_disk, __Pyx_CYFUNCTION_CCLASS, __pyx_mstate_global->__pyx_n_u_EditTrees_to_disk, NULL, __pyx_mstate_global->__pyx_n_u_spacy_pipeline__edit_tree_intern, __pyx_mstate_global->__pyx_d, ((PyObject *)__pyx_mstate_global->__pyx_codeobj_tab[9])); if (unlikely(!__pyx_t_2)) __PYX_ERR(0, 242, __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_5spacy_8pipeline_20_edit_tree_internals_10edit_trees_EditTrees, __pyx_mstate_global->__pyx_n_u_to_disk, __pyx_t_2) < (0)) __PYX_ERR(0, 242, __pyx_L1_error) + __Pyx_DECREF(__pyx_t_2); __pyx_t_2 = 0; + + /* "spacy/pipeline/_edit_tree_internals/edit_trees.pyx":247 + * file_.write(self.to_bytes()) + * + * def from_disk(self, path, **kwargs) -> "EditTrees": # <<<<<<<<<<<<<< + * path = util.ensure_path(path) + * if path.exists(): +*/ + __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_kp_u_EditTrees_2) < (0)) __PYX_ERR(0, 247, __pyx_L1_error) + __pyx_t_4 = __Pyx_CyFunction_New(&__pyx_mdef_5spacy_8pipeline_20_edit_tree_internals_10edit_trees_9EditTrees_17from_disk, __Pyx_CYFUNCTION_CCLASS, __pyx_mstate_global->__pyx_n_u_EditTrees_from_disk, NULL, __pyx_mstate_global->__pyx_n_u_spacy_pipeline__edit_tree_intern, __pyx_mstate_global->__pyx_d, ((PyObject *)__pyx_mstate_global->__pyx_codeobj_tab[10])); 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_5spacy_8pipeline_20_edit_tree_internals_10edit_trees_EditTrees, __pyx_mstate_global->__pyx_n_u_from_disk, __pyx_t_4) < (0)) __PYX_ERR(0, 247, __pyx_L1_error) + __Pyx_DECREF(__pyx_t_4); __pyx_t_4 = 0; + + /* "spacy/pipeline/_edit_tree_internals/edit_trees.pyx":262 + * return self.trees.size() + * + * def _rebuild_tree_map(self): # <<<<<<<<<<<<<< + * """Rebuild the tree hash -> tree id mapping""" + * cdef EditTreeC c_tree +*/ + __pyx_t_4 = __Pyx_CyFunction_New(&__pyx_mdef_5spacy_8pipeline_20_edit_tree_internals_10edit_trees_9EditTrees_23_rebuild_tree_map, __Pyx_CYFUNCTION_CCLASS, __pyx_mstate_global->__pyx_n_u_EditTrees__rebuild_tree_map, NULL, __pyx_mstate_global->__pyx_n_u_spacy_pipeline__edit_tree_intern, __pyx_mstate_global->__pyx_d, ((PyObject *)__pyx_mstate_global->__pyx_codeobj_tab[11])); if (unlikely(!__pyx_t_4)) __PYX_ERR(0, 262, __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 (__Pyx_SetItemOnTypeDict(__pyx_mstate_global->__pyx_ptype_5spacy_8pipeline_20_edit_tree_internals_10edit_trees_EditTrees, __pyx_mstate_global->__pyx_n_u_rebuild_tree_map, __pyx_t_4) < (0)) __PYX_ERR(0, 262, __pyx_L1_error) + __Pyx_DECREF(__pyx_t_4); __pyx_t_4 = 0; + + /* "spacy/pipeline/_edit_tree_internals/edit_trees.pyx":275 + * self.map.insert(pair[hash_t, uint32_t](tree_hash, tree_id)) + * + * def __reduce__(self): # <<<<<<<<<<<<<< + * return (unpickle_edittrees, (self.strings, self.to_bytes())) + * +*/ + __pyx_t_4 = __Pyx_CyFunction_New(&__pyx_mdef_5spacy_8pipeline_20_edit_tree_internals_10edit_trees_9EditTrees_25__reduce__, __Pyx_CYFUNCTION_CCLASS, __pyx_mstate_global->__pyx_n_u_EditTrees___reduce, NULL, __pyx_mstate_global->__pyx_n_u_spacy_pipeline__edit_tree_intern, __pyx_mstate_global->__pyx_d, ((PyObject *)__pyx_mstate_global->__pyx_codeobj_tab[12])); if (unlikely(!__pyx_t_4)) __PYX_ERR(0, 275, __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 (__Pyx_SetItemOnTypeDict(__pyx_mstate_global->__pyx_ptype_5spacy_8pipeline_20_edit_tree_internals_10edit_trees_EditTrees, __pyx_mstate_global->__pyx_n_u_reduce, __pyx_t_4) < (0)) __PYX_ERR(0, 275, __pyx_L1_error) + __Pyx_DECREF(__pyx_t_4); __pyx_t_4 = 0; + + /* "spacy/pipeline/_edit_tree_internals/edit_trees.pyx":279 + * + * + * def unpickle_edittrees(strings, trees_data): # <<<<<<<<<<<<<< + * return EditTrees(strings).from_bytes(trees_data) + * +*/ + __pyx_t_4 = __Pyx_CyFunction_New(&__pyx_mdef_5spacy_8pipeline_20_edit_tree_internals_10edit_trees_1unpickle_edittrees, 0, __pyx_mstate_global->__pyx_n_u_unpickle_edittrees, NULL, __pyx_mstate_global->__pyx_n_u_spacy_pipeline__edit_tree_intern, __pyx_mstate_global->__pyx_d, ((PyObject *)__pyx_mstate_global->__pyx_codeobj_tab[13])); if (unlikely(!__pyx_t_4)) __PYX_ERR(0, 279, __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_unpickle_edittrees, __pyx_t_4) < (0)) __PYX_ERR(0, 279, __pyx_L1_error) + __Pyx_DECREF(__pyx_t_4); __pyx_t_4 = 0; + + /* "spacy/pipeline/_edit_tree_internals/edit_trees.pyx":283 + * + * + * def _tree2dict(tree): # <<<<<<<<<<<<<< + * if tree["is_match_node"]: + * tree = tree["inner"]["match_node"] +*/ + __pyx_t_4 = __Pyx_CyFunction_New(&__pyx_mdef_5spacy_8pipeline_20_edit_tree_internals_10edit_trees_3_tree2dict, 0, __pyx_mstate_global->__pyx_n_u_tree2dict, NULL, __pyx_mstate_global->__pyx_n_u_spacy_pipeline__edit_tree_intern, __pyx_mstate_global->__pyx_d, ((PyObject *)__pyx_mstate_global->__pyx_codeobj_tab[14])); if (unlikely(!__pyx_t_4)) __PYX_ERR(0, 283, __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_tree2dict, __pyx_t_4) < (0)) __PYX_ERR(0, 283, __pyx_L1_error) + __Pyx_DECREF(__pyx_t_4); __pyx_t_4 = 0; + + /* "spacy/pipeline/_edit_tree_internals/edit_trees.pyx":291 + * + * + * def _dict2tree(tree): # <<<<<<<<<<<<<< + * errors = validate_edit_tree(tree) + * if errors: +*/ + __pyx_t_4 = __Pyx_CyFunction_New(&__pyx_mdef_5spacy_8pipeline_20_edit_tree_internals_10edit_trees_5_dict2tree, 0, __pyx_mstate_global->__pyx_n_u_dict2tree, NULL, __pyx_mstate_global->__pyx_n_u_spacy_pipeline__edit_tree_intern, __pyx_mstate_global->__pyx_d, ((PyObject *)__pyx_mstate_global->__pyx_codeobj_tab[15])); if (unlikely(!__pyx_t_4)) __PYX_ERR(0, 291, __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_dict2tree, __pyx_t_4) < (0)) __PYX_ERR(0, 291, __pyx_L1_error) + __Pyx_DECREF(__pyx_t_4); __pyx_t_4 = 0; + + /* "spacy/pipeline/_edit_tree_internals/edit_trees.pyx":1 + * # cython: infer_types=True, binding=True # <<<<<<<<<<<<<< + * # cython: profile=False + * from cython.operator cimport dereference as deref +*/ + __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 spacy.pipeline._edit_tree_internals.edit_trees", __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 spacy.pipeline._edit_tree_internals.edit_trees"); + } + __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_enumerate = __Pyx_GetBuiltinName(__pyx_mstate->__pyx_n_u_enumerate); if (!__pyx_builtin_enumerate) __PYX_ERR(0, 38, __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); + + /* "spacy/pipeline/_edit_tree_internals/edit_trees.pyx":244 + * def to_disk(self, path, **kwargs) -> "EditTrees": + * path = util.ensure_path(path) + * with path.open("wb") as file_: # <<<<<<<<<<<<<< + * file_.write(self.to_bytes()) + * +*/ + __pyx_mstate_global->__pyx_tuple[0] = PyTuple_Pack(3, Py_None, Py_None, Py_None); if (unlikely(!__pyx_mstate_global->__pyx_tuple[0])) __PYX_ERR(0, 244, __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 CYTHON_COMPILING_IN_CPYTHON_FREETHREADING + Py_SET_REFCNT(table[i], _Py_IMMORTAL_REFCNT_LOCAL); + #else + 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: 8; } index[] = {{0},{11},{39},{55},{52},{52},{53},{53},{46},{47},{55},{47},{4},{179},{3},{2},{2},{1},{1},{1},{1},{1},{8},{18},{18},{7},{6},{2},{9},{3},{22},{4},{6},{12},{43},{50},{13},{0},{5},{5},{5},{9},{20},{27},{13},{15},{20},{19},{19},{18},{17},{21},{6},{20},{11},{3},{5},{18},{5},{10},{6},{18},{4},{17},{13},{10},{11},{9},{9},{6},{6},{8},{5},{4},{6},{10},{37},{28},{9},{9},{8},{5},{13},{13},{5},{6},{8},{5},{4},{8},{10},{10},{1},{8},{4},{4},{4},{3},{10},{11},{12},{14},{12},{2},{4},{17},{10},{6},{7},{4},{11},{12},{10},{46},{7},{5},{10},{10},{11},{8},{8},{26},{7},{4},{10},{9},{10},{9},{7},{11},{5},{10},{18},{4},{18},{6},{2},{5},{61},{17},{9},{69},{185},{70},{68},{64},{18},{29},{52},{93},{46},{40},{4},{51},{21},{39}}; + #if (CYTHON_COMPRESS_STRINGS) == 2 /* compression: bz2 (1640 bytes) */ +const char* const cstring = "BZh91AY&SY\343\330\275\252\000\000\301\177\377\367\377\377\361\357\377\377}\257\357\377\332\277\377\377\372@@@@@@@@@@@@@\000@\000P\005\356v\367\275\273\332\353\334\273\255\325\314\356k\273\227\203\203S\"\236\241\241\032\203\365\032\230zi\211\225\036\243L\2154z&\010dz\217Ph\323FC5\0317\251\006\321=\251\35126\250% \214\206\210b\232\237\2444\236S\322z\203\312\032\000\006\200\000\000\000\000\0004\000\000\323D\312i\032j5\036Q\355P\365\000=F\217P\003@\006\200\000\000\000\032\000\001\352\000\t\024\"b\236\223ORz\236\220\304\332@4\003@\320\000\000=@\323@\003@\000\000\032\002Q4#MJz\233S\323OD\323\024\320\332\200\032h\000\000\000\r\000\000\000h\000\0002\2728\330B\032\273\"\3670\214]\027\371\323t\310\032\245\031\020Y\363\227J0\021\020\300\2015R\306\017\364\215Bv\205C\032lm\261\215\266\014U^\0258\345\230t\250\266TR\251`\026\314\200\231\024\262R\225sQ<\354E\020V\225\320\222\313\225\371Q]\203(XNj\021\201\301\022\r\253\270*\222I\235)I\274\332+,DG\3724v\240R\364(\346\353B\210I\021\221\2206\251)\224\334\323\270\300\327\215`\005\017\354\345\260\200<\222\242\272\276\205P\2431\234\200\373\000D\223\236X\261\006\246\232\030\222\004r\357\346\031\214]3\230\200]\343ns$\3341\216\275E\232\213\323fu\3267T\253\256R\354\211jD%U\373\315c\325T&\266\333e\273\355\343\313.\2151\317 \263\234F\262e\014\246\230\3065\2214#\322X;\2134\261c_\206\\a\205\005\200\246\305\254\247\272\252M\035\036\222\217\007\223[\337*M\027\352\350\031Z8\230b\321-ej\0176\022\216D)BhC3\006&|\355\tR\326\014$\014Ec\357KN\033\030L\355p\270\323\353\323\273K\rQ\345*\352\261\331~\365\340A\0254\244%\355\317\312\316\232\201\266(1a\303~\345\003IUi\010\305Y@\342\371\245\237\215M\r\3258g\020M'\3251\275oz?!\205g\n\331\324\245\251~\332\2652p\250\310\330\360\274\3659\025`\022\231\232\345\202\037\207\273 \223[\200\342R&\201\343\220\254\006\332mW9@JE\020mSlcOe\031\231T`\214#s\232D\234\271\204\024\212Rc-d\010wtf\250\255y.\204\235y\353\027\177F\360\031\326\323)=\220\020~Q\251t\327\246\301R\217\242\257\333\213\204r\212\332\2664b\n\254\\e\311\2040cf""\323\021\213*\321\321\034\312\342\355d\322\356\354,\275\010\032h\010[\302\206\001K\322\315F\220\326\220\211R\005\033\010U\210\204\262\352\002\010\361R\"d[\250|\020\034\251Y\034\262h\323\320ZcKb[U,\265q\256LQ\35001\202ZD\231C\254*\277B\006b\005\213\301v&VT5d\312.\3764\317\036g'\005jD\t\332*kH\201i\227\320J\037\314T\006\235W\223\025\212&\002\n\214Qq\200A\217-@xf\264\267\022\213\242\205U\017K\261\n\211\351n\314\232\002J{x\244dJ\250\250\002i\272!ZqlpwgXl\\2\272\303y\030\360\255\001\332\326\212\024*\372\005-\230\2712\270J\303\231\0350T\027q\206\t\316\372\nn$\344aQ\370k\220XQ\007W\357g%p\252\342\004\320\"e\014\2601F\340a3\223Y\025\217E\244\264\217zN\350\337[^\240\233*\301\024\241\033\005\313@\021\010H\327\334\311&\252\243\275\250\305f+w\231\222\375A3)R\227\t$TJ)P\201^\370\260rl\000Z\302D\014\013a\030-\204\251bFSB\265\020\301dU\203\244\257\2326sJ&\204\322t\240\240\200C\320\000\264\352\355h\210\000\2241`\300\200\325\242A$\002\211\214r\200\343\026h\270\245\242\274\364\017\235\025\320\322\302td\212\314aI@\223\223\344b\005\244\272\367H\274F\272\222\250\307\\j\237\r\031\025\204\303}b\321a\264\207\025\302;}\345\264\031F;\033+\215\375t\"^d\351\006p\r\203KL\032\247\334\250 \210R*g\270d\236 0#\315\254\007(\245\010\0273\237\247W\341q\354P1\250*\242\346\252+\222qZ\030s\221\306\014\016\242D\030\262\254[\266I\345\262\200\307\244M<\2702\256\010\022!2\246\267\233;\026\212\242e\276\022\304\300\034\345\220\024\370\330\365\2648\234\205\306\003E\360z\245\231\2022\300\212\243\204\327RV\242B\362\003\014\217E >\274\001l\274\n\3022\276\210\205\233\212\256\322s\024f\311Bh\002\342d\021\217m\035\323\235\255M\020b#KH\255\334\204\031e\301\027q)\314\276\225\355*\222\260\270\004\342\014\014\344\206\224\034\313\330\0321\325\270\327\357\353[\227\342\255E\371\035\317o\365;\2612\363u\337a?\234\261\335\332CvYj\311\315C\004'\344\235\000e\232\370.\226f\210U\033\366\240WL\351\234\0215j\002\322\341\236D\230\200\262hRKHl\"(\264S\376.\344\212p\241!\307\261{T"; + PyObject *data = __Pyx_DecompressString(cstring, 1640, 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 (1484 bytes) */ +const char* const cstring = "x\332\225UAs\0237\024\306\035C\035p\212]H(9\204\365\224\340\004\250\301\211\311\2204C\307CBa\240)&\241t\350d4\362\256\034+Y\357\256W\332$\246\303L\216>\352\250\343\036}\364\321\307\0349\372\350\243\177\002?\241OZ'6\204\266\344\020Yz\373\236\336\367\276\367=%\273fQ\276\351\023\302\262\277\271>1x\025;\206\353\020#p\250\353\030\230s\237\226\003N\014\0173F\254e#\273\356\032{\330\016\210\301\222'\353\371\244B\017\220M\234\354W\307\260\240r\346\230A\036\016\265\2379\321\331\202\\\237n\237%E\231\361\257w\247\014\32507\253\310q\2553`\242\216C|pw\310\272\313u\333\271\361\270\301\253\3208\312\014\213\330\264L|\314\211\335P\301\324\344\304\217\264\361r\355\345O\205\207\005\350\267e\370d\207\230\234\031\000\331\264\225>\230\222@9\2406\247\216\301\033\036a9\343Y\305h\270\201\341\020\300\302]\255\243\321\000\020\214c0\302\265r\262\330q\\\2169\350\007A8u\266\263\206E}HB\367\210\212~\202mFrY#\233\235\233\2353\346.\346~\301\226\005\245s\222\325\210\262#\\\014,\232\317\310bQ\206\3136!\216Z\267M\312\242\2355[3\206qw\215a\304,\203x\017\233\215\\\264\022\337w}\026\355=\352\001K\016\311!\002#\244%\201\250\003<9\2001\307\314*\251\341\310\365\336\261\353\275/\271\336;\261\261\234\3278\030\244\003\316\235m\266\226\277?\277\250\226%X\026\356\237\314\352\311&\207\220O\254\300$\010\215\330|\242z`E\211j\330\033~\002\266F\016\236g7\206\307\212\357\326P\271\301G\257\3276\240m\3673\323\016s\235\241\211\273\237\307\201\345\323(\r\005\254P\330\232&\021\241\227\215\003\370[\005m\241ur\300_\221\312\206\256z\203\303C\004@5<\314\032\216I\335\234\351\372n\000\252\"Lg\322\013\2620\307\246\256\322T\364\002\247p\300&)csW}\263\010#>\3056}G\"\202G\014\200\300\202\324\363\312N\034\026\370\004y\230W\021\"\2521\352'\250\351\t\210zN\016(\343\000\032~9B\025j\023\004\203US\177\230\017\231\033\356r+\266kB{\037\345N\241\370\222\323\212\215ke\013?:!\374\204f\310\0268&Bzb\021\214\373\t\025\237\214>\345\244\306v\367\261\277\315\216\357\262I\255""\006iA\313\340\007\334\214x\303\336\265\002(\002\201\331\3015\330\270\036q\324K\245X\360\\o\370\014\217<\224\010\201B\221\211=\212P\264\337\343j\202\324\251\036`;\272\311/\253\376\235R\341P\252>\341\201\357\034\217\010\261+\243]A\360\030\014 \301\316\"\025\034\330\374kFn8G\203\351\321s<\034\346\341?\211\221W\034!h\003\020t,\341\343\337\323\235\031H:\0222,\363J>\372\364\311\206\351]\025\263j\004\317\032Q\276\006\247\027-\335\300\361\250\271\013\354)\344\332\014m\265\341\375\246\360\225\014k\324/:\333/\357\373\320\344n\374N+\337K\\nr\261\"\353a\254\227\270\324,4\367\005\356\245'\304k\231\221Ka\261\227\272&\002\271\026\246{\311+\242 \376\0163a\276\017!\365\303X/~\251\271$\212\342O\371W+\326J\207S\335;+\235b\247tX\3748yn,\331\\h\342\346\236\330\220\337\310\233\322\014\323a\266u\245U\204k\272Wf\302Rh\302i\275\223\211\256m\204\2610\335\327H\036\310\230\234\224u\270dZ]\362P,\010K\336\n\317\207\245^\362{q[\026\345\037\n\301\264\264\302[*\355\307\013\312\255\000\221\371^\362\272\274\252>\253K\027e\032\362VC\034\276kOu\362\235\325\243\304\207\330\207\251\356\306f?1\023n\266&[\365~b\022j\205\242\227\305V\370\243J0\005!v+\323Zn\227\376\347\343\345f\000\245\277\225\357[\305\326\333\366\373\243\342\321V\367\325\006\334\016\300S\377\005\374\232\250\367\022c\275dJ|+\352r,\234\014\353\275\313)\205X\267\302\027\023\002\013U~\362\334\330xsU\\\020\270\237H6\237C\027\212r\023\334\003E\342\204\330T,A\317\222?\310q\240\023\253\033\343\342W\371\240k\314\2673\355\237;\270\033\277\t\375KL\210R\017.x*VeL\245Y\226%\t\336\223b[m\006eBv\361\\\326\243\026,A\246\255V\346\020\202S\335\224\"k\252]h7\216b\315X\037\262\214\313R/u]N\205y%\217\253\342\211\274\035\026\303R7>\023n\2653P\234\202~\035\222\251\324b\027\244\243\361\327e2\374\275\r\014$\273\311i\225x \242\361\356\370\r]I\374\333C\240\346\273\346\216V\300^\370\006\250}\323^\355\234\357\224:\270\037W\332\254\013\355\366^\327J\217\016\303xZ\267\242\2418N\213I\300\037\227\317\302\222<\010\353\335\370\r\331h\305T]O\304-\031\353k~\213#\354\246\240o;\221\250\243r\003x\\\026\346\021?\267\376\372\305\013\264\371jm\r=[U\306\305\002\342\306\354\236K-\343\366]\003\014w\215c\363\33495\373\213\205\177\000Ora\032"; + PyObject *data = __Pyx_DecompressString(cstring, 1484, 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 (2905 bytes) */ +const char* const bytes = "'EditTrees'More than one union attribute passed: 'No value specified for any of the union attributes (%s)No value specified for struct attribute 'prefix_len'No value specified for struct attribute 'suffix_len'No value specified for struct attribute 'prefix_tree'No value specified for struct attribute 'suffix_tree'No value specified for struct attribute 'orig'No value specified for struct attribute 'subst'No value specified for struct attribute 'is_match_node'No value specified for struct attribute 'inner'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.' '')() )\n.?add_note' and 'match_node'' and 'subst_node'disableenablegcisenabled(m match_node, subst_node(s 'spacy.spacy.errorsspacy.pipeline._edit_tree_internals.schemasspacy/pipeline/_edit_tree_internals/edit_trees.pyxspacy.stringsE1026E1029E1030EditTreesEditTrees.__reduce__EditTrees._rebuild_tree_mapEditTrees.addEditTrees.applyEditTrees.from_bytesEditTrees.from_diskEditTrees.from_jsonEditTrees.to_bytesEditTrees.to_diskEditTrees.tree_to_strErrors__Pyx_PyDict_NextRefStringStoreaddapplyasyncio.coroutinesbytesbytes_datac_treecline_in_tracebackdatadeserialize_treesdeserializers_dict2treeensure_path__enter__enumerateerrorsexists__exit__file_formformatfrom_bytesfrom_bytes..deserialize_treesfrom_bytes..from_diskfrom_json__func__inner_is_coroutineis_match_nodeitemskwargslemmalist__main__match_node__module__n__name__openorigpathpopprefix_lenprefix_tree__pyx_capi____pyx_vtable____qualname__rbread_rebuild_tree_map__reduce__returnschemasselfserializers__set_name__setdefaultspacy.pipeline._edit_tree_internals.edit_treesstringssubstsubst_nodesuffix_lensuffix_tree__test__to_bytesto_bytes..to_disktree_tree2dicttree_dicttree_dictstree_hashtree_idtree_to_strtreestrees_dataunpickle_edittreesutilvalidate_edit_treevalueswbwrite\320\004+\2501\330\010\017""\210t\220<\230q\240\001\330\010\013\2104\210w\220a\330\021\025\220U\230!\2309\240A\330\020\027\220u\230E\240\021\330\014\023\2204\220{\240!\2401\340\010\017\210q\200\001\330\004\013\2109\220A\220X\230[\250\001\250\021\240\032\320+<\270A\270Q\200A\360\026\000\t\014\2103\210a\210v\220S\230\002\230$\230c\240\021\240'\250\023\250A\330\014\023\320\023%\240Q\240c\250\023\250N\270!\330\014\023\2204\220y\240\001\240\021\340\010\017\210t\2205\230\001\230\026\230q\200A\360\036\000\t\014\2108\2203\220d\230&\240\005\240Q\330\014\022\220*\230A\230V\2401\340\010\036\230d\240&\250\001\250\021\360\006\000\t\014\2104\210t\2201\330\014\031\230\024\230V\2401\330\014\023\2206\230\021\230$\230h\240a\240z\260\032\2701\270D\300\010\310\001\310\032\320ST\340\010%\240T\250\026\250q\340\010\026\220a\330\010\013\210:\220]\240#\240Q\330\014\032\230$\230l\250!\250:\260Q\340\010\026\220a\330\010\013\210:\220]\240#\240Q\330\014\032\230$\230l\250!\250:\260Q\340\010\017\210u\220A\220Z\230}\250A\250Z\260}\300A\300]\320RS\320ST\200A\360\020\000\t\014\2108\2203\220d\230&\240\005\240Q\330\014\022\220*\230A\230V\2401\340\010\027\220q\330\010\t\330\014\020\220\007\220q\230\t\240\026\240q\330\017\020\330\014\023\2201\330\010\017\210r\220\025\220a\220q\200A\360\014\000\t\r\210D\220\006\220a\340\010\014\210K\220u\230A\230T\240\026\240u\250A\330\014\025\220T\230\026\230q\240\001\330\014\030\230\r\240Q\240a\330\014\020\220\004\220G\2305\320 2\260!\260;\270a\320\004$\240A\330\010\025\220Q\330\010\014\210H\220D\230\001\330\014\023\220:\230Q\230a\330\014\026\220g\230Q\230a\340\010\026\220a\330\010\023\2201\220K\230q\340\010\017\210t\2209\230A\230]\250!\200A\330\010\020\320\020%\240T\250\032\2604\260y\300\001\210\001\340\014\020\220\r\230Q\330\020\031\230\032\2401\240A\330\020\024\220F\230*\240A\240Q\320\004%\240]\260!\330\010\t\360\014\000\t\031\230\001\330\010\025\220Q\220k\240\021\330\010\014\210K\220q\230\014\240O\2601\340\010\014\320\014\036\230a\340\010\017\210q\200\001\330\004\r\320\r\037\230q\240\001\330""\004\007\200q\330\010\016\210j\230\001\230\026\230v\240W\250A\250W\260D\270\005\270Q\270a\340\004\013\2104\210q\220\001\330\004\007\200}\220C\220q\330\010\020\320\020!\240\026\240z\260\036\270q\340\010\020\320\020!\240\027\250\n\260.\300\001\340\004\013\2101\200\001\330\004\007\200t\2101\210A\330\010\017\210t\2201\220H\230A\230Q\340\010\017\210t\2201\220H\230A\230Q\330\004\013\2104\210q\220\001\320\004)\250\021\330\010\017\210t\220<\230q\240\001\330\r\021\220\025\220a\220y\240\001\330\014\021\220\026\220q\230\004\230I\240Q\230x\240q\320\004\037\230y\250\001\330\010\014\210F\220&\230\001\340\010\014\210H\220A\330\014\023\220:\230Q\230a\330\014\020\220\006\220j\240\001\240\021\340\010\014\320\014\036\230auint32_t\000NULL_TREE_IDuint64_t (void *, int, uint64_t)\000hash64"; + 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 < 138; i++) { + Py_ssize_t bytes_length = index[i].length; + PyObject *string = PyUnicode_DecodeUTF8(bytes + pos, bytes_length, NULL); + if (likely(string) && i >= 37) 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 = 138; i < 156; 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 < 156; i++) { + if (unlikely(PyObject_Hash(stringtab[i]) == -1)) { + __PYX_ERR(0, 1, __pyx_L1_error) + } + } + #if CYTHON_IMMORTAL_CONSTANTS + { + PyObject **table = stringtab + 138; + for (Py_ssize_t i=0; i<18; ++i) { + #if CYTHON_COMPILING_IN_CPYTHON_FREETHREADING + Py_SET_REFCNT(table[i], _Py_IMMORTAL_REFCNT_LOCAL); + #else + 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 : 9; +} __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, 3, (unsigned int)(CO_OPTIMIZED|CO_NEWLOCALS), 217}; + PyObject* const varnames[] = {__pyx_mstate->__pyx_n_u_tree_dicts, __pyx_mstate->__pyx_n_u_c_tree, __pyx_mstate->__pyx_n_u_tree_dict}; + __pyx_mstate_global->__pyx_codeobj_tab[0] = __Pyx_PyCode_New(descr, varnames, __pyx_mstate->__pyx_kp_u_spacy_pipeline__edit_tree_intern_3, __pyx_mstate->__pyx_n_u_deserialize_trees, __pyx_mstate->__pyx_kp_b_iso88591_Q_1A_F_AQ, 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), 224}; + PyObject* const varnames[] = {__pyx_mstate->__pyx_n_u_n}; + __pyx_mstate_global->__pyx_codeobj_tab[1] = __Pyx_PyCode_New(descr, varnames, __pyx_mstate->__pyx_kp_u_spacy_pipeline__edit_tree_intern_3, __pyx_mstate->__pyx_n_u_lambda, __pyx_mstate->__pyx_kp_b_iso88591_AQ, tuple_dedup_map); if (unlikely(!__pyx_mstate_global->__pyx_codeobj_tab[1])) goto bad; + } + { + const __Pyx_PyCode_New_function_description descr = {0, 0, 0, 0, (unsigned int)(CO_OPTIMIZED|CO_NEWLOCALS), 238}; + PyObject* const varnames[] = {0}; + __pyx_mstate_global->__pyx_codeobj_tab[2] = __Pyx_PyCode_New(descr, varnames, __pyx_mstate->__pyx_kp_u_spacy_pipeline__edit_tree_intern_3, __pyx_mstate->__pyx_n_u_lambda, __pyx_mstate->__pyx_kp_b_iso88591_xq, tuple_dedup_map); if (unlikely(!__pyx_mstate_global->__pyx_codeobj_tab[2])) goto bad; + } + { + const __Pyx_PyCode_New_function_description descr = {3, 0, 0, 3, (unsigned int)(CO_OPTIMIZED|CO_NEWLOCALS), 69}; + PyObject* const varnames[] = {__pyx_mstate->__pyx_n_u_self, __pyx_mstate->__pyx_n_u_form, __pyx_mstate->__pyx_n_u_lemma}; + __pyx_mstate_global->__pyx_codeobj_tab[3] = __Pyx_PyCode_New(descr, varnames, __pyx_mstate->__pyx_kp_u_spacy_pipeline__edit_tree_intern_3, __pyx_mstate->__pyx_n_u_add, __pyx_mstate->__pyx_kp_b_iso88591_A_3avS_c_A_Qc_N_4y_t5_q, tuple_dedup_map); if (unlikely(!__pyx_mstate_global->__pyx_codeobj_tab[3])) goto bad; + } + { + const __Pyx_PyCode_New_function_description descr = {3, 0, 0, 3, (unsigned int)(CO_OPTIMIZED|CO_NEWLOCALS), 122}; + PyObject* const varnames[] = {__pyx_mstate->__pyx_n_u_self, __pyx_mstate->__pyx_n_u_tree_id, __pyx_mstate->__pyx_n_u_form}; + __pyx_mstate_global->__pyx_codeobj_tab[4] = __Pyx_PyCode_New(descr, varnames, __pyx_mstate->__pyx_kp_u_spacy_pipeline__edit_tree_intern_3, __pyx_mstate->__pyx_n_u_apply, __pyx_mstate->__pyx_kp_b_iso88591_A_83d_Q_AV1_q_q_q_1_r_aq, tuple_dedup_map); if (unlikely(!__pyx_mstate_global->__pyx_codeobj_tab[4])) goto bad; + } + { + const __Pyx_PyCode_New_function_description descr = {2, 0, 0, 2, (unsigned int)(CO_OPTIMIZED|CO_NEWLOCALS), 170}; + PyObject* const varnames[] = {__pyx_mstate->__pyx_n_u_self, __pyx_mstate->__pyx_n_u_tree_id}; + __pyx_mstate_global->__pyx_codeobj_tab[5] = __Pyx_PyCode_New(descr, varnames, __pyx_mstate->__pyx_kp_u_spacy_pipeline__edit_tree_intern_3, __pyx_mstate->__pyx_n_u_tree_to_str, __pyx_mstate->__pyx_kp_b_iso88591_A_83d_Q_AV1_d_4t1_V1_6_haz_1D_ST, tuple_dedup_map); if (unlikely(!__pyx_mstate_global->__pyx_codeobj_tab[5])) goto bad; + } + { + const __Pyx_PyCode_New_function_description descr = {2, 0, 0, 3, (unsigned int)(CO_OPTIMIZED|CO_NEWLOCALS), 207}; + PyObject* const varnames[] = {__pyx_mstate->__pyx_n_u_self, __pyx_mstate->__pyx_n_u_trees, __pyx_mstate->__pyx_n_u_tree}; + __pyx_mstate_global->__pyx_codeobj_tab[6] = __Pyx_PyCode_New(descr, varnames, __pyx_mstate->__pyx_kp_u_spacy_pipeline__edit_tree_intern_3, __pyx_mstate->__pyx_n_u_from_json, __pyx_mstate->__pyx_kp_b_iso88591_y_F_HA_Qa_j_a, tuple_dedup_map); if (unlikely(!__pyx_mstate_global->__pyx_codeobj_tab[6])) goto bad; + } + { + const __Pyx_PyCode_New_function_description descr = {2, 0, 0, 5, (unsigned int)(CO_OPTIMIZED|CO_NEWLOCALS), 216}; + PyObject* const varnames[] = {__pyx_mstate->__pyx_n_u_self, __pyx_mstate->__pyx_n_u_bytes_data, __pyx_mstate->__pyx_n_u_deserialize_trees, __pyx_mstate->__pyx_n_u_deserialize_trees, __pyx_mstate->__pyx_n_u_deserializers}; + __pyx_mstate_global->__pyx_codeobj_tab[7] = __Pyx_PyCode_New(descr, varnames, __pyx_mstate->__pyx_kp_u_spacy_pipeline__edit_tree_intern_3, __pyx_mstate->__pyx_n_u_from_bytes, __pyx_mstate->__pyx_kp_b_iso88591_Qk_Kq_O1_a_q, tuple_dedup_map); if (unlikely(!__pyx_mstate_global->__pyx_codeobj_tab[7])) goto bad; + } + { + const __Pyx_PyCode_New_function_description descr = {1, 0, 0, 5, (unsigned int)(CO_OPTIMIZED|CO_NEWLOCALS|CO_VARKEYWORDS), 231}; + PyObject* const varnames[] = {__pyx_mstate->__pyx_n_u_self, __pyx_mstate->__pyx_n_u_kwargs, __pyx_mstate->__pyx_n_u_tree_dicts, __pyx_mstate->__pyx_n_u_tree, __pyx_mstate->__pyx_n_u_serializers}; + __pyx_mstate_global->__pyx_codeobj_tab[8] = __Pyx_PyCode_New(descr, varnames, __pyx_mstate->__pyx_kp_u_spacy_pipeline__edit_tree_intern_3, __pyx_mstate->__pyx_n_u_to_bytes, __pyx_mstate->__pyx_kp_b_iso88591_A_Q_HD_Qa_gQa_a_1Kq_t9A, tuple_dedup_map); if (unlikely(!__pyx_mstate_global->__pyx_codeobj_tab[8])) goto bad; + } + { + const __Pyx_PyCode_New_function_description descr = {2, 0, 0, 4, (unsigned int)(CO_OPTIMIZED|CO_NEWLOCALS|CO_VARKEYWORDS), 242}; + PyObject* const varnames[] = {__pyx_mstate->__pyx_n_u_self, __pyx_mstate->__pyx_n_u_path, __pyx_mstate->__pyx_n_u_kwargs, __pyx_mstate->__pyx_n_u_file}; + __pyx_mstate_global->__pyx_codeobj_tab[9] = __Pyx_PyCode_New(descr, varnames, __pyx_mstate->__pyx_kp_u_spacy_pipeline__edit_tree_intern_3, __pyx_mstate->__pyx_n_u_to_disk, __pyx_mstate->__pyx_kp_b_iso88591_t_q_ay_q_IQ, tuple_dedup_map); if (unlikely(!__pyx_mstate_global->__pyx_codeobj_tab[9])) goto bad; + } + { + const __Pyx_PyCode_New_function_description descr = {2, 0, 0, 5, (unsigned int)(CO_OPTIMIZED|CO_NEWLOCALS|CO_VARKEYWORDS), 247}; + PyObject* const varnames[] = {__pyx_mstate->__pyx_n_u_self, __pyx_mstate->__pyx_n_u_path, __pyx_mstate->__pyx_n_u_kwargs, __pyx_mstate->__pyx_n_u_file, __pyx_mstate->__pyx_n_u_data}; + __pyx_mstate_global->__pyx_codeobj_tab[10] = __Pyx_PyCode_New(descr, varnames, __pyx_mstate->__pyx_kp_u_spacy_pipeline__edit_tree_intern_3, __pyx_mstate->__pyx_n_u_from_disk, __pyx_mstate->__pyx_kp_b_iso88591_1_t_q_4wa_U_9A_uE_4_1_q, tuple_dedup_map); if (unlikely(!__pyx_mstate_global->__pyx_codeobj_tab[10])) goto bad; + } + { + const __Pyx_PyCode_New_function_description descr = {1, 0, 0, 4, (unsigned int)(CO_OPTIMIZED|CO_NEWLOCALS), 262}; + PyObject* const varnames[] = {__pyx_mstate->__pyx_n_u_self, __pyx_mstate->__pyx_n_u_c_tree, __pyx_mstate->__pyx_n_u_tree_id, __pyx_mstate->__pyx_n_u_tree_hash}; + __pyx_mstate_global->__pyx_codeobj_tab[11] = __Pyx_PyCode_New(descr, varnames, __pyx_mstate->__pyx_kp_u_spacy_pipeline__edit_tree_intern_3, __pyx_mstate->__pyx_n_u_rebuild_tree_map, __pyx_mstate->__pyx_kp_b_iso88591_A_D_a_KuAT_uA_T_q_Qa_G5_2_a, tuple_dedup_map); if (unlikely(!__pyx_mstate_global->__pyx_codeobj_tab[11])) goto bad; + } + { + const __Pyx_PyCode_New_function_description descr = {1, 0, 0, 1, (unsigned int)(CO_OPTIMIZED|CO_NEWLOCALS), 275}; + PyObject* const varnames[] = {__pyx_mstate->__pyx_n_u_self}; + __pyx_mstate_global->__pyx_codeobj_tab[12] = __Pyx_PyCode_New(descr, varnames, __pyx_mstate->__pyx_kp_u_spacy_pipeline__edit_tree_intern_3, __pyx_mstate->__pyx_n_u_reduce, __pyx_mstate->__pyx_kp_b_iso88591_A_T_4y, tuple_dedup_map); if (unlikely(!__pyx_mstate_global->__pyx_codeobj_tab[12])) goto bad; + } + { + const __Pyx_PyCode_New_function_description descr = {2, 0, 0, 2, (unsigned int)(CO_OPTIMIZED|CO_NEWLOCALS), 279}; + PyObject* const varnames[] = {__pyx_mstate->__pyx_n_u_strings, __pyx_mstate->__pyx_n_u_trees_data}; + __pyx_mstate_global->__pyx_codeobj_tab[13] = __Pyx_PyCode_New(descr, varnames, __pyx_mstate->__pyx_kp_u_spacy_pipeline__edit_tree_intern_3, __pyx_mstate->__pyx_n_u_unpickle_edittrees, __pyx_mstate->__pyx_kp_b_iso88591_9AX, tuple_dedup_map); if (unlikely(!__pyx_mstate_global->__pyx_codeobj_tab[13])) goto bad; + } + { + const __Pyx_PyCode_New_function_description descr = {1, 0, 0, 1, (unsigned int)(CO_OPTIMIZED|CO_NEWLOCALS), 283}; + PyObject* const varnames[] = {__pyx_mstate->__pyx_n_u_tree}; + __pyx_mstate_global->__pyx_codeobj_tab[14] = __Pyx_PyCode_New(descr, varnames, __pyx_mstate->__pyx_kp_u_spacy_pipeline__edit_tree_intern_3, __pyx_mstate->__pyx_n_u_tree2dict, __pyx_mstate->__pyx_kp_b_iso88591_t1A_t1HAQ_t1HAQ_4q, tuple_dedup_map); if (unlikely(!__pyx_mstate_global->__pyx_codeobj_tab[14])) goto bad; + } + { + const __Pyx_PyCode_New_function_description descr = {1, 0, 0, 2, (unsigned int)(CO_OPTIMIZED|CO_NEWLOCALS), 291}; + PyObject* const varnames[] = {__pyx_mstate->__pyx_n_u_tree, __pyx_mstate->__pyx_n_u_errors}; + __pyx_mstate_global->__pyx_codeobj_tab[15] = __Pyx_PyCode_New(descr, varnames, __pyx_mstate->__pyx_kp_u_spacy_pipeline__edit_tree_intern_3, __pyx_mstate->__pyx_n_u_dict2tree, __pyx_mstate->__pyx_kp_b_iso88591_q_q_j_vWAWD_Qa_4q_Cq_z_q_1, tuple_dedup_map); if (unlikely(!__pyx_mstate_global->__pyx_codeobj_tab[15])) 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) + + /* AssertionsEnabled.init */ + if (likely(__Pyx_init_assertions_enabled() == 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; +} + +/* 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 + +/* 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 +} + +/* PyObjectCall (used by PyObjectFastCall) */ +#if CYTHON_COMPILING_IN_CPYTHON +static CYTHON_INLINE PyObject* __Pyx_PyObject_Call(PyObject *func, PyObject *arg, PyObject *kw) { + PyObject *result; + ternaryfunc call = Py_TYPE(func)->tp_call; + if (unlikely(!call)) + return PyObject_Call(func, arg, kw); + if (unlikely(Py_EnterRecursiveCall(" 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 */ +#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 +} + +/* 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; +} + +/* 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); +} + +/* 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 +} + +/* unicode_iter */ +static CYTHON_INLINE int __Pyx_init_unicode_iteration( + PyObject* ustring, Py_ssize_t *length, void** data, int *kind) { +#if CYTHON_COMPILING_IN_LIMITED_API + *kind = 0; + *length = PyUnicode_GetLength(ustring); + *data = (void*)ustring; +#else + if (unlikely(__Pyx_PyUnicode_READY(ustring) < 0)) return -1; + *kind = PyUnicode_KIND(ustring); + *length = PyUnicode_GET_LENGTH(ustring); + *data = PyUnicode_DATA(ustring); +#endif + return 0; +} + +/* 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++) { + if (unlikely(__Pyx_PyTuple_SET_ITEM(res, i, src[i]) < (0))) { + Py_DECREF(res); + return NULL; + } + Py_INCREF(src[i]); + } + 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; itype, *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); +} + +/* ExtTypeTest */ +static CYTHON_INLINE int __Pyx_TypeTest(PyObject *obj, PyTypeObject *type) { + __Pyx_TypeName obj_type_name; + __Pyx_TypeName type_name; + if (unlikely(!type)) { + PyErr_SetString(PyExc_SystemError, "Missing type object"); + return 0; + } + if (likely(__Pyx_TypeCheck(obj, type))) + return 1; + obj_type_name = __Pyx_PyType_GetFullyQualifiedName(Py_TYPE(obj)); + type_name = __Pyx_PyType_GetFullyQualifiedName(type); + PyErr_Format(PyExc_TypeError, + "Cannot convert " __Pyx_FMT_TYPENAME " to " __Pyx_FMT_TYPENAME, + obj_type_name, type_name); + __Pyx_DECREF_TypeName(obj_type_name); + __Pyx_DECREF_TypeName(type_name); + return 0; +} + +/* PyDictVersioning */ +#if CYTHON_USE_DICT_VERSIONS && CYTHON_USE_TYPE_SLOTS +static CYTHON_INLINE PY_UINT64_T __Pyx_get_tp_dict_version(PyObject *obj) { + PyObject *dict = Py_TYPE(obj)->tp_dict; + return likely(dict) ? __PYX_GET_DICT_VERSION(dict) : 0; +} +static CYTHON_INLINE PY_UINT64_T __Pyx_get_object_dict_version(PyObject *obj) { + PyObject **dictptr = NULL; + Py_ssize_t offset = Py_TYPE(obj)->tp_dictoffset; + if (offset) { +#if CYTHON_COMPILING_IN_CPYTHON + dictptr = (likely(offset > 0)) ? (PyObject **) ((char *)obj + offset) : _PyObject_GetDictPtr(obj); +#else + dictptr = _PyObject_GetDictPtr(obj); +#endif + } + return (dictptr && *dictptr) ? __PYX_GET_DICT_VERSION(*dictptr) : 0; +} +static CYTHON_INLINE int __Pyx_object_dict_version_matches(PyObject* obj, PY_UINT64_T tp_dict_version, PY_UINT64_T obj_dict_version) { + PyObject *dict = Py_TYPE(obj)->tp_dict; + if (unlikely(!dict) || unlikely(tp_dict_version != __PYX_GET_DICT_VERSION(dict))) + return 0; + return obj_dict_version == __Pyx_get_object_dict_version(obj); +} +#endif + +/* 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_Substring */ +static CYTHON_INLINE PyObject* __Pyx_PyUnicode_Substring( + PyObject* text, Py_ssize_t start, Py_ssize_t stop) { + Py_ssize_t length; + #if !CYTHON_COMPILING_IN_LIMITED_API + if (unlikely(__Pyx_PyUnicode_READY(text) == -1)) return NULL; + #endif + length = __Pyx_PyUnicode_GET_LENGTH(text); + #if !CYTHON_ASSUME_SAFE_SIZE + if (unlikely(length < 0)) return NULL; + #endif + if (start < 0) { + start += length; + if (start < 0) + start = 0; + } + if (stop < 0) + stop += length; + else if (stop > length) + stop = length; + if (stop <= start) + return __Pyx_NewRef(__pyx_mstate_global->__pyx_empty_unicode); + if (start == 0 && stop == length) + return __Pyx_NewRef(text); +#if CYTHON_COMPILING_IN_LIMITED_API + return PyUnicode_Substring(text, start, stop); +#else + return PyUnicode_FromKindAndData(PyUnicode_KIND(text), + PyUnicode_1BYTE_DATA(text) + start*PyUnicode_KIND(text), stop-start); +#endif +} + +/* RaiseUnexpectedTypeError */ +static int +__Pyx_RaiseUnexpectedTypeError(const char *expected, PyObject *obj) +{ + __Pyx_TypeName obj_type_name = __Pyx_PyType_GetFullyQualifiedName(Py_TYPE(obj)); + PyErr_Format(PyExc_TypeError, "Expected %s, got " __Pyx_FMT_TYPENAME, + expected, obj_type_name); + __Pyx_DECREF_TypeName(obj_type_name); + return 0; +} + +/* 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); +} + +/* GetItemInt */ +static PyObject *__Pyx_GetItemInt_Generic(PyObject *o, PyObject* j) { + PyObject *r; + if (unlikely(!j)) return NULL; + r = PyObject_GetItem(o, j); + Py_DECREF(j); + return r; +} +static CYTHON_INLINE PyObject *__Pyx_GetItemInt_List_Fast(PyObject *o, Py_ssize_t i, + int wraparound, int boundscheck, int unsafe_shared) { + CYTHON_MAYBE_UNUSED_VAR(unsafe_shared); +#if CYTHON_ASSUME_SAFE_SIZE + Py_ssize_t wrapped_i = i; + if (wraparound & unlikely(i < 0)) { + wrapped_i += PyList_GET_SIZE(o); + } + if ((CYTHON_AVOID_BORROWED_REFS || CYTHON_AVOID_THREAD_UNSAFE_BORROWED_REFS || !CYTHON_ASSUME_SAFE_MACROS)) { + return __Pyx_PyList_GetItemRefFast(o, wrapped_i, unsafe_shared); + } else + if ((!boundscheck) || likely(__Pyx_is_valid_index(wrapped_i, PyList_GET_SIZE(o)))) { + return __Pyx_NewRef(PyList_GET_ITEM(o, wrapped_i)); + } + return __Pyx_GetItemInt_Generic(o, PyLong_FromSsize_t(i)); +#else + (void)wraparound; + (void)boundscheck; + return PySequence_GetItem(o, i); +#endif +} +static CYTHON_INLINE PyObject *__Pyx_GetItemInt_Tuple_Fast(PyObject *o, Py_ssize_t i, + int wraparound, int boundscheck, int unsafe_shared) { + CYTHON_MAYBE_UNUSED_VAR(unsafe_shared); +#if CYTHON_ASSUME_SAFE_SIZE && CYTHON_ASSUME_SAFE_MACROS && !CYTHON_AVOID_BORROWED_REFS + Py_ssize_t wrapped_i = i; + if (wraparound & unlikely(i < 0)) { + wrapped_i += PyTuple_GET_SIZE(o); + } + if ((!boundscheck) || likely(__Pyx_is_valid_index(wrapped_i, PyTuple_GET_SIZE(o)))) { + return __Pyx_NewRef(PyTuple_GET_ITEM(o, wrapped_i)); + } + return __Pyx_GetItemInt_Generic(o, PyLong_FromSsize_t(i)); +#else + (void)wraparound; + (void)boundscheck; + return PySequence_GetItem(o, i); +#endif +} +static CYTHON_INLINE PyObject *__Pyx_GetItemInt_Fast(PyObject *o, Py_ssize_t i, int is_list, + int wraparound, int boundscheck, int unsafe_shared) { + CYTHON_MAYBE_UNUSED_VAR(unsafe_shared); +#if CYTHON_ASSUME_SAFE_MACROS && CYTHON_ASSUME_SAFE_SIZE + if (is_list || PyList_CheckExact(o)) { + Py_ssize_t n = ((!wraparound) | likely(i >= 0)) ? i : i + PyList_GET_SIZE(o); + if ((CYTHON_AVOID_BORROWED_REFS || CYTHON_AVOID_THREAD_UNSAFE_BORROWED_REFS)) { + return __Pyx_PyList_GetItemRefFast(o, n, unsafe_shared); + } else if ((!boundscheck) || (likely(__Pyx_is_valid_index(n, PyList_GET_SIZE(o))))) { + return __Pyx_NewRef(PyList_GET_ITEM(o, n)); + } + } else + #if !CYTHON_AVOID_BORROWED_REFS + if (PyTuple_CheckExact(o)) { + Py_ssize_t n = ((!wraparound) | likely(i >= 0)) ? i : i + PyTuple_GET_SIZE(o); + if ((!boundscheck) || likely(__Pyx_is_valid_index(n, PyTuple_GET_SIZE(o)))) { + return __Pyx_NewRef(PyTuple_GET_ITEM(o, n)); + } + } else + #endif +#endif +#if CYTHON_USE_TYPE_SLOTS && !CYTHON_COMPILING_IN_PYPY + { + PyMappingMethods *mm = Py_TYPE(o)->tp_as_mapping; + PySequenceMethods *sm = Py_TYPE(o)->tp_as_sequence; + if (!is_list && mm && mm->mp_subscript) { + PyObject *r, *key = PyLong_FromSsize_t(i); + if (unlikely(!key)) return NULL; + r = mm->mp_subscript(o, key); + Py_DECREF(key); + return r; + } + if (is_list || likely(sm && sm->sq_item)) { + if (wraparound && unlikely(i < 0) && likely(sm->sq_length)) { + Py_ssize_t l = sm->sq_length(o); + if (likely(l >= 0)) { + i += l; + } else { + if (!PyErr_ExceptionMatches(PyExc_OverflowError)) + return NULL; + PyErr_Clear(); + } + } + return sm->sq_item(o, i); + } + } +#else + if (is_list || !PyMapping_Check(o)) { + return PySequence_GetItem(o, i); + } +#endif + (void)wraparound; + (void)boundscheck; + return __Pyx_GetItemInt_Generic(o, PyLong_FromSsize_t(i)); +} + +/* 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_uint16_t(uint16_t value, Py_ssize_t width, char padding_char) { +#ifdef __Pyx_HAS_GCC_DIAGNOSTIC +#pragma GCC diagnostic push +#pragma GCC diagnostic ignored "-Wconversion" +#endif + const uint16_t neg_one = (uint16_t) -1, const_zero = (uint16_t) 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 & ~ (uint16_t) 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_uint16_t(uint16_t value, Py_ssize_t width, char padding_char, char format_char) { + char digits[sizeof(uint16_t)*3+2]; + char *dpos, *end = digits + sizeof(uint16_t)*3+2; + const char *hex_digits = DIGITS_HEX; + Py_ssize_t length, ulength; + int prepend_sign, last_one_off; + uint16_t remaining; +#ifdef __Pyx_HAS_GCC_DIAGNOSTIC +#pragma GCC diagnostic push +#pragma GCC diagnostic ignored "-Wconversion" +#endif + const uint16_t neg_one = (uint16_t) -1, const_zero = (uint16_t) 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 = (uint16_t) (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 = (uint16_t) (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 = (uint16_t) (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); +} + +/* RaiseClosureNameError */ +static void __Pyx_RaiseClosureNameError(const char *varname) { + PyErr_Format(PyExc_NameError, "free variable '%s' referenced before assignment in enclosing scope", varname); +} + +/* dict_setdefault (used by FetchCommonType) */ +static CYTHON_INLINE PyObject *__Pyx_PyDict_SetDefault(PyObject *d, PyObject *key, PyObject *default_value) { + PyObject* value; +#if 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); +#elif PY_VERSION_HEX >= 0x030d0000 + PyDict_SetDefaultRef(d, key, default_value, &value); +#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_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(marker); + 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}, + {"_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 !CYTHON_COMPILING_IN_LIMITED_API +#if PY_VERSION_HEX < 0x030900B1 + Py_CLEAR(__Pyx_CyFunction_GetClassObj(m)); +#else + { + PyObject *cls = (PyObject*) ((PyCMethodObject *) (m))->mm_class; + ((PyCMethodObject *) (m))->mm_class = NULL; + Py_XDECREF(cls); + } +#endif +#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); +#if !CYTHON_COMPILING_IN_LIMITED_API + Py_VISIT(__Pyx_CyFunction_GetClassObj(m)); +#endif + Py_VISIT(m->defaults_tuple); + Py_VISIT(m->defaults_kwdict); + 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; +} + +/* KeywordStringCheck */ +static int __Pyx_CheckKeywordStrings( + const char* function_name, + PyObject *kw) +{ +#if CYTHON_COMPILING_IN_PYPY && !defined(PyArg_ValidateKeywordArguments) + CYTHON_UNUSED_VAR(function_name); + CYTHON_UNUSED_VAR(kw); + return 0; +#else + if (CYTHON_METH_FASTCALL && likely(PyTuple_Check(kw))) { +#if PY_VERSION_HEX >= 0x03090000 + CYTHON_UNUSED_VAR(function_name); +#else + Py_ssize_t kwsize; + #if CYTHON_ASSUME_SAFE_SIZE + kwsize = PyTuple_GET_SIZE(kw); + #else + kwsize = PyTuple_Size(kw); + if (unlikely(kwsize < 0)) return -1; + #endif + for (Py_ssize_t pos = 0; pos < kwsize; pos++) { + PyObject* key = NULL; + #if CYTHON_ASSUME_SAFE_MACROS + key = PyTuple_GET_ITEM(kw, pos); + #else + key = PyTuple_GetItem(kw, pos); + if (unlikely(!key)) return -1; + #endif + if (unlikely(!PyUnicode_Check(key))) { + PyErr_Format(PyExc_TypeError, + "%.200s() keywords must be strings", function_name); + return -1; + } + } +#endif + } else { + if (unlikely(!PyArg_ValidateKeywordArguments(kw))) return -1; + } + return 0; +#endif +} + +/* PyObjectLookupSpecial */ +#if CYTHON_USE_PYTYPE_LOOKUP && CYTHON_USE_TYPE_SLOTS +static CYTHON_INLINE PyObject* __Pyx__PyObject_LookupSpecial(PyObject* obj, PyObject* attr_name, int with_error) { + PyObject *res; + PyTypeObject *tp = Py_TYPE(obj); + res = _PyType_Lookup(tp, attr_name); + if (likely(res)) { + descrgetfunc f = Py_TYPE(res)->tp_descr_get; + if (!f) { + Py_INCREF(res); + } else { + res = f(res, obj, (PyObject *)tp); + } + } else if (with_error) { + PyErr_SetObject(PyExc_AttributeError, attr_name); + } + return res; +} +#endif + +/* RaiseUnboundLocalError */ +static void __Pyx_RaiseUnboundLocalError(const char *varname) { + PyErr_Format(PyExc_UnboundLocalError, "local variable '%s' referenced before assignment", varname); +} + +/* 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; + if (__Pyx_PyTuple_SET_ITEM(builder, n, key) != (0)) return -1; + Py_INCREF(key); + 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 + +/* 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); + } +} + +/* VoidPtrExport */ +static int __Pyx_ExportVoidPtr(PyObject *api_dict, const char *name, void *p, const char *sig) { + PyObject *cobj; + cobj = PyCapsule_New(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; +} + +/* 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 +} + +/* SetVTable */ +static int __Pyx_SetVtable(PyTypeObject *type, void *vtable) { + PyObject *ob = PyCapsule_New(vtable, 0, 0); + if (unlikely(!ob)) + goto bad; +#if CYTHON_COMPILING_IN_LIMITED_API + if (unlikely(PyObject_SetAttr((PyObject *) type, __pyx_mstate_global->__pyx_n_u_pyx_vtable, ob) < 0)) +#else + if (unlikely(PyDict_SetItem(type->tp_dict, __pyx_mstate_global->__pyx_n_u_pyx_vtable, ob) < 0)) +#endif + goto bad; + Py_DECREF(ob); + return 0; +bad: + Py_XDECREF(ob); + return -1; +} + +/* GetVTable (used by MergeVTables) */ +static void* __Pyx_GetVtable(PyTypeObject *type) { + void* ptr; +#if CYTHON_COMPILING_IN_LIMITED_API + PyObject *ob = PyObject_GetAttr((PyObject *)type, __pyx_mstate_global->__pyx_n_u_pyx_vtable); +#else + PyObject *ob = PyObject_GetItem(type->tp_dict, __pyx_mstate_global->__pyx_n_u_pyx_vtable); +#endif + if (!ob) + goto bad; + ptr = PyCapsule_GetPointer(ob, 0); + if (!ptr && !PyErr_Occurred()) + PyErr_SetString(PyExc_RuntimeError, "invalid vtable found for imported type"); + Py_DECREF(ob); + return ptr; +bad: + Py_XDECREF(ob); + return NULL; +} + +/* MergeVTables */ +static int __Pyx_MergeVtables(PyTypeObject *type) { + int i=0; + Py_ssize_t size; + void** base_vtables; + __Pyx_TypeName tp_base_name = NULL; + __Pyx_TypeName base_name = NULL; + void* unknown = (void*)-1; + PyObject* bases = __Pyx_PyType_GetSlot(type, tp_bases, PyObject*); + int base_depth = 0; + { + PyTypeObject* base = __Pyx_PyType_GetSlot(type, tp_base, PyTypeObject*); + while (base) { + base_depth += 1; + base = __Pyx_PyType_GetSlot(base, tp_base, PyTypeObject*); + } + } + base_vtables = (void**) PyMem_Malloc(sizeof(void*) * (size_t)(base_depth + 1)); + base_vtables[0] = unknown; +#if CYTHON_COMPILING_IN_LIMITED_API + size = PyTuple_Size(bases); + if (size < 0) goto other_failure; +#else + size = PyTuple_GET_SIZE(bases); +#endif + for (i = 1; i < size; i++) { + PyObject *basei; + void* base_vtable; +#if CYTHON_AVOID_BORROWED_REFS + basei = PySequence_GetItem(bases, i); + if (unlikely(!basei)) goto other_failure; +#elif !CYTHON_ASSUME_SAFE_MACROS + basei = PyTuple_GetItem(bases, i); + if (unlikely(!basei)) goto other_failure; +#else + basei = PyTuple_GET_ITEM(bases, i); +#endif + base_vtable = __Pyx_GetVtable((PyTypeObject*)basei); +#if CYTHON_AVOID_BORROWED_REFS + Py_DECREF(basei); +#endif + if (base_vtable != NULL) { + int j; + PyTypeObject* base = __Pyx_PyType_GetSlot(type, tp_base, PyTypeObject*); + for (j = 0; j < base_depth; j++) { + if (base_vtables[j] == unknown) { + base_vtables[j] = __Pyx_GetVtable(base); + base_vtables[j + 1] = unknown; + } + if (base_vtables[j] == base_vtable) { + break; + } else if (base_vtables[j] == NULL) { + goto bad; + } + base = __Pyx_PyType_GetSlot(base, tp_base, PyTypeObject*); + } + } + } + PyErr_Clear(); + PyMem_Free(base_vtables); + return 0; +bad: + { + PyTypeObject* basei = NULL; + PyTypeObject* tp_base = __Pyx_PyType_GetSlot(type, tp_base, PyTypeObject*); + tp_base_name = __Pyx_PyType_GetFullyQualifiedName(tp_base); +#if CYTHON_AVOID_BORROWED_REFS + basei = (PyTypeObject*)PySequence_GetItem(bases, i); + if (unlikely(!basei)) goto really_bad; +#elif !CYTHON_ASSUME_SAFE_MACROS + basei = (PyTypeObject*)PyTuple_GetItem(bases, i); + if (unlikely(!basei)) goto really_bad; +#else + basei = (PyTypeObject*)PyTuple_GET_ITEM(bases, i); +#endif + base_name = __Pyx_PyType_GetFullyQualifiedName(basei); +#if CYTHON_AVOID_BORROWED_REFS + Py_DECREF(basei); +#endif + } + PyErr_Format(PyExc_TypeError, + "multiple bases have vtable conflict: '" __Pyx_FMT_TYPENAME "' and '" __Pyx_FMT_TYPENAME "'", tp_base_name, base_name); +#if CYTHON_AVOID_BORROWED_REFS || !CYTHON_ASSUME_SAFE_MACROS +really_bad: // bad has failed! +#endif + __Pyx_DECREF_TypeName(tp_base_name); + __Pyx_DECREF_TypeName(base_name); +#if CYTHON_COMPILING_IN_LIMITED_API || CYTHON_AVOID_BORROWED_REFS || !CYTHON_ASSUME_SAFE_MACROS +other_failure: +#endif + PyMem_Free(base_vtables); + return -1; +} + +/* TypeImport */ +#ifndef __PYX_HAVE_RT_ImportType_3_2_1 +#define __PYX_HAVE_RT_ImportType_3_2_1 +static PyTypeObject *__Pyx_ImportType_3_2_1(PyObject *module, const char *module_name, const char *class_name, + size_t size, size_t alignment, enum __Pyx_ImportType_CheckSize_3_2_1 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_1 && + ((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_1 && (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_1 +#define __PYX_HAVE_RT_ImportFromPxd_3_2_1 +static int __Pyx_ImportFromPxd_3_2_1(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_1 +#define __PYX_HAVE_RT_ImportFunction_3_2_1 +static int __Pyx_ImportFunction_3_2_1(PyObject *module, const char *funcname, void (**f)(void), const char *sig) { + union { + void (*fp)(void); + void *p; + } tmp; + int result = __Pyx_ImportFromPxd_3_2_1(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__8); + 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; +} + +/* 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 + +static PyObject* __pyx_convert__to_py_struct____pyx_t_5spacy_8pipeline_20_edit_tree_internals_10edit_trees_MatchNodeC(struct __pyx_t_5spacy_8pipeline_20_edit_tree_internals_10edit_trees_MatchNodeC s) { + PyObject* res; + PyObject* member; + res = __Pyx_PyDict_NewPresized(4); if (unlikely(!res)) return NULL; + member = __Pyx_PyLong_From_uint16_t(s.prefix_len); if (unlikely(!member)) goto bad; + if (unlikely(PyDict_SetItem(res, __pyx_mstate_global->__pyx_n_u_prefix_len, member) < 0)) goto bad; + Py_DECREF(member); + member = __Pyx_PyLong_From_uint16_t(s.suffix_len); if (unlikely(!member)) goto bad; + if (unlikely(PyDict_SetItem(res, __pyx_mstate_global->__pyx_n_u_suffix_len, member) < 0)) goto bad; + Py_DECREF(member); + member = __Pyx_PyLong_From_uint32_t(s.prefix_tree); if (unlikely(!member)) goto bad; + if (unlikely(PyDict_SetItem(res, __pyx_mstate_global->__pyx_n_u_prefix_tree, member) < 0)) goto bad; + Py_DECREF(member); + member = __Pyx_PyLong_From_uint32_t(s.suffix_tree); if (unlikely(!member)) goto bad; + if (unlikely(PyDict_SetItem(res, __pyx_mstate_global->__pyx_n_u_suffix_tree, member) < 0)) goto bad; + Py_DECREF(member); + return res; + bad: + Py_XDECREF(member); + Py_DECREF(res); + return NULL; +} +static PyObject* __pyx_convert__to_py_struct____pyx_t_5spacy_8pipeline_20_edit_tree_internals_10edit_trees_SubstNodeC(struct __pyx_t_5spacy_8pipeline_20_edit_tree_internals_10edit_trees_SubstNodeC s) { + PyObject* res; + PyObject* member; + res = __Pyx_PyDict_NewPresized(2); if (unlikely(!res)) return NULL; + member = __Pyx_PyLong_From_uint64_t(s.orig); if (unlikely(!member)) goto bad; + if (unlikely(PyDict_SetItem(res, __pyx_mstate_global->__pyx_n_u_orig, member) < 0)) goto bad; + Py_DECREF(member); + member = __Pyx_PyLong_From_uint64_t(s.subst); if (unlikely(!member)) goto bad; + if (unlikely(PyDict_SetItem(res, __pyx_mstate_global->__pyx_n_u_subst, member) < 0)) goto bad; + Py_DECREF(member); + return res; + bad: + Py_XDECREF(member); + Py_DECREF(res); + return NULL; +} +static PyObject* __pyx_convert__to_py_union____pyx_t_5spacy_8pipeline_20_edit_tree_internals_10edit_trees_NodeC(union __pyx_t_5spacy_8pipeline_20_edit_tree_internals_10edit_trees_NodeC s) { + PyObject* res; + PyObject* member; + res = __Pyx_PyDict_NewPresized(2); if (unlikely(!res)) return NULL; + member = __pyx_convert__to_py_struct____pyx_t_5spacy_8pipeline_20_edit_tree_internals_10edit_trees_MatchNodeC(s.match_node); if (unlikely(!member)) goto bad; + if (unlikely(PyDict_SetItem(res, __pyx_mstate_global->__pyx_n_u_match_node, member) < 0)) goto bad; + Py_DECREF(member); + member = __pyx_convert__to_py_struct____pyx_t_5spacy_8pipeline_20_edit_tree_internals_10edit_trees_SubstNodeC(s.subst_node); if (unlikely(!member)) goto bad; + if (unlikely(PyDict_SetItem(res, __pyx_mstate_global->__pyx_n_u_subst_node, member) < 0)) goto bad; + Py_DECREF(member); + return res; + bad: + Py_XDECREF(member); + Py_DECREF(res); + return NULL; +} +/* 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;\ + } + +/* UnicodeAsUCS4 */ +static void __Pyx_PyUnicode_AsPy_UCS4_error(Py_ssize_t length) { + if (likely(length >= 0)) { + PyErr_Format(PyExc_ValueError, + "only single character unicode strings can be converted to Py_UCS4, " + "got length %" CYTHON_FORMAT_SSIZE_T "d", length); + } +} +static CYTHON_INLINE Py_UCS4 __Pyx_PyUnicode_AsPy_UCS4(PyObject* x) { + Py_ssize_t length = __Pyx_PyUnicode_GET_LENGTH(x); + if (unlikely(length != 1)) { + __Pyx_PyUnicode_AsPy_UCS4_error(length); + return (Py_UCS4)-1; + } + return __Pyx_PyUnicode_READ_CHAR(x, 0); +} + +static PyObject* __pyx_convert__to_py_struct____pyx_t_5spacy_8pipeline_20_edit_tree_internals_10edit_trees_EditTreeC(struct __pyx_t_5spacy_8pipeline_20_edit_tree_internals_10edit_trees_EditTreeC s) { + PyObject* res; + PyObject* member; + res = __Pyx_PyDict_NewPresized(2); if (unlikely(!res)) return NULL; + member = __Pyx_PyBool_FromLong(s.is_match_node); if (unlikely(!member)) goto bad; + if (unlikely(PyDict_SetItem(res, __pyx_mstate_global->__pyx_n_u_is_match_node, member) < 0)) goto bad; + Py_DECREF(member); + member = __pyx_convert__to_py_union____pyx_t_5spacy_8pipeline_20_edit_tree_internals_10edit_trees_NodeC(s.inner); if (unlikely(!member)) goto bad; + if (unlikely(PyDict_SetItem(res, __pyx_mstate_global->__pyx_n_u_inner, member) < 0)) goto bad; + Py_DECREF(member); + return res; + bad: + Py_XDECREF(member); + Py_DECREF(res); + return NULL; +} +/* CIntToPy */ +static CYTHON_INLINE PyObject* __Pyx_PyLong_From_uint16_t(uint16_t value) { +#ifdef __Pyx_HAS_GCC_DIAGNOSTIC +#pragma GCC diagnostic push +#pragma GCC diagnostic ignored "-Wconversion" +#endif + const uint16_t neg_one = (uint16_t) -1, const_zero = (uint16_t) 0; +#ifdef __Pyx_HAS_GCC_DIAGNOSTIC +#pragma GCC diagnostic pop +#endif + const int is_unsigned = neg_one > const_zero; + if (is_unsigned) { + if (sizeof(uint16_t) < sizeof(long)) { + return PyLong_FromLong((long) value); + } else if (sizeof(uint16_t) <= sizeof(unsigned long)) { + return PyLong_FromUnsignedLong((unsigned long) value); +#if !CYTHON_COMPILING_IN_PYPY + } else if (sizeof(uint16_t) <= sizeof(unsigned PY_LONG_LONG)) { + return PyLong_FromUnsignedLongLong((unsigned PY_LONG_LONG) value); +#endif + } + } else { + if (sizeof(uint16_t) <= sizeof(long)) { + return PyLong_FromLong((long) value); + } else if (sizeof(uint16_t) <= 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(uint16_t), + 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(uint16_t)); + 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 + } +} + +/* CIntToPy */ +static CYTHON_INLINE PyObject* __Pyx_PyLong_From_uint32_t(uint32_t value) { +#ifdef __Pyx_HAS_GCC_DIAGNOSTIC +#pragma GCC diagnostic push +#pragma GCC diagnostic ignored "-Wconversion" +#endif + const uint32_t neg_one = (uint32_t) -1, const_zero = (uint32_t) 0; +#ifdef __Pyx_HAS_GCC_DIAGNOSTIC +#pragma GCC diagnostic pop +#endif + const int is_unsigned = neg_one > const_zero; + if (is_unsigned) { + if (sizeof(uint32_t) < sizeof(long)) { + return PyLong_FromLong((long) value); + } else if (sizeof(uint32_t) <= sizeof(unsigned long)) { + return PyLong_FromUnsignedLong((unsigned long) value); +#if !CYTHON_COMPILING_IN_PYPY + } else if (sizeof(uint32_t) <= sizeof(unsigned PY_LONG_LONG)) { + return PyLong_FromUnsignedLongLong((unsigned PY_LONG_LONG) value); +#endif + } + } else { + if (sizeof(uint32_t) <= sizeof(long)) { + return PyLong_FromLong((long) value); + } else if (sizeof(uint32_t) <= 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(uint32_t), + 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(uint32_t)); + 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 + } +} + +/* CIntToPy */ +static CYTHON_INLINE PyObject* __Pyx_PyLong_From_uint64_t(uint64_t value) { +#ifdef __Pyx_HAS_GCC_DIAGNOSTIC +#pragma GCC diagnostic push +#pragma GCC diagnostic ignored "-Wconversion" +#endif + const uint64_t neg_one = (uint64_t) -1, const_zero = (uint64_t) 0; +#ifdef __Pyx_HAS_GCC_DIAGNOSTIC +#pragma GCC diagnostic pop +#endif + const int is_unsigned = neg_one > const_zero; + if (is_unsigned) { + if (sizeof(uint64_t) < sizeof(long)) { + return PyLong_FromLong((long) value); + } else if (sizeof(uint64_t) <= sizeof(unsigned long)) { + return PyLong_FromUnsignedLong((unsigned long) value); +#if !CYTHON_COMPILING_IN_PYPY + } else if (sizeof(uint64_t) <= sizeof(unsigned PY_LONG_LONG)) { + return PyLong_FromUnsignedLongLong((unsigned PY_LONG_LONG) value); +#endif + } + } else { + if (sizeof(uint64_t) <= sizeof(long)) { + return PyLong_FromLong((long) value); + } else if (sizeof(uint64_t) <= 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(uint64_t), + 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(uint64_t)); + 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 uint32_t __Pyx_PyLong_As_uint32_t(PyObject *x) { +#ifdef __Pyx_HAS_GCC_DIAGNOSTIC +#pragma GCC diagnostic push +#pragma GCC diagnostic ignored "-Wconversion" +#endif + const uint32_t neg_one = (uint32_t) -1, const_zero = (uint32_t) 0; +#ifdef __Pyx_HAS_GCC_DIAGNOSTIC +#pragma GCC diagnostic pop +#endif + const int is_unsigned = neg_one > const_zero; + if (unlikely(!PyLong_Check(x))) { + uint32_t val; + PyObject *tmp = __Pyx_PyNumber_Long(x); + if (!tmp) return (uint32_t) -1; + val = __Pyx_PyLong_As_uint32_t(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(uint32_t, __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(uint32_t) > 1 * PyLong_SHIFT)) { + if ((8 * sizeof(unsigned long) > 2 * PyLong_SHIFT)) { + __PYX_VERIFY_RETURN_INT(uint32_t, unsigned long, (((((unsigned long)digits[1]) << PyLong_SHIFT) | (unsigned long)digits[0]))) + } else if ((8 * sizeof(uint32_t) >= 2 * PyLong_SHIFT)) { + return (uint32_t) (((((uint32_t)digits[1]) << PyLong_SHIFT) | (uint32_t)digits[0])); + } + } + break; + case 3: + if ((8 * sizeof(uint32_t) > 2 * PyLong_SHIFT)) { + if ((8 * sizeof(unsigned long) > 3 * PyLong_SHIFT)) { + __PYX_VERIFY_RETURN_INT(uint32_t, unsigned long, (((((((unsigned long)digits[2]) << PyLong_SHIFT) | (unsigned long)digits[1]) << PyLong_SHIFT) | (unsigned long)digits[0]))) + } else if ((8 * sizeof(uint32_t) >= 3 * PyLong_SHIFT)) { + return (uint32_t) (((((((uint32_t)digits[2]) << PyLong_SHIFT) | (uint32_t)digits[1]) << PyLong_SHIFT) | (uint32_t)digits[0])); + } + } + break; + case 4: + if ((8 * sizeof(uint32_t) > 3 * PyLong_SHIFT)) { + if ((8 * sizeof(unsigned long) > 4 * PyLong_SHIFT)) { + __PYX_VERIFY_RETURN_INT(uint32_t, unsigned long, (((((((((unsigned long)digits[3]) << PyLong_SHIFT) | (unsigned long)digits[2]) << PyLong_SHIFT) | (unsigned long)digits[1]) << PyLong_SHIFT) | (unsigned long)digits[0]))) + } else if ((8 * sizeof(uint32_t) >= 4 * PyLong_SHIFT)) { + return (uint32_t) (((((((((uint32_t)digits[3]) << PyLong_SHIFT) | (uint32_t)digits[2]) << PyLong_SHIFT) | (uint32_t)digits[1]) << PyLong_SHIFT) | (uint32_t)digits[0])); + } + } + break; + } + } +#endif +#if CYTHON_COMPILING_IN_CPYTHON && 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 (uint32_t) -1; + if (unlikely(result == 1)) + goto raise_neg_overflow; + } +#endif + if ((sizeof(uint32_t) <= sizeof(unsigned long))) { + __PYX_VERIFY_RETURN_INT_EXC(uint32_t, unsigned long, PyLong_AsUnsignedLong(x)) + } else if ((sizeof(uint32_t) <= sizeof(unsigned PY_LONG_LONG))) { + __PYX_VERIFY_RETURN_INT_EXC(uint32_t, unsigned PY_LONG_LONG, PyLong_AsUnsignedLongLong(x)) + } + } else { +#if CYTHON_USE_PYLONG_INTERNALS + if (__Pyx_PyLong_IsCompact(x)) { + __PYX_VERIFY_RETURN_INT(uint32_t, __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(uint32_t) - 1 > 1 * PyLong_SHIFT)) { + if ((8 * sizeof(unsigned long) > 2 * PyLong_SHIFT)) { + __PYX_VERIFY_RETURN_INT(uint32_t, long, -(long) (((((unsigned long)digits[1]) << PyLong_SHIFT) | (unsigned long)digits[0]))) + } else if ((8 * sizeof(uint32_t) - 1 > 2 * PyLong_SHIFT)) { + return (uint32_t) (((uint32_t)-1)*(((((uint32_t)digits[1]) << PyLong_SHIFT) | (uint32_t)digits[0]))); + } + } + break; + case 2: + if ((8 * sizeof(uint32_t) > 1 * PyLong_SHIFT)) { + if ((8 * sizeof(unsigned long) > 2 * PyLong_SHIFT)) { + __PYX_VERIFY_RETURN_INT(uint32_t, unsigned long, (((((unsigned long)digits[1]) << PyLong_SHIFT) | (unsigned long)digits[0]))) + } else if ((8 * sizeof(uint32_t) - 1 > 2 * PyLong_SHIFT)) { + return (uint32_t) ((((((uint32_t)digits[1]) << PyLong_SHIFT) | (uint32_t)digits[0]))); + } + } + break; + case -3: + if ((8 * sizeof(uint32_t) - 1 > 2 * PyLong_SHIFT)) { + if ((8 * sizeof(unsigned long) > 3 * PyLong_SHIFT)) { + __PYX_VERIFY_RETURN_INT(uint32_t, long, -(long) (((((((unsigned long)digits[2]) << PyLong_SHIFT) | (unsigned long)digits[1]) << PyLong_SHIFT) | (unsigned long)digits[0]))) + } else if ((8 * sizeof(uint32_t) - 1 > 3 * PyLong_SHIFT)) { + return (uint32_t) (((uint32_t)-1)*(((((((uint32_t)digits[2]) << PyLong_SHIFT) | (uint32_t)digits[1]) << PyLong_SHIFT) | (uint32_t)digits[0]))); + } + } + break; + case 3: + if ((8 * sizeof(uint32_t) > 2 * PyLong_SHIFT)) { + if ((8 * sizeof(unsigned long) > 3 * PyLong_SHIFT)) { + __PYX_VERIFY_RETURN_INT(uint32_t, unsigned long, (((((((unsigned long)digits[2]) << PyLong_SHIFT) | (unsigned long)digits[1]) << PyLong_SHIFT) | (unsigned long)digits[0]))) + } else if ((8 * sizeof(uint32_t) - 1 > 3 * PyLong_SHIFT)) { + return (uint32_t) ((((((((uint32_t)digits[2]) << PyLong_SHIFT) | (uint32_t)digits[1]) << PyLong_SHIFT) | (uint32_t)digits[0]))); + } + } + break; + case -4: + if ((8 * sizeof(uint32_t) - 1 > 3 * PyLong_SHIFT)) { + if ((8 * sizeof(unsigned long) > 4 * PyLong_SHIFT)) { + __PYX_VERIFY_RETURN_INT(uint32_t, long, -(long) (((((((((unsigned long)digits[3]) << PyLong_SHIFT) | (unsigned long)digits[2]) << PyLong_SHIFT) | (unsigned long)digits[1]) << PyLong_SHIFT) | (unsigned long)digits[0]))) + } else if ((8 * sizeof(uint32_t) - 1 > 4 * PyLong_SHIFT)) { + return (uint32_t) (((uint32_t)-1)*(((((((((uint32_t)digits[3]) << PyLong_SHIFT) | (uint32_t)digits[2]) << PyLong_SHIFT) | (uint32_t)digits[1]) << PyLong_SHIFT) | (uint32_t)digits[0]))); + } + } + break; + case 4: + if ((8 * sizeof(uint32_t) > 3 * PyLong_SHIFT)) { + if ((8 * sizeof(unsigned long) > 4 * PyLong_SHIFT)) { + __PYX_VERIFY_RETURN_INT(uint32_t, unsigned long, (((((((((unsigned long)digits[3]) << PyLong_SHIFT) | (unsigned long)digits[2]) << PyLong_SHIFT) | (unsigned long)digits[1]) << PyLong_SHIFT) | (unsigned long)digits[0]))) + } else if ((8 * sizeof(uint32_t) - 1 > 4 * PyLong_SHIFT)) { + return (uint32_t) ((((((((((uint32_t)digits[3]) << PyLong_SHIFT) | (uint32_t)digits[2]) << PyLong_SHIFT) | (uint32_t)digits[1]) << PyLong_SHIFT) | (uint32_t)digits[0]))); + } + } + break; + } + } +#endif + if ((sizeof(uint32_t) <= sizeof(long))) { + __PYX_VERIFY_RETURN_INT_EXC(uint32_t, long, PyLong_AsLong(x)) + } else if ((sizeof(uint32_t) <= sizeof(PY_LONG_LONG))) { + __PYX_VERIFY_RETURN_INT_EXC(uint32_t, PY_LONG_LONG, PyLong_AsLongLong(x)) + } + } + { + uint32_t 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 (uint32_t) -1; + assert(PyLong_CheckExact(v)); + } + { + int result = PyObject_RichCompareBool(v, Py_False, Py_LT); + if (unlikely(result < 0)) { + Py_DECREF(v); + return (uint32_t) -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 (uint32_t) -1; + } else { + stepval = v; + } + v = NULL; + val = (uint32_t) 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(uint32_t) * 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 |= ((uint32_t) 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(uint32_t) * 8) - bits - (is_unsigned ? 0 : 1); + if (unlikely(idigit >= (1L << remaining_bits))) + goto raise_overflow; + val |= ((uint32_t) idigit) << bits; + } + if (!is_unsigned) { + if (unlikely(val & (((uint32_t) 1) << (sizeof(uint32_t) * 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 (uint32_t) -1; + return val; + } +raise_overflow: + PyErr_SetString(PyExc_OverflowError, + "value too large to convert to uint32_t"); + return (uint32_t) -1; +raise_neg_overflow: + PyErr_SetString(PyExc_OverflowError, + "can't convert negative value to uint32_t"); + return (uint32_t) -1; +} + +/* CIntFromPy */ +static CYTHON_INLINE 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 uint64_t __Pyx_PyLong_As_uint64_t(PyObject *x) { +#ifdef __Pyx_HAS_GCC_DIAGNOSTIC +#pragma GCC diagnostic push +#pragma GCC diagnostic ignored "-Wconversion" +#endif + const uint64_t neg_one = (uint64_t) -1, const_zero = (uint64_t) 0; +#ifdef __Pyx_HAS_GCC_DIAGNOSTIC +#pragma GCC diagnostic pop +#endif + const int is_unsigned = neg_one > const_zero; + if (unlikely(!PyLong_Check(x))) { + uint64_t val; + PyObject *tmp = __Pyx_PyNumber_Long(x); + if (!tmp) return (uint64_t) -1; + val = __Pyx_PyLong_As_uint64_t(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(uint64_t, __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(uint64_t) > 1 * PyLong_SHIFT)) { + if ((8 * sizeof(unsigned long) > 2 * PyLong_SHIFT)) { + __PYX_VERIFY_RETURN_INT(uint64_t, unsigned long, (((((unsigned long)digits[1]) << PyLong_SHIFT) | (unsigned long)digits[0]))) + } else if ((8 * sizeof(uint64_t) >= 2 * PyLong_SHIFT)) { + return (uint64_t) (((((uint64_t)digits[1]) << PyLong_SHIFT) | (uint64_t)digits[0])); + } + } + break; + case 3: + if ((8 * sizeof(uint64_t) > 2 * PyLong_SHIFT)) { + if ((8 * sizeof(unsigned long) > 3 * PyLong_SHIFT)) { + __PYX_VERIFY_RETURN_INT(uint64_t, unsigned long, (((((((unsigned long)digits[2]) << PyLong_SHIFT) | (unsigned long)digits[1]) << PyLong_SHIFT) | (unsigned long)digits[0]))) + } else if ((8 * sizeof(uint64_t) >= 3 * PyLong_SHIFT)) { + return (uint64_t) (((((((uint64_t)digits[2]) << PyLong_SHIFT) | (uint64_t)digits[1]) << PyLong_SHIFT) | (uint64_t)digits[0])); + } + } + break; + case 4: + if ((8 * sizeof(uint64_t) > 3 * PyLong_SHIFT)) { + if ((8 * sizeof(unsigned long) > 4 * PyLong_SHIFT)) { + __PYX_VERIFY_RETURN_INT(uint64_t, unsigned long, (((((((((unsigned long)digits[3]) << PyLong_SHIFT) | (unsigned long)digits[2]) << PyLong_SHIFT) | (unsigned long)digits[1]) << PyLong_SHIFT) | (unsigned long)digits[0]))) + } else if ((8 * sizeof(uint64_t) >= 4 * PyLong_SHIFT)) { + return (uint64_t) (((((((((uint64_t)digits[3]) << PyLong_SHIFT) | (uint64_t)digits[2]) << PyLong_SHIFT) | (uint64_t)digits[1]) << PyLong_SHIFT) | (uint64_t)digits[0])); + } + } + break; + } + } +#endif +#if CYTHON_COMPILING_IN_CPYTHON && 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 (uint64_t) -1; + if (unlikely(result == 1)) + goto raise_neg_overflow; + } +#endif + if ((sizeof(uint64_t) <= sizeof(unsigned long))) { + __PYX_VERIFY_RETURN_INT_EXC(uint64_t, unsigned long, PyLong_AsUnsignedLong(x)) + } else if ((sizeof(uint64_t) <= sizeof(unsigned PY_LONG_LONG))) { + __PYX_VERIFY_RETURN_INT_EXC(uint64_t, unsigned PY_LONG_LONG, PyLong_AsUnsignedLongLong(x)) + } + } else { +#if CYTHON_USE_PYLONG_INTERNALS + if (__Pyx_PyLong_IsCompact(x)) { + __PYX_VERIFY_RETURN_INT(uint64_t, __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(uint64_t) - 1 > 1 * PyLong_SHIFT)) { + if ((8 * sizeof(unsigned long) > 2 * PyLong_SHIFT)) { + __PYX_VERIFY_RETURN_INT(uint64_t, long, -(long) (((((unsigned long)digits[1]) << PyLong_SHIFT) | (unsigned long)digits[0]))) + } else if ((8 * sizeof(uint64_t) - 1 > 2 * PyLong_SHIFT)) { + return (uint64_t) (((uint64_t)-1)*(((((uint64_t)digits[1]) << PyLong_SHIFT) | (uint64_t)digits[0]))); + } + } + break; + case 2: + if ((8 * sizeof(uint64_t) > 1 * PyLong_SHIFT)) { + if ((8 * sizeof(unsigned long) > 2 * PyLong_SHIFT)) { + __PYX_VERIFY_RETURN_INT(uint64_t, unsigned long, (((((unsigned long)digits[1]) << PyLong_SHIFT) | (unsigned long)digits[0]))) + } else if ((8 * sizeof(uint64_t) - 1 > 2 * PyLong_SHIFT)) { + return (uint64_t) ((((((uint64_t)digits[1]) << PyLong_SHIFT) | (uint64_t)digits[0]))); + } + } + break; + case -3: + if ((8 * sizeof(uint64_t) - 1 > 2 * PyLong_SHIFT)) { + if ((8 * sizeof(unsigned long) > 3 * PyLong_SHIFT)) { + __PYX_VERIFY_RETURN_INT(uint64_t, long, -(long) (((((((unsigned long)digits[2]) << PyLong_SHIFT) | (unsigned long)digits[1]) << PyLong_SHIFT) | (unsigned long)digits[0]))) + } else if ((8 * sizeof(uint64_t) - 1 > 3 * PyLong_SHIFT)) { + return (uint64_t) (((uint64_t)-1)*(((((((uint64_t)digits[2]) << PyLong_SHIFT) | (uint64_t)digits[1]) << PyLong_SHIFT) | (uint64_t)digits[0]))); + } + } + break; + case 3: + if ((8 * sizeof(uint64_t) > 2 * PyLong_SHIFT)) { + if ((8 * sizeof(unsigned long) > 3 * PyLong_SHIFT)) { + __PYX_VERIFY_RETURN_INT(uint64_t, unsigned long, (((((((unsigned long)digits[2]) << PyLong_SHIFT) | (unsigned long)digits[1]) << PyLong_SHIFT) | (unsigned long)digits[0]))) + } else if ((8 * sizeof(uint64_t) - 1 > 3 * PyLong_SHIFT)) { + return (uint64_t) ((((((((uint64_t)digits[2]) << PyLong_SHIFT) | (uint64_t)digits[1]) << PyLong_SHIFT) | (uint64_t)digits[0]))); + } + } + break; + case -4: + if ((8 * sizeof(uint64_t) - 1 > 3 * PyLong_SHIFT)) { + if ((8 * sizeof(unsigned long) > 4 * PyLong_SHIFT)) { + __PYX_VERIFY_RETURN_INT(uint64_t, long, -(long) (((((((((unsigned long)digits[3]) << PyLong_SHIFT) | (unsigned long)digits[2]) << PyLong_SHIFT) | (unsigned long)digits[1]) << PyLong_SHIFT) | (unsigned long)digits[0]))) + } else if ((8 * sizeof(uint64_t) - 1 > 4 * PyLong_SHIFT)) { + return (uint64_t) (((uint64_t)-1)*(((((((((uint64_t)digits[3]) << PyLong_SHIFT) | (uint64_t)digits[2]) << PyLong_SHIFT) | (uint64_t)digits[1]) << PyLong_SHIFT) | (uint64_t)digits[0]))); + } + } + break; + case 4: + if ((8 * sizeof(uint64_t) > 3 * PyLong_SHIFT)) { + if ((8 * sizeof(unsigned long) > 4 * PyLong_SHIFT)) { + __PYX_VERIFY_RETURN_INT(uint64_t, unsigned long, (((((((((unsigned long)digits[3]) << PyLong_SHIFT) | (unsigned long)digits[2]) << PyLong_SHIFT) | (unsigned long)digits[1]) << PyLong_SHIFT) | (unsigned long)digits[0]))) + } else if ((8 * sizeof(uint64_t) - 1 > 4 * PyLong_SHIFT)) { + return (uint64_t) ((((((((((uint64_t)digits[3]) << PyLong_SHIFT) | (uint64_t)digits[2]) << PyLong_SHIFT) | (uint64_t)digits[1]) << PyLong_SHIFT) | (uint64_t)digits[0]))); + } + } + break; + } + } +#endif + if ((sizeof(uint64_t) <= sizeof(long))) { + __PYX_VERIFY_RETURN_INT_EXC(uint64_t, long, PyLong_AsLong(x)) + } else if ((sizeof(uint64_t) <= sizeof(PY_LONG_LONG))) { + __PYX_VERIFY_RETURN_INT_EXC(uint64_t, PY_LONG_LONG, PyLong_AsLongLong(x)) + } + } + { + uint64_t 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 (uint64_t) -1; + assert(PyLong_CheckExact(v)); + } + { + int result = PyObject_RichCompareBool(v, Py_False, Py_LT); + if (unlikely(result < 0)) { + Py_DECREF(v); + return (uint64_t) -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 (uint64_t) -1; + } else { + stepval = v; + } + v = NULL; + val = (uint64_t) 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(uint64_t) * 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 |= ((uint64_t) 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(uint64_t) * 8) - bits - (is_unsigned ? 0 : 1); + if (unlikely(idigit >= (1L << remaining_bits))) + goto raise_overflow; + val |= ((uint64_t) idigit) << bits; + } + if (!is_unsigned) { + if (unlikely(val & (((uint64_t) 1) << (sizeof(uint64_t) * 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 (uint64_t) -1; + return val; + } +raise_overflow: + PyErr_SetString(PyExc_OverflowError, + "value too large to convert to uint64_t"); + return (uint64_t) -1; +raise_neg_overflow: + PyErr_SetString(PyExc_OverflowError, + "can't convert negative value to uint64_t"); + return (uint64_t) -1; +} + +/* CIntFromPy */ +static CYTHON_INLINE uint16_t __Pyx_PyLong_As_uint16_t(PyObject *x) { +#ifdef __Pyx_HAS_GCC_DIAGNOSTIC +#pragma GCC diagnostic push +#pragma GCC diagnostic ignored "-Wconversion" +#endif + const uint16_t neg_one = (uint16_t) -1, const_zero = (uint16_t) 0; +#ifdef __Pyx_HAS_GCC_DIAGNOSTIC +#pragma GCC diagnostic pop +#endif + const int is_unsigned = neg_one > const_zero; + if (unlikely(!PyLong_Check(x))) { + uint16_t val; + PyObject *tmp = __Pyx_PyNumber_Long(x); + if (!tmp) return (uint16_t) -1; + val = __Pyx_PyLong_As_uint16_t(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(uint16_t, __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(uint16_t) > 1 * PyLong_SHIFT)) { + if ((8 * sizeof(unsigned long) > 2 * PyLong_SHIFT)) { + __PYX_VERIFY_RETURN_INT(uint16_t, unsigned long, (((((unsigned long)digits[1]) << PyLong_SHIFT) | (unsigned long)digits[0]))) + } else if ((8 * sizeof(uint16_t) >= 2 * PyLong_SHIFT)) { + return (uint16_t) (((((uint16_t)digits[1]) << PyLong_SHIFT) | (uint16_t)digits[0])); + } + } + break; + case 3: + if ((8 * sizeof(uint16_t) > 2 * PyLong_SHIFT)) { + if ((8 * sizeof(unsigned long) > 3 * PyLong_SHIFT)) { + __PYX_VERIFY_RETURN_INT(uint16_t, unsigned long, (((((((unsigned long)digits[2]) << PyLong_SHIFT) | (unsigned long)digits[1]) << PyLong_SHIFT) | (unsigned long)digits[0]))) + } else if ((8 * sizeof(uint16_t) >= 3 * PyLong_SHIFT)) { + return (uint16_t) (((((((uint16_t)digits[2]) << PyLong_SHIFT) | (uint16_t)digits[1]) << PyLong_SHIFT) | (uint16_t)digits[0])); + } + } + break; + case 4: + if ((8 * sizeof(uint16_t) > 3 * PyLong_SHIFT)) { + if ((8 * sizeof(unsigned long) > 4 * PyLong_SHIFT)) { + __PYX_VERIFY_RETURN_INT(uint16_t, unsigned long, (((((((((unsigned long)digits[3]) << PyLong_SHIFT) | (unsigned long)digits[2]) << PyLong_SHIFT) | (unsigned long)digits[1]) << PyLong_SHIFT) | (unsigned long)digits[0]))) + } else if ((8 * sizeof(uint16_t) >= 4 * PyLong_SHIFT)) { + return (uint16_t) (((((((((uint16_t)digits[3]) << PyLong_SHIFT) | (uint16_t)digits[2]) << PyLong_SHIFT) | (uint16_t)digits[1]) << PyLong_SHIFT) | (uint16_t)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 (uint16_t) -1; + if (unlikely(result == 1)) + goto raise_neg_overflow; + } +#endif + if ((sizeof(uint16_t) <= sizeof(unsigned long))) { + __PYX_VERIFY_RETURN_INT_EXC(uint16_t, unsigned long, PyLong_AsUnsignedLong(x)) + } else if ((sizeof(uint16_t) <= sizeof(unsigned PY_LONG_LONG))) { + __PYX_VERIFY_RETURN_INT_EXC(uint16_t, unsigned PY_LONG_LONG, PyLong_AsUnsignedLongLong(x)) + } + } else { +#if CYTHON_USE_PYLONG_INTERNALS + if (__Pyx_PyLong_IsCompact(x)) { + __PYX_VERIFY_RETURN_INT(uint16_t, __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(uint16_t) - 1 > 1 * PyLong_SHIFT)) { + if ((8 * sizeof(unsigned long) > 2 * PyLong_SHIFT)) { + __PYX_VERIFY_RETURN_INT(uint16_t, long, -(long) (((((unsigned long)digits[1]) << PyLong_SHIFT) | (unsigned long)digits[0]))) + } else if ((8 * sizeof(uint16_t) - 1 > 2 * PyLong_SHIFT)) { + return (uint16_t) (((uint16_t)-1)*(((((uint16_t)digits[1]) << PyLong_SHIFT) | (uint16_t)digits[0]))); + } + } + break; + case 2: + if ((8 * sizeof(uint16_t) > 1 * PyLong_SHIFT)) { + if ((8 * sizeof(unsigned long) > 2 * PyLong_SHIFT)) { + __PYX_VERIFY_RETURN_INT(uint16_t, unsigned long, (((((unsigned long)digits[1]) << PyLong_SHIFT) | (unsigned long)digits[0]))) + } else if ((8 * sizeof(uint16_t) - 1 > 2 * PyLong_SHIFT)) { + return (uint16_t) ((((((uint16_t)digits[1]) << PyLong_SHIFT) | (uint16_t)digits[0]))); + } + } + break; + case -3: + if ((8 * sizeof(uint16_t) - 1 > 2 * PyLong_SHIFT)) { + if ((8 * sizeof(unsigned long) > 3 * PyLong_SHIFT)) { + __PYX_VERIFY_RETURN_INT(uint16_t, long, -(long) (((((((unsigned long)digits[2]) << PyLong_SHIFT) | (unsigned long)digits[1]) << PyLong_SHIFT) | (unsigned long)digits[0]))) + } else if ((8 * sizeof(uint16_t) - 1 > 3 * PyLong_SHIFT)) { + return (uint16_t) (((uint16_t)-1)*(((((((uint16_t)digits[2]) << PyLong_SHIFT) | (uint16_t)digits[1]) << PyLong_SHIFT) | (uint16_t)digits[0]))); + } + } + break; + case 3: + if ((8 * sizeof(uint16_t) > 2 * PyLong_SHIFT)) { + if ((8 * sizeof(unsigned long) > 3 * PyLong_SHIFT)) { + __PYX_VERIFY_RETURN_INT(uint16_t, unsigned long, (((((((unsigned long)digits[2]) << PyLong_SHIFT) | (unsigned long)digits[1]) << PyLong_SHIFT) | (unsigned long)digits[0]))) + } else if ((8 * sizeof(uint16_t) - 1 > 3 * PyLong_SHIFT)) { + return (uint16_t) ((((((((uint16_t)digits[2]) << PyLong_SHIFT) | (uint16_t)digits[1]) << PyLong_SHIFT) | (uint16_t)digits[0]))); + } + } + break; + case -4: + if ((8 * sizeof(uint16_t) - 1 > 3 * PyLong_SHIFT)) { + if ((8 * sizeof(unsigned long) > 4 * PyLong_SHIFT)) { + __PYX_VERIFY_RETURN_INT(uint16_t, long, -(long) (((((((((unsigned long)digits[3]) << PyLong_SHIFT) | (unsigned long)digits[2]) << PyLong_SHIFT) | (unsigned long)digits[1]) << PyLong_SHIFT) | (unsigned long)digits[0]))) + } else if ((8 * sizeof(uint16_t) - 1 > 4 * PyLong_SHIFT)) { + return (uint16_t) (((uint16_t)-1)*(((((((((uint16_t)digits[3]) << PyLong_SHIFT) | (uint16_t)digits[2]) << PyLong_SHIFT) | (uint16_t)digits[1]) << PyLong_SHIFT) | (uint16_t)digits[0]))); + } + } + break; + case 4: + if ((8 * sizeof(uint16_t) > 3 * PyLong_SHIFT)) { + if ((8 * sizeof(unsigned long) > 4 * PyLong_SHIFT)) { + __PYX_VERIFY_RETURN_INT(uint16_t, unsigned long, (((((((((unsigned long)digits[3]) << PyLong_SHIFT) | (unsigned long)digits[2]) << PyLong_SHIFT) | (unsigned long)digits[1]) << PyLong_SHIFT) | (unsigned long)digits[0]))) + } else if ((8 * sizeof(uint16_t) - 1 > 4 * PyLong_SHIFT)) { + return (uint16_t) ((((((((((uint16_t)digits[3]) << PyLong_SHIFT) | (uint16_t)digits[2]) << PyLong_SHIFT) | (uint16_t)digits[1]) << PyLong_SHIFT) | (uint16_t)digits[0]))); + } + } + break; + } + } +#endif + if ((sizeof(uint16_t) <= sizeof(long))) { + __PYX_VERIFY_RETURN_INT_EXC(uint16_t, long, PyLong_AsLong(x)) + } else if ((sizeof(uint16_t) <= sizeof(PY_LONG_LONG))) { + __PYX_VERIFY_RETURN_INT_EXC(uint16_t, PY_LONG_LONG, PyLong_AsLongLong(x)) + } + } + { + uint16_t 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 (uint16_t) -1; + assert(PyLong_CheckExact(v)); + } + { + int result = PyObject_RichCompareBool(v, Py_False, Py_LT); + if (unlikely(result < 0)) { + Py_DECREF(v); + return (uint16_t) -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 (uint16_t) -1; + } else { + stepval = v; + } + v = NULL; + val = (uint16_t) 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(uint16_t) * 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 |= ((uint16_t) 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(uint16_t) * 8) - bits - (is_unsigned ? 0 : 1); + if (unlikely(idigit >= (1L << remaining_bits))) + goto raise_overflow; + val |= ((uint16_t) idigit) << bits; + } + if (!is_unsigned) { + if (unlikely(val & (((uint16_t) 1) << (sizeof(uint16_t) * 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 (uint16_t) -1; + return val; + } +raise_overflow: + PyErr_SetString(PyExc_OverflowError, + "value too large to convert to uint16_t"); + return (uint16_t) -1; +raise_neg_overflow: + PyErr_SetString(PyExc_OverflowError, + "can't convert negative value to uint16_t"); + return (uint16_t) -1; +} + +/* CIntFromPy */ +static CYTHON_INLINE size_t __Pyx_PyLong_As_size_t(PyObject *x) { +#ifdef __Pyx_HAS_GCC_DIAGNOSTIC +#pragma GCC diagnostic push +#pragma GCC diagnostic ignored "-Wconversion" +#endif + const size_t neg_one = (size_t) -1, const_zero = (size_t) 0; +#ifdef __Pyx_HAS_GCC_DIAGNOSTIC +#pragma GCC diagnostic pop +#endif + const int is_unsigned = neg_one > const_zero; + if (unlikely(!PyLong_Check(x))) { + size_t val; + PyObject *tmp = __Pyx_PyNumber_Long(x); + if (!tmp) return (size_t) -1; + val = __Pyx_PyLong_As_size_t(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(size_t, __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(size_t) > 1 * PyLong_SHIFT)) { + if ((8 * sizeof(unsigned long) > 2 * PyLong_SHIFT)) { + __PYX_VERIFY_RETURN_INT(size_t, unsigned long, (((((unsigned long)digits[1]) << PyLong_SHIFT) | (unsigned long)digits[0]))) + } else if ((8 * sizeof(size_t) >= 2 * PyLong_SHIFT)) { + return (size_t) (((((size_t)digits[1]) << PyLong_SHIFT) | (size_t)digits[0])); + } + } + break; + case 3: + if ((8 * sizeof(size_t) > 2 * PyLong_SHIFT)) { + if ((8 * sizeof(unsigned long) > 3 * PyLong_SHIFT)) { + __PYX_VERIFY_RETURN_INT(size_t, unsigned long, (((((((unsigned long)digits[2]) << PyLong_SHIFT) | (unsigned long)digits[1]) << PyLong_SHIFT) | (unsigned long)digits[0]))) + } else if ((8 * sizeof(size_t) >= 3 * PyLong_SHIFT)) { + return (size_t) (((((((size_t)digits[2]) << PyLong_SHIFT) | (size_t)digits[1]) << PyLong_SHIFT) | (size_t)digits[0])); + } + } + break; + case 4: + if ((8 * sizeof(size_t) > 3 * PyLong_SHIFT)) { + if ((8 * sizeof(unsigned long) > 4 * PyLong_SHIFT)) { + __PYX_VERIFY_RETURN_INT(size_t, unsigned long, (((((((((unsigned long)digits[3]) << PyLong_SHIFT) | (unsigned long)digits[2]) << PyLong_SHIFT) | (unsigned long)digits[1]) << PyLong_SHIFT) | (unsigned long)digits[0]))) + } else if ((8 * sizeof(size_t) >= 4 * PyLong_SHIFT)) { + return (size_t) (((((((((size_t)digits[3]) << PyLong_SHIFT) | (size_t)digits[2]) << PyLong_SHIFT) | (size_t)digits[1]) << PyLong_SHIFT) | (size_t)digits[0])); + } + } + break; + } + } +#endif +#if CYTHON_COMPILING_IN_CPYTHON && 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 (size_t) -1; + if (unlikely(result == 1)) + goto raise_neg_overflow; + } +#endif + if ((sizeof(size_t) <= sizeof(unsigned long))) { + __PYX_VERIFY_RETURN_INT_EXC(size_t, unsigned long, PyLong_AsUnsignedLong(x)) + } else if ((sizeof(size_t) <= sizeof(unsigned PY_LONG_LONG))) { + __PYX_VERIFY_RETURN_INT_EXC(size_t, unsigned PY_LONG_LONG, PyLong_AsUnsignedLongLong(x)) + } + } else { +#if CYTHON_USE_PYLONG_INTERNALS + if (__Pyx_PyLong_IsCompact(x)) { + __PYX_VERIFY_RETURN_INT(size_t, __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(size_t) - 1 > 1 * PyLong_SHIFT)) { + if ((8 * sizeof(unsigned long) > 2 * PyLong_SHIFT)) { + __PYX_VERIFY_RETURN_INT(size_t, long, -(long) (((((unsigned long)digits[1]) << PyLong_SHIFT) | (unsigned long)digits[0]))) + } else if ((8 * sizeof(size_t) - 1 > 2 * PyLong_SHIFT)) { + return (size_t) (((size_t)-1)*(((((size_t)digits[1]) << PyLong_SHIFT) | (size_t)digits[0]))); + } + } + break; + case 2: + if ((8 * sizeof(size_t) > 1 * PyLong_SHIFT)) { + if ((8 * sizeof(unsigned long) > 2 * PyLong_SHIFT)) { + __PYX_VERIFY_RETURN_INT(size_t, unsigned long, (((((unsigned long)digits[1]) << PyLong_SHIFT) | (unsigned long)digits[0]))) + } else if ((8 * sizeof(size_t) - 1 > 2 * PyLong_SHIFT)) { + return (size_t) ((((((size_t)digits[1]) << PyLong_SHIFT) | (size_t)digits[0]))); + } + } + break; + case -3: + if ((8 * sizeof(size_t) - 1 > 2 * PyLong_SHIFT)) { + if ((8 * sizeof(unsigned long) > 3 * PyLong_SHIFT)) { + __PYX_VERIFY_RETURN_INT(size_t, long, -(long) (((((((unsigned long)digits[2]) << PyLong_SHIFT) | (unsigned long)digits[1]) << PyLong_SHIFT) | (unsigned long)digits[0]))) + } else if ((8 * sizeof(size_t) - 1 > 3 * PyLong_SHIFT)) { + return (size_t) (((size_t)-1)*(((((((size_t)digits[2]) << PyLong_SHIFT) | (size_t)digits[1]) << PyLong_SHIFT) | (size_t)digits[0]))); + } + } + break; + case 3: + if ((8 * sizeof(size_t) > 2 * PyLong_SHIFT)) { + if ((8 * sizeof(unsigned long) > 3 * PyLong_SHIFT)) { + __PYX_VERIFY_RETURN_INT(size_t, unsigned long, (((((((unsigned long)digits[2]) << PyLong_SHIFT) | (unsigned long)digits[1]) << PyLong_SHIFT) | (unsigned long)digits[0]))) + } else if ((8 * sizeof(size_t) - 1 > 3 * PyLong_SHIFT)) { + return (size_t) ((((((((size_t)digits[2]) << PyLong_SHIFT) | (size_t)digits[1]) << PyLong_SHIFT) | (size_t)digits[0]))); + } + } + break; + case -4: + if ((8 * sizeof(size_t) - 1 > 3 * PyLong_SHIFT)) { + if ((8 * sizeof(unsigned long) > 4 * PyLong_SHIFT)) { + __PYX_VERIFY_RETURN_INT(size_t, long, -(long) (((((((((unsigned long)digits[3]) << PyLong_SHIFT) | (unsigned long)digits[2]) << PyLong_SHIFT) | (unsigned long)digits[1]) << PyLong_SHIFT) | (unsigned long)digits[0]))) + } else if ((8 * sizeof(size_t) - 1 > 4 * PyLong_SHIFT)) { + return (size_t) (((size_t)-1)*(((((((((size_t)digits[3]) << PyLong_SHIFT) | (size_t)digits[2]) << PyLong_SHIFT) | (size_t)digits[1]) << PyLong_SHIFT) | (size_t)digits[0]))); + } + } + break; + case 4: + if ((8 * sizeof(size_t) > 3 * PyLong_SHIFT)) { + if ((8 * sizeof(unsigned long) > 4 * PyLong_SHIFT)) { + __PYX_VERIFY_RETURN_INT(size_t, unsigned long, (((((((((unsigned long)digits[3]) << PyLong_SHIFT) | (unsigned long)digits[2]) << PyLong_SHIFT) | (unsigned long)digits[1]) << PyLong_SHIFT) | (unsigned long)digits[0]))) + } else if ((8 * sizeof(size_t) - 1 > 4 * PyLong_SHIFT)) { + return (size_t) ((((((((((size_t)digits[3]) << PyLong_SHIFT) | (size_t)digits[2]) << PyLong_SHIFT) | (size_t)digits[1]) << PyLong_SHIFT) | (size_t)digits[0]))); + } + } + break; + } + } +#endif + if ((sizeof(size_t) <= sizeof(long))) { + __PYX_VERIFY_RETURN_INT_EXC(size_t, long, PyLong_AsLong(x)) + } else if ((sizeof(size_t) <= sizeof(PY_LONG_LONG))) { + __PYX_VERIFY_RETURN_INT_EXC(size_t, PY_LONG_LONG, PyLong_AsLongLong(x)) + } + } + { + size_t 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 (size_t) -1; + assert(PyLong_CheckExact(v)); + } + { + int result = PyObject_RichCompareBool(v, Py_False, Py_LT); + if (unlikely(result < 0)) { + Py_DECREF(v); + return (size_t) -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 (size_t) -1; + } else { + stepval = v; + } + v = NULL; + val = (size_t) 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(size_t) * 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 |= ((size_t) 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(size_t) * 8) - bits - (is_unsigned ? 0 : 1); + if (unlikely(idigit >= (1L << remaining_bits))) + goto raise_overflow; + val |= ((size_t) idigit) << bits; + } + if (!is_unsigned) { + if (unlikely(val & (((size_t) 1) << (sizeof(size_t) * 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 (size_t) -1; + return val; + } +raise_overflow: + PyErr_SetString(PyExc_OverflowError, + "value too large to convert to size_t"); + return (size_t) -1; +raise_neg_overflow: + PyErr_SetString(PyExc_OverflowError, + "can't convert negative value to size_t"); + return (size_t) -1; +} + +/* ObjectAsUCS4 */ +static void __Pyx__PyObject_AsPy_UCS4_raise_error(long ival) { + if (ival < 0) { + if (!PyErr_Occurred()) + PyErr_SetString(PyExc_OverflowError, + "cannot convert negative value to Py_UCS4"); + } else { + PyErr_SetString(PyExc_OverflowError, + "value too large to convert to Py_UCS4"); + } +} +static Py_UCS4 __Pyx__PyObject_AsPy_UCS4(PyObject* x) { + long ival; + ival = __Pyx_PyLong_As_long(x); + if (unlikely(!__Pyx_is_valid_index(ival, 1114111 + 1))) { + __Pyx__PyObject_AsPy_UCS4_raise_error(ival); + return (Py_UCS4)-1; + } + return (Py_UCS4)ival; +} + +/* 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__9); + } + 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, *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)) return NULL; + 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 */ diff --git a/TTS/Kokoro/.venv/Lib/site-packages/spacy/pipeline/_edit_tree_internals/edit_trees.pxd b/TTS/Kokoro/.venv/Lib/site-packages/spacy/pipeline/_edit_tree_internals/edit_trees.pxd new file mode 100644 index 0000000000000000000000000000000000000000..9f80a19ba2a7143a9f936c5394449f81ed954761 --- /dev/null +++ b/TTS/Kokoro/.venv/Lib/site-packages/spacy/pipeline/_edit_tree_internals/edit_trees.pxd @@ -0,0 +1,101 @@ +from libc.stdint cimport uint32_t, uint64_t +from libcpp.unordered_map cimport unordered_map +from libcpp.vector cimport vector + +from ...strings cimport StringStore +from ...typedefs cimport attr_t, hash_t, len_t + + +cdef extern from "" namespace "std" nogil: + void swap[T](T& a, T& b) except + # Only available in Cython 3. + +# An edit tree (Müller et al., 2015) is a tree structure that consists of +# edit operations. The two types of operations are string matches +# and string substitutions. Given an input string s and an output string t, +# subsitution and match nodes should be interpreted as follows: +# +# * Substitution node: consists of an original string and substitute string. +# If s matches the original string, then t is the substitute. Otherwise, +# the node does not apply. +# * Match node: consists of a prefix length, suffix length, prefix edit tree, +# and suffix edit tree. If s is composed of a prefix, middle part, and suffix +# with the given suffix and prefix lengths, then t is the concatenation +# prefix_tree(prefix) + middle + suffix_tree(suffix). +# +# For efficiency, we represent strings in substitution nodes as integers, with +# the actual strings stored in a StringStore. Subtrees in match nodes are stored +# as tree identifiers (rather than pointers) to simplify serialization. + +cdef uint32_t NULL_TREE_ID + +cdef struct MatchNodeC: + len_t prefix_len + len_t suffix_len + uint32_t prefix_tree + uint32_t suffix_tree + +cdef struct SubstNodeC: + attr_t orig + attr_t subst + +cdef union NodeC: + MatchNodeC match_node + SubstNodeC subst_node + +cdef struct EditTreeC: + bint is_match_node + NodeC inner + +cdef inline EditTreeC edittree_new_match( + len_t prefix_len, + len_t suffix_len, + uint32_t prefix_tree, + uint32_t suffix_tree +): + cdef MatchNodeC match_node = MatchNodeC( + prefix_len=prefix_len, + suffix_len=suffix_len, + prefix_tree=prefix_tree, + suffix_tree=suffix_tree + ) + cdef NodeC inner = NodeC(match_node=match_node) + return EditTreeC(is_match_node=True, inner=inner) + +cdef inline EditTreeC edittree_new_subst(attr_t orig, attr_t subst): + cdef EditTreeC node + cdef SubstNodeC subst_node = SubstNodeC(orig=orig, subst=subst) + cdef NodeC inner = NodeC(subst_node=subst_node) + return EditTreeC(is_match_node=False, inner=inner) + +cdef inline uint64_t edittree_hash(EditTreeC tree): + cdef MatchNodeC match_node + cdef SubstNodeC subst_node + + if tree.is_match_node: + match_node = tree.inner.match_node + return hash((match_node.prefix_len, match_node.suffix_len, match_node.prefix_tree, match_node.suffix_tree)) + else: + subst_node = tree.inner.subst_node + return hash((subst_node.orig, subst_node.subst)) + +cdef struct LCS: + int source_begin + int source_end + int target_begin + int target_end + +cdef inline bint lcs_is_empty(LCS lcs): + return lcs.source_begin == 0 and lcs.source_end == 0 and lcs.target_begin == 0 and lcs.target_end == 0 + +cdef class EditTrees: + cdef vector[EditTreeC] trees + cdef unordered_map[hash_t, uint32_t] map + cdef StringStore strings + + cpdef uint32_t add(self, str form, str lemma) + cpdef str apply(self, uint32_t tree_id, str form) + cpdef unicode tree_to_str(self, uint32_t tree_id) + + cdef uint32_t _add(self, str form, str lemma) + cdef _apply(self, uint32_t tree_id, str form_part, list lemma_pieces) + cdef uint32_t _tree_id(self, EditTreeC tree) diff --git a/TTS/Kokoro/.venv/Lib/site-packages/spacy/pipeline/_edit_tree_internals/edit_trees.pyx b/TTS/Kokoro/.venv/Lib/site-packages/spacy/pipeline/_edit_tree_internals/edit_trees.pyx new file mode 100644 index 0000000000000000000000000000000000000000..3e4bc15ee115596342f80184e8306b46c06cb875 --- /dev/null +++ b/TTS/Kokoro/.venv/Lib/site-packages/spacy/pipeline/_edit_tree_internals/edit_trees.pyx @@ -0,0 +1,302 @@ +# cython: infer_types=True, binding=True +# cython: profile=False +from cython.operator cimport dereference as deref +from libc.stdint cimport UINT32_MAX, uint32_t +from libc.string cimport memset +from libcpp.pair cimport pair +from libcpp.vector cimport vector + +from ...typedefs cimport hash_t + +from ... import util +from ...errors import Errors +from ...strings import StringStore +from .schemas import validate_edit_tree + +NULL_TREE_ID = UINT32_MAX + +cdef LCS find_lcs(str source, str target): + """ + Find the longest common subsequence (LCS) between two strings. If there are + multiple LCSes, only one of them is returned. + + source (str): The first string. + target (str): The second string. + RETURNS (LCS): The spans of the longest common subsequences. + """ + cdef Py_ssize_t target_len = len(target) + cdef size_t longest_align = 0 + cdef int source_idx, target_idx + cdef LCS lcs + cdef Py_UCS4 source_cp, target_cp + + memset(&lcs, 0, sizeof(lcs)) + + cdef vector[size_t] prev_aligns = vector[size_t](target_len) + cdef vector[size_t] cur_aligns = vector[size_t](target_len) + + for (source_idx, source_cp) in enumerate(source): + for (target_idx, target_cp) in enumerate(target): + if source_cp == target_cp: + if source_idx == 0 or target_idx == 0: + cur_aligns[target_idx] = 1 + else: + cur_aligns[target_idx] = prev_aligns[target_idx - 1] + 1 + + # Check if this is the longest alignment and replace previous + # best alignment when this is the case. + if cur_aligns[target_idx] > longest_align: + longest_align = cur_aligns[target_idx] + lcs.source_begin = source_idx - longest_align + 1 + lcs.source_end = source_idx + 1 + lcs.target_begin = target_idx - longest_align + 1 + lcs.target_end = target_idx + 1 + else: + # No match, we start with a zero-length alignment. + cur_aligns[target_idx] = 0 + swap(prev_aligns, cur_aligns) + + return lcs + +cdef class EditTrees: + """Container for constructing and storing edit trees.""" + def __init__(self, strings: StringStore): + """Create a container for edit trees. + + strings (StringStore): the string store to use.""" + self.strings = strings + + cpdef uint32_t add(self, str form, str lemma): + """Add an edit tree that rewrites the given string into the given lemma. + + RETURNS (int): identifier of the edit tree in the container. + """ + # Treat two empty strings as a special case. Generating an edit + # tree for identical strings results in a match node. However, + # since two empty strings have a zero-length LCS, a substitution + # node would be created. Since we do not want to clutter the + # recursive tree construction with logic for this case, handle + # it in this wrapper method. + if len(form) == 0 and len(lemma) == 0: + tree = edittree_new_match(0, 0, NULL_TREE_ID, NULL_TREE_ID) + return self._tree_id(tree) + + return self._add(form, lemma) + + cdef uint32_t _add(self, str form, str lemma): + cdef LCS lcs = find_lcs(form, lemma) + + cdef EditTreeC tree + cdef uint32_t prefix_tree, suffix_tree + if lcs_is_empty(lcs): + tree = edittree_new_subst(self.strings.add(form), self.strings.add(lemma)) + else: + # If we have a non-empty LCS, such as "gooi" in "ge[gooi]d" and "[gooi]en", + # create edit trees for the prefix pair ("ge"/"") and the suffix pair ("d"/"en"). + prefix_tree = NULL_TREE_ID + if lcs.source_begin != 0 or lcs.target_begin != 0: + prefix_tree = self.add(form[:lcs.source_begin], lemma[:lcs.target_begin]) + + suffix_tree = NULL_TREE_ID + if lcs.source_end != len(form) or lcs.target_end != len(lemma): + suffix_tree = self.add(form[lcs.source_end:], lemma[lcs.target_end:]) + + tree = edittree_new_match(lcs.source_begin, len(form) - lcs.source_end, prefix_tree, suffix_tree) + + return self._tree_id(tree) + + cdef uint32_t _tree_id(self, EditTreeC tree): + # If this tree has been constructed before, return its identifier. + cdef hash_t hash = edittree_hash(tree) + cdef unordered_map[hash_t, uint32_t].iterator iter = self.map.find(hash) + if iter != self.map.end(): + return deref(iter).second + + # The tree hasn't been seen before, store it. + cdef uint32_t tree_id = self.trees.size() + self.trees.push_back(tree) + self.map.insert(pair[hash_t, uint32_t](hash, tree_id)) + + return tree_id + + cpdef str apply(self, uint32_t tree_id, str form): + """Apply an edit tree to a form. + + tree_id (uint32_t): the identifier of the edit tree to apply. + form (str): the form to apply the edit tree to. + RETURNS (str): the transformer form or None if the edit tree + could not be applied to the form. + """ + if tree_id >= self.trees.size(): + raise IndexError(Errors.E1030) + + lemma_pieces = [] + try: + self._apply(tree_id, form, lemma_pieces) + except ValueError: + return None + return "".join(lemma_pieces) + + cdef _apply(self, uint32_t tree_id, str form_part, list lemma_pieces): + """Recursively apply an edit tree to a form, adding pieces to + the lemma_pieces list.""" + assert tree_id <= self.trees.size() + + cdef EditTreeC tree = self.trees[tree_id] + cdef MatchNodeC match_node + cdef int suffix_start + + if tree.is_match_node: + match_node = tree.inner.match_node + + if match_node.prefix_len + match_node.suffix_len > len(form_part): + raise ValueError(Errors.E1029) + + suffix_start = len(form_part) - match_node.suffix_len + + if match_node.prefix_tree != NULL_TREE_ID: + self._apply(match_node.prefix_tree, form_part[:match_node.prefix_len], lemma_pieces) + + lemma_pieces.append(form_part[match_node.prefix_len:suffix_start]) + + if match_node.suffix_tree != NULL_TREE_ID: + self._apply(match_node.suffix_tree, form_part[suffix_start:], lemma_pieces) + else: + if form_part == self.strings[tree.inner.subst_node.orig]: + lemma_pieces.append(self.strings[tree.inner.subst_node.subst]) + else: + raise ValueError(Errors.E1029) + + cpdef unicode tree_to_str(self, uint32_t tree_id): + """Return the tree as a string. The tree tree string is formatted + like an S-expression. This is primarily useful for debugging. Match + nodes have the following format: + + (m prefix_len suffix_len prefix_tree suffix_tree) + + Substitution nodes have the following format: + + (s original substitute) + + tree_id (uint32_t): the identifier of the edit tree. + RETURNS (str): the tree as an S-expression. + """ + + if tree_id >= self.trees.size(): + raise IndexError(Errors.E1030) + + cdef EditTreeC tree = self.trees[tree_id] + cdef SubstNodeC subst_node + + if not tree.is_match_node: + subst_node = tree.inner.subst_node + return f"(s '{self.strings[subst_node.orig]}' '{self.strings[subst_node.subst]}')" + + cdef MatchNodeC match_node = tree.inner.match_node + + prefix_tree = "()" + if match_node.prefix_tree != NULL_TREE_ID: + prefix_tree = self.tree_to_str(match_node.prefix_tree) + + suffix_tree = "()" + if match_node.suffix_tree != NULL_TREE_ID: + suffix_tree = self.tree_to_str(match_node.suffix_tree) + + return f"(m {match_node.prefix_len} {match_node.suffix_len} {prefix_tree} {suffix_tree})" + + def from_json(self, trees: list) -> "EditTrees": + self.trees.clear() + + for tree in trees: + tree = _dict2tree(tree) + self.trees.push_back(tree) + + self._rebuild_tree_map() + + def from_bytes(self, bytes_data: bytes, *) -> "EditTrees": + def deserialize_trees(tree_dicts): + cdef EditTreeC c_tree + for tree_dict in tree_dicts: + c_tree = _dict2tree(tree_dict) + self.trees.push_back(c_tree) + + deserializers = {} + deserializers["trees"] = lambda n: deserialize_trees(n) + util.from_bytes(bytes_data, deserializers, []) + + self._rebuild_tree_map() + + return self + + def to_bytes(self, **kwargs) -> bytes: + tree_dicts = [] + for tree in self.trees: + tree = _tree2dict(tree) + tree_dicts.append(tree) + + serializers = {} + serializers["trees"] = lambda: tree_dicts + + return util.to_bytes(serializers, []) + + def to_disk(self, path, **kwargs) -> "EditTrees": + path = util.ensure_path(path) + with path.open("wb") as file_: + file_.write(self.to_bytes()) + + def from_disk(self, path, **kwargs) -> "EditTrees": + path = util.ensure_path(path) + if path.exists(): + with path.open("rb") as file_: + data = file_.read() + return self.from_bytes(data) + + return self + + def __getitem__(self, idx): + return _tree2dict(self.trees[idx]) + + def __len__(self): + return self.trees.size() + + def _rebuild_tree_map(self): + """Rebuild the tree hash -> tree id mapping""" + cdef EditTreeC c_tree + cdef uint32_t tree_id + cdef hash_t tree_hash + + self.map.clear() + + for tree_id in range(self.trees.size()): + c_tree = self.trees[tree_id] + tree_hash = edittree_hash(c_tree) + self.map.insert(pair[hash_t, uint32_t](tree_hash, tree_id)) + + def __reduce__(self): + return (unpickle_edittrees, (self.strings, self.to_bytes())) + + +def unpickle_edittrees(strings, trees_data): + return EditTrees(strings).from_bytes(trees_data) + + +def _tree2dict(tree): + if tree["is_match_node"]: + tree = tree["inner"]["match_node"] + else: + tree = tree["inner"]["subst_node"] + return(dict(tree)) + + +def _dict2tree(tree): + errors = validate_edit_tree(tree) + if errors: + raise ValueError(Errors.E1026.format(errors="\n".join(errors))) + + tree = dict(tree) + if "prefix_len" in tree: + tree = {"is_match_node": True, "inner": {"match_node": tree}} + else: + tree = {"is_match_node": False, "inner": {"subst_node": tree}} + + return tree diff --git a/TTS/Kokoro/.venv/Lib/site-packages/spacy/pipeline/_edit_tree_internals/schemas.py b/TTS/Kokoro/.venv/Lib/site-packages/spacy/pipeline/_edit_tree_internals/schemas.py new file mode 100644 index 0000000000000000000000000000000000000000..372d5637264e2ff59d3a01a10cc8a5355da710ce --- /dev/null +++ b/TTS/Kokoro/.venv/Lib/site-packages/spacy/pipeline/_edit_tree_internals/schemas.py @@ -0,0 +1,49 @@ +from collections import defaultdict +from typing import Any, Dict, List, Union + +try: + from pydantic.v1 import BaseModel, Field, ValidationError + from pydantic.v1.types import StrictBool, StrictInt, StrictStr +except ImportError: + from pydantic import BaseModel, Field, ValidationError # type: ignore + from pydantic.types import StrictBool, StrictInt, StrictStr # type: ignore + + +class MatchNodeSchema(BaseModel): + prefix_len: StrictInt = Field(..., title="Prefix length") + suffix_len: StrictInt = Field(..., title="Suffix length") + prefix_tree: StrictInt = Field(..., title="Prefix tree") + suffix_tree: StrictInt = Field(..., title="Suffix tree") + + class Config: + extra = "forbid" + + +class SubstNodeSchema(BaseModel): + orig: Union[int, StrictStr] = Field(..., title="Original substring") + subst: Union[int, StrictStr] = Field(..., title="Replacement substring") + + class Config: + extra = "forbid" + + +class EditTreeSchema(BaseModel): + __root__: Union[MatchNodeSchema, SubstNodeSchema] + + +def validate_edit_tree(obj: Dict[str, Any]) -> List[str]: + """Validate edit tree. + + obj (Dict[str, Any]): JSON-serializable data to validate. + RETURNS (List[str]): A list of error messages, if available. + """ + try: + EditTreeSchema.parse_obj(obj) + return [] + except ValidationError as e: + errors = e.errors() + data = defaultdict(list) + for error in errors: + err_loc = " -> ".join([str(p) for p in error.get("loc", [])]) + data[err_loc].append(error.get("msg")) + return [f"[{loc}] {', '.join(msg)}" for loc, msg in data.items()] # type: ignore[arg-type] diff --git a/TTS/Kokoro/.venv/Lib/site-packages/spacy/pipeline/_parser_internals/__init__.pxd b/TTS/Kokoro/.venv/Lib/site-packages/spacy/pipeline/_parser_internals/__init__.pxd new file mode 100644 index 0000000000000000000000000000000000000000..e69de29bb2d1d6434b8b29ae775ad8c2e48c5391 diff --git a/TTS/Kokoro/.venv/Lib/site-packages/spacy/pipeline/_parser_internals/__init__.py b/TTS/Kokoro/.venv/Lib/site-packages/spacy/pipeline/_parser_internals/__init__.py new file mode 100644 index 0000000000000000000000000000000000000000..e69de29bb2d1d6434b8b29ae775ad8c2e48c5391 diff --git a/TTS/Kokoro/.venv/Lib/site-packages/spacy/pipeline/_parser_internals/__pycache__/__init__.cpython-312.pyc b/TTS/Kokoro/.venv/Lib/site-packages/spacy/pipeline/_parser_internals/__pycache__/__init__.cpython-312.pyc new file mode 100644 index 0000000000000000000000000000000000000000..003fd8ac64c5abc5a8baceaeac73f4edb3f97d43 Binary files /dev/null and b/TTS/Kokoro/.venv/Lib/site-packages/spacy/pipeline/_parser_internals/__pycache__/__init__.cpython-312.pyc differ diff --git a/TTS/Kokoro/.venv/Lib/site-packages/spacy/pipeline/_parser_internals/_beam_utils.cpp b/TTS/Kokoro/.venv/Lib/site-packages/spacy/pipeline/_parser_internals/_beam_utils.cpp new file mode 100644 index 0000000000000000000000000000000000000000..0c0d9eb7239dddfca1824a7d7d3a65c79448bf77 --- /dev/null +++ b/TTS/Kokoro/.venv/Lib/site-packages/spacy/pipeline/_parser_internals/_beam_utils.cpp @@ -0,0 +1,48658 @@ +/* Generated by Cython 3.2.1 */ + +/* BEGIN: Cython Metadata +{ + "distutils": { + "depends": [ + "C:\\Users\\runneradmin\\AppData\\Local\\Temp\\build-env-ej_q3m8u\\Lib\\site-packages\\numpy\\_core\\include\\numpy\\arrayobject.h", + "C:\\Users\\runneradmin\\AppData\\Local\\Temp\\build-env-ej_q3m8u\\Lib\\site-packages\\numpy\\_core\\include\\numpy\\arrayscalars.h", + "C:\\Users\\runneradmin\\AppData\\Local\\Temp\\build-env-ej_q3m8u\\Lib\\site-packages\\numpy\\_core\\include\\numpy\\ndarrayobject.h", + "C:\\Users\\runneradmin\\AppData\\Local\\Temp\\build-env-ej_q3m8u\\Lib\\site-packages\\numpy\\_core\\include\\numpy\\ndarraytypes.h", + "C:\\Users\\runneradmin\\AppData\\Local\\Temp\\build-env-ej_q3m8u\\Lib\\site-packages\\numpy\\_core\\include\\numpy\\ufuncobject.h", + "C:\\Users\\runneradmin\\AppData\\Local\\pypa\\cibuildwheel\\Cache\\nuget-cpython\\python.3.12.10\\tools\\Include\\Python.h" + ], + "extra_compile_args": [ + "-std=c++11" + ], + "include_dirs": [ + "C:\\Users\\runneradmin\\AppData\\Local\\Temp\\build-env-ej_q3m8u\\Lib\\site-packages\\numpy\\_core\\include", + "C:\\Users\\runneradmin\\AppData\\Local\\pypa\\cibuildwheel\\Cache\\nuget-cpython\\python.3.12.10\\tools\\Include" + ], + "language": "c++", + "name": "spacy.pipeline._parser_internals._beam_utils", + "sources": [ + "spacy/pipeline/_parser_internals/_beam_utils.pyx" + ] + }, + "module_name": "spacy.pipeline._parser_internals._beam_utils" +} +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_1" +#define CYTHON_HEX_VERSION 0x030201F0 +#define CYTHON_FUTURE_DIVISION 0 +/* 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)) + +/* CppInitCode */ +#ifndef __cplusplus + #error "Cython files generated with the C++ option must be compiled with a C++ compiler." +#endif +#ifndef CYTHON_INLINE + #if defined(__clang__) + #define CYTHON_INLINE __inline__ __attribute__ ((__unused__)) + #else + #define CYTHON_INLINE inline + #endif +#endif +template +void __Pyx_call_destructor(T& x) { + x.~T(); +} +template +class __Pyx_FakeReference { + public: + __Pyx_FakeReference() : ptr(NULL) { } + __Pyx_FakeReference(const T& ref) : ptr(const_cast(&ref)) { } + T *operator->() { return ptr; } + T *operator&() { return ptr; } + operator T&() { return *ptr; } + template bool operator ==(const U& other) const { return *ptr == other; } + template bool operator !=(const U& other) const { return *ptr != other; } + template bool operator==(const __Pyx_FakeReference& other) const { return *ptr == *other.ptr; } + template bool operator!=(const __Pyx_FakeReference& other) const { return *ptr != *other.ptr; } + private: + T *ptr; +}; + +/* 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 + #define __PYX_EXTERN_C extern "C++" +#endif + +#define __PYX_HAVE__spacy__pipeline___parser_internals___beam_utils +#define __PYX_HAVE_API__spacy__pipeline___parser_internals___beam_utils +/* Early includes */ +#include +#include "ios" +#include "new" +#include "stdexcept" +#include "typeinfo" +#include + + #if __cplusplus >= 201103L || (defined(_MSC_VER) && _MSC_VER >= 1600) + // move should be defined for these versions of MSVC, but __cplusplus isn't set usefully + #include + + namespace cython_std { + template typename std::remove_reference::type&& move(T& t) noexcept { return std::move(t); } + template typename std::remove_reference::type&& move(T&& t) noexcept { return std::move(t); } + } + + #endif + +#include +#include +#include +#include +#include +#include +#include + + /* Using NumPy API declarations from "numpy/__init__.cython-30.pxd" */ + +#include "numpy/arrayobject.h" +#include "numpy/ndarrayobject.h" +#include "numpy/ndarraytypes.h" +#include "numpy/arrayscalars.h" +#include "numpy/ufuncobject.h" +#include +#include "pythread.h" +#ifdef _OPENMP +#include +#endif /* _OPENMP */ + +#if defined(PYREX_WITHOUT_ASSERTIONS) && !defined(CYTHON_WITHOUT_ASSERTIONS) +#define CYTHON_WITHOUT_ASSERTIONS +#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; + +/* Header.proto */ +#if !defined(CYTHON_CCOMPLEX) + #if defined(__cplusplus) + #define CYTHON_CCOMPLEX 1 + #elif (defined(_Complex_I) && !defined(_MSC_VER)) || ((defined (__STDC_VERSION__) && __STDC_VERSION__ >= 201112L) && !defined(__STDC_NO_COMPLEX__) && !defined(_MSC_VER)) + #define CYTHON_CCOMPLEX 1 + #else + #define CYTHON_CCOMPLEX 0 + #endif +#endif +#if CYTHON_CCOMPLEX + #ifdef __cplusplus + #include + #else + #include + #endif +#endif +#if CYTHON_CCOMPLEX && !defined(__cplusplus) && defined(__sun__) && defined(__GNUC__) + #undef _Complex_I + #define _Complex_I 1.0fj +#endif + +/* #### Code section: filename_table ### */ + +static const char* const __pyx_f[] = { + "spacy/pipeline/_parser_internals/_beam_utils.pyx", + "", + "C:/Users/runneradmin/AppData/Local/Temp/build-env-ej_q3m8u/Lib/site-packages/numpy/__init__.cython-30.pxd", + "spacy/lexeme.pxd", + "spacy/pipeline/_parser_internals/_state.pxd", + "spacy/pipeline/_parser_internals/stateclass.pxd", + "cymem/cymem.pxd", + "thinc/extra/search.pxd", + "preshed/maps.pxd", + "spacy/strings.pxd", + "cpython/type.pxd", + "spacy/morphology.pxd", + "spacy/vocab.pxd", + "spacy/tokens/doc.pxd", + "spacy/training/example.pxd", + "spacy/pipeline/_parser_internals/transition_system.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 + +/* ForceInitThreads.proto */ +#ifndef __PYX_FORCE_INIT_THREADS + #define __PYX_FORCE_INIT_THREADS 0 +#endif + +/* NoFastGil.proto */ +#define __Pyx_PyGILState_Ensure PyGILState_Ensure +#define __Pyx_PyGILState_Release PyGILState_Release +#define __Pyx_FastGIL_Remember() +#define __Pyx_FastGIL_Forget() +#define __Pyx_FastGilFuncInit() + +/* IncludeStructmemberH.proto (used by FixUpExtensionType) */ +#include + +/* BufferFormatStructs.proto */ +struct __Pyx_StructField_; +#define __PYX_BUF_FLAGS_PACKED_STRUCT (1 << 0) +typedef struct { + const char* name; + const struct __Pyx_StructField_* fields; + size_t size; + size_t arraysize[8]; + int ndim; + char typegroup; + char is_unsigned; + int flags; +} __Pyx_TypeInfo; +typedef struct __Pyx_StructField_ { + const __Pyx_TypeInfo* type; + const char* name; + size_t offset; +} __Pyx_StructField; +typedef struct { + const __Pyx_StructField* field; + size_t parent_offset; +} __Pyx_BufFmt_StackElem; +typedef struct { + __Pyx_StructField root; + __Pyx_BufFmt_StackElem* head; + size_t fmt_offset; + size_t new_count, enc_count; + size_t struct_alignment; + int is_complex; + char enc_type; + char new_packmode; + char enc_packmode; + char is_valid_array; +} __Pyx_BufFmt_Context; + +/* MemviewSliceStruct.proto */ +struct __pyx_memoryview_obj; +typedef struct { + struct __pyx_memoryview_obj *memview; + char *data; + Py_ssize_t shape[8]; + Py_ssize_t strides[8]; + Py_ssize_t suboffsets[8]; +} __Pyx_memviewslice; +#define __Pyx_MemoryView_Len(m) (m.shape[0]) +#define __Pyx_MEMVIEW_DIRECT 1 +#define __Pyx_MEMVIEW_PTR 2 +#define __Pyx_MEMVIEW_FULL 4 +#define __Pyx_MEMVIEW_CONTIG 8 +#define __Pyx_MEMVIEW_STRIDED 16 +#define __Pyx_MEMVIEW_FOLLOW 32 +#define __Pyx_IS_C_CONTIG 1 +#define __Pyx_IS_F_CONTIG 2 +#define __Pyx_MEMSLICE_INIT { 0, 0, { 0 }, { 0 }, { 0 } } +#if CYTHON_ATOMICS + #define __pyx_add_acquisition_count(memview)\ + __pyx_atomic_incr_relaxed(__pyx_get_slice_count_pointer(memview)) + #define __pyx_sub_acquisition_count(memview)\ + __pyx_atomic_decr_acq_rel(__pyx_get_slice_count_pointer(memview)) +#else + #define __pyx_add_acquisition_count(memview)\ + __pyx_add_acquisition_count_locked(__pyx_get_slice_count_pointer(memview), memview->lock) + #define __pyx_sub_acquisition_count(memview)\ + __pyx_sub_acquisition_count_locked(__pyx_get_slice_count_pointer(memview), memview->lock) +#endif + +/* #### Code section: numeric_typedefs ### */ + +/* "typedefs.pxd":3 + * from libc.stdint cimport int32_t, uint8_t, uint16_t, uint32_t, uint64_t, uintptr_t + * + * ctypedef float weight_t # <<<<<<<<<<<<<< + * ctypedef uint64_t hash_t + * ctypedef uint64_t class_t +*/ +typedef float __pyx_t_5spacy_8typedefs_weight_t; + +/* "typedefs.pxd":4 + * + * ctypedef float weight_t + * ctypedef uint64_t hash_t # <<<<<<<<<<<<<< + * ctypedef uint64_t class_t + * ctypedef uint64_t attr_t +*/ +typedef uint64_t __pyx_t_5spacy_8typedefs_hash_t; + +/* "typedefs.pxd":5 + * ctypedef float weight_t + * ctypedef uint64_t hash_t + * ctypedef uint64_t class_t # <<<<<<<<<<<<<< + * ctypedef uint64_t attr_t + * ctypedef uint64_t flags_t +*/ +typedef uint64_t __pyx_t_5spacy_8typedefs_class_t; + +/* "typedefs.pxd":6 + * ctypedef uint64_t hash_t + * ctypedef uint64_t class_t + * ctypedef uint64_t attr_t # <<<<<<<<<<<<<< + * ctypedef uint64_t flags_t + * ctypedef uint16_t len_t +*/ +typedef uint64_t __pyx_t_5spacy_8typedefs_attr_t; + +/* "typedefs.pxd":7 + * ctypedef uint64_t class_t + * ctypedef uint64_t attr_t + * ctypedef uint64_t flags_t # <<<<<<<<<<<<<< + * ctypedef uint16_t len_t + * ctypedef uint16_t tag_t +*/ +typedef uint64_t __pyx_t_5spacy_8typedefs_flags_t; + +/* "typedefs.pxd":8 + * ctypedef uint64_t attr_t + * ctypedef uint64_t flags_t + * ctypedef uint16_t len_t # <<<<<<<<<<<<<< + * ctypedef uint16_t tag_t +*/ +typedef uint16_t __pyx_t_5spacy_8typedefs_len_t; + +/* "typedefs.pxd":9 + * ctypedef uint64_t flags_t + * ctypedef uint16_t len_t + * ctypedef uint16_t tag_t # <<<<<<<<<<<<<< +*/ +typedef uint16_t __pyx_t_5spacy_8typedefs_tag_t; + +/* "thinc/extra/search.pxd":7 + * from libcpp.vector cimport vector + * + * ctypedef uint64_t hash_t # <<<<<<<<<<<<<< + * ctypedef uint64_t class_t + * ctypedef float weight_t +*/ +typedef uint64_t __pyx_t_5thinc_5extra_6search_hash_t; + +/* "thinc/extra/search.pxd":8 + * + * ctypedef uint64_t hash_t + * ctypedef uint64_t class_t # <<<<<<<<<<<<<< + * ctypedef float weight_t + * +*/ +typedef uint64_t __pyx_t_5thinc_5extra_6search_class_t; + +/* "thinc/extra/search.pxd":9 + * ctypedef uint64_t hash_t + * ctypedef uint64_t class_t + * ctypedef float weight_t # <<<<<<<<<<<<<< + * + * +*/ +typedef float __pyx_t_5thinc_5extra_6search_weight_t; + +/* "preshed/maps.pxd":5 + * + * + * ctypedef uint64_t key_t # <<<<<<<<<<<<<< + * + * +*/ +typedef uint64_t __pyx_t_7preshed_4maps_key_t; + +/* "C:/Users/runneradmin/AppData/Local/Temp/build-env-ej_q3m8u/Lib/site-packages/numpy/__init__.cython-30.pxd":743 + * # in Cython to enable them only on the right systems. + * + * ctypedef npy_int8 int8_t # <<<<<<<<<<<<<< + * ctypedef npy_int16 int16_t + * ctypedef npy_int32 int32_t +*/ +typedef npy_int8 __pyx_t_5numpy_int8_t; + +/* "C:/Users/runneradmin/AppData/Local/Temp/build-env-ej_q3m8u/Lib/site-packages/numpy/__init__.cython-30.pxd":744 + * + * ctypedef npy_int8 int8_t + * ctypedef npy_int16 int16_t # <<<<<<<<<<<<<< + * ctypedef npy_int32 int32_t + * ctypedef npy_int64 int64_t +*/ +typedef npy_int16 __pyx_t_5numpy_int16_t; + +/* "C:/Users/runneradmin/AppData/Local/Temp/build-env-ej_q3m8u/Lib/site-packages/numpy/__init__.cython-30.pxd":745 + * ctypedef npy_int8 int8_t + * ctypedef npy_int16 int16_t + * ctypedef npy_int32 int32_t # <<<<<<<<<<<<<< + * ctypedef npy_int64 int64_t + * +*/ +typedef npy_int32 __pyx_t_5numpy_int32_t; + +/* "C:/Users/runneradmin/AppData/Local/Temp/build-env-ej_q3m8u/Lib/site-packages/numpy/__init__.cython-30.pxd":746 + * ctypedef npy_int16 int16_t + * ctypedef npy_int32 int32_t + * ctypedef npy_int64 int64_t # <<<<<<<<<<<<<< + * + * ctypedef npy_uint8 uint8_t +*/ +typedef npy_int64 __pyx_t_5numpy_int64_t; + +/* "C:/Users/runneradmin/AppData/Local/Temp/build-env-ej_q3m8u/Lib/site-packages/numpy/__init__.cython-30.pxd":748 + * ctypedef npy_int64 int64_t + * + * ctypedef npy_uint8 uint8_t # <<<<<<<<<<<<<< + * ctypedef npy_uint16 uint16_t + * ctypedef npy_uint32 uint32_t +*/ +typedef npy_uint8 __pyx_t_5numpy_uint8_t; + +/* "C:/Users/runneradmin/AppData/Local/Temp/build-env-ej_q3m8u/Lib/site-packages/numpy/__init__.cython-30.pxd":749 + * + * ctypedef npy_uint8 uint8_t + * ctypedef npy_uint16 uint16_t # <<<<<<<<<<<<<< + * ctypedef npy_uint32 uint32_t + * ctypedef npy_uint64 uint64_t +*/ +typedef npy_uint16 __pyx_t_5numpy_uint16_t; + +/* "C:/Users/runneradmin/AppData/Local/Temp/build-env-ej_q3m8u/Lib/site-packages/numpy/__init__.cython-30.pxd":750 + * ctypedef npy_uint8 uint8_t + * ctypedef npy_uint16 uint16_t + * ctypedef npy_uint32 uint32_t # <<<<<<<<<<<<<< + * ctypedef npy_uint64 uint64_t + * +*/ +typedef npy_uint32 __pyx_t_5numpy_uint32_t; + +/* "C:/Users/runneradmin/AppData/Local/Temp/build-env-ej_q3m8u/Lib/site-packages/numpy/__init__.cython-30.pxd":751 + * ctypedef npy_uint16 uint16_t + * ctypedef npy_uint32 uint32_t + * ctypedef npy_uint64 uint64_t # <<<<<<<<<<<<<< + * + * ctypedef npy_float32 float32_t +*/ +typedef npy_uint64 __pyx_t_5numpy_uint64_t; + +/* "C:/Users/runneradmin/AppData/Local/Temp/build-env-ej_q3m8u/Lib/site-packages/numpy/__init__.cython-30.pxd":753 + * ctypedef npy_uint64 uint64_t + * + * ctypedef npy_float32 float32_t # <<<<<<<<<<<<<< + * ctypedef npy_float64 float64_t + * #ctypedef npy_float80 float80_t +*/ +typedef npy_float32 __pyx_t_5numpy_float32_t; + +/* "C:/Users/runneradmin/AppData/Local/Temp/build-env-ej_q3m8u/Lib/site-packages/numpy/__init__.cython-30.pxd":754 + * + * ctypedef npy_float32 float32_t + * ctypedef npy_float64 float64_t # <<<<<<<<<<<<<< + * #ctypedef npy_float80 float80_t + * #ctypedef npy_float128 float128_t +*/ +typedef npy_float64 __pyx_t_5numpy_float64_t; + +/* "C:/Users/runneradmin/AppData/Local/Temp/build-env-ej_q3m8u/Lib/site-packages/numpy/__init__.cython-30.pxd":761 + * ctypedef double complex complex128_t + * + * ctypedef npy_longlong longlong_t # <<<<<<<<<<<<<< + * ctypedef npy_ulonglong ulonglong_t + * +*/ +typedef npy_longlong __pyx_t_5numpy_longlong_t; + +/* "C:/Users/runneradmin/AppData/Local/Temp/build-env-ej_q3m8u/Lib/site-packages/numpy/__init__.cython-30.pxd":762 + * + * ctypedef npy_longlong longlong_t + * ctypedef npy_ulonglong ulonglong_t # <<<<<<<<<<<<<< + * + * ctypedef npy_intp intp_t +*/ +typedef npy_ulonglong __pyx_t_5numpy_ulonglong_t; + +/* "C:/Users/runneradmin/AppData/Local/Temp/build-env-ej_q3m8u/Lib/site-packages/numpy/__init__.cython-30.pxd":764 + * ctypedef npy_ulonglong ulonglong_t + * + * ctypedef npy_intp intp_t # <<<<<<<<<<<<<< + * ctypedef npy_uintp uintp_t + * +*/ +typedef npy_intp __pyx_t_5numpy_intp_t; + +/* "C:/Users/runneradmin/AppData/Local/Temp/build-env-ej_q3m8u/Lib/site-packages/numpy/__init__.cython-30.pxd":765 + * + * ctypedef npy_intp intp_t + * ctypedef npy_uintp uintp_t # <<<<<<<<<<<<<< + * + * ctypedef npy_double float_t +*/ +typedef npy_uintp __pyx_t_5numpy_uintp_t; + +/* "C:/Users/runneradmin/AppData/Local/Temp/build-env-ej_q3m8u/Lib/site-packages/numpy/__init__.cython-30.pxd":767 + * ctypedef npy_uintp uintp_t + * + * ctypedef npy_double float_t # <<<<<<<<<<<<<< + * ctypedef npy_double double_t + * ctypedef npy_longdouble longdouble_t +*/ +typedef npy_double __pyx_t_5numpy_float_t; + +/* "C:/Users/runneradmin/AppData/Local/Temp/build-env-ej_q3m8u/Lib/site-packages/numpy/__init__.cython-30.pxd":768 + * + * ctypedef npy_double float_t + * ctypedef npy_double double_t # <<<<<<<<<<<<<< + * ctypedef npy_longdouble longdouble_t + * +*/ +typedef npy_double __pyx_t_5numpy_double_t; + +/* "C:/Users/runneradmin/AppData/Local/Temp/build-env-ej_q3m8u/Lib/site-packages/numpy/__init__.cython-30.pxd":769 + * ctypedef npy_double float_t + * ctypedef npy_double double_t + * ctypedef npy_longdouble longdouble_t # <<<<<<<<<<<<<< + * + * ctypedef float complex cfloat_t +*/ +typedef npy_longdouble __pyx_t_5numpy_longdouble_t; +/* #### Code section: complex_type_declarations ### */ +/* Declarations.proto */ +#if CYTHON_CCOMPLEX && (1) && (!0 || __cplusplus) + #ifdef __cplusplus + typedef ::std::complex< float > __pyx_t_float_complex; + #else + typedef float _Complex __pyx_t_float_complex; + #endif +#else + typedef struct { float real, imag; } __pyx_t_float_complex; +#endif +static CYTHON_INLINE __pyx_t_float_complex __pyx_t_float_complex_from_parts(float, float); + +/* Declarations.proto */ +#if CYTHON_CCOMPLEX && (1) && (!0 || __cplusplus) + #ifdef __cplusplus + typedef ::std::complex< double > __pyx_t_double_complex; + #else + typedef double _Complex __pyx_t_double_complex; + #endif +#else + typedef struct { double real, imag; } __pyx_t_double_complex; +#endif +static CYTHON_INLINE __pyx_t_double_complex __pyx_t_double_complex_from_parts(double, double); + +/* Declarations.proto */ +#if CYTHON_CCOMPLEX && (1) && (!0 || __cplusplus) + #ifdef __cplusplus + typedef ::std::complex< long double > __pyx_t_long_double_complex; + #else + typedef long double _Complex __pyx_t_long_double_complex; + #endif +#else + typedef struct { long double real, imag; } __pyx_t_long_double_complex; +#endif +static CYTHON_INLINE __pyx_t_long_double_complex __pyx_t_long_double_complex_from_parts(long double, long double); + +/* #### Code section: type_declarations ### */ + +/*--- Type declarations ---*/ +struct __pyx_obj_5cymem_5cymem_PyMalloc; +struct __pyx_obj_5cymem_5cymem_PyFree; +struct __pyx_obj_5cymem_5cymem_Pool; +struct __pyx_obj_5cymem_5cymem_Address; +struct __pyx_obj_5thinc_5extra_6search_Beam; +struct __pyx_obj_5thinc_5extra_6search_MaxViolation; +struct __pyx_obj_7preshed_4maps_PreshMap; +struct __pyx_obj_7preshed_4maps_PreshMapArray; +struct __pyx_obj_5spacy_7strings_StringStore; +struct __pyx_obj_5spacy_10morphology_Morphology; +struct __pyx_obj_5spacy_5vocab_Vocab; +struct __pyx_obj_5spacy_6tokens_3doc_Doc; +struct __pyx_obj_5spacy_8training_7example_Example; +struct __pyx_obj_5spacy_6lexeme_Lexeme; +struct __pyx_obj_5spacy_8pipeline_17_parser_internals_10stateclass_StateClass; +struct __pyx_obj_5spacy_8pipeline_17_parser_internals_17transition_system_TransitionSystem; +struct __pyx_obj_5spacy_8pipeline_17_parser_internals_11_beam_utils_BeamBatch; +struct __pyx_obj_5spacy_8pipeline_17_parser_internals_11_beam_utils___pyx_scope_struct__genexpr; +struct __pyx_array_obj; +struct __pyx_MemviewEnum_obj; +struct __pyx_memoryview_obj; +struct __pyx_memoryviewslice_obj; + +/* "cymem/cymem.pxd":1 + * ctypedef void* (*malloc_t)(size_t n) # <<<<<<<<<<<<<< + * ctypedef void (*free_t)(void *p) + * +*/ +typedef void *(*__pyx_t_5cymem_5cymem_malloc_t)(size_t); + +/* "cymem/cymem.pxd":2 + * ctypedef void* (*malloc_t)(size_t n) + * ctypedef void (*free_t)(void *p) # <<<<<<<<<<<<<< + * + * cdef class PyMalloc: +*/ +typedef void (*__pyx_t_5cymem_5cymem_free_t)(void *); +struct __pyx_t_5thinc_5extra_6search__State; + +/* "thinc/extra/search.pxd":12 + * + * + * ctypedef pair[weight_t, size_t] Entry # <<<<<<<<<<<<<< + * ctypedef priority_queue[Entry] Queue + * +*/ +typedef std::pair<__pyx_t_5thinc_5extra_6search_weight_t,size_t> __pyx_t_5thinc_5extra_6search_Entry; + +/* "thinc/extra/search.pxd":13 + * + * ctypedef pair[weight_t, size_t] Entry + * ctypedef priority_queue[Entry] Queue # <<<<<<<<<<<<<< + * + * +*/ +typedef std::priority_queue<__pyx_t_5thinc_5extra_6search_Entry> __pyx_t_5thinc_5extra_6search_Queue; + +/* "thinc/extra/search.pxd":16 + * + * + * ctypedef int (*trans_func_t)(void* dest, void* src, class_t clas, void* x) except -1 # <<<<<<<<<<<<<< + * + * ctypedef void* (*init_func_t)(Pool mem, int n, void* extra_args) except NULL +*/ +typedef int (*__pyx_t_5thinc_5extra_6search_trans_func_t)(void *, void *, __pyx_t_5thinc_5extra_6search_class_t, void *); + +/* "thinc/extra/search.pxd":18 + * ctypedef int (*trans_func_t)(void* dest, void* src, class_t clas, void* x) except -1 + * + * ctypedef void* (*init_func_t)(Pool mem, int n, void* extra_args) except NULL # <<<<<<<<<<<<<< + * + * ctypedef int (*del_func_t)(Pool mem, void* state, void* extra_args) except -1 +*/ +typedef void *(*__pyx_t_5thinc_5extra_6search_init_func_t)(struct __pyx_obj_5cymem_5cymem_Pool *, int, void *); + +/* "thinc/extra/search.pxd":20 + * ctypedef void* (*init_func_t)(Pool mem, int n, void* extra_args) except NULL + * + * ctypedef int (*del_func_t)(Pool mem, void* state, void* extra_args) except -1 # <<<<<<<<<<<<<< + * + * ctypedef int (*finish_func_t)(void* state, void* extra_args) except -1 +*/ +typedef int (*__pyx_t_5thinc_5extra_6search_del_func_t)(struct __pyx_obj_5cymem_5cymem_Pool *, void *, void *); + +/* "thinc/extra/search.pxd":22 + * ctypedef int (*del_func_t)(Pool mem, void* state, void* extra_args) except -1 + * + * ctypedef int (*finish_func_t)(void* state, void* extra_args) except -1 # <<<<<<<<<<<<<< + * + * ctypedef hash_t (*hash_func_t)(void* state, void* x) except 0 +*/ +typedef int (*__pyx_t_5thinc_5extra_6search_finish_func_t)(void *, void *); + +/* "thinc/extra/search.pxd":24 + * ctypedef int (*finish_func_t)(void* state, void* extra_args) except -1 + * + * ctypedef hash_t (*hash_func_t)(void* state, void* x) except 0 # <<<<<<<<<<<<<< + * + * +*/ +typedef __pyx_t_5thinc_5extra_6search_hash_t (*__pyx_t_5thinc_5extra_6search_hash_func_t)(void *, void *); + +/* "thinc/extra/search.pxd":27 + * + * + * cdef struct _State: # <<<<<<<<<<<<<< + * void* content + * class_t* hist +*/ +struct __pyx_t_5thinc_5extra_6search__State { + void *content; + __pyx_t_5thinc_5extra_6search_class_t *hist; + __pyx_t_5thinc_5extra_6search_weight_t score; + __pyx_t_5thinc_5extra_6search_weight_t loss; + int i; + int t; + int is_done; +}; +struct __pyx_t_7preshed_4maps_Cell; +struct __pyx_t_7preshed_4maps_Result; +struct __pyx_t_7preshed_4maps_MapStruct; + +/* "preshed/maps.pxd":8 + * + * + * cdef struct Cell: # <<<<<<<<<<<<<< + * key_t key + * void* value +*/ +struct __pyx_t_7preshed_4maps_Cell { + __pyx_t_7preshed_4maps_key_t key; + void *value; +}; + +/* "preshed/maps.pxd":13 + * + * + * cdef struct Result: # <<<<<<<<<<<<<< + * int found + * void* value +*/ +struct __pyx_t_7preshed_4maps_Result { + int found; + void *value; +}; + +/* "preshed/maps.pxd":18 + * + * + * cdef struct MapStruct: # <<<<<<<<<<<<<< + * Cell* cells + * void* value_for_empty_key +*/ +struct __pyx_t_7preshed_4maps_MapStruct { + struct __pyx_t_7preshed_4maps_Cell *cells; + void *value_for_empty_key; + void *value_for_del_key; + __pyx_t_7preshed_4maps_key_t length; + __pyx_t_7preshed_4maps_key_t filled; + int is_empty_key_set; + int is_del_key_set; +}; +union __pyx_t_5spacy_7strings_Utf8Str; +typedef union __pyx_t_5spacy_7strings_Utf8Str __pyx_t_5spacy_7strings_Utf8Str; + +/* "strings.pxd":17 + * + * + * ctypedef union Utf8Str: # <<<<<<<<<<<<<< + * unsigned char[8] s + * unsigned char* p +*/ +union __pyx_t_5spacy_7strings_Utf8Str { + unsigned char s[8]; + unsigned char *p; +}; + +/* "symbols.pxd":1 + * cdef enum symbol_t: # <<<<<<<<<<<<<< + * NIL + * IS_ALPHA +*/ +enum __pyx_t_5spacy_7symbols_symbol_t { + __pyx_e_5spacy_7symbols_NIL, + __pyx_e_5spacy_7symbols_IS_ALPHA, + __pyx_e_5spacy_7symbols_IS_ASCII, + __pyx_e_5spacy_7symbols_IS_DIGIT, + __pyx_e_5spacy_7symbols_IS_LOWER, + __pyx_e_5spacy_7symbols_IS_PUNCT, + __pyx_e_5spacy_7symbols_IS_SPACE, + __pyx_e_5spacy_7symbols_IS_TITLE, + __pyx_e_5spacy_7symbols_IS_UPPER, + __pyx_e_5spacy_7symbols_LIKE_URL, + __pyx_e_5spacy_7symbols_LIKE_NUM, + __pyx_e_5spacy_7symbols_LIKE_EMAIL, + __pyx_e_5spacy_7symbols_IS_STOP, + __pyx_e_5spacy_7symbols_IS_OOV_DEPRECATED, + __pyx_e_5spacy_7symbols_IS_BRACKET, + __pyx_e_5spacy_7symbols_IS_QUOTE, + __pyx_e_5spacy_7symbols_IS_LEFT_PUNCT, + __pyx_e_5spacy_7symbols_IS_RIGHT_PUNCT, + __pyx_e_5spacy_7symbols_IS_CURRENCY, + __pyx_e_5spacy_7symbols_FLAG19 = 19, + __pyx_e_5spacy_7symbols_FLAG20, + __pyx_e_5spacy_7symbols_FLAG21, + __pyx_e_5spacy_7symbols_FLAG22, + __pyx_e_5spacy_7symbols_FLAG23, + __pyx_e_5spacy_7symbols_FLAG24, + __pyx_e_5spacy_7symbols_FLAG25, + __pyx_e_5spacy_7symbols_FLAG26, + __pyx_e_5spacy_7symbols_FLAG27, + __pyx_e_5spacy_7symbols_FLAG28, + __pyx_e_5spacy_7symbols_FLAG29, + __pyx_e_5spacy_7symbols_FLAG30, + __pyx_e_5spacy_7symbols_FLAG31, + __pyx_e_5spacy_7symbols_FLAG32, + __pyx_e_5spacy_7symbols_FLAG33, + __pyx_e_5spacy_7symbols_FLAG34, + __pyx_e_5spacy_7symbols_FLAG35, + __pyx_e_5spacy_7symbols_FLAG36, + __pyx_e_5spacy_7symbols_FLAG37, + __pyx_e_5spacy_7symbols_FLAG38, + __pyx_e_5spacy_7symbols_FLAG39, + __pyx_e_5spacy_7symbols_FLAG40, + __pyx_e_5spacy_7symbols_FLAG41, + __pyx_e_5spacy_7symbols_FLAG42, + __pyx_e_5spacy_7symbols_FLAG43, + __pyx_e_5spacy_7symbols_FLAG44, + __pyx_e_5spacy_7symbols_FLAG45, + __pyx_e_5spacy_7symbols_FLAG46, + __pyx_e_5spacy_7symbols_FLAG47, + __pyx_e_5spacy_7symbols_FLAG48, + __pyx_e_5spacy_7symbols_FLAG49, + __pyx_e_5spacy_7symbols_FLAG50, + __pyx_e_5spacy_7symbols_FLAG51, + __pyx_e_5spacy_7symbols_FLAG52, + __pyx_e_5spacy_7symbols_FLAG53, + __pyx_e_5spacy_7symbols_FLAG54, + __pyx_e_5spacy_7symbols_FLAG55, + __pyx_e_5spacy_7symbols_FLAG56, + __pyx_e_5spacy_7symbols_FLAG57, + __pyx_e_5spacy_7symbols_FLAG58, + __pyx_e_5spacy_7symbols_FLAG59, + __pyx_e_5spacy_7symbols_FLAG60, + __pyx_e_5spacy_7symbols_FLAG61, + __pyx_e_5spacy_7symbols_FLAG62, + __pyx_e_5spacy_7symbols_FLAG63, + __pyx_e_5spacy_7symbols_ID, + __pyx_e_5spacy_7symbols_ORTH, + __pyx_e_5spacy_7symbols_LOWER, + __pyx_e_5spacy_7symbols_NORM, + __pyx_e_5spacy_7symbols_SHAPE, + __pyx_e_5spacy_7symbols_PREFIX, + __pyx_e_5spacy_7symbols_SUFFIX, + __pyx_e_5spacy_7symbols_LENGTH, + __pyx_e_5spacy_7symbols_CLUSTER, + __pyx_e_5spacy_7symbols_LEMMA, + __pyx_e_5spacy_7symbols_POS, + __pyx_e_5spacy_7symbols_TAG, + __pyx_e_5spacy_7symbols_DEP, + __pyx_e_5spacy_7symbols_ENT_IOB, + __pyx_e_5spacy_7symbols_ENT_TYPE, + __pyx_e_5spacy_7symbols_HEAD, + __pyx_e_5spacy_7symbols_SENT_START, + __pyx_e_5spacy_7symbols_SPACY, + __pyx_e_5spacy_7symbols_PROB, + __pyx_e_5spacy_7symbols_LANG, + __pyx_e_5spacy_7symbols_ADJ, + __pyx_e_5spacy_7symbols_ADP, + __pyx_e_5spacy_7symbols_ADV, + __pyx_e_5spacy_7symbols_AUX, + __pyx_e_5spacy_7symbols_CONJ, + __pyx_e_5spacy_7symbols_CCONJ, + __pyx_e_5spacy_7symbols_DET, + __pyx_e_5spacy_7symbols_INTJ, + __pyx_e_5spacy_7symbols_NOUN, + __pyx_e_5spacy_7symbols_NUM, + __pyx_e_5spacy_7symbols_PART, + __pyx_e_5spacy_7symbols_PRON, + __pyx_e_5spacy_7symbols_PROPN, + __pyx_e_5spacy_7symbols_PUNCT, + __pyx_e_5spacy_7symbols_SCONJ, + __pyx_e_5spacy_7symbols_SYM, + __pyx_e_5spacy_7symbols_VERB, + __pyx_e_5spacy_7symbols_X, + __pyx_e_5spacy_7symbols_EOL, + __pyx_e_5spacy_7symbols_SPACE, + __pyx_e_5spacy_7symbols_DEPRECATED001, + __pyx_e_5spacy_7symbols_DEPRECATED002, + __pyx_e_5spacy_7symbols_DEPRECATED003, + __pyx_e_5spacy_7symbols_DEPRECATED004, + __pyx_e_5spacy_7symbols_DEPRECATED005, + __pyx_e_5spacy_7symbols_DEPRECATED006, + __pyx_e_5spacy_7symbols_DEPRECATED007, + __pyx_e_5spacy_7symbols_DEPRECATED008, + __pyx_e_5spacy_7symbols_DEPRECATED009, + __pyx_e_5spacy_7symbols_DEPRECATED010, + __pyx_e_5spacy_7symbols_DEPRECATED011, + __pyx_e_5spacy_7symbols_DEPRECATED012, + __pyx_e_5spacy_7symbols_DEPRECATED013, + __pyx_e_5spacy_7symbols_DEPRECATED014, + __pyx_e_5spacy_7symbols_DEPRECATED015, + __pyx_e_5spacy_7symbols_DEPRECATED016, + __pyx_e_5spacy_7symbols_DEPRECATED017, + __pyx_e_5spacy_7symbols_DEPRECATED018, + __pyx_e_5spacy_7symbols_DEPRECATED019, + __pyx_e_5spacy_7symbols_DEPRECATED020, + __pyx_e_5spacy_7symbols_DEPRECATED021, + __pyx_e_5spacy_7symbols_DEPRECATED022, + __pyx_e_5spacy_7symbols_DEPRECATED023, + __pyx_e_5spacy_7symbols_DEPRECATED024, + __pyx_e_5spacy_7symbols_DEPRECATED025, + __pyx_e_5spacy_7symbols_DEPRECATED026, + __pyx_e_5spacy_7symbols_DEPRECATED027, + __pyx_e_5spacy_7symbols_DEPRECATED028, + __pyx_e_5spacy_7symbols_DEPRECATED029, + __pyx_e_5spacy_7symbols_DEPRECATED030, + __pyx_e_5spacy_7symbols_DEPRECATED031, + __pyx_e_5spacy_7symbols_DEPRECATED032, + __pyx_e_5spacy_7symbols_DEPRECATED033, + __pyx_e_5spacy_7symbols_DEPRECATED034, + __pyx_e_5spacy_7symbols_DEPRECATED035, + __pyx_e_5spacy_7symbols_DEPRECATED036, + __pyx_e_5spacy_7symbols_DEPRECATED037, + __pyx_e_5spacy_7symbols_DEPRECATED038, + __pyx_e_5spacy_7symbols_DEPRECATED039, + __pyx_e_5spacy_7symbols_DEPRECATED040, + __pyx_e_5spacy_7symbols_DEPRECATED041, + __pyx_e_5spacy_7symbols_DEPRECATED042, + __pyx_e_5spacy_7symbols_DEPRECATED043, + __pyx_e_5spacy_7symbols_DEPRECATED044, + __pyx_e_5spacy_7symbols_DEPRECATED045, + __pyx_e_5spacy_7symbols_DEPRECATED046, + __pyx_e_5spacy_7symbols_DEPRECATED047, + __pyx_e_5spacy_7symbols_DEPRECATED048, + __pyx_e_5spacy_7symbols_DEPRECATED049, + __pyx_e_5spacy_7symbols_DEPRECATED050, + __pyx_e_5spacy_7symbols_DEPRECATED051, + __pyx_e_5spacy_7symbols_DEPRECATED052, + __pyx_e_5spacy_7symbols_DEPRECATED053, + __pyx_e_5spacy_7symbols_DEPRECATED054, + __pyx_e_5spacy_7symbols_DEPRECATED055, + __pyx_e_5spacy_7symbols_DEPRECATED056, + __pyx_e_5spacy_7symbols_DEPRECATED057, + __pyx_e_5spacy_7symbols_DEPRECATED058, + __pyx_e_5spacy_7symbols_DEPRECATED059, + __pyx_e_5spacy_7symbols_DEPRECATED060, + __pyx_e_5spacy_7symbols_DEPRECATED061, + __pyx_e_5spacy_7symbols_DEPRECATED062, + __pyx_e_5spacy_7symbols_DEPRECATED063, + __pyx_e_5spacy_7symbols_DEPRECATED064, + __pyx_e_5spacy_7symbols_DEPRECATED065, + __pyx_e_5spacy_7symbols_DEPRECATED066, + __pyx_e_5spacy_7symbols_DEPRECATED067, + __pyx_e_5spacy_7symbols_DEPRECATED068, + __pyx_e_5spacy_7symbols_DEPRECATED069, + __pyx_e_5spacy_7symbols_DEPRECATED070, + __pyx_e_5spacy_7symbols_DEPRECATED071, + __pyx_e_5spacy_7symbols_DEPRECATED072, + __pyx_e_5spacy_7symbols_DEPRECATED073, + __pyx_e_5spacy_7symbols_DEPRECATED074, + __pyx_e_5spacy_7symbols_DEPRECATED075, + __pyx_e_5spacy_7symbols_DEPRECATED076, + __pyx_e_5spacy_7symbols_DEPRECATED077, + __pyx_e_5spacy_7symbols_DEPRECATED078, + __pyx_e_5spacy_7symbols_DEPRECATED079, + __pyx_e_5spacy_7symbols_DEPRECATED080, + __pyx_e_5spacy_7symbols_DEPRECATED081, + __pyx_e_5spacy_7symbols_DEPRECATED082, + __pyx_e_5spacy_7symbols_DEPRECATED083, + __pyx_e_5spacy_7symbols_DEPRECATED084, + __pyx_e_5spacy_7symbols_DEPRECATED085, + __pyx_e_5spacy_7symbols_DEPRECATED086, + __pyx_e_5spacy_7symbols_DEPRECATED087, + __pyx_e_5spacy_7symbols_DEPRECATED088, + __pyx_e_5spacy_7symbols_DEPRECATED089, + __pyx_e_5spacy_7symbols_DEPRECATED090, + __pyx_e_5spacy_7symbols_DEPRECATED091, + __pyx_e_5spacy_7symbols_DEPRECATED092, + __pyx_e_5spacy_7symbols_DEPRECATED093, + __pyx_e_5spacy_7symbols_DEPRECATED094, + __pyx_e_5spacy_7symbols_DEPRECATED095, + __pyx_e_5spacy_7symbols_DEPRECATED096, + __pyx_e_5spacy_7symbols_DEPRECATED097, + __pyx_e_5spacy_7symbols_DEPRECATED098, + __pyx_e_5spacy_7symbols_DEPRECATED099, + __pyx_e_5spacy_7symbols_DEPRECATED100, + __pyx_e_5spacy_7symbols_DEPRECATED101, + __pyx_e_5spacy_7symbols_DEPRECATED102, + __pyx_e_5spacy_7symbols_DEPRECATED103, + __pyx_e_5spacy_7symbols_DEPRECATED104, + __pyx_e_5spacy_7symbols_DEPRECATED105, + __pyx_e_5spacy_7symbols_DEPRECATED106, + __pyx_e_5spacy_7symbols_DEPRECATED107, + __pyx_e_5spacy_7symbols_DEPRECATED108, + __pyx_e_5spacy_7symbols_DEPRECATED109, + __pyx_e_5spacy_7symbols_DEPRECATED110, + __pyx_e_5spacy_7symbols_DEPRECATED111, + __pyx_e_5spacy_7symbols_DEPRECATED112, + __pyx_e_5spacy_7symbols_DEPRECATED113, + __pyx_e_5spacy_7symbols_DEPRECATED114, + __pyx_e_5spacy_7symbols_DEPRECATED115, + __pyx_e_5spacy_7symbols_DEPRECATED116, + __pyx_e_5spacy_7symbols_DEPRECATED117, + __pyx_e_5spacy_7symbols_DEPRECATED118, + __pyx_e_5spacy_7symbols_DEPRECATED119, + __pyx_e_5spacy_7symbols_DEPRECATED120, + __pyx_e_5spacy_7symbols_DEPRECATED121, + __pyx_e_5spacy_7symbols_DEPRECATED122, + __pyx_e_5spacy_7symbols_DEPRECATED123, + __pyx_e_5spacy_7symbols_DEPRECATED124, + __pyx_e_5spacy_7symbols_DEPRECATED125, + __pyx_e_5spacy_7symbols_DEPRECATED126, + __pyx_e_5spacy_7symbols_DEPRECATED127, + __pyx_e_5spacy_7symbols_DEPRECATED128, + __pyx_e_5spacy_7symbols_DEPRECATED129, + __pyx_e_5spacy_7symbols_DEPRECATED130, + __pyx_e_5spacy_7symbols_DEPRECATED131, + __pyx_e_5spacy_7symbols_DEPRECATED132, + __pyx_e_5spacy_7symbols_DEPRECATED133, + __pyx_e_5spacy_7symbols_DEPRECATED134, + __pyx_e_5spacy_7symbols_DEPRECATED135, + __pyx_e_5spacy_7symbols_DEPRECATED136, + __pyx_e_5spacy_7symbols_DEPRECATED137, + __pyx_e_5spacy_7symbols_DEPRECATED138, + __pyx_e_5spacy_7symbols_DEPRECATED139, + __pyx_e_5spacy_7symbols_DEPRECATED140, + __pyx_e_5spacy_7symbols_DEPRECATED141, + __pyx_e_5spacy_7symbols_DEPRECATED142, + __pyx_e_5spacy_7symbols_DEPRECATED143, + __pyx_e_5spacy_7symbols_DEPRECATED144, + __pyx_e_5spacy_7symbols_DEPRECATED145, + __pyx_e_5spacy_7symbols_DEPRECATED146, + __pyx_e_5spacy_7symbols_DEPRECATED147, + __pyx_e_5spacy_7symbols_DEPRECATED148, + __pyx_e_5spacy_7symbols_DEPRECATED149, + __pyx_e_5spacy_7symbols_DEPRECATED150, + __pyx_e_5spacy_7symbols_DEPRECATED151, + __pyx_e_5spacy_7symbols_DEPRECATED152, + __pyx_e_5spacy_7symbols_DEPRECATED153, + __pyx_e_5spacy_7symbols_DEPRECATED154, + __pyx_e_5spacy_7symbols_DEPRECATED155, + __pyx_e_5spacy_7symbols_DEPRECATED156, + __pyx_e_5spacy_7symbols_DEPRECATED157, + __pyx_e_5spacy_7symbols_DEPRECATED158, + __pyx_e_5spacy_7symbols_DEPRECATED159, + __pyx_e_5spacy_7symbols_DEPRECATED160, + __pyx_e_5spacy_7symbols_DEPRECATED161, + __pyx_e_5spacy_7symbols_DEPRECATED162, + __pyx_e_5spacy_7symbols_DEPRECATED163, + __pyx_e_5spacy_7symbols_DEPRECATED164, + __pyx_e_5spacy_7symbols_DEPRECATED165, + __pyx_e_5spacy_7symbols_DEPRECATED166, + __pyx_e_5spacy_7symbols_DEPRECATED167, + __pyx_e_5spacy_7symbols_DEPRECATED168, + __pyx_e_5spacy_7symbols_DEPRECATED169, + __pyx_e_5spacy_7symbols_DEPRECATED170, + __pyx_e_5spacy_7symbols_DEPRECATED171, + __pyx_e_5spacy_7symbols_DEPRECATED172, + __pyx_e_5spacy_7symbols_DEPRECATED173, + __pyx_e_5spacy_7symbols_DEPRECATED174, + __pyx_e_5spacy_7symbols_DEPRECATED175, + __pyx_e_5spacy_7symbols_DEPRECATED176, + __pyx_e_5spacy_7symbols_DEPRECATED177, + __pyx_e_5spacy_7symbols_DEPRECATED178, + __pyx_e_5spacy_7symbols_DEPRECATED179, + __pyx_e_5spacy_7symbols_DEPRECATED180, + __pyx_e_5spacy_7symbols_DEPRECATED181, + __pyx_e_5spacy_7symbols_DEPRECATED182, + __pyx_e_5spacy_7symbols_DEPRECATED183, + __pyx_e_5spacy_7symbols_DEPRECATED184, + __pyx_e_5spacy_7symbols_DEPRECATED185, + __pyx_e_5spacy_7symbols_DEPRECATED186, + __pyx_e_5spacy_7symbols_DEPRECATED187, + __pyx_e_5spacy_7symbols_DEPRECATED188, + __pyx_e_5spacy_7symbols_DEPRECATED189, + __pyx_e_5spacy_7symbols_DEPRECATED190, + __pyx_e_5spacy_7symbols_DEPRECATED191, + __pyx_e_5spacy_7symbols_DEPRECATED192, + __pyx_e_5spacy_7symbols_DEPRECATED193, + __pyx_e_5spacy_7symbols_DEPRECATED194, + __pyx_e_5spacy_7symbols_DEPRECATED195, + __pyx_e_5spacy_7symbols_DEPRECATED196, + __pyx_e_5spacy_7symbols_DEPRECATED197, + __pyx_e_5spacy_7symbols_DEPRECATED198, + __pyx_e_5spacy_7symbols_DEPRECATED199, + __pyx_e_5spacy_7symbols_DEPRECATED200, + __pyx_e_5spacy_7symbols_DEPRECATED201, + __pyx_e_5spacy_7symbols_DEPRECATED202, + __pyx_e_5spacy_7symbols_DEPRECATED203, + __pyx_e_5spacy_7symbols_DEPRECATED204, + __pyx_e_5spacy_7symbols_DEPRECATED205, + __pyx_e_5spacy_7symbols_DEPRECATED206, + __pyx_e_5spacy_7symbols_DEPRECATED207, + __pyx_e_5spacy_7symbols_DEPRECATED208, + __pyx_e_5spacy_7symbols_DEPRECATED209, + __pyx_e_5spacy_7symbols_DEPRECATED210, + __pyx_e_5spacy_7symbols_DEPRECATED211, + __pyx_e_5spacy_7symbols_DEPRECATED212, + __pyx_e_5spacy_7symbols_DEPRECATED213, + __pyx_e_5spacy_7symbols_DEPRECATED214, + __pyx_e_5spacy_7symbols_DEPRECATED215, + __pyx_e_5spacy_7symbols_DEPRECATED216, + __pyx_e_5spacy_7symbols_DEPRECATED217, + __pyx_e_5spacy_7symbols_DEPRECATED218, + __pyx_e_5spacy_7symbols_DEPRECATED219, + __pyx_e_5spacy_7symbols_DEPRECATED220, + __pyx_e_5spacy_7symbols_DEPRECATED221, + __pyx_e_5spacy_7symbols_DEPRECATED222, + __pyx_e_5spacy_7symbols_DEPRECATED223, + __pyx_e_5spacy_7symbols_DEPRECATED224, + __pyx_e_5spacy_7symbols_DEPRECATED225, + __pyx_e_5spacy_7symbols_DEPRECATED226, + __pyx_e_5spacy_7symbols_DEPRECATED227, + __pyx_e_5spacy_7symbols_DEPRECATED228, + __pyx_e_5spacy_7symbols_DEPRECATED229, + __pyx_e_5spacy_7symbols_DEPRECATED230, + __pyx_e_5spacy_7symbols_DEPRECATED231, + __pyx_e_5spacy_7symbols_DEPRECATED232, + __pyx_e_5spacy_7symbols_DEPRECATED233, + __pyx_e_5spacy_7symbols_DEPRECATED234, + __pyx_e_5spacy_7symbols_DEPRECATED235, + __pyx_e_5spacy_7symbols_DEPRECATED236, + __pyx_e_5spacy_7symbols_DEPRECATED237, + __pyx_e_5spacy_7symbols_DEPRECATED238, + __pyx_e_5spacy_7symbols_DEPRECATED239, + __pyx_e_5spacy_7symbols_DEPRECATED240, + __pyx_e_5spacy_7symbols_DEPRECATED241, + __pyx_e_5spacy_7symbols_DEPRECATED242, + __pyx_e_5spacy_7symbols_DEPRECATED243, + __pyx_e_5spacy_7symbols_DEPRECATED244, + __pyx_e_5spacy_7symbols_DEPRECATED245, + __pyx_e_5spacy_7symbols_DEPRECATED246, + __pyx_e_5spacy_7symbols_DEPRECATED247, + __pyx_e_5spacy_7symbols_DEPRECATED248, + __pyx_e_5spacy_7symbols_DEPRECATED249, + __pyx_e_5spacy_7symbols_DEPRECATED250, + __pyx_e_5spacy_7symbols_DEPRECATED251, + __pyx_e_5spacy_7symbols_DEPRECATED252, + __pyx_e_5spacy_7symbols_DEPRECATED253, + __pyx_e_5spacy_7symbols_DEPRECATED254, + __pyx_e_5spacy_7symbols_DEPRECATED255, + __pyx_e_5spacy_7symbols_DEPRECATED256, + __pyx_e_5spacy_7symbols_DEPRECATED257, + __pyx_e_5spacy_7symbols_DEPRECATED258, + __pyx_e_5spacy_7symbols_DEPRECATED259, + __pyx_e_5spacy_7symbols_DEPRECATED260, + __pyx_e_5spacy_7symbols_DEPRECATED261, + __pyx_e_5spacy_7symbols_DEPRECATED262, + __pyx_e_5spacy_7symbols_DEPRECATED263, + __pyx_e_5spacy_7symbols_DEPRECATED264, + __pyx_e_5spacy_7symbols_DEPRECATED265, + __pyx_e_5spacy_7symbols_DEPRECATED266, + __pyx_e_5spacy_7symbols_DEPRECATED267, + __pyx_e_5spacy_7symbols_DEPRECATED268, + __pyx_e_5spacy_7symbols_DEPRECATED269, + __pyx_e_5spacy_7symbols_DEPRECATED270, + __pyx_e_5spacy_7symbols_DEPRECATED271, + __pyx_e_5spacy_7symbols_DEPRECATED272, + __pyx_e_5spacy_7symbols_DEPRECATED273, + __pyx_e_5spacy_7symbols_DEPRECATED274, + __pyx_e_5spacy_7symbols_DEPRECATED275, + __pyx_e_5spacy_7symbols_DEPRECATED276, + __pyx_e_5spacy_7symbols_PERSON, + __pyx_e_5spacy_7symbols_NORP, + __pyx_e_5spacy_7symbols_FACILITY, + __pyx_e_5spacy_7symbols_ORG, + __pyx_e_5spacy_7symbols_GPE, + __pyx_e_5spacy_7symbols_LOC, + __pyx_e_5spacy_7symbols_PRODUCT, + __pyx_e_5spacy_7symbols_EVENT, + __pyx_e_5spacy_7symbols_WORK_OF_ART, + __pyx_e_5spacy_7symbols_LANGUAGE, + __pyx_e_5spacy_7symbols_LAW, + __pyx_e_5spacy_7symbols_DATE, + __pyx_e_5spacy_7symbols_TIME, + __pyx_e_5spacy_7symbols_PERCENT, + __pyx_e_5spacy_7symbols_MONEY, + __pyx_e_5spacy_7symbols_QUANTITY, + __pyx_e_5spacy_7symbols_ORDINAL, + __pyx_e_5spacy_7symbols_CARDINAL, + __pyx_e_5spacy_7symbols_acomp, + __pyx_e_5spacy_7symbols_advcl, + __pyx_e_5spacy_7symbols_advmod, + __pyx_e_5spacy_7symbols_agent, + __pyx_e_5spacy_7symbols_amod, + __pyx_e_5spacy_7symbols_appos, + __pyx_e_5spacy_7symbols_attr, + __pyx_e_5spacy_7symbols_aux, + __pyx_e_5spacy_7symbols_auxpass, + __pyx_e_5spacy_7symbols_cc, + __pyx_e_5spacy_7symbols_ccomp, + __pyx_e_5spacy_7symbols_complm, + __pyx_e_5spacy_7symbols_conj, + __pyx_e_5spacy_7symbols_cop, + __pyx_e_5spacy_7symbols_csubj, + __pyx_e_5spacy_7symbols_csubjpass, + __pyx_e_5spacy_7symbols_dep, + __pyx_e_5spacy_7symbols_det, + __pyx_e_5spacy_7symbols_dobj, + __pyx_e_5spacy_7symbols_expl, + __pyx_e_5spacy_7symbols_hmod, + __pyx_e_5spacy_7symbols_hyph, + __pyx_e_5spacy_7symbols_infmod, + __pyx_e_5spacy_7symbols_intj, + __pyx_e_5spacy_7symbols_iobj, + __pyx_e_5spacy_7symbols_mark, + __pyx_e_5spacy_7symbols_meta, + __pyx_e_5spacy_7symbols_neg, + __pyx_e_5spacy_7symbols_nmod, + __pyx_e_5spacy_7symbols_nn, + __pyx_e_5spacy_7symbols_npadvmod, + __pyx_e_5spacy_7symbols_nsubj, + __pyx_e_5spacy_7symbols_nsubjpass, + __pyx_e_5spacy_7symbols_num, + __pyx_e_5spacy_7symbols_number, + __pyx_e_5spacy_7symbols_oprd, + __pyx_e_5spacy_7symbols_obj, + __pyx_e_5spacy_7symbols_obl, + __pyx_e_5spacy_7symbols_parataxis, + __pyx_e_5spacy_7symbols_partmod, + __pyx_e_5spacy_7symbols_pcomp, + __pyx_e_5spacy_7symbols_pobj, + __pyx_e_5spacy_7symbols_poss, + __pyx_e_5spacy_7symbols_possessive, + __pyx_e_5spacy_7symbols_preconj, + __pyx_e_5spacy_7symbols_prep, + __pyx_e_5spacy_7symbols_prt, + __pyx_e_5spacy_7symbols_punct, + __pyx_e_5spacy_7symbols_quantmod, + __pyx_e_5spacy_7symbols_relcl, + __pyx_e_5spacy_7symbols_rcmod, + __pyx_e_5spacy_7symbols_root, + __pyx_e_5spacy_7symbols_xcomp, + __pyx_e_5spacy_7symbols_acl, + __pyx_e_5spacy_7symbols_ENT_KB_ID, + __pyx_e_5spacy_7symbols_MORPH, + __pyx_e_5spacy_7symbols_ENT_ID, + __pyx_e_5spacy_7symbols_IDX, + __pyx_e_5spacy_7symbols__ +}; + +/* "parts_of_speech.pxd":4 + * + * + * cpdef enum univ_pos_t: # <<<<<<<<<<<<<< + * NO_TAG = 0 + * ADJ = symbols.ADJ +*/ +enum __pyx_t_5spacy_15parts_of_speech_univ_pos_t { + + /* "parts_of_speech.pxd":6 + * cpdef enum univ_pos_t: + * NO_TAG = 0 + * ADJ = symbols.ADJ # <<<<<<<<<<<<<< + * ADP + * ADV +*/ + __pyx_e_5spacy_15parts_of_speech_NO_TAG = 0, + __pyx_e_5spacy_15parts_of_speech_ADJ = __pyx_e_5spacy_7symbols_ADJ, + __pyx_e_5spacy_15parts_of_speech_ADP, + __pyx_e_5spacy_15parts_of_speech_ADV, + __pyx_e_5spacy_15parts_of_speech_AUX, + __pyx_e_5spacy_15parts_of_speech_CONJ, + __pyx_e_5spacy_15parts_of_speech_CCONJ, + __pyx_e_5spacy_15parts_of_speech_DET, + __pyx_e_5spacy_15parts_of_speech_INTJ, + __pyx_e_5spacy_15parts_of_speech_NOUN, + __pyx_e_5spacy_15parts_of_speech_NUM, + __pyx_e_5spacy_15parts_of_speech_PART, + __pyx_e_5spacy_15parts_of_speech_PRON, + __pyx_e_5spacy_15parts_of_speech_PROPN, + __pyx_e_5spacy_15parts_of_speech_PUNCT, + __pyx_e_5spacy_15parts_of_speech_SCONJ, + __pyx_e_5spacy_15parts_of_speech_SYM, + __pyx_e_5spacy_15parts_of_speech_VERB, + __pyx_e_5spacy_15parts_of_speech_X, + __pyx_e_5spacy_15parts_of_speech_EOL, + __pyx_e_5spacy_15parts_of_speech_SPACE +}; +struct __pyx_t_5spacy_7structs_LexemeC; +struct __pyx_t_5spacy_7structs_SpanC; +struct __pyx_t_5spacy_7structs_TokenC; +struct __pyx_t_5spacy_7structs_MorphAnalysisC; +struct __pyx_t_5spacy_7structs_KBEntryC; +struct __pyx_t_5spacy_7structs_AliasC; +struct __pyx_t_5spacy_7structs_EdgeC; +struct __pyx_t_5spacy_7structs_GraphC; + +/* "structs.pxd":10 + * + * + * cdef struct LexemeC: # <<<<<<<<<<<<<< + * flags_t flags + * +*/ +struct __pyx_t_5spacy_7structs_LexemeC { + __pyx_t_5spacy_8typedefs_flags_t flags; + __pyx_t_5spacy_8typedefs_attr_t lang; + __pyx_t_5spacy_8typedefs_attr_t id; + __pyx_t_5spacy_8typedefs_attr_t length; + __pyx_t_5spacy_8typedefs_attr_t orth; + __pyx_t_5spacy_8typedefs_attr_t lower; + __pyx_t_5spacy_8typedefs_attr_t norm; + __pyx_t_5spacy_8typedefs_attr_t shape; + __pyx_t_5spacy_8typedefs_attr_t prefix; + __pyx_t_5spacy_8typedefs_attr_t suffix; +}; + +/* "structs.pxd":26 + * + * + * cdef struct SpanC: # <<<<<<<<<<<<<< + * hash_t id + * int start +*/ +struct __pyx_t_5spacy_7structs_SpanC { + __pyx_t_5spacy_8typedefs_hash_t id; + int start; + int end; + int start_char; + int end_char; + __pyx_t_5spacy_8typedefs_attr_t label; + __pyx_t_5spacy_8typedefs_attr_t kb_id; +}; + +/* "structs.pxd":36 + * + * + * cdef struct TokenC: # <<<<<<<<<<<<<< + * const LexemeC* lex + * uint64_t morph +*/ +struct __pyx_t_5spacy_7structs_TokenC { + struct __pyx_t_5spacy_7structs_LexemeC const *lex; + uint64_t morph; + enum __pyx_t_5spacy_15parts_of_speech_univ_pos_t pos; + int spacy; + __pyx_t_5spacy_8typedefs_attr_t tag; + int idx; + __pyx_t_5spacy_8typedefs_attr_t lemma; + __pyx_t_5spacy_8typedefs_attr_t norm; + int head; + __pyx_t_5spacy_8typedefs_attr_t dep; + uint32_t l_kids; + uint32_t r_kids; + uint32_t l_edge; + uint32_t r_edge; + int sent_start; + int ent_iob; + __pyx_t_5spacy_8typedefs_attr_t ent_type; + __pyx_t_5spacy_8typedefs_attr_t ent_kb_id; + __pyx_t_5spacy_8typedefs_hash_t ent_id; +}; + +/* "structs.pxd":60 + * + * + * cdef struct MorphAnalysisC: # <<<<<<<<<<<<<< + * hash_t key + * int length +*/ +struct __pyx_t_5spacy_7structs_MorphAnalysisC { + __pyx_t_5spacy_8typedefs_hash_t key; + int length; + __pyx_t_5spacy_8typedefs_attr_t *fields; + __pyx_t_5spacy_8typedefs_attr_t *features; +}; + +/* "structs.pxd":69 + * + * # Internal struct, for storage and disambiguation of entities. + * cdef struct KBEntryC: # <<<<<<<<<<<<<< + * + * # The hash of this entry's unique ID/name in the kB +*/ +struct __pyx_t_5spacy_7structs_KBEntryC { + __pyx_t_5spacy_8typedefs_hash_t entity_hash; + int32_t vector_index; + int32_t feats_row; + float freq; +}; + +/* "structs.pxd":88 + * # Each alias struct stores a list of Entry pointers with their prior probabilities + * # for this specific mention/alias. + * cdef struct AliasC: # <<<<<<<<<<<<<< + * + * # All entry candidates for this alias +*/ +struct __pyx_t_5spacy_7structs_AliasC { + std::vector entry_indices; + std::vector probs; +}; + +/* "structs.pxd":97 + * + * + * cdef struct EdgeC: # <<<<<<<<<<<<<< + * hash_t label + * int32_t head +*/ +struct __pyx_t_5spacy_7structs_EdgeC { + __pyx_t_5spacy_8typedefs_hash_t label; + int32_t head; + int32_t tail; +}; + +/* "structs.pxd":103 + * + * + * cdef struct GraphC: # <<<<<<<<<<<<<< + * vector[vector[int32_t]] nodes + * vector[EdgeC] edges +*/ +struct __pyx_t_5spacy_7structs_GraphC { + std::vector > nodes; + std::vector edges; + std::vector weights; + std::vector n_heads; + std::vector n_tails; + std::vector first_head; + std::vector first_tail; + std::unordered_set *roots; + std::unordered_map<__pyx_t_5spacy_8typedefs_hash_t,int> *node_map; + std::unordered_map<__pyx_t_5spacy_8typedefs_hash_t,int> *edge_map; +}; + +/* "attrs.pxd":5 + * + * + * cdef enum attr_id_t: # <<<<<<<<<<<<<< + * NULL_ATTR + * IS_ALPHA +*/ +enum __pyx_t_5spacy_5attrs_attr_id_t { + + /* "attrs.pxd":96 + * ENT_KB_ID = symbols.ENT_KB_ID + * MORPH + * ENT_ID = symbols.ENT_ID # <<<<<<<<<<<<<< + * + * IDX +*/ + __pyx_e_5spacy_5attrs_NULL_ATTR, + __pyx_e_5spacy_5attrs_IS_ALPHA, + __pyx_e_5spacy_5attrs_IS_ASCII, + __pyx_e_5spacy_5attrs_IS_DIGIT, + __pyx_e_5spacy_5attrs_IS_LOWER, + __pyx_e_5spacy_5attrs_IS_PUNCT, + __pyx_e_5spacy_5attrs_IS_SPACE, + __pyx_e_5spacy_5attrs_IS_TITLE, + __pyx_e_5spacy_5attrs_IS_UPPER, + __pyx_e_5spacy_5attrs_LIKE_URL, + __pyx_e_5spacy_5attrs_LIKE_NUM, + __pyx_e_5spacy_5attrs_LIKE_EMAIL, + __pyx_e_5spacy_5attrs_IS_STOP, + __pyx_e_5spacy_5attrs_IS_OOV_DEPRECATED, + __pyx_e_5spacy_5attrs_IS_BRACKET, + __pyx_e_5spacy_5attrs_IS_QUOTE, + __pyx_e_5spacy_5attrs_IS_LEFT_PUNCT, + __pyx_e_5spacy_5attrs_IS_RIGHT_PUNCT, + __pyx_e_5spacy_5attrs_IS_CURRENCY, + __pyx_e_5spacy_5attrs_FLAG19 = 19, + __pyx_e_5spacy_5attrs_FLAG20, + __pyx_e_5spacy_5attrs_FLAG21, + __pyx_e_5spacy_5attrs_FLAG22, + __pyx_e_5spacy_5attrs_FLAG23, + __pyx_e_5spacy_5attrs_FLAG24, + __pyx_e_5spacy_5attrs_FLAG25, + __pyx_e_5spacy_5attrs_FLAG26, + __pyx_e_5spacy_5attrs_FLAG27, + __pyx_e_5spacy_5attrs_FLAG28, + __pyx_e_5spacy_5attrs_FLAG29, + __pyx_e_5spacy_5attrs_FLAG30, + __pyx_e_5spacy_5attrs_FLAG31, + __pyx_e_5spacy_5attrs_FLAG32, + __pyx_e_5spacy_5attrs_FLAG33, + __pyx_e_5spacy_5attrs_FLAG34, + __pyx_e_5spacy_5attrs_FLAG35, + __pyx_e_5spacy_5attrs_FLAG36, + __pyx_e_5spacy_5attrs_FLAG37, + __pyx_e_5spacy_5attrs_FLAG38, + __pyx_e_5spacy_5attrs_FLAG39, + __pyx_e_5spacy_5attrs_FLAG40, + __pyx_e_5spacy_5attrs_FLAG41, + __pyx_e_5spacy_5attrs_FLAG42, + __pyx_e_5spacy_5attrs_FLAG43, + __pyx_e_5spacy_5attrs_FLAG44, + __pyx_e_5spacy_5attrs_FLAG45, + __pyx_e_5spacy_5attrs_FLAG46, + __pyx_e_5spacy_5attrs_FLAG47, + __pyx_e_5spacy_5attrs_FLAG48, + __pyx_e_5spacy_5attrs_FLAG49, + __pyx_e_5spacy_5attrs_FLAG50, + __pyx_e_5spacy_5attrs_FLAG51, + __pyx_e_5spacy_5attrs_FLAG52, + __pyx_e_5spacy_5attrs_FLAG53, + __pyx_e_5spacy_5attrs_FLAG54, + __pyx_e_5spacy_5attrs_FLAG55, + __pyx_e_5spacy_5attrs_FLAG56, + __pyx_e_5spacy_5attrs_FLAG57, + __pyx_e_5spacy_5attrs_FLAG58, + __pyx_e_5spacy_5attrs_FLAG59, + __pyx_e_5spacy_5attrs_FLAG60, + __pyx_e_5spacy_5attrs_FLAG61, + __pyx_e_5spacy_5attrs_FLAG62, + __pyx_e_5spacy_5attrs_FLAG63, + __pyx_e_5spacy_5attrs_ID, + __pyx_e_5spacy_5attrs_ORTH, + __pyx_e_5spacy_5attrs_LOWER, + __pyx_e_5spacy_5attrs_NORM, + __pyx_e_5spacy_5attrs_SHAPE, + __pyx_e_5spacy_5attrs_PREFIX, + __pyx_e_5spacy_5attrs_SUFFIX, + __pyx_e_5spacy_5attrs_LENGTH, + __pyx_e_5spacy_5attrs_CLUSTER, + __pyx_e_5spacy_5attrs_LEMMA, + __pyx_e_5spacy_5attrs_POS, + __pyx_e_5spacy_5attrs_TAG, + __pyx_e_5spacy_5attrs_DEP, + __pyx_e_5spacy_5attrs_ENT_IOB, + __pyx_e_5spacy_5attrs_ENT_TYPE, + __pyx_e_5spacy_5attrs_HEAD, + __pyx_e_5spacy_5attrs_SENT_START, + __pyx_e_5spacy_5attrs_SPACY, + __pyx_e_5spacy_5attrs_PROB, + __pyx_e_5spacy_5attrs_LANG, + __pyx_e_5spacy_5attrs_ENT_KB_ID = __pyx_e_5spacy_7symbols_ENT_KB_ID, + __pyx_e_5spacy_5attrs_MORPH, + __pyx_e_5spacy_5attrs_ENT_ID = __pyx_e_5spacy_7symbols_ENT_ID, + __pyx_e_5spacy_5attrs_IDX, + __pyx_e_5spacy_5attrs_SENT_END +}; +union __pyx_t_5spacy_5vocab_LexemesOrTokens; +struct __pyx_t_5spacy_5vocab__Cached; + +/* "vocab.pxd":15 + * + * + * cdef union LexemesOrTokens: # <<<<<<<<<<<<<< + * const LexemeC* const* lexemes + * const TokenC* tokens +*/ +union __pyx_t_5spacy_5vocab_LexemesOrTokens { + struct __pyx_t_5spacy_7structs_LexemeC const *const *lexemes; + struct __pyx_t_5spacy_7structs_TokenC const *tokens; +}; + +/* "vocab.pxd":20 + * + * + * cdef struct _Cached: # <<<<<<<<<<<<<< + * LexemesOrTokens data + * bint is_lex +*/ +struct __pyx_t_5spacy_5vocab__Cached { + union __pyx_t_5spacy_5vocab_LexemesOrTokens data; + int is_lex; + int length; +}; + +/* "tokens/doc.pxd":14 + * + * + * ctypedef const LexemeC* const_Lexeme_ptr # <<<<<<<<<<<<<< + * ctypedef const TokenC* const_TokenC_ptr + * +*/ +typedef struct __pyx_t_5spacy_7structs_LexemeC const *__pyx_t_5spacy_6tokens_3doc_const_Lexeme_ptr; + +/* "tokens/doc.pxd":15 + * + * ctypedef const LexemeC* const_Lexeme_ptr + * ctypedef const TokenC* const_TokenC_ptr # <<<<<<<<<<<<<< + * + * ctypedef fused LexemeOrToken: +*/ +typedef struct __pyx_t_5spacy_7structs_TokenC const *__pyx_t_5spacy_6tokens_3doc_const_TokenC_ptr; +struct __pyx_t_5spacy_8pipeline_17_parser_internals_6_state_ArcC; +struct __pyx_t_5spacy_8pipeline_17_parser_internals_6_state_StateC; + +/* "_state.pxd":23 + * return Lexeme.c_check_flag(token.lex, IS_SPACE) + * + * cdef struct ArcC: # <<<<<<<<<<<<<< + * int head + * int child +*/ +struct __pyx_t_5spacy_8pipeline_17_parser_internals_6_state_ArcC { + int head; + int child; + __pyx_t_5spacy_8typedefs_attr_t label; +}; +struct __pyx_t_5spacy_8pipeline_17_parser_internals_6_state_StateC { + + /* "_state.pxd":29 + * + * + * cdef cppclass StateC: # <<<<<<<<<<<<<< + * int* _heads + * const TokenC* _sent +*/ + int *_heads; + struct __pyx_t_5spacy_7structs_TokenC const *_sent; + std::vector _stack; + std::vector _rebuffer; + std::vector _ents; + std::unordered_map > _left_arcs; + std::unordered_map > _right_arcs; + std::vector _unshiftable; + std::set _sent_starts; + struct __pyx_t_5spacy_7structs_TokenC _empty_token; + int length; + int offset; + int _b_i; + void __pyx_f___init__StateC(struct __pyx_t_5spacy_7structs_TokenC const *, int); + void __pyx_f___dealloc__StateC(void); + virtual void set_context_tokens(int *, int); + virtual int S(int) const; + virtual int B(int) const; + virtual struct __pyx_t_5spacy_7structs_TokenC const *B_(int) const; + virtual struct __pyx_t_5spacy_7structs_TokenC const *E_(int) const; + virtual struct __pyx_t_5spacy_7structs_TokenC const *safe_get(int) const; + virtual void map_get_arcs(std::unordered_map > const &, std::vector *) const; + virtual void get_arcs(std::vector *) const; + virtual int H(int) const; + virtual int E(int) const; + virtual int nth_child(std::unordered_map > const &, int, int) const; + virtual int L(int, int) const; + virtual int R(int, int) const; + virtual int empty(void) const; + virtual int eol(void) const; + virtual int is_final(void) const; + virtual int cannot_sent_start(int) const; + virtual int is_sent_start(int) const; + virtual void set_sent_start(int, int); + virtual int has_head(int) const; + virtual int l_edge(int) const; + virtual int r_edge(int) const; + virtual int n_arcs(std::unordered_map > const &, int) const; + virtual int n_L(int) const; + virtual int n_R(int) const; + virtual int stack_is_connected(void) const; + virtual int entity_is_open(void) const; + virtual int stack_depth(void) const; + virtual int buffer_length(void) const; + virtual void push(void); + virtual void pop(void); + virtual void force_final(void); + virtual void unshift(void); + virtual int is_unshiftable(int) const; + virtual void set_reshiftable(int); + virtual void add_arc(int, int, __pyx_t_5spacy_8typedefs_attr_t); + virtual void map_del_arc(std::unordered_map > *, int, int); + virtual void del_arc(int, int); + virtual struct __pyx_t_5spacy_7structs_SpanC get_ent(void) const; + virtual void open_ent(__pyx_t_5spacy_8typedefs_attr_t); + virtual void close_ent(void); + virtual void clone(__pyx_t_5spacy_8pipeline_17_parser_internals_6_state_StateC const *); + __pyx_t_5spacy_8pipeline_17_parser_internals_6_state_StateC(struct __pyx_t_5spacy_7structs_TokenC const *__pyx_v_sent, int __pyx_v_length) { + __pyx_f___init__StateC(__pyx_v_sent, __pyx_v_length); + } + virtual ~__pyx_t_5spacy_8pipeline_17_parser_internals_6_state_StateC() { + __pyx_f___dealloc__StateC(); + } +}; +struct __pyx_t_5spacy_8pipeline_17_parser_internals_17transition_system_Transition; + +/* "transition_system.pxd":11 + * + * + * cdef struct Transition: # <<<<<<<<<<<<<< + * int clas + * int move +*/ +struct __pyx_t_5spacy_8pipeline_17_parser_internals_17transition_system_Transition { + int clas; + int move; + __pyx_t_5spacy_8typedefs_attr_t label; + __pyx_t_5spacy_8typedefs_weight_t score; + int (*is_valid)(__pyx_t_5spacy_8pipeline_17_parser_internals_6_state_StateC const *, __pyx_t_5spacy_8typedefs_attr_t); + __pyx_t_5spacy_8typedefs_weight_t (*get_cost)(__pyx_t_5spacy_8pipeline_17_parser_internals_6_state_StateC const *, void const *, __pyx_t_5spacy_8typedefs_attr_t); + int (*__pyx_do)(__pyx_t_5spacy_8pipeline_17_parser_internals_6_state_StateC *, __pyx_t_5spacy_8typedefs_attr_t); +}; + +/* "transition_system.pxd":23 + * + * + * ctypedef weight_t (*get_cost_func_t)( # <<<<<<<<<<<<<< + * const StateC* state, const void* gold, attr_tlabel + * ) noexcept nogil +*/ +typedef __pyx_t_5spacy_8typedefs_weight_t (*__pyx_t_5spacy_8pipeline_17_parser_internals_17transition_system_get_cost_func_t)(__pyx_t_5spacy_8pipeline_17_parser_internals_6_state_StateC const *, void const *, PyObject *); + +/* "transition_system.pxd":26 + * const StateC* state, const void* gold, attr_tlabel + * ) noexcept nogil + * ctypedef weight_t (*move_cost_func_t)( # <<<<<<<<<<<<<< + * const StateC* state, const void* gold + * ) noexcept nogil +*/ +typedef __pyx_t_5spacy_8typedefs_weight_t (*__pyx_t_5spacy_8pipeline_17_parser_internals_17transition_system_move_cost_func_t)(__pyx_t_5spacy_8pipeline_17_parser_internals_6_state_StateC const *, void const *); + +/* "transition_system.pxd":29 + * const StateC* state, const void* gold + * ) noexcept nogil + * ctypedef weight_t (*label_cost_func_t)( # <<<<<<<<<<<<<< + * const StateC* state, const void* gold, attr_t label + * ) noexcept nogil +*/ +typedef __pyx_t_5spacy_8typedefs_weight_t (*__pyx_t_5spacy_8pipeline_17_parser_internals_17transition_system_label_cost_func_t)(__pyx_t_5spacy_8pipeline_17_parser_internals_6_state_StateC const *, void const *, __pyx_t_5spacy_8typedefs_attr_t); + +/* "transition_system.pxd":33 + * ) noexcept nogil + * + * ctypedef int (*do_func_t)(StateC* state, attr_t label) noexcept nogil # <<<<<<<<<<<<<< + * + * ctypedef void* (*init_state_t)(Pool mem, int length, void* tokens) except NULL +*/ +typedef int (*__pyx_t_5spacy_8pipeline_17_parser_internals_17transition_system_do_func_t)(__pyx_t_5spacy_8pipeline_17_parser_internals_6_state_StateC *, __pyx_t_5spacy_8typedefs_attr_t); + +/* "transition_system.pxd":35 + * ctypedef int (*do_func_t)(StateC* state, attr_t label) noexcept nogil + * + * ctypedef void* (*init_state_t)(Pool mem, int length, void* tokens) except NULL # <<<<<<<<<<<<<< + * + * ctypedef int (*del_state_t)(Pool mem, void* state, void* extra_args) except -1 +*/ +typedef void *(*__pyx_t_5spacy_8pipeline_17_parser_internals_17transition_system_init_state_t)(struct __pyx_obj_5cymem_5cymem_Pool *, int, void *); + +/* "transition_system.pxd":37 + * ctypedef void* (*init_state_t)(Pool mem, int length, void* tokens) except NULL + * + * ctypedef int (*del_state_t)(Pool mem, void* state, void* extra_args) except -1 # <<<<<<<<<<<<<< + * + * cdef class TransitionSystem: +*/ +typedef int (*__pyx_t_5spacy_8pipeline_17_parser_internals_17transition_system_del_state_t)(struct __pyx_obj_5cymem_5cymem_Pool *, void *, void *); + +/* "cymem/cymem.pxd":4 + * ctypedef void (*free_t)(void *p) + * + * cdef class PyMalloc: # <<<<<<<<<<<<<< + * cdef malloc_t malloc + * cdef void _set(self, malloc_t malloc) +*/ +struct __pyx_obj_5cymem_5cymem_PyMalloc { + PyObject_HEAD + struct __pyx_vtabstruct_5cymem_5cymem_PyMalloc *__pyx_vtab; + __pyx_t_5cymem_5cymem_malloc_t malloc; +}; + + +/* "cymem/cymem.pxd":10 + * cdef PyMalloc WrapMalloc(malloc_t malloc) + * + * cdef class PyFree: # <<<<<<<<<<<<<< + * cdef free_t free + * cdef void _set(self, free_t free) +*/ +struct __pyx_obj_5cymem_5cymem_PyFree { + PyObject_HEAD + struct __pyx_vtabstruct_5cymem_5cymem_PyFree *__pyx_vtab; + __pyx_t_5cymem_5cymem_free_t free; +}; + + +/* "cymem/cymem.pxd":16 + * cdef PyFree WrapFree(free_t free) + * + * cdef class Pool: # <<<<<<<<<<<<<< + * cdef readonly size_t size + * cdef readonly dict addresses +*/ +struct __pyx_obj_5cymem_5cymem_Pool { + PyObject_HEAD + struct __pyx_vtabstruct_5cymem_5cymem_Pool *__pyx_vtab; + size_t size; + PyObject *addresses; + PyObject *refs; + struct __pyx_obj_5cymem_5cymem_PyMalloc *pymalloc; + struct __pyx_obj_5cymem_5cymem_PyFree *pyfree; +}; + + +/* "cymem/cymem.pxd":28 + * + * + * cdef class Address: # <<<<<<<<<<<<<< + * cdef void* ptr + * cdef readonly PyMalloc pymalloc +*/ +struct __pyx_obj_5cymem_5cymem_Address { + PyObject_HEAD + void *ptr; + struct __pyx_obj_5cymem_5cymem_PyMalloc *pymalloc; + struct __pyx_obj_5cymem_5cymem_PyFree *pyfree; +}; + + +/* "thinc/extra/search.pxd":37 + * + * + * cdef class Beam: # <<<<<<<<<<<<<< + * cdef Pool mem + * cdef class_t nr_class +*/ +struct __pyx_obj_5thinc_5extra_6search_Beam { + PyObject_HEAD + struct __pyx_vtabstruct_5thinc_5extra_6search_Beam *__pyx_vtab; + struct __pyx_obj_5cymem_5cymem_Pool *mem; + __pyx_t_5thinc_5extra_6search_class_t nr_class; + __pyx_t_5thinc_5extra_6search_class_t width; + __pyx_t_5thinc_5extra_6search_class_t size; + __pyx_t_5thinc_5extra_6search_weight_t min_density; + int t; + int is_done; + PyObject *histories; + PyObject *_parent_histories; + __pyx_t_5thinc_5extra_6search_weight_t **scores; + int **is_valid; + __pyx_t_5thinc_5extra_6search_weight_t **costs; + struct __pyx_t_5thinc_5extra_6search__State *_parents; + struct __pyx_t_5thinc_5extra_6search__State *_states; + __pyx_t_5thinc_5extra_6search_del_func_t del_func; +}; + + +/* "thinc/extra/search.pxd":75 + * + * + * cdef class MaxViolation: # <<<<<<<<<<<<<< + * cdef Pool mem + * cdef weight_t cost +*/ +struct __pyx_obj_5thinc_5extra_6search_MaxViolation { + PyObject_HEAD + struct __pyx_vtabstruct_5thinc_5extra_6search_MaxViolation *__pyx_vtab; + struct __pyx_obj_5cymem_5cymem_Pool *mem; + __pyx_t_5thinc_5extra_6search_weight_t cost; + __pyx_t_5thinc_5extra_6search_weight_t delta; + __pyx_t_5thinc_5extra_6search_weight_t p_score; + __pyx_t_5thinc_5extra_6search_weight_t g_score; + double Z; + double gZ; + __pyx_t_5thinc_5extra_6search_class_t n; + PyObject *p_hist; + PyObject *g_hist; + PyObject *p_probs; + PyObject *g_probs; +}; + + +/* "preshed/maps.pxd":45 + * + * + * cdef class PreshMap: # <<<<<<<<<<<<<< + * cdef MapStruct* c_map + * cdef Pool mem +*/ +struct __pyx_obj_7preshed_4maps_PreshMap { + PyObject_HEAD + struct __pyx_vtabstruct_7preshed_4maps_PreshMap *__pyx_vtab; + struct __pyx_t_7preshed_4maps_MapStruct *c_map; + struct __pyx_obj_5cymem_5cymem_Pool *mem; +}; + + +/* "preshed/maps.pxd":53 + * + * + * cdef class PreshMapArray: # <<<<<<<<<<<<<< + * cdef Pool mem + * cdef MapStruct* maps +*/ +struct __pyx_obj_7preshed_4maps_PreshMapArray { + PyObject_HEAD + struct __pyx_vtabstruct_7preshed_4maps_PreshMapArray *__pyx_vtab; + struct __pyx_obj_5cymem_5cymem_Pool *mem; + struct __pyx_t_7preshed_4maps_MapStruct *maps; + size_t length; +}; + + +/* "strings.pxd":22 + * + * + * cdef class StringStore: # <<<<<<<<<<<<<< + * cdef Pool mem + * +*/ +struct __pyx_obj_5spacy_7strings_StringStore { + PyObject_HEAD + struct __pyx_vtabstruct_5spacy_7strings_StringStore *__pyx_vtab; + struct __pyx_obj_5cymem_5cymem_Pool *mem; + std::vector<__pyx_t_5spacy_8typedefs_hash_t> keys; + struct __pyx_obj_7preshed_4maps_PreshMap *_map; + std::vector<__pyx_t_5spacy_8typedefs_hash_t> _transient_keys; + struct __pyx_obj_5cymem_5cymem_Pool *_non_temp_mem; +}; + + +/* "morphology.pxd":11 + * + * + * cdef class Morphology: # <<<<<<<<<<<<<< + * cdef readonly Pool mem + * cdef readonly StringStore strings +*/ +struct __pyx_obj_5spacy_10morphology_Morphology { + PyObject_HEAD + struct __pyx_vtabstruct_5spacy_10morphology_Morphology *__pyx_vtab; + struct __pyx_obj_5cymem_5cymem_Pool *mem; + struct __pyx_obj_5spacy_7strings_StringStore *strings; + struct __pyx_obj_7preshed_4maps_PreshMap *tags; +}; + + +/* "vocab.pxd":26 + * + * + * cdef class Vocab: # <<<<<<<<<<<<<< + * cdef Pool mem + * cdef readonly StringStore strings +*/ +struct __pyx_obj_5spacy_5vocab_Vocab { + PyObject_HEAD + struct __pyx_vtabstruct_5spacy_5vocab_Vocab *__pyx_vtab; + struct __pyx_obj_5cymem_5cymem_Pool *mem; + struct __pyx_obj_5spacy_7strings_StringStore *strings; + struct __pyx_obj_5spacy_10morphology_Morphology *morphology; + PyObject *_vectors; + PyObject *_lookups; + PyObject *writing_system; + PyObject *get_noun_chunks; + int length; + PyObject *_unused_object; + PyObject *lex_attr_getters; + PyObject *cfg; + struct __pyx_obj_7preshed_4maps_PreshMap *_by_orth; + struct __pyx_obj_5cymem_5cymem_Pool *_non_temp_mem; + std::vector<__pyx_t_5spacy_8typedefs_attr_t> _transient_orths; +}; + + +/* "tokens/doc.pxd":37 + * + * + * cdef class Doc: # <<<<<<<<<<<<<< + * cdef readonly Pool mem + * cdef readonly Vocab vocab +*/ +struct __pyx_obj_5spacy_6tokens_3doc_Doc { + PyObject_HEAD + struct __pyx_vtabstruct_5spacy_6tokens_3doc_Doc *__pyx_vtab; + struct __pyx_obj_5cymem_5cymem_Pool *mem; + struct __pyx_obj_5spacy_5vocab_Vocab *vocab; + PyObject *_vector; + PyObject *_vector_norm; + PyObject *tensor; + PyObject *cats; + PyObject *user_data; + PyObject *spans; + struct __pyx_t_5spacy_7structs_TokenC *c; + float sentiment; + PyObject *user_hooks; + PyObject *user_token_hooks; + PyObject *user_span_hooks; + int has_unknown_spaces; + PyObject *_context; + int length; + int max_length; + PyObject *noun_chunks_iterator; + PyObject *__weakref__; +}; + + +/* "training/example.pxd":6 + * + * + * cdef class Example: # <<<<<<<<<<<<<< + * cdef readonly Doc x + * cdef readonly Doc y +*/ +struct __pyx_obj_5spacy_8training_7example_Example { + PyObject_HEAD + struct __pyx_obj_5spacy_6tokens_3doc_Doc *x; + struct __pyx_obj_5spacy_6tokens_3doc_Doc *y; + PyObject *_cached_alignment; + PyObject *_cached_words_x; + PyObject *_cached_words_y; + uint64_t _x_sig; + uint64_t _y_sig; +}; + + +/* "lexeme.pxd":24 + * cdef attr_t OOV_RANK + * + * cdef class Lexeme: # <<<<<<<<<<<<<< + * cdef LexemeC* c + * cdef readonly Vocab vocab +*/ +struct __pyx_obj_5spacy_6lexeme_Lexeme { + PyObject_HEAD + struct __pyx_vtabstruct_5spacy_6lexeme_Lexeme *__pyx_vtab; + struct __pyx_t_5spacy_7structs_LexemeC *c; + struct __pyx_obj_5spacy_5vocab_Vocab *vocab; + __pyx_t_5spacy_8typedefs_attr_t orth; +}; + + +/* "stateclass.pxd":9 + * + * + * cdef class StateClass: # <<<<<<<<<<<<<< + * cdef StateC* c + * cdef readonly Doc doc +*/ +struct __pyx_obj_5spacy_8pipeline_17_parser_internals_10stateclass_StateClass { + PyObject_HEAD + struct __pyx_vtabstruct_5spacy_8pipeline_17_parser_internals_10stateclass_StateClass *__pyx_vtab; + __pyx_t_5spacy_8pipeline_17_parser_internals_6_state_StateC *c; + struct __pyx_obj_5spacy_6tokens_3doc_Doc *doc; + int _borrowed; +}; + + +/* "transition_system.pxd":39 + * ctypedef int (*del_state_t)(Pool mem, void* state, void* extra_args) except -1 + * + * cdef class TransitionSystem: # <<<<<<<<<<<<<< + * cdef Pool mem + * cdef StringStore strings +*/ +struct __pyx_obj_5spacy_8pipeline_17_parser_internals_17transition_system_TransitionSystem { + PyObject_HEAD + struct __pyx_vtabstruct_5spacy_8pipeline_17_parser_internals_17transition_system_TransitionSystem *__pyx_vtab; + struct __pyx_obj_5cymem_5cymem_Pool *mem; + struct __pyx_obj_5spacy_7strings_StringStore *strings; + struct __pyx_t_5spacy_8pipeline_17_parser_internals_17transition_system_Transition *c; + int n_moves; + int _size; + __pyx_t_5spacy_8typedefs_attr_t root_label; + PyObject *freqs; + PyObject *labels; + PyObject *cfg; + __pyx_t_5spacy_8pipeline_17_parser_internals_17transition_system_init_state_t init_beam_state; + __pyx_t_5spacy_8pipeline_17_parser_internals_17transition_system_del_state_t del_beam_state; +}; + + +/* "spacy/pipeline/_parser_internals/_beam_utils.pyx":32 + * + * + * cdef class BeamBatch(object): # <<<<<<<<<<<<<< + * cdef public TransitionSystem moves + * cdef public object states +*/ +struct __pyx_obj_5spacy_8pipeline_17_parser_internals_11_beam_utils_BeamBatch { + PyObject_HEAD + struct __pyx_vtabstruct_5spacy_8pipeline_17_parser_internals_11_beam_utils_BeamBatch *__pyx_vtab; + struct __pyx_obj_5spacy_8pipeline_17_parser_internals_17transition_system_TransitionSystem *moves; + PyObject *states; + PyObject *docs; + PyObject *golds; + PyObject *beams; +}; + + +/* "spacy/pipeline/_parser_internals/_beam_utils.pyx":62 + * @property + * def is_done(self): + * return all(b.is_done for b in self.beams) # <<<<<<<<<<<<<< + * + * def __getitem__(self, i): +*/ +struct __pyx_obj_5spacy_8pipeline_17_parser_internals_11_beam_utils___pyx_scope_struct__genexpr { + PyObject_HEAD + PyObject *__pyx_genexpr_arg_0; + PyObject *__pyx_v_b; +}; + + +/* "View.MemoryView":110 + * + * + * @cython.collection_type("sequence") # <<<<<<<<<<<<<< + * @cname("__pyx_array") + * cdef class array: +*/ +struct __pyx_array_obj { + PyObject_HEAD + struct __pyx_vtabstruct_array *__pyx_vtab; + char *data; + Py_ssize_t len; + char *format; + int ndim; + Py_ssize_t *_shape; + Py_ssize_t *_strides; + Py_ssize_t itemsize; + PyObject *mode; + PyObject *_format; + void (*callback_free_data)(void *); + int free_data; + int dtype_is_object; +}; + + +/* "View.MemoryView":299 + * + * + * @cname('__pyx_MemviewEnum') # <<<<<<<<<<<<<< + * cdef class Enum(object): + * cdef object name +*/ +struct __pyx_MemviewEnum_obj { + PyObject_HEAD + PyObject *name; +}; + + +/* "View.MemoryView":334 + * + * + * @cname('__pyx_memoryview') # <<<<<<<<<<<<<< + * cdef class memoryview: + * +*/ +struct __pyx_memoryview_obj { + PyObject_HEAD + struct __pyx_vtabstruct_memoryview *__pyx_vtab; + PyObject *obj; + PyObject *_size; + void *_unused; + PyThread_type_lock lock; + __pyx_atomic_int_type acquisition_count; + Py_buffer view; + int flags; + int dtype_is_object; + __Pyx_TypeInfo const *typeinfo; +}; + + +/* "View.MemoryView":951 + * + * + * @cython.collection_type("sequence") # <<<<<<<<<<<<<< + * @cname('__pyx_memoryviewslice') + * cdef class _memoryviewslice(memoryview): +*/ +struct __pyx_memoryviewslice_obj { + struct __pyx_memoryview_obj __pyx_base; + __Pyx_memviewslice from_slice; + PyObject *from_object; + PyObject *(*to_object_func)(char *); + int (*to_dtype_func)(char *, PyObject *); +}; + + + +/* "cymem/cymem.pxd":4 + * ctypedef void (*free_t)(void *p) + * + * cdef class PyMalloc: # <<<<<<<<<<<<<< + * cdef malloc_t malloc + * cdef void _set(self, malloc_t malloc) +*/ + +struct __pyx_vtabstruct_5cymem_5cymem_PyMalloc { + void (*_set)(struct __pyx_obj_5cymem_5cymem_PyMalloc *, __pyx_t_5cymem_5cymem_malloc_t); +}; +static struct __pyx_vtabstruct_5cymem_5cymem_PyMalloc *__pyx_vtabptr_5cymem_5cymem_PyMalloc; + + +/* "cymem/cymem.pxd":10 + * cdef PyMalloc WrapMalloc(malloc_t malloc) + * + * cdef class PyFree: # <<<<<<<<<<<<<< + * cdef free_t free + * cdef void _set(self, free_t free) +*/ + +struct __pyx_vtabstruct_5cymem_5cymem_PyFree { + void (*_set)(struct __pyx_obj_5cymem_5cymem_PyFree *, __pyx_t_5cymem_5cymem_free_t); +}; +static struct __pyx_vtabstruct_5cymem_5cymem_PyFree *__pyx_vtabptr_5cymem_5cymem_PyFree; + + +/* "cymem/cymem.pxd":16 + * cdef PyFree WrapFree(free_t free) + * + * cdef class Pool: # <<<<<<<<<<<<<< + * cdef readonly size_t size + * cdef readonly dict addresses +*/ + +struct __pyx_vtabstruct_5cymem_5cymem_Pool { + void *(*alloc)(struct __pyx_obj_5cymem_5cymem_Pool *, size_t, size_t); + void (*free)(struct __pyx_obj_5cymem_5cymem_Pool *, void *); + void *(*realloc)(struct __pyx_obj_5cymem_5cymem_Pool *, void *, size_t); +}; +static struct __pyx_vtabstruct_5cymem_5cymem_Pool *__pyx_vtabptr_5cymem_5cymem_Pool; + + +/* "thinc/extra/search.pxd":37 + * + * + * cdef class Beam: # <<<<<<<<<<<<<< + * cdef Pool mem + * cdef class_t nr_class +*/ + +struct __pyx_vtabstruct_5thinc_5extra_6search_Beam { + int (*_fill)(struct __pyx_obj_5thinc_5extra_6search_Beam *, __pyx_t_5thinc_5extra_6search_Queue *, __pyx_t_5thinc_5extra_6search_weight_t **, int **); + void *(*at)(struct __pyx_obj_5thinc_5extra_6search_Beam *, int); + int (*initialize)(struct __pyx_obj_5thinc_5extra_6search_Beam *, __pyx_t_5thinc_5extra_6search_init_func_t, __pyx_t_5thinc_5extra_6search_del_func_t, int, void *); + int (*advance)(struct __pyx_obj_5thinc_5extra_6search_Beam *, __pyx_t_5thinc_5extra_6search_trans_func_t, __pyx_t_5thinc_5extra_6search_hash_func_t, void *); + int (*check_done)(struct __pyx_obj_5thinc_5extra_6search_Beam *, __pyx_t_5thinc_5extra_6search_finish_func_t, void *); + void (*set_cell)(struct __pyx_obj_5thinc_5extra_6search_Beam *, int, int, __pyx_t_5thinc_5extra_6search_weight_t, int, __pyx_t_5thinc_5extra_6search_weight_t); + int (*set_row)(struct __pyx_obj_5thinc_5extra_6search_Beam *, int, __pyx_t_5thinc_5extra_6search_weight_t const *, int const *, __pyx_t_5thinc_5extra_6search_weight_t const *); + int (*set_table)(struct __pyx_obj_5thinc_5extra_6search_Beam *, __pyx_t_5thinc_5extra_6search_weight_t **, int **, __pyx_t_5thinc_5extra_6search_weight_t **); +}; +static struct __pyx_vtabstruct_5thinc_5extra_6search_Beam *__pyx_vtabptr_5thinc_5extra_6search_Beam; +static CYTHON_INLINE void *__pyx_f_5thinc_5extra_6search_4Beam_at(struct __pyx_obj_5thinc_5extra_6search_Beam *, int); +static CYTHON_INLINE void __pyx_f_5thinc_5extra_6search_4Beam_set_cell(struct __pyx_obj_5thinc_5extra_6search_Beam *, int, int, __pyx_t_5thinc_5extra_6search_weight_t, int, __pyx_t_5thinc_5extra_6search_weight_t); + + +/* "thinc/extra/search.pxd":75 + * + * + * cdef class MaxViolation: # <<<<<<<<<<<<<< + * cdef Pool mem + * cdef weight_t cost +*/ + +struct __pyx_vtabstruct_5thinc_5extra_6search_MaxViolation { + int (*check)(struct __pyx_obj_5thinc_5extra_6search_MaxViolation *, struct __pyx_obj_5thinc_5extra_6search_Beam *, struct __pyx_obj_5thinc_5extra_6search_Beam *, int __pyx_skip_dispatch); + int (*check_crf)(struct __pyx_obj_5thinc_5extra_6search_MaxViolation *, struct __pyx_obj_5thinc_5extra_6search_Beam *, struct __pyx_obj_5thinc_5extra_6search_Beam *, int __pyx_skip_dispatch); +}; +static struct __pyx_vtabstruct_5thinc_5extra_6search_MaxViolation *__pyx_vtabptr_5thinc_5extra_6search_MaxViolation; + + +/* "preshed/maps.pxd":45 + * + * + * cdef class PreshMap: # <<<<<<<<<<<<<< + * cdef MapStruct* c_map + * cdef Pool mem +*/ + +struct __pyx_vtabstruct_7preshed_4maps_PreshMap { + void *(*get)(struct __pyx_obj_7preshed_4maps_PreshMap *, __pyx_t_7preshed_4maps_key_t); + void (*set)(struct __pyx_obj_7preshed_4maps_PreshMap *, __pyx_t_7preshed_4maps_key_t, void *); +}; +static struct __pyx_vtabstruct_7preshed_4maps_PreshMap *__pyx_vtabptr_7preshed_4maps_PreshMap; + + +/* "preshed/maps.pxd":53 + * + * + * cdef class PreshMapArray: # <<<<<<<<<<<<<< + * cdef Pool mem + * cdef MapStruct* maps +*/ + +struct __pyx_vtabstruct_7preshed_4maps_PreshMapArray { + void *(*get)(struct __pyx_obj_7preshed_4maps_PreshMapArray *, size_t, __pyx_t_7preshed_4maps_key_t); + void (*set)(struct __pyx_obj_7preshed_4maps_PreshMapArray *, size_t, __pyx_t_7preshed_4maps_key_t, void *); +}; +static struct __pyx_vtabstruct_7preshed_4maps_PreshMapArray *__pyx_vtabptr_7preshed_4maps_PreshMapArray; + + +/* "strings.pxd":22 + * + * + * cdef class StringStore: # <<<<<<<<<<<<<< + * cdef Pool mem + * +*/ + +struct __pyx_vtabstruct_5spacy_7strings_StringStore { + __pyx_t_5spacy_7strings_Utf8Str const *(*intern_unicode)(struct __pyx_obj_5spacy_7strings_StringStore *, PyObject *, int); + __pyx_t_5spacy_7strings_Utf8Str const *(*_intern_utf8)(struct __pyx_obj_5spacy_7strings_StringStore *, char *, int, __pyx_t_5spacy_8typedefs_hash_t *, int); +}; +static struct __pyx_vtabstruct_5spacy_7strings_StringStore *__pyx_vtabptr_5spacy_7strings_StringStore; + + +/* "morphology.pxd":11 + * + * + * cdef class Morphology: # <<<<<<<<<<<<<< + * cdef readonly Pool mem + * cdef readonly StringStore strings +*/ + +struct __pyx_vtabstruct_5spacy_10morphology_Morphology { + struct __pyx_t_5spacy_7structs_MorphAnalysisC (*create_morph_tag)(struct __pyx_obj_5spacy_10morphology_Morphology *, PyObject *); + int (*insert)(struct __pyx_obj_5spacy_10morphology_Morphology *, struct __pyx_t_5spacy_7structs_MorphAnalysisC); +}; +static struct __pyx_vtabstruct_5spacy_10morphology_Morphology *__pyx_vtabptr_5spacy_10morphology_Morphology; + + +/* "vocab.pxd":26 + * + * + * cdef class Vocab: # <<<<<<<<<<<<<< + * cdef Pool mem + * cdef readonly StringStore strings +*/ + +struct __pyx_vtabstruct_5spacy_5vocab_Vocab { + struct __pyx_t_5spacy_7structs_LexemeC const *(*get)(struct __pyx_obj_5spacy_5vocab_Vocab *, struct __pyx_obj_5cymem_5cymem_Pool *, PyObject *); + struct __pyx_t_5spacy_7structs_LexemeC const *(*get_by_orth)(struct __pyx_obj_5spacy_5vocab_Vocab *, struct __pyx_obj_5cymem_5cymem_Pool *, __pyx_t_5spacy_8typedefs_attr_t); + struct __pyx_t_5spacy_7structs_TokenC const *(*make_fused_token)(struct __pyx_obj_5spacy_5vocab_Vocab *, PyObject *); + struct __pyx_t_5spacy_7structs_LexemeC const *(*_new_lexeme)(struct __pyx_obj_5spacy_5vocab_Vocab *, struct __pyx_obj_5cymem_5cymem_Pool *, PyObject *); + int (*_add_lex_to_vocab)(struct __pyx_obj_5spacy_5vocab_Vocab *, __pyx_t_5spacy_8typedefs_hash_t, struct __pyx_t_5spacy_7structs_LexemeC const *, int); +}; +static struct __pyx_vtabstruct_5spacy_5vocab_Vocab *__pyx_vtabptr_5spacy_5vocab_Vocab; + + +/* "tokens/doc.pxd":37 + * + * + * cdef class Doc: # <<<<<<<<<<<<<< + * cdef readonly Pool mem + * cdef readonly Vocab vocab +*/ + +struct __pyx_vtabstruct_5spacy_6tokens_3doc_Doc { + PyArrayObject *(*to_array)(struct __pyx_obj_5spacy_6tokens_3doc_Doc *, PyObject *, int __pyx_skip_dispatch); + int (*__pyx_fuse_0push_back)(struct __pyx_obj_5spacy_6tokens_3doc_Doc *, __pyx_t_5spacy_6tokens_3doc_const_Lexeme_ptr, int); + int (*__pyx_fuse_1push_back)(struct __pyx_obj_5spacy_6tokens_3doc_Doc *, __pyx_t_5spacy_6tokens_3doc_const_TokenC_ptr, int); +}; +static struct __pyx_vtabstruct_5spacy_6tokens_3doc_Doc *__pyx_vtabptr_5spacy_6tokens_3doc_Doc; + + +/* "lexeme.pxd":24 + * cdef attr_t OOV_RANK + * + * cdef class Lexeme: # <<<<<<<<<<<<<< + * cdef LexemeC* c + * cdef readonly Vocab vocab +*/ + +struct __pyx_vtabstruct_5spacy_6lexeme_Lexeme { + struct __pyx_obj_5spacy_6lexeme_Lexeme *(*from_ptr)(struct __pyx_t_5spacy_7structs_LexemeC *, struct __pyx_obj_5spacy_5vocab_Vocab *); + void (*set_struct_attr)(struct __pyx_t_5spacy_7structs_LexemeC *, enum __pyx_t_5spacy_5attrs_attr_id_t, __pyx_t_5spacy_8typedefs_attr_t); + __pyx_t_5spacy_8typedefs_attr_t (*get_struct_attr)(struct __pyx_t_5spacy_7structs_LexemeC const *, enum __pyx_t_5spacy_5attrs_attr_id_t); + int (*c_check_flag)(struct __pyx_t_5spacy_7structs_LexemeC const *, enum __pyx_t_5spacy_5attrs_attr_id_t); + int (*c_set_flag)(struct __pyx_t_5spacy_7structs_LexemeC *, enum __pyx_t_5spacy_5attrs_attr_id_t, int); +}; +static struct __pyx_vtabstruct_5spacy_6lexeme_Lexeme *__pyx_vtabptr_5spacy_6lexeme_Lexeme; +static CYTHON_INLINE struct __pyx_obj_5spacy_6lexeme_Lexeme *__pyx_f_5spacy_6lexeme_6Lexeme_from_ptr(struct __pyx_t_5spacy_7structs_LexemeC *, struct __pyx_obj_5spacy_5vocab_Vocab *); +static CYTHON_INLINE void __pyx_f_5spacy_6lexeme_6Lexeme_set_struct_attr(struct __pyx_t_5spacy_7structs_LexemeC *, enum __pyx_t_5spacy_5attrs_attr_id_t, __pyx_t_5spacy_8typedefs_attr_t); +static CYTHON_INLINE __pyx_t_5spacy_8typedefs_attr_t __pyx_f_5spacy_6lexeme_6Lexeme_get_struct_attr(struct __pyx_t_5spacy_7structs_LexemeC const *, enum __pyx_t_5spacy_5attrs_attr_id_t); +static CYTHON_INLINE int __pyx_f_5spacy_6lexeme_6Lexeme_c_check_flag(struct __pyx_t_5spacy_7structs_LexemeC const *, enum __pyx_t_5spacy_5attrs_attr_id_t); +static CYTHON_INLINE int __pyx_f_5spacy_6lexeme_6Lexeme_c_set_flag(struct __pyx_t_5spacy_7structs_LexemeC *, enum __pyx_t_5spacy_5attrs_attr_id_t, int); + + +/* "stateclass.pxd":9 + * + * + * cdef class StateClass: # <<<<<<<<<<<<<< + * cdef StateC* c + * cdef readonly Doc doc +*/ + +struct __pyx_vtabstruct_5spacy_8pipeline_17_parser_internals_10stateclass_StateClass { + struct __pyx_obj_5spacy_8pipeline_17_parser_internals_10stateclass_StateClass *(*borrow)(__pyx_t_5spacy_8pipeline_17_parser_internals_6_state_StateC *, struct __pyx_obj_5spacy_6tokens_3doc_Doc *); + struct __pyx_obj_5spacy_8pipeline_17_parser_internals_10stateclass_StateClass *(*init_offset)(struct __pyx_t_5spacy_7structs_TokenC const *, int, int); +}; +static struct __pyx_vtabstruct_5spacy_8pipeline_17_parser_internals_10stateclass_StateClass *__pyx_vtabptr_5spacy_8pipeline_17_parser_internals_10stateclass_StateClass; +static CYTHON_INLINE struct __pyx_obj_5spacy_8pipeline_17_parser_internals_10stateclass_StateClass *__pyx_f_5spacy_8pipeline_17_parser_internals_10stateclass_10StateClass_borrow(__pyx_t_5spacy_8pipeline_17_parser_internals_6_state_StateC *, struct __pyx_obj_5spacy_6tokens_3doc_Doc *); +static CYTHON_INLINE struct __pyx_obj_5spacy_8pipeline_17_parser_internals_10stateclass_StateClass *__pyx_f_5spacy_8pipeline_17_parser_internals_10stateclass_10StateClass_init_offset(struct __pyx_t_5spacy_7structs_TokenC const *, int, int); + + +/* "transition_system.pxd":39 + * ctypedef int (*del_state_t)(Pool mem, void* state, void* extra_args) except -1 + * + * cdef class TransitionSystem: # <<<<<<<<<<<<<< + * cdef Pool mem + * cdef StringStore strings +*/ + +struct __pyx_vtabstruct_5spacy_8pipeline_17_parser_internals_17transition_system_TransitionSystem { + struct __pyx_t_5spacy_8pipeline_17_parser_internals_17transition_system_Transition (*lookup_transition)(struct __pyx_obj_5spacy_8pipeline_17_parser_internals_17transition_system_TransitionSystem *, PyObject *); + struct __pyx_t_5spacy_8pipeline_17_parser_internals_17transition_system_Transition (*init_transition)(struct __pyx_obj_5spacy_8pipeline_17_parser_internals_17transition_system_TransitionSystem *, int, int, __pyx_t_5spacy_8typedefs_attr_t); + int (*set_valid)(struct __pyx_obj_5spacy_8pipeline_17_parser_internals_17transition_system_TransitionSystem *, int *, __pyx_t_5spacy_8pipeline_17_parser_internals_6_state_StateC const *); + int (*set_costs)(struct __pyx_obj_5spacy_8pipeline_17_parser_internals_17transition_system_TransitionSystem *, int *, __pyx_t_5spacy_8typedefs_weight_t *, __pyx_t_5spacy_8pipeline_17_parser_internals_6_state_StateC const *, PyObject *); +}; +static struct __pyx_vtabstruct_5spacy_8pipeline_17_parser_internals_17transition_system_TransitionSystem *__pyx_vtabptr_5spacy_8pipeline_17_parser_internals_17transition_system_TransitionSystem; + + +/* "spacy/pipeline/_parser_internals/_beam_utils.pyx":32 + * + * + * cdef class BeamBatch(object): # <<<<<<<<<<<<<< + * cdef public TransitionSystem moves + * cdef public object states +*/ + +struct __pyx_vtabstruct_5spacy_8pipeline_17_parser_internals_11_beam_utils_BeamBatch { + int (*_set_scores)(struct __pyx_obj_5spacy_8pipeline_17_parser_internals_11_beam_utils_BeamBatch *, struct __pyx_obj_5thinc_5extra_6search_Beam *, float const *, int); +}; +static struct __pyx_vtabstruct_5spacy_8pipeline_17_parser_internals_11_beam_utils_BeamBatch *__pyx_vtabptr_5spacy_8pipeline_17_parser_internals_11_beam_utils_BeamBatch; + + +/* "View.MemoryView":110 + * + * + * @cython.collection_type("sequence") # <<<<<<<<<<<<<< + * @cname("__pyx_array") + * cdef class array: +*/ + +struct __pyx_vtabstruct_array { + PyObject *(*get_memview)(struct __pyx_array_obj *); +}; +static struct __pyx_vtabstruct_array *__pyx_vtabptr_array; + + +/* "View.MemoryView":334 + * + * + * @cname('__pyx_memoryview') # <<<<<<<<<<<<<< + * cdef class memoryview: + * +*/ + +struct __pyx_vtabstruct_memoryview { + char *(*get_item_pointer)(struct __pyx_memoryview_obj *, PyObject *); + PyObject *(*is_slice)(struct __pyx_memoryview_obj *, PyObject *); + PyObject *(*setitem_slice_assignment)(struct __pyx_memoryview_obj *, PyObject *, PyObject *); + PyObject *(*setitem_slice_assign_scalar)(struct __pyx_memoryview_obj *, struct __pyx_memoryview_obj *, PyObject *); + PyObject *(*setitem_indexed)(struct __pyx_memoryview_obj *, PyObject *, PyObject *); + PyObject *(*convert_item_to_object)(struct __pyx_memoryview_obj *, char *); + PyObject *(*assign_item_from_object)(struct __pyx_memoryview_obj *, char *, PyObject *); + PyObject *(*_get_base)(struct __pyx_memoryview_obj *); +}; +static struct __pyx_vtabstruct_memoryview *__pyx_vtabptr_memoryview; + + +/* "View.MemoryView":951 + * + * + * @cython.collection_type("sequence") # <<<<<<<<<<<<<< + * @cname('__pyx_memoryviewslice') + * cdef class _memoryviewslice(memoryview): +*/ + +struct __pyx_vtabstruct__memoryviewslice { + struct __pyx_vtabstruct_memoryview __pyx_base; +}; +static struct __pyx_vtabstruct__memoryviewslice *__pyx_vtabptr__memoryviewslice; +/* #### 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); + +/* 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) + +/* RaiseException.export */ +static void __Pyx_Raise(PyObject *type, PyObject *value, PyObject *tb, PyObject *cause); + +/* 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 + +/* RaiseUnexpectedTypeError.proto */ +static int __Pyx_RaiseUnexpectedTypeError(const char *expected, PyObject *obj); + +/* PyMemoryError_Check.proto */ +#define __Pyx_PyExc_MemoryError_Check(obj) __Pyx_TypeCheck(obj, PyExc_MemoryError) + +/* 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); + +/* CIntToPyUnicode.proto */ +#define __Pyx_PyUnicode_From_Py_ssize_t(value, width, padding_char, format_char) (\ + ((format_char) == ('c')) ?\ + __Pyx_uchar___Pyx_PyUnicode_From_Py_ssize_t(value, width, padding_char) :\ + __Pyx____Pyx_PyUnicode_From_Py_ssize_t(value, width, padding_char, format_char)\ + ) +static CYTHON_INLINE PyObject* __Pyx_uchar___Pyx_PyUnicode_From_Py_ssize_t(Py_ssize_t value, Py_ssize_t width, char padding_char); +static CYTHON_INLINE PyObject* __Pyx____Pyx_PyUnicode_From_Py_ssize_t(Py_ssize_t 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); + +/* 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 + +CYTHON_UNUSED static int __pyx_array_getbuffer(PyObject *__pyx_v_self, Py_buffer *__pyx_v_info, int __pyx_v_flags); /*proto*/ +static PyObject *__pyx_array_get_memview(struct __pyx_array_obj *); /*proto*/ +/* GetAttr.proto */ +static CYTHON_INLINE PyObject *__Pyx_GetAttr(PyObject *, PyObject *); + +/* GetItemInt.proto */ +#define __Pyx_GetItemInt(o, i, type, is_signed, to_py_func, is_list, wraparound, boundscheck, has_gil, unsafe_shared)\ + (__Pyx_fits_Py_ssize_t(i, type, is_signed) ?\ + __Pyx_GetItemInt_Fast(o, (Py_ssize_t)i, is_list, wraparound, boundscheck, unsafe_shared) :\ + (is_list ? (PyErr_SetString(PyExc_IndexError, "list index out of range"), (PyObject*)NULL) :\ + __Pyx_GetItemInt_Generic(o, to_py_func(i)))) +#define __Pyx_GetItemInt_List(o, i, type, is_signed, to_py_func, is_list, wraparound, boundscheck, has_gil, unsafe_shared)\ + (__Pyx_fits_Py_ssize_t(i, type, is_signed) ?\ + __Pyx_GetItemInt_List_Fast(o, (Py_ssize_t)i, wraparound, boundscheck, unsafe_shared) :\ + (PyErr_SetString(PyExc_IndexError, "list index out of range"), (PyObject*)NULL)) +static CYTHON_INLINE PyObject *__Pyx_GetItemInt_List_Fast(PyObject *o, Py_ssize_t i, + int wraparound, int boundscheck, int unsafe_shared); +#define __Pyx_GetItemInt_Tuple(o, i, type, is_signed, to_py_func, is_list, wraparound, boundscheck, has_gil, unsafe_shared)\ + (__Pyx_fits_Py_ssize_t(i, type, is_signed) ?\ + __Pyx_GetItemInt_Tuple_Fast(o, (Py_ssize_t)i, wraparound, boundscheck, unsafe_shared) :\ + (PyErr_SetString(PyExc_IndexError, "tuple index out of range"), (PyObject*)NULL)) +static CYTHON_INLINE PyObject *__Pyx_GetItemInt_Tuple_Fast(PyObject *o, Py_ssize_t i, + int wraparound, int boundscheck, int unsafe_shared); +static PyObject *__Pyx_GetItemInt_Generic(PyObject *o, PyObject* j); +static CYTHON_INLINE PyObject *__Pyx_GetItemInt_Fast(PyObject *o, Py_ssize_t i, + int is_list, int wraparound, int boundscheck, int unsafe_shared); + +/* ObjectGetItem.proto */ +#if CYTHON_USE_TYPE_SLOTS +static CYTHON_INLINE PyObject *__Pyx_PyObject_GetItem(PyObject *obj, PyObject *key); +#else +#define __Pyx_PyObject_GetItem(obj, key) PyObject_GetItem(obj, key) +#endif + +/* RejectKeywords.export */ +static void __Pyx_RejectKeywords(const char* function_name, PyObject *kwds); + +/* PyTypeError_Check.proto */ +#define __Pyx_PyExc_TypeError_Check(obj) __Pyx_TypeCheck(obj, PyExc_TypeError) + +/* DivInt[Py_ssize_t].proto */ +static CYTHON_INLINE Py_ssize_t __Pyx_div_Py_ssize_t(Py_ssize_t, Py_ssize_t, int b_is_constant); + +/* UnaryNegOverflows.proto */ +#define __Pyx_UNARY_NEG_WOULD_OVERFLOW(x)\ + (((x) < 0) & ((unsigned long)(x) == 0-(unsigned long)(x))) + +/* GetAttr3.proto */ +static CYTHON_INLINE PyObject *__Pyx_GetAttr3(PyObject *, PyObject *, PyObject *); + +/* 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 + +/* AssertionsEnabled.proto */ +#if CYTHON_COMPILING_IN_LIMITED_API || PY_VERSION_HEX >= 0x030C0000 + static int __pyx_assertions_enabled_flag; + #define __pyx_assertions_enabled() (__pyx_assertions_enabled_flag) + static int __Pyx_init_assertions_enabled(void) { + PyObject *builtins, *debug, *debug_str; + int flag; + builtins = PyEval_GetBuiltins(); + if (!builtins) goto bad; + debug_str = PyUnicode_FromStringAndSize("__debug__", 9); + if (!debug_str) goto bad; + debug = PyObject_GetItem(builtins, debug_str); + Py_DECREF(debug_str); + if (!debug) goto bad; + flag = PyObject_IsTrue(debug); + Py_DECREF(debug); + if (flag == -1) goto bad; + __pyx_assertions_enabled_flag = flag; + return 0; + bad: + __pyx_assertions_enabled_flag = 1; + return -1; + } +#else + #define __Pyx_init_assertions_enabled() (0) + #define __pyx_assertions_enabled() (!Py_OptimizeFlag) +#endif + +/* PyAssertionError_Check.proto */ +#define __Pyx_PyExc_AssertionError_Check(obj) __Pyx_TypeCheck(obj, PyExc_AssertionError) + +/* RaiseTooManyValuesToUnpack.proto */ +static CYTHON_INLINE void __Pyx_RaiseTooManyValuesError(Py_ssize_t expected); + +/* RaiseNeedMoreValuesToUnpack.proto */ +static CYTHON_INLINE void __Pyx_RaiseNeedMoreValuesError(Py_ssize_t index); + +/* RaiseNoneIterError.proto */ +static CYTHON_INLINE void __Pyx_RaiseNoneNotIterableError(void); + +/* ExtTypeTest.proto */ +static CYTHON_INLINE int __Pyx_TypeTest(PyObject *obj, PyTypeObject *type); + +/* 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 + +/* 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); + +/* 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 + +CYTHON_UNUSED static int __pyx_memoryview_getbuffer(PyObject *__pyx_v_self, Py_buffer *__pyx_v_info, int __pyx_v_flags); /*proto*/ +/* 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 + +/* PySequenceMultiply.proto */ +#define __Pyx_PySequence_Multiply_Left(mul, seq) __Pyx_PySequence_Multiply(seq, mul) +static CYTHON_INLINE PyObject* __Pyx_PySequence_Multiply(PyObject *seq, Py_ssize_t mul); + +/* PyObjectFormatAndDecref.proto */ +static CYTHON_INLINE PyObject* __Pyx_PyObject_FormatSimpleAndDecref(PyObject* s, PyObject* f); +static CYTHON_INLINE PyObject* __Pyx_PyObject_FormatAndDecref(PyObject* s, PyObject* f); + +/* PyObjectFormat.proto */ +#if CYTHON_USE_UNICODE_WRITER +static PyObject* __Pyx_PyObject_Format(PyObject* s, PyObject* f); +#else +#define __Pyx_PyObject_Format(s, f) PyObject_Format(s, f) +#endif + +/* SetItemInt.proto */ +#define __Pyx_SetItemInt(o, i, v, type, is_signed, to_py_func, is_list, wraparound, boundscheck, has_gil, unsafe_shared)\ + (__Pyx_fits_Py_ssize_t(i, type, is_signed) ?\ + __Pyx_SetItemInt_Fast(o, (Py_ssize_t)i, v, is_list, wraparound, boundscheck, unsafe_shared) :\ + (is_list ? (PyErr_SetString(PyExc_IndexError, "list assignment index out of range"), -1) :\ + __Pyx_SetItemInt_Generic(o, to_py_func(i), v))) +static int __Pyx_SetItemInt_Generic(PyObject *o, PyObject *j, PyObject *v); +static CYTHON_INLINE int __Pyx_SetItemInt_Fast(PyObject *o, Py_ssize_t i, PyObject *v, + int is_list, int wraparound, int boundscheck, int unsafe_shared); + +/* RaiseUnboundLocalError.proto */ +static void __Pyx_RaiseUnboundLocalError(const char *varname); + +/* PyIndexError_Check.proto */ +#define __Pyx_PyExc_IndexError_Check(obj) __Pyx_TypeCheck(obj, PyExc_IndexError) + +/* DivInt[long].proto */ +static CYTHON_INLINE long __Pyx_div_long(long, long, int b_is_constant); + +/* PyImportError_Check.proto */ +#define __Pyx_PyExc_ImportError_Check(obj) __Pyx_TypeCheck(obj, PyExc_ImportError) + +/* tp_new.proto */ +#define __Pyx_tp_new(type_obj, args) __Pyx_tp_new_kwargs(type_obj, args, NULL) +static CYTHON_INLINE PyObject* __Pyx_tp_new_kwargs(PyObject* type_obj, PyObject* args, PyObject* kwargs); + +/* WriteUnraisableException.proto */ +static void __Pyx_WriteUnraisable(const char *name, int clineno, + int lineno, const char *filename, + int full_traceback, int nogil); + +/* MoveIfSupported.proto */ +#if CYTHON_USE_CPP_STD_MOVE + #include + #define __PYX_STD_MOVE_IF_SUPPORTED(x) std::move(x) +#else + #define __PYX_STD_MOVE_IF_SUPPORTED(x) x +#endif + +/* PyObjectVectorCallKwBuilder.proto */ +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 + +/* ListAppend.proto (used by append) */ +#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 + +/* PyObjectCall2Args.proto (used by PyObjectCallMethod1) */ +static CYTHON_INLINE PyObject* __Pyx_PyObject_Call2Args(PyObject* function, PyObject* arg1, PyObject* arg2); + +/* PyObjectGetMethod.proto (used by PyObjectCallMethod1) */ +#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 + +/* PyObjectCallMethod1.proto (used by append) */ +static PyObject* __Pyx_PyObject_CallMethod1(PyObject* obj, PyObject* method_name, PyObject* arg); + +/* append.proto */ +static CYTHON_INLINE int __Pyx_PyObject_Append(PyObject* L, PyObject* x); + +/* IterFinish.proto */ +static CYTHON_INLINE int __Pyx_IterFinish(void); + +/* UnpackItemEndCheck.proto */ +static int __Pyx_IternextUnpackEndCheck(PyObject *retval, Py_ssize_t expected); + +/* BufferIndexError.proto */ +static void __Pyx_RaiseBufferIndexError(int axis); + +/* 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 + +/* 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 + +/* PyRange_Check.proto */ +#if CYTHON_COMPILING_IN_PYPY && !defined(PyRange_Check) + #define PyRange_Check(obj) __Pyx_TypeCheck((obj), &PyRange_Type) +#endif + +/* PyLongCompare.proto */ +static CYTHON_INLINE int __Pyx_PyLong_BoolNeObjC(PyObject *op1, PyObject *op2, long intval, long inplace); + +/* PyDictContains.proto */ +static CYTHON_INLINE int __Pyx_PyDict_ContainsTF(PyObject* item, PyObject* dict, int eq) { + int result = PyDict_Contains(dict, item); + return unlikely(result < 0) ? result : (result == (eq == Py_EQ)); +} + +/* CallUnboundCMethod1.proto */ +CYTHON_UNUSED +static PyObject* __Pyx__CallUnboundCMethod1(__Pyx_CachedCFunction* cfunc, PyObject* self, PyObject* arg); +#if CYTHON_COMPILING_IN_CPYTHON +static CYTHON_INLINE PyObject* __Pyx_CallUnboundCMethod1(__Pyx_CachedCFunction* cfunc, PyObject* self, PyObject* arg); +#else +#define __Pyx_CallUnboundCMethod1(cfunc, self, arg) __Pyx__CallUnboundCMethod1(cfunc, self, arg) +#endif + +/* 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 + +/* PyFloatBinop.proto */ +#if !CYTHON_COMPILING_IN_PYPY +static int __Pyx_PyFloat_BoolNeObjC(PyObject *op1, PyObject *op2, double floatval, int inplace, int zerodivision_check); +#else +#define __Pyx_PyFloat_BoolNeObjC(op1, op2, floatval, inplace, zerodivision_check)\ + __Pyx_PyObject_IsTrueAndDecref(PyObject_RichCompare(op1, op2, Py_NE)) + #endif + +/* PyFloatBinop.proto */ +#if !CYTHON_COMPILING_IN_PYPY +static int __Pyx_PyFloat_BoolEqObjC(PyObject *op1, PyObject *op2, double floatval, int inplace, int zerodivision_check); +#else +#define __Pyx_PyFloat_BoolEqObjC(op1, op2, floatval, inplace, zerodivision_check)\ + __Pyx_PyObject_IsTrueAndDecref(PyObject_RichCompare(op1, op2, Py_EQ)) + #endif + +/* 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 + +/* CheckTypeForFreelists.proto */ +#if CYTHON_USE_FREELISTS +#if CYTHON_USE_TYPE_SPECS +#define __PYX_CHECK_FINAL_TYPE_FOR_FREELISTS(t, expected_tp, expected_size) ((int) ((t) == (expected_tp))) +#define __PYX_CHECK_TYPE_FOR_FREELIST_FLAGS Py_TPFLAGS_IS_ABSTRACT +#else +#define __PYX_CHECK_FINAL_TYPE_FOR_FREELISTS(t, expected_tp, expected_size) ((int) ((t)->tp_basicsize == (expected_size))) +#define __PYX_CHECK_TYPE_FOR_FREELIST_FLAGS (Py_TPFLAGS_IS_ABSTRACT | Py_TPFLAGS_HEAPTYPE) +#endif +#define __PYX_CHECK_TYPE_FOR_FREELISTS(t, expected_tp, expected_size)\ + (__PYX_CHECK_FINAL_TYPE_FOR_FREELISTS((t), (expected_tp), (expected_size)) &\ + (int) (!__Pyx_PyType_HasFeature((t), __PYX_CHECK_TYPE_FOR_FREELIST_FLAGS))) +#endif + +/* DefaultPlacementNew.proto */ +#include +template +void __Pyx_default_placement_construct(T* x) { + new (static_cast(x)) T(); +} + +/* 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); + +/* 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); + +/* 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); + +/* SetVTable.proto */ +static int __Pyx_SetVtable(PyTypeObject* typeptr , void* vtable); + +/* GetVTable.proto (used by MergeVTables) */ +static void* __Pyx_GetVtable(PyTypeObject *type); + +/* MergeVTables.proto */ +static int __Pyx_MergeVtables(PyTypeObject *type); + +/* 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_1 +#define __PYX_HAVE_RT_ImportType_proto_3_2_1 +#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_1(s) alignof(s) +#else +#define __PYX_GET_STRUCT_ALIGNMENT_3_2_1(s) sizeof(void*) +#endif +enum __Pyx_ImportType_CheckSize_3_2_1 { + __Pyx_ImportType_CheckSize_Error_3_2_1 = 0, + __Pyx_ImportType_CheckSize_Warn_3_2_1 = 1, + __Pyx_ImportType_CheckSize_Ignore_3_2_1 = 2 +}; +static PyTypeObject *__Pyx_ImportType_3_2_1(PyObject* module, const char *module_name, const char *class_name, size_t size, size_t alignment, enum __Pyx_ImportType_CheckSize_3_2_1 check_size); +#endif + +/* VoidPtrImport.proto */ +static int __Pyx_ImportVoidPtr_3_2_1(PyObject *module, const char *name, void **p, const char *sig); + +/* FunctionImport.proto */ +static int __Pyx_ImportFunction_3_2_1(PyObject *module, const char *funcname, void (**f)(void), const char *sig); + +/* 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 + +/* 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); + +/* BufferStructDeclare.proto */ +typedef struct { + Py_ssize_t shape, strides, suboffsets; +} __Pyx_Buf_DimInfo; +typedef struct { + size_t refcount; + Py_buffer pybuffer; +} __Pyx_Buffer; +typedef struct { + __Pyx_Buffer *rcbuffer; + char *data; + __Pyx_Buf_DimInfo diminfo[8]; +} __Pyx_LocalBuf_ND; + +/* MemviewRefcount.proto */ +static CYTHON_INLINE int __pyx_add_acquisition_count_locked( + __pyx_atomic_int_type *acquisition_count, PyThread_type_lock lock); +static CYTHON_INLINE int __pyx_sub_acquisition_count_locked( + __pyx_atomic_int_type *acquisition_count, PyThread_type_lock lock); +#define __pyx_get_slice_count_pointer(memview) (&memview->acquisition_count) +#define __PYX_INC_MEMVIEW(slice, have_gil) __Pyx_INC_MEMVIEW(slice, have_gil, __LINE__) +#define __PYX_XCLEAR_MEMVIEW(slice, have_gil) __Pyx_XCLEAR_MEMVIEW(slice, have_gil, __LINE__) +static CYTHON_INLINE void __Pyx_INC_MEMVIEW(__Pyx_memviewslice *, int, int); +static CYTHON_INLINE void __Pyx_XCLEAR_MEMVIEW(__Pyx_memviewslice *, int, int); + +/* MemviewSliceIsContig.proto */ +static int __pyx_memviewslice_is_contig(const __Pyx_memviewslice mvs, char order, int ndim); + +/* OverlappingSlices.proto */ +static int __pyx_slices_overlap(__Pyx_memviewslice *slice1, + __Pyx_memviewslice *slice2, + int ndim, size_t itemsize); + +/* MemviewSliceInit.proto */ +static int __Pyx_init_memviewslice( + struct __pyx_memoryview_obj *memview, + int ndim, + __Pyx_memviewslice *memviewslice, + int memview_is_new_reference); + +/* CheckUnpickleChecksum.proto */ +static CYTHON_INLINE int __Pyx_CheckUnpickleChecksum(long checksum, long checksum1, long checksum2, long checksum3, const char *members); + +/* IsLittleEndian.proto (used by BufferFormatCheck) */ +static CYTHON_INLINE int __Pyx_Is_Little_Endian(void); + +/* BufferFormatCheck.proto (used by MemviewSliceValidateAndInit) */ +static const char* __Pyx_BufFmt_CheckString(__Pyx_BufFmt_Context* ctx, const char* ts); +static void __Pyx_BufFmt_Init(__Pyx_BufFmt_Context* ctx, + __Pyx_BufFmt_StackElem* stack, + const __Pyx_TypeInfo* type); + +/* TypeInfoCompare.proto (used by MemviewSliceValidateAndInit) */ +static int __pyx_typeinfo_cmp(const __Pyx_TypeInfo *a, const __Pyx_TypeInfo *b); + +/* MemviewSliceValidateAndInit.export */ +static int __Pyx_ValidateAndInit_memviewslice( + int *axes_specs, + int c_or_f_flag, + int buf_flags, + int ndim, + const __Pyx_TypeInfo *dtype, + __Pyx_BufFmt_StackElem stack[], + __Pyx_memviewslice *memviewslice, + PyObject *original_obj); + +/* ObjectToMemviewSlice.proto */ +static CYTHON_INLINE __Pyx_memviewslice __Pyx_PyObject_to_MemoryviewSlice_d_dc_float(PyObject *, int writable_flag); + +/* RealImag.proto */ +#if CYTHON_CCOMPLEX + #ifdef __cplusplus + #define __Pyx_CREAL(z) ((z).real()) + #define __Pyx_CIMAG(z) ((z).imag()) + #else + #define __Pyx_CREAL(z) (__real__(z)) + #define __Pyx_CIMAG(z) (__imag__(z)) + #endif +#else + #define __Pyx_CREAL(z) ((z).real) + #define __Pyx_CIMAG(z) ((z).imag) +#endif +#if defined(__cplusplus) && CYTHON_CCOMPLEX\ + && (defined(_WIN32) || defined(__clang__) || (defined(__GNUC__) && (__GNUC__ >= 5 || __GNUC__ == 4 && __GNUC_MINOR__ >= 4 )) || __cplusplus >= 201103) + #define __Pyx_SET_CREAL(z,x) ((z).real(x)) + #define __Pyx_SET_CIMAG(z,y) ((z).imag(y)) +#else + #define __Pyx_SET_CREAL(z,x) __Pyx_CREAL(z) = (x) + #define __Pyx_SET_CIMAG(z,y) __Pyx_CIMAG(z) = (y) +#endif + +/* Arithmetic.proto */ +#if CYTHON_CCOMPLEX && (1) && (!0 || __cplusplus) + #define __Pyx_c_eq_float(a, b) ((a)==(b)) + #define __Pyx_c_sum_float(a, b) ((a)+(b)) + #define __Pyx_c_diff_float(a, b) ((a)-(b)) + #define __Pyx_c_prod_float(a, b) ((a)*(b)) + #define __Pyx_c_quot_float(a, b) ((a)/(b)) + #define __Pyx_c_neg_float(a) (-(a)) + #ifdef __cplusplus + #define __Pyx_c_is_zero_float(z) ((z)==(float)0) + #define __Pyx_c_conj_float(z) (::std::conj(z)) + #if 1 + #define __Pyx_c_abs_float(z) (::std::abs(z)) + #define __Pyx_c_pow_float(a, b) (::std::pow(a, b)) + #endif + #else + #define __Pyx_c_is_zero_float(z) ((z)==0) + #define __Pyx_c_conj_float(z) (conjf(z)) + #if 1 + #define __Pyx_c_abs_float(z) (cabsf(z)) + #define __Pyx_c_pow_float(a, b) (cpowf(a, b)) + #endif + #endif +#else + static CYTHON_INLINE int __Pyx_c_eq_float(__pyx_t_float_complex, __pyx_t_float_complex); + static CYTHON_INLINE __pyx_t_float_complex __Pyx_c_sum_float(__pyx_t_float_complex, __pyx_t_float_complex); + static CYTHON_INLINE __pyx_t_float_complex __Pyx_c_diff_float(__pyx_t_float_complex, __pyx_t_float_complex); + static CYTHON_INLINE __pyx_t_float_complex __Pyx_c_prod_float(__pyx_t_float_complex, __pyx_t_float_complex); + static CYTHON_INLINE __pyx_t_float_complex __Pyx_c_quot_float(__pyx_t_float_complex, __pyx_t_float_complex); + static CYTHON_INLINE __pyx_t_float_complex __Pyx_c_neg_float(__pyx_t_float_complex); + static CYTHON_INLINE int __Pyx_c_is_zero_float(__pyx_t_float_complex); + static CYTHON_INLINE __pyx_t_float_complex __Pyx_c_conj_float(__pyx_t_float_complex); + #if 1 + static CYTHON_INLINE float __Pyx_c_abs_float(__pyx_t_float_complex); + static CYTHON_INLINE __pyx_t_float_complex __Pyx_c_pow_float(__pyx_t_float_complex, __pyx_t_float_complex); + #endif +#endif + +/* Arithmetic.proto */ +#if CYTHON_CCOMPLEX && (1) && (!0 || __cplusplus) + #define __Pyx_c_eq_double(a, b) ((a)==(b)) + #define __Pyx_c_sum_double(a, b) ((a)+(b)) + #define __Pyx_c_diff_double(a, b) ((a)-(b)) + #define __Pyx_c_prod_double(a, b) ((a)*(b)) + #define __Pyx_c_quot_double(a, b) ((a)/(b)) + #define __Pyx_c_neg_double(a) (-(a)) + #ifdef __cplusplus + #define __Pyx_c_is_zero_double(z) ((z)==(double)0) + #define __Pyx_c_conj_double(z) (::std::conj(z)) + #if 1 + #define __Pyx_c_abs_double(z) (::std::abs(z)) + #define __Pyx_c_pow_double(a, b) (::std::pow(a, b)) + #endif + #else + #define __Pyx_c_is_zero_double(z) ((z)==0) + #define __Pyx_c_conj_double(z) (conj(z)) + #if 1 + #define __Pyx_c_abs_double(z) (cabs(z)) + #define __Pyx_c_pow_double(a, b) (cpow(a, b)) + #endif + #endif +#else + static CYTHON_INLINE int __Pyx_c_eq_double(__pyx_t_double_complex, __pyx_t_double_complex); + static CYTHON_INLINE __pyx_t_double_complex __Pyx_c_sum_double(__pyx_t_double_complex, __pyx_t_double_complex); + static CYTHON_INLINE __pyx_t_double_complex __Pyx_c_diff_double(__pyx_t_double_complex, __pyx_t_double_complex); + static CYTHON_INLINE __pyx_t_double_complex __Pyx_c_prod_double(__pyx_t_double_complex, __pyx_t_double_complex); + static CYTHON_INLINE __pyx_t_double_complex __Pyx_c_quot_double(__pyx_t_double_complex, __pyx_t_double_complex); + static CYTHON_INLINE __pyx_t_double_complex __Pyx_c_neg_double(__pyx_t_double_complex); + static CYTHON_INLINE int __Pyx_c_is_zero_double(__pyx_t_double_complex); + static CYTHON_INLINE __pyx_t_double_complex __Pyx_c_conj_double(__pyx_t_double_complex); + #if 1 + static CYTHON_INLINE double __Pyx_c_abs_double(__pyx_t_double_complex); + static CYTHON_INLINE __pyx_t_double_complex __Pyx_c_pow_double(__pyx_t_double_complex, __pyx_t_double_complex); + #endif +#endif + +/* Arithmetic.proto */ +#if CYTHON_CCOMPLEX && (1) && (!0 || __cplusplus) + #define __Pyx_c_eq_long__double(a, b) ((a)==(b)) + #define __Pyx_c_sum_long__double(a, b) ((a)+(b)) + #define __Pyx_c_diff_long__double(a, b) ((a)-(b)) + #define __Pyx_c_prod_long__double(a, b) ((a)*(b)) + #define __Pyx_c_quot_long__double(a, b) ((a)/(b)) + #define __Pyx_c_neg_long__double(a) (-(a)) + #ifdef __cplusplus + #define __Pyx_c_is_zero_long__double(z) ((z)==(long double)0) + #define __Pyx_c_conj_long__double(z) (::std::conj(z)) + #if 1 + #define __Pyx_c_abs_long__double(z) (::std::abs(z)) + #define __Pyx_c_pow_long__double(a, b) (::std::pow(a, b)) + #endif + #else + #define __Pyx_c_is_zero_long__double(z) ((z)==0) + #define __Pyx_c_conj_long__double(z) (conjl(z)) + #if 1 + #define __Pyx_c_abs_long__double(z) (cabsl(z)) + #define __Pyx_c_pow_long__double(a, b) (cpowl(a, b)) + #endif + #endif +#else + static CYTHON_INLINE int __Pyx_c_eq_long__double(__pyx_t_long_double_complex, __pyx_t_long_double_complex); + static CYTHON_INLINE __pyx_t_long_double_complex __Pyx_c_sum_long__double(__pyx_t_long_double_complex, __pyx_t_long_double_complex); + static CYTHON_INLINE __pyx_t_long_double_complex __Pyx_c_diff_long__double(__pyx_t_long_double_complex, __pyx_t_long_double_complex); + static CYTHON_INLINE __pyx_t_long_double_complex __Pyx_c_prod_long__double(__pyx_t_long_double_complex, __pyx_t_long_double_complex); + static CYTHON_INLINE __pyx_t_long_double_complex __Pyx_c_quot_long__double(__pyx_t_long_double_complex, __pyx_t_long_double_complex); + static CYTHON_INLINE __pyx_t_long_double_complex __Pyx_c_neg_long__double(__pyx_t_long_double_complex); + static CYTHON_INLINE int __Pyx_c_is_zero_long__double(__pyx_t_long_double_complex); + static CYTHON_INLINE __pyx_t_long_double_complex __Pyx_c_conj_long__double(__pyx_t_long_double_complex); + #if 1 + static CYTHON_INLINE long double __Pyx_c_abs_long__double(__pyx_t_long_double_complex); + static CYTHON_INLINE __pyx_t_long_double_complex __Pyx_c_pow_long__double(__pyx_t_long_double_complex, __pyx_t_long_double_complex); + #endif +#endif + +/* CppExceptionConversion.proto */ +#ifndef __Pyx_CppExn2PyErr +#include +#include +#include +#include +static void __Pyx_CppExn2PyErr() { + try { + if (PyErr_Occurred()) + ; // let the latest Python exn pass through and ignore the current one + else + throw; + } catch (const std::bad_alloc& exn) { + PyErr_SetString(PyExc_MemoryError, exn.what()); + } catch (const std::bad_cast& exn) { + PyErr_SetString(PyExc_TypeError, exn.what()); + } catch (const std::bad_typeid& exn) { + PyErr_SetString(PyExc_TypeError, exn.what()); + } catch (const std::domain_error& exn) { + PyErr_SetString(PyExc_ValueError, exn.what()); + } catch (const std::invalid_argument& exn) { + PyErr_SetString(PyExc_ValueError, exn.what()); + } catch (const std::ios_base::failure& exn) { + PyErr_SetString(PyExc_IOError, exn.what()); + } catch (const std::out_of_range& exn) { + PyErr_SetString(PyExc_IndexError, exn.what()); + } catch (const std::overflow_error& exn) { + PyErr_SetString(PyExc_OverflowError, exn.what()); + } catch (const std::range_error& exn) { + PyErr_SetString(PyExc_ArithmeticError, exn.what()); + } catch (const std::underflow_error& exn) { + PyErr_SetString(PyExc_ArithmeticError, exn.what()); + } catch (const std::exception& exn) { + PyErr_SetString(PyExc_RuntimeError, exn.what()); + } + catch (...) + { + PyErr_SetString(PyExc_RuntimeError, "Unknown exception"); + } +} +#endif + +/* MemviewSliceCopy.proto */ +static __Pyx_memviewslice +__pyx_memoryview_copy_new_contig(const __Pyx_memviewslice *from_mvs, + const char *mode, int ndim, + size_t sizeof_dtype, int contig_flag, + int dtype_is_object); + +/* CIntFromPy.proto */ +static CYTHON_INLINE int __Pyx_PyLong_As_int(PyObject *); + +/* CIntFromPy.proto */ +static CYTHON_INLINE long __Pyx_PyLong_As_long(PyObject *); + +/* CIntToPy.proto */ +static CYTHON_INLINE PyObject* __Pyx_PyLong_From_int(int value); + +/* CIntToPy.proto */ +static CYTHON_INLINE PyObject* __Pyx_PyLong_From_uint64_t(uint64_t value); + +/* CIntFromPy.proto */ +static CYTHON_INLINE uint64_t __Pyx_PyLong_As_uint64_t(PyObject *); + +/* CIntToPy.proto */ +static CYTHON_INLINE PyObject* __Pyx_PyLong_From_long(long value); + +/* CIntFromPy.proto */ +static CYTHON_INLINE size_t __Pyx_PyLong_As_size_t(PyObject *); + +/* UpdateUnpickledDict.proto */ +static int __Pyx_UpdateUnpickledDict(PyObject *obj, PyObject *state, Py_ssize_t index); + +/* CIntFromPy.proto */ +static CYTHON_INLINE char __Pyx_PyLong_As_char(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 + +/* 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); + +/* IterNextPlain.proto (used by CoroutineBase) */ +static CYTHON_INLINE PyObject *__Pyx_PyIter_Next_Plain(PyObject *iterator); +#if CYTHON_COMPILING_IN_LIMITED_API && __PYX_LIMITED_VERSION_HEX < 0x030A0000 +static PyObject *__Pyx_GetBuiltinNext_LimitedAPI(void); +#endif + +/* ReturnWithStopIteration.proto (used by CoroutineBase) */ +static CYTHON_INLINE void __Pyx_ReturnWithStopIteration(PyObject* value, int async, int iternext); + +/* CoroutineBase.proto (used by Generator) */ +struct __pyx_CoroutineObject; +typedef PyObject *(*__pyx_coroutine_body_t)(struct __pyx_CoroutineObject *, PyThreadState *, PyObject *); +#if CYTHON_USE_EXC_INFO_STACK +#define __Pyx_ExcInfoStruct _PyErr_StackItem +#else +typedef struct { + PyObject *exc_type; + PyObject *exc_value; + PyObject *exc_traceback; +} __Pyx_ExcInfoStruct; +#endif +typedef struct __pyx_CoroutineObject { + PyObject_HEAD + __pyx_coroutine_body_t body; + PyObject *closure; + __Pyx_ExcInfoStruct gi_exc_state; +#if PY_VERSION_HEX < 0x030C0000 || CYTHON_COMPILING_IN_LIMITED_API + PyObject *gi_weakreflist; +#endif + PyObject *classobj; + PyObject *yieldfrom; + __Pyx_pyiter_sendfunc yieldfrom_am_send; + PyObject *gi_name; + PyObject *gi_qualname; + PyObject *gi_modulename; + PyObject *gi_code; + PyObject *gi_frame; +#if CYTHON_USE_SYS_MONITORING && (CYTHON_PROFILE || CYTHON_TRACE) + PyMonitoringState __pyx_pymonitoring_state[__Pyx_MonitoringEventTypes_CyGen_count]; + uint64_t __pyx_pymonitoring_version; +#endif + int resume_label; + char is_running; +} __pyx_CoroutineObject; +static __pyx_CoroutineObject *__Pyx__Coroutine_New( + PyTypeObject *type, __pyx_coroutine_body_t body, PyObject *code, PyObject *closure, + PyObject *name, PyObject *qualname, PyObject *module_name); +static __pyx_CoroutineObject *__Pyx__Coroutine_NewInit( + __pyx_CoroutineObject *gen, __pyx_coroutine_body_t body, PyObject *code, PyObject *closure, + PyObject *name, PyObject *qualname, PyObject *module_name); +static CYTHON_INLINE void __Pyx_Coroutine_ExceptionClear(__Pyx_ExcInfoStruct *self); +static int __Pyx_Coroutine_clear(PyObject *self); +static __Pyx_PySendResult __Pyx_Coroutine_AmSend(PyObject *self, PyObject *value, PyObject **retval); +static PyObject *__Pyx_Coroutine_Send(PyObject *self, PyObject *value); +static __Pyx_PySendResult __Pyx_Coroutine_Close(PyObject *self, PyObject **retval); +static PyObject *__Pyx_Coroutine_Throw(PyObject *gen, PyObject *args); +#if CYTHON_USE_EXC_INFO_STACK +#define __Pyx_Coroutine_SwapException(self) +#define __Pyx_Coroutine_ResetAndClearException(self) __Pyx_Coroutine_ExceptionClear(&(self)->gi_exc_state) +#else +#define __Pyx_Coroutine_SwapException(self) {\ + __Pyx_ExceptionSwap(&(self)->gi_exc_state.exc_type, &(self)->gi_exc_state.exc_value, &(self)->gi_exc_state.exc_traceback);\ + __Pyx_Coroutine_ResetFrameBackpointer(&(self)->gi_exc_state);\ + } +#define __Pyx_Coroutine_ResetAndClearException(self) {\ + __Pyx_ExceptionReset((self)->gi_exc_state.exc_type, (self)->gi_exc_state.exc_value, (self)->gi_exc_state.exc_traceback);\ + (self)->gi_exc_state.exc_type = (self)->gi_exc_state.exc_value = (self)->gi_exc_state.exc_traceback = NULL;\ + } +#endif +#if CYTHON_FAST_THREAD_STATE +#define __Pyx_PyGen_FetchStopIterationValue(pvalue)\ + __Pyx_PyGen__FetchStopIterationValue(__pyx_tstate, pvalue) +#else +#define __Pyx_PyGen_FetchStopIterationValue(pvalue)\ + __Pyx_PyGen__FetchStopIterationValue(__Pyx_PyThreadState_Current, pvalue) +#endif +static int __Pyx_PyGen__FetchStopIterationValue(PyThreadState *tstate, PyObject **pvalue); +static CYTHON_INLINE void __Pyx_Coroutine_ResetFrameBackpointer(__Pyx_ExcInfoStruct *exc_state); +static char __Pyx_Coroutine_test_and_set_is_running(__pyx_CoroutineObject *gen); +static void __Pyx_Coroutine_unset_is_running(__pyx_CoroutineObject *gen); +static char __Pyx_Coroutine_get_is_running(__pyx_CoroutineObject *gen); +static PyObject *__Pyx_Coroutine_get_is_running_getter(PyObject *gen, void *closure); +#if __PYX_HAS_PY_AM_SEND == 2 +static void __Pyx_SetBackportTypeAmSend(PyTypeObject *type, __Pyx_PyAsyncMethodsStruct *static_amsend_methods, __Pyx_pyiter_sendfunc am_send); +#endif +static PyObject *__Pyx_Coroutine_fail_reduce_ex(PyObject *self, PyObject *arg); + +/* Generator.proto */ +#define __Pyx_Generator_USED +#define __Pyx_Generator_CheckExact(obj) __Pyx_IS_TYPE(obj, __pyx_mstate_global->__pyx_GeneratorType) +#define __Pyx_Generator_New(body, code, closure, name, qualname, module_name)\ + __Pyx__Coroutine_New(__pyx_mstate_global->__pyx_GeneratorType, body, code, closure, name, qualname, module_name) +static PyObject *__Pyx_Generator_Next(PyObject *self); +static int __pyx_Generator_init(PyObject *module); +static CYTHON_INLINE PyObject *__Pyx_Generator_GetInlinedResult(PyObject *self); + +/* 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 "." + +static PyObject *__pyx_array_get_memview(struct __pyx_array_obj *__pyx_v_self); /* proto*/ +static char *__pyx_memoryview_get_item_pointer(struct __pyx_memoryview_obj *__pyx_v_self, PyObject *__pyx_v_index); /* proto*/ +static PyObject *__pyx_memoryview_is_slice(struct __pyx_memoryview_obj *__pyx_v_self, PyObject *__pyx_v_obj); /* proto*/ +static PyObject *__pyx_memoryview_setitem_slice_assignment(struct __pyx_memoryview_obj *__pyx_v_self, PyObject *__pyx_v_dst, PyObject *__pyx_v_src); /* proto*/ +static PyObject *__pyx_memoryview_setitem_slice_assign_scalar(struct __pyx_memoryview_obj *__pyx_v_self, struct __pyx_memoryview_obj *__pyx_v_dst, PyObject *__pyx_v_value); /* proto*/ +static PyObject *__pyx_memoryview_setitem_indexed(struct __pyx_memoryview_obj *__pyx_v_self, PyObject *__pyx_v_index, PyObject *__pyx_v_value); /* proto*/ +static PyObject *__pyx_memoryview_convert_item_to_object(struct __pyx_memoryview_obj *__pyx_v_self, char *__pyx_v_itemp); /* proto*/ +static PyObject *__pyx_memoryview_assign_item_from_object(struct __pyx_memoryview_obj *__pyx_v_self, char *__pyx_v_itemp, PyObject *__pyx_v_value); /* proto*/ +static PyObject *__pyx_memoryview__get_base(struct __pyx_memoryview_obj *__pyx_v_self); /* proto*/ +static PyObject *__pyx_memoryviewslice_convert_item_to_object(struct __pyx_memoryviewslice_obj *__pyx_v_self, char *__pyx_v_itemp); /* proto*/ +static PyObject *__pyx_memoryviewslice_assign_item_from_object(struct __pyx_memoryviewslice_obj *__pyx_v_self, char *__pyx_v_itemp, PyObject *__pyx_v_value); /* proto*/ +static PyObject *__pyx_memoryviewslice__get_base(struct __pyx_memoryviewslice_obj *__pyx_v_self); /* proto*/ +static CYTHON_INLINE void *__pyx_f_5thinc_5extra_6search_4Beam_at(struct __pyx_obj_5thinc_5extra_6search_Beam *__pyx_v_self, int __pyx_v_i); /* proto*/ +static CYTHON_INLINE void __pyx_f_5thinc_5extra_6search_4Beam_set_cell(struct __pyx_obj_5thinc_5extra_6search_Beam *__pyx_v_self, int __pyx_v_i, int __pyx_v_j, __pyx_t_5thinc_5extra_6search_weight_t __pyx_v_score, int __pyx_v_is_valid, __pyx_t_5thinc_5extra_6search_weight_t __pyx_v_cost); /* proto*/ +static CYTHON_INLINE npy_intp __pyx_f_5numpy_5dtype_8itemsize_itemsize(PyArray_Descr *__pyx_v_self); /* proto*/ +static CYTHON_INLINE npy_intp __pyx_f_5numpy_5dtype_9alignment_alignment(PyArray_Descr *__pyx_v_self); /* proto*/ +static CYTHON_INLINE PyObject *__pyx_f_5numpy_5dtype_6fields_fields(PyArray_Descr *__pyx_v_self); /* proto*/ +static CYTHON_INLINE PyObject *__pyx_f_5numpy_5dtype_5names_names(PyArray_Descr *__pyx_v_self); /* proto*/ +static CYTHON_INLINE PyArray_ArrayDescr *__pyx_f_5numpy_5dtype_8subarray_subarray(PyArray_Descr *__pyx_v_self); /* proto*/ +static CYTHON_INLINE npy_uint64 __pyx_f_5numpy_5dtype_5flags_flags(PyArray_Descr *__pyx_v_self); /* proto*/ +static CYTHON_INLINE int __pyx_f_5numpy_9broadcast_7numiter_numiter(PyArrayMultiIterObject *__pyx_v_self); /* proto*/ +static CYTHON_INLINE npy_intp __pyx_f_5numpy_9broadcast_4size_size(PyArrayMultiIterObject *__pyx_v_self); /* proto*/ +static CYTHON_INLINE npy_intp __pyx_f_5numpy_9broadcast_5index_index(PyArrayMultiIterObject *__pyx_v_self); /* proto*/ +static CYTHON_INLINE int __pyx_f_5numpy_9broadcast_2nd_nd(PyArrayMultiIterObject *__pyx_v_self); /* proto*/ +static CYTHON_INLINE npy_intp *__pyx_f_5numpy_9broadcast_10dimensions_dimensions(PyArrayMultiIterObject *__pyx_v_self); /* proto*/ +static CYTHON_INLINE void **__pyx_f_5numpy_9broadcast_5iters_iters(PyArrayMultiIterObject *__pyx_v_self); /* proto*/ +static CYTHON_INLINE PyObject *__pyx_f_5numpy_7ndarray_4base_base(PyArrayObject *__pyx_v_self); /* proto*/ +static CYTHON_INLINE PyArray_Descr *__pyx_f_5numpy_7ndarray_5descr_descr(PyArrayObject *__pyx_v_self); /* proto*/ +static CYTHON_INLINE int __pyx_f_5numpy_7ndarray_4ndim_ndim(PyArrayObject *__pyx_v_self); /* proto*/ +static CYTHON_INLINE npy_intp *__pyx_f_5numpy_7ndarray_5shape_shape(PyArrayObject *__pyx_v_self); /* proto*/ +static CYTHON_INLINE npy_intp *__pyx_f_5numpy_7ndarray_7strides_strides(PyArrayObject *__pyx_v_self); /* proto*/ +static CYTHON_INLINE npy_intp __pyx_f_5numpy_7ndarray_4size_size(PyArrayObject *__pyx_v_self); /* proto*/ +static CYTHON_INLINE char *__pyx_f_5numpy_7ndarray_4data_data(PyArrayObject *__pyx_v_self); /* proto*/ +static CYTHON_INLINE struct __pyx_obj_5spacy_6lexeme_Lexeme *__pyx_f_5spacy_6lexeme_6Lexeme_from_ptr(struct __pyx_t_5spacy_7structs_LexemeC *__pyx_v_lex, struct __pyx_obj_5spacy_5vocab_Vocab *__pyx_v_vocab); /* proto*/ +static CYTHON_INLINE void __pyx_f_5spacy_6lexeme_6Lexeme_set_struct_attr(struct __pyx_t_5spacy_7structs_LexemeC *__pyx_v_lex, enum __pyx_t_5spacy_5attrs_attr_id_t __pyx_v_name, __pyx_t_5spacy_8typedefs_attr_t __pyx_v_value); /* proto*/ +static CYTHON_INLINE __pyx_t_5spacy_8typedefs_attr_t __pyx_f_5spacy_6lexeme_6Lexeme_get_struct_attr(struct __pyx_t_5spacy_7structs_LexemeC const *__pyx_v_lex, enum __pyx_t_5spacy_5attrs_attr_id_t __pyx_v_feat_name); /* proto*/ +static CYTHON_INLINE int __pyx_f_5spacy_6lexeme_6Lexeme_c_check_flag(struct __pyx_t_5spacy_7structs_LexemeC const *__pyx_v_lexeme, enum __pyx_t_5spacy_5attrs_attr_id_t __pyx_v_flag_id); /* proto*/ +static CYTHON_INLINE int __pyx_f_5spacy_6lexeme_6Lexeme_c_set_flag(struct __pyx_t_5spacy_7structs_LexemeC *__pyx_v_lex, enum __pyx_t_5spacy_5attrs_attr_id_t __pyx_v_flag_id, int __pyx_v_value); /* proto*/ +static CYTHON_INLINE struct __pyx_obj_5spacy_8pipeline_17_parser_internals_10stateclass_StateClass *__pyx_f_5spacy_8pipeline_17_parser_internals_10stateclass_10StateClass_borrow(__pyx_t_5spacy_8pipeline_17_parser_internals_6_state_StateC *__pyx_v_ptr, struct __pyx_obj_5spacy_6tokens_3doc_Doc *__pyx_v_doc); /* proto*/ +static CYTHON_INLINE struct __pyx_obj_5spacy_8pipeline_17_parser_internals_10stateclass_StateClass *__pyx_f_5spacy_8pipeline_17_parser_internals_10stateclass_10StateClass_init_offset(struct __pyx_t_5spacy_7structs_TokenC const *__pyx_v_sent, int __pyx_v_length, int __pyx_v_offset); /* proto*/ +static int __pyx_f_5spacy_8pipeline_17_parser_internals_11_beam_utils_9BeamBatch__set_scores(struct __pyx_obj_5spacy_8pipeline_17_parser_internals_11_beam_utils_BeamBatch *__pyx_v_self, struct __pyx_obj_5thinc_5extra_6search_Beam *__pyx_v_beam, float const *__pyx_v_scores, int __pyx_v_nr_class); /* proto*/ + +/* Module declarations from "libc.stdint" */ + +/* Module declarations from "spacy.typedefs" */ + +/* Module declarations from "cymem.cymem" */ + +/* Module declarations from "libcpp.utility" */ + +/* Module declarations from "libcpp.pair" */ + +/* Module declarations from "libcpp.queue" */ + +/* Module declarations from "libcpp.vector" */ + +/* Module declarations from "thinc.extra.search" */ + +/* Module declarations from "libcpp.set" */ + +/* Module declarations from "murmurhash.mrmr" */ +static uint64_t (*__pyx_f_10murmurhash_4mrmr_hash64)(void *, int, uint64_t); /*proto*/ + +/* Module declarations from "preshed.maps" */ + +/* Module declarations from "spacy.strings" */ + +/* Module declarations from "libcpp.unordered_map" */ + +/* Module declarations from "libcpp.unordered_set" */ + +/* Module declarations from "spacy" */ + +/* Module declarations from "spacy.symbols" */ + +/* Module declarations from "spacy.parts_of_speech" */ + +/* Module declarations from "spacy.structs" */ + +/* Module declarations from "libc.string" */ + +/* Module declarations from "libc.stdio" */ + +/* Module declarations from "__builtin__" */ + +/* Module declarations from "cpython.type" */ + +/* Module declarations from "cpython" */ + +/* Module declarations from "cpython.object" */ + +/* Module declarations from "cpython.ref" */ + +/* Module declarations from "numpy" */ + +/* Module declarations from "numpy" */ + +/* Module declarations from "spacy.attrs" */ + +/* Module declarations from "spacy.morphology" */ + +/* Module declarations from "spacy.vocab" */ +static struct __pyx_t_5spacy_7structs_LexemeC *__pyx_vp_5spacy_5vocab_EMPTY_LEXEME = 0; +#define __pyx_v_5spacy_5vocab_EMPTY_LEXEME (*__pyx_vp_5spacy_5vocab_EMPTY_LEXEME) + +/* Module declarations from "spacy.tokens.doc" */ + +/* Module declarations from "spacy.training.example" */ + +/* Module declarations from "libcpp" */ + +/* Module declarations from "cpython.exc" */ + +/* Module declarations from "libc.stdlib" */ + +/* Module declarations from "spacy.lexeme" */ +static struct __pyx_t_5spacy_7structs_LexemeC *__pyx_vp_5spacy_6lexeme_EMPTY_LEXEME = 0; +#define __pyx_v_5spacy_6lexeme_EMPTY_LEXEME (*__pyx_vp_5spacy_6lexeme_EMPTY_LEXEME) +static __pyx_t_5spacy_8typedefs_attr_t *__pyx_vp_5spacy_6lexeme_OOV_RANK = 0; +#define __pyx_v_5spacy_6lexeme_OOV_RANK (*__pyx_vp_5spacy_6lexeme_OOV_RANK) + +/* Module declarations from "spacy.pipeline._parser_internals._state" */ + +/* Module declarations from "spacy.pipeline._parser_internals.stateclass" */ + +/* Module declarations from "spacy.pipeline._parser_internals.transition_system" */ + +/* Module declarations from "spacy.pipeline._parser_internals._beam_utils" */ +static PyObject *__pyx_collections_abc_Sequence = 0; +static PyObject *generic = 0; +static PyObject *strided = 0; +static PyObject *indirect = 0; +static PyObject *contiguous = 0; +static PyObject *indirect_contiguous = 0; +static int __pyx_memoryview_thread_locks_used; +static PyThread_type_lock __pyx_memoryview_thread_locks[8]; +static int __pyx_f_5spacy_8pipeline_17_parser_internals_11_beam_utils_transition_state(void *, void *, __pyx_t_5spacy_8typedefs_class_t, void *); /*proto*/ +static int __pyx_f_5spacy_8pipeline_17_parser_internals_11_beam_utils_check_final_state(void *, void *); /*proto*/ +static PyObject *__pyx_f_5spacy_8pipeline_17_parser_internals_11_beam_utils___pyx_unpickle_BeamBatch__set_state(struct __pyx_obj_5spacy_8pipeline_17_parser_internals_11_beam_utils_BeamBatch *, PyObject *); /*proto*/ +static int __pyx_array_allocate_buffer(struct __pyx_array_obj *); /*proto*/ +static struct __pyx_array_obj *__pyx_array_new(PyObject *, Py_ssize_t, char *, char const *, char *); /*proto*/ +static PyObject *__pyx_memoryview_new(PyObject *, int, int, __Pyx_TypeInfo const *); /*proto*/ +static CYTHON_INLINE int __pyx_memoryview_check(PyObject *); /*proto*/ +static PyObject *_unellipsify(PyObject *, int); /*proto*/ +static int assert_direct_dimensions(Py_ssize_t *, int); /*proto*/ +static struct __pyx_memoryview_obj *__pyx_memview_slice(struct __pyx_memoryview_obj *, PyObject *); /*proto*/ +static int __pyx_memoryview_slice_memviewslice(__Pyx_memviewslice *, Py_ssize_t, Py_ssize_t, Py_ssize_t, int, int, int *, Py_ssize_t, Py_ssize_t, Py_ssize_t, int, int, int, int); /*proto*/ +static char *__pyx_pybuffer_index(Py_buffer *, char *, Py_ssize_t, Py_ssize_t); /*proto*/ +static int __pyx_memslice_transpose(__Pyx_memviewslice *); /*proto*/ +static PyObject *__pyx_memoryview_fromslice(__Pyx_memviewslice, int, PyObject *(*)(char *), int (*)(char *, PyObject *), int); /*proto*/ +static __Pyx_memviewslice *__pyx_memoryview_get_slice_from_memoryview(struct __pyx_memoryview_obj *, __Pyx_memviewslice *); /*proto*/ +static void __pyx_memoryview_slice_copy(struct __pyx_memoryview_obj *, __Pyx_memviewslice *); /*proto*/ +static PyObject *__pyx_memoryview_copy_object(struct __pyx_memoryview_obj *); /*proto*/ +static PyObject *__pyx_memoryview_copy_object_from_slice(struct __pyx_memoryview_obj *, __Pyx_memviewslice *); /*proto*/ +static Py_ssize_t abs_py_ssize_t(Py_ssize_t); /*proto*/ +static char __pyx_get_best_slice_order(__Pyx_memviewslice *, int); /*proto*/ +static void _copy_strided_to_strided(char *, Py_ssize_t *, char *, Py_ssize_t *, Py_ssize_t *, Py_ssize_t *, int, size_t); /*proto*/ +static void copy_strided_to_strided(__Pyx_memviewslice *, __Pyx_memviewslice *, int, size_t); /*proto*/ +static Py_ssize_t __pyx_memoryview_slice_get_size(__Pyx_memviewslice *, int); /*proto*/ +static Py_ssize_t __pyx_fill_contig_strides_array(Py_ssize_t *, Py_ssize_t *, Py_ssize_t, int, char); /*proto*/ +static void *__pyx_memoryview_copy_data_to_temp(__Pyx_memviewslice *, __Pyx_memviewslice *, char, int); /*proto*/ +static int __pyx_memoryview_err_extents(int, Py_ssize_t, Py_ssize_t); /*proto*/ +static int __pyx_memoryview_err_dim(PyObject *, PyObject *, int); /*proto*/ +static int __pyx_memoryview_err(PyObject *, PyObject *); /*proto*/ +static int __pyx_memoryview_err_no_memory(void); /*proto*/ +static int __pyx_memoryview_copy_contents(__Pyx_memviewslice, __Pyx_memviewslice, int, int, int); /*proto*/ +static void __pyx_memoryview_broadcast_leading(__Pyx_memviewslice *, int, int); /*proto*/ +static void __pyx_memoryview_refcount_copying(__Pyx_memviewslice *, int, int, int); /*proto*/ +static void __pyx_memoryview_refcount_objects_in_slice_with_gil(char *, Py_ssize_t *, Py_ssize_t *, int, int); /*proto*/ +static void __pyx_memoryview_refcount_objects_in_slice(char *, Py_ssize_t *, Py_ssize_t *, int, int); /*proto*/ +static void __pyx_memoryview_slice_assign_scalar(__Pyx_memviewslice *, int, size_t, void *, int); /*proto*/ +static void __pyx_memoryview__slice_assign_scalar(char *, Py_ssize_t *, Py_ssize_t *, int, size_t, void *); /*proto*/ +static PyObject *__pyx_unpickle_Enum__set_state(struct __pyx_MemviewEnum_obj *, PyObject *); /*proto*/ +/* #### Code section: typeinfo ### */ +static const __Pyx_TypeInfo __Pyx_TypeInfo_float = { "float", NULL, sizeof(float), { 0 }, 0, 'R', 0, 0 }; +/* #### Code section: before_global_var ### */ +#define __Pyx_MODULE_NAME "spacy.pipeline._parser_internals._beam_utils" +extern int __pyx_module_is_main_spacy__pipeline___parser_internals___beam_utils; +int __pyx_module_is_main_spacy__pipeline___parser_internals___beam_utils = 0; + +/* Implementation of "spacy.pipeline._parser_internals._beam_utils" */ +/* #### Code section: global_var ### */ +static PyObject *__pyx_builtin_zip; +static PyObject *__pyx_builtin_enumerate; +static PyObject *__pyx_builtin_max; +static PyObject *__pyx_builtin___import__; +static PyObject *__pyx_builtin_Ellipsis; +static PyObject *__pyx_builtin_id; +/* #### Code section: string_decls ### */ +/* #### Code section: decls ### */ +static int __pyx_array___pyx_pf_15View_dot_MemoryView_5array___cinit__(struct __pyx_array_obj *__pyx_v_self, PyObject *__pyx_v_shape, Py_ssize_t __pyx_v_itemsize, PyObject *__pyx_v_format, PyObject *__pyx_v_mode, int __pyx_v_allocate_buffer); /* proto */ +static int __pyx_array___pyx_pf_15View_dot_MemoryView_5array_2__getbuffer__(struct __pyx_array_obj *__pyx_v_self, Py_buffer *__pyx_v_info, int __pyx_v_flags); /* proto */ +static void __pyx_array___pyx_pf_15View_dot_MemoryView_5array_4__dealloc__(struct __pyx_array_obj *__pyx_v_self); /* proto */ +static PyObject *__pyx_pf_15View_dot_MemoryView_5array_7memview___get__(struct __pyx_array_obj *__pyx_v_self); /* proto */ +static Py_ssize_t __pyx_array___pyx_pf_15View_dot_MemoryView_5array_6__len__(struct __pyx_array_obj *__pyx_v_self); /* proto */ +static PyObject *__pyx_array___pyx_pf_15View_dot_MemoryView_5array_8__getattr__(struct __pyx_array_obj *__pyx_v_self, PyObject *__pyx_v_attr); /* proto */ +static PyObject *__pyx_array___pyx_pf_15View_dot_MemoryView_5array_10__getitem__(struct __pyx_array_obj *__pyx_v_self, PyObject *__pyx_v_item); /* proto */ +static int __pyx_array___pyx_pf_15View_dot_MemoryView_5array_12__setitem__(struct __pyx_array_obj *__pyx_v_self, PyObject *__pyx_v_item, PyObject *__pyx_v_value); /* proto */ +static PyObject *__pyx_pf___pyx_array___reduce_cython__(CYTHON_UNUSED struct __pyx_array_obj *__pyx_v_self); /* proto */ +static PyObject *__pyx_pf___pyx_array_2__setstate_cython__(CYTHON_UNUSED struct __pyx_array_obj *__pyx_v_self, CYTHON_UNUSED PyObject *__pyx_v___pyx_state); /* proto */ +static int __pyx_MemviewEnum___pyx_pf_15View_dot_MemoryView_4Enum___init__(struct __pyx_MemviewEnum_obj *__pyx_v_self, PyObject *__pyx_v_name); /* proto */ +static PyObject *__pyx_MemviewEnum___pyx_pf_15View_dot_MemoryView_4Enum_2__repr__(struct __pyx_MemviewEnum_obj *__pyx_v_self); /* proto */ +static PyObject *__pyx_pf___pyx_MemviewEnum___reduce_cython__(struct __pyx_MemviewEnum_obj *__pyx_v_self); /* proto */ +static PyObject *__pyx_pf___pyx_MemviewEnum_2__setstate_cython__(struct __pyx_MemviewEnum_obj *__pyx_v_self, PyObject *__pyx_v___pyx_state); /* proto */ +static int __pyx_memoryview___pyx_pf_15View_dot_MemoryView_10memoryview___cinit__(struct __pyx_memoryview_obj *__pyx_v_self, PyObject *__pyx_v_obj, int __pyx_v_flags, int __pyx_v_dtype_is_object); /* proto */ +static void __pyx_memoryview___pyx_pf_15View_dot_MemoryView_10memoryview_2__dealloc__(struct __pyx_memoryview_obj *__pyx_v_self); /* proto */ +static PyObject *__pyx_memoryview___pyx_pf_15View_dot_MemoryView_10memoryview_4__getitem__(struct __pyx_memoryview_obj *__pyx_v_self, PyObject *__pyx_v_index); /* proto */ +static int __pyx_memoryview___pyx_pf_15View_dot_MemoryView_10memoryview_6__setitem__(struct __pyx_memoryview_obj *__pyx_v_self, PyObject *__pyx_v_index, PyObject *__pyx_v_value); /* proto */ +static int __pyx_memoryview___pyx_pf_15View_dot_MemoryView_10memoryview_8__getbuffer__(struct __pyx_memoryview_obj *__pyx_v_self, Py_buffer *__pyx_v_info, int __pyx_v_flags); /* proto */ +static PyObject *__pyx_pf_15View_dot_MemoryView_10memoryview_1T___get__(struct __pyx_memoryview_obj *__pyx_v_self); /* proto */ +static PyObject *__pyx_pf_15View_dot_MemoryView_10memoryview_4base___get__(struct __pyx_memoryview_obj *__pyx_v_self); /* proto */ +static PyObject *__pyx_pf_15View_dot_MemoryView_10memoryview_5shape___get__(struct __pyx_memoryview_obj *__pyx_v_self); /* proto */ +static PyObject *__pyx_pf_15View_dot_MemoryView_10memoryview_7strides___get__(struct __pyx_memoryview_obj *__pyx_v_self); /* proto */ +static PyObject *__pyx_pf_15View_dot_MemoryView_10memoryview_10suboffsets___get__(struct __pyx_memoryview_obj *__pyx_v_self); /* proto */ +static PyObject *__pyx_pf_15View_dot_MemoryView_10memoryview_4ndim___get__(struct __pyx_memoryview_obj *__pyx_v_self); /* proto */ +static PyObject *__pyx_pf_15View_dot_MemoryView_10memoryview_8itemsize___get__(struct __pyx_memoryview_obj *__pyx_v_self); /* proto */ +static PyObject *__pyx_pf_15View_dot_MemoryView_10memoryview_6nbytes___get__(struct __pyx_memoryview_obj *__pyx_v_self); /* proto */ +static PyObject *__pyx_pf_15View_dot_MemoryView_10memoryview_4size___get__(struct __pyx_memoryview_obj *__pyx_v_self); /* proto */ +static Py_ssize_t __pyx_memoryview___pyx_pf_15View_dot_MemoryView_10memoryview_10__len__(struct __pyx_memoryview_obj *__pyx_v_self); /* proto */ +static PyObject *__pyx_memoryview___pyx_pf_15View_dot_MemoryView_10memoryview_12__repr__(struct __pyx_memoryview_obj *__pyx_v_self); /* proto */ +static PyObject *__pyx_memoryview___pyx_pf_15View_dot_MemoryView_10memoryview_14__str__(struct __pyx_memoryview_obj *__pyx_v_self); /* proto */ +static PyObject *__pyx_memoryview___pyx_pf_15View_dot_MemoryView_10memoryview_16is_c_contig(struct __pyx_memoryview_obj *__pyx_v_self); /* proto */ +static PyObject *__pyx_memoryview___pyx_pf_15View_dot_MemoryView_10memoryview_18is_f_contig(struct __pyx_memoryview_obj *__pyx_v_self); /* proto */ +static PyObject *__pyx_memoryview___pyx_pf_15View_dot_MemoryView_10memoryview_20copy(struct __pyx_memoryview_obj *__pyx_v_self); /* proto */ +static PyObject *__pyx_memoryview___pyx_pf_15View_dot_MemoryView_10memoryview_22copy_fortran(struct __pyx_memoryview_obj *__pyx_v_self); /* proto */ +static PyObject *__pyx_pf___pyx_memoryview___reduce_cython__(CYTHON_UNUSED struct __pyx_memoryview_obj *__pyx_v_self); /* proto */ +static PyObject *__pyx_pf___pyx_memoryview_2__setstate_cython__(CYTHON_UNUSED struct __pyx_memoryview_obj *__pyx_v_self, CYTHON_UNUSED PyObject *__pyx_v___pyx_state); /* proto */ +static void __pyx_memoryviewslice___pyx_pf_15View_dot_MemoryView_16_memoryviewslice___dealloc__(struct __pyx_memoryviewslice_obj *__pyx_v_self); /* proto */ +static PyObject *__pyx_pf___pyx_memoryviewslice___reduce_cython__(CYTHON_UNUSED struct __pyx_memoryviewslice_obj *__pyx_v_self); /* proto */ +static PyObject *__pyx_pf___pyx_memoryviewslice_2__setstate_cython__(CYTHON_UNUSED struct __pyx_memoryviewslice_obj *__pyx_v_self, CYTHON_UNUSED PyObject *__pyx_v___pyx_state); /* proto */ +static PyObject *__pyx_pf_15View_dot_MemoryView___pyx_unpickle_Enum(CYTHON_UNUSED PyObject *__pyx_self, PyObject *__pyx_v___pyx_type, long __pyx_v___pyx_checksum, PyObject *__pyx_v___pyx_state); /* proto */ +static int __pyx_pf_5spacy_8pipeline_17_parser_internals_11_beam_utils_9BeamBatch___init__(struct __pyx_obj_5spacy_8pipeline_17_parser_internals_11_beam_utils_BeamBatch *__pyx_v_self, struct __pyx_obj_5spacy_8pipeline_17_parser_internals_17transition_system_TransitionSystem *__pyx_v_moves, PyObject *__pyx_v_states, PyObject *__pyx_v_golds, int __pyx_v_width, float __pyx_v_density); /* proto */ +static PyObject *__pyx_pf_5spacy_8pipeline_17_parser_internals_11_beam_utils_9BeamBatch_7is_done_7__get___genexpr(CYTHON_UNUSED PyObject *__pyx_self, PyObject *__pyx_genexpr_arg_0); /* proto */ +static PyObject *__pyx_pf_5spacy_8pipeline_17_parser_internals_11_beam_utils_9BeamBatch_7is_done___get__(struct __pyx_obj_5spacy_8pipeline_17_parser_internals_11_beam_utils_BeamBatch *__pyx_v_self); /* proto */ +static PyObject *__pyx_pf_5spacy_8pipeline_17_parser_internals_11_beam_utils_9BeamBatch_2__getitem__(struct __pyx_obj_5spacy_8pipeline_17_parser_internals_11_beam_utils_BeamBatch *__pyx_v_self, PyObject *__pyx_v_i); /* proto */ +static Py_ssize_t __pyx_pf_5spacy_8pipeline_17_parser_internals_11_beam_utils_9BeamBatch_4__len__(struct __pyx_obj_5spacy_8pipeline_17_parser_internals_11_beam_utils_BeamBatch *__pyx_v_self); /* proto */ +static PyObject *__pyx_pf_5spacy_8pipeline_17_parser_internals_11_beam_utils_9BeamBatch_6get_states(struct __pyx_obj_5spacy_8pipeline_17_parser_internals_11_beam_utils_BeamBatch *__pyx_v_self); /* proto */ +static PyObject *__pyx_pf_5spacy_8pipeline_17_parser_internals_11_beam_utils_9BeamBatch_8get_unfinished_states(struct __pyx_obj_5spacy_8pipeline_17_parser_internals_11_beam_utils_BeamBatch *__pyx_v_self); /* proto */ +static PyObject *__pyx_pf_5spacy_8pipeline_17_parser_internals_11_beam_utils_9BeamBatch_10advance(struct __pyx_obj_5spacy_8pipeline_17_parser_internals_11_beam_utils_BeamBatch *__pyx_v_self, __Pyx_memviewslice __pyx_v_scores, PyObject *__pyx_v_follow_gold); /* proto */ +static PyObject *__pyx_pf_5spacy_8pipeline_17_parser_internals_11_beam_utils_9BeamBatch_12_set_costs(struct __pyx_obj_5spacy_8pipeline_17_parser_internals_11_beam_utils_BeamBatch *__pyx_v_self, struct __pyx_obj_5thinc_5extra_6search_Beam *__pyx_v_beam, CYTHON_UNUSED PyObject *__pyx_v_doc, PyObject *__pyx_v_gold, int __pyx_v_follow_gold); /* proto */ +static PyObject *__pyx_pf_5spacy_8pipeline_17_parser_internals_11_beam_utils_9BeamBatch_5moves___get__(struct __pyx_obj_5spacy_8pipeline_17_parser_internals_11_beam_utils_BeamBatch *__pyx_v_self); /* proto */ +static int __pyx_pf_5spacy_8pipeline_17_parser_internals_11_beam_utils_9BeamBatch_5moves_2__set__(struct __pyx_obj_5spacy_8pipeline_17_parser_internals_11_beam_utils_BeamBatch *__pyx_v_self, PyObject *__pyx_v_value); /* proto */ +static int __pyx_pf_5spacy_8pipeline_17_parser_internals_11_beam_utils_9BeamBatch_5moves_4__del__(struct __pyx_obj_5spacy_8pipeline_17_parser_internals_11_beam_utils_BeamBatch *__pyx_v_self); /* proto */ +static PyObject *__pyx_pf_5spacy_8pipeline_17_parser_internals_11_beam_utils_9BeamBatch_6states___get__(struct __pyx_obj_5spacy_8pipeline_17_parser_internals_11_beam_utils_BeamBatch *__pyx_v_self); /* proto */ +static int __pyx_pf_5spacy_8pipeline_17_parser_internals_11_beam_utils_9BeamBatch_6states_2__set__(struct __pyx_obj_5spacy_8pipeline_17_parser_internals_11_beam_utils_BeamBatch *__pyx_v_self, PyObject *__pyx_v_value); /* proto */ +static int __pyx_pf_5spacy_8pipeline_17_parser_internals_11_beam_utils_9BeamBatch_6states_4__del__(struct __pyx_obj_5spacy_8pipeline_17_parser_internals_11_beam_utils_BeamBatch *__pyx_v_self); /* proto */ +static PyObject *__pyx_pf_5spacy_8pipeline_17_parser_internals_11_beam_utils_9BeamBatch_4docs___get__(struct __pyx_obj_5spacy_8pipeline_17_parser_internals_11_beam_utils_BeamBatch *__pyx_v_self); /* proto */ +static int __pyx_pf_5spacy_8pipeline_17_parser_internals_11_beam_utils_9BeamBatch_4docs_2__set__(struct __pyx_obj_5spacy_8pipeline_17_parser_internals_11_beam_utils_BeamBatch *__pyx_v_self, PyObject *__pyx_v_value); /* proto */ +static int __pyx_pf_5spacy_8pipeline_17_parser_internals_11_beam_utils_9BeamBatch_4docs_4__del__(struct __pyx_obj_5spacy_8pipeline_17_parser_internals_11_beam_utils_BeamBatch *__pyx_v_self); /* proto */ +static PyObject *__pyx_pf_5spacy_8pipeline_17_parser_internals_11_beam_utils_9BeamBatch_5golds___get__(struct __pyx_obj_5spacy_8pipeline_17_parser_internals_11_beam_utils_BeamBatch *__pyx_v_self); /* proto */ +static int __pyx_pf_5spacy_8pipeline_17_parser_internals_11_beam_utils_9BeamBatch_5golds_2__set__(struct __pyx_obj_5spacy_8pipeline_17_parser_internals_11_beam_utils_BeamBatch *__pyx_v_self, PyObject *__pyx_v_value); /* proto */ +static int __pyx_pf_5spacy_8pipeline_17_parser_internals_11_beam_utils_9BeamBatch_5golds_4__del__(struct __pyx_obj_5spacy_8pipeline_17_parser_internals_11_beam_utils_BeamBatch *__pyx_v_self); /* proto */ +static PyObject *__pyx_pf_5spacy_8pipeline_17_parser_internals_11_beam_utils_9BeamBatch_5beams___get__(struct __pyx_obj_5spacy_8pipeline_17_parser_internals_11_beam_utils_BeamBatch *__pyx_v_self); /* proto */ +static int __pyx_pf_5spacy_8pipeline_17_parser_internals_11_beam_utils_9BeamBatch_5beams_2__set__(struct __pyx_obj_5spacy_8pipeline_17_parser_internals_11_beam_utils_BeamBatch *__pyx_v_self, PyObject *__pyx_v_value); /* proto */ +static int __pyx_pf_5spacy_8pipeline_17_parser_internals_11_beam_utils_9BeamBatch_5beams_4__del__(struct __pyx_obj_5spacy_8pipeline_17_parser_internals_11_beam_utils_BeamBatch *__pyx_v_self); /* proto */ +static PyObject *__pyx_pf_5spacy_8pipeline_17_parser_internals_11_beam_utils_9BeamBatch_14__reduce_cython__(struct __pyx_obj_5spacy_8pipeline_17_parser_internals_11_beam_utils_BeamBatch *__pyx_v_self); /* proto */ +static PyObject *__pyx_pf_5spacy_8pipeline_17_parser_internals_11_beam_utils_9BeamBatch_16__setstate_cython__(struct __pyx_obj_5spacy_8pipeline_17_parser_internals_11_beam_utils_BeamBatch *__pyx_v_self, PyObject *__pyx_v___pyx_state); /* proto */ +static PyObject *__pyx_pf_5spacy_8pipeline_17_parser_internals_11_beam_utils_update_beam(CYTHON_UNUSED PyObject *__pyx_self, struct __pyx_obj_5spacy_8pipeline_17_parser_internals_17transition_system_TransitionSystem *__pyx_v_moves, PyObject *__pyx_v_states, PyObject *__pyx_v_golds, PyObject *__pyx_v_model, int __pyx_v_width, PyObject *__pyx_v_beam_density); /* proto */ +static PyObject *__pyx_pf_5spacy_8pipeline_17_parser_internals_11_beam_utils_2collect_states(CYTHON_UNUSED PyObject *__pyx_self, PyObject *__pyx_v_beams, PyObject *__pyx_v_docs); /* proto */ +static PyObject *__pyx_pf_5spacy_8pipeline_17_parser_internals_11_beam_utils_4get_unique_states(CYTHON_UNUSED PyObject *__pyx_self, PyObject *__pyx_v_pbeams, PyObject *__pyx_v_gbeams); /* proto */ +static PyObject *__pyx_pf_5spacy_8pipeline_17_parser_internals_11_beam_utils_6get_gradient(CYTHON_UNUSED PyObject *__pyx_self, PyObject *__pyx_v_nr_class, PyObject *__pyx_v_beam_maps, PyObject *__pyx_v_histories, PyObject *__pyx_v_losses); /* proto */ +static PyObject *__pyx_pf_5spacy_8pipeline_17_parser_internals_11_beam_utils_8__pyx_unpickle_BeamBatch(CYTHON_UNUSED PyObject *__pyx_self, PyObject *__pyx_v___pyx_type, long __pyx_v___pyx_checksum, PyObject *__pyx_v___pyx_state); /* proto */ +static PyObject *__pyx_tp_new_5spacy_8pipeline_17_parser_internals_11_beam_utils_BeamBatch(PyTypeObject *t, PyObject *a, PyObject *k); /*proto*/ +static PyObject *__pyx_tp_new_5spacy_8pipeline_17_parser_internals_11_beam_utils___pyx_scope_struct__genexpr(PyTypeObject *t, PyObject *a, PyObject *k); /*proto*/ +static PyObject *__pyx_tp_new_array(PyTypeObject *t, PyObject *a, PyObject *k); /*proto*/ +static PyObject *__pyx_tp_new_Enum(PyTypeObject *t, PyObject *a, PyObject *k); /*proto*/ +static PyObject *__pyx_tp_new_memoryview(PyTypeObject *t, PyObject *a, PyObject *k); /*proto*/ +static PyObject *__pyx_tp_new__memoryviewslice(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_5cymem_5cymem_PyMalloc; + PyTypeObject *__pyx_ptype_5cymem_5cymem_PyFree; + PyTypeObject *__pyx_ptype_5cymem_5cymem_Pool; + PyTypeObject *__pyx_ptype_5cymem_5cymem_Address; + PyTypeObject *__pyx_ptype_5thinc_5extra_6search_Beam; + PyTypeObject *__pyx_ptype_5thinc_5extra_6search_MaxViolation; + PyTypeObject *__pyx_ptype_7preshed_4maps_PreshMap; + PyTypeObject *__pyx_ptype_7preshed_4maps_PreshMapArray; + PyTypeObject *__pyx_ptype_5spacy_7strings_StringStore; + PyTypeObject *__pyx_ptype_7cpython_4type_type; + PyTypeObject *__pyx_ptype_5numpy_dtype; + PyTypeObject *__pyx_ptype_5numpy_flatiter; + PyTypeObject *__pyx_ptype_5numpy_broadcast; + PyTypeObject *__pyx_ptype_5numpy_ndarray; + PyTypeObject *__pyx_ptype_5numpy_generic; + PyTypeObject *__pyx_ptype_5numpy_number; + PyTypeObject *__pyx_ptype_5numpy_integer; + PyTypeObject *__pyx_ptype_5numpy_signedinteger; + PyTypeObject *__pyx_ptype_5numpy_unsignedinteger; + PyTypeObject *__pyx_ptype_5numpy_inexact; + PyTypeObject *__pyx_ptype_5numpy_floating; + PyTypeObject *__pyx_ptype_5numpy_complexfloating; + PyTypeObject *__pyx_ptype_5numpy_flexible; + PyTypeObject *__pyx_ptype_5numpy_character; + PyTypeObject *__pyx_ptype_5numpy_ufunc; + PyTypeObject *__pyx_ptype_5spacy_10morphology_Morphology; + PyTypeObject *__pyx_ptype_5spacy_5vocab_Vocab; + PyTypeObject *__pyx_ptype_5spacy_6tokens_3doc_Doc; + PyTypeObject *__pyx_ptype_5spacy_8training_7example_Example; + PyTypeObject *__pyx_ptype_5spacy_6lexeme_Lexeme; + PyTypeObject *__pyx_ptype_5spacy_8pipeline_17_parser_internals_10stateclass_StateClass; + PyTypeObject *__pyx_ptype_5spacy_8pipeline_17_parser_internals_17transition_system_TransitionSystem; + PyObject *__pyx_type_5spacy_8pipeline_17_parser_internals_11_beam_utils_BeamBatch; + PyObject *__pyx_type_5spacy_8pipeline_17_parser_internals_11_beam_utils___pyx_scope_struct__genexpr; + PyObject *__pyx_type___pyx_array; + PyObject *__pyx_type___pyx_MemviewEnum; + PyObject *__pyx_type___pyx_memoryview; + PyObject *__pyx_type___pyx_memoryviewslice; + PyTypeObject *__pyx_ptype_5spacy_8pipeline_17_parser_internals_11_beam_utils_BeamBatch; + PyTypeObject *__pyx_ptype_5spacy_8pipeline_17_parser_internals_11_beam_utils___pyx_scope_struct__genexpr; + PyTypeObject *__pyx_array_type; + PyTypeObject *__pyx_MemviewEnum_type; + PyTypeObject *__pyx_memoryview_type; + PyTypeObject *__pyx_memoryviewslice_type; + __Pyx_CachedCFunction __pyx_umethod_PyDict_Type_items; + __Pyx_CachedCFunction __pyx_umethod_PyDict_Type_pop; + __Pyx_CachedCFunction __pyx_umethod_PyDict_Type_values; + __Pyx_CachedCFunction __pyx_umethod_PyDict_Type__update; + PyObject *__pyx_slice[1]; + PyObject *__pyx_tuple[5]; + PyObject *__pyx_codeobj_tab[12]; + PyObject *__pyx_string_tab[245]; + PyObject *__pyx_number_tab[7]; +/* #### Code section: module_state_contents ### */ + +#if CYTHON_USE_FREELISTS +struct __pyx_obj_5spacy_8pipeline_17_parser_internals_11_beam_utils___pyx_scope_struct__genexpr *__pyx_freelist_5spacy_8pipeline_17_parser_internals_11_beam_utils___pyx_scope_struct__genexpr[8]; +int __pyx_freecount_5spacy_8pipeline_17_parser_internals_11_beam_utils___pyx_scope_struct__genexpr; +#endif +/* 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; + +/* IterNextPlain.module_state_decls */ +#if CYTHON_COMPILING_IN_LIMITED_API && __PYX_LIMITED_VERSION_HEX < 0x030A0000 +PyObject *__Pyx_GetBuiltinNext_LimitedAPI_cache; +#endif + +/* Generator.module_state_decls */ +PyTypeObject *__pyx_GeneratorType; + +/* #### 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_All_dimensions_preceding_dimensi __pyx_string_tab[1] +#define __pyx_kp_u_Buffer_view_does_not_expose_stri __pyx_string_tab[2] +#define __pyx_kp_u_Can_only_create_a_buffer_that_is __pyx_string_tab[3] +#define __pyx_kp_u_Cannot_assign_to_read_only_memor __pyx_string_tab[4] +#define __pyx_kp_u_Cannot_create_writable_memory_vi __pyx_string_tab[5] +#define __pyx_kp_u_Cannot_index_with_type __pyx_string_tab[6] +#define __pyx_kp_u_Cannot_transpose_memoryview_with __pyx_string_tab[7] +#define __pyx_kp_u_Dimension_d_is_not_direct __pyx_string_tab[8] +#define __pyx_kp_u_Empty_shape_tuple_for_cython_arr __pyx_string_tab[9] +#define __pyx_kp_u_Index_out_of_bounds_axis_d __pyx_string_tab[10] +#define __pyx_kp_u_Indirect_dimensions_not_supporte __pyx_string_tab[11] +#define __pyx_kp_u_Invalid_mode_expected_c_or_fortr __pyx_string_tab[12] +#define __pyx_kp_u_Invalid_shape_in_axis __pyx_string_tab[13] +#define __pyx_kp_u_MemoryView_of __pyx_string_tab[14] +#define __pyx_kp_u_Note_that_Cython_is_deliberately __pyx_string_tab[15] +#define __pyx_kp_u_Out_of_bounds_on_buffer_access_a __pyx_string_tab[16] +#define __pyx_kp_u_Step_may_not_be_zero_axis_d __pyx_string_tab[17] +#define __pyx_kp_u_Unable_to_convert_item_to_object __pyx_string_tab[18] +#define __pyx_kp_u__2 __pyx_string_tab[19] +#define __pyx_kp_u__3 __pyx_string_tab[20] +#define __pyx_kp_u__4 __pyx_string_tab[21] +#define __pyx_kp_u__5 __pyx_string_tab[22] +#define __pyx_kp_u__6 __pyx_string_tab[23] +#define __pyx_kp_u_add_note __pyx_string_tab[24] +#define __pyx_kp_u_and __pyx_string_tab[25] +#define __pyx_kp_u_at_0x __pyx_string_tab[26] +#define __pyx_kp_u_collections_abc __pyx_string_tab[27] +#define __pyx_kp_u_contiguous_and_direct __pyx_string_tab[28] +#define __pyx_kp_u_contiguous_and_indirect __pyx_string_tab[29] +#define __pyx_kp_u_disable __pyx_string_tab[30] +#define __pyx_kp_u_enable __pyx_string_tab[31] +#define __pyx_kp_u_gc __pyx_string_tab[32] +#define __pyx_kp_u_got __pyx_string_tab[33] +#define __pyx_kp_u_got_differing_extents_in_dimensi __pyx_string_tab[34] +#define __pyx_kp_u_isenabled __pyx_string_tab[35] +#define __pyx_kp_u_itemsize_0_for_cython_array __pyx_string_tab[36] +#define __pyx_kp_u_no_default___reduce___due_to_non __pyx_string_tab[37] +#define __pyx_kp_u_numpy__core_multiarray_failed_to __pyx_string_tab[38] +#define __pyx_kp_u_numpy__core_umath_failed_to_impo __pyx_string_tab[39] +#define __pyx_kp_u_object __pyx_string_tab[40] +#define __pyx_kp_u_self_beams_is_not_None_or_self_d __pyx_string_tab[41] +#define __pyx_kp_u_self_name_is_not_None __pyx_string_tab[42] +#define __pyx_kp_u_spacy_errors __pyx_string_tab[43] +#define __pyx_kp_u_spacy_pipeline__parser_internals_2 __pyx_string_tab[44] +#define __pyx_kp_u_spacy_pipeline__parser_internals_3 __pyx_string_tab[45] +#define __pyx_kp_u_spacy_pipeline__parser_internals_4 __pyx_string_tab[46] +#define __pyx_kp_u_strided_and_direct __pyx_string_tab[47] +#define __pyx_kp_u_strided_and_direct_or_indirect __pyx_string_tab[48] +#define __pyx_kp_u_strided_and_indirect __pyx_string_tab[49] +#define __pyx_kp_u_stringsource __pyx_string_tab[50] +#define __pyx_kp_u_unable_to_allocate_array_data __pyx_string_tab[51] +#define __pyx_kp_u_unable_to_allocate_shape_and_str __pyx_string_tab[52] +#define __pyx_n_u_ASCII __pyx_string_tab[53] +#define __pyx_n_u_BeamBatch __pyx_string_tab[54] +#define __pyx_n_u_BeamBatch___get___locals_genexpr __pyx_string_tab[55] +#define __pyx_n_u_BeamBatch___reduce_cython __pyx_string_tab[56] +#define __pyx_n_u_BeamBatch___setstate_cython __pyx_string_tab[57] +#define __pyx_n_u_BeamBatch__set_costs __pyx_string_tab[58] +#define __pyx_n_u_BeamBatch_advance __pyx_string_tab[59] +#define __pyx_n_u_BeamBatch_get_states __pyx_string_tab[60] +#define __pyx_n_u_BeamBatch_get_unfinished_states __pyx_string_tab[61] +#define __pyx_n_u_E079 __pyx_string_tab[62] +#define __pyx_n_u_E080 __pyx_string_tab[63] +#define __pyx_n_u_E081 __pyx_string_tab[64] +#define __pyx_n_u_Ellipsis __pyx_string_tab[65] +#define __pyx_n_u_Errors __pyx_string_tab[66] +#define __pyx_n_u_MaxViolation __pyx_string_tab[67] +#define __pyx_n_u_Pyx_PyDict_NextRef __pyx_string_tab[68] +#define __pyx_n_u_Sequence __pyx_string_tab[69] +#define __pyx_n_u_View_MemoryView __pyx_string_tab[70] +#define __pyx_n_u__7 __pyx_string_tab[71] +#define __pyx_n_u_abc __pyx_string_tab[72] +#define __pyx_n_u_advance __pyx_string_tab[73] +#define __pyx_n_u_allocate_buffer __pyx_string_tab[74] +#define __pyx_n_u_append __pyx_string_tab[75] +#define __pyx_n_u_as_contig __pyx_string_tab[76] +#define __pyx_n_u_asarray __pyx_string_tab[77] +#define __pyx_n_u_asyncio_coroutines __pyx_string_tab[78] +#define __pyx_n_u_avg_loss __pyx_string_tab[79] +#define __pyx_n_u_b __pyx_string_tab[80] +#define __pyx_n_u_backprops __pyx_string_tab[81] +#define __pyx_n_u_base __pyx_string_tab[82] +#define __pyx_n_u_beam __pyx_string_tab[83] +#define __pyx_n_u_beam_density __pyx_string_tab[84] +#define __pyx_n_u_beam_map __pyx_string_tab[85] +#define __pyx_n_u_beam_maps __pyx_string_tab[86] +#define __pyx_n_u_beams __pyx_string_tab[87] +#define __pyx_n_u_begin_update __pyx_string_tab[88] +#define __pyx_n_u_bp_scores __pyx_string_tab[89] +#define __pyx_n_u_c __pyx_string_tab[90] +#define __pyx_n_u_c_scores __pyx_string_tab[91] +#define __pyx_n_u_clas __pyx_string_tab[92] +#define __pyx_n_u_class __pyx_string_tab[93] +#define __pyx_n_u_class_getitem __pyx_string_tab[94] +#define __pyx_n_u_cline_in_traceback __pyx_string_tab[95] +#define __pyx_n_u_close __pyx_string_tab[96] +#define __pyx_n_u_collect_states __pyx_string_tab[97] +#define __pyx_n_u_count __pyx_string_tab[98] +#define __pyx_n_u_d_l __pyx_string_tab[99] +#define __pyx_n_u_d_loss __pyx_string_tab[100] +#define __pyx_n_u_d_scores __pyx_string_tab[101] +#define __pyx_n_u_density __pyx_string_tab[102] +#define __pyx_n_u_dict __pyx_string_tab[103] +#define __pyx_n_u_dict_2 __pyx_string_tab[104] +#define __pyx_n_u_doc __pyx_string_tab[105] +#define __pyx_n_u_docs __pyx_string_tab[106] +#define __pyx_n_u_dones __pyx_string_tab[107] +#define __pyx_n_u_dtype __pyx_string_tab[108] +#define __pyx_n_u_dtype_is_object __pyx_string_tab[109] +#define __pyx_n_u_eg_id __pyx_string_tab[110] +#define __pyx_n_u_encode __pyx_string_tab[111] +#define __pyx_n_u_enumerate __pyx_string_tab[112] +#define __pyx_n_u_error __pyx_string_tab[113] +#define __pyx_n_u_errors __pyx_string_tab[114] +#define __pyx_n_u_f __pyx_string_tab[115] +#define __pyx_n_u_flags __pyx_string_tab[116] +#define __pyx_n_u_follow_gold __pyx_string_tab[117] +#define __pyx_n_u_format __pyx_string_tab[118] +#define __pyx_n_u_fortran __pyx_string_tab[119] +#define __pyx_n_u_func __pyx_string_tab[120] +#define __pyx_n_u_g_indices __pyx_string_tab[121] +#define __pyx_n_u_gbeam __pyx_string_tab[122] +#define __pyx_n_u_gbeams __pyx_string_tab[123] +#define __pyx_n_u_genexpr __pyx_string_tab[124] +#define __pyx_n_u_get_gradient __pyx_string_tab[125] +#define __pyx_n_u_get_states __pyx_string_tab[126] +#define __pyx_n_u_get_unfinished_states __pyx_string_tab[127] +#define __pyx_n_u_get_unique_states __pyx_string_tab[128] +#define __pyx_n_u_getstate __pyx_string_tab[129] +#define __pyx_n_u_gold __pyx_string_tab[130] +#define __pyx_n_u_golds __pyx_string_tab[131] +#define __pyx_n_u_grads __pyx_string_tab[132] +#define __pyx_n_u_hist __pyx_string_tab[133] +#define __pyx_n_u_histories __pyx_string_tab[134] +#define __pyx_n_u_hists __pyx_string_tab[135] +#define __pyx_n_u_i __pyx_string_tab[136] +#define __pyx_n_u_id __pyx_string_tab[137] +#define __pyx_n_u_import __pyx_string_tab[138] +#define __pyx_n_u_index __pyx_string_tab[139] +#define __pyx_n_u_is_coroutine __pyx_string_tab[140] +#define __pyx_n_u_is_done __pyx_string_tab[141] +#define __pyx_n_u_is_final __pyx_string_tab[142] +#define __pyx_n_u_isnan __pyx_string_tab[143] +#define __pyx_n_u_items __pyx_string_tab[144] +#define __pyx_n_u_itemsize __pyx_string_tab[145] +#define __pyx_n_u_j __pyx_string_tab[146] +#define __pyx_n_u_key __pyx_string_tab[147] +#define __pyx_n_u_loss __pyx_string_tab[148] +#define __pyx_n_u_losses __pyx_string_tab[149] +#define __pyx_n_u_main __pyx_string_tab[150] +#define __pyx_n_u_max __pyx_string_tab[151] +#define __pyx_n_u_mean __pyx_string_tab[152] +#define __pyx_n_u_memview __pyx_string_tab[153] +#define __pyx_n_u_min_cost __pyx_string_tab[154] +#define __pyx_n_u_min_density __pyx_string_tab[155] +#define __pyx_n_u_mode __pyx_string_tab[156] +#define __pyx_n_u_model __pyx_string_tab[157] +#define __pyx_n_u_module __pyx_string_tab[158] +#define __pyx_n_u_moves __pyx_string_tab[159] +#define __pyx_n_u_n_hist __pyx_string_tab[160] +#define __pyx_n_u_name __pyx_string_tab[161] +#define __pyx_n_u_name_2 __pyx_string_tab[162] +#define __pyx_n_u_ndim __pyx_string_tab[163] +#define __pyx_n_u_new __pyx_string_tab[164] +#define __pyx_n_u_next __pyx_string_tab[165] +#define __pyx_n_u_nr_class __pyx_string_tab[166] +#define __pyx_n_u_nr_state __pyx_string_tab[167] +#define __pyx_n_u_nr_step __pyx_string_tab[168] +#define __pyx_n_u_nr_steps __pyx_string_tab[169] +#define __pyx_n_u_numpy __pyx_string_tab[170] +#define __pyx_n_u_obj __pyx_string_tab[171] +#define __pyx_n_u_ops __pyx_string_tab[172] +#define __pyx_n_u_p_indices __pyx_string_tab[173] +#define __pyx_n_u_pack __pyx_string_tab[174] +#define __pyx_n_u_pbeam __pyx_string_tab[175] +#define __pyx_n_u_pbeams __pyx_string_tab[176] +#define __pyx_n_u_pop __pyx_string_tab[177] +#define __pyx_n_u_pyx_capi __pyx_string_tab[178] +#define __pyx_n_u_pyx_checksum __pyx_string_tab[179] +#define __pyx_n_u_pyx_result __pyx_string_tab[180] +#define __pyx_n_u_pyx_state __pyx_string_tab[181] +#define __pyx_n_u_pyx_type __pyx_string_tab[182] +#define __pyx_n_u_pyx_unpickle_BeamBatch __pyx_string_tab[183] +#define __pyx_n_u_pyx_unpickle_Enum __pyx_string_tab[184] +#define __pyx_n_u_pyx_vtable __pyx_string_tab[185] +#define __pyx_n_u_qualname __pyx_string_tab[186] +#define __pyx_n_u_reduce __pyx_string_tab[187] +#define __pyx_n_u_reduce_cython __pyx_string_tab[188] +#define __pyx_n_u_reduce_ex __pyx_string_tab[189] +#define __pyx_n_u_register __pyx_string_tab[190] +#define __pyx_n_u_scores __pyx_string_tab[191] +#define __pyx_n_u_seen __pyx_string_tab[192] +#define __pyx_n_u_self __pyx_string_tab[193] +#define __pyx_n_u_send __pyx_string_tab[194] +#define __pyx_n_u_set_costs __pyx_string_tab[195] +#define __pyx_n_u_set_name __pyx_string_tab[196] +#define __pyx_n_u_setdefault __pyx_string_tab[197] +#define __pyx_n_u_setstate __pyx_string_tab[198] +#define __pyx_n_u_setstate_cython __pyx_string_tab[199] +#define __pyx_n_u_shape __pyx_string_tab[200] +#define __pyx_n_u_size __pyx_string_tab[201] +#define __pyx_n_u_spacy_pipeline__parser_internals __pyx_string_tab[202] +#define __pyx_n_u_st __pyx_string_tab[203] +#define __pyx_n_u_start __pyx_string_tab[204] +#define __pyx_n_u_state __pyx_string_tab[205] +#define __pyx_n_u_state_or_beam __pyx_string_tab[206] +#define __pyx_n_u_states __pyx_string_tab[207] +#define __pyx_n_u_states_d_scores __pyx_string_tab[208] +#define __pyx_n_u_stcls __pyx_string_tab[209] +#define __pyx_n_u_step __pyx_string_tab[210] +#define __pyx_n_u_stop __pyx_string_tab[211] +#define __pyx_n_u_struct __pyx_string_tab[212] +#define __pyx_n_u_test __pyx_string_tab[213] +#define __pyx_n_u_thinc_extra_search __pyx_string_tab[214] +#define __pyx_n_u_throw __pyx_string_tab[215] +#define __pyx_n_u_unpack __pyx_string_tab[216] +#define __pyx_n_u_update __pyx_string_tab[217] +#define __pyx_n_u_update_beam __pyx_string_tab[218] +#define __pyx_n_u_use_setstate __pyx_string_tab[219] +#define __pyx_n_u_value __pyx_string_tab[220] +#define __pyx_n_u_values __pyx_string_tab[221] +#define __pyx_n_u_violn __pyx_string_tab[222] +#define __pyx_n_u_violns __pyx_string_tab[223] +#define __pyx_n_u_width __pyx_string_tab[224] +#define __pyx_n_u_x __pyx_string_tab[225] +#define __pyx_n_u_zeros __pyx_string_tab[226] +#define __pyx_n_u_zip __pyx_string_tab[227] +#define __pyx_kp_b_int_void_void_int_void_void___py __pyx_string_tab[228] +#define __pyx_kp_b_iso88591_1_Q_q_6_s_83c_j_uG1G3ay_s_1_whi __pyx_string_tab[229] +#define __pyx_kp_b_iso88591_8_F_QfAS_t1_Cxy_t4q_4_1F_A_q_4w __pyx_string_tab[230] +#define __pyx_kp_b_iso88591_A __pyx_string_tab[231] +#define __pyx_kp_b_iso88591_A_F_AV4q_U_4q_S_gQa_q __pyx_string_tab[232] +#define __pyx_kp_b_iso88591_A_q_4vT_Cs_b __pyx_string_tab[233] +#define __pyx_kp_b_iso88591_A_q_y_F_QfAXQ_4uF_1_uCq_Qis_1_q __pyx_string_tab[234] +#define __pyx_kp_b_iso88591_I_IQgXWF_IQgXWF_Ql_T_e1Cq_AV4uA __pyx_string_tab[235] +#define __pyx_kp_b_iso88591_Q_wc_QoQ_1_gQit3at1_1 __pyx_string_tab[236] +#define __pyx_kp_b_iso88591_T_WD_HD_G1F_a_vWE_Q_q_q_awk_awk __pyx_string_tab[237] +#define __pyx_kp_b_iso88591_q_0_kQR_9HAQ_7_1L_a_1 __pyx_string_tab[238] +#define __pyx_kp_b_iso88591_q_E_at1_O4s_1_uIQ_E_at1_AU_ar_q __pyx_string_tab[239] +#define __pyx_kp_b_iso88591_q_a __pyx_string_tab[240] +#define __pyx_kp_b_pyx_t_5spacy_8typedefs_attr_t __pyx_string_tab[241] +#define __pyx_kp_b_struct___pyx_t_5spacy_7structs_L __pyx_string_tab[242] +#define __pyx_kp_b_uint64_t_void_int_uint64_t_hash6 __pyx_string_tab[243] +#define __pyx_n_b_O __pyx_string_tab[244] +#define __pyx_float_0_0 __pyx_number_tab[0] +#define __pyx_int_0 __pyx_number_tab[1] +#define __pyx_int_neg_1 __pyx_number_tab[2] +#define __pyx_int_1 __pyx_number_tab[3] +#define __pyx_int_2 __pyx_number_tab[4] +#define __pyx_int_136983863 __pyx_number_tab[5] +#define __pyx_int_170731940 __pyx_number_tab[6] +/* #### 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_5cymem_5cymem_PyMalloc); + Py_CLEAR(clear_module_state->__pyx_ptype_5cymem_5cymem_PyFree); + Py_CLEAR(clear_module_state->__pyx_ptype_5cymem_5cymem_Pool); + Py_CLEAR(clear_module_state->__pyx_ptype_5cymem_5cymem_Address); + Py_CLEAR(clear_module_state->__pyx_ptype_5thinc_5extra_6search_Beam); + Py_CLEAR(clear_module_state->__pyx_ptype_5thinc_5extra_6search_MaxViolation); + Py_CLEAR(clear_module_state->__pyx_ptype_7preshed_4maps_PreshMap); + Py_CLEAR(clear_module_state->__pyx_ptype_7preshed_4maps_PreshMapArray); + Py_CLEAR(clear_module_state->__pyx_ptype_5spacy_7strings_StringStore); + Py_CLEAR(clear_module_state->__pyx_ptype_7cpython_4type_type); + Py_CLEAR(clear_module_state->__pyx_ptype_5numpy_dtype); + Py_CLEAR(clear_module_state->__pyx_ptype_5numpy_flatiter); + Py_CLEAR(clear_module_state->__pyx_ptype_5numpy_broadcast); + Py_CLEAR(clear_module_state->__pyx_ptype_5numpy_ndarray); + Py_CLEAR(clear_module_state->__pyx_ptype_5numpy_generic); + Py_CLEAR(clear_module_state->__pyx_ptype_5numpy_number); + Py_CLEAR(clear_module_state->__pyx_ptype_5numpy_integer); + Py_CLEAR(clear_module_state->__pyx_ptype_5numpy_signedinteger); + Py_CLEAR(clear_module_state->__pyx_ptype_5numpy_unsignedinteger); + Py_CLEAR(clear_module_state->__pyx_ptype_5numpy_inexact); + Py_CLEAR(clear_module_state->__pyx_ptype_5numpy_floating); + Py_CLEAR(clear_module_state->__pyx_ptype_5numpy_complexfloating); + Py_CLEAR(clear_module_state->__pyx_ptype_5numpy_flexible); + Py_CLEAR(clear_module_state->__pyx_ptype_5numpy_character); + Py_CLEAR(clear_module_state->__pyx_ptype_5numpy_ufunc); + Py_CLEAR(clear_module_state->__pyx_ptype_5spacy_10morphology_Morphology); + Py_CLEAR(clear_module_state->__pyx_ptype_5spacy_5vocab_Vocab); + Py_CLEAR(clear_module_state->__pyx_ptype_5spacy_6tokens_3doc_Doc); + Py_CLEAR(clear_module_state->__pyx_ptype_5spacy_8training_7example_Example); + Py_CLEAR(clear_module_state->__pyx_ptype_5spacy_6lexeme_Lexeme); + Py_CLEAR(clear_module_state->__pyx_ptype_5spacy_8pipeline_17_parser_internals_10stateclass_StateClass); + Py_CLEAR(clear_module_state->__pyx_ptype_5spacy_8pipeline_17_parser_internals_17transition_system_TransitionSystem); + Py_CLEAR(clear_module_state->__pyx_ptype_5spacy_8pipeline_17_parser_internals_11_beam_utils_BeamBatch); + Py_CLEAR(clear_module_state->__pyx_type_5spacy_8pipeline_17_parser_internals_11_beam_utils_BeamBatch); + Py_CLEAR(clear_module_state->__pyx_ptype_5spacy_8pipeline_17_parser_internals_11_beam_utils___pyx_scope_struct__genexpr); + Py_CLEAR(clear_module_state->__pyx_type_5spacy_8pipeline_17_parser_internals_11_beam_utils___pyx_scope_struct__genexpr); + Py_CLEAR(clear_module_state->__pyx_array_type); + Py_CLEAR(clear_module_state->__pyx_type___pyx_array); + Py_CLEAR(clear_module_state->__pyx_MemviewEnum_type); + Py_CLEAR(clear_module_state->__pyx_type___pyx_MemviewEnum); + Py_CLEAR(clear_module_state->__pyx_memoryview_type); + Py_CLEAR(clear_module_state->__pyx_type___pyx_memoryview); + Py_CLEAR(clear_module_state->__pyx_memoryviewslice_type); + Py_CLEAR(clear_module_state->__pyx_type___pyx_memoryviewslice); + for (int i=0; i<1; ++i) { Py_CLEAR(clear_module_state->__pyx_slice[i]); } + for (int i=0; i<5; ++i) { Py_CLEAR(clear_module_state->__pyx_tuple[i]); } + for (int i=0; i<12; ++i) { Py_CLEAR(clear_module_state->__pyx_codeobj_tab[i]); } + for (int i=0; i<245; ++i) { Py_CLEAR(clear_module_state->__pyx_string_tab[i]); } + for (int i=0; i<7; ++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); + +/* Generator.module_state_clear */ +Py_CLEAR(clear_module_state->__pyx_GeneratorType); + +/* #### 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_5cymem_5cymem_PyMalloc); + Py_VISIT(traverse_module_state->__pyx_ptype_5cymem_5cymem_PyFree); + Py_VISIT(traverse_module_state->__pyx_ptype_5cymem_5cymem_Pool); + Py_VISIT(traverse_module_state->__pyx_ptype_5cymem_5cymem_Address); + Py_VISIT(traverse_module_state->__pyx_ptype_5thinc_5extra_6search_Beam); + Py_VISIT(traverse_module_state->__pyx_ptype_5thinc_5extra_6search_MaxViolation); + Py_VISIT(traverse_module_state->__pyx_ptype_7preshed_4maps_PreshMap); + Py_VISIT(traverse_module_state->__pyx_ptype_7preshed_4maps_PreshMapArray); + Py_VISIT(traverse_module_state->__pyx_ptype_5spacy_7strings_StringStore); + Py_VISIT(traverse_module_state->__pyx_ptype_7cpython_4type_type); + Py_VISIT(traverse_module_state->__pyx_ptype_5numpy_dtype); + Py_VISIT(traverse_module_state->__pyx_ptype_5numpy_flatiter); + Py_VISIT(traverse_module_state->__pyx_ptype_5numpy_broadcast); + Py_VISIT(traverse_module_state->__pyx_ptype_5numpy_ndarray); + Py_VISIT(traverse_module_state->__pyx_ptype_5numpy_generic); + Py_VISIT(traverse_module_state->__pyx_ptype_5numpy_number); + Py_VISIT(traverse_module_state->__pyx_ptype_5numpy_integer); + Py_VISIT(traverse_module_state->__pyx_ptype_5numpy_signedinteger); + Py_VISIT(traverse_module_state->__pyx_ptype_5numpy_unsignedinteger); + Py_VISIT(traverse_module_state->__pyx_ptype_5numpy_inexact); + Py_VISIT(traverse_module_state->__pyx_ptype_5numpy_floating); + Py_VISIT(traverse_module_state->__pyx_ptype_5numpy_complexfloating); + Py_VISIT(traverse_module_state->__pyx_ptype_5numpy_flexible); + Py_VISIT(traverse_module_state->__pyx_ptype_5numpy_character); + Py_VISIT(traverse_module_state->__pyx_ptype_5numpy_ufunc); + Py_VISIT(traverse_module_state->__pyx_ptype_5spacy_10morphology_Morphology); + Py_VISIT(traverse_module_state->__pyx_ptype_5spacy_5vocab_Vocab); + Py_VISIT(traverse_module_state->__pyx_ptype_5spacy_6tokens_3doc_Doc); + Py_VISIT(traverse_module_state->__pyx_ptype_5spacy_8training_7example_Example); + Py_VISIT(traverse_module_state->__pyx_ptype_5spacy_6lexeme_Lexeme); + Py_VISIT(traverse_module_state->__pyx_ptype_5spacy_8pipeline_17_parser_internals_10stateclass_StateClass); + Py_VISIT(traverse_module_state->__pyx_ptype_5spacy_8pipeline_17_parser_internals_17transition_system_TransitionSystem); + Py_VISIT(traverse_module_state->__pyx_ptype_5spacy_8pipeline_17_parser_internals_11_beam_utils_BeamBatch); + Py_VISIT(traverse_module_state->__pyx_type_5spacy_8pipeline_17_parser_internals_11_beam_utils_BeamBatch); + Py_VISIT(traverse_module_state->__pyx_ptype_5spacy_8pipeline_17_parser_internals_11_beam_utils___pyx_scope_struct__genexpr); + Py_VISIT(traverse_module_state->__pyx_type_5spacy_8pipeline_17_parser_internals_11_beam_utils___pyx_scope_struct__genexpr); + Py_VISIT(traverse_module_state->__pyx_array_type); + Py_VISIT(traverse_module_state->__pyx_type___pyx_array); + Py_VISIT(traverse_module_state->__pyx_MemviewEnum_type); + Py_VISIT(traverse_module_state->__pyx_type___pyx_MemviewEnum); + Py_VISIT(traverse_module_state->__pyx_memoryview_type); + Py_VISIT(traverse_module_state->__pyx_type___pyx_memoryview); + Py_VISIT(traverse_module_state->__pyx_memoryviewslice_type); + Py_VISIT(traverse_module_state->__pyx_type___pyx_memoryviewslice); + for (int i=0; i<1; ++i) { __Pyx_VISIT_CONST(traverse_module_state->__pyx_slice[i]); } + for (int i=0; i<5; ++i) { __Pyx_VISIT_CONST(traverse_module_state->__pyx_tuple[i]); } + for (int i=0; i<12; ++i) { __Pyx_VISIT_CONST(traverse_module_state->__pyx_codeobj_tab[i]); } + for (int i=0; i<245; ++i) { __Pyx_VISIT_CONST(traverse_module_state->__pyx_string_tab[i]); } + for (int i=0; i<7; ++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); + +/* Generator.module_state_traverse */ +Py_VISIT(traverse_module_state->__pyx_GeneratorType); + +/* #### Code section: module_state_traverse_end ### */ +return 0; +} +#endif +/* #### Code section: module_code ### */ + +/* "View.MemoryView":129 + * cdef bint dtype_is_object + * + * def __cinit__(array self, tuple shape, Py_ssize_t itemsize, format not None, # <<<<<<<<<<<<<< + * mode="c", bint allocate_buffer=True): + * +*/ + +/* Python wrapper */ +static int __pyx_array___cinit__(PyObject *__pyx_v_self, PyObject *__pyx_args, PyObject *__pyx_kwds); /*proto*/ +static int __pyx_array___cinit__(PyObject *__pyx_v_self, PyObject *__pyx_args, PyObject *__pyx_kwds) { + PyObject *__pyx_v_shape = 0; + Py_ssize_t __pyx_v_itemsize; + PyObject *__pyx_v_format = 0; + PyObject *__pyx_v_mode = 0; + int __pyx_v_allocate_buffer; + CYTHON_UNUSED Py_ssize_t __pyx_nargs; + CYTHON_UNUSED PyObject *const *__pyx_kwvalues; + PyObject* values[5] = {0,0,0,0,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_shape,&__pyx_mstate_global->__pyx_n_u_itemsize,&__pyx_mstate_global->__pyx_n_u_format,&__pyx_mstate_global->__pyx_n_u_mode,&__pyx_mstate_global->__pyx_n_u_allocate_buffer,0}; + const Py_ssize_t __pyx_kwds_len = (__pyx_kwds) ? __Pyx_NumKwargs_VARARGS(__pyx_kwds) : 0; + if (unlikely(__pyx_kwds_len) < 0) __PYX_ERR(1, 129, __pyx_L3_error) + if (__pyx_kwds_len > 0) { + switch (__pyx_nargs) { + case 5: + values[4] = __Pyx_ArgRef_VARARGS(__pyx_args, 4); + if (!CYTHON_ASSUME_SAFE_MACROS && unlikely(!values[4])) __PYX_ERR(1, 129, __pyx_L3_error) + CYTHON_FALLTHROUGH; + case 4: + values[3] = __Pyx_ArgRef_VARARGS(__pyx_args, 3); + if (!CYTHON_ASSUME_SAFE_MACROS && unlikely(!values[3])) __PYX_ERR(1, 129, __pyx_L3_error) + CYTHON_FALLTHROUGH; + case 3: + values[2] = __Pyx_ArgRef_VARARGS(__pyx_args, 2); + if (!CYTHON_ASSUME_SAFE_MACROS && unlikely(!values[2])) __PYX_ERR(1, 129, __pyx_L3_error) + CYTHON_FALLTHROUGH; + case 2: + values[1] = __Pyx_ArgRef_VARARGS(__pyx_args, 1); + if (!CYTHON_ASSUME_SAFE_MACROS && unlikely(!values[1])) __PYX_ERR(1, 129, __pyx_L3_error) + CYTHON_FALLTHROUGH; + case 1: + values[0] = __Pyx_ArgRef_VARARGS(__pyx_args, 0); + if (!CYTHON_ASSUME_SAFE_MACROS && unlikely(!values[0])) __PYX_ERR(1, 129, __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(1, 129, __pyx_L3_error) + if (!values[3]) values[3] = __Pyx_NewRef(((PyObject *)__pyx_mstate_global->__pyx_n_u_c)); + for (Py_ssize_t i = __pyx_nargs; i < 3; i++) { + if (unlikely(!values[i])) { __Pyx_RaiseArgtupleInvalid("__cinit__", 0, 3, 5, i); __PYX_ERR(1, 129, __pyx_L3_error) } + } + } else { + switch (__pyx_nargs) { + case 5: + values[4] = __Pyx_ArgRef_VARARGS(__pyx_args, 4); + if (!CYTHON_ASSUME_SAFE_MACROS && unlikely(!values[4])) __PYX_ERR(1, 129, __pyx_L3_error) + CYTHON_FALLTHROUGH; + case 4: + values[3] = __Pyx_ArgRef_VARARGS(__pyx_args, 3); + if (!CYTHON_ASSUME_SAFE_MACROS && unlikely(!values[3])) __PYX_ERR(1, 129, __pyx_L3_error) + CYTHON_FALLTHROUGH; + case 3: + values[2] = __Pyx_ArgRef_VARARGS(__pyx_args, 2); + if (!CYTHON_ASSUME_SAFE_MACROS && unlikely(!values[2])) __PYX_ERR(1, 129, __pyx_L3_error) + values[1] = __Pyx_ArgRef_VARARGS(__pyx_args, 1); + if (!CYTHON_ASSUME_SAFE_MACROS && unlikely(!values[1])) __PYX_ERR(1, 129, __pyx_L3_error) + values[0] = __Pyx_ArgRef_VARARGS(__pyx_args, 0); + if (!CYTHON_ASSUME_SAFE_MACROS && unlikely(!values[0])) __PYX_ERR(1, 129, __pyx_L3_error) + break; + default: goto __pyx_L5_argtuple_error; + } + if (!values[3]) values[3] = __Pyx_NewRef(((PyObject *)__pyx_mstate_global->__pyx_n_u_c)); + } + __pyx_v_shape = ((PyObject*)values[0]); + __pyx_v_itemsize = __Pyx_PyIndex_AsSsize_t(values[1]); if (unlikely((__pyx_v_itemsize == (Py_ssize_t)-1) && PyErr_Occurred())) __PYX_ERR(1, 129, __pyx_L3_error) + __pyx_v_format = values[2]; + __pyx_v_mode = values[3]; + if (values[4]) { + __pyx_v_allocate_buffer = __Pyx_PyObject_IsTrue(values[4]); if (unlikely((__pyx_v_allocate_buffer == (int)-1) && PyErr_Occurred())) __PYX_ERR(1, 130, __pyx_L3_error) + } else { + + /* "View.MemoryView":130 + * + * def __cinit__(array self, tuple shape, Py_ssize_t itemsize, format not None, + * mode="c", bint allocate_buffer=True): # <<<<<<<<<<<<<< + * + * cdef int idx +*/ + __pyx_v_allocate_buffer = ((int)1); + } + } + goto __pyx_L6_skip; + __pyx_L5_argtuple_error:; + __Pyx_RaiseArgtupleInvalid("__cinit__", 0, 3, 5, __pyx_nargs); __PYX_ERR(1, 129, __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("View.MemoryView.array.__cinit__", __pyx_clineno, __pyx_lineno, __pyx_filename); + __Pyx_RefNannyFinishContext(); + return -1; + __pyx_L4_argument_unpacking_done:; + if (unlikely(!__Pyx_ArgTypeTest(((PyObject *)__pyx_v_shape), (&PyTuple_Type), 1, "shape", 1))) __PYX_ERR(1, 129, __pyx_L1_error) + if (unlikely(((PyObject *)__pyx_v_format) == Py_None)) { + PyErr_Format(PyExc_TypeError, "Argument '%.200s' must not be None", "format"); __PYX_ERR(1, 129, __pyx_L1_error) + } + __pyx_r = __pyx_array___pyx_pf_15View_dot_MemoryView_5array___cinit__(((struct __pyx_array_obj *)__pyx_v_self), __pyx_v_shape, __pyx_v_itemsize, __pyx_v_format, __pyx_v_mode, __pyx_v_allocate_buffer); + + /* "View.MemoryView":129 + * cdef bint dtype_is_object + * + * def __cinit__(array self, tuple shape, Py_ssize_t itemsize, format not None, # <<<<<<<<<<<<<< + * mode="c", bint allocate_buffer=True): + * +*/ + + /* 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_array___pyx_pf_15View_dot_MemoryView_5array___cinit__(struct __pyx_array_obj *__pyx_v_self, PyObject *__pyx_v_shape, Py_ssize_t __pyx_v_itemsize, PyObject *__pyx_v_format, PyObject *__pyx_v_mode, int __pyx_v_allocate_buffer) { + int __pyx_v_idx; + Py_ssize_t __pyx_v_dim; + char __pyx_v_order; + int __pyx_r; + __Pyx_RefNannyDeclarations + Py_ssize_t __pyx_t_1; + int __pyx_t_2; + int __pyx_t_3; + PyObject *__pyx_t_4 = NULL; + PyObject *__pyx_t_5 = NULL; + size_t __pyx_t_6; + char *__pyx_t_7; + int __pyx_t_8; + Py_ssize_t __pyx_t_9; + PyObject *__pyx_t_10 = NULL; + PyObject *__pyx_t_11[5]; + PyObject *__pyx_t_12 = NULL; + int __pyx_lineno = 0; + const char *__pyx_filename = NULL; + int __pyx_clineno = 0; + __Pyx_RefNannySetupContext("__cinit__", 0); + __Pyx_INCREF(__pyx_v_format); + + /* "View.MemoryView":135 + * cdef Py_ssize_t dim + * + * self.ndim = len(shape) # <<<<<<<<<<<<<< + * self.itemsize = itemsize + * +*/ + if (unlikely(__pyx_v_shape == Py_None)) { + PyErr_SetString(PyExc_TypeError, "object of type 'NoneType' has no len()"); + __PYX_ERR(1, 135, __pyx_L1_error) + } + __pyx_t_1 = __Pyx_PyTuple_GET_SIZE(__pyx_v_shape); if (unlikely(__pyx_t_1 == ((Py_ssize_t)-1))) __PYX_ERR(1, 135, __pyx_L1_error) + __pyx_v_self->ndim = ((int)__pyx_t_1); + + /* "View.MemoryView":136 + * + * self.ndim = len(shape) + * self.itemsize = itemsize # <<<<<<<<<<<<<< + * + * if not self.ndim: +*/ + __pyx_v_self->itemsize = __pyx_v_itemsize; + + /* "View.MemoryView":138 + * self.itemsize = itemsize + * + * if not self.ndim: # <<<<<<<<<<<<<< + * raise ValueError, "Empty shape tuple for cython.array" + * +*/ + __pyx_t_2 = (!(__pyx_v_self->ndim != 0)); + if (unlikely(__pyx_t_2)) { + + /* "View.MemoryView":139 + * + * if not self.ndim: + * raise ValueError, "Empty shape tuple for cython.array" # <<<<<<<<<<<<<< + * + * if itemsize <= 0: +*/ + __Pyx_Raise(((PyObject *)(((PyTypeObject*)PyExc_ValueError))), __pyx_mstate_global->__pyx_kp_u_Empty_shape_tuple_for_cython_arr, 0, 0); + __PYX_ERR(1, 139, __pyx_L1_error) + + /* "View.MemoryView":138 + * self.itemsize = itemsize + * + * if not self.ndim: # <<<<<<<<<<<<<< + * raise ValueError, "Empty shape tuple for cython.array" + * +*/ + } + + /* "View.MemoryView":141 + * raise ValueError, "Empty shape tuple for cython.array" + * + * if itemsize <= 0: # <<<<<<<<<<<<<< + * raise ValueError, "itemsize <= 0 for cython.array" + * +*/ + __pyx_t_2 = (__pyx_v_itemsize <= 0); + if (unlikely(__pyx_t_2)) { + + /* "View.MemoryView":142 + * + * if itemsize <= 0: + * raise ValueError, "itemsize <= 0 for cython.array" # <<<<<<<<<<<<<< + * + * if not isinstance(format, bytes): +*/ + __Pyx_Raise(((PyObject *)(((PyTypeObject*)PyExc_ValueError))), __pyx_mstate_global->__pyx_kp_u_itemsize_0_for_cython_array, 0, 0); + __PYX_ERR(1, 142, __pyx_L1_error) + + /* "View.MemoryView":141 + * raise ValueError, "Empty shape tuple for cython.array" + * + * if itemsize <= 0: # <<<<<<<<<<<<<< + * raise ValueError, "itemsize <= 0 for cython.array" + * +*/ + } + + /* "View.MemoryView":144 + * raise ValueError, "itemsize <= 0 for cython.array" + * + * if not isinstance(format, bytes): # <<<<<<<<<<<<<< + * format = format.encode('ASCII') + * self._format = format # keep a reference to the byte string +*/ + __pyx_t_2 = PyBytes_Check(__pyx_v_format); + __pyx_t_3 = (!__pyx_t_2); + if (__pyx_t_3) { + + /* "View.MemoryView":145 + * + * if not isinstance(format, bytes): + * format = format.encode('ASCII') # <<<<<<<<<<<<<< + * self._format = format # keep a reference to the byte string + * self.format = self._format +*/ + __pyx_t_5 = __pyx_v_format; + __Pyx_INCREF(__pyx_t_5); + __pyx_t_6 = 0; + { + PyObject *__pyx_callargs[2] = {__pyx_t_5, __pyx_mstate_global->__pyx_n_u_ASCII}; + __pyx_t_4 = __Pyx_PyObject_FastCallMethod((PyObject*)__pyx_mstate_global->__pyx_n_u_encode, __pyx_callargs+__pyx_t_6, (2-__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(1, 145, __pyx_L1_error) + __Pyx_GOTREF(__pyx_t_4); + } + __Pyx_DECREF_SET(__pyx_v_format, __pyx_t_4); + __pyx_t_4 = 0; + + /* "View.MemoryView":144 + * raise ValueError, "itemsize <= 0 for cython.array" + * + * if not isinstance(format, bytes): # <<<<<<<<<<<<<< + * format = format.encode('ASCII') + * self._format = format # keep a reference to the byte string +*/ + } + + /* "View.MemoryView":146 + * if not isinstance(format, bytes): + * format = format.encode('ASCII') + * self._format = format # keep a reference to the byte string # <<<<<<<<<<<<<< + * self.format = self._format + * +*/ + __pyx_t_4 = __pyx_v_format; + __Pyx_INCREF(__pyx_t_4); + if (!(likely(PyBytes_CheckExact(__pyx_t_4))||((__pyx_t_4) == Py_None) || __Pyx_RaiseUnexpectedTypeError("bytes", __pyx_t_4))) __PYX_ERR(1, 146, __pyx_L1_error) + __Pyx_GIVEREF(__pyx_t_4); + __Pyx_GOTREF(__pyx_v_self->_format); + __Pyx_DECREF(__pyx_v_self->_format); + __pyx_v_self->_format = ((PyObject*)__pyx_t_4); + __pyx_t_4 = 0; + + /* "View.MemoryView":147 + * format = format.encode('ASCII') + * self._format = format # keep a reference to the byte string + * self.format = self._format # <<<<<<<<<<<<<< + * + * +*/ + if (unlikely(__pyx_v_self->_format == Py_None)) { + PyErr_SetString(PyExc_TypeError, "expected bytes, NoneType found"); + __PYX_ERR(1, 147, __pyx_L1_error) + } + __pyx_t_7 = __Pyx_PyBytes_AsWritableString(__pyx_v_self->_format); if (unlikely((!__pyx_t_7) && PyErr_Occurred())) __PYX_ERR(1, 147, __pyx_L1_error) + __pyx_v_self->format = __pyx_t_7; + + /* "View.MemoryView":150 + * + * + * self._shape = PyObject_Malloc(sizeof(Py_ssize_t)*self.ndim*2) # <<<<<<<<<<<<<< + * self._strides = self._shape + self.ndim + * +*/ + __pyx_v_self->_shape = ((Py_ssize_t *)PyObject_Malloc((((sizeof(Py_ssize_t)) * __pyx_v_self->ndim) * 2))); + + /* "View.MemoryView":151 + * + * self._shape = PyObject_Malloc(sizeof(Py_ssize_t)*self.ndim*2) + * self._strides = self._shape + self.ndim # <<<<<<<<<<<<<< + * + * if not self._shape: +*/ + __pyx_v_self->_strides = (__pyx_v_self->_shape + __pyx_v_self->ndim); + + /* "View.MemoryView":153 + * self._strides = self._shape + self.ndim + * + * if not self._shape: # <<<<<<<<<<<<<< + * raise MemoryError, "unable to allocate shape and strides." + * +*/ + __pyx_t_3 = (!(__pyx_v_self->_shape != 0)); + if (unlikely(__pyx_t_3)) { + + /* "View.MemoryView":154 + * + * if not self._shape: + * raise MemoryError, "unable to allocate shape and strides." # <<<<<<<<<<<<<< + * + * +*/ + __Pyx_Raise(((PyObject *)(((PyTypeObject*)PyExc_MemoryError))), __pyx_mstate_global->__pyx_kp_u_unable_to_allocate_shape_and_str, 0, 0); + __PYX_ERR(1, 154, __pyx_L1_error) + + /* "View.MemoryView":153 + * self._strides = self._shape + self.ndim + * + * if not self._shape: # <<<<<<<<<<<<<< + * raise MemoryError, "unable to allocate shape and strides." + * +*/ + } + + /* "View.MemoryView":157 + * + * + * for idx, dim in enumerate(shape): # <<<<<<<<<<<<<< + * if dim <= 0: + * raise ValueError, f"Invalid shape in axis {idx}: {dim}." +*/ + __pyx_t_8 = 0; + __pyx_t_4 = __pyx_v_shape; __Pyx_INCREF(__pyx_t_4); + __pyx_t_1 = 0; + for (;;) { + { + Py_ssize_t __pyx_temp = __Pyx_PyTuple_GET_SIZE(__pyx_t_4); + #if !CYTHON_ASSUME_SAFE_SIZE + if (unlikely((__pyx_temp < 0))) __PYX_ERR(1, 157, __pyx_L1_error) + #endif + if (__pyx_t_1 >= __pyx_temp) break; + } + #if CYTHON_ASSUME_SAFE_MACROS && !CYTHON_AVOID_BORROWED_REFS + __pyx_t_5 = __Pyx_NewRef(PyTuple_GET_ITEM(__pyx_t_4, __pyx_t_1)); + #else + __pyx_t_5 = __Pyx_PySequence_ITEM(__pyx_t_4, __pyx_t_1); + #endif + ++__pyx_t_1; + if (unlikely(!__pyx_t_5)) __PYX_ERR(1, 157, __pyx_L1_error) + __Pyx_GOTREF(__pyx_t_5); + __pyx_t_9 = __Pyx_PyIndex_AsSsize_t(__pyx_t_5); if (unlikely((__pyx_t_9 == (Py_ssize_t)-1) && PyErr_Occurred())) __PYX_ERR(1, 157, __pyx_L1_error) + __Pyx_DECREF(__pyx_t_5); __pyx_t_5 = 0; + __pyx_v_dim = __pyx_t_9; + __pyx_v_idx = __pyx_t_8; + __pyx_t_8 = (__pyx_t_8 + 1); + + /* "View.MemoryView":158 + * + * for idx, dim in enumerate(shape): + * if dim <= 0: # <<<<<<<<<<<<<< + * raise ValueError, f"Invalid shape in axis {idx}: {dim}." + * self._shape[idx] = dim +*/ + __pyx_t_3 = (__pyx_v_dim <= 0); + if (unlikely(__pyx_t_3)) { + + /* "View.MemoryView":159 + * for idx, dim in enumerate(shape): + * if dim <= 0: + * raise ValueError, f"Invalid shape in axis {idx}: {dim}." # <<<<<<<<<<<<<< + * self._shape[idx] = dim + * +*/ + __pyx_t_5 = __Pyx_PyUnicode_From_int(__pyx_v_idx, 0, ' ', 'd'); if (unlikely(!__pyx_t_5)) __PYX_ERR(1, 159, __pyx_L1_error) + __Pyx_GOTREF(__pyx_t_5); + __pyx_t_10 = __Pyx_PyUnicode_From_Py_ssize_t(__pyx_v_dim, 0, ' ', 'd'); if (unlikely(!__pyx_t_10)) __PYX_ERR(1, 159, __pyx_L1_error) + __Pyx_GOTREF(__pyx_t_10); + __pyx_t_11[0] = __pyx_mstate_global->__pyx_kp_u_Invalid_shape_in_axis; + __pyx_t_11[1] = __pyx_t_5; + __pyx_t_11[2] = __pyx_mstate_global->__pyx_kp_u_; + __pyx_t_11[3] = __pyx_t_10; + __pyx_t_11[4] = __pyx_mstate_global->__pyx_kp_u__2; + __pyx_t_12 = __Pyx_PyUnicode_Join(__pyx_t_11, 5, 22 + __Pyx_PyUnicode_GET_LENGTH(__pyx_t_5) + 2 + __Pyx_PyUnicode_GET_LENGTH(__pyx_t_10) + 1, 127); + if (unlikely(!__pyx_t_12)) __PYX_ERR(1, 159, __pyx_L1_error) + __Pyx_GOTREF(__pyx_t_12); + __Pyx_DECREF(__pyx_t_5); __pyx_t_5 = 0; + __Pyx_DECREF(__pyx_t_10); __pyx_t_10 = 0; + __Pyx_Raise(((PyObject *)(((PyTypeObject*)PyExc_ValueError))), __pyx_t_12, 0, 0); + __Pyx_DECREF(__pyx_t_12); __pyx_t_12 = 0; + __PYX_ERR(1, 159, __pyx_L1_error) + + /* "View.MemoryView":158 + * + * for idx, dim in enumerate(shape): + * if dim <= 0: # <<<<<<<<<<<<<< + * raise ValueError, f"Invalid shape in axis {idx}: {dim}." + * self._shape[idx] = dim +*/ + } + + /* "View.MemoryView":160 + * if dim <= 0: + * raise ValueError, f"Invalid shape in axis {idx}: {dim}." + * self._shape[idx] = dim # <<<<<<<<<<<<<< + * + * cdef char order +*/ + (__pyx_v_self->_shape[__pyx_v_idx]) = __pyx_v_dim; + + /* "View.MemoryView":157 + * + * + * for idx, dim in enumerate(shape): # <<<<<<<<<<<<<< + * if dim <= 0: + * raise ValueError, f"Invalid shape in axis {idx}: {dim}." +*/ + } + __Pyx_DECREF(__pyx_t_4); __pyx_t_4 = 0; + + /* "View.MemoryView":163 + * + * cdef char order + * if mode == 'c': # <<<<<<<<<<<<<< + * order = b'C' + * self.mode = u'c' +*/ + __pyx_t_3 = (__Pyx_PyUnicode_Equals(__pyx_v_mode, __pyx_mstate_global->__pyx_n_u_c, Py_EQ)); if (unlikely((__pyx_t_3 < 0))) __PYX_ERR(1, 163, __pyx_L1_error) + if (__pyx_t_3) { + + /* "View.MemoryView":164 + * cdef char order + * if mode == 'c': + * order = b'C' # <<<<<<<<<<<<<< + * self.mode = u'c' + * elif mode == 'fortran': +*/ + __pyx_v_order = 'C'; + + /* "View.MemoryView":165 + * if mode == 'c': + * order = b'C' + * self.mode = u'c' # <<<<<<<<<<<<<< + * elif mode == 'fortran': + * order = b'F' +*/ + __Pyx_INCREF(__pyx_mstate_global->__pyx_n_u_c); + __Pyx_GIVEREF(__pyx_mstate_global->__pyx_n_u_c); + __Pyx_GOTREF(__pyx_v_self->mode); + __Pyx_DECREF(__pyx_v_self->mode); + __pyx_v_self->mode = __pyx_mstate_global->__pyx_n_u_c; + + /* "View.MemoryView":163 + * + * cdef char order + * if mode == 'c': # <<<<<<<<<<<<<< + * order = b'C' + * self.mode = u'c' +*/ + goto __pyx_L11; + } + + /* "View.MemoryView":166 + * order = b'C' + * self.mode = u'c' + * elif mode == 'fortran': # <<<<<<<<<<<<<< + * order = b'F' + * self.mode = u'fortran' +*/ + __pyx_t_3 = (__Pyx_PyUnicode_Equals(__pyx_v_mode, __pyx_mstate_global->__pyx_n_u_fortran, Py_EQ)); if (unlikely((__pyx_t_3 < 0))) __PYX_ERR(1, 166, __pyx_L1_error) + if (likely(__pyx_t_3)) { + + /* "View.MemoryView":167 + * self.mode = u'c' + * elif mode == 'fortran': + * order = b'F' # <<<<<<<<<<<<<< + * self.mode = u'fortran' + * else: +*/ + __pyx_v_order = 'F'; + + /* "View.MemoryView":168 + * elif mode == 'fortran': + * order = b'F' + * self.mode = u'fortran' # <<<<<<<<<<<<<< + * else: + * raise ValueError, f"Invalid mode, expected 'c' or 'fortran', got {mode}" +*/ + __Pyx_INCREF(__pyx_mstate_global->__pyx_n_u_fortran); + __Pyx_GIVEREF(__pyx_mstate_global->__pyx_n_u_fortran); + __Pyx_GOTREF(__pyx_v_self->mode); + __Pyx_DECREF(__pyx_v_self->mode); + __pyx_v_self->mode = __pyx_mstate_global->__pyx_n_u_fortran; + + /* "View.MemoryView":166 + * order = b'C' + * self.mode = u'c' + * elif mode == 'fortran': # <<<<<<<<<<<<<< + * order = b'F' + * self.mode = u'fortran' +*/ + goto __pyx_L11; + } + + /* "View.MemoryView":170 + * self.mode = u'fortran' + * else: + * raise ValueError, f"Invalid mode, expected 'c' or 'fortran', got {mode}" # <<<<<<<<<<<<<< + * + * self.len = fill_contig_strides_array(self._shape, self._strides, itemsize, self.ndim, order) +*/ + /*else*/ { + __pyx_t_4 = __Pyx_PyObject_FormatSimple(__pyx_v_mode, __pyx_mstate_global->__pyx_empty_unicode); if (unlikely(!__pyx_t_4)) __PYX_ERR(1, 170, __pyx_L1_error) + __Pyx_GOTREF(__pyx_t_4); + __pyx_t_12 = __Pyx_PyUnicode_Concat(__pyx_mstate_global->__pyx_kp_u_Invalid_mode_expected_c_or_fortr, __pyx_t_4); if (unlikely(!__pyx_t_12)) __PYX_ERR(1, 170, __pyx_L1_error) + __Pyx_GOTREF(__pyx_t_12); + __Pyx_DECREF(__pyx_t_4); __pyx_t_4 = 0; + __Pyx_Raise(((PyObject *)(((PyTypeObject*)PyExc_ValueError))), __pyx_t_12, 0, 0); + __Pyx_DECREF(__pyx_t_12); __pyx_t_12 = 0; + __PYX_ERR(1, 170, __pyx_L1_error) + } + __pyx_L11:; + + /* "View.MemoryView":172 + * raise ValueError, f"Invalid mode, expected 'c' or 'fortran', got {mode}" + * + * self.len = fill_contig_strides_array(self._shape, self._strides, itemsize, self.ndim, order) # <<<<<<<<<<<<<< + * + * self.free_data = allocate_buffer +*/ + __pyx_v_self->len = __pyx_fill_contig_strides_array(__pyx_v_self->_shape, __pyx_v_self->_strides, __pyx_v_itemsize, __pyx_v_self->ndim, __pyx_v_order); + + /* "View.MemoryView":174 + * self.len = fill_contig_strides_array(self._shape, self._strides, itemsize, self.ndim, order) + * + * self.free_data = allocate_buffer # <<<<<<<<<<<<<< + * self.dtype_is_object = format == b'O' + * +*/ + __pyx_v_self->free_data = __pyx_v_allocate_buffer; + + /* "View.MemoryView":175 + * + * self.free_data = allocate_buffer + * self.dtype_is_object = format == b'O' # <<<<<<<<<<<<<< + * + * if allocate_buffer: +*/ + __pyx_t_12 = PyObject_RichCompare(__pyx_v_format, __pyx_mstate_global->__pyx_n_b_O, Py_EQ); __Pyx_XGOTREF(__pyx_t_12); if (unlikely(!__pyx_t_12)) __PYX_ERR(1, 175, __pyx_L1_error) + __pyx_t_3 = __Pyx_PyObject_IsTrue(__pyx_t_12); if (unlikely((__pyx_t_3 == (int)-1) && PyErr_Occurred())) __PYX_ERR(1, 175, __pyx_L1_error) + __Pyx_DECREF(__pyx_t_12); __pyx_t_12 = 0; + __pyx_v_self->dtype_is_object = __pyx_t_3; + + /* "View.MemoryView":177 + * self.dtype_is_object = format == b'O' + * + * if allocate_buffer: # <<<<<<<<<<<<<< + * _allocate_buffer(self) + * +*/ + if (__pyx_v_allocate_buffer) { + + /* "View.MemoryView":178 + * + * if allocate_buffer: + * _allocate_buffer(self) # <<<<<<<<<<<<<< + * + * @cname('getbuffer') +*/ + __pyx_t_8 = __pyx_array_allocate_buffer(__pyx_v_self); if (unlikely(__pyx_t_8 == ((int)-1))) __PYX_ERR(1, 178, __pyx_L1_error) + + /* "View.MemoryView":177 + * self.dtype_is_object = format == b'O' + * + * if allocate_buffer: # <<<<<<<<<<<<<< + * _allocate_buffer(self) + * +*/ + } + + /* "View.MemoryView":129 + * cdef bint dtype_is_object + * + * def __cinit__(array self, tuple shape, Py_ssize_t itemsize, format not None, # <<<<<<<<<<<<<< + * mode="c", bint allocate_buffer=True): + * +*/ + + /* 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_10); + __Pyx_XDECREF(__pyx_t_12); + __Pyx_AddTraceback("View.MemoryView.array.__cinit__", __pyx_clineno, __pyx_lineno, __pyx_filename); + __pyx_r = -1; + __pyx_L0:; + __Pyx_XDECREF(__pyx_v_format); + __Pyx_RefNannyFinishContext(); + return __pyx_r; +} + +/* "View.MemoryView":180 + * _allocate_buffer(self) + * + * @cname('getbuffer') # <<<<<<<<<<<<<< + * def __getbuffer__(self, Py_buffer *info, int flags): + * cdef int bufmode = -1 +*/ + +/* Python wrapper */ +CYTHON_UNUSED static int __pyx_array_getbuffer(PyObject *__pyx_v_self, Py_buffer *__pyx_v_info, int __pyx_v_flags); /*proto*/ +CYTHON_UNUSED static int __pyx_array_getbuffer(PyObject *__pyx_v_self, Py_buffer *__pyx_v_info, int __pyx_v_flags) { + CYTHON_UNUSED PyObject *const *__pyx_kwvalues; + int __pyx_r; + __Pyx_RefNannyDeclarations + __Pyx_RefNannySetupContext("__getbuffer__ (wrapper)", 0); + __pyx_kwvalues = __Pyx_KwValues_VARARGS(__pyx_args, __pyx_nargs); + __pyx_r = __pyx_array___pyx_pf_15View_dot_MemoryView_5array_2__getbuffer__(((struct __pyx_array_obj *)__pyx_v_self), ((Py_buffer *)__pyx_v_info), ((int)__pyx_v_flags)); + + /* function exit code */ + __Pyx_RefNannyFinishContext(); + return __pyx_r; +} + +static int __pyx_array___pyx_pf_15View_dot_MemoryView_5array_2__getbuffer__(struct __pyx_array_obj *__pyx_v_self, Py_buffer *__pyx_v_info, int __pyx_v_flags) { + int __pyx_v_bufmode; + int __pyx_r; + __Pyx_RefNannyDeclarations + int __pyx_t_1; + char *__pyx_t_2; + Py_ssize_t __pyx_t_3; + int __pyx_t_4; + Py_ssize_t *__pyx_t_5; + int __pyx_lineno = 0; + const char *__pyx_filename = NULL; + int __pyx_clineno = 0; + if (unlikely(__pyx_v_info == NULL)) { + PyErr_SetString(PyExc_BufferError, "PyObject_GetBuffer: view==NULL argument is obsolete"); + return -1; + } + __Pyx_RefNannySetupContext("__getbuffer__", 0); + __pyx_v_info->obj = Py_None; __Pyx_INCREF(Py_None); + __Pyx_GIVEREF(__pyx_v_info->obj); + + /* "View.MemoryView":182 + * @cname('getbuffer') + * def __getbuffer__(self, Py_buffer *info, int flags): + * cdef int bufmode = -1 # <<<<<<<<<<<<<< + * if flags & (PyBUF_C_CONTIGUOUS | PyBUF_F_CONTIGUOUS | PyBUF_ANY_CONTIGUOUS): + * if self.mode == u"c": +*/ + __pyx_v_bufmode = -1; + + /* "View.MemoryView":183 + * def __getbuffer__(self, Py_buffer *info, int flags): + * cdef int bufmode = -1 + * if flags & (PyBUF_C_CONTIGUOUS | PyBUF_F_CONTIGUOUS | PyBUF_ANY_CONTIGUOUS): # <<<<<<<<<<<<<< + * if self.mode == u"c": + * bufmode = PyBUF_C_CONTIGUOUS | PyBUF_ANY_CONTIGUOUS +*/ + __pyx_t_1 = ((__pyx_v_flags & ((PyBUF_C_CONTIGUOUS | PyBUF_F_CONTIGUOUS) | PyBUF_ANY_CONTIGUOUS)) != 0); + if (__pyx_t_1) { + + /* "View.MemoryView":184 + * cdef int bufmode = -1 + * if flags & (PyBUF_C_CONTIGUOUS | PyBUF_F_CONTIGUOUS | PyBUF_ANY_CONTIGUOUS): + * if self.mode == u"c": # <<<<<<<<<<<<<< + * bufmode = PyBUF_C_CONTIGUOUS | PyBUF_ANY_CONTIGUOUS + * elif self.mode == u"fortran": +*/ + __pyx_t_1 = (__Pyx_PyUnicode_Equals(__pyx_v_self->mode, __pyx_mstate_global->__pyx_n_u_c, Py_EQ)); if (unlikely((__pyx_t_1 < 0))) __PYX_ERR(1, 184, __pyx_L1_error) + if (__pyx_t_1) { + + /* "View.MemoryView":185 + * if flags & (PyBUF_C_CONTIGUOUS | PyBUF_F_CONTIGUOUS | PyBUF_ANY_CONTIGUOUS): + * if self.mode == u"c": + * bufmode = PyBUF_C_CONTIGUOUS | PyBUF_ANY_CONTIGUOUS # <<<<<<<<<<<<<< + * elif self.mode == u"fortran": + * bufmode = PyBUF_F_CONTIGUOUS | PyBUF_ANY_CONTIGUOUS +*/ + __pyx_v_bufmode = (PyBUF_C_CONTIGUOUS | PyBUF_ANY_CONTIGUOUS); + + /* "View.MemoryView":184 + * cdef int bufmode = -1 + * if flags & (PyBUF_C_CONTIGUOUS | PyBUF_F_CONTIGUOUS | PyBUF_ANY_CONTIGUOUS): + * if self.mode == u"c": # <<<<<<<<<<<<<< + * bufmode = PyBUF_C_CONTIGUOUS | PyBUF_ANY_CONTIGUOUS + * elif self.mode == u"fortran": +*/ + goto __pyx_L4; + } + + /* "View.MemoryView":186 + * if self.mode == u"c": + * bufmode = PyBUF_C_CONTIGUOUS | PyBUF_ANY_CONTIGUOUS + * elif self.mode == u"fortran": # <<<<<<<<<<<<<< + * bufmode = PyBUF_F_CONTIGUOUS | PyBUF_ANY_CONTIGUOUS + * if not (flags & bufmode): +*/ + __pyx_t_1 = (__Pyx_PyUnicode_Equals(__pyx_v_self->mode, __pyx_mstate_global->__pyx_n_u_fortran, Py_EQ)); if (unlikely((__pyx_t_1 < 0))) __PYX_ERR(1, 186, __pyx_L1_error) + if (__pyx_t_1) { + + /* "View.MemoryView":187 + * bufmode = PyBUF_C_CONTIGUOUS | PyBUF_ANY_CONTIGUOUS + * elif self.mode == u"fortran": + * bufmode = PyBUF_F_CONTIGUOUS | PyBUF_ANY_CONTIGUOUS # <<<<<<<<<<<<<< + * if not (flags & bufmode): + * raise ValueError, "Can only create a buffer that is contiguous in memory." +*/ + __pyx_v_bufmode = (PyBUF_F_CONTIGUOUS | PyBUF_ANY_CONTIGUOUS); + + /* "View.MemoryView":186 + * if self.mode == u"c": + * bufmode = PyBUF_C_CONTIGUOUS | PyBUF_ANY_CONTIGUOUS + * elif self.mode == u"fortran": # <<<<<<<<<<<<<< + * bufmode = PyBUF_F_CONTIGUOUS | PyBUF_ANY_CONTIGUOUS + * if not (flags & bufmode): +*/ + } + __pyx_L4:; + + /* "View.MemoryView":188 + * elif self.mode == u"fortran": + * bufmode = PyBUF_F_CONTIGUOUS | PyBUF_ANY_CONTIGUOUS + * if not (flags & bufmode): # <<<<<<<<<<<<<< + * raise ValueError, "Can only create a buffer that is contiguous in memory." + * info.buf = self.data +*/ + __pyx_t_1 = (!((__pyx_v_flags & __pyx_v_bufmode) != 0)); + if (unlikely(__pyx_t_1)) { + + /* "View.MemoryView":189 + * bufmode = PyBUF_F_CONTIGUOUS | PyBUF_ANY_CONTIGUOUS + * if not (flags & bufmode): + * raise ValueError, "Can only create a buffer that is contiguous in memory." # <<<<<<<<<<<<<< + * info.buf = self.data + * info.len = self.len +*/ + __Pyx_Raise(((PyObject *)(((PyTypeObject*)PyExc_ValueError))), __pyx_mstate_global->__pyx_kp_u_Can_only_create_a_buffer_that_is, 0, 0); + __PYX_ERR(1, 189, __pyx_L1_error) + + /* "View.MemoryView":188 + * elif self.mode == u"fortran": + * bufmode = PyBUF_F_CONTIGUOUS | PyBUF_ANY_CONTIGUOUS + * if not (flags & bufmode): # <<<<<<<<<<<<<< + * raise ValueError, "Can only create a buffer that is contiguous in memory." + * info.buf = self.data +*/ + } + + /* "View.MemoryView":183 + * def __getbuffer__(self, Py_buffer *info, int flags): + * cdef int bufmode = -1 + * if flags & (PyBUF_C_CONTIGUOUS | PyBUF_F_CONTIGUOUS | PyBUF_ANY_CONTIGUOUS): # <<<<<<<<<<<<<< + * if self.mode == u"c": + * bufmode = PyBUF_C_CONTIGUOUS | PyBUF_ANY_CONTIGUOUS +*/ + } + + /* "View.MemoryView":190 + * if not (flags & bufmode): + * raise ValueError, "Can only create a buffer that is contiguous in memory." + * info.buf = self.data # <<<<<<<<<<<<<< + * info.len = self.len + * +*/ + __pyx_t_2 = __pyx_v_self->data; + __pyx_v_info->buf = __pyx_t_2; + + /* "View.MemoryView":191 + * raise ValueError, "Can only create a buffer that is contiguous in memory." + * info.buf = self.data + * info.len = self.len # <<<<<<<<<<<<<< + * + * if flags & PyBUF_STRIDES: +*/ + __pyx_t_3 = __pyx_v_self->len; + __pyx_v_info->len = __pyx_t_3; + + /* "View.MemoryView":193 + * info.len = self.len + * + * if flags & PyBUF_STRIDES: # <<<<<<<<<<<<<< + * info.ndim = self.ndim + * info.shape = self._shape +*/ + __pyx_t_1 = ((__pyx_v_flags & PyBUF_STRIDES) != 0); + if (__pyx_t_1) { + + /* "View.MemoryView":194 + * + * if flags & PyBUF_STRIDES: + * info.ndim = self.ndim # <<<<<<<<<<<<<< + * info.shape = self._shape + * info.strides = self._strides +*/ + __pyx_t_4 = __pyx_v_self->ndim; + __pyx_v_info->ndim = __pyx_t_4; + + /* "View.MemoryView":195 + * if flags & PyBUF_STRIDES: + * info.ndim = self.ndim + * info.shape = self._shape # <<<<<<<<<<<<<< + * info.strides = self._strides + * else: +*/ + __pyx_t_5 = __pyx_v_self->_shape; + __pyx_v_info->shape = __pyx_t_5; + + /* "View.MemoryView":196 + * info.ndim = self.ndim + * info.shape = self._shape + * info.strides = self._strides # <<<<<<<<<<<<<< + * else: + * info.ndim = 1 +*/ + __pyx_t_5 = __pyx_v_self->_strides; + __pyx_v_info->strides = __pyx_t_5; + + /* "View.MemoryView":193 + * info.len = self.len + * + * if flags & PyBUF_STRIDES: # <<<<<<<<<<<<<< + * info.ndim = self.ndim + * info.shape = self._shape +*/ + goto __pyx_L6; + } + + /* "View.MemoryView":198 + * info.strides = self._strides + * else: + * info.ndim = 1 # <<<<<<<<<<<<<< + * info.shape = &self.len if flags & PyBUF_ND else NULL + * info.strides = NULL +*/ + /*else*/ { + __pyx_v_info->ndim = 1; + + /* "View.MemoryView":199 + * else: + * info.ndim = 1 + * info.shape = &self.len if flags & PyBUF_ND else NULL # <<<<<<<<<<<<<< + * info.strides = NULL + * +*/ + __pyx_t_1 = ((__pyx_v_flags & PyBUF_ND) != 0); + if (__pyx_t_1) { + __pyx_t_5 = (&__pyx_v_self->len); + } else { + __pyx_t_5 = NULL; + } + __pyx_v_info->shape = __pyx_t_5; + + /* "View.MemoryView":200 + * info.ndim = 1 + * info.shape = &self.len if flags & PyBUF_ND else NULL + * info.strides = NULL # <<<<<<<<<<<<<< + * + * info.suboffsets = NULL +*/ + __pyx_v_info->strides = NULL; + } + __pyx_L6:; + + /* "View.MemoryView":202 + * info.strides = NULL + * + * info.suboffsets = NULL # <<<<<<<<<<<<<< + * info.itemsize = self.itemsize + * info.readonly = 0 +*/ + __pyx_v_info->suboffsets = NULL; + + /* "View.MemoryView":203 + * + * info.suboffsets = NULL + * info.itemsize = self.itemsize # <<<<<<<<<<<<<< + * info.readonly = 0 + * info.format = self.format if flags & PyBUF_FORMAT else NULL +*/ + __pyx_t_3 = __pyx_v_self->itemsize; + __pyx_v_info->itemsize = __pyx_t_3; + + /* "View.MemoryView":204 + * info.suboffsets = NULL + * info.itemsize = self.itemsize + * info.readonly = 0 # <<<<<<<<<<<<<< + * info.format = self.format if flags & PyBUF_FORMAT else NULL + * info.obj = self +*/ + __pyx_v_info->readonly = 0; + + /* "View.MemoryView":205 + * info.itemsize = self.itemsize + * info.readonly = 0 + * info.format = self.format if flags & PyBUF_FORMAT else NULL # <<<<<<<<<<<<<< + * info.obj = self + * +*/ + __pyx_t_1 = ((__pyx_v_flags & PyBUF_FORMAT) != 0); + if (__pyx_t_1) { + __pyx_t_2 = __pyx_v_self->format; + } else { + __pyx_t_2 = NULL; + } + __pyx_v_info->format = __pyx_t_2; + + /* "View.MemoryView":206 + * info.readonly = 0 + * info.format = self.format if flags & PyBUF_FORMAT else NULL + * info.obj = self # <<<<<<<<<<<<<< + * + * def __dealloc__(array self): +*/ + __Pyx_INCREF((PyObject *)__pyx_v_self); + __Pyx_GIVEREF((PyObject *)__pyx_v_self); + __Pyx_GOTREF(__pyx_v_info->obj); + __Pyx_DECREF(__pyx_v_info->obj); + __pyx_v_info->obj = ((PyObject *)__pyx_v_self); + + /* "View.MemoryView":180 + * _allocate_buffer(self) + * + * @cname('getbuffer') # <<<<<<<<<<<<<< + * def __getbuffer__(self, Py_buffer *info, int flags): + * cdef int bufmode = -1 +*/ + + /* function exit code */ + __pyx_r = 0; + goto __pyx_L0; + __pyx_L1_error:; + __Pyx_AddTraceback("View.MemoryView.array.__getbuffer__", __pyx_clineno, __pyx_lineno, __pyx_filename); + __pyx_r = -1; + if (__pyx_v_info->obj != NULL) { + __Pyx_GOTREF(__pyx_v_info->obj); + __Pyx_DECREF(__pyx_v_info->obj); __pyx_v_info->obj = 0; + } + goto __pyx_L2; + __pyx_L0:; + if (__pyx_v_info->obj == Py_None) { + __Pyx_GOTREF(__pyx_v_info->obj); + __Pyx_DECREF(__pyx_v_info->obj); __pyx_v_info->obj = 0; + } + __pyx_L2:; + __Pyx_RefNannyFinishContext(); + return __pyx_r; +} + +/* "View.MemoryView":208 + * info.obj = self + * + * def __dealloc__(array self): # <<<<<<<<<<<<<< + * if self.callback_free_data != NULL: + * self.callback_free_data(self.data) +*/ + +/* Python wrapper */ +static void __pyx_array___dealloc__(PyObject *__pyx_v_self); /*proto*/ +static void __pyx_array___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_array___pyx_pf_15View_dot_MemoryView_5array_4__dealloc__(((struct __pyx_array_obj *)__pyx_v_self)); + + /* function exit code */ + __Pyx_RefNannyFinishContext(); +} + +static void __pyx_array___pyx_pf_15View_dot_MemoryView_5array_4__dealloc__(struct __pyx_array_obj *__pyx_v_self) { + int __pyx_t_1; + int __pyx_t_2; + + /* "View.MemoryView":209 + * + * def __dealloc__(array self): + * if self.callback_free_data != NULL: # <<<<<<<<<<<<<< + * self.callback_free_data(self.data) + * elif self.free_data and self.data is not NULL: +*/ + __pyx_t_1 = (__pyx_v_self->callback_free_data != NULL); + if (__pyx_t_1) { + + /* "View.MemoryView":210 + * def __dealloc__(array self): + * if self.callback_free_data != NULL: + * self.callback_free_data(self.data) # <<<<<<<<<<<<<< + * elif self.free_data and self.data is not NULL: + * if self.dtype_is_object: +*/ + __pyx_v_self->callback_free_data(__pyx_v_self->data); + + /* "View.MemoryView":209 + * + * def __dealloc__(array self): + * if self.callback_free_data != NULL: # <<<<<<<<<<<<<< + * self.callback_free_data(self.data) + * elif self.free_data and self.data is not NULL: +*/ + goto __pyx_L3; + } + + /* "View.MemoryView":211 + * if self.callback_free_data != NULL: + * self.callback_free_data(self.data) + * elif self.free_data and self.data is not NULL: # <<<<<<<<<<<<<< + * if self.dtype_is_object: + * refcount_objects_in_slice(self.data, self._shape, self._strides, self.ndim, inc=False) +*/ + if (__pyx_v_self->free_data) { + } else { + __pyx_t_1 = __pyx_v_self->free_data; + goto __pyx_L4_bool_binop_done; + } + __pyx_t_2 = (__pyx_v_self->data != NULL); + __pyx_t_1 = __pyx_t_2; + __pyx_L4_bool_binop_done:; + if (__pyx_t_1) { + + /* "View.MemoryView":212 + * self.callback_free_data(self.data) + * elif self.free_data and self.data is not NULL: + * if self.dtype_is_object: # <<<<<<<<<<<<<< + * refcount_objects_in_slice(self.data, self._shape, self._strides, self.ndim, inc=False) + * free(self.data) +*/ + if (__pyx_v_self->dtype_is_object) { + + /* "View.MemoryView":213 + * elif self.free_data and self.data is not NULL: + * if self.dtype_is_object: + * refcount_objects_in_slice(self.data, self._shape, self._strides, self.ndim, inc=False) # <<<<<<<<<<<<<< + * free(self.data) + * PyObject_Free(self._shape) +*/ + __pyx_memoryview_refcount_objects_in_slice(__pyx_v_self->data, __pyx_v_self->_shape, __pyx_v_self->_strides, __pyx_v_self->ndim, 0); + + /* "View.MemoryView":212 + * self.callback_free_data(self.data) + * elif self.free_data and self.data is not NULL: + * if self.dtype_is_object: # <<<<<<<<<<<<<< + * refcount_objects_in_slice(self.data, self._shape, self._strides, self.ndim, inc=False) + * free(self.data) +*/ + } + + /* "View.MemoryView":214 + * if self.dtype_is_object: + * refcount_objects_in_slice(self.data, self._shape, self._strides, self.ndim, inc=False) + * free(self.data) # <<<<<<<<<<<<<< + * PyObject_Free(self._shape) + * +*/ + free(__pyx_v_self->data); + + /* "View.MemoryView":211 + * if self.callback_free_data != NULL: + * self.callback_free_data(self.data) + * elif self.free_data and self.data is not NULL: # <<<<<<<<<<<<<< + * if self.dtype_is_object: + * refcount_objects_in_slice(self.data, self._shape, self._strides, self.ndim, inc=False) +*/ + } + __pyx_L3:; + + /* "View.MemoryView":215 + * refcount_objects_in_slice(self.data, self._shape, self._strides, self.ndim, inc=False) + * free(self.data) + * PyObject_Free(self._shape) # <<<<<<<<<<<<<< + * + * @property +*/ + PyObject_Free(__pyx_v_self->_shape); + + /* "View.MemoryView":208 + * info.obj = self + * + * def __dealloc__(array self): # <<<<<<<<<<<<<< + * if self.callback_free_data != NULL: + * self.callback_free_data(self.data) +*/ + + /* function exit code */ +} + +/* "View.MemoryView":217 + * PyObject_Free(self._shape) + * + * @property # <<<<<<<<<<<<<< + * def memview(self): + * return self.get_memview() +*/ + +/* Python wrapper */ +static PyObject *__pyx_pw_15View_dot_MemoryView_5array_7memview_1__get__(PyObject *__pyx_v_self); /*proto*/ +static PyObject *__pyx_pw_15View_dot_MemoryView_5array_7memview_1__get__(PyObject *__pyx_v_self) { + CYTHON_UNUSED PyObject *const *__pyx_kwvalues; + PyObject *__pyx_r = 0; + __Pyx_RefNannyDeclarations + __Pyx_RefNannySetupContext("__get__ (wrapper)", 0); + __pyx_kwvalues = __Pyx_KwValues_VARARGS(__pyx_args, __pyx_nargs); + __pyx_r = __pyx_pf_15View_dot_MemoryView_5array_7memview___get__(((struct __pyx_array_obj *)__pyx_v_self)); + + /* function exit code */ + __Pyx_RefNannyFinishContext(); + return __pyx_r; +} + +static PyObject *__pyx_pf_15View_dot_MemoryView_5array_7memview___get__(struct __pyx_array_obj *__pyx_v_self) { + PyObject *__pyx_r = NULL; + __Pyx_RefNannyDeclarations + PyObject *__pyx_t_1 = NULL; + int __pyx_lineno = 0; + const char *__pyx_filename = NULL; + int __pyx_clineno = 0; + __Pyx_RefNannySetupContext("__get__", 0); + + /* "View.MemoryView":219 + * @property + * def memview(self): + * return self.get_memview() # <<<<<<<<<<<<<< + * + * @cname('get_memview') +*/ + __Pyx_XDECREF(__pyx_r); + __pyx_t_1 = ((struct __pyx_vtabstruct_array *)__pyx_v_self->__pyx_vtab)->get_memview(__pyx_v_self); if (unlikely(!__pyx_t_1)) __PYX_ERR(1, 219, __pyx_L1_error) + __Pyx_GOTREF(__pyx_t_1); + __pyx_r = __pyx_t_1; + __pyx_t_1 = 0; + goto __pyx_L0; + + /* "View.MemoryView":217 + * PyObject_Free(self._shape) + * + * @property # <<<<<<<<<<<<<< + * def memview(self): + * return self.get_memview() +*/ + + /* function exit code */ + __pyx_L1_error:; + __Pyx_XDECREF(__pyx_t_1); + __Pyx_AddTraceback("View.MemoryView.array.memview.__get__", __pyx_clineno, __pyx_lineno, __pyx_filename); + __pyx_r = NULL; + __pyx_L0:; + __Pyx_XGIVEREF(__pyx_r); + __Pyx_RefNannyFinishContext(); + return __pyx_r; +} + +/* "View.MemoryView":221 + * return self.get_memview() + * + * @cname('get_memview') # <<<<<<<<<<<<<< + * cdef get_memview(self): + * flags = PyBUF_ANY_CONTIGUOUS|PyBUF_FORMAT|PyBUF_WRITABLE +*/ + +static PyObject *__pyx_array_get_memview(struct __pyx_array_obj *__pyx_v_self) { + int __pyx_v_flags; + PyObject *__pyx_r = NULL; + __Pyx_RefNannyDeclarations + PyObject *__pyx_t_1 = NULL; + PyObject *__pyx_t_2 = NULL; + PyObject *__pyx_t_3 = NULL; + PyObject *__pyx_t_4 = NULL; + size_t __pyx_t_5; + int __pyx_lineno = 0; + const char *__pyx_filename = NULL; + int __pyx_clineno = 0; + __Pyx_RefNannySetupContext("get_memview", 0); + + /* "View.MemoryView":223 + * @cname('get_memview') + * cdef get_memview(self): + * flags = PyBUF_ANY_CONTIGUOUS|PyBUF_FORMAT|PyBUF_WRITABLE # <<<<<<<<<<<<<< + * return memoryview(self, flags, self.dtype_is_object) + * +*/ + __pyx_v_flags = ((PyBUF_ANY_CONTIGUOUS | PyBUF_FORMAT) | PyBUF_WRITABLE); + + /* "View.MemoryView":224 + * cdef get_memview(self): + * flags = PyBUF_ANY_CONTIGUOUS|PyBUF_FORMAT|PyBUF_WRITABLE + * return memoryview(self, flags, self.dtype_is_object) # <<<<<<<<<<<<<< + * + * def __len__(self): +*/ + __Pyx_XDECREF(__pyx_r); + __pyx_t_2 = NULL; + __pyx_t_3 = __Pyx_PyLong_From_int(__pyx_v_flags); if (unlikely(!__pyx_t_3)) __PYX_ERR(1, 224, __pyx_L1_error) + __Pyx_GOTREF(__pyx_t_3); + __pyx_t_4 = __Pyx_PyBool_FromLong(__pyx_v_self->dtype_is_object); if (unlikely(!__pyx_t_4)) __PYX_ERR(1, 224, __pyx_L1_error) + __Pyx_GOTREF(__pyx_t_4); + __pyx_t_5 = 1; + { + PyObject *__pyx_callargs[4] = {__pyx_t_2, ((PyObject *)__pyx_v_self), __pyx_t_3, __pyx_t_4}; + __pyx_t_1 = __Pyx_PyObject_FastCall((PyObject*)__pyx_mstate_global->__pyx_memoryview_type, __pyx_callargs+__pyx_t_5, (4-__pyx_t_5) | (__pyx_t_5*__Pyx_PY_VECTORCALL_ARGUMENTS_OFFSET)); + __Pyx_XDECREF(__pyx_t_2); __pyx_t_2 = 0; + __Pyx_DECREF(__pyx_t_3); __pyx_t_3 = 0; + __Pyx_DECREF(__pyx_t_4); __pyx_t_4 = 0; + if (unlikely(!__pyx_t_1)) __PYX_ERR(1, 224, __pyx_L1_error) + __Pyx_GOTREF((PyObject *)__pyx_t_1); + } + __pyx_r = ((PyObject *)__pyx_t_1); + __pyx_t_1 = 0; + goto __pyx_L0; + + /* "View.MemoryView":221 + * return self.get_memview() + * + * @cname('get_memview') # <<<<<<<<<<<<<< + * cdef get_memview(self): + * flags = PyBUF_ANY_CONTIGUOUS|PyBUF_FORMAT|PyBUF_WRITABLE +*/ + + /* function exit code */ + __pyx_L1_error:; + __Pyx_XDECREF(__pyx_t_1); + __Pyx_XDECREF(__pyx_t_2); + __Pyx_XDECREF(__pyx_t_3); + __Pyx_XDECREF(__pyx_t_4); + __Pyx_AddTraceback("View.MemoryView.array.get_memview", __pyx_clineno, __pyx_lineno, __pyx_filename); + __pyx_r = 0; + __pyx_L0:; + __Pyx_XGIVEREF(__pyx_r); + __Pyx_RefNannyFinishContext(); + return __pyx_r; +} + +/* "View.MemoryView":226 + * return memoryview(self, flags, self.dtype_is_object) + * + * def __len__(self): # <<<<<<<<<<<<<< + * return self._shape[0] + * +*/ + +/* Python wrapper */ +static Py_ssize_t __pyx_array___len__(PyObject *__pyx_v_self); /*proto*/ +static Py_ssize_t __pyx_array___len__(PyObject *__pyx_v_self) { + CYTHON_UNUSED PyObject *const *__pyx_kwvalues; + Py_ssize_t __pyx_r; + __Pyx_RefNannyDeclarations + __Pyx_RefNannySetupContext("__len__ (wrapper)", 0); + __pyx_kwvalues = __Pyx_KwValues_VARARGS(__pyx_args, __pyx_nargs); + __pyx_r = __pyx_array___pyx_pf_15View_dot_MemoryView_5array_6__len__(((struct __pyx_array_obj *)__pyx_v_self)); + + /* function exit code */ + __Pyx_RefNannyFinishContext(); + return __pyx_r; +} + +static Py_ssize_t __pyx_array___pyx_pf_15View_dot_MemoryView_5array_6__len__(struct __pyx_array_obj *__pyx_v_self) { + Py_ssize_t __pyx_r; + + /* "View.MemoryView":227 + * + * def __len__(self): + * return self._shape[0] # <<<<<<<<<<<<<< + * + * def __getattr__(self, attr): +*/ + __pyx_r = (__pyx_v_self->_shape[0]); + goto __pyx_L0; + + /* "View.MemoryView":226 + * return memoryview(self, flags, self.dtype_is_object) + * + * def __len__(self): # <<<<<<<<<<<<<< + * return self._shape[0] + * +*/ + + /* function exit code */ + __pyx_L0:; + return __pyx_r; +} + +/* "View.MemoryView":229 + * return self._shape[0] + * + * def __getattr__(self, attr): # <<<<<<<<<<<<<< + * return getattr(self.memview, attr) + * +*/ + +/* Python wrapper */ +static PyObject *__pyx_array___getattr__(PyObject *__pyx_v_self, PyObject *__pyx_v_attr); /*proto*/ +static PyObject *__pyx_array___getattr__(PyObject *__pyx_v_self, PyObject *__pyx_v_attr) { + CYTHON_UNUSED PyObject *const *__pyx_kwvalues; + PyObject *__pyx_r = 0; + __Pyx_RefNannyDeclarations + __Pyx_RefNannySetupContext("__getattr__ (wrapper)", 0); + __pyx_kwvalues = __Pyx_KwValues_VARARGS(__pyx_args, __pyx_nargs); + __pyx_r = __pyx_array___pyx_pf_15View_dot_MemoryView_5array_8__getattr__(((struct __pyx_array_obj *)__pyx_v_self), ((PyObject *)__pyx_v_attr)); + + /* function exit code */ + __Pyx_RefNannyFinishContext(); + return __pyx_r; +} + +static PyObject *__pyx_array___pyx_pf_15View_dot_MemoryView_5array_8__getattr__(struct __pyx_array_obj *__pyx_v_self, PyObject *__pyx_v_attr) { + PyObject *__pyx_r = NULL; + __Pyx_RefNannyDeclarations + PyObject *__pyx_t_1 = NULL; + PyObject *__pyx_t_2 = NULL; + int __pyx_lineno = 0; + const char *__pyx_filename = NULL; + int __pyx_clineno = 0; + __Pyx_RefNannySetupContext("__getattr__", 0); + + /* "View.MemoryView":230 + * + * def __getattr__(self, attr): + * return getattr(self.memview, attr) # <<<<<<<<<<<<<< + * + * def __getitem__(self, item): +*/ + __Pyx_XDECREF(__pyx_r); + __pyx_t_1 = __Pyx_PyObject_GetAttrStr(((PyObject *)__pyx_v_self), __pyx_mstate_global->__pyx_n_u_memview); if (unlikely(!__pyx_t_1)) __PYX_ERR(1, 230, __pyx_L1_error) + __Pyx_GOTREF(__pyx_t_1); + __pyx_t_2 = __Pyx_GetAttr(__pyx_t_1, __pyx_v_attr); if (unlikely(!__pyx_t_2)) __PYX_ERR(1, 230, __pyx_L1_error) + __Pyx_GOTREF(__pyx_t_2); + __Pyx_DECREF(__pyx_t_1); __pyx_t_1 = 0; + __pyx_r = __pyx_t_2; + __pyx_t_2 = 0; + goto __pyx_L0; + + /* "View.MemoryView":229 + * return self._shape[0] + * + * def __getattr__(self, attr): # <<<<<<<<<<<<<< + * return getattr(self.memview, attr) + * +*/ + + /* function exit code */ + __pyx_L1_error:; + __Pyx_XDECREF(__pyx_t_1); + __Pyx_XDECREF(__pyx_t_2); + __Pyx_AddTraceback("View.MemoryView.array.__getattr__", __pyx_clineno, __pyx_lineno, __pyx_filename); + __pyx_r = NULL; + __pyx_L0:; + __Pyx_XGIVEREF(__pyx_r); + __Pyx_RefNannyFinishContext(); + return __pyx_r; +} + +/* "View.MemoryView":232 + * return getattr(self.memview, attr) + * + * def __getitem__(self, item): # <<<<<<<<<<<<<< + * return self.memview[item] + * +*/ + +/* Python wrapper */ +static PyObject *__pyx_array___getitem__(PyObject *__pyx_v_self, PyObject *__pyx_v_item); /*proto*/ +static PyObject *__pyx_array___getitem__(PyObject *__pyx_v_self, PyObject *__pyx_v_item) { + CYTHON_UNUSED PyObject *const *__pyx_kwvalues; + PyObject *__pyx_r = 0; + __Pyx_RefNannyDeclarations + __Pyx_RefNannySetupContext("__getitem__ (wrapper)", 0); + __pyx_kwvalues = __Pyx_KwValues_VARARGS(__pyx_args, __pyx_nargs); + __pyx_r = __pyx_array___pyx_pf_15View_dot_MemoryView_5array_10__getitem__(((struct __pyx_array_obj *)__pyx_v_self), ((PyObject *)__pyx_v_item)); + + /* function exit code */ + __Pyx_RefNannyFinishContext(); + return __pyx_r; +} + +static PyObject *__pyx_array___pyx_pf_15View_dot_MemoryView_5array_10__getitem__(struct __pyx_array_obj *__pyx_v_self, PyObject *__pyx_v_item) { + PyObject *__pyx_r = NULL; + __Pyx_RefNannyDeclarations + PyObject *__pyx_t_1 = NULL; + PyObject *__pyx_t_2 = NULL; + int __pyx_lineno = 0; + const char *__pyx_filename = NULL; + int __pyx_clineno = 0; + __Pyx_RefNannySetupContext("__getitem__", 0); + + /* "View.MemoryView":233 + * + * def __getitem__(self, item): + * return self.memview[item] # <<<<<<<<<<<<<< + * + * def __setitem__(self, item, value): +*/ + __Pyx_XDECREF(__pyx_r); + __pyx_t_1 = __Pyx_PyObject_GetAttrStr(((PyObject *)__pyx_v_self), __pyx_mstate_global->__pyx_n_u_memview); if (unlikely(!__pyx_t_1)) __PYX_ERR(1, 233, __pyx_L1_error) + __Pyx_GOTREF(__pyx_t_1); + __pyx_t_2 = __Pyx_PyObject_GetItem(__pyx_t_1, __pyx_v_item); if (unlikely(!__pyx_t_2)) __PYX_ERR(1, 233, __pyx_L1_error) + __Pyx_GOTREF(__pyx_t_2); + __Pyx_DECREF(__pyx_t_1); __pyx_t_1 = 0; + __pyx_r = __pyx_t_2; + __pyx_t_2 = 0; + goto __pyx_L0; + + /* "View.MemoryView":232 + * return getattr(self.memview, attr) + * + * def __getitem__(self, item): # <<<<<<<<<<<<<< + * return self.memview[item] + * +*/ + + /* function exit code */ + __pyx_L1_error:; + __Pyx_XDECREF(__pyx_t_1); + __Pyx_XDECREF(__pyx_t_2); + __Pyx_AddTraceback("View.MemoryView.array.__getitem__", __pyx_clineno, __pyx_lineno, __pyx_filename); + __pyx_r = NULL; + __pyx_L0:; + __Pyx_XGIVEREF(__pyx_r); + __Pyx_RefNannyFinishContext(); + return __pyx_r; +} + +/* "View.MemoryView":235 + * return self.memview[item] + * + * def __setitem__(self, item, value): # <<<<<<<<<<<<<< + * self.memview[item] = value + * +*/ + +/* Python wrapper */ +static int __pyx_array___setitem__(PyObject *__pyx_v_self, PyObject *__pyx_v_item, PyObject *__pyx_v_value); /*proto*/ +static int __pyx_array___setitem__(PyObject *__pyx_v_self, PyObject *__pyx_v_item, PyObject *__pyx_v_value) { + CYTHON_UNUSED PyObject *const *__pyx_kwvalues; + int __pyx_r; + __Pyx_RefNannyDeclarations + __Pyx_RefNannySetupContext("__setitem__ (wrapper)", 0); + __pyx_kwvalues = __Pyx_KwValues_VARARGS(__pyx_args, __pyx_nargs); + __pyx_r = __pyx_array___pyx_pf_15View_dot_MemoryView_5array_12__setitem__(((struct __pyx_array_obj *)__pyx_v_self), ((PyObject *)__pyx_v_item), ((PyObject *)__pyx_v_value)); + + /* function exit code */ + __Pyx_RefNannyFinishContext(); + return __pyx_r; +} + +static int __pyx_array___pyx_pf_15View_dot_MemoryView_5array_12__setitem__(struct __pyx_array_obj *__pyx_v_self, PyObject *__pyx_v_item, PyObject *__pyx_v_value) { + int __pyx_r; + __Pyx_RefNannyDeclarations + PyObject *__pyx_t_1 = NULL; + int __pyx_lineno = 0; + const char *__pyx_filename = NULL; + int __pyx_clineno = 0; + __Pyx_RefNannySetupContext("__setitem__", 0); + + /* "View.MemoryView":236 + * + * def __setitem__(self, item, value): + * self.memview[item] = value # <<<<<<<<<<<<<< + * + * +*/ + __pyx_t_1 = __Pyx_PyObject_GetAttrStr(((PyObject *)__pyx_v_self), __pyx_mstate_global->__pyx_n_u_memview); if (unlikely(!__pyx_t_1)) __PYX_ERR(1, 236, __pyx_L1_error) + __Pyx_GOTREF(__pyx_t_1); + if (unlikely((PyObject_SetItem(__pyx_t_1, __pyx_v_item, __pyx_v_value) < 0))) __PYX_ERR(1, 236, __pyx_L1_error) + __Pyx_DECREF(__pyx_t_1); __pyx_t_1 = 0; + + /* "View.MemoryView":235 + * return self.memview[item] + * + * def __setitem__(self, item, value): # <<<<<<<<<<<<<< + * self.memview[item] = value + * +*/ + + /* function exit code */ + __pyx_r = 0; + goto __pyx_L0; + __pyx_L1_error:; + __Pyx_XDECREF(__pyx_t_1); + __Pyx_AddTraceback("View.MemoryView.array.__setitem__", __pyx_clineno, __pyx_lineno, __pyx_filename); + __pyx_r = -1; + __pyx_L0:; + __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___pyx_array_1__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*/ +static PyObject *__pyx_pw___pyx_array_1__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___pyx_array___reduce_cython__(((struct __pyx_array_obj *)__pyx_v_self)); + + /* function exit code */ + __Pyx_RefNannyFinishContext(); + return __pyx_r; +} + +static PyObject *__pyx_pf___pyx_array___reduce_cython__(CYTHON_UNUSED struct __pyx_array_obj *__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("View.MemoryView.array.__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___pyx_array_3__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*/ +static PyObject *__pyx_pw___pyx_array_3__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("View.MemoryView.array.__setstate_cython__", __pyx_clineno, __pyx_lineno, __pyx_filename); + __Pyx_RefNannyFinishContext(); + return NULL; + __pyx_L4_argument_unpacking_done:; + __pyx_r = __pyx_pf___pyx_array_2__setstate_cython__(((struct __pyx_array_obj *)__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___pyx_array_2__setstate_cython__(CYTHON_UNUSED struct __pyx_array_obj *__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("View.MemoryView.array.__setstate_cython__", __pyx_clineno, __pyx_lineno, __pyx_filename); + __pyx_r = NULL; + __Pyx_XGIVEREF(__pyx_r); + __Pyx_RefNannyFinishContext(); + return __pyx_r; +} + +/* "View.MemoryView":245 + * pass + * + * @cname("__pyx_array_allocate_buffer") # <<<<<<<<<<<<<< + * cdef int _allocate_buffer(array self) except -1: + * +*/ + +static int __pyx_array_allocate_buffer(struct __pyx_array_obj *__pyx_v_self) { + Py_ssize_t __pyx_v_i; + PyObject **__pyx_v_p; + int __pyx_r; + int __pyx_t_1; + Py_ssize_t __pyx_t_2; + Py_ssize_t __pyx_t_3; + Py_ssize_t __pyx_t_4; + int __pyx_lineno = 0; + const char *__pyx_filename = NULL; + int __pyx_clineno = 0; + + /* "View.MemoryView":252 + * cdef PyObject **p + * + * self.free_data = True # <<<<<<<<<<<<<< + * self.data = malloc(self.len) + * if not self.data: +*/ + __pyx_v_self->free_data = 1; + + /* "View.MemoryView":253 + * + * self.free_data = True + * self.data = malloc(self.len) # <<<<<<<<<<<<<< + * if not self.data: + * raise MemoryError, "unable to allocate array data." +*/ + __pyx_v_self->data = ((char *)malloc(__pyx_v_self->len)); + + /* "View.MemoryView":254 + * self.free_data = True + * self.data = malloc(self.len) + * if not self.data: # <<<<<<<<<<<<<< + * raise MemoryError, "unable to allocate array data." + * +*/ + __pyx_t_1 = (!(__pyx_v_self->data != 0)); + if (unlikely(__pyx_t_1)) { + + /* "View.MemoryView":255 + * self.data = malloc(self.len) + * if not self.data: + * raise MemoryError, "unable to allocate array data." # <<<<<<<<<<<<<< + * + * if self.dtype_is_object: +*/ + __Pyx_Raise(((PyObject *)(((PyTypeObject*)PyExc_MemoryError))), __pyx_mstate_global->__pyx_kp_u_unable_to_allocate_array_data, 0, 0); + __PYX_ERR(1, 255, __pyx_L1_error) + + /* "View.MemoryView":254 + * self.free_data = True + * self.data = malloc(self.len) + * if not self.data: # <<<<<<<<<<<<<< + * raise MemoryError, "unable to allocate array data." + * +*/ + } + + /* "View.MemoryView":257 + * raise MemoryError, "unable to allocate array data." + * + * if self.dtype_is_object: # <<<<<<<<<<<<<< + * p = self.data + * for i in range(self.len // self.itemsize): +*/ + if (__pyx_v_self->dtype_is_object) { + + /* "View.MemoryView":258 + * + * if self.dtype_is_object: + * p = self.data # <<<<<<<<<<<<<< + * for i in range(self.len // self.itemsize): + * p[i] = Py_None +*/ + __pyx_v_p = ((PyObject **)__pyx_v_self->data); + + /* "View.MemoryView":259 + * if self.dtype_is_object: + * p = self.data + * for i in range(self.len // self.itemsize): # <<<<<<<<<<<<<< + * p[i] = Py_None + * Py_INCREF(Py_None) +*/ + if (unlikely(__pyx_v_self->itemsize == 0)) { + PyErr_SetString(PyExc_ZeroDivisionError, "integer division or modulo by zero"); + __PYX_ERR(1, 259, __pyx_L1_error) + } + else if (sizeof(Py_ssize_t) == sizeof(long) && (!(((Py_ssize_t)-1) > 0)) && unlikely(__pyx_v_self->itemsize == (Py_ssize_t)-1) && unlikely(__Pyx_UNARY_NEG_WOULD_OVERFLOW(__pyx_v_self->len))) { + PyErr_SetString(PyExc_OverflowError, "value too large to perform division"); + __PYX_ERR(1, 259, __pyx_L1_error) + } + __pyx_t_2 = __Pyx_div_Py_ssize_t(__pyx_v_self->len, __pyx_v_self->itemsize, 0); + __pyx_t_3 = __pyx_t_2; + for (__pyx_t_4 = 0; __pyx_t_4 < __pyx_t_3; __pyx_t_4+=1) { + __pyx_v_i = __pyx_t_4; + + /* "View.MemoryView":260 + * p = self.data + * for i in range(self.len // self.itemsize): + * p[i] = Py_None # <<<<<<<<<<<<<< + * Py_INCREF(Py_None) + * return 0 +*/ + (__pyx_v_p[__pyx_v_i]) = Py_None; + + /* "View.MemoryView":261 + * for i in range(self.len // self.itemsize): + * p[i] = Py_None + * Py_INCREF(Py_None) # <<<<<<<<<<<<<< + * return 0 + * +*/ + Py_INCREF(Py_None); + } + + /* "View.MemoryView":257 + * raise MemoryError, "unable to allocate array data." + * + * if self.dtype_is_object: # <<<<<<<<<<<<<< + * p = self.data + * for i in range(self.len // self.itemsize): +*/ + } + + /* "View.MemoryView":262 + * p[i] = Py_None + * Py_INCREF(Py_None) + * return 0 # <<<<<<<<<<<<<< + * + * +*/ + __pyx_r = 0; + goto __pyx_L0; + + /* "View.MemoryView":245 + * pass + * + * @cname("__pyx_array_allocate_buffer") # <<<<<<<<<<<<<< + * cdef int _allocate_buffer(array self) except -1: + * +*/ + + /* function exit code */ + __pyx_L1_error:; + __Pyx_AddTraceback("View.MemoryView._allocate_buffer", __pyx_clineno, __pyx_lineno, __pyx_filename); + __pyx_r = -1; + __pyx_L0:; + return __pyx_r; +} + +/* "View.MemoryView":265 + * + * + * @cname("__pyx_array_new") # <<<<<<<<<<<<<< + * cdef array array_cwrapper(tuple shape, Py_ssize_t itemsize, char *format, const char *c_mode, char *buf): + * cdef array result +*/ + +static struct __pyx_array_obj *__pyx_array_new(PyObject *__pyx_v_shape, Py_ssize_t __pyx_v_itemsize, char *__pyx_v_format, char const *__pyx_v_c_mode, char *__pyx_v_buf) { + struct __pyx_array_obj *__pyx_v_result = 0; + PyObject *__pyx_v_mode = 0; + struct __pyx_array_obj *__pyx_r = NULL; + __Pyx_RefNannyDeclarations + PyObject *__pyx_t_1 = NULL; + int __pyx_t_2; + PyObject *__pyx_t_3 = NULL; + PyObject *__pyx_t_4 = NULL; + int __pyx_lineno = 0; + const char *__pyx_filename = NULL; + int __pyx_clineno = 0; + __Pyx_RefNannySetupContext("array_cwrapper", 0); + + /* "View.MemoryView":268 + * cdef array array_cwrapper(tuple shape, Py_ssize_t itemsize, char *format, const char *c_mode, char *buf): + * cdef array result + * cdef str mode = "fortran" if c_mode[0] == b'f' else "c" # this often comes from a constant C string. # <<<<<<<<<<<<<< + * + * if buf is NULL: +*/ + __pyx_t_2 = ((__pyx_v_c_mode[0]) == 'f'); + if (__pyx_t_2) { + __Pyx_INCREF(__pyx_mstate_global->__pyx_n_u_fortran); + __pyx_t_1 = __pyx_mstate_global->__pyx_n_u_fortran; + } else { + __Pyx_INCREF(__pyx_mstate_global->__pyx_n_u_c); + __pyx_t_1 = __pyx_mstate_global->__pyx_n_u_c; + } + __pyx_v_mode = ((PyObject*)__pyx_t_1); + __pyx_t_1 = 0; + + /* "View.MemoryView":270 + * cdef str mode = "fortran" if c_mode[0] == b'f' else "c" # this often comes from a constant C string. + * + * if buf is NULL: # <<<<<<<<<<<<<< + * result = array.__new__(array, shape, itemsize, format, mode) + * else: +*/ + __pyx_t_2 = (__pyx_v_buf == NULL); + if (__pyx_t_2) { + + /* "View.MemoryView":271 + * + * if buf is NULL: + * result = array.__new__(array, shape, itemsize, format, mode) # <<<<<<<<<<<<<< + * else: + * result = array.__new__(array, shape, itemsize, format, mode, allocate_buffer=False) +*/ + __pyx_t_1 = PyLong_FromSsize_t(__pyx_v_itemsize); if (unlikely(!__pyx_t_1)) __PYX_ERR(1, 271, __pyx_L1_error) + __Pyx_GOTREF(__pyx_t_1); + __pyx_t_3 = __Pyx_PyBytes_FromString(__pyx_v_format); if (unlikely(!__pyx_t_3)) __PYX_ERR(1, 271, __pyx_L1_error) + __Pyx_GOTREF(__pyx_t_3); + __pyx_t_4 = PyTuple_New(4); if (unlikely(!__pyx_t_4)) __PYX_ERR(1, 271, __pyx_L1_error) + __Pyx_GOTREF(__pyx_t_4); + __Pyx_INCREF(__pyx_v_shape); + __Pyx_GIVEREF(__pyx_v_shape); + if (__Pyx_PyTuple_SET_ITEM(__pyx_t_4, 0, __pyx_v_shape) != (0)) __PYX_ERR(1, 271, __pyx_L1_error); + __Pyx_GIVEREF(__pyx_t_1); + if (__Pyx_PyTuple_SET_ITEM(__pyx_t_4, 1, __pyx_t_1) != (0)) __PYX_ERR(1, 271, __pyx_L1_error); + __Pyx_GIVEREF(__pyx_t_3); + if (__Pyx_PyTuple_SET_ITEM(__pyx_t_4, 2, __pyx_t_3) != (0)) __PYX_ERR(1, 271, __pyx_L1_error); + __Pyx_INCREF(__pyx_v_mode); + __Pyx_GIVEREF(__pyx_v_mode); + if (__Pyx_PyTuple_SET_ITEM(__pyx_t_4, 3, __pyx_v_mode) != (0)) __PYX_ERR(1, 271, __pyx_L1_error); + __pyx_t_1 = 0; + __pyx_t_3 = 0; + __pyx_t_3 = ((PyObject *)__pyx_tp_new_array(((PyTypeObject *)__pyx_mstate_global->__pyx_array_type), __pyx_t_4, NULL)); if (unlikely(!__pyx_t_3)) __PYX_ERR(1, 271, __pyx_L1_error) + __Pyx_GOTREF((PyObject *)__pyx_t_3); + __Pyx_DECREF(__pyx_t_4); __pyx_t_4 = 0; + __pyx_v_result = ((struct __pyx_array_obj *)__pyx_t_3); + __pyx_t_3 = 0; + + /* "View.MemoryView":270 + * cdef str mode = "fortran" if c_mode[0] == b'f' else "c" # this often comes from a constant C string. + * + * if buf is NULL: # <<<<<<<<<<<<<< + * result = array.__new__(array, shape, itemsize, format, mode) + * else: +*/ + goto __pyx_L3; + } + + /* "View.MemoryView":273 + * result = array.__new__(array, shape, itemsize, format, mode) + * else: + * result = array.__new__(array, shape, itemsize, format, mode, allocate_buffer=False) # <<<<<<<<<<<<<< + * result.data = buf + * +*/ + /*else*/ { + __pyx_t_3 = PyLong_FromSsize_t(__pyx_v_itemsize); if (unlikely(!__pyx_t_3)) __PYX_ERR(1, 273, __pyx_L1_error) + __Pyx_GOTREF(__pyx_t_3); + __pyx_t_4 = __Pyx_PyBytes_FromString(__pyx_v_format); if (unlikely(!__pyx_t_4)) __PYX_ERR(1, 273, __pyx_L1_error) + __Pyx_GOTREF(__pyx_t_4); + __pyx_t_1 = PyTuple_New(4); if (unlikely(!__pyx_t_1)) __PYX_ERR(1, 273, __pyx_L1_error) + __Pyx_GOTREF(__pyx_t_1); + __Pyx_INCREF(__pyx_v_shape); + __Pyx_GIVEREF(__pyx_v_shape); + if (__Pyx_PyTuple_SET_ITEM(__pyx_t_1, 0, __pyx_v_shape) != (0)) __PYX_ERR(1, 273, __pyx_L1_error); + __Pyx_GIVEREF(__pyx_t_3); + if (__Pyx_PyTuple_SET_ITEM(__pyx_t_1, 1, __pyx_t_3) != (0)) __PYX_ERR(1, 273, __pyx_L1_error); + __Pyx_GIVEREF(__pyx_t_4); + if (__Pyx_PyTuple_SET_ITEM(__pyx_t_1, 2, __pyx_t_4) != (0)) __PYX_ERR(1, 273, __pyx_L1_error); + __Pyx_INCREF(__pyx_v_mode); + __Pyx_GIVEREF(__pyx_v_mode); + if (__Pyx_PyTuple_SET_ITEM(__pyx_t_1, 3, __pyx_v_mode) != (0)) __PYX_ERR(1, 273, __pyx_L1_error); + __pyx_t_3 = 0; + __pyx_t_4 = 0; + __pyx_t_4 = __Pyx_PyDict_NewPresized(1); if (unlikely(!__pyx_t_4)) __PYX_ERR(1, 273, __pyx_L1_error) + __Pyx_GOTREF(__pyx_t_4); + if (PyDict_SetItem(__pyx_t_4, __pyx_mstate_global->__pyx_n_u_allocate_buffer, Py_False) < (0)) __PYX_ERR(1, 273, __pyx_L1_error) + __pyx_t_3 = ((PyObject *)__pyx_tp_new_array(((PyTypeObject *)__pyx_mstate_global->__pyx_array_type), __pyx_t_1, __pyx_t_4)); if (unlikely(!__pyx_t_3)) __PYX_ERR(1, 273, __pyx_L1_error) + __Pyx_GOTREF((PyObject *)__pyx_t_3); + __Pyx_DECREF(__pyx_t_1); __pyx_t_1 = 0; + __Pyx_DECREF(__pyx_t_4); __pyx_t_4 = 0; + __pyx_v_result = ((struct __pyx_array_obj *)__pyx_t_3); + __pyx_t_3 = 0; + + /* "View.MemoryView":274 + * else: + * result = array.__new__(array, shape, itemsize, format, mode, allocate_buffer=False) + * result.data = buf # <<<<<<<<<<<<<< + * + * return result +*/ + __pyx_v_result->data = __pyx_v_buf; + } + __pyx_L3:; + + /* "View.MemoryView":276 + * result.data = buf + * + * return result # <<<<<<<<<<<<<< + * + * +*/ + __Pyx_XDECREF((PyObject *)__pyx_r); + __Pyx_INCREF((PyObject *)__pyx_v_result); + __pyx_r = __pyx_v_result; + goto __pyx_L0; + + /* "View.MemoryView":265 + * + * + * @cname("__pyx_array_new") # <<<<<<<<<<<<<< + * cdef array array_cwrapper(tuple shape, Py_ssize_t itemsize, char *format, const char *c_mode, char *buf): + * cdef array result +*/ + + /* function exit code */ + __pyx_L1_error:; + __Pyx_XDECREF(__pyx_t_1); + __Pyx_XDECREF(__pyx_t_3); + __Pyx_XDECREF(__pyx_t_4); + __Pyx_AddTraceback("View.MemoryView.array_cwrapper", __pyx_clineno, __pyx_lineno, __pyx_filename); + __pyx_r = 0; + __pyx_L0:; + __Pyx_XDECREF((PyObject *)__pyx_v_result); + __Pyx_XDECREF(__pyx_v_mode); + __Pyx_XGIVEREF((PyObject *)__pyx_r); + __Pyx_RefNannyFinishContext(); + return __pyx_r; +} + +/* "View.MemoryView":302 + * cdef class Enum(object): + * cdef object name + * def __init__(self, name): # <<<<<<<<<<<<<< + * self.name = name + * def __repr__(self): +*/ + +/* Python wrapper */ +static int __pyx_MemviewEnum___init__(PyObject *__pyx_v_self, PyObject *__pyx_args, PyObject *__pyx_kwds); /*proto*/ +static int __pyx_MemviewEnum___init__(PyObject *__pyx_v_self, PyObject *__pyx_args, PyObject *__pyx_kwds) { + PyObject *__pyx_v_name = 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_name,0}; + const Py_ssize_t __pyx_kwds_len = (__pyx_kwds) ? __Pyx_NumKwargs_VARARGS(__pyx_kwds) : 0; + if (unlikely(__pyx_kwds_len) < 0) __PYX_ERR(1, 302, __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(1, 302, __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(1, 302, __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(1, 302, __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(1, 302, __pyx_L3_error) + } + __pyx_v_name = values[0]; + } + goto __pyx_L6_skip; + __pyx_L5_argtuple_error:; + __Pyx_RaiseArgtupleInvalid("__init__", 1, 1, 1, __pyx_nargs); __PYX_ERR(1, 302, __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("View.MemoryView.Enum.__init__", __pyx_clineno, __pyx_lineno, __pyx_filename); + __Pyx_RefNannyFinishContext(); + return -1; + __pyx_L4_argument_unpacking_done:; + __pyx_r = __pyx_MemviewEnum___pyx_pf_15View_dot_MemoryView_4Enum___init__(((struct __pyx_MemviewEnum_obj *)__pyx_v_self), __pyx_v_name); + + /* 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_MemviewEnum___pyx_pf_15View_dot_MemoryView_4Enum___init__(struct __pyx_MemviewEnum_obj *__pyx_v_self, PyObject *__pyx_v_name) { + int __pyx_r; + __Pyx_RefNannyDeclarations + __Pyx_RefNannySetupContext("__init__", 0); + + /* "View.MemoryView":303 + * cdef object name + * def __init__(self, name): + * self.name = name # <<<<<<<<<<<<<< + * def __repr__(self): + * return self.name +*/ + __Pyx_INCREF(__pyx_v_name); + __Pyx_GIVEREF(__pyx_v_name); + __Pyx_GOTREF(__pyx_v_self->name); + __Pyx_DECREF(__pyx_v_self->name); + __pyx_v_self->name = __pyx_v_name; + + /* "View.MemoryView":302 + * cdef class Enum(object): + * cdef object name + * def __init__(self, name): # <<<<<<<<<<<<<< + * self.name = name + * def __repr__(self): +*/ + + /* function exit code */ + __pyx_r = 0; + __Pyx_RefNannyFinishContext(); + return __pyx_r; +} + +/* "View.MemoryView":304 + * def __init__(self, name): + * self.name = name + * def __repr__(self): # <<<<<<<<<<<<<< + * return self.name + * +*/ + +/* Python wrapper */ +static PyObject *__pyx_MemviewEnum___repr__(PyObject *__pyx_v_self); /*proto*/ +static PyObject *__pyx_MemviewEnum___repr__(PyObject *__pyx_v_self) { + CYTHON_UNUSED PyObject *const *__pyx_kwvalues; + PyObject *__pyx_r = 0; + __Pyx_RefNannyDeclarations + __Pyx_RefNannySetupContext("__repr__ (wrapper)", 0); + __pyx_kwvalues = __Pyx_KwValues_VARARGS(__pyx_args, __pyx_nargs); + __pyx_r = __pyx_MemviewEnum___pyx_pf_15View_dot_MemoryView_4Enum_2__repr__(((struct __pyx_MemviewEnum_obj *)__pyx_v_self)); + + /* function exit code */ + __Pyx_RefNannyFinishContext(); + return __pyx_r; +} + +static PyObject *__pyx_MemviewEnum___pyx_pf_15View_dot_MemoryView_4Enum_2__repr__(struct __pyx_MemviewEnum_obj *__pyx_v_self) { + PyObject *__pyx_r = NULL; + __Pyx_RefNannyDeclarations + __Pyx_RefNannySetupContext("__repr__", 0); + + /* "View.MemoryView":305 + * self.name = name + * def __repr__(self): + * return self.name # <<<<<<<<<<<<<< + * + * cdef generic = Enum("") +*/ + __Pyx_XDECREF(__pyx_r); + __Pyx_INCREF(__pyx_v_self->name); + __pyx_r = __pyx_v_self->name; + goto __pyx_L0; + + /* "View.MemoryView":304 + * def __init__(self, name): + * self.name = name + * def __repr__(self): # <<<<<<<<<<<<<< + * return self.name + * +*/ + + /* function exit code */ + __pyx_L0:; + __Pyx_XGIVEREF(__pyx_r); + __Pyx_RefNannyFinishContext(); + return __pyx_r; +} + +/* "(tree fragment)":1 + * def __reduce_cython__(self): # <<<<<<<<<<<<<< + * cdef tuple state + * cdef object _dict +*/ + +/* Python wrapper */ +static PyObject *__pyx_pw___pyx_MemviewEnum_1__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*/ +static PyObject *__pyx_pw___pyx_MemviewEnum_1__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___pyx_MemviewEnum___reduce_cython__(((struct __pyx_MemviewEnum_obj *)__pyx_v_self)); + + /* function exit code */ + __Pyx_RefNannyFinishContext(); + return __pyx_r; +} + +static PyObject *__pyx_pf___pyx_MemviewEnum___reduce_cython__(struct __pyx_MemviewEnum_obj *__pyx_v_self) { + PyObject *__pyx_v_state = 0; + PyObject *__pyx_v__dict = 0; + int __pyx_v_use_setstate; + PyObject *__pyx_r = NULL; + __Pyx_RefNannyDeclarations + PyObject *__pyx_t_1 = NULL; + int __pyx_t_2; + int __pyx_t_3; + PyObject *__pyx_t_4 = NULL; + PyObject *__pyx_t_5 = NULL; + int __pyx_lineno = 0; + const char *__pyx_filename = NULL; + int __pyx_clineno = 0; + __Pyx_RefNannySetupContext("__reduce_cython__", 0); + + /* "(tree fragment)":5 + * cdef object _dict + * cdef bint use_setstate + * state = (self.name,) # <<<<<<<<<<<<<< + * _dict = getattr(self, '__dict__', None) + * if _dict is not None and _dict: +*/ + __pyx_t_1 = PyTuple_New(1); if (unlikely(!__pyx_t_1)) __PYX_ERR(1, 5, __pyx_L1_error) + __Pyx_GOTREF(__pyx_t_1); + __Pyx_INCREF(__pyx_v_self->name); + __Pyx_GIVEREF(__pyx_v_self->name); + if (__Pyx_PyTuple_SET_ITEM(__pyx_t_1, 0, __pyx_v_self->name) != (0)) __PYX_ERR(1, 5, __pyx_L1_error); + __pyx_v_state = ((PyObject*)__pyx_t_1); + __pyx_t_1 = 0; + + /* "(tree fragment)":6 + * cdef bint use_setstate + * state = (self.name,) + * _dict = getattr(self, '__dict__', None) # <<<<<<<<<<<<<< + * if _dict is not None and _dict: + * state += (_dict,) +*/ + __pyx_t_1 = __Pyx_GetAttr3(((PyObject *)__pyx_v_self), __pyx_mstate_global->__pyx_n_u_dict, Py_None); if (unlikely(!__pyx_t_1)) __PYX_ERR(1, 6, __pyx_L1_error) + __Pyx_GOTREF(__pyx_t_1); + __pyx_v__dict = __pyx_t_1; + __pyx_t_1 = 0; + + /* "(tree fragment)":7 + * state = (self.name,) + * _dict = getattr(self, '__dict__', None) + * if _dict is not None and _dict: # <<<<<<<<<<<<<< + * state += (_dict,) + * use_setstate = True +*/ + __pyx_t_3 = (__pyx_v__dict != Py_None); + if (__pyx_t_3) { + } else { + __pyx_t_2 = __pyx_t_3; + goto __pyx_L4_bool_binop_done; + } + __pyx_t_3 = __Pyx_PyObject_IsTrue(__pyx_v__dict); if (unlikely((__pyx_t_3 < 0))) __PYX_ERR(1, 7, __pyx_L1_error) + __pyx_t_2 = __pyx_t_3; + __pyx_L4_bool_binop_done:; + if (__pyx_t_2) { + + /* "(tree fragment)":8 + * _dict = getattr(self, '__dict__', None) + * if _dict is not None and _dict: + * state += (_dict,) # <<<<<<<<<<<<<< + * use_setstate = True + * else: +*/ + __pyx_t_1 = PyTuple_New(1); if (unlikely(!__pyx_t_1)) __PYX_ERR(1, 8, __pyx_L1_error) + __Pyx_GOTREF(__pyx_t_1); + __Pyx_INCREF(__pyx_v__dict); + __Pyx_GIVEREF(__pyx_v__dict); + if (__Pyx_PyTuple_SET_ITEM(__pyx_t_1, 0, __pyx_v__dict) != (0)) __PYX_ERR(1, 8, __pyx_L1_error); + __pyx_t_4 = PyNumber_InPlaceAdd(__pyx_v_state, __pyx_t_1); if (unlikely(!__pyx_t_4)) __PYX_ERR(1, 8, __pyx_L1_error) + __Pyx_GOTREF(__pyx_t_4); + __Pyx_DECREF(__pyx_t_1); __pyx_t_1 = 0; + __Pyx_DECREF_SET(__pyx_v_state, ((PyObject*)__pyx_t_4)); + __pyx_t_4 = 0; + + /* "(tree fragment)":9 + * if _dict is not None and _dict: + * state += (_dict,) + * use_setstate = True # <<<<<<<<<<<<<< + * else: + * use_setstate = ('self.name is not None',) +*/ + __pyx_v_use_setstate = 1; + + /* "(tree fragment)":7 + * state = (self.name,) + * _dict = getattr(self, '__dict__', None) + * if _dict is not None and _dict: # <<<<<<<<<<<<<< + * state += (_dict,) + * use_setstate = True +*/ + goto __pyx_L3; + } + + /* "(tree fragment)":11 + * use_setstate = True + * else: + * use_setstate = ('self.name is not None',) # <<<<<<<<<<<<<< + * if use_setstate: + * return __pyx_unpickle_Enum, (type(self), 0x82a3537, None), state +*/ + /*else*/ { + __pyx_t_2 = __Pyx_PyObject_IsTrue(__pyx_mstate_global->__pyx_tuple[0]); if (unlikely((__pyx_t_2 == (int)-1) && PyErr_Occurred())) __PYX_ERR(1, 11, __pyx_L1_error) + __pyx_v_use_setstate = __pyx_t_2; + } + __pyx_L3:; + + /* "(tree fragment)":12 + * else: + * use_setstate = ('self.name is not None',) + * if use_setstate: # <<<<<<<<<<<<<< + * return __pyx_unpickle_Enum, (type(self), 0x82a3537, None), state + * else: +*/ + if (__pyx_v_use_setstate) { + + /* "(tree fragment)":13 + * use_setstate = ('self.name is not None',) + * if use_setstate: + * return __pyx_unpickle_Enum, (type(self), 0x82a3537, None), state # <<<<<<<<<<<<<< + * else: + * return __pyx_unpickle_Enum, (type(self), 0x82a3537, state) +*/ + __Pyx_XDECREF(__pyx_r); + __Pyx_GetModuleGlobalName(__pyx_t_4, __pyx_mstate_global->__pyx_n_u_pyx_unpickle_Enum); if (unlikely(!__pyx_t_4)) __PYX_ERR(1, 13, __pyx_L1_error) + __Pyx_GOTREF(__pyx_t_4); + __pyx_t_1 = PyTuple_New(3); if (unlikely(!__pyx_t_1)) __PYX_ERR(1, 13, __pyx_L1_error) + __Pyx_GOTREF(__pyx_t_1); + __Pyx_INCREF(((PyObject *)Py_TYPE(((PyObject *)__pyx_v_self)))); + __Pyx_GIVEREF(((PyObject *)Py_TYPE(((PyObject *)__pyx_v_self)))); + if (__Pyx_PyTuple_SET_ITEM(__pyx_t_1, 0, ((PyObject *)Py_TYPE(((PyObject *)__pyx_v_self)))) != (0)) __PYX_ERR(1, 13, __pyx_L1_error); + __Pyx_INCREF(__pyx_mstate_global->__pyx_int_136983863); + __Pyx_GIVEREF(__pyx_mstate_global->__pyx_int_136983863); + if (__Pyx_PyTuple_SET_ITEM(__pyx_t_1, 1, __pyx_mstate_global->__pyx_int_136983863) != (0)) __PYX_ERR(1, 13, __pyx_L1_error); + __Pyx_INCREF(Py_None); + __Pyx_GIVEREF(Py_None); + if (__Pyx_PyTuple_SET_ITEM(__pyx_t_1, 2, Py_None) != (0)) __PYX_ERR(1, 13, __pyx_L1_error); + __pyx_t_5 = PyTuple_New(3); if (unlikely(!__pyx_t_5)) __PYX_ERR(1, 13, __pyx_L1_error) + __Pyx_GOTREF(__pyx_t_5); + __Pyx_GIVEREF(__pyx_t_4); + if (__Pyx_PyTuple_SET_ITEM(__pyx_t_5, 0, __pyx_t_4) != (0)) __PYX_ERR(1, 13, __pyx_L1_error); + __Pyx_GIVEREF(__pyx_t_1); + if (__Pyx_PyTuple_SET_ITEM(__pyx_t_5, 1, __pyx_t_1) != (0)) __PYX_ERR(1, 13, __pyx_L1_error); + __Pyx_INCREF(__pyx_v_state); + __Pyx_GIVEREF(__pyx_v_state); + if (__Pyx_PyTuple_SET_ITEM(__pyx_t_5, 2, __pyx_v_state) != (0)) __PYX_ERR(1, 13, __pyx_L1_error); + __pyx_t_4 = 0; + __pyx_t_1 = 0; + __pyx_r = __pyx_t_5; + __pyx_t_5 = 0; + goto __pyx_L0; + + /* "(tree fragment)":12 + * else: + * use_setstate = ('self.name is not None',) + * if use_setstate: # <<<<<<<<<<<<<< + * return __pyx_unpickle_Enum, (type(self), 0x82a3537, None), state + * else: +*/ + } + + /* "(tree fragment)":15 + * return __pyx_unpickle_Enum, (type(self), 0x82a3537, None), state + * else: + * return __pyx_unpickle_Enum, (type(self), 0x82a3537, state) # <<<<<<<<<<<<<< + * def __setstate_cython__(self, __pyx_state): + * __pyx_unpickle_Enum__set_state(self, __pyx_state) +*/ + /*else*/ { + __Pyx_XDECREF(__pyx_r); + __Pyx_GetModuleGlobalName(__pyx_t_5, __pyx_mstate_global->__pyx_n_u_pyx_unpickle_Enum); if (unlikely(!__pyx_t_5)) __PYX_ERR(1, 15, __pyx_L1_error) + __Pyx_GOTREF(__pyx_t_5); + __pyx_t_1 = PyTuple_New(3); if (unlikely(!__pyx_t_1)) __PYX_ERR(1, 15, __pyx_L1_error) + __Pyx_GOTREF(__pyx_t_1); + __Pyx_INCREF(((PyObject *)Py_TYPE(((PyObject *)__pyx_v_self)))); + __Pyx_GIVEREF(((PyObject *)Py_TYPE(((PyObject *)__pyx_v_self)))); + if (__Pyx_PyTuple_SET_ITEM(__pyx_t_1, 0, ((PyObject *)Py_TYPE(((PyObject *)__pyx_v_self)))) != (0)) __PYX_ERR(1, 15, __pyx_L1_error); + __Pyx_INCREF(__pyx_mstate_global->__pyx_int_136983863); + __Pyx_GIVEREF(__pyx_mstate_global->__pyx_int_136983863); + if (__Pyx_PyTuple_SET_ITEM(__pyx_t_1, 1, __pyx_mstate_global->__pyx_int_136983863) != (0)) __PYX_ERR(1, 15, __pyx_L1_error); + __Pyx_INCREF(__pyx_v_state); + __Pyx_GIVEREF(__pyx_v_state); + if (__Pyx_PyTuple_SET_ITEM(__pyx_t_1, 2, __pyx_v_state) != (0)) __PYX_ERR(1, 15, __pyx_L1_error); + __pyx_t_4 = PyTuple_New(2); if (unlikely(!__pyx_t_4)) __PYX_ERR(1, 15, __pyx_L1_error) + __Pyx_GOTREF(__pyx_t_4); + __Pyx_GIVEREF(__pyx_t_5); + if (__Pyx_PyTuple_SET_ITEM(__pyx_t_4, 0, __pyx_t_5) != (0)) __PYX_ERR(1, 15, __pyx_L1_error); + __Pyx_GIVEREF(__pyx_t_1); + if (__Pyx_PyTuple_SET_ITEM(__pyx_t_4, 1, __pyx_t_1) != (0)) __PYX_ERR(1, 15, __pyx_L1_error); + __pyx_t_5 = 0; + __pyx_t_1 = 0; + __pyx_r = __pyx_t_4; + __pyx_t_4 = 0; + goto __pyx_L0; + } + + /* "(tree fragment)":1 + * def __reduce_cython__(self): # <<<<<<<<<<<<<< + * cdef tuple state + * cdef object _dict +*/ + + /* function exit code */ + __pyx_L1_error:; + __Pyx_XDECREF(__pyx_t_1); + __Pyx_XDECREF(__pyx_t_4); + __Pyx_XDECREF(__pyx_t_5); + __Pyx_AddTraceback("View.MemoryView.Enum.__reduce_cython__", __pyx_clineno, __pyx_lineno, __pyx_filename); + __pyx_r = NULL; + __pyx_L0:; + __Pyx_XDECREF(__pyx_v_state); + __Pyx_XDECREF(__pyx_v__dict); + __Pyx_XGIVEREF(__pyx_r); + __Pyx_RefNannyFinishContext(); + return __pyx_r; +} + +/* "(tree fragment)":16 + * else: + * return __pyx_unpickle_Enum, (type(self), 0x82a3537, state) + * def __setstate_cython__(self, __pyx_state): # <<<<<<<<<<<<<< + * __pyx_unpickle_Enum__set_state(self, __pyx_state) +*/ + +/* Python wrapper */ +static PyObject *__pyx_pw___pyx_MemviewEnum_3__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*/ +static PyObject *__pyx_pw___pyx_MemviewEnum_3__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 +) { + 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, 16, __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, 16, __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, 16, __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, 16, __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, 16, __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, 16, __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("View.MemoryView.Enum.__setstate_cython__", __pyx_clineno, __pyx_lineno, __pyx_filename); + __Pyx_RefNannyFinishContext(); + return NULL; + __pyx_L4_argument_unpacking_done:; + __pyx_r = __pyx_pf___pyx_MemviewEnum_2__setstate_cython__(((struct __pyx_MemviewEnum_obj *)__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___pyx_MemviewEnum_2__setstate_cython__(struct __pyx_MemviewEnum_obj *__pyx_v_self, PyObject *__pyx_v___pyx_state) { + PyObject *__pyx_r = NULL; + __Pyx_RefNannyDeclarations + PyObject *__pyx_t_1 = NULL; + PyObject *__pyx_t_2 = NULL; + int __pyx_lineno = 0; + const char *__pyx_filename = NULL; + int __pyx_clineno = 0; + __Pyx_RefNannySetupContext("__setstate_cython__", 0); + + /* "(tree fragment)":17 + * return __pyx_unpickle_Enum, (type(self), 0x82a3537, state) + * def __setstate_cython__(self, __pyx_state): + * __pyx_unpickle_Enum__set_state(self, __pyx_state) # <<<<<<<<<<<<<< +*/ + __pyx_t_1 = __pyx_v___pyx_state; + __Pyx_INCREF(__pyx_t_1); + if (!(likely(PyTuple_CheckExact(__pyx_t_1))||((__pyx_t_1) == Py_None) || __Pyx_RaiseUnexpectedTypeError("tuple", __pyx_t_1))) __PYX_ERR(1, 17, __pyx_L1_error) + if (unlikely(__pyx_t_1 == Py_None)) { + PyErr_SetString(PyExc_TypeError, "cannot pass None into a C function argument that is declared 'not None'"); + __PYX_ERR(1, 17, __pyx_L1_error) + } + __pyx_t_2 = __pyx_unpickle_Enum__set_state(__pyx_v_self, ((PyObject*)__pyx_t_1)); if (unlikely(!__pyx_t_2)) __PYX_ERR(1, 17, __pyx_L1_error) + __Pyx_GOTREF(__pyx_t_2); + __Pyx_DECREF(__pyx_t_1); __pyx_t_1 = 0; + __Pyx_DECREF(__pyx_t_2); __pyx_t_2 = 0; + + /* "(tree fragment)":16 + * else: + * return __pyx_unpickle_Enum, (type(self), 0x82a3537, state) + * def __setstate_cython__(self, __pyx_state): # <<<<<<<<<<<<<< + * __pyx_unpickle_Enum__set_state(self, __pyx_state) +*/ + + /* 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("View.MemoryView.Enum.__setstate_cython__", __pyx_clineno, __pyx_lineno, __pyx_filename); + __pyx_r = NULL; + __pyx_L0:; + __Pyx_XGIVEREF(__pyx_r); + __Pyx_RefNannyFinishContext(); + return __pyx_r; +} + +/* "View.MemoryView":348 + * cdef const __Pyx_TypeInfo *typeinfo + * + * def __cinit__(memoryview self, object obj, int flags, bint dtype_is_object=False): # <<<<<<<<<<<<<< + * self.obj = obj + * self.flags = flags +*/ + +/* Python wrapper */ +static int __pyx_memoryview___cinit__(PyObject *__pyx_v_self, PyObject *__pyx_args, PyObject *__pyx_kwds); /*proto*/ +static int __pyx_memoryview___cinit__(PyObject *__pyx_v_self, PyObject *__pyx_args, PyObject *__pyx_kwds) { + PyObject *__pyx_v_obj = 0; + int __pyx_v_flags; + int __pyx_v_dtype_is_object; + CYTHON_UNUSED Py_ssize_t __pyx_nargs; + 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; + 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_obj,&__pyx_mstate_global->__pyx_n_u_flags,&__pyx_mstate_global->__pyx_n_u_dtype_is_object,0}; + const Py_ssize_t __pyx_kwds_len = (__pyx_kwds) ? __Pyx_NumKwargs_VARARGS(__pyx_kwds) : 0; + if (unlikely(__pyx_kwds_len) < 0) __PYX_ERR(1, 348, __pyx_L3_error) + if (__pyx_kwds_len > 0) { + switch (__pyx_nargs) { + case 3: + values[2] = __Pyx_ArgRef_VARARGS(__pyx_args, 2); + if (!CYTHON_ASSUME_SAFE_MACROS && unlikely(!values[2])) __PYX_ERR(1, 348, __pyx_L3_error) + CYTHON_FALLTHROUGH; + case 2: + values[1] = __Pyx_ArgRef_VARARGS(__pyx_args, 1); + if (!CYTHON_ASSUME_SAFE_MACROS && unlikely(!values[1])) __PYX_ERR(1, 348, __pyx_L3_error) + CYTHON_FALLTHROUGH; + case 1: + values[0] = __Pyx_ArgRef_VARARGS(__pyx_args, 0); + if (!CYTHON_ASSUME_SAFE_MACROS && unlikely(!values[0])) __PYX_ERR(1, 348, __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(1, 348, __pyx_L3_error) + for (Py_ssize_t i = __pyx_nargs; i < 2; i++) { + if (unlikely(!values[i])) { __Pyx_RaiseArgtupleInvalid("__cinit__", 0, 2, 3, i); __PYX_ERR(1, 348, __pyx_L3_error) } + } + } else { + switch (__pyx_nargs) { + case 3: + values[2] = __Pyx_ArgRef_VARARGS(__pyx_args, 2); + if (!CYTHON_ASSUME_SAFE_MACROS && unlikely(!values[2])) __PYX_ERR(1, 348, __pyx_L3_error) + CYTHON_FALLTHROUGH; + case 2: + values[1] = __Pyx_ArgRef_VARARGS(__pyx_args, 1); + if (!CYTHON_ASSUME_SAFE_MACROS && unlikely(!values[1])) __PYX_ERR(1, 348, __pyx_L3_error) + values[0] = __Pyx_ArgRef_VARARGS(__pyx_args, 0); + if (!CYTHON_ASSUME_SAFE_MACROS && unlikely(!values[0])) __PYX_ERR(1, 348, __pyx_L3_error) + break; + default: goto __pyx_L5_argtuple_error; + } + } + __pyx_v_obj = values[0]; + __pyx_v_flags = __Pyx_PyLong_As_int(values[1]); if (unlikely((__pyx_v_flags == (int)-1) && PyErr_Occurred())) __PYX_ERR(1, 348, __pyx_L3_error) + if (values[2]) { + __pyx_v_dtype_is_object = __Pyx_PyObject_IsTrue(values[2]); if (unlikely((__pyx_v_dtype_is_object == (int)-1) && PyErr_Occurred())) __PYX_ERR(1, 348, __pyx_L3_error) + } else { + __pyx_v_dtype_is_object = ((int)0); + } + } + goto __pyx_L6_skip; + __pyx_L5_argtuple_error:; + __Pyx_RaiseArgtupleInvalid("__cinit__", 0, 2, 3, __pyx_nargs); __PYX_ERR(1, 348, __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("View.MemoryView.memoryview.__cinit__", __pyx_clineno, __pyx_lineno, __pyx_filename); + __Pyx_RefNannyFinishContext(); + return -1; + __pyx_L4_argument_unpacking_done:; + __pyx_r = __pyx_memoryview___pyx_pf_15View_dot_MemoryView_10memoryview___cinit__(((struct __pyx_memoryview_obj *)__pyx_v_self), __pyx_v_obj, __pyx_v_flags, __pyx_v_dtype_is_object); + + /* 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_memoryview___pyx_pf_15View_dot_MemoryView_10memoryview___cinit__(struct __pyx_memoryview_obj *__pyx_v_self, PyObject *__pyx_v_obj, int __pyx_v_flags, int __pyx_v_dtype_is_object) { + int __pyx_r; + __Pyx_RefNannyDeclarations + int __pyx_t_1; + int __pyx_t_2; + int __pyx_t_3; + Py_intptr_t __pyx_t_4; + size_t __pyx_t_5; + int __pyx_lineno = 0; + const char *__pyx_filename = NULL; + int __pyx_clineno = 0; + __Pyx_RefNannySetupContext("__cinit__", 0); + + /* "View.MemoryView":349 + * + * def __cinit__(memoryview self, object obj, int flags, bint dtype_is_object=False): + * self.obj = obj # <<<<<<<<<<<<<< + * self.flags = flags + * if type(self) is memoryview or obj is not None: +*/ + __Pyx_INCREF(__pyx_v_obj); + __Pyx_GIVEREF(__pyx_v_obj); + __Pyx_GOTREF(__pyx_v_self->obj); + __Pyx_DECREF(__pyx_v_self->obj); + __pyx_v_self->obj = __pyx_v_obj; + + /* "View.MemoryView":350 + * def __cinit__(memoryview self, object obj, int flags, bint dtype_is_object=False): + * self.obj = obj + * self.flags = flags # <<<<<<<<<<<<<< + * if type(self) is memoryview or obj is not None: + * PyObject_GetBuffer(obj, &self.view, flags) +*/ + __pyx_v_self->flags = __pyx_v_flags; + + /* "View.MemoryView":351 + * self.obj = obj + * self.flags = flags + * if type(self) is memoryview or obj is not None: # <<<<<<<<<<<<<< + * PyObject_GetBuffer(obj, &self.view, flags) + * if self.view.obj == NULL: +*/ + __pyx_t_2 = (((PyObject *)Py_TYPE(((PyObject *)__pyx_v_self))) == ((PyObject *)__pyx_mstate_global->__pyx_memoryview_type)); + if (!__pyx_t_2) { + } else { + __pyx_t_1 = __pyx_t_2; + goto __pyx_L4_bool_binop_done; + } + __pyx_t_2 = (__pyx_v_obj != Py_None); + __pyx_t_1 = __pyx_t_2; + __pyx_L4_bool_binop_done:; + if (__pyx_t_1) { + + /* "View.MemoryView":352 + * self.flags = flags + * if type(self) is memoryview or obj is not None: + * PyObject_GetBuffer(obj, &self.view, flags) # <<<<<<<<<<<<<< + * if self.view.obj == NULL: + * (<__pyx_buffer *> &self.view).obj = Py_None +*/ + __pyx_t_3 = PyObject_GetBuffer(__pyx_v_obj, (&__pyx_v_self->view), __pyx_v_flags); if (unlikely(__pyx_t_3 == ((int)-1))) __PYX_ERR(1, 352, __pyx_L1_error) + + /* "View.MemoryView":353 + * if type(self) is memoryview or obj is not None: + * PyObject_GetBuffer(obj, &self.view, flags) + * if self.view.obj == NULL: # <<<<<<<<<<<<<< + * (<__pyx_buffer *> &self.view).obj = Py_None + * Py_INCREF(Py_None) +*/ + __pyx_t_1 = (((PyObject *)__pyx_v_self->view.obj) == NULL); + if (__pyx_t_1) { + + /* "View.MemoryView":354 + * PyObject_GetBuffer(obj, &self.view, flags) + * if self.view.obj == NULL: + * (<__pyx_buffer *> &self.view).obj = Py_None # <<<<<<<<<<<<<< + * Py_INCREF(Py_None) + * +*/ + ((Py_buffer *)(&__pyx_v_self->view))->obj = Py_None; + + /* "View.MemoryView":355 + * if self.view.obj == NULL: + * (<__pyx_buffer *> &self.view).obj = Py_None + * Py_INCREF(Py_None) # <<<<<<<<<<<<<< + * + * if not __PYX_CYTHON_ATOMICS_ENABLED(): +*/ + Py_INCREF(Py_None); + + /* "View.MemoryView":353 + * if type(self) is memoryview or obj is not None: + * PyObject_GetBuffer(obj, &self.view, flags) + * if self.view.obj == NULL: # <<<<<<<<<<<<<< + * (<__pyx_buffer *> &self.view).obj = Py_None + * Py_INCREF(Py_None) +*/ + } + + /* "View.MemoryView":351 + * self.obj = obj + * self.flags = flags + * if type(self) is memoryview or obj is not None: # <<<<<<<<<<<<<< + * PyObject_GetBuffer(obj, &self.view, flags) + * if self.view.obj == NULL: +*/ + } + + /* "View.MemoryView":357 + * Py_INCREF(Py_None) + * + * if not __PYX_CYTHON_ATOMICS_ENABLED(): # <<<<<<<<<<<<<< + * global __pyx_memoryview_thread_locks_used + * if (__pyx_memoryview_thread_locks_used < 8 and +*/ + __pyx_t_1 = (!__PYX_CYTHON_ATOMICS_ENABLED()); + if (__pyx_t_1) { + + /* "View.MemoryView":359 + * if not __PYX_CYTHON_ATOMICS_ENABLED(): + * global __pyx_memoryview_thread_locks_used + * if (__pyx_memoryview_thread_locks_used < 8 and # <<<<<<<<<<<<<< + * + * not __PYX_GET_CYTHON_COMPILING_IN_CPYTHON_FREETHREADING()): +*/ + __pyx_t_2 = (__pyx_memoryview_thread_locks_used < 8); + if (__pyx_t_2) { + } else { + __pyx_t_1 = __pyx_t_2; + goto __pyx_L9_bool_binop_done; + } + + /* "View.MemoryView":361 + * if (__pyx_memoryview_thread_locks_used < 8 and + * + * not __PYX_GET_CYTHON_COMPILING_IN_CPYTHON_FREETHREADING()): # <<<<<<<<<<<<<< + * self.lock = __pyx_memoryview_thread_locks[__pyx_memoryview_thread_locks_used] + * __pyx_memoryview_thread_locks_used += 1 +*/ + __pyx_t_2 = (!__PYX_GET_CYTHON_COMPILING_IN_CPYTHON_FREETHREADING()); + __pyx_t_1 = __pyx_t_2; + __pyx_L9_bool_binop_done:; + + /* "View.MemoryView":359 + * if not __PYX_CYTHON_ATOMICS_ENABLED(): + * global __pyx_memoryview_thread_locks_used + * if (__pyx_memoryview_thread_locks_used < 8 and # <<<<<<<<<<<<<< + * + * not __PYX_GET_CYTHON_COMPILING_IN_CPYTHON_FREETHREADING()): +*/ + if (__pyx_t_1) { + + /* "View.MemoryView":362 + * + * not __PYX_GET_CYTHON_COMPILING_IN_CPYTHON_FREETHREADING()): + * self.lock = __pyx_memoryview_thread_locks[__pyx_memoryview_thread_locks_used] # <<<<<<<<<<<<<< + * __pyx_memoryview_thread_locks_used += 1 + * if self.lock is NULL: +*/ + __pyx_v_self->lock = (__pyx_memoryview_thread_locks[__pyx_memoryview_thread_locks_used]); + + /* "View.MemoryView":363 + * not __PYX_GET_CYTHON_COMPILING_IN_CPYTHON_FREETHREADING()): + * self.lock = __pyx_memoryview_thread_locks[__pyx_memoryview_thread_locks_used] + * __pyx_memoryview_thread_locks_used += 1 # <<<<<<<<<<<<<< + * if self.lock is NULL: + * self.lock = PyThread_allocate_lock() +*/ + __pyx_memoryview_thread_locks_used = (__pyx_memoryview_thread_locks_used + 1); + + /* "View.MemoryView":359 + * if not __PYX_CYTHON_ATOMICS_ENABLED(): + * global __pyx_memoryview_thread_locks_used + * if (__pyx_memoryview_thread_locks_used < 8 and # <<<<<<<<<<<<<< + * + * not __PYX_GET_CYTHON_COMPILING_IN_CPYTHON_FREETHREADING()): +*/ + } + + /* "View.MemoryView":364 + * self.lock = __pyx_memoryview_thread_locks[__pyx_memoryview_thread_locks_used] + * __pyx_memoryview_thread_locks_used += 1 + * if self.lock is NULL: # <<<<<<<<<<<<<< + * self.lock = PyThread_allocate_lock() + * if self.lock is NULL: +*/ + __pyx_t_1 = (__pyx_v_self->lock == NULL); + if (__pyx_t_1) { + + /* "View.MemoryView":365 + * __pyx_memoryview_thread_locks_used += 1 + * if self.lock is NULL: + * self.lock = PyThread_allocate_lock() # <<<<<<<<<<<<<< + * if self.lock is NULL: + * raise MemoryError +*/ + __pyx_v_self->lock = PyThread_allocate_lock(); + + /* "View.MemoryView":366 + * if self.lock is NULL: + * self.lock = PyThread_allocate_lock() + * if self.lock is NULL: # <<<<<<<<<<<<<< + * raise MemoryError + * +*/ + __pyx_t_1 = (__pyx_v_self->lock == NULL); + if (unlikely(__pyx_t_1)) { + + /* "View.MemoryView":367 + * self.lock = PyThread_allocate_lock() + * if self.lock is NULL: + * raise MemoryError # <<<<<<<<<<<<<< + * + * if flags & PyBUF_FORMAT: +*/ + PyErr_NoMemory(); __PYX_ERR(1, 367, __pyx_L1_error) + + /* "View.MemoryView":366 + * if self.lock is NULL: + * self.lock = PyThread_allocate_lock() + * if self.lock is NULL: # <<<<<<<<<<<<<< + * raise MemoryError + * +*/ + } + + /* "View.MemoryView":364 + * self.lock = __pyx_memoryview_thread_locks[__pyx_memoryview_thread_locks_used] + * __pyx_memoryview_thread_locks_used += 1 + * if self.lock is NULL: # <<<<<<<<<<<<<< + * self.lock = PyThread_allocate_lock() + * if self.lock is NULL: +*/ + } + + /* "View.MemoryView":357 + * Py_INCREF(Py_None) + * + * if not __PYX_CYTHON_ATOMICS_ENABLED(): # <<<<<<<<<<<<<< + * global __pyx_memoryview_thread_locks_used + * if (__pyx_memoryview_thread_locks_used < 8 and +*/ + } + + /* "View.MemoryView":369 + * raise MemoryError + * + * if flags & PyBUF_FORMAT: # <<<<<<<<<<<<<< + * self.dtype_is_object = (self.view.format[0] == b'O' and self.view.format[1] == b'\0') + * else: +*/ + __pyx_t_1 = ((__pyx_v_flags & PyBUF_FORMAT) != 0); + if (__pyx_t_1) { + + /* "View.MemoryView":370 + * + * if flags & PyBUF_FORMAT: + * self.dtype_is_object = (self.view.format[0] == b'O' and self.view.format[1] == b'\0') # <<<<<<<<<<<<<< + * else: + * self.dtype_is_object = dtype_is_object +*/ + __pyx_t_2 = ((__pyx_v_self->view.format[0]) == 'O'); + if (__pyx_t_2) { + } else { + __pyx_t_1 = __pyx_t_2; + goto __pyx_L14_bool_binop_done; + } + __pyx_t_2 = ((__pyx_v_self->view.format[1]) == '\x00'); + __pyx_t_1 = __pyx_t_2; + __pyx_L14_bool_binop_done:; + __pyx_v_self->dtype_is_object = __pyx_t_1; + + /* "View.MemoryView":369 + * raise MemoryError + * + * if flags & PyBUF_FORMAT: # <<<<<<<<<<<<<< + * self.dtype_is_object = (self.view.format[0] == b'O' and self.view.format[1] == b'\0') + * else: +*/ + goto __pyx_L13; + } + + /* "View.MemoryView":372 + * self.dtype_is_object = (self.view.format[0] == b'O' and self.view.format[1] == b'\0') + * else: + * self.dtype_is_object = dtype_is_object # <<<<<<<<<<<<<< + * + * assert (&self.acquisition_count) % sizeof(__pyx_atomic_int_type) == 0 +*/ + /*else*/ { + __pyx_v_self->dtype_is_object = __pyx_v_dtype_is_object; + } + __pyx_L13:; + + /* "View.MemoryView":374 + * self.dtype_is_object = dtype_is_object + * + * assert (&self.acquisition_count) % sizeof(__pyx_atomic_int_type) == 0 # <<<<<<<<<<<<<< + * self.typeinfo = NULL + * +*/ + #ifndef CYTHON_WITHOUT_ASSERTIONS + if (unlikely(__pyx_assertions_enabled())) { + __pyx_t_4 = ((Py_intptr_t)((void *)(&__pyx_v_self->acquisition_count))); + __pyx_t_5 = (sizeof(__pyx_atomic_int_type)); + if (unlikely(__pyx_t_5 == 0)) { + PyErr_SetString(PyExc_ZeroDivisionError, "integer division or modulo by zero"); + __PYX_ERR(1, 374, __pyx_L1_error) + } + __pyx_t_1 = ((__pyx_t_4 % __pyx_t_5) == 0); + if (unlikely(!__pyx_t_1)) { + __Pyx_Raise(((PyObject *)(((PyTypeObject*)PyExc_AssertionError))), 0, 0, 0); + __PYX_ERR(1, 374, __pyx_L1_error) + } + } + #else + if ((1)); else __PYX_ERR(1, 374, __pyx_L1_error) + #endif + + /* "View.MemoryView":375 + * + * assert (&self.acquisition_count) % sizeof(__pyx_atomic_int_type) == 0 + * self.typeinfo = NULL # <<<<<<<<<<<<<< + * + * def __dealloc__(memoryview self): +*/ + __pyx_v_self->typeinfo = NULL; + + /* "View.MemoryView":348 + * cdef const __Pyx_TypeInfo *typeinfo + * + * def __cinit__(memoryview self, object obj, int flags, bint dtype_is_object=False): # <<<<<<<<<<<<<< + * self.obj = obj + * self.flags = flags +*/ + + /* function exit code */ + __pyx_r = 0; + goto __pyx_L0; + __pyx_L1_error:; + __Pyx_AddTraceback("View.MemoryView.memoryview.__cinit__", __pyx_clineno, __pyx_lineno, __pyx_filename); + __pyx_r = -1; + __pyx_L0:; + __Pyx_RefNannyFinishContext(); + return __pyx_r; +} + +/* "View.MemoryView":377 + * self.typeinfo = NULL + * + * def __dealloc__(memoryview self): # <<<<<<<<<<<<<< + * if self.obj is not None: + * PyBuffer_Release(&self.view) +*/ + +/* Python wrapper */ +static void __pyx_memoryview___dealloc__(PyObject *__pyx_v_self); /*proto*/ +static void __pyx_memoryview___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_memoryview___pyx_pf_15View_dot_MemoryView_10memoryview_2__dealloc__(((struct __pyx_memoryview_obj *)__pyx_v_self)); + + /* function exit code */ + __Pyx_RefNannyFinishContext(); +} + +static void __pyx_memoryview___pyx_pf_15View_dot_MemoryView_10memoryview_2__dealloc__(struct __pyx_memoryview_obj *__pyx_v_self) { + int __pyx_v_i; + int __pyx_t_1; + Py_ssize_t __pyx_t_2; + Py_ssize_t __pyx_t_3; + int __pyx_t_4; + PyThread_type_lock __pyx_t_5; + PyThread_type_lock __pyx_t_6; + + /* "View.MemoryView":378 + * + * def __dealloc__(memoryview self): + * if self.obj is not None: # <<<<<<<<<<<<<< + * PyBuffer_Release(&self.view) + * elif (<__pyx_buffer *> &self.view).obj == Py_None: +*/ + __pyx_t_1 = (__pyx_v_self->obj != Py_None); + if (__pyx_t_1) { + + /* "View.MemoryView":379 + * def __dealloc__(memoryview self): + * if self.obj is not None: + * PyBuffer_Release(&self.view) # <<<<<<<<<<<<<< + * elif (<__pyx_buffer *> &self.view).obj == Py_None: + * +*/ + PyBuffer_Release((&__pyx_v_self->view)); + + /* "View.MemoryView":378 + * + * def __dealloc__(memoryview self): + * if self.obj is not None: # <<<<<<<<<<<<<< + * PyBuffer_Release(&self.view) + * elif (<__pyx_buffer *> &self.view).obj == Py_None: +*/ + goto __pyx_L3; + } + + /* "View.MemoryView":380 + * if self.obj is not None: + * PyBuffer_Release(&self.view) + * elif (<__pyx_buffer *> &self.view).obj == Py_None: # <<<<<<<<<<<<<< + * + * (<__pyx_buffer *> &self.view).obj = NULL +*/ + __pyx_t_1 = (((Py_buffer *)(&__pyx_v_self->view))->obj == Py_None); + if (__pyx_t_1) { + + /* "View.MemoryView":382 + * elif (<__pyx_buffer *> &self.view).obj == Py_None: + * + * (<__pyx_buffer *> &self.view).obj = NULL # <<<<<<<<<<<<<< + * Py_DECREF(Py_None) + * +*/ + ((Py_buffer *)(&__pyx_v_self->view))->obj = NULL; + + /* "View.MemoryView":383 + * + * (<__pyx_buffer *> &self.view).obj = NULL + * Py_DECREF(Py_None) # <<<<<<<<<<<<<< + * + * cdef int i +*/ + Py_DECREF(Py_None); + + /* "View.MemoryView":380 + * if self.obj is not None: + * PyBuffer_Release(&self.view) + * elif (<__pyx_buffer *> &self.view).obj == Py_None: # <<<<<<<<<<<<<< + * + * (<__pyx_buffer *> &self.view).obj = NULL +*/ + } + __pyx_L3:; + + /* "View.MemoryView":387 + * cdef int i + * global __pyx_memoryview_thread_locks_used + * if self.lock != NULL: # <<<<<<<<<<<<<< + * for i in range(0 if __PYX_GET_CYTHON_COMPILING_IN_CPYTHON_FREETHREADING() else __pyx_memoryview_thread_locks_used): + * if __pyx_memoryview_thread_locks[i] is self.lock: +*/ + __pyx_t_1 = (__pyx_v_self->lock != NULL); + if (__pyx_t_1) { + + /* "View.MemoryView":388 + * global __pyx_memoryview_thread_locks_used + * if self.lock != NULL: + * for i in range(0 if __PYX_GET_CYTHON_COMPILING_IN_CPYTHON_FREETHREADING() else __pyx_memoryview_thread_locks_used): # <<<<<<<<<<<<<< + * if __pyx_memoryview_thread_locks[i] is self.lock: + * __pyx_memoryview_thread_locks_used -= 1 +*/ + __pyx_t_1 = __PYX_GET_CYTHON_COMPILING_IN_CPYTHON_FREETHREADING(); + if (__pyx_t_1) { + __pyx_t_2 = 0; + } else { + __pyx_t_2 = __pyx_memoryview_thread_locks_used; + } + __pyx_t_3 = __pyx_t_2; + for (__pyx_t_4 = 0; __pyx_t_4 < __pyx_t_3; __pyx_t_4+=1) { + __pyx_v_i = __pyx_t_4; + + /* "View.MemoryView":389 + * if self.lock != NULL: + * for i in range(0 if __PYX_GET_CYTHON_COMPILING_IN_CPYTHON_FREETHREADING() else __pyx_memoryview_thread_locks_used): + * if __pyx_memoryview_thread_locks[i] is self.lock: # <<<<<<<<<<<<<< + * __pyx_memoryview_thread_locks_used -= 1 + * if i != __pyx_memoryview_thread_locks_used: +*/ + __pyx_t_1 = ((__pyx_memoryview_thread_locks[__pyx_v_i]) == __pyx_v_self->lock); + if (__pyx_t_1) { + + /* "View.MemoryView":390 + * for i in range(0 if __PYX_GET_CYTHON_COMPILING_IN_CPYTHON_FREETHREADING() else __pyx_memoryview_thread_locks_used): + * if __pyx_memoryview_thread_locks[i] is self.lock: + * __pyx_memoryview_thread_locks_used -= 1 # <<<<<<<<<<<<<< + * if i != __pyx_memoryview_thread_locks_used: + * __pyx_memoryview_thread_locks[i], __pyx_memoryview_thread_locks[__pyx_memoryview_thread_locks_used] = ( +*/ + __pyx_memoryview_thread_locks_used = (__pyx_memoryview_thread_locks_used - 1); + + /* "View.MemoryView":391 + * if __pyx_memoryview_thread_locks[i] is self.lock: + * __pyx_memoryview_thread_locks_used -= 1 + * if i != __pyx_memoryview_thread_locks_used: # <<<<<<<<<<<<<< + * __pyx_memoryview_thread_locks[i], __pyx_memoryview_thread_locks[__pyx_memoryview_thread_locks_used] = ( + * __pyx_memoryview_thread_locks[__pyx_memoryview_thread_locks_used], __pyx_memoryview_thread_locks[i]) +*/ + __pyx_t_1 = (__pyx_v_i != __pyx_memoryview_thread_locks_used); + if (__pyx_t_1) { + + /* "View.MemoryView":393 + * if i != __pyx_memoryview_thread_locks_used: + * __pyx_memoryview_thread_locks[i], __pyx_memoryview_thread_locks[__pyx_memoryview_thread_locks_used] = ( + * __pyx_memoryview_thread_locks[__pyx_memoryview_thread_locks_used], __pyx_memoryview_thread_locks[i]) # <<<<<<<<<<<<<< + * break + * else: +*/ + __pyx_t_5 = (__pyx_memoryview_thread_locks[__pyx_memoryview_thread_locks_used]); + __pyx_t_6 = (__pyx_memoryview_thread_locks[__pyx_v_i]); + + /* "View.MemoryView":392 + * __pyx_memoryview_thread_locks_used -= 1 + * if i != __pyx_memoryview_thread_locks_used: + * __pyx_memoryview_thread_locks[i], __pyx_memoryview_thread_locks[__pyx_memoryview_thread_locks_used] = ( # <<<<<<<<<<<<<< + * __pyx_memoryview_thread_locks[__pyx_memoryview_thread_locks_used], __pyx_memoryview_thread_locks[i]) + * break +*/ + (__pyx_memoryview_thread_locks[__pyx_v_i]) = __pyx_t_5; + (__pyx_memoryview_thread_locks[__pyx_memoryview_thread_locks_used]) = __pyx_t_6; + + /* "View.MemoryView":391 + * if __pyx_memoryview_thread_locks[i] is self.lock: + * __pyx_memoryview_thread_locks_used -= 1 + * if i != __pyx_memoryview_thread_locks_used: # <<<<<<<<<<<<<< + * __pyx_memoryview_thread_locks[i], __pyx_memoryview_thread_locks[__pyx_memoryview_thread_locks_used] = ( + * __pyx_memoryview_thread_locks[__pyx_memoryview_thread_locks_used], __pyx_memoryview_thread_locks[i]) +*/ + } + + /* "View.MemoryView":394 + * __pyx_memoryview_thread_locks[i], __pyx_memoryview_thread_locks[__pyx_memoryview_thread_locks_used] = ( + * __pyx_memoryview_thread_locks[__pyx_memoryview_thread_locks_used], __pyx_memoryview_thread_locks[i]) + * break # <<<<<<<<<<<<<< + * else: + * PyThread_free_lock(self.lock) +*/ + goto __pyx_L6_break; + + /* "View.MemoryView":389 + * if self.lock != NULL: + * for i in range(0 if __PYX_GET_CYTHON_COMPILING_IN_CPYTHON_FREETHREADING() else __pyx_memoryview_thread_locks_used): + * if __pyx_memoryview_thread_locks[i] is self.lock: # <<<<<<<<<<<<<< + * __pyx_memoryview_thread_locks_used -= 1 + * if i != __pyx_memoryview_thread_locks_used: +*/ + } + } + /*else*/ { + + /* "View.MemoryView":396 + * break + * else: + * PyThread_free_lock(self.lock) # <<<<<<<<<<<<<< + * + * cdef char *get_item_pointer(memoryview self, object index) except NULL: +*/ + PyThread_free_lock(__pyx_v_self->lock); + } + __pyx_L6_break:; + + /* "View.MemoryView":387 + * cdef int i + * global __pyx_memoryview_thread_locks_used + * if self.lock != NULL: # <<<<<<<<<<<<<< + * for i in range(0 if __PYX_GET_CYTHON_COMPILING_IN_CPYTHON_FREETHREADING() else __pyx_memoryview_thread_locks_used): + * if __pyx_memoryview_thread_locks[i] is self.lock: +*/ + } + + /* "View.MemoryView":377 + * self.typeinfo = NULL + * + * def __dealloc__(memoryview self): # <<<<<<<<<<<<<< + * if self.obj is not None: + * PyBuffer_Release(&self.view) +*/ + + /* function exit code */ +} + +/* "View.MemoryView":398 + * PyThread_free_lock(self.lock) + * + * cdef char *get_item_pointer(memoryview self, object index) except NULL: # <<<<<<<<<<<<<< + * cdef Py_ssize_t dim + * cdef char *itemp = self.view.buf +*/ + +static char *__pyx_memoryview_get_item_pointer(struct __pyx_memoryview_obj *__pyx_v_self, PyObject *__pyx_v_index) { + Py_ssize_t __pyx_v_dim; + char *__pyx_v_itemp; + PyObject *__pyx_v_idx = NULL; + char *__pyx_r; + __Pyx_RefNannyDeclarations + Py_ssize_t __pyx_t_1; + PyObject *__pyx_t_2 = NULL; + Py_ssize_t __pyx_t_3; + PyObject *(*__pyx_t_4)(PyObject *); + PyObject *__pyx_t_5 = NULL; + Py_ssize_t __pyx_t_6; + char *__pyx_t_7; + int __pyx_lineno = 0; + const char *__pyx_filename = NULL; + int __pyx_clineno = 0; + __Pyx_RefNannySetupContext("get_item_pointer", 0); + + /* "View.MemoryView":400 + * cdef char *get_item_pointer(memoryview self, object index) except NULL: + * cdef Py_ssize_t dim + * cdef char *itemp = self.view.buf # <<<<<<<<<<<<<< + * + * for dim, idx in enumerate(index): +*/ + __pyx_v_itemp = ((char *)__pyx_v_self->view.buf); + + /* "View.MemoryView":402 + * cdef char *itemp = self.view.buf + * + * for dim, idx in enumerate(index): # <<<<<<<<<<<<<< + * itemp = pybuffer_index(&self.view, itemp, idx, dim) + * +*/ + __pyx_t_1 = 0; + if (likely(PyList_CheckExact(__pyx_v_index)) || PyTuple_CheckExact(__pyx_v_index)) { + __pyx_t_2 = __pyx_v_index; __Pyx_INCREF(__pyx_t_2); + __pyx_t_3 = 0; + __pyx_t_4 = NULL; + } else { + __pyx_t_3 = -1; __pyx_t_2 = PyObject_GetIter(__pyx_v_index); if (unlikely(!__pyx_t_2)) __PYX_ERR(1, 402, __pyx_L1_error) + __Pyx_GOTREF(__pyx_t_2); + __pyx_t_4 = (CYTHON_COMPILING_IN_LIMITED_API) ? PyIter_Next : __Pyx_PyObject_GetIterNextFunc(__pyx_t_2); if (unlikely(!__pyx_t_4)) __PYX_ERR(1, 402, __pyx_L1_error) + } + for (;;) { + if (likely(!__pyx_t_4)) { + if (likely(PyList_CheckExact(__pyx_t_2))) { + { + Py_ssize_t __pyx_temp = __Pyx_PyList_GET_SIZE(__pyx_t_2); + #if !CYTHON_ASSUME_SAFE_SIZE + if (unlikely((__pyx_temp < 0))) __PYX_ERR(1, 402, __pyx_L1_error) + #endif + if (__pyx_t_3 >= __pyx_temp) break; + } + __pyx_t_5 = __Pyx_PyList_GetItemRefFast(__pyx_t_2, __pyx_t_3, __Pyx_ReferenceSharing_OwnStrongReference); + ++__pyx_t_3; + } else { + { + Py_ssize_t __pyx_temp = __Pyx_PyTuple_GET_SIZE(__pyx_t_2); + #if !CYTHON_ASSUME_SAFE_SIZE + if (unlikely((__pyx_temp < 0))) __PYX_ERR(1, 402, __pyx_L1_error) + #endif + if (__pyx_t_3 >= __pyx_temp) break; + } + #if CYTHON_ASSUME_SAFE_MACROS && !CYTHON_AVOID_BORROWED_REFS + __pyx_t_5 = __Pyx_NewRef(PyTuple_GET_ITEM(__pyx_t_2, __pyx_t_3)); + #else + __pyx_t_5 = __Pyx_PySequence_ITEM(__pyx_t_2, __pyx_t_3); + #endif + ++__pyx_t_3; + } + if (unlikely(!__pyx_t_5)) __PYX_ERR(1, 402, __pyx_L1_error) + } else { + __pyx_t_5 = __pyx_t_4(__pyx_t_2); + if (unlikely(!__pyx_t_5)) { + PyObject* exc_type = PyErr_Occurred(); + if (exc_type) { + if (unlikely(!__Pyx_PyErr_GivenExceptionMatches(exc_type, PyExc_StopIteration))) __PYX_ERR(1, 402, __pyx_L1_error) + PyErr_Clear(); + } + break; + } + } + __Pyx_GOTREF(__pyx_t_5); + __Pyx_XDECREF_SET(__pyx_v_idx, __pyx_t_5); + __pyx_t_5 = 0; + __pyx_v_dim = __pyx_t_1; + __pyx_t_1 = (__pyx_t_1 + 1); + + /* "View.MemoryView":403 + * + * for dim, idx in enumerate(index): + * itemp = pybuffer_index(&self.view, itemp, idx, dim) # <<<<<<<<<<<<<< + * + * return itemp +*/ + __pyx_t_6 = __Pyx_PyIndex_AsSsize_t(__pyx_v_idx); if (unlikely((__pyx_t_6 == (Py_ssize_t)-1) && PyErr_Occurred())) __PYX_ERR(1, 403, __pyx_L1_error) + __pyx_t_7 = __pyx_pybuffer_index((&__pyx_v_self->view), __pyx_v_itemp, __pyx_t_6, __pyx_v_dim); if (unlikely(__pyx_t_7 == ((void *)NULL))) __PYX_ERR(1, 403, __pyx_L1_error) + __pyx_v_itemp = __pyx_t_7; + + /* "View.MemoryView":402 + * cdef char *itemp = self.view.buf + * + * for dim, idx in enumerate(index): # <<<<<<<<<<<<<< + * itemp = pybuffer_index(&self.view, itemp, idx, dim) + * +*/ + } + __Pyx_DECREF(__pyx_t_2); __pyx_t_2 = 0; + + /* "View.MemoryView":405 + * itemp = pybuffer_index(&self.view, itemp, idx, dim) + * + * return itemp # <<<<<<<<<<<<<< + * + * +*/ + __pyx_r = __pyx_v_itemp; + goto __pyx_L0; + + /* "View.MemoryView":398 + * PyThread_free_lock(self.lock) + * + * cdef char *get_item_pointer(memoryview self, object index) except NULL: # <<<<<<<<<<<<<< + * cdef Py_ssize_t dim + * cdef char *itemp = self.view.buf +*/ + + /* function exit code */ + __pyx_L1_error:; + __Pyx_XDECREF(__pyx_t_2); + __Pyx_XDECREF(__pyx_t_5); + __Pyx_AddTraceback("View.MemoryView.memoryview.get_item_pointer", __pyx_clineno, __pyx_lineno, __pyx_filename); + __pyx_r = NULL; + __pyx_L0:; + __Pyx_XDECREF(__pyx_v_idx); + __Pyx_RefNannyFinishContext(); + return __pyx_r; +} + +/* "View.MemoryView":408 + * + * + * def __getitem__(memoryview self, object index): # <<<<<<<<<<<<<< + * if index is Ellipsis: + * return self +*/ + +/* Python wrapper */ +static PyObject *__pyx_memoryview___getitem__(PyObject *__pyx_v_self, PyObject *__pyx_v_index); /*proto*/ +static PyObject *__pyx_memoryview___getitem__(PyObject *__pyx_v_self, PyObject *__pyx_v_index) { + CYTHON_UNUSED PyObject *const *__pyx_kwvalues; + PyObject *__pyx_r = 0; + __Pyx_RefNannyDeclarations + __Pyx_RefNannySetupContext("__getitem__ (wrapper)", 0); + __pyx_kwvalues = __Pyx_KwValues_VARARGS(__pyx_args, __pyx_nargs); + __pyx_r = __pyx_memoryview___pyx_pf_15View_dot_MemoryView_10memoryview_4__getitem__(((struct __pyx_memoryview_obj *)__pyx_v_self), ((PyObject *)__pyx_v_index)); + + /* function exit code */ + __Pyx_RefNannyFinishContext(); + return __pyx_r; +} + +static PyObject *__pyx_memoryview___pyx_pf_15View_dot_MemoryView_10memoryview_4__getitem__(struct __pyx_memoryview_obj *__pyx_v_self, PyObject *__pyx_v_index) { + PyObject *__pyx_v_have_slices = NULL; + PyObject *__pyx_v_indices = NULL; + char *__pyx_v_itemp; + 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; + char *__pyx_t_5; + int __pyx_lineno = 0; + const char *__pyx_filename = NULL; + int __pyx_clineno = 0; + __Pyx_RefNannySetupContext("__getitem__", 0); + + /* "View.MemoryView":409 + * + * def __getitem__(memoryview self, object index): + * if index is Ellipsis: # <<<<<<<<<<<<<< + * return self + * +*/ + __pyx_t_1 = (__pyx_v_index == __pyx_builtin_Ellipsis); + if (__pyx_t_1) { + + /* "View.MemoryView":410 + * def __getitem__(memoryview self, object index): + * if index is Ellipsis: + * return self # <<<<<<<<<<<<<< + * + * have_slices, indices = _unellipsify(index, self.view.ndim) +*/ + __Pyx_XDECREF(__pyx_r); + __Pyx_INCREF((PyObject *)__pyx_v_self); + __pyx_r = ((PyObject *)__pyx_v_self); + goto __pyx_L0; + + /* "View.MemoryView":409 + * + * def __getitem__(memoryview self, object index): + * if index is Ellipsis: # <<<<<<<<<<<<<< + * return self + * +*/ + } + + /* "View.MemoryView":412 + * return self + * + * have_slices, indices = _unellipsify(index, self.view.ndim) # <<<<<<<<<<<<<< + * + * cdef char *itemp +*/ + __pyx_t_2 = _unellipsify(__pyx_v_index, __pyx_v_self->view.ndim); if (unlikely(!__pyx_t_2)) __PYX_ERR(1, 412, __pyx_L1_error) + __Pyx_GOTREF(__pyx_t_2); + if (likely(__pyx_t_2 != Py_None)) { + PyObject* sequence = __pyx_t_2; + Py_ssize_t size = __Pyx_PyTuple_GET_SIZE(sequence); + if (unlikely(size != 2)) { + if (size > 2) __Pyx_RaiseTooManyValuesError(2); + else if (size >= 0) __Pyx_RaiseNeedMoreValuesError(size); + __PYX_ERR(1, 412, __pyx_L1_error) + } + #if CYTHON_ASSUME_SAFE_MACROS && !CYTHON_AVOID_BORROWED_REFS + __pyx_t_3 = PyTuple_GET_ITEM(sequence, 0); + __Pyx_INCREF(__pyx_t_3); + __pyx_t_4 = PyTuple_GET_ITEM(sequence, 1); + __Pyx_INCREF(__pyx_t_4); + #else + __pyx_t_3 = __Pyx_PySequence_ITEM(sequence, 0); if (unlikely(!__pyx_t_3)) __PYX_ERR(1, 412, __pyx_L1_error) + __Pyx_GOTREF(__pyx_t_3); + __pyx_t_4 = __Pyx_PySequence_ITEM(sequence, 1); if (unlikely(!__pyx_t_4)) __PYX_ERR(1, 412, __pyx_L1_error) + __Pyx_GOTREF(__pyx_t_4); + #endif + __Pyx_DECREF(__pyx_t_2); __pyx_t_2 = 0; + } else { + __Pyx_RaiseNoneNotIterableError(); __PYX_ERR(1, 412, __pyx_L1_error) + } + __pyx_v_have_slices = __pyx_t_3; + __pyx_t_3 = 0; + __pyx_v_indices = __pyx_t_4; + __pyx_t_4 = 0; + + /* "View.MemoryView":415 + * + * cdef char *itemp + * if have_slices: # <<<<<<<<<<<<<< + * return memview_slice(self, indices) + * else: +*/ + __pyx_t_1 = __Pyx_PyObject_IsTrue(__pyx_v_have_slices); if (unlikely((__pyx_t_1 < 0))) __PYX_ERR(1, 415, __pyx_L1_error) + if (__pyx_t_1) { + + /* "View.MemoryView":416 + * cdef char *itemp + * if have_slices: + * return memview_slice(self, indices) # <<<<<<<<<<<<<< + * else: + * itemp = self.get_item_pointer(indices) +*/ + __Pyx_XDECREF(__pyx_r); + __pyx_t_2 = ((PyObject *)__pyx_memview_slice(__pyx_v_self, __pyx_v_indices)); if (unlikely(!__pyx_t_2)) __PYX_ERR(1, 416, __pyx_L1_error) + __Pyx_GOTREF(__pyx_t_2); + __pyx_r = __pyx_t_2; + __pyx_t_2 = 0; + goto __pyx_L0; + + /* "View.MemoryView":415 + * + * cdef char *itemp + * if have_slices: # <<<<<<<<<<<<<< + * return memview_slice(self, indices) + * else: +*/ + } + + /* "View.MemoryView":418 + * return memview_slice(self, indices) + * else: + * itemp = self.get_item_pointer(indices) # <<<<<<<<<<<<<< + * return self.convert_item_to_object(itemp) + * +*/ + /*else*/ { + __pyx_t_5 = ((struct __pyx_vtabstruct_memoryview *)__pyx_v_self->__pyx_vtab)->get_item_pointer(__pyx_v_self, __pyx_v_indices); if (unlikely(__pyx_t_5 == ((void *)NULL))) __PYX_ERR(1, 418, __pyx_L1_error) + __pyx_v_itemp = __pyx_t_5; + + /* "View.MemoryView":419 + * else: + * itemp = self.get_item_pointer(indices) + * return self.convert_item_to_object(itemp) # <<<<<<<<<<<<<< + * + * def __setitem__(memoryview self, object index, object value): +*/ + __Pyx_XDECREF(__pyx_r); + __pyx_t_2 = ((struct __pyx_vtabstruct_memoryview *)__pyx_v_self->__pyx_vtab)->convert_item_to_object(__pyx_v_self, __pyx_v_itemp); if (unlikely(!__pyx_t_2)) __PYX_ERR(1, 419, __pyx_L1_error) + __Pyx_GOTREF(__pyx_t_2); + __pyx_r = __pyx_t_2; + __pyx_t_2 = 0; + goto __pyx_L0; + } + + /* "View.MemoryView":408 + * + * + * def __getitem__(memoryview self, object index): # <<<<<<<<<<<<<< + * if index is Ellipsis: + * return self +*/ + + /* function exit code */ + __pyx_L1_error:; + __Pyx_XDECREF(__pyx_t_2); + __Pyx_XDECREF(__pyx_t_3); + __Pyx_XDECREF(__pyx_t_4); + __Pyx_AddTraceback("View.MemoryView.memoryview.__getitem__", __pyx_clineno, __pyx_lineno, __pyx_filename); + __pyx_r = NULL; + __pyx_L0:; + __Pyx_XDECREF(__pyx_v_have_slices); + __Pyx_XDECREF(__pyx_v_indices); + __Pyx_XGIVEREF(__pyx_r); + __Pyx_RefNannyFinishContext(); + return __pyx_r; +} + +/* "View.MemoryView":421 + * return self.convert_item_to_object(itemp) + * + * def __setitem__(memoryview self, object index, object value): # <<<<<<<<<<<<<< + * if self.view.readonly: + * raise TypeError, "Cannot assign to read-only memoryview" +*/ + +/* Python wrapper */ +static int __pyx_memoryview___setitem__(PyObject *__pyx_v_self, PyObject *__pyx_v_index, PyObject *__pyx_v_value); /*proto*/ +static int __pyx_memoryview___setitem__(PyObject *__pyx_v_self, PyObject *__pyx_v_index, PyObject *__pyx_v_value) { + CYTHON_UNUSED PyObject *const *__pyx_kwvalues; + int __pyx_r; + __Pyx_RefNannyDeclarations + __Pyx_RefNannySetupContext("__setitem__ (wrapper)", 0); + __pyx_kwvalues = __Pyx_KwValues_VARARGS(__pyx_args, __pyx_nargs); + __pyx_r = __pyx_memoryview___pyx_pf_15View_dot_MemoryView_10memoryview_6__setitem__(((struct __pyx_memoryview_obj *)__pyx_v_self), ((PyObject *)__pyx_v_index), ((PyObject *)__pyx_v_value)); + + /* function exit code */ + __Pyx_RefNannyFinishContext(); + return __pyx_r; +} + +static int __pyx_memoryview___pyx_pf_15View_dot_MemoryView_10memoryview_6__setitem__(struct __pyx_memoryview_obj *__pyx_v_self, PyObject *__pyx_v_index, PyObject *__pyx_v_value) { + PyObject *__pyx_v_have_slices = NULL; + PyObject *__pyx_v_obj = NULL; + int __pyx_r; + __Pyx_RefNannyDeclarations + PyObject *__pyx_t_1 = NULL; + PyObject *__pyx_t_2 = NULL; + PyObject *__pyx_t_3 = NULL; + int __pyx_t_4; + int __pyx_lineno = 0; + const char *__pyx_filename = NULL; + int __pyx_clineno = 0; + __Pyx_RefNannySetupContext("__setitem__", 0); + __Pyx_INCREF(__pyx_v_index); + + /* "View.MemoryView":422 + * + * def __setitem__(memoryview self, object index, object value): + * if self.view.readonly: # <<<<<<<<<<<<<< + * raise TypeError, "Cannot assign to read-only memoryview" + * +*/ + if (unlikely(__pyx_v_self->view.readonly)) { + + /* "View.MemoryView":423 + * def __setitem__(memoryview self, object index, object value): + * if self.view.readonly: + * raise TypeError, "Cannot assign to read-only memoryview" # <<<<<<<<<<<<<< + * + * have_slices, index = _unellipsify(index, self.view.ndim) +*/ + __Pyx_Raise(((PyObject *)(((PyTypeObject*)PyExc_TypeError))), __pyx_mstate_global->__pyx_kp_u_Cannot_assign_to_read_only_memor, 0, 0); + __PYX_ERR(1, 423, __pyx_L1_error) + + /* "View.MemoryView":422 + * + * def __setitem__(memoryview self, object index, object value): + * if self.view.readonly: # <<<<<<<<<<<<<< + * raise TypeError, "Cannot assign to read-only memoryview" + * +*/ + } + + /* "View.MemoryView":425 + * raise TypeError, "Cannot assign to read-only memoryview" + * + * have_slices, index = _unellipsify(index, self.view.ndim) # <<<<<<<<<<<<<< + * + * if have_slices: +*/ + __pyx_t_1 = _unellipsify(__pyx_v_index, __pyx_v_self->view.ndim); if (unlikely(!__pyx_t_1)) __PYX_ERR(1, 425, __pyx_L1_error) + __Pyx_GOTREF(__pyx_t_1); + if (likely(__pyx_t_1 != Py_None)) { + PyObject* sequence = __pyx_t_1; + Py_ssize_t size = __Pyx_PyTuple_GET_SIZE(sequence); + if (unlikely(size != 2)) { + if (size > 2) __Pyx_RaiseTooManyValuesError(2); + else if (size >= 0) __Pyx_RaiseNeedMoreValuesError(size); + __PYX_ERR(1, 425, __pyx_L1_error) + } + #if CYTHON_ASSUME_SAFE_MACROS && !CYTHON_AVOID_BORROWED_REFS + __pyx_t_2 = PyTuple_GET_ITEM(sequence, 0); + __Pyx_INCREF(__pyx_t_2); + __pyx_t_3 = PyTuple_GET_ITEM(sequence, 1); + __Pyx_INCREF(__pyx_t_3); + #else + __pyx_t_2 = __Pyx_PySequence_ITEM(sequence, 0); if (unlikely(!__pyx_t_2)) __PYX_ERR(1, 425, __pyx_L1_error) + __Pyx_GOTREF(__pyx_t_2); + __pyx_t_3 = __Pyx_PySequence_ITEM(sequence, 1); if (unlikely(!__pyx_t_3)) __PYX_ERR(1, 425, __pyx_L1_error) + __Pyx_GOTREF(__pyx_t_3); + #endif + __Pyx_DECREF(__pyx_t_1); __pyx_t_1 = 0; + } else { + __Pyx_RaiseNoneNotIterableError(); __PYX_ERR(1, 425, __pyx_L1_error) + } + __pyx_v_have_slices = __pyx_t_2; + __pyx_t_2 = 0; + __Pyx_DECREF_SET(__pyx_v_index, __pyx_t_3); + __pyx_t_3 = 0; + + /* "View.MemoryView":427 + * have_slices, index = _unellipsify(index, self.view.ndim) + * + * if have_slices: # <<<<<<<<<<<<<< + * obj = self.is_slice(value) + * if obj is not None: +*/ + __pyx_t_4 = __Pyx_PyObject_IsTrue(__pyx_v_have_slices); if (unlikely((__pyx_t_4 < 0))) __PYX_ERR(1, 427, __pyx_L1_error) + if (__pyx_t_4) { + + /* "View.MemoryView":428 + * + * if have_slices: + * obj = self.is_slice(value) # <<<<<<<<<<<<<< + * if obj is not None: + * self.setitem_slice_assignment(self[index], obj) +*/ + __pyx_t_1 = ((struct __pyx_vtabstruct_memoryview *)__pyx_v_self->__pyx_vtab)->is_slice(__pyx_v_self, __pyx_v_value); if (unlikely(!__pyx_t_1)) __PYX_ERR(1, 428, __pyx_L1_error) + __Pyx_GOTREF(__pyx_t_1); + __pyx_v_obj = __pyx_t_1; + __pyx_t_1 = 0; + + /* "View.MemoryView":429 + * if have_slices: + * obj = self.is_slice(value) + * if obj is not None: # <<<<<<<<<<<<<< + * self.setitem_slice_assignment(self[index], obj) + * else: +*/ + __pyx_t_4 = (__pyx_v_obj != Py_None); + if (__pyx_t_4) { + + /* "View.MemoryView":430 + * obj = self.is_slice(value) + * if obj is not None: + * self.setitem_slice_assignment(self[index], obj) # <<<<<<<<<<<<<< + * else: + * self.setitem_slice_assign_scalar(self[index], value) +*/ + __pyx_t_1 = __Pyx_PyObject_GetItem(((PyObject *)__pyx_v_self), __pyx_v_index); if (unlikely(!__pyx_t_1)) __PYX_ERR(1, 430, __pyx_L1_error) + __Pyx_GOTREF(__pyx_t_1); + __pyx_t_3 = ((struct __pyx_vtabstruct_memoryview *)__pyx_v_self->__pyx_vtab)->setitem_slice_assignment(__pyx_v_self, __pyx_t_1, __pyx_v_obj); if (unlikely(!__pyx_t_3)) __PYX_ERR(1, 430, __pyx_L1_error) + __Pyx_GOTREF(__pyx_t_3); + __Pyx_DECREF(__pyx_t_1); __pyx_t_1 = 0; + __Pyx_DECREF(__pyx_t_3); __pyx_t_3 = 0; + + /* "View.MemoryView":429 + * if have_slices: + * obj = self.is_slice(value) + * if obj is not None: # <<<<<<<<<<<<<< + * self.setitem_slice_assignment(self[index], obj) + * else: +*/ + goto __pyx_L5; + } + + /* "View.MemoryView":432 + * self.setitem_slice_assignment(self[index], obj) + * else: + * self.setitem_slice_assign_scalar(self[index], value) # <<<<<<<<<<<<<< + * else: + * self.setitem_indexed(index, value) +*/ + /*else*/ { + __pyx_t_3 = __Pyx_PyObject_GetItem(((PyObject *)__pyx_v_self), __pyx_v_index); if (unlikely(!__pyx_t_3)) __PYX_ERR(1, 432, __pyx_L1_error) + __Pyx_GOTREF(__pyx_t_3); + if (!(likely(((__pyx_t_3) == Py_None) || likely(__Pyx_TypeTest(__pyx_t_3, __pyx_mstate_global->__pyx_memoryview_type))))) __PYX_ERR(1, 432, __pyx_L1_error) + __pyx_t_1 = ((struct __pyx_vtabstruct_memoryview *)__pyx_v_self->__pyx_vtab)->setitem_slice_assign_scalar(__pyx_v_self, ((struct __pyx_memoryview_obj *)__pyx_t_3), __pyx_v_value); if (unlikely(!__pyx_t_1)) __PYX_ERR(1, 432, __pyx_L1_error) + __Pyx_GOTREF(__pyx_t_1); + __Pyx_DECREF(__pyx_t_3); __pyx_t_3 = 0; + __Pyx_DECREF(__pyx_t_1); __pyx_t_1 = 0; + } + __pyx_L5:; + + /* "View.MemoryView":427 + * have_slices, index = _unellipsify(index, self.view.ndim) + * + * if have_slices: # <<<<<<<<<<<<<< + * obj = self.is_slice(value) + * if obj is not None: +*/ + goto __pyx_L4; + } + + /* "View.MemoryView":434 + * self.setitem_slice_assign_scalar(self[index], value) + * else: + * self.setitem_indexed(index, value) # <<<<<<<<<<<<<< + * + * cdef is_slice(self, obj): +*/ + /*else*/ { + __pyx_t_1 = ((struct __pyx_vtabstruct_memoryview *)__pyx_v_self->__pyx_vtab)->setitem_indexed(__pyx_v_self, __pyx_v_index, __pyx_v_value); if (unlikely(!__pyx_t_1)) __PYX_ERR(1, 434, __pyx_L1_error) + __Pyx_GOTREF(__pyx_t_1); + __Pyx_DECREF(__pyx_t_1); __pyx_t_1 = 0; + } + __pyx_L4:; + + /* "View.MemoryView":421 + * return self.convert_item_to_object(itemp) + * + * def __setitem__(memoryview self, object index, object value): # <<<<<<<<<<<<<< + * if self.view.readonly: + * raise TypeError, "Cannot assign to read-only memoryview" +*/ + + /* function exit code */ + __pyx_r = 0; + goto __pyx_L0; + __pyx_L1_error:; + __Pyx_XDECREF(__pyx_t_1); + __Pyx_XDECREF(__pyx_t_2); + __Pyx_XDECREF(__pyx_t_3); + __Pyx_AddTraceback("View.MemoryView.memoryview.__setitem__", __pyx_clineno, __pyx_lineno, __pyx_filename); + __pyx_r = -1; + __pyx_L0:; + __Pyx_XDECREF(__pyx_v_have_slices); + __Pyx_XDECREF(__pyx_v_obj); + __Pyx_XDECREF(__pyx_v_index); + __Pyx_RefNannyFinishContext(); + return __pyx_r; +} + +/* "View.MemoryView":436 + * self.setitem_indexed(index, value) + * + * cdef is_slice(self, obj): # <<<<<<<<<<<<<< + * if not isinstance(obj, memoryview): + * try: +*/ + +static PyObject *__pyx_memoryview_is_slice(struct __pyx_memoryview_obj *__pyx_v_self, PyObject *__pyx_v_obj) { + PyObject *__pyx_r = NULL; + __Pyx_RefNannyDeclarations + int __pyx_t_1; + int __pyx_t_2; + PyObject *__pyx_t_3 = NULL; + PyObject *__pyx_t_4 = NULL; + PyObject *__pyx_t_5 = NULL; + PyObject *__pyx_t_6 = NULL; + PyObject *__pyx_t_7 = NULL; + PyObject *__pyx_t_8 = NULL; + PyObject *__pyx_t_9 = NULL; + size_t __pyx_t_10; + int __pyx_t_11; + int __pyx_lineno = 0; + const char *__pyx_filename = NULL; + int __pyx_clineno = 0; + __Pyx_RefNannySetupContext("is_slice", 0); + __Pyx_INCREF(__pyx_v_obj); + + /* "View.MemoryView":437 + * + * cdef is_slice(self, obj): + * if not isinstance(obj, memoryview): # <<<<<<<<<<<<<< + * try: + * obj = memoryview(obj, self.flags & ~PyBUF_WRITABLE | PyBUF_ANY_CONTIGUOUS, +*/ + __pyx_t_1 = __Pyx_TypeCheck(__pyx_v_obj, __pyx_mstate_global->__pyx_memoryview_type); + __pyx_t_2 = (!__pyx_t_1); + if (__pyx_t_2) { + + /* "View.MemoryView":438 + * cdef is_slice(self, obj): + * if not isinstance(obj, memoryview): + * try: # <<<<<<<<<<<<<< + * obj = memoryview(obj, self.flags & ~PyBUF_WRITABLE | PyBUF_ANY_CONTIGUOUS, + * self.dtype_is_object) +*/ + { + __Pyx_PyThreadState_declare + __Pyx_PyThreadState_assign + __Pyx_ExceptionSave(&__pyx_t_3, &__pyx_t_4, &__pyx_t_5); + __Pyx_XGOTREF(__pyx_t_3); + __Pyx_XGOTREF(__pyx_t_4); + __Pyx_XGOTREF(__pyx_t_5); + /*try:*/ { + + /* "View.MemoryView":439 + * if not isinstance(obj, memoryview): + * try: + * obj = memoryview(obj, self.flags & ~PyBUF_WRITABLE | PyBUF_ANY_CONTIGUOUS, # <<<<<<<<<<<<<< + * self.dtype_is_object) + * except TypeError: +*/ + __pyx_t_7 = NULL; + __pyx_t_8 = __Pyx_PyLong_From_int(((__pyx_v_self->flags & (~PyBUF_WRITABLE)) | PyBUF_ANY_CONTIGUOUS)); if (unlikely(!__pyx_t_8)) __PYX_ERR(1, 439, __pyx_L4_error) + __Pyx_GOTREF(__pyx_t_8); + + /* "View.MemoryView":440 + * try: + * obj = memoryview(obj, self.flags & ~PyBUF_WRITABLE | PyBUF_ANY_CONTIGUOUS, + * self.dtype_is_object) # <<<<<<<<<<<<<< + * except TypeError: + * return None +*/ + __pyx_t_9 = __Pyx_PyBool_FromLong(__pyx_v_self->dtype_is_object); if (unlikely(!__pyx_t_9)) __PYX_ERR(1, 440, __pyx_L4_error) + __Pyx_GOTREF(__pyx_t_9); + __pyx_t_10 = 1; + { + PyObject *__pyx_callargs[4] = {__pyx_t_7, __pyx_v_obj, __pyx_t_8, __pyx_t_9}; + __pyx_t_6 = __Pyx_PyObject_FastCall((PyObject*)__pyx_mstate_global->__pyx_memoryview_type, __pyx_callargs+__pyx_t_10, (4-__pyx_t_10) | (__pyx_t_10*__Pyx_PY_VECTORCALL_ARGUMENTS_OFFSET)); + __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; + if (unlikely(!__pyx_t_6)) __PYX_ERR(1, 439, __pyx_L4_error) + __Pyx_GOTREF((PyObject *)__pyx_t_6); + } + __Pyx_DECREF_SET(__pyx_v_obj, ((PyObject *)__pyx_t_6)); + __pyx_t_6 = 0; + + /* "View.MemoryView":438 + * cdef is_slice(self, obj): + * if not isinstance(obj, memoryview): + * try: # <<<<<<<<<<<<<< + * obj = memoryview(obj, self.flags & ~PyBUF_WRITABLE | PyBUF_ANY_CONTIGUOUS, + * self.dtype_is_object) +*/ + } + __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; + goto __pyx_L9_try_end; + __pyx_L4_error:; + __Pyx_XDECREF(__pyx_t_6); __pyx_t_6 = 0; + __Pyx_XDECREF(__pyx_t_7); __pyx_t_7 = 0; + __Pyx_XDECREF(__pyx_t_8); __pyx_t_8 = 0; + __Pyx_XDECREF(__pyx_t_9); __pyx_t_9 = 0; + + /* "View.MemoryView":441 + * obj = memoryview(obj, self.flags & ~PyBUF_WRITABLE | PyBUF_ANY_CONTIGUOUS, + * self.dtype_is_object) + * except TypeError: # <<<<<<<<<<<<<< + * return None + * +*/ + __pyx_t_11 = __Pyx_PyErr_ExceptionMatches(((PyObject *)(((PyTypeObject*)PyExc_TypeError)))); + if (__pyx_t_11) { + __Pyx_ErrRestore(0,0,0); + + /* "View.MemoryView":442 + * self.dtype_is_object) + * except TypeError: + * return None # <<<<<<<<<<<<<< + * + * return obj +*/ + __Pyx_XDECREF(__pyx_r); + __pyx_r = Py_None; __Pyx_INCREF(Py_None); + goto __pyx_L7_except_return; + } + goto __pyx_L6_except_error; + + /* "View.MemoryView":438 + * cdef is_slice(self, obj): + * if not isinstance(obj, memoryview): + * try: # <<<<<<<<<<<<<< + * obj = memoryview(obj, self.flags & ~PyBUF_WRITABLE | PyBUF_ANY_CONTIGUOUS, + * self.dtype_is_object) +*/ + __pyx_L6_except_error:; + __Pyx_XGIVEREF(__pyx_t_3); + __Pyx_XGIVEREF(__pyx_t_4); + __Pyx_XGIVEREF(__pyx_t_5); + __Pyx_ExceptionReset(__pyx_t_3, __pyx_t_4, __pyx_t_5); + goto __pyx_L1_error; + __pyx_L7_except_return:; + __Pyx_XGIVEREF(__pyx_t_3); + __Pyx_XGIVEREF(__pyx_t_4); + __Pyx_XGIVEREF(__pyx_t_5); + __Pyx_ExceptionReset(__pyx_t_3, __pyx_t_4, __pyx_t_5); + goto __pyx_L0; + __pyx_L9_try_end:; + } + + /* "View.MemoryView":437 + * + * cdef is_slice(self, obj): + * if not isinstance(obj, memoryview): # <<<<<<<<<<<<<< + * try: + * obj = memoryview(obj, self.flags & ~PyBUF_WRITABLE | PyBUF_ANY_CONTIGUOUS, +*/ + } + + /* "View.MemoryView":444 + * return None + * + * return obj # <<<<<<<<<<<<<< + * + * cdef setitem_slice_assignment(self, dst, src): +*/ + __Pyx_XDECREF(__pyx_r); + __Pyx_INCREF(__pyx_v_obj); + __pyx_r = __pyx_v_obj; + goto __pyx_L0; + + /* "View.MemoryView":436 + * self.setitem_indexed(index, value) + * + * cdef is_slice(self, obj): # <<<<<<<<<<<<<< + * if not isinstance(obj, memoryview): + * try: +*/ + + /* function exit code */ + __pyx_L1_error:; + __Pyx_XDECREF(__pyx_t_6); + __Pyx_XDECREF(__pyx_t_7); + __Pyx_XDECREF(__pyx_t_8); + __Pyx_XDECREF(__pyx_t_9); + __Pyx_AddTraceback("View.MemoryView.memoryview.is_slice", __pyx_clineno, __pyx_lineno, __pyx_filename); + __pyx_r = 0; + __pyx_L0:; + __Pyx_XDECREF(__pyx_v_obj); + __Pyx_XGIVEREF(__pyx_r); + __Pyx_RefNannyFinishContext(); + return __pyx_r; +} + +/* "View.MemoryView":446 + * return obj + * + * cdef setitem_slice_assignment(self, dst, src): # <<<<<<<<<<<<<< + * cdef __Pyx_memviewslice dst_slice + * cdef __Pyx_memviewslice src_slice +*/ + +static PyObject *__pyx_memoryview_setitem_slice_assignment(struct __pyx_memoryview_obj *__pyx_v_self, PyObject *__pyx_v_dst, PyObject *__pyx_v_src) { + __Pyx_memviewslice __pyx_v_dst_slice; + __Pyx_memviewslice __pyx_v_src_slice; + __Pyx_memviewslice __pyx_v_msrc; + __Pyx_memviewslice __pyx_v_mdst; + PyObject *__pyx_r = NULL; + __Pyx_RefNannyDeclarations + __Pyx_memviewslice *__pyx_t_1; + PyObject *__pyx_t_2 = NULL; + int __pyx_t_3; + int __pyx_t_4; + int __pyx_t_5; + int __pyx_lineno = 0; + const char *__pyx_filename = NULL; + int __pyx_clineno = 0; + __Pyx_RefNannySetupContext("setitem_slice_assignment", 0); + + /* "View.MemoryView":449 + * cdef __Pyx_memviewslice dst_slice + * cdef __Pyx_memviewslice src_slice + * cdef __Pyx_memviewslice msrc = get_slice_from_memview(src, &src_slice)[0] # <<<<<<<<<<<<<< + * cdef __Pyx_memviewslice mdst = get_slice_from_memview(dst, &dst_slice)[0] + * +*/ + if (!(likely(((__pyx_v_src) == Py_None) || likely(__Pyx_TypeTest(__pyx_v_src, __pyx_mstate_global->__pyx_memoryview_type))))) __PYX_ERR(1, 449, __pyx_L1_error) + __pyx_t_1 = __pyx_memoryview_get_slice_from_memoryview(((struct __pyx_memoryview_obj *)__pyx_v_src), (&__pyx_v_src_slice)); if (unlikely(__pyx_t_1 == ((void *)NULL))) __PYX_ERR(1, 449, __pyx_L1_error) + __pyx_v_msrc = (__pyx_t_1[0]); + + /* "View.MemoryView":450 + * cdef __Pyx_memviewslice src_slice + * cdef __Pyx_memviewslice msrc = get_slice_from_memview(src, &src_slice)[0] + * cdef __Pyx_memviewslice mdst = get_slice_from_memview(dst, &dst_slice)[0] # <<<<<<<<<<<<<< + * + * memoryview_copy_contents(msrc, mdst, src.ndim, dst.ndim, self.dtype_is_object) +*/ + if (!(likely(((__pyx_v_dst) == Py_None) || likely(__Pyx_TypeTest(__pyx_v_dst, __pyx_mstate_global->__pyx_memoryview_type))))) __PYX_ERR(1, 450, __pyx_L1_error) + __pyx_t_1 = __pyx_memoryview_get_slice_from_memoryview(((struct __pyx_memoryview_obj *)__pyx_v_dst), (&__pyx_v_dst_slice)); if (unlikely(__pyx_t_1 == ((void *)NULL))) __PYX_ERR(1, 450, __pyx_L1_error) + __pyx_v_mdst = (__pyx_t_1[0]); + + /* "View.MemoryView":452 + * cdef __Pyx_memviewslice mdst = get_slice_from_memview(dst, &dst_slice)[0] + * + * memoryview_copy_contents(msrc, mdst, src.ndim, dst.ndim, self.dtype_is_object) # <<<<<<<<<<<<<< + * + * cdef setitem_slice_assign_scalar(self, memoryview dst, value): +*/ + __pyx_t_2 = __Pyx_PyObject_GetAttrStr(__pyx_v_src, __pyx_mstate_global->__pyx_n_u_ndim); if (unlikely(!__pyx_t_2)) __PYX_ERR(1, 452, __pyx_L1_error) + __Pyx_GOTREF(__pyx_t_2); + __pyx_t_3 = __Pyx_PyLong_As_int(__pyx_t_2); if (unlikely((__pyx_t_3 == (int)-1) && PyErr_Occurred())) __PYX_ERR(1, 452, __pyx_L1_error) + __Pyx_DECREF(__pyx_t_2); __pyx_t_2 = 0; + __pyx_t_2 = __Pyx_PyObject_GetAttrStr(__pyx_v_dst, __pyx_mstate_global->__pyx_n_u_ndim); if (unlikely(!__pyx_t_2)) __PYX_ERR(1, 452, __pyx_L1_error) + __Pyx_GOTREF(__pyx_t_2); + __pyx_t_4 = __Pyx_PyLong_As_int(__pyx_t_2); if (unlikely((__pyx_t_4 == (int)-1) && PyErr_Occurred())) __PYX_ERR(1, 452, __pyx_L1_error) + __Pyx_DECREF(__pyx_t_2); __pyx_t_2 = 0; + __pyx_t_5 = __pyx_memoryview_copy_contents(__pyx_v_msrc, __pyx_v_mdst, __pyx_t_3, __pyx_t_4, __pyx_v_self->dtype_is_object); if (unlikely(__pyx_t_5 == ((int)-1))) __PYX_ERR(1, 452, __pyx_L1_error) + + /* "View.MemoryView":446 + * return obj + * + * cdef setitem_slice_assignment(self, dst, src): # <<<<<<<<<<<<<< + * cdef __Pyx_memviewslice dst_slice + * cdef __Pyx_memviewslice src_slice +*/ + + /* function exit code */ + __pyx_r = Py_None; __Pyx_INCREF(Py_None); + goto __pyx_L0; + __pyx_L1_error:; + __Pyx_XDECREF(__pyx_t_2); + __Pyx_AddTraceback("View.MemoryView.memoryview.setitem_slice_assignment", __pyx_clineno, __pyx_lineno, __pyx_filename); + __pyx_r = 0; + __pyx_L0:; + __Pyx_XGIVEREF(__pyx_r); + __Pyx_RefNannyFinishContext(); + return __pyx_r; +} + +/* "View.MemoryView":454 + * memoryview_copy_contents(msrc, mdst, src.ndim, dst.ndim, self.dtype_is_object) + * + * cdef setitem_slice_assign_scalar(self, memoryview dst, value): # <<<<<<<<<<<<<< + * cdef int array[128] + * cdef void *tmp = NULL +*/ + +static PyObject *__pyx_memoryview_setitem_slice_assign_scalar(struct __pyx_memoryview_obj *__pyx_v_self, struct __pyx_memoryview_obj *__pyx_v_dst, PyObject *__pyx_v_value) { + int __pyx_v_array[128]; + void *__pyx_v_tmp; + void *__pyx_v_item; + __Pyx_memviewslice *__pyx_v_dst_slice; + __Pyx_memviewslice __pyx_v_tmp_slice; + PyObject *__pyx_r = NULL; + __Pyx_RefNannyDeclarations + __Pyx_memviewslice *__pyx_t_1; + int __pyx_t_2; + PyObject *__pyx_t_3 = NULL; + int __pyx_t_4; + int __pyx_t_5; + char const *__pyx_t_6; + PyObject *__pyx_t_7 = NULL; + PyObject *__pyx_t_8 = NULL; + PyObject *__pyx_t_9 = NULL; + PyObject *__pyx_t_10 = NULL; + PyObject *__pyx_t_11 = NULL; + PyObject *__pyx_t_12 = NULL; + int __pyx_lineno = 0; + const char *__pyx_filename = NULL; + int __pyx_clineno = 0; + __Pyx_RefNannySetupContext("setitem_slice_assign_scalar", 0); + + /* "View.MemoryView":456 + * cdef setitem_slice_assign_scalar(self, memoryview dst, value): + * cdef int array[128] + * cdef void *tmp = NULL # <<<<<<<<<<<<<< + * cdef void *item + * +*/ + __pyx_v_tmp = NULL; + + /* "View.MemoryView":461 + * cdef __Pyx_memviewslice *dst_slice + * cdef __Pyx_memviewslice tmp_slice + * dst_slice = get_slice_from_memview(dst, &tmp_slice) # <<<<<<<<<<<<<< + * + * if self.view.itemsize > sizeof(array): +*/ + __pyx_t_1 = __pyx_memoryview_get_slice_from_memoryview(__pyx_v_dst, (&__pyx_v_tmp_slice)); if (unlikely(__pyx_t_1 == ((void *)NULL))) __PYX_ERR(1, 461, __pyx_L1_error) + __pyx_v_dst_slice = __pyx_t_1; + + /* "View.MemoryView":463 + * dst_slice = get_slice_from_memview(dst, &tmp_slice) + * + * if self.view.itemsize > sizeof(array): # <<<<<<<<<<<<<< + * tmp = PyMem_Malloc(self.view.itemsize) + * if tmp == NULL: +*/ + __pyx_t_2 = (((size_t)__pyx_v_self->view.itemsize) > (sizeof(__pyx_v_array))); + if (__pyx_t_2) { + + /* "View.MemoryView":464 + * + * if self.view.itemsize > sizeof(array): + * tmp = PyMem_Malloc(self.view.itemsize) # <<<<<<<<<<<<<< + * if tmp == NULL: + * raise MemoryError +*/ + __pyx_v_tmp = PyMem_Malloc(__pyx_v_self->view.itemsize); + + /* "View.MemoryView":465 + * if self.view.itemsize > sizeof(array): + * tmp = PyMem_Malloc(self.view.itemsize) + * if tmp == NULL: # <<<<<<<<<<<<<< + * raise MemoryError + * item = tmp +*/ + __pyx_t_2 = (__pyx_v_tmp == NULL); + if (unlikely(__pyx_t_2)) { + + /* "View.MemoryView":466 + * tmp = PyMem_Malloc(self.view.itemsize) + * if tmp == NULL: + * raise MemoryError # <<<<<<<<<<<<<< + * item = tmp + * else: +*/ + PyErr_NoMemory(); __PYX_ERR(1, 466, __pyx_L1_error) + + /* "View.MemoryView":465 + * if self.view.itemsize > sizeof(array): + * tmp = PyMem_Malloc(self.view.itemsize) + * if tmp == NULL: # <<<<<<<<<<<<<< + * raise MemoryError + * item = tmp +*/ + } + + /* "View.MemoryView":467 + * if tmp == NULL: + * raise MemoryError + * item = tmp # <<<<<<<<<<<<<< + * else: + * item = array +*/ + __pyx_v_item = __pyx_v_tmp; + + /* "View.MemoryView":463 + * dst_slice = get_slice_from_memview(dst, &tmp_slice) + * + * if self.view.itemsize > sizeof(array): # <<<<<<<<<<<<<< + * tmp = PyMem_Malloc(self.view.itemsize) + * if tmp == NULL: +*/ + goto __pyx_L3; + } + + /* "View.MemoryView":469 + * item = tmp + * else: + * item = array # <<<<<<<<<<<<<< + * + * try: +*/ + /*else*/ { + __pyx_v_item = ((void *)__pyx_v_array); + } + __pyx_L3:; + + /* "View.MemoryView":471 + * item = array + * + * try: # <<<<<<<<<<<<<< + * if self.dtype_is_object: + * ( item)[0] = value +*/ + /*try:*/ { + + /* "View.MemoryView":472 + * + * try: + * if self.dtype_is_object: # <<<<<<<<<<<<<< + * ( item)[0] = value + * else: +*/ + if (__pyx_v_self->dtype_is_object) { + + /* "View.MemoryView":473 + * try: + * if self.dtype_is_object: + * ( item)[0] = value # <<<<<<<<<<<<<< + * else: + * self.assign_item_from_object( item, value) +*/ + (((PyObject **)__pyx_v_item)[0]) = ((PyObject *)__pyx_v_value); + + /* "View.MemoryView":472 + * + * try: + * if self.dtype_is_object: # <<<<<<<<<<<<<< + * ( item)[0] = value + * else: +*/ + goto __pyx_L8; + } + + /* "View.MemoryView":475 + * ( item)[0] = value + * else: + * self.assign_item_from_object( item, value) # <<<<<<<<<<<<<< + * + * +*/ + /*else*/ { + __pyx_t_3 = ((struct __pyx_vtabstruct_memoryview *)__pyx_v_self->__pyx_vtab)->assign_item_from_object(__pyx_v_self, ((char *)__pyx_v_item), __pyx_v_value); if (unlikely(!__pyx_t_3)) __PYX_ERR(1, 475, __pyx_L6_error) + __Pyx_GOTREF(__pyx_t_3); + __Pyx_DECREF(__pyx_t_3); __pyx_t_3 = 0; + } + __pyx_L8:; + + /* "View.MemoryView":479 + * + * + * if self.view.suboffsets != NULL: # <<<<<<<<<<<<<< + * assert_direct_dimensions(self.view.suboffsets, self.view.ndim) + * slice_assign_scalar(dst_slice, dst.view.ndim, self.view.itemsize, +*/ + __pyx_t_2 = (__pyx_v_self->view.suboffsets != NULL); + if (__pyx_t_2) { + + /* "View.MemoryView":480 + * + * if self.view.suboffsets != NULL: + * assert_direct_dimensions(self.view.suboffsets, self.view.ndim) # <<<<<<<<<<<<<< + * slice_assign_scalar(dst_slice, dst.view.ndim, self.view.itemsize, + * item, self.dtype_is_object) +*/ + __pyx_t_4 = assert_direct_dimensions(__pyx_v_self->view.suboffsets, __pyx_v_self->view.ndim); if (unlikely(__pyx_t_4 == ((int)-1))) __PYX_ERR(1, 480, __pyx_L6_error) + + /* "View.MemoryView":479 + * + * + * if self.view.suboffsets != NULL: # <<<<<<<<<<<<<< + * assert_direct_dimensions(self.view.suboffsets, self.view.ndim) + * slice_assign_scalar(dst_slice, dst.view.ndim, self.view.itemsize, +*/ + } + + /* "View.MemoryView":481 + * if self.view.suboffsets != NULL: + * assert_direct_dimensions(self.view.suboffsets, self.view.ndim) + * slice_assign_scalar(dst_slice, dst.view.ndim, self.view.itemsize, # <<<<<<<<<<<<<< + * item, self.dtype_is_object) + * finally: +*/ + __pyx_memoryview_slice_assign_scalar(__pyx_v_dst_slice, __pyx_v_dst->view.ndim, __pyx_v_self->view.itemsize, __pyx_v_item, __pyx_v_self->dtype_is_object); + } + + /* "View.MemoryView":484 + * item, self.dtype_is_object) + * finally: + * PyMem_Free(tmp) # <<<<<<<<<<<<<< + * + * cdef setitem_indexed(self, index, value): +*/ + /*finally:*/ { + /*normal exit:*/{ + PyMem_Free(__pyx_v_tmp); + goto __pyx_L7; + } + __pyx_L6_error:; + /*exception exit:*/{ + __Pyx_PyThreadState_declare + __Pyx_PyThreadState_assign + __pyx_t_7 = 0; __pyx_t_8 = 0; __pyx_t_9 = 0; __pyx_t_10 = 0; __pyx_t_11 = 0; __pyx_t_12 = 0; + __Pyx_XDECREF(__pyx_t_3); __pyx_t_3 = 0; + __Pyx_ExceptionSwap(&__pyx_t_10, &__pyx_t_11, &__pyx_t_12); + if ( unlikely(__Pyx_GetException(&__pyx_t_7, &__pyx_t_8, &__pyx_t_9) < 0)) __Pyx_ErrFetch(&__pyx_t_7, &__pyx_t_8, &__pyx_t_9); + __Pyx_XGOTREF(__pyx_t_7); + __Pyx_XGOTREF(__pyx_t_8); + __Pyx_XGOTREF(__pyx_t_9); + __Pyx_XGOTREF(__pyx_t_10); + __Pyx_XGOTREF(__pyx_t_11); + __Pyx_XGOTREF(__pyx_t_12); + __pyx_t_4 = __pyx_lineno; __pyx_t_5 = __pyx_clineno; __pyx_t_6 = __pyx_filename; + { + PyMem_Free(__pyx_v_tmp); + } + __Pyx_XGIVEREF(__pyx_t_10); + __Pyx_XGIVEREF(__pyx_t_11); + __Pyx_XGIVEREF(__pyx_t_12); + __Pyx_ExceptionReset(__pyx_t_10, __pyx_t_11, __pyx_t_12); + __Pyx_XGIVEREF(__pyx_t_7); + __Pyx_XGIVEREF(__pyx_t_8); + __Pyx_XGIVEREF(__pyx_t_9); + __Pyx_ErrRestore(__pyx_t_7, __pyx_t_8, __pyx_t_9); + __pyx_t_7 = 0; __pyx_t_8 = 0; __pyx_t_9 = 0; __pyx_t_10 = 0; __pyx_t_11 = 0; __pyx_t_12 = 0; + __pyx_lineno = __pyx_t_4; __pyx_clineno = __pyx_t_5; __pyx_filename = __pyx_t_6; + goto __pyx_L1_error; + } + __pyx_L7:; + } + + /* "View.MemoryView":454 + * memoryview_copy_contents(msrc, mdst, src.ndim, dst.ndim, self.dtype_is_object) + * + * cdef setitem_slice_assign_scalar(self, memoryview dst, value): # <<<<<<<<<<<<<< + * cdef int array[128] + * cdef void *tmp = NULL +*/ + + /* function exit code */ + __pyx_r = Py_None; __Pyx_INCREF(Py_None); + goto __pyx_L0; + __pyx_L1_error:; + __Pyx_XDECREF(__pyx_t_3); + __Pyx_AddTraceback("View.MemoryView.memoryview.setitem_slice_assign_scalar", __pyx_clineno, __pyx_lineno, __pyx_filename); + __pyx_r = 0; + __pyx_L0:; + __Pyx_XGIVEREF(__pyx_r); + __Pyx_RefNannyFinishContext(); + return __pyx_r; +} + +/* "View.MemoryView":486 + * PyMem_Free(tmp) + * + * cdef setitem_indexed(self, index, value): # <<<<<<<<<<<<<< + * cdef char *itemp = self.get_item_pointer(index) + * self.assign_item_from_object(itemp, value) +*/ + +static PyObject *__pyx_memoryview_setitem_indexed(struct __pyx_memoryview_obj *__pyx_v_self, PyObject *__pyx_v_index, PyObject *__pyx_v_value) { + char *__pyx_v_itemp; + PyObject *__pyx_r = NULL; + __Pyx_RefNannyDeclarations + char *__pyx_t_1; + PyObject *__pyx_t_2 = NULL; + int __pyx_lineno = 0; + const char *__pyx_filename = NULL; + int __pyx_clineno = 0; + __Pyx_RefNannySetupContext("setitem_indexed", 0); + + /* "View.MemoryView":487 + * + * cdef setitem_indexed(self, index, value): + * cdef char *itemp = self.get_item_pointer(index) # <<<<<<<<<<<<<< + * self.assign_item_from_object(itemp, value) + * +*/ + __pyx_t_1 = ((struct __pyx_vtabstruct_memoryview *)__pyx_v_self->__pyx_vtab)->get_item_pointer(__pyx_v_self, __pyx_v_index); if (unlikely(__pyx_t_1 == ((void *)NULL))) __PYX_ERR(1, 487, __pyx_L1_error) + __pyx_v_itemp = __pyx_t_1; + + /* "View.MemoryView":488 + * cdef setitem_indexed(self, index, value): + * cdef char *itemp = self.get_item_pointer(index) + * self.assign_item_from_object(itemp, value) # <<<<<<<<<<<<<< + * + * cdef convert_item_to_object(self, char *itemp): +*/ + __pyx_t_2 = ((struct __pyx_vtabstruct_memoryview *)__pyx_v_self->__pyx_vtab)->assign_item_from_object(__pyx_v_self, __pyx_v_itemp, __pyx_v_value); if (unlikely(!__pyx_t_2)) __PYX_ERR(1, 488, __pyx_L1_error) + __Pyx_GOTREF(__pyx_t_2); + __Pyx_DECREF(__pyx_t_2); __pyx_t_2 = 0; + + /* "View.MemoryView":486 + * PyMem_Free(tmp) + * + * cdef setitem_indexed(self, index, value): # <<<<<<<<<<<<<< + * cdef char *itemp = self.get_item_pointer(index) + * self.assign_item_from_object(itemp, value) +*/ + + /* function exit code */ + __pyx_r = Py_None; __Pyx_INCREF(Py_None); + goto __pyx_L0; + __pyx_L1_error:; + __Pyx_XDECREF(__pyx_t_2); + __Pyx_AddTraceback("View.MemoryView.memoryview.setitem_indexed", __pyx_clineno, __pyx_lineno, __pyx_filename); + __pyx_r = 0; + __pyx_L0:; + __Pyx_XGIVEREF(__pyx_r); + __Pyx_RefNannyFinishContext(); + return __pyx_r; +} + +/* "View.MemoryView":490 + * self.assign_item_from_object(itemp, value) + * + * cdef convert_item_to_object(self, char *itemp): # <<<<<<<<<<<<<< + * """Only used if instantiated manually by the user, or if Cython doesn't + * know how to convert the type""" +*/ + +static PyObject *__pyx_memoryview_convert_item_to_object(struct __pyx_memoryview_obj *__pyx_v_self, char *__pyx_v_itemp) { + PyObject *__pyx_v_struct = NULL; + PyObject *__pyx_v_bytesitem = 0; + PyObject *__pyx_v_result = NULL; + PyObject *__pyx_r = NULL; + __Pyx_RefNannyDeclarations + PyObject *__pyx_t_1 = NULL; + PyObject *__pyx_t_2 = NULL; + PyObject *__pyx_t_3 = NULL; + PyObject *__pyx_t_4 = NULL; + PyObject *__pyx_t_5 = NULL; + PyObject *__pyx_t_6 = NULL; + size_t __pyx_t_7; + Py_ssize_t __pyx_t_8; + int __pyx_t_9; + PyObject *__pyx_t_10 = NULL; + int __pyx_t_11; + int __pyx_lineno = 0; + const char *__pyx_filename = NULL; + int __pyx_clineno = 0; + __Pyx_RefNannySetupContext("convert_item_to_object", 0); + + /* "View.MemoryView":493 + * """Only used if instantiated manually by the user, or if Cython doesn't + * know how to convert the type""" + * import struct # <<<<<<<<<<<<<< + * cdef bytes bytesitem + * +*/ + __pyx_t_2 = __Pyx_Import(__pyx_mstate_global->__pyx_n_u_struct, 0, 0, NULL, 0); if (unlikely(!__pyx_t_2)) __PYX_ERR(1, 493, __pyx_L1_error) + __pyx_t_1 = __pyx_t_2; + __Pyx_GOTREF(__pyx_t_1); + __pyx_v_struct = __pyx_t_1; + __pyx_t_1 = 0; + + /* "View.MemoryView":496 + * cdef bytes bytesitem + * + * bytesitem = itemp[:self.view.itemsize] # <<<<<<<<<<<<<< + * try: + * result = struct.unpack(self.view.format, bytesitem) +*/ + __pyx_t_1 = __Pyx_PyBytes_FromStringAndSize(__pyx_v_itemp + 0, __pyx_v_self->view.itemsize - 0); if (unlikely(!__pyx_t_1)) __PYX_ERR(1, 496, __pyx_L1_error) + __Pyx_GOTREF(__pyx_t_1); + __pyx_v_bytesitem = ((PyObject*)__pyx_t_1); + __pyx_t_1 = 0; + + /* "View.MemoryView":497 + * + * bytesitem = itemp[:self.view.itemsize] + * try: # <<<<<<<<<<<<<< + * result = struct.unpack(self.view.format, bytesitem) + * except struct.error: +*/ + { + __Pyx_PyThreadState_declare + __Pyx_PyThreadState_assign + __Pyx_ExceptionSave(&__pyx_t_2, &__pyx_t_3, &__pyx_t_4); + __Pyx_XGOTREF(__pyx_t_2); + __Pyx_XGOTREF(__pyx_t_3); + __Pyx_XGOTREF(__pyx_t_4); + /*try:*/ { + + /* "View.MemoryView":498 + * bytesitem = itemp[:self.view.itemsize] + * try: + * result = struct.unpack(self.view.format, bytesitem) # <<<<<<<<<<<<<< + * except struct.error: + * raise ValueError, "Unable to convert item to object" +*/ + __pyx_t_5 = __pyx_v_struct; + __Pyx_INCREF(__pyx_t_5); + __pyx_t_6 = __Pyx_PyBytes_FromString(__pyx_v_self->view.format); if (unlikely(!__pyx_t_6)) __PYX_ERR(1, 498, __pyx_L3_error) + __Pyx_GOTREF(__pyx_t_6); + __pyx_t_7 = 0; + { + PyObject *__pyx_callargs[3] = {__pyx_t_5, __pyx_t_6, __pyx_v_bytesitem}; + __pyx_t_1 = __Pyx_PyObject_FastCallMethod((PyObject*)__pyx_mstate_global->__pyx_n_u_unpack, __pyx_callargs+__pyx_t_7, (3-__pyx_t_7) | (1*__Pyx_PY_VECTORCALL_ARGUMENTS_OFFSET)); + __Pyx_XDECREF(__pyx_t_5); __pyx_t_5 = 0; + __Pyx_DECREF(__pyx_t_6); __pyx_t_6 = 0; + if (unlikely(!__pyx_t_1)) __PYX_ERR(1, 498, __pyx_L3_error) + __Pyx_GOTREF(__pyx_t_1); + } + __pyx_v_result = __pyx_t_1; + __pyx_t_1 = 0; + + /* "View.MemoryView":497 + * + * bytesitem = itemp[:self.view.itemsize] + * try: # <<<<<<<<<<<<<< + * result = struct.unpack(self.view.format, bytesitem) + * except struct.error: +*/ + } + + /* "View.MemoryView":502 + * raise ValueError, "Unable to convert item to object" + * else: + * if len(self.view.format) == 1: # <<<<<<<<<<<<<< + * return result[0] + * return result +*/ + /*else:*/ { + __pyx_t_8 = __Pyx_ssize_strlen(__pyx_v_self->view.format); if (unlikely(__pyx_t_8 == ((Py_ssize_t)-1))) __PYX_ERR(1, 502, __pyx_L5_except_error) + __pyx_t_9 = (__pyx_t_8 == 1); + if (__pyx_t_9) { + + /* "View.MemoryView":503 + * else: + * if len(self.view.format) == 1: + * return result[0] # <<<<<<<<<<<<<< + * return result + * +*/ + __Pyx_XDECREF(__pyx_r); + __pyx_t_1 = __Pyx_GetItemInt(__pyx_v_result, 0, long, 1, __Pyx_PyLong_From_long, 0, 0, 1, 1, __Pyx_ReferenceSharing_OwnStrongReference); if (unlikely(!__pyx_t_1)) __PYX_ERR(1, 503, __pyx_L5_except_error) + __Pyx_GOTREF(__pyx_t_1); + __pyx_r = __pyx_t_1; + __pyx_t_1 = 0; + goto __pyx_L6_except_return; + + /* "View.MemoryView":502 + * raise ValueError, "Unable to convert item to object" + * else: + * if len(self.view.format) == 1: # <<<<<<<<<<<<<< + * return result[0] + * return result +*/ + } + + /* "View.MemoryView":504 + * if len(self.view.format) == 1: + * return result[0] + * return result # <<<<<<<<<<<<<< + * + * cdef assign_item_from_object(self, char *itemp, object value): +*/ + __Pyx_XDECREF(__pyx_r); + __Pyx_INCREF(__pyx_v_result); + __pyx_r = __pyx_v_result; + goto __pyx_L6_except_return; + } + __pyx_L3_error:; + __Pyx_XDECREF(__pyx_t_1); __pyx_t_1 = 0; + __Pyx_XDECREF(__pyx_t_5); __pyx_t_5 = 0; + __Pyx_XDECREF(__pyx_t_6); __pyx_t_6 = 0; + + /* "View.MemoryView":499 + * try: + * result = struct.unpack(self.view.format, bytesitem) + * except struct.error: # <<<<<<<<<<<<<< + * raise ValueError, "Unable to convert item to object" + * else: +*/ + __Pyx_ErrFetch(&__pyx_t_1, &__pyx_t_6, &__pyx_t_5); + __pyx_t_10 = __Pyx_PyObject_GetAttrStr(__pyx_v_struct, __pyx_mstate_global->__pyx_n_u_error); if (unlikely(!__pyx_t_10)) __PYX_ERR(1, 499, __pyx_L5_except_error) + __Pyx_GOTREF(__pyx_t_10); + __pyx_t_11 = __Pyx_PyErr_GivenExceptionMatches(__pyx_t_1, __pyx_t_10); + __Pyx_DECREF(__pyx_t_10); __pyx_t_10 = 0; + __Pyx_ErrRestore(__pyx_t_1, __pyx_t_6, __pyx_t_5); + __pyx_t_1 = 0; __pyx_t_6 = 0; __pyx_t_5 = 0; + if (__pyx_t_11) { + __Pyx_AddTraceback("View.MemoryView.memoryview.convert_item_to_object", __pyx_clineno, __pyx_lineno, __pyx_filename); + if (__Pyx_GetException(&__pyx_t_5, &__pyx_t_6, &__pyx_t_1) < 0) __PYX_ERR(1, 499, __pyx_L5_except_error) + __Pyx_XGOTREF(__pyx_t_5); + __Pyx_XGOTREF(__pyx_t_6); + __Pyx_XGOTREF(__pyx_t_1); + + /* "View.MemoryView":500 + * result = struct.unpack(self.view.format, bytesitem) + * except struct.error: + * raise ValueError, "Unable to convert item to object" # <<<<<<<<<<<<<< + * else: + * if len(self.view.format) == 1: +*/ + __Pyx_Raise(((PyObject *)(((PyTypeObject*)PyExc_ValueError))), __pyx_mstate_global->__pyx_kp_u_Unable_to_convert_item_to_object, 0, 0); + __PYX_ERR(1, 500, __pyx_L5_except_error) + } + goto __pyx_L5_except_error; + + /* "View.MemoryView":497 + * + * bytesitem = itemp[:self.view.itemsize] + * try: # <<<<<<<<<<<<<< + * result = struct.unpack(self.view.format, bytesitem) + * except struct.error: +*/ + __pyx_L5_except_error:; + __Pyx_XGIVEREF(__pyx_t_2); + __Pyx_XGIVEREF(__pyx_t_3); + __Pyx_XGIVEREF(__pyx_t_4); + __Pyx_ExceptionReset(__pyx_t_2, __pyx_t_3, __pyx_t_4); + goto __pyx_L1_error; + __pyx_L6_except_return:; + __Pyx_XGIVEREF(__pyx_t_2); + __Pyx_XGIVEREF(__pyx_t_3); + __Pyx_XGIVEREF(__pyx_t_4); + __Pyx_ExceptionReset(__pyx_t_2, __pyx_t_3, __pyx_t_4); + goto __pyx_L0; + } + + /* "View.MemoryView":490 + * self.assign_item_from_object(itemp, value) + * + * cdef convert_item_to_object(self, char *itemp): # <<<<<<<<<<<<<< + * """Only used if instantiated manually by the user, or if Cython doesn't + * know how to convert the type""" +*/ + + /* function exit code */ + __pyx_L1_error:; + __Pyx_XDECREF(__pyx_t_1); + __Pyx_XDECREF(__pyx_t_5); + __Pyx_XDECREF(__pyx_t_6); + __Pyx_XDECREF(__pyx_t_10); + __Pyx_AddTraceback("View.MemoryView.memoryview.convert_item_to_object", __pyx_clineno, __pyx_lineno, __pyx_filename); + __pyx_r = 0; + __pyx_L0:; + __Pyx_XDECREF(__pyx_v_struct); + __Pyx_XDECREF(__pyx_v_bytesitem); + __Pyx_XDECREF(__pyx_v_result); + __Pyx_XGIVEREF(__pyx_r); + __Pyx_RefNannyFinishContext(); + return __pyx_r; +} + +/* "View.MemoryView":506 + * return result + * + * cdef assign_item_from_object(self, char *itemp, object value): # <<<<<<<<<<<<<< + * """Only used if instantiated manually by the user, or if Cython doesn't + * know how to convert the type""" +*/ + +static PyObject *__pyx_memoryview_assign_item_from_object(struct __pyx_memoryview_obj *__pyx_v_self, char *__pyx_v_itemp, PyObject *__pyx_v_value) { + PyObject *__pyx_v_struct = NULL; + char __pyx_v_c; + PyObject *__pyx_v_bytesvalue = 0; + Py_ssize_t __pyx_v_i; + PyObject *__pyx_r = NULL; + __Pyx_RefNannyDeclarations + PyObject *__pyx_t_1 = NULL; + PyObject *__pyx_t_2 = NULL; + int __pyx_t_3; + PyObject *__pyx_t_4 = NULL; + PyObject *__pyx_t_5 = NULL; + PyObject *__pyx_t_6 = NULL; + size_t __pyx_t_7; + Py_ssize_t __pyx_t_8; + PyObject *__pyx_t_9 = NULL; + char *__pyx_t_10; + char *__pyx_t_11; + Py_ssize_t __pyx_t_12; + char *__pyx_t_13; + char *__pyx_t_14; + int __pyx_lineno = 0; + const char *__pyx_filename = NULL; + int __pyx_clineno = 0; + __Pyx_RefNannySetupContext("assign_item_from_object", 0); + + /* "View.MemoryView":509 + * """Only used if instantiated manually by the user, or if Cython doesn't + * know how to convert the type""" + * import struct # <<<<<<<<<<<<<< + * cdef char c + * cdef bytes bytesvalue +*/ + __pyx_t_2 = __Pyx_Import(__pyx_mstate_global->__pyx_n_u_struct, 0, 0, NULL, 0); if (unlikely(!__pyx_t_2)) __PYX_ERR(1, 509, __pyx_L1_error) + __pyx_t_1 = __pyx_t_2; + __Pyx_GOTREF(__pyx_t_1); + __pyx_v_struct = __pyx_t_1; + __pyx_t_1 = 0; + + /* "View.MemoryView":514 + * cdef Py_ssize_t i + * + * if isinstance(value, tuple): # <<<<<<<<<<<<<< + * bytesvalue = struct.pack(self.view.format, *value) + * else: +*/ + __pyx_t_3 = PyTuple_Check(__pyx_v_value); + if (__pyx_t_3) { + + /* "View.MemoryView":515 + * + * if isinstance(value, tuple): + * bytesvalue = struct.pack(self.view.format, *value) # <<<<<<<<<<<<<< + * else: + * bytesvalue = struct.pack(self.view.format, value) +*/ + __pyx_t_1 = __Pyx_PyObject_GetAttrStr(__pyx_v_struct, __pyx_mstate_global->__pyx_n_u_pack); if (unlikely(!__pyx_t_1)) __PYX_ERR(1, 515, __pyx_L1_error) + __Pyx_GOTREF(__pyx_t_1); + __pyx_t_4 = __Pyx_PyBytes_FromString(__pyx_v_self->view.format); if (unlikely(!__pyx_t_4)) __PYX_ERR(1, 515, __pyx_L1_error) + __Pyx_GOTREF(__pyx_t_4); + __pyx_t_5 = PyTuple_New(1); if (unlikely(!__pyx_t_5)) __PYX_ERR(1, 515, __pyx_L1_error) + __Pyx_GOTREF(__pyx_t_5); + __Pyx_GIVEREF(__pyx_t_4); + if (__Pyx_PyTuple_SET_ITEM(__pyx_t_5, 0, __pyx_t_4) != (0)) __PYX_ERR(1, 515, __pyx_L1_error); + __pyx_t_4 = 0; + __pyx_t_4 = __Pyx_PySequence_Tuple(__pyx_v_value); if (unlikely(!__pyx_t_4)) __PYX_ERR(1, 515, __pyx_L1_error) + __Pyx_GOTREF(__pyx_t_4); + __pyx_t_6 = PyNumber_Add(__pyx_t_5, __pyx_t_4); if (unlikely(!__pyx_t_6)) __PYX_ERR(1, 515, __pyx_L1_error) + __Pyx_GOTREF(__pyx_t_6); + __Pyx_DECREF(__pyx_t_5); __pyx_t_5 = 0; + __Pyx_DECREF(__pyx_t_4); __pyx_t_4 = 0; + __pyx_t_4 = __Pyx_PyObject_Call(__pyx_t_1, __pyx_t_6, NULL); if (unlikely(!__pyx_t_4)) __PYX_ERR(1, 515, __pyx_L1_error) + __Pyx_GOTREF(__pyx_t_4); + __Pyx_DECREF(__pyx_t_1); __pyx_t_1 = 0; + __Pyx_DECREF(__pyx_t_6); __pyx_t_6 = 0; + if (!(likely(PyBytes_CheckExact(__pyx_t_4))||((__pyx_t_4) == Py_None) || __Pyx_RaiseUnexpectedTypeError("bytes", __pyx_t_4))) __PYX_ERR(1, 515, __pyx_L1_error) + __pyx_v_bytesvalue = ((PyObject*)__pyx_t_4); + __pyx_t_4 = 0; + + /* "View.MemoryView":514 + * cdef Py_ssize_t i + * + * if isinstance(value, tuple): # <<<<<<<<<<<<<< + * bytesvalue = struct.pack(self.view.format, *value) + * else: +*/ + goto __pyx_L3; + } + + /* "View.MemoryView":517 + * bytesvalue = struct.pack(self.view.format, *value) + * else: + * bytesvalue = struct.pack(self.view.format, value) # <<<<<<<<<<<<<< + * + * for i, c in enumerate(bytesvalue): +*/ + /*else*/ { + __pyx_t_6 = __pyx_v_struct; + __Pyx_INCREF(__pyx_t_6); + __pyx_t_1 = __Pyx_PyBytes_FromString(__pyx_v_self->view.format); if (unlikely(!__pyx_t_1)) __PYX_ERR(1, 517, __pyx_L1_error) + __Pyx_GOTREF(__pyx_t_1); + __pyx_t_7 = 0; + { + PyObject *__pyx_callargs[3] = {__pyx_t_6, __pyx_t_1, __pyx_v_value}; + __pyx_t_4 = __Pyx_PyObject_FastCallMethod((PyObject*)__pyx_mstate_global->__pyx_n_u_pack, __pyx_callargs+__pyx_t_7, (3-__pyx_t_7) | (1*__Pyx_PY_VECTORCALL_ARGUMENTS_OFFSET)); + __Pyx_XDECREF(__pyx_t_6); __pyx_t_6 = 0; + __Pyx_DECREF(__pyx_t_1); __pyx_t_1 = 0; + if (unlikely(!__pyx_t_4)) __PYX_ERR(1, 517, __pyx_L1_error) + __Pyx_GOTREF(__pyx_t_4); + } + if (!(likely(PyBytes_CheckExact(__pyx_t_4))||((__pyx_t_4) == Py_None) || __Pyx_RaiseUnexpectedTypeError("bytes", __pyx_t_4))) __PYX_ERR(1, 517, __pyx_L1_error) + __pyx_v_bytesvalue = ((PyObject*)__pyx_t_4); + __pyx_t_4 = 0; + } + __pyx_L3:; + + /* "View.MemoryView":519 + * bytesvalue = struct.pack(self.view.format, value) + * + * for i, c in enumerate(bytesvalue): # <<<<<<<<<<<<<< + * itemp[i] = c + * +*/ + __pyx_t_8 = 0; + if (unlikely(__pyx_v_bytesvalue == Py_None)) { + PyErr_SetString(PyExc_TypeError, "'NoneType' is not iterable"); + __PYX_ERR(1, 519, __pyx_L1_error) + } + __Pyx_INCREF(__pyx_v_bytesvalue); + __pyx_t_9 = __pyx_v_bytesvalue; + __pyx_t_11 = __Pyx_PyBytes_AsWritableString(__pyx_t_9); if (unlikely(__pyx_t_11 == ((char *)NULL))) __PYX_ERR(1, 519, __pyx_L1_error) + __pyx_t_12 = __Pyx_PyBytes_GET_SIZE(__pyx_t_9); if (unlikely(__pyx_t_12 == ((Py_ssize_t)-1))) __PYX_ERR(1, 519, __pyx_L1_error) + __pyx_t_13 = (__pyx_t_11 + __pyx_t_12); + for (__pyx_t_14 = __pyx_t_11; __pyx_t_14 < __pyx_t_13; __pyx_t_14++) { + __pyx_t_10 = __pyx_t_14; + __pyx_v_c = (__pyx_t_10[0]); + + /* "View.MemoryView":520 + * + * for i, c in enumerate(bytesvalue): + * itemp[i] = c # <<<<<<<<<<<<<< + * + * @cname('getbuffer') +*/ + __pyx_v_i = __pyx_t_8; + + /* "View.MemoryView":519 + * bytesvalue = struct.pack(self.view.format, value) + * + * for i, c in enumerate(bytesvalue): # <<<<<<<<<<<<<< + * itemp[i] = c + * +*/ + __pyx_t_8 = (__pyx_t_8 + 1); + + /* "View.MemoryView":520 + * + * for i, c in enumerate(bytesvalue): + * itemp[i] = c # <<<<<<<<<<<<<< + * + * @cname('getbuffer') +*/ + (__pyx_v_itemp[__pyx_v_i]) = __pyx_v_c; + } + __Pyx_DECREF(__pyx_t_9); __pyx_t_9 = 0; + + /* "View.MemoryView":506 + * return result + * + * cdef assign_item_from_object(self, char *itemp, object value): # <<<<<<<<<<<<<< + * """Only used if instantiated manually by the user, or if Cython doesn't + * know how to convert the 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_4); + __Pyx_XDECREF(__pyx_t_5); + __Pyx_XDECREF(__pyx_t_6); + __Pyx_XDECREF(__pyx_t_9); + __Pyx_AddTraceback("View.MemoryView.memoryview.assign_item_from_object", __pyx_clineno, __pyx_lineno, __pyx_filename); + __pyx_r = 0; + __pyx_L0:; + __Pyx_XDECREF(__pyx_v_struct); + __Pyx_XDECREF(__pyx_v_bytesvalue); + __Pyx_XGIVEREF(__pyx_r); + __Pyx_RefNannyFinishContext(); + return __pyx_r; +} + +/* "View.MemoryView":522 + * itemp[i] = c + * + * @cname('getbuffer') # <<<<<<<<<<<<<< + * def __getbuffer__(self, Py_buffer *info, int flags): + * if flags & PyBUF_WRITABLE and self.view.readonly: +*/ + +/* Python wrapper */ +CYTHON_UNUSED static int __pyx_memoryview_getbuffer(PyObject *__pyx_v_self, Py_buffer *__pyx_v_info, int __pyx_v_flags); /*proto*/ +CYTHON_UNUSED static int __pyx_memoryview_getbuffer(PyObject *__pyx_v_self, Py_buffer *__pyx_v_info, int __pyx_v_flags) { + CYTHON_UNUSED PyObject *const *__pyx_kwvalues; + int __pyx_r; + __Pyx_RefNannyDeclarations + __Pyx_RefNannySetupContext("__getbuffer__ (wrapper)", 0); + __pyx_kwvalues = __Pyx_KwValues_VARARGS(__pyx_args, __pyx_nargs); + __pyx_r = __pyx_memoryview___pyx_pf_15View_dot_MemoryView_10memoryview_8__getbuffer__(((struct __pyx_memoryview_obj *)__pyx_v_self), ((Py_buffer *)__pyx_v_info), ((int)__pyx_v_flags)); + + /* function exit code */ + __Pyx_RefNannyFinishContext(); + return __pyx_r; +} + +static int __pyx_memoryview___pyx_pf_15View_dot_MemoryView_10memoryview_8__getbuffer__(struct __pyx_memoryview_obj *__pyx_v_self, Py_buffer *__pyx_v_info, int __pyx_v_flags) { + int __pyx_r; + __Pyx_RefNannyDeclarations + int __pyx_t_1; + int __pyx_t_2; + Py_ssize_t *__pyx_t_3; + char *__pyx_t_4; + void *__pyx_t_5; + int __pyx_t_6; + Py_ssize_t __pyx_t_7; + int __pyx_lineno = 0; + const char *__pyx_filename = NULL; + int __pyx_clineno = 0; + if (unlikely(__pyx_v_info == NULL)) { + PyErr_SetString(PyExc_BufferError, "PyObject_GetBuffer: view==NULL argument is obsolete"); + return -1; + } + __Pyx_RefNannySetupContext("__getbuffer__", 0); + __pyx_v_info->obj = Py_None; __Pyx_INCREF(Py_None); + __Pyx_GIVEREF(__pyx_v_info->obj); + + /* "View.MemoryView":524 + * @cname('getbuffer') + * def __getbuffer__(self, Py_buffer *info, int flags): + * if flags & PyBUF_WRITABLE and self.view.readonly: # <<<<<<<<<<<<<< + * raise ValueError, "Cannot create writable memory view from read-only memoryview" + * +*/ + __pyx_t_2 = ((__pyx_v_flags & PyBUF_WRITABLE) != 0); + if (__pyx_t_2) { + } else { + __pyx_t_1 = __pyx_t_2; + goto __pyx_L4_bool_binop_done; + } + __pyx_t_1 = __pyx_v_self->view.readonly; + __pyx_L4_bool_binop_done:; + if (unlikely(__pyx_t_1)) { + + /* "View.MemoryView":525 + * def __getbuffer__(self, Py_buffer *info, int flags): + * if flags & PyBUF_WRITABLE and self.view.readonly: + * raise ValueError, "Cannot create writable memory view from read-only memoryview" # <<<<<<<<<<<<<< + * + * if flags & PyBUF_ND: +*/ + __Pyx_Raise(((PyObject *)(((PyTypeObject*)PyExc_ValueError))), __pyx_mstate_global->__pyx_kp_u_Cannot_create_writable_memory_vi, 0, 0); + __PYX_ERR(1, 525, __pyx_L1_error) + + /* "View.MemoryView":524 + * @cname('getbuffer') + * def __getbuffer__(self, Py_buffer *info, int flags): + * if flags & PyBUF_WRITABLE and self.view.readonly: # <<<<<<<<<<<<<< + * raise ValueError, "Cannot create writable memory view from read-only memoryview" + * +*/ + } + + /* "View.MemoryView":527 + * raise ValueError, "Cannot create writable memory view from read-only memoryview" + * + * if flags & PyBUF_ND: # <<<<<<<<<<<<<< + * info.shape = self.view.shape + * else: +*/ + __pyx_t_1 = ((__pyx_v_flags & PyBUF_ND) != 0); + if (__pyx_t_1) { + + /* "View.MemoryView":528 + * + * if flags & PyBUF_ND: + * info.shape = self.view.shape # <<<<<<<<<<<<<< + * else: + * info.shape = NULL +*/ + __pyx_t_3 = __pyx_v_self->view.shape; + __pyx_v_info->shape = __pyx_t_3; + + /* "View.MemoryView":527 + * raise ValueError, "Cannot create writable memory view from read-only memoryview" + * + * if flags & PyBUF_ND: # <<<<<<<<<<<<<< + * info.shape = self.view.shape + * else: +*/ + goto __pyx_L6; + } + + /* "View.MemoryView":530 + * info.shape = self.view.shape + * else: + * info.shape = NULL # <<<<<<<<<<<<<< + * + * if flags & PyBUF_STRIDES: +*/ + /*else*/ { + __pyx_v_info->shape = NULL; + } + __pyx_L6:; + + /* "View.MemoryView":532 + * info.shape = NULL + * + * if flags & PyBUF_STRIDES: # <<<<<<<<<<<<<< + * info.strides = self.view.strides + * else: +*/ + __pyx_t_1 = ((__pyx_v_flags & PyBUF_STRIDES) != 0); + if (__pyx_t_1) { + + /* "View.MemoryView":533 + * + * if flags & PyBUF_STRIDES: + * info.strides = self.view.strides # <<<<<<<<<<<<<< + * else: + * info.strides = NULL +*/ + __pyx_t_3 = __pyx_v_self->view.strides; + __pyx_v_info->strides = __pyx_t_3; + + /* "View.MemoryView":532 + * info.shape = NULL + * + * if flags & PyBUF_STRIDES: # <<<<<<<<<<<<<< + * info.strides = self.view.strides + * else: +*/ + goto __pyx_L7; + } + + /* "View.MemoryView":535 + * info.strides = self.view.strides + * else: + * info.strides = NULL # <<<<<<<<<<<<<< + * + * if flags & PyBUF_INDIRECT: +*/ + /*else*/ { + __pyx_v_info->strides = NULL; + } + __pyx_L7:; + + /* "View.MemoryView":537 + * info.strides = NULL + * + * if flags & PyBUF_INDIRECT: # <<<<<<<<<<<<<< + * info.suboffsets = self.view.suboffsets + * else: +*/ + __pyx_t_1 = ((__pyx_v_flags & PyBUF_INDIRECT) != 0); + if (__pyx_t_1) { + + /* "View.MemoryView":538 + * + * if flags & PyBUF_INDIRECT: + * info.suboffsets = self.view.suboffsets # <<<<<<<<<<<<<< + * else: + * info.suboffsets = NULL +*/ + __pyx_t_3 = __pyx_v_self->view.suboffsets; + __pyx_v_info->suboffsets = __pyx_t_3; + + /* "View.MemoryView":537 + * info.strides = NULL + * + * if flags & PyBUF_INDIRECT: # <<<<<<<<<<<<<< + * info.suboffsets = self.view.suboffsets + * else: +*/ + goto __pyx_L8; + } + + /* "View.MemoryView":540 + * info.suboffsets = self.view.suboffsets + * else: + * info.suboffsets = NULL # <<<<<<<<<<<<<< + * + * if flags & PyBUF_FORMAT: +*/ + /*else*/ { + __pyx_v_info->suboffsets = NULL; + } + __pyx_L8:; + + /* "View.MemoryView":542 + * info.suboffsets = NULL + * + * if flags & PyBUF_FORMAT: # <<<<<<<<<<<<<< + * info.format = self.view.format + * else: +*/ + __pyx_t_1 = ((__pyx_v_flags & PyBUF_FORMAT) != 0); + if (__pyx_t_1) { + + /* "View.MemoryView":543 + * + * if flags & PyBUF_FORMAT: + * info.format = self.view.format # <<<<<<<<<<<<<< + * else: + * info.format = NULL +*/ + __pyx_t_4 = __pyx_v_self->view.format; + __pyx_v_info->format = __pyx_t_4; + + /* "View.MemoryView":542 + * info.suboffsets = NULL + * + * if flags & PyBUF_FORMAT: # <<<<<<<<<<<<<< + * info.format = self.view.format + * else: +*/ + goto __pyx_L9; + } + + /* "View.MemoryView":545 + * info.format = self.view.format + * else: + * info.format = NULL # <<<<<<<<<<<<<< + * + * info.buf = self.view.buf +*/ + /*else*/ { + __pyx_v_info->format = NULL; + } + __pyx_L9:; + + /* "View.MemoryView":547 + * info.format = NULL + * + * info.buf = self.view.buf # <<<<<<<<<<<<<< + * info.ndim = self.view.ndim + * info.itemsize = self.view.itemsize +*/ + __pyx_t_5 = __pyx_v_self->view.buf; + __pyx_v_info->buf = __pyx_t_5; + + /* "View.MemoryView":548 + * + * info.buf = self.view.buf + * info.ndim = self.view.ndim # <<<<<<<<<<<<<< + * info.itemsize = self.view.itemsize + * info.len = self.view.len +*/ + __pyx_t_6 = __pyx_v_self->view.ndim; + __pyx_v_info->ndim = __pyx_t_6; + + /* "View.MemoryView":549 + * info.buf = self.view.buf + * info.ndim = self.view.ndim + * info.itemsize = self.view.itemsize # <<<<<<<<<<<<<< + * info.len = self.view.len + * info.readonly = self.view.readonly +*/ + __pyx_t_7 = __pyx_v_self->view.itemsize; + __pyx_v_info->itemsize = __pyx_t_7; + + /* "View.MemoryView":550 + * info.ndim = self.view.ndim + * info.itemsize = self.view.itemsize + * info.len = self.view.len # <<<<<<<<<<<<<< + * info.readonly = self.view.readonly + * info.obj = self +*/ + __pyx_t_7 = __pyx_v_self->view.len; + __pyx_v_info->len = __pyx_t_7; + + /* "View.MemoryView":551 + * info.itemsize = self.view.itemsize + * info.len = self.view.len + * info.readonly = self.view.readonly # <<<<<<<<<<<<<< + * info.obj = self + * +*/ + __pyx_t_1 = __pyx_v_self->view.readonly; + __pyx_v_info->readonly = __pyx_t_1; + + /* "View.MemoryView":552 + * info.len = self.view.len + * info.readonly = self.view.readonly + * info.obj = self # <<<<<<<<<<<<<< + * + * +*/ + __Pyx_INCREF((PyObject *)__pyx_v_self); + __Pyx_GIVEREF((PyObject *)__pyx_v_self); + __Pyx_GOTREF(__pyx_v_info->obj); + __Pyx_DECREF(__pyx_v_info->obj); + __pyx_v_info->obj = ((PyObject *)__pyx_v_self); + + /* "View.MemoryView":522 + * itemp[i] = c + * + * @cname('getbuffer') # <<<<<<<<<<<<<< + * def __getbuffer__(self, Py_buffer *info, int flags): + * if flags & PyBUF_WRITABLE and self.view.readonly: +*/ + + /* function exit code */ + __pyx_r = 0; + goto __pyx_L0; + __pyx_L1_error:; + __Pyx_AddTraceback("View.MemoryView.memoryview.__getbuffer__", __pyx_clineno, __pyx_lineno, __pyx_filename); + __pyx_r = -1; + if (__pyx_v_info->obj != NULL) { + __Pyx_GOTREF(__pyx_v_info->obj); + __Pyx_DECREF(__pyx_v_info->obj); __pyx_v_info->obj = 0; + } + goto __pyx_L2; + __pyx_L0:; + if (__pyx_v_info->obj == Py_None) { + __Pyx_GOTREF(__pyx_v_info->obj); + __Pyx_DECREF(__pyx_v_info->obj); __pyx_v_info->obj = 0; + } + __pyx_L2:; + __Pyx_RefNannyFinishContext(); + return __pyx_r; +} + +/* "View.MemoryView":555 + * + * + * @property # <<<<<<<<<<<<<< + * def T(self): + * cdef _memoryviewslice result = memoryview_copy(self) +*/ + +/* Python wrapper */ +static PyObject *__pyx_pw_15View_dot_MemoryView_10memoryview_1T_1__get__(PyObject *__pyx_v_self); /*proto*/ +static PyObject *__pyx_pw_15View_dot_MemoryView_10memoryview_1T_1__get__(PyObject *__pyx_v_self) { + CYTHON_UNUSED PyObject *const *__pyx_kwvalues; + PyObject *__pyx_r = 0; + __Pyx_RefNannyDeclarations + __Pyx_RefNannySetupContext("__get__ (wrapper)", 0); + __pyx_kwvalues = __Pyx_KwValues_VARARGS(__pyx_args, __pyx_nargs); + __pyx_r = __pyx_pf_15View_dot_MemoryView_10memoryview_1T___get__(((struct __pyx_memoryview_obj *)__pyx_v_self)); + + /* function exit code */ + __Pyx_RefNannyFinishContext(); + return __pyx_r; +} + +static PyObject *__pyx_pf_15View_dot_MemoryView_10memoryview_1T___get__(struct __pyx_memoryview_obj *__pyx_v_self) { + struct __pyx_memoryviewslice_obj *__pyx_v_result = 0; + PyObject *__pyx_r = NULL; + __Pyx_RefNannyDeclarations + PyObject *__pyx_t_1 = NULL; + int __pyx_t_2; + int __pyx_lineno = 0; + const char *__pyx_filename = NULL; + int __pyx_clineno = 0; + __Pyx_RefNannySetupContext("__get__", 0); + + /* "View.MemoryView":557 + * @property + * def T(self): + * cdef _memoryviewslice result = memoryview_copy(self) # <<<<<<<<<<<<<< + * transpose_memslice(&result.from_slice) + * return result +*/ + __pyx_t_1 = __pyx_memoryview_copy_object(__pyx_v_self); if (unlikely(!__pyx_t_1)) __PYX_ERR(1, 557, __pyx_L1_error) + __Pyx_GOTREF(__pyx_t_1); + if (!(likely(((__pyx_t_1) == Py_None) || likely(__Pyx_TypeTest(__pyx_t_1, __pyx_mstate_global->__pyx_memoryviewslice_type))))) __PYX_ERR(1, 557, __pyx_L1_error) + __pyx_v_result = ((struct __pyx_memoryviewslice_obj *)__pyx_t_1); + __pyx_t_1 = 0; + + /* "View.MemoryView":558 + * def T(self): + * cdef _memoryviewslice result = memoryview_copy(self) + * transpose_memslice(&result.from_slice) # <<<<<<<<<<<<<< + * return result + * +*/ + __pyx_t_2 = __pyx_memslice_transpose((&__pyx_v_result->from_slice)); if (unlikely(__pyx_t_2 == ((int)-1))) __PYX_ERR(1, 558, __pyx_L1_error) + + /* "View.MemoryView":559 + * cdef _memoryviewslice result = memoryview_copy(self) + * transpose_memslice(&result.from_slice) + * return result # <<<<<<<<<<<<<< + * + * @property +*/ + __Pyx_XDECREF(__pyx_r); + __Pyx_INCREF((PyObject *)__pyx_v_result); + __pyx_r = ((PyObject *)__pyx_v_result); + goto __pyx_L0; + + /* "View.MemoryView":555 + * + * + * @property # <<<<<<<<<<<<<< + * def T(self): + * cdef _memoryviewslice result = memoryview_copy(self) +*/ + + /* function exit code */ + __pyx_L1_error:; + __Pyx_XDECREF(__pyx_t_1); + __Pyx_AddTraceback("View.MemoryView.memoryview.T.__get__", __pyx_clineno, __pyx_lineno, __pyx_filename); + __pyx_r = NULL; + __pyx_L0:; + __Pyx_XDECREF((PyObject *)__pyx_v_result); + __Pyx_XGIVEREF(__pyx_r); + __Pyx_RefNannyFinishContext(); + return __pyx_r; +} + +/* "View.MemoryView":561 + * return result + * + * @property # <<<<<<<<<<<<<< + * def base(self): + * return self._get_base() +*/ + +/* Python wrapper */ +static PyObject *__pyx_pw_15View_dot_MemoryView_10memoryview_4base_1__get__(PyObject *__pyx_v_self); /*proto*/ +static PyObject *__pyx_pw_15View_dot_MemoryView_10memoryview_4base_1__get__(PyObject *__pyx_v_self) { + CYTHON_UNUSED PyObject *const *__pyx_kwvalues; + PyObject *__pyx_r = 0; + __Pyx_RefNannyDeclarations + __Pyx_RefNannySetupContext("__get__ (wrapper)", 0); + __pyx_kwvalues = __Pyx_KwValues_VARARGS(__pyx_args, __pyx_nargs); + __pyx_r = __pyx_pf_15View_dot_MemoryView_10memoryview_4base___get__(((struct __pyx_memoryview_obj *)__pyx_v_self)); + + /* function exit code */ + __Pyx_RefNannyFinishContext(); + return __pyx_r; +} + +static PyObject *__pyx_pf_15View_dot_MemoryView_10memoryview_4base___get__(struct __pyx_memoryview_obj *__pyx_v_self) { + PyObject *__pyx_r = NULL; + __Pyx_RefNannyDeclarations + PyObject *__pyx_t_1 = NULL; + int __pyx_lineno = 0; + const char *__pyx_filename = NULL; + int __pyx_clineno = 0; + __Pyx_RefNannySetupContext("__get__", 0); + + /* "View.MemoryView":563 + * @property + * def base(self): + * return self._get_base() # <<<<<<<<<<<<<< + * + * cdef _get_base(self): +*/ + __Pyx_XDECREF(__pyx_r); + __pyx_t_1 = ((struct __pyx_vtabstruct_memoryview *)__pyx_v_self->__pyx_vtab)->_get_base(__pyx_v_self); if (unlikely(!__pyx_t_1)) __PYX_ERR(1, 563, __pyx_L1_error) + __Pyx_GOTREF(__pyx_t_1); + __pyx_r = __pyx_t_1; + __pyx_t_1 = 0; + goto __pyx_L0; + + /* "View.MemoryView":561 + * return result + * + * @property # <<<<<<<<<<<<<< + * def base(self): + * return self._get_base() +*/ + + /* function exit code */ + __pyx_L1_error:; + __Pyx_XDECREF(__pyx_t_1); + __Pyx_AddTraceback("View.MemoryView.memoryview.base.__get__", __pyx_clineno, __pyx_lineno, __pyx_filename); + __pyx_r = NULL; + __pyx_L0:; + __Pyx_XGIVEREF(__pyx_r); + __Pyx_RefNannyFinishContext(); + return __pyx_r; +} + +/* "View.MemoryView":565 + * return self._get_base() + * + * cdef _get_base(self): # <<<<<<<<<<<<<< + * return self.obj + * +*/ + +static PyObject *__pyx_memoryview__get_base(struct __pyx_memoryview_obj *__pyx_v_self) { + PyObject *__pyx_r = NULL; + __Pyx_RefNannyDeclarations + __Pyx_RefNannySetupContext("_get_base", 0); + + /* "View.MemoryView":566 + * + * cdef _get_base(self): + * return self.obj # <<<<<<<<<<<<<< + * + * @property +*/ + __Pyx_XDECREF(__pyx_r); + __Pyx_INCREF(__pyx_v_self->obj); + __pyx_r = __pyx_v_self->obj; + goto __pyx_L0; + + /* "View.MemoryView":565 + * return self._get_base() + * + * cdef _get_base(self): # <<<<<<<<<<<<<< + * return self.obj + * +*/ + + /* function exit code */ + __pyx_L0:; + __Pyx_XGIVEREF(__pyx_r); + __Pyx_RefNannyFinishContext(); + return __pyx_r; +} + +/* "View.MemoryView":568 + * return self.obj + * + * @property # <<<<<<<<<<<<<< + * def shape(self): + * return tuple([length for length in self.view.shape[:self.view.ndim]]) +*/ + +/* Python wrapper */ +static PyObject *__pyx_pw_15View_dot_MemoryView_10memoryview_5shape_1__get__(PyObject *__pyx_v_self); /*proto*/ +static PyObject *__pyx_pw_15View_dot_MemoryView_10memoryview_5shape_1__get__(PyObject *__pyx_v_self) { + CYTHON_UNUSED PyObject *const *__pyx_kwvalues; + PyObject *__pyx_r = 0; + __Pyx_RefNannyDeclarations + __Pyx_RefNannySetupContext("__get__ (wrapper)", 0); + __pyx_kwvalues = __Pyx_KwValues_VARARGS(__pyx_args, __pyx_nargs); + __pyx_r = __pyx_pf_15View_dot_MemoryView_10memoryview_5shape___get__(((struct __pyx_memoryview_obj *)__pyx_v_self)); + + /* function exit code */ + __Pyx_RefNannyFinishContext(); + return __pyx_r; +} + +static PyObject *__pyx_pf_15View_dot_MemoryView_10memoryview_5shape___get__(struct __pyx_memoryview_obj *__pyx_v_self) { + Py_ssize_t __pyx_7genexpr__pyx_v_length; + PyObject *__pyx_r = NULL; + __Pyx_RefNannyDeclarations + PyObject *__pyx_t_1 = NULL; + Py_ssize_t *__pyx_t_2; + Py_ssize_t *__pyx_t_3; + Py_ssize_t *__pyx_t_4; + PyObject *__pyx_t_5 = NULL; + int __pyx_lineno = 0; + const char *__pyx_filename = NULL; + int __pyx_clineno = 0; + __Pyx_RefNannySetupContext("__get__", 0); + + /* "View.MemoryView":570 + * @property + * def shape(self): + * return tuple([length for length in self.view.shape[:self.view.ndim]]) # <<<<<<<<<<<<<< + * + * @property +*/ + __Pyx_XDECREF(__pyx_r); + { /* enter inner scope */ + __pyx_t_1 = PyList_New(0); if (unlikely(!__pyx_t_1)) __PYX_ERR(1, 570, __pyx_L1_error) + __Pyx_GOTREF(__pyx_t_1); + __pyx_t_3 = (__pyx_v_self->view.shape + __pyx_v_self->view.ndim); + for (__pyx_t_4 = __pyx_v_self->view.shape; __pyx_t_4 < __pyx_t_3; __pyx_t_4++) { + __pyx_t_2 = __pyx_t_4; + __pyx_7genexpr__pyx_v_length = (__pyx_t_2[0]); + __pyx_t_5 = PyLong_FromSsize_t(__pyx_7genexpr__pyx_v_length); if (unlikely(!__pyx_t_5)) __PYX_ERR(1, 570, __pyx_L1_error) + __Pyx_GOTREF(__pyx_t_5); + if (unlikely(__Pyx_ListComp_Append(__pyx_t_1, (PyObject*)__pyx_t_5))) __PYX_ERR(1, 570, __pyx_L1_error) + __Pyx_DECREF(__pyx_t_5); __pyx_t_5 = 0; + } + } /* exit inner scope */ + __pyx_t_5 = PyList_AsTuple(((PyObject*)__pyx_t_1)); if (unlikely(!__pyx_t_5)) __PYX_ERR(1, 570, __pyx_L1_error) + __Pyx_GOTREF(__pyx_t_5); + __Pyx_DECREF(__pyx_t_1); __pyx_t_1 = 0; + __pyx_r = __pyx_t_5; + __pyx_t_5 = 0; + goto __pyx_L0; + + /* "View.MemoryView":568 + * return self.obj + * + * @property # <<<<<<<<<<<<<< + * def shape(self): + * return tuple([length for length in self.view.shape[:self.view.ndim]]) +*/ + + /* function exit code */ + __pyx_L1_error:; + __Pyx_XDECREF(__pyx_t_1); + __Pyx_XDECREF(__pyx_t_5); + __Pyx_AddTraceback("View.MemoryView.memoryview.shape.__get__", __pyx_clineno, __pyx_lineno, __pyx_filename); + __pyx_r = NULL; + __pyx_L0:; + __Pyx_XGIVEREF(__pyx_r); + __Pyx_RefNannyFinishContext(); + return __pyx_r; +} + +/* "View.MemoryView":572 + * return tuple([length for length in self.view.shape[:self.view.ndim]]) + * + * @property # <<<<<<<<<<<<<< + * def strides(self): + * if self.view.strides == NULL: +*/ + +/* Python wrapper */ +static PyObject *__pyx_pw_15View_dot_MemoryView_10memoryview_7strides_1__get__(PyObject *__pyx_v_self); /*proto*/ +static PyObject *__pyx_pw_15View_dot_MemoryView_10memoryview_7strides_1__get__(PyObject *__pyx_v_self) { + CYTHON_UNUSED PyObject *const *__pyx_kwvalues; + PyObject *__pyx_r = 0; + __Pyx_RefNannyDeclarations + __Pyx_RefNannySetupContext("__get__ (wrapper)", 0); + __pyx_kwvalues = __Pyx_KwValues_VARARGS(__pyx_args, __pyx_nargs); + __pyx_r = __pyx_pf_15View_dot_MemoryView_10memoryview_7strides___get__(((struct __pyx_memoryview_obj *)__pyx_v_self)); + + /* function exit code */ + __Pyx_RefNannyFinishContext(); + return __pyx_r; +} + +static PyObject *__pyx_pf_15View_dot_MemoryView_10memoryview_7strides___get__(struct __pyx_memoryview_obj *__pyx_v_self) { + Py_ssize_t __pyx_8genexpr1__pyx_v_stride; + PyObject *__pyx_r = NULL; + __Pyx_RefNannyDeclarations + int __pyx_t_1; + PyObject *__pyx_t_2 = NULL; + Py_ssize_t *__pyx_t_3; + Py_ssize_t *__pyx_t_4; + Py_ssize_t *__pyx_t_5; + PyObject *__pyx_t_6 = NULL; + int __pyx_lineno = 0; + const char *__pyx_filename = NULL; + int __pyx_clineno = 0; + __Pyx_RefNannySetupContext("__get__", 0); + + /* "View.MemoryView":574 + * @property + * def strides(self): + * if self.view.strides == NULL: # <<<<<<<<<<<<<< + * + * raise ValueError, "Buffer view does not expose strides" +*/ + __pyx_t_1 = (__pyx_v_self->view.strides == NULL); + if (unlikely(__pyx_t_1)) { + + /* "View.MemoryView":576 + * if self.view.strides == NULL: + * + * raise ValueError, "Buffer view does not expose strides" # <<<<<<<<<<<<<< + * + * return tuple([stride for stride in self.view.strides[:self.view.ndim]]) +*/ + __Pyx_Raise(((PyObject *)(((PyTypeObject*)PyExc_ValueError))), __pyx_mstate_global->__pyx_kp_u_Buffer_view_does_not_expose_stri, 0, 0); + __PYX_ERR(1, 576, __pyx_L1_error) + + /* "View.MemoryView":574 + * @property + * def strides(self): + * if self.view.strides == NULL: # <<<<<<<<<<<<<< + * + * raise ValueError, "Buffer view does not expose strides" +*/ + } + + /* "View.MemoryView":578 + * raise ValueError, "Buffer view does not expose strides" + * + * return tuple([stride for stride in self.view.strides[:self.view.ndim]]) # <<<<<<<<<<<<<< + * + * @property +*/ + __Pyx_XDECREF(__pyx_r); + { /* enter inner scope */ + __pyx_t_2 = PyList_New(0); if (unlikely(!__pyx_t_2)) __PYX_ERR(1, 578, __pyx_L1_error) + __Pyx_GOTREF(__pyx_t_2); + __pyx_t_4 = (__pyx_v_self->view.strides + __pyx_v_self->view.ndim); + for (__pyx_t_5 = __pyx_v_self->view.strides; __pyx_t_5 < __pyx_t_4; __pyx_t_5++) { + __pyx_t_3 = __pyx_t_5; + __pyx_8genexpr1__pyx_v_stride = (__pyx_t_3[0]); + __pyx_t_6 = PyLong_FromSsize_t(__pyx_8genexpr1__pyx_v_stride); if (unlikely(!__pyx_t_6)) __PYX_ERR(1, 578, __pyx_L1_error) + __Pyx_GOTREF(__pyx_t_6); + if (unlikely(__Pyx_ListComp_Append(__pyx_t_2, (PyObject*)__pyx_t_6))) __PYX_ERR(1, 578, __pyx_L1_error) + __Pyx_DECREF(__pyx_t_6); __pyx_t_6 = 0; + } + } /* exit inner scope */ + __pyx_t_6 = PyList_AsTuple(((PyObject*)__pyx_t_2)); if (unlikely(!__pyx_t_6)) __PYX_ERR(1, 578, __pyx_L1_error) + __Pyx_GOTREF(__pyx_t_6); + __Pyx_DECREF(__pyx_t_2); __pyx_t_2 = 0; + __pyx_r = __pyx_t_6; + __pyx_t_6 = 0; + goto __pyx_L0; + + /* "View.MemoryView":572 + * return tuple([length for length in self.view.shape[:self.view.ndim]]) + * + * @property # <<<<<<<<<<<<<< + * def strides(self): + * if self.view.strides == NULL: +*/ + + /* function exit code */ + __pyx_L1_error:; + __Pyx_XDECREF(__pyx_t_2); + __Pyx_XDECREF(__pyx_t_6); + __Pyx_AddTraceback("View.MemoryView.memoryview.strides.__get__", __pyx_clineno, __pyx_lineno, __pyx_filename); + __pyx_r = NULL; + __pyx_L0:; + __Pyx_XGIVEREF(__pyx_r); + __Pyx_RefNannyFinishContext(); + return __pyx_r; +} + +/* "View.MemoryView":580 + * return tuple([stride for stride in self.view.strides[:self.view.ndim]]) + * + * @property # <<<<<<<<<<<<<< + * def suboffsets(self): + * if self.view.suboffsets == NULL: +*/ + +/* Python wrapper */ +static PyObject *__pyx_pw_15View_dot_MemoryView_10memoryview_10suboffsets_1__get__(PyObject *__pyx_v_self); /*proto*/ +static PyObject *__pyx_pw_15View_dot_MemoryView_10memoryview_10suboffsets_1__get__(PyObject *__pyx_v_self) { + CYTHON_UNUSED PyObject *const *__pyx_kwvalues; + PyObject *__pyx_r = 0; + __Pyx_RefNannyDeclarations + __Pyx_RefNannySetupContext("__get__ (wrapper)", 0); + __pyx_kwvalues = __Pyx_KwValues_VARARGS(__pyx_args, __pyx_nargs); + __pyx_r = __pyx_pf_15View_dot_MemoryView_10memoryview_10suboffsets___get__(((struct __pyx_memoryview_obj *)__pyx_v_self)); + + /* function exit code */ + __Pyx_RefNannyFinishContext(); + return __pyx_r; +} + +static PyObject *__pyx_pf_15View_dot_MemoryView_10memoryview_10suboffsets___get__(struct __pyx_memoryview_obj *__pyx_v_self) { + Py_ssize_t __pyx_8genexpr2__pyx_v_suboffset; + PyObject *__pyx_r = NULL; + __Pyx_RefNannyDeclarations + int __pyx_t_1; + PyObject *__pyx_t_2 = NULL; + Py_ssize_t *__pyx_t_3; + Py_ssize_t *__pyx_t_4; + Py_ssize_t *__pyx_t_5; + PyObject *__pyx_t_6 = NULL; + int __pyx_lineno = 0; + const char *__pyx_filename = NULL; + int __pyx_clineno = 0; + __Pyx_RefNannySetupContext("__get__", 0); + + /* "View.MemoryView":582 + * @property + * def suboffsets(self): + * if self.view.suboffsets == NULL: # <<<<<<<<<<<<<< + * return (-1,) * self.view.ndim + * +*/ + __pyx_t_1 = (__pyx_v_self->view.suboffsets == NULL); + if (__pyx_t_1) { + + /* "View.MemoryView":583 + * def suboffsets(self): + * if self.view.suboffsets == NULL: + * return (-1,) * self.view.ndim # <<<<<<<<<<<<<< + * + * return tuple([suboffset for suboffset in self.view.suboffsets[:self.view.ndim]]) +*/ + __Pyx_XDECREF(__pyx_r); + __pyx_t_2 = __Pyx_PySequence_Multiply(__pyx_mstate_global->__pyx_tuple[1], __pyx_v_self->view.ndim); if (unlikely(!__pyx_t_2)) __PYX_ERR(1, 583, __pyx_L1_error) + __Pyx_GOTREF(__pyx_t_2); + __pyx_r = __pyx_t_2; + __pyx_t_2 = 0; + goto __pyx_L0; + + /* "View.MemoryView":582 + * @property + * def suboffsets(self): + * if self.view.suboffsets == NULL: # <<<<<<<<<<<<<< + * return (-1,) * self.view.ndim + * +*/ + } + + /* "View.MemoryView":585 + * return (-1,) * self.view.ndim + * + * return tuple([suboffset for suboffset in self.view.suboffsets[:self.view.ndim]]) # <<<<<<<<<<<<<< + * + * @property +*/ + __Pyx_XDECREF(__pyx_r); + { /* enter inner scope */ + __pyx_t_2 = PyList_New(0); if (unlikely(!__pyx_t_2)) __PYX_ERR(1, 585, __pyx_L1_error) + __Pyx_GOTREF(__pyx_t_2); + __pyx_t_4 = (__pyx_v_self->view.suboffsets + __pyx_v_self->view.ndim); + for (__pyx_t_5 = __pyx_v_self->view.suboffsets; __pyx_t_5 < __pyx_t_4; __pyx_t_5++) { + __pyx_t_3 = __pyx_t_5; + __pyx_8genexpr2__pyx_v_suboffset = (__pyx_t_3[0]); + __pyx_t_6 = PyLong_FromSsize_t(__pyx_8genexpr2__pyx_v_suboffset); if (unlikely(!__pyx_t_6)) __PYX_ERR(1, 585, __pyx_L1_error) + __Pyx_GOTREF(__pyx_t_6); + if (unlikely(__Pyx_ListComp_Append(__pyx_t_2, (PyObject*)__pyx_t_6))) __PYX_ERR(1, 585, __pyx_L1_error) + __Pyx_DECREF(__pyx_t_6); __pyx_t_6 = 0; + } + } /* exit inner scope */ + __pyx_t_6 = PyList_AsTuple(((PyObject*)__pyx_t_2)); if (unlikely(!__pyx_t_6)) __PYX_ERR(1, 585, __pyx_L1_error) + __Pyx_GOTREF(__pyx_t_6); + __Pyx_DECREF(__pyx_t_2); __pyx_t_2 = 0; + __pyx_r = __pyx_t_6; + __pyx_t_6 = 0; + goto __pyx_L0; + + /* "View.MemoryView":580 + * return tuple([stride for stride in self.view.strides[:self.view.ndim]]) + * + * @property # <<<<<<<<<<<<<< + * def suboffsets(self): + * if self.view.suboffsets == NULL: +*/ + + /* function exit code */ + __pyx_L1_error:; + __Pyx_XDECREF(__pyx_t_2); + __Pyx_XDECREF(__pyx_t_6); + __Pyx_AddTraceback("View.MemoryView.memoryview.suboffsets.__get__", __pyx_clineno, __pyx_lineno, __pyx_filename); + __pyx_r = NULL; + __pyx_L0:; + __Pyx_XGIVEREF(__pyx_r); + __Pyx_RefNannyFinishContext(); + return __pyx_r; +} + +/* "View.MemoryView":587 + * return tuple([suboffset for suboffset in self.view.suboffsets[:self.view.ndim]]) + * + * @property # <<<<<<<<<<<<<< + * def ndim(self): + * return self.view.ndim +*/ + +/* Python wrapper */ +static PyObject *__pyx_pw_15View_dot_MemoryView_10memoryview_4ndim_1__get__(PyObject *__pyx_v_self); /*proto*/ +static PyObject *__pyx_pw_15View_dot_MemoryView_10memoryview_4ndim_1__get__(PyObject *__pyx_v_self) { + CYTHON_UNUSED PyObject *const *__pyx_kwvalues; + PyObject *__pyx_r = 0; + __Pyx_RefNannyDeclarations + __Pyx_RefNannySetupContext("__get__ (wrapper)", 0); + __pyx_kwvalues = __Pyx_KwValues_VARARGS(__pyx_args, __pyx_nargs); + __pyx_r = __pyx_pf_15View_dot_MemoryView_10memoryview_4ndim___get__(((struct __pyx_memoryview_obj *)__pyx_v_self)); + + /* function exit code */ + __Pyx_RefNannyFinishContext(); + return __pyx_r; +} + +static PyObject *__pyx_pf_15View_dot_MemoryView_10memoryview_4ndim___get__(struct __pyx_memoryview_obj *__pyx_v_self) { + PyObject *__pyx_r = NULL; + __Pyx_RefNannyDeclarations + PyObject *__pyx_t_1 = NULL; + int __pyx_lineno = 0; + const char *__pyx_filename = NULL; + int __pyx_clineno = 0; + __Pyx_RefNannySetupContext("__get__", 0); + + /* "View.MemoryView":589 + * @property + * def ndim(self): + * return self.view.ndim # <<<<<<<<<<<<<< + * + * @property +*/ + __Pyx_XDECREF(__pyx_r); + __pyx_t_1 = __Pyx_PyLong_From_int(__pyx_v_self->view.ndim); if (unlikely(!__pyx_t_1)) __PYX_ERR(1, 589, __pyx_L1_error) + __Pyx_GOTREF(__pyx_t_1); + __pyx_r = __pyx_t_1; + __pyx_t_1 = 0; + goto __pyx_L0; + + /* "View.MemoryView":587 + * return tuple([suboffset for suboffset in self.view.suboffsets[:self.view.ndim]]) + * + * @property # <<<<<<<<<<<<<< + * def ndim(self): + * return self.view.ndim +*/ + + /* function exit code */ + __pyx_L1_error:; + __Pyx_XDECREF(__pyx_t_1); + __Pyx_AddTraceback("View.MemoryView.memoryview.ndim.__get__", __pyx_clineno, __pyx_lineno, __pyx_filename); + __pyx_r = NULL; + __pyx_L0:; + __Pyx_XGIVEREF(__pyx_r); + __Pyx_RefNannyFinishContext(); + return __pyx_r; +} + +/* "View.MemoryView":591 + * return self.view.ndim + * + * @property # <<<<<<<<<<<<<< + * def itemsize(self): + * return self.view.itemsize +*/ + +/* Python wrapper */ +static PyObject *__pyx_pw_15View_dot_MemoryView_10memoryview_8itemsize_1__get__(PyObject *__pyx_v_self); /*proto*/ +static PyObject *__pyx_pw_15View_dot_MemoryView_10memoryview_8itemsize_1__get__(PyObject *__pyx_v_self) { + CYTHON_UNUSED PyObject *const *__pyx_kwvalues; + PyObject *__pyx_r = 0; + __Pyx_RefNannyDeclarations + __Pyx_RefNannySetupContext("__get__ (wrapper)", 0); + __pyx_kwvalues = __Pyx_KwValues_VARARGS(__pyx_args, __pyx_nargs); + __pyx_r = __pyx_pf_15View_dot_MemoryView_10memoryview_8itemsize___get__(((struct __pyx_memoryview_obj *)__pyx_v_self)); + + /* function exit code */ + __Pyx_RefNannyFinishContext(); + return __pyx_r; +} + +static PyObject *__pyx_pf_15View_dot_MemoryView_10memoryview_8itemsize___get__(struct __pyx_memoryview_obj *__pyx_v_self) { + PyObject *__pyx_r = NULL; + __Pyx_RefNannyDeclarations + PyObject *__pyx_t_1 = NULL; + int __pyx_lineno = 0; + const char *__pyx_filename = NULL; + int __pyx_clineno = 0; + __Pyx_RefNannySetupContext("__get__", 0); + + /* "View.MemoryView":593 + * @property + * def itemsize(self): + * return self.view.itemsize # <<<<<<<<<<<<<< + * + * @property +*/ + __Pyx_XDECREF(__pyx_r); + __pyx_t_1 = PyLong_FromSsize_t(__pyx_v_self->view.itemsize); if (unlikely(!__pyx_t_1)) __PYX_ERR(1, 593, __pyx_L1_error) + __Pyx_GOTREF(__pyx_t_1); + __pyx_r = __pyx_t_1; + __pyx_t_1 = 0; + goto __pyx_L0; + + /* "View.MemoryView":591 + * return self.view.ndim + * + * @property # <<<<<<<<<<<<<< + * def itemsize(self): + * return self.view.itemsize +*/ + + /* function exit code */ + __pyx_L1_error:; + __Pyx_XDECREF(__pyx_t_1); + __Pyx_AddTraceback("View.MemoryView.memoryview.itemsize.__get__", __pyx_clineno, __pyx_lineno, __pyx_filename); + __pyx_r = NULL; + __pyx_L0:; + __Pyx_XGIVEREF(__pyx_r); + __Pyx_RefNannyFinishContext(); + return __pyx_r; +} + +/* "View.MemoryView":595 + * return self.view.itemsize + * + * @property # <<<<<<<<<<<<<< + * def nbytes(self): + * return self.size * self.view.itemsize +*/ + +/* Python wrapper */ +static PyObject *__pyx_pw_15View_dot_MemoryView_10memoryview_6nbytes_1__get__(PyObject *__pyx_v_self); /*proto*/ +static PyObject *__pyx_pw_15View_dot_MemoryView_10memoryview_6nbytes_1__get__(PyObject *__pyx_v_self) { + CYTHON_UNUSED PyObject *const *__pyx_kwvalues; + PyObject *__pyx_r = 0; + __Pyx_RefNannyDeclarations + __Pyx_RefNannySetupContext("__get__ (wrapper)", 0); + __pyx_kwvalues = __Pyx_KwValues_VARARGS(__pyx_args, __pyx_nargs); + __pyx_r = __pyx_pf_15View_dot_MemoryView_10memoryview_6nbytes___get__(((struct __pyx_memoryview_obj *)__pyx_v_self)); + + /* function exit code */ + __Pyx_RefNannyFinishContext(); + return __pyx_r; +} + +static PyObject *__pyx_pf_15View_dot_MemoryView_10memoryview_6nbytes___get__(struct __pyx_memoryview_obj *__pyx_v_self) { + PyObject *__pyx_r = NULL; + __Pyx_RefNannyDeclarations + PyObject *__pyx_t_1 = NULL; + PyObject *__pyx_t_2 = NULL; + PyObject *__pyx_t_3 = NULL; + int __pyx_lineno = 0; + const char *__pyx_filename = NULL; + int __pyx_clineno = 0; + __Pyx_RefNannySetupContext("__get__", 0); + + /* "View.MemoryView":597 + * @property + * def nbytes(self): + * return self.size * self.view.itemsize # <<<<<<<<<<<<<< + * + * @property +*/ + __Pyx_XDECREF(__pyx_r); + __pyx_t_1 = __Pyx_PyObject_GetAttrStr(((PyObject *)__pyx_v_self), __pyx_mstate_global->__pyx_n_u_size); if (unlikely(!__pyx_t_1)) __PYX_ERR(1, 597, __pyx_L1_error) + __Pyx_GOTREF(__pyx_t_1); + __pyx_t_2 = PyLong_FromSsize_t(__pyx_v_self->view.itemsize); if (unlikely(!__pyx_t_2)) __PYX_ERR(1, 597, __pyx_L1_error) + __Pyx_GOTREF(__pyx_t_2); + __pyx_t_3 = PyNumber_Multiply(__pyx_t_1, __pyx_t_2); if (unlikely(!__pyx_t_3)) __PYX_ERR(1, 597, __pyx_L1_error) + __Pyx_GOTREF(__pyx_t_3); + __Pyx_DECREF(__pyx_t_1); __pyx_t_1 = 0; + __Pyx_DECREF(__pyx_t_2); __pyx_t_2 = 0; + __pyx_r = __pyx_t_3; + __pyx_t_3 = 0; + goto __pyx_L0; + + /* "View.MemoryView":595 + * return self.view.itemsize + * + * @property # <<<<<<<<<<<<<< + * def nbytes(self): + * return self.size * self.view.itemsize +*/ + + /* function exit code */ + __pyx_L1_error:; + __Pyx_XDECREF(__pyx_t_1); + __Pyx_XDECREF(__pyx_t_2); + __Pyx_XDECREF(__pyx_t_3); + __Pyx_AddTraceback("View.MemoryView.memoryview.nbytes.__get__", __pyx_clineno, __pyx_lineno, __pyx_filename); + __pyx_r = NULL; + __pyx_L0:; + __Pyx_XGIVEREF(__pyx_r); + __Pyx_RefNannyFinishContext(); + return __pyx_r; +} + +/* "View.MemoryView":599 + * return self.size * self.view.itemsize + * + * @property # <<<<<<<<<<<<<< + * def size(self): + * if self._size is None: +*/ + +/* Python wrapper */ +static PyObject *__pyx_pw_15View_dot_MemoryView_10memoryview_4size_1__get__(PyObject *__pyx_v_self); /*proto*/ +static PyObject *__pyx_pw_15View_dot_MemoryView_10memoryview_4size_1__get__(PyObject *__pyx_v_self) { + CYTHON_UNUSED PyObject *const *__pyx_kwvalues; + PyObject *__pyx_r = 0; + __Pyx_RefNannyDeclarations + __Pyx_RefNannySetupContext("__get__ (wrapper)", 0); + __pyx_kwvalues = __Pyx_KwValues_VARARGS(__pyx_args, __pyx_nargs); + __pyx_r = __pyx_pf_15View_dot_MemoryView_10memoryview_4size___get__(((struct __pyx_memoryview_obj *)__pyx_v_self)); + + /* function exit code */ + __Pyx_RefNannyFinishContext(); + return __pyx_r; +} + +static PyObject *__pyx_pf_15View_dot_MemoryView_10memoryview_4size___get__(struct __pyx_memoryview_obj *__pyx_v_self) { + PyObject *__pyx_v_result = NULL; + PyObject *__pyx_v_length = NULL; + PyObject *__pyx_r = NULL; + __Pyx_RefNannyDeclarations + int __pyx_t_1; + Py_ssize_t *__pyx_t_2; + Py_ssize_t *__pyx_t_3; + Py_ssize_t *__pyx_t_4; + PyObject *__pyx_t_5 = NULL; + int __pyx_lineno = 0; + const char *__pyx_filename = NULL; + int __pyx_clineno = 0; + __Pyx_RefNannySetupContext("__get__", 0); + + /* "View.MemoryView":601 + * @property + * def size(self): + * if self._size is None: # <<<<<<<<<<<<<< + * result = 1 + * +*/ + __pyx_t_1 = (__pyx_v_self->_size == Py_None); + if (__pyx_t_1) { + + /* "View.MemoryView":602 + * def size(self): + * if self._size is None: + * result = 1 # <<<<<<<<<<<<<< + * + * for length in self.view.shape[:self.view.ndim]: +*/ + __Pyx_INCREF(__pyx_mstate_global->__pyx_int_1); + __pyx_v_result = __pyx_mstate_global->__pyx_int_1; + + /* "View.MemoryView":604 + * result = 1 + * + * for length in self.view.shape[:self.view.ndim]: # <<<<<<<<<<<<<< + * result *= length + * +*/ + __pyx_t_3 = (__pyx_v_self->view.shape + __pyx_v_self->view.ndim); + for (__pyx_t_4 = __pyx_v_self->view.shape; __pyx_t_4 < __pyx_t_3; __pyx_t_4++) { + __pyx_t_2 = __pyx_t_4; + __pyx_t_5 = PyLong_FromSsize_t((__pyx_t_2[0])); if (unlikely(!__pyx_t_5)) __PYX_ERR(1, 604, __pyx_L1_error) + __Pyx_GOTREF(__pyx_t_5); + __Pyx_XDECREF_SET(__pyx_v_length, __pyx_t_5); + __pyx_t_5 = 0; + + /* "View.MemoryView":605 + * + * for length in self.view.shape[:self.view.ndim]: + * result *= length # <<<<<<<<<<<<<< + * + * self._size = result +*/ + __pyx_t_5 = PyNumber_InPlaceMultiply(__pyx_v_result, __pyx_v_length); if (unlikely(!__pyx_t_5)) __PYX_ERR(1, 605, __pyx_L1_error) + __Pyx_GOTREF(__pyx_t_5); + __Pyx_DECREF_SET(__pyx_v_result, __pyx_t_5); + __pyx_t_5 = 0; + } + + /* "View.MemoryView":607 + * result *= length + * + * self._size = result # <<<<<<<<<<<<<< + * + * return self._size +*/ + __Pyx_INCREF(__pyx_v_result); + __Pyx_GIVEREF(__pyx_v_result); + __Pyx_GOTREF(__pyx_v_self->_size); + __Pyx_DECREF(__pyx_v_self->_size); + __pyx_v_self->_size = __pyx_v_result; + + /* "View.MemoryView":601 + * @property + * def size(self): + * if self._size is None: # <<<<<<<<<<<<<< + * result = 1 + * +*/ + } + + /* "View.MemoryView":609 + * self._size = result + * + * return self._size # <<<<<<<<<<<<<< + * + * def __len__(self): +*/ + __Pyx_XDECREF(__pyx_r); + __Pyx_INCREF(__pyx_v_self->_size); + __pyx_r = __pyx_v_self->_size; + goto __pyx_L0; + + /* "View.MemoryView":599 + * return self.size * self.view.itemsize + * + * @property # <<<<<<<<<<<<<< + * def size(self): + * if self._size is None: +*/ + + /* function exit code */ + __pyx_L1_error:; + __Pyx_XDECREF(__pyx_t_5); + __Pyx_AddTraceback("View.MemoryView.memoryview.size.__get__", __pyx_clineno, __pyx_lineno, __pyx_filename); + __pyx_r = NULL; + __pyx_L0:; + __Pyx_XDECREF(__pyx_v_result); + __Pyx_XDECREF(__pyx_v_length); + __Pyx_XGIVEREF(__pyx_r); + __Pyx_RefNannyFinishContext(); + return __pyx_r; +} + +/* "View.MemoryView":611 + * return self._size + * + * def __len__(self): # <<<<<<<<<<<<<< + * if self.view.ndim >= 1: + * return self.view.shape[0] +*/ + +/* Python wrapper */ +static Py_ssize_t __pyx_memoryview___len__(PyObject *__pyx_v_self); /*proto*/ +static Py_ssize_t __pyx_memoryview___len__(PyObject *__pyx_v_self) { + CYTHON_UNUSED PyObject *const *__pyx_kwvalues; + Py_ssize_t __pyx_r; + __Pyx_RefNannyDeclarations + __Pyx_RefNannySetupContext("__len__ (wrapper)", 0); + __pyx_kwvalues = __Pyx_KwValues_VARARGS(__pyx_args, __pyx_nargs); + __pyx_r = __pyx_memoryview___pyx_pf_15View_dot_MemoryView_10memoryview_10__len__(((struct __pyx_memoryview_obj *)__pyx_v_self)); + + /* function exit code */ + __Pyx_RefNannyFinishContext(); + return __pyx_r; +} + +static Py_ssize_t __pyx_memoryview___pyx_pf_15View_dot_MemoryView_10memoryview_10__len__(struct __pyx_memoryview_obj *__pyx_v_self) { + Py_ssize_t __pyx_r; + int __pyx_t_1; + + /* "View.MemoryView":612 + * + * def __len__(self): + * if self.view.ndim >= 1: # <<<<<<<<<<<<<< + * return self.view.shape[0] + * +*/ + __pyx_t_1 = (__pyx_v_self->view.ndim >= 1); + if (__pyx_t_1) { + + /* "View.MemoryView":613 + * def __len__(self): + * if self.view.ndim >= 1: + * return self.view.shape[0] # <<<<<<<<<<<<<< + * + * return 0 +*/ + __pyx_r = (__pyx_v_self->view.shape[0]); + goto __pyx_L0; + + /* "View.MemoryView":612 + * + * def __len__(self): + * if self.view.ndim >= 1: # <<<<<<<<<<<<<< + * return self.view.shape[0] + * +*/ + } + + /* "View.MemoryView":615 + * return self.view.shape[0] + * + * return 0 # <<<<<<<<<<<<<< + * + * def __repr__(self): +*/ + __pyx_r = 0; + goto __pyx_L0; + + /* "View.MemoryView":611 + * return self._size + * + * def __len__(self): # <<<<<<<<<<<<<< + * if self.view.ndim >= 1: + * return self.view.shape[0] +*/ + + /* function exit code */ + __pyx_L0:; + return __pyx_r; +} + +/* "View.MemoryView":617 + * return 0 + * + * def __repr__(self): # <<<<<<<<<<<<<< + * return "" % (self.base.__class__.__name__, + * id(self)) +*/ + +/* Python wrapper */ +static PyObject *__pyx_memoryview___repr__(PyObject *__pyx_v_self); /*proto*/ +static PyObject *__pyx_memoryview___repr__(PyObject *__pyx_v_self) { + CYTHON_UNUSED PyObject *const *__pyx_kwvalues; + PyObject *__pyx_r = 0; + __Pyx_RefNannyDeclarations + __Pyx_RefNannySetupContext("__repr__ (wrapper)", 0); + __pyx_kwvalues = __Pyx_KwValues_VARARGS(__pyx_args, __pyx_nargs); + __pyx_r = __pyx_memoryview___pyx_pf_15View_dot_MemoryView_10memoryview_12__repr__(((struct __pyx_memoryview_obj *)__pyx_v_self)); + + /* function exit code */ + __Pyx_RefNannyFinishContext(); + return __pyx_r; +} + +static PyObject *__pyx_memoryview___pyx_pf_15View_dot_MemoryView_10memoryview_12__repr__(struct __pyx_memoryview_obj *__pyx_v_self) { + PyObject *__pyx_r = NULL; + __Pyx_RefNannyDeclarations + PyObject *__pyx_t_1 = NULL; + PyObject *__pyx_t_2 = NULL; + PyObject *__pyx_t_3 = NULL; + PyObject *__pyx_t_4[5]; + int __pyx_lineno = 0; + const char *__pyx_filename = NULL; + int __pyx_clineno = 0; + __Pyx_RefNannySetupContext("__repr__", 0); + + /* "View.MemoryView":618 + * + * def __repr__(self): + * return "" % (self.base.__class__.__name__, # <<<<<<<<<<<<<< + * id(self)) + * +*/ + __Pyx_XDECREF(__pyx_r); + __pyx_t_1 = __Pyx_PyObject_GetAttrStr(((PyObject *)__pyx_v_self), __pyx_mstate_global->__pyx_n_u_base); if (unlikely(!__pyx_t_1)) __PYX_ERR(1, 618, __pyx_L1_error) + __Pyx_GOTREF(__pyx_t_1); + __pyx_t_2 = __Pyx_PyObject_GetAttrStr(__pyx_t_1, __pyx_mstate_global->__pyx_n_u_class); if (unlikely(!__pyx_t_2)) __PYX_ERR(1, 618, __pyx_L1_error) + __Pyx_GOTREF(__pyx_t_2); + __Pyx_DECREF(__pyx_t_1); __pyx_t_1 = 0; + __pyx_t_1 = __Pyx_PyObject_GetAttrStr(__pyx_t_2, __pyx_mstate_global->__pyx_n_u_name_2); if (unlikely(!__pyx_t_1)) __PYX_ERR(1, 618, __pyx_L1_error) + __Pyx_GOTREF(__pyx_t_1); + __Pyx_DECREF(__pyx_t_2); __pyx_t_2 = 0; + __pyx_t_2 = __Pyx_PyObject_FormatSimpleAndDecref(PyObject_Repr(__pyx_t_1), __pyx_mstate_global->__pyx_empty_unicode); if (unlikely(!__pyx_t_2)) __PYX_ERR(1, 618, __pyx_L1_error) + __Pyx_GOTREF(__pyx_t_2); + __Pyx_DECREF(__pyx_t_1); __pyx_t_1 = 0; + + /* "View.MemoryView":619 + * def __repr__(self): + * return "" % (self.base.__class__.__name__, + * id(self)) # <<<<<<<<<<<<<< + * + * def __str__(self): +*/ + __pyx_t_1 = __Pyx_PyObject_CallOneArg(__pyx_builtin_id, ((PyObject *)__pyx_v_self)); if (unlikely(!__pyx_t_1)) __PYX_ERR(1, 619, __pyx_L1_error) + __Pyx_GOTREF(__pyx_t_1); + __pyx_t_3 = __Pyx_PyObject_Format(__pyx_t_1, __pyx_mstate_global->__pyx_n_u_x); if (unlikely(!__pyx_t_3)) __PYX_ERR(1, 619, __pyx_L1_error) + __Pyx_GOTREF(__pyx_t_3); + __Pyx_DECREF(__pyx_t_1); __pyx_t_1 = 0; + __pyx_t_4[0] = __pyx_mstate_global->__pyx_kp_u_MemoryView_of; + __pyx_t_4[1] = __pyx_t_2; + __pyx_t_4[2] = __pyx_mstate_global->__pyx_kp_u_at_0x; + __pyx_t_4[3] = __pyx_t_3; + __pyx_t_4[4] = __pyx_mstate_global->__pyx_kp_u__3; + + /* "View.MemoryView":618 + * + * def __repr__(self): + * return "" % (self.base.__class__.__name__, # <<<<<<<<<<<<<< + * id(self)) + * +*/ + __pyx_t_1 = __Pyx_PyUnicode_Join(__pyx_t_4, 5, 15 + __Pyx_PyUnicode_GET_LENGTH(__pyx_t_2) + 6 + __Pyx_PyUnicode_GET_LENGTH(__pyx_t_3) + 1, 127 | __Pyx_PyUnicode_MAX_CHAR_VALUE(__pyx_t_2) | __Pyx_PyUnicode_MAX_CHAR_VALUE(__pyx_t_3)); + if (unlikely(!__pyx_t_1)) __PYX_ERR(1, 618, __pyx_L1_error) + __Pyx_GOTREF(__pyx_t_1); + __Pyx_DECREF(__pyx_t_2); __pyx_t_2 = 0; + __Pyx_DECREF(__pyx_t_3); __pyx_t_3 = 0; + __pyx_r = __pyx_t_1; + __pyx_t_1 = 0; + goto __pyx_L0; + + /* "View.MemoryView":617 + * return 0 + * + * def __repr__(self): # <<<<<<<<<<<<<< + * return "" % (self.base.__class__.__name__, + * id(self)) +*/ + + /* function exit code */ + __pyx_L1_error:; + __Pyx_XDECREF(__pyx_t_1); + __Pyx_XDECREF(__pyx_t_2); + __Pyx_XDECREF(__pyx_t_3); + __Pyx_AddTraceback("View.MemoryView.memoryview.__repr__", __pyx_clineno, __pyx_lineno, __pyx_filename); + __pyx_r = NULL; + __pyx_L0:; + __Pyx_XGIVEREF(__pyx_r); + __Pyx_RefNannyFinishContext(); + return __pyx_r; +} + +/* "View.MemoryView":621 + * id(self)) + * + * def __str__(self): # <<<<<<<<<<<<<< + * return "" % (self.base.__class__.__name__,) + * +*/ + +/* Python wrapper */ +static PyObject *__pyx_memoryview___str__(PyObject *__pyx_v_self); /*proto*/ +static PyObject *__pyx_memoryview___str__(PyObject *__pyx_v_self) { + CYTHON_UNUSED PyObject *const *__pyx_kwvalues; + PyObject *__pyx_r = 0; + __Pyx_RefNannyDeclarations + __Pyx_RefNannySetupContext("__str__ (wrapper)", 0); + __pyx_kwvalues = __Pyx_KwValues_VARARGS(__pyx_args, __pyx_nargs); + __pyx_r = __pyx_memoryview___pyx_pf_15View_dot_MemoryView_10memoryview_14__str__(((struct __pyx_memoryview_obj *)__pyx_v_self)); + + /* function exit code */ + __Pyx_RefNannyFinishContext(); + return __pyx_r; +} + +static PyObject *__pyx_memoryview___pyx_pf_15View_dot_MemoryView_10memoryview_14__str__(struct __pyx_memoryview_obj *__pyx_v_self) { + PyObject *__pyx_r = NULL; + __Pyx_RefNannyDeclarations + PyObject *__pyx_t_1 = NULL; + PyObject *__pyx_t_2 = NULL; + PyObject *__pyx_t_3[3]; + int __pyx_lineno = 0; + const char *__pyx_filename = NULL; + int __pyx_clineno = 0; + __Pyx_RefNannySetupContext("__str__", 0); + + /* "View.MemoryView":622 + * + * def __str__(self): + * return "" % (self.base.__class__.__name__,) # <<<<<<<<<<<<<< + * + * +*/ + __Pyx_XDECREF(__pyx_r); + __pyx_t_1 = __Pyx_PyObject_GetAttrStr(((PyObject *)__pyx_v_self), __pyx_mstate_global->__pyx_n_u_base); if (unlikely(!__pyx_t_1)) __PYX_ERR(1, 622, __pyx_L1_error) + __Pyx_GOTREF(__pyx_t_1); + __pyx_t_2 = __Pyx_PyObject_GetAttrStr(__pyx_t_1, __pyx_mstate_global->__pyx_n_u_class); if (unlikely(!__pyx_t_2)) __PYX_ERR(1, 622, __pyx_L1_error) + __Pyx_GOTREF(__pyx_t_2); + __Pyx_DECREF(__pyx_t_1); __pyx_t_1 = 0; + __pyx_t_1 = __Pyx_PyObject_GetAttrStr(__pyx_t_2, __pyx_mstate_global->__pyx_n_u_name_2); if (unlikely(!__pyx_t_1)) __PYX_ERR(1, 622, __pyx_L1_error) + __Pyx_GOTREF(__pyx_t_1); + __Pyx_DECREF(__pyx_t_2); __pyx_t_2 = 0; + __pyx_t_2 = __Pyx_PyObject_FormatSimpleAndDecref(PyObject_Repr(__pyx_t_1), __pyx_mstate_global->__pyx_empty_unicode); if (unlikely(!__pyx_t_2)) __PYX_ERR(1, 622, __pyx_L1_error) + __Pyx_GOTREF(__pyx_t_2); + __Pyx_DECREF(__pyx_t_1); __pyx_t_1 = 0; + __pyx_t_3[0] = __pyx_mstate_global->__pyx_kp_u_MemoryView_of; + __pyx_t_3[1] = __pyx_t_2; + __pyx_t_3[2] = __pyx_mstate_global->__pyx_kp_u_object; + __pyx_t_1 = __Pyx_PyUnicode_Join(__pyx_t_3, 3, 15 + __Pyx_PyUnicode_GET_LENGTH(__pyx_t_2) + 8, 127 | __Pyx_PyUnicode_MAX_CHAR_VALUE(__pyx_t_2)); + if (unlikely(!__pyx_t_1)) __PYX_ERR(1, 622, __pyx_L1_error) + __Pyx_GOTREF(__pyx_t_1); + __Pyx_DECREF(__pyx_t_2); __pyx_t_2 = 0; + __pyx_r = __pyx_t_1; + __pyx_t_1 = 0; + goto __pyx_L0; + + /* "View.MemoryView":621 + * id(self)) + * + * def __str__(self): # <<<<<<<<<<<<<< + * return "" % (self.base.__class__.__name__,) + * +*/ + + /* function exit code */ + __pyx_L1_error:; + __Pyx_XDECREF(__pyx_t_1); + __Pyx_XDECREF(__pyx_t_2); + __Pyx_AddTraceback("View.MemoryView.memoryview.__str__", __pyx_clineno, __pyx_lineno, __pyx_filename); + __pyx_r = NULL; + __pyx_L0:; + __Pyx_XGIVEREF(__pyx_r); + __Pyx_RefNannyFinishContext(); + return __pyx_r; +} + +/* "View.MemoryView":625 + * + * + * def is_c_contig(self): # <<<<<<<<<<<<<< + * cdef __Pyx_memviewslice *mslice + * cdef __Pyx_memviewslice tmp +*/ + +/* Python wrapper */ +static PyObject *__pyx_memoryview_is_c_contig(PyObject *__pyx_v_self, +#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*/ +static PyObject *__pyx_memoryview_is_c_contig(PyObject *__pyx_v_self, +#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_c_contig (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_c_contig", 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_c_contig", __pyx_kwds); return NULL;} + __pyx_r = __pyx_memoryview___pyx_pf_15View_dot_MemoryView_10memoryview_16is_c_contig(((struct __pyx_memoryview_obj *)__pyx_v_self)); + + /* function exit code */ + __Pyx_RefNannyFinishContext(); + return __pyx_r; +} + +static PyObject *__pyx_memoryview___pyx_pf_15View_dot_MemoryView_10memoryview_16is_c_contig(struct __pyx_memoryview_obj *__pyx_v_self) { + __Pyx_memviewslice *__pyx_v_mslice; + __Pyx_memviewslice __pyx_v_tmp; + PyObject *__pyx_r = NULL; + __Pyx_RefNannyDeclarations + __Pyx_memviewslice *__pyx_t_1; + PyObject *__pyx_t_2 = NULL; + int __pyx_lineno = 0; + const char *__pyx_filename = NULL; + int __pyx_clineno = 0; + __Pyx_RefNannySetupContext("is_c_contig", 0); + + /* "View.MemoryView":628 + * cdef __Pyx_memviewslice *mslice + * cdef __Pyx_memviewslice tmp + * mslice = get_slice_from_memview(self, &tmp) # <<<<<<<<<<<<<< + * return slice_is_contig(mslice[0], 'C', self.view.ndim) + * +*/ + __pyx_t_1 = __pyx_memoryview_get_slice_from_memoryview(__pyx_v_self, (&__pyx_v_tmp)); if (unlikely(__pyx_t_1 == ((void *)NULL))) __PYX_ERR(1, 628, __pyx_L1_error) + __pyx_v_mslice = __pyx_t_1; + + /* "View.MemoryView":629 + * cdef __Pyx_memviewslice tmp + * mslice = get_slice_from_memview(self, &tmp) + * return slice_is_contig(mslice[0], 'C', self.view.ndim) # <<<<<<<<<<<<<< + * + * def is_f_contig(self): +*/ + __Pyx_XDECREF(__pyx_r); + __pyx_t_2 = __Pyx_PyBool_FromLong(__pyx_memviewslice_is_contig((__pyx_v_mslice[0]), 'C', __pyx_v_self->view.ndim)); if (unlikely(!__pyx_t_2)) __PYX_ERR(1, 629, __pyx_L1_error) + __Pyx_GOTREF(__pyx_t_2); + __pyx_r = __pyx_t_2; + __pyx_t_2 = 0; + goto __pyx_L0; + + /* "View.MemoryView":625 + * + * + * def is_c_contig(self): # <<<<<<<<<<<<<< + * cdef __Pyx_memviewslice *mslice + * cdef __Pyx_memviewslice tmp +*/ + + /* function exit code */ + __pyx_L1_error:; + __Pyx_XDECREF(__pyx_t_2); + __Pyx_AddTraceback("View.MemoryView.memoryview.is_c_contig", __pyx_clineno, __pyx_lineno, __pyx_filename); + __pyx_r = NULL; + __pyx_L0:; + __Pyx_XGIVEREF(__pyx_r); + __Pyx_RefNannyFinishContext(); + return __pyx_r; +} + +/* "View.MemoryView":631 + * return slice_is_contig(mslice[0], 'C', self.view.ndim) + * + * def is_f_contig(self): # <<<<<<<<<<<<<< + * cdef __Pyx_memviewslice *mslice + * cdef __Pyx_memviewslice tmp +*/ + +/* Python wrapper */ +static PyObject *__pyx_memoryview_is_f_contig(PyObject *__pyx_v_self, +#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*/ +static PyObject *__pyx_memoryview_is_f_contig(PyObject *__pyx_v_self, +#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_f_contig (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_f_contig", 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_f_contig", __pyx_kwds); return NULL;} + __pyx_r = __pyx_memoryview___pyx_pf_15View_dot_MemoryView_10memoryview_18is_f_contig(((struct __pyx_memoryview_obj *)__pyx_v_self)); + + /* function exit code */ + __Pyx_RefNannyFinishContext(); + return __pyx_r; +} + +static PyObject *__pyx_memoryview___pyx_pf_15View_dot_MemoryView_10memoryview_18is_f_contig(struct __pyx_memoryview_obj *__pyx_v_self) { + __Pyx_memviewslice *__pyx_v_mslice; + __Pyx_memviewslice __pyx_v_tmp; + PyObject *__pyx_r = NULL; + __Pyx_RefNannyDeclarations + __Pyx_memviewslice *__pyx_t_1; + PyObject *__pyx_t_2 = NULL; + int __pyx_lineno = 0; + const char *__pyx_filename = NULL; + int __pyx_clineno = 0; + __Pyx_RefNannySetupContext("is_f_contig", 0); + + /* "View.MemoryView":634 + * cdef __Pyx_memviewslice *mslice + * cdef __Pyx_memviewslice tmp + * mslice = get_slice_from_memview(self, &tmp) # <<<<<<<<<<<<<< + * return slice_is_contig(mslice[0], 'F', self.view.ndim) + * +*/ + __pyx_t_1 = __pyx_memoryview_get_slice_from_memoryview(__pyx_v_self, (&__pyx_v_tmp)); if (unlikely(__pyx_t_1 == ((void *)NULL))) __PYX_ERR(1, 634, __pyx_L1_error) + __pyx_v_mslice = __pyx_t_1; + + /* "View.MemoryView":635 + * cdef __Pyx_memviewslice tmp + * mslice = get_slice_from_memview(self, &tmp) + * return slice_is_contig(mslice[0], 'F', self.view.ndim) # <<<<<<<<<<<<<< + * + * def copy(self): +*/ + __Pyx_XDECREF(__pyx_r); + __pyx_t_2 = __Pyx_PyBool_FromLong(__pyx_memviewslice_is_contig((__pyx_v_mslice[0]), 'F', __pyx_v_self->view.ndim)); if (unlikely(!__pyx_t_2)) __PYX_ERR(1, 635, __pyx_L1_error) + __Pyx_GOTREF(__pyx_t_2); + __pyx_r = __pyx_t_2; + __pyx_t_2 = 0; + goto __pyx_L0; + + /* "View.MemoryView":631 + * return slice_is_contig(mslice[0], 'C', self.view.ndim) + * + * def is_f_contig(self): # <<<<<<<<<<<<<< + * cdef __Pyx_memviewslice *mslice + * cdef __Pyx_memviewslice tmp +*/ + + /* function exit code */ + __pyx_L1_error:; + __Pyx_XDECREF(__pyx_t_2); + __Pyx_AddTraceback("View.MemoryView.memoryview.is_f_contig", __pyx_clineno, __pyx_lineno, __pyx_filename); + __pyx_r = NULL; + __pyx_L0:; + __Pyx_XGIVEREF(__pyx_r); + __Pyx_RefNannyFinishContext(); + return __pyx_r; +} + +/* "View.MemoryView":637 + * return slice_is_contig(mslice[0], 'F', self.view.ndim) + * + * def copy(self): # <<<<<<<<<<<<<< + * cdef __Pyx_memviewslice mslice + * cdef int flags = self.flags & ~PyBUF_F_CONTIGUOUS +*/ + +/* Python wrapper */ +static PyObject *__pyx_memoryview_copy(PyObject *__pyx_v_self, +#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*/ +static PyObject *__pyx_memoryview_copy(PyObject *__pyx_v_self, +#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("copy (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("copy", 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("copy", __pyx_kwds); return NULL;} + __pyx_r = __pyx_memoryview___pyx_pf_15View_dot_MemoryView_10memoryview_20copy(((struct __pyx_memoryview_obj *)__pyx_v_self)); + + /* function exit code */ + __Pyx_RefNannyFinishContext(); + return __pyx_r; +} + +static PyObject *__pyx_memoryview___pyx_pf_15View_dot_MemoryView_10memoryview_20copy(struct __pyx_memoryview_obj *__pyx_v_self) { + __Pyx_memviewslice __pyx_v_mslice; + int __pyx_v_flags; + PyObject *__pyx_r = NULL; + __Pyx_RefNannyDeclarations + __Pyx_memviewslice __pyx_t_1; + PyObject *__pyx_t_2 = NULL; + int __pyx_lineno = 0; + const char *__pyx_filename = NULL; + int __pyx_clineno = 0; + __Pyx_RefNannySetupContext("copy", 0); + + /* "View.MemoryView":639 + * def copy(self): + * cdef __Pyx_memviewslice mslice + * cdef int flags = self.flags & ~PyBUF_F_CONTIGUOUS # <<<<<<<<<<<<<< + * + * slice_copy(self, &mslice) +*/ + __pyx_v_flags = (__pyx_v_self->flags & (~PyBUF_F_CONTIGUOUS)); + + /* "View.MemoryView":641 + * cdef int flags = self.flags & ~PyBUF_F_CONTIGUOUS + * + * slice_copy(self, &mslice) # <<<<<<<<<<<<<< + * mslice = slice_copy_contig(&mslice, "c", self.view.ndim, + * self.view.itemsize, +*/ + __pyx_memoryview_slice_copy(__pyx_v_self, (&__pyx_v_mslice)); + + /* "View.MemoryView":642 + * + * slice_copy(self, &mslice) + * mslice = slice_copy_contig(&mslice, "c", self.view.ndim, # <<<<<<<<<<<<<< + * self.view.itemsize, + * flags|PyBUF_C_CONTIGUOUS, +*/ + __pyx_t_1 = __pyx_memoryview_copy_new_contig((&__pyx_v_mslice), ((char const *)"c"), __pyx_v_self->view.ndim, __pyx_v_self->view.itemsize, (__pyx_v_flags | PyBUF_C_CONTIGUOUS), __pyx_v_self->dtype_is_object); if (unlikely(PyErr_Occurred())) __PYX_ERR(1, 642, __pyx_L1_error) + __pyx_v_mslice = __pyx_t_1; + + /* "View.MemoryView":647 + * self.dtype_is_object) + * + * return memoryview_copy_from_slice(self, &mslice) # <<<<<<<<<<<<<< + * + * def copy_fortran(self): +*/ + __Pyx_XDECREF(__pyx_r); + __pyx_t_2 = __pyx_memoryview_copy_object_from_slice(__pyx_v_self, (&__pyx_v_mslice)); if (unlikely(!__pyx_t_2)) __PYX_ERR(1, 647, __pyx_L1_error) + __Pyx_GOTREF(__pyx_t_2); + __pyx_r = __pyx_t_2; + __pyx_t_2 = 0; + goto __pyx_L0; + + /* "View.MemoryView":637 + * return slice_is_contig(mslice[0], 'F', self.view.ndim) + * + * def copy(self): # <<<<<<<<<<<<<< + * cdef __Pyx_memviewslice mslice + * cdef int flags = self.flags & ~PyBUF_F_CONTIGUOUS +*/ + + /* function exit code */ + __pyx_L1_error:; + __Pyx_XDECREF(__pyx_t_2); + __Pyx_AddTraceback("View.MemoryView.memoryview.copy", __pyx_clineno, __pyx_lineno, __pyx_filename); + __pyx_r = NULL; + __pyx_L0:; + __Pyx_XGIVEREF(__pyx_r); + __Pyx_RefNannyFinishContext(); + return __pyx_r; +} + +/* "View.MemoryView":649 + * return memoryview_copy_from_slice(self, &mslice) + * + * def copy_fortran(self): # <<<<<<<<<<<<<< + * cdef __Pyx_memviewslice src, dst + * cdef int flags = self.flags & ~PyBUF_C_CONTIGUOUS +*/ + +/* Python wrapper */ +static PyObject *__pyx_memoryview_copy_fortran(PyObject *__pyx_v_self, +#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*/ +static PyObject *__pyx_memoryview_copy_fortran(PyObject *__pyx_v_self, +#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("copy_fortran (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("copy_fortran", 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("copy_fortran", __pyx_kwds); return NULL;} + __pyx_r = __pyx_memoryview___pyx_pf_15View_dot_MemoryView_10memoryview_22copy_fortran(((struct __pyx_memoryview_obj *)__pyx_v_self)); + + /* function exit code */ + __Pyx_RefNannyFinishContext(); + return __pyx_r; +} + +static PyObject *__pyx_memoryview___pyx_pf_15View_dot_MemoryView_10memoryview_22copy_fortran(struct __pyx_memoryview_obj *__pyx_v_self) { + __Pyx_memviewslice __pyx_v_src; + __Pyx_memviewslice __pyx_v_dst; + int __pyx_v_flags; + PyObject *__pyx_r = NULL; + __Pyx_RefNannyDeclarations + __Pyx_memviewslice __pyx_t_1; + PyObject *__pyx_t_2 = NULL; + int __pyx_lineno = 0; + const char *__pyx_filename = NULL; + int __pyx_clineno = 0; + __Pyx_RefNannySetupContext("copy_fortran", 0); + + /* "View.MemoryView":651 + * def copy_fortran(self): + * cdef __Pyx_memviewslice src, dst + * cdef int flags = self.flags & ~PyBUF_C_CONTIGUOUS # <<<<<<<<<<<<<< + * + * slice_copy(self, &src) +*/ + __pyx_v_flags = (__pyx_v_self->flags & (~PyBUF_C_CONTIGUOUS)); + + /* "View.MemoryView":653 + * cdef int flags = self.flags & ~PyBUF_C_CONTIGUOUS + * + * slice_copy(self, &src) # <<<<<<<<<<<<<< + * dst = slice_copy_contig(&src, "fortran", self.view.ndim, + * self.view.itemsize, +*/ + __pyx_memoryview_slice_copy(__pyx_v_self, (&__pyx_v_src)); + + /* "View.MemoryView":654 + * + * slice_copy(self, &src) + * dst = slice_copy_contig(&src, "fortran", self.view.ndim, # <<<<<<<<<<<<<< + * self.view.itemsize, + * flags|PyBUF_F_CONTIGUOUS, +*/ + __pyx_t_1 = __pyx_memoryview_copy_new_contig((&__pyx_v_src), ((char const *)"fortran"), __pyx_v_self->view.ndim, __pyx_v_self->view.itemsize, (__pyx_v_flags | PyBUF_F_CONTIGUOUS), __pyx_v_self->dtype_is_object); if (unlikely(PyErr_Occurred())) __PYX_ERR(1, 654, __pyx_L1_error) + __pyx_v_dst = __pyx_t_1; + + /* "View.MemoryView":659 + * self.dtype_is_object) + * + * return memoryview_copy_from_slice(self, &dst) # <<<<<<<<<<<<<< + * + * +*/ + __Pyx_XDECREF(__pyx_r); + __pyx_t_2 = __pyx_memoryview_copy_object_from_slice(__pyx_v_self, (&__pyx_v_dst)); if (unlikely(!__pyx_t_2)) __PYX_ERR(1, 659, __pyx_L1_error) + __Pyx_GOTREF(__pyx_t_2); + __pyx_r = __pyx_t_2; + __pyx_t_2 = 0; + goto __pyx_L0; + + /* "View.MemoryView":649 + * return memoryview_copy_from_slice(self, &mslice) + * + * def copy_fortran(self): # <<<<<<<<<<<<<< + * cdef __Pyx_memviewslice src, dst + * cdef int flags = self.flags & ~PyBUF_C_CONTIGUOUS +*/ + + /* function exit code */ + __pyx_L1_error:; + __Pyx_XDECREF(__pyx_t_2); + __Pyx_AddTraceback("View.MemoryView.memoryview.copy_fortran", __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___pyx_memoryview_1__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*/ +static PyObject *__pyx_pw___pyx_memoryview_1__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___pyx_memoryview___reduce_cython__(((struct __pyx_memoryview_obj *)__pyx_v_self)); + + /* function exit code */ + __Pyx_RefNannyFinishContext(); + return __pyx_r; +} + +static PyObject *__pyx_pf___pyx_memoryview___reduce_cython__(CYTHON_UNUSED struct __pyx_memoryview_obj *__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("View.MemoryView.memoryview.__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___pyx_memoryview_3__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*/ +static PyObject *__pyx_pw___pyx_memoryview_3__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("View.MemoryView.memoryview.__setstate_cython__", __pyx_clineno, __pyx_lineno, __pyx_filename); + __Pyx_RefNannyFinishContext(); + return NULL; + __pyx_L4_argument_unpacking_done:; + __pyx_r = __pyx_pf___pyx_memoryview_2__setstate_cython__(((struct __pyx_memoryview_obj *)__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___pyx_memoryview_2__setstate_cython__(CYTHON_UNUSED struct __pyx_memoryview_obj *__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("View.MemoryView.memoryview.__setstate_cython__", __pyx_clineno, __pyx_lineno, __pyx_filename); + __pyx_r = NULL; + __Pyx_XGIVEREF(__pyx_r); + __Pyx_RefNannyFinishContext(); + return __pyx_r; +} + +/* "View.MemoryView":662 + * + * + * @cname('__pyx_memoryview_new') # <<<<<<<<<<<<<< + * cdef memoryview_cwrapper(object o, int flags, bint dtype_is_object, const __Pyx_TypeInfo *typeinfo): + * cdef memoryview result = memoryview(o, flags, dtype_is_object) +*/ + +static PyObject *__pyx_memoryview_new(PyObject *__pyx_v_o, int __pyx_v_flags, int __pyx_v_dtype_is_object, __Pyx_TypeInfo const *__pyx_v_typeinfo) { + struct __pyx_memoryview_obj *__pyx_v_result = 0; + PyObject *__pyx_r = NULL; + __Pyx_RefNannyDeclarations + PyObject *__pyx_t_1 = NULL; + PyObject *__pyx_t_2 = NULL; + PyObject *__pyx_t_3 = NULL; + PyObject *__pyx_t_4 = NULL; + size_t __pyx_t_5; + int __pyx_lineno = 0; + const char *__pyx_filename = NULL; + int __pyx_clineno = 0; + __Pyx_RefNannySetupContext("memoryview_cwrapper", 0); + + /* "View.MemoryView":664 + * @cname('__pyx_memoryview_new') + * cdef memoryview_cwrapper(object o, int flags, bint dtype_is_object, const __Pyx_TypeInfo *typeinfo): + * cdef memoryview result = memoryview(o, flags, dtype_is_object) # <<<<<<<<<<<<<< + * result.typeinfo = typeinfo + * return result +*/ + __pyx_t_2 = NULL; + __pyx_t_3 = __Pyx_PyLong_From_int(__pyx_v_flags); if (unlikely(!__pyx_t_3)) __PYX_ERR(1, 664, __pyx_L1_error) + __Pyx_GOTREF(__pyx_t_3); + __pyx_t_4 = __Pyx_PyBool_FromLong(__pyx_v_dtype_is_object); if (unlikely(!__pyx_t_4)) __PYX_ERR(1, 664, __pyx_L1_error) + __Pyx_GOTREF(__pyx_t_4); + __pyx_t_5 = 1; + { + PyObject *__pyx_callargs[4] = {__pyx_t_2, __pyx_v_o, __pyx_t_3, __pyx_t_4}; + __pyx_t_1 = __Pyx_PyObject_FastCall((PyObject*)__pyx_mstate_global->__pyx_memoryview_type, __pyx_callargs+__pyx_t_5, (4-__pyx_t_5) | (__pyx_t_5*__Pyx_PY_VECTORCALL_ARGUMENTS_OFFSET)); + __Pyx_XDECREF(__pyx_t_2); __pyx_t_2 = 0; + __Pyx_DECREF(__pyx_t_3); __pyx_t_3 = 0; + __Pyx_DECREF(__pyx_t_4); __pyx_t_4 = 0; + if (unlikely(!__pyx_t_1)) __PYX_ERR(1, 664, __pyx_L1_error) + __Pyx_GOTREF((PyObject *)__pyx_t_1); + } + __pyx_v_result = ((struct __pyx_memoryview_obj *)__pyx_t_1); + __pyx_t_1 = 0; + + /* "View.MemoryView":665 + * cdef memoryview_cwrapper(object o, int flags, bint dtype_is_object, const __Pyx_TypeInfo *typeinfo): + * cdef memoryview result = memoryview(o, flags, dtype_is_object) + * result.typeinfo = typeinfo # <<<<<<<<<<<<<< + * return result + * +*/ + __pyx_v_result->typeinfo = __pyx_v_typeinfo; + + /* "View.MemoryView":666 + * cdef memoryview result = memoryview(o, flags, dtype_is_object) + * result.typeinfo = typeinfo + * return result # <<<<<<<<<<<<<< + * + * @cname('__pyx_memoryview_check') +*/ + __Pyx_XDECREF(__pyx_r); + __Pyx_INCREF((PyObject *)__pyx_v_result); + __pyx_r = ((PyObject *)__pyx_v_result); + goto __pyx_L0; + + /* "View.MemoryView":662 + * + * + * @cname('__pyx_memoryview_new') # <<<<<<<<<<<<<< + * cdef memoryview_cwrapper(object o, int flags, bint dtype_is_object, const __Pyx_TypeInfo *typeinfo): + * cdef memoryview result = memoryview(o, flags, dtype_is_object) +*/ + + /* function exit code */ + __pyx_L1_error:; + __Pyx_XDECREF(__pyx_t_1); + __Pyx_XDECREF(__pyx_t_2); + __Pyx_XDECREF(__pyx_t_3); + __Pyx_XDECREF(__pyx_t_4); + __Pyx_AddTraceback("View.MemoryView.memoryview_cwrapper", __pyx_clineno, __pyx_lineno, __pyx_filename); + __pyx_r = 0; + __pyx_L0:; + __Pyx_XDECREF((PyObject *)__pyx_v_result); + __Pyx_XGIVEREF(__pyx_r); + __Pyx_RefNannyFinishContext(); + return __pyx_r; +} + +/* "View.MemoryView":668 + * return result + * + * @cname('__pyx_memoryview_check') # <<<<<<<<<<<<<< + * cdef inline bint memoryview_check(object o) noexcept: + * return isinstance(o, memoryview) +*/ + +static CYTHON_INLINE int __pyx_memoryview_check(PyObject *__pyx_v_o) { + int __pyx_r; + int __pyx_t_1; + + /* "View.MemoryView":670 + * @cname('__pyx_memoryview_check') + * cdef inline bint memoryview_check(object o) noexcept: + * return isinstance(o, memoryview) # <<<<<<<<<<<<<< + * + * cdef tuple _unellipsify(object index, int ndim): +*/ + __pyx_t_1 = __Pyx_TypeCheck(__pyx_v_o, __pyx_mstate_global->__pyx_memoryview_type); + __pyx_r = __pyx_t_1; + goto __pyx_L0; + + /* "View.MemoryView":668 + * return result + * + * @cname('__pyx_memoryview_check') # <<<<<<<<<<<<<< + * cdef inline bint memoryview_check(object o) noexcept: + * return isinstance(o, memoryview) +*/ + + /* function exit code */ + __pyx_L0:; + return __pyx_r; +} + +/* "View.MemoryView":672 + * return isinstance(o, memoryview) + * + * cdef tuple _unellipsify(object index, int ndim): # <<<<<<<<<<<<<< + * """ + * Replace all ellipses with full slices and fill incomplete indices with +*/ + +static PyObject *_unellipsify(PyObject *__pyx_v_index, int __pyx_v_ndim) { + Py_ssize_t __pyx_v_idx; + PyObject *__pyx_v_tup = NULL; + PyObject *__pyx_v_result = NULL; + int __pyx_v_have_slices; + int __pyx_v_seen_ellipsis; + PyObject *__pyx_v_item = NULL; + Py_ssize_t __pyx_v_nslices; + PyObject *__pyx_r = NULL; + __Pyx_RefNannyDeclarations + PyObject *__pyx_t_1 = NULL; + int __pyx_t_2; + PyObject *__pyx_t_3 = NULL; + Py_ssize_t __pyx_t_4; + Py_ssize_t __pyx_t_5; + PyObject *__pyx_t_6[3]; + PyObject *__pyx_t_7 = NULL; + int __pyx_lineno = 0; + const char *__pyx_filename = NULL; + int __pyx_clineno = 0; + __Pyx_RefNannySetupContext("_unellipsify", 0); + + /* "View.MemoryView":678 + * """ + * cdef Py_ssize_t idx + * tup = index if isinstance(index, tuple) else (index,) # <<<<<<<<<<<<<< + * + * result = [slice(None)] * ndim +*/ + __pyx_t_2 = PyTuple_Check(__pyx_v_index); + if (__pyx_t_2) { + __Pyx_INCREF(((PyObject*)__pyx_v_index)); + __pyx_t_1 = __pyx_v_index; + } else { + __pyx_t_3 = PyTuple_New(1); if (unlikely(!__pyx_t_3)) __PYX_ERR(1, 678, __pyx_L1_error) + __Pyx_GOTREF(__pyx_t_3); + __Pyx_INCREF(__pyx_v_index); + __Pyx_GIVEREF(__pyx_v_index); + if (__Pyx_PyTuple_SET_ITEM(__pyx_t_3, 0, __pyx_v_index) != (0)) __PYX_ERR(1, 678, __pyx_L1_error); + __pyx_t_1 = __pyx_t_3; + __pyx_t_3 = 0; + } + __pyx_v_tup = ((PyObject*)__pyx_t_1); + __pyx_t_1 = 0; + + /* "View.MemoryView":680 + * tup = index if isinstance(index, tuple) else (index,) + * + * result = [slice(None)] * ndim # <<<<<<<<<<<<<< + * have_slices = False + * seen_ellipsis = False +*/ + __pyx_t_1 = PyList_New(1 * ((__pyx_v_ndim<0) ? 0:__pyx_v_ndim)); if (unlikely(!__pyx_t_1)) __PYX_ERR(1, 680, __pyx_L1_error) + __Pyx_GOTREF(__pyx_t_1); + { Py_ssize_t __pyx_temp; + for (__pyx_temp=0; __pyx_temp < __pyx_v_ndim; __pyx_temp++) { + __Pyx_INCREF(__pyx_mstate_global->__pyx_slice[0]); + __Pyx_GIVEREF(__pyx_mstate_global->__pyx_slice[0]); + if (__Pyx_PyList_SET_ITEM(__pyx_t_1, __pyx_temp, __pyx_mstate_global->__pyx_slice[0]) != (0)) __PYX_ERR(1, 680, __pyx_L1_error); + } + } + __pyx_v_result = ((PyObject*)__pyx_t_1); + __pyx_t_1 = 0; + + /* "View.MemoryView":681 + * + * result = [slice(None)] * ndim + * have_slices = False # <<<<<<<<<<<<<< + * seen_ellipsis = False + * idx = 0 +*/ + __pyx_v_have_slices = 0; + + /* "View.MemoryView":682 + * result = [slice(None)] * ndim + * have_slices = False + * seen_ellipsis = False # <<<<<<<<<<<<<< + * idx = 0 + * for item in tup: +*/ + __pyx_v_seen_ellipsis = 0; + + /* "View.MemoryView":683 + * have_slices = False + * seen_ellipsis = False + * idx = 0 # <<<<<<<<<<<<<< + * for item in tup: + * if item is Ellipsis: +*/ + __pyx_v_idx = 0; + + /* "View.MemoryView":684 + * seen_ellipsis = False + * idx = 0 + * for item in tup: # <<<<<<<<<<<<<< + * if item is Ellipsis: + * if not seen_ellipsis: +*/ + if (unlikely(__pyx_v_tup == Py_None)) { + PyErr_SetString(PyExc_TypeError, "'NoneType' object is not iterable"); + __PYX_ERR(1, 684, __pyx_L1_error) + } + __pyx_t_1 = __pyx_v_tup; __Pyx_INCREF(__pyx_t_1); + __pyx_t_4 = 0; + for (;;) { + { + Py_ssize_t __pyx_temp = __Pyx_PyTuple_GET_SIZE(__pyx_t_1); + #if !CYTHON_ASSUME_SAFE_SIZE + if (unlikely((__pyx_temp < 0))) __PYX_ERR(1, 684, __pyx_L1_error) + #endif + if (__pyx_t_4 >= __pyx_temp) break; + } + #if CYTHON_ASSUME_SAFE_MACROS && !CYTHON_AVOID_BORROWED_REFS + __pyx_t_3 = __Pyx_NewRef(PyTuple_GET_ITEM(__pyx_t_1, __pyx_t_4)); + #else + __pyx_t_3 = __Pyx_PySequence_ITEM(__pyx_t_1, __pyx_t_4); + #endif + ++__pyx_t_4; + if (unlikely(!__pyx_t_3)) __PYX_ERR(1, 684, __pyx_L1_error) + __Pyx_GOTREF(__pyx_t_3); + __Pyx_XDECREF_SET(__pyx_v_item, __pyx_t_3); + __pyx_t_3 = 0; + + /* "View.MemoryView":685 + * idx = 0 + * for item in tup: + * if item is Ellipsis: # <<<<<<<<<<<<<< + * if not seen_ellipsis: + * idx += ndim - len(tup) +*/ + __pyx_t_2 = (__pyx_v_item == __pyx_builtin_Ellipsis); + if (__pyx_t_2) { + + /* "View.MemoryView":686 + * for item in tup: + * if item is Ellipsis: + * if not seen_ellipsis: # <<<<<<<<<<<<<< + * idx += ndim - len(tup) + * seen_ellipsis = True +*/ + __pyx_t_2 = (!__pyx_v_seen_ellipsis); + if (__pyx_t_2) { + + /* "View.MemoryView":687 + * if item is Ellipsis: + * if not seen_ellipsis: + * idx += ndim - len(tup) # <<<<<<<<<<<<<< + * seen_ellipsis = True + * have_slices = True +*/ + if (unlikely(__pyx_v_tup == Py_None)) { + PyErr_SetString(PyExc_TypeError, "object of type 'NoneType' has no len()"); + __PYX_ERR(1, 687, __pyx_L1_error) + } + __pyx_t_5 = __Pyx_PyTuple_GET_SIZE(__pyx_v_tup); if (unlikely(__pyx_t_5 == ((Py_ssize_t)-1))) __PYX_ERR(1, 687, __pyx_L1_error) + __pyx_v_idx = (__pyx_v_idx + (__pyx_v_ndim - __pyx_t_5)); + + /* "View.MemoryView":688 + * if not seen_ellipsis: + * idx += ndim - len(tup) + * seen_ellipsis = True # <<<<<<<<<<<<<< + * have_slices = True + * else: +*/ + __pyx_v_seen_ellipsis = 1; + + /* "View.MemoryView":686 + * for item in tup: + * if item is Ellipsis: + * if not seen_ellipsis: # <<<<<<<<<<<<<< + * idx += ndim - len(tup) + * seen_ellipsis = True +*/ + } + + /* "View.MemoryView":689 + * idx += ndim - len(tup) + * seen_ellipsis = True + * have_slices = True # <<<<<<<<<<<<<< + * else: + * if isinstance(item, slice): +*/ + __pyx_v_have_slices = 1; + + /* "View.MemoryView":685 + * idx = 0 + * for item in tup: + * if item is Ellipsis: # <<<<<<<<<<<<<< + * if not seen_ellipsis: + * idx += ndim - len(tup) +*/ + goto __pyx_L5; + } + + /* "View.MemoryView":691 + * have_slices = True + * else: + * if isinstance(item, slice): # <<<<<<<<<<<<<< + * have_slices = True + * elif not PyIndex_Check(item): +*/ + /*else*/ { + __pyx_t_2 = PySlice_Check(__pyx_v_item); + if (__pyx_t_2) { + + /* "View.MemoryView":692 + * else: + * if isinstance(item, slice): + * have_slices = True # <<<<<<<<<<<<<< + * elif not PyIndex_Check(item): + * raise TypeError, f"Cannot index with type '{type(item)}'" +*/ + __pyx_v_have_slices = 1; + + /* "View.MemoryView":691 + * have_slices = True + * else: + * if isinstance(item, slice): # <<<<<<<<<<<<<< + * have_slices = True + * elif not PyIndex_Check(item): +*/ + goto __pyx_L7; + } + + /* "View.MemoryView":693 + * if isinstance(item, slice): + * have_slices = True + * elif not PyIndex_Check(item): # <<<<<<<<<<<<<< + * raise TypeError, f"Cannot index with type '{type(item)}'" + * result[idx] = item +*/ + __pyx_t_2 = (!(PyIndex_Check(__pyx_v_item) != 0)); + if (unlikely(__pyx_t_2)) { + + /* "View.MemoryView":694 + * have_slices = True + * elif not PyIndex_Check(item): + * raise TypeError, f"Cannot index with type '{type(item)}'" # <<<<<<<<<<<<<< + * result[idx] = item + * idx += 1 +*/ + __pyx_t_3 = __Pyx_PyObject_FormatSimple(((PyObject *)Py_TYPE(__pyx_v_item)), __pyx_mstate_global->__pyx_empty_unicode); if (unlikely(!__pyx_t_3)) __PYX_ERR(1, 694, __pyx_L1_error) + __Pyx_GOTREF(__pyx_t_3); + __pyx_t_6[0] = __pyx_mstate_global->__pyx_kp_u_Cannot_index_with_type; + __pyx_t_6[1] = __pyx_t_3; + __pyx_t_6[2] = __pyx_mstate_global->__pyx_kp_u__4; + __pyx_t_7 = __Pyx_PyUnicode_Join(__pyx_t_6, 3, 24 + __Pyx_PyUnicode_GET_LENGTH(__pyx_t_3) + 1, 127 | __Pyx_PyUnicode_MAX_CHAR_VALUE(__pyx_t_3)); + if (unlikely(!__pyx_t_7)) __PYX_ERR(1, 694, __pyx_L1_error) + __Pyx_GOTREF(__pyx_t_7); + __Pyx_DECREF(__pyx_t_3); __pyx_t_3 = 0; + __Pyx_Raise(((PyObject *)(((PyTypeObject*)PyExc_TypeError))), __pyx_t_7, 0, 0); + __Pyx_DECREF(__pyx_t_7); __pyx_t_7 = 0; + __PYX_ERR(1, 694, __pyx_L1_error) + + /* "View.MemoryView":693 + * if isinstance(item, slice): + * have_slices = True + * elif not PyIndex_Check(item): # <<<<<<<<<<<<<< + * raise TypeError, f"Cannot index with type '{type(item)}'" + * result[idx] = item +*/ + } + __pyx_L7:; + + /* "View.MemoryView":695 + * elif not PyIndex_Check(item): + * raise TypeError, f"Cannot index with type '{type(item)}'" + * result[idx] = item # <<<<<<<<<<<<<< + * idx += 1 + * +*/ + if (unlikely((__Pyx_SetItemInt(__pyx_v_result, __pyx_v_idx, __pyx_v_item, Py_ssize_t, 1, PyLong_FromSsize_t, 1, 1, 1, 1, __Pyx_ReferenceSharing_OwnStrongReference) < 0))) __PYX_ERR(1, 695, __pyx_L1_error) + } + __pyx_L5:; + + /* "View.MemoryView":696 + * raise TypeError, f"Cannot index with type '{type(item)}'" + * result[idx] = item + * idx += 1 # <<<<<<<<<<<<<< + * + * nslices = ndim - idx +*/ + __pyx_v_idx = (__pyx_v_idx + 1); + + /* "View.MemoryView":684 + * seen_ellipsis = False + * idx = 0 + * for item in tup: # <<<<<<<<<<<<<< + * if item is Ellipsis: + * if not seen_ellipsis: +*/ + } + __Pyx_DECREF(__pyx_t_1); __pyx_t_1 = 0; + + /* "View.MemoryView":698 + * idx += 1 + * + * nslices = ndim - idx # <<<<<<<<<<<<<< + * return have_slices or nslices, tuple(result) + * +*/ + __pyx_v_nslices = (__pyx_v_ndim - __pyx_v_idx); + + /* "View.MemoryView":699 + * + * nslices = ndim - idx + * return have_slices or nslices, tuple(result) # <<<<<<<<<<<<<< + * + * cdef int assert_direct_dimensions(Py_ssize_t *suboffsets, int ndim) except -1: +*/ + __Pyx_XDECREF(__pyx_r); + if (!__pyx_v_have_slices) { + } else { + __pyx_t_7 = __Pyx_PyBool_FromLong(__pyx_v_have_slices); if (unlikely(!__pyx_t_7)) __PYX_ERR(1, 699, __pyx_L1_error) + __Pyx_GOTREF(__pyx_t_7); + __pyx_t_1 = __pyx_t_7; + __pyx_t_7 = 0; + goto __pyx_L9_bool_binop_done; + } + __pyx_t_7 = PyLong_FromSsize_t(__pyx_v_nslices); if (unlikely(!__pyx_t_7)) __PYX_ERR(1, 699, __pyx_L1_error) + __Pyx_GOTREF(__pyx_t_7); + __pyx_t_1 = __pyx_t_7; + __pyx_t_7 = 0; + __pyx_L9_bool_binop_done:; + __pyx_t_7 = PyList_AsTuple(__pyx_v_result); if (unlikely(!__pyx_t_7)) __PYX_ERR(1, 699, __pyx_L1_error) + __Pyx_GOTREF(__pyx_t_7); + __pyx_t_3 = PyTuple_New(2); if (unlikely(!__pyx_t_3)) __PYX_ERR(1, 699, __pyx_L1_error) + __Pyx_GOTREF(__pyx_t_3); + __Pyx_GIVEREF(__pyx_t_1); + if (__Pyx_PyTuple_SET_ITEM(__pyx_t_3, 0, __pyx_t_1) != (0)) __PYX_ERR(1, 699, __pyx_L1_error); + __Pyx_GIVEREF(__pyx_t_7); + if (__Pyx_PyTuple_SET_ITEM(__pyx_t_3, 1, __pyx_t_7) != (0)) __PYX_ERR(1, 699, __pyx_L1_error); + __pyx_t_1 = 0; + __pyx_t_7 = 0; + __pyx_r = ((PyObject*)__pyx_t_3); + __pyx_t_3 = 0; + goto __pyx_L0; + + /* "View.MemoryView":672 + * return isinstance(o, memoryview) + * + * cdef tuple _unellipsify(object index, int ndim): # <<<<<<<<<<<<<< + * """ + * Replace all ellipses with full slices and fill incomplete indices with +*/ + + /* function exit code */ + __pyx_L1_error:; + __Pyx_XDECREF(__pyx_t_1); + __Pyx_XDECREF(__pyx_t_3); + __Pyx_XDECREF(__pyx_t_7); + __Pyx_AddTraceback("View.MemoryView._unellipsify", __pyx_clineno, __pyx_lineno, __pyx_filename); + __pyx_r = 0; + __pyx_L0:; + __Pyx_XDECREF(__pyx_v_tup); + __Pyx_XDECREF(__pyx_v_result); + __Pyx_XDECREF(__pyx_v_item); + __Pyx_XGIVEREF(__pyx_r); + __Pyx_RefNannyFinishContext(); + return __pyx_r; +} + +/* "View.MemoryView":701 + * return have_slices or nslices, tuple(result) + * + * cdef int assert_direct_dimensions(Py_ssize_t *suboffsets, int ndim) except -1: # <<<<<<<<<<<<<< + * for suboffset in suboffsets[:ndim]: + * if suboffset >= 0: +*/ + +static int assert_direct_dimensions(Py_ssize_t *__pyx_v_suboffsets, int __pyx_v_ndim) { + Py_ssize_t __pyx_v_suboffset; + int __pyx_r; + Py_ssize_t *__pyx_t_1; + Py_ssize_t *__pyx_t_2; + Py_ssize_t *__pyx_t_3; + int __pyx_t_4; + int __pyx_lineno = 0; + const char *__pyx_filename = NULL; + int __pyx_clineno = 0; + + /* "View.MemoryView":702 + * + * cdef int assert_direct_dimensions(Py_ssize_t *suboffsets, int ndim) except -1: + * for suboffset in suboffsets[:ndim]: # <<<<<<<<<<<<<< + * if suboffset >= 0: + * raise ValueError, "Indirect dimensions not supported" +*/ + __pyx_t_2 = (__pyx_v_suboffsets + __pyx_v_ndim); + for (__pyx_t_3 = __pyx_v_suboffsets; __pyx_t_3 < __pyx_t_2; __pyx_t_3++) { + __pyx_t_1 = __pyx_t_3; + __pyx_v_suboffset = (__pyx_t_1[0]); + + /* "View.MemoryView":703 + * cdef int assert_direct_dimensions(Py_ssize_t *suboffsets, int ndim) except -1: + * for suboffset in suboffsets[:ndim]: + * if suboffset >= 0: # <<<<<<<<<<<<<< + * raise ValueError, "Indirect dimensions not supported" + * return 0 # return type just used as an error flag +*/ + __pyx_t_4 = (__pyx_v_suboffset >= 0); + if (unlikely(__pyx_t_4)) { + + /* "View.MemoryView":704 + * for suboffset in suboffsets[:ndim]: + * if suboffset >= 0: + * raise ValueError, "Indirect dimensions not supported" # <<<<<<<<<<<<<< + * return 0 # return type just used as an error flag + * +*/ + __Pyx_Raise(((PyObject *)(((PyTypeObject*)PyExc_ValueError))), __pyx_mstate_global->__pyx_kp_u_Indirect_dimensions_not_supporte, 0, 0); + __PYX_ERR(1, 704, __pyx_L1_error) + + /* "View.MemoryView":703 + * cdef int assert_direct_dimensions(Py_ssize_t *suboffsets, int ndim) except -1: + * for suboffset in suboffsets[:ndim]: + * if suboffset >= 0: # <<<<<<<<<<<<<< + * raise ValueError, "Indirect dimensions not supported" + * return 0 # return type just used as an error flag +*/ + } + } + + /* "View.MemoryView":705 + * if suboffset >= 0: + * raise ValueError, "Indirect dimensions not supported" + * return 0 # return type just used as an error flag # <<<<<<<<<<<<<< + * + * +*/ + __pyx_r = 0; + goto __pyx_L0; + + /* "View.MemoryView":701 + * return have_slices or nslices, tuple(result) + * + * cdef int assert_direct_dimensions(Py_ssize_t *suboffsets, int ndim) except -1: # <<<<<<<<<<<<<< + * for suboffset in suboffsets[:ndim]: + * if suboffset >= 0: +*/ + + /* function exit code */ + __pyx_L1_error:; + __Pyx_AddTraceback("View.MemoryView.assert_direct_dimensions", __pyx_clineno, __pyx_lineno, __pyx_filename); + __pyx_r = -1; + __pyx_L0:; + return __pyx_r; +} + +/* "View.MemoryView":711 + * + * + * @cname('__pyx_memview_slice') # <<<<<<<<<<<<<< + * cdef memoryview memview_slice(memoryview memview, object indices): + * cdef int new_ndim = 0, suboffset_dim = -1, dim +*/ + +static struct __pyx_memoryview_obj *__pyx_memview_slice(struct __pyx_memoryview_obj *__pyx_v_memview, PyObject *__pyx_v_indices) { + int __pyx_v_new_ndim; + int __pyx_v_suboffset_dim; + int __pyx_v_dim; + __Pyx_memviewslice __pyx_v_src; + __Pyx_memviewslice __pyx_v_dst; + __Pyx_memviewslice *__pyx_v_p_src; + struct __pyx_memoryviewslice_obj *__pyx_v_memviewsliceobj = 0; + __Pyx_memviewslice *__pyx_v_p_dst; + int *__pyx_v_p_suboffset_dim; + Py_ssize_t __pyx_v_start; + Py_ssize_t __pyx_v_stop; + Py_ssize_t __pyx_v_step; + Py_ssize_t __pyx_v_cindex; + int __pyx_v_have_start; + int __pyx_v_have_stop; + int __pyx_v_have_step; + PyObject *__pyx_v_index = NULL; + struct __pyx_memoryview_obj *__pyx_r = NULL; + __Pyx_RefNannyDeclarations + int __pyx_t_1; + PyObject *__pyx_t_2 = NULL; + struct __pyx_memoryview_obj *__pyx_t_3; + char *__pyx_t_4; + int __pyx_t_5; + Py_ssize_t __pyx_t_6; + PyObject *(*__pyx_t_7)(PyObject *); + PyObject *__pyx_t_8 = NULL; + Py_ssize_t __pyx_t_9; + int __pyx_t_10; + Py_ssize_t __pyx_t_11; + int __pyx_lineno = 0; + const char *__pyx_filename = NULL; + int __pyx_clineno = 0; + __Pyx_RefNannySetupContext("memview_slice", 0); + + /* "View.MemoryView":713 + * @cname('__pyx_memview_slice') + * cdef memoryview memview_slice(memoryview memview, object indices): + * cdef int new_ndim = 0, suboffset_dim = -1, dim # <<<<<<<<<<<<<< + * cdef bint negative_step + * cdef __Pyx_memviewslice src, dst +*/ + __pyx_v_new_ndim = 0; + __pyx_v_suboffset_dim = -1; + + /* "View.MemoryView":720 + * + * + * memset(&dst, 0, sizeof(dst)) # <<<<<<<<<<<<<< + * + * cdef _memoryviewslice memviewsliceobj +*/ + (void)(memset((&__pyx_v_dst), 0, (sizeof(__pyx_v_dst)))); + + /* "View.MemoryView":724 + * cdef _memoryviewslice memviewsliceobj + * + * assert memview.view.ndim > 0 # <<<<<<<<<<<<<< + * + * if isinstance(memview, _memoryviewslice): +*/ + #ifndef CYTHON_WITHOUT_ASSERTIONS + if (unlikely(__pyx_assertions_enabled())) { + __pyx_t_1 = (__pyx_v_memview->view.ndim > 0); + if (unlikely(!__pyx_t_1)) { + __Pyx_Raise(((PyObject *)(((PyTypeObject*)PyExc_AssertionError))), 0, 0, 0); + __PYX_ERR(1, 724, __pyx_L1_error) + } + } + #else + if ((1)); else __PYX_ERR(1, 724, __pyx_L1_error) + #endif + + /* "View.MemoryView":726 + * assert memview.view.ndim > 0 + * + * if isinstance(memview, _memoryviewslice): # <<<<<<<<<<<<<< + * memviewsliceobj = memview + * p_src = &memviewsliceobj.from_slice +*/ + __pyx_t_1 = __Pyx_TypeCheck(((PyObject *)__pyx_v_memview), __pyx_mstate_global->__pyx_memoryviewslice_type); + if (__pyx_t_1) { + + /* "View.MemoryView":727 + * + * if isinstance(memview, _memoryviewslice): + * memviewsliceobj = memview # <<<<<<<<<<<<<< + * p_src = &memviewsliceobj.from_slice + * else: +*/ + __pyx_t_2 = ((PyObject *)__pyx_v_memview); + __Pyx_INCREF(__pyx_t_2); + if (!(likely(((__pyx_t_2) == Py_None) || likely(__Pyx_TypeTest(__pyx_t_2, __pyx_mstate_global->__pyx_memoryviewslice_type))))) __PYX_ERR(1, 727, __pyx_L1_error) + __pyx_v_memviewsliceobj = ((struct __pyx_memoryviewslice_obj *)__pyx_t_2); + __pyx_t_2 = 0; + + /* "View.MemoryView":728 + * if isinstance(memview, _memoryviewslice): + * memviewsliceobj = memview + * p_src = &memviewsliceobj.from_slice # <<<<<<<<<<<<<< + * else: + * slice_copy(memview, &src) +*/ + __pyx_v_p_src = (&__pyx_v_memviewsliceobj->from_slice); + + /* "View.MemoryView":726 + * assert memview.view.ndim > 0 + * + * if isinstance(memview, _memoryviewslice): # <<<<<<<<<<<<<< + * memviewsliceobj = memview + * p_src = &memviewsliceobj.from_slice +*/ + goto __pyx_L3; + } + + /* "View.MemoryView":730 + * p_src = &memviewsliceobj.from_slice + * else: + * slice_copy(memview, &src) # <<<<<<<<<<<<<< + * p_src = &src + * +*/ + /*else*/ { + __pyx_memoryview_slice_copy(__pyx_v_memview, (&__pyx_v_src)); + + /* "View.MemoryView":731 + * else: + * slice_copy(memview, &src) + * p_src = &src # <<<<<<<<<<<<<< + * + * +*/ + __pyx_v_p_src = (&__pyx_v_src); + } + __pyx_L3:; + + /* "View.MemoryView":737 + * + * + * dst.memview = p_src.memview # <<<<<<<<<<<<<< + * dst.data = p_src.data + * +*/ + __pyx_t_3 = __pyx_v_p_src->memview; + __pyx_v_dst.memview = __pyx_t_3; + + /* "View.MemoryView":738 + * + * dst.memview = p_src.memview + * dst.data = p_src.data # <<<<<<<<<<<<<< + * + * +*/ + __pyx_t_4 = __pyx_v_p_src->data; + __pyx_v_dst.data = __pyx_t_4; + + /* "View.MemoryView":743 + * + * + * cdef __Pyx_memviewslice *p_dst = &dst # <<<<<<<<<<<<<< + * cdef int *p_suboffset_dim = &suboffset_dim + * cdef Py_ssize_t start, stop, step, cindex +*/ + __pyx_v_p_dst = (&__pyx_v_dst); + + /* "View.MemoryView":744 + * + * cdef __Pyx_memviewslice *p_dst = &dst + * cdef int *p_suboffset_dim = &suboffset_dim # <<<<<<<<<<<<<< + * cdef Py_ssize_t start, stop, step, cindex + * cdef bint have_start, have_stop, have_step +*/ + __pyx_v_p_suboffset_dim = (&__pyx_v_suboffset_dim); + + /* "View.MemoryView":748 + * cdef bint have_start, have_stop, have_step + * + * for dim, index in enumerate(indices): # <<<<<<<<<<<<<< + * if PyIndex_Check(index): + * cindex = index +*/ + __pyx_t_5 = 0; + if (likely(PyList_CheckExact(__pyx_v_indices)) || PyTuple_CheckExact(__pyx_v_indices)) { + __pyx_t_2 = __pyx_v_indices; __Pyx_INCREF(__pyx_t_2); + __pyx_t_6 = 0; + __pyx_t_7 = NULL; + } else { + __pyx_t_6 = -1; __pyx_t_2 = PyObject_GetIter(__pyx_v_indices); if (unlikely(!__pyx_t_2)) __PYX_ERR(1, 748, __pyx_L1_error) + __Pyx_GOTREF(__pyx_t_2); + __pyx_t_7 = (CYTHON_COMPILING_IN_LIMITED_API) ? PyIter_Next : __Pyx_PyObject_GetIterNextFunc(__pyx_t_2); if (unlikely(!__pyx_t_7)) __PYX_ERR(1, 748, __pyx_L1_error) + } + for (;;) { + if (likely(!__pyx_t_7)) { + if (likely(PyList_CheckExact(__pyx_t_2))) { + { + Py_ssize_t __pyx_temp = __Pyx_PyList_GET_SIZE(__pyx_t_2); + #if !CYTHON_ASSUME_SAFE_SIZE + if (unlikely((__pyx_temp < 0))) __PYX_ERR(1, 748, __pyx_L1_error) + #endif + if (__pyx_t_6 >= __pyx_temp) break; + } + __pyx_t_8 = __Pyx_PyList_GetItemRefFast(__pyx_t_2, __pyx_t_6, __Pyx_ReferenceSharing_OwnStrongReference); + ++__pyx_t_6; + } else { + { + Py_ssize_t __pyx_temp = __Pyx_PyTuple_GET_SIZE(__pyx_t_2); + #if !CYTHON_ASSUME_SAFE_SIZE + if (unlikely((__pyx_temp < 0))) __PYX_ERR(1, 748, __pyx_L1_error) + #endif + if (__pyx_t_6 >= __pyx_temp) break; + } + #if CYTHON_ASSUME_SAFE_MACROS && !CYTHON_AVOID_BORROWED_REFS + __pyx_t_8 = __Pyx_NewRef(PyTuple_GET_ITEM(__pyx_t_2, __pyx_t_6)); + #else + __pyx_t_8 = __Pyx_PySequence_ITEM(__pyx_t_2, __pyx_t_6); + #endif + ++__pyx_t_6; + } + if (unlikely(!__pyx_t_8)) __PYX_ERR(1, 748, __pyx_L1_error) + } else { + __pyx_t_8 = __pyx_t_7(__pyx_t_2); + if (unlikely(!__pyx_t_8)) { + PyObject* exc_type = PyErr_Occurred(); + if (exc_type) { + if (unlikely(!__Pyx_PyErr_GivenExceptionMatches(exc_type, PyExc_StopIteration))) __PYX_ERR(1, 748, __pyx_L1_error) + PyErr_Clear(); + } + break; + } + } + __Pyx_GOTREF(__pyx_t_8); + __Pyx_XDECREF_SET(__pyx_v_index, __pyx_t_8); + __pyx_t_8 = 0; + __pyx_v_dim = __pyx_t_5; + __pyx_t_5 = (__pyx_t_5 + 1); + + /* "View.MemoryView":749 + * + * for dim, index in enumerate(indices): + * if PyIndex_Check(index): # <<<<<<<<<<<<<< + * cindex = index + * slice_memviewslice( +*/ + __pyx_t_1 = (PyIndex_Check(__pyx_v_index) != 0); + if (__pyx_t_1) { + + /* "View.MemoryView":750 + * for dim, index in enumerate(indices): + * if PyIndex_Check(index): + * cindex = index # <<<<<<<<<<<<<< + * slice_memviewslice( + * p_dst, p_src.shape[dim], p_src.strides[dim], p_src.suboffsets[dim], +*/ + __pyx_t_9 = __Pyx_PyIndex_AsSsize_t(__pyx_v_index); if (unlikely((__pyx_t_9 == (Py_ssize_t)-1) && PyErr_Occurred())) __PYX_ERR(1, 750, __pyx_L1_error) + __pyx_v_cindex = __pyx_t_9; + + /* "View.MemoryView":751 + * if PyIndex_Check(index): + * cindex = index + * slice_memviewslice( # <<<<<<<<<<<<<< + * p_dst, p_src.shape[dim], p_src.strides[dim], p_src.suboffsets[dim], + * dim, new_ndim, p_suboffset_dim, +*/ + __pyx_t_10 = __pyx_memoryview_slice_memviewslice(__pyx_v_p_dst, (__pyx_v_p_src->shape[__pyx_v_dim]), (__pyx_v_p_src->strides[__pyx_v_dim]), (__pyx_v_p_src->suboffsets[__pyx_v_dim]), __pyx_v_dim, __pyx_v_new_ndim, __pyx_v_p_suboffset_dim, __pyx_v_cindex, 0, 0, 0, 0, 0, 0); if (unlikely(__pyx_t_10 == ((int)-1))) __PYX_ERR(1, 751, __pyx_L1_error) + + /* "View.MemoryView":749 + * + * for dim, index in enumerate(indices): + * if PyIndex_Check(index): # <<<<<<<<<<<<<< + * cindex = index + * slice_memviewslice( +*/ + goto __pyx_L6; + } + + /* "View.MemoryView":757 + * 0, 0, 0, # have_{start,stop,step} + * False) + * elif index is None: # <<<<<<<<<<<<<< + * p_dst.shape[new_ndim] = 1 + * p_dst.strides[new_ndim] = 0 +*/ + __pyx_t_1 = (__pyx_v_index == Py_None); + if (__pyx_t_1) { + + /* "View.MemoryView":758 + * False) + * elif index is None: + * p_dst.shape[new_ndim] = 1 # <<<<<<<<<<<<<< + * p_dst.strides[new_ndim] = 0 + * p_dst.suboffsets[new_ndim] = -1 +*/ + (__pyx_v_p_dst->shape[__pyx_v_new_ndim]) = 1; + + /* "View.MemoryView":759 + * elif index is None: + * p_dst.shape[new_ndim] = 1 + * p_dst.strides[new_ndim] = 0 # <<<<<<<<<<<<<< + * p_dst.suboffsets[new_ndim] = -1 + * new_ndim += 1 +*/ + (__pyx_v_p_dst->strides[__pyx_v_new_ndim]) = 0; + + /* "View.MemoryView":760 + * p_dst.shape[new_ndim] = 1 + * p_dst.strides[new_ndim] = 0 + * p_dst.suboffsets[new_ndim] = -1 # <<<<<<<<<<<<<< + * new_ndim += 1 + * else: +*/ + (__pyx_v_p_dst->suboffsets[__pyx_v_new_ndim]) = -1L; + + /* "View.MemoryView":761 + * p_dst.strides[new_ndim] = 0 + * p_dst.suboffsets[new_ndim] = -1 + * new_ndim += 1 # <<<<<<<<<<<<<< + * else: + * start = index.start or 0 +*/ + __pyx_v_new_ndim = (__pyx_v_new_ndim + 1); + + /* "View.MemoryView":757 + * 0, 0, 0, # have_{start,stop,step} + * False) + * elif index is None: # <<<<<<<<<<<<<< + * p_dst.shape[new_ndim] = 1 + * p_dst.strides[new_ndim] = 0 +*/ + goto __pyx_L6; + } + + /* "View.MemoryView":763 + * new_ndim += 1 + * else: + * start = index.start or 0 # <<<<<<<<<<<<<< + * stop = index.stop or 0 + * step = index.step or 0 +*/ + /*else*/ { + __pyx_t_8 = __Pyx_PyObject_GetAttrStr(__pyx_v_index, __pyx_mstate_global->__pyx_n_u_start); if (unlikely(!__pyx_t_8)) __PYX_ERR(1, 763, __pyx_L1_error) + __Pyx_GOTREF(__pyx_t_8); + __pyx_t_1 = __Pyx_PyObject_IsTrue(__pyx_t_8); if (unlikely((__pyx_t_1 < 0))) __PYX_ERR(1, 763, __pyx_L1_error) + if (!__pyx_t_1) { + __Pyx_DECREF(__pyx_t_8); __pyx_t_8 = 0; + } else { + __pyx_t_11 = __Pyx_PyIndex_AsSsize_t(__pyx_t_8); if (unlikely((__pyx_t_11 == (Py_ssize_t)-1) && PyErr_Occurred())) __PYX_ERR(1, 763, __pyx_L1_error) + __pyx_t_9 = __pyx_t_11; + __Pyx_DECREF(__pyx_t_8); __pyx_t_8 = 0; + goto __pyx_L7_bool_binop_done; + } + __pyx_t_9 = 0; + __pyx_L7_bool_binop_done:; + __pyx_v_start = __pyx_t_9; + + /* "View.MemoryView":764 + * else: + * start = index.start or 0 + * stop = index.stop or 0 # <<<<<<<<<<<<<< + * step = index.step or 0 + * +*/ + __pyx_t_8 = __Pyx_PyObject_GetAttrStr(__pyx_v_index, __pyx_mstate_global->__pyx_n_u_stop); if (unlikely(!__pyx_t_8)) __PYX_ERR(1, 764, __pyx_L1_error) + __Pyx_GOTREF(__pyx_t_8); + __pyx_t_1 = __Pyx_PyObject_IsTrue(__pyx_t_8); if (unlikely((__pyx_t_1 < 0))) __PYX_ERR(1, 764, __pyx_L1_error) + if (!__pyx_t_1) { + __Pyx_DECREF(__pyx_t_8); __pyx_t_8 = 0; + } else { + __pyx_t_11 = __Pyx_PyIndex_AsSsize_t(__pyx_t_8); if (unlikely((__pyx_t_11 == (Py_ssize_t)-1) && PyErr_Occurred())) __PYX_ERR(1, 764, __pyx_L1_error) + __pyx_t_9 = __pyx_t_11; + __Pyx_DECREF(__pyx_t_8); __pyx_t_8 = 0; + goto __pyx_L9_bool_binop_done; + } + __pyx_t_9 = 0; + __pyx_L9_bool_binop_done:; + __pyx_v_stop = __pyx_t_9; + + /* "View.MemoryView":765 + * start = index.start or 0 + * stop = index.stop or 0 + * step = index.step or 0 # <<<<<<<<<<<<<< + * + * have_start = index.start is not None +*/ + __pyx_t_8 = __Pyx_PyObject_GetAttrStr(__pyx_v_index, __pyx_mstate_global->__pyx_n_u_step); if (unlikely(!__pyx_t_8)) __PYX_ERR(1, 765, __pyx_L1_error) + __Pyx_GOTREF(__pyx_t_8); + __pyx_t_1 = __Pyx_PyObject_IsTrue(__pyx_t_8); if (unlikely((__pyx_t_1 < 0))) __PYX_ERR(1, 765, __pyx_L1_error) + if (!__pyx_t_1) { + __Pyx_DECREF(__pyx_t_8); __pyx_t_8 = 0; + } else { + __pyx_t_11 = __Pyx_PyIndex_AsSsize_t(__pyx_t_8); if (unlikely((__pyx_t_11 == (Py_ssize_t)-1) && PyErr_Occurred())) __PYX_ERR(1, 765, __pyx_L1_error) + __pyx_t_9 = __pyx_t_11; + __Pyx_DECREF(__pyx_t_8); __pyx_t_8 = 0; + goto __pyx_L11_bool_binop_done; + } + __pyx_t_9 = 0; + __pyx_L11_bool_binop_done:; + __pyx_v_step = __pyx_t_9; + + /* "View.MemoryView":767 + * step = index.step or 0 + * + * have_start = index.start is not None # <<<<<<<<<<<<<< + * have_stop = index.stop is not None + * have_step = index.step is not None +*/ + __pyx_t_8 = __Pyx_PyObject_GetAttrStr(__pyx_v_index, __pyx_mstate_global->__pyx_n_u_start); if (unlikely(!__pyx_t_8)) __PYX_ERR(1, 767, __pyx_L1_error) + __Pyx_GOTREF(__pyx_t_8); + __pyx_t_1 = (__pyx_t_8 != Py_None); + __Pyx_DECREF(__pyx_t_8); __pyx_t_8 = 0; + __pyx_v_have_start = __pyx_t_1; + + /* "View.MemoryView":768 + * + * have_start = index.start is not None + * have_stop = index.stop is not None # <<<<<<<<<<<<<< + * have_step = index.step is not None + * +*/ + __pyx_t_8 = __Pyx_PyObject_GetAttrStr(__pyx_v_index, __pyx_mstate_global->__pyx_n_u_stop); if (unlikely(!__pyx_t_8)) __PYX_ERR(1, 768, __pyx_L1_error) + __Pyx_GOTREF(__pyx_t_8); + __pyx_t_1 = (__pyx_t_8 != Py_None); + __Pyx_DECREF(__pyx_t_8); __pyx_t_8 = 0; + __pyx_v_have_stop = __pyx_t_1; + + /* "View.MemoryView":769 + * have_start = index.start is not None + * have_stop = index.stop is not None + * have_step = index.step is not None # <<<<<<<<<<<<<< + * + * slice_memviewslice( +*/ + __pyx_t_8 = __Pyx_PyObject_GetAttrStr(__pyx_v_index, __pyx_mstate_global->__pyx_n_u_step); if (unlikely(!__pyx_t_8)) __PYX_ERR(1, 769, __pyx_L1_error) + __Pyx_GOTREF(__pyx_t_8); + __pyx_t_1 = (__pyx_t_8 != Py_None); + __Pyx_DECREF(__pyx_t_8); __pyx_t_8 = 0; + __pyx_v_have_step = __pyx_t_1; + + /* "View.MemoryView":771 + * have_step = index.step is not None + * + * slice_memviewslice( # <<<<<<<<<<<<<< + * p_dst, p_src.shape[dim], p_src.strides[dim], p_src.suboffsets[dim], + * dim, new_ndim, p_suboffset_dim, +*/ + __pyx_t_10 = __pyx_memoryview_slice_memviewslice(__pyx_v_p_dst, (__pyx_v_p_src->shape[__pyx_v_dim]), (__pyx_v_p_src->strides[__pyx_v_dim]), (__pyx_v_p_src->suboffsets[__pyx_v_dim]), __pyx_v_dim, __pyx_v_new_ndim, __pyx_v_p_suboffset_dim, __pyx_v_start, __pyx_v_stop, __pyx_v_step, __pyx_v_have_start, __pyx_v_have_stop, __pyx_v_have_step, 1); if (unlikely(__pyx_t_10 == ((int)-1))) __PYX_ERR(1, 771, __pyx_L1_error) + + /* "View.MemoryView":777 + * have_start, have_stop, have_step, + * True) + * new_ndim += 1 # <<<<<<<<<<<<<< + * + * if isinstance(memview, _memoryviewslice): +*/ + __pyx_v_new_ndim = (__pyx_v_new_ndim + 1); + } + __pyx_L6:; + + /* "View.MemoryView":748 + * cdef bint have_start, have_stop, have_step + * + * for dim, index in enumerate(indices): # <<<<<<<<<<<<<< + * if PyIndex_Check(index): + * cindex = index +*/ + } + __Pyx_DECREF(__pyx_t_2); __pyx_t_2 = 0; + + /* "View.MemoryView":779 + * new_ndim += 1 + * + * if isinstance(memview, _memoryviewslice): # <<<<<<<<<<<<<< + * return memoryview_fromslice(dst, new_ndim, + * memviewsliceobj.to_object_func, +*/ + __pyx_t_1 = __Pyx_TypeCheck(((PyObject *)__pyx_v_memview), __pyx_mstate_global->__pyx_memoryviewslice_type); + if (__pyx_t_1) { + + /* "View.MemoryView":780 + * + * if isinstance(memview, _memoryviewslice): + * return memoryview_fromslice(dst, new_ndim, # <<<<<<<<<<<<<< + * memviewsliceobj.to_object_func, + * memviewsliceobj.to_dtype_func, +*/ + __Pyx_XDECREF((PyObject *)__pyx_r); + + /* "View.MemoryView":781 + * if isinstance(memview, _memoryviewslice): + * return memoryview_fromslice(dst, new_ndim, + * memviewsliceobj.to_object_func, # <<<<<<<<<<<<<< + * memviewsliceobj.to_dtype_func, + * memview.dtype_is_object) +*/ + if (unlikely(!__pyx_v_memviewsliceobj)) { __Pyx_RaiseUnboundLocalError("memviewsliceobj"); __PYX_ERR(1, 781, __pyx_L1_error) } + + /* "View.MemoryView":782 + * return memoryview_fromslice(dst, new_ndim, + * memviewsliceobj.to_object_func, + * memviewsliceobj.to_dtype_func, # <<<<<<<<<<<<<< + * memview.dtype_is_object) + * else: +*/ + if (unlikely(!__pyx_v_memviewsliceobj)) { __Pyx_RaiseUnboundLocalError("memviewsliceobj"); __PYX_ERR(1, 782, __pyx_L1_error) } + + /* "View.MemoryView":780 + * + * if isinstance(memview, _memoryviewslice): + * return memoryview_fromslice(dst, new_ndim, # <<<<<<<<<<<<<< + * memviewsliceobj.to_object_func, + * memviewsliceobj.to_dtype_func, +*/ + __pyx_t_2 = __pyx_memoryview_fromslice(__pyx_v_dst, __pyx_v_new_ndim, __pyx_v_memviewsliceobj->to_object_func, __pyx_v_memviewsliceobj->to_dtype_func, __pyx_v_memview->dtype_is_object); if (unlikely(!__pyx_t_2)) __PYX_ERR(1, 780, __pyx_L1_error) + __Pyx_GOTREF(__pyx_t_2); + if (!(likely(((__pyx_t_2) == Py_None) || likely(__Pyx_TypeTest(__pyx_t_2, __pyx_mstate_global->__pyx_memoryview_type))))) __PYX_ERR(1, 780, __pyx_L1_error) + __pyx_r = ((struct __pyx_memoryview_obj *)__pyx_t_2); + __pyx_t_2 = 0; + goto __pyx_L0; + + /* "View.MemoryView":779 + * new_ndim += 1 + * + * if isinstance(memview, _memoryviewslice): # <<<<<<<<<<<<<< + * return memoryview_fromslice(dst, new_ndim, + * memviewsliceobj.to_object_func, +*/ + } + + /* "View.MemoryView":785 + * memview.dtype_is_object) + * else: + * return memoryview_fromslice(dst, new_ndim, NULL, NULL, # <<<<<<<<<<<<<< + * memview.dtype_is_object) + * +*/ + /*else*/ { + __Pyx_XDECREF((PyObject *)__pyx_r); + + /* "View.MemoryView":786 + * else: + * return memoryview_fromslice(dst, new_ndim, NULL, NULL, + * memview.dtype_is_object) # <<<<<<<<<<<<<< + * + * +*/ + __pyx_t_2 = __pyx_memoryview_fromslice(__pyx_v_dst, __pyx_v_new_ndim, NULL, NULL, __pyx_v_memview->dtype_is_object); if (unlikely(!__pyx_t_2)) __PYX_ERR(1, 785, __pyx_L1_error) + __Pyx_GOTREF(__pyx_t_2); + + /* "View.MemoryView":785 + * memview.dtype_is_object) + * else: + * return memoryview_fromslice(dst, new_ndim, NULL, NULL, # <<<<<<<<<<<<<< + * memview.dtype_is_object) + * +*/ + if (!(likely(((__pyx_t_2) == Py_None) || likely(__Pyx_TypeTest(__pyx_t_2, __pyx_mstate_global->__pyx_memoryview_type))))) __PYX_ERR(1, 785, __pyx_L1_error) + __pyx_r = ((struct __pyx_memoryview_obj *)__pyx_t_2); + __pyx_t_2 = 0; + goto __pyx_L0; + } + + /* "View.MemoryView":711 + * + * + * @cname('__pyx_memview_slice') # <<<<<<<<<<<<<< + * cdef memoryview memview_slice(memoryview memview, object indices): + * cdef int new_ndim = 0, suboffset_dim = -1, dim +*/ + + /* function exit code */ + __pyx_L1_error:; + __Pyx_XDECREF(__pyx_t_2); + __Pyx_XDECREF(__pyx_t_8); + __Pyx_AddTraceback("View.MemoryView.memview_slice", __pyx_clineno, __pyx_lineno, __pyx_filename); + __pyx_r = 0; + __pyx_L0:; + __Pyx_XDECREF((PyObject *)__pyx_v_memviewsliceobj); + __Pyx_XDECREF(__pyx_v_index); + __Pyx_XGIVEREF((PyObject *)__pyx_r); + __Pyx_RefNannyFinishContext(); + return __pyx_r; +} + +/* "View.MemoryView":793 + * + * + * @cname('__pyx_memoryview_slice_memviewslice') # <<<<<<<<<<<<<< + * cdef int slice_memviewslice( + * __Pyx_memviewslice *dst, +*/ + +static int __pyx_memoryview_slice_memviewslice(__Pyx_memviewslice *__pyx_v_dst, Py_ssize_t __pyx_v_shape, Py_ssize_t __pyx_v_stride, Py_ssize_t __pyx_v_suboffset, int __pyx_v_dim, int __pyx_v_new_ndim, int *__pyx_v_suboffset_dim, Py_ssize_t __pyx_v_start, Py_ssize_t __pyx_v_stop, Py_ssize_t __pyx_v_step, int __pyx_v_have_start, int __pyx_v_have_stop, int __pyx_v_have_step, int __pyx_v_is_slice) { + Py_ssize_t __pyx_v_new_shape; + int __pyx_v_negative_step; + int __pyx_r; + int __pyx_t_1; + int __pyx_t_2; + int __pyx_t_3; + int __pyx_lineno = 0; + const char *__pyx_filename = NULL; + int __pyx_clineno = 0; + PyGILState_STATE __pyx_gilstate_save; + + /* "View.MemoryView":814 + * cdef bint negative_step + * + * if not is_slice: # <<<<<<<<<<<<<< + * + * if start < 0: +*/ + __pyx_t_1 = (!__pyx_v_is_slice); + if (__pyx_t_1) { + + /* "View.MemoryView":816 + * if not is_slice: + * + * if start < 0: # <<<<<<<<<<<<<< + * start += shape + * if not 0 <= start < shape: +*/ + __pyx_t_1 = (__pyx_v_start < 0); + if (__pyx_t_1) { + + /* "View.MemoryView":817 + * + * if start < 0: + * start += shape # <<<<<<<<<<<<<< + * if not 0 <= start < shape: + * _err_dim(PyExc_IndexError, "Index out of bounds (axis %d)", dim) +*/ + __pyx_v_start = (__pyx_v_start + __pyx_v_shape); + + /* "View.MemoryView":816 + * if not is_slice: + * + * if start < 0: # <<<<<<<<<<<<<< + * start += shape + * if not 0 <= start < shape: +*/ + } + + /* "View.MemoryView":818 + * if start < 0: + * start += shape + * if not 0 <= start < shape: # <<<<<<<<<<<<<< + * _err_dim(PyExc_IndexError, "Index out of bounds (axis %d)", dim) + * else: +*/ + __pyx_t_1 = (0 <= __pyx_v_start); + if (__pyx_t_1) { + __pyx_t_1 = (__pyx_v_start < __pyx_v_shape); + } + __pyx_t_2 = (!__pyx_t_1); + if (__pyx_t_2) { + + /* "View.MemoryView":819 + * start += shape + * if not 0 <= start < shape: + * _err_dim(PyExc_IndexError, "Index out of bounds (axis %d)", dim) # <<<<<<<<<<<<<< + * else: + * +*/ + __pyx_t_3 = __pyx_memoryview_err_dim(PyExc_IndexError, __pyx_mstate_global->__pyx_kp_u_Index_out_of_bounds_axis_d, __pyx_v_dim); if (unlikely(__pyx_t_3 == ((int)-1))) __PYX_ERR(1, 819, __pyx_L1_error) + + /* "View.MemoryView":818 + * if start < 0: + * start += shape + * if not 0 <= start < shape: # <<<<<<<<<<<<<< + * _err_dim(PyExc_IndexError, "Index out of bounds (axis %d)", dim) + * else: +*/ + } + + /* "View.MemoryView":814 + * cdef bint negative_step + * + * if not is_slice: # <<<<<<<<<<<<<< + * + * if start < 0: +*/ + goto __pyx_L3; + } + + /* "View.MemoryView":822 + * else: + * + * if have_step: # <<<<<<<<<<<<<< + * negative_step = step < 0 + * if step == 0: +*/ + /*else*/ { + __pyx_t_2 = (__pyx_v_have_step != 0); + if (__pyx_t_2) { + + /* "View.MemoryView":823 + * + * if have_step: + * negative_step = step < 0 # <<<<<<<<<<<<<< + * if step == 0: + * _err_dim(PyExc_ValueError, "Step may not be zero (axis %d)", dim) +*/ + __pyx_v_negative_step = (__pyx_v_step < 0); + + /* "View.MemoryView":824 + * if have_step: + * negative_step = step < 0 + * if step == 0: # <<<<<<<<<<<<<< + * _err_dim(PyExc_ValueError, "Step may not be zero (axis %d)", dim) + * else: +*/ + __pyx_t_2 = (__pyx_v_step == 0); + if (__pyx_t_2) { + + /* "View.MemoryView":825 + * negative_step = step < 0 + * if step == 0: + * _err_dim(PyExc_ValueError, "Step may not be zero (axis %d)", dim) # <<<<<<<<<<<<<< + * else: + * negative_step = False +*/ + __pyx_t_3 = __pyx_memoryview_err_dim(PyExc_ValueError, __pyx_mstate_global->__pyx_kp_u_Step_may_not_be_zero_axis_d, __pyx_v_dim); if (unlikely(__pyx_t_3 == ((int)-1))) __PYX_ERR(1, 825, __pyx_L1_error) + + /* "View.MemoryView":824 + * if have_step: + * negative_step = step < 0 + * if step == 0: # <<<<<<<<<<<<<< + * _err_dim(PyExc_ValueError, "Step may not be zero (axis %d)", dim) + * else: +*/ + } + + /* "View.MemoryView":822 + * else: + * + * if have_step: # <<<<<<<<<<<<<< + * negative_step = step < 0 + * if step == 0: +*/ + goto __pyx_L6; + } + + /* "View.MemoryView":827 + * _err_dim(PyExc_ValueError, "Step may not be zero (axis %d)", dim) + * else: + * negative_step = False # <<<<<<<<<<<<<< + * step = 1 + * +*/ + /*else*/ { + __pyx_v_negative_step = 0; + + /* "View.MemoryView":828 + * else: + * negative_step = False + * step = 1 # <<<<<<<<<<<<<< + * + * +*/ + __pyx_v_step = 1; + } + __pyx_L6:; + + /* "View.MemoryView":831 + * + * + * if have_start: # <<<<<<<<<<<<<< + * if start < 0: + * start += shape +*/ + __pyx_t_2 = (__pyx_v_have_start != 0); + if (__pyx_t_2) { + + /* "View.MemoryView":832 + * + * if have_start: + * if start < 0: # <<<<<<<<<<<<<< + * start += shape + * if start < 0: +*/ + __pyx_t_2 = (__pyx_v_start < 0); + if (__pyx_t_2) { + + /* "View.MemoryView":833 + * if have_start: + * if start < 0: + * start += shape # <<<<<<<<<<<<<< + * if start < 0: + * start = 0 +*/ + __pyx_v_start = (__pyx_v_start + __pyx_v_shape); + + /* "View.MemoryView":834 + * if start < 0: + * start += shape + * if start < 0: # <<<<<<<<<<<<<< + * start = 0 + * elif start >= shape: +*/ + __pyx_t_2 = (__pyx_v_start < 0); + if (__pyx_t_2) { + + /* "View.MemoryView":835 + * start += shape + * if start < 0: + * start = 0 # <<<<<<<<<<<<<< + * elif start >= shape: + * if negative_step: +*/ + __pyx_v_start = 0; + + /* "View.MemoryView":834 + * if start < 0: + * start += shape + * if start < 0: # <<<<<<<<<<<<<< + * start = 0 + * elif start >= shape: +*/ + } + + /* "View.MemoryView":832 + * + * if have_start: + * if start < 0: # <<<<<<<<<<<<<< + * start += shape + * if start < 0: +*/ + goto __pyx_L9; + } + + /* "View.MemoryView":836 + * if start < 0: + * start = 0 + * elif start >= shape: # <<<<<<<<<<<<<< + * if negative_step: + * start = shape - 1 +*/ + __pyx_t_2 = (__pyx_v_start >= __pyx_v_shape); + if (__pyx_t_2) { + + /* "View.MemoryView":837 + * start = 0 + * elif start >= shape: + * if negative_step: # <<<<<<<<<<<<<< + * start = shape - 1 + * else: +*/ + if (__pyx_v_negative_step) { + + /* "View.MemoryView":838 + * elif start >= shape: + * if negative_step: + * start = shape - 1 # <<<<<<<<<<<<<< + * else: + * start = shape +*/ + __pyx_v_start = (__pyx_v_shape - 1); + + /* "View.MemoryView":837 + * start = 0 + * elif start >= shape: + * if negative_step: # <<<<<<<<<<<<<< + * start = shape - 1 + * else: +*/ + goto __pyx_L11; + } + + /* "View.MemoryView":840 + * start = shape - 1 + * else: + * start = shape # <<<<<<<<<<<<<< + * else: + * if negative_step: +*/ + /*else*/ { + __pyx_v_start = __pyx_v_shape; + } + __pyx_L11:; + + /* "View.MemoryView":836 + * if start < 0: + * start = 0 + * elif start >= shape: # <<<<<<<<<<<<<< + * if negative_step: + * start = shape - 1 +*/ + } + __pyx_L9:; + + /* "View.MemoryView":831 + * + * + * if have_start: # <<<<<<<<<<<<<< + * if start < 0: + * start += shape +*/ + goto __pyx_L8; + } + + /* "View.MemoryView":842 + * start = shape + * else: + * if negative_step: # <<<<<<<<<<<<<< + * start = shape - 1 + * else: +*/ + /*else*/ { + if (__pyx_v_negative_step) { + + /* "View.MemoryView":843 + * else: + * if negative_step: + * start = shape - 1 # <<<<<<<<<<<<<< + * else: + * start = 0 +*/ + __pyx_v_start = (__pyx_v_shape - 1); + + /* "View.MemoryView":842 + * start = shape + * else: + * if negative_step: # <<<<<<<<<<<<<< + * start = shape - 1 + * else: +*/ + goto __pyx_L12; + } + + /* "View.MemoryView":845 + * start = shape - 1 + * else: + * start = 0 # <<<<<<<<<<<<<< + * + * if have_stop: +*/ + /*else*/ { + __pyx_v_start = 0; + } + __pyx_L12:; + } + __pyx_L8:; + + /* "View.MemoryView":847 + * start = 0 + * + * if have_stop: # <<<<<<<<<<<<<< + * if stop < 0: + * stop += shape +*/ + __pyx_t_2 = (__pyx_v_have_stop != 0); + if (__pyx_t_2) { + + /* "View.MemoryView":848 + * + * if have_stop: + * if stop < 0: # <<<<<<<<<<<<<< + * stop += shape + * if stop < 0: +*/ + __pyx_t_2 = (__pyx_v_stop < 0); + if (__pyx_t_2) { + + /* "View.MemoryView":849 + * if have_stop: + * if stop < 0: + * stop += shape # <<<<<<<<<<<<<< + * if stop < 0: + * stop = 0 +*/ + __pyx_v_stop = (__pyx_v_stop + __pyx_v_shape); + + /* "View.MemoryView":850 + * if stop < 0: + * stop += shape + * if stop < 0: # <<<<<<<<<<<<<< + * stop = 0 + * elif stop > shape: +*/ + __pyx_t_2 = (__pyx_v_stop < 0); + if (__pyx_t_2) { + + /* "View.MemoryView":851 + * stop += shape + * if stop < 0: + * stop = 0 # <<<<<<<<<<<<<< + * elif stop > shape: + * stop = shape +*/ + __pyx_v_stop = 0; + + /* "View.MemoryView":850 + * if stop < 0: + * stop += shape + * if stop < 0: # <<<<<<<<<<<<<< + * stop = 0 + * elif stop > shape: +*/ + } + + /* "View.MemoryView":848 + * + * if have_stop: + * if stop < 0: # <<<<<<<<<<<<<< + * stop += shape + * if stop < 0: +*/ + goto __pyx_L14; + } + + /* "View.MemoryView":852 + * if stop < 0: + * stop = 0 + * elif stop > shape: # <<<<<<<<<<<<<< + * stop = shape + * else: +*/ + __pyx_t_2 = (__pyx_v_stop > __pyx_v_shape); + if (__pyx_t_2) { + + /* "View.MemoryView":853 + * stop = 0 + * elif stop > shape: + * stop = shape # <<<<<<<<<<<<<< + * else: + * if negative_step: +*/ + __pyx_v_stop = __pyx_v_shape; + + /* "View.MemoryView":852 + * if stop < 0: + * stop = 0 + * elif stop > shape: # <<<<<<<<<<<<<< + * stop = shape + * else: +*/ + } + __pyx_L14:; + + /* "View.MemoryView":847 + * start = 0 + * + * if have_stop: # <<<<<<<<<<<<<< + * if stop < 0: + * stop += shape +*/ + goto __pyx_L13; + } + + /* "View.MemoryView":855 + * stop = shape + * else: + * if negative_step: # <<<<<<<<<<<<<< + * stop = -1 + * else: +*/ + /*else*/ { + if (__pyx_v_negative_step) { + + /* "View.MemoryView":856 + * else: + * if negative_step: + * stop = -1 # <<<<<<<<<<<<<< + * else: + * stop = shape +*/ + __pyx_v_stop = -1L; + + /* "View.MemoryView":855 + * stop = shape + * else: + * if negative_step: # <<<<<<<<<<<<<< + * stop = -1 + * else: +*/ + goto __pyx_L16; + } + + /* "View.MemoryView":858 + * stop = -1 + * else: + * stop = shape # <<<<<<<<<<<<<< + * + * +*/ + /*else*/ { + __pyx_v_stop = __pyx_v_shape; + } + __pyx_L16:; + } + __pyx_L13:; + + /* "View.MemoryView":862 + * + * with cython.cdivision(True): + * new_shape = (stop - start) // step # <<<<<<<<<<<<<< + * + * if (stop - start) - step * new_shape: +*/ + __pyx_v_new_shape = ((__pyx_v_stop - __pyx_v_start) / __pyx_v_step); + + /* "View.MemoryView":864 + * new_shape = (stop - start) // step + * + * if (stop - start) - step * new_shape: # <<<<<<<<<<<<<< + * new_shape += 1 + * +*/ + __pyx_t_2 = (((__pyx_v_stop - __pyx_v_start) - (__pyx_v_step * __pyx_v_new_shape)) != 0); + if (__pyx_t_2) { + + /* "View.MemoryView":865 + * + * if (stop - start) - step * new_shape: + * new_shape += 1 # <<<<<<<<<<<<<< + * + * if new_shape < 0: +*/ + __pyx_v_new_shape = (__pyx_v_new_shape + 1); + + /* "View.MemoryView":864 + * new_shape = (stop - start) // step + * + * if (stop - start) - step * new_shape: # <<<<<<<<<<<<<< + * new_shape += 1 + * +*/ + } + + /* "View.MemoryView":867 + * new_shape += 1 + * + * if new_shape < 0: # <<<<<<<<<<<<<< + * new_shape = 0 + * +*/ + __pyx_t_2 = (__pyx_v_new_shape < 0); + if (__pyx_t_2) { + + /* "View.MemoryView":868 + * + * if new_shape < 0: + * new_shape = 0 # <<<<<<<<<<<<<< + * + * +*/ + __pyx_v_new_shape = 0; + + /* "View.MemoryView":867 + * new_shape += 1 + * + * if new_shape < 0: # <<<<<<<<<<<<<< + * new_shape = 0 + * +*/ + } + + /* "View.MemoryView":871 + * + * + * dst.strides[new_ndim] = stride * step # <<<<<<<<<<<<<< + * dst.shape[new_ndim] = new_shape + * dst.suboffsets[new_ndim] = suboffset +*/ + (__pyx_v_dst->strides[__pyx_v_new_ndim]) = (__pyx_v_stride * __pyx_v_step); + + /* "View.MemoryView":872 + * + * dst.strides[new_ndim] = stride * step + * dst.shape[new_ndim] = new_shape # <<<<<<<<<<<<<< + * dst.suboffsets[new_ndim] = suboffset + * +*/ + (__pyx_v_dst->shape[__pyx_v_new_ndim]) = __pyx_v_new_shape; + + /* "View.MemoryView":873 + * dst.strides[new_ndim] = stride * step + * dst.shape[new_ndim] = new_shape + * dst.suboffsets[new_ndim] = suboffset # <<<<<<<<<<<<<< + * + * +*/ + (__pyx_v_dst->suboffsets[__pyx_v_new_ndim]) = __pyx_v_suboffset; + } + __pyx_L3:; + + /* "View.MemoryView":876 + * + * + * if suboffset_dim[0] < 0: # <<<<<<<<<<<<<< + * dst.data += start * stride + * else: +*/ + __pyx_t_2 = ((__pyx_v_suboffset_dim[0]) < 0); + if (__pyx_t_2) { + + /* "View.MemoryView":877 + * + * if suboffset_dim[0] < 0: + * dst.data += start * stride # <<<<<<<<<<<<<< + * else: + * dst.suboffsets[suboffset_dim[0]] += start * stride +*/ + __pyx_v_dst->data = (__pyx_v_dst->data + (__pyx_v_start * __pyx_v_stride)); + + /* "View.MemoryView":876 + * + * + * if suboffset_dim[0] < 0: # <<<<<<<<<<<<<< + * dst.data += start * stride + * else: +*/ + goto __pyx_L19; + } + + /* "View.MemoryView":879 + * dst.data += start * stride + * else: + * dst.suboffsets[suboffset_dim[0]] += start * stride # <<<<<<<<<<<<<< + * + * if suboffset >= 0: +*/ + /*else*/ { + __pyx_t_3 = (__pyx_v_suboffset_dim[0]); + (__pyx_v_dst->suboffsets[__pyx_t_3]) = ((__pyx_v_dst->suboffsets[__pyx_t_3]) + (__pyx_v_start * __pyx_v_stride)); + } + __pyx_L19:; + + /* "View.MemoryView":881 + * dst.suboffsets[suboffset_dim[0]] += start * stride + * + * if suboffset >= 0: # <<<<<<<<<<<<<< + * if not is_slice: + * if new_ndim == 0: +*/ + __pyx_t_2 = (__pyx_v_suboffset >= 0); + if (__pyx_t_2) { + + /* "View.MemoryView":882 + * + * if suboffset >= 0: + * if not is_slice: # <<<<<<<<<<<<<< + * if new_ndim == 0: + * dst.data = ( dst.data)[0] + suboffset +*/ + __pyx_t_2 = (!__pyx_v_is_slice); + if (__pyx_t_2) { + + /* "View.MemoryView":883 + * if suboffset >= 0: + * if not is_slice: + * if new_ndim == 0: # <<<<<<<<<<<<<< + * dst.data = ( dst.data)[0] + suboffset + * else: +*/ + __pyx_t_2 = (__pyx_v_new_ndim == 0); + if (__pyx_t_2) { + + /* "View.MemoryView":884 + * if not is_slice: + * if new_ndim == 0: + * dst.data = ( dst.data)[0] + suboffset # <<<<<<<<<<<<<< + * else: + * _err_dim(PyExc_IndexError, "All dimensions preceding dimension %d " +*/ + __pyx_v_dst->data = ((((char **)__pyx_v_dst->data)[0]) + __pyx_v_suboffset); + + /* "View.MemoryView":883 + * if suboffset >= 0: + * if not is_slice: + * if new_ndim == 0: # <<<<<<<<<<<<<< + * dst.data = ( dst.data)[0] + suboffset + * else: +*/ + goto __pyx_L22; + } + + /* "View.MemoryView":886 + * dst.data = ( dst.data)[0] + suboffset + * else: + * _err_dim(PyExc_IndexError, "All dimensions preceding dimension %d " # <<<<<<<<<<<<<< + * "must be indexed and not sliced", dim) + * else: +*/ + /*else*/ { + + /* "View.MemoryView":887 + * else: + * _err_dim(PyExc_IndexError, "All dimensions preceding dimension %d " + * "must be indexed and not sliced", dim) # <<<<<<<<<<<<<< + * else: + * suboffset_dim[0] = new_ndim +*/ + __pyx_t_3 = __pyx_memoryview_err_dim(PyExc_IndexError, __pyx_mstate_global->__pyx_kp_u_All_dimensions_preceding_dimensi, __pyx_v_dim); if (unlikely(__pyx_t_3 == ((int)-1))) __PYX_ERR(1, 886, __pyx_L1_error) + } + __pyx_L22:; + + /* "View.MemoryView":882 + * + * if suboffset >= 0: + * if not is_slice: # <<<<<<<<<<<<<< + * if new_ndim == 0: + * dst.data = ( dst.data)[0] + suboffset +*/ + goto __pyx_L21; + } + + /* "View.MemoryView":889 + * "must be indexed and not sliced", dim) + * else: + * suboffset_dim[0] = new_ndim # <<<<<<<<<<<<<< + * + * return 0 +*/ + /*else*/ { + (__pyx_v_suboffset_dim[0]) = __pyx_v_new_ndim; + } + __pyx_L21:; + + /* "View.MemoryView":881 + * dst.suboffsets[suboffset_dim[0]] += start * stride + * + * if suboffset >= 0: # <<<<<<<<<<<<<< + * if not is_slice: + * if new_ndim == 0: +*/ + } + + /* "View.MemoryView":891 + * suboffset_dim[0] = new_ndim + * + * return 0 # <<<<<<<<<<<<<< + * + * +*/ + __pyx_r = 0; + goto __pyx_L0; + + /* "View.MemoryView":793 + * + * + * @cname('__pyx_memoryview_slice_memviewslice') # <<<<<<<<<<<<<< + * cdef int slice_memviewslice( + * __Pyx_memviewslice *dst, +*/ + + /* function exit code */ + __pyx_L1_error:; + __pyx_gilstate_save = __Pyx_PyGILState_Ensure(); + __Pyx_AddTraceback("View.MemoryView.slice_memviewslice", __pyx_clineno, __pyx_lineno, __pyx_filename); + __pyx_r = -1; + __Pyx_PyGILState_Release(__pyx_gilstate_save); + __pyx_L0:; + return __pyx_r; +} + +/* "View.MemoryView":896 + * + * + * @cname('__pyx_pybuffer_index') # <<<<<<<<<<<<<< + * cdef char *pybuffer_index(Py_buffer *view, char *bufp, Py_ssize_t index, + * Py_ssize_t dim) except NULL: +*/ + +static char *__pyx_pybuffer_index(Py_buffer *__pyx_v_view, char *__pyx_v_bufp, Py_ssize_t __pyx_v_index, Py_ssize_t __pyx_v_dim) { + Py_ssize_t __pyx_v_shape; + Py_ssize_t __pyx_v_stride; + Py_ssize_t __pyx_v_suboffset; + Py_ssize_t __pyx_v_itemsize; + char *__pyx_v_resultp; + char *__pyx_r; + __Pyx_RefNannyDeclarations + Py_ssize_t __pyx_t_1; + int __pyx_t_2; + PyObject *__pyx_t_3 = NULL; + PyObject *__pyx_t_4[3]; + PyObject *__pyx_t_5 = NULL; + int __pyx_lineno = 0; + const char *__pyx_filename = NULL; + int __pyx_clineno = 0; + __Pyx_RefNannySetupContext("pybuffer_index", 0); + + /* "View.MemoryView":899 + * cdef char *pybuffer_index(Py_buffer *view, char *bufp, Py_ssize_t index, + * Py_ssize_t dim) except NULL: + * cdef Py_ssize_t shape, stride, suboffset = -1 # <<<<<<<<<<<<<< + * cdef Py_ssize_t itemsize = view.itemsize + * cdef char *resultp +*/ + __pyx_v_suboffset = -1L; + + /* "View.MemoryView":900 + * Py_ssize_t dim) except NULL: + * cdef Py_ssize_t shape, stride, suboffset = -1 + * cdef Py_ssize_t itemsize = view.itemsize # <<<<<<<<<<<<<< + * cdef char *resultp + * +*/ + __pyx_t_1 = __pyx_v_view->itemsize; + __pyx_v_itemsize = __pyx_t_1; + + /* "View.MemoryView":903 + * cdef char *resultp + * + * if view.ndim == 0: # <<<<<<<<<<<<<< + * shape = view.len // itemsize + * stride = itemsize +*/ + __pyx_t_2 = (__pyx_v_view->ndim == 0); + if (__pyx_t_2) { + + /* "View.MemoryView":904 + * + * if view.ndim == 0: + * shape = view.len // itemsize # <<<<<<<<<<<<<< + * stride = itemsize + * else: +*/ + if (unlikely(__pyx_v_itemsize == 0)) { + PyErr_SetString(PyExc_ZeroDivisionError, "integer division or modulo by zero"); + __PYX_ERR(1, 904, __pyx_L1_error) + } + else if (sizeof(Py_ssize_t) == sizeof(long) && (!(((Py_ssize_t)-1) > 0)) && unlikely(__pyx_v_itemsize == (Py_ssize_t)-1) && unlikely(__Pyx_UNARY_NEG_WOULD_OVERFLOW(__pyx_v_view->len))) { + PyErr_SetString(PyExc_OverflowError, "value too large to perform division"); + __PYX_ERR(1, 904, __pyx_L1_error) + } + __pyx_v_shape = __Pyx_div_Py_ssize_t(__pyx_v_view->len, __pyx_v_itemsize, 0); + + /* "View.MemoryView":905 + * if view.ndim == 0: + * shape = view.len // itemsize + * stride = itemsize # <<<<<<<<<<<<<< + * else: + * shape = view.shape[dim] +*/ + __pyx_v_stride = __pyx_v_itemsize; + + /* "View.MemoryView":903 + * cdef char *resultp + * + * if view.ndim == 0: # <<<<<<<<<<<<<< + * shape = view.len // itemsize + * stride = itemsize +*/ + goto __pyx_L3; + } + + /* "View.MemoryView":907 + * stride = itemsize + * else: + * shape = view.shape[dim] # <<<<<<<<<<<<<< + * stride = view.strides[dim] + * if view.suboffsets != NULL: +*/ + /*else*/ { + __pyx_v_shape = (__pyx_v_view->shape[__pyx_v_dim]); + + /* "View.MemoryView":908 + * else: + * shape = view.shape[dim] + * stride = view.strides[dim] # <<<<<<<<<<<<<< + * if view.suboffsets != NULL: + * suboffset = view.suboffsets[dim] +*/ + __pyx_v_stride = (__pyx_v_view->strides[__pyx_v_dim]); + + /* "View.MemoryView":909 + * shape = view.shape[dim] + * stride = view.strides[dim] + * if view.suboffsets != NULL: # <<<<<<<<<<<<<< + * suboffset = view.suboffsets[dim] + * +*/ + __pyx_t_2 = (__pyx_v_view->suboffsets != NULL); + if (__pyx_t_2) { + + /* "View.MemoryView":910 + * stride = view.strides[dim] + * if view.suboffsets != NULL: + * suboffset = view.suboffsets[dim] # <<<<<<<<<<<<<< + * + * if index < 0: +*/ + __pyx_v_suboffset = (__pyx_v_view->suboffsets[__pyx_v_dim]); + + /* "View.MemoryView":909 + * shape = view.shape[dim] + * stride = view.strides[dim] + * if view.suboffsets != NULL: # <<<<<<<<<<<<<< + * suboffset = view.suboffsets[dim] + * +*/ + } + } + __pyx_L3:; + + /* "View.MemoryView":912 + * suboffset = view.suboffsets[dim] + * + * if index < 0: # <<<<<<<<<<<<<< + * index += view.shape[dim] + * if index < 0: +*/ + __pyx_t_2 = (__pyx_v_index < 0); + if (__pyx_t_2) { + + /* "View.MemoryView":913 + * + * if index < 0: + * index += view.shape[dim] # <<<<<<<<<<<<<< + * if index < 0: + * raise IndexError, f"Out of bounds on buffer access (axis {dim})" +*/ + __pyx_v_index = (__pyx_v_index + (__pyx_v_view->shape[__pyx_v_dim])); + + /* "View.MemoryView":914 + * if index < 0: + * index += view.shape[dim] + * if index < 0: # <<<<<<<<<<<<<< + * raise IndexError, f"Out of bounds on buffer access (axis {dim})" + * +*/ + __pyx_t_2 = (__pyx_v_index < 0); + if (unlikely(__pyx_t_2)) { + + /* "View.MemoryView":915 + * index += view.shape[dim] + * if index < 0: + * raise IndexError, f"Out of bounds on buffer access (axis {dim})" # <<<<<<<<<<<<<< + * + * if index >= shape: +*/ + __pyx_t_3 = __Pyx_PyUnicode_From_Py_ssize_t(__pyx_v_dim, 0, ' ', 'd'); if (unlikely(!__pyx_t_3)) __PYX_ERR(1, 915, __pyx_L1_error) + __Pyx_GOTREF(__pyx_t_3); + __pyx_t_4[0] = __pyx_mstate_global->__pyx_kp_u_Out_of_bounds_on_buffer_access_a; + __pyx_t_4[1] = __pyx_t_3; + __pyx_t_4[2] = __pyx_mstate_global->__pyx_kp_u__5; + __pyx_t_5 = __Pyx_PyUnicode_Join(__pyx_t_4, 3, 37 + __Pyx_PyUnicode_GET_LENGTH(__pyx_t_3) + 1, 127); + if (unlikely(!__pyx_t_5)) __PYX_ERR(1, 915, __pyx_L1_error) + __Pyx_GOTREF(__pyx_t_5); + __Pyx_DECREF(__pyx_t_3); __pyx_t_3 = 0; + __Pyx_Raise(((PyObject *)(((PyTypeObject*)PyExc_IndexError))), __pyx_t_5, 0, 0); + __Pyx_DECREF(__pyx_t_5); __pyx_t_5 = 0; + __PYX_ERR(1, 915, __pyx_L1_error) + + /* "View.MemoryView":914 + * if index < 0: + * index += view.shape[dim] + * if index < 0: # <<<<<<<<<<<<<< + * raise IndexError, f"Out of bounds on buffer access (axis {dim})" + * +*/ + } + + /* "View.MemoryView":912 + * suboffset = view.suboffsets[dim] + * + * if index < 0: # <<<<<<<<<<<<<< + * index += view.shape[dim] + * if index < 0: +*/ + } + + /* "View.MemoryView":917 + * raise IndexError, f"Out of bounds on buffer access (axis {dim})" + * + * if index >= shape: # <<<<<<<<<<<<<< + * raise IndexError, f"Out of bounds on buffer access (axis {dim})" + * +*/ + __pyx_t_2 = (__pyx_v_index >= __pyx_v_shape); + if (unlikely(__pyx_t_2)) { + + /* "View.MemoryView":918 + * + * if index >= shape: + * raise IndexError, f"Out of bounds on buffer access (axis {dim})" # <<<<<<<<<<<<<< + * + * resultp = bufp + index * stride +*/ + __pyx_t_5 = __Pyx_PyUnicode_From_Py_ssize_t(__pyx_v_dim, 0, ' ', 'd'); if (unlikely(!__pyx_t_5)) __PYX_ERR(1, 918, __pyx_L1_error) + __Pyx_GOTREF(__pyx_t_5); + __pyx_t_4[0] = __pyx_mstate_global->__pyx_kp_u_Out_of_bounds_on_buffer_access_a; + __pyx_t_4[1] = __pyx_t_5; + __pyx_t_4[2] = __pyx_mstate_global->__pyx_kp_u__5; + __pyx_t_3 = __Pyx_PyUnicode_Join(__pyx_t_4, 3, 37 + __Pyx_PyUnicode_GET_LENGTH(__pyx_t_5) + 1, 127); + if (unlikely(!__pyx_t_3)) __PYX_ERR(1, 918, __pyx_L1_error) + __Pyx_GOTREF(__pyx_t_3); + __Pyx_DECREF(__pyx_t_5); __pyx_t_5 = 0; + __Pyx_Raise(((PyObject *)(((PyTypeObject*)PyExc_IndexError))), __pyx_t_3, 0, 0); + __Pyx_DECREF(__pyx_t_3); __pyx_t_3 = 0; + __PYX_ERR(1, 918, __pyx_L1_error) + + /* "View.MemoryView":917 + * raise IndexError, f"Out of bounds on buffer access (axis {dim})" + * + * if index >= shape: # <<<<<<<<<<<<<< + * raise IndexError, f"Out of bounds on buffer access (axis {dim})" + * +*/ + } + + /* "View.MemoryView":920 + * raise IndexError, f"Out of bounds on buffer access (axis {dim})" + * + * resultp = bufp + index * stride # <<<<<<<<<<<<<< + * if suboffset >= 0: + * resultp = ( resultp)[0] + suboffset +*/ + __pyx_v_resultp = (__pyx_v_bufp + (__pyx_v_index * __pyx_v_stride)); + + /* "View.MemoryView":921 + * + * resultp = bufp + index * stride + * if suboffset >= 0: # <<<<<<<<<<<<<< + * resultp = ( resultp)[0] + suboffset + * +*/ + __pyx_t_2 = (__pyx_v_suboffset >= 0); + if (__pyx_t_2) { + + /* "View.MemoryView":922 + * resultp = bufp + index * stride + * if suboffset >= 0: + * resultp = ( resultp)[0] + suboffset # <<<<<<<<<<<<<< + * + * return resultp +*/ + __pyx_v_resultp = ((((char **)__pyx_v_resultp)[0]) + __pyx_v_suboffset); + + /* "View.MemoryView":921 + * + * resultp = bufp + index * stride + * if suboffset >= 0: # <<<<<<<<<<<<<< + * resultp = ( resultp)[0] + suboffset + * +*/ + } + + /* "View.MemoryView":924 + * resultp = ( resultp)[0] + suboffset + * + * return resultp # <<<<<<<<<<<<<< + * + * +*/ + __pyx_r = __pyx_v_resultp; + goto __pyx_L0; + + /* "View.MemoryView":896 + * + * + * @cname('__pyx_pybuffer_index') # <<<<<<<<<<<<<< + * cdef char *pybuffer_index(Py_buffer *view, char *bufp, Py_ssize_t index, + * Py_ssize_t dim) except NULL: +*/ + + /* function exit code */ + __pyx_L1_error:; + __Pyx_XDECREF(__pyx_t_3); + __Pyx_XDECREF(__pyx_t_5); + __Pyx_AddTraceback("View.MemoryView.pybuffer_index", __pyx_clineno, __pyx_lineno, __pyx_filename); + __pyx_r = NULL; + __pyx_L0:; + __Pyx_RefNannyFinishContext(); + return __pyx_r; +} + +/* "View.MemoryView":929 + * + * + * @cname('__pyx_memslice_transpose') # <<<<<<<<<<<<<< + * cdef int transpose_memslice(__Pyx_memviewslice *memslice) except -1 nogil: + * cdef int ndim = memslice.memview.view.ndim +*/ + +static int __pyx_memslice_transpose(__Pyx_memviewslice *__pyx_v_memslice) { + int __pyx_v_ndim; + Py_ssize_t *__pyx_v_shape; + Py_ssize_t *__pyx_v_strides; + int __pyx_v_i; + int __pyx_v_j; + int __pyx_r; + int __pyx_t_1; + Py_ssize_t *__pyx_t_2; + long __pyx_t_3; + long __pyx_t_4; + Py_ssize_t __pyx_t_5; + Py_ssize_t __pyx_t_6; + int __pyx_t_7; + int __pyx_t_8; + int __pyx_t_9; + int __pyx_lineno = 0; + const char *__pyx_filename = NULL; + int __pyx_clineno = 0; + PyGILState_STATE __pyx_gilstate_save; + + /* "View.MemoryView":931 + * @cname('__pyx_memslice_transpose') + * cdef int transpose_memslice(__Pyx_memviewslice *memslice) except -1 nogil: + * cdef int ndim = memslice.memview.view.ndim # <<<<<<<<<<<<<< + * + * cdef Py_ssize_t *shape = memslice.shape +*/ + __pyx_t_1 = __pyx_v_memslice->memview->view.ndim; + __pyx_v_ndim = __pyx_t_1; + + /* "View.MemoryView":933 + * cdef int ndim = memslice.memview.view.ndim + * + * cdef Py_ssize_t *shape = memslice.shape # <<<<<<<<<<<<<< + * cdef Py_ssize_t *strides = memslice.strides + * +*/ + __pyx_t_2 = __pyx_v_memslice->shape; + __pyx_v_shape = __pyx_t_2; + + /* "View.MemoryView":934 + * + * cdef Py_ssize_t *shape = memslice.shape + * cdef Py_ssize_t *strides = memslice.strides # <<<<<<<<<<<<<< + * + * +*/ + __pyx_t_2 = __pyx_v_memslice->strides; + __pyx_v_strides = __pyx_t_2; + + /* "View.MemoryView":938 + * + * cdef int i, j + * for i in range(ndim // 2): # <<<<<<<<<<<<<< + * j = ndim - 1 - i + * strides[i], strides[j] = strides[j], strides[i] +*/ + __pyx_t_3 = __Pyx_div_long(__pyx_v_ndim, 2, 1); + __pyx_t_4 = __pyx_t_3; + for (__pyx_t_1 = 0; __pyx_t_1 < __pyx_t_4; __pyx_t_1+=1) { + __pyx_v_i = __pyx_t_1; + + /* "View.MemoryView":939 + * cdef int i, j + * for i in range(ndim // 2): + * j = ndim - 1 - i # <<<<<<<<<<<<<< + * strides[i], strides[j] = strides[j], strides[i] + * shape[i], shape[j] = shape[j], shape[i] +*/ + __pyx_v_j = ((__pyx_v_ndim - 1) - __pyx_v_i); + + /* "View.MemoryView":940 + * for i in range(ndim // 2): + * j = ndim - 1 - i + * strides[i], strides[j] = strides[j], strides[i] # <<<<<<<<<<<<<< + * shape[i], shape[j] = shape[j], shape[i] + * +*/ + __pyx_t_5 = (__pyx_v_strides[__pyx_v_j]); + __pyx_t_6 = (__pyx_v_strides[__pyx_v_i]); + (__pyx_v_strides[__pyx_v_i]) = __pyx_t_5; + (__pyx_v_strides[__pyx_v_j]) = __pyx_t_6; + + /* "View.MemoryView":941 + * j = ndim - 1 - i + * strides[i], strides[j] = strides[j], strides[i] + * shape[i], shape[j] = shape[j], shape[i] # <<<<<<<<<<<<<< + * + * if memslice.suboffsets[i] >= 0 or memslice.suboffsets[j] >= 0: +*/ + __pyx_t_6 = (__pyx_v_shape[__pyx_v_j]); + __pyx_t_5 = (__pyx_v_shape[__pyx_v_i]); + (__pyx_v_shape[__pyx_v_i]) = __pyx_t_6; + (__pyx_v_shape[__pyx_v_j]) = __pyx_t_5; + + /* "View.MemoryView":943 + * shape[i], shape[j] = shape[j], shape[i] + * + * if memslice.suboffsets[i] >= 0 or memslice.suboffsets[j] >= 0: # <<<<<<<<<<<<<< + * _err(PyExc_ValueError, "Cannot transpose memoryview with indirect dimensions") + * +*/ + __pyx_t_8 = ((__pyx_v_memslice->suboffsets[__pyx_v_i]) >= 0); + if (!__pyx_t_8) { + } else { + __pyx_t_7 = __pyx_t_8; + goto __pyx_L6_bool_binop_done; + } + __pyx_t_8 = ((__pyx_v_memslice->suboffsets[__pyx_v_j]) >= 0); + __pyx_t_7 = __pyx_t_8; + __pyx_L6_bool_binop_done:; + if (__pyx_t_7) { + + /* "View.MemoryView":944 + * + * if memslice.suboffsets[i] >= 0 or memslice.suboffsets[j] >= 0: + * _err(PyExc_ValueError, "Cannot transpose memoryview with indirect dimensions") # <<<<<<<<<<<<<< + * + * return 0 +*/ + __pyx_t_9 = __pyx_memoryview_err(PyExc_ValueError, __pyx_mstate_global->__pyx_kp_u_Cannot_transpose_memoryview_with); if (unlikely(__pyx_t_9 == ((int)-1))) __PYX_ERR(1, 944, __pyx_L1_error) + + /* "View.MemoryView":943 + * shape[i], shape[j] = shape[j], shape[i] + * + * if memslice.suboffsets[i] >= 0 or memslice.suboffsets[j] >= 0: # <<<<<<<<<<<<<< + * _err(PyExc_ValueError, "Cannot transpose memoryview with indirect dimensions") + * +*/ + } + } + + /* "View.MemoryView":946 + * _err(PyExc_ValueError, "Cannot transpose memoryview with indirect dimensions") + * + * return 0 # <<<<<<<<<<<<<< + * + * +*/ + __pyx_r = 0; + goto __pyx_L0; + + /* "View.MemoryView":929 + * + * + * @cname('__pyx_memslice_transpose') # <<<<<<<<<<<<<< + * cdef int transpose_memslice(__Pyx_memviewslice *memslice) except -1 nogil: + * cdef int ndim = memslice.memview.view.ndim +*/ + + /* function exit code */ + __pyx_L1_error:; + __pyx_gilstate_save = __Pyx_PyGILState_Ensure(); + __Pyx_AddTraceback("View.MemoryView.transpose_memslice", __pyx_clineno, __pyx_lineno, __pyx_filename); + __pyx_r = -1; + __Pyx_PyGILState_Release(__pyx_gilstate_save); + __pyx_L0:; + return __pyx_r; +} + +/* "View.MemoryView":964 + * cdef int (*to_dtype_func)(char *, object) except 0 + * + * def __dealloc__(self): # <<<<<<<<<<<<<< + * __PYX_XCLEAR_MEMVIEW(&self.from_slice, 1) + * +*/ + +/* Python wrapper */ +static void __pyx_memoryviewslice___dealloc__(PyObject *__pyx_v_self); /*proto*/ +static void __pyx_memoryviewslice___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_memoryviewslice___pyx_pf_15View_dot_MemoryView_16_memoryviewslice___dealloc__(((struct __pyx_memoryviewslice_obj *)__pyx_v_self)); + + /* function exit code */ + __Pyx_RefNannyFinishContext(); +} + +static void __pyx_memoryviewslice___pyx_pf_15View_dot_MemoryView_16_memoryviewslice___dealloc__(struct __pyx_memoryviewslice_obj *__pyx_v_self) { + + /* "View.MemoryView":965 + * + * def __dealloc__(self): + * __PYX_XCLEAR_MEMVIEW(&self.from_slice, 1) # <<<<<<<<<<<<<< + * + * cdef convert_item_to_object(self, char *itemp): +*/ + __PYX_XCLEAR_MEMVIEW((&__pyx_v_self->from_slice), 1); + + /* "View.MemoryView":964 + * cdef int (*to_dtype_func)(char *, object) except 0 + * + * def __dealloc__(self): # <<<<<<<<<<<<<< + * __PYX_XCLEAR_MEMVIEW(&self.from_slice, 1) + * +*/ + + /* function exit code */ +} + +/* "View.MemoryView":967 + * __PYX_XCLEAR_MEMVIEW(&self.from_slice, 1) + * + * cdef convert_item_to_object(self, char *itemp): # <<<<<<<<<<<<<< + * if self.to_object_func != NULL: + * return self.to_object_func(itemp) +*/ + +static PyObject *__pyx_memoryviewslice_convert_item_to_object(struct __pyx_memoryviewslice_obj *__pyx_v_self, char *__pyx_v_itemp) { + 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("convert_item_to_object", 0); + + /* "View.MemoryView":968 + * + * cdef convert_item_to_object(self, char *itemp): + * if self.to_object_func != NULL: # <<<<<<<<<<<<<< + * return self.to_object_func(itemp) + * else: +*/ + __pyx_t_1 = (__pyx_v_self->to_object_func != NULL); + if (__pyx_t_1) { + + /* "View.MemoryView":969 + * cdef convert_item_to_object(self, char *itemp): + * if self.to_object_func != NULL: + * return self.to_object_func(itemp) # <<<<<<<<<<<<<< + * else: + * return memoryview.convert_item_to_object(self, itemp) +*/ + __Pyx_XDECREF(__pyx_r); + __pyx_t_2 = __pyx_v_self->to_object_func(__pyx_v_itemp); if (unlikely(!__pyx_t_2)) __PYX_ERR(1, 969, __pyx_L1_error) + __Pyx_GOTREF(__pyx_t_2); + __pyx_r = __pyx_t_2; + __pyx_t_2 = 0; + goto __pyx_L0; + + /* "View.MemoryView":968 + * + * cdef convert_item_to_object(self, char *itemp): + * if self.to_object_func != NULL: # <<<<<<<<<<<<<< + * return self.to_object_func(itemp) + * else: +*/ + } + + /* "View.MemoryView":971 + * return self.to_object_func(itemp) + * else: + * return memoryview.convert_item_to_object(self, itemp) # <<<<<<<<<<<<<< + * + * cdef assign_item_from_object(self, char *itemp, object value): +*/ + /*else*/ { + __Pyx_XDECREF(__pyx_r); + __pyx_t_2 = __pyx_memoryview_convert_item_to_object(((struct __pyx_memoryview_obj *)__pyx_v_self), __pyx_v_itemp); if (unlikely(!__pyx_t_2)) __PYX_ERR(1, 971, __pyx_L1_error) + __Pyx_GOTREF(__pyx_t_2); + __pyx_r = __pyx_t_2; + __pyx_t_2 = 0; + goto __pyx_L0; + } + + /* "View.MemoryView":967 + * __PYX_XCLEAR_MEMVIEW(&self.from_slice, 1) + * + * cdef convert_item_to_object(self, char *itemp): # <<<<<<<<<<<<<< + * if self.to_object_func != NULL: + * return self.to_object_func(itemp) +*/ + + /* function exit code */ + __pyx_L1_error:; + __Pyx_XDECREF(__pyx_t_2); + __Pyx_AddTraceback("View.MemoryView._memoryviewslice.convert_item_to_object", __pyx_clineno, __pyx_lineno, __pyx_filename); + __pyx_r = 0; + __pyx_L0:; + __Pyx_XGIVEREF(__pyx_r); + __Pyx_RefNannyFinishContext(); + return __pyx_r; +} + +/* "View.MemoryView":973 + * return memoryview.convert_item_to_object(self, itemp) + * + * cdef assign_item_from_object(self, char *itemp, object value): # <<<<<<<<<<<<<< + * if self.to_dtype_func != NULL: + * self.to_dtype_func(itemp, value) +*/ + +static PyObject *__pyx_memoryviewslice_assign_item_from_object(struct __pyx_memoryviewslice_obj *__pyx_v_self, char *__pyx_v_itemp, PyObject *__pyx_v_value) { + PyObject *__pyx_r = NULL; + __Pyx_RefNannyDeclarations + int __pyx_t_1; + int __pyx_t_2; + PyObject *__pyx_t_3 = NULL; + int __pyx_lineno = 0; + const char *__pyx_filename = NULL; + int __pyx_clineno = 0; + __Pyx_RefNannySetupContext("assign_item_from_object", 0); + + /* "View.MemoryView":974 + * + * cdef assign_item_from_object(self, char *itemp, object value): + * if self.to_dtype_func != NULL: # <<<<<<<<<<<<<< + * self.to_dtype_func(itemp, value) + * else: +*/ + __pyx_t_1 = (__pyx_v_self->to_dtype_func != NULL); + if (__pyx_t_1) { + + /* "View.MemoryView":975 + * cdef assign_item_from_object(self, char *itemp, object value): + * if self.to_dtype_func != NULL: + * self.to_dtype_func(itemp, value) # <<<<<<<<<<<<<< + * else: + * memoryview.assign_item_from_object(self, itemp, value) +*/ + __pyx_t_2 = __pyx_v_self->to_dtype_func(__pyx_v_itemp, __pyx_v_value); if (unlikely(__pyx_t_2 == ((int)0))) __PYX_ERR(1, 975, __pyx_L1_error) + + /* "View.MemoryView":974 + * + * cdef assign_item_from_object(self, char *itemp, object value): + * if self.to_dtype_func != NULL: # <<<<<<<<<<<<<< + * self.to_dtype_func(itemp, value) + * else: +*/ + goto __pyx_L3; + } + + /* "View.MemoryView":977 + * self.to_dtype_func(itemp, value) + * else: + * memoryview.assign_item_from_object(self, itemp, value) # <<<<<<<<<<<<<< + * + * cdef _get_base(self): +*/ + /*else*/ { + __pyx_t_3 = __pyx_memoryview_assign_item_from_object(((struct __pyx_memoryview_obj *)__pyx_v_self), __pyx_v_itemp, __pyx_v_value); if (unlikely(!__pyx_t_3)) __PYX_ERR(1, 977, __pyx_L1_error) + __Pyx_GOTREF(__pyx_t_3); + __Pyx_DECREF(__pyx_t_3); __pyx_t_3 = 0; + } + __pyx_L3:; + + /* "View.MemoryView":973 + * return memoryview.convert_item_to_object(self, itemp) + * + * cdef assign_item_from_object(self, char *itemp, object value): # <<<<<<<<<<<<<< + * if self.to_dtype_func != NULL: + * self.to_dtype_func(itemp, value) +*/ + + /* function exit code */ + __pyx_r = Py_None; __Pyx_INCREF(Py_None); + goto __pyx_L0; + __pyx_L1_error:; + __Pyx_XDECREF(__pyx_t_3); + __Pyx_AddTraceback("View.MemoryView._memoryviewslice.assign_item_from_object", __pyx_clineno, __pyx_lineno, __pyx_filename); + __pyx_r = 0; + __pyx_L0:; + __Pyx_XGIVEREF(__pyx_r); + __Pyx_RefNannyFinishContext(); + return __pyx_r; +} + +/* "View.MemoryView":979 + * memoryview.assign_item_from_object(self, itemp, value) + * + * cdef _get_base(self): # <<<<<<<<<<<<<< + * return self.from_object + * +*/ + +static PyObject *__pyx_memoryviewslice__get_base(struct __pyx_memoryviewslice_obj *__pyx_v_self) { + PyObject *__pyx_r = NULL; + __Pyx_RefNannyDeclarations + __Pyx_RefNannySetupContext("_get_base", 0); + + /* "View.MemoryView":980 + * + * cdef _get_base(self): + * return self.from_object # <<<<<<<<<<<<<< + * + * +*/ + __Pyx_XDECREF(__pyx_r); + __Pyx_INCREF(__pyx_v_self->from_object); + __pyx_r = __pyx_v_self->from_object; + goto __pyx_L0; + + /* "View.MemoryView":979 + * memoryview.assign_item_from_object(self, itemp, value) + * + * cdef _get_base(self): # <<<<<<<<<<<<<< + * return self.from_object + * +*/ + + /* function exit code */ + __pyx_L0:; + __Pyx_XGIVEREF(__pyx_r); + __Pyx_RefNannyFinishContext(); + return __pyx_r; +} + +/* "(tree fragment)":1 + * def __reduce_cython__(self): # <<<<<<<<<<<<<< + * raise TypeError, "no default __reduce__ due to non-trivial __cinit__" + * def __setstate_cython__(self, __pyx_state): +*/ + +/* Python wrapper */ +static PyObject *__pyx_pw___pyx_memoryviewslice_1__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*/ +static PyObject *__pyx_pw___pyx_memoryviewslice_1__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___pyx_memoryviewslice___reduce_cython__(((struct __pyx_memoryviewslice_obj *)__pyx_v_self)); + + /* function exit code */ + __Pyx_RefNannyFinishContext(); + return __pyx_r; +} + +static PyObject *__pyx_pf___pyx_memoryviewslice___reduce_cython__(CYTHON_UNUSED struct __pyx_memoryviewslice_obj *__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("View.MemoryView._memoryviewslice.__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___pyx_memoryviewslice_3__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*/ +static PyObject *__pyx_pw___pyx_memoryviewslice_3__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("View.MemoryView._memoryviewslice.__setstate_cython__", __pyx_clineno, __pyx_lineno, __pyx_filename); + __Pyx_RefNannyFinishContext(); + return NULL; + __pyx_L4_argument_unpacking_done:; + __pyx_r = __pyx_pf___pyx_memoryviewslice_2__setstate_cython__(((struct __pyx_memoryviewslice_obj *)__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___pyx_memoryviewslice_2__setstate_cython__(CYTHON_UNUSED struct __pyx_memoryviewslice_obj *__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("View.MemoryView._memoryviewslice.__setstate_cython__", __pyx_clineno, __pyx_lineno, __pyx_filename); + __pyx_r = NULL; + __Pyx_XGIVEREF(__pyx_r); + __Pyx_RefNannyFinishContext(); + return __pyx_r; +} + +/* "View.MemoryView":999 + * pass # ignore failure, it's a minor issue + * + * @cname('__pyx_memoryview_fromslice') # <<<<<<<<<<<<<< + * cdef memoryview_fromslice(__Pyx_memviewslice memviewslice, + * int ndim, +*/ + +static PyObject *__pyx_memoryview_fromslice(__Pyx_memviewslice __pyx_v_memviewslice, int __pyx_v_ndim, PyObject *(*__pyx_v_to_object_func)(char *), int (*__pyx_v_to_dtype_func)(char *, PyObject *), int __pyx_v_dtype_is_object) { + struct __pyx_memoryviewslice_obj *__pyx_v_result = 0; + Py_ssize_t __pyx_v_suboffset; + PyObject *__pyx_v_length = NULL; + PyObject *__pyx_r = NULL; + __Pyx_RefNannyDeclarations + int __pyx_t_1; + PyObject *__pyx_t_2 = NULL; + PyObject *__pyx_t_3 = NULL; + __Pyx_TypeInfo const *__pyx_t_4; + Py_buffer __pyx_t_5; + Py_ssize_t *__pyx_t_6; + Py_ssize_t *__pyx_t_7; + Py_ssize_t *__pyx_t_8; + Py_ssize_t __pyx_t_9; + int __pyx_lineno = 0; + const char *__pyx_filename = NULL; + int __pyx_clineno = 0; + __Pyx_RefNannySetupContext("memoryview_fromslice", 0); + + /* "View.MemoryView":1008 + * cdef _memoryviewslice result + * + * if memviewslice.memview == Py_None: # <<<<<<<<<<<<<< + * return None + * +*/ + __pyx_t_1 = (((PyObject *)__pyx_v_memviewslice.memview) == Py_None); + if (__pyx_t_1) { + + /* "View.MemoryView":1009 + * + * if memviewslice.memview == Py_None: + * return None # <<<<<<<<<<<<<< + * + * +*/ + __Pyx_XDECREF(__pyx_r); + __pyx_r = Py_None; __Pyx_INCREF(Py_None); + goto __pyx_L0; + + /* "View.MemoryView":1008 + * cdef _memoryviewslice result + * + * if memviewslice.memview == Py_None: # <<<<<<<<<<<<<< + * return None + * +*/ + } + + /* "View.MemoryView":1014 + * + * + * result = _memoryviewslice.__new__(_memoryviewslice, None, 0, dtype_is_object) # <<<<<<<<<<<<<< + * + * result.from_slice = memviewslice +*/ + __pyx_t_2 = __Pyx_PyBool_FromLong(__pyx_v_dtype_is_object); if (unlikely(!__pyx_t_2)) __PYX_ERR(1, 1014, __pyx_L1_error) + __Pyx_GOTREF(__pyx_t_2); + __pyx_t_3 = PyTuple_New(3); if (unlikely(!__pyx_t_3)) __PYX_ERR(1, 1014, __pyx_L1_error) + __Pyx_GOTREF(__pyx_t_3); + __Pyx_INCREF(Py_None); + __Pyx_GIVEREF(Py_None); + if (__Pyx_PyTuple_SET_ITEM(__pyx_t_3, 0, Py_None) != (0)) __PYX_ERR(1, 1014, __pyx_L1_error); + __Pyx_INCREF(__pyx_mstate_global->__pyx_int_0); + __Pyx_GIVEREF(__pyx_mstate_global->__pyx_int_0); + if (__Pyx_PyTuple_SET_ITEM(__pyx_t_3, 1, __pyx_mstate_global->__pyx_int_0) != (0)) __PYX_ERR(1, 1014, __pyx_L1_error); + __Pyx_GIVEREF(__pyx_t_2); + if (__Pyx_PyTuple_SET_ITEM(__pyx_t_3, 2, __pyx_t_2) != (0)) __PYX_ERR(1, 1014, __pyx_L1_error); + __pyx_t_2 = 0; + __pyx_t_2 = ((PyObject *)__pyx_tp_new__memoryviewslice(((PyTypeObject *)__pyx_mstate_global->__pyx_memoryviewslice_type), __pyx_t_3, NULL)); if (unlikely(!__pyx_t_2)) __PYX_ERR(1, 1014, __pyx_L1_error) + __Pyx_GOTREF((PyObject *)__pyx_t_2); + __Pyx_DECREF(__pyx_t_3); __pyx_t_3 = 0; + __pyx_v_result = ((struct __pyx_memoryviewslice_obj *)__pyx_t_2); + __pyx_t_2 = 0; + + /* "View.MemoryView":1016 + * result = _memoryviewslice.__new__(_memoryviewslice, None, 0, dtype_is_object) + * + * result.from_slice = memviewslice # <<<<<<<<<<<<<< + * __PYX_INC_MEMVIEW(&memviewslice, 1) + * +*/ + __pyx_v_result->from_slice = __pyx_v_memviewslice; + + /* "View.MemoryView":1017 + * + * result.from_slice = memviewslice + * __PYX_INC_MEMVIEW(&memviewslice, 1) # <<<<<<<<<<<<<< + * + * result.from_object = ( memviewslice.memview)._get_base() +*/ + __PYX_INC_MEMVIEW((&__pyx_v_memviewslice), 1); + + /* "View.MemoryView":1019 + * __PYX_INC_MEMVIEW(&memviewslice, 1) + * + * result.from_object = ( memviewslice.memview)._get_base() # <<<<<<<<<<<<<< + * result.typeinfo = memviewslice.memview.typeinfo + * +*/ + __pyx_t_2 = ((struct __pyx_vtabstruct_memoryview *)((struct __pyx_memoryview_obj *)__pyx_v_memviewslice.memview)->__pyx_vtab)->_get_base(((struct __pyx_memoryview_obj *)__pyx_v_memviewslice.memview)); if (unlikely(!__pyx_t_2)) __PYX_ERR(1, 1019, __pyx_L1_error) + __Pyx_GOTREF(__pyx_t_2); + __Pyx_GIVEREF(__pyx_t_2); + __Pyx_GOTREF(__pyx_v_result->from_object); + __Pyx_DECREF(__pyx_v_result->from_object); + __pyx_v_result->from_object = __pyx_t_2; + __pyx_t_2 = 0; + + /* "View.MemoryView":1020 + * + * result.from_object = ( memviewslice.memview)._get_base() + * result.typeinfo = memviewslice.memview.typeinfo # <<<<<<<<<<<<<< + * + * result.view = memviewslice.memview.view +*/ + __pyx_t_4 = __pyx_v_memviewslice.memview->typeinfo; + __pyx_v_result->__pyx_base.typeinfo = __pyx_t_4; + + /* "View.MemoryView":1022 + * result.typeinfo = memviewslice.memview.typeinfo + * + * result.view = memviewslice.memview.view # <<<<<<<<<<<<<< + * result.view.buf = memviewslice.data + * result.view.ndim = ndim +*/ + __pyx_t_5 = __pyx_v_memviewslice.memview->view; + __pyx_v_result->__pyx_base.view = __pyx_t_5; + + /* "View.MemoryView":1023 + * + * result.view = memviewslice.memview.view + * result.view.buf = memviewslice.data # <<<<<<<<<<<<<< + * result.view.ndim = ndim + * (<__pyx_buffer *> &result.view).obj = Py_None +*/ + __pyx_v_result->__pyx_base.view.buf = ((void *)__pyx_v_memviewslice.data); + + /* "View.MemoryView":1024 + * result.view = memviewslice.memview.view + * result.view.buf = memviewslice.data + * result.view.ndim = ndim # <<<<<<<<<<<<<< + * (<__pyx_buffer *> &result.view).obj = Py_None + * Py_INCREF(Py_None) +*/ + __pyx_v_result->__pyx_base.view.ndim = __pyx_v_ndim; + + /* "View.MemoryView":1025 + * result.view.buf = memviewslice.data + * result.view.ndim = ndim + * (<__pyx_buffer *> &result.view).obj = Py_None # <<<<<<<<<<<<<< + * Py_INCREF(Py_None) + * +*/ + ((Py_buffer *)(&__pyx_v_result->__pyx_base.view))->obj = Py_None; + + /* "View.MemoryView":1026 + * result.view.ndim = ndim + * (<__pyx_buffer *> &result.view).obj = Py_None + * Py_INCREF(Py_None) # <<<<<<<<<<<<<< + * + * if (memviewslice.memview).flags & PyBUF_WRITABLE: +*/ + Py_INCREF(Py_None); + + /* "View.MemoryView":1028 + * Py_INCREF(Py_None) + * + * if (memviewslice.memview).flags & PyBUF_WRITABLE: # <<<<<<<<<<<<<< + * result.flags = PyBUF_RECORDS + * else: +*/ + __pyx_t_1 = ((((struct __pyx_memoryview_obj *)__pyx_v_memviewslice.memview)->flags & PyBUF_WRITABLE) != 0); + if (__pyx_t_1) { + + /* "View.MemoryView":1029 + * + * if (memviewslice.memview).flags & PyBUF_WRITABLE: + * result.flags = PyBUF_RECORDS # <<<<<<<<<<<<<< + * else: + * result.flags = PyBUF_RECORDS_RO +*/ + __pyx_v_result->__pyx_base.flags = PyBUF_RECORDS; + + /* "View.MemoryView":1028 + * Py_INCREF(Py_None) + * + * if (memviewslice.memview).flags & PyBUF_WRITABLE: # <<<<<<<<<<<<<< + * result.flags = PyBUF_RECORDS + * else: +*/ + goto __pyx_L4; + } + + /* "View.MemoryView":1031 + * result.flags = PyBUF_RECORDS + * else: + * result.flags = PyBUF_RECORDS_RO # <<<<<<<<<<<<<< + * + * result.view.shape = result.from_slice.shape +*/ + /*else*/ { + __pyx_v_result->__pyx_base.flags = PyBUF_RECORDS_RO; + } + __pyx_L4:; + + /* "View.MemoryView":1033 + * result.flags = PyBUF_RECORDS_RO + * + * result.view.shape = result.from_slice.shape # <<<<<<<<<<<<<< + * result.view.strides = result.from_slice.strides + * +*/ + __pyx_v_result->__pyx_base.view.shape = ((Py_ssize_t *)__pyx_v_result->from_slice.shape); + + /* "View.MemoryView":1034 + * + * result.view.shape = result.from_slice.shape + * result.view.strides = result.from_slice.strides # <<<<<<<<<<<<<< + * + * +*/ + __pyx_v_result->__pyx_base.view.strides = ((Py_ssize_t *)__pyx_v_result->from_slice.strides); + + /* "View.MemoryView":1037 + * + * + * result.view.suboffsets = NULL # <<<<<<<<<<<<<< + * for suboffset in result.from_slice.suboffsets[:ndim]: + * if suboffset >= 0: +*/ + __pyx_v_result->__pyx_base.view.suboffsets = NULL; + + /* "View.MemoryView":1038 + * + * result.view.suboffsets = NULL + * for suboffset in result.from_slice.suboffsets[:ndim]: # <<<<<<<<<<<<<< + * if suboffset >= 0: + * result.view.suboffsets = result.from_slice.suboffsets +*/ + __pyx_t_7 = (__pyx_v_result->from_slice.suboffsets + __pyx_v_ndim); + for (__pyx_t_8 = __pyx_v_result->from_slice.suboffsets; __pyx_t_8 < __pyx_t_7; __pyx_t_8++) { + __pyx_t_6 = __pyx_t_8; + __pyx_v_suboffset = (__pyx_t_6[0]); + + /* "View.MemoryView":1039 + * result.view.suboffsets = NULL + * for suboffset in result.from_slice.suboffsets[:ndim]: + * if suboffset >= 0: # <<<<<<<<<<<<<< + * result.view.suboffsets = result.from_slice.suboffsets + * break +*/ + __pyx_t_1 = (__pyx_v_suboffset >= 0); + if (__pyx_t_1) { + + /* "View.MemoryView":1040 + * for suboffset in result.from_slice.suboffsets[:ndim]: + * if suboffset >= 0: + * result.view.suboffsets = result.from_slice.suboffsets # <<<<<<<<<<<<<< + * break + * +*/ + __pyx_v_result->__pyx_base.view.suboffsets = ((Py_ssize_t *)__pyx_v_result->from_slice.suboffsets); + + /* "View.MemoryView":1041 + * if suboffset >= 0: + * result.view.suboffsets = result.from_slice.suboffsets + * break # <<<<<<<<<<<<<< + * + * result.view.len = result.view.itemsize +*/ + goto __pyx_L6_break; + + /* "View.MemoryView":1039 + * result.view.suboffsets = NULL + * for suboffset in result.from_slice.suboffsets[:ndim]: + * if suboffset >= 0: # <<<<<<<<<<<<<< + * result.view.suboffsets = result.from_slice.suboffsets + * break +*/ + } + } + __pyx_L6_break:; + + /* "View.MemoryView":1043 + * break + * + * result.view.len = result.view.itemsize # <<<<<<<<<<<<<< + * for length in result.view.shape[:ndim]: + * result.view.len *= length +*/ + __pyx_t_9 = __pyx_v_result->__pyx_base.view.itemsize; + __pyx_v_result->__pyx_base.view.len = __pyx_t_9; + + /* "View.MemoryView":1044 + * + * result.view.len = result.view.itemsize + * for length in result.view.shape[:ndim]: # <<<<<<<<<<<<<< + * result.view.len *= length + * +*/ + __pyx_t_7 = (__pyx_v_result->__pyx_base.view.shape + __pyx_v_ndim); + for (__pyx_t_8 = __pyx_v_result->__pyx_base.view.shape; __pyx_t_8 < __pyx_t_7; __pyx_t_8++) { + __pyx_t_6 = __pyx_t_8; + __pyx_t_2 = PyLong_FromSsize_t((__pyx_t_6[0])); if (unlikely(!__pyx_t_2)) __PYX_ERR(1, 1044, __pyx_L1_error) + __Pyx_GOTREF(__pyx_t_2); + __Pyx_XDECREF_SET(__pyx_v_length, __pyx_t_2); + __pyx_t_2 = 0; + + /* "View.MemoryView":1045 + * result.view.len = result.view.itemsize + * for length in result.view.shape[:ndim]: + * result.view.len *= length # <<<<<<<<<<<<<< + * + * result.to_object_func = to_object_func +*/ + __pyx_t_2 = PyLong_FromSsize_t(__pyx_v_result->__pyx_base.view.len); if (unlikely(!__pyx_t_2)) __PYX_ERR(1, 1045, __pyx_L1_error) + __Pyx_GOTREF(__pyx_t_2); + __pyx_t_3 = PyNumber_InPlaceMultiply(__pyx_t_2, __pyx_v_length); if (unlikely(!__pyx_t_3)) __PYX_ERR(1, 1045, __pyx_L1_error) + __Pyx_GOTREF(__pyx_t_3); + __Pyx_DECREF(__pyx_t_2); __pyx_t_2 = 0; + __pyx_t_9 = __Pyx_PyIndex_AsSsize_t(__pyx_t_3); if (unlikely((__pyx_t_9 == (Py_ssize_t)-1) && PyErr_Occurred())) __PYX_ERR(1, 1045, __pyx_L1_error) + __Pyx_DECREF(__pyx_t_3); __pyx_t_3 = 0; + __pyx_v_result->__pyx_base.view.len = __pyx_t_9; + } + + /* "View.MemoryView":1047 + * result.view.len *= length + * + * result.to_object_func = to_object_func # <<<<<<<<<<<<<< + * result.to_dtype_func = to_dtype_func + * +*/ + __pyx_v_result->to_object_func = __pyx_v_to_object_func; + + /* "View.MemoryView":1048 + * + * result.to_object_func = to_object_func + * result.to_dtype_func = to_dtype_func # <<<<<<<<<<<<<< + * + * return result +*/ + __pyx_v_result->to_dtype_func = __pyx_v_to_dtype_func; + + /* "View.MemoryView":1050 + * result.to_dtype_func = to_dtype_func + * + * return result # <<<<<<<<<<<<<< + * + * @cname('__pyx_memoryview_get_slice_from_memoryview') +*/ + __Pyx_XDECREF(__pyx_r); + __Pyx_INCREF((PyObject *)__pyx_v_result); + __pyx_r = ((PyObject *)__pyx_v_result); + goto __pyx_L0; + + /* "View.MemoryView":999 + * pass # ignore failure, it's a minor issue + * + * @cname('__pyx_memoryview_fromslice') # <<<<<<<<<<<<<< + * cdef memoryview_fromslice(__Pyx_memviewslice memviewslice, + * int ndim, +*/ + + /* function exit code */ + __pyx_L1_error:; + __Pyx_XDECREF(__pyx_t_2); + __Pyx_XDECREF(__pyx_t_3); + __Pyx_AddTraceback("View.MemoryView.memoryview_fromslice", __pyx_clineno, __pyx_lineno, __pyx_filename); + __pyx_r = 0; + __pyx_L0:; + __Pyx_XDECREF((PyObject *)__pyx_v_result); + __Pyx_XDECREF(__pyx_v_length); + __Pyx_XGIVEREF(__pyx_r); + __Pyx_RefNannyFinishContext(); + return __pyx_r; +} + +/* "View.MemoryView":1052 + * return result + * + * @cname('__pyx_memoryview_get_slice_from_memoryview') # <<<<<<<<<<<<<< + * cdef __Pyx_memviewslice *get_slice_from_memview(memoryview memview, + * __Pyx_memviewslice *mslice) except NULL: +*/ + +static __Pyx_memviewslice *__pyx_memoryview_get_slice_from_memoryview(struct __pyx_memoryview_obj *__pyx_v_memview, __Pyx_memviewslice *__pyx_v_mslice) { + struct __pyx_memoryviewslice_obj *__pyx_v_obj = 0; + __Pyx_memviewslice *__pyx_r; + __Pyx_RefNannyDeclarations + int __pyx_t_1; + PyObject *__pyx_t_2 = NULL; + int __pyx_lineno = 0; + const char *__pyx_filename = NULL; + int __pyx_clineno = 0; + __Pyx_RefNannySetupContext("get_slice_from_memview", 0); + + /* "View.MemoryView":1056 + * __Pyx_memviewslice *mslice) except NULL: + * cdef _memoryviewslice obj + * if isinstance(memview, _memoryviewslice): # <<<<<<<<<<<<<< + * obj = memview + * return &obj.from_slice +*/ + __pyx_t_1 = __Pyx_TypeCheck(((PyObject *)__pyx_v_memview), __pyx_mstate_global->__pyx_memoryviewslice_type); + if (__pyx_t_1) { + + /* "View.MemoryView":1057 + * cdef _memoryviewslice obj + * if isinstance(memview, _memoryviewslice): + * obj = memview # <<<<<<<<<<<<<< + * return &obj.from_slice + * else: +*/ + __pyx_t_2 = ((PyObject *)__pyx_v_memview); + __Pyx_INCREF(__pyx_t_2); + if (!(likely(((__pyx_t_2) == Py_None) || likely(__Pyx_TypeTest(__pyx_t_2, __pyx_mstate_global->__pyx_memoryviewslice_type))))) __PYX_ERR(1, 1057, __pyx_L1_error) + __pyx_v_obj = ((struct __pyx_memoryviewslice_obj *)__pyx_t_2); + __pyx_t_2 = 0; + + /* "View.MemoryView":1058 + * if isinstance(memview, _memoryviewslice): + * obj = memview + * return &obj.from_slice # <<<<<<<<<<<<<< + * else: + * slice_copy(memview, mslice) +*/ + __pyx_r = (&__pyx_v_obj->from_slice); + goto __pyx_L0; + + /* "View.MemoryView":1056 + * __Pyx_memviewslice *mslice) except NULL: + * cdef _memoryviewslice obj + * if isinstance(memview, _memoryviewslice): # <<<<<<<<<<<<<< + * obj = memview + * return &obj.from_slice +*/ + } + + /* "View.MemoryView":1060 + * return &obj.from_slice + * else: + * slice_copy(memview, mslice) # <<<<<<<<<<<<<< + * return mslice + * +*/ + /*else*/ { + __pyx_memoryview_slice_copy(__pyx_v_memview, __pyx_v_mslice); + + /* "View.MemoryView":1061 + * else: + * slice_copy(memview, mslice) + * return mslice # <<<<<<<<<<<<<< + * + * @cname('__pyx_memoryview_slice_copy') +*/ + __pyx_r = __pyx_v_mslice; + goto __pyx_L0; + } + + /* "View.MemoryView":1052 + * return result + * + * @cname('__pyx_memoryview_get_slice_from_memoryview') # <<<<<<<<<<<<<< + * cdef __Pyx_memviewslice *get_slice_from_memview(memoryview memview, + * __Pyx_memviewslice *mslice) except NULL: +*/ + + /* function exit code */ + __pyx_L1_error:; + __Pyx_XDECREF(__pyx_t_2); + __Pyx_AddTraceback("View.MemoryView.get_slice_from_memview", __pyx_clineno, __pyx_lineno, __pyx_filename); + __pyx_r = NULL; + __pyx_L0:; + __Pyx_XDECREF((PyObject *)__pyx_v_obj); + __Pyx_RefNannyFinishContext(); + return __pyx_r; +} + +/* "View.MemoryView":1063 + * return mslice + * + * @cname('__pyx_memoryview_slice_copy') # <<<<<<<<<<<<<< + * cdef void slice_copy(memoryview memview, __Pyx_memviewslice *dst) noexcept: + * cdef int dim +*/ + +static void __pyx_memoryview_slice_copy(struct __pyx_memoryview_obj *__pyx_v_memview, __Pyx_memviewslice *__pyx_v_dst) { + int __pyx_v_dim; + Py_ssize_t *__pyx_v_shape; + Py_ssize_t *__pyx_v_strides; + Py_ssize_t *__pyx_v_suboffsets; + Py_ssize_t *__pyx_t_1; + int __pyx_t_2; + int __pyx_t_3; + int __pyx_t_4; + Py_ssize_t __pyx_t_5; + int __pyx_t_6; + + /* "View.MemoryView":1068 + * cdef (Py_ssize_t*) shape, strides, suboffsets + * + * shape = memview.view.shape # <<<<<<<<<<<<<< + * strides = memview.view.strides + * suboffsets = memview.view.suboffsets +*/ + __pyx_t_1 = __pyx_v_memview->view.shape; + __pyx_v_shape = __pyx_t_1; + + /* "View.MemoryView":1069 + * + * shape = memview.view.shape + * strides = memview.view.strides # <<<<<<<<<<<<<< + * suboffsets = memview.view.suboffsets + * +*/ + __pyx_t_1 = __pyx_v_memview->view.strides; + __pyx_v_strides = __pyx_t_1; + + /* "View.MemoryView":1070 + * shape = memview.view.shape + * strides = memview.view.strides + * suboffsets = memview.view.suboffsets # <<<<<<<<<<<<<< + * + * dst.memview = <__pyx_memoryview *> memview +*/ + __pyx_t_1 = __pyx_v_memview->view.suboffsets; + __pyx_v_suboffsets = __pyx_t_1; + + /* "View.MemoryView":1072 + * suboffsets = memview.view.suboffsets + * + * dst.memview = <__pyx_memoryview *> memview # <<<<<<<<<<<<<< + * dst.data = memview.view.buf + * +*/ + __pyx_v_dst->memview = ((struct __pyx_memoryview_obj *)__pyx_v_memview); + + /* "View.MemoryView":1073 + * + * dst.memview = <__pyx_memoryview *> memview + * dst.data = memview.view.buf # <<<<<<<<<<<<<< + * + * for dim in range(memview.view.ndim): +*/ + __pyx_v_dst->data = ((char *)__pyx_v_memview->view.buf); + + /* "View.MemoryView":1075 + * dst.data = memview.view.buf + * + * for dim in range(memview.view.ndim): # <<<<<<<<<<<<<< + * dst.shape[dim] = shape[dim] + * dst.strides[dim] = strides[dim] +*/ + __pyx_t_2 = __pyx_v_memview->view.ndim; + __pyx_t_3 = __pyx_t_2; + for (__pyx_t_4 = 0; __pyx_t_4 < __pyx_t_3; __pyx_t_4+=1) { + __pyx_v_dim = __pyx_t_4; + + /* "View.MemoryView":1076 + * + * for dim in range(memview.view.ndim): + * dst.shape[dim] = shape[dim] # <<<<<<<<<<<<<< + * dst.strides[dim] = strides[dim] + * dst.suboffsets[dim] = suboffsets[dim] if suboffsets else -1 +*/ + (__pyx_v_dst->shape[__pyx_v_dim]) = (__pyx_v_shape[__pyx_v_dim]); + + /* "View.MemoryView":1077 + * for dim in range(memview.view.ndim): + * dst.shape[dim] = shape[dim] + * dst.strides[dim] = strides[dim] # <<<<<<<<<<<<<< + * dst.suboffsets[dim] = suboffsets[dim] if suboffsets else -1 + * +*/ + (__pyx_v_dst->strides[__pyx_v_dim]) = (__pyx_v_strides[__pyx_v_dim]); + + /* "View.MemoryView":1078 + * dst.shape[dim] = shape[dim] + * dst.strides[dim] = strides[dim] + * dst.suboffsets[dim] = suboffsets[dim] if suboffsets else -1 # <<<<<<<<<<<<<< + * + * @cname('__pyx_memoryview_copy_object') +*/ + __pyx_t_6 = (__pyx_v_suboffsets != 0); + if (__pyx_t_6) { + __pyx_t_5 = (__pyx_v_suboffsets[__pyx_v_dim]); + } else { + __pyx_t_5 = -1L; + } + (__pyx_v_dst->suboffsets[__pyx_v_dim]) = __pyx_t_5; + } + + /* "View.MemoryView":1063 + * return mslice + * + * @cname('__pyx_memoryview_slice_copy') # <<<<<<<<<<<<<< + * cdef void slice_copy(memoryview memview, __Pyx_memviewslice *dst) noexcept: + * cdef int dim +*/ + + /* function exit code */ +} + +/* "View.MemoryView":1080 + * dst.suboffsets[dim] = suboffsets[dim] if suboffsets else -1 + * + * @cname('__pyx_memoryview_copy_object') # <<<<<<<<<<<<<< + * cdef memoryview_copy(memoryview memview): + * "Create a new memoryview object" +*/ + +static PyObject *__pyx_memoryview_copy_object(struct __pyx_memoryview_obj *__pyx_v_memview) { + __Pyx_memviewslice __pyx_v_memviewslice; + 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("memoryview_copy", 0); + + /* "View.MemoryView":1084 + * "Create a new memoryview object" + * cdef __Pyx_memviewslice memviewslice + * slice_copy(memview, &memviewslice) # <<<<<<<<<<<<<< + * return memoryview_copy_from_slice(memview, &memviewslice) + * +*/ + __pyx_memoryview_slice_copy(__pyx_v_memview, (&__pyx_v_memviewslice)); + + /* "View.MemoryView":1085 + * cdef __Pyx_memviewslice memviewslice + * slice_copy(memview, &memviewslice) + * return memoryview_copy_from_slice(memview, &memviewslice) # <<<<<<<<<<<<<< + * + * @cname('__pyx_memoryview_copy_object_from_slice') +*/ + __Pyx_XDECREF(__pyx_r); + __pyx_t_1 = __pyx_memoryview_copy_object_from_slice(__pyx_v_memview, (&__pyx_v_memviewslice)); if (unlikely(!__pyx_t_1)) __PYX_ERR(1, 1085, __pyx_L1_error) + __Pyx_GOTREF(__pyx_t_1); + __pyx_r = __pyx_t_1; + __pyx_t_1 = 0; + goto __pyx_L0; + + /* "View.MemoryView":1080 + * dst.suboffsets[dim] = suboffsets[dim] if suboffsets else -1 + * + * @cname('__pyx_memoryview_copy_object') # <<<<<<<<<<<<<< + * cdef memoryview_copy(memoryview memview): + * "Create a new memoryview object" +*/ + + /* function exit code */ + __pyx_L1_error:; + __Pyx_XDECREF(__pyx_t_1); + __Pyx_AddTraceback("View.MemoryView.memoryview_copy", __pyx_clineno, __pyx_lineno, __pyx_filename); + __pyx_r = 0; + __pyx_L0:; + __Pyx_XGIVEREF(__pyx_r); + __Pyx_RefNannyFinishContext(); + return __pyx_r; +} + +/* "View.MemoryView":1087 + * return memoryview_copy_from_slice(memview, &memviewslice) + * + * @cname('__pyx_memoryview_copy_object_from_slice') # <<<<<<<<<<<<<< + * cdef memoryview_copy_from_slice(memoryview memview, __Pyx_memviewslice *memviewslice): + * """ +*/ + +static PyObject *__pyx_memoryview_copy_object_from_slice(struct __pyx_memoryview_obj *__pyx_v_memview, __Pyx_memviewslice *__pyx_v_memviewslice) { + PyObject *(*__pyx_v_to_object_func)(char *); + int (*__pyx_v_to_dtype_func)(char *, PyObject *); + PyObject *__pyx_r = NULL; + __Pyx_RefNannyDeclarations + int __pyx_t_1; + PyObject *(*__pyx_t_2)(char *); + int (*__pyx_t_3)(char *, PyObject *); + PyObject *__pyx_t_4 = NULL; + int __pyx_lineno = 0; + const char *__pyx_filename = NULL; + int __pyx_clineno = 0; + __Pyx_RefNannySetupContext("memoryview_copy_from_slice", 0); + + /* "View.MemoryView":1095 + * cdef int (*to_dtype_func)(char *, object) except 0 + * + * if isinstance(memview, _memoryviewslice): # <<<<<<<<<<<<<< + * to_object_func = (<_memoryviewslice> memview).to_object_func + * to_dtype_func = (<_memoryviewslice> memview).to_dtype_func +*/ + __pyx_t_1 = __Pyx_TypeCheck(((PyObject *)__pyx_v_memview), __pyx_mstate_global->__pyx_memoryviewslice_type); + if (__pyx_t_1) { + + /* "View.MemoryView":1096 + * + * if isinstance(memview, _memoryviewslice): + * to_object_func = (<_memoryviewslice> memview).to_object_func # <<<<<<<<<<<<<< + * to_dtype_func = (<_memoryviewslice> memview).to_dtype_func + * else: +*/ + __pyx_t_2 = ((struct __pyx_memoryviewslice_obj *)__pyx_v_memview)->to_object_func; + __pyx_v_to_object_func = __pyx_t_2; + + /* "View.MemoryView":1097 + * if isinstance(memview, _memoryviewslice): + * to_object_func = (<_memoryviewslice> memview).to_object_func + * to_dtype_func = (<_memoryviewslice> memview).to_dtype_func # <<<<<<<<<<<<<< + * else: + * to_object_func = NULL +*/ + __pyx_t_3 = ((struct __pyx_memoryviewslice_obj *)__pyx_v_memview)->to_dtype_func; + __pyx_v_to_dtype_func = __pyx_t_3; + + /* "View.MemoryView":1095 + * cdef int (*to_dtype_func)(char *, object) except 0 + * + * if isinstance(memview, _memoryviewslice): # <<<<<<<<<<<<<< + * to_object_func = (<_memoryviewslice> memview).to_object_func + * to_dtype_func = (<_memoryviewslice> memview).to_dtype_func +*/ + goto __pyx_L3; + } + + /* "View.MemoryView":1099 + * to_dtype_func = (<_memoryviewslice> memview).to_dtype_func + * else: + * to_object_func = NULL # <<<<<<<<<<<<<< + * to_dtype_func = NULL + * +*/ + /*else*/ { + __pyx_v_to_object_func = NULL; + + /* "View.MemoryView":1100 + * else: + * to_object_func = NULL + * to_dtype_func = NULL # <<<<<<<<<<<<<< + * + * return memoryview_fromslice(memviewslice[0], memview.view.ndim, +*/ + __pyx_v_to_dtype_func = NULL; + } + __pyx_L3:; + + /* "View.MemoryView":1102 + * to_dtype_func = NULL + * + * return memoryview_fromslice(memviewslice[0], memview.view.ndim, # <<<<<<<<<<<<<< + * to_object_func, to_dtype_func, + * memview.dtype_is_object) +*/ + __Pyx_XDECREF(__pyx_r); + + /* "View.MemoryView":1104 + * return memoryview_fromslice(memviewslice[0], memview.view.ndim, + * to_object_func, to_dtype_func, + * memview.dtype_is_object) # <<<<<<<<<<<<<< + * + * +*/ + __pyx_t_4 = __pyx_memoryview_fromslice((__pyx_v_memviewslice[0]), __pyx_v_memview->view.ndim, __pyx_v_to_object_func, __pyx_v_to_dtype_func, __pyx_v_memview->dtype_is_object); if (unlikely(!__pyx_t_4)) __PYX_ERR(1, 1102, __pyx_L1_error) + __Pyx_GOTREF(__pyx_t_4); + __pyx_r = __pyx_t_4; + __pyx_t_4 = 0; + goto __pyx_L0; + + /* "View.MemoryView":1087 + * return memoryview_copy_from_slice(memview, &memviewslice) + * + * @cname('__pyx_memoryview_copy_object_from_slice') # <<<<<<<<<<<<<< + * cdef memoryview_copy_from_slice(memoryview memview, __Pyx_memviewslice *memviewslice): + * """ +*/ + + /* function exit code */ + __pyx_L1_error:; + __Pyx_XDECREF(__pyx_t_4); + __Pyx_AddTraceback("View.MemoryView.memoryview_copy_from_slice", __pyx_clineno, __pyx_lineno, __pyx_filename); + __pyx_r = 0; + __pyx_L0:; + __Pyx_XGIVEREF(__pyx_r); + __Pyx_RefNannyFinishContext(); + return __pyx_r; +} + +/* "View.MemoryView":1110 + * + * + * cdef Py_ssize_t abs_py_ssize_t(Py_ssize_t arg) noexcept nogil: # <<<<<<<<<<<<<< + * return -arg if arg < 0 else arg + * +*/ + +static Py_ssize_t abs_py_ssize_t(Py_ssize_t __pyx_v_arg) { + Py_ssize_t __pyx_r; + Py_ssize_t __pyx_t_1; + int __pyx_t_2; + + /* "View.MemoryView":1111 + * + * cdef Py_ssize_t abs_py_ssize_t(Py_ssize_t arg) noexcept nogil: + * return -arg if arg < 0 else arg # <<<<<<<<<<<<<< + * + * @cname('__pyx_get_best_slice_order') +*/ + __pyx_t_2 = (__pyx_v_arg < 0); + if (__pyx_t_2) { + __pyx_t_1 = (-__pyx_v_arg); + } else { + __pyx_t_1 = __pyx_v_arg; + } + __pyx_r = __pyx_t_1; + goto __pyx_L0; + + /* "View.MemoryView":1110 + * + * + * cdef Py_ssize_t abs_py_ssize_t(Py_ssize_t arg) noexcept nogil: # <<<<<<<<<<<<<< + * return -arg if arg < 0 else arg + * +*/ + + /* function exit code */ + __pyx_L0:; + return __pyx_r; +} + +/* "View.MemoryView":1113 + * return -arg if arg < 0 else arg + * + * @cname('__pyx_get_best_slice_order') # <<<<<<<<<<<<<< + * cdef char get_best_order(__Pyx_memviewslice *mslice, int ndim) noexcept nogil: + * """ +*/ + +static char __pyx_get_best_slice_order(__Pyx_memviewslice *__pyx_v_mslice, int __pyx_v_ndim) { + int __pyx_v_i; + Py_ssize_t __pyx_v_c_stride; + Py_ssize_t __pyx_v_f_stride; + char __pyx_r; + int __pyx_t_1; + int __pyx_t_2; + int __pyx_t_3; + int __pyx_t_4; + + /* "View.MemoryView":1119 + * """ + * cdef int i + * cdef Py_ssize_t c_stride = 0 # <<<<<<<<<<<<<< + * cdef Py_ssize_t f_stride = 0 + * +*/ + __pyx_v_c_stride = 0; + + /* "View.MemoryView":1120 + * cdef int i + * cdef Py_ssize_t c_stride = 0 + * cdef Py_ssize_t f_stride = 0 # <<<<<<<<<<<<<< + * + * for i in range(ndim - 1, -1, -1): +*/ + __pyx_v_f_stride = 0; + + /* "View.MemoryView":1122 + * cdef Py_ssize_t f_stride = 0 + * + * for i in range(ndim - 1, -1, -1): # <<<<<<<<<<<<<< + * if mslice.shape[i] > 1: + * c_stride = mslice.strides[i] +*/ + for (__pyx_t_1 = (__pyx_v_ndim - 1); __pyx_t_1 > -1; __pyx_t_1-=1) { + __pyx_v_i = __pyx_t_1; + + /* "View.MemoryView":1123 + * + * for i in range(ndim - 1, -1, -1): + * if mslice.shape[i] > 1: # <<<<<<<<<<<<<< + * c_stride = mslice.strides[i] + * break +*/ + __pyx_t_2 = ((__pyx_v_mslice->shape[__pyx_v_i]) > 1); + if (__pyx_t_2) { + + /* "View.MemoryView":1124 + * for i in range(ndim - 1, -1, -1): + * if mslice.shape[i] > 1: + * c_stride = mslice.strides[i] # <<<<<<<<<<<<<< + * break + * +*/ + __pyx_v_c_stride = (__pyx_v_mslice->strides[__pyx_v_i]); + + /* "View.MemoryView":1125 + * if mslice.shape[i] > 1: + * c_stride = mslice.strides[i] + * break # <<<<<<<<<<<<<< + * + * for i in range(ndim): +*/ + goto __pyx_L4_break; + + /* "View.MemoryView":1123 + * + * for i in range(ndim - 1, -1, -1): + * if mslice.shape[i] > 1: # <<<<<<<<<<<<<< + * c_stride = mslice.strides[i] + * break +*/ + } + } + __pyx_L4_break:; + + /* "View.MemoryView":1127 + * break + * + * for i in range(ndim): # <<<<<<<<<<<<<< + * if mslice.shape[i] > 1: + * f_stride = mslice.strides[i] +*/ + __pyx_t_1 = __pyx_v_ndim; + __pyx_t_3 = __pyx_t_1; + for (__pyx_t_4 = 0; __pyx_t_4 < __pyx_t_3; __pyx_t_4+=1) { + __pyx_v_i = __pyx_t_4; + + /* "View.MemoryView":1128 + * + * for i in range(ndim): + * if mslice.shape[i] > 1: # <<<<<<<<<<<<<< + * f_stride = mslice.strides[i] + * break +*/ + __pyx_t_2 = ((__pyx_v_mslice->shape[__pyx_v_i]) > 1); + if (__pyx_t_2) { + + /* "View.MemoryView":1129 + * for i in range(ndim): + * if mslice.shape[i] > 1: + * f_stride = mslice.strides[i] # <<<<<<<<<<<<<< + * break + * +*/ + __pyx_v_f_stride = (__pyx_v_mslice->strides[__pyx_v_i]); + + /* "View.MemoryView":1130 + * if mslice.shape[i] > 1: + * f_stride = mslice.strides[i] + * break # <<<<<<<<<<<<<< + * + * if abs_py_ssize_t(c_stride) <= abs_py_ssize_t(f_stride): +*/ + goto __pyx_L7_break; + + /* "View.MemoryView":1128 + * + * for i in range(ndim): + * if mslice.shape[i] > 1: # <<<<<<<<<<<<<< + * f_stride = mslice.strides[i] + * break +*/ + } + } + __pyx_L7_break:; + + /* "View.MemoryView":1132 + * break + * + * if abs_py_ssize_t(c_stride) <= abs_py_ssize_t(f_stride): # <<<<<<<<<<<<<< + * return 'C' + * else: +*/ + __pyx_t_2 = (abs_py_ssize_t(__pyx_v_c_stride) <= abs_py_ssize_t(__pyx_v_f_stride)); + if (__pyx_t_2) { + + /* "View.MemoryView":1133 + * + * if abs_py_ssize_t(c_stride) <= abs_py_ssize_t(f_stride): + * return 'C' # <<<<<<<<<<<<<< + * else: + * return 'F' +*/ + __pyx_r = 'C'; + goto __pyx_L0; + + /* "View.MemoryView":1132 + * break + * + * if abs_py_ssize_t(c_stride) <= abs_py_ssize_t(f_stride): # <<<<<<<<<<<<<< + * return 'C' + * else: +*/ + } + + /* "View.MemoryView":1135 + * return 'C' + * else: + * return 'F' # <<<<<<<<<<<<<< + * + * @cython.cdivision(True) +*/ + /*else*/ { + __pyx_r = 'F'; + goto __pyx_L0; + } + + /* "View.MemoryView":1113 + * return -arg if arg < 0 else arg + * + * @cname('__pyx_get_best_slice_order') # <<<<<<<<<<<<<< + * cdef char get_best_order(__Pyx_memviewslice *mslice, int ndim) noexcept nogil: + * """ +*/ + + /* function exit code */ + __pyx_L0:; + return __pyx_r; +} + +/* "View.MemoryView":1137 + * return 'F' + * + * @cython.cdivision(True) # <<<<<<<<<<<<<< + * cdef void _copy_strided_to_strided(char *src_data, Py_ssize_t *src_strides, + * char *dst_data, Py_ssize_t *dst_strides, +*/ + +static void _copy_strided_to_strided(char *__pyx_v_src_data, Py_ssize_t *__pyx_v_src_strides, char *__pyx_v_dst_data, Py_ssize_t *__pyx_v_dst_strides, Py_ssize_t *__pyx_v_src_shape, Py_ssize_t *__pyx_v_dst_shape, int __pyx_v_ndim, size_t __pyx_v_itemsize) { + CYTHON_UNUSED Py_ssize_t __pyx_v_i; + CYTHON_UNUSED Py_ssize_t __pyx_v_src_extent; + Py_ssize_t __pyx_v_dst_extent; + Py_ssize_t __pyx_v_src_stride; + Py_ssize_t __pyx_v_dst_stride; + int __pyx_t_1; + int __pyx_t_2; + Py_ssize_t __pyx_t_3; + Py_ssize_t __pyx_t_4; + Py_ssize_t __pyx_t_5; + + /* "View.MemoryView":1145 + * + * cdef Py_ssize_t i + * cdef Py_ssize_t src_extent = src_shape[0] # <<<<<<<<<<<<<< + * cdef Py_ssize_t dst_extent = dst_shape[0] + * cdef Py_ssize_t src_stride = src_strides[0] +*/ + __pyx_v_src_extent = (__pyx_v_src_shape[0]); + + /* "View.MemoryView":1146 + * cdef Py_ssize_t i + * cdef Py_ssize_t src_extent = src_shape[0] + * cdef Py_ssize_t dst_extent = dst_shape[0] # <<<<<<<<<<<<<< + * cdef Py_ssize_t src_stride = src_strides[0] + * cdef Py_ssize_t dst_stride = dst_strides[0] +*/ + __pyx_v_dst_extent = (__pyx_v_dst_shape[0]); + + /* "View.MemoryView":1147 + * cdef Py_ssize_t src_extent = src_shape[0] + * cdef Py_ssize_t dst_extent = dst_shape[0] + * cdef Py_ssize_t src_stride = src_strides[0] # <<<<<<<<<<<<<< + * cdef Py_ssize_t dst_stride = dst_strides[0] + * +*/ + __pyx_v_src_stride = (__pyx_v_src_strides[0]); + + /* "View.MemoryView":1148 + * cdef Py_ssize_t dst_extent = dst_shape[0] + * cdef Py_ssize_t src_stride = src_strides[0] + * cdef Py_ssize_t dst_stride = dst_strides[0] # <<<<<<<<<<<<<< + * + * if ndim == 1: +*/ + __pyx_v_dst_stride = (__pyx_v_dst_strides[0]); + + /* "View.MemoryView":1150 + * cdef Py_ssize_t dst_stride = dst_strides[0] + * + * if ndim == 1: # <<<<<<<<<<<<<< + * if (src_stride > 0 and dst_stride > 0 and + * src_stride == itemsize == dst_stride): +*/ + __pyx_t_1 = (__pyx_v_ndim == 1); + if (__pyx_t_1) { + + /* "View.MemoryView":1151 + * + * if ndim == 1: + * if (src_stride > 0 and dst_stride > 0 and # <<<<<<<<<<<<<< + * src_stride == itemsize == dst_stride): + * memcpy(dst_data, src_data, itemsize * dst_extent) +*/ + __pyx_t_2 = (__pyx_v_src_stride > 0); + if (__pyx_t_2) { + } else { + __pyx_t_1 = __pyx_t_2; + goto __pyx_L5_bool_binop_done; + } + __pyx_t_2 = (__pyx_v_dst_stride > 0); + if (__pyx_t_2) { + } else { + __pyx_t_1 = __pyx_t_2; + goto __pyx_L5_bool_binop_done; + } + + /* "View.MemoryView":1152 + * if ndim == 1: + * if (src_stride > 0 and dst_stride > 0 and + * src_stride == itemsize == dst_stride): # <<<<<<<<<<<<<< + * memcpy(dst_data, src_data, itemsize * dst_extent) + * else: +*/ + __pyx_t_2 = (((size_t)__pyx_v_src_stride) == __pyx_v_itemsize); + if (__pyx_t_2) { + __pyx_t_2 = (__pyx_v_itemsize == ((size_t)__pyx_v_dst_stride)); + } + __pyx_t_1 = __pyx_t_2; + __pyx_L5_bool_binop_done:; + + /* "View.MemoryView":1151 + * + * if ndim == 1: + * if (src_stride > 0 and dst_stride > 0 and # <<<<<<<<<<<<<< + * src_stride == itemsize == dst_stride): + * memcpy(dst_data, src_data, itemsize * dst_extent) +*/ + if (__pyx_t_1) { + + /* "View.MemoryView":1153 + * if (src_stride > 0 and dst_stride > 0 and + * src_stride == itemsize == dst_stride): + * memcpy(dst_data, src_data, itemsize * dst_extent) # <<<<<<<<<<<<<< + * else: + * for i in range(dst_extent): +*/ + (void)(memcpy(__pyx_v_dst_data, __pyx_v_src_data, (__pyx_v_itemsize * __pyx_v_dst_extent))); + + /* "View.MemoryView":1151 + * + * if ndim == 1: + * if (src_stride > 0 and dst_stride > 0 and # <<<<<<<<<<<<<< + * src_stride == itemsize == dst_stride): + * memcpy(dst_data, src_data, itemsize * dst_extent) +*/ + goto __pyx_L4; + } + + /* "View.MemoryView":1155 + * memcpy(dst_data, src_data, itemsize * dst_extent) + * else: + * for i in range(dst_extent): # <<<<<<<<<<<<<< + * memcpy(dst_data, src_data, itemsize) + * src_data += src_stride +*/ + /*else*/ { + __pyx_t_3 = __pyx_v_dst_extent; + __pyx_t_4 = __pyx_t_3; + for (__pyx_t_5 = 0; __pyx_t_5 < __pyx_t_4; __pyx_t_5+=1) { + __pyx_v_i = __pyx_t_5; + + /* "View.MemoryView":1156 + * else: + * for i in range(dst_extent): + * memcpy(dst_data, src_data, itemsize) # <<<<<<<<<<<<<< + * src_data += src_stride + * dst_data += dst_stride +*/ + (void)(memcpy(__pyx_v_dst_data, __pyx_v_src_data, __pyx_v_itemsize)); + + /* "View.MemoryView":1157 + * for i in range(dst_extent): + * memcpy(dst_data, src_data, itemsize) + * src_data += src_stride # <<<<<<<<<<<<<< + * dst_data += dst_stride + * else: +*/ + __pyx_v_src_data = (__pyx_v_src_data + __pyx_v_src_stride); + + /* "View.MemoryView":1158 + * memcpy(dst_data, src_data, itemsize) + * src_data += src_stride + * dst_data += dst_stride # <<<<<<<<<<<<<< + * else: + * for i in range(dst_extent): +*/ + __pyx_v_dst_data = (__pyx_v_dst_data + __pyx_v_dst_stride); + } + } + __pyx_L4:; + + /* "View.MemoryView":1150 + * cdef Py_ssize_t dst_stride = dst_strides[0] + * + * if ndim == 1: # <<<<<<<<<<<<<< + * if (src_stride > 0 and dst_stride > 0 and + * src_stride == itemsize == dst_stride): +*/ + goto __pyx_L3; + } + + /* "View.MemoryView":1160 + * dst_data += dst_stride + * else: + * for i in range(dst_extent): # <<<<<<<<<<<<<< + * _copy_strided_to_strided(src_data, src_strides + 1, + * dst_data, dst_strides + 1, +*/ + /*else*/ { + __pyx_t_3 = __pyx_v_dst_extent; + __pyx_t_4 = __pyx_t_3; + for (__pyx_t_5 = 0; __pyx_t_5 < __pyx_t_4; __pyx_t_5+=1) { + __pyx_v_i = __pyx_t_5; + + /* "View.MemoryView":1161 + * else: + * for i in range(dst_extent): + * _copy_strided_to_strided(src_data, src_strides + 1, # <<<<<<<<<<<<<< + * dst_data, dst_strides + 1, + * src_shape + 1, dst_shape + 1, +*/ + _copy_strided_to_strided(__pyx_v_src_data, (__pyx_v_src_strides + 1), __pyx_v_dst_data, (__pyx_v_dst_strides + 1), (__pyx_v_src_shape + 1), (__pyx_v_dst_shape + 1), (__pyx_v_ndim - 1), __pyx_v_itemsize); + + /* "View.MemoryView":1165 + * src_shape + 1, dst_shape + 1, + * ndim - 1, itemsize) + * src_data += src_stride # <<<<<<<<<<<<<< + * dst_data += dst_stride + * +*/ + __pyx_v_src_data = (__pyx_v_src_data + __pyx_v_src_stride); + + /* "View.MemoryView":1166 + * ndim - 1, itemsize) + * src_data += src_stride + * dst_data += dst_stride # <<<<<<<<<<<<<< + * + * cdef void copy_strided_to_strided(__Pyx_memviewslice *src, +*/ + __pyx_v_dst_data = (__pyx_v_dst_data + __pyx_v_dst_stride); + } + } + __pyx_L3:; + + /* "View.MemoryView":1137 + * return 'F' + * + * @cython.cdivision(True) # <<<<<<<<<<<<<< + * cdef void _copy_strided_to_strided(char *src_data, Py_ssize_t *src_strides, + * char *dst_data, Py_ssize_t *dst_strides, +*/ + + /* function exit code */ +} + +/* "View.MemoryView":1168 + * dst_data += dst_stride + * + * cdef void copy_strided_to_strided(__Pyx_memviewslice *src, # <<<<<<<<<<<<<< + * __Pyx_memviewslice *dst, + * int ndim, size_t itemsize) noexcept nogil: +*/ + +static void copy_strided_to_strided(__Pyx_memviewslice *__pyx_v_src, __Pyx_memviewslice *__pyx_v_dst, int __pyx_v_ndim, size_t __pyx_v_itemsize) { + + /* "View.MemoryView":1171 + * __Pyx_memviewslice *dst, + * int ndim, size_t itemsize) noexcept nogil: + * _copy_strided_to_strided(src.data, src.strides, dst.data, dst.strides, # <<<<<<<<<<<<<< + * src.shape, dst.shape, ndim, itemsize) + * +*/ + _copy_strided_to_strided(__pyx_v_src->data, __pyx_v_src->strides, __pyx_v_dst->data, __pyx_v_dst->strides, __pyx_v_src->shape, __pyx_v_dst->shape, __pyx_v_ndim, __pyx_v_itemsize); + + /* "View.MemoryView":1168 + * dst_data += dst_stride + * + * cdef void copy_strided_to_strided(__Pyx_memviewslice *src, # <<<<<<<<<<<<<< + * __Pyx_memviewslice *dst, + * int ndim, size_t itemsize) noexcept nogil: +*/ + + /* function exit code */ +} + +/* "View.MemoryView":1174 + * src.shape, dst.shape, ndim, itemsize) + * + * @cname('__pyx_memoryview_slice_get_size') # <<<<<<<<<<<<<< + * cdef Py_ssize_t slice_get_size(__Pyx_memviewslice *src, int ndim) noexcept nogil: + * "Return the size of the memory occupied by the slice in number of bytes" +*/ + +static Py_ssize_t __pyx_memoryview_slice_get_size(__Pyx_memviewslice *__pyx_v_src, int __pyx_v_ndim) { + Py_ssize_t __pyx_v_shape; + Py_ssize_t __pyx_v_size; + Py_ssize_t __pyx_r; + Py_ssize_t __pyx_t_1; + Py_ssize_t *__pyx_t_2; + Py_ssize_t *__pyx_t_3; + Py_ssize_t *__pyx_t_4; + + /* "View.MemoryView":1177 + * cdef Py_ssize_t slice_get_size(__Pyx_memviewslice *src, int ndim) noexcept nogil: + * "Return the size of the memory occupied by the slice in number of bytes" + * cdef Py_ssize_t shape, size = src.memview.view.itemsize # <<<<<<<<<<<<<< + * + * for shape in src.shape[:ndim]: +*/ + __pyx_t_1 = __pyx_v_src->memview->view.itemsize; + __pyx_v_size = __pyx_t_1; + + /* "View.MemoryView":1179 + * cdef Py_ssize_t shape, size = src.memview.view.itemsize + * + * for shape in src.shape[:ndim]: # <<<<<<<<<<<<<< + * size *= shape + * +*/ + __pyx_t_3 = (__pyx_v_src->shape + __pyx_v_ndim); + for (__pyx_t_4 = __pyx_v_src->shape; __pyx_t_4 < __pyx_t_3; __pyx_t_4++) { + __pyx_t_2 = __pyx_t_4; + __pyx_v_shape = (__pyx_t_2[0]); + + /* "View.MemoryView":1180 + * + * for shape in src.shape[:ndim]: + * size *= shape # <<<<<<<<<<<<<< + * + * return size +*/ + __pyx_v_size = (__pyx_v_size * __pyx_v_shape); + } + + /* "View.MemoryView":1182 + * size *= shape + * + * return size # <<<<<<<<<<<<<< + * + * @cname('__pyx_fill_contig_strides_array') +*/ + __pyx_r = __pyx_v_size; + goto __pyx_L0; + + /* "View.MemoryView":1174 + * src.shape, dst.shape, ndim, itemsize) + * + * @cname('__pyx_memoryview_slice_get_size') # <<<<<<<<<<<<<< + * cdef Py_ssize_t slice_get_size(__Pyx_memviewslice *src, int ndim) noexcept nogil: + * "Return the size of the memory occupied by the slice in number of bytes" +*/ + + /* function exit code */ + __pyx_L0:; + return __pyx_r; +} + +/* "View.MemoryView":1184 + * return size + * + * @cname('__pyx_fill_contig_strides_array') # <<<<<<<<<<<<<< + * cdef Py_ssize_t fill_contig_strides_array( + * Py_ssize_t *shape, Py_ssize_t *strides, Py_ssize_t stride, +*/ + +static Py_ssize_t __pyx_fill_contig_strides_array(Py_ssize_t *__pyx_v_shape, Py_ssize_t *__pyx_v_strides, Py_ssize_t __pyx_v_stride, int __pyx_v_ndim, char __pyx_v_order) { + int __pyx_v_idx; + Py_ssize_t __pyx_r; + int __pyx_t_1; + int __pyx_t_2; + int __pyx_t_3; + int __pyx_t_4; + + /* "View.MemoryView":1194 + * cdef int idx + * + * if order == 'F': # <<<<<<<<<<<<<< + * for idx in range(ndim): + * strides[idx] = stride +*/ + __pyx_t_1 = (__pyx_v_order == 'F'); + if (__pyx_t_1) { + + /* "View.MemoryView":1195 + * + * if order == 'F': + * for idx in range(ndim): # <<<<<<<<<<<<<< + * strides[idx] = stride + * stride *= shape[idx] +*/ + __pyx_t_2 = __pyx_v_ndim; + __pyx_t_3 = __pyx_t_2; + for (__pyx_t_4 = 0; __pyx_t_4 < __pyx_t_3; __pyx_t_4+=1) { + __pyx_v_idx = __pyx_t_4; + + /* "View.MemoryView":1196 + * if order == 'F': + * for idx in range(ndim): + * strides[idx] = stride # <<<<<<<<<<<<<< + * stride *= shape[idx] + * else: +*/ + (__pyx_v_strides[__pyx_v_idx]) = __pyx_v_stride; + + /* "View.MemoryView":1197 + * for idx in range(ndim): + * strides[idx] = stride + * stride *= shape[idx] # <<<<<<<<<<<<<< + * else: + * for idx in range(ndim - 1, -1, -1): +*/ + __pyx_v_stride = (__pyx_v_stride * (__pyx_v_shape[__pyx_v_idx])); + } + + /* "View.MemoryView":1194 + * cdef int idx + * + * if order == 'F': # <<<<<<<<<<<<<< + * for idx in range(ndim): + * strides[idx] = stride +*/ + goto __pyx_L3; + } + + /* "View.MemoryView":1199 + * stride *= shape[idx] + * else: + * for idx in range(ndim - 1, -1, -1): # <<<<<<<<<<<<<< + * strides[idx] = stride + * stride *= shape[idx] +*/ + /*else*/ { + for (__pyx_t_2 = (__pyx_v_ndim - 1); __pyx_t_2 > -1; __pyx_t_2-=1) { + __pyx_v_idx = __pyx_t_2; + + /* "View.MemoryView":1200 + * else: + * for idx in range(ndim - 1, -1, -1): + * strides[idx] = stride # <<<<<<<<<<<<<< + * stride *= shape[idx] + * +*/ + (__pyx_v_strides[__pyx_v_idx]) = __pyx_v_stride; + + /* "View.MemoryView":1201 + * for idx in range(ndim - 1, -1, -1): + * strides[idx] = stride + * stride *= shape[idx] # <<<<<<<<<<<<<< + * + * return stride +*/ + __pyx_v_stride = (__pyx_v_stride * (__pyx_v_shape[__pyx_v_idx])); + } + } + __pyx_L3:; + + /* "View.MemoryView":1203 + * stride *= shape[idx] + * + * return stride # <<<<<<<<<<<<<< + * + * @cname('__pyx_memoryview_copy_data_to_temp') +*/ + __pyx_r = __pyx_v_stride; + goto __pyx_L0; + + /* "View.MemoryView":1184 + * return size + * + * @cname('__pyx_fill_contig_strides_array') # <<<<<<<<<<<<<< + * cdef Py_ssize_t fill_contig_strides_array( + * Py_ssize_t *shape, Py_ssize_t *strides, Py_ssize_t stride, +*/ + + /* function exit code */ + __pyx_L0:; + return __pyx_r; +} + +/* "View.MemoryView":1205 + * return stride + * + * @cname('__pyx_memoryview_copy_data_to_temp') # <<<<<<<<<<<<<< + * cdef void *copy_data_to_temp(__Pyx_memviewslice *src, + * __Pyx_memviewslice *tmpslice, +*/ + +static void *__pyx_memoryview_copy_data_to_temp(__Pyx_memviewslice *__pyx_v_src, __Pyx_memviewslice *__pyx_v_tmpslice, char __pyx_v_order, int __pyx_v_ndim) { + int __pyx_v_i; + void *__pyx_v_result; + size_t __pyx_v_itemsize; + size_t __pyx_v_size; + void *__pyx_r; + Py_ssize_t __pyx_t_1; + int __pyx_t_2; + int __pyx_t_3; + struct __pyx_memoryview_obj *__pyx_t_4; + int __pyx_t_5; + int __pyx_t_6; + int __pyx_lineno = 0; + const char *__pyx_filename = NULL; + int __pyx_clineno = 0; + PyGILState_STATE __pyx_gilstate_save; + + /* "View.MemoryView":1217 + * cdef void *result + * + * cdef size_t itemsize = src.memview.view.itemsize # <<<<<<<<<<<<<< + * cdef size_t size = slice_get_size(src, ndim) + * +*/ + __pyx_t_1 = __pyx_v_src->memview->view.itemsize; + __pyx_v_itemsize = __pyx_t_1; + + /* "View.MemoryView":1218 + * + * cdef size_t itemsize = src.memview.view.itemsize + * cdef size_t size = slice_get_size(src, ndim) # <<<<<<<<<<<<<< + * + * result = malloc(size) +*/ + __pyx_v_size = __pyx_memoryview_slice_get_size(__pyx_v_src, __pyx_v_ndim); + + /* "View.MemoryView":1220 + * cdef size_t size = slice_get_size(src, ndim) + * + * result = malloc(size) # <<<<<<<<<<<<<< + * if not result: + * _err_no_memory() +*/ + __pyx_v_result = malloc(__pyx_v_size); + + /* "View.MemoryView":1221 + * + * result = malloc(size) + * if not result: # <<<<<<<<<<<<<< + * _err_no_memory() + * +*/ + __pyx_t_2 = (!(__pyx_v_result != 0)); + if (__pyx_t_2) { + + /* "View.MemoryView":1222 + * result = malloc(size) + * if not result: + * _err_no_memory() # <<<<<<<<<<<<<< + * + * +*/ + __pyx_t_3 = __pyx_memoryview_err_no_memory(); if (unlikely(__pyx_t_3 == ((int)-1))) __PYX_ERR(1, 1222, __pyx_L1_error) + + /* "View.MemoryView":1221 + * + * result = malloc(size) + * if not result: # <<<<<<<<<<<<<< + * _err_no_memory() + * +*/ + } + + /* "View.MemoryView":1225 + * + * + * tmpslice.data = result # <<<<<<<<<<<<<< + * tmpslice.memview = src.memview + * for i in range(ndim): +*/ + __pyx_v_tmpslice->data = ((char *)__pyx_v_result); + + /* "View.MemoryView":1226 + * + * tmpslice.data = result + * tmpslice.memview = src.memview # <<<<<<<<<<<<<< + * for i in range(ndim): + * tmpslice.shape[i] = src.shape[i] +*/ + __pyx_t_4 = __pyx_v_src->memview; + __pyx_v_tmpslice->memview = __pyx_t_4; + + /* "View.MemoryView":1227 + * tmpslice.data = result + * tmpslice.memview = src.memview + * for i in range(ndim): # <<<<<<<<<<<<<< + * tmpslice.shape[i] = src.shape[i] + * tmpslice.suboffsets[i] = -1 +*/ + __pyx_t_3 = __pyx_v_ndim; + __pyx_t_5 = __pyx_t_3; + for (__pyx_t_6 = 0; __pyx_t_6 < __pyx_t_5; __pyx_t_6+=1) { + __pyx_v_i = __pyx_t_6; + + /* "View.MemoryView":1228 + * tmpslice.memview = src.memview + * for i in range(ndim): + * tmpslice.shape[i] = src.shape[i] # <<<<<<<<<<<<<< + * tmpslice.suboffsets[i] = -1 + * +*/ + (__pyx_v_tmpslice->shape[__pyx_v_i]) = (__pyx_v_src->shape[__pyx_v_i]); + + /* "View.MemoryView":1229 + * for i in range(ndim): + * tmpslice.shape[i] = src.shape[i] + * tmpslice.suboffsets[i] = -1 # <<<<<<<<<<<<<< + * + * fill_contig_strides_array(&tmpslice.shape[0], &tmpslice.strides[0], itemsize, ndim, order) +*/ + (__pyx_v_tmpslice->suboffsets[__pyx_v_i]) = -1L; + } + + /* "View.MemoryView":1231 + * tmpslice.suboffsets[i] = -1 + * + * fill_contig_strides_array(&tmpslice.shape[0], &tmpslice.strides[0], itemsize, ndim, order) # <<<<<<<<<<<<<< + * + * +*/ + (void)(__pyx_fill_contig_strides_array((&(__pyx_v_tmpslice->shape[0])), (&(__pyx_v_tmpslice->strides[0])), __pyx_v_itemsize, __pyx_v_ndim, __pyx_v_order)); + + /* "View.MemoryView":1234 + * + * + * for i in range(ndim): # <<<<<<<<<<<<<< + * if tmpslice.shape[i] == 1: + * tmpslice.strides[i] = 0 +*/ + __pyx_t_3 = __pyx_v_ndim; + __pyx_t_5 = __pyx_t_3; + for (__pyx_t_6 = 0; __pyx_t_6 < __pyx_t_5; __pyx_t_6+=1) { + __pyx_v_i = __pyx_t_6; + + /* "View.MemoryView":1235 + * + * for i in range(ndim): + * if tmpslice.shape[i] == 1: # <<<<<<<<<<<<<< + * tmpslice.strides[i] = 0 + * +*/ + __pyx_t_2 = ((__pyx_v_tmpslice->shape[__pyx_v_i]) == 1); + if (__pyx_t_2) { + + /* "View.MemoryView":1236 + * for i in range(ndim): + * if tmpslice.shape[i] == 1: + * tmpslice.strides[i] = 0 # <<<<<<<<<<<<<< + * + * if slice_is_contig(src[0], order, ndim): +*/ + (__pyx_v_tmpslice->strides[__pyx_v_i]) = 0; + + /* "View.MemoryView":1235 + * + * for i in range(ndim): + * if tmpslice.shape[i] == 1: # <<<<<<<<<<<<<< + * tmpslice.strides[i] = 0 + * +*/ + } + } + + /* "View.MemoryView":1238 + * tmpslice.strides[i] = 0 + * + * if slice_is_contig(src[0], order, ndim): # <<<<<<<<<<<<<< + * memcpy(result, src.data, size) + * else: +*/ + __pyx_t_2 = __pyx_memviewslice_is_contig((__pyx_v_src[0]), __pyx_v_order, __pyx_v_ndim); + if (__pyx_t_2) { + + /* "View.MemoryView":1239 + * + * if slice_is_contig(src[0], order, ndim): + * memcpy(result, src.data, size) # <<<<<<<<<<<<<< + * else: + * copy_strided_to_strided(src, tmpslice, ndim, itemsize) +*/ + (void)(memcpy(__pyx_v_result, __pyx_v_src->data, __pyx_v_size)); + + /* "View.MemoryView":1238 + * tmpslice.strides[i] = 0 + * + * if slice_is_contig(src[0], order, ndim): # <<<<<<<<<<<<<< + * memcpy(result, src.data, size) + * else: +*/ + goto __pyx_L9; + } + + /* "View.MemoryView":1241 + * memcpy(result, src.data, size) + * else: + * copy_strided_to_strided(src, tmpslice, ndim, itemsize) # <<<<<<<<<<<<<< + * + * return result +*/ + /*else*/ { + copy_strided_to_strided(__pyx_v_src, __pyx_v_tmpslice, __pyx_v_ndim, __pyx_v_itemsize); + } + __pyx_L9:; + + /* "View.MemoryView":1243 + * copy_strided_to_strided(src, tmpslice, ndim, itemsize) + * + * return result # <<<<<<<<<<<<<< + * + * +*/ + __pyx_r = __pyx_v_result; + goto __pyx_L0; + + /* "View.MemoryView":1205 + * return stride + * + * @cname('__pyx_memoryview_copy_data_to_temp') # <<<<<<<<<<<<<< + * cdef void *copy_data_to_temp(__Pyx_memviewslice *src, + * __Pyx_memviewslice *tmpslice, +*/ + + /* function exit code */ + __pyx_L1_error:; + __pyx_gilstate_save = __Pyx_PyGILState_Ensure(); + __Pyx_AddTraceback("View.MemoryView.copy_data_to_temp", __pyx_clineno, __pyx_lineno, __pyx_filename); + __pyx_r = NULL; + __Pyx_PyGILState_Release(__pyx_gilstate_save); + __pyx_L0:; + return __pyx_r; +} + +/* "View.MemoryView":1247 + * + * + * @cname('__pyx_memoryview_err_extents') # <<<<<<<<<<<<<< + * cdef int _err_extents(int i, Py_ssize_t extent1, + * Py_ssize_t extent2) except -1 with gil: +*/ + +static int __pyx_memoryview_err_extents(int __pyx_v_i, Py_ssize_t __pyx_v_extent1, Py_ssize_t __pyx_v_extent2) { + int __pyx_r; + __Pyx_RefNannyDeclarations + PyObject *__pyx_t_1 = NULL; + PyObject *__pyx_t_2 = NULL; + PyObject *__pyx_t_3 = NULL; + PyObject *__pyx_t_4[7]; + PyObject *__pyx_t_5 = NULL; + int __pyx_lineno = 0; + const char *__pyx_filename = NULL; + int __pyx_clineno = 0; + PyGILState_STATE __pyx_gilstate_save = __Pyx_PyGILState_Ensure(); + __Pyx_RefNannySetupContext("_err_extents", 0); + + /* "View.MemoryView":1250 + * cdef int _err_extents(int i, Py_ssize_t extent1, + * Py_ssize_t extent2) except -1 with gil: + * raise ValueError, f"got differing extents in dimension {i} (got {extent1} and {extent2})" # <<<<<<<<<<<<<< + * + * @cname('__pyx_memoryview_err_dim') +*/ + __pyx_t_1 = __Pyx_PyUnicode_From_int(__pyx_v_i, 0, ' ', 'd'); if (unlikely(!__pyx_t_1)) __PYX_ERR(1, 1250, __pyx_L1_error) + __Pyx_GOTREF(__pyx_t_1); + __pyx_t_2 = __Pyx_PyUnicode_From_Py_ssize_t(__pyx_v_extent1, 0, ' ', 'd'); if (unlikely(!__pyx_t_2)) __PYX_ERR(1, 1250, __pyx_L1_error) + __Pyx_GOTREF(__pyx_t_2); + __pyx_t_3 = __Pyx_PyUnicode_From_Py_ssize_t(__pyx_v_extent2, 0, ' ', 'd'); if (unlikely(!__pyx_t_3)) __PYX_ERR(1, 1250, __pyx_L1_error) + __Pyx_GOTREF(__pyx_t_3); + __pyx_t_4[0] = __pyx_mstate_global->__pyx_kp_u_got_differing_extents_in_dimensi; + __pyx_t_4[1] = __pyx_t_1; + __pyx_t_4[2] = __pyx_mstate_global->__pyx_kp_u_got; + __pyx_t_4[3] = __pyx_t_2; + __pyx_t_4[4] = __pyx_mstate_global->__pyx_kp_u_and; + __pyx_t_4[5] = __pyx_t_3; + __pyx_t_4[6] = __pyx_mstate_global->__pyx_kp_u__5; + __pyx_t_5 = __Pyx_PyUnicode_Join(__pyx_t_4, 7, 35 + __Pyx_PyUnicode_GET_LENGTH(__pyx_t_1) + 6 + __Pyx_PyUnicode_GET_LENGTH(__pyx_t_2) + 5 + __Pyx_PyUnicode_GET_LENGTH(__pyx_t_3) + 1, 127); + if (unlikely(!__pyx_t_5)) __PYX_ERR(1, 1250, __pyx_L1_error) + __Pyx_GOTREF(__pyx_t_5); + __Pyx_DECREF(__pyx_t_1); __pyx_t_1 = 0; + __Pyx_DECREF(__pyx_t_2); __pyx_t_2 = 0; + __Pyx_DECREF(__pyx_t_3); __pyx_t_3 = 0; + __Pyx_Raise(((PyObject *)(((PyTypeObject*)PyExc_ValueError))), __pyx_t_5, 0, 0); + __Pyx_DECREF(__pyx_t_5); __pyx_t_5 = 0; + __PYX_ERR(1, 1250, __pyx_L1_error) + + /* "View.MemoryView":1247 + * + * + * @cname('__pyx_memoryview_err_extents') # <<<<<<<<<<<<<< + * cdef int _err_extents(int i, Py_ssize_t extent1, + * Py_ssize_t extent2) except -1 with gil: +*/ + + /* function exit code */ + __pyx_L1_error:; + __Pyx_XDECREF(__pyx_t_1); + __Pyx_XDECREF(__pyx_t_2); + __Pyx_XDECREF(__pyx_t_3); + __Pyx_XDECREF(__pyx_t_5); + __Pyx_AddTraceback("View.MemoryView._err_extents", __pyx_clineno, __pyx_lineno, __pyx_filename); + __pyx_r = -1; + __Pyx_RefNannyFinishContext(); + __Pyx_PyGILState_Release(__pyx_gilstate_save); + return __pyx_r; +} + +/* "View.MemoryView":1252 + * raise ValueError, f"got differing extents in dimension {i} (got {extent1} and {extent2})" + * + * @cname('__pyx_memoryview_err_dim') # <<<<<<<<<<<<<< + * cdef int _err_dim(PyObject *error, str msg, int dim) except -1 with gil: + * raise error, msg % dim +*/ + +static int __pyx_memoryview_err_dim(PyObject *__pyx_v_error, PyObject *__pyx_v_msg, int __pyx_v_dim) { + int __pyx_r; + __Pyx_RefNannyDeclarations + PyObject *__pyx_t_1 = NULL; + PyObject *__pyx_t_2 = NULL; + int __pyx_lineno = 0; + const char *__pyx_filename = NULL; + int __pyx_clineno = 0; + PyGILState_STATE __pyx_gilstate_save = __Pyx_PyGILState_Ensure(); + __Pyx_RefNannySetupContext("_err_dim", 0); + __Pyx_INCREF(__pyx_v_msg); + + /* "View.MemoryView":1254 + * @cname('__pyx_memoryview_err_dim') + * cdef int _err_dim(PyObject *error, str msg, int dim) except -1 with gil: + * raise error, msg % dim # <<<<<<<<<<<<<< + * + * @cname('__pyx_memoryview_err') +*/ + __pyx_t_1 = __Pyx_PyLong_From_int(__pyx_v_dim); if (unlikely(!__pyx_t_1)) __PYX_ERR(1, 1254, __pyx_L1_error) + __Pyx_GOTREF(__pyx_t_1); + __pyx_t_2 = __Pyx_PyUnicode_FormatSafe(__pyx_v_msg, __pyx_t_1); if (unlikely(!__pyx_t_2)) __PYX_ERR(1, 1254, __pyx_L1_error) + __Pyx_GOTREF(__pyx_t_2); + __Pyx_DECREF(__pyx_t_1); __pyx_t_1 = 0; + __Pyx_Raise(((PyObject *)__pyx_v_error), __pyx_t_2, 0, 0); + __Pyx_DECREF(__pyx_t_2); __pyx_t_2 = 0; + __PYX_ERR(1, 1254, __pyx_L1_error) + + /* "View.MemoryView":1252 + * raise ValueError, f"got differing extents in dimension {i} (got {extent1} and {extent2})" + * + * @cname('__pyx_memoryview_err_dim') # <<<<<<<<<<<<<< + * cdef int _err_dim(PyObject *error, str msg, int dim) except -1 with gil: + * raise error, msg % dim +*/ + + /* function exit code */ + __pyx_L1_error:; + __Pyx_XDECREF(__pyx_t_1); + __Pyx_XDECREF(__pyx_t_2); + __Pyx_AddTraceback("View.MemoryView._err_dim", __pyx_clineno, __pyx_lineno, __pyx_filename); + __pyx_r = -1; + __Pyx_XDECREF(__pyx_v_msg); + __Pyx_RefNannyFinishContext(); + __Pyx_PyGILState_Release(__pyx_gilstate_save); + return __pyx_r; +} + +/* "View.MemoryView":1256 + * raise error, msg % dim + * + * @cname('__pyx_memoryview_err') # <<<<<<<<<<<<<< + * cdef int _err(PyObject *error, str msg) except -1 with gil: + * raise error, msg +*/ + +static int __pyx_memoryview_err(PyObject *__pyx_v_error, PyObject *__pyx_v_msg) { + int __pyx_r; + __Pyx_RefNannyDeclarations + int __pyx_lineno = 0; + const char *__pyx_filename = NULL; + int __pyx_clineno = 0; + PyGILState_STATE __pyx_gilstate_save = __Pyx_PyGILState_Ensure(); + __Pyx_RefNannySetupContext("_err", 0); + __Pyx_INCREF(__pyx_v_msg); + + /* "View.MemoryView":1258 + * @cname('__pyx_memoryview_err') + * cdef int _err(PyObject *error, str msg) except -1 with gil: + * raise error, msg # <<<<<<<<<<<<<< + * + * @cname('__pyx_memoryview_err_no_memory') +*/ + __Pyx_Raise(((PyObject *)__pyx_v_error), __pyx_v_msg, 0, 0); + __PYX_ERR(1, 1258, __pyx_L1_error) + + /* "View.MemoryView":1256 + * raise error, msg % dim + * + * @cname('__pyx_memoryview_err') # <<<<<<<<<<<<<< + * cdef int _err(PyObject *error, str msg) except -1 with gil: + * raise error, msg +*/ + + /* function exit code */ + __pyx_L1_error:; + __Pyx_AddTraceback("View.MemoryView._err", __pyx_clineno, __pyx_lineno, __pyx_filename); + __pyx_r = -1; + __Pyx_XDECREF(__pyx_v_msg); + __Pyx_RefNannyFinishContext(); + __Pyx_PyGILState_Release(__pyx_gilstate_save); + return __pyx_r; +} + +/* "View.MemoryView":1260 + * raise error, msg + * + * @cname('__pyx_memoryview_err_no_memory') # <<<<<<<<<<<<<< + * cdef int _err_no_memory() except -1 with gil: + * raise MemoryError +*/ + +static int __pyx_memoryview_err_no_memory(void) { + int __pyx_r; + int __pyx_lineno = 0; + const char *__pyx_filename = NULL; + int __pyx_clineno = 0; + PyGILState_STATE __pyx_gilstate_save = __Pyx_PyGILState_Ensure(); + + /* "View.MemoryView":1262 + * @cname('__pyx_memoryview_err_no_memory') + * cdef int _err_no_memory() except -1 with gil: + * raise MemoryError # <<<<<<<<<<<<<< + * + * +*/ + PyErr_NoMemory(); __PYX_ERR(1, 1262, __pyx_L1_error) + + /* "View.MemoryView":1260 + * raise error, msg + * + * @cname('__pyx_memoryview_err_no_memory') # <<<<<<<<<<<<<< + * cdef int _err_no_memory() except -1 with gil: + * raise MemoryError +*/ + + /* function exit code */ + __pyx_L1_error:; + __Pyx_AddTraceback("View.MemoryView._err_no_memory", __pyx_clineno, __pyx_lineno, __pyx_filename); + __pyx_r = -1; + __Pyx_PyGILState_Release(__pyx_gilstate_save); + return __pyx_r; +} + +/* "View.MemoryView":1265 + * + * + * @cname('__pyx_memoryview_copy_contents') # <<<<<<<<<<<<<< + * cdef int memoryview_copy_contents(__Pyx_memviewslice src, + * __Pyx_memviewslice dst, +*/ + +static int __pyx_memoryview_copy_contents(__Pyx_memviewslice __pyx_v_src, __Pyx_memviewslice __pyx_v_dst, int __pyx_v_src_ndim, int __pyx_v_dst_ndim, int __pyx_v_dtype_is_object) { + void *__pyx_v_tmpdata; + size_t __pyx_v_itemsize; + int __pyx_v_i; + char __pyx_v_order; + int __pyx_v_broadcasting; + int __pyx_v_direct_copy; + __Pyx_memviewslice __pyx_v_tmp; + int __pyx_v_ndim; + int __pyx_r; + Py_ssize_t __pyx_t_1; + int __pyx_t_2; + int __pyx_t_3; + int __pyx_t_4; + int __pyx_t_5; + int __pyx_t_6; + void *__pyx_t_7; + int __pyx_lineno = 0; + const char *__pyx_filename = NULL; + int __pyx_clineno = 0; + PyGILState_STATE __pyx_gilstate_save; + + /* "View.MemoryView":1274 + * Check for overlapping memory and verify the shapes. + * """ + * cdef void *tmpdata = NULL # <<<<<<<<<<<<<< + * cdef size_t itemsize = src.memview.view.itemsize + * cdef int i +*/ + __pyx_v_tmpdata = NULL; + + /* "View.MemoryView":1275 + * """ + * cdef void *tmpdata = NULL + * cdef size_t itemsize = src.memview.view.itemsize # <<<<<<<<<<<<<< + * cdef int i + * cdef char order = get_best_order(&src, src_ndim) +*/ + __pyx_t_1 = __pyx_v_src.memview->view.itemsize; + __pyx_v_itemsize = __pyx_t_1; + + /* "View.MemoryView":1277 + * cdef size_t itemsize = src.memview.view.itemsize + * cdef int i + * cdef char order = get_best_order(&src, src_ndim) # <<<<<<<<<<<<<< + * cdef bint broadcasting = False + * cdef bint direct_copy = False +*/ + __pyx_v_order = __pyx_get_best_slice_order((&__pyx_v_src), __pyx_v_src_ndim); + + /* "View.MemoryView":1278 + * cdef int i + * cdef char order = get_best_order(&src, src_ndim) + * cdef bint broadcasting = False # <<<<<<<<<<<<<< + * cdef bint direct_copy = False + * cdef __Pyx_memviewslice tmp +*/ + __pyx_v_broadcasting = 0; + + /* "View.MemoryView":1279 + * cdef char order = get_best_order(&src, src_ndim) + * cdef bint broadcasting = False + * cdef bint direct_copy = False # <<<<<<<<<<<<<< + * cdef __Pyx_memviewslice tmp + * +*/ + __pyx_v_direct_copy = 0; + + /* "View.MemoryView":1282 + * cdef __Pyx_memviewslice tmp + * + * if src_ndim < dst_ndim: # <<<<<<<<<<<<<< + * broadcast_leading(&src, src_ndim, dst_ndim) + * elif dst_ndim < src_ndim: +*/ + __pyx_t_2 = (__pyx_v_src_ndim < __pyx_v_dst_ndim); + if (__pyx_t_2) { + + /* "View.MemoryView":1283 + * + * if src_ndim < dst_ndim: + * broadcast_leading(&src, src_ndim, dst_ndim) # <<<<<<<<<<<<<< + * elif dst_ndim < src_ndim: + * broadcast_leading(&dst, dst_ndim, src_ndim) +*/ + __pyx_memoryview_broadcast_leading((&__pyx_v_src), __pyx_v_src_ndim, __pyx_v_dst_ndim); + + /* "View.MemoryView":1282 + * cdef __Pyx_memviewslice tmp + * + * if src_ndim < dst_ndim: # <<<<<<<<<<<<<< + * broadcast_leading(&src, src_ndim, dst_ndim) + * elif dst_ndim < src_ndim: +*/ + goto __pyx_L3; + } + + /* "View.MemoryView":1284 + * if src_ndim < dst_ndim: + * broadcast_leading(&src, src_ndim, dst_ndim) + * elif dst_ndim < src_ndim: # <<<<<<<<<<<<<< + * broadcast_leading(&dst, dst_ndim, src_ndim) + * +*/ + __pyx_t_2 = (__pyx_v_dst_ndim < __pyx_v_src_ndim); + if (__pyx_t_2) { + + /* "View.MemoryView":1285 + * broadcast_leading(&src, src_ndim, dst_ndim) + * elif dst_ndim < src_ndim: + * broadcast_leading(&dst, dst_ndim, src_ndim) # <<<<<<<<<<<<<< + * + * cdef int ndim = max(src_ndim, dst_ndim) +*/ + __pyx_memoryview_broadcast_leading((&__pyx_v_dst), __pyx_v_dst_ndim, __pyx_v_src_ndim); + + /* "View.MemoryView":1284 + * if src_ndim < dst_ndim: + * broadcast_leading(&src, src_ndim, dst_ndim) + * elif dst_ndim < src_ndim: # <<<<<<<<<<<<<< + * broadcast_leading(&dst, dst_ndim, src_ndim) + * +*/ + } + __pyx_L3:; + + /* "View.MemoryView":1287 + * broadcast_leading(&dst, dst_ndim, src_ndim) + * + * cdef int ndim = max(src_ndim, dst_ndim) # <<<<<<<<<<<<<< + * + * for i in range(ndim): +*/ + __pyx_t_3 = __pyx_v_dst_ndim; + __pyx_t_4 = __pyx_v_src_ndim; + __pyx_t_2 = (__pyx_t_3 > __pyx_t_4); + if (__pyx_t_2) { + __pyx_t_5 = __pyx_t_3; + } else { + __pyx_t_5 = __pyx_t_4; + } + __pyx_v_ndim = __pyx_t_5; + + /* "View.MemoryView":1289 + * cdef int ndim = max(src_ndim, dst_ndim) + * + * for i in range(ndim): # <<<<<<<<<<<<<< + * if src.shape[i] != dst.shape[i]: + * if src.shape[i] == 1: +*/ + __pyx_t_5 = __pyx_v_ndim; + __pyx_t_3 = __pyx_t_5; + for (__pyx_t_4 = 0; __pyx_t_4 < __pyx_t_3; __pyx_t_4+=1) { + __pyx_v_i = __pyx_t_4; + + /* "View.MemoryView":1290 + * + * for i in range(ndim): + * if src.shape[i] != dst.shape[i]: # <<<<<<<<<<<<<< + * if src.shape[i] == 1: + * broadcasting = True +*/ + __pyx_t_2 = ((__pyx_v_src.shape[__pyx_v_i]) != (__pyx_v_dst.shape[__pyx_v_i])); + if (__pyx_t_2) { + + /* "View.MemoryView":1291 + * for i in range(ndim): + * if src.shape[i] != dst.shape[i]: + * if src.shape[i] == 1: # <<<<<<<<<<<<<< + * broadcasting = True + * src.strides[i] = 0 +*/ + __pyx_t_2 = ((__pyx_v_src.shape[__pyx_v_i]) == 1); + if (__pyx_t_2) { + + /* "View.MemoryView":1292 + * if src.shape[i] != dst.shape[i]: + * if src.shape[i] == 1: + * broadcasting = True # <<<<<<<<<<<<<< + * src.strides[i] = 0 + * else: +*/ + __pyx_v_broadcasting = 1; + + /* "View.MemoryView":1293 + * if src.shape[i] == 1: + * broadcasting = True + * src.strides[i] = 0 # <<<<<<<<<<<<<< + * else: + * _err_extents(i, dst.shape[i], src.shape[i]) +*/ + (__pyx_v_src.strides[__pyx_v_i]) = 0; + + /* "View.MemoryView":1291 + * for i in range(ndim): + * if src.shape[i] != dst.shape[i]: + * if src.shape[i] == 1: # <<<<<<<<<<<<<< + * broadcasting = True + * src.strides[i] = 0 +*/ + goto __pyx_L7; + } + + /* "View.MemoryView":1295 + * src.strides[i] = 0 + * else: + * _err_extents(i, dst.shape[i], src.shape[i]) # <<<<<<<<<<<<<< + * + * if src.suboffsets[i] >= 0: +*/ + /*else*/ { + __pyx_t_6 = __pyx_memoryview_err_extents(__pyx_v_i, (__pyx_v_dst.shape[__pyx_v_i]), (__pyx_v_src.shape[__pyx_v_i])); if (unlikely(__pyx_t_6 == ((int)-1))) __PYX_ERR(1, 1295, __pyx_L1_error) + } + __pyx_L7:; + + /* "View.MemoryView":1290 + * + * for i in range(ndim): + * if src.shape[i] != dst.shape[i]: # <<<<<<<<<<<<<< + * if src.shape[i] == 1: + * broadcasting = True +*/ + } + + /* "View.MemoryView":1297 + * _err_extents(i, dst.shape[i], src.shape[i]) + * + * if src.suboffsets[i] >= 0: # <<<<<<<<<<<<<< + * _err_dim(PyExc_ValueError, "Dimension %d is not direct", i) + * +*/ + __pyx_t_2 = ((__pyx_v_src.suboffsets[__pyx_v_i]) >= 0); + if (__pyx_t_2) { + + /* "View.MemoryView":1298 + * + * if src.suboffsets[i] >= 0: + * _err_dim(PyExc_ValueError, "Dimension %d is not direct", i) # <<<<<<<<<<<<<< + * + * if slices_overlap(&src, &dst, ndim, itemsize): +*/ + __pyx_t_6 = __pyx_memoryview_err_dim(PyExc_ValueError, __pyx_mstate_global->__pyx_kp_u_Dimension_d_is_not_direct, __pyx_v_i); if (unlikely(__pyx_t_6 == ((int)-1))) __PYX_ERR(1, 1298, __pyx_L1_error) + + /* "View.MemoryView":1297 + * _err_extents(i, dst.shape[i], src.shape[i]) + * + * if src.suboffsets[i] >= 0: # <<<<<<<<<<<<<< + * _err_dim(PyExc_ValueError, "Dimension %d is not direct", i) + * +*/ + } + } + + /* "View.MemoryView":1300 + * _err_dim(PyExc_ValueError, "Dimension %d is not direct", i) + * + * if slices_overlap(&src, &dst, ndim, itemsize): # <<<<<<<<<<<<<< + * + * if not slice_is_contig(src, order, ndim): +*/ + __pyx_t_2 = __pyx_slices_overlap((&__pyx_v_src), (&__pyx_v_dst), __pyx_v_ndim, __pyx_v_itemsize); + if (__pyx_t_2) { + + /* "View.MemoryView":1302 + * if slices_overlap(&src, &dst, ndim, itemsize): + * + * if not slice_is_contig(src, order, ndim): # <<<<<<<<<<<<<< + * order = get_best_order(&dst, ndim) + * +*/ + __pyx_t_2 = (!__pyx_memviewslice_is_contig(__pyx_v_src, __pyx_v_order, __pyx_v_ndim)); + if (__pyx_t_2) { + + /* "View.MemoryView":1303 + * + * if not slice_is_contig(src, order, ndim): + * order = get_best_order(&dst, ndim) # <<<<<<<<<<<<<< + * + * tmpdata = copy_data_to_temp(&src, &tmp, order, ndim) +*/ + __pyx_v_order = __pyx_get_best_slice_order((&__pyx_v_dst), __pyx_v_ndim); + + /* "View.MemoryView":1302 + * if slices_overlap(&src, &dst, ndim, itemsize): + * + * if not slice_is_contig(src, order, ndim): # <<<<<<<<<<<<<< + * order = get_best_order(&dst, ndim) + * +*/ + } + + /* "View.MemoryView":1305 + * order = get_best_order(&dst, ndim) + * + * tmpdata = copy_data_to_temp(&src, &tmp, order, ndim) # <<<<<<<<<<<<<< + * src = tmp + * +*/ + __pyx_t_7 = __pyx_memoryview_copy_data_to_temp((&__pyx_v_src), (&__pyx_v_tmp), __pyx_v_order, __pyx_v_ndim); if (unlikely(__pyx_t_7 == ((void *)NULL))) __PYX_ERR(1, 1305, __pyx_L1_error) + __pyx_v_tmpdata = __pyx_t_7; + + /* "View.MemoryView":1306 + * + * tmpdata = copy_data_to_temp(&src, &tmp, order, ndim) + * src = tmp # <<<<<<<<<<<<<< + * + * if not broadcasting: +*/ + __pyx_v_src = __pyx_v_tmp; + + /* "View.MemoryView":1300 + * _err_dim(PyExc_ValueError, "Dimension %d is not direct", i) + * + * if slices_overlap(&src, &dst, ndim, itemsize): # <<<<<<<<<<<<<< + * + * if not slice_is_contig(src, order, ndim): +*/ + } + + /* "View.MemoryView":1308 + * src = tmp + * + * if not broadcasting: # <<<<<<<<<<<<<< + * + * +*/ + __pyx_t_2 = (!__pyx_v_broadcasting); + if (__pyx_t_2) { + + /* "View.MemoryView":1311 + * + * + * if slice_is_contig(src, 'C', ndim): # <<<<<<<<<<<<<< + * direct_copy = slice_is_contig(dst, 'C', ndim) + * elif slice_is_contig(src, 'F', ndim): +*/ + __pyx_t_2 = __pyx_memviewslice_is_contig(__pyx_v_src, 'C', __pyx_v_ndim); + if (__pyx_t_2) { + + /* "View.MemoryView":1312 + * + * if slice_is_contig(src, 'C', ndim): + * direct_copy = slice_is_contig(dst, 'C', ndim) # <<<<<<<<<<<<<< + * elif slice_is_contig(src, 'F', ndim): + * direct_copy = slice_is_contig(dst, 'F', ndim) +*/ + __pyx_v_direct_copy = __pyx_memviewslice_is_contig(__pyx_v_dst, 'C', __pyx_v_ndim); + + /* "View.MemoryView":1311 + * + * + * if slice_is_contig(src, 'C', ndim): # <<<<<<<<<<<<<< + * direct_copy = slice_is_contig(dst, 'C', ndim) + * elif slice_is_contig(src, 'F', ndim): +*/ + goto __pyx_L12; + } + + /* "View.MemoryView":1313 + * if slice_is_contig(src, 'C', ndim): + * direct_copy = slice_is_contig(dst, 'C', ndim) + * elif slice_is_contig(src, 'F', ndim): # <<<<<<<<<<<<<< + * direct_copy = slice_is_contig(dst, 'F', ndim) + * +*/ + __pyx_t_2 = __pyx_memviewslice_is_contig(__pyx_v_src, 'F', __pyx_v_ndim); + if (__pyx_t_2) { + + /* "View.MemoryView":1314 + * direct_copy = slice_is_contig(dst, 'C', ndim) + * elif slice_is_contig(src, 'F', ndim): + * direct_copy = slice_is_contig(dst, 'F', ndim) # <<<<<<<<<<<<<< + * + * if direct_copy: +*/ + __pyx_v_direct_copy = __pyx_memviewslice_is_contig(__pyx_v_dst, 'F', __pyx_v_ndim); + + /* "View.MemoryView":1313 + * if slice_is_contig(src, 'C', ndim): + * direct_copy = slice_is_contig(dst, 'C', ndim) + * elif slice_is_contig(src, 'F', ndim): # <<<<<<<<<<<<<< + * direct_copy = slice_is_contig(dst, 'F', ndim) + * +*/ + } + __pyx_L12:; + + /* "View.MemoryView":1316 + * direct_copy = slice_is_contig(dst, 'F', ndim) + * + * if direct_copy: # <<<<<<<<<<<<<< + * + * refcount_copying(&dst, dtype_is_object, ndim, inc=False) +*/ + if (__pyx_v_direct_copy) { + + /* "View.MemoryView":1318 + * if direct_copy: + * + * refcount_copying(&dst, dtype_is_object, ndim, inc=False) # <<<<<<<<<<<<<< + * memcpy(dst.data, src.data, slice_get_size(&src, ndim)) + * refcount_copying(&dst, dtype_is_object, ndim, inc=True) +*/ + __pyx_memoryview_refcount_copying((&__pyx_v_dst), __pyx_v_dtype_is_object, __pyx_v_ndim, 0); + + /* "View.MemoryView":1319 + * + * refcount_copying(&dst, dtype_is_object, ndim, inc=False) + * memcpy(dst.data, src.data, slice_get_size(&src, ndim)) # <<<<<<<<<<<<<< + * refcount_copying(&dst, dtype_is_object, ndim, inc=True) + * free(tmpdata) +*/ + (void)(memcpy(__pyx_v_dst.data, __pyx_v_src.data, __pyx_memoryview_slice_get_size((&__pyx_v_src), __pyx_v_ndim))); + + /* "View.MemoryView":1320 + * refcount_copying(&dst, dtype_is_object, ndim, inc=False) + * memcpy(dst.data, src.data, slice_get_size(&src, ndim)) + * refcount_copying(&dst, dtype_is_object, ndim, inc=True) # <<<<<<<<<<<<<< + * free(tmpdata) + * return 0 +*/ + __pyx_memoryview_refcount_copying((&__pyx_v_dst), __pyx_v_dtype_is_object, __pyx_v_ndim, 1); + + /* "View.MemoryView":1321 + * memcpy(dst.data, src.data, slice_get_size(&src, ndim)) + * refcount_copying(&dst, dtype_is_object, ndim, inc=True) + * free(tmpdata) # <<<<<<<<<<<<<< + * return 0 + * +*/ + free(__pyx_v_tmpdata); + + /* "View.MemoryView":1322 + * refcount_copying(&dst, dtype_is_object, ndim, inc=True) + * free(tmpdata) + * return 0 # <<<<<<<<<<<<<< + * + * if order == 'F' == get_best_order(&dst, ndim): +*/ + __pyx_r = 0; + goto __pyx_L0; + + /* "View.MemoryView":1316 + * direct_copy = slice_is_contig(dst, 'F', ndim) + * + * if direct_copy: # <<<<<<<<<<<<<< + * + * refcount_copying(&dst, dtype_is_object, ndim, inc=False) +*/ + } + + /* "View.MemoryView":1308 + * src = tmp + * + * if not broadcasting: # <<<<<<<<<<<<<< + * + * +*/ + } + + /* "View.MemoryView":1324 + * return 0 + * + * if order == 'F' == get_best_order(&dst, ndim): # <<<<<<<<<<<<<< + * + * +*/ + __pyx_t_2 = (__pyx_v_order == 'F'); + if (__pyx_t_2) { + __pyx_t_2 = ('F' == __pyx_get_best_slice_order((&__pyx_v_dst), __pyx_v_ndim)); + } + if (__pyx_t_2) { + + /* "View.MemoryView":1327 + * + * + * transpose_memslice(&src) # <<<<<<<<<<<<<< + * transpose_memslice(&dst) + * +*/ + __pyx_t_5 = __pyx_memslice_transpose((&__pyx_v_src)); if (unlikely(__pyx_t_5 == ((int)-1))) __PYX_ERR(1, 1327, __pyx_L1_error) + + /* "View.MemoryView":1328 + * + * transpose_memslice(&src) + * transpose_memslice(&dst) # <<<<<<<<<<<<<< + * + * refcount_copying(&dst, dtype_is_object, ndim, inc=False) +*/ + __pyx_t_5 = __pyx_memslice_transpose((&__pyx_v_dst)); if (unlikely(__pyx_t_5 == ((int)-1))) __PYX_ERR(1, 1328, __pyx_L1_error) + + /* "View.MemoryView":1324 + * return 0 + * + * if order == 'F' == get_best_order(&dst, ndim): # <<<<<<<<<<<<<< + * + * +*/ + } + + /* "View.MemoryView":1330 + * transpose_memslice(&dst) + * + * refcount_copying(&dst, dtype_is_object, ndim, inc=False) # <<<<<<<<<<<<<< + * copy_strided_to_strided(&src, &dst, ndim, itemsize) + * refcount_copying(&dst, dtype_is_object, ndim, inc=True) +*/ + __pyx_memoryview_refcount_copying((&__pyx_v_dst), __pyx_v_dtype_is_object, __pyx_v_ndim, 0); + + /* "View.MemoryView":1331 + * + * refcount_copying(&dst, dtype_is_object, ndim, inc=False) + * copy_strided_to_strided(&src, &dst, ndim, itemsize) # <<<<<<<<<<<<<< + * refcount_copying(&dst, dtype_is_object, ndim, inc=True) + * +*/ + copy_strided_to_strided((&__pyx_v_src), (&__pyx_v_dst), __pyx_v_ndim, __pyx_v_itemsize); + + /* "View.MemoryView":1332 + * refcount_copying(&dst, dtype_is_object, ndim, inc=False) + * copy_strided_to_strided(&src, &dst, ndim, itemsize) + * refcount_copying(&dst, dtype_is_object, ndim, inc=True) # <<<<<<<<<<<<<< + * + * free(tmpdata) +*/ + __pyx_memoryview_refcount_copying((&__pyx_v_dst), __pyx_v_dtype_is_object, __pyx_v_ndim, 1); + + /* "View.MemoryView":1334 + * refcount_copying(&dst, dtype_is_object, ndim, inc=True) + * + * free(tmpdata) # <<<<<<<<<<<<<< + * return 0 + * +*/ + free(__pyx_v_tmpdata); + + /* "View.MemoryView":1335 + * + * free(tmpdata) + * return 0 # <<<<<<<<<<<<<< + * + * @cname('__pyx_memoryview_broadcast_leading') +*/ + __pyx_r = 0; + goto __pyx_L0; + + /* "View.MemoryView":1265 + * + * + * @cname('__pyx_memoryview_copy_contents') # <<<<<<<<<<<<<< + * cdef int memoryview_copy_contents(__Pyx_memviewslice src, + * __Pyx_memviewslice dst, +*/ + + /* function exit code */ + __pyx_L1_error:; + __pyx_gilstate_save = __Pyx_PyGILState_Ensure(); + __Pyx_AddTraceback("View.MemoryView.memoryview_copy_contents", __pyx_clineno, __pyx_lineno, __pyx_filename); + __pyx_r = -1; + __Pyx_PyGILState_Release(__pyx_gilstate_save); + __pyx_L0:; + return __pyx_r; +} + +/* "View.MemoryView":1337 + * return 0 + * + * @cname('__pyx_memoryview_broadcast_leading') # <<<<<<<<<<<<<< + * cdef void broadcast_leading(__Pyx_memviewslice *mslice, + * int ndim, +*/ + +static void __pyx_memoryview_broadcast_leading(__Pyx_memviewslice *__pyx_v_mslice, int __pyx_v_ndim, int __pyx_v_ndim_other) { + int __pyx_v_i; + int __pyx_v_offset; + int __pyx_t_1; + int __pyx_t_2; + int __pyx_t_3; + + /* "View.MemoryView":1342 + * int ndim_other) noexcept nogil: + * cdef int i + * cdef int offset = ndim_other - ndim # <<<<<<<<<<<<<< + * + * for i in range(ndim - 1, -1, -1): +*/ + __pyx_v_offset = (__pyx_v_ndim_other - __pyx_v_ndim); + + /* "View.MemoryView":1344 + * cdef int offset = ndim_other - ndim + * + * for i in range(ndim - 1, -1, -1): # <<<<<<<<<<<<<< + * mslice.shape[i + offset] = mslice.shape[i] + * mslice.strides[i + offset] = mslice.strides[i] +*/ + for (__pyx_t_1 = (__pyx_v_ndim - 1); __pyx_t_1 > -1; __pyx_t_1-=1) { + __pyx_v_i = __pyx_t_1; + + /* "View.MemoryView":1345 + * + * for i in range(ndim - 1, -1, -1): + * mslice.shape[i + offset] = mslice.shape[i] # <<<<<<<<<<<<<< + * mslice.strides[i + offset] = mslice.strides[i] + * mslice.suboffsets[i + offset] = mslice.suboffsets[i] +*/ + (__pyx_v_mslice->shape[(__pyx_v_i + __pyx_v_offset)]) = (__pyx_v_mslice->shape[__pyx_v_i]); + + /* "View.MemoryView":1346 + * for i in range(ndim - 1, -1, -1): + * mslice.shape[i + offset] = mslice.shape[i] + * mslice.strides[i + offset] = mslice.strides[i] # <<<<<<<<<<<<<< + * mslice.suboffsets[i + offset] = mslice.suboffsets[i] + * +*/ + (__pyx_v_mslice->strides[(__pyx_v_i + __pyx_v_offset)]) = (__pyx_v_mslice->strides[__pyx_v_i]); + + /* "View.MemoryView":1347 + * mslice.shape[i + offset] = mslice.shape[i] + * mslice.strides[i + offset] = mslice.strides[i] + * mslice.suboffsets[i + offset] = mslice.suboffsets[i] # <<<<<<<<<<<<<< + * + * for i in range(offset): +*/ + (__pyx_v_mslice->suboffsets[(__pyx_v_i + __pyx_v_offset)]) = (__pyx_v_mslice->suboffsets[__pyx_v_i]); + } + + /* "View.MemoryView":1349 + * mslice.suboffsets[i + offset] = mslice.suboffsets[i] + * + * for i in range(offset): # <<<<<<<<<<<<<< + * mslice.shape[i] = 1 + * mslice.strides[i] = mslice.strides[0] +*/ + __pyx_t_1 = __pyx_v_offset; + __pyx_t_2 = __pyx_t_1; + for (__pyx_t_3 = 0; __pyx_t_3 < __pyx_t_2; __pyx_t_3+=1) { + __pyx_v_i = __pyx_t_3; + + /* "View.MemoryView":1350 + * + * for i in range(offset): + * mslice.shape[i] = 1 # <<<<<<<<<<<<<< + * mslice.strides[i] = mslice.strides[0] + * mslice.suboffsets[i] = -1 +*/ + (__pyx_v_mslice->shape[__pyx_v_i]) = 1; + + /* "View.MemoryView":1351 + * for i in range(offset): + * mslice.shape[i] = 1 + * mslice.strides[i] = mslice.strides[0] # <<<<<<<<<<<<<< + * mslice.suboffsets[i] = -1 + * +*/ + (__pyx_v_mslice->strides[__pyx_v_i]) = (__pyx_v_mslice->strides[0]); + + /* "View.MemoryView":1352 + * mslice.shape[i] = 1 + * mslice.strides[i] = mslice.strides[0] + * mslice.suboffsets[i] = -1 # <<<<<<<<<<<<<< + * + * +*/ + (__pyx_v_mslice->suboffsets[__pyx_v_i]) = -1L; + } + + /* "View.MemoryView":1337 + * return 0 + * + * @cname('__pyx_memoryview_broadcast_leading') # <<<<<<<<<<<<<< + * cdef void broadcast_leading(__Pyx_memviewslice *mslice, + * int ndim, +*/ + + /* function exit code */ +} + +/* "View.MemoryView":1359 + * + * + * @cname('__pyx_memoryview_refcount_copying') # <<<<<<<<<<<<<< + * cdef void refcount_copying(__Pyx_memviewslice *dst, bint dtype_is_object, int ndim, bint inc) noexcept nogil: + * +*/ + +static void __pyx_memoryview_refcount_copying(__Pyx_memviewslice *__pyx_v_dst, int __pyx_v_dtype_is_object, int __pyx_v_ndim, int __pyx_v_inc) { + + /* "View.MemoryView":1362 + * cdef void refcount_copying(__Pyx_memviewslice *dst, bint dtype_is_object, int ndim, bint inc) noexcept nogil: + * + * if dtype_is_object: # <<<<<<<<<<<<<< + * refcount_objects_in_slice_with_gil(dst.data, dst.shape, dst.strides, ndim, inc) + * +*/ + if (__pyx_v_dtype_is_object) { + + /* "View.MemoryView":1363 + * + * if dtype_is_object: + * refcount_objects_in_slice_with_gil(dst.data, dst.shape, dst.strides, ndim, inc) # <<<<<<<<<<<<<< + * + * @cname('__pyx_memoryview_refcount_objects_in_slice_with_gil') +*/ + __pyx_memoryview_refcount_objects_in_slice_with_gil(__pyx_v_dst->data, __pyx_v_dst->shape, __pyx_v_dst->strides, __pyx_v_ndim, __pyx_v_inc); + + /* "View.MemoryView":1362 + * cdef void refcount_copying(__Pyx_memviewslice *dst, bint dtype_is_object, int ndim, bint inc) noexcept nogil: + * + * if dtype_is_object: # <<<<<<<<<<<<<< + * refcount_objects_in_slice_with_gil(dst.data, dst.shape, dst.strides, ndim, inc) + * +*/ + } + + /* "View.MemoryView":1359 + * + * + * @cname('__pyx_memoryview_refcount_copying') # <<<<<<<<<<<<<< + * cdef void refcount_copying(__Pyx_memviewslice *dst, bint dtype_is_object, int ndim, bint inc) noexcept nogil: + * +*/ + + /* function exit code */ +} + +/* "View.MemoryView":1365 + * refcount_objects_in_slice_with_gil(dst.data, dst.shape, dst.strides, ndim, inc) + * + * @cname('__pyx_memoryview_refcount_objects_in_slice_with_gil') # <<<<<<<<<<<<<< + * cdef void refcount_objects_in_slice_with_gil(char *data, Py_ssize_t *shape, + * Py_ssize_t *strides, int ndim, +*/ + +static void __pyx_memoryview_refcount_objects_in_slice_with_gil(char *__pyx_v_data, Py_ssize_t *__pyx_v_shape, Py_ssize_t *__pyx_v_strides, int __pyx_v_ndim, int __pyx_v_inc) { + PyGILState_STATE __pyx_gilstate_save = __Pyx_PyGILState_Ensure(); + + /* "View.MemoryView":1369 + * Py_ssize_t *strides, int ndim, + * bint inc) noexcept with gil: + * refcount_objects_in_slice(data, shape, strides, ndim, inc) # <<<<<<<<<<<<<< + * + * @cname('__pyx_memoryview_refcount_objects_in_slice') +*/ + __pyx_memoryview_refcount_objects_in_slice(__pyx_v_data, __pyx_v_shape, __pyx_v_strides, __pyx_v_ndim, __pyx_v_inc); + + /* "View.MemoryView":1365 + * refcount_objects_in_slice_with_gil(dst.data, dst.shape, dst.strides, ndim, inc) + * + * @cname('__pyx_memoryview_refcount_objects_in_slice_with_gil') # <<<<<<<<<<<<<< + * cdef void refcount_objects_in_slice_with_gil(char *data, Py_ssize_t *shape, + * Py_ssize_t *strides, int ndim, +*/ + + /* function exit code */ + __Pyx_PyGILState_Release(__pyx_gilstate_save); +} + +/* "View.MemoryView":1371 + * refcount_objects_in_slice(data, shape, strides, ndim, inc) + * + * @cname('__pyx_memoryview_refcount_objects_in_slice') # <<<<<<<<<<<<<< + * cdef void refcount_objects_in_slice(char *data, Py_ssize_t *shape, + * Py_ssize_t *strides, int ndim, bint inc) noexcept: +*/ + +static void __pyx_memoryview_refcount_objects_in_slice(char *__pyx_v_data, Py_ssize_t *__pyx_v_shape, Py_ssize_t *__pyx_v_strides, int __pyx_v_ndim, int __pyx_v_inc) { + CYTHON_UNUSED Py_ssize_t __pyx_v_i; + Py_ssize_t __pyx_v_stride; + Py_ssize_t __pyx_t_1; + Py_ssize_t __pyx_t_2; + Py_ssize_t __pyx_t_3; + int __pyx_t_4; + + /* "View.MemoryView":1375 + * Py_ssize_t *strides, int ndim, bint inc) noexcept: + * cdef Py_ssize_t i + * cdef Py_ssize_t stride = strides[0] # <<<<<<<<<<<<<< + * + * for i in range(shape[0]): +*/ + __pyx_v_stride = (__pyx_v_strides[0]); + + /* "View.MemoryView":1377 + * cdef Py_ssize_t stride = strides[0] + * + * for i in range(shape[0]): # <<<<<<<<<<<<<< + * if ndim == 1: + * if inc: +*/ + __pyx_t_1 = (__pyx_v_shape[0]); + __pyx_t_2 = __pyx_t_1; + for (__pyx_t_3 = 0; __pyx_t_3 < __pyx_t_2; __pyx_t_3+=1) { + __pyx_v_i = __pyx_t_3; + + /* "View.MemoryView":1378 + * + * for i in range(shape[0]): + * if ndim == 1: # <<<<<<<<<<<<<< + * if inc: + * Py_INCREF(( data)[0]) +*/ + __pyx_t_4 = (__pyx_v_ndim == 1); + if (__pyx_t_4) { + + /* "View.MemoryView":1379 + * for i in range(shape[0]): + * if ndim == 1: + * if inc: # <<<<<<<<<<<<<< + * Py_INCREF(( data)[0]) + * else: +*/ + if (__pyx_v_inc) { + + /* "View.MemoryView":1380 + * if ndim == 1: + * if inc: + * Py_INCREF(( data)[0]) # <<<<<<<<<<<<<< + * else: + * Py_DECREF(( data)[0]) +*/ + Py_INCREF((((PyObject **)__pyx_v_data)[0])); + + /* "View.MemoryView":1379 + * for i in range(shape[0]): + * if ndim == 1: + * if inc: # <<<<<<<<<<<<<< + * Py_INCREF(( data)[0]) + * else: +*/ + goto __pyx_L6; + } + + /* "View.MemoryView":1382 + * Py_INCREF(( data)[0]) + * else: + * Py_DECREF(( data)[0]) # <<<<<<<<<<<<<< + * else: + * refcount_objects_in_slice(data, shape + 1, strides + 1, ndim - 1, inc) +*/ + /*else*/ { + Py_DECREF((((PyObject **)__pyx_v_data)[0])); + } + __pyx_L6:; + + /* "View.MemoryView":1378 + * + * for i in range(shape[0]): + * if ndim == 1: # <<<<<<<<<<<<<< + * if inc: + * Py_INCREF(( data)[0]) +*/ + goto __pyx_L5; + } + + /* "View.MemoryView":1384 + * Py_DECREF(( data)[0]) + * else: + * refcount_objects_in_slice(data, shape + 1, strides + 1, ndim - 1, inc) # <<<<<<<<<<<<<< + * + * data += stride +*/ + /*else*/ { + __pyx_memoryview_refcount_objects_in_slice(__pyx_v_data, (__pyx_v_shape + 1), (__pyx_v_strides + 1), (__pyx_v_ndim - 1), __pyx_v_inc); + } + __pyx_L5:; + + /* "View.MemoryView":1386 + * refcount_objects_in_slice(data, shape + 1, strides + 1, ndim - 1, inc) + * + * data += stride # <<<<<<<<<<<<<< + * + * +*/ + __pyx_v_data = (__pyx_v_data + __pyx_v_stride); + } + + /* "View.MemoryView":1371 + * refcount_objects_in_slice(data, shape, strides, ndim, inc) + * + * @cname('__pyx_memoryview_refcount_objects_in_slice') # <<<<<<<<<<<<<< + * cdef void refcount_objects_in_slice(char *data, Py_ssize_t *shape, + * Py_ssize_t *strides, int ndim, bint inc) noexcept: +*/ + + /* function exit code */ +} + +/* "View.MemoryView":1391 + * + * + * @cname('__pyx_memoryview_slice_assign_scalar') # <<<<<<<<<<<<<< + * cdef void slice_assign_scalar(__Pyx_memviewslice *dst, int ndim, + * size_t itemsize, void *item, +*/ + +static void __pyx_memoryview_slice_assign_scalar(__Pyx_memviewslice *__pyx_v_dst, int __pyx_v_ndim, size_t __pyx_v_itemsize, void *__pyx_v_item, int __pyx_v_dtype_is_object) { + + /* "View.MemoryView":1395 + * size_t itemsize, void *item, + * bint dtype_is_object) noexcept nogil: + * refcount_copying(dst, dtype_is_object, ndim, inc=False) # <<<<<<<<<<<<<< + * _slice_assign_scalar(dst.data, dst.shape, dst.strides, ndim, itemsize, item) + * refcount_copying(dst, dtype_is_object, ndim, inc=True) +*/ + __pyx_memoryview_refcount_copying(__pyx_v_dst, __pyx_v_dtype_is_object, __pyx_v_ndim, 0); + + /* "View.MemoryView":1396 + * bint dtype_is_object) noexcept nogil: + * refcount_copying(dst, dtype_is_object, ndim, inc=False) + * _slice_assign_scalar(dst.data, dst.shape, dst.strides, ndim, itemsize, item) # <<<<<<<<<<<<<< + * refcount_copying(dst, dtype_is_object, ndim, inc=True) + * +*/ + __pyx_memoryview__slice_assign_scalar(__pyx_v_dst->data, __pyx_v_dst->shape, __pyx_v_dst->strides, __pyx_v_ndim, __pyx_v_itemsize, __pyx_v_item); + + /* "View.MemoryView":1397 + * refcount_copying(dst, dtype_is_object, ndim, inc=False) + * _slice_assign_scalar(dst.data, dst.shape, dst.strides, ndim, itemsize, item) + * refcount_copying(dst, dtype_is_object, ndim, inc=True) # <<<<<<<<<<<<<< + * + * +*/ + __pyx_memoryview_refcount_copying(__pyx_v_dst, __pyx_v_dtype_is_object, __pyx_v_ndim, 1); + + /* "View.MemoryView":1391 + * + * + * @cname('__pyx_memoryview_slice_assign_scalar') # <<<<<<<<<<<<<< + * cdef void slice_assign_scalar(__Pyx_memviewslice *dst, int ndim, + * size_t itemsize, void *item, +*/ + + /* function exit code */ +} + +/* "View.MemoryView":1400 + * + * + * @cname('__pyx_memoryview__slice_assign_scalar') # <<<<<<<<<<<<<< + * cdef void _slice_assign_scalar(char *data, Py_ssize_t *shape, + * Py_ssize_t *strides, int ndim, +*/ + +static void __pyx_memoryview__slice_assign_scalar(char *__pyx_v_data, Py_ssize_t *__pyx_v_shape, Py_ssize_t *__pyx_v_strides, int __pyx_v_ndim, size_t __pyx_v_itemsize, void *__pyx_v_item) { + CYTHON_UNUSED Py_ssize_t __pyx_v_i; + Py_ssize_t __pyx_v_stride; + Py_ssize_t __pyx_v_extent; + int __pyx_t_1; + Py_ssize_t __pyx_t_2; + Py_ssize_t __pyx_t_3; + Py_ssize_t __pyx_t_4; + + /* "View.MemoryView":1405 + * size_t itemsize, void *item) noexcept nogil: + * cdef Py_ssize_t i + * cdef Py_ssize_t stride = strides[0] # <<<<<<<<<<<<<< + * cdef Py_ssize_t extent = shape[0] + * +*/ + __pyx_v_stride = (__pyx_v_strides[0]); + + /* "View.MemoryView":1406 + * cdef Py_ssize_t i + * cdef Py_ssize_t stride = strides[0] + * cdef Py_ssize_t extent = shape[0] # <<<<<<<<<<<<<< + * + * if ndim == 1: +*/ + __pyx_v_extent = (__pyx_v_shape[0]); + + /* "View.MemoryView":1408 + * cdef Py_ssize_t extent = shape[0] + * + * if ndim == 1: # <<<<<<<<<<<<<< + * for i in range(extent): + * memcpy(data, item, itemsize) +*/ + __pyx_t_1 = (__pyx_v_ndim == 1); + if (__pyx_t_1) { + + /* "View.MemoryView":1409 + * + * if ndim == 1: + * for i in range(extent): # <<<<<<<<<<<<<< + * memcpy(data, item, itemsize) + * data += stride +*/ + __pyx_t_2 = __pyx_v_extent; + __pyx_t_3 = __pyx_t_2; + for (__pyx_t_4 = 0; __pyx_t_4 < __pyx_t_3; __pyx_t_4+=1) { + __pyx_v_i = __pyx_t_4; + + /* "View.MemoryView":1410 + * if ndim == 1: + * for i in range(extent): + * memcpy(data, item, itemsize) # <<<<<<<<<<<<<< + * data += stride + * else: +*/ + (void)(memcpy(__pyx_v_data, __pyx_v_item, __pyx_v_itemsize)); + + /* "View.MemoryView":1411 + * for i in range(extent): + * memcpy(data, item, itemsize) + * data += stride # <<<<<<<<<<<<<< + * else: + * for i in range(extent): +*/ + __pyx_v_data = (__pyx_v_data + __pyx_v_stride); + } + + /* "View.MemoryView":1408 + * cdef Py_ssize_t extent = shape[0] + * + * if ndim == 1: # <<<<<<<<<<<<<< + * for i in range(extent): + * memcpy(data, item, itemsize) +*/ + goto __pyx_L3; + } + + /* "View.MemoryView":1413 + * data += stride + * else: + * for i in range(extent): # <<<<<<<<<<<<<< + * _slice_assign_scalar(data, shape + 1, strides + 1, ndim - 1, itemsize, item) + * data += stride +*/ + /*else*/ { + __pyx_t_2 = __pyx_v_extent; + __pyx_t_3 = __pyx_t_2; + for (__pyx_t_4 = 0; __pyx_t_4 < __pyx_t_3; __pyx_t_4+=1) { + __pyx_v_i = __pyx_t_4; + + /* "View.MemoryView":1414 + * else: + * for i in range(extent): + * _slice_assign_scalar(data, shape + 1, strides + 1, ndim - 1, itemsize, item) # <<<<<<<<<<<<<< + * data += stride + * +*/ + __pyx_memoryview__slice_assign_scalar(__pyx_v_data, (__pyx_v_shape + 1), (__pyx_v_strides + 1), (__pyx_v_ndim - 1), __pyx_v_itemsize, __pyx_v_item); + + /* "View.MemoryView":1415 + * for i in range(extent): + * _slice_assign_scalar(data, shape + 1, strides + 1, ndim - 1, itemsize, item) + * data += stride # <<<<<<<<<<<<<< + * +*/ + __pyx_v_data = (__pyx_v_data + __pyx_v_stride); + } + } + __pyx_L3:; + + /* "View.MemoryView":1400 + * + * + * @cname('__pyx_memoryview__slice_assign_scalar') # <<<<<<<<<<<<<< + * cdef void _slice_assign_scalar(char *data, Py_ssize_t *shape, + * Py_ssize_t *strides, int ndim, +*/ + + /* function exit code */ +} + +/* "(tree fragment)":4 + * int __Pyx_CheckUnpickleChecksum(long, long, long, long, const char*) except -1 + * int __Pyx_UpdateUnpickledDict(object, object, Py_ssize_t) except -1 + * def __pyx_unpickle_Enum(__pyx_type, long __pyx_checksum, tuple __pyx_state): # <<<<<<<<<<<<<< + * cdef object __pyx_result + * __Pyx_CheckUnpickleChecksum(__pyx_checksum, 0x82a3537, 0x6ae9995, 0xb068931, b'name') +*/ + +/* Python wrapper */ +static PyObject *__pyx_pw_15View_dot_MemoryView_1__pyx_unpickle_Enum(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*/ +static PyMethodDef __pyx_mdef_15View_dot_MemoryView_1__pyx_unpickle_Enum = {"__pyx_unpickle_Enum", (PyCFunction)(void(*)(void))(__Pyx_PyCFunction_FastCallWithKeywords)__pyx_pw_15View_dot_MemoryView_1__pyx_unpickle_Enum, __Pyx_METH_FASTCALL|METH_KEYWORDS, 0}; +static PyObject *__pyx_pw_15View_dot_MemoryView_1__pyx_unpickle_Enum(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 +) { + PyObject *__pyx_v___pyx_type = 0; + long __pyx_v___pyx_checksum; + 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[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("__pyx_unpickle_Enum (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_type,&__pyx_mstate_global->__pyx_n_u_pyx_checksum,&__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, 4, __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(1, 4, __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(1, 4, __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(1, 4, __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, "__pyx_unpickle_Enum", 0) < (0)) __PYX_ERR(1, 4, __pyx_L3_error) + for (Py_ssize_t i = __pyx_nargs; i < 3; i++) { + if (unlikely(!values[i])) { __Pyx_RaiseArgtupleInvalid("__pyx_unpickle_Enum", 1, 3, 3, i); __PYX_ERR(1, 4, __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(1, 4, __pyx_L3_error) + values[1] = __Pyx_ArgRef_FASTCALL(__pyx_args, 1); + if (!CYTHON_ASSUME_SAFE_MACROS && unlikely(!values[1])) __PYX_ERR(1, 4, __pyx_L3_error) + values[2] = __Pyx_ArgRef_FASTCALL(__pyx_args, 2); + if (!CYTHON_ASSUME_SAFE_MACROS && unlikely(!values[2])) __PYX_ERR(1, 4, __pyx_L3_error) + } + __pyx_v___pyx_type = values[0]; + __pyx_v___pyx_checksum = __Pyx_PyLong_As_long(values[1]); if (unlikely((__pyx_v___pyx_checksum == (long)-1) && PyErr_Occurred())) __PYX_ERR(1, 4, __pyx_L3_error) + __pyx_v___pyx_state = ((PyObject*)values[2]); + } + goto __pyx_L6_skip; + __pyx_L5_argtuple_error:; + __Pyx_RaiseArgtupleInvalid("__pyx_unpickle_Enum", 1, 3, 3, __pyx_nargs); __PYX_ERR(1, 4, __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("View.MemoryView.__pyx_unpickle_Enum", __pyx_clineno, __pyx_lineno, __pyx_filename); + __Pyx_RefNannyFinishContext(); + return NULL; + __pyx_L4_argument_unpacking_done:; + if (unlikely(!__Pyx_ArgTypeTest(((PyObject *)__pyx_v___pyx_state), (&PyTuple_Type), 1, "__pyx_state", 1))) __PYX_ERR(1, 4, __pyx_L1_error) + __pyx_r = __pyx_pf_15View_dot_MemoryView___pyx_unpickle_Enum(__pyx_self, __pyx_v___pyx_type, __pyx_v___pyx_checksum, __pyx_v___pyx_state); + + /* 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_15View_dot_MemoryView___pyx_unpickle_Enum(CYTHON_UNUSED PyObject *__pyx_self, PyObject *__pyx_v___pyx_type, long __pyx_v___pyx_checksum, PyObject *__pyx_v___pyx_state) { + PyObject *__pyx_v___pyx_result = 0; + 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_t_5; + int __pyx_lineno = 0; + const char *__pyx_filename = NULL; + int __pyx_clineno = 0; + __Pyx_RefNannySetupContext("__pyx_unpickle_Enum", 0); + + /* "(tree fragment)":6 + * def __pyx_unpickle_Enum(__pyx_type, long __pyx_checksum, tuple __pyx_state): + * cdef object __pyx_result + * __Pyx_CheckUnpickleChecksum(__pyx_checksum, 0x82a3537, 0x6ae9995, 0xb068931, b'name') # <<<<<<<<<<<<<< + * __pyx_result = Enum.__new__(__pyx_type) + * if __pyx_state is not None: +*/ + __pyx_t_1 = __Pyx_CheckUnpickleChecksum(__pyx_v___pyx_checksum, 0x82a3537, 0x6ae9995, 0xb068931, ((char const *)"name")); if (unlikely(__pyx_t_1 == ((int)-1))) __PYX_ERR(1, 6, __pyx_L1_error) + + /* "(tree fragment)":7 + * cdef object __pyx_result + * __Pyx_CheckUnpickleChecksum(__pyx_checksum, 0x82a3537, 0x6ae9995, 0xb068931, b'name') + * __pyx_result = Enum.__new__(__pyx_type) # <<<<<<<<<<<<<< + * if __pyx_state is not None: + * __pyx_unpickle_Enum__set_state( __pyx_result, __pyx_state) +*/ + __pyx_t_3 = ((PyObject *)__pyx_mstate_global->__pyx_MemviewEnum_type); + __Pyx_INCREF(__pyx_t_3); + __pyx_t_4 = 0; + { + PyObject *__pyx_callargs[2] = {__pyx_t_3, __pyx_v___pyx_type}; + __pyx_t_2 = __Pyx_PyObject_FastCallMethod((PyObject*)__pyx_mstate_global->__pyx_n_u_new, __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_2)) __PYX_ERR(1, 7, __pyx_L1_error) + __Pyx_GOTREF(__pyx_t_2); + } + __pyx_v___pyx_result = __pyx_t_2; + __pyx_t_2 = 0; + + /* "(tree fragment)":8 + * __Pyx_CheckUnpickleChecksum(__pyx_checksum, 0x82a3537, 0x6ae9995, 0xb068931, b'name') + * __pyx_result = Enum.__new__(__pyx_type) + * if __pyx_state is not None: # <<<<<<<<<<<<<< + * __pyx_unpickle_Enum__set_state( __pyx_result, __pyx_state) + * return __pyx_result +*/ + __pyx_t_5 = (__pyx_v___pyx_state != ((PyObject*)Py_None)); + if (__pyx_t_5) { + + /* "(tree fragment)":9 + * __pyx_result = Enum.__new__(__pyx_type) + * if __pyx_state is not None: + * __pyx_unpickle_Enum__set_state( __pyx_result, __pyx_state) # <<<<<<<<<<<<<< + * return __pyx_result + * cdef __pyx_unpickle_Enum__set_state(Enum __pyx_result, __pyx_state: tuple): +*/ + if (unlikely(__pyx_v___pyx_state == Py_None)) { + PyErr_SetString(PyExc_TypeError, "cannot pass None into a C function argument that is declared 'not None'"); + __PYX_ERR(1, 9, __pyx_L1_error) + } + __pyx_t_2 = __pyx_unpickle_Enum__set_state(((struct __pyx_MemviewEnum_obj *)__pyx_v___pyx_result), __pyx_v___pyx_state); if (unlikely(!__pyx_t_2)) __PYX_ERR(1, 9, __pyx_L1_error) + __Pyx_GOTREF(__pyx_t_2); + __Pyx_DECREF(__pyx_t_2); __pyx_t_2 = 0; + + /* "(tree fragment)":8 + * __Pyx_CheckUnpickleChecksum(__pyx_checksum, 0x82a3537, 0x6ae9995, 0xb068931, b'name') + * __pyx_result = Enum.__new__(__pyx_type) + * if __pyx_state is not None: # <<<<<<<<<<<<<< + * __pyx_unpickle_Enum__set_state( __pyx_result, __pyx_state) + * return __pyx_result +*/ + } + + /* "(tree fragment)":10 + * if __pyx_state is not None: + * __pyx_unpickle_Enum__set_state( __pyx_result, __pyx_state) + * return __pyx_result # <<<<<<<<<<<<<< + * cdef __pyx_unpickle_Enum__set_state(Enum __pyx_result, __pyx_state: tuple): + * __pyx_result.name = __pyx_state[0] +*/ + __Pyx_XDECREF(__pyx_r); + __Pyx_INCREF(__pyx_v___pyx_result); + __pyx_r = __pyx_v___pyx_result; + goto __pyx_L0; + + /* "(tree fragment)":4 + * int __Pyx_CheckUnpickleChecksum(long, long, long, long, const char*) except -1 + * int __Pyx_UpdateUnpickledDict(object, object, Py_ssize_t) except -1 + * def __pyx_unpickle_Enum(__pyx_type, long __pyx_checksum, tuple __pyx_state): # <<<<<<<<<<<<<< + * cdef object __pyx_result + * __Pyx_CheckUnpickleChecksum(__pyx_checksum, 0x82a3537, 0x6ae9995, 0xb068931, b'name') +*/ + + /* function exit code */ + __pyx_L1_error:; + __Pyx_XDECREF(__pyx_t_2); + __Pyx_XDECREF(__pyx_t_3); + __Pyx_AddTraceback("View.MemoryView.__pyx_unpickle_Enum", __pyx_clineno, __pyx_lineno, __pyx_filename); + __pyx_r = NULL; + __pyx_L0:; + __Pyx_XDECREF(__pyx_v___pyx_result); + __Pyx_XGIVEREF(__pyx_r); + __Pyx_RefNannyFinishContext(); + return __pyx_r; +} + +/* "(tree fragment)":11 + * __pyx_unpickle_Enum__set_state( __pyx_result, __pyx_state) + * return __pyx_result + * cdef __pyx_unpickle_Enum__set_state(Enum __pyx_result, __pyx_state: tuple): # <<<<<<<<<<<<<< + * __pyx_result.name = __pyx_state[0] + * __Pyx_UpdateUnpickledDict(__pyx_result, __pyx_state, 1) +*/ + +static PyObject *__pyx_unpickle_Enum__set_state(struct __pyx_MemviewEnum_obj *__pyx_v___pyx_result, PyObject *__pyx_v___pyx_state) { + PyObject *__pyx_r = NULL; + __Pyx_RefNannyDeclarations + PyObject *__pyx_t_1 = NULL; + int __pyx_t_2; + int __pyx_lineno = 0; + const char *__pyx_filename = NULL; + int __pyx_clineno = 0; + __Pyx_RefNannySetupContext("__pyx_unpickle_Enum__set_state", 0); + + /* "(tree fragment)":12 + * return __pyx_result + * cdef __pyx_unpickle_Enum__set_state(Enum __pyx_result, __pyx_state: tuple): + * __pyx_result.name = __pyx_state[0] # <<<<<<<<<<<<<< + * __Pyx_UpdateUnpickledDict(__pyx_result, __pyx_state, 1) +*/ + __pyx_t_1 = __Pyx_GetItemInt_Tuple(__pyx_v___pyx_state, 0, long, 1, __Pyx_PyLong_From_long, 0, 0, 1, 1, __Pyx_ReferenceSharing_FunctionArgument); if (unlikely(!__pyx_t_1)) __PYX_ERR(1, 12, __pyx_L1_error) + __Pyx_GOTREF(__pyx_t_1); + __Pyx_GIVEREF(__pyx_t_1); + __Pyx_GOTREF(__pyx_v___pyx_result->name); + __Pyx_DECREF(__pyx_v___pyx_result->name); + __pyx_v___pyx_result->name = __pyx_t_1; + __pyx_t_1 = 0; + + /* "(tree fragment)":13 + * cdef __pyx_unpickle_Enum__set_state(Enum __pyx_result, __pyx_state: tuple): + * __pyx_result.name = __pyx_state[0] + * __Pyx_UpdateUnpickledDict(__pyx_result, __pyx_state, 1) # <<<<<<<<<<<<<< +*/ + __pyx_t_2 = __Pyx_UpdateUnpickledDict(((PyObject *)__pyx_v___pyx_result), __pyx_v___pyx_state, 1); if (unlikely(__pyx_t_2 == ((int)-1))) __PYX_ERR(1, 13, __pyx_L1_error) + + /* "(tree fragment)":11 + * __pyx_unpickle_Enum__set_state( __pyx_result, __pyx_state) + * return __pyx_result + * cdef __pyx_unpickle_Enum__set_state(Enum __pyx_result, __pyx_state: tuple): # <<<<<<<<<<<<<< + * __pyx_result.name = __pyx_state[0] + * __Pyx_UpdateUnpickledDict(__pyx_result, __pyx_state, 1) +*/ + + /* function exit code */ + __pyx_r = Py_None; __Pyx_INCREF(Py_None); + goto __pyx_L0; + __pyx_L1_error:; + __Pyx_XDECREF(__pyx_t_1); + __Pyx_AddTraceback("View.MemoryView.__pyx_unpickle_Enum__set_state", __pyx_clineno, __pyx_lineno, __pyx_filename); + __pyx_r = 0; + __pyx_L0:; + __Pyx_XGIVEREF(__pyx_r); + __Pyx_RefNannyFinishContext(); + return __pyx_r; +} + +/* "thinc/extra/search.pxd":56 + * cdef int _fill(self, Queue* q, weight_t** scores, int** is_valid) except -1 + * + * cdef inline void* at(self, int i) nogil: # <<<<<<<<<<<<<< + * return self._states[i].content + * +*/ + +static CYTHON_INLINE void *__pyx_f_5thinc_5extra_6search_4Beam_at(struct __pyx_obj_5thinc_5extra_6search_Beam *__pyx_v_self, int __pyx_v_i) { + void *__pyx_r; + + /* "thinc/extra/search.pxd":57 + * + * cdef inline void* at(self, int i) nogil: + * return self._states[i].content # <<<<<<<<<<<<<< + * + * cdef int initialize(self, init_func_t init_func, del_func_t del_func, int n, void* extra_args) except -1 +*/ + __pyx_r = (__pyx_v_self->_states[__pyx_v_i]).content; + goto __pyx_L0; + + /* "thinc/extra/search.pxd":56 + * cdef int _fill(self, Queue* q, weight_t** scores, int** is_valid) except -1 + * + * cdef inline void* at(self, int i) nogil: # <<<<<<<<<<<<<< + * return self._states[i].content + * +*/ + + /* function exit code */ + __pyx_L0:; + return __pyx_r; +} + +/* "thinc/extra/search.pxd":65 + * + * + * cdef inline void set_cell(self, int i, int j, weight_t score, int is_valid, weight_t cost) nogil: # <<<<<<<<<<<<<< + * self.scores[i][j] = score + * self.is_valid[i][j] = is_valid +*/ + +static CYTHON_INLINE void __pyx_f_5thinc_5extra_6search_4Beam_set_cell(struct __pyx_obj_5thinc_5extra_6search_Beam *__pyx_v_self, int __pyx_v_i, int __pyx_v_j, __pyx_t_5thinc_5extra_6search_weight_t __pyx_v_score, int __pyx_v_is_valid, __pyx_t_5thinc_5extra_6search_weight_t __pyx_v_cost) { + + /* "thinc/extra/search.pxd":66 + * + * cdef inline void set_cell(self, int i, int j, weight_t score, int is_valid, weight_t cost) nogil: + * self.scores[i][j] = score # <<<<<<<<<<<<<< + * self.is_valid[i][j] = is_valid + * self.costs[i][j] = cost +*/ + ((__pyx_v_self->scores[__pyx_v_i])[__pyx_v_j]) = __pyx_v_score; + + /* "thinc/extra/search.pxd":67 + * cdef inline void set_cell(self, int i, int j, weight_t score, int is_valid, weight_t cost) nogil: + * self.scores[i][j] = score + * self.is_valid[i][j] = is_valid # <<<<<<<<<<<<<< + * self.costs[i][j] = cost + * +*/ + ((__pyx_v_self->is_valid[__pyx_v_i])[__pyx_v_j]) = __pyx_v_is_valid; + + /* "thinc/extra/search.pxd":68 + * self.scores[i][j] = score + * self.is_valid[i][j] = is_valid + * self.costs[i][j] = cost # <<<<<<<<<<<<<< + * + * cdef int set_row(self, int i, const weight_t* scores, const int* is_valid, +*/ + ((__pyx_v_self->costs[__pyx_v_i])[__pyx_v_j]) = __pyx_v_cost; + + /* "thinc/extra/search.pxd":65 + * + * + * cdef inline void set_cell(self, int i, int j, weight_t score, int is_valid, weight_t cost) nogil: # <<<<<<<<<<<<<< + * self.scores[i][j] = score + * self.is_valid[i][j] = is_valid +*/ + + /* function exit code */ +} + +/* "C:/Users/runneradmin/AppData/Local/Temp/build-env-ej_q3m8u/Lib/site-packages/numpy/__init__.cython-30.pxd":242 + * cdef int type_num + * + * @property # <<<<<<<<<<<<<< + * cdef inline npy_intp itemsize(self) noexcept nogil: + * return PyDataType_ELSIZE(self) +*/ + +static CYTHON_INLINE npy_intp __pyx_f_5numpy_5dtype_8itemsize_itemsize(PyArray_Descr *__pyx_v_self) { + npy_intp __pyx_r; + + /* "C:/Users/runneradmin/AppData/Local/Temp/build-env-ej_q3m8u/Lib/site-packages/numpy/__init__.cython-30.pxd":244 + * @property + * cdef inline npy_intp itemsize(self) noexcept nogil: + * return PyDataType_ELSIZE(self) # <<<<<<<<<<<<<< + * + * @property +*/ + __pyx_r = PyDataType_ELSIZE(__pyx_v_self); + goto __pyx_L0; + + /* "C:/Users/runneradmin/AppData/Local/Temp/build-env-ej_q3m8u/Lib/site-packages/numpy/__init__.cython-30.pxd":242 + * cdef int type_num + * + * @property # <<<<<<<<<<<<<< + * cdef inline npy_intp itemsize(self) noexcept nogil: + * return PyDataType_ELSIZE(self) +*/ + + /* function exit code */ + __pyx_L0:; + return __pyx_r; +} + +/* "C:/Users/runneradmin/AppData/Local/Temp/build-env-ej_q3m8u/Lib/site-packages/numpy/__init__.cython-30.pxd":246 + * return PyDataType_ELSIZE(self) + * + * @property # <<<<<<<<<<<<<< + * cdef inline npy_intp alignment(self) noexcept nogil: + * return PyDataType_ALIGNMENT(self) +*/ + +static CYTHON_INLINE npy_intp __pyx_f_5numpy_5dtype_9alignment_alignment(PyArray_Descr *__pyx_v_self) { + npy_intp __pyx_r; + + /* "C:/Users/runneradmin/AppData/Local/Temp/build-env-ej_q3m8u/Lib/site-packages/numpy/__init__.cython-30.pxd":248 + * @property + * cdef inline npy_intp alignment(self) noexcept nogil: + * return PyDataType_ALIGNMENT(self) # <<<<<<<<<<<<<< + * + * # Use fields/names with care as they may be NULL. You must check +*/ + __pyx_r = PyDataType_ALIGNMENT(__pyx_v_self); + goto __pyx_L0; + + /* "C:/Users/runneradmin/AppData/Local/Temp/build-env-ej_q3m8u/Lib/site-packages/numpy/__init__.cython-30.pxd":246 + * return PyDataType_ELSIZE(self) + * + * @property # <<<<<<<<<<<<<< + * cdef inline npy_intp alignment(self) noexcept nogil: + * return PyDataType_ALIGNMENT(self) +*/ + + /* function exit code */ + __pyx_L0:; + return __pyx_r; +} + +/* "C:/Users/runneradmin/AppData/Local/Temp/build-env-ej_q3m8u/Lib/site-packages/numpy/__init__.cython-30.pxd":252 + * # Use fields/names with care as they may be NULL. You must check + * # for this using PyDataType_HASFIELDS. + * @property # <<<<<<<<<<<<<< + * cdef inline object fields(self): + * return PyDataType_FIELDS(self) +*/ + +static CYTHON_INLINE PyObject *__pyx_f_5numpy_5dtype_6fields_fields(PyArray_Descr *__pyx_v_self) { + PyObject *__pyx_r = NULL; + __Pyx_RefNannyDeclarations + PyObject *__pyx_t_1; + __Pyx_RefNannySetupContext("fields", 0); + + /* "C:/Users/runneradmin/AppData/Local/Temp/build-env-ej_q3m8u/Lib/site-packages/numpy/__init__.cython-30.pxd":254 + * @property + * cdef inline object fields(self): + * return PyDataType_FIELDS(self) # <<<<<<<<<<<<<< + * + * @property +*/ + __Pyx_XDECREF(__pyx_r); + __pyx_t_1 = PyDataType_FIELDS(__pyx_v_self); + __Pyx_INCREF(((PyObject *)__pyx_t_1)); + __pyx_r = ((PyObject *)__pyx_t_1); + goto __pyx_L0; + + /* "C:/Users/runneradmin/AppData/Local/Temp/build-env-ej_q3m8u/Lib/site-packages/numpy/__init__.cython-30.pxd":252 + * # Use fields/names with care as they may be NULL. You must check + * # for this using PyDataType_HASFIELDS. + * @property # <<<<<<<<<<<<<< + * cdef inline object fields(self): + * return PyDataType_FIELDS(self) +*/ + + /* function exit code */ + __pyx_L0:; + __Pyx_XGIVEREF(__pyx_r); + __Pyx_RefNannyFinishContext(); + return __pyx_r; +} + +/* "C:/Users/runneradmin/AppData/Local/Temp/build-env-ej_q3m8u/Lib/site-packages/numpy/__init__.cython-30.pxd":256 + * return PyDataType_FIELDS(self) + * + * @property # <<<<<<<<<<<<<< + * cdef inline tuple names(self): + * return PyDataType_NAMES(self) +*/ + +static CYTHON_INLINE PyObject *__pyx_f_5numpy_5dtype_5names_names(PyArray_Descr *__pyx_v_self) { + PyObject *__pyx_r = NULL; + __Pyx_RefNannyDeclarations + PyObject *__pyx_t_1; + __Pyx_RefNannySetupContext("names", 0); + + /* "C:/Users/runneradmin/AppData/Local/Temp/build-env-ej_q3m8u/Lib/site-packages/numpy/__init__.cython-30.pxd":258 + * @property + * cdef inline tuple names(self): + * return PyDataType_NAMES(self) # <<<<<<<<<<<<<< + * + * # Use PyDataType_HASSUBARRAY to test whether this field is +*/ + __Pyx_XDECREF(__pyx_r); + __pyx_t_1 = PyDataType_NAMES(__pyx_v_self); + __Pyx_INCREF(((PyObject*)__pyx_t_1)); + __pyx_r = ((PyObject*)__pyx_t_1); + goto __pyx_L0; + + /* "C:/Users/runneradmin/AppData/Local/Temp/build-env-ej_q3m8u/Lib/site-packages/numpy/__init__.cython-30.pxd":256 + * return PyDataType_FIELDS(self) + * + * @property # <<<<<<<<<<<<<< + * cdef inline tuple names(self): + * return PyDataType_NAMES(self) +*/ + + /* function exit code */ + __pyx_L0:; + __Pyx_XGIVEREF(__pyx_r); + __Pyx_RefNannyFinishContext(); + return __pyx_r; +} + +/* "C:/Users/runneradmin/AppData/Local/Temp/build-env-ej_q3m8u/Lib/site-packages/numpy/__init__.cython-30.pxd":263 + * # valid (the pointer can be NULL). Most users should access + * # this field via the inline helper method PyDataType_SHAPE. + * @property # <<<<<<<<<<<<<< + * cdef inline PyArray_ArrayDescr* subarray(self) noexcept nogil: + * return PyDataType_SUBARRAY(self) +*/ + +static CYTHON_INLINE PyArray_ArrayDescr *__pyx_f_5numpy_5dtype_8subarray_subarray(PyArray_Descr *__pyx_v_self) { + PyArray_ArrayDescr *__pyx_r; + + /* "C:/Users/runneradmin/AppData/Local/Temp/build-env-ej_q3m8u/Lib/site-packages/numpy/__init__.cython-30.pxd":265 + * @property + * cdef inline PyArray_ArrayDescr* subarray(self) noexcept nogil: + * return PyDataType_SUBARRAY(self) # <<<<<<<<<<<<<< + * + * @property +*/ + __pyx_r = PyDataType_SUBARRAY(__pyx_v_self); + goto __pyx_L0; + + /* "C:/Users/runneradmin/AppData/Local/Temp/build-env-ej_q3m8u/Lib/site-packages/numpy/__init__.cython-30.pxd":263 + * # valid (the pointer can be NULL). Most users should access + * # this field via the inline helper method PyDataType_SHAPE. + * @property # <<<<<<<<<<<<<< + * cdef inline PyArray_ArrayDescr* subarray(self) noexcept nogil: + * return PyDataType_SUBARRAY(self) +*/ + + /* function exit code */ + __pyx_L0:; + return __pyx_r; +} + +/* "C:/Users/runneradmin/AppData/Local/Temp/build-env-ej_q3m8u/Lib/site-packages/numpy/__init__.cython-30.pxd":267 + * return PyDataType_SUBARRAY(self) + * + * @property # <<<<<<<<<<<<<< + * cdef inline npy_uint64 flags(self) noexcept nogil: + * """The data types flags.""" +*/ + +static CYTHON_INLINE npy_uint64 __pyx_f_5numpy_5dtype_5flags_flags(PyArray_Descr *__pyx_v_self) { + npy_uint64 __pyx_r; + + /* "C:/Users/runneradmin/AppData/Local/Temp/build-env-ej_q3m8u/Lib/site-packages/numpy/__init__.cython-30.pxd":270 + * cdef inline npy_uint64 flags(self) noexcept nogil: + * """The data types flags.""" + * return PyDataType_FLAGS(self) # <<<<<<<<<<<<<< + * + * +*/ + __pyx_r = PyDataType_FLAGS(__pyx_v_self); + goto __pyx_L0; + + /* "C:/Users/runneradmin/AppData/Local/Temp/build-env-ej_q3m8u/Lib/site-packages/numpy/__init__.cython-30.pxd":267 + * return PyDataType_SUBARRAY(self) + * + * @property # <<<<<<<<<<<<<< + * cdef inline npy_uint64 flags(self) noexcept nogil: + * """The data types flags.""" +*/ + + /* function exit code */ + __pyx_L0:; + return __pyx_r; +} + +/* "C:/Users/runneradmin/AppData/Local/Temp/build-env-ej_q3m8u/Lib/site-packages/numpy/__init__.cython-30.pxd":279 + * ctypedef class numpy.broadcast [object PyArrayMultiIterObject, check_size ignore]: + * + * @property # <<<<<<<<<<<<<< + * cdef inline int numiter(self) noexcept nogil: + * """The number of arrays that need to be broadcast to the same shape.""" +*/ + +static CYTHON_INLINE int __pyx_f_5numpy_9broadcast_7numiter_numiter(PyArrayMultiIterObject *__pyx_v_self) { + int __pyx_r; + + /* "C:/Users/runneradmin/AppData/Local/Temp/build-env-ej_q3m8u/Lib/site-packages/numpy/__init__.cython-30.pxd":282 + * cdef inline int numiter(self) noexcept nogil: + * """The number of arrays that need to be broadcast to the same shape.""" + * return PyArray_MultiIter_NUMITER(self) # <<<<<<<<<<<<<< + * + * @property +*/ + __pyx_r = PyArray_MultiIter_NUMITER(__pyx_v_self); + goto __pyx_L0; + + /* "C:/Users/runneradmin/AppData/Local/Temp/build-env-ej_q3m8u/Lib/site-packages/numpy/__init__.cython-30.pxd":279 + * ctypedef class numpy.broadcast [object PyArrayMultiIterObject, check_size ignore]: + * + * @property # <<<<<<<<<<<<<< + * cdef inline int numiter(self) noexcept nogil: + * """The number of arrays that need to be broadcast to the same shape.""" +*/ + + /* function exit code */ + __pyx_L0:; + return __pyx_r; +} + +/* "C:/Users/runneradmin/AppData/Local/Temp/build-env-ej_q3m8u/Lib/site-packages/numpy/__init__.cython-30.pxd":284 + * return PyArray_MultiIter_NUMITER(self) + * + * @property # <<<<<<<<<<<<<< + * cdef inline npy_intp size(self) noexcept nogil: + * """The total broadcasted size.""" +*/ + +static CYTHON_INLINE npy_intp __pyx_f_5numpy_9broadcast_4size_size(PyArrayMultiIterObject *__pyx_v_self) { + npy_intp __pyx_r; + + /* "C:/Users/runneradmin/AppData/Local/Temp/build-env-ej_q3m8u/Lib/site-packages/numpy/__init__.cython-30.pxd":287 + * cdef inline npy_intp size(self) noexcept nogil: + * """The total broadcasted size.""" + * return PyArray_MultiIter_SIZE(self) # <<<<<<<<<<<<<< + * + * @property +*/ + __pyx_r = PyArray_MultiIter_SIZE(__pyx_v_self); + goto __pyx_L0; + + /* "C:/Users/runneradmin/AppData/Local/Temp/build-env-ej_q3m8u/Lib/site-packages/numpy/__init__.cython-30.pxd":284 + * return PyArray_MultiIter_NUMITER(self) + * + * @property # <<<<<<<<<<<<<< + * cdef inline npy_intp size(self) noexcept nogil: + * """The total broadcasted size.""" +*/ + + /* function exit code */ + __pyx_L0:; + return __pyx_r; +} + +/* "C:/Users/runneradmin/AppData/Local/Temp/build-env-ej_q3m8u/Lib/site-packages/numpy/__init__.cython-30.pxd":289 + * return PyArray_MultiIter_SIZE(self) + * + * @property # <<<<<<<<<<<<<< + * cdef inline npy_intp index(self) noexcept nogil: + * """The current (1-d) index into the broadcasted result.""" +*/ + +static CYTHON_INLINE npy_intp __pyx_f_5numpy_9broadcast_5index_index(PyArrayMultiIterObject *__pyx_v_self) { + npy_intp __pyx_r; + + /* "C:/Users/runneradmin/AppData/Local/Temp/build-env-ej_q3m8u/Lib/site-packages/numpy/__init__.cython-30.pxd":292 + * cdef inline npy_intp index(self) noexcept nogil: + * """The current (1-d) index into the broadcasted result.""" + * return PyArray_MultiIter_INDEX(self) # <<<<<<<<<<<<<< + * + * @property +*/ + __pyx_r = PyArray_MultiIter_INDEX(__pyx_v_self); + goto __pyx_L0; + + /* "C:/Users/runneradmin/AppData/Local/Temp/build-env-ej_q3m8u/Lib/site-packages/numpy/__init__.cython-30.pxd":289 + * return PyArray_MultiIter_SIZE(self) + * + * @property # <<<<<<<<<<<<<< + * cdef inline npy_intp index(self) noexcept nogil: + * """The current (1-d) index into the broadcasted result.""" +*/ + + /* function exit code */ + __pyx_L0:; + return __pyx_r; +} + +/* "C:/Users/runneradmin/AppData/Local/Temp/build-env-ej_q3m8u/Lib/site-packages/numpy/__init__.cython-30.pxd":294 + * return PyArray_MultiIter_INDEX(self) + * + * @property # <<<<<<<<<<<<<< + * cdef inline int nd(self) noexcept nogil: + * """The number of dimensions in the broadcasted result.""" +*/ + +static CYTHON_INLINE int __pyx_f_5numpy_9broadcast_2nd_nd(PyArrayMultiIterObject *__pyx_v_self) { + int __pyx_r; + + /* "C:/Users/runneradmin/AppData/Local/Temp/build-env-ej_q3m8u/Lib/site-packages/numpy/__init__.cython-30.pxd":297 + * cdef inline int nd(self) noexcept nogil: + * """The number of dimensions in the broadcasted result.""" + * return PyArray_MultiIter_NDIM(self) # <<<<<<<<<<<<<< + * + * @property +*/ + __pyx_r = PyArray_MultiIter_NDIM(__pyx_v_self); + goto __pyx_L0; + + /* "C:/Users/runneradmin/AppData/Local/Temp/build-env-ej_q3m8u/Lib/site-packages/numpy/__init__.cython-30.pxd":294 + * return PyArray_MultiIter_INDEX(self) + * + * @property # <<<<<<<<<<<<<< + * cdef inline int nd(self) noexcept nogil: + * """The number of dimensions in the broadcasted result.""" +*/ + + /* function exit code */ + __pyx_L0:; + return __pyx_r; +} + +/* "C:/Users/runneradmin/AppData/Local/Temp/build-env-ej_q3m8u/Lib/site-packages/numpy/__init__.cython-30.pxd":299 + * return PyArray_MultiIter_NDIM(self) + * + * @property # <<<<<<<<<<<<<< + * cdef inline npy_intp* dimensions(self) noexcept nogil: + * """The shape of the broadcasted result.""" +*/ + +static CYTHON_INLINE npy_intp *__pyx_f_5numpy_9broadcast_10dimensions_dimensions(PyArrayMultiIterObject *__pyx_v_self) { + npy_intp *__pyx_r; + + /* "C:/Users/runneradmin/AppData/Local/Temp/build-env-ej_q3m8u/Lib/site-packages/numpy/__init__.cython-30.pxd":302 + * cdef inline npy_intp* dimensions(self) noexcept nogil: + * """The shape of the broadcasted result.""" + * return PyArray_MultiIter_DIMS(self) # <<<<<<<<<<<<<< + * + * @property +*/ + __pyx_r = PyArray_MultiIter_DIMS(__pyx_v_self); + goto __pyx_L0; + + /* "C:/Users/runneradmin/AppData/Local/Temp/build-env-ej_q3m8u/Lib/site-packages/numpy/__init__.cython-30.pxd":299 + * return PyArray_MultiIter_NDIM(self) + * + * @property # <<<<<<<<<<<<<< + * cdef inline npy_intp* dimensions(self) noexcept nogil: + * """The shape of the broadcasted result.""" +*/ + + /* function exit code */ + __pyx_L0:; + return __pyx_r; +} + +/* "C:/Users/runneradmin/AppData/Local/Temp/build-env-ej_q3m8u/Lib/site-packages/numpy/__init__.cython-30.pxd":304 + * return PyArray_MultiIter_DIMS(self) + * + * @property # <<<<<<<<<<<<<< + * cdef inline void** iters(self) noexcept nogil: + * """An array of iterator objects that holds the iterators for the arrays to be broadcast together. +*/ + +static CYTHON_INLINE void **__pyx_f_5numpy_9broadcast_5iters_iters(PyArrayMultiIterObject *__pyx_v_self) { + void **__pyx_r; + + /* "C:/Users/runneradmin/AppData/Local/Temp/build-env-ej_q3m8u/Lib/site-packages/numpy/__init__.cython-30.pxd":308 + * """An array of iterator objects that holds the iterators for the arrays to be broadcast together. + * On return, the iterators are adjusted for broadcasting.""" + * return PyArray_MultiIter_ITERS(self) # <<<<<<<<<<<<<< + * + * +*/ + __pyx_r = PyArray_MultiIter_ITERS(__pyx_v_self); + goto __pyx_L0; + + /* "C:/Users/runneradmin/AppData/Local/Temp/build-env-ej_q3m8u/Lib/site-packages/numpy/__init__.cython-30.pxd":304 + * return PyArray_MultiIter_DIMS(self) + * + * @property # <<<<<<<<<<<<<< + * cdef inline void** iters(self) noexcept nogil: + * """An array of iterator objects that holds the iterators for the arrays to be broadcast together. +*/ + + /* function exit code */ + __pyx_L0:; + return __pyx_r; +} + +/* "C:/Users/runneradmin/AppData/Local/Temp/build-env-ej_q3m8u/Lib/site-packages/numpy/__init__.cython-30.pxd":322 + * # Instead, we use properties that map to the corresponding C-API functions. + * + * @property # <<<<<<<<<<<<<< + * cdef inline PyObject* base(self) noexcept nogil: + * """Returns a borrowed reference to the object owning the data/memory. +*/ + +static CYTHON_INLINE PyObject *__pyx_f_5numpy_7ndarray_4base_base(PyArrayObject *__pyx_v_self) { + PyObject *__pyx_r; + + /* "C:/Users/runneradmin/AppData/Local/Temp/build-env-ej_q3m8u/Lib/site-packages/numpy/__init__.cython-30.pxd":326 + * """Returns a borrowed reference to the object owning the data/memory. + * """ + * return PyArray_BASE(self) # <<<<<<<<<<<<<< + * + * @property +*/ + __pyx_r = PyArray_BASE(__pyx_v_self); + goto __pyx_L0; + + /* "C:/Users/runneradmin/AppData/Local/Temp/build-env-ej_q3m8u/Lib/site-packages/numpy/__init__.cython-30.pxd":322 + * # Instead, we use properties that map to the corresponding C-API functions. + * + * @property # <<<<<<<<<<<<<< + * cdef inline PyObject* base(self) noexcept nogil: + * """Returns a borrowed reference to the object owning the data/memory. +*/ + + /* function exit code */ + __pyx_L0:; + return __pyx_r; +} + +/* "C:/Users/runneradmin/AppData/Local/Temp/build-env-ej_q3m8u/Lib/site-packages/numpy/__init__.cython-30.pxd":328 + * return PyArray_BASE(self) + * + * @property # <<<<<<<<<<<<<< + * cdef inline dtype descr(self): + * """Returns an owned reference to the dtype of the array. +*/ + +static CYTHON_INLINE PyArray_Descr *__pyx_f_5numpy_7ndarray_5descr_descr(PyArrayObject *__pyx_v_self) { + PyArray_Descr *__pyx_r = NULL; + __Pyx_RefNannyDeclarations + PyArray_Descr *__pyx_t_1; + __Pyx_RefNannySetupContext("descr", 0); + + /* "C:/Users/runneradmin/AppData/Local/Temp/build-env-ej_q3m8u/Lib/site-packages/numpy/__init__.cython-30.pxd":332 + * """Returns an owned reference to the dtype of the array. + * """ + * return PyArray_DESCR(self) # <<<<<<<<<<<<<< + * + * @property +*/ + __Pyx_XDECREF((PyObject *)__pyx_r); + __pyx_t_1 = PyArray_DESCR(__pyx_v_self); + __Pyx_INCREF((PyObject *)((PyArray_Descr *)__pyx_t_1)); + __pyx_r = ((PyArray_Descr *)__pyx_t_1); + goto __pyx_L0; + + /* "C:/Users/runneradmin/AppData/Local/Temp/build-env-ej_q3m8u/Lib/site-packages/numpy/__init__.cython-30.pxd":328 + * return PyArray_BASE(self) + * + * @property # <<<<<<<<<<<<<< + * cdef inline dtype descr(self): + * """Returns an owned reference to the dtype of the array. +*/ + + /* function exit code */ + __pyx_L0:; + __Pyx_XGIVEREF((PyObject *)__pyx_r); + __Pyx_RefNannyFinishContext(); + return __pyx_r; +} + +/* "C:/Users/runneradmin/AppData/Local/Temp/build-env-ej_q3m8u/Lib/site-packages/numpy/__init__.cython-30.pxd":334 + * return PyArray_DESCR(self) + * + * @property # <<<<<<<<<<<<<< + * cdef inline int ndim(self) noexcept nogil: + * """Returns the number of dimensions in the array. +*/ + +static CYTHON_INLINE int __pyx_f_5numpy_7ndarray_4ndim_ndim(PyArrayObject *__pyx_v_self) { + int __pyx_r; + + /* "C:/Users/runneradmin/AppData/Local/Temp/build-env-ej_q3m8u/Lib/site-packages/numpy/__init__.cython-30.pxd":338 + * """Returns the number of dimensions in the array. + * """ + * return PyArray_NDIM(self) # <<<<<<<<<<<<<< + * + * @property +*/ + __pyx_r = PyArray_NDIM(__pyx_v_self); + goto __pyx_L0; + + /* "C:/Users/runneradmin/AppData/Local/Temp/build-env-ej_q3m8u/Lib/site-packages/numpy/__init__.cython-30.pxd":334 + * return PyArray_DESCR(self) + * + * @property # <<<<<<<<<<<<<< + * cdef inline int ndim(self) noexcept nogil: + * """Returns the number of dimensions in the array. +*/ + + /* function exit code */ + __pyx_L0:; + return __pyx_r; +} + +/* "C:/Users/runneradmin/AppData/Local/Temp/build-env-ej_q3m8u/Lib/site-packages/numpy/__init__.cython-30.pxd":340 + * return PyArray_NDIM(self) + * + * @property # <<<<<<<<<<<<<< + * cdef inline npy_intp *shape(self) noexcept nogil: + * """Returns a pointer to the dimensions/shape of the array. +*/ + +static CYTHON_INLINE npy_intp *__pyx_f_5numpy_7ndarray_5shape_shape(PyArrayObject *__pyx_v_self) { + npy_intp *__pyx_r; + + /* "C:/Users/runneradmin/AppData/Local/Temp/build-env-ej_q3m8u/Lib/site-packages/numpy/__init__.cython-30.pxd":346 + * Can return NULL for 0-dimensional arrays. + * """ + * return PyArray_DIMS(self) # <<<<<<<<<<<<<< + * + * @property +*/ + __pyx_r = PyArray_DIMS(__pyx_v_self); + goto __pyx_L0; + + /* "C:/Users/runneradmin/AppData/Local/Temp/build-env-ej_q3m8u/Lib/site-packages/numpy/__init__.cython-30.pxd":340 + * return PyArray_NDIM(self) + * + * @property # <<<<<<<<<<<<<< + * cdef inline npy_intp *shape(self) noexcept nogil: + * """Returns a pointer to the dimensions/shape of the array. +*/ + + /* function exit code */ + __pyx_L0:; + return __pyx_r; +} + +/* "C:/Users/runneradmin/AppData/Local/Temp/build-env-ej_q3m8u/Lib/site-packages/numpy/__init__.cython-30.pxd":348 + * return PyArray_DIMS(self) + * + * @property # <<<<<<<<<<<<<< + * cdef inline npy_intp *strides(self) noexcept nogil: + * """Returns a pointer to the strides of the array. +*/ + +static CYTHON_INLINE npy_intp *__pyx_f_5numpy_7ndarray_7strides_strides(PyArrayObject *__pyx_v_self) { + npy_intp *__pyx_r; + + /* "C:/Users/runneradmin/AppData/Local/Temp/build-env-ej_q3m8u/Lib/site-packages/numpy/__init__.cython-30.pxd":353 + * The number of elements matches the number of dimensions of the array (ndim). + * """ + * return PyArray_STRIDES(self) # <<<<<<<<<<<<<< + * + * @property +*/ + __pyx_r = PyArray_STRIDES(__pyx_v_self); + goto __pyx_L0; + + /* "C:/Users/runneradmin/AppData/Local/Temp/build-env-ej_q3m8u/Lib/site-packages/numpy/__init__.cython-30.pxd":348 + * return PyArray_DIMS(self) + * + * @property # <<<<<<<<<<<<<< + * cdef inline npy_intp *strides(self) noexcept nogil: + * """Returns a pointer to the strides of the array. +*/ + + /* function exit code */ + __pyx_L0:; + return __pyx_r; +} + +/* "C:/Users/runneradmin/AppData/Local/Temp/build-env-ej_q3m8u/Lib/site-packages/numpy/__init__.cython-30.pxd":355 + * return PyArray_STRIDES(self) + * + * @property # <<<<<<<<<<<<<< + * cdef inline npy_intp size(self) noexcept nogil: + * """Returns the total size (in number of elements) of the array. +*/ + +static CYTHON_INLINE npy_intp __pyx_f_5numpy_7ndarray_4size_size(PyArrayObject *__pyx_v_self) { + npy_intp __pyx_r; + + /* "C:/Users/runneradmin/AppData/Local/Temp/build-env-ej_q3m8u/Lib/site-packages/numpy/__init__.cython-30.pxd":359 + * """Returns the total size (in number of elements) of the array. + * """ + * return PyArray_SIZE(self) # <<<<<<<<<<<<<< + * + * @property +*/ + __pyx_r = PyArray_SIZE(__pyx_v_self); + goto __pyx_L0; + + /* "C:/Users/runneradmin/AppData/Local/Temp/build-env-ej_q3m8u/Lib/site-packages/numpy/__init__.cython-30.pxd":355 + * return PyArray_STRIDES(self) + * + * @property # <<<<<<<<<<<<<< + * cdef inline npy_intp size(self) noexcept nogil: + * """Returns the total size (in number of elements) of the array. +*/ + + /* function exit code */ + __pyx_L0:; + return __pyx_r; +} + +/* "C:/Users/runneradmin/AppData/Local/Temp/build-env-ej_q3m8u/Lib/site-packages/numpy/__init__.cython-30.pxd":361 + * return PyArray_SIZE(self) + * + * @property # <<<<<<<<<<<<<< + * cdef inline char* data(self) noexcept nogil: + * """The pointer to the data buffer as a char*. +*/ + +static CYTHON_INLINE char *__pyx_f_5numpy_7ndarray_4data_data(PyArrayObject *__pyx_v_self) { + char *__pyx_r; + + /* "C:/Users/runneradmin/AppData/Local/Temp/build-env-ej_q3m8u/Lib/site-packages/numpy/__init__.cython-30.pxd":368 + * of `PyArray_DATA()` instead, which returns a 'void*'. + * """ + * return PyArray_BYTES(self) # <<<<<<<<<<<<<< + * + * +*/ + __pyx_r = PyArray_BYTES(__pyx_v_self); + goto __pyx_L0; + + /* "C:/Users/runneradmin/AppData/Local/Temp/build-env-ej_q3m8u/Lib/site-packages/numpy/__init__.cython-30.pxd":361 + * return PyArray_SIZE(self) + * + * @property # <<<<<<<<<<<<<< + * cdef inline char* data(self) noexcept nogil: + * """The pointer to the data buffer as a char*. +*/ + + /* function exit code */ + __pyx_L0:; + return __pyx_r; +} + +/* "C:/Users/runneradmin/AppData/Local/Temp/build-env-ej_q3m8u/Lib/site-packages/numpy/__init__.cython-30.pxd":776 + * ctypedef long double complex clongdouble_t + * + * cdef inline object PyArray_MultiIterNew1(a): # <<<<<<<<<<<<<< + * return PyArray_MultiIterNew(1, a) + * +*/ + +static CYTHON_INLINE PyObject *__pyx_f_5numpy_PyArray_MultiIterNew1(PyObject *__pyx_v_a) { + PyObject *__pyx_r = NULL; + __Pyx_RefNannyDeclarations + PyObject *__pyx_t_1 = NULL; + int __pyx_lineno = 0; + const char *__pyx_filename = NULL; + int __pyx_clineno = 0; + __Pyx_RefNannySetupContext("PyArray_MultiIterNew1", 0); + + /* "C:/Users/runneradmin/AppData/Local/Temp/build-env-ej_q3m8u/Lib/site-packages/numpy/__init__.cython-30.pxd":777 + * + * cdef inline object PyArray_MultiIterNew1(a): + * return PyArray_MultiIterNew(1, a) # <<<<<<<<<<<<<< + * + * cdef inline object PyArray_MultiIterNew2(a, b): +*/ + __Pyx_XDECREF(__pyx_r); + __pyx_t_1 = PyArray_MultiIterNew(1, ((void *)__pyx_v_a)); if (unlikely(!__pyx_t_1)) __PYX_ERR(2, 777, __pyx_L1_error) + __Pyx_GOTREF(__pyx_t_1); + __pyx_r = __pyx_t_1; + __pyx_t_1 = 0; + goto __pyx_L0; + + /* "C:/Users/runneradmin/AppData/Local/Temp/build-env-ej_q3m8u/Lib/site-packages/numpy/__init__.cython-30.pxd":776 + * ctypedef long double complex clongdouble_t + * + * cdef inline object PyArray_MultiIterNew1(a): # <<<<<<<<<<<<<< + * return PyArray_MultiIterNew(1, a) + * +*/ + + /* function exit code */ + __pyx_L1_error:; + __Pyx_XDECREF(__pyx_t_1); + __Pyx_AddTraceback("numpy.PyArray_MultiIterNew1", __pyx_clineno, __pyx_lineno, __pyx_filename); + __pyx_r = 0; + __pyx_L0:; + __Pyx_XGIVEREF(__pyx_r); + __Pyx_RefNannyFinishContext(); + return __pyx_r; +} + +/* "C:/Users/runneradmin/AppData/Local/Temp/build-env-ej_q3m8u/Lib/site-packages/numpy/__init__.cython-30.pxd":779 + * return PyArray_MultiIterNew(1, a) + * + * cdef inline object PyArray_MultiIterNew2(a, b): # <<<<<<<<<<<<<< + * return PyArray_MultiIterNew(2, a, b) + * +*/ + +static CYTHON_INLINE PyObject *__pyx_f_5numpy_PyArray_MultiIterNew2(PyObject *__pyx_v_a, PyObject *__pyx_v_b) { + PyObject *__pyx_r = NULL; + __Pyx_RefNannyDeclarations + PyObject *__pyx_t_1 = NULL; + int __pyx_lineno = 0; + const char *__pyx_filename = NULL; + int __pyx_clineno = 0; + __Pyx_RefNannySetupContext("PyArray_MultiIterNew2", 0); + + /* "C:/Users/runneradmin/AppData/Local/Temp/build-env-ej_q3m8u/Lib/site-packages/numpy/__init__.cython-30.pxd":780 + * + * cdef inline object PyArray_MultiIterNew2(a, b): + * return PyArray_MultiIterNew(2, a, b) # <<<<<<<<<<<<<< + * + * cdef inline object PyArray_MultiIterNew3(a, b, c): +*/ + __Pyx_XDECREF(__pyx_r); + __pyx_t_1 = PyArray_MultiIterNew(2, ((void *)__pyx_v_a), ((void *)__pyx_v_b)); if (unlikely(!__pyx_t_1)) __PYX_ERR(2, 780, __pyx_L1_error) + __Pyx_GOTREF(__pyx_t_1); + __pyx_r = __pyx_t_1; + __pyx_t_1 = 0; + goto __pyx_L0; + + /* "C:/Users/runneradmin/AppData/Local/Temp/build-env-ej_q3m8u/Lib/site-packages/numpy/__init__.cython-30.pxd":779 + * return PyArray_MultiIterNew(1, a) + * + * cdef inline object PyArray_MultiIterNew2(a, b): # <<<<<<<<<<<<<< + * return PyArray_MultiIterNew(2, a, b) + * +*/ + + /* function exit code */ + __pyx_L1_error:; + __Pyx_XDECREF(__pyx_t_1); + __Pyx_AddTraceback("numpy.PyArray_MultiIterNew2", __pyx_clineno, __pyx_lineno, __pyx_filename); + __pyx_r = 0; + __pyx_L0:; + __Pyx_XGIVEREF(__pyx_r); + __Pyx_RefNannyFinishContext(); + return __pyx_r; +} + +/* "C:/Users/runneradmin/AppData/Local/Temp/build-env-ej_q3m8u/Lib/site-packages/numpy/__init__.cython-30.pxd":782 + * return PyArray_MultiIterNew(2, a, b) + * + * cdef inline object PyArray_MultiIterNew3(a, b, c): # <<<<<<<<<<<<<< + * return PyArray_MultiIterNew(3, a, b, c) + * +*/ + +static CYTHON_INLINE PyObject *__pyx_f_5numpy_PyArray_MultiIterNew3(PyObject *__pyx_v_a, PyObject *__pyx_v_b, PyObject *__pyx_v_c) { + PyObject *__pyx_r = NULL; + __Pyx_RefNannyDeclarations + PyObject *__pyx_t_1 = NULL; + int __pyx_lineno = 0; + const char *__pyx_filename = NULL; + int __pyx_clineno = 0; + __Pyx_RefNannySetupContext("PyArray_MultiIterNew3", 0); + + /* "C:/Users/runneradmin/AppData/Local/Temp/build-env-ej_q3m8u/Lib/site-packages/numpy/__init__.cython-30.pxd":783 + * + * cdef inline object PyArray_MultiIterNew3(a, b, c): + * return PyArray_MultiIterNew(3, a, b, c) # <<<<<<<<<<<<<< + * + * cdef inline object PyArray_MultiIterNew4(a, b, c, d): +*/ + __Pyx_XDECREF(__pyx_r); + __pyx_t_1 = PyArray_MultiIterNew(3, ((void *)__pyx_v_a), ((void *)__pyx_v_b), ((void *)__pyx_v_c)); if (unlikely(!__pyx_t_1)) __PYX_ERR(2, 783, __pyx_L1_error) + __Pyx_GOTREF(__pyx_t_1); + __pyx_r = __pyx_t_1; + __pyx_t_1 = 0; + goto __pyx_L0; + + /* "C:/Users/runneradmin/AppData/Local/Temp/build-env-ej_q3m8u/Lib/site-packages/numpy/__init__.cython-30.pxd":782 + * return PyArray_MultiIterNew(2, a, b) + * + * cdef inline object PyArray_MultiIterNew3(a, b, c): # <<<<<<<<<<<<<< + * return PyArray_MultiIterNew(3, a, b, c) + * +*/ + + /* function exit code */ + __pyx_L1_error:; + __Pyx_XDECREF(__pyx_t_1); + __Pyx_AddTraceback("numpy.PyArray_MultiIterNew3", __pyx_clineno, __pyx_lineno, __pyx_filename); + __pyx_r = 0; + __pyx_L0:; + __Pyx_XGIVEREF(__pyx_r); + __Pyx_RefNannyFinishContext(); + return __pyx_r; +} + +/* "C:/Users/runneradmin/AppData/Local/Temp/build-env-ej_q3m8u/Lib/site-packages/numpy/__init__.cython-30.pxd":785 + * return PyArray_MultiIterNew(3, a, b, c) + * + * cdef inline object PyArray_MultiIterNew4(a, b, c, d): # <<<<<<<<<<<<<< + * return PyArray_MultiIterNew(4, a, b, c, d) + * +*/ + +static CYTHON_INLINE PyObject *__pyx_f_5numpy_PyArray_MultiIterNew4(PyObject *__pyx_v_a, PyObject *__pyx_v_b, PyObject *__pyx_v_c, PyObject *__pyx_v_d) { + PyObject *__pyx_r = NULL; + __Pyx_RefNannyDeclarations + PyObject *__pyx_t_1 = NULL; + int __pyx_lineno = 0; + const char *__pyx_filename = NULL; + int __pyx_clineno = 0; + __Pyx_RefNannySetupContext("PyArray_MultiIterNew4", 0); + + /* "C:/Users/runneradmin/AppData/Local/Temp/build-env-ej_q3m8u/Lib/site-packages/numpy/__init__.cython-30.pxd":786 + * + * cdef inline object PyArray_MultiIterNew4(a, b, c, d): + * return PyArray_MultiIterNew(4, a, b, c, d) # <<<<<<<<<<<<<< + * + * cdef inline object PyArray_MultiIterNew5(a, b, c, d, e): +*/ + __Pyx_XDECREF(__pyx_r); + __pyx_t_1 = PyArray_MultiIterNew(4, ((void *)__pyx_v_a), ((void *)__pyx_v_b), ((void *)__pyx_v_c), ((void *)__pyx_v_d)); if (unlikely(!__pyx_t_1)) __PYX_ERR(2, 786, __pyx_L1_error) + __Pyx_GOTREF(__pyx_t_1); + __pyx_r = __pyx_t_1; + __pyx_t_1 = 0; + goto __pyx_L0; + + /* "C:/Users/runneradmin/AppData/Local/Temp/build-env-ej_q3m8u/Lib/site-packages/numpy/__init__.cython-30.pxd":785 + * return PyArray_MultiIterNew(3, a, b, c) + * + * cdef inline object PyArray_MultiIterNew4(a, b, c, d): # <<<<<<<<<<<<<< + * return PyArray_MultiIterNew(4, a, b, c, d) + * +*/ + + /* function exit code */ + __pyx_L1_error:; + __Pyx_XDECREF(__pyx_t_1); + __Pyx_AddTraceback("numpy.PyArray_MultiIterNew4", __pyx_clineno, __pyx_lineno, __pyx_filename); + __pyx_r = 0; + __pyx_L0:; + __Pyx_XGIVEREF(__pyx_r); + __Pyx_RefNannyFinishContext(); + return __pyx_r; +} + +/* "C:/Users/runneradmin/AppData/Local/Temp/build-env-ej_q3m8u/Lib/site-packages/numpy/__init__.cython-30.pxd":788 + * return PyArray_MultiIterNew(4, a, b, c, d) + * + * cdef inline object PyArray_MultiIterNew5(a, b, c, d, e): # <<<<<<<<<<<<<< + * return PyArray_MultiIterNew(5, a, b, c, d, e) + * +*/ + +static CYTHON_INLINE PyObject *__pyx_f_5numpy_PyArray_MultiIterNew5(PyObject *__pyx_v_a, PyObject *__pyx_v_b, PyObject *__pyx_v_c, PyObject *__pyx_v_d, PyObject *__pyx_v_e) { + PyObject *__pyx_r = NULL; + __Pyx_RefNannyDeclarations + PyObject *__pyx_t_1 = NULL; + int __pyx_lineno = 0; + const char *__pyx_filename = NULL; + int __pyx_clineno = 0; + __Pyx_RefNannySetupContext("PyArray_MultiIterNew5", 0); + + /* "C:/Users/runneradmin/AppData/Local/Temp/build-env-ej_q3m8u/Lib/site-packages/numpy/__init__.cython-30.pxd":789 + * + * cdef inline object PyArray_MultiIterNew5(a, b, c, d, e): + * return PyArray_MultiIterNew(5, a, b, c, d, e) # <<<<<<<<<<<<<< + * + * cdef inline tuple PyDataType_SHAPE(dtype d): +*/ + __Pyx_XDECREF(__pyx_r); + __pyx_t_1 = PyArray_MultiIterNew(5, ((void *)__pyx_v_a), ((void *)__pyx_v_b), ((void *)__pyx_v_c), ((void *)__pyx_v_d), ((void *)__pyx_v_e)); if (unlikely(!__pyx_t_1)) __PYX_ERR(2, 789, __pyx_L1_error) + __Pyx_GOTREF(__pyx_t_1); + __pyx_r = __pyx_t_1; + __pyx_t_1 = 0; + goto __pyx_L0; + + /* "C:/Users/runneradmin/AppData/Local/Temp/build-env-ej_q3m8u/Lib/site-packages/numpy/__init__.cython-30.pxd":788 + * return PyArray_MultiIterNew(4, a, b, c, d) + * + * cdef inline object PyArray_MultiIterNew5(a, b, c, d, e): # <<<<<<<<<<<<<< + * return PyArray_MultiIterNew(5, a, b, c, d, e) + * +*/ + + /* function exit code */ + __pyx_L1_error:; + __Pyx_XDECREF(__pyx_t_1); + __Pyx_AddTraceback("numpy.PyArray_MultiIterNew5", __pyx_clineno, __pyx_lineno, __pyx_filename); + __pyx_r = 0; + __pyx_L0:; + __Pyx_XGIVEREF(__pyx_r); + __Pyx_RefNannyFinishContext(); + return __pyx_r; +} + +/* "C:/Users/runneradmin/AppData/Local/Temp/build-env-ej_q3m8u/Lib/site-packages/numpy/__init__.cython-30.pxd":791 + * return PyArray_MultiIterNew(5, a, b, c, d, e) + * + * cdef inline tuple PyDataType_SHAPE(dtype d): # <<<<<<<<<<<<<< + * if PyDataType_HASSUBARRAY(d): + * return d.subarray.shape +*/ + +static CYTHON_INLINE PyObject *__pyx_f_5numpy_PyDataType_SHAPE(PyArray_Descr *__pyx_v_d) { + PyObject *__pyx_r = NULL; + __Pyx_RefNannyDeclarations + int __pyx_t_1; + PyObject *__pyx_t_2; + __Pyx_RefNannySetupContext("PyDataType_SHAPE", 0); + + /* "C:/Users/runneradmin/AppData/Local/Temp/build-env-ej_q3m8u/Lib/site-packages/numpy/__init__.cython-30.pxd":792 + * + * cdef inline tuple PyDataType_SHAPE(dtype d): + * if PyDataType_HASSUBARRAY(d): # <<<<<<<<<<<<<< + * return d.subarray.shape + * else: +*/ + __pyx_t_1 = PyDataType_HASSUBARRAY(__pyx_v_d); + if (__pyx_t_1) { + + /* "C:/Users/runneradmin/AppData/Local/Temp/build-env-ej_q3m8u/Lib/site-packages/numpy/__init__.cython-30.pxd":793 + * cdef inline tuple PyDataType_SHAPE(dtype d): + * if PyDataType_HASSUBARRAY(d): + * return d.subarray.shape # <<<<<<<<<<<<<< + * else: + * return () +*/ + __Pyx_XDECREF(__pyx_r); + __pyx_t_2 = __pyx_f_5numpy_5dtype_8subarray_subarray(__pyx_v_d)->shape; + __Pyx_INCREF(((PyObject*)__pyx_t_2)); + __pyx_r = ((PyObject*)__pyx_t_2); + goto __pyx_L0; + + /* "C:/Users/runneradmin/AppData/Local/Temp/build-env-ej_q3m8u/Lib/site-packages/numpy/__init__.cython-30.pxd":792 + * + * cdef inline tuple PyDataType_SHAPE(dtype d): + * if PyDataType_HASSUBARRAY(d): # <<<<<<<<<<<<<< + * return d.subarray.shape + * else: +*/ + } + + /* "C:/Users/runneradmin/AppData/Local/Temp/build-env-ej_q3m8u/Lib/site-packages/numpy/__init__.cython-30.pxd":795 + * return d.subarray.shape + * else: + * return () # <<<<<<<<<<<<<< + * + * +*/ + /*else*/ { + __Pyx_XDECREF(__pyx_r); + __Pyx_INCREF(__pyx_mstate_global->__pyx_empty_tuple); + __pyx_r = __pyx_mstate_global->__pyx_empty_tuple; + goto __pyx_L0; + } + + /* "C:/Users/runneradmin/AppData/Local/Temp/build-env-ej_q3m8u/Lib/site-packages/numpy/__init__.cython-30.pxd":791 + * return PyArray_MultiIterNew(5, a, b, c, d, e) + * + * cdef inline tuple PyDataType_SHAPE(dtype d): # <<<<<<<<<<<<<< + * if PyDataType_HASSUBARRAY(d): + * return d.subarray.shape +*/ + + /* function exit code */ + __pyx_L0:; + __Pyx_XGIVEREF(__pyx_r); + __Pyx_RefNannyFinishContext(); + return __pyx_r; +} + +/* "C:/Users/runneradmin/AppData/Local/Temp/build-env-ej_q3m8u/Lib/site-packages/numpy/__init__.cython-30.pxd":994 + * int _import_umath() except -1 + * + * cdef inline void set_array_base(ndarray arr, object base) except *: # <<<<<<<<<<<<<< + * Py_INCREF(base) # important to do this before stealing the reference below! + * PyArray_SetBaseObject(arr, base) +*/ + +static CYTHON_INLINE void __pyx_f_5numpy_set_array_base(PyArrayObject *__pyx_v_arr, PyObject *__pyx_v_base) { + int __pyx_t_1; + int __pyx_lineno = 0; + const char *__pyx_filename = NULL; + int __pyx_clineno = 0; + + /* "C:/Users/runneradmin/AppData/Local/Temp/build-env-ej_q3m8u/Lib/site-packages/numpy/__init__.cython-30.pxd":995 + * + * cdef inline void set_array_base(ndarray arr, object base) except *: + * Py_INCREF(base) # important to do this before stealing the reference below! # <<<<<<<<<<<<<< + * PyArray_SetBaseObject(arr, base) + * +*/ + Py_INCREF(__pyx_v_base); + + /* "C:/Users/runneradmin/AppData/Local/Temp/build-env-ej_q3m8u/Lib/site-packages/numpy/__init__.cython-30.pxd":996 + * cdef inline void set_array_base(ndarray arr, object base) except *: + * Py_INCREF(base) # important to do this before stealing the reference below! + * PyArray_SetBaseObject(arr, base) # <<<<<<<<<<<<<< + * + * cdef inline object get_array_base(ndarray arr): +*/ + __pyx_t_1 = PyArray_SetBaseObject(__pyx_v_arr, __pyx_v_base); if (unlikely(__pyx_t_1 == ((int)-1))) __PYX_ERR(2, 996, __pyx_L1_error) + + /* "C:/Users/runneradmin/AppData/Local/Temp/build-env-ej_q3m8u/Lib/site-packages/numpy/__init__.cython-30.pxd":994 + * int _import_umath() except -1 + * + * cdef inline void set_array_base(ndarray arr, object base) except *: # <<<<<<<<<<<<<< + * Py_INCREF(base) # important to do this before stealing the reference below! + * PyArray_SetBaseObject(arr, base) +*/ + + /* function exit code */ + goto __pyx_L0; + __pyx_L1_error:; + __Pyx_AddTraceback("numpy.set_array_base", __pyx_clineno, __pyx_lineno, __pyx_filename); + __pyx_L0:; +} + +/* "C:/Users/runneradmin/AppData/Local/Temp/build-env-ej_q3m8u/Lib/site-packages/numpy/__init__.cython-30.pxd":998 + * PyArray_SetBaseObject(arr, base) + * + * cdef inline object get_array_base(ndarray arr): # <<<<<<<<<<<<<< + * base = PyArray_BASE(arr) + * if base is NULL: +*/ + +static CYTHON_INLINE PyObject *__pyx_f_5numpy_get_array_base(PyArrayObject *__pyx_v_arr) { + PyObject *__pyx_v_base; + PyObject *__pyx_r = NULL; + __Pyx_RefNannyDeclarations + int __pyx_t_1; + __Pyx_RefNannySetupContext("get_array_base", 0); + + /* "C:/Users/runneradmin/AppData/Local/Temp/build-env-ej_q3m8u/Lib/site-packages/numpy/__init__.cython-30.pxd":999 + * + * cdef inline object get_array_base(ndarray arr): + * base = PyArray_BASE(arr) # <<<<<<<<<<<<<< + * if base is NULL: + * return None +*/ + __pyx_v_base = PyArray_BASE(__pyx_v_arr); + + /* "C:/Users/runneradmin/AppData/Local/Temp/build-env-ej_q3m8u/Lib/site-packages/numpy/__init__.cython-30.pxd":1000 + * cdef inline object get_array_base(ndarray arr): + * base = PyArray_BASE(arr) + * if base is NULL: # <<<<<<<<<<<<<< + * return None + * return base +*/ + __pyx_t_1 = (__pyx_v_base == NULL); + if (__pyx_t_1) { + + /* "C:/Users/runneradmin/AppData/Local/Temp/build-env-ej_q3m8u/Lib/site-packages/numpy/__init__.cython-30.pxd":1001 + * base = PyArray_BASE(arr) + * if base is NULL: + * return None # <<<<<<<<<<<<<< + * return base + * +*/ + __Pyx_XDECREF(__pyx_r); + __pyx_r = Py_None; __Pyx_INCREF(Py_None); + goto __pyx_L0; + + /* "C:/Users/runneradmin/AppData/Local/Temp/build-env-ej_q3m8u/Lib/site-packages/numpy/__init__.cython-30.pxd":1000 + * cdef inline object get_array_base(ndarray arr): + * base = PyArray_BASE(arr) + * if base is NULL: # <<<<<<<<<<<<<< + * return None + * return base +*/ + } + + /* "C:/Users/runneradmin/AppData/Local/Temp/build-env-ej_q3m8u/Lib/site-packages/numpy/__init__.cython-30.pxd":1002 + * if base is NULL: + * return None + * return base # <<<<<<<<<<<<<< + * + * # Versions of the import_* functions which are more suitable for +*/ + __Pyx_XDECREF(__pyx_r); + __Pyx_INCREF(((PyObject *)__pyx_v_base)); + __pyx_r = ((PyObject *)__pyx_v_base); + goto __pyx_L0; + + /* "C:/Users/runneradmin/AppData/Local/Temp/build-env-ej_q3m8u/Lib/site-packages/numpy/__init__.cython-30.pxd":998 + * PyArray_SetBaseObject(arr, base) + * + * cdef inline object get_array_base(ndarray arr): # <<<<<<<<<<<<<< + * base = PyArray_BASE(arr) + * if base is NULL: +*/ + + /* function exit code */ + __pyx_L0:; + __Pyx_XGIVEREF(__pyx_r); + __Pyx_RefNannyFinishContext(); + return __pyx_r; +} + +/* "C:/Users/runneradmin/AppData/Local/Temp/build-env-ej_q3m8u/Lib/site-packages/numpy/__init__.cython-30.pxd":1006 + * # Versions of the import_* functions which are more suitable for + * # Cython code. + * cdef inline int import_array() except -1: # <<<<<<<<<<<<<< + * try: + * __pyx_import_array() +*/ + +static CYTHON_INLINE int __pyx_f_5numpy_import_array(void) { + int __pyx_r; + __Pyx_RefNannyDeclarations + PyObject *__pyx_t_1 = NULL; + PyObject *__pyx_t_2 = NULL; + PyObject *__pyx_t_3 = NULL; + int __pyx_t_4; + PyObject *__pyx_t_5 = NULL; + PyObject *__pyx_t_6 = NULL; + PyObject *__pyx_t_7 = NULL; + PyObject *__pyx_t_8 = NULL; + PyObject *__pyx_t_9 = NULL; + size_t __pyx_t_10; + int __pyx_lineno = 0; + const char *__pyx_filename = NULL; + int __pyx_clineno = 0; + __Pyx_RefNannySetupContext("import_array", 0); + + /* "C:/Users/runneradmin/AppData/Local/Temp/build-env-ej_q3m8u/Lib/site-packages/numpy/__init__.cython-30.pxd":1007 + * # Cython code. + * cdef inline int import_array() except -1: + * try: # <<<<<<<<<<<<<< + * __pyx_import_array() + * except Exception: +*/ + { + __Pyx_PyThreadState_declare + __Pyx_PyThreadState_assign + __Pyx_ExceptionSave(&__pyx_t_1, &__pyx_t_2, &__pyx_t_3); + __Pyx_XGOTREF(__pyx_t_1); + __Pyx_XGOTREF(__pyx_t_2); + __Pyx_XGOTREF(__pyx_t_3); + /*try:*/ { + + /* "C:/Users/runneradmin/AppData/Local/Temp/build-env-ej_q3m8u/Lib/site-packages/numpy/__init__.cython-30.pxd":1008 + * cdef inline int import_array() except -1: + * try: + * __pyx_import_array() # <<<<<<<<<<<<<< + * except Exception: + * raise ImportError("numpy._core.multiarray failed to import") +*/ + __pyx_t_4 = _import_array(); if (unlikely(__pyx_t_4 == ((int)-1))) __PYX_ERR(2, 1008, __pyx_L3_error) + + /* "C:/Users/runneradmin/AppData/Local/Temp/build-env-ej_q3m8u/Lib/site-packages/numpy/__init__.cython-30.pxd":1007 + * # Cython code. + * cdef inline int import_array() except -1: + * try: # <<<<<<<<<<<<<< + * __pyx_import_array() + * except Exception: +*/ + } + __Pyx_XDECREF(__pyx_t_1); __pyx_t_1 = 0; + __Pyx_XDECREF(__pyx_t_2); __pyx_t_2 = 0; + __Pyx_XDECREF(__pyx_t_3); __pyx_t_3 = 0; + goto __pyx_L8_try_end; + __pyx_L3_error:; + + /* "C:/Users/runneradmin/AppData/Local/Temp/build-env-ej_q3m8u/Lib/site-packages/numpy/__init__.cython-30.pxd":1009 + * try: + * __pyx_import_array() + * except Exception: # <<<<<<<<<<<<<< + * raise ImportError("numpy._core.multiarray failed to import") + * +*/ + __pyx_t_4 = __Pyx_PyErr_ExceptionMatches(((PyObject *)(((PyTypeObject*)PyExc_Exception)))); + if (__pyx_t_4) { + __Pyx_AddTraceback("numpy.import_array", __pyx_clineno, __pyx_lineno, __pyx_filename); + if (__Pyx_GetException(&__pyx_t_5, &__pyx_t_6, &__pyx_t_7) < 0) __PYX_ERR(2, 1009, __pyx_L5_except_error) + __Pyx_XGOTREF(__pyx_t_5); + __Pyx_XGOTREF(__pyx_t_6); + __Pyx_XGOTREF(__pyx_t_7); + + /* "C:/Users/runneradmin/AppData/Local/Temp/build-env-ej_q3m8u/Lib/site-packages/numpy/__init__.cython-30.pxd":1010 + * __pyx_import_array() + * except Exception: + * raise ImportError("numpy._core.multiarray failed to import") # <<<<<<<<<<<<<< + * + * cdef inline int import_umath() except -1: +*/ + __pyx_t_9 = NULL; + __pyx_t_10 = 1; + { + PyObject *__pyx_callargs[2] = {__pyx_t_9, __pyx_mstate_global->__pyx_kp_u_numpy__core_multiarray_failed_to}; + __pyx_t_8 = __Pyx_PyObject_FastCall((PyObject*)(((PyTypeObject*)PyExc_ImportError)), __pyx_callargs+__pyx_t_10, (2-__pyx_t_10) | (__pyx_t_10*__Pyx_PY_VECTORCALL_ARGUMENTS_OFFSET)); + __Pyx_XDECREF(__pyx_t_9); __pyx_t_9 = 0; + if (unlikely(!__pyx_t_8)) __PYX_ERR(2, 1010, __pyx_L5_except_error) + __Pyx_GOTREF(__pyx_t_8); + } + __Pyx_Raise(__pyx_t_8, 0, 0, 0); + __Pyx_DECREF(__pyx_t_8); __pyx_t_8 = 0; + __PYX_ERR(2, 1010, __pyx_L5_except_error) + } + goto __pyx_L5_except_error; + + /* "C:/Users/runneradmin/AppData/Local/Temp/build-env-ej_q3m8u/Lib/site-packages/numpy/__init__.cython-30.pxd":1007 + * # Cython code. + * cdef inline int import_array() except -1: + * try: # <<<<<<<<<<<<<< + * __pyx_import_array() + * except Exception: +*/ + __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:; + } + + /* "C:/Users/runneradmin/AppData/Local/Temp/build-env-ej_q3m8u/Lib/site-packages/numpy/__init__.cython-30.pxd":1006 + * # Versions of the import_* functions which are more suitable for + * # Cython code. + * cdef inline int import_array() except -1: # <<<<<<<<<<<<<< + * try: + * __pyx_import_array() +*/ + + /* function exit code */ + __pyx_r = 0; + goto __pyx_L0; + __pyx_L1_error:; + __Pyx_XDECREF(__pyx_t_5); + __Pyx_XDECREF(__pyx_t_6); + __Pyx_XDECREF(__pyx_t_7); + __Pyx_XDECREF(__pyx_t_8); + __Pyx_XDECREF(__pyx_t_9); + __Pyx_AddTraceback("numpy.import_array", __pyx_clineno, __pyx_lineno, __pyx_filename); + __pyx_r = -1; + __pyx_L0:; + __Pyx_RefNannyFinishContext(); + return __pyx_r; +} + +/* "C:/Users/runneradmin/AppData/Local/Temp/build-env-ej_q3m8u/Lib/site-packages/numpy/__init__.cython-30.pxd":1012 + * raise ImportError("numpy._core.multiarray failed to import") + * + * cdef inline int import_umath() except -1: # <<<<<<<<<<<<<< + * try: + * _import_umath() +*/ + +static CYTHON_INLINE int __pyx_f_5numpy_import_umath(void) { + int __pyx_r; + __Pyx_RefNannyDeclarations + PyObject *__pyx_t_1 = NULL; + PyObject *__pyx_t_2 = NULL; + PyObject *__pyx_t_3 = NULL; + int __pyx_t_4; + PyObject *__pyx_t_5 = NULL; + PyObject *__pyx_t_6 = NULL; + PyObject *__pyx_t_7 = NULL; + PyObject *__pyx_t_8 = NULL; + PyObject *__pyx_t_9 = NULL; + size_t __pyx_t_10; + int __pyx_lineno = 0; + const char *__pyx_filename = NULL; + int __pyx_clineno = 0; + __Pyx_RefNannySetupContext("import_umath", 0); + + /* "C:/Users/runneradmin/AppData/Local/Temp/build-env-ej_q3m8u/Lib/site-packages/numpy/__init__.cython-30.pxd":1013 + * + * cdef inline int import_umath() except -1: + * try: # <<<<<<<<<<<<<< + * _import_umath() + * except Exception: +*/ + { + __Pyx_PyThreadState_declare + __Pyx_PyThreadState_assign + __Pyx_ExceptionSave(&__pyx_t_1, &__pyx_t_2, &__pyx_t_3); + __Pyx_XGOTREF(__pyx_t_1); + __Pyx_XGOTREF(__pyx_t_2); + __Pyx_XGOTREF(__pyx_t_3); + /*try:*/ { + + /* "C:/Users/runneradmin/AppData/Local/Temp/build-env-ej_q3m8u/Lib/site-packages/numpy/__init__.cython-30.pxd":1014 + * cdef inline int import_umath() except -1: + * try: + * _import_umath() # <<<<<<<<<<<<<< + * except Exception: + * raise ImportError("numpy._core.umath failed to import") +*/ + __pyx_t_4 = _import_umath(); if (unlikely(__pyx_t_4 == ((int)-1))) __PYX_ERR(2, 1014, __pyx_L3_error) + + /* "C:/Users/runneradmin/AppData/Local/Temp/build-env-ej_q3m8u/Lib/site-packages/numpy/__init__.cython-30.pxd":1013 + * + * cdef inline int import_umath() except -1: + * try: # <<<<<<<<<<<<<< + * _import_umath() + * except Exception: +*/ + } + __Pyx_XDECREF(__pyx_t_1); __pyx_t_1 = 0; + __Pyx_XDECREF(__pyx_t_2); __pyx_t_2 = 0; + __Pyx_XDECREF(__pyx_t_3); __pyx_t_3 = 0; + goto __pyx_L8_try_end; + __pyx_L3_error:; + + /* "C:/Users/runneradmin/AppData/Local/Temp/build-env-ej_q3m8u/Lib/site-packages/numpy/__init__.cython-30.pxd":1015 + * try: + * _import_umath() + * except Exception: # <<<<<<<<<<<<<< + * raise ImportError("numpy._core.umath failed to import") + * +*/ + __pyx_t_4 = __Pyx_PyErr_ExceptionMatches(((PyObject *)(((PyTypeObject*)PyExc_Exception)))); + if (__pyx_t_4) { + __Pyx_AddTraceback("numpy.import_umath", __pyx_clineno, __pyx_lineno, __pyx_filename); + if (__Pyx_GetException(&__pyx_t_5, &__pyx_t_6, &__pyx_t_7) < 0) __PYX_ERR(2, 1015, __pyx_L5_except_error) + __Pyx_XGOTREF(__pyx_t_5); + __Pyx_XGOTREF(__pyx_t_6); + __Pyx_XGOTREF(__pyx_t_7); + + /* "C:/Users/runneradmin/AppData/Local/Temp/build-env-ej_q3m8u/Lib/site-packages/numpy/__init__.cython-30.pxd":1016 + * _import_umath() + * except Exception: + * raise ImportError("numpy._core.umath failed to import") # <<<<<<<<<<<<<< + * + * cdef inline int import_ufunc() except -1: +*/ + __pyx_t_9 = NULL; + __pyx_t_10 = 1; + { + PyObject *__pyx_callargs[2] = {__pyx_t_9, __pyx_mstate_global->__pyx_kp_u_numpy__core_umath_failed_to_impo}; + __pyx_t_8 = __Pyx_PyObject_FastCall((PyObject*)(((PyTypeObject*)PyExc_ImportError)), __pyx_callargs+__pyx_t_10, (2-__pyx_t_10) | (__pyx_t_10*__Pyx_PY_VECTORCALL_ARGUMENTS_OFFSET)); + __Pyx_XDECREF(__pyx_t_9); __pyx_t_9 = 0; + if (unlikely(!__pyx_t_8)) __PYX_ERR(2, 1016, __pyx_L5_except_error) + __Pyx_GOTREF(__pyx_t_8); + } + __Pyx_Raise(__pyx_t_8, 0, 0, 0); + __Pyx_DECREF(__pyx_t_8); __pyx_t_8 = 0; + __PYX_ERR(2, 1016, __pyx_L5_except_error) + } + goto __pyx_L5_except_error; + + /* "C:/Users/runneradmin/AppData/Local/Temp/build-env-ej_q3m8u/Lib/site-packages/numpy/__init__.cython-30.pxd":1013 + * + * cdef inline int import_umath() except -1: + * try: # <<<<<<<<<<<<<< + * _import_umath() + * except Exception: +*/ + __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:; + } + + /* "C:/Users/runneradmin/AppData/Local/Temp/build-env-ej_q3m8u/Lib/site-packages/numpy/__init__.cython-30.pxd":1012 + * raise ImportError("numpy._core.multiarray failed to import") + * + * cdef inline int import_umath() except -1: # <<<<<<<<<<<<<< + * try: + * _import_umath() +*/ + + /* function exit code */ + __pyx_r = 0; + goto __pyx_L0; + __pyx_L1_error:; + __Pyx_XDECREF(__pyx_t_5); + __Pyx_XDECREF(__pyx_t_6); + __Pyx_XDECREF(__pyx_t_7); + __Pyx_XDECREF(__pyx_t_8); + __Pyx_XDECREF(__pyx_t_9); + __Pyx_AddTraceback("numpy.import_umath", __pyx_clineno, __pyx_lineno, __pyx_filename); + __pyx_r = -1; + __pyx_L0:; + __Pyx_RefNannyFinishContext(); + return __pyx_r; +} + +/* "C:/Users/runneradmin/AppData/Local/Temp/build-env-ej_q3m8u/Lib/site-packages/numpy/__init__.cython-30.pxd":1018 + * raise ImportError("numpy._core.umath failed to import") + * + * cdef inline int import_ufunc() except -1: # <<<<<<<<<<<<<< + * try: + * _import_umath() +*/ + +static CYTHON_INLINE int __pyx_f_5numpy_import_ufunc(void) { + int __pyx_r; + __Pyx_RefNannyDeclarations + PyObject *__pyx_t_1 = NULL; + PyObject *__pyx_t_2 = NULL; + PyObject *__pyx_t_3 = NULL; + int __pyx_t_4; + PyObject *__pyx_t_5 = NULL; + PyObject *__pyx_t_6 = NULL; + PyObject *__pyx_t_7 = NULL; + PyObject *__pyx_t_8 = NULL; + PyObject *__pyx_t_9 = NULL; + size_t __pyx_t_10; + int __pyx_lineno = 0; + const char *__pyx_filename = NULL; + int __pyx_clineno = 0; + __Pyx_RefNannySetupContext("import_ufunc", 0); + + /* "C:/Users/runneradmin/AppData/Local/Temp/build-env-ej_q3m8u/Lib/site-packages/numpy/__init__.cython-30.pxd":1019 + * + * cdef inline int import_ufunc() except -1: + * try: # <<<<<<<<<<<<<< + * _import_umath() + * except Exception: +*/ + { + __Pyx_PyThreadState_declare + __Pyx_PyThreadState_assign + __Pyx_ExceptionSave(&__pyx_t_1, &__pyx_t_2, &__pyx_t_3); + __Pyx_XGOTREF(__pyx_t_1); + __Pyx_XGOTREF(__pyx_t_2); + __Pyx_XGOTREF(__pyx_t_3); + /*try:*/ { + + /* "C:/Users/runneradmin/AppData/Local/Temp/build-env-ej_q3m8u/Lib/site-packages/numpy/__init__.cython-30.pxd":1020 + * cdef inline int import_ufunc() except -1: + * try: + * _import_umath() # <<<<<<<<<<<<<< + * except Exception: + * raise ImportError("numpy._core.umath failed to import") +*/ + __pyx_t_4 = _import_umath(); if (unlikely(__pyx_t_4 == ((int)-1))) __PYX_ERR(2, 1020, __pyx_L3_error) + + /* "C:/Users/runneradmin/AppData/Local/Temp/build-env-ej_q3m8u/Lib/site-packages/numpy/__init__.cython-30.pxd":1019 + * + * cdef inline int import_ufunc() except -1: + * try: # <<<<<<<<<<<<<< + * _import_umath() + * except Exception: +*/ + } + __Pyx_XDECREF(__pyx_t_1); __pyx_t_1 = 0; + __Pyx_XDECREF(__pyx_t_2); __pyx_t_2 = 0; + __Pyx_XDECREF(__pyx_t_3); __pyx_t_3 = 0; + goto __pyx_L8_try_end; + __pyx_L3_error:; + + /* "C:/Users/runneradmin/AppData/Local/Temp/build-env-ej_q3m8u/Lib/site-packages/numpy/__init__.cython-30.pxd":1021 + * try: + * _import_umath() + * except Exception: # <<<<<<<<<<<<<< + * raise ImportError("numpy._core.umath failed to import") + * +*/ + __pyx_t_4 = __Pyx_PyErr_ExceptionMatches(((PyObject *)(((PyTypeObject*)PyExc_Exception)))); + if (__pyx_t_4) { + __Pyx_AddTraceback("numpy.import_ufunc", __pyx_clineno, __pyx_lineno, __pyx_filename); + if (__Pyx_GetException(&__pyx_t_5, &__pyx_t_6, &__pyx_t_7) < 0) __PYX_ERR(2, 1021, __pyx_L5_except_error) + __Pyx_XGOTREF(__pyx_t_5); + __Pyx_XGOTREF(__pyx_t_6); + __Pyx_XGOTREF(__pyx_t_7); + + /* "C:/Users/runneradmin/AppData/Local/Temp/build-env-ej_q3m8u/Lib/site-packages/numpy/__init__.cython-30.pxd":1022 + * _import_umath() + * except Exception: + * raise ImportError("numpy._core.umath failed to import") # <<<<<<<<<<<<<< + * + * +*/ + __pyx_t_9 = NULL; + __pyx_t_10 = 1; + { + PyObject *__pyx_callargs[2] = {__pyx_t_9, __pyx_mstate_global->__pyx_kp_u_numpy__core_umath_failed_to_impo}; + __pyx_t_8 = __Pyx_PyObject_FastCall((PyObject*)(((PyTypeObject*)PyExc_ImportError)), __pyx_callargs+__pyx_t_10, (2-__pyx_t_10) | (__pyx_t_10*__Pyx_PY_VECTORCALL_ARGUMENTS_OFFSET)); + __Pyx_XDECREF(__pyx_t_9); __pyx_t_9 = 0; + if (unlikely(!__pyx_t_8)) __PYX_ERR(2, 1022, __pyx_L5_except_error) + __Pyx_GOTREF(__pyx_t_8); + } + __Pyx_Raise(__pyx_t_8, 0, 0, 0); + __Pyx_DECREF(__pyx_t_8); __pyx_t_8 = 0; + __PYX_ERR(2, 1022, __pyx_L5_except_error) + } + goto __pyx_L5_except_error; + + /* "C:/Users/runneradmin/AppData/Local/Temp/build-env-ej_q3m8u/Lib/site-packages/numpy/__init__.cython-30.pxd":1019 + * + * cdef inline int import_ufunc() except -1: + * try: # <<<<<<<<<<<<<< + * _import_umath() + * except Exception: +*/ + __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:; + } + + /* "C:/Users/runneradmin/AppData/Local/Temp/build-env-ej_q3m8u/Lib/site-packages/numpy/__init__.cython-30.pxd":1018 + * raise ImportError("numpy._core.umath failed to import") + * + * cdef inline int import_ufunc() except -1: # <<<<<<<<<<<<<< + * try: + * _import_umath() +*/ + + /* function exit code */ + __pyx_r = 0; + goto __pyx_L0; + __pyx_L1_error:; + __Pyx_XDECREF(__pyx_t_5); + __Pyx_XDECREF(__pyx_t_6); + __Pyx_XDECREF(__pyx_t_7); + __Pyx_XDECREF(__pyx_t_8); + __Pyx_XDECREF(__pyx_t_9); + __Pyx_AddTraceback("numpy.import_ufunc", __pyx_clineno, __pyx_lineno, __pyx_filename); + __pyx_r = -1; + __pyx_L0:; + __Pyx_RefNannyFinishContext(); + return __pyx_r; +} + +/* "C:/Users/runneradmin/AppData/Local/Temp/build-env-ej_q3m8u/Lib/site-packages/numpy/__init__.cython-30.pxd":1025 + * + * + * cdef inline bint is_timedelta64_object(object obj) noexcept: # <<<<<<<<<<<<<< + * """ + * Cython equivalent of `isinstance(obj, np.timedelta64)` +*/ + +static CYTHON_INLINE int __pyx_f_5numpy_is_timedelta64_object(PyObject *__pyx_v_obj) { + int __pyx_r; + + /* "C:/Users/runneradmin/AppData/Local/Temp/build-env-ej_q3m8u/Lib/site-packages/numpy/__init__.cython-30.pxd":1037 + * bool + * """ + * return PyObject_TypeCheck(obj, &PyTimedeltaArrType_Type) # <<<<<<<<<<<<<< + * + * +*/ + __pyx_r = PyObject_TypeCheck(__pyx_v_obj, (&PyTimedeltaArrType_Type)); + goto __pyx_L0; + + /* "C:/Users/runneradmin/AppData/Local/Temp/build-env-ej_q3m8u/Lib/site-packages/numpy/__init__.cython-30.pxd":1025 + * + * + * cdef inline bint is_timedelta64_object(object obj) noexcept: # <<<<<<<<<<<<<< + * """ + * Cython equivalent of `isinstance(obj, np.timedelta64)` +*/ + + /* function exit code */ + __pyx_L0:; + return __pyx_r; +} + +/* "C:/Users/runneradmin/AppData/Local/Temp/build-env-ej_q3m8u/Lib/site-packages/numpy/__init__.cython-30.pxd":1040 + * + * + * cdef inline bint is_datetime64_object(object obj) noexcept: # <<<<<<<<<<<<<< + * """ + * Cython equivalent of `isinstance(obj, np.datetime64)` +*/ + +static CYTHON_INLINE int __pyx_f_5numpy_is_datetime64_object(PyObject *__pyx_v_obj) { + int __pyx_r; + + /* "C:/Users/runneradmin/AppData/Local/Temp/build-env-ej_q3m8u/Lib/site-packages/numpy/__init__.cython-30.pxd":1052 + * bool + * """ + * return PyObject_TypeCheck(obj, &PyDatetimeArrType_Type) # <<<<<<<<<<<<<< + * + * +*/ + __pyx_r = PyObject_TypeCheck(__pyx_v_obj, (&PyDatetimeArrType_Type)); + goto __pyx_L0; + + /* "C:/Users/runneradmin/AppData/Local/Temp/build-env-ej_q3m8u/Lib/site-packages/numpy/__init__.cython-30.pxd":1040 + * + * + * cdef inline bint is_datetime64_object(object obj) noexcept: # <<<<<<<<<<<<<< + * """ + * Cython equivalent of `isinstance(obj, np.datetime64)` +*/ + + /* function exit code */ + __pyx_L0:; + return __pyx_r; +} + +/* "C:/Users/runneradmin/AppData/Local/Temp/build-env-ej_q3m8u/Lib/site-packages/numpy/__init__.cython-30.pxd":1055 + * + * + * cdef inline npy_datetime get_datetime64_value(object obj) noexcept nogil: # <<<<<<<<<<<<<< + * """ + * returns the int64 value underlying scalar numpy datetime64 object +*/ + +static CYTHON_INLINE npy_datetime __pyx_f_5numpy_get_datetime64_value(PyObject *__pyx_v_obj) { + npy_datetime __pyx_r; + + /* "C:/Users/runneradmin/AppData/Local/Temp/build-env-ej_q3m8u/Lib/site-packages/numpy/__init__.cython-30.pxd":1062 + * also needed. That can be found using `get_datetime64_unit`. + * """ + * return (obj).obval # <<<<<<<<<<<<<< + * + * +*/ + __pyx_r = ((PyDatetimeScalarObject *)__pyx_v_obj)->obval; + goto __pyx_L0; + + /* "C:/Users/runneradmin/AppData/Local/Temp/build-env-ej_q3m8u/Lib/site-packages/numpy/__init__.cython-30.pxd":1055 + * + * + * cdef inline npy_datetime get_datetime64_value(object obj) noexcept nogil: # <<<<<<<<<<<<<< + * """ + * returns the int64 value underlying scalar numpy datetime64 object +*/ + + /* function exit code */ + __pyx_L0:; + return __pyx_r; +} + +/* "C:/Users/runneradmin/AppData/Local/Temp/build-env-ej_q3m8u/Lib/site-packages/numpy/__init__.cython-30.pxd":1065 + * + * + * cdef inline npy_timedelta get_timedelta64_value(object obj) noexcept nogil: # <<<<<<<<<<<<<< + * """ + * returns the int64 value underlying scalar numpy timedelta64 object +*/ + +static CYTHON_INLINE npy_timedelta __pyx_f_5numpy_get_timedelta64_value(PyObject *__pyx_v_obj) { + npy_timedelta __pyx_r; + + /* "C:/Users/runneradmin/AppData/Local/Temp/build-env-ej_q3m8u/Lib/site-packages/numpy/__init__.cython-30.pxd":1069 + * returns the int64 value underlying scalar numpy timedelta64 object + * """ + * return (obj).obval # <<<<<<<<<<<<<< + * + * +*/ + __pyx_r = ((PyTimedeltaScalarObject *)__pyx_v_obj)->obval; + goto __pyx_L0; + + /* "C:/Users/runneradmin/AppData/Local/Temp/build-env-ej_q3m8u/Lib/site-packages/numpy/__init__.cython-30.pxd":1065 + * + * + * cdef inline npy_timedelta get_timedelta64_value(object obj) noexcept nogil: # <<<<<<<<<<<<<< + * """ + * returns the int64 value underlying scalar numpy timedelta64 object +*/ + + /* function exit code */ + __pyx_L0:; + return __pyx_r; +} + +/* "C:/Users/runneradmin/AppData/Local/Temp/build-env-ej_q3m8u/Lib/site-packages/numpy/__init__.cython-30.pxd":1072 + * + * + * cdef inline NPY_DATETIMEUNIT get_datetime64_unit(object obj) noexcept nogil: # <<<<<<<<<<<<<< + * """ + * returns the unit part of the dtype for a numpy datetime64 object. +*/ + +static CYTHON_INLINE NPY_DATETIMEUNIT __pyx_f_5numpy_get_datetime64_unit(PyObject *__pyx_v_obj) { + NPY_DATETIMEUNIT __pyx_r; + + /* "C:/Users/runneradmin/AppData/Local/Temp/build-env-ej_q3m8u/Lib/site-packages/numpy/__init__.cython-30.pxd":1076 + * returns the unit part of the dtype for a numpy datetime64 object. + * """ + * return (obj).obmeta.base # <<<<<<<<<<<<<< + * + * +*/ + __pyx_r = ((NPY_DATETIMEUNIT)((PyDatetimeScalarObject *)__pyx_v_obj)->obmeta.base); + goto __pyx_L0; + + /* "C:/Users/runneradmin/AppData/Local/Temp/build-env-ej_q3m8u/Lib/site-packages/numpy/__init__.cython-30.pxd":1072 + * + * + * cdef inline NPY_DATETIMEUNIT get_datetime64_unit(object obj) noexcept nogil: # <<<<<<<<<<<<<< + * """ + * returns the unit part of the dtype for a numpy datetime64 object. +*/ + + /* function exit code */ + __pyx_L0:; + return __pyx_r; +} + +/* "lexeme.pxd":29 + * cdef readonly attr_t orth + * + * @staticmethod # <<<<<<<<<<<<<< + * cdef inline Lexeme from_ptr(LexemeC* lex, Vocab vocab): + * cdef Lexeme self = Lexeme.__new__(Lexeme, vocab, lex.orth) +*/ + +static CYTHON_INLINE struct __pyx_obj_5spacy_6lexeme_Lexeme *__pyx_f_5spacy_6lexeme_6Lexeme_from_ptr(struct __pyx_t_5spacy_7structs_LexemeC *__pyx_v_lex, struct __pyx_obj_5spacy_5vocab_Vocab *__pyx_v_vocab) { + struct __pyx_obj_5spacy_6lexeme_Lexeme *__pyx_v_self = 0; + struct __pyx_obj_5spacy_6lexeme_Lexeme *__pyx_r = NULL; + __Pyx_RefNannyDeclarations + PyObject *__pyx_t_1 = NULL; + PyObject *__pyx_t_2 = NULL; + __pyx_t_5spacy_8typedefs_attr_t __pyx_t_3; + int __pyx_lineno = 0; + const char *__pyx_filename = NULL; + int __pyx_clineno = 0; + __Pyx_RefNannySetupContext("from_ptr", 0); + + /* "lexeme.pxd":31 + * @staticmethod + * cdef inline Lexeme from_ptr(LexemeC* lex, Vocab vocab): + * cdef Lexeme self = Lexeme.__new__(Lexeme, vocab, lex.orth) # <<<<<<<<<<<<<< + * self.c = lex + * self.vocab = vocab +*/ + __pyx_t_1 = __Pyx_PyLong_From_uint64_t(__pyx_v_lex->orth); if (unlikely(!__pyx_t_1)) __PYX_ERR(3, 31, __pyx_L1_error) + __Pyx_GOTREF(__pyx_t_1); + __pyx_t_2 = PyTuple_New(2); if (unlikely(!__pyx_t_2)) __PYX_ERR(3, 31, __pyx_L1_error) + __Pyx_GOTREF(__pyx_t_2); + __Pyx_INCREF((PyObject *)__pyx_v_vocab); + __Pyx_GIVEREF((PyObject *)__pyx_v_vocab); + if (__Pyx_PyTuple_SET_ITEM(__pyx_t_2, 0, ((PyObject *)__pyx_v_vocab)) != (0)) __PYX_ERR(3, 31, __pyx_L1_error); + __Pyx_GIVEREF(__pyx_t_1); + if (__Pyx_PyTuple_SET_ITEM(__pyx_t_2, 1, __pyx_t_1) != (0)) __PYX_ERR(3, 31, __pyx_L1_error); + __pyx_t_1 = 0; + __pyx_t_1 = __Pyx_tp_new(((PyObject *)__pyx_mstate_global->__pyx_ptype_5spacy_6lexeme_Lexeme), ((PyObject*)__pyx_t_2)); if (unlikely(!__pyx_t_1)) __PYX_ERR(3, 31, __pyx_L1_error) + __Pyx_GOTREF(__pyx_t_1); + __Pyx_DECREF(__pyx_t_2); __pyx_t_2 = 0; + if (!(likely(__Pyx_TypeTest(__pyx_t_1, __pyx_mstate_global->__pyx_ptype_5spacy_6lexeme_Lexeme)))) __PYX_ERR(3, 31, __pyx_L1_error) + __pyx_v_self = ((struct __pyx_obj_5spacy_6lexeme_Lexeme *)__pyx_t_1); + __pyx_t_1 = 0; + + /* "lexeme.pxd":32 + * cdef inline Lexeme from_ptr(LexemeC* lex, Vocab vocab): + * cdef Lexeme self = Lexeme.__new__(Lexeme, vocab, lex.orth) + * self.c = lex # <<<<<<<<<<<<<< + * self.vocab = vocab + * self.orth = lex.orth +*/ + __pyx_v_self->c = __pyx_v_lex; + + /* "lexeme.pxd":33 + * cdef Lexeme self = Lexeme.__new__(Lexeme, vocab, lex.orth) + * self.c = lex + * self.vocab = vocab # <<<<<<<<<<<<<< + * self.orth = lex.orth + * return self +*/ + __Pyx_INCREF((PyObject *)__pyx_v_vocab); + __Pyx_GIVEREF((PyObject *)__pyx_v_vocab); + __Pyx_GOTREF((PyObject *)__pyx_v_self->vocab); + __Pyx_DECREF((PyObject *)__pyx_v_self->vocab); + __pyx_v_self->vocab = __pyx_v_vocab; + + /* "lexeme.pxd":34 + * self.c = lex + * self.vocab = vocab + * self.orth = lex.orth # <<<<<<<<<<<<<< + * return self + * +*/ + __pyx_t_3 = __pyx_v_lex->orth; + __pyx_v_self->orth = __pyx_t_3; + + /* "lexeme.pxd":35 + * self.vocab = vocab + * self.orth = lex.orth + * return self # <<<<<<<<<<<<<< + * + * @staticmethod +*/ + __Pyx_XDECREF((PyObject *)__pyx_r); + __Pyx_INCREF((PyObject *)__pyx_v_self); + __pyx_r = __pyx_v_self; + goto __pyx_L0; + + /* "lexeme.pxd":29 + * cdef readonly attr_t orth + * + * @staticmethod # <<<<<<<<<<<<<< + * cdef inline Lexeme from_ptr(LexemeC* lex, Vocab vocab): + * cdef Lexeme self = Lexeme.__new__(Lexeme, vocab, lex.orth) +*/ + + /* function exit code */ + __pyx_L1_error:; + __Pyx_XDECREF(__pyx_t_1); + __Pyx_XDECREF(__pyx_t_2); + __Pyx_AddTraceback("spacy.lexeme.Lexeme.from_ptr", __pyx_clineno, __pyx_lineno, __pyx_filename); + __pyx_r = 0; + __pyx_L0:; + __Pyx_XDECREF((PyObject *)__pyx_v_self); + __Pyx_XGIVEREF((PyObject *)__pyx_r); + __Pyx_RefNannyFinishContext(); + return __pyx_r; +} + +/* "lexeme.pxd":37 + * return self + * + * @staticmethod # <<<<<<<<<<<<<< + * cdef inline void set_struct_attr(LexemeC* lex, attr_id_t name, attr_t value) noexcept nogil: + * if name < (sizeof(flags_t) * 8): +*/ + +static CYTHON_INLINE void __pyx_f_5spacy_6lexeme_6Lexeme_set_struct_attr(struct __pyx_t_5spacy_7structs_LexemeC *__pyx_v_lex, enum __pyx_t_5spacy_5attrs_attr_id_t __pyx_v_name, __pyx_t_5spacy_8typedefs_attr_t __pyx_v_value) { + int __pyx_t_1; + + /* "lexeme.pxd":39 + * @staticmethod + * cdef inline void set_struct_attr(LexemeC* lex, attr_id_t name, attr_t value) noexcept nogil: + * if name < (sizeof(flags_t) * 8): # <<<<<<<<<<<<<< + * Lexeme.c_set_flag(lex, name, value) + * elif name == ID: +*/ + __pyx_t_1 = (__pyx_v_name < ((sizeof(__pyx_t_5spacy_8typedefs_flags_t)) * 8)); + if (__pyx_t_1) { + + /* "lexeme.pxd":40 + * cdef inline void set_struct_attr(LexemeC* lex, attr_id_t name, attr_t value) noexcept nogil: + * if name < (sizeof(flags_t) * 8): + * Lexeme.c_set_flag(lex, name, value) # <<<<<<<<<<<<<< + * elif name == ID: + * lex.id = value +*/ + (void)(__pyx_f_5spacy_6lexeme_6Lexeme_c_set_flag(__pyx_v_lex, __pyx_v_name, __pyx_v_value)); + + /* "lexeme.pxd":39 + * @staticmethod + * cdef inline void set_struct_attr(LexemeC* lex, attr_id_t name, attr_t value) noexcept nogil: + * if name < (sizeof(flags_t) * 8): # <<<<<<<<<<<<<< + * Lexeme.c_set_flag(lex, name, value) + * elif name == ID: +*/ + goto __pyx_L3; + } + + /* "lexeme.pxd":41 + * if name < (sizeof(flags_t) * 8): + * Lexeme.c_set_flag(lex, name, value) + * elif name == ID: # <<<<<<<<<<<<<< + * lex.id = value + * elif name == LOWER: +*/ + __pyx_t_1 = (__pyx_v_name == __pyx_e_5spacy_5attrs_ID); + if (__pyx_t_1) { + + /* "lexeme.pxd":42 + * Lexeme.c_set_flag(lex, name, value) + * elif name == ID: + * lex.id = value # <<<<<<<<<<<<<< + * elif name == LOWER: + * lex.lower = value +*/ + __pyx_v_lex->id = __pyx_v_value; + + /* "lexeme.pxd":41 + * if name < (sizeof(flags_t) * 8): + * Lexeme.c_set_flag(lex, name, value) + * elif name == ID: # <<<<<<<<<<<<<< + * lex.id = value + * elif name == LOWER: +*/ + goto __pyx_L3; + } + + /* "lexeme.pxd":43 + * elif name == ID: + * lex.id = value + * elif name == LOWER: # <<<<<<<<<<<<<< + * lex.lower = value + * elif name == NORM: +*/ + __pyx_t_1 = (__pyx_v_name == __pyx_e_5spacy_5attrs_LOWER); + if (__pyx_t_1) { + + /* "lexeme.pxd":44 + * lex.id = value + * elif name == LOWER: + * lex.lower = value # <<<<<<<<<<<<<< + * elif name == NORM: + * lex.norm = value +*/ + __pyx_v_lex->lower = __pyx_v_value; + + /* "lexeme.pxd":43 + * elif name == ID: + * lex.id = value + * elif name == LOWER: # <<<<<<<<<<<<<< + * lex.lower = value + * elif name == NORM: +*/ + goto __pyx_L3; + } + + /* "lexeme.pxd":45 + * elif name == LOWER: + * lex.lower = value + * elif name == NORM: # <<<<<<<<<<<<<< + * lex.norm = value + * elif name == SHAPE: +*/ + __pyx_t_1 = (__pyx_v_name == __pyx_e_5spacy_5attrs_NORM); + if (__pyx_t_1) { + + /* "lexeme.pxd":46 + * lex.lower = value + * elif name == NORM: + * lex.norm = value # <<<<<<<<<<<<<< + * elif name == SHAPE: + * lex.shape = value +*/ + __pyx_v_lex->norm = __pyx_v_value; + + /* "lexeme.pxd":45 + * elif name == LOWER: + * lex.lower = value + * elif name == NORM: # <<<<<<<<<<<<<< + * lex.norm = value + * elif name == SHAPE: +*/ + goto __pyx_L3; + } + + /* "lexeme.pxd":47 + * elif name == NORM: + * lex.norm = value + * elif name == SHAPE: # <<<<<<<<<<<<<< + * lex.shape = value + * elif name == PREFIX: +*/ + __pyx_t_1 = (__pyx_v_name == __pyx_e_5spacy_5attrs_SHAPE); + if (__pyx_t_1) { + + /* "lexeme.pxd":48 + * lex.norm = value + * elif name == SHAPE: + * lex.shape = value # <<<<<<<<<<<<<< + * elif name == PREFIX: + * lex.prefix = value +*/ + __pyx_v_lex->shape = __pyx_v_value; + + /* "lexeme.pxd":47 + * elif name == NORM: + * lex.norm = value + * elif name == SHAPE: # <<<<<<<<<<<<<< + * lex.shape = value + * elif name == PREFIX: +*/ + goto __pyx_L3; + } + + /* "lexeme.pxd":49 + * elif name == SHAPE: + * lex.shape = value + * elif name == PREFIX: # <<<<<<<<<<<<<< + * lex.prefix = value + * elif name == SUFFIX: +*/ + __pyx_t_1 = (__pyx_v_name == __pyx_e_5spacy_5attrs_PREFIX); + if (__pyx_t_1) { + + /* "lexeme.pxd":50 + * lex.shape = value + * elif name == PREFIX: + * lex.prefix = value # <<<<<<<<<<<<<< + * elif name == SUFFIX: + * lex.suffix = value +*/ + __pyx_v_lex->prefix = __pyx_v_value; + + /* "lexeme.pxd":49 + * elif name == SHAPE: + * lex.shape = value + * elif name == PREFIX: # <<<<<<<<<<<<<< + * lex.prefix = value + * elif name == SUFFIX: +*/ + goto __pyx_L3; + } + + /* "lexeme.pxd":51 + * elif name == PREFIX: + * lex.prefix = value + * elif name == SUFFIX: # <<<<<<<<<<<<<< + * lex.suffix = value + * elif name == LANG: +*/ + __pyx_t_1 = (__pyx_v_name == __pyx_e_5spacy_5attrs_SUFFIX); + if (__pyx_t_1) { + + /* "lexeme.pxd":52 + * lex.prefix = value + * elif name == SUFFIX: + * lex.suffix = value # <<<<<<<<<<<<<< + * elif name == LANG: + * lex.lang = value +*/ + __pyx_v_lex->suffix = __pyx_v_value; + + /* "lexeme.pxd":51 + * elif name == PREFIX: + * lex.prefix = value + * elif name == SUFFIX: # <<<<<<<<<<<<<< + * lex.suffix = value + * elif name == LANG: +*/ + goto __pyx_L3; + } + + /* "lexeme.pxd":53 + * elif name == SUFFIX: + * lex.suffix = value + * elif name == LANG: # <<<<<<<<<<<<<< + * lex.lang = value + * +*/ + __pyx_t_1 = (__pyx_v_name == __pyx_e_5spacy_5attrs_LANG); + if (__pyx_t_1) { + + /* "lexeme.pxd":54 + * lex.suffix = value + * elif name == LANG: + * lex.lang = value # <<<<<<<<<<<<<< + * + * @staticmethod +*/ + __pyx_v_lex->lang = __pyx_v_value; + + /* "lexeme.pxd":53 + * elif name == SUFFIX: + * lex.suffix = value + * elif name == LANG: # <<<<<<<<<<<<<< + * lex.lang = value + * +*/ + } + __pyx_L3:; + + /* "lexeme.pxd":37 + * return self + * + * @staticmethod # <<<<<<<<<<<<<< + * cdef inline void set_struct_attr(LexemeC* lex, attr_id_t name, attr_t value) noexcept nogil: + * if name < (sizeof(flags_t) * 8): +*/ + + /* function exit code */ +} + +/* "lexeme.pxd":56 + * lex.lang = value + * + * @staticmethod # <<<<<<<<<<<<<< + * cdef inline attr_t get_struct_attr(const LexemeC* lex, attr_id_t feat_name) noexcept nogil: + * if feat_name < (sizeof(flags_t) * 8): +*/ + +static CYTHON_INLINE __pyx_t_5spacy_8typedefs_attr_t __pyx_f_5spacy_6lexeme_6Lexeme_get_struct_attr(struct __pyx_t_5spacy_7structs_LexemeC const *__pyx_v_lex, enum __pyx_t_5spacy_5attrs_attr_id_t __pyx_v_feat_name) { + __pyx_t_5spacy_8typedefs_attr_t __pyx_r; + int __pyx_t_1; + + /* "lexeme.pxd":58 + * @staticmethod + * cdef inline attr_t get_struct_attr(const LexemeC* lex, attr_id_t feat_name) noexcept nogil: + * if feat_name < (sizeof(flags_t) * 8): # <<<<<<<<<<<<<< + * if Lexeme.c_check_flag(lex, feat_name): + * return 1 +*/ + __pyx_t_1 = (__pyx_v_feat_name < ((sizeof(__pyx_t_5spacy_8typedefs_flags_t)) * 8)); + if (__pyx_t_1) { + + /* "lexeme.pxd":59 + * cdef inline attr_t get_struct_attr(const LexemeC* lex, attr_id_t feat_name) noexcept nogil: + * if feat_name < (sizeof(flags_t) * 8): + * if Lexeme.c_check_flag(lex, feat_name): # <<<<<<<<<<<<<< + * return 1 + * else: +*/ + __pyx_t_1 = __pyx_f_5spacy_6lexeme_6Lexeme_c_check_flag(__pyx_v_lex, __pyx_v_feat_name); + if (__pyx_t_1) { + + /* "lexeme.pxd":60 + * if feat_name < (sizeof(flags_t) * 8): + * if Lexeme.c_check_flag(lex, feat_name): + * return 1 # <<<<<<<<<<<<<< + * else: + * return 0 +*/ + __pyx_r = 1; + goto __pyx_L0; + + /* "lexeme.pxd":59 + * cdef inline attr_t get_struct_attr(const LexemeC* lex, attr_id_t feat_name) noexcept nogil: + * if feat_name < (sizeof(flags_t) * 8): + * if Lexeme.c_check_flag(lex, feat_name): # <<<<<<<<<<<<<< + * return 1 + * else: +*/ + } + + /* "lexeme.pxd":62 + * return 1 + * else: + * return 0 # <<<<<<<<<<<<<< + * elif feat_name == ID: + * return lex.id +*/ + /*else*/ { + __pyx_r = 0; + goto __pyx_L0; + } + + /* "lexeme.pxd":58 + * @staticmethod + * cdef inline attr_t get_struct_attr(const LexemeC* lex, attr_id_t feat_name) noexcept nogil: + * if feat_name < (sizeof(flags_t) * 8): # <<<<<<<<<<<<<< + * if Lexeme.c_check_flag(lex, feat_name): + * return 1 +*/ + } + + /* "lexeme.pxd":63 + * else: + * return 0 + * elif feat_name == ID: # <<<<<<<<<<<<<< + * return lex.id + * elif feat_name == ORTH: +*/ + __pyx_t_1 = (__pyx_v_feat_name == __pyx_e_5spacy_5attrs_ID); + if (__pyx_t_1) { + + /* "lexeme.pxd":64 + * return 0 + * elif feat_name == ID: + * return lex.id # <<<<<<<<<<<<<< + * elif feat_name == ORTH: + * return lex.orth +*/ + __pyx_r = __pyx_v_lex->id; + goto __pyx_L0; + + /* "lexeme.pxd":63 + * else: + * return 0 + * elif feat_name == ID: # <<<<<<<<<<<<<< + * return lex.id + * elif feat_name == ORTH: +*/ + } + + /* "lexeme.pxd":65 + * elif feat_name == ID: + * return lex.id + * elif feat_name == ORTH: # <<<<<<<<<<<<<< + * return lex.orth + * elif feat_name == LOWER: +*/ + __pyx_t_1 = (__pyx_v_feat_name == __pyx_e_5spacy_5attrs_ORTH); + if (__pyx_t_1) { + + /* "lexeme.pxd":66 + * return lex.id + * elif feat_name == ORTH: + * return lex.orth # <<<<<<<<<<<<<< + * elif feat_name == LOWER: + * return lex.lower +*/ + __pyx_r = __pyx_v_lex->orth; + goto __pyx_L0; + + /* "lexeme.pxd":65 + * elif feat_name == ID: + * return lex.id + * elif feat_name == ORTH: # <<<<<<<<<<<<<< + * return lex.orth + * elif feat_name == LOWER: +*/ + } + + /* "lexeme.pxd":67 + * elif feat_name == ORTH: + * return lex.orth + * elif feat_name == LOWER: # <<<<<<<<<<<<<< + * return lex.lower + * elif feat_name == NORM: +*/ + __pyx_t_1 = (__pyx_v_feat_name == __pyx_e_5spacy_5attrs_LOWER); + if (__pyx_t_1) { + + /* "lexeme.pxd":68 + * return lex.orth + * elif feat_name == LOWER: + * return lex.lower # <<<<<<<<<<<<<< + * elif feat_name == NORM: + * return lex.norm +*/ + __pyx_r = __pyx_v_lex->lower; + goto __pyx_L0; + + /* "lexeme.pxd":67 + * elif feat_name == ORTH: + * return lex.orth + * elif feat_name == LOWER: # <<<<<<<<<<<<<< + * return lex.lower + * elif feat_name == NORM: +*/ + } + + /* "lexeme.pxd":69 + * elif feat_name == LOWER: + * return lex.lower + * elif feat_name == NORM: # <<<<<<<<<<<<<< + * return lex.norm + * elif feat_name == SHAPE: +*/ + __pyx_t_1 = (__pyx_v_feat_name == __pyx_e_5spacy_5attrs_NORM); + if (__pyx_t_1) { + + /* "lexeme.pxd":70 + * return lex.lower + * elif feat_name == NORM: + * return lex.norm # <<<<<<<<<<<<<< + * elif feat_name == SHAPE: + * return lex.shape +*/ + __pyx_r = __pyx_v_lex->norm; + goto __pyx_L0; + + /* "lexeme.pxd":69 + * elif feat_name == LOWER: + * return lex.lower + * elif feat_name == NORM: # <<<<<<<<<<<<<< + * return lex.norm + * elif feat_name == SHAPE: +*/ + } + + /* "lexeme.pxd":71 + * elif feat_name == NORM: + * return lex.norm + * elif feat_name == SHAPE: # <<<<<<<<<<<<<< + * return lex.shape + * elif feat_name == PREFIX: +*/ + __pyx_t_1 = (__pyx_v_feat_name == __pyx_e_5spacy_5attrs_SHAPE); + if (__pyx_t_1) { + + /* "lexeme.pxd":72 + * return lex.norm + * elif feat_name == SHAPE: + * return lex.shape # <<<<<<<<<<<<<< + * elif feat_name == PREFIX: + * return lex.prefix +*/ + __pyx_r = __pyx_v_lex->shape; + goto __pyx_L0; + + /* "lexeme.pxd":71 + * elif feat_name == NORM: + * return lex.norm + * elif feat_name == SHAPE: # <<<<<<<<<<<<<< + * return lex.shape + * elif feat_name == PREFIX: +*/ + } + + /* "lexeme.pxd":73 + * elif feat_name == SHAPE: + * return lex.shape + * elif feat_name == PREFIX: # <<<<<<<<<<<<<< + * return lex.prefix + * elif feat_name == SUFFIX: +*/ + __pyx_t_1 = (__pyx_v_feat_name == __pyx_e_5spacy_5attrs_PREFIX); + if (__pyx_t_1) { + + /* "lexeme.pxd":74 + * return lex.shape + * elif feat_name == PREFIX: + * return lex.prefix # <<<<<<<<<<<<<< + * elif feat_name == SUFFIX: + * return lex.suffix +*/ + __pyx_r = __pyx_v_lex->prefix; + goto __pyx_L0; + + /* "lexeme.pxd":73 + * elif feat_name == SHAPE: + * return lex.shape + * elif feat_name == PREFIX: # <<<<<<<<<<<<<< + * return lex.prefix + * elif feat_name == SUFFIX: +*/ + } + + /* "lexeme.pxd":75 + * elif feat_name == PREFIX: + * return lex.prefix + * elif feat_name == SUFFIX: # <<<<<<<<<<<<<< + * return lex.suffix + * elif feat_name == LENGTH: +*/ + __pyx_t_1 = (__pyx_v_feat_name == __pyx_e_5spacy_5attrs_SUFFIX); + if (__pyx_t_1) { + + /* "lexeme.pxd":76 + * return lex.prefix + * elif feat_name == SUFFIX: + * return lex.suffix # <<<<<<<<<<<<<< + * elif feat_name == LENGTH: + * return lex.length +*/ + __pyx_r = __pyx_v_lex->suffix; + goto __pyx_L0; + + /* "lexeme.pxd":75 + * elif feat_name == PREFIX: + * return lex.prefix + * elif feat_name == SUFFIX: # <<<<<<<<<<<<<< + * return lex.suffix + * elif feat_name == LENGTH: +*/ + } + + /* "lexeme.pxd":77 + * elif feat_name == SUFFIX: + * return lex.suffix + * elif feat_name == LENGTH: # <<<<<<<<<<<<<< + * return lex.length + * elif feat_name == LANG: +*/ + __pyx_t_1 = (__pyx_v_feat_name == __pyx_e_5spacy_5attrs_LENGTH); + if (__pyx_t_1) { + + /* "lexeme.pxd":78 + * return lex.suffix + * elif feat_name == LENGTH: + * return lex.length # <<<<<<<<<<<<<< + * elif feat_name == LANG: + * return lex.lang +*/ + __pyx_r = __pyx_v_lex->length; + goto __pyx_L0; + + /* "lexeme.pxd":77 + * elif feat_name == SUFFIX: + * return lex.suffix + * elif feat_name == LENGTH: # <<<<<<<<<<<<<< + * return lex.length + * elif feat_name == LANG: +*/ + } + + /* "lexeme.pxd":79 + * elif feat_name == LENGTH: + * return lex.length + * elif feat_name == LANG: # <<<<<<<<<<<<<< + * return lex.lang + * else: +*/ + __pyx_t_1 = (__pyx_v_feat_name == __pyx_e_5spacy_5attrs_LANG); + if (__pyx_t_1) { + + /* "lexeme.pxd":80 + * return lex.length + * elif feat_name == LANG: + * return lex.lang # <<<<<<<<<<<<<< + * else: + * return 0 +*/ + __pyx_r = __pyx_v_lex->lang; + goto __pyx_L0; + + /* "lexeme.pxd":79 + * elif feat_name == LENGTH: + * return lex.length + * elif feat_name == LANG: # <<<<<<<<<<<<<< + * return lex.lang + * else: +*/ + } + + /* "lexeme.pxd":82 + * return lex.lang + * else: + * return 0 # <<<<<<<<<<<<<< + * + * @staticmethod +*/ + /*else*/ { + __pyx_r = 0; + goto __pyx_L0; + } + + /* "lexeme.pxd":56 + * lex.lang = value + * + * @staticmethod # <<<<<<<<<<<<<< + * cdef inline attr_t get_struct_attr(const LexemeC* lex, attr_id_t feat_name) noexcept nogil: + * if feat_name < (sizeof(flags_t) * 8): +*/ + + /* function exit code */ + __pyx_L0:; + return __pyx_r; +} + +/* "lexeme.pxd":84 + * return 0 + * + * @staticmethod # <<<<<<<<<<<<<< + * cdef inline bint c_check_flag(const LexemeC* lexeme, attr_id_t flag_id) noexcept nogil: + * cdef flags_t one = 1 +*/ + +static CYTHON_INLINE int __pyx_f_5spacy_6lexeme_6Lexeme_c_check_flag(struct __pyx_t_5spacy_7structs_LexemeC const *__pyx_v_lexeme, enum __pyx_t_5spacy_5attrs_attr_id_t __pyx_v_flag_id) { + __pyx_t_5spacy_8typedefs_flags_t __pyx_v_one; + int __pyx_r; + int __pyx_t_1; + + /* "lexeme.pxd":86 + * @staticmethod + * cdef inline bint c_check_flag(const LexemeC* lexeme, attr_id_t flag_id) noexcept nogil: + * cdef flags_t one = 1 # <<<<<<<<<<<<<< + * if lexeme.flags & (one << flag_id): + * return True +*/ + __pyx_v_one = 1; + + /* "lexeme.pxd":87 + * cdef inline bint c_check_flag(const LexemeC* lexeme, attr_id_t flag_id) noexcept nogil: + * cdef flags_t one = 1 + * if lexeme.flags & (one << flag_id): # <<<<<<<<<<<<<< + * return True + * else: +*/ + __pyx_t_1 = ((__pyx_v_lexeme->flags & (__pyx_v_one << __pyx_v_flag_id)) != 0); + if (__pyx_t_1) { + + /* "lexeme.pxd":88 + * cdef flags_t one = 1 + * if lexeme.flags & (one << flag_id): + * return True # <<<<<<<<<<<<<< + * else: + * return False +*/ + __pyx_r = 1; + goto __pyx_L0; + + /* "lexeme.pxd":87 + * cdef inline bint c_check_flag(const LexemeC* lexeme, attr_id_t flag_id) noexcept nogil: + * cdef flags_t one = 1 + * if lexeme.flags & (one << flag_id): # <<<<<<<<<<<<<< + * return True + * else: +*/ + } + + /* "lexeme.pxd":90 + * return True + * else: + * return False # <<<<<<<<<<<<<< + * + * @staticmethod +*/ + /*else*/ { + __pyx_r = 0; + goto __pyx_L0; + } + + /* "lexeme.pxd":84 + * return 0 + * + * @staticmethod # <<<<<<<<<<<<<< + * cdef inline bint c_check_flag(const LexemeC* lexeme, attr_id_t flag_id) noexcept nogil: + * cdef flags_t one = 1 +*/ + + /* function exit code */ + __pyx_L0:; + return __pyx_r; +} + +/* "lexeme.pxd":92 + * return False + * + * @staticmethod # <<<<<<<<<<<<<< + * cdef inline bint c_set_flag(LexemeC* lex, attr_id_t flag_id, bint value) noexcept nogil: + * cdef flags_t one = 1 +*/ + +static CYTHON_INLINE int __pyx_f_5spacy_6lexeme_6Lexeme_c_set_flag(struct __pyx_t_5spacy_7structs_LexemeC *__pyx_v_lex, enum __pyx_t_5spacy_5attrs_attr_id_t __pyx_v_flag_id, int __pyx_v_value) { + __pyx_t_5spacy_8typedefs_flags_t __pyx_v_one; + int __pyx_r; + + /* "lexeme.pxd":94 + * @staticmethod + * cdef inline bint c_set_flag(LexemeC* lex, attr_id_t flag_id, bint value) noexcept nogil: + * cdef flags_t one = 1 # <<<<<<<<<<<<<< + * if value: + * lex.flags |= one << flag_id +*/ + __pyx_v_one = 1; + + /* "lexeme.pxd":95 + * cdef inline bint c_set_flag(LexemeC* lex, attr_id_t flag_id, bint value) noexcept nogil: + * cdef flags_t one = 1 + * if value: # <<<<<<<<<<<<<< + * lex.flags |= one << flag_id + * else: +*/ + if (__pyx_v_value) { + + /* "lexeme.pxd":96 + * cdef flags_t one = 1 + * if value: + * lex.flags |= one << flag_id # <<<<<<<<<<<<<< + * else: + * lex.flags &= ~(one << flag_id) +*/ + __pyx_v_lex->flags = (__pyx_v_lex->flags | (__pyx_v_one << __pyx_v_flag_id)); + + /* "lexeme.pxd":95 + * cdef inline bint c_set_flag(LexemeC* lex, attr_id_t flag_id, bint value) noexcept nogil: + * cdef flags_t one = 1 + * if value: # <<<<<<<<<<<<<< + * lex.flags |= one << flag_id + * else: +*/ + goto __pyx_L3; + } + + /* "lexeme.pxd":98 + * lex.flags |= one << flag_id + * else: + * lex.flags &= ~(one << flag_id) # <<<<<<<<<<<<<< +*/ + /*else*/ { + __pyx_v_lex->flags = (__pyx_v_lex->flags & (~(__pyx_v_one << __pyx_v_flag_id))); + } + __pyx_L3:; + + /* "lexeme.pxd":92 + * return False + * + * @staticmethod # <<<<<<<<<<<<<< + * cdef inline bint c_set_flag(LexemeC* lex, attr_id_t flag_id, bint value) noexcept nogil: + * cdef flags_t one = 1 +*/ + + /* function exit code */ + __pyx_r = 0; + return __pyx_r; +} + +/* "_state.pxd":20 + * + * + * cdef inline bint is_space_token(const TokenC* token) noexcept nogil: # <<<<<<<<<<<<<< + * return Lexeme.c_check_flag(token.lex, IS_SPACE) + * +*/ + +static CYTHON_INLINE int __pyx_f_5spacy_8pipeline_17_parser_internals_6_state_is_space_token(struct __pyx_t_5spacy_7structs_TokenC const *__pyx_v_token) { + int __pyx_r; + + /* "_state.pxd":21 + * + * cdef inline bint is_space_token(const TokenC* token) noexcept nogil: + * return Lexeme.c_check_flag(token.lex, IS_SPACE) # <<<<<<<<<<<<<< + * + * cdef struct ArcC: +*/ + __pyx_r = __pyx_f_5spacy_6lexeme_6Lexeme_c_check_flag(__pyx_v_token->lex, __pyx_e_5spacy_5attrs_IS_SPACE); + goto __pyx_L0; + + /* "_state.pxd":20 + * + * + * cdef inline bint is_space_token(const TokenC* token) noexcept nogil: # <<<<<<<<<<<<<< + * return Lexeme.c_check_flag(token.lex, IS_SPACE) + * +*/ + + /* function exit code */ + __pyx_L0:; + return __pyx_r; +} + +/* "_state.pxd":44 + * int _b_i + * + * inline __init__(const TokenC* sent, int length) noexcept nogil: # <<<<<<<<<<<<<< + * this._sent = sent + * this._heads = calloc(length, sizeof(int)) +*/ + +void __pyx_t_5spacy_8pipeline_17_parser_internals_6_state_StateC::__pyx_f___init__StateC(struct __pyx_t_5spacy_7structs_TokenC const *__pyx_v_sent, int __pyx_v_length) { + int __pyx_v_i; + int __pyx_t_1; + int __pyx_t_2; + PyObject *__pyx_t_3; + int __pyx_t_4; + int __pyx_t_5; + int __pyx_t_6; + int __pyx_lineno = 0; + const char *__pyx_filename = NULL; + int __pyx_clineno = 0; + PyGILState_STATE __pyx_gilstate_save; + + /* "_state.pxd":45 + * + * inline __init__(const TokenC* sent, int length) noexcept nogil: + * this._sent = sent # <<<<<<<<<<<<<< + * this._heads = calloc(length, sizeof(int)) + * if not (this._sent and this._heads): +*/ + this->_sent = __pyx_v_sent; + + /* "_state.pxd":46 + * inline __init__(const TokenC* sent, int length) noexcept nogil: + * this._sent = sent + * this._heads = calloc(length, sizeof(int)) # <<<<<<<<<<<<<< + * if not (this._sent and this._heads): + * with gil: +*/ + this->_heads = ((int *)calloc(__pyx_v_length, (sizeof(int)))); + + /* "_state.pxd":47 + * this._sent = sent + * this._heads = calloc(length, sizeof(int)) + * if not (this._sent and this._heads): # <<<<<<<<<<<<<< + * with gil: + * PyErr_SetFromErrno(MemoryError) +*/ + __pyx_t_2 = (this->_sent != 0); + if (__pyx_t_2) { + } else { + __pyx_t_1 = __pyx_t_2; + goto __pyx_L4_bool_binop_done; + } + __pyx_t_2 = (this->_heads != 0); + __pyx_t_1 = __pyx_t_2; + __pyx_L4_bool_binop_done:; + __pyx_t_2 = (!__pyx_t_1); + if (__pyx_t_2) { + + /* "_state.pxd":48 + * this._heads = calloc(length, sizeof(int)) + * if not (this._sent and this._heads): + * with gil: # <<<<<<<<<<<<<< + * PyErr_SetFromErrno(MemoryError) + * PyErr_CheckSignals() +*/ + { + PyGILState_STATE __pyx_gilstate_save = __Pyx_PyGILState_Ensure(); + /*try:*/ { + + /* "_state.pxd":49 + * if not (this._sent and this._heads): + * with gil: + * PyErr_SetFromErrno(MemoryError) # <<<<<<<<<<<<<< + * PyErr_CheckSignals() + * this.offset = 0 +*/ + __pyx_t_3 = PyErr_SetFromErrno(((PyObject *)(((PyTypeObject*)PyExc_MemoryError)))); if (unlikely(__pyx_t_3 == ((void *)NULL))) __PYX_ERR(4, 49, __pyx_L7_error) + + /* "_state.pxd":50 + * with gil: + * PyErr_SetFromErrno(MemoryError) + * PyErr_CheckSignals() # <<<<<<<<<<<<<< + * this.offset = 0 + * this.length = length +*/ + __pyx_t_4 = PyErr_CheckSignals(); if (unlikely(__pyx_t_4 == ((int)-1))) __PYX_ERR(4, 50, __pyx_L7_error) + } + + /* "_state.pxd":48 + * this._heads = calloc(length, sizeof(int)) + * if not (this._sent and this._heads): + * with gil: # <<<<<<<<<<<<<< + * PyErr_SetFromErrno(MemoryError) + * PyErr_CheckSignals() +*/ + /*finally:*/ { + /*normal exit:*/{ + __Pyx_PyGILState_Release(__pyx_gilstate_save); + goto __pyx_L8; + } + __pyx_L7_error: { + __Pyx_PyGILState_Release(__pyx_gilstate_save); + goto __pyx_L1_error; + } + __pyx_L8:; + } + } + + /* "_state.pxd":47 + * this._sent = sent + * this._heads = calloc(length, sizeof(int)) + * if not (this._sent and this._heads): # <<<<<<<<<<<<<< + * with gil: + * PyErr_SetFromErrno(MemoryError) +*/ + } + + /* "_state.pxd":51 + * PyErr_SetFromErrno(MemoryError) + * PyErr_CheckSignals() + * this.offset = 0 # <<<<<<<<<<<<<< + * this.length = length + * this._b_i = 0 +*/ + this->offset = 0; + + /* "_state.pxd":52 + * PyErr_CheckSignals() + * this.offset = 0 + * this.length = length # <<<<<<<<<<<<<< + * this._b_i = 0 + * for i in range(length): +*/ + this->length = __pyx_v_length; + + /* "_state.pxd":53 + * this.offset = 0 + * this.length = length + * this._b_i = 0 # <<<<<<<<<<<<<< + * for i in range(length): + * this._heads[i] = -1 +*/ + this->_b_i = 0; + + /* "_state.pxd":54 + * this.length = length + * this._b_i = 0 + * for i in range(length): # <<<<<<<<<<<<<< + * this._heads[i] = -1 + * this._unshiftable.push_back(0) +*/ + __pyx_t_4 = __pyx_v_length; + __pyx_t_5 = __pyx_t_4; + for (__pyx_t_6 = 0; __pyx_t_6 < __pyx_t_5; __pyx_t_6+=1) { + __pyx_v_i = __pyx_t_6; + + /* "_state.pxd":55 + * this._b_i = 0 + * for i in range(length): + * this._heads[i] = -1 # <<<<<<<<<<<<<< + * this._unshiftable.push_back(0) + * memset(&this._empty_token, 0, sizeof(TokenC)) +*/ + (this->_heads[__pyx_v_i]) = -1; + + /* "_state.pxd":56 + * for i in range(length): + * this._heads[i] = -1 + * this._unshiftable.push_back(0) # <<<<<<<<<<<<<< + * memset(&this._empty_token, 0, sizeof(TokenC)) + * this._empty_token.lex = &EMPTY_LEXEME +*/ + try { + this->_unshiftable.push_back(0); + } catch(...) { + PyGILState_STATE __pyx_gilstate_save = __Pyx_PyGILState_Ensure(); + __Pyx_CppExn2PyErr(); + __Pyx_PyGILState_Release(__pyx_gilstate_save); + __PYX_ERR(4, 56, __pyx_L1_error) + } + } + + /* "_state.pxd":57 + * this._heads[i] = -1 + * this._unshiftable.push_back(0) + * memset(&this._empty_token, 0, sizeof(TokenC)) # <<<<<<<<<<<<<< + * this._empty_token.lex = &EMPTY_LEXEME + * +*/ + (void)(memset((&this->_empty_token), 0, (sizeof(struct __pyx_t_5spacy_7structs_TokenC)))); + + /* "_state.pxd":58 + * this._unshiftable.push_back(0) + * memset(&this._empty_token, 0, sizeof(TokenC)) + * this._empty_token.lex = &EMPTY_LEXEME # <<<<<<<<<<<<<< + * + * inline __dealloc__(): +*/ + this->_empty_token.lex = (&__pyx_v_5spacy_5vocab_EMPTY_LEXEME); + + /* "_state.pxd":44 + * int _b_i + * + * inline __init__(const TokenC* sent, int length) noexcept nogil: # <<<<<<<<<<<<<< + * this._sent = sent + * this._heads = calloc(length, sizeof(int)) +*/ + + /* function exit code */ + goto __pyx_L0; + __pyx_L1_error:; + __pyx_gilstate_save = __Pyx_PyGILState_Ensure(); + __Pyx_WriteUnraisable("StateC.", __pyx_clineno, __pyx_lineno, __pyx_filename, 1, 0); + __Pyx_PyGILState_Release(__pyx_gilstate_save); + __pyx_L0:; +} + +/* "_state.pxd":60 + * this._empty_token.lex = &EMPTY_LEXEME + * + * inline __dealloc__(): # <<<<<<<<<<<<<< + * free(this._heads) + * +*/ + +void __pyx_t_5spacy_8pipeline_17_parser_internals_6_state_StateC::__pyx_f___dealloc__StateC(void) { + + /* "_state.pxd":61 + * + * inline __dealloc__(): + * free(this._heads) # <<<<<<<<<<<<<< + * + * inline void set_context_tokens(int* ids, int n) noexcept nogil: +*/ + free(this->_heads); + + /* "_state.pxd":60 + * this._empty_token.lex = &EMPTY_LEXEME + * + * inline __dealloc__(): # <<<<<<<<<<<<<< + * free(this._heads) + * +*/ + + /* function exit code */ +} + +/* "_state.pxd":63 + * free(this._heads) + * + * inline void set_context_tokens(int* ids, int n) noexcept nogil: # <<<<<<<<<<<<<< + * cdef int i, j + * if n == 1: +*/ + +void __pyx_t_5spacy_8pipeline_17_parser_internals_6_state_StateC::set_context_tokens(int *__pyx_v_ids, int __pyx_v_n) { + int __pyx_v_i; + int __pyx_v_j; + struct __pyx_t_5spacy_7structs_SpanC __pyx_v_ent; + int __pyx_t_1; + int __pyx_t_2; + int __pyx_t_3; + int __pyx_t_4; + int __pyx_t_5; + int __pyx_t_6; + + /* "_state.pxd":65 + * inline void set_context_tokens(int* ids, int n) noexcept nogil: + * cdef int i, j + * if n == 1: # <<<<<<<<<<<<<< + * if this.B(0) >= 0: + * ids[0] = this.B(0) +*/ + switch (__pyx_v_n) { + case 1: + + /* "_state.pxd":66 + * cdef int i, j + * if n == 1: + * if this.B(0) >= 0: # <<<<<<<<<<<<<< + * ids[0] = this.B(0) + * else: +*/ + __pyx_t_1 = (this->B(0) >= 0); + if (__pyx_t_1) { + + /* "_state.pxd":67 + * if n == 1: + * if this.B(0) >= 0: + * ids[0] = this.B(0) # <<<<<<<<<<<<<< + * else: + * ids[0] = -1 +*/ + (__pyx_v_ids[0]) = this->B(0); + + /* "_state.pxd":66 + * cdef int i, j + * if n == 1: + * if this.B(0) >= 0: # <<<<<<<<<<<<<< + * ids[0] = this.B(0) + * else: +*/ + goto __pyx_L3; + } + + /* "_state.pxd":69 + * ids[0] = this.B(0) + * else: + * ids[0] = -1 # <<<<<<<<<<<<<< + * elif n == 2: + * ids[0] = this.B(0) +*/ + /*else*/ { + (__pyx_v_ids[0]) = -1; + } + __pyx_L3:; + + /* "_state.pxd":65 + * inline void set_context_tokens(int* ids, int n) noexcept nogil: + * cdef int i, j + * if n == 1: # <<<<<<<<<<<<<< + * if this.B(0) >= 0: + * ids[0] = this.B(0) +*/ + break; + case 2: + + /* "_state.pxd":71 + * ids[0] = -1 + * elif n == 2: + * ids[0] = this.B(0) # <<<<<<<<<<<<<< + * ids[1] = this.S(0) + * elif n == 3: +*/ + (__pyx_v_ids[0]) = this->B(0); + + /* "_state.pxd":72 + * elif n == 2: + * ids[0] = this.B(0) + * ids[1] = this.S(0) # <<<<<<<<<<<<<< + * elif n == 3: + * if this.B(0) >= 0: +*/ + (__pyx_v_ids[1]) = this->S(0); + + /* "_state.pxd":70 + * else: + * ids[0] = -1 + * elif n == 2: # <<<<<<<<<<<<<< + * ids[0] = this.B(0) + * ids[1] = this.S(0) +*/ + break; + case 3: + + /* "_state.pxd":74 + * ids[1] = this.S(0) + * elif n == 3: + * if this.B(0) >= 0: # <<<<<<<<<<<<<< + * ids[0] = this.B(0) + * else: +*/ + __pyx_t_1 = (this->B(0) >= 0); + if (__pyx_t_1) { + + /* "_state.pxd":75 + * elif n == 3: + * if this.B(0) >= 0: + * ids[0] = this.B(0) # <<<<<<<<<<<<<< + * else: + * ids[0] = -1 +*/ + (__pyx_v_ids[0]) = this->B(0); + + /* "_state.pxd":74 + * ids[1] = this.S(0) + * elif n == 3: + * if this.B(0) >= 0: # <<<<<<<<<<<<<< + * ids[0] = this.B(0) + * else: +*/ + goto __pyx_L4; + } + + /* "_state.pxd":77 + * ids[0] = this.B(0) + * else: + * ids[0] = -1 # <<<<<<<<<<<<<< + * # First word of entity, if any + * if this.entity_is_open(): +*/ + /*else*/ { + (__pyx_v_ids[0]) = -1; + } + __pyx_L4:; + + /* "_state.pxd":79 + * ids[0] = -1 + * # First word of entity, if any + * if this.entity_is_open(): # <<<<<<<<<<<<<< + * ids[1] = this.E(0) + * else: +*/ + __pyx_t_1 = this->entity_is_open(); + if (__pyx_t_1) { + + /* "_state.pxd":80 + * # First word of entity, if any + * if this.entity_is_open(): + * ids[1] = this.E(0) # <<<<<<<<<<<<<< + * else: + * ids[1] = -1 +*/ + (__pyx_v_ids[1]) = this->E(0); + + /* "_state.pxd":79 + * ids[0] = -1 + * # First word of entity, if any + * if this.entity_is_open(): # <<<<<<<<<<<<<< + * ids[1] = this.E(0) + * else: +*/ + goto __pyx_L5; + } + + /* "_state.pxd":82 + * ids[1] = this.E(0) + * else: + * ids[1] = -1 # <<<<<<<<<<<<<< + * # Last word of entity, if within entity + * if ids[0] == -1 or ids[1] == -1: +*/ + /*else*/ { + (__pyx_v_ids[1]) = -1; + } + __pyx_L5:; + + /* "_state.pxd":84 + * ids[1] = -1 + * # Last word of entity, if within entity + * if ids[0] == -1 or ids[1] == -1: # <<<<<<<<<<<<<< + * ids[2] = -1 + * else: +*/ + __pyx_t_2 = ((__pyx_v_ids[0]) == -1L); + if (!__pyx_t_2) { + } else { + __pyx_t_1 = __pyx_t_2; + goto __pyx_L7_bool_binop_done; + } + __pyx_t_2 = ((__pyx_v_ids[1]) == -1L); + __pyx_t_1 = __pyx_t_2; + __pyx_L7_bool_binop_done:; + if (__pyx_t_1) { + + /* "_state.pxd":85 + * # Last word of entity, if within entity + * if ids[0] == -1 or ids[1] == -1: + * ids[2] = -1 # <<<<<<<<<<<<<< + * else: + * ids[2] = ids[0] - 1 +*/ + (__pyx_v_ids[2]) = -1; + + /* "_state.pxd":84 + * ids[1] = -1 + * # Last word of entity, if within entity + * if ids[0] == -1 or ids[1] == -1: # <<<<<<<<<<<<<< + * ids[2] = -1 + * else: +*/ + goto __pyx_L6; + } + + /* "_state.pxd":87 + * ids[2] = -1 + * else: + * ids[2] = ids[0] - 1 # <<<<<<<<<<<<<< + * elif n == 8: + * ids[0] = this.B(0) +*/ + /*else*/ { + (__pyx_v_ids[2]) = ((__pyx_v_ids[0]) - 1); + } + __pyx_L6:; + + /* "_state.pxd":73 + * ids[0] = this.B(0) + * ids[1] = this.S(0) + * elif n == 3: # <<<<<<<<<<<<<< + * if this.B(0) >= 0: + * ids[0] = this.B(0) +*/ + break; + case 8: + + /* "_state.pxd":89 + * ids[2] = ids[0] - 1 + * elif n == 8: + * ids[0] = this.B(0) # <<<<<<<<<<<<<< + * ids[1] = this.B(1) + * ids[2] = this.S(0) +*/ + (__pyx_v_ids[0]) = this->B(0); + + /* "_state.pxd":90 + * elif n == 8: + * ids[0] = this.B(0) + * ids[1] = this.B(1) # <<<<<<<<<<<<<< + * ids[2] = this.S(0) + * ids[3] = this.S(1) +*/ + (__pyx_v_ids[1]) = this->B(1); + + /* "_state.pxd":91 + * ids[0] = this.B(0) + * ids[1] = this.B(1) + * ids[2] = this.S(0) # <<<<<<<<<<<<<< + * ids[3] = this.S(1) + * ids[4] = this.S(2) +*/ + (__pyx_v_ids[2]) = this->S(0); + + /* "_state.pxd":92 + * ids[1] = this.B(1) + * ids[2] = this.S(0) + * ids[3] = this.S(1) # <<<<<<<<<<<<<< + * ids[4] = this.S(2) + * ids[5] = this.L(this.B(0), 1) +*/ + (__pyx_v_ids[3]) = this->S(1); + + /* "_state.pxd":93 + * ids[2] = this.S(0) + * ids[3] = this.S(1) + * ids[4] = this.S(2) # <<<<<<<<<<<<<< + * ids[5] = this.L(this.B(0), 1) + * ids[6] = this.L(this.S(0), 1) +*/ + (__pyx_v_ids[4]) = this->S(2); + + /* "_state.pxd":94 + * ids[3] = this.S(1) + * ids[4] = this.S(2) + * ids[5] = this.L(this.B(0), 1) # <<<<<<<<<<<<<< + * ids[6] = this.L(this.S(0), 1) + * ids[7] = this.R(this.S(0), 1) +*/ + (__pyx_v_ids[5]) = this->L(this->B(0), 1); + + /* "_state.pxd":95 + * ids[4] = this.S(2) + * ids[5] = this.L(this.B(0), 1) + * ids[6] = this.L(this.S(0), 1) # <<<<<<<<<<<<<< + * ids[7] = this.R(this.S(0), 1) + * elif n == 13: +*/ + (__pyx_v_ids[6]) = this->L(this->S(0), 1); + + /* "_state.pxd":96 + * ids[5] = this.L(this.B(0), 1) + * ids[6] = this.L(this.S(0), 1) + * ids[7] = this.R(this.S(0), 1) # <<<<<<<<<<<<<< + * elif n == 13: + * ids[0] = this.B(0) +*/ + (__pyx_v_ids[7]) = this->R(this->S(0), 1); + + /* "_state.pxd":88 + * else: + * ids[2] = ids[0] - 1 + * elif n == 8: # <<<<<<<<<<<<<< + * ids[0] = this.B(0) + * ids[1] = this.B(1) +*/ + break; + case 13: + + /* "_state.pxd":98 + * ids[7] = this.R(this.S(0), 1) + * elif n == 13: + * ids[0] = this.B(0) # <<<<<<<<<<<<<< + * ids[1] = this.B(1) + * ids[2] = this.S(0) +*/ + (__pyx_v_ids[0]) = this->B(0); + + /* "_state.pxd":99 + * elif n == 13: + * ids[0] = this.B(0) + * ids[1] = this.B(1) # <<<<<<<<<<<<<< + * ids[2] = this.S(0) + * ids[3] = this.S(1) +*/ + (__pyx_v_ids[1]) = this->B(1); + + /* "_state.pxd":100 + * ids[0] = this.B(0) + * ids[1] = this.B(1) + * ids[2] = this.S(0) # <<<<<<<<<<<<<< + * ids[3] = this.S(1) + * ids[4] = this.S(2) +*/ + (__pyx_v_ids[2]) = this->S(0); + + /* "_state.pxd":101 + * ids[1] = this.B(1) + * ids[2] = this.S(0) + * ids[3] = this.S(1) # <<<<<<<<<<<<<< + * ids[4] = this.S(2) + * ids[5] = this.L(this.S(0), 1) +*/ + (__pyx_v_ids[3]) = this->S(1); + + /* "_state.pxd":102 + * ids[2] = this.S(0) + * ids[3] = this.S(1) + * ids[4] = this.S(2) # <<<<<<<<<<<<<< + * ids[5] = this.L(this.S(0), 1) + * ids[6] = this.L(this.S(0), 2) +*/ + (__pyx_v_ids[4]) = this->S(2); + + /* "_state.pxd":103 + * ids[3] = this.S(1) + * ids[4] = this.S(2) + * ids[5] = this.L(this.S(0), 1) # <<<<<<<<<<<<<< + * ids[6] = this.L(this.S(0), 2) + * ids[6] = this.R(this.S(0), 1) +*/ + (__pyx_v_ids[5]) = this->L(this->S(0), 1); + + /* "_state.pxd":104 + * ids[4] = this.S(2) + * ids[5] = this.L(this.S(0), 1) + * ids[6] = this.L(this.S(0), 2) # <<<<<<<<<<<<<< + * ids[6] = this.R(this.S(0), 1) + * ids[7] = this.L(this.B(0), 1) +*/ + (__pyx_v_ids[6]) = this->L(this->S(0), 2); + + /* "_state.pxd":105 + * ids[5] = this.L(this.S(0), 1) + * ids[6] = this.L(this.S(0), 2) + * ids[6] = this.R(this.S(0), 1) # <<<<<<<<<<<<<< + * ids[7] = this.L(this.B(0), 1) + * ids[8] = this.R(this.S(0), 2) +*/ + (__pyx_v_ids[6]) = this->R(this->S(0), 1); + + /* "_state.pxd":106 + * ids[6] = this.L(this.S(0), 2) + * ids[6] = this.R(this.S(0), 1) + * ids[7] = this.L(this.B(0), 1) # <<<<<<<<<<<<<< + * ids[8] = this.R(this.S(0), 2) + * ids[9] = this.L(this.S(1), 1) +*/ + (__pyx_v_ids[7]) = this->L(this->B(0), 1); + + /* "_state.pxd":107 + * ids[6] = this.R(this.S(0), 1) + * ids[7] = this.L(this.B(0), 1) + * ids[8] = this.R(this.S(0), 2) # <<<<<<<<<<<<<< + * ids[9] = this.L(this.S(1), 1) + * ids[10] = this.L(this.S(1), 2) +*/ + (__pyx_v_ids[8]) = this->R(this->S(0), 2); + + /* "_state.pxd":108 + * ids[7] = this.L(this.B(0), 1) + * ids[8] = this.R(this.S(0), 2) + * ids[9] = this.L(this.S(1), 1) # <<<<<<<<<<<<<< + * ids[10] = this.L(this.S(1), 2) + * ids[11] = this.R(this.S(1), 1) +*/ + (__pyx_v_ids[9]) = this->L(this->S(1), 1); + + /* "_state.pxd":109 + * ids[8] = this.R(this.S(0), 2) + * ids[9] = this.L(this.S(1), 1) + * ids[10] = this.L(this.S(1), 2) # <<<<<<<<<<<<<< + * ids[11] = this.R(this.S(1), 1) + * ids[12] = this.R(this.S(1), 2) +*/ + (__pyx_v_ids[10]) = this->L(this->S(1), 2); + + /* "_state.pxd":110 + * ids[9] = this.L(this.S(1), 1) + * ids[10] = this.L(this.S(1), 2) + * ids[11] = this.R(this.S(1), 1) # <<<<<<<<<<<<<< + * ids[12] = this.R(this.S(1), 2) + * elif n == 6: +*/ + (__pyx_v_ids[11]) = this->R(this->S(1), 1); + + /* "_state.pxd":111 + * ids[10] = this.L(this.S(1), 2) + * ids[11] = this.R(this.S(1), 1) + * ids[12] = this.R(this.S(1), 2) # <<<<<<<<<<<<<< + * elif n == 6: + * for i in range(6): +*/ + (__pyx_v_ids[12]) = this->R(this->S(1), 2); + + /* "_state.pxd":97 + * ids[6] = this.L(this.S(0), 1) + * ids[7] = this.R(this.S(0), 1) + * elif n == 13: # <<<<<<<<<<<<<< + * ids[0] = this.B(0) + * ids[1] = this.B(1) +*/ + break; + case 6: + + /* "_state.pxd":113 + * ids[12] = this.R(this.S(1), 2) + * elif n == 6: + * for i in range(6): # <<<<<<<<<<<<<< + * ids[i] = -1 + * if this.B(0) >= 0: +*/ + for (__pyx_t_3 = 0; __pyx_t_3 < 6; __pyx_t_3+=1) { + __pyx_v_i = __pyx_t_3; + + /* "_state.pxd":114 + * elif n == 6: + * for i in range(6): + * ids[i] = -1 # <<<<<<<<<<<<<< + * if this.B(0) >= 0: + * ids[0] = this.B(0) +*/ + (__pyx_v_ids[__pyx_v_i]) = -1; + } + + /* "_state.pxd":115 + * for i in range(6): + * ids[i] = -1 + * if this.B(0) >= 0: # <<<<<<<<<<<<<< + * ids[0] = this.B(0) + * if this.entity_is_open(): +*/ + __pyx_t_1 = (this->B(0) >= 0); + if (__pyx_t_1) { + + /* "_state.pxd":116 + * ids[i] = -1 + * if this.B(0) >= 0: + * ids[0] = this.B(0) # <<<<<<<<<<<<<< + * if this.entity_is_open(): + * ent = this.get_ent() +*/ + (__pyx_v_ids[0]) = this->B(0); + + /* "_state.pxd":115 + * for i in range(6): + * ids[i] = -1 + * if this.B(0) >= 0: # <<<<<<<<<<<<<< + * ids[0] = this.B(0) + * if this.entity_is_open(): +*/ + } + + /* "_state.pxd":117 + * if this.B(0) >= 0: + * ids[0] = this.B(0) + * if this.entity_is_open(): # <<<<<<<<<<<<<< + * ent = this.get_ent() + * j = 1 +*/ + __pyx_t_1 = this->entity_is_open(); + if (__pyx_t_1) { + + /* "_state.pxd":118 + * ids[0] = this.B(0) + * if this.entity_is_open(): + * ent = this.get_ent() # <<<<<<<<<<<<<< + * j = 1 + * for i in range(ent.start, this.B(0)): +*/ + __pyx_v_ent = this->get_ent(); + + /* "_state.pxd":119 + * if this.entity_is_open(): + * ent = this.get_ent() + * j = 1 # <<<<<<<<<<<<<< + * for i in range(ent.start, this.B(0)): + * ids[j] = i +*/ + __pyx_v_j = 1; + + /* "_state.pxd":120 + * ent = this.get_ent() + * j = 1 + * for i in range(ent.start, this.B(0)): # <<<<<<<<<<<<<< + * ids[j] = i + * j += 1 +*/ + __pyx_t_3 = this->B(0); + __pyx_t_4 = __pyx_t_3; + for (__pyx_t_5 = __pyx_v_ent.start; __pyx_t_5 < __pyx_t_4; __pyx_t_5+=1) { + __pyx_v_i = __pyx_t_5; + + /* "_state.pxd":121 + * j = 1 + * for i in range(ent.start, this.B(0)): + * ids[j] = i # <<<<<<<<<<<<<< + * j += 1 + * if j >= 6: +*/ + (__pyx_v_ids[__pyx_v_j]) = __pyx_v_i; + + /* "_state.pxd":122 + * for i in range(ent.start, this.B(0)): + * ids[j] = i + * j += 1 # <<<<<<<<<<<<<< + * if j >= 6: + * break +*/ + __pyx_v_j = (__pyx_v_j + 1); + + /* "_state.pxd":123 + * ids[j] = i + * j += 1 + * if j >= 6: # <<<<<<<<<<<<<< + * break + * else: +*/ + __pyx_t_1 = (__pyx_v_j >= 6); + if (__pyx_t_1) { + + /* "_state.pxd":124 + * j += 1 + * if j >= 6: + * break # <<<<<<<<<<<<<< + * else: + * # TODO error =/ +*/ + goto __pyx_L14_break; + + /* "_state.pxd":123 + * ids[j] = i + * j += 1 + * if j >= 6: # <<<<<<<<<<<<<< + * break + * else: +*/ + } + } + __pyx_L14_break:; + + /* "_state.pxd":117 + * if this.B(0) >= 0: + * ids[0] = this.B(0) + * if this.entity_is_open(): # <<<<<<<<<<<<<< + * ent = this.get_ent() + * j = 1 +*/ + } + + /* "_state.pxd":112 + * ids[11] = this.R(this.S(1), 1) + * ids[12] = this.R(this.S(1), 2) + * elif n == 6: # <<<<<<<<<<<<<< + * for i in range(6): + * ids[i] = -1 +*/ + break; + default: + break; + } + + /* "_state.pxd":128 + * # TODO error =/ + * pass + * for i in range(n): # <<<<<<<<<<<<<< + * if ids[i] >= 0: + * ids[i] += this.offset +*/ + __pyx_t_3 = __pyx_v_n; + __pyx_t_4 = __pyx_t_3; + for (__pyx_t_5 = 0; __pyx_t_5 < __pyx_t_4; __pyx_t_5+=1) { + __pyx_v_i = __pyx_t_5; + + /* "_state.pxd":129 + * pass + * for i in range(n): + * if ids[i] >= 0: # <<<<<<<<<<<<<< + * ids[i] += this.offset + * else: +*/ + __pyx_t_1 = ((__pyx_v_ids[__pyx_v_i]) >= 0); + if (__pyx_t_1) { + + /* "_state.pxd":130 + * for i in range(n): + * if ids[i] >= 0: + * ids[i] += this.offset # <<<<<<<<<<<<<< + * else: + * ids[i] = -1 +*/ + __pyx_t_6 = __pyx_v_i; + (__pyx_v_ids[__pyx_t_6]) = ((__pyx_v_ids[__pyx_t_6]) + this->offset); + + /* "_state.pxd":129 + * pass + * for i in range(n): + * if ids[i] >= 0: # <<<<<<<<<<<<<< + * ids[i] += this.offset + * else: +*/ + goto __pyx_L18; + } + + /* "_state.pxd":132 + * ids[i] += this.offset + * else: + * ids[i] = -1 # <<<<<<<<<<<<<< + * + * inline int S(int i) noexcept nogil const: +*/ + /*else*/ { + (__pyx_v_ids[__pyx_v_i]) = -1; + } + __pyx_L18:; + } + + /* "_state.pxd":63 + * free(this._heads) + * + * inline void set_context_tokens(int* ids, int n) noexcept nogil: # <<<<<<<<<<<<<< + * cdef int i, j + * if n == 1: +*/ + + /* function exit code */ +} + +/* "_state.pxd":134 + * ids[i] = -1 + * + * inline int S(int i) noexcept nogil const: # <<<<<<<<<<<<<< + * if i >= this._stack.size(): + * return -1 +*/ + +int __pyx_t_5spacy_8pipeline_17_parser_internals_6_state_StateC::S(int __pyx_v_i) const { + int __pyx_r; + int __pyx_t_1; + __Pyx_FakeReference __pyx_t_2; + int __pyx_lineno = 0; + const char *__pyx_filename = NULL; + int __pyx_clineno = 0; + PyGILState_STATE __pyx_gilstate_save; + + /* "_state.pxd":135 + * + * inline int S(int i) noexcept nogil const: + * if i >= this._stack.size(): # <<<<<<<<<<<<<< + * return -1 + * elif i < 0: +*/ + __pyx_t_1 = (__pyx_v_i >= this->_stack.size()); + if (__pyx_t_1) { + + /* "_state.pxd":136 + * inline int S(int i) noexcept nogil const: + * if i >= this._stack.size(): + * return -1 # <<<<<<<<<<<<<< + * elif i < 0: + * return -1 +*/ + __pyx_r = -1; + goto __pyx_L0; + + /* "_state.pxd":135 + * + * inline int S(int i) noexcept nogil const: + * if i >= this._stack.size(): # <<<<<<<<<<<<<< + * return -1 + * elif i < 0: +*/ + } + + /* "_state.pxd":137 + * if i >= this._stack.size(): + * return -1 + * elif i < 0: # <<<<<<<<<<<<<< + * return -1 + * return this._stack.at(this._stack.size() - (i+1)) +*/ + __pyx_t_1 = (__pyx_v_i < 0); + if (__pyx_t_1) { + + /* "_state.pxd":138 + * return -1 + * elif i < 0: + * return -1 # <<<<<<<<<<<<<< + * return this._stack.at(this._stack.size() - (i+1)) + * +*/ + __pyx_r = -1; + goto __pyx_L0; + + /* "_state.pxd":137 + * if i >= this._stack.size(): + * return -1 + * elif i < 0: # <<<<<<<<<<<<<< + * return -1 + * return this._stack.at(this._stack.size() - (i+1)) +*/ + } + + /* "_state.pxd":139 + * elif i < 0: + * return -1 + * return this._stack.at(this._stack.size() - (i+1)) # <<<<<<<<<<<<<< + * + * inline int B(int i) noexcept nogil const: +*/ + try { + __pyx_t_2 = this->_stack.at((this->_stack.size() - (__pyx_v_i + 1))); + } catch(...) { + PyGILState_STATE __pyx_gilstate_save = __Pyx_PyGILState_Ensure(); + __Pyx_CppExn2PyErr(); + __Pyx_PyGILState_Release(__pyx_gilstate_save); + __PYX_ERR(4, 139, __pyx_L1_error) + } + __pyx_r = __pyx_t_2; + goto __pyx_L0; + + /* "_state.pxd":134 + * ids[i] = -1 + * + * inline int S(int i) noexcept nogil const: # <<<<<<<<<<<<<< + * if i >= this._stack.size(): + * return -1 +*/ + + /* function exit code */ + __pyx_L1_error:; + __pyx_gilstate_save = __Pyx_PyGILState_Ensure(); + __Pyx_WriteUnraisable("StateC.S", __pyx_clineno, __pyx_lineno, __pyx_filename, 1, 0); + __pyx_r = 0; + __Pyx_PyGILState_Release(__pyx_gilstate_save); + __pyx_L0:; + return __pyx_r; +} + +/* "_state.pxd":141 + * return this._stack.at(this._stack.size() - (i+1)) + * + * inline int B(int i) noexcept nogil const: # <<<<<<<<<<<<<< + * if i < 0: + * return -1 +*/ + +int __pyx_t_5spacy_8pipeline_17_parser_internals_6_state_StateC::B(int __pyx_v_i) const { + std::vector ::size_type __pyx_v_b_i; + int __pyx_r; + int __pyx_t_1; + __Pyx_FakeReference __pyx_t_2; + int __pyx_lineno = 0; + const char *__pyx_filename = NULL; + int __pyx_clineno = 0; + PyGILState_STATE __pyx_gilstate_save; + + /* "_state.pxd":142 + * + * inline int B(int i) noexcept nogil const: + * if i < 0: # <<<<<<<<<<<<<< + * return -1 + * elif i < this._rebuffer.size(): +*/ + __pyx_t_1 = (__pyx_v_i < 0); + if (__pyx_t_1) { + + /* "_state.pxd":143 + * inline int B(int i) noexcept nogil const: + * if i < 0: + * return -1 # <<<<<<<<<<<<<< + * elif i < this._rebuffer.size(): + * return this._rebuffer.at(this._rebuffer.size() - (i+1)) +*/ + __pyx_r = -1; + goto __pyx_L0; + + /* "_state.pxd":142 + * + * inline int B(int i) noexcept nogil const: + * if i < 0: # <<<<<<<<<<<<<< + * return -1 + * elif i < this._rebuffer.size(): +*/ + } + + /* "_state.pxd":144 + * if i < 0: + * return -1 + * elif i < this._rebuffer.size(): # <<<<<<<<<<<<<< + * return this._rebuffer.at(this._rebuffer.size() - (i+1)) + * else: +*/ + __pyx_t_1 = (__pyx_v_i < this->_rebuffer.size()); + if (__pyx_t_1) { + + /* "_state.pxd":145 + * return -1 + * elif i < this._rebuffer.size(): + * return this._rebuffer.at(this._rebuffer.size() - (i+1)) # <<<<<<<<<<<<<< + * else: + * b_i = this._b_i + (i - this._rebuffer.size()) +*/ + try { + __pyx_t_2 = this->_rebuffer.at((this->_rebuffer.size() - (__pyx_v_i + 1))); + } catch(...) { + PyGILState_STATE __pyx_gilstate_save = __Pyx_PyGILState_Ensure(); + __Pyx_CppExn2PyErr(); + __Pyx_PyGILState_Release(__pyx_gilstate_save); + __PYX_ERR(4, 145, __pyx_L1_error) + } + __pyx_r = __pyx_t_2; + goto __pyx_L0; + + /* "_state.pxd":144 + * if i < 0: + * return -1 + * elif i < this._rebuffer.size(): # <<<<<<<<<<<<<< + * return this._rebuffer.at(this._rebuffer.size() - (i+1)) + * else: +*/ + } + + /* "_state.pxd":147 + * return this._rebuffer.at(this._rebuffer.size() - (i+1)) + * else: + * b_i = this._b_i + (i - this._rebuffer.size()) # <<<<<<<<<<<<<< + * if b_i >= this.length: + * return -1 +*/ + /*else*/ { + __pyx_v_b_i = (this->_b_i + (__pyx_v_i - this->_rebuffer.size())); + + /* "_state.pxd":148 + * else: + * b_i = this._b_i + (i - this._rebuffer.size()) + * if b_i >= this.length: # <<<<<<<<<<<<<< + * return -1 + * else: +*/ + __pyx_t_1 = (__pyx_v_b_i >= this->length); + if (__pyx_t_1) { + + /* "_state.pxd":149 + * b_i = this._b_i + (i - this._rebuffer.size()) + * if b_i >= this.length: + * return -1 # <<<<<<<<<<<<<< + * else: + * return b_i +*/ + __pyx_r = -1; + goto __pyx_L0; + + /* "_state.pxd":148 + * else: + * b_i = this._b_i + (i - this._rebuffer.size()) + * if b_i >= this.length: # <<<<<<<<<<<<<< + * return -1 + * else: +*/ + } + + /* "_state.pxd":151 + * return -1 + * else: + * return b_i # <<<<<<<<<<<<<< + * + * inline const TokenC* B_(int i) noexcept nogil const: +*/ + /*else*/ { + __pyx_r = __pyx_v_b_i; + goto __pyx_L0; + } + } + + /* "_state.pxd":141 + * return this._stack.at(this._stack.size() - (i+1)) + * + * inline int B(int i) noexcept nogil const: # <<<<<<<<<<<<<< + * if i < 0: + * return -1 +*/ + + /* function exit code */ + __pyx_L1_error:; + __pyx_gilstate_save = __Pyx_PyGILState_Ensure(); + __Pyx_WriteUnraisable("StateC.B", __pyx_clineno, __pyx_lineno, __pyx_filename, 1, 0); + __pyx_r = 0; + __Pyx_PyGILState_Release(__pyx_gilstate_save); + __pyx_L0:; + return __pyx_r; +} + +/* "_state.pxd":153 + * return b_i + * + * inline const TokenC* B_(int i) noexcept nogil const: # <<<<<<<<<<<<<< + * return this.safe_get(this.B(i)) + * +*/ + +struct __pyx_t_5spacy_7structs_TokenC const *__pyx_t_5spacy_8pipeline_17_parser_internals_6_state_StateC::B_(int __pyx_v_i) const { + struct __pyx_t_5spacy_7structs_TokenC const *__pyx_r; + + /* "_state.pxd":154 + * + * inline const TokenC* B_(int i) noexcept nogil const: + * return this.safe_get(this.B(i)) # <<<<<<<<<<<<<< + * + * inline const TokenC* E_(int i) noexcept nogil const: +*/ + __pyx_r = this->safe_get(this->B(__pyx_v_i)); + goto __pyx_L0; + + /* "_state.pxd":153 + * return b_i + * + * inline const TokenC* B_(int i) noexcept nogil const: # <<<<<<<<<<<<<< + * return this.safe_get(this.B(i)) + * +*/ + + /* function exit code */ + __pyx_L0:; + return __pyx_r; +} + +/* "_state.pxd":156 + * return this.safe_get(this.B(i)) + * + * inline const TokenC* E_(int i) noexcept nogil const: # <<<<<<<<<<<<<< + * return this.safe_get(this.E(i)) + * +*/ + +struct __pyx_t_5spacy_7structs_TokenC const *__pyx_t_5spacy_8pipeline_17_parser_internals_6_state_StateC::E_(int __pyx_v_i) const { + struct __pyx_t_5spacy_7structs_TokenC const *__pyx_r; + + /* "_state.pxd":157 + * + * inline const TokenC* E_(int i) noexcept nogil const: + * return this.safe_get(this.E(i)) # <<<<<<<<<<<<<< + * + * inline const TokenC* safe_get(int i) noexcept nogil const: +*/ + __pyx_r = this->safe_get(this->E(__pyx_v_i)); + goto __pyx_L0; + + /* "_state.pxd":156 + * return this.safe_get(this.B(i)) + * + * inline const TokenC* E_(int i) noexcept nogil const: # <<<<<<<<<<<<<< + * return this.safe_get(this.E(i)) + * +*/ + + /* function exit code */ + __pyx_L0:; + return __pyx_r; +} + +/* "_state.pxd":159 + * return this.safe_get(this.E(i)) + * + * inline const TokenC* safe_get(int i) noexcept nogil const: # <<<<<<<<<<<<<< + * if i < 0 or i >= this.length: + * return &this._empty_token +*/ + +struct __pyx_t_5spacy_7structs_TokenC const *__pyx_t_5spacy_8pipeline_17_parser_internals_6_state_StateC::safe_get(int __pyx_v_i) const { + struct __pyx_t_5spacy_7structs_TokenC const *__pyx_r; + int __pyx_t_1; + int __pyx_t_2; + + /* "_state.pxd":160 + * + * inline const TokenC* safe_get(int i) noexcept nogil const: + * if i < 0 or i >= this.length: # <<<<<<<<<<<<<< + * return &this._empty_token + * else: +*/ + __pyx_t_2 = (__pyx_v_i < 0); + if (!__pyx_t_2) { + } else { + __pyx_t_1 = __pyx_t_2; + goto __pyx_L4_bool_binop_done; + } + __pyx_t_2 = (__pyx_v_i >= this->length); + __pyx_t_1 = __pyx_t_2; + __pyx_L4_bool_binop_done:; + if (__pyx_t_1) { + + /* "_state.pxd":161 + * inline const TokenC* safe_get(int i) noexcept nogil const: + * if i < 0 or i >= this.length: + * return &this._empty_token # <<<<<<<<<<<<<< + * else: + * return &this._sent[i] +*/ + __pyx_r = (&this->_empty_token); + goto __pyx_L0; + + /* "_state.pxd":160 + * + * inline const TokenC* safe_get(int i) noexcept nogil const: + * if i < 0 or i >= this.length: # <<<<<<<<<<<<<< + * return &this._empty_token + * else: +*/ + } + + /* "_state.pxd":163 + * return &this._empty_token + * else: + * return &this._sent[i] # <<<<<<<<<<<<<< + * + * inline void map_get_arcs(const unordered_map[int, vector[ArcC]] &heads_arcs, vector[ArcC]* out) noexcept nogil const: +*/ + /*else*/ { + __pyx_r = (&(this->_sent[__pyx_v_i])); + goto __pyx_L0; + } + + /* "_state.pxd":159 + * return this.safe_get(this.E(i)) + * + * inline const TokenC* safe_get(int i) noexcept nogil const: # <<<<<<<<<<<<<< + * if i < 0 or i >= this.length: + * return &this._empty_token +*/ + + /* function exit code */ + __pyx_L0:; + return __pyx_r; +} + +/* "_state.pxd":165 + * return &this._sent[i] + * + * inline void map_get_arcs(const unordered_map[int, vector[ArcC]] &heads_arcs, vector[ArcC]* out) noexcept nogil const: # <<<<<<<<<<<<<< + * cdef const vector[ArcC]* arcs + * head_arcs_it = heads_arcs.const_begin() +*/ + +void __pyx_t_5spacy_8pipeline_17_parser_internals_6_state_StateC::map_get_arcs(std::unordered_map > const &__pyx_v_heads_arcs, std::vector *__pyx_v_out) const { + std::vector const *__pyx_v_arcs; + std::unordered_map > ::const_iterator __pyx_v_head_arcs_it; + std::vector ::const_iterator __pyx_v_arcs_it; + struct __pyx_t_5spacy_8pipeline_17_parser_internals_6_state_ArcC __pyx_v_arc; + int __pyx_t_1; + int __pyx_t_2; + int __pyx_lineno = 0; + const char *__pyx_filename = NULL; + int __pyx_clineno = 0; + PyGILState_STATE __pyx_gilstate_save; + + /* "_state.pxd":167 + * inline void map_get_arcs(const unordered_map[int, vector[ArcC]] &heads_arcs, vector[ArcC]* out) noexcept nogil const: + * cdef const vector[ArcC]* arcs + * head_arcs_it = heads_arcs.const_begin() # <<<<<<<<<<<<<< + * while head_arcs_it != heads_arcs.const_end(): + * arcs = &deref(head_arcs_it).second +*/ + try { + __pyx_v_head_arcs_it = __pyx_v_heads_arcs.begin(); + } catch(...) { + PyGILState_STATE __pyx_gilstate_save = __Pyx_PyGILState_Ensure(); + __Pyx_CppExn2PyErr(); + __Pyx_PyGILState_Release(__pyx_gilstate_save); + __PYX_ERR(4, 167, __pyx_L1_error) + } + + /* "_state.pxd":168 + * cdef const vector[ArcC]* arcs + * head_arcs_it = heads_arcs.const_begin() + * while head_arcs_it != heads_arcs.const_end(): # <<<<<<<<<<<<<< + * arcs = &deref(head_arcs_it).second + * arcs_it = arcs.const_begin() +*/ + while (1) { + __pyx_t_1 = (__pyx_v_head_arcs_it != __pyx_v_heads_arcs.end()); + if (!__pyx_t_1) break; + + /* "_state.pxd":169 + * head_arcs_it = heads_arcs.const_begin() + * while head_arcs_it != heads_arcs.const_end(): + * arcs = &deref(head_arcs_it).second # <<<<<<<<<<<<<< + * arcs_it = arcs.const_begin() + * while arcs_it != arcs.const_end(): +*/ + __pyx_v_arcs = (&(*__pyx_v_head_arcs_it).second); + + /* "_state.pxd":170 + * while head_arcs_it != heads_arcs.const_end(): + * arcs = &deref(head_arcs_it).second + * arcs_it = arcs.const_begin() # <<<<<<<<<<<<<< + * while arcs_it != arcs.const_end(): + * arc = deref(arcs_it) +*/ + try { + __pyx_v_arcs_it = __pyx_v_arcs->begin(); + } catch(...) { + PyGILState_STATE __pyx_gilstate_save = __Pyx_PyGILState_Ensure(); + __Pyx_CppExn2PyErr(); + __Pyx_PyGILState_Release(__pyx_gilstate_save); + __PYX_ERR(4, 170, __pyx_L1_error) + } + + /* "_state.pxd":171 + * arcs = &deref(head_arcs_it).second + * arcs_it = arcs.const_begin() + * while arcs_it != arcs.const_end(): # <<<<<<<<<<<<<< + * arc = deref(arcs_it) + * if arc.head != -1 and arc.child != -1: +*/ + while (1) { + __pyx_t_1 = (__pyx_v_arcs_it != __pyx_v_arcs->end()); + if (!__pyx_t_1) break; + + /* "_state.pxd":172 + * arcs_it = arcs.const_begin() + * while arcs_it != arcs.const_end(): + * arc = deref(arcs_it) # <<<<<<<<<<<<<< + * if arc.head != -1 and arc.child != -1: + * out.push_back(arc) +*/ + __pyx_v_arc = (*__pyx_v_arcs_it); + + /* "_state.pxd":173 + * while arcs_it != arcs.const_end(): + * arc = deref(arcs_it) + * if arc.head != -1 and arc.child != -1: # <<<<<<<<<<<<<< + * out.push_back(arc) + * incr(arcs_it) +*/ + __pyx_t_2 = (__pyx_v_arc.head != -1L); + if (__pyx_t_2) { + } else { + __pyx_t_1 = __pyx_t_2; + goto __pyx_L8_bool_binop_done; + } + __pyx_t_2 = (__pyx_v_arc.child != -1L); + __pyx_t_1 = __pyx_t_2; + __pyx_L8_bool_binop_done:; + if (__pyx_t_1) { + + /* "_state.pxd":174 + * arc = deref(arcs_it) + * if arc.head != -1 and arc.child != -1: + * out.push_back(arc) # <<<<<<<<<<<<<< + * incr(arcs_it) + * incr(head_arcs_it) +*/ + try { + __pyx_v_out->push_back(__pyx_v_arc); + } catch(...) { + PyGILState_STATE __pyx_gilstate_save = __Pyx_PyGILState_Ensure(); + __Pyx_CppExn2PyErr(); + __Pyx_PyGILState_Release(__pyx_gilstate_save); + __PYX_ERR(4, 174, __pyx_L1_error) + } + + /* "_state.pxd":173 + * while arcs_it != arcs.const_end(): + * arc = deref(arcs_it) + * if arc.head != -1 and arc.child != -1: # <<<<<<<<<<<<<< + * out.push_back(arc) + * incr(arcs_it) +*/ + } + + /* "_state.pxd":175 + * if arc.head != -1 and arc.child != -1: + * out.push_back(arc) + * incr(arcs_it) # <<<<<<<<<<<<<< + * incr(head_arcs_it) + * +*/ + (void)((++__pyx_v_arcs_it)); + } + + /* "_state.pxd":176 + * out.push_back(arc) + * incr(arcs_it) + * incr(head_arcs_it) # <<<<<<<<<<<<<< + * + * inline void get_arcs(vector[ArcC]* out) noexcept nogil const: +*/ + (void)((++__pyx_v_head_arcs_it)); + } + + /* "_state.pxd":165 + * return &this._sent[i] + * + * inline void map_get_arcs(const unordered_map[int, vector[ArcC]] &heads_arcs, vector[ArcC]* out) noexcept nogil const: # <<<<<<<<<<<<<< + * cdef const vector[ArcC]* arcs + * head_arcs_it = heads_arcs.const_begin() +*/ + + /* function exit code */ + goto __pyx_L0; + __pyx_L1_error:; + __pyx_gilstate_save = __Pyx_PyGILState_Ensure(); + __Pyx_WriteUnraisable("StateC.map_get_arcs", __pyx_clineno, __pyx_lineno, __pyx_filename, 1, 0); + __Pyx_PyGILState_Release(__pyx_gilstate_save); + __pyx_L0:; +} + +/* "_state.pxd":178 + * incr(head_arcs_it) + * + * inline void get_arcs(vector[ArcC]* out) noexcept nogil const: # <<<<<<<<<<<<<< + * this.map_get_arcs(this._left_arcs, out) + * this.map_get_arcs(this._right_arcs, out) +*/ + +void __pyx_t_5spacy_8pipeline_17_parser_internals_6_state_StateC::get_arcs(std::vector *__pyx_v_out) const { + + /* "_state.pxd":179 + * + * inline void get_arcs(vector[ArcC]* out) noexcept nogil const: + * this.map_get_arcs(this._left_arcs, out) # <<<<<<<<<<<<<< + * this.map_get_arcs(this._right_arcs, out) + * +*/ + this->map_get_arcs(this->_left_arcs, __pyx_v_out); + + /* "_state.pxd":180 + * inline void get_arcs(vector[ArcC]* out) noexcept nogil const: + * this.map_get_arcs(this._left_arcs, out) + * this.map_get_arcs(this._right_arcs, out) # <<<<<<<<<<<<<< + * + * inline int H(int child) noexcept nogil const: +*/ + this->map_get_arcs(this->_right_arcs, __pyx_v_out); + + /* "_state.pxd":178 + * incr(head_arcs_it) + * + * inline void get_arcs(vector[ArcC]* out) noexcept nogil const: # <<<<<<<<<<<<<< + * this.map_get_arcs(this._left_arcs, out) + * this.map_get_arcs(this._right_arcs, out) +*/ + + /* function exit code */ +} + +/* "_state.pxd":182 + * this.map_get_arcs(this._right_arcs, out) + * + * inline int H(int child) noexcept nogil const: # <<<<<<<<<<<<<< + * if child >= this.length or child < 0: + * return -1 +*/ + +int __pyx_t_5spacy_8pipeline_17_parser_internals_6_state_StateC::H(int __pyx_v_child) const { + int __pyx_r; + int __pyx_t_1; + int __pyx_t_2; + + /* "_state.pxd":183 + * + * inline int H(int child) noexcept nogil const: + * if child >= this.length or child < 0: # <<<<<<<<<<<<<< + * return -1 + * else: +*/ + __pyx_t_2 = (__pyx_v_child >= this->length); + if (!__pyx_t_2) { + } else { + __pyx_t_1 = __pyx_t_2; + goto __pyx_L4_bool_binop_done; + } + __pyx_t_2 = (__pyx_v_child < 0); + __pyx_t_1 = __pyx_t_2; + __pyx_L4_bool_binop_done:; + if (__pyx_t_1) { + + /* "_state.pxd":184 + * inline int H(int child) noexcept nogil const: + * if child >= this.length or child < 0: + * return -1 # <<<<<<<<<<<<<< + * else: + * return this._heads[child] +*/ + __pyx_r = -1; + goto __pyx_L0; + + /* "_state.pxd":183 + * + * inline int H(int child) noexcept nogil const: + * if child >= this.length or child < 0: # <<<<<<<<<<<<<< + * return -1 + * else: +*/ + } + + /* "_state.pxd":186 + * return -1 + * else: + * return this._heads[child] # <<<<<<<<<<<<<< + * + * inline int E(int i) noexcept nogil const: +*/ + /*else*/ { + __pyx_r = (this->_heads[__pyx_v_child]); + goto __pyx_L0; + } + + /* "_state.pxd":182 + * this.map_get_arcs(this._right_arcs, out) + * + * inline int H(int child) noexcept nogil const: # <<<<<<<<<<<<<< + * if child >= this.length or child < 0: + * return -1 +*/ + + /* function exit code */ + __pyx_L0:; + return __pyx_r; +} + +/* "_state.pxd":188 + * return this._heads[child] + * + * inline int E(int i) noexcept nogil const: # <<<<<<<<<<<<<< + * if this._ents.size() == 0: + * return -1 +*/ + +int __pyx_t_5spacy_8pipeline_17_parser_internals_6_state_StateC::E(CYTHON_UNUSED int __pyx_v_i) const { + int __pyx_r; + int __pyx_t_1; + + /* "_state.pxd":189 + * + * inline int E(int i) noexcept nogil const: + * if this._ents.size() == 0: # <<<<<<<<<<<<<< + * return -1 + * else: +*/ + __pyx_t_1 = (this->_ents.size() == 0); + if (__pyx_t_1) { + + /* "_state.pxd":190 + * inline int E(int i) noexcept nogil const: + * if this._ents.size() == 0: + * return -1 # <<<<<<<<<<<<<< + * else: + * return this._ents.back().start +*/ + __pyx_r = -1; + goto __pyx_L0; + + /* "_state.pxd":189 + * + * inline int E(int i) noexcept nogil const: + * if this._ents.size() == 0: # <<<<<<<<<<<<<< + * return -1 + * else: +*/ + } + + /* "_state.pxd":192 + * return -1 + * else: + * return this._ents.back().start # <<<<<<<<<<<<<< + * + * inline int nth_child(const unordered_map[int, vector[ArcC]]& heads_arcs, int head, int idx) noexcept nogil const: +*/ + /*else*/ { + __pyx_r = this->_ents.back().start; + goto __pyx_L0; + } + + /* "_state.pxd":188 + * return this._heads[child] + * + * inline int E(int i) noexcept nogil const: # <<<<<<<<<<<<<< + * if this._ents.size() == 0: + * return -1 +*/ + + /* function exit code */ + __pyx_L0:; + return __pyx_r; +} + +/* "_state.pxd":194 + * return this._ents.back().start + * + * inline int nth_child(const unordered_map[int, vector[ArcC]]& heads_arcs, int head, int idx) noexcept nogil const: # <<<<<<<<<<<<<< + * if idx < 1: + * return -1 +*/ + +int __pyx_t_5spacy_8pipeline_17_parser_internals_6_state_StateC::nth_child(std::unordered_map > const &__pyx_v_heads_arcs, int __pyx_v_head, int __pyx_v_idx) const { + std::unordered_map > ::const_iterator __pyx_v_head_arcs_it; + std::vector const *__pyx_v_arcs; + size_t __pyx_v_child_index; + std::vector ::const_reverse_iterator __pyx_v_arcs_it; + struct __pyx_t_5spacy_8pipeline_17_parser_internals_6_state_ArcC __pyx_v_arc; + int __pyx_r; + int __pyx_t_1; + int __pyx_t_2; + int __pyx_lineno = 0; + const char *__pyx_filename = NULL; + int __pyx_clineno = 0; + PyGILState_STATE __pyx_gilstate_save; + + /* "_state.pxd":195 + * + * inline int nth_child(const unordered_map[int, vector[ArcC]]& heads_arcs, int head, int idx) noexcept nogil const: + * if idx < 1: # <<<<<<<<<<<<<< + * return -1 + * +*/ + __pyx_t_1 = (__pyx_v_idx < 1); + if (__pyx_t_1) { + + /* "_state.pxd":196 + * inline int nth_child(const unordered_map[int, vector[ArcC]]& heads_arcs, int head, int idx) noexcept nogil const: + * if idx < 1: + * return -1 # <<<<<<<<<<<<<< + * + * head_arcs_it = heads_arcs.const_find(head) +*/ + __pyx_r = -1; + goto __pyx_L0; + + /* "_state.pxd":195 + * + * inline int nth_child(const unordered_map[int, vector[ArcC]]& heads_arcs, int head, int idx) noexcept nogil const: + * if idx < 1: # <<<<<<<<<<<<<< + * return -1 + * +*/ + } + + /* "_state.pxd":198 + * return -1 + * + * head_arcs_it = heads_arcs.const_find(head) # <<<<<<<<<<<<<< + * if head_arcs_it == heads_arcs.const_end(): + * return -1 +*/ + try { + __pyx_v_head_arcs_it = __pyx_v_heads_arcs.find(__pyx_v_head); + } catch(...) { + PyGILState_STATE __pyx_gilstate_save = __Pyx_PyGILState_Ensure(); + __Pyx_CppExn2PyErr(); + __Pyx_PyGILState_Release(__pyx_gilstate_save); + __PYX_ERR(4, 198, __pyx_L1_error) + } + + /* "_state.pxd":199 + * + * head_arcs_it = heads_arcs.const_find(head) + * if head_arcs_it == heads_arcs.const_end(): # <<<<<<<<<<<<<< + * return -1 + * +*/ + __pyx_t_1 = (__pyx_v_head_arcs_it == __pyx_v_heads_arcs.end()); + if (__pyx_t_1) { + + /* "_state.pxd":200 + * head_arcs_it = heads_arcs.const_find(head) + * if head_arcs_it == heads_arcs.const_end(): + * return -1 # <<<<<<<<<<<<<< + * + * cdef const vector[ArcC]* arcs = &deref(head_arcs_it).second +*/ + __pyx_r = -1; + goto __pyx_L0; + + /* "_state.pxd":199 + * + * head_arcs_it = heads_arcs.const_find(head) + * if head_arcs_it == heads_arcs.const_end(): # <<<<<<<<<<<<<< + * return -1 + * +*/ + } + + /* "_state.pxd":202 + * return -1 + * + * cdef const vector[ArcC]* arcs = &deref(head_arcs_it).second # <<<<<<<<<<<<<< + * + * # Work backwards through arcs to find the arc at the +*/ + __pyx_v_arcs = (&(*__pyx_v_head_arcs_it).second); + + /* "_state.pxd":206 + * # Work backwards through arcs to find the arc at the + * # requested index more quickly. + * cdef size_t child_index = 0 # <<<<<<<<<<<<<< + * arcs_it = arcs.const_rbegin() + * while arcs_it != arcs.const_rend() and child_index != idx: +*/ + __pyx_v_child_index = 0; + + /* "_state.pxd":207 + * # requested index more quickly. + * cdef size_t child_index = 0 + * arcs_it = arcs.const_rbegin() # <<<<<<<<<<<<<< + * while arcs_it != arcs.const_rend() and child_index != idx: + * arc = deref(arcs_it) +*/ + try { + __pyx_v_arcs_it = __pyx_v_arcs->rbegin(); + } catch(...) { + PyGILState_STATE __pyx_gilstate_save = __Pyx_PyGILState_Ensure(); + __Pyx_CppExn2PyErr(); + __Pyx_PyGILState_Release(__pyx_gilstate_save); + __PYX_ERR(4, 207, __pyx_L1_error) + } + + /* "_state.pxd":208 + * cdef size_t child_index = 0 + * arcs_it = arcs.const_rbegin() + * while arcs_it != arcs.const_rend() and child_index != idx: # <<<<<<<<<<<<<< + * arc = deref(arcs_it) + * if arc.child != -1: +*/ + while (1) { + __pyx_t_2 = (__pyx_v_arcs_it != __pyx_v_arcs->rend()); + if (__pyx_t_2) { + } else { + __pyx_t_1 = __pyx_t_2; + goto __pyx_L7_bool_binop_done; + } + __pyx_t_2 = (__pyx_v_child_index != __pyx_v_idx); + __pyx_t_1 = __pyx_t_2; + __pyx_L7_bool_binop_done:; + if (!__pyx_t_1) break; + + /* "_state.pxd":209 + * arcs_it = arcs.const_rbegin() + * while arcs_it != arcs.const_rend() and child_index != idx: + * arc = deref(arcs_it) # <<<<<<<<<<<<<< + * if arc.child != -1: + * child_index += 1 +*/ + __pyx_v_arc = (*__pyx_v_arcs_it); + + /* "_state.pxd":210 + * while arcs_it != arcs.const_rend() and child_index != idx: + * arc = deref(arcs_it) + * if arc.child != -1: # <<<<<<<<<<<<<< + * child_index += 1 + * if child_index == idx: +*/ + __pyx_t_1 = (__pyx_v_arc.child != -1L); + if (__pyx_t_1) { + + /* "_state.pxd":211 + * arc = deref(arcs_it) + * if arc.child != -1: + * child_index += 1 # <<<<<<<<<<<<<< + * if child_index == idx: + * return arc.child +*/ + __pyx_v_child_index = (__pyx_v_child_index + 1); + + /* "_state.pxd":212 + * if arc.child != -1: + * child_index += 1 + * if child_index == idx: # <<<<<<<<<<<<<< + * return arc.child + * incr(arcs_it) +*/ + __pyx_t_1 = (__pyx_v_child_index == __pyx_v_idx); + if (__pyx_t_1) { + + /* "_state.pxd":213 + * child_index += 1 + * if child_index == idx: + * return arc.child # <<<<<<<<<<<<<< + * incr(arcs_it) + * +*/ + __pyx_r = __pyx_v_arc.child; + goto __pyx_L0; + + /* "_state.pxd":212 + * if arc.child != -1: + * child_index += 1 + * if child_index == idx: # <<<<<<<<<<<<<< + * return arc.child + * incr(arcs_it) +*/ + } + + /* "_state.pxd":210 + * while arcs_it != arcs.const_rend() and child_index != idx: + * arc = deref(arcs_it) + * if arc.child != -1: # <<<<<<<<<<<<<< + * child_index += 1 + * if child_index == idx: +*/ + } + + /* "_state.pxd":214 + * if child_index == idx: + * return arc.child + * incr(arcs_it) # <<<<<<<<<<<<<< + * + * return -1 +*/ + (void)((++__pyx_v_arcs_it)); + } + + /* "_state.pxd":216 + * incr(arcs_it) + * + * return -1 # <<<<<<<<<<<<<< + * + * inline int L(int head, int idx) noexcept nogil const: +*/ + __pyx_r = -1; + goto __pyx_L0; + + /* "_state.pxd":194 + * return this._ents.back().start + * + * inline int nth_child(const unordered_map[int, vector[ArcC]]& heads_arcs, int head, int idx) noexcept nogil const: # <<<<<<<<<<<<<< + * if idx < 1: + * return -1 +*/ + + /* function exit code */ + __pyx_L1_error:; + __pyx_gilstate_save = __Pyx_PyGILState_Ensure(); + __Pyx_WriteUnraisable("StateC.nth_child", __pyx_clineno, __pyx_lineno, __pyx_filename, 1, 0); + __pyx_r = 0; + __Pyx_PyGILState_Release(__pyx_gilstate_save); + __pyx_L0:; + return __pyx_r; +} + +/* "_state.pxd":218 + * return -1 + * + * inline int L(int head, int idx) noexcept nogil const: # <<<<<<<<<<<<<< + * return this.nth_child(this._left_arcs, head, idx) + * +*/ + +int __pyx_t_5spacy_8pipeline_17_parser_internals_6_state_StateC::L(int __pyx_v_head, int __pyx_v_idx) const { + int __pyx_r; + + /* "_state.pxd":219 + * + * inline int L(int head, int idx) noexcept nogil const: + * return this.nth_child(this._left_arcs, head, idx) # <<<<<<<<<<<<<< + * + * inline int R(int head, int idx) noexcept nogil const: +*/ + __pyx_r = this->nth_child(this->_left_arcs, __pyx_v_head, __pyx_v_idx); + goto __pyx_L0; + + /* "_state.pxd":218 + * return -1 + * + * inline int L(int head, int idx) noexcept nogil const: # <<<<<<<<<<<<<< + * return this.nth_child(this._left_arcs, head, idx) + * +*/ + + /* function exit code */ + __pyx_L0:; + return __pyx_r; +} + +/* "_state.pxd":221 + * return this.nth_child(this._left_arcs, head, idx) + * + * inline int R(int head, int idx) noexcept nogil const: # <<<<<<<<<<<<<< + * return this.nth_child(this._right_arcs, head, idx) + * +*/ + +int __pyx_t_5spacy_8pipeline_17_parser_internals_6_state_StateC::R(int __pyx_v_head, int __pyx_v_idx) const { + int __pyx_r; + + /* "_state.pxd":222 + * + * inline int R(int head, int idx) noexcept nogil const: + * return this.nth_child(this._right_arcs, head, idx) # <<<<<<<<<<<<<< + * + * inline bint empty() noexcept nogil const: +*/ + __pyx_r = this->nth_child(this->_right_arcs, __pyx_v_head, __pyx_v_idx); + goto __pyx_L0; + + /* "_state.pxd":221 + * return this.nth_child(this._left_arcs, head, idx) + * + * inline int R(int head, int idx) noexcept nogil const: # <<<<<<<<<<<<<< + * return this.nth_child(this._right_arcs, head, idx) + * +*/ + + /* function exit code */ + __pyx_L0:; + return __pyx_r; +} + +/* "_state.pxd":224 + * return this.nth_child(this._right_arcs, head, idx) + * + * inline bint empty() noexcept nogil const: # <<<<<<<<<<<<<< + * return this._stack.size() == 0 + * +*/ + +int __pyx_t_5spacy_8pipeline_17_parser_internals_6_state_StateC::empty(void) const { + int __pyx_r; + + /* "_state.pxd":225 + * + * inline bint empty() noexcept nogil const: + * return this._stack.size() == 0 # <<<<<<<<<<<<<< + * + * inline bint eol() noexcept nogil const: +*/ + __pyx_r = (this->_stack.size() == 0); + goto __pyx_L0; + + /* "_state.pxd":224 + * return this.nth_child(this._right_arcs, head, idx) + * + * inline bint empty() noexcept nogil const: # <<<<<<<<<<<<<< + * return this._stack.size() == 0 + * +*/ + + /* function exit code */ + __pyx_L0:; + return __pyx_r; +} + +/* "_state.pxd":227 + * return this._stack.size() == 0 + * + * inline bint eol() noexcept nogil const: # <<<<<<<<<<<<<< + * return this.buffer_length() == 0 + * +*/ + +int __pyx_t_5spacy_8pipeline_17_parser_internals_6_state_StateC::eol(void) const { + int __pyx_r; + + /* "_state.pxd":228 + * + * inline bint eol() noexcept nogil const: + * return this.buffer_length() == 0 # <<<<<<<<<<<<<< + * + * inline bint is_final() noexcept nogil const: +*/ + __pyx_r = (this->buffer_length() == 0); + goto __pyx_L0; + + /* "_state.pxd":227 + * return this._stack.size() == 0 + * + * inline bint eol() noexcept nogil const: # <<<<<<<<<<<<<< + * return this.buffer_length() == 0 + * +*/ + + /* function exit code */ + __pyx_L0:; + return __pyx_r; +} + +/* "_state.pxd":230 + * return this.buffer_length() == 0 + * + * inline bint is_final() noexcept nogil const: # <<<<<<<<<<<<<< + * return this.stack_depth() <= 0 and this.eol() + * +*/ + +int __pyx_t_5spacy_8pipeline_17_parser_internals_6_state_StateC::is_final(void) const { + int __pyx_r; + int __pyx_t_1; + int __pyx_t_2; + + /* "_state.pxd":231 + * + * inline bint is_final() noexcept nogil const: + * return this.stack_depth() <= 0 and this.eol() # <<<<<<<<<<<<<< + * + * inline int cannot_sent_start(int word) noexcept nogil const: +*/ + __pyx_t_2 = (this->stack_depth() <= 0); + if (__pyx_t_2) { + } else { + __pyx_t_1 = __pyx_t_2; + goto __pyx_L3_bool_binop_done; + } + __pyx_t_2 = this->eol(); + __pyx_t_1 = __pyx_t_2; + __pyx_L3_bool_binop_done:; + __pyx_r = __pyx_t_1; + goto __pyx_L0; + + /* "_state.pxd":230 + * return this.buffer_length() == 0 + * + * inline bint is_final() noexcept nogil const: # <<<<<<<<<<<<<< + * return this.stack_depth() <= 0 and this.eol() + * +*/ + + /* function exit code */ + __pyx_L0:; + return __pyx_r; +} + +/* "_state.pxd":233 + * return this.stack_depth() <= 0 and this.eol() + * + * inline int cannot_sent_start(int word) noexcept nogil const: # <<<<<<<<<<<<<< + * if word < 0 or word >= this.length: + * return 0 +*/ + +int __pyx_t_5spacy_8pipeline_17_parser_internals_6_state_StateC::cannot_sent_start(int __pyx_v_word) const { + int __pyx_r; + int __pyx_t_1; + int __pyx_t_2; + + /* "_state.pxd":234 + * + * inline int cannot_sent_start(int word) noexcept nogil const: + * if word < 0 or word >= this.length: # <<<<<<<<<<<<<< + * return 0 + * elif this._sent[word].sent_start == -1: +*/ + __pyx_t_2 = (__pyx_v_word < 0); + if (!__pyx_t_2) { + } else { + __pyx_t_1 = __pyx_t_2; + goto __pyx_L4_bool_binop_done; + } + __pyx_t_2 = (__pyx_v_word >= this->length); + __pyx_t_1 = __pyx_t_2; + __pyx_L4_bool_binop_done:; + if (__pyx_t_1) { + + /* "_state.pxd":235 + * inline int cannot_sent_start(int word) noexcept nogil const: + * if word < 0 or word >= this.length: + * return 0 # <<<<<<<<<<<<<< + * elif this._sent[word].sent_start == -1: + * return 1 +*/ + __pyx_r = 0; + goto __pyx_L0; + + /* "_state.pxd":234 + * + * inline int cannot_sent_start(int word) noexcept nogil const: + * if word < 0 or word >= this.length: # <<<<<<<<<<<<<< + * return 0 + * elif this._sent[word].sent_start == -1: +*/ + } + + /* "_state.pxd":236 + * if word < 0 or word >= this.length: + * return 0 + * elif this._sent[word].sent_start == -1: # <<<<<<<<<<<<<< + * return 1 + * else: +*/ + __pyx_t_1 = ((this->_sent[__pyx_v_word]).sent_start == -1L); + if (__pyx_t_1) { + + /* "_state.pxd":237 + * return 0 + * elif this._sent[word].sent_start == -1: + * return 1 # <<<<<<<<<<<<<< + * else: + * return 0 +*/ + __pyx_r = 1; + goto __pyx_L0; + + /* "_state.pxd":236 + * if word < 0 or word >= this.length: + * return 0 + * elif this._sent[word].sent_start == -1: # <<<<<<<<<<<<<< + * return 1 + * else: +*/ + } + + /* "_state.pxd":239 + * return 1 + * else: + * return 0 # <<<<<<<<<<<<<< + * + * inline int is_sent_start(int word) noexcept nogil const: +*/ + /*else*/ { + __pyx_r = 0; + goto __pyx_L0; + } + + /* "_state.pxd":233 + * return this.stack_depth() <= 0 and this.eol() + * + * inline int cannot_sent_start(int word) noexcept nogil const: # <<<<<<<<<<<<<< + * if word < 0 or word >= this.length: + * return 0 +*/ + + /* function exit code */ + __pyx_L0:; + return __pyx_r; +} + +/* "_state.pxd":241 + * return 0 + * + * inline int is_sent_start(int word) noexcept nogil const: # <<<<<<<<<<<<<< + * if word < 0 or word >= this.length: + * return 0 +*/ + +int __pyx_t_5spacy_8pipeline_17_parser_internals_6_state_StateC::is_sent_start(int __pyx_v_word) const { + int __pyx_r; + int __pyx_t_1; + int __pyx_t_2; + + /* "_state.pxd":242 + * + * inline int is_sent_start(int word) noexcept nogil const: + * if word < 0 or word >= this.length: # <<<<<<<<<<<<<< + * return 0 + * elif this._sent[word].sent_start == 1: +*/ + __pyx_t_2 = (__pyx_v_word < 0); + if (!__pyx_t_2) { + } else { + __pyx_t_1 = __pyx_t_2; + goto __pyx_L4_bool_binop_done; + } + __pyx_t_2 = (__pyx_v_word >= this->length); + __pyx_t_1 = __pyx_t_2; + __pyx_L4_bool_binop_done:; + if (__pyx_t_1) { + + /* "_state.pxd":243 + * inline int is_sent_start(int word) noexcept nogil const: + * if word < 0 or word >= this.length: + * return 0 # <<<<<<<<<<<<<< + * elif this._sent[word].sent_start == 1: + * return 1 +*/ + __pyx_r = 0; + goto __pyx_L0; + + /* "_state.pxd":242 + * + * inline int is_sent_start(int word) noexcept nogil const: + * if word < 0 or word >= this.length: # <<<<<<<<<<<<<< + * return 0 + * elif this._sent[word].sent_start == 1: +*/ + } + + /* "_state.pxd":244 + * if word < 0 or word >= this.length: + * return 0 + * elif this._sent[word].sent_start == 1: # <<<<<<<<<<<<<< + * return 1 + * elif this._sent_starts.count(word) >= 1: +*/ + __pyx_t_1 = ((this->_sent[__pyx_v_word]).sent_start == 1); + if (__pyx_t_1) { + + /* "_state.pxd":245 + * return 0 + * elif this._sent[word].sent_start == 1: + * return 1 # <<<<<<<<<<<<<< + * elif this._sent_starts.count(word) >= 1: + * return 1 +*/ + __pyx_r = 1; + goto __pyx_L0; + + /* "_state.pxd":244 + * if word < 0 or word >= this.length: + * return 0 + * elif this._sent[word].sent_start == 1: # <<<<<<<<<<<<<< + * return 1 + * elif this._sent_starts.count(word) >= 1: +*/ + } + + /* "_state.pxd":246 + * elif this._sent[word].sent_start == 1: + * return 1 + * elif this._sent_starts.count(word) >= 1: # <<<<<<<<<<<<<< + * return 1 + * else: +*/ + __pyx_t_1 = (this->_sent_starts.count(__pyx_v_word) >= 1); + if (__pyx_t_1) { + + /* "_state.pxd":247 + * return 1 + * elif this._sent_starts.count(word) >= 1: + * return 1 # <<<<<<<<<<<<<< + * else: + * return 0 +*/ + __pyx_r = 1; + goto __pyx_L0; + + /* "_state.pxd":246 + * elif this._sent[word].sent_start == 1: + * return 1 + * elif this._sent_starts.count(word) >= 1: # <<<<<<<<<<<<<< + * return 1 + * else: +*/ + } + + /* "_state.pxd":249 + * return 1 + * else: + * return 0 # <<<<<<<<<<<<<< + * + * inline void set_sent_start(int word, int value) noexcept nogil: +*/ + /*else*/ { + __pyx_r = 0; + goto __pyx_L0; + } + + /* "_state.pxd":241 + * return 0 + * + * inline int is_sent_start(int word) noexcept nogil const: # <<<<<<<<<<<<<< + * if word < 0 or word >= this.length: + * return 0 +*/ + + /* function exit code */ + __pyx_L0:; + return __pyx_r; +} + +/* "_state.pxd":251 + * return 0 + * + * inline void set_sent_start(int word, int value) noexcept nogil: # <<<<<<<<<<<<<< + * if value >= 1: + * this._sent_starts.insert(word) +*/ + +void __pyx_t_5spacy_8pipeline_17_parser_internals_6_state_StateC::set_sent_start(int __pyx_v_word, int __pyx_v_value) { + int __pyx_t_1; + int __pyx_lineno = 0; + const char *__pyx_filename = NULL; + int __pyx_clineno = 0; + PyGILState_STATE __pyx_gilstate_save; + + /* "_state.pxd":252 + * + * inline void set_sent_start(int word, int value) noexcept nogil: + * if value >= 1: # <<<<<<<<<<<<<< + * this._sent_starts.insert(word) + * +*/ + __pyx_t_1 = (__pyx_v_value >= 1); + if (__pyx_t_1) { + + /* "_state.pxd":253 + * inline void set_sent_start(int word, int value) noexcept nogil: + * if value >= 1: + * this._sent_starts.insert(word) # <<<<<<<<<<<<<< + * + * inline bint has_head(int child) noexcept nogil const: +*/ + try { + this->_sent_starts.insert(__pyx_v_word); + } catch(...) { + PyGILState_STATE __pyx_gilstate_save = __Pyx_PyGILState_Ensure(); + __Pyx_CppExn2PyErr(); + __Pyx_PyGILState_Release(__pyx_gilstate_save); + __PYX_ERR(4, 253, __pyx_L1_error) + } + + /* "_state.pxd":252 + * + * inline void set_sent_start(int word, int value) noexcept nogil: + * if value >= 1: # <<<<<<<<<<<<<< + * this._sent_starts.insert(word) + * +*/ + } + + /* "_state.pxd":251 + * return 0 + * + * inline void set_sent_start(int word, int value) noexcept nogil: # <<<<<<<<<<<<<< + * if value >= 1: + * this._sent_starts.insert(word) +*/ + + /* function exit code */ + goto __pyx_L0; + __pyx_L1_error:; + __pyx_gilstate_save = __Pyx_PyGILState_Ensure(); + __Pyx_WriteUnraisable("StateC.set_sent_start", __pyx_clineno, __pyx_lineno, __pyx_filename, 1, 0); + __Pyx_PyGILState_Release(__pyx_gilstate_save); + __pyx_L0:; +} + +/* "_state.pxd":255 + * this._sent_starts.insert(word) + * + * inline bint has_head(int child) noexcept nogil const: # <<<<<<<<<<<<<< + * return this._heads[child] >= 0 + * +*/ + +int __pyx_t_5spacy_8pipeline_17_parser_internals_6_state_StateC::has_head(int __pyx_v_child) const { + int __pyx_r; + + /* "_state.pxd":256 + * + * inline bint has_head(int child) noexcept nogil const: + * return this._heads[child] >= 0 # <<<<<<<<<<<<<< + * + * inline int l_edge(int word) noexcept nogil const: +*/ + __pyx_r = ((this->_heads[__pyx_v_child]) >= 0); + goto __pyx_L0; + + /* "_state.pxd":255 + * this._sent_starts.insert(word) + * + * inline bint has_head(int child) noexcept nogil const: # <<<<<<<<<<<<<< + * return this._heads[child] >= 0 + * +*/ + + /* function exit code */ + __pyx_L0:; + return __pyx_r; +} + +/* "_state.pxd":258 + * return this._heads[child] >= 0 + * + * inline int l_edge(int word) noexcept nogil const: # <<<<<<<<<<<<<< + * return word + * +*/ + +int __pyx_t_5spacy_8pipeline_17_parser_internals_6_state_StateC::l_edge(int __pyx_v_word) const { + int __pyx_r; + + /* "_state.pxd":259 + * + * inline int l_edge(int word) noexcept nogil const: + * return word # <<<<<<<<<<<<<< + * + * inline int r_edge(int word) noexcept nogil const: +*/ + __pyx_r = __pyx_v_word; + goto __pyx_L0; + + /* "_state.pxd":258 + * return this._heads[child] >= 0 + * + * inline int l_edge(int word) noexcept nogil const: # <<<<<<<<<<<<<< + * return word + * +*/ + + /* function exit code */ + __pyx_L0:; + return __pyx_r; +} + +/* "_state.pxd":261 + * return word + * + * inline int r_edge(int word) noexcept nogil const: # <<<<<<<<<<<<<< + * return word + * +*/ + +int __pyx_t_5spacy_8pipeline_17_parser_internals_6_state_StateC::r_edge(int __pyx_v_word) const { + int __pyx_r; + + /* "_state.pxd":262 + * + * inline int r_edge(int word) noexcept nogil const: + * return word # <<<<<<<<<<<<<< + * + * inline int n_arcs(const unordered_map[int, vector[ArcC]] &heads_arcs, int head) noexcept nogil const: +*/ + __pyx_r = __pyx_v_word; + goto __pyx_L0; + + /* "_state.pxd":261 + * return word + * + * inline int r_edge(int word) noexcept nogil const: # <<<<<<<<<<<<<< + * return word + * +*/ + + /* function exit code */ + __pyx_L0:; + return __pyx_r; +} + +/* "_state.pxd":264 + * return word + * + * inline int n_arcs(const unordered_map[int, vector[ArcC]] &heads_arcs, int head) noexcept nogil const: # <<<<<<<<<<<<<< + * cdef int n = 0 + * head_arcs_it = heads_arcs.const_find(head) +*/ + +int __pyx_t_5spacy_8pipeline_17_parser_internals_6_state_StateC::n_arcs(std::unordered_map > const &__pyx_v_heads_arcs, int __pyx_v_head) const { + int __pyx_v_n; + std::unordered_map > ::const_iterator __pyx_v_head_arcs_it; + std::vector const *__pyx_v_arcs; + std::vector ::const_iterator __pyx_v_arcs_it; + struct __pyx_t_5spacy_8pipeline_17_parser_internals_6_state_ArcC __pyx_v_arc; + int __pyx_r; + int __pyx_t_1; + int __pyx_lineno = 0; + const char *__pyx_filename = NULL; + int __pyx_clineno = 0; + PyGILState_STATE __pyx_gilstate_save; + + /* "_state.pxd":265 + * + * inline int n_arcs(const unordered_map[int, vector[ArcC]] &heads_arcs, int head) noexcept nogil const: + * cdef int n = 0 # <<<<<<<<<<<<<< + * head_arcs_it = heads_arcs.const_find(head) + * if head_arcs_it == heads_arcs.const_end(): +*/ + __pyx_v_n = 0; + + /* "_state.pxd":266 + * inline int n_arcs(const unordered_map[int, vector[ArcC]] &heads_arcs, int head) noexcept nogil const: + * cdef int n = 0 + * head_arcs_it = heads_arcs.const_find(head) # <<<<<<<<<<<<<< + * if head_arcs_it == heads_arcs.const_end(): + * return n +*/ + try { + __pyx_v_head_arcs_it = __pyx_v_heads_arcs.find(__pyx_v_head); + } catch(...) { + PyGILState_STATE __pyx_gilstate_save = __Pyx_PyGILState_Ensure(); + __Pyx_CppExn2PyErr(); + __Pyx_PyGILState_Release(__pyx_gilstate_save); + __PYX_ERR(4, 266, __pyx_L1_error) + } + + /* "_state.pxd":267 + * cdef int n = 0 + * head_arcs_it = heads_arcs.const_find(head) + * if head_arcs_it == heads_arcs.const_end(): # <<<<<<<<<<<<<< + * return n + * +*/ + __pyx_t_1 = (__pyx_v_head_arcs_it == __pyx_v_heads_arcs.end()); + if (__pyx_t_1) { + + /* "_state.pxd":268 + * head_arcs_it = heads_arcs.const_find(head) + * if head_arcs_it == heads_arcs.const_end(): + * return n # <<<<<<<<<<<<<< + * + * cdef const vector[ArcC]* arcs = &deref(head_arcs_it).second +*/ + __pyx_r = __pyx_v_n; + goto __pyx_L0; + + /* "_state.pxd":267 + * cdef int n = 0 + * head_arcs_it = heads_arcs.const_find(head) + * if head_arcs_it == heads_arcs.const_end(): # <<<<<<<<<<<<<< + * return n + * +*/ + } + + /* "_state.pxd":270 + * return n + * + * cdef const vector[ArcC]* arcs = &deref(head_arcs_it).second # <<<<<<<<<<<<<< + * arcs_it = arcs.const_begin() + * while arcs_it != arcs.end(): +*/ + __pyx_v_arcs = (&(*__pyx_v_head_arcs_it).second); + + /* "_state.pxd":271 + * + * cdef const vector[ArcC]* arcs = &deref(head_arcs_it).second + * arcs_it = arcs.const_begin() # <<<<<<<<<<<<<< + * while arcs_it != arcs.end(): + * arc = deref(arcs_it) +*/ + try { + __pyx_v_arcs_it = __pyx_v_arcs->begin(); + } catch(...) { + PyGILState_STATE __pyx_gilstate_save = __Pyx_PyGILState_Ensure(); + __Pyx_CppExn2PyErr(); + __Pyx_PyGILState_Release(__pyx_gilstate_save); + __PYX_ERR(4, 271, __pyx_L1_error) + } + + /* "_state.pxd":272 + * cdef const vector[ArcC]* arcs = &deref(head_arcs_it).second + * arcs_it = arcs.const_begin() + * while arcs_it != arcs.end(): # <<<<<<<<<<<<<< + * arc = deref(arcs_it) + * if arc.child != -1: +*/ + while (1) { + __pyx_t_1 = (__pyx_v_arcs_it != __pyx_v_arcs->end()); + if (!__pyx_t_1) break; + + /* "_state.pxd":273 + * arcs_it = arcs.const_begin() + * while arcs_it != arcs.end(): + * arc = deref(arcs_it) # <<<<<<<<<<<<<< + * if arc.child != -1: + * n += 1 +*/ + __pyx_v_arc = (*__pyx_v_arcs_it); + + /* "_state.pxd":274 + * while arcs_it != arcs.end(): + * arc = deref(arcs_it) + * if arc.child != -1: # <<<<<<<<<<<<<< + * n += 1 + * incr(arcs_it) +*/ + __pyx_t_1 = (__pyx_v_arc.child != -1L); + if (__pyx_t_1) { + + /* "_state.pxd":275 + * arc = deref(arcs_it) + * if arc.child != -1: + * n += 1 # <<<<<<<<<<<<<< + * incr(arcs_it) + * +*/ + __pyx_v_n = (__pyx_v_n + 1); + + /* "_state.pxd":274 + * while arcs_it != arcs.end(): + * arc = deref(arcs_it) + * if arc.child != -1: # <<<<<<<<<<<<<< + * n += 1 + * incr(arcs_it) +*/ + } + + /* "_state.pxd":276 + * if arc.child != -1: + * n += 1 + * incr(arcs_it) # <<<<<<<<<<<<<< + * + * return n +*/ + (void)((++__pyx_v_arcs_it)); + } + + /* "_state.pxd":278 + * incr(arcs_it) + * + * return n # <<<<<<<<<<<<<< + * + * inline int n_L(int head) noexcept nogil const: +*/ + __pyx_r = __pyx_v_n; + goto __pyx_L0; + + /* "_state.pxd":264 + * return word + * + * inline int n_arcs(const unordered_map[int, vector[ArcC]] &heads_arcs, int head) noexcept nogil const: # <<<<<<<<<<<<<< + * cdef int n = 0 + * head_arcs_it = heads_arcs.const_find(head) +*/ + + /* function exit code */ + __pyx_L1_error:; + __pyx_gilstate_save = __Pyx_PyGILState_Ensure(); + __Pyx_WriteUnraisable("StateC.n_arcs", __pyx_clineno, __pyx_lineno, __pyx_filename, 1, 0); + __pyx_r = 0; + __Pyx_PyGILState_Release(__pyx_gilstate_save); + __pyx_L0:; + return __pyx_r; +} + +/* "_state.pxd":280 + * return n + * + * inline int n_L(int head) noexcept nogil const: # <<<<<<<<<<<<<< + * return n_arcs(this._left_arcs, head) + * +*/ + +int __pyx_t_5spacy_8pipeline_17_parser_internals_6_state_StateC::n_L(int __pyx_v_head) const { + int __pyx_r; + + /* "_state.pxd":281 + * + * inline int n_L(int head) noexcept nogil const: + * return n_arcs(this._left_arcs, head) # <<<<<<<<<<<<<< + * + * inline int n_R(int head) noexcept nogil const: +*/ + __pyx_r = n_arcs(this->_left_arcs, __pyx_v_head); + goto __pyx_L0; + + /* "_state.pxd":280 + * return n + * + * inline int n_L(int head) noexcept nogil const: # <<<<<<<<<<<<<< + * return n_arcs(this._left_arcs, head) + * +*/ + + /* function exit code */ + __pyx_L0:; + return __pyx_r; +} + +/* "_state.pxd":283 + * return n_arcs(this._left_arcs, head) + * + * inline int n_R(int head) noexcept nogil const: # <<<<<<<<<<<<<< + * return n_arcs(this._right_arcs, head) + * +*/ + +int __pyx_t_5spacy_8pipeline_17_parser_internals_6_state_StateC::n_R(int __pyx_v_head) const { + int __pyx_r; + + /* "_state.pxd":284 + * + * inline int n_R(int head) noexcept nogil const: + * return n_arcs(this._right_arcs, head) # <<<<<<<<<<<<<< + * + * inline bint stack_is_connected() noexcept nogil const: +*/ + __pyx_r = n_arcs(this->_right_arcs, __pyx_v_head); + goto __pyx_L0; + + /* "_state.pxd":283 + * return n_arcs(this._left_arcs, head) + * + * inline int n_R(int head) noexcept nogil const: # <<<<<<<<<<<<<< + * return n_arcs(this._right_arcs, head) + * +*/ + + /* function exit code */ + __pyx_L0:; + return __pyx_r; +} + +/* "_state.pxd":286 + * return n_arcs(this._right_arcs, head) + * + * inline bint stack_is_connected() noexcept nogil const: # <<<<<<<<<<<<<< + * return False + * +*/ + +int __pyx_t_5spacy_8pipeline_17_parser_internals_6_state_StateC::stack_is_connected(void) const { + int __pyx_r; + + /* "_state.pxd":287 + * + * inline bint stack_is_connected() noexcept nogil const: + * return False # <<<<<<<<<<<<<< + * + * inline bint entity_is_open() noexcept nogil const: +*/ + __pyx_r = 0; + goto __pyx_L0; + + /* "_state.pxd":286 + * return n_arcs(this._right_arcs, head) + * + * inline bint stack_is_connected() noexcept nogil const: # <<<<<<<<<<<<<< + * return False + * +*/ + + /* function exit code */ + __pyx_L0:; + return __pyx_r; +} + +/* "_state.pxd":289 + * return False + * + * inline bint entity_is_open() noexcept nogil const: # <<<<<<<<<<<<<< + * if this._ents.size() == 0: + * return False +*/ + +int __pyx_t_5spacy_8pipeline_17_parser_internals_6_state_StateC::entity_is_open(void) const { + int __pyx_r; + int __pyx_t_1; + + /* "_state.pxd":290 + * + * inline bint entity_is_open() noexcept nogil const: + * if this._ents.size() == 0: # <<<<<<<<<<<<<< + * return False + * else: +*/ + __pyx_t_1 = (this->_ents.size() == 0); + if (__pyx_t_1) { + + /* "_state.pxd":291 + * inline bint entity_is_open() noexcept nogil const: + * if this._ents.size() == 0: + * return False # <<<<<<<<<<<<<< + * else: + * return this._ents.back().end == -1 +*/ + __pyx_r = 0; + goto __pyx_L0; + + /* "_state.pxd":290 + * + * inline bint entity_is_open() noexcept nogil const: + * if this._ents.size() == 0: # <<<<<<<<<<<<<< + * return False + * else: +*/ + } + + /* "_state.pxd":293 + * return False + * else: + * return this._ents.back().end == -1 # <<<<<<<<<<<<<< + * + * inline int stack_depth() noexcept nogil const: +*/ + /*else*/ { + __pyx_r = (this->_ents.back().end == -1L); + goto __pyx_L0; + } + + /* "_state.pxd":289 + * return False + * + * inline bint entity_is_open() noexcept nogil const: # <<<<<<<<<<<<<< + * if this._ents.size() == 0: + * return False +*/ + + /* function exit code */ + __pyx_L0:; + return __pyx_r; +} + +/* "_state.pxd":295 + * return this._ents.back().end == -1 + * + * inline int stack_depth() noexcept nogil const: # <<<<<<<<<<<<<< + * return this._stack.size() + * +*/ + +int __pyx_t_5spacy_8pipeline_17_parser_internals_6_state_StateC::stack_depth(void) const { + int __pyx_r; + + /* "_state.pxd":296 + * + * inline int stack_depth() noexcept nogil const: + * return this._stack.size() # <<<<<<<<<<<<<< + * + * inline int buffer_length() noexcept nogil const: +*/ + __pyx_r = this->_stack.size(); + goto __pyx_L0; + + /* "_state.pxd":295 + * return this._ents.back().end == -1 + * + * inline int stack_depth() noexcept nogil const: # <<<<<<<<<<<<<< + * return this._stack.size() + * +*/ + + /* function exit code */ + __pyx_L0:; + return __pyx_r; +} + +/* "_state.pxd":298 + * return this._stack.size() + * + * inline int buffer_length() noexcept nogil const: # <<<<<<<<<<<<<< + * return (this.length - this._b_i) + this._rebuffer.size() + * +*/ + +int __pyx_t_5spacy_8pipeline_17_parser_internals_6_state_StateC::buffer_length(void) const { + int __pyx_r; + + /* "_state.pxd":299 + * + * inline int buffer_length() noexcept nogil const: + * return (this.length - this._b_i) + this._rebuffer.size() # <<<<<<<<<<<<<< + * + * inline void push() noexcept nogil: +*/ + __pyx_r = ((this->length - this->_b_i) + this->_rebuffer.size()); + goto __pyx_L0; + + /* "_state.pxd":298 + * return this._stack.size() + * + * inline int buffer_length() noexcept nogil const: # <<<<<<<<<<<<<< + * return (this.length - this._b_i) + this._rebuffer.size() + * +*/ + + /* function exit code */ + __pyx_L0:; + return __pyx_r; +} + +/* "_state.pxd":301 + * return (this.length - this._b_i) + this._rebuffer.size() + * + * inline void push() noexcept nogil: # <<<<<<<<<<<<<< + * b0 = this.B(0) + * if this._rebuffer.size(): +*/ + +void __pyx_t_5spacy_8pipeline_17_parser_internals_6_state_StateC::push(void) { + int __pyx_v_b0; + int __pyx_t_1; + int __pyx_t_2; + int __pyx_lineno = 0; + const char *__pyx_filename = NULL; + int __pyx_clineno = 0; + PyGILState_STATE __pyx_gilstate_save; + + /* "_state.pxd":302 + * + * inline void push() noexcept nogil: + * b0 = this.B(0) # <<<<<<<<<<<<<< + * if this._rebuffer.size(): + * b0 = this._rebuffer.back() +*/ + __pyx_v_b0 = this->B(0); + + /* "_state.pxd":303 + * inline void push() noexcept nogil: + * b0 = this.B(0) + * if this._rebuffer.size(): # <<<<<<<<<<<<<< + * b0 = this._rebuffer.back() + * this._rebuffer.pop_back() +*/ + __pyx_t_1 = (this->_rebuffer.size() != 0); + if (__pyx_t_1) { + + /* "_state.pxd":304 + * b0 = this.B(0) + * if this._rebuffer.size(): + * b0 = this._rebuffer.back() # <<<<<<<<<<<<<< + * this._rebuffer.pop_back() + * else: +*/ + __pyx_v_b0 = this->_rebuffer.back(); + + /* "_state.pxd":305 + * if this._rebuffer.size(): + * b0 = this._rebuffer.back() + * this._rebuffer.pop_back() # <<<<<<<<<<<<<< + * else: + * b0 = this._b_i +*/ + this->_rebuffer.pop_back(); + + /* "_state.pxd":303 + * inline void push() noexcept nogil: + * b0 = this.B(0) + * if this._rebuffer.size(): # <<<<<<<<<<<<<< + * b0 = this._rebuffer.back() + * this._rebuffer.pop_back() +*/ + goto __pyx_L3; + } + + /* "_state.pxd":307 + * this._rebuffer.pop_back() + * else: + * b0 = this._b_i # <<<<<<<<<<<<<< + * this._b_i += 1 + * this._stack.push_back(b0) +*/ + /*else*/ { + __pyx_t_2 = this->_b_i; + __pyx_v_b0 = __pyx_t_2; + + /* "_state.pxd":308 + * else: + * b0 = this._b_i + * this._b_i += 1 # <<<<<<<<<<<<<< + * this._stack.push_back(b0) + * +*/ + this->_b_i = (this->_b_i + 1); + } + __pyx_L3:; + + /* "_state.pxd":309 + * b0 = this._b_i + * this._b_i += 1 + * this._stack.push_back(b0) # <<<<<<<<<<<<<< + * + * inline void pop() noexcept nogil: +*/ + try { + this->_stack.push_back(__pyx_v_b0); + } catch(...) { + PyGILState_STATE __pyx_gilstate_save = __Pyx_PyGILState_Ensure(); + __Pyx_CppExn2PyErr(); + __Pyx_PyGILState_Release(__pyx_gilstate_save); + __PYX_ERR(4, 309, __pyx_L1_error) + } + + /* "_state.pxd":301 + * return (this.length - this._b_i) + this._rebuffer.size() + * + * inline void push() noexcept nogil: # <<<<<<<<<<<<<< + * b0 = this.B(0) + * if this._rebuffer.size(): +*/ + + /* function exit code */ + goto __pyx_L0; + __pyx_L1_error:; + __pyx_gilstate_save = __Pyx_PyGILState_Ensure(); + __Pyx_WriteUnraisable("StateC.push", __pyx_clineno, __pyx_lineno, __pyx_filename, 1, 0); + __Pyx_PyGILState_Release(__pyx_gilstate_save); + __pyx_L0:; +} + +/* "_state.pxd":311 + * this._stack.push_back(b0) + * + * inline void pop() noexcept nogil: # <<<<<<<<<<<<<< + * this._stack.pop_back() + * +*/ + +void __pyx_t_5spacy_8pipeline_17_parser_internals_6_state_StateC::pop(void) { + + /* "_state.pxd":312 + * + * inline void pop() noexcept nogil: + * this._stack.pop_back() # <<<<<<<<<<<<<< + * + * inline void force_final() noexcept nogil: +*/ + this->_stack.pop_back(); + + /* "_state.pxd":311 + * this._stack.push_back(b0) + * + * inline void pop() noexcept nogil: # <<<<<<<<<<<<<< + * this._stack.pop_back() + * +*/ + + /* function exit code */ +} + +/* "_state.pxd":314 + * this._stack.pop_back() + * + * inline void force_final() noexcept nogil: # <<<<<<<<<<<<<< + * # This should only be used in desperate situations, as it may leave + * # the analysis in an unexpected state. +*/ + +void __pyx_t_5spacy_8pipeline_17_parser_internals_6_state_StateC::force_final(void) { + int __pyx_t_1; + + /* "_state.pxd":317 + * # This should only be used in desperate situations, as it may leave + * # the analysis in an unexpected state. + * this._stack.clear() # <<<<<<<<<<<<<< + * this._b_i = this.length + * +*/ + this->_stack.clear(); + + /* "_state.pxd":318 + * # the analysis in an unexpected state. + * this._stack.clear() + * this._b_i = this.length # <<<<<<<<<<<<<< + * + * inline void unshift() noexcept nogil: +*/ + __pyx_t_1 = this->length; + this->_b_i = __pyx_t_1; + + /* "_state.pxd":314 + * this._stack.pop_back() + * + * inline void force_final() noexcept nogil: # <<<<<<<<<<<<<< + * # This should only be used in desperate situations, as it may leave + * # the analysis in an unexpected state. +*/ + + /* function exit code */ +} + +/* "_state.pxd":320 + * this._b_i = this.length + * + * inline void unshift() noexcept nogil: # <<<<<<<<<<<<<< + * s0 = this._stack.back() + * this._unshiftable[s0] = 1 +*/ + +void __pyx_t_5spacy_8pipeline_17_parser_internals_6_state_StateC::unshift(void) { + int __pyx_v_s0; + int __pyx_lineno = 0; + const char *__pyx_filename = NULL; + int __pyx_clineno = 0; + PyGILState_STATE __pyx_gilstate_save; + + /* "_state.pxd":321 + * + * inline void unshift() noexcept nogil: + * s0 = this._stack.back() # <<<<<<<<<<<<<< + * this._unshiftable[s0] = 1 + * this._rebuffer.push_back(s0) +*/ + __pyx_v_s0 = this->_stack.back(); + + /* "_state.pxd":322 + * inline void unshift() noexcept nogil: + * s0 = this._stack.back() + * this._unshiftable[s0] = 1 # <<<<<<<<<<<<<< + * this._rebuffer.push_back(s0) + * this._stack.pop_back() +*/ + (this->_unshiftable[__pyx_v_s0]) = 1; + + /* "_state.pxd":323 + * s0 = this._stack.back() + * this._unshiftable[s0] = 1 + * this._rebuffer.push_back(s0) # <<<<<<<<<<<<<< + * this._stack.pop_back() + * +*/ + try { + this->_rebuffer.push_back(__pyx_v_s0); + } catch(...) { + PyGILState_STATE __pyx_gilstate_save = __Pyx_PyGILState_Ensure(); + __Pyx_CppExn2PyErr(); + __Pyx_PyGILState_Release(__pyx_gilstate_save); + __PYX_ERR(4, 323, __pyx_L1_error) + } + + /* "_state.pxd":324 + * this._unshiftable[s0] = 1 + * this._rebuffer.push_back(s0) + * this._stack.pop_back() # <<<<<<<<<<<<<< + * + * inline int is_unshiftable(int item) noexcept nogil const: +*/ + this->_stack.pop_back(); + + /* "_state.pxd":320 + * this._b_i = this.length + * + * inline void unshift() noexcept nogil: # <<<<<<<<<<<<<< + * s0 = this._stack.back() + * this._unshiftable[s0] = 1 +*/ + + /* function exit code */ + goto __pyx_L0; + __pyx_L1_error:; + __pyx_gilstate_save = __Pyx_PyGILState_Ensure(); + __Pyx_WriteUnraisable("StateC.unshift", __pyx_clineno, __pyx_lineno, __pyx_filename, 1, 0); + __Pyx_PyGILState_Release(__pyx_gilstate_save); + __pyx_L0:; +} + +/* "_state.pxd":326 + * this._stack.pop_back() + * + * inline int is_unshiftable(int item) noexcept nogil const: # <<<<<<<<<<<<<< + * if item >= this._unshiftable.size(): + * return 0 +*/ + +int __pyx_t_5spacy_8pipeline_17_parser_internals_6_state_StateC::is_unshiftable(int __pyx_v_item) const { + int __pyx_r; + int __pyx_t_1; + bool __pyx_t_2; + int __pyx_lineno = 0; + const char *__pyx_filename = NULL; + int __pyx_clineno = 0; + PyGILState_STATE __pyx_gilstate_save; + + /* "_state.pxd":327 + * + * inline int is_unshiftable(int item) noexcept nogil const: + * if item >= this._unshiftable.size(): # <<<<<<<<<<<<<< + * return 0 + * else: +*/ + __pyx_t_1 = (__pyx_v_item >= this->_unshiftable.size()); + if (__pyx_t_1) { + + /* "_state.pxd":328 + * inline int is_unshiftable(int item) noexcept nogil const: + * if item >= this._unshiftable.size(): + * return 0 # <<<<<<<<<<<<<< + * else: + * return this._unshiftable.at(item) +*/ + __pyx_r = 0; + goto __pyx_L0; + + /* "_state.pxd":327 + * + * inline int is_unshiftable(int item) noexcept nogil const: + * if item >= this._unshiftable.size(): # <<<<<<<<<<<<<< + * return 0 + * else: +*/ + } + + /* "_state.pxd":330 + * return 0 + * else: + * return this._unshiftable.at(item) # <<<<<<<<<<<<<< + * + * inline void set_reshiftable(int item) noexcept nogil: +*/ + /*else*/ { + try { + __pyx_t_2 = this->_unshiftable.at(__pyx_v_item); + } catch(...) { + PyGILState_STATE __pyx_gilstate_save = __Pyx_PyGILState_Ensure(); + __Pyx_CppExn2PyErr(); + __Pyx_PyGILState_Release(__pyx_gilstate_save); + __PYX_ERR(4, 330, __pyx_L1_error) + } + __pyx_r = __pyx_t_2; + goto __pyx_L0; + } + + /* "_state.pxd":326 + * this._stack.pop_back() + * + * inline int is_unshiftable(int item) noexcept nogil const: # <<<<<<<<<<<<<< + * if item >= this._unshiftable.size(): + * return 0 +*/ + + /* function exit code */ + __pyx_L1_error:; + __pyx_gilstate_save = __Pyx_PyGILState_Ensure(); + __Pyx_WriteUnraisable("StateC.is_unshiftable", __pyx_clineno, __pyx_lineno, __pyx_filename, 1, 0); + __pyx_r = 0; + __Pyx_PyGILState_Release(__pyx_gilstate_save); + __pyx_L0:; + return __pyx_r; +} + +/* "_state.pxd":332 + * return this._unshiftable.at(item) + * + * inline void set_reshiftable(int item) noexcept nogil: # <<<<<<<<<<<<<< + * if item < this._unshiftable.size(): + * this._unshiftable[item] = 0 +*/ + +void __pyx_t_5spacy_8pipeline_17_parser_internals_6_state_StateC::set_reshiftable(int __pyx_v_item) { + int __pyx_t_1; + + /* "_state.pxd":333 + * + * inline void set_reshiftable(int item) noexcept nogil: + * if item < this._unshiftable.size(): # <<<<<<<<<<<<<< + * this._unshiftable[item] = 0 + * +*/ + __pyx_t_1 = (__pyx_v_item < this->_unshiftable.size()); + if (__pyx_t_1) { + + /* "_state.pxd":334 + * inline void set_reshiftable(int item) noexcept nogil: + * if item < this._unshiftable.size(): + * this._unshiftable[item] = 0 # <<<<<<<<<<<<<< + * + * inline void add_arc(int head, int child, attr_t label) noexcept nogil: +*/ + (this->_unshiftable[__pyx_v_item]) = 0; + + /* "_state.pxd":333 + * + * inline void set_reshiftable(int item) noexcept nogil: + * if item < this._unshiftable.size(): # <<<<<<<<<<<<<< + * this._unshiftable[item] = 0 + * +*/ + } + + /* "_state.pxd":332 + * return this._unshiftable.at(item) + * + * inline void set_reshiftable(int item) noexcept nogil: # <<<<<<<<<<<<<< + * if item < this._unshiftable.size(): + * this._unshiftable[item] = 0 +*/ + + /* function exit code */ +} + +/* "_state.pxd":336 + * this._unshiftable[item] = 0 + * + * inline void add_arc(int head, int child, attr_t label) noexcept nogil: # <<<<<<<<<<<<<< + * if this.has_head(child): + * this.del_arc(this.H(child), child) +*/ + +void __pyx_t_5spacy_8pipeline_17_parser_internals_6_state_StateC::add_arc(int __pyx_v_head, int __pyx_v_child, __pyx_t_5spacy_8typedefs_attr_t __pyx_v_label) { + struct __pyx_t_5spacy_8pipeline_17_parser_internals_6_state_ArcC __pyx_v_arc; + int __pyx_t_1; + int __pyx_lineno = 0; + const char *__pyx_filename = NULL; + int __pyx_clineno = 0; + PyGILState_STATE __pyx_gilstate_save; + + /* "_state.pxd":337 + * + * inline void add_arc(int head, int child, attr_t label) noexcept nogil: + * if this.has_head(child): # <<<<<<<<<<<<<< + * this.del_arc(this.H(child), child) + * cdef ArcC arc +*/ + __pyx_t_1 = this->has_head(__pyx_v_child); + if (__pyx_t_1) { + + /* "_state.pxd":338 + * inline void add_arc(int head, int child, attr_t label) noexcept nogil: + * if this.has_head(child): + * this.del_arc(this.H(child), child) # <<<<<<<<<<<<<< + * cdef ArcC arc + * arc.head = head +*/ + this->del_arc(this->H(__pyx_v_child), __pyx_v_child); + + /* "_state.pxd":337 + * + * inline void add_arc(int head, int child, attr_t label) noexcept nogil: + * if this.has_head(child): # <<<<<<<<<<<<<< + * this.del_arc(this.H(child), child) + * cdef ArcC arc +*/ + } + + /* "_state.pxd":340 + * this.del_arc(this.H(child), child) + * cdef ArcC arc + * arc.head = head # <<<<<<<<<<<<<< + * arc.child = child + * arc.label = label +*/ + __pyx_v_arc.head = __pyx_v_head; + + /* "_state.pxd":341 + * cdef ArcC arc + * arc.head = head + * arc.child = child # <<<<<<<<<<<<<< + * arc.label = label + * if head > child: +*/ + __pyx_v_arc.child = __pyx_v_child; + + /* "_state.pxd":342 + * arc.head = head + * arc.child = child + * arc.label = label # <<<<<<<<<<<<<< + * if head > child: + * this._left_arcs[arc.head].push_back(arc) +*/ + __pyx_v_arc.label = __pyx_v_label; + + /* "_state.pxd":343 + * arc.child = child + * arc.label = label + * if head > child: # <<<<<<<<<<<<<< + * this._left_arcs[arc.head].push_back(arc) + * else: +*/ + __pyx_t_1 = (__pyx_v_head > __pyx_v_child); + if (__pyx_t_1) { + + /* "_state.pxd":344 + * arc.label = label + * if head > child: + * this._left_arcs[arc.head].push_back(arc) # <<<<<<<<<<<<<< + * else: + * this._right_arcs[arc.head].push_back(arc) +*/ + try { + (this->_left_arcs[__pyx_v_arc.head]).push_back(__pyx_v_arc); + } catch(...) { + PyGILState_STATE __pyx_gilstate_save = __Pyx_PyGILState_Ensure(); + __Pyx_CppExn2PyErr(); + __Pyx_PyGILState_Release(__pyx_gilstate_save); + __PYX_ERR(4, 344, __pyx_L1_error) + } + + /* "_state.pxd":343 + * arc.child = child + * arc.label = label + * if head > child: # <<<<<<<<<<<<<< + * this._left_arcs[arc.head].push_back(arc) + * else: +*/ + goto __pyx_L4; + } + + /* "_state.pxd":346 + * this._left_arcs[arc.head].push_back(arc) + * else: + * this._right_arcs[arc.head].push_back(arc) # <<<<<<<<<<<<<< + * this._heads[child] = head + * +*/ + /*else*/ { + try { + (this->_right_arcs[__pyx_v_arc.head]).push_back(__pyx_v_arc); + } catch(...) { + PyGILState_STATE __pyx_gilstate_save = __Pyx_PyGILState_Ensure(); + __Pyx_CppExn2PyErr(); + __Pyx_PyGILState_Release(__pyx_gilstate_save); + __PYX_ERR(4, 346, __pyx_L1_error) + } + } + __pyx_L4:; + + /* "_state.pxd":347 + * else: + * this._right_arcs[arc.head].push_back(arc) + * this._heads[child] = head # <<<<<<<<<<<<<< + * + * inline void map_del_arc(unordered_map[int, vector[ArcC]]* heads_arcs, int h_i, int c_i) noexcept nogil: +*/ + (this->_heads[__pyx_v_child]) = __pyx_v_head; + + /* "_state.pxd":336 + * this._unshiftable[item] = 0 + * + * inline void add_arc(int head, int child, attr_t label) noexcept nogil: # <<<<<<<<<<<<<< + * if this.has_head(child): + * this.del_arc(this.H(child), child) +*/ + + /* function exit code */ + goto __pyx_L0; + __pyx_L1_error:; + __pyx_gilstate_save = __Pyx_PyGILState_Ensure(); + __Pyx_WriteUnraisable("StateC.add_arc", __pyx_clineno, __pyx_lineno, __pyx_filename, 1, 0); + __Pyx_PyGILState_Release(__pyx_gilstate_save); + __pyx_L0:; +} + +/* "_state.pxd":349 + * this._heads[child] = head + * + * inline void map_del_arc(unordered_map[int, vector[ArcC]]* heads_arcs, int h_i, int c_i) noexcept nogil: # <<<<<<<<<<<<<< + * arcs_it = heads_arcs.find(h_i) + * if arcs_it == heads_arcs.end(): +*/ + +void __pyx_t_5spacy_8pipeline_17_parser_internals_6_state_StateC::map_del_arc(std::unordered_map > *__pyx_v_heads_arcs, int __pyx_v_h_i, int __pyx_v_c_i) { + std::unordered_map > ::iterator __pyx_v_arcs_it; + std::vector *__pyx_v_arcs; + struct __pyx_t_5spacy_8pipeline_17_parser_internals_6_state_ArcC __pyx_v_arc; + std::vector ::size_type __pyx_v_i; + int __pyx_t_1; + int __pyx_t_2; + std::vector ::size_type __pyx_t_3; + std::vector ::size_type __pyx_t_4; + std::vector ::size_type __pyx_t_5; + __Pyx_FakeReference __pyx_t_6; + int __pyx_lineno = 0; + const char *__pyx_filename = NULL; + int __pyx_clineno = 0; + PyGILState_STATE __pyx_gilstate_save; + + /* "_state.pxd":350 + * + * inline void map_del_arc(unordered_map[int, vector[ArcC]]* heads_arcs, int h_i, int c_i) noexcept nogil: + * arcs_it = heads_arcs.find(h_i) # <<<<<<<<<<<<<< + * if arcs_it == heads_arcs.end(): + * return +*/ + __pyx_v_arcs_it = __pyx_v_heads_arcs->find(__pyx_v_h_i); + + /* "_state.pxd":351 + * inline void map_del_arc(unordered_map[int, vector[ArcC]]* heads_arcs, int h_i, int c_i) noexcept nogil: + * arcs_it = heads_arcs.find(h_i) + * if arcs_it == heads_arcs.end(): # <<<<<<<<<<<<<< + * return + * +*/ + __pyx_t_1 = (__pyx_v_arcs_it == __pyx_v_heads_arcs->end()); + if (__pyx_t_1) { + + /* "_state.pxd":352 + * arcs_it = heads_arcs.find(h_i) + * if arcs_it == heads_arcs.end(): + * return # <<<<<<<<<<<<<< + * + * arcs = &deref(arcs_it).second +*/ + goto __pyx_L0; + + /* "_state.pxd":351 + * inline void map_del_arc(unordered_map[int, vector[ArcC]]* heads_arcs, int h_i, int c_i) noexcept nogil: + * arcs_it = heads_arcs.find(h_i) + * if arcs_it == heads_arcs.end(): # <<<<<<<<<<<<<< + * return + * +*/ + } + + /* "_state.pxd":354 + * return + * + * arcs = &deref(arcs_it).second # <<<<<<<<<<<<<< + * if arcs.size() == 0: + * return +*/ + __pyx_v_arcs = (&(*__pyx_v_arcs_it).second); + + /* "_state.pxd":355 + * + * arcs = &deref(arcs_it).second + * if arcs.size() == 0: # <<<<<<<<<<<<<< + * return + * +*/ + __pyx_t_1 = (__pyx_v_arcs->size() == 0); + if (__pyx_t_1) { + + /* "_state.pxd":356 + * arcs = &deref(arcs_it).second + * if arcs.size() == 0: + * return # <<<<<<<<<<<<<< + * + * arc = arcs.back() +*/ + goto __pyx_L0; + + /* "_state.pxd":355 + * + * arcs = &deref(arcs_it).second + * if arcs.size() == 0: # <<<<<<<<<<<<<< + * return + * +*/ + } + + /* "_state.pxd":358 + * return + * + * arc = arcs.back() # <<<<<<<<<<<<<< + * if arc.head == h_i and arc.child == c_i: + * arcs.pop_back() +*/ + __pyx_v_arc = __pyx_v_arcs->back(); + + /* "_state.pxd":359 + * + * arc = arcs.back() + * if arc.head == h_i and arc.child == c_i: # <<<<<<<<<<<<<< + * arcs.pop_back() + * else: +*/ + __pyx_t_2 = (__pyx_v_arc.head == __pyx_v_h_i); + if (__pyx_t_2) { + } else { + __pyx_t_1 = __pyx_t_2; + goto __pyx_L6_bool_binop_done; + } + __pyx_t_2 = (__pyx_v_arc.child == __pyx_v_c_i); + __pyx_t_1 = __pyx_t_2; + __pyx_L6_bool_binop_done:; + if (__pyx_t_1) { + + /* "_state.pxd":360 + * arc = arcs.back() + * if arc.head == h_i and arc.child == c_i: + * arcs.pop_back() # <<<<<<<<<<<<<< + * else: + * for i in range(arcs.size()-1): +*/ + __pyx_v_arcs->pop_back(); + + /* "_state.pxd":359 + * + * arc = arcs.back() + * if arc.head == h_i and arc.child == c_i: # <<<<<<<<<<<<<< + * arcs.pop_back() + * else: +*/ + goto __pyx_L5; + } + + /* "_state.pxd":362 + * arcs.pop_back() + * else: + * for i in range(arcs.size()-1): # <<<<<<<<<<<<<< + * arc = arcs.at(i) + * if arc.head == h_i and arc.child == c_i: +*/ + /*else*/ { + __pyx_t_3 = (__pyx_v_arcs->size() - 1); + __pyx_t_4 = __pyx_t_3; + for (__pyx_t_5 = 0; __pyx_t_5 < __pyx_t_4; __pyx_t_5+=1) { + __pyx_v_i = __pyx_t_5; + + /* "_state.pxd":363 + * else: + * for i in range(arcs.size()-1): + * arc = arcs.at(i) # <<<<<<<<<<<<<< + * if arc.head == h_i and arc.child == c_i: + * arc.head = -1 +*/ + try { + __pyx_t_6 = __pyx_v_arcs->at(__pyx_v_i); + } catch(...) { + PyGILState_STATE __pyx_gilstate_save = __Pyx_PyGILState_Ensure(); + __Pyx_CppExn2PyErr(); + __Pyx_PyGILState_Release(__pyx_gilstate_save); + __PYX_ERR(4, 363, __pyx_L1_error) + } + __pyx_v_arc = __pyx_t_6; + + /* "_state.pxd":364 + * for i in range(arcs.size()-1): + * arc = arcs.at(i) + * if arc.head == h_i and arc.child == c_i: # <<<<<<<<<<<<<< + * arc.head = -1 + * arc.child = -1 +*/ + __pyx_t_2 = (__pyx_v_arc.head == __pyx_v_h_i); + if (__pyx_t_2) { + } else { + __pyx_t_1 = __pyx_t_2; + goto __pyx_L11_bool_binop_done; + } + __pyx_t_2 = (__pyx_v_arc.child == __pyx_v_c_i); + __pyx_t_1 = __pyx_t_2; + __pyx_L11_bool_binop_done:; + if (__pyx_t_1) { + + /* "_state.pxd":365 + * arc = arcs.at(i) + * if arc.head == h_i and arc.child == c_i: + * arc.head = -1 # <<<<<<<<<<<<<< + * arc.child = -1 + * arc.label = 0 +*/ + __pyx_v_arc.head = -1; + + /* "_state.pxd":366 + * if arc.head == h_i and arc.child == c_i: + * arc.head = -1 + * arc.child = -1 # <<<<<<<<<<<<<< + * arc.label = 0 + * break +*/ + __pyx_v_arc.child = -1; + + /* "_state.pxd":367 + * arc.head = -1 + * arc.child = -1 + * arc.label = 0 # <<<<<<<<<<<<<< + * break + * +*/ + __pyx_v_arc.label = 0; + + /* "_state.pxd":368 + * arc.child = -1 + * arc.label = 0 + * break # <<<<<<<<<<<<<< + * + * inline void del_arc(int h_i, int c_i) noexcept nogil: +*/ + goto __pyx_L9_break; + + /* "_state.pxd":364 + * for i in range(arcs.size()-1): + * arc = arcs.at(i) + * if arc.head == h_i and arc.child == c_i: # <<<<<<<<<<<<<< + * arc.head = -1 + * arc.child = -1 +*/ + } + } + __pyx_L9_break:; + } + __pyx_L5:; + + /* "_state.pxd":349 + * this._heads[child] = head + * + * inline void map_del_arc(unordered_map[int, vector[ArcC]]* heads_arcs, int h_i, int c_i) noexcept nogil: # <<<<<<<<<<<<<< + * arcs_it = heads_arcs.find(h_i) + * if arcs_it == heads_arcs.end(): +*/ + + /* function exit code */ + goto __pyx_L0; + __pyx_L1_error:; + __pyx_gilstate_save = __Pyx_PyGILState_Ensure(); + __Pyx_WriteUnraisable("StateC.map_del_arc", __pyx_clineno, __pyx_lineno, __pyx_filename, 1, 0); + __Pyx_PyGILState_Release(__pyx_gilstate_save); + __pyx_L0:; +} + +/* "_state.pxd":370 + * break + * + * inline void del_arc(int h_i, int c_i) noexcept nogil: # <<<<<<<<<<<<<< + * if h_i > c_i: + * this.map_del_arc(&this._left_arcs, h_i, c_i) +*/ + +void __pyx_t_5spacy_8pipeline_17_parser_internals_6_state_StateC::del_arc(int __pyx_v_h_i, int __pyx_v_c_i) { + int __pyx_t_1; + + /* "_state.pxd":371 + * + * inline void del_arc(int h_i, int c_i) noexcept nogil: + * if h_i > c_i: # <<<<<<<<<<<<<< + * this.map_del_arc(&this._left_arcs, h_i, c_i) + * else: +*/ + __pyx_t_1 = (__pyx_v_h_i > __pyx_v_c_i); + if (__pyx_t_1) { + + /* "_state.pxd":372 + * inline void del_arc(int h_i, int c_i) noexcept nogil: + * if h_i > c_i: + * this.map_del_arc(&this._left_arcs, h_i, c_i) # <<<<<<<<<<<<<< + * else: + * this.map_del_arc(&this._right_arcs, h_i, c_i) +*/ + this->map_del_arc((&this->_left_arcs), __pyx_v_h_i, __pyx_v_c_i); + + /* "_state.pxd":371 + * + * inline void del_arc(int h_i, int c_i) noexcept nogil: + * if h_i > c_i: # <<<<<<<<<<<<<< + * this.map_del_arc(&this._left_arcs, h_i, c_i) + * else: +*/ + goto __pyx_L3; + } + + /* "_state.pxd":374 + * this.map_del_arc(&this._left_arcs, h_i, c_i) + * else: + * this.map_del_arc(&this._right_arcs, h_i, c_i) # <<<<<<<<<<<<<< + * + * inline SpanC get_ent() noexcept nogil const: +*/ + /*else*/ { + this->map_del_arc((&this->_right_arcs), __pyx_v_h_i, __pyx_v_c_i); + } + __pyx_L3:; + + /* "_state.pxd":370 + * break + * + * inline void del_arc(int h_i, int c_i) noexcept nogil: # <<<<<<<<<<<<<< + * if h_i > c_i: + * this.map_del_arc(&this._left_arcs, h_i, c_i) +*/ + + /* function exit code */ +} + +/* "_state.pxd":376 + * this.map_del_arc(&this._right_arcs, h_i, c_i) + * + * inline SpanC get_ent() noexcept nogil const: # <<<<<<<<<<<<<< + * cdef SpanC ent + * if this._ents.size() == 0: +*/ + +struct __pyx_t_5spacy_7structs_SpanC __pyx_t_5spacy_8pipeline_17_parser_internals_6_state_StateC::get_ent(void) const { + struct __pyx_t_5spacy_7structs_SpanC __pyx_v_ent; + struct __pyx_t_5spacy_7structs_SpanC __pyx_r; + int __pyx_t_1; + + /* "_state.pxd":378 + * inline SpanC get_ent() noexcept nogil const: + * cdef SpanC ent + * if this._ents.size() == 0: # <<<<<<<<<<<<<< + * ent.start = 0 + * ent.end = 0 +*/ + __pyx_t_1 = (this->_ents.size() == 0); + if (__pyx_t_1) { + + /* "_state.pxd":379 + * cdef SpanC ent + * if this._ents.size() == 0: + * ent.start = 0 # <<<<<<<<<<<<<< + * ent.end = 0 + * ent.label = 0 +*/ + __pyx_v_ent.start = 0; + + /* "_state.pxd":380 + * if this._ents.size() == 0: + * ent.start = 0 + * ent.end = 0 # <<<<<<<<<<<<<< + * ent.label = 0 + * return ent +*/ + __pyx_v_ent.end = 0; + + /* "_state.pxd":381 + * ent.start = 0 + * ent.end = 0 + * ent.label = 0 # <<<<<<<<<<<<<< + * return ent + * else: +*/ + __pyx_v_ent.label = 0; + + /* "_state.pxd":382 + * ent.end = 0 + * ent.label = 0 + * return ent # <<<<<<<<<<<<<< + * else: + * return this._ents.back() +*/ + __pyx_r = __pyx_v_ent; + goto __pyx_L0; + + /* "_state.pxd":378 + * inline SpanC get_ent() noexcept nogil const: + * cdef SpanC ent + * if this._ents.size() == 0: # <<<<<<<<<<<<<< + * ent.start = 0 + * ent.end = 0 +*/ + } + + /* "_state.pxd":384 + * return ent + * else: + * return this._ents.back() # <<<<<<<<<<<<<< + * + * inline void open_ent(attr_t label) noexcept nogil: +*/ + /*else*/ { + __pyx_r = this->_ents.back(); + goto __pyx_L0; + } + + /* "_state.pxd":376 + * this.map_del_arc(&this._right_arcs, h_i, c_i) + * + * inline SpanC get_ent() noexcept nogil const: # <<<<<<<<<<<<<< + * cdef SpanC ent + * if this._ents.size() == 0: +*/ + + /* function exit code */ + __pyx_L0:; + return __pyx_r; +} + +/* "_state.pxd":386 + * return this._ents.back() + * + * inline void open_ent(attr_t label) noexcept nogil: # <<<<<<<<<<<<<< + * cdef SpanC ent + * ent.start = this.B(0) +*/ + +void __pyx_t_5spacy_8pipeline_17_parser_internals_6_state_StateC::open_ent(__pyx_t_5spacy_8typedefs_attr_t __pyx_v_label) { + struct __pyx_t_5spacy_7structs_SpanC __pyx_v_ent; + int __pyx_lineno = 0; + const char *__pyx_filename = NULL; + int __pyx_clineno = 0; + PyGILState_STATE __pyx_gilstate_save; + + /* "_state.pxd":388 + * inline void open_ent(attr_t label) noexcept nogil: + * cdef SpanC ent + * ent.start = this.B(0) # <<<<<<<<<<<<<< + * ent.label = label + * ent.end = -1 +*/ + __pyx_v_ent.start = this->B(0); + + /* "_state.pxd":389 + * cdef SpanC ent + * ent.start = this.B(0) + * ent.label = label # <<<<<<<<<<<<<< + * ent.end = -1 + * this._ents.push_back(ent) +*/ + __pyx_v_ent.label = __pyx_v_label; + + /* "_state.pxd":390 + * ent.start = this.B(0) + * ent.label = label + * ent.end = -1 # <<<<<<<<<<<<<< + * this._ents.push_back(ent) + * +*/ + __pyx_v_ent.end = -1; + + /* "_state.pxd":391 + * ent.label = label + * ent.end = -1 + * this._ents.push_back(ent) # <<<<<<<<<<<<<< + * + * inline void close_ent() noexcept nogil: +*/ + try { + this->_ents.push_back(__pyx_v_ent); + } catch(...) { + PyGILState_STATE __pyx_gilstate_save = __Pyx_PyGILState_Ensure(); + __Pyx_CppExn2PyErr(); + __Pyx_PyGILState_Release(__pyx_gilstate_save); + __PYX_ERR(4, 391, __pyx_L1_error) + } + + /* "_state.pxd":386 + * return this._ents.back() + * + * inline void open_ent(attr_t label) noexcept nogil: # <<<<<<<<<<<<<< + * cdef SpanC ent + * ent.start = this.B(0) +*/ + + /* function exit code */ + goto __pyx_L0; + __pyx_L1_error:; + __pyx_gilstate_save = __Pyx_PyGILState_Ensure(); + __Pyx_WriteUnraisable("StateC.open_ent", __pyx_clineno, __pyx_lineno, __pyx_filename, 1, 0); + __Pyx_PyGILState_Release(__pyx_gilstate_save); + __pyx_L0:; +} + +/* "_state.pxd":393 + * this._ents.push_back(ent) + * + * inline void close_ent() noexcept nogil: # <<<<<<<<<<<<<< + * this._ents.back().end = this.B(0)+1 + * +*/ + +void __pyx_t_5spacy_8pipeline_17_parser_internals_6_state_StateC::close_ent(void) { + + /* "_state.pxd":394 + * + * inline void close_ent() noexcept nogil: + * this._ents.back().end = this.B(0)+1 # <<<<<<<<<<<<<< + * + * inline void clone(const StateC* src) noexcept nogil: +*/ + this->_ents.back().end = (this->B(0) + 1); + + /* "_state.pxd":393 + * this._ents.push_back(ent) + * + * inline void close_ent() noexcept nogil: # <<<<<<<<<<<<<< + * this._ents.back().end = this.B(0)+1 + * +*/ + + /* function exit code */ +} + +/* "_state.pxd":396 + * this._ents.back().end = this.B(0)+1 + * + * inline void clone(const StateC* src) noexcept nogil: # <<<<<<<<<<<<<< + * this.length = src.length + * this._sent = src._sent +*/ + +void __pyx_t_5spacy_8pipeline_17_parser_internals_6_state_StateC::clone(__pyx_t_5spacy_8pipeline_17_parser_internals_6_state_StateC const *__pyx_v_src) { + int __pyx_t_1; + struct __pyx_t_5spacy_7structs_TokenC const *__pyx_t_2; + std::vector __pyx_t_3; + std::set __pyx_t_4; + std::vector __pyx_t_5; + std::vector __pyx_t_6; + std::unordered_map > __pyx_t_7; + struct __pyx_t_5spacy_7structs_TokenC __pyx_t_8; + + /* "_state.pxd":397 + * + * inline void clone(const StateC* src) noexcept nogil: + * this.length = src.length # <<<<<<<<<<<<<< + * this._sent = src._sent + * this._stack = src._stack +*/ + __pyx_t_1 = __pyx_v_src->length; + this->length = __pyx_t_1; + + /* "_state.pxd":398 + * inline void clone(const StateC* src) noexcept nogil: + * this.length = src.length + * this._sent = src._sent # <<<<<<<<<<<<<< + * this._stack = src._stack + * this._rebuffer = src._rebuffer +*/ + __pyx_t_2 = __pyx_v_src->_sent; + this->_sent = __pyx_t_2; + + /* "_state.pxd":399 + * this.length = src.length + * this._sent = src._sent + * this._stack = src._stack # <<<<<<<<<<<<<< + * this._rebuffer = src._rebuffer + * this._sent_starts = src._sent_starts +*/ + __pyx_t_3 = __pyx_v_src->_stack; + this->_stack = __PYX_STD_MOVE_IF_SUPPORTED(__pyx_t_3); + + /* "_state.pxd":400 + * this._sent = src._sent + * this._stack = src._stack + * this._rebuffer = src._rebuffer # <<<<<<<<<<<<<< + * this._sent_starts = src._sent_starts + * this._unshiftable = src._unshiftable +*/ + __pyx_t_3 = __pyx_v_src->_rebuffer; + this->_rebuffer = __PYX_STD_MOVE_IF_SUPPORTED(__pyx_t_3); + + /* "_state.pxd":401 + * this._stack = src._stack + * this._rebuffer = src._rebuffer + * this._sent_starts = src._sent_starts # <<<<<<<<<<<<<< + * this._unshiftable = src._unshiftable + * memcpy(this._heads, src._heads, this.length * sizeof(this._heads[0])) +*/ + __pyx_t_4 = __pyx_v_src->_sent_starts; + this->_sent_starts = __PYX_STD_MOVE_IF_SUPPORTED(__pyx_t_4); + + /* "_state.pxd":402 + * this._rebuffer = src._rebuffer + * this._sent_starts = src._sent_starts + * this._unshiftable = src._unshiftable # <<<<<<<<<<<<<< + * memcpy(this._heads, src._heads, this.length * sizeof(this._heads[0])) + * this._ents = src._ents +*/ + __pyx_t_5 = __pyx_v_src->_unshiftable; + this->_unshiftable = __PYX_STD_MOVE_IF_SUPPORTED(__pyx_t_5); + + /* "_state.pxd":403 + * this._sent_starts = src._sent_starts + * this._unshiftable = src._unshiftable + * memcpy(this._heads, src._heads, this.length * sizeof(this._heads[0])) # <<<<<<<<<<<<<< + * this._ents = src._ents + * this._left_arcs = src._left_arcs +*/ + (void)(memcpy(this->_heads, __pyx_v_src->_heads, (this->length * (sizeof((this->_heads[0])))))); + + /* "_state.pxd":404 + * this._unshiftable = src._unshiftable + * memcpy(this._heads, src._heads, this.length * sizeof(this._heads[0])) + * this._ents = src._ents # <<<<<<<<<<<<<< + * this._left_arcs = src._left_arcs + * this._right_arcs = src._right_arcs +*/ + __pyx_t_6 = __pyx_v_src->_ents; + this->_ents = __PYX_STD_MOVE_IF_SUPPORTED(__pyx_t_6); + + /* "_state.pxd":405 + * memcpy(this._heads, src._heads, this.length * sizeof(this._heads[0])) + * this._ents = src._ents + * this._left_arcs = src._left_arcs # <<<<<<<<<<<<<< + * this._right_arcs = src._right_arcs + * this._b_i = src._b_i +*/ + __pyx_t_7 = __pyx_v_src->_left_arcs; + this->_left_arcs = __PYX_STD_MOVE_IF_SUPPORTED(__pyx_t_7); + + /* "_state.pxd":406 + * this._ents = src._ents + * this._left_arcs = src._left_arcs + * this._right_arcs = src._right_arcs # <<<<<<<<<<<<<< + * this._b_i = src._b_i + * this.offset = src.offset +*/ + __pyx_t_7 = __pyx_v_src->_right_arcs; + this->_right_arcs = __PYX_STD_MOVE_IF_SUPPORTED(__pyx_t_7); + + /* "_state.pxd":407 + * this._left_arcs = src._left_arcs + * this._right_arcs = src._right_arcs + * this._b_i = src._b_i # <<<<<<<<<<<<<< + * this.offset = src.offset + * this._empty_token = src._empty_token +*/ + __pyx_t_1 = __pyx_v_src->_b_i; + this->_b_i = __pyx_t_1; + + /* "_state.pxd":408 + * this._right_arcs = src._right_arcs + * this._b_i = src._b_i + * this.offset = src.offset # <<<<<<<<<<<<<< + * this._empty_token = src._empty_token +*/ + __pyx_t_1 = __pyx_v_src->offset; + this->offset = __pyx_t_1; + + /* "_state.pxd":409 + * this._b_i = src._b_i + * this.offset = src.offset + * this._empty_token = src._empty_token # <<<<<<<<<<<<<< +*/ + __pyx_t_8 = __pyx_v_src->_empty_token; + this->_empty_token = __pyx_t_8; + + /* "_state.pxd":396 + * this._ents.back().end = this.B(0)+1 + * + * inline void clone(const StateC* src) noexcept nogil: # <<<<<<<<<<<<<< + * this.length = src.length + * this._sent = src._sent +*/ + + /* function exit code */ +} + +/* "stateclass.pxd":14 + * cdef int _borrowed + * + * @staticmethod # <<<<<<<<<<<<<< + * cdef inline StateClass borrow(StateC* ptr, Doc doc): + * cdef StateClass self = StateClass() +*/ + +static CYTHON_INLINE struct __pyx_obj_5spacy_8pipeline_17_parser_internals_10stateclass_StateClass *__pyx_f_5spacy_8pipeline_17_parser_internals_10stateclass_10StateClass_borrow(__pyx_t_5spacy_8pipeline_17_parser_internals_6_state_StateC *__pyx_v_ptr, struct __pyx_obj_5spacy_6tokens_3doc_Doc *__pyx_v_doc) { + struct __pyx_obj_5spacy_8pipeline_17_parser_internals_10stateclass_StateClass *__pyx_v_self = 0; + struct __pyx_obj_5spacy_8pipeline_17_parser_internals_10stateclass_StateClass *__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("borrow", 0); + + /* "stateclass.pxd":16 + * @staticmethod + * cdef inline StateClass borrow(StateC* ptr, Doc doc): + * cdef StateClass self = StateClass() # <<<<<<<<<<<<<< + * self.c = ptr + * self._borrowed = 1 +*/ + __pyx_t_2 = NULL; + __pyx_t_3 = 1; + { + PyObject *__pyx_callargs[2] = {__pyx_t_2, NULL}; + __pyx_t_1 = __Pyx_PyObject_FastCall((PyObject*)__pyx_mstate_global->__pyx_ptype_5spacy_8pipeline_17_parser_internals_10stateclass_StateClass, __pyx_callargs+__pyx_t_3, (1-__pyx_t_3) | (__pyx_t_3*__Pyx_PY_VECTORCALL_ARGUMENTS_OFFSET)); + __Pyx_XDECREF(__pyx_t_2); __pyx_t_2 = 0; + if (unlikely(!__pyx_t_1)) __PYX_ERR(5, 16, __pyx_L1_error) + __Pyx_GOTREF((PyObject *)__pyx_t_1); + } + __pyx_v_self = ((struct __pyx_obj_5spacy_8pipeline_17_parser_internals_10stateclass_StateClass *)__pyx_t_1); + __pyx_t_1 = 0; + + /* "stateclass.pxd":17 + * cdef inline StateClass borrow(StateC* ptr, Doc doc): + * cdef StateClass self = StateClass() + * self.c = ptr # <<<<<<<<<<<<<< + * self._borrowed = 1 + * self.doc = doc +*/ + __pyx_v_self->c = __pyx_v_ptr; + + /* "stateclass.pxd":18 + * cdef StateClass self = StateClass() + * self.c = ptr + * self._borrowed = 1 # <<<<<<<<<<<<<< + * self.doc = doc + * return self +*/ + __pyx_v_self->_borrowed = 1; + + /* "stateclass.pxd":19 + * self.c = ptr + * self._borrowed = 1 + * self.doc = doc # <<<<<<<<<<<<<< + * return self + * +*/ + __Pyx_INCREF((PyObject *)__pyx_v_doc); + __Pyx_GIVEREF((PyObject *)__pyx_v_doc); + __Pyx_GOTREF((PyObject *)__pyx_v_self->doc); + __Pyx_DECREF((PyObject *)__pyx_v_self->doc); + __pyx_v_self->doc = __pyx_v_doc; + + /* "stateclass.pxd":20 + * self._borrowed = 1 + * self.doc = doc + * return self # <<<<<<<<<<<<<< + * + * @staticmethod +*/ + __Pyx_XDECREF((PyObject *)__pyx_r); + __Pyx_INCREF((PyObject *)__pyx_v_self); + __pyx_r = __pyx_v_self; + goto __pyx_L0; + + /* "stateclass.pxd":14 + * cdef int _borrowed + * + * @staticmethod # <<<<<<<<<<<<<< + * cdef inline StateClass borrow(StateC* ptr, Doc doc): + * cdef StateClass self = StateClass() +*/ + + /* function exit code */ + __pyx_L1_error:; + __Pyx_XDECREF(__pyx_t_1); + __Pyx_XDECREF(__pyx_t_2); + __Pyx_AddTraceback("spacy.pipeline._parser_internals.stateclass.StateClass.borrow", __pyx_clineno, __pyx_lineno, __pyx_filename); + __pyx_r = 0; + __pyx_L0:; + __Pyx_XDECREF((PyObject *)__pyx_v_self); + __Pyx_XGIVEREF((PyObject *)__pyx_r); + __Pyx_RefNannyFinishContext(); + return __pyx_r; +} + +/* "stateclass.pxd":22 + * return self + * + * @staticmethod # <<<<<<<<<<<<<< + * cdef inline StateClass init_offset(const TokenC* sent, int length, int + * offset): +*/ + +static CYTHON_INLINE struct __pyx_obj_5spacy_8pipeline_17_parser_internals_10stateclass_StateClass *__pyx_f_5spacy_8pipeline_17_parser_internals_10stateclass_10StateClass_init_offset(struct __pyx_t_5spacy_7structs_TokenC const *__pyx_v_sent, int __pyx_v_length, int __pyx_v_offset) { + struct __pyx_obj_5spacy_8pipeline_17_parser_internals_10stateclass_StateClass *__pyx_v_self = 0; + struct __pyx_obj_5spacy_8pipeline_17_parser_internals_10stateclass_StateClass *__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("init_offset", 0); + + /* "stateclass.pxd":25 + * cdef inline StateClass init_offset(const TokenC* sent, int length, int + * offset): + * cdef StateClass self = StateClass() # <<<<<<<<<<<<<< + * self.c = new StateC(sent, length) + * self.c.offset = offset +*/ + __pyx_t_2 = NULL; + __pyx_t_3 = 1; + { + PyObject *__pyx_callargs[2] = {__pyx_t_2, NULL}; + __pyx_t_1 = __Pyx_PyObject_FastCall((PyObject*)__pyx_mstate_global->__pyx_ptype_5spacy_8pipeline_17_parser_internals_10stateclass_StateClass, __pyx_callargs+__pyx_t_3, (1-__pyx_t_3) | (__pyx_t_3*__Pyx_PY_VECTORCALL_ARGUMENTS_OFFSET)); + __Pyx_XDECREF(__pyx_t_2); __pyx_t_2 = 0; + if (unlikely(!__pyx_t_1)) __PYX_ERR(5, 25, __pyx_L1_error) + __Pyx_GOTREF((PyObject *)__pyx_t_1); + } + __pyx_v_self = ((struct __pyx_obj_5spacy_8pipeline_17_parser_internals_10stateclass_StateClass *)__pyx_t_1); + __pyx_t_1 = 0; + + /* "stateclass.pxd":26 + * offset): + * cdef StateClass self = StateClass() + * self.c = new StateC(sent, length) # <<<<<<<<<<<<<< + * self.c.offset = offset + * return self +*/ + __pyx_v_self->c = new __pyx_t_5spacy_8pipeline_17_parser_internals_6_state_StateC(__pyx_v_sent, __pyx_v_length); + + /* "stateclass.pxd":27 + * cdef StateClass self = StateClass() + * self.c = new StateC(sent, length) + * self.c.offset = offset # <<<<<<<<<<<<<< + * return self +*/ + __pyx_v_self->c->offset = __pyx_v_offset; + + /* "stateclass.pxd":28 + * self.c = new StateC(sent, length) + * self.c.offset = offset + * return self # <<<<<<<<<<<<<< +*/ + __Pyx_XDECREF((PyObject *)__pyx_r); + __Pyx_INCREF((PyObject *)__pyx_v_self); + __pyx_r = __pyx_v_self; + goto __pyx_L0; + + /* "stateclass.pxd":22 + * return self + * + * @staticmethod # <<<<<<<<<<<<<< + * cdef inline StateClass init_offset(const TokenC* sent, int length, int + * offset): +*/ + + /* function exit code */ + __pyx_L1_error:; + __Pyx_XDECREF(__pyx_t_1); + __Pyx_XDECREF(__pyx_t_2); + __Pyx_AddTraceback("spacy.pipeline._parser_internals.stateclass.StateClass.init_offset", __pyx_clineno, __pyx_lineno, __pyx_filename); + __pyx_r = 0; + __pyx_L0:; + __Pyx_XDECREF((PyObject *)__pyx_v_self); + __Pyx_XGIVEREF((PyObject *)__pyx_r); + __Pyx_RefNannyFinishContext(); + return __pyx_r; +} + +/* "spacy/pipeline/_parser_internals/_beam_utils.pyx":19 + * + * # These are passed as callbacks to thinc.search.Beam + * cdef int transition_state(void* _dest, void* _src, class_t clas, void* _moves) except -1: # <<<<<<<<<<<<<< + * dest = _dest + * src = _src +*/ + +static int __pyx_f_5spacy_8pipeline_17_parser_internals_11_beam_utils_transition_state(void *__pyx_v__dest, void *__pyx_v__src, __pyx_t_5spacy_8typedefs_class_t __pyx_v_clas, void *__pyx_v__moves) { + __pyx_t_5spacy_8pipeline_17_parser_internals_6_state_StateC *__pyx_v_dest; + __pyx_t_5spacy_8pipeline_17_parser_internals_6_state_StateC *__pyx_v_src; + struct __pyx_t_5spacy_8pipeline_17_parser_internals_17transition_system_Transition const *__pyx_v_moves; + int __pyx_r; + + /* "spacy/pipeline/_parser_internals/_beam_utils.pyx":20 + * # These are passed as callbacks to thinc.search.Beam + * cdef int transition_state(void* _dest, void* _src, class_t clas, void* _moves) except -1: + * dest = _dest # <<<<<<<<<<<<<< + * src = _src + * moves = _moves +*/ + __pyx_v_dest = ((__pyx_t_5spacy_8pipeline_17_parser_internals_6_state_StateC *)__pyx_v__dest); + + /* "spacy/pipeline/_parser_internals/_beam_utils.pyx":21 + * cdef int transition_state(void* _dest, void* _src, class_t clas, void* _moves) except -1: + * dest = _dest + * src = _src # <<<<<<<<<<<<<< + * moves = _moves + * dest.clone(src) +*/ + __pyx_v_src = ((__pyx_t_5spacy_8pipeline_17_parser_internals_6_state_StateC *)__pyx_v__src); + + /* "spacy/pipeline/_parser_internals/_beam_utils.pyx":22 + * dest = _dest + * src = _src + * moves = _moves # <<<<<<<<<<<<<< + * dest.clone(src) + * moves[clas].do(dest, moves[clas].label) +*/ + __pyx_v_moves = ((struct __pyx_t_5spacy_8pipeline_17_parser_internals_17transition_system_Transition const *)__pyx_v__moves); + + /* "spacy/pipeline/_parser_internals/_beam_utils.pyx":23 + * src = _src + * moves = _moves + * dest.clone(src) # <<<<<<<<<<<<<< + * moves[clas].do(dest, moves[clas].label) + * +*/ + __pyx_v_dest->clone(__pyx_v_src); + + /* "spacy/pipeline/_parser_internals/_beam_utils.pyx":24 + * moves = _moves + * dest.clone(src) + * moves[clas].do(dest, moves[clas].label) # <<<<<<<<<<<<<< + * + * +*/ + (void)((__pyx_v_moves[__pyx_v_clas]).__pyx_do(__pyx_v_dest, (__pyx_v_moves[__pyx_v_clas]).label)); + + /* "spacy/pipeline/_parser_internals/_beam_utils.pyx":19 + * + * # These are passed as callbacks to thinc.search.Beam + * cdef int transition_state(void* _dest, void* _src, class_t clas, void* _moves) except -1: # <<<<<<<<<<<<<< + * dest = _dest + * src = _src +*/ + + /* function exit code */ + __pyx_r = 0; + return __pyx_r; +} + +/* "spacy/pipeline/_parser_internals/_beam_utils.pyx":27 + * + * + * cdef int check_final_state(void* _state, void* extra_args) except -1: # <<<<<<<<<<<<<< + * state = _state + * return state.is_final() +*/ + +static int __pyx_f_5spacy_8pipeline_17_parser_internals_11_beam_utils_check_final_state(void *__pyx_v__state, CYTHON_UNUSED void *__pyx_v_extra_args) { + __pyx_t_5spacy_8pipeline_17_parser_internals_6_state_StateC *__pyx_v_state; + int __pyx_r; + + /* "spacy/pipeline/_parser_internals/_beam_utils.pyx":28 + * + * cdef int check_final_state(void* _state, void* extra_args) except -1: + * state = _state # <<<<<<<<<<<<<< + * return state.is_final() + * +*/ + __pyx_v_state = ((__pyx_t_5spacy_8pipeline_17_parser_internals_6_state_StateC *)__pyx_v__state); + + /* "spacy/pipeline/_parser_internals/_beam_utils.pyx":29 + * cdef int check_final_state(void* _state, void* extra_args) except -1: + * state = _state + * return state.is_final() # <<<<<<<<<<<<<< + * + * +*/ + __pyx_r = __pyx_v_state->is_final(); + goto __pyx_L0; + + /* "spacy/pipeline/_parser_internals/_beam_utils.pyx":27 + * + * + * cdef int check_final_state(void* _state, void* extra_args) except -1: # <<<<<<<<<<<<<< + * state = _state + * return state.is_final() +*/ + + /* function exit code */ + __pyx_L0:; + return __pyx_r; +} + +/* "spacy/pipeline/_parser_internals/_beam_utils.pyx":39 + * cdef public object beams + * + * def __init__(self, TransitionSystem moves, states, golds, # <<<<<<<<<<<<<< + * int width, float density=0.): + * cdef StateClass state +*/ + +/* Python wrapper */ +static int __pyx_pw_5spacy_8pipeline_17_parser_internals_11_beam_utils_9BeamBatch_1__init__(PyObject *__pyx_v_self, PyObject *__pyx_args, PyObject *__pyx_kwds); /*proto*/ +static int __pyx_pw_5spacy_8pipeline_17_parser_internals_11_beam_utils_9BeamBatch_1__init__(PyObject *__pyx_v_self, PyObject *__pyx_args, PyObject *__pyx_kwds) { + struct __pyx_obj_5spacy_8pipeline_17_parser_internals_17transition_system_TransitionSystem *__pyx_v_moves = 0; + PyObject *__pyx_v_states = 0; + PyObject *__pyx_v_golds = 0; + int __pyx_v_width; + float __pyx_v_density; + CYTHON_UNUSED Py_ssize_t __pyx_nargs; + CYTHON_UNUSED PyObject *const *__pyx_kwvalues; + PyObject* values[5] = {0,0,0,0,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_moves,&__pyx_mstate_global->__pyx_n_u_states,&__pyx_mstate_global->__pyx_n_u_golds,&__pyx_mstate_global->__pyx_n_u_width,&__pyx_mstate_global->__pyx_n_u_density,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, 39, __pyx_L3_error) + if (__pyx_kwds_len > 0) { + switch (__pyx_nargs) { + case 5: + values[4] = __Pyx_ArgRef_VARARGS(__pyx_args, 4); + if (!CYTHON_ASSUME_SAFE_MACROS && unlikely(!values[4])) __PYX_ERR(0, 39, __pyx_L3_error) + CYTHON_FALLTHROUGH; + case 4: + values[3] = __Pyx_ArgRef_VARARGS(__pyx_args, 3); + if (!CYTHON_ASSUME_SAFE_MACROS && unlikely(!values[3])) __PYX_ERR(0, 39, __pyx_L3_error) + CYTHON_FALLTHROUGH; + case 3: + values[2] = __Pyx_ArgRef_VARARGS(__pyx_args, 2); + if (!CYTHON_ASSUME_SAFE_MACROS && unlikely(!values[2])) __PYX_ERR(0, 39, __pyx_L3_error) + CYTHON_FALLTHROUGH; + case 2: + values[1] = __Pyx_ArgRef_VARARGS(__pyx_args, 1); + if (!CYTHON_ASSUME_SAFE_MACROS && unlikely(!values[1])) __PYX_ERR(0, 39, __pyx_L3_error) + CYTHON_FALLTHROUGH; + case 1: + values[0] = __Pyx_ArgRef_VARARGS(__pyx_args, 0); + if (!CYTHON_ASSUME_SAFE_MACROS && unlikely(!values[0])) __PYX_ERR(0, 39, __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, 39, __pyx_L3_error) + for (Py_ssize_t i = __pyx_nargs; i < 4; i++) { + if (unlikely(!values[i])) { __Pyx_RaiseArgtupleInvalid("__init__", 0, 4, 5, i); __PYX_ERR(0, 39, __pyx_L3_error) } + } + } else { + switch (__pyx_nargs) { + case 5: + values[4] = __Pyx_ArgRef_VARARGS(__pyx_args, 4); + if (!CYTHON_ASSUME_SAFE_MACROS && unlikely(!values[4])) __PYX_ERR(0, 39, __pyx_L3_error) + CYTHON_FALLTHROUGH; + case 4: + values[3] = __Pyx_ArgRef_VARARGS(__pyx_args, 3); + if (!CYTHON_ASSUME_SAFE_MACROS && unlikely(!values[3])) __PYX_ERR(0, 39, __pyx_L3_error) + values[2] = __Pyx_ArgRef_VARARGS(__pyx_args, 2); + if (!CYTHON_ASSUME_SAFE_MACROS && unlikely(!values[2])) __PYX_ERR(0, 39, __pyx_L3_error) + values[1] = __Pyx_ArgRef_VARARGS(__pyx_args, 1); + if (!CYTHON_ASSUME_SAFE_MACROS && unlikely(!values[1])) __PYX_ERR(0, 39, __pyx_L3_error) + values[0] = __Pyx_ArgRef_VARARGS(__pyx_args, 0); + if (!CYTHON_ASSUME_SAFE_MACROS && unlikely(!values[0])) __PYX_ERR(0, 39, __pyx_L3_error) + break; + default: goto __pyx_L5_argtuple_error; + } + } + __pyx_v_moves = ((struct __pyx_obj_5spacy_8pipeline_17_parser_internals_17transition_system_TransitionSystem *)values[0]); + __pyx_v_states = values[1]; + __pyx_v_golds = values[2]; + __pyx_v_width = __Pyx_PyLong_As_int(values[3]); if (unlikely((__pyx_v_width == (int)-1) && PyErr_Occurred())) __PYX_ERR(0, 40, __pyx_L3_error) + if (values[4]) { + __pyx_v_density = __Pyx_PyFloat_AsFloat(values[4]); if (unlikely((__pyx_v_density == (float)-1) && PyErr_Occurred())) __PYX_ERR(0, 40, __pyx_L3_error) + } else { + __pyx_v_density = ((float)0.); + } + } + goto __pyx_L6_skip; + __pyx_L5_argtuple_error:; + __Pyx_RaiseArgtupleInvalid("__init__", 0, 4, 5, __pyx_nargs); __PYX_ERR(0, 39, __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("spacy.pipeline._parser_internals._beam_utils.BeamBatch.__init__", __pyx_clineno, __pyx_lineno, __pyx_filename); + __Pyx_RefNannyFinishContext(); + return -1; + __pyx_L4_argument_unpacking_done:; + if (unlikely(!__Pyx_ArgTypeTest(((PyObject *)__pyx_v_moves), __pyx_mstate_global->__pyx_ptype_5spacy_8pipeline_17_parser_internals_17transition_system_TransitionSystem, 1, "moves", 0))) __PYX_ERR(0, 39, __pyx_L1_error) + __pyx_r = __pyx_pf_5spacy_8pipeline_17_parser_internals_11_beam_utils_9BeamBatch___init__(((struct __pyx_obj_5spacy_8pipeline_17_parser_internals_11_beam_utils_BeamBatch *)__pyx_v_self), __pyx_v_moves, __pyx_v_states, __pyx_v_golds, __pyx_v_width, __pyx_v_density); + + /* 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_5spacy_8pipeline_17_parser_internals_11_beam_utils_9BeamBatch___init__(struct __pyx_obj_5spacy_8pipeline_17_parser_internals_11_beam_utils_BeamBatch *__pyx_v_self, struct __pyx_obj_5spacy_8pipeline_17_parser_internals_17transition_system_TransitionSystem *__pyx_v_moves, PyObject *__pyx_v_states, PyObject *__pyx_v_golds, int __pyx_v_width, float __pyx_v_density) { + struct __pyx_obj_5spacy_8pipeline_17_parser_internals_10stateclass_StateClass *__pyx_v_state = 0; + struct __pyx_obj_5thinc_5extra_6search_Beam *__pyx_v_beam = 0; + __pyx_t_5spacy_8pipeline_17_parser_internals_6_state_StateC *__pyx_v_st; + __pyx_t_5thinc_5extra_6search_class_t __pyx_v_i; + int __pyx_r; + __Pyx_RefNannyDeclarations + PyObject *__pyx_t_1 = NULL; + PyObject *__pyx_t_2 = NULL; + Py_ssize_t __pyx_t_3; + PyObject *(*__pyx_t_4)(PyObject *); + PyObject *__pyx_t_5 = NULL; + PyObject *__pyx_t_6 = NULL; + PyObject *__pyx_t_7 = NULL; + PyObject *__pyx_t_8 = NULL; + size_t __pyx_t_9; + PyObject *__pyx_t_10 = NULL; + int __pyx_t_11; + __pyx_t_5thinc_5extra_6search_class_t __pyx_t_12; + __pyx_t_5thinc_5extra_6search_class_t __pyx_t_13; + __pyx_t_5thinc_5extra_6search_class_t __pyx_t_14; + void *__pyx_t_15; + int __pyx_t_16; + int __pyx_lineno = 0; + const char *__pyx_filename = NULL; + int __pyx_clineno = 0; + __Pyx_RefNannySetupContext("__init__", 0); + + /* "spacy/pipeline/_parser_internals/_beam_utils.pyx":42 + * int width, float density=0.): + * cdef StateClass state + * self.moves = moves # <<<<<<<<<<<<<< + * self.states = states + * self.docs = [state.doc for state in states] +*/ + __Pyx_INCREF((PyObject *)__pyx_v_moves); + __Pyx_GIVEREF((PyObject *)__pyx_v_moves); + __Pyx_GOTREF((PyObject *)__pyx_v_self->moves); + __Pyx_DECREF((PyObject *)__pyx_v_self->moves); + __pyx_v_self->moves = __pyx_v_moves; + + /* "spacy/pipeline/_parser_internals/_beam_utils.pyx":43 + * cdef StateClass state + * self.moves = moves + * self.states = states # <<<<<<<<<<<<<< + * self.docs = [state.doc for state in states] + * self.golds = golds +*/ + __Pyx_INCREF(__pyx_v_states); + __Pyx_GIVEREF(__pyx_v_states); + __Pyx_GOTREF(__pyx_v_self->states); + __Pyx_DECREF(__pyx_v_self->states); + __pyx_v_self->states = __pyx_v_states; + + /* "spacy/pipeline/_parser_internals/_beam_utils.pyx":44 + * self.moves = moves + * self.states = states + * self.docs = [state.doc for state in states] # <<<<<<<<<<<<<< + * self.golds = golds + * self.beams = [] +*/ + __pyx_t_1 = PyList_New(0); if (unlikely(!__pyx_t_1)) __PYX_ERR(0, 44, __pyx_L1_error) + __Pyx_GOTREF(__pyx_t_1); + if (likely(PyList_CheckExact(__pyx_v_states)) || PyTuple_CheckExact(__pyx_v_states)) { + __pyx_t_2 = __pyx_v_states; __Pyx_INCREF(__pyx_t_2); + __pyx_t_3 = 0; + __pyx_t_4 = NULL; + } else { + __pyx_t_3 = -1; __pyx_t_2 = PyObject_GetIter(__pyx_v_states); if (unlikely(!__pyx_t_2)) __PYX_ERR(0, 44, __pyx_L1_error) + __Pyx_GOTREF(__pyx_t_2); + __pyx_t_4 = (CYTHON_COMPILING_IN_LIMITED_API) ? PyIter_Next : __Pyx_PyObject_GetIterNextFunc(__pyx_t_2); if (unlikely(!__pyx_t_4)) __PYX_ERR(0, 44, __pyx_L1_error) + } + for (;;) { + if (likely(!__pyx_t_4)) { + if (likely(PyList_CheckExact(__pyx_t_2))) { + { + Py_ssize_t __pyx_temp = __Pyx_PyList_GET_SIZE(__pyx_t_2); + #if !CYTHON_ASSUME_SAFE_SIZE + if (unlikely((__pyx_temp < 0))) __PYX_ERR(0, 44, __pyx_L1_error) + #endif + if (__pyx_t_3 >= __pyx_temp) break; + } + __pyx_t_5 = __Pyx_PyList_GetItemRefFast(__pyx_t_2, __pyx_t_3, __Pyx_ReferenceSharing_OwnStrongReference); + ++__pyx_t_3; + } else { + { + Py_ssize_t __pyx_temp = __Pyx_PyTuple_GET_SIZE(__pyx_t_2); + #if !CYTHON_ASSUME_SAFE_SIZE + if (unlikely((__pyx_temp < 0))) __PYX_ERR(0, 44, __pyx_L1_error) + #endif + if (__pyx_t_3 >= __pyx_temp) break; + } + #if CYTHON_ASSUME_SAFE_MACROS && !CYTHON_AVOID_BORROWED_REFS + __pyx_t_5 = __Pyx_NewRef(PyTuple_GET_ITEM(__pyx_t_2, __pyx_t_3)); + #else + __pyx_t_5 = __Pyx_PySequence_ITEM(__pyx_t_2, __pyx_t_3); + #endif + ++__pyx_t_3; + } + if (unlikely(!__pyx_t_5)) __PYX_ERR(0, 44, __pyx_L1_error) + } else { + __pyx_t_5 = __pyx_t_4(__pyx_t_2); + if (unlikely(!__pyx_t_5)) { + PyObject* exc_type = PyErr_Occurred(); + if (exc_type) { + if (unlikely(!__Pyx_PyErr_GivenExceptionMatches(exc_type, PyExc_StopIteration))) __PYX_ERR(0, 44, __pyx_L1_error) + PyErr_Clear(); + } + break; + } + } + __Pyx_GOTREF(__pyx_t_5); + if (!(likely(((__pyx_t_5) == Py_None) || likely(__Pyx_TypeTest(__pyx_t_5, __pyx_mstate_global->__pyx_ptype_5spacy_8pipeline_17_parser_internals_10stateclass_StateClass))))) __PYX_ERR(0, 44, __pyx_L1_error) + __Pyx_XDECREF_SET(__pyx_v_state, ((struct __pyx_obj_5spacy_8pipeline_17_parser_internals_10stateclass_StateClass *)__pyx_t_5)); + __pyx_t_5 = 0; + if (unlikely(__Pyx_ListComp_Append(__pyx_t_1, (PyObject*)__pyx_v_state->doc))) __PYX_ERR(0, 44, __pyx_L1_error) + } + __Pyx_DECREF(__pyx_t_2); __pyx_t_2 = 0; + __Pyx_GIVEREF(__pyx_t_1); + __Pyx_GOTREF(__pyx_v_self->docs); + __Pyx_DECREF(__pyx_v_self->docs); + __pyx_v_self->docs = __pyx_t_1; + __pyx_t_1 = 0; + + /* "spacy/pipeline/_parser_internals/_beam_utils.pyx":45 + * self.states = states + * self.docs = [state.doc for state in states] + * self.golds = golds # <<<<<<<<<<<<<< + * self.beams = [] + * cdef Beam beam +*/ + __Pyx_INCREF(__pyx_v_golds); + __Pyx_GIVEREF(__pyx_v_golds); + __Pyx_GOTREF(__pyx_v_self->golds); + __Pyx_DECREF(__pyx_v_self->golds); + __pyx_v_self->golds = __pyx_v_golds; + + /* "spacy/pipeline/_parser_internals/_beam_utils.pyx":46 + * self.docs = [state.doc for state in states] + * self.golds = golds + * self.beams = [] # <<<<<<<<<<<<<< + * cdef Beam beam + * cdef StateC* st +*/ + __pyx_t_1 = PyList_New(0); if (unlikely(!__pyx_t_1)) __PYX_ERR(0, 46, __pyx_L1_error) + __Pyx_GOTREF(__pyx_t_1); + __Pyx_GIVEREF(__pyx_t_1); + __Pyx_GOTREF(__pyx_v_self->beams); + __Pyx_DECREF(__pyx_v_self->beams); + __pyx_v_self->beams = __pyx_t_1; + __pyx_t_1 = 0; + + /* "spacy/pipeline/_parser_internals/_beam_utils.pyx":49 + * cdef Beam beam + * cdef StateC* st + * for state in states: # <<<<<<<<<<<<<< + * beam = Beam(self.moves.n_moves, width, min_density=density) + * beam.initialize(self.moves.init_beam_state, +*/ + if (likely(PyList_CheckExact(__pyx_v_states)) || PyTuple_CheckExact(__pyx_v_states)) { + __pyx_t_1 = __pyx_v_states; __Pyx_INCREF(__pyx_t_1); + __pyx_t_3 = 0; + __pyx_t_4 = NULL; + } else { + __pyx_t_3 = -1; __pyx_t_1 = PyObject_GetIter(__pyx_v_states); if (unlikely(!__pyx_t_1)) __PYX_ERR(0, 49, __pyx_L1_error) + __Pyx_GOTREF(__pyx_t_1); + __pyx_t_4 = (CYTHON_COMPILING_IN_LIMITED_API) ? PyIter_Next : __Pyx_PyObject_GetIterNextFunc(__pyx_t_1); if (unlikely(!__pyx_t_4)) __PYX_ERR(0, 49, __pyx_L1_error) + } + for (;;) { + if (likely(!__pyx_t_4)) { + if (likely(PyList_CheckExact(__pyx_t_1))) { + { + Py_ssize_t __pyx_temp = __Pyx_PyList_GET_SIZE(__pyx_t_1); + #if !CYTHON_ASSUME_SAFE_SIZE + if (unlikely((__pyx_temp < 0))) __PYX_ERR(0, 49, __pyx_L1_error) + #endif + if (__pyx_t_3 >= __pyx_temp) break; + } + __pyx_t_2 = __Pyx_PyList_GetItemRefFast(__pyx_t_1, __pyx_t_3, __Pyx_ReferenceSharing_OwnStrongReference); + ++__pyx_t_3; + } else { + { + Py_ssize_t __pyx_temp = __Pyx_PyTuple_GET_SIZE(__pyx_t_1); + #if !CYTHON_ASSUME_SAFE_SIZE + if (unlikely((__pyx_temp < 0))) __PYX_ERR(0, 49, __pyx_L1_error) + #endif + if (__pyx_t_3 >= __pyx_temp) break; + } + #if CYTHON_ASSUME_SAFE_MACROS && !CYTHON_AVOID_BORROWED_REFS + __pyx_t_2 = __Pyx_NewRef(PyTuple_GET_ITEM(__pyx_t_1, __pyx_t_3)); + #else + __pyx_t_2 = __Pyx_PySequence_ITEM(__pyx_t_1, __pyx_t_3); + #endif + ++__pyx_t_3; + } + if (unlikely(!__pyx_t_2)) __PYX_ERR(0, 49, __pyx_L1_error) + } else { + __pyx_t_2 = __pyx_t_4(__pyx_t_1); + 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, 49, __pyx_L1_error) + PyErr_Clear(); + } + break; + } + } + __Pyx_GOTREF(__pyx_t_2); + if (!(likely(((__pyx_t_2) == Py_None) || likely(__Pyx_TypeTest(__pyx_t_2, __pyx_mstate_global->__pyx_ptype_5spacy_8pipeline_17_parser_internals_10stateclass_StateClass))))) __PYX_ERR(0, 49, __pyx_L1_error) + __Pyx_XDECREF_SET(__pyx_v_state, ((struct __pyx_obj_5spacy_8pipeline_17_parser_internals_10stateclass_StateClass *)__pyx_t_2)); + __pyx_t_2 = 0; + + /* "spacy/pipeline/_parser_internals/_beam_utils.pyx":50 + * cdef StateC* st + * for state in states: + * beam = Beam(self.moves.n_moves, width, min_density=density) # <<<<<<<<<<<<<< + * beam.initialize(self.moves.init_beam_state, + * self.moves.del_beam_state, state.c.length, +*/ + __pyx_t_5 = NULL; + __pyx_t_6 = __Pyx_PyLong_From_int(__pyx_v_self->moves->n_moves); if (unlikely(!__pyx_t_6)) __PYX_ERR(0, 50, __pyx_L1_error) + __Pyx_GOTREF(__pyx_t_6); + __pyx_t_7 = __Pyx_PyLong_From_int(__pyx_v_width); if (unlikely(!__pyx_t_7)) __PYX_ERR(0, 50, __pyx_L1_error) + __Pyx_GOTREF(__pyx_t_7); + __pyx_t_8 = PyFloat_FromDouble(__pyx_v_density); if (unlikely(!__pyx_t_8)) __PYX_ERR(0, 50, __pyx_L1_error) + __Pyx_GOTREF(__pyx_t_8); + __pyx_t_9 = 1; + { + PyObject *__pyx_callargs[3 + ((CYTHON_VECTORCALL) ? 1 : 0)] = {__pyx_t_5, __pyx_t_6, __pyx_t_7}; + __pyx_t_10 = __Pyx_MakeVectorcallBuilderKwds(1); if (unlikely(!__pyx_t_10)) __PYX_ERR(0, 50, __pyx_L1_error) + __Pyx_GOTREF(__pyx_t_10); + if (__Pyx_VectorcallBuilder_AddArg(__pyx_mstate_global->__pyx_n_u_min_density, __pyx_t_8, __pyx_t_10, __pyx_callargs+3, 0) < (0)) __PYX_ERR(0, 50, __pyx_L1_error) + __pyx_t_2 = __Pyx_Object_Vectorcall_CallFromBuilder((PyObject*)__pyx_mstate_global->__pyx_ptype_5thinc_5extra_6search_Beam, __pyx_callargs+__pyx_t_9, (3-__pyx_t_9) | (__pyx_t_9*__Pyx_PY_VECTORCALL_ARGUMENTS_OFFSET), __pyx_t_10); + __Pyx_XDECREF(__pyx_t_5); __pyx_t_5 = 0; + __Pyx_DECREF(__pyx_t_6); __pyx_t_6 = 0; + __Pyx_DECREF(__pyx_t_7); __pyx_t_7 = 0; + __Pyx_DECREF(__pyx_t_8); __pyx_t_8 = 0; + __Pyx_DECREF(__pyx_t_10); __pyx_t_10 = 0; + if (unlikely(!__pyx_t_2)) __PYX_ERR(0, 50, __pyx_L1_error) + __Pyx_GOTREF((PyObject *)__pyx_t_2); + } + __Pyx_XDECREF_SET(__pyx_v_beam, ((struct __pyx_obj_5thinc_5extra_6search_Beam *)__pyx_t_2)); + __pyx_t_2 = 0; + + /* "spacy/pipeline/_parser_internals/_beam_utils.pyx":51 + * for state in states: + * beam = Beam(self.moves.n_moves, width, min_density=density) + * beam.initialize(self.moves.init_beam_state, # <<<<<<<<<<<<<< + * self.moves.del_beam_state, state.c.length, + * state.c._sent) +*/ + __pyx_t_11 = ((struct __pyx_vtabstruct_5thinc_5extra_6search_Beam *)__pyx_v_beam->__pyx_vtab)->initialize(__pyx_v_beam, __pyx_v_self->moves->init_beam_state, __pyx_v_self->moves->del_beam_state, __pyx_v_state->c->length, ((void *)__pyx_v_state->c->_sent)); if (unlikely(__pyx_t_11 == ((int)-1))) __PYX_ERR(0, 51, __pyx_L1_error) + + /* "spacy/pipeline/_parser_internals/_beam_utils.pyx":54 + * self.moves.del_beam_state, state.c.length, + * state.c._sent) + * for i in range(beam.width): # <<<<<<<<<<<<<< + * st = beam.at(i) + * st.offset = state.c.offset +*/ + __pyx_t_12 = __pyx_v_beam->width; + __pyx_t_13 = __pyx_t_12; + for (__pyx_t_14 = 0; __pyx_t_14 < __pyx_t_13; __pyx_t_14+=1) { + __pyx_v_i = __pyx_t_14; + + /* "spacy/pipeline/_parser_internals/_beam_utils.pyx":55 + * state.c._sent) + * for i in range(beam.width): + * st = beam.at(i) # <<<<<<<<<<<<<< + * st.offset = state.c.offset + * beam.check_done(check_final_state, NULL) +*/ + __pyx_t_15 = __pyx_f_5thinc_5extra_6search_4Beam_at(__pyx_v_beam, __pyx_v_i); if (unlikely(PyErr_Occurred())) __PYX_ERR(0, 55, __pyx_L1_error) + __pyx_v_st = ((__pyx_t_5spacy_8pipeline_17_parser_internals_6_state_StateC *)__pyx_t_15); + + /* "spacy/pipeline/_parser_internals/_beam_utils.pyx":56 + * for i in range(beam.width): + * st = beam.at(i) + * st.offset = state.c.offset # <<<<<<<<<<<<<< + * beam.check_done(check_final_state, NULL) + * self.beams.append(beam) +*/ + __pyx_t_11 = __pyx_v_state->c->offset; + __pyx_v_st->offset = __pyx_t_11; + } + + /* "spacy/pipeline/_parser_internals/_beam_utils.pyx":57 + * st = beam.at(i) + * st.offset = state.c.offset + * beam.check_done(check_final_state, NULL) # <<<<<<<<<<<<<< + * self.beams.append(beam) + * +*/ + __pyx_t_11 = ((struct __pyx_vtabstruct_5thinc_5extra_6search_Beam *)__pyx_v_beam->__pyx_vtab)->check_done(__pyx_v_beam, __pyx_f_5spacy_8pipeline_17_parser_internals_11_beam_utils_check_final_state, NULL); if (unlikely(__pyx_t_11 == ((int)-1))) __PYX_ERR(0, 57, __pyx_L1_error) + + /* "spacy/pipeline/_parser_internals/_beam_utils.pyx":58 + * st.offset = state.c.offset + * beam.check_done(check_final_state, NULL) + * self.beams.append(beam) # <<<<<<<<<<<<<< + * + * @property +*/ + __pyx_t_16 = __Pyx_PyObject_Append(__pyx_v_self->beams, ((PyObject *)__pyx_v_beam)); if (unlikely(__pyx_t_16 == ((int)-1))) __PYX_ERR(0, 58, __pyx_L1_error) + + /* "spacy/pipeline/_parser_internals/_beam_utils.pyx":49 + * cdef Beam beam + * cdef StateC* st + * for state in states: # <<<<<<<<<<<<<< + * beam = Beam(self.moves.n_moves, width, min_density=density) + * beam.initialize(self.moves.init_beam_state, +*/ + } + __Pyx_DECREF(__pyx_t_1); __pyx_t_1 = 0; + + /* "spacy/pipeline/_parser_internals/_beam_utils.pyx":39 + * cdef public object beams + * + * def __init__(self, TransitionSystem moves, states, golds, # <<<<<<<<<<<<<< + * int width, float density=0.): + * cdef StateClass state +*/ + + /* function exit code */ + __pyx_r = 0; + goto __pyx_L0; + __pyx_L1_error:; + __Pyx_XDECREF(__pyx_t_1); + __Pyx_XDECREF(__pyx_t_2); + __Pyx_XDECREF(__pyx_t_5); + __Pyx_XDECREF(__pyx_t_6); + __Pyx_XDECREF(__pyx_t_7); + __Pyx_XDECREF(__pyx_t_8); + __Pyx_XDECREF(__pyx_t_10); + __Pyx_AddTraceback("spacy.pipeline._parser_internals._beam_utils.BeamBatch.__init__", __pyx_clineno, __pyx_lineno, __pyx_filename); + __pyx_r = -1; + __pyx_L0:; + __Pyx_XDECREF((PyObject *)__pyx_v_state); + __Pyx_XDECREF((PyObject *)__pyx_v_beam); + __Pyx_RefNannyFinishContext(); + return __pyx_r; +} + +/* "spacy/pipeline/_parser_internals/_beam_utils.pyx":60 + * self.beams.append(beam) + * + * @property # <<<<<<<<<<<<<< + * def is_done(self): + * return all(b.is_done for b in self.beams) +*/ + +/* Python wrapper */ +static PyObject *__pyx_pw_5spacy_8pipeline_17_parser_internals_11_beam_utils_9BeamBatch_7is_done_1__get__(PyObject *__pyx_v_self); /*proto*/ +static PyObject *__pyx_pw_5spacy_8pipeline_17_parser_internals_11_beam_utils_9BeamBatch_7is_done_1__get__(PyObject *__pyx_v_self) { + CYTHON_UNUSED PyObject *const *__pyx_kwvalues; + PyObject *__pyx_r = 0; + __Pyx_RefNannyDeclarations + __Pyx_RefNannySetupContext("__get__ (wrapper)", 0); + __pyx_kwvalues = __Pyx_KwValues_VARARGS(__pyx_args, __pyx_nargs); + __pyx_r = __pyx_pf_5spacy_8pipeline_17_parser_internals_11_beam_utils_9BeamBatch_7is_done___get__(((struct __pyx_obj_5spacy_8pipeline_17_parser_internals_11_beam_utils_BeamBatch *)__pyx_v_self)); + + /* function exit code */ + __Pyx_RefNannyFinishContext(); + return __pyx_r; +} +static PyObject *__pyx_gb_5spacy_8pipeline_17_parser_internals_11_beam_utils_9BeamBatch_7is_done_7__get___2generator(__pyx_CoroutineObject *__pyx_generator, CYTHON_UNUSED PyThreadState *__pyx_tstate, PyObject *__pyx_sent_value); /* proto */ + +/* "spacy/pipeline/_parser_internals/_beam_utils.pyx":62 + * @property + * def is_done(self): + * return all(b.is_done for b in self.beams) # <<<<<<<<<<<<<< + * + * def __getitem__(self, i): +*/ + +static PyObject *__pyx_pf_5spacy_8pipeline_17_parser_internals_11_beam_utils_9BeamBatch_7is_done_7__get___genexpr(CYTHON_UNUSED PyObject *__pyx_self, PyObject *__pyx_genexpr_arg_0) { + struct __pyx_obj_5spacy_8pipeline_17_parser_internals_11_beam_utils___pyx_scope_struct__genexpr *__pyx_cur_scope; + PyObject *__pyx_r = NULL; + __Pyx_RefNannyDeclarations + int __pyx_lineno = 0; + const char *__pyx_filename = NULL; + int __pyx_clineno = 0; + __Pyx_RefNannySetupContext("genexpr", 0); + __pyx_cur_scope = (struct __pyx_obj_5spacy_8pipeline_17_parser_internals_11_beam_utils___pyx_scope_struct__genexpr *)__pyx_tp_new_5spacy_8pipeline_17_parser_internals_11_beam_utils___pyx_scope_struct__genexpr(__pyx_mstate_global->__pyx_ptype_5spacy_8pipeline_17_parser_internals_11_beam_utils___pyx_scope_struct__genexpr, __pyx_mstate_global->__pyx_empty_tuple, NULL); + if (unlikely(!__pyx_cur_scope)) { + __pyx_cur_scope = ((struct __pyx_obj_5spacy_8pipeline_17_parser_internals_11_beam_utils___pyx_scope_struct__genexpr *)Py_None); + __Pyx_INCREF(Py_None); + __PYX_ERR(0, 62, __pyx_L1_error) + } else { + __Pyx_GOTREF((PyObject *)__pyx_cur_scope); + } + __pyx_cur_scope->__pyx_genexpr_arg_0 = __pyx_genexpr_arg_0; + __Pyx_INCREF(__pyx_cur_scope->__pyx_genexpr_arg_0); + __Pyx_GIVEREF(__pyx_cur_scope->__pyx_genexpr_arg_0); + { + __pyx_CoroutineObject *gen = __Pyx_Generator_New((__pyx_coroutine_body_t) __pyx_gb_5spacy_8pipeline_17_parser_internals_11_beam_utils_9BeamBatch_7is_done_7__get___2generator, ((PyObject *)__pyx_mstate_global->__pyx_codeobj_tab[0]), (PyObject *) __pyx_cur_scope, __pyx_mstate_global->__pyx_n_u_genexpr, __pyx_mstate_global->__pyx_n_u_BeamBatch___get___locals_genexpr, __pyx_mstate_global->__pyx_n_u_spacy_pipeline__parser_internals); if (unlikely(!gen)) __PYX_ERR(0, 62, __pyx_L1_error) + __Pyx_DECREF(__pyx_cur_scope); + __Pyx_RefNannyFinishContext(); + return (PyObject *) gen; + } + + /* function exit code */ + __pyx_L1_error:; + __Pyx_AddTraceback("spacy.pipeline._parser_internals._beam_utils.BeamBatch.is_done.__get__.genexpr", __pyx_clineno, __pyx_lineno, __pyx_filename); + __pyx_r = NULL; + __Pyx_DECREF((PyObject *)__pyx_cur_scope); + __Pyx_XGIVEREF(__pyx_r); + __Pyx_RefNannyFinishContext(); + return __pyx_r; +} + +static PyObject *__pyx_gb_5spacy_8pipeline_17_parser_internals_11_beam_utils_9BeamBatch_7is_done_7__get___2generator(__pyx_CoroutineObject *__pyx_generator, CYTHON_UNUSED PyThreadState *__pyx_tstate, PyObject *__pyx_sent_value) /* generator body */ +{ + struct __pyx_obj_5spacy_8pipeline_17_parser_internals_11_beam_utils___pyx_scope_struct__genexpr *__pyx_cur_scope = ((struct __pyx_obj_5spacy_8pipeline_17_parser_internals_11_beam_utils___pyx_scope_struct__genexpr *)__pyx_generator->closure); + PyObject *__pyx_r = NULL; + PyObject *__pyx_t_1 = NULL; + Py_ssize_t __pyx_t_2; + PyObject *(*__pyx_t_3)(PyObject *); + PyObject *__pyx_t_4 = NULL; + int __pyx_t_5; + int __pyx_t_6; + int __pyx_lineno = 0; + const char *__pyx_filename = NULL; + int __pyx_clineno = 0; + __Pyx_RefNannyDeclarations + __Pyx_RefNannySetupContext("genexpr", 0); + switch (__pyx_generator->resume_label) { + case 0: goto __pyx_L3_first_run; + default: /* CPython raises the right error here */ + __Pyx_RefNannyFinishContext(); + return NULL; + } + __pyx_L3_first_run:; + if (unlikely(!__pyx_sent_value)) __PYX_ERR(0, 62, __pyx_L1_error) + if (unlikely(!__pyx_cur_scope->__pyx_genexpr_arg_0)) { __Pyx_RaiseUnboundLocalError(".0"); __PYX_ERR(0, 62, __pyx_L1_error) } + if (likely(PyList_CheckExact(__pyx_cur_scope->__pyx_genexpr_arg_0)) || PyTuple_CheckExact(__pyx_cur_scope->__pyx_genexpr_arg_0)) { + __pyx_t_1 = __pyx_cur_scope->__pyx_genexpr_arg_0; __Pyx_INCREF(__pyx_t_1); + __pyx_t_2 = 0; + __pyx_t_3 = NULL; + } else { + __pyx_t_2 = -1; __pyx_t_1 = PyObject_GetIter(__pyx_cur_scope->__pyx_genexpr_arg_0); if (unlikely(!__pyx_t_1)) __PYX_ERR(0, 62, __pyx_L1_error) + __Pyx_GOTREF(__pyx_t_1); + __pyx_t_3 = (CYTHON_COMPILING_IN_LIMITED_API) ? PyIter_Next : __Pyx_PyObject_GetIterNextFunc(__pyx_t_1); if (unlikely(!__pyx_t_3)) __PYX_ERR(0, 62, __pyx_L1_error) + } + for (;;) { + if (likely(!__pyx_t_3)) { + if (likely(PyList_CheckExact(__pyx_t_1))) { + { + Py_ssize_t __pyx_temp = __Pyx_PyList_GET_SIZE(__pyx_t_1); + #if !CYTHON_ASSUME_SAFE_SIZE + if (unlikely((__pyx_temp < 0))) __PYX_ERR(0, 62, __pyx_L1_error) + #endif + if (__pyx_t_2 >= __pyx_temp) break; + } + __pyx_t_4 = __Pyx_PyList_GetItemRefFast(__pyx_t_1, __pyx_t_2, __Pyx_ReferenceSharing_OwnStrongReference); + ++__pyx_t_2; + } else { + { + Py_ssize_t __pyx_temp = __Pyx_PyTuple_GET_SIZE(__pyx_t_1); + #if !CYTHON_ASSUME_SAFE_SIZE + if (unlikely((__pyx_temp < 0))) __PYX_ERR(0, 62, __pyx_L1_error) + #endif + if (__pyx_t_2 >= __pyx_temp) break; + } + #if CYTHON_ASSUME_SAFE_MACROS && !CYTHON_AVOID_BORROWED_REFS + __pyx_t_4 = __Pyx_NewRef(PyTuple_GET_ITEM(__pyx_t_1, __pyx_t_2)); + #else + __pyx_t_4 = __Pyx_PySequence_ITEM(__pyx_t_1, __pyx_t_2); + #endif + ++__pyx_t_2; + } + if (unlikely(!__pyx_t_4)) __PYX_ERR(0, 62, __pyx_L1_error) + } else { + __pyx_t_4 = __pyx_t_3(__pyx_t_1); + if (unlikely(!__pyx_t_4)) { + PyObject* exc_type = PyErr_Occurred(); + if (exc_type) { + if (unlikely(!__Pyx_PyErr_GivenExceptionMatches(exc_type, PyExc_StopIteration))) __PYX_ERR(0, 62, __pyx_L1_error) + PyErr_Clear(); + } + break; + } + } + __Pyx_GOTREF(__pyx_t_4); + __Pyx_XGOTREF(__pyx_cur_scope->__pyx_v_b); + __Pyx_XDECREF_SET(__pyx_cur_scope->__pyx_v_b, __pyx_t_4); + __Pyx_GIVEREF(__pyx_t_4); + __pyx_t_4 = 0; + __pyx_t_4 = __Pyx_PyObject_GetAttrStr(__pyx_cur_scope->__pyx_v_b, __pyx_mstate_global->__pyx_n_u_is_done); if (unlikely(!__pyx_t_4)) __PYX_ERR(0, 62, __pyx_L1_error) + __Pyx_GOTREF(__pyx_t_4); + __pyx_t_5 = __Pyx_PyObject_IsTrue(__pyx_t_4); if (unlikely((__pyx_t_5 < 0))) __PYX_ERR(0, 62, __pyx_L1_error) + __Pyx_DECREF(__pyx_t_4); __pyx_t_4 = 0; + __pyx_t_6 = (!__pyx_t_5); + if (__pyx_t_6) { + __Pyx_XDECREF(__pyx_r); + __Pyx_INCREF(Py_False); + __pyx_r = Py_False; + __Pyx_DECREF(__pyx_t_1); __pyx_t_1 = 0; + goto __pyx_L0; + } + } + __Pyx_DECREF(__pyx_t_1); __pyx_t_1 = 0; + /*else*/ { + __Pyx_XDECREF(__pyx_r); + __Pyx_INCREF(Py_True); + __pyx_r = Py_True; + goto __pyx_L0; + } + CYTHON_MAYBE_UNUSED_VAR(__pyx_cur_scope); + + /* function exit code */ + goto __pyx_L0; + __pyx_L1_error:; + __Pyx_XDECREF(__pyx_t_1); + __Pyx_XDECREF(__pyx_t_4); + if (__Pyx_PyErr_Occurred()) { + __Pyx_AddTraceback("genexpr", __pyx_clineno, __pyx_lineno, __pyx_filename); + } + __pyx_L0:; + __Pyx_XGIVEREF(__pyx_r); + #if !CYTHON_USE_EXC_INFO_STACK + __Pyx_Coroutine_ResetAndClearException(__pyx_generator); + #endif + __pyx_generator->resume_label = -1; + __Pyx_Coroutine_clear((PyObject*)__pyx_generator); + __Pyx_RefNannyFinishContext(); + return __pyx_r; +} + +/* "spacy/pipeline/_parser_internals/_beam_utils.pyx":60 + * self.beams.append(beam) + * + * @property # <<<<<<<<<<<<<< + * def is_done(self): + * return all(b.is_done for b in self.beams) +*/ + +static PyObject *__pyx_pf_5spacy_8pipeline_17_parser_internals_11_beam_utils_9BeamBatch_7is_done___get__(struct __pyx_obj_5spacy_8pipeline_17_parser_internals_11_beam_utils_BeamBatch *__pyx_v_self) { + PyObject *__pyx_gb_5spacy_8pipeline_17_parser_internals_11_beam_utils_9BeamBatch_7is_done_7__get___2generator = 0; + PyObject *__pyx_r = NULL; + __Pyx_RefNannyDeclarations + PyObject *__pyx_t_1 = NULL; + PyObject *__pyx_t_2 = NULL; + int __pyx_lineno = 0; + const char *__pyx_filename = NULL; + int __pyx_clineno = 0; + __Pyx_RefNannySetupContext("__get__", 0); + + /* "spacy/pipeline/_parser_internals/_beam_utils.pyx":62 + * @property + * def is_done(self): + * return all(b.is_done for b in self.beams) # <<<<<<<<<<<<<< + * + * def __getitem__(self, i): +*/ + __Pyx_XDECREF(__pyx_r); + __pyx_t_1 = __pyx_pf_5spacy_8pipeline_17_parser_internals_11_beam_utils_9BeamBatch_7is_done_7__get___genexpr(NULL, __pyx_v_self->beams); if (unlikely(!__pyx_t_1)) __PYX_ERR(0, 62, __pyx_L1_error) + __Pyx_GOTREF(__pyx_t_1); + __pyx_t_2 = __Pyx_Generator_GetInlinedResult(__pyx_t_1); if (unlikely(!__pyx_t_2)) __PYX_ERR(0, 62, __pyx_L1_error) + __Pyx_GOTREF(__pyx_t_2); + __Pyx_DECREF(__pyx_t_1); __pyx_t_1 = 0; + __pyx_r = __pyx_t_2; + __pyx_t_2 = 0; + goto __pyx_L0; + + /* "spacy/pipeline/_parser_internals/_beam_utils.pyx":60 + * self.beams.append(beam) + * + * @property # <<<<<<<<<<<<<< + * def is_done(self): + * return all(b.is_done for b in self.beams) +*/ + + /* function exit code */ + __pyx_L1_error:; + __Pyx_XDECREF(__pyx_t_1); + __Pyx_XDECREF(__pyx_t_2); + __Pyx_AddTraceback("spacy.pipeline._parser_internals._beam_utils.BeamBatch.is_done.__get__", __pyx_clineno, __pyx_lineno, __pyx_filename); + __pyx_r = NULL; + __pyx_L0:; + __Pyx_XDECREF(__pyx_gb_5spacy_8pipeline_17_parser_internals_11_beam_utils_9BeamBatch_7is_done_7__get___2generator); + __Pyx_XGIVEREF(__pyx_r); + __Pyx_RefNannyFinishContext(); + return __pyx_r; +} + +/* "spacy/pipeline/_parser_internals/_beam_utils.pyx":64 + * return all(b.is_done for b in self.beams) + * + * def __getitem__(self, i): # <<<<<<<<<<<<<< + * return self.beams[i] + * +*/ + +/* Python wrapper */ +static PyObject *__pyx_pw_5spacy_8pipeline_17_parser_internals_11_beam_utils_9BeamBatch_3__getitem__(PyObject *__pyx_v_self, PyObject *__pyx_v_i); /*proto*/ +static PyObject *__pyx_pw_5spacy_8pipeline_17_parser_internals_11_beam_utils_9BeamBatch_3__getitem__(PyObject *__pyx_v_self, PyObject *__pyx_v_i) { + CYTHON_UNUSED PyObject *const *__pyx_kwvalues; + PyObject *__pyx_r = 0; + __Pyx_RefNannyDeclarations + __Pyx_RefNannySetupContext("__getitem__ (wrapper)", 0); + __pyx_kwvalues = __Pyx_KwValues_VARARGS(__pyx_args, __pyx_nargs); + __pyx_r = __pyx_pf_5spacy_8pipeline_17_parser_internals_11_beam_utils_9BeamBatch_2__getitem__(((struct __pyx_obj_5spacy_8pipeline_17_parser_internals_11_beam_utils_BeamBatch *)__pyx_v_self), ((PyObject *)__pyx_v_i)); + + /* function exit code */ + __Pyx_RefNannyFinishContext(); + return __pyx_r; +} + +static PyObject *__pyx_pf_5spacy_8pipeline_17_parser_internals_11_beam_utils_9BeamBatch_2__getitem__(struct __pyx_obj_5spacy_8pipeline_17_parser_internals_11_beam_utils_BeamBatch *__pyx_v_self, PyObject *__pyx_v_i) { + 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("__getitem__", 0); + + /* "spacy/pipeline/_parser_internals/_beam_utils.pyx":65 + * + * def __getitem__(self, i): + * return self.beams[i] # <<<<<<<<<<<<<< + * + * def __len__(self): +*/ + __Pyx_XDECREF(__pyx_r); + __pyx_t_1 = __Pyx_PyObject_GetItem(__pyx_v_self->beams, __pyx_v_i); if (unlikely(!__pyx_t_1)) __PYX_ERR(0, 65, __pyx_L1_error) + __Pyx_GOTREF(__pyx_t_1); + __pyx_r = __pyx_t_1; + __pyx_t_1 = 0; + goto __pyx_L0; + + /* "spacy/pipeline/_parser_internals/_beam_utils.pyx":64 + * return all(b.is_done for b in self.beams) + * + * def __getitem__(self, i): # <<<<<<<<<<<<<< + * return self.beams[i] + * +*/ + + /* function exit code */ + __pyx_L1_error:; + __Pyx_XDECREF(__pyx_t_1); + __Pyx_AddTraceback("spacy.pipeline._parser_internals._beam_utils.BeamBatch.__getitem__", __pyx_clineno, __pyx_lineno, __pyx_filename); + __pyx_r = NULL; + __pyx_L0:; + __Pyx_XGIVEREF(__pyx_r); + __Pyx_RefNannyFinishContext(); + return __pyx_r; +} + +/* "spacy/pipeline/_parser_internals/_beam_utils.pyx":67 + * return self.beams[i] + * + * def __len__(self): # <<<<<<<<<<<<<< + * return len(self.beams) + * +*/ + +/* Python wrapper */ +static Py_ssize_t __pyx_pw_5spacy_8pipeline_17_parser_internals_11_beam_utils_9BeamBatch_5__len__(PyObject *__pyx_v_self); /*proto*/ +static Py_ssize_t __pyx_pw_5spacy_8pipeline_17_parser_internals_11_beam_utils_9BeamBatch_5__len__(PyObject *__pyx_v_self) { + CYTHON_UNUSED PyObject *const *__pyx_kwvalues; + Py_ssize_t __pyx_r; + __Pyx_RefNannyDeclarations + __Pyx_RefNannySetupContext("__len__ (wrapper)", 0); + __pyx_kwvalues = __Pyx_KwValues_VARARGS(__pyx_args, __pyx_nargs); + __pyx_r = __pyx_pf_5spacy_8pipeline_17_parser_internals_11_beam_utils_9BeamBatch_4__len__(((struct __pyx_obj_5spacy_8pipeline_17_parser_internals_11_beam_utils_BeamBatch *)__pyx_v_self)); + + /* function exit code */ + __Pyx_RefNannyFinishContext(); + return __pyx_r; +} + +static Py_ssize_t __pyx_pf_5spacy_8pipeline_17_parser_internals_11_beam_utils_9BeamBatch_4__len__(struct __pyx_obj_5spacy_8pipeline_17_parser_internals_11_beam_utils_BeamBatch *__pyx_v_self) { + Py_ssize_t __pyx_r; + __Pyx_RefNannyDeclarations + PyObject *__pyx_t_1 = NULL; + Py_ssize_t __pyx_t_2; + int __pyx_lineno = 0; + const char *__pyx_filename = NULL; + int __pyx_clineno = 0; + __Pyx_RefNannySetupContext("__len__", 0); + + /* "spacy/pipeline/_parser_internals/_beam_utils.pyx":68 + * + * def __len__(self): + * return len(self.beams) # <<<<<<<<<<<<<< + * + * def get_states(self): +*/ + __pyx_t_1 = __pyx_v_self->beams; + __Pyx_INCREF(__pyx_t_1); + __pyx_t_2 = PyObject_Length(__pyx_t_1); if (unlikely(__pyx_t_2 == ((Py_ssize_t)-1))) __PYX_ERR(0, 68, __pyx_L1_error) + __Pyx_DECREF(__pyx_t_1); __pyx_t_1 = 0; + __pyx_r = __pyx_t_2; + goto __pyx_L0; + + /* "spacy/pipeline/_parser_internals/_beam_utils.pyx":67 + * return self.beams[i] + * + * def __len__(self): # <<<<<<<<<<<<<< + * return len(self.beams) + * +*/ + + /* function exit code */ + __pyx_L1_error:; + __Pyx_XDECREF(__pyx_t_1); + __Pyx_AddTraceback("spacy.pipeline._parser_internals._beam_utils.BeamBatch.__len__", __pyx_clineno, __pyx_lineno, __pyx_filename); + __pyx_r = -1; + __pyx_L0:; + __Pyx_RefNannyFinishContext(); + return __pyx_r; +} + +/* "spacy/pipeline/_parser_internals/_beam_utils.pyx":70 + * return len(self.beams) + * + * def get_states(self): # <<<<<<<<<<<<<< + * cdef Beam beam + * cdef StateC* state +*/ + +/* Python wrapper */ +static PyObject *__pyx_pw_5spacy_8pipeline_17_parser_internals_11_beam_utils_9BeamBatch_7get_states(PyObject *__pyx_v_self, +#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_5spacy_8pipeline_17_parser_internals_11_beam_utils_9BeamBatch_6get_states, "BeamBatch.get_states(self)"); +static PyMethodDef __pyx_mdef_5spacy_8pipeline_17_parser_internals_11_beam_utils_9BeamBatch_7get_states = {"get_states", (PyCFunction)(void(*)(void))(__Pyx_PyCFunction_FastCallWithKeywords)__pyx_pw_5spacy_8pipeline_17_parser_internals_11_beam_utils_9BeamBatch_7get_states, __Pyx_METH_FASTCALL|METH_KEYWORDS, __pyx_doc_5spacy_8pipeline_17_parser_internals_11_beam_utils_9BeamBatch_6get_states}; +static PyObject *__pyx_pw_5spacy_8pipeline_17_parser_internals_11_beam_utils_9BeamBatch_7get_states(PyObject *__pyx_v_self, +#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("get_states (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("get_states", 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("get_states", __pyx_kwds); return NULL;} + __pyx_r = __pyx_pf_5spacy_8pipeline_17_parser_internals_11_beam_utils_9BeamBatch_6get_states(((struct __pyx_obj_5spacy_8pipeline_17_parser_internals_11_beam_utils_BeamBatch *)__pyx_v_self)); + + /* function exit code */ + __Pyx_RefNannyFinishContext(); + return __pyx_r; +} + +static PyObject *__pyx_pf_5spacy_8pipeline_17_parser_internals_11_beam_utils_9BeamBatch_6get_states(struct __pyx_obj_5spacy_8pipeline_17_parser_internals_11_beam_utils_BeamBatch *__pyx_v_self) { + struct __pyx_obj_5thinc_5extra_6search_Beam *__pyx_v_beam = 0; + __pyx_t_5spacy_8pipeline_17_parser_internals_6_state_StateC *__pyx_v_state; + struct __pyx_obj_5spacy_8pipeline_17_parser_internals_10stateclass_StateClass *__pyx_v_stcls = 0; + PyObject *__pyx_v_states = NULL; + PyObject *__pyx_v_doc = NULL; + __pyx_t_5thinc_5extra_6search_class_t __pyx_v_i; + PyObject *__pyx_r = NULL; + __Pyx_RefNannyDeclarations + PyObject *__pyx_t_1 = NULL; + PyObject *__pyx_t_2 = NULL; + size_t __pyx_t_3; + Py_ssize_t __pyx_t_4; + PyObject *(*__pyx_t_5)(PyObject *); + PyObject *__pyx_t_6 = NULL; + PyObject *__pyx_t_7 = NULL; + PyObject *__pyx_t_8 = NULL; + PyObject *(*__pyx_t_9)(PyObject *); + __pyx_t_5thinc_5extra_6search_class_t __pyx_t_10; + __pyx_t_5thinc_5extra_6search_class_t __pyx_t_11; + __pyx_t_5thinc_5extra_6search_class_t __pyx_t_12; + void *__pyx_t_13; + int __pyx_t_14; + int __pyx_lineno = 0; + const char *__pyx_filename = NULL; + int __pyx_clineno = 0; + __Pyx_RefNannySetupContext("get_states", 0); + + /* "spacy/pipeline/_parser_internals/_beam_utils.pyx":74 + * cdef StateC* state + * cdef StateClass stcls + * states = [] # <<<<<<<<<<<<<< + * for beam, doc in zip(self, self.docs): + * for i in range(beam.size): +*/ + __pyx_t_1 = PyList_New(0); if (unlikely(!__pyx_t_1)) __PYX_ERR(0, 74, __pyx_L1_error) + __Pyx_GOTREF(__pyx_t_1); + __pyx_v_states = ((PyObject*)__pyx_t_1); + __pyx_t_1 = 0; + + /* "spacy/pipeline/_parser_internals/_beam_utils.pyx":75 + * cdef StateClass stcls + * states = [] + * for beam, doc in zip(self, self.docs): # <<<<<<<<<<<<<< + * for i in range(beam.size): + * state = beam.at(i) +*/ + __pyx_t_2 = NULL; + __pyx_t_3 = 1; + { + PyObject *__pyx_callargs[3] = {__pyx_t_2, ((PyObject *)__pyx_v_self), __pyx_v_self->docs}; + __pyx_t_1 = __Pyx_PyObject_FastCall((PyObject*)__pyx_builtin_zip, __pyx_callargs+__pyx_t_3, (3-__pyx_t_3) | (__pyx_t_3*__Pyx_PY_VECTORCALL_ARGUMENTS_OFFSET)); + __Pyx_XDECREF(__pyx_t_2); __pyx_t_2 = 0; + if (unlikely(!__pyx_t_1)) __PYX_ERR(0, 75, __pyx_L1_error) + __Pyx_GOTREF(__pyx_t_1); + } + if (likely(PyList_CheckExact(__pyx_t_1)) || PyTuple_CheckExact(__pyx_t_1)) { + __pyx_t_2 = __pyx_t_1; __Pyx_INCREF(__pyx_t_2); + __pyx_t_4 = 0; + __pyx_t_5 = NULL; + } else { + __pyx_t_4 = -1; __pyx_t_2 = PyObject_GetIter(__pyx_t_1); if (unlikely(!__pyx_t_2)) __PYX_ERR(0, 75, __pyx_L1_error) + __Pyx_GOTREF(__pyx_t_2); + __pyx_t_5 = (CYTHON_COMPILING_IN_LIMITED_API) ? PyIter_Next : __Pyx_PyObject_GetIterNextFunc(__pyx_t_2); if (unlikely(!__pyx_t_5)) __PYX_ERR(0, 75, __pyx_L1_error) + } + __Pyx_DECREF(__pyx_t_1); __pyx_t_1 = 0; + for (;;) { + if (likely(!__pyx_t_5)) { + if (likely(PyList_CheckExact(__pyx_t_2))) { + { + Py_ssize_t __pyx_temp = __Pyx_PyList_GET_SIZE(__pyx_t_2); + #if !CYTHON_ASSUME_SAFE_SIZE + if (unlikely((__pyx_temp < 0))) __PYX_ERR(0, 75, __pyx_L1_error) + #endif + if (__pyx_t_4 >= __pyx_temp) break; + } + __pyx_t_1 = __Pyx_PyList_GetItemRefFast(__pyx_t_2, __pyx_t_4, __Pyx_ReferenceSharing_OwnStrongReference); + ++__pyx_t_4; + } else { + { + Py_ssize_t __pyx_temp = __Pyx_PyTuple_GET_SIZE(__pyx_t_2); + #if !CYTHON_ASSUME_SAFE_SIZE + if (unlikely((__pyx_temp < 0))) __PYX_ERR(0, 75, __pyx_L1_error) + #endif + if (__pyx_t_4 >= __pyx_temp) break; + } + #if CYTHON_ASSUME_SAFE_MACROS && !CYTHON_AVOID_BORROWED_REFS + __pyx_t_1 = __Pyx_NewRef(PyTuple_GET_ITEM(__pyx_t_2, __pyx_t_4)); + #else + __pyx_t_1 = __Pyx_PySequence_ITEM(__pyx_t_2, __pyx_t_4); + #endif + ++__pyx_t_4; + } + if (unlikely(!__pyx_t_1)) __PYX_ERR(0, 75, __pyx_L1_error) + } else { + __pyx_t_1 = __pyx_t_5(__pyx_t_2); + if (unlikely(!__pyx_t_1)) { + PyObject* exc_type = PyErr_Occurred(); + if (exc_type) { + if (unlikely(!__Pyx_PyErr_GivenExceptionMatches(exc_type, PyExc_StopIteration))) __PYX_ERR(0, 75, __pyx_L1_error) + PyErr_Clear(); + } + break; + } + } + __Pyx_GOTREF(__pyx_t_1); + if ((likely(PyTuple_CheckExact(__pyx_t_1))) || (PyList_CheckExact(__pyx_t_1))) { + PyObject* sequence = __pyx_t_1; + 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, 75, __pyx_L1_error) + } + #if CYTHON_ASSUME_SAFE_MACROS && !CYTHON_AVOID_BORROWED_REFS + if (likely(PyTuple_CheckExact(sequence))) { + __pyx_t_6 = PyTuple_GET_ITEM(sequence, 0); + __Pyx_INCREF(__pyx_t_6); + __pyx_t_7 = PyTuple_GET_ITEM(sequence, 1); + __Pyx_INCREF(__pyx_t_7); + } else { + __pyx_t_6 = __Pyx_PyList_GetItemRefFast(sequence, 0, __Pyx_ReferenceSharing_SharedReference); + if (unlikely(!__pyx_t_6)) __PYX_ERR(0, 75, __pyx_L1_error) + __Pyx_XGOTREF(__pyx_t_6); + __pyx_t_7 = __Pyx_PyList_GetItemRefFast(sequence, 1, __Pyx_ReferenceSharing_SharedReference); + if (unlikely(!__pyx_t_7)) __PYX_ERR(0, 75, __pyx_L1_error) + __Pyx_XGOTREF(__pyx_t_7); + } + #else + __pyx_t_6 = __Pyx_PySequence_ITEM(sequence, 0); if (unlikely(!__pyx_t_6)) __PYX_ERR(0, 75, __pyx_L1_error) + __Pyx_GOTREF(__pyx_t_6); + __pyx_t_7 = __Pyx_PySequence_ITEM(sequence, 1); if (unlikely(!__pyx_t_7)) __PYX_ERR(0, 75, __pyx_L1_error) + __Pyx_GOTREF(__pyx_t_7); + #endif + __Pyx_DECREF(__pyx_t_1); __pyx_t_1 = 0; + } else { + Py_ssize_t index = -1; + __pyx_t_8 = PyObject_GetIter(__pyx_t_1); if (unlikely(!__pyx_t_8)) __PYX_ERR(0, 75, __pyx_L1_error) + __Pyx_GOTREF(__pyx_t_8); + __Pyx_DECREF(__pyx_t_1); __pyx_t_1 = 0; + __pyx_t_9 = (CYTHON_COMPILING_IN_LIMITED_API) ? PyIter_Next : __Pyx_PyObject_GetIterNextFunc(__pyx_t_8); + index = 0; __pyx_t_6 = __pyx_t_9(__pyx_t_8); if (unlikely(!__pyx_t_6)) goto __pyx_L5_unpacking_failed; + __Pyx_GOTREF(__pyx_t_6); + index = 1; __pyx_t_7 = __pyx_t_9(__pyx_t_8); if (unlikely(!__pyx_t_7)) goto __pyx_L5_unpacking_failed; + __Pyx_GOTREF(__pyx_t_7); + if (__Pyx_IternextUnpackEndCheck(__pyx_t_9(__pyx_t_8), 2) < (0)) __PYX_ERR(0, 75, __pyx_L1_error) + __pyx_t_9 = NULL; + __Pyx_DECREF(__pyx_t_8); __pyx_t_8 = 0; + goto __pyx_L6_unpacking_done; + __pyx_L5_unpacking_failed:; + __Pyx_DECREF(__pyx_t_8); __pyx_t_8 = 0; + __pyx_t_9 = NULL; + if (__Pyx_IterFinish() == 0) __Pyx_RaiseNeedMoreValuesError(index); + __PYX_ERR(0, 75, __pyx_L1_error) + __pyx_L6_unpacking_done:; + } + if (!(likely(((__pyx_t_6) == Py_None) || likely(__Pyx_TypeTest(__pyx_t_6, __pyx_mstate_global->__pyx_ptype_5thinc_5extra_6search_Beam))))) __PYX_ERR(0, 75, __pyx_L1_error) + __Pyx_XDECREF_SET(__pyx_v_beam, ((struct __pyx_obj_5thinc_5extra_6search_Beam *)__pyx_t_6)); + __pyx_t_6 = 0; + __Pyx_XDECREF_SET(__pyx_v_doc, __pyx_t_7); + __pyx_t_7 = 0; + + /* "spacy/pipeline/_parser_internals/_beam_utils.pyx":76 + * states = [] + * for beam, doc in zip(self, self.docs): + * for i in range(beam.size): # <<<<<<<<<<<<<< + * state = beam.at(i) + * stcls = StateClass.borrow(state, doc) +*/ + __pyx_t_10 = __pyx_v_beam->size; + __pyx_t_11 = __pyx_t_10; + for (__pyx_t_12 = 0; __pyx_t_12 < __pyx_t_11; __pyx_t_12+=1) { + __pyx_v_i = __pyx_t_12; + + /* "spacy/pipeline/_parser_internals/_beam_utils.pyx":77 + * for beam, doc in zip(self, self.docs): + * for i in range(beam.size): + * state = beam.at(i) # <<<<<<<<<<<<<< + * stcls = StateClass.borrow(state, doc) + * states.append(stcls) +*/ + __pyx_t_13 = __pyx_f_5thinc_5extra_6search_4Beam_at(__pyx_v_beam, __pyx_v_i); if (unlikely(PyErr_Occurred())) __PYX_ERR(0, 77, __pyx_L1_error) + __pyx_v_state = ((__pyx_t_5spacy_8pipeline_17_parser_internals_6_state_StateC *)__pyx_t_13); + + /* "spacy/pipeline/_parser_internals/_beam_utils.pyx":78 + * for i in range(beam.size): + * state = beam.at(i) + * stcls = StateClass.borrow(state, doc) # <<<<<<<<<<<<<< + * states.append(stcls) + * return states +*/ + if (!(likely(((__pyx_v_doc) == Py_None) || likely(__Pyx_TypeTest(__pyx_v_doc, __pyx_mstate_global->__pyx_ptype_5spacy_6tokens_3doc_Doc))))) __PYX_ERR(0, 78, __pyx_L1_error) + __pyx_t_1 = ((PyObject *)__pyx_f_5spacy_8pipeline_17_parser_internals_10stateclass_10StateClass_borrow(__pyx_v_state, ((struct __pyx_obj_5spacy_6tokens_3doc_Doc *)__pyx_v_doc))); if (unlikely(!__pyx_t_1)) __PYX_ERR(0, 78, __pyx_L1_error) + __Pyx_GOTREF(__pyx_t_1); + __Pyx_XDECREF_SET(__pyx_v_stcls, ((struct __pyx_obj_5spacy_8pipeline_17_parser_internals_10stateclass_StateClass *)__pyx_t_1)); + __pyx_t_1 = 0; + + /* "spacy/pipeline/_parser_internals/_beam_utils.pyx":79 + * state = beam.at(i) + * stcls = StateClass.borrow(state, doc) + * states.append(stcls) # <<<<<<<<<<<<<< + * return states + * +*/ + __pyx_t_14 = __Pyx_PyList_Append(__pyx_v_states, ((PyObject *)__pyx_v_stcls)); if (unlikely(__pyx_t_14 == ((int)-1))) __PYX_ERR(0, 79, __pyx_L1_error) + } + + /* "spacy/pipeline/_parser_internals/_beam_utils.pyx":75 + * cdef StateClass stcls + * states = [] + * for beam, doc in zip(self, self.docs): # <<<<<<<<<<<<<< + * for i in range(beam.size): + * state = beam.at(i) +*/ + } + __Pyx_DECREF(__pyx_t_2); __pyx_t_2 = 0; + + /* "spacy/pipeline/_parser_internals/_beam_utils.pyx":80 + * stcls = StateClass.borrow(state, doc) + * states.append(stcls) + * return states # <<<<<<<<<<<<<< + * + * def get_unfinished_states(self): +*/ + __Pyx_XDECREF(__pyx_r); + __Pyx_INCREF(__pyx_v_states); + __pyx_r = __pyx_v_states; + goto __pyx_L0; + + /* "spacy/pipeline/_parser_internals/_beam_utils.pyx":70 + * return len(self.beams) + * + * def get_states(self): # <<<<<<<<<<<<<< + * cdef Beam beam + * cdef StateC* state +*/ + + /* function exit code */ + __pyx_L1_error:; + __Pyx_XDECREF(__pyx_t_1); + __Pyx_XDECREF(__pyx_t_2); + __Pyx_XDECREF(__pyx_t_6); + __Pyx_XDECREF(__pyx_t_7); + __Pyx_XDECREF(__pyx_t_8); + __Pyx_AddTraceback("spacy.pipeline._parser_internals._beam_utils.BeamBatch.get_states", __pyx_clineno, __pyx_lineno, __pyx_filename); + __pyx_r = NULL; + __pyx_L0:; + __Pyx_XDECREF((PyObject *)__pyx_v_beam); + __Pyx_XDECREF((PyObject *)__pyx_v_stcls); + __Pyx_XDECREF(__pyx_v_states); + __Pyx_XDECREF(__pyx_v_doc); + __Pyx_XGIVEREF(__pyx_r); + __Pyx_RefNannyFinishContext(); + return __pyx_r; +} + +/* "spacy/pipeline/_parser_internals/_beam_utils.pyx":82 + * return states + * + * def get_unfinished_states(self): # <<<<<<<<<<<<<< + * return [st for st in self.get_states() if not st.is_final()] + * +*/ + +/* Python wrapper */ +static PyObject *__pyx_pw_5spacy_8pipeline_17_parser_internals_11_beam_utils_9BeamBatch_9get_unfinished_states(PyObject *__pyx_v_self, +#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_5spacy_8pipeline_17_parser_internals_11_beam_utils_9BeamBatch_8get_unfinished_states, "BeamBatch.get_unfinished_states(self)"); +static PyMethodDef __pyx_mdef_5spacy_8pipeline_17_parser_internals_11_beam_utils_9BeamBatch_9get_unfinished_states = {"get_unfinished_states", (PyCFunction)(void(*)(void))(__Pyx_PyCFunction_FastCallWithKeywords)__pyx_pw_5spacy_8pipeline_17_parser_internals_11_beam_utils_9BeamBatch_9get_unfinished_states, __Pyx_METH_FASTCALL|METH_KEYWORDS, __pyx_doc_5spacy_8pipeline_17_parser_internals_11_beam_utils_9BeamBatch_8get_unfinished_states}; +static PyObject *__pyx_pw_5spacy_8pipeline_17_parser_internals_11_beam_utils_9BeamBatch_9get_unfinished_states(PyObject *__pyx_v_self, +#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("get_unfinished_states (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("get_unfinished_states", 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("get_unfinished_states", __pyx_kwds); return NULL;} + __pyx_r = __pyx_pf_5spacy_8pipeline_17_parser_internals_11_beam_utils_9BeamBatch_8get_unfinished_states(((struct __pyx_obj_5spacy_8pipeline_17_parser_internals_11_beam_utils_BeamBatch *)__pyx_v_self)); + + /* function exit code */ + __Pyx_RefNannyFinishContext(); + return __pyx_r; +} + +static PyObject *__pyx_pf_5spacy_8pipeline_17_parser_internals_11_beam_utils_9BeamBatch_8get_unfinished_states(struct __pyx_obj_5spacy_8pipeline_17_parser_internals_11_beam_utils_BeamBatch *__pyx_v_self) { + PyObject *__pyx_v_st = 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; + Py_ssize_t __pyx_t_5; + PyObject *(*__pyx_t_6)(PyObject *); + PyObject *__pyx_t_7 = NULL; + int __pyx_t_8; + int __pyx_t_9; + int __pyx_lineno = 0; + const char *__pyx_filename = NULL; + int __pyx_clineno = 0; + __Pyx_RefNannySetupContext("get_unfinished_states", 0); + + /* "spacy/pipeline/_parser_internals/_beam_utils.pyx":83 + * + * def get_unfinished_states(self): + * return [st for st in self.get_states() if not st.is_final()] # <<<<<<<<<<<<<< + * + * def advance(self, float[:, ::1] scores, follow_gold=False): +*/ + __Pyx_XDECREF(__pyx_r); + __pyx_t_1 = PyList_New(0); if (unlikely(!__pyx_t_1)) __PYX_ERR(0, 83, __pyx_L1_error) + __Pyx_GOTREF(__pyx_t_1); + __pyx_t_3 = ((PyObject *)__pyx_v_self); + __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_get_states, __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, 83, __pyx_L1_error) + __Pyx_GOTREF(__pyx_t_2); + } + if (likely(PyList_CheckExact(__pyx_t_2)) || PyTuple_CheckExact(__pyx_t_2)) { + __pyx_t_3 = __pyx_t_2; __Pyx_INCREF(__pyx_t_3); + __pyx_t_5 = 0; + __pyx_t_6 = NULL; + } else { + __pyx_t_5 = -1; __pyx_t_3 = PyObject_GetIter(__pyx_t_2); if (unlikely(!__pyx_t_3)) __PYX_ERR(0, 83, __pyx_L1_error) + __Pyx_GOTREF(__pyx_t_3); + __pyx_t_6 = (CYTHON_COMPILING_IN_LIMITED_API) ? PyIter_Next : __Pyx_PyObject_GetIterNextFunc(__pyx_t_3); if (unlikely(!__pyx_t_6)) __PYX_ERR(0, 83, __pyx_L1_error) + } + __Pyx_DECREF(__pyx_t_2); __pyx_t_2 = 0; + for (;;) { + if (likely(!__pyx_t_6)) { + 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, 83, __pyx_L1_error) + #endif + if (__pyx_t_5 >= __pyx_temp) break; + } + __pyx_t_2 = __Pyx_PyList_GetItemRefFast(__pyx_t_3, __pyx_t_5, __Pyx_ReferenceSharing_OwnStrongReference); + ++__pyx_t_5; + } 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, 83, __pyx_L1_error) + #endif + if (__pyx_t_5 >= __pyx_temp) break; + } + #if CYTHON_ASSUME_SAFE_MACROS && !CYTHON_AVOID_BORROWED_REFS + __pyx_t_2 = __Pyx_NewRef(PyTuple_GET_ITEM(__pyx_t_3, __pyx_t_5)); + #else + __pyx_t_2 = __Pyx_PySequence_ITEM(__pyx_t_3, __pyx_t_5); + #endif + ++__pyx_t_5; + } + if (unlikely(!__pyx_t_2)) __PYX_ERR(0, 83, __pyx_L1_error) + } else { + __pyx_t_2 = __pyx_t_6(__pyx_t_3); + 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, 83, __pyx_L1_error) + PyErr_Clear(); + } + break; + } + } + __Pyx_GOTREF(__pyx_t_2); + __Pyx_XDECREF_SET(__pyx_v_st, __pyx_t_2); + __pyx_t_2 = 0; + __pyx_t_7 = __pyx_v_st; + __Pyx_INCREF(__pyx_t_7); + __pyx_t_4 = 0; + { + PyObject *__pyx_callargs[2] = {__pyx_t_7, NULL}; + __pyx_t_2 = __Pyx_PyObject_FastCallMethod((PyObject*)__pyx_mstate_global->__pyx_n_u_is_final, __pyx_callargs+__pyx_t_4, (1-__pyx_t_4) | (1*__Pyx_PY_VECTORCALL_ARGUMENTS_OFFSET)); + __Pyx_XDECREF(__pyx_t_7); __pyx_t_7 = 0; + if (unlikely(!__pyx_t_2)) __PYX_ERR(0, 83, __pyx_L1_error) + __Pyx_GOTREF(__pyx_t_2); + } + __pyx_t_8 = __Pyx_PyObject_IsTrue(__pyx_t_2); if (unlikely((__pyx_t_8 < 0))) __PYX_ERR(0, 83, __pyx_L1_error) + __Pyx_DECREF(__pyx_t_2); __pyx_t_2 = 0; + __pyx_t_9 = (!__pyx_t_8); + if (__pyx_t_9) { + if (unlikely(__Pyx_ListComp_Append(__pyx_t_1, (PyObject*)__pyx_v_st))) __PYX_ERR(0, 83, __pyx_L1_error) + } + } + __Pyx_DECREF(__pyx_t_3); __pyx_t_3 = 0; + __pyx_r = __pyx_t_1; + __pyx_t_1 = 0; + goto __pyx_L0; + + /* "spacy/pipeline/_parser_internals/_beam_utils.pyx":82 + * return states + * + * def get_unfinished_states(self): # <<<<<<<<<<<<<< + * return [st for st in self.get_states() if not st.is_final()] + * +*/ + + /* 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("spacy.pipeline._parser_internals._beam_utils.BeamBatch.get_unfinished_states", __pyx_clineno, __pyx_lineno, __pyx_filename); + __pyx_r = NULL; + __pyx_L0:; + __Pyx_XDECREF(__pyx_v_st); + __Pyx_XGIVEREF(__pyx_r); + __Pyx_RefNannyFinishContext(); + return __pyx_r; +} + +/* "spacy/pipeline/_parser_internals/_beam_utils.pyx":85 + * return [st for st in self.get_states() if not st.is_final()] + * + * def advance(self, float[:, ::1] scores, follow_gold=False): # <<<<<<<<<<<<<< + * cdef Beam beam + * cdef int nr_class = scores.shape[1] +*/ + +/* Python wrapper */ +static PyObject *__pyx_pw_5spacy_8pipeline_17_parser_internals_11_beam_utils_9BeamBatch_11advance(PyObject *__pyx_v_self, +#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_5spacy_8pipeline_17_parser_internals_11_beam_utils_9BeamBatch_10advance, "BeamBatch.advance(self, float[:, ::1] scores, follow_gold=False)"); +static PyMethodDef __pyx_mdef_5spacy_8pipeline_17_parser_internals_11_beam_utils_9BeamBatch_11advance = {"advance", (PyCFunction)(void(*)(void))(__Pyx_PyCFunction_FastCallWithKeywords)__pyx_pw_5spacy_8pipeline_17_parser_internals_11_beam_utils_9BeamBatch_11advance, __Pyx_METH_FASTCALL|METH_KEYWORDS, __pyx_doc_5spacy_8pipeline_17_parser_internals_11_beam_utils_9BeamBatch_10advance}; +static PyObject *__pyx_pw_5spacy_8pipeline_17_parser_internals_11_beam_utils_9BeamBatch_11advance(PyObject *__pyx_v_self, +#if CYTHON_METH_FASTCALL +PyObject *const *__pyx_args, Py_ssize_t __pyx_nargs, PyObject *__pyx_kwds +#else +PyObject *__pyx_args, PyObject *__pyx_kwds +#endif +) { + __Pyx_memviewslice __pyx_v_scores = { 0, 0, { 0 }, { 0 }, { 0 } }; + PyObject *__pyx_v_follow_gold = 0; + #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("advance (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_scores,&__pyx_mstate_global->__pyx_n_u_follow_gold,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, 85, __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, 85, __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, 85, __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, "advance", 0) < (0)) __PYX_ERR(0, 85, __pyx_L3_error) + if (!values[1]) values[1] = __Pyx_NewRef(((PyObject *)Py_False)); + for (Py_ssize_t i = __pyx_nargs; i < 1; i++) { + if (unlikely(!values[i])) { __Pyx_RaiseArgtupleInvalid("advance", 0, 1, 2, i); __PYX_ERR(0, 85, __pyx_L3_error) } + } + } else { + switch (__pyx_nargs) { + case 2: + values[1] = __Pyx_ArgRef_FASTCALL(__pyx_args, 1); + if (!CYTHON_ASSUME_SAFE_MACROS && unlikely(!values[1])) __PYX_ERR(0, 85, __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, 85, __pyx_L3_error) + break; + default: goto __pyx_L5_argtuple_error; + } + if (!values[1]) values[1] = __Pyx_NewRef(((PyObject *)Py_False)); + } + __pyx_v_scores = __Pyx_PyObject_to_MemoryviewSlice_d_dc_float(values[0], PyBUF_WRITABLE); if (unlikely(!__pyx_v_scores.memview)) __PYX_ERR(0, 85, __pyx_L3_error) + __pyx_v_follow_gold = values[1]; + } + goto __pyx_L6_skip; + __pyx_L5_argtuple_error:; + __Pyx_RaiseArgtupleInvalid("advance", 0, 1, 2, __pyx_nargs); __PYX_ERR(0, 85, __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_XCLEAR_MEMVIEW(&__pyx_v_scores, 1); + __Pyx_AddTraceback("spacy.pipeline._parser_internals._beam_utils.BeamBatch.advance", __pyx_clineno, __pyx_lineno, __pyx_filename); + __Pyx_RefNannyFinishContext(); + return NULL; + __pyx_L4_argument_unpacking_done:; + __pyx_r = __pyx_pf_5spacy_8pipeline_17_parser_internals_11_beam_utils_9BeamBatch_10advance(((struct __pyx_obj_5spacy_8pipeline_17_parser_internals_11_beam_utils_BeamBatch *)__pyx_v_self), __pyx_v_scores, __pyx_v_follow_gold); + + /* 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_XCLEAR_MEMVIEW(&__pyx_v_scores, 1); + __Pyx_RefNannyFinishContext(); + return __pyx_r; +} + +static PyObject *__pyx_pf_5spacy_8pipeline_17_parser_internals_11_beam_utils_9BeamBatch_10advance(struct __pyx_obj_5spacy_8pipeline_17_parser_internals_11_beam_utils_BeamBatch *__pyx_v_self, __Pyx_memviewslice __pyx_v_scores, PyObject *__pyx_v_follow_gold) { + struct __pyx_obj_5thinc_5extra_6search_Beam *__pyx_v_beam = 0; + int __pyx_v_nr_class; + float const *__pyx_v_c_scores; + PyObject *__pyx_v_docs = NULL; + PyObject *__pyx_v_i = NULL; + int __pyx_v_nr_state; + PyObject *__pyx_r = NULL; + __Pyx_RefNannyDeclarations + Py_ssize_t __pyx_t_1; + Py_ssize_t __pyx_t_2; + int __pyx_t_3; + PyObject *__pyx_t_4 = NULL; + PyObject *__pyx_t_5 = NULL; + Py_ssize_t __pyx_t_6; + PyObject *(*__pyx_t_7)(PyObject *); + PyObject *__pyx_t_8 = NULL; + int __pyx_t_9; + PyObject *__pyx_t_10 = NULL; + PyObject *__pyx_t_11 = NULL; + PyObject *__pyx_t_12 = NULL; + size_t __pyx_t_13; + PyObject *__pyx_t_14 = NULL; + int __pyx_lineno = 0; + const char *__pyx_filename = NULL; + int __pyx_clineno = 0; + __Pyx_RefNannySetupContext("advance", 0); + + /* "spacy/pipeline/_parser_internals/_beam_utils.pyx":87 + * def advance(self, float[:, ::1] scores, follow_gold=False): + * cdef Beam beam + * cdef int nr_class = scores.shape[1] # <<<<<<<<<<<<<< + * cdef const float* c_scores = &scores[0, 0] + * docs = self.docs +*/ + __pyx_v_nr_class = (__pyx_v_scores.shape[1]); + + /* "spacy/pipeline/_parser_internals/_beam_utils.pyx":88 + * cdef Beam beam + * cdef int nr_class = scores.shape[1] + * cdef const float* c_scores = &scores[0, 0] # <<<<<<<<<<<<<< + * docs = self.docs + * for i, beam in enumerate(self): +*/ + __pyx_t_1 = 0; + __pyx_t_2 = 0; + __pyx_t_3 = -1; + if (__pyx_t_1 < 0) { + __pyx_t_1 += __pyx_v_scores.shape[0]; + if (unlikely(__pyx_t_1 < 0)) __pyx_t_3 = 0; + } else if (unlikely(__pyx_t_1 >= __pyx_v_scores.shape[0])) __pyx_t_3 = 0; + if (__pyx_t_2 < 0) { + __pyx_t_2 += __pyx_v_scores.shape[1]; + if (unlikely(__pyx_t_2 < 0)) __pyx_t_3 = 1; + } else if (unlikely(__pyx_t_2 >= __pyx_v_scores.shape[1])) __pyx_t_3 = 1; + if (unlikely(__pyx_t_3 != -1)) { + __Pyx_RaiseBufferIndexError(__pyx_t_3); + __PYX_ERR(0, 88, __pyx_L1_error) + } + __pyx_v_c_scores = (&(*((float *) ( /* dim=1 */ ((char *) (((float *) ( /* dim=0 */ (__pyx_v_scores.data + __pyx_t_1 * __pyx_v_scores.strides[0]) )) + __pyx_t_2)) )))); + + /* "spacy/pipeline/_parser_internals/_beam_utils.pyx":89 + * cdef int nr_class = scores.shape[1] + * cdef const float* c_scores = &scores[0, 0] + * docs = self.docs # <<<<<<<<<<<<<< + * for i, beam in enumerate(self): + * if not beam.is_done: +*/ + __pyx_t_4 = __pyx_v_self->docs; + __Pyx_INCREF(__pyx_t_4); + __pyx_v_docs = __pyx_t_4; + __pyx_t_4 = 0; + + /* "spacy/pipeline/_parser_internals/_beam_utils.pyx":90 + * cdef const float* c_scores = &scores[0, 0] + * docs = self.docs + * for i, beam in enumerate(self): # <<<<<<<<<<<<<< + * if not beam.is_done: + * nr_state = self._set_scores(beam, c_scores, nr_class) +*/ + __Pyx_INCREF(__pyx_mstate_global->__pyx_int_0); + __pyx_t_4 = __pyx_mstate_global->__pyx_int_0; + if (likely(PyList_CheckExact(((PyObject *)__pyx_v_self))) || PyTuple_CheckExact(((PyObject *)__pyx_v_self))) { + __pyx_t_5 = ((PyObject *)__pyx_v_self); __Pyx_INCREF(__pyx_t_5); + __pyx_t_6 = 0; + __pyx_t_7 = NULL; + } else { + __pyx_t_6 = -1; __pyx_t_5 = PyObject_GetIter(((PyObject *)__pyx_v_self)); if (unlikely(!__pyx_t_5)) __PYX_ERR(0, 90, __pyx_L1_error) + __Pyx_GOTREF(__pyx_t_5); + __pyx_t_7 = (CYTHON_COMPILING_IN_LIMITED_API) ? PyIter_Next : __Pyx_PyObject_GetIterNextFunc(__pyx_t_5); if (unlikely(!__pyx_t_7)) __PYX_ERR(0, 90, __pyx_L1_error) + } + for (;;) { + if (likely(!__pyx_t_7)) { + if (likely(PyList_CheckExact(__pyx_t_5))) { + { + Py_ssize_t __pyx_temp = __Pyx_PyList_GET_SIZE(__pyx_t_5); + #if !CYTHON_ASSUME_SAFE_SIZE + if (unlikely((__pyx_temp < 0))) __PYX_ERR(0, 90, __pyx_L1_error) + #endif + if (__pyx_t_6 >= __pyx_temp) break; + } + __pyx_t_8 = __Pyx_PyList_GetItemRefFast(__pyx_t_5, __pyx_t_6, __Pyx_ReferenceSharing_OwnStrongReference); + ++__pyx_t_6; + } else { + { + Py_ssize_t __pyx_temp = __Pyx_PyTuple_GET_SIZE(__pyx_t_5); + #if !CYTHON_ASSUME_SAFE_SIZE + if (unlikely((__pyx_temp < 0))) __PYX_ERR(0, 90, __pyx_L1_error) + #endif + if (__pyx_t_6 >= __pyx_temp) break; + } + #if CYTHON_ASSUME_SAFE_MACROS && !CYTHON_AVOID_BORROWED_REFS + __pyx_t_8 = __Pyx_NewRef(PyTuple_GET_ITEM(__pyx_t_5, __pyx_t_6)); + #else + __pyx_t_8 = __Pyx_PySequence_ITEM(__pyx_t_5, __pyx_t_6); + #endif + ++__pyx_t_6; + } + if (unlikely(!__pyx_t_8)) __PYX_ERR(0, 90, __pyx_L1_error) + } else { + __pyx_t_8 = __pyx_t_7(__pyx_t_5); + if (unlikely(!__pyx_t_8)) { + PyObject* exc_type = PyErr_Occurred(); + if (exc_type) { + if (unlikely(!__Pyx_PyErr_GivenExceptionMatches(exc_type, PyExc_StopIteration))) __PYX_ERR(0, 90, __pyx_L1_error) + PyErr_Clear(); + } + break; + } + } + __Pyx_GOTREF(__pyx_t_8); + if (!(likely(((__pyx_t_8) == Py_None) || likely(__Pyx_TypeTest(__pyx_t_8, __pyx_mstate_global->__pyx_ptype_5thinc_5extra_6search_Beam))))) __PYX_ERR(0, 90, __pyx_L1_error) + __Pyx_XDECREF_SET(__pyx_v_beam, ((struct __pyx_obj_5thinc_5extra_6search_Beam *)__pyx_t_8)); + __pyx_t_8 = 0; + __Pyx_INCREF(__pyx_t_4); + __Pyx_XDECREF_SET(__pyx_v_i, __pyx_t_4); + __pyx_t_8 = __Pyx_PyLong_AddObjC(__pyx_t_4, __pyx_mstate_global->__pyx_int_1, 1, 0, 0); if (unlikely(!__pyx_t_8)) __PYX_ERR(0, 90, __pyx_L1_error) + __Pyx_GOTREF(__pyx_t_8); + __Pyx_DECREF(__pyx_t_4); + __pyx_t_4 = __pyx_t_8; + __pyx_t_8 = 0; + + /* "spacy/pipeline/_parser_internals/_beam_utils.pyx":91 + * docs = self.docs + * for i, beam in enumerate(self): + * if not beam.is_done: # <<<<<<<<<<<<<< + * nr_state = self._set_scores(beam, c_scores, nr_class) + * assert nr_state +*/ + __pyx_t_9 = (!__pyx_v_beam->is_done); + if (__pyx_t_9) { + + /* "spacy/pipeline/_parser_internals/_beam_utils.pyx":92 + * for i, beam in enumerate(self): + * if not beam.is_done: + * nr_state = self._set_scores(beam, c_scores, nr_class) # <<<<<<<<<<<<<< + * assert nr_state + * if self.golds is not None: +*/ + __pyx_t_3 = ((struct __pyx_vtabstruct_5spacy_8pipeline_17_parser_internals_11_beam_utils_BeamBatch *)__pyx_v_self->__pyx_vtab)->_set_scores(__pyx_v_self, __pyx_v_beam, __pyx_v_c_scores, __pyx_v_nr_class); if (unlikely(__pyx_t_3 == ((int)-1))) __PYX_ERR(0, 92, __pyx_L1_error) + __pyx_v_nr_state = __pyx_t_3; + + /* "spacy/pipeline/_parser_internals/_beam_utils.pyx":93 + * if not beam.is_done: + * nr_state = self._set_scores(beam, c_scores, nr_class) + * assert nr_state # <<<<<<<<<<<<<< + * if self.golds is not None: + * self._set_costs( +*/ + #ifndef CYTHON_WITHOUT_ASSERTIONS + if (unlikely(__pyx_assertions_enabled())) { + __pyx_t_9 = (__pyx_v_nr_state != 0); + if (unlikely(!__pyx_t_9)) { + __Pyx_Raise(((PyObject *)(((PyTypeObject*)PyExc_AssertionError))), 0, 0, 0); + __PYX_ERR(0, 93, __pyx_L1_error) + } + } + #else + if ((1)); else __PYX_ERR(0, 93, __pyx_L1_error) + #endif + + /* "spacy/pipeline/_parser_internals/_beam_utils.pyx":94 + * nr_state = self._set_scores(beam, c_scores, nr_class) + * assert nr_state + * if self.golds is not None: # <<<<<<<<<<<<<< + * self._set_costs( + * beam, +*/ + __pyx_t_9 = (__pyx_v_self->golds != Py_None); + if (__pyx_t_9) { + + /* "spacy/pipeline/_parser_internals/_beam_utils.pyx":95 + * assert nr_state + * if self.golds is not None: + * self._set_costs( # <<<<<<<<<<<<<< + * beam, + * docs[i], +*/ + __pyx_t_10 = ((PyObject *)__pyx_v_self); + __Pyx_INCREF(__pyx_t_10); + + /* "spacy/pipeline/_parser_internals/_beam_utils.pyx":97 + * self._set_costs( + * beam, + * docs[i], # <<<<<<<<<<<<<< + * self.golds[i], + * follow_gold=follow_gold +*/ + __pyx_t_11 = __Pyx_PyObject_GetItem(__pyx_v_docs, __pyx_v_i); if (unlikely(!__pyx_t_11)) __PYX_ERR(0, 97, __pyx_L1_error) + __Pyx_GOTREF(__pyx_t_11); + + /* "spacy/pipeline/_parser_internals/_beam_utils.pyx":98 + * beam, + * docs[i], + * self.golds[i], # <<<<<<<<<<<<<< + * follow_gold=follow_gold + * ) +*/ + __pyx_t_12 = __Pyx_PyObject_GetItem(__pyx_v_self->golds, __pyx_v_i); if (unlikely(!__pyx_t_12)) __PYX_ERR(0, 98, __pyx_L1_error) + __Pyx_GOTREF(__pyx_t_12); + + /* "spacy/pipeline/_parser_internals/_beam_utils.pyx":99 + * docs[i], + * self.golds[i], + * follow_gold=follow_gold # <<<<<<<<<<<<<< + * ) + * c_scores += nr_state * nr_class +*/ + __pyx_t_13 = 0; + { + PyObject *__pyx_callargs[4 + ((CYTHON_VECTORCALL) ? 1 : 0)] = {__pyx_t_10, ((PyObject *)__pyx_v_beam), __pyx_t_11, __pyx_t_12}; + __pyx_t_14 = __Pyx_MakeVectorcallBuilderKwds(1); if (unlikely(!__pyx_t_14)) __PYX_ERR(0, 95, __pyx_L1_error) + __Pyx_GOTREF(__pyx_t_14); + if (__Pyx_VectorcallBuilder_AddArg(__pyx_mstate_global->__pyx_n_u_follow_gold, __pyx_v_follow_gold, __pyx_t_14, __pyx_callargs+4, 0) < (0)) __PYX_ERR(0, 95, __pyx_L1_error) + __pyx_t_8 = __Pyx_Object_VectorcallMethod_CallFromBuilder((PyObject*)__pyx_mstate_global->__pyx_n_u_set_costs, __pyx_callargs+__pyx_t_13, (4-__pyx_t_13) | (1*__Pyx_PY_VECTORCALL_ARGUMENTS_OFFSET), __pyx_t_14); + __Pyx_XDECREF(__pyx_t_10); __pyx_t_10 = 0; + __Pyx_DECREF(__pyx_t_11); __pyx_t_11 = 0; + __Pyx_DECREF(__pyx_t_12); __pyx_t_12 = 0; + __Pyx_DECREF(__pyx_t_14); __pyx_t_14 = 0; + if (unlikely(!__pyx_t_8)) __PYX_ERR(0, 95, __pyx_L1_error) + __Pyx_GOTREF(__pyx_t_8); + } + __Pyx_DECREF(__pyx_t_8); __pyx_t_8 = 0; + + /* "spacy/pipeline/_parser_internals/_beam_utils.pyx":94 + * nr_state = self._set_scores(beam, c_scores, nr_class) + * assert nr_state + * if self.golds is not None: # <<<<<<<<<<<<<< + * self._set_costs( + * beam, +*/ + } + + /* "spacy/pipeline/_parser_internals/_beam_utils.pyx":101 + * follow_gold=follow_gold + * ) + * c_scores += nr_state * nr_class # <<<<<<<<<<<<<< + * beam.advance(transition_state, NULL, self.moves.c) + * beam.check_done(check_final_state, NULL) +*/ + __pyx_v_c_scores = (__pyx_v_c_scores + (__pyx_v_nr_state * __pyx_v_nr_class)); + + /* "spacy/pipeline/_parser_internals/_beam_utils.pyx":102 + * ) + * c_scores += nr_state * nr_class + * beam.advance(transition_state, NULL, self.moves.c) # <<<<<<<<<<<<<< + * beam.check_done(check_final_state, NULL) + * +*/ + __pyx_t_3 = ((struct __pyx_vtabstruct_5thinc_5extra_6search_Beam *)__pyx_v_beam->__pyx_vtab)->advance(__pyx_v_beam, __pyx_f_5spacy_8pipeline_17_parser_internals_11_beam_utils_transition_state, NULL, ((void *)__pyx_v_self->moves->c)); if (unlikely(__pyx_t_3 == ((int)-1))) __PYX_ERR(0, 102, __pyx_L1_error) + + /* "spacy/pipeline/_parser_internals/_beam_utils.pyx":103 + * c_scores += nr_state * nr_class + * beam.advance(transition_state, NULL, self.moves.c) + * beam.check_done(check_final_state, NULL) # <<<<<<<<<<<<<< + * + * cdef int _set_scores(self, Beam beam, const float* scores, int nr_class) except -1: +*/ + __pyx_t_3 = ((struct __pyx_vtabstruct_5thinc_5extra_6search_Beam *)__pyx_v_beam->__pyx_vtab)->check_done(__pyx_v_beam, __pyx_f_5spacy_8pipeline_17_parser_internals_11_beam_utils_check_final_state, NULL); if (unlikely(__pyx_t_3 == ((int)-1))) __PYX_ERR(0, 103, __pyx_L1_error) + + /* "spacy/pipeline/_parser_internals/_beam_utils.pyx":91 + * docs = self.docs + * for i, beam in enumerate(self): + * if not beam.is_done: # <<<<<<<<<<<<<< + * nr_state = self._set_scores(beam, c_scores, nr_class) + * assert nr_state +*/ + } + + /* "spacy/pipeline/_parser_internals/_beam_utils.pyx":90 + * cdef const float* c_scores = &scores[0, 0] + * docs = self.docs + * for i, beam in enumerate(self): # <<<<<<<<<<<<<< + * if not beam.is_done: + * nr_state = self._set_scores(beam, c_scores, nr_class) +*/ + } + __Pyx_DECREF(__pyx_t_5); __pyx_t_5 = 0; + __Pyx_DECREF(__pyx_t_4); __pyx_t_4 = 0; + + /* "spacy/pipeline/_parser_internals/_beam_utils.pyx":85 + * return [st for st in self.get_states() if not st.is_final()] + * + * def advance(self, float[:, ::1] scores, follow_gold=False): # <<<<<<<<<<<<<< + * cdef Beam beam + * cdef int nr_class = scores.shape[1] +*/ + + /* function exit code */ + __pyx_r = Py_None; __Pyx_INCREF(Py_None); + goto __pyx_L0; + __pyx_L1_error:; + __Pyx_XDECREF(__pyx_t_4); + __Pyx_XDECREF(__pyx_t_5); + __Pyx_XDECREF(__pyx_t_8); + __Pyx_XDECREF(__pyx_t_10); + __Pyx_XDECREF(__pyx_t_11); + __Pyx_XDECREF(__pyx_t_12); + __Pyx_XDECREF(__pyx_t_14); + __Pyx_AddTraceback("spacy.pipeline._parser_internals._beam_utils.BeamBatch.advance", __pyx_clineno, __pyx_lineno, __pyx_filename); + __pyx_r = NULL; + __pyx_L0:; + __Pyx_XDECREF((PyObject *)__pyx_v_beam); + __Pyx_XDECREF(__pyx_v_docs); + __Pyx_XDECREF(__pyx_v_i); + __Pyx_XGIVEREF(__pyx_r); + __Pyx_RefNannyFinishContext(); + return __pyx_r; +} + +/* "spacy/pipeline/_parser_internals/_beam_utils.pyx":105 + * beam.check_done(check_final_state, NULL) + * + * cdef int _set_scores(self, Beam beam, const float* scores, int nr_class) except -1: # <<<<<<<<<<<<<< + * cdef int nr_state = 0 + * for i in range(beam.size): +*/ + +static int __pyx_f_5spacy_8pipeline_17_parser_internals_11_beam_utils_9BeamBatch__set_scores(struct __pyx_obj_5spacy_8pipeline_17_parser_internals_11_beam_utils_BeamBatch *__pyx_v_self, struct __pyx_obj_5thinc_5extra_6search_Beam *__pyx_v_beam, float const *__pyx_v_scores, int __pyx_v_nr_class) { + int __pyx_v_nr_state; + __pyx_t_5thinc_5extra_6search_class_t __pyx_v_i; + __pyx_t_5spacy_8pipeline_17_parser_internals_6_state_StateC *__pyx_v_state; + __pyx_t_5thinc_5extra_6search_class_t __pyx_v_j; + int __pyx_r; + __pyx_t_5thinc_5extra_6search_class_t __pyx_t_1; + __pyx_t_5thinc_5extra_6search_class_t __pyx_t_2; + __pyx_t_5thinc_5extra_6search_class_t __pyx_t_3; + void *__pyx_t_4; + int __pyx_t_5; + int __pyx_t_6; + int __pyx_t_7; + __pyx_t_5thinc_5extra_6search_class_t __pyx_t_8; + __pyx_t_5thinc_5extra_6search_class_t __pyx_t_9; + __pyx_t_5thinc_5extra_6search_class_t __pyx_t_10; + int __pyx_lineno = 0; + const char *__pyx_filename = NULL; + int __pyx_clineno = 0; + + /* "spacy/pipeline/_parser_internals/_beam_utils.pyx":106 + * + * cdef int _set_scores(self, Beam beam, const float* scores, int nr_class) except -1: + * cdef int nr_state = 0 # <<<<<<<<<<<<<< + * for i in range(beam.size): + * state = beam.at(i) +*/ + __pyx_v_nr_state = 0; + + /* "spacy/pipeline/_parser_internals/_beam_utils.pyx":107 + * cdef int _set_scores(self, Beam beam, const float* scores, int nr_class) except -1: + * cdef int nr_state = 0 + * for i in range(beam.size): # <<<<<<<<<<<<<< + * state = beam.at(i) + * if not state.is_final(): +*/ + __pyx_t_1 = __pyx_v_beam->size; + __pyx_t_2 = __pyx_t_1; + for (__pyx_t_3 = 0; __pyx_t_3 < __pyx_t_2; __pyx_t_3+=1) { + __pyx_v_i = __pyx_t_3; + + /* "spacy/pipeline/_parser_internals/_beam_utils.pyx":108 + * cdef int nr_state = 0 + * for i in range(beam.size): + * state = beam.at(i) # <<<<<<<<<<<<<< + * if not state.is_final(): + * for j in range(nr_class): +*/ + __pyx_t_4 = __pyx_f_5thinc_5extra_6search_4Beam_at(__pyx_v_beam, __pyx_v_i); if (unlikely(PyErr_Occurred())) __PYX_ERR(0, 108, __pyx_L1_error) + __pyx_v_state = ((__pyx_t_5spacy_8pipeline_17_parser_internals_6_state_StateC *)__pyx_t_4); + + /* "spacy/pipeline/_parser_internals/_beam_utils.pyx":109 + * for i in range(beam.size): + * state = beam.at(i) + * if not state.is_final(): # <<<<<<<<<<<<<< + * for j in range(nr_class): + * beam.scores[i][j] = scores[nr_state * nr_class + j] +*/ + __pyx_t_5 = (!__pyx_v_state->is_final()); + if (__pyx_t_5) { + + /* "spacy/pipeline/_parser_internals/_beam_utils.pyx":110 + * state = beam.at(i) + * if not state.is_final(): + * for j in range(nr_class): # <<<<<<<<<<<<<< + * beam.scores[i][j] = scores[nr_state * nr_class + j] + * self.moves.set_valid(beam.is_valid[i], state) +*/ + __pyx_t_6 = __pyx_v_nr_class; + __pyx_t_7 = __pyx_t_6; + for (__pyx_t_8 = 0; __pyx_t_8 < __pyx_t_7; __pyx_t_8+=1) { + __pyx_v_j = __pyx_t_8; + + /* "spacy/pipeline/_parser_internals/_beam_utils.pyx":111 + * if not state.is_final(): + * for j in range(nr_class): + * beam.scores[i][j] = scores[nr_state * nr_class + j] # <<<<<<<<<<<<<< + * self.moves.set_valid(beam.is_valid[i], state) + * nr_state += 1 +*/ + ((__pyx_v_beam->scores[__pyx_v_i])[__pyx_v_j]) = (__pyx_v_scores[((__pyx_v_nr_state * __pyx_v_nr_class) + __pyx_v_j)]); + } + + /* "spacy/pipeline/_parser_internals/_beam_utils.pyx":112 + * for j in range(nr_class): + * beam.scores[i][j] = scores[nr_state * nr_class + j] + * self.moves.set_valid(beam.is_valid[i], state) # <<<<<<<<<<<<<< + * nr_state += 1 + * else: +*/ + (void)(((struct __pyx_vtabstruct_5spacy_8pipeline_17_parser_internals_17transition_system_TransitionSystem *)__pyx_v_self->moves->__pyx_vtab)->set_valid(__pyx_v_self->moves, (__pyx_v_beam->is_valid[__pyx_v_i]), __pyx_v_state)); + + /* "spacy/pipeline/_parser_internals/_beam_utils.pyx":113 + * beam.scores[i][j] = scores[nr_state * nr_class + j] + * self.moves.set_valid(beam.is_valid[i], state) + * nr_state += 1 # <<<<<<<<<<<<<< + * else: + * for j in range(beam.nr_class): +*/ + __pyx_v_nr_state = (__pyx_v_nr_state + 1); + + /* "spacy/pipeline/_parser_internals/_beam_utils.pyx":109 + * for i in range(beam.size): + * state = beam.at(i) + * if not state.is_final(): # <<<<<<<<<<<<<< + * for j in range(nr_class): + * beam.scores[i][j] = scores[nr_state * nr_class + j] +*/ + goto __pyx_L5; + } + + /* "spacy/pipeline/_parser_internals/_beam_utils.pyx":115 + * nr_state += 1 + * else: + * for j in range(beam.nr_class): # <<<<<<<<<<<<<< + * beam.scores[i][j] = 0 + * beam.costs[i][j] = 0 +*/ + /*else*/ { + __pyx_t_8 = __pyx_v_beam->nr_class; + __pyx_t_9 = __pyx_t_8; + for (__pyx_t_10 = 0; __pyx_t_10 < __pyx_t_9; __pyx_t_10+=1) { + __pyx_v_j = __pyx_t_10; + + /* "spacy/pipeline/_parser_internals/_beam_utils.pyx":116 + * else: + * for j in range(beam.nr_class): + * beam.scores[i][j] = 0 # <<<<<<<<<<<<<< + * beam.costs[i][j] = 0 + * return nr_state +*/ + ((__pyx_v_beam->scores[__pyx_v_i])[__pyx_v_j]) = 0.0; + + /* "spacy/pipeline/_parser_internals/_beam_utils.pyx":117 + * for j in range(beam.nr_class): + * beam.scores[i][j] = 0 + * beam.costs[i][j] = 0 # <<<<<<<<<<<<<< + * return nr_state + * +*/ + ((__pyx_v_beam->costs[__pyx_v_i])[__pyx_v_j]) = 0.0; + } + } + __pyx_L5:; + } + + /* "spacy/pipeline/_parser_internals/_beam_utils.pyx":118 + * beam.scores[i][j] = 0 + * beam.costs[i][j] = 0 + * return nr_state # <<<<<<<<<<<<<< + * + * def _set_costs(self, Beam beam, doc, gold, int follow_gold=False): +*/ + __pyx_r = __pyx_v_nr_state; + goto __pyx_L0; + + /* "spacy/pipeline/_parser_internals/_beam_utils.pyx":105 + * beam.check_done(check_final_state, NULL) + * + * cdef int _set_scores(self, Beam beam, const float* scores, int nr_class) except -1: # <<<<<<<<<<<<<< + * cdef int nr_state = 0 + * for i in range(beam.size): +*/ + + /* function exit code */ + __pyx_L1_error:; + __Pyx_AddTraceback("spacy.pipeline._parser_internals._beam_utils.BeamBatch._set_scores", __pyx_clineno, __pyx_lineno, __pyx_filename); + __pyx_r = -1; + __pyx_L0:; + return __pyx_r; +} + +/* "spacy/pipeline/_parser_internals/_beam_utils.pyx":120 + * return nr_state + * + * def _set_costs(self, Beam beam, doc, gold, int follow_gold=False): # <<<<<<<<<<<<<< + * cdef const StateC* state + * for i in range(beam.size): +*/ + +/* Python wrapper */ +static PyObject *__pyx_pw_5spacy_8pipeline_17_parser_internals_11_beam_utils_9BeamBatch_13_set_costs(PyObject *__pyx_v_self, +#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_5spacy_8pipeline_17_parser_internals_11_beam_utils_9BeamBatch_12_set_costs, "BeamBatch._set_costs(self, Beam beam, doc, gold, int follow_gold=False)"); +static PyMethodDef __pyx_mdef_5spacy_8pipeline_17_parser_internals_11_beam_utils_9BeamBatch_13_set_costs = {"_set_costs", (PyCFunction)(void(*)(void))(__Pyx_PyCFunction_FastCallWithKeywords)__pyx_pw_5spacy_8pipeline_17_parser_internals_11_beam_utils_9BeamBatch_13_set_costs, __Pyx_METH_FASTCALL|METH_KEYWORDS, __pyx_doc_5spacy_8pipeline_17_parser_internals_11_beam_utils_9BeamBatch_12_set_costs}; +static PyObject *__pyx_pw_5spacy_8pipeline_17_parser_internals_11_beam_utils_9BeamBatch_13_set_costs(PyObject *__pyx_v_self, +#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_5thinc_5extra_6search_Beam *__pyx_v_beam = 0; + CYTHON_UNUSED PyObject *__pyx_v_doc = 0; + PyObject *__pyx_v_gold = 0; + int __pyx_v_follow_gold; + #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("_set_costs (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_beam,&__pyx_mstate_global->__pyx_n_u_doc,&__pyx_mstate_global->__pyx_n_u_gold,&__pyx_mstate_global->__pyx_n_u_follow_gold,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, 120, __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, 120, __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, 120, __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, 120, __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, 120, __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, "_set_costs", 0) < (0)) __PYX_ERR(0, 120, __pyx_L3_error) + for (Py_ssize_t i = __pyx_nargs; i < 3; i++) { + if (unlikely(!values[i])) { __Pyx_RaiseArgtupleInvalid("_set_costs", 0, 3, 4, i); __PYX_ERR(0, 120, __pyx_L3_error) } + } + } else { + switch (__pyx_nargs) { + case 4: + values[3] = __Pyx_ArgRef_FASTCALL(__pyx_args, 3); + if (!CYTHON_ASSUME_SAFE_MACROS && unlikely(!values[3])) __PYX_ERR(0, 120, __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, 120, __pyx_L3_error) + values[1] = __Pyx_ArgRef_FASTCALL(__pyx_args, 1); + if (!CYTHON_ASSUME_SAFE_MACROS && unlikely(!values[1])) __PYX_ERR(0, 120, __pyx_L3_error) + values[0] = __Pyx_ArgRef_FASTCALL(__pyx_args, 0); + if (!CYTHON_ASSUME_SAFE_MACROS && unlikely(!values[0])) __PYX_ERR(0, 120, __pyx_L3_error) + break; + default: goto __pyx_L5_argtuple_error; + } + } + __pyx_v_beam = ((struct __pyx_obj_5thinc_5extra_6search_Beam *)values[0]); + __pyx_v_doc = values[1]; + __pyx_v_gold = values[2]; + if (values[3]) { + __pyx_v_follow_gold = __Pyx_PyLong_As_int(values[3]); if (unlikely((__pyx_v_follow_gold == (int)-1) && PyErr_Occurred())) __PYX_ERR(0, 120, __pyx_L3_error) + } else { + __pyx_v_follow_gold = ((int)0); + } + } + goto __pyx_L6_skip; + __pyx_L5_argtuple_error:; + __Pyx_RaiseArgtupleInvalid("_set_costs", 0, 3, 4, __pyx_nargs); __PYX_ERR(0, 120, __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("spacy.pipeline._parser_internals._beam_utils.BeamBatch._set_costs", __pyx_clineno, __pyx_lineno, __pyx_filename); + __Pyx_RefNannyFinishContext(); + return NULL; + __pyx_L4_argument_unpacking_done:; + if (unlikely(!__Pyx_ArgTypeTest(((PyObject *)__pyx_v_beam), __pyx_mstate_global->__pyx_ptype_5thinc_5extra_6search_Beam, 1, "beam", 0))) __PYX_ERR(0, 120, __pyx_L1_error) + __pyx_r = __pyx_pf_5spacy_8pipeline_17_parser_internals_11_beam_utils_9BeamBatch_12_set_costs(((struct __pyx_obj_5spacy_8pipeline_17_parser_internals_11_beam_utils_BeamBatch *)__pyx_v_self), __pyx_v_beam, __pyx_v_doc, __pyx_v_gold, __pyx_v_follow_gold); + + /* 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_5spacy_8pipeline_17_parser_internals_11_beam_utils_9BeamBatch_12_set_costs(struct __pyx_obj_5spacy_8pipeline_17_parser_internals_11_beam_utils_BeamBatch *__pyx_v_self, struct __pyx_obj_5thinc_5extra_6search_Beam *__pyx_v_beam, CYTHON_UNUSED PyObject *__pyx_v_doc, PyObject *__pyx_v_gold, int __pyx_v_follow_gold) { + __pyx_t_5spacy_8pipeline_17_parser_internals_6_state_StateC const *__pyx_v_state; + __pyx_t_5thinc_5extra_6search_class_t __pyx_v_i; + __pyx_t_5thinc_5extra_6search_class_t __pyx_v_j; + __pyx_t_5thinc_5extra_6search_weight_t __pyx_v_min_cost; + PyObject *__pyx_r = NULL; + __Pyx_RefNannyDeclarations + __pyx_t_5thinc_5extra_6search_class_t __pyx_t_1; + __pyx_t_5thinc_5extra_6search_class_t __pyx_t_2; + __pyx_t_5thinc_5extra_6search_class_t __pyx_t_3; + void *__pyx_t_4; + int __pyx_t_5; + __pyx_t_5thinc_5extra_6search_class_t __pyx_t_6; + __pyx_t_5thinc_5extra_6search_class_t __pyx_t_7; + __pyx_t_5thinc_5extra_6search_class_t __pyx_t_8; + int __pyx_t_9; + int __pyx_t_10; + int __pyx_lineno = 0; + const char *__pyx_filename = NULL; + int __pyx_clineno = 0; + __Pyx_RefNannySetupContext("_set_costs", 0); + + /* "spacy/pipeline/_parser_internals/_beam_utils.pyx":122 + * def _set_costs(self, Beam beam, doc, gold, int follow_gold=False): + * cdef const StateC* state + * for i in range(beam.size): # <<<<<<<<<<<<<< + * state = beam.at(i) + * if state.is_final(): +*/ + __pyx_t_1 = __pyx_v_beam->size; + __pyx_t_2 = __pyx_t_1; + for (__pyx_t_3 = 0; __pyx_t_3 < __pyx_t_2; __pyx_t_3+=1) { + __pyx_v_i = __pyx_t_3; + + /* "spacy/pipeline/_parser_internals/_beam_utils.pyx":123 + * cdef const StateC* state + * for i in range(beam.size): + * state = beam.at(i) # <<<<<<<<<<<<<< + * if state.is_final(): + * for j in range(beam.nr_class): +*/ + __pyx_t_4 = __pyx_f_5thinc_5extra_6search_4Beam_at(__pyx_v_beam, __pyx_v_i); if (unlikely(PyErr_Occurred())) __PYX_ERR(0, 123, __pyx_L1_error) + __pyx_v_state = ((__pyx_t_5spacy_8pipeline_17_parser_internals_6_state_StateC const *)__pyx_t_4); + + /* "spacy/pipeline/_parser_internals/_beam_utils.pyx":124 + * for i in range(beam.size): + * state = beam.at(i) + * if state.is_final(): # <<<<<<<<<<<<<< + * for j in range(beam.nr_class): + * beam.is_valid[i][j] = 0 +*/ + __pyx_t_5 = __pyx_v_state->is_final(); + if (__pyx_t_5) { + + /* "spacy/pipeline/_parser_internals/_beam_utils.pyx":125 + * state = beam.at(i) + * if state.is_final(): + * for j in range(beam.nr_class): # <<<<<<<<<<<<<< + * beam.is_valid[i][j] = 0 + * beam.costs[i][j] = 9000 +*/ + __pyx_t_6 = __pyx_v_beam->nr_class; + __pyx_t_7 = __pyx_t_6; + for (__pyx_t_8 = 0; __pyx_t_8 < __pyx_t_7; __pyx_t_8+=1) { + __pyx_v_j = __pyx_t_8; + + /* "spacy/pipeline/_parser_internals/_beam_utils.pyx":126 + * if state.is_final(): + * for j in range(beam.nr_class): + * beam.is_valid[i][j] = 0 # <<<<<<<<<<<<<< + * beam.costs[i][j] = 9000 + * else: +*/ + ((__pyx_v_beam->is_valid[__pyx_v_i])[__pyx_v_j]) = 0; + + /* "spacy/pipeline/_parser_internals/_beam_utils.pyx":127 + * for j in range(beam.nr_class): + * beam.is_valid[i][j] = 0 + * beam.costs[i][j] = 9000 # <<<<<<<<<<<<<< + * else: + * self.moves.set_costs(beam.is_valid[i], beam.costs[i], +*/ + ((__pyx_v_beam->costs[__pyx_v_i])[__pyx_v_j]) = 9000.0; + } + + /* "spacy/pipeline/_parser_internals/_beam_utils.pyx":124 + * for i in range(beam.size): + * state = beam.at(i) + * if state.is_final(): # <<<<<<<<<<<<<< + * for j in range(beam.nr_class): + * beam.is_valid[i][j] = 0 +*/ + goto __pyx_L5; + } + + /* "spacy/pipeline/_parser_internals/_beam_utils.pyx":129 + * beam.costs[i][j] = 9000 + * else: + * self.moves.set_costs(beam.is_valid[i], beam.costs[i], # <<<<<<<<<<<<<< + * state, gold) + * if follow_gold: +*/ + /*else*/ { + + /* "spacy/pipeline/_parser_internals/_beam_utils.pyx":130 + * else: + * self.moves.set_costs(beam.is_valid[i], beam.costs[i], + * state, gold) # <<<<<<<<<<<<<< + * if follow_gold: + * min_cost = 0 +*/ + __pyx_t_9 = ((struct __pyx_vtabstruct_5spacy_8pipeline_17_parser_internals_17transition_system_TransitionSystem *)__pyx_v_self->moves->__pyx_vtab)->set_costs(__pyx_v_self->moves, (__pyx_v_beam->is_valid[__pyx_v_i]), (__pyx_v_beam->costs[__pyx_v_i]), __pyx_v_state, __pyx_v_gold); if (unlikely(__pyx_t_9 == ((int)-1))) __PYX_ERR(0, 129, __pyx_L1_error) + + /* "spacy/pipeline/_parser_internals/_beam_utils.pyx":131 + * self.moves.set_costs(beam.is_valid[i], beam.costs[i], + * state, gold) + * if follow_gold: # <<<<<<<<<<<<<< + * min_cost = 0 + * for j in range(beam.nr_class): +*/ + __pyx_t_5 = (__pyx_v_follow_gold != 0); + if (__pyx_t_5) { + + /* "spacy/pipeline/_parser_internals/_beam_utils.pyx":132 + * state, gold) + * if follow_gold: + * min_cost = 0 # <<<<<<<<<<<<<< + * for j in range(beam.nr_class): + * if beam.is_valid[i][j] and beam.costs[i][j] < min_cost: +*/ + __pyx_v_min_cost = 0.0; + + /* "spacy/pipeline/_parser_internals/_beam_utils.pyx":133 + * if follow_gold: + * min_cost = 0 + * for j in range(beam.nr_class): # <<<<<<<<<<<<<< + * if beam.is_valid[i][j] and beam.costs[i][j] < min_cost: + * min_cost = beam.costs[i][j] +*/ + __pyx_t_6 = __pyx_v_beam->nr_class; + __pyx_t_7 = __pyx_t_6; + for (__pyx_t_8 = 0; __pyx_t_8 < __pyx_t_7; __pyx_t_8+=1) { + __pyx_v_j = __pyx_t_8; + + /* "spacy/pipeline/_parser_internals/_beam_utils.pyx":134 + * min_cost = 0 + * for j in range(beam.nr_class): + * if beam.is_valid[i][j] and beam.costs[i][j] < min_cost: # <<<<<<<<<<<<<< + * min_cost = beam.costs[i][j] + * for j in range(beam.nr_class): +*/ + __pyx_t_10 = (((__pyx_v_beam->is_valid[__pyx_v_i])[__pyx_v_j]) != 0); + if (__pyx_t_10) { + } else { + __pyx_t_5 = __pyx_t_10; + goto __pyx_L12_bool_binop_done; + } + __pyx_t_10 = (((__pyx_v_beam->costs[__pyx_v_i])[__pyx_v_j]) < __pyx_v_min_cost); + __pyx_t_5 = __pyx_t_10; + __pyx_L12_bool_binop_done:; + if (__pyx_t_5) { + + /* "spacy/pipeline/_parser_internals/_beam_utils.pyx":135 + * for j in range(beam.nr_class): + * if beam.is_valid[i][j] and beam.costs[i][j] < min_cost: + * min_cost = beam.costs[i][j] # <<<<<<<<<<<<<< + * for j in range(beam.nr_class): + * if beam.costs[i][j] > min_cost: +*/ + __pyx_v_min_cost = ((__pyx_v_beam->costs[__pyx_v_i])[__pyx_v_j]); + + /* "spacy/pipeline/_parser_internals/_beam_utils.pyx":134 + * min_cost = 0 + * for j in range(beam.nr_class): + * if beam.is_valid[i][j] and beam.costs[i][j] < min_cost: # <<<<<<<<<<<<<< + * min_cost = beam.costs[i][j] + * for j in range(beam.nr_class): +*/ + } + } + + /* "spacy/pipeline/_parser_internals/_beam_utils.pyx":136 + * if beam.is_valid[i][j] and beam.costs[i][j] < min_cost: + * min_cost = beam.costs[i][j] + * for j in range(beam.nr_class): # <<<<<<<<<<<<<< + * if beam.costs[i][j] > min_cost: + * beam.is_valid[i][j] = 0 +*/ + __pyx_t_6 = __pyx_v_beam->nr_class; + __pyx_t_7 = __pyx_t_6; + for (__pyx_t_8 = 0; __pyx_t_8 < __pyx_t_7; __pyx_t_8+=1) { + __pyx_v_j = __pyx_t_8; + + /* "spacy/pipeline/_parser_internals/_beam_utils.pyx":137 + * min_cost = beam.costs[i][j] + * for j in range(beam.nr_class): + * if beam.costs[i][j] > min_cost: # <<<<<<<<<<<<<< + * beam.is_valid[i][j] = 0 + * +*/ + __pyx_t_5 = (((__pyx_v_beam->costs[__pyx_v_i])[__pyx_v_j]) > __pyx_v_min_cost); + if (__pyx_t_5) { + + /* "spacy/pipeline/_parser_internals/_beam_utils.pyx":138 + * for j in range(beam.nr_class): + * if beam.costs[i][j] > min_cost: + * beam.is_valid[i][j] = 0 # <<<<<<<<<<<<<< + * + * +*/ + ((__pyx_v_beam->is_valid[__pyx_v_i])[__pyx_v_j]) = 0; + + /* "spacy/pipeline/_parser_internals/_beam_utils.pyx":137 + * min_cost = beam.costs[i][j] + * for j in range(beam.nr_class): + * if beam.costs[i][j] > min_cost: # <<<<<<<<<<<<<< + * beam.is_valid[i][j] = 0 + * +*/ + } + } + + /* "spacy/pipeline/_parser_internals/_beam_utils.pyx":131 + * self.moves.set_costs(beam.is_valid[i], beam.costs[i], + * state, gold) + * if follow_gold: # <<<<<<<<<<<<<< + * min_cost = 0 + * for j in range(beam.nr_class): +*/ + } + } + __pyx_L5:; + } + + /* "spacy/pipeline/_parser_internals/_beam_utils.pyx":120 + * return nr_state + * + * def _set_costs(self, Beam beam, doc, gold, int follow_gold=False): # <<<<<<<<<<<<<< + * cdef const StateC* state + * for i in range(beam.size): +*/ + + /* function exit code */ + __pyx_r = Py_None; __Pyx_INCREF(Py_None); + goto __pyx_L0; + __pyx_L1_error:; + __Pyx_AddTraceback("spacy.pipeline._parser_internals._beam_utils.BeamBatch._set_costs", __pyx_clineno, __pyx_lineno, __pyx_filename); + __pyx_r = NULL; + __pyx_L0:; + __Pyx_XGIVEREF(__pyx_r); + __Pyx_RefNannyFinishContext(); + return __pyx_r; +} + +/* "spacy/pipeline/_parser_internals/_beam_utils.pyx":33 + * + * cdef class BeamBatch(object): + * cdef public TransitionSystem moves # <<<<<<<<<<<<<< + * cdef public object states + * cdef public object docs +*/ + +/* Python wrapper */ +static PyObject *__pyx_pw_5spacy_8pipeline_17_parser_internals_11_beam_utils_9BeamBatch_5moves_1__get__(PyObject *__pyx_v_self); /*proto*/ +static PyObject *__pyx_pw_5spacy_8pipeline_17_parser_internals_11_beam_utils_9BeamBatch_5moves_1__get__(PyObject *__pyx_v_self) { + CYTHON_UNUSED PyObject *const *__pyx_kwvalues; + PyObject *__pyx_r = 0; + __Pyx_RefNannyDeclarations + __Pyx_RefNannySetupContext("__get__ (wrapper)", 0); + __pyx_kwvalues = __Pyx_KwValues_VARARGS(__pyx_args, __pyx_nargs); + __pyx_r = __pyx_pf_5spacy_8pipeline_17_parser_internals_11_beam_utils_9BeamBatch_5moves___get__(((struct __pyx_obj_5spacy_8pipeline_17_parser_internals_11_beam_utils_BeamBatch *)__pyx_v_self)); + + /* function exit code */ + __Pyx_RefNannyFinishContext(); + return __pyx_r; +} + +static PyObject *__pyx_pf_5spacy_8pipeline_17_parser_internals_11_beam_utils_9BeamBatch_5moves___get__(struct __pyx_obj_5spacy_8pipeline_17_parser_internals_11_beam_utils_BeamBatch *__pyx_v_self) { + PyObject *__pyx_r = NULL; + __Pyx_RefNannyDeclarations + __Pyx_RefNannySetupContext("__get__", 0); + __Pyx_XDECREF(__pyx_r); + __Pyx_INCREF((PyObject *)__pyx_v_self->moves); + __pyx_r = ((PyObject *)__pyx_v_self->moves); + goto __pyx_L0; + + /* function exit code */ + __pyx_L0:; + __Pyx_XGIVEREF(__pyx_r); + __Pyx_RefNannyFinishContext(); + return __pyx_r; +} + +/* Python wrapper */ +static int __pyx_pw_5spacy_8pipeline_17_parser_internals_11_beam_utils_9BeamBatch_5moves_3__set__(PyObject *__pyx_v_self, PyObject *__pyx_v_value); /*proto*/ +static int __pyx_pw_5spacy_8pipeline_17_parser_internals_11_beam_utils_9BeamBatch_5moves_3__set__(PyObject *__pyx_v_self, PyObject *__pyx_v_value) { + CYTHON_UNUSED PyObject *const *__pyx_kwvalues; + int __pyx_r; + __Pyx_RefNannyDeclarations + __Pyx_RefNannySetupContext("__set__ (wrapper)", 0); + __pyx_kwvalues = __Pyx_KwValues_VARARGS(__pyx_args, __pyx_nargs); + __pyx_r = __pyx_pf_5spacy_8pipeline_17_parser_internals_11_beam_utils_9BeamBatch_5moves_2__set__(((struct __pyx_obj_5spacy_8pipeline_17_parser_internals_11_beam_utils_BeamBatch *)__pyx_v_self), ((PyObject *)__pyx_v_value)); + + /* function exit code */ + __Pyx_RefNannyFinishContext(); + return __pyx_r; +} + +static int __pyx_pf_5spacy_8pipeline_17_parser_internals_11_beam_utils_9BeamBatch_5moves_2__set__(struct __pyx_obj_5spacy_8pipeline_17_parser_internals_11_beam_utils_BeamBatch *__pyx_v_self, PyObject *__pyx_v_value) { + int __pyx_r; + __Pyx_RefNannyDeclarations + PyObject *__pyx_t_1 = NULL; + int __pyx_lineno = 0; + const char *__pyx_filename = NULL; + int __pyx_clineno = 0; + __Pyx_RefNannySetupContext("__set__", 0); + __pyx_t_1 = __pyx_v_value; + __Pyx_INCREF(__pyx_t_1); + if (!(likely(((__pyx_t_1) == Py_None) || likely(__Pyx_TypeTest(__pyx_t_1, __pyx_mstate_global->__pyx_ptype_5spacy_8pipeline_17_parser_internals_17transition_system_TransitionSystem))))) __PYX_ERR(0, 33, __pyx_L1_error) + __Pyx_GIVEREF(__pyx_t_1); + __Pyx_GOTREF((PyObject *)__pyx_v_self->moves); + __Pyx_DECREF((PyObject *)__pyx_v_self->moves); + __pyx_v_self->moves = ((struct __pyx_obj_5spacy_8pipeline_17_parser_internals_17transition_system_TransitionSystem *)__pyx_t_1); + __pyx_t_1 = 0; + + /* function exit code */ + __pyx_r = 0; + goto __pyx_L0; + __pyx_L1_error:; + __Pyx_XDECREF(__pyx_t_1); + __Pyx_AddTraceback("spacy.pipeline._parser_internals._beam_utils.BeamBatch.moves.__set__", __pyx_clineno, __pyx_lineno, __pyx_filename); + __pyx_r = -1; + __pyx_L0:; + __Pyx_RefNannyFinishContext(); + return __pyx_r; +} + +/* Python wrapper */ +static int __pyx_pw_5spacy_8pipeline_17_parser_internals_11_beam_utils_9BeamBatch_5moves_5__del__(PyObject *__pyx_v_self); /*proto*/ +static int __pyx_pw_5spacy_8pipeline_17_parser_internals_11_beam_utils_9BeamBatch_5moves_5__del__(PyObject *__pyx_v_self) { + CYTHON_UNUSED PyObject *const *__pyx_kwvalues; + int __pyx_r; + __Pyx_RefNannyDeclarations + __Pyx_RefNannySetupContext("__del__ (wrapper)", 0); + __pyx_kwvalues = __Pyx_KwValues_VARARGS(__pyx_args, __pyx_nargs); + __pyx_r = __pyx_pf_5spacy_8pipeline_17_parser_internals_11_beam_utils_9BeamBatch_5moves_4__del__(((struct __pyx_obj_5spacy_8pipeline_17_parser_internals_11_beam_utils_BeamBatch *)__pyx_v_self)); + + /* function exit code */ + __Pyx_RefNannyFinishContext(); + return __pyx_r; +} + +static int __pyx_pf_5spacy_8pipeline_17_parser_internals_11_beam_utils_9BeamBatch_5moves_4__del__(struct __pyx_obj_5spacy_8pipeline_17_parser_internals_11_beam_utils_BeamBatch *__pyx_v_self) { + int __pyx_r; + __Pyx_RefNannyDeclarations + __Pyx_RefNannySetupContext("__del__", 0); + __Pyx_INCREF(Py_None); + __Pyx_GIVEREF(Py_None); + __Pyx_GOTREF((PyObject *)__pyx_v_self->moves); + __Pyx_DECREF((PyObject *)__pyx_v_self->moves); + __pyx_v_self->moves = ((struct __pyx_obj_5spacy_8pipeline_17_parser_internals_17transition_system_TransitionSystem *)Py_None); + + /* function exit code */ + __pyx_r = 0; + __Pyx_RefNannyFinishContext(); + return __pyx_r; +} + +/* "spacy/pipeline/_parser_internals/_beam_utils.pyx":34 + * cdef class BeamBatch(object): + * cdef public TransitionSystem moves + * cdef public object states # <<<<<<<<<<<<<< + * cdef public object docs + * cdef public object golds +*/ + +/* Python wrapper */ +static PyObject *__pyx_pw_5spacy_8pipeline_17_parser_internals_11_beam_utils_9BeamBatch_6states_1__get__(PyObject *__pyx_v_self); /*proto*/ +static PyObject *__pyx_pw_5spacy_8pipeline_17_parser_internals_11_beam_utils_9BeamBatch_6states_1__get__(PyObject *__pyx_v_self) { + CYTHON_UNUSED PyObject *const *__pyx_kwvalues; + PyObject *__pyx_r = 0; + __Pyx_RefNannyDeclarations + __Pyx_RefNannySetupContext("__get__ (wrapper)", 0); + __pyx_kwvalues = __Pyx_KwValues_VARARGS(__pyx_args, __pyx_nargs); + __pyx_r = __pyx_pf_5spacy_8pipeline_17_parser_internals_11_beam_utils_9BeamBatch_6states___get__(((struct __pyx_obj_5spacy_8pipeline_17_parser_internals_11_beam_utils_BeamBatch *)__pyx_v_self)); + + /* function exit code */ + __Pyx_RefNannyFinishContext(); + return __pyx_r; +} + +static PyObject *__pyx_pf_5spacy_8pipeline_17_parser_internals_11_beam_utils_9BeamBatch_6states___get__(struct __pyx_obj_5spacy_8pipeline_17_parser_internals_11_beam_utils_BeamBatch *__pyx_v_self) { + PyObject *__pyx_r = NULL; + __Pyx_RefNannyDeclarations + __Pyx_RefNannySetupContext("__get__", 0); + __Pyx_XDECREF(__pyx_r); + __Pyx_INCREF(__pyx_v_self->states); + __pyx_r = __pyx_v_self->states; + goto __pyx_L0; + + /* function exit code */ + __pyx_L0:; + __Pyx_XGIVEREF(__pyx_r); + __Pyx_RefNannyFinishContext(); + return __pyx_r; +} + +/* Python wrapper */ +static int __pyx_pw_5spacy_8pipeline_17_parser_internals_11_beam_utils_9BeamBatch_6states_3__set__(PyObject *__pyx_v_self, PyObject *__pyx_v_value); /*proto*/ +static int __pyx_pw_5spacy_8pipeline_17_parser_internals_11_beam_utils_9BeamBatch_6states_3__set__(PyObject *__pyx_v_self, PyObject *__pyx_v_value) { + CYTHON_UNUSED PyObject *const *__pyx_kwvalues; + int __pyx_r; + __Pyx_RefNannyDeclarations + __Pyx_RefNannySetupContext("__set__ (wrapper)", 0); + __pyx_kwvalues = __Pyx_KwValues_VARARGS(__pyx_args, __pyx_nargs); + __pyx_r = __pyx_pf_5spacy_8pipeline_17_parser_internals_11_beam_utils_9BeamBatch_6states_2__set__(((struct __pyx_obj_5spacy_8pipeline_17_parser_internals_11_beam_utils_BeamBatch *)__pyx_v_self), ((PyObject *)__pyx_v_value)); + + /* function exit code */ + __Pyx_RefNannyFinishContext(); + return __pyx_r; +} + +static int __pyx_pf_5spacy_8pipeline_17_parser_internals_11_beam_utils_9BeamBatch_6states_2__set__(struct __pyx_obj_5spacy_8pipeline_17_parser_internals_11_beam_utils_BeamBatch *__pyx_v_self, PyObject *__pyx_v_value) { + int __pyx_r; + __Pyx_RefNannyDeclarations + __Pyx_RefNannySetupContext("__set__", 0); + __Pyx_INCREF(__pyx_v_value); + __Pyx_GIVEREF(__pyx_v_value); + __Pyx_GOTREF(__pyx_v_self->states); + __Pyx_DECREF(__pyx_v_self->states); + __pyx_v_self->states = __pyx_v_value; + + /* function exit code */ + __pyx_r = 0; + __Pyx_RefNannyFinishContext(); + return __pyx_r; +} + +/* Python wrapper */ +static int __pyx_pw_5spacy_8pipeline_17_parser_internals_11_beam_utils_9BeamBatch_6states_5__del__(PyObject *__pyx_v_self); /*proto*/ +static int __pyx_pw_5spacy_8pipeline_17_parser_internals_11_beam_utils_9BeamBatch_6states_5__del__(PyObject *__pyx_v_self) { + CYTHON_UNUSED PyObject *const *__pyx_kwvalues; + int __pyx_r; + __Pyx_RefNannyDeclarations + __Pyx_RefNannySetupContext("__del__ (wrapper)", 0); + __pyx_kwvalues = __Pyx_KwValues_VARARGS(__pyx_args, __pyx_nargs); + __pyx_r = __pyx_pf_5spacy_8pipeline_17_parser_internals_11_beam_utils_9BeamBatch_6states_4__del__(((struct __pyx_obj_5spacy_8pipeline_17_parser_internals_11_beam_utils_BeamBatch *)__pyx_v_self)); + + /* function exit code */ + __Pyx_RefNannyFinishContext(); + return __pyx_r; +} + +static int __pyx_pf_5spacy_8pipeline_17_parser_internals_11_beam_utils_9BeamBatch_6states_4__del__(struct __pyx_obj_5spacy_8pipeline_17_parser_internals_11_beam_utils_BeamBatch *__pyx_v_self) { + int __pyx_r; + __Pyx_RefNannyDeclarations + __Pyx_RefNannySetupContext("__del__", 0); + __Pyx_INCREF(Py_None); + __Pyx_GIVEREF(Py_None); + __Pyx_GOTREF(__pyx_v_self->states); + __Pyx_DECREF(__pyx_v_self->states); + __pyx_v_self->states = Py_None; + + /* function exit code */ + __pyx_r = 0; + __Pyx_RefNannyFinishContext(); + return __pyx_r; +} + +/* "spacy/pipeline/_parser_internals/_beam_utils.pyx":35 + * cdef public TransitionSystem moves + * cdef public object states + * cdef public object docs # <<<<<<<<<<<<<< + * cdef public object golds + * cdef public object beams +*/ + +/* Python wrapper */ +static PyObject *__pyx_pw_5spacy_8pipeline_17_parser_internals_11_beam_utils_9BeamBatch_4docs_1__get__(PyObject *__pyx_v_self); /*proto*/ +static PyObject *__pyx_pw_5spacy_8pipeline_17_parser_internals_11_beam_utils_9BeamBatch_4docs_1__get__(PyObject *__pyx_v_self) { + CYTHON_UNUSED PyObject *const *__pyx_kwvalues; + PyObject *__pyx_r = 0; + __Pyx_RefNannyDeclarations + __Pyx_RefNannySetupContext("__get__ (wrapper)", 0); + __pyx_kwvalues = __Pyx_KwValues_VARARGS(__pyx_args, __pyx_nargs); + __pyx_r = __pyx_pf_5spacy_8pipeline_17_parser_internals_11_beam_utils_9BeamBatch_4docs___get__(((struct __pyx_obj_5spacy_8pipeline_17_parser_internals_11_beam_utils_BeamBatch *)__pyx_v_self)); + + /* function exit code */ + __Pyx_RefNannyFinishContext(); + return __pyx_r; +} + +static PyObject *__pyx_pf_5spacy_8pipeline_17_parser_internals_11_beam_utils_9BeamBatch_4docs___get__(struct __pyx_obj_5spacy_8pipeline_17_parser_internals_11_beam_utils_BeamBatch *__pyx_v_self) { + PyObject *__pyx_r = NULL; + __Pyx_RefNannyDeclarations + __Pyx_RefNannySetupContext("__get__", 0); + __Pyx_XDECREF(__pyx_r); + __Pyx_INCREF(__pyx_v_self->docs); + __pyx_r = __pyx_v_self->docs; + goto __pyx_L0; + + /* function exit code */ + __pyx_L0:; + __Pyx_XGIVEREF(__pyx_r); + __Pyx_RefNannyFinishContext(); + return __pyx_r; +} + +/* Python wrapper */ +static int __pyx_pw_5spacy_8pipeline_17_parser_internals_11_beam_utils_9BeamBatch_4docs_3__set__(PyObject *__pyx_v_self, PyObject *__pyx_v_value); /*proto*/ +static int __pyx_pw_5spacy_8pipeline_17_parser_internals_11_beam_utils_9BeamBatch_4docs_3__set__(PyObject *__pyx_v_self, PyObject *__pyx_v_value) { + CYTHON_UNUSED PyObject *const *__pyx_kwvalues; + int __pyx_r; + __Pyx_RefNannyDeclarations + __Pyx_RefNannySetupContext("__set__ (wrapper)", 0); + __pyx_kwvalues = __Pyx_KwValues_VARARGS(__pyx_args, __pyx_nargs); + __pyx_r = __pyx_pf_5spacy_8pipeline_17_parser_internals_11_beam_utils_9BeamBatch_4docs_2__set__(((struct __pyx_obj_5spacy_8pipeline_17_parser_internals_11_beam_utils_BeamBatch *)__pyx_v_self), ((PyObject *)__pyx_v_value)); + + /* function exit code */ + __Pyx_RefNannyFinishContext(); + return __pyx_r; +} + +static int __pyx_pf_5spacy_8pipeline_17_parser_internals_11_beam_utils_9BeamBatch_4docs_2__set__(struct __pyx_obj_5spacy_8pipeline_17_parser_internals_11_beam_utils_BeamBatch *__pyx_v_self, PyObject *__pyx_v_value) { + int __pyx_r; + __Pyx_RefNannyDeclarations + __Pyx_RefNannySetupContext("__set__", 0); + __Pyx_INCREF(__pyx_v_value); + __Pyx_GIVEREF(__pyx_v_value); + __Pyx_GOTREF(__pyx_v_self->docs); + __Pyx_DECREF(__pyx_v_self->docs); + __pyx_v_self->docs = __pyx_v_value; + + /* function exit code */ + __pyx_r = 0; + __Pyx_RefNannyFinishContext(); + return __pyx_r; +} + +/* Python wrapper */ +static int __pyx_pw_5spacy_8pipeline_17_parser_internals_11_beam_utils_9BeamBatch_4docs_5__del__(PyObject *__pyx_v_self); /*proto*/ +static int __pyx_pw_5spacy_8pipeline_17_parser_internals_11_beam_utils_9BeamBatch_4docs_5__del__(PyObject *__pyx_v_self) { + CYTHON_UNUSED PyObject *const *__pyx_kwvalues; + int __pyx_r; + __Pyx_RefNannyDeclarations + __Pyx_RefNannySetupContext("__del__ (wrapper)", 0); + __pyx_kwvalues = __Pyx_KwValues_VARARGS(__pyx_args, __pyx_nargs); + __pyx_r = __pyx_pf_5spacy_8pipeline_17_parser_internals_11_beam_utils_9BeamBatch_4docs_4__del__(((struct __pyx_obj_5spacy_8pipeline_17_parser_internals_11_beam_utils_BeamBatch *)__pyx_v_self)); + + /* function exit code */ + __Pyx_RefNannyFinishContext(); + return __pyx_r; +} + +static int __pyx_pf_5spacy_8pipeline_17_parser_internals_11_beam_utils_9BeamBatch_4docs_4__del__(struct __pyx_obj_5spacy_8pipeline_17_parser_internals_11_beam_utils_BeamBatch *__pyx_v_self) { + int __pyx_r; + __Pyx_RefNannyDeclarations + __Pyx_RefNannySetupContext("__del__", 0); + __Pyx_INCREF(Py_None); + __Pyx_GIVEREF(Py_None); + __Pyx_GOTREF(__pyx_v_self->docs); + __Pyx_DECREF(__pyx_v_self->docs); + __pyx_v_self->docs = Py_None; + + /* function exit code */ + __pyx_r = 0; + __Pyx_RefNannyFinishContext(); + return __pyx_r; +} + +/* "spacy/pipeline/_parser_internals/_beam_utils.pyx":36 + * cdef public object states + * cdef public object docs + * cdef public object golds # <<<<<<<<<<<<<< + * cdef public object beams + * +*/ + +/* Python wrapper */ +static PyObject *__pyx_pw_5spacy_8pipeline_17_parser_internals_11_beam_utils_9BeamBatch_5golds_1__get__(PyObject *__pyx_v_self); /*proto*/ +static PyObject *__pyx_pw_5spacy_8pipeline_17_parser_internals_11_beam_utils_9BeamBatch_5golds_1__get__(PyObject *__pyx_v_self) { + CYTHON_UNUSED PyObject *const *__pyx_kwvalues; + PyObject *__pyx_r = 0; + __Pyx_RefNannyDeclarations + __Pyx_RefNannySetupContext("__get__ (wrapper)", 0); + __pyx_kwvalues = __Pyx_KwValues_VARARGS(__pyx_args, __pyx_nargs); + __pyx_r = __pyx_pf_5spacy_8pipeline_17_parser_internals_11_beam_utils_9BeamBatch_5golds___get__(((struct __pyx_obj_5spacy_8pipeline_17_parser_internals_11_beam_utils_BeamBatch *)__pyx_v_self)); + + /* function exit code */ + __Pyx_RefNannyFinishContext(); + return __pyx_r; +} + +static PyObject *__pyx_pf_5spacy_8pipeline_17_parser_internals_11_beam_utils_9BeamBatch_5golds___get__(struct __pyx_obj_5spacy_8pipeline_17_parser_internals_11_beam_utils_BeamBatch *__pyx_v_self) { + PyObject *__pyx_r = NULL; + __Pyx_RefNannyDeclarations + __Pyx_RefNannySetupContext("__get__", 0); + __Pyx_XDECREF(__pyx_r); + __Pyx_INCREF(__pyx_v_self->golds); + __pyx_r = __pyx_v_self->golds; + goto __pyx_L0; + + /* function exit code */ + __pyx_L0:; + __Pyx_XGIVEREF(__pyx_r); + __Pyx_RefNannyFinishContext(); + return __pyx_r; +} + +/* Python wrapper */ +static int __pyx_pw_5spacy_8pipeline_17_parser_internals_11_beam_utils_9BeamBatch_5golds_3__set__(PyObject *__pyx_v_self, PyObject *__pyx_v_value); /*proto*/ +static int __pyx_pw_5spacy_8pipeline_17_parser_internals_11_beam_utils_9BeamBatch_5golds_3__set__(PyObject *__pyx_v_self, PyObject *__pyx_v_value) { + CYTHON_UNUSED PyObject *const *__pyx_kwvalues; + int __pyx_r; + __Pyx_RefNannyDeclarations + __Pyx_RefNannySetupContext("__set__ (wrapper)", 0); + __pyx_kwvalues = __Pyx_KwValues_VARARGS(__pyx_args, __pyx_nargs); + __pyx_r = __pyx_pf_5spacy_8pipeline_17_parser_internals_11_beam_utils_9BeamBatch_5golds_2__set__(((struct __pyx_obj_5spacy_8pipeline_17_parser_internals_11_beam_utils_BeamBatch *)__pyx_v_self), ((PyObject *)__pyx_v_value)); + + /* function exit code */ + __Pyx_RefNannyFinishContext(); + return __pyx_r; +} + +static int __pyx_pf_5spacy_8pipeline_17_parser_internals_11_beam_utils_9BeamBatch_5golds_2__set__(struct __pyx_obj_5spacy_8pipeline_17_parser_internals_11_beam_utils_BeamBatch *__pyx_v_self, PyObject *__pyx_v_value) { + int __pyx_r; + __Pyx_RefNannyDeclarations + __Pyx_RefNannySetupContext("__set__", 0); + __Pyx_INCREF(__pyx_v_value); + __Pyx_GIVEREF(__pyx_v_value); + __Pyx_GOTREF(__pyx_v_self->golds); + __Pyx_DECREF(__pyx_v_self->golds); + __pyx_v_self->golds = __pyx_v_value; + + /* function exit code */ + __pyx_r = 0; + __Pyx_RefNannyFinishContext(); + return __pyx_r; +} + +/* Python wrapper */ +static int __pyx_pw_5spacy_8pipeline_17_parser_internals_11_beam_utils_9BeamBatch_5golds_5__del__(PyObject *__pyx_v_self); /*proto*/ +static int __pyx_pw_5spacy_8pipeline_17_parser_internals_11_beam_utils_9BeamBatch_5golds_5__del__(PyObject *__pyx_v_self) { + CYTHON_UNUSED PyObject *const *__pyx_kwvalues; + int __pyx_r; + __Pyx_RefNannyDeclarations + __Pyx_RefNannySetupContext("__del__ (wrapper)", 0); + __pyx_kwvalues = __Pyx_KwValues_VARARGS(__pyx_args, __pyx_nargs); + __pyx_r = __pyx_pf_5spacy_8pipeline_17_parser_internals_11_beam_utils_9BeamBatch_5golds_4__del__(((struct __pyx_obj_5spacy_8pipeline_17_parser_internals_11_beam_utils_BeamBatch *)__pyx_v_self)); + + /* function exit code */ + __Pyx_RefNannyFinishContext(); + return __pyx_r; +} + +static int __pyx_pf_5spacy_8pipeline_17_parser_internals_11_beam_utils_9BeamBatch_5golds_4__del__(struct __pyx_obj_5spacy_8pipeline_17_parser_internals_11_beam_utils_BeamBatch *__pyx_v_self) { + int __pyx_r; + __Pyx_RefNannyDeclarations + __Pyx_RefNannySetupContext("__del__", 0); + __Pyx_INCREF(Py_None); + __Pyx_GIVEREF(Py_None); + __Pyx_GOTREF(__pyx_v_self->golds); + __Pyx_DECREF(__pyx_v_self->golds); + __pyx_v_self->golds = Py_None; + + /* function exit code */ + __pyx_r = 0; + __Pyx_RefNannyFinishContext(); + return __pyx_r; +} + +/* "spacy/pipeline/_parser_internals/_beam_utils.pyx":37 + * cdef public object docs + * cdef public object golds + * cdef public object beams # <<<<<<<<<<<<<< + * + * def __init__(self, TransitionSystem moves, states, golds, +*/ + +/* Python wrapper */ +static PyObject *__pyx_pw_5spacy_8pipeline_17_parser_internals_11_beam_utils_9BeamBatch_5beams_1__get__(PyObject *__pyx_v_self); /*proto*/ +static PyObject *__pyx_pw_5spacy_8pipeline_17_parser_internals_11_beam_utils_9BeamBatch_5beams_1__get__(PyObject *__pyx_v_self) { + CYTHON_UNUSED PyObject *const *__pyx_kwvalues; + PyObject *__pyx_r = 0; + __Pyx_RefNannyDeclarations + __Pyx_RefNannySetupContext("__get__ (wrapper)", 0); + __pyx_kwvalues = __Pyx_KwValues_VARARGS(__pyx_args, __pyx_nargs); + __pyx_r = __pyx_pf_5spacy_8pipeline_17_parser_internals_11_beam_utils_9BeamBatch_5beams___get__(((struct __pyx_obj_5spacy_8pipeline_17_parser_internals_11_beam_utils_BeamBatch *)__pyx_v_self)); + + /* function exit code */ + __Pyx_RefNannyFinishContext(); + return __pyx_r; +} + +static PyObject *__pyx_pf_5spacy_8pipeline_17_parser_internals_11_beam_utils_9BeamBatch_5beams___get__(struct __pyx_obj_5spacy_8pipeline_17_parser_internals_11_beam_utils_BeamBatch *__pyx_v_self) { + PyObject *__pyx_r = NULL; + __Pyx_RefNannyDeclarations + __Pyx_RefNannySetupContext("__get__", 0); + __Pyx_XDECREF(__pyx_r); + __Pyx_INCREF(__pyx_v_self->beams); + __pyx_r = __pyx_v_self->beams; + goto __pyx_L0; + + /* function exit code */ + __pyx_L0:; + __Pyx_XGIVEREF(__pyx_r); + __Pyx_RefNannyFinishContext(); + return __pyx_r; +} + +/* Python wrapper */ +static int __pyx_pw_5spacy_8pipeline_17_parser_internals_11_beam_utils_9BeamBatch_5beams_3__set__(PyObject *__pyx_v_self, PyObject *__pyx_v_value); /*proto*/ +static int __pyx_pw_5spacy_8pipeline_17_parser_internals_11_beam_utils_9BeamBatch_5beams_3__set__(PyObject *__pyx_v_self, PyObject *__pyx_v_value) { + CYTHON_UNUSED PyObject *const *__pyx_kwvalues; + int __pyx_r; + __Pyx_RefNannyDeclarations + __Pyx_RefNannySetupContext("__set__ (wrapper)", 0); + __pyx_kwvalues = __Pyx_KwValues_VARARGS(__pyx_args, __pyx_nargs); + __pyx_r = __pyx_pf_5spacy_8pipeline_17_parser_internals_11_beam_utils_9BeamBatch_5beams_2__set__(((struct __pyx_obj_5spacy_8pipeline_17_parser_internals_11_beam_utils_BeamBatch *)__pyx_v_self), ((PyObject *)__pyx_v_value)); + + /* function exit code */ + __Pyx_RefNannyFinishContext(); + return __pyx_r; +} + +static int __pyx_pf_5spacy_8pipeline_17_parser_internals_11_beam_utils_9BeamBatch_5beams_2__set__(struct __pyx_obj_5spacy_8pipeline_17_parser_internals_11_beam_utils_BeamBatch *__pyx_v_self, PyObject *__pyx_v_value) { + int __pyx_r; + __Pyx_RefNannyDeclarations + __Pyx_RefNannySetupContext("__set__", 0); + __Pyx_INCREF(__pyx_v_value); + __Pyx_GIVEREF(__pyx_v_value); + __Pyx_GOTREF(__pyx_v_self->beams); + __Pyx_DECREF(__pyx_v_self->beams); + __pyx_v_self->beams = __pyx_v_value; + + /* function exit code */ + __pyx_r = 0; + __Pyx_RefNannyFinishContext(); + return __pyx_r; +} + +/* Python wrapper */ +static int __pyx_pw_5spacy_8pipeline_17_parser_internals_11_beam_utils_9BeamBatch_5beams_5__del__(PyObject *__pyx_v_self); /*proto*/ +static int __pyx_pw_5spacy_8pipeline_17_parser_internals_11_beam_utils_9BeamBatch_5beams_5__del__(PyObject *__pyx_v_self) { + CYTHON_UNUSED PyObject *const *__pyx_kwvalues; + int __pyx_r; + __Pyx_RefNannyDeclarations + __Pyx_RefNannySetupContext("__del__ (wrapper)", 0); + __pyx_kwvalues = __Pyx_KwValues_VARARGS(__pyx_args, __pyx_nargs); + __pyx_r = __pyx_pf_5spacy_8pipeline_17_parser_internals_11_beam_utils_9BeamBatch_5beams_4__del__(((struct __pyx_obj_5spacy_8pipeline_17_parser_internals_11_beam_utils_BeamBatch *)__pyx_v_self)); + + /* function exit code */ + __Pyx_RefNannyFinishContext(); + return __pyx_r; +} + +static int __pyx_pf_5spacy_8pipeline_17_parser_internals_11_beam_utils_9BeamBatch_5beams_4__del__(struct __pyx_obj_5spacy_8pipeline_17_parser_internals_11_beam_utils_BeamBatch *__pyx_v_self) { + int __pyx_r; + __Pyx_RefNannyDeclarations + __Pyx_RefNannySetupContext("__del__", 0); + __Pyx_INCREF(Py_None); + __Pyx_GIVEREF(Py_None); + __Pyx_GOTREF(__pyx_v_self->beams); + __Pyx_DECREF(__pyx_v_self->beams); + __pyx_v_self->beams = Py_None; + + /* function exit code */ + __pyx_r = 0; + __Pyx_RefNannyFinishContext(); + return __pyx_r; +} + +/* "(tree fragment)":1 + * def __reduce_cython__(self): # <<<<<<<<<<<<<< + * cdef tuple state + * cdef object _dict +*/ + +/* Python wrapper */ +static PyObject *__pyx_pw_5spacy_8pipeline_17_parser_internals_11_beam_utils_9BeamBatch_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_5spacy_8pipeline_17_parser_internals_11_beam_utils_9BeamBatch_14__reduce_cython__, "BeamBatch.__reduce_cython__(self)"); +static PyMethodDef __pyx_mdef_5spacy_8pipeline_17_parser_internals_11_beam_utils_9BeamBatch_15__reduce_cython__ = {"__reduce_cython__", (PyCFunction)(void(*)(void))(__Pyx_PyCFunction_FastCallWithKeywords)__pyx_pw_5spacy_8pipeline_17_parser_internals_11_beam_utils_9BeamBatch_15__reduce_cython__, __Pyx_METH_FASTCALL|METH_KEYWORDS, __pyx_doc_5spacy_8pipeline_17_parser_internals_11_beam_utils_9BeamBatch_14__reduce_cython__}; +static PyObject *__pyx_pw_5spacy_8pipeline_17_parser_internals_11_beam_utils_9BeamBatch_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_5spacy_8pipeline_17_parser_internals_11_beam_utils_9BeamBatch_14__reduce_cython__(((struct __pyx_obj_5spacy_8pipeline_17_parser_internals_11_beam_utils_BeamBatch *)__pyx_v_self)); + + /* function exit code */ + __Pyx_RefNannyFinishContext(); + return __pyx_r; +} + +static PyObject *__pyx_pf_5spacy_8pipeline_17_parser_internals_11_beam_utils_9BeamBatch_14__reduce_cython__(struct __pyx_obj_5spacy_8pipeline_17_parser_internals_11_beam_utils_BeamBatch *__pyx_v_self) { + PyObject *__pyx_v_state = 0; + PyObject *__pyx_v__dict = 0; + int __pyx_v_use_setstate; + PyObject *__pyx_r = NULL; + __Pyx_RefNannyDeclarations + PyObject *__pyx_t_1 = NULL; + int __pyx_t_2; + int __pyx_t_3; + PyObject *__pyx_t_4 = NULL; + PyObject *__pyx_t_5 = NULL; + int __pyx_lineno = 0; + const char *__pyx_filename = NULL; + int __pyx_clineno = 0; + __Pyx_RefNannySetupContext("__reduce_cython__", 0); + + /* "(tree fragment)":5 + * cdef object _dict + * cdef bint use_setstate + * state = (self.beams, self.docs, self.golds, self.moves, self.states) # <<<<<<<<<<<<<< + * _dict = getattr(self, '__dict__', None) + * if _dict is not None and _dict: +*/ + __pyx_t_1 = PyTuple_New(5); if (unlikely(!__pyx_t_1)) __PYX_ERR(1, 5, __pyx_L1_error) + __Pyx_GOTREF(__pyx_t_1); + __Pyx_INCREF(__pyx_v_self->beams); + __Pyx_GIVEREF(__pyx_v_self->beams); + if (__Pyx_PyTuple_SET_ITEM(__pyx_t_1, 0, __pyx_v_self->beams) != (0)) __PYX_ERR(1, 5, __pyx_L1_error); + __Pyx_INCREF(__pyx_v_self->docs); + __Pyx_GIVEREF(__pyx_v_self->docs); + if (__Pyx_PyTuple_SET_ITEM(__pyx_t_1, 1, __pyx_v_self->docs) != (0)) __PYX_ERR(1, 5, __pyx_L1_error); + __Pyx_INCREF(__pyx_v_self->golds); + __Pyx_GIVEREF(__pyx_v_self->golds); + if (__Pyx_PyTuple_SET_ITEM(__pyx_t_1, 2, __pyx_v_self->golds) != (0)) __PYX_ERR(1, 5, __pyx_L1_error); + __Pyx_INCREF((PyObject *)__pyx_v_self->moves); + __Pyx_GIVEREF((PyObject *)__pyx_v_self->moves); + if (__Pyx_PyTuple_SET_ITEM(__pyx_t_1, 3, ((PyObject *)__pyx_v_self->moves)) != (0)) __PYX_ERR(1, 5, __pyx_L1_error); + __Pyx_INCREF(__pyx_v_self->states); + __Pyx_GIVEREF(__pyx_v_self->states); + if (__Pyx_PyTuple_SET_ITEM(__pyx_t_1, 4, __pyx_v_self->states) != (0)) __PYX_ERR(1, 5, __pyx_L1_error); + __pyx_v_state = ((PyObject*)__pyx_t_1); + __pyx_t_1 = 0; + + /* "(tree fragment)":6 + * cdef bint use_setstate + * state = (self.beams, self.docs, self.golds, self.moves, self.states) + * _dict = getattr(self, '__dict__', None) # <<<<<<<<<<<<<< + * if _dict is not None and _dict: + * state += (_dict,) +*/ + __pyx_t_1 = __Pyx_GetAttr3(((PyObject *)__pyx_v_self), __pyx_mstate_global->__pyx_n_u_dict, Py_None); if (unlikely(!__pyx_t_1)) __PYX_ERR(1, 6, __pyx_L1_error) + __Pyx_GOTREF(__pyx_t_1); + __pyx_v__dict = __pyx_t_1; + __pyx_t_1 = 0; + + /* "(tree fragment)":7 + * state = (self.beams, self.docs, self.golds, self.moves, self.states) + * _dict = getattr(self, '__dict__', None) + * if _dict is not None and _dict: # <<<<<<<<<<<<<< + * state += (_dict,) + * use_setstate = True +*/ + __pyx_t_3 = (__pyx_v__dict != Py_None); + if (__pyx_t_3) { + } else { + __pyx_t_2 = __pyx_t_3; + goto __pyx_L4_bool_binop_done; + } + __pyx_t_3 = __Pyx_PyObject_IsTrue(__pyx_v__dict); if (unlikely((__pyx_t_3 < 0))) __PYX_ERR(1, 7, __pyx_L1_error) + __pyx_t_2 = __pyx_t_3; + __pyx_L4_bool_binop_done:; + if (__pyx_t_2) { + + /* "(tree fragment)":8 + * _dict = getattr(self, '__dict__', None) + * if _dict is not None and _dict: + * state += (_dict,) # <<<<<<<<<<<<<< + * use_setstate = True + * else: +*/ + __pyx_t_1 = PyTuple_New(1); if (unlikely(!__pyx_t_1)) __PYX_ERR(1, 8, __pyx_L1_error) + __Pyx_GOTREF(__pyx_t_1); + __Pyx_INCREF(__pyx_v__dict); + __Pyx_GIVEREF(__pyx_v__dict); + if (__Pyx_PyTuple_SET_ITEM(__pyx_t_1, 0, __pyx_v__dict) != (0)) __PYX_ERR(1, 8, __pyx_L1_error); + __pyx_t_4 = PyNumber_InPlaceAdd(__pyx_v_state, __pyx_t_1); if (unlikely(!__pyx_t_4)) __PYX_ERR(1, 8, __pyx_L1_error) + __Pyx_GOTREF(__pyx_t_4); + __Pyx_DECREF(__pyx_t_1); __pyx_t_1 = 0; + __Pyx_DECREF_SET(__pyx_v_state, ((PyObject*)__pyx_t_4)); + __pyx_t_4 = 0; + + /* "(tree fragment)":9 + * if _dict is not None and _dict: + * state += (_dict,) + * use_setstate = True # <<<<<<<<<<<<<< + * else: + * use_setstate = ('self.beams is not None or self.docs is not None or self.golds is not None or self.moves is not None or self.states is not None',) +*/ + __pyx_v_use_setstate = 1; + + /* "(tree fragment)":7 + * state = (self.beams, self.docs, self.golds, self.moves, self.states) + * _dict = getattr(self, '__dict__', None) + * if _dict is not None and _dict: # <<<<<<<<<<<<<< + * state += (_dict,) + * use_setstate = True +*/ + goto __pyx_L3; + } + + /* "(tree fragment)":11 + * use_setstate = True + * else: + * use_setstate = ('self.beams is not None or self.docs is not None or self.golds is not None or self.moves is not None or self.states is not None',) # <<<<<<<<<<<<<< + * if use_setstate: + * return __pyx_unpickle_BeamBatch, (type(self), 0xa2d29a4, None), state +*/ + /*else*/ { + __pyx_t_2 = __Pyx_PyObject_IsTrue(__pyx_mstate_global->__pyx_tuple[2]); if (unlikely((__pyx_t_2 == (int)-1) && PyErr_Occurred())) __PYX_ERR(1, 11, __pyx_L1_error) + __pyx_v_use_setstate = __pyx_t_2; + } + __pyx_L3:; + + /* "(tree fragment)":12 + * else: + * use_setstate = ('self.beams is not None or self.docs is not None or self.golds is not None or self.moves is not None or self.states is not None',) + * if use_setstate: # <<<<<<<<<<<<<< + * return __pyx_unpickle_BeamBatch, (type(self), 0xa2d29a4, None), state + * else: +*/ + if (__pyx_v_use_setstate) { + + /* "(tree fragment)":13 + * use_setstate = ('self.beams is not None or self.docs is not None or self.golds is not None or self.moves is not None or self.states is not None',) + * if use_setstate: + * return __pyx_unpickle_BeamBatch, (type(self), 0xa2d29a4, None), state # <<<<<<<<<<<<<< + * else: + * return __pyx_unpickle_BeamBatch, (type(self), 0xa2d29a4, state) +*/ + __Pyx_XDECREF(__pyx_r); + __Pyx_GetModuleGlobalName(__pyx_t_4, __pyx_mstate_global->__pyx_n_u_pyx_unpickle_BeamBatch); if (unlikely(!__pyx_t_4)) __PYX_ERR(1, 13, __pyx_L1_error) + __Pyx_GOTREF(__pyx_t_4); + __pyx_t_1 = PyTuple_New(3); if (unlikely(!__pyx_t_1)) __PYX_ERR(1, 13, __pyx_L1_error) + __Pyx_GOTREF(__pyx_t_1); + __Pyx_INCREF(((PyObject *)Py_TYPE(((PyObject *)__pyx_v_self)))); + __Pyx_GIVEREF(((PyObject *)Py_TYPE(((PyObject *)__pyx_v_self)))); + if (__Pyx_PyTuple_SET_ITEM(__pyx_t_1, 0, ((PyObject *)Py_TYPE(((PyObject *)__pyx_v_self)))) != (0)) __PYX_ERR(1, 13, __pyx_L1_error); + __Pyx_INCREF(__pyx_mstate_global->__pyx_int_170731940); + __Pyx_GIVEREF(__pyx_mstate_global->__pyx_int_170731940); + if (__Pyx_PyTuple_SET_ITEM(__pyx_t_1, 1, __pyx_mstate_global->__pyx_int_170731940) != (0)) __PYX_ERR(1, 13, __pyx_L1_error); + __Pyx_INCREF(Py_None); + __Pyx_GIVEREF(Py_None); + if (__Pyx_PyTuple_SET_ITEM(__pyx_t_1, 2, Py_None) != (0)) __PYX_ERR(1, 13, __pyx_L1_error); + __pyx_t_5 = PyTuple_New(3); if (unlikely(!__pyx_t_5)) __PYX_ERR(1, 13, __pyx_L1_error) + __Pyx_GOTREF(__pyx_t_5); + __Pyx_GIVEREF(__pyx_t_4); + if (__Pyx_PyTuple_SET_ITEM(__pyx_t_5, 0, __pyx_t_4) != (0)) __PYX_ERR(1, 13, __pyx_L1_error); + __Pyx_GIVEREF(__pyx_t_1); + if (__Pyx_PyTuple_SET_ITEM(__pyx_t_5, 1, __pyx_t_1) != (0)) __PYX_ERR(1, 13, __pyx_L1_error); + __Pyx_INCREF(__pyx_v_state); + __Pyx_GIVEREF(__pyx_v_state); + if (__Pyx_PyTuple_SET_ITEM(__pyx_t_5, 2, __pyx_v_state) != (0)) __PYX_ERR(1, 13, __pyx_L1_error); + __pyx_t_4 = 0; + __pyx_t_1 = 0; + __pyx_r = __pyx_t_5; + __pyx_t_5 = 0; + goto __pyx_L0; + + /* "(tree fragment)":12 + * else: + * use_setstate = ('self.beams is not None or self.docs is not None or self.golds is not None or self.moves is not None or self.states is not None',) + * if use_setstate: # <<<<<<<<<<<<<< + * return __pyx_unpickle_BeamBatch, (type(self), 0xa2d29a4, None), state + * else: +*/ + } + + /* "(tree fragment)":15 + * return __pyx_unpickle_BeamBatch, (type(self), 0xa2d29a4, None), state + * else: + * return __pyx_unpickle_BeamBatch, (type(self), 0xa2d29a4, state) # <<<<<<<<<<<<<< + * def __setstate_cython__(self, __pyx_state): + * __pyx_unpickle_BeamBatch__set_state(self, __pyx_state) +*/ + /*else*/ { + __Pyx_XDECREF(__pyx_r); + __Pyx_GetModuleGlobalName(__pyx_t_5, __pyx_mstate_global->__pyx_n_u_pyx_unpickle_BeamBatch); if (unlikely(!__pyx_t_5)) __PYX_ERR(1, 15, __pyx_L1_error) + __Pyx_GOTREF(__pyx_t_5); + __pyx_t_1 = PyTuple_New(3); if (unlikely(!__pyx_t_1)) __PYX_ERR(1, 15, __pyx_L1_error) + __Pyx_GOTREF(__pyx_t_1); + __Pyx_INCREF(((PyObject *)Py_TYPE(((PyObject *)__pyx_v_self)))); + __Pyx_GIVEREF(((PyObject *)Py_TYPE(((PyObject *)__pyx_v_self)))); + if (__Pyx_PyTuple_SET_ITEM(__pyx_t_1, 0, ((PyObject *)Py_TYPE(((PyObject *)__pyx_v_self)))) != (0)) __PYX_ERR(1, 15, __pyx_L1_error); + __Pyx_INCREF(__pyx_mstate_global->__pyx_int_170731940); + __Pyx_GIVEREF(__pyx_mstate_global->__pyx_int_170731940); + if (__Pyx_PyTuple_SET_ITEM(__pyx_t_1, 1, __pyx_mstate_global->__pyx_int_170731940) != (0)) __PYX_ERR(1, 15, __pyx_L1_error); + __Pyx_INCREF(__pyx_v_state); + __Pyx_GIVEREF(__pyx_v_state); + if (__Pyx_PyTuple_SET_ITEM(__pyx_t_1, 2, __pyx_v_state) != (0)) __PYX_ERR(1, 15, __pyx_L1_error); + __pyx_t_4 = PyTuple_New(2); if (unlikely(!__pyx_t_4)) __PYX_ERR(1, 15, __pyx_L1_error) + __Pyx_GOTREF(__pyx_t_4); + __Pyx_GIVEREF(__pyx_t_5); + if (__Pyx_PyTuple_SET_ITEM(__pyx_t_4, 0, __pyx_t_5) != (0)) __PYX_ERR(1, 15, __pyx_L1_error); + __Pyx_GIVEREF(__pyx_t_1); + if (__Pyx_PyTuple_SET_ITEM(__pyx_t_4, 1, __pyx_t_1) != (0)) __PYX_ERR(1, 15, __pyx_L1_error); + __pyx_t_5 = 0; + __pyx_t_1 = 0; + __pyx_r = __pyx_t_4; + __pyx_t_4 = 0; + goto __pyx_L0; + } + + /* "(tree fragment)":1 + * def __reduce_cython__(self): # <<<<<<<<<<<<<< + * cdef tuple state + * cdef object _dict +*/ + + /* function exit code */ + __pyx_L1_error:; + __Pyx_XDECREF(__pyx_t_1); + __Pyx_XDECREF(__pyx_t_4); + __Pyx_XDECREF(__pyx_t_5); + __Pyx_AddTraceback("spacy.pipeline._parser_internals._beam_utils.BeamBatch.__reduce_cython__", __pyx_clineno, __pyx_lineno, __pyx_filename); + __pyx_r = NULL; + __pyx_L0:; + __Pyx_XDECREF(__pyx_v_state); + __Pyx_XDECREF(__pyx_v__dict); + __Pyx_XGIVEREF(__pyx_r); + __Pyx_RefNannyFinishContext(); + return __pyx_r; +} + +/* "(tree fragment)":16 + * else: + * return __pyx_unpickle_BeamBatch, (type(self), 0xa2d29a4, state) + * def __setstate_cython__(self, __pyx_state): # <<<<<<<<<<<<<< + * __pyx_unpickle_BeamBatch__set_state(self, __pyx_state) +*/ + +/* Python wrapper */ +static PyObject *__pyx_pw_5spacy_8pipeline_17_parser_internals_11_beam_utils_9BeamBatch_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_5spacy_8pipeline_17_parser_internals_11_beam_utils_9BeamBatch_16__setstate_cython__, "BeamBatch.__setstate_cython__(self, __pyx_state)"); +static PyMethodDef __pyx_mdef_5spacy_8pipeline_17_parser_internals_11_beam_utils_9BeamBatch_17__setstate_cython__ = {"__setstate_cython__", (PyCFunction)(void(*)(void))(__Pyx_PyCFunction_FastCallWithKeywords)__pyx_pw_5spacy_8pipeline_17_parser_internals_11_beam_utils_9BeamBatch_17__setstate_cython__, __Pyx_METH_FASTCALL|METH_KEYWORDS, __pyx_doc_5spacy_8pipeline_17_parser_internals_11_beam_utils_9BeamBatch_16__setstate_cython__}; +static PyObject *__pyx_pw_5spacy_8pipeline_17_parser_internals_11_beam_utils_9BeamBatch_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 +) { + 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, 16, __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, 16, __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, 16, __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, 16, __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, 16, __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, 16, __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("spacy.pipeline._parser_internals._beam_utils.BeamBatch.__setstate_cython__", __pyx_clineno, __pyx_lineno, __pyx_filename); + __Pyx_RefNannyFinishContext(); + return NULL; + __pyx_L4_argument_unpacking_done:; + __pyx_r = __pyx_pf_5spacy_8pipeline_17_parser_internals_11_beam_utils_9BeamBatch_16__setstate_cython__(((struct __pyx_obj_5spacy_8pipeline_17_parser_internals_11_beam_utils_BeamBatch *)__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_5spacy_8pipeline_17_parser_internals_11_beam_utils_9BeamBatch_16__setstate_cython__(struct __pyx_obj_5spacy_8pipeline_17_parser_internals_11_beam_utils_BeamBatch *__pyx_v_self, PyObject *__pyx_v___pyx_state) { + PyObject *__pyx_r = NULL; + __Pyx_RefNannyDeclarations + PyObject *__pyx_t_1 = NULL; + int __pyx_lineno = 0; + const char *__pyx_filename = NULL; + int __pyx_clineno = 0; + __Pyx_RefNannySetupContext("__setstate_cython__", 0); + + /* "(tree fragment)":17 + * return __pyx_unpickle_BeamBatch, (type(self), 0xa2d29a4, state) + * def __setstate_cython__(self, __pyx_state): + * __pyx_unpickle_BeamBatch__set_state(self, __pyx_state) # <<<<<<<<<<<<<< +*/ + __pyx_t_1 = __pyx_f_5spacy_8pipeline_17_parser_internals_11_beam_utils___pyx_unpickle_BeamBatch__set_state(__pyx_v_self, __pyx_v___pyx_state); if (unlikely(!__pyx_t_1)) __PYX_ERR(1, 17, __pyx_L1_error) + __Pyx_GOTREF(__pyx_t_1); + __Pyx_DECREF(__pyx_t_1); __pyx_t_1 = 0; + + /* "(tree fragment)":16 + * else: + * return __pyx_unpickle_BeamBatch, (type(self), 0xa2d29a4, state) + * def __setstate_cython__(self, __pyx_state): # <<<<<<<<<<<<<< + * __pyx_unpickle_BeamBatch__set_state(self, __pyx_state) +*/ + + /* function exit code */ + __pyx_r = Py_None; __Pyx_INCREF(Py_None); + goto __pyx_L0; + __pyx_L1_error:; + __Pyx_XDECREF(__pyx_t_1); + __Pyx_AddTraceback("spacy.pipeline._parser_internals._beam_utils.BeamBatch.__setstate_cython__", __pyx_clineno, __pyx_lineno, __pyx_filename); + __pyx_r = NULL; + __pyx_L0:; + __Pyx_XGIVEREF(__pyx_r); + __Pyx_RefNannyFinishContext(); + return __pyx_r; +} + +/* "spacy/pipeline/_parser_internals/_beam_utils.pyx":141 + * + * + * def update_beam(TransitionSystem moves, states, golds, model, int width, beam_density=0.0): # <<<<<<<<<<<<<< + * cdef MaxViolation violn + * pbeam = BeamBatch(moves, states, golds, width=width, density=beam_density) +*/ + +/* Python wrapper */ +static PyObject *__pyx_pw_5spacy_8pipeline_17_parser_internals_11_beam_utils_1update_beam(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_5spacy_8pipeline_17_parser_internals_11_beam_utils_update_beam, "update_beam(TransitionSystem moves, states, golds, model, int width, beam_density=0.0)"); +static PyMethodDef __pyx_mdef_5spacy_8pipeline_17_parser_internals_11_beam_utils_1update_beam = {"update_beam", (PyCFunction)(void(*)(void))(__Pyx_PyCFunction_FastCallWithKeywords)__pyx_pw_5spacy_8pipeline_17_parser_internals_11_beam_utils_1update_beam, __Pyx_METH_FASTCALL|METH_KEYWORDS, __pyx_doc_5spacy_8pipeline_17_parser_internals_11_beam_utils_update_beam}; +static PyObject *__pyx_pw_5spacy_8pipeline_17_parser_internals_11_beam_utils_1update_beam(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 +) { + struct __pyx_obj_5spacy_8pipeline_17_parser_internals_17transition_system_TransitionSystem *__pyx_v_moves = 0; + PyObject *__pyx_v_states = 0; + PyObject *__pyx_v_golds = 0; + PyObject *__pyx_v_model = 0; + int __pyx_v_width; + PyObject *__pyx_v_beam_density = 0; + #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("update_beam (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_moves,&__pyx_mstate_global->__pyx_n_u_states,&__pyx_mstate_global->__pyx_n_u_golds,&__pyx_mstate_global->__pyx_n_u_model,&__pyx_mstate_global->__pyx_n_u_width,&__pyx_mstate_global->__pyx_n_u_beam_density,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, 141, __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, 141, __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, 141, __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, 141, __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, 141, __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, 141, __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, 141, __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, "update_beam", 0) < (0)) __PYX_ERR(0, 141, __pyx_L3_error) + if (!values[5]) values[5] = __Pyx_NewRef(((PyObject *)((PyObject*)__pyx_mstate_global->__pyx_float_0_0))); + for (Py_ssize_t i = __pyx_nargs; i < 5; i++) { + if (unlikely(!values[i])) { __Pyx_RaiseArgtupleInvalid("update_beam", 0, 5, 6, i); __PYX_ERR(0, 141, __pyx_L3_error) } + } + } else { + switch (__pyx_nargs) { + case 6: + values[5] = __Pyx_ArgRef_FASTCALL(__pyx_args, 5); + if (!CYTHON_ASSUME_SAFE_MACROS && unlikely(!values[5])) __PYX_ERR(0, 141, __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, 141, __pyx_L3_error) + values[3] = __Pyx_ArgRef_FASTCALL(__pyx_args, 3); + if (!CYTHON_ASSUME_SAFE_MACROS && unlikely(!values[3])) __PYX_ERR(0, 141, __pyx_L3_error) + values[2] = __Pyx_ArgRef_FASTCALL(__pyx_args, 2); + if (!CYTHON_ASSUME_SAFE_MACROS && unlikely(!values[2])) __PYX_ERR(0, 141, __pyx_L3_error) + values[1] = __Pyx_ArgRef_FASTCALL(__pyx_args, 1); + if (!CYTHON_ASSUME_SAFE_MACROS && unlikely(!values[1])) __PYX_ERR(0, 141, __pyx_L3_error) + values[0] = __Pyx_ArgRef_FASTCALL(__pyx_args, 0); + if (!CYTHON_ASSUME_SAFE_MACROS && unlikely(!values[0])) __PYX_ERR(0, 141, __pyx_L3_error) + break; + default: goto __pyx_L5_argtuple_error; + } + if (!values[5]) values[5] = __Pyx_NewRef(((PyObject *)((PyObject*)__pyx_mstate_global->__pyx_float_0_0))); + } + __pyx_v_moves = ((struct __pyx_obj_5spacy_8pipeline_17_parser_internals_17transition_system_TransitionSystem *)values[0]); + __pyx_v_states = values[1]; + __pyx_v_golds = values[2]; + __pyx_v_model = values[3]; + __pyx_v_width = __Pyx_PyLong_As_int(values[4]); if (unlikely((__pyx_v_width == (int)-1) && PyErr_Occurred())) __PYX_ERR(0, 141, __pyx_L3_error) + __pyx_v_beam_density = values[5]; + } + goto __pyx_L6_skip; + __pyx_L5_argtuple_error:; + __Pyx_RaiseArgtupleInvalid("update_beam", 0, 5, 6, __pyx_nargs); __PYX_ERR(0, 141, __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("spacy.pipeline._parser_internals._beam_utils.update_beam", __pyx_clineno, __pyx_lineno, __pyx_filename); + __Pyx_RefNannyFinishContext(); + return NULL; + __pyx_L4_argument_unpacking_done:; + if (unlikely(!__Pyx_ArgTypeTest(((PyObject *)__pyx_v_moves), __pyx_mstate_global->__pyx_ptype_5spacy_8pipeline_17_parser_internals_17transition_system_TransitionSystem, 1, "moves", 0))) __PYX_ERR(0, 141, __pyx_L1_error) + __pyx_r = __pyx_pf_5spacy_8pipeline_17_parser_internals_11_beam_utils_update_beam(__pyx_self, __pyx_v_moves, __pyx_v_states, __pyx_v_golds, __pyx_v_model, __pyx_v_width, __pyx_v_beam_density); + + /* 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_5spacy_8pipeline_17_parser_internals_11_beam_utils_update_beam(CYTHON_UNUSED PyObject *__pyx_self, struct __pyx_obj_5spacy_8pipeline_17_parser_internals_17transition_system_TransitionSystem *__pyx_v_moves, PyObject *__pyx_v_states, PyObject *__pyx_v_golds, PyObject *__pyx_v_model, int __pyx_v_width, PyObject *__pyx_v_beam_density) { + struct __pyx_obj_5thinc_5extra_6search_MaxViolation *__pyx_v_violn = 0; + struct __pyx_obj_5spacy_8pipeline_17_parser_internals_11_beam_utils_BeamBatch *__pyx_v_pbeam = NULL; + struct __pyx_obj_5spacy_8pipeline_17_parser_internals_11_beam_utils_BeamBatch *__pyx_v_gbeam = NULL; + PyObject *__pyx_v_beam_maps = NULL; + PyObject *__pyx_v_backprops = NULL; + PyObject *__pyx_v_violns = NULL; + PyObject *__pyx_v_dones = NULL; + PyObject *__pyx_v_p_indices = NULL; + PyObject *__pyx_v_g_indices = NULL; + PyObject *__pyx_v_beam_map = NULL; + PyObject *__pyx_v_scores = NULL; + PyObject *__pyx_v_bp_scores = NULL; + PyObject *__pyx_v_i = NULL; + PyObject *__pyx_v_histories = NULL; + PyObject *__pyx_v_grads = NULL; + PyObject *__pyx_v_d_loss = NULL; + PyObject *__pyx_v_loss = NULL; + PyObject *__pyx_v_states_d_scores = NULL; + PyObject *__pyx_v_d_scores = NULL; + CYTHON_UNUSED PyObject *__pyx_v__ = NULL; + PyObject *__pyx_v_d_l = 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; + PyObject *__pyx_t_5 = NULL; + Py_ssize_t __pyx_t_6; + PyObject *(*__pyx_t_7)(PyObject *); + int __pyx_t_8; + int __pyx_t_9; + int __pyx_t_10; + PyObject *__pyx_t_11 = NULL; + PyObject *__pyx_t_12 = NULL; + PyObject *(*__pyx_t_13)(PyObject *); + int __pyx_t_14; + int __pyx_t_15; + Py_ssize_t __pyx_t_16; + int __pyx_lineno = 0; + const char *__pyx_filename = NULL; + int __pyx_clineno = 0; + __Pyx_RefNannySetupContext("update_beam", 0); + __Pyx_INCREF(__pyx_v_states); + + /* "spacy/pipeline/_parser_internals/_beam_utils.pyx":143 + * def update_beam(TransitionSystem moves, states, golds, model, int width, beam_density=0.0): + * cdef MaxViolation violn + * pbeam = BeamBatch(moves, states, golds, width=width, density=beam_density) # <<<<<<<<<<<<<< + * gbeam = BeamBatch(moves, states, golds, width=width, density=0.0) + * beam_maps = [] +*/ + __pyx_t_2 = NULL; + __pyx_t_3 = __Pyx_PyLong_From_int(__pyx_v_width); if (unlikely(!__pyx_t_3)) __PYX_ERR(0, 143, __pyx_L1_error) + __Pyx_GOTREF(__pyx_t_3); + __pyx_t_4 = 1; + { + PyObject *__pyx_callargs[4 + ((CYTHON_VECTORCALL) ? 2 : 0)] = {__pyx_t_2, ((PyObject *)__pyx_v_moves), __pyx_v_states, __pyx_v_golds}; + __pyx_t_5 = __Pyx_MakeVectorcallBuilderKwds(2); if (unlikely(!__pyx_t_5)) __PYX_ERR(0, 143, __pyx_L1_error) + __Pyx_GOTREF(__pyx_t_5); + if (__Pyx_VectorcallBuilder_AddArg(__pyx_mstate_global->__pyx_n_u_width, __pyx_t_3, __pyx_t_5, __pyx_callargs+4, 0) < (0)) __PYX_ERR(0, 143, __pyx_L1_error) + if (__Pyx_VectorcallBuilder_AddArg(__pyx_mstate_global->__pyx_n_u_density, __pyx_v_beam_density, __pyx_t_5, __pyx_callargs+4, 1) < (0)) __PYX_ERR(0, 143, __pyx_L1_error) + __pyx_t_1 = __Pyx_Object_Vectorcall_CallFromBuilder((PyObject*)__pyx_mstate_global->__pyx_ptype_5spacy_8pipeline_17_parser_internals_11_beam_utils_BeamBatch, __pyx_callargs+__pyx_t_4, (4-__pyx_t_4) | (__pyx_t_4*__Pyx_PY_VECTORCALL_ARGUMENTS_OFFSET), __pyx_t_5); + __Pyx_XDECREF(__pyx_t_2); __pyx_t_2 = 0; + __Pyx_DECREF(__pyx_t_3); __pyx_t_3 = 0; + __Pyx_DECREF(__pyx_t_5); __pyx_t_5 = 0; + if (unlikely(!__pyx_t_1)) __PYX_ERR(0, 143, __pyx_L1_error) + __Pyx_GOTREF((PyObject *)__pyx_t_1); + } + __pyx_v_pbeam = ((struct __pyx_obj_5spacy_8pipeline_17_parser_internals_11_beam_utils_BeamBatch *)__pyx_t_1); + __pyx_t_1 = 0; + + /* "spacy/pipeline/_parser_internals/_beam_utils.pyx":144 + * cdef MaxViolation violn + * pbeam = BeamBatch(moves, states, golds, width=width, density=beam_density) + * gbeam = BeamBatch(moves, states, golds, width=width, density=0.0) # <<<<<<<<<<<<<< + * beam_maps = [] + * backprops = [] +*/ + __pyx_t_5 = NULL; + __pyx_t_3 = __Pyx_PyLong_From_int(__pyx_v_width); if (unlikely(!__pyx_t_3)) __PYX_ERR(0, 144, __pyx_L1_error) + __Pyx_GOTREF(__pyx_t_3); + __pyx_t_4 = 1; + { + PyObject *__pyx_callargs[4 + ((CYTHON_VECTORCALL) ? 2 : 0)] = {__pyx_t_5, ((PyObject *)__pyx_v_moves), __pyx_v_states, __pyx_v_golds}; + __pyx_t_2 = __Pyx_MakeVectorcallBuilderKwds(2); if (unlikely(!__pyx_t_2)) __PYX_ERR(0, 144, __pyx_L1_error) + __Pyx_GOTREF(__pyx_t_2); + if (__Pyx_VectorcallBuilder_AddArg(__pyx_mstate_global->__pyx_n_u_width, __pyx_t_3, __pyx_t_2, __pyx_callargs+4, 0) < (0)) __PYX_ERR(0, 144, __pyx_L1_error) + if (__Pyx_VectorcallBuilder_AddArg(__pyx_mstate_global->__pyx_n_u_density, __pyx_mstate_global->__pyx_float_0_0, __pyx_t_2, __pyx_callargs+4, 1) < (0)) __PYX_ERR(0, 144, __pyx_L1_error) + __pyx_t_1 = __Pyx_Object_Vectorcall_CallFromBuilder((PyObject*)__pyx_mstate_global->__pyx_ptype_5spacy_8pipeline_17_parser_internals_11_beam_utils_BeamBatch, __pyx_callargs+__pyx_t_4, (4-__pyx_t_4) | (__pyx_t_4*__Pyx_PY_VECTORCALL_ARGUMENTS_OFFSET), __pyx_t_2); + __Pyx_XDECREF(__pyx_t_5); __pyx_t_5 = 0; + __Pyx_DECREF(__pyx_t_3); __pyx_t_3 = 0; + __Pyx_DECREF(__pyx_t_2); __pyx_t_2 = 0; + if (unlikely(!__pyx_t_1)) __PYX_ERR(0, 144, __pyx_L1_error) + __Pyx_GOTREF((PyObject *)__pyx_t_1); + } + __pyx_v_gbeam = ((struct __pyx_obj_5spacy_8pipeline_17_parser_internals_11_beam_utils_BeamBatch *)__pyx_t_1); + __pyx_t_1 = 0; + + /* "spacy/pipeline/_parser_internals/_beam_utils.pyx":145 + * pbeam = BeamBatch(moves, states, golds, width=width, density=beam_density) + * gbeam = BeamBatch(moves, states, golds, width=width, density=0.0) + * beam_maps = [] # <<<<<<<<<<<<<< + * backprops = [] + * violns = [MaxViolation() for _ in range(len(states))] +*/ + __pyx_t_1 = PyList_New(0); if (unlikely(!__pyx_t_1)) __PYX_ERR(0, 145, __pyx_L1_error) + __Pyx_GOTREF(__pyx_t_1); + __pyx_v_beam_maps = ((PyObject*)__pyx_t_1); + __pyx_t_1 = 0; + + /* "spacy/pipeline/_parser_internals/_beam_utils.pyx":146 + * gbeam = BeamBatch(moves, states, golds, width=width, density=0.0) + * beam_maps = [] + * backprops = [] # <<<<<<<<<<<<<< + * violns = [MaxViolation() for _ in range(len(states))] + * dones = [False for _ in states] +*/ + __pyx_t_1 = PyList_New(0); if (unlikely(!__pyx_t_1)) __PYX_ERR(0, 146, __pyx_L1_error) + __Pyx_GOTREF(__pyx_t_1); + __pyx_v_backprops = ((PyObject*)__pyx_t_1); + __pyx_t_1 = 0; + + /* "spacy/pipeline/_parser_internals/_beam_utils.pyx":147 + * beam_maps = [] + * backprops = [] + * violns = [MaxViolation() for _ in range(len(states))] # <<<<<<<<<<<<<< + * dones = [False for _ in states] + * while not pbeam.is_done or not gbeam.is_done: +*/ + __pyx_t_1 = PyList_New(0); if (unlikely(!__pyx_t_1)) __PYX_ERR(0, 147, __pyx_L1_error) + __Pyx_GOTREF(__pyx_t_1); + __pyx_t_3 = NULL; + __pyx_t_6 = PyObject_Length(__pyx_v_states); if (unlikely(__pyx_t_6 == ((Py_ssize_t)-1))) __PYX_ERR(0, 147, __pyx_L1_error) + __pyx_t_5 = PyLong_FromSsize_t(__pyx_t_6); if (unlikely(!__pyx_t_5)) __PYX_ERR(0, 147, __pyx_L1_error) + __Pyx_GOTREF(__pyx_t_5); + __pyx_t_4 = 1; + { + PyObject *__pyx_callargs[2] = {__pyx_t_3, __pyx_t_5}; + __pyx_t_2 = __Pyx_PyObject_FastCall((PyObject*)(&PyRange_Type), __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_5); __pyx_t_5 = 0; + if (unlikely(!__pyx_t_2)) __PYX_ERR(0, 147, __pyx_L1_error) + __Pyx_GOTREF(__pyx_t_2); + } + __pyx_t_5 = PyObject_GetIter(__pyx_t_2); if (unlikely(!__pyx_t_5)) __PYX_ERR(0, 147, __pyx_L1_error) + __Pyx_GOTREF(__pyx_t_5); + __pyx_t_7 = (CYTHON_COMPILING_IN_LIMITED_API) ? PyIter_Next : __Pyx_PyObject_GetIterNextFunc(__pyx_t_5); if (unlikely(!__pyx_t_7)) __PYX_ERR(0, 147, __pyx_L1_error) + __Pyx_DECREF(__pyx_t_2); __pyx_t_2 = 0; + for (;;) { + { + __pyx_t_2 = __pyx_t_7(__pyx_t_5); + 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, 147, __pyx_L1_error) + PyErr_Clear(); + } + break; + } + } + __Pyx_GOTREF(__pyx_t_2); + __Pyx_XDECREF_SET(__pyx_v__, __pyx_t_2); + __pyx_t_2 = 0; + __pyx_t_3 = NULL; + __pyx_t_4 = 1; + { + PyObject *__pyx_callargs[2] = {__pyx_t_3, NULL}; + __pyx_t_2 = __Pyx_PyObject_FastCall((PyObject*)__pyx_mstate_global->__pyx_ptype_5thinc_5extra_6search_MaxViolation, __pyx_callargs+__pyx_t_4, (1-__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, 147, __pyx_L1_error) + __Pyx_GOTREF((PyObject *)__pyx_t_2); + } + if (unlikely(__Pyx_ListComp_Append(__pyx_t_1, (PyObject*)__pyx_t_2))) __PYX_ERR(0, 147, __pyx_L1_error) + __Pyx_DECREF((PyObject *)__pyx_t_2); __pyx_t_2 = 0; + } + __Pyx_DECREF(__pyx_t_5); __pyx_t_5 = 0; + __pyx_v_violns = ((PyObject*)__pyx_t_1); + __pyx_t_1 = 0; + + /* "spacy/pipeline/_parser_internals/_beam_utils.pyx":148 + * backprops = [] + * violns = [MaxViolation() for _ in range(len(states))] + * dones = [False for _ in states] # <<<<<<<<<<<<<< + * while not pbeam.is_done or not gbeam.is_done: + * # The beam maps let us find the right row in the flattened scores +*/ + __pyx_t_1 = PyList_New(0); if (unlikely(!__pyx_t_1)) __PYX_ERR(0, 148, __pyx_L1_error) + __Pyx_GOTREF(__pyx_t_1); + if (likely(PyList_CheckExact(__pyx_v_states)) || PyTuple_CheckExact(__pyx_v_states)) { + __pyx_t_5 = __pyx_v_states; __Pyx_INCREF(__pyx_t_5); + __pyx_t_6 = 0; + __pyx_t_7 = NULL; + } else { + __pyx_t_6 = -1; __pyx_t_5 = PyObject_GetIter(__pyx_v_states); if (unlikely(!__pyx_t_5)) __PYX_ERR(0, 148, __pyx_L1_error) + __Pyx_GOTREF(__pyx_t_5); + __pyx_t_7 = (CYTHON_COMPILING_IN_LIMITED_API) ? PyIter_Next : __Pyx_PyObject_GetIterNextFunc(__pyx_t_5); if (unlikely(!__pyx_t_7)) __PYX_ERR(0, 148, __pyx_L1_error) + } + for (;;) { + if (likely(!__pyx_t_7)) { + if (likely(PyList_CheckExact(__pyx_t_5))) { + { + Py_ssize_t __pyx_temp = __Pyx_PyList_GET_SIZE(__pyx_t_5); + #if !CYTHON_ASSUME_SAFE_SIZE + if (unlikely((__pyx_temp < 0))) __PYX_ERR(0, 148, __pyx_L1_error) + #endif + if (__pyx_t_6 >= __pyx_temp) break; + } + __pyx_t_2 = __Pyx_PyList_GetItemRefFast(__pyx_t_5, __pyx_t_6, __Pyx_ReferenceSharing_OwnStrongReference); + ++__pyx_t_6; + } else { + { + Py_ssize_t __pyx_temp = __Pyx_PyTuple_GET_SIZE(__pyx_t_5); + #if !CYTHON_ASSUME_SAFE_SIZE + if (unlikely((__pyx_temp < 0))) __PYX_ERR(0, 148, __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_5, __pyx_t_6)); + #else + __pyx_t_2 = __Pyx_PySequence_ITEM(__pyx_t_5, __pyx_t_6); + #endif + ++__pyx_t_6; + } + if (unlikely(!__pyx_t_2)) __PYX_ERR(0, 148, __pyx_L1_error) + } else { + __pyx_t_2 = __pyx_t_7(__pyx_t_5); + 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, 148, __pyx_L1_error) + PyErr_Clear(); + } + break; + } + } + __Pyx_GOTREF(__pyx_t_2); + __Pyx_XDECREF_SET(__pyx_v__, __pyx_t_2); + __pyx_t_2 = 0; + if (unlikely(__Pyx_ListComp_Append(__pyx_t_1, (PyObject*)Py_False))) __PYX_ERR(0, 148, __pyx_L1_error) + } + __Pyx_DECREF(__pyx_t_5); __pyx_t_5 = 0; + __pyx_v_dones = ((PyObject*)__pyx_t_1); + __pyx_t_1 = 0; + + /* "spacy/pipeline/_parser_internals/_beam_utils.pyx":149 + * violns = [MaxViolation() for _ in range(len(states))] + * dones = [False for _ in states] + * while not pbeam.is_done or not gbeam.is_done: # <<<<<<<<<<<<<< + * # The beam maps let us find the right row in the flattened scores + * # array for each state. States are identified by (example id, +*/ + while (1) { + __pyx_t_1 = __Pyx_PyObject_GetAttrStr(((PyObject *)__pyx_v_pbeam), __pyx_mstate_global->__pyx_n_u_is_done); if (unlikely(!__pyx_t_1)) __PYX_ERR(0, 149, __pyx_L1_error) + __Pyx_GOTREF(__pyx_t_1); + __pyx_t_9 = __Pyx_PyObject_IsTrue(__pyx_t_1); if (unlikely((__pyx_t_9 < 0))) __PYX_ERR(0, 149, __pyx_L1_error) + __Pyx_DECREF(__pyx_t_1); __pyx_t_1 = 0; + __pyx_t_10 = (!__pyx_t_9); + if (!__pyx_t_10) { + } else { + __pyx_t_8 = __pyx_t_10; + goto __pyx_L11_bool_binop_done; + } + __pyx_t_1 = __Pyx_PyObject_GetAttrStr(((PyObject *)__pyx_v_gbeam), __pyx_mstate_global->__pyx_n_u_is_done); if (unlikely(!__pyx_t_1)) __PYX_ERR(0, 149, __pyx_L1_error) + __Pyx_GOTREF(__pyx_t_1); + __pyx_t_10 = __Pyx_PyObject_IsTrue(__pyx_t_1); if (unlikely((__pyx_t_10 < 0))) __PYX_ERR(0, 149, __pyx_L1_error) + __Pyx_DECREF(__pyx_t_1); __pyx_t_1 = 0; + __pyx_t_9 = (!__pyx_t_10); + __pyx_t_8 = __pyx_t_9; + __pyx_L11_bool_binop_done:; + if (!__pyx_t_8) break; + + /* "spacy/pipeline/_parser_internals/_beam_utils.pyx":159 + * # in both beams. To figure out which beam each state belonged to, + * # we keep two lists of indices, p_indices and g_indices + * states, p_indices, g_indices, beam_map = get_unique_states(pbeam, gbeam) # <<<<<<<<<<<<<< + * beam_maps.append(beam_map) + * if not states: +*/ + __pyx_t_5 = NULL; + __Pyx_GetModuleGlobalName(__pyx_t_2, __pyx_mstate_global->__pyx_n_u_get_unique_states); if (unlikely(!__pyx_t_2)) __PYX_ERR(0, 159, __pyx_L1_error) + __Pyx_GOTREF(__pyx_t_2); + __pyx_t_4 = 1; + #if CYTHON_UNPACK_METHODS + if (unlikely(PyMethod_Check(__pyx_t_2))) { + __pyx_t_5 = PyMethod_GET_SELF(__pyx_t_2); + assert(__pyx_t_5); + PyObject* __pyx__function = PyMethod_GET_FUNCTION(__pyx_t_2); + __Pyx_INCREF(__pyx_t_5); + __Pyx_INCREF(__pyx__function); + __Pyx_DECREF_SET(__pyx_t_2, __pyx__function); + __pyx_t_4 = 0; + } + #endif + { + PyObject *__pyx_callargs[3] = {__pyx_t_5, ((PyObject *)__pyx_v_pbeam), ((PyObject *)__pyx_v_gbeam)}; + __pyx_t_1 = __Pyx_PyObject_FastCall((PyObject*)__pyx_t_2, __pyx_callargs+__pyx_t_4, (3-__pyx_t_4) | (__pyx_t_4*__Pyx_PY_VECTORCALL_ARGUMENTS_OFFSET)); + __Pyx_XDECREF(__pyx_t_5); __pyx_t_5 = 0; + __Pyx_DECREF(__pyx_t_2); __pyx_t_2 = 0; + if (unlikely(!__pyx_t_1)) __PYX_ERR(0, 159, __pyx_L1_error) + __Pyx_GOTREF(__pyx_t_1); + } + if ((likely(PyTuple_CheckExact(__pyx_t_1))) || (PyList_CheckExact(__pyx_t_1))) { + PyObject* sequence = __pyx_t_1; + Py_ssize_t size = __Pyx_PySequence_SIZE(sequence); + if (unlikely(size != 4)) { + if (size > 4) __Pyx_RaiseTooManyValuesError(4); + else if (size >= 0) __Pyx_RaiseNeedMoreValuesError(size); + __PYX_ERR(0, 159, __pyx_L1_error) + } + #if CYTHON_ASSUME_SAFE_MACROS && !CYTHON_AVOID_BORROWED_REFS + if (likely(PyTuple_CheckExact(sequence))) { + __pyx_t_2 = PyTuple_GET_ITEM(sequence, 0); + __Pyx_INCREF(__pyx_t_2); + __pyx_t_5 = PyTuple_GET_ITEM(sequence, 1); + __Pyx_INCREF(__pyx_t_5); + __pyx_t_3 = PyTuple_GET_ITEM(sequence, 2); + __Pyx_INCREF(__pyx_t_3); + __pyx_t_11 = PyTuple_GET_ITEM(sequence, 3); + __Pyx_INCREF(__pyx_t_11); + } else { + __pyx_t_2 = __Pyx_PyList_GetItemRefFast(sequence, 0, __Pyx_ReferenceSharing_SharedReference); + if (unlikely(!__pyx_t_2)) __PYX_ERR(0, 159, __pyx_L1_error) + __Pyx_XGOTREF(__pyx_t_2); + __pyx_t_5 = __Pyx_PyList_GetItemRefFast(sequence, 1, __Pyx_ReferenceSharing_SharedReference); + if (unlikely(!__pyx_t_5)) __PYX_ERR(0, 159, __pyx_L1_error) + __Pyx_XGOTREF(__pyx_t_5); + __pyx_t_3 = __Pyx_PyList_GetItemRefFast(sequence, 2, __Pyx_ReferenceSharing_SharedReference); + if (unlikely(!__pyx_t_3)) __PYX_ERR(0, 159, __pyx_L1_error) + __Pyx_XGOTREF(__pyx_t_3); + __pyx_t_11 = __Pyx_PyList_GetItemRefFast(sequence, 3, __Pyx_ReferenceSharing_SharedReference); + if (unlikely(!__pyx_t_11)) __PYX_ERR(0, 159, __pyx_L1_error) + __Pyx_XGOTREF(__pyx_t_11); + } + #else + { + Py_ssize_t i; + PyObject** temps[4] = {&__pyx_t_2,&__pyx_t_5,&__pyx_t_3,&__pyx_t_11}; + for (i=0; i < 4; i++) { + PyObject* item = __Pyx_PySequence_ITEM(sequence, i); if (unlikely(!item)) __PYX_ERR(0, 159, __pyx_L1_error) + __Pyx_GOTREF(item); + *(temps[i]) = item; + } + } + #endif + __Pyx_DECREF(__pyx_t_1); __pyx_t_1 = 0; + } else { + Py_ssize_t index = -1; + PyObject** temps[4] = {&__pyx_t_2,&__pyx_t_5,&__pyx_t_3,&__pyx_t_11}; + __pyx_t_12 = PyObject_GetIter(__pyx_t_1); if (unlikely(!__pyx_t_12)) __PYX_ERR(0, 159, __pyx_L1_error) + __Pyx_GOTREF(__pyx_t_12); + __Pyx_DECREF(__pyx_t_1); __pyx_t_1 = 0; + __pyx_t_13 = (CYTHON_COMPILING_IN_LIMITED_API) ? PyIter_Next : __Pyx_PyObject_GetIterNextFunc(__pyx_t_12); + for (index=0; index < 4; index++) { + PyObject* item = __pyx_t_13(__pyx_t_12); if (unlikely(!item)) goto __pyx_L13_unpacking_failed; + __Pyx_GOTREF(item); + *(temps[index]) = item; + } + if (__Pyx_IternextUnpackEndCheck(__pyx_t_13(__pyx_t_12), 4) < (0)) __PYX_ERR(0, 159, __pyx_L1_error) + __pyx_t_13 = NULL; + __Pyx_DECREF(__pyx_t_12); __pyx_t_12 = 0; + goto __pyx_L14_unpacking_done; + __pyx_L13_unpacking_failed:; + __Pyx_DECREF(__pyx_t_12); __pyx_t_12 = 0; + __pyx_t_13 = NULL; + if (__Pyx_IterFinish() == 0) __Pyx_RaiseNeedMoreValuesError(index); + __PYX_ERR(0, 159, __pyx_L1_error) + __pyx_L14_unpacking_done:; + } + __Pyx_DECREF_SET(__pyx_v_states, __pyx_t_2); + __pyx_t_2 = 0; + __Pyx_XDECREF_SET(__pyx_v_p_indices, __pyx_t_5); + __pyx_t_5 = 0; + __Pyx_XDECREF_SET(__pyx_v_g_indices, __pyx_t_3); + __pyx_t_3 = 0; + __Pyx_XDECREF_SET(__pyx_v_beam_map, __pyx_t_11); + __pyx_t_11 = 0; + + /* "spacy/pipeline/_parser_internals/_beam_utils.pyx":160 + * # we keep two lists of indices, p_indices and g_indices + * states, p_indices, g_indices, beam_map = get_unique_states(pbeam, gbeam) + * beam_maps.append(beam_map) # <<<<<<<<<<<<<< + * if not states: + * break +*/ + __pyx_t_14 = __Pyx_PyList_Append(__pyx_v_beam_maps, __pyx_v_beam_map); if (unlikely(__pyx_t_14 == ((int)-1))) __PYX_ERR(0, 160, __pyx_L1_error) + + /* "spacy/pipeline/_parser_internals/_beam_utils.pyx":161 + * states, p_indices, g_indices, beam_map = get_unique_states(pbeam, gbeam) + * beam_maps.append(beam_map) + * if not states: # <<<<<<<<<<<<<< + * break + * # Now that we have our flat list of states, feed them through the model +*/ + __pyx_t_8 = __Pyx_PyObject_IsTrue(__pyx_v_states); if (unlikely((__pyx_t_8 < 0))) __PYX_ERR(0, 161, __pyx_L1_error) + __pyx_t_9 = (!__pyx_t_8); + if (__pyx_t_9) { + + /* "spacy/pipeline/_parser_internals/_beam_utils.pyx":162 + * beam_maps.append(beam_map) + * if not states: + * break # <<<<<<<<<<<<<< + * # Now that we have our flat list of states, feed them through the model + * scores, bp_scores = model.begin_update(states) +*/ + goto __pyx_L10_break; + + /* "spacy/pipeline/_parser_internals/_beam_utils.pyx":161 + * states, p_indices, g_indices, beam_map = get_unique_states(pbeam, gbeam) + * beam_maps.append(beam_map) + * if not states: # <<<<<<<<<<<<<< + * break + * # Now that we have our flat list of states, feed them through the model +*/ + } + + /* "spacy/pipeline/_parser_internals/_beam_utils.pyx":164 + * break + * # Now that we have our flat list of states, feed them through the model + * scores, bp_scores = model.begin_update(states) # <<<<<<<<<<<<<< + * assert scores.size != 0 + * # Store the callbacks for the backward pass +*/ + __pyx_t_11 = __pyx_v_model; + __Pyx_INCREF(__pyx_t_11); + __pyx_t_4 = 0; + { + PyObject *__pyx_callargs[2] = {__pyx_t_11, __pyx_v_states}; + __pyx_t_1 = __Pyx_PyObject_FastCallMethod((PyObject*)__pyx_mstate_global->__pyx_n_u_begin_update, __pyx_callargs+__pyx_t_4, (2-__pyx_t_4) | (1*__Pyx_PY_VECTORCALL_ARGUMENTS_OFFSET)); + __Pyx_XDECREF(__pyx_t_11); __pyx_t_11 = 0; + if (unlikely(!__pyx_t_1)) __PYX_ERR(0, 164, __pyx_L1_error) + __Pyx_GOTREF(__pyx_t_1); + } + if ((likely(PyTuple_CheckExact(__pyx_t_1))) || (PyList_CheckExact(__pyx_t_1))) { + PyObject* sequence = __pyx_t_1; + 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, 164, __pyx_L1_error) + } + #if CYTHON_ASSUME_SAFE_MACROS && !CYTHON_AVOID_BORROWED_REFS + if (likely(PyTuple_CheckExact(sequence))) { + __pyx_t_11 = PyTuple_GET_ITEM(sequence, 0); + __Pyx_INCREF(__pyx_t_11); + __pyx_t_3 = PyTuple_GET_ITEM(sequence, 1); + __Pyx_INCREF(__pyx_t_3); + } else { + __pyx_t_11 = __Pyx_PyList_GetItemRefFast(sequence, 0, __Pyx_ReferenceSharing_SharedReference); + if (unlikely(!__pyx_t_11)) __PYX_ERR(0, 164, __pyx_L1_error) + __Pyx_XGOTREF(__pyx_t_11); + __pyx_t_3 = __Pyx_PyList_GetItemRefFast(sequence, 1, __Pyx_ReferenceSharing_SharedReference); + if (unlikely(!__pyx_t_3)) __PYX_ERR(0, 164, __pyx_L1_error) + __Pyx_XGOTREF(__pyx_t_3); + } + #else + __pyx_t_11 = __Pyx_PySequence_ITEM(sequence, 0); if (unlikely(!__pyx_t_11)) __PYX_ERR(0, 164, __pyx_L1_error) + __Pyx_GOTREF(__pyx_t_11); + __pyx_t_3 = __Pyx_PySequence_ITEM(sequence, 1); if (unlikely(!__pyx_t_3)) __PYX_ERR(0, 164, __pyx_L1_error) + __Pyx_GOTREF(__pyx_t_3); + #endif + __Pyx_DECREF(__pyx_t_1); __pyx_t_1 = 0; + } else { + Py_ssize_t index = -1; + __pyx_t_5 = PyObject_GetIter(__pyx_t_1); if (unlikely(!__pyx_t_5)) __PYX_ERR(0, 164, __pyx_L1_error) + __Pyx_GOTREF(__pyx_t_5); + __Pyx_DECREF(__pyx_t_1); __pyx_t_1 = 0; + __pyx_t_13 = (CYTHON_COMPILING_IN_LIMITED_API) ? PyIter_Next : __Pyx_PyObject_GetIterNextFunc(__pyx_t_5); + index = 0; __pyx_t_11 = __pyx_t_13(__pyx_t_5); if (unlikely(!__pyx_t_11)) goto __pyx_L16_unpacking_failed; + __Pyx_GOTREF(__pyx_t_11); + index = 1; __pyx_t_3 = __pyx_t_13(__pyx_t_5); if (unlikely(!__pyx_t_3)) goto __pyx_L16_unpacking_failed; + __Pyx_GOTREF(__pyx_t_3); + if (__Pyx_IternextUnpackEndCheck(__pyx_t_13(__pyx_t_5), 2) < (0)) __PYX_ERR(0, 164, __pyx_L1_error) + __pyx_t_13 = NULL; + __Pyx_DECREF(__pyx_t_5); __pyx_t_5 = 0; + goto __pyx_L17_unpacking_done; + __pyx_L16_unpacking_failed:; + __Pyx_DECREF(__pyx_t_5); __pyx_t_5 = 0; + __pyx_t_13 = NULL; + if (__Pyx_IterFinish() == 0) __Pyx_RaiseNeedMoreValuesError(index); + __PYX_ERR(0, 164, __pyx_L1_error) + __pyx_L17_unpacking_done:; + } + __Pyx_XDECREF_SET(__pyx_v_scores, __pyx_t_11); + __pyx_t_11 = 0; + __Pyx_XDECREF_SET(__pyx_v_bp_scores, __pyx_t_3); + __pyx_t_3 = 0; + + /* "spacy/pipeline/_parser_internals/_beam_utils.pyx":165 + * # Now that we have our flat list of states, feed them through the model + * scores, bp_scores = model.begin_update(states) + * assert scores.size != 0 # <<<<<<<<<<<<<< + * # Store the callbacks for the backward pass + * backprops.append(bp_scores) +*/ + #ifndef CYTHON_WITHOUT_ASSERTIONS + if (unlikely(__pyx_assertions_enabled())) { + __pyx_t_1 = __Pyx_PyObject_GetAttrStr(__pyx_v_scores, __pyx_mstate_global->__pyx_n_u_size); if (unlikely(!__pyx_t_1)) __PYX_ERR(0, 165, __pyx_L1_error) + __Pyx_GOTREF(__pyx_t_1); + __pyx_t_9 = (__Pyx_PyLong_BoolNeObjC(__pyx_t_1, __pyx_mstate_global->__pyx_int_0, 0, 0)); if (unlikely((__pyx_t_9 < 0))) __PYX_ERR(0, 165, __pyx_L1_error) + __Pyx_DECREF(__pyx_t_1); __pyx_t_1 = 0; + if (unlikely(!__pyx_t_9)) { + __Pyx_Raise(((PyObject *)(((PyTypeObject*)PyExc_AssertionError))), 0, 0, 0); + __PYX_ERR(0, 165, __pyx_L1_error) + } + } + #else + if ((1)); else __PYX_ERR(0, 165, __pyx_L1_error) + #endif + + /* "spacy/pipeline/_parser_internals/_beam_utils.pyx":167 + * assert scores.size != 0 + * # Store the callbacks for the backward pass + * backprops.append(bp_scores) # <<<<<<<<<<<<<< + * # Unpack the scores for the two beams. The indices arrays + * # tell us which example and state the scores-row refers to. +*/ + __pyx_t_14 = __Pyx_PyList_Append(__pyx_v_backprops, __pyx_v_bp_scores); if (unlikely(__pyx_t_14 == ((int)-1))) __PYX_ERR(0, 167, __pyx_L1_error) + + /* "spacy/pipeline/_parser_internals/_beam_utils.pyx":172 + * # Now advance the states in the beams. The gold beam is constrained to + * # to follow only gold analyses. + * if not pbeam.is_done: # <<<<<<<<<<<<<< + * pbeam.advance(model.ops.as_contig(scores[p_indices])) + * if not gbeam.is_done: +*/ + __pyx_t_1 = __Pyx_PyObject_GetAttrStr(((PyObject *)__pyx_v_pbeam), __pyx_mstate_global->__pyx_n_u_is_done); if (unlikely(!__pyx_t_1)) __PYX_ERR(0, 172, __pyx_L1_error) + __Pyx_GOTREF(__pyx_t_1); + __pyx_t_9 = __Pyx_PyObject_IsTrue(__pyx_t_1); if (unlikely((__pyx_t_9 < 0))) __PYX_ERR(0, 172, __pyx_L1_error) + __Pyx_DECREF(__pyx_t_1); __pyx_t_1 = 0; + __pyx_t_8 = (!__pyx_t_9); + if (__pyx_t_8) { + + /* "spacy/pipeline/_parser_internals/_beam_utils.pyx":173 + * # to follow only gold analyses. + * if not pbeam.is_done: + * pbeam.advance(model.ops.as_contig(scores[p_indices])) # <<<<<<<<<<<<<< + * if not gbeam.is_done: + * gbeam.advance(model.ops.as_contig(scores[g_indices]), follow_gold=True) +*/ + __pyx_t_3 = ((PyObject *)__pyx_v_pbeam); + __Pyx_INCREF(__pyx_t_3); + __pyx_t_2 = __Pyx_PyObject_GetAttrStr(__pyx_v_model, __pyx_mstate_global->__pyx_n_u_ops); if (unlikely(!__pyx_t_2)) __PYX_ERR(0, 173, __pyx_L1_error) + __Pyx_GOTREF(__pyx_t_2); + __pyx_t_5 = __pyx_t_2; + __Pyx_INCREF(__pyx_t_5); + __pyx_t_12 = __Pyx_PyObject_GetItem(__pyx_v_scores, __pyx_v_p_indices); if (unlikely(!__pyx_t_12)) __PYX_ERR(0, 173, __pyx_L1_error) + __Pyx_GOTREF(__pyx_t_12); + __pyx_t_4 = 0; + { + PyObject *__pyx_callargs[2] = {__pyx_t_5, __pyx_t_12}; + __pyx_t_11 = __Pyx_PyObject_FastCallMethod((PyObject*)__pyx_mstate_global->__pyx_n_u_as_contig, __pyx_callargs+__pyx_t_4, (2-__pyx_t_4) | (1*__Pyx_PY_VECTORCALL_ARGUMENTS_OFFSET)); + __Pyx_XDECREF(__pyx_t_5); __pyx_t_5 = 0; + __Pyx_DECREF(__pyx_t_12); __pyx_t_12 = 0; + __Pyx_DECREF(__pyx_t_2); __pyx_t_2 = 0; + if (unlikely(!__pyx_t_11)) __PYX_ERR(0, 173, __pyx_L1_error) + __Pyx_GOTREF(__pyx_t_11); + } + __pyx_t_4 = 0; + { + PyObject *__pyx_callargs[2] = {__pyx_t_3, __pyx_t_11}; + __pyx_t_1 = __Pyx_PyObject_FastCallMethod((PyObject*)__pyx_mstate_global->__pyx_n_u_advance, __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_11); __pyx_t_11 = 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; + + /* "spacy/pipeline/_parser_internals/_beam_utils.pyx":172 + * # Now advance the states in the beams. The gold beam is constrained to + * # to follow only gold analyses. + * if not pbeam.is_done: # <<<<<<<<<<<<<< + * pbeam.advance(model.ops.as_contig(scores[p_indices])) + * if not gbeam.is_done: +*/ + } + + /* "spacy/pipeline/_parser_internals/_beam_utils.pyx":174 + * if not pbeam.is_done: + * pbeam.advance(model.ops.as_contig(scores[p_indices])) + * if not gbeam.is_done: # <<<<<<<<<<<<<< + * gbeam.advance(model.ops.as_contig(scores[g_indices]), follow_gold=True) + * # Track the "maximum violation", to use in the update. +*/ + __pyx_t_1 = __Pyx_PyObject_GetAttrStr(((PyObject *)__pyx_v_gbeam), __pyx_mstate_global->__pyx_n_u_is_done); if (unlikely(!__pyx_t_1)) __PYX_ERR(0, 174, __pyx_L1_error) + __Pyx_GOTREF(__pyx_t_1); + __pyx_t_8 = __Pyx_PyObject_IsTrue(__pyx_t_1); if (unlikely((__pyx_t_8 < 0))) __PYX_ERR(0, 174, __pyx_L1_error) + __Pyx_DECREF(__pyx_t_1); __pyx_t_1 = 0; + __pyx_t_9 = (!__pyx_t_8); + if (__pyx_t_9) { + + /* "spacy/pipeline/_parser_internals/_beam_utils.pyx":175 + * pbeam.advance(model.ops.as_contig(scores[p_indices])) + * if not gbeam.is_done: + * gbeam.advance(model.ops.as_contig(scores[g_indices]), follow_gold=True) # <<<<<<<<<<<<<< + * # Track the "maximum violation", to use in the update. + * for i, violn in enumerate(violns): +*/ + __pyx_t_11 = ((PyObject *)__pyx_v_gbeam); + __Pyx_INCREF(__pyx_t_11); + __pyx_t_12 = __Pyx_PyObject_GetAttrStr(__pyx_v_model, __pyx_mstate_global->__pyx_n_u_ops); if (unlikely(!__pyx_t_12)) __PYX_ERR(0, 175, __pyx_L1_error) + __Pyx_GOTREF(__pyx_t_12); + __pyx_t_2 = __pyx_t_12; + __Pyx_INCREF(__pyx_t_2); + __pyx_t_5 = __Pyx_PyObject_GetItem(__pyx_v_scores, __pyx_v_g_indices); if (unlikely(!__pyx_t_5)) __PYX_ERR(0, 175, __pyx_L1_error) + __Pyx_GOTREF(__pyx_t_5); + __pyx_t_4 = 0; + { + PyObject *__pyx_callargs[2] = {__pyx_t_2, __pyx_t_5}; + __pyx_t_3 = __Pyx_PyObject_FastCallMethod((PyObject*)__pyx_mstate_global->__pyx_n_u_as_contig, __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_5); __pyx_t_5 = 0; + __Pyx_DECREF(__pyx_t_12); __pyx_t_12 = 0; + if (unlikely(!__pyx_t_3)) __PYX_ERR(0, 175, __pyx_L1_error) + __Pyx_GOTREF(__pyx_t_3); + } + __pyx_t_4 = 0; + { + PyObject *__pyx_callargs[2 + ((CYTHON_VECTORCALL) ? 1 : 0)] = {__pyx_t_11, __pyx_t_3}; + __pyx_t_12 = __Pyx_MakeVectorcallBuilderKwds(1); if (unlikely(!__pyx_t_12)) __PYX_ERR(0, 175, __pyx_L1_error) + __Pyx_GOTREF(__pyx_t_12); + if (__Pyx_VectorcallBuilder_AddArg(__pyx_mstate_global->__pyx_n_u_follow_gold, Py_True, __pyx_t_12, __pyx_callargs+2, 0) < (0)) __PYX_ERR(0, 175, __pyx_L1_error) + __pyx_t_1 = __Pyx_Object_VectorcallMethod_CallFromBuilder((PyObject*)__pyx_mstate_global->__pyx_n_u_advance, __pyx_callargs+__pyx_t_4, (2-__pyx_t_4) | (1*__Pyx_PY_VECTORCALL_ARGUMENTS_OFFSET), __pyx_t_12); + __Pyx_XDECREF(__pyx_t_11); __pyx_t_11 = 0; + __Pyx_DECREF(__pyx_t_3); __pyx_t_3 = 0; + __Pyx_DECREF(__pyx_t_12); __pyx_t_12 = 0; + if (unlikely(!__pyx_t_1)) __PYX_ERR(0, 175, __pyx_L1_error) + __Pyx_GOTREF(__pyx_t_1); + } + __Pyx_DECREF(__pyx_t_1); __pyx_t_1 = 0; + + /* "spacy/pipeline/_parser_internals/_beam_utils.pyx":174 + * if not pbeam.is_done: + * pbeam.advance(model.ops.as_contig(scores[p_indices])) + * if not gbeam.is_done: # <<<<<<<<<<<<<< + * gbeam.advance(model.ops.as_contig(scores[g_indices]), follow_gold=True) + * # Track the "maximum violation", to use in the update. +*/ + } + + /* "spacy/pipeline/_parser_internals/_beam_utils.pyx":177 + * gbeam.advance(model.ops.as_contig(scores[g_indices]), follow_gold=True) + * # Track the "maximum violation", to use in the update. + * for i, violn in enumerate(violns): # <<<<<<<<<<<<<< + * if not dones[i]: + * violn.check_crf(pbeam[i], gbeam[i]) +*/ + __Pyx_INCREF(__pyx_mstate_global->__pyx_int_0); + __pyx_t_1 = __pyx_mstate_global->__pyx_int_0; + __pyx_t_12 = __pyx_v_violns; __Pyx_INCREF(__pyx_t_12); + __pyx_t_6 = 0; + for (;;) { + { + 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, 177, __pyx_L1_error) + #endif + if (__pyx_t_6 >= __pyx_temp) break; + } + __pyx_t_3 = __Pyx_PyList_GetItemRefFast(__pyx_t_12, __pyx_t_6, __Pyx_ReferenceSharing_OwnStrongReference); + ++__pyx_t_6; + if (unlikely(!__pyx_t_3)) __PYX_ERR(0, 177, __pyx_L1_error) + __Pyx_GOTREF(__pyx_t_3); + if (!(likely(((__pyx_t_3) == Py_None) || likely(__Pyx_TypeTest(__pyx_t_3, __pyx_mstate_global->__pyx_ptype_5thinc_5extra_6search_MaxViolation))))) __PYX_ERR(0, 177, __pyx_L1_error) + __Pyx_XDECREF_SET(__pyx_v_violn, ((struct __pyx_obj_5thinc_5extra_6search_MaxViolation *)__pyx_t_3)); + __pyx_t_3 = 0; + __Pyx_INCREF(__pyx_t_1); + __Pyx_XDECREF_SET(__pyx_v_i, __pyx_t_1); + __pyx_t_3 = __Pyx_PyLong_AddObjC(__pyx_t_1, __pyx_mstate_global->__pyx_int_1, 1, 0, 0); if (unlikely(!__pyx_t_3)) __PYX_ERR(0, 177, __pyx_L1_error) + __Pyx_GOTREF(__pyx_t_3); + __Pyx_DECREF(__pyx_t_1); + __pyx_t_1 = __pyx_t_3; + __pyx_t_3 = 0; + + /* "spacy/pipeline/_parser_internals/_beam_utils.pyx":178 + * # Track the "maximum violation", to use in the update. + * for i, violn in enumerate(violns): + * if not dones[i]: # <<<<<<<<<<<<<< + * violn.check_crf(pbeam[i], gbeam[i]) + * if pbeam[i].is_done and gbeam[i].is_done: +*/ + __pyx_t_3 = __Pyx_PyObject_GetItem(__pyx_v_dones, __pyx_v_i); if (unlikely(!__pyx_t_3)) __PYX_ERR(0, 178, __pyx_L1_error) + __Pyx_GOTREF(__pyx_t_3); + __pyx_t_9 = __Pyx_PyObject_IsTrue(__pyx_t_3); if (unlikely((__pyx_t_9 < 0))) __PYX_ERR(0, 178, __pyx_L1_error) + __Pyx_DECREF(__pyx_t_3); __pyx_t_3 = 0; + __pyx_t_8 = (!__pyx_t_9); + if (__pyx_t_8) { + + /* "spacy/pipeline/_parser_internals/_beam_utils.pyx":179 + * for i, violn in enumerate(violns): + * if not dones[i]: + * violn.check_crf(pbeam[i], gbeam[i]) # <<<<<<<<<<<<<< + * if pbeam[i].is_done and gbeam[i].is_done: + * dones[i] = True +*/ + __pyx_t_3 = __Pyx_PyObject_GetItem(((PyObject *)__pyx_v_pbeam), __pyx_v_i); if (unlikely(!__pyx_t_3)) __PYX_ERR(0, 179, __pyx_L1_error) + __Pyx_GOTREF(__pyx_t_3); + if (!(likely(((__pyx_t_3) == Py_None) || likely(__Pyx_TypeTest(__pyx_t_3, __pyx_mstate_global->__pyx_ptype_5thinc_5extra_6search_Beam))))) __PYX_ERR(0, 179, __pyx_L1_error) + __pyx_t_11 = __Pyx_PyObject_GetItem(((PyObject *)__pyx_v_gbeam), __pyx_v_i); if (unlikely(!__pyx_t_11)) __PYX_ERR(0, 179, __pyx_L1_error) + __Pyx_GOTREF(__pyx_t_11); + if (!(likely(((__pyx_t_11) == Py_None) || likely(__Pyx_TypeTest(__pyx_t_11, __pyx_mstate_global->__pyx_ptype_5thinc_5extra_6search_Beam))))) __PYX_ERR(0, 179, __pyx_L1_error) + __pyx_t_15 = ((struct __pyx_vtabstruct_5thinc_5extra_6search_MaxViolation *)__pyx_v_violn->__pyx_vtab)->check_crf(__pyx_v_violn, ((struct __pyx_obj_5thinc_5extra_6search_Beam *)__pyx_t_3), ((struct __pyx_obj_5thinc_5extra_6search_Beam *)__pyx_t_11), 0); if (unlikely(__pyx_t_15 == ((int)-1))) __PYX_ERR(0, 179, __pyx_L1_error) + __Pyx_DECREF(__pyx_t_3); __pyx_t_3 = 0; + __Pyx_DECREF(__pyx_t_11); __pyx_t_11 = 0; + + /* "spacy/pipeline/_parser_internals/_beam_utils.pyx":180 + * if not dones[i]: + * violn.check_crf(pbeam[i], gbeam[i]) + * if pbeam[i].is_done and gbeam[i].is_done: # <<<<<<<<<<<<<< + * dones[i] = True + * histories = [] +*/ + __pyx_t_11 = __Pyx_PyObject_GetItem(((PyObject *)__pyx_v_pbeam), __pyx_v_i); if (unlikely(!__pyx_t_11)) __PYX_ERR(0, 180, __pyx_L1_error) + __Pyx_GOTREF(__pyx_t_11); + __pyx_t_3 = __Pyx_PyObject_GetAttrStr(__pyx_t_11, __pyx_mstate_global->__pyx_n_u_is_done); if (unlikely(!__pyx_t_3)) __PYX_ERR(0, 180, __pyx_L1_error) + __Pyx_GOTREF(__pyx_t_3); + __Pyx_DECREF(__pyx_t_11); __pyx_t_11 = 0; + __pyx_t_9 = __Pyx_PyObject_IsTrue(__pyx_t_3); if (unlikely((__pyx_t_9 < 0))) __PYX_ERR(0, 180, __pyx_L1_error) + __Pyx_DECREF(__pyx_t_3); __pyx_t_3 = 0; + if (__pyx_t_9) { + } else { + __pyx_t_8 = __pyx_t_9; + goto __pyx_L24_bool_binop_done; + } + __pyx_t_3 = __Pyx_PyObject_GetItem(((PyObject *)__pyx_v_gbeam), __pyx_v_i); if (unlikely(!__pyx_t_3)) __PYX_ERR(0, 180, __pyx_L1_error) + __Pyx_GOTREF(__pyx_t_3); + __pyx_t_11 = __Pyx_PyObject_GetAttrStr(__pyx_t_3, __pyx_mstate_global->__pyx_n_u_is_done); if (unlikely(!__pyx_t_11)) __PYX_ERR(0, 180, __pyx_L1_error) + __Pyx_GOTREF(__pyx_t_11); + __Pyx_DECREF(__pyx_t_3); __pyx_t_3 = 0; + __pyx_t_9 = __Pyx_PyObject_IsTrue(__pyx_t_11); if (unlikely((__pyx_t_9 < 0))) __PYX_ERR(0, 180, __pyx_L1_error) + __Pyx_DECREF(__pyx_t_11); __pyx_t_11 = 0; + __pyx_t_8 = __pyx_t_9; + __pyx_L24_bool_binop_done:; + if (__pyx_t_8) { + + /* "spacy/pipeline/_parser_internals/_beam_utils.pyx":181 + * violn.check_crf(pbeam[i], gbeam[i]) + * if pbeam[i].is_done and gbeam[i].is_done: + * dones[i] = True # <<<<<<<<<<<<<< + * histories = [] + * grads = [] +*/ + if (unlikely((PyObject_SetItem(__pyx_v_dones, __pyx_v_i, Py_True) < 0))) __PYX_ERR(0, 181, __pyx_L1_error) + + /* "spacy/pipeline/_parser_internals/_beam_utils.pyx":180 + * if not dones[i]: + * violn.check_crf(pbeam[i], gbeam[i]) + * if pbeam[i].is_done and gbeam[i].is_done: # <<<<<<<<<<<<<< + * dones[i] = True + * histories = [] +*/ + } + + /* "spacy/pipeline/_parser_internals/_beam_utils.pyx":178 + * # Track the "maximum violation", to use in the update. + * for i, violn in enumerate(violns): + * if not dones[i]: # <<<<<<<<<<<<<< + * violn.check_crf(pbeam[i], gbeam[i]) + * if pbeam[i].is_done and gbeam[i].is_done: +*/ + } + + /* "spacy/pipeline/_parser_internals/_beam_utils.pyx":177 + * gbeam.advance(model.ops.as_contig(scores[g_indices]), follow_gold=True) + * # Track the "maximum violation", to use in the update. + * for i, violn in enumerate(violns): # <<<<<<<<<<<<<< + * if not dones[i]: + * violn.check_crf(pbeam[i], gbeam[i]) +*/ + } + __Pyx_DECREF(__pyx_t_12); __pyx_t_12 = 0; + __Pyx_DECREF(__pyx_t_1); __pyx_t_1 = 0; + } + __pyx_L10_break:; + + /* "spacy/pipeline/_parser_internals/_beam_utils.pyx":182 + * if pbeam[i].is_done and gbeam[i].is_done: + * dones[i] = True + * histories = [] # <<<<<<<<<<<<<< + * grads = [] + * for violn in violns: +*/ + __pyx_t_1 = PyList_New(0); if (unlikely(!__pyx_t_1)) __PYX_ERR(0, 182, __pyx_L1_error) + __Pyx_GOTREF(__pyx_t_1); + __pyx_v_histories = ((PyObject*)__pyx_t_1); + __pyx_t_1 = 0; + + /* "spacy/pipeline/_parser_internals/_beam_utils.pyx":183 + * dones[i] = True + * histories = [] + * grads = [] # <<<<<<<<<<<<<< + * for violn in violns: + * if violn.p_hist: +*/ + __pyx_t_1 = PyList_New(0); if (unlikely(!__pyx_t_1)) __PYX_ERR(0, 183, __pyx_L1_error) + __Pyx_GOTREF(__pyx_t_1); + __pyx_v_grads = ((PyObject*)__pyx_t_1); + __pyx_t_1 = 0; + + /* "spacy/pipeline/_parser_internals/_beam_utils.pyx":184 + * histories = [] + * grads = [] + * for violn in violns: # <<<<<<<<<<<<<< + * if violn.p_hist: + * histories.append(violn.p_hist + violn.g_hist) +*/ + __pyx_t_1 = __pyx_v_violns; __Pyx_INCREF(__pyx_t_1); + __pyx_t_6 = 0; + for (;;) { + { + Py_ssize_t __pyx_temp = __Pyx_PyList_GET_SIZE(__pyx_t_1); + #if !CYTHON_ASSUME_SAFE_SIZE + if (unlikely((__pyx_temp < 0))) __PYX_ERR(0, 184, __pyx_L1_error) + #endif + if (__pyx_t_6 >= __pyx_temp) break; + } + __pyx_t_12 = __Pyx_PyList_GetItemRefFast(__pyx_t_1, __pyx_t_6, __Pyx_ReferenceSharing_OwnStrongReference); + ++__pyx_t_6; + if (unlikely(!__pyx_t_12)) __PYX_ERR(0, 184, __pyx_L1_error) + __Pyx_GOTREF(__pyx_t_12); + if (!(likely(((__pyx_t_12) == Py_None) || likely(__Pyx_TypeTest(__pyx_t_12, __pyx_mstate_global->__pyx_ptype_5thinc_5extra_6search_MaxViolation))))) __PYX_ERR(0, 184, __pyx_L1_error) + __Pyx_XDECREF_SET(__pyx_v_violn, ((struct __pyx_obj_5thinc_5extra_6search_MaxViolation *)__pyx_t_12)); + __pyx_t_12 = 0; + + /* "spacy/pipeline/_parser_internals/_beam_utils.pyx":185 + * grads = [] + * for violn in violns: + * if violn.p_hist: # <<<<<<<<<<<<<< + * histories.append(violn.p_hist + violn.g_hist) + * d_loss = [d_l * violn.cost for d_l in violn.p_probs + violn.g_probs] +*/ + if (__pyx_v_violn->p_hist == Py_None) __pyx_t_8 = 0; + else + { + Py_ssize_t __pyx_temp = __Pyx_PyList_GET_SIZE(__pyx_v_violn->p_hist); + if (unlikely(((!CYTHON_ASSUME_SAFE_SIZE) && __pyx_temp < 0))) __PYX_ERR(0, 185, __pyx_L1_error) + __pyx_t_8 = (__pyx_temp != 0); + } + + if (__pyx_t_8) { + + /* "spacy/pipeline/_parser_internals/_beam_utils.pyx":186 + * for violn in violns: + * if violn.p_hist: + * histories.append(violn.p_hist + violn.g_hist) # <<<<<<<<<<<<<< + * d_loss = [d_l * violn.cost for d_l in violn.p_probs + violn.g_probs] + * grads.append(d_loss) +*/ + __pyx_t_12 = PyNumber_Add(__pyx_v_violn->p_hist, __pyx_v_violn->g_hist); if (unlikely(!__pyx_t_12)) __PYX_ERR(0, 186, __pyx_L1_error) + __Pyx_GOTREF(__pyx_t_12); + __pyx_t_14 = __Pyx_PyList_Append(__pyx_v_histories, __pyx_t_12); if (unlikely(__pyx_t_14 == ((int)-1))) __PYX_ERR(0, 186, __pyx_L1_error) + __Pyx_DECREF(__pyx_t_12); __pyx_t_12 = 0; + + /* "spacy/pipeline/_parser_internals/_beam_utils.pyx":187 + * if violn.p_hist: + * histories.append(violn.p_hist + violn.g_hist) + * d_loss = [d_l * violn.cost for d_l in violn.p_probs + violn.g_probs] # <<<<<<<<<<<<<< + * grads.append(d_loss) + * else: +*/ + __pyx_t_12 = PyList_New(0); if (unlikely(!__pyx_t_12)) __PYX_ERR(0, 187, __pyx_L1_error) + __Pyx_GOTREF(__pyx_t_12); + __pyx_t_11 = PyNumber_Add(__pyx_v_violn->p_probs, __pyx_v_violn->g_probs); if (unlikely(!__pyx_t_11)) __PYX_ERR(0, 187, __pyx_L1_error) + __Pyx_GOTREF(__pyx_t_11); + __pyx_t_3 = __pyx_t_11; __Pyx_INCREF(__pyx_t_3); + __pyx_t_16 = 0; + __Pyx_DECREF(__pyx_t_11); __pyx_t_11 = 0; + for (;;) { + { + 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, 187, __pyx_L1_error) + #endif + if (__pyx_t_16 >= __pyx_temp) break; + } + __pyx_t_11 = __Pyx_PyList_GetItemRefFast(__pyx_t_3, __pyx_t_16, __Pyx_ReferenceSharing_OwnStrongReference); + ++__pyx_t_16; + if (unlikely(!__pyx_t_11)) __PYX_ERR(0, 187, __pyx_L1_error) + __Pyx_GOTREF(__pyx_t_11); + __Pyx_XDECREF_SET(__pyx_v_d_l, __pyx_t_11); + __pyx_t_11 = 0; + __pyx_t_11 = PyFloat_FromDouble(__pyx_v_violn->cost); if (unlikely(!__pyx_t_11)) __PYX_ERR(0, 187, __pyx_L1_error) + __Pyx_GOTREF(__pyx_t_11); + __pyx_t_5 = PyNumber_Multiply(__pyx_v_d_l, __pyx_t_11); if (unlikely(!__pyx_t_5)) __PYX_ERR(0, 187, __pyx_L1_error) + __Pyx_GOTREF(__pyx_t_5); + __Pyx_DECREF(__pyx_t_11); __pyx_t_11 = 0; + if (unlikely(__Pyx_ListComp_Append(__pyx_t_12, (PyObject*)__pyx_t_5))) __PYX_ERR(0, 187, __pyx_L1_error) + __Pyx_DECREF(__pyx_t_5); __pyx_t_5 = 0; + } + __Pyx_DECREF(__pyx_t_3); __pyx_t_3 = 0; + __Pyx_XDECREF_SET(__pyx_v_d_loss, ((PyObject*)__pyx_t_12)); + __pyx_t_12 = 0; + + /* "spacy/pipeline/_parser_internals/_beam_utils.pyx":188 + * histories.append(violn.p_hist + violn.g_hist) + * d_loss = [d_l * violn.cost for d_l in violn.p_probs + violn.g_probs] + * grads.append(d_loss) # <<<<<<<<<<<<<< + * else: + * histories.append([]) +*/ + __pyx_t_14 = __Pyx_PyList_Append(__pyx_v_grads, __pyx_v_d_loss); if (unlikely(__pyx_t_14 == ((int)-1))) __PYX_ERR(0, 188, __pyx_L1_error) + + /* "spacy/pipeline/_parser_internals/_beam_utils.pyx":185 + * grads = [] + * for violn in violns: + * if violn.p_hist: # <<<<<<<<<<<<<< + * histories.append(violn.p_hist + violn.g_hist) + * d_loss = [d_l * violn.cost for d_l in violn.p_probs + violn.g_probs] +*/ + goto __pyx_L29; + } + + /* "spacy/pipeline/_parser_internals/_beam_utils.pyx":190 + * grads.append(d_loss) + * else: + * histories.append([]) # <<<<<<<<<<<<<< + * grads.append([]) + * loss = 0.0 +*/ + /*else*/ { + __pyx_t_12 = PyList_New(0); if (unlikely(!__pyx_t_12)) __PYX_ERR(0, 190, __pyx_L1_error) + __Pyx_GOTREF(__pyx_t_12); + __pyx_t_14 = __Pyx_PyList_Append(__pyx_v_histories, __pyx_t_12); if (unlikely(__pyx_t_14 == ((int)-1))) __PYX_ERR(0, 190, __pyx_L1_error) + __Pyx_DECREF(__pyx_t_12); __pyx_t_12 = 0; + + /* "spacy/pipeline/_parser_internals/_beam_utils.pyx":191 + * else: + * histories.append([]) + * grads.append([]) # <<<<<<<<<<<<<< + * loss = 0.0 + * states_d_scores = get_gradient(moves.n_moves, beam_maps, histories, grads) +*/ + __pyx_t_12 = PyList_New(0); if (unlikely(!__pyx_t_12)) __PYX_ERR(0, 191, __pyx_L1_error) + __Pyx_GOTREF(__pyx_t_12); + __pyx_t_14 = __Pyx_PyList_Append(__pyx_v_grads, __pyx_t_12); if (unlikely(__pyx_t_14 == ((int)-1))) __PYX_ERR(0, 191, __pyx_L1_error) + __Pyx_DECREF(__pyx_t_12); __pyx_t_12 = 0; + } + __pyx_L29:; + + /* "spacy/pipeline/_parser_internals/_beam_utils.pyx":184 + * histories = [] + * grads = [] + * for violn in violns: # <<<<<<<<<<<<<< + * if violn.p_hist: + * histories.append(violn.p_hist + violn.g_hist) +*/ + } + __Pyx_DECREF(__pyx_t_1); __pyx_t_1 = 0; + + /* "spacy/pipeline/_parser_internals/_beam_utils.pyx":192 + * histories.append([]) + * grads.append([]) + * loss = 0.0 # <<<<<<<<<<<<<< + * states_d_scores = get_gradient(moves.n_moves, beam_maps, histories, grads) + * for i, (d_scores, bp_scores) in enumerate(zip(states_d_scores, backprops)): +*/ + __Pyx_INCREF(__pyx_mstate_global->__pyx_float_0_0); + __pyx_v_loss = __pyx_mstate_global->__pyx_float_0_0; + + /* "spacy/pipeline/_parser_internals/_beam_utils.pyx":193 + * grads.append([]) + * loss = 0.0 + * states_d_scores = get_gradient(moves.n_moves, beam_maps, histories, grads) # <<<<<<<<<<<<<< + * for i, (d_scores, bp_scores) in enumerate(zip(states_d_scores, backprops)): + * loss += (d_scores**2).mean() +*/ + __pyx_t_12 = NULL; + __Pyx_GetModuleGlobalName(__pyx_t_3, __pyx_mstate_global->__pyx_n_u_get_gradient); if (unlikely(!__pyx_t_3)) __PYX_ERR(0, 193, __pyx_L1_error) + __Pyx_GOTREF(__pyx_t_3); + __pyx_t_5 = __Pyx_PyLong_From_int(__pyx_v_moves->n_moves); if (unlikely(!__pyx_t_5)) __PYX_ERR(0, 193, __pyx_L1_error) + __Pyx_GOTREF(__pyx_t_5); + __pyx_t_4 = 1; + #if CYTHON_UNPACK_METHODS + if (unlikely(PyMethod_Check(__pyx_t_3))) { + __pyx_t_12 = PyMethod_GET_SELF(__pyx_t_3); + assert(__pyx_t_12); + PyObject* __pyx__function = PyMethod_GET_FUNCTION(__pyx_t_3); + __Pyx_INCREF(__pyx_t_12); + __Pyx_INCREF(__pyx__function); + __Pyx_DECREF_SET(__pyx_t_3, __pyx__function); + __pyx_t_4 = 0; + } + #endif + { + PyObject *__pyx_callargs[5] = {__pyx_t_12, __pyx_t_5, __pyx_v_beam_maps, __pyx_v_histories, __pyx_v_grads}; + __pyx_t_1 = __Pyx_PyObject_FastCall((PyObject*)__pyx_t_3, __pyx_callargs+__pyx_t_4, (5-__pyx_t_4) | (__pyx_t_4*__Pyx_PY_VECTORCALL_ARGUMENTS_OFFSET)); + __Pyx_XDECREF(__pyx_t_12); __pyx_t_12 = 0; + __Pyx_DECREF(__pyx_t_5); __pyx_t_5 = 0; + __Pyx_DECREF(__pyx_t_3); __pyx_t_3 = 0; + if (unlikely(!__pyx_t_1)) __PYX_ERR(0, 193, __pyx_L1_error) + __Pyx_GOTREF(__pyx_t_1); + } + __pyx_v_states_d_scores = __pyx_t_1; + __pyx_t_1 = 0; + + /* "spacy/pipeline/_parser_internals/_beam_utils.pyx":194 + * loss = 0.0 + * states_d_scores = get_gradient(moves.n_moves, beam_maps, histories, grads) + * for i, (d_scores, bp_scores) in enumerate(zip(states_d_scores, backprops)): # <<<<<<<<<<<<<< + * loss += (d_scores**2).mean() + * bp_scores(d_scores) +*/ + __Pyx_INCREF(__pyx_mstate_global->__pyx_int_0); + __pyx_t_1 = __pyx_mstate_global->__pyx_int_0; + __pyx_t_5 = NULL; + __pyx_t_4 = 1; + { + PyObject *__pyx_callargs[3] = {__pyx_t_5, __pyx_v_states_d_scores, __pyx_v_backprops}; + __pyx_t_3 = __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_5); __pyx_t_5 = 0; + if (unlikely(!__pyx_t_3)) __PYX_ERR(0, 194, __pyx_L1_error) + __Pyx_GOTREF(__pyx_t_3); + } + if (likely(PyList_CheckExact(__pyx_t_3)) || PyTuple_CheckExact(__pyx_t_3)) { + __pyx_t_5 = __pyx_t_3; __Pyx_INCREF(__pyx_t_5); + __pyx_t_6 = 0; + __pyx_t_7 = NULL; + } else { + __pyx_t_6 = -1; __pyx_t_5 = PyObject_GetIter(__pyx_t_3); if (unlikely(!__pyx_t_5)) __PYX_ERR(0, 194, __pyx_L1_error) + __Pyx_GOTREF(__pyx_t_5); + __pyx_t_7 = (CYTHON_COMPILING_IN_LIMITED_API) ? PyIter_Next : __Pyx_PyObject_GetIterNextFunc(__pyx_t_5); if (unlikely(!__pyx_t_7)) __PYX_ERR(0, 194, __pyx_L1_error) + } + __Pyx_DECREF(__pyx_t_3); __pyx_t_3 = 0; + for (;;) { + if (likely(!__pyx_t_7)) { + if (likely(PyList_CheckExact(__pyx_t_5))) { + { + Py_ssize_t __pyx_temp = __Pyx_PyList_GET_SIZE(__pyx_t_5); + #if !CYTHON_ASSUME_SAFE_SIZE + if (unlikely((__pyx_temp < 0))) __PYX_ERR(0, 194, __pyx_L1_error) + #endif + if (__pyx_t_6 >= __pyx_temp) break; + } + __pyx_t_3 = __Pyx_PyList_GetItemRefFast(__pyx_t_5, __pyx_t_6, __Pyx_ReferenceSharing_OwnStrongReference); + ++__pyx_t_6; + } else { + { + Py_ssize_t __pyx_temp = __Pyx_PyTuple_GET_SIZE(__pyx_t_5); + #if !CYTHON_ASSUME_SAFE_SIZE + if (unlikely((__pyx_temp < 0))) __PYX_ERR(0, 194, __pyx_L1_error) + #endif + if (__pyx_t_6 >= __pyx_temp) break; + } + #if CYTHON_ASSUME_SAFE_MACROS && !CYTHON_AVOID_BORROWED_REFS + __pyx_t_3 = __Pyx_NewRef(PyTuple_GET_ITEM(__pyx_t_5, __pyx_t_6)); + #else + __pyx_t_3 = __Pyx_PySequence_ITEM(__pyx_t_5, __pyx_t_6); + #endif + ++__pyx_t_6; + } + if (unlikely(!__pyx_t_3)) __PYX_ERR(0, 194, __pyx_L1_error) + } else { + __pyx_t_3 = __pyx_t_7(__pyx_t_5); + 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, 194, __pyx_L1_error) + PyErr_Clear(); + } + break; + } + } + __Pyx_GOTREF(__pyx_t_3); + if ((likely(PyTuple_CheckExact(__pyx_t_3))) || (PyList_CheckExact(__pyx_t_3))) { + PyObject* sequence = __pyx_t_3; + 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, 194, __pyx_L1_error) + } + #if CYTHON_ASSUME_SAFE_MACROS && !CYTHON_AVOID_BORROWED_REFS + if (likely(PyTuple_CheckExact(sequence))) { + __pyx_t_12 = PyTuple_GET_ITEM(sequence, 0); + __Pyx_INCREF(__pyx_t_12); + __pyx_t_11 = PyTuple_GET_ITEM(sequence, 1); + __Pyx_INCREF(__pyx_t_11); + } else { + __pyx_t_12 = __Pyx_PyList_GetItemRefFast(sequence, 0, __Pyx_ReferenceSharing_SharedReference); + if (unlikely(!__pyx_t_12)) __PYX_ERR(0, 194, __pyx_L1_error) + __Pyx_XGOTREF(__pyx_t_12); + __pyx_t_11 = __Pyx_PyList_GetItemRefFast(sequence, 1, __Pyx_ReferenceSharing_SharedReference); + if (unlikely(!__pyx_t_11)) __PYX_ERR(0, 194, __pyx_L1_error) + __Pyx_XGOTREF(__pyx_t_11); + } + #else + __pyx_t_12 = __Pyx_PySequence_ITEM(sequence, 0); if (unlikely(!__pyx_t_12)) __PYX_ERR(0, 194, __pyx_L1_error) + __Pyx_GOTREF(__pyx_t_12); + __pyx_t_11 = __Pyx_PySequence_ITEM(sequence, 1); if (unlikely(!__pyx_t_11)) __PYX_ERR(0, 194, __pyx_L1_error) + __Pyx_GOTREF(__pyx_t_11); + #endif + __Pyx_DECREF(__pyx_t_3); __pyx_t_3 = 0; + } else { + Py_ssize_t index = -1; + __pyx_t_2 = PyObject_GetIter(__pyx_t_3); if (unlikely(!__pyx_t_2)) __PYX_ERR(0, 194, __pyx_L1_error) + __Pyx_GOTREF(__pyx_t_2); + __Pyx_DECREF(__pyx_t_3); __pyx_t_3 = 0; + __pyx_t_13 = (CYTHON_COMPILING_IN_LIMITED_API) ? PyIter_Next : __Pyx_PyObject_GetIterNextFunc(__pyx_t_2); + index = 0; __pyx_t_12 = __pyx_t_13(__pyx_t_2); if (unlikely(!__pyx_t_12)) goto __pyx_L36_unpacking_failed; + __Pyx_GOTREF(__pyx_t_12); + index = 1; __pyx_t_11 = __pyx_t_13(__pyx_t_2); if (unlikely(!__pyx_t_11)) goto __pyx_L36_unpacking_failed; + __Pyx_GOTREF(__pyx_t_11); + if (__Pyx_IternextUnpackEndCheck(__pyx_t_13(__pyx_t_2), 2) < (0)) __PYX_ERR(0, 194, __pyx_L1_error) + __pyx_t_13 = NULL; + __Pyx_DECREF(__pyx_t_2); __pyx_t_2 = 0; + goto __pyx_L37_unpacking_done; + __pyx_L36_unpacking_failed:; + __Pyx_DECREF(__pyx_t_2); __pyx_t_2 = 0; + __pyx_t_13 = NULL; + if (__Pyx_IterFinish() == 0) __Pyx_RaiseNeedMoreValuesError(index); + __PYX_ERR(0, 194, __pyx_L1_error) + __pyx_L37_unpacking_done:; + } + __Pyx_XDECREF_SET(__pyx_v_d_scores, __pyx_t_12); + __pyx_t_12 = 0; + __Pyx_XDECREF_SET(__pyx_v_bp_scores, __pyx_t_11); + __pyx_t_11 = 0; + __Pyx_INCREF(__pyx_t_1); + __Pyx_XDECREF_SET(__pyx_v_i, __pyx_t_1); + __pyx_t_3 = __Pyx_PyLong_AddObjC(__pyx_t_1, __pyx_mstate_global->__pyx_int_1, 1, 0, 0); if (unlikely(!__pyx_t_3)) __PYX_ERR(0, 194, __pyx_L1_error) + __Pyx_GOTREF(__pyx_t_3); + __Pyx_DECREF(__pyx_t_1); + __pyx_t_1 = __pyx_t_3; + __pyx_t_3 = 0; + + /* "spacy/pipeline/_parser_internals/_beam_utils.pyx":195 + * states_d_scores = get_gradient(moves.n_moves, beam_maps, histories, grads) + * for i, (d_scores, bp_scores) in enumerate(zip(states_d_scores, backprops)): + * loss += (d_scores**2).mean() # <<<<<<<<<<<<<< + * bp_scores(d_scores) + * return loss +*/ + __pyx_t_12 = PyNumber_Power(__pyx_v_d_scores, __pyx_mstate_global->__pyx_int_2, Py_None); if (unlikely(!__pyx_t_12)) __PYX_ERR(0, 195, __pyx_L1_error) + __Pyx_GOTREF(__pyx_t_12); + __pyx_t_11 = __pyx_t_12; + __Pyx_INCREF(__pyx_t_11); + __pyx_t_4 = 0; + { + PyObject *__pyx_callargs[2] = {__pyx_t_11, NULL}; + __pyx_t_3 = __Pyx_PyObject_FastCallMethod((PyObject*)__pyx_mstate_global->__pyx_n_u_mean, __pyx_callargs+__pyx_t_4, (1-__pyx_t_4) | (1*__Pyx_PY_VECTORCALL_ARGUMENTS_OFFSET)); + __Pyx_XDECREF(__pyx_t_11); __pyx_t_11 = 0; + __Pyx_DECREF(__pyx_t_12); __pyx_t_12 = 0; + if (unlikely(!__pyx_t_3)) __PYX_ERR(0, 195, __pyx_L1_error) + __Pyx_GOTREF(__pyx_t_3); + } + __pyx_t_12 = PyNumber_InPlaceAdd(__pyx_v_loss, __pyx_t_3); if (unlikely(!__pyx_t_12)) __PYX_ERR(0, 195, __pyx_L1_error) + __Pyx_GOTREF(__pyx_t_12); + __Pyx_DECREF(__pyx_t_3); __pyx_t_3 = 0; + __Pyx_DECREF_SET(__pyx_v_loss, __pyx_t_12); + __pyx_t_12 = 0; + + /* "spacy/pipeline/_parser_internals/_beam_utils.pyx":196 + * for i, (d_scores, bp_scores) in enumerate(zip(states_d_scores, backprops)): + * loss += (d_scores**2).mean() + * bp_scores(d_scores) # <<<<<<<<<<<<<< + * return loss + * +*/ + __pyx_t_3 = NULL; + __Pyx_INCREF(__pyx_v_bp_scores); + __pyx_t_11 = __pyx_v_bp_scores; + __pyx_t_4 = 1; + #if CYTHON_UNPACK_METHODS + if (unlikely(PyMethod_Check(__pyx_t_11))) { + __pyx_t_3 = PyMethod_GET_SELF(__pyx_t_11); + assert(__pyx_t_3); + PyObject* __pyx__function = PyMethod_GET_FUNCTION(__pyx_t_11); + __Pyx_INCREF(__pyx_t_3); + __Pyx_INCREF(__pyx__function); + __Pyx_DECREF_SET(__pyx_t_11, __pyx__function); + __pyx_t_4 = 0; + } + #endif + { + PyObject *__pyx_callargs[2] = {__pyx_t_3, __pyx_v_d_scores}; + __pyx_t_12 = __Pyx_PyObject_FastCall((PyObject*)__pyx_t_11, __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_11); __pyx_t_11 = 0; + if (unlikely(!__pyx_t_12)) __PYX_ERR(0, 196, __pyx_L1_error) + __Pyx_GOTREF(__pyx_t_12); + } + __Pyx_DECREF(__pyx_t_12); __pyx_t_12 = 0; + + /* "spacy/pipeline/_parser_internals/_beam_utils.pyx":194 + * loss = 0.0 + * states_d_scores = get_gradient(moves.n_moves, beam_maps, histories, grads) + * for i, (d_scores, bp_scores) in enumerate(zip(states_d_scores, backprops)): # <<<<<<<<<<<<<< + * loss += (d_scores**2).mean() + * bp_scores(d_scores) +*/ + } + __Pyx_DECREF(__pyx_t_5); __pyx_t_5 = 0; + __Pyx_DECREF(__pyx_t_1); __pyx_t_1 = 0; + + /* "spacy/pipeline/_parser_internals/_beam_utils.pyx":197 + * loss += (d_scores**2).mean() + * bp_scores(d_scores) + * return loss # <<<<<<<<<<<<<< + * + * +*/ + __Pyx_XDECREF(__pyx_r); + __Pyx_INCREF(__pyx_v_loss); + __pyx_r = __pyx_v_loss; + goto __pyx_L0; + + /* "spacy/pipeline/_parser_internals/_beam_utils.pyx":141 + * + * + * def update_beam(TransitionSystem moves, states, golds, model, int width, beam_density=0.0): # <<<<<<<<<<<<<< + * cdef MaxViolation violn + * pbeam = BeamBatch(moves, states, golds, width=width, density=beam_density) +*/ + + /* function exit code */ + __pyx_L1_error:; + __Pyx_XDECREF(__pyx_t_1); + __Pyx_XDECREF(__pyx_t_2); + __Pyx_XDECREF(__pyx_t_3); + __Pyx_XDECREF(__pyx_t_5); + __Pyx_XDECREF(__pyx_t_11); + __Pyx_XDECREF(__pyx_t_12); + __Pyx_AddTraceback("spacy.pipeline._parser_internals._beam_utils.update_beam", __pyx_clineno, __pyx_lineno, __pyx_filename); + __pyx_r = NULL; + __pyx_L0:; + __Pyx_XDECREF((PyObject *)__pyx_v_violn); + __Pyx_XDECREF((PyObject *)__pyx_v_pbeam); + __Pyx_XDECREF((PyObject *)__pyx_v_gbeam); + __Pyx_XDECREF(__pyx_v_beam_maps); + __Pyx_XDECREF(__pyx_v_backprops); + __Pyx_XDECREF(__pyx_v_violns); + __Pyx_XDECREF(__pyx_v_dones); + __Pyx_XDECREF(__pyx_v_p_indices); + __Pyx_XDECREF(__pyx_v_g_indices); + __Pyx_XDECREF(__pyx_v_beam_map); + __Pyx_XDECREF(__pyx_v_scores); + __Pyx_XDECREF(__pyx_v_bp_scores); + __Pyx_XDECREF(__pyx_v_i); + __Pyx_XDECREF(__pyx_v_histories); + __Pyx_XDECREF(__pyx_v_grads); + __Pyx_XDECREF(__pyx_v_d_loss); + __Pyx_XDECREF(__pyx_v_loss); + __Pyx_XDECREF(__pyx_v_states_d_scores); + __Pyx_XDECREF(__pyx_v_d_scores); + __Pyx_XDECREF(__pyx_v__); + __Pyx_XDECREF(__pyx_v_d_l); + __Pyx_XDECREF(__pyx_v_states); + __Pyx_XGIVEREF(__pyx_r); + __Pyx_RefNannyFinishContext(); + return __pyx_r; +} + +/* "spacy/pipeline/_parser_internals/_beam_utils.pyx":200 + * + * + * def collect_states(beams, docs): # <<<<<<<<<<<<<< + * cdef StateClass state + * cdef Beam beam +*/ + +/* Python wrapper */ +static PyObject *__pyx_pw_5spacy_8pipeline_17_parser_internals_11_beam_utils_3collect_states(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_5spacy_8pipeline_17_parser_internals_11_beam_utils_2collect_states, "collect_states(beams, docs)"); +static PyMethodDef __pyx_mdef_5spacy_8pipeline_17_parser_internals_11_beam_utils_3collect_states = {"collect_states", (PyCFunction)(void(*)(void))(__Pyx_PyCFunction_FastCallWithKeywords)__pyx_pw_5spacy_8pipeline_17_parser_internals_11_beam_utils_3collect_states, __Pyx_METH_FASTCALL|METH_KEYWORDS, __pyx_doc_5spacy_8pipeline_17_parser_internals_11_beam_utils_2collect_states}; +static PyObject *__pyx_pw_5spacy_8pipeline_17_parser_internals_11_beam_utils_3collect_states(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 +) { + PyObject *__pyx_v_beams = 0; + PyObject *__pyx_v_docs = 0; + #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("collect_states (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_beams,&__pyx_mstate_global->__pyx_n_u_docs,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, 200, __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, 200, __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, 200, __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, "collect_states", 0) < (0)) __PYX_ERR(0, 200, __pyx_L3_error) + for (Py_ssize_t i = __pyx_nargs; i < 2; i++) { + if (unlikely(!values[i])) { __Pyx_RaiseArgtupleInvalid("collect_states", 1, 2, 2, i); __PYX_ERR(0, 200, __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, 200, __pyx_L3_error) + values[1] = __Pyx_ArgRef_FASTCALL(__pyx_args, 1); + if (!CYTHON_ASSUME_SAFE_MACROS && unlikely(!values[1])) __PYX_ERR(0, 200, __pyx_L3_error) + } + __pyx_v_beams = values[0]; + __pyx_v_docs = values[1]; + } + goto __pyx_L6_skip; + __pyx_L5_argtuple_error:; + __Pyx_RaiseArgtupleInvalid("collect_states", 1, 2, 2, __pyx_nargs); __PYX_ERR(0, 200, __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("spacy.pipeline._parser_internals._beam_utils.collect_states", __pyx_clineno, __pyx_lineno, __pyx_filename); + __Pyx_RefNannyFinishContext(); + return NULL; + __pyx_L4_argument_unpacking_done:; + __pyx_r = __pyx_pf_5spacy_8pipeline_17_parser_internals_11_beam_utils_2collect_states(__pyx_self, __pyx_v_beams, __pyx_v_docs); + + /* 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_5spacy_8pipeline_17_parser_internals_11_beam_utils_2collect_states(CYTHON_UNUSED PyObject *__pyx_self, PyObject *__pyx_v_beams, PyObject *__pyx_v_docs) { + struct __pyx_obj_5spacy_8pipeline_17_parser_internals_10stateclass_StateClass *__pyx_v_state = 0; + struct __pyx_obj_5thinc_5extra_6search_Beam *__pyx_v_beam = 0; + PyObject *__pyx_v_states = NULL; + PyObject *__pyx_v_state_or_beam = NULL; + PyObject *__pyx_v_doc = NULL; + PyObject *__pyx_r = NULL; + __Pyx_RefNannyDeclarations + PyObject *__pyx_t_1 = NULL; + PyObject *__pyx_t_2 = NULL; + size_t __pyx_t_3; + Py_ssize_t __pyx_t_4; + PyObject *(*__pyx_t_5)(PyObject *); + PyObject *__pyx_t_6 = NULL; + PyObject *__pyx_t_7 = NULL; + PyObject *__pyx_t_8 = NULL; + PyObject *(*__pyx_t_9)(PyObject *); + int __pyx_t_10; + int __pyx_t_11; + void *__pyx_t_12; + int __pyx_lineno = 0; + const char *__pyx_filename = NULL; + int __pyx_clineno = 0; + __Pyx_RefNannySetupContext("collect_states", 0); + + /* "spacy/pipeline/_parser_internals/_beam_utils.pyx":203 + * cdef StateClass state + * cdef Beam beam + * states = [] # <<<<<<<<<<<<<< + * for state_or_beam, doc in zip(beams, docs): + * if isinstance(state_or_beam, StateClass): +*/ + __pyx_t_1 = PyList_New(0); if (unlikely(!__pyx_t_1)) __PYX_ERR(0, 203, __pyx_L1_error) + __Pyx_GOTREF(__pyx_t_1); + __pyx_v_states = ((PyObject*)__pyx_t_1); + __pyx_t_1 = 0; + + /* "spacy/pipeline/_parser_internals/_beam_utils.pyx":204 + * cdef Beam beam + * states = [] + * for state_or_beam, doc in zip(beams, docs): # <<<<<<<<<<<<<< + * if isinstance(state_or_beam, StateClass): + * states.append(state_or_beam) +*/ + __pyx_t_2 = NULL; + __pyx_t_3 = 1; + { + PyObject *__pyx_callargs[3] = {__pyx_t_2, __pyx_v_beams, __pyx_v_docs}; + __pyx_t_1 = __Pyx_PyObject_FastCall((PyObject*)__pyx_builtin_zip, __pyx_callargs+__pyx_t_3, (3-__pyx_t_3) | (__pyx_t_3*__Pyx_PY_VECTORCALL_ARGUMENTS_OFFSET)); + __Pyx_XDECREF(__pyx_t_2); __pyx_t_2 = 0; + if (unlikely(!__pyx_t_1)) __PYX_ERR(0, 204, __pyx_L1_error) + __Pyx_GOTREF(__pyx_t_1); + } + if (likely(PyList_CheckExact(__pyx_t_1)) || PyTuple_CheckExact(__pyx_t_1)) { + __pyx_t_2 = __pyx_t_1; __Pyx_INCREF(__pyx_t_2); + __pyx_t_4 = 0; + __pyx_t_5 = NULL; + } else { + __pyx_t_4 = -1; __pyx_t_2 = PyObject_GetIter(__pyx_t_1); if (unlikely(!__pyx_t_2)) __PYX_ERR(0, 204, __pyx_L1_error) + __Pyx_GOTREF(__pyx_t_2); + __pyx_t_5 = (CYTHON_COMPILING_IN_LIMITED_API) ? PyIter_Next : __Pyx_PyObject_GetIterNextFunc(__pyx_t_2); if (unlikely(!__pyx_t_5)) __PYX_ERR(0, 204, __pyx_L1_error) + } + __Pyx_DECREF(__pyx_t_1); __pyx_t_1 = 0; + for (;;) { + if (likely(!__pyx_t_5)) { + if (likely(PyList_CheckExact(__pyx_t_2))) { + { + Py_ssize_t __pyx_temp = __Pyx_PyList_GET_SIZE(__pyx_t_2); + #if !CYTHON_ASSUME_SAFE_SIZE + if (unlikely((__pyx_temp < 0))) __PYX_ERR(0, 204, __pyx_L1_error) + #endif + if (__pyx_t_4 >= __pyx_temp) break; + } + __pyx_t_1 = __Pyx_PyList_GetItemRefFast(__pyx_t_2, __pyx_t_4, __Pyx_ReferenceSharing_OwnStrongReference); + ++__pyx_t_4; + } else { + { + Py_ssize_t __pyx_temp = __Pyx_PyTuple_GET_SIZE(__pyx_t_2); + #if !CYTHON_ASSUME_SAFE_SIZE + if (unlikely((__pyx_temp < 0))) __PYX_ERR(0, 204, __pyx_L1_error) + #endif + if (__pyx_t_4 >= __pyx_temp) break; + } + #if CYTHON_ASSUME_SAFE_MACROS && !CYTHON_AVOID_BORROWED_REFS + __pyx_t_1 = __Pyx_NewRef(PyTuple_GET_ITEM(__pyx_t_2, __pyx_t_4)); + #else + __pyx_t_1 = __Pyx_PySequence_ITEM(__pyx_t_2, __pyx_t_4); + #endif + ++__pyx_t_4; + } + if (unlikely(!__pyx_t_1)) __PYX_ERR(0, 204, __pyx_L1_error) + } else { + __pyx_t_1 = __pyx_t_5(__pyx_t_2); + if (unlikely(!__pyx_t_1)) { + PyObject* exc_type = PyErr_Occurred(); + if (exc_type) { + if (unlikely(!__Pyx_PyErr_GivenExceptionMatches(exc_type, PyExc_StopIteration))) __PYX_ERR(0, 204, __pyx_L1_error) + PyErr_Clear(); + } + break; + } + } + __Pyx_GOTREF(__pyx_t_1); + if ((likely(PyTuple_CheckExact(__pyx_t_1))) || (PyList_CheckExact(__pyx_t_1))) { + PyObject* sequence = __pyx_t_1; + 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, 204, __pyx_L1_error) + } + #if CYTHON_ASSUME_SAFE_MACROS && !CYTHON_AVOID_BORROWED_REFS + if (likely(PyTuple_CheckExact(sequence))) { + __pyx_t_6 = PyTuple_GET_ITEM(sequence, 0); + __Pyx_INCREF(__pyx_t_6); + __pyx_t_7 = PyTuple_GET_ITEM(sequence, 1); + __Pyx_INCREF(__pyx_t_7); + } else { + __pyx_t_6 = __Pyx_PyList_GetItemRefFast(sequence, 0, __Pyx_ReferenceSharing_SharedReference); + if (unlikely(!__pyx_t_6)) __PYX_ERR(0, 204, __pyx_L1_error) + __Pyx_XGOTREF(__pyx_t_6); + __pyx_t_7 = __Pyx_PyList_GetItemRefFast(sequence, 1, __Pyx_ReferenceSharing_SharedReference); + if (unlikely(!__pyx_t_7)) __PYX_ERR(0, 204, __pyx_L1_error) + __Pyx_XGOTREF(__pyx_t_7); + } + #else + __pyx_t_6 = __Pyx_PySequence_ITEM(sequence, 0); if (unlikely(!__pyx_t_6)) __PYX_ERR(0, 204, __pyx_L1_error) + __Pyx_GOTREF(__pyx_t_6); + __pyx_t_7 = __Pyx_PySequence_ITEM(sequence, 1); if (unlikely(!__pyx_t_7)) __PYX_ERR(0, 204, __pyx_L1_error) + __Pyx_GOTREF(__pyx_t_7); + #endif + __Pyx_DECREF(__pyx_t_1); __pyx_t_1 = 0; + } else { + Py_ssize_t index = -1; + __pyx_t_8 = PyObject_GetIter(__pyx_t_1); if (unlikely(!__pyx_t_8)) __PYX_ERR(0, 204, __pyx_L1_error) + __Pyx_GOTREF(__pyx_t_8); + __Pyx_DECREF(__pyx_t_1); __pyx_t_1 = 0; + __pyx_t_9 = (CYTHON_COMPILING_IN_LIMITED_API) ? PyIter_Next : __Pyx_PyObject_GetIterNextFunc(__pyx_t_8); + index = 0; __pyx_t_6 = __pyx_t_9(__pyx_t_8); if (unlikely(!__pyx_t_6)) goto __pyx_L5_unpacking_failed; + __Pyx_GOTREF(__pyx_t_6); + index = 1; __pyx_t_7 = __pyx_t_9(__pyx_t_8); if (unlikely(!__pyx_t_7)) goto __pyx_L5_unpacking_failed; + __Pyx_GOTREF(__pyx_t_7); + if (__Pyx_IternextUnpackEndCheck(__pyx_t_9(__pyx_t_8), 2) < (0)) __PYX_ERR(0, 204, __pyx_L1_error) + __pyx_t_9 = NULL; + __Pyx_DECREF(__pyx_t_8); __pyx_t_8 = 0; + goto __pyx_L6_unpacking_done; + __pyx_L5_unpacking_failed:; + __Pyx_DECREF(__pyx_t_8); __pyx_t_8 = 0; + __pyx_t_9 = NULL; + if (__Pyx_IterFinish() == 0) __Pyx_RaiseNeedMoreValuesError(index); + __PYX_ERR(0, 204, __pyx_L1_error) + __pyx_L6_unpacking_done:; + } + __Pyx_XDECREF_SET(__pyx_v_state_or_beam, __pyx_t_6); + __pyx_t_6 = 0; + __Pyx_XDECREF_SET(__pyx_v_doc, __pyx_t_7); + __pyx_t_7 = 0; + + /* "spacy/pipeline/_parser_internals/_beam_utils.pyx":205 + * states = [] + * for state_or_beam, doc in zip(beams, docs): + * if isinstance(state_or_beam, StateClass): # <<<<<<<<<<<<<< + * states.append(state_or_beam) + * else: +*/ + __pyx_t_10 = __Pyx_TypeCheck(__pyx_v_state_or_beam, __pyx_mstate_global->__pyx_ptype_5spacy_8pipeline_17_parser_internals_10stateclass_StateClass); + if (__pyx_t_10) { + + /* "spacy/pipeline/_parser_internals/_beam_utils.pyx":206 + * for state_or_beam, doc in zip(beams, docs): + * if isinstance(state_or_beam, StateClass): + * states.append(state_or_beam) # <<<<<<<<<<<<<< + * else: + * beam = state_or_beam +*/ + __pyx_t_11 = __Pyx_PyList_Append(__pyx_v_states, __pyx_v_state_or_beam); if (unlikely(__pyx_t_11 == ((int)-1))) __PYX_ERR(0, 206, __pyx_L1_error) + + /* "spacy/pipeline/_parser_internals/_beam_utils.pyx":205 + * states = [] + * for state_or_beam, doc in zip(beams, docs): + * if isinstance(state_or_beam, StateClass): # <<<<<<<<<<<<<< + * states.append(state_or_beam) + * else: +*/ + goto __pyx_L7; + } + + /* "spacy/pipeline/_parser_internals/_beam_utils.pyx":208 + * states.append(state_or_beam) + * else: + * beam = state_or_beam # <<<<<<<<<<<<<< + * state = StateClass.borrow(beam.at(0), doc) + * states.append(state) +*/ + /*else*/ { + __pyx_t_1 = __pyx_v_state_or_beam; + __Pyx_INCREF(__pyx_t_1); + if (!(likely(((__pyx_t_1) == Py_None) || likely(__Pyx_TypeTest(__pyx_t_1, __pyx_mstate_global->__pyx_ptype_5thinc_5extra_6search_Beam))))) __PYX_ERR(0, 208, __pyx_L1_error) + __Pyx_XDECREF_SET(__pyx_v_beam, ((struct __pyx_obj_5thinc_5extra_6search_Beam *)__pyx_t_1)); + __pyx_t_1 = 0; + + /* "spacy/pipeline/_parser_internals/_beam_utils.pyx":209 + * else: + * beam = state_or_beam + * state = StateClass.borrow(beam.at(0), doc) # <<<<<<<<<<<<<< + * states.append(state) + * return states +*/ + __pyx_t_12 = __pyx_f_5thinc_5extra_6search_4Beam_at(__pyx_v_beam, 0); if (unlikely(PyErr_Occurred())) __PYX_ERR(0, 209, __pyx_L1_error) + if (!(likely(((__pyx_v_doc) == Py_None) || likely(__Pyx_TypeTest(__pyx_v_doc, __pyx_mstate_global->__pyx_ptype_5spacy_6tokens_3doc_Doc))))) __PYX_ERR(0, 209, __pyx_L1_error) + __pyx_t_1 = ((PyObject *)__pyx_f_5spacy_8pipeline_17_parser_internals_10stateclass_10StateClass_borrow(((__pyx_t_5spacy_8pipeline_17_parser_internals_6_state_StateC *)__pyx_t_12), ((struct __pyx_obj_5spacy_6tokens_3doc_Doc *)__pyx_v_doc))); if (unlikely(!__pyx_t_1)) __PYX_ERR(0, 209, __pyx_L1_error) + __Pyx_GOTREF(__pyx_t_1); + __Pyx_XDECREF_SET(__pyx_v_state, ((struct __pyx_obj_5spacy_8pipeline_17_parser_internals_10stateclass_StateClass *)__pyx_t_1)); + __pyx_t_1 = 0; + + /* "spacy/pipeline/_parser_internals/_beam_utils.pyx":210 + * beam = state_or_beam + * state = StateClass.borrow(beam.at(0), doc) + * states.append(state) # <<<<<<<<<<<<<< + * return states + * +*/ + __pyx_t_11 = __Pyx_PyList_Append(__pyx_v_states, ((PyObject *)__pyx_v_state)); if (unlikely(__pyx_t_11 == ((int)-1))) __PYX_ERR(0, 210, __pyx_L1_error) + } + __pyx_L7:; + + /* "spacy/pipeline/_parser_internals/_beam_utils.pyx":204 + * cdef Beam beam + * states = [] + * for state_or_beam, doc in zip(beams, docs): # <<<<<<<<<<<<<< + * if isinstance(state_or_beam, StateClass): + * states.append(state_or_beam) +*/ + } + __Pyx_DECREF(__pyx_t_2); __pyx_t_2 = 0; + + /* "spacy/pipeline/_parser_internals/_beam_utils.pyx":211 + * state = StateClass.borrow(beam.at(0), doc) + * states.append(state) + * return states # <<<<<<<<<<<<<< + * + * +*/ + __Pyx_XDECREF(__pyx_r); + __Pyx_INCREF(__pyx_v_states); + __pyx_r = __pyx_v_states; + goto __pyx_L0; + + /* "spacy/pipeline/_parser_internals/_beam_utils.pyx":200 + * + * + * def collect_states(beams, docs): # <<<<<<<<<<<<<< + * cdef StateClass state + * cdef Beam beam +*/ + + /* function exit code */ + __pyx_L1_error:; + __Pyx_XDECREF(__pyx_t_1); + __Pyx_XDECREF(__pyx_t_2); + __Pyx_XDECREF(__pyx_t_6); + __Pyx_XDECREF(__pyx_t_7); + __Pyx_XDECREF(__pyx_t_8); + __Pyx_AddTraceback("spacy.pipeline._parser_internals._beam_utils.collect_states", __pyx_clineno, __pyx_lineno, __pyx_filename); + __pyx_r = NULL; + __pyx_L0:; + __Pyx_XDECREF((PyObject *)__pyx_v_state); + __Pyx_XDECREF((PyObject *)__pyx_v_beam); + __Pyx_XDECREF(__pyx_v_states); + __Pyx_XDECREF(__pyx_v_state_or_beam); + __Pyx_XDECREF(__pyx_v_doc); + __Pyx_XGIVEREF(__pyx_r); + __Pyx_RefNannyFinishContext(); + return __pyx_r; +} + +/* "spacy/pipeline/_parser_internals/_beam_utils.pyx":214 + * + * + * def get_unique_states(pbeams, gbeams): # <<<<<<<<<<<<<< + * seen = {} + * states = [] +*/ + +/* Python wrapper */ +static PyObject *__pyx_pw_5spacy_8pipeline_17_parser_internals_11_beam_utils_5get_unique_states(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_5spacy_8pipeline_17_parser_internals_11_beam_utils_4get_unique_states, "get_unique_states(pbeams, gbeams)"); +static PyMethodDef __pyx_mdef_5spacy_8pipeline_17_parser_internals_11_beam_utils_5get_unique_states = {"get_unique_states", (PyCFunction)(void(*)(void))(__Pyx_PyCFunction_FastCallWithKeywords)__pyx_pw_5spacy_8pipeline_17_parser_internals_11_beam_utils_5get_unique_states, __Pyx_METH_FASTCALL|METH_KEYWORDS, __pyx_doc_5spacy_8pipeline_17_parser_internals_11_beam_utils_4get_unique_states}; +static PyObject *__pyx_pw_5spacy_8pipeline_17_parser_internals_11_beam_utils_5get_unique_states(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 +) { + PyObject *__pyx_v_pbeams = 0; + PyObject *__pyx_v_gbeams = 0; + #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("get_unique_states (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_pbeams,&__pyx_mstate_global->__pyx_n_u_gbeams,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, 214, __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, 214, __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, 214, __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, "get_unique_states", 0) < (0)) __PYX_ERR(0, 214, __pyx_L3_error) + for (Py_ssize_t i = __pyx_nargs; i < 2; i++) { + if (unlikely(!values[i])) { __Pyx_RaiseArgtupleInvalid("get_unique_states", 1, 2, 2, i); __PYX_ERR(0, 214, __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, 214, __pyx_L3_error) + values[1] = __Pyx_ArgRef_FASTCALL(__pyx_args, 1); + if (!CYTHON_ASSUME_SAFE_MACROS && unlikely(!values[1])) __PYX_ERR(0, 214, __pyx_L3_error) + } + __pyx_v_pbeams = values[0]; + __pyx_v_gbeams = values[1]; + } + goto __pyx_L6_skip; + __pyx_L5_argtuple_error:; + __Pyx_RaiseArgtupleInvalid("get_unique_states", 1, 2, 2, __pyx_nargs); __PYX_ERR(0, 214, __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("spacy.pipeline._parser_internals._beam_utils.get_unique_states", __pyx_clineno, __pyx_lineno, __pyx_filename); + __Pyx_RefNannyFinishContext(); + return NULL; + __pyx_L4_argument_unpacking_done:; + __pyx_r = __pyx_pf_5spacy_8pipeline_17_parser_internals_11_beam_utils_4get_unique_states(__pyx_self, __pyx_v_pbeams, __pyx_v_gbeams); + + /* 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_5spacy_8pipeline_17_parser_internals_11_beam_utils_4get_unique_states(CYTHON_UNUSED PyObject *__pyx_self, PyObject *__pyx_v_pbeams, PyObject *__pyx_v_gbeams) { + PyObject *__pyx_v_seen = NULL; + PyObject *__pyx_v_states = NULL; + PyObject *__pyx_v_p_indices = NULL; + PyObject *__pyx_v_g_indices = NULL; + PyObject *__pyx_v_beam_map = NULL; + PyObject *__pyx_v_docs = NULL; + struct __pyx_obj_5thinc_5extra_6search_Beam *__pyx_v_pbeam = 0; + struct __pyx_obj_5thinc_5extra_6search_Beam *__pyx_v_gbeam = 0; + PyObject *__pyx_v_eg_id = NULL; + PyObject *__pyx_v_doc = NULL; + __pyx_t_5thinc_5extra_6search_class_t __pyx_v_i; + struct __pyx_obj_5spacy_8pipeline_17_parser_internals_10stateclass_StateClass *__pyx_v_state = NULL; + PyObject *__pyx_v_key = NULL; + PyObject *__pyx_r = NULL; + __Pyx_RefNannyDeclarations + PyObject *__pyx_t_1 = NULL; + Py_ssize_t __pyx_t_2; + Py_ssize_t __pyx_t_3; + int __pyx_t_4; + PyObject *__pyx_t_5 = NULL; + PyObject *__pyx_t_6 = NULL; + PyObject *__pyx_t_7 = NULL; + 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; + PyObject *(*__pyx_t_13)(PyObject *); + PyObject *(*__pyx_t_14)(PyObject *); + __pyx_t_5thinc_5extra_6search_class_t __pyx_t_15; + __pyx_t_5thinc_5extra_6search_class_t __pyx_t_16; + __pyx_t_5thinc_5extra_6search_class_t __pyx_t_17; + void *__pyx_t_18; + int __pyx_t_19; + int __pyx_t_20; + int __pyx_lineno = 0; + const char *__pyx_filename = NULL; + int __pyx_clineno = 0; + __Pyx_RefNannySetupContext("get_unique_states", 0); + + /* "spacy/pipeline/_parser_internals/_beam_utils.pyx":215 + * + * def get_unique_states(pbeams, gbeams): + * seen = {} # <<<<<<<<<<<<<< + * states = [] + * p_indices = [] +*/ + __pyx_t_1 = __Pyx_PyDict_NewPresized(0); if (unlikely(!__pyx_t_1)) __PYX_ERR(0, 215, __pyx_L1_error) + __Pyx_GOTREF(__pyx_t_1); + __pyx_v_seen = ((PyObject*)__pyx_t_1); + __pyx_t_1 = 0; + + /* "spacy/pipeline/_parser_internals/_beam_utils.pyx":216 + * def get_unique_states(pbeams, gbeams): + * seen = {} + * states = [] # <<<<<<<<<<<<<< + * p_indices = [] + * g_indices = [] +*/ + __pyx_t_1 = PyList_New(0); if (unlikely(!__pyx_t_1)) __PYX_ERR(0, 216, __pyx_L1_error) + __Pyx_GOTREF(__pyx_t_1); + __pyx_v_states = ((PyObject*)__pyx_t_1); + __pyx_t_1 = 0; + + /* "spacy/pipeline/_parser_internals/_beam_utils.pyx":217 + * seen = {} + * states = [] + * p_indices = [] # <<<<<<<<<<<<<< + * g_indices = [] + * beam_map = {} +*/ + __pyx_t_1 = PyList_New(0); if (unlikely(!__pyx_t_1)) __PYX_ERR(0, 217, __pyx_L1_error) + __Pyx_GOTREF(__pyx_t_1); + __pyx_v_p_indices = __pyx_t_1; + __pyx_t_1 = 0; + + /* "spacy/pipeline/_parser_internals/_beam_utils.pyx":218 + * states = [] + * p_indices = [] + * g_indices = [] # <<<<<<<<<<<<<< + * beam_map = {} + * docs = pbeams.docs +*/ + __pyx_t_1 = PyList_New(0); if (unlikely(!__pyx_t_1)) __PYX_ERR(0, 218, __pyx_L1_error) + __Pyx_GOTREF(__pyx_t_1); + __pyx_v_g_indices = __pyx_t_1; + __pyx_t_1 = 0; + + /* "spacy/pipeline/_parser_internals/_beam_utils.pyx":219 + * p_indices = [] + * g_indices = [] + * beam_map = {} # <<<<<<<<<<<<<< + * docs = pbeams.docs + * cdef Beam pbeam, gbeam +*/ + __pyx_t_1 = __Pyx_PyDict_NewPresized(0); if (unlikely(!__pyx_t_1)) __PYX_ERR(0, 219, __pyx_L1_error) + __Pyx_GOTREF(__pyx_t_1); + __pyx_v_beam_map = ((PyObject*)__pyx_t_1); + __pyx_t_1 = 0; + + /* "spacy/pipeline/_parser_internals/_beam_utils.pyx":220 + * g_indices = [] + * beam_map = {} + * docs = pbeams.docs # <<<<<<<<<<<<<< + * cdef Beam pbeam, gbeam + * if len(pbeams) != len(gbeams): +*/ + __pyx_t_1 = __Pyx_PyObject_GetAttrStr(__pyx_v_pbeams, __pyx_mstate_global->__pyx_n_u_docs); if (unlikely(!__pyx_t_1)) __PYX_ERR(0, 220, __pyx_L1_error) + __Pyx_GOTREF(__pyx_t_1); + __pyx_v_docs = __pyx_t_1; + __pyx_t_1 = 0; + + /* "spacy/pipeline/_parser_internals/_beam_utils.pyx":222 + * docs = pbeams.docs + * cdef Beam pbeam, gbeam + * if len(pbeams) != len(gbeams): # <<<<<<<<<<<<<< + * raise ValueError(Errors.E079.format(pbeams=len(pbeams), gbeams=len(gbeams))) + * for eg_id, (pbeam, gbeam, doc) in enumerate(zip(pbeams, gbeams, docs)): +*/ + __pyx_t_2 = PyObject_Length(__pyx_v_pbeams); if (unlikely(__pyx_t_2 == ((Py_ssize_t)-1))) __PYX_ERR(0, 222, __pyx_L1_error) + __pyx_t_3 = PyObject_Length(__pyx_v_gbeams); if (unlikely(__pyx_t_3 == ((Py_ssize_t)-1))) __PYX_ERR(0, 222, __pyx_L1_error) + __pyx_t_4 = (__pyx_t_2 != __pyx_t_3); + if (unlikely(__pyx_t_4)) { + + /* "spacy/pipeline/_parser_internals/_beam_utils.pyx":223 + * cdef Beam pbeam, gbeam + * if len(pbeams) != len(gbeams): + * raise ValueError(Errors.E079.format(pbeams=len(pbeams), gbeams=len(gbeams))) # <<<<<<<<<<<<<< + * for eg_id, (pbeam, gbeam, doc) in enumerate(zip(pbeams, gbeams, docs)): + * if not pbeam.is_done: +*/ + __pyx_t_5 = NULL; + __Pyx_GetModuleGlobalName(__pyx_t_8, __pyx_mstate_global->__pyx_n_u_Errors); if (unlikely(!__pyx_t_8)) __PYX_ERR(0, 223, __pyx_L1_error) + __Pyx_GOTREF(__pyx_t_8); + __pyx_t_9 = __Pyx_PyObject_GetAttrStr(__pyx_t_8, __pyx_mstate_global->__pyx_n_u_E079); if (unlikely(!__pyx_t_9)) __PYX_ERR(0, 223, __pyx_L1_error) + __Pyx_GOTREF(__pyx_t_9); + __Pyx_DECREF(__pyx_t_8); __pyx_t_8 = 0; + __pyx_t_7 = __pyx_t_9; + __Pyx_INCREF(__pyx_t_7); + __pyx_t_3 = PyObject_Length(__pyx_v_pbeams); if (unlikely(__pyx_t_3 == ((Py_ssize_t)-1))) __PYX_ERR(0, 223, __pyx_L1_error) + __pyx_t_8 = PyLong_FromSsize_t(__pyx_t_3); if (unlikely(!__pyx_t_8)) __PYX_ERR(0, 223, __pyx_L1_error) + __Pyx_GOTREF(__pyx_t_8); + __pyx_t_3 = PyObject_Length(__pyx_v_gbeams); if (unlikely(__pyx_t_3 == ((Py_ssize_t)-1))) __PYX_ERR(0, 223, __pyx_L1_error) + __pyx_t_10 = PyLong_FromSsize_t(__pyx_t_3); if (unlikely(!__pyx_t_10)) __PYX_ERR(0, 223, __pyx_L1_error) + __Pyx_GOTREF(__pyx_t_10); + __pyx_t_11 = 0; + { + PyObject *__pyx_callargs[2 + ((CYTHON_VECTORCALL) ? 2 : 0)] = {__pyx_t_7, NULL}; + __pyx_t_12 = __Pyx_MakeVectorcallBuilderKwds(2); if (unlikely(!__pyx_t_12)) __PYX_ERR(0, 223, __pyx_L1_error) + __Pyx_GOTREF(__pyx_t_12); + if (__Pyx_VectorcallBuilder_AddArg(__pyx_mstate_global->__pyx_n_u_pbeams, __pyx_t_8, __pyx_t_12, __pyx_callargs+1, 0) < (0)) __PYX_ERR(0, 223, __pyx_L1_error) + if (__Pyx_VectorcallBuilder_AddArg(__pyx_mstate_global->__pyx_n_u_gbeams, __pyx_t_10, __pyx_t_12, __pyx_callargs+1, 1) < (0)) __PYX_ERR(0, 223, __pyx_L1_error) + __pyx_t_6 = __Pyx_Object_VectorcallMethod_CallFromBuilder((PyObject*)__pyx_mstate_global->__pyx_n_u_format, __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_10); __pyx_t_10 = 0; + __Pyx_DECREF(__pyx_t_12); __pyx_t_12 = 0; + __Pyx_DECREF(__pyx_t_9); __pyx_t_9 = 0; + if (unlikely(!__pyx_t_6)) __PYX_ERR(0, 223, __pyx_L1_error) + __Pyx_GOTREF(__pyx_t_6); + } + __pyx_t_11 = 1; + { + PyObject *__pyx_callargs[2] = {__pyx_t_5, __pyx_t_6}; + __pyx_t_1 = __Pyx_PyObject_FastCall((PyObject*)(((PyTypeObject*)PyExc_ValueError)), __pyx_callargs+__pyx_t_11, (2-__pyx_t_11) | (__pyx_t_11*__Pyx_PY_VECTORCALL_ARGUMENTS_OFFSET)); + __Pyx_XDECREF(__pyx_t_5); __pyx_t_5 = 0; + __Pyx_DECREF(__pyx_t_6); __pyx_t_6 = 0; + if (unlikely(!__pyx_t_1)) __PYX_ERR(0, 223, __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, 223, __pyx_L1_error) + + /* "spacy/pipeline/_parser_internals/_beam_utils.pyx":222 + * docs = pbeams.docs + * cdef Beam pbeam, gbeam + * if len(pbeams) != len(gbeams): # <<<<<<<<<<<<<< + * raise ValueError(Errors.E079.format(pbeams=len(pbeams), gbeams=len(gbeams))) + * for eg_id, (pbeam, gbeam, doc) in enumerate(zip(pbeams, gbeams, docs)): +*/ + } + + /* "spacy/pipeline/_parser_internals/_beam_utils.pyx":224 + * if len(pbeams) != len(gbeams): + * raise ValueError(Errors.E079.format(pbeams=len(pbeams), gbeams=len(gbeams))) + * for eg_id, (pbeam, gbeam, doc) in enumerate(zip(pbeams, gbeams, docs)): # <<<<<<<<<<<<<< + * if not pbeam.is_done: + * for i in range(pbeam.size): +*/ + __Pyx_INCREF(__pyx_mstate_global->__pyx_int_0); + __pyx_t_1 = __pyx_mstate_global->__pyx_int_0; + __pyx_t_5 = NULL; + __pyx_t_11 = 1; + { + PyObject *__pyx_callargs[4] = {__pyx_t_5, __pyx_v_pbeams, __pyx_v_gbeams, __pyx_v_docs}; + __pyx_t_6 = __Pyx_PyObject_FastCall((PyObject*)__pyx_builtin_zip, __pyx_callargs+__pyx_t_11, (4-__pyx_t_11) | (__pyx_t_11*__Pyx_PY_VECTORCALL_ARGUMENTS_OFFSET)); + __Pyx_XDECREF(__pyx_t_5); __pyx_t_5 = 0; + if (unlikely(!__pyx_t_6)) __PYX_ERR(0, 224, __pyx_L1_error) + __Pyx_GOTREF(__pyx_t_6); + } + if (likely(PyList_CheckExact(__pyx_t_6)) || PyTuple_CheckExact(__pyx_t_6)) { + __pyx_t_5 = __pyx_t_6; __Pyx_INCREF(__pyx_t_5); + __pyx_t_3 = 0; + __pyx_t_13 = NULL; + } else { + __pyx_t_3 = -1; __pyx_t_5 = PyObject_GetIter(__pyx_t_6); if (unlikely(!__pyx_t_5)) __PYX_ERR(0, 224, __pyx_L1_error) + __Pyx_GOTREF(__pyx_t_5); + __pyx_t_13 = (CYTHON_COMPILING_IN_LIMITED_API) ? PyIter_Next : __Pyx_PyObject_GetIterNextFunc(__pyx_t_5); if (unlikely(!__pyx_t_13)) __PYX_ERR(0, 224, __pyx_L1_error) + } + __Pyx_DECREF(__pyx_t_6); __pyx_t_6 = 0; + for (;;) { + if (likely(!__pyx_t_13)) { + if (likely(PyList_CheckExact(__pyx_t_5))) { + { + Py_ssize_t __pyx_temp = __Pyx_PyList_GET_SIZE(__pyx_t_5); + #if !CYTHON_ASSUME_SAFE_SIZE + if (unlikely((__pyx_temp < 0))) __PYX_ERR(0, 224, __pyx_L1_error) + #endif + if (__pyx_t_3 >= __pyx_temp) break; + } + __pyx_t_6 = __Pyx_PyList_GetItemRefFast(__pyx_t_5, __pyx_t_3, __Pyx_ReferenceSharing_OwnStrongReference); + ++__pyx_t_3; + } else { + { + Py_ssize_t __pyx_temp = __Pyx_PyTuple_GET_SIZE(__pyx_t_5); + #if !CYTHON_ASSUME_SAFE_SIZE + if (unlikely((__pyx_temp < 0))) __PYX_ERR(0, 224, __pyx_L1_error) + #endif + if (__pyx_t_3 >= __pyx_temp) break; + } + #if CYTHON_ASSUME_SAFE_MACROS && !CYTHON_AVOID_BORROWED_REFS + __pyx_t_6 = __Pyx_NewRef(PyTuple_GET_ITEM(__pyx_t_5, __pyx_t_3)); + #else + __pyx_t_6 = __Pyx_PySequence_ITEM(__pyx_t_5, __pyx_t_3); + #endif + ++__pyx_t_3; + } + if (unlikely(!__pyx_t_6)) __PYX_ERR(0, 224, __pyx_L1_error) + } else { + __pyx_t_6 = __pyx_t_13(__pyx_t_5); + if (unlikely(!__pyx_t_6)) { + PyObject* exc_type = PyErr_Occurred(); + if (exc_type) { + if (unlikely(!__Pyx_PyErr_GivenExceptionMatches(exc_type, PyExc_StopIteration))) __PYX_ERR(0, 224, __pyx_L1_error) + PyErr_Clear(); + } + break; + } + } + __Pyx_GOTREF(__pyx_t_6); + if ((likely(PyTuple_CheckExact(__pyx_t_6))) || (PyList_CheckExact(__pyx_t_6))) { + PyObject* sequence = __pyx_t_6; + Py_ssize_t size = __Pyx_PySequence_SIZE(sequence); + if (unlikely(size != 3)) { + if (size > 3) __Pyx_RaiseTooManyValuesError(3); + else if (size >= 0) __Pyx_RaiseNeedMoreValuesError(size); + __PYX_ERR(0, 224, __pyx_L1_error) + } + #if CYTHON_ASSUME_SAFE_MACROS && !CYTHON_AVOID_BORROWED_REFS + if (likely(PyTuple_CheckExact(sequence))) { + __pyx_t_9 = PyTuple_GET_ITEM(sequence, 0); + __Pyx_INCREF(__pyx_t_9); + __pyx_t_12 = PyTuple_GET_ITEM(sequence, 1); + __Pyx_INCREF(__pyx_t_12); + __pyx_t_10 = PyTuple_GET_ITEM(sequence, 2); + __Pyx_INCREF(__pyx_t_10); + } else { + __pyx_t_9 = __Pyx_PyList_GetItemRefFast(sequence, 0, __Pyx_ReferenceSharing_SharedReference); + if (unlikely(!__pyx_t_9)) __PYX_ERR(0, 224, __pyx_L1_error) + __Pyx_XGOTREF(__pyx_t_9); + __pyx_t_12 = __Pyx_PyList_GetItemRefFast(sequence, 1, __Pyx_ReferenceSharing_SharedReference); + if (unlikely(!__pyx_t_12)) __PYX_ERR(0, 224, __pyx_L1_error) + __Pyx_XGOTREF(__pyx_t_12); + __pyx_t_10 = __Pyx_PyList_GetItemRefFast(sequence, 2, __Pyx_ReferenceSharing_SharedReference); + if (unlikely(!__pyx_t_10)) __PYX_ERR(0, 224, __pyx_L1_error) + __Pyx_XGOTREF(__pyx_t_10); + } + #else + __pyx_t_9 = __Pyx_PySequence_ITEM(sequence, 0); if (unlikely(!__pyx_t_9)) __PYX_ERR(0, 224, __pyx_L1_error) + __Pyx_GOTREF(__pyx_t_9); + __pyx_t_12 = __Pyx_PySequence_ITEM(sequence, 1); if (unlikely(!__pyx_t_12)) __PYX_ERR(0, 224, __pyx_L1_error) + __Pyx_GOTREF(__pyx_t_12); + __pyx_t_10 = __Pyx_PySequence_ITEM(sequence, 2); if (unlikely(!__pyx_t_10)) __PYX_ERR(0, 224, __pyx_L1_error) + __Pyx_GOTREF(__pyx_t_10); + #endif + __Pyx_DECREF(__pyx_t_6); __pyx_t_6 = 0; + } else { + Py_ssize_t index = -1; + __pyx_t_8 = PyObject_GetIter(__pyx_t_6); if (unlikely(!__pyx_t_8)) __PYX_ERR(0, 224, __pyx_L1_error) + __Pyx_GOTREF(__pyx_t_8); + __Pyx_DECREF(__pyx_t_6); __pyx_t_6 = 0; + __pyx_t_14 = (CYTHON_COMPILING_IN_LIMITED_API) ? PyIter_Next : __Pyx_PyObject_GetIterNextFunc(__pyx_t_8); + index = 0; __pyx_t_9 = __pyx_t_14(__pyx_t_8); if (unlikely(!__pyx_t_9)) goto __pyx_L6_unpacking_failed; + __Pyx_GOTREF(__pyx_t_9); + index = 1; __pyx_t_12 = __pyx_t_14(__pyx_t_8); if (unlikely(!__pyx_t_12)) goto __pyx_L6_unpacking_failed; + __Pyx_GOTREF(__pyx_t_12); + index = 2; __pyx_t_10 = __pyx_t_14(__pyx_t_8); if (unlikely(!__pyx_t_10)) goto __pyx_L6_unpacking_failed; + __Pyx_GOTREF(__pyx_t_10); + if (__Pyx_IternextUnpackEndCheck(__pyx_t_14(__pyx_t_8), 3) < (0)) __PYX_ERR(0, 224, __pyx_L1_error) + __pyx_t_14 = NULL; + __Pyx_DECREF(__pyx_t_8); __pyx_t_8 = 0; + goto __pyx_L7_unpacking_done; + __pyx_L6_unpacking_failed:; + __Pyx_DECREF(__pyx_t_8); __pyx_t_8 = 0; + __pyx_t_14 = NULL; + if (__Pyx_IterFinish() == 0) __Pyx_RaiseNeedMoreValuesError(index); + __PYX_ERR(0, 224, __pyx_L1_error) + __pyx_L7_unpacking_done:; + } + if (!(likely(((__pyx_t_9) == Py_None) || likely(__Pyx_TypeTest(__pyx_t_9, __pyx_mstate_global->__pyx_ptype_5thinc_5extra_6search_Beam))))) __PYX_ERR(0, 224, __pyx_L1_error) + if (!(likely(((__pyx_t_12) == Py_None) || likely(__Pyx_TypeTest(__pyx_t_12, __pyx_mstate_global->__pyx_ptype_5thinc_5extra_6search_Beam))))) __PYX_ERR(0, 224, __pyx_L1_error) + __Pyx_XDECREF_SET(__pyx_v_pbeam, ((struct __pyx_obj_5thinc_5extra_6search_Beam *)__pyx_t_9)); + __pyx_t_9 = 0; + __Pyx_XDECREF_SET(__pyx_v_gbeam, ((struct __pyx_obj_5thinc_5extra_6search_Beam *)__pyx_t_12)); + __pyx_t_12 = 0; + __Pyx_XDECREF_SET(__pyx_v_doc, __pyx_t_10); + __pyx_t_10 = 0; + __Pyx_INCREF(__pyx_t_1); + __Pyx_XDECREF_SET(__pyx_v_eg_id, __pyx_t_1); + __pyx_t_6 = __Pyx_PyLong_AddObjC(__pyx_t_1, __pyx_mstate_global->__pyx_int_1, 1, 0, 0); if (unlikely(!__pyx_t_6)) __PYX_ERR(0, 224, __pyx_L1_error) + __Pyx_GOTREF(__pyx_t_6); + __Pyx_DECREF(__pyx_t_1); + __pyx_t_1 = __pyx_t_6; + __pyx_t_6 = 0; + + /* "spacy/pipeline/_parser_internals/_beam_utils.pyx":225 + * raise ValueError(Errors.E079.format(pbeams=len(pbeams), gbeams=len(gbeams))) + * for eg_id, (pbeam, gbeam, doc) in enumerate(zip(pbeams, gbeams, docs)): + * if not pbeam.is_done: # <<<<<<<<<<<<<< + * for i in range(pbeam.size): + * state = StateClass.borrow(pbeam.at(i), doc) +*/ + __pyx_t_4 = (!__pyx_v_pbeam->is_done); + if (__pyx_t_4) { + + /* "spacy/pipeline/_parser_internals/_beam_utils.pyx":226 + * for eg_id, (pbeam, gbeam, doc) in enumerate(zip(pbeams, gbeams, docs)): + * if not pbeam.is_done: + * for i in range(pbeam.size): # <<<<<<<<<<<<<< + * state = StateClass.borrow(pbeam.at(i), doc) + * if not state.is_final(): +*/ + __pyx_t_15 = __pyx_v_pbeam->size; + __pyx_t_16 = __pyx_t_15; + for (__pyx_t_17 = 0; __pyx_t_17 < __pyx_t_16; __pyx_t_17+=1) { + __pyx_v_i = __pyx_t_17; + + /* "spacy/pipeline/_parser_internals/_beam_utils.pyx":227 + * if not pbeam.is_done: + * for i in range(pbeam.size): + * state = StateClass.borrow(pbeam.at(i), doc) # <<<<<<<<<<<<<< + * if not state.is_final(): + * key = tuple([eg_id] + pbeam.histories[i]) +*/ + __pyx_t_18 = __pyx_f_5thinc_5extra_6search_4Beam_at(__pyx_v_pbeam, __pyx_v_i); if (unlikely(PyErr_Occurred())) __PYX_ERR(0, 227, __pyx_L1_error) + if (!(likely(((__pyx_v_doc) == Py_None) || likely(__Pyx_TypeTest(__pyx_v_doc, __pyx_mstate_global->__pyx_ptype_5spacy_6tokens_3doc_Doc))))) __PYX_ERR(0, 227, __pyx_L1_error) + __pyx_t_6 = ((PyObject *)__pyx_f_5spacy_8pipeline_17_parser_internals_10stateclass_10StateClass_borrow(((__pyx_t_5spacy_8pipeline_17_parser_internals_6_state_StateC *)__pyx_t_18), ((struct __pyx_obj_5spacy_6tokens_3doc_Doc *)__pyx_v_doc))); if (unlikely(!__pyx_t_6)) __PYX_ERR(0, 227, __pyx_L1_error) + __Pyx_GOTREF(__pyx_t_6); + __Pyx_XDECREF_SET(__pyx_v_state, ((struct __pyx_obj_5spacy_8pipeline_17_parser_internals_10stateclass_StateClass *)__pyx_t_6)); + __pyx_t_6 = 0; + + /* "spacy/pipeline/_parser_internals/_beam_utils.pyx":228 + * for i in range(pbeam.size): + * state = StateClass.borrow(pbeam.at(i), doc) + * if not state.is_final(): # <<<<<<<<<<<<<< + * key = tuple([eg_id] + pbeam.histories[i]) + * if key in seen: +*/ + __pyx_t_10 = ((PyObject *)__pyx_v_state); + __Pyx_INCREF(__pyx_t_10); + __pyx_t_11 = 0; + { + PyObject *__pyx_callargs[2] = {__pyx_t_10, NULL}; + __pyx_t_6 = __Pyx_PyObject_FastCallMethod((PyObject*)__pyx_mstate_global->__pyx_n_u_is_final, __pyx_callargs+__pyx_t_11, (1-__pyx_t_11) | (1*__Pyx_PY_VECTORCALL_ARGUMENTS_OFFSET)); + __Pyx_XDECREF(__pyx_t_10); __pyx_t_10 = 0; + if (unlikely(!__pyx_t_6)) __PYX_ERR(0, 228, __pyx_L1_error) + __Pyx_GOTREF(__pyx_t_6); + } + __pyx_t_4 = __Pyx_PyObject_IsTrue(__pyx_t_6); if (unlikely((__pyx_t_4 < 0))) __PYX_ERR(0, 228, __pyx_L1_error) + __Pyx_DECREF(__pyx_t_6); __pyx_t_6 = 0; + __pyx_t_19 = (!__pyx_t_4); + if (__pyx_t_19) { + + /* "spacy/pipeline/_parser_internals/_beam_utils.pyx":229 + * state = StateClass.borrow(pbeam.at(i), doc) + * if not state.is_final(): + * key = tuple([eg_id] + pbeam.histories[i]) # <<<<<<<<<<<<<< + * if key in seen: + * raise ValueError(Errors.E080.format(key=key)) +*/ + __pyx_t_6 = PyList_New(1); if (unlikely(!__pyx_t_6)) __PYX_ERR(0, 229, __pyx_L1_error) + __Pyx_GOTREF(__pyx_t_6); + __Pyx_INCREF(__pyx_v_eg_id); + __Pyx_GIVEREF(__pyx_v_eg_id); + if (__Pyx_PyList_SET_ITEM(__pyx_t_6, 0, __pyx_v_eg_id) != (0)) __PYX_ERR(0, 229, __pyx_L1_error); + if (unlikely(__pyx_v_pbeam->histories == Py_None)) { + PyErr_SetString(PyExc_TypeError, "'NoneType' object is not subscriptable"); + __PYX_ERR(0, 229, __pyx_L1_error) + } + __pyx_t_10 = __Pyx_GetItemInt_List(__pyx_v_pbeam->histories, __pyx_v_i, __pyx_t_5thinc_5extra_6search_class_t, 0, __Pyx_PyLong_From_uint64_t, 1, 0, 1, 1, __Pyx_ReferenceSharing_SharedReference); if (unlikely(!__pyx_t_10)) __PYX_ERR(0, 229, __pyx_L1_error) + __Pyx_GOTREF(__pyx_t_10); + __pyx_t_12 = PyNumber_Add(__pyx_t_6, __pyx_t_10); if (unlikely(!__pyx_t_12)) __PYX_ERR(0, 229, __pyx_L1_error) + __Pyx_GOTREF(__pyx_t_12); + __Pyx_DECREF(__pyx_t_6); __pyx_t_6 = 0; + __Pyx_DECREF(__pyx_t_10); __pyx_t_10 = 0; + __pyx_t_10 = __Pyx_PySequence_Tuple(__pyx_t_12); if (unlikely(!__pyx_t_10)) __PYX_ERR(0, 229, __pyx_L1_error) + __Pyx_GOTREF(__pyx_t_10); + __Pyx_DECREF(__pyx_t_12); __pyx_t_12 = 0; + __Pyx_XDECREF_SET(__pyx_v_key, ((PyObject*)__pyx_t_10)); + __pyx_t_10 = 0; + + /* "spacy/pipeline/_parser_internals/_beam_utils.pyx":230 + * if not state.is_final(): + * key = tuple([eg_id] + pbeam.histories[i]) + * if key in seen: # <<<<<<<<<<<<<< + * raise ValueError(Errors.E080.format(key=key)) + * seen[key] = len(states) +*/ + __pyx_t_19 = (__Pyx_PyDict_ContainsTF(__pyx_v_key, __pyx_v_seen, Py_EQ)); if (unlikely((__pyx_t_19 < 0))) __PYX_ERR(0, 230, __pyx_L1_error) + if (unlikely(__pyx_t_19)) { + + /* "spacy/pipeline/_parser_internals/_beam_utils.pyx":231 + * key = tuple([eg_id] + pbeam.histories[i]) + * if key in seen: + * raise ValueError(Errors.E080.format(key=key)) # <<<<<<<<<<<<<< + * seen[key] = len(states) + * p_indices.append(len(states)) +*/ + __pyx_t_12 = NULL; + __Pyx_GetModuleGlobalName(__pyx_t_8, __pyx_mstate_global->__pyx_n_u_Errors); if (unlikely(!__pyx_t_8)) __PYX_ERR(0, 231, __pyx_L1_error) + __Pyx_GOTREF(__pyx_t_8); + __pyx_t_7 = __Pyx_PyObject_GetAttrStr(__pyx_t_8, __pyx_mstate_global->__pyx_n_u_E080); if (unlikely(!__pyx_t_7)) __PYX_ERR(0, 231, __pyx_L1_error) + __Pyx_GOTREF(__pyx_t_7); + __Pyx_DECREF(__pyx_t_8); __pyx_t_8 = 0; + __pyx_t_9 = __pyx_t_7; + __Pyx_INCREF(__pyx_t_9); + __pyx_t_11 = 0; + { + PyObject *__pyx_callargs[2 + ((CYTHON_VECTORCALL) ? 1 : 0)] = {__pyx_t_9, NULL}; + __pyx_t_8 = __Pyx_MakeVectorcallBuilderKwds(1); if (unlikely(!__pyx_t_8)) __PYX_ERR(0, 231, __pyx_L1_error) + __Pyx_GOTREF(__pyx_t_8); + if (__Pyx_VectorcallBuilder_AddArg(__pyx_mstate_global->__pyx_n_u_key, __pyx_v_key, __pyx_t_8, __pyx_callargs+1, 0) < (0)) __PYX_ERR(0, 231, __pyx_L1_error) + __pyx_t_6 = __Pyx_Object_VectorcallMethod_CallFromBuilder((PyObject*)__pyx_mstate_global->__pyx_n_u_format, __pyx_callargs+__pyx_t_11, (1-__pyx_t_11) | (1*__Pyx_PY_VECTORCALL_ARGUMENTS_OFFSET), __pyx_t_8); + __Pyx_XDECREF(__pyx_t_9); __pyx_t_9 = 0; + __Pyx_DECREF(__pyx_t_8); __pyx_t_8 = 0; + __Pyx_DECREF(__pyx_t_7); __pyx_t_7 = 0; + if (unlikely(!__pyx_t_6)) __PYX_ERR(0, 231, __pyx_L1_error) + __Pyx_GOTREF(__pyx_t_6); + } + __pyx_t_11 = 1; + { + PyObject *__pyx_callargs[2] = {__pyx_t_12, __pyx_t_6}; + __pyx_t_10 = __Pyx_PyObject_FastCall((PyObject*)(((PyTypeObject*)PyExc_ValueError)), __pyx_callargs+__pyx_t_11, (2-__pyx_t_11) | (__pyx_t_11*__Pyx_PY_VECTORCALL_ARGUMENTS_OFFSET)); + __Pyx_XDECREF(__pyx_t_12); __pyx_t_12 = 0; + __Pyx_DECREF(__pyx_t_6); __pyx_t_6 = 0; + if (unlikely(!__pyx_t_10)) __PYX_ERR(0, 231, __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, 231, __pyx_L1_error) + + /* "spacy/pipeline/_parser_internals/_beam_utils.pyx":230 + * if not state.is_final(): + * key = tuple([eg_id] + pbeam.histories[i]) + * if key in seen: # <<<<<<<<<<<<<< + * raise ValueError(Errors.E080.format(key=key)) + * seen[key] = len(states) +*/ + } + + /* "spacy/pipeline/_parser_internals/_beam_utils.pyx":232 + * if key in seen: + * raise ValueError(Errors.E080.format(key=key)) + * seen[key] = len(states) # <<<<<<<<<<<<<< + * p_indices.append(len(states)) + * states.append(state) +*/ + __pyx_t_2 = __Pyx_PyList_GET_SIZE(__pyx_v_states); if (unlikely(__pyx_t_2 == ((Py_ssize_t)-1))) __PYX_ERR(0, 232, __pyx_L1_error) + __pyx_t_10 = PyLong_FromSsize_t(__pyx_t_2); if (unlikely(!__pyx_t_10)) __PYX_ERR(0, 232, __pyx_L1_error) + __Pyx_GOTREF(__pyx_t_10); + if (unlikely((PyDict_SetItem(__pyx_v_seen, __pyx_v_key, __pyx_t_10) < 0))) __PYX_ERR(0, 232, __pyx_L1_error) + __Pyx_DECREF(__pyx_t_10); __pyx_t_10 = 0; + + /* "spacy/pipeline/_parser_internals/_beam_utils.pyx":233 + * raise ValueError(Errors.E080.format(key=key)) + * seen[key] = len(states) + * p_indices.append(len(states)) # <<<<<<<<<<<<<< + * states.append(state) + * beam_map.update(seen) +*/ + __pyx_t_2 = __Pyx_PyList_GET_SIZE(__pyx_v_states); if (unlikely(__pyx_t_2 == ((Py_ssize_t)-1))) __PYX_ERR(0, 233, __pyx_L1_error) + __pyx_t_10 = PyLong_FromSsize_t(__pyx_t_2); if (unlikely(!__pyx_t_10)) __PYX_ERR(0, 233, __pyx_L1_error) + __Pyx_GOTREF(__pyx_t_10); + __pyx_t_20 = __Pyx_PyObject_Append(__pyx_v_p_indices, __pyx_t_10); if (unlikely(__pyx_t_20 == ((int)-1))) __PYX_ERR(0, 233, __pyx_L1_error) + __Pyx_DECREF(__pyx_t_10); __pyx_t_10 = 0; + + /* "spacy/pipeline/_parser_internals/_beam_utils.pyx":234 + * seen[key] = len(states) + * p_indices.append(len(states)) + * states.append(state) # <<<<<<<<<<<<<< + * beam_map.update(seen) + * if not gbeam.is_done: +*/ + __pyx_t_20 = __Pyx_PyList_Append(__pyx_v_states, ((PyObject *)__pyx_v_state)); if (unlikely(__pyx_t_20 == ((int)-1))) __PYX_ERR(0, 234, __pyx_L1_error) + + /* "spacy/pipeline/_parser_internals/_beam_utils.pyx":228 + * for i in range(pbeam.size): + * state = StateClass.borrow(pbeam.at(i), doc) + * if not state.is_final(): # <<<<<<<<<<<<<< + * key = tuple([eg_id] + pbeam.histories[i]) + * if key in seen: +*/ + } + } + + /* "spacy/pipeline/_parser_internals/_beam_utils.pyx":235 + * p_indices.append(len(states)) + * states.append(state) + * beam_map.update(seen) # <<<<<<<<<<<<<< + * if not gbeam.is_done: + * for i in range(gbeam.size): +*/ + __pyx_t_10 = __Pyx_CallUnboundCMethod1(&__pyx_mstate_global->__pyx_umethod_PyDict_Type__update, __pyx_v_beam_map, __pyx_v_seen); if (unlikely(!__pyx_t_10)) __PYX_ERR(0, 235, __pyx_L1_error) + __Pyx_GOTREF(__pyx_t_10); + __Pyx_DECREF(__pyx_t_10); __pyx_t_10 = 0; + + /* "spacy/pipeline/_parser_internals/_beam_utils.pyx":225 + * raise ValueError(Errors.E079.format(pbeams=len(pbeams), gbeams=len(gbeams))) + * for eg_id, (pbeam, gbeam, doc) in enumerate(zip(pbeams, gbeams, docs)): + * if not pbeam.is_done: # <<<<<<<<<<<<<< + * for i in range(pbeam.size): + * state = StateClass.borrow(pbeam.at(i), doc) +*/ + } + + /* "spacy/pipeline/_parser_internals/_beam_utils.pyx":236 + * states.append(state) + * beam_map.update(seen) + * if not gbeam.is_done: # <<<<<<<<<<<<<< + * for i in range(gbeam.size): + * state = StateClass.borrow(gbeam.at(i), doc) +*/ + __pyx_t_19 = (!__pyx_v_gbeam->is_done); + if (__pyx_t_19) { + + /* "spacy/pipeline/_parser_internals/_beam_utils.pyx":237 + * beam_map.update(seen) + * if not gbeam.is_done: + * for i in range(gbeam.size): # <<<<<<<<<<<<<< + * state = StateClass.borrow(gbeam.at(i), doc) + * if not state.is_final(): +*/ + __pyx_t_15 = __pyx_v_gbeam->size; + __pyx_t_16 = __pyx_t_15; + for (__pyx_t_17 = 0; __pyx_t_17 < __pyx_t_16; __pyx_t_17+=1) { + __pyx_v_i = __pyx_t_17; + + /* "spacy/pipeline/_parser_internals/_beam_utils.pyx":238 + * if not gbeam.is_done: + * for i in range(gbeam.size): + * state = StateClass.borrow(gbeam.at(i), doc) # <<<<<<<<<<<<<< + * if not state.is_final(): + * key = tuple([eg_id] + gbeam.histories[i]) +*/ + __pyx_t_18 = __pyx_f_5thinc_5extra_6search_4Beam_at(__pyx_v_gbeam, __pyx_v_i); if (unlikely(PyErr_Occurred())) __PYX_ERR(0, 238, __pyx_L1_error) + if (!(likely(((__pyx_v_doc) == Py_None) || likely(__Pyx_TypeTest(__pyx_v_doc, __pyx_mstate_global->__pyx_ptype_5spacy_6tokens_3doc_Doc))))) __PYX_ERR(0, 238, __pyx_L1_error) + __pyx_t_10 = ((PyObject *)__pyx_f_5spacy_8pipeline_17_parser_internals_10stateclass_10StateClass_borrow(((__pyx_t_5spacy_8pipeline_17_parser_internals_6_state_StateC *)__pyx_t_18), ((struct __pyx_obj_5spacy_6tokens_3doc_Doc *)__pyx_v_doc))); if (unlikely(!__pyx_t_10)) __PYX_ERR(0, 238, __pyx_L1_error) + __Pyx_GOTREF(__pyx_t_10); + __Pyx_XDECREF_SET(__pyx_v_state, ((struct __pyx_obj_5spacy_8pipeline_17_parser_internals_10stateclass_StateClass *)__pyx_t_10)); + __pyx_t_10 = 0; + + /* "spacy/pipeline/_parser_internals/_beam_utils.pyx":239 + * for i in range(gbeam.size): + * state = StateClass.borrow(gbeam.at(i), doc) + * if not state.is_final(): # <<<<<<<<<<<<<< + * key = tuple([eg_id] + gbeam.histories[i]) + * if key in seen: +*/ + __pyx_t_6 = ((PyObject *)__pyx_v_state); + __Pyx_INCREF(__pyx_t_6); + __pyx_t_11 = 0; + { + PyObject *__pyx_callargs[2] = {__pyx_t_6, NULL}; + __pyx_t_10 = __Pyx_PyObject_FastCallMethod((PyObject*)__pyx_mstate_global->__pyx_n_u_is_final, __pyx_callargs+__pyx_t_11, (1-__pyx_t_11) | (1*__Pyx_PY_VECTORCALL_ARGUMENTS_OFFSET)); + __Pyx_XDECREF(__pyx_t_6); __pyx_t_6 = 0; + if (unlikely(!__pyx_t_10)) __PYX_ERR(0, 239, __pyx_L1_error) + __Pyx_GOTREF(__pyx_t_10); + } + __pyx_t_19 = __Pyx_PyObject_IsTrue(__pyx_t_10); if (unlikely((__pyx_t_19 < 0))) __PYX_ERR(0, 239, __pyx_L1_error) + __Pyx_DECREF(__pyx_t_10); __pyx_t_10 = 0; + __pyx_t_4 = (!__pyx_t_19); + if (__pyx_t_4) { + + /* "spacy/pipeline/_parser_internals/_beam_utils.pyx":240 + * state = StateClass.borrow(gbeam.at(i), doc) + * if not state.is_final(): + * key = tuple([eg_id] + gbeam.histories[i]) # <<<<<<<<<<<<<< + * if key in seen: + * g_indices.append(seen[key]) +*/ + __pyx_t_10 = PyList_New(1); if (unlikely(!__pyx_t_10)) __PYX_ERR(0, 240, __pyx_L1_error) + __Pyx_GOTREF(__pyx_t_10); + __Pyx_INCREF(__pyx_v_eg_id); + __Pyx_GIVEREF(__pyx_v_eg_id); + if (__Pyx_PyList_SET_ITEM(__pyx_t_10, 0, __pyx_v_eg_id) != (0)) __PYX_ERR(0, 240, __pyx_L1_error); + if (unlikely(__pyx_v_gbeam->histories == Py_None)) { + PyErr_SetString(PyExc_TypeError, "'NoneType' object is not subscriptable"); + __PYX_ERR(0, 240, __pyx_L1_error) + } + __pyx_t_6 = __Pyx_GetItemInt_List(__pyx_v_gbeam->histories, __pyx_v_i, __pyx_t_5thinc_5extra_6search_class_t, 0, __Pyx_PyLong_From_uint64_t, 1, 0, 1, 1, __Pyx_ReferenceSharing_SharedReference); if (unlikely(!__pyx_t_6)) __PYX_ERR(0, 240, __pyx_L1_error) + __Pyx_GOTREF(__pyx_t_6); + __pyx_t_12 = PyNumber_Add(__pyx_t_10, __pyx_t_6); if (unlikely(!__pyx_t_12)) __PYX_ERR(0, 240, __pyx_L1_error) + __Pyx_GOTREF(__pyx_t_12); + __Pyx_DECREF(__pyx_t_10); __pyx_t_10 = 0; + __Pyx_DECREF(__pyx_t_6); __pyx_t_6 = 0; + __pyx_t_6 = __Pyx_PySequence_Tuple(__pyx_t_12); if (unlikely(!__pyx_t_6)) __PYX_ERR(0, 240, __pyx_L1_error) + __Pyx_GOTREF(__pyx_t_6); + __Pyx_DECREF(__pyx_t_12); __pyx_t_12 = 0; + __Pyx_XDECREF_SET(__pyx_v_key, ((PyObject*)__pyx_t_6)); + __pyx_t_6 = 0; + + /* "spacy/pipeline/_parser_internals/_beam_utils.pyx":241 + * if not state.is_final(): + * key = tuple([eg_id] + gbeam.histories[i]) + * if key in seen: # <<<<<<<<<<<<<< + * g_indices.append(seen[key]) + * else: +*/ + __pyx_t_4 = (__Pyx_PyDict_ContainsTF(__pyx_v_key, __pyx_v_seen, Py_EQ)); if (unlikely((__pyx_t_4 < 0))) __PYX_ERR(0, 241, __pyx_L1_error) + if (__pyx_t_4) { + + /* "spacy/pipeline/_parser_internals/_beam_utils.pyx":242 + * key = tuple([eg_id] + gbeam.histories[i]) + * if key in seen: + * g_indices.append(seen[key]) # <<<<<<<<<<<<<< + * else: + * g_indices.append(len(states)) +*/ + __pyx_t_6 = __Pyx_PyDict_GetItem(__pyx_v_seen, __pyx_v_key); if (unlikely(!__pyx_t_6)) __PYX_ERR(0, 242, __pyx_L1_error) + __Pyx_GOTREF(__pyx_t_6); + __pyx_t_20 = __Pyx_PyObject_Append(__pyx_v_g_indices, __pyx_t_6); if (unlikely(__pyx_t_20 == ((int)-1))) __PYX_ERR(0, 242, __pyx_L1_error) + __Pyx_DECREF(__pyx_t_6); __pyx_t_6 = 0; + + /* "spacy/pipeline/_parser_internals/_beam_utils.pyx":241 + * if not state.is_final(): + * key = tuple([eg_id] + gbeam.histories[i]) + * if key in seen: # <<<<<<<<<<<<<< + * g_indices.append(seen[key]) + * else: +*/ + goto __pyx_L17; + } + + /* "spacy/pipeline/_parser_internals/_beam_utils.pyx":244 + * g_indices.append(seen[key]) + * else: + * g_indices.append(len(states)) # <<<<<<<<<<<<<< + * beam_map[key] = len(states) + * states.append(state) +*/ + /*else*/ { + __pyx_t_2 = __Pyx_PyList_GET_SIZE(__pyx_v_states); if (unlikely(__pyx_t_2 == ((Py_ssize_t)-1))) __PYX_ERR(0, 244, __pyx_L1_error) + __pyx_t_6 = PyLong_FromSsize_t(__pyx_t_2); if (unlikely(!__pyx_t_6)) __PYX_ERR(0, 244, __pyx_L1_error) + __Pyx_GOTREF(__pyx_t_6); + __pyx_t_20 = __Pyx_PyObject_Append(__pyx_v_g_indices, __pyx_t_6); if (unlikely(__pyx_t_20 == ((int)-1))) __PYX_ERR(0, 244, __pyx_L1_error) + __Pyx_DECREF(__pyx_t_6); __pyx_t_6 = 0; + + /* "spacy/pipeline/_parser_internals/_beam_utils.pyx":245 + * else: + * g_indices.append(len(states)) + * beam_map[key] = len(states) # <<<<<<<<<<<<<< + * states.append(state) + * p_indices = numpy.asarray(p_indices, dtype='i') +*/ + __pyx_t_2 = __Pyx_PyList_GET_SIZE(__pyx_v_states); if (unlikely(__pyx_t_2 == ((Py_ssize_t)-1))) __PYX_ERR(0, 245, __pyx_L1_error) + __pyx_t_6 = PyLong_FromSsize_t(__pyx_t_2); if (unlikely(!__pyx_t_6)) __PYX_ERR(0, 245, __pyx_L1_error) + __Pyx_GOTREF(__pyx_t_6); + if (unlikely((PyDict_SetItem(__pyx_v_beam_map, __pyx_v_key, __pyx_t_6) < 0))) __PYX_ERR(0, 245, __pyx_L1_error) + __Pyx_DECREF(__pyx_t_6); __pyx_t_6 = 0; + + /* "spacy/pipeline/_parser_internals/_beam_utils.pyx":246 + * g_indices.append(len(states)) + * beam_map[key] = len(states) + * states.append(state) # <<<<<<<<<<<<<< + * p_indices = numpy.asarray(p_indices, dtype='i') + * g_indices = numpy.asarray(g_indices, dtype='i') +*/ + __pyx_t_20 = __Pyx_PyList_Append(__pyx_v_states, ((PyObject *)__pyx_v_state)); if (unlikely(__pyx_t_20 == ((int)-1))) __PYX_ERR(0, 246, __pyx_L1_error) + } + __pyx_L17:; + + /* "spacy/pipeline/_parser_internals/_beam_utils.pyx":239 + * for i in range(gbeam.size): + * state = StateClass.borrow(gbeam.at(i), doc) + * if not state.is_final(): # <<<<<<<<<<<<<< + * key = tuple([eg_id] + gbeam.histories[i]) + * if key in seen: +*/ + } + } + + /* "spacy/pipeline/_parser_internals/_beam_utils.pyx":236 + * states.append(state) + * beam_map.update(seen) + * if not gbeam.is_done: # <<<<<<<<<<<<<< + * for i in range(gbeam.size): + * state = StateClass.borrow(gbeam.at(i), doc) +*/ + } + + /* "spacy/pipeline/_parser_internals/_beam_utils.pyx":224 + * if len(pbeams) != len(gbeams): + * raise ValueError(Errors.E079.format(pbeams=len(pbeams), gbeams=len(gbeams))) + * for eg_id, (pbeam, gbeam, doc) in enumerate(zip(pbeams, gbeams, docs)): # <<<<<<<<<<<<<< + * if not pbeam.is_done: + * for i in range(pbeam.size): +*/ + } + __Pyx_DECREF(__pyx_t_5); __pyx_t_5 = 0; + __Pyx_DECREF(__pyx_t_1); __pyx_t_1 = 0; + + /* "spacy/pipeline/_parser_internals/_beam_utils.pyx":247 + * beam_map[key] = len(states) + * states.append(state) + * p_indices = numpy.asarray(p_indices, dtype='i') # <<<<<<<<<<<<<< + * g_indices = numpy.asarray(g_indices, dtype='i') + * return states, p_indices, g_indices, beam_map +*/ + __pyx_t_5 = NULL; + __Pyx_GetModuleGlobalName(__pyx_t_6, __pyx_mstate_global->__pyx_n_u_numpy); if (unlikely(!__pyx_t_6)) __PYX_ERR(0, 247, __pyx_L1_error) + __Pyx_GOTREF(__pyx_t_6); + __pyx_t_12 = __Pyx_PyObject_GetAttrStr(__pyx_t_6, __pyx_mstate_global->__pyx_n_u_asarray); if (unlikely(!__pyx_t_12)) __PYX_ERR(0, 247, __pyx_L1_error) + __Pyx_GOTREF(__pyx_t_12); + __Pyx_DECREF(__pyx_t_6); __pyx_t_6 = 0; + __pyx_t_11 = 1; + #if CYTHON_UNPACK_METHODS + if (unlikely(PyMethod_Check(__pyx_t_12))) { + __pyx_t_5 = PyMethod_GET_SELF(__pyx_t_12); + assert(__pyx_t_5); + PyObject* __pyx__function = PyMethod_GET_FUNCTION(__pyx_t_12); + __Pyx_INCREF(__pyx_t_5); + __Pyx_INCREF(__pyx__function); + __Pyx_DECREF_SET(__pyx_t_12, __pyx__function); + __pyx_t_11 = 0; + } + #endif + { + PyObject *__pyx_callargs[2 + ((CYTHON_VECTORCALL) ? 1 : 0)] = {__pyx_t_5, __pyx_v_p_indices}; + __pyx_t_6 = __Pyx_MakeVectorcallBuilderKwds(1); if (unlikely(!__pyx_t_6)) __PYX_ERR(0, 247, __pyx_L1_error) + __Pyx_GOTREF(__pyx_t_6); + if (__Pyx_VectorcallBuilder_AddArg(__pyx_mstate_global->__pyx_n_u_dtype, __pyx_mstate_global->__pyx_n_u_i, __pyx_t_6, __pyx_callargs+2, 0) < (0)) __PYX_ERR(0, 247, __pyx_L1_error) + __pyx_t_1 = __Pyx_Object_Vectorcall_CallFromBuilder((PyObject*)__pyx_t_12, __pyx_callargs+__pyx_t_11, (2-__pyx_t_11) | (__pyx_t_11*__Pyx_PY_VECTORCALL_ARGUMENTS_OFFSET), __pyx_t_6); + __Pyx_XDECREF(__pyx_t_5); __pyx_t_5 = 0; + __Pyx_DECREF(__pyx_t_6); __pyx_t_6 = 0; + __Pyx_DECREF(__pyx_t_12); __pyx_t_12 = 0; + if (unlikely(!__pyx_t_1)) __PYX_ERR(0, 247, __pyx_L1_error) + __Pyx_GOTREF(__pyx_t_1); + } + __Pyx_DECREF_SET(__pyx_v_p_indices, __pyx_t_1); + __pyx_t_1 = 0; + + /* "spacy/pipeline/_parser_internals/_beam_utils.pyx":248 + * states.append(state) + * p_indices = numpy.asarray(p_indices, dtype='i') + * g_indices = numpy.asarray(g_indices, dtype='i') # <<<<<<<<<<<<<< + * return states, p_indices, g_indices, beam_map + * +*/ + __pyx_t_12 = NULL; + __Pyx_GetModuleGlobalName(__pyx_t_6, __pyx_mstate_global->__pyx_n_u_numpy); if (unlikely(!__pyx_t_6)) __PYX_ERR(0, 248, __pyx_L1_error) + __Pyx_GOTREF(__pyx_t_6); + __pyx_t_5 = __Pyx_PyObject_GetAttrStr(__pyx_t_6, __pyx_mstate_global->__pyx_n_u_asarray); if (unlikely(!__pyx_t_5)) __PYX_ERR(0, 248, __pyx_L1_error) + __Pyx_GOTREF(__pyx_t_5); + __Pyx_DECREF(__pyx_t_6); __pyx_t_6 = 0; + __pyx_t_11 = 1; + #if CYTHON_UNPACK_METHODS + if (unlikely(PyMethod_Check(__pyx_t_5))) { + __pyx_t_12 = PyMethod_GET_SELF(__pyx_t_5); + assert(__pyx_t_12); + PyObject* __pyx__function = PyMethod_GET_FUNCTION(__pyx_t_5); + __Pyx_INCREF(__pyx_t_12); + __Pyx_INCREF(__pyx__function); + __Pyx_DECREF_SET(__pyx_t_5, __pyx__function); + __pyx_t_11 = 0; + } + #endif + { + PyObject *__pyx_callargs[2 + ((CYTHON_VECTORCALL) ? 1 : 0)] = {__pyx_t_12, __pyx_v_g_indices}; + __pyx_t_6 = __Pyx_MakeVectorcallBuilderKwds(1); if (unlikely(!__pyx_t_6)) __PYX_ERR(0, 248, __pyx_L1_error) + __Pyx_GOTREF(__pyx_t_6); + if (__Pyx_VectorcallBuilder_AddArg(__pyx_mstate_global->__pyx_n_u_dtype, __pyx_mstate_global->__pyx_n_u_i, __pyx_t_6, __pyx_callargs+2, 0) < (0)) __PYX_ERR(0, 248, __pyx_L1_error) + __pyx_t_1 = __Pyx_Object_Vectorcall_CallFromBuilder((PyObject*)__pyx_t_5, __pyx_callargs+__pyx_t_11, (2-__pyx_t_11) | (__pyx_t_11*__Pyx_PY_VECTORCALL_ARGUMENTS_OFFSET), __pyx_t_6); + __Pyx_XDECREF(__pyx_t_12); __pyx_t_12 = 0; + __Pyx_DECREF(__pyx_t_6); __pyx_t_6 = 0; + __Pyx_DECREF(__pyx_t_5); __pyx_t_5 = 0; + if (unlikely(!__pyx_t_1)) __PYX_ERR(0, 248, __pyx_L1_error) + __Pyx_GOTREF(__pyx_t_1); + } + __Pyx_DECREF_SET(__pyx_v_g_indices, __pyx_t_1); + __pyx_t_1 = 0; + + /* "spacy/pipeline/_parser_internals/_beam_utils.pyx":249 + * p_indices = numpy.asarray(p_indices, dtype='i') + * g_indices = numpy.asarray(g_indices, dtype='i') + * return states, p_indices, g_indices, beam_map # <<<<<<<<<<<<<< + * + * +*/ + __Pyx_XDECREF(__pyx_r); + __pyx_t_1 = PyTuple_New(4); if (unlikely(!__pyx_t_1)) __PYX_ERR(0, 249, __pyx_L1_error) + __Pyx_GOTREF(__pyx_t_1); + __Pyx_INCREF(__pyx_v_states); + __Pyx_GIVEREF(__pyx_v_states); + if (__Pyx_PyTuple_SET_ITEM(__pyx_t_1, 0, __pyx_v_states) != (0)) __PYX_ERR(0, 249, __pyx_L1_error); + __Pyx_INCREF(__pyx_v_p_indices); + __Pyx_GIVEREF(__pyx_v_p_indices); + if (__Pyx_PyTuple_SET_ITEM(__pyx_t_1, 1, __pyx_v_p_indices) != (0)) __PYX_ERR(0, 249, __pyx_L1_error); + __Pyx_INCREF(__pyx_v_g_indices); + __Pyx_GIVEREF(__pyx_v_g_indices); + if (__Pyx_PyTuple_SET_ITEM(__pyx_t_1, 2, __pyx_v_g_indices) != (0)) __PYX_ERR(0, 249, __pyx_L1_error); + __Pyx_INCREF(__pyx_v_beam_map); + __Pyx_GIVEREF(__pyx_v_beam_map); + if (__Pyx_PyTuple_SET_ITEM(__pyx_t_1, 3, __pyx_v_beam_map) != (0)) __PYX_ERR(0, 249, __pyx_L1_error); + __pyx_r = __pyx_t_1; + __pyx_t_1 = 0; + goto __pyx_L0; + + /* "spacy/pipeline/_parser_internals/_beam_utils.pyx":214 + * + * + * def get_unique_states(pbeams, gbeams): # <<<<<<<<<<<<<< + * seen = {} + * states = [] +*/ + + /* function exit code */ + __pyx_L1_error:; + __Pyx_XDECREF(__pyx_t_1); + __Pyx_XDECREF(__pyx_t_5); + __Pyx_XDECREF(__pyx_t_6); + __Pyx_XDECREF(__pyx_t_7); + __Pyx_XDECREF(__pyx_t_8); + __Pyx_XDECREF(__pyx_t_9); + __Pyx_XDECREF(__pyx_t_10); + __Pyx_XDECREF(__pyx_t_12); + __Pyx_AddTraceback("spacy.pipeline._parser_internals._beam_utils.get_unique_states", __pyx_clineno, __pyx_lineno, __pyx_filename); + __pyx_r = NULL; + __pyx_L0:; + __Pyx_XDECREF(__pyx_v_seen); + __Pyx_XDECREF(__pyx_v_states); + __Pyx_XDECREF(__pyx_v_p_indices); + __Pyx_XDECREF(__pyx_v_g_indices); + __Pyx_XDECREF(__pyx_v_beam_map); + __Pyx_XDECREF(__pyx_v_docs); + __Pyx_XDECREF((PyObject *)__pyx_v_pbeam); + __Pyx_XDECREF((PyObject *)__pyx_v_gbeam); + __Pyx_XDECREF(__pyx_v_eg_id); + __Pyx_XDECREF(__pyx_v_doc); + __Pyx_XDECREF((PyObject *)__pyx_v_state); + __Pyx_XDECREF(__pyx_v_key); + __Pyx_XGIVEREF(__pyx_r); + __Pyx_RefNannyFinishContext(); + return __pyx_r; +} + +/* "spacy/pipeline/_parser_internals/_beam_utils.pyx":252 + * + * + * def get_gradient(nr_class, beam_maps, histories, losses): # <<<<<<<<<<<<<< + * """The global model assigns a loss to each parse. The beam scores + * are additive, so the same gradient is applied to each action +*/ + +/* Python wrapper */ +static PyObject *__pyx_pw_5spacy_8pipeline_17_parser_internals_11_beam_utils_7get_gradient(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_5spacy_8pipeline_17_parser_internals_11_beam_utils_6get_gradient, "get_gradient(nr_class, beam_maps, histories, losses)\n\nThe global model assigns a loss to each parse. The beam scores\nare additive, so the same gradient is applied to each action\nin the history. This gives the gradient of a single *action*\nfor a beam state -- so we have \"the gradient of loss for taking\naction i given history H.\"\n\nHistories: Each history is a list of actions\nEach candidate has a history\nEach beam has multiple candidates\nEach batch has multiple beams\nSo history is list of lists of lists of ints"); +static PyMethodDef __pyx_mdef_5spacy_8pipeline_17_parser_internals_11_beam_utils_7get_gradient = {"get_gradient", (PyCFunction)(void(*)(void))(__Pyx_PyCFunction_FastCallWithKeywords)__pyx_pw_5spacy_8pipeline_17_parser_internals_11_beam_utils_7get_gradient, __Pyx_METH_FASTCALL|METH_KEYWORDS, __pyx_doc_5spacy_8pipeline_17_parser_internals_11_beam_utils_6get_gradient}; +static PyObject *__pyx_pw_5spacy_8pipeline_17_parser_internals_11_beam_utils_7get_gradient(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 +) { + PyObject *__pyx_v_nr_class = 0; + PyObject *__pyx_v_beam_maps = 0; + PyObject *__pyx_v_histories = 0; + PyObject *__pyx_v_losses = 0; + #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("get_gradient (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_nr_class,&__pyx_mstate_global->__pyx_n_u_beam_maps,&__pyx_mstate_global->__pyx_n_u_histories,&__pyx_mstate_global->__pyx_n_u_losses,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, 252, __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, 252, __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, 252, __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, 252, __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, 252, __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, "get_gradient", 0) < (0)) __PYX_ERR(0, 252, __pyx_L3_error) + for (Py_ssize_t i = __pyx_nargs; i < 4; i++) { + if (unlikely(!values[i])) { __Pyx_RaiseArgtupleInvalid("get_gradient", 1, 4, 4, i); __PYX_ERR(0, 252, __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, 252, __pyx_L3_error) + values[1] = __Pyx_ArgRef_FASTCALL(__pyx_args, 1); + if (!CYTHON_ASSUME_SAFE_MACROS && unlikely(!values[1])) __PYX_ERR(0, 252, __pyx_L3_error) + values[2] = __Pyx_ArgRef_FASTCALL(__pyx_args, 2); + if (!CYTHON_ASSUME_SAFE_MACROS && unlikely(!values[2])) __PYX_ERR(0, 252, __pyx_L3_error) + values[3] = __Pyx_ArgRef_FASTCALL(__pyx_args, 3); + if (!CYTHON_ASSUME_SAFE_MACROS && unlikely(!values[3])) __PYX_ERR(0, 252, __pyx_L3_error) + } + __pyx_v_nr_class = values[0]; + __pyx_v_beam_maps = values[1]; + __pyx_v_histories = values[2]; + __pyx_v_losses = values[3]; + } + goto __pyx_L6_skip; + __pyx_L5_argtuple_error:; + __Pyx_RaiseArgtupleInvalid("get_gradient", 1, 4, 4, __pyx_nargs); __PYX_ERR(0, 252, __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("spacy.pipeline._parser_internals._beam_utils.get_gradient", __pyx_clineno, __pyx_lineno, __pyx_filename); + __Pyx_RefNannyFinishContext(); + return NULL; + __pyx_L4_argument_unpacking_done:; + __pyx_r = __pyx_pf_5spacy_8pipeline_17_parser_internals_11_beam_utils_6get_gradient(__pyx_self, __pyx_v_nr_class, __pyx_v_beam_maps, __pyx_v_histories, __pyx_v_losses); + + /* 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_5spacy_8pipeline_17_parser_internals_11_beam_utils_6get_gradient(CYTHON_UNUSED PyObject *__pyx_self, PyObject *__pyx_v_nr_class, PyObject *__pyx_v_beam_maps, PyObject *__pyx_v_histories, PyObject *__pyx_v_losses) { + PyObject *__pyx_v_grads = NULL; + PyObject *__pyx_v_nr_steps = NULL; + PyObject *__pyx_v_eg_id = NULL; + PyObject *__pyx_v_hists = NULL; + Py_ssize_t __pyx_v_nr_step; + PyObject *__pyx_v_loss = NULL; + PyObject *__pyx_v_hist = NULL; + PyObject *__pyx_v_i = NULL; + PyObject *__pyx_v_key = NULL; + PyObject *__pyx_v_avg_loss = NULL; + PyObject *__pyx_v_step = NULL; + PyObject *__pyx_v_clas = NULL; + PyObject *__pyx_r = NULL; + __Pyx_RefNannyDeclarations + PyObject *__pyx_t_1 = NULL; + PyObject *__pyx_t_2 = NULL; + Py_ssize_t __pyx_t_3; + PyObject *(*__pyx_t_4)(PyObject *); + PyObject *__pyx_t_5 = NULL; + PyObject *__pyx_t_6 = NULL; + PyObject *__pyx_t_7 = NULL; + size_t __pyx_t_8; + Py_ssize_t __pyx_t_9; + PyObject *(*__pyx_t_10)(PyObject *); + PyObject *__pyx_t_11 = NULL; + PyObject *__pyx_t_12 = NULL; + PyObject *(*__pyx_t_13)(PyObject *); + int __pyx_t_14; + int __pyx_t_15; + Py_ssize_t __pyx_t_16; + Py_ssize_t __pyx_t_17; + Py_ssize_t __pyx_t_18; + int __pyx_t_19; + PyObject *__pyx_t_20 = NULL; + PyObject *__pyx_t_21 = NULL; + PyObject *(*__pyx_t_22)(PyObject *); + int __pyx_lineno = 0; + const char *__pyx_filename = NULL; + int __pyx_clineno = 0; + __Pyx_RefNannySetupContext("get_gradient", 0); + + /* "spacy/pipeline/_parser_internals/_beam_utils.pyx":265 + * So history is list of lists of lists of ints + * """ + * grads = [] # <<<<<<<<<<<<<< + * nr_steps = [] + * for eg_id, hists in enumerate(histories): +*/ + __pyx_t_1 = PyList_New(0); if (unlikely(!__pyx_t_1)) __PYX_ERR(0, 265, __pyx_L1_error) + __Pyx_GOTREF(__pyx_t_1); + __pyx_v_grads = ((PyObject*)__pyx_t_1); + __pyx_t_1 = 0; + + /* "spacy/pipeline/_parser_internals/_beam_utils.pyx":266 + * """ + * grads = [] + * nr_steps = [] # <<<<<<<<<<<<<< + * for eg_id, hists in enumerate(histories): + * nr_step = 0 +*/ + __pyx_t_1 = PyList_New(0); if (unlikely(!__pyx_t_1)) __PYX_ERR(0, 266, __pyx_L1_error) + __Pyx_GOTREF(__pyx_t_1); + __pyx_v_nr_steps = ((PyObject*)__pyx_t_1); + __pyx_t_1 = 0; + + /* "spacy/pipeline/_parser_internals/_beam_utils.pyx":267 + * grads = [] + * nr_steps = [] + * for eg_id, hists in enumerate(histories): # <<<<<<<<<<<<<< + * nr_step = 0 + * for loss, hist in zip(losses[eg_id], hists): +*/ + __Pyx_INCREF(__pyx_mstate_global->__pyx_int_0); + __pyx_t_1 = __pyx_mstate_global->__pyx_int_0; + if (likely(PyList_CheckExact(__pyx_v_histories)) || PyTuple_CheckExact(__pyx_v_histories)) { + __pyx_t_2 = __pyx_v_histories; __Pyx_INCREF(__pyx_t_2); + __pyx_t_3 = 0; + __pyx_t_4 = NULL; + } else { + __pyx_t_3 = -1; __pyx_t_2 = PyObject_GetIter(__pyx_v_histories); if (unlikely(!__pyx_t_2)) __PYX_ERR(0, 267, __pyx_L1_error) + __Pyx_GOTREF(__pyx_t_2); + __pyx_t_4 = (CYTHON_COMPILING_IN_LIMITED_API) ? PyIter_Next : __Pyx_PyObject_GetIterNextFunc(__pyx_t_2); if (unlikely(!__pyx_t_4)) __PYX_ERR(0, 267, __pyx_L1_error) + } + for (;;) { + if (likely(!__pyx_t_4)) { + if (likely(PyList_CheckExact(__pyx_t_2))) { + { + Py_ssize_t __pyx_temp = __Pyx_PyList_GET_SIZE(__pyx_t_2); + #if !CYTHON_ASSUME_SAFE_SIZE + if (unlikely((__pyx_temp < 0))) __PYX_ERR(0, 267, __pyx_L1_error) + #endif + if (__pyx_t_3 >= __pyx_temp) break; + } + __pyx_t_5 = __Pyx_PyList_GetItemRefFast(__pyx_t_2, __pyx_t_3, __Pyx_ReferenceSharing_OwnStrongReference); + ++__pyx_t_3; + } else { + { + Py_ssize_t __pyx_temp = __Pyx_PyTuple_GET_SIZE(__pyx_t_2); + #if !CYTHON_ASSUME_SAFE_SIZE + if (unlikely((__pyx_temp < 0))) __PYX_ERR(0, 267, __pyx_L1_error) + #endif + if (__pyx_t_3 >= __pyx_temp) break; + } + #if CYTHON_ASSUME_SAFE_MACROS && !CYTHON_AVOID_BORROWED_REFS + __pyx_t_5 = __Pyx_NewRef(PyTuple_GET_ITEM(__pyx_t_2, __pyx_t_3)); + #else + __pyx_t_5 = __Pyx_PySequence_ITEM(__pyx_t_2, __pyx_t_3); + #endif + ++__pyx_t_3; + } + if (unlikely(!__pyx_t_5)) __PYX_ERR(0, 267, __pyx_L1_error) + } else { + __pyx_t_5 = __pyx_t_4(__pyx_t_2); + if (unlikely(!__pyx_t_5)) { + PyObject* exc_type = PyErr_Occurred(); + if (exc_type) { + if (unlikely(!__Pyx_PyErr_GivenExceptionMatches(exc_type, PyExc_StopIteration))) __PYX_ERR(0, 267, __pyx_L1_error) + PyErr_Clear(); + } + break; + } + } + __Pyx_GOTREF(__pyx_t_5); + __Pyx_XDECREF_SET(__pyx_v_hists, __pyx_t_5); + __pyx_t_5 = 0; + __Pyx_INCREF(__pyx_t_1); + __Pyx_XDECREF_SET(__pyx_v_eg_id, __pyx_t_1); + __pyx_t_5 = __Pyx_PyLong_AddObjC(__pyx_t_1, __pyx_mstate_global->__pyx_int_1, 1, 0, 0); if (unlikely(!__pyx_t_5)) __PYX_ERR(0, 267, __pyx_L1_error) + __Pyx_GOTREF(__pyx_t_5); + __Pyx_DECREF(__pyx_t_1); + __pyx_t_1 = __pyx_t_5; + __pyx_t_5 = 0; + + /* "spacy/pipeline/_parser_internals/_beam_utils.pyx":268 + * nr_steps = [] + * for eg_id, hists in enumerate(histories): + * nr_step = 0 # <<<<<<<<<<<<<< + * for loss, hist in zip(losses[eg_id], hists): + * assert not numpy.isnan(loss) +*/ + __pyx_v_nr_step = 0; + + /* "spacy/pipeline/_parser_internals/_beam_utils.pyx":269 + * for eg_id, hists in enumerate(histories): + * nr_step = 0 + * for loss, hist in zip(losses[eg_id], hists): # <<<<<<<<<<<<<< + * assert not numpy.isnan(loss) + * if loss != 0.0: +*/ + __pyx_t_6 = NULL; + __pyx_t_7 = __Pyx_PyObject_GetItem(__pyx_v_losses, __pyx_v_eg_id); if (unlikely(!__pyx_t_7)) __PYX_ERR(0, 269, __pyx_L1_error) + __Pyx_GOTREF(__pyx_t_7); + __pyx_t_8 = 1; + { + PyObject *__pyx_callargs[3] = {__pyx_t_6, __pyx_t_7, __pyx_v_hists}; + __pyx_t_5 = __Pyx_PyObject_FastCall((PyObject*)__pyx_builtin_zip, __pyx_callargs+__pyx_t_8, (3-__pyx_t_8) | (__pyx_t_8*__Pyx_PY_VECTORCALL_ARGUMENTS_OFFSET)); + __Pyx_XDECREF(__pyx_t_6); __pyx_t_6 = 0; + __Pyx_DECREF(__pyx_t_7); __pyx_t_7 = 0; + if (unlikely(!__pyx_t_5)) __PYX_ERR(0, 269, __pyx_L1_error) + __Pyx_GOTREF(__pyx_t_5); + } + if (likely(PyList_CheckExact(__pyx_t_5)) || PyTuple_CheckExact(__pyx_t_5)) { + __pyx_t_7 = __pyx_t_5; __Pyx_INCREF(__pyx_t_7); + __pyx_t_9 = 0; + __pyx_t_10 = NULL; + } else { + __pyx_t_9 = -1; __pyx_t_7 = PyObject_GetIter(__pyx_t_5); if (unlikely(!__pyx_t_7)) __PYX_ERR(0, 269, __pyx_L1_error) + __Pyx_GOTREF(__pyx_t_7); + __pyx_t_10 = (CYTHON_COMPILING_IN_LIMITED_API) ? PyIter_Next : __Pyx_PyObject_GetIterNextFunc(__pyx_t_7); if (unlikely(!__pyx_t_10)) __PYX_ERR(0, 269, __pyx_L1_error) + } + __Pyx_DECREF(__pyx_t_5); __pyx_t_5 = 0; + for (;;) { + if (likely(!__pyx_t_10)) { + if (likely(PyList_CheckExact(__pyx_t_7))) { + { + Py_ssize_t __pyx_temp = __Pyx_PyList_GET_SIZE(__pyx_t_7); + #if !CYTHON_ASSUME_SAFE_SIZE + if (unlikely((__pyx_temp < 0))) __PYX_ERR(0, 269, __pyx_L1_error) + #endif + if (__pyx_t_9 >= __pyx_temp) break; + } + __pyx_t_5 = __Pyx_PyList_GetItemRefFast(__pyx_t_7, __pyx_t_9, __Pyx_ReferenceSharing_OwnStrongReference); + ++__pyx_t_9; + } else { + { + Py_ssize_t __pyx_temp = __Pyx_PyTuple_GET_SIZE(__pyx_t_7); + #if !CYTHON_ASSUME_SAFE_SIZE + if (unlikely((__pyx_temp < 0))) __PYX_ERR(0, 269, __pyx_L1_error) + #endif + if (__pyx_t_9 >= __pyx_temp) break; + } + #if CYTHON_ASSUME_SAFE_MACROS && !CYTHON_AVOID_BORROWED_REFS + __pyx_t_5 = __Pyx_NewRef(PyTuple_GET_ITEM(__pyx_t_7, __pyx_t_9)); + #else + __pyx_t_5 = __Pyx_PySequence_ITEM(__pyx_t_7, __pyx_t_9); + #endif + ++__pyx_t_9; + } + if (unlikely(!__pyx_t_5)) __PYX_ERR(0, 269, __pyx_L1_error) + } else { + __pyx_t_5 = __pyx_t_10(__pyx_t_7); + if (unlikely(!__pyx_t_5)) { + PyObject* exc_type = PyErr_Occurred(); + if (exc_type) { + if (unlikely(!__Pyx_PyErr_GivenExceptionMatches(exc_type, PyExc_StopIteration))) __PYX_ERR(0, 269, __pyx_L1_error) + PyErr_Clear(); + } + break; + } + } + __Pyx_GOTREF(__pyx_t_5); + if ((likely(PyTuple_CheckExact(__pyx_t_5))) || (PyList_CheckExact(__pyx_t_5))) { + PyObject* sequence = __pyx_t_5; + 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, 269, __pyx_L1_error) + } + #if CYTHON_ASSUME_SAFE_MACROS && !CYTHON_AVOID_BORROWED_REFS + if (likely(PyTuple_CheckExact(sequence))) { + __pyx_t_6 = PyTuple_GET_ITEM(sequence, 0); + __Pyx_INCREF(__pyx_t_6); + __pyx_t_11 = PyTuple_GET_ITEM(sequence, 1); + __Pyx_INCREF(__pyx_t_11); + } else { + __pyx_t_6 = __Pyx_PyList_GetItemRefFast(sequence, 0, __Pyx_ReferenceSharing_SharedReference); + if (unlikely(!__pyx_t_6)) __PYX_ERR(0, 269, __pyx_L1_error) + __Pyx_XGOTREF(__pyx_t_6); + __pyx_t_11 = __Pyx_PyList_GetItemRefFast(sequence, 1, __Pyx_ReferenceSharing_SharedReference); + if (unlikely(!__pyx_t_11)) __PYX_ERR(0, 269, __pyx_L1_error) + __Pyx_XGOTREF(__pyx_t_11); + } + #else + __pyx_t_6 = __Pyx_PySequence_ITEM(sequence, 0); if (unlikely(!__pyx_t_6)) __PYX_ERR(0, 269, __pyx_L1_error) + __Pyx_GOTREF(__pyx_t_6); + __pyx_t_11 = __Pyx_PySequence_ITEM(sequence, 1); if (unlikely(!__pyx_t_11)) __PYX_ERR(0, 269, __pyx_L1_error) + __Pyx_GOTREF(__pyx_t_11); + #endif + __Pyx_DECREF(__pyx_t_5); __pyx_t_5 = 0; + } else { + Py_ssize_t index = -1; + __pyx_t_12 = PyObject_GetIter(__pyx_t_5); if (unlikely(!__pyx_t_12)) __PYX_ERR(0, 269, __pyx_L1_error) + __Pyx_GOTREF(__pyx_t_12); + __Pyx_DECREF(__pyx_t_5); __pyx_t_5 = 0; + __pyx_t_13 = (CYTHON_COMPILING_IN_LIMITED_API) ? PyIter_Next : __Pyx_PyObject_GetIterNextFunc(__pyx_t_12); + index = 0; __pyx_t_6 = __pyx_t_13(__pyx_t_12); if (unlikely(!__pyx_t_6)) goto __pyx_L7_unpacking_failed; + __Pyx_GOTREF(__pyx_t_6); + index = 1; __pyx_t_11 = __pyx_t_13(__pyx_t_12); if (unlikely(!__pyx_t_11)) goto __pyx_L7_unpacking_failed; + __Pyx_GOTREF(__pyx_t_11); + if (__Pyx_IternextUnpackEndCheck(__pyx_t_13(__pyx_t_12), 2) < (0)) __PYX_ERR(0, 269, __pyx_L1_error) + __pyx_t_13 = NULL; + __Pyx_DECREF(__pyx_t_12); __pyx_t_12 = 0; + goto __pyx_L8_unpacking_done; + __pyx_L7_unpacking_failed:; + __Pyx_DECREF(__pyx_t_12); __pyx_t_12 = 0; + __pyx_t_13 = NULL; + if (__Pyx_IterFinish() == 0) __Pyx_RaiseNeedMoreValuesError(index); + __PYX_ERR(0, 269, __pyx_L1_error) + __pyx_L8_unpacking_done:; + } + __Pyx_XDECREF_SET(__pyx_v_loss, __pyx_t_6); + __pyx_t_6 = 0; + __Pyx_XDECREF_SET(__pyx_v_hist, __pyx_t_11); + __pyx_t_11 = 0; + + /* "spacy/pipeline/_parser_internals/_beam_utils.pyx":270 + * nr_step = 0 + * for loss, hist in zip(losses[eg_id], hists): + * assert not numpy.isnan(loss) # <<<<<<<<<<<<<< + * if loss != 0.0: + * nr_step = max(nr_step, len(hist)) +*/ + #ifndef CYTHON_WITHOUT_ASSERTIONS + if (unlikely(__pyx_assertions_enabled())) { + __pyx_t_11 = NULL; + __Pyx_GetModuleGlobalName(__pyx_t_6, __pyx_mstate_global->__pyx_n_u_numpy); if (unlikely(!__pyx_t_6)) __PYX_ERR(0, 270, __pyx_L1_error) + __Pyx_GOTREF(__pyx_t_6); + __pyx_t_12 = __Pyx_PyObject_GetAttrStr(__pyx_t_6, __pyx_mstate_global->__pyx_n_u_isnan); if (unlikely(!__pyx_t_12)) __PYX_ERR(0, 270, __pyx_L1_error) + __Pyx_GOTREF(__pyx_t_12); + __Pyx_DECREF(__pyx_t_6); __pyx_t_6 = 0; + __pyx_t_8 = 1; + #if CYTHON_UNPACK_METHODS + if (unlikely(PyMethod_Check(__pyx_t_12))) { + __pyx_t_11 = PyMethod_GET_SELF(__pyx_t_12); + assert(__pyx_t_11); + PyObject* __pyx__function = PyMethod_GET_FUNCTION(__pyx_t_12); + __Pyx_INCREF(__pyx_t_11); + __Pyx_INCREF(__pyx__function); + __Pyx_DECREF_SET(__pyx_t_12, __pyx__function); + __pyx_t_8 = 0; + } + #endif + { + PyObject *__pyx_callargs[2] = {__pyx_t_11, __pyx_v_loss}; + __pyx_t_5 = __Pyx_PyObject_FastCall((PyObject*)__pyx_t_12, __pyx_callargs+__pyx_t_8, (2-__pyx_t_8) | (__pyx_t_8*__Pyx_PY_VECTORCALL_ARGUMENTS_OFFSET)); + __Pyx_XDECREF(__pyx_t_11); __pyx_t_11 = 0; + __Pyx_DECREF(__pyx_t_12); __pyx_t_12 = 0; + if (unlikely(!__pyx_t_5)) __PYX_ERR(0, 270, __pyx_L1_error) + __Pyx_GOTREF(__pyx_t_5); + } + __pyx_t_14 = __Pyx_PyObject_IsTrue(__pyx_t_5); if (unlikely((__pyx_t_14 < 0))) __PYX_ERR(0, 270, __pyx_L1_error) + __Pyx_DECREF(__pyx_t_5); __pyx_t_5 = 0; + __pyx_t_15 = (!__pyx_t_14); + if (unlikely(!__pyx_t_15)) { + __Pyx_Raise(((PyObject *)(((PyTypeObject*)PyExc_AssertionError))), 0, 0, 0); + __PYX_ERR(0, 270, __pyx_L1_error) + } + } + #else + if ((1)); else __PYX_ERR(0, 270, __pyx_L1_error) + #endif + + /* "spacy/pipeline/_parser_internals/_beam_utils.pyx":271 + * for loss, hist in zip(losses[eg_id], hists): + * assert not numpy.isnan(loss) + * if loss != 0.0: # <<<<<<<<<<<<<< + * nr_step = max(nr_step, len(hist)) + * nr_steps.append(nr_step) +*/ + __pyx_t_15 = (__Pyx_PyFloat_BoolNeObjC(__pyx_v_loss, __pyx_mstate_global->__pyx_float_0_0, 0.0, 0, 0)); if (unlikely((__pyx_t_15 < 0))) __PYX_ERR(0, 271, __pyx_L1_error) + if (__pyx_t_15) { + + /* "spacy/pipeline/_parser_internals/_beam_utils.pyx":272 + * assert not numpy.isnan(loss) + * if loss != 0.0: + * nr_step = max(nr_step, len(hist)) # <<<<<<<<<<<<<< + * nr_steps.append(nr_step) + * for i in range(max(nr_steps)): +*/ + __pyx_t_16 = PyObject_Length(__pyx_v_hist); if (unlikely(__pyx_t_16 == ((Py_ssize_t)-1))) __PYX_ERR(0, 272, __pyx_L1_error) + __pyx_t_17 = __pyx_v_nr_step; + __pyx_t_15 = (__pyx_t_16 > __pyx_t_17); + if (__pyx_t_15) { + __pyx_t_18 = __pyx_t_16; + } else { + __pyx_t_18 = __pyx_t_17; + } + __pyx_v_nr_step = __pyx_t_18; + + /* "spacy/pipeline/_parser_internals/_beam_utils.pyx":271 + * for loss, hist in zip(losses[eg_id], hists): + * assert not numpy.isnan(loss) + * if loss != 0.0: # <<<<<<<<<<<<<< + * nr_step = max(nr_step, len(hist)) + * nr_steps.append(nr_step) +*/ + } + + /* "spacy/pipeline/_parser_internals/_beam_utils.pyx":269 + * for eg_id, hists in enumerate(histories): + * nr_step = 0 + * for loss, hist in zip(losses[eg_id], hists): # <<<<<<<<<<<<<< + * assert not numpy.isnan(loss) + * if loss != 0.0: +*/ + } + __Pyx_DECREF(__pyx_t_7); __pyx_t_7 = 0; + + /* "spacy/pipeline/_parser_internals/_beam_utils.pyx":273 + * if loss != 0.0: + * nr_step = max(nr_step, len(hist)) + * nr_steps.append(nr_step) # <<<<<<<<<<<<<< + * for i in range(max(nr_steps)): + * grads.append(numpy.zeros((max(beam_maps[i].values())+1, nr_class), +*/ + __pyx_t_7 = PyLong_FromSsize_t(__pyx_v_nr_step); if (unlikely(!__pyx_t_7)) __PYX_ERR(0, 273, __pyx_L1_error) + __Pyx_GOTREF(__pyx_t_7); + __pyx_t_19 = __Pyx_PyList_Append(__pyx_v_nr_steps, __pyx_t_7); if (unlikely(__pyx_t_19 == ((int)-1))) __PYX_ERR(0, 273, __pyx_L1_error) + __Pyx_DECREF(__pyx_t_7); __pyx_t_7 = 0; + + /* "spacy/pipeline/_parser_internals/_beam_utils.pyx":267 + * grads = [] + * nr_steps = [] + * for eg_id, hists in enumerate(histories): # <<<<<<<<<<<<<< + * nr_step = 0 + * for loss, hist in zip(losses[eg_id], hists): +*/ + } + __Pyx_DECREF(__pyx_t_2); __pyx_t_2 = 0; + __Pyx_DECREF(__pyx_t_1); __pyx_t_1 = 0; + + /* "spacy/pipeline/_parser_internals/_beam_utils.pyx":274 + * nr_step = max(nr_step, len(hist)) + * nr_steps.append(nr_step) + * for i in range(max(nr_steps)): # <<<<<<<<<<<<<< + * grads.append(numpy.zeros((max(beam_maps[i].values())+1, nr_class), + * dtype='f')) +*/ + __pyx_t_2 = NULL; + __pyx_t_5 = NULL; + __pyx_t_8 = 1; + { + PyObject *__pyx_callargs[2] = {__pyx_t_5, __pyx_v_nr_steps}; + __pyx_t_7 = __Pyx_PyObject_FastCall((PyObject*)__pyx_builtin_max, __pyx_callargs+__pyx_t_8, (2-__pyx_t_8) | (__pyx_t_8*__Pyx_PY_VECTORCALL_ARGUMENTS_OFFSET)); + __Pyx_XDECREF(__pyx_t_5); __pyx_t_5 = 0; + if (unlikely(!__pyx_t_7)) __PYX_ERR(0, 274, __pyx_L1_error) + __Pyx_GOTREF(__pyx_t_7); + } + __pyx_t_8 = 1; + { + PyObject *__pyx_callargs[2] = {__pyx_t_2, __pyx_t_7}; + __pyx_t_1 = __Pyx_PyObject_FastCall((PyObject*)(&PyRange_Type), __pyx_callargs+__pyx_t_8, (2-__pyx_t_8) | (__pyx_t_8*__Pyx_PY_VECTORCALL_ARGUMENTS_OFFSET)); + __Pyx_XDECREF(__pyx_t_2); __pyx_t_2 = 0; + __Pyx_DECREF(__pyx_t_7); __pyx_t_7 = 0; + if (unlikely(!__pyx_t_1)) __PYX_ERR(0, 274, __pyx_L1_error) + __Pyx_GOTREF(__pyx_t_1); + } + __pyx_t_7 = PyObject_GetIter(__pyx_t_1); if (unlikely(!__pyx_t_7)) __PYX_ERR(0, 274, __pyx_L1_error) + __Pyx_GOTREF(__pyx_t_7); + __pyx_t_4 = (CYTHON_COMPILING_IN_LIMITED_API) ? PyIter_Next : __Pyx_PyObject_GetIterNextFunc(__pyx_t_7); if (unlikely(!__pyx_t_4)) __PYX_ERR(0, 274, __pyx_L1_error) + __Pyx_DECREF(__pyx_t_1); __pyx_t_1 = 0; + for (;;) { + { + __pyx_t_1 = __pyx_t_4(__pyx_t_7); + if (unlikely(!__pyx_t_1)) { + PyObject* exc_type = PyErr_Occurred(); + if (exc_type) { + if (unlikely(!__Pyx_PyErr_GivenExceptionMatches(exc_type, PyExc_StopIteration))) __PYX_ERR(0, 274, __pyx_L1_error) + PyErr_Clear(); + } + break; + } + } + __Pyx_GOTREF(__pyx_t_1); + __Pyx_XDECREF_SET(__pyx_v_i, __pyx_t_1); + __pyx_t_1 = 0; + + /* "spacy/pipeline/_parser_internals/_beam_utils.pyx":275 + * nr_steps.append(nr_step) + * for i in range(max(nr_steps)): + * grads.append(numpy.zeros((max(beam_maps[i].values())+1, nr_class), # <<<<<<<<<<<<<< + * dtype='f')) + * if len(histories) != len(losses): +*/ + __pyx_t_2 = NULL; + __Pyx_GetModuleGlobalName(__pyx_t_5, __pyx_mstate_global->__pyx_n_u_numpy); if (unlikely(!__pyx_t_5)) __PYX_ERR(0, 275, __pyx_L1_error) + __Pyx_GOTREF(__pyx_t_5); + __pyx_t_12 = __Pyx_PyObject_GetAttrStr(__pyx_t_5, __pyx_mstate_global->__pyx_n_u_zeros); if (unlikely(!__pyx_t_12)) __PYX_ERR(0, 275, __pyx_L1_error) + __Pyx_GOTREF(__pyx_t_12); + __Pyx_DECREF(__pyx_t_5); __pyx_t_5 = 0; + __pyx_t_11 = NULL; + __pyx_t_21 = __Pyx_PyObject_GetItem(__pyx_v_beam_maps, __pyx_v_i); if (unlikely(!__pyx_t_21)) __PYX_ERR(0, 275, __pyx_L1_error) + __Pyx_GOTREF(__pyx_t_21); + __pyx_t_20 = __pyx_t_21; + __Pyx_INCREF(__pyx_t_20); + __pyx_t_8 = 0; + { + PyObject *__pyx_callargs[2] = {__pyx_t_20, NULL}; + __pyx_t_6 = __Pyx_PyObject_FastCallMethod((PyObject*)__pyx_mstate_global->__pyx_n_u_values, __pyx_callargs+__pyx_t_8, (1-__pyx_t_8) | (1*__Pyx_PY_VECTORCALL_ARGUMENTS_OFFSET)); + __Pyx_XDECREF(__pyx_t_20); __pyx_t_20 = 0; + __Pyx_DECREF(__pyx_t_21); __pyx_t_21 = 0; + if (unlikely(!__pyx_t_6)) __PYX_ERR(0, 275, __pyx_L1_error) + __Pyx_GOTREF(__pyx_t_6); + } + __pyx_t_8 = 1; + { + PyObject *__pyx_callargs[2] = {__pyx_t_11, __pyx_t_6}; + __pyx_t_5 = __Pyx_PyObject_FastCall((PyObject*)__pyx_builtin_max, __pyx_callargs+__pyx_t_8, (2-__pyx_t_8) | (__pyx_t_8*__Pyx_PY_VECTORCALL_ARGUMENTS_OFFSET)); + __Pyx_XDECREF(__pyx_t_11); __pyx_t_11 = 0; + __Pyx_DECREF(__pyx_t_6); __pyx_t_6 = 0; + if (unlikely(!__pyx_t_5)) __PYX_ERR(0, 275, __pyx_L1_error) + __Pyx_GOTREF(__pyx_t_5); + } + __pyx_t_6 = __Pyx_PyLong_AddObjC(__pyx_t_5, __pyx_mstate_global->__pyx_int_1, 1, 0, 0); if (unlikely(!__pyx_t_6)) __PYX_ERR(0, 275, __pyx_L1_error) + __Pyx_GOTREF(__pyx_t_6); + __Pyx_DECREF(__pyx_t_5); __pyx_t_5 = 0; + __pyx_t_5 = PyTuple_New(2); if (unlikely(!__pyx_t_5)) __PYX_ERR(0, 275, __pyx_L1_error) + __Pyx_GOTREF(__pyx_t_5); + __Pyx_GIVEREF(__pyx_t_6); + if (__Pyx_PyTuple_SET_ITEM(__pyx_t_5, 0, __pyx_t_6) != (0)) __PYX_ERR(0, 275, __pyx_L1_error); + __Pyx_INCREF(__pyx_v_nr_class); + __Pyx_GIVEREF(__pyx_v_nr_class); + if (__Pyx_PyTuple_SET_ITEM(__pyx_t_5, 1, __pyx_v_nr_class) != (0)) __PYX_ERR(0, 275, __pyx_L1_error); + __pyx_t_6 = 0; + __pyx_t_8 = 1; + #if CYTHON_UNPACK_METHODS + if (unlikely(PyMethod_Check(__pyx_t_12))) { + __pyx_t_2 = PyMethod_GET_SELF(__pyx_t_12); + assert(__pyx_t_2); + PyObject* __pyx__function = PyMethod_GET_FUNCTION(__pyx_t_12); + __Pyx_INCREF(__pyx_t_2); + __Pyx_INCREF(__pyx__function); + __Pyx_DECREF_SET(__pyx_t_12, __pyx__function); + __pyx_t_8 = 0; + } + #endif + { + PyObject *__pyx_callargs[2 + ((CYTHON_VECTORCALL) ? 1 : 0)] = {__pyx_t_2, __pyx_t_5}; + __pyx_t_6 = __Pyx_MakeVectorcallBuilderKwds(1); if (unlikely(!__pyx_t_6)) __PYX_ERR(0, 275, __pyx_L1_error) + __Pyx_GOTREF(__pyx_t_6); + if (__Pyx_VectorcallBuilder_AddArg(__pyx_mstate_global->__pyx_n_u_dtype, __pyx_mstate_global->__pyx_n_u_f, __pyx_t_6, __pyx_callargs+2, 0) < (0)) __PYX_ERR(0, 275, __pyx_L1_error) + __pyx_t_1 = __Pyx_Object_Vectorcall_CallFromBuilder((PyObject*)__pyx_t_12, __pyx_callargs+__pyx_t_8, (2-__pyx_t_8) | (__pyx_t_8*__Pyx_PY_VECTORCALL_ARGUMENTS_OFFSET), __pyx_t_6); + __Pyx_XDECREF(__pyx_t_2); __pyx_t_2 = 0; + __Pyx_DECREF(__pyx_t_5); __pyx_t_5 = 0; + __Pyx_DECREF(__pyx_t_6); __pyx_t_6 = 0; + __Pyx_DECREF(__pyx_t_12); __pyx_t_12 = 0; + if (unlikely(!__pyx_t_1)) __PYX_ERR(0, 275, __pyx_L1_error) + __Pyx_GOTREF(__pyx_t_1); + } + __pyx_t_19 = __Pyx_PyList_Append(__pyx_v_grads, __pyx_t_1); if (unlikely(__pyx_t_19 == ((int)-1))) __PYX_ERR(0, 275, __pyx_L1_error) + __Pyx_DECREF(__pyx_t_1); __pyx_t_1 = 0; + + /* "spacy/pipeline/_parser_internals/_beam_utils.pyx":274 + * nr_step = max(nr_step, len(hist)) + * nr_steps.append(nr_step) + * for i in range(max(nr_steps)): # <<<<<<<<<<<<<< + * grads.append(numpy.zeros((max(beam_maps[i].values())+1, nr_class), + * dtype='f')) +*/ + } + __Pyx_DECREF(__pyx_t_7); __pyx_t_7 = 0; + + /* "spacy/pipeline/_parser_internals/_beam_utils.pyx":277 + * grads.append(numpy.zeros((max(beam_maps[i].values())+1, nr_class), + * dtype='f')) + * if len(histories) != len(losses): # <<<<<<<<<<<<<< + * raise ValueError(Errors.E081.format(n_hist=len(histories), losses=len(losses))) + * for eg_id, hists in enumerate(histories): +*/ + __pyx_t_3 = PyObject_Length(__pyx_v_histories); if (unlikely(__pyx_t_3 == ((Py_ssize_t)-1))) __PYX_ERR(0, 277, __pyx_L1_error) + __pyx_t_9 = PyObject_Length(__pyx_v_losses); if (unlikely(__pyx_t_9 == ((Py_ssize_t)-1))) __PYX_ERR(0, 277, __pyx_L1_error) + __pyx_t_15 = (__pyx_t_3 != __pyx_t_9); + if (unlikely(__pyx_t_15)) { + + /* "spacy/pipeline/_parser_internals/_beam_utils.pyx":278 + * dtype='f')) + * if len(histories) != len(losses): + * raise ValueError(Errors.E081.format(n_hist=len(histories), losses=len(losses))) # <<<<<<<<<<<<<< + * for eg_id, hists in enumerate(histories): + * for loss, hist in zip(losses[eg_id], hists): +*/ + __pyx_t_1 = NULL; + __Pyx_GetModuleGlobalName(__pyx_t_5, __pyx_mstate_global->__pyx_n_u_Errors); if (unlikely(!__pyx_t_5)) __PYX_ERR(0, 278, __pyx_L1_error) + __Pyx_GOTREF(__pyx_t_5); + __pyx_t_2 = __Pyx_PyObject_GetAttrStr(__pyx_t_5, __pyx_mstate_global->__pyx_n_u_E081); if (unlikely(!__pyx_t_2)) __PYX_ERR(0, 278, __pyx_L1_error) + __Pyx_GOTREF(__pyx_t_2); + __Pyx_DECREF(__pyx_t_5); __pyx_t_5 = 0; + __pyx_t_6 = __pyx_t_2; + __Pyx_INCREF(__pyx_t_6); + __pyx_t_9 = PyObject_Length(__pyx_v_histories); if (unlikely(__pyx_t_9 == ((Py_ssize_t)-1))) __PYX_ERR(0, 278, __pyx_L1_error) + __pyx_t_5 = PyLong_FromSsize_t(__pyx_t_9); if (unlikely(!__pyx_t_5)) __PYX_ERR(0, 278, __pyx_L1_error) + __Pyx_GOTREF(__pyx_t_5); + __pyx_t_9 = PyObject_Length(__pyx_v_losses); if (unlikely(__pyx_t_9 == ((Py_ssize_t)-1))) __PYX_ERR(0, 278, __pyx_L1_error) + __pyx_t_11 = PyLong_FromSsize_t(__pyx_t_9); if (unlikely(!__pyx_t_11)) __PYX_ERR(0, 278, __pyx_L1_error) + __Pyx_GOTREF(__pyx_t_11); + __pyx_t_8 = 0; + { + PyObject *__pyx_callargs[2 + ((CYTHON_VECTORCALL) ? 2 : 0)] = {__pyx_t_6, NULL}; + __pyx_t_21 = __Pyx_MakeVectorcallBuilderKwds(2); if (unlikely(!__pyx_t_21)) __PYX_ERR(0, 278, __pyx_L1_error) + __Pyx_GOTREF(__pyx_t_21); + if (__Pyx_VectorcallBuilder_AddArg(__pyx_mstate_global->__pyx_n_u_n_hist, __pyx_t_5, __pyx_t_21, __pyx_callargs+1, 0) < (0)) __PYX_ERR(0, 278, __pyx_L1_error) + if (__Pyx_VectorcallBuilder_AddArg(__pyx_mstate_global->__pyx_n_u_losses, __pyx_t_11, __pyx_t_21, __pyx_callargs+1, 1) < (0)) __PYX_ERR(0, 278, __pyx_L1_error) + __pyx_t_12 = __Pyx_Object_VectorcallMethod_CallFromBuilder((PyObject*)__pyx_mstate_global->__pyx_n_u_format, __pyx_callargs+__pyx_t_8, (1-__pyx_t_8) | (1*__Pyx_PY_VECTORCALL_ARGUMENTS_OFFSET), __pyx_t_21); + __Pyx_XDECREF(__pyx_t_6); __pyx_t_6 = 0; + __Pyx_DECREF(__pyx_t_5); __pyx_t_5 = 0; + __Pyx_DECREF(__pyx_t_11); __pyx_t_11 = 0; + __Pyx_DECREF(__pyx_t_21); __pyx_t_21 = 0; + __Pyx_DECREF(__pyx_t_2); __pyx_t_2 = 0; + if (unlikely(!__pyx_t_12)) __PYX_ERR(0, 278, __pyx_L1_error) + __Pyx_GOTREF(__pyx_t_12); + } + __pyx_t_8 = 1; + { + PyObject *__pyx_callargs[2] = {__pyx_t_1, __pyx_t_12}; + __pyx_t_7 = __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_1); __pyx_t_1 = 0; + __Pyx_DECREF(__pyx_t_12); __pyx_t_12 = 0; + if (unlikely(!__pyx_t_7)) __PYX_ERR(0, 278, __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, 278, __pyx_L1_error) + + /* "spacy/pipeline/_parser_internals/_beam_utils.pyx":277 + * grads.append(numpy.zeros((max(beam_maps[i].values())+1, nr_class), + * dtype='f')) + * if len(histories) != len(losses): # <<<<<<<<<<<<<< + * raise ValueError(Errors.E081.format(n_hist=len(histories), losses=len(losses))) + * for eg_id, hists in enumerate(histories): +*/ + } + + /* "spacy/pipeline/_parser_internals/_beam_utils.pyx":279 + * if len(histories) != len(losses): + * raise ValueError(Errors.E081.format(n_hist=len(histories), losses=len(losses))) + * for eg_id, hists in enumerate(histories): # <<<<<<<<<<<<<< + * for loss, hist in zip(losses[eg_id], hists): + * assert not numpy.isnan(loss) +*/ + __Pyx_INCREF(__pyx_mstate_global->__pyx_int_0); + __pyx_t_7 = __pyx_mstate_global->__pyx_int_0; + if (likely(PyList_CheckExact(__pyx_v_histories)) || PyTuple_CheckExact(__pyx_v_histories)) { + __pyx_t_12 = __pyx_v_histories; __Pyx_INCREF(__pyx_t_12); + __pyx_t_9 = 0; + __pyx_t_4 = NULL; + } else { + __pyx_t_9 = -1; __pyx_t_12 = PyObject_GetIter(__pyx_v_histories); if (unlikely(!__pyx_t_12)) __PYX_ERR(0, 279, __pyx_L1_error) + __Pyx_GOTREF(__pyx_t_12); + __pyx_t_4 = (CYTHON_COMPILING_IN_LIMITED_API) ? PyIter_Next : __Pyx_PyObject_GetIterNextFunc(__pyx_t_12); if (unlikely(!__pyx_t_4)) __PYX_ERR(0, 279, __pyx_L1_error) + } + for (;;) { + if (likely(!__pyx_t_4)) { + 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, 279, __pyx_L1_error) + #endif + if (__pyx_t_9 >= __pyx_temp) break; + } + __pyx_t_1 = __Pyx_PyList_GetItemRefFast(__pyx_t_12, __pyx_t_9, __Pyx_ReferenceSharing_OwnStrongReference); + ++__pyx_t_9; + } 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, 279, __pyx_L1_error) + #endif + if (__pyx_t_9 >= __pyx_temp) break; + } + #if CYTHON_ASSUME_SAFE_MACROS && !CYTHON_AVOID_BORROWED_REFS + __pyx_t_1 = __Pyx_NewRef(PyTuple_GET_ITEM(__pyx_t_12, __pyx_t_9)); + #else + __pyx_t_1 = __Pyx_PySequence_ITEM(__pyx_t_12, __pyx_t_9); + #endif + ++__pyx_t_9; + } + if (unlikely(!__pyx_t_1)) __PYX_ERR(0, 279, __pyx_L1_error) + } else { + __pyx_t_1 = __pyx_t_4(__pyx_t_12); + if (unlikely(!__pyx_t_1)) { + PyObject* exc_type = PyErr_Occurred(); + if (exc_type) { + if (unlikely(!__Pyx_PyErr_GivenExceptionMatches(exc_type, PyExc_StopIteration))) __PYX_ERR(0, 279, __pyx_L1_error) + PyErr_Clear(); + } + break; + } + } + __Pyx_GOTREF(__pyx_t_1); + __Pyx_XDECREF_SET(__pyx_v_hists, __pyx_t_1); + __pyx_t_1 = 0; + __Pyx_INCREF(__pyx_t_7); + __Pyx_XDECREF_SET(__pyx_v_eg_id, __pyx_t_7); + __pyx_t_1 = __Pyx_PyLong_AddObjC(__pyx_t_7, __pyx_mstate_global->__pyx_int_1, 1, 0, 0); if (unlikely(!__pyx_t_1)) __PYX_ERR(0, 279, __pyx_L1_error) + __Pyx_GOTREF(__pyx_t_1); + __Pyx_DECREF(__pyx_t_7); + __pyx_t_7 = __pyx_t_1; + __pyx_t_1 = 0; + + /* "spacy/pipeline/_parser_internals/_beam_utils.pyx":280 + * raise ValueError(Errors.E081.format(n_hist=len(histories), losses=len(losses))) + * for eg_id, hists in enumerate(histories): + * for loss, hist in zip(losses[eg_id], hists): # <<<<<<<<<<<<<< + * assert not numpy.isnan(loss) + * if loss == 0.0: +*/ + __pyx_t_2 = NULL; + __pyx_t_21 = __Pyx_PyObject_GetItem(__pyx_v_losses, __pyx_v_eg_id); if (unlikely(!__pyx_t_21)) __PYX_ERR(0, 280, __pyx_L1_error) + __Pyx_GOTREF(__pyx_t_21); + __pyx_t_8 = 1; + { + PyObject *__pyx_callargs[3] = {__pyx_t_2, __pyx_t_21, __pyx_v_hists}; + __pyx_t_1 = __Pyx_PyObject_FastCall((PyObject*)__pyx_builtin_zip, __pyx_callargs+__pyx_t_8, (3-__pyx_t_8) | (__pyx_t_8*__Pyx_PY_VECTORCALL_ARGUMENTS_OFFSET)); + __Pyx_XDECREF(__pyx_t_2); __pyx_t_2 = 0; + __Pyx_DECREF(__pyx_t_21); __pyx_t_21 = 0; + if (unlikely(!__pyx_t_1)) __PYX_ERR(0, 280, __pyx_L1_error) + __Pyx_GOTREF(__pyx_t_1); + } + if (likely(PyList_CheckExact(__pyx_t_1)) || PyTuple_CheckExact(__pyx_t_1)) { + __pyx_t_21 = __pyx_t_1; __Pyx_INCREF(__pyx_t_21); + __pyx_t_3 = 0; + __pyx_t_10 = NULL; + } else { + __pyx_t_3 = -1; __pyx_t_21 = PyObject_GetIter(__pyx_t_1); if (unlikely(!__pyx_t_21)) __PYX_ERR(0, 280, __pyx_L1_error) + __Pyx_GOTREF(__pyx_t_21); + __pyx_t_10 = (CYTHON_COMPILING_IN_LIMITED_API) ? PyIter_Next : __Pyx_PyObject_GetIterNextFunc(__pyx_t_21); if (unlikely(!__pyx_t_10)) __PYX_ERR(0, 280, __pyx_L1_error) + } + __Pyx_DECREF(__pyx_t_1); __pyx_t_1 = 0; + for (;;) { + if (likely(!__pyx_t_10)) { + if (likely(PyList_CheckExact(__pyx_t_21))) { + { + Py_ssize_t __pyx_temp = __Pyx_PyList_GET_SIZE(__pyx_t_21); + #if !CYTHON_ASSUME_SAFE_SIZE + if (unlikely((__pyx_temp < 0))) __PYX_ERR(0, 280, __pyx_L1_error) + #endif + if (__pyx_t_3 >= __pyx_temp) break; + } + __pyx_t_1 = __Pyx_PyList_GetItemRefFast(__pyx_t_21, __pyx_t_3, __Pyx_ReferenceSharing_OwnStrongReference); + ++__pyx_t_3; + } else { + { + Py_ssize_t __pyx_temp = __Pyx_PyTuple_GET_SIZE(__pyx_t_21); + #if !CYTHON_ASSUME_SAFE_SIZE + if (unlikely((__pyx_temp < 0))) __PYX_ERR(0, 280, __pyx_L1_error) + #endif + if (__pyx_t_3 >= __pyx_temp) break; + } + #if CYTHON_ASSUME_SAFE_MACROS && !CYTHON_AVOID_BORROWED_REFS + __pyx_t_1 = __Pyx_NewRef(PyTuple_GET_ITEM(__pyx_t_21, __pyx_t_3)); + #else + __pyx_t_1 = __Pyx_PySequence_ITEM(__pyx_t_21, __pyx_t_3); + #endif + ++__pyx_t_3; + } + if (unlikely(!__pyx_t_1)) __PYX_ERR(0, 280, __pyx_L1_error) + } else { + __pyx_t_1 = __pyx_t_10(__pyx_t_21); + if (unlikely(!__pyx_t_1)) { + PyObject* exc_type = PyErr_Occurred(); + if (exc_type) { + if (unlikely(!__Pyx_PyErr_GivenExceptionMatches(exc_type, PyExc_StopIteration))) __PYX_ERR(0, 280, __pyx_L1_error) + PyErr_Clear(); + } + break; + } + } + __Pyx_GOTREF(__pyx_t_1); + if ((likely(PyTuple_CheckExact(__pyx_t_1))) || (PyList_CheckExact(__pyx_t_1))) { + PyObject* sequence = __pyx_t_1; + 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, 280, __pyx_L1_error) + } + #if CYTHON_ASSUME_SAFE_MACROS && !CYTHON_AVOID_BORROWED_REFS + if (likely(PyTuple_CheckExact(sequence))) { + __pyx_t_2 = PyTuple_GET_ITEM(sequence, 0); + __Pyx_INCREF(__pyx_t_2); + __pyx_t_11 = PyTuple_GET_ITEM(sequence, 1); + __Pyx_INCREF(__pyx_t_11); + } else { + __pyx_t_2 = __Pyx_PyList_GetItemRefFast(sequence, 0, __Pyx_ReferenceSharing_SharedReference); + if (unlikely(!__pyx_t_2)) __PYX_ERR(0, 280, __pyx_L1_error) + __Pyx_XGOTREF(__pyx_t_2); + __pyx_t_11 = __Pyx_PyList_GetItemRefFast(sequence, 1, __Pyx_ReferenceSharing_SharedReference); + if (unlikely(!__pyx_t_11)) __PYX_ERR(0, 280, __pyx_L1_error) + __Pyx_XGOTREF(__pyx_t_11); + } + #else + __pyx_t_2 = __Pyx_PySequence_ITEM(sequence, 0); if (unlikely(!__pyx_t_2)) __PYX_ERR(0, 280, __pyx_L1_error) + __Pyx_GOTREF(__pyx_t_2); + __pyx_t_11 = __Pyx_PySequence_ITEM(sequence, 1); if (unlikely(!__pyx_t_11)) __PYX_ERR(0, 280, __pyx_L1_error) + __Pyx_GOTREF(__pyx_t_11); + #endif + __Pyx_DECREF(__pyx_t_1); __pyx_t_1 = 0; + } else { + Py_ssize_t index = -1; + __pyx_t_5 = PyObject_GetIter(__pyx_t_1); if (unlikely(!__pyx_t_5)) __PYX_ERR(0, 280, __pyx_L1_error) + __Pyx_GOTREF(__pyx_t_5); + __Pyx_DECREF(__pyx_t_1); __pyx_t_1 = 0; + __pyx_t_13 = (CYTHON_COMPILING_IN_LIMITED_API) ? PyIter_Next : __Pyx_PyObject_GetIterNextFunc(__pyx_t_5); + index = 0; __pyx_t_2 = __pyx_t_13(__pyx_t_5); if (unlikely(!__pyx_t_2)) goto __pyx_L20_unpacking_failed; + __Pyx_GOTREF(__pyx_t_2); + index = 1; __pyx_t_11 = __pyx_t_13(__pyx_t_5); if (unlikely(!__pyx_t_11)) goto __pyx_L20_unpacking_failed; + __Pyx_GOTREF(__pyx_t_11); + if (__Pyx_IternextUnpackEndCheck(__pyx_t_13(__pyx_t_5), 2) < (0)) __PYX_ERR(0, 280, __pyx_L1_error) + __pyx_t_13 = NULL; + __Pyx_DECREF(__pyx_t_5); __pyx_t_5 = 0; + goto __pyx_L21_unpacking_done; + __pyx_L20_unpacking_failed:; + __Pyx_DECREF(__pyx_t_5); __pyx_t_5 = 0; + __pyx_t_13 = NULL; + if (__Pyx_IterFinish() == 0) __Pyx_RaiseNeedMoreValuesError(index); + __PYX_ERR(0, 280, __pyx_L1_error) + __pyx_L21_unpacking_done:; + } + __Pyx_XDECREF_SET(__pyx_v_loss, __pyx_t_2); + __pyx_t_2 = 0; + __Pyx_XDECREF_SET(__pyx_v_hist, __pyx_t_11); + __pyx_t_11 = 0; + + /* "spacy/pipeline/_parser_internals/_beam_utils.pyx":281 + * for eg_id, hists in enumerate(histories): + * for loss, hist in zip(losses[eg_id], hists): + * assert not numpy.isnan(loss) # <<<<<<<<<<<<<< + * if loss == 0.0: + * continue +*/ + #ifndef CYTHON_WITHOUT_ASSERTIONS + if (unlikely(__pyx_assertions_enabled())) { + __pyx_t_11 = NULL; + __Pyx_GetModuleGlobalName(__pyx_t_2, __pyx_mstate_global->__pyx_n_u_numpy); if (unlikely(!__pyx_t_2)) __PYX_ERR(0, 281, __pyx_L1_error) + __Pyx_GOTREF(__pyx_t_2); + __pyx_t_5 = __Pyx_PyObject_GetAttrStr(__pyx_t_2, __pyx_mstate_global->__pyx_n_u_isnan); if (unlikely(!__pyx_t_5)) __PYX_ERR(0, 281, __pyx_L1_error) + __Pyx_GOTREF(__pyx_t_5); + __Pyx_DECREF(__pyx_t_2); __pyx_t_2 = 0; + __pyx_t_8 = 1; + #if CYTHON_UNPACK_METHODS + if (unlikely(PyMethod_Check(__pyx_t_5))) { + __pyx_t_11 = PyMethod_GET_SELF(__pyx_t_5); + assert(__pyx_t_11); + PyObject* __pyx__function = PyMethod_GET_FUNCTION(__pyx_t_5); + __Pyx_INCREF(__pyx_t_11); + __Pyx_INCREF(__pyx__function); + __Pyx_DECREF_SET(__pyx_t_5, __pyx__function); + __pyx_t_8 = 0; + } + #endif + { + PyObject *__pyx_callargs[2] = {__pyx_t_11, __pyx_v_loss}; + __pyx_t_1 = __Pyx_PyObject_FastCall((PyObject*)__pyx_t_5, __pyx_callargs+__pyx_t_8, (2-__pyx_t_8) | (__pyx_t_8*__Pyx_PY_VECTORCALL_ARGUMENTS_OFFSET)); + __Pyx_XDECREF(__pyx_t_11); __pyx_t_11 = 0; + __Pyx_DECREF(__pyx_t_5); __pyx_t_5 = 0; + if (unlikely(!__pyx_t_1)) __PYX_ERR(0, 281, __pyx_L1_error) + __Pyx_GOTREF(__pyx_t_1); + } + __pyx_t_15 = __Pyx_PyObject_IsTrue(__pyx_t_1); if (unlikely((__pyx_t_15 < 0))) __PYX_ERR(0, 281, __pyx_L1_error) + __Pyx_DECREF(__pyx_t_1); __pyx_t_1 = 0; + __pyx_t_14 = (!__pyx_t_15); + if (unlikely(!__pyx_t_14)) { + __Pyx_Raise(((PyObject *)(((PyTypeObject*)PyExc_AssertionError))), 0, 0, 0); + __PYX_ERR(0, 281, __pyx_L1_error) + } + } + #else + if ((1)); else __PYX_ERR(0, 281, __pyx_L1_error) + #endif + + /* "spacy/pipeline/_parser_internals/_beam_utils.pyx":282 + * for loss, hist in zip(losses[eg_id], hists): + * assert not numpy.isnan(loss) + * if loss == 0.0: # <<<<<<<<<<<<<< + * continue + * key = tuple([eg_id]) +*/ + __pyx_t_14 = (__Pyx_PyFloat_BoolEqObjC(__pyx_v_loss, __pyx_mstate_global->__pyx_float_0_0, 0.0, 0, 0)); if (unlikely((__pyx_t_14 < 0))) __PYX_ERR(0, 282, __pyx_L1_error) + if (__pyx_t_14) { + + /* "spacy/pipeline/_parser_internals/_beam_utils.pyx":283 + * assert not numpy.isnan(loss) + * if loss == 0.0: + * continue # <<<<<<<<<<<<<< + * key = tuple([eg_id]) + * # Adjust loss for length +*/ + goto __pyx_L18_continue; + + /* "spacy/pipeline/_parser_internals/_beam_utils.pyx":282 + * for loss, hist in zip(losses[eg_id], hists): + * assert not numpy.isnan(loss) + * if loss == 0.0: # <<<<<<<<<<<<<< + * continue + * key = tuple([eg_id]) +*/ + } + + /* "spacy/pipeline/_parser_internals/_beam_utils.pyx":284 + * if loss == 0.0: + * continue + * key = tuple([eg_id]) # <<<<<<<<<<<<<< + * # Adjust loss for length + * # We need to do this because each state in a short path is scored +*/ + __pyx_t_1 = PyList_New(1); if (unlikely(!__pyx_t_1)) __PYX_ERR(0, 284, __pyx_L1_error) + __Pyx_GOTREF(__pyx_t_1); + __Pyx_INCREF(__pyx_v_eg_id); + __Pyx_GIVEREF(__pyx_v_eg_id); + if (__Pyx_PyList_SET_ITEM(__pyx_t_1, 0, __pyx_v_eg_id) != (0)) __PYX_ERR(0, 284, __pyx_L1_error); + __pyx_t_5 = PyList_AsTuple(((PyObject*)__pyx_t_1)); if (unlikely(!__pyx_t_5)) __PYX_ERR(0, 284, __pyx_L1_error) + __Pyx_GOTREF(__pyx_t_5); + __Pyx_DECREF(__pyx_t_1); __pyx_t_1 = 0; + __Pyx_XDECREF_SET(__pyx_v_key, ((PyObject*)__pyx_t_5)); + __pyx_t_5 = 0; + + /* "spacy/pipeline/_parser_internals/_beam_utils.pyx":289 + * # multiple times, as we add in the average cost when we run out + * # of actions. + * avg_loss = loss / len(hist) # <<<<<<<<<<<<<< + * loss += avg_loss * (nr_steps[eg_id] - len(hist)) + * for step, clas in enumerate(hist): +*/ + __pyx_t_18 = PyObject_Length(__pyx_v_hist); if (unlikely(__pyx_t_18 == ((Py_ssize_t)-1))) __PYX_ERR(0, 289, __pyx_L1_error) + __pyx_t_5 = PyLong_FromSsize_t(__pyx_t_18); if (unlikely(!__pyx_t_5)) __PYX_ERR(0, 289, __pyx_L1_error) + __Pyx_GOTREF(__pyx_t_5); + __pyx_t_1 = __Pyx_PyNumber_Divide(__pyx_v_loss, __pyx_t_5); if (unlikely(!__pyx_t_1)) __PYX_ERR(0, 289, __pyx_L1_error) + __Pyx_GOTREF(__pyx_t_1); + __Pyx_DECREF(__pyx_t_5); __pyx_t_5 = 0; + __Pyx_XDECREF_SET(__pyx_v_avg_loss, __pyx_t_1); + __pyx_t_1 = 0; + + /* "spacy/pipeline/_parser_internals/_beam_utils.pyx":290 + * # of actions. + * avg_loss = loss / len(hist) + * loss += avg_loss * (nr_steps[eg_id] - len(hist)) # <<<<<<<<<<<<<< + * for step, clas in enumerate(hist): + * i = beam_maps[step][key] +*/ + __pyx_t_1 = __Pyx_PyObject_GetItem(__pyx_v_nr_steps, __pyx_v_eg_id); if (unlikely(!__pyx_t_1)) __PYX_ERR(0, 290, __pyx_L1_error) + __Pyx_GOTREF(__pyx_t_1); + __pyx_t_18 = PyObject_Length(__pyx_v_hist); if (unlikely(__pyx_t_18 == ((Py_ssize_t)-1))) __PYX_ERR(0, 290, __pyx_L1_error) + __pyx_t_5 = PyLong_FromSsize_t(__pyx_t_18); if (unlikely(!__pyx_t_5)) __PYX_ERR(0, 290, __pyx_L1_error) + __Pyx_GOTREF(__pyx_t_5); + __pyx_t_11 = PyNumber_Subtract(__pyx_t_1, __pyx_t_5); if (unlikely(!__pyx_t_11)) __PYX_ERR(0, 290, __pyx_L1_error) + __Pyx_GOTREF(__pyx_t_11); + __Pyx_DECREF(__pyx_t_1); __pyx_t_1 = 0; + __Pyx_DECREF(__pyx_t_5); __pyx_t_5 = 0; + __pyx_t_5 = PyNumber_Multiply(__pyx_v_avg_loss, __pyx_t_11); if (unlikely(!__pyx_t_5)) __PYX_ERR(0, 290, __pyx_L1_error) + __Pyx_GOTREF(__pyx_t_5); + __Pyx_DECREF(__pyx_t_11); __pyx_t_11 = 0; + __pyx_t_11 = PyNumber_InPlaceAdd(__pyx_v_loss, __pyx_t_5); if (unlikely(!__pyx_t_11)) __PYX_ERR(0, 290, __pyx_L1_error) + __Pyx_GOTREF(__pyx_t_11); + __Pyx_DECREF(__pyx_t_5); __pyx_t_5 = 0; + __Pyx_DECREF_SET(__pyx_v_loss, __pyx_t_11); + __pyx_t_11 = 0; + + /* "spacy/pipeline/_parser_internals/_beam_utils.pyx":291 + * avg_loss = loss / len(hist) + * loss += avg_loss * (nr_steps[eg_id] - len(hist)) + * for step, clas in enumerate(hist): # <<<<<<<<<<<<<< + * i = beam_maps[step][key] + * # In step j, at state i action clas +*/ + __Pyx_INCREF(__pyx_mstate_global->__pyx_int_0); + __pyx_t_11 = __pyx_mstate_global->__pyx_int_0; + if (likely(PyList_CheckExact(__pyx_v_hist)) || PyTuple_CheckExact(__pyx_v_hist)) { + __pyx_t_5 = __pyx_v_hist; __Pyx_INCREF(__pyx_t_5); + __pyx_t_18 = 0; + __pyx_t_22 = NULL; + } else { + __pyx_t_18 = -1; __pyx_t_5 = PyObject_GetIter(__pyx_v_hist); if (unlikely(!__pyx_t_5)) __PYX_ERR(0, 291, __pyx_L1_error) + __Pyx_GOTREF(__pyx_t_5); + __pyx_t_22 = (CYTHON_COMPILING_IN_LIMITED_API) ? PyIter_Next : __Pyx_PyObject_GetIterNextFunc(__pyx_t_5); if (unlikely(!__pyx_t_22)) __PYX_ERR(0, 291, __pyx_L1_error) + } + for (;;) { + if (likely(!__pyx_t_22)) { + if (likely(PyList_CheckExact(__pyx_t_5))) { + { + Py_ssize_t __pyx_temp = __Pyx_PyList_GET_SIZE(__pyx_t_5); + #if !CYTHON_ASSUME_SAFE_SIZE + if (unlikely((__pyx_temp < 0))) __PYX_ERR(0, 291, __pyx_L1_error) + #endif + if (__pyx_t_18 >= __pyx_temp) break; + } + __pyx_t_1 = __Pyx_PyList_GetItemRefFast(__pyx_t_5, __pyx_t_18, __Pyx_ReferenceSharing_OwnStrongReference); + ++__pyx_t_18; + } else { + { + Py_ssize_t __pyx_temp = __Pyx_PyTuple_GET_SIZE(__pyx_t_5); + #if !CYTHON_ASSUME_SAFE_SIZE + if (unlikely((__pyx_temp < 0))) __PYX_ERR(0, 291, __pyx_L1_error) + #endif + if (__pyx_t_18 >= __pyx_temp) break; + } + #if CYTHON_ASSUME_SAFE_MACROS && !CYTHON_AVOID_BORROWED_REFS + __pyx_t_1 = __Pyx_NewRef(PyTuple_GET_ITEM(__pyx_t_5, __pyx_t_18)); + #else + __pyx_t_1 = __Pyx_PySequence_ITEM(__pyx_t_5, __pyx_t_18); + #endif + ++__pyx_t_18; + } + if (unlikely(!__pyx_t_1)) __PYX_ERR(0, 291, __pyx_L1_error) + } else { + __pyx_t_1 = __pyx_t_22(__pyx_t_5); + if (unlikely(!__pyx_t_1)) { + PyObject* exc_type = PyErr_Occurred(); + if (exc_type) { + if (unlikely(!__Pyx_PyErr_GivenExceptionMatches(exc_type, PyExc_StopIteration))) __PYX_ERR(0, 291, __pyx_L1_error) + PyErr_Clear(); + } + break; + } + } + __Pyx_GOTREF(__pyx_t_1); + __Pyx_XDECREF_SET(__pyx_v_clas, __pyx_t_1); + __pyx_t_1 = 0; + __Pyx_INCREF(__pyx_t_11); + __Pyx_XDECREF_SET(__pyx_v_step, __pyx_t_11); + __pyx_t_1 = __Pyx_PyLong_AddObjC(__pyx_t_11, __pyx_mstate_global->__pyx_int_1, 1, 0, 0); if (unlikely(!__pyx_t_1)) __PYX_ERR(0, 291, __pyx_L1_error) + __Pyx_GOTREF(__pyx_t_1); + __Pyx_DECREF(__pyx_t_11); + __pyx_t_11 = __pyx_t_1; + __pyx_t_1 = 0; + + /* "spacy/pipeline/_parser_internals/_beam_utils.pyx":292 + * loss += avg_loss * (nr_steps[eg_id] - len(hist)) + * for step, clas in enumerate(hist): + * i = beam_maps[step][key] # <<<<<<<<<<<<<< + * # In step j, at state i action clas + * # resulted in loss +*/ + __pyx_t_1 = __Pyx_PyObject_GetItem(__pyx_v_beam_maps, __pyx_v_step); if (unlikely(!__pyx_t_1)) __PYX_ERR(0, 292, __pyx_L1_error) + __Pyx_GOTREF(__pyx_t_1); + __pyx_t_2 = __Pyx_PyObject_GetItem(__pyx_t_1, __pyx_v_key); if (unlikely(!__pyx_t_2)) __PYX_ERR(0, 292, __pyx_L1_error) + __Pyx_GOTREF(__pyx_t_2); + __Pyx_DECREF(__pyx_t_1); __pyx_t_1 = 0; + __Pyx_XDECREF_SET(__pyx_v_i, __pyx_t_2); + __pyx_t_2 = 0; + + /* "spacy/pipeline/_parser_internals/_beam_utils.pyx":295 + * # In step j, at state i action clas + * # resulted in loss + * grads[step][i, clas] += loss # <<<<<<<<<<<<<< + * key = key + tuple([clas]) + * return grads +*/ + __pyx_t_2 = __Pyx_PyObject_GetItem(__pyx_v_grads, __pyx_v_step); if (unlikely(!__pyx_t_2)) __PYX_ERR(0, 295, __pyx_L1_error) + __Pyx_GOTREF(__pyx_t_2); + __pyx_t_1 = PyTuple_New(2); if (unlikely(!__pyx_t_1)) __PYX_ERR(0, 295, __pyx_L1_error) + __Pyx_GOTREF(__pyx_t_1); + __Pyx_INCREF(__pyx_v_i); + __Pyx_GIVEREF(__pyx_v_i); + if (__Pyx_PyTuple_SET_ITEM(__pyx_t_1, 0, __pyx_v_i) != (0)) __PYX_ERR(0, 295, __pyx_L1_error); + __Pyx_INCREF(__pyx_v_clas); + __Pyx_GIVEREF(__pyx_v_clas); + if (__Pyx_PyTuple_SET_ITEM(__pyx_t_1, 1, __pyx_v_clas) != (0)) __PYX_ERR(0, 295, __pyx_L1_error); + __pyx_t_6 = __Pyx_PyObject_GetItem(__pyx_t_2, __pyx_t_1); if (unlikely(!__pyx_t_6)) __PYX_ERR(0, 295, __pyx_L1_error) + __Pyx_GOTREF(__pyx_t_6); + __pyx_t_20 = PyNumber_InPlaceAdd(__pyx_t_6, __pyx_v_loss); if (unlikely(!__pyx_t_20)) __PYX_ERR(0, 295, __pyx_L1_error) + __Pyx_GOTREF(__pyx_t_20); + __Pyx_DECREF(__pyx_t_6); __pyx_t_6 = 0; + if (unlikely((PyObject_SetItem(__pyx_t_2, __pyx_t_1, __pyx_t_20) < 0))) __PYX_ERR(0, 295, __pyx_L1_error) + __Pyx_DECREF(__pyx_t_20); __pyx_t_20 = 0; + __Pyx_DECREF(__pyx_t_1); __pyx_t_1 = 0; + __Pyx_DECREF(__pyx_t_2); __pyx_t_2 = 0; + + /* "spacy/pipeline/_parser_internals/_beam_utils.pyx":296 + * # resulted in loss + * grads[step][i, clas] += loss + * key = key + tuple([clas]) # <<<<<<<<<<<<<< + * return grads +*/ + __pyx_t_2 = PyList_New(1); if (unlikely(!__pyx_t_2)) __PYX_ERR(0, 296, __pyx_L1_error) + __Pyx_GOTREF(__pyx_t_2); + __Pyx_INCREF(__pyx_v_clas); + __Pyx_GIVEREF(__pyx_v_clas); + if (__Pyx_PyList_SET_ITEM(__pyx_t_2, 0, __pyx_v_clas) != (0)) __PYX_ERR(0, 296, __pyx_L1_error); + __pyx_t_1 = PyList_AsTuple(((PyObject*)__pyx_t_2)); if (unlikely(!__pyx_t_1)) __PYX_ERR(0, 296, __pyx_L1_error) + __Pyx_GOTREF(__pyx_t_1); + __Pyx_DECREF(__pyx_t_2); __pyx_t_2 = 0; + __pyx_t_2 = PyNumber_Add(__pyx_v_key, __pyx_t_1); if (unlikely(!__pyx_t_2)) __PYX_ERR(0, 296, __pyx_L1_error) + __Pyx_GOTREF(__pyx_t_2); + __Pyx_DECREF(__pyx_t_1); __pyx_t_1 = 0; + __Pyx_DECREF_SET(__pyx_v_key, ((PyObject*)__pyx_t_2)); + __pyx_t_2 = 0; + + /* "spacy/pipeline/_parser_internals/_beam_utils.pyx":291 + * avg_loss = loss / len(hist) + * loss += avg_loss * (nr_steps[eg_id] - len(hist)) + * for step, clas in enumerate(hist): # <<<<<<<<<<<<<< + * i = beam_maps[step][key] + * # In step j, at state i action clas +*/ + } + __Pyx_DECREF(__pyx_t_5); __pyx_t_5 = 0; + __Pyx_DECREF(__pyx_t_11); __pyx_t_11 = 0; + + /* "spacy/pipeline/_parser_internals/_beam_utils.pyx":280 + * raise ValueError(Errors.E081.format(n_hist=len(histories), losses=len(losses))) + * for eg_id, hists in enumerate(histories): + * for loss, hist in zip(losses[eg_id], hists): # <<<<<<<<<<<<<< + * assert not numpy.isnan(loss) + * if loss == 0.0: +*/ + __pyx_L18_continue:; + } + __Pyx_DECREF(__pyx_t_21); __pyx_t_21 = 0; + + /* "spacy/pipeline/_parser_internals/_beam_utils.pyx":279 + * if len(histories) != len(losses): + * raise ValueError(Errors.E081.format(n_hist=len(histories), losses=len(losses))) + * for eg_id, hists in enumerate(histories): # <<<<<<<<<<<<<< + * for loss, hist in zip(losses[eg_id], hists): + * assert not numpy.isnan(loss) +*/ + } + __Pyx_DECREF(__pyx_t_12); __pyx_t_12 = 0; + __Pyx_DECREF(__pyx_t_7); __pyx_t_7 = 0; + + /* "spacy/pipeline/_parser_internals/_beam_utils.pyx":297 + * grads[step][i, clas] += loss + * key = key + tuple([clas]) + * return grads # <<<<<<<<<<<<<< +*/ + __Pyx_XDECREF(__pyx_r); + __Pyx_INCREF(__pyx_v_grads); + __pyx_r = __pyx_v_grads; + goto __pyx_L0; + + /* "spacy/pipeline/_parser_internals/_beam_utils.pyx":252 + * + * + * def get_gradient(nr_class, beam_maps, histories, losses): # <<<<<<<<<<<<<< + * """The global model assigns a loss to each parse. The beam scores + * are additive, so the same gradient is applied to each action +*/ + + /* function exit code */ + __pyx_L1_error:; + __Pyx_XDECREF(__pyx_t_1); + __Pyx_XDECREF(__pyx_t_2); + __Pyx_XDECREF(__pyx_t_5); + __Pyx_XDECREF(__pyx_t_6); + __Pyx_XDECREF(__pyx_t_7); + __Pyx_XDECREF(__pyx_t_11); + __Pyx_XDECREF(__pyx_t_12); + __Pyx_XDECREF(__pyx_t_20); + __Pyx_XDECREF(__pyx_t_21); + __Pyx_AddTraceback("spacy.pipeline._parser_internals._beam_utils.get_gradient", __pyx_clineno, __pyx_lineno, __pyx_filename); + __pyx_r = NULL; + __pyx_L0:; + __Pyx_XDECREF(__pyx_v_grads); + __Pyx_XDECREF(__pyx_v_nr_steps); + __Pyx_XDECREF(__pyx_v_eg_id); + __Pyx_XDECREF(__pyx_v_hists); + __Pyx_XDECREF(__pyx_v_loss); + __Pyx_XDECREF(__pyx_v_hist); + __Pyx_XDECREF(__pyx_v_i); + __Pyx_XDECREF(__pyx_v_key); + __Pyx_XDECREF(__pyx_v_avg_loss); + __Pyx_XDECREF(__pyx_v_step); + __Pyx_XDECREF(__pyx_v_clas); + __Pyx_XGIVEREF(__pyx_r); + __Pyx_RefNannyFinishContext(); + return __pyx_r; +} + +/* "(tree fragment)":4 + * int __Pyx_CheckUnpickleChecksum(long, long, long, long, const char*) except -1 + * int __Pyx_UpdateUnpickledDict(object, object, Py_ssize_t) except -1 + * def __pyx_unpickle_BeamBatch(__pyx_type, long __pyx_checksum, tuple __pyx_state): # <<<<<<<<<<<<<< + * cdef object __pyx_result + * __Pyx_CheckUnpickleChecksum(__pyx_checksum, 0xa2d29a4, 0xb00362f, 0x8d7a14f, b'beams, docs, golds, moves, states') +*/ + +/* Python wrapper */ +static PyObject *__pyx_pw_5spacy_8pipeline_17_parser_internals_11_beam_utils_9__pyx_unpickle_BeamBatch(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_5spacy_8pipeline_17_parser_internals_11_beam_utils_8__pyx_unpickle_BeamBatch, "__pyx_unpickle_BeamBatch(__pyx_type, long __pyx_checksum, tuple __pyx_state)"); +static PyMethodDef __pyx_mdef_5spacy_8pipeline_17_parser_internals_11_beam_utils_9__pyx_unpickle_BeamBatch = {"__pyx_unpickle_BeamBatch", (PyCFunction)(void(*)(void))(__Pyx_PyCFunction_FastCallWithKeywords)__pyx_pw_5spacy_8pipeline_17_parser_internals_11_beam_utils_9__pyx_unpickle_BeamBatch, __Pyx_METH_FASTCALL|METH_KEYWORDS, __pyx_doc_5spacy_8pipeline_17_parser_internals_11_beam_utils_8__pyx_unpickle_BeamBatch}; +static PyObject *__pyx_pw_5spacy_8pipeline_17_parser_internals_11_beam_utils_9__pyx_unpickle_BeamBatch(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 +) { + PyObject *__pyx_v___pyx_type = 0; + long __pyx_v___pyx_checksum; + 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[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("__pyx_unpickle_BeamBatch (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_type,&__pyx_mstate_global->__pyx_n_u_pyx_checksum,&__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, 4, __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(1, 4, __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(1, 4, __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(1, 4, __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, "__pyx_unpickle_BeamBatch", 0) < (0)) __PYX_ERR(1, 4, __pyx_L3_error) + for (Py_ssize_t i = __pyx_nargs; i < 3; i++) { + if (unlikely(!values[i])) { __Pyx_RaiseArgtupleInvalid("__pyx_unpickle_BeamBatch", 1, 3, 3, i); __PYX_ERR(1, 4, __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(1, 4, __pyx_L3_error) + values[1] = __Pyx_ArgRef_FASTCALL(__pyx_args, 1); + if (!CYTHON_ASSUME_SAFE_MACROS && unlikely(!values[1])) __PYX_ERR(1, 4, __pyx_L3_error) + values[2] = __Pyx_ArgRef_FASTCALL(__pyx_args, 2); + if (!CYTHON_ASSUME_SAFE_MACROS && unlikely(!values[2])) __PYX_ERR(1, 4, __pyx_L3_error) + } + __pyx_v___pyx_type = values[0]; + __pyx_v___pyx_checksum = __Pyx_PyLong_As_long(values[1]); if (unlikely((__pyx_v___pyx_checksum == (long)-1) && PyErr_Occurred())) __PYX_ERR(1, 4, __pyx_L3_error) + __pyx_v___pyx_state = ((PyObject*)values[2]); + } + goto __pyx_L6_skip; + __pyx_L5_argtuple_error:; + __Pyx_RaiseArgtupleInvalid("__pyx_unpickle_BeamBatch", 1, 3, 3, __pyx_nargs); __PYX_ERR(1, 4, __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("spacy.pipeline._parser_internals._beam_utils.__pyx_unpickle_BeamBatch", __pyx_clineno, __pyx_lineno, __pyx_filename); + __Pyx_RefNannyFinishContext(); + return NULL; + __pyx_L4_argument_unpacking_done:; + if (unlikely(!__Pyx_ArgTypeTest(((PyObject *)__pyx_v___pyx_state), (&PyTuple_Type), 1, "__pyx_state", 1))) __PYX_ERR(1, 4, __pyx_L1_error) + __pyx_r = __pyx_pf_5spacy_8pipeline_17_parser_internals_11_beam_utils_8__pyx_unpickle_BeamBatch(__pyx_self, __pyx_v___pyx_type, __pyx_v___pyx_checksum, __pyx_v___pyx_state); + + /* 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_5spacy_8pipeline_17_parser_internals_11_beam_utils_8__pyx_unpickle_BeamBatch(CYTHON_UNUSED PyObject *__pyx_self, PyObject *__pyx_v___pyx_type, long __pyx_v___pyx_checksum, PyObject *__pyx_v___pyx_state) { + PyObject *__pyx_v___pyx_result = 0; + 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_t_5; + int __pyx_lineno = 0; + const char *__pyx_filename = NULL; + int __pyx_clineno = 0; + __Pyx_RefNannySetupContext("__pyx_unpickle_BeamBatch", 0); + + /* "(tree fragment)":6 + * def __pyx_unpickle_BeamBatch(__pyx_type, long __pyx_checksum, tuple __pyx_state): + * cdef object __pyx_result + * __Pyx_CheckUnpickleChecksum(__pyx_checksum, 0xa2d29a4, 0xb00362f, 0x8d7a14f, b'beams, docs, golds, moves, states') # <<<<<<<<<<<<<< + * __pyx_result = BeamBatch.__new__(__pyx_type) + * if __pyx_state is not None: +*/ + __pyx_t_1 = __Pyx_CheckUnpickleChecksum(__pyx_v___pyx_checksum, 0xa2d29a4, 0xb00362f, 0x8d7a14f, ((char const *)"beams, docs, golds, moves, states")); if (unlikely(__pyx_t_1 == ((int)-1))) __PYX_ERR(1, 6, __pyx_L1_error) + + /* "(tree fragment)":7 + * cdef object __pyx_result + * __Pyx_CheckUnpickleChecksum(__pyx_checksum, 0xa2d29a4, 0xb00362f, 0x8d7a14f, b'beams, docs, golds, moves, states') + * __pyx_result = BeamBatch.__new__(__pyx_type) # <<<<<<<<<<<<<< + * if __pyx_state is not None: + * __pyx_unpickle_BeamBatch__set_state( __pyx_result, __pyx_state) +*/ + __pyx_t_3 = ((PyObject *)__pyx_mstate_global->__pyx_ptype_5spacy_8pipeline_17_parser_internals_11_beam_utils_BeamBatch); + __Pyx_INCREF(__pyx_t_3); + __pyx_t_4 = 0; + { + PyObject *__pyx_callargs[2] = {__pyx_t_3, __pyx_v___pyx_type}; + __pyx_t_2 = __Pyx_PyObject_FastCallMethod((PyObject*)__pyx_mstate_global->__pyx_n_u_new, __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_2)) __PYX_ERR(1, 7, __pyx_L1_error) + __Pyx_GOTREF(__pyx_t_2); + } + __pyx_v___pyx_result = __pyx_t_2; + __pyx_t_2 = 0; + + /* "(tree fragment)":8 + * __Pyx_CheckUnpickleChecksum(__pyx_checksum, 0xa2d29a4, 0xb00362f, 0x8d7a14f, b'beams, docs, golds, moves, states') + * __pyx_result = BeamBatch.__new__(__pyx_type) + * if __pyx_state is not None: # <<<<<<<<<<<<<< + * __pyx_unpickle_BeamBatch__set_state( __pyx_result, __pyx_state) + * return __pyx_result +*/ + __pyx_t_5 = (__pyx_v___pyx_state != ((PyObject*)Py_None)); + if (__pyx_t_5) { + + /* "(tree fragment)":9 + * __pyx_result = BeamBatch.__new__(__pyx_type) + * if __pyx_state is not None: + * __pyx_unpickle_BeamBatch__set_state( __pyx_result, __pyx_state) # <<<<<<<<<<<<<< + * return __pyx_result + * cdef __pyx_unpickle_BeamBatch__set_state(BeamBatch __pyx_result, __pyx_state: tuple): +*/ + __pyx_t_2 = __pyx_f_5spacy_8pipeline_17_parser_internals_11_beam_utils___pyx_unpickle_BeamBatch__set_state(((struct __pyx_obj_5spacy_8pipeline_17_parser_internals_11_beam_utils_BeamBatch *)__pyx_v___pyx_result), __pyx_v___pyx_state); if (unlikely(!__pyx_t_2)) __PYX_ERR(1, 9, __pyx_L1_error) + __Pyx_GOTREF(__pyx_t_2); + __Pyx_DECREF(__pyx_t_2); __pyx_t_2 = 0; + + /* "(tree fragment)":8 + * __Pyx_CheckUnpickleChecksum(__pyx_checksum, 0xa2d29a4, 0xb00362f, 0x8d7a14f, b'beams, docs, golds, moves, states') + * __pyx_result = BeamBatch.__new__(__pyx_type) + * if __pyx_state is not None: # <<<<<<<<<<<<<< + * __pyx_unpickle_BeamBatch__set_state( __pyx_result, __pyx_state) + * return __pyx_result +*/ + } + + /* "(tree fragment)":10 + * if __pyx_state is not None: + * __pyx_unpickle_BeamBatch__set_state( __pyx_result, __pyx_state) + * return __pyx_result # <<<<<<<<<<<<<< + * cdef __pyx_unpickle_BeamBatch__set_state(BeamBatch __pyx_result, __pyx_state: tuple): + * __pyx_result.beams = __pyx_state[0]; __pyx_result.docs = __pyx_state[1]; __pyx_result.golds = __pyx_state[2]; __pyx_result.moves = __pyx_state[3]; __pyx_result.states = __pyx_state[4] +*/ + __Pyx_XDECREF(__pyx_r); + __Pyx_INCREF(__pyx_v___pyx_result); + __pyx_r = __pyx_v___pyx_result; + goto __pyx_L0; + + /* "(tree fragment)":4 + * int __Pyx_CheckUnpickleChecksum(long, long, long, long, const char*) except -1 + * int __Pyx_UpdateUnpickledDict(object, object, Py_ssize_t) except -1 + * def __pyx_unpickle_BeamBatch(__pyx_type, long __pyx_checksum, tuple __pyx_state): # <<<<<<<<<<<<<< + * cdef object __pyx_result + * __Pyx_CheckUnpickleChecksum(__pyx_checksum, 0xa2d29a4, 0xb00362f, 0x8d7a14f, b'beams, docs, golds, moves, states') +*/ + + /* function exit code */ + __pyx_L1_error:; + __Pyx_XDECREF(__pyx_t_2); + __Pyx_XDECREF(__pyx_t_3); + __Pyx_AddTraceback("spacy.pipeline._parser_internals._beam_utils.__pyx_unpickle_BeamBatch", __pyx_clineno, __pyx_lineno, __pyx_filename); + __pyx_r = NULL; + __pyx_L0:; + __Pyx_XDECREF(__pyx_v___pyx_result); + __Pyx_XGIVEREF(__pyx_r); + __Pyx_RefNannyFinishContext(); + return __pyx_r; +} + +/* "(tree fragment)":11 + * __pyx_unpickle_BeamBatch__set_state( __pyx_result, __pyx_state) + * return __pyx_result + * cdef __pyx_unpickle_BeamBatch__set_state(BeamBatch __pyx_result, __pyx_state: tuple): # <<<<<<<<<<<<<< + * __pyx_result.beams = __pyx_state[0]; __pyx_result.docs = __pyx_state[1]; __pyx_result.golds = __pyx_state[2]; __pyx_result.moves = __pyx_state[3]; __pyx_result.states = __pyx_state[4] + * __Pyx_UpdateUnpickledDict(__pyx_result, __pyx_state, 5) +*/ + +static PyObject *__pyx_f_5spacy_8pipeline_17_parser_internals_11_beam_utils___pyx_unpickle_BeamBatch__set_state(struct __pyx_obj_5spacy_8pipeline_17_parser_internals_11_beam_utils_BeamBatch *__pyx_v___pyx_result, PyObject *__pyx_v___pyx_state) { + PyObject *__pyx_r = NULL; + __Pyx_RefNannyDeclarations + PyObject *__pyx_t_1 = NULL; + int __pyx_t_2; + int __pyx_lineno = 0; + const char *__pyx_filename = NULL; + int __pyx_clineno = 0; + __Pyx_RefNannySetupContext("__pyx_unpickle_BeamBatch__set_state", 0); + + /* "(tree fragment)":12 + * return __pyx_result + * cdef __pyx_unpickle_BeamBatch__set_state(BeamBatch __pyx_result, __pyx_state: tuple): + * __pyx_result.beams = __pyx_state[0]; __pyx_result.docs = __pyx_state[1]; __pyx_result.golds = __pyx_state[2]; __pyx_result.moves = __pyx_state[3]; __pyx_result.states = __pyx_state[4] # <<<<<<<<<<<<<< + * __Pyx_UpdateUnpickledDict(__pyx_result, __pyx_state, 5) +*/ + __pyx_t_1 = __Pyx_GetItemInt(__pyx_v___pyx_state, 0, long, 1, __Pyx_PyLong_From_long, 0, 0, 1, 1, __Pyx_ReferenceSharing_FunctionArgument); if (unlikely(!__pyx_t_1)) __PYX_ERR(1, 12, __pyx_L1_error) + __Pyx_GOTREF(__pyx_t_1); + __Pyx_GIVEREF(__pyx_t_1); + __Pyx_GOTREF(__pyx_v___pyx_result->beams); + __Pyx_DECREF(__pyx_v___pyx_result->beams); + __pyx_v___pyx_result->beams = __pyx_t_1; + __pyx_t_1 = 0; + __pyx_t_1 = __Pyx_GetItemInt(__pyx_v___pyx_state, 1, long, 1, __Pyx_PyLong_From_long, 0, 0, 1, 1, __Pyx_ReferenceSharing_FunctionArgument); if (unlikely(!__pyx_t_1)) __PYX_ERR(1, 12, __pyx_L1_error) + __Pyx_GOTREF(__pyx_t_1); + __Pyx_GIVEREF(__pyx_t_1); + __Pyx_GOTREF(__pyx_v___pyx_result->docs); + __Pyx_DECREF(__pyx_v___pyx_result->docs); + __pyx_v___pyx_result->docs = __pyx_t_1; + __pyx_t_1 = 0; + __pyx_t_1 = __Pyx_GetItemInt(__pyx_v___pyx_state, 2, long, 1, __Pyx_PyLong_From_long, 0, 0, 1, 1, __Pyx_ReferenceSharing_FunctionArgument); if (unlikely(!__pyx_t_1)) __PYX_ERR(1, 12, __pyx_L1_error) + __Pyx_GOTREF(__pyx_t_1); + __Pyx_GIVEREF(__pyx_t_1); + __Pyx_GOTREF(__pyx_v___pyx_result->golds); + __Pyx_DECREF(__pyx_v___pyx_result->golds); + __pyx_v___pyx_result->golds = __pyx_t_1; + __pyx_t_1 = 0; + __pyx_t_1 = __Pyx_GetItemInt(__pyx_v___pyx_state, 3, long, 1, __Pyx_PyLong_From_long, 0, 0, 1, 1, __Pyx_ReferenceSharing_FunctionArgument); if (unlikely(!__pyx_t_1)) __PYX_ERR(1, 12, __pyx_L1_error) + __Pyx_GOTREF(__pyx_t_1); + if (!(likely(((__pyx_t_1) == Py_None) || likely(__Pyx_TypeTest(__pyx_t_1, __pyx_mstate_global->__pyx_ptype_5spacy_8pipeline_17_parser_internals_17transition_system_TransitionSystem))))) __PYX_ERR(1, 12, __pyx_L1_error) + __Pyx_GIVEREF(__pyx_t_1); + __Pyx_GOTREF((PyObject *)__pyx_v___pyx_result->moves); + __Pyx_DECREF((PyObject *)__pyx_v___pyx_result->moves); + __pyx_v___pyx_result->moves = ((struct __pyx_obj_5spacy_8pipeline_17_parser_internals_17transition_system_TransitionSystem *)__pyx_t_1); + __pyx_t_1 = 0; + __pyx_t_1 = __Pyx_GetItemInt(__pyx_v___pyx_state, 4, long, 1, __Pyx_PyLong_From_long, 0, 0, 1, 1, __Pyx_ReferenceSharing_FunctionArgument); if (unlikely(!__pyx_t_1)) __PYX_ERR(1, 12, __pyx_L1_error) + __Pyx_GOTREF(__pyx_t_1); + __Pyx_GIVEREF(__pyx_t_1); + __Pyx_GOTREF(__pyx_v___pyx_result->states); + __Pyx_DECREF(__pyx_v___pyx_result->states); + __pyx_v___pyx_result->states = __pyx_t_1; + __pyx_t_1 = 0; + + /* "(tree fragment)":13 + * cdef __pyx_unpickle_BeamBatch__set_state(BeamBatch __pyx_result, __pyx_state: tuple): + * __pyx_result.beams = __pyx_state[0]; __pyx_result.docs = __pyx_state[1]; __pyx_result.golds = __pyx_state[2]; __pyx_result.moves = __pyx_state[3]; __pyx_result.states = __pyx_state[4] + * __Pyx_UpdateUnpickledDict(__pyx_result, __pyx_state, 5) # <<<<<<<<<<<<<< +*/ + __pyx_t_2 = __Pyx_UpdateUnpickledDict(((PyObject *)__pyx_v___pyx_result), __pyx_v___pyx_state, 5); if (unlikely(__pyx_t_2 == ((int)-1))) __PYX_ERR(1, 13, __pyx_L1_error) + + /* "(tree fragment)":11 + * __pyx_unpickle_BeamBatch__set_state( __pyx_result, __pyx_state) + * return __pyx_result + * cdef __pyx_unpickle_BeamBatch__set_state(BeamBatch __pyx_result, __pyx_state: tuple): # <<<<<<<<<<<<<< + * __pyx_result.beams = __pyx_state[0]; __pyx_result.docs = __pyx_state[1]; __pyx_result.golds = __pyx_state[2]; __pyx_result.moves = __pyx_state[3]; __pyx_result.states = __pyx_state[4] + * __Pyx_UpdateUnpickledDict(__pyx_result, __pyx_state, 5) +*/ + + /* function exit code */ + __pyx_r = Py_None; __Pyx_INCREF(Py_None); + goto __pyx_L0; + __pyx_L1_error:; + __Pyx_XDECREF(__pyx_t_1); + __Pyx_AddTraceback("spacy.pipeline._parser_internals._beam_utils.__pyx_unpickle_BeamBatch__set_state", __pyx_clineno, __pyx_lineno, __pyx_filename); + __pyx_r = 0; + __pyx_L0:; + __Pyx_XGIVEREF(__pyx_r); + __Pyx_RefNannyFinishContext(); + return __pyx_r; +} +/* #### Code section: module_exttypes ### */ +static struct __pyx_vtabstruct_5spacy_8pipeline_17_parser_internals_11_beam_utils_BeamBatch __pyx_vtable_5spacy_8pipeline_17_parser_internals_11_beam_utils_BeamBatch; + +static PyObject *__pyx_tp_new_5spacy_8pipeline_17_parser_internals_11_beam_utils_BeamBatch(PyTypeObject *t, CYTHON_UNUSED PyObject *a, CYTHON_UNUSED PyObject *k) { + struct __pyx_obj_5spacy_8pipeline_17_parser_internals_11_beam_utils_BeamBatch *p; + PyObject *o; + o = __Pyx_AllocateExtensionType(t, 0); + if (unlikely(!o)) return 0; + p = ((struct __pyx_obj_5spacy_8pipeline_17_parser_internals_11_beam_utils_BeamBatch *)o); + p->__pyx_vtab = __pyx_vtabptr_5spacy_8pipeline_17_parser_internals_11_beam_utils_BeamBatch; + p->moves = ((struct __pyx_obj_5spacy_8pipeline_17_parser_internals_17transition_system_TransitionSystem *)Py_None); Py_INCREF(Py_None); + p->states = Py_None; Py_INCREF(Py_None); + p->docs = Py_None; Py_INCREF(Py_None); + p->golds = Py_None; Py_INCREF(Py_None); + p->beams = Py_None; Py_INCREF(Py_None); + return o; +} + +static void __pyx_tp_dealloc_5spacy_8pipeline_17_parser_internals_11_beam_utils_BeamBatch(PyObject *o) { + struct __pyx_obj_5spacy_8pipeline_17_parser_internals_11_beam_utils_BeamBatch *p = (struct __pyx_obj_5spacy_8pipeline_17_parser_internals_11_beam_utils_BeamBatch *)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_5spacy_8pipeline_17_parser_internals_11_beam_utils_BeamBatch) { + if (PyObject_CallFinalizerFromDealloc(o)) return; + } + } + #endif + PyObject_GC_UnTrack(o); + Py_CLEAR(p->moves); + Py_CLEAR(p->states); + Py_CLEAR(p->docs); + Py_CLEAR(p->golds); + Py_CLEAR(p->beams); + 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_5spacy_8pipeline_17_parser_internals_11_beam_utils_BeamBatch(PyObject *o, visitproc v, void *a) { + int e; + struct __pyx_obj_5spacy_8pipeline_17_parser_internals_11_beam_utils_BeamBatch *p = (struct __pyx_obj_5spacy_8pipeline_17_parser_internals_11_beam_utils_BeamBatch *)o; + { + e = __Pyx_call_type_traverse(o, 1, v, a); + if (e) return e; + } + if (p->moves) { + e = (*v)(((PyObject *)p->moves), a); if (e) return e; + } + if (p->states) { + e = (*v)(p->states, a); if (e) return e; + } + if (p->docs) { + e = (*v)(p->docs, a); if (e) return e; + } + if (p->golds) { + e = (*v)(p->golds, a); if (e) return e; + } + if (p->beams) { + e = (*v)(p->beams, a); if (e) return e; + } + return 0; +} + +static int __pyx_tp_clear_5spacy_8pipeline_17_parser_internals_11_beam_utils_BeamBatch(PyObject *o) { + PyObject* tmp; + struct __pyx_obj_5spacy_8pipeline_17_parser_internals_11_beam_utils_BeamBatch *p = (struct __pyx_obj_5spacy_8pipeline_17_parser_internals_11_beam_utils_BeamBatch *)o; + tmp = ((PyObject*)p->moves); + p->moves = ((struct __pyx_obj_5spacy_8pipeline_17_parser_internals_17transition_system_TransitionSystem *)Py_None); Py_INCREF(Py_None); + Py_XDECREF(tmp); + tmp = ((PyObject*)p->states); + p->states = Py_None; Py_INCREF(Py_None); + Py_XDECREF(tmp); + tmp = ((PyObject*)p->docs); + p->docs = Py_None; Py_INCREF(Py_None); + Py_XDECREF(tmp); + tmp = ((PyObject*)p->golds); + p->golds = Py_None; Py_INCREF(Py_None); + Py_XDECREF(tmp); + tmp = ((PyObject*)p->beams); + p->beams = Py_None; Py_INCREF(Py_None); + Py_XDECREF(tmp); + return 0; +} + +static PyObject *__pyx_sq_item_5spacy_8pipeline_17_parser_internals_11_beam_utils_BeamBatch(PyObject *o, Py_ssize_t i) { + PyObject *r; + PyObject *x = PyLong_FromSsize_t(i); if(!x) return 0; + #if CYTHON_USE_TYPE_SLOTS || (!CYTHON_USE_TYPE_SPECS && __PYX_LIMITED_VERSION_HEX < 0x030A0000) + r = Py_TYPE(o)->tp_as_mapping->mp_subscript(o, x); + #else + r = ((binaryfunc)PyType_GetSlot(Py_TYPE(o), Py_mp_subscript))(o, x); + #endif + Py_DECREF(x); + return r; +} + +static PyObject *__pyx_getprop_5spacy_8pipeline_17_parser_internals_11_beam_utils_9BeamBatch_is_done(PyObject *o, CYTHON_UNUSED void *x) { + return __pyx_pw_5spacy_8pipeline_17_parser_internals_11_beam_utils_9BeamBatch_7is_done_1__get__(o); +} + +static PyObject *__pyx_getprop_5spacy_8pipeline_17_parser_internals_11_beam_utils_9BeamBatch_moves(PyObject *o, CYTHON_UNUSED void *x) { + return __pyx_pw_5spacy_8pipeline_17_parser_internals_11_beam_utils_9BeamBatch_5moves_1__get__(o); +} + +static int __pyx_setprop_5spacy_8pipeline_17_parser_internals_11_beam_utils_9BeamBatch_moves(PyObject *o, PyObject *v, CYTHON_UNUSED void *x) { + if (v) { + return __pyx_pw_5spacy_8pipeline_17_parser_internals_11_beam_utils_9BeamBatch_5moves_3__set__(o, v); + } + else { + return __pyx_pw_5spacy_8pipeline_17_parser_internals_11_beam_utils_9BeamBatch_5moves_5__del__(o); + } +} + +static PyObject *__pyx_getprop_5spacy_8pipeline_17_parser_internals_11_beam_utils_9BeamBatch_states(PyObject *o, CYTHON_UNUSED void *x) { + return __pyx_pw_5spacy_8pipeline_17_parser_internals_11_beam_utils_9BeamBatch_6states_1__get__(o); +} + +static int __pyx_setprop_5spacy_8pipeline_17_parser_internals_11_beam_utils_9BeamBatch_states(PyObject *o, PyObject *v, CYTHON_UNUSED void *x) { + if (v) { + return __pyx_pw_5spacy_8pipeline_17_parser_internals_11_beam_utils_9BeamBatch_6states_3__set__(o, v); + } + else { + return __pyx_pw_5spacy_8pipeline_17_parser_internals_11_beam_utils_9BeamBatch_6states_5__del__(o); + } +} + +static PyObject *__pyx_getprop_5spacy_8pipeline_17_parser_internals_11_beam_utils_9BeamBatch_docs(PyObject *o, CYTHON_UNUSED void *x) { + return __pyx_pw_5spacy_8pipeline_17_parser_internals_11_beam_utils_9BeamBatch_4docs_1__get__(o); +} + +static int __pyx_setprop_5spacy_8pipeline_17_parser_internals_11_beam_utils_9BeamBatch_docs(PyObject *o, PyObject *v, CYTHON_UNUSED void *x) { + if (v) { + return __pyx_pw_5spacy_8pipeline_17_parser_internals_11_beam_utils_9BeamBatch_4docs_3__set__(o, v); + } + else { + return __pyx_pw_5spacy_8pipeline_17_parser_internals_11_beam_utils_9BeamBatch_4docs_5__del__(o); + } +} + +static PyObject *__pyx_getprop_5spacy_8pipeline_17_parser_internals_11_beam_utils_9BeamBatch_golds(PyObject *o, CYTHON_UNUSED void *x) { + return __pyx_pw_5spacy_8pipeline_17_parser_internals_11_beam_utils_9BeamBatch_5golds_1__get__(o); +} + +static int __pyx_setprop_5spacy_8pipeline_17_parser_internals_11_beam_utils_9BeamBatch_golds(PyObject *o, PyObject *v, CYTHON_UNUSED void *x) { + if (v) { + return __pyx_pw_5spacy_8pipeline_17_parser_internals_11_beam_utils_9BeamBatch_5golds_3__set__(o, v); + } + else { + return __pyx_pw_5spacy_8pipeline_17_parser_internals_11_beam_utils_9BeamBatch_5golds_5__del__(o); + } +} + +static PyObject *__pyx_getprop_5spacy_8pipeline_17_parser_internals_11_beam_utils_9BeamBatch_beams(PyObject *o, CYTHON_UNUSED void *x) { + return __pyx_pw_5spacy_8pipeline_17_parser_internals_11_beam_utils_9BeamBatch_5beams_1__get__(o); +} + +static int __pyx_setprop_5spacy_8pipeline_17_parser_internals_11_beam_utils_9BeamBatch_beams(PyObject *o, PyObject *v, CYTHON_UNUSED void *x) { + if (v) { + return __pyx_pw_5spacy_8pipeline_17_parser_internals_11_beam_utils_9BeamBatch_5beams_3__set__(o, v); + } + else { + return __pyx_pw_5spacy_8pipeline_17_parser_internals_11_beam_utils_9BeamBatch_5beams_5__del__(o); + } +} + +static PyMethodDef __pyx_methods_5spacy_8pipeline_17_parser_internals_11_beam_utils_BeamBatch[] = { + {"get_states", (PyCFunction)(void(*)(void))(__Pyx_PyCFunction_FastCallWithKeywords)__pyx_pw_5spacy_8pipeline_17_parser_internals_11_beam_utils_9BeamBatch_7get_states, __Pyx_METH_FASTCALL|METH_KEYWORDS, __pyx_doc_5spacy_8pipeline_17_parser_internals_11_beam_utils_9BeamBatch_6get_states}, + {"get_unfinished_states", (PyCFunction)(void(*)(void))(__Pyx_PyCFunction_FastCallWithKeywords)__pyx_pw_5spacy_8pipeline_17_parser_internals_11_beam_utils_9BeamBatch_9get_unfinished_states, __Pyx_METH_FASTCALL|METH_KEYWORDS, __pyx_doc_5spacy_8pipeline_17_parser_internals_11_beam_utils_9BeamBatch_8get_unfinished_states}, + {"advance", (PyCFunction)(void(*)(void))(__Pyx_PyCFunction_FastCallWithKeywords)__pyx_pw_5spacy_8pipeline_17_parser_internals_11_beam_utils_9BeamBatch_11advance, __Pyx_METH_FASTCALL|METH_KEYWORDS, __pyx_doc_5spacy_8pipeline_17_parser_internals_11_beam_utils_9BeamBatch_10advance}, + {"_set_costs", (PyCFunction)(void(*)(void))(__Pyx_PyCFunction_FastCallWithKeywords)__pyx_pw_5spacy_8pipeline_17_parser_internals_11_beam_utils_9BeamBatch_13_set_costs, __Pyx_METH_FASTCALL|METH_KEYWORDS, __pyx_doc_5spacy_8pipeline_17_parser_internals_11_beam_utils_9BeamBatch_12_set_costs}, + {"__reduce_cython__", (PyCFunction)(void(*)(void))(__Pyx_PyCFunction_FastCallWithKeywords)__pyx_pw_5spacy_8pipeline_17_parser_internals_11_beam_utils_9BeamBatch_15__reduce_cython__, __Pyx_METH_FASTCALL|METH_KEYWORDS, __pyx_doc_5spacy_8pipeline_17_parser_internals_11_beam_utils_9BeamBatch_14__reduce_cython__}, + {"__setstate_cython__", (PyCFunction)(void(*)(void))(__Pyx_PyCFunction_FastCallWithKeywords)__pyx_pw_5spacy_8pipeline_17_parser_internals_11_beam_utils_9BeamBatch_17__setstate_cython__, __Pyx_METH_FASTCALL|METH_KEYWORDS, __pyx_doc_5spacy_8pipeline_17_parser_internals_11_beam_utils_9BeamBatch_16__setstate_cython__}, + {0, 0, 0, 0} +}; + +static struct PyGetSetDef __pyx_getsets_5spacy_8pipeline_17_parser_internals_11_beam_utils_BeamBatch[] = { + {"is_done", __pyx_getprop_5spacy_8pipeline_17_parser_internals_11_beam_utils_9BeamBatch_is_done, 0, 0, 0}, + {"moves", __pyx_getprop_5spacy_8pipeline_17_parser_internals_11_beam_utils_9BeamBatch_moves, __pyx_setprop_5spacy_8pipeline_17_parser_internals_11_beam_utils_9BeamBatch_moves, PyDoc_STR("moves: spacy.pipeline._parser_internals.transition_system.TransitionSystem"), 0}, + {"states", __pyx_getprop_5spacy_8pipeline_17_parser_internals_11_beam_utils_9BeamBatch_states, __pyx_setprop_5spacy_8pipeline_17_parser_internals_11_beam_utils_9BeamBatch_states, PyDoc_STR("states: object"), 0}, + {"docs", __pyx_getprop_5spacy_8pipeline_17_parser_internals_11_beam_utils_9BeamBatch_docs, __pyx_setprop_5spacy_8pipeline_17_parser_internals_11_beam_utils_9BeamBatch_docs, PyDoc_STR("docs: object"), 0}, + {"golds", __pyx_getprop_5spacy_8pipeline_17_parser_internals_11_beam_utils_9BeamBatch_golds, __pyx_setprop_5spacy_8pipeline_17_parser_internals_11_beam_utils_9BeamBatch_golds, PyDoc_STR("golds: object"), 0}, + {"beams", __pyx_getprop_5spacy_8pipeline_17_parser_internals_11_beam_utils_9BeamBatch_beams, __pyx_setprop_5spacy_8pipeline_17_parser_internals_11_beam_utils_9BeamBatch_beams, PyDoc_STR("beams: object"), 0}, + {0, 0, 0, 0, 0} +}; +#if CYTHON_USE_TYPE_SPECS +static PyType_Slot __pyx_type_5spacy_8pipeline_17_parser_internals_11_beam_utils_BeamBatch_slots[] = { + {Py_tp_dealloc, (void *)__pyx_tp_dealloc_5spacy_8pipeline_17_parser_internals_11_beam_utils_BeamBatch}, + {Py_sq_length, (void *)__pyx_pw_5spacy_8pipeline_17_parser_internals_11_beam_utils_9BeamBatch_5__len__}, + {Py_sq_item, (void *)__pyx_sq_item_5spacy_8pipeline_17_parser_internals_11_beam_utils_BeamBatch}, + {Py_mp_length, (void *)__pyx_pw_5spacy_8pipeline_17_parser_internals_11_beam_utils_9BeamBatch_5__len__}, + {Py_mp_subscript, (void *)__pyx_pw_5spacy_8pipeline_17_parser_internals_11_beam_utils_9BeamBatch_3__getitem__}, + {Py_tp_doc, (void *)PyDoc_STR("BeamBatch(TransitionSystem moves, states, golds, int width, float density=0.)")}, + {Py_tp_traverse, (void *)__pyx_tp_traverse_5spacy_8pipeline_17_parser_internals_11_beam_utils_BeamBatch}, + {Py_tp_clear, (void *)__pyx_tp_clear_5spacy_8pipeline_17_parser_internals_11_beam_utils_BeamBatch}, + {Py_tp_methods, (void *)__pyx_methods_5spacy_8pipeline_17_parser_internals_11_beam_utils_BeamBatch}, + {Py_tp_getset, (void *)__pyx_getsets_5spacy_8pipeline_17_parser_internals_11_beam_utils_BeamBatch}, + {Py_tp_init, (void *)__pyx_pw_5spacy_8pipeline_17_parser_internals_11_beam_utils_9BeamBatch_1__init__}, + {Py_tp_new, (void *)__pyx_tp_new_5spacy_8pipeline_17_parser_internals_11_beam_utils_BeamBatch}, + {0, 0}, +}; +static PyType_Spec __pyx_type_5spacy_8pipeline_17_parser_internals_11_beam_utils_BeamBatch_spec = { + "spacy.pipeline._parser_internals._beam_utils.BeamBatch", + sizeof(struct __pyx_obj_5spacy_8pipeline_17_parser_internals_11_beam_utils_BeamBatch), + 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_5spacy_8pipeline_17_parser_internals_11_beam_utils_BeamBatch_slots, +}; +#else + +static PySequenceMethods __pyx_tp_as_sequence_BeamBatch = { + __pyx_pw_5spacy_8pipeline_17_parser_internals_11_beam_utils_9BeamBatch_5__len__, /*sq_length*/ + 0, /*sq_concat*/ + 0, /*sq_repeat*/ + __pyx_sq_item_5spacy_8pipeline_17_parser_internals_11_beam_utils_BeamBatch, /*sq_item*/ + 0, /*sq_slice*/ + 0, /*sq_ass_item*/ + 0, /*sq_ass_slice*/ + 0, /*sq_contains*/ + 0, /*sq_inplace_concat*/ + 0, /*sq_inplace_repeat*/ +}; + +static PyMappingMethods __pyx_tp_as_mapping_BeamBatch = { + __pyx_pw_5spacy_8pipeline_17_parser_internals_11_beam_utils_9BeamBatch_5__len__, /*mp_length*/ + __pyx_pw_5spacy_8pipeline_17_parser_internals_11_beam_utils_9BeamBatch_3__getitem__, /*mp_subscript*/ + 0, /*mp_ass_subscript*/ +}; + +static PyTypeObject __pyx_type_5spacy_8pipeline_17_parser_internals_11_beam_utils_BeamBatch = { + PyVarObject_HEAD_INIT(0, 0) + "spacy.pipeline._parser_internals._beam_utils.""BeamBatch", /*tp_name*/ + sizeof(struct __pyx_obj_5spacy_8pipeline_17_parser_internals_11_beam_utils_BeamBatch), /*tp_basicsize*/ + 0, /*tp_itemsize*/ + __pyx_tp_dealloc_5spacy_8pipeline_17_parser_internals_11_beam_utils_BeamBatch, /*tp_dealloc*/ + 0, /*tp_vectorcall_offset*/ + 0, /*tp_getattr*/ + 0, /*tp_setattr*/ + 0, /*tp_as_async*/ + 0, /*tp_repr*/ + 0, /*tp_as_number*/ + &__pyx_tp_as_sequence_BeamBatch, /*tp_as_sequence*/ + &__pyx_tp_as_mapping_BeamBatch, /*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("BeamBatch(TransitionSystem moves, states, golds, int width, float density=0.)"), /*tp_doc*/ + __pyx_tp_traverse_5spacy_8pipeline_17_parser_internals_11_beam_utils_BeamBatch, /*tp_traverse*/ + __pyx_tp_clear_5spacy_8pipeline_17_parser_internals_11_beam_utils_BeamBatch, /*tp_clear*/ + 0, /*tp_richcompare*/ + 0, /*tp_weaklistoffset*/ + 0, /*tp_iter*/ + 0, /*tp_iternext*/ + __pyx_methods_5spacy_8pipeline_17_parser_internals_11_beam_utils_BeamBatch, /*tp_methods*/ + 0, /*tp_members*/ + __pyx_getsets_5spacy_8pipeline_17_parser_internals_11_beam_utils_BeamBatch, /*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_5spacy_8pipeline_17_parser_internals_11_beam_utils_9BeamBatch_1__init__, /*tp_init*/ + 0, /*tp_alloc*/ + __pyx_tp_new_5spacy_8pipeline_17_parser_internals_11_beam_utils_BeamBatch, /*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_5spacy_8pipeline_17_parser_internals_11_beam_utils___pyx_scope_struct__genexpr(PyTypeObject *t, CYTHON_UNUSED PyObject *a, CYTHON_UNUSED PyObject *k) { + PyObject *o; + #if CYTHON_USE_FREELISTS + if (likely((int)(__pyx_mstate_global->__pyx_freecount_5spacy_8pipeline_17_parser_internals_11_beam_utils___pyx_scope_struct__genexpr > 0) & __PYX_CHECK_FINAL_TYPE_FOR_FREELISTS(t, __pyx_mstate_global->__pyx_ptype_5spacy_8pipeline_17_parser_internals_11_beam_utils___pyx_scope_struct__genexpr, sizeof(struct __pyx_obj_5spacy_8pipeline_17_parser_internals_11_beam_utils___pyx_scope_struct__genexpr)))) + { + o = (PyObject*)__pyx_mstate_global->__pyx_freelist_5spacy_8pipeline_17_parser_internals_11_beam_utils___pyx_scope_struct__genexpr[--__pyx_mstate_global->__pyx_freecount_5spacy_8pipeline_17_parser_internals_11_beam_utils___pyx_scope_struct__genexpr]; + #if CYTHON_USE_TYPE_SPECS + Py_DECREF(Py_TYPE(o)); + #endif + memset(o, 0, sizeof(struct __pyx_obj_5spacy_8pipeline_17_parser_internals_11_beam_utils___pyx_scope_struct__genexpr)); + #if CYTHON_COMPILING_IN_LIMITED_API + (void) PyObject_Init(o, t); + #else + (void) PyObject_INIT(o, t); + #endif + PyObject_GC_Track(o); + } else + #endif + { + o = __Pyx_AllocateExtensionType(t, 1); + if (unlikely(!o)) return 0; + } + return o; +} + +static void __pyx_tp_dealloc_5spacy_8pipeline_17_parser_internals_11_beam_utils___pyx_scope_struct__genexpr(PyObject *o) { + struct __pyx_obj_5spacy_8pipeline_17_parser_internals_11_beam_utils___pyx_scope_struct__genexpr *p = (struct __pyx_obj_5spacy_8pipeline_17_parser_internals_11_beam_utils___pyx_scope_struct__genexpr *)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_5spacy_8pipeline_17_parser_internals_11_beam_utils___pyx_scope_struct__genexpr) { + if (PyObject_CallFinalizerFromDealloc(o)) return; + } + } + #endif + PyObject_GC_UnTrack(o); + Py_CLEAR(p->__pyx_genexpr_arg_0); + Py_CLEAR(p->__pyx_v_b); + #if CYTHON_USE_FREELISTS + if (likely((int)(__pyx_mstate_global->__pyx_freecount_5spacy_8pipeline_17_parser_internals_11_beam_utils___pyx_scope_struct__genexpr < 8) & __PYX_CHECK_FINAL_TYPE_FOR_FREELISTS(Py_TYPE(o), __pyx_mstate_global->__pyx_ptype_5spacy_8pipeline_17_parser_internals_11_beam_utils___pyx_scope_struct__genexpr, sizeof(struct __pyx_obj_5spacy_8pipeline_17_parser_internals_11_beam_utils___pyx_scope_struct__genexpr)))) + { + __pyx_mstate_global->__pyx_freelist_5spacy_8pipeline_17_parser_internals_11_beam_utils___pyx_scope_struct__genexpr[__pyx_mstate_global->__pyx_freecount_5spacy_8pipeline_17_parser_internals_11_beam_utils___pyx_scope_struct__genexpr++] = ((struct __pyx_obj_5spacy_8pipeline_17_parser_internals_11_beam_utils___pyx_scope_struct__genexpr *)o); + } else + #endif + { + 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_5spacy_8pipeline_17_parser_internals_11_beam_utils___pyx_scope_struct__genexpr(PyObject *o, visitproc v, void *a) { + int e; + struct __pyx_obj_5spacy_8pipeline_17_parser_internals_11_beam_utils___pyx_scope_struct__genexpr *p = (struct __pyx_obj_5spacy_8pipeline_17_parser_internals_11_beam_utils___pyx_scope_struct__genexpr *)o; + { + e = __Pyx_call_type_traverse(o, 1, v, a); + if (e) return e; + } + if (p->__pyx_genexpr_arg_0) { + e = (*v)(p->__pyx_genexpr_arg_0, a); if (e) return e; + } + if (p->__pyx_v_b) { + e = (*v)(p->__pyx_v_b, a); if (e) return e; + } + return 0; +} +#if CYTHON_USE_TYPE_SPECS +static PyType_Slot __pyx_type_5spacy_8pipeline_17_parser_internals_11_beam_utils___pyx_scope_struct__genexpr_slots[] = { + {Py_tp_dealloc, (void *)__pyx_tp_dealloc_5spacy_8pipeline_17_parser_internals_11_beam_utils___pyx_scope_struct__genexpr}, + {Py_tp_traverse, (void *)__pyx_tp_traverse_5spacy_8pipeline_17_parser_internals_11_beam_utils___pyx_scope_struct__genexpr}, + {Py_tp_new, (void *)__pyx_tp_new_5spacy_8pipeline_17_parser_internals_11_beam_utils___pyx_scope_struct__genexpr}, + {0, 0}, +}; +static PyType_Spec __pyx_type_5spacy_8pipeline_17_parser_internals_11_beam_utils___pyx_scope_struct__genexpr_spec = { + "spacy.pipeline._parser_internals._beam_utils.__pyx_scope_struct__genexpr", + sizeof(struct __pyx_obj_5spacy_8pipeline_17_parser_internals_11_beam_utils___pyx_scope_struct__genexpr), + 0, + Py_TPFLAGS_DEFAULT|Py_TPFLAGS_HAVE_VERSION_TAG|Py_TPFLAGS_CHECKTYPES|Py_TPFLAGS_HAVE_NEWBUFFER|Py_TPFLAGS_HAVE_GC, + __pyx_type_5spacy_8pipeline_17_parser_internals_11_beam_utils___pyx_scope_struct__genexpr_slots, +}; +#else + +static PyTypeObject __pyx_type_5spacy_8pipeline_17_parser_internals_11_beam_utils___pyx_scope_struct__genexpr = { + PyVarObject_HEAD_INIT(0, 0) + "spacy.pipeline._parser_internals._beam_utils.""__pyx_scope_struct__genexpr", /*tp_name*/ + sizeof(struct __pyx_obj_5spacy_8pipeline_17_parser_internals_11_beam_utils___pyx_scope_struct__genexpr), /*tp_basicsize*/ + 0, /*tp_itemsize*/ + __pyx_tp_dealloc_5spacy_8pipeline_17_parser_internals_11_beam_utils___pyx_scope_struct__genexpr, /*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_HAVE_GC, /*tp_flags*/ + 0, /*tp_doc*/ + __pyx_tp_traverse_5spacy_8pipeline_17_parser_internals_11_beam_utils___pyx_scope_struct__genexpr, /*tp_traverse*/ + 0, /*tp_clear*/ + 0, /*tp_richcompare*/ + 0, /*tp_weaklistoffset*/ + 0, /*tp_iter*/ + 0, /*tp_iternext*/ + 0, /*tp_methods*/ + 0, /*tp_members*/ + 0, /*tp_getset*/ + 0, /*tp_base*/ + 0, /*tp_dict*/ + 0, /*tp_descr_get*/ + 0, /*tp_descr_set*/ + #if !CYTHON_USE_TYPE_SPECS + 0, /*tp_dictoffset*/ + #endif + 0, /*tp_init*/ + 0, /*tp_alloc*/ + __pyx_tp_new_5spacy_8pipeline_17_parser_internals_11_beam_utils___pyx_scope_struct__genexpr, /*tp_new*/ + 0, /*tp_free*/ + 0, /*tp_is_gc*/ + 0, /*tp_bases*/ + 0, /*tp_mro*/ + 0, /*tp_cache*/ + 0, /*tp_subclasses*/ + 0, /*tp_weaklist*/ + 0, /*tp_del*/ + 0, /*tp_version_tag*/ + #if 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 struct __pyx_vtabstruct_array __pyx_vtable_array; + +static PyObject *__pyx_tp_new_array(PyTypeObject *t, PyObject *a, PyObject *k) { + struct __pyx_array_obj *p; + PyObject *o; + o = __Pyx_AllocateExtensionType(t, 0); + if (unlikely(!o)) return 0; + p = ((struct __pyx_array_obj *)o); + p->__pyx_vtab = __pyx_vtabptr_array; + p->mode = ((PyObject*)Py_None); Py_INCREF(Py_None); + p->_format = ((PyObject*)Py_None); Py_INCREF(Py_None); + if (unlikely(__pyx_array___cinit__(o, a, k) < 0)) goto bad; + return o; + bad: + Py_DECREF(o); o = 0; + return NULL; +} + +static void __pyx_tp_dealloc_array(PyObject *o) { + struct __pyx_array_obj *p = (struct __pyx_array_obj *)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_array) { + if (PyObject_CallFinalizerFromDealloc(o)) return; + } + } + #endif + { + PyObject *etype, *eval, *etb; + PyErr_Fetch(&etype, &eval, &etb); + __Pyx_SET_REFCNT(o, Py_REFCNT(o) + 1); + __pyx_array___dealloc__(o); + __Pyx_SET_REFCNT(o, Py_REFCNT(o) - 1); + PyErr_Restore(etype, eval, etb); + } + Py_CLEAR(p->mode); + Py_CLEAR(p->_format); + 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 PyObject *__pyx_sq_item_array(PyObject *o, Py_ssize_t i) { + PyObject *r; + PyObject *x = PyLong_FromSsize_t(i); if(!x) return 0; + #if CYTHON_USE_TYPE_SLOTS || (!CYTHON_USE_TYPE_SPECS && __PYX_LIMITED_VERSION_HEX < 0x030A0000) + r = Py_TYPE(o)->tp_as_mapping->mp_subscript(o, x); + #else + r = ((binaryfunc)PyType_GetSlot(Py_TYPE(o), Py_mp_subscript))(o, x); + #endif + Py_DECREF(x); + return r; +} + +static int __pyx_mp_ass_subscript_array(PyObject *o, PyObject *i, PyObject *v) { + if (v) { + return __pyx_array___setitem__(o, i, v); + } + else { + __Pyx_TypeName o_type_name; + o_type_name = __Pyx_PyType_GetFullyQualifiedName(Py_TYPE(o)); + PyErr_Format(PyExc_NotImplementedError, + "Subscript deletion not supported by " __Pyx_FMT_TYPENAME, o_type_name); + __Pyx_DECREF_TypeName(o_type_name); + return -1; + } +} + +static PyObject *__pyx_tp_getattro_array(PyObject *o, PyObject *n) { + PyObject *v = PyObject_GenericGetAttr(o, n); + if (!v && PyErr_ExceptionMatches(PyExc_AttributeError)) { + PyErr_Clear(); + v = __pyx_array___getattr__(o, n); + } + return v; +} + +static PyObject *__pyx_getprop___pyx_array_memview(PyObject *o, CYTHON_UNUSED void *x) { + return __pyx_pw_15View_dot_MemoryView_5array_7memview_1__get__(o); +} + +static PyMethodDef __pyx_methods_array[] = { + {"__getattr__", (PyCFunction)__pyx_array___getattr__, METH_O|METH_COEXIST, 0}, + {"__reduce_cython__", (PyCFunction)(void(*)(void))(__Pyx_PyCFunction_FastCallWithKeywords)__pyx_pw___pyx_array_1__reduce_cython__, __Pyx_METH_FASTCALL|METH_KEYWORDS, 0}, + {"__setstate_cython__", (PyCFunction)(void(*)(void))(__Pyx_PyCFunction_FastCallWithKeywords)__pyx_pw___pyx_array_3__setstate_cython__, __Pyx_METH_FASTCALL|METH_KEYWORDS, 0}, + {0, 0, 0, 0} +}; + +static struct PyGetSetDef __pyx_getsets_array[] = { + {"memview", __pyx_getprop___pyx_array_memview, 0, 0, 0}, + {0, 0, 0, 0, 0} +}; +#if CYTHON_USE_TYPE_SPECS +#if !CYTHON_COMPILING_IN_LIMITED_API + +static PyBufferProcs __pyx_tp_as_buffer_array = { + __pyx_array_getbuffer, /*bf_getbuffer*/ + 0, /*bf_releasebuffer*/ +}; +#endif +static PyType_Slot __pyx_type___pyx_array_slots[] = { + {Py_tp_dealloc, (void *)__pyx_tp_dealloc_array}, + {Py_sq_length, (void *)__pyx_array___len__}, + {Py_sq_item, (void *)__pyx_sq_item_array}, + {Py_mp_length, (void *)__pyx_array___len__}, + {Py_mp_subscript, (void *)__pyx_array___getitem__}, + {Py_mp_ass_subscript, (void *)__pyx_mp_ass_subscript_array}, + {Py_tp_getattro, (void *)__pyx_tp_getattro_array}, + #if defined(Py_bf_getbuffer) + {Py_bf_getbuffer, (void *)__pyx_array_getbuffer}, + #endif + {Py_tp_methods, (void *)__pyx_methods_array}, + {Py_tp_getset, (void *)__pyx_getsets_array}, + {Py_tp_new, (void *)__pyx_tp_new_array}, + {0, 0}, +}; +static PyType_Spec __pyx_type___pyx_array_spec = { + "spacy.pipeline._parser_internals._beam_utils.array", + sizeof(struct __pyx_array_obj), + 0, + Py_TPFLAGS_DEFAULT|Py_TPFLAGS_HAVE_VERSION_TAG|Py_TPFLAGS_CHECKTYPES|Py_TPFLAGS_HAVE_NEWBUFFER|Py_TPFLAGS_BASETYPE|Py_TPFLAGS_SEQUENCE, + __pyx_type___pyx_array_slots, +}; +#else + +static PySequenceMethods __pyx_tp_as_sequence_array = { + __pyx_array___len__, /*sq_length*/ + 0, /*sq_concat*/ + 0, /*sq_repeat*/ + __pyx_sq_item_array, /*sq_item*/ + 0, /*sq_slice*/ + 0, /*sq_ass_item*/ + 0, /*sq_ass_slice*/ + 0, /*sq_contains*/ + 0, /*sq_inplace_concat*/ + 0, /*sq_inplace_repeat*/ +}; + +static PyMappingMethods __pyx_tp_as_mapping_array = { + __pyx_array___len__, /*mp_length*/ + __pyx_array___getitem__, /*mp_subscript*/ + __pyx_mp_ass_subscript_array, /*mp_ass_subscript*/ +}; + +static PyBufferProcs __pyx_tp_as_buffer_array = { + __pyx_array_getbuffer, /*bf_getbuffer*/ + 0, /*bf_releasebuffer*/ +}; + +static PyTypeObject __pyx_type___pyx_array = { + PyVarObject_HEAD_INIT(0, 0) + "spacy.pipeline._parser_internals._beam_utils.""array", /*tp_name*/ + sizeof(struct __pyx_array_obj), /*tp_basicsize*/ + 0, /*tp_itemsize*/ + __pyx_tp_dealloc_array, /*tp_dealloc*/ + 0, /*tp_vectorcall_offset*/ + 0, /*tp_getattr*/ + 0, /*tp_setattr*/ + 0, /*tp_as_async*/ + 0, /*tp_repr*/ + 0, /*tp_as_number*/ + &__pyx_tp_as_sequence_array, /*tp_as_sequence*/ + &__pyx_tp_as_mapping_array, /*tp_as_mapping*/ + 0, /*tp_hash*/ + 0, /*tp_call*/ + 0, /*tp_str*/ + __pyx_tp_getattro_array, /*tp_getattro*/ + 0, /*tp_setattro*/ + &__pyx_tp_as_buffer_array, /*tp_as_buffer*/ + Py_TPFLAGS_DEFAULT|Py_TPFLAGS_HAVE_VERSION_TAG|Py_TPFLAGS_CHECKTYPES|Py_TPFLAGS_HAVE_NEWBUFFER|Py_TPFLAGS_BASETYPE|Py_TPFLAGS_SEQUENCE, /*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_array, /*tp_methods*/ + 0, /*tp_members*/ + __pyx_getsets_array, /*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_array, /*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_Enum(PyTypeObject *t, CYTHON_UNUSED PyObject *a, CYTHON_UNUSED PyObject *k) { + struct __pyx_MemviewEnum_obj *p; + PyObject *o; + o = __Pyx_AllocateExtensionType(t, 0); + if (unlikely(!o)) return 0; + p = ((struct __pyx_MemviewEnum_obj *)o); + p->name = Py_None; Py_INCREF(Py_None); + return o; +} + +static void __pyx_tp_dealloc_Enum(PyObject *o) { + struct __pyx_MemviewEnum_obj *p = (struct __pyx_MemviewEnum_obj *)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_Enum) { + if (PyObject_CallFinalizerFromDealloc(o)) return; + } + } + #endif + PyObject_GC_UnTrack(o); + Py_CLEAR(p->name); + 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_Enum(PyObject *o, visitproc v, void *a) { + int e; + struct __pyx_MemviewEnum_obj *p = (struct __pyx_MemviewEnum_obj *)o; + { + e = __Pyx_call_type_traverse(o, 1, v, a); + if (e) return e; + } + if (p->name) { + e = (*v)(p->name, a); if (e) return e; + } + return 0; +} + +static int __pyx_tp_clear_Enum(PyObject *o) { + PyObject* tmp; + struct __pyx_MemviewEnum_obj *p = (struct __pyx_MemviewEnum_obj *)o; + tmp = ((PyObject*)p->name); + p->name = Py_None; Py_INCREF(Py_None); + Py_XDECREF(tmp); + return 0; +} + +static PyMethodDef __pyx_methods_Enum[] = { + {"__reduce_cython__", (PyCFunction)(void(*)(void))(__Pyx_PyCFunction_FastCallWithKeywords)__pyx_pw___pyx_MemviewEnum_1__reduce_cython__, __Pyx_METH_FASTCALL|METH_KEYWORDS, 0}, + {"__setstate_cython__", (PyCFunction)(void(*)(void))(__Pyx_PyCFunction_FastCallWithKeywords)__pyx_pw___pyx_MemviewEnum_3__setstate_cython__, __Pyx_METH_FASTCALL|METH_KEYWORDS, 0}, + {0, 0, 0, 0} +}; +#if CYTHON_USE_TYPE_SPECS +static PyType_Slot __pyx_type___pyx_MemviewEnum_slots[] = { + {Py_tp_dealloc, (void *)__pyx_tp_dealloc_Enum}, + {Py_tp_repr, (void *)__pyx_MemviewEnum___repr__}, + {Py_tp_traverse, (void *)__pyx_tp_traverse_Enum}, + {Py_tp_clear, (void *)__pyx_tp_clear_Enum}, + {Py_tp_methods, (void *)__pyx_methods_Enum}, + {Py_tp_init, (void *)__pyx_MemviewEnum___init__}, + {Py_tp_new, (void *)__pyx_tp_new_Enum}, + {0, 0}, +}; +static PyType_Spec __pyx_type___pyx_MemviewEnum_spec = { + "spacy.pipeline._parser_internals._beam_utils.Enum", + sizeof(struct __pyx_MemviewEnum_obj), + 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___pyx_MemviewEnum_slots, +}; +#else + +static PyTypeObject __pyx_type___pyx_MemviewEnum = { + PyVarObject_HEAD_INIT(0, 0) + "spacy.pipeline._parser_internals._beam_utils.""Enum", /*tp_name*/ + sizeof(struct __pyx_MemviewEnum_obj), /*tp_basicsize*/ + 0, /*tp_itemsize*/ + __pyx_tp_dealloc_Enum, /*tp_dealloc*/ + 0, /*tp_vectorcall_offset*/ + 0, /*tp_getattr*/ + 0, /*tp_setattr*/ + 0, /*tp_as_async*/ + __pyx_MemviewEnum___repr__, /*tp_repr*/ + 0, /*tp_as_number*/ + 0, /*tp_as_sequence*/ + 0, /*tp_as_mapping*/ + 0, /*tp_hash*/ + 0, /*tp_call*/ + 0, /*tp_str*/ + 0, /*tp_getattro*/ + 0, /*tp_setattro*/ + 0, /*tp_as_buffer*/ + Py_TPFLAGS_DEFAULT|Py_TPFLAGS_HAVE_VERSION_TAG|Py_TPFLAGS_CHECKTYPES|Py_TPFLAGS_HAVE_NEWBUFFER|Py_TPFLAGS_BASETYPE|Py_TPFLAGS_HAVE_GC, /*tp_flags*/ + 0, /*tp_doc*/ + __pyx_tp_traverse_Enum, /*tp_traverse*/ + __pyx_tp_clear_Enum, /*tp_clear*/ + 0, /*tp_richcompare*/ + 0, /*tp_weaklistoffset*/ + 0, /*tp_iter*/ + 0, /*tp_iternext*/ + __pyx_methods_Enum, /*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_MemviewEnum___init__, /*tp_init*/ + 0, /*tp_alloc*/ + __pyx_tp_new_Enum, /*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 struct __pyx_vtabstruct_memoryview __pyx_vtable_memoryview; + +static PyObject *__pyx_tp_new_memoryview(PyTypeObject *t, PyObject *a, PyObject *k) { + struct __pyx_memoryview_obj *p; + PyObject *o; + o = __Pyx_AllocateExtensionType(t, 0); + if (unlikely(!o)) return 0; + p = ((struct __pyx_memoryview_obj *)o); + p->__pyx_vtab = __pyx_vtabptr_memoryview; + p->obj = Py_None; Py_INCREF(Py_None); + p->_size = Py_None; Py_INCREF(Py_None); + p->view.obj = NULL; + if (unlikely(__pyx_memoryview___cinit__(o, a, k) < 0)) goto bad; + return o; + bad: + Py_DECREF(o); o = 0; + return NULL; +} + +static void __pyx_tp_dealloc_memoryview(PyObject *o) { + struct __pyx_memoryview_obj *p = (struct __pyx_memoryview_obj *)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_memoryview) { + 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_memoryview___dealloc__(o); + __Pyx_SET_REFCNT(o, Py_REFCNT(o) - 1); + PyErr_Restore(etype, eval, etb); + } + Py_CLEAR(p->obj); + Py_CLEAR(p->_size); + 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_memoryview(PyObject *o, visitproc v, void *a) { + int e; + struct __pyx_memoryview_obj *p = (struct __pyx_memoryview_obj *)o; + { + e = __Pyx_call_type_traverse(o, 1, v, a); + if (e) return e; + } + if (p->obj) { + e = (*v)(p->obj, a); if (e) return e; + } + if (p->_size) { + e = (*v)(p->_size, a); if (e) return e; + } + if (p->view.obj) { + e = (*v)(p->view.obj, a); if (e) return e; + } + return 0; +} + +static int __pyx_tp_clear_memoryview(PyObject *o) { + PyObject* tmp; + struct __pyx_memoryview_obj *p = (struct __pyx_memoryview_obj *)o; + tmp = ((PyObject*)p->obj); + p->obj = Py_None; Py_INCREF(Py_None); + Py_XDECREF(tmp); + tmp = ((PyObject*)p->_size); + p->_size = Py_None; Py_INCREF(Py_None); + Py_XDECREF(tmp); + Py_CLEAR(p->view.obj); + return 0; +} + +static PyObject *__pyx_sq_item_memoryview(PyObject *o, Py_ssize_t i) { + PyObject *r; + PyObject *x = PyLong_FromSsize_t(i); if(!x) return 0; + #if CYTHON_USE_TYPE_SLOTS || (!CYTHON_USE_TYPE_SPECS && __PYX_LIMITED_VERSION_HEX < 0x030A0000) + r = Py_TYPE(o)->tp_as_mapping->mp_subscript(o, x); + #else + r = ((binaryfunc)PyType_GetSlot(Py_TYPE(o), Py_mp_subscript))(o, x); + #endif + Py_DECREF(x); + return r; +} + +static int __pyx_mp_ass_subscript_memoryview(PyObject *o, PyObject *i, PyObject *v) { + if (v) { + return __pyx_memoryview___setitem__(o, i, v); + } + else { + __Pyx_TypeName o_type_name; + o_type_name = __Pyx_PyType_GetFullyQualifiedName(Py_TYPE(o)); + PyErr_Format(PyExc_NotImplementedError, + "Subscript deletion not supported by " __Pyx_FMT_TYPENAME, o_type_name); + __Pyx_DECREF_TypeName(o_type_name); + return -1; + } +} + +static PyObject *__pyx_getprop___pyx_memoryview_T(PyObject *o, CYTHON_UNUSED void *x) { + return __pyx_pw_15View_dot_MemoryView_10memoryview_1T_1__get__(o); +} + +static PyObject *__pyx_getprop___pyx_memoryview_base(PyObject *o, CYTHON_UNUSED void *x) { + return __pyx_pw_15View_dot_MemoryView_10memoryview_4base_1__get__(o); +} + +static PyObject *__pyx_getprop___pyx_memoryview_shape(PyObject *o, CYTHON_UNUSED void *x) { + return __pyx_pw_15View_dot_MemoryView_10memoryview_5shape_1__get__(o); +} + +static PyObject *__pyx_getprop___pyx_memoryview_strides(PyObject *o, CYTHON_UNUSED void *x) { + return __pyx_pw_15View_dot_MemoryView_10memoryview_7strides_1__get__(o); +} + +static PyObject *__pyx_getprop___pyx_memoryview_suboffsets(PyObject *o, CYTHON_UNUSED void *x) { + return __pyx_pw_15View_dot_MemoryView_10memoryview_10suboffsets_1__get__(o); +} + +static PyObject *__pyx_getprop___pyx_memoryview_ndim(PyObject *o, CYTHON_UNUSED void *x) { + return __pyx_pw_15View_dot_MemoryView_10memoryview_4ndim_1__get__(o); +} + +static PyObject *__pyx_getprop___pyx_memoryview_itemsize(PyObject *o, CYTHON_UNUSED void *x) { + return __pyx_pw_15View_dot_MemoryView_10memoryview_8itemsize_1__get__(o); +} + +static PyObject *__pyx_getprop___pyx_memoryview_nbytes(PyObject *o, CYTHON_UNUSED void *x) { + return __pyx_pw_15View_dot_MemoryView_10memoryview_6nbytes_1__get__(o); +} + +static PyObject *__pyx_getprop___pyx_memoryview_size(PyObject *o, CYTHON_UNUSED void *x) { + return __pyx_pw_15View_dot_MemoryView_10memoryview_4size_1__get__(o); +} + +static PyMethodDef __pyx_methods_memoryview[] = { + {"is_c_contig", (PyCFunction)(void(*)(void))(__Pyx_PyCFunction_FastCallWithKeywords)__pyx_memoryview_is_c_contig, __Pyx_METH_FASTCALL|METH_KEYWORDS, 0}, + {"is_f_contig", (PyCFunction)(void(*)(void))(__Pyx_PyCFunction_FastCallWithKeywords)__pyx_memoryview_is_f_contig, __Pyx_METH_FASTCALL|METH_KEYWORDS, 0}, + {"copy", (PyCFunction)(void(*)(void))(__Pyx_PyCFunction_FastCallWithKeywords)__pyx_memoryview_copy, __Pyx_METH_FASTCALL|METH_KEYWORDS, 0}, + {"copy_fortran", (PyCFunction)(void(*)(void))(__Pyx_PyCFunction_FastCallWithKeywords)__pyx_memoryview_copy_fortran, __Pyx_METH_FASTCALL|METH_KEYWORDS, 0}, + {"__reduce_cython__", (PyCFunction)(void(*)(void))(__Pyx_PyCFunction_FastCallWithKeywords)__pyx_pw___pyx_memoryview_1__reduce_cython__, __Pyx_METH_FASTCALL|METH_KEYWORDS, 0}, + {"__setstate_cython__", (PyCFunction)(void(*)(void))(__Pyx_PyCFunction_FastCallWithKeywords)__pyx_pw___pyx_memoryview_3__setstate_cython__, __Pyx_METH_FASTCALL|METH_KEYWORDS, 0}, + {0, 0, 0, 0} +}; + +static struct PyGetSetDef __pyx_getsets_memoryview[] = { + {"T", __pyx_getprop___pyx_memoryview_T, 0, 0, 0}, + {"base", __pyx_getprop___pyx_memoryview_base, 0, 0, 0}, + {"shape", __pyx_getprop___pyx_memoryview_shape, 0, 0, 0}, + {"strides", __pyx_getprop___pyx_memoryview_strides, 0, 0, 0}, + {"suboffsets", __pyx_getprop___pyx_memoryview_suboffsets, 0, 0, 0}, + {"ndim", __pyx_getprop___pyx_memoryview_ndim, 0, 0, 0}, + {"itemsize", __pyx_getprop___pyx_memoryview_itemsize, 0, 0, 0}, + {"nbytes", __pyx_getprop___pyx_memoryview_nbytes, 0, 0, 0}, + {"size", __pyx_getprop___pyx_memoryview_size, 0, 0, 0}, + {0, 0, 0, 0, 0} +}; +#if CYTHON_USE_TYPE_SPECS +#if !CYTHON_COMPILING_IN_LIMITED_API + +static PyBufferProcs __pyx_tp_as_buffer_memoryview = { + __pyx_memoryview_getbuffer, /*bf_getbuffer*/ + 0, /*bf_releasebuffer*/ +}; +#endif +static PyType_Slot __pyx_type___pyx_memoryview_slots[] = { + {Py_tp_dealloc, (void *)__pyx_tp_dealloc_memoryview}, + {Py_tp_repr, (void *)__pyx_memoryview___repr__}, + {Py_sq_length, (void *)__pyx_memoryview___len__}, + {Py_sq_item, (void *)__pyx_sq_item_memoryview}, + {Py_mp_length, (void *)__pyx_memoryview___len__}, + {Py_mp_subscript, (void *)__pyx_memoryview___getitem__}, + {Py_mp_ass_subscript, (void *)__pyx_mp_ass_subscript_memoryview}, + {Py_tp_str, (void *)__pyx_memoryview___str__}, + #if defined(Py_bf_getbuffer) + {Py_bf_getbuffer, (void *)__pyx_memoryview_getbuffer}, + #endif + {Py_tp_traverse, (void *)__pyx_tp_traverse_memoryview}, + {Py_tp_clear, (void *)__pyx_tp_clear_memoryview}, + {Py_tp_methods, (void *)__pyx_methods_memoryview}, + {Py_tp_getset, (void *)__pyx_getsets_memoryview}, + {Py_tp_new, (void *)__pyx_tp_new_memoryview}, + {0, 0}, +}; +static PyType_Spec __pyx_type___pyx_memoryview_spec = { + "spacy.pipeline._parser_internals._beam_utils.memoryview", + sizeof(struct __pyx_memoryview_obj), + 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___pyx_memoryview_slots, +}; +#else + +static PySequenceMethods __pyx_tp_as_sequence_memoryview = { + __pyx_memoryview___len__, /*sq_length*/ + 0, /*sq_concat*/ + 0, /*sq_repeat*/ + __pyx_sq_item_memoryview, /*sq_item*/ + 0, /*sq_slice*/ + 0, /*sq_ass_item*/ + 0, /*sq_ass_slice*/ + 0, /*sq_contains*/ + 0, /*sq_inplace_concat*/ + 0, /*sq_inplace_repeat*/ +}; + +static PyMappingMethods __pyx_tp_as_mapping_memoryview = { + __pyx_memoryview___len__, /*mp_length*/ + __pyx_memoryview___getitem__, /*mp_subscript*/ + __pyx_mp_ass_subscript_memoryview, /*mp_ass_subscript*/ +}; + +static PyBufferProcs __pyx_tp_as_buffer_memoryview = { + __pyx_memoryview_getbuffer, /*bf_getbuffer*/ + 0, /*bf_releasebuffer*/ +}; + +static PyTypeObject __pyx_type___pyx_memoryview = { + PyVarObject_HEAD_INIT(0, 0) + "spacy.pipeline._parser_internals._beam_utils.""memoryview", /*tp_name*/ + sizeof(struct __pyx_memoryview_obj), /*tp_basicsize*/ + 0, /*tp_itemsize*/ + __pyx_tp_dealloc_memoryview, /*tp_dealloc*/ + 0, /*tp_vectorcall_offset*/ + 0, /*tp_getattr*/ + 0, /*tp_setattr*/ + 0, /*tp_as_async*/ + __pyx_memoryview___repr__, /*tp_repr*/ + 0, /*tp_as_number*/ + &__pyx_tp_as_sequence_memoryview, /*tp_as_sequence*/ + &__pyx_tp_as_mapping_memoryview, /*tp_as_mapping*/ + 0, /*tp_hash*/ + 0, /*tp_call*/ + __pyx_memoryview___str__, /*tp_str*/ + 0, /*tp_getattro*/ + 0, /*tp_setattro*/ + &__pyx_tp_as_buffer_memoryview, /*tp_as_buffer*/ + Py_TPFLAGS_DEFAULT|Py_TPFLAGS_HAVE_VERSION_TAG|Py_TPFLAGS_CHECKTYPES|Py_TPFLAGS_HAVE_NEWBUFFER|Py_TPFLAGS_BASETYPE|Py_TPFLAGS_HAVE_GC, /*tp_flags*/ + 0, /*tp_doc*/ + __pyx_tp_traverse_memoryview, /*tp_traverse*/ + __pyx_tp_clear_memoryview, /*tp_clear*/ + 0, /*tp_richcompare*/ + 0, /*tp_weaklistoffset*/ + 0, /*tp_iter*/ + 0, /*tp_iternext*/ + __pyx_methods_memoryview, /*tp_methods*/ + 0, /*tp_members*/ + __pyx_getsets_memoryview, /*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_memoryview, /*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 struct __pyx_vtabstruct__memoryviewslice __pyx_vtable__memoryviewslice; + +static PyObject *__pyx_tp_new__memoryviewslice(PyTypeObject *t, PyObject *a, PyObject *k) { + struct __pyx_memoryviewslice_obj *p; + PyObject *o = __pyx_tp_new_memoryview(t, a, k); + if (unlikely(!o)) return 0; + p = ((struct __pyx_memoryviewslice_obj *)o); + p->__pyx_base.__pyx_vtab = (struct __pyx_vtabstruct_memoryview*)__pyx_vtabptr__memoryviewslice; + __Pyx_default_placement_construct(&(p->from_slice)); + p->from_object = Py_None; Py_INCREF(Py_None); + p->from_slice.memview = NULL; + return o; +} + +static void __pyx_tp_dealloc__memoryviewslice(PyObject *o) { + struct __pyx_memoryviewslice_obj *p = (struct __pyx_memoryviewslice_obj *)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__memoryviewslice) { + 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_memoryviewslice___dealloc__(o); + __Pyx_SET_REFCNT(o, Py_REFCNT(o) - 1); + PyErr_Restore(etype, eval, etb); + } + __Pyx_call_destructor(p->from_slice); + Py_CLEAR(p->from_object); + PyObject_GC_Track(o); + __pyx_tp_dealloc_memoryview(o); +} + +static int __pyx_tp_traverse__memoryviewslice(PyObject *o, visitproc v, void *a) { + int e; + struct __pyx_memoryviewslice_obj *p = (struct __pyx_memoryviewslice_obj *)o; + e = __pyx_tp_traverse_memoryview(o, v, a); if (e) return e; + if (p->from_object) { + e = (*v)(p->from_object, a); if (e) return e; + } + return 0; +} + +static int __pyx_tp_clear__memoryviewslice(PyObject *o) { + PyObject* tmp; + struct __pyx_memoryviewslice_obj *p = (struct __pyx_memoryviewslice_obj *)o; + __pyx_tp_clear_memoryview(o); + tmp = ((PyObject*)p->from_object); + p->from_object = Py_None; Py_INCREF(Py_None); + Py_XDECREF(tmp); + __PYX_XCLEAR_MEMVIEW(&p->from_slice, 1); + return 0; +} + +static PyMethodDef __pyx_methods__memoryviewslice[] = { + {"__reduce_cython__", (PyCFunction)(void(*)(void))(__Pyx_PyCFunction_FastCallWithKeywords)__pyx_pw___pyx_memoryviewslice_1__reduce_cython__, __Pyx_METH_FASTCALL|METH_KEYWORDS, 0}, + {"__setstate_cython__", (PyCFunction)(void(*)(void))(__Pyx_PyCFunction_FastCallWithKeywords)__pyx_pw___pyx_memoryviewslice_3__setstate_cython__, __Pyx_METH_FASTCALL|METH_KEYWORDS, 0}, + {0, 0, 0, 0} +}; +#if CYTHON_USE_TYPE_SPECS +static PyType_Slot __pyx_type___pyx_memoryviewslice_slots[] = { + {Py_tp_dealloc, (void *)__pyx_tp_dealloc__memoryviewslice}, + {Py_tp_doc, (void *)PyDoc_STR("Internal class for passing memoryview slices to Python")}, + {Py_tp_traverse, (void *)__pyx_tp_traverse__memoryviewslice}, + {Py_tp_clear, (void *)__pyx_tp_clear__memoryviewslice}, + {Py_tp_methods, (void *)__pyx_methods__memoryviewslice}, + {Py_tp_new, (void *)__pyx_tp_new__memoryviewslice}, + {0, 0}, +}; +static PyType_Spec __pyx_type___pyx_memoryviewslice_spec = { + "spacy.pipeline._parser_internals._beam_utils._memoryviewslice", + sizeof(struct __pyx_memoryviewslice_obj), + 0, + Py_TPFLAGS_DEFAULT|Py_TPFLAGS_HAVE_VERSION_TAG|Py_TPFLAGS_CHECKTYPES|Py_TPFLAGS_HAVE_NEWBUFFER|Py_TPFLAGS_BASETYPE|Py_TPFLAGS_HAVE_GC|Py_TPFLAGS_SEQUENCE, + __pyx_type___pyx_memoryviewslice_slots, +}; +#else + +static PyTypeObject __pyx_type___pyx_memoryviewslice = { + PyVarObject_HEAD_INIT(0, 0) + "spacy.pipeline._parser_internals._beam_utils.""_memoryviewslice", /*tp_name*/ + sizeof(struct __pyx_memoryviewslice_obj), /*tp_basicsize*/ + 0, /*tp_itemsize*/ + __pyx_tp_dealloc__memoryviewslice, /*tp_dealloc*/ + 0, /*tp_vectorcall_offset*/ + 0, /*tp_getattr*/ + 0, /*tp_setattr*/ + 0, /*tp_as_async*/ + #if CYTHON_COMPILING_IN_PYPY || 0 + __pyx_memoryview___repr__, /*tp_repr*/ + #else + 0, /*tp_repr*/ + #endif + 0, /*tp_as_number*/ + 0, /*tp_as_sequence*/ + 0, /*tp_as_mapping*/ + 0, /*tp_hash*/ + 0, /*tp_call*/ + #if CYTHON_COMPILING_IN_PYPY || 0 + __pyx_memoryview___str__, /*tp_str*/ + #else + 0, /*tp_str*/ + #endif + 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|Py_TPFLAGS_SEQUENCE, /*tp_flags*/ + PyDoc_STR("Internal class for passing memoryview slices to Python"), /*tp_doc*/ + __pyx_tp_traverse__memoryviewslice, /*tp_traverse*/ + __pyx_tp_clear__memoryviewslice, /*tp_clear*/ + 0, /*tp_richcompare*/ + 0, /*tp_weaklistoffset*/ + 0, /*tp_iter*/ + 0, /*tp_iternext*/ + __pyx_methods__memoryviewslice, /*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__memoryviewslice, /*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_collections_abc_Sequence = Py_None; Py_INCREF(Py_None); + generic = Py_None; Py_INCREF(Py_None); + strided = Py_None; Py_INCREF(Py_None); + indirect = Py_None; Py_INCREF(Py_None); + contiguous = Py_None; Py_INCREF(Py_None); + indirect_contiguous = Py_None; Py_INCREF(Py_None); + __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_int_void_void_int_void_void___py); + #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 + 84; + void (*const __pyx_export_pointers[])(void) = {(void (*)(void))&__pyx_f_5spacy_8pipeline_17_parser_internals_11_beam_utils_check_final_state, (void (*)(void))&__pyx_f_5spacy_8pipeline_17_parser_internals_11_beam_utils_transition_state, (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); + PyObject *__pyx_t_1 = NULL; + int __pyx_lineno = 0; + const char *__pyx_filename = NULL; + int __pyx_clineno = 0; + __Pyx_RefNannySetupContext("__Pyx_modinit_type_init_code", 0); + /*--- Type init code ---*/ + __pyx_vtabptr_5spacy_8pipeline_17_parser_internals_11_beam_utils_BeamBatch = &__pyx_vtable_5spacy_8pipeline_17_parser_internals_11_beam_utils_BeamBatch; + __pyx_vtable_5spacy_8pipeline_17_parser_internals_11_beam_utils_BeamBatch._set_scores = (int (*)(struct __pyx_obj_5spacy_8pipeline_17_parser_internals_11_beam_utils_BeamBatch *, struct __pyx_obj_5thinc_5extra_6search_Beam *, float const *, int))__pyx_f_5spacy_8pipeline_17_parser_internals_11_beam_utils_9BeamBatch__set_scores; + #if CYTHON_USE_TYPE_SPECS + __pyx_mstate->__pyx_ptype_5spacy_8pipeline_17_parser_internals_11_beam_utils_BeamBatch = (PyTypeObject *) __Pyx_PyType_FromModuleAndSpec(__pyx_m, &__pyx_type_5spacy_8pipeline_17_parser_internals_11_beam_utils_BeamBatch_spec, NULL); if (unlikely(!__pyx_mstate->__pyx_ptype_5spacy_8pipeline_17_parser_internals_11_beam_utils_BeamBatch)) __PYX_ERR(0, 32, __pyx_L1_error) + if (__Pyx_fix_up_extension_type_from_spec(&__pyx_type_5spacy_8pipeline_17_parser_internals_11_beam_utils_BeamBatch_spec, __pyx_mstate->__pyx_ptype_5spacy_8pipeline_17_parser_internals_11_beam_utils_BeamBatch) < (0)) __PYX_ERR(0, 32, __pyx_L1_error) + #else + __pyx_mstate->__pyx_ptype_5spacy_8pipeline_17_parser_internals_11_beam_utils_BeamBatch = &__pyx_type_5spacy_8pipeline_17_parser_internals_11_beam_utils_BeamBatch; + #endif + #if !CYTHON_COMPILING_IN_LIMITED_API + #endif + #if !CYTHON_USE_TYPE_SPECS + if (__Pyx_PyType_Ready(__pyx_mstate->__pyx_ptype_5spacy_8pipeline_17_parser_internals_11_beam_utils_BeamBatch) < (0)) __PYX_ERR(0, 32, __pyx_L1_error) + #endif + #if CYTHON_COMPILING_IN_CPYTHON && PY_VERSION_HEX >= 0x030E0000 + PyUnstable_Object_EnableDeferredRefcount((PyObject*)__pyx_mstate->__pyx_ptype_5spacy_8pipeline_17_parser_internals_11_beam_utils_BeamBatch); + #endif + #if !CYTHON_COMPILING_IN_LIMITED_API + if ((CYTHON_USE_TYPE_SLOTS && CYTHON_USE_PYTYPE_LOOKUP) && likely(!__pyx_mstate->__pyx_ptype_5spacy_8pipeline_17_parser_internals_11_beam_utils_BeamBatch->tp_dictoffset && __pyx_mstate->__pyx_ptype_5spacy_8pipeline_17_parser_internals_11_beam_utils_BeamBatch->tp_getattro == PyObject_GenericGetAttr)) { + __pyx_mstate->__pyx_ptype_5spacy_8pipeline_17_parser_internals_11_beam_utils_BeamBatch->tp_getattro = PyObject_GenericGetAttr; + } + #endif + if (__Pyx_SetVtable(__pyx_mstate->__pyx_ptype_5spacy_8pipeline_17_parser_internals_11_beam_utils_BeamBatch, __pyx_vtabptr_5spacy_8pipeline_17_parser_internals_11_beam_utils_BeamBatch) < (0)) __PYX_ERR(0, 32, __pyx_L1_error) + if (__Pyx_MergeVtables(__pyx_mstate->__pyx_ptype_5spacy_8pipeline_17_parser_internals_11_beam_utils_BeamBatch) < (0)) __PYX_ERR(0, 32, __pyx_L1_error) + if (PyObject_SetAttr(__pyx_m, __pyx_mstate_global->__pyx_n_u_BeamBatch, (PyObject *) __pyx_mstate->__pyx_ptype_5spacy_8pipeline_17_parser_internals_11_beam_utils_BeamBatch) < (0)) __PYX_ERR(0, 32, __pyx_L1_error) + if (__Pyx_setup_reduce((PyObject *) __pyx_mstate->__pyx_ptype_5spacy_8pipeline_17_parser_internals_11_beam_utils_BeamBatch) < (0)) __PYX_ERR(0, 32, __pyx_L1_error) + #if CYTHON_USE_TYPE_SPECS + __pyx_mstate->__pyx_ptype_5spacy_8pipeline_17_parser_internals_11_beam_utils___pyx_scope_struct__genexpr = (PyTypeObject *) __Pyx_PyType_FromModuleAndSpec(__pyx_m, &__pyx_type_5spacy_8pipeline_17_parser_internals_11_beam_utils___pyx_scope_struct__genexpr_spec, NULL); if (unlikely(!__pyx_mstate->__pyx_ptype_5spacy_8pipeline_17_parser_internals_11_beam_utils___pyx_scope_struct__genexpr)) __PYX_ERR(0, 62, __pyx_L1_error) + if (__Pyx_fix_up_extension_type_from_spec(&__pyx_type_5spacy_8pipeline_17_parser_internals_11_beam_utils___pyx_scope_struct__genexpr_spec, __pyx_mstate->__pyx_ptype_5spacy_8pipeline_17_parser_internals_11_beam_utils___pyx_scope_struct__genexpr) < (0)) __PYX_ERR(0, 62, __pyx_L1_error) + #else + __pyx_mstate->__pyx_ptype_5spacy_8pipeline_17_parser_internals_11_beam_utils___pyx_scope_struct__genexpr = &__pyx_type_5spacy_8pipeline_17_parser_internals_11_beam_utils___pyx_scope_struct__genexpr; + #endif + #if !CYTHON_COMPILING_IN_LIMITED_API + #endif + #if !CYTHON_USE_TYPE_SPECS + if (__Pyx_PyType_Ready(__pyx_mstate->__pyx_ptype_5spacy_8pipeline_17_parser_internals_11_beam_utils___pyx_scope_struct__genexpr) < (0)) __PYX_ERR(0, 62, __pyx_L1_error) + #endif + #if CYTHON_COMPILING_IN_CPYTHON && PY_VERSION_HEX >= 0x030E0000 + PyUnstable_Object_EnableDeferredRefcount((PyObject*)__pyx_mstate->__pyx_ptype_5spacy_8pipeline_17_parser_internals_11_beam_utils___pyx_scope_struct__genexpr); + #endif + #if !CYTHON_COMPILING_IN_LIMITED_API + if ((CYTHON_USE_TYPE_SLOTS && CYTHON_USE_PYTYPE_LOOKUP) && likely(!__pyx_mstate->__pyx_ptype_5spacy_8pipeline_17_parser_internals_11_beam_utils___pyx_scope_struct__genexpr->tp_dictoffset && __pyx_mstate->__pyx_ptype_5spacy_8pipeline_17_parser_internals_11_beam_utils___pyx_scope_struct__genexpr->tp_getattro == PyObject_GenericGetAttr)) { + __pyx_mstate->__pyx_ptype_5spacy_8pipeline_17_parser_internals_11_beam_utils___pyx_scope_struct__genexpr->tp_getattro = PyObject_GenericGetAttr; + } + #endif + __pyx_vtabptr_array = &__pyx_vtable_array; + __pyx_vtable_array.get_memview = (PyObject *(*)(struct __pyx_array_obj *))__pyx_array_get_memview; + #if CYTHON_USE_TYPE_SPECS + __pyx_mstate->__pyx_array_type = (PyTypeObject *) __Pyx_PyType_FromModuleAndSpec(__pyx_m, &__pyx_type___pyx_array_spec, NULL); if (unlikely(!__pyx_mstate->__pyx_array_type)) __PYX_ERR(1, 110, __pyx_L1_error) + #if !CYTHON_COMPILING_IN_LIMITED_API + __pyx_mstate->__pyx_array_type->tp_as_buffer = &__pyx_tp_as_buffer_array; + if (!__pyx_mstate->__pyx_array_type->tp_as_buffer->bf_releasebuffer && __pyx_mstate->__pyx_array_type->tp_base->tp_as_buffer && __pyx_mstate->__pyx_array_type->tp_base->tp_as_buffer->bf_releasebuffer) { + __pyx_mstate->__pyx_array_type->tp_as_buffer->bf_releasebuffer = __pyx_mstate->__pyx_array_type->tp_base->tp_as_buffer->bf_releasebuffer; + } + #elif defined(Py_bf_getbuffer) && defined(Py_bf_releasebuffer) + /* PY_VERSION_HEX >= 0x03090000 || Py_LIMITED_API >= 0x030B0000 */ + #elif defined(_MSC_VER) + #pragma message ("The buffer protocol is not supported in the Limited C-API < 3.11.") + #else + #warning "The buffer protocol is not supported in the Limited C-API < 3.11." + #endif + if (__Pyx_fix_up_extension_type_from_spec(&__pyx_type___pyx_array_spec, __pyx_mstate->__pyx_array_type) < (0)) __PYX_ERR(1, 110, __pyx_L1_error) + #else + __pyx_mstate->__pyx_array_type = &__pyx_type___pyx_array; + #endif + #if !CYTHON_COMPILING_IN_LIMITED_API + #endif + #if !CYTHON_USE_TYPE_SPECS + if (__Pyx_PyType_Ready(__pyx_mstate->__pyx_array_type) < (0)) __PYX_ERR(1, 110, __pyx_L1_error) + #endif + #if CYTHON_COMPILING_IN_CPYTHON && PY_VERSION_HEX >= 0x030E0000 + PyUnstable_Object_EnableDeferredRefcount((PyObject*)__pyx_mstate->__pyx_array_type); + #endif + if (__Pyx_SetVtable(__pyx_mstate->__pyx_array_type, __pyx_vtabptr_array) < (0)) __PYX_ERR(1, 110, __pyx_L1_error) + if (__Pyx_MergeVtables(__pyx_mstate->__pyx_array_type) < (0)) __PYX_ERR(1, 110, __pyx_L1_error) + if (__Pyx_setup_reduce((PyObject *) __pyx_mstate->__pyx_array_type) < (0)) __PYX_ERR(1, 110, __pyx_L1_error) + #if CYTHON_USE_TYPE_SPECS + __pyx_mstate->__pyx_MemviewEnum_type = (PyTypeObject *) __Pyx_PyType_FromModuleAndSpec(__pyx_m, &__pyx_type___pyx_MemviewEnum_spec, NULL); if (unlikely(!__pyx_mstate->__pyx_MemviewEnum_type)) __PYX_ERR(1, 299, __pyx_L1_error) + if (__Pyx_fix_up_extension_type_from_spec(&__pyx_type___pyx_MemviewEnum_spec, __pyx_mstate->__pyx_MemviewEnum_type) < (0)) __PYX_ERR(1, 299, __pyx_L1_error) + #else + __pyx_mstate->__pyx_MemviewEnum_type = &__pyx_type___pyx_MemviewEnum; + #endif + #if !CYTHON_COMPILING_IN_LIMITED_API + #endif + #if !CYTHON_USE_TYPE_SPECS + if (__Pyx_PyType_Ready(__pyx_mstate->__pyx_MemviewEnum_type) < (0)) __PYX_ERR(1, 299, __pyx_L1_error) + #endif + #if CYTHON_COMPILING_IN_CPYTHON && PY_VERSION_HEX >= 0x030E0000 + PyUnstable_Object_EnableDeferredRefcount((PyObject*)__pyx_mstate->__pyx_MemviewEnum_type); + #endif + #if !CYTHON_COMPILING_IN_LIMITED_API + if ((CYTHON_USE_TYPE_SLOTS && CYTHON_USE_PYTYPE_LOOKUP) && likely(!__pyx_mstate->__pyx_MemviewEnum_type->tp_dictoffset && __pyx_mstate->__pyx_MemviewEnum_type->tp_getattro == PyObject_GenericGetAttr)) { + __pyx_mstate->__pyx_MemviewEnum_type->tp_getattro = PyObject_GenericGetAttr; + } + #endif + if (__Pyx_setup_reduce((PyObject *) __pyx_mstate->__pyx_MemviewEnum_type) < (0)) __PYX_ERR(1, 299, __pyx_L1_error) + __pyx_vtabptr_memoryview = &__pyx_vtable_memoryview; + __pyx_vtable_memoryview.get_item_pointer = (char *(*)(struct __pyx_memoryview_obj *, PyObject *))__pyx_memoryview_get_item_pointer; + __pyx_vtable_memoryview.is_slice = (PyObject *(*)(struct __pyx_memoryview_obj *, PyObject *))__pyx_memoryview_is_slice; + __pyx_vtable_memoryview.setitem_slice_assignment = (PyObject *(*)(struct __pyx_memoryview_obj *, PyObject *, PyObject *))__pyx_memoryview_setitem_slice_assignment; + __pyx_vtable_memoryview.setitem_slice_assign_scalar = (PyObject *(*)(struct __pyx_memoryview_obj *, struct __pyx_memoryview_obj *, PyObject *))__pyx_memoryview_setitem_slice_assign_scalar; + __pyx_vtable_memoryview.setitem_indexed = (PyObject *(*)(struct __pyx_memoryview_obj *, PyObject *, PyObject *))__pyx_memoryview_setitem_indexed; + __pyx_vtable_memoryview.convert_item_to_object = (PyObject *(*)(struct __pyx_memoryview_obj *, char *))__pyx_memoryview_convert_item_to_object; + __pyx_vtable_memoryview.assign_item_from_object = (PyObject *(*)(struct __pyx_memoryview_obj *, char *, PyObject *))__pyx_memoryview_assign_item_from_object; + __pyx_vtable_memoryview._get_base = (PyObject *(*)(struct __pyx_memoryview_obj *))__pyx_memoryview__get_base; + #if CYTHON_USE_TYPE_SPECS + __pyx_mstate->__pyx_memoryview_type = (PyTypeObject *) __Pyx_PyType_FromModuleAndSpec(__pyx_m, &__pyx_type___pyx_memoryview_spec, NULL); if (unlikely(!__pyx_mstate->__pyx_memoryview_type)) __PYX_ERR(1, 334, __pyx_L1_error) + #if !CYTHON_COMPILING_IN_LIMITED_API + __pyx_mstate->__pyx_memoryview_type->tp_as_buffer = &__pyx_tp_as_buffer_memoryview; + if (!__pyx_mstate->__pyx_memoryview_type->tp_as_buffer->bf_releasebuffer && __pyx_mstate->__pyx_memoryview_type->tp_base->tp_as_buffer && __pyx_mstate->__pyx_memoryview_type->tp_base->tp_as_buffer->bf_releasebuffer) { + __pyx_mstate->__pyx_memoryview_type->tp_as_buffer->bf_releasebuffer = __pyx_mstate->__pyx_memoryview_type->tp_base->tp_as_buffer->bf_releasebuffer; + } + #elif defined(Py_bf_getbuffer) && defined(Py_bf_releasebuffer) + /* PY_VERSION_HEX >= 0x03090000 || Py_LIMITED_API >= 0x030B0000 */ + #elif defined(_MSC_VER) + #pragma message ("The buffer protocol is not supported in the Limited C-API < 3.11.") + #else + #warning "The buffer protocol is not supported in the Limited C-API < 3.11." + #endif + if (__Pyx_fix_up_extension_type_from_spec(&__pyx_type___pyx_memoryview_spec, __pyx_mstate->__pyx_memoryview_type) < (0)) __PYX_ERR(1, 334, __pyx_L1_error) + #else + __pyx_mstate->__pyx_memoryview_type = &__pyx_type___pyx_memoryview; + #endif + #if !CYTHON_COMPILING_IN_LIMITED_API + #endif + #if !CYTHON_USE_TYPE_SPECS + if (__Pyx_PyType_Ready(__pyx_mstate->__pyx_memoryview_type) < (0)) __PYX_ERR(1, 334, __pyx_L1_error) + #endif + #if CYTHON_COMPILING_IN_CPYTHON && PY_VERSION_HEX >= 0x030E0000 + PyUnstable_Object_EnableDeferredRefcount((PyObject*)__pyx_mstate->__pyx_memoryview_type); + #endif + #if !CYTHON_COMPILING_IN_LIMITED_API + if ((CYTHON_USE_TYPE_SLOTS && CYTHON_USE_PYTYPE_LOOKUP) && likely(!__pyx_mstate->__pyx_memoryview_type->tp_dictoffset && __pyx_mstate->__pyx_memoryview_type->tp_getattro == PyObject_GenericGetAttr)) { + __pyx_mstate->__pyx_memoryview_type->tp_getattro = PyObject_GenericGetAttr; + } + #endif + if (__Pyx_SetVtable(__pyx_mstate->__pyx_memoryview_type, __pyx_vtabptr_memoryview) < (0)) __PYX_ERR(1, 334, __pyx_L1_error) + if (__Pyx_MergeVtables(__pyx_mstate->__pyx_memoryview_type) < (0)) __PYX_ERR(1, 334, __pyx_L1_error) + if (__Pyx_setup_reduce((PyObject *) __pyx_mstate->__pyx_memoryview_type) < (0)) __PYX_ERR(1, 334, __pyx_L1_error) + __pyx_vtabptr__memoryviewslice = &__pyx_vtable__memoryviewslice; + __pyx_vtable__memoryviewslice.__pyx_base = *__pyx_vtabptr_memoryview; + __pyx_vtable__memoryviewslice.__pyx_base.convert_item_to_object = (PyObject *(*)(struct __pyx_memoryview_obj *, char *))__pyx_memoryviewslice_convert_item_to_object; + __pyx_vtable__memoryviewslice.__pyx_base.assign_item_from_object = (PyObject *(*)(struct __pyx_memoryview_obj *, char *, PyObject *))__pyx_memoryviewslice_assign_item_from_object; + __pyx_vtable__memoryviewslice.__pyx_base._get_base = (PyObject *(*)(struct __pyx_memoryview_obj *))__pyx_memoryviewslice__get_base; + #if CYTHON_USE_TYPE_SPECS + __pyx_t_1 = PyTuple_Pack(1, (PyObject *)__pyx_mstate_global->__pyx_memoryview_type); if (unlikely(!__pyx_t_1)) __PYX_ERR(1, 951, __pyx_L1_error) + __Pyx_GOTREF(__pyx_t_1); + __pyx_mstate->__pyx_memoryviewslice_type = (PyTypeObject *) __Pyx_PyType_FromModuleAndSpec(__pyx_m, &__pyx_type___pyx_memoryviewslice_spec, __pyx_t_1); + __Pyx_XDECREF(__pyx_t_1); __pyx_t_1 = 0; + if (unlikely(!__pyx_mstate->__pyx_memoryviewslice_type)) __PYX_ERR(1, 951, __pyx_L1_error) + if (__Pyx_fix_up_extension_type_from_spec(&__pyx_type___pyx_memoryviewslice_spec, __pyx_mstate->__pyx_memoryviewslice_type) < (0)) __PYX_ERR(1, 951, __pyx_L1_error) + #else + __pyx_mstate->__pyx_memoryviewslice_type = &__pyx_type___pyx_memoryviewslice; + #endif + #if !CYTHON_COMPILING_IN_LIMITED_API + __pyx_mstate_global->__pyx_memoryviewslice_type->tp_base = __pyx_mstate_global->__pyx_memoryview_type; + #endif + #if !CYTHON_USE_TYPE_SPECS + if (__Pyx_PyType_Ready(__pyx_mstate->__pyx_memoryviewslice_type) < (0)) __PYX_ERR(1, 951, __pyx_L1_error) + #endif + #if CYTHON_COMPILING_IN_CPYTHON && PY_VERSION_HEX >= 0x030E0000 + PyUnstable_Object_EnableDeferredRefcount((PyObject*)__pyx_mstate->__pyx_memoryviewslice_type); + #endif + #if !CYTHON_COMPILING_IN_LIMITED_API + if ((CYTHON_USE_TYPE_SLOTS && CYTHON_USE_PYTYPE_LOOKUP) && likely(!__pyx_mstate->__pyx_memoryviewslice_type->tp_dictoffset && __pyx_mstate->__pyx_memoryviewslice_type->tp_getattro == PyObject_GenericGetAttr)) { + __pyx_mstate->__pyx_memoryviewslice_type->tp_getattro = PyObject_GenericGetAttr; + } + #endif + if (__Pyx_SetVtable(__pyx_mstate->__pyx_memoryviewslice_type, __pyx_vtabptr__memoryviewslice) < (0)) __PYX_ERR(1, 951, __pyx_L1_error) + if (__Pyx_MergeVtables(__pyx_mstate->__pyx_memoryviewslice_type) < (0)) __PYX_ERR(1, 951, __pyx_L1_error) + if (__Pyx_setup_reduce((PyObject *) __pyx_mstate->__pyx_memoryviewslice_type) < (0)) __PYX_ERR(1, 951, __pyx_L1_error) + __Pyx_RefNannyFinishContext(); + return 0; + __pyx_L1_error:; + __Pyx_XDECREF(__pyx_t_1); + __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("cymem.cymem"); if (unlikely(!__pyx_t_1)) __PYX_ERR(6, 4, __pyx_L1_error) + __Pyx_GOTREF(__pyx_t_1); + __pyx_mstate->__pyx_ptype_5cymem_5cymem_PyMalloc = __Pyx_ImportType_3_2_1(__pyx_t_1, "cymem.cymem", "PyMalloc", + #if defined(PYPY_VERSION_NUM) && PYPY_VERSION_NUM < 0x050B0000 + sizeof(struct __pyx_obj_5cymem_5cymem_PyMalloc), __PYX_GET_STRUCT_ALIGNMENT_3_2_1(struct __pyx_obj_5cymem_5cymem_PyMalloc), + #elif CYTHON_COMPILING_IN_LIMITED_API + sizeof(struct __pyx_obj_5cymem_5cymem_PyMalloc), __PYX_GET_STRUCT_ALIGNMENT_3_2_1(struct __pyx_obj_5cymem_5cymem_PyMalloc), + #else + sizeof(struct __pyx_obj_5cymem_5cymem_PyMalloc), __PYX_GET_STRUCT_ALIGNMENT_3_2_1(struct __pyx_obj_5cymem_5cymem_PyMalloc), + #endif + __Pyx_ImportType_CheckSize_Warn_3_2_1); if (!__pyx_mstate->__pyx_ptype_5cymem_5cymem_PyMalloc) __PYX_ERR(6, 4, __pyx_L1_error) + __pyx_vtabptr_5cymem_5cymem_PyMalloc = (struct __pyx_vtabstruct_5cymem_5cymem_PyMalloc*)__Pyx_GetVtable(__pyx_mstate->__pyx_ptype_5cymem_5cymem_PyMalloc); if (unlikely(!__pyx_vtabptr_5cymem_5cymem_PyMalloc)) __PYX_ERR(6, 4, __pyx_L1_error) + __pyx_mstate->__pyx_ptype_5cymem_5cymem_PyFree = __Pyx_ImportType_3_2_1(__pyx_t_1, "cymem.cymem", "PyFree", + #if defined(PYPY_VERSION_NUM) && PYPY_VERSION_NUM < 0x050B0000 + sizeof(struct __pyx_obj_5cymem_5cymem_PyFree), __PYX_GET_STRUCT_ALIGNMENT_3_2_1(struct __pyx_obj_5cymem_5cymem_PyFree), + #elif CYTHON_COMPILING_IN_LIMITED_API + sizeof(struct __pyx_obj_5cymem_5cymem_PyFree), __PYX_GET_STRUCT_ALIGNMENT_3_2_1(struct __pyx_obj_5cymem_5cymem_PyFree), + #else + sizeof(struct __pyx_obj_5cymem_5cymem_PyFree), __PYX_GET_STRUCT_ALIGNMENT_3_2_1(struct __pyx_obj_5cymem_5cymem_PyFree), + #endif + __Pyx_ImportType_CheckSize_Warn_3_2_1); if (!__pyx_mstate->__pyx_ptype_5cymem_5cymem_PyFree) __PYX_ERR(6, 10, __pyx_L1_error) + __pyx_vtabptr_5cymem_5cymem_PyFree = (struct __pyx_vtabstruct_5cymem_5cymem_PyFree*)__Pyx_GetVtable(__pyx_mstate->__pyx_ptype_5cymem_5cymem_PyFree); if (unlikely(!__pyx_vtabptr_5cymem_5cymem_PyFree)) __PYX_ERR(6, 10, __pyx_L1_error) + __pyx_mstate->__pyx_ptype_5cymem_5cymem_Pool = __Pyx_ImportType_3_2_1(__pyx_t_1, "cymem.cymem", "Pool", + #if defined(PYPY_VERSION_NUM) && PYPY_VERSION_NUM < 0x050B0000 + sizeof(struct __pyx_obj_5cymem_5cymem_Pool), __PYX_GET_STRUCT_ALIGNMENT_3_2_1(struct __pyx_obj_5cymem_5cymem_Pool), + #elif CYTHON_COMPILING_IN_LIMITED_API + sizeof(struct __pyx_obj_5cymem_5cymem_Pool), __PYX_GET_STRUCT_ALIGNMENT_3_2_1(struct __pyx_obj_5cymem_5cymem_Pool), + #else + sizeof(struct __pyx_obj_5cymem_5cymem_Pool), __PYX_GET_STRUCT_ALIGNMENT_3_2_1(struct __pyx_obj_5cymem_5cymem_Pool), + #endif + __Pyx_ImportType_CheckSize_Warn_3_2_1); if (!__pyx_mstate->__pyx_ptype_5cymem_5cymem_Pool) __PYX_ERR(6, 16, __pyx_L1_error) + __pyx_vtabptr_5cymem_5cymem_Pool = (struct __pyx_vtabstruct_5cymem_5cymem_Pool*)__Pyx_GetVtable(__pyx_mstate->__pyx_ptype_5cymem_5cymem_Pool); if (unlikely(!__pyx_vtabptr_5cymem_5cymem_Pool)) __PYX_ERR(6, 16, __pyx_L1_error) + __pyx_mstate->__pyx_ptype_5cymem_5cymem_Address = __Pyx_ImportType_3_2_1(__pyx_t_1, "cymem.cymem", "Address", + #if defined(PYPY_VERSION_NUM) && PYPY_VERSION_NUM < 0x050B0000 + sizeof(struct __pyx_obj_5cymem_5cymem_Address), __PYX_GET_STRUCT_ALIGNMENT_3_2_1(struct __pyx_obj_5cymem_5cymem_Address), + #elif CYTHON_COMPILING_IN_LIMITED_API + sizeof(struct __pyx_obj_5cymem_5cymem_Address), __PYX_GET_STRUCT_ALIGNMENT_3_2_1(struct __pyx_obj_5cymem_5cymem_Address), + #else + sizeof(struct __pyx_obj_5cymem_5cymem_Address), __PYX_GET_STRUCT_ALIGNMENT_3_2_1(struct __pyx_obj_5cymem_5cymem_Address), + #endif + __Pyx_ImportType_CheckSize_Warn_3_2_1); if (!__pyx_mstate->__pyx_ptype_5cymem_5cymem_Address) __PYX_ERR(6, 28, __pyx_L1_error) + __Pyx_DECREF(__pyx_t_1); __pyx_t_1 = 0; + __pyx_t_1 = PyImport_ImportModule("thinc.extra.search"); if (unlikely(!__pyx_t_1)) __PYX_ERR(7, 37, __pyx_L1_error) + __Pyx_GOTREF(__pyx_t_1); + __pyx_mstate->__pyx_ptype_5thinc_5extra_6search_Beam = __Pyx_ImportType_3_2_1(__pyx_t_1, "thinc.extra.search", "Beam", + #if defined(PYPY_VERSION_NUM) && PYPY_VERSION_NUM < 0x050B0000 + sizeof(struct __pyx_obj_5thinc_5extra_6search_Beam), __PYX_GET_STRUCT_ALIGNMENT_3_2_1(struct __pyx_obj_5thinc_5extra_6search_Beam), + #elif CYTHON_COMPILING_IN_LIMITED_API + sizeof(struct __pyx_obj_5thinc_5extra_6search_Beam), __PYX_GET_STRUCT_ALIGNMENT_3_2_1(struct __pyx_obj_5thinc_5extra_6search_Beam), + #else + sizeof(struct __pyx_obj_5thinc_5extra_6search_Beam), __PYX_GET_STRUCT_ALIGNMENT_3_2_1(struct __pyx_obj_5thinc_5extra_6search_Beam), + #endif + __Pyx_ImportType_CheckSize_Warn_3_2_1); if (!__pyx_mstate->__pyx_ptype_5thinc_5extra_6search_Beam) __PYX_ERR(7, 37, __pyx_L1_error) + __pyx_vtabptr_5thinc_5extra_6search_Beam = (struct __pyx_vtabstruct_5thinc_5extra_6search_Beam*)__Pyx_GetVtable(__pyx_mstate->__pyx_ptype_5thinc_5extra_6search_Beam); if (unlikely(!__pyx_vtabptr_5thinc_5extra_6search_Beam)) __PYX_ERR(7, 37, __pyx_L1_error) + __pyx_mstate->__pyx_ptype_5thinc_5extra_6search_MaxViolation = __Pyx_ImportType_3_2_1(__pyx_t_1, "thinc.extra.search", "MaxViolation", + #if defined(PYPY_VERSION_NUM) && PYPY_VERSION_NUM < 0x050B0000 + sizeof(struct __pyx_obj_5thinc_5extra_6search_MaxViolation), __PYX_GET_STRUCT_ALIGNMENT_3_2_1(struct __pyx_obj_5thinc_5extra_6search_MaxViolation), + #elif CYTHON_COMPILING_IN_LIMITED_API + sizeof(struct __pyx_obj_5thinc_5extra_6search_MaxViolation), __PYX_GET_STRUCT_ALIGNMENT_3_2_1(struct __pyx_obj_5thinc_5extra_6search_MaxViolation), + #else + sizeof(struct __pyx_obj_5thinc_5extra_6search_MaxViolation), __PYX_GET_STRUCT_ALIGNMENT_3_2_1(struct __pyx_obj_5thinc_5extra_6search_MaxViolation), + #endif + __Pyx_ImportType_CheckSize_Warn_3_2_1); if (!__pyx_mstate->__pyx_ptype_5thinc_5extra_6search_MaxViolation) __PYX_ERR(7, 75, __pyx_L1_error) + __pyx_vtabptr_5thinc_5extra_6search_MaxViolation = (struct __pyx_vtabstruct_5thinc_5extra_6search_MaxViolation*)__Pyx_GetVtable(__pyx_mstate->__pyx_ptype_5thinc_5extra_6search_MaxViolation); if (unlikely(!__pyx_vtabptr_5thinc_5extra_6search_MaxViolation)) __PYX_ERR(7, 75, __pyx_L1_error) + __Pyx_DECREF(__pyx_t_1); __pyx_t_1 = 0; + __pyx_t_1 = PyImport_ImportModule("preshed.maps"); if (unlikely(!__pyx_t_1)) __PYX_ERR(8, 45, __pyx_L1_error) + __Pyx_GOTREF(__pyx_t_1); + __pyx_mstate->__pyx_ptype_7preshed_4maps_PreshMap = __Pyx_ImportType_3_2_1(__pyx_t_1, "preshed.maps", "PreshMap", + #if defined(PYPY_VERSION_NUM) && PYPY_VERSION_NUM < 0x050B0000 + sizeof(struct __pyx_obj_7preshed_4maps_PreshMap), __PYX_GET_STRUCT_ALIGNMENT_3_2_1(struct __pyx_obj_7preshed_4maps_PreshMap), + #elif CYTHON_COMPILING_IN_LIMITED_API + sizeof(struct __pyx_obj_7preshed_4maps_PreshMap), __PYX_GET_STRUCT_ALIGNMENT_3_2_1(struct __pyx_obj_7preshed_4maps_PreshMap), + #else + sizeof(struct __pyx_obj_7preshed_4maps_PreshMap), __PYX_GET_STRUCT_ALIGNMENT_3_2_1(struct __pyx_obj_7preshed_4maps_PreshMap), + #endif + __Pyx_ImportType_CheckSize_Warn_3_2_1); if (!__pyx_mstate->__pyx_ptype_7preshed_4maps_PreshMap) __PYX_ERR(8, 45, __pyx_L1_error) + __pyx_vtabptr_7preshed_4maps_PreshMap = (struct __pyx_vtabstruct_7preshed_4maps_PreshMap*)__Pyx_GetVtable(__pyx_mstate->__pyx_ptype_7preshed_4maps_PreshMap); if (unlikely(!__pyx_vtabptr_7preshed_4maps_PreshMap)) __PYX_ERR(8, 45, __pyx_L1_error) + __pyx_mstate->__pyx_ptype_7preshed_4maps_PreshMapArray = __Pyx_ImportType_3_2_1(__pyx_t_1, "preshed.maps", "PreshMapArray", + #if defined(PYPY_VERSION_NUM) && PYPY_VERSION_NUM < 0x050B0000 + sizeof(struct __pyx_obj_7preshed_4maps_PreshMapArray), __PYX_GET_STRUCT_ALIGNMENT_3_2_1(struct __pyx_obj_7preshed_4maps_PreshMapArray), + #elif CYTHON_COMPILING_IN_LIMITED_API + sizeof(struct __pyx_obj_7preshed_4maps_PreshMapArray), __PYX_GET_STRUCT_ALIGNMENT_3_2_1(struct __pyx_obj_7preshed_4maps_PreshMapArray), + #else + sizeof(struct __pyx_obj_7preshed_4maps_PreshMapArray), __PYX_GET_STRUCT_ALIGNMENT_3_2_1(struct __pyx_obj_7preshed_4maps_PreshMapArray), + #endif + __Pyx_ImportType_CheckSize_Warn_3_2_1); if (!__pyx_mstate->__pyx_ptype_7preshed_4maps_PreshMapArray) __PYX_ERR(8, 53, __pyx_L1_error) + __pyx_vtabptr_7preshed_4maps_PreshMapArray = (struct __pyx_vtabstruct_7preshed_4maps_PreshMapArray*)__Pyx_GetVtable(__pyx_mstate->__pyx_ptype_7preshed_4maps_PreshMapArray); if (unlikely(!__pyx_vtabptr_7preshed_4maps_PreshMapArray)) __PYX_ERR(8, 53, __pyx_L1_error) + __Pyx_DECREF(__pyx_t_1); __pyx_t_1 = 0; + __pyx_t_1 = PyImport_ImportModule("spacy.strings"); if (unlikely(!__pyx_t_1)) __PYX_ERR(9, 22, __pyx_L1_error) + __Pyx_GOTREF(__pyx_t_1); + __pyx_mstate->__pyx_ptype_5spacy_7strings_StringStore = __Pyx_ImportType_3_2_1(__pyx_t_1, "spacy.strings", "StringStore", + #if defined(PYPY_VERSION_NUM) && PYPY_VERSION_NUM < 0x050B0000 + sizeof(struct __pyx_obj_5spacy_7strings_StringStore), __PYX_GET_STRUCT_ALIGNMENT_3_2_1(struct __pyx_obj_5spacy_7strings_StringStore), + #elif CYTHON_COMPILING_IN_LIMITED_API + sizeof(struct __pyx_obj_5spacy_7strings_StringStore), __PYX_GET_STRUCT_ALIGNMENT_3_2_1(struct __pyx_obj_5spacy_7strings_StringStore), + #else + sizeof(struct __pyx_obj_5spacy_7strings_StringStore), __PYX_GET_STRUCT_ALIGNMENT_3_2_1(struct __pyx_obj_5spacy_7strings_StringStore), + #endif + __Pyx_ImportType_CheckSize_Warn_3_2_1); if (!__pyx_mstate->__pyx_ptype_5spacy_7strings_StringStore) __PYX_ERR(9, 22, __pyx_L1_error) + __pyx_vtabptr_5spacy_7strings_StringStore = (struct __pyx_vtabstruct_5spacy_7strings_StringStore*)__Pyx_GetVtable(__pyx_mstate->__pyx_ptype_5spacy_7strings_StringStore); if (unlikely(!__pyx_vtabptr_5spacy_7strings_StringStore)) __PYX_ERR(9, 22, __pyx_L1_error) + __Pyx_DECREF(__pyx_t_1); __pyx_t_1 = 0; + __pyx_t_1 = PyImport_ImportModule(__Pyx_BUILTIN_MODULE_NAME); if (unlikely(!__pyx_t_1)) __PYX_ERR(10, 9, __pyx_L1_error) + __Pyx_GOTREF(__pyx_t_1); + __pyx_mstate->__pyx_ptype_7cpython_4type_type = __Pyx_ImportType_3_2_1(__pyx_t_1, __Pyx_BUILTIN_MODULE_NAME, "type", + #if defined(PYPY_VERSION_NUM) && PYPY_VERSION_NUM < 0x050B0000 + sizeof(PyTypeObject), __PYX_GET_STRUCT_ALIGNMENT_3_2_1(PyTypeObject), + #elif CYTHON_COMPILING_IN_LIMITED_API + 0, 0, + #else + sizeof(PyHeapTypeObject), __PYX_GET_STRUCT_ALIGNMENT_3_2_1(PyHeapTypeObject), + #endif + __Pyx_ImportType_CheckSize_Warn_3_2_1); if (!__pyx_mstate->__pyx_ptype_7cpython_4type_type) __PYX_ERR(10, 9, __pyx_L1_error) + __Pyx_DECREF(__pyx_t_1); __pyx_t_1 = 0; + __pyx_t_1 = PyImport_ImportModule("numpy"); if (unlikely(!__pyx_t_1)) __PYX_ERR(2, 228, __pyx_L1_error) + __Pyx_GOTREF(__pyx_t_1); + __pyx_mstate->__pyx_ptype_5numpy_dtype = __Pyx_ImportType_3_2_1(__pyx_t_1, "numpy", "dtype", + #if defined(PYPY_VERSION_NUM) && PYPY_VERSION_NUM < 0x050B0000 + sizeof(PyArray_Descr), __PYX_GET_STRUCT_ALIGNMENT_3_2_1(PyArray_Descr), + #elif CYTHON_COMPILING_IN_LIMITED_API + sizeof(PyArray_Descr), __PYX_GET_STRUCT_ALIGNMENT_3_2_1(PyArray_Descr), + #else + sizeof(PyArray_Descr), __PYX_GET_STRUCT_ALIGNMENT_3_2_1(PyArray_Descr), + #endif + __Pyx_ImportType_CheckSize_Ignore_3_2_1); if (!__pyx_mstate->__pyx_ptype_5numpy_dtype) __PYX_ERR(2, 228, __pyx_L1_error) + __pyx_mstate->__pyx_ptype_5numpy_flatiter = __Pyx_ImportType_3_2_1(__pyx_t_1, "numpy", "flatiter", + #if defined(PYPY_VERSION_NUM) && PYPY_VERSION_NUM < 0x050B0000 + sizeof(PyArrayIterObject), __PYX_GET_STRUCT_ALIGNMENT_3_2_1(PyArrayIterObject), + #elif CYTHON_COMPILING_IN_LIMITED_API + sizeof(PyArrayIterObject), __PYX_GET_STRUCT_ALIGNMENT_3_2_1(PyArrayIterObject), + #else + sizeof(PyArrayIterObject), __PYX_GET_STRUCT_ALIGNMENT_3_2_1(PyArrayIterObject), + #endif + __Pyx_ImportType_CheckSize_Ignore_3_2_1); if (!__pyx_mstate->__pyx_ptype_5numpy_flatiter) __PYX_ERR(2, 273, __pyx_L1_error) + __pyx_mstate->__pyx_ptype_5numpy_broadcast = __Pyx_ImportType_3_2_1(__pyx_t_1, "numpy", "broadcast", + #if defined(PYPY_VERSION_NUM) && PYPY_VERSION_NUM < 0x050B0000 + sizeof(PyArrayMultiIterObject), __PYX_GET_STRUCT_ALIGNMENT_3_2_1(PyArrayMultiIterObject), + #elif CYTHON_COMPILING_IN_LIMITED_API + sizeof(PyArrayMultiIterObject), __PYX_GET_STRUCT_ALIGNMENT_3_2_1(PyArrayMultiIterObject), + #else + sizeof(PyArrayMultiIterObject), __PYX_GET_STRUCT_ALIGNMENT_3_2_1(PyArrayMultiIterObject), + #endif + __Pyx_ImportType_CheckSize_Ignore_3_2_1); if (!__pyx_mstate->__pyx_ptype_5numpy_broadcast) __PYX_ERR(2, 277, __pyx_L1_error) + __pyx_mstate->__pyx_ptype_5numpy_ndarray = __Pyx_ImportType_3_2_1(__pyx_t_1, "numpy", "ndarray", + #if defined(PYPY_VERSION_NUM) && PYPY_VERSION_NUM < 0x050B0000 + sizeof(PyArrayObject), __PYX_GET_STRUCT_ALIGNMENT_3_2_1(PyArrayObject), + #elif CYTHON_COMPILING_IN_LIMITED_API + sizeof(PyArrayObject), __PYX_GET_STRUCT_ALIGNMENT_3_2_1(PyArrayObject), + #else + sizeof(PyArrayObject), __PYX_GET_STRUCT_ALIGNMENT_3_2_1(PyArrayObject), + #endif + __Pyx_ImportType_CheckSize_Ignore_3_2_1); if (!__pyx_mstate->__pyx_ptype_5numpy_ndarray) __PYX_ERR(2, 316, __pyx_L1_error) + __pyx_mstate->__pyx_ptype_5numpy_generic = __Pyx_ImportType_3_2_1(__pyx_t_1, "numpy", "generic", + #if defined(PYPY_VERSION_NUM) && PYPY_VERSION_NUM < 0x050B0000 + sizeof(PyObject), __PYX_GET_STRUCT_ALIGNMENT_3_2_1(PyObject), + #elif CYTHON_COMPILING_IN_LIMITED_API + sizeof(PyObject), __PYX_GET_STRUCT_ALIGNMENT_3_2_1(PyObject), + #else + sizeof(PyObject), __PYX_GET_STRUCT_ALIGNMENT_3_2_1(PyObject), + #endif + __Pyx_ImportType_CheckSize_Warn_3_2_1); if (!__pyx_mstate->__pyx_ptype_5numpy_generic) __PYX_ERR(2, 825, __pyx_L1_error) + __pyx_mstate->__pyx_ptype_5numpy_number = __Pyx_ImportType_3_2_1(__pyx_t_1, "numpy", "number", + #if defined(PYPY_VERSION_NUM) && PYPY_VERSION_NUM < 0x050B0000 + sizeof(PyObject), __PYX_GET_STRUCT_ALIGNMENT_3_2_1(PyObject), + #elif CYTHON_COMPILING_IN_LIMITED_API + sizeof(PyObject), __PYX_GET_STRUCT_ALIGNMENT_3_2_1(PyObject), + #else + sizeof(PyObject), __PYX_GET_STRUCT_ALIGNMENT_3_2_1(PyObject), + #endif + __Pyx_ImportType_CheckSize_Warn_3_2_1); if (!__pyx_mstate->__pyx_ptype_5numpy_number) __PYX_ERR(2, 827, __pyx_L1_error) + __pyx_mstate->__pyx_ptype_5numpy_integer = __Pyx_ImportType_3_2_1(__pyx_t_1, "numpy", "integer", + #if defined(PYPY_VERSION_NUM) && PYPY_VERSION_NUM < 0x050B0000 + sizeof(PyObject), __PYX_GET_STRUCT_ALIGNMENT_3_2_1(PyObject), + #elif CYTHON_COMPILING_IN_LIMITED_API + sizeof(PyObject), __PYX_GET_STRUCT_ALIGNMENT_3_2_1(PyObject), + #else + sizeof(PyObject), __PYX_GET_STRUCT_ALIGNMENT_3_2_1(PyObject), + #endif + __Pyx_ImportType_CheckSize_Warn_3_2_1); if (!__pyx_mstate->__pyx_ptype_5numpy_integer) __PYX_ERR(2, 829, __pyx_L1_error) + __pyx_mstate->__pyx_ptype_5numpy_signedinteger = __Pyx_ImportType_3_2_1(__pyx_t_1, "numpy", "signedinteger", + #if defined(PYPY_VERSION_NUM) && PYPY_VERSION_NUM < 0x050B0000 + sizeof(PyObject), __PYX_GET_STRUCT_ALIGNMENT_3_2_1(PyObject), + #elif CYTHON_COMPILING_IN_LIMITED_API + sizeof(PyObject), __PYX_GET_STRUCT_ALIGNMENT_3_2_1(PyObject), + #else + sizeof(PyObject), __PYX_GET_STRUCT_ALIGNMENT_3_2_1(PyObject), + #endif + __Pyx_ImportType_CheckSize_Warn_3_2_1); if (!__pyx_mstate->__pyx_ptype_5numpy_signedinteger) __PYX_ERR(2, 831, __pyx_L1_error) + __pyx_mstate->__pyx_ptype_5numpy_unsignedinteger = __Pyx_ImportType_3_2_1(__pyx_t_1, "numpy", "unsignedinteger", + #if defined(PYPY_VERSION_NUM) && PYPY_VERSION_NUM < 0x050B0000 + sizeof(PyObject), __PYX_GET_STRUCT_ALIGNMENT_3_2_1(PyObject), + #elif CYTHON_COMPILING_IN_LIMITED_API + sizeof(PyObject), __PYX_GET_STRUCT_ALIGNMENT_3_2_1(PyObject), + #else + sizeof(PyObject), __PYX_GET_STRUCT_ALIGNMENT_3_2_1(PyObject), + #endif + __Pyx_ImportType_CheckSize_Warn_3_2_1); if (!__pyx_mstate->__pyx_ptype_5numpy_unsignedinteger) __PYX_ERR(2, 833, __pyx_L1_error) + __pyx_mstate->__pyx_ptype_5numpy_inexact = __Pyx_ImportType_3_2_1(__pyx_t_1, "numpy", "inexact", + #if defined(PYPY_VERSION_NUM) && PYPY_VERSION_NUM < 0x050B0000 + sizeof(PyObject), __PYX_GET_STRUCT_ALIGNMENT_3_2_1(PyObject), + #elif CYTHON_COMPILING_IN_LIMITED_API + sizeof(PyObject), __PYX_GET_STRUCT_ALIGNMENT_3_2_1(PyObject), + #else + sizeof(PyObject), __PYX_GET_STRUCT_ALIGNMENT_3_2_1(PyObject), + #endif + __Pyx_ImportType_CheckSize_Warn_3_2_1); if (!__pyx_mstate->__pyx_ptype_5numpy_inexact) __PYX_ERR(2, 835, __pyx_L1_error) + __pyx_mstate->__pyx_ptype_5numpy_floating = __Pyx_ImportType_3_2_1(__pyx_t_1, "numpy", "floating", + #if defined(PYPY_VERSION_NUM) && PYPY_VERSION_NUM < 0x050B0000 + sizeof(PyObject), __PYX_GET_STRUCT_ALIGNMENT_3_2_1(PyObject), + #elif CYTHON_COMPILING_IN_LIMITED_API + sizeof(PyObject), __PYX_GET_STRUCT_ALIGNMENT_3_2_1(PyObject), + #else + sizeof(PyObject), __PYX_GET_STRUCT_ALIGNMENT_3_2_1(PyObject), + #endif + __Pyx_ImportType_CheckSize_Warn_3_2_1); if (!__pyx_mstate->__pyx_ptype_5numpy_floating) __PYX_ERR(2, 837, __pyx_L1_error) + __pyx_mstate->__pyx_ptype_5numpy_complexfloating = __Pyx_ImportType_3_2_1(__pyx_t_1, "numpy", "complexfloating", + #if defined(PYPY_VERSION_NUM) && PYPY_VERSION_NUM < 0x050B0000 + sizeof(PyObject), __PYX_GET_STRUCT_ALIGNMENT_3_2_1(PyObject), + #elif CYTHON_COMPILING_IN_LIMITED_API + sizeof(PyObject), __PYX_GET_STRUCT_ALIGNMENT_3_2_1(PyObject), + #else + sizeof(PyObject), __PYX_GET_STRUCT_ALIGNMENT_3_2_1(PyObject), + #endif + __Pyx_ImportType_CheckSize_Warn_3_2_1); if (!__pyx_mstate->__pyx_ptype_5numpy_complexfloating) __PYX_ERR(2, 839, __pyx_L1_error) + __pyx_mstate->__pyx_ptype_5numpy_flexible = __Pyx_ImportType_3_2_1(__pyx_t_1, "numpy", "flexible", + #if defined(PYPY_VERSION_NUM) && PYPY_VERSION_NUM < 0x050B0000 + sizeof(PyObject), __PYX_GET_STRUCT_ALIGNMENT_3_2_1(PyObject), + #elif CYTHON_COMPILING_IN_LIMITED_API + sizeof(PyObject), __PYX_GET_STRUCT_ALIGNMENT_3_2_1(PyObject), + #else + sizeof(PyObject), __PYX_GET_STRUCT_ALIGNMENT_3_2_1(PyObject), + #endif + __Pyx_ImportType_CheckSize_Warn_3_2_1); if (!__pyx_mstate->__pyx_ptype_5numpy_flexible) __PYX_ERR(2, 841, __pyx_L1_error) + __pyx_mstate->__pyx_ptype_5numpy_character = __Pyx_ImportType_3_2_1(__pyx_t_1, "numpy", "character", + #if defined(PYPY_VERSION_NUM) && PYPY_VERSION_NUM < 0x050B0000 + sizeof(PyObject), __PYX_GET_STRUCT_ALIGNMENT_3_2_1(PyObject), + #elif CYTHON_COMPILING_IN_LIMITED_API + sizeof(PyObject), __PYX_GET_STRUCT_ALIGNMENT_3_2_1(PyObject), + #else + sizeof(PyObject), __PYX_GET_STRUCT_ALIGNMENT_3_2_1(PyObject), + #endif + __Pyx_ImportType_CheckSize_Warn_3_2_1); if (!__pyx_mstate->__pyx_ptype_5numpy_character) __PYX_ERR(2, 843, __pyx_L1_error) + __pyx_mstate->__pyx_ptype_5numpy_ufunc = __Pyx_ImportType_3_2_1(__pyx_t_1, "numpy", "ufunc", + #if defined(PYPY_VERSION_NUM) && PYPY_VERSION_NUM < 0x050B0000 + sizeof(PyUFuncObject), __PYX_GET_STRUCT_ALIGNMENT_3_2_1(PyUFuncObject), + #elif CYTHON_COMPILING_IN_LIMITED_API + sizeof(PyUFuncObject), __PYX_GET_STRUCT_ALIGNMENT_3_2_1(PyUFuncObject), + #else + sizeof(PyUFuncObject), __PYX_GET_STRUCT_ALIGNMENT_3_2_1(PyUFuncObject), + #endif + __Pyx_ImportType_CheckSize_Ignore_3_2_1); if (!__pyx_mstate->__pyx_ptype_5numpy_ufunc) __PYX_ERR(2, 907, __pyx_L1_error) + __Pyx_DECREF(__pyx_t_1); __pyx_t_1 = 0; + __pyx_t_1 = PyImport_ImportModule("spacy.morphology"); if (unlikely(!__pyx_t_1)) __PYX_ERR(11, 11, __pyx_L1_error) + __Pyx_GOTREF(__pyx_t_1); + __pyx_mstate->__pyx_ptype_5spacy_10morphology_Morphology = __Pyx_ImportType_3_2_1(__pyx_t_1, "spacy.morphology", "Morphology", + #if defined(PYPY_VERSION_NUM) && PYPY_VERSION_NUM < 0x050B0000 + sizeof(struct __pyx_obj_5spacy_10morphology_Morphology), __PYX_GET_STRUCT_ALIGNMENT_3_2_1(struct __pyx_obj_5spacy_10morphology_Morphology), + #elif CYTHON_COMPILING_IN_LIMITED_API + sizeof(struct __pyx_obj_5spacy_10morphology_Morphology), __PYX_GET_STRUCT_ALIGNMENT_3_2_1(struct __pyx_obj_5spacy_10morphology_Morphology), + #else + sizeof(struct __pyx_obj_5spacy_10morphology_Morphology), __PYX_GET_STRUCT_ALIGNMENT_3_2_1(struct __pyx_obj_5spacy_10morphology_Morphology), + #endif + __Pyx_ImportType_CheckSize_Warn_3_2_1); if (!__pyx_mstate->__pyx_ptype_5spacy_10morphology_Morphology) __PYX_ERR(11, 11, __pyx_L1_error) + __pyx_vtabptr_5spacy_10morphology_Morphology = (struct __pyx_vtabstruct_5spacy_10morphology_Morphology*)__Pyx_GetVtable(__pyx_mstate->__pyx_ptype_5spacy_10morphology_Morphology); if (unlikely(!__pyx_vtabptr_5spacy_10morphology_Morphology)) __PYX_ERR(11, 11, __pyx_L1_error) + __Pyx_DECREF(__pyx_t_1); __pyx_t_1 = 0; + __pyx_t_1 = PyImport_ImportModule("spacy.vocab"); if (unlikely(!__pyx_t_1)) __PYX_ERR(12, 26, __pyx_L1_error) + __Pyx_GOTREF(__pyx_t_1); + __pyx_mstate->__pyx_ptype_5spacy_5vocab_Vocab = __Pyx_ImportType_3_2_1(__pyx_t_1, "spacy.vocab", "Vocab", + #if defined(PYPY_VERSION_NUM) && PYPY_VERSION_NUM < 0x050B0000 + sizeof(struct __pyx_obj_5spacy_5vocab_Vocab), __PYX_GET_STRUCT_ALIGNMENT_3_2_1(struct __pyx_obj_5spacy_5vocab_Vocab), + #elif CYTHON_COMPILING_IN_LIMITED_API + sizeof(struct __pyx_obj_5spacy_5vocab_Vocab), __PYX_GET_STRUCT_ALIGNMENT_3_2_1(struct __pyx_obj_5spacy_5vocab_Vocab), + #else + sizeof(struct __pyx_obj_5spacy_5vocab_Vocab), __PYX_GET_STRUCT_ALIGNMENT_3_2_1(struct __pyx_obj_5spacy_5vocab_Vocab), + #endif + __Pyx_ImportType_CheckSize_Warn_3_2_1); if (!__pyx_mstate->__pyx_ptype_5spacy_5vocab_Vocab) __PYX_ERR(12, 26, __pyx_L1_error) + __pyx_vtabptr_5spacy_5vocab_Vocab = (struct __pyx_vtabstruct_5spacy_5vocab_Vocab*)__Pyx_GetVtable(__pyx_mstate->__pyx_ptype_5spacy_5vocab_Vocab); if (unlikely(!__pyx_vtabptr_5spacy_5vocab_Vocab)) __PYX_ERR(12, 26, __pyx_L1_error) + __Pyx_DECREF(__pyx_t_1); __pyx_t_1 = 0; + __pyx_t_1 = PyImport_ImportModule("spacy.tokens.doc"); if (unlikely(!__pyx_t_1)) __PYX_ERR(13, 37, __pyx_L1_error) + __Pyx_GOTREF(__pyx_t_1); + __pyx_mstate->__pyx_ptype_5spacy_6tokens_3doc_Doc = __Pyx_ImportType_3_2_1(__pyx_t_1, "spacy.tokens.doc", "Doc", + #if defined(PYPY_VERSION_NUM) && PYPY_VERSION_NUM < 0x050B0000 + sizeof(struct __pyx_obj_5spacy_6tokens_3doc_Doc), __PYX_GET_STRUCT_ALIGNMENT_3_2_1(struct __pyx_obj_5spacy_6tokens_3doc_Doc), + #elif CYTHON_COMPILING_IN_LIMITED_API + sizeof(struct __pyx_obj_5spacy_6tokens_3doc_Doc), __PYX_GET_STRUCT_ALIGNMENT_3_2_1(struct __pyx_obj_5spacy_6tokens_3doc_Doc), + #else + sizeof(struct __pyx_obj_5spacy_6tokens_3doc_Doc), __PYX_GET_STRUCT_ALIGNMENT_3_2_1(struct __pyx_obj_5spacy_6tokens_3doc_Doc), + #endif + __Pyx_ImportType_CheckSize_Warn_3_2_1); if (!__pyx_mstate->__pyx_ptype_5spacy_6tokens_3doc_Doc) __PYX_ERR(13, 37, __pyx_L1_error) + __pyx_vtabptr_5spacy_6tokens_3doc_Doc = (struct __pyx_vtabstruct_5spacy_6tokens_3doc_Doc*)__Pyx_GetVtable(__pyx_mstate->__pyx_ptype_5spacy_6tokens_3doc_Doc); if (unlikely(!__pyx_vtabptr_5spacy_6tokens_3doc_Doc)) __PYX_ERR(13, 37, __pyx_L1_error) + __Pyx_DECREF(__pyx_t_1); __pyx_t_1 = 0; + __pyx_t_1 = PyImport_ImportModule("spacy.training.example"); if (unlikely(!__pyx_t_1)) __PYX_ERR(14, 6, __pyx_L1_error) + __Pyx_GOTREF(__pyx_t_1); + __pyx_mstate->__pyx_ptype_5spacy_8training_7example_Example = __Pyx_ImportType_3_2_1(__pyx_t_1, "spacy.training.example", "Example", + #if defined(PYPY_VERSION_NUM) && PYPY_VERSION_NUM < 0x050B0000 + sizeof(struct __pyx_obj_5spacy_8training_7example_Example), __PYX_GET_STRUCT_ALIGNMENT_3_2_1(struct __pyx_obj_5spacy_8training_7example_Example), + #elif CYTHON_COMPILING_IN_LIMITED_API + sizeof(struct __pyx_obj_5spacy_8training_7example_Example), __PYX_GET_STRUCT_ALIGNMENT_3_2_1(struct __pyx_obj_5spacy_8training_7example_Example), + #else + sizeof(struct __pyx_obj_5spacy_8training_7example_Example), __PYX_GET_STRUCT_ALIGNMENT_3_2_1(struct __pyx_obj_5spacy_8training_7example_Example), + #endif + __Pyx_ImportType_CheckSize_Warn_3_2_1); if (!__pyx_mstate->__pyx_ptype_5spacy_8training_7example_Example) __PYX_ERR(14, 6, __pyx_L1_error) + __Pyx_DECREF(__pyx_t_1); __pyx_t_1 = 0; + __pyx_t_1 = PyImport_ImportModule("spacy.lexeme"); if (unlikely(!__pyx_t_1)) __PYX_ERR(3, 24, __pyx_L1_error) + __Pyx_GOTREF(__pyx_t_1); + __pyx_mstate->__pyx_ptype_5spacy_6lexeme_Lexeme = __Pyx_ImportType_3_2_1(__pyx_t_1, "spacy.lexeme", "Lexeme", + #if defined(PYPY_VERSION_NUM) && PYPY_VERSION_NUM < 0x050B0000 + sizeof(struct __pyx_obj_5spacy_6lexeme_Lexeme), __PYX_GET_STRUCT_ALIGNMENT_3_2_1(struct __pyx_obj_5spacy_6lexeme_Lexeme), + #elif CYTHON_COMPILING_IN_LIMITED_API + sizeof(struct __pyx_obj_5spacy_6lexeme_Lexeme), __PYX_GET_STRUCT_ALIGNMENT_3_2_1(struct __pyx_obj_5spacy_6lexeme_Lexeme), + #else + sizeof(struct __pyx_obj_5spacy_6lexeme_Lexeme), __PYX_GET_STRUCT_ALIGNMENT_3_2_1(struct __pyx_obj_5spacy_6lexeme_Lexeme), + #endif + __Pyx_ImportType_CheckSize_Warn_3_2_1); if (!__pyx_mstate->__pyx_ptype_5spacy_6lexeme_Lexeme) __PYX_ERR(3, 24, __pyx_L1_error) + __pyx_vtabptr_5spacy_6lexeme_Lexeme = (struct __pyx_vtabstruct_5spacy_6lexeme_Lexeme*)__Pyx_GetVtable(__pyx_mstate->__pyx_ptype_5spacy_6lexeme_Lexeme); if (unlikely(!__pyx_vtabptr_5spacy_6lexeme_Lexeme)) __PYX_ERR(3, 24, __pyx_L1_error) + __Pyx_DECREF(__pyx_t_1); __pyx_t_1 = 0; + __pyx_t_1 = PyImport_ImportModule("spacy.pipeline._parser_internals.stateclass"); if (unlikely(!__pyx_t_1)) __PYX_ERR(5, 9, __pyx_L1_error) + __Pyx_GOTREF(__pyx_t_1); + __pyx_mstate->__pyx_ptype_5spacy_8pipeline_17_parser_internals_10stateclass_StateClass = __Pyx_ImportType_3_2_1(__pyx_t_1, "spacy.pipeline._parser_internals.stateclass", "StateClass", + #if defined(PYPY_VERSION_NUM) && PYPY_VERSION_NUM < 0x050B0000 + sizeof(struct __pyx_obj_5spacy_8pipeline_17_parser_internals_10stateclass_StateClass), __PYX_GET_STRUCT_ALIGNMENT_3_2_1(struct __pyx_obj_5spacy_8pipeline_17_parser_internals_10stateclass_StateClass), + #elif CYTHON_COMPILING_IN_LIMITED_API + sizeof(struct __pyx_obj_5spacy_8pipeline_17_parser_internals_10stateclass_StateClass), __PYX_GET_STRUCT_ALIGNMENT_3_2_1(struct __pyx_obj_5spacy_8pipeline_17_parser_internals_10stateclass_StateClass), + #else + sizeof(struct __pyx_obj_5spacy_8pipeline_17_parser_internals_10stateclass_StateClass), __PYX_GET_STRUCT_ALIGNMENT_3_2_1(struct __pyx_obj_5spacy_8pipeline_17_parser_internals_10stateclass_StateClass), + #endif + __Pyx_ImportType_CheckSize_Warn_3_2_1); if (!__pyx_mstate->__pyx_ptype_5spacy_8pipeline_17_parser_internals_10stateclass_StateClass) __PYX_ERR(5, 9, __pyx_L1_error) + __pyx_vtabptr_5spacy_8pipeline_17_parser_internals_10stateclass_StateClass = (struct __pyx_vtabstruct_5spacy_8pipeline_17_parser_internals_10stateclass_StateClass*)__Pyx_GetVtable(__pyx_mstate->__pyx_ptype_5spacy_8pipeline_17_parser_internals_10stateclass_StateClass); if (unlikely(!__pyx_vtabptr_5spacy_8pipeline_17_parser_internals_10stateclass_StateClass)) __PYX_ERR(5, 9, __pyx_L1_error) + __Pyx_DECREF(__pyx_t_1); __pyx_t_1 = 0; + __pyx_t_1 = PyImport_ImportModule("spacy.pipeline._parser_internals.transition_system"); if (unlikely(!__pyx_t_1)) __PYX_ERR(15, 39, __pyx_L1_error) + __Pyx_GOTREF(__pyx_t_1); + __pyx_mstate->__pyx_ptype_5spacy_8pipeline_17_parser_internals_17transition_system_TransitionSystem = __Pyx_ImportType_3_2_1(__pyx_t_1, "spacy.pipeline._parser_internals.transition_system", "TransitionSystem", + #if defined(PYPY_VERSION_NUM) && PYPY_VERSION_NUM < 0x050B0000 + sizeof(struct __pyx_obj_5spacy_8pipeline_17_parser_internals_17transition_system_TransitionSystem), __PYX_GET_STRUCT_ALIGNMENT_3_2_1(struct __pyx_obj_5spacy_8pipeline_17_parser_internals_17transition_system_TransitionSystem), + #elif CYTHON_COMPILING_IN_LIMITED_API + sizeof(struct __pyx_obj_5spacy_8pipeline_17_parser_internals_17transition_system_TransitionSystem), __PYX_GET_STRUCT_ALIGNMENT_3_2_1(struct __pyx_obj_5spacy_8pipeline_17_parser_internals_17transition_system_TransitionSystem), + #else + sizeof(struct __pyx_obj_5spacy_8pipeline_17_parser_internals_17transition_system_TransitionSystem), __PYX_GET_STRUCT_ALIGNMENT_3_2_1(struct __pyx_obj_5spacy_8pipeline_17_parser_internals_17transition_system_TransitionSystem), + #endif + __Pyx_ImportType_CheckSize_Warn_3_2_1); if (!__pyx_mstate->__pyx_ptype_5spacy_8pipeline_17_parser_internals_17transition_system_TransitionSystem) __PYX_ERR(15, 39, __pyx_L1_error) + __pyx_vtabptr_5spacy_8pipeline_17_parser_internals_17transition_system_TransitionSystem = (struct __pyx_vtabstruct_5spacy_8pipeline_17_parser_internals_17transition_system_TransitionSystem*)__Pyx_GetVtable(__pyx_mstate->__pyx_ptype_5spacy_8pipeline_17_parser_internals_17transition_system_TransitionSystem); if (unlikely(!__pyx_vtabptr_5spacy_8pipeline_17_parser_internals_17transition_system_TransitionSystem)) __PYX_ERR(15, 39, __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); + PyObject *__pyx_t_1 = NULL; + int __pyx_lineno = 0; + const char *__pyx_filename = NULL; + int __pyx_clineno = 0; + __Pyx_RefNannySetupContext("__Pyx_modinit_variable_import_code", 0); + /*--- Variable import code ---*/ + { + __pyx_t_1 = PyImport_ImportModule("spacy.vocab"); 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_struct___pyx_t_5spacy_7structs_L); + #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 + 39; + void **const __pyx_import_pointers[] = {(void **)&__pyx_vp_5spacy_5vocab_EMPTY_LEXEME, (void **) NULL}; + void **const *__pyx_import_pointer = __pyx_import_pointers; + const char *__pyx_import_current_signature = __pyx_import_signature; + while (*__pyx_import_pointer) { + if (__Pyx_ImportVoidPtr_3_2_1(__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_t_1 = PyImport_ImportModule("spacy.lexeme"); 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_pyx_t_5spacy_8typedefs_attr_t); + #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 + 71; + void **const __pyx_import_pointers[] = {(void **)&__pyx_vp_5spacy_6lexeme_OOV_RANK, (void **)&__pyx_vp_5spacy_6lexeme_EMPTY_LEXEME, (void **) NULL}; + void **const *__pyx_import_pointer = __pyx_import_pointers; + const char *__pyx_import_current_signature = __pyx_import_signature; + while (*__pyx_import_pointer) { + if (__Pyx_ImportVoidPtr_3_2_1(__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; +} + +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("murmurhash.mrmr"); 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_uint64_t_void_int_uint64_t_hash6); + #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 + 33; + void (**const __pyx_import_pointers[])(void) = {(void (**)(void))&__pyx_f_10murmurhash_4mrmr_hash64, (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_1(__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__beam_utils(PyObject* module); /*proto*/ +static PyModuleDef_Slot __pyx_moduledef_slots[] = { + {Py_mod_create, (void*)__pyx_pymod_create}, + {Py_mod_exec, (void*)__pyx_pymod_exec__beam_utils}, + #if CYTHON_COMPILING_IN_CPYTHON_FREETHREADING + {Py_mod_gil, Py_MOD_GIL_USED}, + #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, + "_beam_utils", + 0, /* 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__beam_utils(void) CYTHON_SMALL_CODE; /*proto*/ +__Pyx_PyMODINIT_FUNC PyInit__beam_utils(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__beam_utils(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; + PyObject *__pyx_t_4 = NULL; + PyObject *__pyx_t_5 = NULL; + size_t __pyx_t_6; + static PyThread_type_lock __pyx_t_7[8]; + int __pyx_t_8; + Py_ssize_t __pyx_t_9; + 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 '_beam_utils' 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 "_beam_utils" 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__beam_utils", 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_spacy__pipeline___parser_internals___beam_utils) { + if (PyObject_SetAttr(__pyx_m, __pyx_mstate_global->__pyx_n_u_name_2, __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, "spacy.pipeline._parser_internals._beam_utils")) { + if (unlikely((PyDict_SetItemString(modules, "spacy.pipeline._parser_internals._beam_utils", __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) + 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) + if (unlikely((__Pyx_modinit_variable_import_code(__pyx_mstate) < 0))) __PYX_ERR(0, 1, __pyx_L1_error) + if (unlikely((__Pyx_modinit_function_import_code(__pyx_mstate) < 0))) __PYX_ERR(0, 1, __pyx_L1_error) + /*--- Execution code ---*/ + + /* "View.MemoryView":100 + * + * cdef object __pyx_collections_abc_Sequence "__pyx_collections_abc_Sequence" + * try: # <<<<<<<<<<<<<< + * __pyx_collections_abc_Sequence = __import__("collections.abc").abc.Sequence + * except: +*/ + { + __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:*/ { + + /* "View.MemoryView":101 + * cdef object __pyx_collections_abc_Sequence "__pyx_collections_abc_Sequence" + * try: + * __pyx_collections_abc_Sequence = __import__("collections.abc").abc.Sequence # <<<<<<<<<<<<<< + * except: + * +*/ + __pyx_t_5 = NULL; + __pyx_t_6 = 1; + { + PyObject *__pyx_callargs[2] = {__pyx_t_5, __pyx_mstate_global->__pyx_kp_u_collections_abc}; + __pyx_t_4 = __Pyx_PyObject_FastCall((PyObject*)__pyx_builtin___import__, __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(1, 101, __pyx_L2_error) + __Pyx_GOTREF(__pyx_t_4); + } + __pyx_t_5 = __Pyx_PyObject_GetAttrStr(__pyx_t_4, __pyx_mstate_global->__pyx_n_u_abc); if (unlikely(!__pyx_t_5)) __PYX_ERR(1, 101, __pyx_L2_error) + __Pyx_GOTREF(__pyx_t_5); + __Pyx_DECREF(__pyx_t_4); __pyx_t_4 = 0; + __pyx_t_4 = __Pyx_PyObject_GetAttrStr(__pyx_t_5, __pyx_mstate_global->__pyx_n_u_Sequence); if (unlikely(!__pyx_t_4)) __PYX_ERR(1, 101, __pyx_L2_error) + __Pyx_GOTREF(__pyx_t_4); + __Pyx_DECREF(__pyx_t_5); __pyx_t_5 = 0; + __Pyx_XGOTREF(__pyx_collections_abc_Sequence); + __Pyx_DECREF_SET(__pyx_collections_abc_Sequence, __pyx_t_4); + __Pyx_GIVEREF(__pyx_t_4); + __pyx_t_4 = 0; + + /* "View.MemoryView":100 + * + * cdef object __pyx_collections_abc_Sequence "__pyx_collections_abc_Sequence" + * try: # <<<<<<<<<<<<<< + * __pyx_collections_abc_Sequence = __import__("collections.abc").abc.Sequence + * except: +*/ + } + __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_L7_try_end; + __pyx_L2_error:; + __Pyx_XDECREF(__pyx_t_4); __pyx_t_4 = 0; + __Pyx_XDECREF(__pyx_t_5); __pyx_t_5 = 0; + + /* "View.MemoryView":102 + * try: + * __pyx_collections_abc_Sequence = __import__("collections.abc").abc.Sequence + * except: # <<<<<<<<<<<<<< + * + * __pyx_collections_abc_Sequence = None +*/ + /*except:*/ { + __Pyx_ErrRestore(0,0,0); + + /* "View.MemoryView":104 + * except: + * + * __pyx_collections_abc_Sequence = None # <<<<<<<<<<<<<< + * + * +*/ + __Pyx_INCREF(Py_None); + __Pyx_XGOTREF(__pyx_collections_abc_Sequence); + __Pyx_DECREF_SET(__pyx_collections_abc_Sequence, Py_None); + __Pyx_GIVEREF(Py_None); + goto __pyx_L3_exception_handled; + } + __pyx_L3_exception_handled:; + __Pyx_XGIVEREF(__pyx_t_1); + __Pyx_XGIVEREF(__pyx_t_2); + __Pyx_XGIVEREF(__pyx_t_3); + __Pyx_ExceptionReset(__pyx_t_1, __pyx_t_2, __pyx_t_3); + __pyx_L7_try_end:; + } + + /* "View.MemoryView":239 + * + * + * try: # <<<<<<<<<<<<<< + * count = __pyx_collections_abc_Sequence.count + * index = __pyx_collections_abc_Sequence.index +*/ + { + __Pyx_PyThreadState_declare + __Pyx_PyThreadState_assign + __Pyx_ExceptionSave(&__pyx_t_3, &__pyx_t_2, &__pyx_t_1); + __Pyx_XGOTREF(__pyx_t_3); + __Pyx_XGOTREF(__pyx_t_2); + __Pyx_XGOTREF(__pyx_t_1); + /*try:*/ { + + /* "View.MemoryView":240 + * + * try: + * count = __pyx_collections_abc_Sequence.count # <<<<<<<<<<<<<< + * index = __pyx_collections_abc_Sequence.index + * except: +*/ + __pyx_t_4 = __Pyx_PyObject_GetAttrStr(__pyx_collections_abc_Sequence, __pyx_mstate_global->__pyx_n_u_count); if (unlikely(!__pyx_t_4)) __PYX_ERR(1, 240, __pyx_L10_error) + __Pyx_GOTREF(__pyx_t_4); + if (__Pyx_SetItemOnTypeDict(__pyx_mstate_global->__pyx_array_type, __pyx_mstate_global->__pyx_n_u_count, __pyx_t_4) < (0)) __PYX_ERR(1, 240, __pyx_L10_error) + __Pyx_DECREF(__pyx_t_4); __pyx_t_4 = 0; + + /* "View.MemoryView":241 + * try: + * count = __pyx_collections_abc_Sequence.count + * index = __pyx_collections_abc_Sequence.index # <<<<<<<<<<<<<< + * except: + * pass +*/ + __pyx_t_4 = __Pyx_PyObject_GetAttrStr(__pyx_collections_abc_Sequence, __pyx_mstate_global->__pyx_n_u_index); if (unlikely(!__pyx_t_4)) __PYX_ERR(1, 241, __pyx_L10_error) + __Pyx_GOTREF(__pyx_t_4); + if (__Pyx_SetItemOnTypeDict(__pyx_mstate_global->__pyx_array_type, __pyx_mstate_global->__pyx_n_u_index, __pyx_t_4) < (0)) __PYX_ERR(1, 241, __pyx_L10_error) + __Pyx_DECREF(__pyx_t_4); __pyx_t_4 = 0; + + /* "View.MemoryView":239 + * + * + * try: # <<<<<<<<<<<<<< + * count = __pyx_collections_abc_Sequence.count + * index = __pyx_collections_abc_Sequence.index +*/ + } + __Pyx_XDECREF(__pyx_t_3); __pyx_t_3 = 0; + __Pyx_XDECREF(__pyx_t_2); __pyx_t_2 = 0; + __Pyx_XDECREF(__pyx_t_1); __pyx_t_1 = 0; + goto __pyx_L15_try_end; + __pyx_L10_error:; + __Pyx_XDECREF(__pyx_t_4); __pyx_t_4 = 0; + __Pyx_XDECREF(__pyx_t_5); __pyx_t_5 = 0; + + /* "View.MemoryView":242 + * count = __pyx_collections_abc_Sequence.count + * index = __pyx_collections_abc_Sequence.index + * except: # <<<<<<<<<<<<<< + * pass + * +*/ + /*except:*/ { + __Pyx_ErrRestore(0,0,0); + goto __pyx_L11_exception_handled; + } + __pyx_L11_exception_handled:; + __Pyx_XGIVEREF(__pyx_t_3); + __Pyx_XGIVEREF(__pyx_t_2); + __Pyx_XGIVEREF(__pyx_t_1); + __Pyx_ExceptionReset(__pyx_t_3, __pyx_t_2, __pyx_t_1); + __pyx_L15_try_end:; + } + + /* "View.MemoryView":307 + * return self.name + * + * cdef generic = Enum("") # <<<<<<<<<<<<<< + * cdef strided = Enum("") # default + * cdef indirect = Enum("") +*/ + __pyx_t_5 = NULL; + __pyx_t_6 = 1; + { + PyObject *__pyx_callargs[2] = {__pyx_t_5, __pyx_mstate_global->__pyx_kp_u_strided_and_direct_or_indirect}; + __pyx_t_4 = __Pyx_PyObject_FastCall((PyObject*)__pyx_mstate_global->__pyx_MemviewEnum_type, __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(1, 307, __pyx_L1_error) + __Pyx_GOTREF((PyObject *)__pyx_t_4); + } + __Pyx_XGOTREF(generic); + __Pyx_DECREF_SET(generic, ((PyObject *)__pyx_t_4)); + __Pyx_GIVEREF((PyObject *)__pyx_t_4); + __pyx_t_4 = 0; + + /* "View.MemoryView":308 + * + * cdef generic = Enum("") + * cdef strided = Enum("") # default # <<<<<<<<<<<<<< + * cdef indirect = Enum("") + * +*/ + __pyx_t_5 = NULL; + __pyx_t_6 = 1; + { + PyObject *__pyx_callargs[2] = {__pyx_t_5, __pyx_mstate_global->__pyx_kp_u_strided_and_direct}; + __pyx_t_4 = __Pyx_PyObject_FastCall((PyObject*)__pyx_mstate_global->__pyx_MemviewEnum_type, __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(1, 308, __pyx_L1_error) + __Pyx_GOTREF((PyObject *)__pyx_t_4); + } + __Pyx_XGOTREF(strided); + __Pyx_DECREF_SET(strided, ((PyObject *)__pyx_t_4)); + __Pyx_GIVEREF((PyObject *)__pyx_t_4); + __pyx_t_4 = 0; + + /* "View.MemoryView":309 + * cdef generic = Enum("") + * cdef strided = Enum("") # default + * cdef indirect = Enum("") # <<<<<<<<<<<<<< + * + * +*/ + __pyx_t_5 = NULL; + __pyx_t_6 = 1; + { + PyObject *__pyx_callargs[2] = {__pyx_t_5, __pyx_mstate_global->__pyx_kp_u_strided_and_indirect}; + __pyx_t_4 = __Pyx_PyObject_FastCall((PyObject*)__pyx_mstate_global->__pyx_MemviewEnum_type, __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(1, 309, __pyx_L1_error) + __Pyx_GOTREF((PyObject *)__pyx_t_4); + } + __Pyx_XGOTREF(indirect); + __Pyx_DECREF_SET(indirect, ((PyObject *)__pyx_t_4)); + __Pyx_GIVEREF((PyObject *)__pyx_t_4); + __pyx_t_4 = 0; + + /* "View.MemoryView":312 + * + * + * cdef contiguous = Enum("") # <<<<<<<<<<<<<< + * cdef indirect_contiguous = Enum("") + * +*/ + __pyx_t_5 = NULL; + __pyx_t_6 = 1; + { + PyObject *__pyx_callargs[2] = {__pyx_t_5, __pyx_mstate_global->__pyx_kp_u_contiguous_and_direct}; + __pyx_t_4 = __Pyx_PyObject_FastCall((PyObject*)__pyx_mstate_global->__pyx_MemviewEnum_type, __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(1, 312, __pyx_L1_error) + __Pyx_GOTREF((PyObject *)__pyx_t_4); + } + __Pyx_XGOTREF(contiguous); + __Pyx_DECREF_SET(contiguous, ((PyObject *)__pyx_t_4)); + __Pyx_GIVEREF((PyObject *)__pyx_t_4); + __pyx_t_4 = 0; + + /* "View.MemoryView":313 + * + * cdef contiguous = Enum("") + * cdef indirect_contiguous = Enum("") # <<<<<<<<<<<<<< + * + * +*/ + __pyx_t_5 = NULL; + __pyx_t_6 = 1; + { + PyObject *__pyx_callargs[2] = {__pyx_t_5, __pyx_mstate_global->__pyx_kp_u_contiguous_and_indirect}; + __pyx_t_4 = __Pyx_PyObject_FastCall((PyObject*)__pyx_mstate_global->__pyx_MemviewEnum_type, __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(1, 313, __pyx_L1_error) + __Pyx_GOTREF((PyObject *)__pyx_t_4); + } + __Pyx_XGOTREF(indirect_contiguous); + __Pyx_DECREF_SET(indirect_contiguous, ((PyObject *)__pyx_t_4)); + __Pyx_GIVEREF((PyObject *)__pyx_t_4); + __pyx_t_4 = 0; + + /* "View.MemoryView":321 + * + * + * cdef int __pyx_memoryview_thread_locks_used = 0 # <<<<<<<<<<<<<< + * cdef PyThread_type_lock[8] __pyx_memoryview_thread_locks = [ + * PyThread_allocate_lock(), +*/ + __pyx_memoryview_thread_locks_used = 0; + + /* "View.MemoryView":322 + * + * cdef int __pyx_memoryview_thread_locks_used = 0 + * cdef PyThread_type_lock[8] __pyx_memoryview_thread_locks = [ # <<<<<<<<<<<<<< + * PyThread_allocate_lock(), + * PyThread_allocate_lock(), +*/ + __pyx_t_7[0] = PyThread_allocate_lock(); + __pyx_t_7[1] = PyThread_allocate_lock(); + __pyx_t_7[2] = PyThread_allocate_lock(); + __pyx_t_7[3] = PyThread_allocate_lock(); + __pyx_t_7[4] = PyThread_allocate_lock(); + __pyx_t_7[5] = PyThread_allocate_lock(); + __pyx_t_7[6] = PyThread_allocate_lock(); + __pyx_t_7[7] = PyThread_allocate_lock(); + memcpy(&(__pyx_memoryview_thread_locks[0]), __pyx_t_7, sizeof(__pyx_memoryview_thread_locks[0]) * (8)); + + /* "View.MemoryView":983 + * + * + * try: # <<<<<<<<<<<<<< + * count = __pyx_collections_abc_Sequence.count + * index = __pyx_collections_abc_Sequence.index +*/ + { + __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:*/ { + + /* "View.MemoryView":984 + * + * try: + * count = __pyx_collections_abc_Sequence.count # <<<<<<<<<<<<<< + * index = __pyx_collections_abc_Sequence.index + * except: +*/ + __pyx_t_4 = __Pyx_PyObject_GetAttrStr(__pyx_collections_abc_Sequence, __pyx_mstate_global->__pyx_n_u_count); if (unlikely(!__pyx_t_4)) __PYX_ERR(1, 984, __pyx_L18_error) + __Pyx_GOTREF(__pyx_t_4); + if (__Pyx_SetItemOnTypeDict(__pyx_mstate_global->__pyx_memoryviewslice_type, __pyx_mstate_global->__pyx_n_u_count, __pyx_t_4) < (0)) __PYX_ERR(1, 984, __pyx_L18_error) + __Pyx_DECREF(__pyx_t_4); __pyx_t_4 = 0; + + /* "View.MemoryView":985 + * try: + * count = __pyx_collections_abc_Sequence.count + * index = __pyx_collections_abc_Sequence.index # <<<<<<<<<<<<<< + * except: + * pass +*/ + __pyx_t_4 = __Pyx_PyObject_GetAttrStr(__pyx_collections_abc_Sequence, __pyx_mstate_global->__pyx_n_u_index); if (unlikely(!__pyx_t_4)) __PYX_ERR(1, 985, __pyx_L18_error) + __Pyx_GOTREF(__pyx_t_4); + if (__Pyx_SetItemOnTypeDict(__pyx_mstate_global->__pyx_memoryviewslice_type, __pyx_mstate_global->__pyx_n_u_index, __pyx_t_4) < (0)) __PYX_ERR(1, 985, __pyx_L18_error) + __Pyx_DECREF(__pyx_t_4); __pyx_t_4 = 0; + + /* "View.MemoryView":983 + * + * + * try: # <<<<<<<<<<<<<< + * count = __pyx_collections_abc_Sequence.count + * index = __pyx_collections_abc_Sequence.index +*/ + } + __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_L23_try_end; + __pyx_L18_error:; + __Pyx_XDECREF(__pyx_t_4); __pyx_t_4 = 0; + __Pyx_XDECREF(__pyx_t_5); __pyx_t_5 = 0; + + /* "View.MemoryView":986 + * count = __pyx_collections_abc_Sequence.count + * index = __pyx_collections_abc_Sequence.index + * except: # <<<<<<<<<<<<<< + * pass + * +*/ + /*except:*/ { + __Pyx_ErrRestore(0,0,0); + goto __pyx_L19_exception_handled; + } + __pyx_L19_exception_handled:; + __Pyx_XGIVEREF(__pyx_t_1); + __Pyx_XGIVEREF(__pyx_t_2); + __Pyx_XGIVEREF(__pyx_t_3); + __Pyx_ExceptionReset(__pyx_t_1, __pyx_t_2, __pyx_t_3); + __pyx_L23_try_end:; + } + + /* "View.MemoryView":989 + * pass + * + * try: # <<<<<<<<<<<<<< + * if __pyx_collections_abc_Sequence: + * +*/ + { + __Pyx_PyThreadState_declare + __Pyx_PyThreadState_assign + __Pyx_ExceptionSave(&__pyx_t_3, &__pyx_t_2, &__pyx_t_1); + __Pyx_XGOTREF(__pyx_t_3); + __Pyx_XGOTREF(__pyx_t_2); + __Pyx_XGOTREF(__pyx_t_1); + /*try:*/ { + + /* "View.MemoryView":990 + * + * try: + * if __pyx_collections_abc_Sequence: # <<<<<<<<<<<<<< + * + * +*/ + __pyx_t_8 = __Pyx_PyObject_IsTrue(__pyx_collections_abc_Sequence); if (unlikely((__pyx_t_8 < 0))) __PYX_ERR(1, 990, __pyx_L26_error) + if (__pyx_t_8) { + + /* "View.MemoryView":994 + * + * + * __pyx_collections_abc_Sequence.register(_memoryviewslice) # <<<<<<<<<<<<<< + * __pyx_collections_abc_Sequence.register(array) + * except: +*/ + __pyx_t_5 = __pyx_collections_abc_Sequence; + __Pyx_INCREF(__pyx_t_5); + __pyx_t_6 = 0; + { + PyObject *__pyx_callargs[2] = {__pyx_t_5, ((PyObject *)__pyx_mstate_global->__pyx_memoryviewslice_type)}; + __pyx_t_4 = __Pyx_PyObject_FastCallMethod((PyObject*)__pyx_mstate_global->__pyx_n_u_register, __pyx_callargs+__pyx_t_6, (2-__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(1, 994, __pyx_L26_error) + __Pyx_GOTREF(__pyx_t_4); + } + __Pyx_DECREF(__pyx_t_4); __pyx_t_4 = 0; + + /* "View.MemoryView":995 + * + * __pyx_collections_abc_Sequence.register(_memoryviewslice) + * __pyx_collections_abc_Sequence.register(array) # <<<<<<<<<<<<<< + * except: + * pass # ignore failure, it's a minor issue +*/ + __pyx_t_5 = __pyx_collections_abc_Sequence; + __Pyx_INCREF(__pyx_t_5); + __pyx_t_6 = 0; + { + PyObject *__pyx_callargs[2] = {__pyx_t_5, ((PyObject *)__pyx_mstate_global->__pyx_array_type)}; + __pyx_t_4 = __Pyx_PyObject_FastCallMethod((PyObject*)__pyx_mstate_global->__pyx_n_u_register, __pyx_callargs+__pyx_t_6, (2-__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(1, 995, __pyx_L26_error) + __Pyx_GOTREF(__pyx_t_4); + } + __Pyx_DECREF(__pyx_t_4); __pyx_t_4 = 0; + + /* "View.MemoryView":990 + * + * try: + * if __pyx_collections_abc_Sequence: # <<<<<<<<<<<<<< + * + * +*/ + } + + /* "View.MemoryView":989 + * pass + * + * try: # <<<<<<<<<<<<<< + * if __pyx_collections_abc_Sequence: + * +*/ + } + __Pyx_XDECREF(__pyx_t_3); __pyx_t_3 = 0; + __Pyx_XDECREF(__pyx_t_2); __pyx_t_2 = 0; + __Pyx_XDECREF(__pyx_t_1); __pyx_t_1 = 0; + goto __pyx_L31_try_end; + __pyx_L26_error:; + __Pyx_XDECREF(__pyx_t_4); __pyx_t_4 = 0; + __Pyx_XDECREF(__pyx_t_5); __pyx_t_5 = 0; + + /* "View.MemoryView":996 + * __pyx_collections_abc_Sequence.register(_memoryviewslice) + * __pyx_collections_abc_Sequence.register(array) + * except: # <<<<<<<<<<<<<< + * pass # ignore failure, it's a minor issue + * +*/ + /*except:*/ { + __Pyx_ErrRestore(0,0,0); + goto __pyx_L27_exception_handled; + } + __pyx_L27_exception_handled:; + __Pyx_XGIVEREF(__pyx_t_3); + __Pyx_XGIVEREF(__pyx_t_2); + __Pyx_XGIVEREF(__pyx_t_1); + __Pyx_ExceptionReset(__pyx_t_3, __pyx_t_2, __pyx_t_1); + __pyx_L31_try_end:; + } + + /* "(tree fragment)":4 + * int __Pyx_CheckUnpickleChecksum(long, long, long, long, const char*) except -1 + * int __Pyx_UpdateUnpickledDict(object, object, Py_ssize_t) except -1 + * def __pyx_unpickle_Enum(__pyx_type, long __pyx_checksum, tuple __pyx_state): # <<<<<<<<<<<<<< + * cdef object __pyx_result + * __Pyx_CheckUnpickleChecksum(__pyx_checksum, 0x82a3537, 0x6ae9995, 0xb068931, b'name') +*/ + __pyx_t_4 = PyCFunction_NewEx(&__pyx_mdef_15View_dot_MemoryView_1__pyx_unpickle_Enum, NULL, __pyx_mstate_global->__pyx_n_u_View_MemoryView); if (unlikely(!__pyx_t_4)) __PYX_ERR(1, 4, __pyx_L1_error) + __Pyx_GOTREF(__pyx_t_4); + if (PyDict_SetItem(__pyx_mstate_global->__pyx_d, __pyx_mstate_global->__pyx_n_u_pyx_unpickle_Enum, __pyx_t_4) < (0)) __PYX_ERR(1, 4, __pyx_L1_error) + __Pyx_DECREF(__pyx_t_4); __pyx_t_4 = 0; + + /* "spacy/pipeline/_parser_internals/_beam_utils.pyx":2 + * # cython: infer_types=True + * import numpy # <<<<<<<<<<<<<< + * + * from thinc.extra.search cimport Beam +*/ + __pyx_t_1 = __Pyx_Import(__pyx_mstate_global->__pyx_n_u_numpy, 0, 0, __pyx_mstate_global->__pyx_kp_u_spacy_pipeline__parser_internals_2, -1); if (unlikely(!__pyx_t_1)) __PYX_ERR(0, 2, __pyx_L1_error) + __pyx_t_4 = __pyx_t_1; + __Pyx_GOTREF(__pyx_t_4); + if (PyDict_SetItem(__pyx_mstate_global->__pyx_d, __pyx_mstate_global->__pyx_n_u_numpy, __pyx_t_4) < (0)) __PYX_ERR(0, 2, __pyx_L1_error) + __Pyx_DECREF(__pyx_t_4); __pyx_t_4 = 0; + + /* "spacy/pipeline/_parser_internals/_beam_utils.pyx":6 + * from thinc.extra.search cimport Beam + * + * from thinc.extra.search import MaxViolation # <<<<<<<<<<<<<< + * + * from thinc.extra.search cimport MaxViolation +*/ + { + PyObject* const __pyx_imported_names[] = {__pyx_mstate_global->__pyx_n_u_MaxViolation}; + __pyx_t_1 = __Pyx_Import(__pyx_mstate_global->__pyx_n_u_thinc_extra_search, __pyx_imported_names, 1, __pyx_mstate_global->__pyx_kp_u_spacy_pipeline__parser_internals_3, -1); if (unlikely(!__pyx_t_1)) __PYX_ERR(0, 6, __pyx_L1_error) + } + __pyx_t_4 = __pyx_t_1; + __Pyx_GOTREF(__pyx_t_4); + __Pyx_DECREF(__pyx_t_4); __pyx_t_4 = 0; + + /* "spacy/pipeline/_parser_internals/_beam_utils.pyx":13 + * from .transition_system cimport Transition, TransitionSystem + * + * from ...errors import Errors # <<<<<<<<<<<<<< + * + * from .stateclass cimport StateC, StateClass +*/ + { + PyObject* const __pyx_imported_names[] = {__pyx_mstate_global->__pyx_n_u_Errors}; + __pyx_t_1 = __Pyx_Import(__pyx_mstate_global->__pyx_n_u_errors, __pyx_imported_names, 1, __pyx_mstate_global->__pyx_kp_u_spacy_errors, 3); if (unlikely(!__pyx_t_1)) __PYX_ERR(0, 13, __pyx_L1_error) + } + __pyx_t_4 = __pyx_t_1; + __Pyx_GOTREF(__pyx_t_4); + { + PyObject* const __pyx_imported_names[] = {__pyx_mstate_global->__pyx_n_u_Errors}; + __pyx_t_9 = 0; { + __pyx_t_5 = __Pyx_ImportFrom(__pyx_t_4, __pyx_imported_names[__pyx_t_9]); if (unlikely(!__pyx_t_5)) __PYX_ERR(0, 13, __pyx_L1_error) + __Pyx_GOTREF(__pyx_t_5); + if (PyDict_SetItem(__pyx_mstate_global->__pyx_d, __pyx_imported_names[__pyx_t_9], __pyx_t_5) < (0)) __PYX_ERR(0, 13, __pyx_L1_error) + __Pyx_DECREF(__pyx_t_5); __pyx_t_5 = 0; + } + } + __Pyx_DECREF(__pyx_t_4); __pyx_t_4 = 0; + + /* "spacy/pipeline/_parser_internals/_beam_utils.pyx":70 + * return len(self.beams) + * + * def get_states(self): # <<<<<<<<<<<<<< + * cdef Beam beam + * cdef StateC* state +*/ + __pyx_t_4 = __Pyx_CyFunction_New(&__pyx_mdef_5spacy_8pipeline_17_parser_internals_11_beam_utils_9BeamBatch_7get_states, __Pyx_CYFUNCTION_CCLASS, __pyx_mstate_global->__pyx_n_u_BeamBatch_get_states, NULL, __pyx_mstate_global->__pyx_n_u_spacy_pipeline__parser_internals, __pyx_mstate_global->__pyx_d, ((PyObject *)__pyx_mstate_global->__pyx_codeobj_tab[1])); if (unlikely(!__pyx_t_4)) __PYX_ERR(0, 70, __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 (__Pyx_SetItemOnTypeDict(__pyx_mstate_global->__pyx_ptype_5spacy_8pipeline_17_parser_internals_11_beam_utils_BeamBatch, __pyx_mstate_global->__pyx_n_u_get_states, __pyx_t_4) < (0)) __PYX_ERR(0, 70, __pyx_L1_error) + __Pyx_DECREF(__pyx_t_4); __pyx_t_4 = 0; + + /* "spacy/pipeline/_parser_internals/_beam_utils.pyx":82 + * return states + * + * def get_unfinished_states(self): # <<<<<<<<<<<<<< + * return [st for st in self.get_states() if not st.is_final()] + * +*/ + __pyx_t_4 = __Pyx_CyFunction_New(&__pyx_mdef_5spacy_8pipeline_17_parser_internals_11_beam_utils_9BeamBatch_9get_unfinished_states, __Pyx_CYFUNCTION_CCLASS, __pyx_mstate_global->__pyx_n_u_BeamBatch_get_unfinished_states, NULL, __pyx_mstate_global->__pyx_n_u_spacy_pipeline__parser_internals, __pyx_mstate_global->__pyx_d, ((PyObject *)__pyx_mstate_global->__pyx_codeobj_tab[2])); if (unlikely(!__pyx_t_4)) __PYX_ERR(0, 82, __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 (__Pyx_SetItemOnTypeDict(__pyx_mstate_global->__pyx_ptype_5spacy_8pipeline_17_parser_internals_11_beam_utils_BeamBatch, __pyx_mstate_global->__pyx_n_u_get_unfinished_states, __pyx_t_4) < (0)) __PYX_ERR(0, 82, __pyx_L1_error) + __Pyx_DECREF(__pyx_t_4); __pyx_t_4 = 0; + + /* "spacy/pipeline/_parser_internals/_beam_utils.pyx":85 + * return [st for st in self.get_states() if not st.is_final()] + * + * def advance(self, float[:, ::1] scores, follow_gold=False): # <<<<<<<<<<<<<< + * cdef Beam beam + * cdef int nr_class = scores.shape[1] +*/ + __pyx_t_4 = __Pyx_CyFunction_New(&__pyx_mdef_5spacy_8pipeline_17_parser_internals_11_beam_utils_9BeamBatch_11advance, __Pyx_CYFUNCTION_CCLASS, __pyx_mstate_global->__pyx_n_u_BeamBatch_advance, NULL, __pyx_mstate_global->__pyx_n_u_spacy_pipeline__parser_internals, __pyx_mstate_global->__pyx_d, ((PyObject *)__pyx_mstate_global->__pyx_codeobj_tab[3])); if (unlikely(!__pyx_t_4)) __PYX_ERR(0, 85, __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_SetDefaultsTuple(__pyx_t_4, __pyx_mstate_global->__pyx_tuple[3]); + if (__Pyx_SetItemOnTypeDict(__pyx_mstate_global->__pyx_ptype_5spacy_8pipeline_17_parser_internals_11_beam_utils_BeamBatch, __pyx_mstate_global->__pyx_n_u_advance, __pyx_t_4) < (0)) __PYX_ERR(0, 85, __pyx_L1_error) + __Pyx_DECREF(__pyx_t_4); __pyx_t_4 = 0; + + /* "spacy/pipeline/_parser_internals/_beam_utils.pyx":120 + * return nr_state + * + * def _set_costs(self, Beam beam, doc, gold, int follow_gold=False): # <<<<<<<<<<<<<< + * cdef const StateC* state + * for i in range(beam.size): +*/ + __pyx_t_4 = __Pyx_CyFunction_New(&__pyx_mdef_5spacy_8pipeline_17_parser_internals_11_beam_utils_9BeamBatch_13_set_costs, __Pyx_CYFUNCTION_CCLASS, __pyx_mstate_global->__pyx_n_u_BeamBatch__set_costs, NULL, __pyx_mstate_global->__pyx_n_u_spacy_pipeline__parser_internals, __pyx_mstate_global->__pyx_d, ((PyObject *)__pyx_mstate_global->__pyx_codeobj_tab[4])); if (unlikely(!__pyx_t_4)) __PYX_ERR(0, 120, __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_SetDefaultsTuple(__pyx_t_4, __pyx_mstate_global->__pyx_tuple[3]); + if (__Pyx_SetItemOnTypeDict(__pyx_mstate_global->__pyx_ptype_5spacy_8pipeline_17_parser_internals_11_beam_utils_BeamBatch, __pyx_mstate_global->__pyx_n_u_set_costs, __pyx_t_4) < (0)) __PYX_ERR(0, 120, __pyx_L1_error) + __Pyx_DECREF(__pyx_t_4); __pyx_t_4 = 0; + + /* "(tree fragment)":1 + * def __reduce_cython__(self): # <<<<<<<<<<<<<< + * cdef tuple state + * cdef object _dict +*/ + __pyx_t_4 = __Pyx_CyFunction_New(&__pyx_mdef_5spacy_8pipeline_17_parser_internals_11_beam_utils_9BeamBatch_15__reduce_cython__, __Pyx_CYFUNCTION_CCLASS, __pyx_mstate_global->__pyx_n_u_BeamBatch___reduce_cython, NULL, __pyx_mstate_global->__pyx_n_u_spacy_pipeline__parser_internals, __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 (__Pyx_SetItemOnTypeDict(__pyx_mstate_global->__pyx_ptype_5spacy_8pipeline_17_parser_internals_11_beam_utils_BeamBatch, __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)":16 + * else: + * return __pyx_unpickle_BeamBatch, (type(self), 0xa2d29a4, state) + * def __setstate_cython__(self, __pyx_state): # <<<<<<<<<<<<<< + * __pyx_unpickle_BeamBatch__set_state(self, __pyx_state) +*/ + __pyx_t_4 = __Pyx_CyFunction_New(&__pyx_mdef_5spacy_8pipeline_17_parser_internals_11_beam_utils_9BeamBatch_17__setstate_cython__, __Pyx_CYFUNCTION_CCLASS, __pyx_mstate_global->__pyx_n_u_BeamBatch___setstate_cython, NULL, __pyx_mstate_global->__pyx_n_u_spacy_pipeline__parser_internals, __pyx_mstate_global->__pyx_d, ((PyObject *)__pyx_mstate_global->__pyx_codeobj_tab[6])); if (unlikely(!__pyx_t_4)) __PYX_ERR(1, 16, __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 (__Pyx_SetItemOnTypeDict(__pyx_mstate_global->__pyx_ptype_5spacy_8pipeline_17_parser_internals_11_beam_utils_BeamBatch, __pyx_mstate_global->__pyx_n_u_setstate_cython, __pyx_t_4) < (0)) __PYX_ERR(1, 16, __pyx_L1_error) + __Pyx_DECREF(__pyx_t_4); __pyx_t_4 = 0; + + /* "spacy/pipeline/_parser_internals/_beam_utils.pyx":141 + * + * + * def update_beam(TransitionSystem moves, states, golds, model, int width, beam_density=0.0): # <<<<<<<<<<<<<< + * cdef MaxViolation violn + * pbeam = BeamBatch(moves, states, golds, width=width, density=beam_density) +*/ + __pyx_t_4 = __Pyx_CyFunction_New(&__pyx_mdef_5spacy_8pipeline_17_parser_internals_11_beam_utils_1update_beam, 0, __pyx_mstate_global->__pyx_n_u_update_beam, NULL, __pyx_mstate_global->__pyx_n_u_spacy_pipeline__parser_internals, __pyx_mstate_global->__pyx_d, ((PyObject *)__pyx_mstate_global->__pyx_codeobj_tab[7])); if (unlikely(!__pyx_t_4)) __PYX_ERR(0, 141, __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_SetDefaultsTuple(__pyx_t_4, __pyx_mstate_global->__pyx_tuple[4]); + if (PyDict_SetItem(__pyx_mstate_global->__pyx_d, __pyx_mstate_global->__pyx_n_u_update_beam, __pyx_t_4) < (0)) __PYX_ERR(0, 141, __pyx_L1_error) + __Pyx_DECREF(__pyx_t_4); __pyx_t_4 = 0; + + /* "spacy/pipeline/_parser_internals/_beam_utils.pyx":200 + * + * + * def collect_states(beams, docs): # <<<<<<<<<<<<<< + * cdef StateClass state + * cdef Beam beam +*/ + __pyx_t_4 = __Pyx_CyFunction_New(&__pyx_mdef_5spacy_8pipeline_17_parser_internals_11_beam_utils_3collect_states, 0, __pyx_mstate_global->__pyx_n_u_collect_states, NULL, __pyx_mstate_global->__pyx_n_u_spacy_pipeline__parser_internals, __pyx_mstate_global->__pyx_d, ((PyObject *)__pyx_mstate_global->__pyx_codeobj_tab[8])); if (unlikely(!__pyx_t_4)) __PYX_ERR(0, 200, __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_collect_states, __pyx_t_4) < (0)) __PYX_ERR(0, 200, __pyx_L1_error) + __Pyx_DECREF(__pyx_t_4); __pyx_t_4 = 0; + + /* "spacy/pipeline/_parser_internals/_beam_utils.pyx":214 + * + * + * def get_unique_states(pbeams, gbeams): # <<<<<<<<<<<<<< + * seen = {} + * states = [] +*/ + __pyx_t_4 = __Pyx_CyFunction_New(&__pyx_mdef_5spacy_8pipeline_17_parser_internals_11_beam_utils_5get_unique_states, 0, __pyx_mstate_global->__pyx_n_u_get_unique_states, NULL, __pyx_mstate_global->__pyx_n_u_spacy_pipeline__parser_internals, __pyx_mstate_global->__pyx_d, ((PyObject *)__pyx_mstate_global->__pyx_codeobj_tab[9])); if (unlikely(!__pyx_t_4)) __PYX_ERR(0, 214, __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_get_unique_states, __pyx_t_4) < (0)) __PYX_ERR(0, 214, __pyx_L1_error) + __Pyx_DECREF(__pyx_t_4); __pyx_t_4 = 0; + + /* "spacy/pipeline/_parser_internals/_beam_utils.pyx":252 + * + * + * def get_gradient(nr_class, beam_maps, histories, losses): # <<<<<<<<<<<<<< + * """The global model assigns a loss to each parse. The beam scores + * are additive, so the same gradient is applied to each action +*/ + __pyx_t_4 = __Pyx_CyFunction_New(&__pyx_mdef_5spacy_8pipeline_17_parser_internals_11_beam_utils_7get_gradient, 0, __pyx_mstate_global->__pyx_n_u_get_gradient, NULL, __pyx_mstate_global->__pyx_n_u_spacy_pipeline__parser_internals, __pyx_mstate_global->__pyx_d, ((PyObject *)__pyx_mstate_global->__pyx_codeobj_tab[10])); if (unlikely(!__pyx_t_4)) __PYX_ERR(0, 252, __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_get_gradient, __pyx_t_4) < (0)) __PYX_ERR(0, 252, __pyx_L1_error) + __Pyx_DECREF(__pyx_t_4); __pyx_t_4 = 0; + + /* "(tree fragment)":4 + * int __Pyx_CheckUnpickleChecksum(long, long, long, long, const char*) except -1 + * int __Pyx_UpdateUnpickledDict(object, object, Py_ssize_t) except -1 + * def __pyx_unpickle_BeamBatch(__pyx_type, long __pyx_checksum, tuple __pyx_state): # <<<<<<<<<<<<<< + * cdef object __pyx_result + * __Pyx_CheckUnpickleChecksum(__pyx_checksum, 0xa2d29a4, 0xb00362f, 0x8d7a14f, b'beams, docs, golds, moves, states') +*/ + __pyx_t_4 = __Pyx_CyFunction_New(&__pyx_mdef_5spacy_8pipeline_17_parser_internals_11_beam_utils_9__pyx_unpickle_BeamBatch, 0, __pyx_mstate_global->__pyx_n_u_pyx_unpickle_BeamBatch, NULL, __pyx_mstate_global->__pyx_n_u_spacy_pipeline__parser_internals, __pyx_mstate_global->__pyx_d, ((PyObject *)__pyx_mstate_global->__pyx_codeobj_tab[11])); if (unlikely(!__pyx_t_4)) __PYX_ERR(1, 4, __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_pyx_unpickle_BeamBatch, __pyx_t_4) < (0)) __PYX_ERR(1, 4, __pyx_L1_error) + __Pyx_DECREF(__pyx_t_4); __pyx_t_4 = 0; + + /* "spacy/pipeline/_parser_internals/_beam_utils.pyx":1 + * # cython: infer_types=True # <<<<<<<<<<<<<< + * import numpy + * +*/ + __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_4); + __Pyx_XDECREF(__pyx_t_5); + if (__pyx_m) { + if (__pyx_mstate->__pyx_d && stringtab_initialized) { + __Pyx_AddTraceback("init spacy.pipeline._parser_internals._beam_utils", __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 spacy.pipeline._parser_internals._beam_utils"); + } + __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, 75, __pyx_L1_error) + __pyx_builtin_enumerate = __Pyx_GetBuiltinName(__pyx_mstate->__pyx_n_u_enumerate); if (!__pyx_builtin_enumerate) __PYX_ERR(0, 90, __pyx_L1_error) + __pyx_builtin_max = __Pyx_GetBuiltinName(__pyx_mstate->__pyx_n_u_max); if (!__pyx_builtin_max) __PYX_ERR(0, 274, __pyx_L1_error) + __pyx_builtin___import__ = __Pyx_GetBuiltinName(__pyx_mstate->__pyx_n_u_import); if (!__pyx_builtin___import__) __PYX_ERR(1, 101, __pyx_L1_error) + __pyx_builtin_Ellipsis = __Pyx_GetBuiltinName(__pyx_mstate->__pyx_n_u_Ellipsis); if (!__pyx_builtin_Ellipsis) __PYX_ERR(1, 409, __pyx_L1_error) + __pyx_builtin_id = __Pyx_GetBuiltinName(__pyx_mstate->__pyx_n_u_id); if (!__pyx_builtin_id) __PYX_ERR(1, 619, __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; + __pyx_mstate->__pyx_umethod_PyDict_Type__update.type = (PyObject*)(&PyDict_Type); + __pyx_mstate->__pyx_umethod_PyDict_Type__update.method_name = &__pyx_mstate->__pyx_n_u_update; + 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); + + /* "(tree fragment)":11 + * use_setstate = True + * else: + * use_setstate = ('self.name is not None',) # <<<<<<<<<<<<<< + * if use_setstate: + * return __pyx_unpickle_Enum, (type(self), 0x82a3537, None), state +*/ + __pyx_mstate_global->__pyx_tuple[0] = PyTuple_Pack(1, __pyx_mstate_global->__pyx_kp_u_self_name_is_not_None); if (unlikely(!__pyx_mstate_global->__pyx_tuple[0])) __PYX_ERR(1, 11, __pyx_L1_error) + __Pyx_GOTREF(__pyx_mstate_global->__pyx_tuple[0]); + __Pyx_GIVEREF(__pyx_mstate_global->__pyx_tuple[0]); + + /* "View.MemoryView":583 + * def suboffsets(self): + * if self.view.suboffsets == NULL: + * return (-1,) * self.view.ndim # <<<<<<<<<<<<<< + * + * return tuple([suboffset for suboffset in self.view.suboffsets[:self.view.ndim]]) +*/ + __pyx_mstate_global->__pyx_tuple[1] = PyTuple_New(1); if (unlikely(!__pyx_mstate_global->__pyx_tuple[1])) __PYX_ERR(1, 583, __pyx_L1_error) + __Pyx_GOTREF(__pyx_mstate_global->__pyx_tuple[1]); + __Pyx_INCREF(__pyx_mstate_global->__pyx_int_neg_1); + __Pyx_GIVEREF(__pyx_mstate_global->__pyx_int_neg_1); + if (__Pyx_PyTuple_SET_ITEM(__pyx_mstate_global->__pyx_tuple[1], 0, __pyx_mstate_global->__pyx_int_neg_1) != (0)) __PYX_ERR(1, 583, __pyx_L1_error); + __Pyx_GIVEREF(__pyx_mstate_global->__pyx_tuple[1]); + + /* "View.MemoryView":680 + * tup = index if isinstance(index, tuple) else (index,) + * + * result = [slice(None)] * ndim # <<<<<<<<<<<<<< + * have_slices = False + * seen_ellipsis = False +*/ + __pyx_mstate_global->__pyx_slice[0] = PySlice_New(Py_None, Py_None, Py_None); if (unlikely(!__pyx_mstate_global->__pyx_slice[0])) __PYX_ERR(1, 680, __pyx_L1_error) + __Pyx_GOTREF(__pyx_mstate_global->__pyx_slice[0]); + __Pyx_GIVEREF(__pyx_mstate_global->__pyx_slice[0]); + + /* "(tree fragment)":11 + * use_setstate = True + * else: + * use_setstate = ('self.beams is not None or self.docs is not None or self.golds is not None or self.moves is not None or self.states is not None',) # <<<<<<<<<<<<<< + * if use_setstate: + * return __pyx_unpickle_BeamBatch, (type(self), 0xa2d29a4, None), state +*/ + __pyx_mstate_global->__pyx_tuple[2] = PyTuple_Pack(1, __pyx_mstate_global->__pyx_kp_u_self_beams_is_not_None_or_self_d); if (unlikely(!__pyx_mstate_global->__pyx_tuple[2])) __PYX_ERR(1, 11, __pyx_L1_error) + __Pyx_GOTREF(__pyx_mstate_global->__pyx_tuple[2]); + __Pyx_GIVEREF(__pyx_mstate_global->__pyx_tuple[2]); + + /* "spacy/pipeline/_parser_internals/_beam_utils.pyx":85 + * return [st for st in self.get_states() if not st.is_final()] + * + * def advance(self, float[:, ::1] scores, follow_gold=False): # <<<<<<<<<<<<<< + * cdef Beam beam + * cdef int nr_class = scores.shape[1] +*/ + __pyx_mstate_global->__pyx_tuple[3] = PyTuple_Pack(1, Py_False); if (unlikely(!__pyx_mstate_global->__pyx_tuple[3])) __PYX_ERR(0, 85, __pyx_L1_error) + __Pyx_GOTREF(__pyx_mstate_global->__pyx_tuple[3]); + __Pyx_GIVEREF(__pyx_mstate_global->__pyx_tuple[3]); + + /* "spacy/pipeline/_parser_internals/_beam_utils.pyx":141 + * + * + * def update_beam(TransitionSystem moves, states, golds, model, int width, beam_density=0.0): # <<<<<<<<<<<<<< + * cdef MaxViolation violn + * pbeam = BeamBatch(moves, states, golds, width=width, density=beam_density) +*/ + __pyx_mstate_global->__pyx_tuple[4] = PyTuple_Pack(1, ((PyObject*)__pyx_mstate_global->__pyx_float_0_0)); if (unlikely(!__pyx_mstate_global->__pyx_tuple[4])) __PYX_ERR(0, 141, __pyx_L1_error) + __Pyx_GOTREF(__pyx_mstate_global->__pyx_tuple[4]); + __Pyx_GIVEREF(__pyx_mstate_global->__pyx_tuple[4]); + #if CYTHON_IMMORTAL_CONSTANTS + { + PyObject **table = __pyx_mstate->__pyx_tuple; + for (Py_ssize_t i=0; i<5; ++i) { + #if CYTHON_COMPILING_IN_CPYTHON_FREETHREADING + Py_SET_REFCNT(table[i], _Py_IMMORTAL_REFCNT_LOCAL); + #else + Py_SET_REFCNT(table[i], _Py_IMMORTAL_INITIAL_REFCNT); + #endif + } + } + #endif + #if CYTHON_IMMORTAL_CONSTANTS + { + PyObject **table = __pyx_mstate->__pyx_slice; + for (Py_ssize_t i=0; i<1; ++i) { + #if CYTHON_COMPILING_IN_CPYTHON_FREETHREADING + Py_SET_REFCNT(table[i], _Py_IMMORTAL_REFCNT_LOCAL); + #else + 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[] = {{2},{68},{35},{54},{37},{60},{24},{52},{26},{34},{29},{33},{45},{22},{15},{179},{37},{30},{32},{1},{1},{1},{1},{1},{8},{5},{6},{15},{23},{25},{7},{6},{2},{6},{35},{9},{30},{50},{39},{34},{8},{126},{21},{12},{38},{51},{48},{20},{32},{22},{14},{30},{37},{5},{9},{34},{27},{29},{20},{17},{20},{31},{4},{4},{4},{8},{6},{12},{20},{8},{15},{1},{3},{7},{15},{6},{9},{7},{18},{8},{1},{9},{4},{4},{12},{8},{9},{5},{12},{9},{1},{8},{4},{9},{17},{18},{5},{14},{5},{3},{6},{8},{7},{8},{5},{3},{4},{5},{5},{15},{5},{6},{9},{5},{6},{1},{5},{11},{6},{7},{8},{9},{5},{6},{7},{12},{10},{21},{17},{12},{4},{5},{5},{4},{9},{5},{1},{2},{10},{5},{13},{7},{8},{5},{5},{8},{1},{3},{4},{6},{8},{3},{4},{7},{8},{11},{4},{5},{10},{5},{6},{4},{8},{4},{7},{4},{8},{8},{7},{8},{5},{3},{3},{9},{4},{5},{6},{3},{12},{14},{12},{11},{10},{24},{19},{14},{12},{10},{17},{13},{8},{6},{4},{4},{4},{10},{12},{10},{12},{19},{5},{4},{44},{2},{5},{5},{13},{6},{15},{5},{4},{4},{6},{8},{18},{5},{6},{6},{11},{12},{5},{6},{5},{6},{5},{1},{5},{3},{118},{423},{161},{2},{77},{29},{363},{485},{82},{107},{55},{231},{11},{92},{51},{39},{1}}; + #if (CYTHON_COMPRESS_STRINGS) == 2 /* compression: bz2 (2958 bytes) */ +const char* const cstring = "BZh91AY&SY\334N]\t\000\002\031\177\377\377\377\377\377\377\377\377\377\277\377\377\372\277\377\377\364@@@@@@@@@@@@@\000@\000`\013N\rpg\320\031\3148\333l\266\265\255K5j\265\246\323<\000\017\003M\022BL\201\036G\251\250\301\033\021\247\2056\311M\344\324\332)\222z\233h\207\242\217M4\031=M4\310zP\365\036\232\233\3220j4\022\210\004\320\004M15=\024\364i\351O&\2432\207\250h\003 \r\000\000\r\000\r\032b\032\0004\r\000I2\024\321\240\003@\003FM\006\200h\000\323@4\000\000\000\000\320\310\r4\004\246\210)\351\2424\232\2315\032f\246\032M\251\240\000\000\000\000\000\000\000\000\000\032\001\220\203&\000L\000\004\300\000\000\000&\t\200\t\200\000&&\000\000&& \022$\206S \230\231O$\332e2O\024\364\324\006\200\032\000\000\000\000\000\000\000\000\000`\313\274\275\300Uk\031WL\357I\004&\336\267\320 \337\003\201\000\343k\247\203\217\215\342\0032\260YEH\205:\377\256QQ\312\024\254\245*\034\376\202\031\204\206d\263:\023\335g\263\031\030a\377\022\224c\305b\244\310\241vlD0\220\220\220!\024f\245\264`\321\203\022\312\305j\206\335a\013\032\345v\003\0242GKR\243&\256[\320K\221\003\231k\034\230\246\302\315\0303]0$\023bl\205\"\332\314bI$,t\215\255\2030\317Qh\211\300\251$\251\313\244\324\211\360\244\327\300\273AG\320\205\n\3348\252\254V\210\221$\242\252\304\262MGV\367\352qK\207E\035V\222A\n1Ln\006\3227\364Y\006\013\000\324=\272\234\341\234\2468\020Z[\212\224\236\265\234\275\331#\3624\201\177+\367?\226\234\234\027Q.\212GI\251\212\204Y\026G\331\207(\352\271PKr`\317\240\2428V\220V\023!)VdV\021Y\276\264K\207l\217\033\371\201x\324\312\262\363\036\2237\003\334\n\224\273lK\335\222\022\352\337\246S\2608\313\256\200\230\303\032\322\303\n)\232Z\200\314\230<\272\256\001T\255u\032-\003B\232*\200\300\345%\332\352\335\245HV\354\233\323\276\305\326am\205\376\t@\327\021_\210\301\332\314\302\")\252\241`\t\206-\221;\n1*R\325\250\r^\250\025P\207\004\342\221\251\356\355\267\272y\251\nR<\035,s\n\353I\"Hw\255\245y;D\210\211WD\236%\226z\0311H\372\232\335Z\314[\233\3243\223\267^\3429\303Q\255X\233z\226\032\r\020\034Q\322\304\371I""ER\210\253\310\321\360\257j\016\214t\306\346\275&\263ZUq\253\016*\340\235\233\265\021\t=\312\244\332\321R\231\245>\337\302\225!\020\"\024\004M\000\367\217\036<\311\240\205\226s\246M\327\0168\236D\335\370\244Y\325}\242\271\325b4\351\357\027\232\247\312\335\234bl\364/\353B\233-[P\270Mt\314\230:\n\271Y\321\220F\022b\216\343@\330\343\316c\304\275F\357\327ON\331\035z1\360\034\354\232\306\261QR|\233\363\310k\240\317\237s\262y\207\027\340d\333\315GX\303\003\004\303\023\221\303\201\310\326\3364\332k\330a\243\245F\267+Kj&\223J\261\273\256\373\302\336\020\303V\236\244+D\356*\340\2053\206\271#\206\330!z%\342\\\206\\\274N\210\350#`1\255F6\214\356\354b\343\266O%V\311S\307\347m\240\340tq\354j^l\245&\014\030H\303 \341\303\217\304[\221z@^\201X\010,\031CJ\036\343\344\231\0246\370\224\212?NLo\236|*\3518w\321V\256\322\3063\225\254\030\306T\2661\016\006\341\326\314\335\221F\261\005o\355|9\024\027\202\031\021\302\265\212\204^T\"_\343\303%uZx\221T\371\3341\236\324\3251\020Y4+\323&\323!\232\327\331\240\242\230Ul\256W\245\034}2ni\225B\304\335U\234}#0\220\375\272\344\331\"\255\013\030\377W*\210Xv\034N\373\365\027g\253\375\026\262\237E\241Gf\003\321\021\310(\033\034V\017(@\204\036\034\370\025H&\326\300\225V\342\\\003\036\031\2662Y\007\2415\331c\210\376h\024Wp\254G5\210\313\206\"\014R\342l\315\224\277\207\256X\262\230\252\232\215\343JjM\356\037\r\217sX=\217kqe\260\3356\313K3g\306Q\260\335\023\224\253%\253\302\013\340\\^e\217.,\274\267\366o\231^\270\301sX\260\306\231\231\220\352\307\215\226\352A\330]xt\235(2\035\325\315\337\031\320\266\3658\353\354L\344\026\241\350j$c1\224H\304DC\033PbAY0\3367M\030ixL!\036\034\234\016\241\240\260\344\263\344\362\265cj\213.+a\235\331J\365\"\024\255a\313\005\304ADZ\250I\203\021QN\213g\206g\312\231MVt\315\352\204jy\201\246\273uv\2325j\215\315\371`\304\026C\344\251i\245T\317:-\341\346.\035\243q\024%\"/D\0256\324\345\025\303AN\006\013\214\326\2412oX\322C\267=0\2267\207\207\246M\306\231\2717\314\240k\331B\026\266\231\313\310`1\326F\"\341\t\"-\001$\254m\246\360\250""\344[#n\021m\034\242P\220\220L\356r\207G\230\305(\005\215\354pZF\355.\312.\211\232\264\311\"\027\013@\351\316\034\031\326\322\236/Z\244-\253m!$\302I&\224+R\243.7\231\335\032\312\316\342#\031\303{\263\347p\357\347\016\347`\264\337\031\270\214\241\227ol\274{bc\336\275\263)\242\322\335\322\244\203\366,\257K\3626\031\333b\270p\362,\035u\2475\323\342\301E\314X\325\365\251)\262 :\020\244H\204\357D0$;,\331\222\254\306\"G9\315\234A\246i\206\311\035\235\037\003\264I\tE\365&[C\235$\262Lm\335\005vh*\337\324p\223\251\261\2064P\275\213+\241\236\\\312b-\n\362d2+\351\215\320\034\2533Z!\272\025\240F\256@\257t\010\342\304\r\304\372\333\031\353\212\016\203\0239\262\270V\021\360\025f9\030\241ud\372:\262\333\033\264Kfv\032p\207\020\365Zs\211+\200\332\304p\275#\273\271\334C:G]6\246\222\335\204\252b\202\217\220(8\215\227\017\227\224\253@\354\231$_Ze\032\252,\030l\222.\240\247^\255VSj\330K\216'ym\340\020\324dQh\215$U\322\023\307\036\"L\311\335\034't\264\037\325H5\206\033z\264\230P\265\354\265;\260#\250\233\025w\n\031\003\261\251:M:\nd\201\265:\323\025&\226F\330\330\311\315]u\274\333B\022\265\247\202\372(\301\317\005\301g9\333i\031\353_\020\265D\252\342\233\344\033i\273\231Q\220\016X\222\327\010\033-+R\033\214\261\200\305\024\340\t\212?\316\034\024!\236\215XF\241P\302$\025\211\315\310j\204\031\2639\255\211\264\363\315\201!!\264\355r\nn\361\033U\214K\263&|\262\232\326\250\030\004\364rj\255-r)\264\251\256\030\330\342\221\216\344'\201+\254\244\232\275\357G\311e\234\361\302\022\263\030\352\346\241\205JrM\207\003s\016\250\034y\021\nK\305\252\276J\310\262\007\007e(\303y\244\326h\321 k`k\030In\243Fbf\203\214a\260com!N\203<\3564]\370\024C\034y\344\021#\177&#\230\211(\010!\212(\210K6\023\207\\\031\006Y\032\262\331ibO3\224N\225.\n\232%\004*j\221L\246F\262)$M%\021\256K\03065\223\315d\2632\325\306/(\361\344I-\366\335`E\037`\232\352\354\264^\246;$\221\244s\347\216\2611\315\200\243\350\203\350z]I\243\223\273\316\013aM!\260w\035%\234\033\206\343\347\264\204\207}\304\332R\272\262$\307\214\271\355<\234""\251\217s=~)2t\241\203\237\021\227,\370\rg?\203\0312eY\267\216\033\344\232\004\022\3357IH\311Z\312N&m\370\007\232\256\273\221y\260\350/>l\330b\362`{\322\262&\204\206\036\316\353C\n\375\225\232v\007z\005J\203V&\010l>\032Q4\355_0\300b\224\322\265^\263-\272\321\006\234\207\030\2539\266X\227+F\033\320\306\255\t\273\247\273\201E\333^8\345.\235q\256 \324j:\303Gj\362\224/AZf8\016z\233\227C\035\013\251\231v\225\r\366o\332dNb\214\346&\206\366\373t\300*\027\241\001\206\204M\002h6/*1\032[#\033u\216ZY\013\\\235\352[\277u\327g\275\255\203;\334\205\025j\0224\346\235\t\014x\356\320\302`\340\307zB\026\343\361\316Q\276\307\207I\020\024\205e\234W9\000\375\355F\320\321d\rv\317a\260\350\213\342\2572\374t%\313\347\350\332\316\007\265\037\301\006\212%\360\330\266\200Z)\312 \250\326(\007\221v\211\330\275j\227\036\032>\220?\202\204\002\007\351\317\006\322\014\253\365D\277\300S\263\375\352F\344M?\n\274\203I8'\355\217\317\276\332\016\003l\261\344\302YXWsB\033a\2121M\317\216\220\332\304LL9A\201\341'\212f\030$n-\326\326\304\255\331\271\333Ub\033l\240\234eTxO\"z\352\211\201\212e\241O_|\3570\270\020\227:\213\213\222\202P\032\206\310\361\013\027\003\222R\322\024\247\321|\212O\374\320\207V~\226\341[\257\300\177\325\341\031N\023\003\312\027O\037\210n\374DQ\227\211z\245A\272\360\231.\360C\036h^\211\344\377\334[\036\371-\230Q\024\021\r\241\005;4\006|A\311\014>/>x\372\304\"\031\360\305\213\013\216\201t!@\356S\245\347\017\207\323\307f\250\361\323A\231\004\001\361a\314[u\301\341B\003\0062\207\355\352\346\346\277G\315:~6\232\347'\263\311Ju\021Ax\005\031\306\306\274\374\316\320\260yi\207\331\362\216\307\3540\224z\362F\036\366\360\353\247T`\214\036\220\376b\257\2415*,\331\265f\357\376\036\0001\263\024\3703;\226\205\207G6""\177$s\362\360:[5\371Vq5\371+e\305\020\346R\352X\354t\016\300\375rF\013\307\362lk\306\n\323%\274oC\225\t\276\245\004\021\3023\033P\312\322,\311()\037\235\233F\215;\000\031\020RY\261\211\254\237\245\274\250\274\370q\361\366\242\244\205\303?`{\201\350j\232\211\312\201\016\224\223g\230.6#xEQY\256+=\333S,\2160Q\3266\346\355tp\233\334R\004w\351C)\310Z0\027y\253p\0077\013)\256F\227\223\367Cf\n^|\276\013<\204\234\022\214i\032\027c4_\271\274\255\264XO\342\007>\177\344\216\275\r\364\033K2\007K\202\215]\356\200\030.o\321\177\273FI\025\357\025.\377\312t]\265\010\036JV\001B\327\3264\3334)\034\024\246\310j\332\335\035\\\246II\260\367\2764\217)tO7\004\355\313\345\356\rM\271DejH\366P\006\324\214|\315\345\226+[c\273/\r\221\270\350\024\2450>r\345\356\337\224k{\270e\331(]\235y\246\253\250\252\303uO\343\252\252\350\236L\324\262\255\037Q\312\256\301L\214j\206e\270\252jy\255v\257\250j\266\303\213-\370\031r\035\245\316\0143\251\227\321\"\342\355\234\346\265\030\272\342\313\031)n\367\0047\353\305\032g-1n\214g\266\305\211\234rD\267\265\375\007\032\266\251\357?\322\262\273|""\377\021\001\252\354\036\222f\213\265\370.c\233i\275\"w\034\333\021\311w\333h\203\341\026/\252m\346\010\356\250\206\005\202[ WQf\372\207\263\334\246aiE\224\312aE\301\231\2435\245\313\325\261\313\325=.WU\002E\365\\\003\356\355\336\332\335D-\365]\264\331k\243\\\267\330\263k|\267\325j\010\333s4~\317\333\"63M[\223\002,K\2523\227\025\367\031M\304\201VL\365\273X~\265\264\274|\037\321\336g\256\326\334\372(\252j\203\2032\305\273\344i\212{\305\006\267\240@\316\316\031)\351\022R\252\352\316!4\271,\330~\203\030\003\271\204+\266mL\3572K\343\333\006\332<\251\370n\233g\325\301e\321\344z:\\\271v\353\347\312\265\333\327\360+UL\323h\013CTd\365\237\262\265\267\206m&\002\243\276\350\255\341\367\000\342\246>C)_\362\372+\336\36186%m,n\313\244\212NO\303\031\303\246&\222\303\332mn\351L\250I\3033!\261f\242gi\206]D\273@\347A\007\301\272\r\325\264\205\250\325\230\266\322v\354\266\2501\301\211\021\222\025:\265\271\333\223\337-\326\036\277\205\354\243\032o\030\226\352\265Q@^k\253\202\232Ph\332\370\003:\212n&5U\325\361\007`!\241\240\277\330\035$TAT\215\323\346\032\302\340\251\212\245xi\320QWWM]\206\250\247\013\2471\251\252N\000%/t/5\260NM\245\223\276\313\207j\0105\351~\336P\301 K\303\341\304\321H\362\004\221}\2274_\275n\262\206\250cs{U\245\206\207~AL\322CKU\353\236\245\201d*Q\033J\336\240\364\345C\244L\243r7\034\246\033P\310m:\354K\202\304h\240\236\251A\2627!\240\334[\n\016-&\232\206p\351g;\006\227\177\204a\350\252\232\350\232\252\312\033\003\345\270UN|\023\004xaS\234\260\302bV\"\314\251:\177X\341=\302\222~\264s\213\241\004x\256\2658\263p\277\240\313E\013&\242<\275S\254\351P\247\237\211\271\266\356\231\234\336\020?K\245\250H\326 \330\311\023G\003\236\240&\036k\256\345$\205\307[f(\337\274\235\276\204\3244T\010\264k\217\301m\023\021\t[\371\300\315\247\255\252\220%Ucm\203\210$\277\233\\[\021^+\371\007N\340\200H\276S\034\351S2@~yV\333\320V\020\365V\177~a\257X\343\265\272\362\342F\373tz$\225""\220\312\367\207\362\277C\313\005-\342$+%\313\331\216\034N,)\367\306M%\\\215\\P\023\027\305p\035\217Z\213\034\361\334s\244\270M\307^\005x\250T\322\375\311S\256\356\t\276\225\000.y^\362\020]\250\233%\037b\325\320\335\346\032\335z\304G\003W)W\271\324\265q\031\274\262\240$\357\313\023\373\030\027\224\264\252\352\r\211\202z[\2669\257\213TZ\334mwI\217\244\005\022BL\310K\264!\325U\032>eF\223G\373\245\321\344\261~u49\343g\322\307\361~\207\006n\372\271\315\311\303\237D?\337\277\355_\367\265 \027\344G\331\257\373\037\202Lp:\360\302GQ)z\024_\217Y\334\033\036\036\212\365\374:\226\312\366\263\376a\1775h\206F\324\211\017\306\245\370\361\340\361\260<\312\036\355/\366=\277<\232\236\361\247\3747A>\270\021fF3\347\303B\224\213.\3077\006\007\007\245\301\203!L'\375E\337\013\226\303\352h\366\333`>\350\204\231\360Lt \232\217>\016r\203\374h\366\214\357\006\327\0036\232\373K\360!\312D\247#/~\224\372\316\316!\2643\341\301\260\024\226G\263\347\202wa9|\20599Z\252\020\346\302\374hz\326\177\024\224\202\377K@y\3303\321lT\215\330f\372\347dT\216\252\2439E\372\034\004`e\212\273\021VCF`O\371\357\203j\260\202$:{\376\036\005\352w\360'\2671y{\220\331\314\236\r\036\206\337\313d\262\363\360\257c\345Wqf\224=\336w\375\322(;\335_\352\257\371=l\224\033M\223m\321\357\214f\276\013\026\203\337\261\355\303\370\312\240<\2329C6\312g\225b \274\216\206\245\321\3347\243\271\263A9\250\322\353a\230'\323\305\260\2749s\026Y\277\014\3412\353?\016\312\033\347\256F\335\370\035@94dd\373-\350l(\327\343\222_\376T\376\234\2358r\302\317Q\034\017\375Bp\022\313\275\r\027\341\273\005\357b\200\205\346\202#\341lZ\223\024\353B\214\317\323~\003\2313\312\246\363\251,_\376A\304\331\r^\207\337EK\221\210/\306\265\301\221a\356S\346\363\267\023S\307\372\345\224\246\331\376\341~\017\213Rm\263'\374|\022\300\245\340\002\226\253\243\374\357\001\377tR\301$3`\343\371K\204\3039L1B\021\345#\3007\003\326v\202\014-8\325\177\343\347Ax\206I\331c\375w~\031\361\177\037\036\010/\000vb\365\201\270089(\017^\201\035\371\002rL\273\344\016z\344\244\304q\337.""\371}xk\375\302zu\235}\021\365\237\016\030\205=\341\317S\230A\356\363W\023\307\3460\347~\240\215y\275\034\274\n\263@\366\014\002\274\020WcF\330\037\362\233H\262\023e\250`\313\330\203Ss|>4\221;\355W}\216VX\nz4z\332\327\203\363A\205\026\303\246\244\013\033\023\313\353P\200\351\3762f6\202\367\341;\320\2500\230\033\346F\373\033\267\025\004\202\3227\221\322\353\360T\310\001\300\022P\313\220W\271\377V\246\206\362}\325\277\330\347\376\317\330\337\roD\231\317\263\023Gr\376\321\340N\270\262Q\272?\314\003,`\223\363\317P\266I\267\202L\3076Q\251i\204y.bh\022\360\244\353\277\245\356\333\034O\0050G\246\307\255\235\363\347\240Z\363\330\341\027te=.\307\325\035\215\277w\364\337\303\205u,E\2754.\217\354\245\0332\210\231S\376?\321\376S\240\201\216\366\247\224\320L4v\"\3709|\020Ma\225\032\214\263\337\310e;)\030\323D\326l\377\210/\323\270\001\323\364)\377\035x\362&\274\024\235\217*\340?\014\325\024\377\323\241\033\335\212\347\241\251\007\206\363\303\016E)\363\332L\235\252[\226T\274O\373&Jv#\372*\376a\360\257u\311\340\311\376\337}+\\F8Z\234\333\370iiX\"$\347\020\346O\330T\302\232C\253\220?\372\351\320\304\324\327t\000d\373\307\241\013D\247B$C\375\005A\331\220\t\260\256@\342\277\t^\202\217\211~\031\221+Y\355\016J[\023\306+fi\305\327\330p\026\022\374 \312\306\2238\005HK\201\305#\277\344?\014\026H\377\016\177\352\242\273*\230UM{\027\372\264\231\235\2436<\374\211\252\273q\374Jt\021\225^\215W\206g\326!\202\273,\020\203\315\311\277\222\010]\213\217\016\356\014W6\252/G\223'\301\251\307h\244*-\362\273\177\213\016\255\037\300\301'\203\257![\222\330\223\277\016:T\345\212\177\n]\356\006%j\237\347\220\253D\014d\307\241W\250e*\301\251\200\201!%\022Kb\304y,\375&\312\323\337C\030q`\232\017;\233\230\3720\270\202\261\327\3217q>^\004.7\207\271a~4\277\000\315\237!\340f\021*\271MQ\r\2446\316\221<\243\373\242\023\262G\\\270u\007\325Am\230\031\236\034\336G\264g\013`\303\3158\027\237\227\324\335\353\334E%j\362\234\271\037a\272\022\036\201\242\236\307\321\360&\316\323\361\016u\212\016E\354\277\336\032\230\353:""\252;\221\334u\276\274\\\334J\314B}\302\327x\213/M<\177\376V}Y~\366\333D\345\351\213\327\377P\237T\336W\236V\376\244\357N\027\017W\233\233\213\352\216\353\r\014\013\312\330|y\242\311D\363\346\342\363\377\000/\3524\016"; + PyObject *data = __Pyx_DecompressString(cstring, 2869, 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 (5397 bytes) */ +const char* const bytes = ": All dimensions preceding dimension %d must be indexed and not slicedBuffer view does not expose stridesCan only create a buffer that is contiguous in memory.Cannot assign to read-only memoryviewCannot create writable memory view from read-only memoryviewCannot index with type 'Cannot transpose memoryview with indirect dimensionsDimension %d is not directEmpty shape tuple for cython.arrayIndex out of bounds (axis %d)Indirect dimensions not supportedInvalid mode, expected 'c' or 'fortran', got Invalid shape in axis ')?add_note and at 0xcollections.abcdisableenablegc (got got differing extents in dimension isenableditemsize <= 0 for cython.arrayno default __reduce__ due to non-trivial __cinit__numpy._core.multiarray failed to importnumpy._core.umath failed to import object>self.beams is not None or self.docs is not None or self.golds is not None or self.moves is not None or self.states is not Noneself.name is not Nonespacy.errorsspacy.pipeline._parser_internals.numpyspacy.pipeline._parser_internals.thinc.extra.searchspacy/pipeline/_parser_internals/_beam_utils.pyxunable to allocate array data.unable to allocate shape and strides.ASCIIBeamBatchBeamBatch.__get__..genexprBeamBatch.__reduce_cython__BeamBatch.__setstate_cython__BeamBatch._set_costsBeamBatch.advanceBeamBatch.get_statesBeamBatch.get_unfinished_statesE079E080E081EllipsisErrorsMaxViolation__Pyx_PyDict_NextRefSequenceView.MemoryView_abcadvanceallocate_bufferappendas_contigasarrayasyncio.coroutinesavg_lossbbackpropsbasebeambeam_densitybeam_mapbeam_mapsbeamsbegin_updatebp_scorescc""_scoresclas__class____class_getitem__cline_in_tracebackclosecollect_statescountd_ld_lossd_scoresdensity__dict___dictdocdocsdonesdtypedtype_is_objecteg_idencodeenumerateerrorerrorsfflagsfollow_goldformatfortran__func__g_indicesgbeamgbeamsgenexprget_gradientget_statesget_unfinished_statesget_unique_states__getstate__goldgoldsgradshisthistorieshistsiid__import__index_is_coroutineis_doneis_finalisnanitemsitemsizejkeylosslosses__main__maxmeanmemviewmin_costmin_densitymodemodel__module__movesn_histname__name__ndim__new__nextnr_classnr_statenr_stepnr_stepsnumpyobjopsp_indicespackpbeampbeamspop__pyx_capi____pyx_checksum__pyx_result__pyx_state__pyx_type__pyx_unpickle_BeamBatch__pyx_unpickle_Enum__pyx_vtable____qualname____reduce____reduce_cython____reduce_ex__registerscoresseenselfsend_set_costs__set_name__setdefault__setstate____setstate_cython__shapesizespacy.pipeline._parser_internals._beam_utilsststartstatestate_or_beamstatesstates_d_scoresstclsstepstopstruct__test__thinc.extra.searchthrowunpackupdateupdate_beamuse_setstatevaluevaluesviolnviolnswidthxzeroszipint (void *, void *)\000int (void *, void *, __pyx_t_5spacy_8typedefs_class_t, void *)\000check_final_state\000transition_state\200\001\330\004\013\2101\330\004\r\210Q\330\004\020\220\001\330\004\020\220\001\330\004\017\210q\330\004\013\2106\220\021\340\004\007\200s\210!\2108\2203\220c\230\021\230!\330\010\016\210j\230\001\230\026\230u\240G\2501\250G\2603\260a\260y\300\007\300s\310!\3101\330\004\010\210\010\220\007\220w\230h\240i\250q\260\003\2601\260H\270H\300A\330\010\013\2104\210u\220A\330\014\020\220\005\220U\230!\2305\240\001\330\020\"\240'\250\021\250)\2605\270\003\2701\270D\300\001\330\020\023\2204\220u\230I\240Q\330\024\032\230%\230q\240\001\240\027\250\002\250%\250z\270\021\270!\330\024\027\220t\2303\230a\330\030\036\230j\250\001\250\026\250u\260G\2701\270D\300\001\330\024\030\230\001\230\027\240\003\2401\240A\330\024\035\230W\240A\240S\250\001\250\021\330\024\032\230'\240\021\240!\330\014\024\220G\2301\230A""\330\010\013\2104\210u\220A\330\014\020\220\005\220U\230!\2305\240\001\330\020\"\240'\250\021\250)\2605\270\003\2701\270D\300\001\330\020\023\2204\220u\230I\240Q\330\024\032\230%\230q\240\001\240\027\250\002\250%\250z\270\021\270!\330\024\027\220t\2303\230a\330\030!\240\027\250\001\250\024\250Q\250a\340\030!\240\027\250\001\250\023\250A\250Q\330\030 \240\001\240\027\250\003\2501\250A\330\030\036\230g\240Q\240a\330\004\020\220\005\220X\230Q\230k\250\026\250q\330\004\020\220\005\220X\230Q\230k\250\026\250q\330\004\013\2108\220;\230k\250\021\320\0048\270\001\340\010\034\230F\240&\250\001\250\021\330\010%\240Q\240f\250A\250S\260\001\330\010\017\210t\2201\330\010\014\210C\210x\220y\240\001\240\021\330\014\017\210t\2204\220q\330\020\033\2304\230|\2501\250F\260*\270A\330\020\027\220q\330\020\023\2204\220w\230g\240Q\330\024\030\230\013\2401\330\030\031\330\030\034\230A\230Q\330\030\034\230F\240!\2401\330\030$\240A\340\020\034\230I\240R\240q\330\020\024\220H\230A\320\035/\250v\260W\270D\300\006\300a\330\020\024\220K\230q\320 3\2601\220A\200A\360\010\000\t\022\220\021\330\010\014\210F\220'\230\023\230A\230V\2404\240q\330\014\020\220\005\220U\230!\2304\230q\330\020\030\230\t\240\024\240S\250\001\250\021\330\020\"\240'\250\021\250'\260\021\330\020\026\220g\230Q\230a\330\010\017\210q\200A\330\010\017\210q\220\003\2204\220v\230T\240\033\250C\250s\260$\260b\270\t\300\021\200\001\360\032\000\005\r\210A\330\004\017\210q\330\004\010\210\007\210y\230\t\240\021\240!\330\010\022\220!\330\010\014\210F\220(\230#\230Q\230f\240A\240X\250Q\330\014\023\2204\220u\230F\240!\2401\330\014\017\210u\220C\220q\330\020\035\230Q\230i\240s\250!\2501\330\010\020\220\007\220q\230\001\330\004\010\210\005\210U\220!\2203\220a\220q\330\010\r\210W\220A\220U\230&\240\002\240#\240Q\240i\250q\260\002\260'\270\023\270A\270S\300\001\330!'\240q\330\004\007\200s\210!\210;\220c\230\023\230A\230Q\330\010\016\210j\230\001\230\026\230u\240G\2501\250G\2603\260a\260|\3007\310#\310Q\310a\330\004\010\210\007\210y\230\t\240""\021\240!\330\010\014\210F\220(\230#\230Q\230f\240A\240X\250Q\330\014\023\2204\220u\230F\240!\2401\330\014\017\210u\220C\220q\330\020\021\330\014\022\220%\220q\230\001\230\021\360\n\000\r\030\220u\230B\230c\240\021\240!\330\014\024\220I\230S\240\010\250\001\250\027\260\002\260#\260Q\260a\330\014\020\220\006\220h\230i\240q\250\001\330\020\024\220I\230Q\230e\2401\240A\360\006\000\021\026\220Q\220e\2301\230C\230y\250\001\330\020\026\220d\230\"\230E\240\021\240!\2401\330\004\013\2101\320\000I\310\021\340\004\014\210I\220Q\220g\230X\240W\250F\260'\270\030\300\021\330\004\014\210I\220Q\220g\230X\240W\250F\260'\270\030\300\021\330\004\020\220\001\330\004\020\220\001\330\004\r\210Q\210l\230#\230T\240\025\240e\2501\250C\250q\260\001\330\004\014\210A\210V\2204\220u\230A\330\004\n\210$\210e\2209\230C\230t\2405\250\001\360\024\000\t\021\220\013\230;\240k\3201B\300!\3007\310!\330\010\021\220\027\230\001\230\021\330\010\013\2104\210q\330\014\r\340\010\020\220\014\230E\240\035\250a\250q\330\010\017\210v\220V\2303\230a\340\010\021\220\027\230\001\230\021\360\n\000\t\014\2104\210u\220A\330\014\021\220\030\230\021\230%\230t\240:\250Q\250f\260A\260Q\330\010\013\2104\210u\220A\330\014\021\220\030\230\021\230%\230t\240:\250Q\250f\260A\260]\300,\310a\340\010\014\210C\210y\230\t\240\021\240!\330\014\017\210t\2205\230\001\230\021\330\020\025\220Z\230q\240\005\240Q\240d\250%\250q\260\001\330\020\023\2205\230\001\230\022\2309\240D\250\005\250Q\250b\260\001\330\024\031\230\021\230%\230q\330\004\020\220\001\330\004\014\210A\330\004\010\210\t\220\021\330\010\013\2105\220\001\330\014\025\220W\230A\230U\240(\250\"\250E\260\021\330\014\025\220Q\220d\230\"\230E\240\026\240t\2507\260%\260y\300\002\300%\300q\330\014\021\220\027\230\001\230\021\340\014\025\220W\230A\230Q\330\014\021\220\027\230\001\230\021\330\004\013\2101\330\004\026\220l\240!\2405\250\n\260+\270[\310\001\330\004\010\210\004\210J\220n\240I\250Q\250c\260\021\3202C\3001\330\010\021\220\030\230\022\2302\230U\240!\330\010\021\220\021""\220!\330\004\013\2101\200\001\360\006\000\005\016\210Q\330\004\010\210\017\220w\230c\240\021\240'\250\021\330\010\013\210:\220Q\220o\240Q\330\014\022\220'\230\021\230!\340\014\023\2201\330\014\036\230g\240Q\240i\250t\2603\260a\260t\2701\330\014\022\220'\230\021\230!\330\004\013\2101\200\001\360\010\000\005\016\210T\220\030\230\024\230W\240D\250\010\260\004\260H\270D\300\001\330\004\014\210G\2201\220F\230,\240a\330\004\007\200v\210W\220E\230\024\230Q\330\010\022\220!\330\010\027\220q\340\010\030\230\001\330\004\007\200q\330\010\017\320\017*\250$\250a\250w\260k\300\027\310\001\340\010\017\320\017*\250$\250a\250w\260k\300\021\200\001\340\004\037\230q\320 0\260\013\270;\300k\320QR\330\004\023\2209\230H\240A\240Q\330\004\007\200|\2207\230!\330\010+\2501\250L\270\016\300a\330\004\013\2101\320\004?\270q\340\010\014\210E\220\025\220a\220t\2301\330\014\024\220O\2404\240s\250!\2501\330\014\017\210u\220I\230Q\330\020\024\220E\230\025\230a\230t\2401\330\024\030\230\t\240\021\240\"\240A\240U\250!\330\024\030\230\006\230a\230r\240\021\240%\240q\340\020\024\220F\230*\240A\240T\250\031\260!\2604\260t\2706\300\021\300!\330%,\250A\330\020\023\2201\330\024\037\230q\330\024\030\230\005\230U\240!\2404\240q\330\030\033\2304\230y\250\001\250\022\2501\250C\250t\2604\260v\270Q\270b\300\001\300\023\300B\300a\330\034'\240t\2506\260\021\260\"\260A\260Q\330\024\030\230\005\230U\240!\2404\240q\330\030\033\2304\230v\240Q\240b\250\001\250\023\250B\250a\330\034 \240\t\250\021\250\"\250A\250U\260!\200\001\330\004'\240q\250\006\250a__pyx_t_5spacy_8typedefs_attr_t\000struct __pyx_t_5spacy_7structs_LexemeC\000OOV_RANK\000EMPTY_LEXEMEstruct __pyx_t_5spacy_7structs_LexemeC\000EMPTY_LEXEMEuint64_t (void *, int, uint64_t)\000hash64O"; + 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 < 228; i++) { + Py_ssize_t bytes_length = index[i].length; + PyObject *string = PyUnicode_DecodeUTF8(bytes + pos, bytes_length, NULL); + if (likely(string) && i >= 53) 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 = 228; i < 245; 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 < 245; i++) { + if (unlikely(PyObject_Hash(stringtab[i]) == -1)) { + __PYX_ERR(0, 1, __pyx_L1_error) + } + } + #if CYTHON_IMMORTAL_CONSTANTS + { + PyObject **table = stringtab + 228; + for (Py_ssize_t i=0; i<17; ++i) { + #if CYTHON_COMPILING_IN_CPYTHON_FREETHREADING + Py_SET_REFCNT(table[i], _Py_IMMORTAL_REFCNT_LOCAL); + #else + Py_SET_REFCNT(table[i], _Py_IMMORTAL_INITIAL_REFCNT); + #endif + } + } + #endif + } + { + PyObject **numbertab = __pyx_mstate->__pyx_number_tab; + double const c_constants[] = {0.0}; + for (int i = 0; i < 1; i++) { + numbertab[i] = PyFloat_FromDouble(c_constants[i]); + if (unlikely(!numbertab[i])) __PYX_ERR(0, 1, __pyx_L1_error) + } + } + { + PyObject **numbertab = __pyx_mstate->__pyx_number_tab + 1; + int8_t const cint_constants_1[] = {0,-1,1,2}; + int32_t const cint_constants_4[] = {136983863L,170731940L}; + for (int i = 0; i < 6; i++) { + numbertab[i] = PyLong_FromLong((i < 4 ? cint_constants_1[i - 0] : cint_constants_4[i - 4])); + 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<7; ++i) { + #if CYTHON_COMPILING_IN_CPYTHON_FREETHREADING + Py_SET_REFCNT(table[i], _Py_IMMORTAL_REFCNT_LOCAL); + #else + 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 : 5; + 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 = {0, 0, 0, 1, (unsigned int)(CO_OPTIMIZED|CO_NEWLOCALS|CO_GENERATOR), 62}; + PyObject* const varnames[] = {__pyx_mstate->__pyx_n_u_b}; + __pyx_mstate_global->__pyx_codeobj_tab[0] = __Pyx_PyCode_New(descr, varnames, __pyx_mstate->__pyx_kp_u_spacy_pipeline__parser_internals_4, __pyx_mstate->__pyx_n_u_genexpr, __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, 7, (unsigned int)(CO_OPTIMIZED|CO_NEWLOCALS), 70}; + PyObject* const varnames[] = {__pyx_mstate->__pyx_n_u_self, __pyx_mstate->__pyx_n_u_beam, __pyx_mstate->__pyx_n_u_state, __pyx_mstate->__pyx_n_u_stcls, __pyx_mstate->__pyx_n_u_states, __pyx_mstate->__pyx_n_u_doc, __pyx_mstate->__pyx_n_u_i}; + __pyx_mstate_global->__pyx_codeobj_tab[1] = __Pyx_PyCode_New(descr, varnames, __pyx_mstate->__pyx_kp_u_spacy_pipeline__parser_internals_4, __pyx_mstate->__pyx_n_u_get_states, __pyx_mstate->__pyx_kp_b_iso88591_A_F_AV4q_U_4q_S_gQa_q, 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), 82}; + PyObject* const varnames[] = {__pyx_mstate->__pyx_n_u_self, __pyx_mstate->__pyx_n_u_st}; + __pyx_mstate_global->__pyx_codeobj_tab[2] = __Pyx_PyCode_New(descr, varnames, __pyx_mstate->__pyx_kp_u_spacy_pipeline__parser_internals_4, __pyx_mstate->__pyx_n_u_get_unfinished_states, __pyx_mstate->__pyx_kp_b_iso88591_A_q_4vT_Cs_b, tuple_dedup_map); if (unlikely(!__pyx_mstate_global->__pyx_codeobj_tab[2])) goto bad; + } + { + const __Pyx_PyCode_New_function_description descr = {3, 0, 0, 9, (unsigned int)(CO_OPTIMIZED|CO_NEWLOCALS), 85}; + PyObject* const varnames[] = {__pyx_mstate->__pyx_n_u_self, __pyx_mstate->__pyx_n_u_scores, __pyx_mstate->__pyx_n_u_follow_gold, __pyx_mstate->__pyx_n_u_beam, __pyx_mstate->__pyx_n_u_nr_class, __pyx_mstate->__pyx_n_u_c_scores, __pyx_mstate->__pyx_n_u_docs, __pyx_mstate->__pyx_n_u_i, __pyx_mstate->__pyx_n_u_nr_state}; + __pyx_mstate_global->__pyx_codeobj_tab[3] = __Pyx_PyCode_New(descr, varnames, __pyx_mstate->__pyx_kp_u_spacy_pipeline__parser_internals_4, __pyx_mstate->__pyx_n_u_advance, __pyx_mstate->__pyx_kp_b_iso88591_8_F_QfAS_t1_Cxy_t4q_4_1F_A_q_4w, tuple_dedup_map); if (unlikely(!__pyx_mstate_global->__pyx_codeobj_tab[3])) goto bad; + } + { + const __Pyx_PyCode_New_function_description descr = {5, 0, 0, 9, (unsigned int)(CO_OPTIMIZED|CO_NEWLOCALS), 120}; + PyObject* const varnames[] = {__pyx_mstate->__pyx_n_u_self, __pyx_mstate->__pyx_n_u_beam, __pyx_mstate->__pyx_n_u_doc, __pyx_mstate->__pyx_n_u_gold, __pyx_mstate->__pyx_n_u_follow_gold, __pyx_mstate->__pyx_n_u_state, __pyx_mstate->__pyx_n_u_i, __pyx_mstate->__pyx_n_u_j, __pyx_mstate->__pyx_n_u_min_cost}; + __pyx_mstate_global->__pyx_codeobj_tab[4] = __Pyx_PyCode_New(descr, varnames, __pyx_mstate->__pyx_kp_u_spacy_pipeline__parser_internals_4, __pyx_mstate->__pyx_n_u_set_costs, __pyx_mstate->__pyx_kp_b_iso88591_q_E_at1_O4s_1_uIQ_E_at1_AU_ar_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, 4, (unsigned int)(CO_OPTIMIZED|CO_NEWLOCALS), 1}; + PyObject* const varnames[] = {__pyx_mstate->__pyx_n_u_self, __pyx_mstate->__pyx_n_u_state, __pyx_mstate->__pyx_n_u_dict_2, __pyx_mstate->__pyx_n_u_use_setstate}; + __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_T_WD_HD_G1F_a_vWE_Q_q_q_awk_awk, 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), 16}; + 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_a, tuple_dedup_map); if (unlikely(!__pyx_mstate_global->__pyx_codeobj_tab[6])) goto bad; + } + { + const __Pyx_PyCode_New_function_description descr = {6, 0, 0, 27, (unsigned int)(CO_OPTIMIZED|CO_NEWLOCALS), 141}; + PyObject* const varnames[] = {__pyx_mstate->__pyx_n_u_moves, __pyx_mstate->__pyx_n_u_states, __pyx_mstate->__pyx_n_u_golds, __pyx_mstate->__pyx_n_u_model, __pyx_mstate->__pyx_n_u_width, __pyx_mstate->__pyx_n_u_beam_density, __pyx_mstate->__pyx_n_u_violn, __pyx_mstate->__pyx_n_u_pbeam, __pyx_mstate->__pyx_n_u_gbeam, __pyx_mstate->__pyx_n_u_beam_maps, __pyx_mstate->__pyx_n_u_backprops, __pyx_mstate->__pyx_n_u_violns, __pyx_mstate->__pyx_n_u_dones, __pyx_mstate->__pyx_n_u_p_indices, __pyx_mstate->__pyx_n_u_g_indices, __pyx_mstate->__pyx_n_u_beam_map, __pyx_mstate->__pyx_n_u_scores, __pyx_mstate->__pyx_n_u_bp_scores, __pyx_mstate->__pyx_n_u_i, __pyx_mstate->__pyx_n_u_histories, __pyx_mstate->__pyx_n_u_grads, __pyx_mstate->__pyx_n_u_d_loss, __pyx_mstate->__pyx_n_u_loss, __pyx_mstate->__pyx_n_u_states_d_scores, __pyx_mstate->__pyx_n_u_d_scores, __pyx_mstate->__pyx_n_u__7, __pyx_mstate->__pyx_n_u_d_l}; + __pyx_mstate_global->__pyx_codeobj_tab[7] = __Pyx_PyCode_New(descr, varnames, __pyx_mstate->__pyx_kp_u_spacy_pipeline__parser_internals_4, __pyx_mstate->__pyx_n_u_update_beam, __pyx_mstate->__pyx_kp_b_iso88591_I_IQgXWF_IQgXWF_Ql_T_e1Cq_AV4uA, tuple_dedup_map); if (unlikely(!__pyx_mstate_global->__pyx_codeobj_tab[7])) goto bad; + } + { + const __Pyx_PyCode_New_function_description descr = {2, 0, 0, 7, (unsigned int)(CO_OPTIMIZED|CO_NEWLOCALS), 200}; + PyObject* const varnames[] = {__pyx_mstate->__pyx_n_u_beams, __pyx_mstate->__pyx_n_u_docs, __pyx_mstate->__pyx_n_u_state, __pyx_mstate->__pyx_n_u_beam, __pyx_mstate->__pyx_n_u_states, __pyx_mstate->__pyx_n_u_state_or_beam, __pyx_mstate->__pyx_n_u_doc}; + __pyx_mstate_global->__pyx_codeobj_tab[8] = __Pyx_PyCode_New(descr, varnames, __pyx_mstate->__pyx_kp_u_spacy_pipeline__parser_internals_4, __pyx_mstate->__pyx_n_u_collect_states, __pyx_mstate->__pyx_kp_b_iso88591_Q_wc_QoQ_1_gQit3at1_1, tuple_dedup_map); if (unlikely(!__pyx_mstate_global->__pyx_codeobj_tab[8])) goto bad; + } + { + const __Pyx_PyCode_New_function_description descr = {2, 0, 0, 15, (unsigned int)(CO_OPTIMIZED|CO_NEWLOCALS), 214}; + PyObject* const varnames[] = {__pyx_mstate->__pyx_n_u_pbeams, __pyx_mstate->__pyx_n_u_gbeams, __pyx_mstate->__pyx_n_u_seen, __pyx_mstate->__pyx_n_u_states, __pyx_mstate->__pyx_n_u_p_indices, __pyx_mstate->__pyx_n_u_g_indices, __pyx_mstate->__pyx_n_u_beam_map, __pyx_mstate->__pyx_n_u_docs, __pyx_mstate->__pyx_n_u_pbeam, __pyx_mstate->__pyx_n_u_gbeam, __pyx_mstate->__pyx_n_u_eg_id, __pyx_mstate->__pyx_n_u_doc, __pyx_mstate->__pyx_n_u_i, __pyx_mstate->__pyx_n_u_state, __pyx_mstate->__pyx_n_u_key}; + __pyx_mstate_global->__pyx_codeobj_tab[9] = __Pyx_PyCode_New(descr, varnames, __pyx_mstate->__pyx_kp_u_spacy_pipeline__parser_internals_4, __pyx_mstate->__pyx_n_u_get_unique_states, __pyx_mstate->__pyx_kp_b_iso88591_1_Q_q_6_s_83c_j_uG1G3ay_s_1_whi, tuple_dedup_map); if (unlikely(!__pyx_mstate_global->__pyx_codeobj_tab[9])) goto bad; + } + { + const __Pyx_PyCode_New_function_description descr = {4, 0, 0, 16, (unsigned int)(CO_OPTIMIZED|CO_NEWLOCALS), 252}; + PyObject* const varnames[] = {__pyx_mstate->__pyx_n_u_nr_class, __pyx_mstate->__pyx_n_u_beam_maps, __pyx_mstate->__pyx_n_u_histories, __pyx_mstate->__pyx_n_u_losses, __pyx_mstate->__pyx_n_u_grads, __pyx_mstate->__pyx_n_u_nr_steps, __pyx_mstate->__pyx_n_u_eg_id, __pyx_mstate->__pyx_n_u_hists, __pyx_mstate->__pyx_n_u_nr_step, __pyx_mstate->__pyx_n_u_loss, __pyx_mstate->__pyx_n_u_hist, __pyx_mstate->__pyx_n_u_i, __pyx_mstate->__pyx_n_u_key, __pyx_mstate->__pyx_n_u_avg_loss, __pyx_mstate->__pyx_n_u_step, __pyx_mstate->__pyx_n_u_clas}; + __pyx_mstate_global->__pyx_codeobj_tab[10] = __Pyx_PyCode_New(descr, varnames, __pyx_mstate->__pyx_kp_u_spacy_pipeline__parser_internals_4, __pyx_mstate->__pyx_n_u_get_gradient, __pyx_mstate->__pyx_kp_b_iso88591_A_q_y_F_QfAXQ_4uF_1_uCq_Qis_1_q, tuple_dedup_map); if (unlikely(!__pyx_mstate_global->__pyx_codeobj_tab[10])) goto bad; + } + { + const __Pyx_PyCode_New_function_description descr = {3, 0, 0, 4, (unsigned int)(CO_OPTIMIZED|CO_NEWLOCALS), 4}; + PyObject* const varnames[] = {__pyx_mstate->__pyx_n_u_pyx_type, __pyx_mstate->__pyx_n_u_pyx_checksum, __pyx_mstate->__pyx_n_u_pyx_state, __pyx_mstate->__pyx_n_u_pyx_result}; + __pyx_mstate_global->__pyx_codeobj_tab[11] = __Pyx_PyCode_New(descr, varnames, __pyx_mstate->__pyx_kp_u_stringsource, __pyx_mstate->__pyx_n_u_pyx_unpickle_BeamBatch, __pyx_mstate->__pyx_kp_b_iso88591_q_0_kQR_9HAQ_7_1L_a_1, tuple_dedup_map); if (unlikely(!__pyx_mstate_global->__pyx_codeobj_tab[11])) 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) + + /* AssertionsEnabled.init */ + if (likely(__Pyx_init_assertions_enabled() == 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) + + /* Generator.init */ + if (likely(__pyx_Generator_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++) { + if (unlikely(__Pyx_PyTuple_SET_ITEM(res, i, src[i]) < (0))) { + Py_DECREF(res); + return NULL; + } + Py_INCREF(src[i]); + } + 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); +} + +/* 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; +} + +/* 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; +} + +/* 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 + +/* RaiseUnexpectedTypeError */ +static int +__Pyx_RaiseUnexpectedTypeError(const char *expected, PyObject *obj) +{ + __Pyx_TypeName obj_type_name = __Pyx_PyType_GetFullyQualifiedName(Py_TYPE(obj)); + PyErr_Format(PyExc_TypeError, "Expected %s, got " __Pyx_FMT_TYPENAME, + expected, obj_type_name); + __Pyx_DECREF_TypeName(obj_type_name); + return 0; +} + +/* 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); +} + +/* CIntToPyUnicode */ +static CYTHON_INLINE PyObject* __Pyx_uchar___Pyx_PyUnicode_From_Py_ssize_t(Py_ssize_t value, Py_ssize_t width, char padding_char) { +#ifdef __Pyx_HAS_GCC_DIAGNOSTIC +#pragma GCC diagnostic push +#pragma GCC diagnostic ignored "-Wconversion" +#endif + const Py_ssize_t neg_one = (Py_ssize_t) -1, const_zero = (Py_ssize_t) 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 & ~ (Py_ssize_t) 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_Py_ssize_t(Py_ssize_t value, Py_ssize_t width, char padding_char, char format_char) { + char digits[sizeof(Py_ssize_t)*3+2]; + char *dpos, *end = digits + sizeof(Py_ssize_t)*3+2; + const char *hex_digits = DIGITS_HEX; + Py_ssize_t length, ulength; + int prepend_sign, last_one_off; + Py_ssize_t remaining; +#ifdef __Pyx_HAS_GCC_DIAGNOSTIC +#pragma GCC diagnostic push +#pragma GCC diagnostic ignored "-Wconversion" +#endif + const Py_ssize_t neg_one = (Py_ssize_t) -1, const_zero = (Py_ssize_t) 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 = (Py_ssize_t) (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 = (Py_ssize_t) (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 = (Py_ssize_t) (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 +} + +/* GetAttr */ +static CYTHON_INLINE PyObject *__Pyx_GetAttr(PyObject *o, PyObject *n) { +#if CYTHON_USE_TYPE_SLOTS + if (likely(PyUnicode_Check(n))) + return __Pyx_PyObject_GetAttrStr(o, n); +#endif + return PyObject_GetAttr(o, n); +} + +/* GetItemInt */ +static PyObject *__Pyx_GetItemInt_Generic(PyObject *o, PyObject* j) { + PyObject *r; + if (unlikely(!j)) return NULL; + r = PyObject_GetItem(o, j); + Py_DECREF(j); + return r; +} +static CYTHON_INLINE PyObject *__Pyx_GetItemInt_List_Fast(PyObject *o, Py_ssize_t i, + int wraparound, int boundscheck, int unsafe_shared) { + CYTHON_MAYBE_UNUSED_VAR(unsafe_shared); +#if CYTHON_ASSUME_SAFE_SIZE + Py_ssize_t wrapped_i = i; + if (wraparound & unlikely(i < 0)) { + wrapped_i += PyList_GET_SIZE(o); + } + if ((CYTHON_AVOID_BORROWED_REFS || CYTHON_AVOID_THREAD_UNSAFE_BORROWED_REFS || !CYTHON_ASSUME_SAFE_MACROS)) { + return __Pyx_PyList_GetItemRefFast(o, wrapped_i, unsafe_shared); + } else + if ((!boundscheck) || likely(__Pyx_is_valid_index(wrapped_i, PyList_GET_SIZE(o)))) { + return __Pyx_NewRef(PyList_GET_ITEM(o, wrapped_i)); + } + return __Pyx_GetItemInt_Generic(o, PyLong_FromSsize_t(i)); +#else + (void)wraparound; + (void)boundscheck; + return PySequence_GetItem(o, i); +#endif +} +static CYTHON_INLINE PyObject *__Pyx_GetItemInt_Tuple_Fast(PyObject *o, Py_ssize_t i, + int wraparound, int boundscheck, int unsafe_shared) { + CYTHON_MAYBE_UNUSED_VAR(unsafe_shared); +#if CYTHON_ASSUME_SAFE_SIZE && CYTHON_ASSUME_SAFE_MACROS && !CYTHON_AVOID_BORROWED_REFS + Py_ssize_t wrapped_i = i; + if (wraparound & unlikely(i < 0)) { + wrapped_i += PyTuple_GET_SIZE(o); + } + if ((!boundscheck) || likely(__Pyx_is_valid_index(wrapped_i, PyTuple_GET_SIZE(o)))) { + return __Pyx_NewRef(PyTuple_GET_ITEM(o, wrapped_i)); + } + return __Pyx_GetItemInt_Generic(o, PyLong_FromSsize_t(i)); +#else + (void)wraparound; + (void)boundscheck; + return PySequence_GetItem(o, i); +#endif +} +static CYTHON_INLINE PyObject *__Pyx_GetItemInt_Fast(PyObject *o, Py_ssize_t i, int is_list, + int wraparound, int boundscheck, int unsafe_shared) { + CYTHON_MAYBE_UNUSED_VAR(unsafe_shared); +#if CYTHON_ASSUME_SAFE_MACROS && CYTHON_ASSUME_SAFE_SIZE + if (is_list || PyList_CheckExact(o)) { + Py_ssize_t n = ((!wraparound) | likely(i >= 0)) ? i : i + PyList_GET_SIZE(o); + if ((CYTHON_AVOID_BORROWED_REFS || CYTHON_AVOID_THREAD_UNSAFE_BORROWED_REFS)) { + return __Pyx_PyList_GetItemRefFast(o, n, unsafe_shared); + } else if ((!boundscheck) || (likely(__Pyx_is_valid_index(n, PyList_GET_SIZE(o))))) { + return __Pyx_NewRef(PyList_GET_ITEM(o, n)); + } + } else + #if !CYTHON_AVOID_BORROWED_REFS + if (PyTuple_CheckExact(o)) { + Py_ssize_t n = ((!wraparound) | likely(i >= 0)) ? i : i + PyTuple_GET_SIZE(o); + if ((!boundscheck) || likely(__Pyx_is_valid_index(n, PyTuple_GET_SIZE(o)))) { + return __Pyx_NewRef(PyTuple_GET_ITEM(o, n)); + } + } else + #endif +#endif +#if CYTHON_USE_TYPE_SLOTS && !CYTHON_COMPILING_IN_PYPY + { + PyMappingMethods *mm = Py_TYPE(o)->tp_as_mapping; + PySequenceMethods *sm = Py_TYPE(o)->tp_as_sequence; + if (!is_list && mm && mm->mp_subscript) { + PyObject *r, *key = PyLong_FromSsize_t(i); + if (unlikely(!key)) return NULL; + r = mm->mp_subscript(o, key); + Py_DECREF(key); + return r; + } + if (is_list || likely(sm && sm->sq_item)) { + if (wraparound && unlikely(i < 0) && likely(sm->sq_length)) { + Py_ssize_t l = sm->sq_length(o); + if (likely(l >= 0)) { + i += l; + } else { + if (!PyErr_ExceptionMatches(PyExc_OverflowError)) + return NULL; + PyErr_Clear(); + } + } + return sm->sq_item(o, i); + } + } +#else + if (is_list || !PyMapping_Check(o)) { + return PySequence_GetItem(o, i); + } +#endif + (void)wraparound; + (void)boundscheck; + return __Pyx_GetItemInt_Generic(o, PyLong_FromSsize_t(i)); +} + +/* ObjectGetItem */ +#if CYTHON_USE_TYPE_SLOTS +static PyObject *__Pyx_PyObject_GetIndex(PyObject *obj, PyObject *index) { + PyObject *runerr = NULL; + Py_ssize_t key_value; + key_value = __Pyx_PyIndex_AsSsize_t(index); + if (likely(key_value != -1 || !(runerr = PyErr_Occurred()))) { + return __Pyx_GetItemInt_Fast(obj, key_value, 0, 1, 1, 1); + } + if (PyErr_GivenExceptionMatches(runerr, PyExc_OverflowError)) { + __Pyx_TypeName index_type_name = __Pyx_PyType_GetFullyQualifiedName(Py_TYPE(index)); + PyErr_Clear(); + PyErr_Format(PyExc_IndexError, + "cannot fit '" __Pyx_FMT_TYPENAME "' into an index-sized integer", index_type_name); + __Pyx_DECREF_TypeName(index_type_name); + } + return NULL; +} +static PyObject *__Pyx_PyObject_GetItem_Slow(PyObject *obj, PyObject *key) { + __Pyx_TypeName obj_type_name; + if (likely(PyType_Check(obj))) { + PyObject *meth = __Pyx_PyObject_GetAttrStrNoError(obj, __pyx_mstate_global->__pyx_n_u_class_getitem); + if (!meth) { + PyErr_Clear(); + } else { + PyObject *result = __Pyx_PyObject_CallOneArg(meth, key); + Py_DECREF(meth); + return result; + } + } + obj_type_name = __Pyx_PyType_GetFullyQualifiedName(Py_TYPE(obj)); + PyErr_Format(PyExc_TypeError, + "'" __Pyx_FMT_TYPENAME "' object is not subscriptable", obj_type_name); + __Pyx_DECREF_TypeName(obj_type_name); + return NULL; +} +static PyObject *__Pyx_PyObject_GetItem(PyObject *obj, PyObject *key) { + PyTypeObject *tp = Py_TYPE(obj); + PyMappingMethods *mm = tp->tp_as_mapping; + PySequenceMethods *sm = tp->tp_as_sequence; + if (likely(mm && mm->mp_subscript)) { + return mm->mp_subscript(obj, key); + } + if (likely(sm && sm->sq_item)) { + return __Pyx_PyObject_GetIndex(obj, key); + } + return __Pyx_PyObject_GetItem_Slow(obj, key); +} +#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); + } +} + +/* DivInt[Py_ssize_t] */ +static CYTHON_INLINE Py_ssize_t __Pyx_div_Py_ssize_t(Py_ssize_t a, Py_ssize_t b, int b_is_constant) { + Py_ssize_t q = a / b; + Py_ssize_t r = a - q*b; + Py_ssize_t adapt_python = (b_is_constant ? + ((r != 0) & ((r < 0) ^ (b < 0))) : + ((r != 0) & ((r ^ b) < 0)) + ); + return q - adapt_python; +} + +/* GetAttr3 */ +#if __PYX_LIMITED_VERSION_HEX < 0x030d0000 +static PyObject *__Pyx_GetAttr3Default(PyObject *d) { + __Pyx_PyThreadState_declare + __Pyx_PyThreadState_assign + if (unlikely(!__Pyx_PyErr_ExceptionMatches(PyExc_AttributeError))) + return NULL; + __Pyx_PyErr_Clear(); + Py_INCREF(d); + return d; +} +#endif +static CYTHON_INLINE PyObject *__Pyx_GetAttr3(PyObject *o, PyObject *n, PyObject *d) { + PyObject *r; +#if __PYX_LIMITED_VERSION_HEX >= 0x030d0000 + int res = PyObject_GetOptionalAttr(o, n, &r); + return (res != 0) ? r : __Pyx_NewRef(d); +#else + #if CYTHON_USE_TYPE_SLOTS + if (likely(PyUnicode_Check(n))) { + r = __Pyx_PyObject_GetAttrStrNoError(o, n); + if (unlikely(!r) && likely(!PyErr_Occurred())) { + r = __Pyx_NewRef(d); + } + return r; + } + #endif + r = PyObject_GetAttr(o, n); + return (likely(r)) ? r : __Pyx_GetAttr3Default(d); +#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); +} + +/* RaiseTooManyValuesToUnpack */ +static CYTHON_INLINE void __Pyx_RaiseTooManyValuesError(Py_ssize_t expected) { + PyErr_Format(PyExc_ValueError, + "too many values to unpack (expected %" CYTHON_FORMAT_SSIZE_T "d)", expected); +} + +/* RaiseNeedMoreValuesToUnpack */ +static CYTHON_INLINE void __Pyx_RaiseNeedMoreValuesError(Py_ssize_t index) { + PyErr_Format(PyExc_ValueError, + "need more than %" CYTHON_FORMAT_SSIZE_T "d value%.1s to unpack", + index, (index == 1) ? "" : "s"); +} + +/* RaiseNoneIterError */ +static CYTHON_INLINE void __Pyx_RaiseNoneNotIterableError(void) { + PyErr_SetString(PyExc_TypeError, "'NoneType' object is not iterable"); +} + +/* ExtTypeTest */ +static CYTHON_INLINE int __Pyx_TypeTest(PyObject *obj, PyTypeObject *type) { + __Pyx_TypeName obj_type_name; + __Pyx_TypeName type_name; + if (unlikely(!type)) { + PyErr_SetString(PyExc_SystemError, "Missing type object"); + return 0; + } + if (likely(__Pyx_TypeCheck(obj, type))) + return 1; + obj_type_name = __Pyx_PyType_GetFullyQualifiedName(Py_TYPE(obj)); + type_name = __Pyx_PyType_GetFullyQualifiedName(type); + PyErr_Format(PyExc_TypeError, + "Cannot convert " __Pyx_FMT_TYPENAME " to " __Pyx_FMT_TYPENAME, + obj_type_name, type_name); + __Pyx_DECREF_TypeName(obj_type_name); + __Pyx_DECREF_TypeName(type_name); + return 0; +} + +/* 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 + +/* 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); +} + +/* 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; itp_as_sequence && type->tp_as_sequence->sq_repeat)) { + return type->tp_as_sequence->sq_repeat(seq, mul); + } else +#endif + { + return __Pyx_PySequence_Multiply_Generic(seq, mul); + } +} + +/* PyObjectFormatAndDecref */ +static CYTHON_INLINE PyObject* __Pyx_PyObject_FormatSimpleAndDecref(PyObject* s, PyObject* f) { + if (unlikely(!s)) return NULL; + if (likely(PyUnicode_CheckExact(s))) return s; + return __Pyx_PyObject_FormatAndDecref(s, f); +} +static CYTHON_INLINE PyObject* __Pyx_PyObject_FormatAndDecref(PyObject* s, PyObject* f) { + PyObject *result; + if (unlikely(!s)) return NULL; + result = PyObject_Format(s, f); + Py_DECREF(s); + return result; +} + +/* PyObjectFormat */ +#if CYTHON_USE_UNICODE_WRITER +static PyObject* __Pyx_PyObject_Format(PyObject* obj, PyObject* format_spec) { + int ret; + _PyUnicodeWriter writer; + if (likely(PyFloat_CheckExact(obj))) { + _PyUnicodeWriter_Init(&writer); + ret = _PyFloat_FormatAdvancedWriter( + &writer, + obj, + format_spec, 0, PyUnicode_GET_LENGTH(format_spec)); + } else if (likely(PyLong_CheckExact(obj))) { + _PyUnicodeWriter_Init(&writer); + ret = _PyLong_FormatAdvancedWriter( + &writer, + obj, + format_spec, 0, PyUnicode_GET_LENGTH(format_spec)); + } else { + return PyObject_Format(obj, format_spec); + } + if (unlikely(ret == -1)) { + _PyUnicodeWriter_Dealloc(&writer); + return NULL; + } + return _PyUnicodeWriter_Finish(&writer); +} +#endif + +/* SetItemInt */ +static int __Pyx_SetItemInt_Generic(PyObject *o, PyObject *j, PyObject *v) { + int r; + if (unlikely(!j)) return -1; + r = PyObject_SetItem(o, j, v); + Py_DECREF(j); + return r; +} +static CYTHON_INLINE int __Pyx_SetItemInt_Fast(PyObject *o, Py_ssize_t i, PyObject *v, int is_list, + int wraparound, int boundscheck, int unsafe_shared) { + CYTHON_MAYBE_UNUSED_VAR(unsafe_shared); +#if CYTHON_ASSUME_SAFE_MACROS && CYTHON_ASSUME_SAFE_SIZE && !CYTHON_AVOID_BORROWED_REFS + if (is_list || PyList_CheckExact(o)) { + Py_ssize_t n = (!wraparound) ? i : ((likely(i >= 0)) ? i : i + PyList_GET_SIZE(o)); + if ((CYTHON_AVOID_THREAD_UNSAFE_BORROWED_REFS && !__Pyx_IS_UNIQUELY_REFERENCED(o, unsafe_shared))) { + Py_INCREF(v); + return PyList_SetItem(o, n, v); + } else if ((!boundscheck) || likely(__Pyx_is_valid_index(n, PyList_GET_SIZE(o)))) { + PyObject* old; + Py_INCREF(v); + old = PyList_GET_ITEM(o, n); + PyList_SET_ITEM(o, n, v); + Py_DECREF(old); + return 0; + } + } else +#endif +#if CYTHON_USE_TYPE_SLOTS && !CYTHON_COMPILING_IN_PYPY + { + PyMappingMethods *mm = Py_TYPE(o)->tp_as_mapping; + PySequenceMethods *sm = Py_TYPE(o)->tp_as_sequence; + if (!is_list && mm && mm->mp_ass_subscript) { + int r; + PyObject *key = PyLong_FromSsize_t(i); + if (unlikely(!key)) return -1; + r = mm->mp_ass_subscript(o, key, v); + Py_DECREF(key); + return r; + } + if (is_list || likely(sm && sm->sq_ass_item)) { + if (wraparound && unlikely(i < 0) && likely(sm->sq_length)) { + Py_ssize_t l = sm->sq_length(o); + if (likely(l >= 0)) { + i += l; + } else { + if (!PyErr_ExceptionMatches(PyExc_OverflowError)) + return -1; + PyErr_Clear(); + } + } + return sm->sq_ass_item(o, i, v); + } + } +#else + if (is_list || !PyMapping_Check(o)) { + return PySequence_SetItem(o, i, v); + } +#endif + (void)wraparound; + (void)boundscheck; + return __Pyx_SetItemInt_Generic(o, PyLong_FromSsize_t(i), v); +} + +/* RaiseUnboundLocalError */ +static void __Pyx_RaiseUnboundLocalError(const char *varname) { + PyErr_Format(PyExc_UnboundLocalError, "local variable '%s' referenced before assignment", varname); +} + +/* DivInt[long] */ +static CYTHON_INLINE long __Pyx_div_long(long a, long b, int b_is_constant) { + long q = a / b; + long r = a - q*b; + long adapt_python = (b_is_constant ? + ((r != 0) & ((r < 0) ^ (b < 0))) : + ((r != 0) & ((r ^ b) < 0)) + ); + return q - adapt_python; +} + +/* tp_new */ +#if CYTHON_COMPILING_IN_LIMITED_API && __PYX_LIMITED_VERSION_HEX < 0x030A0000 +static PyObject* __Pyx_tp_new_fallback(PyObject* type_obj, PyObject* args, PyObject* kwargs) { + PyObject *new_func = NULL, *new_args = NULL, *obj; + Py_ssize_t i, nargs = PyTuple_Size(args); + if (unlikely(nargs < 0)) goto bad; + new_args = PyTuple_New(nargs + 1); + if (unlikely(!new_args)) goto bad; + for (i = 0; i < nargs + 1; i++) { + PyObject *item = (i == 0) ? type_obj : PyTuple_GetItem(args, i - 1); + if (unlikely(!item)) goto bad; + Py_INCREF(item); + if (unlikely(PyTuple_SetItem(new_args, i, item)) < 0) goto bad; + } + new_func = PyObject_GetAttrString(type_obj, "__new__"); + if (unlikely(!new_func)) goto bad; + obj = PyObject_Call(new_func, new_args, kwargs); + Py_DECREF(new_func); + Py_DECREF(new_args); + return obj; + bad: + Py_XDECREF(new_func); + Py_XDECREF(new_args); + return NULL; +} +#endif +static PyObject* __Pyx_tp_new_kwargs(PyObject* type_obj, PyObject* args, PyObject* kwargs) { + newfunc tp_new = __Pyx_PyType_TryGetSlot((PyTypeObject*)type_obj, tp_new, newfunc); +#if CYTHON_COMPILING_IN_LIMITED_API && __PYX_LIMITED_VERSION_HEX < 0x030A0000 + if (!tp_new) return __Pyx_tp_new_fallback(type_obj, args, kwargs); +#else + assert(tp_new != NULL); +#endif + return tp_new((PyTypeObject*)type_obj, args, kwargs); +} + +/* 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); +} + +/* PyObjectVectorCallKwBuilder */ +#if CYTHON_VECTORCALL +static int __Pyx_VectorcallBuilder_AddArg(PyObject *key, PyObject *value, PyObject *builder, PyObject **args, int n) { + (void)__Pyx_PyObject_FastCallDict; + if (__Pyx_PyTuple_SET_ITEM(builder, n, key) != (0)) return -1; + Py_INCREF(key); + 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 + +/* PyObjectCall2Args (used by PyObjectCallMethod1) */ +static CYTHON_INLINE PyObject* __Pyx_PyObject_Call2Args(PyObject* function, PyObject* arg1, PyObject* arg2) { + PyObject *args[3] = {NULL, arg1, arg2}; + return __Pyx_PyObject_FastCall(function, args+1, 2 | __Pyx_PY_VECTORCALL_ARGUMENTS_OFFSET); +} + +/* PyObjectGetMethod (used by PyObjectCallMethod1) */ +#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 + +/* PyObjectCallMethod1 (used by append) */ +#if !(CYTHON_VECTORCALL && (__PYX_LIMITED_VERSION_HEX >= 0x030C0000 || (!CYTHON_COMPILING_IN_LIMITED_API && PY_VERSION_HEX >= 0x03090000))) +static PyObject* __Pyx__PyObject_CallMethod1(PyObject* method, PyObject* arg) { + PyObject *result = __Pyx_PyObject_CallOneArg(method, arg); + Py_DECREF(method); + return result; +} +#endif +static PyObject* __Pyx_PyObject_CallMethod1(PyObject* obj, PyObject* method_name, PyObject* arg) { +#if CYTHON_VECTORCALL && (__PYX_LIMITED_VERSION_HEX >= 0x030C0000 || (!CYTHON_COMPILING_IN_LIMITED_API && PY_VERSION_HEX >= 0x03090000)) + PyObject *args[2] = {obj, arg}; + (void) __Pyx_PyObject_CallOneArg; + (void) __Pyx_PyObject_Call2Args; + return PyObject_VectorcallMethod(method_name, args, 2 | PY_VECTORCALL_ARGUMENTS_OFFSET, NULL); +#else + PyObject *method = NULL, *result; + int is_method = __Pyx_PyObject_GetMethod(obj, method_name, &method); + if (likely(is_method)) { + result = __Pyx_PyObject_Call2Args(method, obj, arg); + Py_DECREF(method); + return result; + } + if (unlikely(!method)) return NULL; + return __Pyx__PyObject_CallMethod1(method, arg); +#endif +} + +/* append */ +static CYTHON_INLINE int __Pyx_PyObject_Append(PyObject* L, PyObject* x) { + if (likely(PyList_CheckExact(L))) { + if (unlikely(__Pyx_PyList_Append(L, x) < 0)) return -1; + } else { + PyObject* retval = __Pyx_PyObject_CallMethod1(L, __pyx_mstate_global->__pyx_n_u_append, x); + if (unlikely(!retval)) + return -1; + Py_DECREF(retval); + } + return 0; +} + +/* IterFinish */ +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; +} + +/* UnpackItemEndCheck */ +static int __Pyx_IternextUnpackEndCheck(PyObject *retval, Py_ssize_t expected) { + if (unlikely(retval)) { + Py_DECREF(retval); + __Pyx_RaiseTooManyValuesError(expected); + return -1; + } + return __Pyx_IterFinish(); +} + +/* BufferIndexError */ +static void __Pyx_RaiseBufferIndexError(int axis) { + PyErr_Format(PyExc_IndexError, + "Out of bounds on buffer access (axis %d)", axis); +} + +/* 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 + +/* 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 + +/* PyLongCompare */ +static CYTHON_INLINE int __Pyx_PyLong_BoolNeObjC(PyObject *op1, PyObject *op2, long intval, long inplace) { + CYTHON_MAYBE_UNUSED_VAR(intval); + CYTHON_UNUSED_VAR(inplace); + if (op1 == op2) { + return 0; + } + #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 1; + intval = -intval; + } else { + if (__Pyx_PyLong_IsNeg(op1)) + return 1; + } + 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_NE)); +} + +/* CallUnboundCMethod1 */ +#if CYTHON_COMPILING_IN_CPYTHON +static CYTHON_INLINE PyObject* __Pyx_CallUnboundCMethod1(__Pyx_CachedCFunction* cfunc, PyObject* self, PyObject* arg) { + int was_initialized = __Pyx_CachedCFunction_GetAndSetInitializing(cfunc); + if (likely(was_initialized == 2 && cfunc->func)) { + int flag = cfunc->flag; + if (flag == METH_O) { + return __Pyx_CallCFunction(cfunc, self, arg); + } else if (flag == METH_FASTCALL) { + return __Pyx_CallCFunctionFast(cfunc, self, &arg, 1); + } else if (flag == (METH_FASTCALL | METH_KEYWORDS)) { + return __Pyx_CallCFunctionFastWithKeywords(cfunc, self, &arg, 1, 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__CallUnboundCMethod1(&tmp_cfunc, self, arg); + } +#endif + PyObject* result = __Pyx__CallUnboundCMethod1(cfunc, self, arg); + __Pyx_CachedCFunction_SetFinishedInitializing(cfunc); + return result; +} +#endif +static PyObject* __Pyx__CallUnboundCMethod1(__Pyx_CachedCFunction* cfunc, PyObject* self, PyObject* arg){ + PyObject *result = NULL; + if (unlikely(!cfunc->func && !cfunc->method) && unlikely(__Pyx_TryUnpackUnboundCMethod(cfunc) < 0)) return NULL; +#if CYTHON_COMPILING_IN_CPYTHON + if (cfunc->func && (cfunc->flag & METH_VARARGS)) { + PyObject *args = PyTuple_New(1); + if (unlikely(!args)) return NULL; + Py_INCREF(arg); + PyTuple_SET_ITEM(args, 0, arg); + if (cfunc->flag & METH_KEYWORDS) + result = __Pyx_CallCFunctionWithKeywords(cfunc, self, args, NULL); + else + result = __Pyx_CallCFunction(cfunc, self, args); + Py_DECREF(args); + } else +#endif + { + result = __Pyx_PyObject_Call2Args(cfunc->method, self, arg); + } + return result; +} + +/* 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 + +/* PyFloatBinop */ +#if !CYTHON_COMPILING_IN_PYPY +static int __Pyx_PyFloat_BoolNeObjC(PyObject *op1, PyObject *op2, double floatval, int inplace, int zerodivision_check) { + const double b = floatval; + double a; + CYTHON_UNUSED_VAR(inplace); + CYTHON_UNUSED_VAR(zerodivision_check); + if (op1 == op2) { + return 0; + } + if (likely(PyFloat_CheckExact(op1))) { + a = __Pyx_PyFloat_AS_DOUBLE(op1); + + } else + if (likely(PyLong_CheckExact(op1))) { + #if CYTHON_USE_PYLONG_INTERNALS + if (__Pyx_PyLong_IsZero(op1)) { + a = 0.0; + + } else if (__Pyx_PyLong_IsCompact(op1)) { + a = (double) __Pyx_PyLong_CompactValue(op1); + } else { + const digit* digits = __Pyx_PyLong_Digits(op1); + const Py_ssize_t size = __Pyx_PyLong_SignedDigitCount(op1); + switch (size) { + case -2: + case 2: + if (8 * sizeof(unsigned long) > 2 * PyLong_SHIFT && ((8 * sizeof(unsigned long) < 53) || (1 * PyLong_SHIFT < 53))) { + a = (double) (((((unsigned long)digits[1]) << PyLong_SHIFT) | (unsigned long)digits[0])); + if ((8 * sizeof(unsigned long) < 53) || (2 * PyLong_SHIFT < 53) || (a < (double) ((PY_LONG_LONG)1 << 53))) { + if (size == -2) + a = -a; + break; + } + } + CYTHON_FALLTHROUGH; + case -3: + case 3: + if (8 * sizeof(unsigned long) > 3 * PyLong_SHIFT && ((8 * sizeof(unsigned long) < 53) || (2 * PyLong_SHIFT < 53))) { + a = (double) (((((((unsigned long)digits[2]) << PyLong_SHIFT) | (unsigned long)digits[1]) << PyLong_SHIFT) | (unsigned long)digits[0])); + if ((8 * sizeof(unsigned long) < 53) || (3 * PyLong_SHIFT < 53) || (a < (double) ((PY_LONG_LONG)1 << 53))) { + if (size == -3) + a = -a; + break; + } + } + CYTHON_FALLTHROUGH; + case -4: + case 4: + if (8 * sizeof(unsigned long) > 4 * PyLong_SHIFT && ((8 * sizeof(unsigned long) < 53) || (3 * PyLong_SHIFT < 53))) { + a = (double) (((((((((unsigned long)digits[3]) << PyLong_SHIFT) | (unsigned long)digits[2]) << PyLong_SHIFT) | (unsigned long)digits[1]) << PyLong_SHIFT) | (unsigned long)digits[0])); + if ((8 * sizeof(unsigned long) < 53) || (4 * PyLong_SHIFT < 53) || (a < (double) ((PY_LONG_LONG)1 << 53))) { + if (size == -4) + a = -a; + break; + } + } + CYTHON_FALLTHROUGH; + default: + #endif + { + PyObject *res = + #if CYTHON_USE_TYPE_SLOTS || __PYX_LIMITED_VERSION_HEX >= 0x030A0000 + __Pyx_PyType_GetSlot((&PyFloat_Type), tp_richcompare, richcmpfunc) + #else + PyObject_RichCompare + #endif + (op2, op1, + Py_NE); + return __Pyx_PyObject_IsTrueAndDecref( + res); + } + #if CYTHON_USE_PYLONG_INTERNALS + } + } + #endif + } else { + return __Pyx_PyObject_IsTrueAndDecref( + PyObject_RichCompare(op1, op2, Py_NE)); + } + if (a != b) { + return 1; + } else { + return 0; + } +} +#endif + +/* PyFloatBinop */ +#if !CYTHON_COMPILING_IN_PYPY +static int __Pyx_PyFloat_BoolEqObjC(PyObject *op1, PyObject *op2, double floatval, int inplace, int zerodivision_check) { + const double b = floatval; + double a; + CYTHON_UNUSED_VAR(inplace); + CYTHON_UNUSED_VAR(zerodivision_check); + if (op1 == op2) { + return 1; + } + if (likely(PyFloat_CheckExact(op1))) { + a = __Pyx_PyFloat_AS_DOUBLE(op1); + + } else + if (likely(PyLong_CheckExact(op1))) { + #if CYTHON_USE_PYLONG_INTERNALS + if (__Pyx_PyLong_IsZero(op1)) { + a = 0.0; + + } else if (__Pyx_PyLong_IsCompact(op1)) { + a = (double) __Pyx_PyLong_CompactValue(op1); + } else { + const digit* digits = __Pyx_PyLong_Digits(op1); + const Py_ssize_t size = __Pyx_PyLong_SignedDigitCount(op1); + switch (size) { + case -2: + case 2: + if (8 * sizeof(unsigned long) > 2 * PyLong_SHIFT && ((8 * sizeof(unsigned long) < 53) || (1 * PyLong_SHIFT < 53))) { + a = (double) (((((unsigned long)digits[1]) << PyLong_SHIFT) | (unsigned long)digits[0])); + if ((8 * sizeof(unsigned long) < 53) || (2 * PyLong_SHIFT < 53) || (a < (double) ((PY_LONG_LONG)1 << 53))) { + if (size == -2) + a = -a; + break; + } + } + CYTHON_FALLTHROUGH; + case -3: + case 3: + if (8 * sizeof(unsigned long) > 3 * PyLong_SHIFT && ((8 * sizeof(unsigned long) < 53) || (2 * PyLong_SHIFT < 53))) { + a = (double) (((((((unsigned long)digits[2]) << PyLong_SHIFT) | (unsigned long)digits[1]) << PyLong_SHIFT) | (unsigned long)digits[0])); + if ((8 * sizeof(unsigned long) < 53) || (3 * PyLong_SHIFT < 53) || (a < (double) ((PY_LONG_LONG)1 << 53))) { + if (size == -3) + a = -a; + break; + } + } + CYTHON_FALLTHROUGH; + case -4: + case 4: + if (8 * sizeof(unsigned long) > 4 * PyLong_SHIFT && ((8 * sizeof(unsigned long) < 53) || (3 * PyLong_SHIFT < 53))) { + a = (double) (((((((((unsigned long)digits[3]) << PyLong_SHIFT) | (unsigned long)digits[2]) << PyLong_SHIFT) | (unsigned long)digits[1]) << PyLong_SHIFT) | (unsigned long)digits[0])); + if ((8 * sizeof(unsigned long) < 53) || (4 * PyLong_SHIFT < 53) || (a < (double) ((PY_LONG_LONG)1 << 53))) { + if (size == -4) + a = -a; + break; + } + } + CYTHON_FALLTHROUGH; + default: + #endif + { + PyObject *res = + #if CYTHON_USE_TYPE_SLOTS || __PYX_LIMITED_VERSION_HEX >= 0x030A0000 + __Pyx_PyType_GetSlot((&PyFloat_Type), tp_richcompare, richcmpfunc) + #else + PyObject_RichCompare + #endif + (op2, op1, + Py_EQ); + return __Pyx_PyObject_IsTrueAndDecref( + res); + } + #if CYTHON_USE_PYLONG_INTERNALS + } + } + #endif + } else { + return __Pyx_PyObject_IsTrueAndDecref( + PyObject_RichCompare(op1, op2, Py_EQ)); + } + if (a == b) { + return 1; + } else { + return 0; + } +} +#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); + } +} + +/* 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 + +/* 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; +} + +/* 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); +} + +/* 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 +} + +/* SetVTable */ +static int __Pyx_SetVtable(PyTypeObject *type, void *vtable) { + PyObject *ob = PyCapsule_New(vtable, 0, 0); + if (unlikely(!ob)) + goto bad; +#if CYTHON_COMPILING_IN_LIMITED_API + if (unlikely(PyObject_SetAttr((PyObject *) type, __pyx_mstate_global->__pyx_n_u_pyx_vtable, ob) < 0)) +#else + if (unlikely(PyDict_SetItem(type->tp_dict, __pyx_mstate_global->__pyx_n_u_pyx_vtable, ob) < 0)) +#endif + goto bad; + Py_DECREF(ob); + return 0; +bad: + Py_XDECREF(ob); + return -1; +} + +/* GetVTable (used by MergeVTables) */ +static void* __Pyx_GetVtable(PyTypeObject *type) { + void* ptr; +#if CYTHON_COMPILING_IN_LIMITED_API + PyObject *ob = PyObject_GetAttr((PyObject *)type, __pyx_mstate_global->__pyx_n_u_pyx_vtable); +#else + PyObject *ob = PyObject_GetItem(type->tp_dict, __pyx_mstate_global->__pyx_n_u_pyx_vtable); +#endif + if (!ob) + goto bad; + ptr = PyCapsule_GetPointer(ob, 0); + if (!ptr && !PyErr_Occurred()) + PyErr_SetString(PyExc_RuntimeError, "invalid vtable found for imported type"); + Py_DECREF(ob); + return ptr; +bad: + Py_XDECREF(ob); + return NULL; +} + +/* MergeVTables */ +static int __Pyx_MergeVtables(PyTypeObject *type) { + int i=0; + Py_ssize_t size; + void** base_vtables; + __Pyx_TypeName tp_base_name = NULL; + __Pyx_TypeName base_name = NULL; + void* unknown = (void*)-1; + PyObject* bases = __Pyx_PyType_GetSlot(type, tp_bases, PyObject*); + int base_depth = 0; + { + PyTypeObject* base = __Pyx_PyType_GetSlot(type, tp_base, PyTypeObject*); + while (base) { + base_depth += 1; + base = __Pyx_PyType_GetSlot(base, tp_base, PyTypeObject*); + } + } + base_vtables = (void**) PyMem_Malloc(sizeof(void*) * (size_t)(base_depth + 1)); + base_vtables[0] = unknown; +#if CYTHON_COMPILING_IN_LIMITED_API + size = PyTuple_Size(bases); + if (size < 0) goto other_failure; +#else + size = PyTuple_GET_SIZE(bases); +#endif + for (i = 1; i < size; i++) { + PyObject *basei; + void* base_vtable; +#if CYTHON_AVOID_BORROWED_REFS + basei = PySequence_GetItem(bases, i); + if (unlikely(!basei)) goto other_failure; +#elif !CYTHON_ASSUME_SAFE_MACROS + basei = PyTuple_GetItem(bases, i); + if (unlikely(!basei)) goto other_failure; +#else + basei = PyTuple_GET_ITEM(bases, i); +#endif + base_vtable = __Pyx_GetVtable((PyTypeObject*)basei); +#if CYTHON_AVOID_BORROWED_REFS + Py_DECREF(basei); +#endif + if (base_vtable != NULL) { + int j; + PyTypeObject* base = __Pyx_PyType_GetSlot(type, tp_base, PyTypeObject*); + for (j = 0; j < base_depth; j++) { + if (base_vtables[j] == unknown) { + base_vtables[j] = __Pyx_GetVtable(base); + base_vtables[j + 1] = unknown; + } + if (base_vtables[j] == base_vtable) { + break; + } else if (base_vtables[j] == NULL) { + goto bad; + } + base = __Pyx_PyType_GetSlot(base, tp_base, PyTypeObject*); + } + } + } + PyErr_Clear(); + PyMem_Free(base_vtables); + return 0; +bad: + { + PyTypeObject* basei = NULL; + PyTypeObject* tp_base = __Pyx_PyType_GetSlot(type, tp_base, PyTypeObject*); + tp_base_name = __Pyx_PyType_GetFullyQualifiedName(tp_base); +#if CYTHON_AVOID_BORROWED_REFS + basei = (PyTypeObject*)PySequence_GetItem(bases, i); + if (unlikely(!basei)) goto really_bad; +#elif !CYTHON_ASSUME_SAFE_MACROS + basei = (PyTypeObject*)PyTuple_GetItem(bases, i); + if (unlikely(!basei)) goto really_bad; +#else + basei = (PyTypeObject*)PyTuple_GET_ITEM(bases, i); +#endif + base_name = __Pyx_PyType_GetFullyQualifiedName(basei); +#if CYTHON_AVOID_BORROWED_REFS + Py_DECREF(basei); +#endif + } + PyErr_Format(PyExc_TypeError, + "multiple bases have vtable conflict: '" __Pyx_FMT_TYPENAME "' and '" __Pyx_FMT_TYPENAME "'", tp_base_name, base_name); +#if CYTHON_AVOID_BORROWED_REFS || !CYTHON_ASSUME_SAFE_MACROS +really_bad: // bad has failed! +#endif + __Pyx_DECREF_TypeName(tp_base_name); + __Pyx_DECREF_TypeName(base_name); +#if CYTHON_COMPILING_IN_LIMITED_API || CYTHON_AVOID_BORROWED_REFS || !CYTHON_ASSUME_SAFE_MACROS +other_failure: +#endif + PyMem_Free(base_vtables); + return -1; +} + +/* 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_2); + if (likely(name_attr)) { + ret = PyObject_RichCompareBool(name_attr, name, Py_EQ); + } else { + ret = -1; + } + if (unlikely(ret < 0)) { + PyErr_Clear(); + ret = 0; + } + Py_XDECREF(name_attr); + return ret; +} +static int __Pyx_setup_reduce(PyObject* type_obj) { + int ret = 0; + PyObject *object_reduce = NULL; + PyObject *object_getstate = NULL; + PyObject *object_reduce_ex = NULL; + PyObject *reduce = NULL; + PyObject *reduce_ex = NULL; + PyObject *reduce_cython = NULL; + PyObject *setstate = NULL; + PyObject *setstate_cython = NULL; + PyObject *getstate = NULL; +#if CYTHON_USE_PYTYPE_LOOKUP + getstate = _PyType_Lookup((PyTypeObject*)type_obj, __pyx_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_1 +#define __PYX_HAVE_RT_ImportType_3_2_1 +static PyTypeObject *__Pyx_ImportType_3_2_1(PyObject *module, const char *module_name, const char *class_name, + size_t size, size_t alignment, enum __Pyx_ImportType_CheckSize_3_2_1 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_1 && + ((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_1 && (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 VoidPtrImport) */ +#ifndef __PYX_HAVE_RT_ImportFromPxd_3_2_1 +#define __PYX_HAVE_RT_ImportFromPxd_3_2_1 +static int __Pyx_ImportFromPxd_3_2_1(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 + +/* VoidPtrImport */ +#ifndef __PYX_HAVE_RT_ImportVoidPtr_3_2_1 +#define __PYX_HAVE_RT_ImportVoidPtr_3_2_1 +static int __Pyx_ImportVoidPtr_3_2_1(PyObject *module, const char *name, void **p, const char *sig) { + return __Pyx_ImportFromPxd_3_2_1(module, name, p, sig, "variable"); +} +#endif + +/* FunctionImport */ +#ifndef __PYX_HAVE_RT_ImportFunction_3_2_1 +#define __PYX_HAVE_RT_ImportFunction_3_2_1 +static int __Pyx_ImportFunction_3_2_1(PyObject *module, const char *funcname, void (**f)(void), const char *sig) { + union { + void (*fp)(void); + void *p; + } tmp; + int result = __Pyx_ImportFromPxd_3_2_1(module, funcname, &tmp.p, sig, "function"); + if (result == 0) { + *f = tmp.fp; + } + return result; +} +#endif + +/* 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__2); + 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 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); +#elif PY_VERSION_HEX >= 0x030d0000 + PyDict_SetDefaultRef(d, key, default_value, &value); +#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_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(marker); + 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}, + {"_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 !CYTHON_COMPILING_IN_LIMITED_API +#if PY_VERSION_HEX < 0x030900B1 + Py_CLEAR(__Pyx_CyFunction_GetClassObj(m)); +#else + { + PyObject *cls = (PyObject*) ((PyCMethodObject *) (m))->mm_class; + ((PyCMethodObject *) (m))->mm_class = NULL; + Py_XDECREF(cls); + } +#endif +#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); +#if !CYTHON_COMPILING_IN_LIMITED_API + Py_VISIT(__Pyx_CyFunction_GetClassObj(m)); +#endif + Py_VISIT(m->defaults_tuple); + Py_VISIT(m->defaults_kwdict); + 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 + +/* MemviewRefcount */ +#include +#ifndef _Py_NO_RETURN +#define _Py_NO_RETURN +#endif +_Py_NO_RETURN +static void __pyx_fatalerror(const char *fmt, ...) { + va_list vargs; + char msg[200]; +#if PY_VERSION_HEX >= 0x030A0000 || defined(HAVE_STDARG_PROTOTYPES) + va_start(vargs, fmt); +#else + va_start(vargs); +#endif + vsnprintf(msg, 200, fmt, vargs); + va_end(vargs); + Py_FatalError(msg); +} +static CYTHON_INLINE int +__pyx_add_acquisition_count_locked(__pyx_atomic_int_type *acquisition_count, + PyThread_type_lock lock) +{ + int result; + PyThread_acquire_lock(lock, 1); + result = (*acquisition_count)++; + PyThread_release_lock(lock); + return result; +} +static CYTHON_INLINE int +__pyx_sub_acquisition_count_locked(__pyx_atomic_int_type *acquisition_count, + PyThread_type_lock lock) +{ + int result; + PyThread_acquire_lock(lock, 1); + result = (*acquisition_count)--; + PyThread_release_lock(lock); + return result; +} +static CYTHON_INLINE void +__Pyx_INC_MEMVIEW(__Pyx_memviewslice *memslice, int have_gil, int lineno) +{ + __pyx_nonatomic_int_type old_acquisition_count; + struct __pyx_memoryview_obj *memview = memslice->memview; + if (unlikely(!memview || (PyObject *) memview == Py_None)) { + return; + } + old_acquisition_count = __pyx_add_acquisition_count(memview); + if (unlikely(old_acquisition_count <= 0)) { + if (likely(old_acquisition_count == 0)) { + if (have_gil) { + Py_INCREF((PyObject *) memview); + } else { + PyGILState_STATE _gilstate = PyGILState_Ensure(); + Py_INCREF((PyObject *) memview); + PyGILState_Release(_gilstate); + } + } else { + __pyx_fatalerror("Acquisition count is %d (line %d)", + old_acquisition_count+1, lineno); + } + } +} +static CYTHON_INLINE void __Pyx_XCLEAR_MEMVIEW(__Pyx_memviewslice *memslice, + int have_gil, int lineno) { + __pyx_nonatomic_int_type old_acquisition_count; + struct __pyx_memoryview_obj *memview = memslice->memview; + if (unlikely(!memview || (PyObject *) memview == Py_None)) { + memslice->memview = NULL; + return; + } + old_acquisition_count = __pyx_sub_acquisition_count(memview); + memslice->data = NULL; + if (likely(old_acquisition_count > 1)) { + memslice->memview = NULL; + } else if (likely(old_acquisition_count == 1)) { + if (have_gil) { + Py_CLEAR(memslice->memview); + } else { + PyGILState_STATE _gilstate = PyGILState_Ensure(); + Py_CLEAR(memslice->memview); + PyGILState_Release(_gilstate); + } + } else { + __pyx_fatalerror("Acquisition count is %d (line %d)", + old_acquisition_count-1, lineno); + } +} + +/* MemviewSliceIsContig */ +static int +__pyx_memviewslice_is_contig(const __Pyx_memviewslice mvs, char order, int ndim) +{ + int i, index, step, start; + Py_ssize_t itemsize = mvs.memview->view.itemsize; + if (order == 'F') { + step = 1; + start = 0; + } else { + step = -1; + start = ndim - 1; + } + for (i = 0; i < ndim; i++) { + index = start + step * i; + if (mvs.suboffsets[index] >= 0 || mvs.strides[index] != itemsize) + return 0; + itemsize *= mvs.shape[index]; + } + return 1; +} + +/* OverlappingSlices */ +static void +__pyx_get_array_memory_extents(__Pyx_memviewslice *slice, + void **out_start, void **out_end, + int ndim, size_t itemsize) +{ + char *start, *end; + int i; + start = end = slice->data; + for (i = 0; i < ndim; i++) { + Py_ssize_t stride = slice->strides[i]; + Py_ssize_t extent = slice->shape[i]; + if (extent == 0) { + *out_start = *out_end = start; + return; + } else { + if (stride > 0) + end += stride * (extent - 1); + else + start += stride * (extent - 1); + } + } + *out_start = start; + *out_end = end + itemsize; +} +static int +__pyx_slices_overlap(__Pyx_memviewslice *slice1, + __Pyx_memviewslice *slice2, + int ndim, size_t itemsize) +{ + void *start1, *end1, *start2, *end2; + __pyx_get_array_memory_extents(slice1, &start1, &end1, ndim, itemsize); + __pyx_get_array_memory_extents(slice2, &start2, &end2, ndim, itemsize); + return (start1 < end2) && (start2 < end1); +} + +/* MemviewSliceInit */ +static int +__Pyx_init_memviewslice(struct __pyx_memoryview_obj *memview, + int ndim, + __Pyx_memviewslice *memviewslice, + int memview_is_new_reference) +{ + __Pyx_RefNannyDeclarations + int i, retval=-1; + Py_buffer *buf = &memview->view; + __Pyx_RefNannySetupContext("init_memviewslice", 0); + if (unlikely(memviewslice->memview || memviewslice->data)) { + PyErr_SetString(PyExc_ValueError, + "memviewslice is already initialized!"); + goto fail; + } + if (buf->strides) { + for (i = 0; i < ndim; i++) { + memviewslice->strides[i] = buf->strides[i]; + } + } else { + Py_ssize_t stride = buf->itemsize; + for (i = ndim - 1; i >= 0; i--) { + memviewslice->strides[i] = stride; + stride *= buf->shape[i]; + } + } + for (i = 0; i < ndim; i++) { + memviewslice->shape[i] = buf->shape[i]; + if (buf->suboffsets) { + memviewslice->suboffsets[i] = buf->suboffsets[i]; + } else { + memviewslice->suboffsets[i] = -1; + } + } + memviewslice->memview = memview; + memviewslice->data = (char *)buf->buf; + if (__pyx_add_acquisition_count(memview) == 0 && !memview_is_new_reference) { + Py_INCREF((PyObject*)memview); + } + retval = 0; + goto no_fail; +fail: + memviewslice->memview = 0; + memviewslice->data = 0; + retval = -1; +no_fail: + __Pyx_RefNannyFinishContext(); + return retval; +} + +/* CheckUnpickleChecksum */ +static void __Pyx_RaiseUnpickleChecksumError(long checksum, long checksum1, long checksum2, long checksum3, const char *members) { + PyObject *pickle_module = PyImport_ImportModule("pickle"); + if (unlikely(!pickle_module)) return; + PyObject *pickle_error = PyObject_GetAttrString(pickle_module, "PickleError"); + Py_DECREF(pickle_module); + if (unlikely(!pickle_error)) return; + if (checksum2 == checksum1) { + PyErr_Format(pickle_error, "Incompatible checksums (0x%x vs (0x%x) = (%s))", + checksum, checksum1, members); + } else if (checksum3 == checksum2) { + PyErr_Format(pickle_error, "Incompatible checksums (0x%x vs (0x%x, 0x%x) = (%s))", + checksum, checksum1, checksum2, members); + } else { + PyErr_Format(pickle_error, "Incompatible checksums (0x%x vs (0x%x, 0x%x, 0x%x) = (%s))", + checksum, checksum1, checksum2, checksum3, members); + } + Py_DECREF(pickle_error); +} +static int __Pyx_CheckUnpickleChecksum(long checksum, long checksum1, long checksum2, long checksum3, const char *members) { + int found = 0; + found |= checksum1 == checksum; + found |= checksum2 == checksum; + found |= checksum3 == checksum; + if (likely(found)) + return 0; + __Pyx_RaiseUnpickleChecksumError(checksum, checksum1, checksum2, checksum3, members); + return -1; +} + +/* 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;\ + } + +/* IsLittleEndian (used by BufferFormatCheck) */ +static CYTHON_INLINE int __Pyx_Is_Little_Endian(void) +{ + union { + uint32_t u32; + uint8_t u8[4]; + } S; + S.u32 = 0x01020304; + return S.u8[0] == 4; +} + +/* BufferFormatCheck (used by MemviewSliceValidateAndInit) */ +static void __Pyx_BufFmt_Init(__Pyx_BufFmt_Context* ctx, + __Pyx_BufFmt_StackElem* stack, + const __Pyx_TypeInfo* type) { + stack[0].field = &ctx->root; + stack[0].parent_offset = 0; + ctx->root.type = type; + ctx->root.name = "buffer dtype"; + ctx->root.offset = 0; + ctx->head = stack; + ctx->head->field = &ctx->root; + ctx->fmt_offset = 0; + ctx->head->parent_offset = 0; + ctx->new_packmode = '@'; + ctx->enc_packmode = '@'; + ctx->new_count = 1; + ctx->enc_count = 0; + ctx->enc_type = 0; + ctx->is_complex = 0; + ctx->is_valid_array = 0; + ctx->struct_alignment = 0; + while (type->typegroup == 'S') { + ++ctx->head; + ctx->head->field = type->fields; + ctx->head->parent_offset = 0; + type = type->fields->type; + } +} +static int __Pyx_BufFmt_ParseNumber(const char** ts) { + int count; + const char* t = *ts; + if (*t < '0' || *t > '9') { + return -1; + } else { + count = *t++ - '0'; + while (*t >= '0' && *t <= '9') { + count *= 10; + count += *t++ - '0'; + } + } + *ts = t; + return count; +} +static int __Pyx_BufFmt_ExpectNumber(const char **ts) { + int number = __Pyx_BufFmt_ParseNumber(ts); + if (number == -1) + PyErr_Format(PyExc_ValueError,\ + "Does not understand character buffer dtype format string ('%c')", **ts); + return number; +} +static void __Pyx_BufFmt_RaiseUnexpectedChar(char ch) { + PyErr_Format(PyExc_ValueError, + "Unexpected format string character: '%c'", ch); +} +static const char* __Pyx_BufFmt_DescribeTypeChar(char ch, int is_complex) { + switch (ch) { + case '?': return "'bool'"; + case 'c': return "'char'"; + case 'b': return "'signed char'"; + case 'B': return "'unsigned char'"; + case 'h': return "'short'"; + case 'H': return "'unsigned short'"; + case 'i': return "'int'"; + case 'I': return "'unsigned int'"; + case 'l': return "'long'"; + case 'L': return "'unsigned long'"; + case 'q': return "'long long'"; + case 'Q': return "'unsigned long long'"; + case 'f': return (is_complex ? "'complex float'" : "'float'"); + case 'd': return (is_complex ? "'complex double'" : "'double'"); + case 'g': return (is_complex ? "'complex long double'" : "'long double'"); + case 'T': return "a struct"; + case 'O': return "Python object"; + case 'P': return "a pointer"; + case 's': case 'p': return "a string"; + case 0: return "end"; + default: return "unparsable format string"; + } +} +static size_t __Pyx_BufFmt_TypeCharToStandardSize(char ch, int is_complex) { + switch (ch) { + case '?': case 'c': case 'b': case 'B': case 's': case 'p': return 1; + case 'h': case 'H': return 2; + case 'i': case 'I': case 'l': case 'L': return 4; + case 'q': case 'Q': return 8; + case 'f': return (is_complex ? 8 : 4); + case 'd': return (is_complex ? 16 : 8); + case 'g': { + PyErr_SetString(PyExc_ValueError, "Python does not define a standard format string size for long double ('g').."); + return 0; + } + case 'O': case 'P': return sizeof(void*); + default: + __Pyx_BufFmt_RaiseUnexpectedChar(ch); + return 0; + } +} +static size_t __Pyx_BufFmt_TypeCharToNativeSize(char ch, int is_complex) { + switch (ch) { + case '?': case 'c': case 'b': case 'B': case 's': case 'p': return 1; + case 'h': case 'H': return sizeof(short); + case 'i': case 'I': return sizeof(int); + case 'l': case 'L': return sizeof(long); + case 'q': case 'Q': return sizeof(PY_LONG_LONG); + case 'f': return sizeof(float) * (is_complex ? 2 : 1); + case 'd': return sizeof(double) * (is_complex ? 2 : 1); + case 'g': return sizeof(long double) * (is_complex ? 2 : 1); + case 'O': case 'P': return sizeof(void*); + default: { + __Pyx_BufFmt_RaiseUnexpectedChar(ch); + return 0; + } + } +} +typedef struct { char c; short x; } __Pyx_st_short; +typedef struct { char c; int x; } __Pyx_st_int; +typedef struct { char c; long x; } __Pyx_st_long; +typedef struct { char c; float x; } __Pyx_st_float; +typedef struct { char c; double x; } __Pyx_st_double; +typedef struct { char c; long double x; } __Pyx_st_longdouble; +typedef struct { char c; void *x; } __Pyx_st_void_p; +typedef struct { char c; PY_LONG_LONG x; } __Pyx_st_longlong; +static size_t __Pyx_BufFmt_TypeCharToAlignment(char ch, int is_complex) { + CYTHON_UNUSED_VAR(is_complex); + switch (ch) { + case '?': case 'c': case 'b': case 'B': case 's': case 'p': return 1; + case 'h': case 'H': return sizeof(__Pyx_st_short) - sizeof(short); + case 'i': case 'I': return sizeof(__Pyx_st_int) - sizeof(int); + case 'l': case 'L': return sizeof(__Pyx_st_long) - sizeof(long); + case 'q': case 'Q': return sizeof(__Pyx_st_longlong) - sizeof(PY_LONG_LONG); + case 'f': return sizeof(__Pyx_st_float) - sizeof(float); + case 'd': return sizeof(__Pyx_st_double) - sizeof(double); + case 'g': return sizeof(__Pyx_st_longdouble) - sizeof(long double); + case 'P': case 'O': return sizeof(__Pyx_st_void_p) - sizeof(void*); + default: + __Pyx_BufFmt_RaiseUnexpectedChar(ch); + return 0; + } +} +/* These are for computing the padding at the end of the struct to align + on the first member of the struct. This will probably the same as above, + but we don't have any guarantees. + */ +typedef struct { short x; char c; } __Pyx_pad_short; +typedef struct { int x; char c; } __Pyx_pad_int; +typedef struct { long x; char c; } __Pyx_pad_long; +typedef struct { float x; char c; } __Pyx_pad_float; +typedef struct { double x; char c; } __Pyx_pad_double; +typedef struct { long double x; char c; } __Pyx_pad_longdouble; +typedef struct { void *x; char c; } __Pyx_pad_void_p; +typedef struct { PY_LONG_LONG x; char c; } __Pyx_pad_longlong; +static size_t __Pyx_BufFmt_TypeCharToPadding(char ch, int is_complex) { + CYTHON_UNUSED_VAR(is_complex); + switch (ch) { + case '?': case 'c': case 'b': case 'B': case 's': case 'p': return 1; + case 'h': case 'H': return sizeof(__Pyx_pad_short) - sizeof(short); + case 'i': case 'I': return sizeof(__Pyx_pad_int) - sizeof(int); + case 'l': case 'L': return sizeof(__Pyx_pad_long) - sizeof(long); + case 'q': case 'Q': return sizeof(__Pyx_pad_longlong) - sizeof(PY_LONG_LONG); + case 'f': return sizeof(__Pyx_pad_float) - sizeof(float); + case 'd': return sizeof(__Pyx_pad_double) - sizeof(double); + case 'g': return sizeof(__Pyx_pad_longdouble) - sizeof(long double); + case 'P': case 'O': return sizeof(__Pyx_pad_void_p) - sizeof(void*); + default: + __Pyx_BufFmt_RaiseUnexpectedChar(ch); + return 0; + } +} +static char __Pyx_BufFmt_TypeCharToGroup(char ch, int is_complex) { + switch (ch) { + case 'c': + return 'H'; + case 'b': case 'h': case 'i': + case 'l': case 'q': case 's': case 'p': + return 'I'; + case '?': case 'B': case 'H': case 'I': case 'L': case 'Q': + return 'U'; + case 'f': case 'd': case 'g': + return (is_complex ? 'C' : 'R'); + case 'O': + return 'O'; + case 'P': + return 'P'; + default: { + __Pyx_BufFmt_RaiseUnexpectedChar(ch); + return 0; + } + } +} +static void __Pyx_BufFmt_RaiseExpected(__Pyx_BufFmt_Context* ctx) { + if (ctx->head == NULL || ctx->head->field == &ctx->root) { + const char* expected; + const char* quote; + if (ctx->head == NULL) { + expected = "end"; + quote = ""; + } else { + expected = ctx->head->field->type->name; + quote = "'"; + } + PyErr_Format(PyExc_ValueError, + "Buffer dtype mismatch, expected %s%s%s but got %s", + quote, expected, quote, + __Pyx_BufFmt_DescribeTypeChar(ctx->enc_type, ctx->is_complex)); + } else { + const __Pyx_StructField* field = ctx->head->field; + const __Pyx_StructField* parent = (ctx->head - 1)->field; + PyErr_Format(PyExc_ValueError, + "Buffer dtype mismatch, expected '%s' but got %s in '%s.%s'", + field->type->name, __Pyx_BufFmt_DescribeTypeChar(ctx->enc_type, ctx->is_complex), + parent->type->name, field->name); + } +} +static int __Pyx_BufFmt_ProcessTypeChunk(__Pyx_BufFmt_Context* ctx) { + char group; + size_t size, offset, arraysize = 1; + if (ctx->enc_type == 0) return 0; + if (ctx->head->field->type->arraysize[0]) { + int i, ndim = 0; + if (ctx->enc_type == 's' || ctx->enc_type == 'p') { + ctx->is_valid_array = ctx->head->field->type->ndim == 1; + ndim = 1; + if (ctx->enc_count != ctx->head->field->type->arraysize[0]) { + PyErr_Format(PyExc_ValueError, + "Expected a dimension of size %zu, got %zu", + ctx->head->field->type->arraysize[0], ctx->enc_count); + return -1; + } + } + if (!ctx->is_valid_array) { + PyErr_Format(PyExc_ValueError, "Expected %d dimensions, got %d", + ctx->head->field->type->ndim, ndim); + return -1; + } + for (i = 0; i < ctx->head->field->type->ndim; i++) { + arraysize *= ctx->head->field->type->arraysize[i]; + } + ctx->is_valid_array = 0; + ctx->enc_count = 1; + } + group = __Pyx_BufFmt_TypeCharToGroup(ctx->enc_type, ctx->is_complex); + do { + const __Pyx_StructField* field = ctx->head->field; + const __Pyx_TypeInfo* type = field->type; + if (ctx->enc_packmode == '@' || ctx->enc_packmode == '^') { + size = __Pyx_BufFmt_TypeCharToNativeSize(ctx->enc_type, ctx->is_complex); + } else { + size = __Pyx_BufFmt_TypeCharToStandardSize(ctx->enc_type, ctx->is_complex); + } + if (ctx->enc_packmode == '@') { + size_t align_at = __Pyx_BufFmt_TypeCharToAlignment(ctx->enc_type, ctx->is_complex); + size_t align_mod_offset; + if (align_at == 0) return -1; + align_mod_offset = ctx->fmt_offset % align_at; + if (align_mod_offset > 0) ctx->fmt_offset += align_at - align_mod_offset; + if (ctx->struct_alignment == 0) + ctx->struct_alignment = __Pyx_BufFmt_TypeCharToPadding(ctx->enc_type, + ctx->is_complex); + } + if (type->size != size || type->typegroup != group) { + if (type->typegroup == 'C' && type->fields != NULL) { + size_t parent_offset = ctx->head->parent_offset + field->offset; + ++ctx->head; + ctx->head->field = type->fields; + ctx->head->parent_offset = parent_offset; + continue; + } + if ((type->typegroup == 'H' || group == 'H') && type->size == size) { + } else { + __Pyx_BufFmt_RaiseExpected(ctx); + return -1; + } + } + offset = ctx->head->parent_offset + field->offset; + if (ctx->fmt_offset != offset) { + PyErr_Format(PyExc_ValueError, + "Buffer dtype mismatch; next field is at offset %" CYTHON_FORMAT_SSIZE_T "d but %" CYTHON_FORMAT_SSIZE_T "d expected", + (Py_ssize_t)ctx->fmt_offset, (Py_ssize_t)offset); + return -1; + } + ctx->fmt_offset += size; + if (arraysize) + ctx->fmt_offset += (arraysize - 1) * size; + --ctx->enc_count; + while (1) { + if (field == &ctx->root) { + ctx->head = NULL; + if (ctx->enc_count != 0) { + __Pyx_BufFmt_RaiseExpected(ctx); + return -1; + } + break; + } + ctx->head->field = ++field; + if (field->type == NULL) { + --ctx->head; + field = ctx->head->field; + continue; + } else if (field->type->typegroup == 'S') { + size_t parent_offset = ctx->head->parent_offset + field->offset; + if (field->type->fields->type == NULL) continue; + field = field->type->fields; + ++ctx->head; + ctx->head->field = field; + ctx->head->parent_offset = parent_offset; + break; + } else { + break; + } + } + } while (ctx->enc_count); + ctx->enc_type = 0; + ctx->is_complex = 0; + return 0; +} +static int +__pyx_buffmt_parse_array(__Pyx_BufFmt_Context* ctx, const char** tsp) +{ + const char *ts = *tsp; + int i = 0, number, ndim; + ++ts; + if (ctx->new_count != 1) { + PyErr_SetString(PyExc_ValueError, + "Cannot handle repeated arrays in format string"); + return -1; + } + if (__Pyx_BufFmt_ProcessTypeChunk(ctx) == -1) return -1; + ndim = ctx->head->field->type->ndim; + while (*ts && *ts != ')') { + switch (*ts) { + case ' ': case '\f': case '\r': case '\n': case '\t': case '\v': continue; + default: break; + } + number = __Pyx_BufFmt_ExpectNumber(&ts); + if (number == -1) return -1; + if (i < ndim && (size_t) number != ctx->head->field->type->arraysize[i]) { + PyErr_Format(PyExc_ValueError, + "Expected a dimension of size %zu, got %d", + ctx->head->field->type->arraysize[i], number); + return -1; + } + if (*ts != ',' && *ts != ')') { + PyErr_Format(PyExc_ValueError, + "Expected a comma in format string, got '%c'", *ts); + return -1; + } + if (*ts == ',') ts++; + i++; + } + if (i != ndim) { + PyErr_Format(PyExc_ValueError, "Expected %d dimension(s), got %d", + ctx->head->field->type->ndim, i); + return -1; + } + if (!*ts) { + PyErr_SetString(PyExc_ValueError, + "Unexpected end of format string, expected ')'"); + return -1; + } + ctx->is_valid_array = 1; + ctx->new_count = 1; + *tsp = ++ts; + return 0; +} +static const char* __Pyx_BufFmt_CheckString(__Pyx_BufFmt_Context* ctx, const char* ts) { + int got_Z = 0; + while (1) { + switch(*ts) { + case 0: + if (ctx->enc_type != 0 && ctx->head == NULL) { + __Pyx_BufFmt_RaiseExpected(ctx); + return NULL; + } + if (__Pyx_BufFmt_ProcessTypeChunk(ctx) == -1) return NULL; + if (ctx->head != NULL) { + __Pyx_BufFmt_RaiseExpected(ctx); + return NULL; + } + return ts; + case ' ': + case '\r': + case '\n': + ++ts; + break; + case '<': + if (!__Pyx_Is_Little_Endian()) { + PyErr_SetString(PyExc_ValueError, "Little-endian buffer not supported on big-endian compiler"); + return NULL; + } + ctx->new_packmode = '='; + ++ts; + break; + case '>': + case '!': + if (__Pyx_Is_Little_Endian()) { + PyErr_SetString(PyExc_ValueError, "Big-endian buffer not supported on little-endian compiler"); + return NULL; + } + ctx->new_packmode = '='; + ++ts; + break; + case '=': + case '@': + case '^': + ctx->new_packmode = *ts++; + break; + case 'T': + { + const char* ts_after_sub; + size_t i, struct_count = ctx->new_count; + size_t struct_alignment = ctx->struct_alignment; + ctx->new_count = 1; + ++ts; + if (*ts != '{') { + PyErr_SetString(PyExc_ValueError, "Buffer acquisition: Expected '{' after 'T'"); + return NULL; + } + if (__Pyx_BufFmt_ProcessTypeChunk(ctx) == -1) return NULL; + ctx->enc_type = 0; + ctx->enc_count = 0; + ctx->struct_alignment = 0; + ++ts; + ts_after_sub = ts; + for (i = 0; i != struct_count; ++i) { + ts_after_sub = __Pyx_BufFmt_CheckString(ctx, ts); + if (!ts_after_sub) return NULL; + } + ts = ts_after_sub; + if (struct_alignment) ctx->struct_alignment = struct_alignment; + } + break; + case '}': + { + size_t alignment = ctx->struct_alignment; + ++ts; + if (__Pyx_BufFmt_ProcessTypeChunk(ctx) == -1) return NULL; + ctx->enc_type = 0; + if (alignment && ctx->fmt_offset % alignment) { + ctx->fmt_offset += alignment - (ctx->fmt_offset % alignment); + } + } + return ts; + case 'x': + if (__Pyx_BufFmt_ProcessTypeChunk(ctx) == -1) return NULL; + ctx->fmt_offset += ctx->new_count; + ctx->new_count = 1; + ctx->enc_count = 0; + ctx->enc_type = 0; + ctx->enc_packmode = ctx->new_packmode; + ++ts; + break; + case 'Z': + got_Z = 1; + ++ts; + if (*ts != 'f' && *ts != 'd' && *ts != 'g') { + __Pyx_BufFmt_RaiseUnexpectedChar('Z'); + return NULL; + } + CYTHON_FALLTHROUGH; + case '?': case 'c': case 'b': case 'B': case 'h': case 'H': case 'i': case 'I': + case 'l': case 'L': case 'q': case 'Q': + case 'f': case 'd': case 'g': + case 'O': case 'p': + if ((ctx->enc_type == *ts) && (got_Z == ctx->is_complex) && + (ctx->enc_packmode == ctx->new_packmode) && (!ctx->is_valid_array)) { + ctx->enc_count += ctx->new_count; + ctx->new_count = 1; + got_Z = 0; + ++ts; + break; + } + CYTHON_FALLTHROUGH; + case 's': + if (__Pyx_BufFmt_ProcessTypeChunk(ctx) == -1) return NULL; + ctx->enc_count = ctx->new_count; + ctx->enc_packmode = ctx->new_packmode; + ctx->enc_type = *ts; + ctx->is_complex = got_Z; + ++ts; + ctx->new_count = 1; + got_Z = 0; + break; + case ':': + ++ts; + while(*ts != ':') ++ts; + ++ts; + break; + case '(': + if (__pyx_buffmt_parse_array(ctx, &ts) < 0) return NULL; + break; + default: + { + int number = __Pyx_BufFmt_ExpectNumber(&ts); + if (number == -1) return NULL; + ctx->new_count = (size_t)number; + } + } + } +} + +/* TypeInfoCompare (used by MemviewSliceValidateAndInit) */ + static int + __pyx_typeinfo_cmp(const __Pyx_TypeInfo *a, const __Pyx_TypeInfo *b) + { + int i; + if (!a || !b) + return 0; + if (a == b) + return 1; + if (a->size != b->size || a->typegroup != b->typegroup || + a->is_unsigned != b->is_unsigned || a->ndim != b->ndim) { + if (a->typegroup == 'H' || b->typegroup == 'H') { + return a->size == b->size; + } else { + return 0; + } + } + if (a->ndim) { + for (i = 0; i < a->ndim; i++) + if (a->arraysize[i] != b->arraysize[i]) + return 0; + } + if (a->typegroup == 'S') { + if (a->flags != b->flags) + return 0; + if (a->fields || b->fields) { + if (!(a->fields && b->fields)) + return 0; + for (i = 0; a->fields[i].type && b->fields[i].type; i++) { + const __Pyx_StructField *field_a = a->fields + i; + const __Pyx_StructField *field_b = b->fields + i; + if (field_a->offset != field_b->offset || + !__pyx_typeinfo_cmp(field_a->type, field_b->type)) + return 0; + } + return !a->fields[i].type && !b->fields[i].type; + } + } + return 1; + } + +/* MemviewSliceValidateAndInit (used by ObjectToMemviewSlice) */ + static int + __pyx_check_strides(Py_buffer *buf, int dim, int ndim, int spec) + { + if (buf->shape[dim] <= 1) + return 1; + if (buf->strides) { + if (spec & __Pyx_MEMVIEW_CONTIG) { + if (spec & (__Pyx_MEMVIEW_PTR|__Pyx_MEMVIEW_FULL)) { + if (unlikely(buf->strides[dim] != sizeof(void *))) { + PyErr_Format(PyExc_ValueError, + "Buffer is not indirectly contiguous " + "in dimension %d.", dim); + goto fail; + } + } else if (unlikely(buf->strides[dim] != buf->itemsize)) { + PyErr_SetString(PyExc_ValueError, + "Buffer and memoryview are not contiguous " + "in the same dimension."); + goto fail; + } + } + if (spec & __Pyx_MEMVIEW_FOLLOW) { + Py_ssize_t stride = buf->strides[dim]; + if (stride < 0) + stride = -stride; + if (unlikely(stride < buf->itemsize)) { + PyErr_SetString(PyExc_ValueError, + "Buffer and memoryview are not contiguous " + "in the same dimension."); + goto fail; + } + } + } else { + if (unlikely(spec & __Pyx_MEMVIEW_CONTIG && dim != ndim - 1)) { + PyErr_Format(PyExc_ValueError, + "C-contiguous buffer is not contiguous in " + "dimension %d", dim); + goto fail; + } else if (unlikely(spec & (__Pyx_MEMVIEW_PTR))) { + PyErr_Format(PyExc_ValueError, + "C-contiguous buffer is not indirect in " + "dimension %d", dim); + goto fail; + } else if (unlikely(buf->suboffsets)) { + PyErr_SetString(PyExc_ValueError, + "Buffer exposes suboffsets but no strides"); + goto fail; + } + } + return 1; + fail: + return 0; + } + static int + __pyx_check_suboffsets(Py_buffer *buf, int dim, int ndim, int spec) + { + CYTHON_UNUSED_VAR(ndim); + if (spec & __Pyx_MEMVIEW_DIRECT) { + if (unlikely(buf->suboffsets && buf->suboffsets[dim] >= 0)) { + PyErr_Format(PyExc_ValueError, + "Buffer not compatible with direct access " + "in dimension %d.", dim); + goto fail; + } + } + if (spec & __Pyx_MEMVIEW_PTR) { + if (unlikely(!buf->suboffsets || (buf->suboffsets[dim] < 0))) { + PyErr_Format(PyExc_ValueError, + "Buffer is not indirectly accessible " + "in dimension %d.", dim); + goto fail; + } + } + return 1; + fail: + return 0; + } + static int + __pyx_verify_contig(Py_buffer *buf, int ndim, int c_or_f_flag) + { + int i; + if (c_or_f_flag & __Pyx_IS_F_CONTIG) { + Py_ssize_t stride = 1; + for (i = 0; i < ndim; i++) { + if (unlikely(stride * buf->itemsize != buf->strides[i] && buf->shape[i] > 1)) { + PyErr_SetString(PyExc_ValueError, + "Buffer not fortran contiguous."); + goto fail; + } + stride = stride * buf->shape[i]; + } + } else if (c_or_f_flag & __Pyx_IS_C_CONTIG) { + Py_ssize_t stride = 1; + for (i = ndim - 1; i >- 1; i--) { + if (unlikely(stride * buf->itemsize != buf->strides[i] && buf->shape[i] > 1)) { + PyErr_SetString(PyExc_ValueError, + "Buffer not C contiguous."); + goto fail; + } + stride = stride * buf->shape[i]; + } + } + return 1; + fail: + return 0; + } + static int __Pyx_ValidateAndInit_memviewslice( + int *axes_specs, + int c_or_f_flag, + int buf_flags, + int ndim, + const __Pyx_TypeInfo *dtype, + __Pyx_BufFmt_StackElem stack[], + __Pyx_memviewslice *memviewslice, + PyObject *original_obj) + { + struct __pyx_memoryview_obj *memview, *new_memview; + __Pyx_RefNannyDeclarations + Py_buffer *buf; + int i, spec = 0, retval = -1; + __Pyx_BufFmt_Context ctx; + int from_memoryview = __pyx_memoryview_check(original_obj); + __Pyx_RefNannySetupContext("ValidateAndInit_memviewslice", 0); + if (from_memoryview && __pyx_typeinfo_cmp(dtype, ((struct __pyx_memoryview_obj *) + original_obj)->typeinfo)) { + memview = (struct __pyx_memoryview_obj *) original_obj; + new_memview = NULL; + } else { + memview = (struct __pyx_memoryview_obj *) __pyx_memoryview_new( + original_obj, buf_flags, 0, dtype); + new_memview = memview; + if (unlikely(!memview)) + goto fail; + } + buf = &memview->view; + if (unlikely(buf->ndim != ndim)) { + PyErr_Format(PyExc_ValueError, + "Buffer has wrong number of dimensions (expected %d, got %d)", + ndim, buf->ndim); + goto fail; + } + if (new_memview) { + __Pyx_BufFmt_Init(&ctx, stack, dtype); + if (unlikely(!__Pyx_BufFmt_CheckString(&ctx, buf->format))) goto fail; + } + if (unlikely((unsigned) buf->itemsize != dtype->size)) { + PyErr_Format(PyExc_ValueError, + "Item size of buffer (%" CYTHON_FORMAT_SSIZE_T "u byte%s) " + "does not match size of '%s' (%" CYTHON_FORMAT_SSIZE_T "u byte%s)", + buf->itemsize, + (buf->itemsize > 1) ? "s" : "", + dtype->name, + dtype->size, + (dtype->size > 1) ? "s" : ""); + goto fail; + } + if (buf->len > 0) { + for (i = 0; i < ndim; i++) { + spec = axes_specs[i]; + if (unlikely(!__pyx_check_strides(buf, i, ndim, spec))) + goto fail; + if (unlikely(!__pyx_check_suboffsets(buf, i, ndim, spec))) + goto fail; + } + if (unlikely(buf->strides && !__pyx_verify_contig(buf, ndim, c_or_f_flag))) + goto fail; + } + if (unlikely(__Pyx_init_memviewslice(memview, ndim, memviewslice, + new_memview != NULL) == -1)) { + goto fail; + } + retval = 0; + goto no_fail; + fail: + Py_XDECREF((PyObject*)new_memview); + retval = -1; + no_fail: + __Pyx_RefNannyFinishContext(); + return retval; + } + +/* ObjectToMemviewSlice */ + static CYTHON_INLINE __Pyx_memviewslice __Pyx_PyObject_to_MemoryviewSlice_d_dc_float(PyObject *obj, int writable_flag) { + __Pyx_memviewslice result = __Pyx_MEMSLICE_INIT; + __Pyx_BufFmt_StackElem stack[1]; + int axes_specs[] = { (__Pyx_MEMVIEW_DIRECT | __Pyx_MEMVIEW_FOLLOW), (__Pyx_MEMVIEW_DIRECT | __Pyx_MEMVIEW_CONTIG) }; + int retcode; + if (obj == Py_None) { + result.memview = (struct __pyx_memoryview_obj *) Py_None; + return result; + } + retcode = __Pyx_ValidateAndInit_memviewslice(axes_specs, __Pyx_IS_C_CONTIG, + (PyBUF_C_CONTIGUOUS | PyBUF_FORMAT) | writable_flag, 2, + &__Pyx_TypeInfo_float, stack, + &result, obj); + if (unlikely(retcode == -1)) + goto __pyx_fail; + return result; + __pyx_fail: + result.memview = NULL; + result.data = NULL; + return result; + } + +/* Declarations */ + #if CYTHON_CCOMPLEX && (1) && (!0 || __cplusplus) + #ifdef __cplusplus + static CYTHON_INLINE __pyx_t_float_complex __pyx_t_float_complex_from_parts(float x, float y) { + return ::std::complex< float >(x, y); + } + #else + static CYTHON_INLINE __pyx_t_float_complex __pyx_t_float_complex_from_parts(float x, float y) { + return x + y*(__pyx_t_float_complex)_Complex_I; + } + #endif + #else + static CYTHON_INLINE __pyx_t_float_complex __pyx_t_float_complex_from_parts(float x, float y) { + __pyx_t_float_complex z; + z.real = x; + z.imag = y; + return z; + } + #endif + +/* Arithmetic */ + #if CYTHON_CCOMPLEX && (1) && (!0 || __cplusplus) + #else + static CYTHON_INLINE int __Pyx_c_eq_float(__pyx_t_float_complex a, __pyx_t_float_complex b) { + return (a.real == b.real) && (a.imag == b.imag); + } + static CYTHON_INLINE __pyx_t_float_complex __Pyx_c_sum_float(__pyx_t_float_complex a, __pyx_t_float_complex b) { + __pyx_t_float_complex z; + z.real = a.real + b.real; + z.imag = a.imag + b.imag; + return z; + } + static CYTHON_INLINE __pyx_t_float_complex __Pyx_c_diff_float(__pyx_t_float_complex a, __pyx_t_float_complex b) { + __pyx_t_float_complex z; + z.real = a.real - b.real; + z.imag = a.imag - b.imag; + return z; + } + static CYTHON_INLINE __pyx_t_float_complex __Pyx_c_prod_float(__pyx_t_float_complex a, __pyx_t_float_complex b) { + __pyx_t_float_complex z; + z.real = a.real * b.real - a.imag * b.imag; + z.imag = a.real * b.imag + a.imag * b.real; + return z; + } + #if 1 + static CYTHON_INLINE __pyx_t_float_complex __Pyx_c_quot_float(__pyx_t_float_complex a, __pyx_t_float_complex b) { + if (b.imag == 0) { + return __pyx_t_float_complex_from_parts(a.real / b.real, a.imag / b.real); + } else if (fabsf(b.real) >= fabsf(b.imag)) { + if (b.real == 0 && b.imag == 0) { + return __pyx_t_float_complex_from_parts(a.real / b.real, a.imag / b.imag); + } else { + float r = b.imag / b.real; + float s = (float)(1.0) / (b.real + b.imag * r); + return __pyx_t_float_complex_from_parts( + (a.real + a.imag * r) * s, (a.imag - a.real * r) * s); + } + } else { + float r = b.real / b.imag; + float s = (float)(1.0) / (b.imag + b.real * r); + return __pyx_t_float_complex_from_parts( + (a.real * r + a.imag) * s, (a.imag * r - a.real) * s); + } + } + #else + static CYTHON_INLINE __pyx_t_float_complex __Pyx_c_quot_float(__pyx_t_float_complex a, __pyx_t_float_complex b) { + if (b.imag == 0) { + return __pyx_t_float_complex_from_parts(a.real / b.real, a.imag / b.real); + } else { + float denom = b.real * b.real + b.imag * b.imag; + return __pyx_t_float_complex_from_parts( + (a.real * b.real + a.imag * b.imag) / denom, + (a.imag * b.real - a.real * b.imag) / denom); + } + } + #endif + static CYTHON_INLINE __pyx_t_float_complex __Pyx_c_neg_float(__pyx_t_float_complex a) { + __pyx_t_float_complex z; + z.real = -a.real; + z.imag = -a.imag; + return z; + } + static CYTHON_INLINE int __Pyx_c_is_zero_float(__pyx_t_float_complex a) { + return (a.real == 0) && (a.imag == 0); + } + static CYTHON_INLINE __pyx_t_float_complex __Pyx_c_conj_float(__pyx_t_float_complex a) { + __pyx_t_float_complex z; + z.real = a.real; + z.imag = -a.imag; + return z; + } + #if 1 + static CYTHON_INLINE float __Pyx_c_abs_float(__pyx_t_float_complex z) { + #if !defined(HAVE_HYPOT) || defined(_MSC_VER) + return sqrtf(z.real*z.real + z.imag*z.imag); + #else + return hypotf(z.real, z.imag); + #endif + } + static CYTHON_INLINE __pyx_t_float_complex __Pyx_c_pow_float(__pyx_t_float_complex a, __pyx_t_float_complex b) { + __pyx_t_float_complex z; + float r, lnr, theta, z_r, z_theta; + if (b.imag == 0 && b.real == (int)b.real) { + if (b.real < 0) { + float denom = a.real * a.real + a.imag * a.imag; + a.real = a.real / denom; + a.imag = -a.imag / denom; + b.real = -b.real; + } + switch ((int)b.real) { + case 0: + z.real = 1; + z.imag = 0; + return z; + case 1: + return a; + case 2: + return __Pyx_c_prod_float(a, a); + case 3: + z = __Pyx_c_prod_float(a, a); + return __Pyx_c_prod_float(z, a); + case 4: + z = __Pyx_c_prod_float(a, a); + return __Pyx_c_prod_float(z, z); + } + } + if (a.imag == 0) { + if (a.real == 0) { + return a; + } else if ((b.imag == 0) && (a.real >= 0)) { + z.real = powf(a.real, b.real); + z.imag = 0; + return z; + } else if (a.real > 0) { + r = a.real; + theta = 0; + } else { + r = -a.real; + theta = atan2f(0.0, -1.0); + } + } else { + r = __Pyx_c_abs_float(a); + theta = atan2f(a.imag, a.real); + } + lnr = logf(r); + z_r = expf(lnr * b.real - theta * b.imag); + z_theta = theta * b.real + lnr * b.imag; + z.real = z_r * cosf(z_theta); + z.imag = z_r * sinf(z_theta); + return z; + } + #endif + #endif + +/* Declarations */ + #if CYTHON_CCOMPLEX && (1) && (!0 || __cplusplus) + #ifdef __cplusplus + static CYTHON_INLINE __pyx_t_double_complex __pyx_t_double_complex_from_parts(double x, double y) { + return ::std::complex< double >(x, y); + } + #else + static CYTHON_INLINE __pyx_t_double_complex __pyx_t_double_complex_from_parts(double x, double y) { + return x + y*(__pyx_t_double_complex)_Complex_I; + } + #endif + #else + static CYTHON_INLINE __pyx_t_double_complex __pyx_t_double_complex_from_parts(double x, double y) { + __pyx_t_double_complex z; + z.real = x; + z.imag = y; + return z; + } + #endif + +/* Arithmetic */ + #if CYTHON_CCOMPLEX && (1) && (!0 || __cplusplus) + #else + static CYTHON_INLINE int __Pyx_c_eq_double(__pyx_t_double_complex a, __pyx_t_double_complex b) { + return (a.real == b.real) && (a.imag == b.imag); + } + static CYTHON_INLINE __pyx_t_double_complex __Pyx_c_sum_double(__pyx_t_double_complex a, __pyx_t_double_complex b) { + __pyx_t_double_complex z; + z.real = a.real + b.real; + z.imag = a.imag + b.imag; + return z; + } + static CYTHON_INLINE __pyx_t_double_complex __Pyx_c_diff_double(__pyx_t_double_complex a, __pyx_t_double_complex b) { + __pyx_t_double_complex z; + z.real = a.real - b.real; + z.imag = a.imag - b.imag; + return z; + } + static CYTHON_INLINE __pyx_t_double_complex __Pyx_c_prod_double(__pyx_t_double_complex a, __pyx_t_double_complex b) { + __pyx_t_double_complex z; + z.real = a.real * b.real - a.imag * b.imag; + z.imag = a.real * b.imag + a.imag * b.real; + return z; + } + #if 1 + static CYTHON_INLINE __pyx_t_double_complex __Pyx_c_quot_double(__pyx_t_double_complex a, __pyx_t_double_complex b) { + if (b.imag == 0) { + return __pyx_t_double_complex_from_parts(a.real / b.real, a.imag / b.real); + } else if (fabs(b.real) >= fabs(b.imag)) { + if (b.real == 0 && b.imag == 0) { + return __pyx_t_double_complex_from_parts(a.real / b.real, a.imag / b.imag); + } else { + double r = b.imag / b.real; + double s = (double)(1.0) / (b.real + b.imag * r); + return __pyx_t_double_complex_from_parts( + (a.real + a.imag * r) * s, (a.imag - a.real * r) * s); + } + } else { + double r = b.real / b.imag; + double s = (double)(1.0) / (b.imag + b.real * r); + return __pyx_t_double_complex_from_parts( + (a.real * r + a.imag) * s, (a.imag * r - a.real) * s); + } + } + #else + static CYTHON_INLINE __pyx_t_double_complex __Pyx_c_quot_double(__pyx_t_double_complex a, __pyx_t_double_complex b) { + if (b.imag == 0) { + return __pyx_t_double_complex_from_parts(a.real / b.real, a.imag / b.real); + } else { + double denom = b.real * b.real + b.imag * b.imag; + return __pyx_t_double_complex_from_parts( + (a.real * b.real + a.imag * b.imag) / denom, + (a.imag * b.real - a.real * b.imag) / denom); + } + } + #endif + static CYTHON_INLINE __pyx_t_double_complex __Pyx_c_neg_double(__pyx_t_double_complex a) { + __pyx_t_double_complex z; + z.real = -a.real; + z.imag = -a.imag; + return z; + } + static CYTHON_INLINE int __Pyx_c_is_zero_double(__pyx_t_double_complex a) { + return (a.real == 0) && (a.imag == 0); + } + static CYTHON_INLINE __pyx_t_double_complex __Pyx_c_conj_double(__pyx_t_double_complex a) { + __pyx_t_double_complex z; + z.real = a.real; + z.imag = -a.imag; + return z; + } + #if 1 + static CYTHON_INLINE double __Pyx_c_abs_double(__pyx_t_double_complex z) { + #if !defined(HAVE_HYPOT) || defined(_MSC_VER) + return sqrt(z.real*z.real + z.imag*z.imag); + #else + return hypot(z.real, z.imag); + #endif + } + static CYTHON_INLINE __pyx_t_double_complex __Pyx_c_pow_double(__pyx_t_double_complex a, __pyx_t_double_complex b) { + __pyx_t_double_complex z; + double r, lnr, theta, z_r, z_theta; + if (b.imag == 0 && b.real == (int)b.real) { + if (b.real < 0) { + double denom = a.real * a.real + a.imag * a.imag; + a.real = a.real / denom; + a.imag = -a.imag / denom; + b.real = -b.real; + } + switch ((int)b.real) { + case 0: + z.real = 1; + z.imag = 0; + return z; + case 1: + return a; + case 2: + return __Pyx_c_prod_double(a, a); + case 3: + z = __Pyx_c_prod_double(a, a); + return __Pyx_c_prod_double(z, a); + case 4: + z = __Pyx_c_prod_double(a, a); + return __Pyx_c_prod_double(z, z); + } + } + if (a.imag == 0) { + if (a.real == 0) { + return a; + } else if ((b.imag == 0) && (a.real >= 0)) { + z.real = pow(a.real, b.real); + z.imag = 0; + return z; + } else if (a.real > 0) { + r = a.real; + theta = 0; + } else { + r = -a.real; + theta = atan2(0.0, -1.0); + } + } else { + r = __Pyx_c_abs_double(a); + theta = atan2(a.imag, a.real); + } + lnr = log(r); + z_r = exp(lnr * b.real - theta * b.imag); + z_theta = theta * b.real + lnr * b.imag; + z.real = z_r * cos(z_theta); + z.imag = z_r * sin(z_theta); + return z; + } + #endif + #endif + +/* Declarations */ + #if CYTHON_CCOMPLEX && (1) && (!0 || __cplusplus) + #ifdef __cplusplus + static CYTHON_INLINE __pyx_t_long_double_complex __pyx_t_long_double_complex_from_parts(long double x, long double y) { + return ::std::complex< long double >(x, y); + } + #else + static CYTHON_INLINE __pyx_t_long_double_complex __pyx_t_long_double_complex_from_parts(long double x, long double y) { + return x + y*(__pyx_t_long_double_complex)_Complex_I; + } + #endif + #else + static CYTHON_INLINE __pyx_t_long_double_complex __pyx_t_long_double_complex_from_parts(long double x, long double y) { + __pyx_t_long_double_complex z; + z.real = x; + z.imag = y; + return z; + } + #endif + +/* Arithmetic */ + #if CYTHON_CCOMPLEX && (1) && (!0 || __cplusplus) + #else + static CYTHON_INLINE int __Pyx_c_eq_long__double(__pyx_t_long_double_complex a, __pyx_t_long_double_complex b) { + return (a.real == b.real) && (a.imag == b.imag); + } + static CYTHON_INLINE __pyx_t_long_double_complex __Pyx_c_sum_long__double(__pyx_t_long_double_complex a, __pyx_t_long_double_complex b) { + __pyx_t_long_double_complex z; + z.real = a.real + b.real; + z.imag = a.imag + b.imag; + return z; + } + static CYTHON_INLINE __pyx_t_long_double_complex __Pyx_c_diff_long__double(__pyx_t_long_double_complex a, __pyx_t_long_double_complex b) { + __pyx_t_long_double_complex z; + z.real = a.real - b.real; + z.imag = a.imag - b.imag; + return z; + } + static CYTHON_INLINE __pyx_t_long_double_complex __Pyx_c_prod_long__double(__pyx_t_long_double_complex a, __pyx_t_long_double_complex b) { + __pyx_t_long_double_complex z; + z.real = a.real * b.real - a.imag * b.imag; + z.imag = a.real * b.imag + a.imag * b.real; + return z; + } + #if 1 + static CYTHON_INLINE __pyx_t_long_double_complex __Pyx_c_quot_long__double(__pyx_t_long_double_complex a, __pyx_t_long_double_complex b) { + if (b.imag == 0) { + return __pyx_t_long_double_complex_from_parts(a.real / b.real, a.imag / b.real); + } else if (fabsl(b.real) >= fabsl(b.imag)) { + if (b.real == 0 && b.imag == 0) { + return __pyx_t_long_double_complex_from_parts(a.real / b.real, a.imag / b.imag); + } else { + long double r = b.imag / b.real; + long double s = (long double)(1.0) / (b.real + b.imag * r); + return __pyx_t_long_double_complex_from_parts( + (a.real + a.imag * r) * s, (a.imag - a.real * r) * s); + } + } else { + long double r = b.real / b.imag; + long double s = (long double)(1.0) / (b.imag + b.real * r); + return __pyx_t_long_double_complex_from_parts( + (a.real * r + a.imag) * s, (a.imag * r - a.real) * s); + } + } + #else + static CYTHON_INLINE __pyx_t_long_double_complex __Pyx_c_quot_long__double(__pyx_t_long_double_complex a, __pyx_t_long_double_complex b) { + if (b.imag == 0) { + return __pyx_t_long_double_complex_from_parts(a.real / b.real, a.imag / b.real); + } else { + long double denom = b.real * b.real + b.imag * b.imag; + return __pyx_t_long_double_complex_from_parts( + (a.real * b.real + a.imag * b.imag) / denom, + (a.imag * b.real - a.real * b.imag) / denom); + } + } + #endif + static CYTHON_INLINE __pyx_t_long_double_complex __Pyx_c_neg_long__double(__pyx_t_long_double_complex a) { + __pyx_t_long_double_complex z; + z.real = -a.real; + z.imag = -a.imag; + return z; + } + static CYTHON_INLINE int __Pyx_c_is_zero_long__double(__pyx_t_long_double_complex a) { + return (a.real == 0) && (a.imag == 0); + } + static CYTHON_INLINE __pyx_t_long_double_complex __Pyx_c_conj_long__double(__pyx_t_long_double_complex a) { + __pyx_t_long_double_complex z; + z.real = a.real; + z.imag = -a.imag; + return z; + } + #if 1 + static CYTHON_INLINE long double __Pyx_c_abs_long__double(__pyx_t_long_double_complex z) { + #if !defined(HAVE_HYPOT) || defined(_MSC_VER) + return sqrtl(z.real*z.real + z.imag*z.imag); + #else + return hypotl(z.real, z.imag); + #endif + } + static CYTHON_INLINE __pyx_t_long_double_complex __Pyx_c_pow_long__double(__pyx_t_long_double_complex a, __pyx_t_long_double_complex b) { + __pyx_t_long_double_complex z; + long double r, lnr, theta, z_r, z_theta; + if (b.imag == 0 && b.real == (int)b.real) { + if (b.real < 0) { + long double denom = a.real * a.real + a.imag * a.imag; + a.real = a.real / denom; + a.imag = -a.imag / denom; + b.real = -b.real; + } + switch ((int)b.real) { + case 0: + z.real = 1; + z.imag = 0; + return z; + case 1: + return a; + case 2: + return __Pyx_c_prod_long__double(a, a); + case 3: + z = __Pyx_c_prod_long__double(a, a); + return __Pyx_c_prod_long__double(z, a); + case 4: + z = __Pyx_c_prod_long__double(a, a); + return __Pyx_c_prod_long__double(z, z); + } + } + if (a.imag == 0) { + if (a.real == 0) { + return a; + } else if ((b.imag == 0) && (a.real >= 0)) { + z.real = powl(a.real, b.real); + z.imag = 0; + return z; + } else if (a.real > 0) { + r = a.real; + theta = 0; + } else { + r = -a.real; + theta = atan2l(0.0, -1.0); + } + } else { + r = __Pyx_c_abs_long__double(a); + theta = atan2l(a.imag, a.real); + } + lnr = logl(r); + z_r = expl(lnr * b.real - theta * b.imag); + z_theta = theta * b.real + lnr * b.imag; + z.real = z_r * cosl(z_theta); + z.imag = z_r * sinl(z_theta); + return z; + } + #endif + #endif + +/* MemviewSliceCopy */ + static __Pyx_memviewslice + __pyx_memoryview_copy_new_contig(const __Pyx_memviewslice *from_mvs, + const char *mode, int ndim, + size_t sizeof_dtype, int contig_flag, + int dtype_is_object) + { + __Pyx_RefNannyDeclarations + int i; + __Pyx_memviewslice new_mvs = __Pyx_MEMSLICE_INIT; + struct __pyx_memoryview_obj *from_memview = from_mvs->memview; + Py_buffer *buf = &from_memview->view; + PyObject *shape_tuple = NULL; + PyObject *temp_int = NULL; + struct __pyx_array_obj *array_obj = NULL; + struct __pyx_memoryview_obj *memview_obj = NULL; + __Pyx_RefNannySetupContext("__pyx_memoryview_copy_new_contig", 0); + for (i = 0; i < ndim; i++) { + if (unlikely(from_mvs->suboffsets[i] >= 0)) { + PyErr_Format(PyExc_ValueError, "Cannot copy memoryview slice with " + "indirect dimensions (axis %d)", i); + goto fail; + } + } + shape_tuple = PyTuple_New(ndim); + if (unlikely(!shape_tuple)) { + goto fail; + } + __Pyx_GOTREF(shape_tuple); + for(i = 0; i < ndim; i++) { + temp_int = PyLong_FromSsize_t(from_mvs->shape[i]); + if(unlikely(!temp_int)) { + goto fail; + } else { + #if CYTHON_ASSUME_SAFE_MACROS + PyTuple_SET_ITEM(shape_tuple, i, temp_int); + #else + if (PyTuple_SetItem(shape_tuple, i, temp_int) < 0) { + goto fail; + } + #endif + temp_int = NULL; + } + } + array_obj = __pyx_array_new(shape_tuple, sizeof_dtype, buf->format, mode, NULL); + if (unlikely(!array_obj)) { + goto fail; + } + __Pyx_GOTREF(array_obj); + memview_obj = (struct __pyx_memoryview_obj *) __pyx_memoryview_new( + (PyObject *) array_obj, contig_flag, + dtype_is_object, + from_mvs->memview->typeinfo); + if (unlikely(!memview_obj)) + goto fail; + if (unlikely(__Pyx_init_memviewslice(memview_obj, ndim, &new_mvs, 1) < 0)) + goto fail; + if (unlikely(__pyx_memoryview_copy_contents(*from_mvs, new_mvs, ndim, ndim, + dtype_is_object) < 0)) + goto fail; + goto no_fail; + fail: + __Pyx_XDECREF((PyObject *) new_mvs.memview); + new_mvs.memview = NULL; + new_mvs.data = NULL; + no_fail: + __Pyx_XDECREF(shape_tuple); + __Pyx_XDECREF(temp_int); + __Pyx_XDECREF((PyObject *) array_obj); + __Pyx_RefNannyFinishContext(); + return new_mvs; + } + +/* 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 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; + } + +/* 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 + } + } + +/* CIntToPy */ + static CYTHON_INLINE PyObject* __Pyx_PyLong_From_uint64_t(uint64_t value) { + #ifdef __Pyx_HAS_GCC_DIAGNOSTIC + #pragma GCC diagnostic push + #pragma GCC diagnostic ignored "-Wconversion" + #endif + const uint64_t neg_one = (uint64_t) -1, const_zero = (uint64_t) 0; + #ifdef __Pyx_HAS_GCC_DIAGNOSTIC + #pragma GCC diagnostic pop + #endif + const int is_unsigned = neg_one > const_zero; + if (is_unsigned) { + if (sizeof(uint64_t) < sizeof(long)) { + return PyLong_FromLong((long) value); + } else if (sizeof(uint64_t) <= sizeof(unsigned long)) { + return PyLong_FromUnsignedLong((unsigned long) value); + #if !CYTHON_COMPILING_IN_PYPY + } else if (sizeof(uint64_t) <= sizeof(unsigned PY_LONG_LONG)) { + return PyLong_FromUnsignedLongLong((unsigned PY_LONG_LONG) value); + #endif + } + } else { + if (sizeof(uint64_t) <= sizeof(long)) { + return PyLong_FromLong((long) value); + } else if (sizeof(uint64_t) <= 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(uint64_t), + 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(uint64_t)); + 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 uint64_t __Pyx_PyLong_As_uint64_t(PyObject *x) { + #ifdef __Pyx_HAS_GCC_DIAGNOSTIC + #pragma GCC diagnostic push + #pragma GCC diagnostic ignored "-Wconversion" + #endif + const uint64_t neg_one = (uint64_t) -1, const_zero = (uint64_t) 0; + #ifdef __Pyx_HAS_GCC_DIAGNOSTIC + #pragma GCC diagnostic pop + #endif + const int is_unsigned = neg_one > const_zero; + if (unlikely(!PyLong_Check(x))) { + uint64_t val; + PyObject *tmp = __Pyx_PyNumber_Long(x); + if (!tmp) return (uint64_t) -1; + val = __Pyx_PyLong_As_uint64_t(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(uint64_t, __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(uint64_t) > 1 * PyLong_SHIFT)) { + if ((8 * sizeof(unsigned long) > 2 * PyLong_SHIFT)) { + __PYX_VERIFY_RETURN_INT(uint64_t, unsigned long, (((((unsigned long)digits[1]) << PyLong_SHIFT) | (unsigned long)digits[0]))) + } else if ((8 * sizeof(uint64_t) >= 2 * PyLong_SHIFT)) { + return (uint64_t) (((((uint64_t)digits[1]) << PyLong_SHIFT) | (uint64_t)digits[0])); + } + } + break; + case 3: + if ((8 * sizeof(uint64_t) > 2 * PyLong_SHIFT)) { + if ((8 * sizeof(unsigned long) > 3 * PyLong_SHIFT)) { + __PYX_VERIFY_RETURN_INT(uint64_t, unsigned long, (((((((unsigned long)digits[2]) << PyLong_SHIFT) | (unsigned long)digits[1]) << PyLong_SHIFT) | (unsigned long)digits[0]))) + } else if ((8 * sizeof(uint64_t) >= 3 * PyLong_SHIFT)) { + return (uint64_t) (((((((uint64_t)digits[2]) << PyLong_SHIFT) | (uint64_t)digits[1]) << PyLong_SHIFT) | (uint64_t)digits[0])); + } + } + break; + case 4: + if ((8 * sizeof(uint64_t) > 3 * PyLong_SHIFT)) { + if ((8 * sizeof(unsigned long) > 4 * PyLong_SHIFT)) { + __PYX_VERIFY_RETURN_INT(uint64_t, unsigned long, (((((((((unsigned long)digits[3]) << PyLong_SHIFT) | (unsigned long)digits[2]) << PyLong_SHIFT) | (unsigned long)digits[1]) << PyLong_SHIFT) | (unsigned long)digits[0]))) + } else if ((8 * sizeof(uint64_t) >= 4 * PyLong_SHIFT)) { + return (uint64_t) (((((((((uint64_t)digits[3]) << PyLong_SHIFT) | (uint64_t)digits[2]) << PyLong_SHIFT) | (uint64_t)digits[1]) << PyLong_SHIFT) | (uint64_t)digits[0])); + } + } + break; + } + } + #endif + #if CYTHON_COMPILING_IN_CPYTHON && 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 (uint64_t) -1; + if (unlikely(result == 1)) + goto raise_neg_overflow; + } + #endif + if ((sizeof(uint64_t) <= sizeof(unsigned long))) { + __PYX_VERIFY_RETURN_INT_EXC(uint64_t, unsigned long, PyLong_AsUnsignedLong(x)) + } else if ((sizeof(uint64_t) <= sizeof(unsigned PY_LONG_LONG))) { + __PYX_VERIFY_RETURN_INT_EXC(uint64_t, unsigned PY_LONG_LONG, PyLong_AsUnsignedLongLong(x)) + } + } else { + #if CYTHON_USE_PYLONG_INTERNALS + if (__Pyx_PyLong_IsCompact(x)) { + __PYX_VERIFY_RETURN_INT(uint64_t, __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(uint64_t) - 1 > 1 * PyLong_SHIFT)) { + if ((8 * sizeof(unsigned long) > 2 * PyLong_SHIFT)) { + __PYX_VERIFY_RETURN_INT(uint64_t, long, -(long) (((((unsigned long)digits[1]) << PyLong_SHIFT) | (unsigned long)digits[0]))) + } else if ((8 * sizeof(uint64_t) - 1 > 2 * PyLong_SHIFT)) { + return (uint64_t) (((uint64_t)-1)*(((((uint64_t)digits[1]) << PyLong_SHIFT) | (uint64_t)digits[0]))); + } + } + break; + case 2: + if ((8 * sizeof(uint64_t) > 1 * PyLong_SHIFT)) { + if ((8 * sizeof(unsigned long) > 2 * PyLong_SHIFT)) { + __PYX_VERIFY_RETURN_INT(uint64_t, unsigned long, (((((unsigned long)digits[1]) << PyLong_SHIFT) | (unsigned long)digits[0]))) + } else if ((8 * sizeof(uint64_t) - 1 > 2 * PyLong_SHIFT)) { + return (uint64_t) ((((((uint64_t)digits[1]) << PyLong_SHIFT) | (uint64_t)digits[0]))); + } + } + break; + case -3: + if ((8 * sizeof(uint64_t) - 1 > 2 * PyLong_SHIFT)) { + if ((8 * sizeof(unsigned long) > 3 * PyLong_SHIFT)) { + __PYX_VERIFY_RETURN_INT(uint64_t, long, -(long) (((((((unsigned long)digits[2]) << PyLong_SHIFT) | (unsigned long)digits[1]) << PyLong_SHIFT) | (unsigned long)digits[0]))) + } else if ((8 * sizeof(uint64_t) - 1 > 3 * PyLong_SHIFT)) { + return (uint64_t) (((uint64_t)-1)*(((((((uint64_t)digits[2]) << PyLong_SHIFT) | (uint64_t)digits[1]) << PyLong_SHIFT) | (uint64_t)digits[0]))); + } + } + break; + case 3: + if ((8 * sizeof(uint64_t) > 2 * PyLong_SHIFT)) { + if ((8 * sizeof(unsigned long) > 3 * PyLong_SHIFT)) { + __PYX_VERIFY_RETURN_INT(uint64_t, unsigned long, (((((((unsigned long)digits[2]) << PyLong_SHIFT) | (unsigned long)digits[1]) << PyLong_SHIFT) | (unsigned long)digits[0]))) + } else if ((8 * sizeof(uint64_t) - 1 > 3 * PyLong_SHIFT)) { + return (uint64_t) ((((((((uint64_t)digits[2]) << PyLong_SHIFT) | (uint64_t)digits[1]) << PyLong_SHIFT) | (uint64_t)digits[0]))); + } + } + break; + case -4: + if ((8 * sizeof(uint64_t) - 1 > 3 * PyLong_SHIFT)) { + if ((8 * sizeof(unsigned long) > 4 * PyLong_SHIFT)) { + __PYX_VERIFY_RETURN_INT(uint64_t, long, -(long) (((((((((unsigned long)digits[3]) << PyLong_SHIFT) | (unsigned long)digits[2]) << PyLong_SHIFT) | (unsigned long)digits[1]) << PyLong_SHIFT) | (unsigned long)digits[0]))) + } else if ((8 * sizeof(uint64_t) - 1 > 4 * PyLong_SHIFT)) { + return (uint64_t) (((uint64_t)-1)*(((((((((uint64_t)digits[3]) << PyLong_SHIFT) | (uint64_t)digits[2]) << PyLong_SHIFT) | (uint64_t)digits[1]) << PyLong_SHIFT) | (uint64_t)digits[0]))); + } + } + break; + case 4: + if ((8 * sizeof(uint64_t) > 3 * PyLong_SHIFT)) { + if ((8 * sizeof(unsigned long) > 4 * PyLong_SHIFT)) { + __PYX_VERIFY_RETURN_INT(uint64_t, unsigned long, (((((((((unsigned long)digits[3]) << PyLong_SHIFT) | (unsigned long)digits[2]) << PyLong_SHIFT) | (unsigned long)digits[1]) << PyLong_SHIFT) | (unsigned long)digits[0]))) + } else if ((8 * sizeof(uint64_t) - 1 > 4 * PyLong_SHIFT)) { + return (uint64_t) ((((((((((uint64_t)digits[3]) << PyLong_SHIFT) | (uint64_t)digits[2]) << PyLong_SHIFT) | (uint64_t)digits[1]) << PyLong_SHIFT) | (uint64_t)digits[0]))); + } + } + break; + } + } + #endif + if ((sizeof(uint64_t) <= sizeof(long))) { + __PYX_VERIFY_RETURN_INT_EXC(uint64_t, long, PyLong_AsLong(x)) + } else if ((sizeof(uint64_t) <= sizeof(PY_LONG_LONG))) { + __PYX_VERIFY_RETURN_INT_EXC(uint64_t, PY_LONG_LONG, PyLong_AsLongLong(x)) + } + } + { + uint64_t 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 (uint64_t) -1; + assert(PyLong_CheckExact(v)); + } + { + int result = PyObject_RichCompareBool(v, Py_False, Py_LT); + if (unlikely(result < 0)) { + Py_DECREF(v); + return (uint64_t) -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 (uint64_t) -1; + } else { + stepval = v; + } + v = NULL; + val = (uint64_t) 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(uint64_t) * 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 |= ((uint64_t) 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(uint64_t) * 8) - bits - (is_unsigned ? 0 : 1); + if (unlikely(idigit >= (1L << remaining_bits))) + goto raise_overflow; + val |= ((uint64_t) idigit) << bits; + } + if (!is_unsigned) { + if (unlikely(val & (((uint64_t) 1) << (sizeof(uint64_t) * 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 (uint64_t) -1; + return val; + } + raise_overflow: + PyErr_SetString(PyExc_OverflowError, + "value too large to convert to uint64_t"); + return (uint64_t) -1; + raise_neg_overflow: + PyErr_SetString(PyExc_OverflowError, + "can't convert negative value to uint64_t"); + return (uint64_t) -1; + } + +/* 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 size_t __Pyx_PyLong_As_size_t(PyObject *x) { + #ifdef __Pyx_HAS_GCC_DIAGNOSTIC + #pragma GCC diagnostic push + #pragma GCC diagnostic ignored "-Wconversion" + #endif + const size_t neg_one = (size_t) -1, const_zero = (size_t) 0; + #ifdef __Pyx_HAS_GCC_DIAGNOSTIC + #pragma GCC diagnostic pop + #endif + const int is_unsigned = neg_one > const_zero; + if (unlikely(!PyLong_Check(x))) { + size_t val; + PyObject *tmp = __Pyx_PyNumber_Long(x); + if (!tmp) return (size_t) -1; + val = __Pyx_PyLong_As_size_t(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(size_t, __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(size_t) > 1 * PyLong_SHIFT)) { + if ((8 * sizeof(unsigned long) > 2 * PyLong_SHIFT)) { + __PYX_VERIFY_RETURN_INT(size_t, unsigned long, (((((unsigned long)digits[1]) << PyLong_SHIFT) | (unsigned long)digits[0]))) + } else if ((8 * sizeof(size_t) >= 2 * PyLong_SHIFT)) { + return (size_t) (((((size_t)digits[1]) << PyLong_SHIFT) | (size_t)digits[0])); + } + } + break; + case 3: + if ((8 * sizeof(size_t) > 2 * PyLong_SHIFT)) { + if ((8 * sizeof(unsigned long) > 3 * PyLong_SHIFT)) { + __PYX_VERIFY_RETURN_INT(size_t, unsigned long, (((((((unsigned long)digits[2]) << PyLong_SHIFT) | (unsigned long)digits[1]) << PyLong_SHIFT) | (unsigned long)digits[0]))) + } else if ((8 * sizeof(size_t) >= 3 * PyLong_SHIFT)) { + return (size_t) (((((((size_t)digits[2]) << PyLong_SHIFT) | (size_t)digits[1]) << PyLong_SHIFT) | (size_t)digits[0])); + } + } + break; + case 4: + if ((8 * sizeof(size_t) > 3 * PyLong_SHIFT)) { + if ((8 * sizeof(unsigned long) > 4 * PyLong_SHIFT)) { + __PYX_VERIFY_RETURN_INT(size_t, unsigned long, (((((((((unsigned long)digits[3]) << PyLong_SHIFT) | (unsigned long)digits[2]) << PyLong_SHIFT) | (unsigned long)digits[1]) << PyLong_SHIFT) | (unsigned long)digits[0]))) + } else if ((8 * sizeof(size_t) >= 4 * PyLong_SHIFT)) { + return (size_t) (((((((((size_t)digits[3]) << PyLong_SHIFT) | (size_t)digits[2]) << PyLong_SHIFT) | (size_t)digits[1]) << PyLong_SHIFT) | (size_t)digits[0])); + } + } + break; + } + } + #endif + #if CYTHON_COMPILING_IN_CPYTHON && 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 (size_t) -1; + if (unlikely(result == 1)) + goto raise_neg_overflow; + } + #endif + if ((sizeof(size_t) <= sizeof(unsigned long))) { + __PYX_VERIFY_RETURN_INT_EXC(size_t, unsigned long, PyLong_AsUnsignedLong(x)) + } else if ((sizeof(size_t) <= sizeof(unsigned PY_LONG_LONG))) { + __PYX_VERIFY_RETURN_INT_EXC(size_t, unsigned PY_LONG_LONG, PyLong_AsUnsignedLongLong(x)) + } + } else { + #if CYTHON_USE_PYLONG_INTERNALS + if (__Pyx_PyLong_IsCompact(x)) { + __PYX_VERIFY_RETURN_INT(size_t, __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(size_t) - 1 > 1 * PyLong_SHIFT)) { + if ((8 * sizeof(unsigned long) > 2 * PyLong_SHIFT)) { + __PYX_VERIFY_RETURN_INT(size_t, long, -(long) (((((unsigned long)digits[1]) << PyLong_SHIFT) | (unsigned long)digits[0]))) + } else if ((8 * sizeof(size_t) - 1 > 2 * PyLong_SHIFT)) { + return (size_t) (((size_t)-1)*(((((size_t)digits[1]) << PyLong_SHIFT) | (size_t)digits[0]))); + } + } + break; + case 2: + if ((8 * sizeof(size_t) > 1 * PyLong_SHIFT)) { + if ((8 * sizeof(unsigned long) > 2 * PyLong_SHIFT)) { + __PYX_VERIFY_RETURN_INT(size_t, unsigned long, (((((unsigned long)digits[1]) << PyLong_SHIFT) | (unsigned long)digits[0]))) + } else if ((8 * sizeof(size_t) - 1 > 2 * PyLong_SHIFT)) { + return (size_t) ((((((size_t)digits[1]) << PyLong_SHIFT) | (size_t)digits[0]))); + } + } + break; + case -3: + if ((8 * sizeof(size_t) - 1 > 2 * PyLong_SHIFT)) { + if ((8 * sizeof(unsigned long) > 3 * PyLong_SHIFT)) { + __PYX_VERIFY_RETURN_INT(size_t, long, -(long) (((((((unsigned long)digits[2]) << PyLong_SHIFT) | (unsigned long)digits[1]) << PyLong_SHIFT) | (unsigned long)digits[0]))) + } else if ((8 * sizeof(size_t) - 1 > 3 * PyLong_SHIFT)) { + return (size_t) (((size_t)-1)*(((((((size_t)digits[2]) << PyLong_SHIFT) | (size_t)digits[1]) << PyLong_SHIFT) | (size_t)digits[0]))); + } + } + break; + case 3: + if ((8 * sizeof(size_t) > 2 * PyLong_SHIFT)) { + if ((8 * sizeof(unsigned long) > 3 * PyLong_SHIFT)) { + __PYX_VERIFY_RETURN_INT(size_t, unsigned long, (((((((unsigned long)digits[2]) << PyLong_SHIFT) | (unsigned long)digits[1]) << PyLong_SHIFT) | (unsigned long)digits[0]))) + } else if ((8 * sizeof(size_t) - 1 > 3 * PyLong_SHIFT)) { + return (size_t) ((((((((size_t)digits[2]) << PyLong_SHIFT) | (size_t)digits[1]) << PyLong_SHIFT) | (size_t)digits[0]))); + } + } + break; + case -4: + if ((8 * sizeof(size_t) - 1 > 3 * PyLong_SHIFT)) { + if ((8 * sizeof(unsigned long) > 4 * PyLong_SHIFT)) { + __PYX_VERIFY_RETURN_INT(size_t, long, -(long) (((((((((unsigned long)digits[3]) << PyLong_SHIFT) | (unsigned long)digits[2]) << PyLong_SHIFT) | (unsigned long)digits[1]) << PyLong_SHIFT) | (unsigned long)digits[0]))) + } else if ((8 * sizeof(size_t) - 1 > 4 * PyLong_SHIFT)) { + return (size_t) (((size_t)-1)*(((((((((size_t)digits[3]) << PyLong_SHIFT) | (size_t)digits[2]) << PyLong_SHIFT) | (size_t)digits[1]) << PyLong_SHIFT) | (size_t)digits[0]))); + } + } + break; + case 4: + if ((8 * sizeof(size_t) > 3 * PyLong_SHIFT)) { + if ((8 * sizeof(unsigned long) > 4 * PyLong_SHIFT)) { + __PYX_VERIFY_RETURN_INT(size_t, unsigned long, (((((((((unsigned long)digits[3]) << PyLong_SHIFT) | (unsigned long)digits[2]) << PyLong_SHIFT) | (unsigned long)digits[1]) << PyLong_SHIFT) | (unsigned long)digits[0]))) + } else if ((8 * sizeof(size_t) - 1 > 4 * PyLong_SHIFT)) { + return (size_t) ((((((((((size_t)digits[3]) << PyLong_SHIFT) | (size_t)digits[2]) << PyLong_SHIFT) | (size_t)digits[1]) << PyLong_SHIFT) | (size_t)digits[0]))); + } + } + break; + } + } + #endif + if ((sizeof(size_t) <= sizeof(long))) { + __PYX_VERIFY_RETURN_INT_EXC(size_t, long, PyLong_AsLong(x)) + } else if ((sizeof(size_t) <= sizeof(PY_LONG_LONG))) { + __PYX_VERIFY_RETURN_INT_EXC(size_t, PY_LONG_LONG, PyLong_AsLongLong(x)) + } + } + { + size_t 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 (size_t) -1; + assert(PyLong_CheckExact(v)); + } + { + int result = PyObject_RichCompareBool(v, Py_False, Py_LT); + if (unlikely(result < 0)) { + Py_DECREF(v); + return (size_t) -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 (size_t) -1; + } else { + stepval = v; + } + v = NULL; + val = (size_t) 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(size_t) * 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 |= ((size_t) 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(size_t) * 8) - bits - (is_unsigned ? 0 : 1); + if (unlikely(idigit >= (1L << remaining_bits))) + goto raise_overflow; + val |= ((size_t) idigit) << bits; + } + if (!is_unsigned) { + if (unlikely(val & (((size_t) 1) << (sizeof(size_t) * 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 (size_t) -1; + return val; + } + raise_overflow: + PyErr_SetString(PyExc_OverflowError, + "value too large to convert to size_t"); + return (size_t) -1; + raise_neg_overflow: + PyErr_SetString(PyExc_OverflowError, + "can't convert negative value to size_t"); + return (size_t) -1; + } + +/* UpdateUnpickledDict */ + static int __Pyx__UpdateUnpickledDict(PyObject *obj, PyObject *state, Py_ssize_t index) { + PyObject *state_dict = __Pyx_PySequence_ITEM(state, index); + if (unlikely(!state_dict)) { + return -1; + } + int non_empty = PyObject_IsTrue(state_dict); + if (non_empty == 0) { + Py_DECREF(state_dict); + return 0; + } else if (unlikely(non_empty == -1)) { + return -1; + } + PyObject *dict; + #if CYTHON_COMPILING_IN_LIMITED_API && __PYX_LIMITED_VERSION_HEX < 0x030A0000 + dict = PyObject_GetAttrString(obj, "__dict__"); + #else + dict = PyObject_GenericGetDict(obj, NULL); + #endif + if (unlikely(!dict)) { + Py_DECREF(state_dict); + return -1; + } + int result; + if (likely(PyDict_CheckExact(dict))) { + result = PyDict_Update(dict, state_dict); + } else { + PyObject *obj_result = __Pyx_PyObject_CallMethod1(dict, __pyx_mstate_global->__pyx_n_u_update, state_dict); + if (likely(obj_result)) { + Py_DECREF(obj_result); + result = 0; + } else { + result = -1; + } + } + Py_DECREF(state_dict); + Py_DECREF(dict); + return result; + } + static int __Pyx_UpdateUnpickledDict(PyObject *obj, PyObject *state, Py_ssize_t index) { + Py_ssize_t state_size = __Pyx_PyTuple_GET_SIZE(state); + #if !CYTHON_ASSUME_SAFE_SIZE + if (unlikely(state_size == -1)) return -1; + #endif + if (state_size <= index) { + return 0; + } + return __Pyx__UpdateUnpickledDict(obj, state, index); + } + +/* CIntFromPy */ + static CYTHON_INLINE char __Pyx_PyLong_As_char(PyObject *x) { + #ifdef __Pyx_HAS_GCC_DIAGNOSTIC + #pragma GCC diagnostic push + #pragma GCC diagnostic ignored "-Wconversion" + #endif + const char neg_one = (char) -1, const_zero = (char) 0; + #ifdef __Pyx_HAS_GCC_DIAGNOSTIC + #pragma GCC diagnostic pop + #endif + const int is_unsigned = neg_one > const_zero; + if (unlikely(!PyLong_Check(x))) { + char val; + PyObject *tmp = __Pyx_PyNumber_Long(x); + if (!tmp) return (char) -1; + val = __Pyx_PyLong_As_char(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(char, __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(char) > 1 * PyLong_SHIFT)) { + if ((8 * sizeof(unsigned long) > 2 * PyLong_SHIFT)) { + __PYX_VERIFY_RETURN_INT(char, unsigned long, (((((unsigned long)digits[1]) << PyLong_SHIFT) | (unsigned long)digits[0]))) + } else if ((8 * sizeof(char) >= 2 * PyLong_SHIFT)) { + return (char) (((((char)digits[1]) << PyLong_SHIFT) | (char)digits[0])); + } + } + break; + case 3: + if ((8 * sizeof(char) > 2 * PyLong_SHIFT)) { + if ((8 * sizeof(unsigned long) > 3 * PyLong_SHIFT)) { + __PYX_VERIFY_RETURN_INT(char, unsigned long, (((((((unsigned long)digits[2]) << PyLong_SHIFT) | (unsigned long)digits[1]) << PyLong_SHIFT) | (unsigned long)digits[0]))) + } else if ((8 * sizeof(char) >= 3 * PyLong_SHIFT)) { + return (char) (((((((char)digits[2]) << PyLong_SHIFT) | (char)digits[1]) << PyLong_SHIFT) | (char)digits[0])); + } + } + break; + case 4: + if ((8 * sizeof(char) > 3 * PyLong_SHIFT)) { + if ((8 * sizeof(unsigned long) > 4 * PyLong_SHIFT)) { + __PYX_VERIFY_RETURN_INT(char, 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(char) >= 4 * PyLong_SHIFT)) { + return (char) (((((((((char)digits[3]) << PyLong_SHIFT) | (char)digits[2]) << PyLong_SHIFT) | (char)digits[1]) << PyLong_SHIFT) | (char)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 (char) -1; + if (unlikely(result == 1)) + goto raise_neg_overflow; + } + #endif + if ((sizeof(char) <= sizeof(unsigned long))) { + __PYX_VERIFY_RETURN_INT_EXC(char, unsigned long, PyLong_AsUnsignedLong(x)) + } else if ((sizeof(char) <= sizeof(unsigned PY_LONG_LONG))) { + __PYX_VERIFY_RETURN_INT_EXC(char, unsigned PY_LONG_LONG, PyLong_AsUnsignedLongLong(x)) + } + } else { + #if CYTHON_USE_PYLONG_INTERNALS + if (__Pyx_PyLong_IsCompact(x)) { + __PYX_VERIFY_RETURN_INT(char, __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(char) - 1 > 1 * PyLong_SHIFT)) { + if ((8 * sizeof(unsigned long) > 2 * PyLong_SHIFT)) { + __PYX_VERIFY_RETURN_INT(char, long, -(long) (((((unsigned long)digits[1]) << PyLong_SHIFT) | (unsigned long)digits[0]))) + } else if ((8 * sizeof(char) - 1 > 2 * PyLong_SHIFT)) { + return (char) (((char)-1)*(((((char)digits[1]) << PyLong_SHIFT) | (char)digits[0]))); + } + } + break; + case 2: + if ((8 * sizeof(char) > 1 * PyLong_SHIFT)) { + if ((8 * sizeof(unsigned long) > 2 * PyLong_SHIFT)) { + __PYX_VERIFY_RETURN_INT(char, unsigned long, (((((unsigned long)digits[1]) << PyLong_SHIFT) | (unsigned long)digits[0]))) + } else if ((8 * sizeof(char) - 1 > 2 * PyLong_SHIFT)) { + return (char) ((((((char)digits[1]) << PyLong_SHIFT) | (char)digits[0]))); + } + } + break; + case -3: + if ((8 * sizeof(char) - 1 > 2 * PyLong_SHIFT)) { + if ((8 * sizeof(unsigned long) > 3 * PyLong_SHIFT)) { + __PYX_VERIFY_RETURN_INT(char, long, -(long) (((((((unsigned long)digits[2]) << PyLong_SHIFT) | (unsigned long)digits[1]) << PyLong_SHIFT) | (unsigned long)digits[0]))) + } else if ((8 * sizeof(char) - 1 > 3 * PyLong_SHIFT)) { + return (char) (((char)-1)*(((((((char)digits[2]) << PyLong_SHIFT) | (char)digits[1]) << PyLong_SHIFT) | (char)digits[0]))); + } + } + break; + case 3: + if ((8 * sizeof(char) > 2 * PyLong_SHIFT)) { + if ((8 * sizeof(unsigned long) > 3 * PyLong_SHIFT)) { + __PYX_VERIFY_RETURN_INT(char, unsigned long, (((((((unsigned long)digits[2]) << PyLong_SHIFT) | (unsigned long)digits[1]) << PyLong_SHIFT) | (unsigned long)digits[0]))) + } else if ((8 * sizeof(char) - 1 > 3 * PyLong_SHIFT)) { + return (char) ((((((((char)digits[2]) << PyLong_SHIFT) | (char)digits[1]) << PyLong_SHIFT) | (char)digits[0]))); + } + } + break; + case -4: + if ((8 * sizeof(char) - 1 > 3 * PyLong_SHIFT)) { + if ((8 * sizeof(unsigned long) > 4 * PyLong_SHIFT)) { + __PYX_VERIFY_RETURN_INT(char, 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(char) - 1 > 4 * PyLong_SHIFT)) { + return (char) (((char)-1)*(((((((((char)digits[3]) << PyLong_SHIFT) | (char)digits[2]) << PyLong_SHIFT) | (char)digits[1]) << PyLong_SHIFT) | (char)digits[0]))); + } + } + break; + case 4: + if ((8 * sizeof(char) > 3 * PyLong_SHIFT)) { + if ((8 * sizeof(unsigned long) > 4 * PyLong_SHIFT)) { + __PYX_VERIFY_RETURN_INT(char, 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(char) - 1 > 4 * PyLong_SHIFT)) { + return (char) ((((((((((char)digits[3]) << PyLong_SHIFT) | (char)digits[2]) << PyLong_SHIFT) | (char)digits[1]) << PyLong_SHIFT) | (char)digits[0]))); + } + } + break; + } + } + #endif + if ((sizeof(char) <= sizeof(long))) { + __PYX_VERIFY_RETURN_INT_EXC(char, long, PyLong_AsLong(x)) + } else if ((sizeof(char) <= sizeof(PY_LONG_LONG))) { + __PYX_VERIFY_RETURN_INT_EXC(char, PY_LONG_LONG, PyLong_AsLongLong(x)) + } + } + { + char 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 (char) -1; + assert(PyLong_CheckExact(v)); + } + { + int result = PyObject_RichCompareBool(v, Py_False, Py_LT); + if (unlikely(result < 0)) { + Py_DECREF(v); + return (char) -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 (char) -1; + } else { + stepval = v; + } + v = NULL; + val = (char) 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(char) * 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 |= ((char) 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(char) * 8) - bits - (is_unsigned ? 0 : 1); + if (unlikely(idigit >= (1L << remaining_bits))) + goto raise_overflow; + val |= ((char) idigit) << bits; + } + if (!is_unsigned) { + if (unlikely(val & (((char) 1) << (sizeof(char) * 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 (char) -1; + return val; + } + raise_overflow: + PyErr_SetString(PyExc_OverflowError, + "value too large to convert to char"); + return (char) -1; + raise_neg_overflow: + PyErr_SetString(PyExc_OverflowError, + "can't convert negative value to char"); + return (char) -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__6); + } + goto done; + } + #endif + +/* GetRuntimeVersion */ + #if __PYX_LIMITED_VERSION_HEX < 0x030b0000 + void __Pyx_init_runtime_version(void) { + if (__Pyx_cached_runtime_version == 0) { + const char* rt_version = Py_GetVersion(); + unsigned long version = 0; + unsigned long factor = 0x01000000UL; + unsigned int digit = 0; + int i = 0; + while (factor) { + while ('0' <= rt_version[i] && rt_version[i] <= '9') { + digit = digit * 10 + (unsigned int) (rt_version[i] - '0'); + ++i; + } + version += factor * digit; + if (rt_version[i] != '.') + break; + digit = 0; + factor >>= 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 + } + +/* IterNextPlain (used by CoroutineBase) */ + #if CYTHON_COMPILING_IN_LIMITED_API && __PYX_LIMITED_VERSION_HEX < 0x030A0000 + static PyObject *__Pyx_GetBuiltinNext_LimitedAPI(void) { + if (unlikely(!__pyx_mstate_global->__Pyx_GetBuiltinNext_LimitedAPI_cache)) + __pyx_mstate_global->__Pyx_GetBuiltinNext_LimitedAPI_cache = __Pyx_GetBuiltinName(__pyx_mstate_global->__pyx_n_u_next); + return __pyx_mstate_global->__Pyx_GetBuiltinNext_LimitedAPI_cache; + } + #endif + static CYTHON_INLINE PyObject *__Pyx_PyIter_Next_Plain(PyObject *iterator) { + #if CYTHON_COMPILING_IN_LIMITED_API && __PYX_LIMITED_VERSION_HEX < 0x030A0000 + PyObject *result; + PyObject *next = __Pyx_GetBuiltinNext_LimitedAPI(); + if (unlikely(!next)) return NULL; + result = PyObject_CallFunctionObjArgs(next, iterator, NULL); + return result; + #else + (void)__Pyx_GetBuiltinName; // only for early limited API + iternextfunc iternext = __Pyx_PyObject_GetIterNextFunc(iterator); + assert(iternext); + return iternext(iterator); + #endif + } + +/* ReturnWithStopIteration (used by CoroutineBase) */ + static void __Pyx__ReturnWithStopIteration(PyObject* value, int async); + static CYTHON_INLINE void __Pyx_ReturnWithStopIteration(PyObject* value, int async, int iternext) { + if (value == Py_None) { + if (async || !iternext) + PyErr_SetNone(async ? PyExc_StopAsyncIteration : PyExc_StopIteration); + return; + } + __Pyx__ReturnWithStopIteration(value, async); + } + static void __Pyx__ReturnWithStopIteration(PyObject* value, int async) { + #if CYTHON_COMPILING_IN_CPYTHON + __Pyx_PyThreadState_declare + #endif + PyObject *exc; + PyObject *exc_type = async ? PyExc_StopAsyncIteration : PyExc_StopIteration; + #if CYTHON_COMPILING_IN_CPYTHON + if ((PY_VERSION_HEX >= (0x030C00A6)) || unlikely(PyTuple_Check(value) || PyExceptionInstance_Check(value))) { + if (PY_VERSION_HEX >= (0x030e00A1)) { + exc = __Pyx_PyObject_CallOneArg(exc_type, value); + } else { + PyObject *args_tuple = PyTuple_New(1); + if (unlikely(!args_tuple)) return; + Py_INCREF(value); + PyTuple_SET_ITEM(args_tuple, 0, value); + exc = PyObject_Call(exc_type, args_tuple, NULL); + Py_DECREF(args_tuple); + } + if (unlikely(!exc)) return; + } else { + Py_INCREF(value); + exc = value; + } + #if CYTHON_FAST_THREAD_STATE + __Pyx_PyThreadState_assign + #if CYTHON_USE_EXC_INFO_STACK + if (!__pyx_tstate->exc_info->exc_value) + #else + if (!__pyx_tstate->exc_type) + #endif + { + Py_INCREF(exc_type); + __Pyx_ErrRestore(exc_type, exc, NULL); + return; + } + #endif + #else + exc = __Pyx_PyObject_CallOneArg(exc_type, value); + if (unlikely(!exc)) return; + #endif + PyErr_SetObject(exc_type, exc); + Py_DECREF(exc); + } + +/* CoroutineBase (used by Generator) */ + #if !CYTHON_COMPILING_IN_LIMITED_API + #include + #if PY_VERSION_HEX >= 0x030b00a6 && !defined(PYPY_VERSION) + #ifndef Py_BUILD_CORE + #define Py_BUILD_CORE 1 + #endif + #include "internal/pycore_frame.h" + #endif + #endif // CYTHON_COMPILING_IN_LIMITED_API + static CYTHON_INLINE void + __Pyx_Coroutine_Undelegate(__pyx_CoroutineObject *gen) { + #if CYTHON_USE_AM_SEND + gen->yieldfrom_am_send = NULL; + #endif + Py_CLEAR(gen->yieldfrom); + } + static int __Pyx_PyGen__FetchStopIterationValue(PyThreadState *__pyx_tstate, PyObject **pvalue) { + PyObject *et, *ev, *tb; + PyObject *value = NULL; + CYTHON_UNUSED_VAR(__pyx_tstate); + __Pyx_ErrFetch(&et, &ev, &tb); + if (!et) { + Py_XDECREF(tb); + Py_XDECREF(ev); + Py_INCREF(Py_None); + *pvalue = Py_None; + return 0; + } + if (likely(et == PyExc_StopIteration)) { + if (!ev) { + Py_INCREF(Py_None); + value = Py_None; + } + else if (likely(__Pyx_IS_TYPE(ev, (PyTypeObject*)PyExc_StopIteration))) { + #if CYTHON_COMPILING_IN_LIMITED_API || CYTHON_COMPILING_IN_GRAAL + value = PyObject_GetAttr(ev, __pyx_mstate_global->__pyx_n_u_value); + if (unlikely(!value)) goto limited_api_failure; + #else + value = ((PyStopIterationObject *)ev)->value; + Py_INCREF(value); + #endif + Py_DECREF(ev); + } + else if (unlikely(PyTuple_Check(ev))) { + Py_ssize_t tuple_size = __Pyx_PyTuple_GET_SIZE(ev); + #if !CYTHON_ASSUME_SAFE_SIZE + if (unlikely(tuple_size < 0)) { + Py_XDECREF(tb); + Py_DECREF(ev); + Py_DECREF(et); + return -1; + } + #endif + if (tuple_size >= 1) { + #if CYTHON_ASSUME_SAFE_MACROS && !CYTHON_AVOID_BORROWED_REFS + value = PyTuple_GET_ITEM(ev, 0); + Py_INCREF(value); + #elif CYTHON_ASSUME_SAFE_MACROS + value = PySequence_ITEM(ev, 0); + #else + value = PySequence_GetItem(ev, 0); + if (!value) goto limited_api_failure; + #endif + } else { + Py_INCREF(Py_None); + value = Py_None; + } + Py_DECREF(ev); + } + else if (!__Pyx_TypeCheck(ev, (PyTypeObject*)PyExc_StopIteration)) { + value = ev; + } + if (likely(value)) { + Py_XDECREF(tb); + Py_DECREF(et); + *pvalue = value; + return 0; + } + } else if (!__Pyx_PyErr_GivenExceptionMatches(et, PyExc_StopIteration)) { + __Pyx_ErrRestore(et, ev, tb); + return -1; + } + PyErr_NormalizeException(&et, &ev, &tb); + if (unlikely(!PyObject_TypeCheck(ev, (PyTypeObject*)PyExc_StopIteration))) { + __Pyx_ErrRestore(et, ev, tb); + return -1; + } + Py_XDECREF(tb); + Py_DECREF(et); + #if CYTHON_COMPILING_IN_LIMITED_API + value = PyObject_GetAttr(ev, __pyx_mstate_global->__pyx_n_u_value); + #else + value = ((PyStopIterationObject *)ev)->value; + Py_INCREF(value); + #endif + Py_DECREF(ev); + #if CYTHON_COMPILING_IN_LIMITED_API + if (unlikely(!value)) return -1; + #endif + *pvalue = value; + return 0; + #if CYTHON_COMPILING_IN_LIMITED_API || CYTHON_COMPILING_IN_GRAAL || !CYTHON_ASSUME_SAFE_MACROS + limited_api_failure: + Py_XDECREF(et); + Py_XDECREF(tb); + Py_XDECREF(ev); + return -1; + #endif + } + static CYTHON_INLINE + __Pyx_PySendResult __Pyx_Coroutine_status_from_result(PyObject **retval) { + if (*retval) { + return PYGEN_NEXT; + } else if (likely(__Pyx_PyGen__FetchStopIterationValue(__Pyx_PyThreadState_Current, retval) == 0)) { + return PYGEN_RETURN; + } else { + return PYGEN_ERROR; + } + } + static CYTHON_INLINE + void __Pyx_Coroutine_ExceptionClear(__Pyx_ExcInfoStruct *exc_state) { + #if PY_VERSION_HEX >= 0x030B00a4 + Py_CLEAR(exc_state->exc_value); + #else + PyObject *t, *v, *tb; + t = exc_state->exc_type; + v = exc_state->exc_value; + tb = exc_state->exc_traceback; + exc_state->exc_type = NULL; + exc_state->exc_value = NULL; + exc_state->exc_traceback = NULL; + Py_XDECREF(t); + Py_XDECREF(v); + Py_XDECREF(tb); + #endif + } + #define __Pyx_Coroutine_AlreadyRunningError(gen) (__Pyx__Coroutine_AlreadyRunningError(gen), (PyObject*)NULL) + static void __Pyx__Coroutine_AlreadyRunningError(__pyx_CoroutineObject *gen) { + const char *msg; + CYTHON_MAYBE_UNUSED_VAR(gen); + if ((0)) { + #ifdef __Pyx_Coroutine_USED + } else if (__Pyx_Coroutine_Check((PyObject*)gen)) { + msg = "coroutine already executing"; + #endif + #ifdef __Pyx_AsyncGen_USED + } else if (__Pyx_AsyncGen_CheckExact((PyObject*)gen)) { + msg = "async generator already executing"; + #endif + } else { + msg = "generator already executing"; + } + PyErr_SetString(PyExc_ValueError, msg); + } + static void __Pyx_Coroutine_AlreadyTerminatedError(PyObject *gen, PyObject *value, int closing) { + CYTHON_MAYBE_UNUSED_VAR(gen); + CYTHON_MAYBE_UNUSED_VAR(closing); + #ifdef __Pyx_Coroutine_USED + if (!closing && __Pyx_Coroutine_Check(gen)) { + PyErr_SetString(PyExc_RuntimeError, "cannot reuse already awaited coroutine"); + } else + #endif + if (value) { + #ifdef __Pyx_AsyncGen_USED + if (__Pyx_AsyncGen_CheckExact(gen)) + PyErr_SetNone(PyExc_StopAsyncIteration); + else + #endif + PyErr_SetNone(PyExc_StopIteration); + } + } + static + __Pyx_PySendResult __Pyx_Coroutine_SendEx(__pyx_CoroutineObject *self, PyObject *value, PyObject **result, int closing) { + __Pyx_PyThreadState_declare + PyThreadState *tstate; + __Pyx_ExcInfoStruct *exc_state; + PyObject *retval; + assert(__Pyx_Coroutine_get_is_running(self)); // Callers should ensure is_running + if (unlikely(self->resume_label == -1)) { + __Pyx_Coroutine_AlreadyTerminatedError((PyObject*)self, value, closing); + return PYGEN_ERROR; + } + #if CYTHON_FAST_THREAD_STATE + __Pyx_PyThreadState_assign + tstate = __pyx_tstate; + #else + tstate = __Pyx_PyThreadState_Current; + #endif + exc_state = &self->gi_exc_state; + if (exc_state->exc_value) { + #if CYTHON_COMPILING_IN_LIMITED_API || CYTHON_COMPILING_IN_PYPY + #else + PyObject *exc_tb; + #if PY_VERSION_HEX >= 0x030B00a4 && !CYTHON_COMPILING_IN_CPYTHON + exc_tb = PyException_GetTraceback(exc_state->exc_value); + #elif PY_VERSION_HEX >= 0x030B00a4 + exc_tb = ((PyBaseExceptionObject*) exc_state->exc_value)->traceback; + #else + exc_tb = exc_state->exc_traceback; + #endif + if (exc_tb) { + PyTracebackObject *tb = (PyTracebackObject *) exc_tb; + PyFrameObject *f = tb->tb_frame; + assert(f->f_back == NULL); + #if PY_VERSION_HEX >= 0x030B00A1 + f->f_back = PyThreadState_GetFrame(tstate); + #else + Py_XINCREF(tstate->frame); + f->f_back = tstate->frame; + #endif + #if PY_VERSION_HEX >= 0x030B00a4 && !CYTHON_COMPILING_IN_CPYTHON + Py_DECREF(exc_tb); + #endif + } + #endif + } + #if CYTHON_USE_EXC_INFO_STACK + exc_state->previous_item = tstate->exc_info; + tstate->exc_info = exc_state; + #else + if (exc_state->exc_type) { + __Pyx_ExceptionSwap(&exc_state->exc_type, &exc_state->exc_value, &exc_state->exc_traceback); + } else { + __Pyx_Coroutine_ExceptionClear(exc_state); + __Pyx_ExceptionSave(&exc_state->exc_type, &exc_state->exc_value, &exc_state->exc_traceback); + } + #endif + retval = self->body(self, tstate, value); + #if CYTHON_USE_EXC_INFO_STACK + exc_state = &self->gi_exc_state; + tstate->exc_info = exc_state->previous_item; + exc_state->previous_item = NULL; + __Pyx_Coroutine_ResetFrameBackpointer(exc_state); + #endif + *result = retval; + if (self->resume_label == -1) { + return likely(retval) ? PYGEN_RETURN : PYGEN_ERROR; + } + return PYGEN_NEXT; + } + static CYTHON_INLINE void __Pyx_Coroutine_ResetFrameBackpointer(__Pyx_ExcInfoStruct *exc_state) { + #if CYTHON_COMPILING_IN_PYPY || CYTHON_COMPILING_IN_LIMITED_API + CYTHON_UNUSED_VAR(exc_state); + #else + PyObject *exc_tb; + #if PY_VERSION_HEX >= 0x030B00a4 + if (!exc_state->exc_value) return; + exc_tb = PyException_GetTraceback(exc_state->exc_value); + #else + exc_tb = exc_state->exc_traceback; + #endif + if (likely(exc_tb)) { + PyTracebackObject *tb = (PyTracebackObject *) exc_tb; + PyFrameObject *f = tb->tb_frame; + Py_CLEAR(f->f_back); + #if PY_VERSION_HEX >= 0x030B00a4 + Py_DECREF(exc_tb); + #endif + } + #endif + } + #define __Pyx_Coroutine_MethodReturnFromResult(gen, result, retval, iternext)\ + ((result) == PYGEN_NEXT ? (retval) : __Pyx__Coroutine_MethodReturnFromResult(gen, result, retval, iternext)) + static PyObject * + __Pyx__Coroutine_MethodReturnFromResult(PyObject* gen, __Pyx_PySendResult result, PyObject *retval, int iternext) { + CYTHON_MAYBE_UNUSED_VAR(gen); + if (likely(result == PYGEN_RETURN)) { + int is_async = 0; + #ifdef __Pyx_AsyncGen_USED + is_async = __Pyx_AsyncGen_CheckExact(gen); + #endif + __Pyx_ReturnWithStopIteration(retval, is_async, iternext); + Py_XDECREF(retval); + } + return NULL; + } + #if CYTHON_COMPILING_IN_CPYTHON + static CYTHON_INLINE + PyObject *__Pyx_PyGen_Send(PyGenObject *gen, PyObject *arg) { + #if PY_VERSION_HEX <= 0x030A00A1 + return _PyGen_Send(gen, arg); + #else + PyObject *result; + if (PyIter_Send((PyObject*)gen, arg ? arg : Py_None, &result) == PYGEN_RETURN) { + if (PyAsyncGen_CheckExact(gen)) { + assert(result == Py_None); + PyErr_SetNone(PyExc_StopAsyncIteration); + } + else if (result == Py_None) { + PyErr_SetNone(PyExc_StopIteration); + } + else { + #if PY_VERSION_HEX < 0x030d00A1 + _PyGen_SetStopIterationValue(result); + #else + if (!PyTuple_Check(result) && !PyExceptionInstance_Check(result)) { + PyErr_SetObject(PyExc_StopIteration, result); + } else { + PyObject *exc = __Pyx_PyObject_CallOneArg(PyExc_StopIteration, result); + if (likely(exc != NULL)) { + PyErr_SetObject(PyExc_StopIteration, exc); + Py_DECREF(exc); + } + } + #endif + } + Py_DECREF(result); + result = NULL; + } + return result; + #endif + } + #endif + static CYTHON_INLINE __Pyx_PySendResult + __Pyx_Coroutine_FinishDelegation(__pyx_CoroutineObject *gen, PyObject** retval) { + __Pyx_PySendResult result; + PyObject *val = NULL; + assert(__Pyx_Coroutine_get_is_running(gen)); + __Pyx_Coroutine_Undelegate(gen); + __Pyx_PyGen__FetchStopIterationValue(__Pyx_PyThreadState_Current, &val); + result = __Pyx_Coroutine_SendEx(gen, val, retval, 0); + Py_XDECREF(val); + return result; + } + #if CYTHON_USE_AM_SEND + static __Pyx_PySendResult + __Pyx_Coroutine_SendToDelegate(__pyx_CoroutineObject *gen, __Pyx_pyiter_sendfunc gen_am_send, PyObject *value, PyObject **retval) { + PyObject *ret = NULL; + __Pyx_PySendResult delegate_result, result; + assert(__Pyx_Coroutine_get_is_running(gen)); + delegate_result = gen_am_send(gen->yieldfrom, value, &ret); + if (delegate_result == PYGEN_NEXT) { + assert (ret != NULL); + *retval = ret; + return PYGEN_NEXT; + } + assert (delegate_result != PYGEN_ERROR || ret == NULL); + __Pyx_Coroutine_Undelegate(gen); + result = __Pyx_Coroutine_SendEx(gen, ret, retval, 0); + Py_XDECREF(ret); + return result; + } + #endif + static PyObject *__Pyx_Coroutine_Send(PyObject *self, PyObject *value) { + PyObject *retval = NULL; + __Pyx_PySendResult result = __Pyx_Coroutine_AmSend(self, value, &retval); + return __Pyx_Coroutine_MethodReturnFromResult(self, result, retval, 0); + } + static __Pyx_PySendResult + __Pyx_Coroutine_AmSend(PyObject *self, PyObject *value, PyObject **retval) { + __Pyx_PySendResult result; + __pyx_CoroutineObject *gen = (__pyx_CoroutineObject*) self; + if (unlikely(__Pyx_Coroutine_test_and_set_is_running(gen))) { + *retval = __Pyx_Coroutine_AlreadyRunningError(gen); + return PYGEN_ERROR; + } + #if CYTHON_USE_AM_SEND + if (gen->yieldfrom_am_send) { + result = __Pyx_Coroutine_SendToDelegate(gen, gen->yieldfrom_am_send, value, retval); + } else + #endif + if (gen->yieldfrom) { + PyObject *yf = gen->yieldfrom; + PyObject *ret; + #if !CYTHON_USE_AM_SEND + #ifdef __Pyx_Generator_USED + if (__Pyx_Generator_CheckExact(yf)) { + ret = __Pyx_Coroutine_Send(yf, value); + } else + #endif + #ifdef __Pyx_Coroutine_USED + if (__Pyx_Coroutine_Check(yf)) { + ret = __Pyx_Coroutine_Send(yf, value); + } else + #endif + #ifdef __Pyx_AsyncGen_USED + if (__pyx_PyAsyncGenASend_CheckExact(yf)) { + ret = __Pyx_async_gen_asend_send(yf, value); + } else + #endif + #if CYTHON_COMPILING_IN_CPYTHON + if (PyGen_CheckExact(yf)) { + ret = __Pyx_PyGen_Send((PyGenObject*)yf, value == Py_None ? NULL : value); + } else + if (PyCoro_CheckExact(yf)) { + ret = __Pyx_PyGen_Send((PyGenObject*)yf, value == Py_None ? NULL : value); + } else + #endif + #endif + { + #if !CYTHON_COMPILING_IN_LIMITED_API || __PYX_LIMITED_VERSION_HEX >= 0x03080000 + if (value == Py_None && PyIter_Check(yf)) + ret = __Pyx_PyIter_Next_Plain(yf); + else + #endif + ret = __Pyx_PyObject_CallMethod1(yf, __pyx_mstate_global->__pyx_n_u_send, value); + } + if (likely(ret)) { + __Pyx_Coroutine_unset_is_running(gen); + *retval = ret; + return PYGEN_NEXT; + } + result = __Pyx_Coroutine_FinishDelegation(gen, retval); + } else { + result = __Pyx_Coroutine_SendEx(gen, value, retval, 0); + } + __Pyx_Coroutine_unset_is_running(gen); + return result; + } + static int __Pyx_Coroutine_CloseIter(__pyx_CoroutineObject *gen, PyObject *yf) { + __Pyx_PySendResult result; + PyObject *retval = NULL; + CYTHON_UNUSED_VAR(gen); + assert(__Pyx_Coroutine_get_is_running(gen)); + #ifdef __Pyx_Generator_USED + if (__Pyx_Generator_CheckExact(yf)) { + result = __Pyx_Coroutine_Close(yf, &retval); + } else + #endif + #ifdef __Pyx_Coroutine_USED + if (__Pyx_Coroutine_Check(yf)) { + result = __Pyx_Coroutine_Close(yf, &retval); + } else + if (__Pyx_CoroutineAwait_CheckExact(yf)) { + result = __Pyx_CoroutineAwait_Close((__pyx_CoroutineAwaitObject*)yf); + } else + #endif + #ifdef __Pyx_AsyncGen_USED + if (__pyx_PyAsyncGenASend_CheckExact(yf)) { + retval = __Pyx_async_gen_asend_close(yf, NULL); + result = PYGEN_RETURN; + } else + if (__pyx_PyAsyncGenAThrow_CheckExact(yf)) { + retval = __Pyx_async_gen_athrow_close(yf, NULL); + result = PYGEN_RETURN; + } else + #endif + { + PyObject *meth; + result = PYGEN_RETURN; + meth = __Pyx_PyObject_GetAttrStrNoError(yf, __pyx_mstate_global->__pyx_n_u_close); + if (unlikely(!meth)) { + if (unlikely(PyErr_Occurred())) { + PyErr_WriteUnraisable(yf); + } + } else { + retval = __Pyx_PyObject_CallNoArg(meth); + Py_DECREF(meth); + if (unlikely(!retval)) { + result = PYGEN_ERROR; + } + } + } + Py_XDECREF(retval); + return result == PYGEN_ERROR ? -1 : 0; + } + static PyObject *__Pyx_Generator_Next(PyObject *self) { + __Pyx_PySendResult result; + PyObject *retval = NULL; + __pyx_CoroutineObject *gen = (__pyx_CoroutineObject*) self; + if (unlikely(__Pyx_Coroutine_test_and_set_is_running(gen))) { + return __Pyx_Coroutine_AlreadyRunningError(gen); + } + #if CYTHON_USE_AM_SEND + if (gen->yieldfrom_am_send) { + result = __Pyx_Coroutine_SendToDelegate(gen, gen->yieldfrom_am_send, Py_None, &retval); + } else + #endif + if (gen->yieldfrom) { + PyObject *yf = gen->yieldfrom; + PyObject *ret; + #ifdef __Pyx_Generator_USED + if (__Pyx_Generator_CheckExact(yf)) { + ret = __Pyx_Generator_Next(yf); + } else + #endif + #ifdef __Pyx_Coroutine_USED + if (__Pyx_Coroutine_CheckExact(yf)) { + ret = __Pyx_Coroutine_Send(yf, Py_None); + } else + #endif + #if CYTHON_COMPILING_IN_CPYTHON && (PY_VERSION_HEX < 0x030A00A3 || !CYTHON_USE_AM_SEND) + if (PyGen_CheckExact(yf)) { + ret = __Pyx_PyGen_Send((PyGenObject*)yf, NULL); + } else + #endif + ret = __Pyx_PyIter_Next_Plain(yf); + if (likely(ret)) { + __Pyx_Coroutine_unset_is_running(gen); + return ret; + } + result = __Pyx_Coroutine_FinishDelegation(gen, &retval); + } else { + result = __Pyx_Coroutine_SendEx(gen, Py_None, &retval, 0); + } + __Pyx_Coroutine_unset_is_running(gen); + return __Pyx_Coroutine_MethodReturnFromResult(self, result, retval, 1); + } + static PyObject *__Pyx_Coroutine_Close_Method(PyObject *self, PyObject *arg) { + PyObject *retval = NULL; + __Pyx_PySendResult result; + CYTHON_UNUSED_VAR(arg); + result = __Pyx_Coroutine_Close(self, &retval); + if (unlikely(result == PYGEN_ERROR)) + return NULL; + Py_XDECREF(retval); + Py_RETURN_NONE; + } + static __Pyx_PySendResult + __Pyx_Coroutine_Close(PyObject *self, PyObject **retval) { + __pyx_CoroutineObject *gen = (__pyx_CoroutineObject *) self; + __Pyx_PySendResult result; + PyObject *yf; + int err = 0; + if (unlikely(__Pyx_Coroutine_test_and_set_is_running(gen))) { + *retval = __Pyx_Coroutine_AlreadyRunningError(gen); + return PYGEN_ERROR; + } + yf = gen->yieldfrom; + if (yf) { + Py_INCREF(yf); + err = __Pyx_Coroutine_CloseIter(gen, yf); + __Pyx_Coroutine_Undelegate(gen); + Py_DECREF(yf); + } + if (err == 0) + PyErr_SetNone(PyExc_GeneratorExit); + result = __Pyx_Coroutine_SendEx(gen, NULL, retval, 1); + if (result == PYGEN_ERROR) { + __Pyx_PyThreadState_declare + __Pyx_PyThreadState_assign + __Pyx_Coroutine_unset_is_running(gen); + if (!__Pyx_PyErr_Occurred()) { + return PYGEN_RETURN; + } else if (likely(__Pyx_PyErr_ExceptionMatches2(PyExc_GeneratorExit, PyExc_StopIteration))) { + __Pyx_PyErr_Clear(); + return PYGEN_RETURN; + } + return PYGEN_ERROR; + } else if (likely(result == PYGEN_RETURN && *retval == Py_None)) { + __Pyx_Coroutine_unset_is_running(gen); + return PYGEN_RETURN; + } else { + const char *msg; + Py_DECREF(*retval); + *retval = NULL; + if ((0)) { + #ifdef __Pyx_Coroutine_USED + } else if (__Pyx_Coroutine_Check(self)) { + msg = "coroutine ignored GeneratorExit"; + #endif + #ifdef __Pyx_AsyncGen_USED + } else if (__Pyx_AsyncGen_CheckExact(self)) { + msg = "async generator ignored GeneratorExit"; + #endif + } else { + msg = "generator ignored GeneratorExit"; + } + PyErr_SetString(PyExc_RuntimeError, msg); + __Pyx_Coroutine_unset_is_running(gen); + return PYGEN_ERROR; + } + } + static PyObject *__Pyx__Coroutine_Throw(PyObject *self, PyObject *typ, PyObject *val, PyObject *tb, + PyObject *args, int close_on_genexit) { + __pyx_CoroutineObject *gen = (__pyx_CoroutineObject *) self; + PyObject *yf; + if (unlikely(__Pyx_Coroutine_test_and_set_is_running(gen))) + return __Pyx_Coroutine_AlreadyRunningError(gen); + yf = gen->yieldfrom; + if (yf) { + __Pyx_PySendResult result; + PyObject *ret; + Py_INCREF(yf); + if (__Pyx_PyErr_GivenExceptionMatches(typ, PyExc_GeneratorExit) && close_on_genexit) { + int err = __Pyx_Coroutine_CloseIter(gen, yf); + Py_DECREF(yf); + __Pyx_Coroutine_Undelegate(gen); + if (err < 0) + goto propagate_exception; + goto throw_here; + } + if (0 + #ifdef __Pyx_Generator_USED + || __Pyx_Generator_CheckExact(yf) + #endif + #ifdef __Pyx_Coroutine_USED + || __Pyx_Coroutine_Check(yf) + #endif + ) { + ret = __Pyx__Coroutine_Throw(yf, typ, val, tb, args, close_on_genexit); + #ifdef __Pyx_Coroutine_USED + } else if (__Pyx_CoroutineAwait_CheckExact(yf)) { + ret = __Pyx__Coroutine_Throw(((__pyx_CoroutineAwaitObject*)yf)->coroutine, typ, val, tb, args, close_on_genexit); + #endif + } else { + PyObject *meth = __Pyx_PyObject_GetAttrStrNoError(yf, __pyx_mstate_global->__pyx_n_u_throw); + if (unlikely(!meth)) { + Py_DECREF(yf); + if (unlikely(PyErr_Occurred())) { + __Pyx_Coroutine_unset_is_running(gen); + return NULL; + } + __Pyx_Coroutine_Undelegate(gen); + goto throw_here; + } + if (likely(args)) { + ret = __Pyx_PyObject_Call(meth, args, NULL); + } else { + PyObject *cargs[4] = {NULL, typ, val, tb}; + ret = __Pyx_PyObject_FastCall(meth, cargs+1, 3 | __Pyx_PY_VECTORCALL_ARGUMENTS_OFFSET); + } + Py_DECREF(meth); + } + Py_DECREF(yf); + if (ret) { + __Pyx_Coroutine_unset_is_running(gen); + return ret; + } + result = __Pyx_Coroutine_FinishDelegation(gen, &ret); + __Pyx_Coroutine_unset_is_running(gen); + return __Pyx_Coroutine_MethodReturnFromResult(self, result, ret, 0); + } + throw_here: + __Pyx_Raise(typ, val, tb, NULL); + propagate_exception: + { + PyObject *retval = NULL; + __Pyx_PySendResult result = __Pyx_Coroutine_SendEx(gen, NULL, &retval, 0); + __Pyx_Coroutine_unset_is_running(gen); + return __Pyx_Coroutine_MethodReturnFromResult(self, result, retval, 0); + } + } + static PyObject *__Pyx_Coroutine_Throw(PyObject *self, PyObject *args) { + PyObject *typ; + PyObject *val = NULL; + PyObject *tb = NULL; + if (unlikely(!PyArg_UnpackTuple(args, "throw", 1, 3, &typ, &val, &tb))) + return NULL; + return __Pyx__Coroutine_Throw(self, typ, val, tb, args, 1); + } + static CYTHON_INLINE int __Pyx_Coroutine_traverse_excstate(__Pyx_ExcInfoStruct *exc_state, visitproc visit, void *arg) { + #if PY_VERSION_HEX >= 0x030B00a4 + Py_VISIT(exc_state->exc_value); + #else + Py_VISIT(exc_state->exc_type); + Py_VISIT(exc_state->exc_value); + Py_VISIT(exc_state->exc_traceback); + #endif + return 0; + } + static int __Pyx_Coroutine_traverse(__pyx_CoroutineObject *gen, visitproc visit, void *arg) { + { + int e = __Pyx_call_type_traverse((PyObject*)gen, 1, visit, arg); + if (e) return e; + } + Py_VISIT(gen->closure); + Py_VISIT(gen->classobj); + Py_VISIT(gen->yieldfrom); + return __Pyx_Coroutine_traverse_excstate(&gen->gi_exc_state, visit, arg); + } + static int __Pyx_Coroutine_clear(PyObject *self) { + __pyx_CoroutineObject *gen = (__pyx_CoroutineObject *) self; + Py_CLEAR(gen->closure); + Py_CLEAR(gen->classobj); + __Pyx_Coroutine_Undelegate(gen); + __Pyx_Coroutine_ExceptionClear(&gen->gi_exc_state); + #ifdef __Pyx_AsyncGen_USED + if (__Pyx_AsyncGen_CheckExact(self)) { + Py_CLEAR(((__pyx_PyAsyncGenObject*)gen)->ag_finalizer); + } + #endif + Py_CLEAR(gen->gi_code); + Py_CLEAR(gen->gi_frame); + Py_CLEAR(gen->gi_name); + Py_CLEAR(gen->gi_qualname); + Py_CLEAR(gen->gi_modulename); + return 0; + } + static void __Pyx_Coroutine_dealloc(PyObject *self) { + __pyx_CoroutineObject *gen = (__pyx_CoroutineObject *) self; + PyObject_GC_UnTrack(gen); + #if PY_VERSION_HEX < 0x030C0000 || CYTHON_COMPILING_IN_LIMITED_API + if (gen->gi_weakreflist != NULL) + #endif + PyObject_ClearWeakRefs(self); + if (gen->resume_label >= 0) { + PyObject_GC_Track(self); + #if CYTHON_USE_TP_FINALIZE + if (unlikely(PyObject_CallFinalizerFromDealloc(self))) + #else + { + destructor del = __Pyx_PyObject_GetSlot(gen, tp_del, destructor); + if (del) del(self); + } + if (unlikely(Py_REFCNT(self) > 0)) + #endif + { + return; + } + PyObject_GC_UnTrack(self); + } + #ifdef __Pyx_AsyncGen_USED + if (__Pyx_AsyncGen_CheckExact(self)) { + /* We have to handle this case for asynchronous generators + right here, because this code has to be between UNTRACK + and GC_Del. */ + Py_CLEAR(((__pyx_PyAsyncGenObject*)self)->ag_finalizer); + } + #endif + __Pyx_Coroutine_clear(self); + __Pyx_PyHeapTypeObject_GC_Del(gen); + } + #if CYTHON_USE_TP_FINALIZE + static void __Pyx_Coroutine_del(PyObject *self) { + PyObject *error_type, *error_value, *error_traceback; + __pyx_CoroutineObject *gen = (__pyx_CoroutineObject *) self; + __Pyx_PyThreadState_declare + if (gen->resume_label < 0) { + return; + } + __Pyx_PyThreadState_assign + __Pyx_ErrFetch(&error_type, &error_value, &error_traceback); + #ifdef __Pyx_AsyncGen_USED + if (__Pyx_AsyncGen_CheckExact(self)) { + __pyx_PyAsyncGenObject *agen = (__pyx_PyAsyncGenObject*)self; + PyObject *finalizer = agen->ag_finalizer; + if (finalizer && !agen->ag_closed) { + PyObject *res = __Pyx_PyObject_CallOneArg(finalizer, self); + if (unlikely(!res)) { + PyErr_WriteUnraisable(self); + } else { + Py_DECREF(res); + } + __Pyx_ErrRestore(error_type, error_value, error_traceback); + return; + } + } + #endif + if (unlikely(gen->resume_label == 0 && !error_value)) { + #ifdef __Pyx_Coroutine_USED + #ifdef __Pyx_Generator_USED + if (!__Pyx_Generator_CheckExact(self)) + #endif + { + PyObject_GC_UnTrack(self); + if (unlikely(PyErr_WarnFormat(PyExc_RuntimeWarning, 1, "coroutine '%.50S' was never awaited", gen->gi_qualname) < 0)) + PyErr_WriteUnraisable(self); + PyObject_GC_Track(self); + } + #endif + } else { + PyObject *retval = NULL; + __Pyx_PySendResult result = __Pyx_Coroutine_Close(self, &retval); + if (result == PYGEN_ERROR) { + PyErr_WriteUnraisable(self); + } else { + Py_XDECREF(retval); + } + } + __Pyx_ErrRestore(error_type, error_value, error_traceback); + } + #endif + static PyObject * + __Pyx_Coroutine_get_name(__pyx_CoroutineObject *self, void *context) + { + PyObject *name = self->gi_name; + CYTHON_UNUSED_VAR(context); + if (unlikely(!name)) name = Py_None; + Py_INCREF(name); + return name; + } + static int + __Pyx_Coroutine_set_name(__pyx_CoroutineObject *self, 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_Py_XDECREF_SET(self->gi_name, value); + return 0; + } + static PyObject * + __Pyx_Coroutine_get_qualname(__pyx_CoroutineObject *self, void *context) + { + PyObject *name = self->gi_qualname; + CYTHON_UNUSED_VAR(context); + if (unlikely(!name)) name = Py_None; + Py_INCREF(name); + return name; + } + static int + __Pyx_Coroutine_set_qualname(__pyx_CoroutineObject *self, 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_Py_XDECREF_SET(self->gi_qualname, value); + return 0; + } + static PyObject * + __Pyx__Coroutine_get_frame(__pyx_CoroutineObject *self) + { + #if !CYTHON_COMPILING_IN_LIMITED_API + PyObject *frame; + #if PY_VERSION_HEX >= 0x030d0000 + Py_BEGIN_CRITICAL_SECTION(self); + #endif + frame = self->gi_frame; + if (!frame) { + if (unlikely(!self->gi_code)) { + Py_RETURN_NONE; + } + PyObject *globals = PyDict_New(); + if (unlikely(!globals)) return NULL; + frame = (PyObject *) PyFrame_New( + PyThreadState_Get(), /*PyThreadState *tstate,*/ + (PyCodeObject*) self->gi_code, /*PyCodeObject *code,*/ + globals, /*PyObject *globals,*/ + 0 /*PyObject *locals*/ + ); + Py_DECREF(globals); + if (unlikely(!frame)) + return NULL; + if (unlikely(self->gi_frame)) { + Py_DECREF(frame); + frame = self->gi_frame; + } else { + self->gi_frame = frame; + } + } + Py_INCREF(frame); + #if PY_VERSION_HEX >= 0x030d0000 + Py_END_CRITICAL_SECTION(); + #endif + return frame; + #else + CYTHON_UNUSED_VAR(self); + Py_RETURN_NONE; + #endif + } + static PyObject * + __Pyx_Coroutine_get_frame(__pyx_CoroutineObject *self, void *context) { + CYTHON_UNUSED_VAR(context); + PyObject *frame = self->gi_frame; + if (frame) + return __Pyx_NewRef(frame); + return __Pyx__Coroutine_get_frame(self); + } + static __pyx_CoroutineObject *__Pyx__Coroutine_New( + PyTypeObject* type, __pyx_coroutine_body_t body, PyObject *code, PyObject *closure, + PyObject *name, PyObject *qualname, PyObject *module_name) { + __pyx_CoroutineObject *gen = PyObject_GC_New(__pyx_CoroutineObject, type); + if (unlikely(!gen)) + return NULL; + return __Pyx__Coroutine_NewInit(gen, body, code, closure, name, qualname, module_name); + } + static __pyx_CoroutineObject *__Pyx__Coroutine_NewInit( + __pyx_CoroutineObject *gen, __pyx_coroutine_body_t body, PyObject *code, PyObject *closure, + PyObject *name, PyObject *qualname, PyObject *module_name) { + gen->body = body; + gen->closure = closure; + Py_XINCREF(closure); + gen->is_running = 0; + gen->resume_label = 0; + gen->classobj = NULL; + gen->yieldfrom = NULL; + gen->yieldfrom_am_send = NULL; + #if PY_VERSION_HEX >= 0x030B00a4 && !CYTHON_COMPILING_IN_LIMITED_API + gen->gi_exc_state.exc_value = NULL; + #else + gen->gi_exc_state.exc_type = NULL; + gen->gi_exc_state.exc_value = NULL; + gen->gi_exc_state.exc_traceback = NULL; + #endif + #if CYTHON_USE_EXC_INFO_STACK + gen->gi_exc_state.previous_item = NULL; + #endif + #if PY_VERSION_HEX < 0x030C0000 || CYTHON_COMPILING_IN_LIMITED_API + gen->gi_weakreflist = NULL; + #endif + Py_XINCREF(qualname); + gen->gi_qualname = qualname; + Py_XINCREF(name); + gen->gi_name = name; + Py_XINCREF(module_name); + gen->gi_modulename = module_name; + Py_XINCREF(code); + gen->gi_code = code; + gen->gi_frame = NULL; + PyObject_GC_Track(gen); + return gen; + } + static char __Pyx_Coroutine_test_and_set_is_running(__pyx_CoroutineObject *gen) { + char result; + #if PY_VERSION_HEX >= 0x030d0000 && !CYTHON_COMPILING_IN_LIMITED_API + Py_BEGIN_CRITICAL_SECTION(gen); + #endif + result = gen->is_running; + gen->is_running = 1; + #if PY_VERSION_HEX >= 0x030d0000 && !CYTHON_COMPILING_IN_LIMITED_API + Py_END_CRITICAL_SECTION(); + #endif + return result; + } + static void __Pyx_Coroutine_unset_is_running(__pyx_CoroutineObject *gen) { + #if PY_VERSION_HEX >= 0x030d0000 && !CYTHON_COMPILING_IN_LIMITED_API + Py_BEGIN_CRITICAL_SECTION(gen); + #endif + assert(gen->is_running); + gen->is_running = 0; + #if PY_VERSION_HEX >= 0x030d0000 && !CYTHON_COMPILING_IN_LIMITED_API + Py_END_CRITICAL_SECTION(); + #endif + } + static char __Pyx_Coroutine_get_is_running(__pyx_CoroutineObject *gen) { + char result; + #if PY_VERSION_HEX >= 0x030d0000 && !CYTHON_COMPILING_IN_LIMITED_API + Py_BEGIN_CRITICAL_SECTION(gen); + #endif + result = gen->is_running; + #if PY_VERSION_HEX >= 0x030d0000 && !CYTHON_COMPILING_IN_LIMITED_API + Py_END_CRITICAL_SECTION(); + #endif + return result; + } + static PyObject *__Pyx_Coroutine_get_is_running_getter(PyObject *gen, void *closure) { + CYTHON_UNUSED_VAR(closure); + char result = __Pyx_Coroutine_get_is_running((__pyx_CoroutineObject*)gen); + if (result) Py_RETURN_TRUE; + else Py_RETURN_FALSE; + } + #if __PYX_HAS_PY_AM_SEND == 2 + static void __Pyx_SetBackportTypeAmSend(PyTypeObject *type, __Pyx_PyAsyncMethodsStruct *static_amsend_methods, __Pyx_pyiter_sendfunc am_send) { + Py_ssize_t ptr_offset = (char*)(type->tp_as_async) - (char*)type; + if (ptr_offset < 0 || ptr_offset > type->tp_basicsize) { + return; + } + memcpy((void*)static_amsend_methods, (void*)(type->tp_as_async), sizeof(*type->tp_as_async)); + static_amsend_methods->am_send = am_send; + type->tp_as_async = __Pyx_SlotTpAsAsync(static_amsend_methods); + } + #endif + static PyObject *__Pyx_Coroutine_fail_reduce_ex(PyObject *self, PyObject *arg) { + CYTHON_UNUSED_VAR(arg); + __Pyx_TypeName self_type_name = __Pyx_PyType_GetFullyQualifiedName(Py_TYPE((PyObject*)self)); + PyErr_Format(PyExc_TypeError, "cannot pickle '" __Pyx_FMT_TYPENAME "' object", + self_type_name); + __Pyx_DECREF_TypeName(self_type_name); + return NULL; + } + +/* Generator */ + static PyMethodDef __pyx_Generator_methods[] = { + {"send", (PyCFunction) __Pyx_Coroutine_Send, METH_O, + PyDoc_STR("send(arg) -> send 'arg' into generator,\nreturn next yielded value or raise StopIteration.")}, + {"throw", (PyCFunction) __Pyx_Coroutine_Throw, METH_VARARGS, + PyDoc_STR("throw(typ[,val[,tb]]) -> raise exception in generator,\nreturn next yielded value or raise StopIteration.")}, + {"close", (PyCFunction) __Pyx_Coroutine_Close_Method, METH_NOARGS, + PyDoc_STR("close() -> raise GeneratorExit inside generator.")}, + {"__reduce_ex__", (PyCFunction) __Pyx_Coroutine_fail_reduce_ex, METH_O, 0}, + {"__reduce__", (PyCFunction) __Pyx_Coroutine_fail_reduce_ex, METH_NOARGS, 0}, + {0, 0, 0, 0} + }; + static PyMemberDef __pyx_Generator_memberlist[] = { + {"gi_yieldfrom", T_OBJECT, offsetof(__pyx_CoroutineObject, yieldfrom), READONLY, + PyDoc_STR("object being iterated by 'yield from', or None")}, + {"gi_code", T_OBJECT, offsetof(__pyx_CoroutineObject, gi_code), READONLY, NULL}, + {"__module__", T_OBJECT, offsetof(__pyx_CoroutineObject, gi_modulename), 0, 0}, + #if PY_VERSION_HEX < 0x030C0000 || CYTHON_COMPILING_IN_LIMITED_API + {"__weaklistoffset__", T_PYSSIZET, offsetof(__pyx_CoroutineObject, gi_weakreflist), READONLY, 0}, + #endif + {0, 0, 0, 0, 0} + }; + static PyGetSetDef __pyx_Generator_getsets[] = { + {"__name__", (getter)__Pyx_Coroutine_get_name, (setter)__Pyx_Coroutine_set_name, + PyDoc_STR("name of the generator"), 0}, + {"__qualname__", (getter)__Pyx_Coroutine_get_qualname, (setter)__Pyx_Coroutine_set_qualname, + PyDoc_STR("qualified name of the generator"), 0}, + {"gi_frame", (getter)__Pyx_Coroutine_get_frame, NULL, + PyDoc_STR("Frame of the generator"), 0}, + {"gi_running", __Pyx_Coroutine_get_is_running_getter, NULL, NULL, NULL}, + {0, 0, 0, 0, 0} + }; + static PyType_Slot __pyx_GeneratorType_slots[] = { + {Py_tp_dealloc, (void *)__Pyx_Coroutine_dealloc}, + {Py_tp_traverse, (void *)__Pyx_Coroutine_traverse}, + {Py_tp_iter, (void *)PyObject_SelfIter}, + {Py_tp_iternext, (void *)__Pyx_Generator_Next}, + {Py_tp_methods, (void *)__pyx_Generator_methods}, + {Py_tp_members, (void *)__pyx_Generator_memberlist}, + {Py_tp_getset, (void *)__pyx_Generator_getsets}, + {Py_tp_getattro, (void *) PyObject_GenericGetAttr}, + #if CYTHON_USE_TP_FINALIZE + {Py_tp_finalize, (void *)__Pyx_Coroutine_del}, + #endif + #if __PYX_HAS_PY_AM_SEND == 1 + {Py_am_send, (void *)__Pyx_Coroutine_AmSend}, + #endif + {0, 0}, + }; + static PyType_Spec __pyx_GeneratorType_spec = { + __PYX_TYPE_MODULE_PREFIX "generator", + sizeof(__pyx_CoroutineObject), + 0, + #if PY_VERSION_HEX >= 0x030C0000 && !CYTHON_COMPILING_IN_LIMITED_API + Py_TPFLAGS_MANAGED_WEAKREF | + #endif + Py_TPFLAGS_IMMUTABLETYPE | Py_TPFLAGS_DISALLOW_INSTANTIATION | + Py_TPFLAGS_DEFAULT | Py_TPFLAGS_HAVE_GC | __Pyx_TPFLAGS_HAVE_AM_SEND, + __pyx_GeneratorType_slots + }; + #if __PYX_HAS_PY_AM_SEND == 2 + static __Pyx_PyAsyncMethodsStruct __pyx_Generator_as_async; + #endif + static int __pyx_Generator_init(PyObject *module) { + __pyx_mstatetype *mstate = __Pyx_PyModule_GetState(module); + mstate->__pyx_GeneratorType = __Pyx_FetchCommonTypeFromSpec( + mstate->__pyx_CommonTypesMetaclassType, module, &__pyx_GeneratorType_spec, NULL); + if (unlikely(!mstate->__pyx_GeneratorType)) { + return -1; + } + #if __PYX_HAS_PY_AM_SEND == 2 + __Pyx_SetBackportTypeAmSend(mstate->__pyx_GeneratorType, &__pyx_Generator_as_async, &__Pyx_Coroutine_AmSend); + #endif + return 0; + } + static PyObject *__Pyx_Generator_GetInlinedResult(PyObject *self) { + __pyx_CoroutineObject *gen = (__pyx_CoroutineObject*) self; + PyObject *retval = NULL; + if (unlikely(__Pyx_Coroutine_test_and_set_is_running(gen))) { + return __Pyx_Coroutine_AlreadyRunningError(gen); + } + __Pyx_PySendResult result = __Pyx_Coroutine_SendEx(gen, Py_None, &retval, 0); + __Pyx_Coroutine_unset_is_running(gen); + (void) result; + assert (result == PYGEN_RETURN || result == PYGEN_ERROR); + assert ((result == PYGEN_RETURN && retval != NULL) || (result == PYGEN_ERROR && retval == NULL)); + return retval; + } + +/* 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, *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)) return NULL; + 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 */ diff --git a/TTS/Kokoro/.venv/Lib/site-packages/spacy/pipeline/_parser_internals/_beam_utils.pxd b/TTS/Kokoro/.venv/Lib/site-packages/spacy/pipeline/_parser_internals/_beam_utils.pxd new file mode 100644 index 0000000000000000000000000000000000000000..ef939d3af1faf58bff47eee67f830b7066e1d48b --- /dev/null +++ b/TTS/Kokoro/.venv/Lib/site-packages/spacy/pipeline/_parser_internals/_beam_utils.pxd @@ -0,0 +1,7 @@ +from ...typedefs cimport class_t, hash_t + + +# These are passed as callbacks to thinc.search.Beam +cdef int transition_state(void* _dest, void* _src, class_t clas, void* _moves) except -1 + +cdef int check_final_state(void* _state, void* extra_args) except -1 diff --git a/TTS/Kokoro/.venv/Lib/site-packages/spacy/pipeline/_parser_internals/_beam_utils.pyx b/TTS/Kokoro/.venv/Lib/site-packages/spacy/pipeline/_parser_internals/_beam_utils.pyx new file mode 100644 index 0000000000000000000000000000000000000000..52b48d25be7365e73cc9bfbc7a5221c281b75908 --- /dev/null +++ b/TTS/Kokoro/.venv/Lib/site-packages/spacy/pipeline/_parser_internals/_beam_utils.pyx @@ -0,0 +1,297 @@ +# cython: infer_types=True +import numpy + +from thinc.extra.search cimport Beam + +from thinc.extra.search import MaxViolation + +from thinc.extra.search cimport MaxViolation + +from ...typedefs cimport class_t +from .transition_system cimport Transition, TransitionSystem + +from ...errors import Errors + +from .stateclass cimport StateC, StateClass + + +# These are passed as callbacks to thinc.search.Beam +cdef int transition_state(void* _dest, void* _src, class_t clas, void* _moves) except -1: + dest = _dest + src = _src + moves = _moves + dest.clone(src) + moves[clas].do(dest, moves[clas].label) + + +cdef int check_final_state(void* _state, void* extra_args) except -1: + state = _state + return state.is_final() + + +cdef class BeamBatch(object): + cdef public TransitionSystem moves + cdef public object states + cdef public object docs + cdef public object golds + cdef public object beams + + def __init__(self, TransitionSystem moves, states, golds, + int width, float density=0.): + cdef StateClass state + self.moves = moves + self.states = states + self.docs = [state.doc for state in states] + self.golds = golds + self.beams = [] + cdef Beam beam + cdef StateC* st + for state in states: + beam = Beam(self.moves.n_moves, width, min_density=density) + beam.initialize(self.moves.init_beam_state, + self.moves.del_beam_state, state.c.length, + state.c._sent) + for i in range(beam.width): + st = beam.at(i) + st.offset = state.c.offset + beam.check_done(check_final_state, NULL) + self.beams.append(beam) + + @property + def is_done(self): + return all(b.is_done for b in self.beams) + + def __getitem__(self, i): + return self.beams[i] + + def __len__(self): + return len(self.beams) + + def get_states(self): + cdef Beam beam + cdef StateC* state + cdef StateClass stcls + states = [] + for beam, doc in zip(self, self.docs): + for i in range(beam.size): + state = beam.at(i) + stcls = StateClass.borrow(state, doc) + states.append(stcls) + return states + + def get_unfinished_states(self): + return [st for st in self.get_states() if not st.is_final()] + + def advance(self, float[:, ::1] scores, follow_gold=False): + cdef Beam beam + cdef int nr_class = scores.shape[1] + cdef const float* c_scores = &scores[0, 0] + docs = self.docs + for i, beam in enumerate(self): + if not beam.is_done: + nr_state = self._set_scores(beam, c_scores, nr_class) + assert nr_state + if self.golds is not None: + self._set_costs( + beam, + docs[i], + self.golds[i], + follow_gold=follow_gold + ) + c_scores += nr_state * nr_class + beam.advance(transition_state, NULL, self.moves.c) + beam.check_done(check_final_state, NULL) + + cdef int _set_scores(self, Beam beam, const float* scores, int nr_class) except -1: + cdef int nr_state = 0 + for i in range(beam.size): + state = beam.at(i) + if not state.is_final(): + for j in range(nr_class): + beam.scores[i][j] = scores[nr_state * nr_class + j] + self.moves.set_valid(beam.is_valid[i], state) + nr_state += 1 + else: + for j in range(beam.nr_class): + beam.scores[i][j] = 0 + beam.costs[i][j] = 0 + return nr_state + + def _set_costs(self, Beam beam, doc, gold, int follow_gold=False): + cdef const StateC* state + for i in range(beam.size): + state = beam.at(i) + if state.is_final(): + for j in range(beam.nr_class): + beam.is_valid[i][j] = 0 + beam.costs[i][j] = 9000 + else: + self.moves.set_costs(beam.is_valid[i], beam.costs[i], + state, gold) + if follow_gold: + min_cost = 0 + for j in range(beam.nr_class): + if beam.is_valid[i][j] and beam.costs[i][j] < min_cost: + min_cost = beam.costs[i][j] + for j in range(beam.nr_class): + if beam.costs[i][j] > min_cost: + beam.is_valid[i][j] = 0 + + +def update_beam(TransitionSystem moves, states, golds, model, int width, beam_density=0.0): + cdef MaxViolation violn + pbeam = BeamBatch(moves, states, golds, width=width, density=beam_density) + gbeam = BeamBatch(moves, states, golds, width=width, density=0.0) + beam_maps = [] + backprops = [] + violns = [MaxViolation() for _ in range(len(states))] + dones = [False for _ in states] + while not pbeam.is_done or not gbeam.is_done: + # The beam maps let us find the right row in the flattened scores + # array for each state. States are identified by (example id, + # history). We keep a different beam map for each step (since we'll + # have a flat scores array for each step). The beam map will let us + # take the per-state losses, and compute the gradient for each (step, + # state, class). + # Gather all states from the two beams in a list. Some stats may occur + # in both beams. To figure out which beam each state belonged to, + # we keep two lists of indices, p_indices and g_indices + states, p_indices, g_indices, beam_map = get_unique_states(pbeam, gbeam) + beam_maps.append(beam_map) + if not states: + break + # Now that we have our flat list of states, feed them through the model + scores, bp_scores = model.begin_update(states) + assert scores.size != 0 + # Store the callbacks for the backward pass + backprops.append(bp_scores) + # Unpack the scores for the two beams. The indices arrays + # tell us which example and state the scores-row refers to. + # Now advance the states in the beams. The gold beam is constrained to + # to follow only gold analyses. + if not pbeam.is_done: + pbeam.advance(model.ops.as_contig(scores[p_indices])) + if not gbeam.is_done: + gbeam.advance(model.ops.as_contig(scores[g_indices]), follow_gold=True) + # Track the "maximum violation", to use in the update. + for i, violn in enumerate(violns): + if not dones[i]: + violn.check_crf(pbeam[i], gbeam[i]) + if pbeam[i].is_done and gbeam[i].is_done: + dones[i] = True + histories = [] + grads = [] + for violn in violns: + if violn.p_hist: + histories.append(violn.p_hist + violn.g_hist) + d_loss = [d_l * violn.cost for d_l in violn.p_probs + violn.g_probs] + grads.append(d_loss) + else: + histories.append([]) + grads.append([]) + loss = 0.0 + states_d_scores = get_gradient(moves.n_moves, beam_maps, histories, grads) + for i, (d_scores, bp_scores) in enumerate(zip(states_d_scores, backprops)): + loss += (d_scores**2).mean() + bp_scores(d_scores) + return loss + + +def collect_states(beams, docs): + cdef StateClass state + cdef Beam beam + states = [] + for state_or_beam, doc in zip(beams, docs): + if isinstance(state_or_beam, StateClass): + states.append(state_or_beam) + else: + beam = state_or_beam + state = StateClass.borrow(beam.at(0), doc) + states.append(state) + return states + + +def get_unique_states(pbeams, gbeams): + seen = {} + states = [] + p_indices = [] + g_indices = [] + beam_map = {} + docs = pbeams.docs + cdef Beam pbeam, gbeam + if len(pbeams) != len(gbeams): + raise ValueError(Errors.E079.format(pbeams=len(pbeams), gbeams=len(gbeams))) + for eg_id, (pbeam, gbeam, doc) in enumerate(zip(pbeams, gbeams, docs)): + if not pbeam.is_done: + for i in range(pbeam.size): + state = StateClass.borrow(pbeam.at(i), doc) + if not state.is_final(): + key = tuple([eg_id] + pbeam.histories[i]) + if key in seen: + raise ValueError(Errors.E080.format(key=key)) + seen[key] = len(states) + p_indices.append(len(states)) + states.append(state) + beam_map.update(seen) + if not gbeam.is_done: + for i in range(gbeam.size): + state = StateClass.borrow(gbeam.at(i), doc) + if not state.is_final(): + key = tuple([eg_id] + gbeam.histories[i]) + if key in seen: + g_indices.append(seen[key]) + else: + g_indices.append(len(states)) + beam_map[key] = len(states) + states.append(state) + p_indices = numpy.asarray(p_indices, dtype='i') + g_indices = numpy.asarray(g_indices, dtype='i') + return states, p_indices, g_indices, beam_map + + +def get_gradient(nr_class, beam_maps, histories, losses): + """The global model assigns a loss to each parse. The beam scores + are additive, so the same gradient is applied to each action + in the history. This gives the gradient of a single *action* + for a beam state -- so we have "the gradient of loss for taking + action i given history H." + + Histories: Each history is a list of actions + Each candidate has a history + Each beam has multiple candidates + Each batch has multiple beams + So history is list of lists of lists of ints + """ + grads = [] + nr_steps = [] + for eg_id, hists in enumerate(histories): + nr_step = 0 + for loss, hist in zip(losses[eg_id], hists): + assert not numpy.isnan(loss) + if loss != 0.0: + nr_step = max(nr_step, len(hist)) + nr_steps.append(nr_step) + for i in range(max(nr_steps)): + grads.append(numpy.zeros((max(beam_maps[i].values())+1, nr_class), + dtype='f')) + if len(histories) != len(losses): + raise ValueError(Errors.E081.format(n_hist=len(histories), losses=len(losses))) + for eg_id, hists in enumerate(histories): + for loss, hist in zip(losses[eg_id], hists): + assert not numpy.isnan(loss) + if loss == 0.0: + continue + key = tuple([eg_id]) + # Adjust loss for length + # We need to do this because each state in a short path is scored + # multiple times, as we add in the average cost when we run out + # of actions. + avg_loss = loss / len(hist) + loss += avg_loss * (nr_steps[eg_id] - len(hist)) + for step, clas in enumerate(hist): + i = beam_maps[step][key] + # In step j, at state i action clas + # resulted in loss + grads[step][i, clas] += loss + key = key + tuple([clas]) + return grads diff --git a/TTS/Kokoro/.venv/Lib/site-packages/spacy/pipeline/_parser_internals/_state.cp312-win_amd64.pyd b/TTS/Kokoro/.venv/Lib/site-packages/spacy/pipeline/_parser_internals/_state.cp312-win_amd64.pyd new file mode 100644 index 0000000000000000000000000000000000000000..6d599660b2696ae9a45a20b844aef8353b8420a9 Binary files /dev/null and b/TTS/Kokoro/.venv/Lib/site-packages/spacy/pipeline/_parser_internals/_state.cp312-win_amd64.pyd differ diff --git a/TTS/Kokoro/.venv/Lib/site-packages/spacy/pipeline/_parser_internals/_state.cpp b/TTS/Kokoro/.venv/Lib/site-packages/spacy/pipeline/_parser_internals/_state.cpp new file mode 100644 index 0000000000000000000000000000000000000000..83cb2b460f879afc96ce1e18ac9c34d1b77ffc2f --- /dev/null +++ b/TTS/Kokoro/.venv/Lib/site-packages/spacy/pipeline/_parser_internals/_state.cpp @@ -0,0 +1,15178 @@ +/* Generated by Cython 3.2.1 */ + +/* BEGIN: Cython Metadata +{ + "distutils": { + "depends": [ + "C:\\Users\\runneradmin\\AppData\\Local\\Temp\\build-env-ej_q3m8u\\Lib\\site-packages\\numpy\\_core\\include\\numpy\\arrayobject.h", + "C:\\Users\\runneradmin\\AppData\\Local\\Temp\\build-env-ej_q3m8u\\Lib\\site-packages\\numpy\\_core\\include\\numpy\\arrayscalars.h", + "C:\\Users\\runneradmin\\AppData\\Local\\Temp\\build-env-ej_q3m8u\\Lib\\site-packages\\numpy\\_core\\include\\numpy\\ndarrayobject.h", + "C:\\Users\\runneradmin\\AppData\\Local\\Temp\\build-env-ej_q3m8u\\Lib\\site-packages\\numpy\\_core\\include\\numpy\\ndarraytypes.h", + "C:\\Users\\runneradmin\\AppData\\Local\\Temp\\build-env-ej_q3m8u\\Lib\\site-packages\\numpy\\_core\\include\\numpy\\ufuncobject.h", + "C:\\Users\\runneradmin\\AppData\\Local\\pypa\\cibuildwheel\\Cache\\nuget-cpython\\python.3.12.10\\tools\\Include\\Python.h" + ], + "extra_compile_args": [ + "-std=c++11" + ], + "include_dirs": [ + "C:\\Users\\runneradmin\\AppData\\Local\\Temp\\build-env-ej_q3m8u\\Lib\\site-packages\\numpy\\_core\\include", + "C:\\Users\\runneradmin\\AppData\\Local\\pypa\\cibuildwheel\\Cache\\nuget-cpython\\python.3.12.10\\tools\\Include" + ], + "language": "c++", + "name": "spacy.pipeline._parser_internals._state", + "sources": [ + "spacy/pipeline/_parser_internals/_state.pyx" + ] + }, + "module_name": "spacy.pipeline._parser_internals._state" +} +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_1" +#define CYTHON_HEX_VERSION 0x030201F0 +#define CYTHON_FUTURE_DIVISION 0 +/* 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)) + +/* CppInitCode */ +#ifndef __cplusplus + #error "Cython files generated with the C++ option must be compiled with a C++ compiler." +#endif +#ifndef CYTHON_INLINE + #if defined(__clang__) + #define CYTHON_INLINE __inline__ __attribute__ ((__unused__)) + #else + #define CYTHON_INLINE inline + #endif +#endif +template +void __Pyx_call_destructor(T& x) { + x.~T(); +} +template +class __Pyx_FakeReference { + public: + __Pyx_FakeReference() : ptr(NULL) { } + __Pyx_FakeReference(const T& ref) : ptr(const_cast(&ref)) { } + T *operator->() { return ptr; } + T *operator&() { return ptr; } + operator T&() { return *ptr; } + template bool operator ==(const U& other) const { return *ptr == other; } + template bool operator !=(const U& other) const { return *ptr != other; } + template bool operator==(const __Pyx_FakeReference& other) const { return *ptr == *other.ptr; } + template bool operator!=(const __Pyx_FakeReference& other) const { return *ptr != *other.ptr; } + private: + T *ptr; +}; + +/* 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 + #define __PYX_EXTERN_C extern "C++" +#endif + +#define __PYX_HAVE__spacy__pipeline___parser_internals___state +#define __PYX_HAVE_API__spacy__pipeline___parser_internals___state +/* Early includes */ +#include +#include +#include +#include +#include "ios" +#include "new" +#include "stdexcept" +#include "typeinfo" +#include + + #if __cplusplus >= 201103L || (defined(_MSC_VER) && _MSC_VER >= 1600) + // move should be defined for these versions of MSVC, but __cplusplus isn't set usefully + #include + + namespace cython_std { + template typename std::remove_reference::type&& move(T& t) noexcept { return std::move(t); } + template typename std::remove_reference::type&& move(T&& t) noexcept { return std::move(t); } + } + + #endif + +#include +#include +#include + + /* Using NumPy API declarations from "numpy/__init__.cython-30.pxd" */ + +#include "numpy/arrayobject.h" +#include "numpy/ndarrayobject.h" +#include "numpy/ndarraytypes.h" +#include "numpy/arrayscalars.h" +#include "numpy/ufuncobject.h" +#include +#ifdef _OPENMP +#include +#endif /* _OPENMP */ + +#if defined(PYREX_WITHOUT_ASSERTIONS) && !defined(CYTHON_WITHOUT_ASSERTIONS) +#define CYTHON_WITHOUT_ASSERTIONS +#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; + +/* Header.proto */ +#if !defined(CYTHON_CCOMPLEX) + #if defined(__cplusplus) + #define CYTHON_CCOMPLEX 1 + #elif (defined(_Complex_I) && !defined(_MSC_VER)) || ((defined (__STDC_VERSION__) && __STDC_VERSION__ >= 201112L) && !defined(__STDC_NO_COMPLEX__) && !defined(_MSC_VER)) + #define CYTHON_CCOMPLEX 1 + #else + #define CYTHON_CCOMPLEX 0 + #endif +#endif +#if CYTHON_CCOMPLEX + #ifdef __cplusplus + #include + #else + #include + #endif +#endif +#if CYTHON_CCOMPLEX && !defined(__cplusplus) && defined(__sun__) && defined(__GNUC__) + #undef _Complex_I + #define _Complex_I 1.0fj +#endif + +/* #### Code section: filename_table ### */ + +static const char* const __pyx_f[] = { + "spacy/pipeline/_parser_internals/_state.pyx", + "C:/Users/runneradmin/AppData/Local/Temp/build-env-ej_q3m8u/Lib/site-packages/numpy/__init__.cython-30.pxd", + "spacy/lexeme.pxd", + "spacy/pipeline/_parser_internals/_state.pxd", + "cpython/type.pxd", + "cymem/cymem.pxd", + "preshed/maps.pxd", + "spacy/strings.pxd", + "spacy/morphology.pxd", + "spacy/vocab.pxd", +}; +/* #### Code section: utility_code_proto_before_types ### */ +/* ForceInitThreads.proto */ +#ifndef __PYX_FORCE_INIT_THREADS + #define __PYX_FORCE_INIT_THREADS 0 +#endif + +/* NoFastGil.proto */ +#define __Pyx_PyGILState_Ensure PyGILState_Ensure +#define __Pyx_PyGILState_Release PyGILState_Release +#define __Pyx_FastGIL_Remember() +#define __Pyx_FastGIL_Forget() +#define __Pyx_FastGilFuncInit() + +/* Atomics.proto (used by CodeObjectCache) */ +#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 + +/* #### Code section: numeric_typedefs ### */ + +/* "C:/Users/runneradmin/AppData/Local/Temp/build-env-ej_q3m8u/Lib/site-packages/numpy/__init__.cython-30.pxd":743 + * # in Cython to enable them only on the right systems. + * + * ctypedef npy_int8 int8_t # <<<<<<<<<<<<<< + * ctypedef npy_int16 int16_t + * ctypedef npy_int32 int32_t +*/ +typedef npy_int8 __pyx_t_5numpy_int8_t; + +/* "C:/Users/runneradmin/AppData/Local/Temp/build-env-ej_q3m8u/Lib/site-packages/numpy/__init__.cython-30.pxd":744 + * + * ctypedef npy_int8 int8_t + * ctypedef npy_int16 int16_t # <<<<<<<<<<<<<< + * ctypedef npy_int32 int32_t + * ctypedef npy_int64 int64_t +*/ +typedef npy_int16 __pyx_t_5numpy_int16_t; + +/* "C:/Users/runneradmin/AppData/Local/Temp/build-env-ej_q3m8u/Lib/site-packages/numpy/__init__.cython-30.pxd":745 + * ctypedef npy_int8 int8_t + * ctypedef npy_int16 int16_t + * ctypedef npy_int32 int32_t # <<<<<<<<<<<<<< + * ctypedef npy_int64 int64_t + * +*/ +typedef npy_int32 __pyx_t_5numpy_int32_t; + +/* "C:/Users/runneradmin/AppData/Local/Temp/build-env-ej_q3m8u/Lib/site-packages/numpy/__init__.cython-30.pxd":746 + * ctypedef npy_int16 int16_t + * ctypedef npy_int32 int32_t + * ctypedef npy_int64 int64_t # <<<<<<<<<<<<<< + * + * ctypedef npy_uint8 uint8_t +*/ +typedef npy_int64 __pyx_t_5numpy_int64_t; + +/* "C:/Users/runneradmin/AppData/Local/Temp/build-env-ej_q3m8u/Lib/site-packages/numpy/__init__.cython-30.pxd":748 + * ctypedef npy_int64 int64_t + * + * ctypedef npy_uint8 uint8_t # <<<<<<<<<<<<<< + * ctypedef npy_uint16 uint16_t + * ctypedef npy_uint32 uint32_t +*/ +typedef npy_uint8 __pyx_t_5numpy_uint8_t; + +/* "C:/Users/runneradmin/AppData/Local/Temp/build-env-ej_q3m8u/Lib/site-packages/numpy/__init__.cython-30.pxd":749 + * + * ctypedef npy_uint8 uint8_t + * ctypedef npy_uint16 uint16_t # <<<<<<<<<<<<<< + * ctypedef npy_uint32 uint32_t + * ctypedef npy_uint64 uint64_t +*/ +typedef npy_uint16 __pyx_t_5numpy_uint16_t; + +/* "C:/Users/runneradmin/AppData/Local/Temp/build-env-ej_q3m8u/Lib/site-packages/numpy/__init__.cython-30.pxd":750 + * ctypedef npy_uint8 uint8_t + * ctypedef npy_uint16 uint16_t + * ctypedef npy_uint32 uint32_t # <<<<<<<<<<<<<< + * ctypedef npy_uint64 uint64_t + * +*/ +typedef npy_uint32 __pyx_t_5numpy_uint32_t; + +/* "C:/Users/runneradmin/AppData/Local/Temp/build-env-ej_q3m8u/Lib/site-packages/numpy/__init__.cython-30.pxd":751 + * ctypedef npy_uint16 uint16_t + * ctypedef npy_uint32 uint32_t + * ctypedef npy_uint64 uint64_t # <<<<<<<<<<<<<< + * + * ctypedef npy_float32 float32_t +*/ +typedef npy_uint64 __pyx_t_5numpy_uint64_t; + +/* "C:/Users/runneradmin/AppData/Local/Temp/build-env-ej_q3m8u/Lib/site-packages/numpy/__init__.cython-30.pxd":753 + * ctypedef npy_uint64 uint64_t + * + * ctypedef npy_float32 float32_t # <<<<<<<<<<<<<< + * ctypedef npy_float64 float64_t + * #ctypedef npy_float80 float80_t +*/ +typedef npy_float32 __pyx_t_5numpy_float32_t; + +/* "C:/Users/runneradmin/AppData/Local/Temp/build-env-ej_q3m8u/Lib/site-packages/numpy/__init__.cython-30.pxd":754 + * + * ctypedef npy_float32 float32_t + * ctypedef npy_float64 float64_t # <<<<<<<<<<<<<< + * #ctypedef npy_float80 float80_t + * #ctypedef npy_float128 float128_t +*/ +typedef npy_float64 __pyx_t_5numpy_float64_t; + +/* "C:/Users/runneradmin/AppData/Local/Temp/build-env-ej_q3m8u/Lib/site-packages/numpy/__init__.cython-30.pxd":761 + * ctypedef double complex complex128_t + * + * ctypedef npy_longlong longlong_t # <<<<<<<<<<<<<< + * ctypedef npy_ulonglong ulonglong_t + * +*/ +typedef npy_longlong __pyx_t_5numpy_longlong_t; + +/* "C:/Users/runneradmin/AppData/Local/Temp/build-env-ej_q3m8u/Lib/site-packages/numpy/__init__.cython-30.pxd":762 + * + * ctypedef npy_longlong longlong_t + * ctypedef npy_ulonglong ulonglong_t # <<<<<<<<<<<<<< + * + * ctypedef npy_intp intp_t +*/ +typedef npy_ulonglong __pyx_t_5numpy_ulonglong_t; + +/* "C:/Users/runneradmin/AppData/Local/Temp/build-env-ej_q3m8u/Lib/site-packages/numpy/__init__.cython-30.pxd":764 + * ctypedef npy_ulonglong ulonglong_t + * + * ctypedef npy_intp intp_t # <<<<<<<<<<<<<< + * ctypedef npy_uintp uintp_t + * +*/ +typedef npy_intp __pyx_t_5numpy_intp_t; + +/* "C:/Users/runneradmin/AppData/Local/Temp/build-env-ej_q3m8u/Lib/site-packages/numpy/__init__.cython-30.pxd":765 + * + * ctypedef npy_intp intp_t + * ctypedef npy_uintp uintp_t # <<<<<<<<<<<<<< + * + * ctypedef npy_double float_t +*/ +typedef npy_uintp __pyx_t_5numpy_uintp_t; + +/* "C:/Users/runneradmin/AppData/Local/Temp/build-env-ej_q3m8u/Lib/site-packages/numpy/__init__.cython-30.pxd":767 + * ctypedef npy_uintp uintp_t + * + * ctypedef npy_double float_t # <<<<<<<<<<<<<< + * ctypedef npy_double double_t + * ctypedef npy_longdouble longdouble_t +*/ +typedef npy_double __pyx_t_5numpy_float_t; + +/* "C:/Users/runneradmin/AppData/Local/Temp/build-env-ej_q3m8u/Lib/site-packages/numpy/__init__.cython-30.pxd":768 + * + * ctypedef npy_double float_t + * ctypedef npy_double double_t # <<<<<<<<<<<<<< + * ctypedef npy_longdouble longdouble_t + * +*/ +typedef npy_double __pyx_t_5numpy_double_t; + +/* "C:/Users/runneradmin/AppData/Local/Temp/build-env-ej_q3m8u/Lib/site-packages/numpy/__init__.cython-30.pxd":769 + * ctypedef npy_double float_t + * ctypedef npy_double double_t + * ctypedef npy_longdouble longdouble_t # <<<<<<<<<<<<<< + * + * ctypedef float complex cfloat_t +*/ +typedef npy_longdouble __pyx_t_5numpy_longdouble_t; + +/* "preshed/maps.pxd":5 + * + * + * ctypedef uint64_t key_t # <<<<<<<<<<<<<< + * + * +*/ +typedef uint64_t __pyx_t_7preshed_4maps_key_t; + +/* "typedefs.pxd":3 + * from libc.stdint cimport int32_t, uint8_t, uint16_t, uint32_t, uint64_t, uintptr_t + * + * ctypedef float weight_t # <<<<<<<<<<<<<< + * ctypedef uint64_t hash_t + * ctypedef uint64_t class_t +*/ +typedef float __pyx_t_5spacy_8typedefs_weight_t; + +/* "typedefs.pxd":4 + * + * ctypedef float weight_t + * ctypedef uint64_t hash_t # <<<<<<<<<<<<<< + * ctypedef uint64_t class_t + * ctypedef uint64_t attr_t +*/ +typedef uint64_t __pyx_t_5spacy_8typedefs_hash_t; + +/* "typedefs.pxd":5 + * ctypedef float weight_t + * ctypedef uint64_t hash_t + * ctypedef uint64_t class_t # <<<<<<<<<<<<<< + * ctypedef uint64_t attr_t + * ctypedef uint64_t flags_t +*/ +typedef uint64_t __pyx_t_5spacy_8typedefs_class_t; + +/* "typedefs.pxd":6 + * ctypedef uint64_t hash_t + * ctypedef uint64_t class_t + * ctypedef uint64_t attr_t # <<<<<<<<<<<<<< + * ctypedef uint64_t flags_t + * ctypedef uint16_t len_t +*/ +typedef uint64_t __pyx_t_5spacy_8typedefs_attr_t; + +/* "typedefs.pxd":7 + * ctypedef uint64_t class_t + * ctypedef uint64_t attr_t + * ctypedef uint64_t flags_t # <<<<<<<<<<<<<< + * ctypedef uint16_t len_t + * ctypedef uint16_t tag_t +*/ +typedef uint64_t __pyx_t_5spacy_8typedefs_flags_t; + +/* "typedefs.pxd":8 + * ctypedef uint64_t attr_t + * ctypedef uint64_t flags_t + * ctypedef uint16_t len_t # <<<<<<<<<<<<<< + * ctypedef uint16_t tag_t +*/ +typedef uint16_t __pyx_t_5spacy_8typedefs_len_t; + +/* "typedefs.pxd":9 + * ctypedef uint64_t flags_t + * ctypedef uint16_t len_t + * ctypedef uint16_t tag_t # <<<<<<<<<<<<<< +*/ +typedef uint16_t __pyx_t_5spacy_8typedefs_tag_t; +/* #### Code section: complex_type_declarations ### */ +/* Declarations.proto */ +#if CYTHON_CCOMPLEX && (1) && (!0 || __cplusplus) + #ifdef __cplusplus + typedef ::std::complex< float > __pyx_t_float_complex; + #else + typedef float _Complex __pyx_t_float_complex; + #endif +#else + typedef struct { float real, imag; } __pyx_t_float_complex; +#endif +static CYTHON_INLINE __pyx_t_float_complex __pyx_t_float_complex_from_parts(float, float); + +/* Declarations.proto */ +#if CYTHON_CCOMPLEX && (1) && (!0 || __cplusplus) + #ifdef __cplusplus + typedef ::std::complex< double > __pyx_t_double_complex; + #else + typedef double _Complex __pyx_t_double_complex; + #endif +#else + typedef struct { double real, imag; } __pyx_t_double_complex; +#endif +static CYTHON_INLINE __pyx_t_double_complex __pyx_t_double_complex_from_parts(double, double); + +/* Declarations.proto */ +#if CYTHON_CCOMPLEX && (1) && (!0 || __cplusplus) + #ifdef __cplusplus + typedef ::std::complex< long double > __pyx_t_long_double_complex; + #else + typedef long double _Complex __pyx_t_long_double_complex; + #endif +#else + typedef struct { long double real, imag; } __pyx_t_long_double_complex; +#endif +static CYTHON_INLINE __pyx_t_long_double_complex __pyx_t_long_double_complex_from_parts(long double, long double); + +/* #### Code section: type_declarations ### */ + +/*--- Type declarations ---*/ +struct __pyx_obj_5cymem_5cymem_PyMalloc; +struct __pyx_obj_5cymem_5cymem_PyFree; +struct __pyx_obj_5cymem_5cymem_Pool; +struct __pyx_obj_5cymem_5cymem_Address; +struct __pyx_obj_7preshed_4maps_PreshMap; +struct __pyx_obj_7preshed_4maps_PreshMapArray; +struct __pyx_obj_5spacy_7strings_StringStore; +struct __pyx_obj_5spacy_10morphology_Morphology; +struct __pyx_obj_5spacy_5vocab_Vocab; +struct __pyx_obj_5spacy_6lexeme_Lexeme; + +/* "symbols.pxd":1 + * cdef enum symbol_t: # <<<<<<<<<<<<<< + * NIL + * IS_ALPHA +*/ +enum __pyx_t_5spacy_7symbols_symbol_t { + __pyx_e_5spacy_7symbols_NIL, + __pyx_e_5spacy_7symbols_IS_ALPHA, + __pyx_e_5spacy_7symbols_IS_ASCII, + __pyx_e_5spacy_7symbols_IS_DIGIT, + __pyx_e_5spacy_7symbols_IS_LOWER, + __pyx_e_5spacy_7symbols_IS_PUNCT, + __pyx_e_5spacy_7symbols_IS_SPACE, + __pyx_e_5spacy_7symbols_IS_TITLE, + __pyx_e_5spacy_7symbols_IS_UPPER, + __pyx_e_5spacy_7symbols_LIKE_URL, + __pyx_e_5spacy_7symbols_LIKE_NUM, + __pyx_e_5spacy_7symbols_LIKE_EMAIL, + __pyx_e_5spacy_7symbols_IS_STOP, + __pyx_e_5spacy_7symbols_IS_OOV_DEPRECATED, + __pyx_e_5spacy_7symbols_IS_BRACKET, + __pyx_e_5spacy_7symbols_IS_QUOTE, + __pyx_e_5spacy_7symbols_IS_LEFT_PUNCT, + __pyx_e_5spacy_7symbols_IS_RIGHT_PUNCT, + __pyx_e_5spacy_7symbols_IS_CURRENCY, + __pyx_e_5spacy_7symbols_FLAG19 = 19, + __pyx_e_5spacy_7symbols_FLAG20, + __pyx_e_5spacy_7symbols_FLAG21, + __pyx_e_5spacy_7symbols_FLAG22, + __pyx_e_5spacy_7symbols_FLAG23, + __pyx_e_5spacy_7symbols_FLAG24, + __pyx_e_5spacy_7symbols_FLAG25, + __pyx_e_5spacy_7symbols_FLAG26, + __pyx_e_5spacy_7symbols_FLAG27, + __pyx_e_5spacy_7symbols_FLAG28, + __pyx_e_5spacy_7symbols_FLAG29, + __pyx_e_5spacy_7symbols_FLAG30, + __pyx_e_5spacy_7symbols_FLAG31, + __pyx_e_5spacy_7symbols_FLAG32, + __pyx_e_5spacy_7symbols_FLAG33, + __pyx_e_5spacy_7symbols_FLAG34, + __pyx_e_5spacy_7symbols_FLAG35, + __pyx_e_5spacy_7symbols_FLAG36, + __pyx_e_5spacy_7symbols_FLAG37, + __pyx_e_5spacy_7symbols_FLAG38, + __pyx_e_5spacy_7symbols_FLAG39, + __pyx_e_5spacy_7symbols_FLAG40, + __pyx_e_5spacy_7symbols_FLAG41, + __pyx_e_5spacy_7symbols_FLAG42, + __pyx_e_5spacy_7symbols_FLAG43, + __pyx_e_5spacy_7symbols_FLAG44, + __pyx_e_5spacy_7symbols_FLAG45, + __pyx_e_5spacy_7symbols_FLAG46, + __pyx_e_5spacy_7symbols_FLAG47, + __pyx_e_5spacy_7symbols_FLAG48, + __pyx_e_5spacy_7symbols_FLAG49, + __pyx_e_5spacy_7symbols_FLAG50, + __pyx_e_5spacy_7symbols_FLAG51, + __pyx_e_5spacy_7symbols_FLAG52, + __pyx_e_5spacy_7symbols_FLAG53, + __pyx_e_5spacy_7symbols_FLAG54, + __pyx_e_5spacy_7symbols_FLAG55, + __pyx_e_5spacy_7symbols_FLAG56, + __pyx_e_5spacy_7symbols_FLAG57, + __pyx_e_5spacy_7symbols_FLAG58, + __pyx_e_5spacy_7symbols_FLAG59, + __pyx_e_5spacy_7symbols_FLAG60, + __pyx_e_5spacy_7symbols_FLAG61, + __pyx_e_5spacy_7symbols_FLAG62, + __pyx_e_5spacy_7symbols_FLAG63, + __pyx_e_5spacy_7symbols_ID, + __pyx_e_5spacy_7symbols_ORTH, + __pyx_e_5spacy_7symbols_LOWER, + __pyx_e_5spacy_7symbols_NORM, + __pyx_e_5spacy_7symbols_SHAPE, + __pyx_e_5spacy_7symbols_PREFIX, + __pyx_e_5spacy_7symbols_SUFFIX, + __pyx_e_5spacy_7symbols_LENGTH, + __pyx_e_5spacy_7symbols_CLUSTER, + __pyx_e_5spacy_7symbols_LEMMA, + __pyx_e_5spacy_7symbols_POS, + __pyx_e_5spacy_7symbols_TAG, + __pyx_e_5spacy_7symbols_DEP, + __pyx_e_5spacy_7symbols_ENT_IOB, + __pyx_e_5spacy_7symbols_ENT_TYPE, + __pyx_e_5spacy_7symbols_HEAD, + __pyx_e_5spacy_7symbols_SENT_START, + __pyx_e_5spacy_7symbols_SPACY, + __pyx_e_5spacy_7symbols_PROB, + __pyx_e_5spacy_7symbols_LANG, + __pyx_e_5spacy_7symbols_ADJ, + __pyx_e_5spacy_7symbols_ADP, + __pyx_e_5spacy_7symbols_ADV, + __pyx_e_5spacy_7symbols_AUX, + __pyx_e_5spacy_7symbols_CONJ, + __pyx_e_5spacy_7symbols_CCONJ, + __pyx_e_5spacy_7symbols_DET, + __pyx_e_5spacy_7symbols_INTJ, + __pyx_e_5spacy_7symbols_NOUN, + __pyx_e_5spacy_7symbols_NUM, + __pyx_e_5spacy_7symbols_PART, + __pyx_e_5spacy_7symbols_PRON, + __pyx_e_5spacy_7symbols_PROPN, + __pyx_e_5spacy_7symbols_PUNCT, + __pyx_e_5spacy_7symbols_SCONJ, + __pyx_e_5spacy_7symbols_SYM, + __pyx_e_5spacy_7symbols_VERB, + __pyx_e_5spacy_7symbols_X, + __pyx_e_5spacy_7symbols_EOL, + __pyx_e_5spacy_7symbols_SPACE, + __pyx_e_5spacy_7symbols_DEPRECATED001, + __pyx_e_5spacy_7symbols_DEPRECATED002, + __pyx_e_5spacy_7symbols_DEPRECATED003, + __pyx_e_5spacy_7symbols_DEPRECATED004, + __pyx_e_5spacy_7symbols_DEPRECATED005, + __pyx_e_5spacy_7symbols_DEPRECATED006, + __pyx_e_5spacy_7symbols_DEPRECATED007, + __pyx_e_5spacy_7symbols_DEPRECATED008, + __pyx_e_5spacy_7symbols_DEPRECATED009, + __pyx_e_5spacy_7symbols_DEPRECATED010, + __pyx_e_5spacy_7symbols_DEPRECATED011, + __pyx_e_5spacy_7symbols_DEPRECATED012, + __pyx_e_5spacy_7symbols_DEPRECATED013, + __pyx_e_5spacy_7symbols_DEPRECATED014, + __pyx_e_5spacy_7symbols_DEPRECATED015, + __pyx_e_5spacy_7symbols_DEPRECATED016, + __pyx_e_5spacy_7symbols_DEPRECATED017, + __pyx_e_5spacy_7symbols_DEPRECATED018, + __pyx_e_5spacy_7symbols_DEPRECATED019, + __pyx_e_5spacy_7symbols_DEPRECATED020, + __pyx_e_5spacy_7symbols_DEPRECATED021, + __pyx_e_5spacy_7symbols_DEPRECATED022, + __pyx_e_5spacy_7symbols_DEPRECATED023, + __pyx_e_5spacy_7symbols_DEPRECATED024, + __pyx_e_5spacy_7symbols_DEPRECATED025, + __pyx_e_5spacy_7symbols_DEPRECATED026, + __pyx_e_5spacy_7symbols_DEPRECATED027, + __pyx_e_5spacy_7symbols_DEPRECATED028, + __pyx_e_5spacy_7symbols_DEPRECATED029, + __pyx_e_5spacy_7symbols_DEPRECATED030, + __pyx_e_5spacy_7symbols_DEPRECATED031, + __pyx_e_5spacy_7symbols_DEPRECATED032, + __pyx_e_5spacy_7symbols_DEPRECATED033, + __pyx_e_5spacy_7symbols_DEPRECATED034, + __pyx_e_5spacy_7symbols_DEPRECATED035, + __pyx_e_5spacy_7symbols_DEPRECATED036, + __pyx_e_5spacy_7symbols_DEPRECATED037, + __pyx_e_5spacy_7symbols_DEPRECATED038, + __pyx_e_5spacy_7symbols_DEPRECATED039, + __pyx_e_5spacy_7symbols_DEPRECATED040, + __pyx_e_5spacy_7symbols_DEPRECATED041, + __pyx_e_5spacy_7symbols_DEPRECATED042, + __pyx_e_5spacy_7symbols_DEPRECATED043, + __pyx_e_5spacy_7symbols_DEPRECATED044, + __pyx_e_5spacy_7symbols_DEPRECATED045, + __pyx_e_5spacy_7symbols_DEPRECATED046, + __pyx_e_5spacy_7symbols_DEPRECATED047, + __pyx_e_5spacy_7symbols_DEPRECATED048, + __pyx_e_5spacy_7symbols_DEPRECATED049, + __pyx_e_5spacy_7symbols_DEPRECATED050, + __pyx_e_5spacy_7symbols_DEPRECATED051, + __pyx_e_5spacy_7symbols_DEPRECATED052, + __pyx_e_5spacy_7symbols_DEPRECATED053, + __pyx_e_5spacy_7symbols_DEPRECATED054, + __pyx_e_5spacy_7symbols_DEPRECATED055, + __pyx_e_5spacy_7symbols_DEPRECATED056, + __pyx_e_5spacy_7symbols_DEPRECATED057, + __pyx_e_5spacy_7symbols_DEPRECATED058, + __pyx_e_5spacy_7symbols_DEPRECATED059, + __pyx_e_5spacy_7symbols_DEPRECATED060, + __pyx_e_5spacy_7symbols_DEPRECATED061, + __pyx_e_5spacy_7symbols_DEPRECATED062, + __pyx_e_5spacy_7symbols_DEPRECATED063, + __pyx_e_5spacy_7symbols_DEPRECATED064, + __pyx_e_5spacy_7symbols_DEPRECATED065, + __pyx_e_5spacy_7symbols_DEPRECATED066, + __pyx_e_5spacy_7symbols_DEPRECATED067, + __pyx_e_5spacy_7symbols_DEPRECATED068, + __pyx_e_5spacy_7symbols_DEPRECATED069, + __pyx_e_5spacy_7symbols_DEPRECATED070, + __pyx_e_5spacy_7symbols_DEPRECATED071, + __pyx_e_5spacy_7symbols_DEPRECATED072, + __pyx_e_5spacy_7symbols_DEPRECATED073, + __pyx_e_5spacy_7symbols_DEPRECATED074, + __pyx_e_5spacy_7symbols_DEPRECATED075, + __pyx_e_5spacy_7symbols_DEPRECATED076, + __pyx_e_5spacy_7symbols_DEPRECATED077, + __pyx_e_5spacy_7symbols_DEPRECATED078, + __pyx_e_5spacy_7symbols_DEPRECATED079, + __pyx_e_5spacy_7symbols_DEPRECATED080, + __pyx_e_5spacy_7symbols_DEPRECATED081, + __pyx_e_5spacy_7symbols_DEPRECATED082, + __pyx_e_5spacy_7symbols_DEPRECATED083, + __pyx_e_5spacy_7symbols_DEPRECATED084, + __pyx_e_5spacy_7symbols_DEPRECATED085, + __pyx_e_5spacy_7symbols_DEPRECATED086, + __pyx_e_5spacy_7symbols_DEPRECATED087, + __pyx_e_5spacy_7symbols_DEPRECATED088, + __pyx_e_5spacy_7symbols_DEPRECATED089, + __pyx_e_5spacy_7symbols_DEPRECATED090, + __pyx_e_5spacy_7symbols_DEPRECATED091, + __pyx_e_5spacy_7symbols_DEPRECATED092, + __pyx_e_5spacy_7symbols_DEPRECATED093, + __pyx_e_5spacy_7symbols_DEPRECATED094, + __pyx_e_5spacy_7symbols_DEPRECATED095, + __pyx_e_5spacy_7symbols_DEPRECATED096, + __pyx_e_5spacy_7symbols_DEPRECATED097, + __pyx_e_5spacy_7symbols_DEPRECATED098, + __pyx_e_5spacy_7symbols_DEPRECATED099, + __pyx_e_5spacy_7symbols_DEPRECATED100, + __pyx_e_5spacy_7symbols_DEPRECATED101, + __pyx_e_5spacy_7symbols_DEPRECATED102, + __pyx_e_5spacy_7symbols_DEPRECATED103, + __pyx_e_5spacy_7symbols_DEPRECATED104, + __pyx_e_5spacy_7symbols_DEPRECATED105, + __pyx_e_5spacy_7symbols_DEPRECATED106, + __pyx_e_5spacy_7symbols_DEPRECATED107, + __pyx_e_5spacy_7symbols_DEPRECATED108, + __pyx_e_5spacy_7symbols_DEPRECATED109, + __pyx_e_5spacy_7symbols_DEPRECATED110, + __pyx_e_5spacy_7symbols_DEPRECATED111, + __pyx_e_5spacy_7symbols_DEPRECATED112, + __pyx_e_5spacy_7symbols_DEPRECATED113, + __pyx_e_5spacy_7symbols_DEPRECATED114, + __pyx_e_5spacy_7symbols_DEPRECATED115, + __pyx_e_5spacy_7symbols_DEPRECATED116, + __pyx_e_5spacy_7symbols_DEPRECATED117, + __pyx_e_5spacy_7symbols_DEPRECATED118, + __pyx_e_5spacy_7symbols_DEPRECATED119, + __pyx_e_5spacy_7symbols_DEPRECATED120, + __pyx_e_5spacy_7symbols_DEPRECATED121, + __pyx_e_5spacy_7symbols_DEPRECATED122, + __pyx_e_5spacy_7symbols_DEPRECATED123, + __pyx_e_5spacy_7symbols_DEPRECATED124, + __pyx_e_5spacy_7symbols_DEPRECATED125, + __pyx_e_5spacy_7symbols_DEPRECATED126, + __pyx_e_5spacy_7symbols_DEPRECATED127, + __pyx_e_5spacy_7symbols_DEPRECATED128, + __pyx_e_5spacy_7symbols_DEPRECATED129, + __pyx_e_5spacy_7symbols_DEPRECATED130, + __pyx_e_5spacy_7symbols_DEPRECATED131, + __pyx_e_5spacy_7symbols_DEPRECATED132, + __pyx_e_5spacy_7symbols_DEPRECATED133, + __pyx_e_5spacy_7symbols_DEPRECATED134, + __pyx_e_5spacy_7symbols_DEPRECATED135, + __pyx_e_5spacy_7symbols_DEPRECATED136, + __pyx_e_5spacy_7symbols_DEPRECATED137, + __pyx_e_5spacy_7symbols_DEPRECATED138, + __pyx_e_5spacy_7symbols_DEPRECATED139, + __pyx_e_5spacy_7symbols_DEPRECATED140, + __pyx_e_5spacy_7symbols_DEPRECATED141, + __pyx_e_5spacy_7symbols_DEPRECATED142, + __pyx_e_5spacy_7symbols_DEPRECATED143, + __pyx_e_5spacy_7symbols_DEPRECATED144, + __pyx_e_5spacy_7symbols_DEPRECATED145, + __pyx_e_5spacy_7symbols_DEPRECATED146, + __pyx_e_5spacy_7symbols_DEPRECATED147, + __pyx_e_5spacy_7symbols_DEPRECATED148, + __pyx_e_5spacy_7symbols_DEPRECATED149, + __pyx_e_5spacy_7symbols_DEPRECATED150, + __pyx_e_5spacy_7symbols_DEPRECATED151, + __pyx_e_5spacy_7symbols_DEPRECATED152, + __pyx_e_5spacy_7symbols_DEPRECATED153, + __pyx_e_5spacy_7symbols_DEPRECATED154, + __pyx_e_5spacy_7symbols_DEPRECATED155, + __pyx_e_5spacy_7symbols_DEPRECATED156, + __pyx_e_5spacy_7symbols_DEPRECATED157, + __pyx_e_5spacy_7symbols_DEPRECATED158, + __pyx_e_5spacy_7symbols_DEPRECATED159, + __pyx_e_5spacy_7symbols_DEPRECATED160, + __pyx_e_5spacy_7symbols_DEPRECATED161, + __pyx_e_5spacy_7symbols_DEPRECATED162, + __pyx_e_5spacy_7symbols_DEPRECATED163, + __pyx_e_5spacy_7symbols_DEPRECATED164, + __pyx_e_5spacy_7symbols_DEPRECATED165, + __pyx_e_5spacy_7symbols_DEPRECATED166, + __pyx_e_5spacy_7symbols_DEPRECATED167, + __pyx_e_5spacy_7symbols_DEPRECATED168, + __pyx_e_5spacy_7symbols_DEPRECATED169, + __pyx_e_5spacy_7symbols_DEPRECATED170, + __pyx_e_5spacy_7symbols_DEPRECATED171, + __pyx_e_5spacy_7symbols_DEPRECATED172, + __pyx_e_5spacy_7symbols_DEPRECATED173, + __pyx_e_5spacy_7symbols_DEPRECATED174, + __pyx_e_5spacy_7symbols_DEPRECATED175, + __pyx_e_5spacy_7symbols_DEPRECATED176, + __pyx_e_5spacy_7symbols_DEPRECATED177, + __pyx_e_5spacy_7symbols_DEPRECATED178, + __pyx_e_5spacy_7symbols_DEPRECATED179, + __pyx_e_5spacy_7symbols_DEPRECATED180, + __pyx_e_5spacy_7symbols_DEPRECATED181, + __pyx_e_5spacy_7symbols_DEPRECATED182, + __pyx_e_5spacy_7symbols_DEPRECATED183, + __pyx_e_5spacy_7symbols_DEPRECATED184, + __pyx_e_5spacy_7symbols_DEPRECATED185, + __pyx_e_5spacy_7symbols_DEPRECATED186, + __pyx_e_5spacy_7symbols_DEPRECATED187, + __pyx_e_5spacy_7symbols_DEPRECATED188, + __pyx_e_5spacy_7symbols_DEPRECATED189, + __pyx_e_5spacy_7symbols_DEPRECATED190, + __pyx_e_5spacy_7symbols_DEPRECATED191, + __pyx_e_5spacy_7symbols_DEPRECATED192, + __pyx_e_5spacy_7symbols_DEPRECATED193, + __pyx_e_5spacy_7symbols_DEPRECATED194, + __pyx_e_5spacy_7symbols_DEPRECATED195, + __pyx_e_5spacy_7symbols_DEPRECATED196, + __pyx_e_5spacy_7symbols_DEPRECATED197, + __pyx_e_5spacy_7symbols_DEPRECATED198, + __pyx_e_5spacy_7symbols_DEPRECATED199, + __pyx_e_5spacy_7symbols_DEPRECATED200, + __pyx_e_5spacy_7symbols_DEPRECATED201, + __pyx_e_5spacy_7symbols_DEPRECATED202, + __pyx_e_5spacy_7symbols_DEPRECATED203, + __pyx_e_5spacy_7symbols_DEPRECATED204, + __pyx_e_5spacy_7symbols_DEPRECATED205, + __pyx_e_5spacy_7symbols_DEPRECATED206, + __pyx_e_5spacy_7symbols_DEPRECATED207, + __pyx_e_5spacy_7symbols_DEPRECATED208, + __pyx_e_5spacy_7symbols_DEPRECATED209, + __pyx_e_5spacy_7symbols_DEPRECATED210, + __pyx_e_5spacy_7symbols_DEPRECATED211, + __pyx_e_5spacy_7symbols_DEPRECATED212, + __pyx_e_5spacy_7symbols_DEPRECATED213, + __pyx_e_5spacy_7symbols_DEPRECATED214, + __pyx_e_5spacy_7symbols_DEPRECATED215, + __pyx_e_5spacy_7symbols_DEPRECATED216, + __pyx_e_5spacy_7symbols_DEPRECATED217, + __pyx_e_5spacy_7symbols_DEPRECATED218, + __pyx_e_5spacy_7symbols_DEPRECATED219, + __pyx_e_5spacy_7symbols_DEPRECATED220, + __pyx_e_5spacy_7symbols_DEPRECATED221, + __pyx_e_5spacy_7symbols_DEPRECATED222, + __pyx_e_5spacy_7symbols_DEPRECATED223, + __pyx_e_5spacy_7symbols_DEPRECATED224, + __pyx_e_5spacy_7symbols_DEPRECATED225, + __pyx_e_5spacy_7symbols_DEPRECATED226, + __pyx_e_5spacy_7symbols_DEPRECATED227, + __pyx_e_5spacy_7symbols_DEPRECATED228, + __pyx_e_5spacy_7symbols_DEPRECATED229, + __pyx_e_5spacy_7symbols_DEPRECATED230, + __pyx_e_5spacy_7symbols_DEPRECATED231, + __pyx_e_5spacy_7symbols_DEPRECATED232, + __pyx_e_5spacy_7symbols_DEPRECATED233, + __pyx_e_5spacy_7symbols_DEPRECATED234, + __pyx_e_5spacy_7symbols_DEPRECATED235, + __pyx_e_5spacy_7symbols_DEPRECATED236, + __pyx_e_5spacy_7symbols_DEPRECATED237, + __pyx_e_5spacy_7symbols_DEPRECATED238, + __pyx_e_5spacy_7symbols_DEPRECATED239, + __pyx_e_5spacy_7symbols_DEPRECATED240, + __pyx_e_5spacy_7symbols_DEPRECATED241, + __pyx_e_5spacy_7symbols_DEPRECATED242, + __pyx_e_5spacy_7symbols_DEPRECATED243, + __pyx_e_5spacy_7symbols_DEPRECATED244, + __pyx_e_5spacy_7symbols_DEPRECATED245, + __pyx_e_5spacy_7symbols_DEPRECATED246, + __pyx_e_5spacy_7symbols_DEPRECATED247, + __pyx_e_5spacy_7symbols_DEPRECATED248, + __pyx_e_5spacy_7symbols_DEPRECATED249, + __pyx_e_5spacy_7symbols_DEPRECATED250, + __pyx_e_5spacy_7symbols_DEPRECATED251, + __pyx_e_5spacy_7symbols_DEPRECATED252, + __pyx_e_5spacy_7symbols_DEPRECATED253, + __pyx_e_5spacy_7symbols_DEPRECATED254, + __pyx_e_5spacy_7symbols_DEPRECATED255, + __pyx_e_5spacy_7symbols_DEPRECATED256, + __pyx_e_5spacy_7symbols_DEPRECATED257, + __pyx_e_5spacy_7symbols_DEPRECATED258, + __pyx_e_5spacy_7symbols_DEPRECATED259, + __pyx_e_5spacy_7symbols_DEPRECATED260, + __pyx_e_5spacy_7symbols_DEPRECATED261, + __pyx_e_5spacy_7symbols_DEPRECATED262, + __pyx_e_5spacy_7symbols_DEPRECATED263, + __pyx_e_5spacy_7symbols_DEPRECATED264, + __pyx_e_5spacy_7symbols_DEPRECATED265, + __pyx_e_5spacy_7symbols_DEPRECATED266, + __pyx_e_5spacy_7symbols_DEPRECATED267, + __pyx_e_5spacy_7symbols_DEPRECATED268, + __pyx_e_5spacy_7symbols_DEPRECATED269, + __pyx_e_5spacy_7symbols_DEPRECATED270, + __pyx_e_5spacy_7symbols_DEPRECATED271, + __pyx_e_5spacy_7symbols_DEPRECATED272, + __pyx_e_5spacy_7symbols_DEPRECATED273, + __pyx_e_5spacy_7symbols_DEPRECATED274, + __pyx_e_5spacy_7symbols_DEPRECATED275, + __pyx_e_5spacy_7symbols_DEPRECATED276, + __pyx_e_5spacy_7symbols_PERSON, + __pyx_e_5spacy_7symbols_NORP, + __pyx_e_5spacy_7symbols_FACILITY, + __pyx_e_5spacy_7symbols_ORG, + __pyx_e_5spacy_7symbols_GPE, + __pyx_e_5spacy_7symbols_LOC, + __pyx_e_5spacy_7symbols_PRODUCT, + __pyx_e_5spacy_7symbols_EVENT, + __pyx_e_5spacy_7symbols_WORK_OF_ART, + __pyx_e_5spacy_7symbols_LANGUAGE, + __pyx_e_5spacy_7symbols_LAW, + __pyx_e_5spacy_7symbols_DATE, + __pyx_e_5spacy_7symbols_TIME, + __pyx_e_5spacy_7symbols_PERCENT, + __pyx_e_5spacy_7symbols_MONEY, + __pyx_e_5spacy_7symbols_QUANTITY, + __pyx_e_5spacy_7symbols_ORDINAL, + __pyx_e_5spacy_7symbols_CARDINAL, + __pyx_e_5spacy_7symbols_acomp, + __pyx_e_5spacy_7symbols_advcl, + __pyx_e_5spacy_7symbols_advmod, + __pyx_e_5spacy_7symbols_agent, + __pyx_e_5spacy_7symbols_amod, + __pyx_e_5spacy_7symbols_appos, + __pyx_e_5spacy_7symbols_attr, + __pyx_e_5spacy_7symbols_aux, + __pyx_e_5spacy_7symbols_auxpass, + __pyx_e_5spacy_7symbols_cc, + __pyx_e_5spacy_7symbols_ccomp, + __pyx_e_5spacy_7symbols_complm, + __pyx_e_5spacy_7symbols_conj, + __pyx_e_5spacy_7symbols_cop, + __pyx_e_5spacy_7symbols_csubj, + __pyx_e_5spacy_7symbols_csubjpass, + __pyx_e_5spacy_7symbols_dep, + __pyx_e_5spacy_7symbols_det, + __pyx_e_5spacy_7symbols_dobj, + __pyx_e_5spacy_7symbols_expl, + __pyx_e_5spacy_7symbols_hmod, + __pyx_e_5spacy_7symbols_hyph, + __pyx_e_5spacy_7symbols_infmod, + __pyx_e_5spacy_7symbols_intj, + __pyx_e_5spacy_7symbols_iobj, + __pyx_e_5spacy_7symbols_mark, + __pyx_e_5spacy_7symbols_meta, + __pyx_e_5spacy_7symbols_neg, + __pyx_e_5spacy_7symbols_nmod, + __pyx_e_5spacy_7symbols_nn, + __pyx_e_5spacy_7symbols_npadvmod, + __pyx_e_5spacy_7symbols_nsubj, + __pyx_e_5spacy_7symbols_nsubjpass, + __pyx_e_5spacy_7symbols_num, + __pyx_e_5spacy_7symbols_number, + __pyx_e_5spacy_7symbols_oprd, + __pyx_e_5spacy_7symbols_obj, + __pyx_e_5spacy_7symbols_obl, + __pyx_e_5spacy_7symbols_parataxis, + __pyx_e_5spacy_7symbols_partmod, + __pyx_e_5spacy_7symbols_pcomp, + __pyx_e_5spacy_7symbols_pobj, + __pyx_e_5spacy_7symbols_poss, + __pyx_e_5spacy_7symbols_possessive, + __pyx_e_5spacy_7symbols_preconj, + __pyx_e_5spacy_7symbols_prep, + __pyx_e_5spacy_7symbols_prt, + __pyx_e_5spacy_7symbols_punct, + __pyx_e_5spacy_7symbols_quantmod, + __pyx_e_5spacy_7symbols_relcl, + __pyx_e_5spacy_7symbols_rcmod, + __pyx_e_5spacy_7symbols_root, + __pyx_e_5spacy_7symbols_xcomp, + __pyx_e_5spacy_7symbols_acl, + __pyx_e_5spacy_7symbols_ENT_KB_ID, + __pyx_e_5spacy_7symbols_MORPH, + __pyx_e_5spacy_7symbols_ENT_ID, + __pyx_e_5spacy_7symbols_IDX, + __pyx_e_5spacy_7symbols__ +}; + +/* "attrs.pxd":5 + * + * + * cdef enum attr_id_t: # <<<<<<<<<<<<<< + * NULL_ATTR + * IS_ALPHA +*/ +enum __pyx_t_5spacy_5attrs_attr_id_t { + + /* "attrs.pxd":96 + * ENT_KB_ID = symbols.ENT_KB_ID + * MORPH + * ENT_ID = symbols.ENT_ID # <<<<<<<<<<<<<< + * + * IDX +*/ + __pyx_e_5spacy_5attrs_NULL_ATTR, + __pyx_e_5spacy_5attrs_IS_ALPHA, + __pyx_e_5spacy_5attrs_IS_ASCII, + __pyx_e_5spacy_5attrs_IS_DIGIT, + __pyx_e_5spacy_5attrs_IS_LOWER, + __pyx_e_5spacy_5attrs_IS_PUNCT, + __pyx_e_5spacy_5attrs_IS_SPACE, + __pyx_e_5spacy_5attrs_IS_TITLE, + __pyx_e_5spacy_5attrs_IS_UPPER, + __pyx_e_5spacy_5attrs_LIKE_URL, + __pyx_e_5spacy_5attrs_LIKE_NUM, + __pyx_e_5spacy_5attrs_LIKE_EMAIL, + __pyx_e_5spacy_5attrs_IS_STOP, + __pyx_e_5spacy_5attrs_IS_OOV_DEPRECATED, + __pyx_e_5spacy_5attrs_IS_BRACKET, + __pyx_e_5spacy_5attrs_IS_QUOTE, + __pyx_e_5spacy_5attrs_IS_LEFT_PUNCT, + __pyx_e_5spacy_5attrs_IS_RIGHT_PUNCT, + __pyx_e_5spacy_5attrs_IS_CURRENCY, + __pyx_e_5spacy_5attrs_FLAG19 = 19, + __pyx_e_5spacy_5attrs_FLAG20, + __pyx_e_5spacy_5attrs_FLAG21, + __pyx_e_5spacy_5attrs_FLAG22, + __pyx_e_5spacy_5attrs_FLAG23, + __pyx_e_5spacy_5attrs_FLAG24, + __pyx_e_5spacy_5attrs_FLAG25, + __pyx_e_5spacy_5attrs_FLAG26, + __pyx_e_5spacy_5attrs_FLAG27, + __pyx_e_5spacy_5attrs_FLAG28, + __pyx_e_5spacy_5attrs_FLAG29, + __pyx_e_5spacy_5attrs_FLAG30, + __pyx_e_5spacy_5attrs_FLAG31, + __pyx_e_5spacy_5attrs_FLAG32, + __pyx_e_5spacy_5attrs_FLAG33, + __pyx_e_5spacy_5attrs_FLAG34, + __pyx_e_5spacy_5attrs_FLAG35, + __pyx_e_5spacy_5attrs_FLAG36, + __pyx_e_5spacy_5attrs_FLAG37, + __pyx_e_5spacy_5attrs_FLAG38, + __pyx_e_5spacy_5attrs_FLAG39, + __pyx_e_5spacy_5attrs_FLAG40, + __pyx_e_5spacy_5attrs_FLAG41, + __pyx_e_5spacy_5attrs_FLAG42, + __pyx_e_5spacy_5attrs_FLAG43, + __pyx_e_5spacy_5attrs_FLAG44, + __pyx_e_5spacy_5attrs_FLAG45, + __pyx_e_5spacy_5attrs_FLAG46, + __pyx_e_5spacy_5attrs_FLAG47, + __pyx_e_5spacy_5attrs_FLAG48, + __pyx_e_5spacy_5attrs_FLAG49, + __pyx_e_5spacy_5attrs_FLAG50, + __pyx_e_5spacy_5attrs_FLAG51, + __pyx_e_5spacy_5attrs_FLAG52, + __pyx_e_5spacy_5attrs_FLAG53, + __pyx_e_5spacy_5attrs_FLAG54, + __pyx_e_5spacy_5attrs_FLAG55, + __pyx_e_5spacy_5attrs_FLAG56, + __pyx_e_5spacy_5attrs_FLAG57, + __pyx_e_5spacy_5attrs_FLAG58, + __pyx_e_5spacy_5attrs_FLAG59, + __pyx_e_5spacy_5attrs_FLAG60, + __pyx_e_5spacy_5attrs_FLAG61, + __pyx_e_5spacy_5attrs_FLAG62, + __pyx_e_5spacy_5attrs_FLAG63, + __pyx_e_5spacy_5attrs_ID, + __pyx_e_5spacy_5attrs_ORTH, + __pyx_e_5spacy_5attrs_LOWER, + __pyx_e_5spacy_5attrs_NORM, + __pyx_e_5spacy_5attrs_SHAPE, + __pyx_e_5spacy_5attrs_PREFIX, + __pyx_e_5spacy_5attrs_SUFFIX, + __pyx_e_5spacy_5attrs_LENGTH, + __pyx_e_5spacy_5attrs_CLUSTER, + __pyx_e_5spacy_5attrs_LEMMA, + __pyx_e_5spacy_5attrs_POS, + __pyx_e_5spacy_5attrs_TAG, + __pyx_e_5spacy_5attrs_DEP, + __pyx_e_5spacy_5attrs_ENT_IOB, + __pyx_e_5spacy_5attrs_ENT_TYPE, + __pyx_e_5spacy_5attrs_HEAD, + __pyx_e_5spacy_5attrs_SENT_START, + __pyx_e_5spacy_5attrs_SPACY, + __pyx_e_5spacy_5attrs_PROB, + __pyx_e_5spacy_5attrs_LANG, + __pyx_e_5spacy_5attrs_ENT_KB_ID = __pyx_e_5spacy_7symbols_ENT_KB_ID, + __pyx_e_5spacy_5attrs_MORPH, + __pyx_e_5spacy_5attrs_ENT_ID = __pyx_e_5spacy_7symbols_ENT_ID, + __pyx_e_5spacy_5attrs_IDX, + __pyx_e_5spacy_5attrs_SENT_END +}; + +/* "cymem/cymem.pxd":1 + * ctypedef void* (*malloc_t)(size_t n) # <<<<<<<<<<<<<< + * ctypedef void (*free_t)(void *p) + * +*/ +typedef void *(*__pyx_t_5cymem_5cymem_malloc_t)(size_t); + +/* "cymem/cymem.pxd":2 + * ctypedef void* (*malloc_t)(size_t n) + * ctypedef void (*free_t)(void *p) # <<<<<<<<<<<<<< + * + * cdef class PyMalloc: +*/ +typedef void (*__pyx_t_5cymem_5cymem_free_t)(void *); +struct __pyx_t_7preshed_4maps_Cell; +struct __pyx_t_7preshed_4maps_Result; +struct __pyx_t_7preshed_4maps_MapStruct; + +/* "preshed/maps.pxd":8 + * + * + * cdef struct Cell: # <<<<<<<<<<<<<< + * key_t key + * void* value +*/ +struct __pyx_t_7preshed_4maps_Cell { + __pyx_t_7preshed_4maps_key_t key; + void *value; +}; + +/* "preshed/maps.pxd":13 + * + * + * cdef struct Result: # <<<<<<<<<<<<<< + * int found + * void* value +*/ +struct __pyx_t_7preshed_4maps_Result { + int found; + void *value; +}; + +/* "preshed/maps.pxd":18 + * + * + * cdef struct MapStruct: # <<<<<<<<<<<<<< + * Cell* cells + * void* value_for_empty_key +*/ +struct __pyx_t_7preshed_4maps_MapStruct { + struct __pyx_t_7preshed_4maps_Cell *cells; + void *value_for_empty_key; + void *value_for_del_key; + __pyx_t_7preshed_4maps_key_t length; + __pyx_t_7preshed_4maps_key_t filled; + int is_empty_key_set; + int is_del_key_set; +}; +union __pyx_t_5spacy_7strings_Utf8Str; +typedef union __pyx_t_5spacy_7strings_Utf8Str __pyx_t_5spacy_7strings_Utf8Str; + +/* "strings.pxd":17 + * + * + * ctypedef union Utf8Str: # <<<<<<<<<<<<<< + * unsigned char[8] s + * unsigned char* p +*/ +union __pyx_t_5spacy_7strings_Utf8Str { + unsigned char s[8]; + unsigned char *p; +}; + +/* "parts_of_speech.pxd":4 + * + * + * cpdef enum univ_pos_t: # <<<<<<<<<<<<<< + * NO_TAG = 0 + * ADJ = symbols.ADJ +*/ +enum __pyx_t_5spacy_15parts_of_speech_univ_pos_t { + + /* "parts_of_speech.pxd":6 + * cpdef enum univ_pos_t: + * NO_TAG = 0 + * ADJ = symbols.ADJ # <<<<<<<<<<<<<< + * ADP + * ADV +*/ + __pyx_e_5spacy_15parts_of_speech_NO_TAG = 0, + __pyx_e_5spacy_15parts_of_speech_ADJ = __pyx_e_5spacy_7symbols_ADJ, + __pyx_e_5spacy_15parts_of_speech_ADP, + __pyx_e_5spacy_15parts_of_speech_ADV, + __pyx_e_5spacy_15parts_of_speech_AUX, + __pyx_e_5spacy_15parts_of_speech_CONJ, + __pyx_e_5spacy_15parts_of_speech_CCONJ, + __pyx_e_5spacy_15parts_of_speech_DET, + __pyx_e_5spacy_15parts_of_speech_INTJ, + __pyx_e_5spacy_15parts_of_speech_NOUN, + __pyx_e_5spacy_15parts_of_speech_NUM, + __pyx_e_5spacy_15parts_of_speech_PART, + __pyx_e_5spacy_15parts_of_speech_PRON, + __pyx_e_5spacy_15parts_of_speech_PROPN, + __pyx_e_5spacy_15parts_of_speech_PUNCT, + __pyx_e_5spacy_15parts_of_speech_SCONJ, + __pyx_e_5spacy_15parts_of_speech_SYM, + __pyx_e_5spacy_15parts_of_speech_VERB, + __pyx_e_5spacy_15parts_of_speech_X, + __pyx_e_5spacy_15parts_of_speech_EOL, + __pyx_e_5spacy_15parts_of_speech_SPACE +}; +struct __pyx_t_5spacy_7structs_LexemeC; +struct __pyx_t_5spacy_7structs_SpanC; +struct __pyx_t_5spacy_7structs_TokenC; +struct __pyx_t_5spacy_7structs_MorphAnalysisC; +struct __pyx_t_5spacy_7structs_KBEntryC; +struct __pyx_t_5spacy_7structs_AliasC; +struct __pyx_t_5spacy_7structs_EdgeC; +struct __pyx_t_5spacy_7structs_GraphC; + +/* "structs.pxd":10 + * + * + * cdef struct LexemeC: # <<<<<<<<<<<<<< + * flags_t flags + * +*/ +struct __pyx_t_5spacy_7structs_LexemeC { + __pyx_t_5spacy_8typedefs_flags_t flags; + __pyx_t_5spacy_8typedefs_attr_t lang; + __pyx_t_5spacy_8typedefs_attr_t id; + __pyx_t_5spacy_8typedefs_attr_t length; + __pyx_t_5spacy_8typedefs_attr_t orth; + __pyx_t_5spacy_8typedefs_attr_t lower; + __pyx_t_5spacy_8typedefs_attr_t norm; + __pyx_t_5spacy_8typedefs_attr_t shape; + __pyx_t_5spacy_8typedefs_attr_t prefix; + __pyx_t_5spacy_8typedefs_attr_t suffix; +}; + +/* "structs.pxd":26 + * + * + * cdef struct SpanC: # <<<<<<<<<<<<<< + * hash_t id + * int start +*/ +struct __pyx_t_5spacy_7structs_SpanC { + __pyx_t_5spacy_8typedefs_hash_t id; + int start; + int end; + int start_char; + int end_char; + __pyx_t_5spacy_8typedefs_attr_t label; + __pyx_t_5spacy_8typedefs_attr_t kb_id; +}; + +/* "structs.pxd":36 + * + * + * cdef struct TokenC: # <<<<<<<<<<<<<< + * const LexemeC* lex + * uint64_t morph +*/ +struct __pyx_t_5spacy_7structs_TokenC { + struct __pyx_t_5spacy_7structs_LexemeC const *lex; + uint64_t morph; + enum __pyx_t_5spacy_15parts_of_speech_univ_pos_t pos; + int spacy; + __pyx_t_5spacy_8typedefs_attr_t tag; + int idx; + __pyx_t_5spacy_8typedefs_attr_t lemma; + __pyx_t_5spacy_8typedefs_attr_t norm; + int head; + __pyx_t_5spacy_8typedefs_attr_t dep; + uint32_t l_kids; + uint32_t r_kids; + uint32_t l_edge; + uint32_t r_edge; + int sent_start; + int ent_iob; + __pyx_t_5spacy_8typedefs_attr_t ent_type; + __pyx_t_5spacy_8typedefs_attr_t ent_kb_id; + __pyx_t_5spacy_8typedefs_hash_t ent_id; +}; + +/* "structs.pxd":60 + * + * + * cdef struct MorphAnalysisC: # <<<<<<<<<<<<<< + * hash_t key + * int length +*/ +struct __pyx_t_5spacy_7structs_MorphAnalysisC { + __pyx_t_5spacy_8typedefs_hash_t key; + int length; + __pyx_t_5spacy_8typedefs_attr_t *fields; + __pyx_t_5spacy_8typedefs_attr_t *features; +}; + +/* "structs.pxd":69 + * + * # Internal struct, for storage and disambiguation of entities. + * cdef struct KBEntryC: # <<<<<<<<<<<<<< + * + * # The hash of this entry's unique ID/name in the kB +*/ +struct __pyx_t_5spacy_7structs_KBEntryC { + __pyx_t_5spacy_8typedefs_hash_t entity_hash; + int32_t vector_index; + int32_t feats_row; + float freq; +}; + +/* "structs.pxd":88 + * # Each alias struct stores a list of Entry pointers with their prior probabilities + * # for this specific mention/alias. + * cdef struct AliasC: # <<<<<<<<<<<<<< + * + * # All entry candidates for this alias +*/ +struct __pyx_t_5spacy_7structs_AliasC { + std::vector entry_indices; + std::vector probs; +}; + +/* "structs.pxd":97 + * + * + * cdef struct EdgeC: # <<<<<<<<<<<<<< + * hash_t label + * int32_t head +*/ +struct __pyx_t_5spacy_7structs_EdgeC { + __pyx_t_5spacy_8typedefs_hash_t label; + int32_t head; + int32_t tail; +}; + +/* "structs.pxd":103 + * + * + * cdef struct GraphC: # <<<<<<<<<<<<<< + * vector[vector[int32_t]] nodes + * vector[EdgeC] edges +*/ +struct __pyx_t_5spacy_7structs_GraphC { + std::vector > nodes; + std::vector edges; + std::vector weights; + std::vector n_heads; + std::vector n_tails; + std::vector first_head; + std::vector first_tail; + std::unordered_set *roots; + std::unordered_map<__pyx_t_5spacy_8typedefs_hash_t,int> *node_map; + std::unordered_map<__pyx_t_5spacy_8typedefs_hash_t,int> *edge_map; +}; +union __pyx_t_5spacy_5vocab_LexemesOrTokens; +struct __pyx_t_5spacy_5vocab__Cached; + +/* "vocab.pxd":15 + * + * + * cdef union LexemesOrTokens: # <<<<<<<<<<<<<< + * const LexemeC* const* lexemes + * const TokenC* tokens +*/ +union __pyx_t_5spacy_5vocab_LexemesOrTokens { + struct __pyx_t_5spacy_7structs_LexemeC const *const *lexemes; + struct __pyx_t_5spacy_7structs_TokenC const *tokens; +}; + +/* "vocab.pxd":20 + * + * + * cdef struct _Cached: # <<<<<<<<<<<<<< + * LexemesOrTokens data + * bint is_lex +*/ +struct __pyx_t_5spacy_5vocab__Cached { + union __pyx_t_5spacy_5vocab_LexemesOrTokens data; + int is_lex; + int length; +}; +struct __pyx_t_5spacy_8pipeline_17_parser_internals_6_state_ArcC; +struct __pyx_t_5spacy_8pipeline_17_parser_internals_6_state_StateC; + +/* "spacy/pipeline/_parser_internals/_state.pxd":23 + * return Lexeme.c_check_flag(token.lex, IS_SPACE) + * + * cdef struct ArcC: # <<<<<<<<<<<<<< + * int head + * int child +*/ +struct __pyx_t_5spacy_8pipeline_17_parser_internals_6_state_ArcC { + int head; + int child; + __pyx_t_5spacy_8typedefs_attr_t label; +}; +struct __pyx_t_5spacy_8pipeline_17_parser_internals_6_state_StateC { + + /* "spacy/pipeline/_parser_internals/_state.pxd":29 + * + * + * cdef cppclass StateC: # <<<<<<<<<<<<<< + * int* _heads + * const TokenC* _sent +*/ + int *_heads; + struct __pyx_t_5spacy_7structs_TokenC const *_sent; + std::vector _stack; + std::vector _rebuffer; + std::vector _ents; + std::unordered_map > _left_arcs; + std::unordered_map > _right_arcs; + std::vector _unshiftable; + std::set _sent_starts; + struct __pyx_t_5spacy_7structs_TokenC _empty_token; + int length; + int offset; + int _b_i; + void __pyx_f___init__StateC(struct __pyx_t_5spacy_7structs_TokenC const *, int); + void __pyx_f___dealloc__StateC(void); + virtual void set_context_tokens(int *, int); + virtual int S(int) const; + virtual int B(int) const; + virtual struct __pyx_t_5spacy_7structs_TokenC const *B_(int) const; + virtual struct __pyx_t_5spacy_7structs_TokenC const *E_(int) const; + virtual struct __pyx_t_5spacy_7structs_TokenC const *safe_get(int) const; + virtual void map_get_arcs(std::unordered_map > const &, std::vector *) const; + virtual void get_arcs(std::vector *) const; + virtual int H(int) const; + virtual int E(int) const; + virtual int nth_child(std::unordered_map > const &, int, int) const; + virtual int L(int, int) const; + virtual int R(int, int) const; + virtual int empty(void) const; + virtual int eol(void) const; + virtual int is_final(void) const; + virtual int cannot_sent_start(int) const; + virtual int is_sent_start(int) const; + virtual void set_sent_start(int, int); + virtual int has_head(int) const; + virtual int l_edge(int) const; + virtual int r_edge(int) const; + virtual int n_arcs(std::unordered_map > const &, int) const; + virtual int n_L(int) const; + virtual int n_R(int) const; + virtual int stack_is_connected(void) const; + virtual int entity_is_open(void) const; + virtual int stack_depth(void) const; + virtual int buffer_length(void) const; + virtual void push(void); + virtual void pop(void); + virtual void force_final(void); + virtual void unshift(void); + virtual int is_unshiftable(int) const; + virtual void set_reshiftable(int); + virtual void add_arc(int, int, __pyx_t_5spacy_8typedefs_attr_t); + virtual void map_del_arc(std::unordered_map > *, int, int); + virtual void del_arc(int, int); + virtual struct __pyx_t_5spacy_7structs_SpanC get_ent(void) const; + virtual void open_ent(__pyx_t_5spacy_8typedefs_attr_t); + virtual void close_ent(void); + virtual void clone(__pyx_t_5spacy_8pipeline_17_parser_internals_6_state_StateC const *); + __pyx_t_5spacy_8pipeline_17_parser_internals_6_state_StateC(struct __pyx_t_5spacy_7structs_TokenC const *__pyx_v_sent, int __pyx_v_length) { + __pyx_f___init__StateC(__pyx_v_sent, __pyx_v_length); + } + virtual ~__pyx_t_5spacy_8pipeline_17_parser_internals_6_state_StateC() { + __pyx_f___dealloc__StateC(); + } +}; + +/* "cymem/cymem.pxd":4 + * ctypedef void (*free_t)(void *p) + * + * cdef class PyMalloc: # <<<<<<<<<<<<<< + * cdef malloc_t malloc + * cdef void _set(self, malloc_t malloc) +*/ +struct __pyx_obj_5cymem_5cymem_PyMalloc { + PyObject_HEAD + struct __pyx_vtabstruct_5cymem_5cymem_PyMalloc *__pyx_vtab; + __pyx_t_5cymem_5cymem_malloc_t malloc; +}; + + +/* "cymem/cymem.pxd":10 + * cdef PyMalloc WrapMalloc(malloc_t malloc) + * + * cdef class PyFree: # <<<<<<<<<<<<<< + * cdef free_t free + * cdef void _set(self, free_t free) +*/ +struct __pyx_obj_5cymem_5cymem_PyFree { + PyObject_HEAD + struct __pyx_vtabstruct_5cymem_5cymem_PyFree *__pyx_vtab; + __pyx_t_5cymem_5cymem_free_t free; +}; + + +/* "cymem/cymem.pxd":16 + * cdef PyFree WrapFree(free_t free) + * + * cdef class Pool: # <<<<<<<<<<<<<< + * cdef readonly size_t size + * cdef readonly dict addresses +*/ +struct __pyx_obj_5cymem_5cymem_Pool { + PyObject_HEAD + struct __pyx_vtabstruct_5cymem_5cymem_Pool *__pyx_vtab; + size_t size; + PyObject *addresses; + PyObject *refs; + struct __pyx_obj_5cymem_5cymem_PyMalloc *pymalloc; + struct __pyx_obj_5cymem_5cymem_PyFree *pyfree; +}; + + +/* "cymem/cymem.pxd":28 + * + * + * cdef class Address: # <<<<<<<<<<<<<< + * cdef void* ptr + * cdef readonly PyMalloc pymalloc +*/ +struct __pyx_obj_5cymem_5cymem_Address { + PyObject_HEAD + void *ptr; + struct __pyx_obj_5cymem_5cymem_PyMalloc *pymalloc; + struct __pyx_obj_5cymem_5cymem_PyFree *pyfree; +}; + + +/* "preshed/maps.pxd":45 + * + * + * cdef class PreshMap: # <<<<<<<<<<<<<< + * cdef MapStruct* c_map + * cdef Pool mem +*/ +struct __pyx_obj_7preshed_4maps_PreshMap { + PyObject_HEAD + struct __pyx_vtabstruct_7preshed_4maps_PreshMap *__pyx_vtab; + struct __pyx_t_7preshed_4maps_MapStruct *c_map; + struct __pyx_obj_5cymem_5cymem_Pool *mem; +}; + + +/* "preshed/maps.pxd":53 + * + * + * cdef class PreshMapArray: # <<<<<<<<<<<<<< + * cdef Pool mem + * cdef MapStruct* maps +*/ +struct __pyx_obj_7preshed_4maps_PreshMapArray { + PyObject_HEAD + struct __pyx_vtabstruct_7preshed_4maps_PreshMapArray *__pyx_vtab; + struct __pyx_obj_5cymem_5cymem_Pool *mem; + struct __pyx_t_7preshed_4maps_MapStruct *maps; + size_t length; +}; + + +/* "strings.pxd":22 + * + * + * cdef class StringStore: # <<<<<<<<<<<<<< + * cdef Pool mem + * +*/ +struct __pyx_obj_5spacy_7strings_StringStore { + PyObject_HEAD + struct __pyx_vtabstruct_5spacy_7strings_StringStore *__pyx_vtab; + struct __pyx_obj_5cymem_5cymem_Pool *mem; + std::vector<__pyx_t_5spacy_8typedefs_hash_t> keys; + struct __pyx_obj_7preshed_4maps_PreshMap *_map; + std::vector<__pyx_t_5spacy_8typedefs_hash_t> _transient_keys; + struct __pyx_obj_5cymem_5cymem_Pool *_non_temp_mem; +}; + + +/* "morphology.pxd":11 + * + * + * cdef class Morphology: # <<<<<<<<<<<<<< + * cdef readonly Pool mem + * cdef readonly StringStore strings +*/ +struct __pyx_obj_5spacy_10morphology_Morphology { + PyObject_HEAD + struct __pyx_vtabstruct_5spacy_10morphology_Morphology *__pyx_vtab; + struct __pyx_obj_5cymem_5cymem_Pool *mem; + struct __pyx_obj_5spacy_7strings_StringStore *strings; + struct __pyx_obj_7preshed_4maps_PreshMap *tags; +}; + + +/* "vocab.pxd":26 + * + * + * cdef class Vocab: # <<<<<<<<<<<<<< + * cdef Pool mem + * cdef readonly StringStore strings +*/ +struct __pyx_obj_5spacy_5vocab_Vocab { + PyObject_HEAD + struct __pyx_vtabstruct_5spacy_5vocab_Vocab *__pyx_vtab; + struct __pyx_obj_5cymem_5cymem_Pool *mem; + struct __pyx_obj_5spacy_7strings_StringStore *strings; + struct __pyx_obj_5spacy_10morphology_Morphology *morphology; + PyObject *_vectors; + PyObject *_lookups; + PyObject *writing_system; + PyObject *get_noun_chunks; + int length; + PyObject *_unused_object; + PyObject *lex_attr_getters; + PyObject *cfg; + struct __pyx_obj_7preshed_4maps_PreshMap *_by_orth; + struct __pyx_obj_5cymem_5cymem_Pool *_non_temp_mem; + std::vector<__pyx_t_5spacy_8typedefs_attr_t> _transient_orths; +}; + + +/* "lexeme.pxd":24 + * cdef attr_t OOV_RANK + * + * cdef class Lexeme: # <<<<<<<<<<<<<< + * cdef LexemeC* c + * cdef readonly Vocab vocab +*/ +struct __pyx_obj_5spacy_6lexeme_Lexeme { + PyObject_HEAD + struct __pyx_vtabstruct_5spacy_6lexeme_Lexeme *__pyx_vtab; + struct __pyx_t_5spacy_7structs_LexemeC *c; + struct __pyx_obj_5spacy_5vocab_Vocab *vocab; + __pyx_t_5spacy_8typedefs_attr_t orth; +}; + + + +/* "cymem/cymem.pxd":4 + * ctypedef void (*free_t)(void *p) + * + * cdef class PyMalloc: # <<<<<<<<<<<<<< + * cdef malloc_t malloc + * cdef void _set(self, malloc_t malloc) +*/ + +struct __pyx_vtabstruct_5cymem_5cymem_PyMalloc { + void (*_set)(struct __pyx_obj_5cymem_5cymem_PyMalloc *, __pyx_t_5cymem_5cymem_malloc_t); +}; +static struct __pyx_vtabstruct_5cymem_5cymem_PyMalloc *__pyx_vtabptr_5cymem_5cymem_PyMalloc; + + +/* "cymem/cymem.pxd":10 + * cdef PyMalloc WrapMalloc(malloc_t malloc) + * + * cdef class PyFree: # <<<<<<<<<<<<<< + * cdef free_t free + * cdef void _set(self, free_t free) +*/ + +struct __pyx_vtabstruct_5cymem_5cymem_PyFree { + void (*_set)(struct __pyx_obj_5cymem_5cymem_PyFree *, __pyx_t_5cymem_5cymem_free_t); +}; +static struct __pyx_vtabstruct_5cymem_5cymem_PyFree *__pyx_vtabptr_5cymem_5cymem_PyFree; + + +/* "cymem/cymem.pxd":16 + * cdef PyFree WrapFree(free_t free) + * + * cdef class Pool: # <<<<<<<<<<<<<< + * cdef readonly size_t size + * cdef readonly dict addresses +*/ + +struct __pyx_vtabstruct_5cymem_5cymem_Pool { + void *(*alloc)(struct __pyx_obj_5cymem_5cymem_Pool *, size_t, size_t); + void (*free)(struct __pyx_obj_5cymem_5cymem_Pool *, void *); + void *(*realloc)(struct __pyx_obj_5cymem_5cymem_Pool *, void *, size_t); +}; +static struct __pyx_vtabstruct_5cymem_5cymem_Pool *__pyx_vtabptr_5cymem_5cymem_Pool; + + +/* "preshed/maps.pxd":45 + * + * + * cdef class PreshMap: # <<<<<<<<<<<<<< + * cdef MapStruct* c_map + * cdef Pool mem +*/ + +struct __pyx_vtabstruct_7preshed_4maps_PreshMap { + void *(*get)(struct __pyx_obj_7preshed_4maps_PreshMap *, __pyx_t_7preshed_4maps_key_t); + void (*set)(struct __pyx_obj_7preshed_4maps_PreshMap *, __pyx_t_7preshed_4maps_key_t, void *); +}; +static struct __pyx_vtabstruct_7preshed_4maps_PreshMap *__pyx_vtabptr_7preshed_4maps_PreshMap; + + +/* "preshed/maps.pxd":53 + * + * + * cdef class PreshMapArray: # <<<<<<<<<<<<<< + * cdef Pool mem + * cdef MapStruct* maps +*/ + +struct __pyx_vtabstruct_7preshed_4maps_PreshMapArray { + void *(*get)(struct __pyx_obj_7preshed_4maps_PreshMapArray *, size_t, __pyx_t_7preshed_4maps_key_t); + void (*set)(struct __pyx_obj_7preshed_4maps_PreshMapArray *, size_t, __pyx_t_7preshed_4maps_key_t, void *); +}; +static struct __pyx_vtabstruct_7preshed_4maps_PreshMapArray *__pyx_vtabptr_7preshed_4maps_PreshMapArray; + + +/* "strings.pxd":22 + * + * + * cdef class StringStore: # <<<<<<<<<<<<<< + * cdef Pool mem + * +*/ + +struct __pyx_vtabstruct_5spacy_7strings_StringStore { + __pyx_t_5spacy_7strings_Utf8Str const *(*intern_unicode)(struct __pyx_obj_5spacy_7strings_StringStore *, PyObject *, int); + __pyx_t_5spacy_7strings_Utf8Str const *(*_intern_utf8)(struct __pyx_obj_5spacy_7strings_StringStore *, char *, int, __pyx_t_5spacy_8typedefs_hash_t *, int); +}; +static struct __pyx_vtabstruct_5spacy_7strings_StringStore *__pyx_vtabptr_5spacy_7strings_StringStore; + + +/* "morphology.pxd":11 + * + * + * cdef class Morphology: # <<<<<<<<<<<<<< + * cdef readonly Pool mem + * cdef readonly StringStore strings +*/ + +struct __pyx_vtabstruct_5spacy_10morphology_Morphology { + struct __pyx_t_5spacy_7structs_MorphAnalysisC (*create_morph_tag)(struct __pyx_obj_5spacy_10morphology_Morphology *, PyObject *); + int (*insert)(struct __pyx_obj_5spacy_10morphology_Morphology *, struct __pyx_t_5spacy_7structs_MorphAnalysisC); +}; +static struct __pyx_vtabstruct_5spacy_10morphology_Morphology *__pyx_vtabptr_5spacy_10morphology_Morphology; + + +/* "vocab.pxd":26 + * + * + * cdef class Vocab: # <<<<<<<<<<<<<< + * cdef Pool mem + * cdef readonly StringStore strings +*/ + +struct __pyx_vtabstruct_5spacy_5vocab_Vocab { + struct __pyx_t_5spacy_7structs_LexemeC const *(*get)(struct __pyx_obj_5spacy_5vocab_Vocab *, struct __pyx_obj_5cymem_5cymem_Pool *, PyObject *); + struct __pyx_t_5spacy_7structs_LexemeC const *(*get_by_orth)(struct __pyx_obj_5spacy_5vocab_Vocab *, struct __pyx_obj_5cymem_5cymem_Pool *, __pyx_t_5spacy_8typedefs_attr_t); + struct __pyx_t_5spacy_7structs_TokenC const *(*make_fused_token)(struct __pyx_obj_5spacy_5vocab_Vocab *, PyObject *); + struct __pyx_t_5spacy_7structs_LexemeC const *(*_new_lexeme)(struct __pyx_obj_5spacy_5vocab_Vocab *, struct __pyx_obj_5cymem_5cymem_Pool *, PyObject *); + int (*_add_lex_to_vocab)(struct __pyx_obj_5spacy_5vocab_Vocab *, __pyx_t_5spacy_8typedefs_hash_t, struct __pyx_t_5spacy_7structs_LexemeC const *, int); +}; +static struct __pyx_vtabstruct_5spacy_5vocab_Vocab *__pyx_vtabptr_5spacy_5vocab_Vocab; + + +/* "lexeme.pxd":24 + * cdef attr_t OOV_RANK + * + * cdef class Lexeme: # <<<<<<<<<<<<<< + * cdef LexemeC* c + * cdef readonly Vocab vocab +*/ + +struct __pyx_vtabstruct_5spacy_6lexeme_Lexeme { + struct __pyx_obj_5spacy_6lexeme_Lexeme *(*from_ptr)(struct __pyx_t_5spacy_7structs_LexemeC *, struct __pyx_obj_5spacy_5vocab_Vocab *); + void (*set_struct_attr)(struct __pyx_t_5spacy_7structs_LexemeC *, enum __pyx_t_5spacy_5attrs_attr_id_t, __pyx_t_5spacy_8typedefs_attr_t); + __pyx_t_5spacy_8typedefs_attr_t (*get_struct_attr)(struct __pyx_t_5spacy_7structs_LexemeC const *, enum __pyx_t_5spacy_5attrs_attr_id_t); + int (*c_check_flag)(struct __pyx_t_5spacy_7structs_LexemeC const *, enum __pyx_t_5spacy_5attrs_attr_id_t); + int (*c_set_flag)(struct __pyx_t_5spacy_7structs_LexemeC *, enum __pyx_t_5spacy_5attrs_attr_id_t, int); +}; +static struct __pyx_vtabstruct_5spacy_6lexeme_Lexeme *__pyx_vtabptr_5spacy_6lexeme_Lexeme; +static CYTHON_INLINE struct __pyx_obj_5spacy_6lexeme_Lexeme *__pyx_f_5spacy_6lexeme_6Lexeme_from_ptr(struct __pyx_t_5spacy_7structs_LexemeC *, struct __pyx_obj_5spacy_5vocab_Vocab *); +static CYTHON_INLINE void __pyx_f_5spacy_6lexeme_6Lexeme_set_struct_attr(struct __pyx_t_5spacy_7structs_LexemeC *, enum __pyx_t_5spacy_5attrs_attr_id_t, __pyx_t_5spacy_8typedefs_attr_t); +static CYTHON_INLINE __pyx_t_5spacy_8typedefs_attr_t __pyx_f_5spacy_6lexeme_6Lexeme_get_struct_attr(struct __pyx_t_5spacy_7structs_LexemeC const *, enum __pyx_t_5spacy_5attrs_attr_id_t); +static CYTHON_INLINE int __pyx_f_5spacy_6lexeme_6Lexeme_c_check_flag(struct __pyx_t_5spacy_7structs_LexemeC const *, enum __pyx_t_5spacy_5attrs_attr_id_t); +static CYTHON_INLINE int __pyx_f_5spacy_6lexeme_6Lexeme_c_set_flag(struct __pyx_t_5spacy_7structs_LexemeC *, enum __pyx_t_5spacy_5attrs_attr_id_t, int); +/* #### 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) + +/* 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 + +/* PyImportError_Check.proto */ +#define __Pyx_PyExc_ImportError_Check(obj) __Pyx_TypeCheck(obj, PyExc_ImportError) + +/* 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 */ +#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); + +/* 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); + +/* tp_new.proto */ +#define __Pyx_tp_new(type_obj, args) __Pyx_tp_new_kwargs(type_obj, args, NULL) +static CYTHON_INLINE PyObject* __Pyx_tp_new_kwargs(PyObject* type_obj, PyObject* args, PyObject* kwargs); + +/* ExtTypeTest.proto */ +static CYTHON_INLINE int __Pyx_TypeTest(PyObject *obj, PyTypeObject *type); + +/* 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); + +/* MoveIfSupported.proto */ +#if CYTHON_USE_CPP_STD_MOVE + #include + #define __PYX_STD_MOVE_IF_SUPPORTED(x) std::move(x) +#else + #define __PYX_STD_MOVE_IF_SUPPORTED(x) x +#endif + +/* TypeImport.proto */ +#ifndef __PYX_HAVE_RT_ImportType_proto_3_2_1 +#define __PYX_HAVE_RT_ImportType_proto_3_2_1 +#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_1(s) alignof(s) +#else +#define __PYX_GET_STRUCT_ALIGNMENT_3_2_1(s) sizeof(void*) +#endif +enum __Pyx_ImportType_CheckSize_3_2_1 { + __Pyx_ImportType_CheckSize_Error_3_2_1 = 0, + __Pyx_ImportType_CheckSize_Warn_3_2_1 = 1, + __Pyx_ImportType_CheckSize_Ignore_3_2_1 = 2 +}; +static PyTypeObject *__Pyx_ImportType_3_2_1(PyObject* module, const char *module_name, const char *class_name, size_t size, size_t alignment, enum __Pyx_ImportType_CheckSize_3_2_1 check_size); +#endif + +/* GetVTable.proto */ +static void* __Pyx_GetVtable(PyTypeObject *type); + +/* VoidPtrImport.proto */ +static int __Pyx_ImportVoidPtr_3_2_1(PyObject *module, const char *name, void **p, const char *sig); + +/* IncludeStringH.proto */ +#include + +/* FunctionImport.proto */ +static int __Pyx_ImportFunction_3_2_1(PyObject *module, const char *funcname, void (**f)(void), const char *sig); + +/* dict_setdefault.proto (used by CLineInTraceback) */ +static CYTHON_INLINE PyObject *__Pyx_PyDict_SetDefault(PyObject *d, PyObject *key, PyObject *default_value); + +/* 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 + +/* 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 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 + +/* CppExceptionConversion.proto */ +#ifndef __Pyx_CppExn2PyErr +#include +#include +#include +#include +static void __Pyx_CppExn2PyErr() { + try { + if (PyErr_Occurred()) + ; // let the latest Python exn pass through and ignore the current one + else + throw; + } catch (const std::bad_alloc& exn) { + PyErr_SetString(PyExc_MemoryError, exn.what()); + } catch (const std::bad_cast& exn) { + PyErr_SetString(PyExc_TypeError, exn.what()); + } catch (const std::bad_typeid& exn) { + PyErr_SetString(PyExc_TypeError, exn.what()); + } catch (const std::domain_error& exn) { + PyErr_SetString(PyExc_ValueError, exn.what()); + } catch (const std::invalid_argument& exn) { + PyErr_SetString(PyExc_ValueError, exn.what()); + } catch (const std::ios_base::failure& exn) { + PyErr_SetString(PyExc_IOError, exn.what()); + } catch (const std::out_of_range& exn) { + PyErr_SetString(PyExc_IndexError, exn.what()); + } catch (const std::overflow_error& exn) { + PyErr_SetString(PyExc_OverflowError, exn.what()); + } catch (const std::range_error& exn) { + PyErr_SetString(PyExc_ArithmeticError, exn.what()); + } catch (const std::underflow_error& exn) { + PyErr_SetString(PyExc_ArithmeticError, exn.what()); + } catch (const std::exception& exn) { + PyErr_SetString(PyExc_RuntimeError, exn.what()); + } + catch (...) + { + PyErr_SetString(PyExc_RuntimeError, "Unknown exception"); + } +} +#endif + +/* RealImag.proto */ +#if CYTHON_CCOMPLEX + #ifdef __cplusplus + #define __Pyx_CREAL(z) ((z).real()) + #define __Pyx_CIMAG(z) ((z).imag()) + #else + #define __Pyx_CREAL(z) (__real__(z)) + #define __Pyx_CIMAG(z) (__imag__(z)) + #endif +#else + #define __Pyx_CREAL(z) ((z).real) + #define __Pyx_CIMAG(z) ((z).imag) +#endif +#if defined(__cplusplus) && CYTHON_CCOMPLEX\ + && (defined(_WIN32) || defined(__clang__) || (defined(__GNUC__) && (__GNUC__ >= 5 || __GNUC__ == 4 && __GNUC_MINOR__ >= 4 )) || __cplusplus >= 201103) + #define __Pyx_SET_CREAL(z,x) ((z).real(x)) + #define __Pyx_SET_CIMAG(z,y) ((z).imag(y)) +#else + #define __Pyx_SET_CREAL(z,x) __Pyx_CREAL(z) = (x) + #define __Pyx_SET_CIMAG(z,y) __Pyx_CIMAG(z) = (y) +#endif + +/* Arithmetic.proto */ +#if CYTHON_CCOMPLEX && (1) && (!0 || __cplusplus) + #define __Pyx_c_eq_float(a, b) ((a)==(b)) + #define __Pyx_c_sum_float(a, b) ((a)+(b)) + #define __Pyx_c_diff_float(a, b) ((a)-(b)) + #define __Pyx_c_prod_float(a, b) ((a)*(b)) + #define __Pyx_c_quot_float(a, b) ((a)/(b)) + #define __Pyx_c_neg_float(a) (-(a)) + #ifdef __cplusplus + #define __Pyx_c_is_zero_float(z) ((z)==(float)0) + #define __Pyx_c_conj_float(z) (::std::conj(z)) + #if 1 + #define __Pyx_c_abs_float(z) (::std::abs(z)) + #define __Pyx_c_pow_float(a, b) (::std::pow(a, b)) + #endif + #else + #define __Pyx_c_is_zero_float(z) ((z)==0) + #define __Pyx_c_conj_float(z) (conjf(z)) + #if 1 + #define __Pyx_c_abs_float(z) (cabsf(z)) + #define __Pyx_c_pow_float(a, b) (cpowf(a, b)) + #endif + #endif +#else + static CYTHON_INLINE int __Pyx_c_eq_float(__pyx_t_float_complex, __pyx_t_float_complex); + static CYTHON_INLINE __pyx_t_float_complex __Pyx_c_sum_float(__pyx_t_float_complex, __pyx_t_float_complex); + static CYTHON_INLINE __pyx_t_float_complex __Pyx_c_diff_float(__pyx_t_float_complex, __pyx_t_float_complex); + static CYTHON_INLINE __pyx_t_float_complex __Pyx_c_prod_float(__pyx_t_float_complex, __pyx_t_float_complex); + static CYTHON_INLINE __pyx_t_float_complex __Pyx_c_quot_float(__pyx_t_float_complex, __pyx_t_float_complex); + static CYTHON_INLINE __pyx_t_float_complex __Pyx_c_neg_float(__pyx_t_float_complex); + static CYTHON_INLINE int __Pyx_c_is_zero_float(__pyx_t_float_complex); + static CYTHON_INLINE __pyx_t_float_complex __Pyx_c_conj_float(__pyx_t_float_complex); + #if 1 + static CYTHON_INLINE float __Pyx_c_abs_float(__pyx_t_float_complex); + static CYTHON_INLINE __pyx_t_float_complex __Pyx_c_pow_float(__pyx_t_float_complex, __pyx_t_float_complex); + #endif +#endif + +/* Arithmetic.proto */ +#if CYTHON_CCOMPLEX && (1) && (!0 || __cplusplus) + #define __Pyx_c_eq_double(a, b) ((a)==(b)) + #define __Pyx_c_sum_double(a, b) ((a)+(b)) + #define __Pyx_c_diff_double(a, b) ((a)-(b)) + #define __Pyx_c_prod_double(a, b) ((a)*(b)) + #define __Pyx_c_quot_double(a, b) ((a)/(b)) + #define __Pyx_c_neg_double(a) (-(a)) + #ifdef __cplusplus + #define __Pyx_c_is_zero_double(z) ((z)==(double)0) + #define __Pyx_c_conj_double(z) (::std::conj(z)) + #if 1 + #define __Pyx_c_abs_double(z) (::std::abs(z)) + #define __Pyx_c_pow_double(a, b) (::std::pow(a, b)) + #endif + #else + #define __Pyx_c_is_zero_double(z) ((z)==0) + #define __Pyx_c_conj_double(z) (conj(z)) + #if 1 + #define __Pyx_c_abs_double(z) (cabs(z)) + #define __Pyx_c_pow_double(a, b) (cpow(a, b)) + #endif + #endif +#else + static CYTHON_INLINE int __Pyx_c_eq_double(__pyx_t_double_complex, __pyx_t_double_complex); + static CYTHON_INLINE __pyx_t_double_complex __Pyx_c_sum_double(__pyx_t_double_complex, __pyx_t_double_complex); + static CYTHON_INLINE __pyx_t_double_complex __Pyx_c_diff_double(__pyx_t_double_complex, __pyx_t_double_complex); + static CYTHON_INLINE __pyx_t_double_complex __Pyx_c_prod_double(__pyx_t_double_complex, __pyx_t_double_complex); + static CYTHON_INLINE __pyx_t_double_complex __Pyx_c_quot_double(__pyx_t_double_complex, __pyx_t_double_complex); + static CYTHON_INLINE __pyx_t_double_complex __Pyx_c_neg_double(__pyx_t_double_complex); + static CYTHON_INLINE int __Pyx_c_is_zero_double(__pyx_t_double_complex); + static CYTHON_INLINE __pyx_t_double_complex __Pyx_c_conj_double(__pyx_t_double_complex); + #if 1 + static CYTHON_INLINE double __Pyx_c_abs_double(__pyx_t_double_complex); + static CYTHON_INLINE __pyx_t_double_complex __Pyx_c_pow_double(__pyx_t_double_complex, __pyx_t_double_complex); + #endif +#endif + +/* Arithmetic.proto */ +#if CYTHON_CCOMPLEX && (1) && (!0 || __cplusplus) + #define __Pyx_c_eq_long__double(a, b) ((a)==(b)) + #define __Pyx_c_sum_long__double(a, b) ((a)+(b)) + #define __Pyx_c_diff_long__double(a, b) ((a)-(b)) + #define __Pyx_c_prod_long__double(a, b) ((a)*(b)) + #define __Pyx_c_quot_long__double(a, b) ((a)/(b)) + #define __Pyx_c_neg_long__double(a) (-(a)) + #ifdef __cplusplus + #define __Pyx_c_is_zero_long__double(z) ((z)==(long double)0) + #define __Pyx_c_conj_long__double(z) (::std::conj(z)) + #if 1 + #define __Pyx_c_abs_long__double(z) (::std::abs(z)) + #define __Pyx_c_pow_long__double(a, b) (::std::pow(a, b)) + #endif + #else + #define __Pyx_c_is_zero_long__double(z) ((z)==0) + #define __Pyx_c_conj_long__double(z) (conjl(z)) + #if 1 + #define __Pyx_c_abs_long__double(z) (cabsl(z)) + #define __Pyx_c_pow_long__double(a, b) (cpowl(a, b)) + #endif + #endif +#else + static CYTHON_INLINE int __Pyx_c_eq_long__double(__pyx_t_long_double_complex, __pyx_t_long_double_complex); + static CYTHON_INLINE __pyx_t_long_double_complex __Pyx_c_sum_long__double(__pyx_t_long_double_complex, __pyx_t_long_double_complex); + static CYTHON_INLINE __pyx_t_long_double_complex __Pyx_c_diff_long__double(__pyx_t_long_double_complex, __pyx_t_long_double_complex); + static CYTHON_INLINE __pyx_t_long_double_complex __Pyx_c_prod_long__double(__pyx_t_long_double_complex, __pyx_t_long_double_complex); + static CYTHON_INLINE __pyx_t_long_double_complex __Pyx_c_quot_long__double(__pyx_t_long_double_complex, __pyx_t_long_double_complex); + static CYTHON_INLINE __pyx_t_long_double_complex __Pyx_c_neg_long__double(__pyx_t_long_double_complex); + static CYTHON_INLINE int __Pyx_c_is_zero_long__double(__pyx_t_long_double_complex); + static CYTHON_INLINE __pyx_t_long_double_complex __Pyx_c_conj_long__double(__pyx_t_long_double_complex); + #if 1 + static CYTHON_INLINE long double __Pyx_c_abs_long__double(__pyx_t_long_double_complex); + static CYTHON_INLINE __pyx_t_long_double_complex __Pyx_c_pow_long__double(__pyx_t_long_double_complex, __pyx_t_long_double_complex); + #endif +#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 *); + +/* CIntFromPy.proto */ +static CYTHON_INLINE size_t __Pyx_PyLong_As_size_t(PyObject *); + +/* CIntToPy.proto */ +static CYTHON_INLINE PyObject* __Pyx_PyLong_From_uint64_t(uint64_t 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); + +/* AddModuleRef.proto */ +#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 + +/* 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 "." + +static CYTHON_INLINE npy_intp __pyx_f_5numpy_5dtype_8itemsize_itemsize(PyArray_Descr *__pyx_v_self); /* proto*/ +static CYTHON_INLINE npy_intp __pyx_f_5numpy_5dtype_9alignment_alignment(PyArray_Descr *__pyx_v_self); /* proto*/ +static CYTHON_INLINE PyObject *__pyx_f_5numpy_5dtype_6fields_fields(PyArray_Descr *__pyx_v_self); /* proto*/ +static CYTHON_INLINE PyObject *__pyx_f_5numpy_5dtype_5names_names(PyArray_Descr *__pyx_v_self); /* proto*/ +static CYTHON_INLINE PyArray_ArrayDescr *__pyx_f_5numpy_5dtype_8subarray_subarray(PyArray_Descr *__pyx_v_self); /* proto*/ +static CYTHON_INLINE npy_uint64 __pyx_f_5numpy_5dtype_5flags_flags(PyArray_Descr *__pyx_v_self); /* proto*/ +static CYTHON_INLINE int __pyx_f_5numpy_9broadcast_7numiter_numiter(PyArrayMultiIterObject *__pyx_v_self); /* proto*/ +static CYTHON_INLINE npy_intp __pyx_f_5numpy_9broadcast_4size_size(PyArrayMultiIterObject *__pyx_v_self); /* proto*/ +static CYTHON_INLINE npy_intp __pyx_f_5numpy_9broadcast_5index_index(PyArrayMultiIterObject *__pyx_v_self); /* proto*/ +static CYTHON_INLINE int __pyx_f_5numpy_9broadcast_2nd_nd(PyArrayMultiIterObject *__pyx_v_self); /* proto*/ +static CYTHON_INLINE npy_intp *__pyx_f_5numpy_9broadcast_10dimensions_dimensions(PyArrayMultiIterObject *__pyx_v_self); /* proto*/ +static CYTHON_INLINE void **__pyx_f_5numpy_9broadcast_5iters_iters(PyArrayMultiIterObject *__pyx_v_self); /* proto*/ +static CYTHON_INLINE PyObject *__pyx_f_5numpy_7ndarray_4base_base(PyArrayObject *__pyx_v_self); /* proto*/ +static CYTHON_INLINE PyArray_Descr *__pyx_f_5numpy_7ndarray_5descr_descr(PyArrayObject *__pyx_v_self); /* proto*/ +static CYTHON_INLINE int __pyx_f_5numpy_7ndarray_4ndim_ndim(PyArrayObject *__pyx_v_self); /* proto*/ +static CYTHON_INLINE npy_intp *__pyx_f_5numpy_7ndarray_5shape_shape(PyArrayObject *__pyx_v_self); /* proto*/ +static CYTHON_INLINE npy_intp *__pyx_f_5numpy_7ndarray_7strides_strides(PyArrayObject *__pyx_v_self); /* proto*/ +static CYTHON_INLINE npy_intp __pyx_f_5numpy_7ndarray_4size_size(PyArrayObject *__pyx_v_self); /* proto*/ +static CYTHON_INLINE char *__pyx_f_5numpy_7ndarray_4data_data(PyArrayObject *__pyx_v_self); /* proto*/ +static CYTHON_INLINE struct __pyx_obj_5spacy_6lexeme_Lexeme *__pyx_f_5spacy_6lexeme_6Lexeme_from_ptr(struct __pyx_t_5spacy_7structs_LexemeC *__pyx_v_lex, struct __pyx_obj_5spacy_5vocab_Vocab *__pyx_v_vocab); /* proto*/ +static CYTHON_INLINE void __pyx_f_5spacy_6lexeme_6Lexeme_set_struct_attr(struct __pyx_t_5spacy_7structs_LexemeC *__pyx_v_lex, enum __pyx_t_5spacy_5attrs_attr_id_t __pyx_v_name, __pyx_t_5spacy_8typedefs_attr_t __pyx_v_value); /* proto*/ +static CYTHON_INLINE __pyx_t_5spacy_8typedefs_attr_t __pyx_f_5spacy_6lexeme_6Lexeme_get_struct_attr(struct __pyx_t_5spacy_7structs_LexemeC const *__pyx_v_lex, enum __pyx_t_5spacy_5attrs_attr_id_t __pyx_v_feat_name); /* proto*/ +static CYTHON_INLINE int __pyx_f_5spacy_6lexeme_6Lexeme_c_check_flag(struct __pyx_t_5spacy_7structs_LexemeC const *__pyx_v_lexeme, enum __pyx_t_5spacy_5attrs_attr_id_t __pyx_v_flag_id); /* proto*/ +static CYTHON_INLINE int __pyx_f_5spacy_6lexeme_6Lexeme_c_set_flag(struct __pyx_t_5spacy_7structs_LexemeC *__pyx_v_lex, enum __pyx_t_5spacy_5attrs_attr_id_t __pyx_v_flag_id, int __pyx_v_value); /* proto*/ + +/* Module declarations from "libcpp" */ + +/* Module declarations from "libc.string" */ + +/* Module declarations from "libc.stdio" */ + +/* Module declarations from "__builtin__" */ + +/* Module declarations from "cpython.type" */ + +/* Module declarations from "cpython" */ + +/* Module declarations from "cpython.object" */ + +/* Module declarations from "cpython.exc" */ + +/* Module declarations from "libc.stdint" */ + +/* Module declarations from "libc.stdlib" */ + +/* Module declarations from "libcpp.utility" */ + +/* Module declarations from "libcpp.set" */ + +/* Module declarations from "libcpp.unordered_map" */ + +/* Module declarations from "libcpp.vector" */ + +/* Module declarations from "murmurhash.mrmr" */ +static uint64_t (*__pyx_f_10murmurhash_4mrmr_hash64)(void *, int, uint64_t); /*proto*/ + +/* Module declarations from "spacy" */ + +/* Module declarations from "spacy.symbols" */ + +/* Module declarations from "spacy.attrs" */ + +/* Module declarations from "cpython.ref" */ + +/* Module declarations from "numpy" */ + +/* Module declarations from "numpy" */ + +/* Module declarations from "cymem.cymem" */ + +/* Module declarations from "preshed.maps" */ + +/* Module declarations from "spacy.typedefs" */ + +/* Module declarations from "spacy.strings" */ + +/* Module declarations from "libcpp.unordered_set" */ + +/* Module declarations from "spacy.parts_of_speech" */ + +/* Module declarations from "spacy.structs" */ + +/* Module declarations from "spacy.morphology" */ + +/* Module declarations from "spacy.vocab" */ +static struct __pyx_t_5spacy_7structs_LexemeC *__pyx_vp_5spacy_5vocab_EMPTY_LEXEME = 0; +#define __pyx_v_5spacy_5vocab_EMPTY_LEXEME (*__pyx_vp_5spacy_5vocab_EMPTY_LEXEME) + +/* Module declarations from "spacy.lexeme" */ +static struct __pyx_t_5spacy_7structs_LexemeC *__pyx_vp_5spacy_6lexeme_EMPTY_LEXEME = 0; +#define __pyx_v_5spacy_6lexeme_EMPTY_LEXEME (*__pyx_vp_5spacy_6lexeme_EMPTY_LEXEME) +static __pyx_t_5spacy_8typedefs_attr_t *__pyx_vp_5spacy_6lexeme_OOV_RANK = 0; +#define __pyx_v_5spacy_6lexeme_OOV_RANK (*__pyx_vp_5spacy_6lexeme_OOV_RANK) + +/* Module declarations from "spacy.pipeline._parser_internals._state" */ +/* #### Code section: typeinfo ### */ +/* #### Code section: before_global_var ### */ +#define __Pyx_MODULE_NAME "spacy.pipeline._parser_internals._state" +extern int __pyx_module_is_main_spacy__pipeline___parser_internals___state; +int __pyx_module_is_main_spacy__pipeline___parser_internals___state = 0; + +/* Implementation of "spacy.pipeline._parser_internals._state" */ +/* #### Code section: global_var ### */ +/* #### Code section: string_decls ### */ +/* #### Code section: decls ### */ +/* #### 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_7cpython_4type_type; + PyTypeObject *__pyx_ptype_5numpy_dtype; + PyTypeObject *__pyx_ptype_5numpy_flatiter; + PyTypeObject *__pyx_ptype_5numpy_broadcast; + PyTypeObject *__pyx_ptype_5numpy_ndarray; + PyTypeObject *__pyx_ptype_5numpy_generic; + PyTypeObject *__pyx_ptype_5numpy_number; + PyTypeObject *__pyx_ptype_5numpy_integer; + PyTypeObject *__pyx_ptype_5numpy_signedinteger; + PyTypeObject *__pyx_ptype_5numpy_unsignedinteger; + PyTypeObject *__pyx_ptype_5numpy_inexact; + PyTypeObject *__pyx_ptype_5numpy_floating; + PyTypeObject *__pyx_ptype_5numpy_complexfloating; + PyTypeObject *__pyx_ptype_5numpy_flexible; + PyTypeObject *__pyx_ptype_5numpy_character; + PyTypeObject *__pyx_ptype_5numpy_ufunc; + PyTypeObject *__pyx_ptype_5cymem_5cymem_PyMalloc; + PyTypeObject *__pyx_ptype_5cymem_5cymem_PyFree; + PyTypeObject *__pyx_ptype_5cymem_5cymem_Pool; + PyTypeObject *__pyx_ptype_5cymem_5cymem_Address; + PyTypeObject *__pyx_ptype_7preshed_4maps_PreshMap; + PyTypeObject *__pyx_ptype_7preshed_4maps_PreshMapArray; + PyTypeObject *__pyx_ptype_5spacy_7strings_StringStore; + PyTypeObject *__pyx_ptype_5spacy_10morphology_Morphology; + PyTypeObject *__pyx_ptype_5spacy_5vocab_Vocab; + PyTypeObject *__pyx_ptype_5spacy_6lexeme_Lexeme; + PyObject *__pyx_string_tab[14]; +/* #### Code section: module_state_contents ### */ +/* 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_numpy__core_multiarray_failed_to __pyx_string_tab[1] +#define __pyx_kp_u_numpy__core_umath_failed_to_impo __pyx_string_tab[2] +#define __pyx_n_u_cline_in_traceback __pyx_string_tab[3] +#define __pyx_n_u_main __pyx_string_tab[4] +#define __pyx_n_u_module __pyx_string_tab[5] +#define __pyx_n_u_name __pyx_string_tab[6] +#define __pyx_n_u_pyx_vtable __pyx_string_tab[7] +#define __pyx_n_u_qualname __pyx_string_tab[8] +#define __pyx_n_u_setdefault __pyx_string_tab[9] +#define __pyx_n_u_test __pyx_string_tab[10] +#define __pyx_kp_b_pyx_t_5spacy_8typedefs_attr_t __pyx_string_tab[11] +#define __pyx_kp_b_struct___pyx_t_5spacy_7structs_L __pyx_string_tab[12] +#define __pyx_kp_b_uint64_t_void_int_uint64_t_hash6 __pyx_string_tab[13] +/* #### 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_7cpython_4type_type); + Py_CLEAR(clear_module_state->__pyx_ptype_5numpy_dtype); + Py_CLEAR(clear_module_state->__pyx_ptype_5numpy_flatiter); + Py_CLEAR(clear_module_state->__pyx_ptype_5numpy_broadcast); + Py_CLEAR(clear_module_state->__pyx_ptype_5numpy_ndarray); + Py_CLEAR(clear_module_state->__pyx_ptype_5numpy_generic); + Py_CLEAR(clear_module_state->__pyx_ptype_5numpy_number); + Py_CLEAR(clear_module_state->__pyx_ptype_5numpy_integer); + Py_CLEAR(clear_module_state->__pyx_ptype_5numpy_signedinteger); + Py_CLEAR(clear_module_state->__pyx_ptype_5numpy_unsignedinteger); + Py_CLEAR(clear_module_state->__pyx_ptype_5numpy_inexact); + Py_CLEAR(clear_module_state->__pyx_ptype_5numpy_floating); + Py_CLEAR(clear_module_state->__pyx_ptype_5numpy_complexfloating); + Py_CLEAR(clear_module_state->__pyx_ptype_5numpy_flexible); + Py_CLEAR(clear_module_state->__pyx_ptype_5numpy_character); + Py_CLEAR(clear_module_state->__pyx_ptype_5numpy_ufunc); + Py_CLEAR(clear_module_state->__pyx_ptype_5cymem_5cymem_PyMalloc); + Py_CLEAR(clear_module_state->__pyx_ptype_5cymem_5cymem_PyFree); + Py_CLEAR(clear_module_state->__pyx_ptype_5cymem_5cymem_Pool); + Py_CLEAR(clear_module_state->__pyx_ptype_5cymem_5cymem_Address); + Py_CLEAR(clear_module_state->__pyx_ptype_7preshed_4maps_PreshMap); + Py_CLEAR(clear_module_state->__pyx_ptype_7preshed_4maps_PreshMapArray); + Py_CLEAR(clear_module_state->__pyx_ptype_5spacy_7strings_StringStore); + Py_CLEAR(clear_module_state->__pyx_ptype_5spacy_10morphology_Morphology); + Py_CLEAR(clear_module_state->__pyx_ptype_5spacy_5vocab_Vocab); + Py_CLEAR(clear_module_state->__pyx_ptype_5spacy_6lexeme_Lexeme); + for (int i=0; i<14; ++i) { Py_CLEAR(clear_module_state->__pyx_string_tab[i]); } +/* #### Code section: module_state_clear_contents ### */ +/* #### 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_7cpython_4type_type); + Py_VISIT(traverse_module_state->__pyx_ptype_5numpy_dtype); + Py_VISIT(traverse_module_state->__pyx_ptype_5numpy_flatiter); + Py_VISIT(traverse_module_state->__pyx_ptype_5numpy_broadcast); + Py_VISIT(traverse_module_state->__pyx_ptype_5numpy_ndarray); + Py_VISIT(traverse_module_state->__pyx_ptype_5numpy_generic); + Py_VISIT(traverse_module_state->__pyx_ptype_5numpy_number); + Py_VISIT(traverse_module_state->__pyx_ptype_5numpy_integer); + Py_VISIT(traverse_module_state->__pyx_ptype_5numpy_signedinteger); + Py_VISIT(traverse_module_state->__pyx_ptype_5numpy_unsignedinteger); + Py_VISIT(traverse_module_state->__pyx_ptype_5numpy_inexact); + Py_VISIT(traverse_module_state->__pyx_ptype_5numpy_floating); + Py_VISIT(traverse_module_state->__pyx_ptype_5numpy_complexfloating); + Py_VISIT(traverse_module_state->__pyx_ptype_5numpy_flexible); + Py_VISIT(traverse_module_state->__pyx_ptype_5numpy_character); + Py_VISIT(traverse_module_state->__pyx_ptype_5numpy_ufunc); + Py_VISIT(traverse_module_state->__pyx_ptype_5cymem_5cymem_PyMalloc); + Py_VISIT(traverse_module_state->__pyx_ptype_5cymem_5cymem_PyFree); + Py_VISIT(traverse_module_state->__pyx_ptype_5cymem_5cymem_Pool); + Py_VISIT(traverse_module_state->__pyx_ptype_5cymem_5cymem_Address); + Py_VISIT(traverse_module_state->__pyx_ptype_7preshed_4maps_PreshMap); + Py_VISIT(traverse_module_state->__pyx_ptype_7preshed_4maps_PreshMapArray); + Py_VISIT(traverse_module_state->__pyx_ptype_5spacy_7strings_StringStore); + Py_VISIT(traverse_module_state->__pyx_ptype_5spacy_10morphology_Morphology); + Py_VISIT(traverse_module_state->__pyx_ptype_5spacy_5vocab_Vocab); + Py_VISIT(traverse_module_state->__pyx_ptype_5spacy_6lexeme_Lexeme); + for (int i=0; i<14; ++i) { __Pyx_VISIT_CONST(traverse_module_state->__pyx_string_tab[i]); } +/* #### Code section: module_state_traverse_contents ### */ +/* #### Code section: module_state_traverse_end ### */ +return 0; +} +#endif +/* #### Code section: module_code ### */ + +/* "C:/Users/runneradmin/AppData/Local/Temp/build-env-ej_q3m8u/Lib/site-packages/numpy/__init__.cython-30.pxd":242 + * cdef int type_num + * + * @property # <<<<<<<<<<<<<< + * cdef inline npy_intp itemsize(self) noexcept nogil: + * return PyDataType_ELSIZE(self) +*/ + +static CYTHON_INLINE npy_intp __pyx_f_5numpy_5dtype_8itemsize_itemsize(PyArray_Descr *__pyx_v_self) { + npy_intp __pyx_r; + + /* "C:/Users/runneradmin/AppData/Local/Temp/build-env-ej_q3m8u/Lib/site-packages/numpy/__init__.cython-30.pxd":244 + * @property + * cdef inline npy_intp itemsize(self) noexcept nogil: + * return PyDataType_ELSIZE(self) # <<<<<<<<<<<<<< + * + * @property +*/ + __pyx_r = PyDataType_ELSIZE(__pyx_v_self); + goto __pyx_L0; + + /* "C:/Users/runneradmin/AppData/Local/Temp/build-env-ej_q3m8u/Lib/site-packages/numpy/__init__.cython-30.pxd":242 + * cdef int type_num + * + * @property # <<<<<<<<<<<<<< + * cdef inline npy_intp itemsize(self) noexcept nogil: + * return PyDataType_ELSIZE(self) +*/ + + /* function exit code */ + __pyx_L0:; + return __pyx_r; +} + +/* "C:/Users/runneradmin/AppData/Local/Temp/build-env-ej_q3m8u/Lib/site-packages/numpy/__init__.cython-30.pxd":246 + * return PyDataType_ELSIZE(self) + * + * @property # <<<<<<<<<<<<<< + * cdef inline npy_intp alignment(self) noexcept nogil: + * return PyDataType_ALIGNMENT(self) +*/ + +static CYTHON_INLINE npy_intp __pyx_f_5numpy_5dtype_9alignment_alignment(PyArray_Descr *__pyx_v_self) { + npy_intp __pyx_r; + + /* "C:/Users/runneradmin/AppData/Local/Temp/build-env-ej_q3m8u/Lib/site-packages/numpy/__init__.cython-30.pxd":248 + * @property + * cdef inline npy_intp alignment(self) noexcept nogil: + * return PyDataType_ALIGNMENT(self) # <<<<<<<<<<<<<< + * + * # Use fields/names with care as they may be NULL. You must check +*/ + __pyx_r = PyDataType_ALIGNMENT(__pyx_v_self); + goto __pyx_L0; + + /* "C:/Users/runneradmin/AppData/Local/Temp/build-env-ej_q3m8u/Lib/site-packages/numpy/__init__.cython-30.pxd":246 + * return PyDataType_ELSIZE(self) + * + * @property # <<<<<<<<<<<<<< + * cdef inline npy_intp alignment(self) noexcept nogil: + * return PyDataType_ALIGNMENT(self) +*/ + + /* function exit code */ + __pyx_L0:; + return __pyx_r; +} + +/* "C:/Users/runneradmin/AppData/Local/Temp/build-env-ej_q3m8u/Lib/site-packages/numpy/__init__.cython-30.pxd":252 + * # Use fields/names with care as they may be NULL. You must check + * # for this using PyDataType_HASFIELDS. + * @property # <<<<<<<<<<<<<< + * cdef inline object fields(self): + * return PyDataType_FIELDS(self) +*/ + +static CYTHON_INLINE PyObject *__pyx_f_5numpy_5dtype_6fields_fields(PyArray_Descr *__pyx_v_self) { + PyObject *__pyx_r = NULL; + __Pyx_RefNannyDeclarations + PyObject *__pyx_t_1; + __Pyx_RefNannySetupContext("fields", 0); + + /* "C:/Users/runneradmin/AppData/Local/Temp/build-env-ej_q3m8u/Lib/site-packages/numpy/__init__.cython-30.pxd":254 + * @property + * cdef inline object fields(self): + * return PyDataType_FIELDS(self) # <<<<<<<<<<<<<< + * + * @property +*/ + __Pyx_XDECREF(__pyx_r); + __pyx_t_1 = PyDataType_FIELDS(__pyx_v_self); + __Pyx_INCREF(((PyObject *)__pyx_t_1)); + __pyx_r = ((PyObject *)__pyx_t_1); + goto __pyx_L0; + + /* "C:/Users/runneradmin/AppData/Local/Temp/build-env-ej_q3m8u/Lib/site-packages/numpy/__init__.cython-30.pxd":252 + * # Use fields/names with care as they may be NULL. You must check + * # for this using PyDataType_HASFIELDS. + * @property # <<<<<<<<<<<<<< + * cdef inline object fields(self): + * return PyDataType_FIELDS(self) +*/ + + /* function exit code */ + __pyx_L0:; + __Pyx_XGIVEREF(__pyx_r); + __Pyx_RefNannyFinishContext(); + return __pyx_r; +} + +/* "C:/Users/runneradmin/AppData/Local/Temp/build-env-ej_q3m8u/Lib/site-packages/numpy/__init__.cython-30.pxd":256 + * return PyDataType_FIELDS(self) + * + * @property # <<<<<<<<<<<<<< + * cdef inline tuple names(self): + * return PyDataType_NAMES(self) +*/ + +static CYTHON_INLINE PyObject *__pyx_f_5numpy_5dtype_5names_names(PyArray_Descr *__pyx_v_self) { + PyObject *__pyx_r = NULL; + __Pyx_RefNannyDeclarations + PyObject *__pyx_t_1; + __Pyx_RefNannySetupContext("names", 0); + + /* "C:/Users/runneradmin/AppData/Local/Temp/build-env-ej_q3m8u/Lib/site-packages/numpy/__init__.cython-30.pxd":258 + * @property + * cdef inline tuple names(self): + * return PyDataType_NAMES(self) # <<<<<<<<<<<<<< + * + * # Use PyDataType_HASSUBARRAY to test whether this field is +*/ + __Pyx_XDECREF(__pyx_r); + __pyx_t_1 = PyDataType_NAMES(__pyx_v_self); + __Pyx_INCREF(((PyObject*)__pyx_t_1)); + __pyx_r = ((PyObject*)__pyx_t_1); + goto __pyx_L0; + + /* "C:/Users/runneradmin/AppData/Local/Temp/build-env-ej_q3m8u/Lib/site-packages/numpy/__init__.cython-30.pxd":256 + * return PyDataType_FIELDS(self) + * + * @property # <<<<<<<<<<<<<< + * cdef inline tuple names(self): + * return PyDataType_NAMES(self) +*/ + + /* function exit code */ + __pyx_L0:; + __Pyx_XGIVEREF(__pyx_r); + __Pyx_RefNannyFinishContext(); + return __pyx_r; +} + +/* "C:/Users/runneradmin/AppData/Local/Temp/build-env-ej_q3m8u/Lib/site-packages/numpy/__init__.cython-30.pxd":263 + * # valid (the pointer can be NULL). Most users should access + * # this field via the inline helper method PyDataType_SHAPE. + * @property # <<<<<<<<<<<<<< + * cdef inline PyArray_ArrayDescr* subarray(self) noexcept nogil: + * return PyDataType_SUBARRAY(self) +*/ + +static CYTHON_INLINE PyArray_ArrayDescr *__pyx_f_5numpy_5dtype_8subarray_subarray(PyArray_Descr *__pyx_v_self) { + PyArray_ArrayDescr *__pyx_r; + + /* "C:/Users/runneradmin/AppData/Local/Temp/build-env-ej_q3m8u/Lib/site-packages/numpy/__init__.cython-30.pxd":265 + * @property + * cdef inline PyArray_ArrayDescr* subarray(self) noexcept nogil: + * return PyDataType_SUBARRAY(self) # <<<<<<<<<<<<<< + * + * @property +*/ + __pyx_r = PyDataType_SUBARRAY(__pyx_v_self); + goto __pyx_L0; + + /* "C:/Users/runneradmin/AppData/Local/Temp/build-env-ej_q3m8u/Lib/site-packages/numpy/__init__.cython-30.pxd":263 + * # valid (the pointer can be NULL). Most users should access + * # this field via the inline helper method PyDataType_SHAPE. + * @property # <<<<<<<<<<<<<< + * cdef inline PyArray_ArrayDescr* subarray(self) noexcept nogil: + * return PyDataType_SUBARRAY(self) +*/ + + /* function exit code */ + __pyx_L0:; + return __pyx_r; +} + +/* "C:/Users/runneradmin/AppData/Local/Temp/build-env-ej_q3m8u/Lib/site-packages/numpy/__init__.cython-30.pxd":267 + * return PyDataType_SUBARRAY(self) + * + * @property # <<<<<<<<<<<<<< + * cdef inline npy_uint64 flags(self) noexcept nogil: + * """The data types flags.""" +*/ + +static CYTHON_INLINE npy_uint64 __pyx_f_5numpy_5dtype_5flags_flags(PyArray_Descr *__pyx_v_self) { + npy_uint64 __pyx_r; + + /* "C:/Users/runneradmin/AppData/Local/Temp/build-env-ej_q3m8u/Lib/site-packages/numpy/__init__.cython-30.pxd":270 + * cdef inline npy_uint64 flags(self) noexcept nogil: + * """The data types flags.""" + * return PyDataType_FLAGS(self) # <<<<<<<<<<<<<< + * + * +*/ + __pyx_r = PyDataType_FLAGS(__pyx_v_self); + goto __pyx_L0; + + /* "C:/Users/runneradmin/AppData/Local/Temp/build-env-ej_q3m8u/Lib/site-packages/numpy/__init__.cython-30.pxd":267 + * return PyDataType_SUBARRAY(self) + * + * @property # <<<<<<<<<<<<<< + * cdef inline npy_uint64 flags(self) noexcept nogil: + * """The data types flags.""" +*/ + + /* function exit code */ + __pyx_L0:; + return __pyx_r; +} + +/* "C:/Users/runneradmin/AppData/Local/Temp/build-env-ej_q3m8u/Lib/site-packages/numpy/__init__.cython-30.pxd":279 + * ctypedef class numpy.broadcast [object PyArrayMultiIterObject, check_size ignore]: + * + * @property # <<<<<<<<<<<<<< + * cdef inline int numiter(self) noexcept nogil: + * """The number of arrays that need to be broadcast to the same shape.""" +*/ + +static CYTHON_INLINE int __pyx_f_5numpy_9broadcast_7numiter_numiter(PyArrayMultiIterObject *__pyx_v_self) { + int __pyx_r; + + /* "C:/Users/runneradmin/AppData/Local/Temp/build-env-ej_q3m8u/Lib/site-packages/numpy/__init__.cython-30.pxd":282 + * cdef inline int numiter(self) noexcept nogil: + * """The number of arrays that need to be broadcast to the same shape.""" + * return PyArray_MultiIter_NUMITER(self) # <<<<<<<<<<<<<< + * + * @property +*/ + __pyx_r = PyArray_MultiIter_NUMITER(__pyx_v_self); + goto __pyx_L0; + + /* "C:/Users/runneradmin/AppData/Local/Temp/build-env-ej_q3m8u/Lib/site-packages/numpy/__init__.cython-30.pxd":279 + * ctypedef class numpy.broadcast [object PyArrayMultiIterObject, check_size ignore]: + * + * @property # <<<<<<<<<<<<<< + * cdef inline int numiter(self) noexcept nogil: + * """The number of arrays that need to be broadcast to the same shape.""" +*/ + + /* function exit code */ + __pyx_L0:; + return __pyx_r; +} + +/* "C:/Users/runneradmin/AppData/Local/Temp/build-env-ej_q3m8u/Lib/site-packages/numpy/__init__.cython-30.pxd":284 + * return PyArray_MultiIter_NUMITER(self) + * + * @property # <<<<<<<<<<<<<< + * cdef inline npy_intp size(self) noexcept nogil: + * """The total broadcasted size.""" +*/ + +static CYTHON_INLINE npy_intp __pyx_f_5numpy_9broadcast_4size_size(PyArrayMultiIterObject *__pyx_v_self) { + npy_intp __pyx_r; + + /* "C:/Users/runneradmin/AppData/Local/Temp/build-env-ej_q3m8u/Lib/site-packages/numpy/__init__.cython-30.pxd":287 + * cdef inline npy_intp size(self) noexcept nogil: + * """The total broadcasted size.""" + * return PyArray_MultiIter_SIZE(self) # <<<<<<<<<<<<<< + * + * @property +*/ + __pyx_r = PyArray_MultiIter_SIZE(__pyx_v_self); + goto __pyx_L0; + + /* "C:/Users/runneradmin/AppData/Local/Temp/build-env-ej_q3m8u/Lib/site-packages/numpy/__init__.cython-30.pxd":284 + * return PyArray_MultiIter_NUMITER(self) + * + * @property # <<<<<<<<<<<<<< + * cdef inline npy_intp size(self) noexcept nogil: + * """The total broadcasted size.""" +*/ + + /* function exit code */ + __pyx_L0:; + return __pyx_r; +} + +/* "C:/Users/runneradmin/AppData/Local/Temp/build-env-ej_q3m8u/Lib/site-packages/numpy/__init__.cython-30.pxd":289 + * return PyArray_MultiIter_SIZE(self) + * + * @property # <<<<<<<<<<<<<< + * cdef inline npy_intp index(self) noexcept nogil: + * """The current (1-d) index into the broadcasted result.""" +*/ + +static CYTHON_INLINE npy_intp __pyx_f_5numpy_9broadcast_5index_index(PyArrayMultiIterObject *__pyx_v_self) { + npy_intp __pyx_r; + + /* "C:/Users/runneradmin/AppData/Local/Temp/build-env-ej_q3m8u/Lib/site-packages/numpy/__init__.cython-30.pxd":292 + * cdef inline npy_intp index(self) noexcept nogil: + * """The current (1-d) index into the broadcasted result.""" + * return PyArray_MultiIter_INDEX(self) # <<<<<<<<<<<<<< + * + * @property +*/ + __pyx_r = PyArray_MultiIter_INDEX(__pyx_v_self); + goto __pyx_L0; + + /* "C:/Users/runneradmin/AppData/Local/Temp/build-env-ej_q3m8u/Lib/site-packages/numpy/__init__.cython-30.pxd":289 + * return PyArray_MultiIter_SIZE(self) + * + * @property # <<<<<<<<<<<<<< + * cdef inline npy_intp index(self) noexcept nogil: + * """The current (1-d) index into the broadcasted result.""" +*/ + + /* function exit code */ + __pyx_L0:; + return __pyx_r; +} + +/* "C:/Users/runneradmin/AppData/Local/Temp/build-env-ej_q3m8u/Lib/site-packages/numpy/__init__.cython-30.pxd":294 + * return PyArray_MultiIter_INDEX(self) + * + * @property # <<<<<<<<<<<<<< + * cdef inline int nd(self) noexcept nogil: + * """The number of dimensions in the broadcasted result.""" +*/ + +static CYTHON_INLINE int __pyx_f_5numpy_9broadcast_2nd_nd(PyArrayMultiIterObject *__pyx_v_self) { + int __pyx_r; + + /* "C:/Users/runneradmin/AppData/Local/Temp/build-env-ej_q3m8u/Lib/site-packages/numpy/__init__.cython-30.pxd":297 + * cdef inline int nd(self) noexcept nogil: + * """The number of dimensions in the broadcasted result.""" + * return PyArray_MultiIter_NDIM(self) # <<<<<<<<<<<<<< + * + * @property +*/ + __pyx_r = PyArray_MultiIter_NDIM(__pyx_v_self); + goto __pyx_L0; + + /* "C:/Users/runneradmin/AppData/Local/Temp/build-env-ej_q3m8u/Lib/site-packages/numpy/__init__.cython-30.pxd":294 + * return PyArray_MultiIter_INDEX(self) + * + * @property # <<<<<<<<<<<<<< + * cdef inline int nd(self) noexcept nogil: + * """The number of dimensions in the broadcasted result.""" +*/ + + /* function exit code */ + __pyx_L0:; + return __pyx_r; +} + +/* "C:/Users/runneradmin/AppData/Local/Temp/build-env-ej_q3m8u/Lib/site-packages/numpy/__init__.cython-30.pxd":299 + * return PyArray_MultiIter_NDIM(self) + * + * @property # <<<<<<<<<<<<<< + * cdef inline npy_intp* dimensions(self) noexcept nogil: + * """The shape of the broadcasted result.""" +*/ + +static CYTHON_INLINE npy_intp *__pyx_f_5numpy_9broadcast_10dimensions_dimensions(PyArrayMultiIterObject *__pyx_v_self) { + npy_intp *__pyx_r; + + /* "C:/Users/runneradmin/AppData/Local/Temp/build-env-ej_q3m8u/Lib/site-packages/numpy/__init__.cython-30.pxd":302 + * cdef inline npy_intp* dimensions(self) noexcept nogil: + * """The shape of the broadcasted result.""" + * return PyArray_MultiIter_DIMS(self) # <<<<<<<<<<<<<< + * + * @property +*/ + __pyx_r = PyArray_MultiIter_DIMS(__pyx_v_self); + goto __pyx_L0; + + /* "C:/Users/runneradmin/AppData/Local/Temp/build-env-ej_q3m8u/Lib/site-packages/numpy/__init__.cython-30.pxd":299 + * return PyArray_MultiIter_NDIM(self) + * + * @property # <<<<<<<<<<<<<< + * cdef inline npy_intp* dimensions(self) noexcept nogil: + * """The shape of the broadcasted result.""" +*/ + + /* function exit code */ + __pyx_L0:; + return __pyx_r; +} + +/* "C:/Users/runneradmin/AppData/Local/Temp/build-env-ej_q3m8u/Lib/site-packages/numpy/__init__.cython-30.pxd":304 + * return PyArray_MultiIter_DIMS(self) + * + * @property # <<<<<<<<<<<<<< + * cdef inline void** iters(self) noexcept nogil: + * """An array of iterator objects that holds the iterators for the arrays to be broadcast together. +*/ + +static CYTHON_INLINE void **__pyx_f_5numpy_9broadcast_5iters_iters(PyArrayMultiIterObject *__pyx_v_self) { + void **__pyx_r; + + /* "C:/Users/runneradmin/AppData/Local/Temp/build-env-ej_q3m8u/Lib/site-packages/numpy/__init__.cython-30.pxd":308 + * """An array of iterator objects that holds the iterators for the arrays to be broadcast together. + * On return, the iterators are adjusted for broadcasting.""" + * return PyArray_MultiIter_ITERS(self) # <<<<<<<<<<<<<< + * + * +*/ + __pyx_r = PyArray_MultiIter_ITERS(__pyx_v_self); + goto __pyx_L0; + + /* "C:/Users/runneradmin/AppData/Local/Temp/build-env-ej_q3m8u/Lib/site-packages/numpy/__init__.cython-30.pxd":304 + * return PyArray_MultiIter_DIMS(self) + * + * @property # <<<<<<<<<<<<<< + * cdef inline void** iters(self) noexcept nogil: + * """An array of iterator objects that holds the iterators for the arrays to be broadcast together. +*/ + + /* function exit code */ + __pyx_L0:; + return __pyx_r; +} + +/* "C:/Users/runneradmin/AppData/Local/Temp/build-env-ej_q3m8u/Lib/site-packages/numpy/__init__.cython-30.pxd":322 + * # Instead, we use properties that map to the corresponding C-API functions. + * + * @property # <<<<<<<<<<<<<< + * cdef inline PyObject* base(self) noexcept nogil: + * """Returns a borrowed reference to the object owning the data/memory. +*/ + +static CYTHON_INLINE PyObject *__pyx_f_5numpy_7ndarray_4base_base(PyArrayObject *__pyx_v_self) { + PyObject *__pyx_r; + + /* "C:/Users/runneradmin/AppData/Local/Temp/build-env-ej_q3m8u/Lib/site-packages/numpy/__init__.cython-30.pxd":326 + * """Returns a borrowed reference to the object owning the data/memory. + * """ + * return PyArray_BASE(self) # <<<<<<<<<<<<<< + * + * @property +*/ + __pyx_r = PyArray_BASE(__pyx_v_self); + goto __pyx_L0; + + /* "C:/Users/runneradmin/AppData/Local/Temp/build-env-ej_q3m8u/Lib/site-packages/numpy/__init__.cython-30.pxd":322 + * # Instead, we use properties that map to the corresponding C-API functions. + * + * @property # <<<<<<<<<<<<<< + * cdef inline PyObject* base(self) noexcept nogil: + * """Returns a borrowed reference to the object owning the data/memory. +*/ + + /* function exit code */ + __pyx_L0:; + return __pyx_r; +} + +/* "C:/Users/runneradmin/AppData/Local/Temp/build-env-ej_q3m8u/Lib/site-packages/numpy/__init__.cython-30.pxd":328 + * return PyArray_BASE(self) + * + * @property # <<<<<<<<<<<<<< + * cdef inline dtype descr(self): + * """Returns an owned reference to the dtype of the array. +*/ + +static CYTHON_INLINE PyArray_Descr *__pyx_f_5numpy_7ndarray_5descr_descr(PyArrayObject *__pyx_v_self) { + PyArray_Descr *__pyx_r = NULL; + __Pyx_RefNannyDeclarations + PyArray_Descr *__pyx_t_1; + __Pyx_RefNannySetupContext("descr", 0); + + /* "C:/Users/runneradmin/AppData/Local/Temp/build-env-ej_q3m8u/Lib/site-packages/numpy/__init__.cython-30.pxd":332 + * """Returns an owned reference to the dtype of the array. + * """ + * return PyArray_DESCR(self) # <<<<<<<<<<<<<< + * + * @property +*/ + __Pyx_XDECREF((PyObject *)__pyx_r); + __pyx_t_1 = PyArray_DESCR(__pyx_v_self); + __Pyx_INCREF((PyObject *)((PyArray_Descr *)__pyx_t_1)); + __pyx_r = ((PyArray_Descr *)__pyx_t_1); + goto __pyx_L0; + + /* "C:/Users/runneradmin/AppData/Local/Temp/build-env-ej_q3m8u/Lib/site-packages/numpy/__init__.cython-30.pxd":328 + * return PyArray_BASE(self) + * + * @property # <<<<<<<<<<<<<< + * cdef inline dtype descr(self): + * """Returns an owned reference to the dtype of the array. +*/ + + /* function exit code */ + __pyx_L0:; + __Pyx_XGIVEREF((PyObject *)__pyx_r); + __Pyx_RefNannyFinishContext(); + return __pyx_r; +} + +/* "C:/Users/runneradmin/AppData/Local/Temp/build-env-ej_q3m8u/Lib/site-packages/numpy/__init__.cython-30.pxd":334 + * return PyArray_DESCR(self) + * + * @property # <<<<<<<<<<<<<< + * cdef inline int ndim(self) noexcept nogil: + * """Returns the number of dimensions in the array. +*/ + +static CYTHON_INLINE int __pyx_f_5numpy_7ndarray_4ndim_ndim(PyArrayObject *__pyx_v_self) { + int __pyx_r; + + /* "C:/Users/runneradmin/AppData/Local/Temp/build-env-ej_q3m8u/Lib/site-packages/numpy/__init__.cython-30.pxd":338 + * """Returns the number of dimensions in the array. + * """ + * return PyArray_NDIM(self) # <<<<<<<<<<<<<< + * + * @property +*/ + __pyx_r = PyArray_NDIM(__pyx_v_self); + goto __pyx_L0; + + /* "C:/Users/runneradmin/AppData/Local/Temp/build-env-ej_q3m8u/Lib/site-packages/numpy/__init__.cython-30.pxd":334 + * return PyArray_DESCR(self) + * + * @property # <<<<<<<<<<<<<< + * cdef inline int ndim(self) noexcept nogil: + * """Returns the number of dimensions in the array. +*/ + + /* function exit code */ + __pyx_L0:; + return __pyx_r; +} + +/* "C:/Users/runneradmin/AppData/Local/Temp/build-env-ej_q3m8u/Lib/site-packages/numpy/__init__.cython-30.pxd":340 + * return PyArray_NDIM(self) + * + * @property # <<<<<<<<<<<<<< + * cdef inline npy_intp *shape(self) noexcept nogil: + * """Returns a pointer to the dimensions/shape of the array. +*/ + +static CYTHON_INLINE npy_intp *__pyx_f_5numpy_7ndarray_5shape_shape(PyArrayObject *__pyx_v_self) { + npy_intp *__pyx_r; + + /* "C:/Users/runneradmin/AppData/Local/Temp/build-env-ej_q3m8u/Lib/site-packages/numpy/__init__.cython-30.pxd":346 + * Can return NULL for 0-dimensional arrays. + * """ + * return PyArray_DIMS(self) # <<<<<<<<<<<<<< + * + * @property +*/ + __pyx_r = PyArray_DIMS(__pyx_v_self); + goto __pyx_L0; + + /* "C:/Users/runneradmin/AppData/Local/Temp/build-env-ej_q3m8u/Lib/site-packages/numpy/__init__.cython-30.pxd":340 + * return PyArray_NDIM(self) + * + * @property # <<<<<<<<<<<<<< + * cdef inline npy_intp *shape(self) noexcept nogil: + * """Returns a pointer to the dimensions/shape of the array. +*/ + + /* function exit code */ + __pyx_L0:; + return __pyx_r; +} + +/* "C:/Users/runneradmin/AppData/Local/Temp/build-env-ej_q3m8u/Lib/site-packages/numpy/__init__.cython-30.pxd":348 + * return PyArray_DIMS(self) + * + * @property # <<<<<<<<<<<<<< + * cdef inline npy_intp *strides(self) noexcept nogil: + * """Returns a pointer to the strides of the array. +*/ + +static CYTHON_INLINE npy_intp *__pyx_f_5numpy_7ndarray_7strides_strides(PyArrayObject *__pyx_v_self) { + npy_intp *__pyx_r; + + /* "C:/Users/runneradmin/AppData/Local/Temp/build-env-ej_q3m8u/Lib/site-packages/numpy/__init__.cython-30.pxd":353 + * The number of elements matches the number of dimensions of the array (ndim). + * """ + * return PyArray_STRIDES(self) # <<<<<<<<<<<<<< + * + * @property +*/ + __pyx_r = PyArray_STRIDES(__pyx_v_self); + goto __pyx_L0; + + /* "C:/Users/runneradmin/AppData/Local/Temp/build-env-ej_q3m8u/Lib/site-packages/numpy/__init__.cython-30.pxd":348 + * return PyArray_DIMS(self) + * + * @property # <<<<<<<<<<<<<< + * cdef inline npy_intp *strides(self) noexcept nogil: + * """Returns a pointer to the strides of the array. +*/ + + /* function exit code */ + __pyx_L0:; + return __pyx_r; +} + +/* "C:/Users/runneradmin/AppData/Local/Temp/build-env-ej_q3m8u/Lib/site-packages/numpy/__init__.cython-30.pxd":355 + * return PyArray_STRIDES(self) + * + * @property # <<<<<<<<<<<<<< + * cdef inline npy_intp size(self) noexcept nogil: + * """Returns the total size (in number of elements) of the array. +*/ + +static CYTHON_INLINE npy_intp __pyx_f_5numpy_7ndarray_4size_size(PyArrayObject *__pyx_v_self) { + npy_intp __pyx_r; + + /* "C:/Users/runneradmin/AppData/Local/Temp/build-env-ej_q3m8u/Lib/site-packages/numpy/__init__.cython-30.pxd":359 + * """Returns the total size (in number of elements) of the array. + * """ + * return PyArray_SIZE(self) # <<<<<<<<<<<<<< + * + * @property +*/ + __pyx_r = PyArray_SIZE(__pyx_v_self); + goto __pyx_L0; + + /* "C:/Users/runneradmin/AppData/Local/Temp/build-env-ej_q3m8u/Lib/site-packages/numpy/__init__.cython-30.pxd":355 + * return PyArray_STRIDES(self) + * + * @property # <<<<<<<<<<<<<< + * cdef inline npy_intp size(self) noexcept nogil: + * """Returns the total size (in number of elements) of the array. +*/ + + /* function exit code */ + __pyx_L0:; + return __pyx_r; +} + +/* "C:/Users/runneradmin/AppData/Local/Temp/build-env-ej_q3m8u/Lib/site-packages/numpy/__init__.cython-30.pxd":361 + * return PyArray_SIZE(self) + * + * @property # <<<<<<<<<<<<<< + * cdef inline char* data(self) noexcept nogil: + * """The pointer to the data buffer as a char*. +*/ + +static CYTHON_INLINE char *__pyx_f_5numpy_7ndarray_4data_data(PyArrayObject *__pyx_v_self) { + char *__pyx_r; + + /* "C:/Users/runneradmin/AppData/Local/Temp/build-env-ej_q3m8u/Lib/site-packages/numpy/__init__.cython-30.pxd":368 + * of `PyArray_DATA()` instead, which returns a 'void*'. + * """ + * return PyArray_BYTES(self) # <<<<<<<<<<<<<< + * + * +*/ + __pyx_r = PyArray_BYTES(__pyx_v_self); + goto __pyx_L0; + + /* "C:/Users/runneradmin/AppData/Local/Temp/build-env-ej_q3m8u/Lib/site-packages/numpy/__init__.cython-30.pxd":361 + * return PyArray_SIZE(self) + * + * @property # <<<<<<<<<<<<<< + * cdef inline char* data(self) noexcept nogil: + * """The pointer to the data buffer as a char*. +*/ + + /* function exit code */ + __pyx_L0:; + return __pyx_r; +} + +/* "C:/Users/runneradmin/AppData/Local/Temp/build-env-ej_q3m8u/Lib/site-packages/numpy/__init__.cython-30.pxd":776 + * ctypedef long double complex clongdouble_t + * + * cdef inline object PyArray_MultiIterNew1(a): # <<<<<<<<<<<<<< + * return PyArray_MultiIterNew(1, a) + * +*/ + +static CYTHON_INLINE PyObject *__pyx_f_5numpy_PyArray_MultiIterNew1(PyObject *__pyx_v_a) { + PyObject *__pyx_r = NULL; + __Pyx_RefNannyDeclarations + PyObject *__pyx_t_1 = NULL; + int __pyx_lineno = 0; + const char *__pyx_filename = NULL; + int __pyx_clineno = 0; + __Pyx_RefNannySetupContext("PyArray_MultiIterNew1", 0); + + /* "C:/Users/runneradmin/AppData/Local/Temp/build-env-ej_q3m8u/Lib/site-packages/numpy/__init__.cython-30.pxd":777 + * + * cdef inline object PyArray_MultiIterNew1(a): + * return PyArray_MultiIterNew(1, a) # <<<<<<<<<<<<<< + * + * cdef inline object PyArray_MultiIterNew2(a, b): +*/ + __Pyx_XDECREF(__pyx_r); + __pyx_t_1 = PyArray_MultiIterNew(1, ((void *)__pyx_v_a)); if (unlikely(!__pyx_t_1)) __PYX_ERR(1, 777, __pyx_L1_error) + __Pyx_GOTREF(__pyx_t_1); + __pyx_r = __pyx_t_1; + __pyx_t_1 = 0; + goto __pyx_L0; + + /* "C:/Users/runneradmin/AppData/Local/Temp/build-env-ej_q3m8u/Lib/site-packages/numpy/__init__.cython-30.pxd":776 + * ctypedef long double complex clongdouble_t + * + * cdef inline object PyArray_MultiIterNew1(a): # <<<<<<<<<<<<<< + * return PyArray_MultiIterNew(1, a) + * +*/ + + /* function exit code */ + __pyx_L1_error:; + __Pyx_XDECREF(__pyx_t_1); + __Pyx_AddTraceback("numpy.PyArray_MultiIterNew1", __pyx_clineno, __pyx_lineno, __pyx_filename); + __pyx_r = 0; + __pyx_L0:; + __Pyx_XGIVEREF(__pyx_r); + __Pyx_RefNannyFinishContext(); + return __pyx_r; +} + +/* "C:/Users/runneradmin/AppData/Local/Temp/build-env-ej_q3m8u/Lib/site-packages/numpy/__init__.cython-30.pxd":779 + * return PyArray_MultiIterNew(1, a) + * + * cdef inline object PyArray_MultiIterNew2(a, b): # <<<<<<<<<<<<<< + * return PyArray_MultiIterNew(2, a, b) + * +*/ + +static CYTHON_INLINE PyObject *__pyx_f_5numpy_PyArray_MultiIterNew2(PyObject *__pyx_v_a, PyObject *__pyx_v_b) { + PyObject *__pyx_r = NULL; + __Pyx_RefNannyDeclarations + PyObject *__pyx_t_1 = NULL; + int __pyx_lineno = 0; + const char *__pyx_filename = NULL; + int __pyx_clineno = 0; + __Pyx_RefNannySetupContext("PyArray_MultiIterNew2", 0); + + /* "C:/Users/runneradmin/AppData/Local/Temp/build-env-ej_q3m8u/Lib/site-packages/numpy/__init__.cython-30.pxd":780 + * + * cdef inline object PyArray_MultiIterNew2(a, b): + * return PyArray_MultiIterNew(2, a, b) # <<<<<<<<<<<<<< + * + * cdef inline object PyArray_MultiIterNew3(a, b, c): +*/ + __Pyx_XDECREF(__pyx_r); + __pyx_t_1 = PyArray_MultiIterNew(2, ((void *)__pyx_v_a), ((void *)__pyx_v_b)); if (unlikely(!__pyx_t_1)) __PYX_ERR(1, 780, __pyx_L1_error) + __Pyx_GOTREF(__pyx_t_1); + __pyx_r = __pyx_t_1; + __pyx_t_1 = 0; + goto __pyx_L0; + + /* "C:/Users/runneradmin/AppData/Local/Temp/build-env-ej_q3m8u/Lib/site-packages/numpy/__init__.cython-30.pxd":779 + * return PyArray_MultiIterNew(1, a) + * + * cdef inline object PyArray_MultiIterNew2(a, b): # <<<<<<<<<<<<<< + * return PyArray_MultiIterNew(2, a, b) + * +*/ + + /* function exit code */ + __pyx_L1_error:; + __Pyx_XDECREF(__pyx_t_1); + __Pyx_AddTraceback("numpy.PyArray_MultiIterNew2", __pyx_clineno, __pyx_lineno, __pyx_filename); + __pyx_r = 0; + __pyx_L0:; + __Pyx_XGIVEREF(__pyx_r); + __Pyx_RefNannyFinishContext(); + return __pyx_r; +} + +/* "C:/Users/runneradmin/AppData/Local/Temp/build-env-ej_q3m8u/Lib/site-packages/numpy/__init__.cython-30.pxd":782 + * return PyArray_MultiIterNew(2, a, b) + * + * cdef inline object PyArray_MultiIterNew3(a, b, c): # <<<<<<<<<<<<<< + * return PyArray_MultiIterNew(3, a, b, c) + * +*/ + +static CYTHON_INLINE PyObject *__pyx_f_5numpy_PyArray_MultiIterNew3(PyObject *__pyx_v_a, PyObject *__pyx_v_b, PyObject *__pyx_v_c) { + PyObject *__pyx_r = NULL; + __Pyx_RefNannyDeclarations + PyObject *__pyx_t_1 = NULL; + int __pyx_lineno = 0; + const char *__pyx_filename = NULL; + int __pyx_clineno = 0; + __Pyx_RefNannySetupContext("PyArray_MultiIterNew3", 0); + + /* "C:/Users/runneradmin/AppData/Local/Temp/build-env-ej_q3m8u/Lib/site-packages/numpy/__init__.cython-30.pxd":783 + * + * cdef inline object PyArray_MultiIterNew3(a, b, c): + * return PyArray_MultiIterNew(3, a, b, c) # <<<<<<<<<<<<<< + * + * cdef inline object PyArray_MultiIterNew4(a, b, c, d): +*/ + __Pyx_XDECREF(__pyx_r); + __pyx_t_1 = PyArray_MultiIterNew(3, ((void *)__pyx_v_a), ((void *)__pyx_v_b), ((void *)__pyx_v_c)); if (unlikely(!__pyx_t_1)) __PYX_ERR(1, 783, __pyx_L1_error) + __Pyx_GOTREF(__pyx_t_1); + __pyx_r = __pyx_t_1; + __pyx_t_1 = 0; + goto __pyx_L0; + + /* "C:/Users/runneradmin/AppData/Local/Temp/build-env-ej_q3m8u/Lib/site-packages/numpy/__init__.cython-30.pxd":782 + * return PyArray_MultiIterNew(2, a, b) + * + * cdef inline object PyArray_MultiIterNew3(a, b, c): # <<<<<<<<<<<<<< + * return PyArray_MultiIterNew(3, a, b, c) + * +*/ + + /* function exit code */ + __pyx_L1_error:; + __Pyx_XDECREF(__pyx_t_1); + __Pyx_AddTraceback("numpy.PyArray_MultiIterNew3", __pyx_clineno, __pyx_lineno, __pyx_filename); + __pyx_r = 0; + __pyx_L0:; + __Pyx_XGIVEREF(__pyx_r); + __Pyx_RefNannyFinishContext(); + return __pyx_r; +} + +/* "C:/Users/runneradmin/AppData/Local/Temp/build-env-ej_q3m8u/Lib/site-packages/numpy/__init__.cython-30.pxd":785 + * return PyArray_MultiIterNew(3, a, b, c) + * + * cdef inline object PyArray_MultiIterNew4(a, b, c, d): # <<<<<<<<<<<<<< + * return PyArray_MultiIterNew(4, a, b, c, d) + * +*/ + +static CYTHON_INLINE PyObject *__pyx_f_5numpy_PyArray_MultiIterNew4(PyObject *__pyx_v_a, PyObject *__pyx_v_b, PyObject *__pyx_v_c, PyObject *__pyx_v_d) { + PyObject *__pyx_r = NULL; + __Pyx_RefNannyDeclarations + PyObject *__pyx_t_1 = NULL; + int __pyx_lineno = 0; + const char *__pyx_filename = NULL; + int __pyx_clineno = 0; + __Pyx_RefNannySetupContext("PyArray_MultiIterNew4", 0); + + /* "C:/Users/runneradmin/AppData/Local/Temp/build-env-ej_q3m8u/Lib/site-packages/numpy/__init__.cython-30.pxd":786 + * + * cdef inline object PyArray_MultiIterNew4(a, b, c, d): + * return PyArray_MultiIterNew(4, a, b, c, d) # <<<<<<<<<<<<<< + * + * cdef inline object PyArray_MultiIterNew5(a, b, c, d, e): +*/ + __Pyx_XDECREF(__pyx_r); + __pyx_t_1 = PyArray_MultiIterNew(4, ((void *)__pyx_v_a), ((void *)__pyx_v_b), ((void *)__pyx_v_c), ((void *)__pyx_v_d)); if (unlikely(!__pyx_t_1)) __PYX_ERR(1, 786, __pyx_L1_error) + __Pyx_GOTREF(__pyx_t_1); + __pyx_r = __pyx_t_1; + __pyx_t_1 = 0; + goto __pyx_L0; + + /* "C:/Users/runneradmin/AppData/Local/Temp/build-env-ej_q3m8u/Lib/site-packages/numpy/__init__.cython-30.pxd":785 + * return PyArray_MultiIterNew(3, a, b, c) + * + * cdef inline object PyArray_MultiIterNew4(a, b, c, d): # <<<<<<<<<<<<<< + * return PyArray_MultiIterNew(4, a, b, c, d) + * +*/ + + /* function exit code */ + __pyx_L1_error:; + __Pyx_XDECREF(__pyx_t_1); + __Pyx_AddTraceback("numpy.PyArray_MultiIterNew4", __pyx_clineno, __pyx_lineno, __pyx_filename); + __pyx_r = 0; + __pyx_L0:; + __Pyx_XGIVEREF(__pyx_r); + __Pyx_RefNannyFinishContext(); + return __pyx_r; +} + +/* "C:/Users/runneradmin/AppData/Local/Temp/build-env-ej_q3m8u/Lib/site-packages/numpy/__init__.cython-30.pxd":788 + * return PyArray_MultiIterNew(4, a, b, c, d) + * + * cdef inline object PyArray_MultiIterNew5(a, b, c, d, e): # <<<<<<<<<<<<<< + * return PyArray_MultiIterNew(5, a, b, c, d, e) + * +*/ + +static CYTHON_INLINE PyObject *__pyx_f_5numpy_PyArray_MultiIterNew5(PyObject *__pyx_v_a, PyObject *__pyx_v_b, PyObject *__pyx_v_c, PyObject *__pyx_v_d, PyObject *__pyx_v_e) { + PyObject *__pyx_r = NULL; + __Pyx_RefNannyDeclarations + PyObject *__pyx_t_1 = NULL; + int __pyx_lineno = 0; + const char *__pyx_filename = NULL; + int __pyx_clineno = 0; + __Pyx_RefNannySetupContext("PyArray_MultiIterNew5", 0); + + /* "C:/Users/runneradmin/AppData/Local/Temp/build-env-ej_q3m8u/Lib/site-packages/numpy/__init__.cython-30.pxd":789 + * + * cdef inline object PyArray_MultiIterNew5(a, b, c, d, e): + * return PyArray_MultiIterNew(5, a, b, c, d, e) # <<<<<<<<<<<<<< + * + * cdef inline tuple PyDataType_SHAPE(dtype d): +*/ + __Pyx_XDECREF(__pyx_r); + __pyx_t_1 = PyArray_MultiIterNew(5, ((void *)__pyx_v_a), ((void *)__pyx_v_b), ((void *)__pyx_v_c), ((void *)__pyx_v_d), ((void *)__pyx_v_e)); if (unlikely(!__pyx_t_1)) __PYX_ERR(1, 789, __pyx_L1_error) + __Pyx_GOTREF(__pyx_t_1); + __pyx_r = __pyx_t_1; + __pyx_t_1 = 0; + goto __pyx_L0; + + /* "C:/Users/runneradmin/AppData/Local/Temp/build-env-ej_q3m8u/Lib/site-packages/numpy/__init__.cython-30.pxd":788 + * return PyArray_MultiIterNew(4, a, b, c, d) + * + * cdef inline object PyArray_MultiIterNew5(a, b, c, d, e): # <<<<<<<<<<<<<< + * return PyArray_MultiIterNew(5, a, b, c, d, e) + * +*/ + + /* function exit code */ + __pyx_L1_error:; + __Pyx_XDECREF(__pyx_t_1); + __Pyx_AddTraceback("numpy.PyArray_MultiIterNew5", __pyx_clineno, __pyx_lineno, __pyx_filename); + __pyx_r = 0; + __pyx_L0:; + __Pyx_XGIVEREF(__pyx_r); + __Pyx_RefNannyFinishContext(); + return __pyx_r; +} + +/* "C:/Users/runneradmin/AppData/Local/Temp/build-env-ej_q3m8u/Lib/site-packages/numpy/__init__.cython-30.pxd":791 + * return PyArray_MultiIterNew(5, a, b, c, d, e) + * + * cdef inline tuple PyDataType_SHAPE(dtype d): # <<<<<<<<<<<<<< + * if PyDataType_HASSUBARRAY(d): + * return d.subarray.shape +*/ + +static CYTHON_INLINE PyObject *__pyx_f_5numpy_PyDataType_SHAPE(PyArray_Descr *__pyx_v_d) { + PyObject *__pyx_r = NULL; + __Pyx_RefNannyDeclarations + int __pyx_t_1; + PyObject *__pyx_t_2; + __Pyx_RefNannySetupContext("PyDataType_SHAPE", 0); + + /* "C:/Users/runneradmin/AppData/Local/Temp/build-env-ej_q3m8u/Lib/site-packages/numpy/__init__.cython-30.pxd":792 + * + * cdef inline tuple PyDataType_SHAPE(dtype d): + * if PyDataType_HASSUBARRAY(d): # <<<<<<<<<<<<<< + * return d.subarray.shape + * else: +*/ + __pyx_t_1 = PyDataType_HASSUBARRAY(__pyx_v_d); + if (__pyx_t_1) { + + /* "C:/Users/runneradmin/AppData/Local/Temp/build-env-ej_q3m8u/Lib/site-packages/numpy/__init__.cython-30.pxd":793 + * cdef inline tuple PyDataType_SHAPE(dtype d): + * if PyDataType_HASSUBARRAY(d): + * return d.subarray.shape # <<<<<<<<<<<<<< + * else: + * return () +*/ + __Pyx_XDECREF(__pyx_r); + __pyx_t_2 = __pyx_f_5numpy_5dtype_8subarray_subarray(__pyx_v_d)->shape; + __Pyx_INCREF(((PyObject*)__pyx_t_2)); + __pyx_r = ((PyObject*)__pyx_t_2); + goto __pyx_L0; + + /* "C:/Users/runneradmin/AppData/Local/Temp/build-env-ej_q3m8u/Lib/site-packages/numpy/__init__.cython-30.pxd":792 + * + * cdef inline tuple PyDataType_SHAPE(dtype d): + * if PyDataType_HASSUBARRAY(d): # <<<<<<<<<<<<<< + * return d.subarray.shape + * else: +*/ + } + + /* "C:/Users/runneradmin/AppData/Local/Temp/build-env-ej_q3m8u/Lib/site-packages/numpy/__init__.cython-30.pxd":795 + * return d.subarray.shape + * else: + * return () # <<<<<<<<<<<<<< + * + * +*/ + /*else*/ { + __Pyx_XDECREF(__pyx_r); + __Pyx_INCREF(__pyx_mstate_global->__pyx_empty_tuple); + __pyx_r = __pyx_mstate_global->__pyx_empty_tuple; + goto __pyx_L0; + } + + /* "C:/Users/runneradmin/AppData/Local/Temp/build-env-ej_q3m8u/Lib/site-packages/numpy/__init__.cython-30.pxd":791 + * return PyArray_MultiIterNew(5, a, b, c, d, e) + * + * cdef inline tuple PyDataType_SHAPE(dtype d): # <<<<<<<<<<<<<< + * if PyDataType_HASSUBARRAY(d): + * return d.subarray.shape +*/ + + /* function exit code */ + __pyx_L0:; + __Pyx_XGIVEREF(__pyx_r); + __Pyx_RefNannyFinishContext(); + return __pyx_r; +} + +/* "C:/Users/runneradmin/AppData/Local/Temp/build-env-ej_q3m8u/Lib/site-packages/numpy/__init__.cython-30.pxd":994 + * int _import_umath() except -1 + * + * cdef inline void set_array_base(ndarray arr, object base) except *: # <<<<<<<<<<<<<< + * Py_INCREF(base) # important to do this before stealing the reference below! + * PyArray_SetBaseObject(arr, base) +*/ + +static CYTHON_INLINE void __pyx_f_5numpy_set_array_base(PyArrayObject *__pyx_v_arr, PyObject *__pyx_v_base) { + int __pyx_t_1; + int __pyx_lineno = 0; + const char *__pyx_filename = NULL; + int __pyx_clineno = 0; + + /* "C:/Users/runneradmin/AppData/Local/Temp/build-env-ej_q3m8u/Lib/site-packages/numpy/__init__.cython-30.pxd":995 + * + * cdef inline void set_array_base(ndarray arr, object base) except *: + * Py_INCREF(base) # important to do this before stealing the reference below! # <<<<<<<<<<<<<< + * PyArray_SetBaseObject(arr, base) + * +*/ + Py_INCREF(__pyx_v_base); + + /* "C:/Users/runneradmin/AppData/Local/Temp/build-env-ej_q3m8u/Lib/site-packages/numpy/__init__.cython-30.pxd":996 + * cdef inline void set_array_base(ndarray arr, object base) except *: + * Py_INCREF(base) # important to do this before stealing the reference below! + * PyArray_SetBaseObject(arr, base) # <<<<<<<<<<<<<< + * + * cdef inline object get_array_base(ndarray arr): +*/ + __pyx_t_1 = PyArray_SetBaseObject(__pyx_v_arr, __pyx_v_base); if (unlikely(__pyx_t_1 == ((int)-1))) __PYX_ERR(1, 996, __pyx_L1_error) + + /* "C:/Users/runneradmin/AppData/Local/Temp/build-env-ej_q3m8u/Lib/site-packages/numpy/__init__.cython-30.pxd":994 + * int _import_umath() except -1 + * + * cdef inline void set_array_base(ndarray arr, object base) except *: # <<<<<<<<<<<<<< + * Py_INCREF(base) # important to do this before stealing the reference below! + * PyArray_SetBaseObject(arr, base) +*/ + + /* function exit code */ + goto __pyx_L0; + __pyx_L1_error:; + __Pyx_AddTraceback("numpy.set_array_base", __pyx_clineno, __pyx_lineno, __pyx_filename); + __pyx_L0:; +} + +/* "C:/Users/runneradmin/AppData/Local/Temp/build-env-ej_q3m8u/Lib/site-packages/numpy/__init__.cython-30.pxd":998 + * PyArray_SetBaseObject(arr, base) + * + * cdef inline object get_array_base(ndarray arr): # <<<<<<<<<<<<<< + * base = PyArray_BASE(arr) + * if base is NULL: +*/ + +static CYTHON_INLINE PyObject *__pyx_f_5numpy_get_array_base(PyArrayObject *__pyx_v_arr) { + PyObject *__pyx_v_base; + PyObject *__pyx_r = NULL; + __Pyx_RefNannyDeclarations + int __pyx_t_1; + __Pyx_RefNannySetupContext("get_array_base", 0); + + /* "C:/Users/runneradmin/AppData/Local/Temp/build-env-ej_q3m8u/Lib/site-packages/numpy/__init__.cython-30.pxd":999 + * + * cdef inline object get_array_base(ndarray arr): + * base = PyArray_BASE(arr) # <<<<<<<<<<<<<< + * if base is NULL: + * return None +*/ + __pyx_v_base = PyArray_BASE(__pyx_v_arr); + + /* "C:/Users/runneradmin/AppData/Local/Temp/build-env-ej_q3m8u/Lib/site-packages/numpy/__init__.cython-30.pxd":1000 + * cdef inline object get_array_base(ndarray arr): + * base = PyArray_BASE(arr) + * if base is NULL: # <<<<<<<<<<<<<< + * return None + * return base +*/ + __pyx_t_1 = (__pyx_v_base == NULL); + if (__pyx_t_1) { + + /* "C:/Users/runneradmin/AppData/Local/Temp/build-env-ej_q3m8u/Lib/site-packages/numpy/__init__.cython-30.pxd":1001 + * base = PyArray_BASE(arr) + * if base is NULL: + * return None # <<<<<<<<<<<<<< + * return base + * +*/ + __Pyx_XDECREF(__pyx_r); + __pyx_r = Py_None; __Pyx_INCREF(Py_None); + goto __pyx_L0; + + /* "C:/Users/runneradmin/AppData/Local/Temp/build-env-ej_q3m8u/Lib/site-packages/numpy/__init__.cython-30.pxd":1000 + * cdef inline object get_array_base(ndarray arr): + * base = PyArray_BASE(arr) + * if base is NULL: # <<<<<<<<<<<<<< + * return None + * return base +*/ + } + + /* "C:/Users/runneradmin/AppData/Local/Temp/build-env-ej_q3m8u/Lib/site-packages/numpy/__init__.cython-30.pxd":1002 + * if base is NULL: + * return None + * return base # <<<<<<<<<<<<<< + * + * # Versions of the import_* functions which are more suitable for +*/ + __Pyx_XDECREF(__pyx_r); + __Pyx_INCREF(((PyObject *)__pyx_v_base)); + __pyx_r = ((PyObject *)__pyx_v_base); + goto __pyx_L0; + + /* "C:/Users/runneradmin/AppData/Local/Temp/build-env-ej_q3m8u/Lib/site-packages/numpy/__init__.cython-30.pxd":998 + * PyArray_SetBaseObject(arr, base) + * + * cdef inline object get_array_base(ndarray arr): # <<<<<<<<<<<<<< + * base = PyArray_BASE(arr) + * if base is NULL: +*/ + + /* function exit code */ + __pyx_L0:; + __Pyx_XGIVEREF(__pyx_r); + __Pyx_RefNannyFinishContext(); + return __pyx_r; +} + +/* "C:/Users/runneradmin/AppData/Local/Temp/build-env-ej_q3m8u/Lib/site-packages/numpy/__init__.cython-30.pxd":1006 + * # Versions of the import_* functions which are more suitable for + * # Cython code. + * cdef inline int import_array() except -1: # <<<<<<<<<<<<<< + * try: + * __pyx_import_array() +*/ + +static CYTHON_INLINE int __pyx_f_5numpy_import_array(void) { + int __pyx_r; + __Pyx_RefNannyDeclarations + PyObject *__pyx_t_1 = NULL; + PyObject *__pyx_t_2 = NULL; + PyObject *__pyx_t_3 = NULL; + int __pyx_t_4; + PyObject *__pyx_t_5 = NULL; + PyObject *__pyx_t_6 = NULL; + PyObject *__pyx_t_7 = NULL; + PyObject *__pyx_t_8 = NULL; + PyObject *__pyx_t_9 = NULL; + size_t __pyx_t_10; + int __pyx_lineno = 0; + const char *__pyx_filename = NULL; + int __pyx_clineno = 0; + __Pyx_RefNannySetupContext("import_array", 0); + + /* "C:/Users/runneradmin/AppData/Local/Temp/build-env-ej_q3m8u/Lib/site-packages/numpy/__init__.cython-30.pxd":1007 + * # Cython code. + * cdef inline int import_array() except -1: + * try: # <<<<<<<<<<<<<< + * __pyx_import_array() + * except Exception: +*/ + { + __Pyx_PyThreadState_declare + __Pyx_PyThreadState_assign + __Pyx_ExceptionSave(&__pyx_t_1, &__pyx_t_2, &__pyx_t_3); + __Pyx_XGOTREF(__pyx_t_1); + __Pyx_XGOTREF(__pyx_t_2); + __Pyx_XGOTREF(__pyx_t_3); + /*try:*/ { + + /* "C:/Users/runneradmin/AppData/Local/Temp/build-env-ej_q3m8u/Lib/site-packages/numpy/__init__.cython-30.pxd":1008 + * cdef inline int import_array() except -1: + * try: + * __pyx_import_array() # <<<<<<<<<<<<<< + * except Exception: + * raise ImportError("numpy._core.multiarray failed to import") +*/ + __pyx_t_4 = _import_array(); if (unlikely(__pyx_t_4 == ((int)-1))) __PYX_ERR(1, 1008, __pyx_L3_error) + + /* "C:/Users/runneradmin/AppData/Local/Temp/build-env-ej_q3m8u/Lib/site-packages/numpy/__init__.cython-30.pxd":1007 + * # Cython code. + * cdef inline int import_array() except -1: + * try: # <<<<<<<<<<<<<< + * __pyx_import_array() + * except Exception: +*/ + } + __Pyx_XDECREF(__pyx_t_1); __pyx_t_1 = 0; + __Pyx_XDECREF(__pyx_t_2); __pyx_t_2 = 0; + __Pyx_XDECREF(__pyx_t_3); __pyx_t_3 = 0; + goto __pyx_L8_try_end; + __pyx_L3_error:; + + /* "C:/Users/runneradmin/AppData/Local/Temp/build-env-ej_q3m8u/Lib/site-packages/numpy/__init__.cython-30.pxd":1009 + * try: + * __pyx_import_array() + * except Exception: # <<<<<<<<<<<<<< + * raise ImportError("numpy._core.multiarray failed to import") + * +*/ + __pyx_t_4 = __Pyx_PyErr_ExceptionMatches(((PyObject *)(((PyTypeObject*)PyExc_Exception)))); + if (__pyx_t_4) { + __Pyx_AddTraceback("numpy.import_array", __pyx_clineno, __pyx_lineno, __pyx_filename); + if (__Pyx_GetException(&__pyx_t_5, &__pyx_t_6, &__pyx_t_7) < 0) __PYX_ERR(1, 1009, __pyx_L5_except_error) + __Pyx_XGOTREF(__pyx_t_5); + __Pyx_XGOTREF(__pyx_t_6); + __Pyx_XGOTREF(__pyx_t_7); + + /* "C:/Users/runneradmin/AppData/Local/Temp/build-env-ej_q3m8u/Lib/site-packages/numpy/__init__.cython-30.pxd":1010 + * __pyx_import_array() + * except Exception: + * raise ImportError("numpy._core.multiarray failed to import") # <<<<<<<<<<<<<< + * + * cdef inline int import_umath() except -1: +*/ + __pyx_t_9 = NULL; + __pyx_t_10 = 1; + { + PyObject *__pyx_callargs[2] = {__pyx_t_9, __pyx_mstate_global->__pyx_kp_u_numpy__core_multiarray_failed_to}; + __pyx_t_8 = __Pyx_PyObject_FastCall((PyObject*)(((PyTypeObject*)PyExc_ImportError)), __pyx_callargs+__pyx_t_10, (2-__pyx_t_10) | (__pyx_t_10*__Pyx_PY_VECTORCALL_ARGUMENTS_OFFSET)); + __Pyx_XDECREF(__pyx_t_9); __pyx_t_9 = 0; + if (unlikely(!__pyx_t_8)) __PYX_ERR(1, 1010, __pyx_L5_except_error) + __Pyx_GOTREF(__pyx_t_8); + } + __Pyx_Raise(__pyx_t_8, 0, 0, 0); + __Pyx_DECREF(__pyx_t_8); __pyx_t_8 = 0; + __PYX_ERR(1, 1010, __pyx_L5_except_error) + } + goto __pyx_L5_except_error; + + /* "C:/Users/runneradmin/AppData/Local/Temp/build-env-ej_q3m8u/Lib/site-packages/numpy/__init__.cython-30.pxd":1007 + * # Cython code. + * cdef inline int import_array() except -1: + * try: # <<<<<<<<<<<<<< + * __pyx_import_array() + * except Exception: +*/ + __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:; + } + + /* "C:/Users/runneradmin/AppData/Local/Temp/build-env-ej_q3m8u/Lib/site-packages/numpy/__init__.cython-30.pxd":1006 + * # Versions of the import_* functions which are more suitable for + * # Cython code. + * cdef inline int import_array() except -1: # <<<<<<<<<<<<<< + * try: + * __pyx_import_array() +*/ + + /* function exit code */ + __pyx_r = 0; + goto __pyx_L0; + __pyx_L1_error:; + __Pyx_XDECREF(__pyx_t_5); + __Pyx_XDECREF(__pyx_t_6); + __Pyx_XDECREF(__pyx_t_7); + __Pyx_XDECREF(__pyx_t_8); + __Pyx_XDECREF(__pyx_t_9); + __Pyx_AddTraceback("numpy.import_array", __pyx_clineno, __pyx_lineno, __pyx_filename); + __pyx_r = -1; + __pyx_L0:; + __Pyx_RefNannyFinishContext(); + return __pyx_r; +} + +/* "C:/Users/runneradmin/AppData/Local/Temp/build-env-ej_q3m8u/Lib/site-packages/numpy/__init__.cython-30.pxd":1012 + * raise ImportError("numpy._core.multiarray failed to import") + * + * cdef inline int import_umath() except -1: # <<<<<<<<<<<<<< + * try: + * _import_umath() +*/ + +static CYTHON_INLINE int __pyx_f_5numpy_import_umath(void) { + int __pyx_r; + __Pyx_RefNannyDeclarations + PyObject *__pyx_t_1 = NULL; + PyObject *__pyx_t_2 = NULL; + PyObject *__pyx_t_3 = NULL; + int __pyx_t_4; + PyObject *__pyx_t_5 = NULL; + PyObject *__pyx_t_6 = NULL; + PyObject *__pyx_t_7 = NULL; + PyObject *__pyx_t_8 = NULL; + PyObject *__pyx_t_9 = NULL; + size_t __pyx_t_10; + int __pyx_lineno = 0; + const char *__pyx_filename = NULL; + int __pyx_clineno = 0; + __Pyx_RefNannySetupContext("import_umath", 0); + + /* "C:/Users/runneradmin/AppData/Local/Temp/build-env-ej_q3m8u/Lib/site-packages/numpy/__init__.cython-30.pxd":1013 + * + * cdef inline int import_umath() except -1: + * try: # <<<<<<<<<<<<<< + * _import_umath() + * except Exception: +*/ + { + __Pyx_PyThreadState_declare + __Pyx_PyThreadState_assign + __Pyx_ExceptionSave(&__pyx_t_1, &__pyx_t_2, &__pyx_t_3); + __Pyx_XGOTREF(__pyx_t_1); + __Pyx_XGOTREF(__pyx_t_2); + __Pyx_XGOTREF(__pyx_t_3); + /*try:*/ { + + /* "C:/Users/runneradmin/AppData/Local/Temp/build-env-ej_q3m8u/Lib/site-packages/numpy/__init__.cython-30.pxd":1014 + * cdef inline int import_umath() except -1: + * try: + * _import_umath() # <<<<<<<<<<<<<< + * except Exception: + * raise ImportError("numpy._core.umath failed to import") +*/ + __pyx_t_4 = _import_umath(); if (unlikely(__pyx_t_4 == ((int)-1))) __PYX_ERR(1, 1014, __pyx_L3_error) + + /* "C:/Users/runneradmin/AppData/Local/Temp/build-env-ej_q3m8u/Lib/site-packages/numpy/__init__.cython-30.pxd":1013 + * + * cdef inline int import_umath() except -1: + * try: # <<<<<<<<<<<<<< + * _import_umath() + * except Exception: +*/ + } + __Pyx_XDECREF(__pyx_t_1); __pyx_t_1 = 0; + __Pyx_XDECREF(__pyx_t_2); __pyx_t_2 = 0; + __Pyx_XDECREF(__pyx_t_3); __pyx_t_3 = 0; + goto __pyx_L8_try_end; + __pyx_L3_error:; + + /* "C:/Users/runneradmin/AppData/Local/Temp/build-env-ej_q3m8u/Lib/site-packages/numpy/__init__.cython-30.pxd":1015 + * try: + * _import_umath() + * except Exception: # <<<<<<<<<<<<<< + * raise ImportError("numpy._core.umath failed to import") + * +*/ + __pyx_t_4 = __Pyx_PyErr_ExceptionMatches(((PyObject *)(((PyTypeObject*)PyExc_Exception)))); + if (__pyx_t_4) { + __Pyx_AddTraceback("numpy.import_umath", __pyx_clineno, __pyx_lineno, __pyx_filename); + if (__Pyx_GetException(&__pyx_t_5, &__pyx_t_6, &__pyx_t_7) < 0) __PYX_ERR(1, 1015, __pyx_L5_except_error) + __Pyx_XGOTREF(__pyx_t_5); + __Pyx_XGOTREF(__pyx_t_6); + __Pyx_XGOTREF(__pyx_t_7); + + /* "C:/Users/runneradmin/AppData/Local/Temp/build-env-ej_q3m8u/Lib/site-packages/numpy/__init__.cython-30.pxd":1016 + * _import_umath() + * except Exception: + * raise ImportError("numpy._core.umath failed to import") # <<<<<<<<<<<<<< + * + * cdef inline int import_ufunc() except -1: +*/ + __pyx_t_9 = NULL; + __pyx_t_10 = 1; + { + PyObject *__pyx_callargs[2] = {__pyx_t_9, __pyx_mstate_global->__pyx_kp_u_numpy__core_umath_failed_to_impo}; + __pyx_t_8 = __Pyx_PyObject_FastCall((PyObject*)(((PyTypeObject*)PyExc_ImportError)), __pyx_callargs+__pyx_t_10, (2-__pyx_t_10) | (__pyx_t_10*__Pyx_PY_VECTORCALL_ARGUMENTS_OFFSET)); + __Pyx_XDECREF(__pyx_t_9); __pyx_t_9 = 0; + if (unlikely(!__pyx_t_8)) __PYX_ERR(1, 1016, __pyx_L5_except_error) + __Pyx_GOTREF(__pyx_t_8); + } + __Pyx_Raise(__pyx_t_8, 0, 0, 0); + __Pyx_DECREF(__pyx_t_8); __pyx_t_8 = 0; + __PYX_ERR(1, 1016, __pyx_L5_except_error) + } + goto __pyx_L5_except_error; + + /* "C:/Users/runneradmin/AppData/Local/Temp/build-env-ej_q3m8u/Lib/site-packages/numpy/__init__.cython-30.pxd":1013 + * + * cdef inline int import_umath() except -1: + * try: # <<<<<<<<<<<<<< + * _import_umath() + * except Exception: +*/ + __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:; + } + + /* "C:/Users/runneradmin/AppData/Local/Temp/build-env-ej_q3m8u/Lib/site-packages/numpy/__init__.cython-30.pxd":1012 + * raise ImportError("numpy._core.multiarray failed to import") + * + * cdef inline int import_umath() except -1: # <<<<<<<<<<<<<< + * try: + * _import_umath() +*/ + + /* function exit code */ + __pyx_r = 0; + goto __pyx_L0; + __pyx_L1_error:; + __Pyx_XDECREF(__pyx_t_5); + __Pyx_XDECREF(__pyx_t_6); + __Pyx_XDECREF(__pyx_t_7); + __Pyx_XDECREF(__pyx_t_8); + __Pyx_XDECREF(__pyx_t_9); + __Pyx_AddTraceback("numpy.import_umath", __pyx_clineno, __pyx_lineno, __pyx_filename); + __pyx_r = -1; + __pyx_L0:; + __Pyx_RefNannyFinishContext(); + return __pyx_r; +} + +/* "C:/Users/runneradmin/AppData/Local/Temp/build-env-ej_q3m8u/Lib/site-packages/numpy/__init__.cython-30.pxd":1018 + * raise ImportError("numpy._core.umath failed to import") + * + * cdef inline int import_ufunc() except -1: # <<<<<<<<<<<<<< + * try: + * _import_umath() +*/ + +static CYTHON_INLINE int __pyx_f_5numpy_import_ufunc(void) { + int __pyx_r; + __Pyx_RefNannyDeclarations + PyObject *__pyx_t_1 = NULL; + PyObject *__pyx_t_2 = NULL; + PyObject *__pyx_t_3 = NULL; + int __pyx_t_4; + PyObject *__pyx_t_5 = NULL; + PyObject *__pyx_t_6 = NULL; + PyObject *__pyx_t_7 = NULL; + PyObject *__pyx_t_8 = NULL; + PyObject *__pyx_t_9 = NULL; + size_t __pyx_t_10; + int __pyx_lineno = 0; + const char *__pyx_filename = NULL; + int __pyx_clineno = 0; + __Pyx_RefNannySetupContext("import_ufunc", 0); + + /* "C:/Users/runneradmin/AppData/Local/Temp/build-env-ej_q3m8u/Lib/site-packages/numpy/__init__.cython-30.pxd":1019 + * + * cdef inline int import_ufunc() except -1: + * try: # <<<<<<<<<<<<<< + * _import_umath() + * except Exception: +*/ + { + __Pyx_PyThreadState_declare + __Pyx_PyThreadState_assign + __Pyx_ExceptionSave(&__pyx_t_1, &__pyx_t_2, &__pyx_t_3); + __Pyx_XGOTREF(__pyx_t_1); + __Pyx_XGOTREF(__pyx_t_2); + __Pyx_XGOTREF(__pyx_t_3); + /*try:*/ { + + /* "C:/Users/runneradmin/AppData/Local/Temp/build-env-ej_q3m8u/Lib/site-packages/numpy/__init__.cython-30.pxd":1020 + * cdef inline int import_ufunc() except -1: + * try: + * _import_umath() # <<<<<<<<<<<<<< + * except Exception: + * raise ImportError("numpy._core.umath failed to import") +*/ + __pyx_t_4 = _import_umath(); if (unlikely(__pyx_t_4 == ((int)-1))) __PYX_ERR(1, 1020, __pyx_L3_error) + + /* "C:/Users/runneradmin/AppData/Local/Temp/build-env-ej_q3m8u/Lib/site-packages/numpy/__init__.cython-30.pxd":1019 + * + * cdef inline int import_ufunc() except -1: + * try: # <<<<<<<<<<<<<< + * _import_umath() + * except Exception: +*/ + } + __Pyx_XDECREF(__pyx_t_1); __pyx_t_1 = 0; + __Pyx_XDECREF(__pyx_t_2); __pyx_t_2 = 0; + __Pyx_XDECREF(__pyx_t_3); __pyx_t_3 = 0; + goto __pyx_L8_try_end; + __pyx_L3_error:; + + /* "C:/Users/runneradmin/AppData/Local/Temp/build-env-ej_q3m8u/Lib/site-packages/numpy/__init__.cython-30.pxd":1021 + * try: + * _import_umath() + * except Exception: # <<<<<<<<<<<<<< + * raise ImportError("numpy._core.umath failed to import") + * +*/ + __pyx_t_4 = __Pyx_PyErr_ExceptionMatches(((PyObject *)(((PyTypeObject*)PyExc_Exception)))); + if (__pyx_t_4) { + __Pyx_AddTraceback("numpy.import_ufunc", __pyx_clineno, __pyx_lineno, __pyx_filename); + if (__Pyx_GetException(&__pyx_t_5, &__pyx_t_6, &__pyx_t_7) < 0) __PYX_ERR(1, 1021, __pyx_L5_except_error) + __Pyx_XGOTREF(__pyx_t_5); + __Pyx_XGOTREF(__pyx_t_6); + __Pyx_XGOTREF(__pyx_t_7); + + /* "C:/Users/runneradmin/AppData/Local/Temp/build-env-ej_q3m8u/Lib/site-packages/numpy/__init__.cython-30.pxd":1022 + * _import_umath() + * except Exception: + * raise ImportError("numpy._core.umath failed to import") # <<<<<<<<<<<<<< + * + * +*/ + __pyx_t_9 = NULL; + __pyx_t_10 = 1; + { + PyObject *__pyx_callargs[2] = {__pyx_t_9, __pyx_mstate_global->__pyx_kp_u_numpy__core_umath_failed_to_impo}; + __pyx_t_8 = __Pyx_PyObject_FastCall((PyObject*)(((PyTypeObject*)PyExc_ImportError)), __pyx_callargs+__pyx_t_10, (2-__pyx_t_10) | (__pyx_t_10*__Pyx_PY_VECTORCALL_ARGUMENTS_OFFSET)); + __Pyx_XDECREF(__pyx_t_9); __pyx_t_9 = 0; + if (unlikely(!__pyx_t_8)) __PYX_ERR(1, 1022, __pyx_L5_except_error) + __Pyx_GOTREF(__pyx_t_8); + } + __Pyx_Raise(__pyx_t_8, 0, 0, 0); + __Pyx_DECREF(__pyx_t_8); __pyx_t_8 = 0; + __PYX_ERR(1, 1022, __pyx_L5_except_error) + } + goto __pyx_L5_except_error; + + /* "C:/Users/runneradmin/AppData/Local/Temp/build-env-ej_q3m8u/Lib/site-packages/numpy/__init__.cython-30.pxd":1019 + * + * cdef inline int import_ufunc() except -1: + * try: # <<<<<<<<<<<<<< + * _import_umath() + * except Exception: +*/ + __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:; + } + + /* "C:/Users/runneradmin/AppData/Local/Temp/build-env-ej_q3m8u/Lib/site-packages/numpy/__init__.cython-30.pxd":1018 + * raise ImportError("numpy._core.umath failed to import") + * + * cdef inline int import_ufunc() except -1: # <<<<<<<<<<<<<< + * try: + * _import_umath() +*/ + + /* function exit code */ + __pyx_r = 0; + goto __pyx_L0; + __pyx_L1_error:; + __Pyx_XDECREF(__pyx_t_5); + __Pyx_XDECREF(__pyx_t_6); + __Pyx_XDECREF(__pyx_t_7); + __Pyx_XDECREF(__pyx_t_8); + __Pyx_XDECREF(__pyx_t_9); + __Pyx_AddTraceback("numpy.import_ufunc", __pyx_clineno, __pyx_lineno, __pyx_filename); + __pyx_r = -1; + __pyx_L0:; + __Pyx_RefNannyFinishContext(); + return __pyx_r; +} + +/* "C:/Users/runneradmin/AppData/Local/Temp/build-env-ej_q3m8u/Lib/site-packages/numpy/__init__.cython-30.pxd":1025 + * + * + * cdef inline bint is_timedelta64_object(object obj) noexcept: # <<<<<<<<<<<<<< + * """ + * Cython equivalent of `isinstance(obj, np.timedelta64)` +*/ + +static CYTHON_INLINE int __pyx_f_5numpy_is_timedelta64_object(PyObject *__pyx_v_obj) { + int __pyx_r; + + /* "C:/Users/runneradmin/AppData/Local/Temp/build-env-ej_q3m8u/Lib/site-packages/numpy/__init__.cython-30.pxd":1037 + * bool + * """ + * return PyObject_TypeCheck(obj, &PyTimedeltaArrType_Type) # <<<<<<<<<<<<<< + * + * +*/ + __pyx_r = PyObject_TypeCheck(__pyx_v_obj, (&PyTimedeltaArrType_Type)); + goto __pyx_L0; + + /* "C:/Users/runneradmin/AppData/Local/Temp/build-env-ej_q3m8u/Lib/site-packages/numpy/__init__.cython-30.pxd":1025 + * + * + * cdef inline bint is_timedelta64_object(object obj) noexcept: # <<<<<<<<<<<<<< + * """ + * Cython equivalent of `isinstance(obj, np.timedelta64)` +*/ + + /* function exit code */ + __pyx_L0:; + return __pyx_r; +} + +/* "C:/Users/runneradmin/AppData/Local/Temp/build-env-ej_q3m8u/Lib/site-packages/numpy/__init__.cython-30.pxd":1040 + * + * + * cdef inline bint is_datetime64_object(object obj) noexcept: # <<<<<<<<<<<<<< + * """ + * Cython equivalent of `isinstance(obj, np.datetime64)` +*/ + +static CYTHON_INLINE int __pyx_f_5numpy_is_datetime64_object(PyObject *__pyx_v_obj) { + int __pyx_r; + + /* "C:/Users/runneradmin/AppData/Local/Temp/build-env-ej_q3m8u/Lib/site-packages/numpy/__init__.cython-30.pxd":1052 + * bool + * """ + * return PyObject_TypeCheck(obj, &PyDatetimeArrType_Type) # <<<<<<<<<<<<<< + * + * +*/ + __pyx_r = PyObject_TypeCheck(__pyx_v_obj, (&PyDatetimeArrType_Type)); + goto __pyx_L0; + + /* "C:/Users/runneradmin/AppData/Local/Temp/build-env-ej_q3m8u/Lib/site-packages/numpy/__init__.cython-30.pxd":1040 + * + * + * cdef inline bint is_datetime64_object(object obj) noexcept: # <<<<<<<<<<<<<< + * """ + * Cython equivalent of `isinstance(obj, np.datetime64)` +*/ + + /* function exit code */ + __pyx_L0:; + return __pyx_r; +} + +/* "C:/Users/runneradmin/AppData/Local/Temp/build-env-ej_q3m8u/Lib/site-packages/numpy/__init__.cython-30.pxd":1055 + * + * + * cdef inline npy_datetime get_datetime64_value(object obj) noexcept nogil: # <<<<<<<<<<<<<< + * """ + * returns the int64 value underlying scalar numpy datetime64 object +*/ + +static CYTHON_INLINE npy_datetime __pyx_f_5numpy_get_datetime64_value(PyObject *__pyx_v_obj) { + npy_datetime __pyx_r; + + /* "C:/Users/runneradmin/AppData/Local/Temp/build-env-ej_q3m8u/Lib/site-packages/numpy/__init__.cython-30.pxd":1062 + * also needed. That can be found using `get_datetime64_unit`. + * """ + * return (obj).obval # <<<<<<<<<<<<<< + * + * +*/ + __pyx_r = ((PyDatetimeScalarObject *)__pyx_v_obj)->obval; + goto __pyx_L0; + + /* "C:/Users/runneradmin/AppData/Local/Temp/build-env-ej_q3m8u/Lib/site-packages/numpy/__init__.cython-30.pxd":1055 + * + * + * cdef inline npy_datetime get_datetime64_value(object obj) noexcept nogil: # <<<<<<<<<<<<<< + * """ + * returns the int64 value underlying scalar numpy datetime64 object +*/ + + /* function exit code */ + __pyx_L0:; + return __pyx_r; +} + +/* "C:/Users/runneradmin/AppData/Local/Temp/build-env-ej_q3m8u/Lib/site-packages/numpy/__init__.cython-30.pxd":1065 + * + * + * cdef inline npy_timedelta get_timedelta64_value(object obj) noexcept nogil: # <<<<<<<<<<<<<< + * """ + * returns the int64 value underlying scalar numpy timedelta64 object +*/ + +static CYTHON_INLINE npy_timedelta __pyx_f_5numpy_get_timedelta64_value(PyObject *__pyx_v_obj) { + npy_timedelta __pyx_r; + + /* "C:/Users/runneradmin/AppData/Local/Temp/build-env-ej_q3m8u/Lib/site-packages/numpy/__init__.cython-30.pxd":1069 + * returns the int64 value underlying scalar numpy timedelta64 object + * """ + * return (obj).obval # <<<<<<<<<<<<<< + * + * +*/ + __pyx_r = ((PyTimedeltaScalarObject *)__pyx_v_obj)->obval; + goto __pyx_L0; + + /* "C:/Users/runneradmin/AppData/Local/Temp/build-env-ej_q3m8u/Lib/site-packages/numpy/__init__.cython-30.pxd":1065 + * + * + * cdef inline npy_timedelta get_timedelta64_value(object obj) noexcept nogil: # <<<<<<<<<<<<<< + * """ + * returns the int64 value underlying scalar numpy timedelta64 object +*/ + + /* function exit code */ + __pyx_L0:; + return __pyx_r; +} + +/* "C:/Users/runneradmin/AppData/Local/Temp/build-env-ej_q3m8u/Lib/site-packages/numpy/__init__.cython-30.pxd":1072 + * + * + * cdef inline NPY_DATETIMEUNIT get_datetime64_unit(object obj) noexcept nogil: # <<<<<<<<<<<<<< + * """ + * returns the unit part of the dtype for a numpy datetime64 object. +*/ + +static CYTHON_INLINE NPY_DATETIMEUNIT __pyx_f_5numpy_get_datetime64_unit(PyObject *__pyx_v_obj) { + NPY_DATETIMEUNIT __pyx_r; + + /* "C:/Users/runneradmin/AppData/Local/Temp/build-env-ej_q3m8u/Lib/site-packages/numpy/__init__.cython-30.pxd":1076 + * returns the unit part of the dtype for a numpy datetime64 object. + * """ + * return (obj).obmeta.base # <<<<<<<<<<<<<< + * + * +*/ + __pyx_r = ((NPY_DATETIMEUNIT)((PyDatetimeScalarObject *)__pyx_v_obj)->obmeta.base); + goto __pyx_L0; + + /* "C:/Users/runneradmin/AppData/Local/Temp/build-env-ej_q3m8u/Lib/site-packages/numpy/__init__.cython-30.pxd":1072 + * + * + * cdef inline NPY_DATETIMEUNIT get_datetime64_unit(object obj) noexcept nogil: # <<<<<<<<<<<<<< + * """ + * returns the unit part of the dtype for a numpy datetime64 object. +*/ + + /* function exit code */ + __pyx_L0:; + return __pyx_r; +} + +/* "lexeme.pxd":29 + * cdef readonly attr_t orth + * + * @staticmethod # <<<<<<<<<<<<<< + * cdef inline Lexeme from_ptr(LexemeC* lex, Vocab vocab): + * cdef Lexeme self = Lexeme.__new__(Lexeme, vocab, lex.orth) +*/ + +static CYTHON_INLINE struct __pyx_obj_5spacy_6lexeme_Lexeme *__pyx_f_5spacy_6lexeme_6Lexeme_from_ptr(struct __pyx_t_5spacy_7structs_LexemeC *__pyx_v_lex, struct __pyx_obj_5spacy_5vocab_Vocab *__pyx_v_vocab) { + struct __pyx_obj_5spacy_6lexeme_Lexeme *__pyx_v_self = 0; + struct __pyx_obj_5spacy_6lexeme_Lexeme *__pyx_r = NULL; + __Pyx_RefNannyDeclarations + PyObject *__pyx_t_1 = NULL; + PyObject *__pyx_t_2 = NULL; + __pyx_t_5spacy_8typedefs_attr_t __pyx_t_3; + int __pyx_lineno = 0; + const char *__pyx_filename = NULL; + int __pyx_clineno = 0; + __Pyx_RefNannySetupContext("from_ptr", 0); + + /* "lexeme.pxd":31 + * @staticmethod + * cdef inline Lexeme from_ptr(LexemeC* lex, Vocab vocab): + * cdef Lexeme self = Lexeme.__new__(Lexeme, vocab, lex.orth) # <<<<<<<<<<<<<< + * self.c = lex + * self.vocab = vocab +*/ + __pyx_t_1 = __Pyx_PyLong_From_uint64_t(__pyx_v_lex->orth); if (unlikely(!__pyx_t_1)) __PYX_ERR(2, 31, __pyx_L1_error) + __Pyx_GOTREF(__pyx_t_1); + __pyx_t_2 = PyTuple_New(2); if (unlikely(!__pyx_t_2)) __PYX_ERR(2, 31, __pyx_L1_error) + __Pyx_GOTREF(__pyx_t_2); + __Pyx_INCREF((PyObject *)__pyx_v_vocab); + __Pyx_GIVEREF((PyObject *)__pyx_v_vocab); + if (__Pyx_PyTuple_SET_ITEM(__pyx_t_2, 0, ((PyObject *)__pyx_v_vocab)) != (0)) __PYX_ERR(2, 31, __pyx_L1_error); + __Pyx_GIVEREF(__pyx_t_1); + if (__Pyx_PyTuple_SET_ITEM(__pyx_t_2, 1, __pyx_t_1) != (0)) __PYX_ERR(2, 31, __pyx_L1_error); + __pyx_t_1 = 0; + __pyx_t_1 = __Pyx_tp_new(((PyObject *)__pyx_mstate_global->__pyx_ptype_5spacy_6lexeme_Lexeme), ((PyObject*)__pyx_t_2)); if (unlikely(!__pyx_t_1)) __PYX_ERR(2, 31, __pyx_L1_error) + __Pyx_GOTREF(__pyx_t_1); + __Pyx_DECREF(__pyx_t_2); __pyx_t_2 = 0; + if (!(likely(__Pyx_TypeTest(__pyx_t_1, __pyx_mstate_global->__pyx_ptype_5spacy_6lexeme_Lexeme)))) __PYX_ERR(2, 31, __pyx_L1_error) + __pyx_v_self = ((struct __pyx_obj_5spacy_6lexeme_Lexeme *)__pyx_t_1); + __pyx_t_1 = 0; + + /* "lexeme.pxd":32 + * cdef inline Lexeme from_ptr(LexemeC* lex, Vocab vocab): + * cdef Lexeme self = Lexeme.__new__(Lexeme, vocab, lex.orth) + * self.c = lex # <<<<<<<<<<<<<< + * self.vocab = vocab + * self.orth = lex.orth +*/ + __pyx_v_self->c = __pyx_v_lex; + + /* "lexeme.pxd":33 + * cdef Lexeme self = Lexeme.__new__(Lexeme, vocab, lex.orth) + * self.c = lex + * self.vocab = vocab # <<<<<<<<<<<<<< + * self.orth = lex.orth + * return self +*/ + __Pyx_INCREF((PyObject *)__pyx_v_vocab); + __Pyx_GIVEREF((PyObject *)__pyx_v_vocab); + __Pyx_GOTREF((PyObject *)__pyx_v_self->vocab); + __Pyx_DECREF((PyObject *)__pyx_v_self->vocab); + __pyx_v_self->vocab = __pyx_v_vocab; + + /* "lexeme.pxd":34 + * self.c = lex + * self.vocab = vocab + * self.orth = lex.orth # <<<<<<<<<<<<<< + * return self + * +*/ + __pyx_t_3 = __pyx_v_lex->orth; + __pyx_v_self->orth = __pyx_t_3; + + /* "lexeme.pxd":35 + * self.vocab = vocab + * self.orth = lex.orth + * return self # <<<<<<<<<<<<<< + * + * @staticmethod +*/ + __Pyx_XDECREF((PyObject *)__pyx_r); + __Pyx_INCREF((PyObject *)__pyx_v_self); + __pyx_r = __pyx_v_self; + goto __pyx_L0; + + /* "lexeme.pxd":29 + * cdef readonly attr_t orth + * + * @staticmethod # <<<<<<<<<<<<<< + * cdef inline Lexeme from_ptr(LexemeC* lex, Vocab vocab): + * cdef Lexeme self = Lexeme.__new__(Lexeme, vocab, lex.orth) +*/ + + /* function exit code */ + __pyx_L1_error:; + __Pyx_XDECREF(__pyx_t_1); + __Pyx_XDECREF(__pyx_t_2); + __Pyx_AddTraceback("spacy.lexeme.Lexeme.from_ptr", __pyx_clineno, __pyx_lineno, __pyx_filename); + __pyx_r = 0; + __pyx_L0:; + __Pyx_XDECREF((PyObject *)__pyx_v_self); + __Pyx_XGIVEREF((PyObject *)__pyx_r); + __Pyx_RefNannyFinishContext(); + return __pyx_r; +} + +/* "lexeme.pxd":37 + * return self + * + * @staticmethod # <<<<<<<<<<<<<< + * cdef inline void set_struct_attr(LexemeC* lex, attr_id_t name, attr_t value) noexcept nogil: + * if name < (sizeof(flags_t) * 8): +*/ + +static CYTHON_INLINE void __pyx_f_5spacy_6lexeme_6Lexeme_set_struct_attr(struct __pyx_t_5spacy_7structs_LexemeC *__pyx_v_lex, enum __pyx_t_5spacy_5attrs_attr_id_t __pyx_v_name, __pyx_t_5spacy_8typedefs_attr_t __pyx_v_value) { + int __pyx_t_1; + + /* "lexeme.pxd":39 + * @staticmethod + * cdef inline void set_struct_attr(LexemeC* lex, attr_id_t name, attr_t value) noexcept nogil: + * if name < (sizeof(flags_t) * 8): # <<<<<<<<<<<<<< + * Lexeme.c_set_flag(lex, name, value) + * elif name == ID: +*/ + __pyx_t_1 = (__pyx_v_name < ((sizeof(__pyx_t_5spacy_8typedefs_flags_t)) * 8)); + if (__pyx_t_1) { + + /* "lexeme.pxd":40 + * cdef inline void set_struct_attr(LexemeC* lex, attr_id_t name, attr_t value) noexcept nogil: + * if name < (sizeof(flags_t) * 8): + * Lexeme.c_set_flag(lex, name, value) # <<<<<<<<<<<<<< + * elif name == ID: + * lex.id = value +*/ + (void)(__pyx_f_5spacy_6lexeme_6Lexeme_c_set_flag(__pyx_v_lex, __pyx_v_name, __pyx_v_value)); + + /* "lexeme.pxd":39 + * @staticmethod + * cdef inline void set_struct_attr(LexemeC* lex, attr_id_t name, attr_t value) noexcept nogil: + * if name < (sizeof(flags_t) * 8): # <<<<<<<<<<<<<< + * Lexeme.c_set_flag(lex, name, value) + * elif name == ID: +*/ + goto __pyx_L3; + } + + /* "lexeme.pxd":41 + * if name < (sizeof(flags_t) * 8): + * Lexeme.c_set_flag(lex, name, value) + * elif name == ID: # <<<<<<<<<<<<<< + * lex.id = value + * elif name == LOWER: +*/ + __pyx_t_1 = (__pyx_v_name == __pyx_e_5spacy_5attrs_ID); + if (__pyx_t_1) { + + /* "lexeme.pxd":42 + * Lexeme.c_set_flag(lex, name, value) + * elif name == ID: + * lex.id = value # <<<<<<<<<<<<<< + * elif name == LOWER: + * lex.lower = value +*/ + __pyx_v_lex->id = __pyx_v_value; + + /* "lexeme.pxd":41 + * if name < (sizeof(flags_t) * 8): + * Lexeme.c_set_flag(lex, name, value) + * elif name == ID: # <<<<<<<<<<<<<< + * lex.id = value + * elif name == LOWER: +*/ + goto __pyx_L3; + } + + /* "lexeme.pxd":43 + * elif name == ID: + * lex.id = value + * elif name == LOWER: # <<<<<<<<<<<<<< + * lex.lower = value + * elif name == NORM: +*/ + __pyx_t_1 = (__pyx_v_name == __pyx_e_5spacy_5attrs_LOWER); + if (__pyx_t_1) { + + /* "lexeme.pxd":44 + * lex.id = value + * elif name == LOWER: + * lex.lower = value # <<<<<<<<<<<<<< + * elif name == NORM: + * lex.norm = value +*/ + __pyx_v_lex->lower = __pyx_v_value; + + /* "lexeme.pxd":43 + * elif name == ID: + * lex.id = value + * elif name == LOWER: # <<<<<<<<<<<<<< + * lex.lower = value + * elif name == NORM: +*/ + goto __pyx_L3; + } + + /* "lexeme.pxd":45 + * elif name == LOWER: + * lex.lower = value + * elif name == NORM: # <<<<<<<<<<<<<< + * lex.norm = value + * elif name == SHAPE: +*/ + __pyx_t_1 = (__pyx_v_name == __pyx_e_5spacy_5attrs_NORM); + if (__pyx_t_1) { + + /* "lexeme.pxd":46 + * lex.lower = value + * elif name == NORM: + * lex.norm = value # <<<<<<<<<<<<<< + * elif name == SHAPE: + * lex.shape = value +*/ + __pyx_v_lex->norm = __pyx_v_value; + + /* "lexeme.pxd":45 + * elif name == LOWER: + * lex.lower = value + * elif name == NORM: # <<<<<<<<<<<<<< + * lex.norm = value + * elif name == SHAPE: +*/ + goto __pyx_L3; + } + + /* "lexeme.pxd":47 + * elif name == NORM: + * lex.norm = value + * elif name == SHAPE: # <<<<<<<<<<<<<< + * lex.shape = value + * elif name == PREFIX: +*/ + __pyx_t_1 = (__pyx_v_name == __pyx_e_5spacy_5attrs_SHAPE); + if (__pyx_t_1) { + + /* "lexeme.pxd":48 + * lex.norm = value + * elif name == SHAPE: + * lex.shape = value # <<<<<<<<<<<<<< + * elif name == PREFIX: + * lex.prefix = value +*/ + __pyx_v_lex->shape = __pyx_v_value; + + /* "lexeme.pxd":47 + * elif name == NORM: + * lex.norm = value + * elif name == SHAPE: # <<<<<<<<<<<<<< + * lex.shape = value + * elif name == PREFIX: +*/ + goto __pyx_L3; + } + + /* "lexeme.pxd":49 + * elif name == SHAPE: + * lex.shape = value + * elif name == PREFIX: # <<<<<<<<<<<<<< + * lex.prefix = value + * elif name == SUFFIX: +*/ + __pyx_t_1 = (__pyx_v_name == __pyx_e_5spacy_5attrs_PREFIX); + if (__pyx_t_1) { + + /* "lexeme.pxd":50 + * lex.shape = value + * elif name == PREFIX: + * lex.prefix = value # <<<<<<<<<<<<<< + * elif name == SUFFIX: + * lex.suffix = value +*/ + __pyx_v_lex->prefix = __pyx_v_value; + + /* "lexeme.pxd":49 + * elif name == SHAPE: + * lex.shape = value + * elif name == PREFIX: # <<<<<<<<<<<<<< + * lex.prefix = value + * elif name == SUFFIX: +*/ + goto __pyx_L3; + } + + /* "lexeme.pxd":51 + * elif name == PREFIX: + * lex.prefix = value + * elif name == SUFFIX: # <<<<<<<<<<<<<< + * lex.suffix = value + * elif name == LANG: +*/ + __pyx_t_1 = (__pyx_v_name == __pyx_e_5spacy_5attrs_SUFFIX); + if (__pyx_t_1) { + + /* "lexeme.pxd":52 + * lex.prefix = value + * elif name == SUFFIX: + * lex.suffix = value # <<<<<<<<<<<<<< + * elif name == LANG: + * lex.lang = value +*/ + __pyx_v_lex->suffix = __pyx_v_value; + + /* "lexeme.pxd":51 + * elif name == PREFIX: + * lex.prefix = value + * elif name == SUFFIX: # <<<<<<<<<<<<<< + * lex.suffix = value + * elif name == LANG: +*/ + goto __pyx_L3; + } + + /* "lexeme.pxd":53 + * elif name == SUFFIX: + * lex.suffix = value + * elif name == LANG: # <<<<<<<<<<<<<< + * lex.lang = value + * +*/ + __pyx_t_1 = (__pyx_v_name == __pyx_e_5spacy_5attrs_LANG); + if (__pyx_t_1) { + + /* "lexeme.pxd":54 + * lex.suffix = value + * elif name == LANG: + * lex.lang = value # <<<<<<<<<<<<<< + * + * @staticmethod +*/ + __pyx_v_lex->lang = __pyx_v_value; + + /* "lexeme.pxd":53 + * elif name == SUFFIX: + * lex.suffix = value + * elif name == LANG: # <<<<<<<<<<<<<< + * lex.lang = value + * +*/ + } + __pyx_L3:; + + /* "lexeme.pxd":37 + * return self + * + * @staticmethod # <<<<<<<<<<<<<< + * cdef inline void set_struct_attr(LexemeC* lex, attr_id_t name, attr_t value) noexcept nogil: + * if name < (sizeof(flags_t) * 8): +*/ + + /* function exit code */ +} + +/* "lexeme.pxd":56 + * lex.lang = value + * + * @staticmethod # <<<<<<<<<<<<<< + * cdef inline attr_t get_struct_attr(const LexemeC* lex, attr_id_t feat_name) noexcept nogil: + * if feat_name < (sizeof(flags_t) * 8): +*/ + +static CYTHON_INLINE __pyx_t_5spacy_8typedefs_attr_t __pyx_f_5spacy_6lexeme_6Lexeme_get_struct_attr(struct __pyx_t_5spacy_7structs_LexemeC const *__pyx_v_lex, enum __pyx_t_5spacy_5attrs_attr_id_t __pyx_v_feat_name) { + __pyx_t_5spacy_8typedefs_attr_t __pyx_r; + int __pyx_t_1; + + /* "lexeme.pxd":58 + * @staticmethod + * cdef inline attr_t get_struct_attr(const LexemeC* lex, attr_id_t feat_name) noexcept nogil: + * if feat_name < (sizeof(flags_t) * 8): # <<<<<<<<<<<<<< + * if Lexeme.c_check_flag(lex, feat_name): + * return 1 +*/ + __pyx_t_1 = (__pyx_v_feat_name < ((sizeof(__pyx_t_5spacy_8typedefs_flags_t)) * 8)); + if (__pyx_t_1) { + + /* "lexeme.pxd":59 + * cdef inline attr_t get_struct_attr(const LexemeC* lex, attr_id_t feat_name) noexcept nogil: + * if feat_name < (sizeof(flags_t) * 8): + * if Lexeme.c_check_flag(lex, feat_name): # <<<<<<<<<<<<<< + * return 1 + * else: +*/ + __pyx_t_1 = __pyx_f_5spacy_6lexeme_6Lexeme_c_check_flag(__pyx_v_lex, __pyx_v_feat_name); + if (__pyx_t_1) { + + /* "lexeme.pxd":60 + * if feat_name < (sizeof(flags_t) * 8): + * if Lexeme.c_check_flag(lex, feat_name): + * return 1 # <<<<<<<<<<<<<< + * else: + * return 0 +*/ + __pyx_r = 1; + goto __pyx_L0; + + /* "lexeme.pxd":59 + * cdef inline attr_t get_struct_attr(const LexemeC* lex, attr_id_t feat_name) noexcept nogil: + * if feat_name < (sizeof(flags_t) * 8): + * if Lexeme.c_check_flag(lex, feat_name): # <<<<<<<<<<<<<< + * return 1 + * else: +*/ + } + + /* "lexeme.pxd":62 + * return 1 + * else: + * return 0 # <<<<<<<<<<<<<< + * elif feat_name == ID: + * return lex.id +*/ + /*else*/ { + __pyx_r = 0; + goto __pyx_L0; + } + + /* "lexeme.pxd":58 + * @staticmethod + * cdef inline attr_t get_struct_attr(const LexemeC* lex, attr_id_t feat_name) noexcept nogil: + * if feat_name < (sizeof(flags_t) * 8): # <<<<<<<<<<<<<< + * if Lexeme.c_check_flag(lex, feat_name): + * return 1 +*/ + } + + /* "lexeme.pxd":63 + * else: + * return 0 + * elif feat_name == ID: # <<<<<<<<<<<<<< + * return lex.id + * elif feat_name == ORTH: +*/ + __pyx_t_1 = (__pyx_v_feat_name == __pyx_e_5spacy_5attrs_ID); + if (__pyx_t_1) { + + /* "lexeme.pxd":64 + * return 0 + * elif feat_name == ID: + * return lex.id # <<<<<<<<<<<<<< + * elif feat_name == ORTH: + * return lex.orth +*/ + __pyx_r = __pyx_v_lex->id; + goto __pyx_L0; + + /* "lexeme.pxd":63 + * else: + * return 0 + * elif feat_name == ID: # <<<<<<<<<<<<<< + * return lex.id + * elif feat_name == ORTH: +*/ + } + + /* "lexeme.pxd":65 + * elif feat_name == ID: + * return lex.id + * elif feat_name == ORTH: # <<<<<<<<<<<<<< + * return lex.orth + * elif feat_name == LOWER: +*/ + __pyx_t_1 = (__pyx_v_feat_name == __pyx_e_5spacy_5attrs_ORTH); + if (__pyx_t_1) { + + /* "lexeme.pxd":66 + * return lex.id + * elif feat_name == ORTH: + * return lex.orth # <<<<<<<<<<<<<< + * elif feat_name == LOWER: + * return lex.lower +*/ + __pyx_r = __pyx_v_lex->orth; + goto __pyx_L0; + + /* "lexeme.pxd":65 + * elif feat_name == ID: + * return lex.id + * elif feat_name == ORTH: # <<<<<<<<<<<<<< + * return lex.orth + * elif feat_name == LOWER: +*/ + } + + /* "lexeme.pxd":67 + * elif feat_name == ORTH: + * return lex.orth + * elif feat_name == LOWER: # <<<<<<<<<<<<<< + * return lex.lower + * elif feat_name == NORM: +*/ + __pyx_t_1 = (__pyx_v_feat_name == __pyx_e_5spacy_5attrs_LOWER); + if (__pyx_t_1) { + + /* "lexeme.pxd":68 + * return lex.orth + * elif feat_name == LOWER: + * return lex.lower # <<<<<<<<<<<<<< + * elif feat_name == NORM: + * return lex.norm +*/ + __pyx_r = __pyx_v_lex->lower; + goto __pyx_L0; + + /* "lexeme.pxd":67 + * elif feat_name == ORTH: + * return lex.orth + * elif feat_name == LOWER: # <<<<<<<<<<<<<< + * return lex.lower + * elif feat_name == NORM: +*/ + } + + /* "lexeme.pxd":69 + * elif feat_name == LOWER: + * return lex.lower + * elif feat_name == NORM: # <<<<<<<<<<<<<< + * return lex.norm + * elif feat_name == SHAPE: +*/ + __pyx_t_1 = (__pyx_v_feat_name == __pyx_e_5spacy_5attrs_NORM); + if (__pyx_t_1) { + + /* "lexeme.pxd":70 + * return lex.lower + * elif feat_name == NORM: + * return lex.norm # <<<<<<<<<<<<<< + * elif feat_name == SHAPE: + * return lex.shape +*/ + __pyx_r = __pyx_v_lex->norm; + goto __pyx_L0; + + /* "lexeme.pxd":69 + * elif feat_name == LOWER: + * return lex.lower + * elif feat_name == NORM: # <<<<<<<<<<<<<< + * return lex.norm + * elif feat_name == SHAPE: +*/ + } + + /* "lexeme.pxd":71 + * elif feat_name == NORM: + * return lex.norm + * elif feat_name == SHAPE: # <<<<<<<<<<<<<< + * return lex.shape + * elif feat_name == PREFIX: +*/ + __pyx_t_1 = (__pyx_v_feat_name == __pyx_e_5spacy_5attrs_SHAPE); + if (__pyx_t_1) { + + /* "lexeme.pxd":72 + * return lex.norm + * elif feat_name == SHAPE: + * return lex.shape # <<<<<<<<<<<<<< + * elif feat_name == PREFIX: + * return lex.prefix +*/ + __pyx_r = __pyx_v_lex->shape; + goto __pyx_L0; + + /* "lexeme.pxd":71 + * elif feat_name == NORM: + * return lex.norm + * elif feat_name == SHAPE: # <<<<<<<<<<<<<< + * return lex.shape + * elif feat_name == PREFIX: +*/ + } + + /* "lexeme.pxd":73 + * elif feat_name == SHAPE: + * return lex.shape + * elif feat_name == PREFIX: # <<<<<<<<<<<<<< + * return lex.prefix + * elif feat_name == SUFFIX: +*/ + __pyx_t_1 = (__pyx_v_feat_name == __pyx_e_5spacy_5attrs_PREFIX); + if (__pyx_t_1) { + + /* "lexeme.pxd":74 + * return lex.shape + * elif feat_name == PREFIX: + * return lex.prefix # <<<<<<<<<<<<<< + * elif feat_name == SUFFIX: + * return lex.suffix +*/ + __pyx_r = __pyx_v_lex->prefix; + goto __pyx_L0; + + /* "lexeme.pxd":73 + * elif feat_name == SHAPE: + * return lex.shape + * elif feat_name == PREFIX: # <<<<<<<<<<<<<< + * return lex.prefix + * elif feat_name == SUFFIX: +*/ + } + + /* "lexeme.pxd":75 + * elif feat_name == PREFIX: + * return lex.prefix + * elif feat_name == SUFFIX: # <<<<<<<<<<<<<< + * return lex.suffix + * elif feat_name == LENGTH: +*/ + __pyx_t_1 = (__pyx_v_feat_name == __pyx_e_5spacy_5attrs_SUFFIX); + if (__pyx_t_1) { + + /* "lexeme.pxd":76 + * return lex.prefix + * elif feat_name == SUFFIX: + * return lex.suffix # <<<<<<<<<<<<<< + * elif feat_name == LENGTH: + * return lex.length +*/ + __pyx_r = __pyx_v_lex->suffix; + goto __pyx_L0; + + /* "lexeme.pxd":75 + * elif feat_name == PREFIX: + * return lex.prefix + * elif feat_name == SUFFIX: # <<<<<<<<<<<<<< + * return lex.suffix + * elif feat_name == LENGTH: +*/ + } + + /* "lexeme.pxd":77 + * elif feat_name == SUFFIX: + * return lex.suffix + * elif feat_name == LENGTH: # <<<<<<<<<<<<<< + * return lex.length + * elif feat_name == LANG: +*/ + __pyx_t_1 = (__pyx_v_feat_name == __pyx_e_5spacy_5attrs_LENGTH); + if (__pyx_t_1) { + + /* "lexeme.pxd":78 + * return lex.suffix + * elif feat_name == LENGTH: + * return lex.length # <<<<<<<<<<<<<< + * elif feat_name == LANG: + * return lex.lang +*/ + __pyx_r = __pyx_v_lex->length; + goto __pyx_L0; + + /* "lexeme.pxd":77 + * elif feat_name == SUFFIX: + * return lex.suffix + * elif feat_name == LENGTH: # <<<<<<<<<<<<<< + * return lex.length + * elif feat_name == LANG: +*/ + } + + /* "lexeme.pxd":79 + * elif feat_name == LENGTH: + * return lex.length + * elif feat_name == LANG: # <<<<<<<<<<<<<< + * return lex.lang + * else: +*/ + __pyx_t_1 = (__pyx_v_feat_name == __pyx_e_5spacy_5attrs_LANG); + if (__pyx_t_1) { + + /* "lexeme.pxd":80 + * return lex.length + * elif feat_name == LANG: + * return lex.lang # <<<<<<<<<<<<<< + * else: + * return 0 +*/ + __pyx_r = __pyx_v_lex->lang; + goto __pyx_L0; + + /* "lexeme.pxd":79 + * elif feat_name == LENGTH: + * return lex.length + * elif feat_name == LANG: # <<<<<<<<<<<<<< + * return lex.lang + * else: +*/ + } + + /* "lexeme.pxd":82 + * return lex.lang + * else: + * return 0 # <<<<<<<<<<<<<< + * + * @staticmethod +*/ + /*else*/ { + __pyx_r = 0; + goto __pyx_L0; + } + + /* "lexeme.pxd":56 + * lex.lang = value + * + * @staticmethod # <<<<<<<<<<<<<< + * cdef inline attr_t get_struct_attr(const LexemeC* lex, attr_id_t feat_name) noexcept nogil: + * if feat_name < (sizeof(flags_t) * 8): +*/ + + /* function exit code */ + __pyx_L0:; + return __pyx_r; +} + +/* "lexeme.pxd":84 + * return 0 + * + * @staticmethod # <<<<<<<<<<<<<< + * cdef inline bint c_check_flag(const LexemeC* lexeme, attr_id_t flag_id) noexcept nogil: + * cdef flags_t one = 1 +*/ + +static CYTHON_INLINE int __pyx_f_5spacy_6lexeme_6Lexeme_c_check_flag(struct __pyx_t_5spacy_7structs_LexemeC const *__pyx_v_lexeme, enum __pyx_t_5spacy_5attrs_attr_id_t __pyx_v_flag_id) { + __pyx_t_5spacy_8typedefs_flags_t __pyx_v_one; + int __pyx_r; + int __pyx_t_1; + + /* "lexeme.pxd":86 + * @staticmethod + * cdef inline bint c_check_flag(const LexemeC* lexeme, attr_id_t flag_id) noexcept nogil: + * cdef flags_t one = 1 # <<<<<<<<<<<<<< + * if lexeme.flags & (one << flag_id): + * return True +*/ + __pyx_v_one = 1; + + /* "lexeme.pxd":87 + * cdef inline bint c_check_flag(const LexemeC* lexeme, attr_id_t flag_id) noexcept nogil: + * cdef flags_t one = 1 + * if lexeme.flags & (one << flag_id): # <<<<<<<<<<<<<< + * return True + * else: +*/ + __pyx_t_1 = ((__pyx_v_lexeme->flags & (__pyx_v_one << __pyx_v_flag_id)) != 0); + if (__pyx_t_1) { + + /* "lexeme.pxd":88 + * cdef flags_t one = 1 + * if lexeme.flags & (one << flag_id): + * return True # <<<<<<<<<<<<<< + * else: + * return False +*/ + __pyx_r = 1; + goto __pyx_L0; + + /* "lexeme.pxd":87 + * cdef inline bint c_check_flag(const LexemeC* lexeme, attr_id_t flag_id) noexcept nogil: + * cdef flags_t one = 1 + * if lexeme.flags & (one << flag_id): # <<<<<<<<<<<<<< + * return True + * else: +*/ + } + + /* "lexeme.pxd":90 + * return True + * else: + * return False # <<<<<<<<<<<<<< + * + * @staticmethod +*/ + /*else*/ { + __pyx_r = 0; + goto __pyx_L0; + } + + /* "lexeme.pxd":84 + * return 0 + * + * @staticmethod # <<<<<<<<<<<<<< + * cdef inline bint c_check_flag(const LexemeC* lexeme, attr_id_t flag_id) noexcept nogil: + * cdef flags_t one = 1 +*/ + + /* function exit code */ + __pyx_L0:; + return __pyx_r; +} + +/* "lexeme.pxd":92 + * return False + * + * @staticmethod # <<<<<<<<<<<<<< + * cdef inline bint c_set_flag(LexemeC* lex, attr_id_t flag_id, bint value) noexcept nogil: + * cdef flags_t one = 1 +*/ + +static CYTHON_INLINE int __pyx_f_5spacy_6lexeme_6Lexeme_c_set_flag(struct __pyx_t_5spacy_7structs_LexemeC *__pyx_v_lex, enum __pyx_t_5spacy_5attrs_attr_id_t __pyx_v_flag_id, int __pyx_v_value) { + __pyx_t_5spacy_8typedefs_flags_t __pyx_v_one; + int __pyx_r; + + /* "lexeme.pxd":94 + * @staticmethod + * cdef inline bint c_set_flag(LexemeC* lex, attr_id_t flag_id, bint value) noexcept nogil: + * cdef flags_t one = 1 # <<<<<<<<<<<<<< + * if value: + * lex.flags |= one << flag_id +*/ + __pyx_v_one = 1; + + /* "lexeme.pxd":95 + * cdef inline bint c_set_flag(LexemeC* lex, attr_id_t flag_id, bint value) noexcept nogil: + * cdef flags_t one = 1 + * if value: # <<<<<<<<<<<<<< + * lex.flags |= one << flag_id + * else: +*/ + if (__pyx_v_value) { + + /* "lexeme.pxd":96 + * cdef flags_t one = 1 + * if value: + * lex.flags |= one << flag_id # <<<<<<<<<<<<<< + * else: + * lex.flags &= ~(one << flag_id) +*/ + __pyx_v_lex->flags = (__pyx_v_lex->flags | (__pyx_v_one << __pyx_v_flag_id)); + + /* "lexeme.pxd":95 + * cdef inline bint c_set_flag(LexemeC* lex, attr_id_t flag_id, bint value) noexcept nogil: + * cdef flags_t one = 1 + * if value: # <<<<<<<<<<<<<< + * lex.flags |= one << flag_id + * else: +*/ + goto __pyx_L3; + } + + /* "lexeme.pxd":98 + * lex.flags |= one << flag_id + * else: + * lex.flags &= ~(one << flag_id) # <<<<<<<<<<<<<< +*/ + /*else*/ { + __pyx_v_lex->flags = (__pyx_v_lex->flags & (~(__pyx_v_one << __pyx_v_flag_id))); + } + __pyx_L3:; + + /* "lexeme.pxd":92 + * return False + * + * @staticmethod # <<<<<<<<<<<<<< + * cdef inline bint c_set_flag(LexemeC* lex, attr_id_t flag_id, bint value) noexcept nogil: + * cdef flags_t one = 1 +*/ + + /* function exit code */ + __pyx_r = 0; + return __pyx_r; +} + +/* "spacy/pipeline/_parser_internals/_state.pxd":20 + * + * + * cdef inline bint is_space_token(const TokenC* token) noexcept nogil: # <<<<<<<<<<<<<< + * return Lexeme.c_check_flag(token.lex, IS_SPACE) + * +*/ + +static CYTHON_INLINE int __pyx_f_5spacy_8pipeline_17_parser_internals_6_state_is_space_token(struct __pyx_t_5spacy_7structs_TokenC const *__pyx_v_token) { + int __pyx_r; + + /* "spacy/pipeline/_parser_internals/_state.pxd":21 + * + * cdef inline bint is_space_token(const TokenC* token) noexcept nogil: + * return Lexeme.c_check_flag(token.lex, IS_SPACE) # <<<<<<<<<<<<<< + * + * cdef struct ArcC: +*/ + __pyx_r = __pyx_f_5spacy_6lexeme_6Lexeme_c_check_flag(__pyx_v_token->lex, __pyx_e_5spacy_5attrs_IS_SPACE); + goto __pyx_L0; + + /* "spacy/pipeline/_parser_internals/_state.pxd":20 + * + * + * cdef inline bint is_space_token(const TokenC* token) noexcept nogil: # <<<<<<<<<<<<<< + * return Lexeme.c_check_flag(token.lex, IS_SPACE) + * +*/ + + /* function exit code */ + __pyx_L0:; + return __pyx_r; +} + +/* "spacy/pipeline/_parser_internals/_state.pxd":44 + * int _b_i + * + * inline __init__(const TokenC* sent, int length) noexcept nogil: # <<<<<<<<<<<<<< + * this._sent = sent + * this._heads = calloc(length, sizeof(int)) +*/ + +void __pyx_t_5spacy_8pipeline_17_parser_internals_6_state_StateC::__pyx_f___init__StateC(struct __pyx_t_5spacy_7structs_TokenC const *__pyx_v_sent, int __pyx_v_length) { + int __pyx_v_i; + int __pyx_t_1; + int __pyx_t_2; + PyObject *__pyx_t_3; + int __pyx_t_4; + int __pyx_t_5; + int __pyx_t_6; + int __pyx_lineno = 0; + const char *__pyx_filename = NULL; + int __pyx_clineno = 0; + PyGILState_STATE __pyx_gilstate_save; + + /* "spacy/pipeline/_parser_internals/_state.pxd":45 + * + * inline __init__(const TokenC* sent, int length) noexcept nogil: + * this._sent = sent # <<<<<<<<<<<<<< + * this._heads = calloc(length, sizeof(int)) + * if not (this._sent and this._heads): +*/ + this->_sent = __pyx_v_sent; + + /* "spacy/pipeline/_parser_internals/_state.pxd":46 + * inline __init__(const TokenC* sent, int length) noexcept nogil: + * this._sent = sent + * this._heads = calloc(length, sizeof(int)) # <<<<<<<<<<<<<< + * if not (this._sent and this._heads): + * with gil: +*/ + this->_heads = ((int *)calloc(__pyx_v_length, (sizeof(int)))); + + /* "spacy/pipeline/_parser_internals/_state.pxd":47 + * this._sent = sent + * this._heads = calloc(length, sizeof(int)) + * if not (this._sent and this._heads): # <<<<<<<<<<<<<< + * with gil: + * PyErr_SetFromErrno(MemoryError) +*/ + __pyx_t_2 = (this->_sent != 0); + if (__pyx_t_2) { + } else { + __pyx_t_1 = __pyx_t_2; + goto __pyx_L4_bool_binop_done; + } + __pyx_t_2 = (this->_heads != 0); + __pyx_t_1 = __pyx_t_2; + __pyx_L4_bool_binop_done:; + __pyx_t_2 = (!__pyx_t_1); + if (__pyx_t_2) { + + /* "spacy/pipeline/_parser_internals/_state.pxd":48 + * this._heads = calloc(length, sizeof(int)) + * if not (this._sent and this._heads): + * with gil: # <<<<<<<<<<<<<< + * PyErr_SetFromErrno(MemoryError) + * PyErr_CheckSignals() +*/ + { + PyGILState_STATE __pyx_gilstate_save = __Pyx_PyGILState_Ensure(); + /*try:*/ { + + /* "spacy/pipeline/_parser_internals/_state.pxd":49 + * if not (this._sent and this._heads): + * with gil: + * PyErr_SetFromErrno(MemoryError) # <<<<<<<<<<<<<< + * PyErr_CheckSignals() + * this.offset = 0 +*/ + __pyx_t_3 = PyErr_SetFromErrno(((PyObject *)(((PyTypeObject*)PyExc_MemoryError)))); if (unlikely(__pyx_t_3 == ((void *)NULL))) __PYX_ERR(3, 49, __pyx_L7_error) + + /* "spacy/pipeline/_parser_internals/_state.pxd":50 + * with gil: + * PyErr_SetFromErrno(MemoryError) + * PyErr_CheckSignals() # <<<<<<<<<<<<<< + * this.offset = 0 + * this.length = length +*/ + __pyx_t_4 = PyErr_CheckSignals(); if (unlikely(__pyx_t_4 == ((int)-1))) __PYX_ERR(3, 50, __pyx_L7_error) + } + + /* "spacy/pipeline/_parser_internals/_state.pxd":48 + * this._heads = calloc(length, sizeof(int)) + * if not (this._sent and this._heads): + * with gil: # <<<<<<<<<<<<<< + * PyErr_SetFromErrno(MemoryError) + * PyErr_CheckSignals() +*/ + /*finally:*/ { + /*normal exit:*/{ + __Pyx_PyGILState_Release(__pyx_gilstate_save); + goto __pyx_L8; + } + __pyx_L7_error: { + __Pyx_PyGILState_Release(__pyx_gilstate_save); + goto __pyx_L1_error; + } + __pyx_L8:; + } + } + + /* "spacy/pipeline/_parser_internals/_state.pxd":47 + * this._sent = sent + * this._heads = calloc(length, sizeof(int)) + * if not (this._sent and this._heads): # <<<<<<<<<<<<<< + * with gil: + * PyErr_SetFromErrno(MemoryError) +*/ + } + + /* "spacy/pipeline/_parser_internals/_state.pxd":51 + * PyErr_SetFromErrno(MemoryError) + * PyErr_CheckSignals() + * this.offset = 0 # <<<<<<<<<<<<<< + * this.length = length + * this._b_i = 0 +*/ + this->offset = 0; + + /* "spacy/pipeline/_parser_internals/_state.pxd":52 + * PyErr_CheckSignals() + * this.offset = 0 + * this.length = length # <<<<<<<<<<<<<< + * this._b_i = 0 + * for i in range(length): +*/ + this->length = __pyx_v_length; + + /* "spacy/pipeline/_parser_internals/_state.pxd":53 + * this.offset = 0 + * this.length = length + * this._b_i = 0 # <<<<<<<<<<<<<< + * for i in range(length): + * this._heads[i] = -1 +*/ + this->_b_i = 0; + + /* "spacy/pipeline/_parser_internals/_state.pxd":54 + * this.length = length + * this._b_i = 0 + * for i in range(length): # <<<<<<<<<<<<<< + * this._heads[i] = -1 + * this._unshiftable.push_back(0) +*/ + __pyx_t_4 = __pyx_v_length; + __pyx_t_5 = __pyx_t_4; + for (__pyx_t_6 = 0; __pyx_t_6 < __pyx_t_5; __pyx_t_6+=1) { + __pyx_v_i = __pyx_t_6; + + /* "spacy/pipeline/_parser_internals/_state.pxd":55 + * this._b_i = 0 + * for i in range(length): + * this._heads[i] = -1 # <<<<<<<<<<<<<< + * this._unshiftable.push_back(0) + * memset(&this._empty_token, 0, sizeof(TokenC)) +*/ + (this->_heads[__pyx_v_i]) = -1; + + /* "spacy/pipeline/_parser_internals/_state.pxd":56 + * for i in range(length): + * this._heads[i] = -1 + * this._unshiftable.push_back(0) # <<<<<<<<<<<<<< + * memset(&this._empty_token, 0, sizeof(TokenC)) + * this._empty_token.lex = &EMPTY_LEXEME +*/ + try { + this->_unshiftable.push_back(0); + } catch(...) { + PyGILState_STATE __pyx_gilstate_save = __Pyx_PyGILState_Ensure(); + __Pyx_CppExn2PyErr(); + __Pyx_PyGILState_Release(__pyx_gilstate_save); + __PYX_ERR(3, 56, __pyx_L1_error) + } + } + + /* "spacy/pipeline/_parser_internals/_state.pxd":57 + * this._heads[i] = -1 + * this._unshiftable.push_back(0) + * memset(&this._empty_token, 0, sizeof(TokenC)) # <<<<<<<<<<<<<< + * this._empty_token.lex = &EMPTY_LEXEME + * +*/ + (void)(memset((&this->_empty_token), 0, (sizeof(struct __pyx_t_5spacy_7structs_TokenC)))); + + /* "spacy/pipeline/_parser_internals/_state.pxd":58 + * this._unshiftable.push_back(0) + * memset(&this._empty_token, 0, sizeof(TokenC)) + * this._empty_token.lex = &EMPTY_LEXEME # <<<<<<<<<<<<<< + * + * inline __dealloc__(): +*/ + this->_empty_token.lex = (&__pyx_v_5spacy_5vocab_EMPTY_LEXEME); + + /* "spacy/pipeline/_parser_internals/_state.pxd":44 + * int _b_i + * + * inline __init__(const TokenC* sent, int length) noexcept nogil: # <<<<<<<<<<<<<< + * this._sent = sent + * this._heads = calloc(length, sizeof(int)) +*/ + + /* function exit code */ + goto __pyx_L0; + __pyx_L1_error:; + __pyx_gilstate_save = __Pyx_PyGILState_Ensure(); + __Pyx_WriteUnraisable("StateC.", __pyx_clineno, __pyx_lineno, __pyx_filename, 1, 0); + __Pyx_PyGILState_Release(__pyx_gilstate_save); + __pyx_L0:; +} + +/* "spacy/pipeline/_parser_internals/_state.pxd":60 + * this._empty_token.lex = &EMPTY_LEXEME + * + * inline __dealloc__(): # <<<<<<<<<<<<<< + * free(this._heads) + * +*/ + +void __pyx_t_5spacy_8pipeline_17_parser_internals_6_state_StateC::__pyx_f___dealloc__StateC(void) { + + /* "spacy/pipeline/_parser_internals/_state.pxd":61 + * + * inline __dealloc__(): + * free(this._heads) # <<<<<<<<<<<<<< + * + * inline void set_context_tokens(int* ids, int n) noexcept nogil: +*/ + free(this->_heads); + + /* "spacy/pipeline/_parser_internals/_state.pxd":60 + * this._empty_token.lex = &EMPTY_LEXEME + * + * inline __dealloc__(): # <<<<<<<<<<<<<< + * free(this._heads) + * +*/ + + /* function exit code */ +} + +/* "spacy/pipeline/_parser_internals/_state.pxd":63 + * free(this._heads) + * + * inline void set_context_tokens(int* ids, int n) noexcept nogil: # <<<<<<<<<<<<<< + * cdef int i, j + * if n == 1: +*/ + +void __pyx_t_5spacy_8pipeline_17_parser_internals_6_state_StateC::set_context_tokens(int *__pyx_v_ids, int __pyx_v_n) { + int __pyx_v_i; + int __pyx_v_j; + struct __pyx_t_5spacy_7structs_SpanC __pyx_v_ent; + int __pyx_t_1; + int __pyx_t_2; + int __pyx_t_3; + int __pyx_t_4; + int __pyx_t_5; + int __pyx_t_6; + + /* "spacy/pipeline/_parser_internals/_state.pxd":65 + * inline void set_context_tokens(int* ids, int n) noexcept nogil: + * cdef int i, j + * if n == 1: # <<<<<<<<<<<<<< + * if this.B(0) >= 0: + * ids[0] = this.B(0) +*/ + switch (__pyx_v_n) { + case 1: + + /* "spacy/pipeline/_parser_internals/_state.pxd":66 + * cdef int i, j + * if n == 1: + * if this.B(0) >= 0: # <<<<<<<<<<<<<< + * ids[0] = this.B(0) + * else: +*/ + __pyx_t_1 = (this->B(0) >= 0); + if (__pyx_t_1) { + + /* "spacy/pipeline/_parser_internals/_state.pxd":67 + * if n == 1: + * if this.B(0) >= 0: + * ids[0] = this.B(0) # <<<<<<<<<<<<<< + * else: + * ids[0] = -1 +*/ + (__pyx_v_ids[0]) = this->B(0); + + /* "spacy/pipeline/_parser_internals/_state.pxd":66 + * cdef int i, j + * if n == 1: + * if this.B(0) >= 0: # <<<<<<<<<<<<<< + * ids[0] = this.B(0) + * else: +*/ + goto __pyx_L3; + } + + /* "spacy/pipeline/_parser_internals/_state.pxd":69 + * ids[0] = this.B(0) + * else: + * ids[0] = -1 # <<<<<<<<<<<<<< + * elif n == 2: + * ids[0] = this.B(0) +*/ + /*else*/ { + (__pyx_v_ids[0]) = -1; + } + __pyx_L3:; + + /* "spacy/pipeline/_parser_internals/_state.pxd":65 + * inline void set_context_tokens(int* ids, int n) noexcept nogil: + * cdef int i, j + * if n == 1: # <<<<<<<<<<<<<< + * if this.B(0) >= 0: + * ids[0] = this.B(0) +*/ + break; + case 2: + + /* "spacy/pipeline/_parser_internals/_state.pxd":71 + * ids[0] = -1 + * elif n == 2: + * ids[0] = this.B(0) # <<<<<<<<<<<<<< + * ids[1] = this.S(0) + * elif n == 3: +*/ + (__pyx_v_ids[0]) = this->B(0); + + /* "spacy/pipeline/_parser_internals/_state.pxd":72 + * elif n == 2: + * ids[0] = this.B(0) + * ids[1] = this.S(0) # <<<<<<<<<<<<<< + * elif n == 3: + * if this.B(0) >= 0: +*/ + (__pyx_v_ids[1]) = this->S(0); + + /* "spacy/pipeline/_parser_internals/_state.pxd":70 + * else: + * ids[0] = -1 + * elif n == 2: # <<<<<<<<<<<<<< + * ids[0] = this.B(0) + * ids[1] = this.S(0) +*/ + break; + case 3: + + /* "spacy/pipeline/_parser_internals/_state.pxd":74 + * ids[1] = this.S(0) + * elif n == 3: + * if this.B(0) >= 0: # <<<<<<<<<<<<<< + * ids[0] = this.B(0) + * else: +*/ + __pyx_t_1 = (this->B(0) >= 0); + if (__pyx_t_1) { + + /* "spacy/pipeline/_parser_internals/_state.pxd":75 + * elif n == 3: + * if this.B(0) >= 0: + * ids[0] = this.B(0) # <<<<<<<<<<<<<< + * else: + * ids[0] = -1 +*/ + (__pyx_v_ids[0]) = this->B(0); + + /* "spacy/pipeline/_parser_internals/_state.pxd":74 + * ids[1] = this.S(0) + * elif n == 3: + * if this.B(0) >= 0: # <<<<<<<<<<<<<< + * ids[0] = this.B(0) + * else: +*/ + goto __pyx_L4; + } + + /* "spacy/pipeline/_parser_internals/_state.pxd":77 + * ids[0] = this.B(0) + * else: + * ids[0] = -1 # <<<<<<<<<<<<<< + * # First word of entity, if any + * if this.entity_is_open(): +*/ + /*else*/ { + (__pyx_v_ids[0]) = -1; + } + __pyx_L4:; + + /* "spacy/pipeline/_parser_internals/_state.pxd":79 + * ids[0] = -1 + * # First word of entity, if any + * if this.entity_is_open(): # <<<<<<<<<<<<<< + * ids[1] = this.E(0) + * else: +*/ + __pyx_t_1 = this->entity_is_open(); + if (__pyx_t_1) { + + /* "spacy/pipeline/_parser_internals/_state.pxd":80 + * # First word of entity, if any + * if this.entity_is_open(): + * ids[1] = this.E(0) # <<<<<<<<<<<<<< + * else: + * ids[1] = -1 +*/ + (__pyx_v_ids[1]) = this->E(0); + + /* "spacy/pipeline/_parser_internals/_state.pxd":79 + * ids[0] = -1 + * # First word of entity, if any + * if this.entity_is_open(): # <<<<<<<<<<<<<< + * ids[1] = this.E(0) + * else: +*/ + goto __pyx_L5; + } + + /* "spacy/pipeline/_parser_internals/_state.pxd":82 + * ids[1] = this.E(0) + * else: + * ids[1] = -1 # <<<<<<<<<<<<<< + * # Last word of entity, if within entity + * if ids[0] == -1 or ids[1] == -1: +*/ + /*else*/ { + (__pyx_v_ids[1]) = -1; + } + __pyx_L5:; + + /* "spacy/pipeline/_parser_internals/_state.pxd":84 + * ids[1] = -1 + * # Last word of entity, if within entity + * if ids[0] == -1 or ids[1] == -1: # <<<<<<<<<<<<<< + * ids[2] = -1 + * else: +*/ + __pyx_t_2 = ((__pyx_v_ids[0]) == -1L); + if (!__pyx_t_2) { + } else { + __pyx_t_1 = __pyx_t_2; + goto __pyx_L7_bool_binop_done; + } + __pyx_t_2 = ((__pyx_v_ids[1]) == -1L); + __pyx_t_1 = __pyx_t_2; + __pyx_L7_bool_binop_done:; + if (__pyx_t_1) { + + /* "spacy/pipeline/_parser_internals/_state.pxd":85 + * # Last word of entity, if within entity + * if ids[0] == -1 or ids[1] == -1: + * ids[2] = -1 # <<<<<<<<<<<<<< + * else: + * ids[2] = ids[0] - 1 +*/ + (__pyx_v_ids[2]) = -1; + + /* "spacy/pipeline/_parser_internals/_state.pxd":84 + * ids[1] = -1 + * # Last word of entity, if within entity + * if ids[0] == -1 or ids[1] == -1: # <<<<<<<<<<<<<< + * ids[2] = -1 + * else: +*/ + goto __pyx_L6; + } + + /* "spacy/pipeline/_parser_internals/_state.pxd":87 + * ids[2] = -1 + * else: + * ids[2] = ids[0] - 1 # <<<<<<<<<<<<<< + * elif n == 8: + * ids[0] = this.B(0) +*/ + /*else*/ { + (__pyx_v_ids[2]) = ((__pyx_v_ids[0]) - 1); + } + __pyx_L6:; + + /* "spacy/pipeline/_parser_internals/_state.pxd":73 + * ids[0] = this.B(0) + * ids[1] = this.S(0) + * elif n == 3: # <<<<<<<<<<<<<< + * if this.B(0) >= 0: + * ids[0] = this.B(0) +*/ + break; + case 8: + + /* "spacy/pipeline/_parser_internals/_state.pxd":89 + * ids[2] = ids[0] - 1 + * elif n == 8: + * ids[0] = this.B(0) # <<<<<<<<<<<<<< + * ids[1] = this.B(1) + * ids[2] = this.S(0) +*/ + (__pyx_v_ids[0]) = this->B(0); + + /* "spacy/pipeline/_parser_internals/_state.pxd":90 + * elif n == 8: + * ids[0] = this.B(0) + * ids[1] = this.B(1) # <<<<<<<<<<<<<< + * ids[2] = this.S(0) + * ids[3] = this.S(1) +*/ + (__pyx_v_ids[1]) = this->B(1); + + /* "spacy/pipeline/_parser_internals/_state.pxd":91 + * ids[0] = this.B(0) + * ids[1] = this.B(1) + * ids[2] = this.S(0) # <<<<<<<<<<<<<< + * ids[3] = this.S(1) + * ids[4] = this.S(2) +*/ + (__pyx_v_ids[2]) = this->S(0); + + /* "spacy/pipeline/_parser_internals/_state.pxd":92 + * ids[1] = this.B(1) + * ids[2] = this.S(0) + * ids[3] = this.S(1) # <<<<<<<<<<<<<< + * ids[4] = this.S(2) + * ids[5] = this.L(this.B(0), 1) +*/ + (__pyx_v_ids[3]) = this->S(1); + + /* "spacy/pipeline/_parser_internals/_state.pxd":93 + * ids[2] = this.S(0) + * ids[3] = this.S(1) + * ids[4] = this.S(2) # <<<<<<<<<<<<<< + * ids[5] = this.L(this.B(0), 1) + * ids[6] = this.L(this.S(0), 1) +*/ + (__pyx_v_ids[4]) = this->S(2); + + /* "spacy/pipeline/_parser_internals/_state.pxd":94 + * ids[3] = this.S(1) + * ids[4] = this.S(2) + * ids[5] = this.L(this.B(0), 1) # <<<<<<<<<<<<<< + * ids[6] = this.L(this.S(0), 1) + * ids[7] = this.R(this.S(0), 1) +*/ + (__pyx_v_ids[5]) = this->L(this->B(0), 1); + + /* "spacy/pipeline/_parser_internals/_state.pxd":95 + * ids[4] = this.S(2) + * ids[5] = this.L(this.B(0), 1) + * ids[6] = this.L(this.S(0), 1) # <<<<<<<<<<<<<< + * ids[7] = this.R(this.S(0), 1) + * elif n == 13: +*/ + (__pyx_v_ids[6]) = this->L(this->S(0), 1); + + /* "spacy/pipeline/_parser_internals/_state.pxd":96 + * ids[5] = this.L(this.B(0), 1) + * ids[6] = this.L(this.S(0), 1) + * ids[7] = this.R(this.S(0), 1) # <<<<<<<<<<<<<< + * elif n == 13: + * ids[0] = this.B(0) +*/ + (__pyx_v_ids[7]) = this->R(this->S(0), 1); + + /* "spacy/pipeline/_parser_internals/_state.pxd":88 + * else: + * ids[2] = ids[0] - 1 + * elif n == 8: # <<<<<<<<<<<<<< + * ids[0] = this.B(0) + * ids[1] = this.B(1) +*/ + break; + case 13: + + /* "spacy/pipeline/_parser_internals/_state.pxd":98 + * ids[7] = this.R(this.S(0), 1) + * elif n == 13: + * ids[0] = this.B(0) # <<<<<<<<<<<<<< + * ids[1] = this.B(1) + * ids[2] = this.S(0) +*/ + (__pyx_v_ids[0]) = this->B(0); + + /* "spacy/pipeline/_parser_internals/_state.pxd":99 + * elif n == 13: + * ids[0] = this.B(0) + * ids[1] = this.B(1) # <<<<<<<<<<<<<< + * ids[2] = this.S(0) + * ids[3] = this.S(1) +*/ + (__pyx_v_ids[1]) = this->B(1); + + /* "spacy/pipeline/_parser_internals/_state.pxd":100 + * ids[0] = this.B(0) + * ids[1] = this.B(1) + * ids[2] = this.S(0) # <<<<<<<<<<<<<< + * ids[3] = this.S(1) + * ids[4] = this.S(2) +*/ + (__pyx_v_ids[2]) = this->S(0); + + /* "spacy/pipeline/_parser_internals/_state.pxd":101 + * ids[1] = this.B(1) + * ids[2] = this.S(0) + * ids[3] = this.S(1) # <<<<<<<<<<<<<< + * ids[4] = this.S(2) + * ids[5] = this.L(this.S(0), 1) +*/ + (__pyx_v_ids[3]) = this->S(1); + + /* "spacy/pipeline/_parser_internals/_state.pxd":102 + * ids[2] = this.S(0) + * ids[3] = this.S(1) + * ids[4] = this.S(2) # <<<<<<<<<<<<<< + * ids[5] = this.L(this.S(0), 1) + * ids[6] = this.L(this.S(0), 2) +*/ + (__pyx_v_ids[4]) = this->S(2); + + /* "spacy/pipeline/_parser_internals/_state.pxd":103 + * ids[3] = this.S(1) + * ids[4] = this.S(2) + * ids[5] = this.L(this.S(0), 1) # <<<<<<<<<<<<<< + * ids[6] = this.L(this.S(0), 2) + * ids[6] = this.R(this.S(0), 1) +*/ + (__pyx_v_ids[5]) = this->L(this->S(0), 1); + + /* "spacy/pipeline/_parser_internals/_state.pxd":104 + * ids[4] = this.S(2) + * ids[5] = this.L(this.S(0), 1) + * ids[6] = this.L(this.S(0), 2) # <<<<<<<<<<<<<< + * ids[6] = this.R(this.S(0), 1) + * ids[7] = this.L(this.B(0), 1) +*/ + (__pyx_v_ids[6]) = this->L(this->S(0), 2); + + /* "spacy/pipeline/_parser_internals/_state.pxd":105 + * ids[5] = this.L(this.S(0), 1) + * ids[6] = this.L(this.S(0), 2) + * ids[6] = this.R(this.S(0), 1) # <<<<<<<<<<<<<< + * ids[7] = this.L(this.B(0), 1) + * ids[8] = this.R(this.S(0), 2) +*/ + (__pyx_v_ids[6]) = this->R(this->S(0), 1); + + /* "spacy/pipeline/_parser_internals/_state.pxd":106 + * ids[6] = this.L(this.S(0), 2) + * ids[6] = this.R(this.S(0), 1) + * ids[7] = this.L(this.B(0), 1) # <<<<<<<<<<<<<< + * ids[8] = this.R(this.S(0), 2) + * ids[9] = this.L(this.S(1), 1) +*/ + (__pyx_v_ids[7]) = this->L(this->B(0), 1); + + /* "spacy/pipeline/_parser_internals/_state.pxd":107 + * ids[6] = this.R(this.S(0), 1) + * ids[7] = this.L(this.B(0), 1) + * ids[8] = this.R(this.S(0), 2) # <<<<<<<<<<<<<< + * ids[9] = this.L(this.S(1), 1) + * ids[10] = this.L(this.S(1), 2) +*/ + (__pyx_v_ids[8]) = this->R(this->S(0), 2); + + /* "spacy/pipeline/_parser_internals/_state.pxd":108 + * ids[7] = this.L(this.B(0), 1) + * ids[8] = this.R(this.S(0), 2) + * ids[9] = this.L(this.S(1), 1) # <<<<<<<<<<<<<< + * ids[10] = this.L(this.S(1), 2) + * ids[11] = this.R(this.S(1), 1) +*/ + (__pyx_v_ids[9]) = this->L(this->S(1), 1); + + /* "spacy/pipeline/_parser_internals/_state.pxd":109 + * ids[8] = this.R(this.S(0), 2) + * ids[9] = this.L(this.S(1), 1) + * ids[10] = this.L(this.S(1), 2) # <<<<<<<<<<<<<< + * ids[11] = this.R(this.S(1), 1) + * ids[12] = this.R(this.S(1), 2) +*/ + (__pyx_v_ids[10]) = this->L(this->S(1), 2); + + /* "spacy/pipeline/_parser_internals/_state.pxd":110 + * ids[9] = this.L(this.S(1), 1) + * ids[10] = this.L(this.S(1), 2) + * ids[11] = this.R(this.S(1), 1) # <<<<<<<<<<<<<< + * ids[12] = this.R(this.S(1), 2) + * elif n == 6: +*/ + (__pyx_v_ids[11]) = this->R(this->S(1), 1); + + /* "spacy/pipeline/_parser_internals/_state.pxd":111 + * ids[10] = this.L(this.S(1), 2) + * ids[11] = this.R(this.S(1), 1) + * ids[12] = this.R(this.S(1), 2) # <<<<<<<<<<<<<< + * elif n == 6: + * for i in range(6): +*/ + (__pyx_v_ids[12]) = this->R(this->S(1), 2); + + /* "spacy/pipeline/_parser_internals/_state.pxd":97 + * ids[6] = this.L(this.S(0), 1) + * ids[7] = this.R(this.S(0), 1) + * elif n == 13: # <<<<<<<<<<<<<< + * ids[0] = this.B(0) + * ids[1] = this.B(1) +*/ + break; + case 6: + + /* "spacy/pipeline/_parser_internals/_state.pxd":113 + * ids[12] = this.R(this.S(1), 2) + * elif n == 6: + * for i in range(6): # <<<<<<<<<<<<<< + * ids[i] = -1 + * if this.B(0) >= 0: +*/ + for (__pyx_t_3 = 0; __pyx_t_3 < 6; __pyx_t_3+=1) { + __pyx_v_i = __pyx_t_3; + + /* "spacy/pipeline/_parser_internals/_state.pxd":114 + * elif n == 6: + * for i in range(6): + * ids[i] = -1 # <<<<<<<<<<<<<< + * if this.B(0) >= 0: + * ids[0] = this.B(0) +*/ + (__pyx_v_ids[__pyx_v_i]) = -1; + } + + /* "spacy/pipeline/_parser_internals/_state.pxd":115 + * for i in range(6): + * ids[i] = -1 + * if this.B(0) >= 0: # <<<<<<<<<<<<<< + * ids[0] = this.B(0) + * if this.entity_is_open(): +*/ + __pyx_t_1 = (this->B(0) >= 0); + if (__pyx_t_1) { + + /* "spacy/pipeline/_parser_internals/_state.pxd":116 + * ids[i] = -1 + * if this.B(0) >= 0: + * ids[0] = this.B(0) # <<<<<<<<<<<<<< + * if this.entity_is_open(): + * ent = this.get_ent() +*/ + (__pyx_v_ids[0]) = this->B(0); + + /* "spacy/pipeline/_parser_internals/_state.pxd":115 + * for i in range(6): + * ids[i] = -1 + * if this.B(0) >= 0: # <<<<<<<<<<<<<< + * ids[0] = this.B(0) + * if this.entity_is_open(): +*/ + } + + /* "spacy/pipeline/_parser_internals/_state.pxd":117 + * if this.B(0) >= 0: + * ids[0] = this.B(0) + * if this.entity_is_open(): # <<<<<<<<<<<<<< + * ent = this.get_ent() + * j = 1 +*/ + __pyx_t_1 = this->entity_is_open(); + if (__pyx_t_1) { + + /* "spacy/pipeline/_parser_internals/_state.pxd":118 + * ids[0] = this.B(0) + * if this.entity_is_open(): + * ent = this.get_ent() # <<<<<<<<<<<<<< + * j = 1 + * for i in range(ent.start, this.B(0)): +*/ + __pyx_v_ent = this->get_ent(); + + /* "spacy/pipeline/_parser_internals/_state.pxd":119 + * if this.entity_is_open(): + * ent = this.get_ent() + * j = 1 # <<<<<<<<<<<<<< + * for i in range(ent.start, this.B(0)): + * ids[j] = i +*/ + __pyx_v_j = 1; + + /* "spacy/pipeline/_parser_internals/_state.pxd":120 + * ent = this.get_ent() + * j = 1 + * for i in range(ent.start, this.B(0)): # <<<<<<<<<<<<<< + * ids[j] = i + * j += 1 +*/ + __pyx_t_3 = this->B(0); + __pyx_t_4 = __pyx_t_3; + for (__pyx_t_5 = __pyx_v_ent.start; __pyx_t_5 < __pyx_t_4; __pyx_t_5+=1) { + __pyx_v_i = __pyx_t_5; + + /* "spacy/pipeline/_parser_internals/_state.pxd":121 + * j = 1 + * for i in range(ent.start, this.B(0)): + * ids[j] = i # <<<<<<<<<<<<<< + * j += 1 + * if j >= 6: +*/ + (__pyx_v_ids[__pyx_v_j]) = __pyx_v_i; + + /* "spacy/pipeline/_parser_internals/_state.pxd":122 + * for i in range(ent.start, this.B(0)): + * ids[j] = i + * j += 1 # <<<<<<<<<<<<<< + * if j >= 6: + * break +*/ + __pyx_v_j = (__pyx_v_j + 1); + + /* "spacy/pipeline/_parser_internals/_state.pxd":123 + * ids[j] = i + * j += 1 + * if j >= 6: # <<<<<<<<<<<<<< + * break + * else: +*/ + __pyx_t_1 = (__pyx_v_j >= 6); + if (__pyx_t_1) { + + /* "spacy/pipeline/_parser_internals/_state.pxd":124 + * j += 1 + * if j >= 6: + * break # <<<<<<<<<<<<<< + * else: + * # TODO error =/ +*/ + goto __pyx_L14_break; + + /* "spacy/pipeline/_parser_internals/_state.pxd":123 + * ids[j] = i + * j += 1 + * if j >= 6: # <<<<<<<<<<<<<< + * break + * else: +*/ + } + } + __pyx_L14_break:; + + /* "spacy/pipeline/_parser_internals/_state.pxd":117 + * if this.B(0) >= 0: + * ids[0] = this.B(0) + * if this.entity_is_open(): # <<<<<<<<<<<<<< + * ent = this.get_ent() + * j = 1 +*/ + } + + /* "spacy/pipeline/_parser_internals/_state.pxd":112 + * ids[11] = this.R(this.S(1), 1) + * ids[12] = this.R(this.S(1), 2) + * elif n == 6: # <<<<<<<<<<<<<< + * for i in range(6): + * ids[i] = -1 +*/ + break; + default: + break; + } + + /* "spacy/pipeline/_parser_internals/_state.pxd":128 + * # TODO error =/ + * pass + * for i in range(n): # <<<<<<<<<<<<<< + * if ids[i] >= 0: + * ids[i] += this.offset +*/ + __pyx_t_3 = __pyx_v_n; + __pyx_t_4 = __pyx_t_3; + for (__pyx_t_5 = 0; __pyx_t_5 < __pyx_t_4; __pyx_t_5+=1) { + __pyx_v_i = __pyx_t_5; + + /* "spacy/pipeline/_parser_internals/_state.pxd":129 + * pass + * for i in range(n): + * if ids[i] >= 0: # <<<<<<<<<<<<<< + * ids[i] += this.offset + * else: +*/ + __pyx_t_1 = ((__pyx_v_ids[__pyx_v_i]) >= 0); + if (__pyx_t_1) { + + /* "spacy/pipeline/_parser_internals/_state.pxd":130 + * for i in range(n): + * if ids[i] >= 0: + * ids[i] += this.offset # <<<<<<<<<<<<<< + * else: + * ids[i] = -1 +*/ + __pyx_t_6 = __pyx_v_i; + (__pyx_v_ids[__pyx_t_6]) = ((__pyx_v_ids[__pyx_t_6]) + this->offset); + + /* "spacy/pipeline/_parser_internals/_state.pxd":129 + * pass + * for i in range(n): + * if ids[i] >= 0: # <<<<<<<<<<<<<< + * ids[i] += this.offset + * else: +*/ + goto __pyx_L18; + } + + /* "spacy/pipeline/_parser_internals/_state.pxd":132 + * ids[i] += this.offset + * else: + * ids[i] = -1 # <<<<<<<<<<<<<< + * + * inline int S(int i) noexcept nogil const: +*/ + /*else*/ { + (__pyx_v_ids[__pyx_v_i]) = -1; + } + __pyx_L18:; + } + + /* "spacy/pipeline/_parser_internals/_state.pxd":63 + * free(this._heads) + * + * inline void set_context_tokens(int* ids, int n) noexcept nogil: # <<<<<<<<<<<<<< + * cdef int i, j + * if n == 1: +*/ + + /* function exit code */ +} + +/* "spacy/pipeline/_parser_internals/_state.pxd":134 + * ids[i] = -1 + * + * inline int S(int i) noexcept nogil const: # <<<<<<<<<<<<<< + * if i >= this._stack.size(): + * return -1 +*/ + +int __pyx_t_5spacy_8pipeline_17_parser_internals_6_state_StateC::S(int __pyx_v_i) const { + int __pyx_r; + int __pyx_t_1; + __Pyx_FakeReference __pyx_t_2; + int __pyx_lineno = 0; + const char *__pyx_filename = NULL; + int __pyx_clineno = 0; + PyGILState_STATE __pyx_gilstate_save; + + /* "spacy/pipeline/_parser_internals/_state.pxd":135 + * + * inline int S(int i) noexcept nogil const: + * if i >= this._stack.size(): # <<<<<<<<<<<<<< + * return -1 + * elif i < 0: +*/ + __pyx_t_1 = (__pyx_v_i >= this->_stack.size()); + if (__pyx_t_1) { + + /* "spacy/pipeline/_parser_internals/_state.pxd":136 + * inline int S(int i) noexcept nogil const: + * if i >= this._stack.size(): + * return -1 # <<<<<<<<<<<<<< + * elif i < 0: + * return -1 +*/ + __pyx_r = -1; + goto __pyx_L0; + + /* "spacy/pipeline/_parser_internals/_state.pxd":135 + * + * inline int S(int i) noexcept nogil const: + * if i >= this._stack.size(): # <<<<<<<<<<<<<< + * return -1 + * elif i < 0: +*/ + } + + /* "spacy/pipeline/_parser_internals/_state.pxd":137 + * if i >= this._stack.size(): + * return -1 + * elif i < 0: # <<<<<<<<<<<<<< + * return -1 + * return this._stack.at(this._stack.size() - (i+1)) +*/ + __pyx_t_1 = (__pyx_v_i < 0); + if (__pyx_t_1) { + + /* "spacy/pipeline/_parser_internals/_state.pxd":138 + * return -1 + * elif i < 0: + * return -1 # <<<<<<<<<<<<<< + * return this._stack.at(this._stack.size() - (i+1)) + * +*/ + __pyx_r = -1; + goto __pyx_L0; + + /* "spacy/pipeline/_parser_internals/_state.pxd":137 + * if i >= this._stack.size(): + * return -1 + * elif i < 0: # <<<<<<<<<<<<<< + * return -1 + * return this._stack.at(this._stack.size() - (i+1)) +*/ + } + + /* "spacy/pipeline/_parser_internals/_state.pxd":139 + * elif i < 0: + * return -1 + * return this._stack.at(this._stack.size() - (i+1)) # <<<<<<<<<<<<<< + * + * inline int B(int i) noexcept nogil const: +*/ + try { + __pyx_t_2 = this->_stack.at((this->_stack.size() - (__pyx_v_i + 1))); + } catch(...) { + PyGILState_STATE __pyx_gilstate_save = __Pyx_PyGILState_Ensure(); + __Pyx_CppExn2PyErr(); + __Pyx_PyGILState_Release(__pyx_gilstate_save); + __PYX_ERR(3, 139, __pyx_L1_error) + } + __pyx_r = __pyx_t_2; + goto __pyx_L0; + + /* "spacy/pipeline/_parser_internals/_state.pxd":134 + * ids[i] = -1 + * + * inline int S(int i) noexcept nogil const: # <<<<<<<<<<<<<< + * if i >= this._stack.size(): + * return -1 +*/ + + /* function exit code */ + __pyx_L1_error:; + __pyx_gilstate_save = __Pyx_PyGILState_Ensure(); + __Pyx_WriteUnraisable("StateC.S", __pyx_clineno, __pyx_lineno, __pyx_filename, 1, 0); + __pyx_r = 0; + __Pyx_PyGILState_Release(__pyx_gilstate_save); + __pyx_L0:; + return __pyx_r; +} + +/* "spacy/pipeline/_parser_internals/_state.pxd":141 + * return this._stack.at(this._stack.size() - (i+1)) + * + * inline int B(int i) noexcept nogil const: # <<<<<<<<<<<<<< + * if i < 0: + * return -1 +*/ + +int __pyx_t_5spacy_8pipeline_17_parser_internals_6_state_StateC::B(int __pyx_v_i) const { + std::vector ::size_type __pyx_v_b_i; + int __pyx_r; + int __pyx_t_1; + __Pyx_FakeReference __pyx_t_2; + int __pyx_lineno = 0; + const char *__pyx_filename = NULL; + int __pyx_clineno = 0; + PyGILState_STATE __pyx_gilstate_save; + + /* "spacy/pipeline/_parser_internals/_state.pxd":142 + * + * inline int B(int i) noexcept nogil const: + * if i < 0: # <<<<<<<<<<<<<< + * return -1 + * elif i < this._rebuffer.size(): +*/ + __pyx_t_1 = (__pyx_v_i < 0); + if (__pyx_t_1) { + + /* "spacy/pipeline/_parser_internals/_state.pxd":143 + * inline int B(int i) noexcept nogil const: + * if i < 0: + * return -1 # <<<<<<<<<<<<<< + * elif i < this._rebuffer.size(): + * return this._rebuffer.at(this._rebuffer.size() - (i+1)) +*/ + __pyx_r = -1; + goto __pyx_L0; + + /* "spacy/pipeline/_parser_internals/_state.pxd":142 + * + * inline int B(int i) noexcept nogil const: + * if i < 0: # <<<<<<<<<<<<<< + * return -1 + * elif i < this._rebuffer.size(): +*/ + } + + /* "spacy/pipeline/_parser_internals/_state.pxd":144 + * if i < 0: + * return -1 + * elif i < this._rebuffer.size(): # <<<<<<<<<<<<<< + * return this._rebuffer.at(this._rebuffer.size() - (i+1)) + * else: +*/ + __pyx_t_1 = (__pyx_v_i < this->_rebuffer.size()); + if (__pyx_t_1) { + + /* "spacy/pipeline/_parser_internals/_state.pxd":145 + * return -1 + * elif i < this._rebuffer.size(): + * return this._rebuffer.at(this._rebuffer.size() - (i+1)) # <<<<<<<<<<<<<< + * else: + * b_i = this._b_i + (i - this._rebuffer.size()) +*/ + try { + __pyx_t_2 = this->_rebuffer.at((this->_rebuffer.size() - (__pyx_v_i + 1))); + } catch(...) { + PyGILState_STATE __pyx_gilstate_save = __Pyx_PyGILState_Ensure(); + __Pyx_CppExn2PyErr(); + __Pyx_PyGILState_Release(__pyx_gilstate_save); + __PYX_ERR(3, 145, __pyx_L1_error) + } + __pyx_r = __pyx_t_2; + goto __pyx_L0; + + /* "spacy/pipeline/_parser_internals/_state.pxd":144 + * if i < 0: + * return -1 + * elif i < this._rebuffer.size(): # <<<<<<<<<<<<<< + * return this._rebuffer.at(this._rebuffer.size() - (i+1)) + * else: +*/ + } + + /* "spacy/pipeline/_parser_internals/_state.pxd":147 + * return this._rebuffer.at(this._rebuffer.size() - (i+1)) + * else: + * b_i = this._b_i + (i - this._rebuffer.size()) # <<<<<<<<<<<<<< + * if b_i >= this.length: + * return -1 +*/ + /*else*/ { + __pyx_v_b_i = (this->_b_i + (__pyx_v_i - this->_rebuffer.size())); + + /* "spacy/pipeline/_parser_internals/_state.pxd":148 + * else: + * b_i = this._b_i + (i - this._rebuffer.size()) + * if b_i >= this.length: # <<<<<<<<<<<<<< + * return -1 + * else: +*/ + __pyx_t_1 = (__pyx_v_b_i >= this->length); + if (__pyx_t_1) { + + /* "spacy/pipeline/_parser_internals/_state.pxd":149 + * b_i = this._b_i + (i - this._rebuffer.size()) + * if b_i >= this.length: + * return -1 # <<<<<<<<<<<<<< + * else: + * return b_i +*/ + __pyx_r = -1; + goto __pyx_L0; + + /* "spacy/pipeline/_parser_internals/_state.pxd":148 + * else: + * b_i = this._b_i + (i - this._rebuffer.size()) + * if b_i >= this.length: # <<<<<<<<<<<<<< + * return -1 + * else: +*/ + } + + /* "spacy/pipeline/_parser_internals/_state.pxd":151 + * return -1 + * else: + * return b_i # <<<<<<<<<<<<<< + * + * inline const TokenC* B_(int i) noexcept nogil const: +*/ + /*else*/ { + __pyx_r = __pyx_v_b_i; + goto __pyx_L0; + } + } + + /* "spacy/pipeline/_parser_internals/_state.pxd":141 + * return this._stack.at(this._stack.size() - (i+1)) + * + * inline int B(int i) noexcept nogil const: # <<<<<<<<<<<<<< + * if i < 0: + * return -1 +*/ + + /* function exit code */ + __pyx_L1_error:; + __pyx_gilstate_save = __Pyx_PyGILState_Ensure(); + __Pyx_WriteUnraisable("StateC.B", __pyx_clineno, __pyx_lineno, __pyx_filename, 1, 0); + __pyx_r = 0; + __Pyx_PyGILState_Release(__pyx_gilstate_save); + __pyx_L0:; + return __pyx_r; +} + +/* "spacy/pipeline/_parser_internals/_state.pxd":153 + * return b_i + * + * inline const TokenC* B_(int i) noexcept nogil const: # <<<<<<<<<<<<<< + * return this.safe_get(this.B(i)) + * +*/ + +struct __pyx_t_5spacy_7structs_TokenC const *__pyx_t_5spacy_8pipeline_17_parser_internals_6_state_StateC::B_(int __pyx_v_i) const { + struct __pyx_t_5spacy_7structs_TokenC const *__pyx_r; + + /* "spacy/pipeline/_parser_internals/_state.pxd":154 + * + * inline const TokenC* B_(int i) noexcept nogil const: + * return this.safe_get(this.B(i)) # <<<<<<<<<<<<<< + * + * inline const TokenC* E_(int i) noexcept nogil const: +*/ + __pyx_r = this->safe_get(this->B(__pyx_v_i)); + goto __pyx_L0; + + /* "spacy/pipeline/_parser_internals/_state.pxd":153 + * return b_i + * + * inline const TokenC* B_(int i) noexcept nogil const: # <<<<<<<<<<<<<< + * return this.safe_get(this.B(i)) + * +*/ + + /* function exit code */ + __pyx_L0:; + return __pyx_r; +} + +/* "spacy/pipeline/_parser_internals/_state.pxd":156 + * return this.safe_get(this.B(i)) + * + * inline const TokenC* E_(int i) noexcept nogil const: # <<<<<<<<<<<<<< + * return this.safe_get(this.E(i)) + * +*/ + +struct __pyx_t_5spacy_7structs_TokenC const *__pyx_t_5spacy_8pipeline_17_parser_internals_6_state_StateC::E_(int __pyx_v_i) const { + struct __pyx_t_5spacy_7structs_TokenC const *__pyx_r; + + /* "spacy/pipeline/_parser_internals/_state.pxd":157 + * + * inline const TokenC* E_(int i) noexcept nogil const: + * return this.safe_get(this.E(i)) # <<<<<<<<<<<<<< + * + * inline const TokenC* safe_get(int i) noexcept nogil const: +*/ + __pyx_r = this->safe_get(this->E(__pyx_v_i)); + goto __pyx_L0; + + /* "spacy/pipeline/_parser_internals/_state.pxd":156 + * return this.safe_get(this.B(i)) + * + * inline const TokenC* E_(int i) noexcept nogil const: # <<<<<<<<<<<<<< + * return this.safe_get(this.E(i)) + * +*/ + + /* function exit code */ + __pyx_L0:; + return __pyx_r; +} + +/* "spacy/pipeline/_parser_internals/_state.pxd":159 + * return this.safe_get(this.E(i)) + * + * inline const TokenC* safe_get(int i) noexcept nogil const: # <<<<<<<<<<<<<< + * if i < 0 or i >= this.length: + * return &this._empty_token +*/ + +struct __pyx_t_5spacy_7structs_TokenC const *__pyx_t_5spacy_8pipeline_17_parser_internals_6_state_StateC::safe_get(int __pyx_v_i) const { + struct __pyx_t_5spacy_7structs_TokenC const *__pyx_r; + int __pyx_t_1; + int __pyx_t_2; + + /* "spacy/pipeline/_parser_internals/_state.pxd":160 + * + * inline const TokenC* safe_get(int i) noexcept nogil const: + * if i < 0 or i >= this.length: # <<<<<<<<<<<<<< + * return &this._empty_token + * else: +*/ + __pyx_t_2 = (__pyx_v_i < 0); + if (!__pyx_t_2) { + } else { + __pyx_t_1 = __pyx_t_2; + goto __pyx_L4_bool_binop_done; + } + __pyx_t_2 = (__pyx_v_i >= this->length); + __pyx_t_1 = __pyx_t_2; + __pyx_L4_bool_binop_done:; + if (__pyx_t_1) { + + /* "spacy/pipeline/_parser_internals/_state.pxd":161 + * inline const TokenC* safe_get(int i) noexcept nogil const: + * if i < 0 or i >= this.length: + * return &this._empty_token # <<<<<<<<<<<<<< + * else: + * return &this._sent[i] +*/ + __pyx_r = (&this->_empty_token); + goto __pyx_L0; + + /* "spacy/pipeline/_parser_internals/_state.pxd":160 + * + * inline const TokenC* safe_get(int i) noexcept nogil const: + * if i < 0 or i >= this.length: # <<<<<<<<<<<<<< + * return &this._empty_token + * else: +*/ + } + + /* "spacy/pipeline/_parser_internals/_state.pxd":163 + * return &this._empty_token + * else: + * return &this._sent[i] # <<<<<<<<<<<<<< + * + * inline void map_get_arcs(const unordered_map[int, vector[ArcC]] &heads_arcs, vector[ArcC]* out) noexcept nogil const: +*/ + /*else*/ { + __pyx_r = (&(this->_sent[__pyx_v_i])); + goto __pyx_L0; + } + + /* "spacy/pipeline/_parser_internals/_state.pxd":159 + * return this.safe_get(this.E(i)) + * + * inline const TokenC* safe_get(int i) noexcept nogil const: # <<<<<<<<<<<<<< + * if i < 0 or i >= this.length: + * return &this._empty_token +*/ + + /* function exit code */ + __pyx_L0:; + return __pyx_r; +} + +/* "spacy/pipeline/_parser_internals/_state.pxd":165 + * return &this._sent[i] + * + * inline void map_get_arcs(const unordered_map[int, vector[ArcC]] &heads_arcs, vector[ArcC]* out) noexcept nogil const: # <<<<<<<<<<<<<< + * cdef const vector[ArcC]* arcs + * head_arcs_it = heads_arcs.const_begin() +*/ + +void __pyx_t_5spacy_8pipeline_17_parser_internals_6_state_StateC::map_get_arcs(std::unordered_map > const &__pyx_v_heads_arcs, std::vector *__pyx_v_out) const { + std::vector const *__pyx_v_arcs; + std::unordered_map > ::const_iterator __pyx_v_head_arcs_it; + std::vector ::const_iterator __pyx_v_arcs_it; + struct __pyx_t_5spacy_8pipeline_17_parser_internals_6_state_ArcC __pyx_v_arc; + int __pyx_t_1; + int __pyx_t_2; + int __pyx_lineno = 0; + const char *__pyx_filename = NULL; + int __pyx_clineno = 0; + PyGILState_STATE __pyx_gilstate_save; + + /* "spacy/pipeline/_parser_internals/_state.pxd":167 + * inline void map_get_arcs(const unordered_map[int, vector[ArcC]] &heads_arcs, vector[ArcC]* out) noexcept nogil const: + * cdef const vector[ArcC]* arcs + * head_arcs_it = heads_arcs.const_begin() # <<<<<<<<<<<<<< + * while head_arcs_it != heads_arcs.const_end(): + * arcs = &deref(head_arcs_it).second +*/ + try { + __pyx_v_head_arcs_it = __pyx_v_heads_arcs.begin(); + } catch(...) { + PyGILState_STATE __pyx_gilstate_save = __Pyx_PyGILState_Ensure(); + __Pyx_CppExn2PyErr(); + __Pyx_PyGILState_Release(__pyx_gilstate_save); + __PYX_ERR(3, 167, __pyx_L1_error) + } + + /* "spacy/pipeline/_parser_internals/_state.pxd":168 + * cdef const vector[ArcC]* arcs + * head_arcs_it = heads_arcs.const_begin() + * while head_arcs_it != heads_arcs.const_end(): # <<<<<<<<<<<<<< + * arcs = &deref(head_arcs_it).second + * arcs_it = arcs.const_begin() +*/ + while (1) { + __pyx_t_1 = (__pyx_v_head_arcs_it != __pyx_v_heads_arcs.end()); + if (!__pyx_t_1) break; + + /* "spacy/pipeline/_parser_internals/_state.pxd":169 + * head_arcs_it = heads_arcs.const_begin() + * while head_arcs_it != heads_arcs.const_end(): + * arcs = &deref(head_arcs_it).second # <<<<<<<<<<<<<< + * arcs_it = arcs.const_begin() + * while arcs_it != arcs.const_end(): +*/ + __pyx_v_arcs = (&(*__pyx_v_head_arcs_it).second); + + /* "spacy/pipeline/_parser_internals/_state.pxd":170 + * while head_arcs_it != heads_arcs.const_end(): + * arcs = &deref(head_arcs_it).second + * arcs_it = arcs.const_begin() # <<<<<<<<<<<<<< + * while arcs_it != arcs.const_end(): + * arc = deref(arcs_it) +*/ + try { + __pyx_v_arcs_it = __pyx_v_arcs->begin(); + } catch(...) { + PyGILState_STATE __pyx_gilstate_save = __Pyx_PyGILState_Ensure(); + __Pyx_CppExn2PyErr(); + __Pyx_PyGILState_Release(__pyx_gilstate_save); + __PYX_ERR(3, 170, __pyx_L1_error) + } + + /* "spacy/pipeline/_parser_internals/_state.pxd":171 + * arcs = &deref(head_arcs_it).second + * arcs_it = arcs.const_begin() + * while arcs_it != arcs.const_end(): # <<<<<<<<<<<<<< + * arc = deref(arcs_it) + * if arc.head != -1 and arc.child != -1: +*/ + while (1) { + __pyx_t_1 = (__pyx_v_arcs_it != __pyx_v_arcs->end()); + if (!__pyx_t_1) break; + + /* "spacy/pipeline/_parser_internals/_state.pxd":172 + * arcs_it = arcs.const_begin() + * while arcs_it != arcs.const_end(): + * arc = deref(arcs_it) # <<<<<<<<<<<<<< + * if arc.head != -1 and arc.child != -1: + * out.push_back(arc) +*/ + __pyx_v_arc = (*__pyx_v_arcs_it); + + /* "spacy/pipeline/_parser_internals/_state.pxd":173 + * while arcs_it != arcs.const_end(): + * arc = deref(arcs_it) + * if arc.head != -1 and arc.child != -1: # <<<<<<<<<<<<<< + * out.push_back(arc) + * incr(arcs_it) +*/ + __pyx_t_2 = (__pyx_v_arc.head != -1L); + if (__pyx_t_2) { + } else { + __pyx_t_1 = __pyx_t_2; + goto __pyx_L8_bool_binop_done; + } + __pyx_t_2 = (__pyx_v_arc.child != -1L); + __pyx_t_1 = __pyx_t_2; + __pyx_L8_bool_binop_done:; + if (__pyx_t_1) { + + /* "spacy/pipeline/_parser_internals/_state.pxd":174 + * arc = deref(arcs_it) + * if arc.head != -1 and arc.child != -1: + * out.push_back(arc) # <<<<<<<<<<<<<< + * incr(arcs_it) + * incr(head_arcs_it) +*/ + try { + __pyx_v_out->push_back(__pyx_v_arc); + } catch(...) { + PyGILState_STATE __pyx_gilstate_save = __Pyx_PyGILState_Ensure(); + __Pyx_CppExn2PyErr(); + __Pyx_PyGILState_Release(__pyx_gilstate_save); + __PYX_ERR(3, 174, __pyx_L1_error) + } + + /* "spacy/pipeline/_parser_internals/_state.pxd":173 + * while arcs_it != arcs.const_end(): + * arc = deref(arcs_it) + * if arc.head != -1 and arc.child != -1: # <<<<<<<<<<<<<< + * out.push_back(arc) + * incr(arcs_it) +*/ + } + + /* "spacy/pipeline/_parser_internals/_state.pxd":175 + * if arc.head != -1 and arc.child != -1: + * out.push_back(arc) + * incr(arcs_it) # <<<<<<<<<<<<<< + * incr(head_arcs_it) + * +*/ + (void)((++__pyx_v_arcs_it)); + } + + /* "spacy/pipeline/_parser_internals/_state.pxd":176 + * out.push_back(arc) + * incr(arcs_it) + * incr(head_arcs_it) # <<<<<<<<<<<<<< + * + * inline void get_arcs(vector[ArcC]* out) noexcept nogil const: +*/ + (void)((++__pyx_v_head_arcs_it)); + } + + /* "spacy/pipeline/_parser_internals/_state.pxd":165 + * return &this._sent[i] + * + * inline void map_get_arcs(const unordered_map[int, vector[ArcC]] &heads_arcs, vector[ArcC]* out) noexcept nogil const: # <<<<<<<<<<<<<< + * cdef const vector[ArcC]* arcs + * head_arcs_it = heads_arcs.const_begin() +*/ + + /* function exit code */ + goto __pyx_L0; + __pyx_L1_error:; + __pyx_gilstate_save = __Pyx_PyGILState_Ensure(); + __Pyx_WriteUnraisable("StateC.map_get_arcs", __pyx_clineno, __pyx_lineno, __pyx_filename, 1, 0); + __Pyx_PyGILState_Release(__pyx_gilstate_save); + __pyx_L0:; +} + +/* "spacy/pipeline/_parser_internals/_state.pxd":178 + * incr(head_arcs_it) + * + * inline void get_arcs(vector[ArcC]* out) noexcept nogil const: # <<<<<<<<<<<<<< + * this.map_get_arcs(this._left_arcs, out) + * this.map_get_arcs(this._right_arcs, out) +*/ + +void __pyx_t_5spacy_8pipeline_17_parser_internals_6_state_StateC::get_arcs(std::vector *__pyx_v_out) const { + + /* "spacy/pipeline/_parser_internals/_state.pxd":179 + * + * inline void get_arcs(vector[ArcC]* out) noexcept nogil const: + * this.map_get_arcs(this._left_arcs, out) # <<<<<<<<<<<<<< + * this.map_get_arcs(this._right_arcs, out) + * +*/ + this->map_get_arcs(this->_left_arcs, __pyx_v_out); + + /* "spacy/pipeline/_parser_internals/_state.pxd":180 + * inline void get_arcs(vector[ArcC]* out) noexcept nogil const: + * this.map_get_arcs(this._left_arcs, out) + * this.map_get_arcs(this._right_arcs, out) # <<<<<<<<<<<<<< + * + * inline int H(int child) noexcept nogil const: +*/ + this->map_get_arcs(this->_right_arcs, __pyx_v_out); + + /* "spacy/pipeline/_parser_internals/_state.pxd":178 + * incr(head_arcs_it) + * + * inline void get_arcs(vector[ArcC]* out) noexcept nogil const: # <<<<<<<<<<<<<< + * this.map_get_arcs(this._left_arcs, out) + * this.map_get_arcs(this._right_arcs, out) +*/ + + /* function exit code */ +} + +/* "spacy/pipeline/_parser_internals/_state.pxd":182 + * this.map_get_arcs(this._right_arcs, out) + * + * inline int H(int child) noexcept nogil const: # <<<<<<<<<<<<<< + * if child >= this.length or child < 0: + * return -1 +*/ + +int __pyx_t_5spacy_8pipeline_17_parser_internals_6_state_StateC::H(int __pyx_v_child) const { + int __pyx_r; + int __pyx_t_1; + int __pyx_t_2; + + /* "spacy/pipeline/_parser_internals/_state.pxd":183 + * + * inline int H(int child) noexcept nogil const: + * if child >= this.length or child < 0: # <<<<<<<<<<<<<< + * return -1 + * else: +*/ + __pyx_t_2 = (__pyx_v_child >= this->length); + if (!__pyx_t_2) { + } else { + __pyx_t_1 = __pyx_t_2; + goto __pyx_L4_bool_binop_done; + } + __pyx_t_2 = (__pyx_v_child < 0); + __pyx_t_1 = __pyx_t_2; + __pyx_L4_bool_binop_done:; + if (__pyx_t_1) { + + /* "spacy/pipeline/_parser_internals/_state.pxd":184 + * inline int H(int child) noexcept nogil const: + * if child >= this.length or child < 0: + * return -1 # <<<<<<<<<<<<<< + * else: + * return this._heads[child] +*/ + __pyx_r = -1; + goto __pyx_L0; + + /* "spacy/pipeline/_parser_internals/_state.pxd":183 + * + * inline int H(int child) noexcept nogil const: + * if child >= this.length or child < 0: # <<<<<<<<<<<<<< + * return -1 + * else: +*/ + } + + /* "spacy/pipeline/_parser_internals/_state.pxd":186 + * return -1 + * else: + * return this._heads[child] # <<<<<<<<<<<<<< + * + * inline int E(int i) noexcept nogil const: +*/ + /*else*/ { + __pyx_r = (this->_heads[__pyx_v_child]); + goto __pyx_L0; + } + + /* "spacy/pipeline/_parser_internals/_state.pxd":182 + * this.map_get_arcs(this._right_arcs, out) + * + * inline int H(int child) noexcept nogil const: # <<<<<<<<<<<<<< + * if child >= this.length or child < 0: + * return -1 +*/ + + /* function exit code */ + __pyx_L0:; + return __pyx_r; +} + +/* "spacy/pipeline/_parser_internals/_state.pxd":188 + * return this._heads[child] + * + * inline int E(int i) noexcept nogil const: # <<<<<<<<<<<<<< + * if this._ents.size() == 0: + * return -1 +*/ + +int __pyx_t_5spacy_8pipeline_17_parser_internals_6_state_StateC::E(CYTHON_UNUSED int __pyx_v_i) const { + int __pyx_r; + int __pyx_t_1; + + /* "spacy/pipeline/_parser_internals/_state.pxd":189 + * + * inline int E(int i) noexcept nogil const: + * if this._ents.size() == 0: # <<<<<<<<<<<<<< + * return -1 + * else: +*/ + __pyx_t_1 = (this->_ents.size() == 0); + if (__pyx_t_1) { + + /* "spacy/pipeline/_parser_internals/_state.pxd":190 + * inline int E(int i) noexcept nogil const: + * if this._ents.size() == 0: + * return -1 # <<<<<<<<<<<<<< + * else: + * return this._ents.back().start +*/ + __pyx_r = -1; + goto __pyx_L0; + + /* "spacy/pipeline/_parser_internals/_state.pxd":189 + * + * inline int E(int i) noexcept nogil const: + * if this._ents.size() == 0: # <<<<<<<<<<<<<< + * return -1 + * else: +*/ + } + + /* "spacy/pipeline/_parser_internals/_state.pxd":192 + * return -1 + * else: + * return this._ents.back().start # <<<<<<<<<<<<<< + * + * inline int nth_child(const unordered_map[int, vector[ArcC]]& heads_arcs, int head, int idx) noexcept nogil const: +*/ + /*else*/ { + __pyx_r = this->_ents.back().start; + goto __pyx_L0; + } + + /* "spacy/pipeline/_parser_internals/_state.pxd":188 + * return this._heads[child] + * + * inline int E(int i) noexcept nogil const: # <<<<<<<<<<<<<< + * if this._ents.size() == 0: + * return -1 +*/ + + /* function exit code */ + __pyx_L0:; + return __pyx_r; +} + +/* "spacy/pipeline/_parser_internals/_state.pxd":194 + * return this._ents.back().start + * + * inline int nth_child(const unordered_map[int, vector[ArcC]]& heads_arcs, int head, int idx) noexcept nogil const: # <<<<<<<<<<<<<< + * if idx < 1: + * return -1 +*/ + +int __pyx_t_5spacy_8pipeline_17_parser_internals_6_state_StateC::nth_child(std::unordered_map > const &__pyx_v_heads_arcs, int __pyx_v_head, int __pyx_v_idx) const { + std::unordered_map > ::const_iterator __pyx_v_head_arcs_it; + std::vector const *__pyx_v_arcs; + size_t __pyx_v_child_index; + std::vector ::const_reverse_iterator __pyx_v_arcs_it; + struct __pyx_t_5spacy_8pipeline_17_parser_internals_6_state_ArcC __pyx_v_arc; + int __pyx_r; + int __pyx_t_1; + int __pyx_t_2; + int __pyx_lineno = 0; + const char *__pyx_filename = NULL; + int __pyx_clineno = 0; + PyGILState_STATE __pyx_gilstate_save; + + /* "spacy/pipeline/_parser_internals/_state.pxd":195 + * + * inline int nth_child(const unordered_map[int, vector[ArcC]]& heads_arcs, int head, int idx) noexcept nogil const: + * if idx < 1: # <<<<<<<<<<<<<< + * return -1 + * +*/ + __pyx_t_1 = (__pyx_v_idx < 1); + if (__pyx_t_1) { + + /* "spacy/pipeline/_parser_internals/_state.pxd":196 + * inline int nth_child(const unordered_map[int, vector[ArcC]]& heads_arcs, int head, int idx) noexcept nogil const: + * if idx < 1: + * return -1 # <<<<<<<<<<<<<< + * + * head_arcs_it = heads_arcs.const_find(head) +*/ + __pyx_r = -1; + goto __pyx_L0; + + /* "spacy/pipeline/_parser_internals/_state.pxd":195 + * + * inline int nth_child(const unordered_map[int, vector[ArcC]]& heads_arcs, int head, int idx) noexcept nogil const: + * if idx < 1: # <<<<<<<<<<<<<< + * return -1 + * +*/ + } + + /* "spacy/pipeline/_parser_internals/_state.pxd":198 + * return -1 + * + * head_arcs_it = heads_arcs.const_find(head) # <<<<<<<<<<<<<< + * if head_arcs_it == heads_arcs.const_end(): + * return -1 +*/ + try { + __pyx_v_head_arcs_it = __pyx_v_heads_arcs.find(__pyx_v_head); + } catch(...) { + PyGILState_STATE __pyx_gilstate_save = __Pyx_PyGILState_Ensure(); + __Pyx_CppExn2PyErr(); + __Pyx_PyGILState_Release(__pyx_gilstate_save); + __PYX_ERR(3, 198, __pyx_L1_error) + } + + /* "spacy/pipeline/_parser_internals/_state.pxd":199 + * + * head_arcs_it = heads_arcs.const_find(head) + * if head_arcs_it == heads_arcs.const_end(): # <<<<<<<<<<<<<< + * return -1 + * +*/ + __pyx_t_1 = (__pyx_v_head_arcs_it == __pyx_v_heads_arcs.end()); + if (__pyx_t_1) { + + /* "spacy/pipeline/_parser_internals/_state.pxd":200 + * head_arcs_it = heads_arcs.const_find(head) + * if head_arcs_it == heads_arcs.const_end(): + * return -1 # <<<<<<<<<<<<<< + * + * cdef const vector[ArcC]* arcs = &deref(head_arcs_it).second +*/ + __pyx_r = -1; + goto __pyx_L0; + + /* "spacy/pipeline/_parser_internals/_state.pxd":199 + * + * head_arcs_it = heads_arcs.const_find(head) + * if head_arcs_it == heads_arcs.const_end(): # <<<<<<<<<<<<<< + * return -1 + * +*/ + } + + /* "spacy/pipeline/_parser_internals/_state.pxd":202 + * return -1 + * + * cdef const vector[ArcC]* arcs = &deref(head_arcs_it).second # <<<<<<<<<<<<<< + * + * # Work backwards through arcs to find the arc at the +*/ + __pyx_v_arcs = (&(*__pyx_v_head_arcs_it).second); + + /* "spacy/pipeline/_parser_internals/_state.pxd":206 + * # Work backwards through arcs to find the arc at the + * # requested index more quickly. + * cdef size_t child_index = 0 # <<<<<<<<<<<<<< + * arcs_it = arcs.const_rbegin() + * while arcs_it != arcs.const_rend() and child_index != idx: +*/ + __pyx_v_child_index = 0; + + /* "spacy/pipeline/_parser_internals/_state.pxd":207 + * # requested index more quickly. + * cdef size_t child_index = 0 + * arcs_it = arcs.const_rbegin() # <<<<<<<<<<<<<< + * while arcs_it != arcs.const_rend() and child_index != idx: + * arc = deref(arcs_it) +*/ + try { + __pyx_v_arcs_it = __pyx_v_arcs->rbegin(); + } catch(...) { + PyGILState_STATE __pyx_gilstate_save = __Pyx_PyGILState_Ensure(); + __Pyx_CppExn2PyErr(); + __Pyx_PyGILState_Release(__pyx_gilstate_save); + __PYX_ERR(3, 207, __pyx_L1_error) + } + + /* "spacy/pipeline/_parser_internals/_state.pxd":208 + * cdef size_t child_index = 0 + * arcs_it = arcs.const_rbegin() + * while arcs_it != arcs.const_rend() and child_index != idx: # <<<<<<<<<<<<<< + * arc = deref(arcs_it) + * if arc.child != -1: +*/ + while (1) { + __pyx_t_2 = (__pyx_v_arcs_it != __pyx_v_arcs->rend()); + if (__pyx_t_2) { + } else { + __pyx_t_1 = __pyx_t_2; + goto __pyx_L7_bool_binop_done; + } + __pyx_t_2 = (__pyx_v_child_index != __pyx_v_idx); + __pyx_t_1 = __pyx_t_2; + __pyx_L7_bool_binop_done:; + if (!__pyx_t_1) break; + + /* "spacy/pipeline/_parser_internals/_state.pxd":209 + * arcs_it = arcs.const_rbegin() + * while arcs_it != arcs.const_rend() and child_index != idx: + * arc = deref(arcs_it) # <<<<<<<<<<<<<< + * if arc.child != -1: + * child_index += 1 +*/ + __pyx_v_arc = (*__pyx_v_arcs_it); + + /* "spacy/pipeline/_parser_internals/_state.pxd":210 + * while arcs_it != arcs.const_rend() and child_index != idx: + * arc = deref(arcs_it) + * if arc.child != -1: # <<<<<<<<<<<<<< + * child_index += 1 + * if child_index == idx: +*/ + __pyx_t_1 = (__pyx_v_arc.child != -1L); + if (__pyx_t_1) { + + /* "spacy/pipeline/_parser_internals/_state.pxd":211 + * arc = deref(arcs_it) + * if arc.child != -1: + * child_index += 1 # <<<<<<<<<<<<<< + * if child_index == idx: + * return arc.child +*/ + __pyx_v_child_index = (__pyx_v_child_index + 1); + + /* "spacy/pipeline/_parser_internals/_state.pxd":212 + * if arc.child != -1: + * child_index += 1 + * if child_index == idx: # <<<<<<<<<<<<<< + * return arc.child + * incr(arcs_it) +*/ + __pyx_t_1 = (__pyx_v_child_index == __pyx_v_idx); + if (__pyx_t_1) { + + /* "spacy/pipeline/_parser_internals/_state.pxd":213 + * child_index += 1 + * if child_index == idx: + * return arc.child # <<<<<<<<<<<<<< + * incr(arcs_it) + * +*/ + __pyx_r = __pyx_v_arc.child; + goto __pyx_L0; + + /* "spacy/pipeline/_parser_internals/_state.pxd":212 + * if arc.child != -1: + * child_index += 1 + * if child_index == idx: # <<<<<<<<<<<<<< + * return arc.child + * incr(arcs_it) +*/ + } + + /* "spacy/pipeline/_parser_internals/_state.pxd":210 + * while arcs_it != arcs.const_rend() and child_index != idx: + * arc = deref(arcs_it) + * if arc.child != -1: # <<<<<<<<<<<<<< + * child_index += 1 + * if child_index == idx: +*/ + } + + /* "spacy/pipeline/_parser_internals/_state.pxd":214 + * if child_index == idx: + * return arc.child + * incr(arcs_it) # <<<<<<<<<<<<<< + * + * return -1 +*/ + (void)((++__pyx_v_arcs_it)); + } + + /* "spacy/pipeline/_parser_internals/_state.pxd":216 + * incr(arcs_it) + * + * return -1 # <<<<<<<<<<<<<< + * + * inline int L(int head, int idx) noexcept nogil const: +*/ + __pyx_r = -1; + goto __pyx_L0; + + /* "spacy/pipeline/_parser_internals/_state.pxd":194 + * return this._ents.back().start + * + * inline int nth_child(const unordered_map[int, vector[ArcC]]& heads_arcs, int head, int idx) noexcept nogil const: # <<<<<<<<<<<<<< + * if idx < 1: + * return -1 +*/ + + /* function exit code */ + __pyx_L1_error:; + __pyx_gilstate_save = __Pyx_PyGILState_Ensure(); + __Pyx_WriteUnraisable("StateC.nth_child", __pyx_clineno, __pyx_lineno, __pyx_filename, 1, 0); + __pyx_r = 0; + __Pyx_PyGILState_Release(__pyx_gilstate_save); + __pyx_L0:; + return __pyx_r; +} + +/* "spacy/pipeline/_parser_internals/_state.pxd":218 + * return -1 + * + * inline int L(int head, int idx) noexcept nogil const: # <<<<<<<<<<<<<< + * return this.nth_child(this._left_arcs, head, idx) + * +*/ + +int __pyx_t_5spacy_8pipeline_17_parser_internals_6_state_StateC::L(int __pyx_v_head, int __pyx_v_idx) const { + int __pyx_r; + + /* "spacy/pipeline/_parser_internals/_state.pxd":219 + * + * inline int L(int head, int idx) noexcept nogil const: + * return this.nth_child(this._left_arcs, head, idx) # <<<<<<<<<<<<<< + * + * inline int R(int head, int idx) noexcept nogil const: +*/ + __pyx_r = this->nth_child(this->_left_arcs, __pyx_v_head, __pyx_v_idx); + goto __pyx_L0; + + /* "spacy/pipeline/_parser_internals/_state.pxd":218 + * return -1 + * + * inline int L(int head, int idx) noexcept nogil const: # <<<<<<<<<<<<<< + * return this.nth_child(this._left_arcs, head, idx) + * +*/ + + /* function exit code */ + __pyx_L0:; + return __pyx_r; +} + +/* "spacy/pipeline/_parser_internals/_state.pxd":221 + * return this.nth_child(this._left_arcs, head, idx) + * + * inline int R(int head, int idx) noexcept nogil const: # <<<<<<<<<<<<<< + * return this.nth_child(this._right_arcs, head, idx) + * +*/ + +int __pyx_t_5spacy_8pipeline_17_parser_internals_6_state_StateC::R(int __pyx_v_head, int __pyx_v_idx) const { + int __pyx_r; + + /* "spacy/pipeline/_parser_internals/_state.pxd":222 + * + * inline int R(int head, int idx) noexcept nogil const: + * return this.nth_child(this._right_arcs, head, idx) # <<<<<<<<<<<<<< + * + * inline bint empty() noexcept nogil const: +*/ + __pyx_r = this->nth_child(this->_right_arcs, __pyx_v_head, __pyx_v_idx); + goto __pyx_L0; + + /* "spacy/pipeline/_parser_internals/_state.pxd":221 + * return this.nth_child(this._left_arcs, head, idx) + * + * inline int R(int head, int idx) noexcept nogil const: # <<<<<<<<<<<<<< + * return this.nth_child(this._right_arcs, head, idx) + * +*/ + + /* function exit code */ + __pyx_L0:; + return __pyx_r; +} + +/* "spacy/pipeline/_parser_internals/_state.pxd":224 + * return this.nth_child(this._right_arcs, head, idx) + * + * inline bint empty() noexcept nogil const: # <<<<<<<<<<<<<< + * return this._stack.size() == 0 + * +*/ + +int __pyx_t_5spacy_8pipeline_17_parser_internals_6_state_StateC::empty(void) const { + int __pyx_r; + + /* "spacy/pipeline/_parser_internals/_state.pxd":225 + * + * inline bint empty() noexcept nogil const: + * return this._stack.size() == 0 # <<<<<<<<<<<<<< + * + * inline bint eol() noexcept nogil const: +*/ + __pyx_r = (this->_stack.size() == 0); + goto __pyx_L0; + + /* "spacy/pipeline/_parser_internals/_state.pxd":224 + * return this.nth_child(this._right_arcs, head, idx) + * + * inline bint empty() noexcept nogil const: # <<<<<<<<<<<<<< + * return this._stack.size() == 0 + * +*/ + + /* function exit code */ + __pyx_L0:; + return __pyx_r; +} + +/* "spacy/pipeline/_parser_internals/_state.pxd":227 + * return this._stack.size() == 0 + * + * inline bint eol() noexcept nogil const: # <<<<<<<<<<<<<< + * return this.buffer_length() == 0 + * +*/ + +int __pyx_t_5spacy_8pipeline_17_parser_internals_6_state_StateC::eol(void) const { + int __pyx_r; + + /* "spacy/pipeline/_parser_internals/_state.pxd":228 + * + * inline bint eol() noexcept nogil const: + * return this.buffer_length() == 0 # <<<<<<<<<<<<<< + * + * inline bint is_final() noexcept nogil const: +*/ + __pyx_r = (this->buffer_length() == 0); + goto __pyx_L0; + + /* "spacy/pipeline/_parser_internals/_state.pxd":227 + * return this._stack.size() == 0 + * + * inline bint eol() noexcept nogil const: # <<<<<<<<<<<<<< + * return this.buffer_length() == 0 + * +*/ + + /* function exit code */ + __pyx_L0:; + return __pyx_r; +} + +/* "spacy/pipeline/_parser_internals/_state.pxd":230 + * return this.buffer_length() == 0 + * + * inline bint is_final() noexcept nogil const: # <<<<<<<<<<<<<< + * return this.stack_depth() <= 0 and this.eol() + * +*/ + +int __pyx_t_5spacy_8pipeline_17_parser_internals_6_state_StateC::is_final(void) const { + int __pyx_r; + int __pyx_t_1; + int __pyx_t_2; + + /* "spacy/pipeline/_parser_internals/_state.pxd":231 + * + * inline bint is_final() noexcept nogil const: + * return this.stack_depth() <= 0 and this.eol() # <<<<<<<<<<<<<< + * + * inline int cannot_sent_start(int word) noexcept nogil const: +*/ + __pyx_t_2 = (this->stack_depth() <= 0); + if (__pyx_t_2) { + } else { + __pyx_t_1 = __pyx_t_2; + goto __pyx_L3_bool_binop_done; + } + __pyx_t_2 = this->eol(); + __pyx_t_1 = __pyx_t_2; + __pyx_L3_bool_binop_done:; + __pyx_r = __pyx_t_1; + goto __pyx_L0; + + /* "spacy/pipeline/_parser_internals/_state.pxd":230 + * return this.buffer_length() == 0 + * + * inline bint is_final() noexcept nogil const: # <<<<<<<<<<<<<< + * return this.stack_depth() <= 0 and this.eol() + * +*/ + + /* function exit code */ + __pyx_L0:; + return __pyx_r; +} + +/* "spacy/pipeline/_parser_internals/_state.pxd":233 + * return this.stack_depth() <= 0 and this.eol() + * + * inline int cannot_sent_start(int word) noexcept nogil const: # <<<<<<<<<<<<<< + * if word < 0 or word >= this.length: + * return 0 +*/ + +int __pyx_t_5spacy_8pipeline_17_parser_internals_6_state_StateC::cannot_sent_start(int __pyx_v_word) const { + int __pyx_r; + int __pyx_t_1; + int __pyx_t_2; + + /* "spacy/pipeline/_parser_internals/_state.pxd":234 + * + * inline int cannot_sent_start(int word) noexcept nogil const: + * if word < 0 or word >= this.length: # <<<<<<<<<<<<<< + * return 0 + * elif this._sent[word].sent_start == -1: +*/ + __pyx_t_2 = (__pyx_v_word < 0); + if (!__pyx_t_2) { + } else { + __pyx_t_1 = __pyx_t_2; + goto __pyx_L4_bool_binop_done; + } + __pyx_t_2 = (__pyx_v_word >= this->length); + __pyx_t_1 = __pyx_t_2; + __pyx_L4_bool_binop_done:; + if (__pyx_t_1) { + + /* "spacy/pipeline/_parser_internals/_state.pxd":235 + * inline int cannot_sent_start(int word) noexcept nogil const: + * if word < 0 or word >= this.length: + * return 0 # <<<<<<<<<<<<<< + * elif this._sent[word].sent_start == -1: + * return 1 +*/ + __pyx_r = 0; + goto __pyx_L0; + + /* "spacy/pipeline/_parser_internals/_state.pxd":234 + * + * inline int cannot_sent_start(int word) noexcept nogil const: + * if word < 0 or word >= this.length: # <<<<<<<<<<<<<< + * return 0 + * elif this._sent[word].sent_start == -1: +*/ + } + + /* "spacy/pipeline/_parser_internals/_state.pxd":236 + * if word < 0 or word >= this.length: + * return 0 + * elif this._sent[word].sent_start == -1: # <<<<<<<<<<<<<< + * return 1 + * else: +*/ + __pyx_t_1 = ((this->_sent[__pyx_v_word]).sent_start == -1L); + if (__pyx_t_1) { + + /* "spacy/pipeline/_parser_internals/_state.pxd":237 + * return 0 + * elif this._sent[word].sent_start == -1: + * return 1 # <<<<<<<<<<<<<< + * else: + * return 0 +*/ + __pyx_r = 1; + goto __pyx_L0; + + /* "spacy/pipeline/_parser_internals/_state.pxd":236 + * if word < 0 or word >= this.length: + * return 0 + * elif this._sent[word].sent_start == -1: # <<<<<<<<<<<<<< + * return 1 + * else: +*/ + } + + /* "spacy/pipeline/_parser_internals/_state.pxd":239 + * return 1 + * else: + * return 0 # <<<<<<<<<<<<<< + * + * inline int is_sent_start(int word) noexcept nogil const: +*/ + /*else*/ { + __pyx_r = 0; + goto __pyx_L0; + } + + /* "spacy/pipeline/_parser_internals/_state.pxd":233 + * return this.stack_depth() <= 0 and this.eol() + * + * inline int cannot_sent_start(int word) noexcept nogil const: # <<<<<<<<<<<<<< + * if word < 0 or word >= this.length: + * return 0 +*/ + + /* function exit code */ + __pyx_L0:; + return __pyx_r; +} + +/* "spacy/pipeline/_parser_internals/_state.pxd":241 + * return 0 + * + * inline int is_sent_start(int word) noexcept nogil const: # <<<<<<<<<<<<<< + * if word < 0 or word >= this.length: + * return 0 +*/ + +int __pyx_t_5spacy_8pipeline_17_parser_internals_6_state_StateC::is_sent_start(int __pyx_v_word) const { + int __pyx_r; + int __pyx_t_1; + int __pyx_t_2; + + /* "spacy/pipeline/_parser_internals/_state.pxd":242 + * + * inline int is_sent_start(int word) noexcept nogil const: + * if word < 0 or word >= this.length: # <<<<<<<<<<<<<< + * return 0 + * elif this._sent[word].sent_start == 1: +*/ + __pyx_t_2 = (__pyx_v_word < 0); + if (!__pyx_t_2) { + } else { + __pyx_t_1 = __pyx_t_2; + goto __pyx_L4_bool_binop_done; + } + __pyx_t_2 = (__pyx_v_word >= this->length); + __pyx_t_1 = __pyx_t_2; + __pyx_L4_bool_binop_done:; + if (__pyx_t_1) { + + /* "spacy/pipeline/_parser_internals/_state.pxd":243 + * inline int is_sent_start(int word) noexcept nogil const: + * if word < 0 or word >= this.length: + * return 0 # <<<<<<<<<<<<<< + * elif this._sent[word].sent_start == 1: + * return 1 +*/ + __pyx_r = 0; + goto __pyx_L0; + + /* "spacy/pipeline/_parser_internals/_state.pxd":242 + * + * inline int is_sent_start(int word) noexcept nogil const: + * if word < 0 or word >= this.length: # <<<<<<<<<<<<<< + * return 0 + * elif this._sent[word].sent_start == 1: +*/ + } + + /* "spacy/pipeline/_parser_internals/_state.pxd":244 + * if word < 0 or word >= this.length: + * return 0 + * elif this._sent[word].sent_start == 1: # <<<<<<<<<<<<<< + * return 1 + * elif this._sent_starts.count(word) >= 1: +*/ + __pyx_t_1 = ((this->_sent[__pyx_v_word]).sent_start == 1); + if (__pyx_t_1) { + + /* "spacy/pipeline/_parser_internals/_state.pxd":245 + * return 0 + * elif this._sent[word].sent_start == 1: + * return 1 # <<<<<<<<<<<<<< + * elif this._sent_starts.count(word) >= 1: + * return 1 +*/ + __pyx_r = 1; + goto __pyx_L0; + + /* "spacy/pipeline/_parser_internals/_state.pxd":244 + * if word < 0 or word >= this.length: + * return 0 + * elif this._sent[word].sent_start == 1: # <<<<<<<<<<<<<< + * return 1 + * elif this._sent_starts.count(word) >= 1: +*/ + } + + /* "spacy/pipeline/_parser_internals/_state.pxd":246 + * elif this._sent[word].sent_start == 1: + * return 1 + * elif this._sent_starts.count(word) >= 1: # <<<<<<<<<<<<<< + * return 1 + * else: +*/ + __pyx_t_1 = (this->_sent_starts.count(__pyx_v_word) >= 1); + if (__pyx_t_1) { + + /* "spacy/pipeline/_parser_internals/_state.pxd":247 + * return 1 + * elif this._sent_starts.count(word) >= 1: + * return 1 # <<<<<<<<<<<<<< + * else: + * return 0 +*/ + __pyx_r = 1; + goto __pyx_L0; + + /* "spacy/pipeline/_parser_internals/_state.pxd":246 + * elif this._sent[word].sent_start == 1: + * return 1 + * elif this._sent_starts.count(word) >= 1: # <<<<<<<<<<<<<< + * return 1 + * else: +*/ + } + + /* "spacy/pipeline/_parser_internals/_state.pxd":249 + * return 1 + * else: + * return 0 # <<<<<<<<<<<<<< + * + * inline void set_sent_start(int word, int value) noexcept nogil: +*/ + /*else*/ { + __pyx_r = 0; + goto __pyx_L0; + } + + /* "spacy/pipeline/_parser_internals/_state.pxd":241 + * return 0 + * + * inline int is_sent_start(int word) noexcept nogil const: # <<<<<<<<<<<<<< + * if word < 0 or word >= this.length: + * return 0 +*/ + + /* function exit code */ + __pyx_L0:; + return __pyx_r; +} + +/* "spacy/pipeline/_parser_internals/_state.pxd":251 + * return 0 + * + * inline void set_sent_start(int word, int value) noexcept nogil: # <<<<<<<<<<<<<< + * if value >= 1: + * this._sent_starts.insert(word) +*/ + +void __pyx_t_5spacy_8pipeline_17_parser_internals_6_state_StateC::set_sent_start(int __pyx_v_word, int __pyx_v_value) { + int __pyx_t_1; + int __pyx_lineno = 0; + const char *__pyx_filename = NULL; + int __pyx_clineno = 0; + PyGILState_STATE __pyx_gilstate_save; + + /* "spacy/pipeline/_parser_internals/_state.pxd":252 + * + * inline void set_sent_start(int word, int value) noexcept nogil: + * if value >= 1: # <<<<<<<<<<<<<< + * this._sent_starts.insert(word) + * +*/ + __pyx_t_1 = (__pyx_v_value >= 1); + if (__pyx_t_1) { + + /* "spacy/pipeline/_parser_internals/_state.pxd":253 + * inline void set_sent_start(int word, int value) noexcept nogil: + * if value >= 1: + * this._sent_starts.insert(word) # <<<<<<<<<<<<<< + * + * inline bint has_head(int child) noexcept nogil const: +*/ + try { + this->_sent_starts.insert(__pyx_v_word); + } catch(...) { + PyGILState_STATE __pyx_gilstate_save = __Pyx_PyGILState_Ensure(); + __Pyx_CppExn2PyErr(); + __Pyx_PyGILState_Release(__pyx_gilstate_save); + __PYX_ERR(3, 253, __pyx_L1_error) + } + + /* "spacy/pipeline/_parser_internals/_state.pxd":252 + * + * inline void set_sent_start(int word, int value) noexcept nogil: + * if value >= 1: # <<<<<<<<<<<<<< + * this._sent_starts.insert(word) + * +*/ + } + + /* "spacy/pipeline/_parser_internals/_state.pxd":251 + * return 0 + * + * inline void set_sent_start(int word, int value) noexcept nogil: # <<<<<<<<<<<<<< + * if value >= 1: + * this._sent_starts.insert(word) +*/ + + /* function exit code */ + goto __pyx_L0; + __pyx_L1_error:; + __pyx_gilstate_save = __Pyx_PyGILState_Ensure(); + __Pyx_WriteUnraisable("StateC.set_sent_start", __pyx_clineno, __pyx_lineno, __pyx_filename, 1, 0); + __Pyx_PyGILState_Release(__pyx_gilstate_save); + __pyx_L0:; +} + +/* "spacy/pipeline/_parser_internals/_state.pxd":255 + * this._sent_starts.insert(word) + * + * inline bint has_head(int child) noexcept nogil const: # <<<<<<<<<<<<<< + * return this._heads[child] >= 0 + * +*/ + +int __pyx_t_5spacy_8pipeline_17_parser_internals_6_state_StateC::has_head(int __pyx_v_child) const { + int __pyx_r; + + /* "spacy/pipeline/_parser_internals/_state.pxd":256 + * + * inline bint has_head(int child) noexcept nogil const: + * return this._heads[child] >= 0 # <<<<<<<<<<<<<< + * + * inline int l_edge(int word) noexcept nogil const: +*/ + __pyx_r = ((this->_heads[__pyx_v_child]) >= 0); + goto __pyx_L0; + + /* "spacy/pipeline/_parser_internals/_state.pxd":255 + * this._sent_starts.insert(word) + * + * inline bint has_head(int child) noexcept nogil const: # <<<<<<<<<<<<<< + * return this._heads[child] >= 0 + * +*/ + + /* function exit code */ + __pyx_L0:; + return __pyx_r; +} + +/* "spacy/pipeline/_parser_internals/_state.pxd":258 + * return this._heads[child] >= 0 + * + * inline int l_edge(int word) noexcept nogil const: # <<<<<<<<<<<<<< + * return word + * +*/ + +int __pyx_t_5spacy_8pipeline_17_parser_internals_6_state_StateC::l_edge(int __pyx_v_word) const { + int __pyx_r; + + /* "spacy/pipeline/_parser_internals/_state.pxd":259 + * + * inline int l_edge(int word) noexcept nogil const: + * return word # <<<<<<<<<<<<<< + * + * inline int r_edge(int word) noexcept nogil const: +*/ + __pyx_r = __pyx_v_word; + goto __pyx_L0; + + /* "spacy/pipeline/_parser_internals/_state.pxd":258 + * return this._heads[child] >= 0 + * + * inline int l_edge(int word) noexcept nogil const: # <<<<<<<<<<<<<< + * return word + * +*/ + + /* function exit code */ + __pyx_L0:; + return __pyx_r; +} + +/* "spacy/pipeline/_parser_internals/_state.pxd":261 + * return word + * + * inline int r_edge(int word) noexcept nogil const: # <<<<<<<<<<<<<< + * return word + * +*/ + +int __pyx_t_5spacy_8pipeline_17_parser_internals_6_state_StateC::r_edge(int __pyx_v_word) const { + int __pyx_r; + + /* "spacy/pipeline/_parser_internals/_state.pxd":262 + * + * inline int r_edge(int word) noexcept nogil const: + * return word # <<<<<<<<<<<<<< + * + * inline int n_arcs(const unordered_map[int, vector[ArcC]] &heads_arcs, int head) noexcept nogil const: +*/ + __pyx_r = __pyx_v_word; + goto __pyx_L0; + + /* "spacy/pipeline/_parser_internals/_state.pxd":261 + * return word + * + * inline int r_edge(int word) noexcept nogil const: # <<<<<<<<<<<<<< + * return word + * +*/ + + /* function exit code */ + __pyx_L0:; + return __pyx_r; +} + +/* "spacy/pipeline/_parser_internals/_state.pxd":264 + * return word + * + * inline int n_arcs(const unordered_map[int, vector[ArcC]] &heads_arcs, int head) noexcept nogil const: # <<<<<<<<<<<<<< + * cdef int n = 0 + * head_arcs_it = heads_arcs.const_find(head) +*/ + +int __pyx_t_5spacy_8pipeline_17_parser_internals_6_state_StateC::n_arcs(std::unordered_map > const &__pyx_v_heads_arcs, int __pyx_v_head) const { + int __pyx_v_n; + std::unordered_map > ::const_iterator __pyx_v_head_arcs_it; + std::vector const *__pyx_v_arcs; + std::vector ::const_iterator __pyx_v_arcs_it; + struct __pyx_t_5spacy_8pipeline_17_parser_internals_6_state_ArcC __pyx_v_arc; + int __pyx_r; + int __pyx_t_1; + int __pyx_lineno = 0; + const char *__pyx_filename = NULL; + int __pyx_clineno = 0; + PyGILState_STATE __pyx_gilstate_save; + + /* "spacy/pipeline/_parser_internals/_state.pxd":265 + * + * inline int n_arcs(const unordered_map[int, vector[ArcC]] &heads_arcs, int head) noexcept nogil const: + * cdef int n = 0 # <<<<<<<<<<<<<< + * head_arcs_it = heads_arcs.const_find(head) + * if head_arcs_it == heads_arcs.const_end(): +*/ + __pyx_v_n = 0; + + /* "spacy/pipeline/_parser_internals/_state.pxd":266 + * inline int n_arcs(const unordered_map[int, vector[ArcC]] &heads_arcs, int head) noexcept nogil const: + * cdef int n = 0 + * head_arcs_it = heads_arcs.const_find(head) # <<<<<<<<<<<<<< + * if head_arcs_it == heads_arcs.const_end(): + * return n +*/ + try { + __pyx_v_head_arcs_it = __pyx_v_heads_arcs.find(__pyx_v_head); + } catch(...) { + PyGILState_STATE __pyx_gilstate_save = __Pyx_PyGILState_Ensure(); + __Pyx_CppExn2PyErr(); + __Pyx_PyGILState_Release(__pyx_gilstate_save); + __PYX_ERR(3, 266, __pyx_L1_error) + } + + /* "spacy/pipeline/_parser_internals/_state.pxd":267 + * cdef int n = 0 + * head_arcs_it = heads_arcs.const_find(head) + * if head_arcs_it == heads_arcs.const_end(): # <<<<<<<<<<<<<< + * return n + * +*/ + __pyx_t_1 = (__pyx_v_head_arcs_it == __pyx_v_heads_arcs.end()); + if (__pyx_t_1) { + + /* "spacy/pipeline/_parser_internals/_state.pxd":268 + * head_arcs_it = heads_arcs.const_find(head) + * if head_arcs_it == heads_arcs.const_end(): + * return n # <<<<<<<<<<<<<< + * + * cdef const vector[ArcC]* arcs = &deref(head_arcs_it).second +*/ + __pyx_r = __pyx_v_n; + goto __pyx_L0; + + /* "spacy/pipeline/_parser_internals/_state.pxd":267 + * cdef int n = 0 + * head_arcs_it = heads_arcs.const_find(head) + * if head_arcs_it == heads_arcs.const_end(): # <<<<<<<<<<<<<< + * return n + * +*/ + } + + /* "spacy/pipeline/_parser_internals/_state.pxd":270 + * return n + * + * cdef const vector[ArcC]* arcs = &deref(head_arcs_it).second # <<<<<<<<<<<<<< + * arcs_it = arcs.const_begin() + * while arcs_it != arcs.end(): +*/ + __pyx_v_arcs = (&(*__pyx_v_head_arcs_it).second); + + /* "spacy/pipeline/_parser_internals/_state.pxd":271 + * + * cdef const vector[ArcC]* arcs = &deref(head_arcs_it).second + * arcs_it = arcs.const_begin() # <<<<<<<<<<<<<< + * while arcs_it != arcs.end(): + * arc = deref(arcs_it) +*/ + try { + __pyx_v_arcs_it = __pyx_v_arcs->begin(); + } catch(...) { + PyGILState_STATE __pyx_gilstate_save = __Pyx_PyGILState_Ensure(); + __Pyx_CppExn2PyErr(); + __Pyx_PyGILState_Release(__pyx_gilstate_save); + __PYX_ERR(3, 271, __pyx_L1_error) + } + + /* "spacy/pipeline/_parser_internals/_state.pxd":272 + * cdef const vector[ArcC]* arcs = &deref(head_arcs_it).second + * arcs_it = arcs.const_begin() + * while arcs_it != arcs.end(): # <<<<<<<<<<<<<< + * arc = deref(arcs_it) + * if arc.child != -1: +*/ + while (1) { + __pyx_t_1 = (__pyx_v_arcs_it != __pyx_v_arcs->end()); + if (!__pyx_t_1) break; + + /* "spacy/pipeline/_parser_internals/_state.pxd":273 + * arcs_it = arcs.const_begin() + * while arcs_it != arcs.end(): + * arc = deref(arcs_it) # <<<<<<<<<<<<<< + * if arc.child != -1: + * n += 1 +*/ + __pyx_v_arc = (*__pyx_v_arcs_it); + + /* "spacy/pipeline/_parser_internals/_state.pxd":274 + * while arcs_it != arcs.end(): + * arc = deref(arcs_it) + * if arc.child != -1: # <<<<<<<<<<<<<< + * n += 1 + * incr(arcs_it) +*/ + __pyx_t_1 = (__pyx_v_arc.child != -1L); + if (__pyx_t_1) { + + /* "spacy/pipeline/_parser_internals/_state.pxd":275 + * arc = deref(arcs_it) + * if arc.child != -1: + * n += 1 # <<<<<<<<<<<<<< + * incr(arcs_it) + * +*/ + __pyx_v_n = (__pyx_v_n + 1); + + /* "spacy/pipeline/_parser_internals/_state.pxd":274 + * while arcs_it != arcs.end(): + * arc = deref(arcs_it) + * if arc.child != -1: # <<<<<<<<<<<<<< + * n += 1 + * incr(arcs_it) +*/ + } + + /* "spacy/pipeline/_parser_internals/_state.pxd":276 + * if arc.child != -1: + * n += 1 + * incr(arcs_it) # <<<<<<<<<<<<<< + * + * return n +*/ + (void)((++__pyx_v_arcs_it)); + } + + /* "spacy/pipeline/_parser_internals/_state.pxd":278 + * incr(arcs_it) + * + * return n # <<<<<<<<<<<<<< + * + * inline int n_L(int head) noexcept nogil const: +*/ + __pyx_r = __pyx_v_n; + goto __pyx_L0; + + /* "spacy/pipeline/_parser_internals/_state.pxd":264 + * return word + * + * inline int n_arcs(const unordered_map[int, vector[ArcC]] &heads_arcs, int head) noexcept nogil const: # <<<<<<<<<<<<<< + * cdef int n = 0 + * head_arcs_it = heads_arcs.const_find(head) +*/ + + /* function exit code */ + __pyx_L1_error:; + __pyx_gilstate_save = __Pyx_PyGILState_Ensure(); + __Pyx_WriteUnraisable("StateC.n_arcs", __pyx_clineno, __pyx_lineno, __pyx_filename, 1, 0); + __pyx_r = 0; + __Pyx_PyGILState_Release(__pyx_gilstate_save); + __pyx_L0:; + return __pyx_r; +} + +/* "spacy/pipeline/_parser_internals/_state.pxd":280 + * return n + * + * inline int n_L(int head) noexcept nogil const: # <<<<<<<<<<<<<< + * return n_arcs(this._left_arcs, head) + * +*/ + +int __pyx_t_5spacy_8pipeline_17_parser_internals_6_state_StateC::n_L(int __pyx_v_head) const { + int __pyx_r; + + /* "spacy/pipeline/_parser_internals/_state.pxd":281 + * + * inline int n_L(int head) noexcept nogil const: + * return n_arcs(this._left_arcs, head) # <<<<<<<<<<<<<< + * + * inline int n_R(int head) noexcept nogil const: +*/ + __pyx_r = n_arcs(this->_left_arcs, __pyx_v_head); + goto __pyx_L0; + + /* "spacy/pipeline/_parser_internals/_state.pxd":280 + * return n + * + * inline int n_L(int head) noexcept nogil const: # <<<<<<<<<<<<<< + * return n_arcs(this._left_arcs, head) + * +*/ + + /* function exit code */ + __pyx_L0:; + return __pyx_r; +} + +/* "spacy/pipeline/_parser_internals/_state.pxd":283 + * return n_arcs(this._left_arcs, head) + * + * inline int n_R(int head) noexcept nogil const: # <<<<<<<<<<<<<< + * return n_arcs(this._right_arcs, head) + * +*/ + +int __pyx_t_5spacy_8pipeline_17_parser_internals_6_state_StateC::n_R(int __pyx_v_head) const { + int __pyx_r; + + /* "spacy/pipeline/_parser_internals/_state.pxd":284 + * + * inline int n_R(int head) noexcept nogil const: + * return n_arcs(this._right_arcs, head) # <<<<<<<<<<<<<< + * + * inline bint stack_is_connected() noexcept nogil const: +*/ + __pyx_r = n_arcs(this->_right_arcs, __pyx_v_head); + goto __pyx_L0; + + /* "spacy/pipeline/_parser_internals/_state.pxd":283 + * return n_arcs(this._left_arcs, head) + * + * inline int n_R(int head) noexcept nogil const: # <<<<<<<<<<<<<< + * return n_arcs(this._right_arcs, head) + * +*/ + + /* function exit code */ + __pyx_L0:; + return __pyx_r; +} + +/* "spacy/pipeline/_parser_internals/_state.pxd":286 + * return n_arcs(this._right_arcs, head) + * + * inline bint stack_is_connected() noexcept nogil const: # <<<<<<<<<<<<<< + * return False + * +*/ + +int __pyx_t_5spacy_8pipeline_17_parser_internals_6_state_StateC::stack_is_connected(void) const { + int __pyx_r; + + /* "spacy/pipeline/_parser_internals/_state.pxd":287 + * + * inline bint stack_is_connected() noexcept nogil const: + * return False # <<<<<<<<<<<<<< + * + * inline bint entity_is_open() noexcept nogil const: +*/ + __pyx_r = 0; + goto __pyx_L0; + + /* "spacy/pipeline/_parser_internals/_state.pxd":286 + * return n_arcs(this._right_arcs, head) + * + * inline bint stack_is_connected() noexcept nogil const: # <<<<<<<<<<<<<< + * return False + * +*/ + + /* function exit code */ + __pyx_L0:; + return __pyx_r; +} + +/* "spacy/pipeline/_parser_internals/_state.pxd":289 + * return False + * + * inline bint entity_is_open() noexcept nogil const: # <<<<<<<<<<<<<< + * if this._ents.size() == 0: + * return False +*/ + +int __pyx_t_5spacy_8pipeline_17_parser_internals_6_state_StateC::entity_is_open(void) const { + int __pyx_r; + int __pyx_t_1; + + /* "spacy/pipeline/_parser_internals/_state.pxd":290 + * + * inline bint entity_is_open() noexcept nogil const: + * if this._ents.size() == 0: # <<<<<<<<<<<<<< + * return False + * else: +*/ + __pyx_t_1 = (this->_ents.size() == 0); + if (__pyx_t_1) { + + /* "spacy/pipeline/_parser_internals/_state.pxd":291 + * inline bint entity_is_open() noexcept nogil const: + * if this._ents.size() == 0: + * return False # <<<<<<<<<<<<<< + * else: + * return this._ents.back().end == -1 +*/ + __pyx_r = 0; + goto __pyx_L0; + + /* "spacy/pipeline/_parser_internals/_state.pxd":290 + * + * inline bint entity_is_open() noexcept nogil const: + * if this._ents.size() == 0: # <<<<<<<<<<<<<< + * return False + * else: +*/ + } + + /* "spacy/pipeline/_parser_internals/_state.pxd":293 + * return False + * else: + * return this._ents.back().end == -1 # <<<<<<<<<<<<<< + * + * inline int stack_depth() noexcept nogil const: +*/ + /*else*/ { + __pyx_r = (this->_ents.back().end == -1L); + goto __pyx_L0; + } + + /* "spacy/pipeline/_parser_internals/_state.pxd":289 + * return False + * + * inline bint entity_is_open() noexcept nogil const: # <<<<<<<<<<<<<< + * if this._ents.size() == 0: + * return False +*/ + + /* function exit code */ + __pyx_L0:; + return __pyx_r; +} + +/* "spacy/pipeline/_parser_internals/_state.pxd":295 + * return this._ents.back().end == -1 + * + * inline int stack_depth() noexcept nogil const: # <<<<<<<<<<<<<< + * return this._stack.size() + * +*/ + +int __pyx_t_5spacy_8pipeline_17_parser_internals_6_state_StateC::stack_depth(void) const { + int __pyx_r; + + /* "spacy/pipeline/_parser_internals/_state.pxd":296 + * + * inline int stack_depth() noexcept nogil const: + * return this._stack.size() # <<<<<<<<<<<<<< + * + * inline int buffer_length() noexcept nogil const: +*/ + __pyx_r = this->_stack.size(); + goto __pyx_L0; + + /* "spacy/pipeline/_parser_internals/_state.pxd":295 + * return this._ents.back().end == -1 + * + * inline int stack_depth() noexcept nogil const: # <<<<<<<<<<<<<< + * return this._stack.size() + * +*/ + + /* function exit code */ + __pyx_L0:; + return __pyx_r; +} + +/* "spacy/pipeline/_parser_internals/_state.pxd":298 + * return this._stack.size() + * + * inline int buffer_length() noexcept nogil const: # <<<<<<<<<<<<<< + * return (this.length - this._b_i) + this._rebuffer.size() + * +*/ + +int __pyx_t_5spacy_8pipeline_17_parser_internals_6_state_StateC::buffer_length(void) const { + int __pyx_r; + + /* "spacy/pipeline/_parser_internals/_state.pxd":299 + * + * inline int buffer_length() noexcept nogil const: + * return (this.length - this._b_i) + this._rebuffer.size() # <<<<<<<<<<<<<< + * + * inline void push() noexcept nogil: +*/ + __pyx_r = ((this->length - this->_b_i) + this->_rebuffer.size()); + goto __pyx_L0; + + /* "spacy/pipeline/_parser_internals/_state.pxd":298 + * return this._stack.size() + * + * inline int buffer_length() noexcept nogil const: # <<<<<<<<<<<<<< + * return (this.length - this._b_i) + this._rebuffer.size() + * +*/ + + /* function exit code */ + __pyx_L0:; + return __pyx_r; +} + +/* "spacy/pipeline/_parser_internals/_state.pxd":301 + * return (this.length - this._b_i) + this._rebuffer.size() + * + * inline void push() noexcept nogil: # <<<<<<<<<<<<<< + * b0 = this.B(0) + * if this._rebuffer.size(): +*/ + +void __pyx_t_5spacy_8pipeline_17_parser_internals_6_state_StateC::push(void) { + int __pyx_v_b0; + int __pyx_t_1; + int __pyx_t_2; + int __pyx_lineno = 0; + const char *__pyx_filename = NULL; + int __pyx_clineno = 0; + PyGILState_STATE __pyx_gilstate_save; + + /* "spacy/pipeline/_parser_internals/_state.pxd":302 + * + * inline void push() noexcept nogil: + * b0 = this.B(0) # <<<<<<<<<<<<<< + * if this._rebuffer.size(): + * b0 = this._rebuffer.back() +*/ + __pyx_v_b0 = this->B(0); + + /* "spacy/pipeline/_parser_internals/_state.pxd":303 + * inline void push() noexcept nogil: + * b0 = this.B(0) + * if this._rebuffer.size(): # <<<<<<<<<<<<<< + * b0 = this._rebuffer.back() + * this._rebuffer.pop_back() +*/ + __pyx_t_1 = (this->_rebuffer.size() != 0); + if (__pyx_t_1) { + + /* "spacy/pipeline/_parser_internals/_state.pxd":304 + * b0 = this.B(0) + * if this._rebuffer.size(): + * b0 = this._rebuffer.back() # <<<<<<<<<<<<<< + * this._rebuffer.pop_back() + * else: +*/ + __pyx_v_b0 = this->_rebuffer.back(); + + /* "spacy/pipeline/_parser_internals/_state.pxd":305 + * if this._rebuffer.size(): + * b0 = this._rebuffer.back() + * this._rebuffer.pop_back() # <<<<<<<<<<<<<< + * else: + * b0 = this._b_i +*/ + this->_rebuffer.pop_back(); + + /* "spacy/pipeline/_parser_internals/_state.pxd":303 + * inline void push() noexcept nogil: + * b0 = this.B(0) + * if this._rebuffer.size(): # <<<<<<<<<<<<<< + * b0 = this._rebuffer.back() + * this._rebuffer.pop_back() +*/ + goto __pyx_L3; + } + + /* "spacy/pipeline/_parser_internals/_state.pxd":307 + * this._rebuffer.pop_back() + * else: + * b0 = this._b_i # <<<<<<<<<<<<<< + * this._b_i += 1 + * this._stack.push_back(b0) +*/ + /*else*/ { + __pyx_t_2 = this->_b_i; + __pyx_v_b0 = __pyx_t_2; + + /* "spacy/pipeline/_parser_internals/_state.pxd":308 + * else: + * b0 = this._b_i + * this._b_i += 1 # <<<<<<<<<<<<<< + * this._stack.push_back(b0) + * +*/ + this->_b_i = (this->_b_i + 1); + } + __pyx_L3:; + + /* "spacy/pipeline/_parser_internals/_state.pxd":309 + * b0 = this._b_i + * this._b_i += 1 + * this._stack.push_back(b0) # <<<<<<<<<<<<<< + * + * inline void pop() noexcept nogil: +*/ + try { + this->_stack.push_back(__pyx_v_b0); + } catch(...) { + PyGILState_STATE __pyx_gilstate_save = __Pyx_PyGILState_Ensure(); + __Pyx_CppExn2PyErr(); + __Pyx_PyGILState_Release(__pyx_gilstate_save); + __PYX_ERR(3, 309, __pyx_L1_error) + } + + /* "spacy/pipeline/_parser_internals/_state.pxd":301 + * return (this.length - this._b_i) + this._rebuffer.size() + * + * inline void push() noexcept nogil: # <<<<<<<<<<<<<< + * b0 = this.B(0) + * if this._rebuffer.size(): +*/ + + /* function exit code */ + goto __pyx_L0; + __pyx_L1_error:; + __pyx_gilstate_save = __Pyx_PyGILState_Ensure(); + __Pyx_WriteUnraisable("StateC.push", __pyx_clineno, __pyx_lineno, __pyx_filename, 1, 0); + __Pyx_PyGILState_Release(__pyx_gilstate_save); + __pyx_L0:; +} + +/* "spacy/pipeline/_parser_internals/_state.pxd":311 + * this._stack.push_back(b0) + * + * inline void pop() noexcept nogil: # <<<<<<<<<<<<<< + * this._stack.pop_back() + * +*/ + +void __pyx_t_5spacy_8pipeline_17_parser_internals_6_state_StateC::pop(void) { + + /* "spacy/pipeline/_parser_internals/_state.pxd":312 + * + * inline void pop() noexcept nogil: + * this._stack.pop_back() # <<<<<<<<<<<<<< + * + * inline void force_final() noexcept nogil: +*/ + this->_stack.pop_back(); + + /* "spacy/pipeline/_parser_internals/_state.pxd":311 + * this._stack.push_back(b0) + * + * inline void pop() noexcept nogil: # <<<<<<<<<<<<<< + * this._stack.pop_back() + * +*/ + + /* function exit code */ +} + +/* "spacy/pipeline/_parser_internals/_state.pxd":314 + * this._stack.pop_back() + * + * inline void force_final() noexcept nogil: # <<<<<<<<<<<<<< + * # This should only be used in desperate situations, as it may leave + * # the analysis in an unexpected state. +*/ + +void __pyx_t_5spacy_8pipeline_17_parser_internals_6_state_StateC::force_final(void) { + int __pyx_t_1; + + /* "spacy/pipeline/_parser_internals/_state.pxd":317 + * # This should only be used in desperate situations, as it may leave + * # the analysis in an unexpected state. + * this._stack.clear() # <<<<<<<<<<<<<< + * this._b_i = this.length + * +*/ + this->_stack.clear(); + + /* "spacy/pipeline/_parser_internals/_state.pxd":318 + * # the analysis in an unexpected state. + * this._stack.clear() + * this._b_i = this.length # <<<<<<<<<<<<<< + * + * inline void unshift() noexcept nogil: +*/ + __pyx_t_1 = this->length; + this->_b_i = __pyx_t_1; + + /* "spacy/pipeline/_parser_internals/_state.pxd":314 + * this._stack.pop_back() + * + * inline void force_final() noexcept nogil: # <<<<<<<<<<<<<< + * # This should only be used in desperate situations, as it may leave + * # the analysis in an unexpected state. +*/ + + /* function exit code */ +} + +/* "spacy/pipeline/_parser_internals/_state.pxd":320 + * this._b_i = this.length + * + * inline void unshift() noexcept nogil: # <<<<<<<<<<<<<< + * s0 = this._stack.back() + * this._unshiftable[s0] = 1 +*/ + +void __pyx_t_5spacy_8pipeline_17_parser_internals_6_state_StateC::unshift(void) { + int __pyx_v_s0; + int __pyx_lineno = 0; + const char *__pyx_filename = NULL; + int __pyx_clineno = 0; + PyGILState_STATE __pyx_gilstate_save; + + /* "spacy/pipeline/_parser_internals/_state.pxd":321 + * + * inline void unshift() noexcept nogil: + * s0 = this._stack.back() # <<<<<<<<<<<<<< + * this._unshiftable[s0] = 1 + * this._rebuffer.push_back(s0) +*/ + __pyx_v_s0 = this->_stack.back(); + + /* "spacy/pipeline/_parser_internals/_state.pxd":322 + * inline void unshift() noexcept nogil: + * s0 = this._stack.back() + * this._unshiftable[s0] = 1 # <<<<<<<<<<<<<< + * this._rebuffer.push_back(s0) + * this._stack.pop_back() +*/ + (this->_unshiftable[__pyx_v_s0]) = 1; + + /* "spacy/pipeline/_parser_internals/_state.pxd":323 + * s0 = this._stack.back() + * this._unshiftable[s0] = 1 + * this._rebuffer.push_back(s0) # <<<<<<<<<<<<<< + * this._stack.pop_back() + * +*/ + try { + this->_rebuffer.push_back(__pyx_v_s0); + } catch(...) { + PyGILState_STATE __pyx_gilstate_save = __Pyx_PyGILState_Ensure(); + __Pyx_CppExn2PyErr(); + __Pyx_PyGILState_Release(__pyx_gilstate_save); + __PYX_ERR(3, 323, __pyx_L1_error) + } + + /* "spacy/pipeline/_parser_internals/_state.pxd":324 + * this._unshiftable[s0] = 1 + * this._rebuffer.push_back(s0) + * this._stack.pop_back() # <<<<<<<<<<<<<< + * + * inline int is_unshiftable(int item) noexcept nogil const: +*/ + this->_stack.pop_back(); + + /* "spacy/pipeline/_parser_internals/_state.pxd":320 + * this._b_i = this.length + * + * inline void unshift() noexcept nogil: # <<<<<<<<<<<<<< + * s0 = this._stack.back() + * this._unshiftable[s0] = 1 +*/ + + /* function exit code */ + goto __pyx_L0; + __pyx_L1_error:; + __pyx_gilstate_save = __Pyx_PyGILState_Ensure(); + __Pyx_WriteUnraisable("StateC.unshift", __pyx_clineno, __pyx_lineno, __pyx_filename, 1, 0); + __Pyx_PyGILState_Release(__pyx_gilstate_save); + __pyx_L0:; +} + +/* "spacy/pipeline/_parser_internals/_state.pxd":326 + * this._stack.pop_back() + * + * inline int is_unshiftable(int item) noexcept nogil const: # <<<<<<<<<<<<<< + * if item >= this._unshiftable.size(): + * return 0 +*/ + +int __pyx_t_5spacy_8pipeline_17_parser_internals_6_state_StateC::is_unshiftable(int __pyx_v_item) const { + int __pyx_r; + int __pyx_t_1; + bool __pyx_t_2; + int __pyx_lineno = 0; + const char *__pyx_filename = NULL; + int __pyx_clineno = 0; + PyGILState_STATE __pyx_gilstate_save; + + /* "spacy/pipeline/_parser_internals/_state.pxd":327 + * + * inline int is_unshiftable(int item) noexcept nogil const: + * if item >= this._unshiftable.size(): # <<<<<<<<<<<<<< + * return 0 + * else: +*/ + __pyx_t_1 = (__pyx_v_item >= this->_unshiftable.size()); + if (__pyx_t_1) { + + /* "spacy/pipeline/_parser_internals/_state.pxd":328 + * inline int is_unshiftable(int item) noexcept nogil const: + * if item >= this._unshiftable.size(): + * return 0 # <<<<<<<<<<<<<< + * else: + * return this._unshiftable.at(item) +*/ + __pyx_r = 0; + goto __pyx_L0; + + /* "spacy/pipeline/_parser_internals/_state.pxd":327 + * + * inline int is_unshiftable(int item) noexcept nogil const: + * if item >= this._unshiftable.size(): # <<<<<<<<<<<<<< + * return 0 + * else: +*/ + } + + /* "spacy/pipeline/_parser_internals/_state.pxd":330 + * return 0 + * else: + * return this._unshiftable.at(item) # <<<<<<<<<<<<<< + * + * inline void set_reshiftable(int item) noexcept nogil: +*/ + /*else*/ { + try { + __pyx_t_2 = this->_unshiftable.at(__pyx_v_item); + } catch(...) { + PyGILState_STATE __pyx_gilstate_save = __Pyx_PyGILState_Ensure(); + __Pyx_CppExn2PyErr(); + __Pyx_PyGILState_Release(__pyx_gilstate_save); + __PYX_ERR(3, 330, __pyx_L1_error) + } + __pyx_r = __pyx_t_2; + goto __pyx_L0; + } + + /* "spacy/pipeline/_parser_internals/_state.pxd":326 + * this._stack.pop_back() + * + * inline int is_unshiftable(int item) noexcept nogil const: # <<<<<<<<<<<<<< + * if item >= this._unshiftable.size(): + * return 0 +*/ + + /* function exit code */ + __pyx_L1_error:; + __pyx_gilstate_save = __Pyx_PyGILState_Ensure(); + __Pyx_WriteUnraisable("StateC.is_unshiftable", __pyx_clineno, __pyx_lineno, __pyx_filename, 1, 0); + __pyx_r = 0; + __Pyx_PyGILState_Release(__pyx_gilstate_save); + __pyx_L0:; + return __pyx_r; +} + +/* "spacy/pipeline/_parser_internals/_state.pxd":332 + * return this._unshiftable.at(item) + * + * inline void set_reshiftable(int item) noexcept nogil: # <<<<<<<<<<<<<< + * if item < this._unshiftable.size(): + * this._unshiftable[item] = 0 +*/ + +void __pyx_t_5spacy_8pipeline_17_parser_internals_6_state_StateC::set_reshiftable(int __pyx_v_item) { + int __pyx_t_1; + + /* "spacy/pipeline/_parser_internals/_state.pxd":333 + * + * inline void set_reshiftable(int item) noexcept nogil: + * if item < this._unshiftable.size(): # <<<<<<<<<<<<<< + * this._unshiftable[item] = 0 + * +*/ + __pyx_t_1 = (__pyx_v_item < this->_unshiftable.size()); + if (__pyx_t_1) { + + /* "spacy/pipeline/_parser_internals/_state.pxd":334 + * inline void set_reshiftable(int item) noexcept nogil: + * if item < this._unshiftable.size(): + * this._unshiftable[item] = 0 # <<<<<<<<<<<<<< + * + * inline void add_arc(int head, int child, attr_t label) noexcept nogil: +*/ + (this->_unshiftable[__pyx_v_item]) = 0; + + /* "spacy/pipeline/_parser_internals/_state.pxd":333 + * + * inline void set_reshiftable(int item) noexcept nogil: + * if item < this._unshiftable.size(): # <<<<<<<<<<<<<< + * this._unshiftable[item] = 0 + * +*/ + } + + /* "spacy/pipeline/_parser_internals/_state.pxd":332 + * return this._unshiftable.at(item) + * + * inline void set_reshiftable(int item) noexcept nogil: # <<<<<<<<<<<<<< + * if item < this._unshiftable.size(): + * this._unshiftable[item] = 0 +*/ + + /* function exit code */ +} + +/* "spacy/pipeline/_parser_internals/_state.pxd":336 + * this._unshiftable[item] = 0 + * + * inline void add_arc(int head, int child, attr_t label) noexcept nogil: # <<<<<<<<<<<<<< + * if this.has_head(child): + * this.del_arc(this.H(child), child) +*/ + +void __pyx_t_5spacy_8pipeline_17_parser_internals_6_state_StateC::add_arc(int __pyx_v_head, int __pyx_v_child, __pyx_t_5spacy_8typedefs_attr_t __pyx_v_label) { + struct __pyx_t_5spacy_8pipeline_17_parser_internals_6_state_ArcC __pyx_v_arc; + int __pyx_t_1; + int __pyx_lineno = 0; + const char *__pyx_filename = NULL; + int __pyx_clineno = 0; + PyGILState_STATE __pyx_gilstate_save; + + /* "spacy/pipeline/_parser_internals/_state.pxd":337 + * + * inline void add_arc(int head, int child, attr_t label) noexcept nogil: + * if this.has_head(child): # <<<<<<<<<<<<<< + * this.del_arc(this.H(child), child) + * cdef ArcC arc +*/ + __pyx_t_1 = this->has_head(__pyx_v_child); + if (__pyx_t_1) { + + /* "spacy/pipeline/_parser_internals/_state.pxd":338 + * inline void add_arc(int head, int child, attr_t label) noexcept nogil: + * if this.has_head(child): + * this.del_arc(this.H(child), child) # <<<<<<<<<<<<<< + * cdef ArcC arc + * arc.head = head +*/ + this->del_arc(this->H(__pyx_v_child), __pyx_v_child); + + /* "spacy/pipeline/_parser_internals/_state.pxd":337 + * + * inline void add_arc(int head, int child, attr_t label) noexcept nogil: + * if this.has_head(child): # <<<<<<<<<<<<<< + * this.del_arc(this.H(child), child) + * cdef ArcC arc +*/ + } + + /* "spacy/pipeline/_parser_internals/_state.pxd":340 + * this.del_arc(this.H(child), child) + * cdef ArcC arc + * arc.head = head # <<<<<<<<<<<<<< + * arc.child = child + * arc.label = label +*/ + __pyx_v_arc.head = __pyx_v_head; + + /* "spacy/pipeline/_parser_internals/_state.pxd":341 + * cdef ArcC arc + * arc.head = head + * arc.child = child # <<<<<<<<<<<<<< + * arc.label = label + * if head > child: +*/ + __pyx_v_arc.child = __pyx_v_child; + + /* "spacy/pipeline/_parser_internals/_state.pxd":342 + * arc.head = head + * arc.child = child + * arc.label = label # <<<<<<<<<<<<<< + * if head > child: + * this._left_arcs[arc.head].push_back(arc) +*/ + __pyx_v_arc.label = __pyx_v_label; + + /* "spacy/pipeline/_parser_internals/_state.pxd":343 + * arc.child = child + * arc.label = label + * if head > child: # <<<<<<<<<<<<<< + * this._left_arcs[arc.head].push_back(arc) + * else: +*/ + __pyx_t_1 = (__pyx_v_head > __pyx_v_child); + if (__pyx_t_1) { + + /* "spacy/pipeline/_parser_internals/_state.pxd":344 + * arc.label = label + * if head > child: + * this._left_arcs[arc.head].push_back(arc) # <<<<<<<<<<<<<< + * else: + * this._right_arcs[arc.head].push_back(arc) +*/ + try { + (this->_left_arcs[__pyx_v_arc.head]).push_back(__pyx_v_arc); + } catch(...) { + PyGILState_STATE __pyx_gilstate_save = __Pyx_PyGILState_Ensure(); + __Pyx_CppExn2PyErr(); + __Pyx_PyGILState_Release(__pyx_gilstate_save); + __PYX_ERR(3, 344, __pyx_L1_error) + } + + /* "spacy/pipeline/_parser_internals/_state.pxd":343 + * arc.child = child + * arc.label = label + * if head > child: # <<<<<<<<<<<<<< + * this._left_arcs[arc.head].push_back(arc) + * else: +*/ + goto __pyx_L4; + } + + /* "spacy/pipeline/_parser_internals/_state.pxd":346 + * this._left_arcs[arc.head].push_back(arc) + * else: + * this._right_arcs[arc.head].push_back(arc) # <<<<<<<<<<<<<< + * this._heads[child] = head + * +*/ + /*else*/ { + try { + (this->_right_arcs[__pyx_v_arc.head]).push_back(__pyx_v_arc); + } catch(...) { + PyGILState_STATE __pyx_gilstate_save = __Pyx_PyGILState_Ensure(); + __Pyx_CppExn2PyErr(); + __Pyx_PyGILState_Release(__pyx_gilstate_save); + __PYX_ERR(3, 346, __pyx_L1_error) + } + } + __pyx_L4:; + + /* "spacy/pipeline/_parser_internals/_state.pxd":347 + * else: + * this._right_arcs[arc.head].push_back(arc) + * this._heads[child] = head # <<<<<<<<<<<<<< + * + * inline void map_del_arc(unordered_map[int, vector[ArcC]]* heads_arcs, int h_i, int c_i) noexcept nogil: +*/ + (this->_heads[__pyx_v_child]) = __pyx_v_head; + + /* "spacy/pipeline/_parser_internals/_state.pxd":336 + * this._unshiftable[item] = 0 + * + * inline void add_arc(int head, int child, attr_t label) noexcept nogil: # <<<<<<<<<<<<<< + * if this.has_head(child): + * this.del_arc(this.H(child), child) +*/ + + /* function exit code */ + goto __pyx_L0; + __pyx_L1_error:; + __pyx_gilstate_save = __Pyx_PyGILState_Ensure(); + __Pyx_WriteUnraisable("StateC.add_arc", __pyx_clineno, __pyx_lineno, __pyx_filename, 1, 0); + __Pyx_PyGILState_Release(__pyx_gilstate_save); + __pyx_L0:; +} + +/* "spacy/pipeline/_parser_internals/_state.pxd":349 + * this._heads[child] = head + * + * inline void map_del_arc(unordered_map[int, vector[ArcC]]* heads_arcs, int h_i, int c_i) noexcept nogil: # <<<<<<<<<<<<<< + * arcs_it = heads_arcs.find(h_i) + * if arcs_it == heads_arcs.end(): +*/ + +void __pyx_t_5spacy_8pipeline_17_parser_internals_6_state_StateC::map_del_arc(std::unordered_map > *__pyx_v_heads_arcs, int __pyx_v_h_i, int __pyx_v_c_i) { + std::unordered_map > ::iterator __pyx_v_arcs_it; + std::vector *__pyx_v_arcs; + struct __pyx_t_5spacy_8pipeline_17_parser_internals_6_state_ArcC __pyx_v_arc; + std::vector ::size_type __pyx_v_i; + int __pyx_t_1; + int __pyx_t_2; + std::vector ::size_type __pyx_t_3; + std::vector ::size_type __pyx_t_4; + std::vector ::size_type __pyx_t_5; + __Pyx_FakeReference __pyx_t_6; + int __pyx_lineno = 0; + const char *__pyx_filename = NULL; + int __pyx_clineno = 0; + PyGILState_STATE __pyx_gilstate_save; + + /* "spacy/pipeline/_parser_internals/_state.pxd":350 + * + * inline void map_del_arc(unordered_map[int, vector[ArcC]]* heads_arcs, int h_i, int c_i) noexcept nogil: + * arcs_it = heads_arcs.find(h_i) # <<<<<<<<<<<<<< + * if arcs_it == heads_arcs.end(): + * return +*/ + __pyx_v_arcs_it = __pyx_v_heads_arcs->find(__pyx_v_h_i); + + /* "spacy/pipeline/_parser_internals/_state.pxd":351 + * inline void map_del_arc(unordered_map[int, vector[ArcC]]* heads_arcs, int h_i, int c_i) noexcept nogil: + * arcs_it = heads_arcs.find(h_i) + * if arcs_it == heads_arcs.end(): # <<<<<<<<<<<<<< + * return + * +*/ + __pyx_t_1 = (__pyx_v_arcs_it == __pyx_v_heads_arcs->end()); + if (__pyx_t_1) { + + /* "spacy/pipeline/_parser_internals/_state.pxd":352 + * arcs_it = heads_arcs.find(h_i) + * if arcs_it == heads_arcs.end(): + * return # <<<<<<<<<<<<<< + * + * arcs = &deref(arcs_it).second +*/ + goto __pyx_L0; + + /* "spacy/pipeline/_parser_internals/_state.pxd":351 + * inline void map_del_arc(unordered_map[int, vector[ArcC]]* heads_arcs, int h_i, int c_i) noexcept nogil: + * arcs_it = heads_arcs.find(h_i) + * if arcs_it == heads_arcs.end(): # <<<<<<<<<<<<<< + * return + * +*/ + } + + /* "spacy/pipeline/_parser_internals/_state.pxd":354 + * return + * + * arcs = &deref(arcs_it).second # <<<<<<<<<<<<<< + * if arcs.size() == 0: + * return +*/ + __pyx_v_arcs = (&(*__pyx_v_arcs_it).second); + + /* "spacy/pipeline/_parser_internals/_state.pxd":355 + * + * arcs = &deref(arcs_it).second + * if arcs.size() == 0: # <<<<<<<<<<<<<< + * return + * +*/ + __pyx_t_1 = (__pyx_v_arcs->size() == 0); + if (__pyx_t_1) { + + /* "spacy/pipeline/_parser_internals/_state.pxd":356 + * arcs = &deref(arcs_it).second + * if arcs.size() == 0: + * return # <<<<<<<<<<<<<< + * + * arc = arcs.back() +*/ + goto __pyx_L0; + + /* "spacy/pipeline/_parser_internals/_state.pxd":355 + * + * arcs = &deref(arcs_it).second + * if arcs.size() == 0: # <<<<<<<<<<<<<< + * return + * +*/ + } + + /* "spacy/pipeline/_parser_internals/_state.pxd":358 + * return + * + * arc = arcs.back() # <<<<<<<<<<<<<< + * if arc.head == h_i and arc.child == c_i: + * arcs.pop_back() +*/ + __pyx_v_arc = __pyx_v_arcs->back(); + + /* "spacy/pipeline/_parser_internals/_state.pxd":359 + * + * arc = arcs.back() + * if arc.head == h_i and arc.child == c_i: # <<<<<<<<<<<<<< + * arcs.pop_back() + * else: +*/ + __pyx_t_2 = (__pyx_v_arc.head == __pyx_v_h_i); + if (__pyx_t_2) { + } else { + __pyx_t_1 = __pyx_t_2; + goto __pyx_L6_bool_binop_done; + } + __pyx_t_2 = (__pyx_v_arc.child == __pyx_v_c_i); + __pyx_t_1 = __pyx_t_2; + __pyx_L6_bool_binop_done:; + if (__pyx_t_1) { + + /* "spacy/pipeline/_parser_internals/_state.pxd":360 + * arc = arcs.back() + * if arc.head == h_i and arc.child == c_i: + * arcs.pop_back() # <<<<<<<<<<<<<< + * else: + * for i in range(arcs.size()-1): +*/ + __pyx_v_arcs->pop_back(); + + /* "spacy/pipeline/_parser_internals/_state.pxd":359 + * + * arc = arcs.back() + * if arc.head == h_i and arc.child == c_i: # <<<<<<<<<<<<<< + * arcs.pop_back() + * else: +*/ + goto __pyx_L5; + } + + /* "spacy/pipeline/_parser_internals/_state.pxd":362 + * arcs.pop_back() + * else: + * for i in range(arcs.size()-1): # <<<<<<<<<<<<<< + * arc = arcs.at(i) + * if arc.head == h_i and arc.child == c_i: +*/ + /*else*/ { + __pyx_t_3 = (__pyx_v_arcs->size() - 1); + __pyx_t_4 = __pyx_t_3; + for (__pyx_t_5 = 0; __pyx_t_5 < __pyx_t_4; __pyx_t_5+=1) { + __pyx_v_i = __pyx_t_5; + + /* "spacy/pipeline/_parser_internals/_state.pxd":363 + * else: + * for i in range(arcs.size()-1): + * arc = arcs.at(i) # <<<<<<<<<<<<<< + * if arc.head == h_i and arc.child == c_i: + * arc.head = -1 +*/ + try { + __pyx_t_6 = __pyx_v_arcs->at(__pyx_v_i); + } catch(...) { + PyGILState_STATE __pyx_gilstate_save = __Pyx_PyGILState_Ensure(); + __Pyx_CppExn2PyErr(); + __Pyx_PyGILState_Release(__pyx_gilstate_save); + __PYX_ERR(3, 363, __pyx_L1_error) + } + __pyx_v_arc = __pyx_t_6; + + /* "spacy/pipeline/_parser_internals/_state.pxd":364 + * for i in range(arcs.size()-1): + * arc = arcs.at(i) + * if arc.head == h_i and arc.child == c_i: # <<<<<<<<<<<<<< + * arc.head = -1 + * arc.child = -1 +*/ + __pyx_t_2 = (__pyx_v_arc.head == __pyx_v_h_i); + if (__pyx_t_2) { + } else { + __pyx_t_1 = __pyx_t_2; + goto __pyx_L11_bool_binop_done; + } + __pyx_t_2 = (__pyx_v_arc.child == __pyx_v_c_i); + __pyx_t_1 = __pyx_t_2; + __pyx_L11_bool_binop_done:; + if (__pyx_t_1) { + + /* "spacy/pipeline/_parser_internals/_state.pxd":365 + * arc = arcs.at(i) + * if arc.head == h_i and arc.child == c_i: + * arc.head = -1 # <<<<<<<<<<<<<< + * arc.child = -1 + * arc.label = 0 +*/ + __pyx_v_arc.head = -1; + + /* "spacy/pipeline/_parser_internals/_state.pxd":366 + * if arc.head == h_i and arc.child == c_i: + * arc.head = -1 + * arc.child = -1 # <<<<<<<<<<<<<< + * arc.label = 0 + * break +*/ + __pyx_v_arc.child = -1; + + /* "spacy/pipeline/_parser_internals/_state.pxd":367 + * arc.head = -1 + * arc.child = -1 + * arc.label = 0 # <<<<<<<<<<<<<< + * break + * +*/ + __pyx_v_arc.label = 0; + + /* "spacy/pipeline/_parser_internals/_state.pxd":368 + * arc.child = -1 + * arc.label = 0 + * break # <<<<<<<<<<<<<< + * + * inline void del_arc(int h_i, int c_i) noexcept nogil: +*/ + goto __pyx_L9_break; + + /* "spacy/pipeline/_parser_internals/_state.pxd":364 + * for i in range(arcs.size()-1): + * arc = arcs.at(i) + * if arc.head == h_i and arc.child == c_i: # <<<<<<<<<<<<<< + * arc.head = -1 + * arc.child = -1 +*/ + } + } + __pyx_L9_break:; + } + __pyx_L5:; + + /* "spacy/pipeline/_parser_internals/_state.pxd":349 + * this._heads[child] = head + * + * inline void map_del_arc(unordered_map[int, vector[ArcC]]* heads_arcs, int h_i, int c_i) noexcept nogil: # <<<<<<<<<<<<<< + * arcs_it = heads_arcs.find(h_i) + * if arcs_it == heads_arcs.end(): +*/ + + /* function exit code */ + goto __pyx_L0; + __pyx_L1_error:; + __pyx_gilstate_save = __Pyx_PyGILState_Ensure(); + __Pyx_WriteUnraisable("StateC.map_del_arc", __pyx_clineno, __pyx_lineno, __pyx_filename, 1, 0); + __Pyx_PyGILState_Release(__pyx_gilstate_save); + __pyx_L0:; +} + +/* "spacy/pipeline/_parser_internals/_state.pxd":370 + * break + * + * inline void del_arc(int h_i, int c_i) noexcept nogil: # <<<<<<<<<<<<<< + * if h_i > c_i: + * this.map_del_arc(&this._left_arcs, h_i, c_i) +*/ + +void __pyx_t_5spacy_8pipeline_17_parser_internals_6_state_StateC::del_arc(int __pyx_v_h_i, int __pyx_v_c_i) { + int __pyx_t_1; + + /* "spacy/pipeline/_parser_internals/_state.pxd":371 + * + * inline void del_arc(int h_i, int c_i) noexcept nogil: + * if h_i > c_i: # <<<<<<<<<<<<<< + * this.map_del_arc(&this._left_arcs, h_i, c_i) + * else: +*/ + __pyx_t_1 = (__pyx_v_h_i > __pyx_v_c_i); + if (__pyx_t_1) { + + /* "spacy/pipeline/_parser_internals/_state.pxd":372 + * inline void del_arc(int h_i, int c_i) noexcept nogil: + * if h_i > c_i: + * this.map_del_arc(&this._left_arcs, h_i, c_i) # <<<<<<<<<<<<<< + * else: + * this.map_del_arc(&this._right_arcs, h_i, c_i) +*/ + this->map_del_arc((&this->_left_arcs), __pyx_v_h_i, __pyx_v_c_i); + + /* "spacy/pipeline/_parser_internals/_state.pxd":371 + * + * inline void del_arc(int h_i, int c_i) noexcept nogil: + * if h_i > c_i: # <<<<<<<<<<<<<< + * this.map_del_arc(&this._left_arcs, h_i, c_i) + * else: +*/ + goto __pyx_L3; + } + + /* "spacy/pipeline/_parser_internals/_state.pxd":374 + * this.map_del_arc(&this._left_arcs, h_i, c_i) + * else: + * this.map_del_arc(&this._right_arcs, h_i, c_i) # <<<<<<<<<<<<<< + * + * inline SpanC get_ent() noexcept nogil const: +*/ + /*else*/ { + this->map_del_arc((&this->_right_arcs), __pyx_v_h_i, __pyx_v_c_i); + } + __pyx_L3:; + + /* "spacy/pipeline/_parser_internals/_state.pxd":370 + * break + * + * inline void del_arc(int h_i, int c_i) noexcept nogil: # <<<<<<<<<<<<<< + * if h_i > c_i: + * this.map_del_arc(&this._left_arcs, h_i, c_i) +*/ + + /* function exit code */ +} + +/* "spacy/pipeline/_parser_internals/_state.pxd":376 + * this.map_del_arc(&this._right_arcs, h_i, c_i) + * + * inline SpanC get_ent() noexcept nogil const: # <<<<<<<<<<<<<< + * cdef SpanC ent + * if this._ents.size() == 0: +*/ + +struct __pyx_t_5spacy_7structs_SpanC __pyx_t_5spacy_8pipeline_17_parser_internals_6_state_StateC::get_ent(void) const { + struct __pyx_t_5spacy_7structs_SpanC __pyx_v_ent; + struct __pyx_t_5spacy_7structs_SpanC __pyx_r; + int __pyx_t_1; + + /* "spacy/pipeline/_parser_internals/_state.pxd":378 + * inline SpanC get_ent() noexcept nogil const: + * cdef SpanC ent + * if this._ents.size() == 0: # <<<<<<<<<<<<<< + * ent.start = 0 + * ent.end = 0 +*/ + __pyx_t_1 = (this->_ents.size() == 0); + if (__pyx_t_1) { + + /* "spacy/pipeline/_parser_internals/_state.pxd":379 + * cdef SpanC ent + * if this._ents.size() == 0: + * ent.start = 0 # <<<<<<<<<<<<<< + * ent.end = 0 + * ent.label = 0 +*/ + __pyx_v_ent.start = 0; + + /* "spacy/pipeline/_parser_internals/_state.pxd":380 + * if this._ents.size() == 0: + * ent.start = 0 + * ent.end = 0 # <<<<<<<<<<<<<< + * ent.label = 0 + * return ent +*/ + __pyx_v_ent.end = 0; + + /* "spacy/pipeline/_parser_internals/_state.pxd":381 + * ent.start = 0 + * ent.end = 0 + * ent.label = 0 # <<<<<<<<<<<<<< + * return ent + * else: +*/ + __pyx_v_ent.label = 0; + + /* "spacy/pipeline/_parser_internals/_state.pxd":382 + * ent.end = 0 + * ent.label = 0 + * return ent # <<<<<<<<<<<<<< + * else: + * return this._ents.back() +*/ + __pyx_r = __pyx_v_ent; + goto __pyx_L0; + + /* "spacy/pipeline/_parser_internals/_state.pxd":378 + * inline SpanC get_ent() noexcept nogil const: + * cdef SpanC ent + * if this._ents.size() == 0: # <<<<<<<<<<<<<< + * ent.start = 0 + * ent.end = 0 +*/ + } + + /* "spacy/pipeline/_parser_internals/_state.pxd":384 + * return ent + * else: + * return this._ents.back() # <<<<<<<<<<<<<< + * + * inline void open_ent(attr_t label) noexcept nogil: +*/ + /*else*/ { + __pyx_r = this->_ents.back(); + goto __pyx_L0; + } + + /* "spacy/pipeline/_parser_internals/_state.pxd":376 + * this.map_del_arc(&this._right_arcs, h_i, c_i) + * + * inline SpanC get_ent() noexcept nogil const: # <<<<<<<<<<<<<< + * cdef SpanC ent + * if this._ents.size() == 0: +*/ + + /* function exit code */ + __pyx_L0:; + return __pyx_r; +} + +/* "spacy/pipeline/_parser_internals/_state.pxd":386 + * return this._ents.back() + * + * inline void open_ent(attr_t label) noexcept nogil: # <<<<<<<<<<<<<< + * cdef SpanC ent + * ent.start = this.B(0) +*/ + +void __pyx_t_5spacy_8pipeline_17_parser_internals_6_state_StateC::open_ent(__pyx_t_5spacy_8typedefs_attr_t __pyx_v_label) { + struct __pyx_t_5spacy_7structs_SpanC __pyx_v_ent; + int __pyx_lineno = 0; + const char *__pyx_filename = NULL; + int __pyx_clineno = 0; + PyGILState_STATE __pyx_gilstate_save; + + /* "spacy/pipeline/_parser_internals/_state.pxd":388 + * inline void open_ent(attr_t label) noexcept nogil: + * cdef SpanC ent + * ent.start = this.B(0) # <<<<<<<<<<<<<< + * ent.label = label + * ent.end = -1 +*/ + __pyx_v_ent.start = this->B(0); + + /* "spacy/pipeline/_parser_internals/_state.pxd":389 + * cdef SpanC ent + * ent.start = this.B(0) + * ent.label = label # <<<<<<<<<<<<<< + * ent.end = -1 + * this._ents.push_back(ent) +*/ + __pyx_v_ent.label = __pyx_v_label; + + /* "spacy/pipeline/_parser_internals/_state.pxd":390 + * ent.start = this.B(0) + * ent.label = label + * ent.end = -1 # <<<<<<<<<<<<<< + * this._ents.push_back(ent) + * +*/ + __pyx_v_ent.end = -1; + + /* "spacy/pipeline/_parser_internals/_state.pxd":391 + * ent.label = label + * ent.end = -1 + * this._ents.push_back(ent) # <<<<<<<<<<<<<< + * + * inline void close_ent() noexcept nogil: +*/ + try { + this->_ents.push_back(__pyx_v_ent); + } catch(...) { + PyGILState_STATE __pyx_gilstate_save = __Pyx_PyGILState_Ensure(); + __Pyx_CppExn2PyErr(); + __Pyx_PyGILState_Release(__pyx_gilstate_save); + __PYX_ERR(3, 391, __pyx_L1_error) + } + + /* "spacy/pipeline/_parser_internals/_state.pxd":386 + * return this._ents.back() + * + * inline void open_ent(attr_t label) noexcept nogil: # <<<<<<<<<<<<<< + * cdef SpanC ent + * ent.start = this.B(0) +*/ + + /* function exit code */ + goto __pyx_L0; + __pyx_L1_error:; + __pyx_gilstate_save = __Pyx_PyGILState_Ensure(); + __Pyx_WriteUnraisable("StateC.open_ent", __pyx_clineno, __pyx_lineno, __pyx_filename, 1, 0); + __Pyx_PyGILState_Release(__pyx_gilstate_save); + __pyx_L0:; +} + +/* "spacy/pipeline/_parser_internals/_state.pxd":393 + * this._ents.push_back(ent) + * + * inline void close_ent() noexcept nogil: # <<<<<<<<<<<<<< + * this._ents.back().end = this.B(0)+1 + * +*/ + +void __pyx_t_5spacy_8pipeline_17_parser_internals_6_state_StateC::close_ent(void) { + + /* "spacy/pipeline/_parser_internals/_state.pxd":394 + * + * inline void close_ent() noexcept nogil: + * this._ents.back().end = this.B(0)+1 # <<<<<<<<<<<<<< + * + * inline void clone(const StateC* src) noexcept nogil: +*/ + this->_ents.back().end = (this->B(0) + 1); + + /* "spacy/pipeline/_parser_internals/_state.pxd":393 + * this._ents.push_back(ent) + * + * inline void close_ent() noexcept nogil: # <<<<<<<<<<<<<< + * this._ents.back().end = this.B(0)+1 + * +*/ + + /* function exit code */ +} + +/* "spacy/pipeline/_parser_internals/_state.pxd":396 + * this._ents.back().end = this.B(0)+1 + * + * inline void clone(const StateC* src) noexcept nogil: # <<<<<<<<<<<<<< + * this.length = src.length + * this._sent = src._sent +*/ + +void __pyx_t_5spacy_8pipeline_17_parser_internals_6_state_StateC::clone(__pyx_t_5spacy_8pipeline_17_parser_internals_6_state_StateC const *__pyx_v_src) { + int __pyx_t_1; + struct __pyx_t_5spacy_7structs_TokenC const *__pyx_t_2; + std::vector __pyx_t_3; + std::set __pyx_t_4; + std::vector __pyx_t_5; + std::vector __pyx_t_6; + std::unordered_map > __pyx_t_7; + struct __pyx_t_5spacy_7structs_TokenC __pyx_t_8; + + /* "spacy/pipeline/_parser_internals/_state.pxd":397 + * + * inline void clone(const StateC* src) noexcept nogil: + * this.length = src.length # <<<<<<<<<<<<<< + * this._sent = src._sent + * this._stack = src._stack +*/ + __pyx_t_1 = __pyx_v_src->length; + this->length = __pyx_t_1; + + /* "spacy/pipeline/_parser_internals/_state.pxd":398 + * inline void clone(const StateC* src) noexcept nogil: + * this.length = src.length + * this._sent = src._sent # <<<<<<<<<<<<<< + * this._stack = src._stack + * this._rebuffer = src._rebuffer +*/ + __pyx_t_2 = __pyx_v_src->_sent; + this->_sent = __pyx_t_2; + + /* "spacy/pipeline/_parser_internals/_state.pxd":399 + * this.length = src.length + * this._sent = src._sent + * this._stack = src._stack # <<<<<<<<<<<<<< + * this._rebuffer = src._rebuffer + * this._sent_starts = src._sent_starts +*/ + __pyx_t_3 = __pyx_v_src->_stack; + this->_stack = __PYX_STD_MOVE_IF_SUPPORTED(__pyx_t_3); + + /* "spacy/pipeline/_parser_internals/_state.pxd":400 + * this._sent = src._sent + * this._stack = src._stack + * this._rebuffer = src._rebuffer # <<<<<<<<<<<<<< + * this._sent_starts = src._sent_starts + * this._unshiftable = src._unshiftable +*/ + __pyx_t_3 = __pyx_v_src->_rebuffer; + this->_rebuffer = __PYX_STD_MOVE_IF_SUPPORTED(__pyx_t_3); + + /* "spacy/pipeline/_parser_internals/_state.pxd":401 + * this._stack = src._stack + * this._rebuffer = src._rebuffer + * this._sent_starts = src._sent_starts # <<<<<<<<<<<<<< + * this._unshiftable = src._unshiftable + * memcpy(this._heads, src._heads, this.length * sizeof(this._heads[0])) +*/ + __pyx_t_4 = __pyx_v_src->_sent_starts; + this->_sent_starts = __PYX_STD_MOVE_IF_SUPPORTED(__pyx_t_4); + + /* "spacy/pipeline/_parser_internals/_state.pxd":402 + * this._rebuffer = src._rebuffer + * this._sent_starts = src._sent_starts + * this._unshiftable = src._unshiftable # <<<<<<<<<<<<<< + * memcpy(this._heads, src._heads, this.length * sizeof(this._heads[0])) + * this._ents = src._ents +*/ + __pyx_t_5 = __pyx_v_src->_unshiftable; + this->_unshiftable = __PYX_STD_MOVE_IF_SUPPORTED(__pyx_t_5); + + /* "spacy/pipeline/_parser_internals/_state.pxd":403 + * this._sent_starts = src._sent_starts + * this._unshiftable = src._unshiftable + * memcpy(this._heads, src._heads, this.length * sizeof(this._heads[0])) # <<<<<<<<<<<<<< + * this._ents = src._ents + * this._left_arcs = src._left_arcs +*/ + (void)(memcpy(this->_heads, __pyx_v_src->_heads, (this->length * (sizeof((this->_heads[0])))))); + + /* "spacy/pipeline/_parser_internals/_state.pxd":404 + * this._unshiftable = src._unshiftable + * memcpy(this._heads, src._heads, this.length * sizeof(this._heads[0])) + * this._ents = src._ents # <<<<<<<<<<<<<< + * this._left_arcs = src._left_arcs + * this._right_arcs = src._right_arcs +*/ + __pyx_t_6 = __pyx_v_src->_ents; + this->_ents = __PYX_STD_MOVE_IF_SUPPORTED(__pyx_t_6); + + /* "spacy/pipeline/_parser_internals/_state.pxd":405 + * memcpy(this._heads, src._heads, this.length * sizeof(this._heads[0])) + * this._ents = src._ents + * this._left_arcs = src._left_arcs # <<<<<<<<<<<<<< + * this._right_arcs = src._right_arcs + * this._b_i = src._b_i +*/ + __pyx_t_7 = __pyx_v_src->_left_arcs; + this->_left_arcs = __PYX_STD_MOVE_IF_SUPPORTED(__pyx_t_7); + + /* "spacy/pipeline/_parser_internals/_state.pxd":406 + * this._ents = src._ents + * this._left_arcs = src._left_arcs + * this._right_arcs = src._right_arcs # <<<<<<<<<<<<<< + * this._b_i = src._b_i + * this.offset = src.offset +*/ + __pyx_t_7 = __pyx_v_src->_right_arcs; + this->_right_arcs = __PYX_STD_MOVE_IF_SUPPORTED(__pyx_t_7); + + /* "spacy/pipeline/_parser_internals/_state.pxd":407 + * this._left_arcs = src._left_arcs + * this._right_arcs = src._right_arcs + * this._b_i = src._b_i # <<<<<<<<<<<<<< + * this.offset = src.offset + * this._empty_token = src._empty_token +*/ + __pyx_t_1 = __pyx_v_src->_b_i; + this->_b_i = __pyx_t_1; + + /* "spacy/pipeline/_parser_internals/_state.pxd":408 + * this._right_arcs = src._right_arcs + * this._b_i = src._b_i + * this.offset = src.offset # <<<<<<<<<<<<<< + * this._empty_token = src._empty_token +*/ + __pyx_t_1 = __pyx_v_src->offset; + this->offset = __pyx_t_1; + + /* "spacy/pipeline/_parser_internals/_state.pxd":409 + * this._b_i = src._b_i + * this.offset = src.offset + * this._empty_token = src._empty_token # <<<<<<<<<<<<<< +*/ + __pyx_t_8 = __pyx_v_src->_empty_token; + this->_empty_token = __pyx_t_8; + + /* "spacy/pipeline/_parser_internals/_state.pxd":396 + * this._ents.back().end = this.B(0)+1 + * + * inline void clone(const StateC* src) noexcept nogil: # <<<<<<<<<<<<<< + * this.length = src.length + * this._sent = src._sent +*/ + + /* function exit code */ +} +/* #### 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); + __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); + __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); + PyObject *__pyx_t_1 = NULL; + int __pyx_lineno = 0; + const char *__pyx_filename = NULL; + int __pyx_clineno = 0; + __Pyx_RefNannySetupContext("__Pyx_modinit_type_import_code", 0); + /*--- Type import code ---*/ + __pyx_t_1 = PyImport_ImportModule(__Pyx_BUILTIN_MODULE_NAME); if (unlikely(!__pyx_t_1)) __PYX_ERR(4, 9, __pyx_L1_error) + __Pyx_GOTREF(__pyx_t_1); + __pyx_mstate->__pyx_ptype_7cpython_4type_type = __Pyx_ImportType_3_2_1(__pyx_t_1, __Pyx_BUILTIN_MODULE_NAME, "type", + #if defined(PYPY_VERSION_NUM) && PYPY_VERSION_NUM < 0x050B0000 + sizeof(PyTypeObject), __PYX_GET_STRUCT_ALIGNMENT_3_2_1(PyTypeObject), + #elif CYTHON_COMPILING_IN_LIMITED_API + 0, 0, + #else + sizeof(PyHeapTypeObject), __PYX_GET_STRUCT_ALIGNMENT_3_2_1(PyHeapTypeObject), + #endif + __Pyx_ImportType_CheckSize_Warn_3_2_1); if (!__pyx_mstate->__pyx_ptype_7cpython_4type_type) __PYX_ERR(4, 9, __pyx_L1_error) + __Pyx_DECREF(__pyx_t_1); __pyx_t_1 = 0; + __pyx_t_1 = PyImport_ImportModule("numpy"); if (unlikely(!__pyx_t_1)) __PYX_ERR(1, 228, __pyx_L1_error) + __Pyx_GOTREF(__pyx_t_1); + __pyx_mstate->__pyx_ptype_5numpy_dtype = __Pyx_ImportType_3_2_1(__pyx_t_1, "numpy", "dtype", + #if defined(PYPY_VERSION_NUM) && PYPY_VERSION_NUM < 0x050B0000 + sizeof(PyArray_Descr), __PYX_GET_STRUCT_ALIGNMENT_3_2_1(PyArray_Descr), + #elif CYTHON_COMPILING_IN_LIMITED_API + sizeof(PyArray_Descr), __PYX_GET_STRUCT_ALIGNMENT_3_2_1(PyArray_Descr), + #else + sizeof(PyArray_Descr), __PYX_GET_STRUCT_ALIGNMENT_3_2_1(PyArray_Descr), + #endif + __Pyx_ImportType_CheckSize_Ignore_3_2_1); if (!__pyx_mstate->__pyx_ptype_5numpy_dtype) __PYX_ERR(1, 228, __pyx_L1_error) + __pyx_mstate->__pyx_ptype_5numpy_flatiter = __Pyx_ImportType_3_2_1(__pyx_t_1, "numpy", "flatiter", + #if defined(PYPY_VERSION_NUM) && PYPY_VERSION_NUM < 0x050B0000 + sizeof(PyArrayIterObject), __PYX_GET_STRUCT_ALIGNMENT_3_2_1(PyArrayIterObject), + #elif CYTHON_COMPILING_IN_LIMITED_API + sizeof(PyArrayIterObject), __PYX_GET_STRUCT_ALIGNMENT_3_2_1(PyArrayIterObject), + #else + sizeof(PyArrayIterObject), __PYX_GET_STRUCT_ALIGNMENT_3_2_1(PyArrayIterObject), + #endif + __Pyx_ImportType_CheckSize_Ignore_3_2_1); if (!__pyx_mstate->__pyx_ptype_5numpy_flatiter) __PYX_ERR(1, 273, __pyx_L1_error) + __pyx_mstate->__pyx_ptype_5numpy_broadcast = __Pyx_ImportType_3_2_1(__pyx_t_1, "numpy", "broadcast", + #if defined(PYPY_VERSION_NUM) && PYPY_VERSION_NUM < 0x050B0000 + sizeof(PyArrayMultiIterObject), __PYX_GET_STRUCT_ALIGNMENT_3_2_1(PyArrayMultiIterObject), + #elif CYTHON_COMPILING_IN_LIMITED_API + sizeof(PyArrayMultiIterObject), __PYX_GET_STRUCT_ALIGNMENT_3_2_1(PyArrayMultiIterObject), + #else + sizeof(PyArrayMultiIterObject), __PYX_GET_STRUCT_ALIGNMENT_3_2_1(PyArrayMultiIterObject), + #endif + __Pyx_ImportType_CheckSize_Ignore_3_2_1); if (!__pyx_mstate->__pyx_ptype_5numpy_broadcast) __PYX_ERR(1, 277, __pyx_L1_error) + __pyx_mstate->__pyx_ptype_5numpy_ndarray = __Pyx_ImportType_3_2_1(__pyx_t_1, "numpy", "ndarray", + #if defined(PYPY_VERSION_NUM) && PYPY_VERSION_NUM < 0x050B0000 + sizeof(PyArrayObject), __PYX_GET_STRUCT_ALIGNMENT_3_2_1(PyArrayObject), + #elif CYTHON_COMPILING_IN_LIMITED_API + sizeof(PyArrayObject), __PYX_GET_STRUCT_ALIGNMENT_3_2_1(PyArrayObject), + #else + sizeof(PyArrayObject), __PYX_GET_STRUCT_ALIGNMENT_3_2_1(PyArrayObject), + #endif + __Pyx_ImportType_CheckSize_Ignore_3_2_1); if (!__pyx_mstate->__pyx_ptype_5numpy_ndarray) __PYX_ERR(1, 316, __pyx_L1_error) + __pyx_mstate->__pyx_ptype_5numpy_generic = __Pyx_ImportType_3_2_1(__pyx_t_1, "numpy", "generic", + #if defined(PYPY_VERSION_NUM) && PYPY_VERSION_NUM < 0x050B0000 + sizeof(PyObject), __PYX_GET_STRUCT_ALIGNMENT_3_2_1(PyObject), + #elif CYTHON_COMPILING_IN_LIMITED_API + sizeof(PyObject), __PYX_GET_STRUCT_ALIGNMENT_3_2_1(PyObject), + #else + sizeof(PyObject), __PYX_GET_STRUCT_ALIGNMENT_3_2_1(PyObject), + #endif + __Pyx_ImportType_CheckSize_Warn_3_2_1); if (!__pyx_mstate->__pyx_ptype_5numpy_generic) __PYX_ERR(1, 825, __pyx_L1_error) + __pyx_mstate->__pyx_ptype_5numpy_number = __Pyx_ImportType_3_2_1(__pyx_t_1, "numpy", "number", + #if defined(PYPY_VERSION_NUM) && PYPY_VERSION_NUM < 0x050B0000 + sizeof(PyObject), __PYX_GET_STRUCT_ALIGNMENT_3_2_1(PyObject), + #elif CYTHON_COMPILING_IN_LIMITED_API + sizeof(PyObject), __PYX_GET_STRUCT_ALIGNMENT_3_2_1(PyObject), + #else + sizeof(PyObject), __PYX_GET_STRUCT_ALIGNMENT_3_2_1(PyObject), + #endif + __Pyx_ImportType_CheckSize_Warn_3_2_1); if (!__pyx_mstate->__pyx_ptype_5numpy_number) __PYX_ERR(1, 827, __pyx_L1_error) + __pyx_mstate->__pyx_ptype_5numpy_integer = __Pyx_ImportType_3_2_1(__pyx_t_1, "numpy", "integer", + #if defined(PYPY_VERSION_NUM) && PYPY_VERSION_NUM < 0x050B0000 + sizeof(PyObject), __PYX_GET_STRUCT_ALIGNMENT_3_2_1(PyObject), + #elif CYTHON_COMPILING_IN_LIMITED_API + sizeof(PyObject), __PYX_GET_STRUCT_ALIGNMENT_3_2_1(PyObject), + #else + sizeof(PyObject), __PYX_GET_STRUCT_ALIGNMENT_3_2_1(PyObject), + #endif + __Pyx_ImportType_CheckSize_Warn_3_2_1); if (!__pyx_mstate->__pyx_ptype_5numpy_integer) __PYX_ERR(1, 829, __pyx_L1_error) + __pyx_mstate->__pyx_ptype_5numpy_signedinteger = __Pyx_ImportType_3_2_1(__pyx_t_1, "numpy", "signedinteger", + #if defined(PYPY_VERSION_NUM) && PYPY_VERSION_NUM < 0x050B0000 + sizeof(PyObject), __PYX_GET_STRUCT_ALIGNMENT_3_2_1(PyObject), + #elif CYTHON_COMPILING_IN_LIMITED_API + sizeof(PyObject), __PYX_GET_STRUCT_ALIGNMENT_3_2_1(PyObject), + #else + sizeof(PyObject), __PYX_GET_STRUCT_ALIGNMENT_3_2_1(PyObject), + #endif + __Pyx_ImportType_CheckSize_Warn_3_2_1); if (!__pyx_mstate->__pyx_ptype_5numpy_signedinteger) __PYX_ERR(1, 831, __pyx_L1_error) + __pyx_mstate->__pyx_ptype_5numpy_unsignedinteger = __Pyx_ImportType_3_2_1(__pyx_t_1, "numpy", "unsignedinteger", + #if defined(PYPY_VERSION_NUM) && PYPY_VERSION_NUM < 0x050B0000 + sizeof(PyObject), __PYX_GET_STRUCT_ALIGNMENT_3_2_1(PyObject), + #elif CYTHON_COMPILING_IN_LIMITED_API + sizeof(PyObject), __PYX_GET_STRUCT_ALIGNMENT_3_2_1(PyObject), + #else + sizeof(PyObject), __PYX_GET_STRUCT_ALIGNMENT_3_2_1(PyObject), + #endif + __Pyx_ImportType_CheckSize_Warn_3_2_1); if (!__pyx_mstate->__pyx_ptype_5numpy_unsignedinteger) __PYX_ERR(1, 833, __pyx_L1_error) + __pyx_mstate->__pyx_ptype_5numpy_inexact = __Pyx_ImportType_3_2_1(__pyx_t_1, "numpy", "inexact", + #if defined(PYPY_VERSION_NUM) && PYPY_VERSION_NUM < 0x050B0000 + sizeof(PyObject), __PYX_GET_STRUCT_ALIGNMENT_3_2_1(PyObject), + #elif CYTHON_COMPILING_IN_LIMITED_API + sizeof(PyObject), __PYX_GET_STRUCT_ALIGNMENT_3_2_1(PyObject), + #else + sizeof(PyObject), __PYX_GET_STRUCT_ALIGNMENT_3_2_1(PyObject), + #endif + __Pyx_ImportType_CheckSize_Warn_3_2_1); if (!__pyx_mstate->__pyx_ptype_5numpy_inexact) __PYX_ERR(1, 835, __pyx_L1_error) + __pyx_mstate->__pyx_ptype_5numpy_floating = __Pyx_ImportType_3_2_1(__pyx_t_1, "numpy", "floating", + #if defined(PYPY_VERSION_NUM) && PYPY_VERSION_NUM < 0x050B0000 + sizeof(PyObject), __PYX_GET_STRUCT_ALIGNMENT_3_2_1(PyObject), + #elif CYTHON_COMPILING_IN_LIMITED_API + sizeof(PyObject), __PYX_GET_STRUCT_ALIGNMENT_3_2_1(PyObject), + #else + sizeof(PyObject), __PYX_GET_STRUCT_ALIGNMENT_3_2_1(PyObject), + #endif + __Pyx_ImportType_CheckSize_Warn_3_2_1); if (!__pyx_mstate->__pyx_ptype_5numpy_floating) __PYX_ERR(1, 837, __pyx_L1_error) + __pyx_mstate->__pyx_ptype_5numpy_complexfloating = __Pyx_ImportType_3_2_1(__pyx_t_1, "numpy", "complexfloating", + #if defined(PYPY_VERSION_NUM) && PYPY_VERSION_NUM < 0x050B0000 + sizeof(PyObject), __PYX_GET_STRUCT_ALIGNMENT_3_2_1(PyObject), + #elif CYTHON_COMPILING_IN_LIMITED_API + sizeof(PyObject), __PYX_GET_STRUCT_ALIGNMENT_3_2_1(PyObject), + #else + sizeof(PyObject), __PYX_GET_STRUCT_ALIGNMENT_3_2_1(PyObject), + #endif + __Pyx_ImportType_CheckSize_Warn_3_2_1); if (!__pyx_mstate->__pyx_ptype_5numpy_complexfloating) __PYX_ERR(1, 839, __pyx_L1_error) + __pyx_mstate->__pyx_ptype_5numpy_flexible = __Pyx_ImportType_3_2_1(__pyx_t_1, "numpy", "flexible", + #if defined(PYPY_VERSION_NUM) && PYPY_VERSION_NUM < 0x050B0000 + sizeof(PyObject), __PYX_GET_STRUCT_ALIGNMENT_3_2_1(PyObject), + #elif CYTHON_COMPILING_IN_LIMITED_API + sizeof(PyObject), __PYX_GET_STRUCT_ALIGNMENT_3_2_1(PyObject), + #else + sizeof(PyObject), __PYX_GET_STRUCT_ALIGNMENT_3_2_1(PyObject), + #endif + __Pyx_ImportType_CheckSize_Warn_3_2_1); if (!__pyx_mstate->__pyx_ptype_5numpy_flexible) __PYX_ERR(1, 841, __pyx_L1_error) + __pyx_mstate->__pyx_ptype_5numpy_character = __Pyx_ImportType_3_2_1(__pyx_t_1, "numpy", "character", + #if defined(PYPY_VERSION_NUM) && PYPY_VERSION_NUM < 0x050B0000 + sizeof(PyObject), __PYX_GET_STRUCT_ALIGNMENT_3_2_1(PyObject), + #elif CYTHON_COMPILING_IN_LIMITED_API + sizeof(PyObject), __PYX_GET_STRUCT_ALIGNMENT_3_2_1(PyObject), + #else + sizeof(PyObject), __PYX_GET_STRUCT_ALIGNMENT_3_2_1(PyObject), + #endif + __Pyx_ImportType_CheckSize_Warn_3_2_1); if (!__pyx_mstate->__pyx_ptype_5numpy_character) __PYX_ERR(1, 843, __pyx_L1_error) + __pyx_mstate->__pyx_ptype_5numpy_ufunc = __Pyx_ImportType_3_2_1(__pyx_t_1, "numpy", "ufunc", + #if defined(PYPY_VERSION_NUM) && PYPY_VERSION_NUM < 0x050B0000 + sizeof(PyUFuncObject), __PYX_GET_STRUCT_ALIGNMENT_3_2_1(PyUFuncObject), + #elif CYTHON_COMPILING_IN_LIMITED_API + sizeof(PyUFuncObject), __PYX_GET_STRUCT_ALIGNMENT_3_2_1(PyUFuncObject), + #else + sizeof(PyUFuncObject), __PYX_GET_STRUCT_ALIGNMENT_3_2_1(PyUFuncObject), + #endif + __Pyx_ImportType_CheckSize_Ignore_3_2_1); if (!__pyx_mstate->__pyx_ptype_5numpy_ufunc) __PYX_ERR(1, 907, __pyx_L1_error) + __Pyx_DECREF(__pyx_t_1); __pyx_t_1 = 0; + __pyx_t_1 = PyImport_ImportModule("cymem.cymem"); if (unlikely(!__pyx_t_1)) __PYX_ERR(5, 4, __pyx_L1_error) + __Pyx_GOTREF(__pyx_t_1); + __pyx_mstate->__pyx_ptype_5cymem_5cymem_PyMalloc = __Pyx_ImportType_3_2_1(__pyx_t_1, "cymem.cymem", "PyMalloc", + #if defined(PYPY_VERSION_NUM) && PYPY_VERSION_NUM < 0x050B0000 + sizeof(struct __pyx_obj_5cymem_5cymem_PyMalloc), __PYX_GET_STRUCT_ALIGNMENT_3_2_1(struct __pyx_obj_5cymem_5cymem_PyMalloc), + #elif CYTHON_COMPILING_IN_LIMITED_API + sizeof(struct __pyx_obj_5cymem_5cymem_PyMalloc), __PYX_GET_STRUCT_ALIGNMENT_3_2_1(struct __pyx_obj_5cymem_5cymem_PyMalloc), + #else + sizeof(struct __pyx_obj_5cymem_5cymem_PyMalloc), __PYX_GET_STRUCT_ALIGNMENT_3_2_1(struct __pyx_obj_5cymem_5cymem_PyMalloc), + #endif + __Pyx_ImportType_CheckSize_Warn_3_2_1); if (!__pyx_mstate->__pyx_ptype_5cymem_5cymem_PyMalloc) __PYX_ERR(5, 4, __pyx_L1_error) + __pyx_vtabptr_5cymem_5cymem_PyMalloc = (struct __pyx_vtabstruct_5cymem_5cymem_PyMalloc*)__Pyx_GetVtable(__pyx_mstate->__pyx_ptype_5cymem_5cymem_PyMalloc); if (unlikely(!__pyx_vtabptr_5cymem_5cymem_PyMalloc)) __PYX_ERR(5, 4, __pyx_L1_error) + __pyx_mstate->__pyx_ptype_5cymem_5cymem_PyFree = __Pyx_ImportType_3_2_1(__pyx_t_1, "cymem.cymem", "PyFree", + #if defined(PYPY_VERSION_NUM) && PYPY_VERSION_NUM < 0x050B0000 + sizeof(struct __pyx_obj_5cymem_5cymem_PyFree), __PYX_GET_STRUCT_ALIGNMENT_3_2_1(struct __pyx_obj_5cymem_5cymem_PyFree), + #elif CYTHON_COMPILING_IN_LIMITED_API + sizeof(struct __pyx_obj_5cymem_5cymem_PyFree), __PYX_GET_STRUCT_ALIGNMENT_3_2_1(struct __pyx_obj_5cymem_5cymem_PyFree), + #else + sizeof(struct __pyx_obj_5cymem_5cymem_PyFree), __PYX_GET_STRUCT_ALIGNMENT_3_2_1(struct __pyx_obj_5cymem_5cymem_PyFree), + #endif + __Pyx_ImportType_CheckSize_Warn_3_2_1); if (!__pyx_mstate->__pyx_ptype_5cymem_5cymem_PyFree) __PYX_ERR(5, 10, __pyx_L1_error) + __pyx_vtabptr_5cymem_5cymem_PyFree = (struct __pyx_vtabstruct_5cymem_5cymem_PyFree*)__Pyx_GetVtable(__pyx_mstate->__pyx_ptype_5cymem_5cymem_PyFree); if (unlikely(!__pyx_vtabptr_5cymem_5cymem_PyFree)) __PYX_ERR(5, 10, __pyx_L1_error) + __pyx_mstate->__pyx_ptype_5cymem_5cymem_Pool = __Pyx_ImportType_3_2_1(__pyx_t_1, "cymem.cymem", "Pool", + #if defined(PYPY_VERSION_NUM) && PYPY_VERSION_NUM < 0x050B0000 + sizeof(struct __pyx_obj_5cymem_5cymem_Pool), __PYX_GET_STRUCT_ALIGNMENT_3_2_1(struct __pyx_obj_5cymem_5cymem_Pool), + #elif CYTHON_COMPILING_IN_LIMITED_API + sizeof(struct __pyx_obj_5cymem_5cymem_Pool), __PYX_GET_STRUCT_ALIGNMENT_3_2_1(struct __pyx_obj_5cymem_5cymem_Pool), + #else + sizeof(struct __pyx_obj_5cymem_5cymem_Pool), __PYX_GET_STRUCT_ALIGNMENT_3_2_1(struct __pyx_obj_5cymem_5cymem_Pool), + #endif + __Pyx_ImportType_CheckSize_Warn_3_2_1); if (!__pyx_mstate->__pyx_ptype_5cymem_5cymem_Pool) __PYX_ERR(5, 16, __pyx_L1_error) + __pyx_vtabptr_5cymem_5cymem_Pool = (struct __pyx_vtabstruct_5cymem_5cymem_Pool*)__Pyx_GetVtable(__pyx_mstate->__pyx_ptype_5cymem_5cymem_Pool); if (unlikely(!__pyx_vtabptr_5cymem_5cymem_Pool)) __PYX_ERR(5, 16, __pyx_L1_error) + __pyx_mstate->__pyx_ptype_5cymem_5cymem_Address = __Pyx_ImportType_3_2_1(__pyx_t_1, "cymem.cymem", "Address", + #if defined(PYPY_VERSION_NUM) && PYPY_VERSION_NUM < 0x050B0000 + sizeof(struct __pyx_obj_5cymem_5cymem_Address), __PYX_GET_STRUCT_ALIGNMENT_3_2_1(struct __pyx_obj_5cymem_5cymem_Address), + #elif CYTHON_COMPILING_IN_LIMITED_API + sizeof(struct __pyx_obj_5cymem_5cymem_Address), __PYX_GET_STRUCT_ALIGNMENT_3_2_1(struct __pyx_obj_5cymem_5cymem_Address), + #else + sizeof(struct __pyx_obj_5cymem_5cymem_Address), __PYX_GET_STRUCT_ALIGNMENT_3_2_1(struct __pyx_obj_5cymem_5cymem_Address), + #endif + __Pyx_ImportType_CheckSize_Warn_3_2_1); if (!__pyx_mstate->__pyx_ptype_5cymem_5cymem_Address) __PYX_ERR(5, 28, __pyx_L1_error) + __Pyx_DECREF(__pyx_t_1); __pyx_t_1 = 0; + __pyx_t_1 = PyImport_ImportModule("preshed.maps"); if (unlikely(!__pyx_t_1)) __PYX_ERR(6, 45, __pyx_L1_error) + __Pyx_GOTREF(__pyx_t_1); + __pyx_mstate->__pyx_ptype_7preshed_4maps_PreshMap = __Pyx_ImportType_3_2_1(__pyx_t_1, "preshed.maps", "PreshMap", + #if defined(PYPY_VERSION_NUM) && PYPY_VERSION_NUM < 0x050B0000 + sizeof(struct __pyx_obj_7preshed_4maps_PreshMap), __PYX_GET_STRUCT_ALIGNMENT_3_2_1(struct __pyx_obj_7preshed_4maps_PreshMap), + #elif CYTHON_COMPILING_IN_LIMITED_API + sizeof(struct __pyx_obj_7preshed_4maps_PreshMap), __PYX_GET_STRUCT_ALIGNMENT_3_2_1(struct __pyx_obj_7preshed_4maps_PreshMap), + #else + sizeof(struct __pyx_obj_7preshed_4maps_PreshMap), __PYX_GET_STRUCT_ALIGNMENT_3_2_1(struct __pyx_obj_7preshed_4maps_PreshMap), + #endif + __Pyx_ImportType_CheckSize_Warn_3_2_1); if (!__pyx_mstate->__pyx_ptype_7preshed_4maps_PreshMap) __PYX_ERR(6, 45, __pyx_L1_error) + __pyx_vtabptr_7preshed_4maps_PreshMap = (struct __pyx_vtabstruct_7preshed_4maps_PreshMap*)__Pyx_GetVtable(__pyx_mstate->__pyx_ptype_7preshed_4maps_PreshMap); if (unlikely(!__pyx_vtabptr_7preshed_4maps_PreshMap)) __PYX_ERR(6, 45, __pyx_L1_error) + __pyx_mstate->__pyx_ptype_7preshed_4maps_PreshMapArray = __Pyx_ImportType_3_2_1(__pyx_t_1, "preshed.maps", "PreshMapArray", + #if defined(PYPY_VERSION_NUM) && PYPY_VERSION_NUM < 0x050B0000 + sizeof(struct __pyx_obj_7preshed_4maps_PreshMapArray), __PYX_GET_STRUCT_ALIGNMENT_3_2_1(struct __pyx_obj_7preshed_4maps_PreshMapArray), + #elif CYTHON_COMPILING_IN_LIMITED_API + sizeof(struct __pyx_obj_7preshed_4maps_PreshMapArray), __PYX_GET_STRUCT_ALIGNMENT_3_2_1(struct __pyx_obj_7preshed_4maps_PreshMapArray), + #else + sizeof(struct __pyx_obj_7preshed_4maps_PreshMapArray), __PYX_GET_STRUCT_ALIGNMENT_3_2_1(struct __pyx_obj_7preshed_4maps_PreshMapArray), + #endif + __Pyx_ImportType_CheckSize_Warn_3_2_1); if (!__pyx_mstate->__pyx_ptype_7preshed_4maps_PreshMapArray) __PYX_ERR(6, 53, __pyx_L1_error) + __pyx_vtabptr_7preshed_4maps_PreshMapArray = (struct __pyx_vtabstruct_7preshed_4maps_PreshMapArray*)__Pyx_GetVtable(__pyx_mstate->__pyx_ptype_7preshed_4maps_PreshMapArray); if (unlikely(!__pyx_vtabptr_7preshed_4maps_PreshMapArray)) __PYX_ERR(6, 53, __pyx_L1_error) + __Pyx_DECREF(__pyx_t_1); __pyx_t_1 = 0; + __pyx_t_1 = PyImport_ImportModule("spacy.strings"); if (unlikely(!__pyx_t_1)) __PYX_ERR(7, 22, __pyx_L1_error) + __Pyx_GOTREF(__pyx_t_1); + __pyx_mstate->__pyx_ptype_5spacy_7strings_StringStore = __Pyx_ImportType_3_2_1(__pyx_t_1, "spacy.strings", "StringStore", + #if defined(PYPY_VERSION_NUM) && PYPY_VERSION_NUM < 0x050B0000 + sizeof(struct __pyx_obj_5spacy_7strings_StringStore), __PYX_GET_STRUCT_ALIGNMENT_3_2_1(struct __pyx_obj_5spacy_7strings_StringStore), + #elif CYTHON_COMPILING_IN_LIMITED_API + sizeof(struct __pyx_obj_5spacy_7strings_StringStore), __PYX_GET_STRUCT_ALIGNMENT_3_2_1(struct __pyx_obj_5spacy_7strings_StringStore), + #else + sizeof(struct __pyx_obj_5spacy_7strings_StringStore), __PYX_GET_STRUCT_ALIGNMENT_3_2_1(struct __pyx_obj_5spacy_7strings_StringStore), + #endif + __Pyx_ImportType_CheckSize_Warn_3_2_1); if (!__pyx_mstate->__pyx_ptype_5spacy_7strings_StringStore) __PYX_ERR(7, 22, __pyx_L1_error) + __pyx_vtabptr_5spacy_7strings_StringStore = (struct __pyx_vtabstruct_5spacy_7strings_StringStore*)__Pyx_GetVtable(__pyx_mstate->__pyx_ptype_5spacy_7strings_StringStore); if (unlikely(!__pyx_vtabptr_5spacy_7strings_StringStore)) __PYX_ERR(7, 22, __pyx_L1_error) + __Pyx_DECREF(__pyx_t_1); __pyx_t_1 = 0; + __pyx_t_1 = PyImport_ImportModule("spacy.morphology"); if (unlikely(!__pyx_t_1)) __PYX_ERR(8, 11, __pyx_L1_error) + __Pyx_GOTREF(__pyx_t_1); + __pyx_mstate->__pyx_ptype_5spacy_10morphology_Morphology = __Pyx_ImportType_3_2_1(__pyx_t_1, "spacy.morphology", "Morphology", + #if defined(PYPY_VERSION_NUM) && PYPY_VERSION_NUM < 0x050B0000 + sizeof(struct __pyx_obj_5spacy_10morphology_Morphology), __PYX_GET_STRUCT_ALIGNMENT_3_2_1(struct __pyx_obj_5spacy_10morphology_Morphology), + #elif CYTHON_COMPILING_IN_LIMITED_API + sizeof(struct __pyx_obj_5spacy_10morphology_Morphology), __PYX_GET_STRUCT_ALIGNMENT_3_2_1(struct __pyx_obj_5spacy_10morphology_Morphology), + #else + sizeof(struct __pyx_obj_5spacy_10morphology_Morphology), __PYX_GET_STRUCT_ALIGNMENT_3_2_1(struct __pyx_obj_5spacy_10morphology_Morphology), + #endif + __Pyx_ImportType_CheckSize_Warn_3_2_1); if (!__pyx_mstate->__pyx_ptype_5spacy_10morphology_Morphology) __PYX_ERR(8, 11, __pyx_L1_error) + __pyx_vtabptr_5spacy_10morphology_Morphology = (struct __pyx_vtabstruct_5spacy_10morphology_Morphology*)__Pyx_GetVtable(__pyx_mstate->__pyx_ptype_5spacy_10morphology_Morphology); if (unlikely(!__pyx_vtabptr_5spacy_10morphology_Morphology)) __PYX_ERR(8, 11, __pyx_L1_error) + __Pyx_DECREF(__pyx_t_1); __pyx_t_1 = 0; + __pyx_t_1 = PyImport_ImportModule("spacy.vocab"); if (unlikely(!__pyx_t_1)) __PYX_ERR(9, 26, __pyx_L1_error) + __Pyx_GOTREF(__pyx_t_1); + __pyx_mstate->__pyx_ptype_5spacy_5vocab_Vocab = __Pyx_ImportType_3_2_1(__pyx_t_1, "spacy.vocab", "Vocab", + #if defined(PYPY_VERSION_NUM) && PYPY_VERSION_NUM < 0x050B0000 + sizeof(struct __pyx_obj_5spacy_5vocab_Vocab), __PYX_GET_STRUCT_ALIGNMENT_3_2_1(struct __pyx_obj_5spacy_5vocab_Vocab), + #elif CYTHON_COMPILING_IN_LIMITED_API + sizeof(struct __pyx_obj_5spacy_5vocab_Vocab), __PYX_GET_STRUCT_ALIGNMENT_3_2_1(struct __pyx_obj_5spacy_5vocab_Vocab), + #else + sizeof(struct __pyx_obj_5spacy_5vocab_Vocab), __PYX_GET_STRUCT_ALIGNMENT_3_2_1(struct __pyx_obj_5spacy_5vocab_Vocab), + #endif + __Pyx_ImportType_CheckSize_Warn_3_2_1); if (!__pyx_mstate->__pyx_ptype_5spacy_5vocab_Vocab) __PYX_ERR(9, 26, __pyx_L1_error) + __pyx_vtabptr_5spacy_5vocab_Vocab = (struct __pyx_vtabstruct_5spacy_5vocab_Vocab*)__Pyx_GetVtable(__pyx_mstate->__pyx_ptype_5spacy_5vocab_Vocab); if (unlikely(!__pyx_vtabptr_5spacy_5vocab_Vocab)) __PYX_ERR(9, 26, __pyx_L1_error) + __Pyx_DECREF(__pyx_t_1); __pyx_t_1 = 0; + __pyx_t_1 = PyImport_ImportModule("spacy.lexeme"); if (unlikely(!__pyx_t_1)) __PYX_ERR(2, 24, __pyx_L1_error) + __Pyx_GOTREF(__pyx_t_1); + __pyx_mstate->__pyx_ptype_5spacy_6lexeme_Lexeme = __Pyx_ImportType_3_2_1(__pyx_t_1, "spacy.lexeme", "Lexeme", + #if defined(PYPY_VERSION_NUM) && PYPY_VERSION_NUM < 0x050B0000 + sizeof(struct __pyx_obj_5spacy_6lexeme_Lexeme), __PYX_GET_STRUCT_ALIGNMENT_3_2_1(struct __pyx_obj_5spacy_6lexeme_Lexeme), + #elif CYTHON_COMPILING_IN_LIMITED_API + sizeof(struct __pyx_obj_5spacy_6lexeme_Lexeme), __PYX_GET_STRUCT_ALIGNMENT_3_2_1(struct __pyx_obj_5spacy_6lexeme_Lexeme), + #else + sizeof(struct __pyx_obj_5spacy_6lexeme_Lexeme), __PYX_GET_STRUCT_ALIGNMENT_3_2_1(struct __pyx_obj_5spacy_6lexeme_Lexeme), + #endif + __Pyx_ImportType_CheckSize_Warn_3_2_1); if (!__pyx_mstate->__pyx_ptype_5spacy_6lexeme_Lexeme) __PYX_ERR(2, 24, __pyx_L1_error) + __pyx_vtabptr_5spacy_6lexeme_Lexeme = (struct __pyx_vtabstruct_5spacy_6lexeme_Lexeme*)__Pyx_GetVtable(__pyx_mstate->__pyx_ptype_5spacy_6lexeme_Lexeme); if (unlikely(!__pyx_vtabptr_5spacy_6lexeme_Lexeme)) __PYX_ERR(2, 24, __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); + PyObject *__pyx_t_1 = NULL; + int __pyx_lineno = 0; + const char *__pyx_filename = NULL; + int __pyx_clineno = 0; + __Pyx_RefNannySetupContext("__Pyx_modinit_variable_import_code", 0); + /*--- Variable import code ---*/ + { + __pyx_t_1 = PyImport_ImportModule("spacy.vocab"); 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_struct___pyx_t_5spacy_7structs_L); + #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 + 39; + void **const __pyx_import_pointers[] = {(void **)&__pyx_vp_5spacy_5vocab_EMPTY_LEXEME, (void **) NULL}; + void **const *__pyx_import_pointer = __pyx_import_pointers; + const char *__pyx_import_current_signature = __pyx_import_signature; + while (*__pyx_import_pointer) { + if (__Pyx_ImportVoidPtr_3_2_1(__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_t_1 = PyImport_ImportModule("spacy.lexeme"); 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_pyx_t_5spacy_8typedefs_attr_t); + #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 + 71; + void **const __pyx_import_pointers[] = {(void **)&__pyx_vp_5spacy_6lexeme_OOV_RANK, (void **)&__pyx_vp_5spacy_6lexeme_EMPTY_LEXEME, (void **) NULL}; + void **const *__pyx_import_pointer = __pyx_import_pointers; + const char *__pyx_import_current_signature = __pyx_import_signature; + while (*__pyx_import_pointer) { + if (__Pyx_ImportVoidPtr_3_2_1(__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; +} + +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("murmurhash.mrmr"); 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_uint64_t_void_int_uint64_t_hash6); + #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 + 33; + void (**const __pyx_import_pointers[])(void) = {(void (**)(void))&__pyx_f_10murmurhash_4mrmr_hash64, (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_1(__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__state(PyObject* module); /*proto*/ +static PyModuleDef_Slot __pyx_moduledef_slots[] = { + {Py_mod_create, (void*)__pyx_pymod_create}, + {Py_mod_exec, (void*)__pyx_pymod_exec__state}, + #if CYTHON_COMPILING_IN_CPYTHON_FREETHREADING + {Py_mod_gil, Py_MOD_GIL_USED}, + #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, + "_state", + 0, /* 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__state(void) CYTHON_SMALL_CODE; /*proto*/ +__Pyx_PyMODINIT_FUNC PyInit__state(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__state(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 '_state' 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 "_state" 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__state", 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_spacy__pipeline___parser_internals___state) { + 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, "spacy.pipeline._parser_internals._state")) { + if (unlikely((PyDict_SetItemString(modules, "spacy.pipeline._parser_internals._state", __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); + (void)__Pyx_modinit_type_init_code(__pyx_mstate); + if (unlikely((__Pyx_modinit_type_import_code(__pyx_mstate) < 0))) __PYX_ERR(0, 1, __pyx_L1_error) + if (unlikely((__Pyx_modinit_variable_import_code(__pyx_mstate) < 0))) __PYX_ERR(0, 1, __pyx_L1_error) + if (unlikely((__Pyx_modinit_function_import_code(__pyx_mstate) < 0))) __PYX_ERR(0, 1, __pyx_L1_error) + /*--- Execution code ---*/ + + /* "spacy/pipeline/_parser_internals/_state.pyx":1 + * # cython: profile=False # <<<<<<<<<<<<<< +*/ + __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 spacy.pipeline._parser_internals._state", __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 spacy.pipeline._parser_internals._state"); + } + __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); + 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: 7; } index[] = {{1},{39},{34},{18},{8},{10},{8},{14},{12},{10},{8},{92},{51},{39}}; + #if (CYTHON_COMPRESS_STRINGS) == 2 /* compression: bz2 (267 bytes) */ +const char* const cstring = "BZh91AY&SY\277\271hO\000\000\025\337\200@\000@u\007\300\252\017\325`\277o\377`0\000\355\266\241*j1\rM\246\232M\001\246\215\000\000h5#M\r\000\000\000\000\006\200JS\002F\232i\352dmC\3224\000\r\005p\031r\217f\010q\307\300\366\t\221\250\371\032r,S\224\346\022*7\264\300\211\254\270\224\341 \223\256p\335\242\334n\030\206T\202o084C\314\0371\336\"\226\373\305\254\002%\037\020\254&\271\266A9\010\365p\213TeS\267\331\0320`\002\220\346\006K5\201\307\210\211O\331J\272\221\035o\0038\361k\302J\253\032%\224\313aRf\312K2\311\222\222R\207\014-P\274j\017\224\245\237\262\026\020K\232\025\024$\345\265\231\246\026$\\\314\022\273\350\3724\200\227)\025\013l\203\231K\027\244\203'\007\023~\306p\205\027\266\335U\230\277@D|J\222\n\017\342\356H\247\n\022\027\367-\t\340"; + PyObject *data = __Pyx_DecompressString(cstring, 267, 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 (207 bytes) */ +const char* const cstring = "x\332\215\216MK\003A\014\206\367\247\314Q\245\364T\2537\021\331S[+\"\242\247\220\316\246\354\340|9\363N\351\374{G\227B\321\213\271$y\362\274\220;_\\\254s\322!\311\334\025\013\303)qU{6V\006\205\240\214\213!\341\\+\2161\3761\2645^\310xBb-;\326\037D\216\333\336\312\205\241X\371\236<\273\237\036\353\221\016\340\335D?\013\333\351\222\005\203\354\271=B\004\3118\271\240\353\034YW\272E\215\322\224L\014$B\227\221\212\206\372\245\335L8\323Z\216\342\344\241\333n_\351\371\376q\325\365\233\247\227wZ\367o\375\246\377g\366__pyx_string_tab; + Py_ssize_t pos = 0; + for (int i = 0; i < 11; i++) { + Py_ssize_t bytes_length = index[i].length; + PyObject *string = PyUnicode_DecodeUTF8(bytes + pos, bytes_length, NULL); + if (likely(string) && i >= 3) 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 = 11; i < 14; 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 < 14; i++) { + if (unlikely(PyObject_Hash(stringtab[i]) == -1)) { + __PYX_ERR(0, 1, __pyx_L1_error) + } + } + #if CYTHON_IMMORTAL_CONSTANTS + { + PyObject **table = stringtab + 11; + for (Py_ssize_t i=0; i<3; ++i) { + #if CYTHON_COMPILING_IN_CPYTHON_FREETHREADING + Py_SET_REFCNT(table[i], _Py_IMMORTAL_REFCNT_LOCAL); + #else + Py_SET_REFCNT(table[i], _Py_IMMORTAL_INITIAL_REFCNT); + #endif + } + } + #endif + } + return 0; + __pyx_L1_error:; + return -1; +} +/* #### Code section: init_codeobjects ### */ + +static int __Pyx_CreateCodeObjects(__pyx_mstatetype *__pyx_mstate) { + CYTHON_UNUSED_VAR(__pyx_mstate); + return 0; +} +/* #### 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) + + 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 + +/* 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 +} + +/* PyObjectCall (used by PyObjectFastCall) */ +#if CYTHON_COMPILING_IN_CPYTHON +static CYTHON_INLINE PyObject* __Pyx_PyObject_Call(PyObject *func, PyObject *arg, PyObject *kw) { + PyObject *result; + ternaryfunc call = Py_TYPE(func)->tp_call; + if (unlikely(!call)) + return PyObject_Call(func, arg, kw); + if (unlikely(Py_EnterRecursiveCall(" 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 */ +#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 +} + +/* 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; +} + +/* tp_new */ +#if CYTHON_COMPILING_IN_LIMITED_API && __PYX_LIMITED_VERSION_HEX < 0x030A0000 +static PyObject* __Pyx_tp_new_fallback(PyObject* type_obj, PyObject* args, PyObject* kwargs) { + PyObject *new_func = NULL, *new_args = NULL, *obj; + Py_ssize_t i, nargs = PyTuple_Size(args); + if (unlikely(nargs < 0)) goto bad; + new_args = PyTuple_New(nargs + 1); + if (unlikely(!new_args)) goto bad; + for (i = 0; i < nargs + 1; i++) { + PyObject *item = (i == 0) ? type_obj : PyTuple_GetItem(args, i - 1); + if (unlikely(!item)) goto bad; + Py_INCREF(item); + if (unlikely(PyTuple_SetItem(new_args, i, item)) < 0) goto bad; + } + new_func = PyObject_GetAttrString(type_obj, "__new__"); + if (unlikely(!new_func)) goto bad; + obj = PyObject_Call(new_func, new_args, kwargs); + Py_DECREF(new_func); + Py_DECREF(new_args); + return obj; + bad: + Py_XDECREF(new_func); + Py_XDECREF(new_args); + return NULL; +} +#endif +static PyObject* __Pyx_tp_new_kwargs(PyObject* type_obj, PyObject* args, PyObject* kwargs) { + newfunc tp_new = __Pyx_PyType_TryGetSlot((PyTypeObject*)type_obj, tp_new, newfunc); +#if CYTHON_COMPILING_IN_LIMITED_API && __PYX_LIMITED_VERSION_HEX < 0x030A0000 + if (!tp_new) return __Pyx_tp_new_fallback(type_obj, args, kwargs); +#else + assert(tp_new != NULL); +#endif + return tp_new((PyTypeObject*)type_obj, args, kwargs); +} + +/* ExtTypeTest */ +static CYTHON_INLINE int __Pyx_TypeTest(PyObject *obj, PyTypeObject *type) { + __Pyx_TypeName obj_type_name; + __Pyx_TypeName type_name; + if (unlikely(!type)) { + PyErr_SetString(PyExc_SystemError, "Missing type object"); + return 0; + } + if (likely(__Pyx_TypeCheck(obj, type))) + return 1; + obj_type_name = __Pyx_PyType_GetFullyQualifiedName(Py_TYPE(obj)); + type_name = __Pyx_PyType_GetFullyQualifiedName(type); + PyErr_Format(PyExc_TypeError, + "Cannot convert " __Pyx_FMT_TYPENAME " to " __Pyx_FMT_TYPENAME, + obj_type_name, type_name); + __Pyx_DECREF_TypeName(obj_type_name); + __Pyx_DECREF_TypeName(type_name); + return 0; +} + +/* 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); +} + +/* TypeImport */ +#ifndef __PYX_HAVE_RT_ImportType_3_2_1 +#define __PYX_HAVE_RT_ImportType_3_2_1 +static PyTypeObject *__Pyx_ImportType_3_2_1(PyObject *module, const char *module_name, const char *class_name, + size_t size, size_t alignment, enum __Pyx_ImportType_CheckSize_3_2_1 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_1 && + ((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_1 && (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 + +/* GetVTable */ +static void* __Pyx_GetVtable(PyTypeObject *type) { + void* ptr; +#if CYTHON_COMPILING_IN_LIMITED_API + PyObject *ob = PyObject_GetAttr((PyObject *)type, __pyx_mstate_global->__pyx_n_u_pyx_vtable); +#else + PyObject *ob = PyObject_GetItem(type->tp_dict, __pyx_mstate_global->__pyx_n_u_pyx_vtable); +#endif + if (!ob) + goto bad; + ptr = PyCapsule_GetPointer(ob, 0); + if (!ptr && !PyErr_Occurred()) + PyErr_SetString(PyExc_RuntimeError, "invalid vtable found for imported type"); + Py_DECREF(ob); + return ptr; +bad: + Py_XDECREF(ob); + return NULL; +} + +/* PxdImportShared (used by VoidPtrImport) */ +#ifndef __PYX_HAVE_RT_ImportFromPxd_3_2_1 +#define __PYX_HAVE_RT_ImportFromPxd_3_2_1 +static int __Pyx_ImportFromPxd_3_2_1(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 + +/* VoidPtrImport */ +#ifndef __PYX_HAVE_RT_ImportVoidPtr_3_2_1 +#define __PYX_HAVE_RT_ImportVoidPtr_3_2_1 +static int __Pyx_ImportVoidPtr_3_2_1(PyObject *module, const char *name, void **p, const char *sig) { + return __Pyx_ImportFromPxd_3_2_1(module, name, p, sig, "variable"); +} +#endif + +/* FunctionImport */ +#ifndef __PYX_HAVE_RT_ImportFunction_3_2_1 +#define __PYX_HAVE_RT_ImportFunction_3_2_1 +static int __Pyx_ImportFunction_3_2_1(PyObject *module, const char *funcname, void (**f)(void), const char *sig) { + union { + void (*fp)(void); + void *p; + } tmp; + int result = __Pyx_ImportFromPxd_3_2_1(module, funcname, &tmp.p, sig, "function"); + if (result == 0) { + *f = tmp.fp; + } + return result; +} +#endif + +/* dict_setdefault (used by CLineInTraceback) */ +static CYTHON_INLINE PyObject *__Pyx_PyDict_SetDefault(PyObject *d, PyObject *key, PyObject *default_value) { + PyObject* value; +#if 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); +#elif PY_VERSION_HEX >= 0x030d0000 + PyDict_SetDefaultRef(d, key, default_value, &value); +#else + value = PyDict_SetDefault(d, key, default_value); + if (unlikely(!value)) return NULL; + Py_INCREF(value); +#endif + return value; +} + +/* 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 + +/* 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 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;\ + } + +/* Declarations */ +#if CYTHON_CCOMPLEX && (1) && (!0 || __cplusplus) + #ifdef __cplusplus + static CYTHON_INLINE __pyx_t_float_complex __pyx_t_float_complex_from_parts(float x, float y) { + return ::std::complex< float >(x, y); + } + #else + static CYTHON_INLINE __pyx_t_float_complex __pyx_t_float_complex_from_parts(float x, float y) { + return x + y*(__pyx_t_float_complex)_Complex_I; + } + #endif +#else + static CYTHON_INLINE __pyx_t_float_complex __pyx_t_float_complex_from_parts(float x, float y) { + __pyx_t_float_complex z; + z.real = x; + z.imag = y; + return z; + } +#endif + +/* Arithmetic */ +#if CYTHON_CCOMPLEX && (1) && (!0 || __cplusplus) +#else + static CYTHON_INLINE int __Pyx_c_eq_float(__pyx_t_float_complex a, __pyx_t_float_complex b) { + return (a.real == b.real) && (a.imag == b.imag); + } + static CYTHON_INLINE __pyx_t_float_complex __Pyx_c_sum_float(__pyx_t_float_complex a, __pyx_t_float_complex b) { + __pyx_t_float_complex z; + z.real = a.real + b.real; + z.imag = a.imag + b.imag; + return z; + } + static CYTHON_INLINE __pyx_t_float_complex __Pyx_c_diff_float(__pyx_t_float_complex a, __pyx_t_float_complex b) { + __pyx_t_float_complex z; + z.real = a.real - b.real; + z.imag = a.imag - b.imag; + return z; + } + static CYTHON_INLINE __pyx_t_float_complex __Pyx_c_prod_float(__pyx_t_float_complex a, __pyx_t_float_complex b) { + __pyx_t_float_complex z; + z.real = a.real * b.real - a.imag * b.imag; + z.imag = a.real * b.imag + a.imag * b.real; + return z; + } + #if 1 + static CYTHON_INLINE __pyx_t_float_complex __Pyx_c_quot_float(__pyx_t_float_complex a, __pyx_t_float_complex b) { + if (b.imag == 0) { + return __pyx_t_float_complex_from_parts(a.real / b.real, a.imag / b.real); + } else if (fabsf(b.real) >= fabsf(b.imag)) { + if (b.real == 0 && b.imag == 0) { + return __pyx_t_float_complex_from_parts(a.real / b.real, a.imag / b.imag); + } else { + float r = b.imag / b.real; + float s = (float)(1.0) / (b.real + b.imag * r); + return __pyx_t_float_complex_from_parts( + (a.real + a.imag * r) * s, (a.imag - a.real * r) * s); + } + } else { + float r = b.real / b.imag; + float s = (float)(1.0) / (b.imag + b.real * r); + return __pyx_t_float_complex_from_parts( + (a.real * r + a.imag) * s, (a.imag * r - a.real) * s); + } + } + #else + static CYTHON_INLINE __pyx_t_float_complex __Pyx_c_quot_float(__pyx_t_float_complex a, __pyx_t_float_complex b) { + if (b.imag == 0) { + return __pyx_t_float_complex_from_parts(a.real / b.real, a.imag / b.real); + } else { + float denom = b.real * b.real + b.imag * b.imag; + return __pyx_t_float_complex_from_parts( + (a.real * b.real + a.imag * b.imag) / denom, + (a.imag * b.real - a.real * b.imag) / denom); + } + } + #endif + static CYTHON_INLINE __pyx_t_float_complex __Pyx_c_neg_float(__pyx_t_float_complex a) { + __pyx_t_float_complex z; + z.real = -a.real; + z.imag = -a.imag; + return z; + } + static CYTHON_INLINE int __Pyx_c_is_zero_float(__pyx_t_float_complex a) { + return (a.real == 0) && (a.imag == 0); + } + static CYTHON_INLINE __pyx_t_float_complex __Pyx_c_conj_float(__pyx_t_float_complex a) { + __pyx_t_float_complex z; + z.real = a.real; + z.imag = -a.imag; + return z; + } + #if 1 + static CYTHON_INLINE float __Pyx_c_abs_float(__pyx_t_float_complex z) { + #if !defined(HAVE_HYPOT) || defined(_MSC_VER) + return sqrtf(z.real*z.real + z.imag*z.imag); + #else + return hypotf(z.real, z.imag); + #endif + } + static CYTHON_INLINE __pyx_t_float_complex __Pyx_c_pow_float(__pyx_t_float_complex a, __pyx_t_float_complex b) { + __pyx_t_float_complex z; + float r, lnr, theta, z_r, z_theta; + if (b.imag == 0 && b.real == (int)b.real) { + if (b.real < 0) { + float denom = a.real * a.real + a.imag * a.imag; + a.real = a.real / denom; + a.imag = -a.imag / denom; + b.real = -b.real; + } + switch ((int)b.real) { + case 0: + z.real = 1; + z.imag = 0; + return z; + case 1: + return a; + case 2: + return __Pyx_c_prod_float(a, a); + case 3: + z = __Pyx_c_prod_float(a, a); + return __Pyx_c_prod_float(z, a); + case 4: + z = __Pyx_c_prod_float(a, a); + return __Pyx_c_prod_float(z, z); + } + } + if (a.imag == 0) { + if (a.real == 0) { + return a; + } else if ((b.imag == 0) && (a.real >= 0)) { + z.real = powf(a.real, b.real); + z.imag = 0; + return z; + } else if (a.real > 0) { + r = a.real; + theta = 0; + } else { + r = -a.real; + theta = atan2f(0.0, -1.0); + } + } else { + r = __Pyx_c_abs_float(a); + theta = atan2f(a.imag, a.real); + } + lnr = logf(r); + z_r = expf(lnr * b.real - theta * b.imag); + z_theta = theta * b.real + lnr * b.imag; + z.real = z_r * cosf(z_theta); + z.imag = z_r * sinf(z_theta); + return z; + } + #endif +#endif + +/* Declarations */ +#if CYTHON_CCOMPLEX && (1) && (!0 || __cplusplus) + #ifdef __cplusplus + static CYTHON_INLINE __pyx_t_double_complex __pyx_t_double_complex_from_parts(double x, double y) { + return ::std::complex< double >(x, y); + } + #else + static CYTHON_INLINE __pyx_t_double_complex __pyx_t_double_complex_from_parts(double x, double y) { + return x + y*(__pyx_t_double_complex)_Complex_I; + } + #endif +#else + static CYTHON_INLINE __pyx_t_double_complex __pyx_t_double_complex_from_parts(double x, double y) { + __pyx_t_double_complex z; + z.real = x; + z.imag = y; + return z; + } +#endif + +/* Arithmetic */ +#if CYTHON_CCOMPLEX && (1) && (!0 || __cplusplus) +#else + static CYTHON_INLINE int __Pyx_c_eq_double(__pyx_t_double_complex a, __pyx_t_double_complex b) { + return (a.real == b.real) && (a.imag == b.imag); + } + static CYTHON_INLINE __pyx_t_double_complex __Pyx_c_sum_double(__pyx_t_double_complex a, __pyx_t_double_complex b) { + __pyx_t_double_complex z; + z.real = a.real + b.real; + z.imag = a.imag + b.imag; + return z; + } + static CYTHON_INLINE __pyx_t_double_complex __Pyx_c_diff_double(__pyx_t_double_complex a, __pyx_t_double_complex b) { + __pyx_t_double_complex z; + z.real = a.real - b.real; + z.imag = a.imag - b.imag; + return z; + } + static CYTHON_INLINE __pyx_t_double_complex __Pyx_c_prod_double(__pyx_t_double_complex a, __pyx_t_double_complex b) { + __pyx_t_double_complex z; + z.real = a.real * b.real - a.imag * b.imag; + z.imag = a.real * b.imag + a.imag * b.real; + return z; + } + #if 1 + static CYTHON_INLINE __pyx_t_double_complex __Pyx_c_quot_double(__pyx_t_double_complex a, __pyx_t_double_complex b) { + if (b.imag == 0) { + return __pyx_t_double_complex_from_parts(a.real / b.real, a.imag / b.real); + } else if (fabs(b.real) >= fabs(b.imag)) { + if (b.real == 0 && b.imag == 0) { + return __pyx_t_double_complex_from_parts(a.real / b.real, a.imag / b.imag); + } else { + double r = b.imag / b.real; + double s = (double)(1.0) / (b.real + b.imag * r); + return __pyx_t_double_complex_from_parts( + (a.real + a.imag * r) * s, (a.imag - a.real * r) * s); + } + } else { + double r = b.real / b.imag; + double s = (double)(1.0) / (b.imag + b.real * r); + return __pyx_t_double_complex_from_parts( + (a.real * r + a.imag) * s, (a.imag * r - a.real) * s); + } + } + #else + static CYTHON_INLINE __pyx_t_double_complex __Pyx_c_quot_double(__pyx_t_double_complex a, __pyx_t_double_complex b) { + if (b.imag == 0) { + return __pyx_t_double_complex_from_parts(a.real / b.real, a.imag / b.real); + } else { + double denom = b.real * b.real + b.imag * b.imag; + return __pyx_t_double_complex_from_parts( + (a.real * b.real + a.imag * b.imag) / denom, + (a.imag * b.real - a.real * b.imag) / denom); + } + } + #endif + static CYTHON_INLINE __pyx_t_double_complex __Pyx_c_neg_double(__pyx_t_double_complex a) { + __pyx_t_double_complex z; + z.real = -a.real; + z.imag = -a.imag; + return z; + } + static CYTHON_INLINE int __Pyx_c_is_zero_double(__pyx_t_double_complex a) { + return (a.real == 0) && (a.imag == 0); + } + static CYTHON_INLINE __pyx_t_double_complex __Pyx_c_conj_double(__pyx_t_double_complex a) { + __pyx_t_double_complex z; + z.real = a.real; + z.imag = -a.imag; + return z; + } + #if 1 + static CYTHON_INLINE double __Pyx_c_abs_double(__pyx_t_double_complex z) { + #if !defined(HAVE_HYPOT) || defined(_MSC_VER) + return sqrt(z.real*z.real + z.imag*z.imag); + #else + return hypot(z.real, z.imag); + #endif + } + static CYTHON_INLINE __pyx_t_double_complex __Pyx_c_pow_double(__pyx_t_double_complex a, __pyx_t_double_complex b) { + __pyx_t_double_complex z; + double r, lnr, theta, z_r, z_theta; + if (b.imag == 0 && b.real == (int)b.real) { + if (b.real < 0) { + double denom = a.real * a.real + a.imag * a.imag; + a.real = a.real / denom; + a.imag = -a.imag / denom; + b.real = -b.real; + } + switch ((int)b.real) { + case 0: + z.real = 1; + z.imag = 0; + return z; + case 1: + return a; + case 2: + return __Pyx_c_prod_double(a, a); + case 3: + z = __Pyx_c_prod_double(a, a); + return __Pyx_c_prod_double(z, a); + case 4: + z = __Pyx_c_prod_double(a, a); + return __Pyx_c_prod_double(z, z); + } + } + if (a.imag == 0) { + if (a.real == 0) { + return a; + } else if ((b.imag == 0) && (a.real >= 0)) { + z.real = pow(a.real, b.real); + z.imag = 0; + return z; + } else if (a.real > 0) { + r = a.real; + theta = 0; + } else { + r = -a.real; + theta = atan2(0.0, -1.0); + } + } else { + r = __Pyx_c_abs_double(a); + theta = atan2(a.imag, a.real); + } + lnr = log(r); + z_r = exp(lnr * b.real - theta * b.imag); + z_theta = theta * b.real + lnr * b.imag; + z.real = z_r * cos(z_theta); + z.imag = z_r * sin(z_theta); + return z; + } + #endif +#endif + +/* Declarations */ +#if CYTHON_CCOMPLEX && (1) && (!0 || __cplusplus) + #ifdef __cplusplus + static CYTHON_INLINE __pyx_t_long_double_complex __pyx_t_long_double_complex_from_parts(long double x, long double y) { + return ::std::complex< long double >(x, y); + } + #else + static CYTHON_INLINE __pyx_t_long_double_complex __pyx_t_long_double_complex_from_parts(long double x, long double y) { + return x + y*(__pyx_t_long_double_complex)_Complex_I; + } + #endif +#else + static CYTHON_INLINE __pyx_t_long_double_complex __pyx_t_long_double_complex_from_parts(long double x, long double y) { + __pyx_t_long_double_complex z; + z.real = x; + z.imag = y; + return z; + } +#endif + +/* Arithmetic */ +#if CYTHON_CCOMPLEX && (1) && (!0 || __cplusplus) +#else + static CYTHON_INLINE int __Pyx_c_eq_long__double(__pyx_t_long_double_complex a, __pyx_t_long_double_complex b) { + return (a.real == b.real) && (a.imag == b.imag); + } + static CYTHON_INLINE __pyx_t_long_double_complex __Pyx_c_sum_long__double(__pyx_t_long_double_complex a, __pyx_t_long_double_complex b) { + __pyx_t_long_double_complex z; + z.real = a.real + b.real; + z.imag = a.imag + b.imag; + return z; + } + static CYTHON_INLINE __pyx_t_long_double_complex __Pyx_c_diff_long__double(__pyx_t_long_double_complex a, __pyx_t_long_double_complex b) { + __pyx_t_long_double_complex z; + z.real = a.real - b.real; + z.imag = a.imag - b.imag; + return z; + } + static CYTHON_INLINE __pyx_t_long_double_complex __Pyx_c_prod_long__double(__pyx_t_long_double_complex a, __pyx_t_long_double_complex b) { + __pyx_t_long_double_complex z; + z.real = a.real * b.real - a.imag * b.imag; + z.imag = a.real * b.imag + a.imag * b.real; + return z; + } + #if 1 + static CYTHON_INLINE __pyx_t_long_double_complex __Pyx_c_quot_long__double(__pyx_t_long_double_complex a, __pyx_t_long_double_complex b) { + if (b.imag == 0) { + return __pyx_t_long_double_complex_from_parts(a.real / b.real, a.imag / b.real); + } else if (fabsl(b.real) >= fabsl(b.imag)) { + if (b.real == 0 && b.imag == 0) { + return __pyx_t_long_double_complex_from_parts(a.real / b.real, a.imag / b.imag); + } else { + long double r = b.imag / b.real; + long double s = (long double)(1.0) / (b.real + b.imag * r); + return __pyx_t_long_double_complex_from_parts( + (a.real + a.imag * r) * s, (a.imag - a.real * r) * s); + } + } else { + long double r = b.real / b.imag; + long double s = (long double)(1.0) / (b.imag + b.real * r); + return __pyx_t_long_double_complex_from_parts( + (a.real * r + a.imag) * s, (a.imag * r - a.real) * s); + } + } + #else + static CYTHON_INLINE __pyx_t_long_double_complex __Pyx_c_quot_long__double(__pyx_t_long_double_complex a, __pyx_t_long_double_complex b) { + if (b.imag == 0) { + return __pyx_t_long_double_complex_from_parts(a.real / b.real, a.imag / b.real); + } else { + long double denom = b.real * b.real + b.imag * b.imag; + return __pyx_t_long_double_complex_from_parts( + (a.real * b.real + a.imag * b.imag) / denom, + (a.imag * b.real - a.real * b.imag) / denom); + } + } + #endif + static CYTHON_INLINE __pyx_t_long_double_complex __Pyx_c_neg_long__double(__pyx_t_long_double_complex a) { + __pyx_t_long_double_complex z; + z.real = -a.real; + z.imag = -a.imag; + return z; + } + static CYTHON_INLINE int __Pyx_c_is_zero_long__double(__pyx_t_long_double_complex a) { + return (a.real == 0) && (a.imag == 0); + } + static CYTHON_INLINE __pyx_t_long_double_complex __Pyx_c_conj_long__double(__pyx_t_long_double_complex a) { + __pyx_t_long_double_complex z; + z.real = a.real; + z.imag = -a.imag; + return z; + } + #if 1 + static CYTHON_INLINE long double __Pyx_c_abs_long__double(__pyx_t_long_double_complex z) { + #if !defined(HAVE_HYPOT) || defined(_MSC_VER) + return sqrtl(z.real*z.real + z.imag*z.imag); + #else + return hypotl(z.real, z.imag); + #endif + } + static CYTHON_INLINE __pyx_t_long_double_complex __Pyx_c_pow_long__double(__pyx_t_long_double_complex a, __pyx_t_long_double_complex b) { + __pyx_t_long_double_complex z; + long double r, lnr, theta, z_r, z_theta; + if (b.imag == 0 && b.real == (int)b.real) { + if (b.real < 0) { + long double denom = a.real * a.real + a.imag * a.imag; + a.real = a.real / denom; + a.imag = -a.imag / denom; + b.real = -b.real; + } + switch ((int)b.real) { + case 0: + z.real = 1; + z.imag = 0; + return z; + case 1: + return a; + case 2: + return __Pyx_c_prod_long__double(a, a); + case 3: + z = __Pyx_c_prod_long__double(a, a); + return __Pyx_c_prod_long__double(z, a); + case 4: + z = __Pyx_c_prod_long__double(a, a); + return __Pyx_c_prod_long__double(z, z); + } + } + if (a.imag == 0) { + if (a.real == 0) { + return a; + } else if ((b.imag == 0) && (a.real >= 0)) { + z.real = powl(a.real, b.real); + z.imag = 0; + return z; + } else if (a.real > 0) { + r = a.real; + theta = 0; + } else { + r = -a.real; + theta = atan2l(0.0, -1.0); + } + } else { + r = __Pyx_c_abs_long__double(a); + theta = atan2l(a.imag, a.real); + } + lnr = logl(r); + z_r = expl(lnr * b.real - theta * b.imag); + z_theta = theta * b.real + lnr * b.imag; + z.real = z_r * cosl(z_theta); + z.imag = z_r * sinl(z_theta); + return z; + } + #endif +#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; + if (__Pyx_PyTuple_SET_ITEM(builder, n, key) != (0)) return -1; + Py_INCREF(key); + 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; +} + +/* CIntFromPy */ +static CYTHON_INLINE size_t __Pyx_PyLong_As_size_t(PyObject *x) { +#ifdef __Pyx_HAS_GCC_DIAGNOSTIC +#pragma GCC diagnostic push +#pragma GCC diagnostic ignored "-Wconversion" +#endif + const size_t neg_one = (size_t) -1, const_zero = (size_t) 0; +#ifdef __Pyx_HAS_GCC_DIAGNOSTIC +#pragma GCC diagnostic pop +#endif + const int is_unsigned = neg_one > const_zero; + if (unlikely(!PyLong_Check(x))) { + size_t val; + PyObject *tmp = __Pyx_PyNumber_Long(x); + if (!tmp) return (size_t) -1; + val = __Pyx_PyLong_As_size_t(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(size_t, __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(size_t) > 1 * PyLong_SHIFT)) { + if ((8 * sizeof(unsigned long) > 2 * PyLong_SHIFT)) { + __PYX_VERIFY_RETURN_INT(size_t, unsigned long, (((((unsigned long)digits[1]) << PyLong_SHIFT) | (unsigned long)digits[0]))) + } else if ((8 * sizeof(size_t) >= 2 * PyLong_SHIFT)) { + return (size_t) (((((size_t)digits[1]) << PyLong_SHIFT) | (size_t)digits[0])); + } + } + break; + case 3: + if ((8 * sizeof(size_t) > 2 * PyLong_SHIFT)) { + if ((8 * sizeof(unsigned long) > 3 * PyLong_SHIFT)) { + __PYX_VERIFY_RETURN_INT(size_t, unsigned long, (((((((unsigned long)digits[2]) << PyLong_SHIFT) | (unsigned long)digits[1]) << PyLong_SHIFT) | (unsigned long)digits[0]))) + } else if ((8 * sizeof(size_t) >= 3 * PyLong_SHIFT)) { + return (size_t) (((((((size_t)digits[2]) << PyLong_SHIFT) | (size_t)digits[1]) << PyLong_SHIFT) | (size_t)digits[0])); + } + } + break; + case 4: + if ((8 * sizeof(size_t) > 3 * PyLong_SHIFT)) { + if ((8 * sizeof(unsigned long) > 4 * PyLong_SHIFT)) { + __PYX_VERIFY_RETURN_INT(size_t, unsigned long, (((((((((unsigned long)digits[3]) << PyLong_SHIFT) | (unsigned long)digits[2]) << PyLong_SHIFT) | (unsigned long)digits[1]) << PyLong_SHIFT) | (unsigned long)digits[0]))) + } else if ((8 * sizeof(size_t) >= 4 * PyLong_SHIFT)) { + return (size_t) (((((((((size_t)digits[3]) << PyLong_SHIFT) | (size_t)digits[2]) << PyLong_SHIFT) | (size_t)digits[1]) << PyLong_SHIFT) | (size_t)digits[0])); + } + } + break; + } + } +#endif +#if CYTHON_COMPILING_IN_CPYTHON && 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 (size_t) -1; + if (unlikely(result == 1)) + goto raise_neg_overflow; + } +#endif + if ((sizeof(size_t) <= sizeof(unsigned long))) { + __PYX_VERIFY_RETURN_INT_EXC(size_t, unsigned long, PyLong_AsUnsignedLong(x)) + } else if ((sizeof(size_t) <= sizeof(unsigned PY_LONG_LONG))) { + __PYX_VERIFY_RETURN_INT_EXC(size_t, unsigned PY_LONG_LONG, PyLong_AsUnsignedLongLong(x)) + } + } else { +#if CYTHON_USE_PYLONG_INTERNALS + if (__Pyx_PyLong_IsCompact(x)) { + __PYX_VERIFY_RETURN_INT(size_t, __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(size_t) - 1 > 1 * PyLong_SHIFT)) { + if ((8 * sizeof(unsigned long) > 2 * PyLong_SHIFT)) { + __PYX_VERIFY_RETURN_INT(size_t, long, -(long) (((((unsigned long)digits[1]) << PyLong_SHIFT) | (unsigned long)digits[0]))) + } else if ((8 * sizeof(size_t) - 1 > 2 * PyLong_SHIFT)) { + return (size_t) (((size_t)-1)*(((((size_t)digits[1]) << PyLong_SHIFT) | (size_t)digits[0]))); + } + } + break; + case 2: + if ((8 * sizeof(size_t) > 1 * PyLong_SHIFT)) { + if ((8 * sizeof(unsigned long) > 2 * PyLong_SHIFT)) { + __PYX_VERIFY_RETURN_INT(size_t, unsigned long, (((((unsigned long)digits[1]) << PyLong_SHIFT) | (unsigned long)digits[0]))) + } else if ((8 * sizeof(size_t) - 1 > 2 * PyLong_SHIFT)) { + return (size_t) ((((((size_t)digits[1]) << PyLong_SHIFT) | (size_t)digits[0]))); + } + } + break; + case -3: + if ((8 * sizeof(size_t) - 1 > 2 * PyLong_SHIFT)) { + if ((8 * sizeof(unsigned long) > 3 * PyLong_SHIFT)) { + __PYX_VERIFY_RETURN_INT(size_t, long, -(long) (((((((unsigned long)digits[2]) << PyLong_SHIFT) | (unsigned long)digits[1]) << PyLong_SHIFT) | (unsigned long)digits[0]))) + } else if ((8 * sizeof(size_t) - 1 > 3 * PyLong_SHIFT)) { + return (size_t) (((size_t)-1)*(((((((size_t)digits[2]) << PyLong_SHIFT) | (size_t)digits[1]) << PyLong_SHIFT) | (size_t)digits[0]))); + } + } + break; + case 3: + if ((8 * sizeof(size_t) > 2 * PyLong_SHIFT)) { + if ((8 * sizeof(unsigned long) > 3 * PyLong_SHIFT)) { + __PYX_VERIFY_RETURN_INT(size_t, unsigned long, (((((((unsigned long)digits[2]) << PyLong_SHIFT) | (unsigned long)digits[1]) << PyLong_SHIFT) | (unsigned long)digits[0]))) + } else if ((8 * sizeof(size_t) - 1 > 3 * PyLong_SHIFT)) { + return (size_t) ((((((((size_t)digits[2]) << PyLong_SHIFT) | (size_t)digits[1]) << PyLong_SHIFT) | (size_t)digits[0]))); + } + } + break; + case -4: + if ((8 * sizeof(size_t) - 1 > 3 * PyLong_SHIFT)) { + if ((8 * sizeof(unsigned long) > 4 * PyLong_SHIFT)) { + __PYX_VERIFY_RETURN_INT(size_t, long, -(long) (((((((((unsigned long)digits[3]) << PyLong_SHIFT) | (unsigned long)digits[2]) << PyLong_SHIFT) | (unsigned long)digits[1]) << PyLong_SHIFT) | (unsigned long)digits[0]))) + } else if ((8 * sizeof(size_t) - 1 > 4 * PyLong_SHIFT)) { + return (size_t) (((size_t)-1)*(((((((((size_t)digits[3]) << PyLong_SHIFT) | (size_t)digits[2]) << PyLong_SHIFT) | (size_t)digits[1]) << PyLong_SHIFT) | (size_t)digits[0]))); + } + } + break; + case 4: + if ((8 * sizeof(size_t) > 3 * PyLong_SHIFT)) { + if ((8 * sizeof(unsigned long) > 4 * PyLong_SHIFT)) { + __PYX_VERIFY_RETURN_INT(size_t, unsigned long, (((((((((unsigned long)digits[3]) << PyLong_SHIFT) | (unsigned long)digits[2]) << PyLong_SHIFT) | (unsigned long)digits[1]) << PyLong_SHIFT) | (unsigned long)digits[0]))) + } else if ((8 * sizeof(size_t) - 1 > 4 * PyLong_SHIFT)) { + return (size_t) ((((((((((size_t)digits[3]) << PyLong_SHIFT) | (size_t)digits[2]) << PyLong_SHIFT) | (size_t)digits[1]) << PyLong_SHIFT) | (size_t)digits[0]))); + } + } + break; + } + } +#endif + if ((sizeof(size_t) <= sizeof(long))) { + __PYX_VERIFY_RETURN_INT_EXC(size_t, long, PyLong_AsLong(x)) + } else if ((sizeof(size_t) <= sizeof(PY_LONG_LONG))) { + __PYX_VERIFY_RETURN_INT_EXC(size_t, PY_LONG_LONG, PyLong_AsLongLong(x)) + } + } + { + size_t 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 (size_t) -1; + assert(PyLong_CheckExact(v)); + } + { + int result = PyObject_RichCompareBool(v, Py_False, Py_LT); + if (unlikely(result < 0)) { + Py_DECREF(v); + return (size_t) -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 (size_t) -1; + } else { + stepval = v; + } + v = NULL; + val = (size_t) 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(size_t) * 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 |= ((size_t) 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(size_t) * 8) - bits - (is_unsigned ? 0 : 1); + if (unlikely(idigit >= (1L << remaining_bits))) + goto raise_overflow; + val |= ((size_t) idigit) << bits; + } + if (!is_unsigned) { + if (unlikely(val & (((size_t) 1) << (sizeof(size_t) * 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 (size_t) -1; + return val; + } +raise_overflow: + PyErr_SetString(PyExc_OverflowError, + "value too large to convert to size_t"); + return (size_t) -1; +raise_neg_overflow: + PyErr_SetString(PyExc_OverflowError, + "can't convert negative value to size_t"); + return (size_t) -1; +} + +/* CIntToPy */ +static CYTHON_INLINE PyObject* __Pyx_PyLong_From_uint64_t(uint64_t value) { +#ifdef __Pyx_HAS_GCC_DIAGNOSTIC +#pragma GCC diagnostic push +#pragma GCC diagnostic ignored "-Wconversion" +#endif + const uint64_t neg_one = (uint64_t) -1, const_zero = (uint64_t) 0; +#ifdef __Pyx_HAS_GCC_DIAGNOSTIC +#pragma GCC diagnostic pop +#endif + const int is_unsigned = neg_one > const_zero; + if (is_unsigned) { + if (sizeof(uint64_t) < sizeof(long)) { + return PyLong_FromLong((long) value); + } else if (sizeof(uint64_t) <= sizeof(unsigned long)) { + return PyLong_FromUnsignedLong((unsigned long) value); +#if !CYTHON_COMPILING_IN_PYPY + } else if (sizeof(uint64_t) <= sizeof(unsigned PY_LONG_LONG)) { + return PyLong_FromUnsignedLongLong((unsigned PY_LONG_LONG) value); +#endif + } + } else { + if (sizeof(uint64_t) <= sizeof(long)) { + return PyLong_FromLong((long) value); + } else if (sizeof(uint64_t) <= 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(uint64_t), + 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(uint64_t)); + 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_); + } + 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 +} + +/* AddModuleRef */ +#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 + +/* 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); + } +} + +/* DecompressString */ +static PyObject *__Pyx_DecompressString(const char *s, Py_ssize_t length, int algo) { + PyObject *module, *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)) return NULL; + 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 */ diff --git a/TTS/Kokoro/.venv/Lib/site-packages/spacy/pipeline/_parser_internals/_state.pxd b/TTS/Kokoro/.venv/Lib/site-packages/spacy/pipeline/_parser_internals/_state.pxd new file mode 100644 index 0000000000000000000000000000000000000000..23f438db310afaab87de5cb836b12fcd212be002 --- /dev/null +++ b/TTS/Kokoro/.venv/Lib/site-packages/spacy/pipeline/_parser_internals/_state.pxd @@ -0,0 +1,409 @@ +cimport libcpp +from cpython.exc cimport PyErr_CheckSignals, PyErr_SetFromErrno +from cython.operator cimport dereference as deref +from cython.operator cimport preincrement as incr +from libc.stdint cimport uint32_t, uint64_t +from libc.stdlib cimport calloc, free +from libc.string cimport memcpy, memset +from libcpp.set cimport set +from libcpp.unordered_map cimport unordered_map +from libcpp.vector cimport vector +from murmurhash.mrmr cimport hash64 + +from ...attrs cimport IS_SPACE +from ...lexeme cimport Lexeme +from ...structs cimport SpanC, TokenC +from ...typedefs cimport attr_t +from ...vocab cimport EMPTY_LEXEME + + +cdef inline bint is_space_token(const TokenC* token) noexcept nogil: + return Lexeme.c_check_flag(token.lex, IS_SPACE) + +cdef struct ArcC: + int head + int child + attr_t label + + +cdef cppclass StateC: + int* _heads + const TokenC* _sent + vector[int] _stack + vector[int] _rebuffer + vector[SpanC] _ents + unordered_map[int, vector[ArcC]] _left_arcs + unordered_map[int, vector[ArcC]] _right_arcs + vector[libcpp.bool] _unshiftable + set[int] _sent_starts + TokenC _empty_token + int length + int offset + int _b_i + + inline __init__(const TokenC* sent, int length) noexcept nogil: + this._sent = sent + this._heads = calloc(length, sizeof(int)) + if not (this._sent and this._heads): + with gil: + PyErr_SetFromErrno(MemoryError) + PyErr_CheckSignals() + this.offset = 0 + this.length = length + this._b_i = 0 + for i in range(length): + this._heads[i] = -1 + this._unshiftable.push_back(0) + memset(&this._empty_token, 0, sizeof(TokenC)) + this._empty_token.lex = &EMPTY_LEXEME + + inline __dealloc__(): + free(this._heads) + + inline void set_context_tokens(int* ids, int n) noexcept nogil: + cdef int i, j + if n == 1: + if this.B(0) >= 0: + ids[0] = this.B(0) + else: + ids[0] = -1 + elif n == 2: + ids[0] = this.B(0) + ids[1] = this.S(0) + elif n == 3: + if this.B(0) >= 0: + ids[0] = this.B(0) + else: + ids[0] = -1 + # First word of entity, if any + if this.entity_is_open(): + ids[1] = this.E(0) + else: + ids[1] = -1 + # Last word of entity, if within entity + if ids[0] == -1 or ids[1] == -1: + ids[2] = -1 + else: + ids[2] = ids[0] - 1 + elif n == 8: + ids[0] = this.B(0) + ids[1] = this.B(1) + ids[2] = this.S(0) + ids[3] = this.S(1) + ids[4] = this.S(2) + ids[5] = this.L(this.B(0), 1) + ids[6] = this.L(this.S(0), 1) + ids[7] = this.R(this.S(0), 1) + elif n == 13: + ids[0] = this.B(0) + ids[1] = this.B(1) + ids[2] = this.S(0) + ids[3] = this.S(1) + ids[4] = this.S(2) + ids[5] = this.L(this.S(0), 1) + ids[6] = this.L(this.S(0), 2) + ids[6] = this.R(this.S(0), 1) + ids[7] = this.L(this.B(0), 1) + ids[8] = this.R(this.S(0), 2) + ids[9] = this.L(this.S(1), 1) + ids[10] = this.L(this.S(1), 2) + ids[11] = this.R(this.S(1), 1) + ids[12] = this.R(this.S(1), 2) + elif n == 6: + for i in range(6): + ids[i] = -1 + if this.B(0) >= 0: + ids[0] = this.B(0) + if this.entity_is_open(): + ent = this.get_ent() + j = 1 + for i in range(ent.start, this.B(0)): + ids[j] = i + j += 1 + if j >= 6: + break + else: + # TODO error =/ + pass + for i in range(n): + if ids[i] >= 0: + ids[i] += this.offset + else: + ids[i] = -1 + + inline int S(int i) noexcept nogil const: + if i >= this._stack.size(): + return -1 + elif i < 0: + return -1 + return this._stack.at(this._stack.size() - (i+1)) + + inline int B(int i) noexcept nogil const: + if i < 0: + return -1 + elif i < this._rebuffer.size(): + return this._rebuffer.at(this._rebuffer.size() - (i+1)) + else: + b_i = this._b_i + (i - this._rebuffer.size()) + if b_i >= this.length: + return -1 + else: + return b_i + + inline const TokenC* B_(int i) noexcept nogil const: + return this.safe_get(this.B(i)) + + inline const TokenC* E_(int i) noexcept nogil const: + return this.safe_get(this.E(i)) + + inline const TokenC* safe_get(int i) noexcept nogil const: + if i < 0 or i >= this.length: + return &this._empty_token + else: + return &this._sent[i] + + inline void map_get_arcs(const unordered_map[int, vector[ArcC]] &heads_arcs, vector[ArcC]* out) noexcept nogil const: + cdef const vector[ArcC]* arcs + head_arcs_it = heads_arcs.const_begin() + while head_arcs_it != heads_arcs.const_end(): + arcs = &deref(head_arcs_it).second + arcs_it = arcs.const_begin() + while arcs_it != arcs.const_end(): + arc = deref(arcs_it) + if arc.head != -1 and arc.child != -1: + out.push_back(arc) + incr(arcs_it) + incr(head_arcs_it) + + inline void get_arcs(vector[ArcC]* out) noexcept nogil const: + this.map_get_arcs(this._left_arcs, out) + this.map_get_arcs(this._right_arcs, out) + + inline int H(int child) noexcept nogil const: + if child >= this.length or child < 0: + return -1 + else: + return this._heads[child] + + inline int E(int i) noexcept nogil const: + if this._ents.size() == 0: + return -1 + else: + return this._ents.back().start + + inline int nth_child(const unordered_map[int, vector[ArcC]]& heads_arcs, int head, int idx) noexcept nogil const: + if idx < 1: + return -1 + + head_arcs_it = heads_arcs.const_find(head) + if head_arcs_it == heads_arcs.const_end(): + return -1 + + cdef const vector[ArcC]* arcs = &deref(head_arcs_it).second + + # Work backwards through arcs to find the arc at the + # requested index more quickly. + cdef size_t child_index = 0 + arcs_it = arcs.const_rbegin() + while arcs_it != arcs.const_rend() and child_index != idx: + arc = deref(arcs_it) + if arc.child != -1: + child_index += 1 + if child_index == idx: + return arc.child + incr(arcs_it) + + return -1 + + inline int L(int head, int idx) noexcept nogil const: + return this.nth_child(this._left_arcs, head, idx) + + inline int R(int head, int idx) noexcept nogil const: + return this.nth_child(this._right_arcs, head, idx) + + inline bint empty() noexcept nogil const: + return this._stack.size() == 0 + + inline bint eol() noexcept nogil const: + return this.buffer_length() == 0 + + inline bint is_final() noexcept nogil const: + return this.stack_depth() <= 0 and this.eol() + + inline int cannot_sent_start(int word) noexcept nogil const: + if word < 0 or word >= this.length: + return 0 + elif this._sent[word].sent_start == -1: + return 1 + else: + return 0 + + inline int is_sent_start(int word) noexcept nogil const: + if word < 0 or word >= this.length: + return 0 + elif this._sent[word].sent_start == 1: + return 1 + elif this._sent_starts.count(word) >= 1: + return 1 + else: + return 0 + + inline void set_sent_start(int word, int value) noexcept nogil: + if value >= 1: + this._sent_starts.insert(word) + + inline bint has_head(int child) noexcept nogil const: + return this._heads[child] >= 0 + + inline int l_edge(int word) noexcept nogil const: + return word + + inline int r_edge(int word) noexcept nogil const: + return word + + inline int n_arcs(const unordered_map[int, vector[ArcC]] &heads_arcs, int head) noexcept nogil const: + cdef int n = 0 + head_arcs_it = heads_arcs.const_find(head) + if head_arcs_it == heads_arcs.const_end(): + return n + + cdef const vector[ArcC]* arcs = &deref(head_arcs_it).second + arcs_it = arcs.const_begin() + while arcs_it != arcs.end(): + arc = deref(arcs_it) + if arc.child != -1: + n += 1 + incr(arcs_it) + + return n + + inline int n_L(int head) noexcept nogil const: + return n_arcs(this._left_arcs, head) + + inline int n_R(int head) noexcept nogil const: + return n_arcs(this._right_arcs, head) + + inline bint stack_is_connected() noexcept nogil const: + return False + + inline bint entity_is_open() noexcept nogil const: + if this._ents.size() == 0: + return False + else: + return this._ents.back().end == -1 + + inline int stack_depth() noexcept nogil const: + return this._stack.size() + + inline int buffer_length() noexcept nogil const: + return (this.length - this._b_i) + this._rebuffer.size() + + inline void push() noexcept nogil: + b0 = this.B(0) + if this._rebuffer.size(): + b0 = this._rebuffer.back() + this._rebuffer.pop_back() + else: + b0 = this._b_i + this._b_i += 1 + this._stack.push_back(b0) + + inline void pop() noexcept nogil: + this._stack.pop_back() + + inline void force_final() noexcept nogil: + # This should only be used in desperate situations, as it may leave + # the analysis in an unexpected state. + this._stack.clear() + this._b_i = this.length + + inline void unshift() noexcept nogil: + s0 = this._stack.back() + this._unshiftable[s0] = 1 + this._rebuffer.push_back(s0) + this._stack.pop_back() + + inline int is_unshiftable(int item) noexcept nogil const: + if item >= this._unshiftable.size(): + return 0 + else: + return this._unshiftable.at(item) + + inline void set_reshiftable(int item) noexcept nogil: + if item < this._unshiftable.size(): + this._unshiftable[item] = 0 + + inline void add_arc(int head, int child, attr_t label) noexcept nogil: + if this.has_head(child): + this.del_arc(this.H(child), child) + cdef ArcC arc + arc.head = head + arc.child = child + arc.label = label + if head > child: + this._left_arcs[arc.head].push_back(arc) + else: + this._right_arcs[arc.head].push_back(arc) + this._heads[child] = head + + inline void map_del_arc(unordered_map[int, vector[ArcC]]* heads_arcs, int h_i, int c_i) noexcept nogil: + arcs_it = heads_arcs.find(h_i) + if arcs_it == heads_arcs.end(): + return + + arcs = &deref(arcs_it).second + if arcs.size() == 0: + return + + arc = arcs.back() + if arc.head == h_i and arc.child == c_i: + arcs.pop_back() + else: + for i in range(arcs.size()-1): + arc = arcs.at(i) + if arc.head == h_i and arc.child == c_i: + arc.head = -1 + arc.child = -1 + arc.label = 0 + break + + inline void del_arc(int h_i, int c_i) noexcept nogil: + if h_i > c_i: + this.map_del_arc(&this._left_arcs, h_i, c_i) + else: + this.map_del_arc(&this._right_arcs, h_i, c_i) + + inline SpanC get_ent() noexcept nogil const: + cdef SpanC ent + if this._ents.size() == 0: + ent.start = 0 + ent.end = 0 + ent.label = 0 + return ent + else: + return this._ents.back() + + inline void open_ent(attr_t label) noexcept nogil: + cdef SpanC ent + ent.start = this.B(0) + ent.label = label + ent.end = -1 + this._ents.push_back(ent) + + inline void close_ent() noexcept nogil: + this._ents.back().end = this.B(0)+1 + + inline void clone(const StateC* src) noexcept nogil: + this.length = src.length + this._sent = src._sent + this._stack = src._stack + this._rebuffer = src._rebuffer + this._sent_starts = src._sent_starts + this._unshiftable = src._unshiftable + memcpy(this._heads, src._heads, this.length * sizeof(this._heads[0])) + this._ents = src._ents + this._left_arcs = src._left_arcs + this._right_arcs = src._right_arcs + this._b_i = src._b_i + this.offset = src.offset + this._empty_token = src._empty_token diff --git a/TTS/Kokoro/.venv/Lib/site-packages/spacy/pipeline/_parser_internals/_state.pyx b/TTS/Kokoro/.venv/Lib/site-packages/spacy/pipeline/_parser_internals/_state.pyx new file mode 100644 index 0000000000000000000000000000000000000000..9ced0659d7a537b0bc57c737e11a05e1ad06c6fc --- /dev/null +++ b/TTS/Kokoro/.venv/Lib/site-packages/spacy/pipeline/_parser_internals/_state.pyx @@ -0,0 +1 @@ +# cython: profile=False diff --git a/TTS/Kokoro/.venv/Lib/site-packages/spacy/pipeline/_parser_internals/arc_eager.cpp b/TTS/Kokoro/.venv/Lib/site-packages/spacy/pipeline/_parser_internals/arc_eager.cpp new file mode 100644 index 0000000000000000000000000000000000000000..53090a5e7a95fa51c7e263a58da305cb452ccc38 --- /dev/null +++ b/TTS/Kokoro/.venv/Lib/site-packages/spacy/pipeline/_parser_internals/arc_eager.cpp @@ -0,0 +1,61869 @@ +/* Generated by Cython 3.2.1 */ + +/* BEGIN: Cython Metadata +{ + "distutils": { + "depends": [ + "C:\\Users\\runneradmin\\AppData\\Local\\Temp\\build-env-ej_q3m8u\\Lib\\site-packages\\numpy\\_core\\include\\numpy\\arrayobject.h", + "C:\\Users\\runneradmin\\AppData\\Local\\Temp\\build-env-ej_q3m8u\\Lib\\site-packages\\numpy\\_core\\include\\numpy\\arrayscalars.h", + "C:\\Users\\runneradmin\\AppData\\Local\\Temp\\build-env-ej_q3m8u\\Lib\\site-packages\\numpy\\_core\\include\\numpy\\ndarrayobject.h", + "C:\\Users\\runneradmin\\AppData\\Local\\Temp\\build-env-ej_q3m8u\\Lib\\site-packages\\numpy\\_core\\include\\numpy\\ndarraytypes.h", + "C:\\Users\\runneradmin\\AppData\\Local\\Temp\\build-env-ej_q3m8u\\Lib\\site-packages\\numpy\\_core\\include\\numpy\\ufuncobject.h", + "C:\\Users\\runneradmin\\AppData\\Local\\pypa\\cibuildwheel\\Cache\\nuget-cpython\\python.3.12.10\\tools\\Include\\Python.h" + ], + "extra_compile_args": [ + "-std=c++11" + ], + "include_dirs": [ + "C:\\Users\\runneradmin\\AppData\\Local\\Temp\\build-env-ej_q3m8u\\Lib\\site-packages\\numpy\\_core\\include", + "C:\\Users\\runneradmin\\AppData\\Local\\pypa\\cibuildwheel\\Cache\\nuget-cpython\\python.3.12.10\\tools\\Include" + ], + "language": "c++", + "name": "spacy.pipeline._parser_internals.arc_eager", + "sources": [ + "spacy/pipeline/_parser_internals/arc_eager.pyx" + ] + }, + "module_name": "spacy.pipeline._parser_internals.arc_eager" +} +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_1" +#define CYTHON_HEX_VERSION 0x030201F0 +#define CYTHON_FUTURE_DIVISION 0 +/* 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)) + +/* CppInitCode */ +#ifndef __cplusplus + #error "Cython files generated with the C++ option must be compiled with a C++ compiler." +#endif +#ifndef CYTHON_INLINE + #if defined(__clang__) + #define CYTHON_INLINE __inline__ __attribute__ ((__unused__)) + #else + #define CYTHON_INLINE inline + #endif +#endif +template +void __Pyx_call_destructor(T& x) { + x.~T(); +} +template +class __Pyx_FakeReference { + public: + __Pyx_FakeReference() : ptr(NULL) { } + __Pyx_FakeReference(const T& ref) : ptr(const_cast(&ref)) { } + T *operator->() { return ptr; } + T *operator&() { return ptr; } + operator T&() { return *ptr; } + template bool operator ==(const U& other) const { return *ptr == other; } + template bool operator !=(const U& other) const { return *ptr != other; } + template bool operator==(const __Pyx_FakeReference& other) const { return *ptr == *other.ptr; } + template bool operator!=(const __Pyx_FakeReference& other) const { return *ptr != *other.ptr; } + private: + T *ptr; +}; + +/* 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 + #define __PYX_EXTERN_C extern "C++" +#endif + +#define __PYX_HAVE__spacy__pipeline___parser_internals__arc_eager +#define __PYX_HAVE_API__spacy__pipeline___parser_internals__arc_eager +/* Early includes */ +#include +#include +#include +#include +#include "ios" +#include "new" +#include "stdexcept" +#include "typeinfo" +#include + + #if __cplusplus >= 201103L || (defined(_MSC_VER) && _MSC_VER >= 1600) + // move should be defined for these versions of MSVC, but __cplusplus isn't set usefully + #include + + namespace cython_std { + template typename std::remove_reference::type&& move(T& t) noexcept { return std::move(t); } + template typename std::remove_reference::type&& move(T&& t) noexcept { return std::move(t); } + } + + #endif + +#include +#include +#include + + /* Using NumPy API declarations from "numpy/__init__.cython-30.pxd" */ + +#include "numpy/arrayobject.h" +#include "numpy/ndarrayobject.h" +#include "numpy/ndarraytypes.h" +#include "numpy/arrayscalars.h" +#include "numpy/ufuncobject.h" +#include +#include +#include "pythread.h" +#ifdef _OPENMP +#include +#endif /* _OPENMP */ + +#if defined(PYREX_WITHOUT_ASSERTIONS) && !defined(CYTHON_WITHOUT_ASSERTIONS) +#define CYTHON_WITHOUT_ASSERTIONS +#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; + +/* Header.proto */ +#if !defined(CYTHON_CCOMPLEX) + #if defined(__cplusplus) + #define CYTHON_CCOMPLEX 1 + #elif (defined(_Complex_I) && !defined(_MSC_VER)) || ((defined (__STDC_VERSION__) && __STDC_VERSION__ >= 201112L) && !defined(__STDC_NO_COMPLEX__) && !defined(_MSC_VER)) + #define CYTHON_CCOMPLEX 1 + #else + #define CYTHON_CCOMPLEX 0 + #endif +#endif +#if CYTHON_CCOMPLEX + #ifdef __cplusplus + #include + #else + #include + #endif +#endif +#if CYTHON_CCOMPLEX && !defined(__cplusplus) && defined(__sun__) && defined(__GNUC__) + #undef _Complex_I + #define _Complex_I 1.0fj +#endif + +/* #### Code section: filename_table ### */ + +static const char* const __pyx_f[] = { + "spacy/pipeline/_parser_internals/arc_eager.pyx", + "", + "C:/Users/runneradmin/AppData/Local/Temp/build-env-ej_q3m8u/Lib/site-packages/numpy/__init__.cython-30.pxd", + "spacy/lexeme.pxd", + "spacy/pipeline/_parser_internals/_state.pxd", + "spacy/pipeline/_parser_internals/stateclass.pxd", + "spacy/tokens/token.pxd", + "cpython/type.pxd", + "cymem/cymem.pxd", + "preshed/maps.pxd", + "spacy/strings.pxd", + "spacy/morphology.pxd", + "spacy/vocab.pxd", + "spacy/tokens/doc.pxd", + "spacy/training/example.pxd", + "thinc/extra/search.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 + +/* ForceInitThreads.proto */ +#ifndef __PYX_FORCE_INIT_THREADS + #define __PYX_FORCE_INIT_THREADS 0 +#endif + +/* NoFastGil.proto */ +#define __Pyx_PyGILState_Ensure PyGILState_Ensure +#define __Pyx_PyGILState_Release PyGILState_Release +#define __Pyx_FastGIL_Remember() +#define __Pyx_FastGIL_Forget() +#define __Pyx_FastGilFuncInit() + +/* IncludeStructmemberH.proto (used by FixUpExtensionType) */ +#include + +/* BufferFormatStructs.proto */ +struct __Pyx_StructField_; +#define __PYX_BUF_FLAGS_PACKED_STRUCT (1 << 0) +typedef struct { + const char* name; + const struct __Pyx_StructField_* fields; + size_t size; + size_t arraysize[8]; + int ndim; + char typegroup; + char is_unsigned; + int flags; +} __Pyx_TypeInfo; +typedef struct __Pyx_StructField_ { + const __Pyx_TypeInfo* type; + const char* name; + size_t offset; +} __Pyx_StructField; +typedef struct { + const __Pyx_StructField* field; + size_t parent_offset; +} __Pyx_BufFmt_StackElem; +typedef struct { + __Pyx_StructField root; + __Pyx_BufFmt_StackElem* head; + size_t fmt_offset; + size_t new_count, enc_count; + size_t struct_alignment; + int is_complex; + char enc_type; + char new_packmode; + char enc_packmode; + char is_valid_array; +} __Pyx_BufFmt_Context; + +/* MemviewSliceStruct.proto */ +struct __pyx_memoryview_obj; +typedef struct { + struct __pyx_memoryview_obj *memview; + char *data; + Py_ssize_t shape[8]; + Py_ssize_t strides[8]; + Py_ssize_t suboffsets[8]; +} __Pyx_memviewslice; +#define __Pyx_MemoryView_Len(m) (m.shape[0]) +#define __Pyx_MEMVIEW_DIRECT 1 +#define __Pyx_MEMVIEW_PTR 2 +#define __Pyx_MEMVIEW_FULL 4 +#define __Pyx_MEMVIEW_CONTIG 8 +#define __Pyx_MEMVIEW_STRIDED 16 +#define __Pyx_MEMVIEW_FOLLOW 32 +#define __Pyx_IS_C_CONTIG 1 +#define __Pyx_IS_F_CONTIG 2 +#define __Pyx_MEMSLICE_INIT { 0, 0, { 0 }, { 0 }, { 0 } } +#if CYTHON_ATOMICS + #define __pyx_add_acquisition_count(memview)\ + __pyx_atomic_incr_relaxed(__pyx_get_slice_count_pointer(memview)) + #define __pyx_sub_acquisition_count(memview)\ + __pyx_atomic_decr_acq_rel(__pyx_get_slice_count_pointer(memview)) +#else + #define __pyx_add_acquisition_count(memview)\ + __pyx_add_acquisition_count_locked(__pyx_get_slice_count_pointer(memview), memview->lock) + #define __pyx_sub_acquisition_count(memview)\ + __pyx_sub_acquisition_count_locked(__pyx_get_slice_count_pointer(memview), memview->lock) +#endif + +/* #### Code section: numeric_typedefs ### */ + +/* "typedefs.pxd":3 + * from libc.stdint cimport int32_t, uint8_t, uint16_t, uint32_t, uint64_t, uintptr_t + * + * ctypedef float weight_t # <<<<<<<<<<<<<< + * ctypedef uint64_t hash_t + * ctypedef uint64_t class_t +*/ +typedef float __pyx_t_5spacy_8typedefs_weight_t; + +/* "typedefs.pxd":4 + * + * ctypedef float weight_t + * ctypedef uint64_t hash_t # <<<<<<<<<<<<<< + * ctypedef uint64_t class_t + * ctypedef uint64_t attr_t +*/ +typedef uint64_t __pyx_t_5spacy_8typedefs_hash_t; + +/* "typedefs.pxd":5 + * ctypedef float weight_t + * ctypedef uint64_t hash_t + * ctypedef uint64_t class_t # <<<<<<<<<<<<<< + * ctypedef uint64_t attr_t + * ctypedef uint64_t flags_t +*/ +typedef uint64_t __pyx_t_5spacy_8typedefs_class_t; + +/* "typedefs.pxd":6 + * ctypedef uint64_t hash_t + * ctypedef uint64_t class_t + * ctypedef uint64_t attr_t # <<<<<<<<<<<<<< + * ctypedef uint64_t flags_t + * ctypedef uint16_t len_t +*/ +typedef uint64_t __pyx_t_5spacy_8typedefs_attr_t; + +/* "typedefs.pxd":7 + * ctypedef uint64_t class_t + * ctypedef uint64_t attr_t + * ctypedef uint64_t flags_t # <<<<<<<<<<<<<< + * ctypedef uint16_t len_t + * ctypedef uint16_t tag_t +*/ +typedef uint64_t __pyx_t_5spacy_8typedefs_flags_t; + +/* "typedefs.pxd":8 + * ctypedef uint64_t attr_t + * ctypedef uint64_t flags_t + * ctypedef uint16_t len_t # <<<<<<<<<<<<<< + * ctypedef uint16_t tag_t +*/ +typedef uint16_t __pyx_t_5spacy_8typedefs_len_t; + +/* "typedefs.pxd":9 + * ctypedef uint64_t flags_t + * ctypedef uint16_t len_t + * ctypedef uint16_t tag_t # <<<<<<<<<<<<<< +*/ +typedef uint16_t __pyx_t_5spacy_8typedefs_tag_t; + +/* "C:/Users/runneradmin/AppData/Local/Temp/build-env-ej_q3m8u/Lib/site-packages/numpy/__init__.cython-30.pxd":743 + * # in Cython to enable them only on the right systems. + * + * ctypedef npy_int8 int8_t # <<<<<<<<<<<<<< + * ctypedef npy_int16 int16_t + * ctypedef npy_int32 int32_t +*/ +typedef npy_int8 __pyx_t_5numpy_int8_t; + +/* "C:/Users/runneradmin/AppData/Local/Temp/build-env-ej_q3m8u/Lib/site-packages/numpy/__init__.cython-30.pxd":744 + * + * ctypedef npy_int8 int8_t + * ctypedef npy_int16 int16_t # <<<<<<<<<<<<<< + * ctypedef npy_int32 int32_t + * ctypedef npy_int64 int64_t +*/ +typedef npy_int16 __pyx_t_5numpy_int16_t; + +/* "C:/Users/runneradmin/AppData/Local/Temp/build-env-ej_q3m8u/Lib/site-packages/numpy/__init__.cython-30.pxd":745 + * ctypedef npy_int8 int8_t + * ctypedef npy_int16 int16_t + * ctypedef npy_int32 int32_t # <<<<<<<<<<<<<< + * ctypedef npy_int64 int64_t + * +*/ +typedef npy_int32 __pyx_t_5numpy_int32_t; + +/* "C:/Users/runneradmin/AppData/Local/Temp/build-env-ej_q3m8u/Lib/site-packages/numpy/__init__.cython-30.pxd":746 + * ctypedef npy_int16 int16_t + * ctypedef npy_int32 int32_t + * ctypedef npy_int64 int64_t # <<<<<<<<<<<<<< + * + * ctypedef npy_uint8 uint8_t +*/ +typedef npy_int64 __pyx_t_5numpy_int64_t; + +/* "C:/Users/runneradmin/AppData/Local/Temp/build-env-ej_q3m8u/Lib/site-packages/numpy/__init__.cython-30.pxd":748 + * ctypedef npy_int64 int64_t + * + * ctypedef npy_uint8 uint8_t # <<<<<<<<<<<<<< + * ctypedef npy_uint16 uint16_t + * ctypedef npy_uint32 uint32_t +*/ +typedef npy_uint8 __pyx_t_5numpy_uint8_t; + +/* "C:/Users/runneradmin/AppData/Local/Temp/build-env-ej_q3m8u/Lib/site-packages/numpy/__init__.cython-30.pxd":749 + * + * ctypedef npy_uint8 uint8_t + * ctypedef npy_uint16 uint16_t # <<<<<<<<<<<<<< + * ctypedef npy_uint32 uint32_t + * ctypedef npy_uint64 uint64_t +*/ +typedef npy_uint16 __pyx_t_5numpy_uint16_t; + +/* "C:/Users/runneradmin/AppData/Local/Temp/build-env-ej_q3m8u/Lib/site-packages/numpy/__init__.cython-30.pxd":750 + * ctypedef npy_uint8 uint8_t + * ctypedef npy_uint16 uint16_t + * ctypedef npy_uint32 uint32_t # <<<<<<<<<<<<<< + * ctypedef npy_uint64 uint64_t + * +*/ +typedef npy_uint32 __pyx_t_5numpy_uint32_t; + +/* "C:/Users/runneradmin/AppData/Local/Temp/build-env-ej_q3m8u/Lib/site-packages/numpy/__init__.cython-30.pxd":751 + * ctypedef npy_uint16 uint16_t + * ctypedef npy_uint32 uint32_t + * ctypedef npy_uint64 uint64_t # <<<<<<<<<<<<<< + * + * ctypedef npy_float32 float32_t +*/ +typedef npy_uint64 __pyx_t_5numpy_uint64_t; + +/* "C:/Users/runneradmin/AppData/Local/Temp/build-env-ej_q3m8u/Lib/site-packages/numpy/__init__.cython-30.pxd":753 + * ctypedef npy_uint64 uint64_t + * + * ctypedef npy_float32 float32_t # <<<<<<<<<<<<<< + * ctypedef npy_float64 float64_t + * #ctypedef npy_float80 float80_t +*/ +typedef npy_float32 __pyx_t_5numpy_float32_t; + +/* "C:/Users/runneradmin/AppData/Local/Temp/build-env-ej_q3m8u/Lib/site-packages/numpy/__init__.cython-30.pxd":754 + * + * ctypedef npy_float32 float32_t + * ctypedef npy_float64 float64_t # <<<<<<<<<<<<<< + * #ctypedef npy_float80 float80_t + * #ctypedef npy_float128 float128_t +*/ +typedef npy_float64 __pyx_t_5numpy_float64_t; + +/* "C:/Users/runneradmin/AppData/Local/Temp/build-env-ej_q3m8u/Lib/site-packages/numpy/__init__.cython-30.pxd":761 + * ctypedef double complex complex128_t + * + * ctypedef npy_longlong longlong_t # <<<<<<<<<<<<<< + * ctypedef npy_ulonglong ulonglong_t + * +*/ +typedef npy_longlong __pyx_t_5numpy_longlong_t; + +/* "C:/Users/runneradmin/AppData/Local/Temp/build-env-ej_q3m8u/Lib/site-packages/numpy/__init__.cython-30.pxd":762 + * + * ctypedef npy_longlong longlong_t + * ctypedef npy_ulonglong ulonglong_t # <<<<<<<<<<<<<< + * + * ctypedef npy_intp intp_t +*/ +typedef npy_ulonglong __pyx_t_5numpy_ulonglong_t; + +/* "C:/Users/runneradmin/AppData/Local/Temp/build-env-ej_q3m8u/Lib/site-packages/numpy/__init__.cython-30.pxd":764 + * ctypedef npy_ulonglong ulonglong_t + * + * ctypedef npy_intp intp_t # <<<<<<<<<<<<<< + * ctypedef npy_uintp uintp_t + * +*/ +typedef npy_intp __pyx_t_5numpy_intp_t; + +/* "C:/Users/runneradmin/AppData/Local/Temp/build-env-ej_q3m8u/Lib/site-packages/numpy/__init__.cython-30.pxd":765 + * + * ctypedef npy_intp intp_t + * ctypedef npy_uintp uintp_t # <<<<<<<<<<<<<< + * + * ctypedef npy_double float_t +*/ +typedef npy_uintp __pyx_t_5numpy_uintp_t; + +/* "C:/Users/runneradmin/AppData/Local/Temp/build-env-ej_q3m8u/Lib/site-packages/numpy/__init__.cython-30.pxd":767 + * ctypedef npy_uintp uintp_t + * + * ctypedef npy_double float_t # <<<<<<<<<<<<<< + * ctypedef npy_double double_t + * ctypedef npy_longdouble longdouble_t +*/ +typedef npy_double __pyx_t_5numpy_float_t; + +/* "C:/Users/runneradmin/AppData/Local/Temp/build-env-ej_q3m8u/Lib/site-packages/numpy/__init__.cython-30.pxd":768 + * + * ctypedef npy_double float_t + * ctypedef npy_double double_t # <<<<<<<<<<<<<< + * ctypedef npy_longdouble longdouble_t + * +*/ +typedef npy_double __pyx_t_5numpy_double_t; + +/* "C:/Users/runneradmin/AppData/Local/Temp/build-env-ej_q3m8u/Lib/site-packages/numpy/__init__.cython-30.pxd":769 + * ctypedef npy_double float_t + * ctypedef npy_double double_t + * ctypedef npy_longdouble longdouble_t # <<<<<<<<<<<<<< + * + * ctypedef float complex cfloat_t +*/ +typedef npy_longdouble __pyx_t_5numpy_longdouble_t; + +/* "preshed/maps.pxd":5 + * + * + * ctypedef uint64_t key_t # <<<<<<<<<<<<<< + * + * +*/ +typedef uint64_t __pyx_t_7preshed_4maps_key_t; + +/* "thinc/extra/search.pxd":7 + * from libcpp.vector cimport vector + * + * ctypedef uint64_t hash_t # <<<<<<<<<<<<<< + * ctypedef uint64_t class_t + * ctypedef float weight_t +*/ +typedef uint64_t __pyx_t_5thinc_5extra_6search_hash_t; + +/* "thinc/extra/search.pxd":8 + * + * ctypedef uint64_t hash_t + * ctypedef uint64_t class_t # <<<<<<<<<<<<<< + * ctypedef float weight_t + * +*/ +typedef uint64_t __pyx_t_5thinc_5extra_6search_class_t; + +/* "thinc/extra/search.pxd":9 + * ctypedef uint64_t hash_t + * ctypedef uint64_t class_t + * ctypedef float weight_t # <<<<<<<<<<<<<< + * + * +*/ +typedef float __pyx_t_5thinc_5extra_6search_weight_t; +/* #### Code section: complex_type_declarations ### */ +/* Declarations.proto */ +#if CYTHON_CCOMPLEX && (1) && (!0 || __cplusplus) + #ifdef __cplusplus + typedef ::std::complex< float > __pyx_t_float_complex; + #else + typedef float _Complex __pyx_t_float_complex; + #endif +#else + typedef struct { float real, imag; } __pyx_t_float_complex; +#endif +static CYTHON_INLINE __pyx_t_float_complex __pyx_t_float_complex_from_parts(float, float); + +/* Declarations.proto */ +#if CYTHON_CCOMPLEX && (1) && (!0 || __cplusplus) + #ifdef __cplusplus + typedef ::std::complex< double > __pyx_t_double_complex; + #else + typedef double _Complex __pyx_t_double_complex; + #endif +#else + typedef struct { double real, imag; } __pyx_t_double_complex; +#endif +static CYTHON_INLINE __pyx_t_double_complex __pyx_t_double_complex_from_parts(double, double); + +/* Declarations.proto */ +#if CYTHON_CCOMPLEX && (1) && (!0 || __cplusplus) + #ifdef __cplusplus + typedef ::std::complex< long double > __pyx_t_long_double_complex; + #else + typedef long double _Complex __pyx_t_long_double_complex; + #endif +#else + typedef struct { long double real, imag; } __pyx_t_long_double_complex; +#endif +static CYTHON_INLINE __pyx_t_long_double_complex __pyx_t_long_double_complex_from_parts(long double, long double); + +/* #### Code section: type_declarations ### */ + +/*--- Type declarations ---*/ +struct __pyx_obj_5cymem_5cymem_PyMalloc; +struct __pyx_obj_5cymem_5cymem_PyFree; +struct __pyx_obj_5cymem_5cymem_Pool; +struct __pyx_obj_5cymem_5cymem_Address; +struct __pyx_obj_7preshed_4maps_PreshMap; +struct __pyx_obj_7preshed_4maps_PreshMapArray; +struct __pyx_obj_5spacy_7strings_StringStore; +struct __pyx_obj_5spacy_10morphology_Morphology; +struct __pyx_obj_5spacy_5vocab_Vocab; +struct __pyx_obj_5spacy_6lexeme_Lexeme; +struct __pyx_obj_5spacy_6tokens_3doc_Doc; +struct __pyx_obj_5spacy_8training_7example_Example; +struct __pyx_obj_5spacy_8pipeline_17_parser_internals_10stateclass_StateClass; +struct __pyx_obj_5spacy_8pipeline_17_parser_internals_17transition_system_TransitionSystem; +struct __pyx_obj_5spacy_6tokens_5token_Token; +struct __pyx_obj_5thinc_5extra_6search_Beam; +struct __pyx_obj_5thinc_5extra_6search_MaxViolation; +struct __pyx_obj_5spacy_8pipeline_17_parser_internals_9arc_eager_ArcEager; +struct __pyx_obj_5spacy_8pipeline_17_parser_internals_9arc_eager_ArcEagerGold; +struct __pyx_obj_5spacy_8pipeline_17_parser_internals_9arc_eager_Shift; +struct __pyx_obj_5spacy_8pipeline_17_parser_internals_9arc_eager_Reduce; +struct __pyx_obj_5spacy_8pipeline_17_parser_internals_9arc_eager_LeftArc; +struct __pyx_obj_5spacy_8pipeline_17_parser_internals_9arc_eager_RightArc; +struct __pyx_obj_5spacy_8pipeline_17_parser_internals_9arc_eager_Break; +struct __pyx_obj_5spacy_8pipeline_17_parser_internals_9arc_eager___pyx_scope_struct___get_aligned_sent_starts; +struct __pyx_obj_5spacy_8pipeline_17_parser_internals_9arc_eager___pyx_scope_struct_1_genexpr; +struct __pyx_obj_5spacy_8pipeline_17_parser_internals_9arc_eager___pyx_scope_struct_2_get_oracle_sequence_from_state; +struct __pyx_obj_5spacy_8pipeline_17_parser_internals_9arc_eager___pyx_scope_struct_3_genexpr; +struct __pyx_array_obj; +struct __pyx_MemviewEnum_obj; +struct __pyx_memoryview_obj; +struct __pyx_memoryviewslice_obj; + +/* "symbols.pxd":1 + * cdef enum symbol_t: # <<<<<<<<<<<<<< + * NIL + * IS_ALPHA +*/ +enum __pyx_t_5spacy_7symbols_symbol_t { + __pyx_e_5spacy_7symbols_NIL, + __pyx_e_5spacy_7symbols_IS_ALPHA, + __pyx_e_5spacy_7symbols_IS_ASCII, + __pyx_e_5spacy_7symbols_IS_DIGIT, + __pyx_e_5spacy_7symbols_IS_LOWER, + __pyx_e_5spacy_7symbols_IS_PUNCT, + __pyx_e_5spacy_7symbols_IS_SPACE, + __pyx_e_5spacy_7symbols_IS_TITLE, + __pyx_e_5spacy_7symbols_IS_UPPER, + __pyx_e_5spacy_7symbols_LIKE_URL, + __pyx_e_5spacy_7symbols_LIKE_NUM, + __pyx_e_5spacy_7symbols_LIKE_EMAIL, + __pyx_e_5spacy_7symbols_IS_STOP, + __pyx_e_5spacy_7symbols_IS_OOV_DEPRECATED, + __pyx_e_5spacy_7symbols_IS_BRACKET, + __pyx_e_5spacy_7symbols_IS_QUOTE, + __pyx_e_5spacy_7symbols_IS_LEFT_PUNCT, + __pyx_e_5spacy_7symbols_IS_RIGHT_PUNCT, + __pyx_e_5spacy_7symbols_IS_CURRENCY, + __pyx_e_5spacy_7symbols_FLAG19 = 19, + __pyx_e_5spacy_7symbols_FLAG20, + __pyx_e_5spacy_7symbols_FLAG21, + __pyx_e_5spacy_7symbols_FLAG22, + __pyx_e_5spacy_7symbols_FLAG23, + __pyx_e_5spacy_7symbols_FLAG24, + __pyx_e_5spacy_7symbols_FLAG25, + __pyx_e_5spacy_7symbols_FLAG26, + __pyx_e_5spacy_7symbols_FLAG27, + __pyx_e_5spacy_7symbols_FLAG28, + __pyx_e_5spacy_7symbols_FLAG29, + __pyx_e_5spacy_7symbols_FLAG30, + __pyx_e_5spacy_7symbols_FLAG31, + __pyx_e_5spacy_7symbols_FLAG32, + __pyx_e_5spacy_7symbols_FLAG33, + __pyx_e_5spacy_7symbols_FLAG34, + __pyx_e_5spacy_7symbols_FLAG35, + __pyx_e_5spacy_7symbols_FLAG36, + __pyx_e_5spacy_7symbols_FLAG37, + __pyx_e_5spacy_7symbols_FLAG38, + __pyx_e_5spacy_7symbols_FLAG39, + __pyx_e_5spacy_7symbols_FLAG40, + __pyx_e_5spacy_7symbols_FLAG41, + __pyx_e_5spacy_7symbols_FLAG42, + __pyx_e_5spacy_7symbols_FLAG43, + __pyx_e_5spacy_7symbols_FLAG44, + __pyx_e_5spacy_7symbols_FLAG45, + __pyx_e_5spacy_7symbols_FLAG46, + __pyx_e_5spacy_7symbols_FLAG47, + __pyx_e_5spacy_7symbols_FLAG48, + __pyx_e_5spacy_7symbols_FLAG49, + __pyx_e_5spacy_7symbols_FLAG50, + __pyx_e_5spacy_7symbols_FLAG51, + __pyx_e_5spacy_7symbols_FLAG52, + __pyx_e_5spacy_7symbols_FLAG53, + __pyx_e_5spacy_7symbols_FLAG54, + __pyx_e_5spacy_7symbols_FLAG55, + __pyx_e_5spacy_7symbols_FLAG56, + __pyx_e_5spacy_7symbols_FLAG57, + __pyx_e_5spacy_7symbols_FLAG58, + __pyx_e_5spacy_7symbols_FLAG59, + __pyx_e_5spacy_7symbols_FLAG60, + __pyx_e_5spacy_7symbols_FLAG61, + __pyx_e_5spacy_7symbols_FLAG62, + __pyx_e_5spacy_7symbols_FLAG63, + __pyx_e_5spacy_7symbols_ID, + __pyx_e_5spacy_7symbols_ORTH, + __pyx_e_5spacy_7symbols_LOWER, + __pyx_e_5spacy_7symbols_NORM, + __pyx_e_5spacy_7symbols_SHAPE, + __pyx_e_5spacy_7symbols_PREFIX, + __pyx_e_5spacy_7symbols_SUFFIX, + __pyx_e_5spacy_7symbols_LENGTH, + __pyx_e_5spacy_7symbols_CLUSTER, + __pyx_e_5spacy_7symbols_LEMMA, + __pyx_e_5spacy_7symbols_POS, + __pyx_e_5spacy_7symbols_TAG, + __pyx_e_5spacy_7symbols_DEP, + __pyx_e_5spacy_7symbols_ENT_IOB, + __pyx_e_5spacy_7symbols_ENT_TYPE, + __pyx_e_5spacy_7symbols_HEAD, + __pyx_e_5spacy_7symbols_SENT_START, + __pyx_e_5spacy_7symbols_SPACY, + __pyx_e_5spacy_7symbols_PROB, + __pyx_e_5spacy_7symbols_LANG, + __pyx_e_5spacy_7symbols_ADJ, + __pyx_e_5spacy_7symbols_ADP, + __pyx_e_5spacy_7symbols_ADV, + __pyx_e_5spacy_7symbols_AUX, + __pyx_e_5spacy_7symbols_CONJ, + __pyx_e_5spacy_7symbols_CCONJ, + __pyx_e_5spacy_7symbols_DET, + __pyx_e_5spacy_7symbols_INTJ, + __pyx_e_5spacy_7symbols_NOUN, + __pyx_e_5spacy_7symbols_NUM, + __pyx_e_5spacy_7symbols_PART, + __pyx_e_5spacy_7symbols_PRON, + __pyx_e_5spacy_7symbols_PROPN, + __pyx_e_5spacy_7symbols_PUNCT, + __pyx_e_5spacy_7symbols_SCONJ, + __pyx_e_5spacy_7symbols_SYM, + __pyx_e_5spacy_7symbols_VERB, + __pyx_e_5spacy_7symbols_X, + __pyx_e_5spacy_7symbols_EOL, + __pyx_e_5spacy_7symbols_SPACE, + __pyx_e_5spacy_7symbols_DEPRECATED001, + __pyx_e_5spacy_7symbols_DEPRECATED002, + __pyx_e_5spacy_7symbols_DEPRECATED003, + __pyx_e_5spacy_7symbols_DEPRECATED004, + __pyx_e_5spacy_7symbols_DEPRECATED005, + __pyx_e_5spacy_7symbols_DEPRECATED006, + __pyx_e_5spacy_7symbols_DEPRECATED007, + __pyx_e_5spacy_7symbols_DEPRECATED008, + __pyx_e_5spacy_7symbols_DEPRECATED009, + __pyx_e_5spacy_7symbols_DEPRECATED010, + __pyx_e_5spacy_7symbols_DEPRECATED011, + __pyx_e_5spacy_7symbols_DEPRECATED012, + __pyx_e_5spacy_7symbols_DEPRECATED013, + __pyx_e_5spacy_7symbols_DEPRECATED014, + __pyx_e_5spacy_7symbols_DEPRECATED015, + __pyx_e_5spacy_7symbols_DEPRECATED016, + __pyx_e_5spacy_7symbols_DEPRECATED017, + __pyx_e_5spacy_7symbols_DEPRECATED018, + __pyx_e_5spacy_7symbols_DEPRECATED019, + __pyx_e_5spacy_7symbols_DEPRECATED020, + __pyx_e_5spacy_7symbols_DEPRECATED021, + __pyx_e_5spacy_7symbols_DEPRECATED022, + __pyx_e_5spacy_7symbols_DEPRECATED023, + __pyx_e_5spacy_7symbols_DEPRECATED024, + __pyx_e_5spacy_7symbols_DEPRECATED025, + __pyx_e_5spacy_7symbols_DEPRECATED026, + __pyx_e_5spacy_7symbols_DEPRECATED027, + __pyx_e_5spacy_7symbols_DEPRECATED028, + __pyx_e_5spacy_7symbols_DEPRECATED029, + __pyx_e_5spacy_7symbols_DEPRECATED030, + __pyx_e_5spacy_7symbols_DEPRECATED031, + __pyx_e_5spacy_7symbols_DEPRECATED032, + __pyx_e_5spacy_7symbols_DEPRECATED033, + __pyx_e_5spacy_7symbols_DEPRECATED034, + __pyx_e_5spacy_7symbols_DEPRECATED035, + __pyx_e_5spacy_7symbols_DEPRECATED036, + __pyx_e_5spacy_7symbols_DEPRECATED037, + __pyx_e_5spacy_7symbols_DEPRECATED038, + __pyx_e_5spacy_7symbols_DEPRECATED039, + __pyx_e_5spacy_7symbols_DEPRECATED040, + __pyx_e_5spacy_7symbols_DEPRECATED041, + __pyx_e_5spacy_7symbols_DEPRECATED042, + __pyx_e_5spacy_7symbols_DEPRECATED043, + __pyx_e_5spacy_7symbols_DEPRECATED044, + __pyx_e_5spacy_7symbols_DEPRECATED045, + __pyx_e_5spacy_7symbols_DEPRECATED046, + __pyx_e_5spacy_7symbols_DEPRECATED047, + __pyx_e_5spacy_7symbols_DEPRECATED048, + __pyx_e_5spacy_7symbols_DEPRECATED049, + __pyx_e_5spacy_7symbols_DEPRECATED050, + __pyx_e_5spacy_7symbols_DEPRECATED051, + __pyx_e_5spacy_7symbols_DEPRECATED052, + __pyx_e_5spacy_7symbols_DEPRECATED053, + __pyx_e_5spacy_7symbols_DEPRECATED054, + __pyx_e_5spacy_7symbols_DEPRECATED055, + __pyx_e_5spacy_7symbols_DEPRECATED056, + __pyx_e_5spacy_7symbols_DEPRECATED057, + __pyx_e_5spacy_7symbols_DEPRECATED058, + __pyx_e_5spacy_7symbols_DEPRECATED059, + __pyx_e_5spacy_7symbols_DEPRECATED060, + __pyx_e_5spacy_7symbols_DEPRECATED061, + __pyx_e_5spacy_7symbols_DEPRECATED062, + __pyx_e_5spacy_7symbols_DEPRECATED063, + __pyx_e_5spacy_7symbols_DEPRECATED064, + __pyx_e_5spacy_7symbols_DEPRECATED065, + __pyx_e_5spacy_7symbols_DEPRECATED066, + __pyx_e_5spacy_7symbols_DEPRECATED067, + __pyx_e_5spacy_7symbols_DEPRECATED068, + __pyx_e_5spacy_7symbols_DEPRECATED069, + __pyx_e_5spacy_7symbols_DEPRECATED070, + __pyx_e_5spacy_7symbols_DEPRECATED071, + __pyx_e_5spacy_7symbols_DEPRECATED072, + __pyx_e_5spacy_7symbols_DEPRECATED073, + __pyx_e_5spacy_7symbols_DEPRECATED074, + __pyx_e_5spacy_7symbols_DEPRECATED075, + __pyx_e_5spacy_7symbols_DEPRECATED076, + __pyx_e_5spacy_7symbols_DEPRECATED077, + __pyx_e_5spacy_7symbols_DEPRECATED078, + __pyx_e_5spacy_7symbols_DEPRECATED079, + __pyx_e_5spacy_7symbols_DEPRECATED080, + __pyx_e_5spacy_7symbols_DEPRECATED081, + __pyx_e_5spacy_7symbols_DEPRECATED082, + __pyx_e_5spacy_7symbols_DEPRECATED083, + __pyx_e_5spacy_7symbols_DEPRECATED084, + __pyx_e_5spacy_7symbols_DEPRECATED085, + __pyx_e_5spacy_7symbols_DEPRECATED086, + __pyx_e_5spacy_7symbols_DEPRECATED087, + __pyx_e_5spacy_7symbols_DEPRECATED088, + __pyx_e_5spacy_7symbols_DEPRECATED089, + __pyx_e_5spacy_7symbols_DEPRECATED090, + __pyx_e_5spacy_7symbols_DEPRECATED091, + __pyx_e_5spacy_7symbols_DEPRECATED092, + __pyx_e_5spacy_7symbols_DEPRECATED093, + __pyx_e_5spacy_7symbols_DEPRECATED094, + __pyx_e_5spacy_7symbols_DEPRECATED095, + __pyx_e_5spacy_7symbols_DEPRECATED096, + __pyx_e_5spacy_7symbols_DEPRECATED097, + __pyx_e_5spacy_7symbols_DEPRECATED098, + __pyx_e_5spacy_7symbols_DEPRECATED099, + __pyx_e_5spacy_7symbols_DEPRECATED100, + __pyx_e_5spacy_7symbols_DEPRECATED101, + __pyx_e_5spacy_7symbols_DEPRECATED102, + __pyx_e_5spacy_7symbols_DEPRECATED103, + __pyx_e_5spacy_7symbols_DEPRECATED104, + __pyx_e_5spacy_7symbols_DEPRECATED105, + __pyx_e_5spacy_7symbols_DEPRECATED106, + __pyx_e_5spacy_7symbols_DEPRECATED107, + __pyx_e_5spacy_7symbols_DEPRECATED108, + __pyx_e_5spacy_7symbols_DEPRECATED109, + __pyx_e_5spacy_7symbols_DEPRECATED110, + __pyx_e_5spacy_7symbols_DEPRECATED111, + __pyx_e_5spacy_7symbols_DEPRECATED112, + __pyx_e_5spacy_7symbols_DEPRECATED113, + __pyx_e_5spacy_7symbols_DEPRECATED114, + __pyx_e_5spacy_7symbols_DEPRECATED115, + __pyx_e_5spacy_7symbols_DEPRECATED116, + __pyx_e_5spacy_7symbols_DEPRECATED117, + __pyx_e_5spacy_7symbols_DEPRECATED118, + __pyx_e_5spacy_7symbols_DEPRECATED119, + __pyx_e_5spacy_7symbols_DEPRECATED120, + __pyx_e_5spacy_7symbols_DEPRECATED121, + __pyx_e_5spacy_7symbols_DEPRECATED122, + __pyx_e_5spacy_7symbols_DEPRECATED123, + __pyx_e_5spacy_7symbols_DEPRECATED124, + __pyx_e_5spacy_7symbols_DEPRECATED125, + __pyx_e_5spacy_7symbols_DEPRECATED126, + __pyx_e_5spacy_7symbols_DEPRECATED127, + __pyx_e_5spacy_7symbols_DEPRECATED128, + __pyx_e_5spacy_7symbols_DEPRECATED129, + __pyx_e_5spacy_7symbols_DEPRECATED130, + __pyx_e_5spacy_7symbols_DEPRECATED131, + __pyx_e_5spacy_7symbols_DEPRECATED132, + __pyx_e_5spacy_7symbols_DEPRECATED133, + __pyx_e_5spacy_7symbols_DEPRECATED134, + __pyx_e_5spacy_7symbols_DEPRECATED135, + __pyx_e_5spacy_7symbols_DEPRECATED136, + __pyx_e_5spacy_7symbols_DEPRECATED137, + __pyx_e_5spacy_7symbols_DEPRECATED138, + __pyx_e_5spacy_7symbols_DEPRECATED139, + __pyx_e_5spacy_7symbols_DEPRECATED140, + __pyx_e_5spacy_7symbols_DEPRECATED141, + __pyx_e_5spacy_7symbols_DEPRECATED142, + __pyx_e_5spacy_7symbols_DEPRECATED143, + __pyx_e_5spacy_7symbols_DEPRECATED144, + __pyx_e_5spacy_7symbols_DEPRECATED145, + __pyx_e_5spacy_7symbols_DEPRECATED146, + __pyx_e_5spacy_7symbols_DEPRECATED147, + __pyx_e_5spacy_7symbols_DEPRECATED148, + __pyx_e_5spacy_7symbols_DEPRECATED149, + __pyx_e_5spacy_7symbols_DEPRECATED150, + __pyx_e_5spacy_7symbols_DEPRECATED151, + __pyx_e_5spacy_7symbols_DEPRECATED152, + __pyx_e_5spacy_7symbols_DEPRECATED153, + __pyx_e_5spacy_7symbols_DEPRECATED154, + __pyx_e_5spacy_7symbols_DEPRECATED155, + __pyx_e_5spacy_7symbols_DEPRECATED156, + __pyx_e_5spacy_7symbols_DEPRECATED157, + __pyx_e_5spacy_7symbols_DEPRECATED158, + __pyx_e_5spacy_7symbols_DEPRECATED159, + __pyx_e_5spacy_7symbols_DEPRECATED160, + __pyx_e_5spacy_7symbols_DEPRECATED161, + __pyx_e_5spacy_7symbols_DEPRECATED162, + __pyx_e_5spacy_7symbols_DEPRECATED163, + __pyx_e_5spacy_7symbols_DEPRECATED164, + __pyx_e_5spacy_7symbols_DEPRECATED165, + __pyx_e_5spacy_7symbols_DEPRECATED166, + __pyx_e_5spacy_7symbols_DEPRECATED167, + __pyx_e_5spacy_7symbols_DEPRECATED168, + __pyx_e_5spacy_7symbols_DEPRECATED169, + __pyx_e_5spacy_7symbols_DEPRECATED170, + __pyx_e_5spacy_7symbols_DEPRECATED171, + __pyx_e_5spacy_7symbols_DEPRECATED172, + __pyx_e_5spacy_7symbols_DEPRECATED173, + __pyx_e_5spacy_7symbols_DEPRECATED174, + __pyx_e_5spacy_7symbols_DEPRECATED175, + __pyx_e_5spacy_7symbols_DEPRECATED176, + __pyx_e_5spacy_7symbols_DEPRECATED177, + __pyx_e_5spacy_7symbols_DEPRECATED178, + __pyx_e_5spacy_7symbols_DEPRECATED179, + __pyx_e_5spacy_7symbols_DEPRECATED180, + __pyx_e_5spacy_7symbols_DEPRECATED181, + __pyx_e_5spacy_7symbols_DEPRECATED182, + __pyx_e_5spacy_7symbols_DEPRECATED183, + __pyx_e_5spacy_7symbols_DEPRECATED184, + __pyx_e_5spacy_7symbols_DEPRECATED185, + __pyx_e_5spacy_7symbols_DEPRECATED186, + __pyx_e_5spacy_7symbols_DEPRECATED187, + __pyx_e_5spacy_7symbols_DEPRECATED188, + __pyx_e_5spacy_7symbols_DEPRECATED189, + __pyx_e_5spacy_7symbols_DEPRECATED190, + __pyx_e_5spacy_7symbols_DEPRECATED191, + __pyx_e_5spacy_7symbols_DEPRECATED192, + __pyx_e_5spacy_7symbols_DEPRECATED193, + __pyx_e_5spacy_7symbols_DEPRECATED194, + __pyx_e_5spacy_7symbols_DEPRECATED195, + __pyx_e_5spacy_7symbols_DEPRECATED196, + __pyx_e_5spacy_7symbols_DEPRECATED197, + __pyx_e_5spacy_7symbols_DEPRECATED198, + __pyx_e_5spacy_7symbols_DEPRECATED199, + __pyx_e_5spacy_7symbols_DEPRECATED200, + __pyx_e_5spacy_7symbols_DEPRECATED201, + __pyx_e_5spacy_7symbols_DEPRECATED202, + __pyx_e_5spacy_7symbols_DEPRECATED203, + __pyx_e_5spacy_7symbols_DEPRECATED204, + __pyx_e_5spacy_7symbols_DEPRECATED205, + __pyx_e_5spacy_7symbols_DEPRECATED206, + __pyx_e_5spacy_7symbols_DEPRECATED207, + __pyx_e_5spacy_7symbols_DEPRECATED208, + __pyx_e_5spacy_7symbols_DEPRECATED209, + __pyx_e_5spacy_7symbols_DEPRECATED210, + __pyx_e_5spacy_7symbols_DEPRECATED211, + __pyx_e_5spacy_7symbols_DEPRECATED212, + __pyx_e_5spacy_7symbols_DEPRECATED213, + __pyx_e_5spacy_7symbols_DEPRECATED214, + __pyx_e_5spacy_7symbols_DEPRECATED215, + __pyx_e_5spacy_7symbols_DEPRECATED216, + __pyx_e_5spacy_7symbols_DEPRECATED217, + __pyx_e_5spacy_7symbols_DEPRECATED218, + __pyx_e_5spacy_7symbols_DEPRECATED219, + __pyx_e_5spacy_7symbols_DEPRECATED220, + __pyx_e_5spacy_7symbols_DEPRECATED221, + __pyx_e_5spacy_7symbols_DEPRECATED222, + __pyx_e_5spacy_7symbols_DEPRECATED223, + __pyx_e_5spacy_7symbols_DEPRECATED224, + __pyx_e_5spacy_7symbols_DEPRECATED225, + __pyx_e_5spacy_7symbols_DEPRECATED226, + __pyx_e_5spacy_7symbols_DEPRECATED227, + __pyx_e_5spacy_7symbols_DEPRECATED228, + __pyx_e_5spacy_7symbols_DEPRECATED229, + __pyx_e_5spacy_7symbols_DEPRECATED230, + __pyx_e_5spacy_7symbols_DEPRECATED231, + __pyx_e_5spacy_7symbols_DEPRECATED232, + __pyx_e_5spacy_7symbols_DEPRECATED233, + __pyx_e_5spacy_7symbols_DEPRECATED234, + __pyx_e_5spacy_7symbols_DEPRECATED235, + __pyx_e_5spacy_7symbols_DEPRECATED236, + __pyx_e_5spacy_7symbols_DEPRECATED237, + __pyx_e_5spacy_7symbols_DEPRECATED238, + __pyx_e_5spacy_7symbols_DEPRECATED239, + __pyx_e_5spacy_7symbols_DEPRECATED240, + __pyx_e_5spacy_7symbols_DEPRECATED241, + __pyx_e_5spacy_7symbols_DEPRECATED242, + __pyx_e_5spacy_7symbols_DEPRECATED243, + __pyx_e_5spacy_7symbols_DEPRECATED244, + __pyx_e_5spacy_7symbols_DEPRECATED245, + __pyx_e_5spacy_7symbols_DEPRECATED246, + __pyx_e_5spacy_7symbols_DEPRECATED247, + __pyx_e_5spacy_7symbols_DEPRECATED248, + __pyx_e_5spacy_7symbols_DEPRECATED249, + __pyx_e_5spacy_7symbols_DEPRECATED250, + __pyx_e_5spacy_7symbols_DEPRECATED251, + __pyx_e_5spacy_7symbols_DEPRECATED252, + __pyx_e_5spacy_7symbols_DEPRECATED253, + __pyx_e_5spacy_7symbols_DEPRECATED254, + __pyx_e_5spacy_7symbols_DEPRECATED255, + __pyx_e_5spacy_7symbols_DEPRECATED256, + __pyx_e_5spacy_7symbols_DEPRECATED257, + __pyx_e_5spacy_7symbols_DEPRECATED258, + __pyx_e_5spacy_7symbols_DEPRECATED259, + __pyx_e_5spacy_7symbols_DEPRECATED260, + __pyx_e_5spacy_7symbols_DEPRECATED261, + __pyx_e_5spacy_7symbols_DEPRECATED262, + __pyx_e_5spacy_7symbols_DEPRECATED263, + __pyx_e_5spacy_7symbols_DEPRECATED264, + __pyx_e_5spacy_7symbols_DEPRECATED265, + __pyx_e_5spacy_7symbols_DEPRECATED266, + __pyx_e_5spacy_7symbols_DEPRECATED267, + __pyx_e_5spacy_7symbols_DEPRECATED268, + __pyx_e_5spacy_7symbols_DEPRECATED269, + __pyx_e_5spacy_7symbols_DEPRECATED270, + __pyx_e_5spacy_7symbols_DEPRECATED271, + __pyx_e_5spacy_7symbols_DEPRECATED272, + __pyx_e_5spacy_7symbols_DEPRECATED273, + __pyx_e_5spacy_7symbols_DEPRECATED274, + __pyx_e_5spacy_7symbols_DEPRECATED275, + __pyx_e_5spacy_7symbols_DEPRECATED276, + __pyx_e_5spacy_7symbols_PERSON, + __pyx_e_5spacy_7symbols_NORP, + __pyx_e_5spacy_7symbols_FACILITY, + __pyx_e_5spacy_7symbols_ORG, + __pyx_e_5spacy_7symbols_GPE, + __pyx_e_5spacy_7symbols_LOC, + __pyx_e_5spacy_7symbols_PRODUCT, + __pyx_e_5spacy_7symbols_EVENT, + __pyx_e_5spacy_7symbols_WORK_OF_ART, + __pyx_e_5spacy_7symbols_LANGUAGE, + __pyx_e_5spacy_7symbols_LAW, + __pyx_e_5spacy_7symbols_DATE, + __pyx_e_5spacy_7symbols_TIME, + __pyx_e_5spacy_7symbols_PERCENT, + __pyx_e_5spacy_7symbols_MONEY, + __pyx_e_5spacy_7symbols_QUANTITY, + __pyx_e_5spacy_7symbols_ORDINAL, + __pyx_e_5spacy_7symbols_CARDINAL, + __pyx_e_5spacy_7symbols_acomp, + __pyx_e_5spacy_7symbols_advcl, + __pyx_e_5spacy_7symbols_advmod, + __pyx_e_5spacy_7symbols_agent, + __pyx_e_5spacy_7symbols_amod, + __pyx_e_5spacy_7symbols_appos, + __pyx_e_5spacy_7symbols_attr, + __pyx_e_5spacy_7symbols_aux, + __pyx_e_5spacy_7symbols_auxpass, + __pyx_e_5spacy_7symbols_cc, + __pyx_e_5spacy_7symbols_ccomp, + __pyx_e_5spacy_7symbols_complm, + __pyx_e_5spacy_7symbols_conj, + __pyx_e_5spacy_7symbols_cop, + __pyx_e_5spacy_7symbols_csubj, + __pyx_e_5spacy_7symbols_csubjpass, + __pyx_e_5spacy_7symbols_dep, + __pyx_e_5spacy_7symbols_det, + __pyx_e_5spacy_7symbols_dobj, + __pyx_e_5spacy_7symbols_expl, + __pyx_e_5spacy_7symbols_hmod, + __pyx_e_5spacy_7symbols_hyph, + __pyx_e_5spacy_7symbols_infmod, + __pyx_e_5spacy_7symbols_intj, + __pyx_e_5spacy_7symbols_iobj, + __pyx_e_5spacy_7symbols_mark, + __pyx_e_5spacy_7symbols_meta, + __pyx_e_5spacy_7symbols_neg, + __pyx_e_5spacy_7symbols_nmod, + __pyx_e_5spacy_7symbols_nn, + __pyx_e_5spacy_7symbols_npadvmod, + __pyx_e_5spacy_7symbols_nsubj, + __pyx_e_5spacy_7symbols_nsubjpass, + __pyx_e_5spacy_7symbols_num, + __pyx_e_5spacy_7symbols_number, + __pyx_e_5spacy_7symbols_oprd, + __pyx_e_5spacy_7symbols_obj, + __pyx_e_5spacy_7symbols_obl, + __pyx_e_5spacy_7symbols_parataxis, + __pyx_e_5spacy_7symbols_partmod, + __pyx_e_5spacy_7symbols_pcomp, + __pyx_e_5spacy_7symbols_pobj, + __pyx_e_5spacy_7symbols_poss, + __pyx_e_5spacy_7symbols_possessive, + __pyx_e_5spacy_7symbols_preconj, + __pyx_e_5spacy_7symbols_prep, + __pyx_e_5spacy_7symbols_prt, + __pyx_e_5spacy_7symbols_punct, + __pyx_e_5spacy_7symbols_quantmod, + __pyx_e_5spacy_7symbols_relcl, + __pyx_e_5spacy_7symbols_rcmod, + __pyx_e_5spacy_7symbols_root, + __pyx_e_5spacy_7symbols_xcomp, + __pyx_e_5spacy_7symbols_acl, + __pyx_e_5spacy_7symbols_ENT_KB_ID, + __pyx_e_5spacy_7symbols_MORPH, + __pyx_e_5spacy_7symbols_ENT_ID, + __pyx_e_5spacy_7symbols_IDX, + __pyx_e_5spacy_7symbols__ +}; + +/* "attrs.pxd":5 + * + * + * cdef enum attr_id_t: # <<<<<<<<<<<<<< + * NULL_ATTR + * IS_ALPHA +*/ +enum __pyx_t_5spacy_5attrs_attr_id_t { + + /* "attrs.pxd":96 + * ENT_KB_ID = symbols.ENT_KB_ID + * MORPH + * ENT_ID = symbols.ENT_ID # <<<<<<<<<<<<<< + * + * IDX +*/ + __pyx_e_5spacy_5attrs_NULL_ATTR, + __pyx_e_5spacy_5attrs_IS_ALPHA, + __pyx_e_5spacy_5attrs_IS_ASCII, + __pyx_e_5spacy_5attrs_IS_DIGIT, + __pyx_e_5spacy_5attrs_IS_LOWER, + __pyx_e_5spacy_5attrs_IS_PUNCT, + __pyx_e_5spacy_5attrs_IS_SPACE, + __pyx_e_5spacy_5attrs_IS_TITLE, + __pyx_e_5spacy_5attrs_IS_UPPER, + __pyx_e_5spacy_5attrs_LIKE_URL, + __pyx_e_5spacy_5attrs_LIKE_NUM, + __pyx_e_5spacy_5attrs_LIKE_EMAIL, + __pyx_e_5spacy_5attrs_IS_STOP, + __pyx_e_5spacy_5attrs_IS_OOV_DEPRECATED, + __pyx_e_5spacy_5attrs_IS_BRACKET, + __pyx_e_5spacy_5attrs_IS_QUOTE, + __pyx_e_5spacy_5attrs_IS_LEFT_PUNCT, + __pyx_e_5spacy_5attrs_IS_RIGHT_PUNCT, + __pyx_e_5spacy_5attrs_IS_CURRENCY, + __pyx_e_5spacy_5attrs_FLAG19 = 19, + __pyx_e_5spacy_5attrs_FLAG20, + __pyx_e_5spacy_5attrs_FLAG21, + __pyx_e_5spacy_5attrs_FLAG22, + __pyx_e_5spacy_5attrs_FLAG23, + __pyx_e_5spacy_5attrs_FLAG24, + __pyx_e_5spacy_5attrs_FLAG25, + __pyx_e_5spacy_5attrs_FLAG26, + __pyx_e_5spacy_5attrs_FLAG27, + __pyx_e_5spacy_5attrs_FLAG28, + __pyx_e_5spacy_5attrs_FLAG29, + __pyx_e_5spacy_5attrs_FLAG30, + __pyx_e_5spacy_5attrs_FLAG31, + __pyx_e_5spacy_5attrs_FLAG32, + __pyx_e_5spacy_5attrs_FLAG33, + __pyx_e_5spacy_5attrs_FLAG34, + __pyx_e_5spacy_5attrs_FLAG35, + __pyx_e_5spacy_5attrs_FLAG36, + __pyx_e_5spacy_5attrs_FLAG37, + __pyx_e_5spacy_5attrs_FLAG38, + __pyx_e_5spacy_5attrs_FLAG39, + __pyx_e_5spacy_5attrs_FLAG40, + __pyx_e_5spacy_5attrs_FLAG41, + __pyx_e_5spacy_5attrs_FLAG42, + __pyx_e_5spacy_5attrs_FLAG43, + __pyx_e_5spacy_5attrs_FLAG44, + __pyx_e_5spacy_5attrs_FLAG45, + __pyx_e_5spacy_5attrs_FLAG46, + __pyx_e_5spacy_5attrs_FLAG47, + __pyx_e_5spacy_5attrs_FLAG48, + __pyx_e_5spacy_5attrs_FLAG49, + __pyx_e_5spacy_5attrs_FLAG50, + __pyx_e_5spacy_5attrs_FLAG51, + __pyx_e_5spacy_5attrs_FLAG52, + __pyx_e_5spacy_5attrs_FLAG53, + __pyx_e_5spacy_5attrs_FLAG54, + __pyx_e_5spacy_5attrs_FLAG55, + __pyx_e_5spacy_5attrs_FLAG56, + __pyx_e_5spacy_5attrs_FLAG57, + __pyx_e_5spacy_5attrs_FLAG58, + __pyx_e_5spacy_5attrs_FLAG59, + __pyx_e_5spacy_5attrs_FLAG60, + __pyx_e_5spacy_5attrs_FLAG61, + __pyx_e_5spacy_5attrs_FLAG62, + __pyx_e_5spacy_5attrs_FLAG63, + __pyx_e_5spacy_5attrs_ID, + __pyx_e_5spacy_5attrs_ORTH, + __pyx_e_5spacy_5attrs_LOWER, + __pyx_e_5spacy_5attrs_NORM, + __pyx_e_5spacy_5attrs_SHAPE, + __pyx_e_5spacy_5attrs_PREFIX, + __pyx_e_5spacy_5attrs_SUFFIX, + __pyx_e_5spacy_5attrs_LENGTH, + __pyx_e_5spacy_5attrs_CLUSTER, + __pyx_e_5spacy_5attrs_LEMMA, + __pyx_e_5spacy_5attrs_POS, + __pyx_e_5spacy_5attrs_TAG, + __pyx_e_5spacy_5attrs_DEP, + __pyx_e_5spacy_5attrs_ENT_IOB, + __pyx_e_5spacy_5attrs_ENT_TYPE, + __pyx_e_5spacy_5attrs_HEAD, + __pyx_e_5spacy_5attrs_SENT_START, + __pyx_e_5spacy_5attrs_SPACY, + __pyx_e_5spacy_5attrs_PROB, + __pyx_e_5spacy_5attrs_LANG, + __pyx_e_5spacy_5attrs_ENT_KB_ID = __pyx_e_5spacy_7symbols_ENT_KB_ID, + __pyx_e_5spacy_5attrs_MORPH, + __pyx_e_5spacy_5attrs_ENT_ID = __pyx_e_5spacy_7symbols_ENT_ID, + __pyx_e_5spacy_5attrs_IDX, + __pyx_e_5spacy_5attrs_SENT_END +}; + +/* "cymem/cymem.pxd":1 + * ctypedef void* (*malloc_t)(size_t n) # <<<<<<<<<<<<<< + * ctypedef void (*free_t)(void *p) + * +*/ +typedef void *(*__pyx_t_5cymem_5cymem_malloc_t)(size_t); + +/* "cymem/cymem.pxd":2 + * ctypedef void* (*malloc_t)(size_t n) + * ctypedef void (*free_t)(void *p) # <<<<<<<<<<<<<< + * + * cdef class PyMalloc: +*/ +typedef void (*__pyx_t_5cymem_5cymem_free_t)(void *); +struct __pyx_t_7preshed_4maps_Cell; +struct __pyx_t_7preshed_4maps_Result; +struct __pyx_t_7preshed_4maps_MapStruct; + +/* "preshed/maps.pxd":8 + * + * + * cdef struct Cell: # <<<<<<<<<<<<<< + * key_t key + * void* value +*/ +struct __pyx_t_7preshed_4maps_Cell { + __pyx_t_7preshed_4maps_key_t key; + void *value; +}; + +/* "preshed/maps.pxd":13 + * + * + * cdef struct Result: # <<<<<<<<<<<<<< + * int found + * void* value +*/ +struct __pyx_t_7preshed_4maps_Result { + int found; + void *value; +}; + +/* "preshed/maps.pxd":18 + * + * + * cdef struct MapStruct: # <<<<<<<<<<<<<< + * Cell* cells + * void* value_for_empty_key +*/ +struct __pyx_t_7preshed_4maps_MapStruct { + struct __pyx_t_7preshed_4maps_Cell *cells; + void *value_for_empty_key; + void *value_for_del_key; + __pyx_t_7preshed_4maps_key_t length; + __pyx_t_7preshed_4maps_key_t filled; + int is_empty_key_set; + int is_del_key_set; +}; +union __pyx_t_5spacy_7strings_Utf8Str; +typedef union __pyx_t_5spacy_7strings_Utf8Str __pyx_t_5spacy_7strings_Utf8Str; + +/* "strings.pxd":17 + * + * + * ctypedef union Utf8Str: # <<<<<<<<<<<<<< + * unsigned char[8] s + * unsigned char* p +*/ +union __pyx_t_5spacy_7strings_Utf8Str { + unsigned char s[8]; + unsigned char *p; +}; + +/* "parts_of_speech.pxd":4 + * + * + * cpdef enum univ_pos_t: # <<<<<<<<<<<<<< + * NO_TAG = 0 + * ADJ = symbols.ADJ +*/ +enum __pyx_t_5spacy_15parts_of_speech_univ_pos_t { + + /* "parts_of_speech.pxd":6 + * cpdef enum univ_pos_t: + * NO_TAG = 0 + * ADJ = symbols.ADJ # <<<<<<<<<<<<<< + * ADP + * ADV +*/ + __pyx_e_5spacy_15parts_of_speech_NO_TAG = 0, + __pyx_e_5spacy_15parts_of_speech_ADJ = __pyx_e_5spacy_7symbols_ADJ, + __pyx_e_5spacy_15parts_of_speech_ADP, + __pyx_e_5spacy_15parts_of_speech_ADV, + __pyx_e_5spacy_15parts_of_speech_AUX, + __pyx_e_5spacy_15parts_of_speech_CONJ, + __pyx_e_5spacy_15parts_of_speech_CCONJ, + __pyx_e_5spacy_15parts_of_speech_DET, + __pyx_e_5spacy_15parts_of_speech_INTJ, + __pyx_e_5spacy_15parts_of_speech_NOUN, + __pyx_e_5spacy_15parts_of_speech_NUM, + __pyx_e_5spacy_15parts_of_speech_PART, + __pyx_e_5spacy_15parts_of_speech_PRON, + __pyx_e_5spacy_15parts_of_speech_PROPN, + __pyx_e_5spacy_15parts_of_speech_PUNCT, + __pyx_e_5spacy_15parts_of_speech_SCONJ, + __pyx_e_5spacy_15parts_of_speech_SYM, + __pyx_e_5spacy_15parts_of_speech_VERB, + __pyx_e_5spacy_15parts_of_speech_X, + __pyx_e_5spacy_15parts_of_speech_EOL, + __pyx_e_5spacy_15parts_of_speech_SPACE +}; +struct __pyx_t_5spacy_7structs_LexemeC; +struct __pyx_t_5spacy_7structs_SpanC; +struct __pyx_t_5spacy_7structs_TokenC; +struct __pyx_t_5spacy_7structs_MorphAnalysisC; +struct __pyx_t_5spacy_7structs_KBEntryC; +struct __pyx_t_5spacy_7structs_AliasC; +struct __pyx_t_5spacy_7structs_EdgeC; +struct __pyx_t_5spacy_7structs_GraphC; + +/* "structs.pxd":10 + * + * + * cdef struct LexemeC: # <<<<<<<<<<<<<< + * flags_t flags + * +*/ +struct __pyx_t_5spacy_7structs_LexemeC { + __pyx_t_5spacy_8typedefs_flags_t flags; + __pyx_t_5spacy_8typedefs_attr_t lang; + __pyx_t_5spacy_8typedefs_attr_t id; + __pyx_t_5spacy_8typedefs_attr_t length; + __pyx_t_5spacy_8typedefs_attr_t orth; + __pyx_t_5spacy_8typedefs_attr_t lower; + __pyx_t_5spacy_8typedefs_attr_t norm; + __pyx_t_5spacy_8typedefs_attr_t shape; + __pyx_t_5spacy_8typedefs_attr_t prefix; + __pyx_t_5spacy_8typedefs_attr_t suffix; +}; + +/* "structs.pxd":26 + * + * + * cdef struct SpanC: # <<<<<<<<<<<<<< + * hash_t id + * int start +*/ +struct __pyx_t_5spacy_7structs_SpanC { + __pyx_t_5spacy_8typedefs_hash_t id; + int start; + int end; + int start_char; + int end_char; + __pyx_t_5spacy_8typedefs_attr_t label; + __pyx_t_5spacy_8typedefs_attr_t kb_id; +}; + +/* "structs.pxd":36 + * + * + * cdef struct TokenC: # <<<<<<<<<<<<<< + * const LexemeC* lex + * uint64_t morph +*/ +struct __pyx_t_5spacy_7structs_TokenC { + struct __pyx_t_5spacy_7structs_LexemeC const *lex; + uint64_t morph; + enum __pyx_t_5spacy_15parts_of_speech_univ_pos_t pos; + int spacy; + __pyx_t_5spacy_8typedefs_attr_t tag; + int idx; + __pyx_t_5spacy_8typedefs_attr_t lemma; + __pyx_t_5spacy_8typedefs_attr_t norm; + int head; + __pyx_t_5spacy_8typedefs_attr_t dep; + uint32_t l_kids; + uint32_t r_kids; + uint32_t l_edge; + uint32_t r_edge; + int sent_start; + int ent_iob; + __pyx_t_5spacy_8typedefs_attr_t ent_type; + __pyx_t_5spacy_8typedefs_attr_t ent_kb_id; + __pyx_t_5spacy_8typedefs_hash_t ent_id; +}; + +/* "structs.pxd":60 + * + * + * cdef struct MorphAnalysisC: # <<<<<<<<<<<<<< + * hash_t key + * int length +*/ +struct __pyx_t_5spacy_7structs_MorphAnalysisC { + __pyx_t_5spacy_8typedefs_hash_t key; + int length; + __pyx_t_5spacy_8typedefs_attr_t *fields; + __pyx_t_5spacy_8typedefs_attr_t *features; +}; + +/* "structs.pxd":69 + * + * # Internal struct, for storage and disambiguation of entities. + * cdef struct KBEntryC: # <<<<<<<<<<<<<< + * + * # The hash of this entry's unique ID/name in the kB +*/ +struct __pyx_t_5spacy_7structs_KBEntryC { + __pyx_t_5spacy_8typedefs_hash_t entity_hash; + int32_t vector_index; + int32_t feats_row; + float freq; +}; + +/* "structs.pxd":88 + * # Each alias struct stores a list of Entry pointers with their prior probabilities + * # for this specific mention/alias. + * cdef struct AliasC: # <<<<<<<<<<<<<< + * + * # All entry candidates for this alias +*/ +struct __pyx_t_5spacy_7structs_AliasC { + std::vector entry_indices; + std::vector probs; +}; + +/* "structs.pxd":97 + * + * + * cdef struct EdgeC: # <<<<<<<<<<<<<< + * hash_t label + * int32_t head +*/ +struct __pyx_t_5spacy_7structs_EdgeC { + __pyx_t_5spacy_8typedefs_hash_t label; + int32_t head; + int32_t tail; +}; + +/* "structs.pxd":103 + * + * + * cdef struct GraphC: # <<<<<<<<<<<<<< + * vector[vector[int32_t]] nodes + * vector[EdgeC] edges +*/ +struct __pyx_t_5spacy_7structs_GraphC { + std::vector > nodes; + std::vector edges; + std::vector weights; + std::vector n_heads; + std::vector n_tails; + std::vector first_head; + std::vector first_tail; + std::unordered_set *roots; + std::unordered_map<__pyx_t_5spacy_8typedefs_hash_t,int> *node_map; + std::unordered_map<__pyx_t_5spacy_8typedefs_hash_t,int> *edge_map; +}; +union __pyx_t_5spacy_5vocab_LexemesOrTokens; +struct __pyx_t_5spacy_5vocab__Cached; + +/* "vocab.pxd":15 + * + * + * cdef union LexemesOrTokens: # <<<<<<<<<<<<<< + * const LexemeC* const* lexemes + * const TokenC* tokens +*/ +union __pyx_t_5spacy_5vocab_LexemesOrTokens { + struct __pyx_t_5spacy_7structs_LexemeC const *const *lexemes; + struct __pyx_t_5spacy_7structs_TokenC const *tokens; +}; + +/* "vocab.pxd":20 + * + * + * cdef struct _Cached: # <<<<<<<<<<<<<< + * LexemesOrTokens data + * bint is_lex +*/ +struct __pyx_t_5spacy_5vocab__Cached { + union __pyx_t_5spacy_5vocab_LexemesOrTokens data; + int is_lex; + int length; +}; +struct __pyx_t_5spacy_8pipeline_17_parser_internals_6_state_ArcC; +struct __pyx_t_5spacy_8pipeline_17_parser_internals_6_state_StateC; + +/* "_state.pxd":23 + * return Lexeme.c_check_flag(token.lex, IS_SPACE) + * + * cdef struct ArcC: # <<<<<<<<<<<<<< + * int head + * int child +*/ +struct __pyx_t_5spacy_8pipeline_17_parser_internals_6_state_ArcC { + int head; + int child; + __pyx_t_5spacy_8typedefs_attr_t label; +}; +struct __pyx_t_5spacy_8pipeline_17_parser_internals_6_state_StateC { + + /* "_state.pxd":29 + * + * + * cdef cppclass StateC: # <<<<<<<<<<<<<< + * int* _heads + * const TokenC* _sent +*/ + int *_heads; + struct __pyx_t_5spacy_7structs_TokenC const *_sent; + std::vector _stack; + std::vector _rebuffer; + std::vector _ents; + std::unordered_map > _left_arcs; + std::unordered_map > _right_arcs; + std::vector _unshiftable; + std::set _sent_starts; + struct __pyx_t_5spacy_7structs_TokenC _empty_token; + int length; + int offset; + int _b_i; + void __pyx_f___init__StateC(struct __pyx_t_5spacy_7structs_TokenC const *, int); + void __pyx_f___dealloc__StateC(void); + virtual void set_context_tokens(int *, int); + virtual int S(int) const; + virtual int B(int) const; + virtual struct __pyx_t_5spacy_7structs_TokenC const *B_(int) const; + virtual struct __pyx_t_5spacy_7structs_TokenC const *E_(int) const; + virtual struct __pyx_t_5spacy_7structs_TokenC const *safe_get(int) const; + virtual void map_get_arcs(std::unordered_map > const &, std::vector *) const; + virtual void get_arcs(std::vector *) const; + virtual int H(int) const; + virtual int E(int) const; + virtual int nth_child(std::unordered_map > const &, int, int) const; + virtual int L(int, int) const; + virtual int R(int, int) const; + virtual int empty(void) const; + virtual int eol(void) const; + virtual int is_final(void) const; + virtual int cannot_sent_start(int) const; + virtual int is_sent_start(int) const; + virtual void set_sent_start(int, int); + virtual int has_head(int) const; + virtual int l_edge(int) const; + virtual int r_edge(int) const; + virtual int n_arcs(std::unordered_map > const &, int) const; + virtual int n_L(int) const; + virtual int n_R(int) const; + virtual int stack_is_connected(void) const; + virtual int entity_is_open(void) const; + virtual int stack_depth(void) const; + virtual int buffer_length(void) const; + virtual void push(void); + virtual void pop(void); + virtual void force_final(void); + virtual void unshift(void); + virtual int is_unshiftable(int) const; + virtual void set_reshiftable(int); + virtual void add_arc(int, int, __pyx_t_5spacy_8typedefs_attr_t); + virtual void map_del_arc(std::unordered_map > *, int, int); + virtual void del_arc(int, int); + virtual struct __pyx_t_5spacy_7structs_SpanC get_ent(void) const; + virtual void open_ent(__pyx_t_5spacy_8typedefs_attr_t); + virtual void close_ent(void); + virtual void clone(__pyx_t_5spacy_8pipeline_17_parser_internals_6_state_StateC const *); + __pyx_t_5spacy_8pipeline_17_parser_internals_6_state_StateC(struct __pyx_t_5spacy_7structs_TokenC const *__pyx_v_sent, int __pyx_v_length) { + __pyx_f___init__StateC(__pyx_v_sent, __pyx_v_length); + } + virtual ~__pyx_t_5spacy_8pipeline_17_parser_internals_6_state_StateC() { + __pyx_f___dealloc__StateC(); + } +}; + +/* "tokens/doc.pxd":14 + * + * + * ctypedef const LexemeC* const_Lexeme_ptr # <<<<<<<<<<<<<< + * ctypedef const TokenC* const_TokenC_ptr + * +*/ +typedef struct __pyx_t_5spacy_7structs_LexemeC const *__pyx_t_5spacy_6tokens_3doc_const_Lexeme_ptr; + +/* "tokens/doc.pxd":15 + * + * ctypedef const LexemeC* const_Lexeme_ptr + * ctypedef const TokenC* const_TokenC_ptr # <<<<<<<<<<<<<< + * + * ctypedef fused LexemeOrToken: +*/ +typedef struct __pyx_t_5spacy_7structs_TokenC const *__pyx_t_5spacy_6tokens_3doc_const_TokenC_ptr; +struct __pyx_t_5spacy_8pipeline_17_parser_internals_17transition_system_Transition; + +/* "transition_system.pxd":11 + * + * + * cdef struct Transition: # <<<<<<<<<<<<<< + * int clas + * int move +*/ +struct __pyx_t_5spacy_8pipeline_17_parser_internals_17transition_system_Transition { + int clas; + int move; + __pyx_t_5spacy_8typedefs_attr_t label; + __pyx_t_5spacy_8typedefs_weight_t score; + int (*is_valid)(__pyx_t_5spacy_8pipeline_17_parser_internals_6_state_StateC const *, __pyx_t_5spacy_8typedefs_attr_t); + __pyx_t_5spacy_8typedefs_weight_t (*get_cost)(__pyx_t_5spacy_8pipeline_17_parser_internals_6_state_StateC const *, void const *, __pyx_t_5spacy_8typedefs_attr_t); + int (*__pyx_do)(__pyx_t_5spacy_8pipeline_17_parser_internals_6_state_StateC *, __pyx_t_5spacy_8typedefs_attr_t); +}; + +/* "transition_system.pxd":23 + * + * + * ctypedef weight_t (*get_cost_func_t)( # <<<<<<<<<<<<<< + * const StateC* state, const void* gold, attr_tlabel + * ) noexcept nogil +*/ +typedef __pyx_t_5spacy_8typedefs_weight_t (*__pyx_t_5spacy_8pipeline_17_parser_internals_17transition_system_get_cost_func_t)(__pyx_t_5spacy_8pipeline_17_parser_internals_6_state_StateC const *, void const *, PyObject *); + +/* "transition_system.pxd":26 + * const StateC* state, const void* gold, attr_tlabel + * ) noexcept nogil + * ctypedef weight_t (*move_cost_func_t)( # <<<<<<<<<<<<<< + * const StateC* state, const void* gold + * ) noexcept nogil +*/ +typedef __pyx_t_5spacy_8typedefs_weight_t (*__pyx_t_5spacy_8pipeline_17_parser_internals_17transition_system_move_cost_func_t)(__pyx_t_5spacy_8pipeline_17_parser_internals_6_state_StateC const *, void const *); + +/* "transition_system.pxd":29 + * const StateC* state, const void* gold + * ) noexcept nogil + * ctypedef weight_t (*label_cost_func_t)( # <<<<<<<<<<<<<< + * const StateC* state, const void* gold, attr_t label + * ) noexcept nogil +*/ +typedef __pyx_t_5spacy_8typedefs_weight_t (*__pyx_t_5spacy_8pipeline_17_parser_internals_17transition_system_label_cost_func_t)(__pyx_t_5spacy_8pipeline_17_parser_internals_6_state_StateC const *, void const *, __pyx_t_5spacy_8typedefs_attr_t); + +/* "transition_system.pxd":33 + * ) noexcept nogil + * + * ctypedef int (*do_func_t)(StateC* state, attr_t label) noexcept nogil # <<<<<<<<<<<<<< + * + * ctypedef void* (*init_state_t)(Pool mem, int length, void* tokens) except NULL +*/ +typedef int (*__pyx_t_5spacy_8pipeline_17_parser_internals_17transition_system_do_func_t)(__pyx_t_5spacy_8pipeline_17_parser_internals_6_state_StateC *, __pyx_t_5spacy_8typedefs_attr_t); + +/* "transition_system.pxd":35 + * ctypedef int (*do_func_t)(StateC* state, attr_t label) noexcept nogil + * + * ctypedef void* (*init_state_t)(Pool mem, int length, void* tokens) except NULL # <<<<<<<<<<<<<< + * + * ctypedef int (*del_state_t)(Pool mem, void* state, void* extra_args) except -1 +*/ +typedef void *(*__pyx_t_5spacy_8pipeline_17_parser_internals_17transition_system_init_state_t)(struct __pyx_obj_5cymem_5cymem_Pool *, int, void *); + +/* "transition_system.pxd":37 + * ctypedef void* (*init_state_t)(Pool mem, int length, void* tokens) except NULL + * + * ctypedef int (*del_state_t)(Pool mem, void* state, void* extra_args) except -1 # <<<<<<<<<<<<<< + * + * cdef class TransitionSystem: +*/ +typedef int (*__pyx_t_5spacy_8pipeline_17_parser_internals_17transition_system_del_state_t)(struct __pyx_obj_5cymem_5cymem_Pool *, void *, void *); +struct __pyx_t_5thinc_5extra_6search__State; + +/* "thinc/extra/search.pxd":12 + * + * + * ctypedef pair[weight_t, size_t] Entry # <<<<<<<<<<<<<< + * ctypedef priority_queue[Entry] Queue + * +*/ +typedef std::pair<__pyx_t_5thinc_5extra_6search_weight_t,size_t> __pyx_t_5thinc_5extra_6search_Entry; + +/* "thinc/extra/search.pxd":13 + * + * ctypedef pair[weight_t, size_t] Entry + * ctypedef priority_queue[Entry] Queue # <<<<<<<<<<<<<< + * + * +*/ +typedef std::priority_queue<__pyx_t_5thinc_5extra_6search_Entry> __pyx_t_5thinc_5extra_6search_Queue; + +/* "thinc/extra/search.pxd":16 + * + * + * ctypedef int (*trans_func_t)(void* dest, void* src, class_t clas, void* x) except -1 # <<<<<<<<<<<<<< + * + * ctypedef void* (*init_func_t)(Pool mem, int n, void* extra_args) except NULL +*/ +typedef int (*__pyx_t_5thinc_5extra_6search_trans_func_t)(void *, void *, __pyx_t_5thinc_5extra_6search_class_t, void *); + +/* "thinc/extra/search.pxd":18 + * ctypedef int (*trans_func_t)(void* dest, void* src, class_t clas, void* x) except -1 + * + * ctypedef void* (*init_func_t)(Pool mem, int n, void* extra_args) except NULL # <<<<<<<<<<<<<< + * + * ctypedef int (*del_func_t)(Pool mem, void* state, void* extra_args) except -1 +*/ +typedef void *(*__pyx_t_5thinc_5extra_6search_init_func_t)(struct __pyx_obj_5cymem_5cymem_Pool *, int, void *); + +/* "thinc/extra/search.pxd":20 + * ctypedef void* (*init_func_t)(Pool mem, int n, void* extra_args) except NULL + * + * ctypedef int (*del_func_t)(Pool mem, void* state, void* extra_args) except -1 # <<<<<<<<<<<<<< + * + * ctypedef int (*finish_func_t)(void* state, void* extra_args) except -1 +*/ +typedef int (*__pyx_t_5thinc_5extra_6search_del_func_t)(struct __pyx_obj_5cymem_5cymem_Pool *, void *, void *); + +/* "thinc/extra/search.pxd":22 + * ctypedef int (*del_func_t)(Pool mem, void* state, void* extra_args) except -1 + * + * ctypedef int (*finish_func_t)(void* state, void* extra_args) except -1 # <<<<<<<<<<<<<< + * + * ctypedef hash_t (*hash_func_t)(void* state, void* x) except 0 +*/ +typedef int (*__pyx_t_5thinc_5extra_6search_finish_func_t)(void *, void *); + +/* "thinc/extra/search.pxd":24 + * ctypedef int (*finish_func_t)(void* state, void* extra_args) except -1 + * + * ctypedef hash_t (*hash_func_t)(void* state, void* x) except 0 # <<<<<<<<<<<<<< + * + * +*/ +typedef __pyx_t_5thinc_5extra_6search_hash_t (*__pyx_t_5thinc_5extra_6search_hash_func_t)(void *, void *); + +/* "thinc/extra/search.pxd":27 + * + * + * cdef struct _State: # <<<<<<<<<<<<<< + * void* content + * class_t* hist +*/ +struct __pyx_t_5thinc_5extra_6search__State { + void *content; + __pyx_t_5thinc_5extra_6search_class_t *hist; + __pyx_t_5thinc_5extra_6search_weight_t score; + __pyx_t_5thinc_5extra_6search_weight_t loss; + int i; + int t; + int is_done; +}; +struct __pyx_t_5spacy_8pipeline_17_parser_internals_9arc_eager_GoldParseStateC; + +/* "spacy/pipeline/_parser_internals/arc_eager.pyx":30 + * DEF NON_MONOTONIC = True + * + * cdef enum: # <<<<<<<<<<<<<< + * SHIFT + * REDUCE +*/ +enum { + __pyx_e_5spacy_8pipeline_17_parser_internals_9arc_eager_SHIFT, + __pyx_e_5spacy_8pipeline_17_parser_internals_9arc_eager_REDUCE, + __pyx_e_5spacy_8pipeline_17_parser_internals_9arc_eager_LEFT, + __pyx_e_5spacy_8pipeline_17_parser_internals_9arc_eager_RIGHT, + __pyx_e_5spacy_8pipeline_17_parser_internals_9arc_eager_BREAK, + __pyx_e_5spacy_8pipeline_17_parser_internals_9arc_eager_N_MOVES +}; + +/* "spacy/pipeline/_parser_internals/arc_eager.pyx":49 + * + * + * cdef enum: # <<<<<<<<<<<<<< + * HEAD_IN_STACK = 0 + * HEAD_IN_BUFFER +*/ +enum { + __pyx_e_5spacy_8pipeline_17_parser_internals_9arc_eager_HEAD_IN_STACK = 0, + __pyx_e_5spacy_8pipeline_17_parser_internals_9arc_eager_HEAD_IN_BUFFER, + __pyx_e_5spacy_8pipeline_17_parser_internals_9arc_eager_HEAD_UNKNOWN, + __pyx_e_5spacy_8pipeline_17_parser_internals_9arc_eager_IS_SENT_START, + __pyx_e_5spacy_8pipeline_17_parser_internals_9arc_eager_SENT_START_UNKNOWN +}; + +/* "spacy/pipeline/_parser_internals/arc_eager.pyx":57 + * + * + * cdef struct GoldParseStateC: # <<<<<<<<<<<<<< + * char* state_bits + * int32_t* n_kids_in_buffer +*/ +struct __pyx_t_5spacy_8pipeline_17_parser_internals_9arc_eager_GoldParseStateC { + char *state_bits; + int32_t *n_kids_in_buffer; + int32_t *n_kids_in_stack; + int32_t *heads; + __pyx_t_5spacy_8typedefs_attr_t *labels; + int32_t **kids; + int32_t *n_kids; + int32_t length; + int32_t stride; + __pyx_t_5spacy_8typedefs_weight_t push_cost; + __pyx_t_5spacy_8typedefs_weight_t pop_cost; +}; + +/* "cymem/cymem.pxd":4 + * ctypedef void (*free_t)(void *p) + * + * cdef class PyMalloc: # <<<<<<<<<<<<<< + * cdef malloc_t malloc + * cdef void _set(self, malloc_t malloc) +*/ +struct __pyx_obj_5cymem_5cymem_PyMalloc { + PyObject_HEAD + struct __pyx_vtabstruct_5cymem_5cymem_PyMalloc *__pyx_vtab; + __pyx_t_5cymem_5cymem_malloc_t malloc; +}; + + +/* "cymem/cymem.pxd":10 + * cdef PyMalloc WrapMalloc(malloc_t malloc) + * + * cdef class PyFree: # <<<<<<<<<<<<<< + * cdef free_t free + * cdef void _set(self, free_t free) +*/ +struct __pyx_obj_5cymem_5cymem_PyFree { + PyObject_HEAD + struct __pyx_vtabstruct_5cymem_5cymem_PyFree *__pyx_vtab; + __pyx_t_5cymem_5cymem_free_t free; +}; + + +/* "cymem/cymem.pxd":16 + * cdef PyFree WrapFree(free_t free) + * + * cdef class Pool: # <<<<<<<<<<<<<< + * cdef readonly size_t size + * cdef readonly dict addresses +*/ +struct __pyx_obj_5cymem_5cymem_Pool { + PyObject_HEAD + struct __pyx_vtabstruct_5cymem_5cymem_Pool *__pyx_vtab; + size_t size; + PyObject *addresses; + PyObject *refs; + struct __pyx_obj_5cymem_5cymem_PyMalloc *pymalloc; + struct __pyx_obj_5cymem_5cymem_PyFree *pyfree; +}; + + +/* "cymem/cymem.pxd":28 + * + * + * cdef class Address: # <<<<<<<<<<<<<< + * cdef void* ptr + * cdef readonly PyMalloc pymalloc +*/ +struct __pyx_obj_5cymem_5cymem_Address { + PyObject_HEAD + void *ptr; + struct __pyx_obj_5cymem_5cymem_PyMalloc *pymalloc; + struct __pyx_obj_5cymem_5cymem_PyFree *pyfree; +}; + + +/* "preshed/maps.pxd":45 + * + * + * cdef class PreshMap: # <<<<<<<<<<<<<< + * cdef MapStruct* c_map + * cdef Pool mem +*/ +struct __pyx_obj_7preshed_4maps_PreshMap { + PyObject_HEAD + struct __pyx_vtabstruct_7preshed_4maps_PreshMap *__pyx_vtab; + struct __pyx_t_7preshed_4maps_MapStruct *c_map; + struct __pyx_obj_5cymem_5cymem_Pool *mem; +}; + + +/* "preshed/maps.pxd":53 + * + * + * cdef class PreshMapArray: # <<<<<<<<<<<<<< + * cdef Pool mem + * cdef MapStruct* maps +*/ +struct __pyx_obj_7preshed_4maps_PreshMapArray { + PyObject_HEAD + struct __pyx_vtabstruct_7preshed_4maps_PreshMapArray *__pyx_vtab; + struct __pyx_obj_5cymem_5cymem_Pool *mem; + struct __pyx_t_7preshed_4maps_MapStruct *maps; + size_t length; +}; + + +/* "strings.pxd":22 + * + * + * cdef class StringStore: # <<<<<<<<<<<<<< + * cdef Pool mem + * +*/ +struct __pyx_obj_5spacy_7strings_StringStore { + PyObject_HEAD + struct __pyx_vtabstruct_5spacy_7strings_StringStore *__pyx_vtab; + struct __pyx_obj_5cymem_5cymem_Pool *mem; + std::vector<__pyx_t_5spacy_8typedefs_hash_t> keys; + struct __pyx_obj_7preshed_4maps_PreshMap *_map; + std::vector<__pyx_t_5spacy_8typedefs_hash_t> _transient_keys; + struct __pyx_obj_5cymem_5cymem_Pool *_non_temp_mem; +}; + + +/* "morphology.pxd":11 + * + * + * cdef class Morphology: # <<<<<<<<<<<<<< + * cdef readonly Pool mem + * cdef readonly StringStore strings +*/ +struct __pyx_obj_5spacy_10morphology_Morphology { + PyObject_HEAD + struct __pyx_vtabstruct_5spacy_10morphology_Morphology *__pyx_vtab; + struct __pyx_obj_5cymem_5cymem_Pool *mem; + struct __pyx_obj_5spacy_7strings_StringStore *strings; + struct __pyx_obj_7preshed_4maps_PreshMap *tags; +}; + + +/* "vocab.pxd":26 + * + * + * cdef class Vocab: # <<<<<<<<<<<<<< + * cdef Pool mem + * cdef readonly StringStore strings +*/ +struct __pyx_obj_5spacy_5vocab_Vocab { + PyObject_HEAD + struct __pyx_vtabstruct_5spacy_5vocab_Vocab *__pyx_vtab; + struct __pyx_obj_5cymem_5cymem_Pool *mem; + struct __pyx_obj_5spacy_7strings_StringStore *strings; + struct __pyx_obj_5spacy_10morphology_Morphology *morphology; + PyObject *_vectors; + PyObject *_lookups; + PyObject *writing_system; + PyObject *get_noun_chunks; + int length; + PyObject *_unused_object; + PyObject *lex_attr_getters; + PyObject *cfg; + struct __pyx_obj_7preshed_4maps_PreshMap *_by_orth; + struct __pyx_obj_5cymem_5cymem_Pool *_non_temp_mem; + std::vector<__pyx_t_5spacy_8typedefs_attr_t> _transient_orths; +}; + + +/* "lexeme.pxd":24 + * cdef attr_t OOV_RANK + * + * cdef class Lexeme: # <<<<<<<<<<<<<< + * cdef LexemeC* c + * cdef readonly Vocab vocab +*/ +struct __pyx_obj_5spacy_6lexeme_Lexeme { + PyObject_HEAD + struct __pyx_vtabstruct_5spacy_6lexeme_Lexeme *__pyx_vtab; + struct __pyx_t_5spacy_7structs_LexemeC *c; + struct __pyx_obj_5spacy_5vocab_Vocab *vocab; + __pyx_t_5spacy_8typedefs_attr_t orth; +}; + + +/* "tokens/doc.pxd":37 + * + * + * cdef class Doc: # <<<<<<<<<<<<<< + * cdef readonly Pool mem + * cdef readonly Vocab vocab +*/ +struct __pyx_obj_5spacy_6tokens_3doc_Doc { + PyObject_HEAD + struct __pyx_vtabstruct_5spacy_6tokens_3doc_Doc *__pyx_vtab; + struct __pyx_obj_5cymem_5cymem_Pool *mem; + struct __pyx_obj_5spacy_5vocab_Vocab *vocab; + PyObject *_vector; + PyObject *_vector_norm; + PyObject *tensor; + PyObject *cats; + PyObject *user_data; + PyObject *spans; + struct __pyx_t_5spacy_7structs_TokenC *c; + float sentiment; + PyObject *user_hooks; + PyObject *user_token_hooks; + PyObject *user_span_hooks; + int has_unknown_spaces; + PyObject *_context; + int length; + int max_length; + PyObject *noun_chunks_iterator; + PyObject *__weakref__; +}; + + +/* "training/example.pxd":6 + * + * + * cdef class Example: # <<<<<<<<<<<<<< + * cdef readonly Doc x + * cdef readonly Doc y +*/ +struct __pyx_obj_5spacy_8training_7example_Example { + PyObject_HEAD + struct __pyx_obj_5spacy_6tokens_3doc_Doc *x; + struct __pyx_obj_5spacy_6tokens_3doc_Doc *y; + PyObject *_cached_alignment; + PyObject *_cached_words_x; + PyObject *_cached_words_y; + uint64_t _x_sig; + uint64_t _y_sig; +}; + + +/* "stateclass.pxd":9 + * + * + * cdef class StateClass: # <<<<<<<<<<<<<< + * cdef StateC* c + * cdef readonly Doc doc +*/ +struct __pyx_obj_5spacy_8pipeline_17_parser_internals_10stateclass_StateClass { + PyObject_HEAD + struct __pyx_vtabstruct_5spacy_8pipeline_17_parser_internals_10stateclass_StateClass *__pyx_vtab; + __pyx_t_5spacy_8pipeline_17_parser_internals_6_state_StateC *c; + struct __pyx_obj_5spacy_6tokens_3doc_Doc *doc; + int _borrowed; +}; + + +/* "transition_system.pxd":39 + * ctypedef int (*del_state_t)(Pool mem, void* state, void* extra_args) except -1 + * + * cdef class TransitionSystem: # <<<<<<<<<<<<<< + * cdef Pool mem + * cdef StringStore strings +*/ +struct __pyx_obj_5spacy_8pipeline_17_parser_internals_17transition_system_TransitionSystem { + PyObject_HEAD + struct __pyx_vtabstruct_5spacy_8pipeline_17_parser_internals_17transition_system_TransitionSystem *__pyx_vtab; + struct __pyx_obj_5cymem_5cymem_Pool *mem; + struct __pyx_obj_5spacy_7strings_StringStore *strings; + struct __pyx_t_5spacy_8pipeline_17_parser_internals_17transition_system_Transition *c; + int n_moves; + int _size; + __pyx_t_5spacy_8typedefs_attr_t root_label; + PyObject *freqs; + PyObject *labels; + PyObject *cfg; + __pyx_t_5spacy_8pipeline_17_parser_internals_17transition_system_init_state_t init_beam_state; + __pyx_t_5spacy_8pipeline_17_parser_internals_17transition_system_del_state_t del_beam_state; +}; + + +/* "tokens/token.pxd":16 + * cdef const int MISSING_DEP = 0 + * + * cdef class Token: # <<<<<<<<<<<<<< + * cdef readonly Vocab vocab + * cdef TokenC* c +*/ +struct __pyx_obj_5spacy_6tokens_5token_Token { + PyObject_HEAD + struct __pyx_vtabstruct_5spacy_6tokens_5token_Token *__pyx_vtab; + struct __pyx_obj_5spacy_5vocab_Vocab *vocab; + struct __pyx_t_5spacy_7structs_TokenC *c; + int i; + struct __pyx_obj_5spacy_6tokens_3doc_Doc *doc; +}; + + +/* "thinc/extra/search.pxd":37 + * + * + * cdef class Beam: # <<<<<<<<<<<<<< + * cdef Pool mem + * cdef class_t nr_class +*/ +struct __pyx_obj_5thinc_5extra_6search_Beam { + PyObject_HEAD + struct __pyx_vtabstruct_5thinc_5extra_6search_Beam *__pyx_vtab; + struct __pyx_obj_5cymem_5cymem_Pool *mem; + __pyx_t_5thinc_5extra_6search_class_t nr_class; + __pyx_t_5thinc_5extra_6search_class_t width; + __pyx_t_5thinc_5extra_6search_class_t size; + __pyx_t_5thinc_5extra_6search_weight_t min_density; + int t; + int is_done; + PyObject *histories; + PyObject *_parent_histories; + __pyx_t_5thinc_5extra_6search_weight_t **scores; + int **is_valid; + __pyx_t_5thinc_5extra_6search_weight_t **costs; + struct __pyx_t_5thinc_5extra_6search__State *_parents; + struct __pyx_t_5thinc_5extra_6search__State *_states; + __pyx_t_5thinc_5extra_6search_del_func_t del_func; +}; + + +/* "thinc/extra/search.pxd":75 + * + * + * cdef class MaxViolation: # <<<<<<<<<<<<<< + * cdef Pool mem + * cdef weight_t cost +*/ +struct __pyx_obj_5thinc_5extra_6search_MaxViolation { + PyObject_HEAD + struct __pyx_vtabstruct_5thinc_5extra_6search_MaxViolation *__pyx_vtab; + struct __pyx_obj_5cymem_5cymem_Pool *mem; + __pyx_t_5thinc_5extra_6search_weight_t cost; + __pyx_t_5thinc_5extra_6search_weight_t delta; + __pyx_t_5thinc_5extra_6search_weight_t p_score; + __pyx_t_5thinc_5extra_6search_weight_t g_score; + double Z; + double gZ; + __pyx_t_5thinc_5extra_6search_class_t n; + PyObject *p_hist; + PyObject *g_hist; + PyObject *p_probs; + PyObject *g_probs; +}; + + +/* "spacy/pipeline/_parser_internals/arc_eager.pxd":6 + * + * + * cdef class ArcEager(TransitionSystem): # <<<<<<<<<<<<<< + * cdef get_arcs(self, StateC* state) +*/ +struct __pyx_obj_5spacy_8pipeline_17_parser_internals_9arc_eager_ArcEager { + struct __pyx_obj_5spacy_8pipeline_17_parser_internals_17transition_system_TransitionSystem __pyx_base; +}; + + +/* "spacy/pipeline/_parser_internals/arc_eager.pyx":199 + * + * + * cdef class ArcEagerGold: # <<<<<<<<<<<<<< + * cdef GoldParseStateC c + * cdef Pool mem +*/ +struct __pyx_obj_5spacy_8pipeline_17_parser_internals_9arc_eager_ArcEagerGold { + PyObject_HEAD + struct __pyx_t_5spacy_8pipeline_17_parser_internals_9arc_eager_GoldParseStateC c; + struct __pyx_obj_5cymem_5cymem_Pool *mem; +}; + + +/* "spacy/pipeline/_parser_internals/arc_eager.pyx":323 + * + * + * cdef class Shift: # <<<<<<<<<<<<<< + * """Move the first word of the buffer onto the stack and mark it as "shifted" + * +*/ +struct __pyx_obj_5spacy_8pipeline_17_parser_internals_9arc_eager_Shift { + PyObject_HEAD + struct __pyx_vtabstruct_5spacy_8pipeline_17_parser_internals_9arc_eager_Shift *__pyx_vtab; +}; + + +/* "spacy/pipeline/_parser_internals/arc_eager.pyx":361 + * + * + * cdef class Reduce: # <<<<<<<<<<<<<< + * """ + * Pop from the stack. If it has no head and the stack isn't empty, place +*/ +struct __pyx_obj_5spacy_8pipeline_17_parser_internals_9arc_eager_Reduce { + PyObject_HEAD + struct __pyx_vtabstruct_5spacy_8pipeline_17_parser_internals_9arc_eager_Reduce *__pyx_vtab; +}; + + +/* "spacy/pipeline/_parser_internals/arc_eager.pyx":411 + * + * + * cdef class LeftArc: # <<<<<<<<<<<<<< + * """Add an arc between B[0] and S[0], replacing the previous head of S[0] if + * one is set. Pop S[0] from the stack. +*/ +struct __pyx_obj_5spacy_8pipeline_17_parser_internals_9arc_eager_LeftArc { + PyObject_HEAD + struct __pyx_vtabstruct_5spacy_8pipeline_17_parser_internals_9arc_eager_LeftArc *__pyx_vtab; +}; + + +/* "spacy/pipeline/_parser_internals/arc_eager.pyx":464 + * + * + * cdef class RightArc: # <<<<<<<<<<<<<< + * """ + * Add an arc from S[0] to B[0]. Push B[0]. +*/ +struct __pyx_obj_5spacy_8pipeline_17_parser_internals_9arc_eager_RightArc { + PyObject_HEAD + struct __pyx_vtabstruct_5spacy_8pipeline_17_parser_internals_9arc_eager_RightArc *__pyx_vtab; +}; + + +/* "spacy/pipeline/_parser_internals/arc_eager.pyx":509 + * + * + * cdef class Break: # <<<<<<<<<<<<<< + * """Mark the second word of the buffer as the start of a + * sentence. +*/ +struct __pyx_obj_5spacy_8pipeline_17_parser_internals_9arc_eager_Break { + PyObject_HEAD + struct __pyx_vtabstruct_5spacy_8pipeline_17_parser_internals_9arc_eager_Break *__pyx_vtab; +}; + + +/* "spacy/pipeline/_parser_internals/arc_eager.pyx":215 + * + * + * def _get_aligned_sent_starts(example): # <<<<<<<<<<<<<< + * """Get list of SENT_START attributes aligned to the predicted tokenization. + * If the reference has not sentence starts, return a list of None values. +*/ +struct __pyx_obj_5spacy_8pipeline_17_parser_internals_9arc_eager___pyx_scope_struct___get_aligned_sent_starts { + PyObject_HEAD + PyObject *__pyx_v_seen_words; +}; + + +/* "spacy/pipeline/_parser_internals/arc_eager.pyx":230 + * for y_sent in example.y.sents: + * x_indices = list(align[y_sent.start : y_sent.end]) + * if any(x_idx in seen_words for x_idx in x_indices): # <<<<<<<<<<<<<< + * # If there are any tokens in X that align across two sentences, + * # regard the sentence annotations as missing, as we can't +*/ +struct __pyx_obj_5spacy_8pipeline_17_parser_internals_9arc_eager___pyx_scope_struct_1_genexpr { + PyObject_HEAD + struct __pyx_obj_5spacy_8pipeline_17_parser_internals_9arc_eager___pyx_scope_struct___get_aligned_sent_starts *__pyx_outer_scope; + PyObject *__pyx_genexpr_arg_0; + PyObject *__pyx_v_x_idx; +}; + + +/* "spacy/pipeline/_parser_internals/arc_eager.pyx":835 + * raise ValueError(Errors.E1031) + * + * def get_oracle_sequence_from_state(self, StateClass state, ArcEagerGold gold, _debug=None): # <<<<<<<<<<<<<< + * cdef int i + * cdef Pool mem = Pool() +*/ +struct __pyx_obj_5spacy_8pipeline_17_parser_internals_9arc_eager___pyx_scope_struct_2_get_oracle_sequence_from_state { + PyObject_HEAD + float *__pyx_v_costs; +}; + + +/* "spacy/pipeline/_parser_internals/arc_eager.pyx":852 + * failed = True + * break + * min_cost = min(costs[i] for i in range(self.n_moves)) # <<<<<<<<<<<<<< + * for i in range(self.n_moves): + * if is_valid[i] and costs[i] <= min_cost: +*/ +struct __pyx_obj_5spacy_8pipeline_17_parser_internals_9arc_eager___pyx_scope_struct_3_genexpr { + PyObject_HEAD + struct __pyx_obj_5spacy_8pipeline_17_parser_internals_9arc_eager___pyx_scope_struct_2_get_oracle_sequence_from_state *__pyx_outer_scope; + int __pyx_genexpr_arg_0; + int __pyx_v_i; + int __pyx_t_0; + int __pyx_t_1; + int __pyx_t_2; +}; + + +/* "View.MemoryView":110 + * + * + * @cython.collection_type("sequence") # <<<<<<<<<<<<<< + * @cname("__pyx_array") + * cdef class array: +*/ +struct __pyx_array_obj { + PyObject_HEAD + struct __pyx_vtabstruct_array *__pyx_vtab; + char *data; + Py_ssize_t len; + char *format; + int ndim; + Py_ssize_t *_shape; + Py_ssize_t *_strides; + Py_ssize_t itemsize; + PyObject *mode; + PyObject *_format; + void (*callback_free_data)(void *); + int free_data; + int dtype_is_object; +}; + + +/* "View.MemoryView":299 + * + * + * @cname('__pyx_MemviewEnum') # <<<<<<<<<<<<<< + * cdef class Enum(object): + * cdef object name +*/ +struct __pyx_MemviewEnum_obj { + PyObject_HEAD + PyObject *name; +}; + + +/* "View.MemoryView":334 + * + * + * @cname('__pyx_memoryview') # <<<<<<<<<<<<<< + * cdef class memoryview: + * +*/ +struct __pyx_memoryview_obj { + PyObject_HEAD + struct __pyx_vtabstruct_memoryview *__pyx_vtab; + PyObject *obj; + PyObject *_size; + void *_unused; + PyThread_type_lock lock; + __pyx_atomic_int_type acquisition_count; + Py_buffer view; + int flags; + int dtype_is_object; + __Pyx_TypeInfo const *typeinfo; +}; + + +/* "View.MemoryView":951 + * + * + * @cython.collection_type("sequence") # <<<<<<<<<<<<<< + * @cname('__pyx_memoryviewslice') + * cdef class _memoryviewslice(memoryview): +*/ +struct __pyx_memoryviewslice_obj { + struct __pyx_memoryview_obj __pyx_base; + __Pyx_memviewslice from_slice; + PyObject *from_object; + PyObject *(*to_object_func)(char *); + int (*to_dtype_func)(char *, PyObject *); +}; + + + +/* "cymem/cymem.pxd":4 + * ctypedef void (*free_t)(void *p) + * + * cdef class PyMalloc: # <<<<<<<<<<<<<< + * cdef malloc_t malloc + * cdef void _set(self, malloc_t malloc) +*/ + +struct __pyx_vtabstruct_5cymem_5cymem_PyMalloc { + void (*_set)(struct __pyx_obj_5cymem_5cymem_PyMalloc *, __pyx_t_5cymem_5cymem_malloc_t); +}; +static struct __pyx_vtabstruct_5cymem_5cymem_PyMalloc *__pyx_vtabptr_5cymem_5cymem_PyMalloc; + + +/* "cymem/cymem.pxd":10 + * cdef PyMalloc WrapMalloc(malloc_t malloc) + * + * cdef class PyFree: # <<<<<<<<<<<<<< + * cdef free_t free + * cdef void _set(self, free_t free) +*/ + +struct __pyx_vtabstruct_5cymem_5cymem_PyFree { + void (*_set)(struct __pyx_obj_5cymem_5cymem_PyFree *, __pyx_t_5cymem_5cymem_free_t); +}; +static struct __pyx_vtabstruct_5cymem_5cymem_PyFree *__pyx_vtabptr_5cymem_5cymem_PyFree; + + +/* "cymem/cymem.pxd":16 + * cdef PyFree WrapFree(free_t free) + * + * cdef class Pool: # <<<<<<<<<<<<<< + * cdef readonly size_t size + * cdef readonly dict addresses +*/ + +struct __pyx_vtabstruct_5cymem_5cymem_Pool { + void *(*alloc)(struct __pyx_obj_5cymem_5cymem_Pool *, size_t, size_t); + void (*free)(struct __pyx_obj_5cymem_5cymem_Pool *, void *); + void *(*realloc)(struct __pyx_obj_5cymem_5cymem_Pool *, void *, size_t); +}; +static struct __pyx_vtabstruct_5cymem_5cymem_Pool *__pyx_vtabptr_5cymem_5cymem_Pool; + + +/* "preshed/maps.pxd":45 + * + * + * cdef class PreshMap: # <<<<<<<<<<<<<< + * cdef MapStruct* c_map + * cdef Pool mem +*/ + +struct __pyx_vtabstruct_7preshed_4maps_PreshMap { + void *(*get)(struct __pyx_obj_7preshed_4maps_PreshMap *, __pyx_t_7preshed_4maps_key_t); + void (*set)(struct __pyx_obj_7preshed_4maps_PreshMap *, __pyx_t_7preshed_4maps_key_t, void *); +}; +static struct __pyx_vtabstruct_7preshed_4maps_PreshMap *__pyx_vtabptr_7preshed_4maps_PreshMap; + + +/* "preshed/maps.pxd":53 + * + * + * cdef class PreshMapArray: # <<<<<<<<<<<<<< + * cdef Pool mem + * cdef MapStruct* maps +*/ + +struct __pyx_vtabstruct_7preshed_4maps_PreshMapArray { + void *(*get)(struct __pyx_obj_7preshed_4maps_PreshMapArray *, size_t, __pyx_t_7preshed_4maps_key_t); + void (*set)(struct __pyx_obj_7preshed_4maps_PreshMapArray *, size_t, __pyx_t_7preshed_4maps_key_t, void *); +}; +static struct __pyx_vtabstruct_7preshed_4maps_PreshMapArray *__pyx_vtabptr_7preshed_4maps_PreshMapArray; + + +/* "strings.pxd":22 + * + * + * cdef class StringStore: # <<<<<<<<<<<<<< + * cdef Pool mem + * +*/ + +struct __pyx_vtabstruct_5spacy_7strings_StringStore { + __pyx_t_5spacy_7strings_Utf8Str const *(*intern_unicode)(struct __pyx_obj_5spacy_7strings_StringStore *, PyObject *, int); + __pyx_t_5spacy_7strings_Utf8Str const *(*_intern_utf8)(struct __pyx_obj_5spacy_7strings_StringStore *, char *, int, __pyx_t_5spacy_8typedefs_hash_t *, int); +}; +static struct __pyx_vtabstruct_5spacy_7strings_StringStore *__pyx_vtabptr_5spacy_7strings_StringStore; + + +/* "morphology.pxd":11 + * + * + * cdef class Morphology: # <<<<<<<<<<<<<< + * cdef readonly Pool mem + * cdef readonly StringStore strings +*/ + +struct __pyx_vtabstruct_5spacy_10morphology_Morphology { + struct __pyx_t_5spacy_7structs_MorphAnalysisC (*create_morph_tag)(struct __pyx_obj_5spacy_10morphology_Morphology *, PyObject *); + int (*insert)(struct __pyx_obj_5spacy_10morphology_Morphology *, struct __pyx_t_5spacy_7structs_MorphAnalysisC); +}; +static struct __pyx_vtabstruct_5spacy_10morphology_Morphology *__pyx_vtabptr_5spacy_10morphology_Morphology; + + +/* "vocab.pxd":26 + * + * + * cdef class Vocab: # <<<<<<<<<<<<<< + * cdef Pool mem + * cdef readonly StringStore strings +*/ + +struct __pyx_vtabstruct_5spacy_5vocab_Vocab { + struct __pyx_t_5spacy_7structs_LexemeC const *(*get)(struct __pyx_obj_5spacy_5vocab_Vocab *, struct __pyx_obj_5cymem_5cymem_Pool *, PyObject *); + struct __pyx_t_5spacy_7structs_LexemeC const *(*get_by_orth)(struct __pyx_obj_5spacy_5vocab_Vocab *, struct __pyx_obj_5cymem_5cymem_Pool *, __pyx_t_5spacy_8typedefs_attr_t); + struct __pyx_t_5spacy_7structs_TokenC const *(*make_fused_token)(struct __pyx_obj_5spacy_5vocab_Vocab *, PyObject *); + struct __pyx_t_5spacy_7structs_LexemeC const *(*_new_lexeme)(struct __pyx_obj_5spacy_5vocab_Vocab *, struct __pyx_obj_5cymem_5cymem_Pool *, PyObject *); + int (*_add_lex_to_vocab)(struct __pyx_obj_5spacy_5vocab_Vocab *, __pyx_t_5spacy_8typedefs_hash_t, struct __pyx_t_5spacy_7structs_LexemeC const *, int); +}; +static struct __pyx_vtabstruct_5spacy_5vocab_Vocab *__pyx_vtabptr_5spacy_5vocab_Vocab; + + +/* "lexeme.pxd":24 + * cdef attr_t OOV_RANK + * + * cdef class Lexeme: # <<<<<<<<<<<<<< + * cdef LexemeC* c + * cdef readonly Vocab vocab +*/ + +struct __pyx_vtabstruct_5spacy_6lexeme_Lexeme { + struct __pyx_obj_5spacy_6lexeme_Lexeme *(*from_ptr)(struct __pyx_t_5spacy_7structs_LexemeC *, struct __pyx_obj_5spacy_5vocab_Vocab *); + void (*set_struct_attr)(struct __pyx_t_5spacy_7structs_LexemeC *, enum __pyx_t_5spacy_5attrs_attr_id_t, __pyx_t_5spacy_8typedefs_attr_t); + __pyx_t_5spacy_8typedefs_attr_t (*get_struct_attr)(struct __pyx_t_5spacy_7structs_LexemeC const *, enum __pyx_t_5spacy_5attrs_attr_id_t); + int (*c_check_flag)(struct __pyx_t_5spacy_7structs_LexemeC const *, enum __pyx_t_5spacy_5attrs_attr_id_t); + int (*c_set_flag)(struct __pyx_t_5spacy_7structs_LexemeC *, enum __pyx_t_5spacy_5attrs_attr_id_t, int); +}; +static struct __pyx_vtabstruct_5spacy_6lexeme_Lexeme *__pyx_vtabptr_5spacy_6lexeme_Lexeme; +static CYTHON_INLINE struct __pyx_obj_5spacy_6lexeme_Lexeme *__pyx_f_5spacy_6lexeme_6Lexeme_from_ptr(struct __pyx_t_5spacy_7structs_LexemeC *, struct __pyx_obj_5spacy_5vocab_Vocab *); +static CYTHON_INLINE void __pyx_f_5spacy_6lexeme_6Lexeme_set_struct_attr(struct __pyx_t_5spacy_7structs_LexemeC *, enum __pyx_t_5spacy_5attrs_attr_id_t, __pyx_t_5spacy_8typedefs_attr_t); +static CYTHON_INLINE __pyx_t_5spacy_8typedefs_attr_t __pyx_f_5spacy_6lexeme_6Lexeme_get_struct_attr(struct __pyx_t_5spacy_7structs_LexemeC const *, enum __pyx_t_5spacy_5attrs_attr_id_t); +static CYTHON_INLINE int __pyx_f_5spacy_6lexeme_6Lexeme_c_check_flag(struct __pyx_t_5spacy_7structs_LexemeC const *, enum __pyx_t_5spacy_5attrs_attr_id_t); +static CYTHON_INLINE int __pyx_f_5spacy_6lexeme_6Lexeme_c_set_flag(struct __pyx_t_5spacy_7structs_LexemeC *, enum __pyx_t_5spacy_5attrs_attr_id_t, int); + + +/* "tokens/doc.pxd":37 + * + * + * cdef class Doc: # <<<<<<<<<<<<<< + * cdef readonly Pool mem + * cdef readonly Vocab vocab +*/ + +struct __pyx_vtabstruct_5spacy_6tokens_3doc_Doc { + PyArrayObject *(*to_array)(struct __pyx_obj_5spacy_6tokens_3doc_Doc *, PyObject *, int __pyx_skip_dispatch); + int (*__pyx_fuse_0push_back)(struct __pyx_obj_5spacy_6tokens_3doc_Doc *, __pyx_t_5spacy_6tokens_3doc_const_Lexeme_ptr, int); + int (*__pyx_fuse_1push_back)(struct __pyx_obj_5spacy_6tokens_3doc_Doc *, __pyx_t_5spacy_6tokens_3doc_const_TokenC_ptr, int); +}; +static struct __pyx_vtabstruct_5spacy_6tokens_3doc_Doc *__pyx_vtabptr_5spacy_6tokens_3doc_Doc; + + +/* "stateclass.pxd":9 + * + * + * cdef class StateClass: # <<<<<<<<<<<<<< + * cdef StateC* c + * cdef readonly Doc doc +*/ + +struct __pyx_vtabstruct_5spacy_8pipeline_17_parser_internals_10stateclass_StateClass { + struct __pyx_obj_5spacy_8pipeline_17_parser_internals_10stateclass_StateClass *(*borrow)(__pyx_t_5spacy_8pipeline_17_parser_internals_6_state_StateC *, struct __pyx_obj_5spacy_6tokens_3doc_Doc *); + struct __pyx_obj_5spacy_8pipeline_17_parser_internals_10stateclass_StateClass *(*init_offset)(struct __pyx_t_5spacy_7structs_TokenC const *, int, int); +}; +static struct __pyx_vtabstruct_5spacy_8pipeline_17_parser_internals_10stateclass_StateClass *__pyx_vtabptr_5spacy_8pipeline_17_parser_internals_10stateclass_StateClass; +static CYTHON_INLINE struct __pyx_obj_5spacy_8pipeline_17_parser_internals_10stateclass_StateClass *__pyx_f_5spacy_8pipeline_17_parser_internals_10stateclass_10StateClass_borrow(__pyx_t_5spacy_8pipeline_17_parser_internals_6_state_StateC *, struct __pyx_obj_5spacy_6tokens_3doc_Doc *); +static CYTHON_INLINE struct __pyx_obj_5spacy_8pipeline_17_parser_internals_10stateclass_StateClass *__pyx_f_5spacy_8pipeline_17_parser_internals_10stateclass_10StateClass_init_offset(struct __pyx_t_5spacy_7structs_TokenC const *, int, int); + + +/* "transition_system.pxd":39 + * ctypedef int (*del_state_t)(Pool mem, void* state, void* extra_args) except -1 + * + * cdef class TransitionSystem: # <<<<<<<<<<<<<< + * cdef Pool mem + * cdef StringStore strings +*/ + +struct __pyx_vtabstruct_5spacy_8pipeline_17_parser_internals_17transition_system_TransitionSystem { + struct __pyx_t_5spacy_8pipeline_17_parser_internals_17transition_system_Transition (*lookup_transition)(struct __pyx_obj_5spacy_8pipeline_17_parser_internals_17transition_system_TransitionSystem *, PyObject *); + struct __pyx_t_5spacy_8pipeline_17_parser_internals_17transition_system_Transition (*init_transition)(struct __pyx_obj_5spacy_8pipeline_17_parser_internals_17transition_system_TransitionSystem *, int, int, __pyx_t_5spacy_8typedefs_attr_t); + int (*set_valid)(struct __pyx_obj_5spacy_8pipeline_17_parser_internals_17transition_system_TransitionSystem *, int *, __pyx_t_5spacy_8pipeline_17_parser_internals_6_state_StateC const *); + int (*set_costs)(struct __pyx_obj_5spacy_8pipeline_17_parser_internals_17transition_system_TransitionSystem *, int *, __pyx_t_5spacy_8typedefs_weight_t *, __pyx_t_5spacy_8pipeline_17_parser_internals_6_state_StateC const *, PyObject *); +}; +static struct __pyx_vtabstruct_5spacy_8pipeline_17_parser_internals_17transition_system_TransitionSystem *__pyx_vtabptr_5spacy_8pipeline_17_parser_internals_17transition_system_TransitionSystem; + + +/* "tokens/token.pxd":16 + * cdef const int MISSING_DEP = 0 + * + * cdef class Token: # <<<<<<<<<<<<<< + * cdef readonly Vocab vocab + * cdef TokenC* c +*/ + +struct __pyx_vtabstruct_5spacy_6tokens_5token_Token { + struct __pyx_obj_5spacy_6tokens_5token_Token *(*cinit)(struct __pyx_obj_5spacy_5vocab_Vocab *, struct __pyx_t_5spacy_7structs_TokenC const *, int, struct __pyx_obj_5spacy_6tokens_3doc_Doc *); + int (*check_flag)(struct __pyx_obj_5spacy_6tokens_5token_Token *, enum __pyx_t_5spacy_5attrs_attr_id_t, int __pyx_skip_dispatch); + __pyx_t_5spacy_8typedefs_attr_t (*get_struct_attr)(struct __pyx_t_5spacy_7structs_TokenC const *, enum __pyx_t_5spacy_5attrs_attr_id_t); + __pyx_t_5spacy_8typedefs_attr_t (*set_struct_attr)(struct __pyx_t_5spacy_7structs_TokenC *, enum __pyx_t_5spacy_5attrs_attr_id_t, __pyx_t_5spacy_8typedefs_attr_t); + int (*missing_dep)(struct __pyx_t_5spacy_7structs_TokenC const *); + int (*missing_head)(struct __pyx_t_5spacy_7structs_TokenC const *); +}; +static struct __pyx_vtabstruct_5spacy_6tokens_5token_Token *__pyx_vtabptr_5spacy_6tokens_5token_Token; +static CYTHON_INLINE struct __pyx_obj_5spacy_6tokens_5token_Token *__pyx_f_5spacy_6tokens_5token_5Token_cinit(struct __pyx_obj_5spacy_5vocab_Vocab *, struct __pyx_t_5spacy_7structs_TokenC const *, int, struct __pyx_obj_5spacy_6tokens_3doc_Doc *); +static CYTHON_INLINE __pyx_t_5spacy_8typedefs_attr_t __pyx_f_5spacy_6tokens_5token_5Token_get_struct_attr(struct __pyx_t_5spacy_7structs_TokenC const *, enum __pyx_t_5spacy_5attrs_attr_id_t); +static CYTHON_INLINE __pyx_t_5spacy_8typedefs_attr_t __pyx_f_5spacy_6tokens_5token_5Token_set_struct_attr(struct __pyx_t_5spacy_7structs_TokenC *, enum __pyx_t_5spacy_5attrs_attr_id_t, __pyx_t_5spacy_8typedefs_attr_t); +static CYTHON_INLINE int __pyx_f_5spacy_6tokens_5token_5Token_missing_dep(struct __pyx_t_5spacy_7structs_TokenC const *); +static CYTHON_INLINE int __pyx_f_5spacy_6tokens_5token_5Token_missing_head(struct __pyx_t_5spacy_7structs_TokenC const *); + + +/* "thinc/extra/search.pxd":37 + * + * + * cdef class Beam: # <<<<<<<<<<<<<< + * cdef Pool mem + * cdef class_t nr_class +*/ + +struct __pyx_vtabstruct_5thinc_5extra_6search_Beam { + int (*_fill)(struct __pyx_obj_5thinc_5extra_6search_Beam *, __pyx_t_5thinc_5extra_6search_Queue *, __pyx_t_5thinc_5extra_6search_weight_t **, int **); + void *(*at)(struct __pyx_obj_5thinc_5extra_6search_Beam *, int); + int (*initialize)(struct __pyx_obj_5thinc_5extra_6search_Beam *, __pyx_t_5thinc_5extra_6search_init_func_t, __pyx_t_5thinc_5extra_6search_del_func_t, int, void *); + int (*advance)(struct __pyx_obj_5thinc_5extra_6search_Beam *, __pyx_t_5thinc_5extra_6search_trans_func_t, __pyx_t_5thinc_5extra_6search_hash_func_t, void *); + int (*check_done)(struct __pyx_obj_5thinc_5extra_6search_Beam *, __pyx_t_5thinc_5extra_6search_finish_func_t, void *); + void (*set_cell)(struct __pyx_obj_5thinc_5extra_6search_Beam *, int, int, __pyx_t_5thinc_5extra_6search_weight_t, int, __pyx_t_5thinc_5extra_6search_weight_t); + int (*set_row)(struct __pyx_obj_5thinc_5extra_6search_Beam *, int, __pyx_t_5thinc_5extra_6search_weight_t const *, int const *, __pyx_t_5thinc_5extra_6search_weight_t const *); + int (*set_table)(struct __pyx_obj_5thinc_5extra_6search_Beam *, __pyx_t_5thinc_5extra_6search_weight_t **, int **, __pyx_t_5thinc_5extra_6search_weight_t **); +}; +static struct __pyx_vtabstruct_5thinc_5extra_6search_Beam *__pyx_vtabptr_5thinc_5extra_6search_Beam; +static CYTHON_INLINE void *__pyx_f_5thinc_5extra_6search_4Beam_at(struct __pyx_obj_5thinc_5extra_6search_Beam *, int); +static CYTHON_INLINE void __pyx_f_5thinc_5extra_6search_4Beam_set_cell(struct __pyx_obj_5thinc_5extra_6search_Beam *, int, int, __pyx_t_5thinc_5extra_6search_weight_t, int, __pyx_t_5thinc_5extra_6search_weight_t); + + +/* "thinc/extra/search.pxd":75 + * + * + * cdef class MaxViolation: # <<<<<<<<<<<<<< + * cdef Pool mem + * cdef weight_t cost +*/ + +struct __pyx_vtabstruct_5thinc_5extra_6search_MaxViolation { + int (*check)(struct __pyx_obj_5thinc_5extra_6search_MaxViolation *, struct __pyx_obj_5thinc_5extra_6search_Beam *, struct __pyx_obj_5thinc_5extra_6search_Beam *, int __pyx_skip_dispatch); + int (*check_crf)(struct __pyx_obj_5thinc_5extra_6search_MaxViolation *, struct __pyx_obj_5thinc_5extra_6search_Beam *, struct __pyx_obj_5thinc_5extra_6search_Beam *, int __pyx_skip_dispatch); +}; +static struct __pyx_vtabstruct_5thinc_5extra_6search_MaxViolation *__pyx_vtabptr_5thinc_5extra_6search_MaxViolation; + + +/* "spacy/pipeline/_parser_internals/arc_eager.pyx":576 + * + * + * cdef class ArcEager(TransitionSystem): # <<<<<<<<<<<<<< + * def __init__(self, *args, **kwargs): + * TransitionSystem.__init__(self, *args, **kwargs) +*/ + +struct __pyx_vtabstruct_5spacy_8pipeline_17_parser_internals_9arc_eager_ArcEager { + struct __pyx_vtabstruct_5spacy_8pipeline_17_parser_internals_17transition_system_TransitionSystem __pyx_base; + PyObject *(*get_arcs)(struct __pyx_obj_5spacy_8pipeline_17_parser_internals_9arc_eager_ArcEager *, __pyx_t_5spacy_8pipeline_17_parser_internals_6_state_StateC *); +}; +static struct __pyx_vtabstruct_5spacy_8pipeline_17_parser_internals_9arc_eager_ArcEager *__pyx_vtabptr_5spacy_8pipeline_17_parser_internals_9arc_eager_ArcEager; + + +/* "spacy/pipeline/_parser_internals/arc_eager.pyx":323 + * + * + * cdef class Shift: # <<<<<<<<<<<<<< + * """Move the first word of the buffer onto the stack and mark it as "shifted" + * +*/ + +struct __pyx_vtabstruct_5spacy_8pipeline_17_parser_internals_9arc_eager_Shift { + int (*is_valid)(__pyx_t_5spacy_8pipeline_17_parser_internals_6_state_StateC const *, __pyx_t_5spacy_8typedefs_attr_t); + int (*transition)(__pyx_t_5spacy_8pipeline_17_parser_internals_6_state_StateC *, __pyx_t_5spacy_8typedefs_attr_t); + __pyx_t_5spacy_8typedefs_weight_t (*cost)(__pyx_t_5spacy_8pipeline_17_parser_internals_6_state_StateC const *, void const *, __pyx_t_5spacy_8typedefs_attr_t); +}; +static struct __pyx_vtabstruct_5spacy_8pipeline_17_parser_internals_9arc_eager_Shift *__pyx_vtabptr_5spacy_8pipeline_17_parser_internals_9arc_eager_Shift; + + +/* "spacy/pipeline/_parser_internals/arc_eager.pyx":361 + * + * + * cdef class Reduce: # <<<<<<<<<<<<<< + * """ + * Pop from the stack. If it has no head and the stack isn't empty, place +*/ + +struct __pyx_vtabstruct_5spacy_8pipeline_17_parser_internals_9arc_eager_Reduce { + int (*is_valid)(__pyx_t_5spacy_8pipeline_17_parser_internals_6_state_StateC const *, __pyx_t_5spacy_8typedefs_attr_t); + int (*transition)(__pyx_t_5spacy_8pipeline_17_parser_internals_6_state_StateC *, __pyx_t_5spacy_8typedefs_attr_t); + __pyx_t_5spacy_8typedefs_weight_t (*cost)(__pyx_t_5spacy_8pipeline_17_parser_internals_6_state_StateC const *, void const *, __pyx_t_5spacy_8typedefs_attr_t); +}; +static struct __pyx_vtabstruct_5spacy_8pipeline_17_parser_internals_9arc_eager_Reduce *__pyx_vtabptr_5spacy_8pipeline_17_parser_internals_9arc_eager_Reduce; + + +/* "spacy/pipeline/_parser_internals/arc_eager.pyx":411 + * + * + * cdef class LeftArc: # <<<<<<<<<<<<<< + * """Add an arc between B[0] and S[0], replacing the previous head of S[0] if + * one is set. Pop S[0] from the stack. +*/ + +struct __pyx_vtabstruct_5spacy_8pipeline_17_parser_internals_9arc_eager_LeftArc { + int (*is_valid)(__pyx_t_5spacy_8pipeline_17_parser_internals_6_state_StateC const *, __pyx_t_5spacy_8typedefs_attr_t); + int (*transition)(__pyx_t_5spacy_8pipeline_17_parser_internals_6_state_StateC *, __pyx_t_5spacy_8typedefs_attr_t); + __pyx_t_5spacy_8typedefs_weight_t (*cost)(__pyx_t_5spacy_8pipeline_17_parser_internals_6_state_StateC const *, void const *, __pyx_t_5spacy_8typedefs_attr_t); +}; +static struct __pyx_vtabstruct_5spacy_8pipeline_17_parser_internals_9arc_eager_LeftArc *__pyx_vtabptr_5spacy_8pipeline_17_parser_internals_9arc_eager_LeftArc; +static CYTHON_INLINE __pyx_t_5spacy_8typedefs_weight_t __pyx_f_5spacy_8pipeline_17_parser_internals_9arc_eager_7LeftArc_cost(__pyx_t_5spacy_8pipeline_17_parser_internals_6_state_StateC const *, void const *, __pyx_t_5spacy_8typedefs_attr_t); + + +/* "spacy/pipeline/_parser_internals/arc_eager.pyx":464 + * + * + * cdef class RightArc: # <<<<<<<<<<<<<< + * """ + * Add an arc from S[0] to B[0]. Push B[0]. +*/ + +struct __pyx_vtabstruct_5spacy_8pipeline_17_parser_internals_9arc_eager_RightArc { + int (*is_valid)(__pyx_t_5spacy_8pipeline_17_parser_internals_6_state_StateC const *, __pyx_t_5spacy_8typedefs_attr_t); + int (*transition)(__pyx_t_5spacy_8pipeline_17_parser_internals_6_state_StateC *, __pyx_t_5spacy_8typedefs_attr_t); + __pyx_t_5spacy_8typedefs_weight_t (*cost)(__pyx_t_5spacy_8pipeline_17_parser_internals_6_state_StateC const *, void const *, __pyx_t_5spacy_8typedefs_attr_t); +}; +static struct __pyx_vtabstruct_5spacy_8pipeline_17_parser_internals_9arc_eager_RightArc *__pyx_vtabptr_5spacy_8pipeline_17_parser_internals_9arc_eager_RightArc; +static CYTHON_INLINE __pyx_t_5spacy_8typedefs_weight_t __pyx_f_5spacy_8pipeline_17_parser_internals_9arc_eager_8RightArc_cost(__pyx_t_5spacy_8pipeline_17_parser_internals_6_state_StateC const *, void const *, __pyx_t_5spacy_8typedefs_attr_t); + + +/* "spacy/pipeline/_parser_internals/arc_eager.pyx":509 + * + * + * cdef class Break: # <<<<<<<<<<<<<< + * """Mark the second word of the buffer as the start of a + * sentence. +*/ + +struct __pyx_vtabstruct_5spacy_8pipeline_17_parser_internals_9arc_eager_Break { + int (*is_valid)(__pyx_t_5spacy_8pipeline_17_parser_internals_6_state_StateC const *, __pyx_t_5spacy_8typedefs_attr_t); + int (*transition)(__pyx_t_5spacy_8pipeline_17_parser_internals_6_state_StateC *, __pyx_t_5spacy_8typedefs_attr_t); + __pyx_t_5spacy_8typedefs_weight_t (*cost)(__pyx_t_5spacy_8pipeline_17_parser_internals_6_state_StateC const *, void const *, __pyx_t_5spacy_8typedefs_attr_t); +}; +static struct __pyx_vtabstruct_5spacy_8pipeline_17_parser_internals_9arc_eager_Break *__pyx_vtabptr_5spacy_8pipeline_17_parser_internals_9arc_eager_Break; + + +/* "View.MemoryView":110 + * + * + * @cython.collection_type("sequence") # <<<<<<<<<<<<<< + * @cname("__pyx_array") + * cdef class array: +*/ + +struct __pyx_vtabstruct_array { + PyObject *(*get_memview)(struct __pyx_array_obj *); +}; +static struct __pyx_vtabstruct_array *__pyx_vtabptr_array; + + +/* "View.MemoryView":334 + * + * + * @cname('__pyx_memoryview') # <<<<<<<<<<<<<< + * cdef class memoryview: + * +*/ + +struct __pyx_vtabstruct_memoryview { + char *(*get_item_pointer)(struct __pyx_memoryview_obj *, PyObject *); + PyObject *(*is_slice)(struct __pyx_memoryview_obj *, PyObject *); + PyObject *(*setitem_slice_assignment)(struct __pyx_memoryview_obj *, PyObject *, PyObject *); + PyObject *(*setitem_slice_assign_scalar)(struct __pyx_memoryview_obj *, struct __pyx_memoryview_obj *, PyObject *); + PyObject *(*setitem_indexed)(struct __pyx_memoryview_obj *, PyObject *, PyObject *); + PyObject *(*convert_item_to_object)(struct __pyx_memoryview_obj *, char *); + PyObject *(*assign_item_from_object)(struct __pyx_memoryview_obj *, char *, PyObject *); + PyObject *(*_get_base)(struct __pyx_memoryview_obj *); +}; +static struct __pyx_vtabstruct_memoryview *__pyx_vtabptr_memoryview; + + +/* "View.MemoryView":951 + * + * + * @cython.collection_type("sequence") # <<<<<<<<<<<<<< + * @cname('__pyx_memoryviewslice') + * cdef class _memoryviewslice(memoryview): +*/ + +struct __pyx_vtabstruct__memoryviewslice { + struct __pyx_vtabstruct_memoryview __pyx_base; +}; +static struct __pyx_vtabstruct__memoryviewslice *__pyx_vtabptr__memoryviewslice; +/* #### 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); + +/* 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) + +/* RaiseException.export */ +static void __Pyx_Raise(PyObject *type, PyObject *value, PyObject *tb, PyObject *cause); + +/* 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 + +/* RaiseUnexpectedTypeError.proto */ +static int __Pyx_RaiseUnexpectedTypeError(const char *expected, PyObject *obj); + +/* PyMemoryError_Check.proto */ +#define __Pyx_PyExc_MemoryError_Check(obj) __Pyx_TypeCheck(obj, PyExc_MemoryError) + +/* 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); + +/* CIntToPyUnicode.proto */ +#define __Pyx_PyUnicode_From_Py_ssize_t(value, width, padding_char, format_char) (\ + ((format_char) == ('c')) ?\ + __Pyx_uchar___Pyx_PyUnicode_From_Py_ssize_t(value, width, padding_char) :\ + __Pyx____Pyx_PyUnicode_From_Py_ssize_t(value, width, padding_char, format_char)\ + ) +static CYTHON_INLINE PyObject* __Pyx_uchar___Pyx_PyUnicode_From_Py_ssize_t(Py_ssize_t value, Py_ssize_t width, char padding_char); +static CYTHON_INLINE PyObject* __Pyx____Pyx_PyUnicode_From_Py_ssize_t(Py_ssize_t 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); + +/* 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 + +CYTHON_UNUSED static int __pyx_array_getbuffer(PyObject *__pyx_v_self, Py_buffer *__pyx_v_info, int __pyx_v_flags); /*proto*/ +static PyObject *__pyx_array_get_memview(struct __pyx_array_obj *); /*proto*/ +/* GetAttr.proto */ +static CYTHON_INLINE PyObject *__Pyx_GetAttr(PyObject *, PyObject *); + +/* GetItemInt.proto */ +#define __Pyx_GetItemInt(o, i, type, is_signed, to_py_func, is_list, wraparound, boundscheck, has_gil, unsafe_shared)\ + (__Pyx_fits_Py_ssize_t(i, type, is_signed) ?\ + __Pyx_GetItemInt_Fast(o, (Py_ssize_t)i, is_list, wraparound, boundscheck, unsafe_shared) :\ + (is_list ? (PyErr_SetString(PyExc_IndexError, "list index out of range"), (PyObject*)NULL) :\ + __Pyx_GetItemInt_Generic(o, to_py_func(i)))) +#define __Pyx_GetItemInt_List(o, i, type, is_signed, to_py_func, is_list, wraparound, boundscheck, has_gil, unsafe_shared)\ + (__Pyx_fits_Py_ssize_t(i, type, is_signed) ?\ + __Pyx_GetItemInt_List_Fast(o, (Py_ssize_t)i, wraparound, boundscheck, unsafe_shared) :\ + (PyErr_SetString(PyExc_IndexError, "list index out of range"), (PyObject*)NULL)) +static CYTHON_INLINE PyObject *__Pyx_GetItemInt_List_Fast(PyObject *o, Py_ssize_t i, + int wraparound, int boundscheck, int unsafe_shared); +#define __Pyx_GetItemInt_Tuple(o, i, type, is_signed, to_py_func, is_list, wraparound, boundscheck, has_gil, unsafe_shared)\ + (__Pyx_fits_Py_ssize_t(i, type, is_signed) ?\ + __Pyx_GetItemInt_Tuple_Fast(o, (Py_ssize_t)i, wraparound, boundscheck, unsafe_shared) :\ + (PyErr_SetString(PyExc_IndexError, "tuple index out of range"), (PyObject*)NULL)) +static CYTHON_INLINE PyObject *__Pyx_GetItemInt_Tuple_Fast(PyObject *o, Py_ssize_t i, + int wraparound, int boundscheck, int unsafe_shared); +static PyObject *__Pyx_GetItemInt_Generic(PyObject *o, PyObject* j); +static CYTHON_INLINE PyObject *__Pyx_GetItemInt_Fast(PyObject *o, Py_ssize_t i, + int is_list, int wraparound, int boundscheck, int unsafe_shared); + +/* ObjectGetItem.proto */ +#if CYTHON_USE_TYPE_SLOTS +static CYTHON_INLINE PyObject *__Pyx_PyObject_GetItem(PyObject *obj, PyObject *key); +#else +#define __Pyx_PyObject_GetItem(obj, key) PyObject_GetItem(obj, key) +#endif + +/* RejectKeywords.export */ +static void __Pyx_RejectKeywords(const char* function_name, PyObject *kwds); + +/* PyTypeError_Check.proto */ +#define __Pyx_PyExc_TypeError_Check(obj) __Pyx_TypeCheck(obj, PyExc_TypeError) + +/* DivInt[Py_ssize_t].proto */ +static CYTHON_INLINE Py_ssize_t __Pyx_div_Py_ssize_t(Py_ssize_t, Py_ssize_t, int b_is_constant); + +/* UnaryNegOverflows.proto */ +#define __Pyx_UNARY_NEG_WOULD_OVERFLOW(x)\ + (((x) < 0) & ((unsigned long)(x) == 0-(unsigned long)(x))) + +/* GetAttr3.proto */ +static CYTHON_INLINE PyObject *__Pyx_GetAttr3(PyObject *, PyObject *, PyObject *); + +/* 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 + +/* AssertionsEnabled.proto */ +#if CYTHON_COMPILING_IN_LIMITED_API || PY_VERSION_HEX >= 0x030C0000 + static int __pyx_assertions_enabled_flag; + #define __pyx_assertions_enabled() (__pyx_assertions_enabled_flag) + static int __Pyx_init_assertions_enabled(void) { + PyObject *builtins, *debug, *debug_str; + int flag; + builtins = PyEval_GetBuiltins(); + if (!builtins) goto bad; + debug_str = PyUnicode_FromStringAndSize("__debug__", 9); + if (!debug_str) goto bad; + debug = PyObject_GetItem(builtins, debug_str); + Py_DECREF(debug_str); + if (!debug) goto bad; + flag = PyObject_IsTrue(debug); + Py_DECREF(debug); + if (flag == -1) goto bad; + __pyx_assertions_enabled_flag = flag; + return 0; + bad: + __pyx_assertions_enabled_flag = 1; + return -1; + } +#else + #define __Pyx_init_assertions_enabled() (0) + #define __pyx_assertions_enabled() (!Py_OptimizeFlag) +#endif + +/* PyAssertionError_Check.proto */ +#define __Pyx_PyExc_AssertionError_Check(obj) __Pyx_TypeCheck(obj, PyExc_AssertionError) + +/* RaiseTooManyValuesToUnpack.proto */ +static CYTHON_INLINE void __Pyx_RaiseTooManyValuesError(Py_ssize_t expected); + +/* RaiseNeedMoreValuesToUnpack.proto */ +static CYTHON_INLINE void __Pyx_RaiseNeedMoreValuesError(Py_ssize_t index); + +/* RaiseNoneIterError.proto */ +static CYTHON_INLINE void __Pyx_RaiseNoneNotIterableError(void); + +/* ExtTypeTest.proto */ +static CYTHON_INLINE int __Pyx_TypeTest(PyObject *obj, PyTypeObject *type); + +/* 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 + +/* 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); + +/* 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 + +CYTHON_UNUSED static int __pyx_memoryview_getbuffer(PyObject *__pyx_v_self, Py_buffer *__pyx_v_info, int __pyx_v_flags); /*proto*/ +/* 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 + +/* PySequenceMultiply.proto */ +#define __Pyx_PySequence_Multiply_Left(mul, seq) __Pyx_PySequence_Multiply(seq, mul) +static CYTHON_INLINE PyObject* __Pyx_PySequence_Multiply(PyObject *seq, Py_ssize_t mul); + +/* PyObjectFormatAndDecref.proto */ +static CYTHON_INLINE PyObject* __Pyx_PyObject_FormatSimpleAndDecref(PyObject* s, PyObject* f); +static CYTHON_INLINE PyObject* __Pyx_PyObject_FormatAndDecref(PyObject* s, PyObject* f); + +/* PyObjectFormat.proto */ +#if CYTHON_USE_UNICODE_WRITER +static PyObject* __Pyx_PyObject_Format(PyObject* s, PyObject* f); +#else +#define __Pyx_PyObject_Format(s, f) PyObject_Format(s, f) +#endif + +/* SetItemInt.proto */ +#define __Pyx_SetItemInt(o, i, v, type, is_signed, to_py_func, is_list, wraparound, boundscheck, has_gil, unsafe_shared)\ + (__Pyx_fits_Py_ssize_t(i, type, is_signed) ?\ + __Pyx_SetItemInt_Fast(o, (Py_ssize_t)i, v, is_list, wraparound, boundscheck, unsafe_shared) :\ + (is_list ? (PyErr_SetString(PyExc_IndexError, "list assignment index out of range"), -1) :\ + __Pyx_SetItemInt_Generic(o, to_py_func(i), v))) +static int __Pyx_SetItemInt_Generic(PyObject *o, PyObject *j, PyObject *v); +static CYTHON_INLINE int __Pyx_SetItemInt_Fast(PyObject *o, Py_ssize_t i, PyObject *v, + int is_list, int wraparound, int boundscheck, int unsafe_shared); + +/* RaiseUnboundLocalError.proto */ +static void __Pyx_RaiseUnboundLocalError(const char *varname); + +/* PyIndexError_Check.proto */ +#define __Pyx_PyExc_IndexError_Check(obj) __Pyx_TypeCheck(obj, PyExc_IndexError) + +/* DivInt[long].proto */ +static CYTHON_INLINE long __Pyx_div_long(long, long, int b_is_constant); + +/* PyImportError_Check.proto */ +#define __Pyx_PyExc_ImportError_Check(obj) __Pyx_TypeCheck(obj, PyExc_ImportError) + +/* tp_new.proto */ +#define __Pyx_tp_new(type_obj, args) __Pyx_tp_new_kwargs(type_obj, args, NULL) +static CYTHON_INLINE PyObject* __Pyx_tp_new_kwargs(PyObject* type_obj, PyObject* args, PyObject* kwargs); + +/* WriteUnraisableException.proto */ +static void __Pyx_WriteUnraisable(const char *name, int clineno, + int lineno, const char *filename, + int full_traceback, int nogil); + +/* MoveIfSupported.proto */ +#if CYTHON_USE_CPP_STD_MOVE + #include + #define __PYX_STD_MOVE_IF_SUPPORTED(x) std::move(x) +#else + #define __PYX_STD_MOVE_IF_SUPPORTED(x) x +#endif + +/* 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 + +/* 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 + +/* IterFinish.proto */ +static CYTHON_INLINE int __Pyx_IterFinish(void); + +/* UnpackItemEndCheck.proto */ +static int __Pyx_IternextUnpackEndCheck(PyObject *retval, Py_ssize_t expected); + +/* PyRange_Check.proto */ +#if CYTHON_COMPILING_IN_PYPY && !defined(PyRange_Check) + #define PyRange_Check(obj) __Pyx_TypeCheck((obj), &PyRange_Type) +#endif + +/* RaiseClosureNameError.proto */ +static void __Pyx_RaiseClosureNameError(const char *varname); + +/* PyObjectCallNoArg.proto (used by pyfrozenset_new) */ +static CYTHON_INLINE PyObject* __Pyx_PyObject_CallNoArg(PyObject *func); + +/* 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); + +/* SliceObject.proto */ +static CYTHON_INLINE PyObject* __Pyx_PyObject_GetSlice( + PyObject* obj, Py_ssize_t cstart, Py_ssize_t cstop, + PyObject** py_start, PyObject** py_stop, PyObject** py_slice, + int has_cstart, int has_cstop, int wraparound); + +/* PyObjectCall2Args.proto (used by CallUnboundCMethod1) */ +static CYTHON_INLINE PyObject* __Pyx_PyObject_Call2Args(PyObject* function, PyObject* arg1, PyObject* arg2); + +/* CallUnboundCMethod1.proto */ +CYTHON_UNUSED +static PyObject* __Pyx__CallUnboundCMethod1(__Pyx_CachedCFunction* cfunc, PyObject* self, PyObject* arg); +#if CYTHON_COMPILING_IN_CPYTHON +static CYTHON_INLINE PyObject* __Pyx_CallUnboundCMethod1(__Pyx_CachedCFunction* cfunc, PyObject* self, PyObject* arg); +#else +#define __Pyx_CallUnboundCMethod1(cfunc, self, arg) __Pyx__CallUnboundCMethod1(cfunc, self, arg) +#endif + +/* KeywordStringCheck.proto */ +static CYTHON_INLINE int __Pyx_CheckKeywordStrings(const char* function_name, PyObject *kw); + +/* dict_getitem_default.proto */ +static PyObject* __Pyx_PyDict_GetItemDefault(PyObject* d, PyObject* key, PyObject* default_value); + +/* 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); + +/* 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 + +/* 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 + +/* PySequenceContains.proto */ +static CYTHON_INLINE int __Pyx_PySequence_ContainsTF(PyObject* item, PyObject* seq, int eq) { + int result = PySequence_Contains(seq, item); + return unlikely(result < 0) ? result : (result == (eq == Py_EQ)); +} + +/* PyKeyError_Check.proto */ +#define __Pyx_PyExc_KeyError_Check(obj) __Pyx_TypeCheck(obj, PyExc_KeyError) + +/* PyLongCompare.proto */ +static CYTHON_INLINE int __Pyx_PyLong_BoolNeObjC(PyObject *op1, PyObject *op2, long intval, long inplace); + +/* PyObject_Unicode.proto */ +#define __Pyx_PyObject_Unicode(obj)\ + (likely(PyUnicode_CheckExact(obj)) ? __Pyx_NewRef(obj) : PyObject_Str(obj)) + +/* CallNextTpDealloc.proto */ +static void __Pyx_call_next_tp_dealloc(PyObject* obj, destructor current_tp_dealloc); + +/* CallNextTpTraverse.proto */ +static int __Pyx_call_next_tp_traverse(PyObject* obj, visitproc v, void *a, traverseproc current_tp_traverse); + +/* CallNextTpClear.proto */ +static void __Pyx_call_next_tp_clear(PyObject* obj, inquiry current_tp_clear); + +/* AllocateExtensionType.proto */ +static PyObject *__Pyx_AllocateExtensionType(PyTypeObject *t, int is_final); + +/* DefaultPlacementNew.proto */ +#include +template +void __Pyx_default_placement_construct(T* x) { + new (static_cast(x)) T(); +} + +/* CheckTypeForFreelists.proto */ +#if CYTHON_USE_FREELISTS +#if CYTHON_USE_TYPE_SPECS +#define __PYX_CHECK_FINAL_TYPE_FOR_FREELISTS(t, expected_tp, expected_size) ((int) ((t) == (expected_tp))) +#define __PYX_CHECK_TYPE_FOR_FREELIST_FLAGS Py_TPFLAGS_IS_ABSTRACT +#else +#define __PYX_CHECK_FINAL_TYPE_FOR_FREELISTS(t, expected_tp, expected_size) ((int) ((t)->tp_basicsize == (expected_size))) +#define __PYX_CHECK_TYPE_FOR_FREELIST_FLAGS (Py_TPFLAGS_IS_ABSTRACT | Py_TPFLAGS_HEAPTYPE) +#endif +#define __PYX_CHECK_TYPE_FOR_FREELISTS(t, expected_tp, expected_size)\ + (__PYX_CHECK_FINAL_TYPE_FOR_FREELISTS((t), (expected_tp), (expected_size)) &\ + (int) (!__Pyx_PyType_HasFeature((t), __PYX_CHECK_TYPE_FOR_FREELIST_FLAGS))) +#endif + +/* TypeImport.proto */ +#ifndef __PYX_HAVE_RT_ImportType_proto_3_2_1 +#define __PYX_HAVE_RT_ImportType_proto_3_2_1 +#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_1(s) alignof(s) +#else +#define __PYX_GET_STRUCT_ALIGNMENT_3_2_1(s) sizeof(void*) +#endif +enum __Pyx_ImportType_CheckSize_3_2_1 { + __Pyx_ImportType_CheckSize_Error_3_2_1 = 0, + __Pyx_ImportType_CheckSize_Warn_3_2_1 = 1, + __Pyx_ImportType_CheckSize_Ignore_3_2_1 = 2 +}; +static PyTypeObject *__Pyx_ImportType_3_2_1(PyObject* module, const char *module_name, const char *class_name, size_t size, size_t alignment, enum __Pyx_ImportType_CheckSize_3_2_1 check_size); +#endif + +/* GetVTable.proto */ +static void* __Pyx_GetVtable(PyTypeObject *type); + +/* 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); + +/* SetVTable.proto */ +static int __Pyx_SetVtable(PyTypeObject* typeptr , void* vtable); + +/* MergeVTables.proto */ +static int __Pyx_MergeVtables(PyTypeObject *type); + +/* 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); + +/* VoidPtrImport.proto */ +static int __Pyx_ImportVoidPtr_3_2_1(PyObject *module, const char *name, void **p, const char *sig); + +/* FunctionImport.proto */ +static int __Pyx_ImportFunction_3_2_1(PyObject *module, const char *funcname, void (**f)(void), const char *sig); + +/* ImportFrom.proto */ +static PyObject* __Pyx_ImportFrom(PyObject* module, PyObject* name); + +/* ClassMethod.proto */ +#if !CYTHON_COMPILING_IN_LIMITED_API +#include "descrobject.h" +#endif +CYTHON_UNUSED static PyObject* __Pyx_Method_ClassMethod(PyObject *method); + +/* GetNameInClass.proto */ +#define __Pyx_GetNameInClass(var, nmspace, name) (var) = __Pyx__GetNameInClass(nmspace, name) +static PyObject *__Pyx__GetNameInClass(PyObject *nmspace, PyObject *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); + +/* CheckUnpickleChecksum.proto */ +static CYTHON_INLINE int __Pyx_CheckUnpickleChecksum(long checksum, long checksum1, long checksum2, long checksum3, const char *members); + +struct __pyx_t_5spacy_8pipeline_17_parser_internals_6_state_ArcC; +static PyObject* __pyx_convert__to_py_struct____pyx_t_5spacy_8pipeline_17_parser_internals_6_state_ArcC(struct __pyx_t_5spacy_8pipeline_17_parser_internals_6_state_ArcC s); +/* Print.proto */ +static int __Pyx_Print(PyObject*, PyObject *, int); + +/* RealImag.proto */ +#if CYTHON_CCOMPLEX + #ifdef __cplusplus + #define __Pyx_CREAL(z) ((z).real()) + #define __Pyx_CIMAG(z) ((z).imag()) + #else + #define __Pyx_CREAL(z) (__real__(z)) + #define __Pyx_CIMAG(z) (__imag__(z)) + #endif +#else + #define __Pyx_CREAL(z) ((z).real) + #define __Pyx_CIMAG(z) ((z).imag) +#endif +#if defined(__cplusplus) && CYTHON_CCOMPLEX\ + && (defined(_WIN32) || defined(__clang__) || (defined(__GNUC__) && (__GNUC__ >= 5 || __GNUC__ == 4 && __GNUC_MINOR__ >= 4 )) || __cplusplus >= 201103) + #define __Pyx_SET_CREAL(z,x) ((z).real(x)) + #define __Pyx_SET_CIMAG(z,y) ((z).imag(y)) +#else + #define __Pyx_SET_CREAL(z,x) __Pyx_CREAL(z) = (x) + #define __Pyx_SET_CIMAG(z,y) __Pyx_CIMAG(z) = (y) +#endif + +/* Arithmetic.proto */ +#if CYTHON_CCOMPLEX && (1) && (!0 || __cplusplus) + #define __Pyx_c_eq_float(a, b) ((a)==(b)) + #define __Pyx_c_sum_float(a, b) ((a)+(b)) + #define __Pyx_c_diff_float(a, b) ((a)-(b)) + #define __Pyx_c_prod_float(a, b) ((a)*(b)) + #define __Pyx_c_quot_float(a, b) ((a)/(b)) + #define __Pyx_c_neg_float(a) (-(a)) + #ifdef __cplusplus + #define __Pyx_c_is_zero_float(z) ((z)==(float)0) + #define __Pyx_c_conj_float(z) (::std::conj(z)) + #if 1 + #define __Pyx_c_abs_float(z) (::std::abs(z)) + #define __Pyx_c_pow_float(a, b) (::std::pow(a, b)) + #endif + #else + #define __Pyx_c_is_zero_float(z) ((z)==0) + #define __Pyx_c_conj_float(z) (conjf(z)) + #if 1 + #define __Pyx_c_abs_float(z) (cabsf(z)) + #define __Pyx_c_pow_float(a, b) (cpowf(a, b)) + #endif + #endif +#else + static CYTHON_INLINE int __Pyx_c_eq_float(__pyx_t_float_complex, __pyx_t_float_complex); + static CYTHON_INLINE __pyx_t_float_complex __Pyx_c_sum_float(__pyx_t_float_complex, __pyx_t_float_complex); + static CYTHON_INLINE __pyx_t_float_complex __Pyx_c_diff_float(__pyx_t_float_complex, __pyx_t_float_complex); + static CYTHON_INLINE __pyx_t_float_complex __Pyx_c_prod_float(__pyx_t_float_complex, __pyx_t_float_complex); + static CYTHON_INLINE __pyx_t_float_complex __Pyx_c_quot_float(__pyx_t_float_complex, __pyx_t_float_complex); + static CYTHON_INLINE __pyx_t_float_complex __Pyx_c_neg_float(__pyx_t_float_complex); + static CYTHON_INLINE int __Pyx_c_is_zero_float(__pyx_t_float_complex); + static CYTHON_INLINE __pyx_t_float_complex __Pyx_c_conj_float(__pyx_t_float_complex); + #if 1 + static CYTHON_INLINE float __Pyx_c_abs_float(__pyx_t_float_complex); + static CYTHON_INLINE __pyx_t_float_complex __Pyx_c_pow_float(__pyx_t_float_complex, __pyx_t_float_complex); + #endif +#endif + +/* Arithmetic.proto */ +#if CYTHON_CCOMPLEX && (1) && (!0 || __cplusplus) + #define __Pyx_c_eq_double(a, b) ((a)==(b)) + #define __Pyx_c_sum_double(a, b) ((a)+(b)) + #define __Pyx_c_diff_double(a, b) ((a)-(b)) + #define __Pyx_c_prod_double(a, b) ((a)*(b)) + #define __Pyx_c_quot_double(a, b) ((a)/(b)) + #define __Pyx_c_neg_double(a) (-(a)) + #ifdef __cplusplus + #define __Pyx_c_is_zero_double(z) ((z)==(double)0) + #define __Pyx_c_conj_double(z) (::std::conj(z)) + #if 1 + #define __Pyx_c_abs_double(z) (::std::abs(z)) + #define __Pyx_c_pow_double(a, b) (::std::pow(a, b)) + #endif + #else + #define __Pyx_c_is_zero_double(z) ((z)==0) + #define __Pyx_c_conj_double(z) (conj(z)) + #if 1 + #define __Pyx_c_abs_double(z) (cabs(z)) + #define __Pyx_c_pow_double(a, b) (cpow(a, b)) + #endif + #endif +#else + static CYTHON_INLINE int __Pyx_c_eq_double(__pyx_t_double_complex, __pyx_t_double_complex); + static CYTHON_INLINE __pyx_t_double_complex __Pyx_c_sum_double(__pyx_t_double_complex, __pyx_t_double_complex); + static CYTHON_INLINE __pyx_t_double_complex __Pyx_c_diff_double(__pyx_t_double_complex, __pyx_t_double_complex); + static CYTHON_INLINE __pyx_t_double_complex __Pyx_c_prod_double(__pyx_t_double_complex, __pyx_t_double_complex); + static CYTHON_INLINE __pyx_t_double_complex __Pyx_c_quot_double(__pyx_t_double_complex, __pyx_t_double_complex); + static CYTHON_INLINE __pyx_t_double_complex __Pyx_c_neg_double(__pyx_t_double_complex); + static CYTHON_INLINE int __Pyx_c_is_zero_double(__pyx_t_double_complex); + static CYTHON_INLINE __pyx_t_double_complex __Pyx_c_conj_double(__pyx_t_double_complex); + #if 1 + static CYTHON_INLINE double __Pyx_c_abs_double(__pyx_t_double_complex); + static CYTHON_INLINE __pyx_t_double_complex __Pyx_c_pow_double(__pyx_t_double_complex, __pyx_t_double_complex); + #endif +#endif + +/* Arithmetic.proto */ +#if CYTHON_CCOMPLEX && (1) && (!0 || __cplusplus) + #define __Pyx_c_eq_long__double(a, b) ((a)==(b)) + #define __Pyx_c_sum_long__double(a, b) ((a)+(b)) + #define __Pyx_c_diff_long__double(a, b) ((a)-(b)) + #define __Pyx_c_prod_long__double(a, b) ((a)*(b)) + #define __Pyx_c_quot_long__double(a, b) ((a)/(b)) + #define __Pyx_c_neg_long__double(a) (-(a)) + #ifdef __cplusplus + #define __Pyx_c_is_zero_long__double(z) ((z)==(long double)0) + #define __Pyx_c_conj_long__double(z) (::std::conj(z)) + #if 1 + #define __Pyx_c_abs_long__double(z) (::std::abs(z)) + #define __Pyx_c_pow_long__double(a, b) (::std::pow(a, b)) + #endif + #else + #define __Pyx_c_is_zero_long__double(z) ((z)==0) + #define __Pyx_c_conj_long__double(z) (conjl(z)) + #if 1 + #define __Pyx_c_abs_long__double(z) (cabsl(z)) + #define __Pyx_c_pow_long__double(a, b) (cpowl(a, b)) + #endif + #endif +#else + static CYTHON_INLINE int __Pyx_c_eq_long__double(__pyx_t_long_double_complex, __pyx_t_long_double_complex); + static CYTHON_INLINE __pyx_t_long_double_complex __Pyx_c_sum_long__double(__pyx_t_long_double_complex, __pyx_t_long_double_complex); + static CYTHON_INLINE __pyx_t_long_double_complex __Pyx_c_diff_long__double(__pyx_t_long_double_complex, __pyx_t_long_double_complex); + static CYTHON_INLINE __pyx_t_long_double_complex __Pyx_c_prod_long__double(__pyx_t_long_double_complex, __pyx_t_long_double_complex); + static CYTHON_INLINE __pyx_t_long_double_complex __Pyx_c_quot_long__double(__pyx_t_long_double_complex, __pyx_t_long_double_complex); + static CYTHON_INLINE __pyx_t_long_double_complex __Pyx_c_neg_long__double(__pyx_t_long_double_complex); + static CYTHON_INLINE int __Pyx_c_is_zero_long__double(__pyx_t_long_double_complex); + static CYTHON_INLINE __pyx_t_long_double_complex __Pyx_c_conj_long__double(__pyx_t_long_double_complex); + #if 1 + static CYTHON_INLINE long double __Pyx_c_abs_long__double(__pyx_t_long_double_complex); + static CYTHON_INLINE __pyx_t_long_double_complex __Pyx_c_pow_long__double(__pyx_t_long_double_complex, __pyx_t_long_double_complex); + #endif +#endif + +/* CppExceptionConversion.proto */ +#ifndef __Pyx_CppExn2PyErr +#include +#include +#include +#include +static void __Pyx_CppExn2PyErr() { + try { + if (PyErr_Occurred()) + ; // let the latest Python exn pass through and ignore the current one + else + throw; + } catch (const std::bad_alloc& exn) { + PyErr_SetString(PyExc_MemoryError, exn.what()); + } catch (const std::bad_cast& exn) { + PyErr_SetString(PyExc_TypeError, exn.what()); + } catch (const std::bad_typeid& exn) { + PyErr_SetString(PyExc_TypeError, exn.what()); + } catch (const std::domain_error& exn) { + PyErr_SetString(PyExc_ValueError, exn.what()); + } catch (const std::invalid_argument& exn) { + PyErr_SetString(PyExc_ValueError, exn.what()); + } catch (const std::ios_base::failure& exn) { + PyErr_SetString(PyExc_IOError, exn.what()); + } catch (const std::out_of_range& exn) { + PyErr_SetString(PyExc_IndexError, exn.what()); + } catch (const std::overflow_error& exn) { + PyErr_SetString(PyExc_OverflowError, exn.what()); + } catch (const std::range_error& exn) { + PyErr_SetString(PyExc_ArithmeticError, exn.what()); + } catch (const std::underflow_error& exn) { + PyErr_SetString(PyExc_ArithmeticError, exn.what()); + } catch (const std::exception& exn) { + PyErr_SetString(PyExc_RuntimeError, exn.what()); + } + catch (...) + { + PyErr_SetString(PyExc_RuntimeError, "Unknown exception"); + } +} +#endif + +/* BufferStructDeclare.proto */ +typedef struct { + Py_ssize_t shape, strides, suboffsets; +} __Pyx_Buf_DimInfo; +typedef struct { + size_t refcount; + Py_buffer pybuffer; +} __Pyx_Buffer; +typedef struct { + __Pyx_Buffer *rcbuffer; + char *data; + __Pyx_Buf_DimInfo diminfo[8]; +} __Pyx_LocalBuf_ND; + +/* MemviewRefcount.proto */ +static CYTHON_INLINE int __pyx_add_acquisition_count_locked( + __pyx_atomic_int_type *acquisition_count, PyThread_type_lock lock); +static CYTHON_INLINE int __pyx_sub_acquisition_count_locked( + __pyx_atomic_int_type *acquisition_count, PyThread_type_lock lock); +#define __pyx_get_slice_count_pointer(memview) (&memview->acquisition_count) +#define __PYX_INC_MEMVIEW(slice, have_gil) __Pyx_INC_MEMVIEW(slice, have_gil, __LINE__) +#define __PYX_XCLEAR_MEMVIEW(slice, have_gil) __Pyx_XCLEAR_MEMVIEW(slice, have_gil, __LINE__) +static CYTHON_INLINE void __Pyx_INC_MEMVIEW(__Pyx_memviewslice *, int, int); +static CYTHON_INLINE void __Pyx_XCLEAR_MEMVIEW(__Pyx_memviewslice *, int, int); + +/* MemviewSliceIsContig.proto */ +static int __pyx_memviewslice_is_contig(const __Pyx_memviewslice mvs, char order, int ndim); + +/* OverlappingSlices.proto */ +static int __pyx_slices_overlap(__Pyx_memviewslice *slice1, + __Pyx_memviewslice *slice2, + int ndim, size_t itemsize); + +/* MemviewSliceInit.proto */ +static int __Pyx_init_memviewslice( + struct __pyx_memoryview_obj *memview, + int ndim, + __Pyx_memviewslice *memviewslice, + int memview_is_new_reference); + +/* CIntToPy.proto */ +static CYTHON_INLINE PyObject* __Pyx_PyLong_From___pyx_anon_enum(int value); + +/* CIntFromPy.proto */ +static CYTHON_INLINE int __Pyx_PyLong_As_int(PyObject *); + +/* CIntFromPy.proto */ +static CYTHON_INLINE uint64_t __Pyx_PyLong_As_uint64_t(PyObject *); + +/* CIntFromPy.proto */ +static CYTHON_INLINE long __Pyx_PyLong_As_long(PyObject *); + +/* CIntFromPy.proto */ +static CYTHON_INLINE int32_t __Pyx_PyLong_As_int32_t(PyObject *); + +/* CIntToPy.proto */ +static CYTHON_INLINE PyObject* __Pyx_PyLong_From_int32_t(int32_t value); + +/* CIntToPy.proto */ +static CYTHON_INLINE PyObject* __Pyx_PyLong_From_int(int value); + +/* CIntToPy.proto */ +static CYTHON_INLINE PyObject* __Pyx_PyLong_From_long(long value); + +/* CIntToPy.proto */ +static CYTHON_INLINE PyObject* __Pyx_PyLong_From_uint64_t(uint64_t value); + +/* CIntFromPy.proto */ +static CYTHON_INLINE size_t __Pyx_PyLong_As_size_t(PyObject *); + +/* PrintOne.proto */ +static int __Pyx_PrintOne(PyObject* stream, PyObject *o); + +/* MemviewSliceCopy.proto */ +static __Pyx_memviewslice +__pyx_memoryview_copy_new_contig(const __Pyx_memviewslice *from_mvs, + const char *mode, int ndim, + size_t sizeof_dtype, int contig_flag, + int dtype_is_object); + +/* PyObjectCallMethod1.proto */ +static PyObject* __Pyx_PyObject_CallMethod1(PyObject* obj, PyObject* method_name, PyObject* arg); + +/* UpdateUnpickledDict.proto */ +static int __Pyx_UpdateUnpickledDict(PyObject *obj, PyObject *state, Py_ssize_t index); + +/* CIntFromPy.proto */ +static CYTHON_INLINE char __Pyx_PyLong_As_char(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 + +/* 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); + +/* IterNextPlain.proto (used by CoroutineBase) */ +static CYTHON_INLINE PyObject *__Pyx_PyIter_Next_Plain(PyObject *iterator); +#if CYTHON_COMPILING_IN_LIMITED_API && __PYX_LIMITED_VERSION_HEX < 0x030A0000 +static PyObject *__Pyx_GetBuiltinNext_LimitedAPI(void); +#endif + +/* ReturnWithStopIteration.proto (used by CoroutineBase) */ +static CYTHON_INLINE void __Pyx_ReturnWithStopIteration(PyObject* value, int async, int iternext); + +/* CoroutineBase.proto (used by Generator) */ +struct __pyx_CoroutineObject; +typedef PyObject *(*__pyx_coroutine_body_t)(struct __pyx_CoroutineObject *, PyThreadState *, PyObject *); +#if CYTHON_USE_EXC_INFO_STACK +#define __Pyx_ExcInfoStruct _PyErr_StackItem +#else +typedef struct { + PyObject *exc_type; + PyObject *exc_value; + PyObject *exc_traceback; +} __Pyx_ExcInfoStruct; +#endif +typedef struct __pyx_CoroutineObject { + PyObject_HEAD + __pyx_coroutine_body_t body; + PyObject *closure; + __Pyx_ExcInfoStruct gi_exc_state; +#if PY_VERSION_HEX < 0x030C0000 || CYTHON_COMPILING_IN_LIMITED_API + PyObject *gi_weakreflist; +#endif + PyObject *classobj; + PyObject *yieldfrom; + __Pyx_pyiter_sendfunc yieldfrom_am_send; + PyObject *gi_name; + PyObject *gi_qualname; + PyObject *gi_modulename; + PyObject *gi_code; + PyObject *gi_frame; +#if CYTHON_USE_SYS_MONITORING && (CYTHON_PROFILE || CYTHON_TRACE) + PyMonitoringState __pyx_pymonitoring_state[__Pyx_MonitoringEventTypes_CyGen_count]; + uint64_t __pyx_pymonitoring_version; +#endif + int resume_label; + char is_running; +} __pyx_CoroutineObject; +static __pyx_CoroutineObject *__Pyx__Coroutine_New( + PyTypeObject *type, __pyx_coroutine_body_t body, PyObject *code, PyObject *closure, + PyObject *name, PyObject *qualname, PyObject *module_name); +static __pyx_CoroutineObject *__Pyx__Coroutine_NewInit( + __pyx_CoroutineObject *gen, __pyx_coroutine_body_t body, PyObject *code, PyObject *closure, + PyObject *name, PyObject *qualname, PyObject *module_name); +static CYTHON_INLINE void __Pyx_Coroutine_ExceptionClear(__Pyx_ExcInfoStruct *self); +static int __Pyx_Coroutine_clear(PyObject *self); +static __Pyx_PySendResult __Pyx_Coroutine_AmSend(PyObject *self, PyObject *value, PyObject **retval); +static PyObject *__Pyx_Coroutine_Send(PyObject *self, PyObject *value); +static __Pyx_PySendResult __Pyx_Coroutine_Close(PyObject *self, PyObject **retval); +static PyObject *__Pyx_Coroutine_Throw(PyObject *gen, PyObject *args); +#if CYTHON_USE_EXC_INFO_STACK +#define __Pyx_Coroutine_SwapException(self) +#define __Pyx_Coroutine_ResetAndClearException(self) __Pyx_Coroutine_ExceptionClear(&(self)->gi_exc_state) +#else +#define __Pyx_Coroutine_SwapException(self) {\ + __Pyx_ExceptionSwap(&(self)->gi_exc_state.exc_type, &(self)->gi_exc_state.exc_value, &(self)->gi_exc_state.exc_traceback);\ + __Pyx_Coroutine_ResetFrameBackpointer(&(self)->gi_exc_state);\ + } +#define __Pyx_Coroutine_ResetAndClearException(self) {\ + __Pyx_ExceptionReset((self)->gi_exc_state.exc_type, (self)->gi_exc_state.exc_value, (self)->gi_exc_state.exc_traceback);\ + (self)->gi_exc_state.exc_type = (self)->gi_exc_state.exc_value = (self)->gi_exc_state.exc_traceback = NULL;\ + } +#endif +#if CYTHON_FAST_THREAD_STATE +#define __Pyx_PyGen_FetchStopIterationValue(pvalue)\ + __Pyx_PyGen__FetchStopIterationValue(__pyx_tstate, pvalue) +#else +#define __Pyx_PyGen_FetchStopIterationValue(pvalue)\ + __Pyx_PyGen__FetchStopIterationValue(__Pyx_PyThreadState_Current, pvalue) +#endif +static int __Pyx_PyGen__FetchStopIterationValue(PyThreadState *tstate, PyObject **pvalue); +static CYTHON_INLINE void __Pyx_Coroutine_ResetFrameBackpointer(__Pyx_ExcInfoStruct *exc_state); +static char __Pyx_Coroutine_test_and_set_is_running(__pyx_CoroutineObject *gen); +static void __Pyx_Coroutine_unset_is_running(__pyx_CoroutineObject *gen); +static char __Pyx_Coroutine_get_is_running(__pyx_CoroutineObject *gen); +static PyObject *__Pyx_Coroutine_get_is_running_getter(PyObject *gen, void *closure); +#if __PYX_HAS_PY_AM_SEND == 2 +static void __Pyx_SetBackportTypeAmSend(PyTypeObject *type, __Pyx_PyAsyncMethodsStruct *static_amsend_methods, __Pyx_pyiter_sendfunc am_send); +#endif +static PyObject *__Pyx_Coroutine_fail_reduce_ex(PyObject *self, PyObject *arg); + +/* Generator.proto */ +#define __Pyx_Generator_USED +#define __Pyx_Generator_CheckExact(obj) __Pyx_IS_TYPE(obj, __pyx_mstate_global->__pyx_GeneratorType) +#define __Pyx_Generator_New(body, code, closure, name, qualname, module_name)\ + __Pyx__Coroutine_New(__pyx_mstate_global->__pyx_GeneratorType, body, code, closure, name, qualname, module_name) +static PyObject *__Pyx_Generator_Next(PyObject *self); +static int __pyx_Generator_init(PyObject *module); +static CYTHON_INLINE PyObject *__Pyx_Generator_GetInlinedResult(PyObject *self); + +/* 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 "." + +static PyObject *__pyx_array_get_memview(struct __pyx_array_obj *__pyx_v_self); /* proto*/ +static char *__pyx_memoryview_get_item_pointer(struct __pyx_memoryview_obj *__pyx_v_self, PyObject *__pyx_v_index); /* proto*/ +static PyObject *__pyx_memoryview_is_slice(struct __pyx_memoryview_obj *__pyx_v_self, PyObject *__pyx_v_obj); /* proto*/ +static PyObject *__pyx_memoryview_setitem_slice_assignment(struct __pyx_memoryview_obj *__pyx_v_self, PyObject *__pyx_v_dst, PyObject *__pyx_v_src); /* proto*/ +static PyObject *__pyx_memoryview_setitem_slice_assign_scalar(struct __pyx_memoryview_obj *__pyx_v_self, struct __pyx_memoryview_obj *__pyx_v_dst, PyObject *__pyx_v_value); /* proto*/ +static PyObject *__pyx_memoryview_setitem_indexed(struct __pyx_memoryview_obj *__pyx_v_self, PyObject *__pyx_v_index, PyObject *__pyx_v_value); /* proto*/ +static PyObject *__pyx_memoryview_convert_item_to_object(struct __pyx_memoryview_obj *__pyx_v_self, char *__pyx_v_itemp); /* proto*/ +static PyObject *__pyx_memoryview_assign_item_from_object(struct __pyx_memoryview_obj *__pyx_v_self, char *__pyx_v_itemp, PyObject *__pyx_v_value); /* proto*/ +static PyObject *__pyx_memoryview__get_base(struct __pyx_memoryview_obj *__pyx_v_self); /* proto*/ +static PyObject *__pyx_memoryviewslice_convert_item_to_object(struct __pyx_memoryviewslice_obj *__pyx_v_self, char *__pyx_v_itemp); /* proto*/ +static PyObject *__pyx_memoryviewslice_assign_item_from_object(struct __pyx_memoryviewslice_obj *__pyx_v_self, char *__pyx_v_itemp, PyObject *__pyx_v_value); /* proto*/ +static PyObject *__pyx_memoryviewslice__get_base(struct __pyx_memoryviewslice_obj *__pyx_v_self); /* proto*/ +static CYTHON_INLINE npy_intp __pyx_f_5numpy_5dtype_8itemsize_itemsize(PyArray_Descr *__pyx_v_self); /* proto*/ +static CYTHON_INLINE npy_intp __pyx_f_5numpy_5dtype_9alignment_alignment(PyArray_Descr *__pyx_v_self); /* proto*/ +static CYTHON_INLINE PyObject *__pyx_f_5numpy_5dtype_6fields_fields(PyArray_Descr *__pyx_v_self); /* proto*/ +static CYTHON_INLINE PyObject *__pyx_f_5numpy_5dtype_5names_names(PyArray_Descr *__pyx_v_self); /* proto*/ +static CYTHON_INLINE PyArray_ArrayDescr *__pyx_f_5numpy_5dtype_8subarray_subarray(PyArray_Descr *__pyx_v_self); /* proto*/ +static CYTHON_INLINE npy_uint64 __pyx_f_5numpy_5dtype_5flags_flags(PyArray_Descr *__pyx_v_self); /* proto*/ +static CYTHON_INLINE int __pyx_f_5numpy_9broadcast_7numiter_numiter(PyArrayMultiIterObject *__pyx_v_self); /* proto*/ +static CYTHON_INLINE npy_intp __pyx_f_5numpy_9broadcast_4size_size(PyArrayMultiIterObject *__pyx_v_self); /* proto*/ +static CYTHON_INLINE npy_intp __pyx_f_5numpy_9broadcast_5index_index(PyArrayMultiIterObject *__pyx_v_self); /* proto*/ +static CYTHON_INLINE int __pyx_f_5numpy_9broadcast_2nd_nd(PyArrayMultiIterObject *__pyx_v_self); /* proto*/ +static CYTHON_INLINE npy_intp *__pyx_f_5numpy_9broadcast_10dimensions_dimensions(PyArrayMultiIterObject *__pyx_v_self); /* proto*/ +static CYTHON_INLINE void **__pyx_f_5numpy_9broadcast_5iters_iters(PyArrayMultiIterObject *__pyx_v_self); /* proto*/ +static CYTHON_INLINE PyObject *__pyx_f_5numpy_7ndarray_4base_base(PyArrayObject *__pyx_v_self); /* proto*/ +static CYTHON_INLINE PyArray_Descr *__pyx_f_5numpy_7ndarray_5descr_descr(PyArrayObject *__pyx_v_self); /* proto*/ +static CYTHON_INLINE int __pyx_f_5numpy_7ndarray_4ndim_ndim(PyArrayObject *__pyx_v_self); /* proto*/ +static CYTHON_INLINE npy_intp *__pyx_f_5numpy_7ndarray_5shape_shape(PyArrayObject *__pyx_v_self); /* proto*/ +static CYTHON_INLINE npy_intp *__pyx_f_5numpy_7ndarray_7strides_strides(PyArrayObject *__pyx_v_self); /* proto*/ +static CYTHON_INLINE npy_intp __pyx_f_5numpy_7ndarray_4size_size(PyArrayObject *__pyx_v_self); /* proto*/ +static CYTHON_INLINE char *__pyx_f_5numpy_7ndarray_4data_data(PyArrayObject *__pyx_v_self); /* proto*/ +static CYTHON_INLINE struct __pyx_obj_5spacy_6lexeme_Lexeme *__pyx_f_5spacy_6lexeme_6Lexeme_from_ptr(struct __pyx_t_5spacy_7structs_LexemeC *__pyx_v_lex, struct __pyx_obj_5spacy_5vocab_Vocab *__pyx_v_vocab); /* proto*/ +static CYTHON_INLINE void __pyx_f_5spacy_6lexeme_6Lexeme_set_struct_attr(struct __pyx_t_5spacy_7structs_LexemeC *__pyx_v_lex, enum __pyx_t_5spacy_5attrs_attr_id_t __pyx_v_name, __pyx_t_5spacy_8typedefs_attr_t __pyx_v_value); /* proto*/ +static CYTHON_INLINE __pyx_t_5spacy_8typedefs_attr_t __pyx_f_5spacy_6lexeme_6Lexeme_get_struct_attr(struct __pyx_t_5spacy_7structs_LexemeC const *__pyx_v_lex, enum __pyx_t_5spacy_5attrs_attr_id_t __pyx_v_feat_name); /* proto*/ +static CYTHON_INLINE int __pyx_f_5spacy_6lexeme_6Lexeme_c_check_flag(struct __pyx_t_5spacy_7structs_LexemeC const *__pyx_v_lexeme, enum __pyx_t_5spacy_5attrs_attr_id_t __pyx_v_flag_id); /* proto*/ +static CYTHON_INLINE int __pyx_f_5spacy_6lexeme_6Lexeme_c_set_flag(struct __pyx_t_5spacy_7structs_LexemeC *__pyx_v_lex, enum __pyx_t_5spacy_5attrs_attr_id_t __pyx_v_flag_id, int __pyx_v_value); /* proto*/ +static CYTHON_INLINE struct __pyx_obj_5spacy_8pipeline_17_parser_internals_10stateclass_StateClass *__pyx_f_5spacy_8pipeline_17_parser_internals_10stateclass_10StateClass_borrow(__pyx_t_5spacy_8pipeline_17_parser_internals_6_state_StateC *__pyx_v_ptr, struct __pyx_obj_5spacy_6tokens_3doc_Doc *__pyx_v_doc); /* proto*/ +static CYTHON_INLINE struct __pyx_obj_5spacy_8pipeline_17_parser_internals_10stateclass_StateClass *__pyx_f_5spacy_8pipeline_17_parser_internals_10stateclass_10StateClass_init_offset(struct __pyx_t_5spacy_7structs_TokenC const *__pyx_v_sent, int __pyx_v_length, int __pyx_v_offset); /* proto*/ +static CYTHON_INLINE struct __pyx_obj_5spacy_6tokens_5token_Token *__pyx_f_5spacy_6tokens_5token_5Token_cinit(struct __pyx_obj_5spacy_5vocab_Vocab *__pyx_v_vocab, CYTHON_UNUSED struct __pyx_t_5spacy_7structs_TokenC const *__pyx_v_token, int __pyx_v_offset, struct __pyx_obj_5spacy_6tokens_3doc_Doc *__pyx_v_doc); /* proto*/ +static CYTHON_INLINE __pyx_t_5spacy_8typedefs_attr_t __pyx_f_5spacy_6tokens_5token_5Token_get_struct_attr(struct __pyx_t_5spacy_7structs_TokenC const *__pyx_v_token, enum __pyx_t_5spacy_5attrs_attr_id_t __pyx_v_feat_name); /* proto*/ +static CYTHON_INLINE __pyx_t_5spacy_8typedefs_attr_t __pyx_f_5spacy_6tokens_5token_5Token_set_struct_attr(struct __pyx_t_5spacy_7structs_TokenC *__pyx_v_token, enum __pyx_t_5spacy_5attrs_attr_id_t __pyx_v_feat_name, __pyx_t_5spacy_8typedefs_attr_t __pyx_v_value); /* proto*/ +static CYTHON_INLINE int __pyx_f_5spacy_6tokens_5token_5Token_missing_dep(struct __pyx_t_5spacy_7structs_TokenC const *__pyx_v_token); /* proto*/ +static CYTHON_INLINE int __pyx_f_5spacy_6tokens_5token_5Token_missing_head(struct __pyx_t_5spacy_7structs_TokenC const *__pyx_v_token); /* proto*/ +static CYTHON_INLINE void *__pyx_f_5thinc_5extra_6search_4Beam_at(struct __pyx_obj_5thinc_5extra_6search_Beam *__pyx_v_self, int __pyx_v_i); /* proto*/ +static CYTHON_INLINE void __pyx_f_5thinc_5extra_6search_4Beam_set_cell(struct __pyx_obj_5thinc_5extra_6search_Beam *__pyx_v_self, int __pyx_v_i, int __pyx_v_j, __pyx_t_5thinc_5extra_6search_weight_t __pyx_v_score, int __pyx_v_is_valid, __pyx_t_5thinc_5extra_6search_weight_t __pyx_v_cost); /* proto*/ +static int __pyx_f_5spacy_8pipeline_17_parser_internals_9arc_eager_5Shift_is_valid(__pyx_t_5spacy_8pipeline_17_parser_internals_6_state_StateC const *__pyx_v_st, CYTHON_UNUSED __pyx_t_5spacy_8typedefs_attr_t __pyx_v_label); /* proto*/ +static int __pyx_f_5spacy_8pipeline_17_parser_internals_9arc_eager_5Shift_transition(__pyx_t_5spacy_8pipeline_17_parser_internals_6_state_StateC *__pyx_v_st, CYTHON_UNUSED __pyx_t_5spacy_8typedefs_attr_t __pyx_v_label); /* proto*/ +static __pyx_t_5spacy_8typedefs_weight_t __pyx_f_5spacy_8pipeline_17_parser_internals_9arc_eager_5Shift_cost(CYTHON_UNUSED __pyx_t_5spacy_8pipeline_17_parser_internals_6_state_StateC const *__pyx_v_state, void const *__pyx_v__gold, CYTHON_UNUSED __pyx_t_5spacy_8typedefs_attr_t __pyx_v_label); /* proto*/ +static int __pyx_f_5spacy_8pipeline_17_parser_internals_9arc_eager_6Reduce_is_valid(__pyx_t_5spacy_8pipeline_17_parser_internals_6_state_StateC const *__pyx_v_st, CYTHON_UNUSED __pyx_t_5spacy_8typedefs_attr_t __pyx_v_label); /* proto*/ +static int __pyx_f_5spacy_8pipeline_17_parser_internals_9arc_eager_6Reduce_transition(__pyx_t_5spacy_8pipeline_17_parser_internals_6_state_StateC *__pyx_v_st, CYTHON_UNUSED __pyx_t_5spacy_8typedefs_attr_t __pyx_v_label); /* proto*/ +static __pyx_t_5spacy_8typedefs_weight_t __pyx_f_5spacy_8pipeline_17_parser_internals_9arc_eager_6Reduce_cost(__pyx_t_5spacy_8pipeline_17_parser_internals_6_state_StateC const *__pyx_v_state, void const *__pyx_v__gold, CYTHON_UNUSED __pyx_t_5spacy_8typedefs_attr_t __pyx_v_label); /* proto*/ +static int __pyx_f_5spacy_8pipeline_17_parser_internals_9arc_eager_7LeftArc_is_valid(__pyx_t_5spacy_8pipeline_17_parser_internals_6_state_StateC const *__pyx_v_st, __pyx_t_5spacy_8typedefs_attr_t __pyx_v_label); /* proto*/ +static int __pyx_f_5spacy_8pipeline_17_parser_internals_9arc_eager_7LeftArc_transition(__pyx_t_5spacy_8pipeline_17_parser_internals_6_state_StateC *__pyx_v_st, __pyx_t_5spacy_8typedefs_attr_t __pyx_v_label); /* proto*/ +static CYTHON_INLINE __pyx_t_5spacy_8typedefs_weight_t __pyx_f_5spacy_8pipeline_17_parser_internals_9arc_eager_7LeftArc_cost(__pyx_t_5spacy_8pipeline_17_parser_internals_6_state_StateC const *__pyx_v_state, void const *__pyx_v__gold, __pyx_t_5spacy_8typedefs_attr_t __pyx_v_label); /* proto*/ +static int __pyx_f_5spacy_8pipeline_17_parser_internals_9arc_eager_8RightArc_is_valid(__pyx_t_5spacy_8pipeline_17_parser_internals_6_state_StateC const *__pyx_v_st, __pyx_t_5spacy_8typedefs_attr_t __pyx_v_label); /* proto*/ +static int __pyx_f_5spacy_8pipeline_17_parser_internals_9arc_eager_8RightArc_transition(__pyx_t_5spacy_8pipeline_17_parser_internals_6_state_StateC *__pyx_v_st, __pyx_t_5spacy_8typedefs_attr_t __pyx_v_label); /* proto*/ +static CYTHON_INLINE __pyx_t_5spacy_8typedefs_weight_t __pyx_f_5spacy_8pipeline_17_parser_internals_9arc_eager_8RightArc_cost(__pyx_t_5spacy_8pipeline_17_parser_internals_6_state_StateC const *__pyx_v_state, void const *__pyx_v__gold, __pyx_t_5spacy_8typedefs_attr_t __pyx_v_label); /* proto*/ +static int __pyx_f_5spacy_8pipeline_17_parser_internals_9arc_eager_5Break_is_valid(__pyx_t_5spacy_8pipeline_17_parser_internals_6_state_StateC const *__pyx_v_st, CYTHON_UNUSED __pyx_t_5spacy_8typedefs_attr_t __pyx_v_label); /* proto*/ +static int __pyx_f_5spacy_8pipeline_17_parser_internals_9arc_eager_5Break_transition(__pyx_t_5spacy_8pipeline_17_parser_internals_6_state_StateC *__pyx_v_st, CYTHON_UNUSED __pyx_t_5spacy_8typedefs_attr_t __pyx_v_label); /* proto*/ +static __pyx_t_5spacy_8typedefs_weight_t __pyx_f_5spacy_8pipeline_17_parser_internals_9arc_eager_5Break_cost(__pyx_t_5spacy_8pipeline_17_parser_internals_6_state_StateC const *__pyx_v_state, void const *__pyx_v__gold, CYTHON_UNUSED __pyx_t_5spacy_8typedefs_attr_t __pyx_v_label); /* proto*/ +static struct __pyx_t_5spacy_8pipeline_17_parser_internals_17transition_system_Transition __pyx_f_5spacy_8pipeline_17_parser_internals_9arc_eager_8ArcEager_lookup_transition(struct __pyx_obj_5spacy_8pipeline_17_parser_internals_9arc_eager_ArcEager *__pyx_v_self, PyObject *__pyx_v_name_or_id); /* proto*/ +static struct __pyx_t_5spacy_8pipeline_17_parser_internals_17transition_system_Transition __pyx_f_5spacy_8pipeline_17_parser_internals_9arc_eager_8ArcEager_init_transition(CYTHON_UNUSED struct __pyx_obj_5spacy_8pipeline_17_parser_internals_9arc_eager_ArcEager *__pyx_v_self, int __pyx_v_clas, int __pyx_v_move, __pyx_t_5spacy_8typedefs_attr_t __pyx_v_label); /* proto*/ +static PyObject *__pyx_f_5spacy_8pipeline_17_parser_internals_9arc_eager_8ArcEager_get_arcs(CYTHON_UNUSED struct __pyx_obj_5spacy_8pipeline_17_parser_internals_9arc_eager_ArcEager *__pyx_v_self, __pyx_t_5spacy_8pipeline_17_parser_internals_6_state_StateC *__pyx_v_state); /* proto*/ +static int __pyx_f_5spacy_8pipeline_17_parser_internals_9arc_eager_8ArcEager_set_valid(struct __pyx_obj_5spacy_8pipeline_17_parser_internals_9arc_eager_ArcEager *__pyx_v_self, int *__pyx_v_output, __pyx_t_5spacy_8pipeline_17_parser_internals_6_state_StateC const *__pyx_v_st); /* proto*/ +static int __pyx_f_5spacy_8pipeline_17_parser_internals_9arc_eager_8ArcEager_set_costs(struct __pyx_obj_5spacy_8pipeline_17_parser_internals_9arc_eager_ArcEager *__pyx_v_self, int *__pyx_v_is_valid, __pyx_t_5spacy_8typedefs_weight_t *__pyx_v_costs, __pyx_t_5spacy_8pipeline_17_parser_internals_6_state_StateC const *__pyx_v_state, PyObject *__pyx_v_gold); /* proto*/ + +/* Module declarations from "libc.stdint" */ + +/* Module declarations from "spacy.typedefs" */ + +/* Module declarations from "libcpp" */ + +/* Module declarations from "libc.string" */ + +/* Module declarations from "libc.stdio" */ + +/* Module declarations from "__builtin__" */ + +/* Module declarations from "cpython.type" */ + +/* Module declarations from "cpython" */ + +/* Module declarations from "cpython.object" */ + +/* Module declarations from "cpython.exc" */ + +/* Module declarations from "libc.stdlib" */ + +/* Module declarations from "libcpp.utility" */ + +/* Module declarations from "libcpp.set" */ + +/* Module declarations from "libcpp.unordered_map" */ + +/* Module declarations from "libcpp.vector" */ + +/* Module declarations from "murmurhash.mrmr" */ +static uint64_t (*__pyx_f_10murmurhash_4mrmr_hash64)(void *, int, uint64_t); /*proto*/ + +/* Module declarations from "spacy" */ + +/* Module declarations from "spacy.symbols" */ + +/* Module declarations from "spacy.attrs" */ + +/* Module declarations from "cpython.ref" */ + +/* Module declarations from "numpy" */ + +/* Module declarations from "numpy" */ + +/* Module declarations from "cymem.cymem" */ + +/* Module declarations from "preshed.maps" */ + +/* Module declarations from "spacy.strings" */ +static __pyx_t_5spacy_8typedefs_hash_t (*__pyx_f_5spacy_7strings_hash_string)(PyObject *, int __pyx_skip_dispatch); /*proto*/ + +/* Module declarations from "libcpp.unordered_set" */ + +/* Module declarations from "spacy.parts_of_speech" */ + +/* Module declarations from "spacy.structs" */ + +/* Module declarations from "spacy.morphology" */ + +/* Module declarations from "spacy.vocab" */ +static struct __pyx_t_5spacy_7structs_LexemeC *__pyx_vp_5spacy_5vocab_EMPTY_LEXEME = 0; +#define __pyx_v_5spacy_5vocab_EMPTY_LEXEME (*__pyx_vp_5spacy_5vocab_EMPTY_LEXEME) + +/* Module declarations from "spacy.lexeme" */ +static struct __pyx_t_5spacy_7structs_LexemeC *__pyx_vp_5spacy_6lexeme_EMPTY_LEXEME = 0; +#define __pyx_v_5spacy_6lexeme_EMPTY_LEXEME (*__pyx_vp_5spacy_6lexeme_EMPTY_LEXEME) +static __pyx_t_5spacy_8typedefs_attr_t *__pyx_vp_5spacy_6lexeme_OOV_RANK = 0; +#define __pyx_v_5spacy_6lexeme_OOV_RANK (*__pyx_vp_5spacy_6lexeme_OOV_RANK) + +/* Module declarations from "spacy.pipeline._parser_internals._state" */ + +/* Module declarations from "spacy.tokens.doc" */ +static int (*__pyx_f_5spacy_6tokens_3doc_set_children_from_heads)(struct __pyx_t_5spacy_7structs_TokenC *, int, int); /*proto*/ + +/* Module declarations from "spacy.training.example" */ + +/* Module declarations from "spacy.pipeline._parser_internals.stateclass" */ + +/* Module declarations from "spacy.pipeline._parser_internals.transition_system" */ + +/* Module declarations from "spacy.tokens.token" */ +static int const *__pyx_vp_5spacy_6tokens_5token_MISSING_DEP = 0; +#define __pyx_v_5spacy_6tokens_5token_MISSING_DEP (*__pyx_vp_5spacy_6tokens_5token_MISSING_DEP) + +/* Module declarations from "libcpp.pair" */ + +/* Module declarations from "libcpp.queue" */ + +/* Module declarations from "thinc.extra.search" */ + +/* Module declarations from "spacy.pipeline._parser_internals.arc_eager" */ +static __pyx_t_5spacy_8typedefs_weight_t __pyx_v_5spacy_8pipeline_17_parser_internals_9arc_eager_MIN_SCORE; +static __pyx_t_5spacy_8typedefs_attr_t __pyx_v_5spacy_8pipeline_17_parser_internals_9arc_eager_SUBTOK_LABEL; +static PyObject *__pyx_collections_abc_Sequence = 0; +static PyObject *generic = 0; +static PyObject *strided = 0; +static PyObject *indirect = 0; +static PyObject *contiguous = 0; +static PyObject *indirect_contiguous = 0; +static int __pyx_memoryview_thread_locks_used; +static PyThread_type_lock __pyx_memoryview_thread_locks[8]; +static struct __pyx_t_5spacy_8pipeline_17_parser_internals_9arc_eager_GoldParseStateC __pyx_f_5spacy_8pipeline_17_parser_internals_9arc_eager_create_gold_state(struct __pyx_obj_5cymem_5cymem_Pool *, __pyx_t_5spacy_8pipeline_17_parser_internals_6_state_StateC const *, PyObject *, PyObject *, PyObject *); /*proto*/ +static void __pyx_f_5spacy_8pipeline_17_parser_internals_9arc_eager_update_gold_state(struct __pyx_t_5spacy_8pipeline_17_parser_internals_9arc_eager_GoldParseStateC *, __pyx_t_5spacy_8pipeline_17_parser_internals_6_state_StateC const *); /*proto*/ +static int __pyx_f_5spacy_8pipeline_17_parser_internals_9arc_eager_check_state_gold(char, char); /*proto*/ +static int __pyx_f_5spacy_8pipeline_17_parser_internals_9arc_eager_set_state_flag(char, char, int); /*proto*/ +static int __pyx_f_5spacy_8pipeline_17_parser_internals_9arc_eager_is_head_in_stack(struct __pyx_t_5spacy_8pipeline_17_parser_internals_9arc_eager_GoldParseStateC const *, int); /*proto*/ +static int __pyx_f_5spacy_8pipeline_17_parser_internals_9arc_eager_is_head_in_buffer(struct __pyx_t_5spacy_8pipeline_17_parser_internals_9arc_eager_GoldParseStateC const *, int); /*proto*/ +static int __pyx_f_5spacy_8pipeline_17_parser_internals_9arc_eager_is_head_unknown(struct __pyx_t_5spacy_8pipeline_17_parser_internals_9arc_eager_GoldParseStateC const *, int); /*proto*/ +static int __pyx_f_5spacy_8pipeline_17_parser_internals_9arc_eager_is_sent_start(struct __pyx_t_5spacy_8pipeline_17_parser_internals_9arc_eager_GoldParseStateC const *, int); /*proto*/ +static int __pyx_f_5spacy_8pipeline_17_parser_internals_9arc_eager_is_sent_start_unknown(struct __pyx_t_5spacy_8pipeline_17_parser_internals_9arc_eager_GoldParseStateC const *, int); /*proto*/ +static __pyx_t_5spacy_8typedefs_weight_t __pyx_f_5spacy_8pipeline_17_parser_internals_9arc_eager_push_cost(__pyx_t_5spacy_8pipeline_17_parser_internals_6_state_StateC const *, struct __pyx_t_5spacy_8pipeline_17_parser_internals_9arc_eager_GoldParseStateC const *); /*proto*/ +static __pyx_t_5spacy_8typedefs_weight_t __pyx_f_5spacy_8pipeline_17_parser_internals_9arc_eager_pop_cost(__pyx_t_5spacy_8pipeline_17_parser_internals_6_state_StateC const *, struct __pyx_t_5spacy_8pipeline_17_parser_internals_9arc_eager_GoldParseStateC const *); /*proto*/ +static int __pyx_f_5spacy_8pipeline_17_parser_internals_9arc_eager_arc_is_gold(struct __pyx_t_5spacy_8pipeline_17_parser_internals_9arc_eager_GoldParseStateC const *, int, int); /*proto*/ +static int __pyx_f_5spacy_8pipeline_17_parser_internals_9arc_eager_label_is_gold(struct __pyx_t_5spacy_8pipeline_17_parser_internals_9arc_eager_GoldParseStateC const *, int, __pyx_t_5spacy_8typedefs_attr_t); /*proto*/ +static void *__pyx_f_5spacy_8pipeline_17_parser_internals_9arc_eager__init_state(struct __pyx_obj_5cymem_5cymem_Pool *, int, void *); /*proto*/ +static int __pyx_f_5spacy_8pipeline_17_parser_internals_9arc_eager__del_state(struct __pyx_obj_5cymem_5cymem_Pool *, void *, void *); /*proto*/ +static PyObject *__pyx_f_5spacy_8pipeline_17_parser_internals_9arc_eager___pyx_unpickle_Shift__set_state(struct __pyx_obj_5spacy_8pipeline_17_parser_internals_9arc_eager_Shift *, PyObject *); /*proto*/ +static PyObject *__pyx_f_5spacy_8pipeline_17_parser_internals_9arc_eager___pyx_unpickle_Reduce__set_state(struct __pyx_obj_5spacy_8pipeline_17_parser_internals_9arc_eager_Reduce *, PyObject *); /*proto*/ +static PyObject *__pyx_f_5spacy_8pipeline_17_parser_internals_9arc_eager___pyx_unpickle_LeftArc__set_state(struct __pyx_obj_5spacy_8pipeline_17_parser_internals_9arc_eager_LeftArc *, PyObject *); /*proto*/ +static PyObject *__pyx_f_5spacy_8pipeline_17_parser_internals_9arc_eager___pyx_unpickle_RightArc__set_state(struct __pyx_obj_5spacy_8pipeline_17_parser_internals_9arc_eager_RightArc *, PyObject *); /*proto*/ +static PyObject *__pyx_f_5spacy_8pipeline_17_parser_internals_9arc_eager___pyx_unpickle_Break__set_state(struct __pyx_obj_5spacy_8pipeline_17_parser_internals_9arc_eager_Break *, PyObject *); /*proto*/ +static PyObject *__pyx_convert_vector_to_py_struct____pyx_t_5spacy_8pipeline_17_parser_internals_6_state_ArcC(std::vector const &); /*proto*/ +static int __pyx_array_allocate_buffer(struct __pyx_array_obj *); /*proto*/ +static struct __pyx_array_obj *__pyx_array_new(PyObject *, Py_ssize_t, char *, char const *, char *); /*proto*/ +static PyObject *__pyx_memoryview_new(PyObject *, int, int, __Pyx_TypeInfo const *); /*proto*/ +static CYTHON_INLINE int __pyx_memoryview_check(PyObject *); /*proto*/ +static PyObject *_unellipsify(PyObject *, int); /*proto*/ +static int assert_direct_dimensions(Py_ssize_t *, int); /*proto*/ +static struct __pyx_memoryview_obj *__pyx_memview_slice(struct __pyx_memoryview_obj *, PyObject *); /*proto*/ +static int __pyx_memoryview_slice_memviewslice(__Pyx_memviewslice *, Py_ssize_t, Py_ssize_t, Py_ssize_t, int, int, int *, Py_ssize_t, Py_ssize_t, Py_ssize_t, int, int, int, int); /*proto*/ +static char *__pyx_pybuffer_index(Py_buffer *, char *, Py_ssize_t, Py_ssize_t); /*proto*/ +static int __pyx_memslice_transpose(__Pyx_memviewslice *); /*proto*/ +static PyObject *__pyx_memoryview_fromslice(__Pyx_memviewslice, int, PyObject *(*)(char *), int (*)(char *, PyObject *), int); /*proto*/ +static __Pyx_memviewslice *__pyx_memoryview_get_slice_from_memoryview(struct __pyx_memoryview_obj *, __Pyx_memviewslice *); /*proto*/ +static void __pyx_memoryview_slice_copy(struct __pyx_memoryview_obj *, __Pyx_memviewslice *); /*proto*/ +static PyObject *__pyx_memoryview_copy_object(struct __pyx_memoryview_obj *); /*proto*/ +static PyObject *__pyx_memoryview_copy_object_from_slice(struct __pyx_memoryview_obj *, __Pyx_memviewslice *); /*proto*/ +static Py_ssize_t abs_py_ssize_t(Py_ssize_t); /*proto*/ +static char __pyx_get_best_slice_order(__Pyx_memviewslice *, int); /*proto*/ +static void _copy_strided_to_strided(char *, Py_ssize_t *, char *, Py_ssize_t *, Py_ssize_t *, Py_ssize_t *, int, size_t); /*proto*/ +static void copy_strided_to_strided(__Pyx_memviewslice *, __Pyx_memviewslice *, int, size_t); /*proto*/ +static Py_ssize_t __pyx_memoryview_slice_get_size(__Pyx_memviewslice *, int); /*proto*/ +static Py_ssize_t __pyx_fill_contig_strides_array(Py_ssize_t *, Py_ssize_t *, Py_ssize_t, int, char); /*proto*/ +static void *__pyx_memoryview_copy_data_to_temp(__Pyx_memviewslice *, __Pyx_memviewslice *, char, int); /*proto*/ +static int __pyx_memoryview_err_extents(int, Py_ssize_t, Py_ssize_t); /*proto*/ +static int __pyx_memoryview_err_dim(PyObject *, PyObject *, int); /*proto*/ +static int __pyx_memoryview_err(PyObject *, PyObject *); /*proto*/ +static int __pyx_memoryview_err_no_memory(void); /*proto*/ +static int __pyx_memoryview_copy_contents(__Pyx_memviewslice, __Pyx_memviewslice, int, int, int); /*proto*/ +static void __pyx_memoryview_broadcast_leading(__Pyx_memviewslice *, int, int); /*proto*/ +static void __pyx_memoryview_refcount_copying(__Pyx_memviewslice *, int, int, int); /*proto*/ +static void __pyx_memoryview_refcount_objects_in_slice_with_gil(char *, Py_ssize_t *, Py_ssize_t *, int, int); /*proto*/ +static void __pyx_memoryview_refcount_objects_in_slice(char *, Py_ssize_t *, Py_ssize_t *, int, int); /*proto*/ +static void __pyx_memoryview_slice_assign_scalar(__Pyx_memviewslice *, int, size_t, void *, int); /*proto*/ +static void __pyx_memoryview__slice_assign_scalar(char *, Py_ssize_t *, Py_ssize_t *, int, size_t, void *); /*proto*/ +static PyObject *__pyx_unpickle_Enum__set_state(struct __pyx_MemviewEnum_obj *, PyObject *); /*proto*/ +/* #### Code section: typeinfo ### */ +/* #### Code section: before_global_var ### */ +#define __Pyx_MODULE_NAME "spacy.pipeline._parser_internals.arc_eager" +extern int __pyx_module_is_main_spacy__pipeline___parser_internals__arc_eager; +int __pyx_module_is_main_spacy__pipeline___parser_internals__arc_eager = 0; + +/* Implementation of "spacy.pipeline._parser_internals.arc_eager" */ +/* #### Code section: global_var ### */ +static PyObject *__pyx_builtin_enumerate; +static PyObject *__pyx_builtin_zip; +static PyObject *__pyx_builtin_sum; +static PyObject *__pyx_builtin_min; +static PyObject *__pyx_builtin___import__; +static PyObject *__pyx_builtin_Ellipsis; +static PyObject *__pyx_builtin_id; +/* #### Code section: string_decls ### */ +/* #### Code section: decls ### */ +static int __pyx_array___pyx_pf_15View_dot_MemoryView_5array___cinit__(struct __pyx_array_obj *__pyx_v_self, PyObject *__pyx_v_shape, Py_ssize_t __pyx_v_itemsize, PyObject *__pyx_v_format, PyObject *__pyx_v_mode, int __pyx_v_allocate_buffer); /* proto */ +static int __pyx_array___pyx_pf_15View_dot_MemoryView_5array_2__getbuffer__(struct __pyx_array_obj *__pyx_v_self, Py_buffer *__pyx_v_info, int __pyx_v_flags); /* proto */ +static void __pyx_array___pyx_pf_15View_dot_MemoryView_5array_4__dealloc__(struct __pyx_array_obj *__pyx_v_self); /* proto */ +static PyObject *__pyx_pf_15View_dot_MemoryView_5array_7memview___get__(struct __pyx_array_obj *__pyx_v_self); /* proto */ +static Py_ssize_t __pyx_array___pyx_pf_15View_dot_MemoryView_5array_6__len__(struct __pyx_array_obj *__pyx_v_self); /* proto */ +static PyObject *__pyx_array___pyx_pf_15View_dot_MemoryView_5array_8__getattr__(struct __pyx_array_obj *__pyx_v_self, PyObject *__pyx_v_attr); /* proto */ +static PyObject *__pyx_array___pyx_pf_15View_dot_MemoryView_5array_10__getitem__(struct __pyx_array_obj *__pyx_v_self, PyObject *__pyx_v_item); /* proto */ +static int __pyx_array___pyx_pf_15View_dot_MemoryView_5array_12__setitem__(struct __pyx_array_obj *__pyx_v_self, PyObject *__pyx_v_item, PyObject *__pyx_v_value); /* proto */ +static PyObject *__pyx_pf___pyx_array___reduce_cython__(CYTHON_UNUSED struct __pyx_array_obj *__pyx_v_self); /* proto */ +static PyObject *__pyx_pf___pyx_array_2__setstate_cython__(CYTHON_UNUSED struct __pyx_array_obj *__pyx_v_self, CYTHON_UNUSED PyObject *__pyx_v___pyx_state); /* proto */ +static int __pyx_MemviewEnum___pyx_pf_15View_dot_MemoryView_4Enum___init__(struct __pyx_MemviewEnum_obj *__pyx_v_self, PyObject *__pyx_v_name); /* proto */ +static PyObject *__pyx_MemviewEnum___pyx_pf_15View_dot_MemoryView_4Enum_2__repr__(struct __pyx_MemviewEnum_obj *__pyx_v_self); /* proto */ +static PyObject *__pyx_pf___pyx_MemviewEnum___reduce_cython__(struct __pyx_MemviewEnum_obj *__pyx_v_self); /* proto */ +static PyObject *__pyx_pf___pyx_MemviewEnum_2__setstate_cython__(struct __pyx_MemviewEnum_obj *__pyx_v_self, PyObject *__pyx_v___pyx_state); /* proto */ +static int __pyx_memoryview___pyx_pf_15View_dot_MemoryView_10memoryview___cinit__(struct __pyx_memoryview_obj *__pyx_v_self, PyObject *__pyx_v_obj, int __pyx_v_flags, int __pyx_v_dtype_is_object); /* proto */ +static void __pyx_memoryview___pyx_pf_15View_dot_MemoryView_10memoryview_2__dealloc__(struct __pyx_memoryview_obj *__pyx_v_self); /* proto */ +static PyObject *__pyx_memoryview___pyx_pf_15View_dot_MemoryView_10memoryview_4__getitem__(struct __pyx_memoryview_obj *__pyx_v_self, PyObject *__pyx_v_index); /* proto */ +static int __pyx_memoryview___pyx_pf_15View_dot_MemoryView_10memoryview_6__setitem__(struct __pyx_memoryview_obj *__pyx_v_self, PyObject *__pyx_v_index, PyObject *__pyx_v_value); /* proto */ +static int __pyx_memoryview___pyx_pf_15View_dot_MemoryView_10memoryview_8__getbuffer__(struct __pyx_memoryview_obj *__pyx_v_self, Py_buffer *__pyx_v_info, int __pyx_v_flags); /* proto */ +static PyObject *__pyx_pf_15View_dot_MemoryView_10memoryview_1T___get__(struct __pyx_memoryview_obj *__pyx_v_self); /* proto */ +static PyObject *__pyx_pf_15View_dot_MemoryView_10memoryview_4base___get__(struct __pyx_memoryview_obj *__pyx_v_self); /* proto */ +static PyObject *__pyx_pf_15View_dot_MemoryView_10memoryview_5shape___get__(struct __pyx_memoryview_obj *__pyx_v_self); /* proto */ +static PyObject *__pyx_pf_15View_dot_MemoryView_10memoryview_7strides___get__(struct __pyx_memoryview_obj *__pyx_v_self); /* proto */ +static PyObject *__pyx_pf_15View_dot_MemoryView_10memoryview_10suboffsets___get__(struct __pyx_memoryview_obj *__pyx_v_self); /* proto */ +static PyObject *__pyx_pf_15View_dot_MemoryView_10memoryview_4ndim___get__(struct __pyx_memoryview_obj *__pyx_v_self); /* proto */ +static PyObject *__pyx_pf_15View_dot_MemoryView_10memoryview_8itemsize___get__(struct __pyx_memoryview_obj *__pyx_v_self); /* proto */ +static PyObject *__pyx_pf_15View_dot_MemoryView_10memoryview_6nbytes___get__(struct __pyx_memoryview_obj *__pyx_v_self); /* proto */ +static PyObject *__pyx_pf_15View_dot_MemoryView_10memoryview_4size___get__(struct __pyx_memoryview_obj *__pyx_v_self); /* proto */ +static Py_ssize_t __pyx_memoryview___pyx_pf_15View_dot_MemoryView_10memoryview_10__len__(struct __pyx_memoryview_obj *__pyx_v_self); /* proto */ +static PyObject *__pyx_memoryview___pyx_pf_15View_dot_MemoryView_10memoryview_12__repr__(struct __pyx_memoryview_obj *__pyx_v_self); /* proto */ +static PyObject *__pyx_memoryview___pyx_pf_15View_dot_MemoryView_10memoryview_14__str__(struct __pyx_memoryview_obj *__pyx_v_self); /* proto */ +static PyObject *__pyx_memoryview___pyx_pf_15View_dot_MemoryView_10memoryview_16is_c_contig(struct __pyx_memoryview_obj *__pyx_v_self); /* proto */ +static PyObject *__pyx_memoryview___pyx_pf_15View_dot_MemoryView_10memoryview_18is_f_contig(struct __pyx_memoryview_obj *__pyx_v_self); /* proto */ +static PyObject *__pyx_memoryview___pyx_pf_15View_dot_MemoryView_10memoryview_20copy(struct __pyx_memoryview_obj *__pyx_v_self); /* proto */ +static PyObject *__pyx_memoryview___pyx_pf_15View_dot_MemoryView_10memoryview_22copy_fortran(struct __pyx_memoryview_obj *__pyx_v_self); /* proto */ +static PyObject *__pyx_pf___pyx_memoryview___reduce_cython__(CYTHON_UNUSED struct __pyx_memoryview_obj *__pyx_v_self); /* proto */ +static PyObject *__pyx_pf___pyx_memoryview_2__setstate_cython__(CYTHON_UNUSED struct __pyx_memoryview_obj *__pyx_v_self, CYTHON_UNUSED PyObject *__pyx_v___pyx_state); /* proto */ +static void __pyx_memoryviewslice___pyx_pf_15View_dot_MemoryView_16_memoryviewslice___dealloc__(struct __pyx_memoryviewslice_obj *__pyx_v_self); /* proto */ +static PyObject *__pyx_pf___pyx_memoryviewslice___reduce_cython__(CYTHON_UNUSED struct __pyx_memoryviewslice_obj *__pyx_v_self); /* proto */ +static PyObject *__pyx_pf___pyx_memoryviewslice_2__setstate_cython__(CYTHON_UNUSED struct __pyx_memoryviewslice_obj *__pyx_v_self, CYTHON_UNUSED PyObject *__pyx_v___pyx_state); /* proto */ +static PyObject *__pyx_pf_15View_dot_MemoryView___pyx_unpickle_Enum(CYTHON_UNUSED PyObject *__pyx_self, PyObject *__pyx_v___pyx_type, long __pyx_v___pyx_checksum, PyObject *__pyx_v___pyx_state); /* proto */ +static int __pyx_pf_5spacy_8pipeline_17_parser_internals_9arc_eager_12ArcEagerGold___init__(struct __pyx_obj_5spacy_8pipeline_17_parser_internals_9arc_eager_ArcEagerGold *__pyx_v_self, CYTHON_UNUSED struct __pyx_obj_5spacy_8pipeline_17_parser_internals_9arc_eager_ArcEager *__pyx_v_moves, struct __pyx_obj_5spacy_8pipeline_17_parser_internals_10stateclass_StateClass *__pyx_v_stcls, struct __pyx_obj_5spacy_8training_7example_Example *__pyx_v_example); /* proto */ +static PyObject *__pyx_pf_5spacy_8pipeline_17_parser_internals_9arc_eager_12ArcEagerGold_2update(struct __pyx_obj_5spacy_8pipeline_17_parser_internals_9arc_eager_ArcEagerGold *__pyx_v_self, struct __pyx_obj_5spacy_8pipeline_17_parser_internals_10stateclass_StateClass *__pyx_v_stcls); /* proto */ +static PyObject *__pyx_pf_5spacy_8pipeline_17_parser_internals_9arc_eager_12ArcEagerGold_4__reduce_cython__(CYTHON_UNUSED struct __pyx_obj_5spacy_8pipeline_17_parser_internals_9arc_eager_ArcEagerGold *__pyx_v_self); /* proto */ +static PyObject *__pyx_pf_5spacy_8pipeline_17_parser_internals_9arc_eager_12ArcEagerGold_6__setstate_cython__(CYTHON_UNUSED struct __pyx_obj_5spacy_8pipeline_17_parser_internals_9arc_eager_ArcEagerGold *__pyx_v_self, CYTHON_UNUSED PyObject *__pyx_v___pyx_state); /* proto */ +static PyObject *__pyx_pf_5spacy_8pipeline_17_parser_internals_9arc_eager_24_get_aligned_sent_starts_genexpr(PyObject *__pyx_self, PyObject *__pyx_genexpr_arg_0); /* proto */ +static PyObject *__pyx_pf_5spacy_8pipeline_17_parser_internals_9arc_eager__get_aligned_sent_starts(CYTHON_UNUSED PyObject *__pyx_self, PyObject *__pyx_v_example); /* proto */ +static PyObject *__pyx_pf_5spacy_8pipeline_17_parser_internals_9arc_eager_5Shift___reduce_cython__(struct __pyx_obj_5spacy_8pipeline_17_parser_internals_9arc_eager_Shift *__pyx_v_self); /* proto */ +static PyObject *__pyx_pf_5spacy_8pipeline_17_parser_internals_9arc_eager_5Shift_2__setstate_cython__(struct __pyx_obj_5spacy_8pipeline_17_parser_internals_9arc_eager_Shift *__pyx_v_self, PyObject *__pyx_v___pyx_state); /* proto */ +static PyObject *__pyx_pf_5spacy_8pipeline_17_parser_internals_9arc_eager_6Reduce___reduce_cython__(struct __pyx_obj_5spacy_8pipeline_17_parser_internals_9arc_eager_Reduce *__pyx_v_self); /* proto */ +static PyObject *__pyx_pf_5spacy_8pipeline_17_parser_internals_9arc_eager_6Reduce_2__setstate_cython__(struct __pyx_obj_5spacy_8pipeline_17_parser_internals_9arc_eager_Reduce *__pyx_v_self, PyObject *__pyx_v___pyx_state); /* proto */ +static PyObject *__pyx_pf_5spacy_8pipeline_17_parser_internals_9arc_eager_7LeftArc___reduce_cython__(struct __pyx_obj_5spacy_8pipeline_17_parser_internals_9arc_eager_LeftArc *__pyx_v_self); /* proto */ +static PyObject *__pyx_pf_5spacy_8pipeline_17_parser_internals_9arc_eager_7LeftArc_2__setstate_cython__(struct __pyx_obj_5spacy_8pipeline_17_parser_internals_9arc_eager_LeftArc *__pyx_v_self, PyObject *__pyx_v___pyx_state); /* proto */ +static PyObject *__pyx_pf_5spacy_8pipeline_17_parser_internals_9arc_eager_8RightArc___reduce_cython__(struct __pyx_obj_5spacy_8pipeline_17_parser_internals_9arc_eager_RightArc *__pyx_v_self); /* proto */ +static PyObject *__pyx_pf_5spacy_8pipeline_17_parser_internals_9arc_eager_8RightArc_2__setstate_cython__(struct __pyx_obj_5spacy_8pipeline_17_parser_internals_9arc_eager_RightArc *__pyx_v_self, PyObject *__pyx_v___pyx_state); /* proto */ +static PyObject *__pyx_pf_5spacy_8pipeline_17_parser_internals_9arc_eager_5Break___reduce_cython__(struct __pyx_obj_5spacy_8pipeline_17_parser_internals_9arc_eager_Break *__pyx_v_self); /* proto */ +static PyObject *__pyx_pf_5spacy_8pipeline_17_parser_internals_9arc_eager_5Break_2__setstate_cython__(struct __pyx_obj_5spacy_8pipeline_17_parser_internals_9arc_eager_Break *__pyx_v_self, PyObject *__pyx_v___pyx_state); /* proto */ +static int __pyx_pf_5spacy_8pipeline_17_parser_internals_9arc_eager_8ArcEager___init__(struct __pyx_obj_5spacy_8pipeline_17_parser_internals_9arc_eager_ArcEager *__pyx_v_self, PyObject *__pyx_v_args, PyObject *__pyx_v_kwargs); /* proto */ +static PyObject *__pyx_lambda_funcdef_lambda1(CYTHON_UNUSED PyObject *__pyx_self); /* proto */ +static PyObject *__pyx_pf_5spacy_8pipeline_17_parser_internals_9arc_eager_8ArcEager_2get_actions(CYTHON_UNUSED PyTypeObject *__pyx_v_cls, PyObject *__pyx_v_kwargs); /* proto */ +static PyObject *__pyx_pf_5spacy_8pipeline_17_parser_internals_9arc_eager_8ArcEager_14builtin_labels___get__(CYTHON_UNUSED struct __pyx_obj_5spacy_8pipeline_17_parser_internals_9arc_eager_ArcEager *__pyx_v_self); /* proto */ +static PyObject *__pyx_pf_5spacy_8pipeline_17_parser_internals_9arc_eager_8ArcEager_12action_types___get__(CYTHON_UNUSED struct __pyx_obj_5spacy_8pipeline_17_parser_internals_9arc_eager_ArcEager *__pyx_v_self); /* proto */ +static PyObject *__pyx_pf_5spacy_8pipeline_17_parser_internals_9arc_eager_8ArcEager_4get_doc_labels(struct __pyx_obj_5spacy_8pipeline_17_parser_internals_9arc_eager_ArcEager *__pyx_v_self, PyObject *__pyx_v_doc); /* proto */ +static PyObject *__pyx_pf_5spacy_8pipeline_17_parser_internals_9arc_eager_8ArcEager_6transition(struct __pyx_obj_5spacy_8pipeline_17_parser_internals_9arc_eager_ArcEager *__pyx_v_self, struct __pyx_obj_5spacy_8pipeline_17_parser_internals_10stateclass_StateClass *__pyx_v_state, PyObject *__pyx_v_action); /* proto */ +static PyObject *__pyx_pf_5spacy_8pipeline_17_parser_internals_9arc_eager_8ArcEager_8is_gold_parse(CYTHON_UNUSED struct __pyx_obj_5spacy_8pipeline_17_parser_internals_9arc_eager_ArcEager *__pyx_v_self, struct __pyx_obj_5spacy_8pipeline_17_parser_internals_10stateclass_StateClass *__pyx_v_state, struct __pyx_obj_5spacy_8pipeline_17_parser_internals_9arc_eager_ArcEagerGold *__pyx_v_gold); /* proto */ +static PyObject *__pyx_pf_5spacy_8pipeline_17_parser_internals_9arc_eager_8ArcEager_10init_gold(struct __pyx_obj_5spacy_8pipeline_17_parser_internals_9arc_eager_ArcEager *__pyx_v_self, struct __pyx_obj_5spacy_8pipeline_17_parser_internals_10stateclass_StateClass *__pyx_v_state, struct __pyx_obj_5spacy_8training_7example_Example *__pyx_v_example); /* proto */ +static PyObject *__pyx_pf_5spacy_8pipeline_17_parser_internals_9arc_eager_8ArcEager_12init_gold_batch(struct __pyx_obj_5spacy_8pipeline_17_parser_internals_9arc_eager_ArcEager *__pyx_v_self, PyObject *__pyx_v_examples); /* proto */ +static PyObject *__pyx_pf_5spacy_8pipeline_17_parser_internals_9arc_eager_8ArcEager_14_replace_unseen_labels(struct __pyx_obj_5spacy_8pipeline_17_parser_internals_9arc_eager_ArcEager *__pyx_v_self, struct __pyx_obj_5spacy_8pipeline_17_parser_internals_9arc_eager_ArcEagerGold *__pyx_v_gold); /* proto */ +static PyObject *__pyx_pf_5spacy_8pipeline_17_parser_internals_9arc_eager_8ArcEager_16move_name(struct __pyx_obj_5spacy_8pipeline_17_parser_internals_9arc_eager_ArcEager *__pyx_v_self, int __pyx_v_move, __pyx_t_5spacy_8typedefs_attr_t __pyx_v_label); /* proto */ +static PyObject *__pyx_pf_5spacy_8pipeline_17_parser_internals_9arc_eager_8ArcEager_18class_name(struct __pyx_obj_5spacy_8pipeline_17_parser_internals_9arc_eager_ArcEager *__pyx_v_self, int __pyx_v_i); /* proto */ +static PyObject *__pyx_pf_5spacy_8pipeline_17_parser_internals_9arc_eager_8ArcEager_20set_annotations(struct __pyx_obj_5spacy_8pipeline_17_parser_internals_9arc_eager_ArcEager *__pyx_v_self, struct __pyx_obj_5spacy_8pipeline_17_parser_internals_10stateclass_StateClass *__pyx_v_state, struct __pyx_obj_5spacy_6tokens_3doc_Doc *__pyx_v_doc); /* proto */ +static PyObject *__pyx_pf_5spacy_8pipeline_17_parser_internals_9arc_eager_8ArcEager_22get_beam_parses(struct __pyx_obj_5spacy_8pipeline_17_parser_internals_9arc_eager_ArcEager *__pyx_v_self, struct __pyx_obj_5thinc_5extra_6search_Beam *__pyx_v_beam); /* proto */ +static PyObject *__pyx_pf_5spacy_8pipeline_17_parser_internals_9arc_eager_8ArcEager_24has_gold(CYTHON_UNUSED struct __pyx_obj_5spacy_8pipeline_17_parser_internals_9arc_eager_ArcEager *__pyx_v_self, struct __pyx_obj_5spacy_8training_7example_Example *__pyx_v_eg, PyObject *__pyx_v_start, PyObject *__pyx_v_end); /* proto */ +static PyObject *__pyx_pf_5spacy_8pipeline_17_parser_internals_9arc_eager_8ArcEager_26get_cost(struct __pyx_obj_5spacy_8pipeline_17_parser_internals_9arc_eager_ArcEager *__pyx_v_self, struct __pyx_obj_5spacy_8pipeline_17_parser_internals_10stateclass_StateClass *__pyx_v_stcls, PyObject *__pyx_v_gold, int __pyx_v_i); /* proto */ +static PyObject *__pyx_pf_5spacy_8pipeline_17_parser_internals_9arc_eager_8ArcEager_30get_oracle_sequence_from_state_genexpr(PyObject *__pyx_self, int __pyx_genexpr_arg_0); /* proto */ +static PyObject *__pyx_pf_5spacy_8pipeline_17_parser_internals_9arc_eager_8ArcEager_28get_oracle_sequence_from_state(struct __pyx_obj_5spacy_8pipeline_17_parser_internals_9arc_eager_ArcEager *__pyx_v_self, struct __pyx_obj_5spacy_8pipeline_17_parser_internals_10stateclass_StateClass *__pyx_v_state, struct __pyx_obj_5spacy_8pipeline_17_parser_internals_9arc_eager_ArcEagerGold *__pyx_v_gold, PyObject *__pyx_v__debug); /* proto */ +static PyObject *__pyx_pf_5spacy_8pipeline_17_parser_internals_9arc_eager_8ArcEager_30__reduce_cython__(CYTHON_UNUSED struct __pyx_obj_5spacy_8pipeline_17_parser_internals_9arc_eager_ArcEager *__pyx_v_self); /* proto */ +static PyObject *__pyx_pf_5spacy_8pipeline_17_parser_internals_9arc_eager_8ArcEager_32__setstate_cython__(CYTHON_UNUSED struct __pyx_obj_5spacy_8pipeline_17_parser_internals_9arc_eager_ArcEager *__pyx_v_self, CYTHON_UNUSED PyObject *__pyx_v___pyx_state); /* proto */ +static PyObject *__pyx_pf_5spacy_8pipeline_17_parser_internals_9arc_eager_2__pyx_unpickle_Shift(CYTHON_UNUSED PyObject *__pyx_self, PyObject *__pyx_v___pyx_type, long __pyx_v___pyx_checksum, PyObject *__pyx_v___pyx_state); /* proto */ +static PyObject *__pyx_pf_5spacy_8pipeline_17_parser_internals_9arc_eager_4__pyx_unpickle_Reduce(CYTHON_UNUSED PyObject *__pyx_self, PyObject *__pyx_v___pyx_type, long __pyx_v___pyx_checksum, PyObject *__pyx_v___pyx_state); /* proto */ +static PyObject *__pyx_pf_5spacy_8pipeline_17_parser_internals_9arc_eager_6__pyx_unpickle_LeftArc(CYTHON_UNUSED PyObject *__pyx_self, PyObject *__pyx_v___pyx_type, long __pyx_v___pyx_checksum, PyObject *__pyx_v___pyx_state); /* proto */ +static PyObject *__pyx_pf_5spacy_8pipeline_17_parser_internals_9arc_eager_8__pyx_unpickle_RightArc(CYTHON_UNUSED PyObject *__pyx_self, PyObject *__pyx_v___pyx_type, long __pyx_v___pyx_checksum, PyObject *__pyx_v___pyx_state); /* proto */ +static PyObject *__pyx_pf_5spacy_8pipeline_17_parser_internals_9arc_eager_10__pyx_unpickle_Break(CYTHON_UNUSED PyObject *__pyx_self, PyObject *__pyx_v___pyx_type, long __pyx_v___pyx_checksum, PyObject *__pyx_v___pyx_state); /* proto */ +static PyObject *__pyx_tp_new_5spacy_8pipeline_17_parser_internals_9arc_eager_ArcEager(PyTypeObject *t, PyObject *a, PyObject *k); /*proto*/ +static PyObject *__pyx_tp_new_5spacy_8pipeline_17_parser_internals_9arc_eager_ArcEagerGold(PyTypeObject *t, PyObject *a, PyObject *k); /*proto*/ +static PyObject *__pyx_tp_new_5spacy_8pipeline_17_parser_internals_9arc_eager_Shift(PyTypeObject *t, PyObject *a, PyObject *k); /*proto*/ +static PyObject *__pyx_tp_new_5spacy_8pipeline_17_parser_internals_9arc_eager_Reduce(PyTypeObject *t, PyObject *a, PyObject *k); /*proto*/ +static PyObject *__pyx_tp_new_5spacy_8pipeline_17_parser_internals_9arc_eager_LeftArc(PyTypeObject *t, PyObject *a, PyObject *k); /*proto*/ +static PyObject *__pyx_tp_new_5spacy_8pipeline_17_parser_internals_9arc_eager_RightArc(PyTypeObject *t, PyObject *a, PyObject *k); /*proto*/ +static PyObject *__pyx_tp_new_5spacy_8pipeline_17_parser_internals_9arc_eager_Break(PyTypeObject *t, PyObject *a, PyObject *k); /*proto*/ +static PyObject *__pyx_tp_new_5spacy_8pipeline_17_parser_internals_9arc_eager___pyx_scope_struct___get_aligned_sent_starts(PyTypeObject *t, PyObject *a, PyObject *k); /*proto*/ +static PyObject *__pyx_tp_new_5spacy_8pipeline_17_parser_internals_9arc_eager___pyx_scope_struct_1_genexpr(PyTypeObject *t, PyObject *a, PyObject *k); /*proto*/ +static PyObject *__pyx_tp_new_5spacy_8pipeline_17_parser_internals_9arc_eager___pyx_scope_struct_2_get_oracle_sequence_from_state(PyTypeObject *t, PyObject *a, PyObject *k); /*proto*/ +static PyObject *__pyx_tp_new_5spacy_8pipeline_17_parser_internals_9arc_eager___pyx_scope_struct_3_genexpr(PyTypeObject *t, PyObject *a, PyObject *k); /*proto*/ +static PyObject *__pyx_tp_new_array(PyTypeObject *t, PyObject *a, PyObject *k); /*proto*/ +static PyObject *__pyx_tp_new_Enum(PyTypeObject *t, PyObject *a, PyObject *k); /*proto*/ +static PyObject *__pyx_tp_new_memoryview(PyTypeObject *t, PyObject *a, PyObject *k); /*proto*/ +static PyObject *__pyx_tp_new__memoryviewslice(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_7cpython_4type_type; + PyTypeObject *__pyx_ptype_5numpy_dtype; + PyTypeObject *__pyx_ptype_5numpy_flatiter; + PyTypeObject *__pyx_ptype_5numpy_broadcast; + PyTypeObject *__pyx_ptype_5numpy_ndarray; + PyTypeObject *__pyx_ptype_5numpy_generic; + PyTypeObject *__pyx_ptype_5numpy_number; + PyTypeObject *__pyx_ptype_5numpy_integer; + PyTypeObject *__pyx_ptype_5numpy_signedinteger; + PyTypeObject *__pyx_ptype_5numpy_unsignedinteger; + PyTypeObject *__pyx_ptype_5numpy_inexact; + PyTypeObject *__pyx_ptype_5numpy_floating; + PyTypeObject *__pyx_ptype_5numpy_complexfloating; + PyTypeObject *__pyx_ptype_5numpy_flexible; + PyTypeObject *__pyx_ptype_5numpy_character; + PyTypeObject *__pyx_ptype_5numpy_ufunc; + PyTypeObject *__pyx_ptype_5cymem_5cymem_PyMalloc; + PyTypeObject *__pyx_ptype_5cymem_5cymem_PyFree; + PyTypeObject *__pyx_ptype_5cymem_5cymem_Pool; + PyTypeObject *__pyx_ptype_5cymem_5cymem_Address; + PyTypeObject *__pyx_ptype_7preshed_4maps_PreshMap; + PyTypeObject *__pyx_ptype_7preshed_4maps_PreshMapArray; + PyTypeObject *__pyx_ptype_5spacy_7strings_StringStore; + PyTypeObject *__pyx_ptype_5spacy_10morphology_Morphology; + PyTypeObject *__pyx_ptype_5spacy_5vocab_Vocab; + PyTypeObject *__pyx_ptype_5spacy_6lexeme_Lexeme; + PyTypeObject *__pyx_ptype_5spacy_6tokens_3doc_Doc; + PyTypeObject *__pyx_ptype_5spacy_8training_7example_Example; + PyTypeObject *__pyx_ptype_5spacy_8pipeline_17_parser_internals_10stateclass_StateClass; + PyTypeObject *__pyx_ptype_5spacy_8pipeline_17_parser_internals_17transition_system_TransitionSystem; + PyTypeObject *__pyx_ptype_5spacy_6tokens_5token_Token; + PyTypeObject *__pyx_ptype_5thinc_5extra_6search_Beam; + PyTypeObject *__pyx_ptype_5thinc_5extra_6search_MaxViolation; + PyObject *__pyx_type_5spacy_8pipeline_17_parser_internals_9arc_eager_ArcEager; + PyObject *__pyx_type_5spacy_8pipeline_17_parser_internals_9arc_eager_ArcEagerGold; + PyObject *__pyx_type_5spacy_8pipeline_17_parser_internals_9arc_eager_Shift; + PyObject *__pyx_type_5spacy_8pipeline_17_parser_internals_9arc_eager_Reduce; + PyObject *__pyx_type_5spacy_8pipeline_17_parser_internals_9arc_eager_LeftArc; + PyObject *__pyx_type_5spacy_8pipeline_17_parser_internals_9arc_eager_RightArc; + PyObject *__pyx_type_5spacy_8pipeline_17_parser_internals_9arc_eager_Break; + PyObject *__pyx_type_5spacy_8pipeline_17_parser_internals_9arc_eager___pyx_scope_struct___get_aligned_sent_starts; + PyObject *__pyx_type_5spacy_8pipeline_17_parser_internals_9arc_eager___pyx_scope_struct_1_genexpr; + PyObject *__pyx_type_5spacy_8pipeline_17_parser_internals_9arc_eager___pyx_scope_struct_2_get_oracle_sequence_from_state; + PyObject *__pyx_type_5spacy_8pipeline_17_parser_internals_9arc_eager___pyx_scope_struct_3_genexpr; + PyObject *__pyx_type___pyx_array; + PyObject *__pyx_type___pyx_MemviewEnum; + PyObject *__pyx_type___pyx_memoryview; + PyObject *__pyx_type___pyx_memoryviewslice; + PyTypeObject *__pyx_ptype_5spacy_8pipeline_17_parser_internals_9arc_eager_ArcEager; + PyTypeObject *__pyx_ptype_5spacy_8pipeline_17_parser_internals_9arc_eager_ArcEagerGold; + PyTypeObject *__pyx_ptype_5spacy_8pipeline_17_parser_internals_9arc_eager_Shift; + PyTypeObject *__pyx_ptype_5spacy_8pipeline_17_parser_internals_9arc_eager_Reduce; + PyTypeObject *__pyx_ptype_5spacy_8pipeline_17_parser_internals_9arc_eager_LeftArc; + PyTypeObject *__pyx_ptype_5spacy_8pipeline_17_parser_internals_9arc_eager_RightArc; + PyTypeObject *__pyx_ptype_5spacy_8pipeline_17_parser_internals_9arc_eager_Break; + PyTypeObject *__pyx_ptype_5spacy_8pipeline_17_parser_internals_9arc_eager___pyx_scope_struct___get_aligned_sent_starts; + PyTypeObject *__pyx_ptype_5spacy_8pipeline_17_parser_internals_9arc_eager___pyx_scope_struct_1_genexpr; + PyTypeObject *__pyx_ptype_5spacy_8pipeline_17_parser_internals_9arc_eager___pyx_scope_struct_2_get_oracle_sequence_from_state; + PyTypeObject *__pyx_ptype_5spacy_8pipeline_17_parser_internals_9arc_eager___pyx_scope_struct_3_genexpr; + PyTypeObject *__pyx_array_type; + PyTypeObject *__pyx_MemviewEnum_type; + PyTypeObject *__pyx_memoryview_type; + PyTypeObject *__pyx_memoryviewslice_type; + __Pyx_CachedCFunction __pyx_umethod_PyDict_Type_get; + __Pyx_CachedCFunction __pyx_umethod_PyDict_Type_items; + __Pyx_CachedCFunction __pyx_umethod_PyDict_Type_pop; + __Pyx_CachedCFunction __pyx_umethod_PyDict_Type_values; + __Pyx_CachedCFunction __pyx_umethod_PySet_Type__update; + PyObject *__pyx_slice[1]; + PyObject *__pyx_tuple[8]; + PyObject *__pyx_codeobj_tab[38]; + PyObject *__pyx_string_tab[377]; + PyObject *__pyx_number_tab[5]; +/* #### 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; + + +#if CYTHON_USE_FREELISTS +struct __pyx_obj_5spacy_8pipeline_17_parser_internals_9arc_eager___pyx_scope_struct___get_aligned_sent_starts *__pyx_freelist_5spacy_8pipeline_17_parser_internals_9arc_eager___pyx_scope_struct___get_aligned_sent_starts[8]; +int __pyx_freecount_5spacy_8pipeline_17_parser_internals_9arc_eager___pyx_scope_struct___get_aligned_sent_starts; +#endif + +#if CYTHON_USE_FREELISTS +struct __pyx_obj_5spacy_8pipeline_17_parser_internals_9arc_eager___pyx_scope_struct_1_genexpr *__pyx_freelist_5spacy_8pipeline_17_parser_internals_9arc_eager___pyx_scope_struct_1_genexpr[8]; +int __pyx_freecount_5spacy_8pipeline_17_parser_internals_9arc_eager___pyx_scope_struct_1_genexpr; +#endif + +#if CYTHON_USE_FREELISTS +struct __pyx_obj_5spacy_8pipeline_17_parser_internals_9arc_eager___pyx_scope_struct_2_get_oracle_sequence_from_state *__pyx_freelist_5spacy_8pipeline_17_parser_internals_9arc_eager___pyx_scope_struct_2_get_oracle_sequence_from_state[8]; +int __pyx_freecount_5spacy_8pipeline_17_parser_internals_9arc_eager___pyx_scope_struct_2_get_oracle_sequence_from_state; +#endif + +#if CYTHON_USE_FREELISTS +struct __pyx_obj_5spacy_8pipeline_17_parser_internals_9arc_eager___pyx_scope_struct_3_genexpr *__pyx_freelist_5spacy_8pipeline_17_parser_internals_9arc_eager___pyx_scope_struct_3_genexpr[8]; +int __pyx_freecount_5spacy_8pipeline_17_parser_internals_9arc_eager___pyx_scope_struct_3_genexpr; +#endif +/* CodeObjectCache.module_state_decls */ +struct __Pyx_CodeObjectCache __pyx_code_cache; + +/* Print.module_state_decls */ +PyObject* __pyx_print; +PyObject* __pyx_print_kwargs; + +/* IterNextPlain.module_state_decls */ +#if CYTHON_COMPILING_IN_LIMITED_API && __PYX_LIMITED_VERSION_HEX < 0x030A0000 +PyObject *__Pyx_GetBuiltinNext_LimitedAPI_cache; +#endif + +/* Generator.module_state_decls */ +PyTypeObject *__pyx_GeneratorType; + +/* #### 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_Aligned_heads __pyx_string_tab[1] +#define __pyx_kp_u_Aligned_sent_starts __pyx_string_tab[2] +#define __pyx_kp_u_All_dimensions_preceding_dimensi __pyx_string_tab[3] +#define __pyx_kp_u_Arc_is_gold_B0_S0 __pyx_string_tab[4] +#define __pyx_kp_u_Arc_is_gold_S0_B0 __pyx_string_tab[5] +#define __pyx_kp_u_B0 __pyx_string_tab[6] +#define __pyx_kp_u_Buffer_view_does_not_expose_stri __pyx_string_tab[7] +#define __pyx_kp_u_Can_only_create_a_buffer_that_is __pyx_string_tab[8] +#define __pyx_kp_u_Cannot_assign_to_read_only_memor __pyx_string_tab[9] +#define __pyx_kp_u_Cannot_create_writable_memory_vi __pyx_string_tab[10] +#define __pyx_kp_u_Cannot_index_with_type __pyx_string_tab[11] +#define __pyx_kp_u_Cannot_transpose_memoryview_with __pyx_string_tab[12] +#define __pyx_kp_u_Dimension_d_is_not_direct __pyx_string_tab[13] +#define __pyx_kp_u_Empty_shape_tuple_for_cython_arr __pyx_string_tab[14] +#define __pyx_kp_u_Gold_sent_starts __pyx_string_tab[15] +#define __pyx_kp_u_Index_out_of_bounds_axis_d __pyx_string_tab[16] +#define __pyx_kp_u_Indirect_dimensions_not_supporte __pyx_string_tab[17] +#define __pyx_kp_u_Invalid_mode_expected_c_or_fortr __pyx_string_tab[18] +#define __pyx_kp_u_Invalid_shape_in_axis __pyx_string_tab[19] +#define __pyx_kp_u_MemoryView_of __pyx_string_tab[20] +#define __pyx_kp_u_Note_that_Cython_is_deliberately __pyx_string_tab[21] +#define __pyx_kp_u_Out_of_bounds_on_buffer_access_a __pyx_string_tab[22] +#define __pyx_kp_u_Predicted_tokens __pyx_string_tab[23] +#define __pyx_kp_u_S0 __pyx_string_tab[24] +#define __pyx_kp_u_S0_head __pyx_string_tab[25] +#define __pyx_kp_u_Step_may_not_be_zero_axis_d __pyx_string_tab[26] +#define __pyx_kp_u_Unable_to_convert_item_to_object __pyx_string_tab[27] +#define __pyx_kp_u_Unknown_transition __pyx_string_tab[28] +#define __pyx_kp_u__10 __pyx_string_tab[29] +#define __pyx_kp_u__11 __pyx_string_tab[30] +#define __pyx_kp_u__2 __pyx_string_tab[31] +#define __pyx_kp_u__3 __pyx_string_tab[32] +#define __pyx_kp_u__4 __pyx_string_tab[33] +#define __pyx_kp_u__5 __pyx_string_tab[34] +#define __pyx_kp_u__6 __pyx_string_tab[35] +#define __pyx_kp_u__7 __pyx_string_tab[36] +#define __pyx_kp_u__8 __pyx_string_tab[37] +#define __pyx_kp_u_add_note __pyx_string_tab[38] +#define __pyx_kp_u_and __pyx_string_tab[39] +#define __pyx_kp_u_at_0x __pyx_string_tab[40] +#define __pyx_kp_u_collections_abc __pyx_string_tab[41] +#define __pyx_kp_u_contiguous_and_direct __pyx_string_tab[42] +#define __pyx_kp_u_contiguous_and_indirect __pyx_string_tab[43] +#define __pyx_kp_u_disable __pyx_string_tab[44] +#define __pyx_kp_u_enable __pyx_string_tab[45] +#define __pyx_kp_u_gc __pyx_string_tab[46] +#define __pyx_kp_u_gold_heads_s0 __pyx_string_tab[47] +#define __pyx_kp_u_got __pyx_string_tab[48] +#define __pyx_kp_u_got_differing_extents_in_dimensi __pyx_string_tab[49] +#define __pyx_kp_u_is_head_unknown_b0 __pyx_string_tab[50] +#define __pyx_kp_u_is_head_unknown_s0 __pyx_string_tab[51] +#define __pyx_kp_u_isenabled __pyx_string_tab[52] +#define __pyx_kp_u_itemsize_0_for_cython_array __pyx_string_tab[53] +#define __pyx_kp_u_no_default___reduce___due_to_non __pyx_string_tab[54] +#define __pyx_kp_u_numpy__core_multiarray_failed_to __pyx_string_tab[55] +#define __pyx_kp_u_numpy__core_umath_failed_to_impo __pyx_string_tab[56] +#define __pyx_kp_u_object __pyx_string_tab[57] +#define __pyx_kp_u_self_c_cannot_be_converted_to_a __pyx_string_tab[58] +#define __pyx_kp_u_self_c_self_del_beam_state_self __pyx_string_tab[59] +#define __pyx_kp_u_self_name_is_not_None __pyx_string_tab[60] +#define __pyx_kp_u_spacy_errors __pyx_string_tab[61] +#define __pyx_kp_u_spacy_pipeline__parser_internals_2 __pyx_string_tab[62] +#define __pyx_kp_u_spacy_pipeline__parser_internals_3 __pyx_string_tab[63] +#define __pyx_kp_u_spacy_training __pyx_string_tab[64] +#define __pyx_kp_u_strided_and_direct __pyx_string_tab[65] +#define __pyx_kp_u_strided_and_direct_or_indirect __pyx_string_tab[66] +#define __pyx_kp_u_strided_and_indirect __pyx_string_tab[67] +#define __pyx_kp_u_stringsource __pyx_string_tab[68] +#define __pyx_kp_u_unable_to_allocate_array_data __pyx_string_tab[69] +#define __pyx_kp_u_unable_to_allocate_shape_and_str __pyx_string_tab[70] +#define __pyx_n_u_ASCII __pyx_string_tab[71] +#define __pyx_n_u_Actions __pyx_string_tab[72] +#define __pyx_n_u_ArcEager __pyx_string_tab[73] +#define __pyx_n_u_ArcEagerGold __pyx_string_tab[74] +#define __pyx_n_u_ArcEagerGold___reduce_cython __pyx_string_tab[75] +#define __pyx_n_u_ArcEagerGold___setstate_cython __pyx_string_tab[76] +#define __pyx_n_u_ArcEagerGold_update __pyx_string_tab[77] +#define __pyx_n_u_ArcEager___reduce_cython __pyx_string_tab[78] +#define __pyx_n_u_ArcEager___setstate_cython __pyx_string_tab[79] +#define __pyx_n_u_ArcEager__replace_unseen_labels __pyx_string_tab[80] +#define __pyx_n_u_ArcEager_class_name __pyx_string_tab[81] +#define __pyx_n_u_ArcEager_get_actions __pyx_string_tab[82] +#define __pyx_n_u_ArcEager_get_beam_parses __pyx_string_tab[83] +#define __pyx_n_u_ArcEager_get_cost __pyx_string_tab[84] +#define __pyx_n_u_ArcEager_get_doc_labels __pyx_string_tab[85] +#define __pyx_n_u_ArcEager_get_oracle_sequence_fro __pyx_string_tab[86] +#define __pyx_n_u_ArcEager_has_gold __pyx_string_tab[87] +#define __pyx_n_u_ArcEager_init_gold __pyx_string_tab[88] +#define __pyx_n_u_ArcEager_init_gold_batch __pyx_string_tab[89] +#define __pyx_n_u_ArcEager_is_gold_parse __pyx_string_tab[90] +#define __pyx_n_u_ArcEager_move_name __pyx_string_tab[91] +#define __pyx_n_u_ArcEager_set_annotations __pyx_string_tab[92] +#define __pyx_n_u_ArcEager_transition __pyx_string_tab[93] +#define __pyx_n_u_B __pyx_string_tab[94] +#define __pyx_n_u_Break __pyx_string_tab[95] +#define __pyx_n_u_Break___reduce_cython __pyx_string_tab[96] +#define __pyx_n_u_Break___setstate_cython __pyx_string_tab[97] +#define __pyx_n_u_Buffer __pyx_string_tab[98] +#define __pyx_n_u_Counter __pyx_string_tab[99] +#define __pyx_n_u_D __pyx_string_tab[100] +#define __pyx_n_u_E019 __pyx_string_tab[101] +#define __pyx_n_u_E024 __pyx_string_tab[102] +#define __pyx_n_u_E040 __pyx_string_tab[103] +#define __pyx_n_u_E1031 __pyx_string_tab[104] +#define __pyx_n_u_E909 __pyx_string_tab[105] +#define __pyx_n_u_Ellipsis __pyx_string_tab[106] +#define __pyx_n_u_Errors __pyx_string_tab[107] +#define __pyx_n_u_False __pyx_string_tab[108] +#define __pyx_n_u_Gold __pyx_string_tab[109] +#define __pyx_n_u_L __pyx_string_tab[110] +#define __pyx_n_u_LeftArc __pyx_string_tab[111] +#define __pyx_n_u_LeftArc___reduce_cython __pyx_string_tab[112] +#define __pyx_n_u_LeftArc___setstate_cython __pyx_string_tab[113] +#define __pyx_n_u_MOVE_NAMES __pyx_string_tab[114] +#define __pyx_n_u_Pyx_PyDict_NextRef __pyx_string_tab[115] +#define __pyx_n_u_R __pyx_string_tab[116] +#define __pyx_n_u_ROOT __pyx_string_tab[117] +#define __pyx_n_u_Reduce __pyx_string_tab[118] +#define __pyx_n_u_Reduce___reduce_cython __pyx_string_tab[119] +#define __pyx_n_u_Reduce___setstate_cython __pyx_string_tab[120] +#define __pyx_n_u_RightArc __pyx_string_tab[121] +#define __pyx_n_u_RightArc___reduce_cython __pyx_string_tab[122] +#define __pyx_n_u_RightArc___setstate_cython __pyx_string_tab[123] +#define __pyx_n_u_S __pyx_string_tab[124] +#define __pyx_n_u_SENT_START __pyx_string_tab[125] +#define __pyx_n_u_Sequence __pyx_string_tab[126] +#define __pyx_n_u_Shift __pyx_string_tab[127] +#define __pyx_n_u_Shift___reduce_cython __pyx_string_tab[128] +#define __pyx_n_u_Shift___setstate_cython __pyx_string_tab[129] +#define __pyx_n_u_Stack __pyx_string_tab[130] +#define __pyx_n_u_View_MemoryView __pyx_string_tab[131] +#define __pyx_n_u__9 __pyx_string_tab[132] +#define __pyx_n_u_abc __pyx_string_tab[133] +#define __pyx_n_u_action __pyx_string_tab[134] +#define __pyx_n_u_actions __pyx_string_tab[135] +#define __pyx_n_u_add __pyx_string_tab[136] +#define __pyx_n_u_align __pyx_string_tab[137] +#define __pyx_n_u_aligned_heads __pyx_string_tab[138] +#define __pyx_n_u_aligned_labels __pyx_string_tab[139] +#define __pyx_n_u_alignment __pyx_string_tab[140] +#define __pyx_n_u_all_states __pyx_string_tab[141] +#define __pyx_n_u_allocate_buffer __pyx_string_tab[142] +#define __pyx_n_u_allow_transient __pyx_string_tab[143] +#define __pyx_n_u_arc __pyx_string_tab[144] +#define __pyx_n_u_arc_eager __pyx_string_tab[145] +#define __pyx_n_u_arcs __pyx_string_tab[146] +#define __pyx_n_u_asyncio_coroutines __pyx_string_tab[147] +#define __pyx_n_u_b0 __pyx_string_tab[148] +#define __pyx_n_u_backoff_label __pyx_string_tab[149] +#define __pyx_n_u_base __pyx_string_tab[150] +#define __pyx_n_u_beam __pyx_string_tab[151] +#define __pyx_n_u_break_labels __pyx_string_tab[152] +#define __pyx_n_u_builtin_labels __pyx_string_tab[153] +#define __pyx_n_u_c __pyx_string_tab[154] +#define __pyx_n_u_child __pyx_string_tab[155] +#define __pyx_n_u_class __pyx_string_tab[156] +#define __pyx_n_u_class_getitem __pyx_string_tab[157] +#define __pyx_n_u_class_name __pyx_string_tab[158] +#define __pyx_n_u_cline_in_traceback __pyx_string_tab[159] +#define __pyx_n_u_close __pyx_string_tab[160] +#define __pyx_n_u_cls __pyx_string_tab[161] +#define __pyx_n_u_collections __pyx_string_tab[162] +#define __pyx_n_u_copy __pyx_string_tab[163] +#define __pyx_n_u_cost __pyx_string_tab[164] +#define __pyx_n_u_costs __pyx_string_tab[165] +#define __pyx_n_u_count __pyx_string_tab[166] +#define __pyx_n_u_debug __pyx_string_tab[167] +#define __pyx_n_u_debug_log __pyx_string_tab[168] +#define __pyx_n_u_defaultdict __pyx_string_tab[169] +#define __pyx_n_u_dep __pyx_string_tab[170] +#define __pyx_n_u_dep_2 __pyx_string_tab[171] +#define __pyx_n_u_dict __pyx_string_tab[172] +#define __pyx_n_u_dict_2 __pyx_string_tab[173] +#define __pyx_n_u_doc __pyx_string_tab[174] +#define __pyx_n_u_dtype_is_object __pyx_string_tab[175] +#define __pyx_n_u_eg __pyx_string_tab[176] +#define __pyx_n_u_encode __pyx_string_tab[177] +#define __pyx_n_u_end __pyx_string_tab[178] +#define __pyx_n_u_enumerate __pyx_string_tab[179] +#define __pyx_n_u_error __pyx_string_tab[180] +#define __pyx_n_u_errors __pyx_string_tab[181] +#define __pyx_n_u_example __pyx_string_tab[182] +#define __pyx_n_u_example_gold_preproc __pyx_string_tab[183] +#define __pyx_n_u_examples __pyx_string_tab[184] +#define __pyx_n_u_failed __pyx_string_tab[185] +#define __pyx_n_u_file __pyx_string_tab[186] +#define __pyx_n_u_flags __pyx_string_tab[187] +#define __pyx_n_u_format __pyx_string_tab[188] +#define __pyx_n_u_fortran __pyx_string_tab[189] +#define __pyx_n_u_freq __pyx_string_tab[190] +#define __pyx_n_u_func __pyx_string_tab[191] +#define __pyx_n_u_genexpr __pyx_string_tab[192] +#define __pyx_n_u_get __pyx_string_tab[193] +#define __pyx_n_u_get_actions __pyx_string_tab[194] +#define __pyx_n_u_get_actions_locals_lambda __pyx_string_tab[195] +#define __pyx_n_u_get_aligned_parse __pyx_string_tab[196] +#define __pyx_n_u_get_aligned_sent_starts __pyx_string_tab[197] +#define __pyx_n_u_get_aligned_sent_starts_2 __pyx_string_tab[198] +#define __pyx_n_u_get_aligned_sent_starts_locals __pyx_string_tab[199] +#define __pyx_n_u_get_beam_parses __pyx_string_tab[200] +#define __pyx_n_u_get_class_name __pyx_string_tab[201] +#define __pyx_n_u_get_cost __pyx_string_tab[202] +#define __pyx_n_u_get_doc_labels __pyx_string_tab[203] +#define __pyx_n_u_get_oracle_sequence_from_state __pyx_string_tab[204] +#define __pyx_n_u_get_oracle_sequence_from_state_l __pyx_string_tab[205] +#define __pyx_n_u_getstate __pyx_string_tab[206] +#define __pyx_n_u_gold __pyx_string_tab[207] +#define __pyx_n_u_gold_2 __pyx_string_tab[208] +#define __pyx_n_u_gold_state __pyx_string_tab[209] +#define __pyx_n_u_golds __pyx_string_tab[210] +#define __pyx_n_u_has_annotation __pyx_string_tab[211] +#define __pyx_n_u_has_gold __pyx_string_tab[212] +#define __pyx_n_u_has_head __pyx_string_tab[213] +#define __pyx_n_u_head __pyx_string_tab[214] +#define __pyx_n_u_heads __pyx_string_tab[215] +#define __pyx_n_u_history __pyx_string_tab[216] +#define __pyx_n_u_i __pyx_string_tab[217] +#define __pyx_n_u_id __pyx_string_tab[218] +#define __pyx_n_u_import __pyx_string_tab[219] +#define __pyx_n_u_index __pyx_string_tab[220] +#define __pyx_n_u_init __pyx_string_tab[221] +#define __pyx_n_u_init_batch __pyx_string_tab[222] +#define __pyx_n_u_init_gold __pyx_string_tab[223] +#define __pyx_n_u_init_gold_batch __pyx_string_tab[224] +#define __pyx_n_u_is_coroutine __pyx_string_tab[225] +#define __pyx_n_u_is_final __pyx_string_tab[226] +#define __pyx_n_u_is_gold_parse __pyx_string_tab[227] +#define __pyx_n_u_is_valid __pyx_string_tab[228] +#define __pyx_n_u_items __pyx_string_tab[229] +#define __pyx_n_u_itemsize __pyx_string_tab[230] +#define __pyx_n_u_kwargs __pyx_string_tab[231] +#define __pyx_n_u_label __pyx_string_tab[232] +#define __pyx_n_u_label_freqs __pyx_string_tab[233] +#define __pyx_n_u_label_str __pyx_string_tab[234] +#define __pyx_n_u_labels __pyx_string_tab[235] +#define __pyx_n_u_lambda __pyx_string_tab[236] +#define __pyx_n_u_learn_tokens __pyx_string_tab[237] +#define __pyx_n_u_left_labels __pyx_string_tab[238] +#define __pyx_n_u_main __pyx_string_tab[239] +#define __pyx_n_u_max_length __pyx_string_tab[240] +#define __pyx_n_u_mem __pyx_string_tab[241] +#define __pyx_n_u_memview __pyx_string_tab[242] +#define __pyx_n_u_min __pyx_string_tab[243] +#define __pyx_n_u_min_cost __pyx_string_tab[244] +#define __pyx_n_u_min_freq __pyx_string_tab[245] +#define __pyx_n_u_mode __pyx_string_tab[246] +#define __pyx_n_u_module __pyx_string_tab[247] +#define __pyx_n_u_move __pyx_string_tab[248] +#define __pyx_n_u_move_name __pyx_string_tab[249] +#define __pyx_n_u_moves __pyx_string_tab[250] +#define __pyx_n_u_n_steps __pyx_string_tab[251] +#define __pyx_n_u_name __pyx_string_tab[252] +#define __pyx_n_u_name_2 __pyx_string_tab[253] +#define __pyx_n_u_ndim __pyx_string_tab[254] +#define __pyx_n_u_new __pyx_string_tab[255] +#define __pyx_n_u_next __pyx_string_tab[256] +#define __pyx_n_u_obj __pyx_string_tab[257] +#define __pyx_n_u_pack __pyx_string_tab[258] +#define __pyx_n_u_parse __pyx_string_tab[259] +#define __pyx_n_u_parses __pyx_string_tab[260] +#define __pyx_n_u_pop __pyx_string_tab[261] +#define __pyx_n_u_predicted __pyx_string_tab[262] +#define __pyx_n_u_print __pyx_string_tab[263] +#define __pyx_n_u_print_state __pyx_string_tab[264] +#define __pyx_n_u_prob __pyx_string_tab[265] +#define __pyx_n_u_probs __pyx_string_tab[266] +#define __pyx_n_u_projectivize __pyx_string_tab[267] +#define __pyx_n_u_pyx_checksum __pyx_string_tab[268] +#define __pyx_n_u_pyx_result __pyx_string_tab[269] +#define __pyx_n_u_pyx_state __pyx_string_tab[270] +#define __pyx_n_u_pyx_type __pyx_string_tab[271] +#define __pyx_n_u_pyx_unpickle_Break __pyx_string_tab[272] +#define __pyx_n_u_pyx_unpickle_Enum __pyx_string_tab[273] +#define __pyx_n_u_pyx_unpickle_LeftArc __pyx_string_tab[274] +#define __pyx_n_u_pyx_unpickle_Reduce __pyx_string_tab[275] +#define __pyx_n_u_pyx_unpickle_RightArc __pyx_string_tab[276] +#define __pyx_n_u_pyx_unpickle_Shift __pyx_string_tab[277] +#define __pyx_n_u_pyx_vtable __pyx_string_tab[278] +#define __pyx_n_u_qualname __pyx_string_tab[279] +#define __pyx_n_u_queue __pyx_string_tab[280] +#define __pyx_n_u_reduce __pyx_string_tab[281] +#define __pyx_n_u_reduce_cython __pyx_string_tab[282] +#define __pyx_n_u_reduce_ex __pyx_string_tab[283] +#define __pyx_n_u_reference __pyx_string_tab[284] +#define __pyx_n_u_register __pyx_string_tab[285] +#define __pyx_n_u_replace_unseen_labels __pyx_string_tab[286] +#define __pyx_n_u_right_labels __pyx_string_tab[287] +#define __pyx_n_u_root_label __pyx_string_tab[288] +#define __pyx_n_u_s __pyx_string_tab[289] +#define __pyx_n_u_s0 __pyx_string_tab[290] +#define __pyx_n_u_seen_words __pyx_string_tab[291] +#define __pyx_n_u_self __pyx_string_tab[292] +#define __pyx_n_u_send __pyx_string_tab[293] +#define __pyx_n_u_sent_starts __pyx_string_tab[294] +#define __pyx_n_u_sents __pyx_string_tab[295] +#define __pyx_n_u_set_annotations __pyx_string_tab[296] +#define __pyx_n_u_set_name __pyx_string_tab[297] +#define __pyx_n_u_setdefault __pyx_string_tab[298] +#define __pyx_n_u_setstate __pyx_string_tab[299] +#define __pyx_n_u_setstate_cython __pyx_string_tab[300] +#define __pyx_n_u_shape __pyx_string_tab[301] +#define __pyx_n_u_size __pyx_string_tab[302] +#define __pyx_n_u_spacy_pipeline__parser_internals __pyx_string_tab[303] +#define __pyx_n_u_split_bilu_label __pyx_string_tab[304] +#define __pyx_n_u_src __pyx_string_tab[305] +#define __pyx_n_u_stack __pyx_string_tab[306] +#define __pyx_n_u_start __pyx_string_tab[307] +#define __pyx_n_u_state __pyx_string_tab[308] +#define __pyx_n_u_states __pyx_string_tab[309] +#define __pyx_n_u_stcls __pyx_string_tab[310] +#define __pyx_n_u_step __pyx_string_tab[311] +#define __pyx_n_u_stop __pyx_string_tab[312] +#define __pyx_n_u_struct __pyx_string_tab[313] +#define __pyx_n_u_subtok __pyx_string_tab[314] +#define __pyx_n_u_sum __pyx_string_tab[315] +#define __pyx_n_u_t __pyx_string_tab[316] +#define __pyx_n_u_test __pyx_string_tab[317] +#define __pyx_n_u_text __pyx_string_tab[318] +#define __pyx_n_u_throw __pyx_string_tab[319] +#define __pyx_n_u_token __pyx_string_tab[320] +#define __pyx_n_u_training __pyx_string_tab[321] +#define __pyx_n_u_transition __pyx_string_tab[322] +#define __pyx_n_u_unpack __pyx_string_tab[323] +#define __pyx_n_u_update __pyx_string_tab[324] +#define __pyx_n_u_upper __pyx_string_tab[325] +#define __pyx_n_u_use_setstate __pyx_string_tab[326] +#define __pyx_n_u_value __pyx_string_tab[327] +#define __pyx_n_u_values __pyx_string_tab[328] +#define __pyx_n_u_w __pyx_string_tab[329] +#define __pyx_n_u_word __pyx_string_tab[330] +#define __pyx_n_u_x __pyx_string_tab[331] +#define __pyx_n_u_x_idx __pyx_string_tab[332] +#define __pyx_n_u_x_indices __pyx_string_tab[333] +#define __pyx_n_u_y __pyx_string_tab[334] +#define __pyx_n_u_y2x __pyx_string_tab[335] +#define __pyx_n_u_y_sent __pyx_string_tab[336] +#define __pyx_n_u_zip __pyx_string_tab[337] +#define __pyx_kp_b_int_const_MISSING_DEP __pyx_string_tab[338] +#define __pyx_kp_b_int_struct___pyx_t_5spacy_7struc __pyx_string_tab[339] +#define __pyx_kp_b_iso88591_1F __pyx_string_tab[340] +#define __pyx_kp_b_iso88591_AV1 __pyx_string_tab[341] +#define __pyx_kp_b_iso88591_A_1F_1A_q __pyx_string_tab[342] +#define __pyx_kp_b_iso88591_A_4t5 __pyx_string_tab[343] +#define __pyx_kp_b_iso88591_A_4z_1F_wauA_U_4r_IQe4t2Qb_4r_IQ __pyx_string_tab[344] +#define __pyx_kp_b_iso88591_A_6_Ql_Qa_q_avQ_q_q_a_IV4q_q_1E __pyx_string_tab[345] +#define __pyx_kp_b_iso88591_A_AT_IQ_uA_d_5_q __pyx_string_tab[346] +#define __pyx_kp_b_iso88591_A_A_E_at1_IT_AQ_uIQ_uAQ_t9AQ_1_q __pyx_string_tab[347] +#define __pyx_kp_b_iso88591_A_D_1_QfBd_A_Qa __pyx_string_tab[348] +#define __pyx_kp_b_iso88591_A_D_2_1_AU_aq_q __pyx_string_tab[349] +#define __pyx_kp_b_iso88591_A_E_auBa_E_9AQ_t_aq_D_1AU_q_1D_C __pyx_string_tab[350] +#define __pyx_kp_b_iso88591_A_G1F_a_vWE_Q_q_q_AWKwa_AWKq __pyx_string_tab[351] +#define __pyx_kp_b_iso88591_A_G1F_a_vWE_Q_q_q_Qg_q_Qg __pyx_string_tab[352] +#define __pyx_kp_b_iso88591_A_G1F_a_vWE_Q_q_q_d_7_WA_d_7_Q __pyx_string_tab[353] +#define __pyx_kp_b_iso88591_A_G1F_a_vWE_Q_q_q_t1G_gQ_t1G_a __pyx_string_tab[354] +#define __pyx_kp_b_iso88591_A_G5_r_Qixs_82S_r_Qiwc_E_as_s_AR __pyx_string_tab[355] +#define __pyx_kp_b_iso88591_A_HAQ_T_d_t7_1_t7_1_E_at2Q_t_1D __pyx_string_tab[356] +#define __pyx_kp_b_iso88591_A_T_AQb_4vQ_G6_A_t9AT_T_iq_WAT_1 __pyx_string_tab[357] +#define __pyx_kp_b_iso88591_A_t_Qd_ARwd_ARq __pyx_string_tab[358] +#define __pyx_kp_b_iso88591_HBb_q_t5_1_q_1 __pyx_string_tab[359] +#define __pyx_kp_b_iso88591_Q __pyx_string_tab[360] +#define __pyx_kp_b_iso88591_QfA __pyx_string_tab[361] +#define __pyx_kp_b_iso88591_YYZ_A_t9Ba_6_j_6_F_4z_A_d_y_Jaz __pyx_string_tab[362] +#define __pyx_kp_b_iso88591__12 __pyx_string_tab[363] +#define __pyx_kp_b_iso88591__13 __pyx_string_tab[364] +#define __pyx_kp_b_iso88591_avQ __pyx_string_tab[365] +#define __pyx_kp_b_iso88591_hgQ __pyx_string_tab[366] +#define __pyx_kp_b_iso88591_q_0_kQR_5_7_q_a_1 __pyx_string_tab[367] +#define __pyx_kp_b_iso88591_q_0_kQR_6_7_1 __pyx_string_tab[368] +#define __pyx_kp_b_iso88591_q_0_kQR_7_1_7_N_1 __pyx_string_tab[369] +#define __pyx_kp_b_iso88591_q_0_kQR_881A_7_nA_1 __pyx_string_tab[370] +#define __pyx_kp_b_iso88591_wb_q_z_awb_1G1_JgRq_AU_6_q_1G1 __pyx_string_tab[371] +#define __pyx_kp_b_pyx_t_5spacy_8typedefs_attr_t __pyx_string_tab[372] +#define __pyx_kp_b_pyx_t_5spacy_8typedefs_hash_t __pyx_string_tab[373] +#define __pyx_kp_b_struct___pyx_t_5spacy_7structs_L __pyx_string_tab[374] +#define __pyx_kp_b_uint64_t_void_int_uint64_t_hash6 __pyx_string_tab[375] +#define __pyx_n_b_O __pyx_string_tab[376] +#define __pyx_int_0 __pyx_number_tab[0] +#define __pyx_int_neg_1 __pyx_number_tab[1] +#define __pyx_int_1 __pyx_number_tab[2] +#define __pyx_int_136983863 __pyx_number_tab[3] +#define __pyx_int_238750788 __pyx_number_tab[4] +/* #### 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_7cpython_4type_type); + Py_CLEAR(clear_module_state->__pyx_ptype_5numpy_dtype); + Py_CLEAR(clear_module_state->__pyx_ptype_5numpy_flatiter); + Py_CLEAR(clear_module_state->__pyx_ptype_5numpy_broadcast); + Py_CLEAR(clear_module_state->__pyx_ptype_5numpy_ndarray); + Py_CLEAR(clear_module_state->__pyx_ptype_5numpy_generic); + Py_CLEAR(clear_module_state->__pyx_ptype_5numpy_number); + Py_CLEAR(clear_module_state->__pyx_ptype_5numpy_integer); + Py_CLEAR(clear_module_state->__pyx_ptype_5numpy_signedinteger); + Py_CLEAR(clear_module_state->__pyx_ptype_5numpy_unsignedinteger); + Py_CLEAR(clear_module_state->__pyx_ptype_5numpy_inexact); + Py_CLEAR(clear_module_state->__pyx_ptype_5numpy_floating); + Py_CLEAR(clear_module_state->__pyx_ptype_5numpy_complexfloating); + Py_CLEAR(clear_module_state->__pyx_ptype_5numpy_flexible); + Py_CLEAR(clear_module_state->__pyx_ptype_5numpy_character); + Py_CLEAR(clear_module_state->__pyx_ptype_5numpy_ufunc); + Py_CLEAR(clear_module_state->__pyx_ptype_5cymem_5cymem_PyMalloc); + Py_CLEAR(clear_module_state->__pyx_ptype_5cymem_5cymem_PyFree); + Py_CLEAR(clear_module_state->__pyx_ptype_5cymem_5cymem_Pool); + Py_CLEAR(clear_module_state->__pyx_ptype_5cymem_5cymem_Address); + Py_CLEAR(clear_module_state->__pyx_ptype_7preshed_4maps_PreshMap); + Py_CLEAR(clear_module_state->__pyx_ptype_7preshed_4maps_PreshMapArray); + Py_CLEAR(clear_module_state->__pyx_ptype_5spacy_7strings_StringStore); + Py_CLEAR(clear_module_state->__pyx_ptype_5spacy_10morphology_Morphology); + Py_CLEAR(clear_module_state->__pyx_ptype_5spacy_5vocab_Vocab); + Py_CLEAR(clear_module_state->__pyx_ptype_5spacy_6lexeme_Lexeme); + Py_CLEAR(clear_module_state->__pyx_ptype_5spacy_6tokens_3doc_Doc); + Py_CLEAR(clear_module_state->__pyx_ptype_5spacy_8training_7example_Example); + Py_CLEAR(clear_module_state->__pyx_ptype_5spacy_8pipeline_17_parser_internals_10stateclass_StateClass); + Py_CLEAR(clear_module_state->__pyx_ptype_5spacy_8pipeline_17_parser_internals_17transition_system_TransitionSystem); + Py_CLEAR(clear_module_state->__pyx_ptype_5spacy_6tokens_5token_Token); + Py_CLEAR(clear_module_state->__pyx_ptype_5thinc_5extra_6search_Beam); + Py_CLEAR(clear_module_state->__pyx_ptype_5thinc_5extra_6search_MaxViolation); + Py_CLEAR(clear_module_state->__pyx_ptype_5spacy_8pipeline_17_parser_internals_9arc_eager_ArcEager); + Py_CLEAR(clear_module_state->__pyx_type_5spacy_8pipeline_17_parser_internals_9arc_eager_ArcEager); + Py_CLEAR(clear_module_state->__pyx_ptype_5spacy_8pipeline_17_parser_internals_9arc_eager_ArcEagerGold); + Py_CLEAR(clear_module_state->__pyx_type_5spacy_8pipeline_17_parser_internals_9arc_eager_ArcEagerGold); + Py_CLEAR(clear_module_state->__pyx_ptype_5spacy_8pipeline_17_parser_internals_9arc_eager_Shift); + Py_CLEAR(clear_module_state->__pyx_type_5spacy_8pipeline_17_parser_internals_9arc_eager_Shift); + Py_CLEAR(clear_module_state->__pyx_ptype_5spacy_8pipeline_17_parser_internals_9arc_eager_Reduce); + Py_CLEAR(clear_module_state->__pyx_type_5spacy_8pipeline_17_parser_internals_9arc_eager_Reduce); + Py_CLEAR(clear_module_state->__pyx_ptype_5spacy_8pipeline_17_parser_internals_9arc_eager_LeftArc); + Py_CLEAR(clear_module_state->__pyx_type_5spacy_8pipeline_17_parser_internals_9arc_eager_LeftArc); + Py_CLEAR(clear_module_state->__pyx_ptype_5spacy_8pipeline_17_parser_internals_9arc_eager_RightArc); + Py_CLEAR(clear_module_state->__pyx_type_5spacy_8pipeline_17_parser_internals_9arc_eager_RightArc); + Py_CLEAR(clear_module_state->__pyx_ptype_5spacy_8pipeline_17_parser_internals_9arc_eager_Break); + Py_CLEAR(clear_module_state->__pyx_type_5spacy_8pipeline_17_parser_internals_9arc_eager_Break); + Py_CLEAR(clear_module_state->__pyx_ptype_5spacy_8pipeline_17_parser_internals_9arc_eager___pyx_scope_struct___get_aligned_sent_starts); + Py_CLEAR(clear_module_state->__pyx_type_5spacy_8pipeline_17_parser_internals_9arc_eager___pyx_scope_struct___get_aligned_sent_starts); + Py_CLEAR(clear_module_state->__pyx_ptype_5spacy_8pipeline_17_parser_internals_9arc_eager___pyx_scope_struct_1_genexpr); + Py_CLEAR(clear_module_state->__pyx_type_5spacy_8pipeline_17_parser_internals_9arc_eager___pyx_scope_struct_1_genexpr); + Py_CLEAR(clear_module_state->__pyx_ptype_5spacy_8pipeline_17_parser_internals_9arc_eager___pyx_scope_struct_2_get_oracle_sequence_from_state); + Py_CLEAR(clear_module_state->__pyx_type_5spacy_8pipeline_17_parser_internals_9arc_eager___pyx_scope_struct_2_get_oracle_sequence_from_state); + Py_CLEAR(clear_module_state->__pyx_ptype_5spacy_8pipeline_17_parser_internals_9arc_eager___pyx_scope_struct_3_genexpr); + Py_CLEAR(clear_module_state->__pyx_type_5spacy_8pipeline_17_parser_internals_9arc_eager___pyx_scope_struct_3_genexpr); + Py_CLEAR(clear_module_state->__pyx_array_type); + Py_CLEAR(clear_module_state->__pyx_type___pyx_array); + Py_CLEAR(clear_module_state->__pyx_MemviewEnum_type); + Py_CLEAR(clear_module_state->__pyx_type___pyx_MemviewEnum); + Py_CLEAR(clear_module_state->__pyx_memoryview_type); + Py_CLEAR(clear_module_state->__pyx_type___pyx_memoryview); + Py_CLEAR(clear_module_state->__pyx_memoryviewslice_type); + Py_CLEAR(clear_module_state->__pyx_type___pyx_memoryviewslice); + for (int i=0; i<1; ++i) { Py_CLEAR(clear_module_state->__pyx_slice[i]); } + for (int i=0; i<8; ++i) { Py_CLEAR(clear_module_state->__pyx_tuple[i]); } + for (int i=0; i<38; ++i) { Py_CLEAR(clear_module_state->__pyx_codeobj_tab[i]); } + for (int i=0; i<377; ++i) { Py_CLEAR(clear_module_state->__pyx_string_tab[i]); } + for (int i=0; i<5; ++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); + +/* Generator.module_state_clear */ +Py_CLEAR(clear_module_state->__pyx_GeneratorType); + +/* #### 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_7cpython_4type_type); + Py_VISIT(traverse_module_state->__pyx_ptype_5numpy_dtype); + Py_VISIT(traverse_module_state->__pyx_ptype_5numpy_flatiter); + Py_VISIT(traverse_module_state->__pyx_ptype_5numpy_broadcast); + Py_VISIT(traverse_module_state->__pyx_ptype_5numpy_ndarray); + Py_VISIT(traverse_module_state->__pyx_ptype_5numpy_generic); + Py_VISIT(traverse_module_state->__pyx_ptype_5numpy_number); + Py_VISIT(traverse_module_state->__pyx_ptype_5numpy_integer); + Py_VISIT(traverse_module_state->__pyx_ptype_5numpy_signedinteger); + Py_VISIT(traverse_module_state->__pyx_ptype_5numpy_unsignedinteger); + Py_VISIT(traverse_module_state->__pyx_ptype_5numpy_inexact); + Py_VISIT(traverse_module_state->__pyx_ptype_5numpy_floating); + Py_VISIT(traverse_module_state->__pyx_ptype_5numpy_complexfloating); + Py_VISIT(traverse_module_state->__pyx_ptype_5numpy_flexible); + Py_VISIT(traverse_module_state->__pyx_ptype_5numpy_character); + Py_VISIT(traverse_module_state->__pyx_ptype_5numpy_ufunc); + Py_VISIT(traverse_module_state->__pyx_ptype_5cymem_5cymem_PyMalloc); + Py_VISIT(traverse_module_state->__pyx_ptype_5cymem_5cymem_PyFree); + Py_VISIT(traverse_module_state->__pyx_ptype_5cymem_5cymem_Pool); + Py_VISIT(traverse_module_state->__pyx_ptype_5cymem_5cymem_Address); + Py_VISIT(traverse_module_state->__pyx_ptype_7preshed_4maps_PreshMap); + Py_VISIT(traverse_module_state->__pyx_ptype_7preshed_4maps_PreshMapArray); + Py_VISIT(traverse_module_state->__pyx_ptype_5spacy_7strings_StringStore); + Py_VISIT(traverse_module_state->__pyx_ptype_5spacy_10morphology_Morphology); + Py_VISIT(traverse_module_state->__pyx_ptype_5spacy_5vocab_Vocab); + Py_VISIT(traverse_module_state->__pyx_ptype_5spacy_6lexeme_Lexeme); + Py_VISIT(traverse_module_state->__pyx_ptype_5spacy_6tokens_3doc_Doc); + Py_VISIT(traverse_module_state->__pyx_ptype_5spacy_8training_7example_Example); + Py_VISIT(traverse_module_state->__pyx_ptype_5spacy_8pipeline_17_parser_internals_10stateclass_StateClass); + Py_VISIT(traverse_module_state->__pyx_ptype_5spacy_8pipeline_17_parser_internals_17transition_system_TransitionSystem); + Py_VISIT(traverse_module_state->__pyx_ptype_5spacy_6tokens_5token_Token); + Py_VISIT(traverse_module_state->__pyx_ptype_5thinc_5extra_6search_Beam); + Py_VISIT(traverse_module_state->__pyx_ptype_5thinc_5extra_6search_MaxViolation); + Py_VISIT(traverse_module_state->__pyx_ptype_5spacy_8pipeline_17_parser_internals_9arc_eager_ArcEager); + Py_VISIT(traverse_module_state->__pyx_type_5spacy_8pipeline_17_parser_internals_9arc_eager_ArcEager); + Py_VISIT(traverse_module_state->__pyx_ptype_5spacy_8pipeline_17_parser_internals_9arc_eager_ArcEagerGold); + Py_VISIT(traverse_module_state->__pyx_type_5spacy_8pipeline_17_parser_internals_9arc_eager_ArcEagerGold); + Py_VISIT(traverse_module_state->__pyx_ptype_5spacy_8pipeline_17_parser_internals_9arc_eager_Shift); + Py_VISIT(traverse_module_state->__pyx_type_5spacy_8pipeline_17_parser_internals_9arc_eager_Shift); + Py_VISIT(traverse_module_state->__pyx_ptype_5spacy_8pipeline_17_parser_internals_9arc_eager_Reduce); + Py_VISIT(traverse_module_state->__pyx_type_5spacy_8pipeline_17_parser_internals_9arc_eager_Reduce); + Py_VISIT(traverse_module_state->__pyx_ptype_5spacy_8pipeline_17_parser_internals_9arc_eager_LeftArc); + Py_VISIT(traverse_module_state->__pyx_type_5spacy_8pipeline_17_parser_internals_9arc_eager_LeftArc); + Py_VISIT(traverse_module_state->__pyx_ptype_5spacy_8pipeline_17_parser_internals_9arc_eager_RightArc); + Py_VISIT(traverse_module_state->__pyx_type_5spacy_8pipeline_17_parser_internals_9arc_eager_RightArc); + Py_VISIT(traverse_module_state->__pyx_ptype_5spacy_8pipeline_17_parser_internals_9arc_eager_Break); + Py_VISIT(traverse_module_state->__pyx_type_5spacy_8pipeline_17_parser_internals_9arc_eager_Break); + Py_VISIT(traverse_module_state->__pyx_ptype_5spacy_8pipeline_17_parser_internals_9arc_eager___pyx_scope_struct___get_aligned_sent_starts); + Py_VISIT(traverse_module_state->__pyx_type_5spacy_8pipeline_17_parser_internals_9arc_eager___pyx_scope_struct___get_aligned_sent_starts); + Py_VISIT(traverse_module_state->__pyx_ptype_5spacy_8pipeline_17_parser_internals_9arc_eager___pyx_scope_struct_1_genexpr); + Py_VISIT(traverse_module_state->__pyx_type_5spacy_8pipeline_17_parser_internals_9arc_eager___pyx_scope_struct_1_genexpr); + Py_VISIT(traverse_module_state->__pyx_ptype_5spacy_8pipeline_17_parser_internals_9arc_eager___pyx_scope_struct_2_get_oracle_sequence_from_state); + Py_VISIT(traverse_module_state->__pyx_type_5spacy_8pipeline_17_parser_internals_9arc_eager___pyx_scope_struct_2_get_oracle_sequence_from_state); + Py_VISIT(traverse_module_state->__pyx_ptype_5spacy_8pipeline_17_parser_internals_9arc_eager___pyx_scope_struct_3_genexpr); + Py_VISIT(traverse_module_state->__pyx_type_5spacy_8pipeline_17_parser_internals_9arc_eager___pyx_scope_struct_3_genexpr); + Py_VISIT(traverse_module_state->__pyx_array_type); + Py_VISIT(traverse_module_state->__pyx_type___pyx_array); + Py_VISIT(traverse_module_state->__pyx_MemviewEnum_type); + Py_VISIT(traverse_module_state->__pyx_type___pyx_MemviewEnum); + Py_VISIT(traverse_module_state->__pyx_memoryview_type); + Py_VISIT(traverse_module_state->__pyx_type___pyx_memoryview); + Py_VISIT(traverse_module_state->__pyx_memoryviewslice_type); + Py_VISIT(traverse_module_state->__pyx_type___pyx_memoryviewslice); + for (int i=0; i<1; ++i) { __Pyx_VISIT_CONST(traverse_module_state->__pyx_slice[i]); } + for (int i=0; i<8; ++i) { __Pyx_VISIT_CONST(traverse_module_state->__pyx_tuple[i]); } + for (int i=0; i<38; ++i) { __Pyx_VISIT_CONST(traverse_module_state->__pyx_codeobj_tab[i]); } + for (int i=0; i<377; ++i) { __Pyx_VISIT_CONST(traverse_module_state->__pyx_string_tab[i]); } + for (int i=0; i<5; ++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); + +/* Generator.module_state_traverse */ +Py_VISIT(traverse_module_state->__pyx_GeneratorType); + +/* #### Code section: module_state_traverse_end ### */ +return 0; +} +#endif +/* #### Code section: module_code ### */ + +/* "vector.to_py":79 + * const Py_ssize_t PY_SSIZE_T_MAX + * + * @cname("__pyx_convert_vector_to_py_struct____pyx_t_5spacy_8pipeline_17_parser_internals_6_state_ArcC") # <<<<<<<<<<<<<< + * cdef object __pyx_convert_vector_to_py_struct____pyx_t_5spacy_8pipeline_17_parser_internals_6_state_ArcC(const vector[X]& v): + * if v.size() > PY_SSIZE_T_MAX: +*/ + +static PyObject *__pyx_convert_vector_to_py_struct____pyx_t_5spacy_8pipeline_17_parser_internals_6_state_ArcC(std::vector const &__pyx_v_v) { + Py_ssize_t __pyx_v_v_size_signed; + PyObject *__pyx_v_o = NULL; + Py_ssize_t __pyx_v_i; + PyObject *__pyx_v_item = 0; + PyObject *__pyx_r = NULL; + __Pyx_RefNannyDeclarations + int __pyx_t_1; + PyObject *__pyx_t_2 = NULL; + Py_ssize_t __pyx_t_3; + Py_ssize_t __pyx_t_4; + Py_ssize_t __pyx_t_5; + int __pyx_t_6; + int __pyx_lineno = 0; + const char *__pyx_filename = NULL; + int __pyx_clineno = 0; + __Pyx_RefNannySetupContext("__pyx_convert_vector_to_py_struct____pyx_t_5spacy_8pipeline_17_parser_internals_6_state_ArcC", 0); + + /* "vector.to_py":81 + * @cname("__pyx_convert_vector_to_py_struct____pyx_t_5spacy_8pipeline_17_parser_internals_6_state_ArcC") + * cdef object __pyx_convert_vector_to_py_struct____pyx_t_5spacy_8pipeline_17_parser_internals_6_state_ArcC(const vector[X]& v): + * if v.size() > PY_SSIZE_T_MAX: # <<<<<<<<<<<<<< + * raise MemoryError() + * v_size_signed = v.size() +*/ + __pyx_t_1 = (__pyx_v_v.size() > ((size_t)PY_SSIZE_T_MAX)); + if (unlikely(__pyx_t_1)) { + + /* "vector.to_py":82 + * cdef object __pyx_convert_vector_to_py_struct____pyx_t_5spacy_8pipeline_17_parser_internals_6_state_ArcC(const vector[X]& v): + * if v.size() > PY_SSIZE_T_MAX: + * raise MemoryError() # <<<<<<<<<<<<<< + * v_size_signed = v.size() + * +*/ + PyErr_NoMemory(); __PYX_ERR(1, 82, __pyx_L1_error) + + /* "vector.to_py":81 + * @cname("__pyx_convert_vector_to_py_struct____pyx_t_5spacy_8pipeline_17_parser_internals_6_state_ArcC") + * cdef object __pyx_convert_vector_to_py_struct____pyx_t_5spacy_8pipeline_17_parser_internals_6_state_ArcC(const vector[X]& v): + * if v.size() > PY_SSIZE_T_MAX: # <<<<<<<<<<<<<< + * raise MemoryError() + * v_size_signed = v.size() +*/ + } + + /* "vector.to_py":83 + * if v.size() > PY_SSIZE_T_MAX: + * raise MemoryError() + * v_size_signed = v.size() # <<<<<<<<<<<<<< + * + * o = PyList_New(v_size_signed) +*/ + __pyx_v_v_size_signed = ((Py_ssize_t)__pyx_v_v.size()); + + /* "vector.to_py":85 + * v_size_signed = v.size() + * + * o = PyList_New(v_size_signed) # <<<<<<<<<<<<<< + * + * cdef Py_ssize_t i +*/ + __pyx_t_2 = PyList_New(__pyx_v_v_size_signed); if (unlikely(!__pyx_t_2)) __PYX_ERR(1, 85, __pyx_L1_error) + __Pyx_GOTREF(__pyx_t_2); + __pyx_v_o = ((PyObject*)__pyx_t_2); + __pyx_t_2 = 0; + + /* "vector.to_py":90 + * cdef object item + * + * for i in range(v_size_signed): # <<<<<<<<<<<<<< + * item = v[i] + * Py_INCREF(item) +*/ + __pyx_t_3 = __pyx_v_v_size_signed; + __pyx_t_4 = __pyx_t_3; + for (__pyx_t_5 = 0; __pyx_t_5 < __pyx_t_4; __pyx_t_5+=1) { + __pyx_v_i = __pyx_t_5; + + /* "vector.to_py":91 + * + * for i in range(v_size_signed): + * item = v[i] # <<<<<<<<<<<<<< + * Py_INCREF(item) + * __Pyx_PyList_SET_ITEM(o, i, item) +*/ + __pyx_t_2 = __pyx_convert__to_py_struct____pyx_t_5spacy_8pipeline_17_parser_internals_6_state_ArcC((__pyx_v_v[__pyx_v_i])); if (unlikely(!__pyx_t_2)) __PYX_ERR(1, 91, __pyx_L1_error) + __Pyx_GOTREF(__pyx_t_2); + __Pyx_XDECREF_SET(__pyx_v_item, __pyx_t_2); + __pyx_t_2 = 0; + + /* "vector.to_py":92 + * for i in range(v_size_signed): + * item = v[i] + * Py_INCREF(item) # <<<<<<<<<<<<<< + * __Pyx_PyList_SET_ITEM(o, i, item) + * +*/ + Py_INCREF(__pyx_v_item); + + /* "vector.to_py":93 + * item = v[i] + * Py_INCREF(item) + * __Pyx_PyList_SET_ITEM(o, i, item) # <<<<<<<<<<<<<< + * + * return o +*/ + __pyx_t_6 = __Pyx_PyList_SET_ITEM(__pyx_v_o, __pyx_v_i, __pyx_v_item); if (unlikely(__pyx_t_6 == ((int)-1))) __PYX_ERR(1, 93, __pyx_L1_error) + } + + /* "vector.to_py":95 + * __Pyx_PyList_SET_ITEM(o, i, item) + * + * return o # <<<<<<<<<<<<<< +*/ + __Pyx_XDECREF(__pyx_r); + __Pyx_INCREF(__pyx_v_o); + __pyx_r = __pyx_v_o; + goto __pyx_L0; + + /* "vector.to_py":79 + * const Py_ssize_t PY_SSIZE_T_MAX + * + * @cname("__pyx_convert_vector_to_py_struct____pyx_t_5spacy_8pipeline_17_parser_internals_6_state_ArcC") # <<<<<<<<<<<<<< + * cdef object __pyx_convert_vector_to_py_struct____pyx_t_5spacy_8pipeline_17_parser_internals_6_state_ArcC(const vector[X]& v): + * if v.size() > PY_SSIZE_T_MAX: +*/ + + /* function exit code */ + __pyx_L1_error:; + __Pyx_XDECREF(__pyx_t_2); + __Pyx_AddTraceback("vector.to_py.__pyx_convert_vector_to_py_struct____pyx_t_5spacy_8pipeline_17_parser_internals_6_state_ArcC", __pyx_clineno, __pyx_lineno, __pyx_filename); + __pyx_r = 0; + __pyx_L0:; + __Pyx_XDECREF(__pyx_v_o); + __Pyx_XDECREF(__pyx_v_item); + __Pyx_XGIVEREF(__pyx_r); + __Pyx_RefNannyFinishContext(); + return __pyx_r; +} + +/* "View.MemoryView":129 + * cdef bint dtype_is_object + * + * def __cinit__(array self, tuple shape, Py_ssize_t itemsize, format not None, # <<<<<<<<<<<<<< + * mode="c", bint allocate_buffer=True): + * +*/ + +/* Python wrapper */ +static int __pyx_array___cinit__(PyObject *__pyx_v_self, PyObject *__pyx_args, PyObject *__pyx_kwds); /*proto*/ +static int __pyx_array___cinit__(PyObject *__pyx_v_self, PyObject *__pyx_args, PyObject *__pyx_kwds) { + PyObject *__pyx_v_shape = 0; + Py_ssize_t __pyx_v_itemsize; + PyObject *__pyx_v_format = 0; + PyObject *__pyx_v_mode = 0; + int __pyx_v_allocate_buffer; + CYTHON_UNUSED Py_ssize_t __pyx_nargs; + CYTHON_UNUSED PyObject *const *__pyx_kwvalues; + PyObject* values[5] = {0,0,0,0,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_shape,&__pyx_mstate_global->__pyx_n_u_itemsize,&__pyx_mstate_global->__pyx_n_u_format,&__pyx_mstate_global->__pyx_n_u_mode,&__pyx_mstate_global->__pyx_n_u_allocate_buffer,0}; + const Py_ssize_t __pyx_kwds_len = (__pyx_kwds) ? __Pyx_NumKwargs_VARARGS(__pyx_kwds) : 0; + if (unlikely(__pyx_kwds_len) < 0) __PYX_ERR(1, 129, __pyx_L3_error) + if (__pyx_kwds_len > 0) { + switch (__pyx_nargs) { + case 5: + values[4] = __Pyx_ArgRef_VARARGS(__pyx_args, 4); + if (!CYTHON_ASSUME_SAFE_MACROS && unlikely(!values[4])) __PYX_ERR(1, 129, __pyx_L3_error) + CYTHON_FALLTHROUGH; + case 4: + values[3] = __Pyx_ArgRef_VARARGS(__pyx_args, 3); + if (!CYTHON_ASSUME_SAFE_MACROS && unlikely(!values[3])) __PYX_ERR(1, 129, __pyx_L3_error) + CYTHON_FALLTHROUGH; + case 3: + values[2] = __Pyx_ArgRef_VARARGS(__pyx_args, 2); + if (!CYTHON_ASSUME_SAFE_MACROS && unlikely(!values[2])) __PYX_ERR(1, 129, __pyx_L3_error) + CYTHON_FALLTHROUGH; + case 2: + values[1] = __Pyx_ArgRef_VARARGS(__pyx_args, 1); + if (!CYTHON_ASSUME_SAFE_MACROS && unlikely(!values[1])) __PYX_ERR(1, 129, __pyx_L3_error) + CYTHON_FALLTHROUGH; + case 1: + values[0] = __Pyx_ArgRef_VARARGS(__pyx_args, 0); + if (!CYTHON_ASSUME_SAFE_MACROS && unlikely(!values[0])) __PYX_ERR(1, 129, __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(1, 129, __pyx_L3_error) + if (!values[3]) values[3] = __Pyx_NewRef(((PyObject *)__pyx_mstate_global->__pyx_n_u_c)); + for (Py_ssize_t i = __pyx_nargs; i < 3; i++) { + if (unlikely(!values[i])) { __Pyx_RaiseArgtupleInvalid("__cinit__", 0, 3, 5, i); __PYX_ERR(1, 129, __pyx_L3_error) } + } + } else { + switch (__pyx_nargs) { + case 5: + values[4] = __Pyx_ArgRef_VARARGS(__pyx_args, 4); + if (!CYTHON_ASSUME_SAFE_MACROS && unlikely(!values[4])) __PYX_ERR(1, 129, __pyx_L3_error) + CYTHON_FALLTHROUGH; + case 4: + values[3] = __Pyx_ArgRef_VARARGS(__pyx_args, 3); + if (!CYTHON_ASSUME_SAFE_MACROS && unlikely(!values[3])) __PYX_ERR(1, 129, __pyx_L3_error) + CYTHON_FALLTHROUGH; + case 3: + values[2] = __Pyx_ArgRef_VARARGS(__pyx_args, 2); + if (!CYTHON_ASSUME_SAFE_MACROS && unlikely(!values[2])) __PYX_ERR(1, 129, __pyx_L3_error) + values[1] = __Pyx_ArgRef_VARARGS(__pyx_args, 1); + if (!CYTHON_ASSUME_SAFE_MACROS && unlikely(!values[1])) __PYX_ERR(1, 129, __pyx_L3_error) + values[0] = __Pyx_ArgRef_VARARGS(__pyx_args, 0); + if (!CYTHON_ASSUME_SAFE_MACROS && unlikely(!values[0])) __PYX_ERR(1, 129, __pyx_L3_error) + break; + default: goto __pyx_L5_argtuple_error; + } + if (!values[3]) values[3] = __Pyx_NewRef(((PyObject *)__pyx_mstate_global->__pyx_n_u_c)); + } + __pyx_v_shape = ((PyObject*)values[0]); + __pyx_v_itemsize = __Pyx_PyIndex_AsSsize_t(values[1]); if (unlikely((__pyx_v_itemsize == (Py_ssize_t)-1) && PyErr_Occurred())) __PYX_ERR(1, 129, __pyx_L3_error) + __pyx_v_format = values[2]; + __pyx_v_mode = values[3]; + if (values[4]) { + __pyx_v_allocate_buffer = __Pyx_PyObject_IsTrue(values[4]); if (unlikely((__pyx_v_allocate_buffer == (int)-1) && PyErr_Occurred())) __PYX_ERR(1, 130, __pyx_L3_error) + } else { + + /* "View.MemoryView":130 + * + * def __cinit__(array self, tuple shape, Py_ssize_t itemsize, format not None, + * mode="c", bint allocate_buffer=True): # <<<<<<<<<<<<<< + * + * cdef int idx +*/ + __pyx_v_allocate_buffer = ((int)1); + } + } + goto __pyx_L6_skip; + __pyx_L5_argtuple_error:; + __Pyx_RaiseArgtupleInvalid("__cinit__", 0, 3, 5, __pyx_nargs); __PYX_ERR(1, 129, __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("View.MemoryView.array.__cinit__", __pyx_clineno, __pyx_lineno, __pyx_filename); + __Pyx_RefNannyFinishContext(); + return -1; + __pyx_L4_argument_unpacking_done:; + if (unlikely(!__Pyx_ArgTypeTest(((PyObject *)__pyx_v_shape), (&PyTuple_Type), 1, "shape", 1))) __PYX_ERR(1, 129, __pyx_L1_error) + if (unlikely(((PyObject *)__pyx_v_format) == Py_None)) { + PyErr_Format(PyExc_TypeError, "Argument '%.200s' must not be None", "format"); __PYX_ERR(1, 129, __pyx_L1_error) + } + __pyx_r = __pyx_array___pyx_pf_15View_dot_MemoryView_5array___cinit__(((struct __pyx_array_obj *)__pyx_v_self), __pyx_v_shape, __pyx_v_itemsize, __pyx_v_format, __pyx_v_mode, __pyx_v_allocate_buffer); + + /* "View.MemoryView":129 + * cdef bint dtype_is_object + * + * def __cinit__(array self, tuple shape, Py_ssize_t itemsize, format not None, # <<<<<<<<<<<<<< + * mode="c", bint allocate_buffer=True): + * +*/ + + /* 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_array___pyx_pf_15View_dot_MemoryView_5array___cinit__(struct __pyx_array_obj *__pyx_v_self, PyObject *__pyx_v_shape, Py_ssize_t __pyx_v_itemsize, PyObject *__pyx_v_format, PyObject *__pyx_v_mode, int __pyx_v_allocate_buffer) { + int __pyx_v_idx; + Py_ssize_t __pyx_v_dim; + char __pyx_v_order; + int __pyx_r; + __Pyx_RefNannyDeclarations + Py_ssize_t __pyx_t_1; + int __pyx_t_2; + int __pyx_t_3; + PyObject *__pyx_t_4 = NULL; + PyObject *__pyx_t_5 = NULL; + size_t __pyx_t_6; + char *__pyx_t_7; + int __pyx_t_8; + Py_ssize_t __pyx_t_9; + PyObject *__pyx_t_10 = NULL; + PyObject *__pyx_t_11[5]; + PyObject *__pyx_t_12 = NULL; + int __pyx_lineno = 0; + const char *__pyx_filename = NULL; + int __pyx_clineno = 0; + __Pyx_RefNannySetupContext("__cinit__", 0); + __Pyx_INCREF(__pyx_v_format); + + /* "View.MemoryView":135 + * cdef Py_ssize_t dim + * + * self.ndim = len(shape) # <<<<<<<<<<<<<< + * self.itemsize = itemsize + * +*/ + if (unlikely(__pyx_v_shape == Py_None)) { + PyErr_SetString(PyExc_TypeError, "object of type 'NoneType' has no len()"); + __PYX_ERR(1, 135, __pyx_L1_error) + } + __pyx_t_1 = __Pyx_PyTuple_GET_SIZE(__pyx_v_shape); if (unlikely(__pyx_t_1 == ((Py_ssize_t)-1))) __PYX_ERR(1, 135, __pyx_L1_error) + __pyx_v_self->ndim = ((int)__pyx_t_1); + + /* "View.MemoryView":136 + * + * self.ndim = len(shape) + * self.itemsize = itemsize # <<<<<<<<<<<<<< + * + * if not self.ndim: +*/ + __pyx_v_self->itemsize = __pyx_v_itemsize; + + /* "View.MemoryView":138 + * self.itemsize = itemsize + * + * if not self.ndim: # <<<<<<<<<<<<<< + * raise ValueError, "Empty shape tuple for cython.array" + * +*/ + __pyx_t_2 = (!(__pyx_v_self->ndim != 0)); + if (unlikely(__pyx_t_2)) { + + /* "View.MemoryView":139 + * + * if not self.ndim: + * raise ValueError, "Empty shape tuple for cython.array" # <<<<<<<<<<<<<< + * + * if itemsize <= 0: +*/ + __Pyx_Raise(((PyObject *)(((PyTypeObject*)PyExc_ValueError))), __pyx_mstate_global->__pyx_kp_u_Empty_shape_tuple_for_cython_arr, 0, 0); + __PYX_ERR(1, 139, __pyx_L1_error) + + /* "View.MemoryView":138 + * self.itemsize = itemsize + * + * if not self.ndim: # <<<<<<<<<<<<<< + * raise ValueError, "Empty shape tuple for cython.array" + * +*/ + } + + /* "View.MemoryView":141 + * raise ValueError, "Empty shape tuple for cython.array" + * + * if itemsize <= 0: # <<<<<<<<<<<<<< + * raise ValueError, "itemsize <= 0 for cython.array" + * +*/ + __pyx_t_2 = (__pyx_v_itemsize <= 0); + if (unlikely(__pyx_t_2)) { + + /* "View.MemoryView":142 + * + * if itemsize <= 0: + * raise ValueError, "itemsize <= 0 for cython.array" # <<<<<<<<<<<<<< + * + * if not isinstance(format, bytes): +*/ + __Pyx_Raise(((PyObject *)(((PyTypeObject*)PyExc_ValueError))), __pyx_mstate_global->__pyx_kp_u_itemsize_0_for_cython_array, 0, 0); + __PYX_ERR(1, 142, __pyx_L1_error) + + /* "View.MemoryView":141 + * raise ValueError, "Empty shape tuple for cython.array" + * + * if itemsize <= 0: # <<<<<<<<<<<<<< + * raise ValueError, "itemsize <= 0 for cython.array" + * +*/ + } + + /* "View.MemoryView":144 + * raise ValueError, "itemsize <= 0 for cython.array" + * + * if not isinstance(format, bytes): # <<<<<<<<<<<<<< + * format = format.encode('ASCII') + * self._format = format # keep a reference to the byte string +*/ + __pyx_t_2 = PyBytes_Check(__pyx_v_format); + __pyx_t_3 = (!__pyx_t_2); + if (__pyx_t_3) { + + /* "View.MemoryView":145 + * + * if not isinstance(format, bytes): + * format = format.encode('ASCII') # <<<<<<<<<<<<<< + * self._format = format # keep a reference to the byte string + * self.format = self._format +*/ + __pyx_t_5 = __pyx_v_format; + __Pyx_INCREF(__pyx_t_5); + __pyx_t_6 = 0; + { + PyObject *__pyx_callargs[2] = {__pyx_t_5, __pyx_mstate_global->__pyx_n_u_ASCII}; + __pyx_t_4 = __Pyx_PyObject_FastCallMethod((PyObject*)__pyx_mstate_global->__pyx_n_u_encode, __pyx_callargs+__pyx_t_6, (2-__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(1, 145, __pyx_L1_error) + __Pyx_GOTREF(__pyx_t_4); + } + __Pyx_DECREF_SET(__pyx_v_format, __pyx_t_4); + __pyx_t_4 = 0; + + /* "View.MemoryView":144 + * raise ValueError, "itemsize <= 0 for cython.array" + * + * if not isinstance(format, bytes): # <<<<<<<<<<<<<< + * format = format.encode('ASCII') + * self._format = format # keep a reference to the byte string +*/ + } + + /* "View.MemoryView":146 + * if not isinstance(format, bytes): + * format = format.encode('ASCII') + * self._format = format # keep a reference to the byte string # <<<<<<<<<<<<<< + * self.format = self._format + * +*/ + __pyx_t_4 = __pyx_v_format; + __Pyx_INCREF(__pyx_t_4); + if (!(likely(PyBytes_CheckExact(__pyx_t_4))||((__pyx_t_4) == Py_None) || __Pyx_RaiseUnexpectedTypeError("bytes", __pyx_t_4))) __PYX_ERR(1, 146, __pyx_L1_error) + __Pyx_GIVEREF(__pyx_t_4); + __Pyx_GOTREF(__pyx_v_self->_format); + __Pyx_DECREF(__pyx_v_self->_format); + __pyx_v_self->_format = ((PyObject*)__pyx_t_4); + __pyx_t_4 = 0; + + /* "View.MemoryView":147 + * format = format.encode('ASCII') + * self._format = format # keep a reference to the byte string + * self.format = self._format # <<<<<<<<<<<<<< + * + * +*/ + if (unlikely(__pyx_v_self->_format == Py_None)) { + PyErr_SetString(PyExc_TypeError, "expected bytes, NoneType found"); + __PYX_ERR(1, 147, __pyx_L1_error) + } + __pyx_t_7 = __Pyx_PyBytes_AsWritableString(__pyx_v_self->_format); if (unlikely((!__pyx_t_7) && PyErr_Occurred())) __PYX_ERR(1, 147, __pyx_L1_error) + __pyx_v_self->format = __pyx_t_7; + + /* "View.MemoryView":150 + * + * + * self._shape = PyObject_Malloc(sizeof(Py_ssize_t)*self.ndim*2) # <<<<<<<<<<<<<< + * self._strides = self._shape + self.ndim + * +*/ + __pyx_v_self->_shape = ((Py_ssize_t *)PyObject_Malloc((((sizeof(Py_ssize_t)) * __pyx_v_self->ndim) * 2))); + + /* "View.MemoryView":151 + * + * self._shape = PyObject_Malloc(sizeof(Py_ssize_t)*self.ndim*2) + * self._strides = self._shape + self.ndim # <<<<<<<<<<<<<< + * + * if not self._shape: +*/ + __pyx_v_self->_strides = (__pyx_v_self->_shape + __pyx_v_self->ndim); + + /* "View.MemoryView":153 + * self._strides = self._shape + self.ndim + * + * if not self._shape: # <<<<<<<<<<<<<< + * raise MemoryError, "unable to allocate shape and strides." + * +*/ + __pyx_t_3 = (!(__pyx_v_self->_shape != 0)); + if (unlikely(__pyx_t_3)) { + + /* "View.MemoryView":154 + * + * if not self._shape: + * raise MemoryError, "unable to allocate shape and strides." # <<<<<<<<<<<<<< + * + * +*/ + __Pyx_Raise(((PyObject *)(((PyTypeObject*)PyExc_MemoryError))), __pyx_mstate_global->__pyx_kp_u_unable_to_allocate_shape_and_str, 0, 0); + __PYX_ERR(1, 154, __pyx_L1_error) + + /* "View.MemoryView":153 + * self._strides = self._shape + self.ndim + * + * if not self._shape: # <<<<<<<<<<<<<< + * raise MemoryError, "unable to allocate shape and strides." + * +*/ + } + + /* "View.MemoryView":157 + * + * + * for idx, dim in enumerate(shape): # <<<<<<<<<<<<<< + * if dim <= 0: + * raise ValueError, f"Invalid shape in axis {idx}: {dim}." +*/ + __pyx_t_8 = 0; + __pyx_t_4 = __pyx_v_shape; __Pyx_INCREF(__pyx_t_4); + __pyx_t_1 = 0; + for (;;) { + { + Py_ssize_t __pyx_temp = __Pyx_PyTuple_GET_SIZE(__pyx_t_4); + #if !CYTHON_ASSUME_SAFE_SIZE + if (unlikely((__pyx_temp < 0))) __PYX_ERR(1, 157, __pyx_L1_error) + #endif + if (__pyx_t_1 >= __pyx_temp) break; + } + #if CYTHON_ASSUME_SAFE_MACROS && !CYTHON_AVOID_BORROWED_REFS + __pyx_t_5 = __Pyx_NewRef(PyTuple_GET_ITEM(__pyx_t_4, __pyx_t_1)); + #else + __pyx_t_5 = __Pyx_PySequence_ITEM(__pyx_t_4, __pyx_t_1); + #endif + ++__pyx_t_1; + if (unlikely(!__pyx_t_5)) __PYX_ERR(1, 157, __pyx_L1_error) + __Pyx_GOTREF(__pyx_t_5); + __pyx_t_9 = __Pyx_PyIndex_AsSsize_t(__pyx_t_5); if (unlikely((__pyx_t_9 == (Py_ssize_t)-1) && PyErr_Occurred())) __PYX_ERR(1, 157, __pyx_L1_error) + __Pyx_DECREF(__pyx_t_5); __pyx_t_5 = 0; + __pyx_v_dim = __pyx_t_9; + __pyx_v_idx = __pyx_t_8; + __pyx_t_8 = (__pyx_t_8 + 1); + + /* "View.MemoryView":158 + * + * for idx, dim in enumerate(shape): + * if dim <= 0: # <<<<<<<<<<<<<< + * raise ValueError, f"Invalid shape in axis {idx}: {dim}." + * self._shape[idx] = dim +*/ + __pyx_t_3 = (__pyx_v_dim <= 0); + if (unlikely(__pyx_t_3)) { + + /* "View.MemoryView":159 + * for idx, dim in enumerate(shape): + * if dim <= 0: + * raise ValueError, f"Invalid shape in axis {idx}: {dim}." # <<<<<<<<<<<<<< + * self._shape[idx] = dim + * +*/ + __pyx_t_5 = __Pyx_PyUnicode_From_int(__pyx_v_idx, 0, ' ', 'd'); if (unlikely(!__pyx_t_5)) __PYX_ERR(1, 159, __pyx_L1_error) + __Pyx_GOTREF(__pyx_t_5); + __pyx_t_10 = __Pyx_PyUnicode_From_Py_ssize_t(__pyx_v_dim, 0, ' ', 'd'); if (unlikely(!__pyx_t_10)) __PYX_ERR(1, 159, __pyx_L1_error) + __Pyx_GOTREF(__pyx_t_10); + __pyx_t_11[0] = __pyx_mstate_global->__pyx_kp_u_Invalid_shape_in_axis; + __pyx_t_11[1] = __pyx_t_5; + __pyx_t_11[2] = __pyx_mstate_global->__pyx_kp_u_; + __pyx_t_11[3] = __pyx_t_10; + __pyx_t_11[4] = __pyx_mstate_global->__pyx_kp_u__2; + __pyx_t_12 = __Pyx_PyUnicode_Join(__pyx_t_11, 5, 22 + __Pyx_PyUnicode_GET_LENGTH(__pyx_t_5) + 2 + __Pyx_PyUnicode_GET_LENGTH(__pyx_t_10) + 1, 127); + if (unlikely(!__pyx_t_12)) __PYX_ERR(1, 159, __pyx_L1_error) + __Pyx_GOTREF(__pyx_t_12); + __Pyx_DECREF(__pyx_t_5); __pyx_t_5 = 0; + __Pyx_DECREF(__pyx_t_10); __pyx_t_10 = 0; + __Pyx_Raise(((PyObject *)(((PyTypeObject*)PyExc_ValueError))), __pyx_t_12, 0, 0); + __Pyx_DECREF(__pyx_t_12); __pyx_t_12 = 0; + __PYX_ERR(1, 159, __pyx_L1_error) + + /* "View.MemoryView":158 + * + * for idx, dim in enumerate(shape): + * if dim <= 0: # <<<<<<<<<<<<<< + * raise ValueError, f"Invalid shape in axis {idx}: {dim}." + * self._shape[idx] = dim +*/ + } + + /* "View.MemoryView":160 + * if dim <= 0: + * raise ValueError, f"Invalid shape in axis {idx}: {dim}." + * self._shape[idx] = dim # <<<<<<<<<<<<<< + * + * cdef char order +*/ + (__pyx_v_self->_shape[__pyx_v_idx]) = __pyx_v_dim; + + /* "View.MemoryView":157 + * + * + * for idx, dim in enumerate(shape): # <<<<<<<<<<<<<< + * if dim <= 0: + * raise ValueError, f"Invalid shape in axis {idx}: {dim}." +*/ + } + __Pyx_DECREF(__pyx_t_4); __pyx_t_4 = 0; + + /* "View.MemoryView":163 + * + * cdef char order + * if mode == 'c': # <<<<<<<<<<<<<< + * order = b'C' + * self.mode = u'c' +*/ + __pyx_t_3 = (__Pyx_PyUnicode_Equals(__pyx_v_mode, __pyx_mstate_global->__pyx_n_u_c, Py_EQ)); if (unlikely((__pyx_t_3 < 0))) __PYX_ERR(1, 163, __pyx_L1_error) + if (__pyx_t_3) { + + /* "View.MemoryView":164 + * cdef char order + * if mode == 'c': + * order = b'C' # <<<<<<<<<<<<<< + * self.mode = u'c' + * elif mode == 'fortran': +*/ + __pyx_v_order = 'C'; + + /* "View.MemoryView":165 + * if mode == 'c': + * order = b'C' + * self.mode = u'c' # <<<<<<<<<<<<<< + * elif mode == 'fortran': + * order = b'F' +*/ + __Pyx_INCREF(__pyx_mstate_global->__pyx_n_u_c); + __Pyx_GIVEREF(__pyx_mstate_global->__pyx_n_u_c); + __Pyx_GOTREF(__pyx_v_self->mode); + __Pyx_DECREF(__pyx_v_self->mode); + __pyx_v_self->mode = __pyx_mstate_global->__pyx_n_u_c; + + /* "View.MemoryView":163 + * + * cdef char order + * if mode == 'c': # <<<<<<<<<<<<<< + * order = b'C' + * self.mode = u'c' +*/ + goto __pyx_L11; + } + + /* "View.MemoryView":166 + * order = b'C' + * self.mode = u'c' + * elif mode == 'fortran': # <<<<<<<<<<<<<< + * order = b'F' + * self.mode = u'fortran' +*/ + __pyx_t_3 = (__Pyx_PyUnicode_Equals(__pyx_v_mode, __pyx_mstate_global->__pyx_n_u_fortran, Py_EQ)); if (unlikely((__pyx_t_3 < 0))) __PYX_ERR(1, 166, __pyx_L1_error) + if (likely(__pyx_t_3)) { + + /* "View.MemoryView":167 + * self.mode = u'c' + * elif mode == 'fortran': + * order = b'F' # <<<<<<<<<<<<<< + * self.mode = u'fortran' + * else: +*/ + __pyx_v_order = 'F'; + + /* "View.MemoryView":168 + * elif mode == 'fortran': + * order = b'F' + * self.mode = u'fortran' # <<<<<<<<<<<<<< + * else: + * raise ValueError, f"Invalid mode, expected 'c' or 'fortran', got {mode}" +*/ + __Pyx_INCREF(__pyx_mstate_global->__pyx_n_u_fortran); + __Pyx_GIVEREF(__pyx_mstate_global->__pyx_n_u_fortran); + __Pyx_GOTREF(__pyx_v_self->mode); + __Pyx_DECREF(__pyx_v_self->mode); + __pyx_v_self->mode = __pyx_mstate_global->__pyx_n_u_fortran; + + /* "View.MemoryView":166 + * order = b'C' + * self.mode = u'c' + * elif mode == 'fortran': # <<<<<<<<<<<<<< + * order = b'F' + * self.mode = u'fortran' +*/ + goto __pyx_L11; + } + + /* "View.MemoryView":170 + * self.mode = u'fortran' + * else: + * raise ValueError, f"Invalid mode, expected 'c' or 'fortran', got {mode}" # <<<<<<<<<<<<<< + * + * self.len = fill_contig_strides_array(self._shape, self._strides, itemsize, self.ndim, order) +*/ + /*else*/ { + __pyx_t_4 = __Pyx_PyObject_FormatSimple(__pyx_v_mode, __pyx_mstate_global->__pyx_empty_unicode); if (unlikely(!__pyx_t_4)) __PYX_ERR(1, 170, __pyx_L1_error) + __Pyx_GOTREF(__pyx_t_4); + __pyx_t_12 = __Pyx_PyUnicode_Concat(__pyx_mstate_global->__pyx_kp_u_Invalid_mode_expected_c_or_fortr, __pyx_t_4); if (unlikely(!__pyx_t_12)) __PYX_ERR(1, 170, __pyx_L1_error) + __Pyx_GOTREF(__pyx_t_12); + __Pyx_DECREF(__pyx_t_4); __pyx_t_4 = 0; + __Pyx_Raise(((PyObject *)(((PyTypeObject*)PyExc_ValueError))), __pyx_t_12, 0, 0); + __Pyx_DECREF(__pyx_t_12); __pyx_t_12 = 0; + __PYX_ERR(1, 170, __pyx_L1_error) + } + __pyx_L11:; + + /* "View.MemoryView":172 + * raise ValueError, f"Invalid mode, expected 'c' or 'fortran', got {mode}" + * + * self.len = fill_contig_strides_array(self._shape, self._strides, itemsize, self.ndim, order) # <<<<<<<<<<<<<< + * + * self.free_data = allocate_buffer +*/ + __pyx_v_self->len = __pyx_fill_contig_strides_array(__pyx_v_self->_shape, __pyx_v_self->_strides, __pyx_v_itemsize, __pyx_v_self->ndim, __pyx_v_order); + + /* "View.MemoryView":174 + * self.len = fill_contig_strides_array(self._shape, self._strides, itemsize, self.ndim, order) + * + * self.free_data = allocate_buffer # <<<<<<<<<<<<<< + * self.dtype_is_object = format == b'O' + * +*/ + __pyx_v_self->free_data = __pyx_v_allocate_buffer; + + /* "View.MemoryView":175 + * + * self.free_data = allocate_buffer + * self.dtype_is_object = format == b'O' # <<<<<<<<<<<<<< + * + * if allocate_buffer: +*/ + __pyx_t_12 = PyObject_RichCompare(__pyx_v_format, __pyx_mstate_global->__pyx_n_b_O, Py_EQ); __Pyx_XGOTREF(__pyx_t_12); if (unlikely(!__pyx_t_12)) __PYX_ERR(1, 175, __pyx_L1_error) + __pyx_t_3 = __Pyx_PyObject_IsTrue(__pyx_t_12); if (unlikely((__pyx_t_3 == (int)-1) && PyErr_Occurred())) __PYX_ERR(1, 175, __pyx_L1_error) + __Pyx_DECREF(__pyx_t_12); __pyx_t_12 = 0; + __pyx_v_self->dtype_is_object = __pyx_t_3; + + /* "View.MemoryView":177 + * self.dtype_is_object = format == b'O' + * + * if allocate_buffer: # <<<<<<<<<<<<<< + * _allocate_buffer(self) + * +*/ + if (__pyx_v_allocate_buffer) { + + /* "View.MemoryView":178 + * + * if allocate_buffer: + * _allocate_buffer(self) # <<<<<<<<<<<<<< + * + * @cname('getbuffer') +*/ + __pyx_t_8 = __pyx_array_allocate_buffer(__pyx_v_self); if (unlikely(__pyx_t_8 == ((int)-1))) __PYX_ERR(1, 178, __pyx_L1_error) + + /* "View.MemoryView":177 + * self.dtype_is_object = format == b'O' + * + * if allocate_buffer: # <<<<<<<<<<<<<< + * _allocate_buffer(self) + * +*/ + } + + /* "View.MemoryView":129 + * cdef bint dtype_is_object + * + * def __cinit__(array self, tuple shape, Py_ssize_t itemsize, format not None, # <<<<<<<<<<<<<< + * mode="c", bint allocate_buffer=True): + * +*/ + + /* 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_10); + __Pyx_XDECREF(__pyx_t_12); + __Pyx_AddTraceback("View.MemoryView.array.__cinit__", __pyx_clineno, __pyx_lineno, __pyx_filename); + __pyx_r = -1; + __pyx_L0:; + __Pyx_XDECREF(__pyx_v_format); + __Pyx_RefNannyFinishContext(); + return __pyx_r; +} + +/* "View.MemoryView":180 + * _allocate_buffer(self) + * + * @cname('getbuffer') # <<<<<<<<<<<<<< + * def __getbuffer__(self, Py_buffer *info, int flags): + * cdef int bufmode = -1 +*/ + +/* Python wrapper */ +CYTHON_UNUSED static int __pyx_array_getbuffer(PyObject *__pyx_v_self, Py_buffer *__pyx_v_info, int __pyx_v_flags); /*proto*/ +CYTHON_UNUSED static int __pyx_array_getbuffer(PyObject *__pyx_v_self, Py_buffer *__pyx_v_info, int __pyx_v_flags) { + CYTHON_UNUSED PyObject *const *__pyx_kwvalues; + int __pyx_r; + __Pyx_RefNannyDeclarations + __Pyx_RefNannySetupContext("__getbuffer__ (wrapper)", 0); + __pyx_kwvalues = __Pyx_KwValues_VARARGS(__pyx_args, __pyx_nargs); + __pyx_r = __pyx_array___pyx_pf_15View_dot_MemoryView_5array_2__getbuffer__(((struct __pyx_array_obj *)__pyx_v_self), ((Py_buffer *)__pyx_v_info), ((int)__pyx_v_flags)); + + /* function exit code */ + __Pyx_RefNannyFinishContext(); + return __pyx_r; +} + +static int __pyx_array___pyx_pf_15View_dot_MemoryView_5array_2__getbuffer__(struct __pyx_array_obj *__pyx_v_self, Py_buffer *__pyx_v_info, int __pyx_v_flags) { + int __pyx_v_bufmode; + int __pyx_r; + __Pyx_RefNannyDeclarations + int __pyx_t_1; + char *__pyx_t_2; + Py_ssize_t __pyx_t_3; + int __pyx_t_4; + Py_ssize_t *__pyx_t_5; + int __pyx_lineno = 0; + const char *__pyx_filename = NULL; + int __pyx_clineno = 0; + if (unlikely(__pyx_v_info == NULL)) { + PyErr_SetString(PyExc_BufferError, "PyObject_GetBuffer: view==NULL argument is obsolete"); + return -1; + } + __Pyx_RefNannySetupContext("__getbuffer__", 0); + __pyx_v_info->obj = Py_None; __Pyx_INCREF(Py_None); + __Pyx_GIVEREF(__pyx_v_info->obj); + + /* "View.MemoryView":182 + * @cname('getbuffer') + * def __getbuffer__(self, Py_buffer *info, int flags): + * cdef int bufmode = -1 # <<<<<<<<<<<<<< + * if flags & (PyBUF_C_CONTIGUOUS | PyBUF_F_CONTIGUOUS | PyBUF_ANY_CONTIGUOUS): + * if self.mode == u"c": +*/ + __pyx_v_bufmode = -1; + + /* "View.MemoryView":183 + * def __getbuffer__(self, Py_buffer *info, int flags): + * cdef int bufmode = -1 + * if flags & (PyBUF_C_CONTIGUOUS | PyBUF_F_CONTIGUOUS | PyBUF_ANY_CONTIGUOUS): # <<<<<<<<<<<<<< + * if self.mode == u"c": + * bufmode = PyBUF_C_CONTIGUOUS | PyBUF_ANY_CONTIGUOUS +*/ + __pyx_t_1 = ((__pyx_v_flags & ((PyBUF_C_CONTIGUOUS | PyBUF_F_CONTIGUOUS) | PyBUF_ANY_CONTIGUOUS)) != 0); + if (__pyx_t_1) { + + /* "View.MemoryView":184 + * cdef int bufmode = -1 + * if flags & (PyBUF_C_CONTIGUOUS | PyBUF_F_CONTIGUOUS | PyBUF_ANY_CONTIGUOUS): + * if self.mode == u"c": # <<<<<<<<<<<<<< + * bufmode = PyBUF_C_CONTIGUOUS | PyBUF_ANY_CONTIGUOUS + * elif self.mode == u"fortran": +*/ + __pyx_t_1 = (__Pyx_PyUnicode_Equals(__pyx_v_self->mode, __pyx_mstate_global->__pyx_n_u_c, Py_EQ)); if (unlikely((__pyx_t_1 < 0))) __PYX_ERR(1, 184, __pyx_L1_error) + if (__pyx_t_1) { + + /* "View.MemoryView":185 + * if flags & (PyBUF_C_CONTIGUOUS | PyBUF_F_CONTIGUOUS | PyBUF_ANY_CONTIGUOUS): + * if self.mode == u"c": + * bufmode = PyBUF_C_CONTIGUOUS | PyBUF_ANY_CONTIGUOUS # <<<<<<<<<<<<<< + * elif self.mode == u"fortran": + * bufmode = PyBUF_F_CONTIGUOUS | PyBUF_ANY_CONTIGUOUS +*/ + __pyx_v_bufmode = (PyBUF_C_CONTIGUOUS | PyBUF_ANY_CONTIGUOUS); + + /* "View.MemoryView":184 + * cdef int bufmode = -1 + * if flags & (PyBUF_C_CONTIGUOUS | PyBUF_F_CONTIGUOUS | PyBUF_ANY_CONTIGUOUS): + * if self.mode == u"c": # <<<<<<<<<<<<<< + * bufmode = PyBUF_C_CONTIGUOUS | PyBUF_ANY_CONTIGUOUS + * elif self.mode == u"fortran": +*/ + goto __pyx_L4; + } + + /* "View.MemoryView":186 + * if self.mode == u"c": + * bufmode = PyBUF_C_CONTIGUOUS | PyBUF_ANY_CONTIGUOUS + * elif self.mode == u"fortran": # <<<<<<<<<<<<<< + * bufmode = PyBUF_F_CONTIGUOUS | PyBUF_ANY_CONTIGUOUS + * if not (flags & bufmode): +*/ + __pyx_t_1 = (__Pyx_PyUnicode_Equals(__pyx_v_self->mode, __pyx_mstate_global->__pyx_n_u_fortran, Py_EQ)); if (unlikely((__pyx_t_1 < 0))) __PYX_ERR(1, 186, __pyx_L1_error) + if (__pyx_t_1) { + + /* "View.MemoryView":187 + * bufmode = PyBUF_C_CONTIGUOUS | PyBUF_ANY_CONTIGUOUS + * elif self.mode == u"fortran": + * bufmode = PyBUF_F_CONTIGUOUS | PyBUF_ANY_CONTIGUOUS # <<<<<<<<<<<<<< + * if not (flags & bufmode): + * raise ValueError, "Can only create a buffer that is contiguous in memory." +*/ + __pyx_v_bufmode = (PyBUF_F_CONTIGUOUS | PyBUF_ANY_CONTIGUOUS); + + /* "View.MemoryView":186 + * if self.mode == u"c": + * bufmode = PyBUF_C_CONTIGUOUS | PyBUF_ANY_CONTIGUOUS + * elif self.mode == u"fortran": # <<<<<<<<<<<<<< + * bufmode = PyBUF_F_CONTIGUOUS | PyBUF_ANY_CONTIGUOUS + * if not (flags & bufmode): +*/ + } + __pyx_L4:; + + /* "View.MemoryView":188 + * elif self.mode == u"fortran": + * bufmode = PyBUF_F_CONTIGUOUS | PyBUF_ANY_CONTIGUOUS + * if not (flags & bufmode): # <<<<<<<<<<<<<< + * raise ValueError, "Can only create a buffer that is contiguous in memory." + * info.buf = self.data +*/ + __pyx_t_1 = (!((__pyx_v_flags & __pyx_v_bufmode) != 0)); + if (unlikely(__pyx_t_1)) { + + /* "View.MemoryView":189 + * bufmode = PyBUF_F_CONTIGUOUS | PyBUF_ANY_CONTIGUOUS + * if not (flags & bufmode): + * raise ValueError, "Can only create a buffer that is contiguous in memory." # <<<<<<<<<<<<<< + * info.buf = self.data + * info.len = self.len +*/ + __Pyx_Raise(((PyObject *)(((PyTypeObject*)PyExc_ValueError))), __pyx_mstate_global->__pyx_kp_u_Can_only_create_a_buffer_that_is, 0, 0); + __PYX_ERR(1, 189, __pyx_L1_error) + + /* "View.MemoryView":188 + * elif self.mode == u"fortran": + * bufmode = PyBUF_F_CONTIGUOUS | PyBUF_ANY_CONTIGUOUS + * if not (flags & bufmode): # <<<<<<<<<<<<<< + * raise ValueError, "Can only create a buffer that is contiguous in memory." + * info.buf = self.data +*/ + } + + /* "View.MemoryView":183 + * def __getbuffer__(self, Py_buffer *info, int flags): + * cdef int bufmode = -1 + * if flags & (PyBUF_C_CONTIGUOUS | PyBUF_F_CONTIGUOUS | PyBUF_ANY_CONTIGUOUS): # <<<<<<<<<<<<<< + * if self.mode == u"c": + * bufmode = PyBUF_C_CONTIGUOUS | PyBUF_ANY_CONTIGUOUS +*/ + } + + /* "View.MemoryView":190 + * if not (flags & bufmode): + * raise ValueError, "Can only create a buffer that is contiguous in memory." + * info.buf = self.data # <<<<<<<<<<<<<< + * info.len = self.len + * +*/ + __pyx_t_2 = __pyx_v_self->data; + __pyx_v_info->buf = __pyx_t_2; + + /* "View.MemoryView":191 + * raise ValueError, "Can only create a buffer that is contiguous in memory." + * info.buf = self.data + * info.len = self.len # <<<<<<<<<<<<<< + * + * if flags & PyBUF_STRIDES: +*/ + __pyx_t_3 = __pyx_v_self->len; + __pyx_v_info->len = __pyx_t_3; + + /* "View.MemoryView":193 + * info.len = self.len + * + * if flags & PyBUF_STRIDES: # <<<<<<<<<<<<<< + * info.ndim = self.ndim + * info.shape = self._shape +*/ + __pyx_t_1 = ((__pyx_v_flags & PyBUF_STRIDES) != 0); + if (__pyx_t_1) { + + /* "View.MemoryView":194 + * + * if flags & PyBUF_STRIDES: + * info.ndim = self.ndim # <<<<<<<<<<<<<< + * info.shape = self._shape + * info.strides = self._strides +*/ + __pyx_t_4 = __pyx_v_self->ndim; + __pyx_v_info->ndim = __pyx_t_4; + + /* "View.MemoryView":195 + * if flags & PyBUF_STRIDES: + * info.ndim = self.ndim + * info.shape = self._shape # <<<<<<<<<<<<<< + * info.strides = self._strides + * else: +*/ + __pyx_t_5 = __pyx_v_self->_shape; + __pyx_v_info->shape = __pyx_t_5; + + /* "View.MemoryView":196 + * info.ndim = self.ndim + * info.shape = self._shape + * info.strides = self._strides # <<<<<<<<<<<<<< + * else: + * info.ndim = 1 +*/ + __pyx_t_5 = __pyx_v_self->_strides; + __pyx_v_info->strides = __pyx_t_5; + + /* "View.MemoryView":193 + * info.len = self.len + * + * if flags & PyBUF_STRIDES: # <<<<<<<<<<<<<< + * info.ndim = self.ndim + * info.shape = self._shape +*/ + goto __pyx_L6; + } + + /* "View.MemoryView":198 + * info.strides = self._strides + * else: + * info.ndim = 1 # <<<<<<<<<<<<<< + * info.shape = &self.len if flags & PyBUF_ND else NULL + * info.strides = NULL +*/ + /*else*/ { + __pyx_v_info->ndim = 1; + + /* "View.MemoryView":199 + * else: + * info.ndim = 1 + * info.shape = &self.len if flags & PyBUF_ND else NULL # <<<<<<<<<<<<<< + * info.strides = NULL + * +*/ + __pyx_t_1 = ((__pyx_v_flags & PyBUF_ND) != 0); + if (__pyx_t_1) { + __pyx_t_5 = (&__pyx_v_self->len); + } else { + __pyx_t_5 = NULL; + } + __pyx_v_info->shape = __pyx_t_5; + + /* "View.MemoryView":200 + * info.ndim = 1 + * info.shape = &self.len if flags & PyBUF_ND else NULL + * info.strides = NULL # <<<<<<<<<<<<<< + * + * info.suboffsets = NULL +*/ + __pyx_v_info->strides = NULL; + } + __pyx_L6:; + + /* "View.MemoryView":202 + * info.strides = NULL + * + * info.suboffsets = NULL # <<<<<<<<<<<<<< + * info.itemsize = self.itemsize + * info.readonly = 0 +*/ + __pyx_v_info->suboffsets = NULL; + + /* "View.MemoryView":203 + * + * info.suboffsets = NULL + * info.itemsize = self.itemsize # <<<<<<<<<<<<<< + * info.readonly = 0 + * info.format = self.format if flags & PyBUF_FORMAT else NULL +*/ + __pyx_t_3 = __pyx_v_self->itemsize; + __pyx_v_info->itemsize = __pyx_t_3; + + /* "View.MemoryView":204 + * info.suboffsets = NULL + * info.itemsize = self.itemsize + * info.readonly = 0 # <<<<<<<<<<<<<< + * info.format = self.format if flags & PyBUF_FORMAT else NULL + * info.obj = self +*/ + __pyx_v_info->readonly = 0; + + /* "View.MemoryView":205 + * info.itemsize = self.itemsize + * info.readonly = 0 + * info.format = self.format if flags & PyBUF_FORMAT else NULL # <<<<<<<<<<<<<< + * info.obj = self + * +*/ + __pyx_t_1 = ((__pyx_v_flags & PyBUF_FORMAT) != 0); + if (__pyx_t_1) { + __pyx_t_2 = __pyx_v_self->format; + } else { + __pyx_t_2 = NULL; + } + __pyx_v_info->format = __pyx_t_2; + + /* "View.MemoryView":206 + * info.readonly = 0 + * info.format = self.format if flags & PyBUF_FORMAT else NULL + * info.obj = self # <<<<<<<<<<<<<< + * + * def __dealloc__(array self): +*/ + __Pyx_INCREF((PyObject *)__pyx_v_self); + __Pyx_GIVEREF((PyObject *)__pyx_v_self); + __Pyx_GOTREF(__pyx_v_info->obj); + __Pyx_DECREF(__pyx_v_info->obj); + __pyx_v_info->obj = ((PyObject *)__pyx_v_self); + + /* "View.MemoryView":180 + * _allocate_buffer(self) + * + * @cname('getbuffer') # <<<<<<<<<<<<<< + * def __getbuffer__(self, Py_buffer *info, int flags): + * cdef int bufmode = -1 +*/ + + /* function exit code */ + __pyx_r = 0; + goto __pyx_L0; + __pyx_L1_error:; + __Pyx_AddTraceback("View.MemoryView.array.__getbuffer__", __pyx_clineno, __pyx_lineno, __pyx_filename); + __pyx_r = -1; + if (__pyx_v_info->obj != NULL) { + __Pyx_GOTREF(__pyx_v_info->obj); + __Pyx_DECREF(__pyx_v_info->obj); __pyx_v_info->obj = 0; + } + goto __pyx_L2; + __pyx_L0:; + if (__pyx_v_info->obj == Py_None) { + __Pyx_GOTREF(__pyx_v_info->obj); + __Pyx_DECREF(__pyx_v_info->obj); __pyx_v_info->obj = 0; + } + __pyx_L2:; + __Pyx_RefNannyFinishContext(); + return __pyx_r; +} + +/* "View.MemoryView":208 + * info.obj = self + * + * def __dealloc__(array self): # <<<<<<<<<<<<<< + * if self.callback_free_data != NULL: + * self.callback_free_data(self.data) +*/ + +/* Python wrapper */ +static void __pyx_array___dealloc__(PyObject *__pyx_v_self); /*proto*/ +static void __pyx_array___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_array___pyx_pf_15View_dot_MemoryView_5array_4__dealloc__(((struct __pyx_array_obj *)__pyx_v_self)); + + /* function exit code */ + __Pyx_RefNannyFinishContext(); +} + +static void __pyx_array___pyx_pf_15View_dot_MemoryView_5array_4__dealloc__(struct __pyx_array_obj *__pyx_v_self) { + int __pyx_t_1; + int __pyx_t_2; + + /* "View.MemoryView":209 + * + * def __dealloc__(array self): + * if self.callback_free_data != NULL: # <<<<<<<<<<<<<< + * self.callback_free_data(self.data) + * elif self.free_data and self.data is not NULL: +*/ + __pyx_t_1 = (__pyx_v_self->callback_free_data != NULL); + if (__pyx_t_1) { + + /* "View.MemoryView":210 + * def __dealloc__(array self): + * if self.callback_free_data != NULL: + * self.callback_free_data(self.data) # <<<<<<<<<<<<<< + * elif self.free_data and self.data is not NULL: + * if self.dtype_is_object: +*/ + __pyx_v_self->callback_free_data(__pyx_v_self->data); + + /* "View.MemoryView":209 + * + * def __dealloc__(array self): + * if self.callback_free_data != NULL: # <<<<<<<<<<<<<< + * self.callback_free_data(self.data) + * elif self.free_data and self.data is not NULL: +*/ + goto __pyx_L3; + } + + /* "View.MemoryView":211 + * if self.callback_free_data != NULL: + * self.callback_free_data(self.data) + * elif self.free_data and self.data is not NULL: # <<<<<<<<<<<<<< + * if self.dtype_is_object: + * refcount_objects_in_slice(self.data, self._shape, self._strides, self.ndim, inc=False) +*/ + if (__pyx_v_self->free_data) { + } else { + __pyx_t_1 = __pyx_v_self->free_data; + goto __pyx_L4_bool_binop_done; + } + __pyx_t_2 = (__pyx_v_self->data != NULL); + __pyx_t_1 = __pyx_t_2; + __pyx_L4_bool_binop_done:; + if (__pyx_t_1) { + + /* "View.MemoryView":212 + * self.callback_free_data(self.data) + * elif self.free_data and self.data is not NULL: + * if self.dtype_is_object: # <<<<<<<<<<<<<< + * refcount_objects_in_slice(self.data, self._shape, self._strides, self.ndim, inc=False) + * free(self.data) +*/ + if (__pyx_v_self->dtype_is_object) { + + /* "View.MemoryView":213 + * elif self.free_data and self.data is not NULL: + * if self.dtype_is_object: + * refcount_objects_in_slice(self.data, self._shape, self._strides, self.ndim, inc=False) # <<<<<<<<<<<<<< + * free(self.data) + * PyObject_Free(self._shape) +*/ + __pyx_memoryview_refcount_objects_in_slice(__pyx_v_self->data, __pyx_v_self->_shape, __pyx_v_self->_strides, __pyx_v_self->ndim, 0); + + /* "View.MemoryView":212 + * self.callback_free_data(self.data) + * elif self.free_data and self.data is not NULL: + * if self.dtype_is_object: # <<<<<<<<<<<<<< + * refcount_objects_in_slice(self.data, self._shape, self._strides, self.ndim, inc=False) + * free(self.data) +*/ + } + + /* "View.MemoryView":214 + * if self.dtype_is_object: + * refcount_objects_in_slice(self.data, self._shape, self._strides, self.ndim, inc=False) + * free(self.data) # <<<<<<<<<<<<<< + * PyObject_Free(self._shape) + * +*/ + free(__pyx_v_self->data); + + /* "View.MemoryView":211 + * if self.callback_free_data != NULL: + * self.callback_free_data(self.data) + * elif self.free_data and self.data is not NULL: # <<<<<<<<<<<<<< + * if self.dtype_is_object: + * refcount_objects_in_slice(self.data, self._shape, self._strides, self.ndim, inc=False) +*/ + } + __pyx_L3:; + + /* "View.MemoryView":215 + * refcount_objects_in_slice(self.data, self._shape, self._strides, self.ndim, inc=False) + * free(self.data) + * PyObject_Free(self._shape) # <<<<<<<<<<<<<< + * + * @property +*/ + PyObject_Free(__pyx_v_self->_shape); + + /* "View.MemoryView":208 + * info.obj = self + * + * def __dealloc__(array self): # <<<<<<<<<<<<<< + * if self.callback_free_data != NULL: + * self.callback_free_data(self.data) +*/ + + /* function exit code */ +} + +/* "View.MemoryView":217 + * PyObject_Free(self._shape) + * + * @property # <<<<<<<<<<<<<< + * def memview(self): + * return self.get_memview() +*/ + +/* Python wrapper */ +static PyObject *__pyx_pw_15View_dot_MemoryView_5array_7memview_1__get__(PyObject *__pyx_v_self); /*proto*/ +static PyObject *__pyx_pw_15View_dot_MemoryView_5array_7memview_1__get__(PyObject *__pyx_v_self) { + CYTHON_UNUSED PyObject *const *__pyx_kwvalues; + PyObject *__pyx_r = 0; + __Pyx_RefNannyDeclarations + __Pyx_RefNannySetupContext("__get__ (wrapper)", 0); + __pyx_kwvalues = __Pyx_KwValues_VARARGS(__pyx_args, __pyx_nargs); + __pyx_r = __pyx_pf_15View_dot_MemoryView_5array_7memview___get__(((struct __pyx_array_obj *)__pyx_v_self)); + + /* function exit code */ + __Pyx_RefNannyFinishContext(); + return __pyx_r; +} + +static PyObject *__pyx_pf_15View_dot_MemoryView_5array_7memview___get__(struct __pyx_array_obj *__pyx_v_self) { + PyObject *__pyx_r = NULL; + __Pyx_RefNannyDeclarations + PyObject *__pyx_t_1 = NULL; + int __pyx_lineno = 0; + const char *__pyx_filename = NULL; + int __pyx_clineno = 0; + __Pyx_RefNannySetupContext("__get__", 0); + + /* "View.MemoryView":219 + * @property + * def memview(self): + * return self.get_memview() # <<<<<<<<<<<<<< + * + * @cname('get_memview') +*/ + __Pyx_XDECREF(__pyx_r); + __pyx_t_1 = ((struct __pyx_vtabstruct_array *)__pyx_v_self->__pyx_vtab)->get_memview(__pyx_v_self); if (unlikely(!__pyx_t_1)) __PYX_ERR(1, 219, __pyx_L1_error) + __Pyx_GOTREF(__pyx_t_1); + __pyx_r = __pyx_t_1; + __pyx_t_1 = 0; + goto __pyx_L0; + + /* "View.MemoryView":217 + * PyObject_Free(self._shape) + * + * @property # <<<<<<<<<<<<<< + * def memview(self): + * return self.get_memview() +*/ + + /* function exit code */ + __pyx_L1_error:; + __Pyx_XDECREF(__pyx_t_1); + __Pyx_AddTraceback("View.MemoryView.array.memview.__get__", __pyx_clineno, __pyx_lineno, __pyx_filename); + __pyx_r = NULL; + __pyx_L0:; + __Pyx_XGIVEREF(__pyx_r); + __Pyx_RefNannyFinishContext(); + return __pyx_r; +} + +/* "View.MemoryView":221 + * return self.get_memview() + * + * @cname('get_memview') # <<<<<<<<<<<<<< + * cdef get_memview(self): + * flags = PyBUF_ANY_CONTIGUOUS|PyBUF_FORMAT|PyBUF_WRITABLE +*/ + +static PyObject *__pyx_array_get_memview(struct __pyx_array_obj *__pyx_v_self) { + int __pyx_v_flags; + PyObject *__pyx_r = NULL; + __Pyx_RefNannyDeclarations + PyObject *__pyx_t_1 = NULL; + PyObject *__pyx_t_2 = NULL; + PyObject *__pyx_t_3 = NULL; + PyObject *__pyx_t_4 = NULL; + size_t __pyx_t_5; + int __pyx_lineno = 0; + const char *__pyx_filename = NULL; + int __pyx_clineno = 0; + __Pyx_RefNannySetupContext("get_memview", 0); + + /* "View.MemoryView":223 + * @cname('get_memview') + * cdef get_memview(self): + * flags = PyBUF_ANY_CONTIGUOUS|PyBUF_FORMAT|PyBUF_WRITABLE # <<<<<<<<<<<<<< + * return memoryview(self, flags, self.dtype_is_object) + * +*/ + __pyx_v_flags = ((PyBUF_ANY_CONTIGUOUS | PyBUF_FORMAT) | PyBUF_WRITABLE); + + /* "View.MemoryView":224 + * cdef get_memview(self): + * flags = PyBUF_ANY_CONTIGUOUS|PyBUF_FORMAT|PyBUF_WRITABLE + * return memoryview(self, flags, self.dtype_is_object) # <<<<<<<<<<<<<< + * + * def __len__(self): +*/ + __Pyx_XDECREF(__pyx_r); + __pyx_t_2 = NULL; + __pyx_t_3 = __Pyx_PyLong_From_int(__pyx_v_flags); if (unlikely(!__pyx_t_3)) __PYX_ERR(1, 224, __pyx_L1_error) + __Pyx_GOTREF(__pyx_t_3); + __pyx_t_4 = __Pyx_PyBool_FromLong(__pyx_v_self->dtype_is_object); if (unlikely(!__pyx_t_4)) __PYX_ERR(1, 224, __pyx_L1_error) + __Pyx_GOTREF(__pyx_t_4); + __pyx_t_5 = 1; + { + PyObject *__pyx_callargs[4] = {__pyx_t_2, ((PyObject *)__pyx_v_self), __pyx_t_3, __pyx_t_4}; + __pyx_t_1 = __Pyx_PyObject_FastCall((PyObject*)__pyx_mstate_global->__pyx_memoryview_type, __pyx_callargs+__pyx_t_5, (4-__pyx_t_5) | (__pyx_t_5*__Pyx_PY_VECTORCALL_ARGUMENTS_OFFSET)); + __Pyx_XDECREF(__pyx_t_2); __pyx_t_2 = 0; + __Pyx_DECREF(__pyx_t_3); __pyx_t_3 = 0; + __Pyx_DECREF(__pyx_t_4); __pyx_t_4 = 0; + if (unlikely(!__pyx_t_1)) __PYX_ERR(1, 224, __pyx_L1_error) + __Pyx_GOTREF((PyObject *)__pyx_t_1); + } + __pyx_r = ((PyObject *)__pyx_t_1); + __pyx_t_1 = 0; + goto __pyx_L0; + + /* "View.MemoryView":221 + * return self.get_memview() + * + * @cname('get_memview') # <<<<<<<<<<<<<< + * cdef get_memview(self): + * flags = PyBUF_ANY_CONTIGUOUS|PyBUF_FORMAT|PyBUF_WRITABLE +*/ + + /* function exit code */ + __pyx_L1_error:; + __Pyx_XDECREF(__pyx_t_1); + __Pyx_XDECREF(__pyx_t_2); + __Pyx_XDECREF(__pyx_t_3); + __Pyx_XDECREF(__pyx_t_4); + __Pyx_AddTraceback("View.MemoryView.array.get_memview", __pyx_clineno, __pyx_lineno, __pyx_filename); + __pyx_r = 0; + __pyx_L0:; + __Pyx_XGIVEREF(__pyx_r); + __Pyx_RefNannyFinishContext(); + return __pyx_r; +} + +/* "View.MemoryView":226 + * return memoryview(self, flags, self.dtype_is_object) + * + * def __len__(self): # <<<<<<<<<<<<<< + * return self._shape[0] + * +*/ + +/* Python wrapper */ +static Py_ssize_t __pyx_array___len__(PyObject *__pyx_v_self); /*proto*/ +static Py_ssize_t __pyx_array___len__(PyObject *__pyx_v_self) { + CYTHON_UNUSED PyObject *const *__pyx_kwvalues; + Py_ssize_t __pyx_r; + __Pyx_RefNannyDeclarations + __Pyx_RefNannySetupContext("__len__ (wrapper)", 0); + __pyx_kwvalues = __Pyx_KwValues_VARARGS(__pyx_args, __pyx_nargs); + __pyx_r = __pyx_array___pyx_pf_15View_dot_MemoryView_5array_6__len__(((struct __pyx_array_obj *)__pyx_v_self)); + + /* function exit code */ + __Pyx_RefNannyFinishContext(); + return __pyx_r; +} + +static Py_ssize_t __pyx_array___pyx_pf_15View_dot_MemoryView_5array_6__len__(struct __pyx_array_obj *__pyx_v_self) { + Py_ssize_t __pyx_r; + + /* "View.MemoryView":227 + * + * def __len__(self): + * return self._shape[0] # <<<<<<<<<<<<<< + * + * def __getattr__(self, attr): +*/ + __pyx_r = (__pyx_v_self->_shape[0]); + goto __pyx_L0; + + /* "View.MemoryView":226 + * return memoryview(self, flags, self.dtype_is_object) + * + * def __len__(self): # <<<<<<<<<<<<<< + * return self._shape[0] + * +*/ + + /* function exit code */ + __pyx_L0:; + return __pyx_r; +} + +/* "View.MemoryView":229 + * return self._shape[0] + * + * def __getattr__(self, attr): # <<<<<<<<<<<<<< + * return getattr(self.memview, attr) + * +*/ + +/* Python wrapper */ +static PyObject *__pyx_array___getattr__(PyObject *__pyx_v_self, PyObject *__pyx_v_attr); /*proto*/ +static PyObject *__pyx_array___getattr__(PyObject *__pyx_v_self, PyObject *__pyx_v_attr) { + CYTHON_UNUSED PyObject *const *__pyx_kwvalues; + PyObject *__pyx_r = 0; + __Pyx_RefNannyDeclarations + __Pyx_RefNannySetupContext("__getattr__ (wrapper)", 0); + __pyx_kwvalues = __Pyx_KwValues_VARARGS(__pyx_args, __pyx_nargs); + __pyx_r = __pyx_array___pyx_pf_15View_dot_MemoryView_5array_8__getattr__(((struct __pyx_array_obj *)__pyx_v_self), ((PyObject *)__pyx_v_attr)); + + /* function exit code */ + __Pyx_RefNannyFinishContext(); + return __pyx_r; +} + +static PyObject *__pyx_array___pyx_pf_15View_dot_MemoryView_5array_8__getattr__(struct __pyx_array_obj *__pyx_v_self, PyObject *__pyx_v_attr) { + PyObject *__pyx_r = NULL; + __Pyx_RefNannyDeclarations + PyObject *__pyx_t_1 = NULL; + PyObject *__pyx_t_2 = NULL; + int __pyx_lineno = 0; + const char *__pyx_filename = NULL; + int __pyx_clineno = 0; + __Pyx_RefNannySetupContext("__getattr__", 0); + + /* "View.MemoryView":230 + * + * def __getattr__(self, attr): + * return getattr(self.memview, attr) # <<<<<<<<<<<<<< + * + * def __getitem__(self, item): +*/ + __Pyx_XDECREF(__pyx_r); + __pyx_t_1 = __Pyx_PyObject_GetAttrStr(((PyObject *)__pyx_v_self), __pyx_mstate_global->__pyx_n_u_memview); if (unlikely(!__pyx_t_1)) __PYX_ERR(1, 230, __pyx_L1_error) + __Pyx_GOTREF(__pyx_t_1); + __pyx_t_2 = __Pyx_GetAttr(__pyx_t_1, __pyx_v_attr); if (unlikely(!__pyx_t_2)) __PYX_ERR(1, 230, __pyx_L1_error) + __Pyx_GOTREF(__pyx_t_2); + __Pyx_DECREF(__pyx_t_1); __pyx_t_1 = 0; + __pyx_r = __pyx_t_2; + __pyx_t_2 = 0; + goto __pyx_L0; + + /* "View.MemoryView":229 + * return self._shape[0] + * + * def __getattr__(self, attr): # <<<<<<<<<<<<<< + * return getattr(self.memview, attr) + * +*/ + + /* function exit code */ + __pyx_L1_error:; + __Pyx_XDECREF(__pyx_t_1); + __Pyx_XDECREF(__pyx_t_2); + __Pyx_AddTraceback("View.MemoryView.array.__getattr__", __pyx_clineno, __pyx_lineno, __pyx_filename); + __pyx_r = NULL; + __pyx_L0:; + __Pyx_XGIVEREF(__pyx_r); + __Pyx_RefNannyFinishContext(); + return __pyx_r; +} + +/* "View.MemoryView":232 + * return getattr(self.memview, attr) + * + * def __getitem__(self, item): # <<<<<<<<<<<<<< + * return self.memview[item] + * +*/ + +/* Python wrapper */ +static PyObject *__pyx_array___getitem__(PyObject *__pyx_v_self, PyObject *__pyx_v_item); /*proto*/ +static PyObject *__pyx_array___getitem__(PyObject *__pyx_v_self, PyObject *__pyx_v_item) { + CYTHON_UNUSED PyObject *const *__pyx_kwvalues; + PyObject *__pyx_r = 0; + __Pyx_RefNannyDeclarations + __Pyx_RefNannySetupContext("__getitem__ (wrapper)", 0); + __pyx_kwvalues = __Pyx_KwValues_VARARGS(__pyx_args, __pyx_nargs); + __pyx_r = __pyx_array___pyx_pf_15View_dot_MemoryView_5array_10__getitem__(((struct __pyx_array_obj *)__pyx_v_self), ((PyObject *)__pyx_v_item)); + + /* function exit code */ + __Pyx_RefNannyFinishContext(); + return __pyx_r; +} + +static PyObject *__pyx_array___pyx_pf_15View_dot_MemoryView_5array_10__getitem__(struct __pyx_array_obj *__pyx_v_self, PyObject *__pyx_v_item) { + PyObject *__pyx_r = NULL; + __Pyx_RefNannyDeclarations + PyObject *__pyx_t_1 = NULL; + PyObject *__pyx_t_2 = NULL; + int __pyx_lineno = 0; + const char *__pyx_filename = NULL; + int __pyx_clineno = 0; + __Pyx_RefNannySetupContext("__getitem__", 0); + + /* "View.MemoryView":233 + * + * def __getitem__(self, item): + * return self.memview[item] # <<<<<<<<<<<<<< + * + * def __setitem__(self, item, value): +*/ + __Pyx_XDECREF(__pyx_r); + __pyx_t_1 = __Pyx_PyObject_GetAttrStr(((PyObject *)__pyx_v_self), __pyx_mstate_global->__pyx_n_u_memview); if (unlikely(!__pyx_t_1)) __PYX_ERR(1, 233, __pyx_L1_error) + __Pyx_GOTREF(__pyx_t_1); + __pyx_t_2 = __Pyx_PyObject_GetItem(__pyx_t_1, __pyx_v_item); if (unlikely(!__pyx_t_2)) __PYX_ERR(1, 233, __pyx_L1_error) + __Pyx_GOTREF(__pyx_t_2); + __Pyx_DECREF(__pyx_t_1); __pyx_t_1 = 0; + __pyx_r = __pyx_t_2; + __pyx_t_2 = 0; + goto __pyx_L0; + + /* "View.MemoryView":232 + * return getattr(self.memview, attr) + * + * def __getitem__(self, item): # <<<<<<<<<<<<<< + * return self.memview[item] + * +*/ + + /* function exit code */ + __pyx_L1_error:; + __Pyx_XDECREF(__pyx_t_1); + __Pyx_XDECREF(__pyx_t_2); + __Pyx_AddTraceback("View.MemoryView.array.__getitem__", __pyx_clineno, __pyx_lineno, __pyx_filename); + __pyx_r = NULL; + __pyx_L0:; + __Pyx_XGIVEREF(__pyx_r); + __Pyx_RefNannyFinishContext(); + return __pyx_r; +} + +/* "View.MemoryView":235 + * return self.memview[item] + * + * def __setitem__(self, item, value): # <<<<<<<<<<<<<< + * self.memview[item] = value + * +*/ + +/* Python wrapper */ +static int __pyx_array___setitem__(PyObject *__pyx_v_self, PyObject *__pyx_v_item, PyObject *__pyx_v_value); /*proto*/ +static int __pyx_array___setitem__(PyObject *__pyx_v_self, PyObject *__pyx_v_item, PyObject *__pyx_v_value) { + CYTHON_UNUSED PyObject *const *__pyx_kwvalues; + int __pyx_r; + __Pyx_RefNannyDeclarations + __Pyx_RefNannySetupContext("__setitem__ (wrapper)", 0); + __pyx_kwvalues = __Pyx_KwValues_VARARGS(__pyx_args, __pyx_nargs); + __pyx_r = __pyx_array___pyx_pf_15View_dot_MemoryView_5array_12__setitem__(((struct __pyx_array_obj *)__pyx_v_self), ((PyObject *)__pyx_v_item), ((PyObject *)__pyx_v_value)); + + /* function exit code */ + __Pyx_RefNannyFinishContext(); + return __pyx_r; +} + +static int __pyx_array___pyx_pf_15View_dot_MemoryView_5array_12__setitem__(struct __pyx_array_obj *__pyx_v_self, PyObject *__pyx_v_item, PyObject *__pyx_v_value) { + int __pyx_r; + __Pyx_RefNannyDeclarations + PyObject *__pyx_t_1 = NULL; + int __pyx_lineno = 0; + const char *__pyx_filename = NULL; + int __pyx_clineno = 0; + __Pyx_RefNannySetupContext("__setitem__", 0); + + /* "View.MemoryView":236 + * + * def __setitem__(self, item, value): + * self.memview[item] = value # <<<<<<<<<<<<<< + * + * +*/ + __pyx_t_1 = __Pyx_PyObject_GetAttrStr(((PyObject *)__pyx_v_self), __pyx_mstate_global->__pyx_n_u_memview); if (unlikely(!__pyx_t_1)) __PYX_ERR(1, 236, __pyx_L1_error) + __Pyx_GOTREF(__pyx_t_1); + if (unlikely((PyObject_SetItem(__pyx_t_1, __pyx_v_item, __pyx_v_value) < 0))) __PYX_ERR(1, 236, __pyx_L1_error) + __Pyx_DECREF(__pyx_t_1); __pyx_t_1 = 0; + + /* "View.MemoryView":235 + * return self.memview[item] + * + * def __setitem__(self, item, value): # <<<<<<<<<<<<<< + * self.memview[item] = value + * +*/ + + /* function exit code */ + __pyx_r = 0; + goto __pyx_L0; + __pyx_L1_error:; + __Pyx_XDECREF(__pyx_t_1); + __Pyx_AddTraceback("View.MemoryView.array.__setitem__", __pyx_clineno, __pyx_lineno, __pyx_filename); + __pyx_r = -1; + __pyx_L0:; + __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___pyx_array_1__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*/ +static PyObject *__pyx_pw___pyx_array_1__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___pyx_array___reduce_cython__(((struct __pyx_array_obj *)__pyx_v_self)); + + /* function exit code */ + __Pyx_RefNannyFinishContext(); + return __pyx_r; +} + +static PyObject *__pyx_pf___pyx_array___reduce_cython__(CYTHON_UNUSED struct __pyx_array_obj *__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("View.MemoryView.array.__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___pyx_array_3__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*/ +static PyObject *__pyx_pw___pyx_array_3__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("View.MemoryView.array.__setstate_cython__", __pyx_clineno, __pyx_lineno, __pyx_filename); + __Pyx_RefNannyFinishContext(); + return NULL; + __pyx_L4_argument_unpacking_done:; + __pyx_r = __pyx_pf___pyx_array_2__setstate_cython__(((struct __pyx_array_obj *)__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___pyx_array_2__setstate_cython__(CYTHON_UNUSED struct __pyx_array_obj *__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("View.MemoryView.array.__setstate_cython__", __pyx_clineno, __pyx_lineno, __pyx_filename); + __pyx_r = NULL; + __Pyx_XGIVEREF(__pyx_r); + __Pyx_RefNannyFinishContext(); + return __pyx_r; +} + +/* "View.MemoryView":245 + * pass + * + * @cname("__pyx_array_allocate_buffer") # <<<<<<<<<<<<<< + * cdef int _allocate_buffer(array self) except -1: + * +*/ + +static int __pyx_array_allocate_buffer(struct __pyx_array_obj *__pyx_v_self) { + Py_ssize_t __pyx_v_i; + PyObject **__pyx_v_p; + int __pyx_r; + int __pyx_t_1; + Py_ssize_t __pyx_t_2; + Py_ssize_t __pyx_t_3; + Py_ssize_t __pyx_t_4; + int __pyx_lineno = 0; + const char *__pyx_filename = NULL; + int __pyx_clineno = 0; + + /* "View.MemoryView":252 + * cdef PyObject **p + * + * self.free_data = True # <<<<<<<<<<<<<< + * self.data = malloc(self.len) + * if not self.data: +*/ + __pyx_v_self->free_data = 1; + + /* "View.MemoryView":253 + * + * self.free_data = True + * self.data = malloc(self.len) # <<<<<<<<<<<<<< + * if not self.data: + * raise MemoryError, "unable to allocate array data." +*/ + __pyx_v_self->data = ((char *)malloc(__pyx_v_self->len)); + + /* "View.MemoryView":254 + * self.free_data = True + * self.data = malloc(self.len) + * if not self.data: # <<<<<<<<<<<<<< + * raise MemoryError, "unable to allocate array data." + * +*/ + __pyx_t_1 = (!(__pyx_v_self->data != 0)); + if (unlikely(__pyx_t_1)) { + + /* "View.MemoryView":255 + * self.data = malloc(self.len) + * if not self.data: + * raise MemoryError, "unable to allocate array data." # <<<<<<<<<<<<<< + * + * if self.dtype_is_object: +*/ + __Pyx_Raise(((PyObject *)(((PyTypeObject*)PyExc_MemoryError))), __pyx_mstate_global->__pyx_kp_u_unable_to_allocate_array_data, 0, 0); + __PYX_ERR(1, 255, __pyx_L1_error) + + /* "View.MemoryView":254 + * self.free_data = True + * self.data = malloc(self.len) + * if not self.data: # <<<<<<<<<<<<<< + * raise MemoryError, "unable to allocate array data." + * +*/ + } + + /* "View.MemoryView":257 + * raise MemoryError, "unable to allocate array data." + * + * if self.dtype_is_object: # <<<<<<<<<<<<<< + * p = self.data + * for i in range(self.len // self.itemsize): +*/ + if (__pyx_v_self->dtype_is_object) { + + /* "View.MemoryView":258 + * + * if self.dtype_is_object: + * p = self.data # <<<<<<<<<<<<<< + * for i in range(self.len // self.itemsize): + * p[i] = Py_None +*/ + __pyx_v_p = ((PyObject **)__pyx_v_self->data); + + /* "View.MemoryView":259 + * if self.dtype_is_object: + * p = self.data + * for i in range(self.len // self.itemsize): # <<<<<<<<<<<<<< + * p[i] = Py_None + * Py_INCREF(Py_None) +*/ + if (unlikely(__pyx_v_self->itemsize == 0)) { + PyErr_SetString(PyExc_ZeroDivisionError, "integer division or modulo by zero"); + __PYX_ERR(1, 259, __pyx_L1_error) + } + else if (sizeof(Py_ssize_t) == sizeof(long) && (!(((Py_ssize_t)-1) > 0)) && unlikely(__pyx_v_self->itemsize == (Py_ssize_t)-1) && unlikely(__Pyx_UNARY_NEG_WOULD_OVERFLOW(__pyx_v_self->len))) { + PyErr_SetString(PyExc_OverflowError, "value too large to perform division"); + __PYX_ERR(1, 259, __pyx_L1_error) + } + __pyx_t_2 = __Pyx_div_Py_ssize_t(__pyx_v_self->len, __pyx_v_self->itemsize, 0); + __pyx_t_3 = __pyx_t_2; + for (__pyx_t_4 = 0; __pyx_t_4 < __pyx_t_3; __pyx_t_4+=1) { + __pyx_v_i = __pyx_t_4; + + /* "View.MemoryView":260 + * p = self.data + * for i in range(self.len // self.itemsize): + * p[i] = Py_None # <<<<<<<<<<<<<< + * Py_INCREF(Py_None) + * return 0 +*/ + (__pyx_v_p[__pyx_v_i]) = Py_None; + + /* "View.MemoryView":261 + * for i in range(self.len // self.itemsize): + * p[i] = Py_None + * Py_INCREF(Py_None) # <<<<<<<<<<<<<< + * return 0 + * +*/ + Py_INCREF(Py_None); + } + + /* "View.MemoryView":257 + * raise MemoryError, "unable to allocate array data." + * + * if self.dtype_is_object: # <<<<<<<<<<<<<< + * p = self.data + * for i in range(self.len // self.itemsize): +*/ + } + + /* "View.MemoryView":262 + * p[i] = Py_None + * Py_INCREF(Py_None) + * return 0 # <<<<<<<<<<<<<< + * + * +*/ + __pyx_r = 0; + goto __pyx_L0; + + /* "View.MemoryView":245 + * pass + * + * @cname("__pyx_array_allocate_buffer") # <<<<<<<<<<<<<< + * cdef int _allocate_buffer(array self) except -1: + * +*/ + + /* function exit code */ + __pyx_L1_error:; + __Pyx_AddTraceback("View.MemoryView._allocate_buffer", __pyx_clineno, __pyx_lineno, __pyx_filename); + __pyx_r = -1; + __pyx_L0:; + return __pyx_r; +} + +/* "View.MemoryView":265 + * + * + * @cname("__pyx_array_new") # <<<<<<<<<<<<<< + * cdef array array_cwrapper(tuple shape, Py_ssize_t itemsize, char *format, const char *c_mode, char *buf): + * cdef array result +*/ + +static struct __pyx_array_obj *__pyx_array_new(PyObject *__pyx_v_shape, Py_ssize_t __pyx_v_itemsize, char *__pyx_v_format, char const *__pyx_v_c_mode, char *__pyx_v_buf) { + struct __pyx_array_obj *__pyx_v_result = 0; + PyObject *__pyx_v_mode = 0; + struct __pyx_array_obj *__pyx_r = NULL; + __Pyx_RefNannyDeclarations + PyObject *__pyx_t_1 = NULL; + int __pyx_t_2; + PyObject *__pyx_t_3 = NULL; + PyObject *__pyx_t_4 = NULL; + int __pyx_lineno = 0; + const char *__pyx_filename = NULL; + int __pyx_clineno = 0; + __Pyx_RefNannySetupContext("array_cwrapper", 0); + + /* "View.MemoryView":268 + * cdef array array_cwrapper(tuple shape, Py_ssize_t itemsize, char *format, const char *c_mode, char *buf): + * cdef array result + * cdef str mode = "fortran" if c_mode[0] == b'f' else "c" # this often comes from a constant C string. # <<<<<<<<<<<<<< + * + * if buf is NULL: +*/ + __pyx_t_2 = ((__pyx_v_c_mode[0]) == 'f'); + if (__pyx_t_2) { + __Pyx_INCREF(__pyx_mstate_global->__pyx_n_u_fortran); + __pyx_t_1 = __pyx_mstate_global->__pyx_n_u_fortran; + } else { + __Pyx_INCREF(__pyx_mstate_global->__pyx_n_u_c); + __pyx_t_1 = __pyx_mstate_global->__pyx_n_u_c; + } + __pyx_v_mode = ((PyObject*)__pyx_t_1); + __pyx_t_1 = 0; + + /* "View.MemoryView":270 + * cdef str mode = "fortran" if c_mode[0] == b'f' else "c" # this often comes from a constant C string. + * + * if buf is NULL: # <<<<<<<<<<<<<< + * result = array.__new__(array, shape, itemsize, format, mode) + * else: +*/ + __pyx_t_2 = (__pyx_v_buf == NULL); + if (__pyx_t_2) { + + /* "View.MemoryView":271 + * + * if buf is NULL: + * result = array.__new__(array, shape, itemsize, format, mode) # <<<<<<<<<<<<<< + * else: + * result = array.__new__(array, shape, itemsize, format, mode, allocate_buffer=False) +*/ + __pyx_t_1 = PyLong_FromSsize_t(__pyx_v_itemsize); if (unlikely(!__pyx_t_1)) __PYX_ERR(1, 271, __pyx_L1_error) + __Pyx_GOTREF(__pyx_t_1); + __pyx_t_3 = __Pyx_PyBytes_FromString(__pyx_v_format); if (unlikely(!__pyx_t_3)) __PYX_ERR(1, 271, __pyx_L1_error) + __Pyx_GOTREF(__pyx_t_3); + __pyx_t_4 = PyTuple_New(4); if (unlikely(!__pyx_t_4)) __PYX_ERR(1, 271, __pyx_L1_error) + __Pyx_GOTREF(__pyx_t_4); + __Pyx_INCREF(__pyx_v_shape); + __Pyx_GIVEREF(__pyx_v_shape); + if (__Pyx_PyTuple_SET_ITEM(__pyx_t_4, 0, __pyx_v_shape) != (0)) __PYX_ERR(1, 271, __pyx_L1_error); + __Pyx_GIVEREF(__pyx_t_1); + if (__Pyx_PyTuple_SET_ITEM(__pyx_t_4, 1, __pyx_t_1) != (0)) __PYX_ERR(1, 271, __pyx_L1_error); + __Pyx_GIVEREF(__pyx_t_3); + if (__Pyx_PyTuple_SET_ITEM(__pyx_t_4, 2, __pyx_t_3) != (0)) __PYX_ERR(1, 271, __pyx_L1_error); + __Pyx_INCREF(__pyx_v_mode); + __Pyx_GIVEREF(__pyx_v_mode); + if (__Pyx_PyTuple_SET_ITEM(__pyx_t_4, 3, __pyx_v_mode) != (0)) __PYX_ERR(1, 271, __pyx_L1_error); + __pyx_t_1 = 0; + __pyx_t_3 = 0; + __pyx_t_3 = ((PyObject *)__pyx_tp_new_array(((PyTypeObject *)__pyx_mstate_global->__pyx_array_type), __pyx_t_4, NULL)); if (unlikely(!__pyx_t_3)) __PYX_ERR(1, 271, __pyx_L1_error) + __Pyx_GOTREF((PyObject *)__pyx_t_3); + __Pyx_DECREF(__pyx_t_4); __pyx_t_4 = 0; + __pyx_v_result = ((struct __pyx_array_obj *)__pyx_t_3); + __pyx_t_3 = 0; + + /* "View.MemoryView":270 + * cdef str mode = "fortran" if c_mode[0] == b'f' else "c" # this often comes from a constant C string. + * + * if buf is NULL: # <<<<<<<<<<<<<< + * result = array.__new__(array, shape, itemsize, format, mode) + * else: +*/ + goto __pyx_L3; + } + + /* "View.MemoryView":273 + * result = array.__new__(array, shape, itemsize, format, mode) + * else: + * result = array.__new__(array, shape, itemsize, format, mode, allocate_buffer=False) # <<<<<<<<<<<<<< + * result.data = buf + * +*/ + /*else*/ { + __pyx_t_3 = PyLong_FromSsize_t(__pyx_v_itemsize); if (unlikely(!__pyx_t_3)) __PYX_ERR(1, 273, __pyx_L1_error) + __Pyx_GOTREF(__pyx_t_3); + __pyx_t_4 = __Pyx_PyBytes_FromString(__pyx_v_format); if (unlikely(!__pyx_t_4)) __PYX_ERR(1, 273, __pyx_L1_error) + __Pyx_GOTREF(__pyx_t_4); + __pyx_t_1 = PyTuple_New(4); if (unlikely(!__pyx_t_1)) __PYX_ERR(1, 273, __pyx_L1_error) + __Pyx_GOTREF(__pyx_t_1); + __Pyx_INCREF(__pyx_v_shape); + __Pyx_GIVEREF(__pyx_v_shape); + if (__Pyx_PyTuple_SET_ITEM(__pyx_t_1, 0, __pyx_v_shape) != (0)) __PYX_ERR(1, 273, __pyx_L1_error); + __Pyx_GIVEREF(__pyx_t_3); + if (__Pyx_PyTuple_SET_ITEM(__pyx_t_1, 1, __pyx_t_3) != (0)) __PYX_ERR(1, 273, __pyx_L1_error); + __Pyx_GIVEREF(__pyx_t_4); + if (__Pyx_PyTuple_SET_ITEM(__pyx_t_1, 2, __pyx_t_4) != (0)) __PYX_ERR(1, 273, __pyx_L1_error); + __Pyx_INCREF(__pyx_v_mode); + __Pyx_GIVEREF(__pyx_v_mode); + if (__Pyx_PyTuple_SET_ITEM(__pyx_t_1, 3, __pyx_v_mode) != (0)) __PYX_ERR(1, 273, __pyx_L1_error); + __pyx_t_3 = 0; + __pyx_t_4 = 0; + __pyx_t_4 = __Pyx_PyDict_NewPresized(1); if (unlikely(!__pyx_t_4)) __PYX_ERR(1, 273, __pyx_L1_error) + __Pyx_GOTREF(__pyx_t_4); + if (PyDict_SetItem(__pyx_t_4, __pyx_mstate_global->__pyx_n_u_allocate_buffer, Py_False) < (0)) __PYX_ERR(1, 273, __pyx_L1_error) + __pyx_t_3 = ((PyObject *)__pyx_tp_new_array(((PyTypeObject *)__pyx_mstate_global->__pyx_array_type), __pyx_t_1, __pyx_t_4)); if (unlikely(!__pyx_t_3)) __PYX_ERR(1, 273, __pyx_L1_error) + __Pyx_GOTREF((PyObject *)__pyx_t_3); + __Pyx_DECREF(__pyx_t_1); __pyx_t_1 = 0; + __Pyx_DECREF(__pyx_t_4); __pyx_t_4 = 0; + __pyx_v_result = ((struct __pyx_array_obj *)__pyx_t_3); + __pyx_t_3 = 0; + + /* "View.MemoryView":274 + * else: + * result = array.__new__(array, shape, itemsize, format, mode, allocate_buffer=False) + * result.data = buf # <<<<<<<<<<<<<< + * + * return result +*/ + __pyx_v_result->data = __pyx_v_buf; + } + __pyx_L3:; + + /* "View.MemoryView":276 + * result.data = buf + * + * return result # <<<<<<<<<<<<<< + * + * +*/ + __Pyx_XDECREF((PyObject *)__pyx_r); + __Pyx_INCREF((PyObject *)__pyx_v_result); + __pyx_r = __pyx_v_result; + goto __pyx_L0; + + /* "View.MemoryView":265 + * + * + * @cname("__pyx_array_new") # <<<<<<<<<<<<<< + * cdef array array_cwrapper(tuple shape, Py_ssize_t itemsize, char *format, const char *c_mode, char *buf): + * cdef array result +*/ + + /* function exit code */ + __pyx_L1_error:; + __Pyx_XDECREF(__pyx_t_1); + __Pyx_XDECREF(__pyx_t_3); + __Pyx_XDECREF(__pyx_t_4); + __Pyx_AddTraceback("View.MemoryView.array_cwrapper", __pyx_clineno, __pyx_lineno, __pyx_filename); + __pyx_r = 0; + __pyx_L0:; + __Pyx_XDECREF((PyObject *)__pyx_v_result); + __Pyx_XDECREF(__pyx_v_mode); + __Pyx_XGIVEREF((PyObject *)__pyx_r); + __Pyx_RefNannyFinishContext(); + return __pyx_r; +} + +/* "View.MemoryView":302 + * cdef class Enum(object): + * cdef object name + * def __init__(self, name): # <<<<<<<<<<<<<< + * self.name = name + * def __repr__(self): +*/ + +/* Python wrapper */ +static int __pyx_MemviewEnum___init__(PyObject *__pyx_v_self, PyObject *__pyx_args, PyObject *__pyx_kwds); /*proto*/ +static int __pyx_MemviewEnum___init__(PyObject *__pyx_v_self, PyObject *__pyx_args, PyObject *__pyx_kwds) { + PyObject *__pyx_v_name = 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_name,0}; + const Py_ssize_t __pyx_kwds_len = (__pyx_kwds) ? __Pyx_NumKwargs_VARARGS(__pyx_kwds) : 0; + if (unlikely(__pyx_kwds_len) < 0) __PYX_ERR(1, 302, __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(1, 302, __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(1, 302, __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(1, 302, __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(1, 302, __pyx_L3_error) + } + __pyx_v_name = values[0]; + } + goto __pyx_L6_skip; + __pyx_L5_argtuple_error:; + __Pyx_RaiseArgtupleInvalid("__init__", 1, 1, 1, __pyx_nargs); __PYX_ERR(1, 302, __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("View.MemoryView.Enum.__init__", __pyx_clineno, __pyx_lineno, __pyx_filename); + __Pyx_RefNannyFinishContext(); + return -1; + __pyx_L4_argument_unpacking_done:; + __pyx_r = __pyx_MemviewEnum___pyx_pf_15View_dot_MemoryView_4Enum___init__(((struct __pyx_MemviewEnum_obj *)__pyx_v_self), __pyx_v_name); + + /* 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_MemviewEnum___pyx_pf_15View_dot_MemoryView_4Enum___init__(struct __pyx_MemviewEnum_obj *__pyx_v_self, PyObject *__pyx_v_name) { + int __pyx_r; + __Pyx_RefNannyDeclarations + __Pyx_RefNannySetupContext("__init__", 0); + + /* "View.MemoryView":303 + * cdef object name + * def __init__(self, name): + * self.name = name # <<<<<<<<<<<<<< + * def __repr__(self): + * return self.name +*/ + __Pyx_INCREF(__pyx_v_name); + __Pyx_GIVEREF(__pyx_v_name); + __Pyx_GOTREF(__pyx_v_self->name); + __Pyx_DECREF(__pyx_v_self->name); + __pyx_v_self->name = __pyx_v_name; + + /* "View.MemoryView":302 + * cdef class Enum(object): + * cdef object name + * def __init__(self, name): # <<<<<<<<<<<<<< + * self.name = name + * def __repr__(self): +*/ + + /* function exit code */ + __pyx_r = 0; + __Pyx_RefNannyFinishContext(); + return __pyx_r; +} + +/* "View.MemoryView":304 + * def __init__(self, name): + * self.name = name + * def __repr__(self): # <<<<<<<<<<<<<< + * return self.name + * +*/ + +/* Python wrapper */ +static PyObject *__pyx_MemviewEnum___repr__(PyObject *__pyx_v_self); /*proto*/ +static PyObject *__pyx_MemviewEnum___repr__(PyObject *__pyx_v_self) { + CYTHON_UNUSED PyObject *const *__pyx_kwvalues; + PyObject *__pyx_r = 0; + __Pyx_RefNannyDeclarations + __Pyx_RefNannySetupContext("__repr__ (wrapper)", 0); + __pyx_kwvalues = __Pyx_KwValues_VARARGS(__pyx_args, __pyx_nargs); + __pyx_r = __pyx_MemviewEnum___pyx_pf_15View_dot_MemoryView_4Enum_2__repr__(((struct __pyx_MemviewEnum_obj *)__pyx_v_self)); + + /* function exit code */ + __Pyx_RefNannyFinishContext(); + return __pyx_r; +} + +static PyObject *__pyx_MemviewEnum___pyx_pf_15View_dot_MemoryView_4Enum_2__repr__(struct __pyx_MemviewEnum_obj *__pyx_v_self) { + PyObject *__pyx_r = NULL; + __Pyx_RefNannyDeclarations + __Pyx_RefNannySetupContext("__repr__", 0); + + /* "View.MemoryView":305 + * self.name = name + * def __repr__(self): + * return self.name # <<<<<<<<<<<<<< + * + * cdef generic = Enum("") +*/ + __Pyx_XDECREF(__pyx_r); + __Pyx_INCREF(__pyx_v_self->name); + __pyx_r = __pyx_v_self->name; + goto __pyx_L0; + + /* "View.MemoryView":304 + * def __init__(self, name): + * self.name = name + * def __repr__(self): # <<<<<<<<<<<<<< + * return self.name + * +*/ + + /* function exit code */ + __pyx_L0:; + __Pyx_XGIVEREF(__pyx_r); + __Pyx_RefNannyFinishContext(); + return __pyx_r; +} + +/* "(tree fragment)":1 + * def __reduce_cython__(self): # <<<<<<<<<<<<<< + * cdef tuple state + * cdef object _dict +*/ + +/* Python wrapper */ +static PyObject *__pyx_pw___pyx_MemviewEnum_1__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*/ +static PyObject *__pyx_pw___pyx_MemviewEnum_1__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___pyx_MemviewEnum___reduce_cython__(((struct __pyx_MemviewEnum_obj *)__pyx_v_self)); + + /* function exit code */ + __Pyx_RefNannyFinishContext(); + return __pyx_r; +} + +static PyObject *__pyx_pf___pyx_MemviewEnum___reduce_cython__(struct __pyx_MemviewEnum_obj *__pyx_v_self) { + PyObject *__pyx_v_state = 0; + PyObject *__pyx_v__dict = 0; + int __pyx_v_use_setstate; + PyObject *__pyx_r = NULL; + __Pyx_RefNannyDeclarations + PyObject *__pyx_t_1 = NULL; + int __pyx_t_2; + int __pyx_t_3; + PyObject *__pyx_t_4 = NULL; + PyObject *__pyx_t_5 = NULL; + int __pyx_lineno = 0; + const char *__pyx_filename = NULL; + int __pyx_clineno = 0; + __Pyx_RefNannySetupContext("__reduce_cython__", 0); + + /* "(tree fragment)":5 + * cdef object _dict + * cdef bint use_setstate + * state = (self.name,) # <<<<<<<<<<<<<< + * _dict = getattr(self, '__dict__', None) + * if _dict is not None and _dict: +*/ + __pyx_t_1 = PyTuple_New(1); if (unlikely(!__pyx_t_1)) __PYX_ERR(1, 5, __pyx_L1_error) + __Pyx_GOTREF(__pyx_t_1); + __Pyx_INCREF(__pyx_v_self->name); + __Pyx_GIVEREF(__pyx_v_self->name); + if (__Pyx_PyTuple_SET_ITEM(__pyx_t_1, 0, __pyx_v_self->name) != (0)) __PYX_ERR(1, 5, __pyx_L1_error); + __pyx_v_state = ((PyObject*)__pyx_t_1); + __pyx_t_1 = 0; + + /* "(tree fragment)":6 + * cdef bint use_setstate + * state = (self.name,) + * _dict = getattr(self, '__dict__', None) # <<<<<<<<<<<<<< + * if _dict is not None and _dict: + * state += (_dict,) +*/ + __pyx_t_1 = __Pyx_GetAttr3(((PyObject *)__pyx_v_self), __pyx_mstate_global->__pyx_n_u_dict, Py_None); if (unlikely(!__pyx_t_1)) __PYX_ERR(1, 6, __pyx_L1_error) + __Pyx_GOTREF(__pyx_t_1); + __pyx_v__dict = __pyx_t_1; + __pyx_t_1 = 0; + + /* "(tree fragment)":7 + * state = (self.name,) + * _dict = getattr(self, '__dict__', None) + * if _dict is not None and _dict: # <<<<<<<<<<<<<< + * state += (_dict,) + * use_setstate = True +*/ + __pyx_t_3 = (__pyx_v__dict != Py_None); + if (__pyx_t_3) { + } else { + __pyx_t_2 = __pyx_t_3; + goto __pyx_L4_bool_binop_done; + } + __pyx_t_3 = __Pyx_PyObject_IsTrue(__pyx_v__dict); if (unlikely((__pyx_t_3 < 0))) __PYX_ERR(1, 7, __pyx_L1_error) + __pyx_t_2 = __pyx_t_3; + __pyx_L4_bool_binop_done:; + if (__pyx_t_2) { + + /* "(tree fragment)":8 + * _dict = getattr(self, '__dict__', None) + * if _dict is not None and _dict: + * state += (_dict,) # <<<<<<<<<<<<<< + * use_setstate = True + * else: +*/ + __pyx_t_1 = PyTuple_New(1); if (unlikely(!__pyx_t_1)) __PYX_ERR(1, 8, __pyx_L1_error) + __Pyx_GOTREF(__pyx_t_1); + __Pyx_INCREF(__pyx_v__dict); + __Pyx_GIVEREF(__pyx_v__dict); + if (__Pyx_PyTuple_SET_ITEM(__pyx_t_1, 0, __pyx_v__dict) != (0)) __PYX_ERR(1, 8, __pyx_L1_error); + __pyx_t_4 = PyNumber_InPlaceAdd(__pyx_v_state, __pyx_t_1); if (unlikely(!__pyx_t_4)) __PYX_ERR(1, 8, __pyx_L1_error) + __Pyx_GOTREF(__pyx_t_4); + __Pyx_DECREF(__pyx_t_1); __pyx_t_1 = 0; + __Pyx_DECREF_SET(__pyx_v_state, ((PyObject*)__pyx_t_4)); + __pyx_t_4 = 0; + + /* "(tree fragment)":9 + * if _dict is not None and _dict: + * state += (_dict,) + * use_setstate = True # <<<<<<<<<<<<<< + * else: + * use_setstate = ('self.name is not None',) +*/ + __pyx_v_use_setstate = 1; + + /* "(tree fragment)":7 + * state = (self.name,) + * _dict = getattr(self, '__dict__', None) + * if _dict is not None and _dict: # <<<<<<<<<<<<<< + * state += (_dict,) + * use_setstate = True +*/ + goto __pyx_L3; + } + + /* "(tree fragment)":11 + * use_setstate = True + * else: + * use_setstate = ('self.name is not None',) # <<<<<<<<<<<<<< + * if use_setstate: + * return __pyx_unpickle_Enum, (type(self), 0x82a3537, None), state +*/ + /*else*/ { + __pyx_t_2 = __Pyx_PyObject_IsTrue(__pyx_mstate_global->__pyx_tuple[0]); if (unlikely((__pyx_t_2 == (int)-1) && PyErr_Occurred())) __PYX_ERR(1, 11, __pyx_L1_error) + __pyx_v_use_setstate = __pyx_t_2; + } + __pyx_L3:; + + /* "(tree fragment)":12 + * else: + * use_setstate = ('self.name is not None',) + * if use_setstate: # <<<<<<<<<<<<<< + * return __pyx_unpickle_Enum, (type(self), 0x82a3537, None), state + * else: +*/ + if (__pyx_v_use_setstate) { + + /* "(tree fragment)":13 + * use_setstate = ('self.name is not None',) + * if use_setstate: + * return __pyx_unpickle_Enum, (type(self), 0x82a3537, None), state # <<<<<<<<<<<<<< + * else: + * return __pyx_unpickle_Enum, (type(self), 0x82a3537, state) +*/ + __Pyx_XDECREF(__pyx_r); + __Pyx_GetModuleGlobalName(__pyx_t_4, __pyx_mstate_global->__pyx_n_u_pyx_unpickle_Enum); if (unlikely(!__pyx_t_4)) __PYX_ERR(1, 13, __pyx_L1_error) + __Pyx_GOTREF(__pyx_t_4); + __pyx_t_1 = PyTuple_New(3); if (unlikely(!__pyx_t_1)) __PYX_ERR(1, 13, __pyx_L1_error) + __Pyx_GOTREF(__pyx_t_1); + __Pyx_INCREF(((PyObject *)Py_TYPE(((PyObject *)__pyx_v_self)))); + __Pyx_GIVEREF(((PyObject *)Py_TYPE(((PyObject *)__pyx_v_self)))); + if (__Pyx_PyTuple_SET_ITEM(__pyx_t_1, 0, ((PyObject *)Py_TYPE(((PyObject *)__pyx_v_self)))) != (0)) __PYX_ERR(1, 13, __pyx_L1_error); + __Pyx_INCREF(__pyx_mstate_global->__pyx_int_136983863); + __Pyx_GIVEREF(__pyx_mstate_global->__pyx_int_136983863); + if (__Pyx_PyTuple_SET_ITEM(__pyx_t_1, 1, __pyx_mstate_global->__pyx_int_136983863) != (0)) __PYX_ERR(1, 13, __pyx_L1_error); + __Pyx_INCREF(Py_None); + __Pyx_GIVEREF(Py_None); + if (__Pyx_PyTuple_SET_ITEM(__pyx_t_1, 2, Py_None) != (0)) __PYX_ERR(1, 13, __pyx_L1_error); + __pyx_t_5 = PyTuple_New(3); if (unlikely(!__pyx_t_5)) __PYX_ERR(1, 13, __pyx_L1_error) + __Pyx_GOTREF(__pyx_t_5); + __Pyx_GIVEREF(__pyx_t_4); + if (__Pyx_PyTuple_SET_ITEM(__pyx_t_5, 0, __pyx_t_4) != (0)) __PYX_ERR(1, 13, __pyx_L1_error); + __Pyx_GIVEREF(__pyx_t_1); + if (__Pyx_PyTuple_SET_ITEM(__pyx_t_5, 1, __pyx_t_1) != (0)) __PYX_ERR(1, 13, __pyx_L1_error); + __Pyx_INCREF(__pyx_v_state); + __Pyx_GIVEREF(__pyx_v_state); + if (__Pyx_PyTuple_SET_ITEM(__pyx_t_5, 2, __pyx_v_state) != (0)) __PYX_ERR(1, 13, __pyx_L1_error); + __pyx_t_4 = 0; + __pyx_t_1 = 0; + __pyx_r = __pyx_t_5; + __pyx_t_5 = 0; + goto __pyx_L0; + + /* "(tree fragment)":12 + * else: + * use_setstate = ('self.name is not None',) + * if use_setstate: # <<<<<<<<<<<<<< + * return __pyx_unpickle_Enum, (type(self), 0x82a3537, None), state + * else: +*/ + } + + /* "(tree fragment)":15 + * return __pyx_unpickle_Enum, (type(self), 0x82a3537, None), state + * else: + * return __pyx_unpickle_Enum, (type(self), 0x82a3537, state) # <<<<<<<<<<<<<< + * def __setstate_cython__(self, __pyx_state): + * __pyx_unpickle_Enum__set_state(self, __pyx_state) +*/ + /*else*/ { + __Pyx_XDECREF(__pyx_r); + __Pyx_GetModuleGlobalName(__pyx_t_5, __pyx_mstate_global->__pyx_n_u_pyx_unpickle_Enum); if (unlikely(!__pyx_t_5)) __PYX_ERR(1, 15, __pyx_L1_error) + __Pyx_GOTREF(__pyx_t_5); + __pyx_t_1 = PyTuple_New(3); if (unlikely(!__pyx_t_1)) __PYX_ERR(1, 15, __pyx_L1_error) + __Pyx_GOTREF(__pyx_t_1); + __Pyx_INCREF(((PyObject *)Py_TYPE(((PyObject *)__pyx_v_self)))); + __Pyx_GIVEREF(((PyObject *)Py_TYPE(((PyObject *)__pyx_v_self)))); + if (__Pyx_PyTuple_SET_ITEM(__pyx_t_1, 0, ((PyObject *)Py_TYPE(((PyObject *)__pyx_v_self)))) != (0)) __PYX_ERR(1, 15, __pyx_L1_error); + __Pyx_INCREF(__pyx_mstate_global->__pyx_int_136983863); + __Pyx_GIVEREF(__pyx_mstate_global->__pyx_int_136983863); + if (__Pyx_PyTuple_SET_ITEM(__pyx_t_1, 1, __pyx_mstate_global->__pyx_int_136983863) != (0)) __PYX_ERR(1, 15, __pyx_L1_error); + __Pyx_INCREF(__pyx_v_state); + __Pyx_GIVEREF(__pyx_v_state); + if (__Pyx_PyTuple_SET_ITEM(__pyx_t_1, 2, __pyx_v_state) != (0)) __PYX_ERR(1, 15, __pyx_L1_error); + __pyx_t_4 = PyTuple_New(2); if (unlikely(!__pyx_t_4)) __PYX_ERR(1, 15, __pyx_L1_error) + __Pyx_GOTREF(__pyx_t_4); + __Pyx_GIVEREF(__pyx_t_5); + if (__Pyx_PyTuple_SET_ITEM(__pyx_t_4, 0, __pyx_t_5) != (0)) __PYX_ERR(1, 15, __pyx_L1_error); + __Pyx_GIVEREF(__pyx_t_1); + if (__Pyx_PyTuple_SET_ITEM(__pyx_t_4, 1, __pyx_t_1) != (0)) __PYX_ERR(1, 15, __pyx_L1_error); + __pyx_t_5 = 0; + __pyx_t_1 = 0; + __pyx_r = __pyx_t_4; + __pyx_t_4 = 0; + goto __pyx_L0; + } + + /* "(tree fragment)":1 + * def __reduce_cython__(self): # <<<<<<<<<<<<<< + * cdef tuple state + * cdef object _dict +*/ + + /* function exit code */ + __pyx_L1_error:; + __Pyx_XDECREF(__pyx_t_1); + __Pyx_XDECREF(__pyx_t_4); + __Pyx_XDECREF(__pyx_t_5); + __Pyx_AddTraceback("View.MemoryView.Enum.__reduce_cython__", __pyx_clineno, __pyx_lineno, __pyx_filename); + __pyx_r = NULL; + __pyx_L0:; + __Pyx_XDECREF(__pyx_v_state); + __Pyx_XDECREF(__pyx_v__dict); + __Pyx_XGIVEREF(__pyx_r); + __Pyx_RefNannyFinishContext(); + return __pyx_r; +} + +/* "(tree fragment)":16 + * else: + * return __pyx_unpickle_Enum, (type(self), 0x82a3537, state) + * def __setstate_cython__(self, __pyx_state): # <<<<<<<<<<<<<< + * __pyx_unpickle_Enum__set_state(self, __pyx_state) +*/ + +/* Python wrapper */ +static PyObject *__pyx_pw___pyx_MemviewEnum_3__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*/ +static PyObject *__pyx_pw___pyx_MemviewEnum_3__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 +) { + 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, 16, __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, 16, __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, 16, __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, 16, __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, 16, __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, 16, __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("View.MemoryView.Enum.__setstate_cython__", __pyx_clineno, __pyx_lineno, __pyx_filename); + __Pyx_RefNannyFinishContext(); + return NULL; + __pyx_L4_argument_unpacking_done:; + __pyx_r = __pyx_pf___pyx_MemviewEnum_2__setstate_cython__(((struct __pyx_MemviewEnum_obj *)__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___pyx_MemviewEnum_2__setstate_cython__(struct __pyx_MemviewEnum_obj *__pyx_v_self, PyObject *__pyx_v___pyx_state) { + PyObject *__pyx_r = NULL; + __Pyx_RefNannyDeclarations + PyObject *__pyx_t_1 = NULL; + PyObject *__pyx_t_2 = NULL; + int __pyx_lineno = 0; + const char *__pyx_filename = NULL; + int __pyx_clineno = 0; + __Pyx_RefNannySetupContext("__setstate_cython__", 0); + + /* "(tree fragment)":17 + * return __pyx_unpickle_Enum, (type(self), 0x82a3537, state) + * def __setstate_cython__(self, __pyx_state): + * __pyx_unpickle_Enum__set_state(self, __pyx_state) # <<<<<<<<<<<<<< +*/ + __pyx_t_1 = __pyx_v___pyx_state; + __Pyx_INCREF(__pyx_t_1); + if (!(likely(PyTuple_CheckExact(__pyx_t_1))||((__pyx_t_1) == Py_None) || __Pyx_RaiseUnexpectedTypeError("tuple", __pyx_t_1))) __PYX_ERR(1, 17, __pyx_L1_error) + if (unlikely(__pyx_t_1 == Py_None)) { + PyErr_SetString(PyExc_TypeError, "cannot pass None into a C function argument that is declared 'not None'"); + __PYX_ERR(1, 17, __pyx_L1_error) + } + __pyx_t_2 = __pyx_unpickle_Enum__set_state(__pyx_v_self, ((PyObject*)__pyx_t_1)); if (unlikely(!__pyx_t_2)) __PYX_ERR(1, 17, __pyx_L1_error) + __Pyx_GOTREF(__pyx_t_2); + __Pyx_DECREF(__pyx_t_1); __pyx_t_1 = 0; + __Pyx_DECREF(__pyx_t_2); __pyx_t_2 = 0; + + /* "(tree fragment)":16 + * else: + * return __pyx_unpickle_Enum, (type(self), 0x82a3537, state) + * def __setstate_cython__(self, __pyx_state): # <<<<<<<<<<<<<< + * __pyx_unpickle_Enum__set_state(self, __pyx_state) +*/ + + /* 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("View.MemoryView.Enum.__setstate_cython__", __pyx_clineno, __pyx_lineno, __pyx_filename); + __pyx_r = NULL; + __pyx_L0:; + __Pyx_XGIVEREF(__pyx_r); + __Pyx_RefNannyFinishContext(); + return __pyx_r; +} + +/* "View.MemoryView":348 + * cdef const __Pyx_TypeInfo *typeinfo + * + * def __cinit__(memoryview self, object obj, int flags, bint dtype_is_object=False): # <<<<<<<<<<<<<< + * self.obj = obj + * self.flags = flags +*/ + +/* Python wrapper */ +static int __pyx_memoryview___cinit__(PyObject *__pyx_v_self, PyObject *__pyx_args, PyObject *__pyx_kwds); /*proto*/ +static int __pyx_memoryview___cinit__(PyObject *__pyx_v_self, PyObject *__pyx_args, PyObject *__pyx_kwds) { + PyObject *__pyx_v_obj = 0; + int __pyx_v_flags; + int __pyx_v_dtype_is_object; + CYTHON_UNUSED Py_ssize_t __pyx_nargs; + 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; + 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_obj,&__pyx_mstate_global->__pyx_n_u_flags,&__pyx_mstate_global->__pyx_n_u_dtype_is_object,0}; + const Py_ssize_t __pyx_kwds_len = (__pyx_kwds) ? __Pyx_NumKwargs_VARARGS(__pyx_kwds) : 0; + if (unlikely(__pyx_kwds_len) < 0) __PYX_ERR(1, 348, __pyx_L3_error) + if (__pyx_kwds_len > 0) { + switch (__pyx_nargs) { + case 3: + values[2] = __Pyx_ArgRef_VARARGS(__pyx_args, 2); + if (!CYTHON_ASSUME_SAFE_MACROS && unlikely(!values[2])) __PYX_ERR(1, 348, __pyx_L3_error) + CYTHON_FALLTHROUGH; + case 2: + values[1] = __Pyx_ArgRef_VARARGS(__pyx_args, 1); + if (!CYTHON_ASSUME_SAFE_MACROS && unlikely(!values[1])) __PYX_ERR(1, 348, __pyx_L3_error) + CYTHON_FALLTHROUGH; + case 1: + values[0] = __Pyx_ArgRef_VARARGS(__pyx_args, 0); + if (!CYTHON_ASSUME_SAFE_MACROS && unlikely(!values[0])) __PYX_ERR(1, 348, __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(1, 348, __pyx_L3_error) + for (Py_ssize_t i = __pyx_nargs; i < 2; i++) { + if (unlikely(!values[i])) { __Pyx_RaiseArgtupleInvalid("__cinit__", 0, 2, 3, i); __PYX_ERR(1, 348, __pyx_L3_error) } + } + } else { + switch (__pyx_nargs) { + case 3: + values[2] = __Pyx_ArgRef_VARARGS(__pyx_args, 2); + if (!CYTHON_ASSUME_SAFE_MACROS && unlikely(!values[2])) __PYX_ERR(1, 348, __pyx_L3_error) + CYTHON_FALLTHROUGH; + case 2: + values[1] = __Pyx_ArgRef_VARARGS(__pyx_args, 1); + if (!CYTHON_ASSUME_SAFE_MACROS && unlikely(!values[1])) __PYX_ERR(1, 348, __pyx_L3_error) + values[0] = __Pyx_ArgRef_VARARGS(__pyx_args, 0); + if (!CYTHON_ASSUME_SAFE_MACROS && unlikely(!values[0])) __PYX_ERR(1, 348, __pyx_L3_error) + break; + default: goto __pyx_L5_argtuple_error; + } + } + __pyx_v_obj = values[0]; + __pyx_v_flags = __Pyx_PyLong_As_int(values[1]); if (unlikely((__pyx_v_flags == (int)-1) && PyErr_Occurred())) __PYX_ERR(1, 348, __pyx_L3_error) + if (values[2]) { + __pyx_v_dtype_is_object = __Pyx_PyObject_IsTrue(values[2]); if (unlikely((__pyx_v_dtype_is_object == (int)-1) && PyErr_Occurred())) __PYX_ERR(1, 348, __pyx_L3_error) + } else { + __pyx_v_dtype_is_object = ((int)0); + } + } + goto __pyx_L6_skip; + __pyx_L5_argtuple_error:; + __Pyx_RaiseArgtupleInvalid("__cinit__", 0, 2, 3, __pyx_nargs); __PYX_ERR(1, 348, __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("View.MemoryView.memoryview.__cinit__", __pyx_clineno, __pyx_lineno, __pyx_filename); + __Pyx_RefNannyFinishContext(); + return -1; + __pyx_L4_argument_unpacking_done:; + __pyx_r = __pyx_memoryview___pyx_pf_15View_dot_MemoryView_10memoryview___cinit__(((struct __pyx_memoryview_obj *)__pyx_v_self), __pyx_v_obj, __pyx_v_flags, __pyx_v_dtype_is_object); + + /* 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_memoryview___pyx_pf_15View_dot_MemoryView_10memoryview___cinit__(struct __pyx_memoryview_obj *__pyx_v_self, PyObject *__pyx_v_obj, int __pyx_v_flags, int __pyx_v_dtype_is_object) { + int __pyx_r; + __Pyx_RefNannyDeclarations + int __pyx_t_1; + int __pyx_t_2; + int __pyx_t_3; + Py_intptr_t __pyx_t_4; + size_t __pyx_t_5; + int __pyx_lineno = 0; + const char *__pyx_filename = NULL; + int __pyx_clineno = 0; + __Pyx_RefNannySetupContext("__cinit__", 0); + + /* "View.MemoryView":349 + * + * def __cinit__(memoryview self, object obj, int flags, bint dtype_is_object=False): + * self.obj = obj # <<<<<<<<<<<<<< + * self.flags = flags + * if type(self) is memoryview or obj is not None: +*/ + __Pyx_INCREF(__pyx_v_obj); + __Pyx_GIVEREF(__pyx_v_obj); + __Pyx_GOTREF(__pyx_v_self->obj); + __Pyx_DECREF(__pyx_v_self->obj); + __pyx_v_self->obj = __pyx_v_obj; + + /* "View.MemoryView":350 + * def __cinit__(memoryview self, object obj, int flags, bint dtype_is_object=False): + * self.obj = obj + * self.flags = flags # <<<<<<<<<<<<<< + * if type(self) is memoryview or obj is not None: + * PyObject_GetBuffer(obj, &self.view, flags) +*/ + __pyx_v_self->flags = __pyx_v_flags; + + /* "View.MemoryView":351 + * self.obj = obj + * self.flags = flags + * if type(self) is memoryview or obj is not None: # <<<<<<<<<<<<<< + * PyObject_GetBuffer(obj, &self.view, flags) + * if self.view.obj == NULL: +*/ + __pyx_t_2 = (((PyObject *)Py_TYPE(((PyObject *)__pyx_v_self))) == ((PyObject *)__pyx_mstate_global->__pyx_memoryview_type)); + if (!__pyx_t_2) { + } else { + __pyx_t_1 = __pyx_t_2; + goto __pyx_L4_bool_binop_done; + } + __pyx_t_2 = (__pyx_v_obj != Py_None); + __pyx_t_1 = __pyx_t_2; + __pyx_L4_bool_binop_done:; + if (__pyx_t_1) { + + /* "View.MemoryView":352 + * self.flags = flags + * if type(self) is memoryview or obj is not None: + * PyObject_GetBuffer(obj, &self.view, flags) # <<<<<<<<<<<<<< + * if self.view.obj == NULL: + * (<__pyx_buffer *> &self.view).obj = Py_None +*/ + __pyx_t_3 = PyObject_GetBuffer(__pyx_v_obj, (&__pyx_v_self->view), __pyx_v_flags); if (unlikely(__pyx_t_3 == ((int)-1))) __PYX_ERR(1, 352, __pyx_L1_error) + + /* "View.MemoryView":353 + * if type(self) is memoryview or obj is not None: + * PyObject_GetBuffer(obj, &self.view, flags) + * if self.view.obj == NULL: # <<<<<<<<<<<<<< + * (<__pyx_buffer *> &self.view).obj = Py_None + * Py_INCREF(Py_None) +*/ + __pyx_t_1 = (((PyObject *)__pyx_v_self->view.obj) == NULL); + if (__pyx_t_1) { + + /* "View.MemoryView":354 + * PyObject_GetBuffer(obj, &self.view, flags) + * if self.view.obj == NULL: + * (<__pyx_buffer *> &self.view).obj = Py_None # <<<<<<<<<<<<<< + * Py_INCREF(Py_None) + * +*/ + ((Py_buffer *)(&__pyx_v_self->view))->obj = Py_None; + + /* "View.MemoryView":355 + * if self.view.obj == NULL: + * (<__pyx_buffer *> &self.view).obj = Py_None + * Py_INCREF(Py_None) # <<<<<<<<<<<<<< + * + * if not __PYX_CYTHON_ATOMICS_ENABLED(): +*/ + Py_INCREF(Py_None); + + /* "View.MemoryView":353 + * if type(self) is memoryview or obj is not None: + * PyObject_GetBuffer(obj, &self.view, flags) + * if self.view.obj == NULL: # <<<<<<<<<<<<<< + * (<__pyx_buffer *> &self.view).obj = Py_None + * Py_INCREF(Py_None) +*/ + } + + /* "View.MemoryView":351 + * self.obj = obj + * self.flags = flags + * if type(self) is memoryview or obj is not None: # <<<<<<<<<<<<<< + * PyObject_GetBuffer(obj, &self.view, flags) + * if self.view.obj == NULL: +*/ + } + + /* "View.MemoryView":357 + * Py_INCREF(Py_None) + * + * if not __PYX_CYTHON_ATOMICS_ENABLED(): # <<<<<<<<<<<<<< + * global __pyx_memoryview_thread_locks_used + * if (__pyx_memoryview_thread_locks_used < 8 and +*/ + __pyx_t_1 = (!__PYX_CYTHON_ATOMICS_ENABLED()); + if (__pyx_t_1) { + + /* "View.MemoryView":359 + * if not __PYX_CYTHON_ATOMICS_ENABLED(): + * global __pyx_memoryview_thread_locks_used + * if (__pyx_memoryview_thread_locks_used < 8 and # <<<<<<<<<<<<<< + * + * not __PYX_GET_CYTHON_COMPILING_IN_CPYTHON_FREETHREADING()): +*/ + __pyx_t_2 = (__pyx_memoryview_thread_locks_used < 8); + if (__pyx_t_2) { + } else { + __pyx_t_1 = __pyx_t_2; + goto __pyx_L9_bool_binop_done; + } + + /* "View.MemoryView":361 + * if (__pyx_memoryview_thread_locks_used < 8 and + * + * not __PYX_GET_CYTHON_COMPILING_IN_CPYTHON_FREETHREADING()): # <<<<<<<<<<<<<< + * self.lock = __pyx_memoryview_thread_locks[__pyx_memoryview_thread_locks_used] + * __pyx_memoryview_thread_locks_used += 1 +*/ + __pyx_t_2 = (!__PYX_GET_CYTHON_COMPILING_IN_CPYTHON_FREETHREADING()); + __pyx_t_1 = __pyx_t_2; + __pyx_L9_bool_binop_done:; + + /* "View.MemoryView":359 + * if not __PYX_CYTHON_ATOMICS_ENABLED(): + * global __pyx_memoryview_thread_locks_used + * if (__pyx_memoryview_thread_locks_used < 8 and # <<<<<<<<<<<<<< + * + * not __PYX_GET_CYTHON_COMPILING_IN_CPYTHON_FREETHREADING()): +*/ + if (__pyx_t_1) { + + /* "View.MemoryView":362 + * + * not __PYX_GET_CYTHON_COMPILING_IN_CPYTHON_FREETHREADING()): + * self.lock = __pyx_memoryview_thread_locks[__pyx_memoryview_thread_locks_used] # <<<<<<<<<<<<<< + * __pyx_memoryview_thread_locks_used += 1 + * if self.lock is NULL: +*/ + __pyx_v_self->lock = (__pyx_memoryview_thread_locks[__pyx_memoryview_thread_locks_used]); + + /* "View.MemoryView":363 + * not __PYX_GET_CYTHON_COMPILING_IN_CPYTHON_FREETHREADING()): + * self.lock = __pyx_memoryview_thread_locks[__pyx_memoryview_thread_locks_used] + * __pyx_memoryview_thread_locks_used += 1 # <<<<<<<<<<<<<< + * if self.lock is NULL: + * self.lock = PyThread_allocate_lock() +*/ + __pyx_memoryview_thread_locks_used = (__pyx_memoryview_thread_locks_used + 1); + + /* "View.MemoryView":359 + * if not __PYX_CYTHON_ATOMICS_ENABLED(): + * global __pyx_memoryview_thread_locks_used + * if (__pyx_memoryview_thread_locks_used < 8 and # <<<<<<<<<<<<<< + * + * not __PYX_GET_CYTHON_COMPILING_IN_CPYTHON_FREETHREADING()): +*/ + } + + /* "View.MemoryView":364 + * self.lock = __pyx_memoryview_thread_locks[__pyx_memoryview_thread_locks_used] + * __pyx_memoryview_thread_locks_used += 1 + * if self.lock is NULL: # <<<<<<<<<<<<<< + * self.lock = PyThread_allocate_lock() + * if self.lock is NULL: +*/ + __pyx_t_1 = (__pyx_v_self->lock == NULL); + if (__pyx_t_1) { + + /* "View.MemoryView":365 + * __pyx_memoryview_thread_locks_used += 1 + * if self.lock is NULL: + * self.lock = PyThread_allocate_lock() # <<<<<<<<<<<<<< + * if self.lock is NULL: + * raise MemoryError +*/ + __pyx_v_self->lock = PyThread_allocate_lock(); + + /* "View.MemoryView":366 + * if self.lock is NULL: + * self.lock = PyThread_allocate_lock() + * if self.lock is NULL: # <<<<<<<<<<<<<< + * raise MemoryError + * +*/ + __pyx_t_1 = (__pyx_v_self->lock == NULL); + if (unlikely(__pyx_t_1)) { + + /* "View.MemoryView":367 + * self.lock = PyThread_allocate_lock() + * if self.lock is NULL: + * raise MemoryError # <<<<<<<<<<<<<< + * + * if flags & PyBUF_FORMAT: +*/ + PyErr_NoMemory(); __PYX_ERR(1, 367, __pyx_L1_error) + + /* "View.MemoryView":366 + * if self.lock is NULL: + * self.lock = PyThread_allocate_lock() + * if self.lock is NULL: # <<<<<<<<<<<<<< + * raise MemoryError + * +*/ + } + + /* "View.MemoryView":364 + * self.lock = __pyx_memoryview_thread_locks[__pyx_memoryview_thread_locks_used] + * __pyx_memoryview_thread_locks_used += 1 + * if self.lock is NULL: # <<<<<<<<<<<<<< + * self.lock = PyThread_allocate_lock() + * if self.lock is NULL: +*/ + } + + /* "View.MemoryView":357 + * Py_INCREF(Py_None) + * + * if not __PYX_CYTHON_ATOMICS_ENABLED(): # <<<<<<<<<<<<<< + * global __pyx_memoryview_thread_locks_used + * if (__pyx_memoryview_thread_locks_used < 8 and +*/ + } + + /* "View.MemoryView":369 + * raise MemoryError + * + * if flags & PyBUF_FORMAT: # <<<<<<<<<<<<<< + * self.dtype_is_object = (self.view.format[0] == b'O' and self.view.format[1] == b'\0') + * else: +*/ + __pyx_t_1 = ((__pyx_v_flags & PyBUF_FORMAT) != 0); + if (__pyx_t_1) { + + /* "View.MemoryView":370 + * + * if flags & PyBUF_FORMAT: + * self.dtype_is_object = (self.view.format[0] == b'O' and self.view.format[1] == b'\0') # <<<<<<<<<<<<<< + * else: + * self.dtype_is_object = dtype_is_object +*/ + __pyx_t_2 = ((__pyx_v_self->view.format[0]) == 'O'); + if (__pyx_t_2) { + } else { + __pyx_t_1 = __pyx_t_2; + goto __pyx_L14_bool_binop_done; + } + __pyx_t_2 = ((__pyx_v_self->view.format[1]) == '\x00'); + __pyx_t_1 = __pyx_t_2; + __pyx_L14_bool_binop_done:; + __pyx_v_self->dtype_is_object = __pyx_t_1; + + /* "View.MemoryView":369 + * raise MemoryError + * + * if flags & PyBUF_FORMAT: # <<<<<<<<<<<<<< + * self.dtype_is_object = (self.view.format[0] == b'O' and self.view.format[1] == b'\0') + * else: +*/ + goto __pyx_L13; + } + + /* "View.MemoryView":372 + * self.dtype_is_object = (self.view.format[0] == b'O' and self.view.format[1] == b'\0') + * else: + * self.dtype_is_object = dtype_is_object # <<<<<<<<<<<<<< + * + * assert (&self.acquisition_count) % sizeof(__pyx_atomic_int_type) == 0 +*/ + /*else*/ { + __pyx_v_self->dtype_is_object = __pyx_v_dtype_is_object; + } + __pyx_L13:; + + /* "View.MemoryView":374 + * self.dtype_is_object = dtype_is_object + * + * assert (&self.acquisition_count) % sizeof(__pyx_atomic_int_type) == 0 # <<<<<<<<<<<<<< + * self.typeinfo = NULL + * +*/ + #ifndef CYTHON_WITHOUT_ASSERTIONS + if (unlikely(__pyx_assertions_enabled())) { + __pyx_t_4 = ((Py_intptr_t)((void *)(&__pyx_v_self->acquisition_count))); + __pyx_t_5 = (sizeof(__pyx_atomic_int_type)); + if (unlikely(__pyx_t_5 == 0)) { + PyErr_SetString(PyExc_ZeroDivisionError, "integer division or modulo by zero"); + __PYX_ERR(1, 374, __pyx_L1_error) + } + __pyx_t_1 = ((__pyx_t_4 % __pyx_t_5) == 0); + if (unlikely(!__pyx_t_1)) { + __Pyx_Raise(((PyObject *)(((PyTypeObject*)PyExc_AssertionError))), 0, 0, 0); + __PYX_ERR(1, 374, __pyx_L1_error) + } + } + #else + if ((1)); else __PYX_ERR(1, 374, __pyx_L1_error) + #endif + + /* "View.MemoryView":375 + * + * assert (&self.acquisition_count) % sizeof(__pyx_atomic_int_type) == 0 + * self.typeinfo = NULL # <<<<<<<<<<<<<< + * + * def __dealloc__(memoryview self): +*/ + __pyx_v_self->typeinfo = NULL; + + /* "View.MemoryView":348 + * cdef const __Pyx_TypeInfo *typeinfo + * + * def __cinit__(memoryview self, object obj, int flags, bint dtype_is_object=False): # <<<<<<<<<<<<<< + * self.obj = obj + * self.flags = flags +*/ + + /* function exit code */ + __pyx_r = 0; + goto __pyx_L0; + __pyx_L1_error:; + __Pyx_AddTraceback("View.MemoryView.memoryview.__cinit__", __pyx_clineno, __pyx_lineno, __pyx_filename); + __pyx_r = -1; + __pyx_L0:; + __Pyx_RefNannyFinishContext(); + return __pyx_r; +} + +/* "View.MemoryView":377 + * self.typeinfo = NULL + * + * def __dealloc__(memoryview self): # <<<<<<<<<<<<<< + * if self.obj is not None: + * PyBuffer_Release(&self.view) +*/ + +/* Python wrapper */ +static void __pyx_memoryview___dealloc__(PyObject *__pyx_v_self); /*proto*/ +static void __pyx_memoryview___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_memoryview___pyx_pf_15View_dot_MemoryView_10memoryview_2__dealloc__(((struct __pyx_memoryview_obj *)__pyx_v_self)); + + /* function exit code */ + __Pyx_RefNannyFinishContext(); +} + +static void __pyx_memoryview___pyx_pf_15View_dot_MemoryView_10memoryview_2__dealloc__(struct __pyx_memoryview_obj *__pyx_v_self) { + int __pyx_v_i; + int __pyx_t_1; + Py_ssize_t __pyx_t_2; + Py_ssize_t __pyx_t_3; + int __pyx_t_4; + PyThread_type_lock __pyx_t_5; + PyThread_type_lock __pyx_t_6; + + /* "View.MemoryView":378 + * + * def __dealloc__(memoryview self): + * if self.obj is not None: # <<<<<<<<<<<<<< + * PyBuffer_Release(&self.view) + * elif (<__pyx_buffer *> &self.view).obj == Py_None: +*/ + __pyx_t_1 = (__pyx_v_self->obj != Py_None); + if (__pyx_t_1) { + + /* "View.MemoryView":379 + * def __dealloc__(memoryview self): + * if self.obj is not None: + * PyBuffer_Release(&self.view) # <<<<<<<<<<<<<< + * elif (<__pyx_buffer *> &self.view).obj == Py_None: + * +*/ + PyBuffer_Release((&__pyx_v_self->view)); + + /* "View.MemoryView":378 + * + * def __dealloc__(memoryview self): + * if self.obj is not None: # <<<<<<<<<<<<<< + * PyBuffer_Release(&self.view) + * elif (<__pyx_buffer *> &self.view).obj == Py_None: +*/ + goto __pyx_L3; + } + + /* "View.MemoryView":380 + * if self.obj is not None: + * PyBuffer_Release(&self.view) + * elif (<__pyx_buffer *> &self.view).obj == Py_None: # <<<<<<<<<<<<<< + * + * (<__pyx_buffer *> &self.view).obj = NULL +*/ + __pyx_t_1 = (((Py_buffer *)(&__pyx_v_self->view))->obj == Py_None); + if (__pyx_t_1) { + + /* "View.MemoryView":382 + * elif (<__pyx_buffer *> &self.view).obj == Py_None: + * + * (<__pyx_buffer *> &self.view).obj = NULL # <<<<<<<<<<<<<< + * Py_DECREF(Py_None) + * +*/ + ((Py_buffer *)(&__pyx_v_self->view))->obj = NULL; + + /* "View.MemoryView":383 + * + * (<__pyx_buffer *> &self.view).obj = NULL + * Py_DECREF(Py_None) # <<<<<<<<<<<<<< + * + * cdef int i +*/ + Py_DECREF(Py_None); + + /* "View.MemoryView":380 + * if self.obj is not None: + * PyBuffer_Release(&self.view) + * elif (<__pyx_buffer *> &self.view).obj == Py_None: # <<<<<<<<<<<<<< + * + * (<__pyx_buffer *> &self.view).obj = NULL +*/ + } + __pyx_L3:; + + /* "View.MemoryView":387 + * cdef int i + * global __pyx_memoryview_thread_locks_used + * if self.lock != NULL: # <<<<<<<<<<<<<< + * for i in range(0 if __PYX_GET_CYTHON_COMPILING_IN_CPYTHON_FREETHREADING() else __pyx_memoryview_thread_locks_used): + * if __pyx_memoryview_thread_locks[i] is self.lock: +*/ + __pyx_t_1 = (__pyx_v_self->lock != NULL); + if (__pyx_t_1) { + + /* "View.MemoryView":388 + * global __pyx_memoryview_thread_locks_used + * if self.lock != NULL: + * for i in range(0 if __PYX_GET_CYTHON_COMPILING_IN_CPYTHON_FREETHREADING() else __pyx_memoryview_thread_locks_used): # <<<<<<<<<<<<<< + * if __pyx_memoryview_thread_locks[i] is self.lock: + * __pyx_memoryview_thread_locks_used -= 1 +*/ + __pyx_t_1 = __PYX_GET_CYTHON_COMPILING_IN_CPYTHON_FREETHREADING(); + if (__pyx_t_1) { + __pyx_t_2 = 0; + } else { + __pyx_t_2 = __pyx_memoryview_thread_locks_used; + } + __pyx_t_3 = __pyx_t_2; + for (__pyx_t_4 = 0; __pyx_t_4 < __pyx_t_3; __pyx_t_4+=1) { + __pyx_v_i = __pyx_t_4; + + /* "View.MemoryView":389 + * if self.lock != NULL: + * for i in range(0 if __PYX_GET_CYTHON_COMPILING_IN_CPYTHON_FREETHREADING() else __pyx_memoryview_thread_locks_used): + * if __pyx_memoryview_thread_locks[i] is self.lock: # <<<<<<<<<<<<<< + * __pyx_memoryview_thread_locks_used -= 1 + * if i != __pyx_memoryview_thread_locks_used: +*/ + __pyx_t_1 = ((__pyx_memoryview_thread_locks[__pyx_v_i]) == __pyx_v_self->lock); + if (__pyx_t_1) { + + /* "View.MemoryView":390 + * for i in range(0 if __PYX_GET_CYTHON_COMPILING_IN_CPYTHON_FREETHREADING() else __pyx_memoryview_thread_locks_used): + * if __pyx_memoryview_thread_locks[i] is self.lock: + * __pyx_memoryview_thread_locks_used -= 1 # <<<<<<<<<<<<<< + * if i != __pyx_memoryview_thread_locks_used: + * __pyx_memoryview_thread_locks[i], __pyx_memoryview_thread_locks[__pyx_memoryview_thread_locks_used] = ( +*/ + __pyx_memoryview_thread_locks_used = (__pyx_memoryview_thread_locks_used - 1); + + /* "View.MemoryView":391 + * if __pyx_memoryview_thread_locks[i] is self.lock: + * __pyx_memoryview_thread_locks_used -= 1 + * if i != __pyx_memoryview_thread_locks_used: # <<<<<<<<<<<<<< + * __pyx_memoryview_thread_locks[i], __pyx_memoryview_thread_locks[__pyx_memoryview_thread_locks_used] = ( + * __pyx_memoryview_thread_locks[__pyx_memoryview_thread_locks_used], __pyx_memoryview_thread_locks[i]) +*/ + __pyx_t_1 = (__pyx_v_i != __pyx_memoryview_thread_locks_used); + if (__pyx_t_1) { + + /* "View.MemoryView":393 + * if i != __pyx_memoryview_thread_locks_used: + * __pyx_memoryview_thread_locks[i], __pyx_memoryview_thread_locks[__pyx_memoryview_thread_locks_used] = ( + * __pyx_memoryview_thread_locks[__pyx_memoryview_thread_locks_used], __pyx_memoryview_thread_locks[i]) # <<<<<<<<<<<<<< + * break + * else: +*/ + __pyx_t_5 = (__pyx_memoryview_thread_locks[__pyx_memoryview_thread_locks_used]); + __pyx_t_6 = (__pyx_memoryview_thread_locks[__pyx_v_i]); + + /* "View.MemoryView":392 + * __pyx_memoryview_thread_locks_used -= 1 + * if i != __pyx_memoryview_thread_locks_used: + * __pyx_memoryview_thread_locks[i], __pyx_memoryview_thread_locks[__pyx_memoryview_thread_locks_used] = ( # <<<<<<<<<<<<<< + * __pyx_memoryview_thread_locks[__pyx_memoryview_thread_locks_used], __pyx_memoryview_thread_locks[i]) + * break +*/ + (__pyx_memoryview_thread_locks[__pyx_v_i]) = __pyx_t_5; + (__pyx_memoryview_thread_locks[__pyx_memoryview_thread_locks_used]) = __pyx_t_6; + + /* "View.MemoryView":391 + * if __pyx_memoryview_thread_locks[i] is self.lock: + * __pyx_memoryview_thread_locks_used -= 1 + * if i != __pyx_memoryview_thread_locks_used: # <<<<<<<<<<<<<< + * __pyx_memoryview_thread_locks[i], __pyx_memoryview_thread_locks[__pyx_memoryview_thread_locks_used] = ( + * __pyx_memoryview_thread_locks[__pyx_memoryview_thread_locks_used], __pyx_memoryview_thread_locks[i]) +*/ + } + + /* "View.MemoryView":394 + * __pyx_memoryview_thread_locks[i], __pyx_memoryview_thread_locks[__pyx_memoryview_thread_locks_used] = ( + * __pyx_memoryview_thread_locks[__pyx_memoryview_thread_locks_used], __pyx_memoryview_thread_locks[i]) + * break # <<<<<<<<<<<<<< + * else: + * PyThread_free_lock(self.lock) +*/ + goto __pyx_L6_break; + + /* "View.MemoryView":389 + * if self.lock != NULL: + * for i in range(0 if __PYX_GET_CYTHON_COMPILING_IN_CPYTHON_FREETHREADING() else __pyx_memoryview_thread_locks_used): + * if __pyx_memoryview_thread_locks[i] is self.lock: # <<<<<<<<<<<<<< + * __pyx_memoryview_thread_locks_used -= 1 + * if i != __pyx_memoryview_thread_locks_used: +*/ + } + } + /*else*/ { + + /* "View.MemoryView":396 + * break + * else: + * PyThread_free_lock(self.lock) # <<<<<<<<<<<<<< + * + * cdef char *get_item_pointer(memoryview self, object index) except NULL: +*/ + PyThread_free_lock(__pyx_v_self->lock); + } + __pyx_L6_break:; + + /* "View.MemoryView":387 + * cdef int i + * global __pyx_memoryview_thread_locks_used + * if self.lock != NULL: # <<<<<<<<<<<<<< + * for i in range(0 if __PYX_GET_CYTHON_COMPILING_IN_CPYTHON_FREETHREADING() else __pyx_memoryview_thread_locks_used): + * if __pyx_memoryview_thread_locks[i] is self.lock: +*/ + } + + /* "View.MemoryView":377 + * self.typeinfo = NULL + * + * def __dealloc__(memoryview self): # <<<<<<<<<<<<<< + * if self.obj is not None: + * PyBuffer_Release(&self.view) +*/ + + /* function exit code */ +} + +/* "View.MemoryView":398 + * PyThread_free_lock(self.lock) + * + * cdef char *get_item_pointer(memoryview self, object index) except NULL: # <<<<<<<<<<<<<< + * cdef Py_ssize_t dim + * cdef char *itemp = self.view.buf +*/ + +static char *__pyx_memoryview_get_item_pointer(struct __pyx_memoryview_obj *__pyx_v_self, PyObject *__pyx_v_index) { + Py_ssize_t __pyx_v_dim; + char *__pyx_v_itemp; + PyObject *__pyx_v_idx = NULL; + char *__pyx_r; + __Pyx_RefNannyDeclarations + Py_ssize_t __pyx_t_1; + PyObject *__pyx_t_2 = NULL; + Py_ssize_t __pyx_t_3; + PyObject *(*__pyx_t_4)(PyObject *); + PyObject *__pyx_t_5 = NULL; + Py_ssize_t __pyx_t_6; + char *__pyx_t_7; + int __pyx_lineno = 0; + const char *__pyx_filename = NULL; + int __pyx_clineno = 0; + __Pyx_RefNannySetupContext("get_item_pointer", 0); + + /* "View.MemoryView":400 + * cdef char *get_item_pointer(memoryview self, object index) except NULL: + * cdef Py_ssize_t dim + * cdef char *itemp = self.view.buf # <<<<<<<<<<<<<< + * + * for dim, idx in enumerate(index): +*/ + __pyx_v_itemp = ((char *)__pyx_v_self->view.buf); + + /* "View.MemoryView":402 + * cdef char *itemp = self.view.buf + * + * for dim, idx in enumerate(index): # <<<<<<<<<<<<<< + * itemp = pybuffer_index(&self.view, itemp, idx, dim) + * +*/ + __pyx_t_1 = 0; + if (likely(PyList_CheckExact(__pyx_v_index)) || PyTuple_CheckExact(__pyx_v_index)) { + __pyx_t_2 = __pyx_v_index; __Pyx_INCREF(__pyx_t_2); + __pyx_t_3 = 0; + __pyx_t_4 = NULL; + } else { + __pyx_t_3 = -1; __pyx_t_2 = PyObject_GetIter(__pyx_v_index); if (unlikely(!__pyx_t_2)) __PYX_ERR(1, 402, __pyx_L1_error) + __Pyx_GOTREF(__pyx_t_2); + __pyx_t_4 = (CYTHON_COMPILING_IN_LIMITED_API) ? PyIter_Next : __Pyx_PyObject_GetIterNextFunc(__pyx_t_2); if (unlikely(!__pyx_t_4)) __PYX_ERR(1, 402, __pyx_L1_error) + } + for (;;) { + if (likely(!__pyx_t_4)) { + if (likely(PyList_CheckExact(__pyx_t_2))) { + { + Py_ssize_t __pyx_temp = __Pyx_PyList_GET_SIZE(__pyx_t_2); + #if !CYTHON_ASSUME_SAFE_SIZE + if (unlikely((__pyx_temp < 0))) __PYX_ERR(1, 402, __pyx_L1_error) + #endif + if (__pyx_t_3 >= __pyx_temp) break; + } + __pyx_t_5 = __Pyx_PyList_GetItemRefFast(__pyx_t_2, __pyx_t_3, __Pyx_ReferenceSharing_OwnStrongReference); + ++__pyx_t_3; + } else { + { + Py_ssize_t __pyx_temp = __Pyx_PyTuple_GET_SIZE(__pyx_t_2); + #if !CYTHON_ASSUME_SAFE_SIZE + if (unlikely((__pyx_temp < 0))) __PYX_ERR(1, 402, __pyx_L1_error) + #endif + if (__pyx_t_3 >= __pyx_temp) break; + } + #if CYTHON_ASSUME_SAFE_MACROS && !CYTHON_AVOID_BORROWED_REFS + __pyx_t_5 = __Pyx_NewRef(PyTuple_GET_ITEM(__pyx_t_2, __pyx_t_3)); + #else + __pyx_t_5 = __Pyx_PySequence_ITEM(__pyx_t_2, __pyx_t_3); + #endif + ++__pyx_t_3; + } + if (unlikely(!__pyx_t_5)) __PYX_ERR(1, 402, __pyx_L1_error) + } else { + __pyx_t_5 = __pyx_t_4(__pyx_t_2); + if (unlikely(!__pyx_t_5)) { + PyObject* exc_type = PyErr_Occurred(); + if (exc_type) { + if (unlikely(!__Pyx_PyErr_GivenExceptionMatches(exc_type, PyExc_StopIteration))) __PYX_ERR(1, 402, __pyx_L1_error) + PyErr_Clear(); + } + break; + } + } + __Pyx_GOTREF(__pyx_t_5); + __Pyx_XDECREF_SET(__pyx_v_idx, __pyx_t_5); + __pyx_t_5 = 0; + __pyx_v_dim = __pyx_t_1; + __pyx_t_1 = (__pyx_t_1 + 1); + + /* "View.MemoryView":403 + * + * for dim, idx in enumerate(index): + * itemp = pybuffer_index(&self.view, itemp, idx, dim) # <<<<<<<<<<<<<< + * + * return itemp +*/ + __pyx_t_6 = __Pyx_PyIndex_AsSsize_t(__pyx_v_idx); if (unlikely((__pyx_t_6 == (Py_ssize_t)-1) && PyErr_Occurred())) __PYX_ERR(1, 403, __pyx_L1_error) + __pyx_t_7 = __pyx_pybuffer_index((&__pyx_v_self->view), __pyx_v_itemp, __pyx_t_6, __pyx_v_dim); if (unlikely(__pyx_t_7 == ((void *)NULL))) __PYX_ERR(1, 403, __pyx_L1_error) + __pyx_v_itemp = __pyx_t_7; + + /* "View.MemoryView":402 + * cdef char *itemp = self.view.buf + * + * for dim, idx in enumerate(index): # <<<<<<<<<<<<<< + * itemp = pybuffer_index(&self.view, itemp, idx, dim) + * +*/ + } + __Pyx_DECREF(__pyx_t_2); __pyx_t_2 = 0; + + /* "View.MemoryView":405 + * itemp = pybuffer_index(&self.view, itemp, idx, dim) + * + * return itemp # <<<<<<<<<<<<<< + * + * +*/ + __pyx_r = __pyx_v_itemp; + goto __pyx_L0; + + /* "View.MemoryView":398 + * PyThread_free_lock(self.lock) + * + * cdef char *get_item_pointer(memoryview self, object index) except NULL: # <<<<<<<<<<<<<< + * cdef Py_ssize_t dim + * cdef char *itemp = self.view.buf +*/ + + /* function exit code */ + __pyx_L1_error:; + __Pyx_XDECREF(__pyx_t_2); + __Pyx_XDECREF(__pyx_t_5); + __Pyx_AddTraceback("View.MemoryView.memoryview.get_item_pointer", __pyx_clineno, __pyx_lineno, __pyx_filename); + __pyx_r = NULL; + __pyx_L0:; + __Pyx_XDECREF(__pyx_v_idx); + __Pyx_RefNannyFinishContext(); + return __pyx_r; +} + +/* "View.MemoryView":408 + * + * + * def __getitem__(memoryview self, object index): # <<<<<<<<<<<<<< + * if index is Ellipsis: + * return self +*/ + +/* Python wrapper */ +static PyObject *__pyx_memoryview___getitem__(PyObject *__pyx_v_self, PyObject *__pyx_v_index); /*proto*/ +static PyObject *__pyx_memoryview___getitem__(PyObject *__pyx_v_self, PyObject *__pyx_v_index) { + CYTHON_UNUSED PyObject *const *__pyx_kwvalues; + PyObject *__pyx_r = 0; + __Pyx_RefNannyDeclarations + __Pyx_RefNannySetupContext("__getitem__ (wrapper)", 0); + __pyx_kwvalues = __Pyx_KwValues_VARARGS(__pyx_args, __pyx_nargs); + __pyx_r = __pyx_memoryview___pyx_pf_15View_dot_MemoryView_10memoryview_4__getitem__(((struct __pyx_memoryview_obj *)__pyx_v_self), ((PyObject *)__pyx_v_index)); + + /* function exit code */ + __Pyx_RefNannyFinishContext(); + return __pyx_r; +} + +static PyObject *__pyx_memoryview___pyx_pf_15View_dot_MemoryView_10memoryview_4__getitem__(struct __pyx_memoryview_obj *__pyx_v_self, PyObject *__pyx_v_index) { + PyObject *__pyx_v_have_slices = NULL; + PyObject *__pyx_v_indices = NULL; + char *__pyx_v_itemp; + 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; + char *__pyx_t_5; + int __pyx_lineno = 0; + const char *__pyx_filename = NULL; + int __pyx_clineno = 0; + __Pyx_RefNannySetupContext("__getitem__", 0); + + /* "View.MemoryView":409 + * + * def __getitem__(memoryview self, object index): + * if index is Ellipsis: # <<<<<<<<<<<<<< + * return self + * +*/ + __pyx_t_1 = (__pyx_v_index == __pyx_builtin_Ellipsis); + if (__pyx_t_1) { + + /* "View.MemoryView":410 + * def __getitem__(memoryview self, object index): + * if index is Ellipsis: + * return self # <<<<<<<<<<<<<< + * + * have_slices, indices = _unellipsify(index, self.view.ndim) +*/ + __Pyx_XDECREF(__pyx_r); + __Pyx_INCREF((PyObject *)__pyx_v_self); + __pyx_r = ((PyObject *)__pyx_v_self); + goto __pyx_L0; + + /* "View.MemoryView":409 + * + * def __getitem__(memoryview self, object index): + * if index is Ellipsis: # <<<<<<<<<<<<<< + * return self + * +*/ + } + + /* "View.MemoryView":412 + * return self + * + * have_slices, indices = _unellipsify(index, self.view.ndim) # <<<<<<<<<<<<<< + * + * cdef char *itemp +*/ + __pyx_t_2 = _unellipsify(__pyx_v_index, __pyx_v_self->view.ndim); if (unlikely(!__pyx_t_2)) __PYX_ERR(1, 412, __pyx_L1_error) + __Pyx_GOTREF(__pyx_t_2); + if (likely(__pyx_t_2 != Py_None)) { + PyObject* sequence = __pyx_t_2; + Py_ssize_t size = __Pyx_PyTuple_GET_SIZE(sequence); + if (unlikely(size != 2)) { + if (size > 2) __Pyx_RaiseTooManyValuesError(2); + else if (size >= 0) __Pyx_RaiseNeedMoreValuesError(size); + __PYX_ERR(1, 412, __pyx_L1_error) + } + #if CYTHON_ASSUME_SAFE_MACROS && !CYTHON_AVOID_BORROWED_REFS + __pyx_t_3 = PyTuple_GET_ITEM(sequence, 0); + __Pyx_INCREF(__pyx_t_3); + __pyx_t_4 = PyTuple_GET_ITEM(sequence, 1); + __Pyx_INCREF(__pyx_t_4); + #else + __pyx_t_3 = __Pyx_PySequence_ITEM(sequence, 0); if (unlikely(!__pyx_t_3)) __PYX_ERR(1, 412, __pyx_L1_error) + __Pyx_GOTREF(__pyx_t_3); + __pyx_t_4 = __Pyx_PySequence_ITEM(sequence, 1); if (unlikely(!__pyx_t_4)) __PYX_ERR(1, 412, __pyx_L1_error) + __Pyx_GOTREF(__pyx_t_4); + #endif + __Pyx_DECREF(__pyx_t_2); __pyx_t_2 = 0; + } else { + __Pyx_RaiseNoneNotIterableError(); __PYX_ERR(1, 412, __pyx_L1_error) + } + __pyx_v_have_slices = __pyx_t_3; + __pyx_t_3 = 0; + __pyx_v_indices = __pyx_t_4; + __pyx_t_4 = 0; + + /* "View.MemoryView":415 + * + * cdef char *itemp + * if have_slices: # <<<<<<<<<<<<<< + * return memview_slice(self, indices) + * else: +*/ + __pyx_t_1 = __Pyx_PyObject_IsTrue(__pyx_v_have_slices); if (unlikely((__pyx_t_1 < 0))) __PYX_ERR(1, 415, __pyx_L1_error) + if (__pyx_t_1) { + + /* "View.MemoryView":416 + * cdef char *itemp + * if have_slices: + * return memview_slice(self, indices) # <<<<<<<<<<<<<< + * else: + * itemp = self.get_item_pointer(indices) +*/ + __Pyx_XDECREF(__pyx_r); + __pyx_t_2 = ((PyObject *)__pyx_memview_slice(__pyx_v_self, __pyx_v_indices)); if (unlikely(!__pyx_t_2)) __PYX_ERR(1, 416, __pyx_L1_error) + __Pyx_GOTREF(__pyx_t_2); + __pyx_r = __pyx_t_2; + __pyx_t_2 = 0; + goto __pyx_L0; + + /* "View.MemoryView":415 + * + * cdef char *itemp + * if have_slices: # <<<<<<<<<<<<<< + * return memview_slice(self, indices) + * else: +*/ + } + + /* "View.MemoryView":418 + * return memview_slice(self, indices) + * else: + * itemp = self.get_item_pointer(indices) # <<<<<<<<<<<<<< + * return self.convert_item_to_object(itemp) + * +*/ + /*else*/ { + __pyx_t_5 = ((struct __pyx_vtabstruct_memoryview *)__pyx_v_self->__pyx_vtab)->get_item_pointer(__pyx_v_self, __pyx_v_indices); if (unlikely(__pyx_t_5 == ((void *)NULL))) __PYX_ERR(1, 418, __pyx_L1_error) + __pyx_v_itemp = __pyx_t_5; + + /* "View.MemoryView":419 + * else: + * itemp = self.get_item_pointer(indices) + * return self.convert_item_to_object(itemp) # <<<<<<<<<<<<<< + * + * def __setitem__(memoryview self, object index, object value): +*/ + __Pyx_XDECREF(__pyx_r); + __pyx_t_2 = ((struct __pyx_vtabstruct_memoryview *)__pyx_v_self->__pyx_vtab)->convert_item_to_object(__pyx_v_self, __pyx_v_itemp); if (unlikely(!__pyx_t_2)) __PYX_ERR(1, 419, __pyx_L1_error) + __Pyx_GOTREF(__pyx_t_2); + __pyx_r = __pyx_t_2; + __pyx_t_2 = 0; + goto __pyx_L0; + } + + /* "View.MemoryView":408 + * + * + * def __getitem__(memoryview self, object index): # <<<<<<<<<<<<<< + * if index is Ellipsis: + * return self +*/ + + /* function exit code */ + __pyx_L1_error:; + __Pyx_XDECREF(__pyx_t_2); + __Pyx_XDECREF(__pyx_t_3); + __Pyx_XDECREF(__pyx_t_4); + __Pyx_AddTraceback("View.MemoryView.memoryview.__getitem__", __pyx_clineno, __pyx_lineno, __pyx_filename); + __pyx_r = NULL; + __pyx_L0:; + __Pyx_XDECREF(__pyx_v_have_slices); + __Pyx_XDECREF(__pyx_v_indices); + __Pyx_XGIVEREF(__pyx_r); + __Pyx_RefNannyFinishContext(); + return __pyx_r; +} + +/* "View.MemoryView":421 + * return self.convert_item_to_object(itemp) + * + * def __setitem__(memoryview self, object index, object value): # <<<<<<<<<<<<<< + * if self.view.readonly: + * raise TypeError, "Cannot assign to read-only memoryview" +*/ + +/* Python wrapper */ +static int __pyx_memoryview___setitem__(PyObject *__pyx_v_self, PyObject *__pyx_v_index, PyObject *__pyx_v_value); /*proto*/ +static int __pyx_memoryview___setitem__(PyObject *__pyx_v_self, PyObject *__pyx_v_index, PyObject *__pyx_v_value) { + CYTHON_UNUSED PyObject *const *__pyx_kwvalues; + int __pyx_r; + __Pyx_RefNannyDeclarations + __Pyx_RefNannySetupContext("__setitem__ (wrapper)", 0); + __pyx_kwvalues = __Pyx_KwValues_VARARGS(__pyx_args, __pyx_nargs); + __pyx_r = __pyx_memoryview___pyx_pf_15View_dot_MemoryView_10memoryview_6__setitem__(((struct __pyx_memoryview_obj *)__pyx_v_self), ((PyObject *)__pyx_v_index), ((PyObject *)__pyx_v_value)); + + /* function exit code */ + __Pyx_RefNannyFinishContext(); + return __pyx_r; +} + +static int __pyx_memoryview___pyx_pf_15View_dot_MemoryView_10memoryview_6__setitem__(struct __pyx_memoryview_obj *__pyx_v_self, PyObject *__pyx_v_index, PyObject *__pyx_v_value) { + PyObject *__pyx_v_have_slices = NULL; + PyObject *__pyx_v_obj = NULL; + int __pyx_r; + __Pyx_RefNannyDeclarations + PyObject *__pyx_t_1 = NULL; + PyObject *__pyx_t_2 = NULL; + PyObject *__pyx_t_3 = NULL; + int __pyx_t_4; + int __pyx_lineno = 0; + const char *__pyx_filename = NULL; + int __pyx_clineno = 0; + __Pyx_RefNannySetupContext("__setitem__", 0); + __Pyx_INCREF(__pyx_v_index); + + /* "View.MemoryView":422 + * + * def __setitem__(memoryview self, object index, object value): + * if self.view.readonly: # <<<<<<<<<<<<<< + * raise TypeError, "Cannot assign to read-only memoryview" + * +*/ + if (unlikely(__pyx_v_self->view.readonly)) { + + /* "View.MemoryView":423 + * def __setitem__(memoryview self, object index, object value): + * if self.view.readonly: + * raise TypeError, "Cannot assign to read-only memoryview" # <<<<<<<<<<<<<< + * + * have_slices, index = _unellipsify(index, self.view.ndim) +*/ + __Pyx_Raise(((PyObject *)(((PyTypeObject*)PyExc_TypeError))), __pyx_mstate_global->__pyx_kp_u_Cannot_assign_to_read_only_memor, 0, 0); + __PYX_ERR(1, 423, __pyx_L1_error) + + /* "View.MemoryView":422 + * + * def __setitem__(memoryview self, object index, object value): + * if self.view.readonly: # <<<<<<<<<<<<<< + * raise TypeError, "Cannot assign to read-only memoryview" + * +*/ + } + + /* "View.MemoryView":425 + * raise TypeError, "Cannot assign to read-only memoryview" + * + * have_slices, index = _unellipsify(index, self.view.ndim) # <<<<<<<<<<<<<< + * + * if have_slices: +*/ + __pyx_t_1 = _unellipsify(__pyx_v_index, __pyx_v_self->view.ndim); if (unlikely(!__pyx_t_1)) __PYX_ERR(1, 425, __pyx_L1_error) + __Pyx_GOTREF(__pyx_t_1); + if (likely(__pyx_t_1 != Py_None)) { + PyObject* sequence = __pyx_t_1; + Py_ssize_t size = __Pyx_PyTuple_GET_SIZE(sequence); + if (unlikely(size != 2)) { + if (size > 2) __Pyx_RaiseTooManyValuesError(2); + else if (size >= 0) __Pyx_RaiseNeedMoreValuesError(size); + __PYX_ERR(1, 425, __pyx_L1_error) + } + #if CYTHON_ASSUME_SAFE_MACROS && !CYTHON_AVOID_BORROWED_REFS + __pyx_t_2 = PyTuple_GET_ITEM(sequence, 0); + __Pyx_INCREF(__pyx_t_2); + __pyx_t_3 = PyTuple_GET_ITEM(sequence, 1); + __Pyx_INCREF(__pyx_t_3); + #else + __pyx_t_2 = __Pyx_PySequence_ITEM(sequence, 0); if (unlikely(!__pyx_t_2)) __PYX_ERR(1, 425, __pyx_L1_error) + __Pyx_GOTREF(__pyx_t_2); + __pyx_t_3 = __Pyx_PySequence_ITEM(sequence, 1); if (unlikely(!__pyx_t_3)) __PYX_ERR(1, 425, __pyx_L1_error) + __Pyx_GOTREF(__pyx_t_3); + #endif + __Pyx_DECREF(__pyx_t_1); __pyx_t_1 = 0; + } else { + __Pyx_RaiseNoneNotIterableError(); __PYX_ERR(1, 425, __pyx_L1_error) + } + __pyx_v_have_slices = __pyx_t_2; + __pyx_t_2 = 0; + __Pyx_DECREF_SET(__pyx_v_index, __pyx_t_3); + __pyx_t_3 = 0; + + /* "View.MemoryView":427 + * have_slices, index = _unellipsify(index, self.view.ndim) + * + * if have_slices: # <<<<<<<<<<<<<< + * obj = self.is_slice(value) + * if obj is not None: +*/ + __pyx_t_4 = __Pyx_PyObject_IsTrue(__pyx_v_have_slices); if (unlikely((__pyx_t_4 < 0))) __PYX_ERR(1, 427, __pyx_L1_error) + if (__pyx_t_4) { + + /* "View.MemoryView":428 + * + * if have_slices: + * obj = self.is_slice(value) # <<<<<<<<<<<<<< + * if obj is not None: + * self.setitem_slice_assignment(self[index], obj) +*/ + __pyx_t_1 = ((struct __pyx_vtabstruct_memoryview *)__pyx_v_self->__pyx_vtab)->is_slice(__pyx_v_self, __pyx_v_value); if (unlikely(!__pyx_t_1)) __PYX_ERR(1, 428, __pyx_L1_error) + __Pyx_GOTREF(__pyx_t_1); + __pyx_v_obj = __pyx_t_1; + __pyx_t_1 = 0; + + /* "View.MemoryView":429 + * if have_slices: + * obj = self.is_slice(value) + * if obj is not None: # <<<<<<<<<<<<<< + * self.setitem_slice_assignment(self[index], obj) + * else: +*/ + __pyx_t_4 = (__pyx_v_obj != Py_None); + if (__pyx_t_4) { + + /* "View.MemoryView":430 + * obj = self.is_slice(value) + * if obj is not None: + * self.setitem_slice_assignment(self[index], obj) # <<<<<<<<<<<<<< + * else: + * self.setitem_slice_assign_scalar(self[index], value) +*/ + __pyx_t_1 = __Pyx_PyObject_GetItem(((PyObject *)__pyx_v_self), __pyx_v_index); if (unlikely(!__pyx_t_1)) __PYX_ERR(1, 430, __pyx_L1_error) + __Pyx_GOTREF(__pyx_t_1); + __pyx_t_3 = ((struct __pyx_vtabstruct_memoryview *)__pyx_v_self->__pyx_vtab)->setitem_slice_assignment(__pyx_v_self, __pyx_t_1, __pyx_v_obj); if (unlikely(!__pyx_t_3)) __PYX_ERR(1, 430, __pyx_L1_error) + __Pyx_GOTREF(__pyx_t_3); + __Pyx_DECREF(__pyx_t_1); __pyx_t_1 = 0; + __Pyx_DECREF(__pyx_t_3); __pyx_t_3 = 0; + + /* "View.MemoryView":429 + * if have_slices: + * obj = self.is_slice(value) + * if obj is not None: # <<<<<<<<<<<<<< + * self.setitem_slice_assignment(self[index], obj) + * else: +*/ + goto __pyx_L5; + } + + /* "View.MemoryView":432 + * self.setitem_slice_assignment(self[index], obj) + * else: + * self.setitem_slice_assign_scalar(self[index], value) # <<<<<<<<<<<<<< + * else: + * self.setitem_indexed(index, value) +*/ + /*else*/ { + __pyx_t_3 = __Pyx_PyObject_GetItem(((PyObject *)__pyx_v_self), __pyx_v_index); if (unlikely(!__pyx_t_3)) __PYX_ERR(1, 432, __pyx_L1_error) + __Pyx_GOTREF(__pyx_t_3); + if (!(likely(((__pyx_t_3) == Py_None) || likely(__Pyx_TypeTest(__pyx_t_3, __pyx_mstate_global->__pyx_memoryview_type))))) __PYX_ERR(1, 432, __pyx_L1_error) + __pyx_t_1 = ((struct __pyx_vtabstruct_memoryview *)__pyx_v_self->__pyx_vtab)->setitem_slice_assign_scalar(__pyx_v_self, ((struct __pyx_memoryview_obj *)__pyx_t_3), __pyx_v_value); if (unlikely(!__pyx_t_1)) __PYX_ERR(1, 432, __pyx_L1_error) + __Pyx_GOTREF(__pyx_t_1); + __Pyx_DECREF(__pyx_t_3); __pyx_t_3 = 0; + __Pyx_DECREF(__pyx_t_1); __pyx_t_1 = 0; + } + __pyx_L5:; + + /* "View.MemoryView":427 + * have_slices, index = _unellipsify(index, self.view.ndim) + * + * if have_slices: # <<<<<<<<<<<<<< + * obj = self.is_slice(value) + * if obj is not None: +*/ + goto __pyx_L4; + } + + /* "View.MemoryView":434 + * self.setitem_slice_assign_scalar(self[index], value) + * else: + * self.setitem_indexed(index, value) # <<<<<<<<<<<<<< + * + * cdef is_slice(self, obj): +*/ + /*else*/ { + __pyx_t_1 = ((struct __pyx_vtabstruct_memoryview *)__pyx_v_self->__pyx_vtab)->setitem_indexed(__pyx_v_self, __pyx_v_index, __pyx_v_value); if (unlikely(!__pyx_t_1)) __PYX_ERR(1, 434, __pyx_L1_error) + __Pyx_GOTREF(__pyx_t_1); + __Pyx_DECREF(__pyx_t_1); __pyx_t_1 = 0; + } + __pyx_L4:; + + /* "View.MemoryView":421 + * return self.convert_item_to_object(itemp) + * + * def __setitem__(memoryview self, object index, object value): # <<<<<<<<<<<<<< + * if self.view.readonly: + * raise TypeError, "Cannot assign to read-only memoryview" +*/ + + /* function exit code */ + __pyx_r = 0; + goto __pyx_L0; + __pyx_L1_error:; + __Pyx_XDECREF(__pyx_t_1); + __Pyx_XDECREF(__pyx_t_2); + __Pyx_XDECREF(__pyx_t_3); + __Pyx_AddTraceback("View.MemoryView.memoryview.__setitem__", __pyx_clineno, __pyx_lineno, __pyx_filename); + __pyx_r = -1; + __pyx_L0:; + __Pyx_XDECREF(__pyx_v_have_slices); + __Pyx_XDECREF(__pyx_v_obj); + __Pyx_XDECREF(__pyx_v_index); + __Pyx_RefNannyFinishContext(); + return __pyx_r; +} + +/* "View.MemoryView":436 + * self.setitem_indexed(index, value) + * + * cdef is_slice(self, obj): # <<<<<<<<<<<<<< + * if not isinstance(obj, memoryview): + * try: +*/ + +static PyObject *__pyx_memoryview_is_slice(struct __pyx_memoryview_obj *__pyx_v_self, PyObject *__pyx_v_obj) { + PyObject *__pyx_r = NULL; + __Pyx_RefNannyDeclarations + int __pyx_t_1; + int __pyx_t_2; + PyObject *__pyx_t_3 = NULL; + PyObject *__pyx_t_4 = NULL; + PyObject *__pyx_t_5 = NULL; + PyObject *__pyx_t_6 = NULL; + PyObject *__pyx_t_7 = NULL; + PyObject *__pyx_t_8 = NULL; + PyObject *__pyx_t_9 = NULL; + size_t __pyx_t_10; + int __pyx_t_11; + int __pyx_lineno = 0; + const char *__pyx_filename = NULL; + int __pyx_clineno = 0; + __Pyx_RefNannySetupContext("is_slice", 0); + __Pyx_INCREF(__pyx_v_obj); + + /* "View.MemoryView":437 + * + * cdef is_slice(self, obj): + * if not isinstance(obj, memoryview): # <<<<<<<<<<<<<< + * try: + * obj = memoryview(obj, self.flags & ~PyBUF_WRITABLE | PyBUF_ANY_CONTIGUOUS, +*/ + __pyx_t_1 = __Pyx_TypeCheck(__pyx_v_obj, __pyx_mstate_global->__pyx_memoryview_type); + __pyx_t_2 = (!__pyx_t_1); + if (__pyx_t_2) { + + /* "View.MemoryView":438 + * cdef is_slice(self, obj): + * if not isinstance(obj, memoryview): + * try: # <<<<<<<<<<<<<< + * obj = memoryview(obj, self.flags & ~PyBUF_WRITABLE | PyBUF_ANY_CONTIGUOUS, + * self.dtype_is_object) +*/ + { + __Pyx_PyThreadState_declare + __Pyx_PyThreadState_assign + __Pyx_ExceptionSave(&__pyx_t_3, &__pyx_t_4, &__pyx_t_5); + __Pyx_XGOTREF(__pyx_t_3); + __Pyx_XGOTREF(__pyx_t_4); + __Pyx_XGOTREF(__pyx_t_5); + /*try:*/ { + + /* "View.MemoryView":439 + * if not isinstance(obj, memoryview): + * try: + * obj = memoryview(obj, self.flags & ~PyBUF_WRITABLE | PyBUF_ANY_CONTIGUOUS, # <<<<<<<<<<<<<< + * self.dtype_is_object) + * except TypeError: +*/ + __pyx_t_7 = NULL; + __pyx_t_8 = __Pyx_PyLong_From_int(((__pyx_v_self->flags & (~PyBUF_WRITABLE)) | PyBUF_ANY_CONTIGUOUS)); if (unlikely(!__pyx_t_8)) __PYX_ERR(1, 439, __pyx_L4_error) + __Pyx_GOTREF(__pyx_t_8); + + /* "View.MemoryView":440 + * try: + * obj = memoryview(obj, self.flags & ~PyBUF_WRITABLE | PyBUF_ANY_CONTIGUOUS, + * self.dtype_is_object) # <<<<<<<<<<<<<< + * except TypeError: + * return None +*/ + __pyx_t_9 = __Pyx_PyBool_FromLong(__pyx_v_self->dtype_is_object); if (unlikely(!__pyx_t_9)) __PYX_ERR(1, 440, __pyx_L4_error) + __Pyx_GOTREF(__pyx_t_9); + __pyx_t_10 = 1; + { + PyObject *__pyx_callargs[4] = {__pyx_t_7, __pyx_v_obj, __pyx_t_8, __pyx_t_9}; + __pyx_t_6 = __Pyx_PyObject_FastCall((PyObject*)__pyx_mstate_global->__pyx_memoryview_type, __pyx_callargs+__pyx_t_10, (4-__pyx_t_10) | (__pyx_t_10*__Pyx_PY_VECTORCALL_ARGUMENTS_OFFSET)); + __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; + if (unlikely(!__pyx_t_6)) __PYX_ERR(1, 439, __pyx_L4_error) + __Pyx_GOTREF((PyObject *)__pyx_t_6); + } + __Pyx_DECREF_SET(__pyx_v_obj, ((PyObject *)__pyx_t_6)); + __pyx_t_6 = 0; + + /* "View.MemoryView":438 + * cdef is_slice(self, obj): + * if not isinstance(obj, memoryview): + * try: # <<<<<<<<<<<<<< + * obj = memoryview(obj, self.flags & ~PyBUF_WRITABLE | PyBUF_ANY_CONTIGUOUS, + * self.dtype_is_object) +*/ + } + __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; + goto __pyx_L9_try_end; + __pyx_L4_error:; + __Pyx_XDECREF(__pyx_t_6); __pyx_t_6 = 0; + __Pyx_XDECREF(__pyx_t_7); __pyx_t_7 = 0; + __Pyx_XDECREF(__pyx_t_8); __pyx_t_8 = 0; + __Pyx_XDECREF(__pyx_t_9); __pyx_t_9 = 0; + + /* "View.MemoryView":441 + * obj = memoryview(obj, self.flags & ~PyBUF_WRITABLE | PyBUF_ANY_CONTIGUOUS, + * self.dtype_is_object) + * except TypeError: # <<<<<<<<<<<<<< + * return None + * +*/ + __pyx_t_11 = __Pyx_PyErr_ExceptionMatches(((PyObject *)(((PyTypeObject*)PyExc_TypeError)))); + if (__pyx_t_11) { + __Pyx_ErrRestore(0,0,0); + + /* "View.MemoryView":442 + * self.dtype_is_object) + * except TypeError: + * return None # <<<<<<<<<<<<<< + * + * return obj +*/ + __Pyx_XDECREF(__pyx_r); + __pyx_r = Py_None; __Pyx_INCREF(Py_None); + goto __pyx_L7_except_return; + } + goto __pyx_L6_except_error; + + /* "View.MemoryView":438 + * cdef is_slice(self, obj): + * if not isinstance(obj, memoryview): + * try: # <<<<<<<<<<<<<< + * obj = memoryview(obj, self.flags & ~PyBUF_WRITABLE | PyBUF_ANY_CONTIGUOUS, + * self.dtype_is_object) +*/ + __pyx_L6_except_error:; + __Pyx_XGIVEREF(__pyx_t_3); + __Pyx_XGIVEREF(__pyx_t_4); + __Pyx_XGIVEREF(__pyx_t_5); + __Pyx_ExceptionReset(__pyx_t_3, __pyx_t_4, __pyx_t_5); + goto __pyx_L1_error; + __pyx_L7_except_return:; + __Pyx_XGIVEREF(__pyx_t_3); + __Pyx_XGIVEREF(__pyx_t_4); + __Pyx_XGIVEREF(__pyx_t_5); + __Pyx_ExceptionReset(__pyx_t_3, __pyx_t_4, __pyx_t_5); + goto __pyx_L0; + __pyx_L9_try_end:; + } + + /* "View.MemoryView":437 + * + * cdef is_slice(self, obj): + * if not isinstance(obj, memoryview): # <<<<<<<<<<<<<< + * try: + * obj = memoryview(obj, self.flags & ~PyBUF_WRITABLE | PyBUF_ANY_CONTIGUOUS, +*/ + } + + /* "View.MemoryView":444 + * return None + * + * return obj # <<<<<<<<<<<<<< + * + * cdef setitem_slice_assignment(self, dst, src): +*/ + __Pyx_XDECREF(__pyx_r); + __Pyx_INCREF(__pyx_v_obj); + __pyx_r = __pyx_v_obj; + goto __pyx_L0; + + /* "View.MemoryView":436 + * self.setitem_indexed(index, value) + * + * cdef is_slice(self, obj): # <<<<<<<<<<<<<< + * if not isinstance(obj, memoryview): + * try: +*/ + + /* function exit code */ + __pyx_L1_error:; + __Pyx_XDECREF(__pyx_t_6); + __Pyx_XDECREF(__pyx_t_7); + __Pyx_XDECREF(__pyx_t_8); + __Pyx_XDECREF(__pyx_t_9); + __Pyx_AddTraceback("View.MemoryView.memoryview.is_slice", __pyx_clineno, __pyx_lineno, __pyx_filename); + __pyx_r = 0; + __pyx_L0:; + __Pyx_XDECREF(__pyx_v_obj); + __Pyx_XGIVEREF(__pyx_r); + __Pyx_RefNannyFinishContext(); + return __pyx_r; +} + +/* "View.MemoryView":446 + * return obj + * + * cdef setitem_slice_assignment(self, dst, src): # <<<<<<<<<<<<<< + * cdef __Pyx_memviewslice dst_slice + * cdef __Pyx_memviewslice src_slice +*/ + +static PyObject *__pyx_memoryview_setitem_slice_assignment(struct __pyx_memoryview_obj *__pyx_v_self, PyObject *__pyx_v_dst, PyObject *__pyx_v_src) { + __Pyx_memviewslice __pyx_v_dst_slice; + __Pyx_memviewslice __pyx_v_src_slice; + __Pyx_memviewslice __pyx_v_msrc; + __Pyx_memviewslice __pyx_v_mdst; + PyObject *__pyx_r = NULL; + __Pyx_RefNannyDeclarations + __Pyx_memviewslice *__pyx_t_1; + PyObject *__pyx_t_2 = NULL; + int __pyx_t_3; + int __pyx_t_4; + int __pyx_t_5; + int __pyx_lineno = 0; + const char *__pyx_filename = NULL; + int __pyx_clineno = 0; + __Pyx_RefNannySetupContext("setitem_slice_assignment", 0); + + /* "View.MemoryView":449 + * cdef __Pyx_memviewslice dst_slice + * cdef __Pyx_memviewslice src_slice + * cdef __Pyx_memviewslice msrc = get_slice_from_memview(src, &src_slice)[0] # <<<<<<<<<<<<<< + * cdef __Pyx_memviewslice mdst = get_slice_from_memview(dst, &dst_slice)[0] + * +*/ + if (!(likely(((__pyx_v_src) == Py_None) || likely(__Pyx_TypeTest(__pyx_v_src, __pyx_mstate_global->__pyx_memoryview_type))))) __PYX_ERR(1, 449, __pyx_L1_error) + __pyx_t_1 = __pyx_memoryview_get_slice_from_memoryview(((struct __pyx_memoryview_obj *)__pyx_v_src), (&__pyx_v_src_slice)); if (unlikely(__pyx_t_1 == ((void *)NULL))) __PYX_ERR(1, 449, __pyx_L1_error) + __pyx_v_msrc = (__pyx_t_1[0]); + + /* "View.MemoryView":450 + * cdef __Pyx_memviewslice src_slice + * cdef __Pyx_memviewslice msrc = get_slice_from_memview(src, &src_slice)[0] + * cdef __Pyx_memviewslice mdst = get_slice_from_memview(dst, &dst_slice)[0] # <<<<<<<<<<<<<< + * + * memoryview_copy_contents(msrc, mdst, src.ndim, dst.ndim, self.dtype_is_object) +*/ + if (!(likely(((__pyx_v_dst) == Py_None) || likely(__Pyx_TypeTest(__pyx_v_dst, __pyx_mstate_global->__pyx_memoryview_type))))) __PYX_ERR(1, 450, __pyx_L1_error) + __pyx_t_1 = __pyx_memoryview_get_slice_from_memoryview(((struct __pyx_memoryview_obj *)__pyx_v_dst), (&__pyx_v_dst_slice)); if (unlikely(__pyx_t_1 == ((void *)NULL))) __PYX_ERR(1, 450, __pyx_L1_error) + __pyx_v_mdst = (__pyx_t_1[0]); + + /* "View.MemoryView":452 + * cdef __Pyx_memviewslice mdst = get_slice_from_memview(dst, &dst_slice)[0] + * + * memoryview_copy_contents(msrc, mdst, src.ndim, dst.ndim, self.dtype_is_object) # <<<<<<<<<<<<<< + * + * cdef setitem_slice_assign_scalar(self, memoryview dst, value): +*/ + __pyx_t_2 = __Pyx_PyObject_GetAttrStr(__pyx_v_src, __pyx_mstate_global->__pyx_n_u_ndim); if (unlikely(!__pyx_t_2)) __PYX_ERR(1, 452, __pyx_L1_error) + __Pyx_GOTREF(__pyx_t_2); + __pyx_t_3 = __Pyx_PyLong_As_int(__pyx_t_2); if (unlikely((__pyx_t_3 == (int)-1) && PyErr_Occurred())) __PYX_ERR(1, 452, __pyx_L1_error) + __Pyx_DECREF(__pyx_t_2); __pyx_t_2 = 0; + __pyx_t_2 = __Pyx_PyObject_GetAttrStr(__pyx_v_dst, __pyx_mstate_global->__pyx_n_u_ndim); if (unlikely(!__pyx_t_2)) __PYX_ERR(1, 452, __pyx_L1_error) + __Pyx_GOTREF(__pyx_t_2); + __pyx_t_4 = __Pyx_PyLong_As_int(__pyx_t_2); if (unlikely((__pyx_t_4 == (int)-1) && PyErr_Occurred())) __PYX_ERR(1, 452, __pyx_L1_error) + __Pyx_DECREF(__pyx_t_2); __pyx_t_2 = 0; + __pyx_t_5 = __pyx_memoryview_copy_contents(__pyx_v_msrc, __pyx_v_mdst, __pyx_t_3, __pyx_t_4, __pyx_v_self->dtype_is_object); if (unlikely(__pyx_t_5 == ((int)-1))) __PYX_ERR(1, 452, __pyx_L1_error) + + /* "View.MemoryView":446 + * return obj + * + * cdef setitem_slice_assignment(self, dst, src): # <<<<<<<<<<<<<< + * cdef __Pyx_memviewslice dst_slice + * cdef __Pyx_memviewslice src_slice +*/ + + /* function exit code */ + __pyx_r = Py_None; __Pyx_INCREF(Py_None); + goto __pyx_L0; + __pyx_L1_error:; + __Pyx_XDECREF(__pyx_t_2); + __Pyx_AddTraceback("View.MemoryView.memoryview.setitem_slice_assignment", __pyx_clineno, __pyx_lineno, __pyx_filename); + __pyx_r = 0; + __pyx_L0:; + __Pyx_XGIVEREF(__pyx_r); + __Pyx_RefNannyFinishContext(); + return __pyx_r; +} + +/* "View.MemoryView":454 + * memoryview_copy_contents(msrc, mdst, src.ndim, dst.ndim, self.dtype_is_object) + * + * cdef setitem_slice_assign_scalar(self, memoryview dst, value): # <<<<<<<<<<<<<< + * cdef int array[128] + * cdef void *tmp = NULL +*/ + +static PyObject *__pyx_memoryview_setitem_slice_assign_scalar(struct __pyx_memoryview_obj *__pyx_v_self, struct __pyx_memoryview_obj *__pyx_v_dst, PyObject *__pyx_v_value) { + int __pyx_v_array[128]; + void *__pyx_v_tmp; + void *__pyx_v_item; + __Pyx_memviewslice *__pyx_v_dst_slice; + __Pyx_memviewslice __pyx_v_tmp_slice; + PyObject *__pyx_r = NULL; + __Pyx_RefNannyDeclarations + __Pyx_memviewslice *__pyx_t_1; + int __pyx_t_2; + PyObject *__pyx_t_3 = NULL; + int __pyx_t_4; + int __pyx_t_5; + char const *__pyx_t_6; + PyObject *__pyx_t_7 = NULL; + PyObject *__pyx_t_8 = NULL; + PyObject *__pyx_t_9 = NULL; + PyObject *__pyx_t_10 = NULL; + PyObject *__pyx_t_11 = NULL; + PyObject *__pyx_t_12 = NULL; + int __pyx_lineno = 0; + const char *__pyx_filename = NULL; + int __pyx_clineno = 0; + __Pyx_RefNannySetupContext("setitem_slice_assign_scalar", 0); + + /* "View.MemoryView":456 + * cdef setitem_slice_assign_scalar(self, memoryview dst, value): + * cdef int array[128] + * cdef void *tmp = NULL # <<<<<<<<<<<<<< + * cdef void *item + * +*/ + __pyx_v_tmp = NULL; + + /* "View.MemoryView":461 + * cdef __Pyx_memviewslice *dst_slice + * cdef __Pyx_memviewslice tmp_slice + * dst_slice = get_slice_from_memview(dst, &tmp_slice) # <<<<<<<<<<<<<< + * + * if self.view.itemsize > sizeof(array): +*/ + __pyx_t_1 = __pyx_memoryview_get_slice_from_memoryview(__pyx_v_dst, (&__pyx_v_tmp_slice)); if (unlikely(__pyx_t_1 == ((void *)NULL))) __PYX_ERR(1, 461, __pyx_L1_error) + __pyx_v_dst_slice = __pyx_t_1; + + /* "View.MemoryView":463 + * dst_slice = get_slice_from_memview(dst, &tmp_slice) + * + * if self.view.itemsize > sizeof(array): # <<<<<<<<<<<<<< + * tmp = PyMem_Malloc(self.view.itemsize) + * if tmp == NULL: +*/ + __pyx_t_2 = (((size_t)__pyx_v_self->view.itemsize) > (sizeof(__pyx_v_array))); + if (__pyx_t_2) { + + /* "View.MemoryView":464 + * + * if self.view.itemsize > sizeof(array): + * tmp = PyMem_Malloc(self.view.itemsize) # <<<<<<<<<<<<<< + * if tmp == NULL: + * raise MemoryError +*/ + __pyx_v_tmp = PyMem_Malloc(__pyx_v_self->view.itemsize); + + /* "View.MemoryView":465 + * if self.view.itemsize > sizeof(array): + * tmp = PyMem_Malloc(self.view.itemsize) + * if tmp == NULL: # <<<<<<<<<<<<<< + * raise MemoryError + * item = tmp +*/ + __pyx_t_2 = (__pyx_v_tmp == NULL); + if (unlikely(__pyx_t_2)) { + + /* "View.MemoryView":466 + * tmp = PyMem_Malloc(self.view.itemsize) + * if tmp == NULL: + * raise MemoryError # <<<<<<<<<<<<<< + * item = tmp + * else: +*/ + PyErr_NoMemory(); __PYX_ERR(1, 466, __pyx_L1_error) + + /* "View.MemoryView":465 + * if self.view.itemsize > sizeof(array): + * tmp = PyMem_Malloc(self.view.itemsize) + * if tmp == NULL: # <<<<<<<<<<<<<< + * raise MemoryError + * item = tmp +*/ + } + + /* "View.MemoryView":467 + * if tmp == NULL: + * raise MemoryError + * item = tmp # <<<<<<<<<<<<<< + * else: + * item = array +*/ + __pyx_v_item = __pyx_v_tmp; + + /* "View.MemoryView":463 + * dst_slice = get_slice_from_memview(dst, &tmp_slice) + * + * if self.view.itemsize > sizeof(array): # <<<<<<<<<<<<<< + * tmp = PyMem_Malloc(self.view.itemsize) + * if tmp == NULL: +*/ + goto __pyx_L3; + } + + /* "View.MemoryView":469 + * item = tmp + * else: + * item = array # <<<<<<<<<<<<<< + * + * try: +*/ + /*else*/ { + __pyx_v_item = ((void *)__pyx_v_array); + } + __pyx_L3:; + + /* "View.MemoryView":471 + * item = array + * + * try: # <<<<<<<<<<<<<< + * if self.dtype_is_object: + * ( item)[0] = value +*/ + /*try:*/ { + + /* "View.MemoryView":472 + * + * try: + * if self.dtype_is_object: # <<<<<<<<<<<<<< + * ( item)[0] = value + * else: +*/ + if (__pyx_v_self->dtype_is_object) { + + /* "View.MemoryView":473 + * try: + * if self.dtype_is_object: + * ( item)[0] = value # <<<<<<<<<<<<<< + * else: + * self.assign_item_from_object( item, value) +*/ + (((PyObject **)__pyx_v_item)[0]) = ((PyObject *)__pyx_v_value); + + /* "View.MemoryView":472 + * + * try: + * if self.dtype_is_object: # <<<<<<<<<<<<<< + * ( item)[0] = value + * else: +*/ + goto __pyx_L8; + } + + /* "View.MemoryView":475 + * ( item)[0] = value + * else: + * self.assign_item_from_object( item, value) # <<<<<<<<<<<<<< + * + * +*/ + /*else*/ { + __pyx_t_3 = ((struct __pyx_vtabstruct_memoryview *)__pyx_v_self->__pyx_vtab)->assign_item_from_object(__pyx_v_self, ((char *)__pyx_v_item), __pyx_v_value); if (unlikely(!__pyx_t_3)) __PYX_ERR(1, 475, __pyx_L6_error) + __Pyx_GOTREF(__pyx_t_3); + __Pyx_DECREF(__pyx_t_3); __pyx_t_3 = 0; + } + __pyx_L8:; + + /* "View.MemoryView":479 + * + * + * if self.view.suboffsets != NULL: # <<<<<<<<<<<<<< + * assert_direct_dimensions(self.view.suboffsets, self.view.ndim) + * slice_assign_scalar(dst_slice, dst.view.ndim, self.view.itemsize, +*/ + __pyx_t_2 = (__pyx_v_self->view.suboffsets != NULL); + if (__pyx_t_2) { + + /* "View.MemoryView":480 + * + * if self.view.suboffsets != NULL: + * assert_direct_dimensions(self.view.suboffsets, self.view.ndim) # <<<<<<<<<<<<<< + * slice_assign_scalar(dst_slice, dst.view.ndim, self.view.itemsize, + * item, self.dtype_is_object) +*/ + __pyx_t_4 = assert_direct_dimensions(__pyx_v_self->view.suboffsets, __pyx_v_self->view.ndim); if (unlikely(__pyx_t_4 == ((int)-1))) __PYX_ERR(1, 480, __pyx_L6_error) + + /* "View.MemoryView":479 + * + * + * if self.view.suboffsets != NULL: # <<<<<<<<<<<<<< + * assert_direct_dimensions(self.view.suboffsets, self.view.ndim) + * slice_assign_scalar(dst_slice, dst.view.ndim, self.view.itemsize, +*/ + } + + /* "View.MemoryView":481 + * if self.view.suboffsets != NULL: + * assert_direct_dimensions(self.view.suboffsets, self.view.ndim) + * slice_assign_scalar(dst_slice, dst.view.ndim, self.view.itemsize, # <<<<<<<<<<<<<< + * item, self.dtype_is_object) + * finally: +*/ + __pyx_memoryview_slice_assign_scalar(__pyx_v_dst_slice, __pyx_v_dst->view.ndim, __pyx_v_self->view.itemsize, __pyx_v_item, __pyx_v_self->dtype_is_object); + } + + /* "View.MemoryView":484 + * item, self.dtype_is_object) + * finally: + * PyMem_Free(tmp) # <<<<<<<<<<<<<< + * + * cdef setitem_indexed(self, index, value): +*/ + /*finally:*/ { + /*normal exit:*/{ + PyMem_Free(__pyx_v_tmp); + goto __pyx_L7; + } + __pyx_L6_error:; + /*exception exit:*/{ + __Pyx_PyThreadState_declare + __Pyx_PyThreadState_assign + __pyx_t_7 = 0; __pyx_t_8 = 0; __pyx_t_9 = 0; __pyx_t_10 = 0; __pyx_t_11 = 0; __pyx_t_12 = 0; + __Pyx_XDECREF(__pyx_t_3); __pyx_t_3 = 0; + __Pyx_ExceptionSwap(&__pyx_t_10, &__pyx_t_11, &__pyx_t_12); + if ( unlikely(__Pyx_GetException(&__pyx_t_7, &__pyx_t_8, &__pyx_t_9) < 0)) __Pyx_ErrFetch(&__pyx_t_7, &__pyx_t_8, &__pyx_t_9); + __Pyx_XGOTREF(__pyx_t_7); + __Pyx_XGOTREF(__pyx_t_8); + __Pyx_XGOTREF(__pyx_t_9); + __Pyx_XGOTREF(__pyx_t_10); + __Pyx_XGOTREF(__pyx_t_11); + __Pyx_XGOTREF(__pyx_t_12); + __pyx_t_4 = __pyx_lineno; __pyx_t_5 = __pyx_clineno; __pyx_t_6 = __pyx_filename; + { + PyMem_Free(__pyx_v_tmp); + } + __Pyx_XGIVEREF(__pyx_t_10); + __Pyx_XGIVEREF(__pyx_t_11); + __Pyx_XGIVEREF(__pyx_t_12); + __Pyx_ExceptionReset(__pyx_t_10, __pyx_t_11, __pyx_t_12); + __Pyx_XGIVEREF(__pyx_t_7); + __Pyx_XGIVEREF(__pyx_t_8); + __Pyx_XGIVEREF(__pyx_t_9); + __Pyx_ErrRestore(__pyx_t_7, __pyx_t_8, __pyx_t_9); + __pyx_t_7 = 0; __pyx_t_8 = 0; __pyx_t_9 = 0; __pyx_t_10 = 0; __pyx_t_11 = 0; __pyx_t_12 = 0; + __pyx_lineno = __pyx_t_4; __pyx_clineno = __pyx_t_5; __pyx_filename = __pyx_t_6; + goto __pyx_L1_error; + } + __pyx_L7:; + } + + /* "View.MemoryView":454 + * memoryview_copy_contents(msrc, mdst, src.ndim, dst.ndim, self.dtype_is_object) + * + * cdef setitem_slice_assign_scalar(self, memoryview dst, value): # <<<<<<<<<<<<<< + * cdef int array[128] + * cdef void *tmp = NULL +*/ + + /* function exit code */ + __pyx_r = Py_None; __Pyx_INCREF(Py_None); + goto __pyx_L0; + __pyx_L1_error:; + __Pyx_XDECREF(__pyx_t_3); + __Pyx_AddTraceback("View.MemoryView.memoryview.setitem_slice_assign_scalar", __pyx_clineno, __pyx_lineno, __pyx_filename); + __pyx_r = 0; + __pyx_L0:; + __Pyx_XGIVEREF(__pyx_r); + __Pyx_RefNannyFinishContext(); + return __pyx_r; +} + +/* "View.MemoryView":486 + * PyMem_Free(tmp) + * + * cdef setitem_indexed(self, index, value): # <<<<<<<<<<<<<< + * cdef char *itemp = self.get_item_pointer(index) + * self.assign_item_from_object(itemp, value) +*/ + +static PyObject *__pyx_memoryview_setitem_indexed(struct __pyx_memoryview_obj *__pyx_v_self, PyObject *__pyx_v_index, PyObject *__pyx_v_value) { + char *__pyx_v_itemp; + PyObject *__pyx_r = NULL; + __Pyx_RefNannyDeclarations + char *__pyx_t_1; + PyObject *__pyx_t_2 = NULL; + int __pyx_lineno = 0; + const char *__pyx_filename = NULL; + int __pyx_clineno = 0; + __Pyx_RefNannySetupContext("setitem_indexed", 0); + + /* "View.MemoryView":487 + * + * cdef setitem_indexed(self, index, value): + * cdef char *itemp = self.get_item_pointer(index) # <<<<<<<<<<<<<< + * self.assign_item_from_object(itemp, value) + * +*/ + __pyx_t_1 = ((struct __pyx_vtabstruct_memoryview *)__pyx_v_self->__pyx_vtab)->get_item_pointer(__pyx_v_self, __pyx_v_index); if (unlikely(__pyx_t_1 == ((void *)NULL))) __PYX_ERR(1, 487, __pyx_L1_error) + __pyx_v_itemp = __pyx_t_1; + + /* "View.MemoryView":488 + * cdef setitem_indexed(self, index, value): + * cdef char *itemp = self.get_item_pointer(index) + * self.assign_item_from_object(itemp, value) # <<<<<<<<<<<<<< + * + * cdef convert_item_to_object(self, char *itemp): +*/ + __pyx_t_2 = ((struct __pyx_vtabstruct_memoryview *)__pyx_v_self->__pyx_vtab)->assign_item_from_object(__pyx_v_self, __pyx_v_itemp, __pyx_v_value); if (unlikely(!__pyx_t_2)) __PYX_ERR(1, 488, __pyx_L1_error) + __Pyx_GOTREF(__pyx_t_2); + __Pyx_DECREF(__pyx_t_2); __pyx_t_2 = 0; + + /* "View.MemoryView":486 + * PyMem_Free(tmp) + * + * cdef setitem_indexed(self, index, value): # <<<<<<<<<<<<<< + * cdef char *itemp = self.get_item_pointer(index) + * self.assign_item_from_object(itemp, value) +*/ + + /* function exit code */ + __pyx_r = Py_None; __Pyx_INCREF(Py_None); + goto __pyx_L0; + __pyx_L1_error:; + __Pyx_XDECREF(__pyx_t_2); + __Pyx_AddTraceback("View.MemoryView.memoryview.setitem_indexed", __pyx_clineno, __pyx_lineno, __pyx_filename); + __pyx_r = 0; + __pyx_L0:; + __Pyx_XGIVEREF(__pyx_r); + __Pyx_RefNannyFinishContext(); + return __pyx_r; +} + +/* "View.MemoryView":490 + * self.assign_item_from_object(itemp, value) + * + * cdef convert_item_to_object(self, char *itemp): # <<<<<<<<<<<<<< + * """Only used if instantiated manually by the user, or if Cython doesn't + * know how to convert the type""" +*/ + +static PyObject *__pyx_memoryview_convert_item_to_object(struct __pyx_memoryview_obj *__pyx_v_self, char *__pyx_v_itemp) { + PyObject *__pyx_v_struct = NULL; + PyObject *__pyx_v_bytesitem = 0; + PyObject *__pyx_v_result = NULL; + PyObject *__pyx_r = NULL; + __Pyx_RefNannyDeclarations + PyObject *__pyx_t_1 = NULL; + PyObject *__pyx_t_2 = NULL; + PyObject *__pyx_t_3 = NULL; + PyObject *__pyx_t_4 = NULL; + PyObject *__pyx_t_5 = NULL; + PyObject *__pyx_t_6 = NULL; + size_t __pyx_t_7; + Py_ssize_t __pyx_t_8; + int __pyx_t_9; + PyObject *__pyx_t_10 = NULL; + int __pyx_t_11; + int __pyx_lineno = 0; + const char *__pyx_filename = NULL; + int __pyx_clineno = 0; + __Pyx_RefNannySetupContext("convert_item_to_object", 0); + + /* "View.MemoryView":493 + * """Only used if instantiated manually by the user, or if Cython doesn't + * know how to convert the type""" + * import struct # <<<<<<<<<<<<<< + * cdef bytes bytesitem + * +*/ + __pyx_t_2 = __Pyx_Import(__pyx_mstate_global->__pyx_n_u_struct, 0, 0, NULL, 0); if (unlikely(!__pyx_t_2)) __PYX_ERR(1, 493, __pyx_L1_error) + __pyx_t_1 = __pyx_t_2; + __Pyx_GOTREF(__pyx_t_1); + __pyx_v_struct = __pyx_t_1; + __pyx_t_1 = 0; + + /* "View.MemoryView":496 + * cdef bytes bytesitem + * + * bytesitem = itemp[:self.view.itemsize] # <<<<<<<<<<<<<< + * try: + * result = struct.unpack(self.view.format, bytesitem) +*/ + __pyx_t_1 = __Pyx_PyBytes_FromStringAndSize(__pyx_v_itemp + 0, __pyx_v_self->view.itemsize - 0); if (unlikely(!__pyx_t_1)) __PYX_ERR(1, 496, __pyx_L1_error) + __Pyx_GOTREF(__pyx_t_1); + __pyx_v_bytesitem = ((PyObject*)__pyx_t_1); + __pyx_t_1 = 0; + + /* "View.MemoryView":497 + * + * bytesitem = itemp[:self.view.itemsize] + * try: # <<<<<<<<<<<<<< + * result = struct.unpack(self.view.format, bytesitem) + * except struct.error: +*/ + { + __Pyx_PyThreadState_declare + __Pyx_PyThreadState_assign + __Pyx_ExceptionSave(&__pyx_t_2, &__pyx_t_3, &__pyx_t_4); + __Pyx_XGOTREF(__pyx_t_2); + __Pyx_XGOTREF(__pyx_t_3); + __Pyx_XGOTREF(__pyx_t_4); + /*try:*/ { + + /* "View.MemoryView":498 + * bytesitem = itemp[:self.view.itemsize] + * try: + * result = struct.unpack(self.view.format, bytesitem) # <<<<<<<<<<<<<< + * except struct.error: + * raise ValueError, "Unable to convert item to object" +*/ + __pyx_t_5 = __pyx_v_struct; + __Pyx_INCREF(__pyx_t_5); + __pyx_t_6 = __Pyx_PyBytes_FromString(__pyx_v_self->view.format); if (unlikely(!__pyx_t_6)) __PYX_ERR(1, 498, __pyx_L3_error) + __Pyx_GOTREF(__pyx_t_6); + __pyx_t_7 = 0; + { + PyObject *__pyx_callargs[3] = {__pyx_t_5, __pyx_t_6, __pyx_v_bytesitem}; + __pyx_t_1 = __Pyx_PyObject_FastCallMethod((PyObject*)__pyx_mstate_global->__pyx_n_u_unpack, __pyx_callargs+__pyx_t_7, (3-__pyx_t_7) | (1*__Pyx_PY_VECTORCALL_ARGUMENTS_OFFSET)); + __Pyx_XDECREF(__pyx_t_5); __pyx_t_5 = 0; + __Pyx_DECREF(__pyx_t_6); __pyx_t_6 = 0; + if (unlikely(!__pyx_t_1)) __PYX_ERR(1, 498, __pyx_L3_error) + __Pyx_GOTREF(__pyx_t_1); + } + __pyx_v_result = __pyx_t_1; + __pyx_t_1 = 0; + + /* "View.MemoryView":497 + * + * bytesitem = itemp[:self.view.itemsize] + * try: # <<<<<<<<<<<<<< + * result = struct.unpack(self.view.format, bytesitem) + * except struct.error: +*/ + } + + /* "View.MemoryView":502 + * raise ValueError, "Unable to convert item to object" + * else: + * if len(self.view.format) == 1: # <<<<<<<<<<<<<< + * return result[0] + * return result +*/ + /*else:*/ { + __pyx_t_8 = __Pyx_ssize_strlen(__pyx_v_self->view.format); if (unlikely(__pyx_t_8 == ((Py_ssize_t)-1))) __PYX_ERR(1, 502, __pyx_L5_except_error) + __pyx_t_9 = (__pyx_t_8 == 1); + if (__pyx_t_9) { + + /* "View.MemoryView":503 + * else: + * if len(self.view.format) == 1: + * return result[0] # <<<<<<<<<<<<<< + * return result + * +*/ + __Pyx_XDECREF(__pyx_r); + __pyx_t_1 = __Pyx_GetItemInt(__pyx_v_result, 0, long, 1, __Pyx_PyLong_From_long, 0, 0, 1, 1, __Pyx_ReferenceSharing_OwnStrongReference); if (unlikely(!__pyx_t_1)) __PYX_ERR(1, 503, __pyx_L5_except_error) + __Pyx_GOTREF(__pyx_t_1); + __pyx_r = __pyx_t_1; + __pyx_t_1 = 0; + goto __pyx_L6_except_return; + + /* "View.MemoryView":502 + * raise ValueError, "Unable to convert item to object" + * else: + * if len(self.view.format) == 1: # <<<<<<<<<<<<<< + * return result[0] + * return result +*/ + } + + /* "View.MemoryView":504 + * if len(self.view.format) == 1: + * return result[0] + * return result # <<<<<<<<<<<<<< + * + * cdef assign_item_from_object(self, char *itemp, object value): +*/ + __Pyx_XDECREF(__pyx_r); + __Pyx_INCREF(__pyx_v_result); + __pyx_r = __pyx_v_result; + goto __pyx_L6_except_return; + } + __pyx_L3_error:; + __Pyx_XDECREF(__pyx_t_1); __pyx_t_1 = 0; + __Pyx_XDECREF(__pyx_t_5); __pyx_t_5 = 0; + __Pyx_XDECREF(__pyx_t_6); __pyx_t_6 = 0; + + /* "View.MemoryView":499 + * try: + * result = struct.unpack(self.view.format, bytesitem) + * except struct.error: # <<<<<<<<<<<<<< + * raise ValueError, "Unable to convert item to object" + * else: +*/ + __Pyx_ErrFetch(&__pyx_t_1, &__pyx_t_6, &__pyx_t_5); + __pyx_t_10 = __Pyx_PyObject_GetAttrStr(__pyx_v_struct, __pyx_mstate_global->__pyx_n_u_error); if (unlikely(!__pyx_t_10)) __PYX_ERR(1, 499, __pyx_L5_except_error) + __Pyx_GOTREF(__pyx_t_10); + __pyx_t_11 = __Pyx_PyErr_GivenExceptionMatches(__pyx_t_1, __pyx_t_10); + __Pyx_DECREF(__pyx_t_10); __pyx_t_10 = 0; + __Pyx_ErrRestore(__pyx_t_1, __pyx_t_6, __pyx_t_5); + __pyx_t_1 = 0; __pyx_t_6 = 0; __pyx_t_5 = 0; + if (__pyx_t_11) { + __Pyx_AddTraceback("View.MemoryView.memoryview.convert_item_to_object", __pyx_clineno, __pyx_lineno, __pyx_filename); + if (__Pyx_GetException(&__pyx_t_5, &__pyx_t_6, &__pyx_t_1) < 0) __PYX_ERR(1, 499, __pyx_L5_except_error) + __Pyx_XGOTREF(__pyx_t_5); + __Pyx_XGOTREF(__pyx_t_6); + __Pyx_XGOTREF(__pyx_t_1); + + /* "View.MemoryView":500 + * result = struct.unpack(self.view.format, bytesitem) + * except struct.error: + * raise ValueError, "Unable to convert item to object" # <<<<<<<<<<<<<< + * else: + * if len(self.view.format) == 1: +*/ + __Pyx_Raise(((PyObject *)(((PyTypeObject*)PyExc_ValueError))), __pyx_mstate_global->__pyx_kp_u_Unable_to_convert_item_to_object, 0, 0); + __PYX_ERR(1, 500, __pyx_L5_except_error) + } + goto __pyx_L5_except_error; + + /* "View.MemoryView":497 + * + * bytesitem = itemp[:self.view.itemsize] + * try: # <<<<<<<<<<<<<< + * result = struct.unpack(self.view.format, bytesitem) + * except struct.error: +*/ + __pyx_L5_except_error:; + __Pyx_XGIVEREF(__pyx_t_2); + __Pyx_XGIVEREF(__pyx_t_3); + __Pyx_XGIVEREF(__pyx_t_4); + __Pyx_ExceptionReset(__pyx_t_2, __pyx_t_3, __pyx_t_4); + goto __pyx_L1_error; + __pyx_L6_except_return:; + __Pyx_XGIVEREF(__pyx_t_2); + __Pyx_XGIVEREF(__pyx_t_3); + __Pyx_XGIVEREF(__pyx_t_4); + __Pyx_ExceptionReset(__pyx_t_2, __pyx_t_3, __pyx_t_4); + goto __pyx_L0; + } + + /* "View.MemoryView":490 + * self.assign_item_from_object(itemp, value) + * + * cdef convert_item_to_object(self, char *itemp): # <<<<<<<<<<<<<< + * """Only used if instantiated manually by the user, or if Cython doesn't + * know how to convert the type""" +*/ + + /* function exit code */ + __pyx_L1_error:; + __Pyx_XDECREF(__pyx_t_1); + __Pyx_XDECREF(__pyx_t_5); + __Pyx_XDECREF(__pyx_t_6); + __Pyx_XDECREF(__pyx_t_10); + __Pyx_AddTraceback("View.MemoryView.memoryview.convert_item_to_object", __pyx_clineno, __pyx_lineno, __pyx_filename); + __pyx_r = 0; + __pyx_L0:; + __Pyx_XDECREF(__pyx_v_struct); + __Pyx_XDECREF(__pyx_v_bytesitem); + __Pyx_XDECREF(__pyx_v_result); + __Pyx_XGIVEREF(__pyx_r); + __Pyx_RefNannyFinishContext(); + return __pyx_r; +} + +/* "View.MemoryView":506 + * return result + * + * cdef assign_item_from_object(self, char *itemp, object value): # <<<<<<<<<<<<<< + * """Only used if instantiated manually by the user, or if Cython doesn't + * know how to convert the type""" +*/ + +static PyObject *__pyx_memoryview_assign_item_from_object(struct __pyx_memoryview_obj *__pyx_v_self, char *__pyx_v_itemp, PyObject *__pyx_v_value) { + PyObject *__pyx_v_struct = NULL; + char __pyx_v_c; + PyObject *__pyx_v_bytesvalue = 0; + Py_ssize_t __pyx_v_i; + PyObject *__pyx_r = NULL; + __Pyx_RefNannyDeclarations + PyObject *__pyx_t_1 = NULL; + PyObject *__pyx_t_2 = NULL; + int __pyx_t_3; + PyObject *__pyx_t_4 = NULL; + PyObject *__pyx_t_5 = NULL; + PyObject *__pyx_t_6 = NULL; + size_t __pyx_t_7; + Py_ssize_t __pyx_t_8; + PyObject *__pyx_t_9 = NULL; + char *__pyx_t_10; + char *__pyx_t_11; + Py_ssize_t __pyx_t_12; + char *__pyx_t_13; + char *__pyx_t_14; + int __pyx_lineno = 0; + const char *__pyx_filename = NULL; + int __pyx_clineno = 0; + __Pyx_RefNannySetupContext("assign_item_from_object", 0); + + /* "View.MemoryView":509 + * """Only used if instantiated manually by the user, or if Cython doesn't + * know how to convert the type""" + * import struct # <<<<<<<<<<<<<< + * cdef char c + * cdef bytes bytesvalue +*/ + __pyx_t_2 = __Pyx_Import(__pyx_mstate_global->__pyx_n_u_struct, 0, 0, NULL, 0); if (unlikely(!__pyx_t_2)) __PYX_ERR(1, 509, __pyx_L1_error) + __pyx_t_1 = __pyx_t_2; + __Pyx_GOTREF(__pyx_t_1); + __pyx_v_struct = __pyx_t_1; + __pyx_t_1 = 0; + + /* "View.MemoryView":514 + * cdef Py_ssize_t i + * + * if isinstance(value, tuple): # <<<<<<<<<<<<<< + * bytesvalue = struct.pack(self.view.format, *value) + * else: +*/ + __pyx_t_3 = PyTuple_Check(__pyx_v_value); + if (__pyx_t_3) { + + /* "View.MemoryView":515 + * + * if isinstance(value, tuple): + * bytesvalue = struct.pack(self.view.format, *value) # <<<<<<<<<<<<<< + * else: + * bytesvalue = struct.pack(self.view.format, value) +*/ + __pyx_t_1 = __Pyx_PyObject_GetAttrStr(__pyx_v_struct, __pyx_mstate_global->__pyx_n_u_pack); if (unlikely(!__pyx_t_1)) __PYX_ERR(1, 515, __pyx_L1_error) + __Pyx_GOTREF(__pyx_t_1); + __pyx_t_4 = __Pyx_PyBytes_FromString(__pyx_v_self->view.format); if (unlikely(!__pyx_t_4)) __PYX_ERR(1, 515, __pyx_L1_error) + __Pyx_GOTREF(__pyx_t_4); + __pyx_t_5 = PyTuple_New(1); if (unlikely(!__pyx_t_5)) __PYX_ERR(1, 515, __pyx_L1_error) + __Pyx_GOTREF(__pyx_t_5); + __Pyx_GIVEREF(__pyx_t_4); + if (__Pyx_PyTuple_SET_ITEM(__pyx_t_5, 0, __pyx_t_4) != (0)) __PYX_ERR(1, 515, __pyx_L1_error); + __pyx_t_4 = 0; + __pyx_t_4 = __Pyx_PySequence_Tuple(__pyx_v_value); if (unlikely(!__pyx_t_4)) __PYX_ERR(1, 515, __pyx_L1_error) + __Pyx_GOTREF(__pyx_t_4); + __pyx_t_6 = PyNumber_Add(__pyx_t_5, __pyx_t_4); if (unlikely(!__pyx_t_6)) __PYX_ERR(1, 515, __pyx_L1_error) + __Pyx_GOTREF(__pyx_t_6); + __Pyx_DECREF(__pyx_t_5); __pyx_t_5 = 0; + __Pyx_DECREF(__pyx_t_4); __pyx_t_4 = 0; + __pyx_t_4 = __Pyx_PyObject_Call(__pyx_t_1, __pyx_t_6, NULL); if (unlikely(!__pyx_t_4)) __PYX_ERR(1, 515, __pyx_L1_error) + __Pyx_GOTREF(__pyx_t_4); + __Pyx_DECREF(__pyx_t_1); __pyx_t_1 = 0; + __Pyx_DECREF(__pyx_t_6); __pyx_t_6 = 0; + if (!(likely(PyBytes_CheckExact(__pyx_t_4))||((__pyx_t_4) == Py_None) || __Pyx_RaiseUnexpectedTypeError("bytes", __pyx_t_4))) __PYX_ERR(1, 515, __pyx_L1_error) + __pyx_v_bytesvalue = ((PyObject*)__pyx_t_4); + __pyx_t_4 = 0; + + /* "View.MemoryView":514 + * cdef Py_ssize_t i + * + * if isinstance(value, tuple): # <<<<<<<<<<<<<< + * bytesvalue = struct.pack(self.view.format, *value) + * else: +*/ + goto __pyx_L3; + } + + /* "View.MemoryView":517 + * bytesvalue = struct.pack(self.view.format, *value) + * else: + * bytesvalue = struct.pack(self.view.format, value) # <<<<<<<<<<<<<< + * + * for i, c in enumerate(bytesvalue): +*/ + /*else*/ { + __pyx_t_6 = __pyx_v_struct; + __Pyx_INCREF(__pyx_t_6); + __pyx_t_1 = __Pyx_PyBytes_FromString(__pyx_v_self->view.format); if (unlikely(!__pyx_t_1)) __PYX_ERR(1, 517, __pyx_L1_error) + __Pyx_GOTREF(__pyx_t_1); + __pyx_t_7 = 0; + { + PyObject *__pyx_callargs[3] = {__pyx_t_6, __pyx_t_1, __pyx_v_value}; + __pyx_t_4 = __Pyx_PyObject_FastCallMethod((PyObject*)__pyx_mstate_global->__pyx_n_u_pack, __pyx_callargs+__pyx_t_7, (3-__pyx_t_7) | (1*__Pyx_PY_VECTORCALL_ARGUMENTS_OFFSET)); + __Pyx_XDECREF(__pyx_t_6); __pyx_t_6 = 0; + __Pyx_DECREF(__pyx_t_1); __pyx_t_1 = 0; + if (unlikely(!__pyx_t_4)) __PYX_ERR(1, 517, __pyx_L1_error) + __Pyx_GOTREF(__pyx_t_4); + } + if (!(likely(PyBytes_CheckExact(__pyx_t_4))||((__pyx_t_4) == Py_None) || __Pyx_RaiseUnexpectedTypeError("bytes", __pyx_t_4))) __PYX_ERR(1, 517, __pyx_L1_error) + __pyx_v_bytesvalue = ((PyObject*)__pyx_t_4); + __pyx_t_4 = 0; + } + __pyx_L3:; + + /* "View.MemoryView":519 + * bytesvalue = struct.pack(self.view.format, value) + * + * for i, c in enumerate(bytesvalue): # <<<<<<<<<<<<<< + * itemp[i] = c + * +*/ + __pyx_t_8 = 0; + if (unlikely(__pyx_v_bytesvalue == Py_None)) { + PyErr_SetString(PyExc_TypeError, "'NoneType' is not iterable"); + __PYX_ERR(1, 519, __pyx_L1_error) + } + __Pyx_INCREF(__pyx_v_bytesvalue); + __pyx_t_9 = __pyx_v_bytesvalue; + __pyx_t_11 = __Pyx_PyBytes_AsWritableString(__pyx_t_9); if (unlikely(__pyx_t_11 == ((char *)NULL))) __PYX_ERR(1, 519, __pyx_L1_error) + __pyx_t_12 = __Pyx_PyBytes_GET_SIZE(__pyx_t_9); if (unlikely(__pyx_t_12 == ((Py_ssize_t)-1))) __PYX_ERR(1, 519, __pyx_L1_error) + __pyx_t_13 = (__pyx_t_11 + __pyx_t_12); + for (__pyx_t_14 = __pyx_t_11; __pyx_t_14 < __pyx_t_13; __pyx_t_14++) { + __pyx_t_10 = __pyx_t_14; + __pyx_v_c = (__pyx_t_10[0]); + + /* "View.MemoryView":520 + * + * for i, c in enumerate(bytesvalue): + * itemp[i] = c # <<<<<<<<<<<<<< + * + * @cname('getbuffer') +*/ + __pyx_v_i = __pyx_t_8; + + /* "View.MemoryView":519 + * bytesvalue = struct.pack(self.view.format, value) + * + * for i, c in enumerate(bytesvalue): # <<<<<<<<<<<<<< + * itemp[i] = c + * +*/ + __pyx_t_8 = (__pyx_t_8 + 1); + + /* "View.MemoryView":520 + * + * for i, c in enumerate(bytesvalue): + * itemp[i] = c # <<<<<<<<<<<<<< + * + * @cname('getbuffer') +*/ + (__pyx_v_itemp[__pyx_v_i]) = __pyx_v_c; + } + __Pyx_DECREF(__pyx_t_9); __pyx_t_9 = 0; + + /* "View.MemoryView":506 + * return result + * + * cdef assign_item_from_object(self, char *itemp, object value): # <<<<<<<<<<<<<< + * """Only used if instantiated manually by the user, or if Cython doesn't + * know how to convert the 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_4); + __Pyx_XDECREF(__pyx_t_5); + __Pyx_XDECREF(__pyx_t_6); + __Pyx_XDECREF(__pyx_t_9); + __Pyx_AddTraceback("View.MemoryView.memoryview.assign_item_from_object", __pyx_clineno, __pyx_lineno, __pyx_filename); + __pyx_r = 0; + __pyx_L0:; + __Pyx_XDECREF(__pyx_v_struct); + __Pyx_XDECREF(__pyx_v_bytesvalue); + __Pyx_XGIVEREF(__pyx_r); + __Pyx_RefNannyFinishContext(); + return __pyx_r; +} + +/* "View.MemoryView":522 + * itemp[i] = c + * + * @cname('getbuffer') # <<<<<<<<<<<<<< + * def __getbuffer__(self, Py_buffer *info, int flags): + * if flags & PyBUF_WRITABLE and self.view.readonly: +*/ + +/* Python wrapper */ +CYTHON_UNUSED static int __pyx_memoryview_getbuffer(PyObject *__pyx_v_self, Py_buffer *__pyx_v_info, int __pyx_v_flags); /*proto*/ +CYTHON_UNUSED static int __pyx_memoryview_getbuffer(PyObject *__pyx_v_self, Py_buffer *__pyx_v_info, int __pyx_v_flags) { + CYTHON_UNUSED PyObject *const *__pyx_kwvalues; + int __pyx_r; + __Pyx_RefNannyDeclarations + __Pyx_RefNannySetupContext("__getbuffer__ (wrapper)", 0); + __pyx_kwvalues = __Pyx_KwValues_VARARGS(__pyx_args, __pyx_nargs); + __pyx_r = __pyx_memoryview___pyx_pf_15View_dot_MemoryView_10memoryview_8__getbuffer__(((struct __pyx_memoryview_obj *)__pyx_v_self), ((Py_buffer *)__pyx_v_info), ((int)__pyx_v_flags)); + + /* function exit code */ + __Pyx_RefNannyFinishContext(); + return __pyx_r; +} + +static int __pyx_memoryview___pyx_pf_15View_dot_MemoryView_10memoryview_8__getbuffer__(struct __pyx_memoryview_obj *__pyx_v_self, Py_buffer *__pyx_v_info, int __pyx_v_flags) { + int __pyx_r; + __Pyx_RefNannyDeclarations + int __pyx_t_1; + int __pyx_t_2; + Py_ssize_t *__pyx_t_3; + char *__pyx_t_4; + void *__pyx_t_5; + int __pyx_t_6; + Py_ssize_t __pyx_t_7; + int __pyx_lineno = 0; + const char *__pyx_filename = NULL; + int __pyx_clineno = 0; + if (unlikely(__pyx_v_info == NULL)) { + PyErr_SetString(PyExc_BufferError, "PyObject_GetBuffer: view==NULL argument is obsolete"); + return -1; + } + __Pyx_RefNannySetupContext("__getbuffer__", 0); + __pyx_v_info->obj = Py_None; __Pyx_INCREF(Py_None); + __Pyx_GIVEREF(__pyx_v_info->obj); + + /* "View.MemoryView":524 + * @cname('getbuffer') + * def __getbuffer__(self, Py_buffer *info, int flags): + * if flags & PyBUF_WRITABLE and self.view.readonly: # <<<<<<<<<<<<<< + * raise ValueError, "Cannot create writable memory view from read-only memoryview" + * +*/ + __pyx_t_2 = ((__pyx_v_flags & PyBUF_WRITABLE) != 0); + if (__pyx_t_2) { + } else { + __pyx_t_1 = __pyx_t_2; + goto __pyx_L4_bool_binop_done; + } + __pyx_t_1 = __pyx_v_self->view.readonly; + __pyx_L4_bool_binop_done:; + if (unlikely(__pyx_t_1)) { + + /* "View.MemoryView":525 + * def __getbuffer__(self, Py_buffer *info, int flags): + * if flags & PyBUF_WRITABLE and self.view.readonly: + * raise ValueError, "Cannot create writable memory view from read-only memoryview" # <<<<<<<<<<<<<< + * + * if flags & PyBUF_ND: +*/ + __Pyx_Raise(((PyObject *)(((PyTypeObject*)PyExc_ValueError))), __pyx_mstate_global->__pyx_kp_u_Cannot_create_writable_memory_vi, 0, 0); + __PYX_ERR(1, 525, __pyx_L1_error) + + /* "View.MemoryView":524 + * @cname('getbuffer') + * def __getbuffer__(self, Py_buffer *info, int flags): + * if flags & PyBUF_WRITABLE and self.view.readonly: # <<<<<<<<<<<<<< + * raise ValueError, "Cannot create writable memory view from read-only memoryview" + * +*/ + } + + /* "View.MemoryView":527 + * raise ValueError, "Cannot create writable memory view from read-only memoryview" + * + * if flags & PyBUF_ND: # <<<<<<<<<<<<<< + * info.shape = self.view.shape + * else: +*/ + __pyx_t_1 = ((__pyx_v_flags & PyBUF_ND) != 0); + if (__pyx_t_1) { + + /* "View.MemoryView":528 + * + * if flags & PyBUF_ND: + * info.shape = self.view.shape # <<<<<<<<<<<<<< + * else: + * info.shape = NULL +*/ + __pyx_t_3 = __pyx_v_self->view.shape; + __pyx_v_info->shape = __pyx_t_3; + + /* "View.MemoryView":527 + * raise ValueError, "Cannot create writable memory view from read-only memoryview" + * + * if flags & PyBUF_ND: # <<<<<<<<<<<<<< + * info.shape = self.view.shape + * else: +*/ + goto __pyx_L6; + } + + /* "View.MemoryView":530 + * info.shape = self.view.shape + * else: + * info.shape = NULL # <<<<<<<<<<<<<< + * + * if flags & PyBUF_STRIDES: +*/ + /*else*/ { + __pyx_v_info->shape = NULL; + } + __pyx_L6:; + + /* "View.MemoryView":532 + * info.shape = NULL + * + * if flags & PyBUF_STRIDES: # <<<<<<<<<<<<<< + * info.strides = self.view.strides + * else: +*/ + __pyx_t_1 = ((__pyx_v_flags & PyBUF_STRIDES) != 0); + if (__pyx_t_1) { + + /* "View.MemoryView":533 + * + * if flags & PyBUF_STRIDES: + * info.strides = self.view.strides # <<<<<<<<<<<<<< + * else: + * info.strides = NULL +*/ + __pyx_t_3 = __pyx_v_self->view.strides; + __pyx_v_info->strides = __pyx_t_3; + + /* "View.MemoryView":532 + * info.shape = NULL + * + * if flags & PyBUF_STRIDES: # <<<<<<<<<<<<<< + * info.strides = self.view.strides + * else: +*/ + goto __pyx_L7; + } + + /* "View.MemoryView":535 + * info.strides = self.view.strides + * else: + * info.strides = NULL # <<<<<<<<<<<<<< + * + * if flags & PyBUF_INDIRECT: +*/ + /*else*/ { + __pyx_v_info->strides = NULL; + } + __pyx_L7:; + + /* "View.MemoryView":537 + * info.strides = NULL + * + * if flags & PyBUF_INDIRECT: # <<<<<<<<<<<<<< + * info.suboffsets = self.view.suboffsets + * else: +*/ + __pyx_t_1 = ((__pyx_v_flags & PyBUF_INDIRECT) != 0); + if (__pyx_t_1) { + + /* "View.MemoryView":538 + * + * if flags & PyBUF_INDIRECT: + * info.suboffsets = self.view.suboffsets # <<<<<<<<<<<<<< + * else: + * info.suboffsets = NULL +*/ + __pyx_t_3 = __pyx_v_self->view.suboffsets; + __pyx_v_info->suboffsets = __pyx_t_3; + + /* "View.MemoryView":537 + * info.strides = NULL + * + * if flags & PyBUF_INDIRECT: # <<<<<<<<<<<<<< + * info.suboffsets = self.view.suboffsets + * else: +*/ + goto __pyx_L8; + } + + /* "View.MemoryView":540 + * info.suboffsets = self.view.suboffsets + * else: + * info.suboffsets = NULL # <<<<<<<<<<<<<< + * + * if flags & PyBUF_FORMAT: +*/ + /*else*/ { + __pyx_v_info->suboffsets = NULL; + } + __pyx_L8:; + + /* "View.MemoryView":542 + * info.suboffsets = NULL + * + * if flags & PyBUF_FORMAT: # <<<<<<<<<<<<<< + * info.format = self.view.format + * else: +*/ + __pyx_t_1 = ((__pyx_v_flags & PyBUF_FORMAT) != 0); + if (__pyx_t_1) { + + /* "View.MemoryView":543 + * + * if flags & PyBUF_FORMAT: + * info.format = self.view.format # <<<<<<<<<<<<<< + * else: + * info.format = NULL +*/ + __pyx_t_4 = __pyx_v_self->view.format; + __pyx_v_info->format = __pyx_t_4; + + /* "View.MemoryView":542 + * info.suboffsets = NULL + * + * if flags & PyBUF_FORMAT: # <<<<<<<<<<<<<< + * info.format = self.view.format + * else: +*/ + goto __pyx_L9; + } + + /* "View.MemoryView":545 + * info.format = self.view.format + * else: + * info.format = NULL # <<<<<<<<<<<<<< + * + * info.buf = self.view.buf +*/ + /*else*/ { + __pyx_v_info->format = NULL; + } + __pyx_L9:; + + /* "View.MemoryView":547 + * info.format = NULL + * + * info.buf = self.view.buf # <<<<<<<<<<<<<< + * info.ndim = self.view.ndim + * info.itemsize = self.view.itemsize +*/ + __pyx_t_5 = __pyx_v_self->view.buf; + __pyx_v_info->buf = __pyx_t_5; + + /* "View.MemoryView":548 + * + * info.buf = self.view.buf + * info.ndim = self.view.ndim # <<<<<<<<<<<<<< + * info.itemsize = self.view.itemsize + * info.len = self.view.len +*/ + __pyx_t_6 = __pyx_v_self->view.ndim; + __pyx_v_info->ndim = __pyx_t_6; + + /* "View.MemoryView":549 + * info.buf = self.view.buf + * info.ndim = self.view.ndim + * info.itemsize = self.view.itemsize # <<<<<<<<<<<<<< + * info.len = self.view.len + * info.readonly = self.view.readonly +*/ + __pyx_t_7 = __pyx_v_self->view.itemsize; + __pyx_v_info->itemsize = __pyx_t_7; + + /* "View.MemoryView":550 + * info.ndim = self.view.ndim + * info.itemsize = self.view.itemsize + * info.len = self.view.len # <<<<<<<<<<<<<< + * info.readonly = self.view.readonly + * info.obj = self +*/ + __pyx_t_7 = __pyx_v_self->view.len; + __pyx_v_info->len = __pyx_t_7; + + /* "View.MemoryView":551 + * info.itemsize = self.view.itemsize + * info.len = self.view.len + * info.readonly = self.view.readonly # <<<<<<<<<<<<<< + * info.obj = self + * +*/ + __pyx_t_1 = __pyx_v_self->view.readonly; + __pyx_v_info->readonly = __pyx_t_1; + + /* "View.MemoryView":552 + * info.len = self.view.len + * info.readonly = self.view.readonly + * info.obj = self # <<<<<<<<<<<<<< + * + * +*/ + __Pyx_INCREF((PyObject *)__pyx_v_self); + __Pyx_GIVEREF((PyObject *)__pyx_v_self); + __Pyx_GOTREF(__pyx_v_info->obj); + __Pyx_DECREF(__pyx_v_info->obj); + __pyx_v_info->obj = ((PyObject *)__pyx_v_self); + + /* "View.MemoryView":522 + * itemp[i] = c + * + * @cname('getbuffer') # <<<<<<<<<<<<<< + * def __getbuffer__(self, Py_buffer *info, int flags): + * if flags & PyBUF_WRITABLE and self.view.readonly: +*/ + + /* function exit code */ + __pyx_r = 0; + goto __pyx_L0; + __pyx_L1_error:; + __Pyx_AddTraceback("View.MemoryView.memoryview.__getbuffer__", __pyx_clineno, __pyx_lineno, __pyx_filename); + __pyx_r = -1; + if (__pyx_v_info->obj != NULL) { + __Pyx_GOTREF(__pyx_v_info->obj); + __Pyx_DECREF(__pyx_v_info->obj); __pyx_v_info->obj = 0; + } + goto __pyx_L2; + __pyx_L0:; + if (__pyx_v_info->obj == Py_None) { + __Pyx_GOTREF(__pyx_v_info->obj); + __Pyx_DECREF(__pyx_v_info->obj); __pyx_v_info->obj = 0; + } + __pyx_L2:; + __Pyx_RefNannyFinishContext(); + return __pyx_r; +} + +/* "View.MemoryView":555 + * + * + * @property # <<<<<<<<<<<<<< + * def T(self): + * cdef _memoryviewslice result = memoryview_copy(self) +*/ + +/* Python wrapper */ +static PyObject *__pyx_pw_15View_dot_MemoryView_10memoryview_1T_1__get__(PyObject *__pyx_v_self); /*proto*/ +static PyObject *__pyx_pw_15View_dot_MemoryView_10memoryview_1T_1__get__(PyObject *__pyx_v_self) { + CYTHON_UNUSED PyObject *const *__pyx_kwvalues; + PyObject *__pyx_r = 0; + __Pyx_RefNannyDeclarations + __Pyx_RefNannySetupContext("__get__ (wrapper)", 0); + __pyx_kwvalues = __Pyx_KwValues_VARARGS(__pyx_args, __pyx_nargs); + __pyx_r = __pyx_pf_15View_dot_MemoryView_10memoryview_1T___get__(((struct __pyx_memoryview_obj *)__pyx_v_self)); + + /* function exit code */ + __Pyx_RefNannyFinishContext(); + return __pyx_r; +} + +static PyObject *__pyx_pf_15View_dot_MemoryView_10memoryview_1T___get__(struct __pyx_memoryview_obj *__pyx_v_self) { + struct __pyx_memoryviewslice_obj *__pyx_v_result = 0; + PyObject *__pyx_r = NULL; + __Pyx_RefNannyDeclarations + PyObject *__pyx_t_1 = NULL; + int __pyx_t_2; + int __pyx_lineno = 0; + const char *__pyx_filename = NULL; + int __pyx_clineno = 0; + __Pyx_RefNannySetupContext("__get__", 0); + + /* "View.MemoryView":557 + * @property + * def T(self): + * cdef _memoryviewslice result = memoryview_copy(self) # <<<<<<<<<<<<<< + * transpose_memslice(&result.from_slice) + * return result +*/ + __pyx_t_1 = __pyx_memoryview_copy_object(__pyx_v_self); if (unlikely(!__pyx_t_1)) __PYX_ERR(1, 557, __pyx_L1_error) + __Pyx_GOTREF(__pyx_t_1); + if (!(likely(((__pyx_t_1) == Py_None) || likely(__Pyx_TypeTest(__pyx_t_1, __pyx_mstate_global->__pyx_memoryviewslice_type))))) __PYX_ERR(1, 557, __pyx_L1_error) + __pyx_v_result = ((struct __pyx_memoryviewslice_obj *)__pyx_t_1); + __pyx_t_1 = 0; + + /* "View.MemoryView":558 + * def T(self): + * cdef _memoryviewslice result = memoryview_copy(self) + * transpose_memslice(&result.from_slice) # <<<<<<<<<<<<<< + * return result + * +*/ + __pyx_t_2 = __pyx_memslice_transpose((&__pyx_v_result->from_slice)); if (unlikely(__pyx_t_2 == ((int)-1))) __PYX_ERR(1, 558, __pyx_L1_error) + + /* "View.MemoryView":559 + * cdef _memoryviewslice result = memoryview_copy(self) + * transpose_memslice(&result.from_slice) + * return result # <<<<<<<<<<<<<< + * + * @property +*/ + __Pyx_XDECREF(__pyx_r); + __Pyx_INCREF((PyObject *)__pyx_v_result); + __pyx_r = ((PyObject *)__pyx_v_result); + goto __pyx_L0; + + /* "View.MemoryView":555 + * + * + * @property # <<<<<<<<<<<<<< + * def T(self): + * cdef _memoryviewslice result = memoryview_copy(self) +*/ + + /* function exit code */ + __pyx_L1_error:; + __Pyx_XDECREF(__pyx_t_1); + __Pyx_AddTraceback("View.MemoryView.memoryview.T.__get__", __pyx_clineno, __pyx_lineno, __pyx_filename); + __pyx_r = NULL; + __pyx_L0:; + __Pyx_XDECREF((PyObject *)__pyx_v_result); + __Pyx_XGIVEREF(__pyx_r); + __Pyx_RefNannyFinishContext(); + return __pyx_r; +} + +/* "View.MemoryView":561 + * return result + * + * @property # <<<<<<<<<<<<<< + * def base(self): + * return self._get_base() +*/ + +/* Python wrapper */ +static PyObject *__pyx_pw_15View_dot_MemoryView_10memoryview_4base_1__get__(PyObject *__pyx_v_self); /*proto*/ +static PyObject *__pyx_pw_15View_dot_MemoryView_10memoryview_4base_1__get__(PyObject *__pyx_v_self) { + CYTHON_UNUSED PyObject *const *__pyx_kwvalues; + PyObject *__pyx_r = 0; + __Pyx_RefNannyDeclarations + __Pyx_RefNannySetupContext("__get__ (wrapper)", 0); + __pyx_kwvalues = __Pyx_KwValues_VARARGS(__pyx_args, __pyx_nargs); + __pyx_r = __pyx_pf_15View_dot_MemoryView_10memoryview_4base___get__(((struct __pyx_memoryview_obj *)__pyx_v_self)); + + /* function exit code */ + __Pyx_RefNannyFinishContext(); + return __pyx_r; +} + +static PyObject *__pyx_pf_15View_dot_MemoryView_10memoryview_4base___get__(struct __pyx_memoryview_obj *__pyx_v_self) { + PyObject *__pyx_r = NULL; + __Pyx_RefNannyDeclarations + PyObject *__pyx_t_1 = NULL; + int __pyx_lineno = 0; + const char *__pyx_filename = NULL; + int __pyx_clineno = 0; + __Pyx_RefNannySetupContext("__get__", 0); + + /* "View.MemoryView":563 + * @property + * def base(self): + * return self._get_base() # <<<<<<<<<<<<<< + * + * cdef _get_base(self): +*/ + __Pyx_XDECREF(__pyx_r); + __pyx_t_1 = ((struct __pyx_vtabstruct_memoryview *)__pyx_v_self->__pyx_vtab)->_get_base(__pyx_v_self); if (unlikely(!__pyx_t_1)) __PYX_ERR(1, 563, __pyx_L1_error) + __Pyx_GOTREF(__pyx_t_1); + __pyx_r = __pyx_t_1; + __pyx_t_1 = 0; + goto __pyx_L0; + + /* "View.MemoryView":561 + * return result + * + * @property # <<<<<<<<<<<<<< + * def base(self): + * return self._get_base() +*/ + + /* function exit code */ + __pyx_L1_error:; + __Pyx_XDECREF(__pyx_t_1); + __Pyx_AddTraceback("View.MemoryView.memoryview.base.__get__", __pyx_clineno, __pyx_lineno, __pyx_filename); + __pyx_r = NULL; + __pyx_L0:; + __Pyx_XGIVEREF(__pyx_r); + __Pyx_RefNannyFinishContext(); + return __pyx_r; +} + +/* "View.MemoryView":565 + * return self._get_base() + * + * cdef _get_base(self): # <<<<<<<<<<<<<< + * return self.obj + * +*/ + +static PyObject *__pyx_memoryview__get_base(struct __pyx_memoryview_obj *__pyx_v_self) { + PyObject *__pyx_r = NULL; + __Pyx_RefNannyDeclarations + __Pyx_RefNannySetupContext("_get_base", 0); + + /* "View.MemoryView":566 + * + * cdef _get_base(self): + * return self.obj # <<<<<<<<<<<<<< + * + * @property +*/ + __Pyx_XDECREF(__pyx_r); + __Pyx_INCREF(__pyx_v_self->obj); + __pyx_r = __pyx_v_self->obj; + goto __pyx_L0; + + /* "View.MemoryView":565 + * return self._get_base() + * + * cdef _get_base(self): # <<<<<<<<<<<<<< + * return self.obj + * +*/ + + /* function exit code */ + __pyx_L0:; + __Pyx_XGIVEREF(__pyx_r); + __Pyx_RefNannyFinishContext(); + return __pyx_r; +} + +/* "View.MemoryView":568 + * return self.obj + * + * @property # <<<<<<<<<<<<<< + * def shape(self): + * return tuple([length for length in self.view.shape[:self.view.ndim]]) +*/ + +/* Python wrapper */ +static PyObject *__pyx_pw_15View_dot_MemoryView_10memoryview_5shape_1__get__(PyObject *__pyx_v_self); /*proto*/ +static PyObject *__pyx_pw_15View_dot_MemoryView_10memoryview_5shape_1__get__(PyObject *__pyx_v_self) { + CYTHON_UNUSED PyObject *const *__pyx_kwvalues; + PyObject *__pyx_r = 0; + __Pyx_RefNannyDeclarations + __Pyx_RefNannySetupContext("__get__ (wrapper)", 0); + __pyx_kwvalues = __Pyx_KwValues_VARARGS(__pyx_args, __pyx_nargs); + __pyx_r = __pyx_pf_15View_dot_MemoryView_10memoryview_5shape___get__(((struct __pyx_memoryview_obj *)__pyx_v_self)); + + /* function exit code */ + __Pyx_RefNannyFinishContext(); + return __pyx_r; +} + +static PyObject *__pyx_pf_15View_dot_MemoryView_10memoryview_5shape___get__(struct __pyx_memoryview_obj *__pyx_v_self) { + Py_ssize_t __pyx_7genexpr__pyx_v_length; + PyObject *__pyx_r = NULL; + __Pyx_RefNannyDeclarations + PyObject *__pyx_t_1 = NULL; + Py_ssize_t *__pyx_t_2; + Py_ssize_t *__pyx_t_3; + Py_ssize_t *__pyx_t_4; + PyObject *__pyx_t_5 = NULL; + int __pyx_lineno = 0; + const char *__pyx_filename = NULL; + int __pyx_clineno = 0; + __Pyx_RefNannySetupContext("__get__", 0); + + /* "View.MemoryView":570 + * @property + * def shape(self): + * return tuple([length for length in self.view.shape[:self.view.ndim]]) # <<<<<<<<<<<<<< + * + * @property +*/ + __Pyx_XDECREF(__pyx_r); + { /* enter inner scope */ + __pyx_t_1 = PyList_New(0); if (unlikely(!__pyx_t_1)) __PYX_ERR(1, 570, __pyx_L1_error) + __Pyx_GOTREF(__pyx_t_1); + __pyx_t_3 = (__pyx_v_self->view.shape + __pyx_v_self->view.ndim); + for (__pyx_t_4 = __pyx_v_self->view.shape; __pyx_t_4 < __pyx_t_3; __pyx_t_4++) { + __pyx_t_2 = __pyx_t_4; + __pyx_7genexpr__pyx_v_length = (__pyx_t_2[0]); + __pyx_t_5 = PyLong_FromSsize_t(__pyx_7genexpr__pyx_v_length); if (unlikely(!__pyx_t_5)) __PYX_ERR(1, 570, __pyx_L1_error) + __Pyx_GOTREF(__pyx_t_5); + if (unlikely(__Pyx_ListComp_Append(__pyx_t_1, (PyObject*)__pyx_t_5))) __PYX_ERR(1, 570, __pyx_L1_error) + __Pyx_DECREF(__pyx_t_5); __pyx_t_5 = 0; + } + } /* exit inner scope */ + __pyx_t_5 = PyList_AsTuple(((PyObject*)__pyx_t_1)); if (unlikely(!__pyx_t_5)) __PYX_ERR(1, 570, __pyx_L1_error) + __Pyx_GOTREF(__pyx_t_5); + __Pyx_DECREF(__pyx_t_1); __pyx_t_1 = 0; + __pyx_r = __pyx_t_5; + __pyx_t_5 = 0; + goto __pyx_L0; + + /* "View.MemoryView":568 + * return self.obj + * + * @property # <<<<<<<<<<<<<< + * def shape(self): + * return tuple([length for length in self.view.shape[:self.view.ndim]]) +*/ + + /* function exit code */ + __pyx_L1_error:; + __Pyx_XDECREF(__pyx_t_1); + __Pyx_XDECREF(__pyx_t_5); + __Pyx_AddTraceback("View.MemoryView.memoryview.shape.__get__", __pyx_clineno, __pyx_lineno, __pyx_filename); + __pyx_r = NULL; + __pyx_L0:; + __Pyx_XGIVEREF(__pyx_r); + __Pyx_RefNannyFinishContext(); + return __pyx_r; +} + +/* "View.MemoryView":572 + * return tuple([length for length in self.view.shape[:self.view.ndim]]) + * + * @property # <<<<<<<<<<<<<< + * def strides(self): + * if self.view.strides == NULL: +*/ + +/* Python wrapper */ +static PyObject *__pyx_pw_15View_dot_MemoryView_10memoryview_7strides_1__get__(PyObject *__pyx_v_self); /*proto*/ +static PyObject *__pyx_pw_15View_dot_MemoryView_10memoryview_7strides_1__get__(PyObject *__pyx_v_self) { + CYTHON_UNUSED PyObject *const *__pyx_kwvalues; + PyObject *__pyx_r = 0; + __Pyx_RefNannyDeclarations + __Pyx_RefNannySetupContext("__get__ (wrapper)", 0); + __pyx_kwvalues = __Pyx_KwValues_VARARGS(__pyx_args, __pyx_nargs); + __pyx_r = __pyx_pf_15View_dot_MemoryView_10memoryview_7strides___get__(((struct __pyx_memoryview_obj *)__pyx_v_self)); + + /* function exit code */ + __Pyx_RefNannyFinishContext(); + return __pyx_r; +} + +static PyObject *__pyx_pf_15View_dot_MemoryView_10memoryview_7strides___get__(struct __pyx_memoryview_obj *__pyx_v_self) { + Py_ssize_t __pyx_8genexpr1__pyx_v_stride; + PyObject *__pyx_r = NULL; + __Pyx_RefNannyDeclarations + int __pyx_t_1; + PyObject *__pyx_t_2 = NULL; + Py_ssize_t *__pyx_t_3; + Py_ssize_t *__pyx_t_4; + Py_ssize_t *__pyx_t_5; + PyObject *__pyx_t_6 = NULL; + int __pyx_lineno = 0; + const char *__pyx_filename = NULL; + int __pyx_clineno = 0; + __Pyx_RefNannySetupContext("__get__", 0); + + /* "View.MemoryView":574 + * @property + * def strides(self): + * if self.view.strides == NULL: # <<<<<<<<<<<<<< + * + * raise ValueError, "Buffer view does not expose strides" +*/ + __pyx_t_1 = (__pyx_v_self->view.strides == NULL); + if (unlikely(__pyx_t_1)) { + + /* "View.MemoryView":576 + * if self.view.strides == NULL: + * + * raise ValueError, "Buffer view does not expose strides" # <<<<<<<<<<<<<< + * + * return tuple([stride for stride in self.view.strides[:self.view.ndim]]) +*/ + __Pyx_Raise(((PyObject *)(((PyTypeObject*)PyExc_ValueError))), __pyx_mstate_global->__pyx_kp_u_Buffer_view_does_not_expose_stri, 0, 0); + __PYX_ERR(1, 576, __pyx_L1_error) + + /* "View.MemoryView":574 + * @property + * def strides(self): + * if self.view.strides == NULL: # <<<<<<<<<<<<<< + * + * raise ValueError, "Buffer view does not expose strides" +*/ + } + + /* "View.MemoryView":578 + * raise ValueError, "Buffer view does not expose strides" + * + * return tuple([stride for stride in self.view.strides[:self.view.ndim]]) # <<<<<<<<<<<<<< + * + * @property +*/ + __Pyx_XDECREF(__pyx_r); + { /* enter inner scope */ + __pyx_t_2 = PyList_New(0); if (unlikely(!__pyx_t_2)) __PYX_ERR(1, 578, __pyx_L1_error) + __Pyx_GOTREF(__pyx_t_2); + __pyx_t_4 = (__pyx_v_self->view.strides + __pyx_v_self->view.ndim); + for (__pyx_t_5 = __pyx_v_self->view.strides; __pyx_t_5 < __pyx_t_4; __pyx_t_5++) { + __pyx_t_3 = __pyx_t_5; + __pyx_8genexpr1__pyx_v_stride = (__pyx_t_3[0]); + __pyx_t_6 = PyLong_FromSsize_t(__pyx_8genexpr1__pyx_v_stride); if (unlikely(!__pyx_t_6)) __PYX_ERR(1, 578, __pyx_L1_error) + __Pyx_GOTREF(__pyx_t_6); + if (unlikely(__Pyx_ListComp_Append(__pyx_t_2, (PyObject*)__pyx_t_6))) __PYX_ERR(1, 578, __pyx_L1_error) + __Pyx_DECREF(__pyx_t_6); __pyx_t_6 = 0; + } + } /* exit inner scope */ + __pyx_t_6 = PyList_AsTuple(((PyObject*)__pyx_t_2)); if (unlikely(!__pyx_t_6)) __PYX_ERR(1, 578, __pyx_L1_error) + __Pyx_GOTREF(__pyx_t_6); + __Pyx_DECREF(__pyx_t_2); __pyx_t_2 = 0; + __pyx_r = __pyx_t_6; + __pyx_t_6 = 0; + goto __pyx_L0; + + /* "View.MemoryView":572 + * return tuple([length for length in self.view.shape[:self.view.ndim]]) + * + * @property # <<<<<<<<<<<<<< + * def strides(self): + * if self.view.strides == NULL: +*/ + + /* function exit code */ + __pyx_L1_error:; + __Pyx_XDECREF(__pyx_t_2); + __Pyx_XDECREF(__pyx_t_6); + __Pyx_AddTraceback("View.MemoryView.memoryview.strides.__get__", __pyx_clineno, __pyx_lineno, __pyx_filename); + __pyx_r = NULL; + __pyx_L0:; + __Pyx_XGIVEREF(__pyx_r); + __Pyx_RefNannyFinishContext(); + return __pyx_r; +} + +/* "View.MemoryView":580 + * return tuple([stride for stride in self.view.strides[:self.view.ndim]]) + * + * @property # <<<<<<<<<<<<<< + * def suboffsets(self): + * if self.view.suboffsets == NULL: +*/ + +/* Python wrapper */ +static PyObject *__pyx_pw_15View_dot_MemoryView_10memoryview_10suboffsets_1__get__(PyObject *__pyx_v_self); /*proto*/ +static PyObject *__pyx_pw_15View_dot_MemoryView_10memoryview_10suboffsets_1__get__(PyObject *__pyx_v_self) { + CYTHON_UNUSED PyObject *const *__pyx_kwvalues; + PyObject *__pyx_r = 0; + __Pyx_RefNannyDeclarations + __Pyx_RefNannySetupContext("__get__ (wrapper)", 0); + __pyx_kwvalues = __Pyx_KwValues_VARARGS(__pyx_args, __pyx_nargs); + __pyx_r = __pyx_pf_15View_dot_MemoryView_10memoryview_10suboffsets___get__(((struct __pyx_memoryview_obj *)__pyx_v_self)); + + /* function exit code */ + __Pyx_RefNannyFinishContext(); + return __pyx_r; +} + +static PyObject *__pyx_pf_15View_dot_MemoryView_10memoryview_10suboffsets___get__(struct __pyx_memoryview_obj *__pyx_v_self) { + Py_ssize_t __pyx_8genexpr2__pyx_v_suboffset; + PyObject *__pyx_r = NULL; + __Pyx_RefNannyDeclarations + int __pyx_t_1; + PyObject *__pyx_t_2 = NULL; + Py_ssize_t *__pyx_t_3; + Py_ssize_t *__pyx_t_4; + Py_ssize_t *__pyx_t_5; + PyObject *__pyx_t_6 = NULL; + int __pyx_lineno = 0; + const char *__pyx_filename = NULL; + int __pyx_clineno = 0; + __Pyx_RefNannySetupContext("__get__", 0); + + /* "View.MemoryView":582 + * @property + * def suboffsets(self): + * if self.view.suboffsets == NULL: # <<<<<<<<<<<<<< + * return (-1,) * self.view.ndim + * +*/ + __pyx_t_1 = (__pyx_v_self->view.suboffsets == NULL); + if (__pyx_t_1) { + + /* "View.MemoryView":583 + * def suboffsets(self): + * if self.view.suboffsets == NULL: + * return (-1,) * self.view.ndim # <<<<<<<<<<<<<< + * + * return tuple([suboffset for suboffset in self.view.suboffsets[:self.view.ndim]]) +*/ + __Pyx_XDECREF(__pyx_r); + __pyx_t_2 = __Pyx_PySequence_Multiply(__pyx_mstate_global->__pyx_tuple[1], __pyx_v_self->view.ndim); if (unlikely(!__pyx_t_2)) __PYX_ERR(1, 583, __pyx_L1_error) + __Pyx_GOTREF(__pyx_t_2); + __pyx_r = __pyx_t_2; + __pyx_t_2 = 0; + goto __pyx_L0; + + /* "View.MemoryView":582 + * @property + * def suboffsets(self): + * if self.view.suboffsets == NULL: # <<<<<<<<<<<<<< + * return (-1,) * self.view.ndim + * +*/ + } + + /* "View.MemoryView":585 + * return (-1,) * self.view.ndim + * + * return tuple([suboffset for suboffset in self.view.suboffsets[:self.view.ndim]]) # <<<<<<<<<<<<<< + * + * @property +*/ + __Pyx_XDECREF(__pyx_r); + { /* enter inner scope */ + __pyx_t_2 = PyList_New(0); if (unlikely(!__pyx_t_2)) __PYX_ERR(1, 585, __pyx_L1_error) + __Pyx_GOTREF(__pyx_t_2); + __pyx_t_4 = (__pyx_v_self->view.suboffsets + __pyx_v_self->view.ndim); + for (__pyx_t_5 = __pyx_v_self->view.suboffsets; __pyx_t_5 < __pyx_t_4; __pyx_t_5++) { + __pyx_t_3 = __pyx_t_5; + __pyx_8genexpr2__pyx_v_suboffset = (__pyx_t_3[0]); + __pyx_t_6 = PyLong_FromSsize_t(__pyx_8genexpr2__pyx_v_suboffset); if (unlikely(!__pyx_t_6)) __PYX_ERR(1, 585, __pyx_L1_error) + __Pyx_GOTREF(__pyx_t_6); + if (unlikely(__Pyx_ListComp_Append(__pyx_t_2, (PyObject*)__pyx_t_6))) __PYX_ERR(1, 585, __pyx_L1_error) + __Pyx_DECREF(__pyx_t_6); __pyx_t_6 = 0; + } + } /* exit inner scope */ + __pyx_t_6 = PyList_AsTuple(((PyObject*)__pyx_t_2)); if (unlikely(!__pyx_t_6)) __PYX_ERR(1, 585, __pyx_L1_error) + __Pyx_GOTREF(__pyx_t_6); + __Pyx_DECREF(__pyx_t_2); __pyx_t_2 = 0; + __pyx_r = __pyx_t_6; + __pyx_t_6 = 0; + goto __pyx_L0; + + /* "View.MemoryView":580 + * return tuple([stride for stride in self.view.strides[:self.view.ndim]]) + * + * @property # <<<<<<<<<<<<<< + * def suboffsets(self): + * if self.view.suboffsets == NULL: +*/ + + /* function exit code */ + __pyx_L1_error:; + __Pyx_XDECREF(__pyx_t_2); + __Pyx_XDECREF(__pyx_t_6); + __Pyx_AddTraceback("View.MemoryView.memoryview.suboffsets.__get__", __pyx_clineno, __pyx_lineno, __pyx_filename); + __pyx_r = NULL; + __pyx_L0:; + __Pyx_XGIVEREF(__pyx_r); + __Pyx_RefNannyFinishContext(); + return __pyx_r; +} + +/* "View.MemoryView":587 + * return tuple([suboffset for suboffset in self.view.suboffsets[:self.view.ndim]]) + * + * @property # <<<<<<<<<<<<<< + * def ndim(self): + * return self.view.ndim +*/ + +/* Python wrapper */ +static PyObject *__pyx_pw_15View_dot_MemoryView_10memoryview_4ndim_1__get__(PyObject *__pyx_v_self); /*proto*/ +static PyObject *__pyx_pw_15View_dot_MemoryView_10memoryview_4ndim_1__get__(PyObject *__pyx_v_self) { + CYTHON_UNUSED PyObject *const *__pyx_kwvalues; + PyObject *__pyx_r = 0; + __Pyx_RefNannyDeclarations + __Pyx_RefNannySetupContext("__get__ (wrapper)", 0); + __pyx_kwvalues = __Pyx_KwValues_VARARGS(__pyx_args, __pyx_nargs); + __pyx_r = __pyx_pf_15View_dot_MemoryView_10memoryview_4ndim___get__(((struct __pyx_memoryview_obj *)__pyx_v_self)); + + /* function exit code */ + __Pyx_RefNannyFinishContext(); + return __pyx_r; +} + +static PyObject *__pyx_pf_15View_dot_MemoryView_10memoryview_4ndim___get__(struct __pyx_memoryview_obj *__pyx_v_self) { + PyObject *__pyx_r = NULL; + __Pyx_RefNannyDeclarations + PyObject *__pyx_t_1 = NULL; + int __pyx_lineno = 0; + const char *__pyx_filename = NULL; + int __pyx_clineno = 0; + __Pyx_RefNannySetupContext("__get__", 0); + + /* "View.MemoryView":589 + * @property + * def ndim(self): + * return self.view.ndim # <<<<<<<<<<<<<< + * + * @property +*/ + __Pyx_XDECREF(__pyx_r); + __pyx_t_1 = __Pyx_PyLong_From_int(__pyx_v_self->view.ndim); if (unlikely(!__pyx_t_1)) __PYX_ERR(1, 589, __pyx_L1_error) + __Pyx_GOTREF(__pyx_t_1); + __pyx_r = __pyx_t_1; + __pyx_t_1 = 0; + goto __pyx_L0; + + /* "View.MemoryView":587 + * return tuple([suboffset for suboffset in self.view.suboffsets[:self.view.ndim]]) + * + * @property # <<<<<<<<<<<<<< + * def ndim(self): + * return self.view.ndim +*/ + + /* function exit code */ + __pyx_L1_error:; + __Pyx_XDECREF(__pyx_t_1); + __Pyx_AddTraceback("View.MemoryView.memoryview.ndim.__get__", __pyx_clineno, __pyx_lineno, __pyx_filename); + __pyx_r = NULL; + __pyx_L0:; + __Pyx_XGIVEREF(__pyx_r); + __Pyx_RefNannyFinishContext(); + return __pyx_r; +} + +/* "View.MemoryView":591 + * return self.view.ndim + * + * @property # <<<<<<<<<<<<<< + * def itemsize(self): + * return self.view.itemsize +*/ + +/* Python wrapper */ +static PyObject *__pyx_pw_15View_dot_MemoryView_10memoryview_8itemsize_1__get__(PyObject *__pyx_v_self); /*proto*/ +static PyObject *__pyx_pw_15View_dot_MemoryView_10memoryview_8itemsize_1__get__(PyObject *__pyx_v_self) { + CYTHON_UNUSED PyObject *const *__pyx_kwvalues; + PyObject *__pyx_r = 0; + __Pyx_RefNannyDeclarations + __Pyx_RefNannySetupContext("__get__ (wrapper)", 0); + __pyx_kwvalues = __Pyx_KwValues_VARARGS(__pyx_args, __pyx_nargs); + __pyx_r = __pyx_pf_15View_dot_MemoryView_10memoryview_8itemsize___get__(((struct __pyx_memoryview_obj *)__pyx_v_self)); + + /* function exit code */ + __Pyx_RefNannyFinishContext(); + return __pyx_r; +} + +static PyObject *__pyx_pf_15View_dot_MemoryView_10memoryview_8itemsize___get__(struct __pyx_memoryview_obj *__pyx_v_self) { + PyObject *__pyx_r = NULL; + __Pyx_RefNannyDeclarations + PyObject *__pyx_t_1 = NULL; + int __pyx_lineno = 0; + const char *__pyx_filename = NULL; + int __pyx_clineno = 0; + __Pyx_RefNannySetupContext("__get__", 0); + + /* "View.MemoryView":593 + * @property + * def itemsize(self): + * return self.view.itemsize # <<<<<<<<<<<<<< + * + * @property +*/ + __Pyx_XDECREF(__pyx_r); + __pyx_t_1 = PyLong_FromSsize_t(__pyx_v_self->view.itemsize); if (unlikely(!__pyx_t_1)) __PYX_ERR(1, 593, __pyx_L1_error) + __Pyx_GOTREF(__pyx_t_1); + __pyx_r = __pyx_t_1; + __pyx_t_1 = 0; + goto __pyx_L0; + + /* "View.MemoryView":591 + * return self.view.ndim + * + * @property # <<<<<<<<<<<<<< + * def itemsize(self): + * return self.view.itemsize +*/ + + /* function exit code */ + __pyx_L1_error:; + __Pyx_XDECREF(__pyx_t_1); + __Pyx_AddTraceback("View.MemoryView.memoryview.itemsize.__get__", __pyx_clineno, __pyx_lineno, __pyx_filename); + __pyx_r = NULL; + __pyx_L0:; + __Pyx_XGIVEREF(__pyx_r); + __Pyx_RefNannyFinishContext(); + return __pyx_r; +} + +/* "View.MemoryView":595 + * return self.view.itemsize + * + * @property # <<<<<<<<<<<<<< + * def nbytes(self): + * return self.size * self.view.itemsize +*/ + +/* Python wrapper */ +static PyObject *__pyx_pw_15View_dot_MemoryView_10memoryview_6nbytes_1__get__(PyObject *__pyx_v_self); /*proto*/ +static PyObject *__pyx_pw_15View_dot_MemoryView_10memoryview_6nbytes_1__get__(PyObject *__pyx_v_self) { + CYTHON_UNUSED PyObject *const *__pyx_kwvalues; + PyObject *__pyx_r = 0; + __Pyx_RefNannyDeclarations + __Pyx_RefNannySetupContext("__get__ (wrapper)", 0); + __pyx_kwvalues = __Pyx_KwValues_VARARGS(__pyx_args, __pyx_nargs); + __pyx_r = __pyx_pf_15View_dot_MemoryView_10memoryview_6nbytes___get__(((struct __pyx_memoryview_obj *)__pyx_v_self)); + + /* function exit code */ + __Pyx_RefNannyFinishContext(); + return __pyx_r; +} + +static PyObject *__pyx_pf_15View_dot_MemoryView_10memoryview_6nbytes___get__(struct __pyx_memoryview_obj *__pyx_v_self) { + PyObject *__pyx_r = NULL; + __Pyx_RefNannyDeclarations + PyObject *__pyx_t_1 = NULL; + PyObject *__pyx_t_2 = NULL; + PyObject *__pyx_t_3 = NULL; + int __pyx_lineno = 0; + const char *__pyx_filename = NULL; + int __pyx_clineno = 0; + __Pyx_RefNannySetupContext("__get__", 0); + + /* "View.MemoryView":597 + * @property + * def nbytes(self): + * return self.size * self.view.itemsize # <<<<<<<<<<<<<< + * + * @property +*/ + __Pyx_XDECREF(__pyx_r); + __pyx_t_1 = __Pyx_PyObject_GetAttrStr(((PyObject *)__pyx_v_self), __pyx_mstate_global->__pyx_n_u_size); if (unlikely(!__pyx_t_1)) __PYX_ERR(1, 597, __pyx_L1_error) + __Pyx_GOTREF(__pyx_t_1); + __pyx_t_2 = PyLong_FromSsize_t(__pyx_v_self->view.itemsize); if (unlikely(!__pyx_t_2)) __PYX_ERR(1, 597, __pyx_L1_error) + __Pyx_GOTREF(__pyx_t_2); + __pyx_t_3 = PyNumber_Multiply(__pyx_t_1, __pyx_t_2); if (unlikely(!__pyx_t_3)) __PYX_ERR(1, 597, __pyx_L1_error) + __Pyx_GOTREF(__pyx_t_3); + __Pyx_DECREF(__pyx_t_1); __pyx_t_1 = 0; + __Pyx_DECREF(__pyx_t_2); __pyx_t_2 = 0; + __pyx_r = __pyx_t_3; + __pyx_t_3 = 0; + goto __pyx_L0; + + /* "View.MemoryView":595 + * return self.view.itemsize + * + * @property # <<<<<<<<<<<<<< + * def nbytes(self): + * return self.size * self.view.itemsize +*/ + + /* function exit code */ + __pyx_L1_error:; + __Pyx_XDECREF(__pyx_t_1); + __Pyx_XDECREF(__pyx_t_2); + __Pyx_XDECREF(__pyx_t_3); + __Pyx_AddTraceback("View.MemoryView.memoryview.nbytes.__get__", __pyx_clineno, __pyx_lineno, __pyx_filename); + __pyx_r = NULL; + __pyx_L0:; + __Pyx_XGIVEREF(__pyx_r); + __Pyx_RefNannyFinishContext(); + return __pyx_r; +} + +/* "View.MemoryView":599 + * return self.size * self.view.itemsize + * + * @property # <<<<<<<<<<<<<< + * def size(self): + * if self._size is None: +*/ + +/* Python wrapper */ +static PyObject *__pyx_pw_15View_dot_MemoryView_10memoryview_4size_1__get__(PyObject *__pyx_v_self); /*proto*/ +static PyObject *__pyx_pw_15View_dot_MemoryView_10memoryview_4size_1__get__(PyObject *__pyx_v_self) { + CYTHON_UNUSED PyObject *const *__pyx_kwvalues; + PyObject *__pyx_r = 0; + __Pyx_RefNannyDeclarations + __Pyx_RefNannySetupContext("__get__ (wrapper)", 0); + __pyx_kwvalues = __Pyx_KwValues_VARARGS(__pyx_args, __pyx_nargs); + __pyx_r = __pyx_pf_15View_dot_MemoryView_10memoryview_4size___get__(((struct __pyx_memoryview_obj *)__pyx_v_self)); + + /* function exit code */ + __Pyx_RefNannyFinishContext(); + return __pyx_r; +} + +static PyObject *__pyx_pf_15View_dot_MemoryView_10memoryview_4size___get__(struct __pyx_memoryview_obj *__pyx_v_self) { + PyObject *__pyx_v_result = NULL; + PyObject *__pyx_v_length = NULL; + PyObject *__pyx_r = NULL; + __Pyx_RefNannyDeclarations + int __pyx_t_1; + Py_ssize_t *__pyx_t_2; + Py_ssize_t *__pyx_t_3; + Py_ssize_t *__pyx_t_4; + PyObject *__pyx_t_5 = NULL; + int __pyx_lineno = 0; + const char *__pyx_filename = NULL; + int __pyx_clineno = 0; + __Pyx_RefNannySetupContext("__get__", 0); + + /* "View.MemoryView":601 + * @property + * def size(self): + * if self._size is None: # <<<<<<<<<<<<<< + * result = 1 + * +*/ + __pyx_t_1 = (__pyx_v_self->_size == Py_None); + if (__pyx_t_1) { + + /* "View.MemoryView":602 + * def size(self): + * if self._size is None: + * result = 1 # <<<<<<<<<<<<<< + * + * for length in self.view.shape[:self.view.ndim]: +*/ + __Pyx_INCREF(__pyx_mstate_global->__pyx_int_1); + __pyx_v_result = __pyx_mstate_global->__pyx_int_1; + + /* "View.MemoryView":604 + * result = 1 + * + * for length in self.view.shape[:self.view.ndim]: # <<<<<<<<<<<<<< + * result *= length + * +*/ + __pyx_t_3 = (__pyx_v_self->view.shape + __pyx_v_self->view.ndim); + for (__pyx_t_4 = __pyx_v_self->view.shape; __pyx_t_4 < __pyx_t_3; __pyx_t_4++) { + __pyx_t_2 = __pyx_t_4; + __pyx_t_5 = PyLong_FromSsize_t((__pyx_t_2[0])); if (unlikely(!__pyx_t_5)) __PYX_ERR(1, 604, __pyx_L1_error) + __Pyx_GOTREF(__pyx_t_5); + __Pyx_XDECREF_SET(__pyx_v_length, __pyx_t_5); + __pyx_t_5 = 0; + + /* "View.MemoryView":605 + * + * for length in self.view.shape[:self.view.ndim]: + * result *= length # <<<<<<<<<<<<<< + * + * self._size = result +*/ + __pyx_t_5 = PyNumber_InPlaceMultiply(__pyx_v_result, __pyx_v_length); if (unlikely(!__pyx_t_5)) __PYX_ERR(1, 605, __pyx_L1_error) + __Pyx_GOTREF(__pyx_t_5); + __Pyx_DECREF_SET(__pyx_v_result, __pyx_t_5); + __pyx_t_5 = 0; + } + + /* "View.MemoryView":607 + * result *= length + * + * self._size = result # <<<<<<<<<<<<<< + * + * return self._size +*/ + __Pyx_INCREF(__pyx_v_result); + __Pyx_GIVEREF(__pyx_v_result); + __Pyx_GOTREF(__pyx_v_self->_size); + __Pyx_DECREF(__pyx_v_self->_size); + __pyx_v_self->_size = __pyx_v_result; + + /* "View.MemoryView":601 + * @property + * def size(self): + * if self._size is None: # <<<<<<<<<<<<<< + * result = 1 + * +*/ + } + + /* "View.MemoryView":609 + * self._size = result + * + * return self._size # <<<<<<<<<<<<<< + * + * def __len__(self): +*/ + __Pyx_XDECREF(__pyx_r); + __Pyx_INCREF(__pyx_v_self->_size); + __pyx_r = __pyx_v_self->_size; + goto __pyx_L0; + + /* "View.MemoryView":599 + * return self.size * self.view.itemsize + * + * @property # <<<<<<<<<<<<<< + * def size(self): + * if self._size is None: +*/ + + /* function exit code */ + __pyx_L1_error:; + __Pyx_XDECREF(__pyx_t_5); + __Pyx_AddTraceback("View.MemoryView.memoryview.size.__get__", __pyx_clineno, __pyx_lineno, __pyx_filename); + __pyx_r = NULL; + __pyx_L0:; + __Pyx_XDECREF(__pyx_v_result); + __Pyx_XDECREF(__pyx_v_length); + __Pyx_XGIVEREF(__pyx_r); + __Pyx_RefNannyFinishContext(); + return __pyx_r; +} + +/* "View.MemoryView":611 + * return self._size + * + * def __len__(self): # <<<<<<<<<<<<<< + * if self.view.ndim >= 1: + * return self.view.shape[0] +*/ + +/* Python wrapper */ +static Py_ssize_t __pyx_memoryview___len__(PyObject *__pyx_v_self); /*proto*/ +static Py_ssize_t __pyx_memoryview___len__(PyObject *__pyx_v_self) { + CYTHON_UNUSED PyObject *const *__pyx_kwvalues; + Py_ssize_t __pyx_r; + __Pyx_RefNannyDeclarations + __Pyx_RefNannySetupContext("__len__ (wrapper)", 0); + __pyx_kwvalues = __Pyx_KwValues_VARARGS(__pyx_args, __pyx_nargs); + __pyx_r = __pyx_memoryview___pyx_pf_15View_dot_MemoryView_10memoryview_10__len__(((struct __pyx_memoryview_obj *)__pyx_v_self)); + + /* function exit code */ + __Pyx_RefNannyFinishContext(); + return __pyx_r; +} + +static Py_ssize_t __pyx_memoryview___pyx_pf_15View_dot_MemoryView_10memoryview_10__len__(struct __pyx_memoryview_obj *__pyx_v_self) { + Py_ssize_t __pyx_r; + int __pyx_t_1; + + /* "View.MemoryView":612 + * + * def __len__(self): + * if self.view.ndim >= 1: # <<<<<<<<<<<<<< + * return self.view.shape[0] + * +*/ + __pyx_t_1 = (__pyx_v_self->view.ndim >= 1); + if (__pyx_t_1) { + + /* "View.MemoryView":613 + * def __len__(self): + * if self.view.ndim >= 1: + * return self.view.shape[0] # <<<<<<<<<<<<<< + * + * return 0 +*/ + __pyx_r = (__pyx_v_self->view.shape[0]); + goto __pyx_L0; + + /* "View.MemoryView":612 + * + * def __len__(self): + * if self.view.ndim >= 1: # <<<<<<<<<<<<<< + * return self.view.shape[0] + * +*/ + } + + /* "View.MemoryView":615 + * return self.view.shape[0] + * + * return 0 # <<<<<<<<<<<<<< + * + * def __repr__(self): +*/ + __pyx_r = 0; + goto __pyx_L0; + + /* "View.MemoryView":611 + * return self._size + * + * def __len__(self): # <<<<<<<<<<<<<< + * if self.view.ndim >= 1: + * return self.view.shape[0] +*/ + + /* function exit code */ + __pyx_L0:; + return __pyx_r; +} + +/* "View.MemoryView":617 + * return 0 + * + * def __repr__(self): # <<<<<<<<<<<<<< + * return "" % (self.base.__class__.__name__, + * id(self)) +*/ + +/* Python wrapper */ +static PyObject *__pyx_memoryview___repr__(PyObject *__pyx_v_self); /*proto*/ +static PyObject *__pyx_memoryview___repr__(PyObject *__pyx_v_self) { + CYTHON_UNUSED PyObject *const *__pyx_kwvalues; + PyObject *__pyx_r = 0; + __Pyx_RefNannyDeclarations + __Pyx_RefNannySetupContext("__repr__ (wrapper)", 0); + __pyx_kwvalues = __Pyx_KwValues_VARARGS(__pyx_args, __pyx_nargs); + __pyx_r = __pyx_memoryview___pyx_pf_15View_dot_MemoryView_10memoryview_12__repr__(((struct __pyx_memoryview_obj *)__pyx_v_self)); + + /* function exit code */ + __Pyx_RefNannyFinishContext(); + return __pyx_r; +} + +static PyObject *__pyx_memoryview___pyx_pf_15View_dot_MemoryView_10memoryview_12__repr__(struct __pyx_memoryview_obj *__pyx_v_self) { + PyObject *__pyx_r = NULL; + __Pyx_RefNannyDeclarations + PyObject *__pyx_t_1 = NULL; + PyObject *__pyx_t_2 = NULL; + PyObject *__pyx_t_3 = NULL; + PyObject *__pyx_t_4[5]; + int __pyx_lineno = 0; + const char *__pyx_filename = NULL; + int __pyx_clineno = 0; + __Pyx_RefNannySetupContext("__repr__", 0); + + /* "View.MemoryView":618 + * + * def __repr__(self): + * return "" % (self.base.__class__.__name__, # <<<<<<<<<<<<<< + * id(self)) + * +*/ + __Pyx_XDECREF(__pyx_r); + __pyx_t_1 = __Pyx_PyObject_GetAttrStr(((PyObject *)__pyx_v_self), __pyx_mstate_global->__pyx_n_u_base); if (unlikely(!__pyx_t_1)) __PYX_ERR(1, 618, __pyx_L1_error) + __Pyx_GOTREF(__pyx_t_1); + __pyx_t_2 = __Pyx_PyObject_GetAttrStr(__pyx_t_1, __pyx_mstate_global->__pyx_n_u_class); if (unlikely(!__pyx_t_2)) __PYX_ERR(1, 618, __pyx_L1_error) + __Pyx_GOTREF(__pyx_t_2); + __Pyx_DECREF(__pyx_t_1); __pyx_t_1 = 0; + __pyx_t_1 = __Pyx_PyObject_GetAttrStr(__pyx_t_2, __pyx_mstate_global->__pyx_n_u_name_2); if (unlikely(!__pyx_t_1)) __PYX_ERR(1, 618, __pyx_L1_error) + __Pyx_GOTREF(__pyx_t_1); + __Pyx_DECREF(__pyx_t_2); __pyx_t_2 = 0; + __pyx_t_2 = __Pyx_PyObject_FormatSimpleAndDecref(PyObject_Repr(__pyx_t_1), __pyx_mstate_global->__pyx_empty_unicode); if (unlikely(!__pyx_t_2)) __PYX_ERR(1, 618, __pyx_L1_error) + __Pyx_GOTREF(__pyx_t_2); + __Pyx_DECREF(__pyx_t_1); __pyx_t_1 = 0; + + /* "View.MemoryView":619 + * def __repr__(self): + * return "" % (self.base.__class__.__name__, + * id(self)) # <<<<<<<<<<<<<< + * + * def __str__(self): +*/ + __pyx_t_1 = __Pyx_PyObject_CallOneArg(__pyx_builtin_id, ((PyObject *)__pyx_v_self)); if (unlikely(!__pyx_t_1)) __PYX_ERR(1, 619, __pyx_L1_error) + __Pyx_GOTREF(__pyx_t_1); + __pyx_t_3 = __Pyx_PyObject_Format(__pyx_t_1, __pyx_mstate_global->__pyx_n_u_x); if (unlikely(!__pyx_t_3)) __PYX_ERR(1, 619, __pyx_L1_error) + __Pyx_GOTREF(__pyx_t_3); + __Pyx_DECREF(__pyx_t_1); __pyx_t_1 = 0; + __pyx_t_4[0] = __pyx_mstate_global->__pyx_kp_u_MemoryView_of; + __pyx_t_4[1] = __pyx_t_2; + __pyx_t_4[2] = __pyx_mstate_global->__pyx_kp_u_at_0x; + __pyx_t_4[3] = __pyx_t_3; + __pyx_t_4[4] = __pyx_mstate_global->__pyx_kp_u__3; + + /* "View.MemoryView":618 + * + * def __repr__(self): + * return "" % (self.base.__class__.__name__, # <<<<<<<<<<<<<< + * id(self)) + * +*/ + __pyx_t_1 = __Pyx_PyUnicode_Join(__pyx_t_4, 5, 15 + __Pyx_PyUnicode_GET_LENGTH(__pyx_t_2) + 6 + __Pyx_PyUnicode_GET_LENGTH(__pyx_t_3) + 1, 127 | __Pyx_PyUnicode_MAX_CHAR_VALUE(__pyx_t_2) | __Pyx_PyUnicode_MAX_CHAR_VALUE(__pyx_t_3)); + if (unlikely(!__pyx_t_1)) __PYX_ERR(1, 618, __pyx_L1_error) + __Pyx_GOTREF(__pyx_t_1); + __Pyx_DECREF(__pyx_t_2); __pyx_t_2 = 0; + __Pyx_DECREF(__pyx_t_3); __pyx_t_3 = 0; + __pyx_r = __pyx_t_1; + __pyx_t_1 = 0; + goto __pyx_L0; + + /* "View.MemoryView":617 + * return 0 + * + * def __repr__(self): # <<<<<<<<<<<<<< + * return "" % (self.base.__class__.__name__, + * id(self)) +*/ + + /* function exit code */ + __pyx_L1_error:; + __Pyx_XDECREF(__pyx_t_1); + __Pyx_XDECREF(__pyx_t_2); + __Pyx_XDECREF(__pyx_t_3); + __Pyx_AddTraceback("View.MemoryView.memoryview.__repr__", __pyx_clineno, __pyx_lineno, __pyx_filename); + __pyx_r = NULL; + __pyx_L0:; + __Pyx_XGIVEREF(__pyx_r); + __Pyx_RefNannyFinishContext(); + return __pyx_r; +} + +/* "View.MemoryView":621 + * id(self)) + * + * def __str__(self): # <<<<<<<<<<<<<< + * return "" % (self.base.__class__.__name__,) + * +*/ + +/* Python wrapper */ +static PyObject *__pyx_memoryview___str__(PyObject *__pyx_v_self); /*proto*/ +static PyObject *__pyx_memoryview___str__(PyObject *__pyx_v_self) { + CYTHON_UNUSED PyObject *const *__pyx_kwvalues; + PyObject *__pyx_r = 0; + __Pyx_RefNannyDeclarations + __Pyx_RefNannySetupContext("__str__ (wrapper)", 0); + __pyx_kwvalues = __Pyx_KwValues_VARARGS(__pyx_args, __pyx_nargs); + __pyx_r = __pyx_memoryview___pyx_pf_15View_dot_MemoryView_10memoryview_14__str__(((struct __pyx_memoryview_obj *)__pyx_v_self)); + + /* function exit code */ + __Pyx_RefNannyFinishContext(); + return __pyx_r; +} + +static PyObject *__pyx_memoryview___pyx_pf_15View_dot_MemoryView_10memoryview_14__str__(struct __pyx_memoryview_obj *__pyx_v_self) { + PyObject *__pyx_r = NULL; + __Pyx_RefNannyDeclarations + PyObject *__pyx_t_1 = NULL; + PyObject *__pyx_t_2 = NULL; + PyObject *__pyx_t_3[3]; + int __pyx_lineno = 0; + const char *__pyx_filename = NULL; + int __pyx_clineno = 0; + __Pyx_RefNannySetupContext("__str__", 0); + + /* "View.MemoryView":622 + * + * def __str__(self): + * return "" % (self.base.__class__.__name__,) # <<<<<<<<<<<<<< + * + * +*/ + __Pyx_XDECREF(__pyx_r); + __pyx_t_1 = __Pyx_PyObject_GetAttrStr(((PyObject *)__pyx_v_self), __pyx_mstate_global->__pyx_n_u_base); if (unlikely(!__pyx_t_1)) __PYX_ERR(1, 622, __pyx_L1_error) + __Pyx_GOTREF(__pyx_t_1); + __pyx_t_2 = __Pyx_PyObject_GetAttrStr(__pyx_t_1, __pyx_mstate_global->__pyx_n_u_class); if (unlikely(!__pyx_t_2)) __PYX_ERR(1, 622, __pyx_L1_error) + __Pyx_GOTREF(__pyx_t_2); + __Pyx_DECREF(__pyx_t_1); __pyx_t_1 = 0; + __pyx_t_1 = __Pyx_PyObject_GetAttrStr(__pyx_t_2, __pyx_mstate_global->__pyx_n_u_name_2); if (unlikely(!__pyx_t_1)) __PYX_ERR(1, 622, __pyx_L1_error) + __Pyx_GOTREF(__pyx_t_1); + __Pyx_DECREF(__pyx_t_2); __pyx_t_2 = 0; + __pyx_t_2 = __Pyx_PyObject_FormatSimpleAndDecref(PyObject_Repr(__pyx_t_1), __pyx_mstate_global->__pyx_empty_unicode); if (unlikely(!__pyx_t_2)) __PYX_ERR(1, 622, __pyx_L1_error) + __Pyx_GOTREF(__pyx_t_2); + __Pyx_DECREF(__pyx_t_1); __pyx_t_1 = 0; + __pyx_t_3[0] = __pyx_mstate_global->__pyx_kp_u_MemoryView_of; + __pyx_t_3[1] = __pyx_t_2; + __pyx_t_3[2] = __pyx_mstate_global->__pyx_kp_u_object; + __pyx_t_1 = __Pyx_PyUnicode_Join(__pyx_t_3, 3, 15 + __Pyx_PyUnicode_GET_LENGTH(__pyx_t_2) + 8, 127 | __Pyx_PyUnicode_MAX_CHAR_VALUE(__pyx_t_2)); + if (unlikely(!__pyx_t_1)) __PYX_ERR(1, 622, __pyx_L1_error) + __Pyx_GOTREF(__pyx_t_1); + __Pyx_DECREF(__pyx_t_2); __pyx_t_2 = 0; + __pyx_r = __pyx_t_1; + __pyx_t_1 = 0; + goto __pyx_L0; + + /* "View.MemoryView":621 + * id(self)) + * + * def __str__(self): # <<<<<<<<<<<<<< + * return "" % (self.base.__class__.__name__,) + * +*/ + + /* function exit code */ + __pyx_L1_error:; + __Pyx_XDECREF(__pyx_t_1); + __Pyx_XDECREF(__pyx_t_2); + __Pyx_AddTraceback("View.MemoryView.memoryview.__str__", __pyx_clineno, __pyx_lineno, __pyx_filename); + __pyx_r = NULL; + __pyx_L0:; + __Pyx_XGIVEREF(__pyx_r); + __Pyx_RefNannyFinishContext(); + return __pyx_r; +} + +/* "View.MemoryView":625 + * + * + * def is_c_contig(self): # <<<<<<<<<<<<<< + * cdef __Pyx_memviewslice *mslice + * cdef __Pyx_memviewslice tmp +*/ + +/* Python wrapper */ +static PyObject *__pyx_memoryview_is_c_contig(PyObject *__pyx_v_self, +#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*/ +static PyObject *__pyx_memoryview_is_c_contig(PyObject *__pyx_v_self, +#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_c_contig (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_c_contig", 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_c_contig", __pyx_kwds); return NULL;} + __pyx_r = __pyx_memoryview___pyx_pf_15View_dot_MemoryView_10memoryview_16is_c_contig(((struct __pyx_memoryview_obj *)__pyx_v_self)); + + /* function exit code */ + __Pyx_RefNannyFinishContext(); + return __pyx_r; +} + +static PyObject *__pyx_memoryview___pyx_pf_15View_dot_MemoryView_10memoryview_16is_c_contig(struct __pyx_memoryview_obj *__pyx_v_self) { + __Pyx_memviewslice *__pyx_v_mslice; + __Pyx_memviewslice __pyx_v_tmp; + PyObject *__pyx_r = NULL; + __Pyx_RefNannyDeclarations + __Pyx_memviewslice *__pyx_t_1; + PyObject *__pyx_t_2 = NULL; + int __pyx_lineno = 0; + const char *__pyx_filename = NULL; + int __pyx_clineno = 0; + __Pyx_RefNannySetupContext("is_c_contig", 0); + + /* "View.MemoryView":628 + * cdef __Pyx_memviewslice *mslice + * cdef __Pyx_memviewslice tmp + * mslice = get_slice_from_memview(self, &tmp) # <<<<<<<<<<<<<< + * return slice_is_contig(mslice[0], 'C', self.view.ndim) + * +*/ + __pyx_t_1 = __pyx_memoryview_get_slice_from_memoryview(__pyx_v_self, (&__pyx_v_tmp)); if (unlikely(__pyx_t_1 == ((void *)NULL))) __PYX_ERR(1, 628, __pyx_L1_error) + __pyx_v_mslice = __pyx_t_1; + + /* "View.MemoryView":629 + * cdef __Pyx_memviewslice tmp + * mslice = get_slice_from_memview(self, &tmp) + * return slice_is_contig(mslice[0], 'C', self.view.ndim) # <<<<<<<<<<<<<< + * + * def is_f_contig(self): +*/ + __Pyx_XDECREF(__pyx_r); + __pyx_t_2 = __Pyx_PyBool_FromLong(__pyx_memviewslice_is_contig((__pyx_v_mslice[0]), 'C', __pyx_v_self->view.ndim)); if (unlikely(!__pyx_t_2)) __PYX_ERR(1, 629, __pyx_L1_error) + __Pyx_GOTREF(__pyx_t_2); + __pyx_r = __pyx_t_2; + __pyx_t_2 = 0; + goto __pyx_L0; + + /* "View.MemoryView":625 + * + * + * def is_c_contig(self): # <<<<<<<<<<<<<< + * cdef __Pyx_memviewslice *mslice + * cdef __Pyx_memviewslice tmp +*/ + + /* function exit code */ + __pyx_L1_error:; + __Pyx_XDECREF(__pyx_t_2); + __Pyx_AddTraceback("View.MemoryView.memoryview.is_c_contig", __pyx_clineno, __pyx_lineno, __pyx_filename); + __pyx_r = NULL; + __pyx_L0:; + __Pyx_XGIVEREF(__pyx_r); + __Pyx_RefNannyFinishContext(); + return __pyx_r; +} + +/* "View.MemoryView":631 + * return slice_is_contig(mslice[0], 'C', self.view.ndim) + * + * def is_f_contig(self): # <<<<<<<<<<<<<< + * cdef __Pyx_memviewslice *mslice + * cdef __Pyx_memviewslice tmp +*/ + +/* Python wrapper */ +static PyObject *__pyx_memoryview_is_f_contig(PyObject *__pyx_v_self, +#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*/ +static PyObject *__pyx_memoryview_is_f_contig(PyObject *__pyx_v_self, +#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_f_contig (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_f_contig", 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_f_contig", __pyx_kwds); return NULL;} + __pyx_r = __pyx_memoryview___pyx_pf_15View_dot_MemoryView_10memoryview_18is_f_contig(((struct __pyx_memoryview_obj *)__pyx_v_self)); + + /* function exit code */ + __Pyx_RefNannyFinishContext(); + return __pyx_r; +} + +static PyObject *__pyx_memoryview___pyx_pf_15View_dot_MemoryView_10memoryview_18is_f_contig(struct __pyx_memoryview_obj *__pyx_v_self) { + __Pyx_memviewslice *__pyx_v_mslice; + __Pyx_memviewslice __pyx_v_tmp; + PyObject *__pyx_r = NULL; + __Pyx_RefNannyDeclarations + __Pyx_memviewslice *__pyx_t_1; + PyObject *__pyx_t_2 = NULL; + int __pyx_lineno = 0; + const char *__pyx_filename = NULL; + int __pyx_clineno = 0; + __Pyx_RefNannySetupContext("is_f_contig", 0); + + /* "View.MemoryView":634 + * cdef __Pyx_memviewslice *mslice + * cdef __Pyx_memviewslice tmp + * mslice = get_slice_from_memview(self, &tmp) # <<<<<<<<<<<<<< + * return slice_is_contig(mslice[0], 'F', self.view.ndim) + * +*/ + __pyx_t_1 = __pyx_memoryview_get_slice_from_memoryview(__pyx_v_self, (&__pyx_v_tmp)); if (unlikely(__pyx_t_1 == ((void *)NULL))) __PYX_ERR(1, 634, __pyx_L1_error) + __pyx_v_mslice = __pyx_t_1; + + /* "View.MemoryView":635 + * cdef __Pyx_memviewslice tmp + * mslice = get_slice_from_memview(self, &tmp) + * return slice_is_contig(mslice[0], 'F', self.view.ndim) # <<<<<<<<<<<<<< + * + * def copy(self): +*/ + __Pyx_XDECREF(__pyx_r); + __pyx_t_2 = __Pyx_PyBool_FromLong(__pyx_memviewslice_is_contig((__pyx_v_mslice[0]), 'F', __pyx_v_self->view.ndim)); if (unlikely(!__pyx_t_2)) __PYX_ERR(1, 635, __pyx_L1_error) + __Pyx_GOTREF(__pyx_t_2); + __pyx_r = __pyx_t_2; + __pyx_t_2 = 0; + goto __pyx_L0; + + /* "View.MemoryView":631 + * return slice_is_contig(mslice[0], 'C', self.view.ndim) + * + * def is_f_contig(self): # <<<<<<<<<<<<<< + * cdef __Pyx_memviewslice *mslice + * cdef __Pyx_memviewslice tmp +*/ + + /* function exit code */ + __pyx_L1_error:; + __Pyx_XDECREF(__pyx_t_2); + __Pyx_AddTraceback("View.MemoryView.memoryview.is_f_contig", __pyx_clineno, __pyx_lineno, __pyx_filename); + __pyx_r = NULL; + __pyx_L0:; + __Pyx_XGIVEREF(__pyx_r); + __Pyx_RefNannyFinishContext(); + return __pyx_r; +} + +/* "View.MemoryView":637 + * return slice_is_contig(mslice[0], 'F', self.view.ndim) + * + * def copy(self): # <<<<<<<<<<<<<< + * cdef __Pyx_memviewslice mslice + * cdef int flags = self.flags & ~PyBUF_F_CONTIGUOUS +*/ + +/* Python wrapper */ +static PyObject *__pyx_memoryview_copy(PyObject *__pyx_v_self, +#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*/ +static PyObject *__pyx_memoryview_copy(PyObject *__pyx_v_self, +#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("copy (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("copy", 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("copy", __pyx_kwds); return NULL;} + __pyx_r = __pyx_memoryview___pyx_pf_15View_dot_MemoryView_10memoryview_20copy(((struct __pyx_memoryview_obj *)__pyx_v_self)); + + /* function exit code */ + __Pyx_RefNannyFinishContext(); + return __pyx_r; +} + +static PyObject *__pyx_memoryview___pyx_pf_15View_dot_MemoryView_10memoryview_20copy(struct __pyx_memoryview_obj *__pyx_v_self) { + __Pyx_memviewslice __pyx_v_mslice; + int __pyx_v_flags; + PyObject *__pyx_r = NULL; + __Pyx_RefNannyDeclarations + __Pyx_memviewslice __pyx_t_1; + PyObject *__pyx_t_2 = NULL; + int __pyx_lineno = 0; + const char *__pyx_filename = NULL; + int __pyx_clineno = 0; + __Pyx_RefNannySetupContext("copy", 0); + + /* "View.MemoryView":639 + * def copy(self): + * cdef __Pyx_memviewslice mslice + * cdef int flags = self.flags & ~PyBUF_F_CONTIGUOUS # <<<<<<<<<<<<<< + * + * slice_copy(self, &mslice) +*/ + __pyx_v_flags = (__pyx_v_self->flags & (~PyBUF_F_CONTIGUOUS)); + + /* "View.MemoryView":641 + * cdef int flags = self.flags & ~PyBUF_F_CONTIGUOUS + * + * slice_copy(self, &mslice) # <<<<<<<<<<<<<< + * mslice = slice_copy_contig(&mslice, "c", self.view.ndim, + * self.view.itemsize, +*/ + __pyx_memoryview_slice_copy(__pyx_v_self, (&__pyx_v_mslice)); + + /* "View.MemoryView":642 + * + * slice_copy(self, &mslice) + * mslice = slice_copy_contig(&mslice, "c", self.view.ndim, # <<<<<<<<<<<<<< + * self.view.itemsize, + * flags|PyBUF_C_CONTIGUOUS, +*/ + __pyx_t_1 = __pyx_memoryview_copy_new_contig((&__pyx_v_mslice), ((char const *)"c"), __pyx_v_self->view.ndim, __pyx_v_self->view.itemsize, (__pyx_v_flags | PyBUF_C_CONTIGUOUS), __pyx_v_self->dtype_is_object); if (unlikely(PyErr_Occurred())) __PYX_ERR(1, 642, __pyx_L1_error) + __pyx_v_mslice = __pyx_t_1; + + /* "View.MemoryView":647 + * self.dtype_is_object) + * + * return memoryview_copy_from_slice(self, &mslice) # <<<<<<<<<<<<<< + * + * def copy_fortran(self): +*/ + __Pyx_XDECREF(__pyx_r); + __pyx_t_2 = __pyx_memoryview_copy_object_from_slice(__pyx_v_self, (&__pyx_v_mslice)); if (unlikely(!__pyx_t_2)) __PYX_ERR(1, 647, __pyx_L1_error) + __Pyx_GOTREF(__pyx_t_2); + __pyx_r = __pyx_t_2; + __pyx_t_2 = 0; + goto __pyx_L0; + + /* "View.MemoryView":637 + * return slice_is_contig(mslice[0], 'F', self.view.ndim) + * + * def copy(self): # <<<<<<<<<<<<<< + * cdef __Pyx_memviewslice mslice + * cdef int flags = self.flags & ~PyBUF_F_CONTIGUOUS +*/ + + /* function exit code */ + __pyx_L1_error:; + __Pyx_XDECREF(__pyx_t_2); + __Pyx_AddTraceback("View.MemoryView.memoryview.copy", __pyx_clineno, __pyx_lineno, __pyx_filename); + __pyx_r = NULL; + __pyx_L0:; + __Pyx_XGIVEREF(__pyx_r); + __Pyx_RefNannyFinishContext(); + return __pyx_r; +} + +/* "View.MemoryView":649 + * return memoryview_copy_from_slice(self, &mslice) + * + * def copy_fortran(self): # <<<<<<<<<<<<<< + * cdef __Pyx_memviewslice src, dst + * cdef int flags = self.flags & ~PyBUF_C_CONTIGUOUS +*/ + +/* Python wrapper */ +static PyObject *__pyx_memoryview_copy_fortran(PyObject *__pyx_v_self, +#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*/ +static PyObject *__pyx_memoryview_copy_fortran(PyObject *__pyx_v_self, +#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("copy_fortran (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("copy_fortran", 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("copy_fortran", __pyx_kwds); return NULL;} + __pyx_r = __pyx_memoryview___pyx_pf_15View_dot_MemoryView_10memoryview_22copy_fortran(((struct __pyx_memoryview_obj *)__pyx_v_self)); + + /* function exit code */ + __Pyx_RefNannyFinishContext(); + return __pyx_r; +} + +static PyObject *__pyx_memoryview___pyx_pf_15View_dot_MemoryView_10memoryview_22copy_fortran(struct __pyx_memoryview_obj *__pyx_v_self) { + __Pyx_memviewslice __pyx_v_src; + __Pyx_memviewslice __pyx_v_dst; + int __pyx_v_flags; + PyObject *__pyx_r = NULL; + __Pyx_RefNannyDeclarations + __Pyx_memviewslice __pyx_t_1; + PyObject *__pyx_t_2 = NULL; + int __pyx_lineno = 0; + const char *__pyx_filename = NULL; + int __pyx_clineno = 0; + __Pyx_RefNannySetupContext("copy_fortran", 0); + + /* "View.MemoryView":651 + * def copy_fortran(self): + * cdef __Pyx_memviewslice src, dst + * cdef int flags = self.flags & ~PyBUF_C_CONTIGUOUS # <<<<<<<<<<<<<< + * + * slice_copy(self, &src) +*/ + __pyx_v_flags = (__pyx_v_self->flags & (~PyBUF_C_CONTIGUOUS)); + + /* "View.MemoryView":653 + * cdef int flags = self.flags & ~PyBUF_C_CONTIGUOUS + * + * slice_copy(self, &src) # <<<<<<<<<<<<<< + * dst = slice_copy_contig(&src, "fortran", self.view.ndim, + * self.view.itemsize, +*/ + __pyx_memoryview_slice_copy(__pyx_v_self, (&__pyx_v_src)); + + /* "View.MemoryView":654 + * + * slice_copy(self, &src) + * dst = slice_copy_contig(&src, "fortran", self.view.ndim, # <<<<<<<<<<<<<< + * self.view.itemsize, + * flags|PyBUF_F_CONTIGUOUS, +*/ + __pyx_t_1 = __pyx_memoryview_copy_new_contig((&__pyx_v_src), ((char const *)"fortran"), __pyx_v_self->view.ndim, __pyx_v_self->view.itemsize, (__pyx_v_flags | PyBUF_F_CONTIGUOUS), __pyx_v_self->dtype_is_object); if (unlikely(PyErr_Occurred())) __PYX_ERR(1, 654, __pyx_L1_error) + __pyx_v_dst = __pyx_t_1; + + /* "View.MemoryView":659 + * self.dtype_is_object) + * + * return memoryview_copy_from_slice(self, &dst) # <<<<<<<<<<<<<< + * + * +*/ + __Pyx_XDECREF(__pyx_r); + __pyx_t_2 = __pyx_memoryview_copy_object_from_slice(__pyx_v_self, (&__pyx_v_dst)); if (unlikely(!__pyx_t_2)) __PYX_ERR(1, 659, __pyx_L1_error) + __Pyx_GOTREF(__pyx_t_2); + __pyx_r = __pyx_t_2; + __pyx_t_2 = 0; + goto __pyx_L0; + + /* "View.MemoryView":649 + * return memoryview_copy_from_slice(self, &mslice) + * + * def copy_fortran(self): # <<<<<<<<<<<<<< + * cdef __Pyx_memviewslice src, dst + * cdef int flags = self.flags & ~PyBUF_C_CONTIGUOUS +*/ + + /* function exit code */ + __pyx_L1_error:; + __Pyx_XDECREF(__pyx_t_2); + __Pyx_AddTraceback("View.MemoryView.memoryview.copy_fortran", __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___pyx_memoryview_1__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*/ +static PyObject *__pyx_pw___pyx_memoryview_1__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___pyx_memoryview___reduce_cython__(((struct __pyx_memoryview_obj *)__pyx_v_self)); + + /* function exit code */ + __Pyx_RefNannyFinishContext(); + return __pyx_r; +} + +static PyObject *__pyx_pf___pyx_memoryview___reduce_cython__(CYTHON_UNUSED struct __pyx_memoryview_obj *__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("View.MemoryView.memoryview.__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___pyx_memoryview_3__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*/ +static PyObject *__pyx_pw___pyx_memoryview_3__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("View.MemoryView.memoryview.__setstate_cython__", __pyx_clineno, __pyx_lineno, __pyx_filename); + __Pyx_RefNannyFinishContext(); + return NULL; + __pyx_L4_argument_unpacking_done:; + __pyx_r = __pyx_pf___pyx_memoryview_2__setstate_cython__(((struct __pyx_memoryview_obj *)__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___pyx_memoryview_2__setstate_cython__(CYTHON_UNUSED struct __pyx_memoryview_obj *__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("View.MemoryView.memoryview.__setstate_cython__", __pyx_clineno, __pyx_lineno, __pyx_filename); + __pyx_r = NULL; + __Pyx_XGIVEREF(__pyx_r); + __Pyx_RefNannyFinishContext(); + return __pyx_r; +} + +/* "View.MemoryView":662 + * + * + * @cname('__pyx_memoryview_new') # <<<<<<<<<<<<<< + * cdef memoryview_cwrapper(object o, int flags, bint dtype_is_object, const __Pyx_TypeInfo *typeinfo): + * cdef memoryview result = memoryview(o, flags, dtype_is_object) +*/ + +static PyObject *__pyx_memoryview_new(PyObject *__pyx_v_o, int __pyx_v_flags, int __pyx_v_dtype_is_object, __Pyx_TypeInfo const *__pyx_v_typeinfo) { + struct __pyx_memoryview_obj *__pyx_v_result = 0; + PyObject *__pyx_r = NULL; + __Pyx_RefNannyDeclarations + PyObject *__pyx_t_1 = NULL; + PyObject *__pyx_t_2 = NULL; + PyObject *__pyx_t_3 = NULL; + PyObject *__pyx_t_4 = NULL; + size_t __pyx_t_5; + int __pyx_lineno = 0; + const char *__pyx_filename = NULL; + int __pyx_clineno = 0; + __Pyx_RefNannySetupContext("memoryview_cwrapper", 0); + + /* "View.MemoryView":664 + * @cname('__pyx_memoryview_new') + * cdef memoryview_cwrapper(object o, int flags, bint dtype_is_object, const __Pyx_TypeInfo *typeinfo): + * cdef memoryview result = memoryview(o, flags, dtype_is_object) # <<<<<<<<<<<<<< + * result.typeinfo = typeinfo + * return result +*/ + __pyx_t_2 = NULL; + __pyx_t_3 = __Pyx_PyLong_From_int(__pyx_v_flags); if (unlikely(!__pyx_t_3)) __PYX_ERR(1, 664, __pyx_L1_error) + __Pyx_GOTREF(__pyx_t_3); + __pyx_t_4 = __Pyx_PyBool_FromLong(__pyx_v_dtype_is_object); if (unlikely(!__pyx_t_4)) __PYX_ERR(1, 664, __pyx_L1_error) + __Pyx_GOTREF(__pyx_t_4); + __pyx_t_5 = 1; + { + PyObject *__pyx_callargs[4] = {__pyx_t_2, __pyx_v_o, __pyx_t_3, __pyx_t_4}; + __pyx_t_1 = __Pyx_PyObject_FastCall((PyObject*)__pyx_mstate_global->__pyx_memoryview_type, __pyx_callargs+__pyx_t_5, (4-__pyx_t_5) | (__pyx_t_5*__Pyx_PY_VECTORCALL_ARGUMENTS_OFFSET)); + __Pyx_XDECREF(__pyx_t_2); __pyx_t_2 = 0; + __Pyx_DECREF(__pyx_t_3); __pyx_t_3 = 0; + __Pyx_DECREF(__pyx_t_4); __pyx_t_4 = 0; + if (unlikely(!__pyx_t_1)) __PYX_ERR(1, 664, __pyx_L1_error) + __Pyx_GOTREF((PyObject *)__pyx_t_1); + } + __pyx_v_result = ((struct __pyx_memoryview_obj *)__pyx_t_1); + __pyx_t_1 = 0; + + /* "View.MemoryView":665 + * cdef memoryview_cwrapper(object o, int flags, bint dtype_is_object, const __Pyx_TypeInfo *typeinfo): + * cdef memoryview result = memoryview(o, flags, dtype_is_object) + * result.typeinfo = typeinfo # <<<<<<<<<<<<<< + * return result + * +*/ + __pyx_v_result->typeinfo = __pyx_v_typeinfo; + + /* "View.MemoryView":666 + * cdef memoryview result = memoryview(o, flags, dtype_is_object) + * result.typeinfo = typeinfo + * return result # <<<<<<<<<<<<<< + * + * @cname('__pyx_memoryview_check') +*/ + __Pyx_XDECREF(__pyx_r); + __Pyx_INCREF((PyObject *)__pyx_v_result); + __pyx_r = ((PyObject *)__pyx_v_result); + goto __pyx_L0; + + /* "View.MemoryView":662 + * + * + * @cname('__pyx_memoryview_new') # <<<<<<<<<<<<<< + * cdef memoryview_cwrapper(object o, int flags, bint dtype_is_object, const __Pyx_TypeInfo *typeinfo): + * cdef memoryview result = memoryview(o, flags, dtype_is_object) +*/ + + /* function exit code */ + __pyx_L1_error:; + __Pyx_XDECREF(__pyx_t_1); + __Pyx_XDECREF(__pyx_t_2); + __Pyx_XDECREF(__pyx_t_3); + __Pyx_XDECREF(__pyx_t_4); + __Pyx_AddTraceback("View.MemoryView.memoryview_cwrapper", __pyx_clineno, __pyx_lineno, __pyx_filename); + __pyx_r = 0; + __pyx_L0:; + __Pyx_XDECREF((PyObject *)__pyx_v_result); + __Pyx_XGIVEREF(__pyx_r); + __Pyx_RefNannyFinishContext(); + return __pyx_r; +} + +/* "View.MemoryView":668 + * return result + * + * @cname('__pyx_memoryview_check') # <<<<<<<<<<<<<< + * cdef inline bint memoryview_check(object o) noexcept: + * return isinstance(o, memoryview) +*/ + +static CYTHON_INLINE int __pyx_memoryview_check(PyObject *__pyx_v_o) { + int __pyx_r; + int __pyx_t_1; + + /* "View.MemoryView":670 + * @cname('__pyx_memoryview_check') + * cdef inline bint memoryview_check(object o) noexcept: + * return isinstance(o, memoryview) # <<<<<<<<<<<<<< + * + * cdef tuple _unellipsify(object index, int ndim): +*/ + __pyx_t_1 = __Pyx_TypeCheck(__pyx_v_o, __pyx_mstate_global->__pyx_memoryview_type); + __pyx_r = __pyx_t_1; + goto __pyx_L0; + + /* "View.MemoryView":668 + * return result + * + * @cname('__pyx_memoryview_check') # <<<<<<<<<<<<<< + * cdef inline bint memoryview_check(object o) noexcept: + * return isinstance(o, memoryview) +*/ + + /* function exit code */ + __pyx_L0:; + return __pyx_r; +} + +/* "View.MemoryView":672 + * return isinstance(o, memoryview) + * + * cdef tuple _unellipsify(object index, int ndim): # <<<<<<<<<<<<<< + * """ + * Replace all ellipses with full slices and fill incomplete indices with +*/ + +static PyObject *_unellipsify(PyObject *__pyx_v_index, int __pyx_v_ndim) { + Py_ssize_t __pyx_v_idx; + PyObject *__pyx_v_tup = NULL; + PyObject *__pyx_v_result = NULL; + int __pyx_v_have_slices; + int __pyx_v_seen_ellipsis; + PyObject *__pyx_v_item = NULL; + Py_ssize_t __pyx_v_nslices; + PyObject *__pyx_r = NULL; + __Pyx_RefNannyDeclarations + PyObject *__pyx_t_1 = NULL; + int __pyx_t_2; + PyObject *__pyx_t_3 = NULL; + Py_ssize_t __pyx_t_4; + Py_ssize_t __pyx_t_5; + PyObject *__pyx_t_6[3]; + PyObject *__pyx_t_7 = NULL; + int __pyx_lineno = 0; + const char *__pyx_filename = NULL; + int __pyx_clineno = 0; + __Pyx_RefNannySetupContext("_unellipsify", 0); + + /* "View.MemoryView":678 + * """ + * cdef Py_ssize_t idx + * tup = index if isinstance(index, tuple) else (index,) # <<<<<<<<<<<<<< + * + * result = [slice(None)] * ndim +*/ + __pyx_t_2 = PyTuple_Check(__pyx_v_index); + if (__pyx_t_2) { + __Pyx_INCREF(((PyObject*)__pyx_v_index)); + __pyx_t_1 = __pyx_v_index; + } else { + __pyx_t_3 = PyTuple_New(1); if (unlikely(!__pyx_t_3)) __PYX_ERR(1, 678, __pyx_L1_error) + __Pyx_GOTREF(__pyx_t_3); + __Pyx_INCREF(__pyx_v_index); + __Pyx_GIVEREF(__pyx_v_index); + if (__Pyx_PyTuple_SET_ITEM(__pyx_t_3, 0, __pyx_v_index) != (0)) __PYX_ERR(1, 678, __pyx_L1_error); + __pyx_t_1 = __pyx_t_3; + __pyx_t_3 = 0; + } + __pyx_v_tup = ((PyObject*)__pyx_t_1); + __pyx_t_1 = 0; + + /* "View.MemoryView":680 + * tup = index if isinstance(index, tuple) else (index,) + * + * result = [slice(None)] * ndim # <<<<<<<<<<<<<< + * have_slices = False + * seen_ellipsis = False +*/ + __pyx_t_1 = PyList_New(1 * ((__pyx_v_ndim<0) ? 0:__pyx_v_ndim)); if (unlikely(!__pyx_t_1)) __PYX_ERR(1, 680, __pyx_L1_error) + __Pyx_GOTREF(__pyx_t_1); + { Py_ssize_t __pyx_temp; + for (__pyx_temp=0; __pyx_temp < __pyx_v_ndim; __pyx_temp++) { + __Pyx_INCREF(__pyx_mstate_global->__pyx_slice[0]); + __Pyx_GIVEREF(__pyx_mstate_global->__pyx_slice[0]); + if (__Pyx_PyList_SET_ITEM(__pyx_t_1, __pyx_temp, __pyx_mstate_global->__pyx_slice[0]) != (0)) __PYX_ERR(1, 680, __pyx_L1_error); + } + } + __pyx_v_result = ((PyObject*)__pyx_t_1); + __pyx_t_1 = 0; + + /* "View.MemoryView":681 + * + * result = [slice(None)] * ndim + * have_slices = False # <<<<<<<<<<<<<< + * seen_ellipsis = False + * idx = 0 +*/ + __pyx_v_have_slices = 0; + + /* "View.MemoryView":682 + * result = [slice(None)] * ndim + * have_slices = False + * seen_ellipsis = False # <<<<<<<<<<<<<< + * idx = 0 + * for item in tup: +*/ + __pyx_v_seen_ellipsis = 0; + + /* "View.MemoryView":683 + * have_slices = False + * seen_ellipsis = False + * idx = 0 # <<<<<<<<<<<<<< + * for item in tup: + * if item is Ellipsis: +*/ + __pyx_v_idx = 0; + + /* "View.MemoryView":684 + * seen_ellipsis = False + * idx = 0 + * for item in tup: # <<<<<<<<<<<<<< + * if item is Ellipsis: + * if not seen_ellipsis: +*/ + if (unlikely(__pyx_v_tup == Py_None)) { + PyErr_SetString(PyExc_TypeError, "'NoneType' object is not iterable"); + __PYX_ERR(1, 684, __pyx_L1_error) + } + __pyx_t_1 = __pyx_v_tup; __Pyx_INCREF(__pyx_t_1); + __pyx_t_4 = 0; + for (;;) { + { + Py_ssize_t __pyx_temp = __Pyx_PyTuple_GET_SIZE(__pyx_t_1); + #if !CYTHON_ASSUME_SAFE_SIZE + if (unlikely((__pyx_temp < 0))) __PYX_ERR(1, 684, __pyx_L1_error) + #endif + if (__pyx_t_4 >= __pyx_temp) break; + } + #if CYTHON_ASSUME_SAFE_MACROS && !CYTHON_AVOID_BORROWED_REFS + __pyx_t_3 = __Pyx_NewRef(PyTuple_GET_ITEM(__pyx_t_1, __pyx_t_4)); + #else + __pyx_t_3 = __Pyx_PySequence_ITEM(__pyx_t_1, __pyx_t_4); + #endif + ++__pyx_t_4; + if (unlikely(!__pyx_t_3)) __PYX_ERR(1, 684, __pyx_L1_error) + __Pyx_GOTREF(__pyx_t_3); + __Pyx_XDECREF_SET(__pyx_v_item, __pyx_t_3); + __pyx_t_3 = 0; + + /* "View.MemoryView":685 + * idx = 0 + * for item in tup: + * if item is Ellipsis: # <<<<<<<<<<<<<< + * if not seen_ellipsis: + * idx += ndim - len(tup) +*/ + __pyx_t_2 = (__pyx_v_item == __pyx_builtin_Ellipsis); + if (__pyx_t_2) { + + /* "View.MemoryView":686 + * for item in tup: + * if item is Ellipsis: + * if not seen_ellipsis: # <<<<<<<<<<<<<< + * idx += ndim - len(tup) + * seen_ellipsis = True +*/ + __pyx_t_2 = (!__pyx_v_seen_ellipsis); + if (__pyx_t_2) { + + /* "View.MemoryView":687 + * if item is Ellipsis: + * if not seen_ellipsis: + * idx += ndim - len(tup) # <<<<<<<<<<<<<< + * seen_ellipsis = True + * have_slices = True +*/ + if (unlikely(__pyx_v_tup == Py_None)) { + PyErr_SetString(PyExc_TypeError, "object of type 'NoneType' has no len()"); + __PYX_ERR(1, 687, __pyx_L1_error) + } + __pyx_t_5 = __Pyx_PyTuple_GET_SIZE(__pyx_v_tup); if (unlikely(__pyx_t_5 == ((Py_ssize_t)-1))) __PYX_ERR(1, 687, __pyx_L1_error) + __pyx_v_idx = (__pyx_v_idx + (__pyx_v_ndim - __pyx_t_5)); + + /* "View.MemoryView":688 + * if not seen_ellipsis: + * idx += ndim - len(tup) + * seen_ellipsis = True # <<<<<<<<<<<<<< + * have_slices = True + * else: +*/ + __pyx_v_seen_ellipsis = 1; + + /* "View.MemoryView":686 + * for item in tup: + * if item is Ellipsis: + * if not seen_ellipsis: # <<<<<<<<<<<<<< + * idx += ndim - len(tup) + * seen_ellipsis = True +*/ + } + + /* "View.MemoryView":689 + * idx += ndim - len(tup) + * seen_ellipsis = True + * have_slices = True # <<<<<<<<<<<<<< + * else: + * if isinstance(item, slice): +*/ + __pyx_v_have_slices = 1; + + /* "View.MemoryView":685 + * idx = 0 + * for item in tup: + * if item is Ellipsis: # <<<<<<<<<<<<<< + * if not seen_ellipsis: + * idx += ndim - len(tup) +*/ + goto __pyx_L5; + } + + /* "View.MemoryView":691 + * have_slices = True + * else: + * if isinstance(item, slice): # <<<<<<<<<<<<<< + * have_slices = True + * elif not PyIndex_Check(item): +*/ + /*else*/ { + __pyx_t_2 = PySlice_Check(__pyx_v_item); + if (__pyx_t_2) { + + /* "View.MemoryView":692 + * else: + * if isinstance(item, slice): + * have_slices = True # <<<<<<<<<<<<<< + * elif not PyIndex_Check(item): + * raise TypeError, f"Cannot index with type '{type(item)}'" +*/ + __pyx_v_have_slices = 1; + + /* "View.MemoryView":691 + * have_slices = True + * else: + * if isinstance(item, slice): # <<<<<<<<<<<<<< + * have_slices = True + * elif not PyIndex_Check(item): +*/ + goto __pyx_L7; + } + + /* "View.MemoryView":693 + * if isinstance(item, slice): + * have_slices = True + * elif not PyIndex_Check(item): # <<<<<<<<<<<<<< + * raise TypeError, f"Cannot index with type '{type(item)}'" + * result[idx] = item +*/ + __pyx_t_2 = (!(PyIndex_Check(__pyx_v_item) != 0)); + if (unlikely(__pyx_t_2)) { + + /* "View.MemoryView":694 + * have_slices = True + * elif not PyIndex_Check(item): + * raise TypeError, f"Cannot index with type '{type(item)}'" # <<<<<<<<<<<<<< + * result[idx] = item + * idx += 1 +*/ + __pyx_t_3 = __Pyx_PyObject_FormatSimple(((PyObject *)Py_TYPE(__pyx_v_item)), __pyx_mstate_global->__pyx_empty_unicode); if (unlikely(!__pyx_t_3)) __PYX_ERR(1, 694, __pyx_L1_error) + __Pyx_GOTREF(__pyx_t_3); + __pyx_t_6[0] = __pyx_mstate_global->__pyx_kp_u_Cannot_index_with_type; + __pyx_t_6[1] = __pyx_t_3; + __pyx_t_6[2] = __pyx_mstate_global->__pyx_kp_u__4; + __pyx_t_7 = __Pyx_PyUnicode_Join(__pyx_t_6, 3, 24 + __Pyx_PyUnicode_GET_LENGTH(__pyx_t_3) + 1, 127 | __Pyx_PyUnicode_MAX_CHAR_VALUE(__pyx_t_3)); + if (unlikely(!__pyx_t_7)) __PYX_ERR(1, 694, __pyx_L1_error) + __Pyx_GOTREF(__pyx_t_7); + __Pyx_DECREF(__pyx_t_3); __pyx_t_3 = 0; + __Pyx_Raise(((PyObject *)(((PyTypeObject*)PyExc_TypeError))), __pyx_t_7, 0, 0); + __Pyx_DECREF(__pyx_t_7); __pyx_t_7 = 0; + __PYX_ERR(1, 694, __pyx_L1_error) + + /* "View.MemoryView":693 + * if isinstance(item, slice): + * have_slices = True + * elif not PyIndex_Check(item): # <<<<<<<<<<<<<< + * raise TypeError, f"Cannot index with type '{type(item)}'" + * result[idx] = item +*/ + } + __pyx_L7:; + + /* "View.MemoryView":695 + * elif not PyIndex_Check(item): + * raise TypeError, f"Cannot index with type '{type(item)}'" + * result[idx] = item # <<<<<<<<<<<<<< + * idx += 1 + * +*/ + if (unlikely((__Pyx_SetItemInt(__pyx_v_result, __pyx_v_idx, __pyx_v_item, Py_ssize_t, 1, PyLong_FromSsize_t, 1, 1, 1, 1, __Pyx_ReferenceSharing_OwnStrongReference) < 0))) __PYX_ERR(1, 695, __pyx_L1_error) + } + __pyx_L5:; + + /* "View.MemoryView":696 + * raise TypeError, f"Cannot index with type '{type(item)}'" + * result[idx] = item + * idx += 1 # <<<<<<<<<<<<<< + * + * nslices = ndim - idx +*/ + __pyx_v_idx = (__pyx_v_idx + 1); + + /* "View.MemoryView":684 + * seen_ellipsis = False + * idx = 0 + * for item in tup: # <<<<<<<<<<<<<< + * if item is Ellipsis: + * if not seen_ellipsis: +*/ + } + __Pyx_DECREF(__pyx_t_1); __pyx_t_1 = 0; + + /* "View.MemoryView":698 + * idx += 1 + * + * nslices = ndim - idx # <<<<<<<<<<<<<< + * return have_slices or nslices, tuple(result) + * +*/ + __pyx_v_nslices = (__pyx_v_ndim - __pyx_v_idx); + + /* "View.MemoryView":699 + * + * nslices = ndim - idx + * return have_slices or nslices, tuple(result) # <<<<<<<<<<<<<< + * + * cdef int assert_direct_dimensions(Py_ssize_t *suboffsets, int ndim) except -1: +*/ + __Pyx_XDECREF(__pyx_r); + if (!__pyx_v_have_slices) { + } else { + __pyx_t_7 = __Pyx_PyBool_FromLong(__pyx_v_have_slices); if (unlikely(!__pyx_t_7)) __PYX_ERR(1, 699, __pyx_L1_error) + __Pyx_GOTREF(__pyx_t_7); + __pyx_t_1 = __pyx_t_7; + __pyx_t_7 = 0; + goto __pyx_L9_bool_binop_done; + } + __pyx_t_7 = PyLong_FromSsize_t(__pyx_v_nslices); if (unlikely(!__pyx_t_7)) __PYX_ERR(1, 699, __pyx_L1_error) + __Pyx_GOTREF(__pyx_t_7); + __pyx_t_1 = __pyx_t_7; + __pyx_t_7 = 0; + __pyx_L9_bool_binop_done:; + __pyx_t_7 = PyList_AsTuple(__pyx_v_result); if (unlikely(!__pyx_t_7)) __PYX_ERR(1, 699, __pyx_L1_error) + __Pyx_GOTREF(__pyx_t_7); + __pyx_t_3 = PyTuple_New(2); if (unlikely(!__pyx_t_3)) __PYX_ERR(1, 699, __pyx_L1_error) + __Pyx_GOTREF(__pyx_t_3); + __Pyx_GIVEREF(__pyx_t_1); + if (__Pyx_PyTuple_SET_ITEM(__pyx_t_3, 0, __pyx_t_1) != (0)) __PYX_ERR(1, 699, __pyx_L1_error); + __Pyx_GIVEREF(__pyx_t_7); + if (__Pyx_PyTuple_SET_ITEM(__pyx_t_3, 1, __pyx_t_7) != (0)) __PYX_ERR(1, 699, __pyx_L1_error); + __pyx_t_1 = 0; + __pyx_t_7 = 0; + __pyx_r = ((PyObject*)__pyx_t_3); + __pyx_t_3 = 0; + goto __pyx_L0; + + /* "View.MemoryView":672 + * return isinstance(o, memoryview) + * + * cdef tuple _unellipsify(object index, int ndim): # <<<<<<<<<<<<<< + * """ + * Replace all ellipses with full slices and fill incomplete indices with +*/ + + /* function exit code */ + __pyx_L1_error:; + __Pyx_XDECREF(__pyx_t_1); + __Pyx_XDECREF(__pyx_t_3); + __Pyx_XDECREF(__pyx_t_7); + __Pyx_AddTraceback("View.MemoryView._unellipsify", __pyx_clineno, __pyx_lineno, __pyx_filename); + __pyx_r = 0; + __pyx_L0:; + __Pyx_XDECREF(__pyx_v_tup); + __Pyx_XDECREF(__pyx_v_result); + __Pyx_XDECREF(__pyx_v_item); + __Pyx_XGIVEREF(__pyx_r); + __Pyx_RefNannyFinishContext(); + return __pyx_r; +} + +/* "View.MemoryView":701 + * return have_slices or nslices, tuple(result) + * + * cdef int assert_direct_dimensions(Py_ssize_t *suboffsets, int ndim) except -1: # <<<<<<<<<<<<<< + * for suboffset in suboffsets[:ndim]: + * if suboffset >= 0: +*/ + +static int assert_direct_dimensions(Py_ssize_t *__pyx_v_suboffsets, int __pyx_v_ndim) { + Py_ssize_t __pyx_v_suboffset; + int __pyx_r; + Py_ssize_t *__pyx_t_1; + Py_ssize_t *__pyx_t_2; + Py_ssize_t *__pyx_t_3; + int __pyx_t_4; + int __pyx_lineno = 0; + const char *__pyx_filename = NULL; + int __pyx_clineno = 0; + + /* "View.MemoryView":702 + * + * cdef int assert_direct_dimensions(Py_ssize_t *suboffsets, int ndim) except -1: + * for suboffset in suboffsets[:ndim]: # <<<<<<<<<<<<<< + * if suboffset >= 0: + * raise ValueError, "Indirect dimensions not supported" +*/ + __pyx_t_2 = (__pyx_v_suboffsets + __pyx_v_ndim); + for (__pyx_t_3 = __pyx_v_suboffsets; __pyx_t_3 < __pyx_t_2; __pyx_t_3++) { + __pyx_t_1 = __pyx_t_3; + __pyx_v_suboffset = (__pyx_t_1[0]); + + /* "View.MemoryView":703 + * cdef int assert_direct_dimensions(Py_ssize_t *suboffsets, int ndim) except -1: + * for suboffset in suboffsets[:ndim]: + * if suboffset >= 0: # <<<<<<<<<<<<<< + * raise ValueError, "Indirect dimensions not supported" + * return 0 # return type just used as an error flag +*/ + __pyx_t_4 = (__pyx_v_suboffset >= 0); + if (unlikely(__pyx_t_4)) { + + /* "View.MemoryView":704 + * for suboffset in suboffsets[:ndim]: + * if suboffset >= 0: + * raise ValueError, "Indirect dimensions not supported" # <<<<<<<<<<<<<< + * return 0 # return type just used as an error flag + * +*/ + __Pyx_Raise(((PyObject *)(((PyTypeObject*)PyExc_ValueError))), __pyx_mstate_global->__pyx_kp_u_Indirect_dimensions_not_supporte, 0, 0); + __PYX_ERR(1, 704, __pyx_L1_error) + + /* "View.MemoryView":703 + * cdef int assert_direct_dimensions(Py_ssize_t *suboffsets, int ndim) except -1: + * for suboffset in suboffsets[:ndim]: + * if suboffset >= 0: # <<<<<<<<<<<<<< + * raise ValueError, "Indirect dimensions not supported" + * return 0 # return type just used as an error flag +*/ + } + } + + /* "View.MemoryView":705 + * if suboffset >= 0: + * raise ValueError, "Indirect dimensions not supported" + * return 0 # return type just used as an error flag # <<<<<<<<<<<<<< + * + * +*/ + __pyx_r = 0; + goto __pyx_L0; + + /* "View.MemoryView":701 + * return have_slices or nslices, tuple(result) + * + * cdef int assert_direct_dimensions(Py_ssize_t *suboffsets, int ndim) except -1: # <<<<<<<<<<<<<< + * for suboffset in suboffsets[:ndim]: + * if suboffset >= 0: +*/ + + /* function exit code */ + __pyx_L1_error:; + __Pyx_AddTraceback("View.MemoryView.assert_direct_dimensions", __pyx_clineno, __pyx_lineno, __pyx_filename); + __pyx_r = -1; + __pyx_L0:; + return __pyx_r; +} + +/* "View.MemoryView":711 + * + * + * @cname('__pyx_memview_slice') # <<<<<<<<<<<<<< + * cdef memoryview memview_slice(memoryview memview, object indices): + * cdef int new_ndim = 0, suboffset_dim = -1, dim +*/ + +static struct __pyx_memoryview_obj *__pyx_memview_slice(struct __pyx_memoryview_obj *__pyx_v_memview, PyObject *__pyx_v_indices) { + int __pyx_v_new_ndim; + int __pyx_v_suboffset_dim; + int __pyx_v_dim; + __Pyx_memviewslice __pyx_v_src; + __Pyx_memviewslice __pyx_v_dst; + __Pyx_memviewslice *__pyx_v_p_src; + struct __pyx_memoryviewslice_obj *__pyx_v_memviewsliceobj = 0; + __Pyx_memviewslice *__pyx_v_p_dst; + int *__pyx_v_p_suboffset_dim; + Py_ssize_t __pyx_v_start; + Py_ssize_t __pyx_v_stop; + Py_ssize_t __pyx_v_step; + Py_ssize_t __pyx_v_cindex; + int __pyx_v_have_start; + int __pyx_v_have_stop; + int __pyx_v_have_step; + PyObject *__pyx_v_index = NULL; + struct __pyx_memoryview_obj *__pyx_r = NULL; + __Pyx_RefNannyDeclarations + int __pyx_t_1; + PyObject *__pyx_t_2 = NULL; + struct __pyx_memoryview_obj *__pyx_t_3; + char *__pyx_t_4; + int __pyx_t_5; + Py_ssize_t __pyx_t_6; + PyObject *(*__pyx_t_7)(PyObject *); + PyObject *__pyx_t_8 = NULL; + Py_ssize_t __pyx_t_9; + int __pyx_t_10; + Py_ssize_t __pyx_t_11; + int __pyx_lineno = 0; + const char *__pyx_filename = NULL; + int __pyx_clineno = 0; + __Pyx_RefNannySetupContext("memview_slice", 0); + + /* "View.MemoryView":713 + * @cname('__pyx_memview_slice') + * cdef memoryview memview_slice(memoryview memview, object indices): + * cdef int new_ndim = 0, suboffset_dim = -1, dim # <<<<<<<<<<<<<< + * cdef bint negative_step + * cdef __Pyx_memviewslice src, dst +*/ + __pyx_v_new_ndim = 0; + __pyx_v_suboffset_dim = -1; + + /* "View.MemoryView":720 + * + * + * memset(&dst, 0, sizeof(dst)) # <<<<<<<<<<<<<< + * + * cdef _memoryviewslice memviewsliceobj +*/ + (void)(memset((&__pyx_v_dst), 0, (sizeof(__pyx_v_dst)))); + + /* "View.MemoryView":724 + * cdef _memoryviewslice memviewsliceobj + * + * assert memview.view.ndim > 0 # <<<<<<<<<<<<<< + * + * if isinstance(memview, _memoryviewslice): +*/ + #ifndef CYTHON_WITHOUT_ASSERTIONS + if (unlikely(__pyx_assertions_enabled())) { + __pyx_t_1 = (__pyx_v_memview->view.ndim > 0); + if (unlikely(!__pyx_t_1)) { + __Pyx_Raise(((PyObject *)(((PyTypeObject*)PyExc_AssertionError))), 0, 0, 0); + __PYX_ERR(1, 724, __pyx_L1_error) + } + } + #else + if ((1)); else __PYX_ERR(1, 724, __pyx_L1_error) + #endif + + /* "View.MemoryView":726 + * assert memview.view.ndim > 0 + * + * if isinstance(memview, _memoryviewslice): # <<<<<<<<<<<<<< + * memviewsliceobj = memview + * p_src = &memviewsliceobj.from_slice +*/ + __pyx_t_1 = __Pyx_TypeCheck(((PyObject *)__pyx_v_memview), __pyx_mstate_global->__pyx_memoryviewslice_type); + if (__pyx_t_1) { + + /* "View.MemoryView":727 + * + * if isinstance(memview, _memoryviewslice): + * memviewsliceobj = memview # <<<<<<<<<<<<<< + * p_src = &memviewsliceobj.from_slice + * else: +*/ + __pyx_t_2 = ((PyObject *)__pyx_v_memview); + __Pyx_INCREF(__pyx_t_2); + if (!(likely(((__pyx_t_2) == Py_None) || likely(__Pyx_TypeTest(__pyx_t_2, __pyx_mstate_global->__pyx_memoryviewslice_type))))) __PYX_ERR(1, 727, __pyx_L1_error) + __pyx_v_memviewsliceobj = ((struct __pyx_memoryviewslice_obj *)__pyx_t_2); + __pyx_t_2 = 0; + + /* "View.MemoryView":728 + * if isinstance(memview, _memoryviewslice): + * memviewsliceobj = memview + * p_src = &memviewsliceobj.from_slice # <<<<<<<<<<<<<< + * else: + * slice_copy(memview, &src) +*/ + __pyx_v_p_src = (&__pyx_v_memviewsliceobj->from_slice); + + /* "View.MemoryView":726 + * assert memview.view.ndim > 0 + * + * if isinstance(memview, _memoryviewslice): # <<<<<<<<<<<<<< + * memviewsliceobj = memview + * p_src = &memviewsliceobj.from_slice +*/ + goto __pyx_L3; + } + + /* "View.MemoryView":730 + * p_src = &memviewsliceobj.from_slice + * else: + * slice_copy(memview, &src) # <<<<<<<<<<<<<< + * p_src = &src + * +*/ + /*else*/ { + __pyx_memoryview_slice_copy(__pyx_v_memview, (&__pyx_v_src)); + + /* "View.MemoryView":731 + * else: + * slice_copy(memview, &src) + * p_src = &src # <<<<<<<<<<<<<< + * + * +*/ + __pyx_v_p_src = (&__pyx_v_src); + } + __pyx_L3:; + + /* "View.MemoryView":737 + * + * + * dst.memview = p_src.memview # <<<<<<<<<<<<<< + * dst.data = p_src.data + * +*/ + __pyx_t_3 = __pyx_v_p_src->memview; + __pyx_v_dst.memview = __pyx_t_3; + + /* "View.MemoryView":738 + * + * dst.memview = p_src.memview + * dst.data = p_src.data # <<<<<<<<<<<<<< + * + * +*/ + __pyx_t_4 = __pyx_v_p_src->data; + __pyx_v_dst.data = __pyx_t_4; + + /* "View.MemoryView":743 + * + * + * cdef __Pyx_memviewslice *p_dst = &dst # <<<<<<<<<<<<<< + * cdef int *p_suboffset_dim = &suboffset_dim + * cdef Py_ssize_t start, stop, step, cindex +*/ + __pyx_v_p_dst = (&__pyx_v_dst); + + /* "View.MemoryView":744 + * + * cdef __Pyx_memviewslice *p_dst = &dst + * cdef int *p_suboffset_dim = &suboffset_dim # <<<<<<<<<<<<<< + * cdef Py_ssize_t start, stop, step, cindex + * cdef bint have_start, have_stop, have_step +*/ + __pyx_v_p_suboffset_dim = (&__pyx_v_suboffset_dim); + + /* "View.MemoryView":748 + * cdef bint have_start, have_stop, have_step + * + * for dim, index in enumerate(indices): # <<<<<<<<<<<<<< + * if PyIndex_Check(index): + * cindex = index +*/ + __pyx_t_5 = 0; + if (likely(PyList_CheckExact(__pyx_v_indices)) || PyTuple_CheckExact(__pyx_v_indices)) { + __pyx_t_2 = __pyx_v_indices; __Pyx_INCREF(__pyx_t_2); + __pyx_t_6 = 0; + __pyx_t_7 = NULL; + } else { + __pyx_t_6 = -1; __pyx_t_2 = PyObject_GetIter(__pyx_v_indices); if (unlikely(!__pyx_t_2)) __PYX_ERR(1, 748, __pyx_L1_error) + __Pyx_GOTREF(__pyx_t_2); + __pyx_t_7 = (CYTHON_COMPILING_IN_LIMITED_API) ? PyIter_Next : __Pyx_PyObject_GetIterNextFunc(__pyx_t_2); if (unlikely(!__pyx_t_7)) __PYX_ERR(1, 748, __pyx_L1_error) + } + for (;;) { + if (likely(!__pyx_t_7)) { + if (likely(PyList_CheckExact(__pyx_t_2))) { + { + Py_ssize_t __pyx_temp = __Pyx_PyList_GET_SIZE(__pyx_t_2); + #if !CYTHON_ASSUME_SAFE_SIZE + if (unlikely((__pyx_temp < 0))) __PYX_ERR(1, 748, __pyx_L1_error) + #endif + if (__pyx_t_6 >= __pyx_temp) break; + } + __pyx_t_8 = __Pyx_PyList_GetItemRefFast(__pyx_t_2, __pyx_t_6, __Pyx_ReferenceSharing_OwnStrongReference); + ++__pyx_t_6; + } else { + { + Py_ssize_t __pyx_temp = __Pyx_PyTuple_GET_SIZE(__pyx_t_2); + #if !CYTHON_ASSUME_SAFE_SIZE + if (unlikely((__pyx_temp < 0))) __PYX_ERR(1, 748, __pyx_L1_error) + #endif + if (__pyx_t_6 >= __pyx_temp) break; + } + #if CYTHON_ASSUME_SAFE_MACROS && !CYTHON_AVOID_BORROWED_REFS + __pyx_t_8 = __Pyx_NewRef(PyTuple_GET_ITEM(__pyx_t_2, __pyx_t_6)); + #else + __pyx_t_8 = __Pyx_PySequence_ITEM(__pyx_t_2, __pyx_t_6); + #endif + ++__pyx_t_6; + } + if (unlikely(!__pyx_t_8)) __PYX_ERR(1, 748, __pyx_L1_error) + } else { + __pyx_t_8 = __pyx_t_7(__pyx_t_2); + if (unlikely(!__pyx_t_8)) { + PyObject* exc_type = PyErr_Occurred(); + if (exc_type) { + if (unlikely(!__Pyx_PyErr_GivenExceptionMatches(exc_type, PyExc_StopIteration))) __PYX_ERR(1, 748, __pyx_L1_error) + PyErr_Clear(); + } + break; + } + } + __Pyx_GOTREF(__pyx_t_8); + __Pyx_XDECREF_SET(__pyx_v_index, __pyx_t_8); + __pyx_t_8 = 0; + __pyx_v_dim = __pyx_t_5; + __pyx_t_5 = (__pyx_t_5 + 1); + + /* "View.MemoryView":749 + * + * for dim, index in enumerate(indices): + * if PyIndex_Check(index): # <<<<<<<<<<<<<< + * cindex = index + * slice_memviewslice( +*/ + __pyx_t_1 = (PyIndex_Check(__pyx_v_index) != 0); + if (__pyx_t_1) { + + /* "View.MemoryView":750 + * for dim, index in enumerate(indices): + * if PyIndex_Check(index): + * cindex = index # <<<<<<<<<<<<<< + * slice_memviewslice( + * p_dst, p_src.shape[dim], p_src.strides[dim], p_src.suboffsets[dim], +*/ + __pyx_t_9 = __Pyx_PyIndex_AsSsize_t(__pyx_v_index); if (unlikely((__pyx_t_9 == (Py_ssize_t)-1) && PyErr_Occurred())) __PYX_ERR(1, 750, __pyx_L1_error) + __pyx_v_cindex = __pyx_t_9; + + /* "View.MemoryView":751 + * if PyIndex_Check(index): + * cindex = index + * slice_memviewslice( # <<<<<<<<<<<<<< + * p_dst, p_src.shape[dim], p_src.strides[dim], p_src.suboffsets[dim], + * dim, new_ndim, p_suboffset_dim, +*/ + __pyx_t_10 = __pyx_memoryview_slice_memviewslice(__pyx_v_p_dst, (__pyx_v_p_src->shape[__pyx_v_dim]), (__pyx_v_p_src->strides[__pyx_v_dim]), (__pyx_v_p_src->suboffsets[__pyx_v_dim]), __pyx_v_dim, __pyx_v_new_ndim, __pyx_v_p_suboffset_dim, __pyx_v_cindex, 0, 0, 0, 0, 0, 0); if (unlikely(__pyx_t_10 == ((int)-1))) __PYX_ERR(1, 751, __pyx_L1_error) + + /* "View.MemoryView":749 + * + * for dim, index in enumerate(indices): + * if PyIndex_Check(index): # <<<<<<<<<<<<<< + * cindex = index + * slice_memviewslice( +*/ + goto __pyx_L6; + } + + /* "View.MemoryView":757 + * 0, 0, 0, # have_{start,stop,step} + * False) + * elif index is None: # <<<<<<<<<<<<<< + * p_dst.shape[new_ndim] = 1 + * p_dst.strides[new_ndim] = 0 +*/ + __pyx_t_1 = (__pyx_v_index == Py_None); + if (__pyx_t_1) { + + /* "View.MemoryView":758 + * False) + * elif index is None: + * p_dst.shape[new_ndim] = 1 # <<<<<<<<<<<<<< + * p_dst.strides[new_ndim] = 0 + * p_dst.suboffsets[new_ndim] = -1 +*/ + (__pyx_v_p_dst->shape[__pyx_v_new_ndim]) = 1; + + /* "View.MemoryView":759 + * elif index is None: + * p_dst.shape[new_ndim] = 1 + * p_dst.strides[new_ndim] = 0 # <<<<<<<<<<<<<< + * p_dst.suboffsets[new_ndim] = -1 + * new_ndim += 1 +*/ + (__pyx_v_p_dst->strides[__pyx_v_new_ndim]) = 0; + + /* "View.MemoryView":760 + * p_dst.shape[new_ndim] = 1 + * p_dst.strides[new_ndim] = 0 + * p_dst.suboffsets[new_ndim] = -1 # <<<<<<<<<<<<<< + * new_ndim += 1 + * else: +*/ + (__pyx_v_p_dst->suboffsets[__pyx_v_new_ndim]) = -1L; + + /* "View.MemoryView":761 + * p_dst.strides[new_ndim] = 0 + * p_dst.suboffsets[new_ndim] = -1 + * new_ndim += 1 # <<<<<<<<<<<<<< + * else: + * start = index.start or 0 +*/ + __pyx_v_new_ndim = (__pyx_v_new_ndim + 1); + + /* "View.MemoryView":757 + * 0, 0, 0, # have_{start,stop,step} + * False) + * elif index is None: # <<<<<<<<<<<<<< + * p_dst.shape[new_ndim] = 1 + * p_dst.strides[new_ndim] = 0 +*/ + goto __pyx_L6; + } + + /* "View.MemoryView":763 + * new_ndim += 1 + * else: + * start = index.start or 0 # <<<<<<<<<<<<<< + * stop = index.stop or 0 + * step = index.step or 0 +*/ + /*else*/ { + __pyx_t_8 = __Pyx_PyObject_GetAttrStr(__pyx_v_index, __pyx_mstate_global->__pyx_n_u_start); if (unlikely(!__pyx_t_8)) __PYX_ERR(1, 763, __pyx_L1_error) + __Pyx_GOTREF(__pyx_t_8); + __pyx_t_1 = __Pyx_PyObject_IsTrue(__pyx_t_8); if (unlikely((__pyx_t_1 < 0))) __PYX_ERR(1, 763, __pyx_L1_error) + if (!__pyx_t_1) { + __Pyx_DECREF(__pyx_t_8); __pyx_t_8 = 0; + } else { + __pyx_t_11 = __Pyx_PyIndex_AsSsize_t(__pyx_t_8); if (unlikely((__pyx_t_11 == (Py_ssize_t)-1) && PyErr_Occurred())) __PYX_ERR(1, 763, __pyx_L1_error) + __pyx_t_9 = __pyx_t_11; + __Pyx_DECREF(__pyx_t_8); __pyx_t_8 = 0; + goto __pyx_L7_bool_binop_done; + } + __pyx_t_9 = 0; + __pyx_L7_bool_binop_done:; + __pyx_v_start = __pyx_t_9; + + /* "View.MemoryView":764 + * else: + * start = index.start or 0 + * stop = index.stop or 0 # <<<<<<<<<<<<<< + * step = index.step or 0 + * +*/ + __pyx_t_8 = __Pyx_PyObject_GetAttrStr(__pyx_v_index, __pyx_mstate_global->__pyx_n_u_stop); if (unlikely(!__pyx_t_8)) __PYX_ERR(1, 764, __pyx_L1_error) + __Pyx_GOTREF(__pyx_t_8); + __pyx_t_1 = __Pyx_PyObject_IsTrue(__pyx_t_8); if (unlikely((__pyx_t_1 < 0))) __PYX_ERR(1, 764, __pyx_L1_error) + if (!__pyx_t_1) { + __Pyx_DECREF(__pyx_t_8); __pyx_t_8 = 0; + } else { + __pyx_t_11 = __Pyx_PyIndex_AsSsize_t(__pyx_t_8); if (unlikely((__pyx_t_11 == (Py_ssize_t)-1) && PyErr_Occurred())) __PYX_ERR(1, 764, __pyx_L1_error) + __pyx_t_9 = __pyx_t_11; + __Pyx_DECREF(__pyx_t_8); __pyx_t_8 = 0; + goto __pyx_L9_bool_binop_done; + } + __pyx_t_9 = 0; + __pyx_L9_bool_binop_done:; + __pyx_v_stop = __pyx_t_9; + + /* "View.MemoryView":765 + * start = index.start or 0 + * stop = index.stop or 0 + * step = index.step or 0 # <<<<<<<<<<<<<< + * + * have_start = index.start is not None +*/ + __pyx_t_8 = __Pyx_PyObject_GetAttrStr(__pyx_v_index, __pyx_mstate_global->__pyx_n_u_step); if (unlikely(!__pyx_t_8)) __PYX_ERR(1, 765, __pyx_L1_error) + __Pyx_GOTREF(__pyx_t_8); + __pyx_t_1 = __Pyx_PyObject_IsTrue(__pyx_t_8); if (unlikely((__pyx_t_1 < 0))) __PYX_ERR(1, 765, __pyx_L1_error) + if (!__pyx_t_1) { + __Pyx_DECREF(__pyx_t_8); __pyx_t_8 = 0; + } else { + __pyx_t_11 = __Pyx_PyIndex_AsSsize_t(__pyx_t_8); if (unlikely((__pyx_t_11 == (Py_ssize_t)-1) && PyErr_Occurred())) __PYX_ERR(1, 765, __pyx_L1_error) + __pyx_t_9 = __pyx_t_11; + __Pyx_DECREF(__pyx_t_8); __pyx_t_8 = 0; + goto __pyx_L11_bool_binop_done; + } + __pyx_t_9 = 0; + __pyx_L11_bool_binop_done:; + __pyx_v_step = __pyx_t_9; + + /* "View.MemoryView":767 + * step = index.step or 0 + * + * have_start = index.start is not None # <<<<<<<<<<<<<< + * have_stop = index.stop is not None + * have_step = index.step is not None +*/ + __pyx_t_8 = __Pyx_PyObject_GetAttrStr(__pyx_v_index, __pyx_mstate_global->__pyx_n_u_start); if (unlikely(!__pyx_t_8)) __PYX_ERR(1, 767, __pyx_L1_error) + __Pyx_GOTREF(__pyx_t_8); + __pyx_t_1 = (__pyx_t_8 != Py_None); + __Pyx_DECREF(__pyx_t_8); __pyx_t_8 = 0; + __pyx_v_have_start = __pyx_t_1; + + /* "View.MemoryView":768 + * + * have_start = index.start is not None + * have_stop = index.stop is not None # <<<<<<<<<<<<<< + * have_step = index.step is not None + * +*/ + __pyx_t_8 = __Pyx_PyObject_GetAttrStr(__pyx_v_index, __pyx_mstate_global->__pyx_n_u_stop); if (unlikely(!__pyx_t_8)) __PYX_ERR(1, 768, __pyx_L1_error) + __Pyx_GOTREF(__pyx_t_8); + __pyx_t_1 = (__pyx_t_8 != Py_None); + __Pyx_DECREF(__pyx_t_8); __pyx_t_8 = 0; + __pyx_v_have_stop = __pyx_t_1; + + /* "View.MemoryView":769 + * have_start = index.start is not None + * have_stop = index.stop is not None + * have_step = index.step is not None # <<<<<<<<<<<<<< + * + * slice_memviewslice( +*/ + __pyx_t_8 = __Pyx_PyObject_GetAttrStr(__pyx_v_index, __pyx_mstate_global->__pyx_n_u_step); if (unlikely(!__pyx_t_8)) __PYX_ERR(1, 769, __pyx_L1_error) + __Pyx_GOTREF(__pyx_t_8); + __pyx_t_1 = (__pyx_t_8 != Py_None); + __Pyx_DECREF(__pyx_t_8); __pyx_t_8 = 0; + __pyx_v_have_step = __pyx_t_1; + + /* "View.MemoryView":771 + * have_step = index.step is not None + * + * slice_memviewslice( # <<<<<<<<<<<<<< + * p_dst, p_src.shape[dim], p_src.strides[dim], p_src.suboffsets[dim], + * dim, new_ndim, p_suboffset_dim, +*/ + __pyx_t_10 = __pyx_memoryview_slice_memviewslice(__pyx_v_p_dst, (__pyx_v_p_src->shape[__pyx_v_dim]), (__pyx_v_p_src->strides[__pyx_v_dim]), (__pyx_v_p_src->suboffsets[__pyx_v_dim]), __pyx_v_dim, __pyx_v_new_ndim, __pyx_v_p_suboffset_dim, __pyx_v_start, __pyx_v_stop, __pyx_v_step, __pyx_v_have_start, __pyx_v_have_stop, __pyx_v_have_step, 1); if (unlikely(__pyx_t_10 == ((int)-1))) __PYX_ERR(1, 771, __pyx_L1_error) + + /* "View.MemoryView":777 + * have_start, have_stop, have_step, + * True) + * new_ndim += 1 # <<<<<<<<<<<<<< + * + * if isinstance(memview, _memoryviewslice): +*/ + __pyx_v_new_ndim = (__pyx_v_new_ndim + 1); + } + __pyx_L6:; + + /* "View.MemoryView":748 + * cdef bint have_start, have_stop, have_step + * + * for dim, index in enumerate(indices): # <<<<<<<<<<<<<< + * if PyIndex_Check(index): + * cindex = index +*/ + } + __Pyx_DECREF(__pyx_t_2); __pyx_t_2 = 0; + + /* "View.MemoryView":779 + * new_ndim += 1 + * + * if isinstance(memview, _memoryviewslice): # <<<<<<<<<<<<<< + * return memoryview_fromslice(dst, new_ndim, + * memviewsliceobj.to_object_func, +*/ + __pyx_t_1 = __Pyx_TypeCheck(((PyObject *)__pyx_v_memview), __pyx_mstate_global->__pyx_memoryviewslice_type); + if (__pyx_t_1) { + + /* "View.MemoryView":780 + * + * if isinstance(memview, _memoryviewslice): + * return memoryview_fromslice(dst, new_ndim, # <<<<<<<<<<<<<< + * memviewsliceobj.to_object_func, + * memviewsliceobj.to_dtype_func, +*/ + __Pyx_XDECREF((PyObject *)__pyx_r); + + /* "View.MemoryView":781 + * if isinstance(memview, _memoryviewslice): + * return memoryview_fromslice(dst, new_ndim, + * memviewsliceobj.to_object_func, # <<<<<<<<<<<<<< + * memviewsliceobj.to_dtype_func, + * memview.dtype_is_object) +*/ + if (unlikely(!__pyx_v_memviewsliceobj)) { __Pyx_RaiseUnboundLocalError("memviewsliceobj"); __PYX_ERR(1, 781, __pyx_L1_error) } + + /* "View.MemoryView":782 + * return memoryview_fromslice(dst, new_ndim, + * memviewsliceobj.to_object_func, + * memviewsliceobj.to_dtype_func, # <<<<<<<<<<<<<< + * memview.dtype_is_object) + * else: +*/ + if (unlikely(!__pyx_v_memviewsliceobj)) { __Pyx_RaiseUnboundLocalError("memviewsliceobj"); __PYX_ERR(1, 782, __pyx_L1_error) } + + /* "View.MemoryView":780 + * + * if isinstance(memview, _memoryviewslice): + * return memoryview_fromslice(dst, new_ndim, # <<<<<<<<<<<<<< + * memviewsliceobj.to_object_func, + * memviewsliceobj.to_dtype_func, +*/ + __pyx_t_2 = __pyx_memoryview_fromslice(__pyx_v_dst, __pyx_v_new_ndim, __pyx_v_memviewsliceobj->to_object_func, __pyx_v_memviewsliceobj->to_dtype_func, __pyx_v_memview->dtype_is_object); if (unlikely(!__pyx_t_2)) __PYX_ERR(1, 780, __pyx_L1_error) + __Pyx_GOTREF(__pyx_t_2); + if (!(likely(((__pyx_t_2) == Py_None) || likely(__Pyx_TypeTest(__pyx_t_2, __pyx_mstate_global->__pyx_memoryview_type))))) __PYX_ERR(1, 780, __pyx_L1_error) + __pyx_r = ((struct __pyx_memoryview_obj *)__pyx_t_2); + __pyx_t_2 = 0; + goto __pyx_L0; + + /* "View.MemoryView":779 + * new_ndim += 1 + * + * if isinstance(memview, _memoryviewslice): # <<<<<<<<<<<<<< + * return memoryview_fromslice(dst, new_ndim, + * memviewsliceobj.to_object_func, +*/ + } + + /* "View.MemoryView":785 + * memview.dtype_is_object) + * else: + * return memoryview_fromslice(dst, new_ndim, NULL, NULL, # <<<<<<<<<<<<<< + * memview.dtype_is_object) + * +*/ + /*else*/ { + __Pyx_XDECREF((PyObject *)__pyx_r); + + /* "View.MemoryView":786 + * else: + * return memoryview_fromslice(dst, new_ndim, NULL, NULL, + * memview.dtype_is_object) # <<<<<<<<<<<<<< + * + * +*/ + __pyx_t_2 = __pyx_memoryview_fromslice(__pyx_v_dst, __pyx_v_new_ndim, NULL, NULL, __pyx_v_memview->dtype_is_object); if (unlikely(!__pyx_t_2)) __PYX_ERR(1, 785, __pyx_L1_error) + __Pyx_GOTREF(__pyx_t_2); + + /* "View.MemoryView":785 + * memview.dtype_is_object) + * else: + * return memoryview_fromslice(dst, new_ndim, NULL, NULL, # <<<<<<<<<<<<<< + * memview.dtype_is_object) + * +*/ + if (!(likely(((__pyx_t_2) == Py_None) || likely(__Pyx_TypeTest(__pyx_t_2, __pyx_mstate_global->__pyx_memoryview_type))))) __PYX_ERR(1, 785, __pyx_L1_error) + __pyx_r = ((struct __pyx_memoryview_obj *)__pyx_t_2); + __pyx_t_2 = 0; + goto __pyx_L0; + } + + /* "View.MemoryView":711 + * + * + * @cname('__pyx_memview_slice') # <<<<<<<<<<<<<< + * cdef memoryview memview_slice(memoryview memview, object indices): + * cdef int new_ndim = 0, suboffset_dim = -1, dim +*/ + + /* function exit code */ + __pyx_L1_error:; + __Pyx_XDECREF(__pyx_t_2); + __Pyx_XDECREF(__pyx_t_8); + __Pyx_AddTraceback("View.MemoryView.memview_slice", __pyx_clineno, __pyx_lineno, __pyx_filename); + __pyx_r = 0; + __pyx_L0:; + __Pyx_XDECREF((PyObject *)__pyx_v_memviewsliceobj); + __Pyx_XDECREF(__pyx_v_index); + __Pyx_XGIVEREF((PyObject *)__pyx_r); + __Pyx_RefNannyFinishContext(); + return __pyx_r; +} + +/* "View.MemoryView":793 + * + * + * @cname('__pyx_memoryview_slice_memviewslice') # <<<<<<<<<<<<<< + * cdef int slice_memviewslice( + * __Pyx_memviewslice *dst, +*/ + +static int __pyx_memoryview_slice_memviewslice(__Pyx_memviewslice *__pyx_v_dst, Py_ssize_t __pyx_v_shape, Py_ssize_t __pyx_v_stride, Py_ssize_t __pyx_v_suboffset, int __pyx_v_dim, int __pyx_v_new_ndim, int *__pyx_v_suboffset_dim, Py_ssize_t __pyx_v_start, Py_ssize_t __pyx_v_stop, Py_ssize_t __pyx_v_step, int __pyx_v_have_start, int __pyx_v_have_stop, int __pyx_v_have_step, int __pyx_v_is_slice) { + Py_ssize_t __pyx_v_new_shape; + int __pyx_v_negative_step; + int __pyx_r; + int __pyx_t_1; + int __pyx_t_2; + int __pyx_t_3; + int __pyx_lineno = 0; + const char *__pyx_filename = NULL; + int __pyx_clineno = 0; + PyGILState_STATE __pyx_gilstate_save; + + /* "View.MemoryView":814 + * cdef bint negative_step + * + * if not is_slice: # <<<<<<<<<<<<<< + * + * if start < 0: +*/ + __pyx_t_1 = (!__pyx_v_is_slice); + if (__pyx_t_1) { + + /* "View.MemoryView":816 + * if not is_slice: + * + * if start < 0: # <<<<<<<<<<<<<< + * start += shape + * if not 0 <= start < shape: +*/ + __pyx_t_1 = (__pyx_v_start < 0); + if (__pyx_t_1) { + + /* "View.MemoryView":817 + * + * if start < 0: + * start += shape # <<<<<<<<<<<<<< + * if not 0 <= start < shape: + * _err_dim(PyExc_IndexError, "Index out of bounds (axis %d)", dim) +*/ + __pyx_v_start = (__pyx_v_start + __pyx_v_shape); + + /* "View.MemoryView":816 + * if not is_slice: + * + * if start < 0: # <<<<<<<<<<<<<< + * start += shape + * if not 0 <= start < shape: +*/ + } + + /* "View.MemoryView":818 + * if start < 0: + * start += shape + * if not 0 <= start < shape: # <<<<<<<<<<<<<< + * _err_dim(PyExc_IndexError, "Index out of bounds (axis %d)", dim) + * else: +*/ + __pyx_t_1 = (0 <= __pyx_v_start); + if (__pyx_t_1) { + __pyx_t_1 = (__pyx_v_start < __pyx_v_shape); + } + __pyx_t_2 = (!__pyx_t_1); + if (__pyx_t_2) { + + /* "View.MemoryView":819 + * start += shape + * if not 0 <= start < shape: + * _err_dim(PyExc_IndexError, "Index out of bounds (axis %d)", dim) # <<<<<<<<<<<<<< + * else: + * +*/ + __pyx_t_3 = __pyx_memoryview_err_dim(PyExc_IndexError, __pyx_mstate_global->__pyx_kp_u_Index_out_of_bounds_axis_d, __pyx_v_dim); if (unlikely(__pyx_t_3 == ((int)-1))) __PYX_ERR(1, 819, __pyx_L1_error) + + /* "View.MemoryView":818 + * if start < 0: + * start += shape + * if not 0 <= start < shape: # <<<<<<<<<<<<<< + * _err_dim(PyExc_IndexError, "Index out of bounds (axis %d)", dim) + * else: +*/ + } + + /* "View.MemoryView":814 + * cdef bint negative_step + * + * if not is_slice: # <<<<<<<<<<<<<< + * + * if start < 0: +*/ + goto __pyx_L3; + } + + /* "View.MemoryView":822 + * else: + * + * if have_step: # <<<<<<<<<<<<<< + * negative_step = step < 0 + * if step == 0: +*/ + /*else*/ { + __pyx_t_2 = (__pyx_v_have_step != 0); + if (__pyx_t_2) { + + /* "View.MemoryView":823 + * + * if have_step: + * negative_step = step < 0 # <<<<<<<<<<<<<< + * if step == 0: + * _err_dim(PyExc_ValueError, "Step may not be zero (axis %d)", dim) +*/ + __pyx_v_negative_step = (__pyx_v_step < 0); + + /* "View.MemoryView":824 + * if have_step: + * negative_step = step < 0 + * if step == 0: # <<<<<<<<<<<<<< + * _err_dim(PyExc_ValueError, "Step may not be zero (axis %d)", dim) + * else: +*/ + __pyx_t_2 = (__pyx_v_step == 0); + if (__pyx_t_2) { + + /* "View.MemoryView":825 + * negative_step = step < 0 + * if step == 0: + * _err_dim(PyExc_ValueError, "Step may not be zero (axis %d)", dim) # <<<<<<<<<<<<<< + * else: + * negative_step = False +*/ + __pyx_t_3 = __pyx_memoryview_err_dim(PyExc_ValueError, __pyx_mstate_global->__pyx_kp_u_Step_may_not_be_zero_axis_d, __pyx_v_dim); if (unlikely(__pyx_t_3 == ((int)-1))) __PYX_ERR(1, 825, __pyx_L1_error) + + /* "View.MemoryView":824 + * if have_step: + * negative_step = step < 0 + * if step == 0: # <<<<<<<<<<<<<< + * _err_dim(PyExc_ValueError, "Step may not be zero (axis %d)", dim) + * else: +*/ + } + + /* "View.MemoryView":822 + * else: + * + * if have_step: # <<<<<<<<<<<<<< + * negative_step = step < 0 + * if step == 0: +*/ + goto __pyx_L6; + } + + /* "View.MemoryView":827 + * _err_dim(PyExc_ValueError, "Step may not be zero (axis %d)", dim) + * else: + * negative_step = False # <<<<<<<<<<<<<< + * step = 1 + * +*/ + /*else*/ { + __pyx_v_negative_step = 0; + + /* "View.MemoryView":828 + * else: + * negative_step = False + * step = 1 # <<<<<<<<<<<<<< + * + * +*/ + __pyx_v_step = 1; + } + __pyx_L6:; + + /* "View.MemoryView":831 + * + * + * if have_start: # <<<<<<<<<<<<<< + * if start < 0: + * start += shape +*/ + __pyx_t_2 = (__pyx_v_have_start != 0); + if (__pyx_t_2) { + + /* "View.MemoryView":832 + * + * if have_start: + * if start < 0: # <<<<<<<<<<<<<< + * start += shape + * if start < 0: +*/ + __pyx_t_2 = (__pyx_v_start < 0); + if (__pyx_t_2) { + + /* "View.MemoryView":833 + * if have_start: + * if start < 0: + * start += shape # <<<<<<<<<<<<<< + * if start < 0: + * start = 0 +*/ + __pyx_v_start = (__pyx_v_start + __pyx_v_shape); + + /* "View.MemoryView":834 + * if start < 0: + * start += shape + * if start < 0: # <<<<<<<<<<<<<< + * start = 0 + * elif start >= shape: +*/ + __pyx_t_2 = (__pyx_v_start < 0); + if (__pyx_t_2) { + + /* "View.MemoryView":835 + * start += shape + * if start < 0: + * start = 0 # <<<<<<<<<<<<<< + * elif start >= shape: + * if negative_step: +*/ + __pyx_v_start = 0; + + /* "View.MemoryView":834 + * if start < 0: + * start += shape + * if start < 0: # <<<<<<<<<<<<<< + * start = 0 + * elif start >= shape: +*/ + } + + /* "View.MemoryView":832 + * + * if have_start: + * if start < 0: # <<<<<<<<<<<<<< + * start += shape + * if start < 0: +*/ + goto __pyx_L9; + } + + /* "View.MemoryView":836 + * if start < 0: + * start = 0 + * elif start >= shape: # <<<<<<<<<<<<<< + * if negative_step: + * start = shape - 1 +*/ + __pyx_t_2 = (__pyx_v_start >= __pyx_v_shape); + if (__pyx_t_2) { + + /* "View.MemoryView":837 + * start = 0 + * elif start >= shape: + * if negative_step: # <<<<<<<<<<<<<< + * start = shape - 1 + * else: +*/ + if (__pyx_v_negative_step) { + + /* "View.MemoryView":838 + * elif start >= shape: + * if negative_step: + * start = shape - 1 # <<<<<<<<<<<<<< + * else: + * start = shape +*/ + __pyx_v_start = (__pyx_v_shape - 1); + + /* "View.MemoryView":837 + * start = 0 + * elif start >= shape: + * if negative_step: # <<<<<<<<<<<<<< + * start = shape - 1 + * else: +*/ + goto __pyx_L11; + } + + /* "View.MemoryView":840 + * start = shape - 1 + * else: + * start = shape # <<<<<<<<<<<<<< + * else: + * if negative_step: +*/ + /*else*/ { + __pyx_v_start = __pyx_v_shape; + } + __pyx_L11:; + + /* "View.MemoryView":836 + * if start < 0: + * start = 0 + * elif start >= shape: # <<<<<<<<<<<<<< + * if negative_step: + * start = shape - 1 +*/ + } + __pyx_L9:; + + /* "View.MemoryView":831 + * + * + * if have_start: # <<<<<<<<<<<<<< + * if start < 0: + * start += shape +*/ + goto __pyx_L8; + } + + /* "View.MemoryView":842 + * start = shape + * else: + * if negative_step: # <<<<<<<<<<<<<< + * start = shape - 1 + * else: +*/ + /*else*/ { + if (__pyx_v_negative_step) { + + /* "View.MemoryView":843 + * else: + * if negative_step: + * start = shape - 1 # <<<<<<<<<<<<<< + * else: + * start = 0 +*/ + __pyx_v_start = (__pyx_v_shape - 1); + + /* "View.MemoryView":842 + * start = shape + * else: + * if negative_step: # <<<<<<<<<<<<<< + * start = shape - 1 + * else: +*/ + goto __pyx_L12; + } + + /* "View.MemoryView":845 + * start = shape - 1 + * else: + * start = 0 # <<<<<<<<<<<<<< + * + * if have_stop: +*/ + /*else*/ { + __pyx_v_start = 0; + } + __pyx_L12:; + } + __pyx_L8:; + + /* "View.MemoryView":847 + * start = 0 + * + * if have_stop: # <<<<<<<<<<<<<< + * if stop < 0: + * stop += shape +*/ + __pyx_t_2 = (__pyx_v_have_stop != 0); + if (__pyx_t_2) { + + /* "View.MemoryView":848 + * + * if have_stop: + * if stop < 0: # <<<<<<<<<<<<<< + * stop += shape + * if stop < 0: +*/ + __pyx_t_2 = (__pyx_v_stop < 0); + if (__pyx_t_2) { + + /* "View.MemoryView":849 + * if have_stop: + * if stop < 0: + * stop += shape # <<<<<<<<<<<<<< + * if stop < 0: + * stop = 0 +*/ + __pyx_v_stop = (__pyx_v_stop + __pyx_v_shape); + + /* "View.MemoryView":850 + * if stop < 0: + * stop += shape + * if stop < 0: # <<<<<<<<<<<<<< + * stop = 0 + * elif stop > shape: +*/ + __pyx_t_2 = (__pyx_v_stop < 0); + if (__pyx_t_2) { + + /* "View.MemoryView":851 + * stop += shape + * if stop < 0: + * stop = 0 # <<<<<<<<<<<<<< + * elif stop > shape: + * stop = shape +*/ + __pyx_v_stop = 0; + + /* "View.MemoryView":850 + * if stop < 0: + * stop += shape + * if stop < 0: # <<<<<<<<<<<<<< + * stop = 0 + * elif stop > shape: +*/ + } + + /* "View.MemoryView":848 + * + * if have_stop: + * if stop < 0: # <<<<<<<<<<<<<< + * stop += shape + * if stop < 0: +*/ + goto __pyx_L14; + } + + /* "View.MemoryView":852 + * if stop < 0: + * stop = 0 + * elif stop > shape: # <<<<<<<<<<<<<< + * stop = shape + * else: +*/ + __pyx_t_2 = (__pyx_v_stop > __pyx_v_shape); + if (__pyx_t_2) { + + /* "View.MemoryView":853 + * stop = 0 + * elif stop > shape: + * stop = shape # <<<<<<<<<<<<<< + * else: + * if negative_step: +*/ + __pyx_v_stop = __pyx_v_shape; + + /* "View.MemoryView":852 + * if stop < 0: + * stop = 0 + * elif stop > shape: # <<<<<<<<<<<<<< + * stop = shape + * else: +*/ + } + __pyx_L14:; + + /* "View.MemoryView":847 + * start = 0 + * + * if have_stop: # <<<<<<<<<<<<<< + * if stop < 0: + * stop += shape +*/ + goto __pyx_L13; + } + + /* "View.MemoryView":855 + * stop = shape + * else: + * if negative_step: # <<<<<<<<<<<<<< + * stop = -1 + * else: +*/ + /*else*/ { + if (__pyx_v_negative_step) { + + /* "View.MemoryView":856 + * else: + * if negative_step: + * stop = -1 # <<<<<<<<<<<<<< + * else: + * stop = shape +*/ + __pyx_v_stop = -1L; + + /* "View.MemoryView":855 + * stop = shape + * else: + * if negative_step: # <<<<<<<<<<<<<< + * stop = -1 + * else: +*/ + goto __pyx_L16; + } + + /* "View.MemoryView":858 + * stop = -1 + * else: + * stop = shape # <<<<<<<<<<<<<< + * + * +*/ + /*else*/ { + __pyx_v_stop = __pyx_v_shape; + } + __pyx_L16:; + } + __pyx_L13:; + + /* "View.MemoryView":862 + * + * with cython.cdivision(True): + * new_shape = (stop - start) // step # <<<<<<<<<<<<<< + * + * if (stop - start) - step * new_shape: +*/ + __pyx_v_new_shape = ((__pyx_v_stop - __pyx_v_start) / __pyx_v_step); + + /* "View.MemoryView":864 + * new_shape = (stop - start) // step + * + * if (stop - start) - step * new_shape: # <<<<<<<<<<<<<< + * new_shape += 1 + * +*/ + __pyx_t_2 = (((__pyx_v_stop - __pyx_v_start) - (__pyx_v_step * __pyx_v_new_shape)) != 0); + if (__pyx_t_2) { + + /* "View.MemoryView":865 + * + * if (stop - start) - step * new_shape: + * new_shape += 1 # <<<<<<<<<<<<<< + * + * if new_shape < 0: +*/ + __pyx_v_new_shape = (__pyx_v_new_shape + 1); + + /* "View.MemoryView":864 + * new_shape = (stop - start) // step + * + * if (stop - start) - step * new_shape: # <<<<<<<<<<<<<< + * new_shape += 1 + * +*/ + } + + /* "View.MemoryView":867 + * new_shape += 1 + * + * if new_shape < 0: # <<<<<<<<<<<<<< + * new_shape = 0 + * +*/ + __pyx_t_2 = (__pyx_v_new_shape < 0); + if (__pyx_t_2) { + + /* "View.MemoryView":868 + * + * if new_shape < 0: + * new_shape = 0 # <<<<<<<<<<<<<< + * + * +*/ + __pyx_v_new_shape = 0; + + /* "View.MemoryView":867 + * new_shape += 1 + * + * if new_shape < 0: # <<<<<<<<<<<<<< + * new_shape = 0 + * +*/ + } + + /* "View.MemoryView":871 + * + * + * dst.strides[new_ndim] = stride * step # <<<<<<<<<<<<<< + * dst.shape[new_ndim] = new_shape + * dst.suboffsets[new_ndim] = suboffset +*/ + (__pyx_v_dst->strides[__pyx_v_new_ndim]) = (__pyx_v_stride * __pyx_v_step); + + /* "View.MemoryView":872 + * + * dst.strides[new_ndim] = stride * step + * dst.shape[new_ndim] = new_shape # <<<<<<<<<<<<<< + * dst.suboffsets[new_ndim] = suboffset + * +*/ + (__pyx_v_dst->shape[__pyx_v_new_ndim]) = __pyx_v_new_shape; + + /* "View.MemoryView":873 + * dst.strides[new_ndim] = stride * step + * dst.shape[new_ndim] = new_shape + * dst.suboffsets[new_ndim] = suboffset # <<<<<<<<<<<<<< + * + * +*/ + (__pyx_v_dst->suboffsets[__pyx_v_new_ndim]) = __pyx_v_suboffset; + } + __pyx_L3:; + + /* "View.MemoryView":876 + * + * + * if suboffset_dim[0] < 0: # <<<<<<<<<<<<<< + * dst.data += start * stride + * else: +*/ + __pyx_t_2 = ((__pyx_v_suboffset_dim[0]) < 0); + if (__pyx_t_2) { + + /* "View.MemoryView":877 + * + * if suboffset_dim[0] < 0: + * dst.data += start * stride # <<<<<<<<<<<<<< + * else: + * dst.suboffsets[suboffset_dim[0]] += start * stride +*/ + __pyx_v_dst->data = (__pyx_v_dst->data + (__pyx_v_start * __pyx_v_stride)); + + /* "View.MemoryView":876 + * + * + * if suboffset_dim[0] < 0: # <<<<<<<<<<<<<< + * dst.data += start * stride + * else: +*/ + goto __pyx_L19; + } + + /* "View.MemoryView":879 + * dst.data += start * stride + * else: + * dst.suboffsets[suboffset_dim[0]] += start * stride # <<<<<<<<<<<<<< + * + * if suboffset >= 0: +*/ + /*else*/ { + __pyx_t_3 = (__pyx_v_suboffset_dim[0]); + (__pyx_v_dst->suboffsets[__pyx_t_3]) = ((__pyx_v_dst->suboffsets[__pyx_t_3]) + (__pyx_v_start * __pyx_v_stride)); + } + __pyx_L19:; + + /* "View.MemoryView":881 + * dst.suboffsets[suboffset_dim[0]] += start * stride + * + * if suboffset >= 0: # <<<<<<<<<<<<<< + * if not is_slice: + * if new_ndim == 0: +*/ + __pyx_t_2 = (__pyx_v_suboffset >= 0); + if (__pyx_t_2) { + + /* "View.MemoryView":882 + * + * if suboffset >= 0: + * if not is_slice: # <<<<<<<<<<<<<< + * if new_ndim == 0: + * dst.data = ( dst.data)[0] + suboffset +*/ + __pyx_t_2 = (!__pyx_v_is_slice); + if (__pyx_t_2) { + + /* "View.MemoryView":883 + * if suboffset >= 0: + * if not is_slice: + * if new_ndim == 0: # <<<<<<<<<<<<<< + * dst.data = ( dst.data)[0] + suboffset + * else: +*/ + __pyx_t_2 = (__pyx_v_new_ndim == 0); + if (__pyx_t_2) { + + /* "View.MemoryView":884 + * if not is_slice: + * if new_ndim == 0: + * dst.data = ( dst.data)[0] + suboffset # <<<<<<<<<<<<<< + * else: + * _err_dim(PyExc_IndexError, "All dimensions preceding dimension %d " +*/ + __pyx_v_dst->data = ((((char **)__pyx_v_dst->data)[0]) + __pyx_v_suboffset); + + /* "View.MemoryView":883 + * if suboffset >= 0: + * if not is_slice: + * if new_ndim == 0: # <<<<<<<<<<<<<< + * dst.data = ( dst.data)[0] + suboffset + * else: +*/ + goto __pyx_L22; + } + + /* "View.MemoryView":886 + * dst.data = ( dst.data)[0] + suboffset + * else: + * _err_dim(PyExc_IndexError, "All dimensions preceding dimension %d " # <<<<<<<<<<<<<< + * "must be indexed and not sliced", dim) + * else: +*/ + /*else*/ { + + /* "View.MemoryView":887 + * else: + * _err_dim(PyExc_IndexError, "All dimensions preceding dimension %d " + * "must be indexed and not sliced", dim) # <<<<<<<<<<<<<< + * else: + * suboffset_dim[0] = new_ndim +*/ + __pyx_t_3 = __pyx_memoryview_err_dim(PyExc_IndexError, __pyx_mstate_global->__pyx_kp_u_All_dimensions_preceding_dimensi, __pyx_v_dim); if (unlikely(__pyx_t_3 == ((int)-1))) __PYX_ERR(1, 886, __pyx_L1_error) + } + __pyx_L22:; + + /* "View.MemoryView":882 + * + * if suboffset >= 0: + * if not is_slice: # <<<<<<<<<<<<<< + * if new_ndim == 0: + * dst.data = ( dst.data)[0] + suboffset +*/ + goto __pyx_L21; + } + + /* "View.MemoryView":889 + * "must be indexed and not sliced", dim) + * else: + * suboffset_dim[0] = new_ndim # <<<<<<<<<<<<<< + * + * return 0 +*/ + /*else*/ { + (__pyx_v_suboffset_dim[0]) = __pyx_v_new_ndim; + } + __pyx_L21:; + + /* "View.MemoryView":881 + * dst.suboffsets[suboffset_dim[0]] += start * stride + * + * if suboffset >= 0: # <<<<<<<<<<<<<< + * if not is_slice: + * if new_ndim == 0: +*/ + } + + /* "View.MemoryView":891 + * suboffset_dim[0] = new_ndim + * + * return 0 # <<<<<<<<<<<<<< + * + * +*/ + __pyx_r = 0; + goto __pyx_L0; + + /* "View.MemoryView":793 + * + * + * @cname('__pyx_memoryview_slice_memviewslice') # <<<<<<<<<<<<<< + * cdef int slice_memviewslice( + * __Pyx_memviewslice *dst, +*/ + + /* function exit code */ + __pyx_L1_error:; + __pyx_gilstate_save = __Pyx_PyGILState_Ensure(); + __Pyx_AddTraceback("View.MemoryView.slice_memviewslice", __pyx_clineno, __pyx_lineno, __pyx_filename); + __pyx_r = -1; + __Pyx_PyGILState_Release(__pyx_gilstate_save); + __pyx_L0:; + return __pyx_r; +} + +/* "View.MemoryView":896 + * + * + * @cname('__pyx_pybuffer_index') # <<<<<<<<<<<<<< + * cdef char *pybuffer_index(Py_buffer *view, char *bufp, Py_ssize_t index, + * Py_ssize_t dim) except NULL: +*/ + +static char *__pyx_pybuffer_index(Py_buffer *__pyx_v_view, char *__pyx_v_bufp, Py_ssize_t __pyx_v_index, Py_ssize_t __pyx_v_dim) { + Py_ssize_t __pyx_v_shape; + Py_ssize_t __pyx_v_stride; + Py_ssize_t __pyx_v_suboffset; + Py_ssize_t __pyx_v_itemsize; + char *__pyx_v_resultp; + char *__pyx_r; + __Pyx_RefNannyDeclarations + Py_ssize_t __pyx_t_1; + int __pyx_t_2; + PyObject *__pyx_t_3 = NULL; + PyObject *__pyx_t_4[3]; + PyObject *__pyx_t_5 = NULL; + int __pyx_lineno = 0; + const char *__pyx_filename = NULL; + int __pyx_clineno = 0; + __Pyx_RefNannySetupContext("pybuffer_index", 0); + + /* "View.MemoryView":899 + * cdef char *pybuffer_index(Py_buffer *view, char *bufp, Py_ssize_t index, + * Py_ssize_t dim) except NULL: + * cdef Py_ssize_t shape, stride, suboffset = -1 # <<<<<<<<<<<<<< + * cdef Py_ssize_t itemsize = view.itemsize + * cdef char *resultp +*/ + __pyx_v_suboffset = -1L; + + /* "View.MemoryView":900 + * Py_ssize_t dim) except NULL: + * cdef Py_ssize_t shape, stride, suboffset = -1 + * cdef Py_ssize_t itemsize = view.itemsize # <<<<<<<<<<<<<< + * cdef char *resultp + * +*/ + __pyx_t_1 = __pyx_v_view->itemsize; + __pyx_v_itemsize = __pyx_t_1; + + /* "View.MemoryView":903 + * cdef char *resultp + * + * if view.ndim == 0: # <<<<<<<<<<<<<< + * shape = view.len // itemsize + * stride = itemsize +*/ + __pyx_t_2 = (__pyx_v_view->ndim == 0); + if (__pyx_t_2) { + + /* "View.MemoryView":904 + * + * if view.ndim == 0: + * shape = view.len // itemsize # <<<<<<<<<<<<<< + * stride = itemsize + * else: +*/ + if (unlikely(__pyx_v_itemsize == 0)) { + PyErr_SetString(PyExc_ZeroDivisionError, "integer division or modulo by zero"); + __PYX_ERR(1, 904, __pyx_L1_error) + } + else if (sizeof(Py_ssize_t) == sizeof(long) && (!(((Py_ssize_t)-1) > 0)) && unlikely(__pyx_v_itemsize == (Py_ssize_t)-1) && unlikely(__Pyx_UNARY_NEG_WOULD_OVERFLOW(__pyx_v_view->len))) { + PyErr_SetString(PyExc_OverflowError, "value too large to perform division"); + __PYX_ERR(1, 904, __pyx_L1_error) + } + __pyx_v_shape = __Pyx_div_Py_ssize_t(__pyx_v_view->len, __pyx_v_itemsize, 0); + + /* "View.MemoryView":905 + * if view.ndim == 0: + * shape = view.len // itemsize + * stride = itemsize # <<<<<<<<<<<<<< + * else: + * shape = view.shape[dim] +*/ + __pyx_v_stride = __pyx_v_itemsize; + + /* "View.MemoryView":903 + * cdef char *resultp + * + * if view.ndim == 0: # <<<<<<<<<<<<<< + * shape = view.len // itemsize + * stride = itemsize +*/ + goto __pyx_L3; + } + + /* "View.MemoryView":907 + * stride = itemsize + * else: + * shape = view.shape[dim] # <<<<<<<<<<<<<< + * stride = view.strides[dim] + * if view.suboffsets != NULL: +*/ + /*else*/ { + __pyx_v_shape = (__pyx_v_view->shape[__pyx_v_dim]); + + /* "View.MemoryView":908 + * else: + * shape = view.shape[dim] + * stride = view.strides[dim] # <<<<<<<<<<<<<< + * if view.suboffsets != NULL: + * suboffset = view.suboffsets[dim] +*/ + __pyx_v_stride = (__pyx_v_view->strides[__pyx_v_dim]); + + /* "View.MemoryView":909 + * shape = view.shape[dim] + * stride = view.strides[dim] + * if view.suboffsets != NULL: # <<<<<<<<<<<<<< + * suboffset = view.suboffsets[dim] + * +*/ + __pyx_t_2 = (__pyx_v_view->suboffsets != NULL); + if (__pyx_t_2) { + + /* "View.MemoryView":910 + * stride = view.strides[dim] + * if view.suboffsets != NULL: + * suboffset = view.suboffsets[dim] # <<<<<<<<<<<<<< + * + * if index < 0: +*/ + __pyx_v_suboffset = (__pyx_v_view->suboffsets[__pyx_v_dim]); + + /* "View.MemoryView":909 + * shape = view.shape[dim] + * stride = view.strides[dim] + * if view.suboffsets != NULL: # <<<<<<<<<<<<<< + * suboffset = view.suboffsets[dim] + * +*/ + } + } + __pyx_L3:; + + /* "View.MemoryView":912 + * suboffset = view.suboffsets[dim] + * + * if index < 0: # <<<<<<<<<<<<<< + * index += view.shape[dim] + * if index < 0: +*/ + __pyx_t_2 = (__pyx_v_index < 0); + if (__pyx_t_2) { + + /* "View.MemoryView":913 + * + * if index < 0: + * index += view.shape[dim] # <<<<<<<<<<<<<< + * if index < 0: + * raise IndexError, f"Out of bounds on buffer access (axis {dim})" +*/ + __pyx_v_index = (__pyx_v_index + (__pyx_v_view->shape[__pyx_v_dim])); + + /* "View.MemoryView":914 + * if index < 0: + * index += view.shape[dim] + * if index < 0: # <<<<<<<<<<<<<< + * raise IndexError, f"Out of bounds on buffer access (axis {dim})" + * +*/ + __pyx_t_2 = (__pyx_v_index < 0); + if (unlikely(__pyx_t_2)) { + + /* "View.MemoryView":915 + * index += view.shape[dim] + * if index < 0: + * raise IndexError, f"Out of bounds on buffer access (axis {dim})" # <<<<<<<<<<<<<< + * + * if index >= shape: +*/ + __pyx_t_3 = __Pyx_PyUnicode_From_Py_ssize_t(__pyx_v_dim, 0, ' ', 'd'); if (unlikely(!__pyx_t_3)) __PYX_ERR(1, 915, __pyx_L1_error) + __Pyx_GOTREF(__pyx_t_3); + __pyx_t_4[0] = __pyx_mstate_global->__pyx_kp_u_Out_of_bounds_on_buffer_access_a; + __pyx_t_4[1] = __pyx_t_3; + __pyx_t_4[2] = __pyx_mstate_global->__pyx_kp_u__5; + __pyx_t_5 = __Pyx_PyUnicode_Join(__pyx_t_4, 3, 37 + __Pyx_PyUnicode_GET_LENGTH(__pyx_t_3) + 1, 127); + if (unlikely(!__pyx_t_5)) __PYX_ERR(1, 915, __pyx_L1_error) + __Pyx_GOTREF(__pyx_t_5); + __Pyx_DECREF(__pyx_t_3); __pyx_t_3 = 0; + __Pyx_Raise(((PyObject *)(((PyTypeObject*)PyExc_IndexError))), __pyx_t_5, 0, 0); + __Pyx_DECREF(__pyx_t_5); __pyx_t_5 = 0; + __PYX_ERR(1, 915, __pyx_L1_error) + + /* "View.MemoryView":914 + * if index < 0: + * index += view.shape[dim] + * if index < 0: # <<<<<<<<<<<<<< + * raise IndexError, f"Out of bounds on buffer access (axis {dim})" + * +*/ + } + + /* "View.MemoryView":912 + * suboffset = view.suboffsets[dim] + * + * if index < 0: # <<<<<<<<<<<<<< + * index += view.shape[dim] + * if index < 0: +*/ + } + + /* "View.MemoryView":917 + * raise IndexError, f"Out of bounds on buffer access (axis {dim})" + * + * if index >= shape: # <<<<<<<<<<<<<< + * raise IndexError, f"Out of bounds on buffer access (axis {dim})" + * +*/ + __pyx_t_2 = (__pyx_v_index >= __pyx_v_shape); + if (unlikely(__pyx_t_2)) { + + /* "View.MemoryView":918 + * + * if index >= shape: + * raise IndexError, f"Out of bounds on buffer access (axis {dim})" # <<<<<<<<<<<<<< + * + * resultp = bufp + index * stride +*/ + __pyx_t_5 = __Pyx_PyUnicode_From_Py_ssize_t(__pyx_v_dim, 0, ' ', 'd'); if (unlikely(!__pyx_t_5)) __PYX_ERR(1, 918, __pyx_L1_error) + __Pyx_GOTREF(__pyx_t_5); + __pyx_t_4[0] = __pyx_mstate_global->__pyx_kp_u_Out_of_bounds_on_buffer_access_a; + __pyx_t_4[1] = __pyx_t_5; + __pyx_t_4[2] = __pyx_mstate_global->__pyx_kp_u__5; + __pyx_t_3 = __Pyx_PyUnicode_Join(__pyx_t_4, 3, 37 + __Pyx_PyUnicode_GET_LENGTH(__pyx_t_5) + 1, 127); + if (unlikely(!__pyx_t_3)) __PYX_ERR(1, 918, __pyx_L1_error) + __Pyx_GOTREF(__pyx_t_3); + __Pyx_DECREF(__pyx_t_5); __pyx_t_5 = 0; + __Pyx_Raise(((PyObject *)(((PyTypeObject*)PyExc_IndexError))), __pyx_t_3, 0, 0); + __Pyx_DECREF(__pyx_t_3); __pyx_t_3 = 0; + __PYX_ERR(1, 918, __pyx_L1_error) + + /* "View.MemoryView":917 + * raise IndexError, f"Out of bounds on buffer access (axis {dim})" + * + * if index >= shape: # <<<<<<<<<<<<<< + * raise IndexError, f"Out of bounds on buffer access (axis {dim})" + * +*/ + } + + /* "View.MemoryView":920 + * raise IndexError, f"Out of bounds on buffer access (axis {dim})" + * + * resultp = bufp + index * stride # <<<<<<<<<<<<<< + * if suboffset >= 0: + * resultp = ( resultp)[0] + suboffset +*/ + __pyx_v_resultp = (__pyx_v_bufp + (__pyx_v_index * __pyx_v_stride)); + + /* "View.MemoryView":921 + * + * resultp = bufp + index * stride + * if suboffset >= 0: # <<<<<<<<<<<<<< + * resultp = ( resultp)[0] + suboffset + * +*/ + __pyx_t_2 = (__pyx_v_suboffset >= 0); + if (__pyx_t_2) { + + /* "View.MemoryView":922 + * resultp = bufp + index * stride + * if suboffset >= 0: + * resultp = ( resultp)[0] + suboffset # <<<<<<<<<<<<<< + * + * return resultp +*/ + __pyx_v_resultp = ((((char **)__pyx_v_resultp)[0]) + __pyx_v_suboffset); + + /* "View.MemoryView":921 + * + * resultp = bufp + index * stride + * if suboffset >= 0: # <<<<<<<<<<<<<< + * resultp = ( resultp)[0] + suboffset + * +*/ + } + + /* "View.MemoryView":924 + * resultp = ( resultp)[0] + suboffset + * + * return resultp # <<<<<<<<<<<<<< + * + * +*/ + __pyx_r = __pyx_v_resultp; + goto __pyx_L0; + + /* "View.MemoryView":896 + * + * + * @cname('__pyx_pybuffer_index') # <<<<<<<<<<<<<< + * cdef char *pybuffer_index(Py_buffer *view, char *bufp, Py_ssize_t index, + * Py_ssize_t dim) except NULL: +*/ + + /* function exit code */ + __pyx_L1_error:; + __Pyx_XDECREF(__pyx_t_3); + __Pyx_XDECREF(__pyx_t_5); + __Pyx_AddTraceback("View.MemoryView.pybuffer_index", __pyx_clineno, __pyx_lineno, __pyx_filename); + __pyx_r = NULL; + __pyx_L0:; + __Pyx_RefNannyFinishContext(); + return __pyx_r; +} + +/* "View.MemoryView":929 + * + * + * @cname('__pyx_memslice_transpose') # <<<<<<<<<<<<<< + * cdef int transpose_memslice(__Pyx_memviewslice *memslice) except -1 nogil: + * cdef int ndim = memslice.memview.view.ndim +*/ + +static int __pyx_memslice_transpose(__Pyx_memviewslice *__pyx_v_memslice) { + int __pyx_v_ndim; + Py_ssize_t *__pyx_v_shape; + Py_ssize_t *__pyx_v_strides; + int __pyx_v_i; + int __pyx_v_j; + int __pyx_r; + int __pyx_t_1; + Py_ssize_t *__pyx_t_2; + long __pyx_t_3; + long __pyx_t_4; + Py_ssize_t __pyx_t_5; + Py_ssize_t __pyx_t_6; + int __pyx_t_7; + int __pyx_t_8; + int __pyx_t_9; + int __pyx_lineno = 0; + const char *__pyx_filename = NULL; + int __pyx_clineno = 0; + PyGILState_STATE __pyx_gilstate_save; + + /* "View.MemoryView":931 + * @cname('__pyx_memslice_transpose') + * cdef int transpose_memslice(__Pyx_memviewslice *memslice) except -1 nogil: + * cdef int ndim = memslice.memview.view.ndim # <<<<<<<<<<<<<< + * + * cdef Py_ssize_t *shape = memslice.shape +*/ + __pyx_t_1 = __pyx_v_memslice->memview->view.ndim; + __pyx_v_ndim = __pyx_t_1; + + /* "View.MemoryView":933 + * cdef int ndim = memslice.memview.view.ndim + * + * cdef Py_ssize_t *shape = memslice.shape # <<<<<<<<<<<<<< + * cdef Py_ssize_t *strides = memslice.strides + * +*/ + __pyx_t_2 = __pyx_v_memslice->shape; + __pyx_v_shape = __pyx_t_2; + + /* "View.MemoryView":934 + * + * cdef Py_ssize_t *shape = memslice.shape + * cdef Py_ssize_t *strides = memslice.strides # <<<<<<<<<<<<<< + * + * +*/ + __pyx_t_2 = __pyx_v_memslice->strides; + __pyx_v_strides = __pyx_t_2; + + /* "View.MemoryView":938 + * + * cdef int i, j + * for i in range(ndim // 2): # <<<<<<<<<<<<<< + * j = ndim - 1 - i + * strides[i], strides[j] = strides[j], strides[i] +*/ + __pyx_t_3 = __Pyx_div_long(__pyx_v_ndim, 2, 1); + __pyx_t_4 = __pyx_t_3; + for (__pyx_t_1 = 0; __pyx_t_1 < __pyx_t_4; __pyx_t_1+=1) { + __pyx_v_i = __pyx_t_1; + + /* "View.MemoryView":939 + * cdef int i, j + * for i in range(ndim // 2): + * j = ndim - 1 - i # <<<<<<<<<<<<<< + * strides[i], strides[j] = strides[j], strides[i] + * shape[i], shape[j] = shape[j], shape[i] +*/ + __pyx_v_j = ((__pyx_v_ndim - 1) - __pyx_v_i); + + /* "View.MemoryView":940 + * for i in range(ndim // 2): + * j = ndim - 1 - i + * strides[i], strides[j] = strides[j], strides[i] # <<<<<<<<<<<<<< + * shape[i], shape[j] = shape[j], shape[i] + * +*/ + __pyx_t_5 = (__pyx_v_strides[__pyx_v_j]); + __pyx_t_6 = (__pyx_v_strides[__pyx_v_i]); + (__pyx_v_strides[__pyx_v_i]) = __pyx_t_5; + (__pyx_v_strides[__pyx_v_j]) = __pyx_t_6; + + /* "View.MemoryView":941 + * j = ndim - 1 - i + * strides[i], strides[j] = strides[j], strides[i] + * shape[i], shape[j] = shape[j], shape[i] # <<<<<<<<<<<<<< + * + * if memslice.suboffsets[i] >= 0 or memslice.suboffsets[j] >= 0: +*/ + __pyx_t_6 = (__pyx_v_shape[__pyx_v_j]); + __pyx_t_5 = (__pyx_v_shape[__pyx_v_i]); + (__pyx_v_shape[__pyx_v_i]) = __pyx_t_6; + (__pyx_v_shape[__pyx_v_j]) = __pyx_t_5; + + /* "View.MemoryView":943 + * shape[i], shape[j] = shape[j], shape[i] + * + * if memslice.suboffsets[i] >= 0 or memslice.suboffsets[j] >= 0: # <<<<<<<<<<<<<< + * _err(PyExc_ValueError, "Cannot transpose memoryview with indirect dimensions") + * +*/ + __pyx_t_8 = ((__pyx_v_memslice->suboffsets[__pyx_v_i]) >= 0); + if (!__pyx_t_8) { + } else { + __pyx_t_7 = __pyx_t_8; + goto __pyx_L6_bool_binop_done; + } + __pyx_t_8 = ((__pyx_v_memslice->suboffsets[__pyx_v_j]) >= 0); + __pyx_t_7 = __pyx_t_8; + __pyx_L6_bool_binop_done:; + if (__pyx_t_7) { + + /* "View.MemoryView":944 + * + * if memslice.suboffsets[i] >= 0 or memslice.suboffsets[j] >= 0: + * _err(PyExc_ValueError, "Cannot transpose memoryview with indirect dimensions") # <<<<<<<<<<<<<< + * + * return 0 +*/ + __pyx_t_9 = __pyx_memoryview_err(PyExc_ValueError, __pyx_mstate_global->__pyx_kp_u_Cannot_transpose_memoryview_with); if (unlikely(__pyx_t_9 == ((int)-1))) __PYX_ERR(1, 944, __pyx_L1_error) + + /* "View.MemoryView":943 + * shape[i], shape[j] = shape[j], shape[i] + * + * if memslice.suboffsets[i] >= 0 or memslice.suboffsets[j] >= 0: # <<<<<<<<<<<<<< + * _err(PyExc_ValueError, "Cannot transpose memoryview with indirect dimensions") + * +*/ + } + } + + /* "View.MemoryView":946 + * _err(PyExc_ValueError, "Cannot transpose memoryview with indirect dimensions") + * + * return 0 # <<<<<<<<<<<<<< + * + * +*/ + __pyx_r = 0; + goto __pyx_L0; + + /* "View.MemoryView":929 + * + * + * @cname('__pyx_memslice_transpose') # <<<<<<<<<<<<<< + * cdef int transpose_memslice(__Pyx_memviewslice *memslice) except -1 nogil: + * cdef int ndim = memslice.memview.view.ndim +*/ + + /* function exit code */ + __pyx_L1_error:; + __pyx_gilstate_save = __Pyx_PyGILState_Ensure(); + __Pyx_AddTraceback("View.MemoryView.transpose_memslice", __pyx_clineno, __pyx_lineno, __pyx_filename); + __pyx_r = -1; + __Pyx_PyGILState_Release(__pyx_gilstate_save); + __pyx_L0:; + return __pyx_r; +} + +/* "View.MemoryView":964 + * cdef int (*to_dtype_func)(char *, object) except 0 + * + * def __dealloc__(self): # <<<<<<<<<<<<<< + * __PYX_XCLEAR_MEMVIEW(&self.from_slice, 1) + * +*/ + +/* Python wrapper */ +static void __pyx_memoryviewslice___dealloc__(PyObject *__pyx_v_self); /*proto*/ +static void __pyx_memoryviewslice___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_memoryviewslice___pyx_pf_15View_dot_MemoryView_16_memoryviewslice___dealloc__(((struct __pyx_memoryviewslice_obj *)__pyx_v_self)); + + /* function exit code */ + __Pyx_RefNannyFinishContext(); +} + +static void __pyx_memoryviewslice___pyx_pf_15View_dot_MemoryView_16_memoryviewslice___dealloc__(struct __pyx_memoryviewslice_obj *__pyx_v_self) { + + /* "View.MemoryView":965 + * + * def __dealloc__(self): + * __PYX_XCLEAR_MEMVIEW(&self.from_slice, 1) # <<<<<<<<<<<<<< + * + * cdef convert_item_to_object(self, char *itemp): +*/ + __PYX_XCLEAR_MEMVIEW((&__pyx_v_self->from_slice), 1); + + /* "View.MemoryView":964 + * cdef int (*to_dtype_func)(char *, object) except 0 + * + * def __dealloc__(self): # <<<<<<<<<<<<<< + * __PYX_XCLEAR_MEMVIEW(&self.from_slice, 1) + * +*/ + + /* function exit code */ +} + +/* "View.MemoryView":967 + * __PYX_XCLEAR_MEMVIEW(&self.from_slice, 1) + * + * cdef convert_item_to_object(self, char *itemp): # <<<<<<<<<<<<<< + * if self.to_object_func != NULL: + * return self.to_object_func(itemp) +*/ + +static PyObject *__pyx_memoryviewslice_convert_item_to_object(struct __pyx_memoryviewslice_obj *__pyx_v_self, char *__pyx_v_itemp) { + 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("convert_item_to_object", 0); + + /* "View.MemoryView":968 + * + * cdef convert_item_to_object(self, char *itemp): + * if self.to_object_func != NULL: # <<<<<<<<<<<<<< + * return self.to_object_func(itemp) + * else: +*/ + __pyx_t_1 = (__pyx_v_self->to_object_func != NULL); + if (__pyx_t_1) { + + /* "View.MemoryView":969 + * cdef convert_item_to_object(self, char *itemp): + * if self.to_object_func != NULL: + * return self.to_object_func(itemp) # <<<<<<<<<<<<<< + * else: + * return memoryview.convert_item_to_object(self, itemp) +*/ + __Pyx_XDECREF(__pyx_r); + __pyx_t_2 = __pyx_v_self->to_object_func(__pyx_v_itemp); if (unlikely(!__pyx_t_2)) __PYX_ERR(1, 969, __pyx_L1_error) + __Pyx_GOTREF(__pyx_t_2); + __pyx_r = __pyx_t_2; + __pyx_t_2 = 0; + goto __pyx_L0; + + /* "View.MemoryView":968 + * + * cdef convert_item_to_object(self, char *itemp): + * if self.to_object_func != NULL: # <<<<<<<<<<<<<< + * return self.to_object_func(itemp) + * else: +*/ + } + + /* "View.MemoryView":971 + * return self.to_object_func(itemp) + * else: + * return memoryview.convert_item_to_object(self, itemp) # <<<<<<<<<<<<<< + * + * cdef assign_item_from_object(self, char *itemp, object value): +*/ + /*else*/ { + __Pyx_XDECREF(__pyx_r); + __pyx_t_2 = __pyx_memoryview_convert_item_to_object(((struct __pyx_memoryview_obj *)__pyx_v_self), __pyx_v_itemp); if (unlikely(!__pyx_t_2)) __PYX_ERR(1, 971, __pyx_L1_error) + __Pyx_GOTREF(__pyx_t_2); + __pyx_r = __pyx_t_2; + __pyx_t_2 = 0; + goto __pyx_L0; + } + + /* "View.MemoryView":967 + * __PYX_XCLEAR_MEMVIEW(&self.from_slice, 1) + * + * cdef convert_item_to_object(self, char *itemp): # <<<<<<<<<<<<<< + * if self.to_object_func != NULL: + * return self.to_object_func(itemp) +*/ + + /* function exit code */ + __pyx_L1_error:; + __Pyx_XDECREF(__pyx_t_2); + __Pyx_AddTraceback("View.MemoryView._memoryviewslice.convert_item_to_object", __pyx_clineno, __pyx_lineno, __pyx_filename); + __pyx_r = 0; + __pyx_L0:; + __Pyx_XGIVEREF(__pyx_r); + __Pyx_RefNannyFinishContext(); + return __pyx_r; +} + +/* "View.MemoryView":973 + * return memoryview.convert_item_to_object(self, itemp) + * + * cdef assign_item_from_object(self, char *itemp, object value): # <<<<<<<<<<<<<< + * if self.to_dtype_func != NULL: + * self.to_dtype_func(itemp, value) +*/ + +static PyObject *__pyx_memoryviewslice_assign_item_from_object(struct __pyx_memoryviewslice_obj *__pyx_v_self, char *__pyx_v_itemp, PyObject *__pyx_v_value) { + PyObject *__pyx_r = NULL; + __Pyx_RefNannyDeclarations + int __pyx_t_1; + int __pyx_t_2; + PyObject *__pyx_t_3 = NULL; + int __pyx_lineno = 0; + const char *__pyx_filename = NULL; + int __pyx_clineno = 0; + __Pyx_RefNannySetupContext("assign_item_from_object", 0); + + /* "View.MemoryView":974 + * + * cdef assign_item_from_object(self, char *itemp, object value): + * if self.to_dtype_func != NULL: # <<<<<<<<<<<<<< + * self.to_dtype_func(itemp, value) + * else: +*/ + __pyx_t_1 = (__pyx_v_self->to_dtype_func != NULL); + if (__pyx_t_1) { + + /* "View.MemoryView":975 + * cdef assign_item_from_object(self, char *itemp, object value): + * if self.to_dtype_func != NULL: + * self.to_dtype_func(itemp, value) # <<<<<<<<<<<<<< + * else: + * memoryview.assign_item_from_object(self, itemp, value) +*/ + __pyx_t_2 = __pyx_v_self->to_dtype_func(__pyx_v_itemp, __pyx_v_value); if (unlikely(__pyx_t_2 == ((int)0))) __PYX_ERR(1, 975, __pyx_L1_error) + + /* "View.MemoryView":974 + * + * cdef assign_item_from_object(self, char *itemp, object value): + * if self.to_dtype_func != NULL: # <<<<<<<<<<<<<< + * self.to_dtype_func(itemp, value) + * else: +*/ + goto __pyx_L3; + } + + /* "View.MemoryView":977 + * self.to_dtype_func(itemp, value) + * else: + * memoryview.assign_item_from_object(self, itemp, value) # <<<<<<<<<<<<<< + * + * cdef _get_base(self): +*/ + /*else*/ { + __pyx_t_3 = __pyx_memoryview_assign_item_from_object(((struct __pyx_memoryview_obj *)__pyx_v_self), __pyx_v_itemp, __pyx_v_value); if (unlikely(!__pyx_t_3)) __PYX_ERR(1, 977, __pyx_L1_error) + __Pyx_GOTREF(__pyx_t_3); + __Pyx_DECREF(__pyx_t_3); __pyx_t_3 = 0; + } + __pyx_L3:; + + /* "View.MemoryView":973 + * return memoryview.convert_item_to_object(self, itemp) + * + * cdef assign_item_from_object(self, char *itemp, object value): # <<<<<<<<<<<<<< + * if self.to_dtype_func != NULL: + * self.to_dtype_func(itemp, value) +*/ + + /* function exit code */ + __pyx_r = Py_None; __Pyx_INCREF(Py_None); + goto __pyx_L0; + __pyx_L1_error:; + __Pyx_XDECREF(__pyx_t_3); + __Pyx_AddTraceback("View.MemoryView._memoryviewslice.assign_item_from_object", __pyx_clineno, __pyx_lineno, __pyx_filename); + __pyx_r = 0; + __pyx_L0:; + __Pyx_XGIVEREF(__pyx_r); + __Pyx_RefNannyFinishContext(); + return __pyx_r; +} + +/* "View.MemoryView":979 + * memoryview.assign_item_from_object(self, itemp, value) + * + * cdef _get_base(self): # <<<<<<<<<<<<<< + * return self.from_object + * +*/ + +static PyObject *__pyx_memoryviewslice__get_base(struct __pyx_memoryviewslice_obj *__pyx_v_self) { + PyObject *__pyx_r = NULL; + __Pyx_RefNannyDeclarations + __Pyx_RefNannySetupContext("_get_base", 0); + + /* "View.MemoryView":980 + * + * cdef _get_base(self): + * return self.from_object # <<<<<<<<<<<<<< + * + * +*/ + __Pyx_XDECREF(__pyx_r); + __Pyx_INCREF(__pyx_v_self->from_object); + __pyx_r = __pyx_v_self->from_object; + goto __pyx_L0; + + /* "View.MemoryView":979 + * memoryview.assign_item_from_object(self, itemp, value) + * + * cdef _get_base(self): # <<<<<<<<<<<<<< + * return self.from_object + * +*/ + + /* function exit code */ + __pyx_L0:; + __Pyx_XGIVEREF(__pyx_r); + __Pyx_RefNannyFinishContext(); + return __pyx_r; +} + +/* "(tree fragment)":1 + * def __reduce_cython__(self): # <<<<<<<<<<<<<< + * raise TypeError, "no default __reduce__ due to non-trivial __cinit__" + * def __setstate_cython__(self, __pyx_state): +*/ + +/* Python wrapper */ +static PyObject *__pyx_pw___pyx_memoryviewslice_1__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*/ +static PyObject *__pyx_pw___pyx_memoryviewslice_1__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___pyx_memoryviewslice___reduce_cython__(((struct __pyx_memoryviewslice_obj *)__pyx_v_self)); + + /* function exit code */ + __Pyx_RefNannyFinishContext(); + return __pyx_r; +} + +static PyObject *__pyx_pf___pyx_memoryviewslice___reduce_cython__(CYTHON_UNUSED struct __pyx_memoryviewslice_obj *__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("View.MemoryView._memoryviewslice.__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___pyx_memoryviewslice_3__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*/ +static PyObject *__pyx_pw___pyx_memoryviewslice_3__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("View.MemoryView._memoryviewslice.__setstate_cython__", __pyx_clineno, __pyx_lineno, __pyx_filename); + __Pyx_RefNannyFinishContext(); + return NULL; + __pyx_L4_argument_unpacking_done:; + __pyx_r = __pyx_pf___pyx_memoryviewslice_2__setstate_cython__(((struct __pyx_memoryviewslice_obj *)__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___pyx_memoryviewslice_2__setstate_cython__(CYTHON_UNUSED struct __pyx_memoryviewslice_obj *__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("View.MemoryView._memoryviewslice.__setstate_cython__", __pyx_clineno, __pyx_lineno, __pyx_filename); + __pyx_r = NULL; + __Pyx_XGIVEREF(__pyx_r); + __Pyx_RefNannyFinishContext(); + return __pyx_r; +} + +/* "View.MemoryView":999 + * pass # ignore failure, it's a minor issue + * + * @cname('__pyx_memoryview_fromslice') # <<<<<<<<<<<<<< + * cdef memoryview_fromslice(__Pyx_memviewslice memviewslice, + * int ndim, +*/ + +static PyObject *__pyx_memoryview_fromslice(__Pyx_memviewslice __pyx_v_memviewslice, int __pyx_v_ndim, PyObject *(*__pyx_v_to_object_func)(char *), int (*__pyx_v_to_dtype_func)(char *, PyObject *), int __pyx_v_dtype_is_object) { + struct __pyx_memoryviewslice_obj *__pyx_v_result = 0; + Py_ssize_t __pyx_v_suboffset; + PyObject *__pyx_v_length = NULL; + PyObject *__pyx_r = NULL; + __Pyx_RefNannyDeclarations + int __pyx_t_1; + PyObject *__pyx_t_2 = NULL; + PyObject *__pyx_t_3 = NULL; + __Pyx_TypeInfo const *__pyx_t_4; + Py_buffer __pyx_t_5; + Py_ssize_t *__pyx_t_6; + Py_ssize_t *__pyx_t_7; + Py_ssize_t *__pyx_t_8; + Py_ssize_t __pyx_t_9; + int __pyx_lineno = 0; + const char *__pyx_filename = NULL; + int __pyx_clineno = 0; + __Pyx_RefNannySetupContext("memoryview_fromslice", 0); + + /* "View.MemoryView":1008 + * cdef _memoryviewslice result + * + * if memviewslice.memview == Py_None: # <<<<<<<<<<<<<< + * return None + * +*/ + __pyx_t_1 = (((PyObject *)__pyx_v_memviewslice.memview) == Py_None); + if (__pyx_t_1) { + + /* "View.MemoryView":1009 + * + * if memviewslice.memview == Py_None: + * return None # <<<<<<<<<<<<<< + * + * +*/ + __Pyx_XDECREF(__pyx_r); + __pyx_r = Py_None; __Pyx_INCREF(Py_None); + goto __pyx_L0; + + /* "View.MemoryView":1008 + * cdef _memoryviewslice result + * + * if memviewslice.memview == Py_None: # <<<<<<<<<<<<<< + * return None + * +*/ + } + + /* "View.MemoryView":1014 + * + * + * result = _memoryviewslice.__new__(_memoryviewslice, None, 0, dtype_is_object) # <<<<<<<<<<<<<< + * + * result.from_slice = memviewslice +*/ + __pyx_t_2 = __Pyx_PyBool_FromLong(__pyx_v_dtype_is_object); if (unlikely(!__pyx_t_2)) __PYX_ERR(1, 1014, __pyx_L1_error) + __Pyx_GOTREF(__pyx_t_2); + __pyx_t_3 = PyTuple_New(3); if (unlikely(!__pyx_t_3)) __PYX_ERR(1, 1014, __pyx_L1_error) + __Pyx_GOTREF(__pyx_t_3); + __Pyx_INCREF(Py_None); + __Pyx_GIVEREF(Py_None); + if (__Pyx_PyTuple_SET_ITEM(__pyx_t_3, 0, Py_None) != (0)) __PYX_ERR(1, 1014, __pyx_L1_error); + __Pyx_INCREF(__pyx_mstate_global->__pyx_int_0); + __Pyx_GIVEREF(__pyx_mstate_global->__pyx_int_0); + if (__Pyx_PyTuple_SET_ITEM(__pyx_t_3, 1, __pyx_mstate_global->__pyx_int_0) != (0)) __PYX_ERR(1, 1014, __pyx_L1_error); + __Pyx_GIVEREF(__pyx_t_2); + if (__Pyx_PyTuple_SET_ITEM(__pyx_t_3, 2, __pyx_t_2) != (0)) __PYX_ERR(1, 1014, __pyx_L1_error); + __pyx_t_2 = 0; + __pyx_t_2 = ((PyObject *)__pyx_tp_new__memoryviewslice(((PyTypeObject *)__pyx_mstate_global->__pyx_memoryviewslice_type), __pyx_t_3, NULL)); if (unlikely(!__pyx_t_2)) __PYX_ERR(1, 1014, __pyx_L1_error) + __Pyx_GOTREF((PyObject *)__pyx_t_2); + __Pyx_DECREF(__pyx_t_3); __pyx_t_3 = 0; + __pyx_v_result = ((struct __pyx_memoryviewslice_obj *)__pyx_t_2); + __pyx_t_2 = 0; + + /* "View.MemoryView":1016 + * result = _memoryviewslice.__new__(_memoryviewslice, None, 0, dtype_is_object) + * + * result.from_slice = memviewslice # <<<<<<<<<<<<<< + * __PYX_INC_MEMVIEW(&memviewslice, 1) + * +*/ + __pyx_v_result->from_slice = __pyx_v_memviewslice; + + /* "View.MemoryView":1017 + * + * result.from_slice = memviewslice + * __PYX_INC_MEMVIEW(&memviewslice, 1) # <<<<<<<<<<<<<< + * + * result.from_object = ( memviewslice.memview)._get_base() +*/ + __PYX_INC_MEMVIEW((&__pyx_v_memviewslice), 1); + + /* "View.MemoryView":1019 + * __PYX_INC_MEMVIEW(&memviewslice, 1) + * + * result.from_object = ( memviewslice.memview)._get_base() # <<<<<<<<<<<<<< + * result.typeinfo = memviewslice.memview.typeinfo + * +*/ + __pyx_t_2 = ((struct __pyx_vtabstruct_memoryview *)((struct __pyx_memoryview_obj *)__pyx_v_memviewslice.memview)->__pyx_vtab)->_get_base(((struct __pyx_memoryview_obj *)__pyx_v_memviewslice.memview)); if (unlikely(!__pyx_t_2)) __PYX_ERR(1, 1019, __pyx_L1_error) + __Pyx_GOTREF(__pyx_t_2); + __Pyx_GIVEREF(__pyx_t_2); + __Pyx_GOTREF(__pyx_v_result->from_object); + __Pyx_DECREF(__pyx_v_result->from_object); + __pyx_v_result->from_object = __pyx_t_2; + __pyx_t_2 = 0; + + /* "View.MemoryView":1020 + * + * result.from_object = ( memviewslice.memview)._get_base() + * result.typeinfo = memviewslice.memview.typeinfo # <<<<<<<<<<<<<< + * + * result.view = memviewslice.memview.view +*/ + __pyx_t_4 = __pyx_v_memviewslice.memview->typeinfo; + __pyx_v_result->__pyx_base.typeinfo = __pyx_t_4; + + /* "View.MemoryView":1022 + * result.typeinfo = memviewslice.memview.typeinfo + * + * result.view = memviewslice.memview.view # <<<<<<<<<<<<<< + * result.view.buf = memviewslice.data + * result.view.ndim = ndim +*/ + __pyx_t_5 = __pyx_v_memviewslice.memview->view; + __pyx_v_result->__pyx_base.view = __pyx_t_5; + + /* "View.MemoryView":1023 + * + * result.view = memviewslice.memview.view + * result.view.buf = memviewslice.data # <<<<<<<<<<<<<< + * result.view.ndim = ndim + * (<__pyx_buffer *> &result.view).obj = Py_None +*/ + __pyx_v_result->__pyx_base.view.buf = ((void *)__pyx_v_memviewslice.data); + + /* "View.MemoryView":1024 + * result.view = memviewslice.memview.view + * result.view.buf = memviewslice.data + * result.view.ndim = ndim # <<<<<<<<<<<<<< + * (<__pyx_buffer *> &result.view).obj = Py_None + * Py_INCREF(Py_None) +*/ + __pyx_v_result->__pyx_base.view.ndim = __pyx_v_ndim; + + /* "View.MemoryView":1025 + * result.view.buf = memviewslice.data + * result.view.ndim = ndim + * (<__pyx_buffer *> &result.view).obj = Py_None # <<<<<<<<<<<<<< + * Py_INCREF(Py_None) + * +*/ + ((Py_buffer *)(&__pyx_v_result->__pyx_base.view))->obj = Py_None; + + /* "View.MemoryView":1026 + * result.view.ndim = ndim + * (<__pyx_buffer *> &result.view).obj = Py_None + * Py_INCREF(Py_None) # <<<<<<<<<<<<<< + * + * if (memviewslice.memview).flags & PyBUF_WRITABLE: +*/ + Py_INCREF(Py_None); + + /* "View.MemoryView":1028 + * Py_INCREF(Py_None) + * + * if (memviewslice.memview).flags & PyBUF_WRITABLE: # <<<<<<<<<<<<<< + * result.flags = PyBUF_RECORDS + * else: +*/ + __pyx_t_1 = ((((struct __pyx_memoryview_obj *)__pyx_v_memviewslice.memview)->flags & PyBUF_WRITABLE) != 0); + if (__pyx_t_1) { + + /* "View.MemoryView":1029 + * + * if (memviewslice.memview).flags & PyBUF_WRITABLE: + * result.flags = PyBUF_RECORDS # <<<<<<<<<<<<<< + * else: + * result.flags = PyBUF_RECORDS_RO +*/ + __pyx_v_result->__pyx_base.flags = PyBUF_RECORDS; + + /* "View.MemoryView":1028 + * Py_INCREF(Py_None) + * + * if (memviewslice.memview).flags & PyBUF_WRITABLE: # <<<<<<<<<<<<<< + * result.flags = PyBUF_RECORDS + * else: +*/ + goto __pyx_L4; + } + + /* "View.MemoryView":1031 + * result.flags = PyBUF_RECORDS + * else: + * result.flags = PyBUF_RECORDS_RO # <<<<<<<<<<<<<< + * + * result.view.shape = result.from_slice.shape +*/ + /*else*/ { + __pyx_v_result->__pyx_base.flags = PyBUF_RECORDS_RO; + } + __pyx_L4:; + + /* "View.MemoryView":1033 + * result.flags = PyBUF_RECORDS_RO + * + * result.view.shape = result.from_slice.shape # <<<<<<<<<<<<<< + * result.view.strides = result.from_slice.strides + * +*/ + __pyx_v_result->__pyx_base.view.shape = ((Py_ssize_t *)__pyx_v_result->from_slice.shape); + + /* "View.MemoryView":1034 + * + * result.view.shape = result.from_slice.shape + * result.view.strides = result.from_slice.strides # <<<<<<<<<<<<<< + * + * +*/ + __pyx_v_result->__pyx_base.view.strides = ((Py_ssize_t *)__pyx_v_result->from_slice.strides); + + /* "View.MemoryView":1037 + * + * + * result.view.suboffsets = NULL # <<<<<<<<<<<<<< + * for suboffset in result.from_slice.suboffsets[:ndim]: + * if suboffset >= 0: +*/ + __pyx_v_result->__pyx_base.view.suboffsets = NULL; + + /* "View.MemoryView":1038 + * + * result.view.suboffsets = NULL + * for suboffset in result.from_slice.suboffsets[:ndim]: # <<<<<<<<<<<<<< + * if suboffset >= 0: + * result.view.suboffsets = result.from_slice.suboffsets +*/ + __pyx_t_7 = (__pyx_v_result->from_slice.suboffsets + __pyx_v_ndim); + for (__pyx_t_8 = __pyx_v_result->from_slice.suboffsets; __pyx_t_8 < __pyx_t_7; __pyx_t_8++) { + __pyx_t_6 = __pyx_t_8; + __pyx_v_suboffset = (__pyx_t_6[0]); + + /* "View.MemoryView":1039 + * result.view.suboffsets = NULL + * for suboffset in result.from_slice.suboffsets[:ndim]: + * if suboffset >= 0: # <<<<<<<<<<<<<< + * result.view.suboffsets = result.from_slice.suboffsets + * break +*/ + __pyx_t_1 = (__pyx_v_suboffset >= 0); + if (__pyx_t_1) { + + /* "View.MemoryView":1040 + * for suboffset in result.from_slice.suboffsets[:ndim]: + * if suboffset >= 0: + * result.view.suboffsets = result.from_slice.suboffsets # <<<<<<<<<<<<<< + * break + * +*/ + __pyx_v_result->__pyx_base.view.suboffsets = ((Py_ssize_t *)__pyx_v_result->from_slice.suboffsets); + + /* "View.MemoryView":1041 + * if suboffset >= 0: + * result.view.suboffsets = result.from_slice.suboffsets + * break # <<<<<<<<<<<<<< + * + * result.view.len = result.view.itemsize +*/ + goto __pyx_L6_break; + + /* "View.MemoryView":1039 + * result.view.suboffsets = NULL + * for suboffset in result.from_slice.suboffsets[:ndim]: + * if suboffset >= 0: # <<<<<<<<<<<<<< + * result.view.suboffsets = result.from_slice.suboffsets + * break +*/ + } + } + __pyx_L6_break:; + + /* "View.MemoryView":1043 + * break + * + * result.view.len = result.view.itemsize # <<<<<<<<<<<<<< + * for length in result.view.shape[:ndim]: + * result.view.len *= length +*/ + __pyx_t_9 = __pyx_v_result->__pyx_base.view.itemsize; + __pyx_v_result->__pyx_base.view.len = __pyx_t_9; + + /* "View.MemoryView":1044 + * + * result.view.len = result.view.itemsize + * for length in result.view.shape[:ndim]: # <<<<<<<<<<<<<< + * result.view.len *= length + * +*/ + __pyx_t_7 = (__pyx_v_result->__pyx_base.view.shape + __pyx_v_ndim); + for (__pyx_t_8 = __pyx_v_result->__pyx_base.view.shape; __pyx_t_8 < __pyx_t_7; __pyx_t_8++) { + __pyx_t_6 = __pyx_t_8; + __pyx_t_2 = PyLong_FromSsize_t((__pyx_t_6[0])); if (unlikely(!__pyx_t_2)) __PYX_ERR(1, 1044, __pyx_L1_error) + __Pyx_GOTREF(__pyx_t_2); + __Pyx_XDECREF_SET(__pyx_v_length, __pyx_t_2); + __pyx_t_2 = 0; + + /* "View.MemoryView":1045 + * result.view.len = result.view.itemsize + * for length in result.view.shape[:ndim]: + * result.view.len *= length # <<<<<<<<<<<<<< + * + * result.to_object_func = to_object_func +*/ + __pyx_t_2 = PyLong_FromSsize_t(__pyx_v_result->__pyx_base.view.len); if (unlikely(!__pyx_t_2)) __PYX_ERR(1, 1045, __pyx_L1_error) + __Pyx_GOTREF(__pyx_t_2); + __pyx_t_3 = PyNumber_InPlaceMultiply(__pyx_t_2, __pyx_v_length); if (unlikely(!__pyx_t_3)) __PYX_ERR(1, 1045, __pyx_L1_error) + __Pyx_GOTREF(__pyx_t_3); + __Pyx_DECREF(__pyx_t_2); __pyx_t_2 = 0; + __pyx_t_9 = __Pyx_PyIndex_AsSsize_t(__pyx_t_3); if (unlikely((__pyx_t_9 == (Py_ssize_t)-1) && PyErr_Occurred())) __PYX_ERR(1, 1045, __pyx_L1_error) + __Pyx_DECREF(__pyx_t_3); __pyx_t_3 = 0; + __pyx_v_result->__pyx_base.view.len = __pyx_t_9; + } + + /* "View.MemoryView":1047 + * result.view.len *= length + * + * result.to_object_func = to_object_func # <<<<<<<<<<<<<< + * result.to_dtype_func = to_dtype_func + * +*/ + __pyx_v_result->to_object_func = __pyx_v_to_object_func; + + /* "View.MemoryView":1048 + * + * result.to_object_func = to_object_func + * result.to_dtype_func = to_dtype_func # <<<<<<<<<<<<<< + * + * return result +*/ + __pyx_v_result->to_dtype_func = __pyx_v_to_dtype_func; + + /* "View.MemoryView":1050 + * result.to_dtype_func = to_dtype_func + * + * return result # <<<<<<<<<<<<<< + * + * @cname('__pyx_memoryview_get_slice_from_memoryview') +*/ + __Pyx_XDECREF(__pyx_r); + __Pyx_INCREF((PyObject *)__pyx_v_result); + __pyx_r = ((PyObject *)__pyx_v_result); + goto __pyx_L0; + + /* "View.MemoryView":999 + * pass # ignore failure, it's a minor issue + * + * @cname('__pyx_memoryview_fromslice') # <<<<<<<<<<<<<< + * cdef memoryview_fromslice(__Pyx_memviewslice memviewslice, + * int ndim, +*/ + + /* function exit code */ + __pyx_L1_error:; + __Pyx_XDECREF(__pyx_t_2); + __Pyx_XDECREF(__pyx_t_3); + __Pyx_AddTraceback("View.MemoryView.memoryview_fromslice", __pyx_clineno, __pyx_lineno, __pyx_filename); + __pyx_r = 0; + __pyx_L0:; + __Pyx_XDECREF((PyObject *)__pyx_v_result); + __Pyx_XDECREF(__pyx_v_length); + __Pyx_XGIVEREF(__pyx_r); + __Pyx_RefNannyFinishContext(); + return __pyx_r; +} + +/* "View.MemoryView":1052 + * return result + * + * @cname('__pyx_memoryview_get_slice_from_memoryview') # <<<<<<<<<<<<<< + * cdef __Pyx_memviewslice *get_slice_from_memview(memoryview memview, + * __Pyx_memviewslice *mslice) except NULL: +*/ + +static __Pyx_memviewslice *__pyx_memoryview_get_slice_from_memoryview(struct __pyx_memoryview_obj *__pyx_v_memview, __Pyx_memviewslice *__pyx_v_mslice) { + struct __pyx_memoryviewslice_obj *__pyx_v_obj = 0; + __Pyx_memviewslice *__pyx_r; + __Pyx_RefNannyDeclarations + int __pyx_t_1; + PyObject *__pyx_t_2 = NULL; + int __pyx_lineno = 0; + const char *__pyx_filename = NULL; + int __pyx_clineno = 0; + __Pyx_RefNannySetupContext("get_slice_from_memview", 0); + + /* "View.MemoryView":1056 + * __Pyx_memviewslice *mslice) except NULL: + * cdef _memoryviewslice obj + * if isinstance(memview, _memoryviewslice): # <<<<<<<<<<<<<< + * obj = memview + * return &obj.from_slice +*/ + __pyx_t_1 = __Pyx_TypeCheck(((PyObject *)__pyx_v_memview), __pyx_mstate_global->__pyx_memoryviewslice_type); + if (__pyx_t_1) { + + /* "View.MemoryView":1057 + * cdef _memoryviewslice obj + * if isinstance(memview, _memoryviewslice): + * obj = memview # <<<<<<<<<<<<<< + * return &obj.from_slice + * else: +*/ + __pyx_t_2 = ((PyObject *)__pyx_v_memview); + __Pyx_INCREF(__pyx_t_2); + if (!(likely(((__pyx_t_2) == Py_None) || likely(__Pyx_TypeTest(__pyx_t_2, __pyx_mstate_global->__pyx_memoryviewslice_type))))) __PYX_ERR(1, 1057, __pyx_L1_error) + __pyx_v_obj = ((struct __pyx_memoryviewslice_obj *)__pyx_t_2); + __pyx_t_2 = 0; + + /* "View.MemoryView":1058 + * if isinstance(memview, _memoryviewslice): + * obj = memview + * return &obj.from_slice # <<<<<<<<<<<<<< + * else: + * slice_copy(memview, mslice) +*/ + __pyx_r = (&__pyx_v_obj->from_slice); + goto __pyx_L0; + + /* "View.MemoryView":1056 + * __Pyx_memviewslice *mslice) except NULL: + * cdef _memoryviewslice obj + * if isinstance(memview, _memoryviewslice): # <<<<<<<<<<<<<< + * obj = memview + * return &obj.from_slice +*/ + } + + /* "View.MemoryView":1060 + * return &obj.from_slice + * else: + * slice_copy(memview, mslice) # <<<<<<<<<<<<<< + * return mslice + * +*/ + /*else*/ { + __pyx_memoryview_slice_copy(__pyx_v_memview, __pyx_v_mslice); + + /* "View.MemoryView":1061 + * else: + * slice_copy(memview, mslice) + * return mslice # <<<<<<<<<<<<<< + * + * @cname('__pyx_memoryview_slice_copy') +*/ + __pyx_r = __pyx_v_mslice; + goto __pyx_L0; + } + + /* "View.MemoryView":1052 + * return result + * + * @cname('__pyx_memoryview_get_slice_from_memoryview') # <<<<<<<<<<<<<< + * cdef __Pyx_memviewslice *get_slice_from_memview(memoryview memview, + * __Pyx_memviewslice *mslice) except NULL: +*/ + + /* function exit code */ + __pyx_L1_error:; + __Pyx_XDECREF(__pyx_t_2); + __Pyx_AddTraceback("View.MemoryView.get_slice_from_memview", __pyx_clineno, __pyx_lineno, __pyx_filename); + __pyx_r = NULL; + __pyx_L0:; + __Pyx_XDECREF((PyObject *)__pyx_v_obj); + __Pyx_RefNannyFinishContext(); + return __pyx_r; +} + +/* "View.MemoryView":1063 + * return mslice + * + * @cname('__pyx_memoryview_slice_copy') # <<<<<<<<<<<<<< + * cdef void slice_copy(memoryview memview, __Pyx_memviewslice *dst) noexcept: + * cdef int dim +*/ + +static void __pyx_memoryview_slice_copy(struct __pyx_memoryview_obj *__pyx_v_memview, __Pyx_memviewslice *__pyx_v_dst) { + int __pyx_v_dim; + Py_ssize_t *__pyx_v_shape; + Py_ssize_t *__pyx_v_strides; + Py_ssize_t *__pyx_v_suboffsets; + Py_ssize_t *__pyx_t_1; + int __pyx_t_2; + int __pyx_t_3; + int __pyx_t_4; + Py_ssize_t __pyx_t_5; + int __pyx_t_6; + + /* "View.MemoryView":1068 + * cdef (Py_ssize_t*) shape, strides, suboffsets + * + * shape = memview.view.shape # <<<<<<<<<<<<<< + * strides = memview.view.strides + * suboffsets = memview.view.suboffsets +*/ + __pyx_t_1 = __pyx_v_memview->view.shape; + __pyx_v_shape = __pyx_t_1; + + /* "View.MemoryView":1069 + * + * shape = memview.view.shape + * strides = memview.view.strides # <<<<<<<<<<<<<< + * suboffsets = memview.view.suboffsets + * +*/ + __pyx_t_1 = __pyx_v_memview->view.strides; + __pyx_v_strides = __pyx_t_1; + + /* "View.MemoryView":1070 + * shape = memview.view.shape + * strides = memview.view.strides + * suboffsets = memview.view.suboffsets # <<<<<<<<<<<<<< + * + * dst.memview = <__pyx_memoryview *> memview +*/ + __pyx_t_1 = __pyx_v_memview->view.suboffsets; + __pyx_v_suboffsets = __pyx_t_1; + + /* "View.MemoryView":1072 + * suboffsets = memview.view.suboffsets + * + * dst.memview = <__pyx_memoryview *> memview # <<<<<<<<<<<<<< + * dst.data = memview.view.buf + * +*/ + __pyx_v_dst->memview = ((struct __pyx_memoryview_obj *)__pyx_v_memview); + + /* "View.MemoryView":1073 + * + * dst.memview = <__pyx_memoryview *> memview + * dst.data = memview.view.buf # <<<<<<<<<<<<<< + * + * for dim in range(memview.view.ndim): +*/ + __pyx_v_dst->data = ((char *)__pyx_v_memview->view.buf); + + /* "View.MemoryView":1075 + * dst.data = memview.view.buf + * + * for dim in range(memview.view.ndim): # <<<<<<<<<<<<<< + * dst.shape[dim] = shape[dim] + * dst.strides[dim] = strides[dim] +*/ + __pyx_t_2 = __pyx_v_memview->view.ndim; + __pyx_t_3 = __pyx_t_2; + for (__pyx_t_4 = 0; __pyx_t_4 < __pyx_t_3; __pyx_t_4+=1) { + __pyx_v_dim = __pyx_t_4; + + /* "View.MemoryView":1076 + * + * for dim in range(memview.view.ndim): + * dst.shape[dim] = shape[dim] # <<<<<<<<<<<<<< + * dst.strides[dim] = strides[dim] + * dst.suboffsets[dim] = suboffsets[dim] if suboffsets else -1 +*/ + (__pyx_v_dst->shape[__pyx_v_dim]) = (__pyx_v_shape[__pyx_v_dim]); + + /* "View.MemoryView":1077 + * for dim in range(memview.view.ndim): + * dst.shape[dim] = shape[dim] + * dst.strides[dim] = strides[dim] # <<<<<<<<<<<<<< + * dst.suboffsets[dim] = suboffsets[dim] if suboffsets else -1 + * +*/ + (__pyx_v_dst->strides[__pyx_v_dim]) = (__pyx_v_strides[__pyx_v_dim]); + + /* "View.MemoryView":1078 + * dst.shape[dim] = shape[dim] + * dst.strides[dim] = strides[dim] + * dst.suboffsets[dim] = suboffsets[dim] if suboffsets else -1 # <<<<<<<<<<<<<< + * + * @cname('__pyx_memoryview_copy_object') +*/ + __pyx_t_6 = (__pyx_v_suboffsets != 0); + if (__pyx_t_6) { + __pyx_t_5 = (__pyx_v_suboffsets[__pyx_v_dim]); + } else { + __pyx_t_5 = -1L; + } + (__pyx_v_dst->suboffsets[__pyx_v_dim]) = __pyx_t_5; + } + + /* "View.MemoryView":1063 + * return mslice + * + * @cname('__pyx_memoryview_slice_copy') # <<<<<<<<<<<<<< + * cdef void slice_copy(memoryview memview, __Pyx_memviewslice *dst) noexcept: + * cdef int dim +*/ + + /* function exit code */ +} + +/* "View.MemoryView":1080 + * dst.suboffsets[dim] = suboffsets[dim] if suboffsets else -1 + * + * @cname('__pyx_memoryview_copy_object') # <<<<<<<<<<<<<< + * cdef memoryview_copy(memoryview memview): + * "Create a new memoryview object" +*/ + +static PyObject *__pyx_memoryview_copy_object(struct __pyx_memoryview_obj *__pyx_v_memview) { + __Pyx_memviewslice __pyx_v_memviewslice; + 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("memoryview_copy", 0); + + /* "View.MemoryView":1084 + * "Create a new memoryview object" + * cdef __Pyx_memviewslice memviewslice + * slice_copy(memview, &memviewslice) # <<<<<<<<<<<<<< + * return memoryview_copy_from_slice(memview, &memviewslice) + * +*/ + __pyx_memoryview_slice_copy(__pyx_v_memview, (&__pyx_v_memviewslice)); + + /* "View.MemoryView":1085 + * cdef __Pyx_memviewslice memviewslice + * slice_copy(memview, &memviewslice) + * return memoryview_copy_from_slice(memview, &memviewslice) # <<<<<<<<<<<<<< + * + * @cname('__pyx_memoryview_copy_object_from_slice') +*/ + __Pyx_XDECREF(__pyx_r); + __pyx_t_1 = __pyx_memoryview_copy_object_from_slice(__pyx_v_memview, (&__pyx_v_memviewslice)); if (unlikely(!__pyx_t_1)) __PYX_ERR(1, 1085, __pyx_L1_error) + __Pyx_GOTREF(__pyx_t_1); + __pyx_r = __pyx_t_1; + __pyx_t_1 = 0; + goto __pyx_L0; + + /* "View.MemoryView":1080 + * dst.suboffsets[dim] = suboffsets[dim] if suboffsets else -1 + * + * @cname('__pyx_memoryview_copy_object') # <<<<<<<<<<<<<< + * cdef memoryview_copy(memoryview memview): + * "Create a new memoryview object" +*/ + + /* function exit code */ + __pyx_L1_error:; + __Pyx_XDECREF(__pyx_t_1); + __Pyx_AddTraceback("View.MemoryView.memoryview_copy", __pyx_clineno, __pyx_lineno, __pyx_filename); + __pyx_r = 0; + __pyx_L0:; + __Pyx_XGIVEREF(__pyx_r); + __Pyx_RefNannyFinishContext(); + return __pyx_r; +} + +/* "View.MemoryView":1087 + * return memoryview_copy_from_slice(memview, &memviewslice) + * + * @cname('__pyx_memoryview_copy_object_from_slice') # <<<<<<<<<<<<<< + * cdef memoryview_copy_from_slice(memoryview memview, __Pyx_memviewslice *memviewslice): + * """ +*/ + +static PyObject *__pyx_memoryview_copy_object_from_slice(struct __pyx_memoryview_obj *__pyx_v_memview, __Pyx_memviewslice *__pyx_v_memviewslice) { + PyObject *(*__pyx_v_to_object_func)(char *); + int (*__pyx_v_to_dtype_func)(char *, PyObject *); + PyObject *__pyx_r = NULL; + __Pyx_RefNannyDeclarations + int __pyx_t_1; + PyObject *(*__pyx_t_2)(char *); + int (*__pyx_t_3)(char *, PyObject *); + PyObject *__pyx_t_4 = NULL; + int __pyx_lineno = 0; + const char *__pyx_filename = NULL; + int __pyx_clineno = 0; + __Pyx_RefNannySetupContext("memoryview_copy_from_slice", 0); + + /* "View.MemoryView":1095 + * cdef int (*to_dtype_func)(char *, object) except 0 + * + * if isinstance(memview, _memoryviewslice): # <<<<<<<<<<<<<< + * to_object_func = (<_memoryviewslice> memview).to_object_func + * to_dtype_func = (<_memoryviewslice> memview).to_dtype_func +*/ + __pyx_t_1 = __Pyx_TypeCheck(((PyObject *)__pyx_v_memview), __pyx_mstate_global->__pyx_memoryviewslice_type); + if (__pyx_t_1) { + + /* "View.MemoryView":1096 + * + * if isinstance(memview, _memoryviewslice): + * to_object_func = (<_memoryviewslice> memview).to_object_func # <<<<<<<<<<<<<< + * to_dtype_func = (<_memoryviewslice> memview).to_dtype_func + * else: +*/ + __pyx_t_2 = ((struct __pyx_memoryviewslice_obj *)__pyx_v_memview)->to_object_func; + __pyx_v_to_object_func = __pyx_t_2; + + /* "View.MemoryView":1097 + * if isinstance(memview, _memoryviewslice): + * to_object_func = (<_memoryviewslice> memview).to_object_func + * to_dtype_func = (<_memoryviewslice> memview).to_dtype_func # <<<<<<<<<<<<<< + * else: + * to_object_func = NULL +*/ + __pyx_t_3 = ((struct __pyx_memoryviewslice_obj *)__pyx_v_memview)->to_dtype_func; + __pyx_v_to_dtype_func = __pyx_t_3; + + /* "View.MemoryView":1095 + * cdef int (*to_dtype_func)(char *, object) except 0 + * + * if isinstance(memview, _memoryviewslice): # <<<<<<<<<<<<<< + * to_object_func = (<_memoryviewslice> memview).to_object_func + * to_dtype_func = (<_memoryviewslice> memview).to_dtype_func +*/ + goto __pyx_L3; + } + + /* "View.MemoryView":1099 + * to_dtype_func = (<_memoryviewslice> memview).to_dtype_func + * else: + * to_object_func = NULL # <<<<<<<<<<<<<< + * to_dtype_func = NULL + * +*/ + /*else*/ { + __pyx_v_to_object_func = NULL; + + /* "View.MemoryView":1100 + * else: + * to_object_func = NULL + * to_dtype_func = NULL # <<<<<<<<<<<<<< + * + * return memoryview_fromslice(memviewslice[0], memview.view.ndim, +*/ + __pyx_v_to_dtype_func = NULL; + } + __pyx_L3:; + + /* "View.MemoryView":1102 + * to_dtype_func = NULL + * + * return memoryview_fromslice(memviewslice[0], memview.view.ndim, # <<<<<<<<<<<<<< + * to_object_func, to_dtype_func, + * memview.dtype_is_object) +*/ + __Pyx_XDECREF(__pyx_r); + + /* "View.MemoryView":1104 + * return memoryview_fromslice(memviewslice[0], memview.view.ndim, + * to_object_func, to_dtype_func, + * memview.dtype_is_object) # <<<<<<<<<<<<<< + * + * +*/ + __pyx_t_4 = __pyx_memoryview_fromslice((__pyx_v_memviewslice[0]), __pyx_v_memview->view.ndim, __pyx_v_to_object_func, __pyx_v_to_dtype_func, __pyx_v_memview->dtype_is_object); if (unlikely(!__pyx_t_4)) __PYX_ERR(1, 1102, __pyx_L1_error) + __Pyx_GOTREF(__pyx_t_4); + __pyx_r = __pyx_t_4; + __pyx_t_4 = 0; + goto __pyx_L0; + + /* "View.MemoryView":1087 + * return memoryview_copy_from_slice(memview, &memviewslice) + * + * @cname('__pyx_memoryview_copy_object_from_slice') # <<<<<<<<<<<<<< + * cdef memoryview_copy_from_slice(memoryview memview, __Pyx_memviewslice *memviewslice): + * """ +*/ + + /* function exit code */ + __pyx_L1_error:; + __Pyx_XDECREF(__pyx_t_4); + __Pyx_AddTraceback("View.MemoryView.memoryview_copy_from_slice", __pyx_clineno, __pyx_lineno, __pyx_filename); + __pyx_r = 0; + __pyx_L0:; + __Pyx_XGIVEREF(__pyx_r); + __Pyx_RefNannyFinishContext(); + return __pyx_r; +} + +/* "View.MemoryView":1110 + * + * + * cdef Py_ssize_t abs_py_ssize_t(Py_ssize_t arg) noexcept nogil: # <<<<<<<<<<<<<< + * return -arg if arg < 0 else arg + * +*/ + +static Py_ssize_t abs_py_ssize_t(Py_ssize_t __pyx_v_arg) { + Py_ssize_t __pyx_r; + Py_ssize_t __pyx_t_1; + int __pyx_t_2; + + /* "View.MemoryView":1111 + * + * cdef Py_ssize_t abs_py_ssize_t(Py_ssize_t arg) noexcept nogil: + * return -arg if arg < 0 else arg # <<<<<<<<<<<<<< + * + * @cname('__pyx_get_best_slice_order') +*/ + __pyx_t_2 = (__pyx_v_arg < 0); + if (__pyx_t_2) { + __pyx_t_1 = (-__pyx_v_arg); + } else { + __pyx_t_1 = __pyx_v_arg; + } + __pyx_r = __pyx_t_1; + goto __pyx_L0; + + /* "View.MemoryView":1110 + * + * + * cdef Py_ssize_t abs_py_ssize_t(Py_ssize_t arg) noexcept nogil: # <<<<<<<<<<<<<< + * return -arg if arg < 0 else arg + * +*/ + + /* function exit code */ + __pyx_L0:; + return __pyx_r; +} + +/* "View.MemoryView":1113 + * return -arg if arg < 0 else arg + * + * @cname('__pyx_get_best_slice_order') # <<<<<<<<<<<<<< + * cdef char get_best_order(__Pyx_memviewslice *mslice, int ndim) noexcept nogil: + * """ +*/ + +static char __pyx_get_best_slice_order(__Pyx_memviewslice *__pyx_v_mslice, int __pyx_v_ndim) { + int __pyx_v_i; + Py_ssize_t __pyx_v_c_stride; + Py_ssize_t __pyx_v_f_stride; + char __pyx_r; + int __pyx_t_1; + int __pyx_t_2; + int __pyx_t_3; + int __pyx_t_4; + + /* "View.MemoryView":1119 + * """ + * cdef int i + * cdef Py_ssize_t c_stride = 0 # <<<<<<<<<<<<<< + * cdef Py_ssize_t f_stride = 0 + * +*/ + __pyx_v_c_stride = 0; + + /* "View.MemoryView":1120 + * cdef int i + * cdef Py_ssize_t c_stride = 0 + * cdef Py_ssize_t f_stride = 0 # <<<<<<<<<<<<<< + * + * for i in range(ndim - 1, -1, -1): +*/ + __pyx_v_f_stride = 0; + + /* "View.MemoryView":1122 + * cdef Py_ssize_t f_stride = 0 + * + * for i in range(ndim - 1, -1, -1): # <<<<<<<<<<<<<< + * if mslice.shape[i] > 1: + * c_stride = mslice.strides[i] +*/ + for (__pyx_t_1 = (__pyx_v_ndim - 1); __pyx_t_1 > -1; __pyx_t_1-=1) { + __pyx_v_i = __pyx_t_1; + + /* "View.MemoryView":1123 + * + * for i in range(ndim - 1, -1, -1): + * if mslice.shape[i] > 1: # <<<<<<<<<<<<<< + * c_stride = mslice.strides[i] + * break +*/ + __pyx_t_2 = ((__pyx_v_mslice->shape[__pyx_v_i]) > 1); + if (__pyx_t_2) { + + /* "View.MemoryView":1124 + * for i in range(ndim - 1, -1, -1): + * if mslice.shape[i] > 1: + * c_stride = mslice.strides[i] # <<<<<<<<<<<<<< + * break + * +*/ + __pyx_v_c_stride = (__pyx_v_mslice->strides[__pyx_v_i]); + + /* "View.MemoryView":1125 + * if mslice.shape[i] > 1: + * c_stride = mslice.strides[i] + * break # <<<<<<<<<<<<<< + * + * for i in range(ndim): +*/ + goto __pyx_L4_break; + + /* "View.MemoryView":1123 + * + * for i in range(ndim - 1, -1, -1): + * if mslice.shape[i] > 1: # <<<<<<<<<<<<<< + * c_stride = mslice.strides[i] + * break +*/ + } + } + __pyx_L4_break:; + + /* "View.MemoryView":1127 + * break + * + * for i in range(ndim): # <<<<<<<<<<<<<< + * if mslice.shape[i] > 1: + * f_stride = mslice.strides[i] +*/ + __pyx_t_1 = __pyx_v_ndim; + __pyx_t_3 = __pyx_t_1; + for (__pyx_t_4 = 0; __pyx_t_4 < __pyx_t_3; __pyx_t_4+=1) { + __pyx_v_i = __pyx_t_4; + + /* "View.MemoryView":1128 + * + * for i in range(ndim): + * if mslice.shape[i] > 1: # <<<<<<<<<<<<<< + * f_stride = mslice.strides[i] + * break +*/ + __pyx_t_2 = ((__pyx_v_mslice->shape[__pyx_v_i]) > 1); + if (__pyx_t_2) { + + /* "View.MemoryView":1129 + * for i in range(ndim): + * if mslice.shape[i] > 1: + * f_stride = mslice.strides[i] # <<<<<<<<<<<<<< + * break + * +*/ + __pyx_v_f_stride = (__pyx_v_mslice->strides[__pyx_v_i]); + + /* "View.MemoryView":1130 + * if mslice.shape[i] > 1: + * f_stride = mslice.strides[i] + * break # <<<<<<<<<<<<<< + * + * if abs_py_ssize_t(c_stride) <= abs_py_ssize_t(f_stride): +*/ + goto __pyx_L7_break; + + /* "View.MemoryView":1128 + * + * for i in range(ndim): + * if mslice.shape[i] > 1: # <<<<<<<<<<<<<< + * f_stride = mslice.strides[i] + * break +*/ + } + } + __pyx_L7_break:; + + /* "View.MemoryView":1132 + * break + * + * if abs_py_ssize_t(c_stride) <= abs_py_ssize_t(f_stride): # <<<<<<<<<<<<<< + * return 'C' + * else: +*/ + __pyx_t_2 = (abs_py_ssize_t(__pyx_v_c_stride) <= abs_py_ssize_t(__pyx_v_f_stride)); + if (__pyx_t_2) { + + /* "View.MemoryView":1133 + * + * if abs_py_ssize_t(c_stride) <= abs_py_ssize_t(f_stride): + * return 'C' # <<<<<<<<<<<<<< + * else: + * return 'F' +*/ + __pyx_r = 'C'; + goto __pyx_L0; + + /* "View.MemoryView":1132 + * break + * + * if abs_py_ssize_t(c_stride) <= abs_py_ssize_t(f_stride): # <<<<<<<<<<<<<< + * return 'C' + * else: +*/ + } + + /* "View.MemoryView":1135 + * return 'C' + * else: + * return 'F' # <<<<<<<<<<<<<< + * + * @cython.cdivision(True) +*/ + /*else*/ { + __pyx_r = 'F'; + goto __pyx_L0; + } + + /* "View.MemoryView":1113 + * return -arg if arg < 0 else arg + * + * @cname('__pyx_get_best_slice_order') # <<<<<<<<<<<<<< + * cdef char get_best_order(__Pyx_memviewslice *mslice, int ndim) noexcept nogil: + * """ +*/ + + /* function exit code */ + __pyx_L0:; + return __pyx_r; +} + +/* "View.MemoryView":1137 + * return 'F' + * + * @cython.cdivision(True) # <<<<<<<<<<<<<< + * cdef void _copy_strided_to_strided(char *src_data, Py_ssize_t *src_strides, + * char *dst_data, Py_ssize_t *dst_strides, +*/ + +static void _copy_strided_to_strided(char *__pyx_v_src_data, Py_ssize_t *__pyx_v_src_strides, char *__pyx_v_dst_data, Py_ssize_t *__pyx_v_dst_strides, Py_ssize_t *__pyx_v_src_shape, Py_ssize_t *__pyx_v_dst_shape, int __pyx_v_ndim, size_t __pyx_v_itemsize) { + CYTHON_UNUSED Py_ssize_t __pyx_v_i; + CYTHON_UNUSED Py_ssize_t __pyx_v_src_extent; + Py_ssize_t __pyx_v_dst_extent; + Py_ssize_t __pyx_v_src_stride; + Py_ssize_t __pyx_v_dst_stride; + int __pyx_t_1; + int __pyx_t_2; + Py_ssize_t __pyx_t_3; + Py_ssize_t __pyx_t_4; + Py_ssize_t __pyx_t_5; + + /* "View.MemoryView":1145 + * + * cdef Py_ssize_t i + * cdef Py_ssize_t src_extent = src_shape[0] # <<<<<<<<<<<<<< + * cdef Py_ssize_t dst_extent = dst_shape[0] + * cdef Py_ssize_t src_stride = src_strides[0] +*/ + __pyx_v_src_extent = (__pyx_v_src_shape[0]); + + /* "View.MemoryView":1146 + * cdef Py_ssize_t i + * cdef Py_ssize_t src_extent = src_shape[0] + * cdef Py_ssize_t dst_extent = dst_shape[0] # <<<<<<<<<<<<<< + * cdef Py_ssize_t src_stride = src_strides[0] + * cdef Py_ssize_t dst_stride = dst_strides[0] +*/ + __pyx_v_dst_extent = (__pyx_v_dst_shape[0]); + + /* "View.MemoryView":1147 + * cdef Py_ssize_t src_extent = src_shape[0] + * cdef Py_ssize_t dst_extent = dst_shape[0] + * cdef Py_ssize_t src_stride = src_strides[0] # <<<<<<<<<<<<<< + * cdef Py_ssize_t dst_stride = dst_strides[0] + * +*/ + __pyx_v_src_stride = (__pyx_v_src_strides[0]); + + /* "View.MemoryView":1148 + * cdef Py_ssize_t dst_extent = dst_shape[0] + * cdef Py_ssize_t src_stride = src_strides[0] + * cdef Py_ssize_t dst_stride = dst_strides[0] # <<<<<<<<<<<<<< + * + * if ndim == 1: +*/ + __pyx_v_dst_stride = (__pyx_v_dst_strides[0]); + + /* "View.MemoryView":1150 + * cdef Py_ssize_t dst_stride = dst_strides[0] + * + * if ndim == 1: # <<<<<<<<<<<<<< + * if (src_stride > 0 and dst_stride > 0 and + * src_stride == itemsize == dst_stride): +*/ + __pyx_t_1 = (__pyx_v_ndim == 1); + if (__pyx_t_1) { + + /* "View.MemoryView":1151 + * + * if ndim == 1: + * if (src_stride > 0 and dst_stride > 0 and # <<<<<<<<<<<<<< + * src_stride == itemsize == dst_stride): + * memcpy(dst_data, src_data, itemsize * dst_extent) +*/ + __pyx_t_2 = (__pyx_v_src_stride > 0); + if (__pyx_t_2) { + } else { + __pyx_t_1 = __pyx_t_2; + goto __pyx_L5_bool_binop_done; + } + __pyx_t_2 = (__pyx_v_dst_stride > 0); + if (__pyx_t_2) { + } else { + __pyx_t_1 = __pyx_t_2; + goto __pyx_L5_bool_binop_done; + } + + /* "View.MemoryView":1152 + * if ndim == 1: + * if (src_stride > 0 and dst_stride > 0 and + * src_stride == itemsize == dst_stride): # <<<<<<<<<<<<<< + * memcpy(dst_data, src_data, itemsize * dst_extent) + * else: +*/ + __pyx_t_2 = (((size_t)__pyx_v_src_stride) == __pyx_v_itemsize); + if (__pyx_t_2) { + __pyx_t_2 = (__pyx_v_itemsize == ((size_t)__pyx_v_dst_stride)); + } + __pyx_t_1 = __pyx_t_2; + __pyx_L5_bool_binop_done:; + + /* "View.MemoryView":1151 + * + * if ndim == 1: + * if (src_stride > 0 and dst_stride > 0 and # <<<<<<<<<<<<<< + * src_stride == itemsize == dst_stride): + * memcpy(dst_data, src_data, itemsize * dst_extent) +*/ + if (__pyx_t_1) { + + /* "View.MemoryView":1153 + * if (src_stride > 0 and dst_stride > 0 and + * src_stride == itemsize == dst_stride): + * memcpy(dst_data, src_data, itemsize * dst_extent) # <<<<<<<<<<<<<< + * else: + * for i in range(dst_extent): +*/ + (void)(memcpy(__pyx_v_dst_data, __pyx_v_src_data, (__pyx_v_itemsize * __pyx_v_dst_extent))); + + /* "View.MemoryView":1151 + * + * if ndim == 1: + * if (src_stride > 0 and dst_stride > 0 and # <<<<<<<<<<<<<< + * src_stride == itemsize == dst_stride): + * memcpy(dst_data, src_data, itemsize * dst_extent) +*/ + goto __pyx_L4; + } + + /* "View.MemoryView":1155 + * memcpy(dst_data, src_data, itemsize * dst_extent) + * else: + * for i in range(dst_extent): # <<<<<<<<<<<<<< + * memcpy(dst_data, src_data, itemsize) + * src_data += src_stride +*/ + /*else*/ { + __pyx_t_3 = __pyx_v_dst_extent; + __pyx_t_4 = __pyx_t_3; + for (__pyx_t_5 = 0; __pyx_t_5 < __pyx_t_4; __pyx_t_5+=1) { + __pyx_v_i = __pyx_t_5; + + /* "View.MemoryView":1156 + * else: + * for i in range(dst_extent): + * memcpy(dst_data, src_data, itemsize) # <<<<<<<<<<<<<< + * src_data += src_stride + * dst_data += dst_stride +*/ + (void)(memcpy(__pyx_v_dst_data, __pyx_v_src_data, __pyx_v_itemsize)); + + /* "View.MemoryView":1157 + * for i in range(dst_extent): + * memcpy(dst_data, src_data, itemsize) + * src_data += src_stride # <<<<<<<<<<<<<< + * dst_data += dst_stride + * else: +*/ + __pyx_v_src_data = (__pyx_v_src_data + __pyx_v_src_stride); + + /* "View.MemoryView":1158 + * memcpy(dst_data, src_data, itemsize) + * src_data += src_stride + * dst_data += dst_stride # <<<<<<<<<<<<<< + * else: + * for i in range(dst_extent): +*/ + __pyx_v_dst_data = (__pyx_v_dst_data + __pyx_v_dst_stride); + } + } + __pyx_L4:; + + /* "View.MemoryView":1150 + * cdef Py_ssize_t dst_stride = dst_strides[0] + * + * if ndim == 1: # <<<<<<<<<<<<<< + * if (src_stride > 0 and dst_stride > 0 and + * src_stride == itemsize == dst_stride): +*/ + goto __pyx_L3; + } + + /* "View.MemoryView":1160 + * dst_data += dst_stride + * else: + * for i in range(dst_extent): # <<<<<<<<<<<<<< + * _copy_strided_to_strided(src_data, src_strides + 1, + * dst_data, dst_strides + 1, +*/ + /*else*/ { + __pyx_t_3 = __pyx_v_dst_extent; + __pyx_t_4 = __pyx_t_3; + for (__pyx_t_5 = 0; __pyx_t_5 < __pyx_t_4; __pyx_t_5+=1) { + __pyx_v_i = __pyx_t_5; + + /* "View.MemoryView":1161 + * else: + * for i in range(dst_extent): + * _copy_strided_to_strided(src_data, src_strides + 1, # <<<<<<<<<<<<<< + * dst_data, dst_strides + 1, + * src_shape + 1, dst_shape + 1, +*/ + _copy_strided_to_strided(__pyx_v_src_data, (__pyx_v_src_strides + 1), __pyx_v_dst_data, (__pyx_v_dst_strides + 1), (__pyx_v_src_shape + 1), (__pyx_v_dst_shape + 1), (__pyx_v_ndim - 1), __pyx_v_itemsize); + + /* "View.MemoryView":1165 + * src_shape + 1, dst_shape + 1, + * ndim - 1, itemsize) + * src_data += src_stride # <<<<<<<<<<<<<< + * dst_data += dst_stride + * +*/ + __pyx_v_src_data = (__pyx_v_src_data + __pyx_v_src_stride); + + /* "View.MemoryView":1166 + * ndim - 1, itemsize) + * src_data += src_stride + * dst_data += dst_stride # <<<<<<<<<<<<<< + * + * cdef void copy_strided_to_strided(__Pyx_memviewslice *src, +*/ + __pyx_v_dst_data = (__pyx_v_dst_data + __pyx_v_dst_stride); + } + } + __pyx_L3:; + + /* "View.MemoryView":1137 + * return 'F' + * + * @cython.cdivision(True) # <<<<<<<<<<<<<< + * cdef void _copy_strided_to_strided(char *src_data, Py_ssize_t *src_strides, + * char *dst_data, Py_ssize_t *dst_strides, +*/ + + /* function exit code */ +} + +/* "View.MemoryView":1168 + * dst_data += dst_stride + * + * cdef void copy_strided_to_strided(__Pyx_memviewslice *src, # <<<<<<<<<<<<<< + * __Pyx_memviewslice *dst, + * int ndim, size_t itemsize) noexcept nogil: +*/ + +static void copy_strided_to_strided(__Pyx_memviewslice *__pyx_v_src, __Pyx_memviewslice *__pyx_v_dst, int __pyx_v_ndim, size_t __pyx_v_itemsize) { + + /* "View.MemoryView":1171 + * __Pyx_memviewslice *dst, + * int ndim, size_t itemsize) noexcept nogil: + * _copy_strided_to_strided(src.data, src.strides, dst.data, dst.strides, # <<<<<<<<<<<<<< + * src.shape, dst.shape, ndim, itemsize) + * +*/ + _copy_strided_to_strided(__pyx_v_src->data, __pyx_v_src->strides, __pyx_v_dst->data, __pyx_v_dst->strides, __pyx_v_src->shape, __pyx_v_dst->shape, __pyx_v_ndim, __pyx_v_itemsize); + + /* "View.MemoryView":1168 + * dst_data += dst_stride + * + * cdef void copy_strided_to_strided(__Pyx_memviewslice *src, # <<<<<<<<<<<<<< + * __Pyx_memviewslice *dst, + * int ndim, size_t itemsize) noexcept nogil: +*/ + + /* function exit code */ +} + +/* "View.MemoryView":1174 + * src.shape, dst.shape, ndim, itemsize) + * + * @cname('__pyx_memoryview_slice_get_size') # <<<<<<<<<<<<<< + * cdef Py_ssize_t slice_get_size(__Pyx_memviewslice *src, int ndim) noexcept nogil: + * "Return the size of the memory occupied by the slice in number of bytes" +*/ + +static Py_ssize_t __pyx_memoryview_slice_get_size(__Pyx_memviewslice *__pyx_v_src, int __pyx_v_ndim) { + Py_ssize_t __pyx_v_shape; + Py_ssize_t __pyx_v_size; + Py_ssize_t __pyx_r; + Py_ssize_t __pyx_t_1; + Py_ssize_t *__pyx_t_2; + Py_ssize_t *__pyx_t_3; + Py_ssize_t *__pyx_t_4; + + /* "View.MemoryView":1177 + * cdef Py_ssize_t slice_get_size(__Pyx_memviewslice *src, int ndim) noexcept nogil: + * "Return the size of the memory occupied by the slice in number of bytes" + * cdef Py_ssize_t shape, size = src.memview.view.itemsize # <<<<<<<<<<<<<< + * + * for shape in src.shape[:ndim]: +*/ + __pyx_t_1 = __pyx_v_src->memview->view.itemsize; + __pyx_v_size = __pyx_t_1; + + /* "View.MemoryView":1179 + * cdef Py_ssize_t shape, size = src.memview.view.itemsize + * + * for shape in src.shape[:ndim]: # <<<<<<<<<<<<<< + * size *= shape + * +*/ + __pyx_t_3 = (__pyx_v_src->shape + __pyx_v_ndim); + for (__pyx_t_4 = __pyx_v_src->shape; __pyx_t_4 < __pyx_t_3; __pyx_t_4++) { + __pyx_t_2 = __pyx_t_4; + __pyx_v_shape = (__pyx_t_2[0]); + + /* "View.MemoryView":1180 + * + * for shape in src.shape[:ndim]: + * size *= shape # <<<<<<<<<<<<<< + * + * return size +*/ + __pyx_v_size = (__pyx_v_size * __pyx_v_shape); + } + + /* "View.MemoryView":1182 + * size *= shape + * + * return size # <<<<<<<<<<<<<< + * + * @cname('__pyx_fill_contig_strides_array') +*/ + __pyx_r = __pyx_v_size; + goto __pyx_L0; + + /* "View.MemoryView":1174 + * src.shape, dst.shape, ndim, itemsize) + * + * @cname('__pyx_memoryview_slice_get_size') # <<<<<<<<<<<<<< + * cdef Py_ssize_t slice_get_size(__Pyx_memviewslice *src, int ndim) noexcept nogil: + * "Return the size of the memory occupied by the slice in number of bytes" +*/ + + /* function exit code */ + __pyx_L0:; + return __pyx_r; +} + +/* "View.MemoryView":1184 + * return size + * + * @cname('__pyx_fill_contig_strides_array') # <<<<<<<<<<<<<< + * cdef Py_ssize_t fill_contig_strides_array( + * Py_ssize_t *shape, Py_ssize_t *strides, Py_ssize_t stride, +*/ + +static Py_ssize_t __pyx_fill_contig_strides_array(Py_ssize_t *__pyx_v_shape, Py_ssize_t *__pyx_v_strides, Py_ssize_t __pyx_v_stride, int __pyx_v_ndim, char __pyx_v_order) { + int __pyx_v_idx; + Py_ssize_t __pyx_r; + int __pyx_t_1; + int __pyx_t_2; + int __pyx_t_3; + int __pyx_t_4; + + /* "View.MemoryView":1194 + * cdef int idx + * + * if order == 'F': # <<<<<<<<<<<<<< + * for idx in range(ndim): + * strides[idx] = stride +*/ + __pyx_t_1 = (__pyx_v_order == 'F'); + if (__pyx_t_1) { + + /* "View.MemoryView":1195 + * + * if order == 'F': + * for idx in range(ndim): # <<<<<<<<<<<<<< + * strides[idx] = stride + * stride *= shape[idx] +*/ + __pyx_t_2 = __pyx_v_ndim; + __pyx_t_3 = __pyx_t_2; + for (__pyx_t_4 = 0; __pyx_t_4 < __pyx_t_3; __pyx_t_4+=1) { + __pyx_v_idx = __pyx_t_4; + + /* "View.MemoryView":1196 + * if order == 'F': + * for idx in range(ndim): + * strides[idx] = stride # <<<<<<<<<<<<<< + * stride *= shape[idx] + * else: +*/ + (__pyx_v_strides[__pyx_v_idx]) = __pyx_v_stride; + + /* "View.MemoryView":1197 + * for idx in range(ndim): + * strides[idx] = stride + * stride *= shape[idx] # <<<<<<<<<<<<<< + * else: + * for idx in range(ndim - 1, -1, -1): +*/ + __pyx_v_stride = (__pyx_v_stride * (__pyx_v_shape[__pyx_v_idx])); + } + + /* "View.MemoryView":1194 + * cdef int idx + * + * if order == 'F': # <<<<<<<<<<<<<< + * for idx in range(ndim): + * strides[idx] = stride +*/ + goto __pyx_L3; + } + + /* "View.MemoryView":1199 + * stride *= shape[idx] + * else: + * for idx in range(ndim - 1, -1, -1): # <<<<<<<<<<<<<< + * strides[idx] = stride + * stride *= shape[idx] +*/ + /*else*/ { + for (__pyx_t_2 = (__pyx_v_ndim - 1); __pyx_t_2 > -1; __pyx_t_2-=1) { + __pyx_v_idx = __pyx_t_2; + + /* "View.MemoryView":1200 + * else: + * for idx in range(ndim - 1, -1, -1): + * strides[idx] = stride # <<<<<<<<<<<<<< + * stride *= shape[idx] + * +*/ + (__pyx_v_strides[__pyx_v_idx]) = __pyx_v_stride; + + /* "View.MemoryView":1201 + * for idx in range(ndim - 1, -1, -1): + * strides[idx] = stride + * stride *= shape[idx] # <<<<<<<<<<<<<< + * + * return stride +*/ + __pyx_v_stride = (__pyx_v_stride * (__pyx_v_shape[__pyx_v_idx])); + } + } + __pyx_L3:; + + /* "View.MemoryView":1203 + * stride *= shape[idx] + * + * return stride # <<<<<<<<<<<<<< + * + * @cname('__pyx_memoryview_copy_data_to_temp') +*/ + __pyx_r = __pyx_v_stride; + goto __pyx_L0; + + /* "View.MemoryView":1184 + * return size + * + * @cname('__pyx_fill_contig_strides_array') # <<<<<<<<<<<<<< + * cdef Py_ssize_t fill_contig_strides_array( + * Py_ssize_t *shape, Py_ssize_t *strides, Py_ssize_t stride, +*/ + + /* function exit code */ + __pyx_L0:; + return __pyx_r; +} + +/* "View.MemoryView":1205 + * return stride + * + * @cname('__pyx_memoryview_copy_data_to_temp') # <<<<<<<<<<<<<< + * cdef void *copy_data_to_temp(__Pyx_memviewslice *src, + * __Pyx_memviewslice *tmpslice, +*/ + +static void *__pyx_memoryview_copy_data_to_temp(__Pyx_memviewslice *__pyx_v_src, __Pyx_memviewslice *__pyx_v_tmpslice, char __pyx_v_order, int __pyx_v_ndim) { + int __pyx_v_i; + void *__pyx_v_result; + size_t __pyx_v_itemsize; + size_t __pyx_v_size; + void *__pyx_r; + Py_ssize_t __pyx_t_1; + int __pyx_t_2; + int __pyx_t_3; + struct __pyx_memoryview_obj *__pyx_t_4; + int __pyx_t_5; + int __pyx_t_6; + int __pyx_lineno = 0; + const char *__pyx_filename = NULL; + int __pyx_clineno = 0; + PyGILState_STATE __pyx_gilstate_save; + + /* "View.MemoryView":1217 + * cdef void *result + * + * cdef size_t itemsize = src.memview.view.itemsize # <<<<<<<<<<<<<< + * cdef size_t size = slice_get_size(src, ndim) + * +*/ + __pyx_t_1 = __pyx_v_src->memview->view.itemsize; + __pyx_v_itemsize = __pyx_t_1; + + /* "View.MemoryView":1218 + * + * cdef size_t itemsize = src.memview.view.itemsize + * cdef size_t size = slice_get_size(src, ndim) # <<<<<<<<<<<<<< + * + * result = malloc(size) +*/ + __pyx_v_size = __pyx_memoryview_slice_get_size(__pyx_v_src, __pyx_v_ndim); + + /* "View.MemoryView":1220 + * cdef size_t size = slice_get_size(src, ndim) + * + * result = malloc(size) # <<<<<<<<<<<<<< + * if not result: + * _err_no_memory() +*/ + __pyx_v_result = malloc(__pyx_v_size); + + /* "View.MemoryView":1221 + * + * result = malloc(size) + * if not result: # <<<<<<<<<<<<<< + * _err_no_memory() + * +*/ + __pyx_t_2 = (!(__pyx_v_result != 0)); + if (__pyx_t_2) { + + /* "View.MemoryView":1222 + * result = malloc(size) + * if not result: + * _err_no_memory() # <<<<<<<<<<<<<< + * + * +*/ + __pyx_t_3 = __pyx_memoryview_err_no_memory(); if (unlikely(__pyx_t_3 == ((int)-1))) __PYX_ERR(1, 1222, __pyx_L1_error) + + /* "View.MemoryView":1221 + * + * result = malloc(size) + * if not result: # <<<<<<<<<<<<<< + * _err_no_memory() + * +*/ + } + + /* "View.MemoryView":1225 + * + * + * tmpslice.data = result # <<<<<<<<<<<<<< + * tmpslice.memview = src.memview + * for i in range(ndim): +*/ + __pyx_v_tmpslice->data = ((char *)__pyx_v_result); + + /* "View.MemoryView":1226 + * + * tmpslice.data = result + * tmpslice.memview = src.memview # <<<<<<<<<<<<<< + * for i in range(ndim): + * tmpslice.shape[i] = src.shape[i] +*/ + __pyx_t_4 = __pyx_v_src->memview; + __pyx_v_tmpslice->memview = __pyx_t_4; + + /* "View.MemoryView":1227 + * tmpslice.data = result + * tmpslice.memview = src.memview + * for i in range(ndim): # <<<<<<<<<<<<<< + * tmpslice.shape[i] = src.shape[i] + * tmpslice.suboffsets[i] = -1 +*/ + __pyx_t_3 = __pyx_v_ndim; + __pyx_t_5 = __pyx_t_3; + for (__pyx_t_6 = 0; __pyx_t_6 < __pyx_t_5; __pyx_t_6+=1) { + __pyx_v_i = __pyx_t_6; + + /* "View.MemoryView":1228 + * tmpslice.memview = src.memview + * for i in range(ndim): + * tmpslice.shape[i] = src.shape[i] # <<<<<<<<<<<<<< + * tmpslice.suboffsets[i] = -1 + * +*/ + (__pyx_v_tmpslice->shape[__pyx_v_i]) = (__pyx_v_src->shape[__pyx_v_i]); + + /* "View.MemoryView":1229 + * for i in range(ndim): + * tmpslice.shape[i] = src.shape[i] + * tmpslice.suboffsets[i] = -1 # <<<<<<<<<<<<<< + * + * fill_contig_strides_array(&tmpslice.shape[0], &tmpslice.strides[0], itemsize, ndim, order) +*/ + (__pyx_v_tmpslice->suboffsets[__pyx_v_i]) = -1L; + } + + /* "View.MemoryView":1231 + * tmpslice.suboffsets[i] = -1 + * + * fill_contig_strides_array(&tmpslice.shape[0], &tmpslice.strides[0], itemsize, ndim, order) # <<<<<<<<<<<<<< + * + * +*/ + (void)(__pyx_fill_contig_strides_array((&(__pyx_v_tmpslice->shape[0])), (&(__pyx_v_tmpslice->strides[0])), __pyx_v_itemsize, __pyx_v_ndim, __pyx_v_order)); + + /* "View.MemoryView":1234 + * + * + * for i in range(ndim): # <<<<<<<<<<<<<< + * if tmpslice.shape[i] == 1: + * tmpslice.strides[i] = 0 +*/ + __pyx_t_3 = __pyx_v_ndim; + __pyx_t_5 = __pyx_t_3; + for (__pyx_t_6 = 0; __pyx_t_6 < __pyx_t_5; __pyx_t_6+=1) { + __pyx_v_i = __pyx_t_6; + + /* "View.MemoryView":1235 + * + * for i in range(ndim): + * if tmpslice.shape[i] == 1: # <<<<<<<<<<<<<< + * tmpslice.strides[i] = 0 + * +*/ + __pyx_t_2 = ((__pyx_v_tmpslice->shape[__pyx_v_i]) == 1); + if (__pyx_t_2) { + + /* "View.MemoryView":1236 + * for i in range(ndim): + * if tmpslice.shape[i] == 1: + * tmpslice.strides[i] = 0 # <<<<<<<<<<<<<< + * + * if slice_is_contig(src[0], order, ndim): +*/ + (__pyx_v_tmpslice->strides[__pyx_v_i]) = 0; + + /* "View.MemoryView":1235 + * + * for i in range(ndim): + * if tmpslice.shape[i] == 1: # <<<<<<<<<<<<<< + * tmpslice.strides[i] = 0 + * +*/ + } + } + + /* "View.MemoryView":1238 + * tmpslice.strides[i] = 0 + * + * if slice_is_contig(src[0], order, ndim): # <<<<<<<<<<<<<< + * memcpy(result, src.data, size) + * else: +*/ + __pyx_t_2 = __pyx_memviewslice_is_contig((__pyx_v_src[0]), __pyx_v_order, __pyx_v_ndim); + if (__pyx_t_2) { + + /* "View.MemoryView":1239 + * + * if slice_is_contig(src[0], order, ndim): + * memcpy(result, src.data, size) # <<<<<<<<<<<<<< + * else: + * copy_strided_to_strided(src, tmpslice, ndim, itemsize) +*/ + (void)(memcpy(__pyx_v_result, __pyx_v_src->data, __pyx_v_size)); + + /* "View.MemoryView":1238 + * tmpslice.strides[i] = 0 + * + * if slice_is_contig(src[0], order, ndim): # <<<<<<<<<<<<<< + * memcpy(result, src.data, size) + * else: +*/ + goto __pyx_L9; + } + + /* "View.MemoryView":1241 + * memcpy(result, src.data, size) + * else: + * copy_strided_to_strided(src, tmpslice, ndim, itemsize) # <<<<<<<<<<<<<< + * + * return result +*/ + /*else*/ { + copy_strided_to_strided(__pyx_v_src, __pyx_v_tmpslice, __pyx_v_ndim, __pyx_v_itemsize); + } + __pyx_L9:; + + /* "View.MemoryView":1243 + * copy_strided_to_strided(src, tmpslice, ndim, itemsize) + * + * return result # <<<<<<<<<<<<<< + * + * +*/ + __pyx_r = __pyx_v_result; + goto __pyx_L0; + + /* "View.MemoryView":1205 + * return stride + * + * @cname('__pyx_memoryview_copy_data_to_temp') # <<<<<<<<<<<<<< + * cdef void *copy_data_to_temp(__Pyx_memviewslice *src, + * __Pyx_memviewslice *tmpslice, +*/ + + /* function exit code */ + __pyx_L1_error:; + __pyx_gilstate_save = __Pyx_PyGILState_Ensure(); + __Pyx_AddTraceback("View.MemoryView.copy_data_to_temp", __pyx_clineno, __pyx_lineno, __pyx_filename); + __pyx_r = NULL; + __Pyx_PyGILState_Release(__pyx_gilstate_save); + __pyx_L0:; + return __pyx_r; +} + +/* "View.MemoryView":1247 + * + * + * @cname('__pyx_memoryview_err_extents') # <<<<<<<<<<<<<< + * cdef int _err_extents(int i, Py_ssize_t extent1, + * Py_ssize_t extent2) except -1 with gil: +*/ + +static int __pyx_memoryview_err_extents(int __pyx_v_i, Py_ssize_t __pyx_v_extent1, Py_ssize_t __pyx_v_extent2) { + int __pyx_r; + __Pyx_RefNannyDeclarations + PyObject *__pyx_t_1 = NULL; + PyObject *__pyx_t_2 = NULL; + PyObject *__pyx_t_3 = NULL; + PyObject *__pyx_t_4[7]; + PyObject *__pyx_t_5 = NULL; + int __pyx_lineno = 0; + const char *__pyx_filename = NULL; + int __pyx_clineno = 0; + PyGILState_STATE __pyx_gilstate_save = __Pyx_PyGILState_Ensure(); + __Pyx_RefNannySetupContext("_err_extents", 0); + + /* "View.MemoryView":1250 + * cdef int _err_extents(int i, Py_ssize_t extent1, + * Py_ssize_t extent2) except -1 with gil: + * raise ValueError, f"got differing extents in dimension {i} (got {extent1} and {extent2})" # <<<<<<<<<<<<<< + * + * @cname('__pyx_memoryview_err_dim') +*/ + __pyx_t_1 = __Pyx_PyUnicode_From_int(__pyx_v_i, 0, ' ', 'd'); if (unlikely(!__pyx_t_1)) __PYX_ERR(1, 1250, __pyx_L1_error) + __Pyx_GOTREF(__pyx_t_1); + __pyx_t_2 = __Pyx_PyUnicode_From_Py_ssize_t(__pyx_v_extent1, 0, ' ', 'd'); if (unlikely(!__pyx_t_2)) __PYX_ERR(1, 1250, __pyx_L1_error) + __Pyx_GOTREF(__pyx_t_2); + __pyx_t_3 = __Pyx_PyUnicode_From_Py_ssize_t(__pyx_v_extent2, 0, ' ', 'd'); if (unlikely(!__pyx_t_3)) __PYX_ERR(1, 1250, __pyx_L1_error) + __Pyx_GOTREF(__pyx_t_3); + __pyx_t_4[0] = __pyx_mstate_global->__pyx_kp_u_got_differing_extents_in_dimensi; + __pyx_t_4[1] = __pyx_t_1; + __pyx_t_4[2] = __pyx_mstate_global->__pyx_kp_u_got; + __pyx_t_4[3] = __pyx_t_2; + __pyx_t_4[4] = __pyx_mstate_global->__pyx_kp_u_and; + __pyx_t_4[5] = __pyx_t_3; + __pyx_t_4[6] = __pyx_mstate_global->__pyx_kp_u__5; + __pyx_t_5 = __Pyx_PyUnicode_Join(__pyx_t_4, 7, 35 + __Pyx_PyUnicode_GET_LENGTH(__pyx_t_1) + 6 + __Pyx_PyUnicode_GET_LENGTH(__pyx_t_2) + 5 + __Pyx_PyUnicode_GET_LENGTH(__pyx_t_3) + 1, 127); + if (unlikely(!__pyx_t_5)) __PYX_ERR(1, 1250, __pyx_L1_error) + __Pyx_GOTREF(__pyx_t_5); + __Pyx_DECREF(__pyx_t_1); __pyx_t_1 = 0; + __Pyx_DECREF(__pyx_t_2); __pyx_t_2 = 0; + __Pyx_DECREF(__pyx_t_3); __pyx_t_3 = 0; + __Pyx_Raise(((PyObject *)(((PyTypeObject*)PyExc_ValueError))), __pyx_t_5, 0, 0); + __Pyx_DECREF(__pyx_t_5); __pyx_t_5 = 0; + __PYX_ERR(1, 1250, __pyx_L1_error) + + /* "View.MemoryView":1247 + * + * + * @cname('__pyx_memoryview_err_extents') # <<<<<<<<<<<<<< + * cdef int _err_extents(int i, Py_ssize_t extent1, + * Py_ssize_t extent2) except -1 with gil: +*/ + + /* function exit code */ + __pyx_L1_error:; + __Pyx_XDECREF(__pyx_t_1); + __Pyx_XDECREF(__pyx_t_2); + __Pyx_XDECREF(__pyx_t_3); + __Pyx_XDECREF(__pyx_t_5); + __Pyx_AddTraceback("View.MemoryView._err_extents", __pyx_clineno, __pyx_lineno, __pyx_filename); + __pyx_r = -1; + __Pyx_RefNannyFinishContext(); + __Pyx_PyGILState_Release(__pyx_gilstate_save); + return __pyx_r; +} + +/* "View.MemoryView":1252 + * raise ValueError, f"got differing extents in dimension {i} (got {extent1} and {extent2})" + * + * @cname('__pyx_memoryview_err_dim') # <<<<<<<<<<<<<< + * cdef int _err_dim(PyObject *error, str msg, int dim) except -1 with gil: + * raise error, msg % dim +*/ + +static int __pyx_memoryview_err_dim(PyObject *__pyx_v_error, PyObject *__pyx_v_msg, int __pyx_v_dim) { + int __pyx_r; + __Pyx_RefNannyDeclarations + PyObject *__pyx_t_1 = NULL; + PyObject *__pyx_t_2 = NULL; + int __pyx_lineno = 0; + const char *__pyx_filename = NULL; + int __pyx_clineno = 0; + PyGILState_STATE __pyx_gilstate_save = __Pyx_PyGILState_Ensure(); + __Pyx_RefNannySetupContext("_err_dim", 0); + __Pyx_INCREF(__pyx_v_msg); + + /* "View.MemoryView":1254 + * @cname('__pyx_memoryview_err_dim') + * cdef int _err_dim(PyObject *error, str msg, int dim) except -1 with gil: + * raise error, msg % dim # <<<<<<<<<<<<<< + * + * @cname('__pyx_memoryview_err') +*/ + __pyx_t_1 = __Pyx_PyLong_From_int(__pyx_v_dim); if (unlikely(!__pyx_t_1)) __PYX_ERR(1, 1254, __pyx_L1_error) + __Pyx_GOTREF(__pyx_t_1); + __pyx_t_2 = __Pyx_PyUnicode_FormatSafe(__pyx_v_msg, __pyx_t_1); if (unlikely(!__pyx_t_2)) __PYX_ERR(1, 1254, __pyx_L1_error) + __Pyx_GOTREF(__pyx_t_2); + __Pyx_DECREF(__pyx_t_1); __pyx_t_1 = 0; + __Pyx_Raise(((PyObject *)__pyx_v_error), __pyx_t_2, 0, 0); + __Pyx_DECREF(__pyx_t_2); __pyx_t_2 = 0; + __PYX_ERR(1, 1254, __pyx_L1_error) + + /* "View.MemoryView":1252 + * raise ValueError, f"got differing extents in dimension {i} (got {extent1} and {extent2})" + * + * @cname('__pyx_memoryview_err_dim') # <<<<<<<<<<<<<< + * cdef int _err_dim(PyObject *error, str msg, int dim) except -1 with gil: + * raise error, msg % dim +*/ + + /* function exit code */ + __pyx_L1_error:; + __Pyx_XDECREF(__pyx_t_1); + __Pyx_XDECREF(__pyx_t_2); + __Pyx_AddTraceback("View.MemoryView._err_dim", __pyx_clineno, __pyx_lineno, __pyx_filename); + __pyx_r = -1; + __Pyx_XDECREF(__pyx_v_msg); + __Pyx_RefNannyFinishContext(); + __Pyx_PyGILState_Release(__pyx_gilstate_save); + return __pyx_r; +} + +/* "View.MemoryView":1256 + * raise error, msg % dim + * + * @cname('__pyx_memoryview_err') # <<<<<<<<<<<<<< + * cdef int _err(PyObject *error, str msg) except -1 with gil: + * raise error, msg +*/ + +static int __pyx_memoryview_err(PyObject *__pyx_v_error, PyObject *__pyx_v_msg) { + int __pyx_r; + __Pyx_RefNannyDeclarations + int __pyx_lineno = 0; + const char *__pyx_filename = NULL; + int __pyx_clineno = 0; + PyGILState_STATE __pyx_gilstate_save = __Pyx_PyGILState_Ensure(); + __Pyx_RefNannySetupContext("_err", 0); + __Pyx_INCREF(__pyx_v_msg); + + /* "View.MemoryView":1258 + * @cname('__pyx_memoryview_err') + * cdef int _err(PyObject *error, str msg) except -1 with gil: + * raise error, msg # <<<<<<<<<<<<<< + * + * @cname('__pyx_memoryview_err_no_memory') +*/ + __Pyx_Raise(((PyObject *)__pyx_v_error), __pyx_v_msg, 0, 0); + __PYX_ERR(1, 1258, __pyx_L1_error) + + /* "View.MemoryView":1256 + * raise error, msg % dim + * + * @cname('__pyx_memoryview_err') # <<<<<<<<<<<<<< + * cdef int _err(PyObject *error, str msg) except -1 with gil: + * raise error, msg +*/ + + /* function exit code */ + __pyx_L1_error:; + __Pyx_AddTraceback("View.MemoryView._err", __pyx_clineno, __pyx_lineno, __pyx_filename); + __pyx_r = -1; + __Pyx_XDECREF(__pyx_v_msg); + __Pyx_RefNannyFinishContext(); + __Pyx_PyGILState_Release(__pyx_gilstate_save); + return __pyx_r; +} + +/* "View.MemoryView":1260 + * raise error, msg + * + * @cname('__pyx_memoryview_err_no_memory') # <<<<<<<<<<<<<< + * cdef int _err_no_memory() except -1 with gil: + * raise MemoryError +*/ + +static int __pyx_memoryview_err_no_memory(void) { + int __pyx_r; + int __pyx_lineno = 0; + const char *__pyx_filename = NULL; + int __pyx_clineno = 0; + PyGILState_STATE __pyx_gilstate_save = __Pyx_PyGILState_Ensure(); + + /* "View.MemoryView":1262 + * @cname('__pyx_memoryview_err_no_memory') + * cdef int _err_no_memory() except -1 with gil: + * raise MemoryError # <<<<<<<<<<<<<< + * + * +*/ + PyErr_NoMemory(); __PYX_ERR(1, 1262, __pyx_L1_error) + + /* "View.MemoryView":1260 + * raise error, msg + * + * @cname('__pyx_memoryview_err_no_memory') # <<<<<<<<<<<<<< + * cdef int _err_no_memory() except -1 with gil: + * raise MemoryError +*/ + + /* function exit code */ + __pyx_L1_error:; + __Pyx_AddTraceback("View.MemoryView._err_no_memory", __pyx_clineno, __pyx_lineno, __pyx_filename); + __pyx_r = -1; + __Pyx_PyGILState_Release(__pyx_gilstate_save); + return __pyx_r; +} + +/* "View.MemoryView":1265 + * + * + * @cname('__pyx_memoryview_copy_contents') # <<<<<<<<<<<<<< + * cdef int memoryview_copy_contents(__Pyx_memviewslice src, + * __Pyx_memviewslice dst, +*/ + +static int __pyx_memoryview_copy_contents(__Pyx_memviewslice __pyx_v_src, __Pyx_memviewslice __pyx_v_dst, int __pyx_v_src_ndim, int __pyx_v_dst_ndim, int __pyx_v_dtype_is_object) { + void *__pyx_v_tmpdata; + size_t __pyx_v_itemsize; + int __pyx_v_i; + char __pyx_v_order; + int __pyx_v_broadcasting; + int __pyx_v_direct_copy; + __Pyx_memviewslice __pyx_v_tmp; + int __pyx_v_ndim; + int __pyx_r; + Py_ssize_t __pyx_t_1; + int __pyx_t_2; + int __pyx_t_3; + int __pyx_t_4; + int __pyx_t_5; + int __pyx_t_6; + void *__pyx_t_7; + int __pyx_lineno = 0; + const char *__pyx_filename = NULL; + int __pyx_clineno = 0; + PyGILState_STATE __pyx_gilstate_save; + + /* "View.MemoryView":1274 + * Check for overlapping memory and verify the shapes. + * """ + * cdef void *tmpdata = NULL # <<<<<<<<<<<<<< + * cdef size_t itemsize = src.memview.view.itemsize + * cdef int i +*/ + __pyx_v_tmpdata = NULL; + + /* "View.MemoryView":1275 + * """ + * cdef void *tmpdata = NULL + * cdef size_t itemsize = src.memview.view.itemsize # <<<<<<<<<<<<<< + * cdef int i + * cdef char order = get_best_order(&src, src_ndim) +*/ + __pyx_t_1 = __pyx_v_src.memview->view.itemsize; + __pyx_v_itemsize = __pyx_t_1; + + /* "View.MemoryView":1277 + * cdef size_t itemsize = src.memview.view.itemsize + * cdef int i + * cdef char order = get_best_order(&src, src_ndim) # <<<<<<<<<<<<<< + * cdef bint broadcasting = False + * cdef bint direct_copy = False +*/ + __pyx_v_order = __pyx_get_best_slice_order((&__pyx_v_src), __pyx_v_src_ndim); + + /* "View.MemoryView":1278 + * cdef int i + * cdef char order = get_best_order(&src, src_ndim) + * cdef bint broadcasting = False # <<<<<<<<<<<<<< + * cdef bint direct_copy = False + * cdef __Pyx_memviewslice tmp +*/ + __pyx_v_broadcasting = 0; + + /* "View.MemoryView":1279 + * cdef char order = get_best_order(&src, src_ndim) + * cdef bint broadcasting = False + * cdef bint direct_copy = False # <<<<<<<<<<<<<< + * cdef __Pyx_memviewslice tmp + * +*/ + __pyx_v_direct_copy = 0; + + /* "View.MemoryView":1282 + * cdef __Pyx_memviewslice tmp + * + * if src_ndim < dst_ndim: # <<<<<<<<<<<<<< + * broadcast_leading(&src, src_ndim, dst_ndim) + * elif dst_ndim < src_ndim: +*/ + __pyx_t_2 = (__pyx_v_src_ndim < __pyx_v_dst_ndim); + if (__pyx_t_2) { + + /* "View.MemoryView":1283 + * + * if src_ndim < dst_ndim: + * broadcast_leading(&src, src_ndim, dst_ndim) # <<<<<<<<<<<<<< + * elif dst_ndim < src_ndim: + * broadcast_leading(&dst, dst_ndim, src_ndim) +*/ + __pyx_memoryview_broadcast_leading((&__pyx_v_src), __pyx_v_src_ndim, __pyx_v_dst_ndim); + + /* "View.MemoryView":1282 + * cdef __Pyx_memviewslice tmp + * + * if src_ndim < dst_ndim: # <<<<<<<<<<<<<< + * broadcast_leading(&src, src_ndim, dst_ndim) + * elif dst_ndim < src_ndim: +*/ + goto __pyx_L3; + } + + /* "View.MemoryView":1284 + * if src_ndim < dst_ndim: + * broadcast_leading(&src, src_ndim, dst_ndim) + * elif dst_ndim < src_ndim: # <<<<<<<<<<<<<< + * broadcast_leading(&dst, dst_ndim, src_ndim) + * +*/ + __pyx_t_2 = (__pyx_v_dst_ndim < __pyx_v_src_ndim); + if (__pyx_t_2) { + + /* "View.MemoryView":1285 + * broadcast_leading(&src, src_ndim, dst_ndim) + * elif dst_ndim < src_ndim: + * broadcast_leading(&dst, dst_ndim, src_ndim) # <<<<<<<<<<<<<< + * + * cdef int ndim = max(src_ndim, dst_ndim) +*/ + __pyx_memoryview_broadcast_leading((&__pyx_v_dst), __pyx_v_dst_ndim, __pyx_v_src_ndim); + + /* "View.MemoryView":1284 + * if src_ndim < dst_ndim: + * broadcast_leading(&src, src_ndim, dst_ndim) + * elif dst_ndim < src_ndim: # <<<<<<<<<<<<<< + * broadcast_leading(&dst, dst_ndim, src_ndim) + * +*/ + } + __pyx_L3:; + + /* "View.MemoryView":1287 + * broadcast_leading(&dst, dst_ndim, src_ndim) + * + * cdef int ndim = max(src_ndim, dst_ndim) # <<<<<<<<<<<<<< + * + * for i in range(ndim): +*/ + __pyx_t_3 = __pyx_v_dst_ndim; + __pyx_t_4 = __pyx_v_src_ndim; + __pyx_t_2 = (__pyx_t_3 > __pyx_t_4); + if (__pyx_t_2) { + __pyx_t_5 = __pyx_t_3; + } else { + __pyx_t_5 = __pyx_t_4; + } + __pyx_v_ndim = __pyx_t_5; + + /* "View.MemoryView":1289 + * cdef int ndim = max(src_ndim, dst_ndim) + * + * for i in range(ndim): # <<<<<<<<<<<<<< + * if src.shape[i] != dst.shape[i]: + * if src.shape[i] == 1: +*/ + __pyx_t_5 = __pyx_v_ndim; + __pyx_t_3 = __pyx_t_5; + for (__pyx_t_4 = 0; __pyx_t_4 < __pyx_t_3; __pyx_t_4+=1) { + __pyx_v_i = __pyx_t_4; + + /* "View.MemoryView":1290 + * + * for i in range(ndim): + * if src.shape[i] != dst.shape[i]: # <<<<<<<<<<<<<< + * if src.shape[i] == 1: + * broadcasting = True +*/ + __pyx_t_2 = ((__pyx_v_src.shape[__pyx_v_i]) != (__pyx_v_dst.shape[__pyx_v_i])); + if (__pyx_t_2) { + + /* "View.MemoryView":1291 + * for i in range(ndim): + * if src.shape[i] != dst.shape[i]: + * if src.shape[i] == 1: # <<<<<<<<<<<<<< + * broadcasting = True + * src.strides[i] = 0 +*/ + __pyx_t_2 = ((__pyx_v_src.shape[__pyx_v_i]) == 1); + if (__pyx_t_2) { + + /* "View.MemoryView":1292 + * if src.shape[i] != dst.shape[i]: + * if src.shape[i] == 1: + * broadcasting = True # <<<<<<<<<<<<<< + * src.strides[i] = 0 + * else: +*/ + __pyx_v_broadcasting = 1; + + /* "View.MemoryView":1293 + * if src.shape[i] == 1: + * broadcasting = True + * src.strides[i] = 0 # <<<<<<<<<<<<<< + * else: + * _err_extents(i, dst.shape[i], src.shape[i]) +*/ + (__pyx_v_src.strides[__pyx_v_i]) = 0; + + /* "View.MemoryView":1291 + * for i in range(ndim): + * if src.shape[i] != dst.shape[i]: + * if src.shape[i] == 1: # <<<<<<<<<<<<<< + * broadcasting = True + * src.strides[i] = 0 +*/ + goto __pyx_L7; + } + + /* "View.MemoryView":1295 + * src.strides[i] = 0 + * else: + * _err_extents(i, dst.shape[i], src.shape[i]) # <<<<<<<<<<<<<< + * + * if src.suboffsets[i] >= 0: +*/ + /*else*/ { + __pyx_t_6 = __pyx_memoryview_err_extents(__pyx_v_i, (__pyx_v_dst.shape[__pyx_v_i]), (__pyx_v_src.shape[__pyx_v_i])); if (unlikely(__pyx_t_6 == ((int)-1))) __PYX_ERR(1, 1295, __pyx_L1_error) + } + __pyx_L7:; + + /* "View.MemoryView":1290 + * + * for i in range(ndim): + * if src.shape[i] != dst.shape[i]: # <<<<<<<<<<<<<< + * if src.shape[i] == 1: + * broadcasting = True +*/ + } + + /* "View.MemoryView":1297 + * _err_extents(i, dst.shape[i], src.shape[i]) + * + * if src.suboffsets[i] >= 0: # <<<<<<<<<<<<<< + * _err_dim(PyExc_ValueError, "Dimension %d is not direct", i) + * +*/ + __pyx_t_2 = ((__pyx_v_src.suboffsets[__pyx_v_i]) >= 0); + if (__pyx_t_2) { + + /* "View.MemoryView":1298 + * + * if src.suboffsets[i] >= 0: + * _err_dim(PyExc_ValueError, "Dimension %d is not direct", i) # <<<<<<<<<<<<<< + * + * if slices_overlap(&src, &dst, ndim, itemsize): +*/ + __pyx_t_6 = __pyx_memoryview_err_dim(PyExc_ValueError, __pyx_mstate_global->__pyx_kp_u_Dimension_d_is_not_direct, __pyx_v_i); if (unlikely(__pyx_t_6 == ((int)-1))) __PYX_ERR(1, 1298, __pyx_L1_error) + + /* "View.MemoryView":1297 + * _err_extents(i, dst.shape[i], src.shape[i]) + * + * if src.suboffsets[i] >= 0: # <<<<<<<<<<<<<< + * _err_dim(PyExc_ValueError, "Dimension %d is not direct", i) + * +*/ + } + } + + /* "View.MemoryView":1300 + * _err_dim(PyExc_ValueError, "Dimension %d is not direct", i) + * + * if slices_overlap(&src, &dst, ndim, itemsize): # <<<<<<<<<<<<<< + * + * if not slice_is_contig(src, order, ndim): +*/ + __pyx_t_2 = __pyx_slices_overlap((&__pyx_v_src), (&__pyx_v_dst), __pyx_v_ndim, __pyx_v_itemsize); + if (__pyx_t_2) { + + /* "View.MemoryView":1302 + * if slices_overlap(&src, &dst, ndim, itemsize): + * + * if not slice_is_contig(src, order, ndim): # <<<<<<<<<<<<<< + * order = get_best_order(&dst, ndim) + * +*/ + __pyx_t_2 = (!__pyx_memviewslice_is_contig(__pyx_v_src, __pyx_v_order, __pyx_v_ndim)); + if (__pyx_t_2) { + + /* "View.MemoryView":1303 + * + * if not slice_is_contig(src, order, ndim): + * order = get_best_order(&dst, ndim) # <<<<<<<<<<<<<< + * + * tmpdata = copy_data_to_temp(&src, &tmp, order, ndim) +*/ + __pyx_v_order = __pyx_get_best_slice_order((&__pyx_v_dst), __pyx_v_ndim); + + /* "View.MemoryView":1302 + * if slices_overlap(&src, &dst, ndim, itemsize): + * + * if not slice_is_contig(src, order, ndim): # <<<<<<<<<<<<<< + * order = get_best_order(&dst, ndim) + * +*/ + } + + /* "View.MemoryView":1305 + * order = get_best_order(&dst, ndim) + * + * tmpdata = copy_data_to_temp(&src, &tmp, order, ndim) # <<<<<<<<<<<<<< + * src = tmp + * +*/ + __pyx_t_7 = __pyx_memoryview_copy_data_to_temp((&__pyx_v_src), (&__pyx_v_tmp), __pyx_v_order, __pyx_v_ndim); if (unlikely(__pyx_t_7 == ((void *)NULL))) __PYX_ERR(1, 1305, __pyx_L1_error) + __pyx_v_tmpdata = __pyx_t_7; + + /* "View.MemoryView":1306 + * + * tmpdata = copy_data_to_temp(&src, &tmp, order, ndim) + * src = tmp # <<<<<<<<<<<<<< + * + * if not broadcasting: +*/ + __pyx_v_src = __pyx_v_tmp; + + /* "View.MemoryView":1300 + * _err_dim(PyExc_ValueError, "Dimension %d is not direct", i) + * + * if slices_overlap(&src, &dst, ndim, itemsize): # <<<<<<<<<<<<<< + * + * if not slice_is_contig(src, order, ndim): +*/ + } + + /* "View.MemoryView":1308 + * src = tmp + * + * if not broadcasting: # <<<<<<<<<<<<<< + * + * +*/ + __pyx_t_2 = (!__pyx_v_broadcasting); + if (__pyx_t_2) { + + /* "View.MemoryView":1311 + * + * + * if slice_is_contig(src, 'C', ndim): # <<<<<<<<<<<<<< + * direct_copy = slice_is_contig(dst, 'C', ndim) + * elif slice_is_contig(src, 'F', ndim): +*/ + __pyx_t_2 = __pyx_memviewslice_is_contig(__pyx_v_src, 'C', __pyx_v_ndim); + if (__pyx_t_2) { + + /* "View.MemoryView":1312 + * + * if slice_is_contig(src, 'C', ndim): + * direct_copy = slice_is_contig(dst, 'C', ndim) # <<<<<<<<<<<<<< + * elif slice_is_contig(src, 'F', ndim): + * direct_copy = slice_is_contig(dst, 'F', ndim) +*/ + __pyx_v_direct_copy = __pyx_memviewslice_is_contig(__pyx_v_dst, 'C', __pyx_v_ndim); + + /* "View.MemoryView":1311 + * + * + * if slice_is_contig(src, 'C', ndim): # <<<<<<<<<<<<<< + * direct_copy = slice_is_contig(dst, 'C', ndim) + * elif slice_is_contig(src, 'F', ndim): +*/ + goto __pyx_L12; + } + + /* "View.MemoryView":1313 + * if slice_is_contig(src, 'C', ndim): + * direct_copy = slice_is_contig(dst, 'C', ndim) + * elif slice_is_contig(src, 'F', ndim): # <<<<<<<<<<<<<< + * direct_copy = slice_is_contig(dst, 'F', ndim) + * +*/ + __pyx_t_2 = __pyx_memviewslice_is_contig(__pyx_v_src, 'F', __pyx_v_ndim); + if (__pyx_t_2) { + + /* "View.MemoryView":1314 + * direct_copy = slice_is_contig(dst, 'C', ndim) + * elif slice_is_contig(src, 'F', ndim): + * direct_copy = slice_is_contig(dst, 'F', ndim) # <<<<<<<<<<<<<< + * + * if direct_copy: +*/ + __pyx_v_direct_copy = __pyx_memviewslice_is_contig(__pyx_v_dst, 'F', __pyx_v_ndim); + + /* "View.MemoryView":1313 + * if slice_is_contig(src, 'C', ndim): + * direct_copy = slice_is_contig(dst, 'C', ndim) + * elif slice_is_contig(src, 'F', ndim): # <<<<<<<<<<<<<< + * direct_copy = slice_is_contig(dst, 'F', ndim) + * +*/ + } + __pyx_L12:; + + /* "View.MemoryView":1316 + * direct_copy = slice_is_contig(dst, 'F', ndim) + * + * if direct_copy: # <<<<<<<<<<<<<< + * + * refcount_copying(&dst, dtype_is_object, ndim, inc=False) +*/ + if (__pyx_v_direct_copy) { + + /* "View.MemoryView":1318 + * if direct_copy: + * + * refcount_copying(&dst, dtype_is_object, ndim, inc=False) # <<<<<<<<<<<<<< + * memcpy(dst.data, src.data, slice_get_size(&src, ndim)) + * refcount_copying(&dst, dtype_is_object, ndim, inc=True) +*/ + __pyx_memoryview_refcount_copying((&__pyx_v_dst), __pyx_v_dtype_is_object, __pyx_v_ndim, 0); + + /* "View.MemoryView":1319 + * + * refcount_copying(&dst, dtype_is_object, ndim, inc=False) + * memcpy(dst.data, src.data, slice_get_size(&src, ndim)) # <<<<<<<<<<<<<< + * refcount_copying(&dst, dtype_is_object, ndim, inc=True) + * free(tmpdata) +*/ + (void)(memcpy(__pyx_v_dst.data, __pyx_v_src.data, __pyx_memoryview_slice_get_size((&__pyx_v_src), __pyx_v_ndim))); + + /* "View.MemoryView":1320 + * refcount_copying(&dst, dtype_is_object, ndim, inc=False) + * memcpy(dst.data, src.data, slice_get_size(&src, ndim)) + * refcount_copying(&dst, dtype_is_object, ndim, inc=True) # <<<<<<<<<<<<<< + * free(tmpdata) + * return 0 +*/ + __pyx_memoryview_refcount_copying((&__pyx_v_dst), __pyx_v_dtype_is_object, __pyx_v_ndim, 1); + + /* "View.MemoryView":1321 + * memcpy(dst.data, src.data, slice_get_size(&src, ndim)) + * refcount_copying(&dst, dtype_is_object, ndim, inc=True) + * free(tmpdata) # <<<<<<<<<<<<<< + * return 0 + * +*/ + free(__pyx_v_tmpdata); + + /* "View.MemoryView":1322 + * refcount_copying(&dst, dtype_is_object, ndim, inc=True) + * free(tmpdata) + * return 0 # <<<<<<<<<<<<<< + * + * if order == 'F' == get_best_order(&dst, ndim): +*/ + __pyx_r = 0; + goto __pyx_L0; + + /* "View.MemoryView":1316 + * direct_copy = slice_is_contig(dst, 'F', ndim) + * + * if direct_copy: # <<<<<<<<<<<<<< + * + * refcount_copying(&dst, dtype_is_object, ndim, inc=False) +*/ + } + + /* "View.MemoryView":1308 + * src = tmp + * + * if not broadcasting: # <<<<<<<<<<<<<< + * + * +*/ + } + + /* "View.MemoryView":1324 + * return 0 + * + * if order == 'F' == get_best_order(&dst, ndim): # <<<<<<<<<<<<<< + * + * +*/ + __pyx_t_2 = (__pyx_v_order == 'F'); + if (__pyx_t_2) { + __pyx_t_2 = ('F' == __pyx_get_best_slice_order((&__pyx_v_dst), __pyx_v_ndim)); + } + if (__pyx_t_2) { + + /* "View.MemoryView":1327 + * + * + * transpose_memslice(&src) # <<<<<<<<<<<<<< + * transpose_memslice(&dst) + * +*/ + __pyx_t_5 = __pyx_memslice_transpose((&__pyx_v_src)); if (unlikely(__pyx_t_5 == ((int)-1))) __PYX_ERR(1, 1327, __pyx_L1_error) + + /* "View.MemoryView":1328 + * + * transpose_memslice(&src) + * transpose_memslice(&dst) # <<<<<<<<<<<<<< + * + * refcount_copying(&dst, dtype_is_object, ndim, inc=False) +*/ + __pyx_t_5 = __pyx_memslice_transpose((&__pyx_v_dst)); if (unlikely(__pyx_t_5 == ((int)-1))) __PYX_ERR(1, 1328, __pyx_L1_error) + + /* "View.MemoryView":1324 + * return 0 + * + * if order == 'F' == get_best_order(&dst, ndim): # <<<<<<<<<<<<<< + * + * +*/ + } + + /* "View.MemoryView":1330 + * transpose_memslice(&dst) + * + * refcount_copying(&dst, dtype_is_object, ndim, inc=False) # <<<<<<<<<<<<<< + * copy_strided_to_strided(&src, &dst, ndim, itemsize) + * refcount_copying(&dst, dtype_is_object, ndim, inc=True) +*/ + __pyx_memoryview_refcount_copying((&__pyx_v_dst), __pyx_v_dtype_is_object, __pyx_v_ndim, 0); + + /* "View.MemoryView":1331 + * + * refcount_copying(&dst, dtype_is_object, ndim, inc=False) + * copy_strided_to_strided(&src, &dst, ndim, itemsize) # <<<<<<<<<<<<<< + * refcount_copying(&dst, dtype_is_object, ndim, inc=True) + * +*/ + copy_strided_to_strided((&__pyx_v_src), (&__pyx_v_dst), __pyx_v_ndim, __pyx_v_itemsize); + + /* "View.MemoryView":1332 + * refcount_copying(&dst, dtype_is_object, ndim, inc=False) + * copy_strided_to_strided(&src, &dst, ndim, itemsize) + * refcount_copying(&dst, dtype_is_object, ndim, inc=True) # <<<<<<<<<<<<<< + * + * free(tmpdata) +*/ + __pyx_memoryview_refcount_copying((&__pyx_v_dst), __pyx_v_dtype_is_object, __pyx_v_ndim, 1); + + /* "View.MemoryView":1334 + * refcount_copying(&dst, dtype_is_object, ndim, inc=True) + * + * free(tmpdata) # <<<<<<<<<<<<<< + * return 0 + * +*/ + free(__pyx_v_tmpdata); + + /* "View.MemoryView":1335 + * + * free(tmpdata) + * return 0 # <<<<<<<<<<<<<< + * + * @cname('__pyx_memoryview_broadcast_leading') +*/ + __pyx_r = 0; + goto __pyx_L0; + + /* "View.MemoryView":1265 + * + * + * @cname('__pyx_memoryview_copy_contents') # <<<<<<<<<<<<<< + * cdef int memoryview_copy_contents(__Pyx_memviewslice src, + * __Pyx_memviewslice dst, +*/ + + /* function exit code */ + __pyx_L1_error:; + __pyx_gilstate_save = __Pyx_PyGILState_Ensure(); + __Pyx_AddTraceback("View.MemoryView.memoryview_copy_contents", __pyx_clineno, __pyx_lineno, __pyx_filename); + __pyx_r = -1; + __Pyx_PyGILState_Release(__pyx_gilstate_save); + __pyx_L0:; + return __pyx_r; +} + +/* "View.MemoryView":1337 + * return 0 + * + * @cname('__pyx_memoryview_broadcast_leading') # <<<<<<<<<<<<<< + * cdef void broadcast_leading(__Pyx_memviewslice *mslice, + * int ndim, +*/ + +static void __pyx_memoryview_broadcast_leading(__Pyx_memviewslice *__pyx_v_mslice, int __pyx_v_ndim, int __pyx_v_ndim_other) { + int __pyx_v_i; + int __pyx_v_offset; + int __pyx_t_1; + int __pyx_t_2; + int __pyx_t_3; + + /* "View.MemoryView":1342 + * int ndim_other) noexcept nogil: + * cdef int i + * cdef int offset = ndim_other - ndim # <<<<<<<<<<<<<< + * + * for i in range(ndim - 1, -1, -1): +*/ + __pyx_v_offset = (__pyx_v_ndim_other - __pyx_v_ndim); + + /* "View.MemoryView":1344 + * cdef int offset = ndim_other - ndim + * + * for i in range(ndim - 1, -1, -1): # <<<<<<<<<<<<<< + * mslice.shape[i + offset] = mslice.shape[i] + * mslice.strides[i + offset] = mslice.strides[i] +*/ + for (__pyx_t_1 = (__pyx_v_ndim - 1); __pyx_t_1 > -1; __pyx_t_1-=1) { + __pyx_v_i = __pyx_t_1; + + /* "View.MemoryView":1345 + * + * for i in range(ndim - 1, -1, -1): + * mslice.shape[i + offset] = mslice.shape[i] # <<<<<<<<<<<<<< + * mslice.strides[i + offset] = mslice.strides[i] + * mslice.suboffsets[i + offset] = mslice.suboffsets[i] +*/ + (__pyx_v_mslice->shape[(__pyx_v_i + __pyx_v_offset)]) = (__pyx_v_mslice->shape[__pyx_v_i]); + + /* "View.MemoryView":1346 + * for i in range(ndim - 1, -1, -1): + * mslice.shape[i + offset] = mslice.shape[i] + * mslice.strides[i + offset] = mslice.strides[i] # <<<<<<<<<<<<<< + * mslice.suboffsets[i + offset] = mslice.suboffsets[i] + * +*/ + (__pyx_v_mslice->strides[(__pyx_v_i + __pyx_v_offset)]) = (__pyx_v_mslice->strides[__pyx_v_i]); + + /* "View.MemoryView":1347 + * mslice.shape[i + offset] = mslice.shape[i] + * mslice.strides[i + offset] = mslice.strides[i] + * mslice.suboffsets[i + offset] = mslice.suboffsets[i] # <<<<<<<<<<<<<< + * + * for i in range(offset): +*/ + (__pyx_v_mslice->suboffsets[(__pyx_v_i + __pyx_v_offset)]) = (__pyx_v_mslice->suboffsets[__pyx_v_i]); + } + + /* "View.MemoryView":1349 + * mslice.suboffsets[i + offset] = mslice.suboffsets[i] + * + * for i in range(offset): # <<<<<<<<<<<<<< + * mslice.shape[i] = 1 + * mslice.strides[i] = mslice.strides[0] +*/ + __pyx_t_1 = __pyx_v_offset; + __pyx_t_2 = __pyx_t_1; + for (__pyx_t_3 = 0; __pyx_t_3 < __pyx_t_2; __pyx_t_3+=1) { + __pyx_v_i = __pyx_t_3; + + /* "View.MemoryView":1350 + * + * for i in range(offset): + * mslice.shape[i] = 1 # <<<<<<<<<<<<<< + * mslice.strides[i] = mslice.strides[0] + * mslice.suboffsets[i] = -1 +*/ + (__pyx_v_mslice->shape[__pyx_v_i]) = 1; + + /* "View.MemoryView":1351 + * for i in range(offset): + * mslice.shape[i] = 1 + * mslice.strides[i] = mslice.strides[0] # <<<<<<<<<<<<<< + * mslice.suboffsets[i] = -1 + * +*/ + (__pyx_v_mslice->strides[__pyx_v_i]) = (__pyx_v_mslice->strides[0]); + + /* "View.MemoryView":1352 + * mslice.shape[i] = 1 + * mslice.strides[i] = mslice.strides[0] + * mslice.suboffsets[i] = -1 # <<<<<<<<<<<<<< + * + * +*/ + (__pyx_v_mslice->suboffsets[__pyx_v_i]) = -1L; + } + + /* "View.MemoryView":1337 + * return 0 + * + * @cname('__pyx_memoryview_broadcast_leading') # <<<<<<<<<<<<<< + * cdef void broadcast_leading(__Pyx_memviewslice *mslice, + * int ndim, +*/ + + /* function exit code */ +} + +/* "View.MemoryView":1359 + * + * + * @cname('__pyx_memoryview_refcount_copying') # <<<<<<<<<<<<<< + * cdef void refcount_copying(__Pyx_memviewslice *dst, bint dtype_is_object, int ndim, bint inc) noexcept nogil: + * +*/ + +static void __pyx_memoryview_refcount_copying(__Pyx_memviewslice *__pyx_v_dst, int __pyx_v_dtype_is_object, int __pyx_v_ndim, int __pyx_v_inc) { + + /* "View.MemoryView":1362 + * cdef void refcount_copying(__Pyx_memviewslice *dst, bint dtype_is_object, int ndim, bint inc) noexcept nogil: + * + * if dtype_is_object: # <<<<<<<<<<<<<< + * refcount_objects_in_slice_with_gil(dst.data, dst.shape, dst.strides, ndim, inc) + * +*/ + if (__pyx_v_dtype_is_object) { + + /* "View.MemoryView":1363 + * + * if dtype_is_object: + * refcount_objects_in_slice_with_gil(dst.data, dst.shape, dst.strides, ndim, inc) # <<<<<<<<<<<<<< + * + * @cname('__pyx_memoryview_refcount_objects_in_slice_with_gil') +*/ + __pyx_memoryview_refcount_objects_in_slice_with_gil(__pyx_v_dst->data, __pyx_v_dst->shape, __pyx_v_dst->strides, __pyx_v_ndim, __pyx_v_inc); + + /* "View.MemoryView":1362 + * cdef void refcount_copying(__Pyx_memviewslice *dst, bint dtype_is_object, int ndim, bint inc) noexcept nogil: + * + * if dtype_is_object: # <<<<<<<<<<<<<< + * refcount_objects_in_slice_with_gil(dst.data, dst.shape, dst.strides, ndim, inc) + * +*/ + } + + /* "View.MemoryView":1359 + * + * + * @cname('__pyx_memoryview_refcount_copying') # <<<<<<<<<<<<<< + * cdef void refcount_copying(__Pyx_memviewslice *dst, bint dtype_is_object, int ndim, bint inc) noexcept nogil: + * +*/ + + /* function exit code */ +} + +/* "View.MemoryView":1365 + * refcount_objects_in_slice_with_gil(dst.data, dst.shape, dst.strides, ndim, inc) + * + * @cname('__pyx_memoryview_refcount_objects_in_slice_with_gil') # <<<<<<<<<<<<<< + * cdef void refcount_objects_in_slice_with_gil(char *data, Py_ssize_t *shape, + * Py_ssize_t *strides, int ndim, +*/ + +static void __pyx_memoryview_refcount_objects_in_slice_with_gil(char *__pyx_v_data, Py_ssize_t *__pyx_v_shape, Py_ssize_t *__pyx_v_strides, int __pyx_v_ndim, int __pyx_v_inc) { + PyGILState_STATE __pyx_gilstate_save = __Pyx_PyGILState_Ensure(); + + /* "View.MemoryView":1369 + * Py_ssize_t *strides, int ndim, + * bint inc) noexcept with gil: + * refcount_objects_in_slice(data, shape, strides, ndim, inc) # <<<<<<<<<<<<<< + * + * @cname('__pyx_memoryview_refcount_objects_in_slice') +*/ + __pyx_memoryview_refcount_objects_in_slice(__pyx_v_data, __pyx_v_shape, __pyx_v_strides, __pyx_v_ndim, __pyx_v_inc); + + /* "View.MemoryView":1365 + * refcount_objects_in_slice_with_gil(dst.data, dst.shape, dst.strides, ndim, inc) + * + * @cname('__pyx_memoryview_refcount_objects_in_slice_with_gil') # <<<<<<<<<<<<<< + * cdef void refcount_objects_in_slice_with_gil(char *data, Py_ssize_t *shape, + * Py_ssize_t *strides, int ndim, +*/ + + /* function exit code */ + __Pyx_PyGILState_Release(__pyx_gilstate_save); +} + +/* "View.MemoryView":1371 + * refcount_objects_in_slice(data, shape, strides, ndim, inc) + * + * @cname('__pyx_memoryview_refcount_objects_in_slice') # <<<<<<<<<<<<<< + * cdef void refcount_objects_in_slice(char *data, Py_ssize_t *shape, + * Py_ssize_t *strides, int ndim, bint inc) noexcept: +*/ + +static void __pyx_memoryview_refcount_objects_in_slice(char *__pyx_v_data, Py_ssize_t *__pyx_v_shape, Py_ssize_t *__pyx_v_strides, int __pyx_v_ndim, int __pyx_v_inc) { + CYTHON_UNUSED Py_ssize_t __pyx_v_i; + Py_ssize_t __pyx_v_stride; + Py_ssize_t __pyx_t_1; + Py_ssize_t __pyx_t_2; + Py_ssize_t __pyx_t_3; + int __pyx_t_4; + + /* "View.MemoryView":1375 + * Py_ssize_t *strides, int ndim, bint inc) noexcept: + * cdef Py_ssize_t i + * cdef Py_ssize_t stride = strides[0] # <<<<<<<<<<<<<< + * + * for i in range(shape[0]): +*/ + __pyx_v_stride = (__pyx_v_strides[0]); + + /* "View.MemoryView":1377 + * cdef Py_ssize_t stride = strides[0] + * + * for i in range(shape[0]): # <<<<<<<<<<<<<< + * if ndim == 1: + * if inc: +*/ + __pyx_t_1 = (__pyx_v_shape[0]); + __pyx_t_2 = __pyx_t_1; + for (__pyx_t_3 = 0; __pyx_t_3 < __pyx_t_2; __pyx_t_3+=1) { + __pyx_v_i = __pyx_t_3; + + /* "View.MemoryView":1378 + * + * for i in range(shape[0]): + * if ndim == 1: # <<<<<<<<<<<<<< + * if inc: + * Py_INCREF(( data)[0]) +*/ + __pyx_t_4 = (__pyx_v_ndim == 1); + if (__pyx_t_4) { + + /* "View.MemoryView":1379 + * for i in range(shape[0]): + * if ndim == 1: + * if inc: # <<<<<<<<<<<<<< + * Py_INCREF(( data)[0]) + * else: +*/ + if (__pyx_v_inc) { + + /* "View.MemoryView":1380 + * if ndim == 1: + * if inc: + * Py_INCREF(( data)[0]) # <<<<<<<<<<<<<< + * else: + * Py_DECREF(( data)[0]) +*/ + Py_INCREF((((PyObject **)__pyx_v_data)[0])); + + /* "View.MemoryView":1379 + * for i in range(shape[0]): + * if ndim == 1: + * if inc: # <<<<<<<<<<<<<< + * Py_INCREF(( data)[0]) + * else: +*/ + goto __pyx_L6; + } + + /* "View.MemoryView":1382 + * Py_INCREF(( data)[0]) + * else: + * Py_DECREF(( data)[0]) # <<<<<<<<<<<<<< + * else: + * refcount_objects_in_slice(data, shape + 1, strides + 1, ndim - 1, inc) +*/ + /*else*/ { + Py_DECREF((((PyObject **)__pyx_v_data)[0])); + } + __pyx_L6:; + + /* "View.MemoryView":1378 + * + * for i in range(shape[0]): + * if ndim == 1: # <<<<<<<<<<<<<< + * if inc: + * Py_INCREF(( data)[0]) +*/ + goto __pyx_L5; + } + + /* "View.MemoryView":1384 + * Py_DECREF(( data)[0]) + * else: + * refcount_objects_in_slice(data, shape + 1, strides + 1, ndim - 1, inc) # <<<<<<<<<<<<<< + * + * data += stride +*/ + /*else*/ { + __pyx_memoryview_refcount_objects_in_slice(__pyx_v_data, (__pyx_v_shape + 1), (__pyx_v_strides + 1), (__pyx_v_ndim - 1), __pyx_v_inc); + } + __pyx_L5:; + + /* "View.MemoryView":1386 + * refcount_objects_in_slice(data, shape + 1, strides + 1, ndim - 1, inc) + * + * data += stride # <<<<<<<<<<<<<< + * + * +*/ + __pyx_v_data = (__pyx_v_data + __pyx_v_stride); + } + + /* "View.MemoryView":1371 + * refcount_objects_in_slice(data, shape, strides, ndim, inc) + * + * @cname('__pyx_memoryview_refcount_objects_in_slice') # <<<<<<<<<<<<<< + * cdef void refcount_objects_in_slice(char *data, Py_ssize_t *shape, + * Py_ssize_t *strides, int ndim, bint inc) noexcept: +*/ + + /* function exit code */ +} + +/* "View.MemoryView":1391 + * + * + * @cname('__pyx_memoryview_slice_assign_scalar') # <<<<<<<<<<<<<< + * cdef void slice_assign_scalar(__Pyx_memviewslice *dst, int ndim, + * size_t itemsize, void *item, +*/ + +static void __pyx_memoryview_slice_assign_scalar(__Pyx_memviewslice *__pyx_v_dst, int __pyx_v_ndim, size_t __pyx_v_itemsize, void *__pyx_v_item, int __pyx_v_dtype_is_object) { + + /* "View.MemoryView":1395 + * size_t itemsize, void *item, + * bint dtype_is_object) noexcept nogil: + * refcount_copying(dst, dtype_is_object, ndim, inc=False) # <<<<<<<<<<<<<< + * _slice_assign_scalar(dst.data, dst.shape, dst.strides, ndim, itemsize, item) + * refcount_copying(dst, dtype_is_object, ndim, inc=True) +*/ + __pyx_memoryview_refcount_copying(__pyx_v_dst, __pyx_v_dtype_is_object, __pyx_v_ndim, 0); + + /* "View.MemoryView":1396 + * bint dtype_is_object) noexcept nogil: + * refcount_copying(dst, dtype_is_object, ndim, inc=False) + * _slice_assign_scalar(dst.data, dst.shape, dst.strides, ndim, itemsize, item) # <<<<<<<<<<<<<< + * refcount_copying(dst, dtype_is_object, ndim, inc=True) + * +*/ + __pyx_memoryview__slice_assign_scalar(__pyx_v_dst->data, __pyx_v_dst->shape, __pyx_v_dst->strides, __pyx_v_ndim, __pyx_v_itemsize, __pyx_v_item); + + /* "View.MemoryView":1397 + * refcount_copying(dst, dtype_is_object, ndim, inc=False) + * _slice_assign_scalar(dst.data, dst.shape, dst.strides, ndim, itemsize, item) + * refcount_copying(dst, dtype_is_object, ndim, inc=True) # <<<<<<<<<<<<<< + * + * +*/ + __pyx_memoryview_refcount_copying(__pyx_v_dst, __pyx_v_dtype_is_object, __pyx_v_ndim, 1); + + /* "View.MemoryView":1391 + * + * + * @cname('__pyx_memoryview_slice_assign_scalar') # <<<<<<<<<<<<<< + * cdef void slice_assign_scalar(__Pyx_memviewslice *dst, int ndim, + * size_t itemsize, void *item, +*/ + + /* function exit code */ +} + +/* "View.MemoryView":1400 + * + * + * @cname('__pyx_memoryview__slice_assign_scalar') # <<<<<<<<<<<<<< + * cdef void _slice_assign_scalar(char *data, Py_ssize_t *shape, + * Py_ssize_t *strides, int ndim, +*/ + +static void __pyx_memoryview__slice_assign_scalar(char *__pyx_v_data, Py_ssize_t *__pyx_v_shape, Py_ssize_t *__pyx_v_strides, int __pyx_v_ndim, size_t __pyx_v_itemsize, void *__pyx_v_item) { + CYTHON_UNUSED Py_ssize_t __pyx_v_i; + Py_ssize_t __pyx_v_stride; + Py_ssize_t __pyx_v_extent; + int __pyx_t_1; + Py_ssize_t __pyx_t_2; + Py_ssize_t __pyx_t_3; + Py_ssize_t __pyx_t_4; + + /* "View.MemoryView":1405 + * size_t itemsize, void *item) noexcept nogil: + * cdef Py_ssize_t i + * cdef Py_ssize_t stride = strides[0] # <<<<<<<<<<<<<< + * cdef Py_ssize_t extent = shape[0] + * +*/ + __pyx_v_stride = (__pyx_v_strides[0]); + + /* "View.MemoryView":1406 + * cdef Py_ssize_t i + * cdef Py_ssize_t stride = strides[0] + * cdef Py_ssize_t extent = shape[0] # <<<<<<<<<<<<<< + * + * if ndim == 1: +*/ + __pyx_v_extent = (__pyx_v_shape[0]); + + /* "View.MemoryView":1408 + * cdef Py_ssize_t extent = shape[0] + * + * if ndim == 1: # <<<<<<<<<<<<<< + * for i in range(extent): + * memcpy(data, item, itemsize) +*/ + __pyx_t_1 = (__pyx_v_ndim == 1); + if (__pyx_t_1) { + + /* "View.MemoryView":1409 + * + * if ndim == 1: + * for i in range(extent): # <<<<<<<<<<<<<< + * memcpy(data, item, itemsize) + * data += stride +*/ + __pyx_t_2 = __pyx_v_extent; + __pyx_t_3 = __pyx_t_2; + for (__pyx_t_4 = 0; __pyx_t_4 < __pyx_t_3; __pyx_t_4+=1) { + __pyx_v_i = __pyx_t_4; + + /* "View.MemoryView":1410 + * if ndim == 1: + * for i in range(extent): + * memcpy(data, item, itemsize) # <<<<<<<<<<<<<< + * data += stride + * else: +*/ + (void)(memcpy(__pyx_v_data, __pyx_v_item, __pyx_v_itemsize)); + + /* "View.MemoryView":1411 + * for i in range(extent): + * memcpy(data, item, itemsize) + * data += stride # <<<<<<<<<<<<<< + * else: + * for i in range(extent): +*/ + __pyx_v_data = (__pyx_v_data + __pyx_v_stride); + } + + /* "View.MemoryView":1408 + * cdef Py_ssize_t extent = shape[0] + * + * if ndim == 1: # <<<<<<<<<<<<<< + * for i in range(extent): + * memcpy(data, item, itemsize) +*/ + goto __pyx_L3; + } + + /* "View.MemoryView":1413 + * data += stride + * else: + * for i in range(extent): # <<<<<<<<<<<<<< + * _slice_assign_scalar(data, shape + 1, strides + 1, ndim - 1, itemsize, item) + * data += stride +*/ + /*else*/ { + __pyx_t_2 = __pyx_v_extent; + __pyx_t_3 = __pyx_t_2; + for (__pyx_t_4 = 0; __pyx_t_4 < __pyx_t_3; __pyx_t_4+=1) { + __pyx_v_i = __pyx_t_4; + + /* "View.MemoryView":1414 + * else: + * for i in range(extent): + * _slice_assign_scalar(data, shape + 1, strides + 1, ndim - 1, itemsize, item) # <<<<<<<<<<<<<< + * data += stride + * +*/ + __pyx_memoryview__slice_assign_scalar(__pyx_v_data, (__pyx_v_shape + 1), (__pyx_v_strides + 1), (__pyx_v_ndim - 1), __pyx_v_itemsize, __pyx_v_item); + + /* "View.MemoryView":1415 + * for i in range(extent): + * _slice_assign_scalar(data, shape + 1, strides + 1, ndim - 1, itemsize, item) + * data += stride # <<<<<<<<<<<<<< + * +*/ + __pyx_v_data = (__pyx_v_data + __pyx_v_stride); + } + } + __pyx_L3:; + + /* "View.MemoryView":1400 + * + * + * @cname('__pyx_memoryview__slice_assign_scalar') # <<<<<<<<<<<<<< + * cdef void _slice_assign_scalar(char *data, Py_ssize_t *shape, + * Py_ssize_t *strides, int ndim, +*/ + + /* function exit code */ +} + +/* "(tree fragment)":4 + * int __Pyx_CheckUnpickleChecksum(long, long, long, long, const char*) except -1 + * int __Pyx_UpdateUnpickledDict(object, object, Py_ssize_t) except -1 + * def __pyx_unpickle_Enum(__pyx_type, long __pyx_checksum, tuple __pyx_state): # <<<<<<<<<<<<<< + * cdef object __pyx_result + * __Pyx_CheckUnpickleChecksum(__pyx_checksum, 0x82a3537, 0x6ae9995, 0xb068931, b'name') +*/ + +/* Python wrapper */ +static PyObject *__pyx_pw_15View_dot_MemoryView_1__pyx_unpickle_Enum(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*/ +static PyMethodDef __pyx_mdef_15View_dot_MemoryView_1__pyx_unpickle_Enum = {"__pyx_unpickle_Enum", (PyCFunction)(void(*)(void))(__Pyx_PyCFunction_FastCallWithKeywords)__pyx_pw_15View_dot_MemoryView_1__pyx_unpickle_Enum, __Pyx_METH_FASTCALL|METH_KEYWORDS, 0}; +static PyObject *__pyx_pw_15View_dot_MemoryView_1__pyx_unpickle_Enum(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 +) { + PyObject *__pyx_v___pyx_type = 0; + long __pyx_v___pyx_checksum; + 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[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("__pyx_unpickle_Enum (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_type,&__pyx_mstate_global->__pyx_n_u_pyx_checksum,&__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, 4, __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(1, 4, __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(1, 4, __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(1, 4, __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, "__pyx_unpickle_Enum", 0) < (0)) __PYX_ERR(1, 4, __pyx_L3_error) + for (Py_ssize_t i = __pyx_nargs; i < 3; i++) { + if (unlikely(!values[i])) { __Pyx_RaiseArgtupleInvalid("__pyx_unpickle_Enum", 1, 3, 3, i); __PYX_ERR(1, 4, __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(1, 4, __pyx_L3_error) + values[1] = __Pyx_ArgRef_FASTCALL(__pyx_args, 1); + if (!CYTHON_ASSUME_SAFE_MACROS && unlikely(!values[1])) __PYX_ERR(1, 4, __pyx_L3_error) + values[2] = __Pyx_ArgRef_FASTCALL(__pyx_args, 2); + if (!CYTHON_ASSUME_SAFE_MACROS && unlikely(!values[2])) __PYX_ERR(1, 4, __pyx_L3_error) + } + __pyx_v___pyx_type = values[0]; + __pyx_v___pyx_checksum = __Pyx_PyLong_As_long(values[1]); if (unlikely((__pyx_v___pyx_checksum == (long)-1) && PyErr_Occurred())) __PYX_ERR(1, 4, __pyx_L3_error) + __pyx_v___pyx_state = ((PyObject*)values[2]); + } + goto __pyx_L6_skip; + __pyx_L5_argtuple_error:; + __Pyx_RaiseArgtupleInvalid("__pyx_unpickle_Enum", 1, 3, 3, __pyx_nargs); __PYX_ERR(1, 4, __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("View.MemoryView.__pyx_unpickle_Enum", __pyx_clineno, __pyx_lineno, __pyx_filename); + __Pyx_RefNannyFinishContext(); + return NULL; + __pyx_L4_argument_unpacking_done:; + if (unlikely(!__Pyx_ArgTypeTest(((PyObject *)__pyx_v___pyx_state), (&PyTuple_Type), 1, "__pyx_state", 1))) __PYX_ERR(1, 4, __pyx_L1_error) + __pyx_r = __pyx_pf_15View_dot_MemoryView___pyx_unpickle_Enum(__pyx_self, __pyx_v___pyx_type, __pyx_v___pyx_checksum, __pyx_v___pyx_state); + + /* 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_15View_dot_MemoryView___pyx_unpickle_Enum(CYTHON_UNUSED PyObject *__pyx_self, PyObject *__pyx_v___pyx_type, long __pyx_v___pyx_checksum, PyObject *__pyx_v___pyx_state) { + PyObject *__pyx_v___pyx_result = 0; + 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_t_5; + int __pyx_lineno = 0; + const char *__pyx_filename = NULL; + int __pyx_clineno = 0; + __Pyx_RefNannySetupContext("__pyx_unpickle_Enum", 0); + + /* "(tree fragment)":6 + * def __pyx_unpickle_Enum(__pyx_type, long __pyx_checksum, tuple __pyx_state): + * cdef object __pyx_result + * __Pyx_CheckUnpickleChecksum(__pyx_checksum, 0x82a3537, 0x6ae9995, 0xb068931, b'name') # <<<<<<<<<<<<<< + * __pyx_result = Enum.__new__(__pyx_type) + * if __pyx_state is not None: +*/ + __pyx_t_1 = __Pyx_CheckUnpickleChecksum(__pyx_v___pyx_checksum, 0x82a3537, 0x6ae9995, 0xb068931, ((char const *)"name")); if (unlikely(__pyx_t_1 == ((int)-1))) __PYX_ERR(1, 6, __pyx_L1_error) + + /* "(tree fragment)":7 + * cdef object __pyx_result + * __Pyx_CheckUnpickleChecksum(__pyx_checksum, 0x82a3537, 0x6ae9995, 0xb068931, b'name') + * __pyx_result = Enum.__new__(__pyx_type) # <<<<<<<<<<<<<< + * if __pyx_state is not None: + * __pyx_unpickle_Enum__set_state( __pyx_result, __pyx_state) +*/ + __pyx_t_3 = ((PyObject *)__pyx_mstate_global->__pyx_MemviewEnum_type); + __Pyx_INCREF(__pyx_t_3); + __pyx_t_4 = 0; + { + PyObject *__pyx_callargs[2] = {__pyx_t_3, __pyx_v___pyx_type}; + __pyx_t_2 = __Pyx_PyObject_FastCallMethod((PyObject*)__pyx_mstate_global->__pyx_n_u_new, __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_2)) __PYX_ERR(1, 7, __pyx_L1_error) + __Pyx_GOTREF(__pyx_t_2); + } + __pyx_v___pyx_result = __pyx_t_2; + __pyx_t_2 = 0; + + /* "(tree fragment)":8 + * __Pyx_CheckUnpickleChecksum(__pyx_checksum, 0x82a3537, 0x6ae9995, 0xb068931, b'name') + * __pyx_result = Enum.__new__(__pyx_type) + * if __pyx_state is not None: # <<<<<<<<<<<<<< + * __pyx_unpickle_Enum__set_state( __pyx_result, __pyx_state) + * return __pyx_result +*/ + __pyx_t_5 = (__pyx_v___pyx_state != ((PyObject*)Py_None)); + if (__pyx_t_5) { + + /* "(tree fragment)":9 + * __pyx_result = Enum.__new__(__pyx_type) + * if __pyx_state is not None: + * __pyx_unpickle_Enum__set_state( __pyx_result, __pyx_state) # <<<<<<<<<<<<<< + * return __pyx_result + * cdef __pyx_unpickle_Enum__set_state(Enum __pyx_result, __pyx_state: tuple): +*/ + if (unlikely(__pyx_v___pyx_state == Py_None)) { + PyErr_SetString(PyExc_TypeError, "cannot pass None into a C function argument that is declared 'not None'"); + __PYX_ERR(1, 9, __pyx_L1_error) + } + __pyx_t_2 = __pyx_unpickle_Enum__set_state(((struct __pyx_MemviewEnum_obj *)__pyx_v___pyx_result), __pyx_v___pyx_state); if (unlikely(!__pyx_t_2)) __PYX_ERR(1, 9, __pyx_L1_error) + __Pyx_GOTREF(__pyx_t_2); + __Pyx_DECREF(__pyx_t_2); __pyx_t_2 = 0; + + /* "(tree fragment)":8 + * __Pyx_CheckUnpickleChecksum(__pyx_checksum, 0x82a3537, 0x6ae9995, 0xb068931, b'name') + * __pyx_result = Enum.__new__(__pyx_type) + * if __pyx_state is not None: # <<<<<<<<<<<<<< + * __pyx_unpickle_Enum__set_state( __pyx_result, __pyx_state) + * return __pyx_result +*/ + } + + /* "(tree fragment)":10 + * if __pyx_state is not None: + * __pyx_unpickle_Enum__set_state( __pyx_result, __pyx_state) + * return __pyx_result # <<<<<<<<<<<<<< + * cdef __pyx_unpickle_Enum__set_state(Enum __pyx_result, __pyx_state: tuple): + * __pyx_result.name = __pyx_state[0] +*/ + __Pyx_XDECREF(__pyx_r); + __Pyx_INCREF(__pyx_v___pyx_result); + __pyx_r = __pyx_v___pyx_result; + goto __pyx_L0; + + /* "(tree fragment)":4 + * int __Pyx_CheckUnpickleChecksum(long, long, long, long, const char*) except -1 + * int __Pyx_UpdateUnpickledDict(object, object, Py_ssize_t) except -1 + * def __pyx_unpickle_Enum(__pyx_type, long __pyx_checksum, tuple __pyx_state): # <<<<<<<<<<<<<< + * cdef object __pyx_result + * __Pyx_CheckUnpickleChecksum(__pyx_checksum, 0x82a3537, 0x6ae9995, 0xb068931, b'name') +*/ + + /* function exit code */ + __pyx_L1_error:; + __Pyx_XDECREF(__pyx_t_2); + __Pyx_XDECREF(__pyx_t_3); + __Pyx_AddTraceback("View.MemoryView.__pyx_unpickle_Enum", __pyx_clineno, __pyx_lineno, __pyx_filename); + __pyx_r = NULL; + __pyx_L0:; + __Pyx_XDECREF(__pyx_v___pyx_result); + __Pyx_XGIVEREF(__pyx_r); + __Pyx_RefNannyFinishContext(); + return __pyx_r; +} + +/* "(tree fragment)":11 + * __pyx_unpickle_Enum__set_state( __pyx_result, __pyx_state) + * return __pyx_result + * cdef __pyx_unpickle_Enum__set_state(Enum __pyx_result, __pyx_state: tuple): # <<<<<<<<<<<<<< + * __pyx_result.name = __pyx_state[0] + * __Pyx_UpdateUnpickledDict(__pyx_result, __pyx_state, 1) +*/ + +static PyObject *__pyx_unpickle_Enum__set_state(struct __pyx_MemviewEnum_obj *__pyx_v___pyx_result, PyObject *__pyx_v___pyx_state) { + PyObject *__pyx_r = NULL; + __Pyx_RefNannyDeclarations + PyObject *__pyx_t_1 = NULL; + int __pyx_t_2; + int __pyx_lineno = 0; + const char *__pyx_filename = NULL; + int __pyx_clineno = 0; + __Pyx_RefNannySetupContext("__pyx_unpickle_Enum__set_state", 0); + + /* "(tree fragment)":12 + * return __pyx_result + * cdef __pyx_unpickle_Enum__set_state(Enum __pyx_result, __pyx_state: tuple): + * __pyx_result.name = __pyx_state[0] # <<<<<<<<<<<<<< + * __Pyx_UpdateUnpickledDict(__pyx_result, __pyx_state, 1) +*/ + __pyx_t_1 = __Pyx_GetItemInt_Tuple(__pyx_v___pyx_state, 0, long, 1, __Pyx_PyLong_From_long, 0, 0, 1, 1, __Pyx_ReferenceSharing_FunctionArgument); if (unlikely(!__pyx_t_1)) __PYX_ERR(1, 12, __pyx_L1_error) + __Pyx_GOTREF(__pyx_t_1); + __Pyx_GIVEREF(__pyx_t_1); + __Pyx_GOTREF(__pyx_v___pyx_result->name); + __Pyx_DECREF(__pyx_v___pyx_result->name); + __pyx_v___pyx_result->name = __pyx_t_1; + __pyx_t_1 = 0; + + /* "(tree fragment)":13 + * cdef __pyx_unpickle_Enum__set_state(Enum __pyx_result, __pyx_state: tuple): + * __pyx_result.name = __pyx_state[0] + * __Pyx_UpdateUnpickledDict(__pyx_result, __pyx_state, 1) # <<<<<<<<<<<<<< +*/ + __pyx_t_2 = __Pyx_UpdateUnpickledDict(((PyObject *)__pyx_v___pyx_result), __pyx_v___pyx_state, 1); if (unlikely(__pyx_t_2 == ((int)-1))) __PYX_ERR(1, 13, __pyx_L1_error) + + /* "(tree fragment)":11 + * __pyx_unpickle_Enum__set_state( __pyx_result, __pyx_state) + * return __pyx_result + * cdef __pyx_unpickle_Enum__set_state(Enum __pyx_result, __pyx_state: tuple): # <<<<<<<<<<<<<< + * __pyx_result.name = __pyx_state[0] + * __Pyx_UpdateUnpickledDict(__pyx_result, __pyx_state, 1) +*/ + + /* function exit code */ + __pyx_r = Py_None; __Pyx_INCREF(Py_None); + goto __pyx_L0; + __pyx_L1_error:; + __Pyx_XDECREF(__pyx_t_1); + __Pyx_AddTraceback("View.MemoryView.__pyx_unpickle_Enum__set_state", __pyx_clineno, __pyx_lineno, __pyx_filename); + __pyx_r = 0; + __pyx_L0:; + __Pyx_XGIVEREF(__pyx_r); + __Pyx_RefNannyFinishContext(); + return __pyx_r; +} + +/* "C:/Users/runneradmin/AppData/Local/Temp/build-env-ej_q3m8u/Lib/site-packages/numpy/__init__.cython-30.pxd":242 + * cdef int type_num + * + * @property # <<<<<<<<<<<<<< + * cdef inline npy_intp itemsize(self) noexcept nogil: + * return PyDataType_ELSIZE(self) +*/ + +static CYTHON_INLINE npy_intp __pyx_f_5numpy_5dtype_8itemsize_itemsize(PyArray_Descr *__pyx_v_self) { + npy_intp __pyx_r; + + /* "C:/Users/runneradmin/AppData/Local/Temp/build-env-ej_q3m8u/Lib/site-packages/numpy/__init__.cython-30.pxd":244 + * @property + * cdef inline npy_intp itemsize(self) noexcept nogil: + * return PyDataType_ELSIZE(self) # <<<<<<<<<<<<<< + * + * @property +*/ + __pyx_r = PyDataType_ELSIZE(__pyx_v_self); + goto __pyx_L0; + + /* "C:/Users/runneradmin/AppData/Local/Temp/build-env-ej_q3m8u/Lib/site-packages/numpy/__init__.cython-30.pxd":242 + * cdef int type_num + * + * @property # <<<<<<<<<<<<<< + * cdef inline npy_intp itemsize(self) noexcept nogil: + * return PyDataType_ELSIZE(self) +*/ + + /* function exit code */ + __pyx_L0:; + return __pyx_r; +} + +/* "C:/Users/runneradmin/AppData/Local/Temp/build-env-ej_q3m8u/Lib/site-packages/numpy/__init__.cython-30.pxd":246 + * return PyDataType_ELSIZE(self) + * + * @property # <<<<<<<<<<<<<< + * cdef inline npy_intp alignment(self) noexcept nogil: + * return PyDataType_ALIGNMENT(self) +*/ + +static CYTHON_INLINE npy_intp __pyx_f_5numpy_5dtype_9alignment_alignment(PyArray_Descr *__pyx_v_self) { + npy_intp __pyx_r; + + /* "C:/Users/runneradmin/AppData/Local/Temp/build-env-ej_q3m8u/Lib/site-packages/numpy/__init__.cython-30.pxd":248 + * @property + * cdef inline npy_intp alignment(self) noexcept nogil: + * return PyDataType_ALIGNMENT(self) # <<<<<<<<<<<<<< + * + * # Use fields/names with care as they may be NULL. You must check +*/ + __pyx_r = PyDataType_ALIGNMENT(__pyx_v_self); + goto __pyx_L0; + + /* "C:/Users/runneradmin/AppData/Local/Temp/build-env-ej_q3m8u/Lib/site-packages/numpy/__init__.cython-30.pxd":246 + * return PyDataType_ELSIZE(self) + * + * @property # <<<<<<<<<<<<<< + * cdef inline npy_intp alignment(self) noexcept nogil: + * return PyDataType_ALIGNMENT(self) +*/ + + /* function exit code */ + __pyx_L0:; + return __pyx_r; +} + +/* "C:/Users/runneradmin/AppData/Local/Temp/build-env-ej_q3m8u/Lib/site-packages/numpy/__init__.cython-30.pxd":252 + * # Use fields/names with care as they may be NULL. You must check + * # for this using PyDataType_HASFIELDS. + * @property # <<<<<<<<<<<<<< + * cdef inline object fields(self): + * return PyDataType_FIELDS(self) +*/ + +static CYTHON_INLINE PyObject *__pyx_f_5numpy_5dtype_6fields_fields(PyArray_Descr *__pyx_v_self) { + PyObject *__pyx_r = NULL; + __Pyx_RefNannyDeclarations + PyObject *__pyx_t_1; + __Pyx_RefNannySetupContext("fields", 0); + + /* "C:/Users/runneradmin/AppData/Local/Temp/build-env-ej_q3m8u/Lib/site-packages/numpy/__init__.cython-30.pxd":254 + * @property + * cdef inline object fields(self): + * return PyDataType_FIELDS(self) # <<<<<<<<<<<<<< + * + * @property +*/ + __Pyx_XDECREF(__pyx_r); + __pyx_t_1 = PyDataType_FIELDS(__pyx_v_self); + __Pyx_INCREF(((PyObject *)__pyx_t_1)); + __pyx_r = ((PyObject *)__pyx_t_1); + goto __pyx_L0; + + /* "C:/Users/runneradmin/AppData/Local/Temp/build-env-ej_q3m8u/Lib/site-packages/numpy/__init__.cython-30.pxd":252 + * # Use fields/names with care as they may be NULL. You must check + * # for this using PyDataType_HASFIELDS. + * @property # <<<<<<<<<<<<<< + * cdef inline object fields(self): + * return PyDataType_FIELDS(self) +*/ + + /* function exit code */ + __pyx_L0:; + __Pyx_XGIVEREF(__pyx_r); + __Pyx_RefNannyFinishContext(); + return __pyx_r; +} + +/* "C:/Users/runneradmin/AppData/Local/Temp/build-env-ej_q3m8u/Lib/site-packages/numpy/__init__.cython-30.pxd":256 + * return PyDataType_FIELDS(self) + * + * @property # <<<<<<<<<<<<<< + * cdef inline tuple names(self): + * return PyDataType_NAMES(self) +*/ + +static CYTHON_INLINE PyObject *__pyx_f_5numpy_5dtype_5names_names(PyArray_Descr *__pyx_v_self) { + PyObject *__pyx_r = NULL; + __Pyx_RefNannyDeclarations + PyObject *__pyx_t_1; + __Pyx_RefNannySetupContext("names", 0); + + /* "C:/Users/runneradmin/AppData/Local/Temp/build-env-ej_q3m8u/Lib/site-packages/numpy/__init__.cython-30.pxd":258 + * @property + * cdef inline tuple names(self): + * return PyDataType_NAMES(self) # <<<<<<<<<<<<<< + * + * # Use PyDataType_HASSUBARRAY to test whether this field is +*/ + __Pyx_XDECREF(__pyx_r); + __pyx_t_1 = PyDataType_NAMES(__pyx_v_self); + __Pyx_INCREF(((PyObject*)__pyx_t_1)); + __pyx_r = ((PyObject*)__pyx_t_1); + goto __pyx_L0; + + /* "C:/Users/runneradmin/AppData/Local/Temp/build-env-ej_q3m8u/Lib/site-packages/numpy/__init__.cython-30.pxd":256 + * return PyDataType_FIELDS(self) + * + * @property # <<<<<<<<<<<<<< + * cdef inline tuple names(self): + * return PyDataType_NAMES(self) +*/ + + /* function exit code */ + __pyx_L0:; + __Pyx_XGIVEREF(__pyx_r); + __Pyx_RefNannyFinishContext(); + return __pyx_r; +} + +/* "C:/Users/runneradmin/AppData/Local/Temp/build-env-ej_q3m8u/Lib/site-packages/numpy/__init__.cython-30.pxd":263 + * # valid (the pointer can be NULL). Most users should access + * # this field via the inline helper method PyDataType_SHAPE. + * @property # <<<<<<<<<<<<<< + * cdef inline PyArray_ArrayDescr* subarray(self) noexcept nogil: + * return PyDataType_SUBARRAY(self) +*/ + +static CYTHON_INLINE PyArray_ArrayDescr *__pyx_f_5numpy_5dtype_8subarray_subarray(PyArray_Descr *__pyx_v_self) { + PyArray_ArrayDescr *__pyx_r; + + /* "C:/Users/runneradmin/AppData/Local/Temp/build-env-ej_q3m8u/Lib/site-packages/numpy/__init__.cython-30.pxd":265 + * @property + * cdef inline PyArray_ArrayDescr* subarray(self) noexcept nogil: + * return PyDataType_SUBARRAY(self) # <<<<<<<<<<<<<< + * + * @property +*/ + __pyx_r = PyDataType_SUBARRAY(__pyx_v_self); + goto __pyx_L0; + + /* "C:/Users/runneradmin/AppData/Local/Temp/build-env-ej_q3m8u/Lib/site-packages/numpy/__init__.cython-30.pxd":263 + * # valid (the pointer can be NULL). Most users should access + * # this field via the inline helper method PyDataType_SHAPE. + * @property # <<<<<<<<<<<<<< + * cdef inline PyArray_ArrayDescr* subarray(self) noexcept nogil: + * return PyDataType_SUBARRAY(self) +*/ + + /* function exit code */ + __pyx_L0:; + return __pyx_r; +} + +/* "C:/Users/runneradmin/AppData/Local/Temp/build-env-ej_q3m8u/Lib/site-packages/numpy/__init__.cython-30.pxd":267 + * return PyDataType_SUBARRAY(self) + * + * @property # <<<<<<<<<<<<<< + * cdef inline npy_uint64 flags(self) noexcept nogil: + * """The data types flags.""" +*/ + +static CYTHON_INLINE npy_uint64 __pyx_f_5numpy_5dtype_5flags_flags(PyArray_Descr *__pyx_v_self) { + npy_uint64 __pyx_r; + + /* "C:/Users/runneradmin/AppData/Local/Temp/build-env-ej_q3m8u/Lib/site-packages/numpy/__init__.cython-30.pxd":270 + * cdef inline npy_uint64 flags(self) noexcept nogil: + * """The data types flags.""" + * return PyDataType_FLAGS(self) # <<<<<<<<<<<<<< + * + * +*/ + __pyx_r = PyDataType_FLAGS(__pyx_v_self); + goto __pyx_L0; + + /* "C:/Users/runneradmin/AppData/Local/Temp/build-env-ej_q3m8u/Lib/site-packages/numpy/__init__.cython-30.pxd":267 + * return PyDataType_SUBARRAY(self) + * + * @property # <<<<<<<<<<<<<< + * cdef inline npy_uint64 flags(self) noexcept nogil: + * """The data types flags.""" +*/ + + /* function exit code */ + __pyx_L0:; + return __pyx_r; +} + +/* "C:/Users/runneradmin/AppData/Local/Temp/build-env-ej_q3m8u/Lib/site-packages/numpy/__init__.cython-30.pxd":279 + * ctypedef class numpy.broadcast [object PyArrayMultiIterObject, check_size ignore]: + * + * @property # <<<<<<<<<<<<<< + * cdef inline int numiter(self) noexcept nogil: + * """The number of arrays that need to be broadcast to the same shape.""" +*/ + +static CYTHON_INLINE int __pyx_f_5numpy_9broadcast_7numiter_numiter(PyArrayMultiIterObject *__pyx_v_self) { + int __pyx_r; + + /* "C:/Users/runneradmin/AppData/Local/Temp/build-env-ej_q3m8u/Lib/site-packages/numpy/__init__.cython-30.pxd":282 + * cdef inline int numiter(self) noexcept nogil: + * """The number of arrays that need to be broadcast to the same shape.""" + * return PyArray_MultiIter_NUMITER(self) # <<<<<<<<<<<<<< + * + * @property +*/ + __pyx_r = PyArray_MultiIter_NUMITER(__pyx_v_self); + goto __pyx_L0; + + /* "C:/Users/runneradmin/AppData/Local/Temp/build-env-ej_q3m8u/Lib/site-packages/numpy/__init__.cython-30.pxd":279 + * ctypedef class numpy.broadcast [object PyArrayMultiIterObject, check_size ignore]: + * + * @property # <<<<<<<<<<<<<< + * cdef inline int numiter(self) noexcept nogil: + * """The number of arrays that need to be broadcast to the same shape.""" +*/ + + /* function exit code */ + __pyx_L0:; + return __pyx_r; +} + +/* "C:/Users/runneradmin/AppData/Local/Temp/build-env-ej_q3m8u/Lib/site-packages/numpy/__init__.cython-30.pxd":284 + * return PyArray_MultiIter_NUMITER(self) + * + * @property # <<<<<<<<<<<<<< + * cdef inline npy_intp size(self) noexcept nogil: + * """The total broadcasted size.""" +*/ + +static CYTHON_INLINE npy_intp __pyx_f_5numpy_9broadcast_4size_size(PyArrayMultiIterObject *__pyx_v_self) { + npy_intp __pyx_r; + + /* "C:/Users/runneradmin/AppData/Local/Temp/build-env-ej_q3m8u/Lib/site-packages/numpy/__init__.cython-30.pxd":287 + * cdef inline npy_intp size(self) noexcept nogil: + * """The total broadcasted size.""" + * return PyArray_MultiIter_SIZE(self) # <<<<<<<<<<<<<< + * + * @property +*/ + __pyx_r = PyArray_MultiIter_SIZE(__pyx_v_self); + goto __pyx_L0; + + /* "C:/Users/runneradmin/AppData/Local/Temp/build-env-ej_q3m8u/Lib/site-packages/numpy/__init__.cython-30.pxd":284 + * return PyArray_MultiIter_NUMITER(self) + * + * @property # <<<<<<<<<<<<<< + * cdef inline npy_intp size(self) noexcept nogil: + * """The total broadcasted size.""" +*/ + + /* function exit code */ + __pyx_L0:; + return __pyx_r; +} + +/* "C:/Users/runneradmin/AppData/Local/Temp/build-env-ej_q3m8u/Lib/site-packages/numpy/__init__.cython-30.pxd":289 + * return PyArray_MultiIter_SIZE(self) + * + * @property # <<<<<<<<<<<<<< + * cdef inline npy_intp index(self) noexcept nogil: + * """The current (1-d) index into the broadcasted result.""" +*/ + +static CYTHON_INLINE npy_intp __pyx_f_5numpy_9broadcast_5index_index(PyArrayMultiIterObject *__pyx_v_self) { + npy_intp __pyx_r; + + /* "C:/Users/runneradmin/AppData/Local/Temp/build-env-ej_q3m8u/Lib/site-packages/numpy/__init__.cython-30.pxd":292 + * cdef inline npy_intp index(self) noexcept nogil: + * """The current (1-d) index into the broadcasted result.""" + * return PyArray_MultiIter_INDEX(self) # <<<<<<<<<<<<<< + * + * @property +*/ + __pyx_r = PyArray_MultiIter_INDEX(__pyx_v_self); + goto __pyx_L0; + + /* "C:/Users/runneradmin/AppData/Local/Temp/build-env-ej_q3m8u/Lib/site-packages/numpy/__init__.cython-30.pxd":289 + * return PyArray_MultiIter_SIZE(self) + * + * @property # <<<<<<<<<<<<<< + * cdef inline npy_intp index(self) noexcept nogil: + * """The current (1-d) index into the broadcasted result.""" +*/ + + /* function exit code */ + __pyx_L0:; + return __pyx_r; +} + +/* "C:/Users/runneradmin/AppData/Local/Temp/build-env-ej_q3m8u/Lib/site-packages/numpy/__init__.cython-30.pxd":294 + * return PyArray_MultiIter_INDEX(self) + * + * @property # <<<<<<<<<<<<<< + * cdef inline int nd(self) noexcept nogil: + * """The number of dimensions in the broadcasted result.""" +*/ + +static CYTHON_INLINE int __pyx_f_5numpy_9broadcast_2nd_nd(PyArrayMultiIterObject *__pyx_v_self) { + int __pyx_r; + + /* "C:/Users/runneradmin/AppData/Local/Temp/build-env-ej_q3m8u/Lib/site-packages/numpy/__init__.cython-30.pxd":297 + * cdef inline int nd(self) noexcept nogil: + * """The number of dimensions in the broadcasted result.""" + * return PyArray_MultiIter_NDIM(self) # <<<<<<<<<<<<<< + * + * @property +*/ + __pyx_r = PyArray_MultiIter_NDIM(__pyx_v_self); + goto __pyx_L0; + + /* "C:/Users/runneradmin/AppData/Local/Temp/build-env-ej_q3m8u/Lib/site-packages/numpy/__init__.cython-30.pxd":294 + * return PyArray_MultiIter_INDEX(self) + * + * @property # <<<<<<<<<<<<<< + * cdef inline int nd(self) noexcept nogil: + * """The number of dimensions in the broadcasted result.""" +*/ + + /* function exit code */ + __pyx_L0:; + return __pyx_r; +} + +/* "C:/Users/runneradmin/AppData/Local/Temp/build-env-ej_q3m8u/Lib/site-packages/numpy/__init__.cython-30.pxd":299 + * return PyArray_MultiIter_NDIM(self) + * + * @property # <<<<<<<<<<<<<< + * cdef inline npy_intp* dimensions(self) noexcept nogil: + * """The shape of the broadcasted result.""" +*/ + +static CYTHON_INLINE npy_intp *__pyx_f_5numpy_9broadcast_10dimensions_dimensions(PyArrayMultiIterObject *__pyx_v_self) { + npy_intp *__pyx_r; + + /* "C:/Users/runneradmin/AppData/Local/Temp/build-env-ej_q3m8u/Lib/site-packages/numpy/__init__.cython-30.pxd":302 + * cdef inline npy_intp* dimensions(self) noexcept nogil: + * """The shape of the broadcasted result.""" + * return PyArray_MultiIter_DIMS(self) # <<<<<<<<<<<<<< + * + * @property +*/ + __pyx_r = PyArray_MultiIter_DIMS(__pyx_v_self); + goto __pyx_L0; + + /* "C:/Users/runneradmin/AppData/Local/Temp/build-env-ej_q3m8u/Lib/site-packages/numpy/__init__.cython-30.pxd":299 + * return PyArray_MultiIter_NDIM(self) + * + * @property # <<<<<<<<<<<<<< + * cdef inline npy_intp* dimensions(self) noexcept nogil: + * """The shape of the broadcasted result.""" +*/ + + /* function exit code */ + __pyx_L0:; + return __pyx_r; +} + +/* "C:/Users/runneradmin/AppData/Local/Temp/build-env-ej_q3m8u/Lib/site-packages/numpy/__init__.cython-30.pxd":304 + * return PyArray_MultiIter_DIMS(self) + * + * @property # <<<<<<<<<<<<<< + * cdef inline void** iters(self) noexcept nogil: + * """An array of iterator objects that holds the iterators for the arrays to be broadcast together. +*/ + +static CYTHON_INLINE void **__pyx_f_5numpy_9broadcast_5iters_iters(PyArrayMultiIterObject *__pyx_v_self) { + void **__pyx_r; + + /* "C:/Users/runneradmin/AppData/Local/Temp/build-env-ej_q3m8u/Lib/site-packages/numpy/__init__.cython-30.pxd":308 + * """An array of iterator objects that holds the iterators for the arrays to be broadcast together. + * On return, the iterators are adjusted for broadcasting.""" + * return PyArray_MultiIter_ITERS(self) # <<<<<<<<<<<<<< + * + * +*/ + __pyx_r = PyArray_MultiIter_ITERS(__pyx_v_self); + goto __pyx_L0; + + /* "C:/Users/runneradmin/AppData/Local/Temp/build-env-ej_q3m8u/Lib/site-packages/numpy/__init__.cython-30.pxd":304 + * return PyArray_MultiIter_DIMS(self) + * + * @property # <<<<<<<<<<<<<< + * cdef inline void** iters(self) noexcept nogil: + * """An array of iterator objects that holds the iterators for the arrays to be broadcast together. +*/ + + /* function exit code */ + __pyx_L0:; + return __pyx_r; +} + +/* "C:/Users/runneradmin/AppData/Local/Temp/build-env-ej_q3m8u/Lib/site-packages/numpy/__init__.cython-30.pxd":322 + * # Instead, we use properties that map to the corresponding C-API functions. + * + * @property # <<<<<<<<<<<<<< + * cdef inline PyObject* base(self) noexcept nogil: + * """Returns a borrowed reference to the object owning the data/memory. +*/ + +static CYTHON_INLINE PyObject *__pyx_f_5numpy_7ndarray_4base_base(PyArrayObject *__pyx_v_self) { + PyObject *__pyx_r; + + /* "C:/Users/runneradmin/AppData/Local/Temp/build-env-ej_q3m8u/Lib/site-packages/numpy/__init__.cython-30.pxd":326 + * """Returns a borrowed reference to the object owning the data/memory. + * """ + * return PyArray_BASE(self) # <<<<<<<<<<<<<< + * + * @property +*/ + __pyx_r = PyArray_BASE(__pyx_v_self); + goto __pyx_L0; + + /* "C:/Users/runneradmin/AppData/Local/Temp/build-env-ej_q3m8u/Lib/site-packages/numpy/__init__.cython-30.pxd":322 + * # Instead, we use properties that map to the corresponding C-API functions. + * + * @property # <<<<<<<<<<<<<< + * cdef inline PyObject* base(self) noexcept nogil: + * """Returns a borrowed reference to the object owning the data/memory. +*/ + + /* function exit code */ + __pyx_L0:; + return __pyx_r; +} + +/* "C:/Users/runneradmin/AppData/Local/Temp/build-env-ej_q3m8u/Lib/site-packages/numpy/__init__.cython-30.pxd":328 + * return PyArray_BASE(self) + * + * @property # <<<<<<<<<<<<<< + * cdef inline dtype descr(self): + * """Returns an owned reference to the dtype of the array. +*/ + +static CYTHON_INLINE PyArray_Descr *__pyx_f_5numpy_7ndarray_5descr_descr(PyArrayObject *__pyx_v_self) { + PyArray_Descr *__pyx_r = NULL; + __Pyx_RefNannyDeclarations + PyArray_Descr *__pyx_t_1; + __Pyx_RefNannySetupContext("descr", 0); + + /* "C:/Users/runneradmin/AppData/Local/Temp/build-env-ej_q3m8u/Lib/site-packages/numpy/__init__.cython-30.pxd":332 + * """Returns an owned reference to the dtype of the array. + * """ + * return PyArray_DESCR(self) # <<<<<<<<<<<<<< + * + * @property +*/ + __Pyx_XDECREF((PyObject *)__pyx_r); + __pyx_t_1 = PyArray_DESCR(__pyx_v_self); + __Pyx_INCREF((PyObject *)((PyArray_Descr *)__pyx_t_1)); + __pyx_r = ((PyArray_Descr *)__pyx_t_1); + goto __pyx_L0; + + /* "C:/Users/runneradmin/AppData/Local/Temp/build-env-ej_q3m8u/Lib/site-packages/numpy/__init__.cython-30.pxd":328 + * return PyArray_BASE(self) + * + * @property # <<<<<<<<<<<<<< + * cdef inline dtype descr(self): + * """Returns an owned reference to the dtype of the array. +*/ + + /* function exit code */ + __pyx_L0:; + __Pyx_XGIVEREF((PyObject *)__pyx_r); + __Pyx_RefNannyFinishContext(); + return __pyx_r; +} + +/* "C:/Users/runneradmin/AppData/Local/Temp/build-env-ej_q3m8u/Lib/site-packages/numpy/__init__.cython-30.pxd":334 + * return PyArray_DESCR(self) + * + * @property # <<<<<<<<<<<<<< + * cdef inline int ndim(self) noexcept nogil: + * """Returns the number of dimensions in the array. +*/ + +static CYTHON_INLINE int __pyx_f_5numpy_7ndarray_4ndim_ndim(PyArrayObject *__pyx_v_self) { + int __pyx_r; + + /* "C:/Users/runneradmin/AppData/Local/Temp/build-env-ej_q3m8u/Lib/site-packages/numpy/__init__.cython-30.pxd":338 + * """Returns the number of dimensions in the array. + * """ + * return PyArray_NDIM(self) # <<<<<<<<<<<<<< + * + * @property +*/ + __pyx_r = PyArray_NDIM(__pyx_v_self); + goto __pyx_L0; + + /* "C:/Users/runneradmin/AppData/Local/Temp/build-env-ej_q3m8u/Lib/site-packages/numpy/__init__.cython-30.pxd":334 + * return PyArray_DESCR(self) + * + * @property # <<<<<<<<<<<<<< + * cdef inline int ndim(self) noexcept nogil: + * """Returns the number of dimensions in the array. +*/ + + /* function exit code */ + __pyx_L0:; + return __pyx_r; +} + +/* "C:/Users/runneradmin/AppData/Local/Temp/build-env-ej_q3m8u/Lib/site-packages/numpy/__init__.cython-30.pxd":340 + * return PyArray_NDIM(self) + * + * @property # <<<<<<<<<<<<<< + * cdef inline npy_intp *shape(self) noexcept nogil: + * """Returns a pointer to the dimensions/shape of the array. +*/ + +static CYTHON_INLINE npy_intp *__pyx_f_5numpy_7ndarray_5shape_shape(PyArrayObject *__pyx_v_self) { + npy_intp *__pyx_r; + + /* "C:/Users/runneradmin/AppData/Local/Temp/build-env-ej_q3m8u/Lib/site-packages/numpy/__init__.cython-30.pxd":346 + * Can return NULL for 0-dimensional arrays. + * """ + * return PyArray_DIMS(self) # <<<<<<<<<<<<<< + * + * @property +*/ + __pyx_r = PyArray_DIMS(__pyx_v_self); + goto __pyx_L0; + + /* "C:/Users/runneradmin/AppData/Local/Temp/build-env-ej_q3m8u/Lib/site-packages/numpy/__init__.cython-30.pxd":340 + * return PyArray_NDIM(self) + * + * @property # <<<<<<<<<<<<<< + * cdef inline npy_intp *shape(self) noexcept nogil: + * """Returns a pointer to the dimensions/shape of the array. +*/ + + /* function exit code */ + __pyx_L0:; + return __pyx_r; +} + +/* "C:/Users/runneradmin/AppData/Local/Temp/build-env-ej_q3m8u/Lib/site-packages/numpy/__init__.cython-30.pxd":348 + * return PyArray_DIMS(self) + * + * @property # <<<<<<<<<<<<<< + * cdef inline npy_intp *strides(self) noexcept nogil: + * """Returns a pointer to the strides of the array. +*/ + +static CYTHON_INLINE npy_intp *__pyx_f_5numpy_7ndarray_7strides_strides(PyArrayObject *__pyx_v_self) { + npy_intp *__pyx_r; + + /* "C:/Users/runneradmin/AppData/Local/Temp/build-env-ej_q3m8u/Lib/site-packages/numpy/__init__.cython-30.pxd":353 + * The number of elements matches the number of dimensions of the array (ndim). + * """ + * return PyArray_STRIDES(self) # <<<<<<<<<<<<<< + * + * @property +*/ + __pyx_r = PyArray_STRIDES(__pyx_v_self); + goto __pyx_L0; + + /* "C:/Users/runneradmin/AppData/Local/Temp/build-env-ej_q3m8u/Lib/site-packages/numpy/__init__.cython-30.pxd":348 + * return PyArray_DIMS(self) + * + * @property # <<<<<<<<<<<<<< + * cdef inline npy_intp *strides(self) noexcept nogil: + * """Returns a pointer to the strides of the array. +*/ + + /* function exit code */ + __pyx_L0:; + return __pyx_r; +} + +/* "C:/Users/runneradmin/AppData/Local/Temp/build-env-ej_q3m8u/Lib/site-packages/numpy/__init__.cython-30.pxd":355 + * return PyArray_STRIDES(self) + * + * @property # <<<<<<<<<<<<<< + * cdef inline npy_intp size(self) noexcept nogil: + * """Returns the total size (in number of elements) of the array. +*/ + +static CYTHON_INLINE npy_intp __pyx_f_5numpy_7ndarray_4size_size(PyArrayObject *__pyx_v_self) { + npy_intp __pyx_r; + + /* "C:/Users/runneradmin/AppData/Local/Temp/build-env-ej_q3m8u/Lib/site-packages/numpy/__init__.cython-30.pxd":359 + * """Returns the total size (in number of elements) of the array. + * """ + * return PyArray_SIZE(self) # <<<<<<<<<<<<<< + * + * @property +*/ + __pyx_r = PyArray_SIZE(__pyx_v_self); + goto __pyx_L0; + + /* "C:/Users/runneradmin/AppData/Local/Temp/build-env-ej_q3m8u/Lib/site-packages/numpy/__init__.cython-30.pxd":355 + * return PyArray_STRIDES(self) + * + * @property # <<<<<<<<<<<<<< + * cdef inline npy_intp size(self) noexcept nogil: + * """Returns the total size (in number of elements) of the array. +*/ + + /* function exit code */ + __pyx_L0:; + return __pyx_r; +} + +/* "C:/Users/runneradmin/AppData/Local/Temp/build-env-ej_q3m8u/Lib/site-packages/numpy/__init__.cython-30.pxd":361 + * return PyArray_SIZE(self) + * + * @property # <<<<<<<<<<<<<< + * cdef inline char* data(self) noexcept nogil: + * """The pointer to the data buffer as a char*. +*/ + +static CYTHON_INLINE char *__pyx_f_5numpy_7ndarray_4data_data(PyArrayObject *__pyx_v_self) { + char *__pyx_r; + + /* "C:/Users/runneradmin/AppData/Local/Temp/build-env-ej_q3m8u/Lib/site-packages/numpy/__init__.cython-30.pxd":368 + * of `PyArray_DATA()` instead, which returns a 'void*'. + * """ + * return PyArray_BYTES(self) # <<<<<<<<<<<<<< + * + * +*/ + __pyx_r = PyArray_BYTES(__pyx_v_self); + goto __pyx_L0; + + /* "C:/Users/runneradmin/AppData/Local/Temp/build-env-ej_q3m8u/Lib/site-packages/numpy/__init__.cython-30.pxd":361 + * return PyArray_SIZE(self) + * + * @property # <<<<<<<<<<<<<< + * cdef inline char* data(self) noexcept nogil: + * """The pointer to the data buffer as a char*. +*/ + + /* function exit code */ + __pyx_L0:; + return __pyx_r; +} + +/* "C:/Users/runneradmin/AppData/Local/Temp/build-env-ej_q3m8u/Lib/site-packages/numpy/__init__.cython-30.pxd":776 + * ctypedef long double complex clongdouble_t + * + * cdef inline object PyArray_MultiIterNew1(a): # <<<<<<<<<<<<<< + * return PyArray_MultiIterNew(1, a) + * +*/ + +static CYTHON_INLINE PyObject *__pyx_f_5numpy_PyArray_MultiIterNew1(PyObject *__pyx_v_a) { + PyObject *__pyx_r = NULL; + __Pyx_RefNannyDeclarations + PyObject *__pyx_t_1 = NULL; + int __pyx_lineno = 0; + const char *__pyx_filename = NULL; + int __pyx_clineno = 0; + __Pyx_RefNannySetupContext("PyArray_MultiIterNew1", 0); + + /* "C:/Users/runneradmin/AppData/Local/Temp/build-env-ej_q3m8u/Lib/site-packages/numpy/__init__.cython-30.pxd":777 + * + * cdef inline object PyArray_MultiIterNew1(a): + * return PyArray_MultiIterNew(1, a) # <<<<<<<<<<<<<< + * + * cdef inline object PyArray_MultiIterNew2(a, b): +*/ + __Pyx_XDECREF(__pyx_r); + __pyx_t_1 = PyArray_MultiIterNew(1, ((void *)__pyx_v_a)); if (unlikely(!__pyx_t_1)) __PYX_ERR(2, 777, __pyx_L1_error) + __Pyx_GOTREF(__pyx_t_1); + __pyx_r = __pyx_t_1; + __pyx_t_1 = 0; + goto __pyx_L0; + + /* "C:/Users/runneradmin/AppData/Local/Temp/build-env-ej_q3m8u/Lib/site-packages/numpy/__init__.cython-30.pxd":776 + * ctypedef long double complex clongdouble_t + * + * cdef inline object PyArray_MultiIterNew1(a): # <<<<<<<<<<<<<< + * return PyArray_MultiIterNew(1, a) + * +*/ + + /* function exit code */ + __pyx_L1_error:; + __Pyx_XDECREF(__pyx_t_1); + __Pyx_AddTraceback("numpy.PyArray_MultiIterNew1", __pyx_clineno, __pyx_lineno, __pyx_filename); + __pyx_r = 0; + __pyx_L0:; + __Pyx_XGIVEREF(__pyx_r); + __Pyx_RefNannyFinishContext(); + return __pyx_r; +} + +/* "C:/Users/runneradmin/AppData/Local/Temp/build-env-ej_q3m8u/Lib/site-packages/numpy/__init__.cython-30.pxd":779 + * return PyArray_MultiIterNew(1, a) + * + * cdef inline object PyArray_MultiIterNew2(a, b): # <<<<<<<<<<<<<< + * return PyArray_MultiIterNew(2, a, b) + * +*/ + +static CYTHON_INLINE PyObject *__pyx_f_5numpy_PyArray_MultiIterNew2(PyObject *__pyx_v_a, PyObject *__pyx_v_b) { + PyObject *__pyx_r = NULL; + __Pyx_RefNannyDeclarations + PyObject *__pyx_t_1 = NULL; + int __pyx_lineno = 0; + const char *__pyx_filename = NULL; + int __pyx_clineno = 0; + __Pyx_RefNannySetupContext("PyArray_MultiIterNew2", 0); + + /* "C:/Users/runneradmin/AppData/Local/Temp/build-env-ej_q3m8u/Lib/site-packages/numpy/__init__.cython-30.pxd":780 + * + * cdef inline object PyArray_MultiIterNew2(a, b): + * return PyArray_MultiIterNew(2, a, b) # <<<<<<<<<<<<<< + * + * cdef inline object PyArray_MultiIterNew3(a, b, c): +*/ + __Pyx_XDECREF(__pyx_r); + __pyx_t_1 = PyArray_MultiIterNew(2, ((void *)__pyx_v_a), ((void *)__pyx_v_b)); if (unlikely(!__pyx_t_1)) __PYX_ERR(2, 780, __pyx_L1_error) + __Pyx_GOTREF(__pyx_t_1); + __pyx_r = __pyx_t_1; + __pyx_t_1 = 0; + goto __pyx_L0; + + /* "C:/Users/runneradmin/AppData/Local/Temp/build-env-ej_q3m8u/Lib/site-packages/numpy/__init__.cython-30.pxd":779 + * return PyArray_MultiIterNew(1, a) + * + * cdef inline object PyArray_MultiIterNew2(a, b): # <<<<<<<<<<<<<< + * return PyArray_MultiIterNew(2, a, b) + * +*/ + + /* function exit code */ + __pyx_L1_error:; + __Pyx_XDECREF(__pyx_t_1); + __Pyx_AddTraceback("numpy.PyArray_MultiIterNew2", __pyx_clineno, __pyx_lineno, __pyx_filename); + __pyx_r = 0; + __pyx_L0:; + __Pyx_XGIVEREF(__pyx_r); + __Pyx_RefNannyFinishContext(); + return __pyx_r; +} + +/* "C:/Users/runneradmin/AppData/Local/Temp/build-env-ej_q3m8u/Lib/site-packages/numpy/__init__.cython-30.pxd":782 + * return PyArray_MultiIterNew(2, a, b) + * + * cdef inline object PyArray_MultiIterNew3(a, b, c): # <<<<<<<<<<<<<< + * return PyArray_MultiIterNew(3, a, b, c) + * +*/ + +static CYTHON_INLINE PyObject *__pyx_f_5numpy_PyArray_MultiIterNew3(PyObject *__pyx_v_a, PyObject *__pyx_v_b, PyObject *__pyx_v_c) { + PyObject *__pyx_r = NULL; + __Pyx_RefNannyDeclarations + PyObject *__pyx_t_1 = NULL; + int __pyx_lineno = 0; + const char *__pyx_filename = NULL; + int __pyx_clineno = 0; + __Pyx_RefNannySetupContext("PyArray_MultiIterNew3", 0); + + /* "C:/Users/runneradmin/AppData/Local/Temp/build-env-ej_q3m8u/Lib/site-packages/numpy/__init__.cython-30.pxd":783 + * + * cdef inline object PyArray_MultiIterNew3(a, b, c): + * return PyArray_MultiIterNew(3, a, b, c) # <<<<<<<<<<<<<< + * + * cdef inline object PyArray_MultiIterNew4(a, b, c, d): +*/ + __Pyx_XDECREF(__pyx_r); + __pyx_t_1 = PyArray_MultiIterNew(3, ((void *)__pyx_v_a), ((void *)__pyx_v_b), ((void *)__pyx_v_c)); if (unlikely(!__pyx_t_1)) __PYX_ERR(2, 783, __pyx_L1_error) + __Pyx_GOTREF(__pyx_t_1); + __pyx_r = __pyx_t_1; + __pyx_t_1 = 0; + goto __pyx_L0; + + /* "C:/Users/runneradmin/AppData/Local/Temp/build-env-ej_q3m8u/Lib/site-packages/numpy/__init__.cython-30.pxd":782 + * return PyArray_MultiIterNew(2, a, b) + * + * cdef inline object PyArray_MultiIterNew3(a, b, c): # <<<<<<<<<<<<<< + * return PyArray_MultiIterNew(3, a, b, c) + * +*/ + + /* function exit code */ + __pyx_L1_error:; + __Pyx_XDECREF(__pyx_t_1); + __Pyx_AddTraceback("numpy.PyArray_MultiIterNew3", __pyx_clineno, __pyx_lineno, __pyx_filename); + __pyx_r = 0; + __pyx_L0:; + __Pyx_XGIVEREF(__pyx_r); + __Pyx_RefNannyFinishContext(); + return __pyx_r; +} + +/* "C:/Users/runneradmin/AppData/Local/Temp/build-env-ej_q3m8u/Lib/site-packages/numpy/__init__.cython-30.pxd":785 + * return PyArray_MultiIterNew(3, a, b, c) + * + * cdef inline object PyArray_MultiIterNew4(a, b, c, d): # <<<<<<<<<<<<<< + * return PyArray_MultiIterNew(4, a, b, c, d) + * +*/ + +static CYTHON_INLINE PyObject *__pyx_f_5numpy_PyArray_MultiIterNew4(PyObject *__pyx_v_a, PyObject *__pyx_v_b, PyObject *__pyx_v_c, PyObject *__pyx_v_d) { + PyObject *__pyx_r = NULL; + __Pyx_RefNannyDeclarations + PyObject *__pyx_t_1 = NULL; + int __pyx_lineno = 0; + const char *__pyx_filename = NULL; + int __pyx_clineno = 0; + __Pyx_RefNannySetupContext("PyArray_MultiIterNew4", 0); + + /* "C:/Users/runneradmin/AppData/Local/Temp/build-env-ej_q3m8u/Lib/site-packages/numpy/__init__.cython-30.pxd":786 + * + * cdef inline object PyArray_MultiIterNew4(a, b, c, d): + * return PyArray_MultiIterNew(4, a, b, c, d) # <<<<<<<<<<<<<< + * + * cdef inline object PyArray_MultiIterNew5(a, b, c, d, e): +*/ + __Pyx_XDECREF(__pyx_r); + __pyx_t_1 = PyArray_MultiIterNew(4, ((void *)__pyx_v_a), ((void *)__pyx_v_b), ((void *)__pyx_v_c), ((void *)__pyx_v_d)); if (unlikely(!__pyx_t_1)) __PYX_ERR(2, 786, __pyx_L1_error) + __Pyx_GOTREF(__pyx_t_1); + __pyx_r = __pyx_t_1; + __pyx_t_1 = 0; + goto __pyx_L0; + + /* "C:/Users/runneradmin/AppData/Local/Temp/build-env-ej_q3m8u/Lib/site-packages/numpy/__init__.cython-30.pxd":785 + * return PyArray_MultiIterNew(3, a, b, c) + * + * cdef inline object PyArray_MultiIterNew4(a, b, c, d): # <<<<<<<<<<<<<< + * return PyArray_MultiIterNew(4, a, b, c, d) + * +*/ + + /* function exit code */ + __pyx_L1_error:; + __Pyx_XDECREF(__pyx_t_1); + __Pyx_AddTraceback("numpy.PyArray_MultiIterNew4", __pyx_clineno, __pyx_lineno, __pyx_filename); + __pyx_r = 0; + __pyx_L0:; + __Pyx_XGIVEREF(__pyx_r); + __Pyx_RefNannyFinishContext(); + return __pyx_r; +} + +/* "C:/Users/runneradmin/AppData/Local/Temp/build-env-ej_q3m8u/Lib/site-packages/numpy/__init__.cython-30.pxd":788 + * return PyArray_MultiIterNew(4, a, b, c, d) + * + * cdef inline object PyArray_MultiIterNew5(a, b, c, d, e): # <<<<<<<<<<<<<< + * return PyArray_MultiIterNew(5, a, b, c, d, e) + * +*/ + +static CYTHON_INLINE PyObject *__pyx_f_5numpy_PyArray_MultiIterNew5(PyObject *__pyx_v_a, PyObject *__pyx_v_b, PyObject *__pyx_v_c, PyObject *__pyx_v_d, PyObject *__pyx_v_e) { + PyObject *__pyx_r = NULL; + __Pyx_RefNannyDeclarations + PyObject *__pyx_t_1 = NULL; + int __pyx_lineno = 0; + const char *__pyx_filename = NULL; + int __pyx_clineno = 0; + __Pyx_RefNannySetupContext("PyArray_MultiIterNew5", 0); + + /* "C:/Users/runneradmin/AppData/Local/Temp/build-env-ej_q3m8u/Lib/site-packages/numpy/__init__.cython-30.pxd":789 + * + * cdef inline object PyArray_MultiIterNew5(a, b, c, d, e): + * return PyArray_MultiIterNew(5, a, b, c, d, e) # <<<<<<<<<<<<<< + * + * cdef inline tuple PyDataType_SHAPE(dtype d): +*/ + __Pyx_XDECREF(__pyx_r); + __pyx_t_1 = PyArray_MultiIterNew(5, ((void *)__pyx_v_a), ((void *)__pyx_v_b), ((void *)__pyx_v_c), ((void *)__pyx_v_d), ((void *)__pyx_v_e)); if (unlikely(!__pyx_t_1)) __PYX_ERR(2, 789, __pyx_L1_error) + __Pyx_GOTREF(__pyx_t_1); + __pyx_r = __pyx_t_1; + __pyx_t_1 = 0; + goto __pyx_L0; + + /* "C:/Users/runneradmin/AppData/Local/Temp/build-env-ej_q3m8u/Lib/site-packages/numpy/__init__.cython-30.pxd":788 + * return PyArray_MultiIterNew(4, a, b, c, d) + * + * cdef inline object PyArray_MultiIterNew5(a, b, c, d, e): # <<<<<<<<<<<<<< + * return PyArray_MultiIterNew(5, a, b, c, d, e) + * +*/ + + /* function exit code */ + __pyx_L1_error:; + __Pyx_XDECREF(__pyx_t_1); + __Pyx_AddTraceback("numpy.PyArray_MultiIterNew5", __pyx_clineno, __pyx_lineno, __pyx_filename); + __pyx_r = 0; + __pyx_L0:; + __Pyx_XGIVEREF(__pyx_r); + __Pyx_RefNannyFinishContext(); + return __pyx_r; +} + +/* "C:/Users/runneradmin/AppData/Local/Temp/build-env-ej_q3m8u/Lib/site-packages/numpy/__init__.cython-30.pxd":791 + * return PyArray_MultiIterNew(5, a, b, c, d, e) + * + * cdef inline tuple PyDataType_SHAPE(dtype d): # <<<<<<<<<<<<<< + * if PyDataType_HASSUBARRAY(d): + * return d.subarray.shape +*/ + +static CYTHON_INLINE PyObject *__pyx_f_5numpy_PyDataType_SHAPE(PyArray_Descr *__pyx_v_d) { + PyObject *__pyx_r = NULL; + __Pyx_RefNannyDeclarations + int __pyx_t_1; + PyObject *__pyx_t_2; + __Pyx_RefNannySetupContext("PyDataType_SHAPE", 0); + + /* "C:/Users/runneradmin/AppData/Local/Temp/build-env-ej_q3m8u/Lib/site-packages/numpy/__init__.cython-30.pxd":792 + * + * cdef inline tuple PyDataType_SHAPE(dtype d): + * if PyDataType_HASSUBARRAY(d): # <<<<<<<<<<<<<< + * return d.subarray.shape + * else: +*/ + __pyx_t_1 = PyDataType_HASSUBARRAY(__pyx_v_d); + if (__pyx_t_1) { + + /* "C:/Users/runneradmin/AppData/Local/Temp/build-env-ej_q3m8u/Lib/site-packages/numpy/__init__.cython-30.pxd":793 + * cdef inline tuple PyDataType_SHAPE(dtype d): + * if PyDataType_HASSUBARRAY(d): + * return d.subarray.shape # <<<<<<<<<<<<<< + * else: + * return () +*/ + __Pyx_XDECREF(__pyx_r); + __pyx_t_2 = __pyx_f_5numpy_5dtype_8subarray_subarray(__pyx_v_d)->shape; + __Pyx_INCREF(((PyObject*)__pyx_t_2)); + __pyx_r = ((PyObject*)__pyx_t_2); + goto __pyx_L0; + + /* "C:/Users/runneradmin/AppData/Local/Temp/build-env-ej_q3m8u/Lib/site-packages/numpy/__init__.cython-30.pxd":792 + * + * cdef inline tuple PyDataType_SHAPE(dtype d): + * if PyDataType_HASSUBARRAY(d): # <<<<<<<<<<<<<< + * return d.subarray.shape + * else: +*/ + } + + /* "C:/Users/runneradmin/AppData/Local/Temp/build-env-ej_q3m8u/Lib/site-packages/numpy/__init__.cython-30.pxd":795 + * return d.subarray.shape + * else: + * return () # <<<<<<<<<<<<<< + * + * +*/ + /*else*/ { + __Pyx_XDECREF(__pyx_r); + __Pyx_INCREF(__pyx_mstate_global->__pyx_empty_tuple); + __pyx_r = __pyx_mstate_global->__pyx_empty_tuple; + goto __pyx_L0; + } + + /* "C:/Users/runneradmin/AppData/Local/Temp/build-env-ej_q3m8u/Lib/site-packages/numpy/__init__.cython-30.pxd":791 + * return PyArray_MultiIterNew(5, a, b, c, d, e) + * + * cdef inline tuple PyDataType_SHAPE(dtype d): # <<<<<<<<<<<<<< + * if PyDataType_HASSUBARRAY(d): + * return d.subarray.shape +*/ + + /* function exit code */ + __pyx_L0:; + __Pyx_XGIVEREF(__pyx_r); + __Pyx_RefNannyFinishContext(); + return __pyx_r; +} + +/* "C:/Users/runneradmin/AppData/Local/Temp/build-env-ej_q3m8u/Lib/site-packages/numpy/__init__.cython-30.pxd":994 + * int _import_umath() except -1 + * + * cdef inline void set_array_base(ndarray arr, object base) except *: # <<<<<<<<<<<<<< + * Py_INCREF(base) # important to do this before stealing the reference below! + * PyArray_SetBaseObject(arr, base) +*/ + +static CYTHON_INLINE void __pyx_f_5numpy_set_array_base(PyArrayObject *__pyx_v_arr, PyObject *__pyx_v_base) { + int __pyx_t_1; + int __pyx_lineno = 0; + const char *__pyx_filename = NULL; + int __pyx_clineno = 0; + + /* "C:/Users/runneradmin/AppData/Local/Temp/build-env-ej_q3m8u/Lib/site-packages/numpy/__init__.cython-30.pxd":995 + * + * cdef inline void set_array_base(ndarray arr, object base) except *: + * Py_INCREF(base) # important to do this before stealing the reference below! # <<<<<<<<<<<<<< + * PyArray_SetBaseObject(arr, base) + * +*/ + Py_INCREF(__pyx_v_base); + + /* "C:/Users/runneradmin/AppData/Local/Temp/build-env-ej_q3m8u/Lib/site-packages/numpy/__init__.cython-30.pxd":996 + * cdef inline void set_array_base(ndarray arr, object base) except *: + * Py_INCREF(base) # important to do this before stealing the reference below! + * PyArray_SetBaseObject(arr, base) # <<<<<<<<<<<<<< + * + * cdef inline object get_array_base(ndarray arr): +*/ + __pyx_t_1 = PyArray_SetBaseObject(__pyx_v_arr, __pyx_v_base); if (unlikely(__pyx_t_1 == ((int)-1))) __PYX_ERR(2, 996, __pyx_L1_error) + + /* "C:/Users/runneradmin/AppData/Local/Temp/build-env-ej_q3m8u/Lib/site-packages/numpy/__init__.cython-30.pxd":994 + * int _import_umath() except -1 + * + * cdef inline void set_array_base(ndarray arr, object base) except *: # <<<<<<<<<<<<<< + * Py_INCREF(base) # important to do this before stealing the reference below! + * PyArray_SetBaseObject(arr, base) +*/ + + /* function exit code */ + goto __pyx_L0; + __pyx_L1_error:; + __Pyx_AddTraceback("numpy.set_array_base", __pyx_clineno, __pyx_lineno, __pyx_filename); + __pyx_L0:; +} + +/* "C:/Users/runneradmin/AppData/Local/Temp/build-env-ej_q3m8u/Lib/site-packages/numpy/__init__.cython-30.pxd":998 + * PyArray_SetBaseObject(arr, base) + * + * cdef inline object get_array_base(ndarray arr): # <<<<<<<<<<<<<< + * base = PyArray_BASE(arr) + * if base is NULL: +*/ + +static CYTHON_INLINE PyObject *__pyx_f_5numpy_get_array_base(PyArrayObject *__pyx_v_arr) { + PyObject *__pyx_v_base; + PyObject *__pyx_r = NULL; + __Pyx_RefNannyDeclarations + int __pyx_t_1; + __Pyx_RefNannySetupContext("get_array_base", 0); + + /* "C:/Users/runneradmin/AppData/Local/Temp/build-env-ej_q3m8u/Lib/site-packages/numpy/__init__.cython-30.pxd":999 + * + * cdef inline object get_array_base(ndarray arr): + * base = PyArray_BASE(arr) # <<<<<<<<<<<<<< + * if base is NULL: + * return None +*/ + __pyx_v_base = PyArray_BASE(__pyx_v_arr); + + /* "C:/Users/runneradmin/AppData/Local/Temp/build-env-ej_q3m8u/Lib/site-packages/numpy/__init__.cython-30.pxd":1000 + * cdef inline object get_array_base(ndarray arr): + * base = PyArray_BASE(arr) + * if base is NULL: # <<<<<<<<<<<<<< + * return None + * return base +*/ + __pyx_t_1 = (__pyx_v_base == NULL); + if (__pyx_t_1) { + + /* "C:/Users/runneradmin/AppData/Local/Temp/build-env-ej_q3m8u/Lib/site-packages/numpy/__init__.cython-30.pxd":1001 + * base = PyArray_BASE(arr) + * if base is NULL: + * return None # <<<<<<<<<<<<<< + * return base + * +*/ + __Pyx_XDECREF(__pyx_r); + __pyx_r = Py_None; __Pyx_INCREF(Py_None); + goto __pyx_L0; + + /* "C:/Users/runneradmin/AppData/Local/Temp/build-env-ej_q3m8u/Lib/site-packages/numpy/__init__.cython-30.pxd":1000 + * cdef inline object get_array_base(ndarray arr): + * base = PyArray_BASE(arr) + * if base is NULL: # <<<<<<<<<<<<<< + * return None + * return base +*/ + } + + /* "C:/Users/runneradmin/AppData/Local/Temp/build-env-ej_q3m8u/Lib/site-packages/numpy/__init__.cython-30.pxd":1002 + * if base is NULL: + * return None + * return base # <<<<<<<<<<<<<< + * + * # Versions of the import_* functions which are more suitable for +*/ + __Pyx_XDECREF(__pyx_r); + __Pyx_INCREF(((PyObject *)__pyx_v_base)); + __pyx_r = ((PyObject *)__pyx_v_base); + goto __pyx_L0; + + /* "C:/Users/runneradmin/AppData/Local/Temp/build-env-ej_q3m8u/Lib/site-packages/numpy/__init__.cython-30.pxd":998 + * PyArray_SetBaseObject(arr, base) + * + * cdef inline object get_array_base(ndarray arr): # <<<<<<<<<<<<<< + * base = PyArray_BASE(arr) + * if base is NULL: +*/ + + /* function exit code */ + __pyx_L0:; + __Pyx_XGIVEREF(__pyx_r); + __Pyx_RefNannyFinishContext(); + return __pyx_r; +} + +/* "C:/Users/runneradmin/AppData/Local/Temp/build-env-ej_q3m8u/Lib/site-packages/numpy/__init__.cython-30.pxd":1006 + * # Versions of the import_* functions which are more suitable for + * # Cython code. + * cdef inline int import_array() except -1: # <<<<<<<<<<<<<< + * try: + * __pyx_import_array() +*/ + +static CYTHON_INLINE int __pyx_f_5numpy_import_array(void) { + int __pyx_r; + __Pyx_RefNannyDeclarations + PyObject *__pyx_t_1 = NULL; + PyObject *__pyx_t_2 = NULL; + PyObject *__pyx_t_3 = NULL; + int __pyx_t_4; + PyObject *__pyx_t_5 = NULL; + PyObject *__pyx_t_6 = NULL; + PyObject *__pyx_t_7 = NULL; + PyObject *__pyx_t_8 = NULL; + PyObject *__pyx_t_9 = NULL; + size_t __pyx_t_10; + int __pyx_lineno = 0; + const char *__pyx_filename = NULL; + int __pyx_clineno = 0; + __Pyx_RefNannySetupContext("import_array", 0); + + /* "C:/Users/runneradmin/AppData/Local/Temp/build-env-ej_q3m8u/Lib/site-packages/numpy/__init__.cython-30.pxd":1007 + * # Cython code. + * cdef inline int import_array() except -1: + * try: # <<<<<<<<<<<<<< + * __pyx_import_array() + * except Exception: +*/ + { + __Pyx_PyThreadState_declare + __Pyx_PyThreadState_assign + __Pyx_ExceptionSave(&__pyx_t_1, &__pyx_t_2, &__pyx_t_3); + __Pyx_XGOTREF(__pyx_t_1); + __Pyx_XGOTREF(__pyx_t_2); + __Pyx_XGOTREF(__pyx_t_3); + /*try:*/ { + + /* "C:/Users/runneradmin/AppData/Local/Temp/build-env-ej_q3m8u/Lib/site-packages/numpy/__init__.cython-30.pxd":1008 + * cdef inline int import_array() except -1: + * try: + * __pyx_import_array() # <<<<<<<<<<<<<< + * except Exception: + * raise ImportError("numpy._core.multiarray failed to import") +*/ + __pyx_t_4 = _import_array(); if (unlikely(__pyx_t_4 == ((int)-1))) __PYX_ERR(2, 1008, __pyx_L3_error) + + /* "C:/Users/runneradmin/AppData/Local/Temp/build-env-ej_q3m8u/Lib/site-packages/numpy/__init__.cython-30.pxd":1007 + * # Cython code. + * cdef inline int import_array() except -1: + * try: # <<<<<<<<<<<<<< + * __pyx_import_array() + * except Exception: +*/ + } + __Pyx_XDECREF(__pyx_t_1); __pyx_t_1 = 0; + __Pyx_XDECREF(__pyx_t_2); __pyx_t_2 = 0; + __Pyx_XDECREF(__pyx_t_3); __pyx_t_3 = 0; + goto __pyx_L8_try_end; + __pyx_L3_error:; + + /* "C:/Users/runneradmin/AppData/Local/Temp/build-env-ej_q3m8u/Lib/site-packages/numpy/__init__.cython-30.pxd":1009 + * try: + * __pyx_import_array() + * except Exception: # <<<<<<<<<<<<<< + * raise ImportError("numpy._core.multiarray failed to import") + * +*/ + __pyx_t_4 = __Pyx_PyErr_ExceptionMatches(((PyObject *)(((PyTypeObject*)PyExc_Exception)))); + if (__pyx_t_4) { + __Pyx_AddTraceback("numpy.import_array", __pyx_clineno, __pyx_lineno, __pyx_filename); + if (__Pyx_GetException(&__pyx_t_5, &__pyx_t_6, &__pyx_t_7) < 0) __PYX_ERR(2, 1009, __pyx_L5_except_error) + __Pyx_XGOTREF(__pyx_t_5); + __Pyx_XGOTREF(__pyx_t_6); + __Pyx_XGOTREF(__pyx_t_7); + + /* "C:/Users/runneradmin/AppData/Local/Temp/build-env-ej_q3m8u/Lib/site-packages/numpy/__init__.cython-30.pxd":1010 + * __pyx_import_array() + * except Exception: + * raise ImportError("numpy._core.multiarray failed to import") # <<<<<<<<<<<<<< + * + * cdef inline int import_umath() except -1: +*/ + __pyx_t_9 = NULL; + __pyx_t_10 = 1; + { + PyObject *__pyx_callargs[2] = {__pyx_t_9, __pyx_mstate_global->__pyx_kp_u_numpy__core_multiarray_failed_to}; + __pyx_t_8 = __Pyx_PyObject_FastCall((PyObject*)(((PyTypeObject*)PyExc_ImportError)), __pyx_callargs+__pyx_t_10, (2-__pyx_t_10) | (__pyx_t_10*__Pyx_PY_VECTORCALL_ARGUMENTS_OFFSET)); + __Pyx_XDECREF(__pyx_t_9); __pyx_t_9 = 0; + if (unlikely(!__pyx_t_8)) __PYX_ERR(2, 1010, __pyx_L5_except_error) + __Pyx_GOTREF(__pyx_t_8); + } + __Pyx_Raise(__pyx_t_8, 0, 0, 0); + __Pyx_DECREF(__pyx_t_8); __pyx_t_8 = 0; + __PYX_ERR(2, 1010, __pyx_L5_except_error) + } + goto __pyx_L5_except_error; + + /* "C:/Users/runneradmin/AppData/Local/Temp/build-env-ej_q3m8u/Lib/site-packages/numpy/__init__.cython-30.pxd":1007 + * # Cython code. + * cdef inline int import_array() except -1: + * try: # <<<<<<<<<<<<<< + * __pyx_import_array() + * except Exception: +*/ + __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:; + } + + /* "C:/Users/runneradmin/AppData/Local/Temp/build-env-ej_q3m8u/Lib/site-packages/numpy/__init__.cython-30.pxd":1006 + * # Versions of the import_* functions which are more suitable for + * # Cython code. + * cdef inline int import_array() except -1: # <<<<<<<<<<<<<< + * try: + * __pyx_import_array() +*/ + + /* function exit code */ + __pyx_r = 0; + goto __pyx_L0; + __pyx_L1_error:; + __Pyx_XDECREF(__pyx_t_5); + __Pyx_XDECREF(__pyx_t_6); + __Pyx_XDECREF(__pyx_t_7); + __Pyx_XDECREF(__pyx_t_8); + __Pyx_XDECREF(__pyx_t_9); + __Pyx_AddTraceback("numpy.import_array", __pyx_clineno, __pyx_lineno, __pyx_filename); + __pyx_r = -1; + __pyx_L0:; + __Pyx_RefNannyFinishContext(); + return __pyx_r; +} + +/* "C:/Users/runneradmin/AppData/Local/Temp/build-env-ej_q3m8u/Lib/site-packages/numpy/__init__.cython-30.pxd":1012 + * raise ImportError("numpy._core.multiarray failed to import") + * + * cdef inline int import_umath() except -1: # <<<<<<<<<<<<<< + * try: + * _import_umath() +*/ + +static CYTHON_INLINE int __pyx_f_5numpy_import_umath(void) { + int __pyx_r; + __Pyx_RefNannyDeclarations + PyObject *__pyx_t_1 = NULL; + PyObject *__pyx_t_2 = NULL; + PyObject *__pyx_t_3 = NULL; + int __pyx_t_4; + PyObject *__pyx_t_5 = NULL; + PyObject *__pyx_t_6 = NULL; + PyObject *__pyx_t_7 = NULL; + PyObject *__pyx_t_8 = NULL; + PyObject *__pyx_t_9 = NULL; + size_t __pyx_t_10; + int __pyx_lineno = 0; + const char *__pyx_filename = NULL; + int __pyx_clineno = 0; + __Pyx_RefNannySetupContext("import_umath", 0); + + /* "C:/Users/runneradmin/AppData/Local/Temp/build-env-ej_q3m8u/Lib/site-packages/numpy/__init__.cython-30.pxd":1013 + * + * cdef inline int import_umath() except -1: + * try: # <<<<<<<<<<<<<< + * _import_umath() + * except Exception: +*/ + { + __Pyx_PyThreadState_declare + __Pyx_PyThreadState_assign + __Pyx_ExceptionSave(&__pyx_t_1, &__pyx_t_2, &__pyx_t_3); + __Pyx_XGOTREF(__pyx_t_1); + __Pyx_XGOTREF(__pyx_t_2); + __Pyx_XGOTREF(__pyx_t_3); + /*try:*/ { + + /* "C:/Users/runneradmin/AppData/Local/Temp/build-env-ej_q3m8u/Lib/site-packages/numpy/__init__.cython-30.pxd":1014 + * cdef inline int import_umath() except -1: + * try: + * _import_umath() # <<<<<<<<<<<<<< + * except Exception: + * raise ImportError("numpy._core.umath failed to import") +*/ + __pyx_t_4 = _import_umath(); if (unlikely(__pyx_t_4 == ((int)-1))) __PYX_ERR(2, 1014, __pyx_L3_error) + + /* "C:/Users/runneradmin/AppData/Local/Temp/build-env-ej_q3m8u/Lib/site-packages/numpy/__init__.cython-30.pxd":1013 + * + * cdef inline int import_umath() except -1: + * try: # <<<<<<<<<<<<<< + * _import_umath() + * except Exception: +*/ + } + __Pyx_XDECREF(__pyx_t_1); __pyx_t_1 = 0; + __Pyx_XDECREF(__pyx_t_2); __pyx_t_2 = 0; + __Pyx_XDECREF(__pyx_t_3); __pyx_t_3 = 0; + goto __pyx_L8_try_end; + __pyx_L3_error:; + + /* "C:/Users/runneradmin/AppData/Local/Temp/build-env-ej_q3m8u/Lib/site-packages/numpy/__init__.cython-30.pxd":1015 + * try: + * _import_umath() + * except Exception: # <<<<<<<<<<<<<< + * raise ImportError("numpy._core.umath failed to import") + * +*/ + __pyx_t_4 = __Pyx_PyErr_ExceptionMatches(((PyObject *)(((PyTypeObject*)PyExc_Exception)))); + if (__pyx_t_4) { + __Pyx_AddTraceback("numpy.import_umath", __pyx_clineno, __pyx_lineno, __pyx_filename); + if (__Pyx_GetException(&__pyx_t_5, &__pyx_t_6, &__pyx_t_7) < 0) __PYX_ERR(2, 1015, __pyx_L5_except_error) + __Pyx_XGOTREF(__pyx_t_5); + __Pyx_XGOTREF(__pyx_t_6); + __Pyx_XGOTREF(__pyx_t_7); + + /* "C:/Users/runneradmin/AppData/Local/Temp/build-env-ej_q3m8u/Lib/site-packages/numpy/__init__.cython-30.pxd":1016 + * _import_umath() + * except Exception: + * raise ImportError("numpy._core.umath failed to import") # <<<<<<<<<<<<<< + * + * cdef inline int import_ufunc() except -1: +*/ + __pyx_t_9 = NULL; + __pyx_t_10 = 1; + { + PyObject *__pyx_callargs[2] = {__pyx_t_9, __pyx_mstate_global->__pyx_kp_u_numpy__core_umath_failed_to_impo}; + __pyx_t_8 = __Pyx_PyObject_FastCall((PyObject*)(((PyTypeObject*)PyExc_ImportError)), __pyx_callargs+__pyx_t_10, (2-__pyx_t_10) | (__pyx_t_10*__Pyx_PY_VECTORCALL_ARGUMENTS_OFFSET)); + __Pyx_XDECREF(__pyx_t_9); __pyx_t_9 = 0; + if (unlikely(!__pyx_t_8)) __PYX_ERR(2, 1016, __pyx_L5_except_error) + __Pyx_GOTREF(__pyx_t_8); + } + __Pyx_Raise(__pyx_t_8, 0, 0, 0); + __Pyx_DECREF(__pyx_t_8); __pyx_t_8 = 0; + __PYX_ERR(2, 1016, __pyx_L5_except_error) + } + goto __pyx_L5_except_error; + + /* "C:/Users/runneradmin/AppData/Local/Temp/build-env-ej_q3m8u/Lib/site-packages/numpy/__init__.cython-30.pxd":1013 + * + * cdef inline int import_umath() except -1: + * try: # <<<<<<<<<<<<<< + * _import_umath() + * except Exception: +*/ + __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:; + } + + /* "C:/Users/runneradmin/AppData/Local/Temp/build-env-ej_q3m8u/Lib/site-packages/numpy/__init__.cython-30.pxd":1012 + * raise ImportError("numpy._core.multiarray failed to import") + * + * cdef inline int import_umath() except -1: # <<<<<<<<<<<<<< + * try: + * _import_umath() +*/ + + /* function exit code */ + __pyx_r = 0; + goto __pyx_L0; + __pyx_L1_error:; + __Pyx_XDECREF(__pyx_t_5); + __Pyx_XDECREF(__pyx_t_6); + __Pyx_XDECREF(__pyx_t_7); + __Pyx_XDECREF(__pyx_t_8); + __Pyx_XDECREF(__pyx_t_9); + __Pyx_AddTraceback("numpy.import_umath", __pyx_clineno, __pyx_lineno, __pyx_filename); + __pyx_r = -1; + __pyx_L0:; + __Pyx_RefNannyFinishContext(); + return __pyx_r; +} + +/* "C:/Users/runneradmin/AppData/Local/Temp/build-env-ej_q3m8u/Lib/site-packages/numpy/__init__.cython-30.pxd":1018 + * raise ImportError("numpy._core.umath failed to import") + * + * cdef inline int import_ufunc() except -1: # <<<<<<<<<<<<<< + * try: + * _import_umath() +*/ + +static CYTHON_INLINE int __pyx_f_5numpy_import_ufunc(void) { + int __pyx_r; + __Pyx_RefNannyDeclarations + PyObject *__pyx_t_1 = NULL; + PyObject *__pyx_t_2 = NULL; + PyObject *__pyx_t_3 = NULL; + int __pyx_t_4; + PyObject *__pyx_t_5 = NULL; + PyObject *__pyx_t_6 = NULL; + PyObject *__pyx_t_7 = NULL; + PyObject *__pyx_t_8 = NULL; + PyObject *__pyx_t_9 = NULL; + size_t __pyx_t_10; + int __pyx_lineno = 0; + const char *__pyx_filename = NULL; + int __pyx_clineno = 0; + __Pyx_RefNannySetupContext("import_ufunc", 0); + + /* "C:/Users/runneradmin/AppData/Local/Temp/build-env-ej_q3m8u/Lib/site-packages/numpy/__init__.cython-30.pxd":1019 + * + * cdef inline int import_ufunc() except -1: + * try: # <<<<<<<<<<<<<< + * _import_umath() + * except Exception: +*/ + { + __Pyx_PyThreadState_declare + __Pyx_PyThreadState_assign + __Pyx_ExceptionSave(&__pyx_t_1, &__pyx_t_2, &__pyx_t_3); + __Pyx_XGOTREF(__pyx_t_1); + __Pyx_XGOTREF(__pyx_t_2); + __Pyx_XGOTREF(__pyx_t_3); + /*try:*/ { + + /* "C:/Users/runneradmin/AppData/Local/Temp/build-env-ej_q3m8u/Lib/site-packages/numpy/__init__.cython-30.pxd":1020 + * cdef inline int import_ufunc() except -1: + * try: + * _import_umath() # <<<<<<<<<<<<<< + * except Exception: + * raise ImportError("numpy._core.umath failed to import") +*/ + __pyx_t_4 = _import_umath(); if (unlikely(__pyx_t_4 == ((int)-1))) __PYX_ERR(2, 1020, __pyx_L3_error) + + /* "C:/Users/runneradmin/AppData/Local/Temp/build-env-ej_q3m8u/Lib/site-packages/numpy/__init__.cython-30.pxd":1019 + * + * cdef inline int import_ufunc() except -1: + * try: # <<<<<<<<<<<<<< + * _import_umath() + * except Exception: +*/ + } + __Pyx_XDECREF(__pyx_t_1); __pyx_t_1 = 0; + __Pyx_XDECREF(__pyx_t_2); __pyx_t_2 = 0; + __Pyx_XDECREF(__pyx_t_3); __pyx_t_3 = 0; + goto __pyx_L8_try_end; + __pyx_L3_error:; + + /* "C:/Users/runneradmin/AppData/Local/Temp/build-env-ej_q3m8u/Lib/site-packages/numpy/__init__.cython-30.pxd":1021 + * try: + * _import_umath() + * except Exception: # <<<<<<<<<<<<<< + * raise ImportError("numpy._core.umath failed to import") + * +*/ + __pyx_t_4 = __Pyx_PyErr_ExceptionMatches(((PyObject *)(((PyTypeObject*)PyExc_Exception)))); + if (__pyx_t_4) { + __Pyx_AddTraceback("numpy.import_ufunc", __pyx_clineno, __pyx_lineno, __pyx_filename); + if (__Pyx_GetException(&__pyx_t_5, &__pyx_t_6, &__pyx_t_7) < 0) __PYX_ERR(2, 1021, __pyx_L5_except_error) + __Pyx_XGOTREF(__pyx_t_5); + __Pyx_XGOTREF(__pyx_t_6); + __Pyx_XGOTREF(__pyx_t_7); + + /* "C:/Users/runneradmin/AppData/Local/Temp/build-env-ej_q3m8u/Lib/site-packages/numpy/__init__.cython-30.pxd":1022 + * _import_umath() + * except Exception: + * raise ImportError("numpy._core.umath failed to import") # <<<<<<<<<<<<<< + * + * +*/ + __pyx_t_9 = NULL; + __pyx_t_10 = 1; + { + PyObject *__pyx_callargs[2] = {__pyx_t_9, __pyx_mstate_global->__pyx_kp_u_numpy__core_umath_failed_to_impo}; + __pyx_t_8 = __Pyx_PyObject_FastCall((PyObject*)(((PyTypeObject*)PyExc_ImportError)), __pyx_callargs+__pyx_t_10, (2-__pyx_t_10) | (__pyx_t_10*__Pyx_PY_VECTORCALL_ARGUMENTS_OFFSET)); + __Pyx_XDECREF(__pyx_t_9); __pyx_t_9 = 0; + if (unlikely(!__pyx_t_8)) __PYX_ERR(2, 1022, __pyx_L5_except_error) + __Pyx_GOTREF(__pyx_t_8); + } + __Pyx_Raise(__pyx_t_8, 0, 0, 0); + __Pyx_DECREF(__pyx_t_8); __pyx_t_8 = 0; + __PYX_ERR(2, 1022, __pyx_L5_except_error) + } + goto __pyx_L5_except_error; + + /* "C:/Users/runneradmin/AppData/Local/Temp/build-env-ej_q3m8u/Lib/site-packages/numpy/__init__.cython-30.pxd":1019 + * + * cdef inline int import_ufunc() except -1: + * try: # <<<<<<<<<<<<<< + * _import_umath() + * except Exception: +*/ + __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:; + } + + /* "C:/Users/runneradmin/AppData/Local/Temp/build-env-ej_q3m8u/Lib/site-packages/numpy/__init__.cython-30.pxd":1018 + * raise ImportError("numpy._core.umath failed to import") + * + * cdef inline int import_ufunc() except -1: # <<<<<<<<<<<<<< + * try: + * _import_umath() +*/ + + /* function exit code */ + __pyx_r = 0; + goto __pyx_L0; + __pyx_L1_error:; + __Pyx_XDECREF(__pyx_t_5); + __Pyx_XDECREF(__pyx_t_6); + __Pyx_XDECREF(__pyx_t_7); + __Pyx_XDECREF(__pyx_t_8); + __Pyx_XDECREF(__pyx_t_9); + __Pyx_AddTraceback("numpy.import_ufunc", __pyx_clineno, __pyx_lineno, __pyx_filename); + __pyx_r = -1; + __pyx_L0:; + __Pyx_RefNannyFinishContext(); + return __pyx_r; +} + +/* "C:/Users/runneradmin/AppData/Local/Temp/build-env-ej_q3m8u/Lib/site-packages/numpy/__init__.cython-30.pxd":1025 + * + * + * cdef inline bint is_timedelta64_object(object obj) noexcept: # <<<<<<<<<<<<<< + * """ + * Cython equivalent of `isinstance(obj, np.timedelta64)` +*/ + +static CYTHON_INLINE int __pyx_f_5numpy_is_timedelta64_object(PyObject *__pyx_v_obj) { + int __pyx_r; + + /* "C:/Users/runneradmin/AppData/Local/Temp/build-env-ej_q3m8u/Lib/site-packages/numpy/__init__.cython-30.pxd":1037 + * bool + * """ + * return PyObject_TypeCheck(obj, &PyTimedeltaArrType_Type) # <<<<<<<<<<<<<< + * + * +*/ + __pyx_r = PyObject_TypeCheck(__pyx_v_obj, (&PyTimedeltaArrType_Type)); + goto __pyx_L0; + + /* "C:/Users/runneradmin/AppData/Local/Temp/build-env-ej_q3m8u/Lib/site-packages/numpy/__init__.cython-30.pxd":1025 + * + * + * cdef inline bint is_timedelta64_object(object obj) noexcept: # <<<<<<<<<<<<<< + * """ + * Cython equivalent of `isinstance(obj, np.timedelta64)` +*/ + + /* function exit code */ + __pyx_L0:; + return __pyx_r; +} + +/* "C:/Users/runneradmin/AppData/Local/Temp/build-env-ej_q3m8u/Lib/site-packages/numpy/__init__.cython-30.pxd":1040 + * + * + * cdef inline bint is_datetime64_object(object obj) noexcept: # <<<<<<<<<<<<<< + * """ + * Cython equivalent of `isinstance(obj, np.datetime64)` +*/ + +static CYTHON_INLINE int __pyx_f_5numpy_is_datetime64_object(PyObject *__pyx_v_obj) { + int __pyx_r; + + /* "C:/Users/runneradmin/AppData/Local/Temp/build-env-ej_q3m8u/Lib/site-packages/numpy/__init__.cython-30.pxd":1052 + * bool + * """ + * return PyObject_TypeCheck(obj, &PyDatetimeArrType_Type) # <<<<<<<<<<<<<< + * + * +*/ + __pyx_r = PyObject_TypeCheck(__pyx_v_obj, (&PyDatetimeArrType_Type)); + goto __pyx_L0; + + /* "C:/Users/runneradmin/AppData/Local/Temp/build-env-ej_q3m8u/Lib/site-packages/numpy/__init__.cython-30.pxd":1040 + * + * + * cdef inline bint is_datetime64_object(object obj) noexcept: # <<<<<<<<<<<<<< + * """ + * Cython equivalent of `isinstance(obj, np.datetime64)` +*/ + + /* function exit code */ + __pyx_L0:; + return __pyx_r; +} + +/* "C:/Users/runneradmin/AppData/Local/Temp/build-env-ej_q3m8u/Lib/site-packages/numpy/__init__.cython-30.pxd":1055 + * + * + * cdef inline npy_datetime get_datetime64_value(object obj) noexcept nogil: # <<<<<<<<<<<<<< + * """ + * returns the int64 value underlying scalar numpy datetime64 object +*/ + +static CYTHON_INLINE npy_datetime __pyx_f_5numpy_get_datetime64_value(PyObject *__pyx_v_obj) { + npy_datetime __pyx_r; + + /* "C:/Users/runneradmin/AppData/Local/Temp/build-env-ej_q3m8u/Lib/site-packages/numpy/__init__.cython-30.pxd":1062 + * also needed. That can be found using `get_datetime64_unit`. + * """ + * return (obj).obval # <<<<<<<<<<<<<< + * + * +*/ + __pyx_r = ((PyDatetimeScalarObject *)__pyx_v_obj)->obval; + goto __pyx_L0; + + /* "C:/Users/runneradmin/AppData/Local/Temp/build-env-ej_q3m8u/Lib/site-packages/numpy/__init__.cython-30.pxd":1055 + * + * + * cdef inline npy_datetime get_datetime64_value(object obj) noexcept nogil: # <<<<<<<<<<<<<< + * """ + * returns the int64 value underlying scalar numpy datetime64 object +*/ + + /* function exit code */ + __pyx_L0:; + return __pyx_r; +} + +/* "C:/Users/runneradmin/AppData/Local/Temp/build-env-ej_q3m8u/Lib/site-packages/numpy/__init__.cython-30.pxd":1065 + * + * + * cdef inline npy_timedelta get_timedelta64_value(object obj) noexcept nogil: # <<<<<<<<<<<<<< + * """ + * returns the int64 value underlying scalar numpy timedelta64 object +*/ + +static CYTHON_INLINE npy_timedelta __pyx_f_5numpy_get_timedelta64_value(PyObject *__pyx_v_obj) { + npy_timedelta __pyx_r; + + /* "C:/Users/runneradmin/AppData/Local/Temp/build-env-ej_q3m8u/Lib/site-packages/numpy/__init__.cython-30.pxd":1069 + * returns the int64 value underlying scalar numpy timedelta64 object + * """ + * return (obj).obval # <<<<<<<<<<<<<< + * + * +*/ + __pyx_r = ((PyTimedeltaScalarObject *)__pyx_v_obj)->obval; + goto __pyx_L0; + + /* "C:/Users/runneradmin/AppData/Local/Temp/build-env-ej_q3m8u/Lib/site-packages/numpy/__init__.cython-30.pxd":1065 + * + * + * cdef inline npy_timedelta get_timedelta64_value(object obj) noexcept nogil: # <<<<<<<<<<<<<< + * """ + * returns the int64 value underlying scalar numpy timedelta64 object +*/ + + /* function exit code */ + __pyx_L0:; + return __pyx_r; +} + +/* "C:/Users/runneradmin/AppData/Local/Temp/build-env-ej_q3m8u/Lib/site-packages/numpy/__init__.cython-30.pxd":1072 + * + * + * cdef inline NPY_DATETIMEUNIT get_datetime64_unit(object obj) noexcept nogil: # <<<<<<<<<<<<<< + * """ + * returns the unit part of the dtype for a numpy datetime64 object. +*/ + +static CYTHON_INLINE NPY_DATETIMEUNIT __pyx_f_5numpy_get_datetime64_unit(PyObject *__pyx_v_obj) { + NPY_DATETIMEUNIT __pyx_r; + + /* "C:/Users/runneradmin/AppData/Local/Temp/build-env-ej_q3m8u/Lib/site-packages/numpy/__init__.cython-30.pxd":1076 + * returns the unit part of the dtype for a numpy datetime64 object. + * """ + * return (obj).obmeta.base # <<<<<<<<<<<<<< + * + * +*/ + __pyx_r = ((NPY_DATETIMEUNIT)((PyDatetimeScalarObject *)__pyx_v_obj)->obmeta.base); + goto __pyx_L0; + + /* "C:/Users/runneradmin/AppData/Local/Temp/build-env-ej_q3m8u/Lib/site-packages/numpy/__init__.cython-30.pxd":1072 + * + * + * cdef inline NPY_DATETIMEUNIT get_datetime64_unit(object obj) noexcept nogil: # <<<<<<<<<<<<<< + * """ + * returns the unit part of the dtype for a numpy datetime64 object. +*/ + + /* function exit code */ + __pyx_L0:; + return __pyx_r; +} + +/* "lexeme.pxd":29 + * cdef readonly attr_t orth + * + * @staticmethod # <<<<<<<<<<<<<< + * cdef inline Lexeme from_ptr(LexemeC* lex, Vocab vocab): + * cdef Lexeme self = Lexeme.__new__(Lexeme, vocab, lex.orth) +*/ + +static CYTHON_INLINE struct __pyx_obj_5spacy_6lexeme_Lexeme *__pyx_f_5spacy_6lexeme_6Lexeme_from_ptr(struct __pyx_t_5spacy_7structs_LexemeC *__pyx_v_lex, struct __pyx_obj_5spacy_5vocab_Vocab *__pyx_v_vocab) { + struct __pyx_obj_5spacy_6lexeme_Lexeme *__pyx_v_self = 0; + struct __pyx_obj_5spacy_6lexeme_Lexeme *__pyx_r = NULL; + __Pyx_RefNannyDeclarations + PyObject *__pyx_t_1 = NULL; + PyObject *__pyx_t_2 = NULL; + __pyx_t_5spacy_8typedefs_attr_t __pyx_t_3; + int __pyx_lineno = 0; + const char *__pyx_filename = NULL; + int __pyx_clineno = 0; + __Pyx_RefNannySetupContext("from_ptr", 0); + + /* "lexeme.pxd":31 + * @staticmethod + * cdef inline Lexeme from_ptr(LexemeC* lex, Vocab vocab): + * cdef Lexeme self = Lexeme.__new__(Lexeme, vocab, lex.orth) # <<<<<<<<<<<<<< + * self.c = lex + * self.vocab = vocab +*/ + __pyx_t_1 = __Pyx_PyLong_From_uint64_t(__pyx_v_lex->orth); if (unlikely(!__pyx_t_1)) __PYX_ERR(3, 31, __pyx_L1_error) + __Pyx_GOTREF(__pyx_t_1); + __pyx_t_2 = PyTuple_New(2); if (unlikely(!__pyx_t_2)) __PYX_ERR(3, 31, __pyx_L1_error) + __Pyx_GOTREF(__pyx_t_2); + __Pyx_INCREF((PyObject *)__pyx_v_vocab); + __Pyx_GIVEREF((PyObject *)__pyx_v_vocab); + if (__Pyx_PyTuple_SET_ITEM(__pyx_t_2, 0, ((PyObject *)__pyx_v_vocab)) != (0)) __PYX_ERR(3, 31, __pyx_L1_error); + __Pyx_GIVEREF(__pyx_t_1); + if (__Pyx_PyTuple_SET_ITEM(__pyx_t_2, 1, __pyx_t_1) != (0)) __PYX_ERR(3, 31, __pyx_L1_error); + __pyx_t_1 = 0; + __pyx_t_1 = __Pyx_tp_new(((PyObject *)__pyx_mstate_global->__pyx_ptype_5spacy_6lexeme_Lexeme), ((PyObject*)__pyx_t_2)); if (unlikely(!__pyx_t_1)) __PYX_ERR(3, 31, __pyx_L1_error) + __Pyx_GOTREF(__pyx_t_1); + __Pyx_DECREF(__pyx_t_2); __pyx_t_2 = 0; + if (!(likely(__Pyx_TypeTest(__pyx_t_1, __pyx_mstate_global->__pyx_ptype_5spacy_6lexeme_Lexeme)))) __PYX_ERR(3, 31, __pyx_L1_error) + __pyx_v_self = ((struct __pyx_obj_5spacy_6lexeme_Lexeme *)__pyx_t_1); + __pyx_t_1 = 0; + + /* "lexeme.pxd":32 + * cdef inline Lexeme from_ptr(LexemeC* lex, Vocab vocab): + * cdef Lexeme self = Lexeme.__new__(Lexeme, vocab, lex.orth) + * self.c = lex # <<<<<<<<<<<<<< + * self.vocab = vocab + * self.orth = lex.orth +*/ + __pyx_v_self->c = __pyx_v_lex; + + /* "lexeme.pxd":33 + * cdef Lexeme self = Lexeme.__new__(Lexeme, vocab, lex.orth) + * self.c = lex + * self.vocab = vocab # <<<<<<<<<<<<<< + * self.orth = lex.orth + * return self +*/ + __Pyx_INCREF((PyObject *)__pyx_v_vocab); + __Pyx_GIVEREF((PyObject *)__pyx_v_vocab); + __Pyx_GOTREF((PyObject *)__pyx_v_self->vocab); + __Pyx_DECREF((PyObject *)__pyx_v_self->vocab); + __pyx_v_self->vocab = __pyx_v_vocab; + + /* "lexeme.pxd":34 + * self.c = lex + * self.vocab = vocab + * self.orth = lex.orth # <<<<<<<<<<<<<< + * return self + * +*/ + __pyx_t_3 = __pyx_v_lex->orth; + __pyx_v_self->orth = __pyx_t_3; + + /* "lexeme.pxd":35 + * self.vocab = vocab + * self.orth = lex.orth + * return self # <<<<<<<<<<<<<< + * + * @staticmethod +*/ + __Pyx_XDECREF((PyObject *)__pyx_r); + __Pyx_INCREF((PyObject *)__pyx_v_self); + __pyx_r = __pyx_v_self; + goto __pyx_L0; + + /* "lexeme.pxd":29 + * cdef readonly attr_t orth + * + * @staticmethod # <<<<<<<<<<<<<< + * cdef inline Lexeme from_ptr(LexemeC* lex, Vocab vocab): + * cdef Lexeme self = Lexeme.__new__(Lexeme, vocab, lex.orth) +*/ + + /* function exit code */ + __pyx_L1_error:; + __Pyx_XDECREF(__pyx_t_1); + __Pyx_XDECREF(__pyx_t_2); + __Pyx_AddTraceback("spacy.lexeme.Lexeme.from_ptr", __pyx_clineno, __pyx_lineno, __pyx_filename); + __pyx_r = 0; + __pyx_L0:; + __Pyx_XDECREF((PyObject *)__pyx_v_self); + __Pyx_XGIVEREF((PyObject *)__pyx_r); + __Pyx_RefNannyFinishContext(); + return __pyx_r; +} + +/* "lexeme.pxd":37 + * return self + * + * @staticmethod # <<<<<<<<<<<<<< + * cdef inline void set_struct_attr(LexemeC* lex, attr_id_t name, attr_t value) noexcept nogil: + * if name < (sizeof(flags_t) * 8): +*/ + +static CYTHON_INLINE void __pyx_f_5spacy_6lexeme_6Lexeme_set_struct_attr(struct __pyx_t_5spacy_7structs_LexemeC *__pyx_v_lex, enum __pyx_t_5spacy_5attrs_attr_id_t __pyx_v_name, __pyx_t_5spacy_8typedefs_attr_t __pyx_v_value) { + int __pyx_t_1; + + /* "lexeme.pxd":39 + * @staticmethod + * cdef inline void set_struct_attr(LexemeC* lex, attr_id_t name, attr_t value) noexcept nogil: + * if name < (sizeof(flags_t) * 8): # <<<<<<<<<<<<<< + * Lexeme.c_set_flag(lex, name, value) + * elif name == ID: +*/ + __pyx_t_1 = (__pyx_v_name < ((sizeof(__pyx_t_5spacy_8typedefs_flags_t)) * 8)); + if (__pyx_t_1) { + + /* "lexeme.pxd":40 + * cdef inline void set_struct_attr(LexemeC* lex, attr_id_t name, attr_t value) noexcept nogil: + * if name < (sizeof(flags_t) * 8): + * Lexeme.c_set_flag(lex, name, value) # <<<<<<<<<<<<<< + * elif name == ID: + * lex.id = value +*/ + (void)(__pyx_f_5spacy_6lexeme_6Lexeme_c_set_flag(__pyx_v_lex, __pyx_v_name, __pyx_v_value)); + + /* "lexeme.pxd":39 + * @staticmethod + * cdef inline void set_struct_attr(LexemeC* lex, attr_id_t name, attr_t value) noexcept nogil: + * if name < (sizeof(flags_t) * 8): # <<<<<<<<<<<<<< + * Lexeme.c_set_flag(lex, name, value) + * elif name == ID: +*/ + goto __pyx_L3; + } + + /* "lexeme.pxd":41 + * if name < (sizeof(flags_t) * 8): + * Lexeme.c_set_flag(lex, name, value) + * elif name == ID: # <<<<<<<<<<<<<< + * lex.id = value + * elif name == LOWER: +*/ + __pyx_t_1 = (__pyx_v_name == __pyx_e_5spacy_5attrs_ID); + if (__pyx_t_1) { + + /* "lexeme.pxd":42 + * Lexeme.c_set_flag(lex, name, value) + * elif name == ID: + * lex.id = value # <<<<<<<<<<<<<< + * elif name == LOWER: + * lex.lower = value +*/ + __pyx_v_lex->id = __pyx_v_value; + + /* "lexeme.pxd":41 + * if name < (sizeof(flags_t) * 8): + * Lexeme.c_set_flag(lex, name, value) + * elif name == ID: # <<<<<<<<<<<<<< + * lex.id = value + * elif name == LOWER: +*/ + goto __pyx_L3; + } + + /* "lexeme.pxd":43 + * elif name == ID: + * lex.id = value + * elif name == LOWER: # <<<<<<<<<<<<<< + * lex.lower = value + * elif name == NORM: +*/ + __pyx_t_1 = (__pyx_v_name == __pyx_e_5spacy_5attrs_LOWER); + if (__pyx_t_1) { + + /* "lexeme.pxd":44 + * lex.id = value + * elif name == LOWER: + * lex.lower = value # <<<<<<<<<<<<<< + * elif name == NORM: + * lex.norm = value +*/ + __pyx_v_lex->lower = __pyx_v_value; + + /* "lexeme.pxd":43 + * elif name == ID: + * lex.id = value + * elif name == LOWER: # <<<<<<<<<<<<<< + * lex.lower = value + * elif name == NORM: +*/ + goto __pyx_L3; + } + + /* "lexeme.pxd":45 + * elif name == LOWER: + * lex.lower = value + * elif name == NORM: # <<<<<<<<<<<<<< + * lex.norm = value + * elif name == SHAPE: +*/ + __pyx_t_1 = (__pyx_v_name == __pyx_e_5spacy_5attrs_NORM); + if (__pyx_t_1) { + + /* "lexeme.pxd":46 + * lex.lower = value + * elif name == NORM: + * lex.norm = value # <<<<<<<<<<<<<< + * elif name == SHAPE: + * lex.shape = value +*/ + __pyx_v_lex->norm = __pyx_v_value; + + /* "lexeme.pxd":45 + * elif name == LOWER: + * lex.lower = value + * elif name == NORM: # <<<<<<<<<<<<<< + * lex.norm = value + * elif name == SHAPE: +*/ + goto __pyx_L3; + } + + /* "lexeme.pxd":47 + * elif name == NORM: + * lex.norm = value + * elif name == SHAPE: # <<<<<<<<<<<<<< + * lex.shape = value + * elif name == PREFIX: +*/ + __pyx_t_1 = (__pyx_v_name == __pyx_e_5spacy_5attrs_SHAPE); + if (__pyx_t_1) { + + /* "lexeme.pxd":48 + * lex.norm = value + * elif name == SHAPE: + * lex.shape = value # <<<<<<<<<<<<<< + * elif name == PREFIX: + * lex.prefix = value +*/ + __pyx_v_lex->shape = __pyx_v_value; + + /* "lexeme.pxd":47 + * elif name == NORM: + * lex.norm = value + * elif name == SHAPE: # <<<<<<<<<<<<<< + * lex.shape = value + * elif name == PREFIX: +*/ + goto __pyx_L3; + } + + /* "lexeme.pxd":49 + * elif name == SHAPE: + * lex.shape = value + * elif name == PREFIX: # <<<<<<<<<<<<<< + * lex.prefix = value + * elif name == SUFFIX: +*/ + __pyx_t_1 = (__pyx_v_name == __pyx_e_5spacy_5attrs_PREFIX); + if (__pyx_t_1) { + + /* "lexeme.pxd":50 + * lex.shape = value + * elif name == PREFIX: + * lex.prefix = value # <<<<<<<<<<<<<< + * elif name == SUFFIX: + * lex.suffix = value +*/ + __pyx_v_lex->prefix = __pyx_v_value; + + /* "lexeme.pxd":49 + * elif name == SHAPE: + * lex.shape = value + * elif name == PREFIX: # <<<<<<<<<<<<<< + * lex.prefix = value + * elif name == SUFFIX: +*/ + goto __pyx_L3; + } + + /* "lexeme.pxd":51 + * elif name == PREFIX: + * lex.prefix = value + * elif name == SUFFIX: # <<<<<<<<<<<<<< + * lex.suffix = value + * elif name == LANG: +*/ + __pyx_t_1 = (__pyx_v_name == __pyx_e_5spacy_5attrs_SUFFIX); + if (__pyx_t_1) { + + /* "lexeme.pxd":52 + * lex.prefix = value + * elif name == SUFFIX: + * lex.suffix = value # <<<<<<<<<<<<<< + * elif name == LANG: + * lex.lang = value +*/ + __pyx_v_lex->suffix = __pyx_v_value; + + /* "lexeme.pxd":51 + * elif name == PREFIX: + * lex.prefix = value + * elif name == SUFFIX: # <<<<<<<<<<<<<< + * lex.suffix = value + * elif name == LANG: +*/ + goto __pyx_L3; + } + + /* "lexeme.pxd":53 + * elif name == SUFFIX: + * lex.suffix = value + * elif name == LANG: # <<<<<<<<<<<<<< + * lex.lang = value + * +*/ + __pyx_t_1 = (__pyx_v_name == __pyx_e_5spacy_5attrs_LANG); + if (__pyx_t_1) { + + /* "lexeme.pxd":54 + * lex.suffix = value + * elif name == LANG: + * lex.lang = value # <<<<<<<<<<<<<< + * + * @staticmethod +*/ + __pyx_v_lex->lang = __pyx_v_value; + + /* "lexeme.pxd":53 + * elif name == SUFFIX: + * lex.suffix = value + * elif name == LANG: # <<<<<<<<<<<<<< + * lex.lang = value + * +*/ + } + __pyx_L3:; + + /* "lexeme.pxd":37 + * return self + * + * @staticmethod # <<<<<<<<<<<<<< + * cdef inline void set_struct_attr(LexemeC* lex, attr_id_t name, attr_t value) noexcept nogil: + * if name < (sizeof(flags_t) * 8): +*/ + + /* function exit code */ +} + +/* "lexeme.pxd":56 + * lex.lang = value + * + * @staticmethod # <<<<<<<<<<<<<< + * cdef inline attr_t get_struct_attr(const LexemeC* lex, attr_id_t feat_name) noexcept nogil: + * if feat_name < (sizeof(flags_t) * 8): +*/ + +static CYTHON_INLINE __pyx_t_5spacy_8typedefs_attr_t __pyx_f_5spacy_6lexeme_6Lexeme_get_struct_attr(struct __pyx_t_5spacy_7structs_LexemeC const *__pyx_v_lex, enum __pyx_t_5spacy_5attrs_attr_id_t __pyx_v_feat_name) { + __pyx_t_5spacy_8typedefs_attr_t __pyx_r; + int __pyx_t_1; + + /* "lexeme.pxd":58 + * @staticmethod + * cdef inline attr_t get_struct_attr(const LexemeC* lex, attr_id_t feat_name) noexcept nogil: + * if feat_name < (sizeof(flags_t) * 8): # <<<<<<<<<<<<<< + * if Lexeme.c_check_flag(lex, feat_name): + * return 1 +*/ + __pyx_t_1 = (__pyx_v_feat_name < ((sizeof(__pyx_t_5spacy_8typedefs_flags_t)) * 8)); + if (__pyx_t_1) { + + /* "lexeme.pxd":59 + * cdef inline attr_t get_struct_attr(const LexemeC* lex, attr_id_t feat_name) noexcept nogil: + * if feat_name < (sizeof(flags_t) * 8): + * if Lexeme.c_check_flag(lex, feat_name): # <<<<<<<<<<<<<< + * return 1 + * else: +*/ + __pyx_t_1 = __pyx_f_5spacy_6lexeme_6Lexeme_c_check_flag(__pyx_v_lex, __pyx_v_feat_name); + if (__pyx_t_1) { + + /* "lexeme.pxd":60 + * if feat_name < (sizeof(flags_t) * 8): + * if Lexeme.c_check_flag(lex, feat_name): + * return 1 # <<<<<<<<<<<<<< + * else: + * return 0 +*/ + __pyx_r = 1; + goto __pyx_L0; + + /* "lexeme.pxd":59 + * cdef inline attr_t get_struct_attr(const LexemeC* lex, attr_id_t feat_name) noexcept nogil: + * if feat_name < (sizeof(flags_t) * 8): + * if Lexeme.c_check_flag(lex, feat_name): # <<<<<<<<<<<<<< + * return 1 + * else: +*/ + } + + /* "lexeme.pxd":62 + * return 1 + * else: + * return 0 # <<<<<<<<<<<<<< + * elif feat_name == ID: + * return lex.id +*/ + /*else*/ { + __pyx_r = 0; + goto __pyx_L0; + } + + /* "lexeme.pxd":58 + * @staticmethod + * cdef inline attr_t get_struct_attr(const LexemeC* lex, attr_id_t feat_name) noexcept nogil: + * if feat_name < (sizeof(flags_t) * 8): # <<<<<<<<<<<<<< + * if Lexeme.c_check_flag(lex, feat_name): + * return 1 +*/ + } + + /* "lexeme.pxd":63 + * else: + * return 0 + * elif feat_name == ID: # <<<<<<<<<<<<<< + * return lex.id + * elif feat_name == ORTH: +*/ + __pyx_t_1 = (__pyx_v_feat_name == __pyx_e_5spacy_5attrs_ID); + if (__pyx_t_1) { + + /* "lexeme.pxd":64 + * return 0 + * elif feat_name == ID: + * return lex.id # <<<<<<<<<<<<<< + * elif feat_name == ORTH: + * return lex.orth +*/ + __pyx_r = __pyx_v_lex->id; + goto __pyx_L0; + + /* "lexeme.pxd":63 + * else: + * return 0 + * elif feat_name == ID: # <<<<<<<<<<<<<< + * return lex.id + * elif feat_name == ORTH: +*/ + } + + /* "lexeme.pxd":65 + * elif feat_name == ID: + * return lex.id + * elif feat_name == ORTH: # <<<<<<<<<<<<<< + * return lex.orth + * elif feat_name == LOWER: +*/ + __pyx_t_1 = (__pyx_v_feat_name == __pyx_e_5spacy_5attrs_ORTH); + if (__pyx_t_1) { + + /* "lexeme.pxd":66 + * return lex.id + * elif feat_name == ORTH: + * return lex.orth # <<<<<<<<<<<<<< + * elif feat_name == LOWER: + * return lex.lower +*/ + __pyx_r = __pyx_v_lex->orth; + goto __pyx_L0; + + /* "lexeme.pxd":65 + * elif feat_name == ID: + * return lex.id + * elif feat_name == ORTH: # <<<<<<<<<<<<<< + * return lex.orth + * elif feat_name == LOWER: +*/ + } + + /* "lexeme.pxd":67 + * elif feat_name == ORTH: + * return lex.orth + * elif feat_name == LOWER: # <<<<<<<<<<<<<< + * return lex.lower + * elif feat_name == NORM: +*/ + __pyx_t_1 = (__pyx_v_feat_name == __pyx_e_5spacy_5attrs_LOWER); + if (__pyx_t_1) { + + /* "lexeme.pxd":68 + * return lex.orth + * elif feat_name == LOWER: + * return lex.lower # <<<<<<<<<<<<<< + * elif feat_name == NORM: + * return lex.norm +*/ + __pyx_r = __pyx_v_lex->lower; + goto __pyx_L0; + + /* "lexeme.pxd":67 + * elif feat_name == ORTH: + * return lex.orth + * elif feat_name == LOWER: # <<<<<<<<<<<<<< + * return lex.lower + * elif feat_name == NORM: +*/ + } + + /* "lexeme.pxd":69 + * elif feat_name == LOWER: + * return lex.lower + * elif feat_name == NORM: # <<<<<<<<<<<<<< + * return lex.norm + * elif feat_name == SHAPE: +*/ + __pyx_t_1 = (__pyx_v_feat_name == __pyx_e_5spacy_5attrs_NORM); + if (__pyx_t_1) { + + /* "lexeme.pxd":70 + * return lex.lower + * elif feat_name == NORM: + * return lex.norm # <<<<<<<<<<<<<< + * elif feat_name == SHAPE: + * return lex.shape +*/ + __pyx_r = __pyx_v_lex->norm; + goto __pyx_L0; + + /* "lexeme.pxd":69 + * elif feat_name == LOWER: + * return lex.lower + * elif feat_name == NORM: # <<<<<<<<<<<<<< + * return lex.norm + * elif feat_name == SHAPE: +*/ + } + + /* "lexeme.pxd":71 + * elif feat_name == NORM: + * return lex.norm + * elif feat_name == SHAPE: # <<<<<<<<<<<<<< + * return lex.shape + * elif feat_name == PREFIX: +*/ + __pyx_t_1 = (__pyx_v_feat_name == __pyx_e_5spacy_5attrs_SHAPE); + if (__pyx_t_1) { + + /* "lexeme.pxd":72 + * return lex.norm + * elif feat_name == SHAPE: + * return lex.shape # <<<<<<<<<<<<<< + * elif feat_name == PREFIX: + * return lex.prefix +*/ + __pyx_r = __pyx_v_lex->shape; + goto __pyx_L0; + + /* "lexeme.pxd":71 + * elif feat_name == NORM: + * return lex.norm + * elif feat_name == SHAPE: # <<<<<<<<<<<<<< + * return lex.shape + * elif feat_name == PREFIX: +*/ + } + + /* "lexeme.pxd":73 + * elif feat_name == SHAPE: + * return lex.shape + * elif feat_name == PREFIX: # <<<<<<<<<<<<<< + * return lex.prefix + * elif feat_name == SUFFIX: +*/ + __pyx_t_1 = (__pyx_v_feat_name == __pyx_e_5spacy_5attrs_PREFIX); + if (__pyx_t_1) { + + /* "lexeme.pxd":74 + * return lex.shape + * elif feat_name == PREFIX: + * return lex.prefix # <<<<<<<<<<<<<< + * elif feat_name == SUFFIX: + * return lex.suffix +*/ + __pyx_r = __pyx_v_lex->prefix; + goto __pyx_L0; + + /* "lexeme.pxd":73 + * elif feat_name == SHAPE: + * return lex.shape + * elif feat_name == PREFIX: # <<<<<<<<<<<<<< + * return lex.prefix + * elif feat_name == SUFFIX: +*/ + } + + /* "lexeme.pxd":75 + * elif feat_name == PREFIX: + * return lex.prefix + * elif feat_name == SUFFIX: # <<<<<<<<<<<<<< + * return lex.suffix + * elif feat_name == LENGTH: +*/ + __pyx_t_1 = (__pyx_v_feat_name == __pyx_e_5spacy_5attrs_SUFFIX); + if (__pyx_t_1) { + + /* "lexeme.pxd":76 + * return lex.prefix + * elif feat_name == SUFFIX: + * return lex.suffix # <<<<<<<<<<<<<< + * elif feat_name == LENGTH: + * return lex.length +*/ + __pyx_r = __pyx_v_lex->suffix; + goto __pyx_L0; + + /* "lexeme.pxd":75 + * elif feat_name == PREFIX: + * return lex.prefix + * elif feat_name == SUFFIX: # <<<<<<<<<<<<<< + * return lex.suffix + * elif feat_name == LENGTH: +*/ + } + + /* "lexeme.pxd":77 + * elif feat_name == SUFFIX: + * return lex.suffix + * elif feat_name == LENGTH: # <<<<<<<<<<<<<< + * return lex.length + * elif feat_name == LANG: +*/ + __pyx_t_1 = (__pyx_v_feat_name == __pyx_e_5spacy_5attrs_LENGTH); + if (__pyx_t_1) { + + /* "lexeme.pxd":78 + * return lex.suffix + * elif feat_name == LENGTH: + * return lex.length # <<<<<<<<<<<<<< + * elif feat_name == LANG: + * return lex.lang +*/ + __pyx_r = __pyx_v_lex->length; + goto __pyx_L0; + + /* "lexeme.pxd":77 + * elif feat_name == SUFFIX: + * return lex.suffix + * elif feat_name == LENGTH: # <<<<<<<<<<<<<< + * return lex.length + * elif feat_name == LANG: +*/ + } + + /* "lexeme.pxd":79 + * elif feat_name == LENGTH: + * return lex.length + * elif feat_name == LANG: # <<<<<<<<<<<<<< + * return lex.lang + * else: +*/ + __pyx_t_1 = (__pyx_v_feat_name == __pyx_e_5spacy_5attrs_LANG); + if (__pyx_t_1) { + + /* "lexeme.pxd":80 + * return lex.length + * elif feat_name == LANG: + * return lex.lang # <<<<<<<<<<<<<< + * else: + * return 0 +*/ + __pyx_r = __pyx_v_lex->lang; + goto __pyx_L0; + + /* "lexeme.pxd":79 + * elif feat_name == LENGTH: + * return lex.length + * elif feat_name == LANG: # <<<<<<<<<<<<<< + * return lex.lang + * else: +*/ + } + + /* "lexeme.pxd":82 + * return lex.lang + * else: + * return 0 # <<<<<<<<<<<<<< + * + * @staticmethod +*/ + /*else*/ { + __pyx_r = 0; + goto __pyx_L0; + } + + /* "lexeme.pxd":56 + * lex.lang = value + * + * @staticmethod # <<<<<<<<<<<<<< + * cdef inline attr_t get_struct_attr(const LexemeC* lex, attr_id_t feat_name) noexcept nogil: + * if feat_name < (sizeof(flags_t) * 8): +*/ + + /* function exit code */ + __pyx_L0:; + return __pyx_r; +} + +/* "lexeme.pxd":84 + * return 0 + * + * @staticmethod # <<<<<<<<<<<<<< + * cdef inline bint c_check_flag(const LexemeC* lexeme, attr_id_t flag_id) noexcept nogil: + * cdef flags_t one = 1 +*/ + +static CYTHON_INLINE int __pyx_f_5spacy_6lexeme_6Lexeme_c_check_flag(struct __pyx_t_5spacy_7structs_LexemeC const *__pyx_v_lexeme, enum __pyx_t_5spacy_5attrs_attr_id_t __pyx_v_flag_id) { + __pyx_t_5spacy_8typedefs_flags_t __pyx_v_one; + int __pyx_r; + int __pyx_t_1; + + /* "lexeme.pxd":86 + * @staticmethod + * cdef inline bint c_check_flag(const LexemeC* lexeme, attr_id_t flag_id) noexcept nogil: + * cdef flags_t one = 1 # <<<<<<<<<<<<<< + * if lexeme.flags & (one << flag_id): + * return True +*/ + __pyx_v_one = 1; + + /* "lexeme.pxd":87 + * cdef inline bint c_check_flag(const LexemeC* lexeme, attr_id_t flag_id) noexcept nogil: + * cdef flags_t one = 1 + * if lexeme.flags & (one << flag_id): # <<<<<<<<<<<<<< + * return True + * else: +*/ + __pyx_t_1 = ((__pyx_v_lexeme->flags & (__pyx_v_one << __pyx_v_flag_id)) != 0); + if (__pyx_t_1) { + + /* "lexeme.pxd":88 + * cdef flags_t one = 1 + * if lexeme.flags & (one << flag_id): + * return True # <<<<<<<<<<<<<< + * else: + * return False +*/ + __pyx_r = 1; + goto __pyx_L0; + + /* "lexeme.pxd":87 + * cdef inline bint c_check_flag(const LexemeC* lexeme, attr_id_t flag_id) noexcept nogil: + * cdef flags_t one = 1 + * if lexeme.flags & (one << flag_id): # <<<<<<<<<<<<<< + * return True + * else: +*/ + } + + /* "lexeme.pxd":90 + * return True + * else: + * return False # <<<<<<<<<<<<<< + * + * @staticmethod +*/ + /*else*/ { + __pyx_r = 0; + goto __pyx_L0; + } + + /* "lexeme.pxd":84 + * return 0 + * + * @staticmethod # <<<<<<<<<<<<<< + * cdef inline bint c_check_flag(const LexemeC* lexeme, attr_id_t flag_id) noexcept nogil: + * cdef flags_t one = 1 +*/ + + /* function exit code */ + __pyx_L0:; + return __pyx_r; +} + +/* "lexeme.pxd":92 + * return False + * + * @staticmethod # <<<<<<<<<<<<<< + * cdef inline bint c_set_flag(LexemeC* lex, attr_id_t flag_id, bint value) noexcept nogil: + * cdef flags_t one = 1 +*/ + +static CYTHON_INLINE int __pyx_f_5spacy_6lexeme_6Lexeme_c_set_flag(struct __pyx_t_5spacy_7structs_LexemeC *__pyx_v_lex, enum __pyx_t_5spacy_5attrs_attr_id_t __pyx_v_flag_id, int __pyx_v_value) { + __pyx_t_5spacy_8typedefs_flags_t __pyx_v_one; + int __pyx_r; + + /* "lexeme.pxd":94 + * @staticmethod + * cdef inline bint c_set_flag(LexemeC* lex, attr_id_t flag_id, bint value) noexcept nogil: + * cdef flags_t one = 1 # <<<<<<<<<<<<<< + * if value: + * lex.flags |= one << flag_id +*/ + __pyx_v_one = 1; + + /* "lexeme.pxd":95 + * cdef inline bint c_set_flag(LexemeC* lex, attr_id_t flag_id, bint value) noexcept nogil: + * cdef flags_t one = 1 + * if value: # <<<<<<<<<<<<<< + * lex.flags |= one << flag_id + * else: +*/ + if (__pyx_v_value) { + + /* "lexeme.pxd":96 + * cdef flags_t one = 1 + * if value: + * lex.flags |= one << flag_id # <<<<<<<<<<<<<< + * else: + * lex.flags &= ~(one << flag_id) +*/ + __pyx_v_lex->flags = (__pyx_v_lex->flags | (__pyx_v_one << __pyx_v_flag_id)); + + /* "lexeme.pxd":95 + * cdef inline bint c_set_flag(LexemeC* lex, attr_id_t flag_id, bint value) noexcept nogil: + * cdef flags_t one = 1 + * if value: # <<<<<<<<<<<<<< + * lex.flags |= one << flag_id + * else: +*/ + goto __pyx_L3; + } + + /* "lexeme.pxd":98 + * lex.flags |= one << flag_id + * else: + * lex.flags &= ~(one << flag_id) # <<<<<<<<<<<<<< +*/ + /*else*/ { + __pyx_v_lex->flags = (__pyx_v_lex->flags & (~(__pyx_v_one << __pyx_v_flag_id))); + } + __pyx_L3:; + + /* "lexeme.pxd":92 + * return False + * + * @staticmethod # <<<<<<<<<<<<<< + * cdef inline bint c_set_flag(LexemeC* lex, attr_id_t flag_id, bint value) noexcept nogil: + * cdef flags_t one = 1 +*/ + + /* function exit code */ + __pyx_r = 0; + return __pyx_r; +} + +/* "_state.pxd":20 + * + * + * cdef inline bint is_space_token(const TokenC* token) noexcept nogil: # <<<<<<<<<<<<<< + * return Lexeme.c_check_flag(token.lex, IS_SPACE) + * +*/ + +static CYTHON_INLINE int __pyx_f_5spacy_8pipeline_17_parser_internals_6_state_is_space_token(struct __pyx_t_5spacy_7structs_TokenC const *__pyx_v_token) { + int __pyx_r; + + /* "_state.pxd":21 + * + * cdef inline bint is_space_token(const TokenC* token) noexcept nogil: + * return Lexeme.c_check_flag(token.lex, IS_SPACE) # <<<<<<<<<<<<<< + * + * cdef struct ArcC: +*/ + __pyx_r = __pyx_f_5spacy_6lexeme_6Lexeme_c_check_flag(__pyx_v_token->lex, __pyx_e_5spacy_5attrs_IS_SPACE); + goto __pyx_L0; + + /* "_state.pxd":20 + * + * + * cdef inline bint is_space_token(const TokenC* token) noexcept nogil: # <<<<<<<<<<<<<< + * return Lexeme.c_check_flag(token.lex, IS_SPACE) + * +*/ + + /* function exit code */ + __pyx_L0:; + return __pyx_r; +} + +/* "_state.pxd":44 + * int _b_i + * + * inline __init__(const TokenC* sent, int length) noexcept nogil: # <<<<<<<<<<<<<< + * this._sent = sent + * this._heads = calloc(length, sizeof(int)) +*/ + +void __pyx_t_5spacy_8pipeline_17_parser_internals_6_state_StateC::__pyx_f___init__StateC(struct __pyx_t_5spacy_7structs_TokenC const *__pyx_v_sent, int __pyx_v_length) { + int __pyx_v_i; + int __pyx_t_1; + int __pyx_t_2; + PyObject *__pyx_t_3; + int __pyx_t_4; + int __pyx_t_5; + int __pyx_t_6; + int __pyx_lineno = 0; + const char *__pyx_filename = NULL; + int __pyx_clineno = 0; + PyGILState_STATE __pyx_gilstate_save; + + /* "_state.pxd":45 + * + * inline __init__(const TokenC* sent, int length) noexcept nogil: + * this._sent = sent # <<<<<<<<<<<<<< + * this._heads = calloc(length, sizeof(int)) + * if not (this._sent and this._heads): +*/ + this->_sent = __pyx_v_sent; + + /* "_state.pxd":46 + * inline __init__(const TokenC* sent, int length) noexcept nogil: + * this._sent = sent + * this._heads = calloc(length, sizeof(int)) # <<<<<<<<<<<<<< + * if not (this._sent and this._heads): + * with gil: +*/ + this->_heads = ((int *)calloc(__pyx_v_length, (sizeof(int)))); + + /* "_state.pxd":47 + * this._sent = sent + * this._heads = calloc(length, sizeof(int)) + * if not (this._sent and this._heads): # <<<<<<<<<<<<<< + * with gil: + * PyErr_SetFromErrno(MemoryError) +*/ + __pyx_t_2 = (this->_sent != 0); + if (__pyx_t_2) { + } else { + __pyx_t_1 = __pyx_t_2; + goto __pyx_L4_bool_binop_done; + } + __pyx_t_2 = (this->_heads != 0); + __pyx_t_1 = __pyx_t_2; + __pyx_L4_bool_binop_done:; + __pyx_t_2 = (!__pyx_t_1); + if (__pyx_t_2) { + + /* "_state.pxd":48 + * this._heads = calloc(length, sizeof(int)) + * if not (this._sent and this._heads): + * with gil: # <<<<<<<<<<<<<< + * PyErr_SetFromErrno(MemoryError) + * PyErr_CheckSignals() +*/ + { + PyGILState_STATE __pyx_gilstate_save = __Pyx_PyGILState_Ensure(); + /*try:*/ { + + /* "_state.pxd":49 + * if not (this._sent and this._heads): + * with gil: + * PyErr_SetFromErrno(MemoryError) # <<<<<<<<<<<<<< + * PyErr_CheckSignals() + * this.offset = 0 +*/ + __pyx_t_3 = PyErr_SetFromErrno(((PyObject *)(((PyTypeObject*)PyExc_MemoryError)))); if (unlikely(__pyx_t_3 == ((void *)NULL))) __PYX_ERR(4, 49, __pyx_L7_error) + + /* "_state.pxd":50 + * with gil: + * PyErr_SetFromErrno(MemoryError) + * PyErr_CheckSignals() # <<<<<<<<<<<<<< + * this.offset = 0 + * this.length = length +*/ + __pyx_t_4 = PyErr_CheckSignals(); if (unlikely(__pyx_t_4 == ((int)-1))) __PYX_ERR(4, 50, __pyx_L7_error) + } + + /* "_state.pxd":48 + * this._heads = calloc(length, sizeof(int)) + * if not (this._sent and this._heads): + * with gil: # <<<<<<<<<<<<<< + * PyErr_SetFromErrno(MemoryError) + * PyErr_CheckSignals() +*/ + /*finally:*/ { + /*normal exit:*/{ + __Pyx_PyGILState_Release(__pyx_gilstate_save); + goto __pyx_L8; + } + __pyx_L7_error: { + __Pyx_PyGILState_Release(__pyx_gilstate_save); + goto __pyx_L1_error; + } + __pyx_L8:; + } + } + + /* "_state.pxd":47 + * this._sent = sent + * this._heads = calloc(length, sizeof(int)) + * if not (this._sent and this._heads): # <<<<<<<<<<<<<< + * with gil: + * PyErr_SetFromErrno(MemoryError) +*/ + } + + /* "_state.pxd":51 + * PyErr_SetFromErrno(MemoryError) + * PyErr_CheckSignals() + * this.offset = 0 # <<<<<<<<<<<<<< + * this.length = length + * this._b_i = 0 +*/ + this->offset = 0; + + /* "_state.pxd":52 + * PyErr_CheckSignals() + * this.offset = 0 + * this.length = length # <<<<<<<<<<<<<< + * this._b_i = 0 + * for i in range(length): +*/ + this->length = __pyx_v_length; + + /* "_state.pxd":53 + * this.offset = 0 + * this.length = length + * this._b_i = 0 # <<<<<<<<<<<<<< + * for i in range(length): + * this._heads[i] = -1 +*/ + this->_b_i = 0; + + /* "_state.pxd":54 + * this.length = length + * this._b_i = 0 + * for i in range(length): # <<<<<<<<<<<<<< + * this._heads[i] = -1 + * this._unshiftable.push_back(0) +*/ + __pyx_t_4 = __pyx_v_length; + __pyx_t_5 = __pyx_t_4; + for (__pyx_t_6 = 0; __pyx_t_6 < __pyx_t_5; __pyx_t_6+=1) { + __pyx_v_i = __pyx_t_6; + + /* "_state.pxd":55 + * this._b_i = 0 + * for i in range(length): + * this._heads[i] = -1 # <<<<<<<<<<<<<< + * this._unshiftable.push_back(0) + * memset(&this._empty_token, 0, sizeof(TokenC)) +*/ + (this->_heads[__pyx_v_i]) = -1; + + /* "_state.pxd":56 + * for i in range(length): + * this._heads[i] = -1 + * this._unshiftable.push_back(0) # <<<<<<<<<<<<<< + * memset(&this._empty_token, 0, sizeof(TokenC)) + * this._empty_token.lex = &EMPTY_LEXEME +*/ + try { + this->_unshiftable.push_back(0); + } catch(...) { + PyGILState_STATE __pyx_gilstate_save = __Pyx_PyGILState_Ensure(); + __Pyx_CppExn2PyErr(); + __Pyx_PyGILState_Release(__pyx_gilstate_save); + __PYX_ERR(4, 56, __pyx_L1_error) + } + } + + /* "_state.pxd":57 + * this._heads[i] = -1 + * this._unshiftable.push_back(0) + * memset(&this._empty_token, 0, sizeof(TokenC)) # <<<<<<<<<<<<<< + * this._empty_token.lex = &EMPTY_LEXEME + * +*/ + (void)(memset((&this->_empty_token), 0, (sizeof(struct __pyx_t_5spacy_7structs_TokenC)))); + + /* "_state.pxd":58 + * this._unshiftable.push_back(0) + * memset(&this._empty_token, 0, sizeof(TokenC)) + * this._empty_token.lex = &EMPTY_LEXEME # <<<<<<<<<<<<<< + * + * inline __dealloc__(): +*/ + this->_empty_token.lex = (&__pyx_v_5spacy_5vocab_EMPTY_LEXEME); + + /* "_state.pxd":44 + * int _b_i + * + * inline __init__(const TokenC* sent, int length) noexcept nogil: # <<<<<<<<<<<<<< + * this._sent = sent + * this._heads = calloc(length, sizeof(int)) +*/ + + /* function exit code */ + goto __pyx_L0; + __pyx_L1_error:; + __pyx_gilstate_save = __Pyx_PyGILState_Ensure(); + __Pyx_WriteUnraisable("StateC.", __pyx_clineno, __pyx_lineno, __pyx_filename, 1, 0); + __Pyx_PyGILState_Release(__pyx_gilstate_save); + __pyx_L0:; +} + +/* "_state.pxd":60 + * this._empty_token.lex = &EMPTY_LEXEME + * + * inline __dealloc__(): # <<<<<<<<<<<<<< + * free(this._heads) + * +*/ + +void __pyx_t_5spacy_8pipeline_17_parser_internals_6_state_StateC::__pyx_f___dealloc__StateC(void) { + + /* "_state.pxd":61 + * + * inline __dealloc__(): + * free(this._heads) # <<<<<<<<<<<<<< + * + * inline void set_context_tokens(int* ids, int n) noexcept nogil: +*/ + free(this->_heads); + + /* "_state.pxd":60 + * this._empty_token.lex = &EMPTY_LEXEME + * + * inline __dealloc__(): # <<<<<<<<<<<<<< + * free(this._heads) + * +*/ + + /* function exit code */ +} + +/* "_state.pxd":63 + * free(this._heads) + * + * inline void set_context_tokens(int* ids, int n) noexcept nogil: # <<<<<<<<<<<<<< + * cdef int i, j + * if n == 1: +*/ + +void __pyx_t_5spacy_8pipeline_17_parser_internals_6_state_StateC::set_context_tokens(int *__pyx_v_ids, int __pyx_v_n) { + int __pyx_v_i; + int __pyx_v_j; + struct __pyx_t_5spacy_7structs_SpanC __pyx_v_ent; + int __pyx_t_1; + int __pyx_t_2; + int __pyx_t_3; + int __pyx_t_4; + int __pyx_t_5; + int __pyx_t_6; + + /* "_state.pxd":65 + * inline void set_context_tokens(int* ids, int n) noexcept nogil: + * cdef int i, j + * if n == 1: # <<<<<<<<<<<<<< + * if this.B(0) >= 0: + * ids[0] = this.B(0) +*/ + switch (__pyx_v_n) { + case 1: + + /* "_state.pxd":66 + * cdef int i, j + * if n == 1: + * if this.B(0) >= 0: # <<<<<<<<<<<<<< + * ids[0] = this.B(0) + * else: +*/ + __pyx_t_1 = (this->B(0) >= 0); + if (__pyx_t_1) { + + /* "_state.pxd":67 + * if n == 1: + * if this.B(0) >= 0: + * ids[0] = this.B(0) # <<<<<<<<<<<<<< + * else: + * ids[0] = -1 +*/ + (__pyx_v_ids[0]) = this->B(0); + + /* "_state.pxd":66 + * cdef int i, j + * if n == 1: + * if this.B(0) >= 0: # <<<<<<<<<<<<<< + * ids[0] = this.B(0) + * else: +*/ + goto __pyx_L3; + } + + /* "_state.pxd":69 + * ids[0] = this.B(0) + * else: + * ids[0] = -1 # <<<<<<<<<<<<<< + * elif n == 2: + * ids[0] = this.B(0) +*/ + /*else*/ { + (__pyx_v_ids[0]) = -1; + } + __pyx_L3:; + + /* "_state.pxd":65 + * inline void set_context_tokens(int* ids, int n) noexcept nogil: + * cdef int i, j + * if n == 1: # <<<<<<<<<<<<<< + * if this.B(0) >= 0: + * ids[0] = this.B(0) +*/ + break; + case 2: + + /* "_state.pxd":71 + * ids[0] = -1 + * elif n == 2: + * ids[0] = this.B(0) # <<<<<<<<<<<<<< + * ids[1] = this.S(0) + * elif n == 3: +*/ + (__pyx_v_ids[0]) = this->B(0); + + /* "_state.pxd":72 + * elif n == 2: + * ids[0] = this.B(0) + * ids[1] = this.S(0) # <<<<<<<<<<<<<< + * elif n == 3: + * if this.B(0) >= 0: +*/ + (__pyx_v_ids[1]) = this->S(0); + + /* "_state.pxd":70 + * else: + * ids[0] = -1 + * elif n == 2: # <<<<<<<<<<<<<< + * ids[0] = this.B(0) + * ids[1] = this.S(0) +*/ + break; + case 3: + + /* "_state.pxd":74 + * ids[1] = this.S(0) + * elif n == 3: + * if this.B(0) >= 0: # <<<<<<<<<<<<<< + * ids[0] = this.B(0) + * else: +*/ + __pyx_t_1 = (this->B(0) >= 0); + if (__pyx_t_1) { + + /* "_state.pxd":75 + * elif n == 3: + * if this.B(0) >= 0: + * ids[0] = this.B(0) # <<<<<<<<<<<<<< + * else: + * ids[0] = -1 +*/ + (__pyx_v_ids[0]) = this->B(0); + + /* "_state.pxd":74 + * ids[1] = this.S(0) + * elif n == 3: + * if this.B(0) >= 0: # <<<<<<<<<<<<<< + * ids[0] = this.B(0) + * else: +*/ + goto __pyx_L4; + } + + /* "_state.pxd":77 + * ids[0] = this.B(0) + * else: + * ids[0] = -1 # <<<<<<<<<<<<<< + * # First word of entity, if any + * if this.entity_is_open(): +*/ + /*else*/ { + (__pyx_v_ids[0]) = -1; + } + __pyx_L4:; + + /* "_state.pxd":79 + * ids[0] = -1 + * # First word of entity, if any + * if this.entity_is_open(): # <<<<<<<<<<<<<< + * ids[1] = this.E(0) + * else: +*/ + __pyx_t_1 = this->entity_is_open(); + if (__pyx_t_1) { + + /* "_state.pxd":80 + * # First word of entity, if any + * if this.entity_is_open(): + * ids[1] = this.E(0) # <<<<<<<<<<<<<< + * else: + * ids[1] = -1 +*/ + (__pyx_v_ids[1]) = this->E(0); + + /* "_state.pxd":79 + * ids[0] = -1 + * # First word of entity, if any + * if this.entity_is_open(): # <<<<<<<<<<<<<< + * ids[1] = this.E(0) + * else: +*/ + goto __pyx_L5; + } + + /* "_state.pxd":82 + * ids[1] = this.E(0) + * else: + * ids[1] = -1 # <<<<<<<<<<<<<< + * # Last word of entity, if within entity + * if ids[0] == -1 or ids[1] == -1: +*/ + /*else*/ { + (__pyx_v_ids[1]) = -1; + } + __pyx_L5:; + + /* "_state.pxd":84 + * ids[1] = -1 + * # Last word of entity, if within entity + * if ids[0] == -1 or ids[1] == -1: # <<<<<<<<<<<<<< + * ids[2] = -1 + * else: +*/ + __pyx_t_2 = ((__pyx_v_ids[0]) == -1L); + if (!__pyx_t_2) { + } else { + __pyx_t_1 = __pyx_t_2; + goto __pyx_L7_bool_binop_done; + } + __pyx_t_2 = ((__pyx_v_ids[1]) == -1L); + __pyx_t_1 = __pyx_t_2; + __pyx_L7_bool_binop_done:; + if (__pyx_t_1) { + + /* "_state.pxd":85 + * # Last word of entity, if within entity + * if ids[0] == -1 or ids[1] == -1: + * ids[2] = -1 # <<<<<<<<<<<<<< + * else: + * ids[2] = ids[0] - 1 +*/ + (__pyx_v_ids[2]) = -1; + + /* "_state.pxd":84 + * ids[1] = -1 + * # Last word of entity, if within entity + * if ids[0] == -1 or ids[1] == -1: # <<<<<<<<<<<<<< + * ids[2] = -1 + * else: +*/ + goto __pyx_L6; + } + + /* "_state.pxd":87 + * ids[2] = -1 + * else: + * ids[2] = ids[0] - 1 # <<<<<<<<<<<<<< + * elif n == 8: + * ids[0] = this.B(0) +*/ + /*else*/ { + (__pyx_v_ids[2]) = ((__pyx_v_ids[0]) - 1); + } + __pyx_L6:; + + /* "_state.pxd":73 + * ids[0] = this.B(0) + * ids[1] = this.S(0) + * elif n == 3: # <<<<<<<<<<<<<< + * if this.B(0) >= 0: + * ids[0] = this.B(0) +*/ + break; + case 8: + + /* "_state.pxd":89 + * ids[2] = ids[0] - 1 + * elif n == 8: + * ids[0] = this.B(0) # <<<<<<<<<<<<<< + * ids[1] = this.B(1) + * ids[2] = this.S(0) +*/ + (__pyx_v_ids[0]) = this->B(0); + + /* "_state.pxd":90 + * elif n == 8: + * ids[0] = this.B(0) + * ids[1] = this.B(1) # <<<<<<<<<<<<<< + * ids[2] = this.S(0) + * ids[3] = this.S(1) +*/ + (__pyx_v_ids[1]) = this->B(1); + + /* "_state.pxd":91 + * ids[0] = this.B(0) + * ids[1] = this.B(1) + * ids[2] = this.S(0) # <<<<<<<<<<<<<< + * ids[3] = this.S(1) + * ids[4] = this.S(2) +*/ + (__pyx_v_ids[2]) = this->S(0); + + /* "_state.pxd":92 + * ids[1] = this.B(1) + * ids[2] = this.S(0) + * ids[3] = this.S(1) # <<<<<<<<<<<<<< + * ids[4] = this.S(2) + * ids[5] = this.L(this.B(0), 1) +*/ + (__pyx_v_ids[3]) = this->S(1); + + /* "_state.pxd":93 + * ids[2] = this.S(0) + * ids[3] = this.S(1) + * ids[4] = this.S(2) # <<<<<<<<<<<<<< + * ids[5] = this.L(this.B(0), 1) + * ids[6] = this.L(this.S(0), 1) +*/ + (__pyx_v_ids[4]) = this->S(2); + + /* "_state.pxd":94 + * ids[3] = this.S(1) + * ids[4] = this.S(2) + * ids[5] = this.L(this.B(0), 1) # <<<<<<<<<<<<<< + * ids[6] = this.L(this.S(0), 1) + * ids[7] = this.R(this.S(0), 1) +*/ + (__pyx_v_ids[5]) = this->L(this->B(0), 1); + + /* "_state.pxd":95 + * ids[4] = this.S(2) + * ids[5] = this.L(this.B(0), 1) + * ids[6] = this.L(this.S(0), 1) # <<<<<<<<<<<<<< + * ids[7] = this.R(this.S(0), 1) + * elif n == 13: +*/ + (__pyx_v_ids[6]) = this->L(this->S(0), 1); + + /* "_state.pxd":96 + * ids[5] = this.L(this.B(0), 1) + * ids[6] = this.L(this.S(0), 1) + * ids[7] = this.R(this.S(0), 1) # <<<<<<<<<<<<<< + * elif n == 13: + * ids[0] = this.B(0) +*/ + (__pyx_v_ids[7]) = this->R(this->S(0), 1); + + /* "_state.pxd":88 + * else: + * ids[2] = ids[0] - 1 + * elif n == 8: # <<<<<<<<<<<<<< + * ids[0] = this.B(0) + * ids[1] = this.B(1) +*/ + break; + case 13: + + /* "_state.pxd":98 + * ids[7] = this.R(this.S(0), 1) + * elif n == 13: + * ids[0] = this.B(0) # <<<<<<<<<<<<<< + * ids[1] = this.B(1) + * ids[2] = this.S(0) +*/ + (__pyx_v_ids[0]) = this->B(0); + + /* "_state.pxd":99 + * elif n == 13: + * ids[0] = this.B(0) + * ids[1] = this.B(1) # <<<<<<<<<<<<<< + * ids[2] = this.S(0) + * ids[3] = this.S(1) +*/ + (__pyx_v_ids[1]) = this->B(1); + + /* "_state.pxd":100 + * ids[0] = this.B(0) + * ids[1] = this.B(1) + * ids[2] = this.S(0) # <<<<<<<<<<<<<< + * ids[3] = this.S(1) + * ids[4] = this.S(2) +*/ + (__pyx_v_ids[2]) = this->S(0); + + /* "_state.pxd":101 + * ids[1] = this.B(1) + * ids[2] = this.S(0) + * ids[3] = this.S(1) # <<<<<<<<<<<<<< + * ids[4] = this.S(2) + * ids[5] = this.L(this.S(0), 1) +*/ + (__pyx_v_ids[3]) = this->S(1); + + /* "_state.pxd":102 + * ids[2] = this.S(0) + * ids[3] = this.S(1) + * ids[4] = this.S(2) # <<<<<<<<<<<<<< + * ids[5] = this.L(this.S(0), 1) + * ids[6] = this.L(this.S(0), 2) +*/ + (__pyx_v_ids[4]) = this->S(2); + + /* "_state.pxd":103 + * ids[3] = this.S(1) + * ids[4] = this.S(2) + * ids[5] = this.L(this.S(0), 1) # <<<<<<<<<<<<<< + * ids[6] = this.L(this.S(0), 2) + * ids[6] = this.R(this.S(0), 1) +*/ + (__pyx_v_ids[5]) = this->L(this->S(0), 1); + + /* "_state.pxd":104 + * ids[4] = this.S(2) + * ids[5] = this.L(this.S(0), 1) + * ids[6] = this.L(this.S(0), 2) # <<<<<<<<<<<<<< + * ids[6] = this.R(this.S(0), 1) + * ids[7] = this.L(this.B(0), 1) +*/ + (__pyx_v_ids[6]) = this->L(this->S(0), 2); + + /* "_state.pxd":105 + * ids[5] = this.L(this.S(0), 1) + * ids[6] = this.L(this.S(0), 2) + * ids[6] = this.R(this.S(0), 1) # <<<<<<<<<<<<<< + * ids[7] = this.L(this.B(0), 1) + * ids[8] = this.R(this.S(0), 2) +*/ + (__pyx_v_ids[6]) = this->R(this->S(0), 1); + + /* "_state.pxd":106 + * ids[6] = this.L(this.S(0), 2) + * ids[6] = this.R(this.S(0), 1) + * ids[7] = this.L(this.B(0), 1) # <<<<<<<<<<<<<< + * ids[8] = this.R(this.S(0), 2) + * ids[9] = this.L(this.S(1), 1) +*/ + (__pyx_v_ids[7]) = this->L(this->B(0), 1); + + /* "_state.pxd":107 + * ids[6] = this.R(this.S(0), 1) + * ids[7] = this.L(this.B(0), 1) + * ids[8] = this.R(this.S(0), 2) # <<<<<<<<<<<<<< + * ids[9] = this.L(this.S(1), 1) + * ids[10] = this.L(this.S(1), 2) +*/ + (__pyx_v_ids[8]) = this->R(this->S(0), 2); + + /* "_state.pxd":108 + * ids[7] = this.L(this.B(0), 1) + * ids[8] = this.R(this.S(0), 2) + * ids[9] = this.L(this.S(1), 1) # <<<<<<<<<<<<<< + * ids[10] = this.L(this.S(1), 2) + * ids[11] = this.R(this.S(1), 1) +*/ + (__pyx_v_ids[9]) = this->L(this->S(1), 1); + + /* "_state.pxd":109 + * ids[8] = this.R(this.S(0), 2) + * ids[9] = this.L(this.S(1), 1) + * ids[10] = this.L(this.S(1), 2) # <<<<<<<<<<<<<< + * ids[11] = this.R(this.S(1), 1) + * ids[12] = this.R(this.S(1), 2) +*/ + (__pyx_v_ids[10]) = this->L(this->S(1), 2); + + /* "_state.pxd":110 + * ids[9] = this.L(this.S(1), 1) + * ids[10] = this.L(this.S(1), 2) + * ids[11] = this.R(this.S(1), 1) # <<<<<<<<<<<<<< + * ids[12] = this.R(this.S(1), 2) + * elif n == 6: +*/ + (__pyx_v_ids[11]) = this->R(this->S(1), 1); + + /* "_state.pxd":111 + * ids[10] = this.L(this.S(1), 2) + * ids[11] = this.R(this.S(1), 1) + * ids[12] = this.R(this.S(1), 2) # <<<<<<<<<<<<<< + * elif n == 6: + * for i in range(6): +*/ + (__pyx_v_ids[12]) = this->R(this->S(1), 2); + + /* "_state.pxd":97 + * ids[6] = this.L(this.S(0), 1) + * ids[7] = this.R(this.S(0), 1) + * elif n == 13: # <<<<<<<<<<<<<< + * ids[0] = this.B(0) + * ids[1] = this.B(1) +*/ + break; + case 6: + + /* "_state.pxd":113 + * ids[12] = this.R(this.S(1), 2) + * elif n == 6: + * for i in range(6): # <<<<<<<<<<<<<< + * ids[i] = -1 + * if this.B(0) >= 0: +*/ + for (__pyx_t_3 = 0; __pyx_t_3 < 6; __pyx_t_3+=1) { + __pyx_v_i = __pyx_t_3; + + /* "_state.pxd":114 + * elif n == 6: + * for i in range(6): + * ids[i] = -1 # <<<<<<<<<<<<<< + * if this.B(0) >= 0: + * ids[0] = this.B(0) +*/ + (__pyx_v_ids[__pyx_v_i]) = -1; + } + + /* "_state.pxd":115 + * for i in range(6): + * ids[i] = -1 + * if this.B(0) >= 0: # <<<<<<<<<<<<<< + * ids[0] = this.B(0) + * if this.entity_is_open(): +*/ + __pyx_t_1 = (this->B(0) >= 0); + if (__pyx_t_1) { + + /* "_state.pxd":116 + * ids[i] = -1 + * if this.B(0) >= 0: + * ids[0] = this.B(0) # <<<<<<<<<<<<<< + * if this.entity_is_open(): + * ent = this.get_ent() +*/ + (__pyx_v_ids[0]) = this->B(0); + + /* "_state.pxd":115 + * for i in range(6): + * ids[i] = -1 + * if this.B(0) >= 0: # <<<<<<<<<<<<<< + * ids[0] = this.B(0) + * if this.entity_is_open(): +*/ + } + + /* "_state.pxd":117 + * if this.B(0) >= 0: + * ids[0] = this.B(0) + * if this.entity_is_open(): # <<<<<<<<<<<<<< + * ent = this.get_ent() + * j = 1 +*/ + __pyx_t_1 = this->entity_is_open(); + if (__pyx_t_1) { + + /* "_state.pxd":118 + * ids[0] = this.B(0) + * if this.entity_is_open(): + * ent = this.get_ent() # <<<<<<<<<<<<<< + * j = 1 + * for i in range(ent.start, this.B(0)): +*/ + __pyx_v_ent = this->get_ent(); + + /* "_state.pxd":119 + * if this.entity_is_open(): + * ent = this.get_ent() + * j = 1 # <<<<<<<<<<<<<< + * for i in range(ent.start, this.B(0)): + * ids[j] = i +*/ + __pyx_v_j = 1; + + /* "_state.pxd":120 + * ent = this.get_ent() + * j = 1 + * for i in range(ent.start, this.B(0)): # <<<<<<<<<<<<<< + * ids[j] = i + * j += 1 +*/ + __pyx_t_3 = this->B(0); + __pyx_t_4 = __pyx_t_3; + for (__pyx_t_5 = __pyx_v_ent.start; __pyx_t_5 < __pyx_t_4; __pyx_t_5+=1) { + __pyx_v_i = __pyx_t_5; + + /* "_state.pxd":121 + * j = 1 + * for i in range(ent.start, this.B(0)): + * ids[j] = i # <<<<<<<<<<<<<< + * j += 1 + * if j >= 6: +*/ + (__pyx_v_ids[__pyx_v_j]) = __pyx_v_i; + + /* "_state.pxd":122 + * for i in range(ent.start, this.B(0)): + * ids[j] = i + * j += 1 # <<<<<<<<<<<<<< + * if j >= 6: + * break +*/ + __pyx_v_j = (__pyx_v_j + 1); + + /* "_state.pxd":123 + * ids[j] = i + * j += 1 + * if j >= 6: # <<<<<<<<<<<<<< + * break + * else: +*/ + __pyx_t_1 = (__pyx_v_j >= 6); + if (__pyx_t_1) { + + /* "_state.pxd":124 + * j += 1 + * if j >= 6: + * break # <<<<<<<<<<<<<< + * else: + * # TODO error =/ +*/ + goto __pyx_L14_break; + + /* "_state.pxd":123 + * ids[j] = i + * j += 1 + * if j >= 6: # <<<<<<<<<<<<<< + * break + * else: +*/ + } + } + __pyx_L14_break:; + + /* "_state.pxd":117 + * if this.B(0) >= 0: + * ids[0] = this.B(0) + * if this.entity_is_open(): # <<<<<<<<<<<<<< + * ent = this.get_ent() + * j = 1 +*/ + } + + /* "_state.pxd":112 + * ids[11] = this.R(this.S(1), 1) + * ids[12] = this.R(this.S(1), 2) + * elif n == 6: # <<<<<<<<<<<<<< + * for i in range(6): + * ids[i] = -1 +*/ + break; + default: + break; + } + + /* "_state.pxd":128 + * # TODO error =/ + * pass + * for i in range(n): # <<<<<<<<<<<<<< + * if ids[i] >= 0: + * ids[i] += this.offset +*/ + __pyx_t_3 = __pyx_v_n; + __pyx_t_4 = __pyx_t_3; + for (__pyx_t_5 = 0; __pyx_t_5 < __pyx_t_4; __pyx_t_5+=1) { + __pyx_v_i = __pyx_t_5; + + /* "_state.pxd":129 + * pass + * for i in range(n): + * if ids[i] >= 0: # <<<<<<<<<<<<<< + * ids[i] += this.offset + * else: +*/ + __pyx_t_1 = ((__pyx_v_ids[__pyx_v_i]) >= 0); + if (__pyx_t_1) { + + /* "_state.pxd":130 + * for i in range(n): + * if ids[i] >= 0: + * ids[i] += this.offset # <<<<<<<<<<<<<< + * else: + * ids[i] = -1 +*/ + __pyx_t_6 = __pyx_v_i; + (__pyx_v_ids[__pyx_t_6]) = ((__pyx_v_ids[__pyx_t_6]) + this->offset); + + /* "_state.pxd":129 + * pass + * for i in range(n): + * if ids[i] >= 0: # <<<<<<<<<<<<<< + * ids[i] += this.offset + * else: +*/ + goto __pyx_L18; + } + + /* "_state.pxd":132 + * ids[i] += this.offset + * else: + * ids[i] = -1 # <<<<<<<<<<<<<< + * + * inline int S(int i) noexcept nogil const: +*/ + /*else*/ { + (__pyx_v_ids[__pyx_v_i]) = -1; + } + __pyx_L18:; + } + + /* "_state.pxd":63 + * free(this._heads) + * + * inline void set_context_tokens(int* ids, int n) noexcept nogil: # <<<<<<<<<<<<<< + * cdef int i, j + * if n == 1: +*/ + + /* function exit code */ +} + +/* "_state.pxd":134 + * ids[i] = -1 + * + * inline int S(int i) noexcept nogil const: # <<<<<<<<<<<<<< + * if i >= this._stack.size(): + * return -1 +*/ + +int __pyx_t_5spacy_8pipeline_17_parser_internals_6_state_StateC::S(int __pyx_v_i) const { + int __pyx_r; + int __pyx_t_1; + __Pyx_FakeReference __pyx_t_2; + int __pyx_lineno = 0; + const char *__pyx_filename = NULL; + int __pyx_clineno = 0; + PyGILState_STATE __pyx_gilstate_save; + + /* "_state.pxd":135 + * + * inline int S(int i) noexcept nogil const: + * if i >= this._stack.size(): # <<<<<<<<<<<<<< + * return -1 + * elif i < 0: +*/ + __pyx_t_1 = (__pyx_v_i >= this->_stack.size()); + if (__pyx_t_1) { + + /* "_state.pxd":136 + * inline int S(int i) noexcept nogil const: + * if i >= this._stack.size(): + * return -1 # <<<<<<<<<<<<<< + * elif i < 0: + * return -1 +*/ + __pyx_r = -1; + goto __pyx_L0; + + /* "_state.pxd":135 + * + * inline int S(int i) noexcept nogil const: + * if i >= this._stack.size(): # <<<<<<<<<<<<<< + * return -1 + * elif i < 0: +*/ + } + + /* "_state.pxd":137 + * if i >= this._stack.size(): + * return -1 + * elif i < 0: # <<<<<<<<<<<<<< + * return -1 + * return this._stack.at(this._stack.size() - (i+1)) +*/ + __pyx_t_1 = (__pyx_v_i < 0); + if (__pyx_t_1) { + + /* "_state.pxd":138 + * return -1 + * elif i < 0: + * return -1 # <<<<<<<<<<<<<< + * return this._stack.at(this._stack.size() - (i+1)) + * +*/ + __pyx_r = -1; + goto __pyx_L0; + + /* "_state.pxd":137 + * if i >= this._stack.size(): + * return -1 + * elif i < 0: # <<<<<<<<<<<<<< + * return -1 + * return this._stack.at(this._stack.size() - (i+1)) +*/ + } + + /* "_state.pxd":139 + * elif i < 0: + * return -1 + * return this._stack.at(this._stack.size() - (i+1)) # <<<<<<<<<<<<<< + * + * inline int B(int i) noexcept nogil const: +*/ + try { + __pyx_t_2 = this->_stack.at((this->_stack.size() - (__pyx_v_i + 1))); + } catch(...) { + PyGILState_STATE __pyx_gilstate_save = __Pyx_PyGILState_Ensure(); + __Pyx_CppExn2PyErr(); + __Pyx_PyGILState_Release(__pyx_gilstate_save); + __PYX_ERR(4, 139, __pyx_L1_error) + } + __pyx_r = __pyx_t_2; + goto __pyx_L0; + + /* "_state.pxd":134 + * ids[i] = -1 + * + * inline int S(int i) noexcept nogil const: # <<<<<<<<<<<<<< + * if i >= this._stack.size(): + * return -1 +*/ + + /* function exit code */ + __pyx_L1_error:; + __pyx_gilstate_save = __Pyx_PyGILState_Ensure(); + __Pyx_WriteUnraisable("StateC.S", __pyx_clineno, __pyx_lineno, __pyx_filename, 1, 0); + __pyx_r = 0; + __Pyx_PyGILState_Release(__pyx_gilstate_save); + __pyx_L0:; + return __pyx_r; +} + +/* "_state.pxd":141 + * return this._stack.at(this._stack.size() - (i+1)) + * + * inline int B(int i) noexcept nogil const: # <<<<<<<<<<<<<< + * if i < 0: + * return -1 +*/ + +int __pyx_t_5spacy_8pipeline_17_parser_internals_6_state_StateC::B(int __pyx_v_i) const { + std::vector ::size_type __pyx_v_b_i; + int __pyx_r; + int __pyx_t_1; + __Pyx_FakeReference __pyx_t_2; + int __pyx_lineno = 0; + const char *__pyx_filename = NULL; + int __pyx_clineno = 0; + PyGILState_STATE __pyx_gilstate_save; + + /* "_state.pxd":142 + * + * inline int B(int i) noexcept nogil const: + * if i < 0: # <<<<<<<<<<<<<< + * return -1 + * elif i < this._rebuffer.size(): +*/ + __pyx_t_1 = (__pyx_v_i < 0); + if (__pyx_t_1) { + + /* "_state.pxd":143 + * inline int B(int i) noexcept nogil const: + * if i < 0: + * return -1 # <<<<<<<<<<<<<< + * elif i < this._rebuffer.size(): + * return this._rebuffer.at(this._rebuffer.size() - (i+1)) +*/ + __pyx_r = -1; + goto __pyx_L0; + + /* "_state.pxd":142 + * + * inline int B(int i) noexcept nogil const: + * if i < 0: # <<<<<<<<<<<<<< + * return -1 + * elif i < this._rebuffer.size(): +*/ + } + + /* "_state.pxd":144 + * if i < 0: + * return -1 + * elif i < this._rebuffer.size(): # <<<<<<<<<<<<<< + * return this._rebuffer.at(this._rebuffer.size() - (i+1)) + * else: +*/ + __pyx_t_1 = (__pyx_v_i < this->_rebuffer.size()); + if (__pyx_t_1) { + + /* "_state.pxd":145 + * return -1 + * elif i < this._rebuffer.size(): + * return this._rebuffer.at(this._rebuffer.size() - (i+1)) # <<<<<<<<<<<<<< + * else: + * b_i = this._b_i + (i - this._rebuffer.size()) +*/ + try { + __pyx_t_2 = this->_rebuffer.at((this->_rebuffer.size() - (__pyx_v_i + 1))); + } catch(...) { + PyGILState_STATE __pyx_gilstate_save = __Pyx_PyGILState_Ensure(); + __Pyx_CppExn2PyErr(); + __Pyx_PyGILState_Release(__pyx_gilstate_save); + __PYX_ERR(4, 145, __pyx_L1_error) + } + __pyx_r = __pyx_t_2; + goto __pyx_L0; + + /* "_state.pxd":144 + * if i < 0: + * return -1 + * elif i < this._rebuffer.size(): # <<<<<<<<<<<<<< + * return this._rebuffer.at(this._rebuffer.size() - (i+1)) + * else: +*/ + } + + /* "_state.pxd":147 + * return this._rebuffer.at(this._rebuffer.size() - (i+1)) + * else: + * b_i = this._b_i + (i - this._rebuffer.size()) # <<<<<<<<<<<<<< + * if b_i >= this.length: + * return -1 +*/ + /*else*/ { + __pyx_v_b_i = (this->_b_i + (__pyx_v_i - this->_rebuffer.size())); + + /* "_state.pxd":148 + * else: + * b_i = this._b_i + (i - this._rebuffer.size()) + * if b_i >= this.length: # <<<<<<<<<<<<<< + * return -1 + * else: +*/ + __pyx_t_1 = (__pyx_v_b_i >= this->length); + if (__pyx_t_1) { + + /* "_state.pxd":149 + * b_i = this._b_i + (i - this._rebuffer.size()) + * if b_i >= this.length: + * return -1 # <<<<<<<<<<<<<< + * else: + * return b_i +*/ + __pyx_r = -1; + goto __pyx_L0; + + /* "_state.pxd":148 + * else: + * b_i = this._b_i + (i - this._rebuffer.size()) + * if b_i >= this.length: # <<<<<<<<<<<<<< + * return -1 + * else: +*/ + } + + /* "_state.pxd":151 + * return -1 + * else: + * return b_i # <<<<<<<<<<<<<< + * + * inline const TokenC* B_(int i) noexcept nogil const: +*/ + /*else*/ { + __pyx_r = __pyx_v_b_i; + goto __pyx_L0; + } + } + + /* "_state.pxd":141 + * return this._stack.at(this._stack.size() - (i+1)) + * + * inline int B(int i) noexcept nogil const: # <<<<<<<<<<<<<< + * if i < 0: + * return -1 +*/ + + /* function exit code */ + __pyx_L1_error:; + __pyx_gilstate_save = __Pyx_PyGILState_Ensure(); + __Pyx_WriteUnraisable("StateC.B", __pyx_clineno, __pyx_lineno, __pyx_filename, 1, 0); + __pyx_r = 0; + __Pyx_PyGILState_Release(__pyx_gilstate_save); + __pyx_L0:; + return __pyx_r; +} + +/* "_state.pxd":153 + * return b_i + * + * inline const TokenC* B_(int i) noexcept nogil const: # <<<<<<<<<<<<<< + * return this.safe_get(this.B(i)) + * +*/ + +struct __pyx_t_5spacy_7structs_TokenC const *__pyx_t_5spacy_8pipeline_17_parser_internals_6_state_StateC::B_(int __pyx_v_i) const { + struct __pyx_t_5spacy_7structs_TokenC const *__pyx_r; + + /* "_state.pxd":154 + * + * inline const TokenC* B_(int i) noexcept nogil const: + * return this.safe_get(this.B(i)) # <<<<<<<<<<<<<< + * + * inline const TokenC* E_(int i) noexcept nogil const: +*/ + __pyx_r = this->safe_get(this->B(__pyx_v_i)); + goto __pyx_L0; + + /* "_state.pxd":153 + * return b_i + * + * inline const TokenC* B_(int i) noexcept nogil const: # <<<<<<<<<<<<<< + * return this.safe_get(this.B(i)) + * +*/ + + /* function exit code */ + __pyx_L0:; + return __pyx_r; +} + +/* "_state.pxd":156 + * return this.safe_get(this.B(i)) + * + * inline const TokenC* E_(int i) noexcept nogil const: # <<<<<<<<<<<<<< + * return this.safe_get(this.E(i)) + * +*/ + +struct __pyx_t_5spacy_7structs_TokenC const *__pyx_t_5spacy_8pipeline_17_parser_internals_6_state_StateC::E_(int __pyx_v_i) const { + struct __pyx_t_5spacy_7structs_TokenC const *__pyx_r; + + /* "_state.pxd":157 + * + * inline const TokenC* E_(int i) noexcept nogil const: + * return this.safe_get(this.E(i)) # <<<<<<<<<<<<<< + * + * inline const TokenC* safe_get(int i) noexcept nogil const: +*/ + __pyx_r = this->safe_get(this->E(__pyx_v_i)); + goto __pyx_L0; + + /* "_state.pxd":156 + * return this.safe_get(this.B(i)) + * + * inline const TokenC* E_(int i) noexcept nogil const: # <<<<<<<<<<<<<< + * return this.safe_get(this.E(i)) + * +*/ + + /* function exit code */ + __pyx_L0:; + return __pyx_r; +} + +/* "_state.pxd":159 + * return this.safe_get(this.E(i)) + * + * inline const TokenC* safe_get(int i) noexcept nogil const: # <<<<<<<<<<<<<< + * if i < 0 or i >= this.length: + * return &this._empty_token +*/ + +struct __pyx_t_5spacy_7structs_TokenC const *__pyx_t_5spacy_8pipeline_17_parser_internals_6_state_StateC::safe_get(int __pyx_v_i) const { + struct __pyx_t_5spacy_7structs_TokenC const *__pyx_r; + int __pyx_t_1; + int __pyx_t_2; + + /* "_state.pxd":160 + * + * inline const TokenC* safe_get(int i) noexcept nogil const: + * if i < 0 or i >= this.length: # <<<<<<<<<<<<<< + * return &this._empty_token + * else: +*/ + __pyx_t_2 = (__pyx_v_i < 0); + if (!__pyx_t_2) { + } else { + __pyx_t_1 = __pyx_t_2; + goto __pyx_L4_bool_binop_done; + } + __pyx_t_2 = (__pyx_v_i >= this->length); + __pyx_t_1 = __pyx_t_2; + __pyx_L4_bool_binop_done:; + if (__pyx_t_1) { + + /* "_state.pxd":161 + * inline const TokenC* safe_get(int i) noexcept nogil const: + * if i < 0 or i >= this.length: + * return &this._empty_token # <<<<<<<<<<<<<< + * else: + * return &this._sent[i] +*/ + __pyx_r = (&this->_empty_token); + goto __pyx_L0; + + /* "_state.pxd":160 + * + * inline const TokenC* safe_get(int i) noexcept nogil const: + * if i < 0 or i >= this.length: # <<<<<<<<<<<<<< + * return &this._empty_token + * else: +*/ + } + + /* "_state.pxd":163 + * return &this._empty_token + * else: + * return &this._sent[i] # <<<<<<<<<<<<<< + * + * inline void map_get_arcs(const unordered_map[int, vector[ArcC]] &heads_arcs, vector[ArcC]* out) noexcept nogil const: +*/ + /*else*/ { + __pyx_r = (&(this->_sent[__pyx_v_i])); + goto __pyx_L0; + } + + /* "_state.pxd":159 + * return this.safe_get(this.E(i)) + * + * inline const TokenC* safe_get(int i) noexcept nogil const: # <<<<<<<<<<<<<< + * if i < 0 or i >= this.length: + * return &this._empty_token +*/ + + /* function exit code */ + __pyx_L0:; + return __pyx_r; +} + +/* "_state.pxd":165 + * return &this._sent[i] + * + * inline void map_get_arcs(const unordered_map[int, vector[ArcC]] &heads_arcs, vector[ArcC]* out) noexcept nogil const: # <<<<<<<<<<<<<< + * cdef const vector[ArcC]* arcs + * head_arcs_it = heads_arcs.const_begin() +*/ + +void __pyx_t_5spacy_8pipeline_17_parser_internals_6_state_StateC::map_get_arcs(std::unordered_map > const &__pyx_v_heads_arcs, std::vector *__pyx_v_out) const { + std::vector const *__pyx_v_arcs; + std::unordered_map > ::const_iterator __pyx_v_head_arcs_it; + std::vector ::const_iterator __pyx_v_arcs_it; + struct __pyx_t_5spacy_8pipeline_17_parser_internals_6_state_ArcC __pyx_v_arc; + int __pyx_t_1; + int __pyx_t_2; + int __pyx_lineno = 0; + const char *__pyx_filename = NULL; + int __pyx_clineno = 0; + PyGILState_STATE __pyx_gilstate_save; + + /* "_state.pxd":167 + * inline void map_get_arcs(const unordered_map[int, vector[ArcC]] &heads_arcs, vector[ArcC]* out) noexcept nogil const: + * cdef const vector[ArcC]* arcs + * head_arcs_it = heads_arcs.const_begin() # <<<<<<<<<<<<<< + * while head_arcs_it != heads_arcs.const_end(): + * arcs = &deref(head_arcs_it).second +*/ + try { + __pyx_v_head_arcs_it = __pyx_v_heads_arcs.begin(); + } catch(...) { + PyGILState_STATE __pyx_gilstate_save = __Pyx_PyGILState_Ensure(); + __Pyx_CppExn2PyErr(); + __Pyx_PyGILState_Release(__pyx_gilstate_save); + __PYX_ERR(4, 167, __pyx_L1_error) + } + + /* "_state.pxd":168 + * cdef const vector[ArcC]* arcs + * head_arcs_it = heads_arcs.const_begin() + * while head_arcs_it != heads_arcs.const_end(): # <<<<<<<<<<<<<< + * arcs = &deref(head_arcs_it).second + * arcs_it = arcs.const_begin() +*/ + while (1) { + __pyx_t_1 = (__pyx_v_head_arcs_it != __pyx_v_heads_arcs.end()); + if (!__pyx_t_1) break; + + /* "_state.pxd":169 + * head_arcs_it = heads_arcs.const_begin() + * while head_arcs_it != heads_arcs.const_end(): + * arcs = &deref(head_arcs_it).second # <<<<<<<<<<<<<< + * arcs_it = arcs.const_begin() + * while arcs_it != arcs.const_end(): +*/ + __pyx_v_arcs = (&(*__pyx_v_head_arcs_it).second); + + /* "_state.pxd":170 + * while head_arcs_it != heads_arcs.const_end(): + * arcs = &deref(head_arcs_it).second + * arcs_it = arcs.const_begin() # <<<<<<<<<<<<<< + * while arcs_it != arcs.const_end(): + * arc = deref(arcs_it) +*/ + try { + __pyx_v_arcs_it = __pyx_v_arcs->begin(); + } catch(...) { + PyGILState_STATE __pyx_gilstate_save = __Pyx_PyGILState_Ensure(); + __Pyx_CppExn2PyErr(); + __Pyx_PyGILState_Release(__pyx_gilstate_save); + __PYX_ERR(4, 170, __pyx_L1_error) + } + + /* "_state.pxd":171 + * arcs = &deref(head_arcs_it).second + * arcs_it = arcs.const_begin() + * while arcs_it != arcs.const_end(): # <<<<<<<<<<<<<< + * arc = deref(arcs_it) + * if arc.head != -1 and arc.child != -1: +*/ + while (1) { + __pyx_t_1 = (__pyx_v_arcs_it != __pyx_v_arcs->end()); + if (!__pyx_t_1) break; + + /* "_state.pxd":172 + * arcs_it = arcs.const_begin() + * while arcs_it != arcs.const_end(): + * arc = deref(arcs_it) # <<<<<<<<<<<<<< + * if arc.head != -1 and arc.child != -1: + * out.push_back(arc) +*/ + __pyx_v_arc = (*__pyx_v_arcs_it); + + /* "_state.pxd":173 + * while arcs_it != arcs.const_end(): + * arc = deref(arcs_it) + * if arc.head != -1 and arc.child != -1: # <<<<<<<<<<<<<< + * out.push_back(arc) + * incr(arcs_it) +*/ + __pyx_t_2 = (__pyx_v_arc.head != -1L); + if (__pyx_t_2) { + } else { + __pyx_t_1 = __pyx_t_2; + goto __pyx_L8_bool_binop_done; + } + __pyx_t_2 = (__pyx_v_arc.child != -1L); + __pyx_t_1 = __pyx_t_2; + __pyx_L8_bool_binop_done:; + if (__pyx_t_1) { + + /* "_state.pxd":174 + * arc = deref(arcs_it) + * if arc.head != -1 and arc.child != -1: + * out.push_back(arc) # <<<<<<<<<<<<<< + * incr(arcs_it) + * incr(head_arcs_it) +*/ + try { + __pyx_v_out->push_back(__pyx_v_arc); + } catch(...) { + PyGILState_STATE __pyx_gilstate_save = __Pyx_PyGILState_Ensure(); + __Pyx_CppExn2PyErr(); + __Pyx_PyGILState_Release(__pyx_gilstate_save); + __PYX_ERR(4, 174, __pyx_L1_error) + } + + /* "_state.pxd":173 + * while arcs_it != arcs.const_end(): + * arc = deref(arcs_it) + * if arc.head != -1 and arc.child != -1: # <<<<<<<<<<<<<< + * out.push_back(arc) + * incr(arcs_it) +*/ + } + + /* "_state.pxd":175 + * if arc.head != -1 and arc.child != -1: + * out.push_back(arc) + * incr(arcs_it) # <<<<<<<<<<<<<< + * incr(head_arcs_it) + * +*/ + (void)((++__pyx_v_arcs_it)); + } + + /* "_state.pxd":176 + * out.push_back(arc) + * incr(arcs_it) + * incr(head_arcs_it) # <<<<<<<<<<<<<< + * + * inline void get_arcs(vector[ArcC]* out) noexcept nogil const: +*/ + (void)((++__pyx_v_head_arcs_it)); + } + + /* "_state.pxd":165 + * return &this._sent[i] + * + * inline void map_get_arcs(const unordered_map[int, vector[ArcC]] &heads_arcs, vector[ArcC]* out) noexcept nogil const: # <<<<<<<<<<<<<< + * cdef const vector[ArcC]* arcs + * head_arcs_it = heads_arcs.const_begin() +*/ + + /* function exit code */ + goto __pyx_L0; + __pyx_L1_error:; + __pyx_gilstate_save = __Pyx_PyGILState_Ensure(); + __Pyx_WriteUnraisable("StateC.map_get_arcs", __pyx_clineno, __pyx_lineno, __pyx_filename, 1, 0); + __Pyx_PyGILState_Release(__pyx_gilstate_save); + __pyx_L0:; +} + +/* "_state.pxd":178 + * incr(head_arcs_it) + * + * inline void get_arcs(vector[ArcC]* out) noexcept nogil const: # <<<<<<<<<<<<<< + * this.map_get_arcs(this._left_arcs, out) + * this.map_get_arcs(this._right_arcs, out) +*/ + +void __pyx_t_5spacy_8pipeline_17_parser_internals_6_state_StateC::get_arcs(std::vector *__pyx_v_out) const { + + /* "_state.pxd":179 + * + * inline void get_arcs(vector[ArcC]* out) noexcept nogil const: + * this.map_get_arcs(this._left_arcs, out) # <<<<<<<<<<<<<< + * this.map_get_arcs(this._right_arcs, out) + * +*/ + this->map_get_arcs(this->_left_arcs, __pyx_v_out); + + /* "_state.pxd":180 + * inline void get_arcs(vector[ArcC]* out) noexcept nogil const: + * this.map_get_arcs(this._left_arcs, out) + * this.map_get_arcs(this._right_arcs, out) # <<<<<<<<<<<<<< + * + * inline int H(int child) noexcept nogil const: +*/ + this->map_get_arcs(this->_right_arcs, __pyx_v_out); + + /* "_state.pxd":178 + * incr(head_arcs_it) + * + * inline void get_arcs(vector[ArcC]* out) noexcept nogil const: # <<<<<<<<<<<<<< + * this.map_get_arcs(this._left_arcs, out) + * this.map_get_arcs(this._right_arcs, out) +*/ + + /* function exit code */ +} + +/* "_state.pxd":182 + * this.map_get_arcs(this._right_arcs, out) + * + * inline int H(int child) noexcept nogil const: # <<<<<<<<<<<<<< + * if child >= this.length or child < 0: + * return -1 +*/ + +int __pyx_t_5spacy_8pipeline_17_parser_internals_6_state_StateC::H(int __pyx_v_child) const { + int __pyx_r; + int __pyx_t_1; + int __pyx_t_2; + + /* "_state.pxd":183 + * + * inline int H(int child) noexcept nogil const: + * if child >= this.length or child < 0: # <<<<<<<<<<<<<< + * return -1 + * else: +*/ + __pyx_t_2 = (__pyx_v_child >= this->length); + if (!__pyx_t_2) { + } else { + __pyx_t_1 = __pyx_t_2; + goto __pyx_L4_bool_binop_done; + } + __pyx_t_2 = (__pyx_v_child < 0); + __pyx_t_1 = __pyx_t_2; + __pyx_L4_bool_binop_done:; + if (__pyx_t_1) { + + /* "_state.pxd":184 + * inline int H(int child) noexcept nogil const: + * if child >= this.length or child < 0: + * return -1 # <<<<<<<<<<<<<< + * else: + * return this._heads[child] +*/ + __pyx_r = -1; + goto __pyx_L0; + + /* "_state.pxd":183 + * + * inline int H(int child) noexcept nogil const: + * if child >= this.length or child < 0: # <<<<<<<<<<<<<< + * return -1 + * else: +*/ + } + + /* "_state.pxd":186 + * return -1 + * else: + * return this._heads[child] # <<<<<<<<<<<<<< + * + * inline int E(int i) noexcept nogil const: +*/ + /*else*/ { + __pyx_r = (this->_heads[__pyx_v_child]); + goto __pyx_L0; + } + + /* "_state.pxd":182 + * this.map_get_arcs(this._right_arcs, out) + * + * inline int H(int child) noexcept nogil const: # <<<<<<<<<<<<<< + * if child >= this.length or child < 0: + * return -1 +*/ + + /* function exit code */ + __pyx_L0:; + return __pyx_r; +} + +/* "_state.pxd":188 + * return this._heads[child] + * + * inline int E(int i) noexcept nogil const: # <<<<<<<<<<<<<< + * if this._ents.size() == 0: + * return -1 +*/ + +int __pyx_t_5spacy_8pipeline_17_parser_internals_6_state_StateC::E(CYTHON_UNUSED int __pyx_v_i) const { + int __pyx_r; + int __pyx_t_1; + + /* "_state.pxd":189 + * + * inline int E(int i) noexcept nogil const: + * if this._ents.size() == 0: # <<<<<<<<<<<<<< + * return -1 + * else: +*/ + __pyx_t_1 = (this->_ents.size() == 0); + if (__pyx_t_1) { + + /* "_state.pxd":190 + * inline int E(int i) noexcept nogil const: + * if this._ents.size() == 0: + * return -1 # <<<<<<<<<<<<<< + * else: + * return this._ents.back().start +*/ + __pyx_r = -1; + goto __pyx_L0; + + /* "_state.pxd":189 + * + * inline int E(int i) noexcept nogil const: + * if this._ents.size() == 0: # <<<<<<<<<<<<<< + * return -1 + * else: +*/ + } + + /* "_state.pxd":192 + * return -1 + * else: + * return this._ents.back().start # <<<<<<<<<<<<<< + * + * inline int nth_child(const unordered_map[int, vector[ArcC]]& heads_arcs, int head, int idx) noexcept nogil const: +*/ + /*else*/ { + __pyx_r = this->_ents.back().start; + goto __pyx_L0; + } + + /* "_state.pxd":188 + * return this._heads[child] + * + * inline int E(int i) noexcept nogil const: # <<<<<<<<<<<<<< + * if this._ents.size() == 0: + * return -1 +*/ + + /* function exit code */ + __pyx_L0:; + return __pyx_r; +} + +/* "_state.pxd":194 + * return this._ents.back().start + * + * inline int nth_child(const unordered_map[int, vector[ArcC]]& heads_arcs, int head, int idx) noexcept nogil const: # <<<<<<<<<<<<<< + * if idx < 1: + * return -1 +*/ + +int __pyx_t_5spacy_8pipeline_17_parser_internals_6_state_StateC::nth_child(std::unordered_map > const &__pyx_v_heads_arcs, int __pyx_v_head, int __pyx_v_idx) const { + std::unordered_map > ::const_iterator __pyx_v_head_arcs_it; + std::vector const *__pyx_v_arcs; + size_t __pyx_v_child_index; + std::vector ::const_reverse_iterator __pyx_v_arcs_it; + struct __pyx_t_5spacy_8pipeline_17_parser_internals_6_state_ArcC __pyx_v_arc; + int __pyx_r; + int __pyx_t_1; + int __pyx_t_2; + int __pyx_lineno = 0; + const char *__pyx_filename = NULL; + int __pyx_clineno = 0; + PyGILState_STATE __pyx_gilstate_save; + + /* "_state.pxd":195 + * + * inline int nth_child(const unordered_map[int, vector[ArcC]]& heads_arcs, int head, int idx) noexcept nogil const: + * if idx < 1: # <<<<<<<<<<<<<< + * return -1 + * +*/ + __pyx_t_1 = (__pyx_v_idx < 1); + if (__pyx_t_1) { + + /* "_state.pxd":196 + * inline int nth_child(const unordered_map[int, vector[ArcC]]& heads_arcs, int head, int idx) noexcept nogil const: + * if idx < 1: + * return -1 # <<<<<<<<<<<<<< + * + * head_arcs_it = heads_arcs.const_find(head) +*/ + __pyx_r = -1; + goto __pyx_L0; + + /* "_state.pxd":195 + * + * inline int nth_child(const unordered_map[int, vector[ArcC]]& heads_arcs, int head, int idx) noexcept nogil const: + * if idx < 1: # <<<<<<<<<<<<<< + * return -1 + * +*/ + } + + /* "_state.pxd":198 + * return -1 + * + * head_arcs_it = heads_arcs.const_find(head) # <<<<<<<<<<<<<< + * if head_arcs_it == heads_arcs.const_end(): + * return -1 +*/ + try { + __pyx_v_head_arcs_it = __pyx_v_heads_arcs.find(__pyx_v_head); + } catch(...) { + PyGILState_STATE __pyx_gilstate_save = __Pyx_PyGILState_Ensure(); + __Pyx_CppExn2PyErr(); + __Pyx_PyGILState_Release(__pyx_gilstate_save); + __PYX_ERR(4, 198, __pyx_L1_error) + } + + /* "_state.pxd":199 + * + * head_arcs_it = heads_arcs.const_find(head) + * if head_arcs_it == heads_arcs.const_end(): # <<<<<<<<<<<<<< + * return -1 + * +*/ + __pyx_t_1 = (__pyx_v_head_arcs_it == __pyx_v_heads_arcs.end()); + if (__pyx_t_1) { + + /* "_state.pxd":200 + * head_arcs_it = heads_arcs.const_find(head) + * if head_arcs_it == heads_arcs.const_end(): + * return -1 # <<<<<<<<<<<<<< + * + * cdef const vector[ArcC]* arcs = &deref(head_arcs_it).second +*/ + __pyx_r = -1; + goto __pyx_L0; + + /* "_state.pxd":199 + * + * head_arcs_it = heads_arcs.const_find(head) + * if head_arcs_it == heads_arcs.const_end(): # <<<<<<<<<<<<<< + * return -1 + * +*/ + } + + /* "_state.pxd":202 + * return -1 + * + * cdef const vector[ArcC]* arcs = &deref(head_arcs_it).second # <<<<<<<<<<<<<< + * + * # Work backwards through arcs to find the arc at the +*/ + __pyx_v_arcs = (&(*__pyx_v_head_arcs_it).second); + + /* "_state.pxd":206 + * # Work backwards through arcs to find the arc at the + * # requested index more quickly. + * cdef size_t child_index = 0 # <<<<<<<<<<<<<< + * arcs_it = arcs.const_rbegin() + * while arcs_it != arcs.const_rend() and child_index != idx: +*/ + __pyx_v_child_index = 0; + + /* "_state.pxd":207 + * # requested index more quickly. + * cdef size_t child_index = 0 + * arcs_it = arcs.const_rbegin() # <<<<<<<<<<<<<< + * while arcs_it != arcs.const_rend() and child_index != idx: + * arc = deref(arcs_it) +*/ + try { + __pyx_v_arcs_it = __pyx_v_arcs->rbegin(); + } catch(...) { + PyGILState_STATE __pyx_gilstate_save = __Pyx_PyGILState_Ensure(); + __Pyx_CppExn2PyErr(); + __Pyx_PyGILState_Release(__pyx_gilstate_save); + __PYX_ERR(4, 207, __pyx_L1_error) + } + + /* "_state.pxd":208 + * cdef size_t child_index = 0 + * arcs_it = arcs.const_rbegin() + * while arcs_it != arcs.const_rend() and child_index != idx: # <<<<<<<<<<<<<< + * arc = deref(arcs_it) + * if arc.child != -1: +*/ + while (1) { + __pyx_t_2 = (__pyx_v_arcs_it != __pyx_v_arcs->rend()); + if (__pyx_t_2) { + } else { + __pyx_t_1 = __pyx_t_2; + goto __pyx_L7_bool_binop_done; + } + __pyx_t_2 = (__pyx_v_child_index != __pyx_v_idx); + __pyx_t_1 = __pyx_t_2; + __pyx_L7_bool_binop_done:; + if (!__pyx_t_1) break; + + /* "_state.pxd":209 + * arcs_it = arcs.const_rbegin() + * while arcs_it != arcs.const_rend() and child_index != idx: + * arc = deref(arcs_it) # <<<<<<<<<<<<<< + * if arc.child != -1: + * child_index += 1 +*/ + __pyx_v_arc = (*__pyx_v_arcs_it); + + /* "_state.pxd":210 + * while arcs_it != arcs.const_rend() and child_index != idx: + * arc = deref(arcs_it) + * if arc.child != -1: # <<<<<<<<<<<<<< + * child_index += 1 + * if child_index == idx: +*/ + __pyx_t_1 = (__pyx_v_arc.child != -1L); + if (__pyx_t_1) { + + /* "_state.pxd":211 + * arc = deref(arcs_it) + * if arc.child != -1: + * child_index += 1 # <<<<<<<<<<<<<< + * if child_index == idx: + * return arc.child +*/ + __pyx_v_child_index = (__pyx_v_child_index + 1); + + /* "_state.pxd":212 + * if arc.child != -1: + * child_index += 1 + * if child_index == idx: # <<<<<<<<<<<<<< + * return arc.child + * incr(arcs_it) +*/ + __pyx_t_1 = (__pyx_v_child_index == __pyx_v_idx); + if (__pyx_t_1) { + + /* "_state.pxd":213 + * child_index += 1 + * if child_index == idx: + * return arc.child # <<<<<<<<<<<<<< + * incr(arcs_it) + * +*/ + __pyx_r = __pyx_v_arc.child; + goto __pyx_L0; + + /* "_state.pxd":212 + * if arc.child != -1: + * child_index += 1 + * if child_index == idx: # <<<<<<<<<<<<<< + * return arc.child + * incr(arcs_it) +*/ + } + + /* "_state.pxd":210 + * while arcs_it != arcs.const_rend() and child_index != idx: + * arc = deref(arcs_it) + * if arc.child != -1: # <<<<<<<<<<<<<< + * child_index += 1 + * if child_index == idx: +*/ + } + + /* "_state.pxd":214 + * if child_index == idx: + * return arc.child + * incr(arcs_it) # <<<<<<<<<<<<<< + * + * return -1 +*/ + (void)((++__pyx_v_arcs_it)); + } + + /* "_state.pxd":216 + * incr(arcs_it) + * + * return -1 # <<<<<<<<<<<<<< + * + * inline int L(int head, int idx) noexcept nogil const: +*/ + __pyx_r = -1; + goto __pyx_L0; + + /* "_state.pxd":194 + * return this._ents.back().start + * + * inline int nth_child(const unordered_map[int, vector[ArcC]]& heads_arcs, int head, int idx) noexcept nogil const: # <<<<<<<<<<<<<< + * if idx < 1: + * return -1 +*/ + + /* function exit code */ + __pyx_L1_error:; + __pyx_gilstate_save = __Pyx_PyGILState_Ensure(); + __Pyx_WriteUnraisable("StateC.nth_child", __pyx_clineno, __pyx_lineno, __pyx_filename, 1, 0); + __pyx_r = 0; + __Pyx_PyGILState_Release(__pyx_gilstate_save); + __pyx_L0:; + return __pyx_r; +} + +/* "_state.pxd":218 + * return -1 + * + * inline int L(int head, int idx) noexcept nogil const: # <<<<<<<<<<<<<< + * return this.nth_child(this._left_arcs, head, idx) + * +*/ + +int __pyx_t_5spacy_8pipeline_17_parser_internals_6_state_StateC::L(int __pyx_v_head, int __pyx_v_idx) const { + int __pyx_r; + + /* "_state.pxd":219 + * + * inline int L(int head, int idx) noexcept nogil const: + * return this.nth_child(this._left_arcs, head, idx) # <<<<<<<<<<<<<< + * + * inline int R(int head, int idx) noexcept nogil const: +*/ + __pyx_r = this->nth_child(this->_left_arcs, __pyx_v_head, __pyx_v_idx); + goto __pyx_L0; + + /* "_state.pxd":218 + * return -1 + * + * inline int L(int head, int idx) noexcept nogil const: # <<<<<<<<<<<<<< + * return this.nth_child(this._left_arcs, head, idx) + * +*/ + + /* function exit code */ + __pyx_L0:; + return __pyx_r; +} + +/* "_state.pxd":221 + * return this.nth_child(this._left_arcs, head, idx) + * + * inline int R(int head, int idx) noexcept nogil const: # <<<<<<<<<<<<<< + * return this.nth_child(this._right_arcs, head, idx) + * +*/ + +int __pyx_t_5spacy_8pipeline_17_parser_internals_6_state_StateC::R(int __pyx_v_head, int __pyx_v_idx) const { + int __pyx_r; + + /* "_state.pxd":222 + * + * inline int R(int head, int idx) noexcept nogil const: + * return this.nth_child(this._right_arcs, head, idx) # <<<<<<<<<<<<<< + * + * inline bint empty() noexcept nogil const: +*/ + __pyx_r = this->nth_child(this->_right_arcs, __pyx_v_head, __pyx_v_idx); + goto __pyx_L0; + + /* "_state.pxd":221 + * return this.nth_child(this._left_arcs, head, idx) + * + * inline int R(int head, int idx) noexcept nogil const: # <<<<<<<<<<<<<< + * return this.nth_child(this._right_arcs, head, idx) + * +*/ + + /* function exit code */ + __pyx_L0:; + return __pyx_r; +} + +/* "_state.pxd":224 + * return this.nth_child(this._right_arcs, head, idx) + * + * inline bint empty() noexcept nogil const: # <<<<<<<<<<<<<< + * return this._stack.size() == 0 + * +*/ + +int __pyx_t_5spacy_8pipeline_17_parser_internals_6_state_StateC::empty(void) const { + int __pyx_r; + + /* "_state.pxd":225 + * + * inline bint empty() noexcept nogil const: + * return this._stack.size() == 0 # <<<<<<<<<<<<<< + * + * inline bint eol() noexcept nogil const: +*/ + __pyx_r = (this->_stack.size() == 0); + goto __pyx_L0; + + /* "_state.pxd":224 + * return this.nth_child(this._right_arcs, head, idx) + * + * inline bint empty() noexcept nogil const: # <<<<<<<<<<<<<< + * return this._stack.size() == 0 + * +*/ + + /* function exit code */ + __pyx_L0:; + return __pyx_r; +} + +/* "_state.pxd":227 + * return this._stack.size() == 0 + * + * inline bint eol() noexcept nogil const: # <<<<<<<<<<<<<< + * return this.buffer_length() == 0 + * +*/ + +int __pyx_t_5spacy_8pipeline_17_parser_internals_6_state_StateC::eol(void) const { + int __pyx_r; + + /* "_state.pxd":228 + * + * inline bint eol() noexcept nogil const: + * return this.buffer_length() == 0 # <<<<<<<<<<<<<< + * + * inline bint is_final() noexcept nogil const: +*/ + __pyx_r = (this->buffer_length() == 0); + goto __pyx_L0; + + /* "_state.pxd":227 + * return this._stack.size() == 0 + * + * inline bint eol() noexcept nogil const: # <<<<<<<<<<<<<< + * return this.buffer_length() == 0 + * +*/ + + /* function exit code */ + __pyx_L0:; + return __pyx_r; +} + +/* "_state.pxd":230 + * return this.buffer_length() == 0 + * + * inline bint is_final() noexcept nogil const: # <<<<<<<<<<<<<< + * return this.stack_depth() <= 0 and this.eol() + * +*/ + +int __pyx_t_5spacy_8pipeline_17_parser_internals_6_state_StateC::is_final(void) const { + int __pyx_r; + int __pyx_t_1; + int __pyx_t_2; + + /* "_state.pxd":231 + * + * inline bint is_final() noexcept nogil const: + * return this.stack_depth() <= 0 and this.eol() # <<<<<<<<<<<<<< + * + * inline int cannot_sent_start(int word) noexcept nogil const: +*/ + __pyx_t_2 = (this->stack_depth() <= 0); + if (__pyx_t_2) { + } else { + __pyx_t_1 = __pyx_t_2; + goto __pyx_L3_bool_binop_done; + } + __pyx_t_2 = this->eol(); + __pyx_t_1 = __pyx_t_2; + __pyx_L3_bool_binop_done:; + __pyx_r = __pyx_t_1; + goto __pyx_L0; + + /* "_state.pxd":230 + * return this.buffer_length() == 0 + * + * inline bint is_final() noexcept nogil const: # <<<<<<<<<<<<<< + * return this.stack_depth() <= 0 and this.eol() + * +*/ + + /* function exit code */ + __pyx_L0:; + return __pyx_r; +} + +/* "_state.pxd":233 + * return this.stack_depth() <= 0 and this.eol() + * + * inline int cannot_sent_start(int word) noexcept nogil const: # <<<<<<<<<<<<<< + * if word < 0 or word >= this.length: + * return 0 +*/ + +int __pyx_t_5spacy_8pipeline_17_parser_internals_6_state_StateC::cannot_sent_start(int __pyx_v_word) const { + int __pyx_r; + int __pyx_t_1; + int __pyx_t_2; + + /* "_state.pxd":234 + * + * inline int cannot_sent_start(int word) noexcept nogil const: + * if word < 0 or word >= this.length: # <<<<<<<<<<<<<< + * return 0 + * elif this._sent[word].sent_start == -1: +*/ + __pyx_t_2 = (__pyx_v_word < 0); + if (!__pyx_t_2) { + } else { + __pyx_t_1 = __pyx_t_2; + goto __pyx_L4_bool_binop_done; + } + __pyx_t_2 = (__pyx_v_word >= this->length); + __pyx_t_1 = __pyx_t_2; + __pyx_L4_bool_binop_done:; + if (__pyx_t_1) { + + /* "_state.pxd":235 + * inline int cannot_sent_start(int word) noexcept nogil const: + * if word < 0 or word >= this.length: + * return 0 # <<<<<<<<<<<<<< + * elif this._sent[word].sent_start == -1: + * return 1 +*/ + __pyx_r = 0; + goto __pyx_L0; + + /* "_state.pxd":234 + * + * inline int cannot_sent_start(int word) noexcept nogil const: + * if word < 0 or word >= this.length: # <<<<<<<<<<<<<< + * return 0 + * elif this._sent[word].sent_start == -1: +*/ + } + + /* "_state.pxd":236 + * if word < 0 or word >= this.length: + * return 0 + * elif this._sent[word].sent_start == -1: # <<<<<<<<<<<<<< + * return 1 + * else: +*/ + __pyx_t_1 = ((this->_sent[__pyx_v_word]).sent_start == -1L); + if (__pyx_t_1) { + + /* "_state.pxd":237 + * return 0 + * elif this._sent[word].sent_start == -1: + * return 1 # <<<<<<<<<<<<<< + * else: + * return 0 +*/ + __pyx_r = 1; + goto __pyx_L0; + + /* "_state.pxd":236 + * if word < 0 or word >= this.length: + * return 0 + * elif this._sent[word].sent_start == -1: # <<<<<<<<<<<<<< + * return 1 + * else: +*/ + } + + /* "_state.pxd":239 + * return 1 + * else: + * return 0 # <<<<<<<<<<<<<< + * + * inline int is_sent_start(int word) noexcept nogil const: +*/ + /*else*/ { + __pyx_r = 0; + goto __pyx_L0; + } + + /* "_state.pxd":233 + * return this.stack_depth() <= 0 and this.eol() + * + * inline int cannot_sent_start(int word) noexcept nogil const: # <<<<<<<<<<<<<< + * if word < 0 or word >= this.length: + * return 0 +*/ + + /* function exit code */ + __pyx_L0:; + return __pyx_r; +} + +/* "_state.pxd":241 + * return 0 + * + * inline int is_sent_start(int word) noexcept nogil const: # <<<<<<<<<<<<<< + * if word < 0 or word >= this.length: + * return 0 +*/ + +int __pyx_t_5spacy_8pipeline_17_parser_internals_6_state_StateC::is_sent_start(int __pyx_v_word) const { + int __pyx_r; + int __pyx_t_1; + int __pyx_t_2; + + /* "_state.pxd":242 + * + * inline int is_sent_start(int word) noexcept nogil const: + * if word < 0 or word >= this.length: # <<<<<<<<<<<<<< + * return 0 + * elif this._sent[word].sent_start == 1: +*/ + __pyx_t_2 = (__pyx_v_word < 0); + if (!__pyx_t_2) { + } else { + __pyx_t_1 = __pyx_t_2; + goto __pyx_L4_bool_binop_done; + } + __pyx_t_2 = (__pyx_v_word >= this->length); + __pyx_t_1 = __pyx_t_2; + __pyx_L4_bool_binop_done:; + if (__pyx_t_1) { + + /* "_state.pxd":243 + * inline int is_sent_start(int word) noexcept nogil const: + * if word < 0 or word >= this.length: + * return 0 # <<<<<<<<<<<<<< + * elif this._sent[word].sent_start == 1: + * return 1 +*/ + __pyx_r = 0; + goto __pyx_L0; + + /* "_state.pxd":242 + * + * inline int is_sent_start(int word) noexcept nogil const: + * if word < 0 or word >= this.length: # <<<<<<<<<<<<<< + * return 0 + * elif this._sent[word].sent_start == 1: +*/ + } + + /* "_state.pxd":244 + * if word < 0 or word >= this.length: + * return 0 + * elif this._sent[word].sent_start == 1: # <<<<<<<<<<<<<< + * return 1 + * elif this._sent_starts.count(word) >= 1: +*/ + __pyx_t_1 = ((this->_sent[__pyx_v_word]).sent_start == 1); + if (__pyx_t_1) { + + /* "_state.pxd":245 + * return 0 + * elif this._sent[word].sent_start == 1: + * return 1 # <<<<<<<<<<<<<< + * elif this._sent_starts.count(word) >= 1: + * return 1 +*/ + __pyx_r = 1; + goto __pyx_L0; + + /* "_state.pxd":244 + * if word < 0 or word >= this.length: + * return 0 + * elif this._sent[word].sent_start == 1: # <<<<<<<<<<<<<< + * return 1 + * elif this._sent_starts.count(word) >= 1: +*/ + } + + /* "_state.pxd":246 + * elif this._sent[word].sent_start == 1: + * return 1 + * elif this._sent_starts.count(word) >= 1: # <<<<<<<<<<<<<< + * return 1 + * else: +*/ + __pyx_t_1 = (this->_sent_starts.count(__pyx_v_word) >= 1); + if (__pyx_t_1) { + + /* "_state.pxd":247 + * return 1 + * elif this._sent_starts.count(word) >= 1: + * return 1 # <<<<<<<<<<<<<< + * else: + * return 0 +*/ + __pyx_r = 1; + goto __pyx_L0; + + /* "_state.pxd":246 + * elif this._sent[word].sent_start == 1: + * return 1 + * elif this._sent_starts.count(word) >= 1: # <<<<<<<<<<<<<< + * return 1 + * else: +*/ + } + + /* "_state.pxd":249 + * return 1 + * else: + * return 0 # <<<<<<<<<<<<<< + * + * inline void set_sent_start(int word, int value) noexcept nogil: +*/ + /*else*/ { + __pyx_r = 0; + goto __pyx_L0; + } + + /* "_state.pxd":241 + * return 0 + * + * inline int is_sent_start(int word) noexcept nogil const: # <<<<<<<<<<<<<< + * if word < 0 or word >= this.length: + * return 0 +*/ + + /* function exit code */ + __pyx_L0:; + return __pyx_r; +} + +/* "_state.pxd":251 + * return 0 + * + * inline void set_sent_start(int word, int value) noexcept nogil: # <<<<<<<<<<<<<< + * if value >= 1: + * this._sent_starts.insert(word) +*/ + +void __pyx_t_5spacy_8pipeline_17_parser_internals_6_state_StateC::set_sent_start(int __pyx_v_word, int __pyx_v_value) { + int __pyx_t_1; + int __pyx_lineno = 0; + const char *__pyx_filename = NULL; + int __pyx_clineno = 0; + PyGILState_STATE __pyx_gilstate_save; + + /* "_state.pxd":252 + * + * inline void set_sent_start(int word, int value) noexcept nogil: + * if value >= 1: # <<<<<<<<<<<<<< + * this._sent_starts.insert(word) + * +*/ + __pyx_t_1 = (__pyx_v_value >= 1); + if (__pyx_t_1) { + + /* "_state.pxd":253 + * inline void set_sent_start(int word, int value) noexcept nogil: + * if value >= 1: + * this._sent_starts.insert(word) # <<<<<<<<<<<<<< + * + * inline bint has_head(int child) noexcept nogil const: +*/ + try { + this->_sent_starts.insert(__pyx_v_word); + } catch(...) { + PyGILState_STATE __pyx_gilstate_save = __Pyx_PyGILState_Ensure(); + __Pyx_CppExn2PyErr(); + __Pyx_PyGILState_Release(__pyx_gilstate_save); + __PYX_ERR(4, 253, __pyx_L1_error) + } + + /* "_state.pxd":252 + * + * inline void set_sent_start(int word, int value) noexcept nogil: + * if value >= 1: # <<<<<<<<<<<<<< + * this._sent_starts.insert(word) + * +*/ + } + + /* "_state.pxd":251 + * return 0 + * + * inline void set_sent_start(int word, int value) noexcept nogil: # <<<<<<<<<<<<<< + * if value >= 1: + * this._sent_starts.insert(word) +*/ + + /* function exit code */ + goto __pyx_L0; + __pyx_L1_error:; + __pyx_gilstate_save = __Pyx_PyGILState_Ensure(); + __Pyx_WriteUnraisable("StateC.set_sent_start", __pyx_clineno, __pyx_lineno, __pyx_filename, 1, 0); + __Pyx_PyGILState_Release(__pyx_gilstate_save); + __pyx_L0:; +} + +/* "_state.pxd":255 + * this._sent_starts.insert(word) + * + * inline bint has_head(int child) noexcept nogil const: # <<<<<<<<<<<<<< + * return this._heads[child] >= 0 + * +*/ + +int __pyx_t_5spacy_8pipeline_17_parser_internals_6_state_StateC::has_head(int __pyx_v_child) const { + int __pyx_r; + + /* "_state.pxd":256 + * + * inline bint has_head(int child) noexcept nogil const: + * return this._heads[child] >= 0 # <<<<<<<<<<<<<< + * + * inline int l_edge(int word) noexcept nogil const: +*/ + __pyx_r = ((this->_heads[__pyx_v_child]) >= 0); + goto __pyx_L0; + + /* "_state.pxd":255 + * this._sent_starts.insert(word) + * + * inline bint has_head(int child) noexcept nogil const: # <<<<<<<<<<<<<< + * return this._heads[child] >= 0 + * +*/ + + /* function exit code */ + __pyx_L0:; + return __pyx_r; +} + +/* "_state.pxd":258 + * return this._heads[child] >= 0 + * + * inline int l_edge(int word) noexcept nogil const: # <<<<<<<<<<<<<< + * return word + * +*/ + +int __pyx_t_5spacy_8pipeline_17_parser_internals_6_state_StateC::l_edge(int __pyx_v_word) const { + int __pyx_r; + + /* "_state.pxd":259 + * + * inline int l_edge(int word) noexcept nogil const: + * return word # <<<<<<<<<<<<<< + * + * inline int r_edge(int word) noexcept nogil const: +*/ + __pyx_r = __pyx_v_word; + goto __pyx_L0; + + /* "_state.pxd":258 + * return this._heads[child] >= 0 + * + * inline int l_edge(int word) noexcept nogil const: # <<<<<<<<<<<<<< + * return word + * +*/ + + /* function exit code */ + __pyx_L0:; + return __pyx_r; +} + +/* "_state.pxd":261 + * return word + * + * inline int r_edge(int word) noexcept nogil const: # <<<<<<<<<<<<<< + * return word + * +*/ + +int __pyx_t_5spacy_8pipeline_17_parser_internals_6_state_StateC::r_edge(int __pyx_v_word) const { + int __pyx_r; + + /* "_state.pxd":262 + * + * inline int r_edge(int word) noexcept nogil const: + * return word # <<<<<<<<<<<<<< + * + * inline int n_arcs(const unordered_map[int, vector[ArcC]] &heads_arcs, int head) noexcept nogil const: +*/ + __pyx_r = __pyx_v_word; + goto __pyx_L0; + + /* "_state.pxd":261 + * return word + * + * inline int r_edge(int word) noexcept nogil const: # <<<<<<<<<<<<<< + * return word + * +*/ + + /* function exit code */ + __pyx_L0:; + return __pyx_r; +} + +/* "_state.pxd":264 + * return word + * + * inline int n_arcs(const unordered_map[int, vector[ArcC]] &heads_arcs, int head) noexcept nogil const: # <<<<<<<<<<<<<< + * cdef int n = 0 + * head_arcs_it = heads_arcs.const_find(head) +*/ + +int __pyx_t_5spacy_8pipeline_17_parser_internals_6_state_StateC::n_arcs(std::unordered_map > const &__pyx_v_heads_arcs, int __pyx_v_head) const { + int __pyx_v_n; + std::unordered_map > ::const_iterator __pyx_v_head_arcs_it; + std::vector const *__pyx_v_arcs; + std::vector ::const_iterator __pyx_v_arcs_it; + struct __pyx_t_5spacy_8pipeline_17_parser_internals_6_state_ArcC __pyx_v_arc; + int __pyx_r; + int __pyx_t_1; + int __pyx_lineno = 0; + const char *__pyx_filename = NULL; + int __pyx_clineno = 0; + PyGILState_STATE __pyx_gilstate_save; + + /* "_state.pxd":265 + * + * inline int n_arcs(const unordered_map[int, vector[ArcC]] &heads_arcs, int head) noexcept nogil const: + * cdef int n = 0 # <<<<<<<<<<<<<< + * head_arcs_it = heads_arcs.const_find(head) + * if head_arcs_it == heads_arcs.const_end(): +*/ + __pyx_v_n = 0; + + /* "_state.pxd":266 + * inline int n_arcs(const unordered_map[int, vector[ArcC]] &heads_arcs, int head) noexcept nogil const: + * cdef int n = 0 + * head_arcs_it = heads_arcs.const_find(head) # <<<<<<<<<<<<<< + * if head_arcs_it == heads_arcs.const_end(): + * return n +*/ + try { + __pyx_v_head_arcs_it = __pyx_v_heads_arcs.find(__pyx_v_head); + } catch(...) { + PyGILState_STATE __pyx_gilstate_save = __Pyx_PyGILState_Ensure(); + __Pyx_CppExn2PyErr(); + __Pyx_PyGILState_Release(__pyx_gilstate_save); + __PYX_ERR(4, 266, __pyx_L1_error) + } + + /* "_state.pxd":267 + * cdef int n = 0 + * head_arcs_it = heads_arcs.const_find(head) + * if head_arcs_it == heads_arcs.const_end(): # <<<<<<<<<<<<<< + * return n + * +*/ + __pyx_t_1 = (__pyx_v_head_arcs_it == __pyx_v_heads_arcs.end()); + if (__pyx_t_1) { + + /* "_state.pxd":268 + * head_arcs_it = heads_arcs.const_find(head) + * if head_arcs_it == heads_arcs.const_end(): + * return n # <<<<<<<<<<<<<< + * + * cdef const vector[ArcC]* arcs = &deref(head_arcs_it).second +*/ + __pyx_r = __pyx_v_n; + goto __pyx_L0; + + /* "_state.pxd":267 + * cdef int n = 0 + * head_arcs_it = heads_arcs.const_find(head) + * if head_arcs_it == heads_arcs.const_end(): # <<<<<<<<<<<<<< + * return n + * +*/ + } + + /* "_state.pxd":270 + * return n + * + * cdef const vector[ArcC]* arcs = &deref(head_arcs_it).second # <<<<<<<<<<<<<< + * arcs_it = arcs.const_begin() + * while arcs_it != arcs.end(): +*/ + __pyx_v_arcs = (&(*__pyx_v_head_arcs_it).second); + + /* "_state.pxd":271 + * + * cdef const vector[ArcC]* arcs = &deref(head_arcs_it).second + * arcs_it = arcs.const_begin() # <<<<<<<<<<<<<< + * while arcs_it != arcs.end(): + * arc = deref(arcs_it) +*/ + try { + __pyx_v_arcs_it = __pyx_v_arcs->begin(); + } catch(...) { + PyGILState_STATE __pyx_gilstate_save = __Pyx_PyGILState_Ensure(); + __Pyx_CppExn2PyErr(); + __Pyx_PyGILState_Release(__pyx_gilstate_save); + __PYX_ERR(4, 271, __pyx_L1_error) + } + + /* "_state.pxd":272 + * cdef const vector[ArcC]* arcs = &deref(head_arcs_it).second + * arcs_it = arcs.const_begin() + * while arcs_it != arcs.end(): # <<<<<<<<<<<<<< + * arc = deref(arcs_it) + * if arc.child != -1: +*/ + while (1) { + __pyx_t_1 = (__pyx_v_arcs_it != __pyx_v_arcs->end()); + if (!__pyx_t_1) break; + + /* "_state.pxd":273 + * arcs_it = arcs.const_begin() + * while arcs_it != arcs.end(): + * arc = deref(arcs_it) # <<<<<<<<<<<<<< + * if arc.child != -1: + * n += 1 +*/ + __pyx_v_arc = (*__pyx_v_arcs_it); + + /* "_state.pxd":274 + * while arcs_it != arcs.end(): + * arc = deref(arcs_it) + * if arc.child != -1: # <<<<<<<<<<<<<< + * n += 1 + * incr(arcs_it) +*/ + __pyx_t_1 = (__pyx_v_arc.child != -1L); + if (__pyx_t_1) { + + /* "_state.pxd":275 + * arc = deref(arcs_it) + * if arc.child != -1: + * n += 1 # <<<<<<<<<<<<<< + * incr(arcs_it) + * +*/ + __pyx_v_n = (__pyx_v_n + 1); + + /* "_state.pxd":274 + * while arcs_it != arcs.end(): + * arc = deref(arcs_it) + * if arc.child != -1: # <<<<<<<<<<<<<< + * n += 1 + * incr(arcs_it) +*/ + } + + /* "_state.pxd":276 + * if arc.child != -1: + * n += 1 + * incr(arcs_it) # <<<<<<<<<<<<<< + * + * return n +*/ + (void)((++__pyx_v_arcs_it)); + } + + /* "_state.pxd":278 + * incr(arcs_it) + * + * return n # <<<<<<<<<<<<<< + * + * inline int n_L(int head) noexcept nogil const: +*/ + __pyx_r = __pyx_v_n; + goto __pyx_L0; + + /* "_state.pxd":264 + * return word + * + * inline int n_arcs(const unordered_map[int, vector[ArcC]] &heads_arcs, int head) noexcept nogil const: # <<<<<<<<<<<<<< + * cdef int n = 0 + * head_arcs_it = heads_arcs.const_find(head) +*/ + + /* function exit code */ + __pyx_L1_error:; + __pyx_gilstate_save = __Pyx_PyGILState_Ensure(); + __Pyx_WriteUnraisable("StateC.n_arcs", __pyx_clineno, __pyx_lineno, __pyx_filename, 1, 0); + __pyx_r = 0; + __Pyx_PyGILState_Release(__pyx_gilstate_save); + __pyx_L0:; + return __pyx_r; +} + +/* "_state.pxd":280 + * return n + * + * inline int n_L(int head) noexcept nogil const: # <<<<<<<<<<<<<< + * return n_arcs(this._left_arcs, head) + * +*/ + +int __pyx_t_5spacy_8pipeline_17_parser_internals_6_state_StateC::n_L(int __pyx_v_head) const { + int __pyx_r; + + /* "_state.pxd":281 + * + * inline int n_L(int head) noexcept nogil const: + * return n_arcs(this._left_arcs, head) # <<<<<<<<<<<<<< + * + * inline int n_R(int head) noexcept nogil const: +*/ + __pyx_r = n_arcs(this->_left_arcs, __pyx_v_head); + goto __pyx_L0; + + /* "_state.pxd":280 + * return n + * + * inline int n_L(int head) noexcept nogil const: # <<<<<<<<<<<<<< + * return n_arcs(this._left_arcs, head) + * +*/ + + /* function exit code */ + __pyx_L0:; + return __pyx_r; +} + +/* "_state.pxd":283 + * return n_arcs(this._left_arcs, head) + * + * inline int n_R(int head) noexcept nogil const: # <<<<<<<<<<<<<< + * return n_arcs(this._right_arcs, head) + * +*/ + +int __pyx_t_5spacy_8pipeline_17_parser_internals_6_state_StateC::n_R(int __pyx_v_head) const { + int __pyx_r; + + /* "_state.pxd":284 + * + * inline int n_R(int head) noexcept nogil const: + * return n_arcs(this._right_arcs, head) # <<<<<<<<<<<<<< + * + * inline bint stack_is_connected() noexcept nogil const: +*/ + __pyx_r = n_arcs(this->_right_arcs, __pyx_v_head); + goto __pyx_L0; + + /* "_state.pxd":283 + * return n_arcs(this._left_arcs, head) + * + * inline int n_R(int head) noexcept nogil const: # <<<<<<<<<<<<<< + * return n_arcs(this._right_arcs, head) + * +*/ + + /* function exit code */ + __pyx_L0:; + return __pyx_r; +} + +/* "_state.pxd":286 + * return n_arcs(this._right_arcs, head) + * + * inline bint stack_is_connected() noexcept nogil const: # <<<<<<<<<<<<<< + * return False + * +*/ + +int __pyx_t_5spacy_8pipeline_17_parser_internals_6_state_StateC::stack_is_connected(void) const { + int __pyx_r; + + /* "_state.pxd":287 + * + * inline bint stack_is_connected() noexcept nogil const: + * return False # <<<<<<<<<<<<<< + * + * inline bint entity_is_open() noexcept nogil const: +*/ + __pyx_r = 0; + goto __pyx_L0; + + /* "_state.pxd":286 + * return n_arcs(this._right_arcs, head) + * + * inline bint stack_is_connected() noexcept nogil const: # <<<<<<<<<<<<<< + * return False + * +*/ + + /* function exit code */ + __pyx_L0:; + return __pyx_r; +} + +/* "_state.pxd":289 + * return False + * + * inline bint entity_is_open() noexcept nogil const: # <<<<<<<<<<<<<< + * if this._ents.size() == 0: + * return False +*/ + +int __pyx_t_5spacy_8pipeline_17_parser_internals_6_state_StateC::entity_is_open(void) const { + int __pyx_r; + int __pyx_t_1; + + /* "_state.pxd":290 + * + * inline bint entity_is_open() noexcept nogil const: + * if this._ents.size() == 0: # <<<<<<<<<<<<<< + * return False + * else: +*/ + __pyx_t_1 = (this->_ents.size() == 0); + if (__pyx_t_1) { + + /* "_state.pxd":291 + * inline bint entity_is_open() noexcept nogil const: + * if this._ents.size() == 0: + * return False # <<<<<<<<<<<<<< + * else: + * return this._ents.back().end == -1 +*/ + __pyx_r = 0; + goto __pyx_L0; + + /* "_state.pxd":290 + * + * inline bint entity_is_open() noexcept nogil const: + * if this._ents.size() == 0: # <<<<<<<<<<<<<< + * return False + * else: +*/ + } + + /* "_state.pxd":293 + * return False + * else: + * return this._ents.back().end == -1 # <<<<<<<<<<<<<< + * + * inline int stack_depth() noexcept nogil const: +*/ + /*else*/ { + __pyx_r = (this->_ents.back().end == -1L); + goto __pyx_L0; + } + + /* "_state.pxd":289 + * return False + * + * inline bint entity_is_open() noexcept nogil const: # <<<<<<<<<<<<<< + * if this._ents.size() == 0: + * return False +*/ + + /* function exit code */ + __pyx_L0:; + return __pyx_r; +} + +/* "_state.pxd":295 + * return this._ents.back().end == -1 + * + * inline int stack_depth() noexcept nogil const: # <<<<<<<<<<<<<< + * return this._stack.size() + * +*/ + +int __pyx_t_5spacy_8pipeline_17_parser_internals_6_state_StateC::stack_depth(void) const { + int __pyx_r; + + /* "_state.pxd":296 + * + * inline int stack_depth() noexcept nogil const: + * return this._stack.size() # <<<<<<<<<<<<<< + * + * inline int buffer_length() noexcept nogil const: +*/ + __pyx_r = this->_stack.size(); + goto __pyx_L0; + + /* "_state.pxd":295 + * return this._ents.back().end == -1 + * + * inline int stack_depth() noexcept nogil const: # <<<<<<<<<<<<<< + * return this._stack.size() + * +*/ + + /* function exit code */ + __pyx_L0:; + return __pyx_r; +} + +/* "_state.pxd":298 + * return this._stack.size() + * + * inline int buffer_length() noexcept nogil const: # <<<<<<<<<<<<<< + * return (this.length - this._b_i) + this._rebuffer.size() + * +*/ + +int __pyx_t_5spacy_8pipeline_17_parser_internals_6_state_StateC::buffer_length(void) const { + int __pyx_r; + + /* "_state.pxd":299 + * + * inline int buffer_length() noexcept nogil const: + * return (this.length - this._b_i) + this._rebuffer.size() # <<<<<<<<<<<<<< + * + * inline void push() noexcept nogil: +*/ + __pyx_r = ((this->length - this->_b_i) + this->_rebuffer.size()); + goto __pyx_L0; + + /* "_state.pxd":298 + * return this._stack.size() + * + * inline int buffer_length() noexcept nogil const: # <<<<<<<<<<<<<< + * return (this.length - this._b_i) + this._rebuffer.size() + * +*/ + + /* function exit code */ + __pyx_L0:; + return __pyx_r; +} + +/* "_state.pxd":301 + * return (this.length - this._b_i) + this._rebuffer.size() + * + * inline void push() noexcept nogil: # <<<<<<<<<<<<<< + * b0 = this.B(0) + * if this._rebuffer.size(): +*/ + +void __pyx_t_5spacy_8pipeline_17_parser_internals_6_state_StateC::push(void) { + int __pyx_v_b0; + int __pyx_t_1; + int __pyx_t_2; + int __pyx_lineno = 0; + const char *__pyx_filename = NULL; + int __pyx_clineno = 0; + PyGILState_STATE __pyx_gilstate_save; + + /* "_state.pxd":302 + * + * inline void push() noexcept nogil: + * b0 = this.B(0) # <<<<<<<<<<<<<< + * if this._rebuffer.size(): + * b0 = this._rebuffer.back() +*/ + __pyx_v_b0 = this->B(0); + + /* "_state.pxd":303 + * inline void push() noexcept nogil: + * b0 = this.B(0) + * if this._rebuffer.size(): # <<<<<<<<<<<<<< + * b0 = this._rebuffer.back() + * this._rebuffer.pop_back() +*/ + __pyx_t_1 = (this->_rebuffer.size() != 0); + if (__pyx_t_1) { + + /* "_state.pxd":304 + * b0 = this.B(0) + * if this._rebuffer.size(): + * b0 = this._rebuffer.back() # <<<<<<<<<<<<<< + * this._rebuffer.pop_back() + * else: +*/ + __pyx_v_b0 = this->_rebuffer.back(); + + /* "_state.pxd":305 + * if this._rebuffer.size(): + * b0 = this._rebuffer.back() + * this._rebuffer.pop_back() # <<<<<<<<<<<<<< + * else: + * b0 = this._b_i +*/ + this->_rebuffer.pop_back(); + + /* "_state.pxd":303 + * inline void push() noexcept nogil: + * b0 = this.B(0) + * if this._rebuffer.size(): # <<<<<<<<<<<<<< + * b0 = this._rebuffer.back() + * this._rebuffer.pop_back() +*/ + goto __pyx_L3; + } + + /* "_state.pxd":307 + * this._rebuffer.pop_back() + * else: + * b0 = this._b_i # <<<<<<<<<<<<<< + * this._b_i += 1 + * this._stack.push_back(b0) +*/ + /*else*/ { + __pyx_t_2 = this->_b_i; + __pyx_v_b0 = __pyx_t_2; + + /* "_state.pxd":308 + * else: + * b0 = this._b_i + * this._b_i += 1 # <<<<<<<<<<<<<< + * this._stack.push_back(b0) + * +*/ + this->_b_i = (this->_b_i + 1); + } + __pyx_L3:; + + /* "_state.pxd":309 + * b0 = this._b_i + * this._b_i += 1 + * this._stack.push_back(b0) # <<<<<<<<<<<<<< + * + * inline void pop() noexcept nogil: +*/ + try { + this->_stack.push_back(__pyx_v_b0); + } catch(...) { + PyGILState_STATE __pyx_gilstate_save = __Pyx_PyGILState_Ensure(); + __Pyx_CppExn2PyErr(); + __Pyx_PyGILState_Release(__pyx_gilstate_save); + __PYX_ERR(4, 309, __pyx_L1_error) + } + + /* "_state.pxd":301 + * return (this.length - this._b_i) + this._rebuffer.size() + * + * inline void push() noexcept nogil: # <<<<<<<<<<<<<< + * b0 = this.B(0) + * if this._rebuffer.size(): +*/ + + /* function exit code */ + goto __pyx_L0; + __pyx_L1_error:; + __pyx_gilstate_save = __Pyx_PyGILState_Ensure(); + __Pyx_WriteUnraisable("StateC.push", __pyx_clineno, __pyx_lineno, __pyx_filename, 1, 0); + __Pyx_PyGILState_Release(__pyx_gilstate_save); + __pyx_L0:; +} + +/* "_state.pxd":311 + * this._stack.push_back(b0) + * + * inline void pop() noexcept nogil: # <<<<<<<<<<<<<< + * this._stack.pop_back() + * +*/ + +void __pyx_t_5spacy_8pipeline_17_parser_internals_6_state_StateC::pop(void) { + + /* "_state.pxd":312 + * + * inline void pop() noexcept nogil: + * this._stack.pop_back() # <<<<<<<<<<<<<< + * + * inline void force_final() noexcept nogil: +*/ + this->_stack.pop_back(); + + /* "_state.pxd":311 + * this._stack.push_back(b0) + * + * inline void pop() noexcept nogil: # <<<<<<<<<<<<<< + * this._stack.pop_back() + * +*/ + + /* function exit code */ +} + +/* "_state.pxd":314 + * this._stack.pop_back() + * + * inline void force_final() noexcept nogil: # <<<<<<<<<<<<<< + * # This should only be used in desperate situations, as it may leave + * # the analysis in an unexpected state. +*/ + +void __pyx_t_5spacy_8pipeline_17_parser_internals_6_state_StateC::force_final(void) { + int __pyx_t_1; + + /* "_state.pxd":317 + * # This should only be used in desperate situations, as it may leave + * # the analysis in an unexpected state. + * this._stack.clear() # <<<<<<<<<<<<<< + * this._b_i = this.length + * +*/ + this->_stack.clear(); + + /* "_state.pxd":318 + * # the analysis in an unexpected state. + * this._stack.clear() + * this._b_i = this.length # <<<<<<<<<<<<<< + * + * inline void unshift() noexcept nogil: +*/ + __pyx_t_1 = this->length; + this->_b_i = __pyx_t_1; + + /* "_state.pxd":314 + * this._stack.pop_back() + * + * inline void force_final() noexcept nogil: # <<<<<<<<<<<<<< + * # This should only be used in desperate situations, as it may leave + * # the analysis in an unexpected state. +*/ + + /* function exit code */ +} + +/* "_state.pxd":320 + * this._b_i = this.length + * + * inline void unshift() noexcept nogil: # <<<<<<<<<<<<<< + * s0 = this._stack.back() + * this._unshiftable[s0] = 1 +*/ + +void __pyx_t_5spacy_8pipeline_17_parser_internals_6_state_StateC::unshift(void) { + int __pyx_v_s0; + int __pyx_lineno = 0; + const char *__pyx_filename = NULL; + int __pyx_clineno = 0; + PyGILState_STATE __pyx_gilstate_save; + + /* "_state.pxd":321 + * + * inline void unshift() noexcept nogil: + * s0 = this._stack.back() # <<<<<<<<<<<<<< + * this._unshiftable[s0] = 1 + * this._rebuffer.push_back(s0) +*/ + __pyx_v_s0 = this->_stack.back(); + + /* "_state.pxd":322 + * inline void unshift() noexcept nogil: + * s0 = this._stack.back() + * this._unshiftable[s0] = 1 # <<<<<<<<<<<<<< + * this._rebuffer.push_back(s0) + * this._stack.pop_back() +*/ + (this->_unshiftable[__pyx_v_s0]) = 1; + + /* "_state.pxd":323 + * s0 = this._stack.back() + * this._unshiftable[s0] = 1 + * this._rebuffer.push_back(s0) # <<<<<<<<<<<<<< + * this._stack.pop_back() + * +*/ + try { + this->_rebuffer.push_back(__pyx_v_s0); + } catch(...) { + PyGILState_STATE __pyx_gilstate_save = __Pyx_PyGILState_Ensure(); + __Pyx_CppExn2PyErr(); + __Pyx_PyGILState_Release(__pyx_gilstate_save); + __PYX_ERR(4, 323, __pyx_L1_error) + } + + /* "_state.pxd":324 + * this._unshiftable[s0] = 1 + * this._rebuffer.push_back(s0) + * this._stack.pop_back() # <<<<<<<<<<<<<< + * + * inline int is_unshiftable(int item) noexcept nogil const: +*/ + this->_stack.pop_back(); + + /* "_state.pxd":320 + * this._b_i = this.length + * + * inline void unshift() noexcept nogil: # <<<<<<<<<<<<<< + * s0 = this._stack.back() + * this._unshiftable[s0] = 1 +*/ + + /* function exit code */ + goto __pyx_L0; + __pyx_L1_error:; + __pyx_gilstate_save = __Pyx_PyGILState_Ensure(); + __Pyx_WriteUnraisable("StateC.unshift", __pyx_clineno, __pyx_lineno, __pyx_filename, 1, 0); + __Pyx_PyGILState_Release(__pyx_gilstate_save); + __pyx_L0:; +} + +/* "_state.pxd":326 + * this._stack.pop_back() + * + * inline int is_unshiftable(int item) noexcept nogil const: # <<<<<<<<<<<<<< + * if item >= this._unshiftable.size(): + * return 0 +*/ + +int __pyx_t_5spacy_8pipeline_17_parser_internals_6_state_StateC::is_unshiftable(int __pyx_v_item) const { + int __pyx_r; + int __pyx_t_1; + bool __pyx_t_2; + int __pyx_lineno = 0; + const char *__pyx_filename = NULL; + int __pyx_clineno = 0; + PyGILState_STATE __pyx_gilstate_save; + + /* "_state.pxd":327 + * + * inline int is_unshiftable(int item) noexcept nogil const: + * if item >= this._unshiftable.size(): # <<<<<<<<<<<<<< + * return 0 + * else: +*/ + __pyx_t_1 = (__pyx_v_item >= this->_unshiftable.size()); + if (__pyx_t_1) { + + /* "_state.pxd":328 + * inline int is_unshiftable(int item) noexcept nogil const: + * if item >= this._unshiftable.size(): + * return 0 # <<<<<<<<<<<<<< + * else: + * return this._unshiftable.at(item) +*/ + __pyx_r = 0; + goto __pyx_L0; + + /* "_state.pxd":327 + * + * inline int is_unshiftable(int item) noexcept nogil const: + * if item >= this._unshiftable.size(): # <<<<<<<<<<<<<< + * return 0 + * else: +*/ + } + + /* "_state.pxd":330 + * return 0 + * else: + * return this._unshiftable.at(item) # <<<<<<<<<<<<<< + * + * inline void set_reshiftable(int item) noexcept nogil: +*/ + /*else*/ { + try { + __pyx_t_2 = this->_unshiftable.at(__pyx_v_item); + } catch(...) { + PyGILState_STATE __pyx_gilstate_save = __Pyx_PyGILState_Ensure(); + __Pyx_CppExn2PyErr(); + __Pyx_PyGILState_Release(__pyx_gilstate_save); + __PYX_ERR(4, 330, __pyx_L1_error) + } + __pyx_r = __pyx_t_2; + goto __pyx_L0; + } + + /* "_state.pxd":326 + * this._stack.pop_back() + * + * inline int is_unshiftable(int item) noexcept nogil const: # <<<<<<<<<<<<<< + * if item >= this._unshiftable.size(): + * return 0 +*/ + + /* function exit code */ + __pyx_L1_error:; + __pyx_gilstate_save = __Pyx_PyGILState_Ensure(); + __Pyx_WriteUnraisable("StateC.is_unshiftable", __pyx_clineno, __pyx_lineno, __pyx_filename, 1, 0); + __pyx_r = 0; + __Pyx_PyGILState_Release(__pyx_gilstate_save); + __pyx_L0:; + return __pyx_r; +} + +/* "_state.pxd":332 + * return this._unshiftable.at(item) + * + * inline void set_reshiftable(int item) noexcept nogil: # <<<<<<<<<<<<<< + * if item < this._unshiftable.size(): + * this._unshiftable[item] = 0 +*/ + +void __pyx_t_5spacy_8pipeline_17_parser_internals_6_state_StateC::set_reshiftable(int __pyx_v_item) { + int __pyx_t_1; + + /* "_state.pxd":333 + * + * inline void set_reshiftable(int item) noexcept nogil: + * if item < this._unshiftable.size(): # <<<<<<<<<<<<<< + * this._unshiftable[item] = 0 + * +*/ + __pyx_t_1 = (__pyx_v_item < this->_unshiftable.size()); + if (__pyx_t_1) { + + /* "_state.pxd":334 + * inline void set_reshiftable(int item) noexcept nogil: + * if item < this._unshiftable.size(): + * this._unshiftable[item] = 0 # <<<<<<<<<<<<<< + * + * inline void add_arc(int head, int child, attr_t label) noexcept nogil: +*/ + (this->_unshiftable[__pyx_v_item]) = 0; + + /* "_state.pxd":333 + * + * inline void set_reshiftable(int item) noexcept nogil: + * if item < this._unshiftable.size(): # <<<<<<<<<<<<<< + * this._unshiftable[item] = 0 + * +*/ + } + + /* "_state.pxd":332 + * return this._unshiftable.at(item) + * + * inline void set_reshiftable(int item) noexcept nogil: # <<<<<<<<<<<<<< + * if item < this._unshiftable.size(): + * this._unshiftable[item] = 0 +*/ + + /* function exit code */ +} + +/* "_state.pxd":336 + * this._unshiftable[item] = 0 + * + * inline void add_arc(int head, int child, attr_t label) noexcept nogil: # <<<<<<<<<<<<<< + * if this.has_head(child): + * this.del_arc(this.H(child), child) +*/ + +void __pyx_t_5spacy_8pipeline_17_parser_internals_6_state_StateC::add_arc(int __pyx_v_head, int __pyx_v_child, __pyx_t_5spacy_8typedefs_attr_t __pyx_v_label) { + struct __pyx_t_5spacy_8pipeline_17_parser_internals_6_state_ArcC __pyx_v_arc; + int __pyx_t_1; + int __pyx_lineno = 0; + const char *__pyx_filename = NULL; + int __pyx_clineno = 0; + PyGILState_STATE __pyx_gilstate_save; + + /* "_state.pxd":337 + * + * inline void add_arc(int head, int child, attr_t label) noexcept nogil: + * if this.has_head(child): # <<<<<<<<<<<<<< + * this.del_arc(this.H(child), child) + * cdef ArcC arc +*/ + __pyx_t_1 = this->has_head(__pyx_v_child); + if (__pyx_t_1) { + + /* "_state.pxd":338 + * inline void add_arc(int head, int child, attr_t label) noexcept nogil: + * if this.has_head(child): + * this.del_arc(this.H(child), child) # <<<<<<<<<<<<<< + * cdef ArcC arc + * arc.head = head +*/ + this->del_arc(this->H(__pyx_v_child), __pyx_v_child); + + /* "_state.pxd":337 + * + * inline void add_arc(int head, int child, attr_t label) noexcept nogil: + * if this.has_head(child): # <<<<<<<<<<<<<< + * this.del_arc(this.H(child), child) + * cdef ArcC arc +*/ + } + + /* "_state.pxd":340 + * this.del_arc(this.H(child), child) + * cdef ArcC arc + * arc.head = head # <<<<<<<<<<<<<< + * arc.child = child + * arc.label = label +*/ + __pyx_v_arc.head = __pyx_v_head; + + /* "_state.pxd":341 + * cdef ArcC arc + * arc.head = head + * arc.child = child # <<<<<<<<<<<<<< + * arc.label = label + * if head > child: +*/ + __pyx_v_arc.child = __pyx_v_child; + + /* "_state.pxd":342 + * arc.head = head + * arc.child = child + * arc.label = label # <<<<<<<<<<<<<< + * if head > child: + * this._left_arcs[arc.head].push_back(arc) +*/ + __pyx_v_arc.label = __pyx_v_label; + + /* "_state.pxd":343 + * arc.child = child + * arc.label = label + * if head > child: # <<<<<<<<<<<<<< + * this._left_arcs[arc.head].push_back(arc) + * else: +*/ + __pyx_t_1 = (__pyx_v_head > __pyx_v_child); + if (__pyx_t_1) { + + /* "_state.pxd":344 + * arc.label = label + * if head > child: + * this._left_arcs[arc.head].push_back(arc) # <<<<<<<<<<<<<< + * else: + * this._right_arcs[arc.head].push_back(arc) +*/ + try { + (this->_left_arcs[__pyx_v_arc.head]).push_back(__pyx_v_arc); + } catch(...) { + PyGILState_STATE __pyx_gilstate_save = __Pyx_PyGILState_Ensure(); + __Pyx_CppExn2PyErr(); + __Pyx_PyGILState_Release(__pyx_gilstate_save); + __PYX_ERR(4, 344, __pyx_L1_error) + } + + /* "_state.pxd":343 + * arc.child = child + * arc.label = label + * if head > child: # <<<<<<<<<<<<<< + * this._left_arcs[arc.head].push_back(arc) + * else: +*/ + goto __pyx_L4; + } + + /* "_state.pxd":346 + * this._left_arcs[arc.head].push_back(arc) + * else: + * this._right_arcs[arc.head].push_back(arc) # <<<<<<<<<<<<<< + * this._heads[child] = head + * +*/ + /*else*/ { + try { + (this->_right_arcs[__pyx_v_arc.head]).push_back(__pyx_v_arc); + } catch(...) { + PyGILState_STATE __pyx_gilstate_save = __Pyx_PyGILState_Ensure(); + __Pyx_CppExn2PyErr(); + __Pyx_PyGILState_Release(__pyx_gilstate_save); + __PYX_ERR(4, 346, __pyx_L1_error) + } + } + __pyx_L4:; + + /* "_state.pxd":347 + * else: + * this._right_arcs[arc.head].push_back(arc) + * this._heads[child] = head # <<<<<<<<<<<<<< + * + * inline void map_del_arc(unordered_map[int, vector[ArcC]]* heads_arcs, int h_i, int c_i) noexcept nogil: +*/ + (this->_heads[__pyx_v_child]) = __pyx_v_head; + + /* "_state.pxd":336 + * this._unshiftable[item] = 0 + * + * inline void add_arc(int head, int child, attr_t label) noexcept nogil: # <<<<<<<<<<<<<< + * if this.has_head(child): + * this.del_arc(this.H(child), child) +*/ + + /* function exit code */ + goto __pyx_L0; + __pyx_L1_error:; + __pyx_gilstate_save = __Pyx_PyGILState_Ensure(); + __Pyx_WriteUnraisable("StateC.add_arc", __pyx_clineno, __pyx_lineno, __pyx_filename, 1, 0); + __Pyx_PyGILState_Release(__pyx_gilstate_save); + __pyx_L0:; +} + +/* "_state.pxd":349 + * this._heads[child] = head + * + * inline void map_del_arc(unordered_map[int, vector[ArcC]]* heads_arcs, int h_i, int c_i) noexcept nogil: # <<<<<<<<<<<<<< + * arcs_it = heads_arcs.find(h_i) + * if arcs_it == heads_arcs.end(): +*/ + +void __pyx_t_5spacy_8pipeline_17_parser_internals_6_state_StateC::map_del_arc(std::unordered_map > *__pyx_v_heads_arcs, int __pyx_v_h_i, int __pyx_v_c_i) { + std::unordered_map > ::iterator __pyx_v_arcs_it; + std::vector *__pyx_v_arcs; + struct __pyx_t_5spacy_8pipeline_17_parser_internals_6_state_ArcC __pyx_v_arc; + std::vector ::size_type __pyx_v_i; + int __pyx_t_1; + int __pyx_t_2; + std::vector ::size_type __pyx_t_3; + std::vector ::size_type __pyx_t_4; + std::vector ::size_type __pyx_t_5; + __Pyx_FakeReference __pyx_t_6; + int __pyx_lineno = 0; + const char *__pyx_filename = NULL; + int __pyx_clineno = 0; + PyGILState_STATE __pyx_gilstate_save; + + /* "_state.pxd":350 + * + * inline void map_del_arc(unordered_map[int, vector[ArcC]]* heads_arcs, int h_i, int c_i) noexcept nogil: + * arcs_it = heads_arcs.find(h_i) # <<<<<<<<<<<<<< + * if arcs_it == heads_arcs.end(): + * return +*/ + __pyx_v_arcs_it = __pyx_v_heads_arcs->find(__pyx_v_h_i); + + /* "_state.pxd":351 + * inline void map_del_arc(unordered_map[int, vector[ArcC]]* heads_arcs, int h_i, int c_i) noexcept nogil: + * arcs_it = heads_arcs.find(h_i) + * if arcs_it == heads_arcs.end(): # <<<<<<<<<<<<<< + * return + * +*/ + __pyx_t_1 = (__pyx_v_arcs_it == __pyx_v_heads_arcs->end()); + if (__pyx_t_1) { + + /* "_state.pxd":352 + * arcs_it = heads_arcs.find(h_i) + * if arcs_it == heads_arcs.end(): + * return # <<<<<<<<<<<<<< + * + * arcs = &deref(arcs_it).second +*/ + goto __pyx_L0; + + /* "_state.pxd":351 + * inline void map_del_arc(unordered_map[int, vector[ArcC]]* heads_arcs, int h_i, int c_i) noexcept nogil: + * arcs_it = heads_arcs.find(h_i) + * if arcs_it == heads_arcs.end(): # <<<<<<<<<<<<<< + * return + * +*/ + } + + /* "_state.pxd":354 + * return + * + * arcs = &deref(arcs_it).second # <<<<<<<<<<<<<< + * if arcs.size() == 0: + * return +*/ + __pyx_v_arcs = (&(*__pyx_v_arcs_it).second); + + /* "_state.pxd":355 + * + * arcs = &deref(arcs_it).second + * if arcs.size() == 0: # <<<<<<<<<<<<<< + * return + * +*/ + __pyx_t_1 = (__pyx_v_arcs->size() == 0); + if (__pyx_t_1) { + + /* "_state.pxd":356 + * arcs = &deref(arcs_it).second + * if arcs.size() == 0: + * return # <<<<<<<<<<<<<< + * + * arc = arcs.back() +*/ + goto __pyx_L0; + + /* "_state.pxd":355 + * + * arcs = &deref(arcs_it).second + * if arcs.size() == 0: # <<<<<<<<<<<<<< + * return + * +*/ + } + + /* "_state.pxd":358 + * return + * + * arc = arcs.back() # <<<<<<<<<<<<<< + * if arc.head == h_i and arc.child == c_i: + * arcs.pop_back() +*/ + __pyx_v_arc = __pyx_v_arcs->back(); + + /* "_state.pxd":359 + * + * arc = arcs.back() + * if arc.head == h_i and arc.child == c_i: # <<<<<<<<<<<<<< + * arcs.pop_back() + * else: +*/ + __pyx_t_2 = (__pyx_v_arc.head == __pyx_v_h_i); + if (__pyx_t_2) { + } else { + __pyx_t_1 = __pyx_t_2; + goto __pyx_L6_bool_binop_done; + } + __pyx_t_2 = (__pyx_v_arc.child == __pyx_v_c_i); + __pyx_t_1 = __pyx_t_2; + __pyx_L6_bool_binop_done:; + if (__pyx_t_1) { + + /* "_state.pxd":360 + * arc = arcs.back() + * if arc.head == h_i and arc.child == c_i: + * arcs.pop_back() # <<<<<<<<<<<<<< + * else: + * for i in range(arcs.size()-1): +*/ + __pyx_v_arcs->pop_back(); + + /* "_state.pxd":359 + * + * arc = arcs.back() + * if arc.head == h_i and arc.child == c_i: # <<<<<<<<<<<<<< + * arcs.pop_back() + * else: +*/ + goto __pyx_L5; + } + + /* "_state.pxd":362 + * arcs.pop_back() + * else: + * for i in range(arcs.size()-1): # <<<<<<<<<<<<<< + * arc = arcs.at(i) + * if arc.head == h_i and arc.child == c_i: +*/ + /*else*/ { + __pyx_t_3 = (__pyx_v_arcs->size() - 1); + __pyx_t_4 = __pyx_t_3; + for (__pyx_t_5 = 0; __pyx_t_5 < __pyx_t_4; __pyx_t_5+=1) { + __pyx_v_i = __pyx_t_5; + + /* "_state.pxd":363 + * else: + * for i in range(arcs.size()-1): + * arc = arcs.at(i) # <<<<<<<<<<<<<< + * if arc.head == h_i and arc.child == c_i: + * arc.head = -1 +*/ + try { + __pyx_t_6 = __pyx_v_arcs->at(__pyx_v_i); + } catch(...) { + PyGILState_STATE __pyx_gilstate_save = __Pyx_PyGILState_Ensure(); + __Pyx_CppExn2PyErr(); + __Pyx_PyGILState_Release(__pyx_gilstate_save); + __PYX_ERR(4, 363, __pyx_L1_error) + } + __pyx_v_arc = __pyx_t_6; + + /* "_state.pxd":364 + * for i in range(arcs.size()-1): + * arc = arcs.at(i) + * if arc.head == h_i and arc.child == c_i: # <<<<<<<<<<<<<< + * arc.head = -1 + * arc.child = -1 +*/ + __pyx_t_2 = (__pyx_v_arc.head == __pyx_v_h_i); + if (__pyx_t_2) { + } else { + __pyx_t_1 = __pyx_t_2; + goto __pyx_L11_bool_binop_done; + } + __pyx_t_2 = (__pyx_v_arc.child == __pyx_v_c_i); + __pyx_t_1 = __pyx_t_2; + __pyx_L11_bool_binop_done:; + if (__pyx_t_1) { + + /* "_state.pxd":365 + * arc = arcs.at(i) + * if arc.head == h_i and arc.child == c_i: + * arc.head = -1 # <<<<<<<<<<<<<< + * arc.child = -1 + * arc.label = 0 +*/ + __pyx_v_arc.head = -1; + + /* "_state.pxd":366 + * if arc.head == h_i and arc.child == c_i: + * arc.head = -1 + * arc.child = -1 # <<<<<<<<<<<<<< + * arc.label = 0 + * break +*/ + __pyx_v_arc.child = -1; + + /* "_state.pxd":367 + * arc.head = -1 + * arc.child = -1 + * arc.label = 0 # <<<<<<<<<<<<<< + * break + * +*/ + __pyx_v_arc.label = 0; + + /* "_state.pxd":368 + * arc.child = -1 + * arc.label = 0 + * break # <<<<<<<<<<<<<< + * + * inline void del_arc(int h_i, int c_i) noexcept nogil: +*/ + goto __pyx_L9_break; + + /* "_state.pxd":364 + * for i in range(arcs.size()-1): + * arc = arcs.at(i) + * if arc.head == h_i and arc.child == c_i: # <<<<<<<<<<<<<< + * arc.head = -1 + * arc.child = -1 +*/ + } + } + __pyx_L9_break:; + } + __pyx_L5:; + + /* "_state.pxd":349 + * this._heads[child] = head + * + * inline void map_del_arc(unordered_map[int, vector[ArcC]]* heads_arcs, int h_i, int c_i) noexcept nogil: # <<<<<<<<<<<<<< + * arcs_it = heads_arcs.find(h_i) + * if arcs_it == heads_arcs.end(): +*/ + + /* function exit code */ + goto __pyx_L0; + __pyx_L1_error:; + __pyx_gilstate_save = __Pyx_PyGILState_Ensure(); + __Pyx_WriteUnraisable("StateC.map_del_arc", __pyx_clineno, __pyx_lineno, __pyx_filename, 1, 0); + __Pyx_PyGILState_Release(__pyx_gilstate_save); + __pyx_L0:; +} + +/* "_state.pxd":370 + * break + * + * inline void del_arc(int h_i, int c_i) noexcept nogil: # <<<<<<<<<<<<<< + * if h_i > c_i: + * this.map_del_arc(&this._left_arcs, h_i, c_i) +*/ + +void __pyx_t_5spacy_8pipeline_17_parser_internals_6_state_StateC::del_arc(int __pyx_v_h_i, int __pyx_v_c_i) { + int __pyx_t_1; + + /* "_state.pxd":371 + * + * inline void del_arc(int h_i, int c_i) noexcept nogil: + * if h_i > c_i: # <<<<<<<<<<<<<< + * this.map_del_arc(&this._left_arcs, h_i, c_i) + * else: +*/ + __pyx_t_1 = (__pyx_v_h_i > __pyx_v_c_i); + if (__pyx_t_1) { + + /* "_state.pxd":372 + * inline void del_arc(int h_i, int c_i) noexcept nogil: + * if h_i > c_i: + * this.map_del_arc(&this._left_arcs, h_i, c_i) # <<<<<<<<<<<<<< + * else: + * this.map_del_arc(&this._right_arcs, h_i, c_i) +*/ + this->map_del_arc((&this->_left_arcs), __pyx_v_h_i, __pyx_v_c_i); + + /* "_state.pxd":371 + * + * inline void del_arc(int h_i, int c_i) noexcept nogil: + * if h_i > c_i: # <<<<<<<<<<<<<< + * this.map_del_arc(&this._left_arcs, h_i, c_i) + * else: +*/ + goto __pyx_L3; + } + + /* "_state.pxd":374 + * this.map_del_arc(&this._left_arcs, h_i, c_i) + * else: + * this.map_del_arc(&this._right_arcs, h_i, c_i) # <<<<<<<<<<<<<< + * + * inline SpanC get_ent() noexcept nogil const: +*/ + /*else*/ { + this->map_del_arc((&this->_right_arcs), __pyx_v_h_i, __pyx_v_c_i); + } + __pyx_L3:; + + /* "_state.pxd":370 + * break + * + * inline void del_arc(int h_i, int c_i) noexcept nogil: # <<<<<<<<<<<<<< + * if h_i > c_i: + * this.map_del_arc(&this._left_arcs, h_i, c_i) +*/ + + /* function exit code */ +} + +/* "_state.pxd":376 + * this.map_del_arc(&this._right_arcs, h_i, c_i) + * + * inline SpanC get_ent() noexcept nogil const: # <<<<<<<<<<<<<< + * cdef SpanC ent + * if this._ents.size() == 0: +*/ + +struct __pyx_t_5spacy_7structs_SpanC __pyx_t_5spacy_8pipeline_17_parser_internals_6_state_StateC::get_ent(void) const { + struct __pyx_t_5spacy_7structs_SpanC __pyx_v_ent; + struct __pyx_t_5spacy_7structs_SpanC __pyx_r; + int __pyx_t_1; + + /* "_state.pxd":378 + * inline SpanC get_ent() noexcept nogil const: + * cdef SpanC ent + * if this._ents.size() == 0: # <<<<<<<<<<<<<< + * ent.start = 0 + * ent.end = 0 +*/ + __pyx_t_1 = (this->_ents.size() == 0); + if (__pyx_t_1) { + + /* "_state.pxd":379 + * cdef SpanC ent + * if this._ents.size() == 0: + * ent.start = 0 # <<<<<<<<<<<<<< + * ent.end = 0 + * ent.label = 0 +*/ + __pyx_v_ent.start = 0; + + /* "_state.pxd":380 + * if this._ents.size() == 0: + * ent.start = 0 + * ent.end = 0 # <<<<<<<<<<<<<< + * ent.label = 0 + * return ent +*/ + __pyx_v_ent.end = 0; + + /* "_state.pxd":381 + * ent.start = 0 + * ent.end = 0 + * ent.label = 0 # <<<<<<<<<<<<<< + * return ent + * else: +*/ + __pyx_v_ent.label = 0; + + /* "_state.pxd":382 + * ent.end = 0 + * ent.label = 0 + * return ent # <<<<<<<<<<<<<< + * else: + * return this._ents.back() +*/ + __pyx_r = __pyx_v_ent; + goto __pyx_L0; + + /* "_state.pxd":378 + * inline SpanC get_ent() noexcept nogil const: + * cdef SpanC ent + * if this._ents.size() == 0: # <<<<<<<<<<<<<< + * ent.start = 0 + * ent.end = 0 +*/ + } + + /* "_state.pxd":384 + * return ent + * else: + * return this._ents.back() # <<<<<<<<<<<<<< + * + * inline void open_ent(attr_t label) noexcept nogil: +*/ + /*else*/ { + __pyx_r = this->_ents.back(); + goto __pyx_L0; + } + + /* "_state.pxd":376 + * this.map_del_arc(&this._right_arcs, h_i, c_i) + * + * inline SpanC get_ent() noexcept nogil const: # <<<<<<<<<<<<<< + * cdef SpanC ent + * if this._ents.size() == 0: +*/ + + /* function exit code */ + __pyx_L0:; + return __pyx_r; +} + +/* "_state.pxd":386 + * return this._ents.back() + * + * inline void open_ent(attr_t label) noexcept nogil: # <<<<<<<<<<<<<< + * cdef SpanC ent + * ent.start = this.B(0) +*/ + +void __pyx_t_5spacy_8pipeline_17_parser_internals_6_state_StateC::open_ent(__pyx_t_5spacy_8typedefs_attr_t __pyx_v_label) { + struct __pyx_t_5spacy_7structs_SpanC __pyx_v_ent; + int __pyx_lineno = 0; + const char *__pyx_filename = NULL; + int __pyx_clineno = 0; + PyGILState_STATE __pyx_gilstate_save; + + /* "_state.pxd":388 + * inline void open_ent(attr_t label) noexcept nogil: + * cdef SpanC ent + * ent.start = this.B(0) # <<<<<<<<<<<<<< + * ent.label = label + * ent.end = -1 +*/ + __pyx_v_ent.start = this->B(0); + + /* "_state.pxd":389 + * cdef SpanC ent + * ent.start = this.B(0) + * ent.label = label # <<<<<<<<<<<<<< + * ent.end = -1 + * this._ents.push_back(ent) +*/ + __pyx_v_ent.label = __pyx_v_label; + + /* "_state.pxd":390 + * ent.start = this.B(0) + * ent.label = label + * ent.end = -1 # <<<<<<<<<<<<<< + * this._ents.push_back(ent) + * +*/ + __pyx_v_ent.end = -1; + + /* "_state.pxd":391 + * ent.label = label + * ent.end = -1 + * this._ents.push_back(ent) # <<<<<<<<<<<<<< + * + * inline void close_ent() noexcept nogil: +*/ + try { + this->_ents.push_back(__pyx_v_ent); + } catch(...) { + PyGILState_STATE __pyx_gilstate_save = __Pyx_PyGILState_Ensure(); + __Pyx_CppExn2PyErr(); + __Pyx_PyGILState_Release(__pyx_gilstate_save); + __PYX_ERR(4, 391, __pyx_L1_error) + } + + /* "_state.pxd":386 + * return this._ents.back() + * + * inline void open_ent(attr_t label) noexcept nogil: # <<<<<<<<<<<<<< + * cdef SpanC ent + * ent.start = this.B(0) +*/ + + /* function exit code */ + goto __pyx_L0; + __pyx_L1_error:; + __pyx_gilstate_save = __Pyx_PyGILState_Ensure(); + __Pyx_WriteUnraisable("StateC.open_ent", __pyx_clineno, __pyx_lineno, __pyx_filename, 1, 0); + __Pyx_PyGILState_Release(__pyx_gilstate_save); + __pyx_L0:; +} + +/* "_state.pxd":393 + * this._ents.push_back(ent) + * + * inline void close_ent() noexcept nogil: # <<<<<<<<<<<<<< + * this._ents.back().end = this.B(0)+1 + * +*/ + +void __pyx_t_5spacy_8pipeline_17_parser_internals_6_state_StateC::close_ent(void) { + + /* "_state.pxd":394 + * + * inline void close_ent() noexcept nogil: + * this._ents.back().end = this.B(0)+1 # <<<<<<<<<<<<<< + * + * inline void clone(const StateC* src) noexcept nogil: +*/ + this->_ents.back().end = (this->B(0) + 1); + + /* "_state.pxd":393 + * this._ents.push_back(ent) + * + * inline void close_ent() noexcept nogil: # <<<<<<<<<<<<<< + * this._ents.back().end = this.B(0)+1 + * +*/ + + /* function exit code */ +} + +/* "_state.pxd":396 + * this._ents.back().end = this.B(0)+1 + * + * inline void clone(const StateC* src) noexcept nogil: # <<<<<<<<<<<<<< + * this.length = src.length + * this._sent = src._sent +*/ + +void __pyx_t_5spacy_8pipeline_17_parser_internals_6_state_StateC::clone(__pyx_t_5spacy_8pipeline_17_parser_internals_6_state_StateC const *__pyx_v_src) { + int __pyx_t_1; + struct __pyx_t_5spacy_7structs_TokenC const *__pyx_t_2; + std::vector __pyx_t_3; + std::set __pyx_t_4; + std::vector __pyx_t_5; + std::vector __pyx_t_6; + std::unordered_map > __pyx_t_7; + struct __pyx_t_5spacy_7structs_TokenC __pyx_t_8; + + /* "_state.pxd":397 + * + * inline void clone(const StateC* src) noexcept nogil: + * this.length = src.length # <<<<<<<<<<<<<< + * this._sent = src._sent + * this._stack = src._stack +*/ + __pyx_t_1 = __pyx_v_src->length; + this->length = __pyx_t_1; + + /* "_state.pxd":398 + * inline void clone(const StateC* src) noexcept nogil: + * this.length = src.length + * this._sent = src._sent # <<<<<<<<<<<<<< + * this._stack = src._stack + * this._rebuffer = src._rebuffer +*/ + __pyx_t_2 = __pyx_v_src->_sent; + this->_sent = __pyx_t_2; + + /* "_state.pxd":399 + * this.length = src.length + * this._sent = src._sent + * this._stack = src._stack # <<<<<<<<<<<<<< + * this._rebuffer = src._rebuffer + * this._sent_starts = src._sent_starts +*/ + __pyx_t_3 = __pyx_v_src->_stack; + this->_stack = __PYX_STD_MOVE_IF_SUPPORTED(__pyx_t_3); + + /* "_state.pxd":400 + * this._sent = src._sent + * this._stack = src._stack + * this._rebuffer = src._rebuffer # <<<<<<<<<<<<<< + * this._sent_starts = src._sent_starts + * this._unshiftable = src._unshiftable +*/ + __pyx_t_3 = __pyx_v_src->_rebuffer; + this->_rebuffer = __PYX_STD_MOVE_IF_SUPPORTED(__pyx_t_3); + + /* "_state.pxd":401 + * this._stack = src._stack + * this._rebuffer = src._rebuffer + * this._sent_starts = src._sent_starts # <<<<<<<<<<<<<< + * this._unshiftable = src._unshiftable + * memcpy(this._heads, src._heads, this.length * sizeof(this._heads[0])) +*/ + __pyx_t_4 = __pyx_v_src->_sent_starts; + this->_sent_starts = __PYX_STD_MOVE_IF_SUPPORTED(__pyx_t_4); + + /* "_state.pxd":402 + * this._rebuffer = src._rebuffer + * this._sent_starts = src._sent_starts + * this._unshiftable = src._unshiftable # <<<<<<<<<<<<<< + * memcpy(this._heads, src._heads, this.length * sizeof(this._heads[0])) + * this._ents = src._ents +*/ + __pyx_t_5 = __pyx_v_src->_unshiftable; + this->_unshiftable = __PYX_STD_MOVE_IF_SUPPORTED(__pyx_t_5); + + /* "_state.pxd":403 + * this._sent_starts = src._sent_starts + * this._unshiftable = src._unshiftable + * memcpy(this._heads, src._heads, this.length * sizeof(this._heads[0])) # <<<<<<<<<<<<<< + * this._ents = src._ents + * this._left_arcs = src._left_arcs +*/ + (void)(memcpy(this->_heads, __pyx_v_src->_heads, (this->length * (sizeof((this->_heads[0])))))); + + /* "_state.pxd":404 + * this._unshiftable = src._unshiftable + * memcpy(this._heads, src._heads, this.length * sizeof(this._heads[0])) + * this._ents = src._ents # <<<<<<<<<<<<<< + * this._left_arcs = src._left_arcs + * this._right_arcs = src._right_arcs +*/ + __pyx_t_6 = __pyx_v_src->_ents; + this->_ents = __PYX_STD_MOVE_IF_SUPPORTED(__pyx_t_6); + + /* "_state.pxd":405 + * memcpy(this._heads, src._heads, this.length * sizeof(this._heads[0])) + * this._ents = src._ents + * this._left_arcs = src._left_arcs # <<<<<<<<<<<<<< + * this._right_arcs = src._right_arcs + * this._b_i = src._b_i +*/ + __pyx_t_7 = __pyx_v_src->_left_arcs; + this->_left_arcs = __PYX_STD_MOVE_IF_SUPPORTED(__pyx_t_7); + + /* "_state.pxd":406 + * this._ents = src._ents + * this._left_arcs = src._left_arcs + * this._right_arcs = src._right_arcs # <<<<<<<<<<<<<< + * this._b_i = src._b_i + * this.offset = src.offset +*/ + __pyx_t_7 = __pyx_v_src->_right_arcs; + this->_right_arcs = __PYX_STD_MOVE_IF_SUPPORTED(__pyx_t_7); + + /* "_state.pxd":407 + * this._left_arcs = src._left_arcs + * this._right_arcs = src._right_arcs + * this._b_i = src._b_i # <<<<<<<<<<<<<< + * this.offset = src.offset + * this._empty_token = src._empty_token +*/ + __pyx_t_1 = __pyx_v_src->_b_i; + this->_b_i = __pyx_t_1; + + /* "_state.pxd":408 + * this._right_arcs = src._right_arcs + * this._b_i = src._b_i + * this.offset = src.offset # <<<<<<<<<<<<<< + * this._empty_token = src._empty_token +*/ + __pyx_t_1 = __pyx_v_src->offset; + this->offset = __pyx_t_1; + + /* "_state.pxd":409 + * this._b_i = src._b_i + * this.offset = src.offset + * this._empty_token = src._empty_token # <<<<<<<<<<<<<< +*/ + __pyx_t_8 = __pyx_v_src->_empty_token; + this->_empty_token = __pyx_t_8; + + /* "_state.pxd":396 + * this._ents.back().end = this.B(0)+1 + * + * inline void clone(const StateC* src) noexcept nogil: # <<<<<<<<<<<<<< + * this.length = src.length + * this._sent = src._sent +*/ + + /* function exit code */ +} + +/* "stateclass.pxd":14 + * cdef int _borrowed + * + * @staticmethod # <<<<<<<<<<<<<< + * cdef inline StateClass borrow(StateC* ptr, Doc doc): + * cdef StateClass self = StateClass() +*/ + +static CYTHON_INLINE struct __pyx_obj_5spacy_8pipeline_17_parser_internals_10stateclass_StateClass *__pyx_f_5spacy_8pipeline_17_parser_internals_10stateclass_10StateClass_borrow(__pyx_t_5spacy_8pipeline_17_parser_internals_6_state_StateC *__pyx_v_ptr, struct __pyx_obj_5spacy_6tokens_3doc_Doc *__pyx_v_doc) { + struct __pyx_obj_5spacy_8pipeline_17_parser_internals_10stateclass_StateClass *__pyx_v_self = 0; + struct __pyx_obj_5spacy_8pipeline_17_parser_internals_10stateclass_StateClass *__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("borrow", 0); + + /* "stateclass.pxd":16 + * @staticmethod + * cdef inline StateClass borrow(StateC* ptr, Doc doc): + * cdef StateClass self = StateClass() # <<<<<<<<<<<<<< + * self.c = ptr + * self._borrowed = 1 +*/ + __pyx_t_2 = NULL; + __pyx_t_3 = 1; + { + PyObject *__pyx_callargs[2] = {__pyx_t_2, NULL}; + __pyx_t_1 = __Pyx_PyObject_FastCall((PyObject*)__pyx_mstate_global->__pyx_ptype_5spacy_8pipeline_17_parser_internals_10stateclass_StateClass, __pyx_callargs+__pyx_t_3, (1-__pyx_t_3) | (__pyx_t_3*__Pyx_PY_VECTORCALL_ARGUMENTS_OFFSET)); + __Pyx_XDECREF(__pyx_t_2); __pyx_t_2 = 0; + if (unlikely(!__pyx_t_1)) __PYX_ERR(5, 16, __pyx_L1_error) + __Pyx_GOTREF((PyObject *)__pyx_t_1); + } + __pyx_v_self = ((struct __pyx_obj_5spacy_8pipeline_17_parser_internals_10stateclass_StateClass *)__pyx_t_1); + __pyx_t_1 = 0; + + /* "stateclass.pxd":17 + * cdef inline StateClass borrow(StateC* ptr, Doc doc): + * cdef StateClass self = StateClass() + * self.c = ptr # <<<<<<<<<<<<<< + * self._borrowed = 1 + * self.doc = doc +*/ + __pyx_v_self->c = __pyx_v_ptr; + + /* "stateclass.pxd":18 + * cdef StateClass self = StateClass() + * self.c = ptr + * self._borrowed = 1 # <<<<<<<<<<<<<< + * self.doc = doc + * return self +*/ + __pyx_v_self->_borrowed = 1; + + /* "stateclass.pxd":19 + * self.c = ptr + * self._borrowed = 1 + * self.doc = doc # <<<<<<<<<<<<<< + * return self + * +*/ + __Pyx_INCREF((PyObject *)__pyx_v_doc); + __Pyx_GIVEREF((PyObject *)__pyx_v_doc); + __Pyx_GOTREF((PyObject *)__pyx_v_self->doc); + __Pyx_DECREF((PyObject *)__pyx_v_self->doc); + __pyx_v_self->doc = __pyx_v_doc; + + /* "stateclass.pxd":20 + * self._borrowed = 1 + * self.doc = doc + * return self # <<<<<<<<<<<<<< + * + * @staticmethod +*/ + __Pyx_XDECREF((PyObject *)__pyx_r); + __Pyx_INCREF((PyObject *)__pyx_v_self); + __pyx_r = __pyx_v_self; + goto __pyx_L0; + + /* "stateclass.pxd":14 + * cdef int _borrowed + * + * @staticmethod # <<<<<<<<<<<<<< + * cdef inline StateClass borrow(StateC* ptr, Doc doc): + * cdef StateClass self = StateClass() +*/ + + /* function exit code */ + __pyx_L1_error:; + __Pyx_XDECREF(__pyx_t_1); + __Pyx_XDECREF(__pyx_t_2); + __Pyx_AddTraceback("spacy.pipeline._parser_internals.stateclass.StateClass.borrow", __pyx_clineno, __pyx_lineno, __pyx_filename); + __pyx_r = 0; + __pyx_L0:; + __Pyx_XDECREF((PyObject *)__pyx_v_self); + __Pyx_XGIVEREF((PyObject *)__pyx_r); + __Pyx_RefNannyFinishContext(); + return __pyx_r; +} + +/* "stateclass.pxd":22 + * return self + * + * @staticmethod # <<<<<<<<<<<<<< + * cdef inline StateClass init_offset(const TokenC* sent, int length, int + * offset): +*/ + +static CYTHON_INLINE struct __pyx_obj_5spacy_8pipeline_17_parser_internals_10stateclass_StateClass *__pyx_f_5spacy_8pipeline_17_parser_internals_10stateclass_10StateClass_init_offset(struct __pyx_t_5spacy_7structs_TokenC const *__pyx_v_sent, int __pyx_v_length, int __pyx_v_offset) { + struct __pyx_obj_5spacy_8pipeline_17_parser_internals_10stateclass_StateClass *__pyx_v_self = 0; + struct __pyx_obj_5spacy_8pipeline_17_parser_internals_10stateclass_StateClass *__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("init_offset", 0); + + /* "stateclass.pxd":25 + * cdef inline StateClass init_offset(const TokenC* sent, int length, int + * offset): + * cdef StateClass self = StateClass() # <<<<<<<<<<<<<< + * self.c = new StateC(sent, length) + * self.c.offset = offset +*/ + __pyx_t_2 = NULL; + __pyx_t_3 = 1; + { + PyObject *__pyx_callargs[2] = {__pyx_t_2, NULL}; + __pyx_t_1 = __Pyx_PyObject_FastCall((PyObject*)__pyx_mstate_global->__pyx_ptype_5spacy_8pipeline_17_parser_internals_10stateclass_StateClass, __pyx_callargs+__pyx_t_3, (1-__pyx_t_3) | (__pyx_t_3*__Pyx_PY_VECTORCALL_ARGUMENTS_OFFSET)); + __Pyx_XDECREF(__pyx_t_2); __pyx_t_2 = 0; + if (unlikely(!__pyx_t_1)) __PYX_ERR(5, 25, __pyx_L1_error) + __Pyx_GOTREF((PyObject *)__pyx_t_1); + } + __pyx_v_self = ((struct __pyx_obj_5spacy_8pipeline_17_parser_internals_10stateclass_StateClass *)__pyx_t_1); + __pyx_t_1 = 0; + + /* "stateclass.pxd":26 + * offset): + * cdef StateClass self = StateClass() + * self.c = new StateC(sent, length) # <<<<<<<<<<<<<< + * self.c.offset = offset + * return self +*/ + __pyx_v_self->c = new __pyx_t_5spacy_8pipeline_17_parser_internals_6_state_StateC(__pyx_v_sent, __pyx_v_length); + + /* "stateclass.pxd":27 + * cdef StateClass self = StateClass() + * self.c = new StateC(sent, length) + * self.c.offset = offset # <<<<<<<<<<<<<< + * return self +*/ + __pyx_v_self->c->offset = __pyx_v_offset; + + /* "stateclass.pxd":28 + * self.c = new StateC(sent, length) + * self.c.offset = offset + * return self # <<<<<<<<<<<<<< +*/ + __Pyx_XDECREF((PyObject *)__pyx_r); + __Pyx_INCREF((PyObject *)__pyx_v_self); + __pyx_r = __pyx_v_self; + goto __pyx_L0; + + /* "stateclass.pxd":22 + * return self + * + * @staticmethod # <<<<<<<<<<<<<< + * cdef inline StateClass init_offset(const TokenC* sent, int length, int + * offset): +*/ + + /* function exit code */ + __pyx_L1_error:; + __Pyx_XDECREF(__pyx_t_1); + __Pyx_XDECREF(__pyx_t_2); + __Pyx_AddTraceback("spacy.pipeline._parser_internals.stateclass.StateClass.init_offset", __pyx_clineno, __pyx_lineno, __pyx_filename); + __pyx_r = 0; + __pyx_L0:; + __Pyx_XDECREF((PyObject *)__pyx_v_self); + __Pyx_XGIVEREF((PyObject *)__pyx_r); + __Pyx_RefNannyFinishContext(); + return __pyx_r; +} + +/* "tokens/token.pxd":22 + * cdef readonly Doc doc + * + * @staticmethod # <<<<<<<<<<<<<< + * cdef inline Token cinit(Vocab vocab, const TokenC* token, int offset, Doc doc): + * if offset < 0 or offset >= doc.length: +*/ + +static CYTHON_INLINE struct __pyx_obj_5spacy_6tokens_5token_Token *__pyx_f_5spacy_6tokens_5token_5Token_cinit(struct __pyx_obj_5spacy_5vocab_Vocab *__pyx_v_vocab, CYTHON_UNUSED struct __pyx_t_5spacy_7structs_TokenC const *__pyx_v_token, int __pyx_v_offset, struct __pyx_obj_5spacy_6tokens_3doc_Doc *__pyx_v_doc) { + struct __pyx_obj_5spacy_6tokens_5token_Token *__pyx_v_self = 0; + struct __pyx_obj_5spacy_6tokens_5token_Token *__pyx_r = NULL; + __Pyx_RefNannyDeclarations + int __pyx_t_1; + int __pyx_t_2; + PyObject *__pyx_t_3 = NULL; + PyObject *__pyx_t_4 = NULL; + PyObject *__pyx_t_5 = NULL; + PyObject *__pyx_t_6 = NULL; + PyObject *__pyx_t_7 = NULL; + PyObject *__pyx_t_8 = NULL; + PyObject *__pyx_t_9 = NULL; + size_t __pyx_t_10; + PyObject *__pyx_t_11 = NULL; + int __pyx_lineno = 0; + const char *__pyx_filename = NULL; + int __pyx_clineno = 0; + __Pyx_RefNannySetupContext("cinit", 0); + + /* "tokens/token.pxd":24 + * @staticmethod + * cdef inline Token cinit(Vocab vocab, const TokenC* token, int offset, Doc doc): + * if offset < 0 or offset >= doc.length: # <<<<<<<<<<<<<< + * raise IndexError(Errors.E040.format(i=offset, max_length=doc.length)) + * cdef Token self = Token.__new__(Token, vocab, doc, offset) +*/ + __pyx_t_2 = (__pyx_v_offset < 0); + if (!__pyx_t_2) { + } else { + __pyx_t_1 = __pyx_t_2; + goto __pyx_L4_bool_binop_done; + } + __pyx_t_2 = (__pyx_v_offset >= __pyx_v_doc->length); + __pyx_t_1 = __pyx_t_2; + __pyx_L4_bool_binop_done:; + if (unlikely(__pyx_t_1)) { + + /* "tokens/token.pxd":25 + * cdef inline Token cinit(Vocab vocab, const TokenC* token, int offset, Doc doc): + * if offset < 0 or offset >= doc.length: + * raise IndexError(Errors.E040.format(i=offset, max_length=doc.length)) # <<<<<<<<<<<<<< + * cdef Token self = Token.__new__(Token, vocab, doc, offset) + * return self +*/ + __pyx_t_4 = NULL; + __Pyx_GetModuleGlobalName(__pyx_t_7, __pyx_mstate_global->__pyx_n_u_Errors); if (unlikely(!__pyx_t_7)) __PYX_ERR(6, 25, __pyx_L1_error) + __Pyx_GOTREF(__pyx_t_7); + __pyx_t_8 = __Pyx_PyObject_GetAttrStr(__pyx_t_7, __pyx_mstate_global->__pyx_n_u_E040); if (unlikely(!__pyx_t_8)) __PYX_ERR(6, 25, __pyx_L1_error) + __Pyx_GOTREF(__pyx_t_8); + __Pyx_DECREF(__pyx_t_7); __pyx_t_7 = 0; + __pyx_t_6 = __pyx_t_8; + __Pyx_INCREF(__pyx_t_6); + __pyx_t_7 = __Pyx_PyLong_From_int(__pyx_v_offset); if (unlikely(!__pyx_t_7)) __PYX_ERR(6, 25, __pyx_L1_error) + __Pyx_GOTREF(__pyx_t_7); + __pyx_t_9 = __Pyx_PyLong_From_int(__pyx_v_doc->length); if (unlikely(!__pyx_t_9)) __PYX_ERR(6, 25, __pyx_L1_error) + __Pyx_GOTREF(__pyx_t_9); + __pyx_t_10 = 0; + { + PyObject *__pyx_callargs[2 + ((CYTHON_VECTORCALL) ? 2 : 0)] = {__pyx_t_6, NULL}; + __pyx_t_11 = __Pyx_MakeVectorcallBuilderKwds(2); if (unlikely(!__pyx_t_11)) __PYX_ERR(6, 25, __pyx_L1_error) + __Pyx_GOTREF(__pyx_t_11); + if (__Pyx_VectorcallBuilder_AddArg(__pyx_mstate_global->__pyx_n_u_i, __pyx_t_7, __pyx_t_11, __pyx_callargs+1, 0) < (0)) __PYX_ERR(6, 25, __pyx_L1_error) + if (__Pyx_VectorcallBuilder_AddArg(__pyx_mstate_global->__pyx_n_u_max_length, __pyx_t_9, __pyx_t_11, __pyx_callargs+1, 1) < (0)) __PYX_ERR(6, 25, __pyx_L1_error) + __pyx_t_5 = __Pyx_Object_VectorcallMethod_CallFromBuilder((PyObject*)__pyx_mstate_global->__pyx_n_u_format, __pyx_callargs+__pyx_t_10, (1-__pyx_t_10) | (1*__Pyx_PY_VECTORCALL_ARGUMENTS_OFFSET), __pyx_t_11); + __Pyx_XDECREF(__pyx_t_6); __pyx_t_6 = 0; + __Pyx_DECREF(__pyx_t_7); __pyx_t_7 = 0; + __Pyx_DECREF(__pyx_t_9); __pyx_t_9 = 0; + __Pyx_DECREF(__pyx_t_11); __pyx_t_11 = 0; + __Pyx_DECREF(__pyx_t_8); __pyx_t_8 = 0; + if (unlikely(!__pyx_t_5)) __PYX_ERR(6, 25, __pyx_L1_error) + __Pyx_GOTREF(__pyx_t_5); + } + __pyx_t_10 = 1; + { + PyObject *__pyx_callargs[2] = {__pyx_t_4, __pyx_t_5}; + __pyx_t_3 = __Pyx_PyObject_FastCall((PyObject*)(((PyTypeObject*)PyExc_IndexError)), __pyx_callargs+__pyx_t_10, (2-__pyx_t_10) | (__pyx_t_10*__Pyx_PY_VECTORCALL_ARGUMENTS_OFFSET)); + __Pyx_XDECREF(__pyx_t_4); __pyx_t_4 = 0; + __Pyx_DECREF(__pyx_t_5); __pyx_t_5 = 0; + if (unlikely(!__pyx_t_3)) __PYX_ERR(6, 25, __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(6, 25, __pyx_L1_error) + + /* "tokens/token.pxd":24 + * @staticmethod + * cdef inline Token cinit(Vocab vocab, const TokenC* token, int offset, Doc doc): + * if offset < 0 or offset >= doc.length: # <<<<<<<<<<<<<< + * raise IndexError(Errors.E040.format(i=offset, max_length=doc.length)) + * cdef Token self = Token.__new__(Token, vocab, doc, offset) +*/ + } + + /* "tokens/token.pxd":26 + * if offset < 0 or offset >= doc.length: + * raise IndexError(Errors.E040.format(i=offset, max_length=doc.length)) + * cdef Token self = Token.__new__(Token, vocab, doc, offset) # <<<<<<<<<<<<<< + * return self + * +*/ + __pyx_t_3 = __Pyx_PyLong_From_int(__pyx_v_offset); if (unlikely(!__pyx_t_3)) __PYX_ERR(6, 26, __pyx_L1_error) + __Pyx_GOTREF(__pyx_t_3); + __pyx_t_5 = PyTuple_New(3); if (unlikely(!__pyx_t_5)) __PYX_ERR(6, 26, __pyx_L1_error) + __Pyx_GOTREF(__pyx_t_5); + __Pyx_INCREF((PyObject *)__pyx_v_vocab); + __Pyx_GIVEREF((PyObject *)__pyx_v_vocab); + if (__Pyx_PyTuple_SET_ITEM(__pyx_t_5, 0, ((PyObject *)__pyx_v_vocab)) != (0)) __PYX_ERR(6, 26, __pyx_L1_error); + __Pyx_INCREF((PyObject *)__pyx_v_doc); + __Pyx_GIVEREF((PyObject *)__pyx_v_doc); + if (__Pyx_PyTuple_SET_ITEM(__pyx_t_5, 1, ((PyObject *)__pyx_v_doc)) != (0)) __PYX_ERR(6, 26, __pyx_L1_error); + __Pyx_GIVEREF(__pyx_t_3); + if (__Pyx_PyTuple_SET_ITEM(__pyx_t_5, 2, __pyx_t_3) != (0)) __PYX_ERR(6, 26, __pyx_L1_error); + __pyx_t_3 = 0; + __pyx_t_3 = __Pyx_tp_new(((PyObject *)__pyx_mstate_global->__pyx_ptype_5spacy_6tokens_5token_Token), ((PyObject*)__pyx_t_5)); if (unlikely(!__pyx_t_3)) __PYX_ERR(6, 26, __pyx_L1_error) + __Pyx_GOTREF(__pyx_t_3); + __Pyx_DECREF(__pyx_t_5); __pyx_t_5 = 0; + if (!(likely(__Pyx_TypeTest(__pyx_t_3, __pyx_mstate_global->__pyx_ptype_5spacy_6tokens_5token_Token)))) __PYX_ERR(6, 26, __pyx_L1_error) + __pyx_v_self = ((struct __pyx_obj_5spacy_6tokens_5token_Token *)__pyx_t_3); + __pyx_t_3 = 0; + + /* "tokens/token.pxd":27 + * raise IndexError(Errors.E040.format(i=offset, max_length=doc.length)) + * cdef Token self = Token.__new__(Token, vocab, doc, offset) + * return self # <<<<<<<<<<<<<< + * + * # cdef inline TokenC struct_from_attrs(Vocab vocab, attrs): +*/ + __Pyx_XDECREF((PyObject *)__pyx_r); + __Pyx_INCREF((PyObject *)__pyx_v_self); + __pyx_r = __pyx_v_self; + goto __pyx_L0; + + /* "tokens/token.pxd":22 + * cdef readonly Doc doc + * + * @staticmethod # <<<<<<<<<<<<<< + * cdef inline Token cinit(Vocab vocab, const TokenC* token, int offset, Doc doc): + * if offset < 0 or offset >= doc.length: +*/ + + /* function exit code */ + __pyx_L1_error:; + __Pyx_XDECREF(__pyx_t_3); + __Pyx_XDECREF(__pyx_t_4); + __Pyx_XDECREF(__pyx_t_5); + __Pyx_XDECREF(__pyx_t_6); + __Pyx_XDECREF(__pyx_t_7); + __Pyx_XDECREF(__pyx_t_8); + __Pyx_XDECREF(__pyx_t_9); + __Pyx_XDECREF(__pyx_t_11); + __Pyx_AddTraceback("spacy.tokens.token.Token.cinit", __pyx_clineno, __pyx_lineno, __pyx_filename); + __pyx_r = 0; + __pyx_L0:; + __Pyx_XDECREF((PyObject *)__pyx_v_self); + __Pyx_XGIVEREF((PyObject *)__pyx_r); + __Pyx_RefNannyFinishContext(); + return __pyx_r; +} + +/* "tokens/token.pxd":35 + * cpdef bint check_flag(self, attr_id_t flag_id) except -1 + * + * @staticmethod # <<<<<<<<<<<<<< + * cdef inline attr_t get_struct_attr(const TokenC* token, attr_id_t feat_name) noexcept nogil: + * if feat_name < (sizeof(flags_t) * 8): +*/ + +static CYTHON_INLINE __pyx_t_5spacy_8typedefs_attr_t __pyx_f_5spacy_6tokens_5token_5Token_get_struct_attr(struct __pyx_t_5spacy_7structs_TokenC const *__pyx_v_token, enum __pyx_t_5spacy_5attrs_attr_id_t __pyx_v_feat_name) { + __pyx_t_5spacy_8typedefs_attr_t __pyx_r; + int __pyx_t_1; + + /* "tokens/token.pxd":37 + * @staticmethod + * cdef inline attr_t get_struct_attr(const TokenC* token, attr_id_t feat_name) noexcept nogil: + * if feat_name < (sizeof(flags_t) * 8): # <<<<<<<<<<<<<< + * return Lexeme.c_check_flag(token.lex, feat_name) + * elif feat_name == LEMMA: +*/ + __pyx_t_1 = (__pyx_v_feat_name < ((sizeof(__pyx_t_5spacy_8typedefs_flags_t)) * 8)); + if (__pyx_t_1) { + + /* "tokens/token.pxd":38 + * cdef inline attr_t get_struct_attr(const TokenC* token, attr_id_t feat_name) noexcept nogil: + * if feat_name < (sizeof(flags_t) * 8): + * return Lexeme.c_check_flag(token.lex, feat_name) # <<<<<<<<<<<<<< + * elif feat_name == LEMMA: + * return token.lemma +*/ + __pyx_r = __pyx_f_5spacy_6lexeme_6Lexeme_c_check_flag(__pyx_v_token->lex, __pyx_v_feat_name); + goto __pyx_L0; + + /* "tokens/token.pxd":37 + * @staticmethod + * cdef inline attr_t get_struct_attr(const TokenC* token, attr_id_t feat_name) noexcept nogil: + * if feat_name < (sizeof(flags_t) * 8): # <<<<<<<<<<<<<< + * return Lexeme.c_check_flag(token.lex, feat_name) + * elif feat_name == LEMMA: +*/ + } + + /* "tokens/token.pxd":39 + * if feat_name < (sizeof(flags_t) * 8): + * return Lexeme.c_check_flag(token.lex, feat_name) + * elif feat_name == LEMMA: # <<<<<<<<<<<<<< + * return token.lemma + * elif feat_name == NORM: +*/ + __pyx_t_1 = (__pyx_v_feat_name == __pyx_e_5spacy_5attrs_LEMMA); + if (__pyx_t_1) { + + /* "tokens/token.pxd":40 + * return Lexeme.c_check_flag(token.lex, feat_name) + * elif feat_name == LEMMA: + * return token.lemma # <<<<<<<<<<<<<< + * elif feat_name == NORM: + * if token.norm == 0: +*/ + __pyx_r = __pyx_v_token->lemma; + goto __pyx_L0; + + /* "tokens/token.pxd":39 + * if feat_name < (sizeof(flags_t) * 8): + * return Lexeme.c_check_flag(token.lex, feat_name) + * elif feat_name == LEMMA: # <<<<<<<<<<<<<< + * return token.lemma + * elif feat_name == NORM: +*/ + } + + /* "tokens/token.pxd":41 + * elif feat_name == LEMMA: + * return token.lemma + * elif feat_name == NORM: # <<<<<<<<<<<<<< + * if token.norm == 0: + * return token.lex.norm +*/ + __pyx_t_1 = (__pyx_v_feat_name == __pyx_e_5spacy_5attrs_NORM); + if (__pyx_t_1) { + + /* "tokens/token.pxd":42 + * return token.lemma + * elif feat_name == NORM: + * if token.norm == 0: # <<<<<<<<<<<<<< + * return token.lex.norm + * else: +*/ + __pyx_t_1 = (__pyx_v_token->norm == 0); + if (__pyx_t_1) { + + /* "tokens/token.pxd":43 + * elif feat_name == NORM: + * if token.norm == 0: + * return token.lex.norm # <<<<<<<<<<<<<< + * else: + * return token.norm +*/ + __pyx_r = __pyx_v_token->lex->norm; + goto __pyx_L0; + + /* "tokens/token.pxd":42 + * return token.lemma + * elif feat_name == NORM: + * if token.norm == 0: # <<<<<<<<<<<<<< + * return token.lex.norm + * else: +*/ + } + + /* "tokens/token.pxd":45 + * return token.lex.norm + * else: + * return token.norm # <<<<<<<<<<<<<< + * elif feat_name == POS: + * return token.pos +*/ + /*else*/ { + __pyx_r = __pyx_v_token->norm; + goto __pyx_L0; + } + + /* "tokens/token.pxd":41 + * elif feat_name == LEMMA: + * return token.lemma + * elif feat_name == NORM: # <<<<<<<<<<<<<< + * if token.norm == 0: + * return token.lex.norm +*/ + } + + /* "tokens/token.pxd":46 + * else: + * return token.norm + * elif feat_name == POS: # <<<<<<<<<<<<<< + * return token.pos + * elif feat_name == TAG: +*/ + __pyx_t_1 = (__pyx_v_feat_name == __pyx_e_5spacy_5attrs_POS); + if (__pyx_t_1) { + + /* "tokens/token.pxd":47 + * return token.norm + * elif feat_name == POS: + * return token.pos # <<<<<<<<<<<<<< + * elif feat_name == TAG: + * return token.tag +*/ + __pyx_r = __pyx_v_token->pos; + goto __pyx_L0; + + /* "tokens/token.pxd":46 + * else: + * return token.norm + * elif feat_name == POS: # <<<<<<<<<<<<<< + * return token.pos + * elif feat_name == TAG: +*/ + } + + /* "tokens/token.pxd":48 + * elif feat_name == POS: + * return token.pos + * elif feat_name == TAG: # <<<<<<<<<<<<<< + * return token.tag + * elif feat_name == MORPH: +*/ + __pyx_t_1 = (__pyx_v_feat_name == __pyx_e_5spacy_5attrs_TAG); + if (__pyx_t_1) { + + /* "tokens/token.pxd":49 + * return token.pos + * elif feat_name == TAG: + * return token.tag # <<<<<<<<<<<<<< + * elif feat_name == MORPH: + * return token.morph +*/ + __pyx_r = __pyx_v_token->tag; + goto __pyx_L0; + + /* "tokens/token.pxd":48 + * elif feat_name == POS: + * return token.pos + * elif feat_name == TAG: # <<<<<<<<<<<<<< + * return token.tag + * elif feat_name == MORPH: +*/ + } + + /* "tokens/token.pxd":50 + * elif feat_name == TAG: + * return token.tag + * elif feat_name == MORPH: # <<<<<<<<<<<<<< + * return token.morph + * elif feat_name == DEP: +*/ + __pyx_t_1 = (__pyx_v_feat_name == __pyx_e_5spacy_5attrs_MORPH); + if (__pyx_t_1) { + + /* "tokens/token.pxd":51 + * return token.tag + * elif feat_name == MORPH: + * return token.morph # <<<<<<<<<<<<<< + * elif feat_name == DEP: + * return token.dep +*/ + __pyx_r = __pyx_v_token->morph; + goto __pyx_L0; + + /* "tokens/token.pxd":50 + * elif feat_name == TAG: + * return token.tag + * elif feat_name == MORPH: # <<<<<<<<<<<<<< + * return token.morph + * elif feat_name == DEP: +*/ + } + + /* "tokens/token.pxd":52 + * elif feat_name == MORPH: + * return token.morph + * elif feat_name == DEP: # <<<<<<<<<<<<<< + * return token.dep + * elif feat_name == HEAD: +*/ + __pyx_t_1 = (__pyx_v_feat_name == __pyx_e_5spacy_5attrs_DEP); + if (__pyx_t_1) { + + /* "tokens/token.pxd":53 + * return token.morph + * elif feat_name == DEP: + * return token.dep # <<<<<<<<<<<<<< + * elif feat_name == HEAD: + * return token.head +*/ + __pyx_r = __pyx_v_token->dep; + goto __pyx_L0; + + /* "tokens/token.pxd":52 + * elif feat_name == MORPH: + * return token.morph + * elif feat_name == DEP: # <<<<<<<<<<<<<< + * return token.dep + * elif feat_name == HEAD: +*/ + } + + /* "tokens/token.pxd":54 + * elif feat_name == DEP: + * return token.dep + * elif feat_name == HEAD: # <<<<<<<<<<<<<< + * return token.head + * elif feat_name == SPACY: +*/ + __pyx_t_1 = (__pyx_v_feat_name == __pyx_e_5spacy_5attrs_HEAD); + if (__pyx_t_1) { + + /* "tokens/token.pxd":55 + * return token.dep + * elif feat_name == HEAD: + * return token.head # <<<<<<<<<<<<<< + * elif feat_name == SPACY: + * return token.spacy +*/ + __pyx_r = __pyx_v_token->head; + goto __pyx_L0; + + /* "tokens/token.pxd":54 + * elif feat_name == DEP: + * return token.dep + * elif feat_name == HEAD: # <<<<<<<<<<<<<< + * return token.head + * elif feat_name == SPACY: +*/ + } + + /* "tokens/token.pxd":56 + * elif feat_name == HEAD: + * return token.head + * elif feat_name == SPACY: # <<<<<<<<<<<<<< + * return token.spacy + * elif feat_name == ENT_IOB: +*/ + __pyx_t_1 = (__pyx_v_feat_name == __pyx_e_5spacy_5attrs_SPACY); + if (__pyx_t_1) { + + /* "tokens/token.pxd":57 + * return token.head + * elif feat_name == SPACY: + * return token.spacy # <<<<<<<<<<<<<< + * elif feat_name == ENT_IOB: + * return token.ent_iob +*/ + __pyx_r = __pyx_v_token->spacy; + goto __pyx_L0; + + /* "tokens/token.pxd":56 + * elif feat_name == HEAD: + * return token.head + * elif feat_name == SPACY: # <<<<<<<<<<<<<< + * return token.spacy + * elif feat_name == ENT_IOB: +*/ + } + + /* "tokens/token.pxd":58 + * elif feat_name == SPACY: + * return token.spacy + * elif feat_name == ENT_IOB: # <<<<<<<<<<<<<< + * return token.ent_iob + * elif feat_name == ENT_TYPE: +*/ + __pyx_t_1 = (__pyx_v_feat_name == __pyx_e_5spacy_5attrs_ENT_IOB); + if (__pyx_t_1) { + + /* "tokens/token.pxd":59 + * return token.spacy + * elif feat_name == ENT_IOB: + * return token.ent_iob # <<<<<<<<<<<<<< + * elif feat_name == ENT_TYPE: + * return token.ent_type +*/ + __pyx_r = __pyx_v_token->ent_iob; + goto __pyx_L0; + + /* "tokens/token.pxd":58 + * elif feat_name == SPACY: + * return token.spacy + * elif feat_name == ENT_IOB: # <<<<<<<<<<<<<< + * return token.ent_iob + * elif feat_name == ENT_TYPE: +*/ + } + + /* "tokens/token.pxd":60 + * elif feat_name == ENT_IOB: + * return token.ent_iob + * elif feat_name == ENT_TYPE: # <<<<<<<<<<<<<< + * return token.ent_type + * elif feat_name == ENT_ID: +*/ + __pyx_t_1 = (__pyx_v_feat_name == __pyx_e_5spacy_5attrs_ENT_TYPE); + if (__pyx_t_1) { + + /* "tokens/token.pxd":61 + * return token.ent_iob + * elif feat_name == ENT_TYPE: + * return token.ent_type # <<<<<<<<<<<<<< + * elif feat_name == ENT_ID: + * return token.ent_id +*/ + __pyx_r = __pyx_v_token->ent_type; + goto __pyx_L0; + + /* "tokens/token.pxd":60 + * elif feat_name == ENT_IOB: + * return token.ent_iob + * elif feat_name == ENT_TYPE: # <<<<<<<<<<<<<< + * return token.ent_type + * elif feat_name == ENT_ID: +*/ + } + + /* "tokens/token.pxd":62 + * elif feat_name == ENT_TYPE: + * return token.ent_type + * elif feat_name == ENT_ID: # <<<<<<<<<<<<<< + * return token.ent_id + * elif feat_name == ENT_KB_ID: +*/ + __pyx_t_1 = (__pyx_v_feat_name == __pyx_e_5spacy_5attrs_ENT_ID); + if (__pyx_t_1) { + + /* "tokens/token.pxd":63 + * return token.ent_type + * elif feat_name == ENT_ID: + * return token.ent_id # <<<<<<<<<<<<<< + * elif feat_name == ENT_KB_ID: + * return token.ent_kb_id +*/ + __pyx_r = __pyx_v_token->ent_id; + goto __pyx_L0; + + /* "tokens/token.pxd":62 + * elif feat_name == ENT_TYPE: + * return token.ent_type + * elif feat_name == ENT_ID: # <<<<<<<<<<<<<< + * return token.ent_id + * elif feat_name == ENT_KB_ID: +*/ + } + + /* "tokens/token.pxd":64 + * elif feat_name == ENT_ID: + * return token.ent_id + * elif feat_name == ENT_KB_ID: # <<<<<<<<<<<<<< + * return token.ent_kb_id + * elif feat_name == SENT_START: +*/ + __pyx_t_1 = (__pyx_v_feat_name == __pyx_e_5spacy_5attrs_ENT_KB_ID); + if (__pyx_t_1) { + + /* "tokens/token.pxd":65 + * return token.ent_id + * elif feat_name == ENT_KB_ID: + * return token.ent_kb_id # <<<<<<<<<<<<<< + * elif feat_name == SENT_START: + * return token.sent_start +*/ + __pyx_r = __pyx_v_token->ent_kb_id; + goto __pyx_L0; + + /* "tokens/token.pxd":64 + * elif feat_name == ENT_ID: + * return token.ent_id + * elif feat_name == ENT_KB_ID: # <<<<<<<<<<<<<< + * return token.ent_kb_id + * elif feat_name == SENT_START: +*/ + } + + /* "tokens/token.pxd":66 + * elif feat_name == ENT_KB_ID: + * return token.ent_kb_id + * elif feat_name == SENT_START: # <<<<<<<<<<<<<< + * return token.sent_start + * else: +*/ + __pyx_t_1 = (__pyx_v_feat_name == __pyx_e_5spacy_5attrs_SENT_START); + if (__pyx_t_1) { + + /* "tokens/token.pxd":67 + * return token.ent_kb_id + * elif feat_name == SENT_START: + * return token.sent_start # <<<<<<<<<<<<<< + * else: + * return Lexeme.get_struct_attr(token.lex, feat_name) +*/ + __pyx_r = __pyx_v_token->sent_start; + goto __pyx_L0; + + /* "tokens/token.pxd":66 + * elif feat_name == ENT_KB_ID: + * return token.ent_kb_id + * elif feat_name == SENT_START: # <<<<<<<<<<<<<< + * return token.sent_start + * else: +*/ + } + + /* "tokens/token.pxd":69 + * return token.sent_start + * else: + * return Lexeme.get_struct_attr(token.lex, feat_name) # <<<<<<<<<<<<<< + * + * @staticmethod +*/ + /*else*/ { + __pyx_r = __pyx_f_5spacy_6lexeme_6Lexeme_get_struct_attr(__pyx_v_token->lex, __pyx_v_feat_name); + goto __pyx_L0; + } + + /* "tokens/token.pxd":35 + * cpdef bint check_flag(self, attr_id_t flag_id) except -1 + * + * @staticmethod # <<<<<<<<<<<<<< + * cdef inline attr_t get_struct_attr(const TokenC* token, attr_id_t feat_name) noexcept nogil: + * if feat_name < (sizeof(flags_t) * 8): +*/ + + /* function exit code */ + __pyx_L0:; + return __pyx_r; +} + +/* "tokens/token.pxd":71 + * return Lexeme.get_struct_attr(token.lex, feat_name) + * + * @staticmethod # <<<<<<<<<<<<<< + * cdef inline attr_t set_struct_attr(TokenC* token, attr_id_t feat_name, + * attr_t value) noexcept nogil: +*/ + +static CYTHON_INLINE __pyx_t_5spacy_8typedefs_attr_t __pyx_f_5spacy_6tokens_5token_5Token_set_struct_attr(struct __pyx_t_5spacy_7structs_TokenC *__pyx_v_token, enum __pyx_t_5spacy_5attrs_attr_id_t __pyx_v_feat_name, __pyx_t_5spacy_8typedefs_attr_t __pyx_v_value) { + __pyx_t_5spacy_8typedefs_attr_t __pyx_r; + + /* "tokens/token.pxd":74 + * cdef inline attr_t set_struct_attr(TokenC* token, attr_id_t feat_name, + * attr_t value) noexcept nogil: + * if feat_name == LEMMA: # <<<<<<<<<<<<<< + * token.lemma = value + * elif feat_name == NORM: +*/ + switch (__pyx_v_feat_name) { + case __pyx_e_5spacy_5attrs_LEMMA: + + /* "tokens/token.pxd":75 + * attr_t value) noexcept nogil: + * if feat_name == LEMMA: + * token.lemma = value # <<<<<<<<<<<<<< + * elif feat_name == NORM: + * token.norm = value +*/ + __pyx_v_token->lemma = __pyx_v_value; + + /* "tokens/token.pxd":74 + * cdef inline attr_t set_struct_attr(TokenC* token, attr_id_t feat_name, + * attr_t value) noexcept nogil: + * if feat_name == LEMMA: # <<<<<<<<<<<<<< + * token.lemma = value + * elif feat_name == NORM: +*/ + break; + case __pyx_e_5spacy_5attrs_NORM: + + /* "tokens/token.pxd":77 + * token.lemma = value + * elif feat_name == NORM: + * token.norm = value # <<<<<<<<<<<<<< + * elif feat_name == POS: + * token.pos = value +*/ + __pyx_v_token->norm = __pyx_v_value; + + /* "tokens/token.pxd":76 + * if feat_name == LEMMA: + * token.lemma = value + * elif feat_name == NORM: # <<<<<<<<<<<<<< + * token.norm = value + * elif feat_name == POS: +*/ + break; + case __pyx_e_5spacy_5attrs_POS: + + /* "tokens/token.pxd":79 + * token.norm = value + * elif feat_name == POS: + * token.pos = value # <<<<<<<<<<<<<< + * elif feat_name == TAG: + * token.tag = value +*/ + __pyx_v_token->pos = ((enum __pyx_t_5spacy_15parts_of_speech_univ_pos_t)__pyx_v_value); + + /* "tokens/token.pxd":78 + * elif feat_name == NORM: + * token.norm = value + * elif feat_name == POS: # <<<<<<<<<<<<<< + * token.pos = value + * elif feat_name == TAG: +*/ + break; + case __pyx_e_5spacy_5attrs_TAG: + + /* "tokens/token.pxd":81 + * token.pos = value + * elif feat_name == TAG: + * token.tag = value # <<<<<<<<<<<<<< + * elif feat_name == MORPH: + * token.morph = value +*/ + __pyx_v_token->tag = __pyx_v_value; + + /* "tokens/token.pxd":80 + * elif feat_name == POS: + * token.pos = value + * elif feat_name == TAG: # <<<<<<<<<<<<<< + * token.tag = value + * elif feat_name == MORPH: +*/ + break; + case __pyx_e_5spacy_5attrs_MORPH: + + /* "tokens/token.pxd":83 + * token.tag = value + * elif feat_name == MORPH: + * token.morph = value # <<<<<<<<<<<<<< + * elif feat_name == DEP: + * token.dep = value +*/ + __pyx_v_token->morph = __pyx_v_value; + + /* "tokens/token.pxd":82 + * elif feat_name == TAG: + * token.tag = value + * elif feat_name == MORPH: # <<<<<<<<<<<<<< + * token.morph = value + * elif feat_name == DEP: +*/ + break; + case __pyx_e_5spacy_5attrs_DEP: + + /* "tokens/token.pxd":85 + * token.morph = value + * elif feat_name == DEP: + * token.dep = value # <<<<<<<<<<<<<< + * elif feat_name == HEAD: + * token.head = value +*/ + __pyx_v_token->dep = __pyx_v_value; + + /* "tokens/token.pxd":84 + * elif feat_name == MORPH: + * token.morph = value + * elif feat_name == DEP: # <<<<<<<<<<<<<< + * token.dep = value + * elif feat_name == HEAD: +*/ + break; + case __pyx_e_5spacy_5attrs_HEAD: + + /* "tokens/token.pxd":87 + * token.dep = value + * elif feat_name == HEAD: + * token.head = value # <<<<<<<<<<<<<< + * elif feat_name == SPACY: + * token.spacy = value +*/ + __pyx_v_token->head = __pyx_v_value; + + /* "tokens/token.pxd":86 + * elif feat_name == DEP: + * token.dep = value + * elif feat_name == HEAD: # <<<<<<<<<<<<<< + * token.head = value + * elif feat_name == SPACY: +*/ + break; + case __pyx_e_5spacy_5attrs_SPACY: + + /* "tokens/token.pxd":89 + * token.head = value + * elif feat_name == SPACY: + * token.spacy = value # <<<<<<<<<<<<<< + * elif feat_name == ENT_IOB: + * token.ent_iob = value +*/ + __pyx_v_token->spacy = __pyx_v_value; + + /* "tokens/token.pxd":88 + * elif feat_name == HEAD: + * token.head = value + * elif feat_name == SPACY: # <<<<<<<<<<<<<< + * token.spacy = value + * elif feat_name == ENT_IOB: +*/ + break; + case __pyx_e_5spacy_5attrs_ENT_IOB: + + /* "tokens/token.pxd":91 + * token.spacy = value + * elif feat_name == ENT_IOB: + * token.ent_iob = value # <<<<<<<<<<<<<< + * elif feat_name == ENT_TYPE: + * token.ent_type = value +*/ + __pyx_v_token->ent_iob = __pyx_v_value; + + /* "tokens/token.pxd":90 + * elif feat_name == SPACY: + * token.spacy = value + * elif feat_name == ENT_IOB: # <<<<<<<<<<<<<< + * token.ent_iob = value + * elif feat_name == ENT_TYPE: +*/ + break; + case __pyx_e_5spacy_5attrs_ENT_TYPE: + + /* "tokens/token.pxd":93 + * token.ent_iob = value + * elif feat_name == ENT_TYPE: + * token.ent_type = value # <<<<<<<<<<<<<< + * elif feat_name == ENT_ID: + * token.ent_id = value +*/ + __pyx_v_token->ent_type = __pyx_v_value; + + /* "tokens/token.pxd":92 + * elif feat_name == ENT_IOB: + * token.ent_iob = value + * elif feat_name == ENT_TYPE: # <<<<<<<<<<<<<< + * token.ent_type = value + * elif feat_name == ENT_ID: +*/ + break; + case __pyx_e_5spacy_5attrs_ENT_ID: + + /* "tokens/token.pxd":95 + * token.ent_type = value + * elif feat_name == ENT_ID: + * token.ent_id = value # <<<<<<<<<<<<<< + * elif feat_name == ENT_KB_ID: + * token.ent_kb_id = value +*/ + __pyx_v_token->ent_id = __pyx_v_value; + + /* "tokens/token.pxd":94 + * elif feat_name == ENT_TYPE: + * token.ent_type = value + * elif feat_name == ENT_ID: # <<<<<<<<<<<<<< + * token.ent_id = value + * elif feat_name == ENT_KB_ID: +*/ + break; + case __pyx_e_5spacy_5attrs_ENT_KB_ID: + + /* "tokens/token.pxd":97 + * token.ent_id = value + * elif feat_name == ENT_KB_ID: + * token.ent_kb_id = value # <<<<<<<<<<<<<< + * elif feat_name == SENT_START: + * token.sent_start = value +*/ + __pyx_v_token->ent_kb_id = __pyx_v_value; + + /* "tokens/token.pxd":96 + * elif feat_name == ENT_ID: + * token.ent_id = value + * elif feat_name == ENT_KB_ID: # <<<<<<<<<<<<<< + * token.ent_kb_id = value + * elif feat_name == SENT_START: +*/ + break; + case __pyx_e_5spacy_5attrs_SENT_START: + + /* "tokens/token.pxd":99 + * token.ent_kb_id = value + * elif feat_name == SENT_START: + * token.sent_start = value # <<<<<<<<<<<<<< + * + * @staticmethod +*/ + __pyx_v_token->sent_start = __pyx_v_value; + + /* "tokens/token.pxd":98 + * elif feat_name == ENT_KB_ID: + * token.ent_kb_id = value + * elif feat_name == SENT_START: # <<<<<<<<<<<<<< + * token.sent_start = value + * +*/ + break; + default: break; + } + + /* "tokens/token.pxd":71 + * return Lexeme.get_struct_attr(token.lex, feat_name) + * + * @staticmethod # <<<<<<<<<<<<<< + * cdef inline attr_t set_struct_attr(TokenC* token, attr_id_t feat_name, + * attr_t value) noexcept nogil: +*/ + + /* function exit code */ + __pyx_r = 0; + return __pyx_r; +} + +/* "tokens/token.pxd":101 + * token.sent_start = value + * + * @staticmethod # <<<<<<<<<<<<<< + * cdef inline int missing_dep(const TokenC* token) noexcept nogil: + * return token.dep == MISSING_DEP +*/ + +static CYTHON_INLINE int __pyx_f_5spacy_6tokens_5token_5Token_missing_dep(struct __pyx_t_5spacy_7structs_TokenC const *__pyx_v_token) { + int __pyx_r; + + /* "tokens/token.pxd":103 + * @staticmethod + * cdef inline int missing_dep(const TokenC* token) noexcept nogil: + * return token.dep == MISSING_DEP # <<<<<<<<<<<<<< + * + * @staticmethod +*/ + __pyx_r = (__pyx_v_token->dep == __pyx_v_5spacy_6tokens_5token_MISSING_DEP); + goto __pyx_L0; + + /* "tokens/token.pxd":101 + * token.sent_start = value + * + * @staticmethod # <<<<<<<<<<<<<< + * cdef inline int missing_dep(const TokenC* token) noexcept nogil: + * return token.dep == MISSING_DEP +*/ + + /* function exit code */ + __pyx_L0:; + return __pyx_r; +} + +/* "tokens/token.pxd":105 + * return token.dep == MISSING_DEP + * + * @staticmethod # <<<<<<<<<<<<<< + * cdef inline int missing_head(const TokenC* token) noexcept nogil: + * return Token.missing_dep(token) +*/ + +static CYTHON_INLINE int __pyx_f_5spacy_6tokens_5token_5Token_missing_head(struct __pyx_t_5spacy_7structs_TokenC const *__pyx_v_token) { + int __pyx_r; + + /* "tokens/token.pxd":107 + * @staticmethod + * cdef inline int missing_head(const TokenC* token) noexcept nogil: + * return Token.missing_dep(token) # <<<<<<<<<<<<<< +*/ + __pyx_r = __pyx_f_5spacy_6tokens_5token_5Token_missing_dep(__pyx_v_token); + goto __pyx_L0; + + /* "tokens/token.pxd":105 + * return token.dep == MISSING_DEP + * + * @staticmethod # <<<<<<<<<<<<<< + * cdef inline int missing_head(const TokenC* token) noexcept nogil: + * return Token.missing_dep(token) +*/ + + /* function exit code */ + __pyx_L0:; + return __pyx_r; +} + +/* "thinc/extra/search.pxd":56 + * cdef int _fill(self, Queue* q, weight_t** scores, int** is_valid) except -1 + * + * cdef inline void* at(self, int i) nogil: # <<<<<<<<<<<<<< + * return self._states[i].content + * +*/ + +static CYTHON_INLINE void *__pyx_f_5thinc_5extra_6search_4Beam_at(struct __pyx_obj_5thinc_5extra_6search_Beam *__pyx_v_self, int __pyx_v_i) { + void *__pyx_r; + + /* "thinc/extra/search.pxd":57 + * + * cdef inline void* at(self, int i) nogil: + * return self._states[i].content # <<<<<<<<<<<<<< + * + * cdef int initialize(self, init_func_t init_func, del_func_t del_func, int n, void* extra_args) except -1 +*/ + __pyx_r = (__pyx_v_self->_states[__pyx_v_i]).content; + goto __pyx_L0; + + /* "thinc/extra/search.pxd":56 + * cdef int _fill(self, Queue* q, weight_t** scores, int** is_valid) except -1 + * + * cdef inline void* at(self, int i) nogil: # <<<<<<<<<<<<<< + * return self._states[i].content + * +*/ + + /* function exit code */ + __pyx_L0:; + return __pyx_r; +} + +/* "thinc/extra/search.pxd":65 + * + * + * cdef inline void set_cell(self, int i, int j, weight_t score, int is_valid, weight_t cost) nogil: # <<<<<<<<<<<<<< + * self.scores[i][j] = score + * self.is_valid[i][j] = is_valid +*/ + +static CYTHON_INLINE void __pyx_f_5thinc_5extra_6search_4Beam_set_cell(struct __pyx_obj_5thinc_5extra_6search_Beam *__pyx_v_self, int __pyx_v_i, int __pyx_v_j, __pyx_t_5thinc_5extra_6search_weight_t __pyx_v_score, int __pyx_v_is_valid, __pyx_t_5thinc_5extra_6search_weight_t __pyx_v_cost) { + + /* "thinc/extra/search.pxd":66 + * + * cdef inline void set_cell(self, int i, int j, weight_t score, int is_valid, weight_t cost) nogil: + * self.scores[i][j] = score # <<<<<<<<<<<<<< + * self.is_valid[i][j] = is_valid + * self.costs[i][j] = cost +*/ + ((__pyx_v_self->scores[__pyx_v_i])[__pyx_v_j]) = __pyx_v_score; + + /* "thinc/extra/search.pxd":67 + * cdef inline void set_cell(self, int i, int j, weight_t score, int is_valid, weight_t cost) nogil: + * self.scores[i][j] = score + * self.is_valid[i][j] = is_valid # <<<<<<<<<<<<<< + * self.costs[i][j] = cost + * +*/ + ((__pyx_v_self->is_valid[__pyx_v_i])[__pyx_v_j]) = __pyx_v_is_valid; + + /* "thinc/extra/search.pxd":68 + * self.scores[i][j] = score + * self.is_valid[i][j] = is_valid + * self.costs[i][j] = cost # <<<<<<<<<<<<<< + * + * cdef int set_row(self, int i, const weight_t* scores, const int* is_valid, +*/ + ((__pyx_v_self->costs[__pyx_v_i])[__pyx_v_j]) = __pyx_v_cost; + + /* "thinc/extra/search.pxd":65 + * + * + * cdef inline void set_cell(self, int i, int j, weight_t score, int is_valid, weight_t cost) nogil: # <<<<<<<<<<<<<< + * self.scores[i][j] = score + * self.is_valid[i][j] = is_valid +*/ + + /* function exit code */ +} + +/* "spacy/pipeline/_parser_internals/arc_eager.pyx":71 + * + * + * cdef GoldParseStateC create_gold_state( # <<<<<<<<<<<<<< + * Pool mem, const StateC* state, heads, labels, sent_starts + * ) except *: +*/ + +static struct __pyx_t_5spacy_8pipeline_17_parser_internals_9arc_eager_GoldParseStateC __pyx_f_5spacy_8pipeline_17_parser_internals_9arc_eager_create_gold_state(struct __pyx_obj_5cymem_5cymem_Pool *__pyx_v_mem, __pyx_t_5spacy_8pipeline_17_parser_internals_6_state_StateC const *__pyx_v_state, PyObject *__pyx_v_heads, PyObject *__pyx_v_labels, PyObject *__pyx_v_sent_starts) { + struct __pyx_t_5spacy_8pipeline_17_parser_internals_9arc_eager_GoldParseStateC __pyx_v_gs; + PyObject *__pyx_v_i = NULL; + PyObject *__pyx_v_is_sent_start = NULL; + PyObject *__pyx_v_head = NULL; + PyObject *__pyx_v_label = NULL; + struct __pyx_obj_5cymem_5cymem_Address *__pyx_v_js_addr = NULL; + int32_t *__pyx_v_js; + struct __pyx_t_5spacy_8pipeline_17_parser_internals_9arc_eager_GoldParseStateC __pyx_r; + __Pyx_RefNannyDeclarations + Py_ssize_t __pyx_t_1; + int __pyx_t_2; + void *__pyx_t_3; + PyObject *__pyx_t_4 = NULL; + PyObject *__pyx_t_5 = NULL; + PyObject *(*__pyx_t_6)(PyObject *); + PyObject *__pyx_t_7 = NULL; + Py_ssize_t __pyx_t_8; + Py_ssize_t __pyx_t_9; + size_t __pyx_t_10; + PyObject *__pyx_t_11 = NULL; + PyObject *__pyx_t_12 = NULL; + PyObject *__pyx_t_13 = NULL; + PyObject *(*__pyx_t_14)(PyObject *); + int32_t __pyx_t_15; + __pyx_t_5spacy_8typedefs_attr_t __pyx_t_16; + int __pyx_t_17; + int __pyx_lineno = 0; + const char *__pyx_filename = NULL; + int __pyx_clineno = 0; + __Pyx_RefNannySetupContext("create_gold_state", 0); + + /* "spacy/pipeline/_parser_internals/arc_eager.pyx":75 + * ) except *: + * cdef GoldParseStateC gs + * gs.length = len(heads) # <<<<<<<<<<<<<< + * gs.stride = 1 + * assert gs.length > 0 +*/ + __pyx_t_1 = PyObject_Length(__pyx_v_heads); if (unlikely(__pyx_t_1 == ((Py_ssize_t)-1))) __PYX_ERR(0, 75, __pyx_L1_error) + __pyx_v_gs.length = __pyx_t_1; + + /* "spacy/pipeline/_parser_internals/arc_eager.pyx":76 + * cdef GoldParseStateC gs + * gs.length = len(heads) + * gs.stride = 1 # <<<<<<<<<<<<<< + * assert gs.length > 0 + * gs.labels = mem.alloc(gs.length, sizeof(gs.labels[0])) +*/ + __pyx_v_gs.stride = 1; + + /* "spacy/pipeline/_parser_internals/arc_eager.pyx":77 + * gs.length = len(heads) + * gs.stride = 1 + * assert gs.length > 0 # <<<<<<<<<<<<<< + * gs.labels = mem.alloc(gs.length, sizeof(gs.labels[0])) + * gs.heads = mem.alloc(gs.length, sizeof(gs.heads[0])) +*/ + #ifndef CYTHON_WITHOUT_ASSERTIONS + if (unlikely(__pyx_assertions_enabled())) { + __pyx_t_2 = (__pyx_v_gs.length > 0); + if (unlikely(!__pyx_t_2)) { + __Pyx_Raise(((PyObject *)(((PyTypeObject*)PyExc_AssertionError))), 0, 0, 0); + __PYX_ERR(0, 77, __pyx_L1_error) + } + } + #else + if ((1)); else __PYX_ERR(0, 77, __pyx_L1_error) + #endif + + /* "spacy/pipeline/_parser_internals/arc_eager.pyx":78 + * gs.stride = 1 + * assert gs.length > 0 + * gs.labels = mem.alloc(gs.length, sizeof(gs.labels[0])) # <<<<<<<<<<<<<< + * gs.heads = mem.alloc(gs.length, sizeof(gs.heads[0])) + * gs.n_kids = mem.alloc(gs.length, sizeof(gs.n_kids[0])) +*/ + __pyx_t_3 = ((struct __pyx_vtabstruct_5cymem_5cymem_Pool *)__pyx_v_mem->__pyx_vtab)->alloc(__pyx_v_mem, __pyx_v_gs.length, (sizeof((__pyx_v_gs.labels[0])))); if (unlikely(__pyx_t_3 == ((void *)NULL))) __PYX_ERR(0, 78, __pyx_L1_error) + __pyx_v_gs.labels = ((__pyx_t_5spacy_8typedefs_attr_t *)__pyx_t_3); + + /* "spacy/pipeline/_parser_internals/arc_eager.pyx":79 + * assert gs.length > 0 + * gs.labels = mem.alloc(gs.length, sizeof(gs.labels[0])) + * gs.heads = mem.alloc(gs.length, sizeof(gs.heads[0])) # <<<<<<<<<<<<<< + * gs.n_kids = mem.alloc(gs.length, sizeof(gs.n_kids[0])) + * gs.state_bits = mem.alloc(gs.length, sizeof(gs.state_bits[0])) +*/ + __pyx_t_3 = ((struct __pyx_vtabstruct_5cymem_5cymem_Pool *)__pyx_v_mem->__pyx_vtab)->alloc(__pyx_v_mem, __pyx_v_gs.length, (sizeof((__pyx_v_gs.heads[0])))); if (unlikely(__pyx_t_3 == ((void *)NULL))) __PYX_ERR(0, 79, __pyx_L1_error) + __pyx_v_gs.heads = ((int32_t *)__pyx_t_3); + + /* "spacy/pipeline/_parser_internals/arc_eager.pyx":80 + * gs.labels = mem.alloc(gs.length, sizeof(gs.labels[0])) + * gs.heads = mem.alloc(gs.length, sizeof(gs.heads[0])) + * gs.n_kids = mem.alloc(gs.length, sizeof(gs.n_kids[0])) # <<<<<<<<<<<<<< + * gs.state_bits = mem.alloc(gs.length, sizeof(gs.state_bits[0])) + * gs.n_kids_in_buffer = mem.alloc(gs.length, sizeof(gs.n_kids_in_buffer[0])) +*/ + __pyx_t_3 = ((struct __pyx_vtabstruct_5cymem_5cymem_Pool *)__pyx_v_mem->__pyx_vtab)->alloc(__pyx_v_mem, __pyx_v_gs.length, (sizeof((__pyx_v_gs.n_kids[0])))); if (unlikely(__pyx_t_3 == ((void *)NULL))) __PYX_ERR(0, 80, __pyx_L1_error) + __pyx_v_gs.n_kids = ((int32_t *)__pyx_t_3); + + /* "spacy/pipeline/_parser_internals/arc_eager.pyx":81 + * gs.heads = mem.alloc(gs.length, sizeof(gs.heads[0])) + * gs.n_kids = mem.alloc(gs.length, sizeof(gs.n_kids[0])) + * gs.state_bits = mem.alloc(gs.length, sizeof(gs.state_bits[0])) # <<<<<<<<<<<<<< + * gs.n_kids_in_buffer = mem.alloc(gs.length, sizeof(gs.n_kids_in_buffer[0])) + * gs.n_kids_in_stack = mem.alloc(gs.length, sizeof(gs.n_kids_in_stack[0])) +*/ + __pyx_t_3 = ((struct __pyx_vtabstruct_5cymem_5cymem_Pool *)__pyx_v_mem->__pyx_vtab)->alloc(__pyx_v_mem, __pyx_v_gs.length, (sizeof((__pyx_v_gs.state_bits[0])))); if (unlikely(__pyx_t_3 == ((void *)NULL))) __PYX_ERR(0, 81, __pyx_L1_error) + __pyx_v_gs.state_bits = ((char *)__pyx_t_3); + + /* "spacy/pipeline/_parser_internals/arc_eager.pyx":82 + * gs.n_kids = mem.alloc(gs.length, sizeof(gs.n_kids[0])) + * gs.state_bits = mem.alloc(gs.length, sizeof(gs.state_bits[0])) + * gs.n_kids_in_buffer = mem.alloc(gs.length, sizeof(gs.n_kids_in_buffer[0])) # <<<<<<<<<<<<<< + * gs.n_kids_in_stack = mem.alloc(gs.length, sizeof(gs.n_kids_in_stack[0])) + * +*/ + __pyx_t_3 = ((struct __pyx_vtabstruct_5cymem_5cymem_Pool *)__pyx_v_mem->__pyx_vtab)->alloc(__pyx_v_mem, __pyx_v_gs.length, (sizeof((__pyx_v_gs.n_kids_in_buffer[0])))); if (unlikely(__pyx_t_3 == ((void *)NULL))) __PYX_ERR(0, 82, __pyx_L1_error) + __pyx_v_gs.n_kids_in_buffer = ((int32_t *)__pyx_t_3); + + /* "spacy/pipeline/_parser_internals/arc_eager.pyx":83 + * gs.state_bits = mem.alloc(gs.length, sizeof(gs.state_bits[0])) + * gs.n_kids_in_buffer = mem.alloc(gs.length, sizeof(gs.n_kids_in_buffer[0])) + * gs.n_kids_in_stack = mem.alloc(gs.length, sizeof(gs.n_kids_in_stack[0])) # <<<<<<<<<<<<<< + * + * for i, is_sent_start in enumerate(sent_starts): +*/ + __pyx_t_3 = ((struct __pyx_vtabstruct_5cymem_5cymem_Pool *)__pyx_v_mem->__pyx_vtab)->alloc(__pyx_v_mem, __pyx_v_gs.length, (sizeof((__pyx_v_gs.n_kids_in_stack[0])))); if (unlikely(__pyx_t_3 == ((void *)NULL))) __PYX_ERR(0, 83, __pyx_L1_error) + __pyx_v_gs.n_kids_in_stack = ((int32_t *)__pyx_t_3); + + /* "spacy/pipeline/_parser_internals/arc_eager.pyx":85 + * gs.n_kids_in_stack = mem.alloc(gs.length, sizeof(gs.n_kids_in_stack[0])) + * + * for i, is_sent_start in enumerate(sent_starts): # <<<<<<<<<<<<<< + * if is_sent_start is True: + * gs.state_bits[i] = set_state_flag( +*/ + __Pyx_INCREF(__pyx_mstate_global->__pyx_int_0); + __pyx_t_4 = __pyx_mstate_global->__pyx_int_0; + if (likely(PyList_CheckExact(__pyx_v_sent_starts)) || PyTuple_CheckExact(__pyx_v_sent_starts)) { + __pyx_t_5 = __pyx_v_sent_starts; __Pyx_INCREF(__pyx_t_5); + __pyx_t_1 = 0; + __pyx_t_6 = NULL; + } else { + __pyx_t_1 = -1; __pyx_t_5 = PyObject_GetIter(__pyx_v_sent_starts); if (unlikely(!__pyx_t_5)) __PYX_ERR(0, 85, __pyx_L1_error) + __Pyx_GOTREF(__pyx_t_5); + __pyx_t_6 = (CYTHON_COMPILING_IN_LIMITED_API) ? PyIter_Next : __Pyx_PyObject_GetIterNextFunc(__pyx_t_5); if (unlikely(!__pyx_t_6)) __PYX_ERR(0, 85, __pyx_L1_error) + } + for (;;) { + if (likely(!__pyx_t_6)) { + if (likely(PyList_CheckExact(__pyx_t_5))) { + { + Py_ssize_t __pyx_temp = __Pyx_PyList_GET_SIZE(__pyx_t_5); + #if !CYTHON_ASSUME_SAFE_SIZE + if (unlikely((__pyx_temp < 0))) __PYX_ERR(0, 85, __pyx_L1_error) + #endif + if (__pyx_t_1 >= __pyx_temp) break; + } + __pyx_t_7 = __Pyx_PyList_GetItemRefFast(__pyx_t_5, __pyx_t_1, __Pyx_ReferenceSharing_OwnStrongReference); + ++__pyx_t_1; + } else { + { + Py_ssize_t __pyx_temp = __Pyx_PyTuple_GET_SIZE(__pyx_t_5); + #if !CYTHON_ASSUME_SAFE_SIZE + if (unlikely((__pyx_temp < 0))) __PYX_ERR(0, 85, __pyx_L1_error) + #endif + if (__pyx_t_1 >= __pyx_temp) break; + } + #if CYTHON_ASSUME_SAFE_MACROS && !CYTHON_AVOID_BORROWED_REFS + __pyx_t_7 = __Pyx_NewRef(PyTuple_GET_ITEM(__pyx_t_5, __pyx_t_1)); + #else + __pyx_t_7 = __Pyx_PySequence_ITEM(__pyx_t_5, __pyx_t_1); + #endif + ++__pyx_t_1; + } + if (unlikely(!__pyx_t_7)) __PYX_ERR(0, 85, __pyx_L1_error) + } else { + __pyx_t_7 = __pyx_t_6(__pyx_t_5); + if (unlikely(!__pyx_t_7)) { + PyObject* exc_type = PyErr_Occurred(); + if (exc_type) { + if (unlikely(!__Pyx_PyErr_GivenExceptionMatches(exc_type, PyExc_StopIteration))) __PYX_ERR(0, 85, __pyx_L1_error) + PyErr_Clear(); + } + break; + } + } + __Pyx_GOTREF(__pyx_t_7); + __Pyx_XDECREF_SET(__pyx_v_is_sent_start, __pyx_t_7); + __pyx_t_7 = 0; + __Pyx_INCREF(__pyx_t_4); + __Pyx_XDECREF_SET(__pyx_v_i, __pyx_t_4); + __pyx_t_7 = __Pyx_PyLong_AddObjC(__pyx_t_4, __pyx_mstate_global->__pyx_int_1, 1, 0, 0); if (unlikely(!__pyx_t_7)) __PYX_ERR(0, 85, __pyx_L1_error) + __Pyx_GOTREF(__pyx_t_7); + __Pyx_DECREF(__pyx_t_4); + __pyx_t_4 = __pyx_t_7; + __pyx_t_7 = 0; + + /* "spacy/pipeline/_parser_internals/arc_eager.pyx":86 + * + * for i, is_sent_start in enumerate(sent_starts): + * if is_sent_start is True: # <<<<<<<<<<<<<< + * gs.state_bits[i] = set_state_flag( + * gs.state_bits[i], +*/ + __pyx_t_2 = (__pyx_v_is_sent_start == Py_True); + if (__pyx_t_2) { + + /* "spacy/pipeline/_parser_internals/arc_eager.pyx":88 + * if is_sent_start is True: + * gs.state_bits[i] = set_state_flag( + * gs.state_bits[i], # <<<<<<<<<<<<<< + * IS_SENT_START, + * 1 +*/ + __pyx_t_8 = __Pyx_PyIndex_AsSsize_t(__pyx_v_i); if (unlikely((__pyx_t_8 == (Py_ssize_t)-1) && PyErr_Occurred())) __PYX_ERR(0, 88, __pyx_L1_error) + + /* "spacy/pipeline/_parser_internals/arc_eager.pyx":87 + * for i, is_sent_start in enumerate(sent_starts): + * if is_sent_start is True: + * gs.state_bits[i] = set_state_flag( # <<<<<<<<<<<<<< + * gs.state_bits[i], + * IS_SENT_START, +*/ + __pyx_t_9 = __Pyx_PyIndex_AsSsize_t(__pyx_v_i); if (unlikely((__pyx_t_9 == (Py_ssize_t)-1) && PyErr_Occurred())) __PYX_ERR(0, 87, __pyx_L1_error) + (__pyx_v_gs.state_bits[__pyx_t_9]) = __pyx_f_5spacy_8pipeline_17_parser_internals_9arc_eager_set_state_flag((__pyx_v_gs.state_bits[__pyx_t_8]), __pyx_e_5spacy_8pipeline_17_parser_internals_9arc_eager_IS_SENT_START, 1); + + /* "spacy/pipeline/_parser_internals/arc_eager.pyx":93 + * ) + * gs.state_bits[i] = set_state_flag( + * gs.state_bits[i], # <<<<<<<<<<<<<< + * SENT_START_UNKNOWN, + * 0 +*/ + __pyx_t_8 = __Pyx_PyIndex_AsSsize_t(__pyx_v_i); if (unlikely((__pyx_t_8 == (Py_ssize_t)-1) && PyErr_Occurred())) __PYX_ERR(0, 93, __pyx_L1_error) + + /* "spacy/pipeline/_parser_internals/arc_eager.pyx":92 + * 1 + * ) + * gs.state_bits[i] = set_state_flag( # <<<<<<<<<<<<<< + * gs.state_bits[i], + * SENT_START_UNKNOWN, +*/ + __pyx_t_9 = __Pyx_PyIndex_AsSsize_t(__pyx_v_i); if (unlikely((__pyx_t_9 == (Py_ssize_t)-1) && PyErr_Occurred())) __PYX_ERR(0, 92, __pyx_L1_error) + (__pyx_v_gs.state_bits[__pyx_t_9]) = __pyx_f_5spacy_8pipeline_17_parser_internals_9arc_eager_set_state_flag((__pyx_v_gs.state_bits[__pyx_t_8]), __pyx_e_5spacy_8pipeline_17_parser_internals_9arc_eager_SENT_START_UNKNOWN, 0); + + /* "spacy/pipeline/_parser_internals/arc_eager.pyx":86 + * + * for i, is_sent_start in enumerate(sent_starts): + * if is_sent_start is True: # <<<<<<<<<<<<<< + * gs.state_bits[i] = set_state_flag( + * gs.state_bits[i], +*/ + goto __pyx_L5; + } + + /* "spacy/pipeline/_parser_internals/arc_eager.pyx":98 + * ) + * + * elif is_sent_start is None: # <<<<<<<<<<<<<< + * gs.state_bits[i] = set_state_flag( + * gs.state_bits[i], +*/ + __pyx_t_2 = (__pyx_v_is_sent_start == Py_None); + if (__pyx_t_2) { + + /* "spacy/pipeline/_parser_internals/arc_eager.pyx":100 + * elif is_sent_start is None: + * gs.state_bits[i] = set_state_flag( + * gs.state_bits[i], # <<<<<<<<<<<<<< + * SENT_START_UNKNOWN, + * 1 +*/ + __pyx_t_8 = __Pyx_PyIndex_AsSsize_t(__pyx_v_i); if (unlikely((__pyx_t_8 == (Py_ssize_t)-1) && PyErr_Occurred())) __PYX_ERR(0, 100, __pyx_L1_error) + + /* "spacy/pipeline/_parser_internals/arc_eager.pyx":99 + * + * elif is_sent_start is None: + * gs.state_bits[i] = set_state_flag( # <<<<<<<<<<<<<< + * gs.state_bits[i], + * SENT_START_UNKNOWN, +*/ + __pyx_t_9 = __Pyx_PyIndex_AsSsize_t(__pyx_v_i); if (unlikely((__pyx_t_9 == (Py_ssize_t)-1) && PyErr_Occurred())) __PYX_ERR(0, 99, __pyx_L1_error) + (__pyx_v_gs.state_bits[__pyx_t_9]) = __pyx_f_5spacy_8pipeline_17_parser_internals_9arc_eager_set_state_flag((__pyx_v_gs.state_bits[__pyx_t_8]), __pyx_e_5spacy_8pipeline_17_parser_internals_9arc_eager_SENT_START_UNKNOWN, 1); + + /* "spacy/pipeline/_parser_internals/arc_eager.pyx":105 + * ) + * gs.state_bits[i] = set_state_flag( + * gs.state_bits[i], # <<<<<<<<<<<<<< + * IS_SENT_START, + * 0 +*/ + __pyx_t_8 = __Pyx_PyIndex_AsSsize_t(__pyx_v_i); if (unlikely((__pyx_t_8 == (Py_ssize_t)-1) && PyErr_Occurred())) __PYX_ERR(0, 105, __pyx_L1_error) + + /* "spacy/pipeline/_parser_internals/arc_eager.pyx":104 + * 1 + * ) + * gs.state_bits[i] = set_state_flag( # <<<<<<<<<<<<<< + * gs.state_bits[i], + * IS_SENT_START, +*/ + __pyx_t_9 = __Pyx_PyIndex_AsSsize_t(__pyx_v_i); if (unlikely((__pyx_t_9 == (Py_ssize_t)-1) && PyErr_Occurred())) __PYX_ERR(0, 104, __pyx_L1_error) + (__pyx_v_gs.state_bits[__pyx_t_9]) = __pyx_f_5spacy_8pipeline_17_parser_internals_9arc_eager_set_state_flag((__pyx_v_gs.state_bits[__pyx_t_8]), __pyx_e_5spacy_8pipeline_17_parser_internals_9arc_eager_IS_SENT_START, 0); + + /* "spacy/pipeline/_parser_internals/arc_eager.pyx":98 + * ) + * + * elif is_sent_start is None: # <<<<<<<<<<<<<< + * gs.state_bits[i] = set_state_flag( + * gs.state_bits[i], +*/ + goto __pyx_L5; + } + + /* "spacy/pipeline/_parser_internals/arc_eager.pyx":110 + * ) + * else: + * gs.state_bits[i] = set_state_flag( # <<<<<<<<<<<<<< + * gs.state_bits[i], + * SENT_START_UNKNOWN, +*/ + /*else*/ { + + /* "spacy/pipeline/_parser_internals/arc_eager.pyx":111 + * else: + * gs.state_bits[i] = set_state_flag( + * gs.state_bits[i], # <<<<<<<<<<<<<< + * SENT_START_UNKNOWN, + * 0 +*/ + __pyx_t_8 = __Pyx_PyIndex_AsSsize_t(__pyx_v_i); if (unlikely((__pyx_t_8 == (Py_ssize_t)-1) && PyErr_Occurred())) __PYX_ERR(0, 111, __pyx_L1_error) + + /* "spacy/pipeline/_parser_internals/arc_eager.pyx":110 + * ) + * else: + * gs.state_bits[i] = set_state_flag( # <<<<<<<<<<<<<< + * gs.state_bits[i], + * SENT_START_UNKNOWN, +*/ + __pyx_t_9 = __Pyx_PyIndex_AsSsize_t(__pyx_v_i); if (unlikely((__pyx_t_9 == (Py_ssize_t)-1) && PyErr_Occurred())) __PYX_ERR(0, 110, __pyx_L1_error) + (__pyx_v_gs.state_bits[__pyx_t_9]) = __pyx_f_5spacy_8pipeline_17_parser_internals_9arc_eager_set_state_flag((__pyx_v_gs.state_bits[__pyx_t_8]), __pyx_e_5spacy_8pipeline_17_parser_internals_9arc_eager_SENT_START_UNKNOWN, 0); + + /* "spacy/pipeline/_parser_internals/arc_eager.pyx":116 + * ) + * gs.state_bits[i] = set_state_flag( + * gs.state_bits[i], # <<<<<<<<<<<<<< + * IS_SENT_START, + * 0 +*/ + __pyx_t_8 = __Pyx_PyIndex_AsSsize_t(__pyx_v_i); if (unlikely((__pyx_t_8 == (Py_ssize_t)-1) && PyErr_Occurred())) __PYX_ERR(0, 116, __pyx_L1_error) + + /* "spacy/pipeline/_parser_internals/arc_eager.pyx":115 + * 0 + * ) + * gs.state_bits[i] = set_state_flag( # <<<<<<<<<<<<<< + * gs.state_bits[i], + * IS_SENT_START, +*/ + __pyx_t_9 = __Pyx_PyIndex_AsSsize_t(__pyx_v_i); if (unlikely((__pyx_t_9 == (Py_ssize_t)-1) && PyErr_Occurred())) __PYX_ERR(0, 115, __pyx_L1_error) + (__pyx_v_gs.state_bits[__pyx_t_9]) = __pyx_f_5spacy_8pipeline_17_parser_internals_9arc_eager_set_state_flag((__pyx_v_gs.state_bits[__pyx_t_8]), __pyx_e_5spacy_8pipeline_17_parser_internals_9arc_eager_IS_SENT_START, 0); + } + __pyx_L5:; + + /* "spacy/pipeline/_parser_internals/arc_eager.pyx":85 + * gs.n_kids_in_stack = mem.alloc(gs.length, sizeof(gs.n_kids_in_stack[0])) + * + * for i, is_sent_start in enumerate(sent_starts): # <<<<<<<<<<<<<< + * if is_sent_start is True: + * gs.state_bits[i] = set_state_flag( +*/ + } + __Pyx_DECREF(__pyx_t_5); __pyx_t_5 = 0; + __Pyx_DECREF(__pyx_t_4); __pyx_t_4 = 0; + + /* "spacy/pipeline/_parser_internals/arc_eager.pyx":121 + * ) + * + * for i, (head, label) in enumerate(zip(heads, labels)): # <<<<<<<<<<<<<< + * if head is not None: + * gs.heads[i] = head +*/ + __Pyx_INCREF(__pyx_mstate_global->__pyx_int_0); + __pyx_t_4 = __pyx_mstate_global->__pyx_int_0; + __pyx_t_7 = NULL; + __pyx_t_10 = 1; + { + PyObject *__pyx_callargs[3] = {__pyx_t_7, __pyx_v_heads, __pyx_v_labels}; + __pyx_t_5 = __Pyx_PyObject_FastCall((PyObject*)__pyx_builtin_zip, __pyx_callargs+__pyx_t_10, (3-__pyx_t_10) | (__pyx_t_10*__Pyx_PY_VECTORCALL_ARGUMENTS_OFFSET)); + __Pyx_XDECREF(__pyx_t_7); __pyx_t_7 = 0; + if (unlikely(!__pyx_t_5)) __PYX_ERR(0, 121, __pyx_L1_error) + __Pyx_GOTREF(__pyx_t_5); + } + if (likely(PyList_CheckExact(__pyx_t_5)) || PyTuple_CheckExact(__pyx_t_5)) { + __pyx_t_7 = __pyx_t_5; __Pyx_INCREF(__pyx_t_7); + __pyx_t_1 = 0; + __pyx_t_6 = NULL; + } else { + __pyx_t_1 = -1; __pyx_t_7 = PyObject_GetIter(__pyx_t_5); if (unlikely(!__pyx_t_7)) __PYX_ERR(0, 121, __pyx_L1_error) + __Pyx_GOTREF(__pyx_t_7); + __pyx_t_6 = (CYTHON_COMPILING_IN_LIMITED_API) ? PyIter_Next : __Pyx_PyObject_GetIterNextFunc(__pyx_t_7); if (unlikely(!__pyx_t_6)) __PYX_ERR(0, 121, __pyx_L1_error) + } + __Pyx_DECREF(__pyx_t_5); __pyx_t_5 = 0; + for (;;) { + if (likely(!__pyx_t_6)) { + if (likely(PyList_CheckExact(__pyx_t_7))) { + { + Py_ssize_t __pyx_temp = __Pyx_PyList_GET_SIZE(__pyx_t_7); + #if !CYTHON_ASSUME_SAFE_SIZE + if (unlikely((__pyx_temp < 0))) __PYX_ERR(0, 121, __pyx_L1_error) + #endif + if (__pyx_t_1 >= __pyx_temp) break; + } + __pyx_t_5 = __Pyx_PyList_GetItemRefFast(__pyx_t_7, __pyx_t_1, __Pyx_ReferenceSharing_OwnStrongReference); + ++__pyx_t_1; + } else { + { + Py_ssize_t __pyx_temp = __Pyx_PyTuple_GET_SIZE(__pyx_t_7); + #if !CYTHON_ASSUME_SAFE_SIZE + if (unlikely((__pyx_temp < 0))) __PYX_ERR(0, 121, __pyx_L1_error) + #endif + if (__pyx_t_1 >= __pyx_temp) break; + } + #if CYTHON_ASSUME_SAFE_MACROS && !CYTHON_AVOID_BORROWED_REFS + __pyx_t_5 = __Pyx_NewRef(PyTuple_GET_ITEM(__pyx_t_7, __pyx_t_1)); + #else + __pyx_t_5 = __Pyx_PySequence_ITEM(__pyx_t_7, __pyx_t_1); + #endif + ++__pyx_t_1; + } + if (unlikely(!__pyx_t_5)) __PYX_ERR(0, 121, __pyx_L1_error) + } else { + __pyx_t_5 = __pyx_t_6(__pyx_t_7); + if (unlikely(!__pyx_t_5)) { + PyObject* exc_type = PyErr_Occurred(); + if (exc_type) { + if (unlikely(!__Pyx_PyErr_GivenExceptionMatches(exc_type, PyExc_StopIteration))) __PYX_ERR(0, 121, __pyx_L1_error) + PyErr_Clear(); + } + break; + } + } + __Pyx_GOTREF(__pyx_t_5); + if ((likely(PyTuple_CheckExact(__pyx_t_5))) || (PyList_CheckExact(__pyx_t_5))) { + PyObject* sequence = __pyx_t_5; + 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, 121, __pyx_L1_error) + } + #if CYTHON_ASSUME_SAFE_MACROS && !CYTHON_AVOID_BORROWED_REFS + if (likely(PyTuple_CheckExact(sequence))) { + __pyx_t_11 = PyTuple_GET_ITEM(sequence, 0); + __Pyx_INCREF(__pyx_t_11); + __pyx_t_12 = PyTuple_GET_ITEM(sequence, 1); + __Pyx_INCREF(__pyx_t_12); + } else { + __pyx_t_11 = __Pyx_PyList_GetItemRefFast(sequence, 0, __Pyx_ReferenceSharing_SharedReference); + if (unlikely(!__pyx_t_11)) __PYX_ERR(0, 121, __pyx_L1_error) + __Pyx_XGOTREF(__pyx_t_11); + __pyx_t_12 = __Pyx_PyList_GetItemRefFast(sequence, 1, __Pyx_ReferenceSharing_SharedReference); + if (unlikely(!__pyx_t_12)) __PYX_ERR(0, 121, __pyx_L1_error) + __Pyx_XGOTREF(__pyx_t_12); + } + #else + __pyx_t_11 = __Pyx_PySequence_ITEM(sequence, 0); if (unlikely(!__pyx_t_11)) __PYX_ERR(0, 121, __pyx_L1_error) + __Pyx_GOTREF(__pyx_t_11); + __pyx_t_12 = __Pyx_PySequence_ITEM(sequence, 1); if (unlikely(!__pyx_t_12)) __PYX_ERR(0, 121, __pyx_L1_error) + __Pyx_GOTREF(__pyx_t_12); + #endif + __Pyx_DECREF(__pyx_t_5); __pyx_t_5 = 0; + } else { + Py_ssize_t index = -1; + __pyx_t_13 = PyObject_GetIter(__pyx_t_5); if (unlikely(!__pyx_t_13)) __PYX_ERR(0, 121, __pyx_L1_error) + __Pyx_GOTREF(__pyx_t_13); + __Pyx_DECREF(__pyx_t_5); __pyx_t_5 = 0; + __pyx_t_14 = (CYTHON_COMPILING_IN_LIMITED_API) ? PyIter_Next : __Pyx_PyObject_GetIterNextFunc(__pyx_t_13); + index = 0; __pyx_t_11 = __pyx_t_14(__pyx_t_13); if (unlikely(!__pyx_t_11)) goto __pyx_L9_unpacking_failed; + __Pyx_GOTREF(__pyx_t_11); + index = 1; __pyx_t_12 = __pyx_t_14(__pyx_t_13); if (unlikely(!__pyx_t_12)) goto __pyx_L9_unpacking_failed; + __Pyx_GOTREF(__pyx_t_12); + if (__Pyx_IternextUnpackEndCheck(__pyx_t_14(__pyx_t_13), 2) < (0)) __PYX_ERR(0, 121, __pyx_L1_error) + __pyx_t_14 = NULL; + __Pyx_DECREF(__pyx_t_13); __pyx_t_13 = 0; + goto __pyx_L10_unpacking_done; + __pyx_L9_unpacking_failed:; + __Pyx_DECREF(__pyx_t_13); __pyx_t_13 = 0; + __pyx_t_14 = NULL; + if (__Pyx_IterFinish() == 0) __Pyx_RaiseNeedMoreValuesError(index); + __PYX_ERR(0, 121, __pyx_L1_error) + __pyx_L10_unpacking_done:; + } + __Pyx_XDECREF_SET(__pyx_v_head, __pyx_t_11); + __pyx_t_11 = 0; + __Pyx_XDECREF_SET(__pyx_v_label, __pyx_t_12); + __pyx_t_12 = 0; + __Pyx_INCREF(__pyx_t_4); + __Pyx_XDECREF_SET(__pyx_v_i, __pyx_t_4); + __pyx_t_5 = __Pyx_PyLong_AddObjC(__pyx_t_4, __pyx_mstate_global->__pyx_int_1, 1, 0, 0); if (unlikely(!__pyx_t_5)) __PYX_ERR(0, 121, __pyx_L1_error) + __Pyx_GOTREF(__pyx_t_5); + __Pyx_DECREF(__pyx_t_4); + __pyx_t_4 = __pyx_t_5; + __pyx_t_5 = 0; + + /* "spacy/pipeline/_parser_internals/arc_eager.pyx":122 + * + * for i, (head, label) in enumerate(zip(heads, labels)): + * if head is not None: # <<<<<<<<<<<<<< + * gs.heads[i] = head + * gs.labels[i] = label +*/ + __pyx_t_2 = (__pyx_v_head != Py_None); + if (__pyx_t_2) { + + /* "spacy/pipeline/_parser_internals/arc_eager.pyx":123 + * for i, (head, label) in enumerate(zip(heads, labels)): + * if head is not None: + * gs.heads[i] = head # <<<<<<<<<<<<<< + * gs.labels[i] = label + * if i != head: +*/ + __pyx_t_15 = __Pyx_PyLong_As_int32_t(__pyx_v_head); if (unlikely((__pyx_t_15 == ((int32_t)-1)) && PyErr_Occurred())) __PYX_ERR(0, 123, __pyx_L1_error) + __pyx_t_8 = __Pyx_PyIndex_AsSsize_t(__pyx_v_i); if (unlikely((__pyx_t_8 == (Py_ssize_t)-1) && PyErr_Occurred())) __PYX_ERR(0, 123, __pyx_L1_error) + (__pyx_v_gs.heads[__pyx_t_8]) = __pyx_t_15; + + /* "spacy/pipeline/_parser_internals/arc_eager.pyx":124 + * if head is not None: + * gs.heads[i] = head + * gs.labels[i] = label # <<<<<<<<<<<<<< + * if i != head: + * gs.n_kids[head] += 1 +*/ + __pyx_t_16 = __Pyx_PyLong_As_uint64_t(__pyx_v_label); if (unlikely((__pyx_t_16 == ((uint64_t)-1)) && PyErr_Occurred())) __PYX_ERR(0, 124, __pyx_L1_error) + __pyx_t_8 = __Pyx_PyIndex_AsSsize_t(__pyx_v_i); if (unlikely((__pyx_t_8 == (Py_ssize_t)-1) && PyErr_Occurred())) __PYX_ERR(0, 124, __pyx_L1_error) + (__pyx_v_gs.labels[__pyx_t_8]) = __pyx_t_16; + + /* "spacy/pipeline/_parser_internals/arc_eager.pyx":125 + * gs.heads[i] = head + * gs.labels[i] = label + * if i != head: # <<<<<<<<<<<<<< + * gs.n_kids[head] += 1 + * gs.state_bits[i] = set_state_flag( +*/ + __pyx_t_5 = PyObject_RichCompare(__pyx_v_i, __pyx_v_head, Py_NE); __Pyx_XGOTREF(__pyx_t_5); if (unlikely(!__pyx_t_5)) __PYX_ERR(0, 125, __pyx_L1_error) + __pyx_t_2 = __Pyx_PyObject_IsTrue(__pyx_t_5); if (unlikely((__pyx_t_2 < 0))) __PYX_ERR(0, 125, __pyx_L1_error) + __Pyx_DECREF(__pyx_t_5); __pyx_t_5 = 0; + if (__pyx_t_2) { + + /* "spacy/pipeline/_parser_internals/arc_eager.pyx":126 + * gs.labels[i] = label + * if i != head: + * gs.n_kids[head] += 1 # <<<<<<<<<<<<<< + * gs.state_bits[i] = set_state_flag( + * gs.state_bits[i], +*/ + __pyx_t_8 = __Pyx_PyIndex_AsSsize_t(__pyx_v_head); if (unlikely((__pyx_t_8 == (Py_ssize_t)-1) && PyErr_Occurred())) __PYX_ERR(0, 126, __pyx_L1_error) + (__pyx_v_gs.n_kids[__pyx_t_8]) = ((__pyx_v_gs.n_kids[__pyx_t_8]) + 1); + + /* "spacy/pipeline/_parser_internals/arc_eager.pyx":125 + * gs.heads[i] = head + * gs.labels[i] = label + * if i != head: # <<<<<<<<<<<<<< + * gs.n_kids[head] += 1 + * gs.state_bits[i] = set_state_flag( +*/ + } + + /* "spacy/pipeline/_parser_internals/arc_eager.pyx":128 + * gs.n_kids[head] += 1 + * gs.state_bits[i] = set_state_flag( + * gs.state_bits[i], # <<<<<<<<<<<<<< + * HEAD_UNKNOWN, + * 0 +*/ + __pyx_t_8 = __Pyx_PyIndex_AsSsize_t(__pyx_v_i); if (unlikely((__pyx_t_8 == (Py_ssize_t)-1) && PyErr_Occurred())) __PYX_ERR(0, 128, __pyx_L1_error) + + /* "spacy/pipeline/_parser_internals/arc_eager.pyx":127 + * if i != head: + * gs.n_kids[head] += 1 + * gs.state_bits[i] = set_state_flag( # <<<<<<<<<<<<<< + * gs.state_bits[i], + * HEAD_UNKNOWN, +*/ + __pyx_t_9 = __Pyx_PyIndex_AsSsize_t(__pyx_v_i); if (unlikely((__pyx_t_9 == (Py_ssize_t)-1) && PyErr_Occurred())) __PYX_ERR(0, 127, __pyx_L1_error) + (__pyx_v_gs.state_bits[__pyx_t_9]) = __pyx_f_5spacy_8pipeline_17_parser_internals_9arc_eager_set_state_flag((__pyx_v_gs.state_bits[__pyx_t_8]), __pyx_e_5spacy_8pipeline_17_parser_internals_9arc_eager_HEAD_UNKNOWN, 0); + + /* "spacy/pipeline/_parser_internals/arc_eager.pyx":122 + * + * for i, (head, label) in enumerate(zip(heads, labels)): + * if head is not None: # <<<<<<<<<<<<<< + * gs.heads[i] = head + * gs.labels[i] = label +*/ + goto __pyx_L11; + } + + /* "spacy/pipeline/_parser_internals/arc_eager.pyx":133 + * ) + * else: + * gs.state_bits[i] = set_state_flag( # <<<<<<<<<<<<<< + * gs.state_bits[i], + * HEAD_UNKNOWN, +*/ + /*else*/ { + + /* "spacy/pipeline/_parser_internals/arc_eager.pyx":134 + * else: + * gs.state_bits[i] = set_state_flag( + * gs.state_bits[i], # <<<<<<<<<<<<<< + * HEAD_UNKNOWN, + * 1 +*/ + __pyx_t_8 = __Pyx_PyIndex_AsSsize_t(__pyx_v_i); if (unlikely((__pyx_t_8 == (Py_ssize_t)-1) && PyErr_Occurred())) __PYX_ERR(0, 134, __pyx_L1_error) + + /* "spacy/pipeline/_parser_internals/arc_eager.pyx":133 + * ) + * else: + * gs.state_bits[i] = set_state_flag( # <<<<<<<<<<<<<< + * gs.state_bits[i], + * HEAD_UNKNOWN, +*/ + __pyx_t_9 = __Pyx_PyIndex_AsSsize_t(__pyx_v_i); if (unlikely((__pyx_t_9 == (Py_ssize_t)-1) && PyErr_Occurred())) __PYX_ERR(0, 133, __pyx_L1_error) + (__pyx_v_gs.state_bits[__pyx_t_9]) = __pyx_f_5spacy_8pipeline_17_parser_internals_9arc_eager_set_state_flag((__pyx_v_gs.state_bits[__pyx_t_8]), __pyx_e_5spacy_8pipeline_17_parser_internals_9arc_eager_HEAD_UNKNOWN, 1); + } + __pyx_L11:; + + /* "spacy/pipeline/_parser_internals/arc_eager.pyx":121 + * ) + * + * for i, (head, label) in enumerate(zip(heads, labels)): # <<<<<<<<<<<<<< + * if head is not None: + * gs.heads[i] = head +*/ + } + __Pyx_DECREF(__pyx_t_7); __pyx_t_7 = 0; + __Pyx_DECREF(__pyx_t_4); __pyx_t_4 = 0; + + /* "spacy/pipeline/_parser_internals/arc_eager.pyx":139 + * ) + * # Make an array of pointers, pointing into the gs_kids_flat array. + * assert gs.length > 0 # <<<<<<<<<<<<<< + * gs.kids = mem.alloc(gs.length, sizeof(int32_t*)) + * for i in range(gs.length): +*/ + #ifndef CYTHON_WITHOUT_ASSERTIONS + if (unlikely(__pyx_assertions_enabled())) { + __pyx_t_2 = (__pyx_v_gs.length > 0); + if (unlikely(!__pyx_t_2)) { + __Pyx_Raise(((PyObject *)(((PyTypeObject*)PyExc_AssertionError))), 0, 0, 0); + __PYX_ERR(0, 139, __pyx_L1_error) + } + } + #else + if ((1)); else __PYX_ERR(0, 139, __pyx_L1_error) + #endif + + /* "spacy/pipeline/_parser_internals/arc_eager.pyx":140 + * # Make an array of pointers, pointing into the gs_kids_flat array. + * assert gs.length > 0 + * gs.kids = mem.alloc(gs.length, sizeof(int32_t*)) # <<<<<<<<<<<<<< + * for i in range(gs.length): + * if gs.n_kids[i] != 0: +*/ + __pyx_t_3 = ((struct __pyx_vtabstruct_5cymem_5cymem_Pool *)__pyx_v_mem->__pyx_vtab)->alloc(__pyx_v_mem, __pyx_v_gs.length, (sizeof(int32_t *))); if (unlikely(__pyx_t_3 == ((void *)NULL))) __PYX_ERR(0, 140, __pyx_L1_error) + __pyx_v_gs.kids = ((int32_t **)__pyx_t_3); + + /* "spacy/pipeline/_parser_internals/arc_eager.pyx":141 + * assert gs.length > 0 + * gs.kids = mem.alloc(gs.length, sizeof(int32_t*)) + * for i in range(gs.length): # <<<<<<<<<<<<<< + * if gs.n_kids[i] != 0: + * gs.kids[i] = mem.alloc(gs.n_kids[i], sizeof(int32_t)) +*/ + __pyx_t_7 = NULL; + __pyx_t_5 = __Pyx_PyLong_From_int32_t(__pyx_v_gs.length); if (unlikely(!__pyx_t_5)) __PYX_ERR(0, 141, __pyx_L1_error) + __Pyx_GOTREF(__pyx_t_5); + __pyx_t_10 = 1; + { + PyObject *__pyx_callargs[2] = {__pyx_t_7, __pyx_t_5}; + __pyx_t_4 = __Pyx_PyObject_FastCall((PyObject*)(&PyRange_Type), __pyx_callargs+__pyx_t_10, (2-__pyx_t_10) | (__pyx_t_10*__Pyx_PY_VECTORCALL_ARGUMENTS_OFFSET)); + __Pyx_XDECREF(__pyx_t_7); __pyx_t_7 = 0; + __Pyx_DECREF(__pyx_t_5); __pyx_t_5 = 0; + if (unlikely(!__pyx_t_4)) __PYX_ERR(0, 141, __pyx_L1_error) + __Pyx_GOTREF(__pyx_t_4); + } + __pyx_t_5 = PyObject_GetIter(__pyx_t_4); if (unlikely(!__pyx_t_5)) __PYX_ERR(0, 141, __pyx_L1_error) + __Pyx_GOTREF(__pyx_t_5); + __pyx_t_6 = (CYTHON_COMPILING_IN_LIMITED_API) ? PyIter_Next : __Pyx_PyObject_GetIterNextFunc(__pyx_t_5); if (unlikely(!__pyx_t_6)) __PYX_ERR(0, 141, __pyx_L1_error) + __Pyx_DECREF(__pyx_t_4); __pyx_t_4 = 0; + for (;;) { + { + __pyx_t_4 = __pyx_t_6(__pyx_t_5); + if (unlikely(!__pyx_t_4)) { + PyObject* exc_type = PyErr_Occurred(); + if (exc_type) { + if (unlikely(!__Pyx_PyErr_GivenExceptionMatches(exc_type, PyExc_StopIteration))) __PYX_ERR(0, 141, __pyx_L1_error) + PyErr_Clear(); + } + break; + } + } + __Pyx_GOTREF(__pyx_t_4); + __Pyx_XDECREF_SET(__pyx_v_i, __pyx_t_4); + __pyx_t_4 = 0; + + /* "spacy/pipeline/_parser_internals/arc_eager.pyx":142 + * gs.kids = mem.alloc(gs.length, sizeof(int32_t*)) + * for i in range(gs.length): + * if gs.n_kids[i] != 0: # <<<<<<<<<<<<<< + * gs.kids[i] = mem.alloc(gs.n_kids[i], sizeof(int32_t)) + * # This is a temporary buffer +*/ + __pyx_t_1 = __Pyx_PyIndex_AsSsize_t(__pyx_v_i); if (unlikely((__pyx_t_1 == (Py_ssize_t)-1) && PyErr_Occurred())) __PYX_ERR(0, 142, __pyx_L1_error) + __pyx_t_2 = ((__pyx_v_gs.n_kids[__pyx_t_1]) != 0); + if (__pyx_t_2) { + + /* "spacy/pipeline/_parser_internals/arc_eager.pyx":143 + * for i in range(gs.length): + * if gs.n_kids[i] != 0: + * gs.kids[i] = mem.alloc(gs.n_kids[i], sizeof(int32_t)) # <<<<<<<<<<<<<< + * # This is a temporary buffer + * js_addr = Address(gs.length, sizeof(int32_t)) +*/ + __pyx_t_1 = __Pyx_PyIndex_AsSsize_t(__pyx_v_i); if (unlikely((__pyx_t_1 == (Py_ssize_t)-1) && PyErr_Occurred())) __PYX_ERR(0, 143, __pyx_L1_error) + __pyx_t_3 = ((struct __pyx_vtabstruct_5cymem_5cymem_Pool *)__pyx_v_mem->__pyx_vtab)->alloc(__pyx_v_mem, (__pyx_v_gs.n_kids[__pyx_t_1]), (sizeof(int32_t))); if (unlikely(__pyx_t_3 == ((void *)NULL))) __PYX_ERR(0, 143, __pyx_L1_error) + __pyx_t_1 = __Pyx_PyIndex_AsSsize_t(__pyx_v_i); if (unlikely((__pyx_t_1 == (Py_ssize_t)-1) && PyErr_Occurred())) __PYX_ERR(0, 143, __pyx_L1_error) + (__pyx_v_gs.kids[__pyx_t_1]) = ((int32_t *)__pyx_t_3); + + /* "spacy/pipeline/_parser_internals/arc_eager.pyx":142 + * gs.kids = mem.alloc(gs.length, sizeof(int32_t*)) + * for i in range(gs.length): + * if gs.n_kids[i] != 0: # <<<<<<<<<<<<<< + * gs.kids[i] = mem.alloc(gs.n_kids[i], sizeof(int32_t)) + * # This is a temporary buffer +*/ + } + + /* "spacy/pipeline/_parser_internals/arc_eager.pyx":141 + * assert gs.length > 0 + * gs.kids = mem.alloc(gs.length, sizeof(int32_t*)) + * for i in range(gs.length): # <<<<<<<<<<<<<< + * if gs.n_kids[i] != 0: + * gs.kids[i] = mem.alloc(gs.n_kids[i], sizeof(int32_t)) +*/ + } + __Pyx_DECREF(__pyx_t_5); __pyx_t_5 = 0; + + /* "spacy/pipeline/_parser_internals/arc_eager.pyx":145 + * gs.kids[i] = mem.alloc(gs.n_kids[i], sizeof(int32_t)) + * # This is a temporary buffer + * js_addr = Address(gs.length, sizeof(int32_t)) # <<<<<<<<<<<<<< + * js = js_addr.ptr + * for i in range(gs.length): +*/ + __pyx_t_4 = NULL; + __pyx_t_7 = __Pyx_PyLong_From_int32_t(__pyx_v_gs.length); if (unlikely(!__pyx_t_7)) __PYX_ERR(0, 145, __pyx_L1_error) + __Pyx_GOTREF(__pyx_t_7); + __pyx_t_12 = __Pyx_PyLong_FromSize_t((sizeof(int32_t))); if (unlikely(!__pyx_t_12)) __PYX_ERR(0, 145, __pyx_L1_error) + __Pyx_GOTREF(__pyx_t_12); + __pyx_t_10 = 1; + { + PyObject *__pyx_callargs[3] = {__pyx_t_4, __pyx_t_7, __pyx_t_12}; + __pyx_t_5 = __Pyx_PyObject_FastCall((PyObject*)__pyx_mstate_global->__pyx_ptype_5cymem_5cymem_Address, __pyx_callargs+__pyx_t_10, (3-__pyx_t_10) | (__pyx_t_10*__Pyx_PY_VECTORCALL_ARGUMENTS_OFFSET)); + __Pyx_XDECREF(__pyx_t_4); __pyx_t_4 = 0; + __Pyx_DECREF(__pyx_t_7); __pyx_t_7 = 0; + __Pyx_DECREF(__pyx_t_12); __pyx_t_12 = 0; + if (unlikely(!__pyx_t_5)) __PYX_ERR(0, 145, __pyx_L1_error) + __Pyx_GOTREF((PyObject *)__pyx_t_5); + } + __pyx_v_js_addr = ((struct __pyx_obj_5cymem_5cymem_Address *)__pyx_t_5); + __pyx_t_5 = 0; + + /* "spacy/pipeline/_parser_internals/arc_eager.pyx":146 + * # This is a temporary buffer + * js_addr = Address(gs.length, sizeof(int32_t)) + * js = js_addr.ptr # <<<<<<<<<<<<<< + * for i in range(gs.length): + * if not is_head_unknown(&gs, i): +*/ + __pyx_v_js = ((int32_t *)__pyx_v_js_addr->ptr); + + /* "spacy/pipeline/_parser_internals/arc_eager.pyx":147 + * js_addr = Address(gs.length, sizeof(int32_t)) + * js = js_addr.ptr + * for i in range(gs.length): # <<<<<<<<<<<<<< + * if not is_head_unknown(&gs, i): + * head = gs.heads[i] +*/ + __pyx_t_12 = NULL; + __pyx_t_7 = __Pyx_PyLong_From_int32_t(__pyx_v_gs.length); if (unlikely(!__pyx_t_7)) __PYX_ERR(0, 147, __pyx_L1_error) + __Pyx_GOTREF(__pyx_t_7); + __pyx_t_10 = 1; + { + PyObject *__pyx_callargs[2] = {__pyx_t_12, __pyx_t_7}; + __pyx_t_5 = __Pyx_PyObject_FastCall((PyObject*)(&PyRange_Type), __pyx_callargs+__pyx_t_10, (2-__pyx_t_10) | (__pyx_t_10*__Pyx_PY_VECTORCALL_ARGUMENTS_OFFSET)); + __Pyx_XDECREF(__pyx_t_12); __pyx_t_12 = 0; + __Pyx_DECREF(__pyx_t_7); __pyx_t_7 = 0; + if (unlikely(!__pyx_t_5)) __PYX_ERR(0, 147, __pyx_L1_error) + __Pyx_GOTREF(__pyx_t_5); + } + __pyx_t_7 = PyObject_GetIter(__pyx_t_5); if (unlikely(!__pyx_t_7)) __PYX_ERR(0, 147, __pyx_L1_error) + __Pyx_GOTREF(__pyx_t_7); + __pyx_t_6 = (CYTHON_COMPILING_IN_LIMITED_API) ? PyIter_Next : __Pyx_PyObject_GetIterNextFunc(__pyx_t_7); if (unlikely(!__pyx_t_6)) __PYX_ERR(0, 147, __pyx_L1_error) + __Pyx_DECREF(__pyx_t_5); __pyx_t_5 = 0; + for (;;) { + { + __pyx_t_5 = __pyx_t_6(__pyx_t_7); + if (unlikely(!__pyx_t_5)) { + PyObject* exc_type = PyErr_Occurred(); + if (exc_type) { + if (unlikely(!__Pyx_PyErr_GivenExceptionMatches(exc_type, PyExc_StopIteration))) __PYX_ERR(0, 147, __pyx_L1_error) + PyErr_Clear(); + } + break; + } + } + __Pyx_GOTREF(__pyx_t_5); + __Pyx_XDECREF_SET(__pyx_v_i, __pyx_t_5); + __pyx_t_5 = 0; + + /* "spacy/pipeline/_parser_internals/arc_eager.pyx":148 + * js = js_addr.ptr + * for i in range(gs.length): + * if not is_head_unknown(&gs, i): # <<<<<<<<<<<<<< + * head = gs.heads[i] + * if head != i: +*/ + __pyx_t_17 = __Pyx_PyLong_As_int(__pyx_v_i); if (unlikely((__pyx_t_17 == (int)-1) && PyErr_Occurred())) __PYX_ERR(0, 148, __pyx_L1_error) + __pyx_t_2 = (!(__pyx_f_5spacy_8pipeline_17_parser_internals_9arc_eager_is_head_unknown((&__pyx_v_gs), __pyx_t_17) != 0)); + if (__pyx_t_2) { + + /* "spacy/pipeline/_parser_internals/arc_eager.pyx":149 + * for i in range(gs.length): + * if not is_head_unknown(&gs, i): + * head = gs.heads[i] # <<<<<<<<<<<<<< + * if head != i: + * gs.kids[head][js[head]] = i +*/ + __pyx_t_1 = __Pyx_PyIndex_AsSsize_t(__pyx_v_i); if (unlikely((__pyx_t_1 == (Py_ssize_t)-1) && PyErr_Occurred())) __PYX_ERR(0, 149, __pyx_L1_error) + __pyx_t_5 = __Pyx_PyLong_From_int32_t((__pyx_v_gs.heads[__pyx_t_1])); if (unlikely(!__pyx_t_5)) __PYX_ERR(0, 149, __pyx_L1_error) + __Pyx_GOTREF(__pyx_t_5); + __Pyx_XDECREF_SET(__pyx_v_head, __pyx_t_5); + __pyx_t_5 = 0; + + /* "spacy/pipeline/_parser_internals/arc_eager.pyx":150 + * if not is_head_unknown(&gs, i): + * head = gs.heads[i] + * if head != i: # <<<<<<<<<<<<<< + * gs.kids[head][js[head]] = i + * js[head] += 1 +*/ + __pyx_t_5 = PyObject_RichCompare(__pyx_v_head, __pyx_v_i, Py_NE); __Pyx_XGOTREF(__pyx_t_5); if (unlikely(!__pyx_t_5)) __PYX_ERR(0, 150, __pyx_L1_error) + __pyx_t_2 = __Pyx_PyObject_IsTrue(__pyx_t_5); if (unlikely((__pyx_t_2 < 0))) __PYX_ERR(0, 150, __pyx_L1_error) + __Pyx_DECREF(__pyx_t_5); __pyx_t_5 = 0; + if (__pyx_t_2) { + + /* "spacy/pipeline/_parser_internals/arc_eager.pyx":151 + * head = gs.heads[i] + * if head != i: + * gs.kids[head][js[head]] = i # <<<<<<<<<<<<<< + * js[head] += 1 + * gs.push_cost = push_cost(state, &gs) +*/ + __pyx_t_15 = __Pyx_PyLong_As_int32_t(__pyx_v_i); if (unlikely((__pyx_t_15 == ((int32_t)-1)) && PyErr_Occurred())) __PYX_ERR(0, 151, __pyx_L1_error) + __pyx_t_1 = __Pyx_PyIndex_AsSsize_t(__pyx_v_head); if (unlikely((__pyx_t_1 == (Py_ssize_t)-1) && PyErr_Occurred())) __PYX_ERR(0, 151, __pyx_L1_error) + __pyx_t_8 = __Pyx_PyIndex_AsSsize_t(__pyx_v_head); if (unlikely((__pyx_t_8 == (Py_ssize_t)-1) && PyErr_Occurred())) __PYX_ERR(0, 151, __pyx_L1_error) + ((__pyx_v_gs.kids[__pyx_t_1])[(__pyx_v_js[__pyx_t_8])]) = __pyx_t_15; + + /* "spacy/pipeline/_parser_internals/arc_eager.pyx":152 + * if head != i: + * gs.kids[head][js[head]] = i + * js[head] += 1 # <<<<<<<<<<<<<< + * gs.push_cost = push_cost(state, &gs) + * gs.pop_cost = pop_cost(state, &gs) +*/ + __pyx_t_8 = __Pyx_PyIndex_AsSsize_t(__pyx_v_head); if (unlikely((__pyx_t_8 == (Py_ssize_t)-1) && PyErr_Occurred())) __PYX_ERR(0, 152, __pyx_L1_error) + (__pyx_v_js[__pyx_t_8]) = ((__pyx_v_js[__pyx_t_8]) + 1); + + /* "spacy/pipeline/_parser_internals/arc_eager.pyx":150 + * if not is_head_unknown(&gs, i): + * head = gs.heads[i] + * if head != i: # <<<<<<<<<<<<<< + * gs.kids[head][js[head]] = i + * js[head] += 1 +*/ + } + + /* "spacy/pipeline/_parser_internals/arc_eager.pyx":148 + * js = js_addr.ptr + * for i in range(gs.length): + * if not is_head_unknown(&gs, i): # <<<<<<<<<<<<<< + * head = gs.heads[i] + * if head != i: +*/ + } + + /* "spacy/pipeline/_parser_internals/arc_eager.pyx":147 + * js_addr = Address(gs.length, sizeof(int32_t)) + * js = js_addr.ptr + * for i in range(gs.length): # <<<<<<<<<<<<<< + * if not is_head_unknown(&gs, i): + * head = gs.heads[i] +*/ + } + __Pyx_DECREF(__pyx_t_7); __pyx_t_7 = 0; + + /* "spacy/pipeline/_parser_internals/arc_eager.pyx":153 + * gs.kids[head][js[head]] = i + * js[head] += 1 + * gs.push_cost = push_cost(state, &gs) # <<<<<<<<<<<<<< + * gs.pop_cost = pop_cost(state, &gs) + * return gs +*/ + __pyx_v_gs.push_cost = __pyx_f_5spacy_8pipeline_17_parser_internals_9arc_eager_push_cost(__pyx_v_state, (&__pyx_v_gs)); + + /* "spacy/pipeline/_parser_internals/arc_eager.pyx":154 + * js[head] += 1 + * gs.push_cost = push_cost(state, &gs) + * gs.pop_cost = pop_cost(state, &gs) # <<<<<<<<<<<<<< + * return gs + * +*/ + __pyx_v_gs.pop_cost = __pyx_f_5spacy_8pipeline_17_parser_internals_9arc_eager_pop_cost(__pyx_v_state, (&__pyx_v_gs)); + + /* "spacy/pipeline/_parser_internals/arc_eager.pyx":155 + * gs.push_cost = push_cost(state, &gs) + * gs.pop_cost = pop_cost(state, &gs) + * return gs # <<<<<<<<<<<<<< + * + * +*/ + __pyx_r = __pyx_v_gs; + goto __pyx_L0; + + /* "spacy/pipeline/_parser_internals/arc_eager.pyx":71 + * + * + * cdef GoldParseStateC create_gold_state( # <<<<<<<<<<<<<< + * Pool mem, const StateC* state, heads, labels, sent_starts + * ) except *: +*/ + + /* function exit code */ + __pyx_L1_error:; + __Pyx_XDECREF(__pyx_t_4); + __Pyx_XDECREF(__pyx_t_5); + __Pyx_XDECREF(__pyx_t_7); + __Pyx_XDECREF(__pyx_t_11); + __Pyx_XDECREF(__pyx_t_12); + __Pyx_XDECREF(__pyx_t_13); + __Pyx_AddTraceback("spacy.pipeline._parser_internals.arc_eager.create_gold_state", __pyx_clineno, __pyx_lineno, __pyx_filename); + __Pyx_pretend_to_initialize(&__pyx_r); + __pyx_L0:; + __Pyx_XDECREF(__pyx_v_i); + __Pyx_XDECREF(__pyx_v_is_sent_start); + __Pyx_XDECREF(__pyx_v_head); + __Pyx_XDECREF(__pyx_v_label); + __Pyx_XDECREF((PyObject *)__pyx_v_js_addr); + __Pyx_RefNannyFinishContext(); + return __pyx_r; +} + +/* "spacy/pipeline/_parser_internals/arc_eager.pyx":158 + * + * + * cdef void update_gold_state(GoldParseStateC* gs, const StateC* s) noexcept nogil: # <<<<<<<<<<<<<< + * for i in range(gs.length): + * gs.state_bits[i] = set_state_flag( +*/ + +static void __pyx_f_5spacy_8pipeline_17_parser_internals_9arc_eager_update_gold_state(struct __pyx_t_5spacy_8pipeline_17_parser_internals_9arc_eager_GoldParseStateC *__pyx_v_gs, __pyx_t_5spacy_8pipeline_17_parser_internals_6_state_StateC const *__pyx_v_s) { + int32_t __pyx_v_i; + int __pyx_v_s_i; + int32_t __pyx_v_kid; + int __pyx_v_b_i; + int32_t __pyx_t_1; + int32_t __pyx_t_2; + int32_t __pyx_t_3; + int __pyx_t_4; + int __pyx_t_5; + int __pyx_t_6; + int __pyx_t_7; + int32_t *__pyx_t_8; + int32_t *__pyx_t_9; + int32_t *__pyx_t_10; + + /* "spacy/pipeline/_parser_internals/arc_eager.pyx":159 + * + * cdef void update_gold_state(GoldParseStateC* gs, const StateC* s) noexcept nogil: + * for i in range(gs.length): # <<<<<<<<<<<<<< + * gs.state_bits[i] = set_state_flag( + * gs.state_bits[i], +*/ + __pyx_t_1 = __pyx_v_gs->length; + __pyx_t_2 = __pyx_t_1; + for (__pyx_t_3 = 0; __pyx_t_3 < __pyx_t_2; __pyx_t_3+=1) { + __pyx_v_i = __pyx_t_3; + + /* "spacy/pipeline/_parser_internals/arc_eager.pyx":160 + * cdef void update_gold_state(GoldParseStateC* gs, const StateC* s) noexcept nogil: + * for i in range(gs.length): + * gs.state_bits[i] = set_state_flag( # <<<<<<<<<<<<<< + * gs.state_bits[i], + * HEAD_IN_BUFFER, +*/ + (__pyx_v_gs->state_bits[__pyx_v_i]) = __pyx_f_5spacy_8pipeline_17_parser_internals_9arc_eager_set_state_flag((__pyx_v_gs->state_bits[__pyx_v_i]), __pyx_e_5spacy_8pipeline_17_parser_internals_9arc_eager_HEAD_IN_BUFFER, 0); + + /* "spacy/pipeline/_parser_internals/arc_eager.pyx":165 + * 0 + * ) + * gs.state_bits[i] = set_state_flag( # <<<<<<<<<<<<<< + * gs.state_bits[i], + * HEAD_IN_STACK, +*/ + (__pyx_v_gs->state_bits[__pyx_v_i]) = __pyx_f_5spacy_8pipeline_17_parser_internals_9arc_eager_set_state_flag((__pyx_v_gs->state_bits[__pyx_v_i]), __pyx_e_5spacy_8pipeline_17_parser_internals_9arc_eager_HEAD_IN_STACK, 0); + + /* "spacy/pipeline/_parser_internals/arc_eager.pyx":170 + * 0 + * ) + * gs.n_kids_in_stack[i] = 0 # <<<<<<<<<<<<<< + * gs.n_kids_in_buffer[i] = 0 + * +*/ + (__pyx_v_gs->n_kids_in_stack[__pyx_v_i]) = 0; + + /* "spacy/pipeline/_parser_internals/arc_eager.pyx":171 + * ) + * gs.n_kids_in_stack[i] = 0 + * gs.n_kids_in_buffer[i] = 0 # <<<<<<<<<<<<<< + * + * for i in range(s.stack_depth()): +*/ + (__pyx_v_gs->n_kids_in_buffer[__pyx_v_i]) = 0; + } + + /* "spacy/pipeline/_parser_internals/arc_eager.pyx":173 + * gs.n_kids_in_buffer[i] = 0 + * + * for i in range(s.stack_depth()): # <<<<<<<<<<<<<< + * s_i = s.S(i) + * if not is_head_unknown(gs, s_i) and gs.heads[s_i] != s_i: +*/ + __pyx_t_4 = __pyx_v_s->stack_depth(); + __pyx_t_5 = __pyx_t_4; + for (__pyx_t_1 = 0; __pyx_t_1 < __pyx_t_5; __pyx_t_1+=1) { + __pyx_v_i = __pyx_t_1; + + /* "spacy/pipeline/_parser_internals/arc_eager.pyx":174 + * + * for i in range(s.stack_depth()): + * s_i = s.S(i) # <<<<<<<<<<<<<< + * if not is_head_unknown(gs, s_i) and gs.heads[s_i] != s_i: + * gs.n_kids_in_stack[gs.heads[s_i]] += 1 +*/ + __pyx_v_s_i = __pyx_v_s->S(__pyx_v_i); + + /* "spacy/pipeline/_parser_internals/arc_eager.pyx":175 + * for i in range(s.stack_depth()): + * s_i = s.S(i) + * if not is_head_unknown(gs, s_i) and gs.heads[s_i] != s_i: # <<<<<<<<<<<<<< + * gs.n_kids_in_stack[gs.heads[s_i]] += 1 + * for kid in gs.kids[s_i][:gs.n_kids[s_i]]: +*/ + __pyx_t_7 = (!(__pyx_f_5spacy_8pipeline_17_parser_internals_9arc_eager_is_head_unknown(__pyx_v_gs, __pyx_v_s_i) != 0)); + if (__pyx_t_7) { + } else { + __pyx_t_6 = __pyx_t_7; + goto __pyx_L8_bool_binop_done; + } + __pyx_t_7 = ((__pyx_v_gs->heads[__pyx_v_s_i]) != __pyx_v_s_i); + __pyx_t_6 = __pyx_t_7; + __pyx_L8_bool_binop_done:; + if (__pyx_t_6) { + + /* "spacy/pipeline/_parser_internals/arc_eager.pyx":176 + * s_i = s.S(i) + * if not is_head_unknown(gs, s_i) and gs.heads[s_i] != s_i: + * gs.n_kids_in_stack[gs.heads[s_i]] += 1 # <<<<<<<<<<<<<< + * for kid in gs.kids[s_i][:gs.n_kids[s_i]]: + * gs.state_bits[kid] = set_state_flag( +*/ + __pyx_t_2 = (__pyx_v_gs->heads[__pyx_v_s_i]); + (__pyx_v_gs->n_kids_in_stack[__pyx_t_2]) = ((__pyx_v_gs->n_kids_in_stack[__pyx_t_2]) + 1); + + /* "spacy/pipeline/_parser_internals/arc_eager.pyx":175 + * for i in range(s.stack_depth()): + * s_i = s.S(i) + * if not is_head_unknown(gs, s_i) and gs.heads[s_i] != s_i: # <<<<<<<<<<<<<< + * gs.n_kids_in_stack[gs.heads[s_i]] += 1 + * for kid in gs.kids[s_i][:gs.n_kids[s_i]]: +*/ + } + + /* "spacy/pipeline/_parser_internals/arc_eager.pyx":177 + * if not is_head_unknown(gs, s_i) and gs.heads[s_i] != s_i: + * gs.n_kids_in_stack[gs.heads[s_i]] += 1 + * for kid in gs.kids[s_i][:gs.n_kids[s_i]]: # <<<<<<<<<<<<<< + * gs.state_bits[kid] = set_state_flag( + * gs.state_bits[kid], +*/ + __pyx_t_9 = ((__pyx_v_gs->kids[__pyx_v_s_i]) + (__pyx_v_gs->n_kids[__pyx_v_s_i])); + for (__pyx_t_10 = (__pyx_v_gs->kids[__pyx_v_s_i]); __pyx_t_10 < __pyx_t_9; __pyx_t_10++) { + __pyx_t_8 = __pyx_t_10; + __pyx_v_kid = (__pyx_t_8[0]); + + /* "spacy/pipeline/_parser_internals/arc_eager.pyx":178 + * gs.n_kids_in_stack[gs.heads[s_i]] += 1 + * for kid in gs.kids[s_i][:gs.n_kids[s_i]]: + * gs.state_bits[kid] = set_state_flag( # <<<<<<<<<<<<<< + * gs.state_bits[kid], + * HEAD_IN_STACK, +*/ + (__pyx_v_gs->state_bits[__pyx_v_kid]) = __pyx_f_5spacy_8pipeline_17_parser_internals_9arc_eager_set_state_flag((__pyx_v_gs->state_bits[__pyx_v_kid]), __pyx_e_5spacy_8pipeline_17_parser_internals_9arc_eager_HEAD_IN_STACK, 1); + } + } + + /* "spacy/pipeline/_parser_internals/arc_eager.pyx":183 + * 1 + * ) + * for i in range(s.buffer_length()): # <<<<<<<<<<<<<< + * b_i = s.B(i) + * if s.is_sent_start(b_i): +*/ + __pyx_t_4 = __pyx_v_s->buffer_length(); + __pyx_t_5 = __pyx_t_4; + for (__pyx_t_1 = 0; __pyx_t_1 < __pyx_t_5; __pyx_t_1+=1) { + __pyx_v_i = __pyx_t_1; + + /* "spacy/pipeline/_parser_internals/arc_eager.pyx":184 + * ) + * for i in range(s.buffer_length()): + * b_i = s.B(i) # <<<<<<<<<<<<<< + * if s.is_sent_start(b_i): + * break +*/ + __pyx_v_b_i = __pyx_v_s->B(__pyx_v_i); + + /* "spacy/pipeline/_parser_internals/arc_eager.pyx":185 + * for i in range(s.buffer_length()): + * b_i = s.B(i) + * if s.is_sent_start(b_i): # <<<<<<<<<<<<<< + * break + * if not is_head_unknown(gs, b_i) and gs.heads[b_i] != b_i: +*/ + __pyx_t_6 = (__pyx_v_s->is_sent_start(__pyx_v_b_i) != 0); + if (__pyx_t_6) { + + /* "spacy/pipeline/_parser_internals/arc_eager.pyx":186 + * b_i = s.B(i) + * if s.is_sent_start(b_i): + * break # <<<<<<<<<<<<<< + * if not is_head_unknown(gs, b_i) and gs.heads[b_i] != b_i: + * gs.n_kids_in_buffer[gs.heads[b_i]] += 1 +*/ + goto __pyx_L13_break; + + /* "spacy/pipeline/_parser_internals/arc_eager.pyx":185 + * for i in range(s.buffer_length()): + * b_i = s.B(i) + * if s.is_sent_start(b_i): # <<<<<<<<<<<<<< + * break + * if not is_head_unknown(gs, b_i) and gs.heads[b_i] != b_i: +*/ + } + + /* "spacy/pipeline/_parser_internals/arc_eager.pyx":187 + * if s.is_sent_start(b_i): + * break + * if not is_head_unknown(gs, b_i) and gs.heads[b_i] != b_i: # <<<<<<<<<<<<<< + * gs.n_kids_in_buffer[gs.heads[b_i]] += 1 + * for kid in gs.kids[b_i][:gs.n_kids[b_i]]: +*/ + __pyx_t_7 = (!(__pyx_f_5spacy_8pipeline_17_parser_internals_9arc_eager_is_head_unknown(__pyx_v_gs, __pyx_v_b_i) != 0)); + if (__pyx_t_7) { + } else { + __pyx_t_6 = __pyx_t_7; + goto __pyx_L16_bool_binop_done; + } + __pyx_t_7 = ((__pyx_v_gs->heads[__pyx_v_b_i]) != __pyx_v_b_i); + __pyx_t_6 = __pyx_t_7; + __pyx_L16_bool_binop_done:; + if (__pyx_t_6) { + + /* "spacy/pipeline/_parser_internals/arc_eager.pyx":188 + * break + * if not is_head_unknown(gs, b_i) and gs.heads[b_i] != b_i: + * gs.n_kids_in_buffer[gs.heads[b_i]] += 1 # <<<<<<<<<<<<<< + * for kid in gs.kids[b_i][:gs.n_kids[b_i]]: + * gs.state_bits[kid] = set_state_flag( +*/ + __pyx_t_2 = (__pyx_v_gs->heads[__pyx_v_b_i]); + (__pyx_v_gs->n_kids_in_buffer[__pyx_t_2]) = ((__pyx_v_gs->n_kids_in_buffer[__pyx_t_2]) + 1); + + /* "spacy/pipeline/_parser_internals/arc_eager.pyx":187 + * if s.is_sent_start(b_i): + * break + * if not is_head_unknown(gs, b_i) and gs.heads[b_i] != b_i: # <<<<<<<<<<<<<< + * gs.n_kids_in_buffer[gs.heads[b_i]] += 1 + * for kid in gs.kids[b_i][:gs.n_kids[b_i]]: +*/ + } + + /* "spacy/pipeline/_parser_internals/arc_eager.pyx":189 + * if not is_head_unknown(gs, b_i) and gs.heads[b_i] != b_i: + * gs.n_kids_in_buffer[gs.heads[b_i]] += 1 + * for kid in gs.kids[b_i][:gs.n_kids[b_i]]: # <<<<<<<<<<<<<< + * gs.state_bits[kid] = set_state_flag( + * gs.state_bits[kid], +*/ + __pyx_t_9 = ((__pyx_v_gs->kids[__pyx_v_b_i]) + (__pyx_v_gs->n_kids[__pyx_v_b_i])); + for (__pyx_t_10 = (__pyx_v_gs->kids[__pyx_v_b_i]); __pyx_t_10 < __pyx_t_9; __pyx_t_10++) { + __pyx_t_8 = __pyx_t_10; + __pyx_v_kid = (__pyx_t_8[0]); + + /* "spacy/pipeline/_parser_internals/arc_eager.pyx":190 + * gs.n_kids_in_buffer[gs.heads[b_i]] += 1 + * for kid in gs.kids[b_i][:gs.n_kids[b_i]]: + * gs.state_bits[kid] = set_state_flag( # <<<<<<<<<<<<<< + * gs.state_bits[kid], + * HEAD_IN_BUFFER, +*/ + (__pyx_v_gs->state_bits[__pyx_v_kid]) = __pyx_f_5spacy_8pipeline_17_parser_internals_9arc_eager_set_state_flag((__pyx_v_gs->state_bits[__pyx_v_kid]), __pyx_e_5spacy_8pipeline_17_parser_internals_9arc_eager_HEAD_IN_BUFFER, 1); + } + } + __pyx_L13_break:; + + /* "spacy/pipeline/_parser_internals/arc_eager.pyx":195 + * 1 + * ) + * gs.push_cost = push_cost(s, gs) # <<<<<<<<<<<<<< + * gs.pop_cost = pop_cost(s, gs) + * +*/ + __pyx_v_gs->push_cost = __pyx_f_5spacy_8pipeline_17_parser_internals_9arc_eager_push_cost(__pyx_v_s, __pyx_v_gs); + + /* "spacy/pipeline/_parser_internals/arc_eager.pyx":196 + * ) + * gs.push_cost = push_cost(s, gs) + * gs.pop_cost = pop_cost(s, gs) # <<<<<<<<<<<<<< + * + * +*/ + __pyx_v_gs->pop_cost = __pyx_f_5spacy_8pipeline_17_parser_internals_9arc_eager_pop_cost(__pyx_v_s, __pyx_v_gs); + + /* "spacy/pipeline/_parser_internals/arc_eager.pyx":158 + * + * + * cdef void update_gold_state(GoldParseStateC* gs, const StateC* s) noexcept nogil: # <<<<<<<<<<<<<< + * for i in range(gs.length): + * gs.state_bits[i] = set_state_flag( +*/ + + /* function exit code */ +} + +/* "spacy/pipeline/_parser_internals/arc_eager.pyx":203 + * cdef Pool mem + * + * def __init__(self, ArcEager moves, StateClass stcls, Example example): # <<<<<<<<<<<<<< + * self.mem = Pool() + * heads, labels = example.get_aligned_parse(projectivize=True) +*/ + +/* Python wrapper */ +static int __pyx_pw_5spacy_8pipeline_17_parser_internals_9arc_eager_12ArcEagerGold_1__init__(PyObject *__pyx_v_self, PyObject *__pyx_args, PyObject *__pyx_kwds); /*proto*/ +static int __pyx_pw_5spacy_8pipeline_17_parser_internals_9arc_eager_12ArcEagerGold_1__init__(PyObject *__pyx_v_self, PyObject *__pyx_args, PyObject *__pyx_kwds) { + CYTHON_UNUSED struct __pyx_obj_5spacy_8pipeline_17_parser_internals_9arc_eager_ArcEager *__pyx_v_moves = 0; + struct __pyx_obj_5spacy_8pipeline_17_parser_internals_10stateclass_StateClass *__pyx_v_stcls = 0; + struct __pyx_obj_5spacy_8training_7example_Example *__pyx_v_example = 0; + CYTHON_UNUSED Py_ssize_t __pyx_nargs; + 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; + 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_moves,&__pyx_mstate_global->__pyx_n_u_stcls,&__pyx_mstate_global->__pyx_n_u_example,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, 203, __pyx_L3_error) + if (__pyx_kwds_len > 0) { + switch (__pyx_nargs) { + case 3: + values[2] = __Pyx_ArgRef_VARARGS(__pyx_args, 2); + if (!CYTHON_ASSUME_SAFE_MACROS && unlikely(!values[2])) __PYX_ERR(0, 203, __pyx_L3_error) + CYTHON_FALLTHROUGH; + case 2: + values[1] = __Pyx_ArgRef_VARARGS(__pyx_args, 1); + if (!CYTHON_ASSUME_SAFE_MACROS && unlikely(!values[1])) __PYX_ERR(0, 203, __pyx_L3_error) + CYTHON_FALLTHROUGH; + case 1: + values[0] = __Pyx_ArgRef_VARARGS(__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, "__init__", 0) < (0)) __PYX_ERR(0, 203, __pyx_L3_error) + for (Py_ssize_t i = __pyx_nargs; i < 3; i++) { + if (unlikely(!values[i])) { __Pyx_RaiseArgtupleInvalid("__init__", 1, 3, 3, i); __PYX_ERR(0, 203, __pyx_L3_error) } + } + } else if (unlikely(__pyx_nargs != 3)) { + 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, 203, __pyx_L3_error) + values[1] = __Pyx_ArgRef_VARARGS(__pyx_args, 1); + if (!CYTHON_ASSUME_SAFE_MACROS && unlikely(!values[1])) __PYX_ERR(0, 203, __pyx_L3_error) + values[2] = __Pyx_ArgRef_VARARGS(__pyx_args, 2); + if (!CYTHON_ASSUME_SAFE_MACROS && unlikely(!values[2])) __PYX_ERR(0, 203, __pyx_L3_error) + } + __pyx_v_moves = ((struct __pyx_obj_5spacy_8pipeline_17_parser_internals_9arc_eager_ArcEager *)values[0]); + __pyx_v_stcls = ((struct __pyx_obj_5spacy_8pipeline_17_parser_internals_10stateclass_StateClass *)values[1]); + __pyx_v_example = ((struct __pyx_obj_5spacy_8training_7example_Example *)values[2]); + } + goto __pyx_L6_skip; + __pyx_L5_argtuple_error:; + __Pyx_RaiseArgtupleInvalid("__init__", 1, 3, 3, __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("spacy.pipeline._parser_internals.arc_eager.ArcEagerGold.__init__", __pyx_clineno, __pyx_lineno, __pyx_filename); + __Pyx_RefNannyFinishContext(); + return -1; + __pyx_L4_argument_unpacking_done:; + if (unlikely(!__Pyx_ArgTypeTest(((PyObject *)__pyx_v_moves), __pyx_mstate_global->__pyx_ptype_5spacy_8pipeline_17_parser_internals_9arc_eager_ArcEager, 1, "moves", 0))) __PYX_ERR(0, 203, __pyx_L1_error) + if (unlikely(!__Pyx_ArgTypeTest(((PyObject *)__pyx_v_stcls), __pyx_mstate_global->__pyx_ptype_5spacy_8pipeline_17_parser_internals_10stateclass_StateClass, 1, "stcls", 0))) __PYX_ERR(0, 203, __pyx_L1_error) + if (unlikely(!__Pyx_ArgTypeTest(((PyObject *)__pyx_v_example), __pyx_mstate_global->__pyx_ptype_5spacy_8training_7example_Example, 1, "example", 0))) __PYX_ERR(0, 203, __pyx_L1_error) + __pyx_r = __pyx_pf_5spacy_8pipeline_17_parser_internals_9arc_eager_12ArcEagerGold___init__(((struct __pyx_obj_5spacy_8pipeline_17_parser_internals_9arc_eager_ArcEagerGold *)__pyx_v_self), __pyx_v_moves, __pyx_v_stcls, __pyx_v_example); + + /* 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_5spacy_8pipeline_17_parser_internals_9arc_eager_12ArcEagerGold___init__(struct __pyx_obj_5spacy_8pipeline_17_parser_internals_9arc_eager_ArcEagerGold *__pyx_v_self, CYTHON_UNUSED struct __pyx_obj_5spacy_8pipeline_17_parser_internals_9arc_eager_ArcEager *__pyx_v_moves, struct __pyx_obj_5spacy_8pipeline_17_parser_internals_10stateclass_StateClass *__pyx_v_stcls, struct __pyx_obj_5spacy_8training_7example_Example *__pyx_v_example) { + PyObject *__pyx_v_heads = NULL; + PyObject *__pyx_v_labels = NULL; + PyObject *__pyx_v_sent_starts = NULL; + PyObject *__pyx_v_label = NULL; + int __pyx_r; + __Pyx_RefNannyDeclarations + PyObject *__pyx_t_1 = NULL; + PyObject *__pyx_t_2 = NULL; + size_t __pyx_t_3; + PyObject *__pyx_t_4 = NULL; + PyObject *__pyx_t_5 = NULL; + PyObject *(*__pyx_t_6)(PyObject *); + Py_ssize_t __pyx_t_7; + PyObject *(*__pyx_t_8)(PyObject *); + int __pyx_t_9; + PyObject *__pyx_t_10 = NULL; + PyObject *__pyx_t_11 = NULL; + Py_ssize_t __pyx_t_12; + Py_ssize_t __pyx_t_13; + struct __pyx_t_5spacy_8pipeline_17_parser_internals_9arc_eager_GoldParseStateC __pyx_t_14; + int __pyx_lineno = 0; + const char *__pyx_filename = NULL; + int __pyx_clineno = 0; + __Pyx_RefNannySetupContext("__init__", 0); + + /* "spacy/pipeline/_parser_internals/arc_eager.pyx":204 + * + * def __init__(self, ArcEager moves, StateClass stcls, Example example): + * self.mem = Pool() # <<<<<<<<<<<<<< + * heads, labels = example.get_aligned_parse(projectivize=True) + * labels = [example.x.vocab.strings.add(label, allow_transient=False) if label is not None else MISSING_DEP for label in labels] +*/ + __pyx_t_2 = NULL; + __pyx_t_3 = 1; + { + PyObject *__pyx_callargs[2] = {__pyx_t_2, NULL}; + __pyx_t_1 = __Pyx_PyObject_FastCall((PyObject*)__pyx_mstate_global->__pyx_ptype_5cymem_5cymem_Pool, __pyx_callargs+__pyx_t_3, (1-__pyx_t_3) | (__pyx_t_3*__Pyx_PY_VECTORCALL_ARGUMENTS_OFFSET)); + __Pyx_XDECREF(__pyx_t_2); __pyx_t_2 = 0; + if (unlikely(!__pyx_t_1)) __PYX_ERR(0, 204, __pyx_L1_error) + __Pyx_GOTREF((PyObject *)__pyx_t_1); + } + __Pyx_GIVEREF((PyObject *)__pyx_t_1); + __Pyx_GOTREF((PyObject *)__pyx_v_self->mem); + __Pyx_DECREF((PyObject *)__pyx_v_self->mem); + __pyx_v_self->mem = ((struct __pyx_obj_5cymem_5cymem_Pool *)__pyx_t_1); + __pyx_t_1 = 0; + + /* "spacy/pipeline/_parser_internals/arc_eager.pyx":205 + * def __init__(self, ArcEager moves, StateClass stcls, Example example): + * self.mem = Pool() + * heads, labels = example.get_aligned_parse(projectivize=True) # <<<<<<<<<<<<<< + * labels = [example.x.vocab.strings.add(label, allow_transient=False) if label is not None else MISSING_DEP for label in labels] + * sent_starts = _get_aligned_sent_starts(example) +*/ + __pyx_t_2 = ((PyObject *)__pyx_v_example); + __Pyx_INCREF(__pyx_t_2); + __pyx_t_3 = 0; + { + PyObject *__pyx_callargs[2 + ((CYTHON_VECTORCALL) ? 1 : 0)] = {__pyx_t_2, NULL}; + __pyx_t_4 = __Pyx_MakeVectorcallBuilderKwds(1); if (unlikely(!__pyx_t_4)) __PYX_ERR(0, 205, __pyx_L1_error) + __Pyx_GOTREF(__pyx_t_4); + if (__Pyx_VectorcallBuilder_AddArg(__pyx_mstate_global->__pyx_n_u_projectivize, Py_True, __pyx_t_4, __pyx_callargs+1, 0) < (0)) __PYX_ERR(0, 205, __pyx_L1_error) + __pyx_t_1 = __Pyx_Object_VectorcallMethod_CallFromBuilder((PyObject*)__pyx_mstate_global->__pyx_n_u_get_aligned_parse, __pyx_callargs+__pyx_t_3, (1-__pyx_t_3) | (1*__Pyx_PY_VECTORCALL_ARGUMENTS_OFFSET), __pyx_t_4); + __Pyx_XDECREF(__pyx_t_2); __pyx_t_2 = 0; + __Pyx_DECREF(__pyx_t_4); __pyx_t_4 = 0; + if (unlikely(!__pyx_t_1)) __PYX_ERR(0, 205, __pyx_L1_error) + __Pyx_GOTREF(__pyx_t_1); + } + if ((likely(PyTuple_CheckExact(__pyx_t_1))) || (PyList_CheckExact(__pyx_t_1))) { + PyObject* sequence = __pyx_t_1; + 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, 205, __pyx_L1_error) + } + #if CYTHON_ASSUME_SAFE_MACROS && !CYTHON_AVOID_BORROWED_REFS + if (likely(PyTuple_CheckExact(sequence))) { + __pyx_t_4 = PyTuple_GET_ITEM(sequence, 0); + __Pyx_INCREF(__pyx_t_4); + __pyx_t_2 = PyTuple_GET_ITEM(sequence, 1); + __Pyx_INCREF(__pyx_t_2); + } else { + __pyx_t_4 = __Pyx_PyList_GetItemRefFast(sequence, 0, __Pyx_ReferenceSharing_SharedReference); + if (unlikely(!__pyx_t_4)) __PYX_ERR(0, 205, __pyx_L1_error) + __Pyx_XGOTREF(__pyx_t_4); + __pyx_t_2 = __Pyx_PyList_GetItemRefFast(sequence, 1, __Pyx_ReferenceSharing_SharedReference); + if (unlikely(!__pyx_t_2)) __PYX_ERR(0, 205, __pyx_L1_error) + __Pyx_XGOTREF(__pyx_t_2); + } + #else + __pyx_t_4 = __Pyx_PySequence_ITEM(sequence, 0); if (unlikely(!__pyx_t_4)) __PYX_ERR(0, 205, __pyx_L1_error) + __Pyx_GOTREF(__pyx_t_4); + __pyx_t_2 = __Pyx_PySequence_ITEM(sequence, 1); if (unlikely(!__pyx_t_2)) __PYX_ERR(0, 205, __pyx_L1_error) + __Pyx_GOTREF(__pyx_t_2); + #endif + __Pyx_DECREF(__pyx_t_1); __pyx_t_1 = 0; + } else { + Py_ssize_t index = -1; + __pyx_t_5 = PyObject_GetIter(__pyx_t_1); if (unlikely(!__pyx_t_5)) __PYX_ERR(0, 205, __pyx_L1_error) + __Pyx_GOTREF(__pyx_t_5); + __Pyx_DECREF(__pyx_t_1); __pyx_t_1 = 0; + __pyx_t_6 = (CYTHON_COMPILING_IN_LIMITED_API) ? PyIter_Next : __Pyx_PyObject_GetIterNextFunc(__pyx_t_5); + index = 0; __pyx_t_4 = __pyx_t_6(__pyx_t_5); if (unlikely(!__pyx_t_4)) goto __pyx_L3_unpacking_failed; + __Pyx_GOTREF(__pyx_t_4); + index = 1; __pyx_t_2 = __pyx_t_6(__pyx_t_5); if (unlikely(!__pyx_t_2)) goto __pyx_L3_unpacking_failed; + __Pyx_GOTREF(__pyx_t_2); + if (__Pyx_IternextUnpackEndCheck(__pyx_t_6(__pyx_t_5), 2) < (0)) __PYX_ERR(0, 205, __pyx_L1_error) + __pyx_t_6 = NULL; + __Pyx_DECREF(__pyx_t_5); __pyx_t_5 = 0; + goto __pyx_L4_unpacking_done; + __pyx_L3_unpacking_failed:; + __Pyx_DECREF(__pyx_t_5); __pyx_t_5 = 0; + __pyx_t_6 = NULL; + if (__Pyx_IterFinish() == 0) __Pyx_RaiseNeedMoreValuesError(index); + __PYX_ERR(0, 205, __pyx_L1_error) + __pyx_L4_unpacking_done:; + } + __pyx_v_heads = __pyx_t_4; + __pyx_t_4 = 0; + __pyx_v_labels = __pyx_t_2; + __pyx_t_2 = 0; + + /* "spacy/pipeline/_parser_internals/arc_eager.pyx":206 + * self.mem = Pool() + * heads, labels = example.get_aligned_parse(projectivize=True) + * labels = [example.x.vocab.strings.add(label, allow_transient=False) if label is not None else MISSING_DEP for label in labels] # <<<<<<<<<<<<<< + * sent_starts = _get_aligned_sent_starts(example) + * assert len(heads) == len(labels) == len(sent_starts), (len(heads), len(labels), len(sent_starts)) +*/ + __pyx_t_1 = PyList_New(0); if (unlikely(!__pyx_t_1)) __PYX_ERR(0, 206, __pyx_L1_error) + __Pyx_GOTREF(__pyx_t_1); + if (likely(PyList_CheckExact(__pyx_v_labels)) || PyTuple_CheckExact(__pyx_v_labels)) { + __pyx_t_2 = __pyx_v_labels; __Pyx_INCREF(__pyx_t_2); + __pyx_t_7 = 0; + __pyx_t_8 = NULL; + } else { + __pyx_t_7 = -1; __pyx_t_2 = PyObject_GetIter(__pyx_v_labels); if (unlikely(!__pyx_t_2)) __PYX_ERR(0, 206, __pyx_L1_error) + __Pyx_GOTREF(__pyx_t_2); + __pyx_t_8 = (CYTHON_COMPILING_IN_LIMITED_API) ? PyIter_Next : __Pyx_PyObject_GetIterNextFunc(__pyx_t_2); if (unlikely(!__pyx_t_8)) __PYX_ERR(0, 206, __pyx_L1_error) + } + for (;;) { + if (likely(!__pyx_t_8)) { + if (likely(PyList_CheckExact(__pyx_t_2))) { + { + Py_ssize_t __pyx_temp = __Pyx_PyList_GET_SIZE(__pyx_t_2); + #if !CYTHON_ASSUME_SAFE_SIZE + if (unlikely((__pyx_temp < 0))) __PYX_ERR(0, 206, __pyx_L1_error) + #endif + if (__pyx_t_7 >= __pyx_temp) break; + } + __pyx_t_4 = __Pyx_PyList_GetItemRefFast(__pyx_t_2, __pyx_t_7, __Pyx_ReferenceSharing_OwnStrongReference); + ++__pyx_t_7; + } else { + { + Py_ssize_t __pyx_temp = __Pyx_PyTuple_GET_SIZE(__pyx_t_2); + #if !CYTHON_ASSUME_SAFE_SIZE + if (unlikely((__pyx_temp < 0))) __PYX_ERR(0, 206, __pyx_L1_error) + #endif + if (__pyx_t_7 >= __pyx_temp) break; + } + #if CYTHON_ASSUME_SAFE_MACROS && !CYTHON_AVOID_BORROWED_REFS + __pyx_t_4 = __Pyx_NewRef(PyTuple_GET_ITEM(__pyx_t_2, __pyx_t_7)); + #else + __pyx_t_4 = __Pyx_PySequence_ITEM(__pyx_t_2, __pyx_t_7); + #endif + ++__pyx_t_7; + } + if (unlikely(!__pyx_t_4)) __PYX_ERR(0, 206, __pyx_L1_error) + } else { + __pyx_t_4 = __pyx_t_8(__pyx_t_2); + if (unlikely(!__pyx_t_4)) { + PyObject* exc_type = PyErr_Occurred(); + if (exc_type) { + if (unlikely(!__Pyx_PyErr_GivenExceptionMatches(exc_type, PyExc_StopIteration))) __PYX_ERR(0, 206, __pyx_L1_error) + PyErr_Clear(); + } + break; + } + } + __Pyx_GOTREF(__pyx_t_4); + __Pyx_XDECREF_SET(__pyx_v_label, __pyx_t_4); + __pyx_t_4 = 0; + __pyx_t_9 = (__pyx_v_label != Py_None); + if (__pyx_t_9) { + __pyx_t_10 = ((PyObject *)__pyx_v_example->x->vocab->strings); + __Pyx_INCREF(__pyx_t_10); + __pyx_t_3 = 0; + { + PyObject *__pyx_callargs[2 + ((CYTHON_VECTORCALL) ? 1 : 0)] = {__pyx_t_10, __pyx_v_label}; + __pyx_t_11 = __Pyx_MakeVectorcallBuilderKwds(1); if (unlikely(!__pyx_t_11)) __PYX_ERR(0, 206, __pyx_L1_error) + __Pyx_GOTREF(__pyx_t_11); + if (__Pyx_VectorcallBuilder_AddArg(__pyx_mstate_global->__pyx_n_u_allow_transient, Py_False, __pyx_t_11, __pyx_callargs+2, 0) < (0)) __PYX_ERR(0, 206, __pyx_L1_error) + __pyx_t_5 = __Pyx_Object_VectorcallMethod_CallFromBuilder((PyObject*)__pyx_mstate_global->__pyx_n_u_add, __pyx_callargs+__pyx_t_3, (2-__pyx_t_3) | (1*__Pyx_PY_VECTORCALL_ARGUMENTS_OFFSET), __pyx_t_11); + __Pyx_XDECREF(__pyx_t_10); __pyx_t_10 = 0; + __Pyx_DECREF(__pyx_t_11); __pyx_t_11 = 0; + if (unlikely(!__pyx_t_5)) __PYX_ERR(0, 206, __pyx_L1_error) + __Pyx_GOTREF(__pyx_t_5); + } + __pyx_t_4 = __pyx_t_5; + __pyx_t_5 = 0; + } else { + __pyx_t_5 = __Pyx_PyLong_From_int(__pyx_v_5spacy_6tokens_5token_MISSING_DEP); if (unlikely(!__pyx_t_5)) __PYX_ERR(0, 206, __pyx_L1_error) + __Pyx_GOTREF(__pyx_t_5); + __pyx_t_4 = __pyx_t_5; + __pyx_t_5 = 0; + } + if (unlikely(__Pyx_ListComp_Append(__pyx_t_1, (PyObject*)__pyx_t_4))) __PYX_ERR(0, 206, __pyx_L1_error) + __Pyx_DECREF(__pyx_t_4); __pyx_t_4 = 0; + } + __Pyx_DECREF(__pyx_t_2); __pyx_t_2 = 0; + __Pyx_DECREF_SET(__pyx_v_labels, __pyx_t_1); + __pyx_t_1 = 0; + + /* "spacy/pipeline/_parser_internals/arc_eager.pyx":207 + * heads, labels = example.get_aligned_parse(projectivize=True) + * labels = [example.x.vocab.strings.add(label, allow_transient=False) if label is not None else MISSING_DEP for label in labels] + * sent_starts = _get_aligned_sent_starts(example) # <<<<<<<<<<<<<< + * assert len(heads) == len(labels) == len(sent_starts), (len(heads), len(labels), len(sent_starts)) + * self.c = create_gold_state(self.mem, stcls.c, heads, labels, sent_starts) +*/ + __pyx_t_2 = NULL; + __Pyx_GetModuleGlobalName(__pyx_t_4, __pyx_mstate_global->__pyx_n_u_get_aligned_sent_starts); if (unlikely(!__pyx_t_4)) __PYX_ERR(0, 207, __pyx_L1_error) + __Pyx_GOTREF(__pyx_t_4); + __pyx_t_3 = 1; + #if CYTHON_UNPACK_METHODS + if (unlikely(PyMethod_Check(__pyx_t_4))) { + __pyx_t_2 = PyMethod_GET_SELF(__pyx_t_4); + assert(__pyx_t_2); + PyObject* __pyx__function = PyMethod_GET_FUNCTION(__pyx_t_4); + __Pyx_INCREF(__pyx_t_2); + __Pyx_INCREF(__pyx__function); + __Pyx_DECREF_SET(__pyx_t_4, __pyx__function); + __pyx_t_3 = 0; + } + #endif + { + PyObject *__pyx_callargs[2] = {__pyx_t_2, ((PyObject *)__pyx_v_example)}; + __pyx_t_1 = __Pyx_PyObject_FastCall((PyObject*)__pyx_t_4, __pyx_callargs+__pyx_t_3, (2-__pyx_t_3) | (__pyx_t_3*__Pyx_PY_VECTORCALL_ARGUMENTS_OFFSET)); + __Pyx_XDECREF(__pyx_t_2); __pyx_t_2 = 0; + __Pyx_DECREF(__pyx_t_4); __pyx_t_4 = 0; + if (unlikely(!__pyx_t_1)) __PYX_ERR(0, 207, __pyx_L1_error) + __Pyx_GOTREF(__pyx_t_1); + } + __pyx_v_sent_starts = __pyx_t_1; + __pyx_t_1 = 0; + + /* "spacy/pipeline/_parser_internals/arc_eager.pyx":208 + * labels = [example.x.vocab.strings.add(label, allow_transient=False) if label is not None else MISSING_DEP for label in labels] + * sent_starts = _get_aligned_sent_starts(example) + * assert len(heads) == len(labels) == len(sent_starts), (len(heads), len(labels), len(sent_starts)) # <<<<<<<<<<<<<< + * self.c = create_gold_state(self.mem, stcls.c, heads, labels, sent_starts) + * +*/ + #ifndef CYTHON_WITHOUT_ASSERTIONS + if (unlikely(__pyx_assertions_enabled())) { + __pyx_t_7 = PyObject_Length(__pyx_v_heads); if (unlikely(__pyx_t_7 == ((Py_ssize_t)-1))) __PYX_ERR(0, 208, __pyx_L1_error) + __pyx_t_12 = PyObject_Length(__pyx_v_labels); if (unlikely(__pyx_t_12 == ((Py_ssize_t)-1))) __PYX_ERR(0, 208, __pyx_L1_error) + __pyx_t_9 = (__pyx_t_7 == __pyx_t_12); + if (__pyx_t_9) { + __pyx_t_13 = PyObject_Length(__pyx_v_sent_starts); if (unlikely(__pyx_t_13 == ((Py_ssize_t)-1))) __PYX_ERR(0, 208, __pyx_L1_error) + __pyx_t_9 = (__pyx_t_12 == __pyx_t_13); + } + if (unlikely(!__pyx_t_9)) { + __pyx_t_12 = PyObject_Length(__pyx_v_heads); if (unlikely(__pyx_t_12 == ((Py_ssize_t)-1))) __PYX_ERR(0, 208, __pyx_L1_error) + __pyx_t_1 = PyLong_FromSsize_t(__pyx_t_12); if (unlikely(!__pyx_t_1)) __PYX_ERR(0, 208, __pyx_L1_error) + __Pyx_GOTREF(__pyx_t_1); + __pyx_t_12 = PyObject_Length(__pyx_v_labels); if (unlikely(__pyx_t_12 == ((Py_ssize_t)-1))) __PYX_ERR(0, 208, __pyx_L1_error) + __pyx_t_4 = PyLong_FromSsize_t(__pyx_t_12); if (unlikely(!__pyx_t_4)) __PYX_ERR(0, 208, __pyx_L1_error) + __Pyx_GOTREF(__pyx_t_4); + __pyx_t_12 = PyObject_Length(__pyx_v_sent_starts); if (unlikely(__pyx_t_12 == ((Py_ssize_t)-1))) __PYX_ERR(0, 208, __pyx_L1_error) + __pyx_t_2 = PyLong_FromSsize_t(__pyx_t_12); if (unlikely(!__pyx_t_2)) __PYX_ERR(0, 208, __pyx_L1_error) + __Pyx_GOTREF(__pyx_t_2); + __pyx_t_5 = PyTuple_New(3); if (unlikely(!__pyx_t_5)) __PYX_ERR(0, 208, __pyx_L1_error) + __Pyx_GOTREF(__pyx_t_5); + __Pyx_GIVEREF(__pyx_t_1); + if (__Pyx_PyTuple_SET_ITEM(__pyx_t_5, 0, __pyx_t_1) != (0)) __PYX_ERR(0, 208, __pyx_L1_error); + __Pyx_GIVEREF(__pyx_t_4); + if (__Pyx_PyTuple_SET_ITEM(__pyx_t_5, 1, __pyx_t_4) != (0)) __PYX_ERR(0, 208, __pyx_L1_error); + __Pyx_GIVEREF(__pyx_t_2); + if (__Pyx_PyTuple_SET_ITEM(__pyx_t_5, 2, __pyx_t_2) != (0)) __PYX_ERR(0, 208, __pyx_L1_error); + __pyx_t_1 = 0; + __pyx_t_4 = 0; + __pyx_t_2 = 0; + __pyx_t_2 = PyTuple_Pack(1, __pyx_t_5); if (unlikely(!__pyx_t_2)) __PYX_ERR(0, 208, __pyx_L1_error) + __Pyx_GOTREF(__pyx_t_2); + __Pyx_DECREF(__pyx_t_5); __pyx_t_5 = 0; + __Pyx_Raise(((PyObject *)(((PyTypeObject*)PyExc_AssertionError))), __pyx_t_2, 0, 0); + __Pyx_DECREF(__pyx_t_2); __pyx_t_2 = 0; + __PYX_ERR(0, 208, __pyx_L1_error) + } + } + #else + if ((1)); else __PYX_ERR(0, 208, __pyx_L1_error) + #endif + + /* "spacy/pipeline/_parser_internals/arc_eager.pyx":209 + * sent_starts = _get_aligned_sent_starts(example) + * assert len(heads) == len(labels) == len(sent_starts), (len(heads), len(labels), len(sent_starts)) + * self.c = create_gold_state(self.mem, stcls.c, heads, labels, sent_starts) # <<<<<<<<<<<<<< + * + * def update(self, StateClass stcls): +*/ + __pyx_t_2 = ((PyObject *)__pyx_v_self->mem); + __Pyx_INCREF(__pyx_t_2); + __pyx_t_14 = __pyx_f_5spacy_8pipeline_17_parser_internals_9arc_eager_create_gold_state(((struct __pyx_obj_5cymem_5cymem_Pool *)__pyx_t_2), __pyx_v_stcls->c, __pyx_v_heads, __pyx_v_labels, __pyx_v_sent_starts); if (unlikely(PyErr_Occurred())) __PYX_ERR(0, 209, __pyx_L1_error) + __Pyx_DECREF(__pyx_t_2); __pyx_t_2 = 0; + __pyx_v_self->c = __pyx_t_14; + + /* "spacy/pipeline/_parser_internals/arc_eager.pyx":203 + * cdef Pool mem + * + * def __init__(self, ArcEager moves, StateClass stcls, Example example): # <<<<<<<<<<<<<< + * self.mem = Pool() + * heads, labels = example.get_aligned_parse(projectivize=True) +*/ + + /* function exit code */ + __pyx_r = 0; + goto __pyx_L0; + __pyx_L1_error:; + __Pyx_XDECREF(__pyx_t_1); + __Pyx_XDECREF(__pyx_t_2); + __Pyx_XDECREF(__pyx_t_4); + __Pyx_XDECREF(__pyx_t_5); + __Pyx_XDECREF(__pyx_t_10); + __Pyx_XDECREF(__pyx_t_11); + __Pyx_AddTraceback("spacy.pipeline._parser_internals.arc_eager.ArcEagerGold.__init__", __pyx_clineno, __pyx_lineno, __pyx_filename); + __pyx_r = -1; + __pyx_L0:; + __Pyx_XDECREF(__pyx_v_heads); + __Pyx_XDECREF(__pyx_v_labels); + __Pyx_XDECREF(__pyx_v_sent_starts); + __Pyx_XDECREF(__pyx_v_label); + __Pyx_RefNannyFinishContext(); + return __pyx_r; +} + +/* "spacy/pipeline/_parser_internals/arc_eager.pyx":211 + * self.c = create_gold_state(self.mem, stcls.c, heads, labels, sent_starts) + * + * def update(self, StateClass stcls): # <<<<<<<<<<<<<< + * update_gold_state(&self.c, stcls.c) + * +*/ + +/* Python wrapper */ +static PyObject *__pyx_pw_5spacy_8pipeline_17_parser_internals_9arc_eager_12ArcEagerGold_3update(PyObject *__pyx_v_self, +#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_5spacy_8pipeline_17_parser_internals_9arc_eager_12ArcEagerGold_2update, "ArcEagerGold.update(self, StateClass stcls)"); +static PyMethodDef __pyx_mdef_5spacy_8pipeline_17_parser_internals_9arc_eager_12ArcEagerGold_3update = {"update", (PyCFunction)(void(*)(void))(__Pyx_PyCFunction_FastCallWithKeywords)__pyx_pw_5spacy_8pipeline_17_parser_internals_9arc_eager_12ArcEagerGold_3update, __Pyx_METH_FASTCALL|METH_KEYWORDS, __pyx_doc_5spacy_8pipeline_17_parser_internals_9arc_eager_12ArcEagerGold_2update}; +static PyObject *__pyx_pw_5spacy_8pipeline_17_parser_internals_9arc_eager_12ArcEagerGold_3update(PyObject *__pyx_v_self, +#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_5spacy_8pipeline_17_parser_internals_10stateclass_StateClass *__pyx_v_stcls = 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("update (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_stcls,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, 211, __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, 211, __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, "update", 0) < (0)) __PYX_ERR(0, 211, __pyx_L3_error) + for (Py_ssize_t i = __pyx_nargs; i < 1; i++) { + if (unlikely(!values[i])) { __Pyx_RaiseArgtupleInvalid("update", 1, 1, 1, i); __PYX_ERR(0, 211, __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, 211, __pyx_L3_error) + } + __pyx_v_stcls = ((struct __pyx_obj_5spacy_8pipeline_17_parser_internals_10stateclass_StateClass *)values[0]); + } + goto __pyx_L6_skip; + __pyx_L5_argtuple_error:; + __Pyx_RaiseArgtupleInvalid("update", 1, 1, 1, __pyx_nargs); __PYX_ERR(0, 211, __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("spacy.pipeline._parser_internals.arc_eager.ArcEagerGold.update", __pyx_clineno, __pyx_lineno, __pyx_filename); + __Pyx_RefNannyFinishContext(); + return NULL; + __pyx_L4_argument_unpacking_done:; + if (unlikely(!__Pyx_ArgTypeTest(((PyObject *)__pyx_v_stcls), __pyx_mstate_global->__pyx_ptype_5spacy_8pipeline_17_parser_internals_10stateclass_StateClass, 1, "stcls", 0))) __PYX_ERR(0, 211, __pyx_L1_error) + __pyx_r = __pyx_pf_5spacy_8pipeline_17_parser_internals_9arc_eager_12ArcEagerGold_2update(((struct __pyx_obj_5spacy_8pipeline_17_parser_internals_9arc_eager_ArcEagerGold *)__pyx_v_self), __pyx_v_stcls); + + /* 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_5spacy_8pipeline_17_parser_internals_9arc_eager_12ArcEagerGold_2update(struct __pyx_obj_5spacy_8pipeline_17_parser_internals_9arc_eager_ArcEagerGold *__pyx_v_self, struct __pyx_obj_5spacy_8pipeline_17_parser_internals_10stateclass_StateClass *__pyx_v_stcls) { + PyObject *__pyx_r = NULL; + __Pyx_RefNannyDeclarations + __Pyx_RefNannySetupContext("update", 0); + + /* "spacy/pipeline/_parser_internals/arc_eager.pyx":212 + * + * def update(self, StateClass stcls): + * update_gold_state(&self.c, stcls.c) # <<<<<<<<<<<<<< + * + * +*/ + __pyx_f_5spacy_8pipeline_17_parser_internals_9arc_eager_update_gold_state((&__pyx_v_self->c), __pyx_v_stcls->c); + + /* "spacy/pipeline/_parser_internals/arc_eager.pyx":211 + * self.c = create_gold_state(self.mem, stcls.c, heads, labels, sent_starts) + * + * def update(self, StateClass stcls): # <<<<<<<<<<<<<< + * update_gold_state(&self.c, stcls.c) + * +*/ + + /* function exit code */ + __pyx_r = Py_None; __Pyx_INCREF(Py_None); + __Pyx_XGIVEREF(__pyx_r); + __Pyx_RefNannyFinishContext(); + return __pyx_r; +} + +/* "(tree fragment)":1 + * def __reduce_cython__(self): # <<<<<<<<<<<<<< + * raise TypeError, "self.c cannot be converted to a Python object for pickling" + * def __setstate_cython__(self, __pyx_state): +*/ + +/* Python wrapper */ +static PyObject *__pyx_pw_5spacy_8pipeline_17_parser_internals_9arc_eager_12ArcEagerGold_5__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_5spacy_8pipeline_17_parser_internals_9arc_eager_12ArcEagerGold_4__reduce_cython__, "ArcEagerGold.__reduce_cython__(self)"); +static PyMethodDef __pyx_mdef_5spacy_8pipeline_17_parser_internals_9arc_eager_12ArcEagerGold_5__reduce_cython__ = {"__reduce_cython__", (PyCFunction)(void(*)(void))(__Pyx_PyCFunction_FastCallWithKeywords)__pyx_pw_5spacy_8pipeline_17_parser_internals_9arc_eager_12ArcEagerGold_5__reduce_cython__, __Pyx_METH_FASTCALL|METH_KEYWORDS, __pyx_doc_5spacy_8pipeline_17_parser_internals_9arc_eager_12ArcEagerGold_4__reduce_cython__}; +static PyObject *__pyx_pw_5spacy_8pipeline_17_parser_internals_9arc_eager_12ArcEagerGold_5__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_5spacy_8pipeline_17_parser_internals_9arc_eager_12ArcEagerGold_4__reduce_cython__(((struct __pyx_obj_5spacy_8pipeline_17_parser_internals_9arc_eager_ArcEagerGold *)__pyx_v_self)); + + /* function exit code */ + __Pyx_RefNannyFinishContext(); + return __pyx_r; +} + +static PyObject *__pyx_pf_5spacy_8pipeline_17_parser_internals_9arc_eager_12ArcEagerGold_4__reduce_cython__(CYTHON_UNUSED struct __pyx_obj_5spacy_8pipeline_17_parser_internals_9arc_eager_ArcEagerGold *__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.c cannot be converted to a Python object for pickling" # <<<<<<<<<<<<<< + * def __setstate_cython__(self, __pyx_state): + * raise TypeError, "self.c cannot be converted to a Python object for pickling" +*/ + __Pyx_Raise(((PyObject *)(((PyTypeObject*)PyExc_TypeError))), __pyx_mstate_global->__pyx_kp_u_self_c_cannot_be_converted_to_a, 0, 0); + __PYX_ERR(1, 2, __pyx_L1_error) + + /* "(tree fragment)":1 + * def __reduce_cython__(self): # <<<<<<<<<<<<<< + * raise TypeError, "self.c cannot be converted to a Python object for pickling" + * def __setstate_cython__(self, __pyx_state): +*/ + + /* function exit code */ + __pyx_L1_error:; + __Pyx_AddTraceback("spacy.pipeline._parser_internals.arc_eager.ArcEagerGold.__reduce_cython__", __pyx_clineno, __pyx_lineno, __pyx_filename); + __pyx_r = NULL; + __Pyx_XGIVEREF(__pyx_r); + __Pyx_RefNannyFinishContext(); + return __pyx_r; +} + +/* "(tree fragment)":3 + * def __reduce_cython__(self): + * raise TypeError, "self.c cannot be converted to a Python object for pickling" + * def __setstate_cython__(self, __pyx_state): # <<<<<<<<<<<<<< + * raise TypeError, "self.c cannot be converted to a Python object for pickling" +*/ + +/* Python wrapper */ +static PyObject *__pyx_pw_5spacy_8pipeline_17_parser_internals_9arc_eager_12ArcEagerGold_7__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_5spacy_8pipeline_17_parser_internals_9arc_eager_12ArcEagerGold_6__setstate_cython__, "ArcEagerGold.__setstate_cython__(self, __pyx_state)"); +static PyMethodDef __pyx_mdef_5spacy_8pipeline_17_parser_internals_9arc_eager_12ArcEagerGold_7__setstate_cython__ = {"__setstate_cython__", (PyCFunction)(void(*)(void))(__Pyx_PyCFunction_FastCallWithKeywords)__pyx_pw_5spacy_8pipeline_17_parser_internals_9arc_eager_12ArcEagerGold_7__setstate_cython__, __Pyx_METH_FASTCALL|METH_KEYWORDS, __pyx_doc_5spacy_8pipeline_17_parser_internals_9arc_eager_12ArcEagerGold_6__setstate_cython__}; +static PyObject *__pyx_pw_5spacy_8pipeline_17_parser_internals_9arc_eager_12ArcEagerGold_7__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("spacy.pipeline._parser_internals.arc_eager.ArcEagerGold.__setstate_cython__", __pyx_clineno, __pyx_lineno, __pyx_filename); + __Pyx_RefNannyFinishContext(); + return NULL; + __pyx_L4_argument_unpacking_done:; + __pyx_r = __pyx_pf_5spacy_8pipeline_17_parser_internals_9arc_eager_12ArcEagerGold_6__setstate_cython__(((struct __pyx_obj_5spacy_8pipeline_17_parser_internals_9arc_eager_ArcEagerGold *)__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_5spacy_8pipeline_17_parser_internals_9arc_eager_12ArcEagerGold_6__setstate_cython__(CYTHON_UNUSED struct __pyx_obj_5spacy_8pipeline_17_parser_internals_9arc_eager_ArcEagerGold *__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.c cannot be converted to a Python object for pickling" + * def __setstate_cython__(self, __pyx_state): + * raise TypeError, "self.c cannot be converted to a Python object for pickling" # <<<<<<<<<<<<<< +*/ + __Pyx_Raise(((PyObject *)(((PyTypeObject*)PyExc_TypeError))), __pyx_mstate_global->__pyx_kp_u_self_c_cannot_be_converted_to_a, 0, 0); + __PYX_ERR(1, 4, __pyx_L1_error) + + /* "(tree fragment)":3 + * def __reduce_cython__(self): + * raise TypeError, "self.c cannot be converted to a Python object for pickling" + * def __setstate_cython__(self, __pyx_state): # <<<<<<<<<<<<<< + * raise TypeError, "self.c cannot be converted to a Python object for pickling" +*/ + + /* function exit code */ + __pyx_L1_error:; + __Pyx_AddTraceback("spacy.pipeline._parser_internals.arc_eager.ArcEagerGold.__setstate_cython__", __pyx_clineno, __pyx_lineno, __pyx_filename); + __pyx_r = NULL; + __Pyx_XGIVEREF(__pyx_r); + __Pyx_RefNannyFinishContext(); + return __pyx_r; +} + +/* "spacy/pipeline/_parser_internals/arc_eager.pyx":215 + * + * + * def _get_aligned_sent_starts(example): # <<<<<<<<<<<<<< + * """Get list of SENT_START attributes aligned to the predicted tokenization. + * If the reference has not sentence starts, return a list of None values. +*/ + +/* Python wrapper */ +static PyObject *__pyx_pw_5spacy_8pipeline_17_parser_internals_9arc_eager_1_get_aligned_sent_starts(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_5spacy_8pipeline_17_parser_internals_9arc_eager__get_aligned_sent_starts, "_get_aligned_sent_starts(example)\n\nGet list of SENT_START attributes aligned to the predicted tokenization.\nIf the reference has not sentence starts, return a list of None values.\n\nThis function is slightly different from the one on Example, because we also\ncheck whether the reference sentences align across multiple sentences,\nand return missing values if they do. This prevents a problem where you have\nthe start of a sentence merged onto a token that belongs to two sentences."); +static PyMethodDef __pyx_mdef_5spacy_8pipeline_17_parser_internals_9arc_eager_1_get_aligned_sent_starts = {"_get_aligned_sent_starts", (PyCFunction)(void(*)(void))(__Pyx_PyCFunction_FastCallWithKeywords)__pyx_pw_5spacy_8pipeline_17_parser_internals_9arc_eager_1_get_aligned_sent_starts, __Pyx_METH_FASTCALL|METH_KEYWORDS, __pyx_doc_5spacy_8pipeline_17_parser_internals_9arc_eager__get_aligned_sent_starts}; +static PyObject *__pyx_pw_5spacy_8pipeline_17_parser_internals_9arc_eager_1_get_aligned_sent_starts(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 +) { + PyObject *__pyx_v_example = 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("_get_aligned_sent_starts (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_example,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, 215, __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, 215, __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, "_get_aligned_sent_starts", 0) < (0)) __PYX_ERR(0, 215, __pyx_L3_error) + for (Py_ssize_t i = __pyx_nargs; i < 1; i++) { + if (unlikely(!values[i])) { __Pyx_RaiseArgtupleInvalid("_get_aligned_sent_starts", 1, 1, 1, i); __PYX_ERR(0, 215, __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, 215, __pyx_L3_error) + } + __pyx_v_example = values[0]; + } + goto __pyx_L6_skip; + __pyx_L5_argtuple_error:; + __Pyx_RaiseArgtupleInvalid("_get_aligned_sent_starts", 1, 1, 1, __pyx_nargs); __PYX_ERR(0, 215, __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("spacy.pipeline._parser_internals.arc_eager._get_aligned_sent_starts", __pyx_clineno, __pyx_lineno, __pyx_filename); + __Pyx_RefNannyFinishContext(); + return NULL; + __pyx_L4_argument_unpacking_done:; + __pyx_r = __pyx_pf_5spacy_8pipeline_17_parser_internals_9arc_eager__get_aligned_sent_starts(__pyx_self, __pyx_v_example); + + /* 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_gb_5spacy_8pipeline_17_parser_internals_9arc_eager_24_get_aligned_sent_starts_2generator(__pyx_CoroutineObject *__pyx_generator, CYTHON_UNUSED PyThreadState *__pyx_tstate, PyObject *__pyx_sent_value); /* proto */ + +/* "spacy/pipeline/_parser_internals/arc_eager.pyx":230 + * for y_sent in example.y.sents: + * x_indices = list(align[y_sent.start : y_sent.end]) + * if any(x_idx in seen_words for x_idx in x_indices): # <<<<<<<<<<<<<< + * # If there are any tokens in X that align across two sentences, + * # regard the sentence annotations as missing, as we can't +*/ + +static PyObject *__pyx_pf_5spacy_8pipeline_17_parser_internals_9arc_eager_24_get_aligned_sent_starts_genexpr(PyObject *__pyx_self, PyObject *__pyx_genexpr_arg_0) { + struct __pyx_obj_5spacy_8pipeline_17_parser_internals_9arc_eager___pyx_scope_struct_1_genexpr *__pyx_cur_scope; + PyObject *__pyx_r = NULL; + __Pyx_RefNannyDeclarations + int __pyx_lineno = 0; + const char *__pyx_filename = NULL; + int __pyx_clineno = 0; + __Pyx_RefNannySetupContext("genexpr", 0); + __pyx_cur_scope = (struct __pyx_obj_5spacy_8pipeline_17_parser_internals_9arc_eager___pyx_scope_struct_1_genexpr *)__pyx_tp_new_5spacy_8pipeline_17_parser_internals_9arc_eager___pyx_scope_struct_1_genexpr(__pyx_mstate_global->__pyx_ptype_5spacy_8pipeline_17_parser_internals_9arc_eager___pyx_scope_struct_1_genexpr, __pyx_mstate_global->__pyx_empty_tuple, NULL); + if (unlikely(!__pyx_cur_scope)) { + __pyx_cur_scope = ((struct __pyx_obj_5spacy_8pipeline_17_parser_internals_9arc_eager___pyx_scope_struct_1_genexpr *)Py_None); + __Pyx_INCREF(Py_None); + __PYX_ERR(0, 230, __pyx_L1_error) + } else { + __Pyx_GOTREF((PyObject *)__pyx_cur_scope); + } + __pyx_cur_scope->__pyx_outer_scope = (struct __pyx_obj_5spacy_8pipeline_17_parser_internals_9arc_eager___pyx_scope_struct___get_aligned_sent_starts *) __pyx_self; + __Pyx_INCREF((PyObject *)__pyx_cur_scope->__pyx_outer_scope); + __Pyx_GIVEREF((PyObject *)__pyx_cur_scope->__pyx_outer_scope); + __pyx_cur_scope->__pyx_genexpr_arg_0 = __pyx_genexpr_arg_0; + __Pyx_INCREF(__pyx_cur_scope->__pyx_genexpr_arg_0); + __Pyx_GIVEREF(__pyx_cur_scope->__pyx_genexpr_arg_0); + { + __pyx_CoroutineObject *gen = __Pyx_Generator_New((__pyx_coroutine_body_t) __pyx_gb_5spacy_8pipeline_17_parser_internals_9arc_eager_24_get_aligned_sent_starts_2generator, ((PyObject *)__pyx_mstate_global->__pyx_codeobj_tab[0]), (PyObject *) __pyx_cur_scope, __pyx_mstate_global->__pyx_n_u_genexpr, __pyx_mstate_global->__pyx_n_u_get_aligned_sent_starts_locals, __pyx_mstate_global->__pyx_n_u_spacy_pipeline__parser_internals); if (unlikely(!gen)) __PYX_ERR(0, 230, __pyx_L1_error) + __Pyx_DECREF(__pyx_cur_scope); + __Pyx_RefNannyFinishContext(); + return (PyObject *) gen; + } + + /* function exit code */ + __pyx_L1_error:; + __Pyx_AddTraceback("spacy.pipeline._parser_internals.arc_eager._get_aligned_sent_starts.genexpr", __pyx_clineno, __pyx_lineno, __pyx_filename); + __pyx_r = NULL; + __Pyx_DECREF((PyObject *)__pyx_cur_scope); + __Pyx_XGIVEREF(__pyx_r); + __Pyx_RefNannyFinishContext(); + return __pyx_r; +} + +static PyObject *__pyx_gb_5spacy_8pipeline_17_parser_internals_9arc_eager_24_get_aligned_sent_starts_2generator(__pyx_CoroutineObject *__pyx_generator, CYTHON_UNUSED PyThreadState *__pyx_tstate, PyObject *__pyx_sent_value) /* generator body */ +{ + struct __pyx_obj_5spacy_8pipeline_17_parser_internals_9arc_eager___pyx_scope_struct_1_genexpr *__pyx_cur_scope = ((struct __pyx_obj_5spacy_8pipeline_17_parser_internals_9arc_eager___pyx_scope_struct_1_genexpr *)__pyx_generator->closure); + PyObject *__pyx_r = NULL; + PyObject *__pyx_t_1 = NULL; + Py_ssize_t __pyx_t_2; + PyObject *__pyx_t_3 = NULL; + int __pyx_t_4; + int __pyx_lineno = 0; + const char *__pyx_filename = NULL; + int __pyx_clineno = 0; + __Pyx_RefNannyDeclarations + __Pyx_RefNannySetupContext("genexpr", 0); + switch (__pyx_generator->resume_label) { + case 0: goto __pyx_L3_first_run; + default: /* CPython raises the right error here */ + __Pyx_RefNannyFinishContext(); + return NULL; + } + __pyx_L3_first_run:; + if (unlikely(!__pyx_sent_value)) __PYX_ERR(0, 230, __pyx_L1_error) + if (unlikely(!__pyx_cur_scope->__pyx_genexpr_arg_0)) { __Pyx_RaiseUnboundLocalError(".0"); __PYX_ERR(0, 230, __pyx_L1_error) } + __pyx_t_1 = __pyx_cur_scope->__pyx_genexpr_arg_0; __Pyx_INCREF(__pyx_t_1); + __pyx_t_2 = 0; + for (;;) { + { + Py_ssize_t __pyx_temp = __Pyx_PyList_GET_SIZE(__pyx_t_1); + #if !CYTHON_ASSUME_SAFE_SIZE + if (unlikely((__pyx_temp < 0))) __PYX_ERR(0, 230, __pyx_L1_error) + #endif + if (__pyx_t_2 >= __pyx_temp) break; + } + __pyx_t_3 = __Pyx_PyList_GetItemRefFast(__pyx_t_1, __pyx_t_2, __Pyx_ReferenceSharing_OwnStrongReference); + ++__pyx_t_2; + if (unlikely(!__pyx_t_3)) __PYX_ERR(0, 230, __pyx_L1_error) + __Pyx_GOTREF(__pyx_t_3); + __Pyx_XGOTREF(__pyx_cur_scope->__pyx_v_x_idx); + __Pyx_XDECREF_SET(__pyx_cur_scope->__pyx_v_x_idx, __pyx_t_3); + __Pyx_GIVEREF(__pyx_t_3); + __pyx_t_3 = 0; + if (unlikely(!__pyx_cur_scope->__pyx_outer_scope->__pyx_v_seen_words)) { __Pyx_RaiseClosureNameError("seen_words"); __PYX_ERR(0, 230, __pyx_L1_error) } + if (unlikely(__pyx_cur_scope->__pyx_outer_scope->__pyx_v_seen_words == Py_None)) { + PyErr_SetString(PyExc_TypeError, "'NoneType' object is not iterable"); + __PYX_ERR(0, 230, __pyx_L1_error) + } + __pyx_t_4 = (__Pyx_PySet_ContainsTF(__pyx_cur_scope->__pyx_v_x_idx, __pyx_cur_scope->__pyx_outer_scope->__pyx_v_seen_words, Py_EQ)); if (unlikely((__pyx_t_4 < 0))) __PYX_ERR(0, 230, __pyx_L1_error) + if (__pyx_t_4) { + __Pyx_XDECREF(__pyx_r); + __Pyx_INCREF(Py_True); + __pyx_r = Py_True; + __Pyx_DECREF(__pyx_t_1); __pyx_t_1 = 0; + goto __pyx_L0; + } + } + __Pyx_DECREF(__pyx_t_1); __pyx_t_1 = 0; + /*else*/ { + __Pyx_XDECREF(__pyx_r); + __Pyx_INCREF(Py_False); + __pyx_r = Py_False; + goto __pyx_L0; + } + CYTHON_MAYBE_UNUSED_VAR(__pyx_cur_scope); + + /* function exit code */ + goto __pyx_L0; + __pyx_L1_error:; + __Pyx_XDECREF(__pyx_t_1); + __Pyx_XDECREF(__pyx_t_3); + if (__Pyx_PyErr_Occurred()) { + __Pyx_AddTraceback("genexpr", __pyx_clineno, __pyx_lineno, __pyx_filename); + } + __pyx_L0:; + __Pyx_XGIVEREF(__pyx_r); + #if !CYTHON_USE_EXC_INFO_STACK + __Pyx_Coroutine_ResetAndClearException(__pyx_generator); + #endif + __pyx_generator->resume_label = -1; + __Pyx_Coroutine_clear((PyObject*)__pyx_generator); + __Pyx_RefNannyFinishContext(); + return __pyx_r; +} + +/* "spacy/pipeline/_parser_internals/arc_eager.pyx":215 + * + * + * def _get_aligned_sent_starts(example): # <<<<<<<<<<<<<< + * """Get list of SENT_START attributes aligned to the predicted tokenization. + * If the reference has not sentence starts, return a list of None values. +*/ + +static PyObject *__pyx_pf_5spacy_8pipeline_17_parser_internals_9arc_eager__get_aligned_sent_starts(CYTHON_UNUSED PyObject *__pyx_self, PyObject *__pyx_v_example) { + struct __pyx_obj_5spacy_8pipeline_17_parser_internals_9arc_eager___pyx_scope_struct___get_aligned_sent_starts *__pyx_cur_scope; + PyObject *__pyx_v_align = NULL; + PyObject *__pyx_v_sent_starts = NULL; + PyObject *__pyx_v_y_sent = NULL; + PyObject *__pyx_v_x_indices = NULL; + PyObject *__pyx_gb_5spacy_8pipeline_17_parser_internals_9arc_eager_24_get_aligned_sent_starts_2generator = 0; + 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; + Py_ssize_t __pyx_t_6; + PyObject *(*__pyx_t_7)(PyObject *); + PyObject *__pyx_t_8 = NULL; + Py_ssize_t __pyx_t_9; + int __pyx_lineno = 0; + const char *__pyx_filename = NULL; + int __pyx_clineno = 0; + __Pyx_RefNannySetupContext("_get_aligned_sent_starts", 0); + __pyx_cur_scope = (struct __pyx_obj_5spacy_8pipeline_17_parser_internals_9arc_eager___pyx_scope_struct___get_aligned_sent_starts *)__pyx_tp_new_5spacy_8pipeline_17_parser_internals_9arc_eager___pyx_scope_struct___get_aligned_sent_starts(__pyx_mstate_global->__pyx_ptype_5spacy_8pipeline_17_parser_internals_9arc_eager___pyx_scope_struct___get_aligned_sent_starts, __pyx_mstate_global->__pyx_empty_tuple, NULL); + if (unlikely(!__pyx_cur_scope)) { + __pyx_cur_scope = ((struct __pyx_obj_5spacy_8pipeline_17_parser_internals_9arc_eager___pyx_scope_struct___get_aligned_sent_starts *)Py_None); + __Pyx_INCREF(Py_None); + __PYX_ERR(0, 215, __pyx_L1_error) + } else { + __Pyx_GOTREF((PyObject *)__pyx_cur_scope); + } + + /* "spacy/pipeline/_parser_internals/arc_eager.pyx":224 + * the start of a sentence merged onto a token that belongs to two sentences. + * """ + * if example.y.has_annotation("SENT_START"): # <<<<<<<<<<<<<< + * align = example.alignment.y2x + * sent_starts = [False] * len(example.x) +*/ + __pyx_t_3 = __Pyx_PyObject_GetAttrStr(__pyx_v_example, __pyx_mstate_global->__pyx_n_u_y); if (unlikely(!__pyx_t_3)) __PYX_ERR(0, 224, __pyx_L1_error) + __Pyx_GOTREF(__pyx_t_3); + __pyx_t_2 = __pyx_t_3; + __Pyx_INCREF(__pyx_t_2); + __pyx_t_4 = 0; + { + PyObject *__pyx_callargs[2] = {__pyx_t_2, __pyx_mstate_global->__pyx_n_u_SENT_START}; + __pyx_t_1 = __Pyx_PyObject_FastCallMethod((PyObject*)__pyx_mstate_global->__pyx_n_u_has_annotation, __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, 224, __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, 224, __pyx_L1_error) + __Pyx_DECREF(__pyx_t_1); __pyx_t_1 = 0; + if (__pyx_t_5) { + + /* "spacy/pipeline/_parser_internals/arc_eager.pyx":225 + * """ + * if example.y.has_annotation("SENT_START"): + * align = example.alignment.y2x # <<<<<<<<<<<<<< + * sent_starts = [False] * len(example.x) + * seen_words = set() +*/ + __pyx_t_1 = __Pyx_PyObject_GetAttrStr(__pyx_v_example, __pyx_mstate_global->__pyx_n_u_alignment); if (unlikely(!__pyx_t_1)) __PYX_ERR(0, 225, __pyx_L1_error) + __Pyx_GOTREF(__pyx_t_1); + __pyx_t_3 = __Pyx_PyObject_GetAttrStr(__pyx_t_1, __pyx_mstate_global->__pyx_n_u_y2x); if (unlikely(!__pyx_t_3)) __PYX_ERR(0, 225, __pyx_L1_error) + __Pyx_GOTREF(__pyx_t_3); + __Pyx_DECREF(__pyx_t_1); __pyx_t_1 = 0; + __pyx_v_align = __pyx_t_3; + __pyx_t_3 = 0; + + /* "spacy/pipeline/_parser_internals/arc_eager.pyx":226 + * if example.y.has_annotation("SENT_START"): + * align = example.alignment.y2x + * sent_starts = [False] * len(example.x) # <<<<<<<<<<<<<< + * seen_words = set() + * for y_sent in example.y.sents: +*/ + __pyx_t_3 = __Pyx_PyObject_GetAttrStr(__pyx_v_example, __pyx_mstate_global->__pyx_n_u_x); if (unlikely(!__pyx_t_3)) __PYX_ERR(0, 226, __pyx_L1_error) + __Pyx_GOTREF(__pyx_t_3); + __pyx_t_6 = PyObject_Length(__pyx_t_3); if (unlikely(__pyx_t_6 == ((Py_ssize_t)-1))) __PYX_ERR(0, 226, __pyx_L1_error) + __Pyx_DECREF(__pyx_t_3); __pyx_t_3 = 0; + __pyx_t_3 = PyList_New(1 * ((__pyx_t_6<0) ? 0:__pyx_t_6)); if (unlikely(!__pyx_t_3)) __PYX_ERR(0, 226, __pyx_L1_error) + __Pyx_GOTREF(__pyx_t_3); + { Py_ssize_t __pyx_temp; + for (__pyx_temp=0; __pyx_temp < __pyx_t_6; __pyx_temp++) { + __Pyx_INCREF(Py_False); + __Pyx_GIVEREF(Py_False); + if (__Pyx_PyList_SET_ITEM(__pyx_t_3, __pyx_temp, Py_False) != (0)) __PYX_ERR(0, 226, __pyx_L1_error); + } + } + __pyx_v_sent_starts = ((PyObject*)__pyx_t_3); + __pyx_t_3 = 0; + + /* "spacy/pipeline/_parser_internals/arc_eager.pyx":227 + * align = example.alignment.y2x + * sent_starts = [False] * len(example.x) + * seen_words = set() # <<<<<<<<<<<<<< + * for y_sent in example.y.sents: + * x_indices = list(align[y_sent.start : y_sent.end]) +*/ + __pyx_t_3 = PySet_New(0); if (unlikely(!__pyx_t_3)) __PYX_ERR(0, 227, __pyx_L1_error) + __Pyx_GOTREF(__pyx_t_3); + __Pyx_GIVEREF(__pyx_t_3); + __pyx_cur_scope->__pyx_v_seen_words = ((PyObject*)__pyx_t_3); + __pyx_t_3 = 0; + + /* "spacy/pipeline/_parser_internals/arc_eager.pyx":228 + * sent_starts = [False] * len(example.x) + * seen_words = set() + * for y_sent in example.y.sents: # <<<<<<<<<<<<<< + * x_indices = list(align[y_sent.start : y_sent.end]) + * if any(x_idx in seen_words for x_idx in x_indices): +*/ + __pyx_t_3 = __Pyx_PyObject_GetAttrStr(__pyx_v_example, __pyx_mstate_global->__pyx_n_u_y); if (unlikely(!__pyx_t_3)) __PYX_ERR(0, 228, __pyx_L1_error) + __Pyx_GOTREF(__pyx_t_3); + __pyx_t_1 = __Pyx_PyObject_GetAttrStr(__pyx_t_3, __pyx_mstate_global->__pyx_n_u_sents); if (unlikely(!__pyx_t_1)) __PYX_ERR(0, 228, __pyx_L1_error) + __Pyx_GOTREF(__pyx_t_1); + __Pyx_DECREF(__pyx_t_3); __pyx_t_3 = 0; + if (likely(PyList_CheckExact(__pyx_t_1)) || PyTuple_CheckExact(__pyx_t_1)) { + __pyx_t_3 = __pyx_t_1; __Pyx_INCREF(__pyx_t_3); + __pyx_t_6 = 0; + __pyx_t_7 = NULL; + } else { + __pyx_t_6 = -1; __pyx_t_3 = PyObject_GetIter(__pyx_t_1); if (unlikely(!__pyx_t_3)) __PYX_ERR(0, 228, __pyx_L1_error) + __Pyx_GOTREF(__pyx_t_3); + __pyx_t_7 = (CYTHON_COMPILING_IN_LIMITED_API) ? PyIter_Next : __Pyx_PyObject_GetIterNextFunc(__pyx_t_3); if (unlikely(!__pyx_t_7)) __PYX_ERR(0, 228, __pyx_L1_error) + } + __Pyx_DECREF(__pyx_t_1); __pyx_t_1 = 0; + for (;;) { + if (likely(!__pyx_t_7)) { + 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, 228, __pyx_L1_error) + #endif + if (__pyx_t_6 >= __pyx_temp) break; + } + __pyx_t_1 = __Pyx_PyList_GetItemRefFast(__pyx_t_3, __pyx_t_6, __Pyx_ReferenceSharing_OwnStrongReference); + ++__pyx_t_6; + } 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, 228, __pyx_L1_error) + #endif + if (__pyx_t_6 >= __pyx_temp) break; + } + #if CYTHON_ASSUME_SAFE_MACROS && !CYTHON_AVOID_BORROWED_REFS + __pyx_t_1 = __Pyx_NewRef(PyTuple_GET_ITEM(__pyx_t_3, __pyx_t_6)); + #else + __pyx_t_1 = __Pyx_PySequence_ITEM(__pyx_t_3, __pyx_t_6); + #endif + ++__pyx_t_6; + } + if (unlikely(!__pyx_t_1)) __PYX_ERR(0, 228, __pyx_L1_error) + } else { + __pyx_t_1 = __pyx_t_7(__pyx_t_3); + if (unlikely(!__pyx_t_1)) { + PyObject* exc_type = PyErr_Occurred(); + if (exc_type) { + if (unlikely(!__Pyx_PyErr_GivenExceptionMatches(exc_type, PyExc_StopIteration))) __PYX_ERR(0, 228, __pyx_L1_error) + PyErr_Clear(); + } + break; + } + } + __Pyx_GOTREF(__pyx_t_1); + __Pyx_XDECREF_SET(__pyx_v_y_sent, __pyx_t_1); + __pyx_t_1 = 0; + + /* "spacy/pipeline/_parser_internals/arc_eager.pyx":229 + * seen_words = set() + * for y_sent in example.y.sents: + * x_indices = list(align[y_sent.start : y_sent.end]) # <<<<<<<<<<<<<< + * if any(x_idx in seen_words for x_idx in x_indices): + * # If there are any tokens in X that align across two sentences, +*/ + __pyx_t_1 = __Pyx_PyObject_GetAttrStr(__pyx_v_y_sent, __pyx_mstate_global->__pyx_n_u_start); if (unlikely(!__pyx_t_1)) __PYX_ERR(0, 229, __pyx_L1_error) + __Pyx_GOTREF(__pyx_t_1); + __pyx_t_2 = __Pyx_PyObject_GetAttrStr(__pyx_v_y_sent, __pyx_mstate_global->__pyx_n_u_end); if (unlikely(!__pyx_t_2)) __PYX_ERR(0, 229, __pyx_L1_error) + __Pyx_GOTREF(__pyx_t_2); + __pyx_t_8 = __Pyx_PyObject_GetSlice(__pyx_v_align, 0, 0, &__pyx_t_1, &__pyx_t_2, NULL, 0, 0, 1); if (unlikely(!__pyx_t_8)) __PYX_ERR(0, 229, __pyx_L1_error) + __Pyx_GOTREF(__pyx_t_8); + __Pyx_DECREF(__pyx_t_1); __pyx_t_1 = 0; + __Pyx_DECREF(__pyx_t_2); __pyx_t_2 = 0; + __pyx_t_2 = __Pyx_PySequence_ListKeepNew(__pyx_t_8); if (unlikely(!__pyx_t_2)) __PYX_ERR(0, 229, __pyx_L1_error) + __Pyx_GOTREF(__pyx_t_2); + __Pyx_DECREF(__pyx_t_8); __pyx_t_8 = 0; + __Pyx_XDECREF_SET(__pyx_v_x_indices, ((PyObject*)__pyx_t_2)); + __pyx_t_2 = 0; + + /* "spacy/pipeline/_parser_internals/arc_eager.pyx":230 + * for y_sent in example.y.sents: + * x_indices = list(align[y_sent.start : y_sent.end]) + * if any(x_idx in seen_words for x_idx in x_indices): # <<<<<<<<<<<<<< + * # If there are any tokens in X that align across two sentences, + * # regard the sentence annotations as missing, as we can't +*/ + __pyx_t_2 = __pyx_pf_5spacy_8pipeline_17_parser_internals_9arc_eager_24_get_aligned_sent_starts_genexpr(((PyObject*)__pyx_cur_scope), __pyx_v_x_indices); if (unlikely(!__pyx_t_2)) __PYX_ERR(0, 230, __pyx_L1_error) + __Pyx_GOTREF(__pyx_t_2); + __pyx_t_8 = __Pyx_Generator_GetInlinedResult(__pyx_t_2); if (unlikely(!__pyx_t_8)) __PYX_ERR(0, 230, __pyx_L1_error) + __Pyx_GOTREF(__pyx_t_8); + __Pyx_DECREF(__pyx_t_2); __pyx_t_2 = 0; + __pyx_t_5 = __Pyx_PyObject_IsTrue(__pyx_t_8); if (unlikely((__pyx_t_5 < 0))) __PYX_ERR(0, 230, __pyx_L1_error) + __Pyx_DECREF(__pyx_t_8); __pyx_t_8 = 0; + if (__pyx_t_5) { + + /* "spacy/pipeline/_parser_internals/arc_eager.pyx":234 + * # regard the sentence annotations as missing, as we can't + * # reliably use them. + * return [None] * len(example.x) # <<<<<<<<<<<<<< + * seen_words.update(x_indices) + * sent_starts[x_indices[0]] = True +*/ + __Pyx_XDECREF(__pyx_r); + __pyx_t_8 = __Pyx_PyObject_GetAttrStr(__pyx_v_example, __pyx_mstate_global->__pyx_n_u_x); if (unlikely(!__pyx_t_8)) __PYX_ERR(0, 234, __pyx_L1_error) + __Pyx_GOTREF(__pyx_t_8); + __pyx_t_9 = PyObject_Length(__pyx_t_8); if (unlikely(__pyx_t_9 == ((Py_ssize_t)-1))) __PYX_ERR(0, 234, __pyx_L1_error) + __Pyx_DECREF(__pyx_t_8); __pyx_t_8 = 0; + __pyx_t_8 = PyList_New(1 * ((__pyx_t_9<0) ? 0:__pyx_t_9)); if (unlikely(!__pyx_t_8)) __PYX_ERR(0, 234, __pyx_L1_error) + __Pyx_GOTREF(__pyx_t_8); + { Py_ssize_t __pyx_temp; + for (__pyx_temp=0; __pyx_temp < __pyx_t_9; __pyx_temp++) { + __Pyx_INCREF(Py_None); + __Pyx_GIVEREF(Py_None); + if (__Pyx_PyList_SET_ITEM(__pyx_t_8, __pyx_temp, Py_None) != (0)) __PYX_ERR(0, 234, __pyx_L1_error); + } + } + __pyx_r = __pyx_t_8; + __pyx_t_8 = 0; + __Pyx_DECREF(__pyx_t_3); __pyx_t_3 = 0; + goto __pyx_L0; + + /* "spacy/pipeline/_parser_internals/arc_eager.pyx":230 + * for y_sent in example.y.sents: + * x_indices = list(align[y_sent.start : y_sent.end]) + * if any(x_idx in seen_words for x_idx in x_indices): # <<<<<<<<<<<<<< + * # If there are any tokens in X that align across two sentences, + * # regard the sentence annotations as missing, as we can't +*/ + } + + /* "spacy/pipeline/_parser_internals/arc_eager.pyx":235 + * # reliably use them. + * return [None] * len(example.x) + * seen_words.update(x_indices) # <<<<<<<<<<<<<< + * sent_starts[x_indices[0]] = True + * return sent_starts +*/ + __pyx_t_8 = __Pyx_CallUnboundCMethod1(&__pyx_mstate_global->__pyx_umethod_PySet_Type__update, __pyx_cur_scope->__pyx_v_seen_words, __pyx_v_x_indices); if (unlikely(!__pyx_t_8)) __PYX_ERR(0, 235, __pyx_L1_error) + __Pyx_GOTREF(__pyx_t_8); + __Pyx_DECREF(__pyx_t_8); __pyx_t_8 = 0; + + /* "spacy/pipeline/_parser_internals/arc_eager.pyx":236 + * return [None] * len(example.x) + * seen_words.update(x_indices) + * sent_starts[x_indices[0]] = True # <<<<<<<<<<<<<< + * return sent_starts + * else: +*/ + __pyx_t_8 = __Pyx_GetItemInt_List(__pyx_v_x_indices, 0, long, 1, __Pyx_PyLong_From_long, 1, 0, 1, 1, __Pyx_ReferenceSharing_OwnStrongReference); if (unlikely(!__pyx_t_8)) __PYX_ERR(0, 236, __pyx_L1_error) + __Pyx_GOTREF(__pyx_t_8); + if (unlikely((PyObject_SetItem(__pyx_v_sent_starts, __pyx_t_8, Py_True) < 0))) __PYX_ERR(0, 236, __pyx_L1_error) + __Pyx_DECREF(__pyx_t_8); __pyx_t_8 = 0; + + /* "spacy/pipeline/_parser_internals/arc_eager.pyx":228 + * sent_starts = [False] * len(example.x) + * seen_words = set() + * for y_sent in example.y.sents: # <<<<<<<<<<<<<< + * x_indices = list(align[y_sent.start : y_sent.end]) + * if any(x_idx in seen_words for x_idx in x_indices): +*/ + } + __Pyx_DECREF(__pyx_t_3); __pyx_t_3 = 0; + + /* "spacy/pipeline/_parser_internals/arc_eager.pyx":237 + * seen_words.update(x_indices) + * sent_starts[x_indices[0]] = True + * return sent_starts # <<<<<<<<<<<<<< + * else: + * return [None] * len(example.x) +*/ + __Pyx_XDECREF(__pyx_r); + __Pyx_INCREF(__pyx_v_sent_starts); + __pyx_r = __pyx_v_sent_starts; + goto __pyx_L0; + + /* "spacy/pipeline/_parser_internals/arc_eager.pyx":224 + * the start of a sentence merged onto a token that belongs to two sentences. + * """ + * if example.y.has_annotation("SENT_START"): # <<<<<<<<<<<<<< + * align = example.alignment.y2x + * sent_starts = [False] * len(example.x) +*/ + } + + /* "spacy/pipeline/_parser_internals/arc_eager.pyx":239 + * return sent_starts + * else: + * return [None] * len(example.x) # <<<<<<<<<<<<<< + * + * +*/ + /*else*/ { + __Pyx_XDECREF(__pyx_r); + __pyx_t_3 = __Pyx_PyObject_GetAttrStr(__pyx_v_example, __pyx_mstate_global->__pyx_n_u_x); if (unlikely(!__pyx_t_3)) __PYX_ERR(0, 239, __pyx_L1_error) + __Pyx_GOTREF(__pyx_t_3); + __pyx_t_6 = PyObject_Length(__pyx_t_3); if (unlikely(__pyx_t_6 == ((Py_ssize_t)-1))) __PYX_ERR(0, 239, __pyx_L1_error) + __Pyx_DECREF(__pyx_t_3); __pyx_t_3 = 0; + __pyx_t_3 = PyList_New(1 * ((__pyx_t_6<0) ? 0:__pyx_t_6)); if (unlikely(!__pyx_t_3)) __PYX_ERR(0, 239, __pyx_L1_error) + __Pyx_GOTREF(__pyx_t_3); + { Py_ssize_t __pyx_temp; + for (__pyx_temp=0; __pyx_temp < __pyx_t_6; __pyx_temp++) { + __Pyx_INCREF(Py_None); + __Pyx_GIVEREF(Py_None); + if (__Pyx_PyList_SET_ITEM(__pyx_t_3, __pyx_temp, Py_None) != (0)) __PYX_ERR(0, 239, __pyx_L1_error); + } + } + __pyx_r = __pyx_t_3; + __pyx_t_3 = 0; + goto __pyx_L0; + } + + /* "spacy/pipeline/_parser_internals/arc_eager.pyx":215 + * + * + * def _get_aligned_sent_starts(example): # <<<<<<<<<<<<<< + * """Get list of SENT_START attributes aligned to the predicted tokenization. + * If the reference has not sentence starts, return a list of None values. +*/ + + /* 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("spacy.pipeline._parser_internals.arc_eager._get_aligned_sent_starts", __pyx_clineno, __pyx_lineno, __pyx_filename); + __pyx_r = NULL; + __pyx_L0:; + __Pyx_XDECREF(__pyx_v_align); + __Pyx_XDECREF(__pyx_v_sent_starts); + __Pyx_XDECREF(__pyx_v_y_sent); + __Pyx_XDECREF(__pyx_v_x_indices); + __Pyx_XDECREF(__pyx_gb_5spacy_8pipeline_17_parser_internals_9arc_eager_24_get_aligned_sent_starts_2generator); + __Pyx_DECREF((PyObject *)__pyx_cur_scope); + __Pyx_XGIVEREF(__pyx_r); + __Pyx_RefNannyFinishContext(); + return __pyx_r; +} + +/* "spacy/pipeline/_parser_internals/arc_eager.pyx":242 + * + * + * cdef int check_state_gold(char state_bits, char flag) noexcept nogil: # <<<<<<<<<<<<<< + * cdef char one = 1 + * return 1 if (state_bits & (one << flag)) else 0 +*/ + +static int __pyx_f_5spacy_8pipeline_17_parser_internals_9arc_eager_check_state_gold(char __pyx_v_state_bits, char __pyx_v_flag) { + char __pyx_v_one; + int __pyx_r; + int __pyx_t_1; + int __pyx_t_2; + + /* "spacy/pipeline/_parser_internals/arc_eager.pyx":243 + * + * cdef int check_state_gold(char state_bits, char flag) noexcept nogil: + * cdef char one = 1 # <<<<<<<<<<<<<< + * return 1 if (state_bits & (one << flag)) else 0 + * +*/ + __pyx_v_one = 1; + + /* "spacy/pipeline/_parser_internals/arc_eager.pyx":244 + * cdef int check_state_gold(char state_bits, char flag) noexcept nogil: + * cdef char one = 1 + * return 1 if (state_bits & (one << flag)) else 0 # <<<<<<<<<<<<<< + * + * +*/ + __pyx_t_2 = ((__pyx_v_state_bits & (__pyx_v_one << __pyx_v_flag)) != 0); + if (__pyx_t_2) { + __pyx_t_1 = 1; + } else { + __pyx_t_1 = 0; + } + __pyx_r = __pyx_t_1; + goto __pyx_L0; + + /* "spacy/pipeline/_parser_internals/arc_eager.pyx":242 + * + * + * cdef int check_state_gold(char state_bits, char flag) noexcept nogil: # <<<<<<<<<<<<<< + * cdef char one = 1 + * return 1 if (state_bits & (one << flag)) else 0 +*/ + + /* function exit code */ + __pyx_L0:; + return __pyx_r; +} + +/* "spacy/pipeline/_parser_internals/arc_eager.pyx":247 + * + * + * cdef int set_state_flag(char state_bits, char flag, int value) noexcept nogil: # <<<<<<<<<<<<<< + * cdef char one = 1 + * if value: +*/ + +static int __pyx_f_5spacy_8pipeline_17_parser_internals_9arc_eager_set_state_flag(char __pyx_v_state_bits, char __pyx_v_flag, int __pyx_v_value) { + char __pyx_v_one; + int __pyx_r; + int __pyx_t_1; + + /* "spacy/pipeline/_parser_internals/arc_eager.pyx":248 + * + * cdef int set_state_flag(char state_bits, char flag, int value) noexcept nogil: + * cdef char one = 1 # <<<<<<<<<<<<<< + * if value: + * return state_bits | (one << flag) +*/ + __pyx_v_one = 1; + + /* "spacy/pipeline/_parser_internals/arc_eager.pyx":249 + * cdef int set_state_flag(char state_bits, char flag, int value) noexcept nogil: + * cdef char one = 1 + * if value: # <<<<<<<<<<<<<< + * return state_bits | (one << flag) + * else: +*/ + __pyx_t_1 = (__pyx_v_value != 0); + if (__pyx_t_1) { + + /* "spacy/pipeline/_parser_internals/arc_eager.pyx":250 + * cdef char one = 1 + * if value: + * return state_bits | (one << flag) # <<<<<<<<<<<<<< + * else: + * return state_bits & ~(one << flag) +*/ + __pyx_r = (__pyx_v_state_bits | (__pyx_v_one << __pyx_v_flag)); + goto __pyx_L0; + + /* "spacy/pipeline/_parser_internals/arc_eager.pyx":249 + * cdef int set_state_flag(char state_bits, char flag, int value) noexcept nogil: + * cdef char one = 1 + * if value: # <<<<<<<<<<<<<< + * return state_bits | (one << flag) + * else: +*/ + } + + /* "spacy/pipeline/_parser_internals/arc_eager.pyx":252 + * return state_bits | (one << flag) + * else: + * return state_bits & ~(one << flag) # <<<<<<<<<<<<<< + * + * +*/ + /*else*/ { + __pyx_r = (__pyx_v_state_bits & (~(__pyx_v_one << __pyx_v_flag))); + goto __pyx_L0; + } + + /* "spacy/pipeline/_parser_internals/arc_eager.pyx":247 + * + * + * cdef int set_state_flag(char state_bits, char flag, int value) noexcept nogil: # <<<<<<<<<<<<<< + * cdef char one = 1 + * if value: +*/ + + /* function exit code */ + __pyx_L0:; + return __pyx_r; +} + +/* "spacy/pipeline/_parser_internals/arc_eager.pyx":255 + * + * + * cdef int is_head_in_stack(const GoldParseStateC* gold, int i) noexcept nogil: # <<<<<<<<<<<<<< + * return check_state_gold(gold.state_bits[i], HEAD_IN_STACK) + * +*/ + +static int __pyx_f_5spacy_8pipeline_17_parser_internals_9arc_eager_is_head_in_stack(struct __pyx_t_5spacy_8pipeline_17_parser_internals_9arc_eager_GoldParseStateC const *__pyx_v_gold, int __pyx_v_i) { + int __pyx_r; + + /* "spacy/pipeline/_parser_internals/arc_eager.pyx":256 + * + * cdef int is_head_in_stack(const GoldParseStateC* gold, int i) noexcept nogil: + * return check_state_gold(gold.state_bits[i], HEAD_IN_STACK) # <<<<<<<<<<<<<< + * + * +*/ + __pyx_r = __pyx_f_5spacy_8pipeline_17_parser_internals_9arc_eager_check_state_gold((__pyx_v_gold->state_bits[__pyx_v_i]), __pyx_e_5spacy_8pipeline_17_parser_internals_9arc_eager_HEAD_IN_STACK); + goto __pyx_L0; + + /* "spacy/pipeline/_parser_internals/arc_eager.pyx":255 + * + * + * cdef int is_head_in_stack(const GoldParseStateC* gold, int i) noexcept nogil: # <<<<<<<<<<<<<< + * return check_state_gold(gold.state_bits[i], HEAD_IN_STACK) + * +*/ + + /* function exit code */ + __pyx_L0:; + return __pyx_r; +} + +/* "spacy/pipeline/_parser_internals/arc_eager.pyx":259 + * + * + * cdef int is_head_in_buffer(const GoldParseStateC* gold, int i) noexcept nogil: # <<<<<<<<<<<<<< + * return check_state_gold(gold.state_bits[i], HEAD_IN_BUFFER) + * +*/ + +static int __pyx_f_5spacy_8pipeline_17_parser_internals_9arc_eager_is_head_in_buffer(struct __pyx_t_5spacy_8pipeline_17_parser_internals_9arc_eager_GoldParseStateC const *__pyx_v_gold, int __pyx_v_i) { + int __pyx_r; + + /* "spacy/pipeline/_parser_internals/arc_eager.pyx":260 + * + * cdef int is_head_in_buffer(const GoldParseStateC* gold, int i) noexcept nogil: + * return check_state_gold(gold.state_bits[i], HEAD_IN_BUFFER) # <<<<<<<<<<<<<< + * + * +*/ + __pyx_r = __pyx_f_5spacy_8pipeline_17_parser_internals_9arc_eager_check_state_gold((__pyx_v_gold->state_bits[__pyx_v_i]), __pyx_e_5spacy_8pipeline_17_parser_internals_9arc_eager_HEAD_IN_BUFFER); + goto __pyx_L0; + + /* "spacy/pipeline/_parser_internals/arc_eager.pyx":259 + * + * + * cdef int is_head_in_buffer(const GoldParseStateC* gold, int i) noexcept nogil: # <<<<<<<<<<<<<< + * return check_state_gold(gold.state_bits[i], HEAD_IN_BUFFER) + * +*/ + + /* function exit code */ + __pyx_L0:; + return __pyx_r; +} + +/* "spacy/pipeline/_parser_internals/arc_eager.pyx":263 + * + * + * cdef int is_head_unknown(const GoldParseStateC* gold, int i) noexcept nogil: # <<<<<<<<<<<<<< + * return check_state_gold(gold.state_bits[i], HEAD_UNKNOWN) + * +*/ + +static int __pyx_f_5spacy_8pipeline_17_parser_internals_9arc_eager_is_head_unknown(struct __pyx_t_5spacy_8pipeline_17_parser_internals_9arc_eager_GoldParseStateC const *__pyx_v_gold, int __pyx_v_i) { + int __pyx_r; + + /* "spacy/pipeline/_parser_internals/arc_eager.pyx":264 + * + * cdef int is_head_unknown(const GoldParseStateC* gold, int i) noexcept nogil: + * return check_state_gold(gold.state_bits[i], HEAD_UNKNOWN) # <<<<<<<<<<<<<< + * + * cdef int is_sent_start(const GoldParseStateC* gold, int i) noexcept nogil: +*/ + __pyx_r = __pyx_f_5spacy_8pipeline_17_parser_internals_9arc_eager_check_state_gold((__pyx_v_gold->state_bits[__pyx_v_i]), __pyx_e_5spacy_8pipeline_17_parser_internals_9arc_eager_HEAD_UNKNOWN); + goto __pyx_L0; + + /* "spacy/pipeline/_parser_internals/arc_eager.pyx":263 + * + * + * cdef int is_head_unknown(const GoldParseStateC* gold, int i) noexcept nogil: # <<<<<<<<<<<<<< + * return check_state_gold(gold.state_bits[i], HEAD_UNKNOWN) + * +*/ + + /* function exit code */ + __pyx_L0:; + return __pyx_r; +} + +/* "spacy/pipeline/_parser_internals/arc_eager.pyx":266 + * return check_state_gold(gold.state_bits[i], HEAD_UNKNOWN) + * + * cdef int is_sent_start(const GoldParseStateC* gold, int i) noexcept nogil: # <<<<<<<<<<<<<< + * return check_state_gold(gold.state_bits[i], IS_SENT_START) + * +*/ + +static int __pyx_f_5spacy_8pipeline_17_parser_internals_9arc_eager_is_sent_start(struct __pyx_t_5spacy_8pipeline_17_parser_internals_9arc_eager_GoldParseStateC const *__pyx_v_gold, int __pyx_v_i) { + int __pyx_r; + + /* "spacy/pipeline/_parser_internals/arc_eager.pyx":267 + * + * cdef int is_sent_start(const GoldParseStateC* gold, int i) noexcept nogil: + * return check_state_gold(gold.state_bits[i], IS_SENT_START) # <<<<<<<<<<<<<< + * + * cdef int is_sent_start_unknown(const GoldParseStateC* gold, int i) noexcept nogil: +*/ + __pyx_r = __pyx_f_5spacy_8pipeline_17_parser_internals_9arc_eager_check_state_gold((__pyx_v_gold->state_bits[__pyx_v_i]), __pyx_e_5spacy_8pipeline_17_parser_internals_9arc_eager_IS_SENT_START); + goto __pyx_L0; + + /* "spacy/pipeline/_parser_internals/arc_eager.pyx":266 + * return check_state_gold(gold.state_bits[i], HEAD_UNKNOWN) + * + * cdef int is_sent_start(const GoldParseStateC* gold, int i) noexcept nogil: # <<<<<<<<<<<<<< + * return check_state_gold(gold.state_bits[i], IS_SENT_START) + * +*/ + + /* function exit code */ + __pyx_L0:; + return __pyx_r; +} + +/* "spacy/pipeline/_parser_internals/arc_eager.pyx":269 + * return check_state_gold(gold.state_bits[i], IS_SENT_START) + * + * cdef int is_sent_start_unknown(const GoldParseStateC* gold, int i) noexcept nogil: # <<<<<<<<<<<<<< + * return check_state_gold(gold.state_bits[i], SENT_START_UNKNOWN) + * +*/ + +static int __pyx_f_5spacy_8pipeline_17_parser_internals_9arc_eager_is_sent_start_unknown(struct __pyx_t_5spacy_8pipeline_17_parser_internals_9arc_eager_GoldParseStateC const *__pyx_v_gold, int __pyx_v_i) { + int __pyx_r; + + /* "spacy/pipeline/_parser_internals/arc_eager.pyx":270 + * + * cdef int is_sent_start_unknown(const GoldParseStateC* gold, int i) noexcept nogil: + * return check_state_gold(gold.state_bits[i], SENT_START_UNKNOWN) # <<<<<<<<<<<<<< + * + * +*/ + __pyx_r = __pyx_f_5spacy_8pipeline_17_parser_internals_9arc_eager_check_state_gold((__pyx_v_gold->state_bits[__pyx_v_i]), __pyx_e_5spacy_8pipeline_17_parser_internals_9arc_eager_SENT_START_UNKNOWN); + goto __pyx_L0; + + /* "spacy/pipeline/_parser_internals/arc_eager.pyx":269 + * return check_state_gold(gold.state_bits[i], IS_SENT_START) + * + * cdef int is_sent_start_unknown(const GoldParseStateC* gold, int i) noexcept nogil: # <<<<<<<<<<<<<< + * return check_state_gold(gold.state_bits[i], SENT_START_UNKNOWN) + * +*/ + + /* function exit code */ + __pyx_L0:; + return __pyx_r; +} + +/* "spacy/pipeline/_parser_internals/arc_eager.pyx":275 + * # Helper functions for the arc-eager oracle + * + * cdef weight_t push_cost(const StateC* state, const GoldParseStateC* gold) noexcept nogil: # <<<<<<<<<<<<<< + * cdef weight_t cost = 0 + * b0 = state.B(0) +*/ + +static __pyx_t_5spacy_8typedefs_weight_t __pyx_f_5spacy_8pipeline_17_parser_internals_9arc_eager_push_cost(__pyx_t_5spacy_8pipeline_17_parser_internals_6_state_StateC const *__pyx_v_state, struct __pyx_t_5spacy_8pipeline_17_parser_internals_9arc_eager_GoldParseStateC const *__pyx_v_gold) { + __pyx_t_5spacy_8typedefs_weight_t __pyx_v_cost; + int __pyx_v_b0; + __pyx_t_5spacy_8typedefs_weight_t __pyx_r; + int __pyx_t_1; + int __pyx_t_2; + + /* "spacy/pipeline/_parser_internals/arc_eager.pyx":276 + * + * cdef weight_t push_cost(const StateC* state, const GoldParseStateC* gold) noexcept nogil: + * cdef weight_t cost = 0 # <<<<<<<<<<<<<< + * b0 = state.B(0) + * if b0 < 0: +*/ + __pyx_v_cost = 0.0; + + /* "spacy/pipeline/_parser_internals/arc_eager.pyx":277 + * cdef weight_t push_cost(const StateC* state, const GoldParseStateC* gold) noexcept nogil: + * cdef weight_t cost = 0 + * b0 = state.B(0) # <<<<<<<<<<<<<< + * if b0 < 0: + * return 9000 +*/ + __pyx_v_b0 = __pyx_v_state->B(0); + + /* "spacy/pipeline/_parser_internals/arc_eager.pyx":278 + * cdef weight_t cost = 0 + * b0 = state.B(0) + * if b0 < 0: # <<<<<<<<<<<<<< + * return 9000 + * if is_head_in_stack(gold, b0): +*/ + __pyx_t_1 = (__pyx_v_b0 < 0); + if (__pyx_t_1) { + + /* "spacy/pipeline/_parser_internals/arc_eager.pyx":279 + * b0 = state.B(0) + * if b0 < 0: + * return 9000 # <<<<<<<<<<<<<< + * if is_head_in_stack(gold, b0): + * cost += 1 +*/ + __pyx_r = 9000.0; + goto __pyx_L0; + + /* "spacy/pipeline/_parser_internals/arc_eager.pyx":278 + * cdef weight_t cost = 0 + * b0 = state.B(0) + * if b0 < 0: # <<<<<<<<<<<<<< + * return 9000 + * if is_head_in_stack(gold, b0): +*/ + } + + /* "spacy/pipeline/_parser_internals/arc_eager.pyx":280 + * if b0 < 0: + * return 9000 + * if is_head_in_stack(gold, b0): # <<<<<<<<<<<<<< + * cost += 1 + * cost += gold.n_kids_in_stack[b0] +*/ + __pyx_t_1 = (__pyx_f_5spacy_8pipeline_17_parser_internals_9arc_eager_is_head_in_stack(__pyx_v_gold, __pyx_v_b0) != 0); + if (__pyx_t_1) { + + /* "spacy/pipeline/_parser_internals/arc_eager.pyx":281 + * return 9000 + * if is_head_in_stack(gold, b0): + * cost += 1 # <<<<<<<<<<<<<< + * cost += gold.n_kids_in_stack[b0] + * if Break.is_valid(state, 0) and is_sent_start(gold, state.B(1)): +*/ + __pyx_v_cost = (__pyx_v_cost + 1.0); + + /* "spacy/pipeline/_parser_internals/arc_eager.pyx":280 + * if b0 < 0: + * return 9000 + * if is_head_in_stack(gold, b0): # <<<<<<<<<<<<<< + * cost += 1 + * cost += gold.n_kids_in_stack[b0] +*/ + } + + /* "spacy/pipeline/_parser_internals/arc_eager.pyx":282 + * if is_head_in_stack(gold, b0): + * cost += 1 + * cost += gold.n_kids_in_stack[b0] # <<<<<<<<<<<<<< + * if Break.is_valid(state, 0) and is_sent_start(gold, state.B(1)): + * cost += 1 +*/ + __pyx_v_cost = (__pyx_v_cost + (__pyx_v_gold->n_kids_in_stack[__pyx_v_b0])); + + /* "spacy/pipeline/_parser_internals/arc_eager.pyx":283 + * cost += 1 + * cost += gold.n_kids_in_stack[b0] + * if Break.is_valid(state, 0) and is_sent_start(gold, state.B(1)): # <<<<<<<<<<<<<< + * cost += 1 + * return cost +*/ + __pyx_t_2 = __pyx_f_5spacy_8pipeline_17_parser_internals_9arc_eager_5Break_is_valid(__pyx_v_state, 0); + if (__pyx_t_2) { + } else { + __pyx_t_1 = __pyx_t_2; + goto __pyx_L6_bool_binop_done; + } + __pyx_t_2 = (__pyx_f_5spacy_8pipeline_17_parser_internals_9arc_eager_is_sent_start(__pyx_v_gold, __pyx_v_state->B(1)) != 0); + __pyx_t_1 = __pyx_t_2; + __pyx_L6_bool_binop_done:; + if (__pyx_t_1) { + + /* "spacy/pipeline/_parser_internals/arc_eager.pyx":284 + * cost += gold.n_kids_in_stack[b0] + * if Break.is_valid(state, 0) and is_sent_start(gold, state.B(1)): + * cost += 1 # <<<<<<<<<<<<<< + * return cost + * +*/ + __pyx_v_cost = (__pyx_v_cost + 1.0); + + /* "spacy/pipeline/_parser_internals/arc_eager.pyx":283 + * cost += 1 + * cost += gold.n_kids_in_stack[b0] + * if Break.is_valid(state, 0) and is_sent_start(gold, state.B(1)): # <<<<<<<<<<<<<< + * cost += 1 + * return cost +*/ + } + + /* "spacy/pipeline/_parser_internals/arc_eager.pyx":285 + * if Break.is_valid(state, 0) and is_sent_start(gold, state.B(1)): + * cost += 1 + * return cost # <<<<<<<<<<<<<< + * + * +*/ + __pyx_r = __pyx_v_cost; + goto __pyx_L0; + + /* "spacy/pipeline/_parser_internals/arc_eager.pyx":275 + * # Helper functions for the arc-eager oracle + * + * cdef weight_t push_cost(const StateC* state, const GoldParseStateC* gold) noexcept nogil: # <<<<<<<<<<<<<< + * cdef weight_t cost = 0 + * b0 = state.B(0) +*/ + + /* function exit code */ + __pyx_L0:; + return __pyx_r; +} + +/* "spacy/pipeline/_parser_internals/arc_eager.pyx":288 + * + * + * cdef weight_t pop_cost(const StateC* state, const GoldParseStateC* gold) noexcept nogil: # <<<<<<<<<<<<<< + * cdef weight_t cost = 0 + * s0 = state.S(0) +*/ + +static __pyx_t_5spacy_8typedefs_weight_t __pyx_f_5spacy_8pipeline_17_parser_internals_9arc_eager_pop_cost(__pyx_t_5spacy_8pipeline_17_parser_internals_6_state_StateC const *__pyx_v_state, struct __pyx_t_5spacy_8pipeline_17_parser_internals_9arc_eager_GoldParseStateC const *__pyx_v_gold) { + __pyx_t_5spacy_8typedefs_weight_t __pyx_v_cost; + int __pyx_v_s0; + __pyx_t_5spacy_8typedefs_weight_t __pyx_r; + int __pyx_t_1; + + /* "spacy/pipeline/_parser_internals/arc_eager.pyx":289 + * + * cdef weight_t pop_cost(const StateC* state, const GoldParseStateC* gold) noexcept nogil: + * cdef weight_t cost = 0 # <<<<<<<<<<<<<< + * s0 = state.S(0) + * if s0 < 0: +*/ + __pyx_v_cost = 0.0; + + /* "spacy/pipeline/_parser_internals/arc_eager.pyx":290 + * cdef weight_t pop_cost(const StateC* state, const GoldParseStateC* gold) noexcept nogil: + * cdef weight_t cost = 0 + * s0 = state.S(0) # <<<<<<<<<<<<<< + * if s0 < 0: + * return 9000 +*/ + __pyx_v_s0 = __pyx_v_state->S(0); + + /* "spacy/pipeline/_parser_internals/arc_eager.pyx":291 + * cdef weight_t cost = 0 + * s0 = state.S(0) + * if s0 < 0: # <<<<<<<<<<<<<< + * return 9000 + * if is_head_in_buffer(gold, s0): +*/ + __pyx_t_1 = (__pyx_v_s0 < 0); + if (__pyx_t_1) { + + /* "spacy/pipeline/_parser_internals/arc_eager.pyx":292 + * s0 = state.S(0) + * if s0 < 0: + * return 9000 # <<<<<<<<<<<<<< + * if is_head_in_buffer(gold, s0): + * cost += 1 +*/ + __pyx_r = 9000.0; + goto __pyx_L0; + + /* "spacy/pipeline/_parser_internals/arc_eager.pyx":291 + * cdef weight_t cost = 0 + * s0 = state.S(0) + * if s0 < 0: # <<<<<<<<<<<<<< + * return 9000 + * if is_head_in_buffer(gold, s0): +*/ + } + + /* "spacy/pipeline/_parser_internals/arc_eager.pyx":293 + * if s0 < 0: + * return 9000 + * if is_head_in_buffer(gold, s0): # <<<<<<<<<<<<<< + * cost += 1 + * cost += gold.n_kids_in_buffer[s0] +*/ + __pyx_t_1 = (__pyx_f_5spacy_8pipeline_17_parser_internals_9arc_eager_is_head_in_buffer(__pyx_v_gold, __pyx_v_s0) != 0); + if (__pyx_t_1) { + + /* "spacy/pipeline/_parser_internals/arc_eager.pyx":294 + * return 9000 + * if is_head_in_buffer(gold, s0): + * cost += 1 # <<<<<<<<<<<<<< + * cost += gold.n_kids_in_buffer[s0] + * return cost +*/ + __pyx_v_cost = (__pyx_v_cost + 1.0); + + /* "spacy/pipeline/_parser_internals/arc_eager.pyx":293 + * if s0 < 0: + * return 9000 + * if is_head_in_buffer(gold, s0): # <<<<<<<<<<<<<< + * cost += 1 + * cost += gold.n_kids_in_buffer[s0] +*/ + } + + /* "spacy/pipeline/_parser_internals/arc_eager.pyx":295 + * if is_head_in_buffer(gold, s0): + * cost += 1 + * cost += gold.n_kids_in_buffer[s0] # <<<<<<<<<<<<<< + * return cost + * +*/ + __pyx_v_cost = (__pyx_v_cost + (__pyx_v_gold->n_kids_in_buffer[__pyx_v_s0])); + + /* "spacy/pipeline/_parser_internals/arc_eager.pyx":296 + * cost += 1 + * cost += gold.n_kids_in_buffer[s0] + * return cost # <<<<<<<<<<<<<< + * + * +*/ + __pyx_r = __pyx_v_cost; + goto __pyx_L0; + + /* "spacy/pipeline/_parser_internals/arc_eager.pyx":288 + * + * + * cdef weight_t pop_cost(const StateC* state, const GoldParseStateC* gold) noexcept nogil: # <<<<<<<<<<<<<< + * cdef weight_t cost = 0 + * s0 = state.S(0) +*/ + + /* function exit code */ + __pyx_L0:; + return __pyx_r; +} + +/* "spacy/pipeline/_parser_internals/arc_eager.pyx":299 + * + * + * cdef bint arc_is_gold(const GoldParseStateC* gold, int head, int child) noexcept nogil: # <<<<<<<<<<<<<< + * if is_head_unknown(gold, child): + * return True +*/ + +static int __pyx_f_5spacy_8pipeline_17_parser_internals_9arc_eager_arc_is_gold(struct __pyx_t_5spacy_8pipeline_17_parser_internals_9arc_eager_GoldParseStateC const *__pyx_v_gold, int __pyx_v_head, int __pyx_v_child) { + int __pyx_r; + int __pyx_t_1; + + /* "spacy/pipeline/_parser_internals/arc_eager.pyx":300 + * + * cdef bint arc_is_gold(const GoldParseStateC* gold, int head, int child) noexcept nogil: + * if is_head_unknown(gold, child): # <<<<<<<<<<<<<< + * return True + * elif gold.heads[child] == head: +*/ + __pyx_t_1 = (__pyx_f_5spacy_8pipeline_17_parser_internals_9arc_eager_is_head_unknown(__pyx_v_gold, __pyx_v_child) != 0); + if (__pyx_t_1) { + + /* "spacy/pipeline/_parser_internals/arc_eager.pyx":301 + * cdef bint arc_is_gold(const GoldParseStateC* gold, int head, int child) noexcept nogil: + * if is_head_unknown(gold, child): + * return True # <<<<<<<<<<<<<< + * elif gold.heads[child] == head: + * return True +*/ + __pyx_r = 1; + goto __pyx_L0; + + /* "spacy/pipeline/_parser_internals/arc_eager.pyx":300 + * + * cdef bint arc_is_gold(const GoldParseStateC* gold, int head, int child) noexcept nogil: + * if is_head_unknown(gold, child): # <<<<<<<<<<<<<< + * return True + * elif gold.heads[child] == head: +*/ + } + + /* "spacy/pipeline/_parser_internals/arc_eager.pyx":302 + * if is_head_unknown(gold, child): + * return True + * elif gold.heads[child] == head: # <<<<<<<<<<<<<< + * return True + * else: +*/ + __pyx_t_1 = ((__pyx_v_gold->heads[__pyx_v_child]) == __pyx_v_head); + if (__pyx_t_1) { + + /* "spacy/pipeline/_parser_internals/arc_eager.pyx":303 + * return True + * elif gold.heads[child] == head: + * return True # <<<<<<<<<<<<<< + * else: + * return False +*/ + __pyx_r = 1; + goto __pyx_L0; + + /* "spacy/pipeline/_parser_internals/arc_eager.pyx":302 + * if is_head_unknown(gold, child): + * return True + * elif gold.heads[child] == head: # <<<<<<<<<<<<<< + * return True + * else: +*/ + } + + /* "spacy/pipeline/_parser_internals/arc_eager.pyx":305 + * return True + * else: + * return False # <<<<<<<<<<<<<< + * + * +*/ + /*else*/ { + __pyx_r = 0; + goto __pyx_L0; + } + + /* "spacy/pipeline/_parser_internals/arc_eager.pyx":299 + * + * + * cdef bint arc_is_gold(const GoldParseStateC* gold, int head, int child) noexcept nogil: # <<<<<<<<<<<<<< + * if is_head_unknown(gold, child): + * return True +*/ + + /* function exit code */ + __pyx_L0:; + return __pyx_r; +} + +/* "spacy/pipeline/_parser_internals/arc_eager.pyx":308 + * + * + * cdef bint label_is_gold(const GoldParseStateC* gold, int child, attr_t label) noexcept nogil: # <<<<<<<<<<<<<< + * if is_head_unknown(gold, child): + * return True +*/ + +static int __pyx_f_5spacy_8pipeline_17_parser_internals_9arc_eager_label_is_gold(struct __pyx_t_5spacy_8pipeline_17_parser_internals_9arc_eager_GoldParseStateC const *__pyx_v_gold, int __pyx_v_child, __pyx_t_5spacy_8typedefs_attr_t __pyx_v_label) { + int __pyx_r; + int __pyx_t_1; + + /* "spacy/pipeline/_parser_internals/arc_eager.pyx":309 + * + * cdef bint label_is_gold(const GoldParseStateC* gold, int child, attr_t label) noexcept nogil: + * if is_head_unknown(gold, child): # <<<<<<<<<<<<<< + * return True + * elif label == 0: +*/ + __pyx_t_1 = (__pyx_f_5spacy_8pipeline_17_parser_internals_9arc_eager_is_head_unknown(__pyx_v_gold, __pyx_v_child) != 0); + if (__pyx_t_1) { + + /* "spacy/pipeline/_parser_internals/arc_eager.pyx":310 + * cdef bint label_is_gold(const GoldParseStateC* gold, int child, attr_t label) noexcept nogil: + * if is_head_unknown(gold, child): + * return True # <<<<<<<<<<<<<< + * elif label == 0: + * return True +*/ + __pyx_r = 1; + goto __pyx_L0; + + /* "spacy/pipeline/_parser_internals/arc_eager.pyx":309 + * + * cdef bint label_is_gold(const GoldParseStateC* gold, int child, attr_t label) noexcept nogil: + * if is_head_unknown(gold, child): # <<<<<<<<<<<<<< + * return True + * elif label == 0: +*/ + } + + /* "spacy/pipeline/_parser_internals/arc_eager.pyx":311 + * if is_head_unknown(gold, child): + * return True + * elif label == 0: # <<<<<<<<<<<<<< + * return True + * elif gold.labels[child] == label: +*/ + __pyx_t_1 = (__pyx_v_label == 0); + if (__pyx_t_1) { + + /* "spacy/pipeline/_parser_internals/arc_eager.pyx":312 + * return True + * elif label == 0: + * return True # <<<<<<<<<<<<<< + * elif gold.labels[child] == label: + * return True +*/ + __pyx_r = 1; + goto __pyx_L0; + + /* "spacy/pipeline/_parser_internals/arc_eager.pyx":311 + * if is_head_unknown(gold, child): + * return True + * elif label == 0: # <<<<<<<<<<<<<< + * return True + * elif gold.labels[child] == label: +*/ + } + + /* "spacy/pipeline/_parser_internals/arc_eager.pyx":313 + * elif label == 0: + * return True + * elif gold.labels[child] == label: # <<<<<<<<<<<<<< + * return True + * else: +*/ + __pyx_t_1 = ((__pyx_v_gold->labels[__pyx_v_child]) == __pyx_v_label); + if (__pyx_t_1) { + + /* "spacy/pipeline/_parser_internals/arc_eager.pyx":314 + * return True + * elif gold.labels[child] == label: + * return True # <<<<<<<<<<<<<< + * else: + * return False +*/ + __pyx_r = 1; + goto __pyx_L0; + + /* "spacy/pipeline/_parser_internals/arc_eager.pyx":313 + * elif label == 0: + * return True + * elif gold.labels[child] == label: # <<<<<<<<<<<<<< + * return True + * else: +*/ + } + + /* "spacy/pipeline/_parser_internals/arc_eager.pyx":316 + * return True + * else: + * return False # <<<<<<<<<<<<<< + * + * +*/ + /*else*/ { + __pyx_r = 0; + goto __pyx_L0; + } + + /* "spacy/pipeline/_parser_internals/arc_eager.pyx":308 + * + * + * cdef bint label_is_gold(const GoldParseStateC* gold, int child, attr_t label) noexcept nogil: # <<<<<<<<<<<<<< + * if is_head_unknown(gold, child): + * return True +*/ + + /* function exit code */ + __pyx_L0:; + return __pyx_r; +} + +/* "spacy/pipeline/_parser_internals/arc_eager.pyx":319 + * + * + * cdef bint _is_gold_root(const GoldParseStateC* gold, int word) noexcept nogil: # <<<<<<<<<<<<<< + * return gold.heads[word] == word or is_head_unknown(gold, word) + * +*/ + +static int __pyx_f_5spacy_8pipeline_17_parser_internals_9arc_eager__is_gold_root(struct __pyx_t_5spacy_8pipeline_17_parser_internals_9arc_eager_GoldParseStateC const *__pyx_v_gold, int __pyx_v_word) { + int __pyx_r; + int __pyx_t_1; + int __pyx_t_2; + + /* "spacy/pipeline/_parser_internals/arc_eager.pyx":320 + * + * cdef bint _is_gold_root(const GoldParseStateC* gold, int word) noexcept nogil: + * return gold.heads[word] == word or is_head_unknown(gold, word) # <<<<<<<<<<<<<< + * + * +*/ + __pyx_t_2 = ((__pyx_v_gold->heads[__pyx_v_word]) == __pyx_v_word); + if (!__pyx_t_2) { + } else { + __pyx_t_1 = __pyx_t_2; + goto __pyx_L3_bool_binop_done; + } + __pyx_t_2 = (__pyx_f_5spacy_8pipeline_17_parser_internals_9arc_eager_is_head_unknown(__pyx_v_gold, __pyx_v_word) != 0); + __pyx_t_1 = __pyx_t_2; + __pyx_L3_bool_binop_done:; + __pyx_r = __pyx_t_1; + goto __pyx_L0; + + /* "spacy/pipeline/_parser_internals/arc_eager.pyx":319 + * + * + * cdef bint _is_gold_root(const GoldParseStateC* gold, int word) noexcept nogil: # <<<<<<<<<<<<<< + * return gold.heads[word] == word or is_head_unknown(gold, word) + * +*/ + + /* function exit code */ + __pyx_L0:; + return __pyx_r; +} + +/* "spacy/pipeline/_parser_internals/arc_eager.pyx":338 + * * Advance buffer + * """ + * @staticmethod # <<<<<<<<<<<<<< + * cdef bint is_valid(const StateC* st, attr_t label) noexcept nogil: + * if st.stack_depth() == 0: +*/ + +static int __pyx_f_5spacy_8pipeline_17_parser_internals_9arc_eager_5Shift_is_valid(__pyx_t_5spacy_8pipeline_17_parser_internals_6_state_StateC const *__pyx_v_st, CYTHON_UNUSED __pyx_t_5spacy_8typedefs_attr_t __pyx_v_label) { + int __pyx_r; + int __pyx_t_1; + + /* "spacy/pipeline/_parser_internals/arc_eager.pyx":340 + * @staticmethod + * cdef bint is_valid(const StateC* st, attr_t label) noexcept nogil: + * if st.stack_depth() == 0: # <<<<<<<<<<<<<< + * return 1 + * elif st.buffer_length() < 2: +*/ + __pyx_t_1 = (__pyx_v_st->stack_depth() == 0); + if (__pyx_t_1) { + + /* "spacy/pipeline/_parser_internals/arc_eager.pyx":341 + * cdef bint is_valid(const StateC* st, attr_t label) noexcept nogil: + * if st.stack_depth() == 0: + * return 1 # <<<<<<<<<<<<<< + * elif st.buffer_length() < 2: + * return 0 +*/ + __pyx_r = 1; + goto __pyx_L0; + + /* "spacy/pipeline/_parser_internals/arc_eager.pyx":340 + * @staticmethod + * cdef bint is_valid(const StateC* st, attr_t label) noexcept nogil: + * if st.stack_depth() == 0: # <<<<<<<<<<<<<< + * return 1 + * elif st.buffer_length() < 2: +*/ + } + + /* "spacy/pipeline/_parser_internals/arc_eager.pyx":342 + * if st.stack_depth() == 0: + * return 1 + * elif st.buffer_length() < 2: # <<<<<<<<<<<<<< + * return 0 + * elif st.is_sent_start(st.B(0)): +*/ + __pyx_t_1 = (__pyx_v_st->buffer_length() < 2); + if (__pyx_t_1) { + + /* "spacy/pipeline/_parser_internals/arc_eager.pyx":343 + * return 1 + * elif st.buffer_length() < 2: + * return 0 # <<<<<<<<<<<<<< + * elif st.is_sent_start(st.B(0)): + * return 0 +*/ + __pyx_r = 0; + goto __pyx_L0; + + /* "spacy/pipeline/_parser_internals/arc_eager.pyx":342 + * if st.stack_depth() == 0: + * return 1 + * elif st.buffer_length() < 2: # <<<<<<<<<<<<<< + * return 0 + * elif st.is_sent_start(st.B(0)): +*/ + } + + /* "spacy/pipeline/_parser_internals/arc_eager.pyx":344 + * elif st.buffer_length() < 2: + * return 0 + * elif st.is_sent_start(st.B(0)): # <<<<<<<<<<<<<< + * return 0 + * elif st.is_unshiftable(st.B(0)): +*/ + __pyx_t_1 = (__pyx_v_st->is_sent_start(__pyx_v_st->B(0)) != 0); + if (__pyx_t_1) { + + /* "spacy/pipeline/_parser_internals/arc_eager.pyx":345 + * return 0 + * elif st.is_sent_start(st.B(0)): + * return 0 # <<<<<<<<<<<<<< + * elif st.is_unshiftable(st.B(0)): + * return 0 +*/ + __pyx_r = 0; + goto __pyx_L0; + + /* "spacy/pipeline/_parser_internals/arc_eager.pyx":344 + * elif st.buffer_length() < 2: + * return 0 + * elif st.is_sent_start(st.B(0)): # <<<<<<<<<<<<<< + * return 0 + * elif st.is_unshiftable(st.B(0)): +*/ + } + + /* "spacy/pipeline/_parser_internals/arc_eager.pyx":346 + * elif st.is_sent_start(st.B(0)): + * return 0 + * elif st.is_unshiftable(st.B(0)): # <<<<<<<<<<<<<< + * return 0 + * else: +*/ + __pyx_t_1 = (__pyx_v_st->is_unshiftable(__pyx_v_st->B(0)) != 0); + if (__pyx_t_1) { + + /* "spacy/pipeline/_parser_internals/arc_eager.pyx":347 + * return 0 + * elif st.is_unshiftable(st.B(0)): + * return 0 # <<<<<<<<<<<<<< + * else: + * return 1 +*/ + __pyx_r = 0; + goto __pyx_L0; + + /* "spacy/pipeline/_parser_internals/arc_eager.pyx":346 + * elif st.is_sent_start(st.B(0)): + * return 0 + * elif st.is_unshiftable(st.B(0)): # <<<<<<<<<<<<<< + * return 0 + * else: +*/ + } + + /* "spacy/pipeline/_parser_internals/arc_eager.pyx":349 + * return 0 + * else: + * return 1 # <<<<<<<<<<<<<< + * + * @staticmethod +*/ + /*else*/ { + __pyx_r = 1; + goto __pyx_L0; + } + + /* "spacy/pipeline/_parser_internals/arc_eager.pyx":338 + * * Advance buffer + * """ + * @staticmethod # <<<<<<<<<<<<<< + * cdef bint is_valid(const StateC* st, attr_t label) noexcept nogil: + * if st.stack_depth() == 0: +*/ + + /* function exit code */ + __pyx_L0:; + return __pyx_r; +} + +/* "spacy/pipeline/_parser_internals/arc_eager.pyx":351 + * return 1 + * + * @staticmethod # <<<<<<<<<<<<<< + * cdef int transition(StateC* st, attr_t label) noexcept nogil: + * st.push() +*/ + +static int __pyx_f_5spacy_8pipeline_17_parser_internals_9arc_eager_5Shift_transition(__pyx_t_5spacy_8pipeline_17_parser_internals_6_state_StateC *__pyx_v_st, CYTHON_UNUSED __pyx_t_5spacy_8typedefs_attr_t __pyx_v_label) { + int __pyx_r; + + /* "spacy/pipeline/_parser_internals/arc_eager.pyx":353 + * @staticmethod + * cdef int transition(StateC* st, attr_t label) noexcept nogil: + * st.push() # <<<<<<<<<<<<<< + * + * @staticmethod +*/ + __pyx_v_st->push(); + + /* "spacy/pipeline/_parser_internals/arc_eager.pyx":351 + * return 1 + * + * @staticmethod # <<<<<<<<<<<<<< + * cdef int transition(StateC* st, attr_t label) noexcept nogil: + * st.push() +*/ + + /* function exit code */ + __pyx_r = 0; + return __pyx_r; +} + +/* "spacy/pipeline/_parser_internals/arc_eager.pyx":355 + * st.push() + * + * @staticmethod # <<<<<<<<<<<<<< + * cdef weight_t cost(const StateC* state, const void* _gold, attr_t label) noexcept nogil: + * gold = _gold +*/ + +static __pyx_t_5spacy_8typedefs_weight_t __pyx_f_5spacy_8pipeline_17_parser_internals_9arc_eager_5Shift_cost(CYTHON_UNUSED __pyx_t_5spacy_8pipeline_17_parser_internals_6_state_StateC const *__pyx_v_state, void const *__pyx_v__gold, CYTHON_UNUSED __pyx_t_5spacy_8typedefs_attr_t __pyx_v_label) { + struct __pyx_t_5spacy_8pipeline_17_parser_internals_9arc_eager_GoldParseStateC const *__pyx_v_gold; + __pyx_t_5spacy_8typedefs_weight_t __pyx_r; + + /* "spacy/pipeline/_parser_internals/arc_eager.pyx":357 + * @staticmethod + * cdef weight_t cost(const StateC* state, const void* _gold, attr_t label) noexcept nogil: + * gold = _gold # <<<<<<<<<<<<<< + * return gold.push_cost + * +*/ + __pyx_v_gold = ((struct __pyx_t_5spacy_8pipeline_17_parser_internals_9arc_eager_GoldParseStateC const *)__pyx_v__gold); + + /* "spacy/pipeline/_parser_internals/arc_eager.pyx":358 + * cdef weight_t cost(const StateC* state, const void* _gold, attr_t label) noexcept nogil: + * gold = _gold + * return gold.push_cost # <<<<<<<<<<<<<< + * + * +*/ + __pyx_r = __pyx_v_gold->push_cost; + goto __pyx_L0; + + /* "spacy/pipeline/_parser_internals/arc_eager.pyx":355 + * st.push() + * + * @staticmethod # <<<<<<<<<<<<<< + * cdef weight_t cost(const StateC* state, const void* _gold, attr_t label) noexcept nogil: + * gold = _gold +*/ + + /* function exit code */ + __pyx_L0:; + return __pyx_r; +} + +/* "(tree fragment)":1 + * def __reduce_cython__(self): # <<<<<<<<<<<<<< + * cdef tuple state + * cdef object _dict +*/ + +/* Python wrapper */ +static PyObject *__pyx_pw_5spacy_8pipeline_17_parser_internals_9arc_eager_5Shift_1__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_5spacy_8pipeline_17_parser_internals_9arc_eager_5Shift___reduce_cython__, "Shift.__reduce_cython__(self)"); +static PyMethodDef __pyx_mdef_5spacy_8pipeline_17_parser_internals_9arc_eager_5Shift_1__reduce_cython__ = {"__reduce_cython__", (PyCFunction)(void(*)(void))(__Pyx_PyCFunction_FastCallWithKeywords)__pyx_pw_5spacy_8pipeline_17_parser_internals_9arc_eager_5Shift_1__reduce_cython__, __Pyx_METH_FASTCALL|METH_KEYWORDS, __pyx_doc_5spacy_8pipeline_17_parser_internals_9arc_eager_5Shift___reduce_cython__}; +static PyObject *__pyx_pw_5spacy_8pipeline_17_parser_internals_9arc_eager_5Shift_1__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_5spacy_8pipeline_17_parser_internals_9arc_eager_5Shift___reduce_cython__(((struct __pyx_obj_5spacy_8pipeline_17_parser_internals_9arc_eager_Shift *)__pyx_v_self)); + + /* function exit code */ + __Pyx_RefNannyFinishContext(); + return __pyx_r; +} + +static PyObject *__pyx_pf_5spacy_8pipeline_17_parser_internals_9arc_eager_5Shift___reduce_cython__(struct __pyx_obj_5spacy_8pipeline_17_parser_internals_9arc_eager_Shift *__pyx_v_self) { + PyObject *__pyx_v_state = 0; + PyObject *__pyx_v__dict = 0; + int __pyx_v_use_setstate; + PyObject *__pyx_r = NULL; + __Pyx_RefNannyDeclarations + PyObject *__pyx_t_1 = NULL; + int __pyx_t_2; + int __pyx_t_3; + PyObject *__pyx_t_4 = NULL; + PyObject *__pyx_t_5 = NULL; + int __pyx_lineno = 0; + const char *__pyx_filename = NULL; + int __pyx_clineno = 0; + __Pyx_RefNannySetupContext("__reduce_cython__", 0); + + /* "(tree fragment)":5 + * cdef object _dict + * cdef bint use_setstate + * state = () # <<<<<<<<<<<<<< + * _dict = getattr(self, '__dict__', None) + * if _dict is not None and _dict: +*/ + __Pyx_INCREF(__pyx_mstate_global->__pyx_empty_tuple); + __pyx_v_state = __pyx_mstate_global->__pyx_empty_tuple; + + /* "(tree fragment)":6 + * cdef bint use_setstate + * state = () + * _dict = getattr(self, '__dict__', None) # <<<<<<<<<<<<<< + * if _dict is not None and _dict: + * state += (_dict,) +*/ + __pyx_t_1 = __Pyx_GetAttr3(((PyObject *)__pyx_v_self), __pyx_mstate_global->__pyx_n_u_dict, Py_None); if (unlikely(!__pyx_t_1)) __PYX_ERR(1, 6, __pyx_L1_error) + __Pyx_GOTREF(__pyx_t_1); + __pyx_v__dict = __pyx_t_1; + __pyx_t_1 = 0; + + /* "(tree fragment)":7 + * state = () + * _dict = getattr(self, '__dict__', None) + * if _dict is not None and _dict: # <<<<<<<<<<<<<< + * state += (_dict,) + * use_setstate = True +*/ + __pyx_t_3 = (__pyx_v__dict != Py_None); + if (__pyx_t_3) { + } else { + __pyx_t_2 = __pyx_t_3; + goto __pyx_L4_bool_binop_done; + } + __pyx_t_3 = __Pyx_PyObject_IsTrue(__pyx_v__dict); if (unlikely((__pyx_t_3 < 0))) __PYX_ERR(1, 7, __pyx_L1_error) + __pyx_t_2 = __pyx_t_3; + __pyx_L4_bool_binop_done:; + if (__pyx_t_2) { + + /* "(tree fragment)":8 + * _dict = getattr(self, '__dict__', None) + * if _dict is not None and _dict: + * state += (_dict,) # <<<<<<<<<<<<<< + * use_setstate = True + * else: +*/ + __pyx_t_1 = PyTuple_New(1); if (unlikely(!__pyx_t_1)) __PYX_ERR(1, 8, __pyx_L1_error) + __Pyx_GOTREF(__pyx_t_1); + __Pyx_INCREF(__pyx_v__dict); + __Pyx_GIVEREF(__pyx_v__dict); + if (__Pyx_PyTuple_SET_ITEM(__pyx_t_1, 0, __pyx_v__dict) != (0)) __PYX_ERR(1, 8, __pyx_L1_error); + __pyx_t_4 = PyNumber_InPlaceAdd(__pyx_v_state, __pyx_t_1); if (unlikely(!__pyx_t_4)) __PYX_ERR(1, 8, __pyx_L1_error) + __Pyx_GOTREF(__pyx_t_4); + __Pyx_DECREF(__pyx_t_1); __pyx_t_1 = 0; + __Pyx_DECREF_SET(__pyx_v_state, ((PyObject*)__pyx_t_4)); + __pyx_t_4 = 0; + + /* "(tree fragment)":9 + * if _dict is not None and _dict: + * state += (_dict,) + * use_setstate = True # <<<<<<<<<<<<<< + * else: + * use_setstate = ('False',) +*/ + __pyx_v_use_setstate = 1; + + /* "(tree fragment)":7 + * state = () + * _dict = getattr(self, '__dict__', None) + * if _dict is not None and _dict: # <<<<<<<<<<<<<< + * state += (_dict,) + * use_setstate = True +*/ + goto __pyx_L3; + } + + /* "(tree fragment)":11 + * use_setstate = True + * else: + * use_setstate = ('False',) # <<<<<<<<<<<<<< + * if use_setstate: + * return __pyx_unpickle_Shift, (type(self), 0xe3b0c44, None), state +*/ + /*else*/ { + __pyx_t_2 = __Pyx_PyObject_IsTrue(__pyx_mstate_global->__pyx_tuple[2]); if (unlikely((__pyx_t_2 == (int)-1) && PyErr_Occurred())) __PYX_ERR(1, 11, __pyx_L1_error) + __pyx_v_use_setstate = __pyx_t_2; + } + __pyx_L3:; + + /* "(tree fragment)":12 + * else: + * use_setstate = ('False',) + * if use_setstate: # <<<<<<<<<<<<<< + * return __pyx_unpickle_Shift, (type(self), 0xe3b0c44, None), state + * else: +*/ + if (__pyx_v_use_setstate) { + + /* "(tree fragment)":13 + * use_setstate = ('False',) + * if use_setstate: + * return __pyx_unpickle_Shift, (type(self), 0xe3b0c44, None), state # <<<<<<<<<<<<<< + * else: + * return __pyx_unpickle_Shift, (type(self), 0xe3b0c44, state) +*/ + __Pyx_XDECREF(__pyx_r); + __Pyx_GetModuleGlobalName(__pyx_t_4, __pyx_mstate_global->__pyx_n_u_pyx_unpickle_Shift); if (unlikely(!__pyx_t_4)) __PYX_ERR(1, 13, __pyx_L1_error) + __Pyx_GOTREF(__pyx_t_4); + __pyx_t_1 = PyTuple_New(3); if (unlikely(!__pyx_t_1)) __PYX_ERR(1, 13, __pyx_L1_error) + __Pyx_GOTREF(__pyx_t_1); + __Pyx_INCREF(((PyObject *)Py_TYPE(((PyObject *)__pyx_v_self)))); + __Pyx_GIVEREF(((PyObject *)Py_TYPE(((PyObject *)__pyx_v_self)))); + if (__Pyx_PyTuple_SET_ITEM(__pyx_t_1, 0, ((PyObject *)Py_TYPE(((PyObject *)__pyx_v_self)))) != (0)) __PYX_ERR(1, 13, __pyx_L1_error); + __Pyx_INCREF(__pyx_mstate_global->__pyx_int_238750788); + __Pyx_GIVEREF(__pyx_mstate_global->__pyx_int_238750788); + if (__Pyx_PyTuple_SET_ITEM(__pyx_t_1, 1, __pyx_mstate_global->__pyx_int_238750788) != (0)) __PYX_ERR(1, 13, __pyx_L1_error); + __Pyx_INCREF(Py_None); + __Pyx_GIVEREF(Py_None); + if (__Pyx_PyTuple_SET_ITEM(__pyx_t_1, 2, Py_None) != (0)) __PYX_ERR(1, 13, __pyx_L1_error); + __pyx_t_5 = PyTuple_New(3); if (unlikely(!__pyx_t_5)) __PYX_ERR(1, 13, __pyx_L1_error) + __Pyx_GOTREF(__pyx_t_5); + __Pyx_GIVEREF(__pyx_t_4); + if (__Pyx_PyTuple_SET_ITEM(__pyx_t_5, 0, __pyx_t_4) != (0)) __PYX_ERR(1, 13, __pyx_L1_error); + __Pyx_GIVEREF(__pyx_t_1); + if (__Pyx_PyTuple_SET_ITEM(__pyx_t_5, 1, __pyx_t_1) != (0)) __PYX_ERR(1, 13, __pyx_L1_error); + __Pyx_INCREF(__pyx_v_state); + __Pyx_GIVEREF(__pyx_v_state); + if (__Pyx_PyTuple_SET_ITEM(__pyx_t_5, 2, __pyx_v_state) != (0)) __PYX_ERR(1, 13, __pyx_L1_error); + __pyx_t_4 = 0; + __pyx_t_1 = 0; + __pyx_r = __pyx_t_5; + __pyx_t_5 = 0; + goto __pyx_L0; + + /* "(tree fragment)":12 + * else: + * use_setstate = ('False',) + * if use_setstate: # <<<<<<<<<<<<<< + * return __pyx_unpickle_Shift, (type(self), 0xe3b0c44, None), state + * else: +*/ + } + + /* "(tree fragment)":15 + * return __pyx_unpickle_Shift, (type(self), 0xe3b0c44, None), state + * else: + * return __pyx_unpickle_Shift, (type(self), 0xe3b0c44, state) # <<<<<<<<<<<<<< + * def __setstate_cython__(self, __pyx_state): + * __pyx_unpickle_Shift__set_state(self, __pyx_state) +*/ + /*else*/ { + __Pyx_XDECREF(__pyx_r); + __Pyx_GetModuleGlobalName(__pyx_t_5, __pyx_mstate_global->__pyx_n_u_pyx_unpickle_Shift); if (unlikely(!__pyx_t_5)) __PYX_ERR(1, 15, __pyx_L1_error) + __Pyx_GOTREF(__pyx_t_5); + __pyx_t_1 = PyTuple_New(3); if (unlikely(!__pyx_t_1)) __PYX_ERR(1, 15, __pyx_L1_error) + __Pyx_GOTREF(__pyx_t_1); + __Pyx_INCREF(((PyObject *)Py_TYPE(((PyObject *)__pyx_v_self)))); + __Pyx_GIVEREF(((PyObject *)Py_TYPE(((PyObject *)__pyx_v_self)))); + if (__Pyx_PyTuple_SET_ITEM(__pyx_t_1, 0, ((PyObject *)Py_TYPE(((PyObject *)__pyx_v_self)))) != (0)) __PYX_ERR(1, 15, __pyx_L1_error); + __Pyx_INCREF(__pyx_mstate_global->__pyx_int_238750788); + __Pyx_GIVEREF(__pyx_mstate_global->__pyx_int_238750788); + if (__Pyx_PyTuple_SET_ITEM(__pyx_t_1, 1, __pyx_mstate_global->__pyx_int_238750788) != (0)) __PYX_ERR(1, 15, __pyx_L1_error); + __Pyx_INCREF(__pyx_v_state); + __Pyx_GIVEREF(__pyx_v_state); + if (__Pyx_PyTuple_SET_ITEM(__pyx_t_1, 2, __pyx_v_state) != (0)) __PYX_ERR(1, 15, __pyx_L1_error); + __pyx_t_4 = PyTuple_New(2); if (unlikely(!__pyx_t_4)) __PYX_ERR(1, 15, __pyx_L1_error) + __Pyx_GOTREF(__pyx_t_4); + __Pyx_GIVEREF(__pyx_t_5); + if (__Pyx_PyTuple_SET_ITEM(__pyx_t_4, 0, __pyx_t_5) != (0)) __PYX_ERR(1, 15, __pyx_L1_error); + __Pyx_GIVEREF(__pyx_t_1); + if (__Pyx_PyTuple_SET_ITEM(__pyx_t_4, 1, __pyx_t_1) != (0)) __PYX_ERR(1, 15, __pyx_L1_error); + __pyx_t_5 = 0; + __pyx_t_1 = 0; + __pyx_r = __pyx_t_4; + __pyx_t_4 = 0; + goto __pyx_L0; + } + + /* "(tree fragment)":1 + * def __reduce_cython__(self): # <<<<<<<<<<<<<< + * cdef tuple state + * cdef object _dict +*/ + + /* function exit code */ + __pyx_L1_error:; + __Pyx_XDECREF(__pyx_t_1); + __Pyx_XDECREF(__pyx_t_4); + __Pyx_XDECREF(__pyx_t_5); + __Pyx_AddTraceback("spacy.pipeline._parser_internals.arc_eager.Shift.__reduce_cython__", __pyx_clineno, __pyx_lineno, __pyx_filename); + __pyx_r = NULL; + __pyx_L0:; + __Pyx_XDECREF(__pyx_v_state); + __Pyx_XDECREF(__pyx_v__dict); + __Pyx_XGIVEREF(__pyx_r); + __Pyx_RefNannyFinishContext(); + return __pyx_r; +} + +/* "(tree fragment)":16 + * else: + * return __pyx_unpickle_Shift, (type(self), 0xe3b0c44, state) + * def __setstate_cython__(self, __pyx_state): # <<<<<<<<<<<<<< + * __pyx_unpickle_Shift__set_state(self, __pyx_state) +*/ + +/* Python wrapper */ +static PyObject *__pyx_pw_5spacy_8pipeline_17_parser_internals_9arc_eager_5Shift_3__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_5spacy_8pipeline_17_parser_internals_9arc_eager_5Shift_2__setstate_cython__, "Shift.__setstate_cython__(self, __pyx_state)"); +static PyMethodDef __pyx_mdef_5spacy_8pipeline_17_parser_internals_9arc_eager_5Shift_3__setstate_cython__ = {"__setstate_cython__", (PyCFunction)(void(*)(void))(__Pyx_PyCFunction_FastCallWithKeywords)__pyx_pw_5spacy_8pipeline_17_parser_internals_9arc_eager_5Shift_3__setstate_cython__, __Pyx_METH_FASTCALL|METH_KEYWORDS, __pyx_doc_5spacy_8pipeline_17_parser_internals_9arc_eager_5Shift_2__setstate_cython__}; +static PyObject *__pyx_pw_5spacy_8pipeline_17_parser_internals_9arc_eager_5Shift_3__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 +) { + 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, 16, __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, 16, __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, 16, __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, 16, __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, 16, __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, 16, __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("spacy.pipeline._parser_internals.arc_eager.Shift.__setstate_cython__", __pyx_clineno, __pyx_lineno, __pyx_filename); + __Pyx_RefNannyFinishContext(); + return NULL; + __pyx_L4_argument_unpacking_done:; + __pyx_r = __pyx_pf_5spacy_8pipeline_17_parser_internals_9arc_eager_5Shift_2__setstate_cython__(((struct __pyx_obj_5spacy_8pipeline_17_parser_internals_9arc_eager_Shift *)__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_5spacy_8pipeline_17_parser_internals_9arc_eager_5Shift_2__setstate_cython__(struct __pyx_obj_5spacy_8pipeline_17_parser_internals_9arc_eager_Shift *__pyx_v_self, PyObject *__pyx_v___pyx_state) { + PyObject *__pyx_r = NULL; + __Pyx_RefNannyDeclarations + PyObject *__pyx_t_1 = NULL; + int __pyx_lineno = 0; + const char *__pyx_filename = NULL; + int __pyx_clineno = 0; + __Pyx_RefNannySetupContext("__setstate_cython__", 0); + + /* "(tree fragment)":17 + * return __pyx_unpickle_Shift, (type(self), 0xe3b0c44, state) + * def __setstate_cython__(self, __pyx_state): + * __pyx_unpickle_Shift__set_state(self, __pyx_state) # <<<<<<<<<<<<<< +*/ + __pyx_t_1 = __pyx_f_5spacy_8pipeline_17_parser_internals_9arc_eager___pyx_unpickle_Shift__set_state(__pyx_v_self, __pyx_v___pyx_state); if (unlikely(!__pyx_t_1)) __PYX_ERR(1, 17, __pyx_L1_error) + __Pyx_GOTREF(__pyx_t_1); + __Pyx_DECREF(__pyx_t_1); __pyx_t_1 = 0; + + /* "(tree fragment)":16 + * else: + * return __pyx_unpickle_Shift, (type(self), 0xe3b0c44, state) + * def __setstate_cython__(self, __pyx_state): # <<<<<<<<<<<<<< + * __pyx_unpickle_Shift__set_state(self, __pyx_state) +*/ + + /* function exit code */ + __pyx_r = Py_None; __Pyx_INCREF(Py_None); + goto __pyx_L0; + __pyx_L1_error:; + __Pyx_XDECREF(__pyx_t_1); + __Pyx_AddTraceback("spacy.pipeline._parser_internals.arc_eager.Shift.__setstate_cython__", __pyx_clineno, __pyx_lineno, __pyx_filename); + __pyx_r = NULL; + __pyx_L0:; + __Pyx_XGIVEREF(__pyx_r); + __Pyx_RefNannyFinishContext(); + return __pyx_r; +} + +/* "spacy/pipeline/_parser_internals/arc_eager.pyx":377 + * cost by those arcs. + * """ + * @staticmethod # <<<<<<<<<<<<<< + * cdef bint is_valid(const StateC* st, attr_t label) noexcept nogil: + * if st.stack_depth() == 0: +*/ + +static int __pyx_f_5spacy_8pipeline_17_parser_internals_9arc_eager_6Reduce_is_valid(__pyx_t_5spacy_8pipeline_17_parser_internals_6_state_StateC const *__pyx_v_st, CYTHON_UNUSED __pyx_t_5spacy_8typedefs_attr_t __pyx_v_label) { + int __pyx_r; + int __pyx_t_1; + int __pyx_t_2; + + /* "spacy/pipeline/_parser_internals/arc_eager.pyx":379 + * @staticmethod + * cdef bint is_valid(const StateC* st, attr_t label) noexcept nogil: + * if st.stack_depth() == 0: # <<<<<<<<<<<<<< + * return False + * elif st.buffer_length() == 0: +*/ + __pyx_t_1 = (__pyx_v_st->stack_depth() == 0); + if (__pyx_t_1) { + + /* "spacy/pipeline/_parser_internals/arc_eager.pyx":380 + * cdef bint is_valid(const StateC* st, attr_t label) noexcept nogil: + * if st.stack_depth() == 0: + * return False # <<<<<<<<<<<<<< + * elif st.buffer_length() == 0: + * return True +*/ + __pyx_r = 0; + goto __pyx_L0; + + /* "spacy/pipeline/_parser_internals/arc_eager.pyx":379 + * @staticmethod + * cdef bint is_valid(const StateC* st, attr_t label) noexcept nogil: + * if st.stack_depth() == 0: # <<<<<<<<<<<<<< + * return False + * elif st.buffer_length() == 0: +*/ + } + + /* "spacy/pipeline/_parser_internals/arc_eager.pyx":381 + * if st.stack_depth() == 0: + * return False + * elif st.buffer_length() == 0: # <<<<<<<<<<<<<< + * return True + * elif st.stack_depth() == 1 and st.cannot_sent_start(st.l_edge(st.B(0))): +*/ + __pyx_t_1 = (__pyx_v_st->buffer_length() == 0); + if (__pyx_t_1) { + + /* "spacy/pipeline/_parser_internals/arc_eager.pyx":382 + * return False + * elif st.buffer_length() == 0: + * return True # <<<<<<<<<<<<<< + * elif st.stack_depth() == 1 and st.cannot_sent_start(st.l_edge(st.B(0))): + * return False +*/ + __pyx_r = 1; + goto __pyx_L0; + + /* "spacy/pipeline/_parser_internals/arc_eager.pyx":381 + * if st.stack_depth() == 0: + * return False + * elif st.buffer_length() == 0: # <<<<<<<<<<<<<< + * return True + * elif st.stack_depth() == 1 and st.cannot_sent_start(st.l_edge(st.B(0))): +*/ + } + + /* "spacy/pipeline/_parser_internals/arc_eager.pyx":383 + * elif st.buffer_length() == 0: + * return True + * elif st.stack_depth() == 1 and st.cannot_sent_start(st.l_edge(st.B(0))): # <<<<<<<<<<<<<< + * return False + * else: +*/ + __pyx_t_2 = (__pyx_v_st->stack_depth() == 1); + if (__pyx_t_2) { + } else { + __pyx_t_1 = __pyx_t_2; + goto __pyx_L4_bool_binop_done; + } + __pyx_t_2 = (__pyx_v_st->cannot_sent_start(__pyx_v_st->l_edge(__pyx_v_st->B(0))) != 0); + __pyx_t_1 = __pyx_t_2; + __pyx_L4_bool_binop_done:; + if (__pyx_t_1) { + + /* "spacy/pipeline/_parser_internals/arc_eager.pyx":384 + * return True + * elif st.stack_depth() == 1 and st.cannot_sent_start(st.l_edge(st.B(0))): + * return False # <<<<<<<<<<<<<< + * else: + * return True +*/ + __pyx_r = 0; + goto __pyx_L0; + + /* "spacy/pipeline/_parser_internals/arc_eager.pyx":383 + * elif st.buffer_length() == 0: + * return True + * elif st.stack_depth() == 1 and st.cannot_sent_start(st.l_edge(st.B(0))): # <<<<<<<<<<<<<< + * return False + * else: +*/ + } + + /* "spacy/pipeline/_parser_internals/arc_eager.pyx":386 + * return False + * else: + * return True # <<<<<<<<<<<<<< + * + * @staticmethod +*/ + /*else*/ { + __pyx_r = 1; + goto __pyx_L0; + } + + /* "spacy/pipeline/_parser_internals/arc_eager.pyx":377 + * cost by those arcs. + * """ + * @staticmethod # <<<<<<<<<<<<<< + * cdef bint is_valid(const StateC* st, attr_t label) noexcept nogil: + * if st.stack_depth() == 0: +*/ + + /* function exit code */ + __pyx_L0:; + return __pyx_r; +} + +/* "spacy/pipeline/_parser_internals/arc_eager.pyx":388 + * return True + * + * @staticmethod # <<<<<<<<<<<<<< + * cdef int transition(StateC* st, attr_t label) noexcept nogil: + * if st.has_head(st.S(0)) or st.stack_depth() == 1: +*/ + +static int __pyx_f_5spacy_8pipeline_17_parser_internals_9arc_eager_6Reduce_transition(__pyx_t_5spacy_8pipeline_17_parser_internals_6_state_StateC *__pyx_v_st, CYTHON_UNUSED __pyx_t_5spacy_8typedefs_attr_t __pyx_v_label) { + int __pyx_r; + int __pyx_t_1; + int __pyx_t_2; + + /* "spacy/pipeline/_parser_internals/arc_eager.pyx":390 + * @staticmethod + * cdef int transition(StateC* st, attr_t label) noexcept nogil: + * if st.has_head(st.S(0)) or st.stack_depth() == 1: # <<<<<<<<<<<<<< + * st.pop() + * else: +*/ + __pyx_t_2 = __pyx_v_st->has_head(__pyx_v_st->S(0)); + if (!__pyx_t_2) { + } else { + __pyx_t_1 = __pyx_t_2; + goto __pyx_L4_bool_binop_done; + } + __pyx_t_2 = (__pyx_v_st->stack_depth() == 1); + __pyx_t_1 = __pyx_t_2; + __pyx_L4_bool_binop_done:; + if (__pyx_t_1) { + + /* "spacy/pipeline/_parser_internals/arc_eager.pyx":391 + * cdef int transition(StateC* st, attr_t label) noexcept nogil: + * if st.has_head(st.S(0)) or st.stack_depth() == 1: + * st.pop() # <<<<<<<<<<<<<< + * else: + * st.unshift() +*/ + __pyx_v_st->pop(); + + /* "spacy/pipeline/_parser_internals/arc_eager.pyx":390 + * @staticmethod + * cdef int transition(StateC* st, attr_t label) noexcept nogil: + * if st.has_head(st.S(0)) or st.stack_depth() == 1: # <<<<<<<<<<<<<< + * st.pop() + * else: +*/ + goto __pyx_L3; + } + + /* "spacy/pipeline/_parser_internals/arc_eager.pyx":393 + * st.pop() + * else: + * st.unshift() # <<<<<<<<<<<<<< + * + * @staticmethod +*/ + /*else*/ { + __pyx_v_st->unshift(); + } + __pyx_L3:; + + /* "spacy/pipeline/_parser_internals/arc_eager.pyx":388 + * return True + * + * @staticmethod # <<<<<<<<<<<<<< + * cdef int transition(StateC* st, attr_t label) noexcept nogil: + * if st.has_head(st.S(0)) or st.stack_depth() == 1: +*/ + + /* function exit code */ + __pyx_r = 0; + return __pyx_r; +} + +/* "spacy/pipeline/_parser_internals/arc_eager.pyx":395 + * st.unshift() + * + * @staticmethod # <<<<<<<<<<<<<< + * cdef weight_t cost(const StateC* state, const void* _gold, attr_t label) noexcept nogil: + * gold = _gold +*/ + +static __pyx_t_5spacy_8typedefs_weight_t __pyx_f_5spacy_8pipeline_17_parser_internals_9arc_eager_6Reduce_cost(__pyx_t_5spacy_8pipeline_17_parser_internals_6_state_StateC const *__pyx_v_state, void const *__pyx_v__gold, CYTHON_UNUSED __pyx_t_5spacy_8typedefs_attr_t __pyx_v_label) { + struct __pyx_t_5spacy_8pipeline_17_parser_internals_9arc_eager_GoldParseStateC const *__pyx_v_gold; + int __pyx_v_s0; + __pyx_t_5spacy_8typedefs_weight_t __pyx_v_cost; + __pyx_t_5spacy_8typedefs_weight_t __pyx_r; + int __pyx_t_1; + __pyx_t_5spacy_8typedefs_weight_t __pyx_t_2; + + /* "spacy/pipeline/_parser_internals/arc_eager.pyx":397 + * @staticmethod + * cdef weight_t cost(const StateC* state, const void* _gold, attr_t label) noexcept nogil: + * gold = _gold # <<<<<<<<<<<<<< + * if state.is_sent_start(state.B(0)): + * return 0 +*/ + __pyx_v_gold = ((struct __pyx_t_5spacy_8pipeline_17_parser_internals_9arc_eager_GoldParseStateC const *)__pyx_v__gold); + + /* "spacy/pipeline/_parser_internals/arc_eager.pyx":398 + * cdef weight_t cost(const StateC* state, const void* _gold, attr_t label) noexcept nogil: + * gold = _gold + * if state.is_sent_start(state.B(0)): # <<<<<<<<<<<<<< + * return 0 + * s0 = state.S(0) +*/ + __pyx_t_1 = (__pyx_v_state->is_sent_start(__pyx_v_state->B(0)) != 0); + if (__pyx_t_1) { + + /* "spacy/pipeline/_parser_internals/arc_eager.pyx":399 + * gold = _gold + * if state.is_sent_start(state.B(0)): + * return 0 # <<<<<<<<<<<<<< + * s0 = state.S(0) + * cost = gold.pop_cost +*/ + __pyx_r = 0.0; + goto __pyx_L0; + + /* "spacy/pipeline/_parser_internals/arc_eager.pyx":398 + * cdef weight_t cost(const StateC* state, const void* _gold, attr_t label) noexcept nogil: + * gold = _gold + * if state.is_sent_start(state.B(0)): # <<<<<<<<<<<<<< + * return 0 + * s0 = state.S(0) +*/ + } + + /* "spacy/pipeline/_parser_internals/arc_eager.pyx":400 + * if state.is_sent_start(state.B(0)): + * return 0 + * s0 = state.S(0) # <<<<<<<<<<<<<< + * cost = gold.pop_cost + * if not state.has_head(s0): +*/ + __pyx_v_s0 = __pyx_v_state->S(0); + + /* "spacy/pipeline/_parser_internals/arc_eager.pyx":401 + * return 0 + * s0 = state.S(0) + * cost = gold.pop_cost # <<<<<<<<<<<<<< + * if not state.has_head(s0): + * # Decrement cost for the arcs we save, as we'll be putting this +*/ + __pyx_t_2 = __pyx_v_gold->pop_cost; + __pyx_v_cost = __pyx_t_2; + + /* "spacy/pipeline/_parser_internals/arc_eager.pyx":402 + * s0 = state.S(0) + * cost = gold.pop_cost + * if not state.has_head(s0): # <<<<<<<<<<<<<< + * # Decrement cost for the arcs we save, as we'll be putting this + * # back to the buffer +*/ + __pyx_t_1 = (!__pyx_v_state->has_head(__pyx_v_s0)); + if (__pyx_t_1) { + + /* "spacy/pipeline/_parser_internals/arc_eager.pyx":405 + * # Decrement cost for the arcs we save, as we'll be putting this + * # back to the buffer + * if is_head_in_stack(gold, s0): # <<<<<<<<<<<<<< + * cost -= 1 + * cost -= gold.n_kids_in_stack[s0] +*/ + __pyx_t_1 = (__pyx_f_5spacy_8pipeline_17_parser_internals_9arc_eager_is_head_in_stack(__pyx_v_gold, __pyx_v_s0) != 0); + if (__pyx_t_1) { + + /* "spacy/pipeline/_parser_internals/arc_eager.pyx":406 + * # back to the buffer + * if is_head_in_stack(gold, s0): + * cost -= 1 # <<<<<<<<<<<<<< + * cost -= gold.n_kids_in_stack[s0] + * return cost +*/ + __pyx_v_cost = (__pyx_v_cost - 1.0); + + /* "spacy/pipeline/_parser_internals/arc_eager.pyx":405 + * # Decrement cost for the arcs we save, as we'll be putting this + * # back to the buffer + * if is_head_in_stack(gold, s0): # <<<<<<<<<<<<<< + * cost -= 1 + * cost -= gold.n_kids_in_stack[s0] +*/ + } + + /* "spacy/pipeline/_parser_internals/arc_eager.pyx":407 + * if is_head_in_stack(gold, s0): + * cost -= 1 + * cost -= gold.n_kids_in_stack[s0] # <<<<<<<<<<<<<< + * return cost + * +*/ + __pyx_v_cost = (__pyx_v_cost - (__pyx_v_gold->n_kids_in_stack[__pyx_v_s0])); + + /* "spacy/pipeline/_parser_internals/arc_eager.pyx":402 + * s0 = state.S(0) + * cost = gold.pop_cost + * if not state.has_head(s0): # <<<<<<<<<<<<<< + * # Decrement cost for the arcs we save, as we'll be putting this + * # back to the buffer +*/ + } + + /* "spacy/pipeline/_parser_internals/arc_eager.pyx":408 + * cost -= 1 + * cost -= gold.n_kids_in_stack[s0] + * return cost # <<<<<<<<<<<<<< + * + * +*/ + __pyx_r = __pyx_v_cost; + goto __pyx_L0; + + /* "spacy/pipeline/_parser_internals/arc_eager.pyx":395 + * st.unshift() + * + * @staticmethod # <<<<<<<<<<<<<< + * cdef weight_t cost(const StateC* state, const void* _gold, attr_t label) noexcept nogil: + * gold = _gold +*/ + + /* function exit code */ + __pyx_L0:; + return __pyx_r; +} + +/* "(tree fragment)":1 + * def __reduce_cython__(self): # <<<<<<<<<<<<<< + * cdef tuple state + * cdef object _dict +*/ + +/* Python wrapper */ +static PyObject *__pyx_pw_5spacy_8pipeline_17_parser_internals_9arc_eager_6Reduce_1__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_5spacy_8pipeline_17_parser_internals_9arc_eager_6Reduce___reduce_cython__, "Reduce.__reduce_cython__(self)"); +static PyMethodDef __pyx_mdef_5spacy_8pipeline_17_parser_internals_9arc_eager_6Reduce_1__reduce_cython__ = {"__reduce_cython__", (PyCFunction)(void(*)(void))(__Pyx_PyCFunction_FastCallWithKeywords)__pyx_pw_5spacy_8pipeline_17_parser_internals_9arc_eager_6Reduce_1__reduce_cython__, __Pyx_METH_FASTCALL|METH_KEYWORDS, __pyx_doc_5spacy_8pipeline_17_parser_internals_9arc_eager_6Reduce___reduce_cython__}; +static PyObject *__pyx_pw_5spacy_8pipeline_17_parser_internals_9arc_eager_6Reduce_1__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_5spacy_8pipeline_17_parser_internals_9arc_eager_6Reduce___reduce_cython__(((struct __pyx_obj_5spacy_8pipeline_17_parser_internals_9arc_eager_Reduce *)__pyx_v_self)); + + /* function exit code */ + __Pyx_RefNannyFinishContext(); + return __pyx_r; +} + +static PyObject *__pyx_pf_5spacy_8pipeline_17_parser_internals_9arc_eager_6Reduce___reduce_cython__(struct __pyx_obj_5spacy_8pipeline_17_parser_internals_9arc_eager_Reduce *__pyx_v_self) { + PyObject *__pyx_v_state = 0; + PyObject *__pyx_v__dict = 0; + int __pyx_v_use_setstate; + PyObject *__pyx_r = NULL; + __Pyx_RefNannyDeclarations + PyObject *__pyx_t_1 = NULL; + int __pyx_t_2; + int __pyx_t_3; + PyObject *__pyx_t_4 = NULL; + PyObject *__pyx_t_5 = NULL; + int __pyx_lineno = 0; + const char *__pyx_filename = NULL; + int __pyx_clineno = 0; + __Pyx_RefNannySetupContext("__reduce_cython__", 0); + + /* "(tree fragment)":5 + * cdef object _dict + * cdef bint use_setstate + * state = () # <<<<<<<<<<<<<< + * _dict = getattr(self, '__dict__', None) + * if _dict is not None and _dict: +*/ + __Pyx_INCREF(__pyx_mstate_global->__pyx_empty_tuple); + __pyx_v_state = __pyx_mstate_global->__pyx_empty_tuple; + + /* "(tree fragment)":6 + * cdef bint use_setstate + * state = () + * _dict = getattr(self, '__dict__', None) # <<<<<<<<<<<<<< + * if _dict is not None and _dict: + * state += (_dict,) +*/ + __pyx_t_1 = __Pyx_GetAttr3(((PyObject *)__pyx_v_self), __pyx_mstate_global->__pyx_n_u_dict, Py_None); if (unlikely(!__pyx_t_1)) __PYX_ERR(1, 6, __pyx_L1_error) + __Pyx_GOTREF(__pyx_t_1); + __pyx_v__dict = __pyx_t_1; + __pyx_t_1 = 0; + + /* "(tree fragment)":7 + * state = () + * _dict = getattr(self, '__dict__', None) + * if _dict is not None and _dict: # <<<<<<<<<<<<<< + * state += (_dict,) + * use_setstate = True +*/ + __pyx_t_3 = (__pyx_v__dict != Py_None); + if (__pyx_t_3) { + } else { + __pyx_t_2 = __pyx_t_3; + goto __pyx_L4_bool_binop_done; + } + __pyx_t_3 = __Pyx_PyObject_IsTrue(__pyx_v__dict); if (unlikely((__pyx_t_3 < 0))) __PYX_ERR(1, 7, __pyx_L1_error) + __pyx_t_2 = __pyx_t_3; + __pyx_L4_bool_binop_done:; + if (__pyx_t_2) { + + /* "(tree fragment)":8 + * _dict = getattr(self, '__dict__', None) + * if _dict is not None and _dict: + * state += (_dict,) # <<<<<<<<<<<<<< + * use_setstate = True + * else: +*/ + __pyx_t_1 = PyTuple_New(1); if (unlikely(!__pyx_t_1)) __PYX_ERR(1, 8, __pyx_L1_error) + __Pyx_GOTREF(__pyx_t_1); + __Pyx_INCREF(__pyx_v__dict); + __Pyx_GIVEREF(__pyx_v__dict); + if (__Pyx_PyTuple_SET_ITEM(__pyx_t_1, 0, __pyx_v__dict) != (0)) __PYX_ERR(1, 8, __pyx_L1_error); + __pyx_t_4 = PyNumber_InPlaceAdd(__pyx_v_state, __pyx_t_1); if (unlikely(!__pyx_t_4)) __PYX_ERR(1, 8, __pyx_L1_error) + __Pyx_GOTREF(__pyx_t_4); + __Pyx_DECREF(__pyx_t_1); __pyx_t_1 = 0; + __Pyx_DECREF_SET(__pyx_v_state, ((PyObject*)__pyx_t_4)); + __pyx_t_4 = 0; + + /* "(tree fragment)":9 + * if _dict is not None and _dict: + * state += (_dict,) + * use_setstate = True # <<<<<<<<<<<<<< + * else: + * use_setstate = ('False',) +*/ + __pyx_v_use_setstate = 1; + + /* "(tree fragment)":7 + * state = () + * _dict = getattr(self, '__dict__', None) + * if _dict is not None and _dict: # <<<<<<<<<<<<<< + * state += (_dict,) + * use_setstate = True +*/ + goto __pyx_L3; + } + + /* "(tree fragment)":11 + * use_setstate = True + * else: + * use_setstate = ('False',) # <<<<<<<<<<<<<< + * if use_setstate: + * return __pyx_unpickle_Reduce, (type(self), 0xe3b0c44, None), state +*/ + /*else*/ { + __pyx_t_2 = __Pyx_PyObject_IsTrue(__pyx_mstate_global->__pyx_tuple[2]); if (unlikely((__pyx_t_2 == (int)-1) && PyErr_Occurred())) __PYX_ERR(1, 11, __pyx_L1_error) + __pyx_v_use_setstate = __pyx_t_2; + } + __pyx_L3:; + + /* "(tree fragment)":12 + * else: + * use_setstate = ('False',) + * if use_setstate: # <<<<<<<<<<<<<< + * return __pyx_unpickle_Reduce, (type(self), 0xe3b0c44, None), state + * else: +*/ + if (__pyx_v_use_setstate) { + + /* "(tree fragment)":13 + * use_setstate = ('False',) + * if use_setstate: + * return __pyx_unpickle_Reduce, (type(self), 0xe3b0c44, None), state # <<<<<<<<<<<<<< + * else: + * return __pyx_unpickle_Reduce, (type(self), 0xe3b0c44, state) +*/ + __Pyx_XDECREF(__pyx_r); + __Pyx_GetModuleGlobalName(__pyx_t_4, __pyx_mstate_global->__pyx_n_u_pyx_unpickle_Reduce); if (unlikely(!__pyx_t_4)) __PYX_ERR(1, 13, __pyx_L1_error) + __Pyx_GOTREF(__pyx_t_4); + __pyx_t_1 = PyTuple_New(3); if (unlikely(!__pyx_t_1)) __PYX_ERR(1, 13, __pyx_L1_error) + __Pyx_GOTREF(__pyx_t_1); + __Pyx_INCREF(((PyObject *)Py_TYPE(((PyObject *)__pyx_v_self)))); + __Pyx_GIVEREF(((PyObject *)Py_TYPE(((PyObject *)__pyx_v_self)))); + if (__Pyx_PyTuple_SET_ITEM(__pyx_t_1, 0, ((PyObject *)Py_TYPE(((PyObject *)__pyx_v_self)))) != (0)) __PYX_ERR(1, 13, __pyx_L1_error); + __Pyx_INCREF(__pyx_mstate_global->__pyx_int_238750788); + __Pyx_GIVEREF(__pyx_mstate_global->__pyx_int_238750788); + if (__Pyx_PyTuple_SET_ITEM(__pyx_t_1, 1, __pyx_mstate_global->__pyx_int_238750788) != (0)) __PYX_ERR(1, 13, __pyx_L1_error); + __Pyx_INCREF(Py_None); + __Pyx_GIVEREF(Py_None); + if (__Pyx_PyTuple_SET_ITEM(__pyx_t_1, 2, Py_None) != (0)) __PYX_ERR(1, 13, __pyx_L1_error); + __pyx_t_5 = PyTuple_New(3); if (unlikely(!__pyx_t_5)) __PYX_ERR(1, 13, __pyx_L1_error) + __Pyx_GOTREF(__pyx_t_5); + __Pyx_GIVEREF(__pyx_t_4); + if (__Pyx_PyTuple_SET_ITEM(__pyx_t_5, 0, __pyx_t_4) != (0)) __PYX_ERR(1, 13, __pyx_L1_error); + __Pyx_GIVEREF(__pyx_t_1); + if (__Pyx_PyTuple_SET_ITEM(__pyx_t_5, 1, __pyx_t_1) != (0)) __PYX_ERR(1, 13, __pyx_L1_error); + __Pyx_INCREF(__pyx_v_state); + __Pyx_GIVEREF(__pyx_v_state); + if (__Pyx_PyTuple_SET_ITEM(__pyx_t_5, 2, __pyx_v_state) != (0)) __PYX_ERR(1, 13, __pyx_L1_error); + __pyx_t_4 = 0; + __pyx_t_1 = 0; + __pyx_r = __pyx_t_5; + __pyx_t_5 = 0; + goto __pyx_L0; + + /* "(tree fragment)":12 + * else: + * use_setstate = ('False',) + * if use_setstate: # <<<<<<<<<<<<<< + * return __pyx_unpickle_Reduce, (type(self), 0xe3b0c44, None), state + * else: +*/ + } + + /* "(tree fragment)":15 + * return __pyx_unpickle_Reduce, (type(self), 0xe3b0c44, None), state + * else: + * return __pyx_unpickle_Reduce, (type(self), 0xe3b0c44, state) # <<<<<<<<<<<<<< + * def __setstate_cython__(self, __pyx_state): + * __pyx_unpickle_Reduce__set_state(self, __pyx_state) +*/ + /*else*/ { + __Pyx_XDECREF(__pyx_r); + __Pyx_GetModuleGlobalName(__pyx_t_5, __pyx_mstate_global->__pyx_n_u_pyx_unpickle_Reduce); if (unlikely(!__pyx_t_5)) __PYX_ERR(1, 15, __pyx_L1_error) + __Pyx_GOTREF(__pyx_t_5); + __pyx_t_1 = PyTuple_New(3); if (unlikely(!__pyx_t_1)) __PYX_ERR(1, 15, __pyx_L1_error) + __Pyx_GOTREF(__pyx_t_1); + __Pyx_INCREF(((PyObject *)Py_TYPE(((PyObject *)__pyx_v_self)))); + __Pyx_GIVEREF(((PyObject *)Py_TYPE(((PyObject *)__pyx_v_self)))); + if (__Pyx_PyTuple_SET_ITEM(__pyx_t_1, 0, ((PyObject *)Py_TYPE(((PyObject *)__pyx_v_self)))) != (0)) __PYX_ERR(1, 15, __pyx_L1_error); + __Pyx_INCREF(__pyx_mstate_global->__pyx_int_238750788); + __Pyx_GIVEREF(__pyx_mstate_global->__pyx_int_238750788); + if (__Pyx_PyTuple_SET_ITEM(__pyx_t_1, 1, __pyx_mstate_global->__pyx_int_238750788) != (0)) __PYX_ERR(1, 15, __pyx_L1_error); + __Pyx_INCREF(__pyx_v_state); + __Pyx_GIVEREF(__pyx_v_state); + if (__Pyx_PyTuple_SET_ITEM(__pyx_t_1, 2, __pyx_v_state) != (0)) __PYX_ERR(1, 15, __pyx_L1_error); + __pyx_t_4 = PyTuple_New(2); if (unlikely(!__pyx_t_4)) __PYX_ERR(1, 15, __pyx_L1_error) + __Pyx_GOTREF(__pyx_t_4); + __Pyx_GIVEREF(__pyx_t_5); + if (__Pyx_PyTuple_SET_ITEM(__pyx_t_4, 0, __pyx_t_5) != (0)) __PYX_ERR(1, 15, __pyx_L1_error); + __Pyx_GIVEREF(__pyx_t_1); + if (__Pyx_PyTuple_SET_ITEM(__pyx_t_4, 1, __pyx_t_1) != (0)) __PYX_ERR(1, 15, __pyx_L1_error); + __pyx_t_5 = 0; + __pyx_t_1 = 0; + __pyx_r = __pyx_t_4; + __pyx_t_4 = 0; + goto __pyx_L0; + } + + /* "(tree fragment)":1 + * def __reduce_cython__(self): # <<<<<<<<<<<<<< + * cdef tuple state + * cdef object _dict +*/ + + /* function exit code */ + __pyx_L1_error:; + __Pyx_XDECREF(__pyx_t_1); + __Pyx_XDECREF(__pyx_t_4); + __Pyx_XDECREF(__pyx_t_5); + __Pyx_AddTraceback("spacy.pipeline._parser_internals.arc_eager.Reduce.__reduce_cython__", __pyx_clineno, __pyx_lineno, __pyx_filename); + __pyx_r = NULL; + __pyx_L0:; + __Pyx_XDECREF(__pyx_v_state); + __Pyx_XDECREF(__pyx_v__dict); + __Pyx_XGIVEREF(__pyx_r); + __Pyx_RefNannyFinishContext(); + return __pyx_r; +} + +/* "(tree fragment)":16 + * else: + * return __pyx_unpickle_Reduce, (type(self), 0xe3b0c44, state) + * def __setstate_cython__(self, __pyx_state): # <<<<<<<<<<<<<< + * __pyx_unpickle_Reduce__set_state(self, __pyx_state) +*/ + +/* Python wrapper */ +static PyObject *__pyx_pw_5spacy_8pipeline_17_parser_internals_9arc_eager_6Reduce_3__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_5spacy_8pipeline_17_parser_internals_9arc_eager_6Reduce_2__setstate_cython__, "Reduce.__setstate_cython__(self, __pyx_state)"); +static PyMethodDef __pyx_mdef_5spacy_8pipeline_17_parser_internals_9arc_eager_6Reduce_3__setstate_cython__ = {"__setstate_cython__", (PyCFunction)(void(*)(void))(__Pyx_PyCFunction_FastCallWithKeywords)__pyx_pw_5spacy_8pipeline_17_parser_internals_9arc_eager_6Reduce_3__setstate_cython__, __Pyx_METH_FASTCALL|METH_KEYWORDS, __pyx_doc_5spacy_8pipeline_17_parser_internals_9arc_eager_6Reduce_2__setstate_cython__}; +static PyObject *__pyx_pw_5spacy_8pipeline_17_parser_internals_9arc_eager_6Reduce_3__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 +) { + 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, 16, __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, 16, __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, 16, __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, 16, __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, 16, __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, 16, __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("spacy.pipeline._parser_internals.arc_eager.Reduce.__setstate_cython__", __pyx_clineno, __pyx_lineno, __pyx_filename); + __Pyx_RefNannyFinishContext(); + return NULL; + __pyx_L4_argument_unpacking_done:; + __pyx_r = __pyx_pf_5spacy_8pipeline_17_parser_internals_9arc_eager_6Reduce_2__setstate_cython__(((struct __pyx_obj_5spacy_8pipeline_17_parser_internals_9arc_eager_Reduce *)__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_5spacy_8pipeline_17_parser_internals_9arc_eager_6Reduce_2__setstate_cython__(struct __pyx_obj_5spacy_8pipeline_17_parser_internals_9arc_eager_Reduce *__pyx_v_self, PyObject *__pyx_v___pyx_state) { + PyObject *__pyx_r = NULL; + __Pyx_RefNannyDeclarations + PyObject *__pyx_t_1 = NULL; + int __pyx_lineno = 0; + const char *__pyx_filename = NULL; + int __pyx_clineno = 0; + __Pyx_RefNannySetupContext("__setstate_cython__", 0); + + /* "(tree fragment)":17 + * return __pyx_unpickle_Reduce, (type(self), 0xe3b0c44, state) + * def __setstate_cython__(self, __pyx_state): + * __pyx_unpickle_Reduce__set_state(self, __pyx_state) # <<<<<<<<<<<<<< +*/ + __pyx_t_1 = __pyx_f_5spacy_8pipeline_17_parser_internals_9arc_eager___pyx_unpickle_Reduce__set_state(__pyx_v_self, __pyx_v___pyx_state); if (unlikely(!__pyx_t_1)) __PYX_ERR(1, 17, __pyx_L1_error) + __Pyx_GOTREF(__pyx_t_1); + __Pyx_DECREF(__pyx_t_1); __pyx_t_1 = 0; + + /* "(tree fragment)":16 + * else: + * return __pyx_unpickle_Reduce, (type(self), 0xe3b0c44, state) + * def __setstate_cython__(self, __pyx_state): # <<<<<<<<<<<<<< + * __pyx_unpickle_Reduce__set_state(self, __pyx_state) +*/ + + /* function exit code */ + __pyx_r = Py_None; __Pyx_INCREF(Py_None); + goto __pyx_L0; + __pyx_L1_error:; + __Pyx_XDECREF(__pyx_t_1); + __Pyx_AddTraceback("spacy.pipeline._parser_internals.arc_eager.Reduce.__setstate_cython__", __pyx_clineno, __pyx_lineno, __pyx_filename); + __pyx_r = NULL; + __pyx_L0:; + __Pyx_XGIVEREF(__pyx_r); + __Pyx_RefNannyFinishContext(); + return __pyx_r; +} + +/* "spacy/pipeline/_parser_internals/arc_eager.pyx":423 + * pop_cost - Arc(B[0], S[0], label) + (Arc(S[1], S[0]) if H(S[0]) else Arcs(S, S[0])) + * """ + * @staticmethod # <<<<<<<<<<<<<< + * cdef bint is_valid(const StateC* st, attr_t label) noexcept nogil: + * if st.stack_depth() == 0: +*/ + +static int __pyx_f_5spacy_8pipeline_17_parser_internals_9arc_eager_7LeftArc_is_valid(__pyx_t_5spacy_8pipeline_17_parser_internals_6_state_StateC const *__pyx_v_st, __pyx_t_5spacy_8typedefs_attr_t __pyx_v_label) { + int __pyx_r; + int __pyx_t_1; + int __pyx_t_2; + + /* "spacy/pipeline/_parser_internals/arc_eager.pyx":425 + * @staticmethod + * cdef bint is_valid(const StateC* st, attr_t label) noexcept nogil: + * if st.stack_depth() == 0: # <<<<<<<<<<<<<< + * return 0 + * elif st.buffer_length() == 0: +*/ + __pyx_t_1 = (__pyx_v_st->stack_depth() == 0); + if (__pyx_t_1) { + + /* "spacy/pipeline/_parser_internals/arc_eager.pyx":426 + * cdef bint is_valid(const StateC* st, attr_t label) noexcept nogil: + * if st.stack_depth() == 0: + * return 0 # <<<<<<<<<<<<<< + * elif st.buffer_length() == 0: + * return 0 +*/ + __pyx_r = 0; + goto __pyx_L0; + + /* "spacy/pipeline/_parser_internals/arc_eager.pyx":425 + * @staticmethod + * cdef bint is_valid(const StateC* st, attr_t label) noexcept nogil: + * if st.stack_depth() == 0: # <<<<<<<<<<<<<< + * return 0 + * elif st.buffer_length() == 0: +*/ + } + + /* "spacy/pipeline/_parser_internals/arc_eager.pyx":427 + * if st.stack_depth() == 0: + * return 0 + * elif st.buffer_length() == 0: # <<<<<<<<<<<<<< + * return 0 + * elif st.is_sent_start(st.B(0)): +*/ + __pyx_t_1 = (__pyx_v_st->buffer_length() == 0); + if (__pyx_t_1) { + + /* "spacy/pipeline/_parser_internals/arc_eager.pyx":428 + * return 0 + * elif st.buffer_length() == 0: + * return 0 # <<<<<<<<<<<<<< + * elif st.is_sent_start(st.B(0)): + * return 0 +*/ + __pyx_r = 0; + goto __pyx_L0; + + /* "spacy/pipeline/_parser_internals/arc_eager.pyx":427 + * if st.stack_depth() == 0: + * return 0 + * elif st.buffer_length() == 0: # <<<<<<<<<<<<<< + * return 0 + * elif st.is_sent_start(st.B(0)): +*/ + } + + /* "spacy/pipeline/_parser_internals/arc_eager.pyx":429 + * elif st.buffer_length() == 0: + * return 0 + * elif st.is_sent_start(st.B(0)): # <<<<<<<<<<<<<< + * return 0 + * elif label == SUBTOK_LABEL and st.S(0) != (st.B(0)-1): +*/ + __pyx_t_1 = (__pyx_v_st->is_sent_start(__pyx_v_st->B(0)) != 0); + if (__pyx_t_1) { + + /* "spacy/pipeline/_parser_internals/arc_eager.pyx":430 + * return 0 + * elif st.is_sent_start(st.B(0)): + * return 0 # <<<<<<<<<<<<<< + * elif label == SUBTOK_LABEL and st.S(0) != (st.B(0)-1): + * return 0 +*/ + __pyx_r = 0; + goto __pyx_L0; + + /* "spacy/pipeline/_parser_internals/arc_eager.pyx":429 + * elif st.buffer_length() == 0: + * return 0 + * elif st.is_sent_start(st.B(0)): # <<<<<<<<<<<<<< + * return 0 + * elif label == SUBTOK_LABEL and st.S(0) != (st.B(0)-1): +*/ + } + + /* "spacy/pipeline/_parser_internals/arc_eager.pyx":431 + * elif st.is_sent_start(st.B(0)): + * return 0 + * elif label == SUBTOK_LABEL and st.S(0) != (st.B(0)-1): # <<<<<<<<<<<<<< + * return 0 + * else: +*/ + __pyx_t_2 = (__pyx_v_label == __pyx_v_5spacy_8pipeline_17_parser_internals_9arc_eager_SUBTOK_LABEL); + if (__pyx_t_2) { + } else { + __pyx_t_1 = __pyx_t_2; + goto __pyx_L4_bool_binop_done; + } + __pyx_t_2 = (__pyx_v_st->S(0) != (__pyx_v_st->B(0) - 1)); + __pyx_t_1 = __pyx_t_2; + __pyx_L4_bool_binop_done:; + if (__pyx_t_1) { + + /* "spacy/pipeline/_parser_internals/arc_eager.pyx":432 + * return 0 + * elif label == SUBTOK_LABEL and st.S(0) != (st.B(0)-1): + * return 0 # <<<<<<<<<<<<<< + * else: + * return 1 +*/ + __pyx_r = 0; + goto __pyx_L0; + + /* "spacy/pipeline/_parser_internals/arc_eager.pyx":431 + * elif st.is_sent_start(st.B(0)): + * return 0 + * elif label == SUBTOK_LABEL and st.S(0) != (st.B(0)-1): # <<<<<<<<<<<<<< + * return 0 + * else: +*/ + } + + /* "spacy/pipeline/_parser_internals/arc_eager.pyx":434 + * return 0 + * else: + * return 1 # <<<<<<<<<<<<<< + * + * @staticmethod +*/ + /*else*/ { + __pyx_r = 1; + goto __pyx_L0; + } + + /* "spacy/pipeline/_parser_internals/arc_eager.pyx":423 + * pop_cost - Arc(B[0], S[0], label) + (Arc(S[1], S[0]) if H(S[0]) else Arcs(S, S[0])) + * """ + * @staticmethod # <<<<<<<<<<<<<< + * cdef bint is_valid(const StateC* st, attr_t label) noexcept nogil: + * if st.stack_depth() == 0: +*/ + + /* function exit code */ + __pyx_L0:; + return __pyx_r; +} + +/* "spacy/pipeline/_parser_internals/arc_eager.pyx":436 + * return 1 + * + * @staticmethod # <<<<<<<<<<<<<< + * cdef int transition(StateC* st, attr_t label) noexcept nogil: + * st.add_arc(st.B(0), st.S(0), label) +*/ + +static int __pyx_f_5spacy_8pipeline_17_parser_internals_9arc_eager_7LeftArc_transition(__pyx_t_5spacy_8pipeline_17_parser_internals_6_state_StateC *__pyx_v_st, __pyx_t_5spacy_8typedefs_attr_t __pyx_v_label) { + int __pyx_r; + + /* "spacy/pipeline/_parser_internals/arc_eager.pyx":438 + * @staticmethod + * cdef int transition(StateC* st, attr_t label) noexcept nogil: + * st.add_arc(st.B(0), st.S(0), label) # <<<<<<<<<<<<<< + * # If we change the stack, it's okay to remove the shifted mark, as + * # we can't get in an infinite loop this way. +*/ + __pyx_v_st->add_arc(__pyx_v_st->B(0), __pyx_v_st->S(0), __pyx_v_label); + + /* "spacy/pipeline/_parser_internals/arc_eager.pyx":441 + * # If we change the stack, it's okay to remove the shifted mark, as + * # we can't get in an infinite loop this way. + * st.set_reshiftable(st.B(0)) # <<<<<<<<<<<<<< + * st.pop() + * +*/ + __pyx_v_st->set_reshiftable(__pyx_v_st->B(0)); + + /* "spacy/pipeline/_parser_internals/arc_eager.pyx":442 + * # we can't get in an infinite loop this way. + * st.set_reshiftable(st.B(0)) + * st.pop() # <<<<<<<<<<<<<< + * + * @staticmethod +*/ + __pyx_v_st->pop(); + + /* "spacy/pipeline/_parser_internals/arc_eager.pyx":436 + * return 1 + * + * @staticmethod # <<<<<<<<<<<<<< + * cdef int transition(StateC* st, attr_t label) noexcept nogil: + * st.add_arc(st.B(0), st.S(0), label) +*/ + + /* function exit code */ + __pyx_r = 0; + return __pyx_r; +} + +/* "spacy/pipeline/_parser_internals/arc_eager.pyx":444 + * st.pop() + * + * @staticmethod # <<<<<<<<<<<<<< + * cdef inline weight_t cost(const StateC* state, const void* _gold, attr_t label) noexcept nogil: + * gold = _gold +*/ + +static CYTHON_INLINE __pyx_t_5spacy_8typedefs_weight_t __pyx_f_5spacy_8pipeline_17_parser_internals_9arc_eager_7LeftArc_cost(__pyx_t_5spacy_8pipeline_17_parser_internals_6_state_StateC const *__pyx_v_state, void const *__pyx_v__gold, __pyx_t_5spacy_8typedefs_attr_t __pyx_v_label) { + struct __pyx_t_5spacy_8pipeline_17_parser_internals_9arc_eager_GoldParseStateC const *__pyx_v_gold; + __pyx_t_5spacy_8typedefs_weight_t __pyx_v_cost; + int __pyx_v_s0; + int __pyx_v_s1; + int __pyx_v_b0; + __pyx_t_5spacy_8typedefs_weight_t __pyx_r; + __pyx_t_5spacy_8typedefs_weight_t __pyx_t_1; + int __pyx_t_2; + int __pyx_t_3; + + /* "spacy/pipeline/_parser_internals/arc_eager.pyx":446 + * @staticmethod + * cdef inline weight_t cost(const StateC* state, const void* _gold, attr_t label) noexcept nogil: + * gold = _gold # <<<<<<<<<<<<<< + * cdef weight_t cost = gold.pop_cost + * s0 = state.S(0) +*/ + __pyx_v_gold = ((struct __pyx_t_5spacy_8pipeline_17_parser_internals_9arc_eager_GoldParseStateC const *)__pyx_v__gold); + + /* "spacy/pipeline/_parser_internals/arc_eager.pyx":447 + * cdef inline weight_t cost(const StateC* state, const void* _gold, attr_t label) noexcept nogil: + * gold = _gold + * cdef weight_t cost = gold.pop_cost # <<<<<<<<<<<<<< + * s0 = state.S(0) + * s1 = state.S(1) +*/ + __pyx_t_1 = __pyx_v_gold->pop_cost; + __pyx_v_cost = __pyx_t_1; + + /* "spacy/pipeline/_parser_internals/arc_eager.pyx":448 + * gold = _gold + * cdef weight_t cost = gold.pop_cost + * s0 = state.S(0) # <<<<<<<<<<<<<< + * s1 = state.S(1) + * b0 = state.B(0) +*/ + __pyx_v_s0 = __pyx_v_state->S(0); + + /* "spacy/pipeline/_parser_internals/arc_eager.pyx":449 + * cdef weight_t cost = gold.pop_cost + * s0 = state.S(0) + * s1 = state.S(1) # <<<<<<<<<<<<<< + * b0 = state.B(0) + * if state.has_head(s0): +*/ + __pyx_v_s1 = __pyx_v_state->S(1); + + /* "spacy/pipeline/_parser_internals/arc_eager.pyx":450 + * s0 = state.S(0) + * s1 = state.S(1) + * b0 = state.B(0) # <<<<<<<<<<<<<< + * if state.has_head(s0): + * # Increment cost if we're clobbering a correct arc +*/ + __pyx_v_b0 = __pyx_v_state->B(0); + + /* "spacy/pipeline/_parser_internals/arc_eager.pyx":451 + * s1 = state.S(1) + * b0 = state.B(0) + * if state.has_head(s0): # <<<<<<<<<<<<<< + * # Increment cost if we're clobbering a correct arc + * cost += gold.heads[s0] == s1 +*/ + __pyx_t_2 = __pyx_v_state->has_head(__pyx_v_s0); + if (__pyx_t_2) { + + /* "spacy/pipeline/_parser_internals/arc_eager.pyx":453 + * if state.has_head(s0): + * # Increment cost if we're clobbering a correct arc + * cost += gold.heads[s0] == s1 # <<<<<<<<<<<<<< + * else: + * # If there's no head, we're losing arcs between S0 and S[1:]. +*/ + __pyx_v_cost = (__pyx_v_cost + ((__pyx_v_gold->heads[__pyx_v_s0]) == __pyx_v_s1)); + + /* "spacy/pipeline/_parser_internals/arc_eager.pyx":451 + * s1 = state.S(1) + * b0 = state.B(0) + * if state.has_head(s0): # <<<<<<<<<<<<<< + * # Increment cost if we're clobbering a correct arc + * cost += gold.heads[s0] == s1 +*/ + goto __pyx_L3; + } + + /* "spacy/pipeline/_parser_internals/arc_eager.pyx":456 + * else: + * # If there's no head, we're losing arcs between S0 and S[1:]. + * cost += is_head_in_stack(gold, s0) # <<<<<<<<<<<<<< + * cost += gold.n_kids_in_stack[s0] + * if b0 != -1 and s0 != -1 and gold.heads[s0] == b0: +*/ + /*else*/ { + __pyx_v_cost = (__pyx_v_cost + __pyx_f_5spacy_8pipeline_17_parser_internals_9arc_eager_is_head_in_stack(__pyx_v_gold, __pyx_v_s0)); + + /* "spacy/pipeline/_parser_internals/arc_eager.pyx":457 + * # If there's no head, we're losing arcs between S0 and S[1:]. + * cost += is_head_in_stack(gold, s0) + * cost += gold.n_kids_in_stack[s0] # <<<<<<<<<<<<<< + * if b0 != -1 and s0 != -1 and gold.heads[s0] == b0: + * cost -= 1 +*/ + __pyx_v_cost = (__pyx_v_cost + (__pyx_v_gold->n_kids_in_stack[__pyx_v_s0])); + } + __pyx_L3:; + + /* "spacy/pipeline/_parser_internals/arc_eager.pyx":458 + * cost += is_head_in_stack(gold, s0) + * cost += gold.n_kids_in_stack[s0] + * if b0 != -1 and s0 != -1 and gold.heads[s0] == b0: # <<<<<<<<<<<<<< + * cost -= 1 + * cost += not label_is_gold(gold, s0, label) +*/ + __pyx_t_3 = (__pyx_v_b0 != -1L); + if (__pyx_t_3) { + } else { + __pyx_t_2 = __pyx_t_3; + goto __pyx_L5_bool_binop_done; + } + __pyx_t_3 = (__pyx_v_s0 != -1L); + if (__pyx_t_3) { + } else { + __pyx_t_2 = __pyx_t_3; + goto __pyx_L5_bool_binop_done; + } + __pyx_t_3 = ((__pyx_v_gold->heads[__pyx_v_s0]) == __pyx_v_b0); + __pyx_t_2 = __pyx_t_3; + __pyx_L5_bool_binop_done:; + if (__pyx_t_2) { + + /* "spacy/pipeline/_parser_internals/arc_eager.pyx":459 + * cost += gold.n_kids_in_stack[s0] + * if b0 != -1 and s0 != -1 and gold.heads[s0] == b0: + * cost -= 1 # <<<<<<<<<<<<<< + * cost += not label_is_gold(gold, s0, label) + * return cost +*/ + __pyx_v_cost = (__pyx_v_cost - 1.0); + + /* "spacy/pipeline/_parser_internals/arc_eager.pyx":460 + * if b0 != -1 and s0 != -1 and gold.heads[s0] == b0: + * cost -= 1 + * cost += not label_is_gold(gold, s0, label) # <<<<<<<<<<<<<< + * return cost + * +*/ + __pyx_v_cost = (__pyx_v_cost + (!__pyx_f_5spacy_8pipeline_17_parser_internals_9arc_eager_label_is_gold(__pyx_v_gold, __pyx_v_s0, __pyx_v_label))); + + /* "spacy/pipeline/_parser_internals/arc_eager.pyx":458 + * cost += is_head_in_stack(gold, s0) + * cost += gold.n_kids_in_stack[s0] + * if b0 != -1 and s0 != -1 and gold.heads[s0] == b0: # <<<<<<<<<<<<<< + * cost -= 1 + * cost += not label_is_gold(gold, s0, label) +*/ + } + + /* "spacy/pipeline/_parser_internals/arc_eager.pyx":461 + * cost -= 1 + * cost += not label_is_gold(gold, s0, label) + * return cost # <<<<<<<<<<<<<< + * + * +*/ + __pyx_r = __pyx_v_cost; + goto __pyx_L0; + + /* "spacy/pipeline/_parser_internals/arc_eager.pyx":444 + * st.pop() + * + * @staticmethod # <<<<<<<<<<<<<< + * cdef inline weight_t cost(const StateC* state, const void* _gold, attr_t label) noexcept nogil: + * gold = _gold +*/ + + /* function exit code */ + __pyx_L0:; + return __pyx_r; +} + +/* "(tree fragment)":1 + * def __reduce_cython__(self): # <<<<<<<<<<<<<< + * cdef tuple state + * cdef object _dict +*/ + +/* Python wrapper */ +static PyObject *__pyx_pw_5spacy_8pipeline_17_parser_internals_9arc_eager_7LeftArc_1__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_5spacy_8pipeline_17_parser_internals_9arc_eager_7LeftArc___reduce_cython__, "LeftArc.__reduce_cython__(self)"); +static PyMethodDef __pyx_mdef_5spacy_8pipeline_17_parser_internals_9arc_eager_7LeftArc_1__reduce_cython__ = {"__reduce_cython__", (PyCFunction)(void(*)(void))(__Pyx_PyCFunction_FastCallWithKeywords)__pyx_pw_5spacy_8pipeline_17_parser_internals_9arc_eager_7LeftArc_1__reduce_cython__, __Pyx_METH_FASTCALL|METH_KEYWORDS, __pyx_doc_5spacy_8pipeline_17_parser_internals_9arc_eager_7LeftArc___reduce_cython__}; +static PyObject *__pyx_pw_5spacy_8pipeline_17_parser_internals_9arc_eager_7LeftArc_1__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_5spacy_8pipeline_17_parser_internals_9arc_eager_7LeftArc___reduce_cython__(((struct __pyx_obj_5spacy_8pipeline_17_parser_internals_9arc_eager_LeftArc *)__pyx_v_self)); + + /* function exit code */ + __Pyx_RefNannyFinishContext(); + return __pyx_r; +} + +static PyObject *__pyx_pf_5spacy_8pipeline_17_parser_internals_9arc_eager_7LeftArc___reduce_cython__(struct __pyx_obj_5spacy_8pipeline_17_parser_internals_9arc_eager_LeftArc *__pyx_v_self) { + PyObject *__pyx_v_state = 0; + PyObject *__pyx_v__dict = 0; + int __pyx_v_use_setstate; + PyObject *__pyx_r = NULL; + __Pyx_RefNannyDeclarations + PyObject *__pyx_t_1 = NULL; + int __pyx_t_2; + int __pyx_t_3; + PyObject *__pyx_t_4 = NULL; + PyObject *__pyx_t_5 = NULL; + int __pyx_lineno = 0; + const char *__pyx_filename = NULL; + int __pyx_clineno = 0; + __Pyx_RefNannySetupContext("__reduce_cython__", 0); + + /* "(tree fragment)":5 + * cdef object _dict + * cdef bint use_setstate + * state = () # <<<<<<<<<<<<<< + * _dict = getattr(self, '__dict__', None) + * if _dict is not None and _dict: +*/ + __Pyx_INCREF(__pyx_mstate_global->__pyx_empty_tuple); + __pyx_v_state = __pyx_mstate_global->__pyx_empty_tuple; + + /* "(tree fragment)":6 + * cdef bint use_setstate + * state = () + * _dict = getattr(self, '__dict__', None) # <<<<<<<<<<<<<< + * if _dict is not None and _dict: + * state += (_dict,) +*/ + __pyx_t_1 = __Pyx_GetAttr3(((PyObject *)__pyx_v_self), __pyx_mstate_global->__pyx_n_u_dict, Py_None); if (unlikely(!__pyx_t_1)) __PYX_ERR(1, 6, __pyx_L1_error) + __Pyx_GOTREF(__pyx_t_1); + __pyx_v__dict = __pyx_t_1; + __pyx_t_1 = 0; + + /* "(tree fragment)":7 + * state = () + * _dict = getattr(self, '__dict__', None) + * if _dict is not None and _dict: # <<<<<<<<<<<<<< + * state += (_dict,) + * use_setstate = True +*/ + __pyx_t_3 = (__pyx_v__dict != Py_None); + if (__pyx_t_3) { + } else { + __pyx_t_2 = __pyx_t_3; + goto __pyx_L4_bool_binop_done; + } + __pyx_t_3 = __Pyx_PyObject_IsTrue(__pyx_v__dict); if (unlikely((__pyx_t_3 < 0))) __PYX_ERR(1, 7, __pyx_L1_error) + __pyx_t_2 = __pyx_t_3; + __pyx_L4_bool_binop_done:; + if (__pyx_t_2) { + + /* "(tree fragment)":8 + * _dict = getattr(self, '__dict__', None) + * if _dict is not None and _dict: + * state += (_dict,) # <<<<<<<<<<<<<< + * use_setstate = True + * else: +*/ + __pyx_t_1 = PyTuple_New(1); if (unlikely(!__pyx_t_1)) __PYX_ERR(1, 8, __pyx_L1_error) + __Pyx_GOTREF(__pyx_t_1); + __Pyx_INCREF(__pyx_v__dict); + __Pyx_GIVEREF(__pyx_v__dict); + if (__Pyx_PyTuple_SET_ITEM(__pyx_t_1, 0, __pyx_v__dict) != (0)) __PYX_ERR(1, 8, __pyx_L1_error); + __pyx_t_4 = PyNumber_InPlaceAdd(__pyx_v_state, __pyx_t_1); if (unlikely(!__pyx_t_4)) __PYX_ERR(1, 8, __pyx_L1_error) + __Pyx_GOTREF(__pyx_t_4); + __Pyx_DECREF(__pyx_t_1); __pyx_t_1 = 0; + __Pyx_DECREF_SET(__pyx_v_state, ((PyObject*)__pyx_t_4)); + __pyx_t_4 = 0; + + /* "(tree fragment)":9 + * if _dict is not None and _dict: + * state += (_dict,) + * use_setstate = True # <<<<<<<<<<<<<< + * else: + * use_setstate = ('False',) +*/ + __pyx_v_use_setstate = 1; + + /* "(tree fragment)":7 + * state = () + * _dict = getattr(self, '__dict__', None) + * if _dict is not None and _dict: # <<<<<<<<<<<<<< + * state += (_dict,) + * use_setstate = True +*/ + goto __pyx_L3; + } + + /* "(tree fragment)":11 + * use_setstate = True + * else: + * use_setstate = ('False',) # <<<<<<<<<<<<<< + * if use_setstate: + * return __pyx_unpickle_LeftArc, (type(self), 0xe3b0c44, None), state +*/ + /*else*/ { + __pyx_t_2 = __Pyx_PyObject_IsTrue(__pyx_mstate_global->__pyx_tuple[2]); if (unlikely((__pyx_t_2 == (int)-1) && PyErr_Occurred())) __PYX_ERR(1, 11, __pyx_L1_error) + __pyx_v_use_setstate = __pyx_t_2; + } + __pyx_L3:; + + /* "(tree fragment)":12 + * else: + * use_setstate = ('False',) + * if use_setstate: # <<<<<<<<<<<<<< + * return __pyx_unpickle_LeftArc, (type(self), 0xe3b0c44, None), state + * else: +*/ + if (__pyx_v_use_setstate) { + + /* "(tree fragment)":13 + * use_setstate = ('False',) + * if use_setstate: + * return __pyx_unpickle_LeftArc, (type(self), 0xe3b0c44, None), state # <<<<<<<<<<<<<< + * else: + * return __pyx_unpickle_LeftArc, (type(self), 0xe3b0c44, state) +*/ + __Pyx_XDECREF(__pyx_r); + __Pyx_GetModuleGlobalName(__pyx_t_4, __pyx_mstate_global->__pyx_n_u_pyx_unpickle_LeftArc); if (unlikely(!__pyx_t_4)) __PYX_ERR(1, 13, __pyx_L1_error) + __Pyx_GOTREF(__pyx_t_4); + __pyx_t_1 = PyTuple_New(3); if (unlikely(!__pyx_t_1)) __PYX_ERR(1, 13, __pyx_L1_error) + __Pyx_GOTREF(__pyx_t_1); + __Pyx_INCREF(((PyObject *)Py_TYPE(((PyObject *)__pyx_v_self)))); + __Pyx_GIVEREF(((PyObject *)Py_TYPE(((PyObject *)__pyx_v_self)))); + if (__Pyx_PyTuple_SET_ITEM(__pyx_t_1, 0, ((PyObject *)Py_TYPE(((PyObject *)__pyx_v_self)))) != (0)) __PYX_ERR(1, 13, __pyx_L1_error); + __Pyx_INCREF(__pyx_mstate_global->__pyx_int_238750788); + __Pyx_GIVEREF(__pyx_mstate_global->__pyx_int_238750788); + if (__Pyx_PyTuple_SET_ITEM(__pyx_t_1, 1, __pyx_mstate_global->__pyx_int_238750788) != (0)) __PYX_ERR(1, 13, __pyx_L1_error); + __Pyx_INCREF(Py_None); + __Pyx_GIVEREF(Py_None); + if (__Pyx_PyTuple_SET_ITEM(__pyx_t_1, 2, Py_None) != (0)) __PYX_ERR(1, 13, __pyx_L1_error); + __pyx_t_5 = PyTuple_New(3); if (unlikely(!__pyx_t_5)) __PYX_ERR(1, 13, __pyx_L1_error) + __Pyx_GOTREF(__pyx_t_5); + __Pyx_GIVEREF(__pyx_t_4); + if (__Pyx_PyTuple_SET_ITEM(__pyx_t_5, 0, __pyx_t_4) != (0)) __PYX_ERR(1, 13, __pyx_L1_error); + __Pyx_GIVEREF(__pyx_t_1); + if (__Pyx_PyTuple_SET_ITEM(__pyx_t_5, 1, __pyx_t_1) != (0)) __PYX_ERR(1, 13, __pyx_L1_error); + __Pyx_INCREF(__pyx_v_state); + __Pyx_GIVEREF(__pyx_v_state); + if (__Pyx_PyTuple_SET_ITEM(__pyx_t_5, 2, __pyx_v_state) != (0)) __PYX_ERR(1, 13, __pyx_L1_error); + __pyx_t_4 = 0; + __pyx_t_1 = 0; + __pyx_r = __pyx_t_5; + __pyx_t_5 = 0; + goto __pyx_L0; + + /* "(tree fragment)":12 + * else: + * use_setstate = ('False',) + * if use_setstate: # <<<<<<<<<<<<<< + * return __pyx_unpickle_LeftArc, (type(self), 0xe3b0c44, None), state + * else: +*/ + } + + /* "(tree fragment)":15 + * return __pyx_unpickle_LeftArc, (type(self), 0xe3b0c44, None), state + * else: + * return __pyx_unpickle_LeftArc, (type(self), 0xe3b0c44, state) # <<<<<<<<<<<<<< + * def __setstate_cython__(self, __pyx_state): + * __pyx_unpickle_LeftArc__set_state(self, __pyx_state) +*/ + /*else*/ { + __Pyx_XDECREF(__pyx_r); + __Pyx_GetModuleGlobalName(__pyx_t_5, __pyx_mstate_global->__pyx_n_u_pyx_unpickle_LeftArc); if (unlikely(!__pyx_t_5)) __PYX_ERR(1, 15, __pyx_L1_error) + __Pyx_GOTREF(__pyx_t_5); + __pyx_t_1 = PyTuple_New(3); if (unlikely(!__pyx_t_1)) __PYX_ERR(1, 15, __pyx_L1_error) + __Pyx_GOTREF(__pyx_t_1); + __Pyx_INCREF(((PyObject *)Py_TYPE(((PyObject *)__pyx_v_self)))); + __Pyx_GIVEREF(((PyObject *)Py_TYPE(((PyObject *)__pyx_v_self)))); + if (__Pyx_PyTuple_SET_ITEM(__pyx_t_1, 0, ((PyObject *)Py_TYPE(((PyObject *)__pyx_v_self)))) != (0)) __PYX_ERR(1, 15, __pyx_L1_error); + __Pyx_INCREF(__pyx_mstate_global->__pyx_int_238750788); + __Pyx_GIVEREF(__pyx_mstate_global->__pyx_int_238750788); + if (__Pyx_PyTuple_SET_ITEM(__pyx_t_1, 1, __pyx_mstate_global->__pyx_int_238750788) != (0)) __PYX_ERR(1, 15, __pyx_L1_error); + __Pyx_INCREF(__pyx_v_state); + __Pyx_GIVEREF(__pyx_v_state); + if (__Pyx_PyTuple_SET_ITEM(__pyx_t_1, 2, __pyx_v_state) != (0)) __PYX_ERR(1, 15, __pyx_L1_error); + __pyx_t_4 = PyTuple_New(2); if (unlikely(!__pyx_t_4)) __PYX_ERR(1, 15, __pyx_L1_error) + __Pyx_GOTREF(__pyx_t_4); + __Pyx_GIVEREF(__pyx_t_5); + if (__Pyx_PyTuple_SET_ITEM(__pyx_t_4, 0, __pyx_t_5) != (0)) __PYX_ERR(1, 15, __pyx_L1_error); + __Pyx_GIVEREF(__pyx_t_1); + if (__Pyx_PyTuple_SET_ITEM(__pyx_t_4, 1, __pyx_t_1) != (0)) __PYX_ERR(1, 15, __pyx_L1_error); + __pyx_t_5 = 0; + __pyx_t_1 = 0; + __pyx_r = __pyx_t_4; + __pyx_t_4 = 0; + goto __pyx_L0; + } + + /* "(tree fragment)":1 + * def __reduce_cython__(self): # <<<<<<<<<<<<<< + * cdef tuple state + * cdef object _dict +*/ + + /* function exit code */ + __pyx_L1_error:; + __Pyx_XDECREF(__pyx_t_1); + __Pyx_XDECREF(__pyx_t_4); + __Pyx_XDECREF(__pyx_t_5); + __Pyx_AddTraceback("spacy.pipeline._parser_internals.arc_eager.LeftArc.__reduce_cython__", __pyx_clineno, __pyx_lineno, __pyx_filename); + __pyx_r = NULL; + __pyx_L0:; + __Pyx_XDECREF(__pyx_v_state); + __Pyx_XDECREF(__pyx_v__dict); + __Pyx_XGIVEREF(__pyx_r); + __Pyx_RefNannyFinishContext(); + return __pyx_r; +} + +/* "(tree fragment)":16 + * else: + * return __pyx_unpickle_LeftArc, (type(self), 0xe3b0c44, state) + * def __setstate_cython__(self, __pyx_state): # <<<<<<<<<<<<<< + * __pyx_unpickle_LeftArc__set_state(self, __pyx_state) +*/ + +/* Python wrapper */ +static PyObject *__pyx_pw_5spacy_8pipeline_17_parser_internals_9arc_eager_7LeftArc_3__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_5spacy_8pipeline_17_parser_internals_9arc_eager_7LeftArc_2__setstate_cython__, "LeftArc.__setstate_cython__(self, __pyx_state)"); +static PyMethodDef __pyx_mdef_5spacy_8pipeline_17_parser_internals_9arc_eager_7LeftArc_3__setstate_cython__ = {"__setstate_cython__", (PyCFunction)(void(*)(void))(__Pyx_PyCFunction_FastCallWithKeywords)__pyx_pw_5spacy_8pipeline_17_parser_internals_9arc_eager_7LeftArc_3__setstate_cython__, __Pyx_METH_FASTCALL|METH_KEYWORDS, __pyx_doc_5spacy_8pipeline_17_parser_internals_9arc_eager_7LeftArc_2__setstate_cython__}; +static PyObject *__pyx_pw_5spacy_8pipeline_17_parser_internals_9arc_eager_7LeftArc_3__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 +) { + 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, 16, __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, 16, __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, 16, __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, 16, __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, 16, __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, 16, __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("spacy.pipeline._parser_internals.arc_eager.LeftArc.__setstate_cython__", __pyx_clineno, __pyx_lineno, __pyx_filename); + __Pyx_RefNannyFinishContext(); + return NULL; + __pyx_L4_argument_unpacking_done:; + __pyx_r = __pyx_pf_5spacy_8pipeline_17_parser_internals_9arc_eager_7LeftArc_2__setstate_cython__(((struct __pyx_obj_5spacy_8pipeline_17_parser_internals_9arc_eager_LeftArc *)__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_5spacy_8pipeline_17_parser_internals_9arc_eager_7LeftArc_2__setstate_cython__(struct __pyx_obj_5spacy_8pipeline_17_parser_internals_9arc_eager_LeftArc *__pyx_v_self, PyObject *__pyx_v___pyx_state) { + PyObject *__pyx_r = NULL; + __Pyx_RefNannyDeclarations + PyObject *__pyx_t_1 = NULL; + int __pyx_lineno = 0; + const char *__pyx_filename = NULL; + int __pyx_clineno = 0; + __Pyx_RefNannySetupContext("__setstate_cython__", 0); + + /* "(tree fragment)":17 + * return __pyx_unpickle_LeftArc, (type(self), 0xe3b0c44, state) + * def __setstate_cython__(self, __pyx_state): + * __pyx_unpickle_LeftArc__set_state(self, __pyx_state) # <<<<<<<<<<<<<< +*/ + __pyx_t_1 = __pyx_f_5spacy_8pipeline_17_parser_internals_9arc_eager___pyx_unpickle_LeftArc__set_state(__pyx_v_self, __pyx_v___pyx_state); if (unlikely(!__pyx_t_1)) __PYX_ERR(1, 17, __pyx_L1_error) + __Pyx_GOTREF(__pyx_t_1); + __Pyx_DECREF(__pyx_t_1); __pyx_t_1 = 0; + + /* "(tree fragment)":16 + * else: + * return __pyx_unpickle_LeftArc, (type(self), 0xe3b0c44, state) + * def __setstate_cython__(self, __pyx_state): # <<<<<<<<<<<<<< + * __pyx_unpickle_LeftArc__set_state(self, __pyx_state) +*/ + + /* function exit code */ + __pyx_r = Py_None; __Pyx_INCREF(Py_None); + goto __pyx_L0; + __pyx_L1_error:; + __Pyx_XDECREF(__pyx_t_1); + __Pyx_AddTraceback("spacy.pipeline._parser_internals.arc_eager.LeftArc.__setstate_cython__", __pyx_clineno, __pyx_lineno, __pyx_filename); + __pyx_r = NULL; + __pyx_L0:; + __Pyx_XGIVEREF(__pyx_r); + __Pyx_RefNannyFinishContext(); + return __pyx_r; +} + +/* "spacy/pipeline/_parser_internals/arc_eager.pyx":476 + * push_cost + (not shifted[b0] and Arc(B[1:], B[0])) - Arc(S[0], B[0], label) + * """ + * @staticmethod # <<<<<<<<<<<<<< + * cdef bint is_valid(const StateC* st, attr_t label) noexcept nogil: + * if st.stack_depth() == 0: +*/ + +static int __pyx_f_5spacy_8pipeline_17_parser_internals_9arc_eager_8RightArc_is_valid(__pyx_t_5spacy_8pipeline_17_parser_internals_6_state_StateC const *__pyx_v_st, __pyx_t_5spacy_8typedefs_attr_t __pyx_v_label) { + int __pyx_r; + int __pyx_t_1; + int __pyx_t_2; + + /* "spacy/pipeline/_parser_internals/arc_eager.pyx":478 + * @staticmethod + * cdef bint is_valid(const StateC* st, attr_t label) noexcept nogil: + * if st.stack_depth() == 0: # <<<<<<<<<<<<<< + * return 0 + * elif st.buffer_length() == 0: +*/ + __pyx_t_1 = (__pyx_v_st->stack_depth() == 0); + if (__pyx_t_1) { + + /* "spacy/pipeline/_parser_internals/arc_eager.pyx":479 + * cdef bint is_valid(const StateC* st, attr_t label) noexcept nogil: + * if st.stack_depth() == 0: + * return 0 # <<<<<<<<<<<<<< + * elif st.buffer_length() == 0: + * return 0 +*/ + __pyx_r = 0; + goto __pyx_L0; + + /* "spacy/pipeline/_parser_internals/arc_eager.pyx":478 + * @staticmethod + * cdef bint is_valid(const StateC* st, attr_t label) noexcept nogil: + * if st.stack_depth() == 0: # <<<<<<<<<<<<<< + * return 0 + * elif st.buffer_length() == 0: +*/ + } + + /* "spacy/pipeline/_parser_internals/arc_eager.pyx":480 + * if st.stack_depth() == 0: + * return 0 + * elif st.buffer_length() == 0: # <<<<<<<<<<<<<< + * return 0 + * elif st.is_sent_start(st.B(0)): +*/ + __pyx_t_1 = (__pyx_v_st->buffer_length() == 0); + if (__pyx_t_1) { + + /* "spacy/pipeline/_parser_internals/arc_eager.pyx":481 + * return 0 + * elif st.buffer_length() == 0: + * return 0 # <<<<<<<<<<<<<< + * elif st.is_sent_start(st.B(0)): + * return 0 +*/ + __pyx_r = 0; + goto __pyx_L0; + + /* "spacy/pipeline/_parser_internals/arc_eager.pyx":480 + * if st.stack_depth() == 0: + * return 0 + * elif st.buffer_length() == 0: # <<<<<<<<<<<<<< + * return 0 + * elif st.is_sent_start(st.B(0)): +*/ + } + + /* "spacy/pipeline/_parser_internals/arc_eager.pyx":482 + * elif st.buffer_length() == 0: + * return 0 + * elif st.is_sent_start(st.B(0)): # <<<<<<<<<<<<<< + * return 0 + * elif label == SUBTOK_LABEL and st.S(0) != (st.B(0)-1): +*/ + __pyx_t_1 = (__pyx_v_st->is_sent_start(__pyx_v_st->B(0)) != 0); + if (__pyx_t_1) { + + /* "spacy/pipeline/_parser_internals/arc_eager.pyx":483 + * return 0 + * elif st.is_sent_start(st.B(0)): + * return 0 # <<<<<<<<<<<<<< + * elif label == SUBTOK_LABEL and st.S(0) != (st.B(0)-1): + * # If there's (perhaps partial) parse pre-set, don't allow cycle. +*/ + __pyx_r = 0; + goto __pyx_L0; + + /* "spacy/pipeline/_parser_internals/arc_eager.pyx":482 + * elif st.buffer_length() == 0: + * return 0 + * elif st.is_sent_start(st.B(0)): # <<<<<<<<<<<<<< + * return 0 + * elif label == SUBTOK_LABEL and st.S(0) != (st.B(0)-1): +*/ + } + + /* "spacy/pipeline/_parser_internals/arc_eager.pyx":484 + * elif st.is_sent_start(st.B(0)): + * return 0 + * elif label == SUBTOK_LABEL and st.S(0) != (st.B(0)-1): # <<<<<<<<<<<<<< + * # If there's (perhaps partial) parse pre-set, don't allow cycle. + * return 0 +*/ + __pyx_t_2 = (__pyx_v_label == __pyx_v_5spacy_8pipeline_17_parser_internals_9arc_eager_SUBTOK_LABEL); + if (__pyx_t_2) { + } else { + __pyx_t_1 = __pyx_t_2; + goto __pyx_L4_bool_binop_done; + } + __pyx_t_2 = (__pyx_v_st->S(0) != (__pyx_v_st->B(0) - 1)); + __pyx_t_1 = __pyx_t_2; + __pyx_L4_bool_binop_done:; + if (__pyx_t_1) { + + /* "spacy/pipeline/_parser_internals/arc_eager.pyx":486 + * elif label == SUBTOK_LABEL and st.S(0) != (st.B(0)-1): + * # If there's (perhaps partial) parse pre-set, don't allow cycle. + * return 0 # <<<<<<<<<<<<<< + * else: + * return 1 +*/ + __pyx_r = 0; + goto __pyx_L0; + + /* "spacy/pipeline/_parser_internals/arc_eager.pyx":484 + * elif st.is_sent_start(st.B(0)): + * return 0 + * elif label == SUBTOK_LABEL and st.S(0) != (st.B(0)-1): # <<<<<<<<<<<<<< + * # If there's (perhaps partial) parse pre-set, don't allow cycle. + * return 0 +*/ + } + + /* "spacy/pipeline/_parser_internals/arc_eager.pyx":488 + * return 0 + * else: + * return 1 # <<<<<<<<<<<<<< + * + * @staticmethod +*/ + /*else*/ { + __pyx_r = 1; + goto __pyx_L0; + } + + /* "spacy/pipeline/_parser_internals/arc_eager.pyx":476 + * push_cost + (not shifted[b0] and Arc(B[1:], B[0])) - Arc(S[0], B[0], label) + * """ + * @staticmethod # <<<<<<<<<<<<<< + * cdef bint is_valid(const StateC* st, attr_t label) noexcept nogil: + * if st.stack_depth() == 0: +*/ + + /* function exit code */ + __pyx_L0:; + return __pyx_r; +} + +/* "spacy/pipeline/_parser_internals/arc_eager.pyx":490 + * return 1 + * + * @staticmethod # <<<<<<<<<<<<<< + * cdef int transition(StateC* st, attr_t label) noexcept nogil: + * st.add_arc(st.S(0), st.B(0), label) +*/ + +static int __pyx_f_5spacy_8pipeline_17_parser_internals_9arc_eager_8RightArc_transition(__pyx_t_5spacy_8pipeline_17_parser_internals_6_state_StateC *__pyx_v_st, __pyx_t_5spacy_8typedefs_attr_t __pyx_v_label) { + int __pyx_r; + + /* "spacy/pipeline/_parser_internals/arc_eager.pyx":492 + * @staticmethod + * cdef int transition(StateC* st, attr_t label) noexcept nogil: + * st.add_arc(st.S(0), st.B(0), label) # <<<<<<<<<<<<<< + * st.push() + * +*/ + __pyx_v_st->add_arc(__pyx_v_st->S(0), __pyx_v_st->B(0), __pyx_v_label); + + /* "spacy/pipeline/_parser_internals/arc_eager.pyx":493 + * cdef int transition(StateC* st, attr_t label) noexcept nogil: + * st.add_arc(st.S(0), st.B(0), label) + * st.push() # <<<<<<<<<<<<<< + * + * @staticmethod +*/ + __pyx_v_st->push(); + + /* "spacy/pipeline/_parser_internals/arc_eager.pyx":490 + * return 1 + * + * @staticmethod # <<<<<<<<<<<<<< + * cdef int transition(StateC* st, attr_t label) noexcept nogil: + * st.add_arc(st.S(0), st.B(0), label) +*/ + + /* function exit code */ + __pyx_r = 0; + return __pyx_r; +} + +/* "spacy/pipeline/_parser_internals/arc_eager.pyx":495 + * st.push() + * + * @staticmethod # <<<<<<<<<<<<<< + * cdef inline weight_t cost(const StateC* state, const void* _gold, attr_t label) noexcept nogil: + * gold = _gold +*/ + +static CYTHON_INLINE __pyx_t_5spacy_8typedefs_weight_t __pyx_f_5spacy_8pipeline_17_parser_internals_9arc_eager_8RightArc_cost(__pyx_t_5spacy_8pipeline_17_parser_internals_6_state_StateC const *__pyx_v_state, void const *__pyx_v__gold, __pyx_t_5spacy_8typedefs_attr_t __pyx_v_label) { + struct __pyx_t_5spacy_8pipeline_17_parser_internals_9arc_eager_GoldParseStateC const *__pyx_v_gold; + __pyx_t_5spacy_8typedefs_weight_t __pyx_v_cost; + int __pyx_v_s0; + int __pyx_v_b0; + __pyx_t_5spacy_8typedefs_weight_t __pyx_r; + __pyx_t_5spacy_8typedefs_weight_t __pyx_t_1; + int __pyx_t_2; + int __pyx_t_3; + + /* "spacy/pipeline/_parser_internals/arc_eager.pyx":497 + * @staticmethod + * cdef inline weight_t cost(const StateC* state, const void* _gold, attr_t label) noexcept nogil: + * gold = _gold # <<<<<<<<<<<<<< + * cost = gold.push_cost + * s0 = state.S(0) +*/ + __pyx_v_gold = ((struct __pyx_t_5spacy_8pipeline_17_parser_internals_9arc_eager_GoldParseStateC const *)__pyx_v__gold); + + /* "spacy/pipeline/_parser_internals/arc_eager.pyx":498 + * cdef inline weight_t cost(const StateC* state, const void* _gold, attr_t label) noexcept nogil: + * gold = _gold + * cost = gold.push_cost # <<<<<<<<<<<<<< + * s0 = state.S(0) + * b0 = state.B(0) +*/ + __pyx_t_1 = __pyx_v_gold->push_cost; + __pyx_v_cost = __pyx_t_1; + + /* "spacy/pipeline/_parser_internals/arc_eager.pyx":499 + * gold = _gold + * cost = gold.push_cost + * s0 = state.S(0) # <<<<<<<<<<<<<< + * b0 = state.B(0) + * if s0 != -1 and b0 != -1 and gold.heads[b0] == s0: +*/ + __pyx_v_s0 = __pyx_v_state->S(0); + + /* "spacy/pipeline/_parser_internals/arc_eager.pyx":500 + * cost = gold.push_cost + * s0 = state.S(0) + * b0 = state.B(0) # <<<<<<<<<<<<<< + * if s0 != -1 and b0 != -1 and gold.heads[b0] == s0: + * cost -= 1 +*/ + __pyx_v_b0 = __pyx_v_state->B(0); + + /* "spacy/pipeline/_parser_internals/arc_eager.pyx":501 + * s0 = state.S(0) + * b0 = state.B(0) + * if s0 != -1 and b0 != -1 and gold.heads[b0] == s0: # <<<<<<<<<<<<<< + * cost -= 1 + * cost += not label_is_gold(gold, b0, label) +*/ + __pyx_t_3 = (__pyx_v_s0 != -1L); + if (__pyx_t_3) { + } else { + __pyx_t_2 = __pyx_t_3; + goto __pyx_L4_bool_binop_done; + } + __pyx_t_3 = (__pyx_v_b0 != -1L); + if (__pyx_t_3) { + } else { + __pyx_t_2 = __pyx_t_3; + goto __pyx_L4_bool_binop_done; + } + __pyx_t_3 = ((__pyx_v_gold->heads[__pyx_v_b0]) == __pyx_v_s0); + __pyx_t_2 = __pyx_t_3; + __pyx_L4_bool_binop_done:; + if (__pyx_t_2) { + + /* "spacy/pipeline/_parser_internals/arc_eager.pyx":502 + * b0 = state.B(0) + * if s0 != -1 and b0 != -1 and gold.heads[b0] == s0: + * cost -= 1 # <<<<<<<<<<<<<< + * cost += not label_is_gold(gold, b0, label) + * elif is_head_in_buffer(gold, b0) and not state.is_unshiftable(b0): +*/ + __pyx_v_cost = (__pyx_v_cost - 1.0); + + /* "spacy/pipeline/_parser_internals/arc_eager.pyx":503 + * if s0 != -1 and b0 != -1 and gold.heads[b0] == s0: + * cost -= 1 + * cost += not label_is_gold(gold, b0, label) # <<<<<<<<<<<<<< + * elif is_head_in_buffer(gold, b0) and not state.is_unshiftable(b0): + * cost += 1 +*/ + __pyx_v_cost = (__pyx_v_cost + (!__pyx_f_5spacy_8pipeline_17_parser_internals_9arc_eager_label_is_gold(__pyx_v_gold, __pyx_v_b0, __pyx_v_label))); + + /* "spacy/pipeline/_parser_internals/arc_eager.pyx":501 + * s0 = state.S(0) + * b0 = state.B(0) + * if s0 != -1 and b0 != -1 and gold.heads[b0] == s0: # <<<<<<<<<<<<<< + * cost -= 1 + * cost += not label_is_gold(gold, b0, label) +*/ + goto __pyx_L3; + } + + /* "spacy/pipeline/_parser_internals/arc_eager.pyx":504 + * cost -= 1 + * cost += not label_is_gold(gold, b0, label) + * elif is_head_in_buffer(gold, b0) and not state.is_unshiftable(b0): # <<<<<<<<<<<<<< + * cost += 1 + * return cost +*/ + __pyx_t_3 = (__pyx_f_5spacy_8pipeline_17_parser_internals_9arc_eager_is_head_in_buffer(__pyx_v_gold, __pyx_v_b0) != 0); + if (__pyx_t_3) { + } else { + __pyx_t_2 = __pyx_t_3; + goto __pyx_L7_bool_binop_done; + } + __pyx_t_3 = (!(__pyx_v_state->is_unshiftable(__pyx_v_b0) != 0)); + __pyx_t_2 = __pyx_t_3; + __pyx_L7_bool_binop_done:; + if (__pyx_t_2) { + + /* "spacy/pipeline/_parser_internals/arc_eager.pyx":505 + * cost += not label_is_gold(gold, b0, label) + * elif is_head_in_buffer(gold, b0) and not state.is_unshiftable(b0): + * cost += 1 # <<<<<<<<<<<<<< + * return cost + * +*/ + __pyx_v_cost = (__pyx_v_cost + 1.0); + + /* "spacy/pipeline/_parser_internals/arc_eager.pyx":504 + * cost -= 1 + * cost += not label_is_gold(gold, b0, label) + * elif is_head_in_buffer(gold, b0) and not state.is_unshiftable(b0): # <<<<<<<<<<<<<< + * cost += 1 + * return cost +*/ + } + __pyx_L3:; + + /* "spacy/pipeline/_parser_internals/arc_eager.pyx":506 + * elif is_head_in_buffer(gold, b0) and not state.is_unshiftable(b0): + * cost += 1 + * return cost # <<<<<<<<<<<<<< + * + * +*/ + __pyx_r = __pyx_v_cost; + goto __pyx_L0; + + /* "spacy/pipeline/_parser_internals/arc_eager.pyx":495 + * st.push() + * + * @staticmethod # <<<<<<<<<<<<<< + * cdef inline weight_t cost(const StateC* state, const void* _gold, attr_t label) noexcept nogil: + * gold = _gold +*/ + + /* function exit code */ + __pyx_L0:; + return __pyx_r; +} + +/* "(tree fragment)":1 + * def __reduce_cython__(self): # <<<<<<<<<<<<<< + * cdef tuple state + * cdef object _dict +*/ + +/* Python wrapper */ +static PyObject *__pyx_pw_5spacy_8pipeline_17_parser_internals_9arc_eager_8RightArc_1__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_5spacy_8pipeline_17_parser_internals_9arc_eager_8RightArc___reduce_cython__, "RightArc.__reduce_cython__(self)"); +static PyMethodDef __pyx_mdef_5spacy_8pipeline_17_parser_internals_9arc_eager_8RightArc_1__reduce_cython__ = {"__reduce_cython__", (PyCFunction)(void(*)(void))(__Pyx_PyCFunction_FastCallWithKeywords)__pyx_pw_5spacy_8pipeline_17_parser_internals_9arc_eager_8RightArc_1__reduce_cython__, __Pyx_METH_FASTCALL|METH_KEYWORDS, __pyx_doc_5spacy_8pipeline_17_parser_internals_9arc_eager_8RightArc___reduce_cython__}; +static PyObject *__pyx_pw_5spacy_8pipeline_17_parser_internals_9arc_eager_8RightArc_1__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_5spacy_8pipeline_17_parser_internals_9arc_eager_8RightArc___reduce_cython__(((struct __pyx_obj_5spacy_8pipeline_17_parser_internals_9arc_eager_RightArc *)__pyx_v_self)); + + /* function exit code */ + __Pyx_RefNannyFinishContext(); + return __pyx_r; +} + +static PyObject *__pyx_pf_5spacy_8pipeline_17_parser_internals_9arc_eager_8RightArc___reduce_cython__(struct __pyx_obj_5spacy_8pipeline_17_parser_internals_9arc_eager_RightArc *__pyx_v_self) { + PyObject *__pyx_v_state = 0; + PyObject *__pyx_v__dict = 0; + int __pyx_v_use_setstate; + PyObject *__pyx_r = NULL; + __Pyx_RefNannyDeclarations + PyObject *__pyx_t_1 = NULL; + int __pyx_t_2; + int __pyx_t_3; + PyObject *__pyx_t_4 = NULL; + PyObject *__pyx_t_5 = NULL; + int __pyx_lineno = 0; + const char *__pyx_filename = NULL; + int __pyx_clineno = 0; + __Pyx_RefNannySetupContext("__reduce_cython__", 0); + + /* "(tree fragment)":5 + * cdef object _dict + * cdef bint use_setstate + * state = () # <<<<<<<<<<<<<< + * _dict = getattr(self, '__dict__', None) + * if _dict is not None and _dict: +*/ + __Pyx_INCREF(__pyx_mstate_global->__pyx_empty_tuple); + __pyx_v_state = __pyx_mstate_global->__pyx_empty_tuple; + + /* "(tree fragment)":6 + * cdef bint use_setstate + * state = () + * _dict = getattr(self, '__dict__', None) # <<<<<<<<<<<<<< + * if _dict is not None and _dict: + * state += (_dict,) +*/ + __pyx_t_1 = __Pyx_GetAttr3(((PyObject *)__pyx_v_self), __pyx_mstate_global->__pyx_n_u_dict, Py_None); if (unlikely(!__pyx_t_1)) __PYX_ERR(1, 6, __pyx_L1_error) + __Pyx_GOTREF(__pyx_t_1); + __pyx_v__dict = __pyx_t_1; + __pyx_t_1 = 0; + + /* "(tree fragment)":7 + * state = () + * _dict = getattr(self, '__dict__', None) + * if _dict is not None and _dict: # <<<<<<<<<<<<<< + * state += (_dict,) + * use_setstate = True +*/ + __pyx_t_3 = (__pyx_v__dict != Py_None); + if (__pyx_t_3) { + } else { + __pyx_t_2 = __pyx_t_3; + goto __pyx_L4_bool_binop_done; + } + __pyx_t_3 = __Pyx_PyObject_IsTrue(__pyx_v__dict); if (unlikely((__pyx_t_3 < 0))) __PYX_ERR(1, 7, __pyx_L1_error) + __pyx_t_2 = __pyx_t_3; + __pyx_L4_bool_binop_done:; + if (__pyx_t_2) { + + /* "(tree fragment)":8 + * _dict = getattr(self, '__dict__', None) + * if _dict is not None and _dict: + * state += (_dict,) # <<<<<<<<<<<<<< + * use_setstate = True + * else: +*/ + __pyx_t_1 = PyTuple_New(1); if (unlikely(!__pyx_t_1)) __PYX_ERR(1, 8, __pyx_L1_error) + __Pyx_GOTREF(__pyx_t_1); + __Pyx_INCREF(__pyx_v__dict); + __Pyx_GIVEREF(__pyx_v__dict); + if (__Pyx_PyTuple_SET_ITEM(__pyx_t_1, 0, __pyx_v__dict) != (0)) __PYX_ERR(1, 8, __pyx_L1_error); + __pyx_t_4 = PyNumber_InPlaceAdd(__pyx_v_state, __pyx_t_1); if (unlikely(!__pyx_t_4)) __PYX_ERR(1, 8, __pyx_L1_error) + __Pyx_GOTREF(__pyx_t_4); + __Pyx_DECREF(__pyx_t_1); __pyx_t_1 = 0; + __Pyx_DECREF_SET(__pyx_v_state, ((PyObject*)__pyx_t_4)); + __pyx_t_4 = 0; + + /* "(tree fragment)":9 + * if _dict is not None and _dict: + * state += (_dict,) + * use_setstate = True # <<<<<<<<<<<<<< + * else: + * use_setstate = ('False',) +*/ + __pyx_v_use_setstate = 1; + + /* "(tree fragment)":7 + * state = () + * _dict = getattr(self, '__dict__', None) + * if _dict is not None and _dict: # <<<<<<<<<<<<<< + * state += (_dict,) + * use_setstate = True +*/ + goto __pyx_L3; + } + + /* "(tree fragment)":11 + * use_setstate = True + * else: + * use_setstate = ('False',) # <<<<<<<<<<<<<< + * if use_setstate: + * return __pyx_unpickle_RightArc, (type(self), 0xe3b0c44, None), state +*/ + /*else*/ { + __pyx_t_2 = __Pyx_PyObject_IsTrue(__pyx_mstate_global->__pyx_tuple[2]); if (unlikely((__pyx_t_2 == (int)-1) && PyErr_Occurred())) __PYX_ERR(1, 11, __pyx_L1_error) + __pyx_v_use_setstate = __pyx_t_2; + } + __pyx_L3:; + + /* "(tree fragment)":12 + * else: + * use_setstate = ('False',) + * if use_setstate: # <<<<<<<<<<<<<< + * return __pyx_unpickle_RightArc, (type(self), 0xe3b0c44, None), state + * else: +*/ + if (__pyx_v_use_setstate) { + + /* "(tree fragment)":13 + * use_setstate = ('False',) + * if use_setstate: + * return __pyx_unpickle_RightArc, (type(self), 0xe3b0c44, None), state # <<<<<<<<<<<<<< + * else: + * return __pyx_unpickle_RightArc, (type(self), 0xe3b0c44, state) +*/ + __Pyx_XDECREF(__pyx_r); + __Pyx_GetModuleGlobalName(__pyx_t_4, __pyx_mstate_global->__pyx_n_u_pyx_unpickle_RightArc); if (unlikely(!__pyx_t_4)) __PYX_ERR(1, 13, __pyx_L1_error) + __Pyx_GOTREF(__pyx_t_4); + __pyx_t_1 = PyTuple_New(3); if (unlikely(!__pyx_t_1)) __PYX_ERR(1, 13, __pyx_L1_error) + __Pyx_GOTREF(__pyx_t_1); + __Pyx_INCREF(((PyObject *)Py_TYPE(((PyObject *)__pyx_v_self)))); + __Pyx_GIVEREF(((PyObject *)Py_TYPE(((PyObject *)__pyx_v_self)))); + if (__Pyx_PyTuple_SET_ITEM(__pyx_t_1, 0, ((PyObject *)Py_TYPE(((PyObject *)__pyx_v_self)))) != (0)) __PYX_ERR(1, 13, __pyx_L1_error); + __Pyx_INCREF(__pyx_mstate_global->__pyx_int_238750788); + __Pyx_GIVEREF(__pyx_mstate_global->__pyx_int_238750788); + if (__Pyx_PyTuple_SET_ITEM(__pyx_t_1, 1, __pyx_mstate_global->__pyx_int_238750788) != (0)) __PYX_ERR(1, 13, __pyx_L1_error); + __Pyx_INCREF(Py_None); + __Pyx_GIVEREF(Py_None); + if (__Pyx_PyTuple_SET_ITEM(__pyx_t_1, 2, Py_None) != (0)) __PYX_ERR(1, 13, __pyx_L1_error); + __pyx_t_5 = PyTuple_New(3); if (unlikely(!__pyx_t_5)) __PYX_ERR(1, 13, __pyx_L1_error) + __Pyx_GOTREF(__pyx_t_5); + __Pyx_GIVEREF(__pyx_t_4); + if (__Pyx_PyTuple_SET_ITEM(__pyx_t_5, 0, __pyx_t_4) != (0)) __PYX_ERR(1, 13, __pyx_L1_error); + __Pyx_GIVEREF(__pyx_t_1); + if (__Pyx_PyTuple_SET_ITEM(__pyx_t_5, 1, __pyx_t_1) != (0)) __PYX_ERR(1, 13, __pyx_L1_error); + __Pyx_INCREF(__pyx_v_state); + __Pyx_GIVEREF(__pyx_v_state); + if (__Pyx_PyTuple_SET_ITEM(__pyx_t_5, 2, __pyx_v_state) != (0)) __PYX_ERR(1, 13, __pyx_L1_error); + __pyx_t_4 = 0; + __pyx_t_1 = 0; + __pyx_r = __pyx_t_5; + __pyx_t_5 = 0; + goto __pyx_L0; + + /* "(tree fragment)":12 + * else: + * use_setstate = ('False',) + * if use_setstate: # <<<<<<<<<<<<<< + * return __pyx_unpickle_RightArc, (type(self), 0xe3b0c44, None), state + * else: +*/ + } + + /* "(tree fragment)":15 + * return __pyx_unpickle_RightArc, (type(self), 0xe3b0c44, None), state + * else: + * return __pyx_unpickle_RightArc, (type(self), 0xe3b0c44, state) # <<<<<<<<<<<<<< + * def __setstate_cython__(self, __pyx_state): + * __pyx_unpickle_RightArc__set_state(self, __pyx_state) +*/ + /*else*/ { + __Pyx_XDECREF(__pyx_r); + __Pyx_GetModuleGlobalName(__pyx_t_5, __pyx_mstate_global->__pyx_n_u_pyx_unpickle_RightArc); if (unlikely(!__pyx_t_5)) __PYX_ERR(1, 15, __pyx_L1_error) + __Pyx_GOTREF(__pyx_t_5); + __pyx_t_1 = PyTuple_New(3); if (unlikely(!__pyx_t_1)) __PYX_ERR(1, 15, __pyx_L1_error) + __Pyx_GOTREF(__pyx_t_1); + __Pyx_INCREF(((PyObject *)Py_TYPE(((PyObject *)__pyx_v_self)))); + __Pyx_GIVEREF(((PyObject *)Py_TYPE(((PyObject *)__pyx_v_self)))); + if (__Pyx_PyTuple_SET_ITEM(__pyx_t_1, 0, ((PyObject *)Py_TYPE(((PyObject *)__pyx_v_self)))) != (0)) __PYX_ERR(1, 15, __pyx_L1_error); + __Pyx_INCREF(__pyx_mstate_global->__pyx_int_238750788); + __Pyx_GIVEREF(__pyx_mstate_global->__pyx_int_238750788); + if (__Pyx_PyTuple_SET_ITEM(__pyx_t_1, 1, __pyx_mstate_global->__pyx_int_238750788) != (0)) __PYX_ERR(1, 15, __pyx_L1_error); + __Pyx_INCREF(__pyx_v_state); + __Pyx_GIVEREF(__pyx_v_state); + if (__Pyx_PyTuple_SET_ITEM(__pyx_t_1, 2, __pyx_v_state) != (0)) __PYX_ERR(1, 15, __pyx_L1_error); + __pyx_t_4 = PyTuple_New(2); if (unlikely(!__pyx_t_4)) __PYX_ERR(1, 15, __pyx_L1_error) + __Pyx_GOTREF(__pyx_t_4); + __Pyx_GIVEREF(__pyx_t_5); + if (__Pyx_PyTuple_SET_ITEM(__pyx_t_4, 0, __pyx_t_5) != (0)) __PYX_ERR(1, 15, __pyx_L1_error); + __Pyx_GIVEREF(__pyx_t_1); + if (__Pyx_PyTuple_SET_ITEM(__pyx_t_4, 1, __pyx_t_1) != (0)) __PYX_ERR(1, 15, __pyx_L1_error); + __pyx_t_5 = 0; + __pyx_t_1 = 0; + __pyx_r = __pyx_t_4; + __pyx_t_4 = 0; + goto __pyx_L0; + } + + /* "(tree fragment)":1 + * def __reduce_cython__(self): # <<<<<<<<<<<<<< + * cdef tuple state + * cdef object _dict +*/ + + /* function exit code */ + __pyx_L1_error:; + __Pyx_XDECREF(__pyx_t_1); + __Pyx_XDECREF(__pyx_t_4); + __Pyx_XDECREF(__pyx_t_5); + __Pyx_AddTraceback("spacy.pipeline._parser_internals.arc_eager.RightArc.__reduce_cython__", __pyx_clineno, __pyx_lineno, __pyx_filename); + __pyx_r = NULL; + __pyx_L0:; + __Pyx_XDECREF(__pyx_v_state); + __Pyx_XDECREF(__pyx_v__dict); + __Pyx_XGIVEREF(__pyx_r); + __Pyx_RefNannyFinishContext(); + return __pyx_r; +} + +/* "(tree fragment)":16 + * else: + * return __pyx_unpickle_RightArc, (type(self), 0xe3b0c44, state) + * def __setstate_cython__(self, __pyx_state): # <<<<<<<<<<<<<< + * __pyx_unpickle_RightArc__set_state(self, __pyx_state) +*/ + +/* Python wrapper */ +static PyObject *__pyx_pw_5spacy_8pipeline_17_parser_internals_9arc_eager_8RightArc_3__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_5spacy_8pipeline_17_parser_internals_9arc_eager_8RightArc_2__setstate_cython__, "RightArc.__setstate_cython__(self, __pyx_state)"); +static PyMethodDef __pyx_mdef_5spacy_8pipeline_17_parser_internals_9arc_eager_8RightArc_3__setstate_cython__ = {"__setstate_cython__", (PyCFunction)(void(*)(void))(__Pyx_PyCFunction_FastCallWithKeywords)__pyx_pw_5spacy_8pipeline_17_parser_internals_9arc_eager_8RightArc_3__setstate_cython__, __Pyx_METH_FASTCALL|METH_KEYWORDS, __pyx_doc_5spacy_8pipeline_17_parser_internals_9arc_eager_8RightArc_2__setstate_cython__}; +static PyObject *__pyx_pw_5spacy_8pipeline_17_parser_internals_9arc_eager_8RightArc_3__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 +) { + 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, 16, __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, 16, __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, 16, __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, 16, __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, 16, __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, 16, __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("spacy.pipeline._parser_internals.arc_eager.RightArc.__setstate_cython__", __pyx_clineno, __pyx_lineno, __pyx_filename); + __Pyx_RefNannyFinishContext(); + return NULL; + __pyx_L4_argument_unpacking_done:; + __pyx_r = __pyx_pf_5spacy_8pipeline_17_parser_internals_9arc_eager_8RightArc_2__setstate_cython__(((struct __pyx_obj_5spacy_8pipeline_17_parser_internals_9arc_eager_RightArc *)__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_5spacy_8pipeline_17_parser_internals_9arc_eager_8RightArc_2__setstate_cython__(struct __pyx_obj_5spacy_8pipeline_17_parser_internals_9arc_eager_RightArc *__pyx_v_self, PyObject *__pyx_v___pyx_state) { + PyObject *__pyx_r = NULL; + __Pyx_RefNannyDeclarations + PyObject *__pyx_t_1 = NULL; + int __pyx_lineno = 0; + const char *__pyx_filename = NULL; + int __pyx_clineno = 0; + __Pyx_RefNannySetupContext("__setstate_cython__", 0); + + /* "(tree fragment)":17 + * return __pyx_unpickle_RightArc, (type(self), 0xe3b0c44, state) + * def __setstate_cython__(self, __pyx_state): + * __pyx_unpickle_RightArc__set_state(self, __pyx_state) # <<<<<<<<<<<<<< +*/ + __pyx_t_1 = __pyx_f_5spacy_8pipeline_17_parser_internals_9arc_eager___pyx_unpickle_RightArc__set_state(__pyx_v_self, __pyx_v___pyx_state); if (unlikely(!__pyx_t_1)) __PYX_ERR(1, 17, __pyx_L1_error) + __Pyx_GOTREF(__pyx_t_1); + __Pyx_DECREF(__pyx_t_1); __pyx_t_1 = 0; + + /* "(tree fragment)":16 + * else: + * return __pyx_unpickle_RightArc, (type(self), 0xe3b0c44, state) + * def __setstate_cython__(self, __pyx_state): # <<<<<<<<<<<<<< + * __pyx_unpickle_RightArc__set_state(self, __pyx_state) +*/ + + /* function exit code */ + __pyx_r = Py_None; __Pyx_INCREF(Py_None); + goto __pyx_L0; + __pyx_L1_error:; + __Pyx_XDECREF(__pyx_t_1); + __Pyx_AddTraceback("spacy.pipeline._parser_internals.arc_eager.RightArc.__setstate_cython__", __pyx_clineno, __pyx_lineno, __pyx_filename); + __pyx_r = NULL; + __pyx_L0:; + __Pyx_XGIVEREF(__pyx_r); + __Pyx_RefNannyFinishContext(); + return __pyx_r; +} + +/* "spacy/pipeline/_parser_internals/arc_eager.pyx":527 + * * Arcs between S and B[1] + * """ + * @staticmethod # <<<<<<<<<<<<<< + * cdef bint is_valid(const StateC* st, attr_t label) noexcept nogil: + * if st.buffer_length() < 2: +*/ + +static int __pyx_f_5spacy_8pipeline_17_parser_internals_9arc_eager_5Break_is_valid(__pyx_t_5spacy_8pipeline_17_parser_internals_6_state_StateC const *__pyx_v_st, CYTHON_UNUSED __pyx_t_5spacy_8typedefs_attr_t __pyx_v_label) { + int __pyx_r; + int __pyx_t_1; + + /* "spacy/pipeline/_parser_internals/arc_eager.pyx":529 + * @staticmethod + * cdef bint is_valid(const StateC* st, attr_t label) noexcept nogil: + * if st.buffer_length() < 2: # <<<<<<<<<<<<<< + * return False + * elif st.B(1) != st.B(0) + 1: +*/ + __pyx_t_1 = (__pyx_v_st->buffer_length() < 2); + if (__pyx_t_1) { + + /* "spacy/pipeline/_parser_internals/arc_eager.pyx":530 + * cdef bint is_valid(const StateC* st, attr_t label) noexcept nogil: + * if st.buffer_length() < 2: + * return False # <<<<<<<<<<<<<< + * elif st.B(1) != st.B(0) + 1: + * return False +*/ + __pyx_r = 0; + goto __pyx_L0; + + /* "spacy/pipeline/_parser_internals/arc_eager.pyx":529 + * @staticmethod + * cdef bint is_valid(const StateC* st, attr_t label) noexcept nogil: + * if st.buffer_length() < 2: # <<<<<<<<<<<<<< + * return False + * elif st.B(1) != st.B(0) + 1: +*/ + } + + /* "spacy/pipeline/_parser_internals/arc_eager.pyx":531 + * if st.buffer_length() < 2: + * return False + * elif st.B(1) != st.B(0) + 1: # <<<<<<<<<<<<<< + * return False + * elif st.is_sent_start(st.B(1)): +*/ + __pyx_t_1 = (__pyx_v_st->B(1) != (__pyx_v_st->B(0) + 1)); + if (__pyx_t_1) { + + /* "spacy/pipeline/_parser_internals/arc_eager.pyx":532 + * return False + * elif st.B(1) != st.B(0) + 1: + * return False # <<<<<<<<<<<<<< + * elif st.is_sent_start(st.B(1)): + * return False +*/ + __pyx_r = 0; + goto __pyx_L0; + + /* "spacy/pipeline/_parser_internals/arc_eager.pyx":531 + * if st.buffer_length() < 2: + * return False + * elif st.B(1) != st.B(0) + 1: # <<<<<<<<<<<<<< + * return False + * elif st.is_sent_start(st.B(1)): +*/ + } + + /* "spacy/pipeline/_parser_internals/arc_eager.pyx":533 + * elif st.B(1) != st.B(0) + 1: + * return False + * elif st.is_sent_start(st.B(1)): # <<<<<<<<<<<<<< + * return False + * elif st.cannot_sent_start(st.B(1)): +*/ + __pyx_t_1 = (__pyx_v_st->is_sent_start(__pyx_v_st->B(1)) != 0); + if (__pyx_t_1) { + + /* "spacy/pipeline/_parser_internals/arc_eager.pyx":534 + * return False + * elif st.is_sent_start(st.B(1)): + * return False # <<<<<<<<<<<<<< + * elif st.cannot_sent_start(st.B(1)): + * return False +*/ + __pyx_r = 0; + goto __pyx_L0; + + /* "spacy/pipeline/_parser_internals/arc_eager.pyx":533 + * elif st.B(1) != st.B(0) + 1: + * return False + * elif st.is_sent_start(st.B(1)): # <<<<<<<<<<<<<< + * return False + * elif st.cannot_sent_start(st.B(1)): +*/ + } + + /* "spacy/pipeline/_parser_internals/arc_eager.pyx":535 + * elif st.is_sent_start(st.B(1)): + * return False + * elif st.cannot_sent_start(st.B(1)): # <<<<<<<<<<<<<< + * return False + * else: +*/ + __pyx_t_1 = (__pyx_v_st->cannot_sent_start(__pyx_v_st->B(1)) != 0); + if (__pyx_t_1) { + + /* "spacy/pipeline/_parser_internals/arc_eager.pyx":536 + * return False + * elif st.cannot_sent_start(st.B(1)): + * return False # <<<<<<<<<<<<<< + * else: + * return True +*/ + __pyx_r = 0; + goto __pyx_L0; + + /* "spacy/pipeline/_parser_internals/arc_eager.pyx":535 + * elif st.is_sent_start(st.B(1)): + * return False + * elif st.cannot_sent_start(st.B(1)): # <<<<<<<<<<<<<< + * return False + * else: +*/ + } + + /* "spacy/pipeline/_parser_internals/arc_eager.pyx":538 + * return False + * else: + * return True # <<<<<<<<<<<<<< + * + * @staticmethod +*/ + /*else*/ { + __pyx_r = 1; + goto __pyx_L0; + } + + /* "spacy/pipeline/_parser_internals/arc_eager.pyx":527 + * * Arcs between S and B[1] + * """ + * @staticmethod # <<<<<<<<<<<<<< + * cdef bint is_valid(const StateC* st, attr_t label) noexcept nogil: + * if st.buffer_length() < 2: +*/ + + /* function exit code */ + __pyx_L0:; + return __pyx_r; +} + +/* "spacy/pipeline/_parser_internals/arc_eager.pyx":540 + * return True + * + * @staticmethod # <<<<<<<<<<<<<< + * cdef int transition(StateC* st, attr_t label) noexcept nogil: + * st.set_sent_start(st.B(1), 1) +*/ + +static int __pyx_f_5spacy_8pipeline_17_parser_internals_9arc_eager_5Break_transition(__pyx_t_5spacy_8pipeline_17_parser_internals_6_state_StateC *__pyx_v_st, CYTHON_UNUSED __pyx_t_5spacy_8typedefs_attr_t __pyx_v_label) { + int __pyx_r; + + /* "spacy/pipeline/_parser_internals/arc_eager.pyx":542 + * @staticmethod + * cdef int transition(StateC* st, attr_t label) noexcept nogil: + * st.set_sent_start(st.B(1), 1) # <<<<<<<<<<<<<< + * + * @staticmethod +*/ + __pyx_v_st->set_sent_start(__pyx_v_st->B(1), 1); + + /* "spacy/pipeline/_parser_internals/arc_eager.pyx":540 + * return True + * + * @staticmethod # <<<<<<<<<<<<<< + * cdef int transition(StateC* st, attr_t label) noexcept nogil: + * st.set_sent_start(st.B(1), 1) +*/ + + /* function exit code */ + __pyx_r = 0; + return __pyx_r; +} + +/* "spacy/pipeline/_parser_internals/arc_eager.pyx":544 + * st.set_sent_start(st.B(1), 1) + * + * @staticmethod # <<<<<<<<<<<<<< + * cdef weight_t cost(const StateC* state, const void* _gold, attr_t label) noexcept nogil: + * gold = _gold +*/ + +static __pyx_t_5spacy_8typedefs_weight_t __pyx_f_5spacy_8pipeline_17_parser_internals_9arc_eager_5Break_cost(__pyx_t_5spacy_8pipeline_17_parser_internals_6_state_StateC const *__pyx_v_state, void const *__pyx_v__gold, CYTHON_UNUSED __pyx_t_5spacy_8typedefs_attr_t __pyx_v_label) { + struct __pyx_t_5spacy_8pipeline_17_parser_internals_9arc_eager_GoldParseStateC const *__pyx_v_gold; + int __pyx_v_b0; + int __pyx_v_cost; + int __pyx_v_si; + int __pyx_v_i; + __pyx_t_5spacy_8typedefs_weight_t __pyx_r; + int __pyx_t_1; + int __pyx_t_2; + int __pyx_t_3; + int __pyx_t_4; + int __pyx_t_5; + + /* "spacy/pipeline/_parser_internals/arc_eager.pyx":546 + * @staticmethod + * cdef weight_t cost(const StateC* state, const void* _gold, attr_t label) noexcept nogil: + * gold = _gold # <<<<<<<<<<<<<< + * cdef int b0 = state.B(0) + * cdef int cost = 0 +*/ + __pyx_v_gold = ((struct __pyx_t_5spacy_8pipeline_17_parser_internals_9arc_eager_GoldParseStateC const *)__pyx_v__gold); + + /* "spacy/pipeline/_parser_internals/arc_eager.pyx":547 + * cdef weight_t cost(const StateC* state, const void* _gold, attr_t label) noexcept nogil: + * gold = _gold + * cdef int b0 = state.B(0) # <<<<<<<<<<<<<< + * cdef int cost = 0 + * cdef int si +*/ + __pyx_v_b0 = __pyx_v_state->B(0); + + /* "spacy/pipeline/_parser_internals/arc_eager.pyx":548 + * gold = _gold + * cdef int b0 = state.B(0) + * cdef int cost = 0 # <<<<<<<<<<<<<< + * cdef int si + * for i in range(state.stack_depth()): +*/ + __pyx_v_cost = 0; + + /* "spacy/pipeline/_parser_internals/arc_eager.pyx":550 + * cdef int cost = 0 + * cdef int si + * for i in range(state.stack_depth()): # <<<<<<<<<<<<<< + * si = state.S(i) + * if is_head_in_buffer(gold, si): +*/ + __pyx_t_1 = __pyx_v_state->stack_depth(); + __pyx_t_2 = __pyx_t_1; + for (__pyx_t_3 = 0; __pyx_t_3 < __pyx_t_2; __pyx_t_3+=1) { + __pyx_v_i = __pyx_t_3; + + /* "spacy/pipeline/_parser_internals/arc_eager.pyx":551 + * cdef int si + * for i in range(state.stack_depth()): + * si = state.S(i) # <<<<<<<<<<<<<< + * if is_head_in_buffer(gold, si): + * cost += 1 +*/ + __pyx_v_si = __pyx_v_state->S(__pyx_v_i); + + /* "spacy/pipeline/_parser_internals/arc_eager.pyx":552 + * for i in range(state.stack_depth()): + * si = state.S(i) + * if is_head_in_buffer(gold, si): # <<<<<<<<<<<<<< + * cost += 1 + * cost += gold.n_kids_in_buffer[si] +*/ + __pyx_t_4 = (__pyx_f_5spacy_8pipeline_17_parser_internals_9arc_eager_is_head_in_buffer(__pyx_v_gold, __pyx_v_si) != 0); + if (__pyx_t_4) { + + /* "spacy/pipeline/_parser_internals/arc_eager.pyx":553 + * si = state.S(i) + * if is_head_in_buffer(gold, si): + * cost += 1 # <<<<<<<<<<<<<< + * cost += gold.n_kids_in_buffer[si] + * # We need to score into B[1:], so subtract deps that are at b0 +*/ + __pyx_v_cost = (__pyx_v_cost + 1); + + /* "spacy/pipeline/_parser_internals/arc_eager.pyx":552 + * for i in range(state.stack_depth()): + * si = state.S(i) + * if is_head_in_buffer(gold, si): # <<<<<<<<<<<<<< + * cost += 1 + * cost += gold.n_kids_in_buffer[si] +*/ + } + + /* "spacy/pipeline/_parser_internals/arc_eager.pyx":554 + * if is_head_in_buffer(gold, si): + * cost += 1 + * cost += gold.n_kids_in_buffer[si] # <<<<<<<<<<<<<< + * # We need to score into B[1:], so subtract deps that are at b0 + * if gold.heads[b0] == si: +*/ + __pyx_v_cost = (__pyx_v_cost + (__pyx_v_gold->n_kids_in_buffer[__pyx_v_si])); + + /* "spacy/pipeline/_parser_internals/arc_eager.pyx":556 + * cost += gold.n_kids_in_buffer[si] + * # We need to score into B[1:], so subtract deps that are at b0 + * if gold.heads[b0] == si: # <<<<<<<<<<<<<< + * cost -= 1 + * if gold.heads[si] == b0: +*/ + __pyx_t_4 = ((__pyx_v_gold->heads[__pyx_v_b0]) == __pyx_v_si); + if (__pyx_t_4) { + + /* "spacy/pipeline/_parser_internals/arc_eager.pyx":557 + * # We need to score into B[1:], so subtract deps that are at b0 + * if gold.heads[b0] == si: + * cost -= 1 # <<<<<<<<<<<<<< + * if gold.heads[si] == b0: + * cost -= 1 +*/ + __pyx_v_cost = (__pyx_v_cost - 1); + + /* "spacy/pipeline/_parser_internals/arc_eager.pyx":556 + * cost += gold.n_kids_in_buffer[si] + * # We need to score into B[1:], so subtract deps that are at b0 + * if gold.heads[b0] == si: # <<<<<<<<<<<<<< + * cost -= 1 + * if gold.heads[si] == b0: +*/ + } + + /* "spacy/pipeline/_parser_internals/arc_eager.pyx":558 + * if gold.heads[b0] == si: + * cost -= 1 + * if gold.heads[si] == b0: # <<<<<<<<<<<<<< + * cost -= 1 + * if not is_sent_start(gold, state.B(1)) and\ +*/ + __pyx_t_4 = ((__pyx_v_gold->heads[__pyx_v_si]) == __pyx_v_b0); + if (__pyx_t_4) { + + /* "spacy/pipeline/_parser_internals/arc_eager.pyx":559 + * cost -= 1 + * if gold.heads[si] == b0: + * cost -= 1 # <<<<<<<<<<<<<< + * if not is_sent_start(gold, state.B(1)) and\ + * not is_sent_start_unknown(gold, state.B(1)): +*/ + __pyx_v_cost = (__pyx_v_cost - 1); + + /* "spacy/pipeline/_parser_internals/arc_eager.pyx":558 + * if gold.heads[b0] == si: + * cost -= 1 + * if gold.heads[si] == b0: # <<<<<<<<<<<<<< + * cost -= 1 + * if not is_sent_start(gold, state.B(1)) and\ +*/ + } + } + + /* "spacy/pipeline/_parser_internals/arc_eager.pyx":560 + * if gold.heads[si] == b0: + * cost -= 1 + * if not is_sent_start(gold, state.B(1)) and\ # <<<<<<<<<<<<<< + * not is_sent_start_unknown(gold, state.B(1)): + * cost += 1 +*/ + __pyx_t_5 = (!(__pyx_f_5spacy_8pipeline_17_parser_internals_9arc_eager_is_sent_start(__pyx_v_gold, __pyx_v_state->B(1)) != 0)); + if (__pyx_t_5) { + } else { + __pyx_t_4 = __pyx_t_5; + goto __pyx_L9_bool_binop_done; + } + + /* "spacy/pipeline/_parser_internals/arc_eager.pyx":561 + * cost -= 1 + * if not is_sent_start(gold, state.B(1)) and\ + * not is_sent_start_unknown(gold, state.B(1)): # <<<<<<<<<<<<<< + * cost += 1 + * return cost +*/ + __pyx_t_5 = (!(__pyx_f_5spacy_8pipeline_17_parser_internals_9arc_eager_is_sent_start_unknown(__pyx_v_gold, __pyx_v_state->B(1)) != 0)); + __pyx_t_4 = __pyx_t_5; + __pyx_L9_bool_binop_done:; + + /* "spacy/pipeline/_parser_internals/arc_eager.pyx":560 + * if gold.heads[si] == b0: + * cost -= 1 + * if not is_sent_start(gold, state.B(1)) and\ # <<<<<<<<<<<<<< + * not is_sent_start_unknown(gold, state.B(1)): + * cost += 1 +*/ + if (__pyx_t_4) { + + /* "spacy/pipeline/_parser_internals/arc_eager.pyx":562 + * if not is_sent_start(gold, state.B(1)) and\ + * not is_sent_start_unknown(gold, state.B(1)): + * cost += 1 # <<<<<<<<<<<<<< + * return cost + * +*/ + __pyx_v_cost = (__pyx_v_cost + 1); + + /* "spacy/pipeline/_parser_internals/arc_eager.pyx":560 + * if gold.heads[si] == b0: + * cost -= 1 + * if not is_sent_start(gold, state.B(1)) and\ # <<<<<<<<<<<<<< + * not is_sent_start_unknown(gold, state.B(1)): + * cost += 1 +*/ + } + + /* "spacy/pipeline/_parser_internals/arc_eager.pyx":563 + * not is_sent_start_unknown(gold, state.B(1)): + * cost += 1 + * return cost # <<<<<<<<<<<<<< + * + * +*/ + __pyx_r = __pyx_v_cost; + goto __pyx_L0; + + /* "spacy/pipeline/_parser_internals/arc_eager.pyx":544 + * st.set_sent_start(st.B(1), 1) + * + * @staticmethod # <<<<<<<<<<<<<< + * cdef weight_t cost(const StateC* state, const void* _gold, attr_t label) noexcept nogil: + * gold = _gold +*/ + + /* function exit code */ + __pyx_L0:; + return __pyx_r; +} + +/* "(tree fragment)":1 + * def __reduce_cython__(self): # <<<<<<<<<<<<<< + * cdef tuple state + * cdef object _dict +*/ + +/* Python wrapper */ +static PyObject *__pyx_pw_5spacy_8pipeline_17_parser_internals_9arc_eager_5Break_1__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_5spacy_8pipeline_17_parser_internals_9arc_eager_5Break___reduce_cython__, "Break.__reduce_cython__(self)"); +static PyMethodDef __pyx_mdef_5spacy_8pipeline_17_parser_internals_9arc_eager_5Break_1__reduce_cython__ = {"__reduce_cython__", (PyCFunction)(void(*)(void))(__Pyx_PyCFunction_FastCallWithKeywords)__pyx_pw_5spacy_8pipeline_17_parser_internals_9arc_eager_5Break_1__reduce_cython__, __Pyx_METH_FASTCALL|METH_KEYWORDS, __pyx_doc_5spacy_8pipeline_17_parser_internals_9arc_eager_5Break___reduce_cython__}; +static PyObject *__pyx_pw_5spacy_8pipeline_17_parser_internals_9arc_eager_5Break_1__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_5spacy_8pipeline_17_parser_internals_9arc_eager_5Break___reduce_cython__(((struct __pyx_obj_5spacy_8pipeline_17_parser_internals_9arc_eager_Break *)__pyx_v_self)); + + /* function exit code */ + __Pyx_RefNannyFinishContext(); + return __pyx_r; +} + +static PyObject *__pyx_pf_5spacy_8pipeline_17_parser_internals_9arc_eager_5Break___reduce_cython__(struct __pyx_obj_5spacy_8pipeline_17_parser_internals_9arc_eager_Break *__pyx_v_self) { + PyObject *__pyx_v_state = 0; + PyObject *__pyx_v__dict = 0; + int __pyx_v_use_setstate; + PyObject *__pyx_r = NULL; + __Pyx_RefNannyDeclarations + PyObject *__pyx_t_1 = NULL; + int __pyx_t_2; + int __pyx_t_3; + PyObject *__pyx_t_4 = NULL; + PyObject *__pyx_t_5 = NULL; + int __pyx_lineno = 0; + const char *__pyx_filename = NULL; + int __pyx_clineno = 0; + __Pyx_RefNannySetupContext("__reduce_cython__", 0); + + /* "(tree fragment)":5 + * cdef object _dict + * cdef bint use_setstate + * state = () # <<<<<<<<<<<<<< + * _dict = getattr(self, '__dict__', None) + * if _dict is not None and _dict: +*/ + __Pyx_INCREF(__pyx_mstate_global->__pyx_empty_tuple); + __pyx_v_state = __pyx_mstate_global->__pyx_empty_tuple; + + /* "(tree fragment)":6 + * cdef bint use_setstate + * state = () + * _dict = getattr(self, '__dict__', None) # <<<<<<<<<<<<<< + * if _dict is not None and _dict: + * state += (_dict,) +*/ + __pyx_t_1 = __Pyx_GetAttr3(((PyObject *)__pyx_v_self), __pyx_mstate_global->__pyx_n_u_dict, Py_None); if (unlikely(!__pyx_t_1)) __PYX_ERR(1, 6, __pyx_L1_error) + __Pyx_GOTREF(__pyx_t_1); + __pyx_v__dict = __pyx_t_1; + __pyx_t_1 = 0; + + /* "(tree fragment)":7 + * state = () + * _dict = getattr(self, '__dict__', None) + * if _dict is not None and _dict: # <<<<<<<<<<<<<< + * state += (_dict,) + * use_setstate = True +*/ + __pyx_t_3 = (__pyx_v__dict != Py_None); + if (__pyx_t_3) { + } else { + __pyx_t_2 = __pyx_t_3; + goto __pyx_L4_bool_binop_done; + } + __pyx_t_3 = __Pyx_PyObject_IsTrue(__pyx_v__dict); if (unlikely((__pyx_t_3 < 0))) __PYX_ERR(1, 7, __pyx_L1_error) + __pyx_t_2 = __pyx_t_3; + __pyx_L4_bool_binop_done:; + if (__pyx_t_2) { + + /* "(tree fragment)":8 + * _dict = getattr(self, '__dict__', None) + * if _dict is not None and _dict: + * state += (_dict,) # <<<<<<<<<<<<<< + * use_setstate = True + * else: +*/ + __pyx_t_1 = PyTuple_New(1); if (unlikely(!__pyx_t_1)) __PYX_ERR(1, 8, __pyx_L1_error) + __Pyx_GOTREF(__pyx_t_1); + __Pyx_INCREF(__pyx_v__dict); + __Pyx_GIVEREF(__pyx_v__dict); + if (__Pyx_PyTuple_SET_ITEM(__pyx_t_1, 0, __pyx_v__dict) != (0)) __PYX_ERR(1, 8, __pyx_L1_error); + __pyx_t_4 = PyNumber_InPlaceAdd(__pyx_v_state, __pyx_t_1); if (unlikely(!__pyx_t_4)) __PYX_ERR(1, 8, __pyx_L1_error) + __Pyx_GOTREF(__pyx_t_4); + __Pyx_DECREF(__pyx_t_1); __pyx_t_1 = 0; + __Pyx_DECREF_SET(__pyx_v_state, ((PyObject*)__pyx_t_4)); + __pyx_t_4 = 0; + + /* "(tree fragment)":9 + * if _dict is not None and _dict: + * state += (_dict,) + * use_setstate = True # <<<<<<<<<<<<<< + * else: + * use_setstate = ('False',) +*/ + __pyx_v_use_setstate = 1; + + /* "(tree fragment)":7 + * state = () + * _dict = getattr(self, '__dict__', None) + * if _dict is not None and _dict: # <<<<<<<<<<<<<< + * state += (_dict,) + * use_setstate = True +*/ + goto __pyx_L3; + } + + /* "(tree fragment)":11 + * use_setstate = True + * else: + * use_setstate = ('False',) # <<<<<<<<<<<<<< + * if use_setstate: + * return __pyx_unpickle_Break, (type(self), 0xe3b0c44, None), state +*/ + /*else*/ { + __pyx_t_2 = __Pyx_PyObject_IsTrue(__pyx_mstate_global->__pyx_tuple[2]); if (unlikely((__pyx_t_2 == (int)-1) && PyErr_Occurred())) __PYX_ERR(1, 11, __pyx_L1_error) + __pyx_v_use_setstate = __pyx_t_2; + } + __pyx_L3:; + + /* "(tree fragment)":12 + * else: + * use_setstate = ('False',) + * if use_setstate: # <<<<<<<<<<<<<< + * return __pyx_unpickle_Break, (type(self), 0xe3b0c44, None), state + * else: +*/ + if (__pyx_v_use_setstate) { + + /* "(tree fragment)":13 + * use_setstate = ('False',) + * if use_setstate: + * return __pyx_unpickle_Break, (type(self), 0xe3b0c44, None), state # <<<<<<<<<<<<<< + * else: + * return __pyx_unpickle_Break, (type(self), 0xe3b0c44, state) +*/ + __Pyx_XDECREF(__pyx_r); + __Pyx_GetModuleGlobalName(__pyx_t_4, __pyx_mstate_global->__pyx_n_u_pyx_unpickle_Break); if (unlikely(!__pyx_t_4)) __PYX_ERR(1, 13, __pyx_L1_error) + __Pyx_GOTREF(__pyx_t_4); + __pyx_t_1 = PyTuple_New(3); if (unlikely(!__pyx_t_1)) __PYX_ERR(1, 13, __pyx_L1_error) + __Pyx_GOTREF(__pyx_t_1); + __Pyx_INCREF(((PyObject *)Py_TYPE(((PyObject *)__pyx_v_self)))); + __Pyx_GIVEREF(((PyObject *)Py_TYPE(((PyObject *)__pyx_v_self)))); + if (__Pyx_PyTuple_SET_ITEM(__pyx_t_1, 0, ((PyObject *)Py_TYPE(((PyObject *)__pyx_v_self)))) != (0)) __PYX_ERR(1, 13, __pyx_L1_error); + __Pyx_INCREF(__pyx_mstate_global->__pyx_int_238750788); + __Pyx_GIVEREF(__pyx_mstate_global->__pyx_int_238750788); + if (__Pyx_PyTuple_SET_ITEM(__pyx_t_1, 1, __pyx_mstate_global->__pyx_int_238750788) != (0)) __PYX_ERR(1, 13, __pyx_L1_error); + __Pyx_INCREF(Py_None); + __Pyx_GIVEREF(Py_None); + if (__Pyx_PyTuple_SET_ITEM(__pyx_t_1, 2, Py_None) != (0)) __PYX_ERR(1, 13, __pyx_L1_error); + __pyx_t_5 = PyTuple_New(3); if (unlikely(!__pyx_t_5)) __PYX_ERR(1, 13, __pyx_L1_error) + __Pyx_GOTREF(__pyx_t_5); + __Pyx_GIVEREF(__pyx_t_4); + if (__Pyx_PyTuple_SET_ITEM(__pyx_t_5, 0, __pyx_t_4) != (0)) __PYX_ERR(1, 13, __pyx_L1_error); + __Pyx_GIVEREF(__pyx_t_1); + if (__Pyx_PyTuple_SET_ITEM(__pyx_t_5, 1, __pyx_t_1) != (0)) __PYX_ERR(1, 13, __pyx_L1_error); + __Pyx_INCREF(__pyx_v_state); + __Pyx_GIVEREF(__pyx_v_state); + if (__Pyx_PyTuple_SET_ITEM(__pyx_t_5, 2, __pyx_v_state) != (0)) __PYX_ERR(1, 13, __pyx_L1_error); + __pyx_t_4 = 0; + __pyx_t_1 = 0; + __pyx_r = __pyx_t_5; + __pyx_t_5 = 0; + goto __pyx_L0; + + /* "(tree fragment)":12 + * else: + * use_setstate = ('False',) + * if use_setstate: # <<<<<<<<<<<<<< + * return __pyx_unpickle_Break, (type(self), 0xe3b0c44, None), state + * else: +*/ + } + + /* "(tree fragment)":15 + * return __pyx_unpickle_Break, (type(self), 0xe3b0c44, None), state + * else: + * return __pyx_unpickle_Break, (type(self), 0xe3b0c44, state) # <<<<<<<<<<<<<< + * def __setstate_cython__(self, __pyx_state): + * __pyx_unpickle_Break__set_state(self, __pyx_state) +*/ + /*else*/ { + __Pyx_XDECREF(__pyx_r); + __Pyx_GetModuleGlobalName(__pyx_t_5, __pyx_mstate_global->__pyx_n_u_pyx_unpickle_Break); if (unlikely(!__pyx_t_5)) __PYX_ERR(1, 15, __pyx_L1_error) + __Pyx_GOTREF(__pyx_t_5); + __pyx_t_1 = PyTuple_New(3); if (unlikely(!__pyx_t_1)) __PYX_ERR(1, 15, __pyx_L1_error) + __Pyx_GOTREF(__pyx_t_1); + __Pyx_INCREF(((PyObject *)Py_TYPE(((PyObject *)__pyx_v_self)))); + __Pyx_GIVEREF(((PyObject *)Py_TYPE(((PyObject *)__pyx_v_self)))); + if (__Pyx_PyTuple_SET_ITEM(__pyx_t_1, 0, ((PyObject *)Py_TYPE(((PyObject *)__pyx_v_self)))) != (0)) __PYX_ERR(1, 15, __pyx_L1_error); + __Pyx_INCREF(__pyx_mstate_global->__pyx_int_238750788); + __Pyx_GIVEREF(__pyx_mstate_global->__pyx_int_238750788); + if (__Pyx_PyTuple_SET_ITEM(__pyx_t_1, 1, __pyx_mstate_global->__pyx_int_238750788) != (0)) __PYX_ERR(1, 15, __pyx_L1_error); + __Pyx_INCREF(__pyx_v_state); + __Pyx_GIVEREF(__pyx_v_state); + if (__Pyx_PyTuple_SET_ITEM(__pyx_t_1, 2, __pyx_v_state) != (0)) __PYX_ERR(1, 15, __pyx_L1_error); + __pyx_t_4 = PyTuple_New(2); if (unlikely(!__pyx_t_4)) __PYX_ERR(1, 15, __pyx_L1_error) + __Pyx_GOTREF(__pyx_t_4); + __Pyx_GIVEREF(__pyx_t_5); + if (__Pyx_PyTuple_SET_ITEM(__pyx_t_4, 0, __pyx_t_5) != (0)) __PYX_ERR(1, 15, __pyx_L1_error); + __Pyx_GIVEREF(__pyx_t_1); + if (__Pyx_PyTuple_SET_ITEM(__pyx_t_4, 1, __pyx_t_1) != (0)) __PYX_ERR(1, 15, __pyx_L1_error); + __pyx_t_5 = 0; + __pyx_t_1 = 0; + __pyx_r = __pyx_t_4; + __pyx_t_4 = 0; + goto __pyx_L0; + } + + /* "(tree fragment)":1 + * def __reduce_cython__(self): # <<<<<<<<<<<<<< + * cdef tuple state + * cdef object _dict +*/ + + /* function exit code */ + __pyx_L1_error:; + __Pyx_XDECREF(__pyx_t_1); + __Pyx_XDECREF(__pyx_t_4); + __Pyx_XDECREF(__pyx_t_5); + __Pyx_AddTraceback("spacy.pipeline._parser_internals.arc_eager.Break.__reduce_cython__", __pyx_clineno, __pyx_lineno, __pyx_filename); + __pyx_r = NULL; + __pyx_L0:; + __Pyx_XDECREF(__pyx_v_state); + __Pyx_XDECREF(__pyx_v__dict); + __Pyx_XGIVEREF(__pyx_r); + __Pyx_RefNannyFinishContext(); + return __pyx_r; +} + +/* "(tree fragment)":16 + * else: + * return __pyx_unpickle_Break, (type(self), 0xe3b0c44, state) + * def __setstate_cython__(self, __pyx_state): # <<<<<<<<<<<<<< + * __pyx_unpickle_Break__set_state(self, __pyx_state) +*/ + +/* Python wrapper */ +static PyObject *__pyx_pw_5spacy_8pipeline_17_parser_internals_9arc_eager_5Break_3__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_5spacy_8pipeline_17_parser_internals_9arc_eager_5Break_2__setstate_cython__, "Break.__setstate_cython__(self, __pyx_state)"); +static PyMethodDef __pyx_mdef_5spacy_8pipeline_17_parser_internals_9arc_eager_5Break_3__setstate_cython__ = {"__setstate_cython__", (PyCFunction)(void(*)(void))(__Pyx_PyCFunction_FastCallWithKeywords)__pyx_pw_5spacy_8pipeline_17_parser_internals_9arc_eager_5Break_3__setstate_cython__, __Pyx_METH_FASTCALL|METH_KEYWORDS, __pyx_doc_5spacy_8pipeline_17_parser_internals_9arc_eager_5Break_2__setstate_cython__}; +static PyObject *__pyx_pw_5spacy_8pipeline_17_parser_internals_9arc_eager_5Break_3__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 +) { + 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, 16, __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, 16, __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, 16, __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, 16, __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, 16, __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, 16, __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("spacy.pipeline._parser_internals.arc_eager.Break.__setstate_cython__", __pyx_clineno, __pyx_lineno, __pyx_filename); + __Pyx_RefNannyFinishContext(); + return NULL; + __pyx_L4_argument_unpacking_done:; + __pyx_r = __pyx_pf_5spacy_8pipeline_17_parser_internals_9arc_eager_5Break_2__setstate_cython__(((struct __pyx_obj_5spacy_8pipeline_17_parser_internals_9arc_eager_Break *)__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_5spacy_8pipeline_17_parser_internals_9arc_eager_5Break_2__setstate_cython__(struct __pyx_obj_5spacy_8pipeline_17_parser_internals_9arc_eager_Break *__pyx_v_self, PyObject *__pyx_v___pyx_state) { + PyObject *__pyx_r = NULL; + __Pyx_RefNannyDeclarations + PyObject *__pyx_t_1 = NULL; + int __pyx_lineno = 0; + const char *__pyx_filename = NULL; + int __pyx_clineno = 0; + __Pyx_RefNannySetupContext("__setstate_cython__", 0); + + /* "(tree fragment)":17 + * return __pyx_unpickle_Break, (type(self), 0xe3b0c44, state) + * def __setstate_cython__(self, __pyx_state): + * __pyx_unpickle_Break__set_state(self, __pyx_state) # <<<<<<<<<<<<<< +*/ + __pyx_t_1 = __pyx_f_5spacy_8pipeline_17_parser_internals_9arc_eager___pyx_unpickle_Break__set_state(__pyx_v_self, __pyx_v___pyx_state); if (unlikely(!__pyx_t_1)) __PYX_ERR(1, 17, __pyx_L1_error) + __Pyx_GOTREF(__pyx_t_1); + __Pyx_DECREF(__pyx_t_1); __pyx_t_1 = 0; + + /* "(tree fragment)":16 + * else: + * return __pyx_unpickle_Break, (type(self), 0xe3b0c44, state) + * def __setstate_cython__(self, __pyx_state): # <<<<<<<<<<<<<< + * __pyx_unpickle_Break__set_state(self, __pyx_state) +*/ + + /* function exit code */ + __pyx_r = Py_None; __Pyx_INCREF(Py_None); + goto __pyx_L0; + __pyx_L1_error:; + __Pyx_XDECREF(__pyx_t_1); + __Pyx_AddTraceback("spacy.pipeline._parser_internals.arc_eager.Break.__setstate_cython__", __pyx_clineno, __pyx_lineno, __pyx_filename); + __pyx_r = NULL; + __pyx_L0:; + __Pyx_XGIVEREF(__pyx_r); + __Pyx_RefNannyFinishContext(); + return __pyx_r; +} + +/* "spacy/pipeline/_parser_internals/arc_eager.pyx":566 + * + * + * cdef void* _init_state(Pool mem, int length, void* tokens) except NULL: # <<<<<<<<<<<<<< + * st = new StateC(tokens, length) + * return st +*/ + +static void *__pyx_f_5spacy_8pipeline_17_parser_internals_9arc_eager__init_state(CYTHON_UNUSED struct __pyx_obj_5cymem_5cymem_Pool *__pyx_v_mem, int __pyx_v_length, void *__pyx_v_tokens) { + __pyx_t_5spacy_8pipeline_17_parser_internals_6_state_StateC *__pyx_v_st; + void *__pyx_r; + + /* "spacy/pipeline/_parser_internals/arc_eager.pyx":567 + * + * cdef void* _init_state(Pool mem, int length, void* tokens) except NULL: + * st = new StateC(tokens, length) # <<<<<<<<<<<<<< + * return st + * +*/ + __pyx_v_st = new __pyx_t_5spacy_8pipeline_17_parser_internals_6_state_StateC(((struct __pyx_t_5spacy_7structs_TokenC const *)__pyx_v_tokens), __pyx_v_length); + + /* "spacy/pipeline/_parser_internals/arc_eager.pyx":568 + * cdef void* _init_state(Pool mem, int length, void* tokens) except NULL: + * st = new StateC(tokens, length) + * return st # <<<<<<<<<<<<<< + * + * +*/ + __pyx_r = ((void *)__pyx_v_st); + goto __pyx_L0; + + /* "spacy/pipeline/_parser_internals/arc_eager.pyx":566 + * + * + * cdef void* _init_state(Pool mem, int length, void* tokens) except NULL: # <<<<<<<<<<<<<< + * st = new StateC(tokens, length) + * return st +*/ + + /* function exit code */ + __pyx_L0:; + return __pyx_r; +} + +/* "spacy/pipeline/_parser_internals/arc_eager.pyx":571 + * + * + * cdef int _del_state(Pool mem, void* state, void* x) except -1: # <<<<<<<<<<<<<< + * cdef StateC* st = state + * del st +*/ + +static int __pyx_f_5spacy_8pipeline_17_parser_internals_9arc_eager__del_state(CYTHON_UNUSED struct __pyx_obj_5cymem_5cymem_Pool *__pyx_v_mem, void *__pyx_v_state, CYTHON_UNUSED void *__pyx_v_x) { + __pyx_t_5spacy_8pipeline_17_parser_internals_6_state_StateC *__pyx_v_st; + int __pyx_r; + + /* "spacy/pipeline/_parser_internals/arc_eager.pyx":572 + * + * cdef int _del_state(Pool mem, void* state, void* x) except -1: + * cdef StateC* st = state # <<<<<<<<<<<<<< + * del st + * +*/ + __pyx_v_st = ((__pyx_t_5spacy_8pipeline_17_parser_internals_6_state_StateC *)__pyx_v_state); + + /* "spacy/pipeline/_parser_internals/arc_eager.pyx":573 + * cdef int _del_state(Pool mem, void* state, void* x) except -1: + * cdef StateC* st = state + * del st # <<<<<<<<<<<<<< + * + * +*/ + delete __pyx_v_st; + + /* "spacy/pipeline/_parser_internals/arc_eager.pyx":571 + * + * + * cdef int _del_state(Pool mem, void* state, void* x) except -1: # <<<<<<<<<<<<<< + * cdef StateC* st = state + * del st +*/ + + /* function exit code */ + __pyx_r = 0; + return __pyx_r; +} + +/* "spacy/pipeline/_parser_internals/arc_eager.pyx":577 + * + * cdef class ArcEager(TransitionSystem): + * def __init__(self, *args, **kwargs): # <<<<<<<<<<<<<< + * TransitionSystem.__init__(self, *args, **kwargs) + * self.init_beam_state = _init_state +*/ + +/* Python wrapper */ +static int __pyx_pw_5spacy_8pipeline_17_parser_internals_9arc_eager_8ArcEager_1__init__(PyObject *__pyx_v_self, PyObject *__pyx_args, PyObject *__pyx_kwds); /*proto*/ +static int __pyx_pw_5spacy_8pipeline_17_parser_internals_9arc_eager_8ArcEager_1__init__(PyObject *__pyx_v_self, PyObject *__pyx_args, PyObject *__pyx_kwds) { + PyObject *__pyx_v_args = 0; + PyObject *__pyx_v_kwargs = 0; + CYTHON_UNUSED Py_ssize_t __pyx_nargs; + CYTHON_UNUSED PyObject *const *__pyx_kwvalues; + 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); + const Py_ssize_t __pyx_kwds_len = (__pyx_kwds) ? __Pyx_NumKwargs_VARARGS(__pyx_kwds) : 0; + if (unlikely(__pyx_kwds_len < 0)) return -1; + if (__pyx_kwds_len > 0) { + if (unlikely(__Pyx_CheckKeywordStrings("__init__", __pyx_kwds) == -1)) return -1; + __pyx_v_kwargs = __Pyx_KwargsAsDict_VARARGS(__pyx_kwds, __pyx_kwvalues); + if (unlikely(!__pyx_v_kwargs)) return -1; + __Pyx_GOTREF(__pyx_v_kwargs); + } else { + __pyx_v_kwargs = PyDict_New(); + if (unlikely(!__pyx_v_kwargs)) return -1; + __Pyx_GOTREF(__pyx_v_kwargs); + } + __Pyx_INCREF(__pyx_args); + __pyx_v_args = __pyx_args; + __pyx_r = __pyx_pf_5spacy_8pipeline_17_parser_internals_9arc_eager_8ArcEager___init__(((struct __pyx_obj_5spacy_8pipeline_17_parser_internals_9arc_eager_ArcEager *)__pyx_v_self), __pyx_v_args, __pyx_v_kwargs); + + /* function exit code */ + __Pyx_DECREF(__pyx_v_args); + __Pyx_DECREF(__pyx_v_kwargs); + __Pyx_RefNannyFinishContext(); + return __pyx_r; +} + +static int __pyx_pf_5spacy_8pipeline_17_parser_internals_9arc_eager_8ArcEager___init__(struct __pyx_obj_5spacy_8pipeline_17_parser_internals_9arc_eager_ArcEager *__pyx_v_self, PyObject *__pyx_v_args, PyObject *__pyx_v_kwargs) { + 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; + int __pyx_lineno = 0; + const char *__pyx_filename = NULL; + int __pyx_clineno = 0; + __Pyx_RefNannySetupContext("__init__", 0); + + /* "spacy/pipeline/_parser_internals/arc_eager.pyx":578 + * cdef class ArcEager(TransitionSystem): + * def __init__(self, *args, **kwargs): + * TransitionSystem.__init__(self, *args, **kwargs) # <<<<<<<<<<<<<< + * self.init_beam_state = _init_state + * self.del_beam_state = _del_state +*/ + __pyx_t_1 = __Pyx_PyObject_GetAttrStr(((PyObject *)__pyx_mstate_global->__pyx_ptype_5spacy_8pipeline_17_parser_internals_17transition_system_TransitionSystem), __pyx_mstate_global->__pyx_n_u_init); if (unlikely(!__pyx_t_1)) __PYX_ERR(0, 578, __pyx_L1_error) + __Pyx_GOTREF(__pyx_t_1); + __pyx_t_2 = PyTuple_New(1); if (unlikely(!__pyx_t_2)) __PYX_ERR(0, 578, __pyx_L1_error) + __Pyx_GOTREF(__pyx_t_2); + __Pyx_INCREF((PyObject *)__pyx_v_self); + __Pyx_GIVEREF((PyObject *)__pyx_v_self); + if (__Pyx_PyTuple_SET_ITEM(__pyx_t_2, 0, ((PyObject *)__pyx_v_self)) != (0)) __PYX_ERR(0, 578, __pyx_L1_error); + __pyx_t_3 = PyNumber_Add(__pyx_t_2, __pyx_v_args); if (unlikely(!__pyx_t_3)) __PYX_ERR(0, 578, __pyx_L1_error) + __Pyx_GOTREF(__pyx_t_3); + __Pyx_DECREF(__pyx_t_2); __pyx_t_2 = 0; + __pyx_t_2 = PyDict_Copy(__pyx_v_kwargs); if (unlikely(!__pyx_t_2)) __PYX_ERR(0, 578, __pyx_L1_error) + __Pyx_GOTREF(__pyx_t_2); + __pyx_t_4 = __Pyx_PyObject_Call(__pyx_t_1, __pyx_t_3, __pyx_t_2); if (unlikely(!__pyx_t_4)) __PYX_ERR(0, 578, __pyx_L1_error) + __Pyx_GOTREF(__pyx_t_4); + __Pyx_DECREF(__pyx_t_1); __pyx_t_1 = 0; + __Pyx_DECREF(__pyx_t_3); __pyx_t_3 = 0; + __Pyx_DECREF(__pyx_t_2); __pyx_t_2 = 0; + __Pyx_DECREF(__pyx_t_4); __pyx_t_4 = 0; + + /* "spacy/pipeline/_parser_internals/arc_eager.pyx":579 + * def __init__(self, *args, **kwargs): + * TransitionSystem.__init__(self, *args, **kwargs) + * self.init_beam_state = _init_state # <<<<<<<<<<<<<< + * self.del_beam_state = _del_state + * +*/ + __pyx_v_self->__pyx_base.init_beam_state = __pyx_f_5spacy_8pipeline_17_parser_internals_9arc_eager__init_state; + + /* "spacy/pipeline/_parser_internals/arc_eager.pyx":580 + * TransitionSystem.__init__(self, *args, **kwargs) + * self.init_beam_state = _init_state + * self.del_beam_state = _del_state # <<<<<<<<<<<<<< + * + * @classmethod +*/ + __pyx_v_self->__pyx_base.del_beam_state = __pyx_f_5spacy_8pipeline_17_parser_internals_9arc_eager__del_state; + + /* "spacy/pipeline/_parser_internals/arc_eager.pyx":577 + * + * cdef class ArcEager(TransitionSystem): + * def __init__(self, *args, **kwargs): # <<<<<<<<<<<<<< + * TransitionSystem.__init__(self, *args, **kwargs) + * self.init_beam_state = _init_state +*/ + + /* function exit code */ + __pyx_r = 0; + goto __pyx_L0; + __pyx_L1_error:; + __Pyx_XDECREF(__pyx_t_1); + __Pyx_XDECREF(__pyx_t_2); + __Pyx_XDECREF(__pyx_t_3); + __Pyx_XDECREF(__pyx_t_4); + __Pyx_AddTraceback("spacy.pipeline._parser_internals.arc_eager.ArcEager.__init__", __pyx_clineno, __pyx_lineno, __pyx_filename); + __pyx_r = -1; + __pyx_L0:; + __Pyx_RefNannyFinishContext(); + return __pyx_r; +} + +/* "spacy/pipeline/_parser_internals/arc_eager.pyx":582 + * self.del_beam_state = _del_state + * + * @classmethod # <<<<<<<<<<<<<< + * def get_actions(cls, **kwargs): + * min_freq = kwargs.get('min_freq', None) +*/ + +/* Python wrapper */ +static PyObject *__pyx_pw_5spacy_8pipeline_17_parser_internals_9arc_eager_8ArcEager_3get_actions(PyObject *__pyx_v_cls, +#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_5spacy_8pipeline_17_parser_internals_9arc_eager_8ArcEager_2get_actions, "ArcEager.get_actions(cls, **kwargs)"); +static PyMethodDef __pyx_mdef_5spacy_8pipeline_17_parser_internals_9arc_eager_8ArcEager_3get_actions = {"get_actions", (PyCFunction)(void(*)(void))(__Pyx_PyCFunction_FastCallWithKeywords)__pyx_pw_5spacy_8pipeline_17_parser_internals_9arc_eager_8ArcEager_3get_actions, __Pyx_METH_FASTCALL|METH_KEYWORDS, __pyx_doc_5spacy_8pipeline_17_parser_internals_9arc_eager_8ArcEager_2get_actions}; +static PyObject *__pyx_pw_5spacy_8pipeline_17_parser_internals_9arc_eager_8ArcEager_3get_actions(PyObject *__pyx_v_cls, +#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_kwargs = 0; + #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("get_actions (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("get_actions", 1, 0, 0, __pyx_nargs); return NULL; } + const Py_ssize_t __pyx_kwds_len = (__pyx_kwds) ? __Pyx_NumKwargs_FASTCALL(__pyx_kwds) : 0; + if (unlikely(__pyx_kwds_len < 0)) return NULL; + if (__pyx_kwds_len > 0) { + if (unlikely(__Pyx_CheckKeywordStrings("get_actions", __pyx_kwds) == -1)) return NULL; + __pyx_v_kwargs = __Pyx_KwargsAsDict_FASTCALL(__pyx_kwds, __pyx_kwvalues); + if (unlikely(!__pyx_v_kwargs)) return NULL; + __Pyx_GOTREF(__pyx_v_kwargs); + } else { + __pyx_v_kwargs = PyDict_New(); + if (unlikely(!__pyx_v_kwargs)) return NULL; + __Pyx_GOTREF(__pyx_v_kwargs); + } + __pyx_r = __pyx_pf_5spacy_8pipeline_17_parser_internals_9arc_eager_8ArcEager_2get_actions(((PyTypeObject*)__pyx_v_cls), __pyx_v_kwargs); + + /* function exit code */ + __Pyx_DECREF(__pyx_v_kwargs); + __Pyx_RefNannyFinishContext(); + return __pyx_r; +} + +/* "spacy/pipeline/_parser_internals/arc_eager.pyx":585 + * def get_actions(cls, **kwargs): + * min_freq = kwargs.get('min_freq', None) + * actions = defaultdict(lambda: Counter()) # <<<<<<<<<<<<<< + * actions[SHIFT][''] = 1 + * actions[REDUCE][''] = 1 +*/ + +/* Python wrapper */ +static PyObject *__pyx_pw_5spacy_8pipeline_17_parser_internals_9arc_eager_8ArcEager_11get_actions_lambda1(PyObject *__pyx_self, CYTHON_UNUSED PyObject *unused); /*proto*/ +static PyMethodDef __pyx_mdef_5spacy_8pipeline_17_parser_internals_9arc_eager_8ArcEager_11get_actions_lambda1 = {"lambda1", (PyCFunction)__pyx_pw_5spacy_8pipeline_17_parser_internals_9arc_eager_8ArcEager_11get_actions_lambda1, METH_NOARGS, 0}; +static PyObject *__pyx_pw_5spacy_8pipeline_17_parser_internals_9arc_eager_8ArcEager_11get_actions_lambda1(PyObject *__pyx_self, CYTHON_UNUSED PyObject *unused) { + CYTHON_UNUSED PyObject *const *__pyx_kwvalues; + PyObject *__pyx_r = 0; + __Pyx_RefNannyDeclarations + __Pyx_RefNannySetupContext("lambda1 (wrapper)", 0); + __pyx_kwvalues = __Pyx_KwValues_VARARGS(__pyx_args, __pyx_nargs); + __pyx_r = __pyx_lambda_funcdef_lambda1(__pyx_self); + + /* function exit code */ + __Pyx_RefNannyFinishContext(); + return __pyx_r; +} + +static PyObject *__pyx_lambda_funcdef_lambda1(CYTHON_UNUSED PyObject *__pyx_self) { + PyObject *__pyx_r = NULL; + __Pyx_RefNannyDeclarations + PyObject *__pyx_t_1 = NULL; + PyObject *__pyx_t_2 = NULL; + PyObject *__pyx_t_3 = NULL; + size_t __pyx_t_4; + int __pyx_lineno = 0; + const char *__pyx_filename = NULL; + int __pyx_clineno = 0; + __Pyx_RefNannySetupContext("lambda1", 0); + __Pyx_XDECREF(__pyx_r); + __pyx_t_2 = NULL; + __Pyx_GetModuleGlobalName(__pyx_t_3, __pyx_mstate_global->__pyx_n_u_Counter); if (unlikely(!__pyx_t_3)) __PYX_ERR(0, 585, __pyx_L1_error) + __Pyx_GOTREF(__pyx_t_3); + __pyx_t_4 = 1; + #if CYTHON_UNPACK_METHODS + if (unlikely(PyMethod_Check(__pyx_t_3))) { + __pyx_t_2 = PyMethod_GET_SELF(__pyx_t_3); + assert(__pyx_t_2); + PyObject* __pyx__function = PyMethod_GET_FUNCTION(__pyx_t_3); + __Pyx_INCREF(__pyx_t_2); + __Pyx_INCREF(__pyx__function); + __Pyx_DECREF_SET(__pyx_t_3, __pyx__function); + __pyx_t_4 = 0; + } + #endif + { + PyObject *__pyx_callargs[2] = {__pyx_t_2, NULL}; + __pyx_t_1 = __Pyx_PyObject_FastCall((PyObject*)__pyx_t_3, __pyx_callargs+__pyx_t_4, (1-__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, 585, __pyx_L1_error) + __Pyx_GOTREF(__pyx_t_1); + } + __pyx_r = __pyx_t_1; + __pyx_t_1 = 0; + goto __pyx_L0; + + /* function exit code */ + __pyx_L1_error:; + __Pyx_XDECREF(__pyx_t_1); + __Pyx_XDECREF(__pyx_t_2); + __Pyx_XDECREF(__pyx_t_3); + __Pyx_AddTraceback("spacy.pipeline._parser_internals.arc_eager.ArcEager.get_actions.lambda1", __pyx_clineno, __pyx_lineno, __pyx_filename); + __pyx_r = NULL; + __pyx_L0:; + __Pyx_XGIVEREF(__pyx_r); + __Pyx_RefNannyFinishContext(); + return __pyx_r; +} + +/* "spacy/pipeline/_parser_internals/arc_eager.pyx":582 + * self.del_beam_state = _del_state + * + * @classmethod # <<<<<<<<<<<<<< + * def get_actions(cls, **kwargs): + * min_freq = kwargs.get('min_freq', None) +*/ + +static PyObject *__pyx_pf_5spacy_8pipeline_17_parser_internals_9arc_eager_8ArcEager_2get_actions(CYTHON_UNUSED PyTypeObject *__pyx_v_cls, PyObject *__pyx_v_kwargs) { + PyObject *__pyx_v_min_freq = NULL; + PyObject *__pyx_v_actions = NULL; + PyObject *__pyx_v_label = NULL; + PyObject *__pyx_v_example = NULL; + struct __pyx_obj_5spacy_8training_7example_Example *__pyx_v_example_gold_preproc = NULL; + PyObject *__pyx_v_heads = NULL; + PyObject *__pyx_v_labels = NULL; + PyObject *__pyx_v_child = NULL; + PyObject *__pyx_v_head = NULL; + CYTHON_UNUSED PyObject *__pyx_v_action = NULL; + PyObject *__pyx_v_label_freqs = NULL; + PyObject *__pyx_v_freq = NULL; + PyObject *__pyx_r = NULL; + __Pyx_RefNannyDeclarations + PyObject *__pyx_t_1 = NULL; + PyObject *__pyx_t_2 = NULL; + PyObject *__pyx_t_3 = NULL; + PyObject *__pyx_t_4 = NULL; + size_t __pyx_t_5; + Py_ssize_t __pyx_t_6; + PyObject *(*__pyx_t_7)(PyObject *); + PyObject *__pyx_t_8 = NULL; + PyObject *(*__pyx_t_9)(PyObject *); + Py_ssize_t __pyx_t_10; + PyObject *(*__pyx_t_11)(PyObject *); + PyObject *__pyx_t_12 = NULL; + PyObject *__pyx_t_13 = NULL; + int __pyx_t_14; + int __pyx_t_15; + PyObject *__pyx_t_16 = NULL; + int __pyx_lineno = 0; + const char *__pyx_filename = NULL; + int __pyx_clineno = 0; + __Pyx_RefNannySetupContext("get_actions", 0); + + /* "spacy/pipeline/_parser_internals/arc_eager.pyx":584 + * @classmethod + * def get_actions(cls, **kwargs): + * min_freq = kwargs.get('min_freq', None) # <<<<<<<<<<<<<< + * actions = defaultdict(lambda: Counter()) + * actions[SHIFT][''] = 1 +*/ + __pyx_t_1 = __Pyx_PyDict_GetItemDefault(__pyx_v_kwargs, __pyx_mstate_global->__pyx_n_u_min_freq, Py_None); if (unlikely(!__pyx_t_1)) __PYX_ERR(0, 584, __pyx_L1_error) + __Pyx_GOTREF(__pyx_t_1); + __pyx_v_min_freq = __pyx_t_1; + __pyx_t_1 = 0; + + /* "spacy/pipeline/_parser_internals/arc_eager.pyx":585 + * def get_actions(cls, **kwargs): + * min_freq = kwargs.get('min_freq', None) + * actions = defaultdict(lambda: Counter()) # <<<<<<<<<<<<<< + * actions[SHIFT][''] = 1 + * actions[REDUCE][''] = 1 +*/ + __pyx_t_2 = NULL; + __Pyx_GetModuleGlobalName(__pyx_t_3, __pyx_mstate_global->__pyx_n_u_defaultdict); if (unlikely(!__pyx_t_3)) __PYX_ERR(0, 585, __pyx_L1_error) + __Pyx_GOTREF(__pyx_t_3); + __pyx_t_4 = __Pyx_CyFunction_New(&__pyx_mdef_5spacy_8pipeline_17_parser_internals_9arc_eager_8ArcEager_11get_actions_lambda1, 0, __pyx_mstate_global->__pyx_n_u_get_actions_locals_lambda, NULL, __pyx_mstate_global->__pyx_n_u_spacy_pipeline__parser_internals, __pyx_mstate_global->__pyx_d, ((PyObject *)__pyx_mstate_global->__pyx_codeobj_tab[1])); if (unlikely(!__pyx_t_4)) __PYX_ERR(0, 585, __pyx_L1_error) + __Pyx_GOTREF(__pyx_t_4); + __pyx_t_5 = 1; + #if CYTHON_UNPACK_METHODS + if (unlikely(PyMethod_Check(__pyx_t_3))) { + __pyx_t_2 = PyMethod_GET_SELF(__pyx_t_3); + assert(__pyx_t_2); + PyObject* __pyx__function = PyMethod_GET_FUNCTION(__pyx_t_3); + __Pyx_INCREF(__pyx_t_2); + __Pyx_INCREF(__pyx__function); + __Pyx_DECREF_SET(__pyx_t_3, __pyx__function); + __pyx_t_5 = 0; + } + #endif + { + PyObject *__pyx_callargs[2] = {__pyx_t_2, __pyx_t_4}; + __pyx_t_1 = __Pyx_PyObject_FastCall((PyObject*)__pyx_t_3, __pyx_callargs+__pyx_t_5, (2-__pyx_t_5) | (__pyx_t_5*__Pyx_PY_VECTORCALL_ARGUMENTS_OFFSET)); + __Pyx_XDECREF(__pyx_t_2); __pyx_t_2 = 0; + __Pyx_DECREF(__pyx_t_4); __pyx_t_4 = 0; + __Pyx_DECREF(__pyx_t_3); __pyx_t_3 = 0; + if (unlikely(!__pyx_t_1)) __PYX_ERR(0, 585, __pyx_L1_error) + __Pyx_GOTREF(__pyx_t_1); + } + __pyx_v_actions = __pyx_t_1; + __pyx_t_1 = 0; + + /* "spacy/pipeline/_parser_internals/arc_eager.pyx":586 + * min_freq = kwargs.get('min_freq', None) + * actions = defaultdict(lambda: Counter()) + * actions[SHIFT][''] = 1 # <<<<<<<<<<<<<< + * actions[REDUCE][''] = 1 + * for label in kwargs.get('left_labels', []): +*/ + __pyx_t_1 = __Pyx_GetItemInt(__pyx_v_actions, __pyx_e_5spacy_8pipeline_17_parser_internals_9arc_eager_SHIFT, int, 1, __Pyx_PyLong_From___pyx_anon_enum, 0, 1, 1, 1, __Pyx_ReferenceSharing_OwnStrongReference); if (unlikely(!__pyx_t_1)) __PYX_ERR(0, 586, __pyx_L1_error) + __Pyx_GOTREF(__pyx_t_1); + if (unlikely((PyObject_SetItem(__pyx_t_1, __pyx_mstate_global->__pyx_kp_u__6, __pyx_mstate_global->__pyx_int_1) < 0))) __PYX_ERR(0, 586, __pyx_L1_error) + __Pyx_DECREF(__pyx_t_1); __pyx_t_1 = 0; + + /* "spacy/pipeline/_parser_internals/arc_eager.pyx":587 + * actions = defaultdict(lambda: Counter()) + * actions[SHIFT][''] = 1 + * actions[REDUCE][''] = 1 # <<<<<<<<<<<<<< + * for label in kwargs.get('left_labels', []): + * actions[LEFT][label] = 1 +*/ + __pyx_t_1 = __Pyx_GetItemInt(__pyx_v_actions, __pyx_e_5spacy_8pipeline_17_parser_internals_9arc_eager_REDUCE, int, 1, __Pyx_PyLong_From___pyx_anon_enum, 0, 1, 1, 1, __Pyx_ReferenceSharing_OwnStrongReference); if (unlikely(!__pyx_t_1)) __PYX_ERR(0, 587, __pyx_L1_error) + __Pyx_GOTREF(__pyx_t_1); + if (unlikely((PyObject_SetItem(__pyx_t_1, __pyx_mstate_global->__pyx_kp_u__6, __pyx_mstate_global->__pyx_int_1) < 0))) __PYX_ERR(0, 587, __pyx_L1_error) + __Pyx_DECREF(__pyx_t_1); __pyx_t_1 = 0; + + /* "spacy/pipeline/_parser_internals/arc_eager.pyx":588 + * actions[SHIFT][''] = 1 + * actions[REDUCE][''] = 1 + * for label in kwargs.get('left_labels', []): # <<<<<<<<<<<<<< + * actions[LEFT][label] = 1 + * actions[SHIFT][label] = 1 +*/ + __pyx_t_1 = PyList_New(0); if (unlikely(!__pyx_t_1)) __PYX_ERR(0, 588, __pyx_L1_error) + __Pyx_GOTREF(__pyx_t_1); + __pyx_t_3 = __Pyx_PyDict_GetItemDefault(__pyx_v_kwargs, __pyx_mstate_global->__pyx_n_u_left_labels, __pyx_t_1); if (unlikely(!__pyx_t_3)) __PYX_ERR(0, 588, __pyx_L1_error) + __Pyx_GOTREF(__pyx_t_3); + __Pyx_DECREF(__pyx_t_1); __pyx_t_1 = 0; + if (likely(PyList_CheckExact(__pyx_t_3)) || PyTuple_CheckExact(__pyx_t_3)) { + __pyx_t_1 = __pyx_t_3; __Pyx_INCREF(__pyx_t_1); + __pyx_t_6 = 0; + __pyx_t_7 = NULL; + } else { + __pyx_t_6 = -1; __pyx_t_1 = PyObject_GetIter(__pyx_t_3); if (unlikely(!__pyx_t_1)) __PYX_ERR(0, 588, __pyx_L1_error) + __Pyx_GOTREF(__pyx_t_1); + __pyx_t_7 = (CYTHON_COMPILING_IN_LIMITED_API) ? PyIter_Next : __Pyx_PyObject_GetIterNextFunc(__pyx_t_1); if (unlikely(!__pyx_t_7)) __PYX_ERR(0, 588, __pyx_L1_error) + } + __Pyx_DECREF(__pyx_t_3); __pyx_t_3 = 0; + for (;;) { + if (likely(!__pyx_t_7)) { + if (likely(PyList_CheckExact(__pyx_t_1))) { + { + Py_ssize_t __pyx_temp = __Pyx_PyList_GET_SIZE(__pyx_t_1); + #if !CYTHON_ASSUME_SAFE_SIZE + if (unlikely((__pyx_temp < 0))) __PYX_ERR(0, 588, __pyx_L1_error) + #endif + if (__pyx_t_6 >= __pyx_temp) break; + } + __pyx_t_3 = __Pyx_PyList_GetItemRefFast(__pyx_t_1, __pyx_t_6, __Pyx_ReferenceSharing_OwnStrongReference); + ++__pyx_t_6; + } else { + { + Py_ssize_t __pyx_temp = __Pyx_PyTuple_GET_SIZE(__pyx_t_1); + #if !CYTHON_ASSUME_SAFE_SIZE + if (unlikely((__pyx_temp < 0))) __PYX_ERR(0, 588, __pyx_L1_error) + #endif + if (__pyx_t_6 >= __pyx_temp) break; + } + #if CYTHON_ASSUME_SAFE_MACROS && !CYTHON_AVOID_BORROWED_REFS + __pyx_t_3 = __Pyx_NewRef(PyTuple_GET_ITEM(__pyx_t_1, __pyx_t_6)); + #else + __pyx_t_3 = __Pyx_PySequence_ITEM(__pyx_t_1, __pyx_t_6); + #endif + ++__pyx_t_6; + } + if (unlikely(!__pyx_t_3)) __PYX_ERR(0, 588, __pyx_L1_error) + } else { + __pyx_t_3 = __pyx_t_7(__pyx_t_1); + 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, 588, __pyx_L1_error) + PyErr_Clear(); + } + break; + } + } + __Pyx_GOTREF(__pyx_t_3); + __Pyx_XDECREF_SET(__pyx_v_label, __pyx_t_3); + __pyx_t_3 = 0; + + /* "spacy/pipeline/_parser_internals/arc_eager.pyx":589 + * actions[REDUCE][''] = 1 + * for label in kwargs.get('left_labels', []): + * actions[LEFT][label] = 1 # <<<<<<<<<<<<<< + * actions[SHIFT][label] = 1 + * for label in kwargs.get('right_labels', []): +*/ + __pyx_t_3 = __Pyx_GetItemInt(__pyx_v_actions, __pyx_e_5spacy_8pipeline_17_parser_internals_9arc_eager_LEFT, int, 1, __Pyx_PyLong_From___pyx_anon_enum, 0, 1, 1, 1, __Pyx_ReferenceSharing_OwnStrongReference); if (unlikely(!__pyx_t_3)) __PYX_ERR(0, 589, __pyx_L1_error) + __Pyx_GOTREF(__pyx_t_3); + if (unlikely((PyObject_SetItem(__pyx_t_3, __pyx_v_label, __pyx_mstate_global->__pyx_int_1) < 0))) __PYX_ERR(0, 589, __pyx_L1_error) + __Pyx_DECREF(__pyx_t_3); __pyx_t_3 = 0; + + /* "spacy/pipeline/_parser_internals/arc_eager.pyx":590 + * for label in kwargs.get('left_labels', []): + * actions[LEFT][label] = 1 + * actions[SHIFT][label] = 1 # <<<<<<<<<<<<<< + * for label in kwargs.get('right_labels', []): + * actions[RIGHT][label] = 1 +*/ + __pyx_t_3 = __Pyx_GetItemInt(__pyx_v_actions, __pyx_e_5spacy_8pipeline_17_parser_internals_9arc_eager_SHIFT, int, 1, __Pyx_PyLong_From___pyx_anon_enum, 0, 1, 1, 1, __Pyx_ReferenceSharing_OwnStrongReference); if (unlikely(!__pyx_t_3)) __PYX_ERR(0, 590, __pyx_L1_error) + __Pyx_GOTREF(__pyx_t_3); + if (unlikely((PyObject_SetItem(__pyx_t_3, __pyx_v_label, __pyx_mstate_global->__pyx_int_1) < 0))) __PYX_ERR(0, 590, __pyx_L1_error) + __Pyx_DECREF(__pyx_t_3); __pyx_t_3 = 0; + + /* "spacy/pipeline/_parser_internals/arc_eager.pyx":588 + * actions[SHIFT][''] = 1 + * actions[REDUCE][''] = 1 + * for label in kwargs.get('left_labels', []): # <<<<<<<<<<<<<< + * actions[LEFT][label] = 1 + * actions[SHIFT][label] = 1 +*/ + } + __Pyx_DECREF(__pyx_t_1); __pyx_t_1 = 0; + + /* "spacy/pipeline/_parser_internals/arc_eager.pyx":591 + * actions[LEFT][label] = 1 + * actions[SHIFT][label] = 1 + * for label in kwargs.get('right_labels', []): # <<<<<<<<<<<<<< + * actions[RIGHT][label] = 1 + * actions[REDUCE][label] = 1 +*/ + __pyx_t_1 = PyList_New(0); if (unlikely(!__pyx_t_1)) __PYX_ERR(0, 591, __pyx_L1_error) + __Pyx_GOTREF(__pyx_t_1); + __pyx_t_3 = __Pyx_PyDict_GetItemDefault(__pyx_v_kwargs, __pyx_mstate_global->__pyx_n_u_right_labels, __pyx_t_1); if (unlikely(!__pyx_t_3)) __PYX_ERR(0, 591, __pyx_L1_error) + __Pyx_GOTREF(__pyx_t_3); + __Pyx_DECREF(__pyx_t_1); __pyx_t_1 = 0; + if (likely(PyList_CheckExact(__pyx_t_3)) || PyTuple_CheckExact(__pyx_t_3)) { + __pyx_t_1 = __pyx_t_3; __Pyx_INCREF(__pyx_t_1); + __pyx_t_6 = 0; + __pyx_t_7 = NULL; + } else { + __pyx_t_6 = -1; __pyx_t_1 = PyObject_GetIter(__pyx_t_3); if (unlikely(!__pyx_t_1)) __PYX_ERR(0, 591, __pyx_L1_error) + __Pyx_GOTREF(__pyx_t_1); + __pyx_t_7 = (CYTHON_COMPILING_IN_LIMITED_API) ? PyIter_Next : __Pyx_PyObject_GetIterNextFunc(__pyx_t_1); if (unlikely(!__pyx_t_7)) __PYX_ERR(0, 591, __pyx_L1_error) + } + __Pyx_DECREF(__pyx_t_3); __pyx_t_3 = 0; + for (;;) { + if (likely(!__pyx_t_7)) { + if (likely(PyList_CheckExact(__pyx_t_1))) { + { + Py_ssize_t __pyx_temp = __Pyx_PyList_GET_SIZE(__pyx_t_1); + #if !CYTHON_ASSUME_SAFE_SIZE + if (unlikely((__pyx_temp < 0))) __PYX_ERR(0, 591, __pyx_L1_error) + #endif + if (__pyx_t_6 >= __pyx_temp) break; + } + __pyx_t_3 = __Pyx_PyList_GetItemRefFast(__pyx_t_1, __pyx_t_6, __Pyx_ReferenceSharing_OwnStrongReference); + ++__pyx_t_6; + } else { + { + Py_ssize_t __pyx_temp = __Pyx_PyTuple_GET_SIZE(__pyx_t_1); + #if !CYTHON_ASSUME_SAFE_SIZE + if (unlikely((__pyx_temp < 0))) __PYX_ERR(0, 591, __pyx_L1_error) + #endif + if (__pyx_t_6 >= __pyx_temp) break; + } + #if CYTHON_ASSUME_SAFE_MACROS && !CYTHON_AVOID_BORROWED_REFS + __pyx_t_3 = __Pyx_NewRef(PyTuple_GET_ITEM(__pyx_t_1, __pyx_t_6)); + #else + __pyx_t_3 = __Pyx_PySequence_ITEM(__pyx_t_1, __pyx_t_6); + #endif + ++__pyx_t_6; + } + if (unlikely(!__pyx_t_3)) __PYX_ERR(0, 591, __pyx_L1_error) + } else { + __pyx_t_3 = __pyx_t_7(__pyx_t_1); + 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, 591, __pyx_L1_error) + PyErr_Clear(); + } + break; + } + } + __Pyx_GOTREF(__pyx_t_3); + __Pyx_XDECREF_SET(__pyx_v_label, __pyx_t_3); + __pyx_t_3 = 0; + + /* "spacy/pipeline/_parser_internals/arc_eager.pyx":592 + * actions[SHIFT][label] = 1 + * for label in kwargs.get('right_labels', []): + * actions[RIGHT][label] = 1 # <<<<<<<<<<<<<< + * actions[REDUCE][label] = 1 + * for example in kwargs.get('examples', []): +*/ + __pyx_t_3 = __Pyx_GetItemInt(__pyx_v_actions, __pyx_e_5spacy_8pipeline_17_parser_internals_9arc_eager_RIGHT, int, 1, __Pyx_PyLong_From___pyx_anon_enum, 0, 1, 1, 1, __Pyx_ReferenceSharing_OwnStrongReference); if (unlikely(!__pyx_t_3)) __PYX_ERR(0, 592, __pyx_L1_error) + __Pyx_GOTREF(__pyx_t_3); + if (unlikely((PyObject_SetItem(__pyx_t_3, __pyx_v_label, __pyx_mstate_global->__pyx_int_1) < 0))) __PYX_ERR(0, 592, __pyx_L1_error) + __Pyx_DECREF(__pyx_t_3); __pyx_t_3 = 0; + + /* "spacy/pipeline/_parser_internals/arc_eager.pyx":593 + * for label in kwargs.get('right_labels', []): + * actions[RIGHT][label] = 1 + * actions[REDUCE][label] = 1 # <<<<<<<<<<<<<< + * for example in kwargs.get('examples', []): + * # use heads and labels from the reference parse (without regard to +*/ + __pyx_t_3 = __Pyx_GetItemInt(__pyx_v_actions, __pyx_e_5spacy_8pipeline_17_parser_internals_9arc_eager_REDUCE, int, 1, __Pyx_PyLong_From___pyx_anon_enum, 0, 1, 1, 1, __Pyx_ReferenceSharing_OwnStrongReference); if (unlikely(!__pyx_t_3)) __PYX_ERR(0, 593, __pyx_L1_error) + __Pyx_GOTREF(__pyx_t_3); + if (unlikely((PyObject_SetItem(__pyx_t_3, __pyx_v_label, __pyx_mstate_global->__pyx_int_1) < 0))) __PYX_ERR(0, 593, __pyx_L1_error) + __Pyx_DECREF(__pyx_t_3); __pyx_t_3 = 0; + + /* "spacy/pipeline/_parser_internals/arc_eager.pyx":591 + * actions[LEFT][label] = 1 + * actions[SHIFT][label] = 1 + * for label in kwargs.get('right_labels', []): # <<<<<<<<<<<<<< + * actions[RIGHT][label] = 1 + * actions[REDUCE][label] = 1 +*/ + } + __Pyx_DECREF(__pyx_t_1); __pyx_t_1 = 0; + + /* "spacy/pipeline/_parser_internals/arc_eager.pyx":594 + * actions[RIGHT][label] = 1 + * actions[REDUCE][label] = 1 + * for example in kwargs.get('examples', []): # <<<<<<<<<<<<<< + * # use heads and labels from the reference parse (without regard to + * # misalignments between the predicted and reference) +*/ + __pyx_t_1 = PyList_New(0); if (unlikely(!__pyx_t_1)) __PYX_ERR(0, 594, __pyx_L1_error) + __Pyx_GOTREF(__pyx_t_1); + __pyx_t_3 = __Pyx_PyDict_GetItemDefault(__pyx_v_kwargs, __pyx_mstate_global->__pyx_n_u_examples, __pyx_t_1); if (unlikely(!__pyx_t_3)) __PYX_ERR(0, 594, __pyx_L1_error) + __Pyx_GOTREF(__pyx_t_3); + __Pyx_DECREF(__pyx_t_1); __pyx_t_1 = 0; + if (likely(PyList_CheckExact(__pyx_t_3)) || PyTuple_CheckExact(__pyx_t_3)) { + __pyx_t_1 = __pyx_t_3; __Pyx_INCREF(__pyx_t_1); + __pyx_t_6 = 0; + __pyx_t_7 = NULL; + } else { + __pyx_t_6 = -1; __pyx_t_1 = PyObject_GetIter(__pyx_t_3); if (unlikely(!__pyx_t_1)) __PYX_ERR(0, 594, __pyx_L1_error) + __Pyx_GOTREF(__pyx_t_1); + __pyx_t_7 = (CYTHON_COMPILING_IN_LIMITED_API) ? PyIter_Next : __Pyx_PyObject_GetIterNextFunc(__pyx_t_1); if (unlikely(!__pyx_t_7)) __PYX_ERR(0, 594, __pyx_L1_error) + } + __Pyx_DECREF(__pyx_t_3); __pyx_t_3 = 0; + for (;;) { + if (likely(!__pyx_t_7)) { + if (likely(PyList_CheckExact(__pyx_t_1))) { + { + Py_ssize_t __pyx_temp = __Pyx_PyList_GET_SIZE(__pyx_t_1); + #if !CYTHON_ASSUME_SAFE_SIZE + if (unlikely((__pyx_temp < 0))) __PYX_ERR(0, 594, __pyx_L1_error) + #endif + if (__pyx_t_6 >= __pyx_temp) break; + } + __pyx_t_3 = __Pyx_PyList_GetItemRefFast(__pyx_t_1, __pyx_t_6, __Pyx_ReferenceSharing_OwnStrongReference); + ++__pyx_t_6; + } else { + { + Py_ssize_t __pyx_temp = __Pyx_PyTuple_GET_SIZE(__pyx_t_1); + #if !CYTHON_ASSUME_SAFE_SIZE + if (unlikely((__pyx_temp < 0))) __PYX_ERR(0, 594, __pyx_L1_error) + #endif + if (__pyx_t_6 >= __pyx_temp) break; + } + #if CYTHON_ASSUME_SAFE_MACROS && !CYTHON_AVOID_BORROWED_REFS + __pyx_t_3 = __Pyx_NewRef(PyTuple_GET_ITEM(__pyx_t_1, __pyx_t_6)); + #else + __pyx_t_3 = __Pyx_PySequence_ITEM(__pyx_t_1, __pyx_t_6); + #endif + ++__pyx_t_6; + } + if (unlikely(!__pyx_t_3)) __PYX_ERR(0, 594, __pyx_L1_error) + } else { + __pyx_t_3 = __pyx_t_7(__pyx_t_1); + 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, 594, __pyx_L1_error) + PyErr_Clear(); + } + break; + } + } + __Pyx_GOTREF(__pyx_t_3); + __Pyx_XDECREF_SET(__pyx_v_example, __pyx_t_3); + __pyx_t_3 = 0; + + /* "spacy/pipeline/_parser_internals/arc_eager.pyx":597 + * # use heads and labels from the reference parse (without regard to + * # misalignments between the predicted and reference) + * example_gold_preproc = Example(example.reference, example.reference) # <<<<<<<<<<<<<< + * heads, labels = example_gold_preproc.get_aligned_parse(projectivize=True) + * for child, (head, label) in enumerate(zip(heads, labels)): +*/ + __pyx_t_4 = NULL; + __pyx_t_2 = __Pyx_PyObject_GetAttrStr(__pyx_v_example, __pyx_mstate_global->__pyx_n_u_reference); if (unlikely(!__pyx_t_2)) __PYX_ERR(0, 597, __pyx_L1_error) + __Pyx_GOTREF(__pyx_t_2); + __pyx_t_8 = __Pyx_PyObject_GetAttrStr(__pyx_v_example, __pyx_mstate_global->__pyx_n_u_reference); if (unlikely(!__pyx_t_8)) __PYX_ERR(0, 597, __pyx_L1_error) + __Pyx_GOTREF(__pyx_t_8); + __pyx_t_5 = 1; + { + PyObject *__pyx_callargs[3] = {__pyx_t_4, __pyx_t_2, __pyx_t_8}; + __pyx_t_3 = __Pyx_PyObject_FastCall((PyObject*)__pyx_mstate_global->__pyx_ptype_5spacy_8training_7example_Example, __pyx_callargs+__pyx_t_5, (3-__pyx_t_5) | (__pyx_t_5*__Pyx_PY_VECTORCALL_ARGUMENTS_OFFSET)); + __Pyx_XDECREF(__pyx_t_4); __pyx_t_4 = 0; + __Pyx_DECREF(__pyx_t_2); __pyx_t_2 = 0; + __Pyx_DECREF(__pyx_t_8); __pyx_t_8 = 0; + if (unlikely(!__pyx_t_3)) __PYX_ERR(0, 597, __pyx_L1_error) + __Pyx_GOTREF((PyObject *)__pyx_t_3); + } + __Pyx_XDECREF_SET(__pyx_v_example_gold_preproc, ((struct __pyx_obj_5spacy_8training_7example_Example *)__pyx_t_3)); + __pyx_t_3 = 0; + + /* "spacy/pipeline/_parser_internals/arc_eager.pyx":598 + * # misalignments between the predicted and reference) + * example_gold_preproc = Example(example.reference, example.reference) + * heads, labels = example_gold_preproc.get_aligned_parse(projectivize=True) # <<<<<<<<<<<<<< + * for child, (head, label) in enumerate(zip(heads, labels)): + * if head is None or label is None: +*/ + __pyx_t_8 = ((PyObject *)__pyx_v_example_gold_preproc); + __Pyx_INCREF(__pyx_t_8); + __pyx_t_5 = 0; + { + PyObject *__pyx_callargs[2 + ((CYTHON_VECTORCALL) ? 1 : 0)] = {__pyx_t_8, NULL}; + __pyx_t_2 = __Pyx_MakeVectorcallBuilderKwds(1); if (unlikely(!__pyx_t_2)) __PYX_ERR(0, 598, __pyx_L1_error) + __Pyx_GOTREF(__pyx_t_2); + if (__Pyx_VectorcallBuilder_AddArg(__pyx_mstate_global->__pyx_n_u_projectivize, Py_True, __pyx_t_2, __pyx_callargs+1, 0) < (0)) __PYX_ERR(0, 598, __pyx_L1_error) + __pyx_t_3 = __Pyx_Object_VectorcallMethod_CallFromBuilder((PyObject*)__pyx_mstate_global->__pyx_n_u_get_aligned_parse, __pyx_callargs+__pyx_t_5, (1-__pyx_t_5) | (1*__Pyx_PY_VECTORCALL_ARGUMENTS_OFFSET), __pyx_t_2); + __Pyx_XDECREF(__pyx_t_8); __pyx_t_8 = 0; + __Pyx_DECREF(__pyx_t_2); __pyx_t_2 = 0; + if (unlikely(!__pyx_t_3)) __PYX_ERR(0, 598, __pyx_L1_error) + __Pyx_GOTREF(__pyx_t_3); + } + if ((likely(PyTuple_CheckExact(__pyx_t_3))) || (PyList_CheckExact(__pyx_t_3))) { + PyObject* sequence = __pyx_t_3; + 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, 598, __pyx_L1_error) + } + #if CYTHON_ASSUME_SAFE_MACROS && !CYTHON_AVOID_BORROWED_REFS + if (likely(PyTuple_CheckExact(sequence))) { + __pyx_t_2 = PyTuple_GET_ITEM(sequence, 0); + __Pyx_INCREF(__pyx_t_2); + __pyx_t_8 = PyTuple_GET_ITEM(sequence, 1); + __Pyx_INCREF(__pyx_t_8); + } else { + __pyx_t_2 = __Pyx_PyList_GetItemRefFast(sequence, 0, __Pyx_ReferenceSharing_SharedReference); + if (unlikely(!__pyx_t_2)) __PYX_ERR(0, 598, __pyx_L1_error) + __Pyx_XGOTREF(__pyx_t_2); + __pyx_t_8 = __Pyx_PyList_GetItemRefFast(sequence, 1, __Pyx_ReferenceSharing_SharedReference); + if (unlikely(!__pyx_t_8)) __PYX_ERR(0, 598, __pyx_L1_error) + __Pyx_XGOTREF(__pyx_t_8); + } + #else + __pyx_t_2 = __Pyx_PySequence_ITEM(sequence, 0); if (unlikely(!__pyx_t_2)) __PYX_ERR(0, 598, __pyx_L1_error) + __Pyx_GOTREF(__pyx_t_2); + __pyx_t_8 = __Pyx_PySequence_ITEM(sequence, 1); if (unlikely(!__pyx_t_8)) __PYX_ERR(0, 598, __pyx_L1_error) + __Pyx_GOTREF(__pyx_t_8); + #endif + __Pyx_DECREF(__pyx_t_3); __pyx_t_3 = 0; + } else { + Py_ssize_t index = -1; + __pyx_t_4 = PyObject_GetIter(__pyx_t_3); if (unlikely(!__pyx_t_4)) __PYX_ERR(0, 598, __pyx_L1_error) + __Pyx_GOTREF(__pyx_t_4); + __Pyx_DECREF(__pyx_t_3); __pyx_t_3 = 0; + __pyx_t_9 = (CYTHON_COMPILING_IN_LIMITED_API) ? PyIter_Next : __Pyx_PyObject_GetIterNextFunc(__pyx_t_4); + index = 0; __pyx_t_2 = __pyx_t_9(__pyx_t_4); if (unlikely(!__pyx_t_2)) goto __pyx_L11_unpacking_failed; + __Pyx_GOTREF(__pyx_t_2); + index = 1; __pyx_t_8 = __pyx_t_9(__pyx_t_4); if (unlikely(!__pyx_t_8)) goto __pyx_L11_unpacking_failed; + __Pyx_GOTREF(__pyx_t_8); + if (__Pyx_IternextUnpackEndCheck(__pyx_t_9(__pyx_t_4), 2) < (0)) __PYX_ERR(0, 598, __pyx_L1_error) + __pyx_t_9 = NULL; + __Pyx_DECREF(__pyx_t_4); __pyx_t_4 = 0; + goto __pyx_L12_unpacking_done; + __pyx_L11_unpacking_failed:; + __Pyx_DECREF(__pyx_t_4); __pyx_t_4 = 0; + __pyx_t_9 = NULL; + if (__Pyx_IterFinish() == 0) __Pyx_RaiseNeedMoreValuesError(index); + __PYX_ERR(0, 598, __pyx_L1_error) + __pyx_L12_unpacking_done:; + } + __Pyx_XDECREF_SET(__pyx_v_heads, __pyx_t_2); + __pyx_t_2 = 0; + __Pyx_XDECREF_SET(__pyx_v_labels, __pyx_t_8); + __pyx_t_8 = 0; + + /* "spacy/pipeline/_parser_internals/arc_eager.pyx":599 + * example_gold_preproc = Example(example.reference, example.reference) + * heads, labels = example_gold_preproc.get_aligned_parse(projectivize=True) + * for child, (head, label) in enumerate(zip(heads, labels)): # <<<<<<<<<<<<<< + * if head is None or label is None: + * continue +*/ + __Pyx_INCREF(__pyx_mstate_global->__pyx_int_0); + __pyx_t_3 = __pyx_mstate_global->__pyx_int_0; + __pyx_t_2 = NULL; + __pyx_t_5 = 1; + { + PyObject *__pyx_callargs[3] = {__pyx_t_2, __pyx_v_heads, __pyx_v_labels}; + __pyx_t_8 = __Pyx_PyObject_FastCall((PyObject*)__pyx_builtin_zip, __pyx_callargs+__pyx_t_5, (3-__pyx_t_5) | (__pyx_t_5*__Pyx_PY_VECTORCALL_ARGUMENTS_OFFSET)); + __Pyx_XDECREF(__pyx_t_2); __pyx_t_2 = 0; + if (unlikely(!__pyx_t_8)) __PYX_ERR(0, 599, __pyx_L1_error) + __Pyx_GOTREF(__pyx_t_8); + } + if (likely(PyList_CheckExact(__pyx_t_8)) || PyTuple_CheckExact(__pyx_t_8)) { + __pyx_t_2 = __pyx_t_8; __Pyx_INCREF(__pyx_t_2); + __pyx_t_10 = 0; + __pyx_t_11 = NULL; + } else { + __pyx_t_10 = -1; __pyx_t_2 = PyObject_GetIter(__pyx_t_8); if (unlikely(!__pyx_t_2)) __PYX_ERR(0, 599, __pyx_L1_error) + __Pyx_GOTREF(__pyx_t_2); + __pyx_t_11 = (CYTHON_COMPILING_IN_LIMITED_API) ? PyIter_Next : __Pyx_PyObject_GetIterNextFunc(__pyx_t_2); if (unlikely(!__pyx_t_11)) __PYX_ERR(0, 599, __pyx_L1_error) + } + __Pyx_DECREF(__pyx_t_8); __pyx_t_8 = 0; + for (;;) { + if (likely(!__pyx_t_11)) { + if (likely(PyList_CheckExact(__pyx_t_2))) { + { + Py_ssize_t __pyx_temp = __Pyx_PyList_GET_SIZE(__pyx_t_2); + #if !CYTHON_ASSUME_SAFE_SIZE + if (unlikely((__pyx_temp < 0))) __PYX_ERR(0, 599, __pyx_L1_error) + #endif + if (__pyx_t_10 >= __pyx_temp) break; + } + __pyx_t_8 = __Pyx_PyList_GetItemRefFast(__pyx_t_2, __pyx_t_10, __Pyx_ReferenceSharing_OwnStrongReference); + ++__pyx_t_10; + } else { + { + Py_ssize_t __pyx_temp = __Pyx_PyTuple_GET_SIZE(__pyx_t_2); + #if !CYTHON_ASSUME_SAFE_SIZE + if (unlikely((__pyx_temp < 0))) __PYX_ERR(0, 599, __pyx_L1_error) + #endif + if (__pyx_t_10 >= __pyx_temp) break; + } + #if CYTHON_ASSUME_SAFE_MACROS && !CYTHON_AVOID_BORROWED_REFS + __pyx_t_8 = __Pyx_NewRef(PyTuple_GET_ITEM(__pyx_t_2, __pyx_t_10)); + #else + __pyx_t_8 = __Pyx_PySequence_ITEM(__pyx_t_2, __pyx_t_10); + #endif + ++__pyx_t_10; + } + if (unlikely(!__pyx_t_8)) __PYX_ERR(0, 599, __pyx_L1_error) + } else { + __pyx_t_8 = __pyx_t_11(__pyx_t_2); + if (unlikely(!__pyx_t_8)) { + PyObject* exc_type = PyErr_Occurred(); + if (exc_type) { + if (unlikely(!__Pyx_PyErr_GivenExceptionMatches(exc_type, PyExc_StopIteration))) __PYX_ERR(0, 599, __pyx_L1_error) + PyErr_Clear(); + } + break; + } + } + __Pyx_GOTREF(__pyx_t_8); + if ((likely(PyTuple_CheckExact(__pyx_t_8))) || (PyList_CheckExact(__pyx_t_8))) { + PyObject* sequence = __pyx_t_8; + 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, 599, __pyx_L1_error) + } + #if CYTHON_ASSUME_SAFE_MACROS && !CYTHON_AVOID_BORROWED_REFS + if (likely(PyTuple_CheckExact(sequence))) { + __pyx_t_4 = PyTuple_GET_ITEM(sequence, 0); + __Pyx_INCREF(__pyx_t_4); + __pyx_t_12 = PyTuple_GET_ITEM(sequence, 1); + __Pyx_INCREF(__pyx_t_12); + } else { + __pyx_t_4 = __Pyx_PyList_GetItemRefFast(sequence, 0, __Pyx_ReferenceSharing_SharedReference); + if (unlikely(!__pyx_t_4)) __PYX_ERR(0, 599, __pyx_L1_error) + __Pyx_XGOTREF(__pyx_t_4); + __pyx_t_12 = __Pyx_PyList_GetItemRefFast(sequence, 1, __Pyx_ReferenceSharing_SharedReference); + if (unlikely(!__pyx_t_12)) __PYX_ERR(0, 599, __pyx_L1_error) + __Pyx_XGOTREF(__pyx_t_12); + } + #else + __pyx_t_4 = __Pyx_PySequence_ITEM(sequence, 0); if (unlikely(!__pyx_t_4)) __PYX_ERR(0, 599, __pyx_L1_error) + __Pyx_GOTREF(__pyx_t_4); + __pyx_t_12 = __Pyx_PySequence_ITEM(sequence, 1); if (unlikely(!__pyx_t_12)) __PYX_ERR(0, 599, __pyx_L1_error) + __Pyx_GOTREF(__pyx_t_12); + #endif + __Pyx_DECREF(__pyx_t_8); __pyx_t_8 = 0; + } else { + Py_ssize_t index = -1; + __pyx_t_13 = PyObject_GetIter(__pyx_t_8); if (unlikely(!__pyx_t_13)) __PYX_ERR(0, 599, __pyx_L1_error) + __Pyx_GOTREF(__pyx_t_13); + __Pyx_DECREF(__pyx_t_8); __pyx_t_8 = 0; + __pyx_t_9 = (CYTHON_COMPILING_IN_LIMITED_API) ? PyIter_Next : __Pyx_PyObject_GetIterNextFunc(__pyx_t_13); + index = 0; __pyx_t_4 = __pyx_t_9(__pyx_t_13); if (unlikely(!__pyx_t_4)) goto __pyx_L15_unpacking_failed; + __Pyx_GOTREF(__pyx_t_4); + index = 1; __pyx_t_12 = __pyx_t_9(__pyx_t_13); if (unlikely(!__pyx_t_12)) goto __pyx_L15_unpacking_failed; + __Pyx_GOTREF(__pyx_t_12); + if (__Pyx_IternextUnpackEndCheck(__pyx_t_9(__pyx_t_13), 2) < (0)) __PYX_ERR(0, 599, __pyx_L1_error) + __pyx_t_9 = NULL; + __Pyx_DECREF(__pyx_t_13); __pyx_t_13 = 0; + goto __pyx_L16_unpacking_done; + __pyx_L15_unpacking_failed:; + __Pyx_DECREF(__pyx_t_13); __pyx_t_13 = 0; + __pyx_t_9 = NULL; + if (__Pyx_IterFinish() == 0) __Pyx_RaiseNeedMoreValuesError(index); + __PYX_ERR(0, 599, __pyx_L1_error) + __pyx_L16_unpacking_done:; + } + __Pyx_XDECREF_SET(__pyx_v_head, __pyx_t_4); + __pyx_t_4 = 0; + __Pyx_XDECREF_SET(__pyx_v_label, __pyx_t_12); + __pyx_t_12 = 0; + __Pyx_INCREF(__pyx_t_3); + __Pyx_XDECREF_SET(__pyx_v_child, __pyx_t_3); + __pyx_t_8 = __Pyx_PyLong_AddObjC(__pyx_t_3, __pyx_mstate_global->__pyx_int_1, 1, 0, 0); if (unlikely(!__pyx_t_8)) __PYX_ERR(0, 599, __pyx_L1_error) + __Pyx_GOTREF(__pyx_t_8); + __Pyx_DECREF(__pyx_t_3); + __pyx_t_3 = __pyx_t_8; + __pyx_t_8 = 0; + + /* "spacy/pipeline/_parser_internals/arc_eager.pyx":600 + * heads, labels = example_gold_preproc.get_aligned_parse(projectivize=True) + * for child, (head, label) in enumerate(zip(heads, labels)): + * if head is None or label is None: # <<<<<<<<<<<<<< + * continue + * if label.upper() == 'ROOT' : +*/ + __pyx_t_15 = (__pyx_v_head == Py_None); + if (!__pyx_t_15) { + } else { + __pyx_t_14 = __pyx_t_15; + goto __pyx_L18_bool_binop_done; + } + __pyx_t_15 = (__pyx_v_label == Py_None); + __pyx_t_14 = __pyx_t_15; + __pyx_L18_bool_binop_done:; + if (__pyx_t_14) { + + /* "spacy/pipeline/_parser_internals/arc_eager.pyx":601 + * for child, (head, label) in enumerate(zip(heads, labels)): + * if head is None or label is None: + * continue # <<<<<<<<<<<<<< + * if label.upper() == 'ROOT' : + * label = 'ROOT' +*/ + goto __pyx_L13_continue; + + /* "spacy/pipeline/_parser_internals/arc_eager.pyx":600 + * heads, labels = example_gold_preproc.get_aligned_parse(projectivize=True) + * for child, (head, label) in enumerate(zip(heads, labels)): + * if head is None or label is None: # <<<<<<<<<<<<<< + * continue + * if label.upper() == 'ROOT' : +*/ + } + + /* "spacy/pipeline/_parser_internals/arc_eager.pyx":602 + * if head is None or label is None: + * continue + * if label.upper() == 'ROOT' : # <<<<<<<<<<<<<< + * label = 'ROOT' + * if head == child: +*/ + __pyx_t_12 = __pyx_v_label; + __Pyx_INCREF(__pyx_t_12); + __pyx_t_5 = 0; + { + PyObject *__pyx_callargs[2] = {__pyx_t_12, NULL}; + __pyx_t_8 = __Pyx_PyObject_FastCallMethod((PyObject*)__pyx_mstate_global->__pyx_n_u_upper, __pyx_callargs+__pyx_t_5, (1-__pyx_t_5) | (1*__Pyx_PY_VECTORCALL_ARGUMENTS_OFFSET)); + __Pyx_XDECREF(__pyx_t_12); __pyx_t_12 = 0; + if (unlikely(!__pyx_t_8)) __PYX_ERR(0, 602, __pyx_L1_error) + __Pyx_GOTREF(__pyx_t_8); + } + __pyx_t_14 = (__Pyx_PyUnicode_Equals(__pyx_t_8, __pyx_mstate_global->__pyx_n_u_ROOT, Py_EQ)); if (unlikely((__pyx_t_14 < 0))) __PYX_ERR(0, 602, __pyx_L1_error) + __Pyx_DECREF(__pyx_t_8); __pyx_t_8 = 0; + if (__pyx_t_14) { + + /* "spacy/pipeline/_parser_internals/arc_eager.pyx":603 + * continue + * if label.upper() == 'ROOT' : + * label = 'ROOT' # <<<<<<<<<<<<<< + * if head == child: + * actions[BREAK][label] += 1 +*/ + __Pyx_INCREF(__pyx_mstate_global->__pyx_n_u_ROOT); + __Pyx_DECREF_SET(__pyx_v_label, __pyx_mstate_global->__pyx_n_u_ROOT); + + /* "spacy/pipeline/_parser_internals/arc_eager.pyx":602 + * if head is None or label is None: + * continue + * if label.upper() == 'ROOT' : # <<<<<<<<<<<<<< + * label = 'ROOT' + * if head == child: +*/ + } + + /* "spacy/pipeline/_parser_internals/arc_eager.pyx":604 + * if label.upper() == 'ROOT' : + * label = 'ROOT' + * if head == child: # <<<<<<<<<<<<<< + * actions[BREAK][label] += 1 + * if head < child: +*/ + __pyx_t_8 = PyObject_RichCompare(__pyx_v_head, __pyx_v_child, Py_EQ); __Pyx_XGOTREF(__pyx_t_8); if (unlikely(!__pyx_t_8)) __PYX_ERR(0, 604, __pyx_L1_error) + __pyx_t_14 = __Pyx_PyObject_IsTrue(__pyx_t_8); if (unlikely((__pyx_t_14 < 0))) __PYX_ERR(0, 604, __pyx_L1_error) + __Pyx_DECREF(__pyx_t_8); __pyx_t_8 = 0; + if (__pyx_t_14) { + + /* "spacy/pipeline/_parser_internals/arc_eager.pyx":605 + * label = 'ROOT' + * if head == child: + * actions[BREAK][label] += 1 # <<<<<<<<<<<<<< + * if head < child: + * actions[RIGHT][label] += 1 +*/ + __pyx_t_8 = __Pyx_GetItemInt(__pyx_v_actions, __pyx_e_5spacy_8pipeline_17_parser_internals_9arc_eager_BREAK, int, 1, __Pyx_PyLong_From___pyx_anon_enum, 0, 1, 1, 1, __Pyx_ReferenceSharing_OwnStrongReference); if (unlikely(!__pyx_t_8)) __PYX_ERR(0, 605, __pyx_L1_error) + __Pyx_GOTREF(__pyx_t_8); + __Pyx_INCREF(__pyx_v_label); + __pyx_t_12 = __pyx_v_label; + __pyx_t_4 = __Pyx_PyObject_GetItem(__pyx_t_8, __pyx_t_12); if (unlikely(!__pyx_t_4)) __PYX_ERR(0, 605, __pyx_L1_error) + __Pyx_GOTREF(__pyx_t_4); + __pyx_t_13 = __Pyx_PyLong_AddObjC(__pyx_t_4, __pyx_mstate_global->__pyx_int_1, 1, 1, 0); if (unlikely(!__pyx_t_13)) __PYX_ERR(0, 605, __pyx_L1_error) + __Pyx_GOTREF(__pyx_t_13); + __Pyx_DECREF(__pyx_t_4); __pyx_t_4 = 0; + if (unlikely((PyObject_SetItem(__pyx_t_8, __pyx_t_12, __pyx_t_13) < 0))) __PYX_ERR(0, 605, __pyx_L1_error) + __Pyx_DECREF(__pyx_t_13); __pyx_t_13 = 0; + __Pyx_DECREF(__pyx_t_12); __pyx_t_12 = 0; + __Pyx_DECREF(__pyx_t_8); __pyx_t_8 = 0; + + /* "spacy/pipeline/_parser_internals/arc_eager.pyx":604 + * if label.upper() == 'ROOT' : + * label = 'ROOT' + * if head == child: # <<<<<<<<<<<<<< + * actions[BREAK][label] += 1 + * if head < child: +*/ + } + + /* "spacy/pipeline/_parser_internals/arc_eager.pyx":606 + * if head == child: + * actions[BREAK][label] += 1 + * if head < child: # <<<<<<<<<<<<<< + * actions[RIGHT][label] += 1 + * actions[REDUCE][''] += 1 +*/ + __pyx_t_8 = PyObject_RichCompare(__pyx_v_head, __pyx_v_child, Py_LT); __Pyx_XGOTREF(__pyx_t_8); if (unlikely(!__pyx_t_8)) __PYX_ERR(0, 606, __pyx_L1_error) + __pyx_t_14 = __Pyx_PyObject_IsTrue(__pyx_t_8); if (unlikely((__pyx_t_14 < 0))) __PYX_ERR(0, 606, __pyx_L1_error) + __Pyx_DECREF(__pyx_t_8); __pyx_t_8 = 0; + if (__pyx_t_14) { + + /* "spacy/pipeline/_parser_internals/arc_eager.pyx":607 + * actions[BREAK][label] += 1 + * if head < child: + * actions[RIGHT][label] += 1 # <<<<<<<<<<<<<< + * actions[REDUCE][''] += 1 + * elif head > child: +*/ + __pyx_t_8 = __Pyx_GetItemInt(__pyx_v_actions, __pyx_e_5spacy_8pipeline_17_parser_internals_9arc_eager_RIGHT, int, 1, __Pyx_PyLong_From___pyx_anon_enum, 0, 1, 1, 1, __Pyx_ReferenceSharing_OwnStrongReference); if (unlikely(!__pyx_t_8)) __PYX_ERR(0, 607, __pyx_L1_error) + __Pyx_GOTREF(__pyx_t_8); + __Pyx_INCREF(__pyx_v_label); + __pyx_t_12 = __pyx_v_label; + __pyx_t_13 = __Pyx_PyObject_GetItem(__pyx_t_8, __pyx_t_12); if (unlikely(!__pyx_t_13)) __PYX_ERR(0, 607, __pyx_L1_error) + __Pyx_GOTREF(__pyx_t_13); + __pyx_t_4 = __Pyx_PyLong_AddObjC(__pyx_t_13, __pyx_mstate_global->__pyx_int_1, 1, 1, 0); if (unlikely(!__pyx_t_4)) __PYX_ERR(0, 607, __pyx_L1_error) + __Pyx_GOTREF(__pyx_t_4); + __Pyx_DECREF(__pyx_t_13); __pyx_t_13 = 0; + if (unlikely((PyObject_SetItem(__pyx_t_8, __pyx_t_12, __pyx_t_4) < 0))) __PYX_ERR(0, 607, __pyx_L1_error) + __Pyx_DECREF(__pyx_t_4); __pyx_t_4 = 0; + __Pyx_DECREF(__pyx_t_12); __pyx_t_12 = 0; + __Pyx_DECREF(__pyx_t_8); __pyx_t_8 = 0; + + /* "spacy/pipeline/_parser_internals/arc_eager.pyx":608 + * if head < child: + * actions[RIGHT][label] += 1 + * actions[REDUCE][''] += 1 # <<<<<<<<<<<<<< + * elif head > child: + * actions[LEFT][label] += 1 +*/ + __pyx_t_8 = __Pyx_GetItemInt(__pyx_v_actions, __pyx_e_5spacy_8pipeline_17_parser_internals_9arc_eager_REDUCE, int, 1, __Pyx_PyLong_From___pyx_anon_enum, 0, 1, 1, 1, __Pyx_ReferenceSharing_OwnStrongReference); if (unlikely(!__pyx_t_8)) __PYX_ERR(0, 608, __pyx_L1_error) + __Pyx_GOTREF(__pyx_t_8); + __Pyx_INCREF(__pyx_mstate_global->__pyx_kp_u__6); + __pyx_t_16 = __pyx_mstate_global->__pyx_kp_u__6; + __pyx_t_12 = __Pyx_PyObject_Dict_GetItem(__pyx_t_8, __pyx_t_16); if (unlikely(!__pyx_t_12)) __PYX_ERR(0, 608, __pyx_L1_error) + __Pyx_GOTREF(__pyx_t_12); + __pyx_t_4 = __Pyx_PyLong_AddObjC(__pyx_t_12, __pyx_mstate_global->__pyx_int_1, 1, 1, 0); if (unlikely(!__pyx_t_4)) __PYX_ERR(0, 608, __pyx_L1_error) + __Pyx_GOTREF(__pyx_t_4); + __Pyx_DECREF(__pyx_t_12); __pyx_t_12 = 0; + if (unlikely((PyObject_SetItem(__pyx_t_8, __pyx_t_16, __pyx_t_4) < 0))) __PYX_ERR(0, 608, __pyx_L1_error) + __Pyx_DECREF(__pyx_t_4); __pyx_t_4 = 0; + __Pyx_DECREF(__pyx_t_16); __pyx_t_16 = 0; + __Pyx_DECREF(__pyx_t_8); __pyx_t_8 = 0; + + /* "spacy/pipeline/_parser_internals/arc_eager.pyx":606 + * if head == child: + * actions[BREAK][label] += 1 + * if head < child: # <<<<<<<<<<<<<< + * actions[RIGHT][label] += 1 + * actions[REDUCE][''] += 1 +*/ + goto __pyx_L22; + } + + /* "spacy/pipeline/_parser_internals/arc_eager.pyx":609 + * actions[RIGHT][label] += 1 + * actions[REDUCE][''] += 1 + * elif head > child: # <<<<<<<<<<<<<< + * actions[LEFT][label] += 1 + * actions[SHIFT][''] += 1 +*/ + __pyx_t_8 = PyObject_RichCompare(__pyx_v_head, __pyx_v_child, Py_GT); __Pyx_XGOTREF(__pyx_t_8); if (unlikely(!__pyx_t_8)) __PYX_ERR(0, 609, __pyx_L1_error) + __pyx_t_14 = __Pyx_PyObject_IsTrue(__pyx_t_8); if (unlikely((__pyx_t_14 < 0))) __PYX_ERR(0, 609, __pyx_L1_error) + __Pyx_DECREF(__pyx_t_8); __pyx_t_8 = 0; + if (__pyx_t_14) { + + /* "spacy/pipeline/_parser_internals/arc_eager.pyx":610 + * actions[REDUCE][''] += 1 + * elif head > child: + * actions[LEFT][label] += 1 # <<<<<<<<<<<<<< + * actions[SHIFT][''] += 1 + * if min_freq is not None: +*/ + __pyx_t_8 = __Pyx_GetItemInt(__pyx_v_actions, __pyx_e_5spacy_8pipeline_17_parser_internals_9arc_eager_LEFT, int, 1, __Pyx_PyLong_From___pyx_anon_enum, 0, 1, 1, 1, __Pyx_ReferenceSharing_OwnStrongReference); if (unlikely(!__pyx_t_8)) __PYX_ERR(0, 610, __pyx_L1_error) + __Pyx_GOTREF(__pyx_t_8); + __Pyx_INCREF(__pyx_v_label); + __pyx_t_4 = __pyx_v_label; + __pyx_t_12 = __Pyx_PyObject_GetItem(__pyx_t_8, __pyx_t_4); if (unlikely(!__pyx_t_12)) __PYX_ERR(0, 610, __pyx_L1_error) + __Pyx_GOTREF(__pyx_t_12); + __pyx_t_13 = __Pyx_PyLong_AddObjC(__pyx_t_12, __pyx_mstate_global->__pyx_int_1, 1, 1, 0); if (unlikely(!__pyx_t_13)) __PYX_ERR(0, 610, __pyx_L1_error) + __Pyx_GOTREF(__pyx_t_13); + __Pyx_DECREF(__pyx_t_12); __pyx_t_12 = 0; + if (unlikely((PyObject_SetItem(__pyx_t_8, __pyx_t_4, __pyx_t_13) < 0))) __PYX_ERR(0, 610, __pyx_L1_error) + __Pyx_DECREF(__pyx_t_13); __pyx_t_13 = 0; + __Pyx_DECREF(__pyx_t_4); __pyx_t_4 = 0; + __Pyx_DECREF(__pyx_t_8); __pyx_t_8 = 0; + + /* "spacy/pipeline/_parser_internals/arc_eager.pyx":611 + * elif head > child: + * actions[LEFT][label] += 1 + * actions[SHIFT][''] += 1 # <<<<<<<<<<<<<< + * if min_freq is not None: + * for action, label_freqs in actions.items(): +*/ + __pyx_t_8 = __Pyx_GetItemInt(__pyx_v_actions, __pyx_e_5spacy_8pipeline_17_parser_internals_9arc_eager_SHIFT, int, 1, __Pyx_PyLong_From___pyx_anon_enum, 0, 1, 1, 1, __Pyx_ReferenceSharing_OwnStrongReference); if (unlikely(!__pyx_t_8)) __PYX_ERR(0, 611, __pyx_L1_error) + __Pyx_GOTREF(__pyx_t_8); + __Pyx_INCREF(__pyx_mstate_global->__pyx_kp_u__6); + __pyx_t_16 = __pyx_mstate_global->__pyx_kp_u__6; + __pyx_t_4 = __Pyx_PyObject_Dict_GetItem(__pyx_t_8, __pyx_t_16); if (unlikely(!__pyx_t_4)) __PYX_ERR(0, 611, __pyx_L1_error) + __Pyx_GOTREF(__pyx_t_4); + __pyx_t_13 = __Pyx_PyLong_AddObjC(__pyx_t_4, __pyx_mstate_global->__pyx_int_1, 1, 1, 0); if (unlikely(!__pyx_t_13)) __PYX_ERR(0, 611, __pyx_L1_error) + __Pyx_GOTREF(__pyx_t_13); + __Pyx_DECREF(__pyx_t_4); __pyx_t_4 = 0; + if (unlikely((PyObject_SetItem(__pyx_t_8, __pyx_t_16, __pyx_t_13) < 0))) __PYX_ERR(0, 611, __pyx_L1_error) + __Pyx_DECREF(__pyx_t_13); __pyx_t_13 = 0; + __Pyx_DECREF(__pyx_t_16); __pyx_t_16 = 0; + __Pyx_DECREF(__pyx_t_8); __pyx_t_8 = 0; + + /* "spacy/pipeline/_parser_internals/arc_eager.pyx":609 + * actions[RIGHT][label] += 1 + * actions[REDUCE][''] += 1 + * elif head > child: # <<<<<<<<<<<<<< + * actions[LEFT][label] += 1 + * actions[SHIFT][''] += 1 +*/ + } + __pyx_L22:; + + /* "spacy/pipeline/_parser_internals/arc_eager.pyx":599 + * example_gold_preproc = Example(example.reference, example.reference) + * heads, labels = example_gold_preproc.get_aligned_parse(projectivize=True) + * for child, (head, label) in enumerate(zip(heads, labels)): # <<<<<<<<<<<<<< + * if head is None or label is None: + * continue +*/ + __pyx_L13_continue:; + } + __Pyx_DECREF(__pyx_t_2); __pyx_t_2 = 0; + __Pyx_DECREF(__pyx_t_3); __pyx_t_3 = 0; + + /* "spacy/pipeline/_parser_internals/arc_eager.pyx":594 + * actions[RIGHT][label] = 1 + * actions[REDUCE][label] = 1 + * for example in kwargs.get('examples', []): # <<<<<<<<<<<<<< + * # use heads and labels from the reference parse (without regard to + * # misalignments between the predicted and reference) +*/ + } + __Pyx_DECREF(__pyx_t_1); __pyx_t_1 = 0; + + /* "spacy/pipeline/_parser_internals/arc_eager.pyx":612 + * actions[LEFT][label] += 1 + * actions[SHIFT][''] += 1 + * if min_freq is not None: # <<<<<<<<<<<<<< + * for action, label_freqs in actions.items(): + * for label, freq in label_freqs.copy().items(): +*/ + __pyx_t_14 = (__pyx_v_min_freq != Py_None); + if (__pyx_t_14) { + + /* "spacy/pipeline/_parser_internals/arc_eager.pyx":613 + * actions[SHIFT][''] += 1 + * if min_freq is not None: + * for action, label_freqs in actions.items(): # <<<<<<<<<<<<<< + * for label, freq in label_freqs.copy().items(): + * if freq < min_freq: +*/ + __pyx_t_3 = __pyx_v_actions; + __Pyx_INCREF(__pyx_t_3); + __pyx_t_5 = 0; + { + PyObject *__pyx_callargs[2] = {__pyx_t_3, NULL}; + __pyx_t_1 = __Pyx_PyObject_FastCallMethod((PyObject*)__pyx_mstate_global->__pyx_n_u_items, __pyx_callargs+__pyx_t_5, (1-__pyx_t_5) | (1*__Pyx_PY_VECTORCALL_ARGUMENTS_OFFSET)); + __Pyx_XDECREF(__pyx_t_3); __pyx_t_3 = 0; + if (unlikely(!__pyx_t_1)) __PYX_ERR(0, 613, __pyx_L1_error) + __Pyx_GOTREF(__pyx_t_1); + } + if (likely(PyList_CheckExact(__pyx_t_1)) || PyTuple_CheckExact(__pyx_t_1)) { + __pyx_t_3 = __pyx_t_1; __Pyx_INCREF(__pyx_t_3); + __pyx_t_6 = 0; + __pyx_t_7 = NULL; + } else { + __pyx_t_6 = -1; __pyx_t_3 = PyObject_GetIter(__pyx_t_1); if (unlikely(!__pyx_t_3)) __PYX_ERR(0, 613, __pyx_L1_error) + __Pyx_GOTREF(__pyx_t_3); + __pyx_t_7 = (CYTHON_COMPILING_IN_LIMITED_API) ? PyIter_Next : __Pyx_PyObject_GetIterNextFunc(__pyx_t_3); if (unlikely(!__pyx_t_7)) __PYX_ERR(0, 613, __pyx_L1_error) + } + __Pyx_DECREF(__pyx_t_1); __pyx_t_1 = 0; + for (;;) { + if (likely(!__pyx_t_7)) { + 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, 613, __pyx_L1_error) + #endif + if (__pyx_t_6 >= __pyx_temp) break; + } + __pyx_t_1 = __Pyx_PyList_GetItemRefFast(__pyx_t_3, __pyx_t_6, __Pyx_ReferenceSharing_OwnStrongReference); + ++__pyx_t_6; + } 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, 613, __pyx_L1_error) + #endif + if (__pyx_t_6 >= __pyx_temp) break; + } + #if CYTHON_ASSUME_SAFE_MACROS && !CYTHON_AVOID_BORROWED_REFS + __pyx_t_1 = __Pyx_NewRef(PyTuple_GET_ITEM(__pyx_t_3, __pyx_t_6)); + #else + __pyx_t_1 = __Pyx_PySequence_ITEM(__pyx_t_3, __pyx_t_6); + #endif + ++__pyx_t_6; + } + if (unlikely(!__pyx_t_1)) __PYX_ERR(0, 613, __pyx_L1_error) + } else { + __pyx_t_1 = __pyx_t_7(__pyx_t_3); + if (unlikely(!__pyx_t_1)) { + PyObject* exc_type = PyErr_Occurred(); + if (exc_type) { + if (unlikely(!__Pyx_PyErr_GivenExceptionMatches(exc_type, PyExc_StopIteration))) __PYX_ERR(0, 613, __pyx_L1_error) + PyErr_Clear(); + } + break; + } + } + __Pyx_GOTREF(__pyx_t_1); + if ((likely(PyTuple_CheckExact(__pyx_t_1))) || (PyList_CheckExact(__pyx_t_1))) { + PyObject* sequence = __pyx_t_1; + 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, 613, __pyx_L1_error) + } + #if CYTHON_ASSUME_SAFE_MACROS && !CYTHON_AVOID_BORROWED_REFS + if (likely(PyTuple_CheckExact(sequence))) { + __pyx_t_2 = PyTuple_GET_ITEM(sequence, 0); + __Pyx_INCREF(__pyx_t_2); + __pyx_t_8 = PyTuple_GET_ITEM(sequence, 1); + __Pyx_INCREF(__pyx_t_8); + } else { + __pyx_t_2 = __Pyx_PyList_GetItemRefFast(sequence, 0, __Pyx_ReferenceSharing_SharedReference); + if (unlikely(!__pyx_t_2)) __PYX_ERR(0, 613, __pyx_L1_error) + __Pyx_XGOTREF(__pyx_t_2); + __pyx_t_8 = __Pyx_PyList_GetItemRefFast(sequence, 1, __Pyx_ReferenceSharing_SharedReference); + if (unlikely(!__pyx_t_8)) __PYX_ERR(0, 613, __pyx_L1_error) + __Pyx_XGOTREF(__pyx_t_8); + } + #else + __pyx_t_2 = __Pyx_PySequence_ITEM(sequence, 0); if (unlikely(!__pyx_t_2)) __PYX_ERR(0, 613, __pyx_L1_error) + __Pyx_GOTREF(__pyx_t_2); + __pyx_t_8 = __Pyx_PySequence_ITEM(sequence, 1); if (unlikely(!__pyx_t_8)) __PYX_ERR(0, 613, __pyx_L1_error) + __Pyx_GOTREF(__pyx_t_8); + #endif + __Pyx_DECREF(__pyx_t_1); __pyx_t_1 = 0; + } else { + Py_ssize_t index = -1; + __pyx_t_13 = PyObject_GetIter(__pyx_t_1); if (unlikely(!__pyx_t_13)) __PYX_ERR(0, 613, __pyx_L1_error) + __Pyx_GOTREF(__pyx_t_13); + __Pyx_DECREF(__pyx_t_1); __pyx_t_1 = 0; + __pyx_t_9 = (CYTHON_COMPILING_IN_LIMITED_API) ? PyIter_Next : __Pyx_PyObject_GetIterNextFunc(__pyx_t_13); + index = 0; __pyx_t_2 = __pyx_t_9(__pyx_t_13); if (unlikely(!__pyx_t_2)) goto __pyx_L28_unpacking_failed; + __Pyx_GOTREF(__pyx_t_2); + index = 1; __pyx_t_8 = __pyx_t_9(__pyx_t_13); if (unlikely(!__pyx_t_8)) goto __pyx_L28_unpacking_failed; + __Pyx_GOTREF(__pyx_t_8); + if (__Pyx_IternextUnpackEndCheck(__pyx_t_9(__pyx_t_13), 2) < (0)) __PYX_ERR(0, 613, __pyx_L1_error) + __pyx_t_9 = NULL; + __Pyx_DECREF(__pyx_t_13); __pyx_t_13 = 0; + goto __pyx_L29_unpacking_done; + __pyx_L28_unpacking_failed:; + __Pyx_DECREF(__pyx_t_13); __pyx_t_13 = 0; + __pyx_t_9 = NULL; + if (__Pyx_IterFinish() == 0) __Pyx_RaiseNeedMoreValuesError(index); + __PYX_ERR(0, 613, __pyx_L1_error) + __pyx_L29_unpacking_done:; + } + __Pyx_XDECREF_SET(__pyx_v_action, __pyx_t_2); + __pyx_t_2 = 0; + __Pyx_XDECREF_SET(__pyx_v_label_freqs, __pyx_t_8); + __pyx_t_8 = 0; + + /* "spacy/pipeline/_parser_internals/arc_eager.pyx":614 + * if min_freq is not None: + * for action, label_freqs in actions.items(): + * for label, freq in label_freqs.copy().items(): # <<<<<<<<<<<<<< + * if freq < min_freq: + * label_freqs.pop(label) +*/ + __pyx_t_13 = __pyx_v_label_freqs; + __Pyx_INCREF(__pyx_t_13); + __pyx_t_5 = 0; + { + PyObject *__pyx_callargs[2] = {__pyx_t_13, NULL}; + __pyx_t_2 = __Pyx_PyObject_FastCallMethod((PyObject*)__pyx_mstate_global->__pyx_n_u_copy, __pyx_callargs+__pyx_t_5, (1-__pyx_t_5) | (1*__Pyx_PY_VECTORCALL_ARGUMENTS_OFFSET)); + __Pyx_XDECREF(__pyx_t_13); __pyx_t_13 = 0; + if (unlikely(!__pyx_t_2)) __PYX_ERR(0, 614, __pyx_L1_error) + __Pyx_GOTREF(__pyx_t_2); + } + __pyx_t_8 = __pyx_t_2; + __Pyx_INCREF(__pyx_t_8); + __pyx_t_5 = 0; + { + PyObject *__pyx_callargs[2] = {__pyx_t_8, NULL}; + __pyx_t_1 = __Pyx_PyObject_FastCallMethod((PyObject*)__pyx_mstate_global->__pyx_n_u_items, __pyx_callargs+__pyx_t_5, (1-__pyx_t_5) | (1*__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_1)) __PYX_ERR(0, 614, __pyx_L1_error) + __Pyx_GOTREF(__pyx_t_1); + } + if (likely(PyList_CheckExact(__pyx_t_1)) || PyTuple_CheckExact(__pyx_t_1)) { + __pyx_t_2 = __pyx_t_1; __Pyx_INCREF(__pyx_t_2); + __pyx_t_10 = 0; + __pyx_t_11 = NULL; + } else { + __pyx_t_10 = -1; __pyx_t_2 = PyObject_GetIter(__pyx_t_1); if (unlikely(!__pyx_t_2)) __PYX_ERR(0, 614, __pyx_L1_error) + __Pyx_GOTREF(__pyx_t_2); + __pyx_t_11 = (CYTHON_COMPILING_IN_LIMITED_API) ? PyIter_Next : __Pyx_PyObject_GetIterNextFunc(__pyx_t_2); if (unlikely(!__pyx_t_11)) __PYX_ERR(0, 614, __pyx_L1_error) + } + __Pyx_DECREF(__pyx_t_1); __pyx_t_1 = 0; + for (;;) { + if (likely(!__pyx_t_11)) { + if (likely(PyList_CheckExact(__pyx_t_2))) { + { + Py_ssize_t __pyx_temp = __Pyx_PyList_GET_SIZE(__pyx_t_2); + #if !CYTHON_ASSUME_SAFE_SIZE + if (unlikely((__pyx_temp < 0))) __PYX_ERR(0, 614, __pyx_L1_error) + #endif + if (__pyx_t_10 >= __pyx_temp) break; + } + __pyx_t_1 = __Pyx_PyList_GetItemRefFast(__pyx_t_2, __pyx_t_10, __Pyx_ReferenceSharing_OwnStrongReference); + ++__pyx_t_10; + } else { + { + Py_ssize_t __pyx_temp = __Pyx_PyTuple_GET_SIZE(__pyx_t_2); + #if !CYTHON_ASSUME_SAFE_SIZE + if (unlikely((__pyx_temp < 0))) __PYX_ERR(0, 614, __pyx_L1_error) + #endif + if (__pyx_t_10 >= __pyx_temp) break; + } + #if CYTHON_ASSUME_SAFE_MACROS && !CYTHON_AVOID_BORROWED_REFS + __pyx_t_1 = __Pyx_NewRef(PyTuple_GET_ITEM(__pyx_t_2, __pyx_t_10)); + #else + __pyx_t_1 = __Pyx_PySequence_ITEM(__pyx_t_2, __pyx_t_10); + #endif + ++__pyx_t_10; + } + if (unlikely(!__pyx_t_1)) __PYX_ERR(0, 614, __pyx_L1_error) + } else { + __pyx_t_1 = __pyx_t_11(__pyx_t_2); + if (unlikely(!__pyx_t_1)) { + PyObject* exc_type = PyErr_Occurred(); + if (exc_type) { + if (unlikely(!__Pyx_PyErr_GivenExceptionMatches(exc_type, PyExc_StopIteration))) __PYX_ERR(0, 614, __pyx_L1_error) + PyErr_Clear(); + } + break; + } + } + __Pyx_GOTREF(__pyx_t_1); + if ((likely(PyTuple_CheckExact(__pyx_t_1))) || (PyList_CheckExact(__pyx_t_1))) { + PyObject* sequence = __pyx_t_1; + 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, 614, __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_13 = PyTuple_GET_ITEM(sequence, 1); + __Pyx_INCREF(__pyx_t_13); + } else { + __pyx_t_8 = __Pyx_PyList_GetItemRefFast(sequence, 0, __Pyx_ReferenceSharing_SharedReference); + if (unlikely(!__pyx_t_8)) __PYX_ERR(0, 614, __pyx_L1_error) + __Pyx_XGOTREF(__pyx_t_8); + __pyx_t_13 = __Pyx_PyList_GetItemRefFast(sequence, 1, __Pyx_ReferenceSharing_SharedReference); + if (unlikely(!__pyx_t_13)) __PYX_ERR(0, 614, __pyx_L1_error) + __Pyx_XGOTREF(__pyx_t_13); + } + #else + __pyx_t_8 = __Pyx_PySequence_ITEM(sequence, 0); if (unlikely(!__pyx_t_8)) __PYX_ERR(0, 614, __pyx_L1_error) + __Pyx_GOTREF(__pyx_t_8); + __pyx_t_13 = __Pyx_PySequence_ITEM(sequence, 1); if (unlikely(!__pyx_t_13)) __PYX_ERR(0, 614, __pyx_L1_error) + __Pyx_GOTREF(__pyx_t_13); + #endif + __Pyx_DECREF(__pyx_t_1); __pyx_t_1 = 0; + } else { + Py_ssize_t index = -1; + __pyx_t_4 = PyObject_GetIter(__pyx_t_1); if (unlikely(!__pyx_t_4)) __PYX_ERR(0, 614, __pyx_L1_error) + __Pyx_GOTREF(__pyx_t_4); + __Pyx_DECREF(__pyx_t_1); __pyx_t_1 = 0; + __pyx_t_9 = (CYTHON_COMPILING_IN_LIMITED_API) ? PyIter_Next : __Pyx_PyObject_GetIterNextFunc(__pyx_t_4); + index = 0; __pyx_t_8 = __pyx_t_9(__pyx_t_4); if (unlikely(!__pyx_t_8)) goto __pyx_L32_unpacking_failed; + __Pyx_GOTREF(__pyx_t_8); + index = 1; __pyx_t_13 = __pyx_t_9(__pyx_t_4); if (unlikely(!__pyx_t_13)) goto __pyx_L32_unpacking_failed; + __Pyx_GOTREF(__pyx_t_13); + if (__Pyx_IternextUnpackEndCheck(__pyx_t_9(__pyx_t_4), 2) < (0)) __PYX_ERR(0, 614, __pyx_L1_error) + __pyx_t_9 = NULL; + __Pyx_DECREF(__pyx_t_4); __pyx_t_4 = 0; + goto __pyx_L33_unpacking_done; + __pyx_L32_unpacking_failed:; + __Pyx_DECREF(__pyx_t_4); __pyx_t_4 = 0; + __pyx_t_9 = NULL; + if (__Pyx_IterFinish() == 0) __Pyx_RaiseNeedMoreValuesError(index); + __PYX_ERR(0, 614, __pyx_L1_error) + __pyx_L33_unpacking_done:; + } + __Pyx_XDECREF_SET(__pyx_v_label, __pyx_t_8); + __pyx_t_8 = 0; + __Pyx_XDECREF_SET(__pyx_v_freq, __pyx_t_13); + __pyx_t_13 = 0; + + /* "spacy/pipeline/_parser_internals/arc_eager.pyx":615 + * for action, label_freqs in actions.items(): + * for label, freq in label_freqs.copy().items(): + * if freq < min_freq: # <<<<<<<<<<<<<< + * label_freqs.pop(label) + * # Ensure these actions are present +*/ + __pyx_t_1 = PyObject_RichCompare(__pyx_v_freq, __pyx_v_min_freq, Py_LT); __Pyx_XGOTREF(__pyx_t_1); if (unlikely(!__pyx_t_1)) __PYX_ERR(0, 615, __pyx_L1_error) + __pyx_t_14 = __Pyx_PyObject_IsTrue(__pyx_t_1); if (unlikely((__pyx_t_14 < 0))) __PYX_ERR(0, 615, __pyx_L1_error) + __Pyx_DECREF(__pyx_t_1); __pyx_t_1 = 0; + if (__pyx_t_14) { + + /* "spacy/pipeline/_parser_internals/arc_eager.pyx":616 + * for label, freq in label_freqs.copy().items(): + * if freq < min_freq: + * label_freqs.pop(label) # <<<<<<<<<<<<<< + * # Ensure these actions are present + * actions[BREAK].setdefault('ROOT', 0) +*/ + __pyx_t_13 = __pyx_v_label_freqs; + __Pyx_INCREF(__pyx_t_13); + __pyx_t_5 = 0; + { + PyObject *__pyx_callargs[2] = {__pyx_t_13, __pyx_v_label}; + __pyx_t_1 = __Pyx_PyObject_FastCallMethod((PyObject*)__pyx_mstate_global->__pyx_n_u_pop, __pyx_callargs+__pyx_t_5, (2-__pyx_t_5) | (1*__Pyx_PY_VECTORCALL_ARGUMENTS_OFFSET)); + __Pyx_XDECREF(__pyx_t_13); __pyx_t_13 = 0; + if (unlikely(!__pyx_t_1)) __PYX_ERR(0, 616, __pyx_L1_error) + __Pyx_GOTREF(__pyx_t_1); + } + __Pyx_DECREF(__pyx_t_1); __pyx_t_1 = 0; + + /* "spacy/pipeline/_parser_internals/arc_eager.pyx":615 + * for action, label_freqs in actions.items(): + * for label, freq in label_freqs.copy().items(): + * if freq < min_freq: # <<<<<<<<<<<<<< + * label_freqs.pop(label) + * # Ensure these actions are present +*/ + } + + /* "spacy/pipeline/_parser_internals/arc_eager.pyx":614 + * if min_freq is not None: + * for action, label_freqs in actions.items(): + * for label, freq in label_freqs.copy().items(): # <<<<<<<<<<<<<< + * if freq < min_freq: + * label_freqs.pop(label) +*/ + } + __Pyx_DECREF(__pyx_t_2); __pyx_t_2 = 0; + + /* "spacy/pipeline/_parser_internals/arc_eager.pyx":613 + * actions[SHIFT][''] += 1 + * if min_freq is not None: + * for action, label_freqs in actions.items(): # <<<<<<<<<<<<<< + * for label, freq in label_freqs.copy().items(): + * if freq < min_freq: +*/ + } + __Pyx_DECREF(__pyx_t_3); __pyx_t_3 = 0; + + /* "spacy/pipeline/_parser_internals/arc_eager.pyx":612 + * actions[LEFT][label] += 1 + * actions[SHIFT][''] += 1 + * if min_freq is not None: # <<<<<<<<<<<<<< + * for action, label_freqs in actions.items(): + * for label, freq in label_freqs.copy().items(): +*/ + } + + /* "spacy/pipeline/_parser_internals/arc_eager.pyx":618 + * label_freqs.pop(label) + * # Ensure these actions are present + * actions[BREAK].setdefault('ROOT', 0) # <<<<<<<<<<<<<< + * if kwargs.get("learn_tokens") is True: + * actions[RIGHT].setdefault('subtok', 0) +*/ + __pyx_t_3 = __Pyx_GetItemInt(__pyx_v_actions, __pyx_e_5spacy_8pipeline_17_parser_internals_9arc_eager_BREAK, int, 1, __Pyx_PyLong_From___pyx_anon_enum, 0, 1, 1, 1, __Pyx_ReferenceSharing_OwnStrongReference); if (unlikely(!__pyx_t_3)) __PYX_ERR(0, 618, __pyx_L1_error) + __Pyx_GOTREF(__pyx_t_3); + __pyx_t_2 = __Pyx_PyObject_GetAttrStr(__pyx_t_3, __pyx_mstate_global->__pyx_n_u_setdefault); if (unlikely(!__pyx_t_2)) __PYX_ERR(0, 618, __pyx_L1_error) + __Pyx_GOTREF(__pyx_t_2); + __Pyx_DECREF(__pyx_t_3); __pyx_t_3 = 0; + __pyx_t_3 = __Pyx_PyObject_Call(__pyx_t_2, __pyx_mstate_global->__pyx_tuple[3], NULL); if (unlikely(!__pyx_t_3)) __PYX_ERR(0, 618, __pyx_L1_error) + __Pyx_GOTREF(__pyx_t_3); + __Pyx_DECREF(__pyx_t_2); __pyx_t_2 = 0; + __Pyx_DECREF(__pyx_t_3); __pyx_t_3 = 0; + + /* "spacy/pipeline/_parser_internals/arc_eager.pyx":619 + * # Ensure these actions are present + * actions[BREAK].setdefault('ROOT', 0) + * if kwargs.get("learn_tokens") is True: # <<<<<<<<<<<<<< + * actions[RIGHT].setdefault('subtok', 0) + * actions[LEFT].setdefault('subtok', 0) +*/ + __pyx_t_3 = __Pyx_PyDict_GetItemDefault(__pyx_v_kwargs, __pyx_mstate_global->__pyx_n_u_learn_tokens, Py_None); if (unlikely(!__pyx_t_3)) __PYX_ERR(0, 619, __pyx_L1_error) + __Pyx_GOTREF(__pyx_t_3); + __pyx_t_14 = (__pyx_t_3 == Py_True); + __Pyx_DECREF(__pyx_t_3); __pyx_t_3 = 0; + if (__pyx_t_14) { + + /* "spacy/pipeline/_parser_internals/arc_eager.pyx":620 + * actions[BREAK].setdefault('ROOT', 0) + * if kwargs.get("learn_tokens") is True: + * actions[RIGHT].setdefault('subtok', 0) # <<<<<<<<<<<<<< + * actions[LEFT].setdefault('subtok', 0) + * # Used for backoff +*/ + __pyx_t_3 = __Pyx_GetItemInt(__pyx_v_actions, __pyx_e_5spacy_8pipeline_17_parser_internals_9arc_eager_RIGHT, int, 1, __Pyx_PyLong_From___pyx_anon_enum, 0, 1, 1, 1, __Pyx_ReferenceSharing_OwnStrongReference); if (unlikely(!__pyx_t_3)) __PYX_ERR(0, 620, __pyx_L1_error) + __Pyx_GOTREF(__pyx_t_3); + __pyx_t_2 = __Pyx_PyObject_GetAttrStr(__pyx_t_3, __pyx_mstate_global->__pyx_n_u_setdefault); if (unlikely(!__pyx_t_2)) __PYX_ERR(0, 620, __pyx_L1_error) + __Pyx_GOTREF(__pyx_t_2); + __Pyx_DECREF(__pyx_t_3); __pyx_t_3 = 0; + __pyx_t_3 = __Pyx_PyObject_Call(__pyx_t_2, __pyx_mstate_global->__pyx_tuple[4], NULL); if (unlikely(!__pyx_t_3)) __PYX_ERR(0, 620, __pyx_L1_error) + __Pyx_GOTREF(__pyx_t_3); + __Pyx_DECREF(__pyx_t_2); __pyx_t_2 = 0; + __Pyx_DECREF(__pyx_t_3); __pyx_t_3 = 0; + + /* "spacy/pipeline/_parser_internals/arc_eager.pyx":621 + * if kwargs.get("learn_tokens") is True: + * actions[RIGHT].setdefault('subtok', 0) + * actions[LEFT].setdefault('subtok', 0) # <<<<<<<<<<<<<< + * # Used for backoff + * actions[RIGHT].setdefault('dep', 0) +*/ + __pyx_t_3 = __Pyx_GetItemInt(__pyx_v_actions, __pyx_e_5spacy_8pipeline_17_parser_internals_9arc_eager_LEFT, int, 1, __Pyx_PyLong_From___pyx_anon_enum, 0, 1, 1, 1, __Pyx_ReferenceSharing_OwnStrongReference); if (unlikely(!__pyx_t_3)) __PYX_ERR(0, 621, __pyx_L1_error) + __Pyx_GOTREF(__pyx_t_3); + __pyx_t_2 = __Pyx_PyObject_GetAttrStr(__pyx_t_3, __pyx_mstate_global->__pyx_n_u_setdefault); if (unlikely(!__pyx_t_2)) __PYX_ERR(0, 621, __pyx_L1_error) + __Pyx_GOTREF(__pyx_t_2); + __Pyx_DECREF(__pyx_t_3); __pyx_t_3 = 0; + __pyx_t_3 = __Pyx_PyObject_Call(__pyx_t_2, __pyx_mstate_global->__pyx_tuple[4], NULL); if (unlikely(!__pyx_t_3)) __PYX_ERR(0, 621, __pyx_L1_error) + __Pyx_GOTREF(__pyx_t_3); + __Pyx_DECREF(__pyx_t_2); __pyx_t_2 = 0; + __Pyx_DECREF(__pyx_t_3); __pyx_t_3 = 0; + + /* "spacy/pipeline/_parser_internals/arc_eager.pyx":619 + * # Ensure these actions are present + * actions[BREAK].setdefault('ROOT', 0) + * if kwargs.get("learn_tokens") is True: # <<<<<<<<<<<<<< + * actions[RIGHT].setdefault('subtok', 0) + * actions[LEFT].setdefault('subtok', 0) +*/ + } + + /* "spacy/pipeline/_parser_internals/arc_eager.pyx":623 + * actions[LEFT].setdefault('subtok', 0) + * # Used for backoff + * actions[RIGHT].setdefault('dep', 0) # <<<<<<<<<<<<<< + * actions[LEFT].setdefault('dep', 0) + * return actions +*/ + __pyx_t_3 = __Pyx_GetItemInt(__pyx_v_actions, __pyx_e_5spacy_8pipeline_17_parser_internals_9arc_eager_RIGHT, int, 1, __Pyx_PyLong_From___pyx_anon_enum, 0, 1, 1, 1, __Pyx_ReferenceSharing_OwnStrongReference); if (unlikely(!__pyx_t_3)) __PYX_ERR(0, 623, __pyx_L1_error) + __Pyx_GOTREF(__pyx_t_3); + __pyx_t_2 = __Pyx_PyObject_GetAttrStr(__pyx_t_3, __pyx_mstate_global->__pyx_n_u_setdefault); if (unlikely(!__pyx_t_2)) __PYX_ERR(0, 623, __pyx_L1_error) + __Pyx_GOTREF(__pyx_t_2); + __Pyx_DECREF(__pyx_t_3); __pyx_t_3 = 0; + __pyx_t_3 = __Pyx_PyObject_Call(__pyx_t_2, __pyx_mstate_global->__pyx_tuple[5], NULL); if (unlikely(!__pyx_t_3)) __PYX_ERR(0, 623, __pyx_L1_error) + __Pyx_GOTREF(__pyx_t_3); + __Pyx_DECREF(__pyx_t_2); __pyx_t_2 = 0; + __Pyx_DECREF(__pyx_t_3); __pyx_t_3 = 0; + + /* "spacy/pipeline/_parser_internals/arc_eager.pyx":624 + * # Used for backoff + * actions[RIGHT].setdefault('dep', 0) + * actions[LEFT].setdefault('dep', 0) # <<<<<<<<<<<<<< + * return actions + * +*/ + __pyx_t_3 = __Pyx_GetItemInt(__pyx_v_actions, __pyx_e_5spacy_8pipeline_17_parser_internals_9arc_eager_LEFT, int, 1, __Pyx_PyLong_From___pyx_anon_enum, 0, 1, 1, 1, __Pyx_ReferenceSharing_OwnStrongReference); if (unlikely(!__pyx_t_3)) __PYX_ERR(0, 624, __pyx_L1_error) + __Pyx_GOTREF(__pyx_t_3); + __pyx_t_2 = __Pyx_PyObject_GetAttrStr(__pyx_t_3, __pyx_mstate_global->__pyx_n_u_setdefault); if (unlikely(!__pyx_t_2)) __PYX_ERR(0, 624, __pyx_L1_error) + __Pyx_GOTREF(__pyx_t_2); + __Pyx_DECREF(__pyx_t_3); __pyx_t_3 = 0; + __pyx_t_3 = __Pyx_PyObject_Call(__pyx_t_2, __pyx_mstate_global->__pyx_tuple[5], NULL); if (unlikely(!__pyx_t_3)) __PYX_ERR(0, 624, __pyx_L1_error) + __Pyx_GOTREF(__pyx_t_3); + __Pyx_DECREF(__pyx_t_2); __pyx_t_2 = 0; + __Pyx_DECREF(__pyx_t_3); __pyx_t_3 = 0; + + /* "spacy/pipeline/_parser_internals/arc_eager.pyx":625 + * actions[RIGHT].setdefault('dep', 0) + * actions[LEFT].setdefault('dep', 0) + * return actions # <<<<<<<<<<<<<< + * + * @property +*/ + __Pyx_XDECREF(__pyx_r); + __Pyx_INCREF(__pyx_v_actions); + __pyx_r = __pyx_v_actions; + goto __pyx_L0; + + /* "spacy/pipeline/_parser_internals/arc_eager.pyx":582 + * self.del_beam_state = _del_state + * + * @classmethod # <<<<<<<<<<<<<< + * def get_actions(cls, **kwargs): + * min_freq = kwargs.get('min_freq', None) +*/ + + /* function exit code */ + __pyx_L1_error:; + __Pyx_XDECREF(__pyx_t_1); + __Pyx_XDECREF(__pyx_t_2); + __Pyx_XDECREF(__pyx_t_3); + __Pyx_XDECREF(__pyx_t_4); + __Pyx_XDECREF(__pyx_t_8); + __Pyx_XDECREF(__pyx_t_12); + __Pyx_XDECREF(__pyx_t_13); + __Pyx_XDECREF(__pyx_t_16); + __Pyx_AddTraceback("spacy.pipeline._parser_internals.arc_eager.ArcEager.get_actions", __pyx_clineno, __pyx_lineno, __pyx_filename); + __pyx_r = NULL; + __pyx_L0:; + __Pyx_XDECREF(__pyx_v_min_freq); + __Pyx_XDECREF(__pyx_v_actions); + __Pyx_XDECREF(__pyx_v_label); + __Pyx_XDECREF(__pyx_v_example); + __Pyx_XDECREF((PyObject *)__pyx_v_example_gold_preproc); + __Pyx_XDECREF(__pyx_v_heads); + __Pyx_XDECREF(__pyx_v_labels); + __Pyx_XDECREF(__pyx_v_child); + __Pyx_XDECREF(__pyx_v_head); + __Pyx_XDECREF(__pyx_v_action); + __Pyx_XDECREF(__pyx_v_label_freqs); + __Pyx_XDECREF(__pyx_v_freq); + __Pyx_XGIVEREF(__pyx_r); + __Pyx_RefNannyFinishContext(); + return __pyx_r; +} + +/* "spacy/pipeline/_parser_internals/arc_eager.pyx":627 + * return actions + * + * @property # <<<<<<<<<<<<<< + * def builtin_labels(self): + * return ["ROOT", "dep"] +*/ + +/* Python wrapper */ +static PyObject *__pyx_pw_5spacy_8pipeline_17_parser_internals_9arc_eager_8ArcEager_14builtin_labels_1__get__(PyObject *__pyx_v_self); /*proto*/ +static PyObject *__pyx_pw_5spacy_8pipeline_17_parser_internals_9arc_eager_8ArcEager_14builtin_labels_1__get__(PyObject *__pyx_v_self) { + CYTHON_UNUSED PyObject *const *__pyx_kwvalues; + PyObject *__pyx_r = 0; + __Pyx_RefNannyDeclarations + __Pyx_RefNannySetupContext("__get__ (wrapper)", 0); + __pyx_kwvalues = __Pyx_KwValues_VARARGS(__pyx_args, __pyx_nargs); + __pyx_r = __pyx_pf_5spacy_8pipeline_17_parser_internals_9arc_eager_8ArcEager_14builtin_labels___get__(((struct __pyx_obj_5spacy_8pipeline_17_parser_internals_9arc_eager_ArcEager *)__pyx_v_self)); + + /* function exit code */ + __Pyx_RefNannyFinishContext(); + return __pyx_r; +} + +static PyObject *__pyx_pf_5spacy_8pipeline_17_parser_internals_9arc_eager_8ArcEager_14builtin_labels___get__(CYTHON_UNUSED struct __pyx_obj_5spacy_8pipeline_17_parser_internals_9arc_eager_ArcEager *__pyx_v_self) { + PyObject *__pyx_r = NULL; + __Pyx_RefNannyDeclarations + PyObject *__pyx_t_1 = NULL; + int __pyx_lineno = 0; + const char *__pyx_filename = NULL; + int __pyx_clineno = 0; + __Pyx_RefNannySetupContext("__get__", 0); + + /* "spacy/pipeline/_parser_internals/arc_eager.pyx":629 + * @property + * def builtin_labels(self): + * return ["ROOT", "dep"] # <<<<<<<<<<<<<< + * + * @property +*/ + __Pyx_XDECREF(__pyx_r); + __pyx_t_1 = PyList_New(2); if (unlikely(!__pyx_t_1)) __PYX_ERR(0, 629, __pyx_L1_error) + __Pyx_GOTREF(__pyx_t_1); + __Pyx_INCREF(__pyx_mstate_global->__pyx_n_u_ROOT); + __Pyx_GIVEREF(__pyx_mstate_global->__pyx_n_u_ROOT); + if (__Pyx_PyList_SET_ITEM(__pyx_t_1, 0, __pyx_mstate_global->__pyx_n_u_ROOT) != (0)) __PYX_ERR(0, 629, __pyx_L1_error); + __Pyx_INCREF(__pyx_mstate_global->__pyx_n_u_dep); + __Pyx_GIVEREF(__pyx_mstate_global->__pyx_n_u_dep); + if (__Pyx_PyList_SET_ITEM(__pyx_t_1, 1, __pyx_mstate_global->__pyx_n_u_dep) != (0)) __PYX_ERR(0, 629, __pyx_L1_error); + __pyx_r = __pyx_t_1; + __pyx_t_1 = 0; + goto __pyx_L0; + + /* "spacy/pipeline/_parser_internals/arc_eager.pyx":627 + * return actions + * + * @property # <<<<<<<<<<<<<< + * def builtin_labels(self): + * return ["ROOT", "dep"] +*/ + + /* function exit code */ + __pyx_L1_error:; + __Pyx_XDECREF(__pyx_t_1); + __Pyx_AddTraceback("spacy.pipeline._parser_internals.arc_eager.ArcEager.builtin_labels.__get__", __pyx_clineno, __pyx_lineno, __pyx_filename); + __pyx_r = NULL; + __pyx_L0:; + __Pyx_XGIVEREF(__pyx_r); + __Pyx_RefNannyFinishContext(); + return __pyx_r; +} + +/* "spacy/pipeline/_parser_internals/arc_eager.pyx":631 + * return ["ROOT", "dep"] + * + * @property # <<<<<<<<<<<<<< + * def action_types(self): + * return (SHIFT, REDUCE, LEFT, RIGHT, BREAK) +*/ + +/* Python wrapper */ +static PyObject *__pyx_pw_5spacy_8pipeline_17_parser_internals_9arc_eager_8ArcEager_12action_types_1__get__(PyObject *__pyx_v_self); /*proto*/ +static PyObject *__pyx_pw_5spacy_8pipeline_17_parser_internals_9arc_eager_8ArcEager_12action_types_1__get__(PyObject *__pyx_v_self) { + CYTHON_UNUSED PyObject *const *__pyx_kwvalues; + PyObject *__pyx_r = 0; + __Pyx_RefNannyDeclarations + __Pyx_RefNannySetupContext("__get__ (wrapper)", 0); + __pyx_kwvalues = __Pyx_KwValues_VARARGS(__pyx_args, __pyx_nargs); + __pyx_r = __pyx_pf_5spacy_8pipeline_17_parser_internals_9arc_eager_8ArcEager_12action_types___get__(((struct __pyx_obj_5spacy_8pipeline_17_parser_internals_9arc_eager_ArcEager *)__pyx_v_self)); + + /* function exit code */ + __Pyx_RefNannyFinishContext(); + return __pyx_r; +} + +static PyObject *__pyx_pf_5spacy_8pipeline_17_parser_internals_9arc_eager_8ArcEager_12action_types___get__(CYTHON_UNUSED struct __pyx_obj_5spacy_8pipeline_17_parser_internals_9arc_eager_ArcEager *__pyx_v_self) { + PyObject *__pyx_r = NULL; + __Pyx_RefNannyDeclarations + PyObject *__pyx_t_1 = NULL; + PyObject *__pyx_t_2 = NULL; + PyObject *__pyx_t_3 = NULL; + PyObject *__pyx_t_4 = NULL; + PyObject *__pyx_t_5 = NULL; + PyObject *__pyx_t_6 = NULL; + int __pyx_lineno = 0; + const char *__pyx_filename = NULL; + int __pyx_clineno = 0; + __Pyx_RefNannySetupContext("__get__", 0); + + /* "spacy/pipeline/_parser_internals/arc_eager.pyx":633 + * @property + * def action_types(self): + * return (SHIFT, REDUCE, LEFT, RIGHT, BREAK) # <<<<<<<<<<<<<< + * + * def get_doc_labels(self, doc): +*/ + __Pyx_XDECREF(__pyx_r); + __pyx_t_1 = __Pyx_PyLong_From___pyx_anon_enum(__pyx_e_5spacy_8pipeline_17_parser_internals_9arc_eager_SHIFT); if (unlikely(!__pyx_t_1)) __PYX_ERR(0, 633, __pyx_L1_error) + __Pyx_GOTREF(__pyx_t_1); + __pyx_t_2 = __Pyx_PyLong_From___pyx_anon_enum(__pyx_e_5spacy_8pipeline_17_parser_internals_9arc_eager_REDUCE); if (unlikely(!__pyx_t_2)) __PYX_ERR(0, 633, __pyx_L1_error) + __Pyx_GOTREF(__pyx_t_2); + __pyx_t_3 = __Pyx_PyLong_From___pyx_anon_enum(__pyx_e_5spacy_8pipeline_17_parser_internals_9arc_eager_LEFT); if (unlikely(!__pyx_t_3)) __PYX_ERR(0, 633, __pyx_L1_error) + __Pyx_GOTREF(__pyx_t_3); + __pyx_t_4 = __Pyx_PyLong_From___pyx_anon_enum(__pyx_e_5spacy_8pipeline_17_parser_internals_9arc_eager_RIGHT); if (unlikely(!__pyx_t_4)) __PYX_ERR(0, 633, __pyx_L1_error) + __Pyx_GOTREF(__pyx_t_4); + __pyx_t_5 = __Pyx_PyLong_From___pyx_anon_enum(__pyx_e_5spacy_8pipeline_17_parser_internals_9arc_eager_BREAK); if (unlikely(!__pyx_t_5)) __PYX_ERR(0, 633, __pyx_L1_error) + __Pyx_GOTREF(__pyx_t_5); + __pyx_t_6 = PyTuple_New(5); if (unlikely(!__pyx_t_6)) __PYX_ERR(0, 633, __pyx_L1_error) + __Pyx_GOTREF(__pyx_t_6); + __Pyx_GIVEREF(__pyx_t_1); + if (__Pyx_PyTuple_SET_ITEM(__pyx_t_6, 0, __pyx_t_1) != (0)) __PYX_ERR(0, 633, __pyx_L1_error); + __Pyx_GIVEREF(__pyx_t_2); + if (__Pyx_PyTuple_SET_ITEM(__pyx_t_6, 1, __pyx_t_2) != (0)) __PYX_ERR(0, 633, __pyx_L1_error); + __Pyx_GIVEREF(__pyx_t_3); + if (__Pyx_PyTuple_SET_ITEM(__pyx_t_6, 2, __pyx_t_3) != (0)) __PYX_ERR(0, 633, __pyx_L1_error); + __Pyx_GIVEREF(__pyx_t_4); + if (__Pyx_PyTuple_SET_ITEM(__pyx_t_6, 3, __pyx_t_4) != (0)) __PYX_ERR(0, 633, __pyx_L1_error); + __Pyx_GIVEREF(__pyx_t_5); + if (__Pyx_PyTuple_SET_ITEM(__pyx_t_6, 4, __pyx_t_5) != (0)) __PYX_ERR(0, 633, __pyx_L1_error); + __pyx_t_1 = 0; + __pyx_t_2 = 0; + __pyx_t_3 = 0; + __pyx_t_4 = 0; + __pyx_t_5 = 0; + __pyx_r = __pyx_t_6; + __pyx_t_6 = 0; + goto __pyx_L0; + + /* "spacy/pipeline/_parser_internals/arc_eager.pyx":631 + * return ["ROOT", "dep"] + * + * @property # <<<<<<<<<<<<<< + * def action_types(self): + * return (SHIFT, REDUCE, LEFT, RIGHT, BREAK) +*/ + + /* function exit code */ + __pyx_L1_error:; + __Pyx_XDECREF(__pyx_t_1); + __Pyx_XDECREF(__pyx_t_2); + __Pyx_XDECREF(__pyx_t_3); + __Pyx_XDECREF(__pyx_t_4); + __Pyx_XDECREF(__pyx_t_5); + __Pyx_XDECREF(__pyx_t_6); + __Pyx_AddTraceback("spacy.pipeline._parser_internals.arc_eager.ArcEager.action_types.__get__", __pyx_clineno, __pyx_lineno, __pyx_filename); + __pyx_r = NULL; + __pyx_L0:; + __Pyx_XGIVEREF(__pyx_r); + __Pyx_RefNannyFinishContext(); + return __pyx_r; +} + +/* "spacy/pipeline/_parser_internals/arc_eager.pyx":635 + * return (SHIFT, REDUCE, LEFT, RIGHT, BREAK) + * + * def get_doc_labels(self, doc): # <<<<<<<<<<<<<< + * """Get the labels required for a given Doc.""" + * labels = set(self.builtin_labels) +*/ + +/* Python wrapper */ +static PyObject *__pyx_pw_5spacy_8pipeline_17_parser_internals_9arc_eager_8ArcEager_5get_doc_labels(PyObject *__pyx_v_self, +#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_5spacy_8pipeline_17_parser_internals_9arc_eager_8ArcEager_4get_doc_labels, "ArcEager.get_doc_labels(self, doc)\n\nGet the labels required for a given Doc."); +static PyMethodDef __pyx_mdef_5spacy_8pipeline_17_parser_internals_9arc_eager_8ArcEager_5get_doc_labels = {"get_doc_labels", (PyCFunction)(void(*)(void))(__Pyx_PyCFunction_FastCallWithKeywords)__pyx_pw_5spacy_8pipeline_17_parser_internals_9arc_eager_8ArcEager_5get_doc_labels, __Pyx_METH_FASTCALL|METH_KEYWORDS, __pyx_doc_5spacy_8pipeline_17_parser_internals_9arc_eager_8ArcEager_4get_doc_labels}; +static PyObject *__pyx_pw_5spacy_8pipeline_17_parser_internals_9arc_eager_8ArcEager_5get_doc_labels(PyObject *__pyx_v_self, +#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_doc = 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("get_doc_labels (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_doc,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, 635, __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, 635, __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, "get_doc_labels", 0) < (0)) __PYX_ERR(0, 635, __pyx_L3_error) + for (Py_ssize_t i = __pyx_nargs; i < 1; i++) { + if (unlikely(!values[i])) { __Pyx_RaiseArgtupleInvalid("get_doc_labels", 1, 1, 1, i); __PYX_ERR(0, 635, __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, 635, __pyx_L3_error) + } + __pyx_v_doc = values[0]; + } + goto __pyx_L6_skip; + __pyx_L5_argtuple_error:; + __Pyx_RaiseArgtupleInvalid("get_doc_labels", 1, 1, 1, __pyx_nargs); __PYX_ERR(0, 635, __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("spacy.pipeline._parser_internals.arc_eager.ArcEager.get_doc_labels", __pyx_clineno, __pyx_lineno, __pyx_filename); + __Pyx_RefNannyFinishContext(); + return NULL; + __pyx_L4_argument_unpacking_done:; + __pyx_r = __pyx_pf_5spacy_8pipeline_17_parser_internals_9arc_eager_8ArcEager_4get_doc_labels(((struct __pyx_obj_5spacy_8pipeline_17_parser_internals_9arc_eager_ArcEager *)__pyx_v_self), __pyx_v_doc); + + /* 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_5spacy_8pipeline_17_parser_internals_9arc_eager_8ArcEager_4get_doc_labels(struct __pyx_obj_5spacy_8pipeline_17_parser_internals_9arc_eager_ArcEager *__pyx_v_self, PyObject *__pyx_v_doc) { + PyObject *__pyx_v_labels = NULL; + PyObject *__pyx_v_token = NULL; + PyObject *__pyx_r = NULL; + __Pyx_RefNannyDeclarations + PyObject *__pyx_t_1 = NULL; + PyObject *__pyx_t_2 = NULL; + Py_ssize_t __pyx_t_3; + PyObject *(*__pyx_t_4)(PyObject *); + int __pyx_t_5; + int __pyx_t_6; + int __pyx_lineno = 0; + const char *__pyx_filename = NULL; + int __pyx_clineno = 0; + __Pyx_RefNannySetupContext("get_doc_labels", 0); + + /* "spacy/pipeline/_parser_internals/arc_eager.pyx":637 + * def get_doc_labels(self, doc): + * """Get the labels required for a given Doc.""" + * labels = set(self.builtin_labels) # <<<<<<<<<<<<<< + * for token in doc: + * if token.dep_: +*/ + __pyx_t_1 = __Pyx_PyObject_GetAttrStr(((PyObject *)__pyx_v_self), __pyx_mstate_global->__pyx_n_u_builtin_labels); if (unlikely(!__pyx_t_1)) __PYX_ERR(0, 637, __pyx_L1_error) + __Pyx_GOTREF(__pyx_t_1); + __pyx_t_2 = PySet_New(__pyx_t_1); if (unlikely(!__pyx_t_2)) __PYX_ERR(0, 637, __pyx_L1_error) + __Pyx_GOTREF(__pyx_t_2); + __Pyx_DECREF(__pyx_t_1); __pyx_t_1 = 0; + __pyx_v_labels = ((PyObject*)__pyx_t_2); + __pyx_t_2 = 0; + + /* "spacy/pipeline/_parser_internals/arc_eager.pyx":638 + * """Get the labels required for a given Doc.""" + * labels = set(self.builtin_labels) + * for token in doc: # <<<<<<<<<<<<<< + * if token.dep_: + * labels.add(token.dep_) +*/ + if (likely(PyList_CheckExact(__pyx_v_doc)) || PyTuple_CheckExact(__pyx_v_doc)) { + __pyx_t_2 = __pyx_v_doc; __Pyx_INCREF(__pyx_t_2); + __pyx_t_3 = 0; + __pyx_t_4 = NULL; + } else { + __pyx_t_3 = -1; __pyx_t_2 = PyObject_GetIter(__pyx_v_doc); if (unlikely(!__pyx_t_2)) __PYX_ERR(0, 638, __pyx_L1_error) + __Pyx_GOTREF(__pyx_t_2); + __pyx_t_4 = (CYTHON_COMPILING_IN_LIMITED_API) ? PyIter_Next : __Pyx_PyObject_GetIterNextFunc(__pyx_t_2); if (unlikely(!__pyx_t_4)) __PYX_ERR(0, 638, __pyx_L1_error) + } + for (;;) { + if (likely(!__pyx_t_4)) { + if (likely(PyList_CheckExact(__pyx_t_2))) { + { + Py_ssize_t __pyx_temp = __Pyx_PyList_GET_SIZE(__pyx_t_2); + #if !CYTHON_ASSUME_SAFE_SIZE + if (unlikely((__pyx_temp < 0))) __PYX_ERR(0, 638, __pyx_L1_error) + #endif + if (__pyx_t_3 >= __pyx_temp) break; + } + __pyx_t_1 = __Pyx_PyList_GetItemRefFast(__pyx_t_2, __pyx_t_3, __Pyx_ReferenceSharing_OwnStrongReference); + ++__pyx_t_3; + } else { + { + Py_ssize_t __pyx_temp = __Pyx_PyTuple_GET_SIZE(__pyx_t_2); + #if !CYTHON_ASSUME_SAFE_SIZE + if (unlikely((__pyx_temp < 0))) __PYX_ERR(0, 638, __pyx_L1_error) + #endif + if (__pyx_t_3 >= __pyx_temp) break; + } + #if CYTHON_ASSUME_SAFE_MACROS && !CYTHON_AVOID_BORROWED_REFS + __pyx_t_1 = __Pyx_NewRef(PyTuple_GET_ITEM(__pyx_t_2, __pyx_t_3)); + #else + __pyx_t_1 = __Pyx_PySequence_ITEM(__pyx_t_2, __pyx_t_3); + #endif + ++__pyx_t_3; + } + if (unlikely(!__pyx_t_1)) __PYX_ERR(0, 638, __pyx_L1_error) + } else { + __pyx_t_1 = __pyx_t_4(__pyx_t_2); + if (unlikely(!__pyx_t_1)) { + PyObject* exc_type = PyErr_Occurred(); + if (exc_type) { + if (unlikely(!__Pyx_PyErr_GivenExceptionMatches(exc_type, PyExc_StopIteration))) __PYX_ERR(0, 638, __pyx_L1_error) + PyErr_Clear(); + } + break; + } + } + __Pyx_GOTREF(__pyx_t_1); + __Pyx_XDECREF_SET(__pyx_v_token, __pyx_t_1); + __pyx_t_1 = 0; + + /* "spacy/pipeline/_parser_internals/arc_eager.pyx":639 + * labels = set(self.builtin_labels) + * for token in doc: + * if token.dep_: # <<<<<<<<<<<<<< + * labels.add(token.dep_) + * return labels +*/ + __pyx_t_1 = __Pyx_PyObject_GetAttrStr(__pyx_v_token, __pyx_mstate_global->__pyx_n_u_dep_2); if (unlikely(!__pyx_t_1)) __PYX_ERR(0, 639, __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, 639, __pyx_L1_error) + __Pyx_DECREF(__pyx_t_1); __pyx_t_1 = 0; + if (__pyx_t_5) { + + /* "spacy/pipeline/_parser_internals/arc_eager.pyx":640 + * for token in doc: + * if token.dep_: + * labels.add(token.dep_) # <<<<<<<<<<<<<< + * return labels + * +*/ + __pyx_t_1 = __Pyx_PyObject_GetAttrStr(__pyx_v_token, __pyx_mstate_global->__pyx_n_u_dep_2); if (unlikely(!__pyx_t_1)) __PYX_ERR(0, 640, __pyx_L1_error) + __Pyx_GOTREF(__pyx_t_1); + __pyx_t_6 = PySet_Add(__pyx_v_labels, __pyx_t_1); if (unlikely(__pyx_t_6 == ((int)-1))) __PYX_ERR(0, 640, __pyx_L1_error) + __Pyx_DECREF(__pyx_t_1); __pyx_t_1 = 0; + + /* "spacy/pipeline/_parser_internals/arc_eager.pyx":639 + * labels = set(self.builtin_labels) + * for token in doc: + * if token.dep_: # <<<<<<<<<<<<<< + * labels.add(token.dep_) + * return labels +*/ + } + + /* "spacy/pipeline/_parser_internals/arc_eager.pyx":638 + * """Get the labels required for a given Doc.""" + * labels = set(self.builtin_labels) + * for token in doc: # <<<<<<<<<<<<<< + * if token.dep_: + * labels.add(token.dep_) +*/ + } + __Pyx_DECREF(__pyx_t_2); __pyx_t_2 = 0; + + /* "spacy/pipeline/_parser_internals/arc_eager.pyx":641 + * if token.dep_: + * labels.add(token.dep_) + * return labels # <<<<<<<<<<<<<< + * + * def transition(self, StateClass state, action): +*/ + __Pyx_XDECREF(__pyx_r); + __Pyx_INCREF(__pyx_v_labels); + __pyx_r = __pyx_v_labels; + goto __pyx_L0; + + /* "spacy/pipeline/_parser_internals/arc_eager.pyx":635 + * return (SHIFT, REDUCE, LEFT, RIGHT, BREAK) + * + * def get_doc_labels(self, doc): # <<<<<<<<<<<<<< + * """Get the labels required for a given Doc.""" + * labels = set(self.builtin_labels) +*/ + + /* function exit code */ + __pyx_L1_error:; + __Pyx_XDECREF(__pyx_t_1); + __Pyx_XDECREF(__pyx_t_2); + __Pyx_AddTraceback("spacy.pipeline._parser_internals.arc_eager.ArcEager.get_doc_labels", __pyx_clineno, __pyx_lineno, __pyx_filename); + __pyx_r = NULL; + __pyx_L0:; + __Pyx_XDECREF(__pyx_v_labels); + __Pyx_XDECREF(__pyx_v_token); + __Pyx_XGIVEREF(__pyx_r); + __Pyx_RefNannyFinishContext(); + return __pyx_r; +} + +/* "spacy/pipeline/_parser_internals/arc_eager.pyx":643 + * return labels + * + * def transition(self, StateClass state, action): # <<<<<<<<<<<<<< + * cdef Transition t = self.lookup_transition(action) + * t.do(state.c, t.label) +*/ + +/* Python wrapper */ +static PyObject *__pyx_pw_5spacy_8pipeline_17_parser_internals_9arc_eager_8ArcEager_7transition(PyObject *__pyx_v_self, +#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_5spacy_8pipeline_17_parser_internals_9arc_eager_8ArcEager_6transition, "ArcEager.transition(self, StateClass state, action)"); +static PyMethodDef __pyx_mdef_5spacy_8pipeline_17_parser_internals_9arc_eager_8ArcEager_7transition = {"transition", (PyCFunction)(void(*)(void))(__Pyx_PyCFunction_FastCallWithKeywords)__pyx_pw_5spacy_8pipeline_17_parser_internals_9arc_eager_8ArcEager_7transition, __Pyx_METH_FASTCALL|METH_KEYWORDS, __pyx_doc_5spacy_8pipeline_17_parser_internals_9arc_eager_8ArcEager_6transition}; +static PyObject *__pyx_pw_5spacy_8pipeline_17_parser_internals_9arc_eager_8ArcEager_7transition(PyObject *__pyx_v_self, +#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_5spacy_8pipeline_17_parser_internals_10stateclass_StateClass *__pyx_v_state = 0; + PyObject *__pyx_v_action = 0; + #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("transition (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_state,&__pyx_mstate_global->__pyx_n_u_action,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, 643, __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, 643, __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, 643, __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, "transition", 0) < (0)) __PYX_ERR(0, 643, __pyx_L3_error) + for (Py_ssize_t i = __pyx_nargs; i < 2; i++) { + if (unlikely(!values[i])) { __Pyx_RaiseArgtupleInvalid("transition", 1, 2, 2, i); __PYX_ERR(0, 643, __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, 643, __pyx_L3_error) + values[1] = __Pyx_ArgRef_FASTCALL(__pyx_args, 1); + if (!CYTHON_ASSUME_SAFE_MACROS && unlikely(!values[1])) __PYX_ERR(0, 643, __pyx_L3_error) + } + __pyx_v_state = ((struct __pyx_obj_5spacy_8pipeline_17_parser_internals_10stateclass_StateClass *)values[0]); + __pyx_v_action = values[1]; + } + goto __pyx_L6_skip; + __pyx_L5_argtuple_error:; + __Pyx_RaiseArgtupleInvalid("transition", 1, 2, 2, __pyx_nargs); __PYX_ERR(0, 643, __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("spacy.pipeline._parser_internals.arc_eager.ArcEager.transition", __pyx_clineno, __pyx_lineno, __pyx_filename); + __Pyx_RefNannyFinishContext(); + return NULL; + __pyx_L4_argument_unpacking_done:; + if (unlikely(!__Pyx_ArgTypeTest(((PyObject *)__pyx_v_state), __pyx_mstate_global->__pyx_ptype_5spacy_8pipeline_17_parser_internals_10stateclass_StateClass, 1, "state", 0))) __PYX_ERR(0, 643, __pyx_L1_error) + __pyx_r = __pyx_pf_5spacy_8pipeline_17_parser_internals_9arc_eager_8ArcEager_6transition(((struct __pyx_obj_5spacy_8pipeline_17_parser_internals_9arc_eager_ArcEager *)__pyx_v_self), __pyx_v_state, __pyx_v_action); + + /* 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_5spacy_8pipeline_17_parser_internals_9arc_eager_8ArcEager_6transition(struct __pyx_obj_5spacy_8pipeline_17_parser_internals_9arc_eager_ArcEager *__pyx_v_self, struct __pyx_obj_5spacy_8pipeline_17_parser_internals_10stateclass_StateClass *__pyx_v_state, PyObject *__pyx_v_action) { + struct __pyx_t_5spacy_8pipeline_17_parser_internals_17transition_system_Transition __pyx_v_t; + PyObject *__pyx_r = NULL; + __Pyx_RefNannyDeclarations + struct __pyx_t_5spacy_8pipeline_17_parser_internals_17transition_system_Transition __pyx_t_1; + int __pyx_lineno = 0; + const char *__pyx_filename = NULL; + int __pyx_clineno = 0; + __Pyx_RefNannySetupContext("transition", 0); + + /* "spacy/pipeline/_parser_internals/arc_eager.pyx":644 + * + * def transition(self, StateClass state, action): + * cdef Transition t = self.lookup_transition(action) # <<<<<<<<<<<<<< + * t.do(state.c, t.label) + * return state +*/ + __pyx_t_1 = ((struct __pyx_vtabstruct_5spacy_8pipeline_17_parser_internals_9arc_eager_ArcEager *)__pyx_v_self->__pyx_base.__pyx_vtab)->__pyx_base.lookup_transition(((struct __pyx_obj_5spacy_8pipeline_17_parser_internals_17transition_system_TransitionSystem *)__pyx_v_self), __pyx_v_action); if (unlikely(PyErr_Occurred())) __PYX_ERR(0, 644, __pyx_L1_error) + __pyx_v_t = __pyx_t_1; + + /* "spacy/pipeline/_parser_internals/arc_eager.pyx":645 + * def transition(self, StateClass state, action): + * cdef Transition t = self.lookup_transition(action) + * t.do(state.c, t.label) # <<<<<<<<<<<<<< + * return state + * +*/ + (void)(__pyx_v_t.__pyx_do(__pyx_v_state->c, __pyx_v_t.label)); + + /* "spacy/pipeline/_parser_internals/arc_eager.pyx":646 + * cdef Transition t = self.lookup_transition(action) + * t.do(state.c, t.label) + * return state # <<<<<<<<<<<<<< + * + * def is_gold_parse(self, StateClass state, ArcEagerGold gold): +*/ + __Pyx_XDECREF(__pyx_r); + __Pyx_INCREF((PyObject *)__pyx_v_state); + __pyx_r = ((PyObject *)__pyx_v_state); + goto __pyx_L0; + + /* "spacy/pipeline/_parser_internals/arc_eager.pyx":643 + * return labels + * + * def transition(self, StateClass state, action): # <<<<<<<<<<<<<< + * cdef Transition t = self.lookup_transition(action) + * t.do(state.c, t.label) +*/ + + /* function exit code */ + __pyx_L1_error:; + __Pyx_AddTraceback("spacy.pipeline._parser_internals.arc_eager.ArcEager.transition", __pyx_clineno, __pyx_lineno, __pyx_filename); + __pyx_r = NULL; + __pyx_L0:; + __Pyx_XGIVEREF(__pyx_r); + __Pyx_RefNannyFinishContext(); + return __pyx_r; +} + +/* "spacy/pipeline/_parser_internals/arc_eager.pyx":648 + * return state + * + * def is_gold_parse(self, StateClass state, ArcEagerGold gold): # <<<<<<<<<<<<<< + * for i in range(state.c.length): + * token = state.c.safe_get(i) +*/ + +/* Python wrapper */ +static PyObject *__pyx_pw_5spacy_8pipeline_17_parser_internals_9arc_eager_8ArcEager_9is_gold_parse(PyObject *__pyx_v_self, +#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_5spacy_8pipeline_17_parser_internals_9arc_eager_8ArcEager_8is_gold_parse, "ArcEager.is_gold_parse(self, StateClass state, ArcEagerGold gold)"); +static PyMethodDef __pyx_mdef_5spacy_8pipeline_17_parser_internals_9arc_eager_8ArcEager_9is_gold_parse = {"is_gold_parse", (PyCFunction)(void(*)(void))(__Pyx_PyCFunction_FastCallWithKeywords)__pyx_pw_5spacy_8pipeline_17_parser_internals_9arc_eager_8ArcEager_9is_gold_parse, __Pyx_METH_FASTCALL|METH_KEYWORDS, __pyx_doc_5spacy_8pipeline_17_parser_internals_9arc_eager_8ArcEager_8is_gold_parse}; +static PyObject *__pyx_pw_5spacy_8pipeline_17_parser_internals_9arc_eager_8ArcEager_9is_gold_parse(PyObject *__pyx_v_self, +#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_5spacy_8pipeline_17_parser_internals_10stateclass_StateClass *__pyx_v_state = 0; + struct __pyx_obj_5spacy_8pipeline_17_parser_internals_9arc_eager_ArcEagerGold *__pyx_v_gold = 0; + #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("is_gold_parse (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_state,&__pyx_mstate_global->__pyx_n_u_gold,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, 648, __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, 648, __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, 648, __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, "is_gold_parse", 0) < (0)) __PYX_ERR(0, 648, __pyx_L3_error) + for (Py_ssize_t i = __pyx_nargs; i < 2; i++) { + if (unlikely(!values[i])) { __Pyx_RaiseArgtupleInvalid("is_gold_parse", 1, 2, 2, i); __PYX_ERR(0, 648, __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, 648, __pyx_L3_error) + values[1] = __Pyx_ArgRef_FASTCALL(__pyx_args, 1); + if (!CYTHON_ASSUME_SAFE_MACROS && unlikely(!values[1])) __PYX_ERR(0, 648, __pyx_L3_error) + } + __pyx_v_state = ((struct __pyx_obj_5spacy_8pipeline_17_parser_internals_10stateclass_StateClass *)values[0]); + __pyx_v_gold = ((struct __pyx_obj_5spacy_8pipeline_17_parser_internals_9arc_eager_ArcEagerGold *)values[1]); + } + goto __pyx_L6_skip; + __pyx_L5_argtuple_error:; + __Pyx_RaiseArgtupleInvalid("is_gold_parse", 1, 2, 2, __pyx_nargs); __PYX_ERR(0, 648, __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("spacy.pipeline._parser_internals.arc_eager.ArcEager.is_gold_parse", __pyx_clineno, __pyx_lineno, __pyx_filename); + __Pyx_RefNannyFinishContext(); + return NULL; + __pyx_L4_argument_unpacking_done:; + if (unlikely(!__Pyx_ArgTypeTest(((PyObject *)__pyx_v_state), __pyx_mstate_global->__pyx_ptype_5spacy_8pipeline_17_parser_internals_10stateclass_StateClass, 1, "state", 0))) __PYX_ERR(0, 648, __pyx_L1_error) + if (unlikely(!__Pyx_ArgTypeTest(((PyObject *)__pyx_v_gold), __pyx_mstate_global->__pyx_ptype_5spacy_8pipeline_17_parser_internals_9arc_eager_ArcEagerGold, 1, "gold", 0))) __PYX_ERR(0, 648, __pyx_L1_error) + __pyx_r = __pyx_pf_5spacy_8pipeline_17_parser_internals_9arc_eager_8ArcEager_8is_gold_parse(((struct __pyx_obj_5spacy_8pipeline_17_parser_internals_9arc_eager_ArcEager *)__pyx_v_self), __pyx_v_state, __pyx_v_gold); + + /* 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_5spacy_8pipeline_17_parser_internals_9arc_eager_8ArcEager_8is_gold_parse(CYTHON_UNUSED struct __pyx_obj_5spacy_8pipeline_17_parser_internals_9arc_eager_ArcEager *__pyx_v_self, struct __pyx_obj_5spacy_8pipeline_17_parser_internals_10stateclass_StateClass *__pyx_v_state, struct __pyx_obj_5spacy_8pipeline_17_parser_internals_9arc_eager_ArcEagerGold *__pyx_v_gold) { + int __pyx_v_i; + struct __pyx_t_5spacy_7structs_TokenC const *__pyx_v_token; + PyObject *__pyx_r = NULL; + __Pyx_RefNannyDeclarations + int __pyx_t_1; + int __pyx_t_2; + int __pyx_t_3; + int __pyx_t_4; + __Pyx_RefNannySetupContext("is_gold_parse", 0); + + /* "spacy/pipeline/_parser_internals/arc_eager.pyx":649 + * + * def is_gold_parse(self, StateClass state, ArcEagerGold gold): + * for i in range(state.c.length): # <<<<<<<<<<<<<< + * token = state.c.safe_get(i) + * if not arc_is_gold(&gold.c, i, i+token.head): +*/ + __pyx_t_1 = __pyx_v_state->c->length; + __pyx_t_2 = __pyx_t_1; + for (__pyx_t_3 = 0; __pyx_t_3 < __pyx_t_2; __pyx_t_3+=1) { + __pyx_v_i = __pyx_t_3; + + /* "spacy/pipeline/_parser_internals/arc_eager.pyx":650 + * def is_gold_parse(self, StateClass state, ArcEagerGold gold): + * for i in range(state.c.length): + * token = state.c.safe_get(i) # <<<<<<<<<<<<<< + * if not arc_is_gold(&gold.c, i, i+token.head): + * return False +*/ + __pyx_v_token = __pyx_v_state->c->safe_get(__pyx_v_i); + + /* "spacy/pipeline/_parser_internals/arc_eager.pyx":651 + * for i in range(state.c.length): + * token = state.c.safe_get(i) + * if not arc_is_gold(&gold.c, i, i+token.head): # <<<<<<<<<<<<<< + * return False + * elif not label_is_gold(&gold.c, i, token.dep): +*/ + __pyx_t_4 = (!__pyx_f_5spacy_8pipeline_17_parser_internals_9arc_eager_arc_is_gold((&__pyx_v_gold->c), __pyx_v_i, (__pyx_v_i + __pyx_v_token->head))); + if (__pyx_t_4) { + + /* "spacy/pipeline/_parser_internals/arc_eager.pyx":652 + * token = state.c.safe_get(i) + * if not arc_is_gold(&gold.c, i, i+token.head): + * return False # <<<<<<<<<<<<<< + * elif not label_is_gold(&gold.c, i, token.dep): + * return False +*/ + __Pyx_XDECREF(__pyx_r); + __Pyx_INCREF(Py_False); + __pyx_r = Py_False; + goto __pyx_L0; + + /* "spacy/pipeline/_parser_internals/arc_eager.pyx":651 + * for i in range(state.c.length): + * token = state.c.safe_get(i) + * if not arc_is_gold(&gold.c, i, i+token.head): # <<<<<<<<<<<<<< + * return False + * elif not label_is_gold(&gold.c, i, token.dep): +*/ + } + + /* "spacy/pipeline/_parser_internals/arc_eager.pyx":653 + * if not arc_is_gold(&gold.c, i, i+token.head): + * return False + * elif not label_is_gold(&gold.c, i, token.dep): # <<<<<<<<<<<<<< + * return False + * return True +*/ + __pyx_t_4 = (!__pyx_f_5spacy_8pipeline_17_parser_internals_9arc_eager_label_is_gold((&__pyx_v_gold->c), __pyx_v_i, __pyx_v_token->dep)); + if (__pyx_t_4) { + + /* "spacy/pipeline/_parser_internals/arc_eager.pyx":654 + * return False + * elif not label_is_gold(&gold.c, i, token.dep): + * return False # <<<<<<<<<<<<<< + * return True + * +*/ + __Pyx_XDECREF(__pyx_r); + __Pyx_INCREF(Py_False); + __pyx_r = Py_False; + goto __pyx_L0; + + /* "spacy/pipeline/_parser_internals/arc_eager.pyx":653 + * if not arc_is_gold(&gold.c, i, i+token.head): + * return False + * elif not label_is_gold(&gold.c, i, token.dep): # <<<<<<<<<<<<<< + * return False + * return True +*/ + } + } + + /* "spacy/pipeline/_parser_internals/arc_eager.pyx":655 + * elif not label_is_gold(&gold.c, i, token.dep): + * return False + * return True # <<<<<<<<<<<<<< + * + * def init_gold(self, StateClass state, Example example): +*/ + __Pyx_XDECREF(__pyx_r); + __Pyx_INCREF(Py_True); + __pyx_r = Py_True; + goto __pyx_L0; + + /* "spacy/pipeline/_parser_internals/arc_eager.pyx":648 + * return state + * + * def is_gold_parse(self, StateClass state, ArcEagerGold gold): # <<<<<<<<<<<<<< + * for i in range(state.c.length): + * token = state.c.safe_get(i) +*/ + + /* function exit code */ + __pyx_L0:; + __Pyx_XGIVEREF(__pyx_r); + __Pyx_RefNannyFinishContext(); + return __pyx_r; +} + +/* "spacy/pipeline/_parser_internals/arc_eager.pyx":657 + * return True + * + * def init_gold(self, StateClass state, Example example): # <<<<<<<<<<<<<< + * gold = ArcEagerGold(self, state, example) + * self._replace_unseen_labels(gold) +*/ + +/* Python wrapper */ +static PyObject *__pyx_pw_5spacy_8pipeline_17_parser_internals_9arc_eager_8ArcEager_11init_gold(PyObject *__pyx_v_self, +#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_5spacy_8pipeline_17_parser_internals_9arc_eager_8ArcEager_10init_gold, "ArcEager.init_gold(self, StateClass state, Example example)"); +static PyMethodDef __pyx_mdef_5spacy_8pipeline_17_parser_internals_9arc_eager_8ArcEager_11init_gold = {"init_gold", (PyCFunction)(void(*)(void))(__Pyx_PyCFunction_FastCallWithKeywords)__pyx_pw_5spacy_8pipeline_17_parser_internals_9arc_eager_8ArcEager_11init_gold, __Pyx_METH_FASTCALL|METH_KEYWORDS, __pyx_doc_5spacy_8pipeline_17_parser_internals_9arc_eager_8ArcEager_10init_gold}; +static PyObject *__pyx_pw_5spacy_8pipeline_17_parser_internals_9arc_eager_8ArcEager_11init_gold(PyObject *__pyx_v_self, +#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_5spacy_8pipeline_17_parser_internals_10stateclass_StateClass *__pyx_v_state = 0; + struct __pyx_obj_5spacy_8training_7example_Example *__pyx_v_example = 0; + #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("init_gold (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_state,&__pyx_mstate_global->__pyx_n_u_example,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, 657, __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, 657, __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, 657, __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_gold", 0) < (0)) __PYX_ERR(0, 657, __pyx_L3_error) + for (Py_ssize_t i = __pyx_nargs; i < 2; i++) { + if (unlikely(!values[i])) { __Pyx_RaiseArgtupleInvalid("init_gold", 1, 2, 2, i); __PYX_ERR(0, 657, __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, 657, __pyx_L3_error) + values[1] = __Pyx_ArgRef_FASTCALL(__pyx_args, 1); + if (!CYTHON_ASSUME_SAFE_MACROS && unlikely(!values[1])) __PYX_ERR(0, 657, __pyx_L3_error) + } + __pyx_v_state = ((struct __pyx_obj_5spacy_8pipeline_17_parser_internals_10stateclass_StateClass *)values[0]); + __pyx_v_example = ((struct __pyx_obj_5spacy_8training_7example_Example *)values[1]); + } + goto __pyx_L6_skip; + __pyx_L5_argtuple_error:; + __Pyx_RaiseArgtupleInvalid("init_gold", 1, 2, 2, __pyx_nargs); __PYX_ERR(0, 657, __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("spacy.pipeline._parser_internals.arc_eager.ArcEager.init_gold", __pyx_clineno, __pyx_lineno, __pyx_filename); + __Pyx_RefNannyFinishContext(); + return NULL; + __pyx_L4_argument_unpacking_done:; + if (unlikely(!__Pyx_ArgTypeTest(((PyObject *)__pyx_v_state), __pyx_mstate_global->__pyx_ptype_5spacy_8pipeline_17_parser_internals_10stateclass_StateClass, 1, "state", 0))) __PYX_ERR(0, 657, __pyx_L1_error) + if (unlikely(!__Pyx_ArgTypeTest(((PyObject *)__pyx_v_example), __pyx_mstate_global->__pyx_ptype_5spacy_8training_7example_Example, 1, "example", 0))) __PYX_ERR(0, 657, __pyx_L1_error) + __pyx_r = __pyx_pf_5spacy_8pipeline_17_parser_internals_9arc_eager_8ArcEager_10init_gold(((struct __pyx_obj_5spacy_8pipeline_17_parser_internals_9arc_eager_ArcEager *)__pyx_v_self), __pyx_v_state, __pyx_v_example); + + /* 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_5spacy_8pipeline_17_parser_internals_9arc_eager_8ArcEager_10init_gold(struct __pyx_obj_5spacy_8pipeline_17_parser_internals_9arc_eager_ArcEager *__pyx_v_self, struct __pyx_obj_5spacy_8pipeline_17_parser_internals_10stateclass_StateClass *__pyx_v_state, struct __pyx_obj_5spacy_8training_7example_Example *__pyx_v_example) { + struct __pyx_obj_5spacy_8pipeline_17_parser_internals_9arc_eager_ArcEagerGold *__pyx_v_gold = 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("init_gold", 0); + + /* "spacy/pipeline/_parser_internals/arc_eager.pyx":658 + * + * def init_gold(self, StateClass state, Example example): + * gold = ArcEagerGold(self, state, example) # <<<<<<<<<<<<<< + * self._replace_unseen_labels(gold) + * return gold +*/ + __pyx_t_2 = NULL; + __pyx_t_3 = 1; + { + PyObject *__pyx_callargs[4] = {__pyx_t_2, ((PyObject *)__pyx_v_self), ((PyObject *)__pyx_v_state), ((PyObject *)__pyx_v_example)}; + __pyx_t_1 = __Pyx_PyObject_FastCall((PyObject*)__pyx_mstate_global->__pyx_ptype_5spacy_8pipeline_17_parser_internals_9arc_eager_ArcEagerGold, __pyx_callargs+__pyx_t_3, (4-__pyx_t_3) | (__pyx_t_3*__Pyx_PY_VECTORCALL_ARGUMENTS_OFFSET)); + __Pyx_XDECREF(__pyx_t_2); __pyx_t_2 = 0; + if (unlikely(!__pyx_t_1)) __PYX_ERR(0, 658, __pyx_L1_error) + __Pyx_GOTREF((PyObject *)__pyx_t_1); + } + __pyx_v_gold = ((struct __pyx_obj_5spacy_8pipeline_17_parser_internals_9arc_eager_ArcEagerGold *)__pyx_t_1); + __pyx_t_1 = 0; + + /* "spacy/pipeline/_parser_internals/arc_eager.pyx":659 + * def init_gold(self, StateClass state, Example example): + * gold = ArcEagerGold(self, state, example) + * self._replace_unseen_labels(gold) # <<<<<<<<<<<<<< + * return gold + * +*/ + __pyx_t_2 = ((PyObject *)__pyx_v_self); + __Pyx_INCREF(__pyx_t_2); + __pyx_t_3 = 0; + { + PyObject *__pyx_callargs[2] = {__pyx_t_2, ((PyObject *)__pyx_v_gold)}; + __pyx_t_1 = __Pyx_PyObject_FastCallMethod((PyObject*)__pyx_mstate_global->__pyx_n_u_replace_unseen_labels, __pyx_callargs+__pyx_t_3, (2-__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, 659, __pyx_L1_error) + __Pyx_GOTREF(__pyx_t_1); + } + __Pyx_DECREF(__pyx_t_1); __pyx_t_1 = 0; + + /* "spacy/pipeline/_parser_internals/arc_eager.pyx":660 + * gold = ArcEagerGold(self, state, example) + * self._replace_unseen_labels(gold) + * return gold # <<<<<<<<<<<<<< + * + * def init_gold_batch(self, examples): +*/ + __Pyx_XDECREF(__pyx_r); + __Pyx_INCREF((PyObject *)__pyx_v_gold); + __pyx_r = ((PyObject *)__pyx_v_gold); + goto __pyx_L0; + + /* "spacy/pipeline/_parser_internals/arc_eager.pyx":657 + * return True + * + * def init_gold(self, StateClass state, Example example): # <<<<<<<<<<<<<< + * gold = ArcEagerGold(self, state, example) + * self._replace_unseen_labels(gold) +*/ + + /* function exit code */ + __pyx_L1_error:; + __Pyx_XDECREF(__pyx_t_1); + __Pyx_XDECREF(__pyx_t_2); + __Pyx_AddTraceback("spacy.pipeline._parser_internals.arc_eager.ArcEager.init_gold", __pyx_clineno, __pyx_lineno, __pyx_filename); + __pyx_r = NULL; + __pyx_L0:; + __Pyx_XDECREF((PyObject *)__pyx_v_gold); + __Pyx_XGIVEREF(__pyx_r); + __Pyx_RefNannyFinishContext(); + return __pyx_r; +} + +/* "spacy/pipeline/_parser_internals/arc_eager.pyx":662 + * return gold + * + * def init_gold_batch(self, examples): # <<<<<<<<<<<<<< + * # TODO: Projectivity? + * all_states = self.init_batch([eg.predicted for eg in examples]) +*/ + +/* Python wrapper */ +static PyObject *__pyx_pw_5spacy_8pipeline_17_parser_internals_9arc_eager_8ArcEager_13init_gold_batch(PyObject *__pyx_v_self, +#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_5spacy_8pipeline_17_parser_internals_9arc_eager_8ArcEager_12init_gold_batch, "ArcEager.init_gold_batch(self, examples)"); +static PyMethodDef __pyx_mdef_5spacy_8pipeline_17_parser_internals_9arc_eager_8ArcEager_13init_gold_batch = {"init_gold_batch", (PyCFunction)(void(*)(void))(__Pyx_PyCFunction_FastCallWithKeywords)__pyx_pw_5spacy_8pipeline_17_parser_internals_9arc_eager_8ArcEager_13init_gold_batch, __Pyx_METH_FASTCALL|METH_KEYWORDS, __pyx_doc_5spacy_8pipeline_17_parser_internals_9arc_eager_8ArcEager_12init_gold_batch}; +static PyObject *__pyx_pw_5spacy_8pipeline_17_parser_internals_9arc_eager_8ArcEager_13init_gold_batch(PyObject *__pyx_v_self, +#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_examples = 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("init_gold_batch (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_examples,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, 662, __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, 662, __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_gold_batch", 0) < (0)) __PYX_ERR(0, 662, __pyx_L3_error) + for (Py_ssize_t i = __pyx_nargs; i < 1; i++) { + if (unlikely(!values[i])) { __Pyx_RaiseArgtupleInvalid("init_gold_batch", 1, 1, 1, i); __PYX_ERR(0, 662, __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, 662, __pyx_L3_error) + } + __pyx_v_examples = values[0]; + } + goto __pyx_L6_skip; + __pyx_L5_argtuple_error:; + __Pyx_RaiseArgtupleInvalid("init_gold_batch", 1, 1, 1, __pyx_nargs); __PYX_ERR(0, 662, __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("spacy.pipeline._parser_internals.arc_eager.ArcEager.init_gold_batch", __pyx_clineno, __pyx_lineno, __pyx_filename); + __Pyx_RefNannyFinishContext(); + return NULL; + __pyx_L4_argument_unpacking_done:; + __pyx_r = __pyx_pf_5spacy_8pipeline_17_parser_internals_9arc_eager_8ArcEager_12init_gold_batch(((struct __pyx_obj_5spacy_8pipeline_17_parser_internals_9arc_eager_ArcEager *)__pyx_v_self), __pyx_v_examples); + + /* 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_5spacy_8pipeline_17_parser_internals_9arc_eager_8ArcEager_12init_gold_batch(struct __pyx_obj_5spacy_8pipeline_17_parser_internals_9arc_eager_ArcEager *__pyx_v_self, PyObject *__pyx_v_examples) { + PyObject *__pyx_v_all_states = NULL; + PyObject *__pyx_v_golds = NULL; + PyObject *__pyx_v_states = NULL; + PyObject *__pyx_v_state = NULL; + PyObject *__pyx_v_eg = NULL; + PyObject *__pyx_v_n_steps = NULL; + PyObject *__pyx_v_s = NULL; + PyObject *__pyx_r = NULL; + __Pyx_RefNannyDeclarations + PyObject *__pyx_t_1 = NULL; + PyObject *__pyx_t_2 = NULL; + PyObject *__pyx_t_3 = NULL; + PyObject *__pyx_t_4 = NULL; + Py_ssize_t __pyx_t_5; + PyObject *(*__pyx_t_6)(PyObject *); + PyObject *__pyx_t_7 = NULL; + size_t __pyx_t_8; + PyObject *(*__pyx_t_9)(PyObject *); + int __pyx_t_10; + int __pyx_t_11; + int __pyx_t_12; + int __pyx_t_13; + Py_ssize_t __pyx_t_14; + int __pyx_lineno = 0; + const char *__pyx_filename = NULL; + int __pyx_clineno = 0; + __Pyx_RefNannySetupContext("init_gold_batch", 0); + + /* "spacy/pipeline/_parser_internals/arc_eager.pyx":664 + * def init_gold_batch(self, examples): + * # TODO: Projectivity? + * all_states = self.init_batch([eg.predicted for eg in examples]) # <<<<<<<<<<<<<< + * golds = [] + * states = [] +*/ + __pyx_t_2 = ((PyObject *)__pyx_v_self); + __Pyx_INCREF(__pyx_t_2); + __pyx_t_3 = PyList_New(0); if (unlikely(!__pyx_t_3)) __PYX_ERR(0, 664, __pyx_L1_error) + __Pyx_GOTREF(__pyx_t_3); + if (likely(PyList_CheckExact(__pyx_v_examples)) || PyTuple_CheckExact(__pyx_v_examples)) { + __pyx_t_4 = __pyx_v_examples; __Pyx_INCREF(__pyx_t_4); + __pyx_t_5 = 0; + __pyx_t_6 = NULL; + } else { + __pyx_t_5 = -1; __pyx_t_4 = PyObject_GetIter(__pyx_v_examples); if (unlikely(!__pyx_t_4)) __PYX_ERR(0, 664, __pyx_L1_error) + __Pyx_GOTREF(__pyx_t_4); + __pyx_t_6 = (CYTHON_COMPILING_IN_LIMITED_API) ? PyIter_Next : __Pyx_PyObject_GetIterNextFunc(__pyx_t_4); if (unlikely(!__pyx_t_6)) __PYX_ERR(0, 664, __pyx_L1_error) + } + for (;;) { + if (likely(!__pyx_t_6)) { + if (likely(PyList_CheckExact(__pyx_t_4))) { + { + Py_ssize_t __pyx_temp = __Pyx_PyList_GET_SIZE(__pyx_t_4); + #if !CYTHON_ASSUME_SAFE_SIZE + if (unlikely((__pyx_temp < 0))) __PYX_ERR(0, 664, __pyx_L1_error) + #endif + if (__pyx_t_5 >= __pyx_temp) break; + } + __pyx_t_7 = __Pyx_PyList_GetItemRefFast(__pyx_t_4, __pyx_t_5, __Pyx_ReferenceSharing_OwnStrongReference); + ++__pyx_t_5; + } else { + { + Py_ssize_t __pyx_temp = __Pyx_PyTuple_GET_SIZE(__pyx_t_4); + #if !CYTHON_ASSUME_SAFE_SIZE + if (unlikely((__pyx_temp < 0))) __PYX_ERR(0, 664, __pyx_L1_error) + #endif + if (__pyx_t_5 >= __pyx_temp) break; + } + #if CYTHON_ASSUME_SAFE_MACROS && !CYTHON_AVOID_BORROWED_REFS + __pyx_t_7 = __Pyx_NewRef(PyTuple_GET_ITEM(__pyx_t_4, __pyx_t_5)); + #else + __pyx_t_7 = __Pyx_PySequence_ITEM(__pyx_t_4, __pyx_t_5); + #endif + ++__pyx_t_5; + } + if (unlikely(!__pyx_t_7)) __PYX_ERR(0, 664, __pyx_L1_error) + } else { + __pyx_t_7 = __pyx_t_6(__pyx_t_4); + if (unlikely(!__pyx_t_7)) { + PyObject* exc_type = PyErr_Occurred(); + if (exc_type) { + if (unlikely(!__Pyx_PyErr_GivenExceptionMatches(exc_type, PyExc_StopIteration))) __PYX_ERR(0, 664, __pyx_L1_error) + PyErr_Clear(); + } + break; + } + } + __Pyx_GOTREF(__pyx_t_7); + __Pyx_XDECREF_SET(__pyx_v_eg, __pyx_t_7); + __pyx_t_7 = 0; + __pyx_t_7 = __Pyx_PyObject_GetAttrStr(__pyx_v_eg, __pyx_mstate_global->__pyx_n_u_predicted); if (unlikely(!__pyx_t_7)) __PYX_ERR(0, 664, __pyx_L1_error) + __Pyx_GOTREF(__pyx_t_7); + if (unlikely(__Pyx_ListComp_Append(__pyx_t_3, (PyObject*)__pyx_t_7))) __PYX_ERR(0, 664, __pyx_L1_error) + __Pyx_DECREF(__pyx_t_7); __pyx_t_7 = 0; + } + __Pyx_DECREF(__pyx_t_4); __pyx_t_4 = 0; + __pyx_t_8 = 0; + { + PyObject *__pyx_callargs[2] = {__pyx_t_2, __pyx_t_3}; + __pyx_t_1 = __Pyx_PyObject_FastCallMethod((PyObject*)__pyx_mstate_global->__pyx_n_u_init_batch, __pyx_callargs+__pyx_t_8, (2-__pyx_t_8) | (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, 664, __pyx_L1_error) + __Pyx_GOTREF(__pyx_t_1); + } + __pyx_v_all_states = __pyx_t_1; + __pyx_t_1 = 0; + + /* "spacy/pipeline/_parser_internals/arc_eager.pyx":665 + * # TODO: Projectivity? + * all_states = self.init_batch([eg.predicted for eg in examples]) + * golds = [] # <<<<<<<<<<<<<< + * states = [] + * for state, eg in zip(all_states, examples): +*/ + __pyx_t_1 = PyList_New(0); if (unlikely(!__pyx_t_1)) __PYX_ERR(0, 665, __pyx_L1_error) + __Pyx_GOTREF(__pyx_t_1); + __pyx_v_golds = ((PyObject*)__pyx_t_1); + __pyx_t_1 = 0; + + /* "spacy/pipeline/_parser_internals/arc_eager.pyx":666 + * all_states = self.init_batch([eg.predicted for eg in examples]) + * golds = [] + * states = [] # <<<<<<<<<<<<<< + * for state, eg in zip(all_states, examples): + * if self.has_gold(eg) and not state.is_final(): +*/ + __pyx_t_1 = PyList_New(0); if (unlikely(!__pyx_t_1)) __PYX_ERR(0, 666, __pyx_L1_error) + __Pyx_GOTREF(__pyx_t_1); + __pyx_v_states = ((PyObject*)__pyx_t_1); + __pyx_t_1 = 0; + + /* "spacy/pipeline/_parser_internals/arc_eager.pyx":667 + * golds = [] + * states = [] + * for state, eg in zip(all_states, examples): # <<<<<<<<<<<<<< + * if self.has_gold(eg) and not state.is_final(): + * golds.append(self.init_gold(state, eg)) +*/ + __pyx_t_3 = NULL; + __pyx_t_8 = 1; + { + PyObject *__pyx_callargs[3] = {__pyx_t_3, __pyx_v_all_states, __pyx_v_examples}; + __pyx_t_1 = __Pyx_PyObject_FastCall((PyObject*)__pyx_builtin_zip, __pyx_callargs+__pyx_t_8, (3-__pyx_t_8) | (__pyx_t_8*__Pyx_PY_VECTORCALL_ARGUMENTS_OFFSET)); + __Pyx_XDECREF(__pyx_t_3); __pyx_t_3 = 0; + if (unlikely(!__pyx_t_1)) __PYX_ERR(0, 667, __pyx_L1_error) + __Pyx_GOTREF(__pyx_t_1); + } + if (likely(PyList_CheckExact(__pyx_t_1)) || PyTuple_CheckExact(__pyx_t_1)) { + __pyx_t_3 = __pyx_t_1; __Pyx_INCREF(__pyx_t_3); + __pyx_t_5 = 0; + __pyx_t_6 = NULL; + } else { + __pyx_t_5 = -1; __pyx_t_3 = PyObject_GetIter(__pyx_t_1); if (unlikely(!__pyx_t_3)) __PYX_ERR(0, 667, __pyx_L1_error) + __Pyx_GOTREF(__pyx_t_3); + __pyx_t_6 = (CYTHON_COMPILING_IN_LIMITED_API) ? PyIter_Next : __Pyx_PyObject_GetIterNextFunc(__pyx_t_3); if (unlikely(!__pyx_t_6)) __PYX_ERR(0, 667, __pyx_L1_error) + } + __Pyx_DECREF(__pyx_t_1); __pyx_t_1 = 0; + for (;;) { + if (likely(!__pyx_t_6)) { + 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, 667, __pyx_L1_error) + #endif + if (__pyx_t_5 >= __pyx_temp) break; + } + __pyx_t_1 = __Pyx_PyList_GetItemRefFast(__pyx_t_3, __pyx_t_5, __Pyx_ReferenceSharing_OwnStrongReference); + ++__pyx_t_5; + } 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, 667, __pyx_L1_error) + #endif + if (__pyx_t_5 >= __pyx_temp) break; + } + #if CYTHON_ASSUME_SAFE_MACROS && !CYTHON_AVOID_BORROWED_REFS + __pyx_t_1 = __Pyx_NewRef(PyTuple_GET_ITEM(__pyx_t_3, __pyx_t_5)); + #else + __pyx_t_1 = __Pyx_PySequence_ITEM(__pyx_t_3, __pyx_t_5); + #endif + ++__pyx_t_5; + } + if (unlikely(!__pyx_t_1)) __PYX_ERR(0, 667, __pyx_L1_error) + } else { + __pyx_t_1 = __pyx_t_6(__pyx_t_3); + if (unlikely(!__pyx_t_1)) { + PyObject* exc_type = PyErr_Occurred(); + if (exc_type) { + if (unlikely(!__Pyx_PyErr_GivenExceptionMatches(exc_type, PyExc_StopIteration))) __PYX_ERR(0, 667, __pyx_L1_error) + PyErr_Clear(); + } + break; + } + } + __Pyx_GOTREF(__pyx_t_1); + if ((likely(PyTuple_CheckExact(__pyx_t_1))) || (PyList_CheckExact(__pyx_t_1))) { + PyObject* sequence = __pyx_t_1; + 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, 667, __pyx_L1_error) + } + #if CYTHON_ASSUME_SAFE_MACROS && !CYTHON_AVOID_BORROWED_REFS + if (likely(PyTuple_CheckExact(sequence))) { + __pyx_t_2 = PyTuple_GET_ITEM(sequence, 0); + __Pyx_INCREF(__pyx_t_2); + __pyx_t_4 = PyTuple_GET_ITEM(sequence, 1); + __Pyx_INCREF(__pyx_t_4); + } else { + __pyx_t_2 = __Pyx_PyList_GetItemRefFast(sequence, 0, __Pyx_ReferenceSharing_SharedReference); + if (unlikely(!__pyx_t_2)) __PYX_ERR(0, 667, __pyx_L1_error) + __Pyx_XGOTREF(__pyx_t_2); + __pyx_t_4 = __Pyx_PyList_GetItemRefFast(sequence, 1, __Pyx_ReferenceSharing_SharedReference); + if (unlikely(!__pyx_t_4)) __PYX_ERR(0, 667, __pyx_L1_error) + __Pyx_XGOTREF(__pyx_t_4); + } + #else + __pyx_t_2 = __Pyx_PySequence_ITEM(sequence, 0); if (unlikely(!__pyx_t_2)) __PYX_ERR(0, 667, __pyx_L1_error) + __Pyx_GOTREF(__pyx_t_2); + __pyx_t_4 = __Pyx_PySequence_ITEM(sequence, 1); if (unlikely(!__pyx_t_4)) __PYX_ERR(0, 667, __pyx_L1_error) + __Pyx_GOTREF(__pyx_t_4); + #endif + __Pyx_DECREF(__pyx_t_1); __pyx_t_1 = 0; + } else { + Py_ssize_t index = -1; + __pyx_t_7 = PyObject_GetIter(__pyx_t_1); if (unlikely(!__pyx_t_7)) __PYX_ERR(0, 667, __pyx_L1_error) + __Pyx_GOTREF(__pyx_t_7); + __Pyx_DECREF(__pyx_t_1); __pyx_t_1 = 0; + __pyx_t_9 = (CYTHON_COMPILING_IN_LIMITED_API) ? PyIter_Next : __Pyx_PyObject_GetIterNextFunc(__pyx_t_7); + index = 0; __pyx_t_2 = __pyx_t_9(__pyx_t_7); if (unlikely(!__pyx_t_2)) goto __pyx_L8_unpacking_failed; + __Pyx_GOTREF(__pyx_t_2); + index = 1; __pyx_t_4 = __pyx_t_9(__pyx_t_7); if (unlikely(!__pyx_t_4)) goto __pyx_L8_unpacking_failed; + __Pyx_GOTREF(__pyx_t_4); + if (__Pyx_IternextUnpackEndCheck(__pyx_t_9(__pyx_t_7), 2) < (0)) __PYX_ERR(0, 667, __pyx_L1_error) + __pyx_t_9 = NULL; + __Pyx_DECREF(__pyx_t_7); __pyx_t_7 = 0; + goto __pyx_L9_unpacking_done; + __pyx_L8_unpacking_failed:; + __Pyx_DECREF(__pyx_t_7); __pyx_t_7 = 0; + __pyx_t_9 = NULL; + if (__Pyx_IterFinish() == 0) __Pyx_RaiseNeedMoreValuesError(index); + __PYX_ERR(0, 667, __pyx_L1_error) + __pyx_L9_unpacking_done:; + } + __Pyx_XDECREF_SET(__pyx_v_state, __pyx_t_2); + __pyx_t_2 = 0; + __Pyx_XDECREF_SET(__pyx_v_eg, __pyx_t_4); + __pyx_t_4 = 0; + + /* "spacy/pipeline/_parser_internals/arc_eager.pyx":668 + * states = [] + * for state, eg in zip(all_states, examples): + * if self.has_gold(eg) and not state.is_final(): # <<<<<<<<<<<<<< + * golds.append(self.init_gold(state, eg)) + * states.append(state) +*/ + __pyx_t_4 = ((PyObject *)__pyx_v_self); + __Pyx_INCREF(__pyx_t_4); + __pyx_t_8 = 0; + { + PyObject *__pyx_callargs[2] = {__pyx_t_4, __pyx_v_eg}; + __pyx_t_1 = __Pyx_PyObject_FastCallMethod((PyObject*)__pyx_mstate_global->__pyx_n_u_has_gold, __pyx_callargs+__pyx_t_8, (2-__pyx_t_8) | (1*__Pyx_PY_VECTORCALL_ARGUMENTS_OFFSET)); + __Pyx_XDECREF(__pyx_t_4); __pyx_t_4 = 0; + if (unlikely(!__pyx_t_1)) __PYX_ERR(0, 668, __pyx_L1_error) + __Pyx_GOTREF(__pyx_t_1); + } + __pyx_t_11 = __Pyx_PyObject_IsTrue(__pyx_t_1); if (unlikely((__pyx_t_11 < 0))) __PYX_ERR(0, 668, __pyx_L1_error) + __Pyx_DECREF(__pyx_t_1); __pyx_t_1 = 0; + if (__pyx_t_11) { + } else { + __pyx_t_10 = __pyx_t_11; + goto __pyx_L11_bool_binop_done; + } + __pyx_t_4 = __pyx_v_state; + __Pyx_INCREF(__pyx_t_4); + __pyx_t_8 = 0; + { + PyObject *__pyx_callargs[2] = {__pyx_t_4, NULL}; + __pyx_t_1 = __Pyx_PyObject_FastCallMethod((PyObject*)__pyx_mstate_global->__pyx_n_u_is_final, __pyx_callargs+__pyx_t_8, (1-__pyx_t_8) | (1*__Pyx_PY_VECTORCALL_ARGUMENTS_OFFSET)); + __Pyx_XDECREF(__pyx_t_4); __pyx_t_4 = 0; + if (unlikely(!__pyx_t_1)) __PYX_ERR(0, 668, __pyx_L1_error) + __Pyx_GOTREF(__pyx_t_1); + } + __pyx_t_11 = __Pyx_PyObject_IsTrue(__pyx_t_1); if (unlikely((__pyx_t_11 < 0))) __PYX_ERR(0, 668, __pyx_L1_error) + __Pyx_DECREF(__pyx_t_1); __pyx_t_1 = 0; + __pyx_t_12 = (!__pyx_t_11); + __pyx_t_10 = __pyx_t_12; + __pyx_L11_bool_binop_done:; + if (__pyx_t_10) { + + /* "spacy/pipeline/_parser_internals/arc_eager.pyx":669 + * for state, eg in zip(all_states, examples): + * if self.has_gold(eg) and not state.is_final(): + * golds.append(self.init_gold(state, eg)) # <<<<<<<<<<<<<< + * states.append(state) + * n_steps = sum([len(s.queue) for s in states]) +*/ + __pyx_t_4 = ((PyObject *)__pyx_v_self); + __Pyx_INCREF(__pyx_t_4); + __pyx_t_8 = 0; + { + PyObject *__pyx_callargs[3] = {__pyx_t_4, __pyx_v_state, __pyx_v_eg}; + __pyx_t_1 = __Pyx_PyObject_FastCallMethod((PyObject*)__pyx_mstate_global->__pyx_n_u_init_gold, __pyx_callargs+__pyx_t_8, (3-__pyx_t_8) | (1*__Pyx_PY_VECTORCALL_ARGUMENTS_OFFSET)); + __Pyx_XDECREF(__pyx_t_4); __pyx_t_4 = 0; + if (unlikely(!__pyx_t_1)) __PYX_ERR(0, 669, __pyx_L1_error) + __Pyx_GOTREF(__pyx_t_1); + } + __pyx_t_13 = __Pyx_PyList_Append(__pyx_v_golds, __pyx_t_1); if (unlikely(__pyx_t_13 == ((int)-1))) __PYX_ERR(0, 669, __pyx_L1_error) + __Pyx_DECREF(__pyx_t_1); __pyx_t_1 = 0; + + /* "spacy/pipeline/_parser_internals/arc_eager.pyx":670 + * if self.has_gold(eg) and not state.is_final(): + * golds.append(self.init_gold(state, eg)) + * states.append(state) # <<<<<<<<<<<<<< + * n_steps = sum([len(s.queue) for s in states]) + * return states, golds, n_steps +*/ + __pyx_t_13 = __Pyx_PyList_Append(__pyx_v_states, __pyx_v_state); if (unlikely(__pyx_t_13 == ((int)-1))) __PYX_ERR(0, 670, __pyx_L1_error) + + /* "spacy/pipeline/_parser_internals/arc_eager.pyx":668 + * states = [] + * for state, eg in zip(all_states, examples): + * if self.has_gold(eg) and not state.is_final(): # <<<<<<<<<<<<<< + * golds.append(self.init_gold(state, eg)) + * states.append(state) +*/ + } + + /* "spacy/pipeline/_parser_internals/arc_eager.pyx":667 + * golds = [] + * states = [] + * for state, eg in zip(all_states, examples): # <<<<<<<<<<<<<< + * if self.has_gold(eg) and not state.is_final(): + * golds.append(self.init_gold(state, eg)) +*/ + } + __Pyx_DECREF(__pyx_t_3); __pyx_t_3 = 0; + + /* "spacy/pipeline/_parser_internals/arc_eager.pyx":671 + * golds.append(self.init_gold(state, eg)) + * states.append(state) + * n_steps = sum([len(s.queue) for s in states]) # <<<<<<<<<<<<<< + * return states, golds, n_steps + * +*/ + __pyx_t_1 = NULL; + __pyx_t_4 = PyList_New(0); if (unlikely(!__pyx_t_4)) __PYX_ERR(0, 671, __pyx_L1_error) + __Pyx_GOTREF(__pyx_t_4); + __pyx_t_2 = __pyx_v_states; __Pyx_INCREF(__pyx_t_2); + __pyx_t_5 = 0; + for (;;) { + { + Py_ssize_t __pyx_temp = __Pyx_PyList_GET_SIZE(__pyx_t_2); + #if !CYTHON_ASSUME_SAFE_SIZE + if (unlikely((__pyx_temp < 0))) __PYX_ERR(0, 671, __pyx_L1_error) + #endif + if (__pyx_t_5 >= __pyx_temp) break; + } + __pyx_t_7 = __Pyx_PyList_GetItemRefFast(__pyx_t_2, __pyx_t_5, __Pyx_ReferenceSharing_OwnStrongReference); + ++__pyx_t_5; + if (unlikely(!__pyx_t_7)) __PYX_ERR(0, 671, __pyx_L1_error) + __Pyx_GOTREF(__pyx_t_7); + __Pyx_XDECREF_SET(__pyx_v_s, __pyx_t_7); + __pyx_t_7 = 0; + __pyx_t_7 = __Pyx_PyObject_GetAttrStr(__pyx_v_s, __pyx_mstate_global->__pyx_n_u_queue); if (unlikely(!__pyx_t_7)) __PYX_ERR(0, 671, __pyx_L1_error) + __Pyx_GOTREF(__pyx_t_7); + __pyx_t_14 = PyObject_Length(__pyx_t_7); if (unlikely(__pyx_t_14 == ((Py_ssize_t)-1))) __PYX_ERR(0, 671, __pyx_L1_error) + __Pyx_DECREF(__pyx_t_7); __pyx_t_7 = 0; + __pyx_t_7 = PyLong_FromSsize_t(__pyx_t_14); if (unlikely(!__pyx_t_7)) __PYX_ERR(0, 671, __pyx_L1_error) + __Pyx_GOTREF(__pyx_t_7); + if (unlikely(__Pyx_ListComp_Append(__pyx_t_4, (PyObject*)__pyx_t_7))) __PYX_ERR(0, 671, __pyx_L1_error) + __Pyx_DECREF(__pyx_t_7); __pyx_t_7 = 0; + } + __Pyx_DECREF(__pyx_t_2); __pyx_t_2 = 0; + __pyx_t_8 = 1; + { + PyObject *__pyx_callargs[2] = {__pyx_t_1, __pyx_t_4}; + __pyx_t_3 = __Pyx_PyObject_FastCall((PyObject*)__pyx_builtin_sum, __pyx_callargs+__pyx_t_8, (2-__pyx_t_8) | (__pyx_t_8*__Pyx_PY_VECTORCALL_ARGUMENTS_OFFSET)); + __Pyx_XDECREF(__pyx_t_1); __pyx_t_1 = 0; + __Pyx_DECREF(__pyx_t_4); __pyx_t_4 = 0; + if (unlikely(!__pyx_t_3)) __PYX_ERR(0, 671, __pyx_L1_error) + __Pyx_GOTREF(__pyx_t_3); + } + __pyx_v_n_steps = __pyx_t_3; + __pyx_t_3 = 0; + + /* "spacy/pipeline/_parser_internals/arc_eager.pyx":672 + * states.append(state) + * n_steps = sum([len(s.queue) for s in states]) + * return states, golds, n_steps # <<<<<<<<<<<<<< + * + * def _replace_unseen_labels(self, ArcEagerGold gold): +*/ + __Pyx_XDECREF(__pyx_r); + __pyx_t_3 = PyTuple_New(3); if (unlikely(!__pyx_t_3)) __PYX_ERR(0, 672, __pyx_L1_error) + __Pyx_GOTREF(__pyx_t_3); + __Pyx_INCREF(__pyx_v_states); + __Pyx_GIVEREF(__pyx_v_states); + if (__Pyx_PyTuple_SET_ITEM(__pyx_t_3, 0, __pyx_v_states) != (0)) __PYX_ERR(0, 672, __pyx_L1_error); + __Pyx_INCREF(__pyx_v_golds); + __Pyx_GIVEREF(__pyx_v_golds); + if (__Pyx_PyTuple_SET_ITEM(__pyx_t_3, 1, __pyx_v_golds) != (0)) __PYX_ERR(0, 672, __pyx_L1_error); + __Pyx_INCREF(__pyx_v_n_steps); + __Pyx_GIVEREF(__pyx_v_n_steps); + if (__Pyx_PyTuple_SET_ITEM(__pyx_t_3, 2, __pyx_v_n_steps) != (0)) __PYX_ERR(0, 672, __pyx_L1_error); + __pyx_r = __pyx_t_3; + __pyx_t_3 = 0; + goto __pyx_L0; + + /* "spacy/pipeline/_parser_internals/arc_eager.pyx":662 + * return gold + * + * def init_gold_batch(self, examples): # <<<<<<<<<<<<<< + * # TODO: Projectivity? + * all_states = self.init_batch([eg.predicted for eg in examples]) +*/ + + /* function exit code */ + __pyx_L1_error:; + __Pyx_XDECREF(__pyx_t_1); + __Pyx_XDECREF(__pyx_t_2); + __Pyx_XDECREF(__pyx_t_3); + __Pyx_XDECREF(__pyx_t_4); + __Pyx_XDECREF(__pyx_t_7); + __Pyx_AddTraceback("spacy.pipeline._parser_internals.arc_eager.ArcEager.init_gold_batch", __pyx_clineno, __pyx_lineno, __pyx_filename); + __pyx_r = NULL; + __pyx_L0:; + __Pyx_XDECREF(__pyx_v_all_states); + __Pyx_XDECREF(__pyx_v_golds); + __Pyx_XDECREF(__pyx_v_states); + __Pyx_XDECREF(__pyx_v_state); + __Pyx_XDECREF(__pyx_v_eg); + __Pyx_XDECREF(__pyx_v_n_steps); + __Pyx_XDECREF(__pyx_v_s); + __Pyx_XGIVEREF(__pyx_r); + __Pyx_RefNannyFinishContext(); + return __pyx_r; +} + +/* "spacy/pipeline/_parser_internals/arc_eager.pyx":674 + * return states, golds, n_steps + * + * def _replace_unseen_labels(self, ArcEagerGold gold): # <<<<<<<<<<<<<< + * backoff_label = self.strings["dep"] + * root_label = self.strings["ROOT"] +*/ + +/* Python wrapper */ +static PyObject *__pyx_pw_5spacy_8pipeline_17_parser_internals_9arc_eager_8ArcEager_15_replace_unseen_labels(PyObject *__pyx_v_self, +#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_5spacy_8pipeline_17_parser_internals_9arc_eager_8ArcEager_14_replace_unseen_labels, "ArcEager._replace_unseen_labels(self, ArcEagerGold gold)"); +static PyMethodDef __pyx_mdef_5spacy_8pipeline_17_parser_internals_9arc_eager_8ArcEager_15_replace_unseen_labels = {"_replace_unseen_labels", (PyCFunction)(void(*)(void))(__Pyx_PyCFunction_FastCallWithKeywords)__pyx_pw_5spacy_8pipeline_17_parser_internals_9arc_eager_8ArcEager_15_replace_unseen_labels, __Pyx_METH_FASTCALL|METH_KEYWORDS, __pyx_doc_5spacy_8pipeline_17_parser_internals_9arc_eager_8ArcEager_14_replace_unseen_labels}; +static PyObject *__pyx_pw_5spacy_8pipeline_17_parser_internals_9arc_eager_8ArcEager_15_replace_unseen_labels(PyObject *__pyx_v_self, +#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_5spacy_8pipeline_17_parser_internals_9arc_eager_ArcEagerGold *__pyx_v_gold = 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("_replace_unseen_labels (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_gold,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, 674, __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, 674, __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, "_replace_unseen_labels", 0) < (0)) __PYX_ERR(0, 674, __pyx_L3_error) + for (Py_ssize_t i = __pyx_nargs; i < 1; i++) { + if (unlikely(!values[i])) { __Pyx_RaiseArgtupleInvalid("_replace_unseen_labels", 1, 1, 1, i); __PYX_ERR(0, 674, __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, 674, __pyx_L3_error) + } + __pyx_v_gold = ((struct __pyx_obj_5spacy_8pipeline_17_parser_internals_9arc_eager_ArcEagerGold *)values[0]); + } + goto __pyx_L6_skip; + __pyx_L5_argtuple_error:; + __Pyx_RaiseArgtupleInvalid("_replace_unseen_labels", 1, 1, 1, __pyx_nargs); __PYX_ERR(0, 674, __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("spacy.pipeline._parser_internals.arc_eager.ArcEager._replace_unseen_labels", __pyx_clineno, __pyx_lineno, __pyx_filename); + __Pyx_RefNannyFinishContext(); + return NULL; + __pyx_L4_argument_unpacking_done:; + if (unlikely(!__Pyx_ArgTypeTest(((PyObject *)__pyx_v_gold), __pyx_mstate_global->__pyx_ptype_5spacy_8pipeline_17_parser_internals_9arc_eager_ArcEagerGold, 1, "gold", 0))) __PYX_ERR(0, 674, __pyx_L1_error) + __pyx_r = __pyx_pf_5spacy_8pipeline_17_parser_internals_9arc_eager_8ArcEager_14_replace_unseen_labels(((struct __pyx_obj_5spacy_8pipeline_17_parser_internals_9arc_eager_ArcEager *)__pyx_v_self), __pyx_v_gold); + + /* 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_5spacy_8pipeline_17_parser_internals_9arc_eager_8ArcEager_14_replace_unseen_labels(struct __pyx_obj_5spacy_8pipeline_17_parser_internals_9arc_eager_ArcEager *__pyx_v_self, struct __pyx_obj_5spacy_8pipeline_17_parser_internals_9arc_eager_ArcEagerGold *__pyx_v_gold) { + PyObject *__pyx_v_backoff_label = NULL; + PyObject *__pyx_v_root_label = NULL; + PyObject *__pyx_v_left_labels = NULL; + PyObject *__pyx_v_right_labels = NULL; + PyObject *__pyx_v_break_labels = NULL; + int32_t __pyx_v_i; + int32_t __pyx_v_head; + PyObject *__pyx_v_label = NULL; + PyObject *__pyx_r = NULL; + __Pyx_RefNannyDeclarations + PyObject *__pyx_t_1 = NULL; + int32_t __pyx_t_2; + int32_t __pyx_t_3; + int32_t __pyx_t_4; + int __pyx_t_5; + int __pyx_t_6; + __pyx_t_5spacy_8typedefs_attr_t __pyx_t_7; + int __pyx_lineno = 0; + const char *__pyx_filename = NULL; + int __pyx_clineno = 0; + __Pyx_RefNannySetupContext("_replace_unseen_labels", 0); + + /* "spacy/pipeline/_parser_internals/arc_eager.pyx":675 + * + * def _replace_unseen_labels(self, ArcEagerGold gold): + * backoff_label = self.strings["dep"] # <<<<<<<<<<<<<< + * root_label = self.strings["ROOT"] + * left_labels = self.labels[LEFT] +*/ + __pyx_t_1 = __Pyx_PyObject_GetItem(((PyObject *)__pyx_v_self->__pyx_base.strings), __pyx_mstate_global->__pyx_n_u_dep); if (unlikely(!__pyx_t_1)) __PYX_ERR(0, 675, __pyx_L1_error) + __Pyx_GOTREF(__pyx_t_1); + __pyx_v_backoff_label = __pyx_t_1; + __pyx_t_1 = 0; + + /* "spacy/pipeline/_parser_internals/arc_eager.pyx":676 + * def _replace_unseen_labels(self, ArcEagerGold gold): + * backoff_label = self.strings["dep"] + * root_label = self.strings["ROOT"] # <<<<<<<<<<<<<< + * left_labels = self.labels[LEFT] + * right_labels = self.labels[RIGHT] +*/ + __pyx_t_1 = __Pyx_PyObject_GetItem(((PyObject *)__pyx_v_self->__pyx_base.strings), __pyx_mstate_global->__pyx_n_u_ROOT); if (unlikely(!__pyx_t_1)) __PYX_ERR(0, 676, __pyx_L1_error) + __Pyx_GOTREF(__pyx_t_1); + __pyx_v_root_label = __pyx_t_1; + __pyx_t_1 = 0; + + /* "spacy/pipeline/_parser_internals/arc_eager.pyx":677 + * backoff_label = self.strings["dep"] + * root_label = self.strings["ROOT"] + * left_labels = self.labels[LEFT] # <<<<<<<<<<<<<< + * right_labels = self.labels[RIGHT] + * break_labels = self.labels[BREAK] +*/ + __pyx_t_1 = __Pyx_GetItemInt(__pyx_v_self->__pyx_base.labels, __pyx_e_5spacy_8pipeline_17_parser_internals_9arc_eager_LEFT, int, 1, __Pyx_PyLong_From___pyx_anon_enum, 0, 1, 1, 1, __Pyx_ReferenceSharing_SharedReference); if (unlikely(!__pyx_t_1)) __PYX_ERR(0, 677, __pyx_L1_error) + __Pyx_GOTREF(__pyx_t_1); + __pyx_v_left_labels = __pyx_t_1; + __pyx_t_1 = 0; + + /* "spacy/pipeline/_parser_internals/arc_eager.pyx":678 + * root_label = self.strings["ROOT"] + * left_labels = self.labels[LEFT] + * right_labels = self.labels[RIGHT] # <<<<<<<<<<<<<< + * break_labels = self.labels[BREAK] + * for i in range(gold.c.length): +*/ + __pyx_t_1 = __Pyx_GetItemInt(__pyx_v_self->__pyx_base.labels, __pyx_e_5spacy_8pipeline_17_parser_internals_9arc_eager_RIGHT, int, 1, __Pyx_PyLong_From___pyx_anon_enum, 0, 1, 1, 1, __Pyx_ReferenceSharing_SharedReference); if (unlikely(!__pyx_t_1)) __PYX_ERR(0, 678, __pyx_L1_error) + __Pyx_GOTREF(__pyx_t_1); + __pyx_v_right_labels = __pyx_t_1; + __pyx_t_1 = 0; + + /* "spacy/pipeline/_parser_internals/arc_eager.pyx":679 + * left_labels = self.labels[LEFT] + * right_labels = self.labels[RIGHT] + * break_labels = self.labels[BREAK] # <<<<<<<<<<<<<< + * for i in range(gold.c.length): + * if not is_head_unknown(&gold.c, i): +*/ + __pyx_t_1 = __Pyx_GetItemInt(__pyx_v_self->__pyx_base.labels, __pyx_e_5spacy_8pipeline_17_parser_internals_9arc_eager_BREAK, int, 1, __Pyx_PyLong_From___pyx_anon_enum, 0, 1, 1, 1, __Pyx_ReferenceSharing_SharedReference); if (unlikely(!__pyx_t_1)) __PYX_ERR(0, 679, __pyx_L1_error) + __Pyx_GOTREF(__pyx_t_1); + __pyx_v_break_labels = __pyx_t_1; + __pyx_t_1 = 0; + + /* "spacy/pipeline/_parser_internals/arc_eager.pyx":680 + * right_labels = self.labels[RIGHT] + * break_labels = self.labels[BREAK] + * for i in range(gold.c.length): # <<<<<<<<<<<<<< + * if not is_head_unknown(&gold.c, i): + * head = gold.c.heads[i] +*/ + __pyx_t_2 = __pyx_v_gold->c.length; + __pyx_t_3 = __pyx_t_2; + for (__pyx_t_4 = 0; __pyx_t_4 < __pyx_t_3; __pyx_t_4+=1) { + __pyx_v_i = __pyx_t_4; + + /* "spacy/pipeline/_parser_internals/arc_eager.pyx":681 + * break_labels = self.labels[BREAK] + * for i in range(gold.c.length): + * if not is_head_unknown(&gold.c, i): # <<<<<<<<<<<<<< + * head = gold.c.heads[i] + * label = self.strings[gold.c.labels[i]] +*/ + __pyx_t_5 = (!(__pyx_f_5spacy_8pipeline_17_parser_internals_9arc_eager_is_head_unknown((&__pyx_v_gold->c), __pyx_v_i) != 0)); + if (__pyx_t_5) { + + /* "spacy/pipeline/_parser_internals/arc_eager.pyx":682 + * for i in range(gold.c.length): + * if not is_head_unknown(&gold.c, i): + * head = gold.c.heads[i] # <<<<<<<<<<<<<< + * label = self.strings[gold.c.labels[i]] + * if head > i and label not in left_labels: +*/ + __pyx_v_head = (__pyx_v_gold->c.heads[__pyx_v_i]); + + /* "spacy/pipeline/_parser_internals/arc_eager.pyx":683 + * if not is_head_unknown(&gold.c, i): + * head = gold.c.heads[i] + * label = self.strings[gold.c.labels[i]] # <<<<<<<<<<<<<< + * if head > i and label not in left_labels: + * gold.c.labels[i] = backoff_label +*/ + __pyx_t_1 = __Pyx_GetItemInt(((PyObject *)__pyx_v_self->__pyx_base.strings), (__pyx_v_gold->c.labels[__pyx_v_i]), __pyx_t_5spacy_8typedefs_attr_t, 0, __Pyx_PyLong_From_uint64_t, 0, 0, 1, 1, __Pyx_ReferenceSharing_SharedReference); if (unlikely(!__pyx_t_1)) __PYX_ERR(0, 683, __pyx_L1_error) + __Pyx_GOTREF(__pyx_t_1); + __Pyx_XDECREF_SET(__pyx_v_label, __pyx_t_1); + __pyx_t_1 = 0; + + /* "spacy/pipeline/_parser_internals/arc_eager.pyx":684 + * head = gold.c.heads[i] + * label = self.strings[gold.c.labels[i]] + * if head > i and label not in left_labels: # <<<<<<<<<<<<<< + * gold.c.labels[i] = backoff_label + * elif head < i and label not in right_labels: +*/ + __pyx_t_6 = (__pyx_v_head > __pyx_v_i); + if (__pyx_t_6) { + } else { + __pyx_t_5 = __pyx_t_6; + goto __pyx_L7_bool_binop_done; + } + __pyx_t_6 = (__Pyx_PySequence_ContainsTF(__pyx_v_label, __pyx_v_left_labels, Py_NE)); if (unlikely((__pyx_t_6 < 0))) __PYX_ERR(0, 684, __pyx_L1_error) + __pyx_t_5 = __pyx_t_6; + __pyx_L7_bool_binop_done:; + if (__pyx_t_5) { + + /* "spacy/pipeline/_parser_internals/arc_eager.pyx":685 + * label = self.strings[gold.c.labels[i]] + * if head > i and label not in left_labels: + * gold.c.labels[i] = backoff_label # <<<<<<<<<<<<<< + * elif head < i and label not in right_labels: + * gold.c.labels[i] = backoff_label +*/ + __pyx_t_7 = __Pyx_PyLong_As_uint64_t(__pyx_v_backoff_label); if (unlikely((__pyx_t_7 == ((uint64_t)-1)) && PyErr_Occurred())) __PYX_ERR(0, 685, __pyx_L1_error) + (__pyx_v_gold->c.labels[__pyx_v_i]) = __pyx_t_7; + + /* "spacy/pipeline/_parser_internals/arc_eager.pyx":684 + * head = gold.c.heads[i] + * label = self.strings[gold.c.labels[i]] + * if head > i and label not in left_labels: # <<<<<<<<<<<<<< + * gold.c.labels[i] = backoff_label + * elif head < i and label not in right_labels: +*/ + goto __pyx_L6; + } + + /* "spacy/pipeline/_parser_internals/arc_eager.pyx":686 + * if head > i and label not in left_labels: + * gold.c.labels[i] = backoff_label + * elif head < i and label not in right_labels: # <<<<<<<<<<<<<< + * gold.c.labels[i] = backoff_label + * elif head == i and label not in break_labels: +*/ + __pyx_t_6 = (__pyx_v_head < __pyx_v_i); + if (__pyx_t_6) { + } else { + __pyx_t_5 = __pyx_t_6; + goto __pyx_L9_bool_binop_done; + } + __pyx_t_6 = (__Pyx_PySequence_ContainsTF(__pyx_v_label, __pyx_v_right_labels, Py_NE)); if (unlikely((__pyx_t_6 < 0))) __PYX_ERR(0, 686, __pyx_L1_error) + __pyx_t_5 = __pyx_t_6; + __pyx_L9_bool_binop_done:; + if (__pyx_t_5) { + + /* "spacy/pipeline/_parser_internals/arc_eager.pyx":687 + * gold.c.labels[i] = backoff_label + * elif head < i and label not in right_labels: + * gold.c.labels[i] = backoff_label # <<<<<<<<<<<<<< + * elif head == i and label not in break_labels: + * gold.c.labels[i] = root_label +*/ + __pyx_t_7 = __Pyx_PyLong_As_uint64_t(__pyx_v_backoff_label); if (unlikely((__pyx_t_7 == ((uint64_t)-1)) && PyErr_Occurred())) __PYX_ERR(0, 687, __pyx_L1_error) + (__pyx_v_gold->c.labels[__pyx_v_i]) = __pyx_t_7; + + /* "spacy/pipeline/_parser_internals/arc_eager.pyx":686 + * if head > i and label not in left_labels: + * gold.c.labels[i] = backoff_label + * elif head < i and label not in right_labels: # <<<<<<<<<<<<<< + * gold.c.labels[i] = backoff_label + * elif head == i and label not in break_labels: +*/ + goto __pyx_L6; + } + + /* "spacy/pipeline/_parser_internals/arc_eager.pyx":688 + * elif head < i and label not in right_labels: + * gold.c.labels[i] = backoff_label + * elif head == i and label not in break_labels: # <<<<<<<<<<<<<< + * gold.c.labels[i] = root_label + * return gold +*/ + __pyx_t_6 = (__pyx_v_head == __pyx_v_i); + if (__pyx_t_6) { + } else { + __pyx_t_5 = __pyx_t_6; + goto __pyx_L11_bool_binop_done; + } + __pyx_t_6 = (__Pyx_PySequence_ContainsTF(__pyx_v_label, __pyx_v_break_labels, Py_NE)); if (unlikely((__pyx_t_6 < 0))) __PYX_ERR(0, 688, __pyx_L1_error) + __pyx_t_5 = __pyx_t_6; + __pyx_L11_bool_binop_done:; + if (__pyx_t_5) { + + /* "spacy/pipeline/_parser_internals/arc_eager.pyx":689 + * gold.c.labels[i] = backoff_label + * elif head == i and label not in break_labels: + * gold.c.labels[i] = root_label # <<<<<<<<<<<<<< + * return gold + * +*/ + __pyx_t_7 = __Pyx_PyLong_As_uint64_t(__pyx_v_root_label); if (unlikely((__pyx_t_7 == ((uint64_t)-1)) && PyErr_Occurred())) __PYX_ERR(0, 689, __pyx_L1_error) + (__pyx_v_gold->c.labels[__pyx_v_i]) = __pyx_t_7; + + /* "spacy/pipeline/_parser_internals/arc_eager.pyx":688 + * elif head < i and label not in right_labels: + * gold.c.labels[i] = backoff_label + * elif head == i and label not in break_labels: # <<<<<<<<<<<<<< + * gold.c.labels[i] = root_label + * return gold +*/ + } + __pyx_L6:; + + /* "spacy/pipeline/_parser_internals/arc_eager.pyx":681 + * break_labels = self.labels[BREAK] + * for i in range(gold.c.length): + * if not is_head_unknown(&gold.c, i): # <<<<<<<<<<<<<< + * head = gold.c.heads[i] + * label = self.strings[gold.c.labels[i]] +*/ + } + } + + /* "spacy/pipeline/_parser_internals/arc_eager.pyx":690 + * elif head == i and label not in break_labels: + * gold.c.labels[i] = root_label + * return gold # <<<<<<<<<<<<<< + * + * cdef Transition lookup_transition(self, object name_or_id) except *: +*/ + __Pyx_XDECREF(__pyx_r); + __Pyx_INCREF((PyObject *)__pyx_v_gold); + __pyx_r = ((PyObject *)__pyx_v_gold); + goto __pyx_L0; + + /* "spacy/pipeline/_parser_internals/arc_eager.pyx":674 + * return states, golds, n_steps + * + * def _replace_unseen_labels(self, ArcEagerGold gold): # <<<<<<<<<<<<<< + * backoff_label = self.strings["dep"] + * root_label = self.strings["ROOT"] +*/ + + /* function exit code */ + __pyx_L1_error:; + __Pyx_XDECREF(__pyx_t_1); + __Pyx_AddTraceback("spacy.pipeline._parser_internals.arc_eager.ArcEager._replace_unseen_labels", __pyx_clineno, __pyx_lineno, __pyx_filename); + __pyx_r = NULL; + __pyx_L0:; + __Pyx_XDECREF(__pyx_v_backoff_label); + __Pyx_XDECREF(__pyx_v_root_label); + __Pyx_XDECREF(__pyx_v_left_labels); + __Pyx_XDECREF(__pyx_v_right_labels); + __Pyx_XDECREF(__pyx_v_break_labels); + __Pyx_XDECREF(__pyx_v_label); + __Pyx_XGIVEREF(__pyx_r); + __Pyx_RefNannyFinishContext(); + return __pyx_r; +} + +/* "spacy/pipeline/_parser_internals/arc_eager.pyx":692 + * return gold + * + * cdef Transition lookup_transition(self, object name_or_id) except *: # <<<<<<<<<<<<<< + * if isinstance(name_or_id, int): + * return self.c[name_or_id] +*/ + +static struct __pyx_t_5spacy_8pipeline_17_parser_internals_17transition_system_Transition __pyx_f_5spacy_8pipeline_17_parser_internals_9arc_eager_8ArcEager_lookup_transition(struct __pyx_obj_5spacy_8pipeline_17_parser_internals_9arc_eager_ArcEager *__pyx_v_self, PyObject *__pyx_v_name_or_id) { + PyObject *__pyx_v_name = NULL; + PyObject *__pyx_v_move_str = NULL; + PyObject *__pyx_v_label_str = NULL; + PyObject *__pyx_v_label = NULL; + PyObject *__pyx_v_move = NULL; + int __pyx_v_i; + struct __pyx_t_5spacy_8pipeline_17_parser_internals_17transition_system_Transition __pyx_r; + __Pyx_RefNannyDeclarations + int __pyx_t_1; + Py_ssize_t __pyx_t_2; + PyObject *__pyx_t_3 = NULL; + PyObject *__pyx_t_4 = NULL; + PyObject *__pyx_t_5 = NULL; + size_t __pyx_t_6; + PyObject *__pyx_t_7 = NULL; + PyObject *(*__pyx_t_8)(PyObject *); + int __pyx_t_9; + int __pyx_t_10; + int __pyx_t_11; + int __pyx_t_12; + int __pyx_lineno = 0; + const char *__pyx_filename = NULL; + int __pyx_clineno = 0; + __Pyx_RefNannySetupContext("lookup_transition", 0); + + /* "spacy/pipeline/_parser_internals/arc_eager.pyx":693 + * + * cdef Transition lookup_transition(self, object name_or_id) except *: + * if isinstance(name_or_id, int): # <<<<<<<<<<<<<< + * return self.c[name_or_id] + * name = name_or_id +*/ + __pyx_t_1 = PyLong_Check(__pyx_v_name_or_id); + if (__pyx_t_1) { + + /* "spacy/pipeline/_parser_internals/arc_eager.pyx":694 + * cdef Transition lookup_transition(self, object name_or_id) except *: + * if isinstance(name_or_id, int): + * return self.c[name_or_id] # <<<<<<<<<<<<<< + * name = name_or_id + * if '-' in name: +*/ + __pyx_t_2 = __Pyx_PyIndex_AsSsize_t(__pyx_v_name_or_id); if (unlikely((__pyx_t_2 == (Py_ssize_t)-1) && PyErr_Occurred())) __PYX_ERR(0, 694, __pyx_L1_error) + __pyx_r = (__pyx_v_self->__pyx_base.c[__pyx_t_2]); + goto __pyx_L0; + + /* "spacy/pipeline/_parser_internals/arc_eager.pyx":693 + * + * cdef Transition lookup_transition(self, object name_or_id) except *: + * if isinstance(name_or_id, int): # <<<<<<<<<<<<<< + * return self.c[name_or_id] + * name = name_or_id +*/ + } + + /* "spacy/pipeline/_parser_internals/arc_eager.pyx":695 + * if isinstance(name_or_id, int): + * return self.c[name_or_id] + * name = name_or_id # <<<<<<<<<<<<<< + * if '-' in name: + * move_str, label_str = split_bilu_label(name) +*/ + __Pyx_INCREF(__pyx_v_name_or_id); + __pyx_v_name = __pyx_v_name_or_id; + + /* "spacy/pipeline/_parser_internals/arc_eager.pyx":696 + * return self.c[name_or_id] + * name = name_or_id + * if '-' in name: # <<<<<<<<<<<<<< + * move_str, label_str = split_bilu_label(name) + * label = self.strings[label_str] +*/ + __pyx_t_1 = (__Pyx_PySequence_ContainsTF(__pyx_mstate_global->__pyx_kp_u__7, __pyx_v_name, Py_EQ)); if (unlikely((__pyx_t_1 < 0))) __PYX_ERR(0, 696, __pyx_L1_error) + if (__pyx_t_1) { + + /* "spacy/pipeline/_parser_internals/arc_eager.pyx":697 + * name = name_or_id + * if '-' in name: + * move_str, label_str = split_bilu_label(name) # <<<<<<<<<<<<<< + * label = self.strings[label_str] + * else: +*/ + __pyx_t_4 = NULL; + __Pyx_GetModuleGlobalName(__pyx_t_5, __pyx_mstate_global->__pyx_n_u_split_bilu_label); if (unlikely(!__pyx_t_5)) __PYX_ERR(0, 697, __pyx_L1_error) + __Pyx_GOTREF(__pyx_t_5); + __pyx_t_6 = 1; + #if CYTHON_UNPACK_METHODS + if (unlikely(PyMethod_Check(__pyx_t_5))) { + __pyx_t_4 = PyMethod_GET_SELF(__pyx_t_5); + assert(__pyx_t_4); + PyObject* __pyx__function = PyMethod_GET_FUNCTION(__pyx_t_5); + __Pyx_INCREF(__pyx_t_4); + __Pyx_INCREF(__pyx__function); + __Pyx_DECREF_SET(__pyx_t_5, __pyx__function); + __pyx_t_6 = 0; + } + #endif + { + PyObject *__pyx_callargs[2] = {__pyx_t_4, __pyx_v_name}; + __pyx_t_3 = __Pyx_PyObject_FastCall((PyObject*)__pyx_t_5, __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; + __Pyx_DECREF(__pyx_t_5); __pyx_t_5 = 0; + if (unlikely(!__pyx_t_3)) __PYX_ERR(0, 697, __pyx_L1_error) + __Pyx_GOTREF(__pyx_t_3); + } + if ((likely(PyTuple_CheckExact(__pyx_t_3))) || (PyList_CheckExact(__pyx_t_3))) { + PyObject* sequence = __pyx_t_3; + 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, 697, __pyx_L1_error) + } + #if CYTHON_ASSUME_SAFE_MACROS && !CYTHON_AVOID_BORROWED_REFS + if (likely(PyTuple_CheckExact(sequence))) { + __pyx_t_5 = PyTuple_GET_ITEM(sequence, 0); + __Pyx_INCREF(__pyx_t_5); + __pyx_t_4 = PyTuple_GET_ITEM(sequence, 1); + __Pyx_INCREF(__pyx_t_4); + } else { + __pyx_t_5 = __Pyx_PyList_GetItemRefFast(sequence, 0, __Pyx_ReferenceSharing_SharedReference); + if (unlikely(!__pyx_t_5)) __PYX_ERR(0, 697, __pyx_L1_error) + __Pyx_XGOTREF(__pyx_t_5); + __pyx_t_4 = __Pyx_PyList_GetItemRefFast(sequence, 1, __Pyx_ReferenceSharing_SharedReference); + if (unlikely(!__pyx_t_4)) __PYX_ERR(0, 697, __pyx_L1_error) + __Pyx_XGOTREF(__pyx_t_4); + } + #else + __pyx_t_5 = __Pyx_PySequence_ITEM(sequence, 0); if (unlikely(!__pyx_t_5)) __PYX_ERR(0, 697, __pyx_L1_error) + __Pyx_GOTREF(__pyx_t_5); + __pyx_t_4 = __Pyx_PySequence_ITEM(sequence, 1); if (unlikely(!__pyx_t_4)) __PYX_ERR(0, 697, __pyx_L1_error) + __Pyx_GOTREF(__pyx_t_4); + #endif + __Pyx_DECREF(__pyx_t_3); __pyx_t_3 = 0; + } else { + Py_ssize_t index = -1; + __pyx_t_7 = PyObject_GetIter(__pyx_t_3); if (unlikely(!__pyx_t_7)) __PYX_ERR(0, 697, __pyx_L1_error) + __Pyx_GOTREF(__pyx_t_7); + __Pyx_DECREF(__pyx_t_3); __pyx_t_3 = 0; + __pyx_t_8 = (CYTHON_COMPILING_IN_LIMITED_API) ? PyIter_Next : __Pyx_PyObject_GetIterNextFunc(__pyx_t_7); + index = 0; __pyx_t_5 = __pyx_t_8(__pyx_t_7); if (unlikely(!__pyx_t_5)) goto __pyx_L5_unpacking_failed; + __Pyx_GOTREF(__pyx_t_5); + index = 1; __pyx_t_4 = __pyx_t_8(__pyx_t_7); if (unlikely(!__pyx_t_4)) goto __pyx_L5_unpacking_failed; + __Pyx_GOTREF(__pyx_t_4); + if (__Pyx_IternextUnpackEndCheck(__pyx_t_8(__pyx_t_7), 2) < (0)) __PYX_ERR(0, 697, __pyx_L1_error) + __pyx_t_8 = NULL; + __Pyx_DECREF(__pyx_t_7); __pyx_t_7 = 0; + goto __pyx_L6_unpacking_done; + __pyx_L5_unpacking_failed:; + __Pyx_DECREF(__pyx_t_7); __pyx_t_7 = 0; + __pyx_t_8 = NULL; + if (__Pyx_IterFinish() == 0) __Pyx_RaiseNeedMoreValuesError(index); + __PYX_ERR(0, 697, __pyx_L1_error) + __pyx_L6_unpacking_done:; + } + __pyx_v_move_str = __pyx_t_5; + __pyx_t_5 = 0; + __pyx_v_label_str = __pyx_t_4; + __pyx_t_4 = 0; + + /* "spacy/pipeline/_parser_internals/arc_eager.pyx":698 + * if '-' in name: + * move_str, label_str = split_bilu_label(name) + * label = self.strings[label_str] # <<<<<<<<<<<<<< + * else: + * move_str = name +*/ + __pyx_t_3 = __Pyx_PyObject_GetItem(((PyObject *)__pyx_v_self->__pyx_base.strings), __pyx_v_label_str); if (unlikely(!__pyx_t_3)) __PYX_ERR(0, 698, __pyx_L1_error) + __Pyx_GOTREF(__pyx_t_3); + __pyx_v_label = __pyx_t_3; + __pyx_t_3 = 0; + + /* "spacy/pipeline/_parser_internals/arc_eager.pyx":696 + * return self.c[name_or_id] + * name = name_or_id + * if '-' in name: # <<<<<<<<<<<<<< + * move_str, label_str = split_bilu_label(name) + * label = self.strings[label_str] +*/ + goto __pyx_L4; + } + + /* "spacy/pipeline/_parser_internals/arc_eager.pyx":700 + * label = self.strings[label_str] + * else: + * move_str = name # <<<<<<<<<<<<<< + * label = 0 + * move = MOVE_NAMES.index(move_str) +*/ + /*else*/ { + __Pyx_INCREF(__pyx_v_name); + __pyx_v_move_str = __pyx_v_name; + + /* "spacy/pipeline/_parser_internals/arc_eager.pyx":701 + * else: + * move_str = name + * label = 0 # <<<<<<<<<<<<<< + * move = MOVE_NAMES.index(move_str) + * for i in range(self.n_moves): +*/ + __Pyx_INCREF(__pyx_mstate_global->__pyx_int_0); + __pyx_v_label = __pyx_mstate_global->__pyx_int_0; + } + __pyx_L4:; + + /* "spacy/pipeline/_parser_internals/arc_eager.pyx":702 + * move_str = name + * label = 0 + * move = MOVE_NAMES.index(move_str) # <<<<<<<<<<<<<< + * for i in range(self.n_moves): + * if self.c[i].move == move and self.c[i].label == label: +*/ + __pyx_t_4 = NULL; + __Pyx_GetModuleGlobalName(__pyx_t_5, __pyx_mstate_global->__pyx_n_u_MOVE_NAMES); if (unlikely(!__pyx_t_5)) __PYX_ERR(0, 702, __pyx_L1_error) + __Pyx_GOTREF(__pyx_t_5); + __pyx_t_7 = __Pyx_PyObject_GetAttrStr(__pyx_t_5, __pyx_mstate_global->__pyx_n_u_index); if (unlikely(!__pyx_t_7)) __PYX_ERR(0, 702, __pyx_L1_error) + __Pyx_GOTREF(__pyx_t_7); + __Pyx_DECREF(__pyx_t_5); __pyx_t_5 = 0; + __pyx_t_6 = 1; + #if CYTHON_UNPACK_METHODS + if (unlikely(PyMethod_Check(__pyx_t_7))) { + __pyx_t_4 = PyMethod_GET_SELF(__pyx_t_7); + assert(__pyx_t_4); + PyObject* __pyx__function = PyMethod_GET_FUNCTION(__pyx_t_7); + __Pyx_INCREF(__pyx_t_4); + __Pyx_INCREF(__pyx__function); + __Pyx_DECREF_SET(__pyx_t_7, __pyx__function); + __pyx_t_6 = 0; + } + #endif + { + PyObject *__pyx_callargs[2] = {__pyx_t_4, __pyx_v_move_str}; + __pyx_t_3 = __Pyx_PyObject_FastCall((PyObject*)__pyx_t_7, __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; + __Pyx_DECREF(__pyx_t_7); __pyx_t_7 = 0; + if (unlikely(!__pyx_t_3)) __PYX_ERR(0, 702, __pyx_L1_error) + __Pyx_GOTREF(__pyx_t_3); + } + __pyx_v_move = __pyx_t_3; + __pyx_t_3 = 0; + + /* "spacy/pipeline/_parser_internals/arc_eager.pyx":703 + * label = 0 + * move = MOVE_NAMES.index(move_str) + * for i in range(self.n_moves): # <<<<<<<<<<<<<< + * if self.c[i].move == move and self.c[i].label == label: + * return self.c[i] +*/ + __pyx_t_9 = __pyx_v_self->__pyx_base.n_moves; + __pyx_t_10 = __pyx_t_9; + for (__pyx_t_11 = 0; __pyx_t_11 < __pyx_t_10; __pyx_t_11+=1) { + __pyx_v_i = __pyx_t_11; + + /* "spacy/pipeline/_parser_internals/arc_eager.pyx":704 + * move = MOVE_NAMES.index(move_str) + * for i in range(self.n_moves): + * if self.c[i].move == move and self.c[i].label == label: # <<<<<<<<<<<<<< + * return self.c[i] + * raise KeyError(f"Unknown transition: {name}") +*/ + __pyx_t_3 = __Pyx_PyLong_From_int((__pyx_v_self->__pyx_base.c[__pyx_v_i]).move); if (unlikely(!__pyx_t_3)) __PYX_ERR(0, 704, __pyx_L1_error) + __Pyx_GOTREF(__pyx_t_3); + __pyx_t_7 = PyObject_RichCompare(__pyx_t_3, __pyx_v_move, Py_EQ); __Pyx_XGOTREF(__pyx_t_7); if (unlikely(!__pyx_t_7)) __PYX_ERR(0, 704, __pyx_L1_error) + __Pyx_DECREF(__pyx_t_3); __pyx_t_3 = 0; + __pyx_t_12 = __Pyx_PyObject_IsTrue(__pyx_t_7); if (unlikely((__pyx_t_12 < 0))) __PYX_ERR(0, 704, __pyx_L1_error) + __Pyx_DECREF(__pyx_t_7); __pyx_t_7 = 0; + if (__pyx_t_12) { + } else { + __pyx_t_1 = __pyx_t_12; + goto __pyx_L10_bool_binop_done; + } + __pyx_t_7 = __Pyx_PyLong_From_uint64_t((__pyx_v_self->__pyx_base.c[__pyx_v_i]).label); if (unlikely(!__pyx_t_7)) __PYX_ERR(0, 704, __pyx_L1_error) + __Pyx_GOTREF(__pyx_t_7); + __pyx_t_3 = PyObject_RichCompare(__pyx_t_7, __pyx_v_label, Py_EQ); __Pyx_XGOTREF(__pyx_t_3); if (unlikely(!__pyx_t_3)) __PYX_ERR(0, 704, __pyx_L1_error) + __Pyx_DECREF(__pyx_t_7); __pyx_t_7 = 0; + __pyx_t_12 = __Pyx_PyObject_IsTrue(__pyx_t_3); if (unlikely((__pyx_t_12 < 0))) __PYX_ERR(0, 704, __pyx_L1_error) + __Pyx_DECREF(__pyx_t_3); __pyx_t_3 = 0; + __pyx_t_1 = __pyx_t_12; + __pyx_L10_bool_binop_done:; + if (__pyx_t_1) { + + /* "spacy/pipeline/_parser_internals/arc_eager.pyx":705 + * for i in range(self.n_moves): + * if self.c[i].move == move and self.c[i].label == label: + * return self.c[i] # <<<<<<<<<<<<<< + * raise KeyError(f"Unknown transition: {name}") + * +*/ + __pyx_r = (__pyx_v_self->__pyx_base.c[__pyx_v_i]); + goto __pyx_L0; + + /* "spacy/pipeline/_parser_internals/arc_eager.pyx":704 + * move = MOVE_NAMES.index(move_str) + * for i in range(self.n_moves): + * if self.c[i].move == move and self.c[i].label == label: # <<<<<<<<<<<<<< + * return self.c[i] + * raise KeyError(f"Unknown transition: {name}") +*/ + } + } + + /* "spacy/pipeline/_parser_internals/arc_eager.pyx":706 + * if self.c[i].move == move and self.c[i].label == label: + * return self.c[i] + * raise KeyError(f"Unknown transition: {name}") # <<<<<<<<<<<<<< + * + * def move_name(self, int move, attr_t label): +*/ + __pyx_t_7 = NULL; + __pyx_t_4 = __Pyx_PyObject_FormatSimple(__pyx_v_name, __pyx_mstate_global->__pyx_empty_unicode); if (unlikely(!__pyx_t_4)) __PYX_ERR(0, 706, __pyx_L1_error) + __Pyx_GOTREF(__pyx_t_4); + __pyx_t_5 = __Pyx_PyUnicode_Concat(__pyx_mstate_global->__pyx_kp_u_Unknown_transition, __pyx_t_4); if (unlikely(!__pyx_t_5)) __PYX_ERR(0, 706, __pyx_L1_error) + __Pyx_GOTREF(__pyx_t_5); + __Pyx_DECREF(__pyx_t_4); __pyx_t_4 = 0; + __pyx_t_6 = 1; + { + PyObject *__pyx_callargs[2] = {__pyx_t_7, __pyx_t_5}; + __pyx_t_3 = __Pyx_PyObject_FastCall((PyObject*)(((PyTypeObject*)PyExc_KeyError)), __pyx_callargs+__pyx_t_6, (2-__pyx_t_6) | (__pyx_t_6*__Pyx_PY_VECTORCALL_ARGUMENTS_OFFSET)); + __Pyx_XDECREF(__pyx_t_7); __pyx_t_7 = 0; + __Pyx_DECREF(__pyx_t_5); __pyx_t_5 = 0; + if (unlikely(!__pyx_t_3)) __PYX_ERR(0, 706, __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, 706, __pyx_L1_error) + + /* "spacy/pipeline/_parser_internals/arc_eager.pyx":692 + * return gold + * + * cdef Transition lookup_transition(self, object name_or_id) except *: # <<<<<<<<<<<<<< + * if isinstance(name_or_id, int): + * return self.c[name_or_id] +*/ + + /* 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_AddTraceback("spacy.pipeline._parser_internals.arc_eager.ArcEager.lookup_transition", __pyx_clineno, __pyx_lineno, __pyx_filename); + __Pyx_pretend_to_initialize(&__pyx_r); + __pyx_L0:; + __Pyx_XDECREF(__pyx_v_name); + __Pyx_XDECREF(__pyx_v_move_str); + __Pyx_XDECREF(__pyx_v_label_str); + __Pyx_XDECREF(__pyx_v_label); + __Pyx_XDECREF(__pyx_v_move); + __Pyx_RefNannyFinishContext(); + return __pyx_r; +} + +/* "spacy/pipeline/_parser_internals/arc_eager.pyx":708 + * raise KeyError(f"Unknown transition: {name}") + * + * def move_name(self, int move, attr_t label): # <<<<<<<<<<<<<< + * label_str = self.strings[label] + * if label_str: +*/ + +/* Python wrapper */ +static PyObject *__pyx_pw_5spacy_8pipeline_17_parser_internals_9arc_eager_8ArcEager_17move_name(PyObject *__pyx_v_self, +#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_5spacy_8pipeline_17_parser_internals_9arc_eager_8ArcEager_16move_name, "ArcEager.move_name(self, int move, attr_t label)"); +static PyMethodDef __pyx_mdef_5spacy_8pipeline_17_parser_internals_9arc_eager_8ArcEager_17move_name = {"move_name", (PyCFunction)(void(*)(void))(__Pyx_PyCFunction_FastCallWithKeywords)__pyx_pw_5spacy_8pipeline_17_parser_internals_9arc_eager_8ArcEager_17move_name, __Pyx_METH_FASTCALL|METH_KEYWORDS, __pyx_doc_5spacy_8pipeline_17_parser_internals_9arc_eager_8ArcEager_16move_name}; +static PyObject *__pyx_pw_5spacy_8pipeline_17_parser_internals_9arc_eager_8ArcEager_17move_name(PyObject *__pyx_v_self, +#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_move; + __pyx_t_5spacy_8typedefs_attr_t __pyx_v_label; + #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("move_name (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_move,&__pyx_mstate_global->__pyx_n_u_label,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, 708, __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, 708, __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, 708, __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, "move_name", 0) < (0)) __PYX_ERR(0, 708, __pyx_L3_error) + for (Py_ssize_t i = __pyx_nargs; i < 2; i++) { + if (unlikely(!values[i])) { __Pyx_RaiseArgtupleInvalid("move_name", 1, 2, 2, i); __PYX_ERR(0, 708, __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, 708, __pyx_L3_error) + values[1] = __Pyx_ArgRef_FASTCALL(__pyx_args, 1); + if (!CYTHON_ASSUME_SAFE_MACROS && unlikely(!values[1])) __PYX_ERR(0, 708, __pyx_L3_error) + } + __pyx_v_move = __Pyx_PyLong_As_int(values[0]); if (unlikely((__pyx_v_move == (int)-1) && PyErr_Occurred())) __PYX_ERR(0, 708, __pyx_L3_error) + __pyx_v_label = __Pyx_PyLong_As_uint64_t(values[1]); if (unlikely((__pyx_v_label == ((uint64_t)-1)) && PyErr_Occurred())) __PYX_ERR(0, 708, __pyx_L3_error) + } + goto __pyx_L6_skip; + __pyx_L5_argtuple_error:; + __Pyx_RaiseArgtupleInvalid("move_name", 1, 2, 2, __pyx_nargs); __PYX_ERR(0, 708, __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("spacy.pipeline._parser_internals.arc_eager.ArcEager.move_name", __pyx_clineno, __pyx_lineno, __pyx_filename); + __Pyx_RefNannyFinishContext(); + return NULL; + __pyx_L4_argument_unpacking_done:; + __pyx_r = __pyx_pf_5spacy_8pipeline_17_parser_internals_9arc_eager_8ArcEager_16move_name(((struct __pyx_obj_5spacy_8pipeline_17_parser_internals_9arc_eager_ArcEager *)__pyx_v_self), __pyx_v_move, __pyx_v_label); + + /* 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_5spacy_8pipeline_17_parser_internals_9arc_eager_8ArcEager_16move_name(struct __pyx_obj_5spacy_8pipeline_17_parser_internals_9arc_eager_ArcEager *__pyx_v_self, int __pyx_v_move, __pyx_t_5spacy_8typedefs_attr_t __pyx_v_label) { + PyObject *__pyx_v_label_str = NULL; + PyObject *__pyx_r = NULL; + __Pyx_RefNannyDeclarations + PyObject *__pyx_t_1 = NULL; + int __pyx_t_2; + PyObject *__pyx_t_3 = NULL; + int __pyx_lineno = 0; + const char *__pyx_filename = NULL; + int __pyx_clineno = 0; + __Pyx_RefNannySetupContext("move_name", 0); + + /* "spacy/pipeline/_parser_internals/arc_eager.pyx":709 + * + * def move_name(self, int move, attr_t label): + * label_str = self.strings[label] # <<<<<<<<<<<<<< + * if label_str: + * return MOVE_NAMES[move] + '-' + label_str +*/ + __pyx_t_1 = __Pyx_GetItemInt(((PyObject *)__pyx_v_self->__pyx_base.strings), __pyx_v_label, __pyx_t_5spacy_8typedefs_attr_t, 0, __Pyx_PyLong_From_uint64_t, 0, 0, 1, 1, __Pyx_ReferenceSharing_SharedReference); if (unlikely(!__pyx_t_1)) __PYX_ERR(0, 709, __pyx_L1_error) + __Pyx_GOTREF(__pyx_t_1); + __pyx_v_label_str = __pyx_t_1; + __pyx_t_1 = 0; + + /* "spacy/pipeline/_parser_internals/arc_eager.pyx":710 + * def move_name(self, int move, attr_t label): + * label_str = self.strings[label] + * if label_str: # <<<<<<<<<<<<<< + * return MOVE_NAMES[move] + '-' + label_str + * else: +*/ + __pyx_t_2 = __Pyx_PyObject_IsTrue(__pyx_v_label_str); if (unlikely((__pyx_t_2 < 0))) __PYX_ERR(0, 710, __pyx_L1_error) + if (__pyx_t_2) { + + /* "spacy/pipeline/_parser_internals/arc_eager.pyx":711 + * label_str = self.strings[label] + * if label_str: + * return MOVE_NAMES[move] + '-' + label_str # <<<<<<<<<<<<<< + * else: + * return MOVE_NAMES[move] +*/ + __Pyx_XDECREF(__pyx_r); + __Pyx_GetModuleGlobalName(__pyx_t_1, __pyx_mstate_global->__pyx_n_u_MOVE_NAMES); if (unlikely(!__pyx_t_1)) __PYX_ERR(0, 711, __pyx_L1_error) + __Pyx_GOTREF(__pyx_t_1); + __pyx_t_3 = __Pyx_GetItemInt(__pyx_t_1, __pyx_v_move, int, 1, __Pyx_PyLong_From_int, 0, 1, 1, 1, __Pyx_ReferenceSharing_OwnStrongReference); if (unlikely(!__pyx_t_3)) __PYX_ERR(0, 711, __pyx_L1_error) + __Pyx_GOTREF(__pyx_t_3); + __Pyx_DECREF(__pyx_t_1); __pyx_t_1 = 0; + __pyx_t_1 = PyNumber_Add(__pyx_t_3, __pyx_mstate_global->__pyx_kp_u__7); if (unlikely(!__pyx_t_1)) __PYX_ERR(0, 711, __pyx_L1_error) + __Pyx_GOTREF(__pyx_t_1); + __Pyx_DECREF(__pyx_t_3); __pyx_t_3 = 0; + __pyx_t_3 = PyNumber_Add(__pyx_t_1, __pyx_v_label_str); if (unlikely(!__pyx_t_3)) __PYX_ERR(0, 711, __pyx_L1_error) + __Pyx_GOTREF(__pyx_t_3); + __Pyx_DECREF(__pyx_t_1); __pyx_t_1 = 0; + __pyx_r = __pyx_t_3; + __pyx_t_3 = 0; + goto __pyx_L0; + + /* "spacy/pipeline/_parser_internals/arc_eager.pyx":710 + * def move_name(self, int move, attr_t label): + * label_str = self.strings[label] + * if label_str: # <<<<<<<<<<<<<< + * return MOVE_NAMES[move] + '-' + label_str + * else: +*/ + } + + /* "spacy/pipeline/_parser_internals/arc_eager.pyx":713 + * return MOVE_NAMES[move] + '-' + label_str + * else: + * return MOVE_NAMES[move] # <<<<<<<<<<<<<< + * + * def class_name(self, int i): +*/ + /*else*/ { + __Pyx_XDECREF(__pyx_r); + __Pyx_GetModuleGlobalName(__pyx_t_3, __pyx_mstate_global->__pyx_n_u_MOVE_NAMES); if (unlikely(!__pyx_t_3)) __PYX_ERR(0, 713, __pyx_L1_error) + __Pyx_GOTREF(__pyx_t_3); + __pyx_t_1 = __Pyx_GetItemInt(__pyx_t_3, __pyx_v_move, int, 1, __Pyx_PyLong_From_int, 0, 1, 1, 1, __Pyx_ReferenceSharing_OwnStrongReference); if (unlikely(!__pyx_t_1)) __PYX_ERR(0, 713, __pyx_L1_error) + __Pyx_GOTREF(__pyx_t_1); + __Pyx_DECREF(__pyx_t_3); __pyx_t_3 = 0; + __pyx_r = __pyx_t_1; + __pyx_t_1 = 0; + goto __pyx_L0; + } + + /* "spacy/pipeline/_parser_internals/arc_eager.pyx":708 + * raise KeyError(f"Unknown transition: {name}") + * + * def move_name(self, int move, attr_t label): # <<<<<<<<<<<<<< + * label_str = self.strings[label] + * if label_str: +*/ + + /* function exit code */ + __pyx_L1_error:; + __Pyx_XDECREF(__pyx_t_1); + __Pyx_XDECREF(__pyx_t_3); + __Pyx_AddTraceback("spacy.pipeline._parser_internals.arc_eager.ArcEager.move_name", __pyx_clineno, __pyx_lineno, __pyx_filename); + __pyx_r = NULL; + __pyx_L0:; + __Pyx_XDECREF(__pyx_v_label_str); + __Pyx_XGIVEREF(__pyx_r); + __Pyx_RefNannyFinishContext(); + return __pyx_r; +} + +/* "spacy/pipeline/_parser_internals/arc_eager.pyx":715 + * return MOVE_NAMES[move] + * + * def class_name(self, int i): # <<<<<<<<<<<<<< + * return self.move_name(self.c[i].move, self.c[i].label) + * +*/ + +/* Python wrapper */ +static PyObject *__pyx_pw_5spacy_8pipeline_17_parser_internals_9arc_eager_8ArcEager_19class_name(PyObject *__pyx_v_self, +#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_5spacy_8pipeline_17_parser_internals_9arc_eager_8ArcEager_18class_name, "ArcEager.class_name(self, int i)"); +static PyMethodDef __pyx_mdef_5spacy_8pipeline_17_parser_internals_9arc_eager_8ArcEager_19class_name = {"class_name", (PyCFunction)(void(*)(void))(__Pyx_PyCFunction_FastCallWithKeywords)__pyx_pw_5spacy_8pipeline_17_parser_internals_9arc_eager_8ArcEager_19class_name, __Pyx_METH_FASTCALL|METH_KEYWORDS, __pyx_doc_5spacy_8pipeline_17_parser_internals_9arc_eager_8ArcEager_18class_name}; +static PyObject *__pyx_pw_5spacy_8pipeline_17_parser_internals_9arc_eager_8ArcEager_19class_name(PyObject *__pyx_v_self, +#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_i; + #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("class_name (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_i,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, 715, __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, 715, __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, "class_name", 0) < (0)) __PYX_ERR(0, 715, __pyx_L3_error) + for (Py_ssize_t i = __pyx_nargs; i < 1; i++) { + if (unlikely(!values[i])) { __Pyx_RaiseArgtupleInvalid("class_name", 1, 1, 1, i); __PYX_ERR(0, 715, __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, 715, __pyx_L3_error) + } + __pyx_v_i = __Pyx_PyLong_As_int(values[0]); if (unlikely((__pyx_v_i == (int)-1) && PyErr_Occurred())) __PYX_ERR(0, 715, __pyx_L3_error) + } + goto __pyx_L6_skip; + __pyx_L5_argtuple_error:; + __Pyx_RaiseArgtupleInvalid("class_name", 1, 1, 1, __pyx_nargs); __PYX_ERR(0, 715, __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("spacy.pipeline._parser_internals.arc_eager.ArcEager.class_name", __pyx_clineno, __pyx_lineno, __pyx_filename); + __Pyx_RefNannyFinishContext(); + return NULL; + __pyx_L4_argument_unpacking_done:; + __pyx_r = __pyx_pf_5spacy_8pipeline_17_parser_internals_9arc_eager_8ArcEager_18class_name(((struct __pyx_obj_5spacy_8pipeline_17_parser_internals_9arc_eager_ArcEager *)__pyx_v_self), __pyx_v_i); + + /* 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_5spacy_8pipeline_17_parser_internals_9arc_eager_8ArcEager_18class_name(struct __pyx_obj_5spacy_8pipeline_17_parser_internals_9arc_eager_ArcEager *__pyx_v_self, int __pyx_v_i) { + PyObject *__pyx_r = NULL; + __Pyx_RefNannyDeclarations + PyObject *__pyx_t_1 = NULL; + PyObject *__pyx_t_2 = NULL; + PyObject *__pyx_t_3 = NULL; + PyObject *__pyx_t_4 = NULL; + size_t __pyx_t_5; + int __pyx_lineno = 0; + const char *__pyx_filename = NULL; + int __pyx_clineno = 0; + __Pyx_RefNannySetupContext("class_name", 0); + + /* "spacy/pipeline/_parser_internals/arc_eager.pyx":716 + * + * def class_name(self, int i): + * return self.move_name(self.c[i].move, self.c[i].label) # <<<<<<<<<<<<<< + * + * cdef Transition init_transition(self, int clas, int move, attr_t label) except *: +*/ + __Pyx_XDECREF(__pyx_r); + __pyx_t_2 = ((PyObject *)__pyx_v_self); + __Pyx_INCREF(__pyx_t_2); + __pyx_t_3 = __Pyx_PyLong_From_int((__pyx_v_self->__pyx_base.c[__pyx_v_i]).move); if (unlikely(!__pyx_t_3)) __PYX_ERR(0, 716, __pyx_L1_error) + __Pyx_GOTREF(__pyx_t_3); + __pyx_t_4 = __Pyx_PyLong_From_uint64_t((__pyx_v_self->__pyx_base.c[__pyx_v_i]).label); if (unlikely(!__pyx_t_4)) __PYX_ERR(0, 716, __pyx_L1_error) + __Pyx_GOTREF(__pyx_t_4); + __pyx_t_5 = 0; + { + PyObject *__pyx_callargs[3] = {__pyx_t_2, __pyx_t_3, __pyx_t_4}; + __pyx_t_1 = __Pyx_PyObject_FastCallMethod((PyObject*)__pyx_mstate_global->__pyx_n_u_move_name, __pyx_callargs+__pyx_t_5, (3-__pyx_t_5) | (1*__Pyx_PY_VECTORCALL_ARGUMENTS_OFFSET)); + __Pyx_XDECREF(__pyx_t_2); __pyx_t_2 = 0; + __Pyx_DECREF(__pyx_t_3); __pyx_t_3 = 0; + __Pyx_DECREF(__pyx_t_4); __pyx_t_4 = 0; + if (unlikely(!__pyx_t_1)) __PYX_ERR(0, 716, __pyx_L1_error) + __Pyx_GOTREF(__pyx_t_1); + } + __pyx_r = __pyx_t_1; + __pyx_t_1 = 0; + goto __pyx_L0; + + /* "spacy/pipeline/_parser_internals/arc_eager.pyx":715 + * return MOVE_NAMES[move] + * + * def class_name(self, int i): # <<<<<<<<<<<<<< + * return self.move_name(self.c[i].move, self.c[i].label) + * +*/ + + /* function exit code */ + __pyx_L1_error:; + __Pyx_XDECREF(__pyx_t_1); + __Pyx_XDECREF(__pyx_t_2); + __Pyx_XDECREF(__pyx_t_3); + __Pyx_XDECREF(__pyx_t_4); + __Pyx_AddTraceback("spacy.pipeline._parser_internals.arc_eager.ArcEager.class_name", __pyx_clineno, __pyx_lineno, __pyx_filename); + __pyx_r = NULL; + __pyx_L0:; + __Pyx_XGIVEREF(__pyx_r); + __Pyx_RefNannyFinishContext(); + return __pyx_r; +} + +/* "spacy/pipeline/_parser_internals/arc_eager.pyx":718 + * return self.move_name(self.c[i].move, self.c[i].label) + * + * cdef Transition init_transition(self, int clas, int move, attr_t label) except *: # <<<<<<<<<<<<<< + * # TODO: Apparent Cython bug here when we try to use the Transition() + * # constructor with the function pointers +*/ + +static struct __pyx_t_5spacy_8pipeline_17_parser_internals_17transition_system_Transition __pyx_f_5spacy_8pipeline_17_parser_internals_9arc_eager_8ArcEager_init_transition(CYTHON_UNUSED struct __pyx_obj_5spacy_8pipeline_17_parser_internals_9arc_eager_ArcEager *__pyx_v_self, int __pyx_v_clas, int __pyx_v_move, __pyx_t_5spacy_8typedefs_attr_t __pyx_v_label) { + struct __pyx_t_5spacy_8pipeline_17_parser_internals_17transition_system_Transition __pyx_v_t; + struct __pyx_t_5spacy_8pipeline_17_parser_internals_17transition_system_Transition __pyx_r; + __Pyx_RefNannyDeclarations + PyObject *__pyx_t_1 = NULL; + PyObject *__pyx_t_2 = NULL; + PyObject *__pyx_t_3 = NULL; + PyObject *__pyx_t_4 = NULL; + PyObject *__pyx_t_5 = NULL; + PyObject *__pyx_t_6 = NULL; + size_t __pyx_t_7; + PyObject *__pyx_t_8 = NULL; + int __pyx_lineno = 0; + const char *__pyx_filename = NULL; + int __pyx_clineno = 0; + __Pyx_RefNannySetupContext("init_transition", 0); + + /* "spacy/pipeline/_parser_internals/arc_eager.pyx":722 + * # constructor with the function pointers + * cdef Transition t + * t.score = 0 # <<<<<<<<<<<<<< + * t.clas = clas + * t.move = move +*/ + __pyx_v_t.score = 0.0; + + /* "spacy/pipeline/_parser_internals/arc_eager.pyx":723 + * cdef Transition t + * t.score = 0 + * t.clas = clas # <<<<<<<<<<<<<< + * t.move = move + * t.label = label +*/ + __pyx_v_t.clas = __pyx_v_clas; + + /* "spacy/pipeline/_parser_internals/arc_eager.pyx":724 + * t.score = 0 + * t.clas = clas + * t.move = move # <<<<<<<<<<<<<< + * t.label = label + * if move == SHIFT: +*/ + __pyx_v_t.move = __pyx_v_move; + + /* "spacy/pipeline/_parser_internals/arc_eager.pyx":725 + * t.clas = clas + * t.move = move + * t.label = label # <<<<<<<<<<<<<< + * if move == SHIFT: + * t.is_valid = Shift.is_valid +*/ + __pyx_v_t.label = __pyx_v_label; + + /* "spacy/pipeline/_parser_internals/arc_eager.pyx":726 + * t.move = move + * t.label = label + * if move == SHIFT: # <<<<<<<<<<<<<< + * t.is_valid = Shift.is_valid + * t.do = Shift.transition +*/ + switch (__pyx_v_move) { + case __pyx_e_5spacy_8pipeline_17_parser_internals_9arc_eager_SHIFT: + + /* "spacy/pipeline/_parser_internals/arc_eager.pyx":727 + * t.label = label + * if move == SHIFT: + * t.is_valid = Shift.is_valid # <<<<<<<<<<<<<< + * t.do = Shift.transition + * t.get_cost = Shift.cost +*/ + __pyx_v_t.is_valid = __pyx_f_5spacy_8pipeline_17_parser_internals_9arc_eager_5Shift_is_valid; + + /* "spacy/pipeline/_parser_internals/arc_eager.pyx":728 + * if move == SHIFT: + * t.is_valid = Shift.is_valid + * t.do = Shift.transition # <<<<<<<<<<<<<< + * t.get_cost = Shift.cost + * elif move == REDUCE: +*/ + __pyx_v_t.__pyx_do = __pyx_f_5spacy_8pipeline_17_parser_internals_9arc_eager_5Shift_transition; + + /* "spacy/pipeline/_parser_internals/arc_eager.pyx":729 + * t.is_valid = Shift.is_valid + * t.do = Shift.transition + * t.get_cost = Shift.cost # <<<<<<<<<<<<<< + * elif move == REDUCE: + * t.is_valid = Reduce.is_valid +*/ + __pyx_v_t.get_cost = __pyx_f_5spacy_8pipeline_17_parser_internals_9arc_eager_5Shift_cost; + + /* "spacy/pipeline/_parser_internals/arc_eager.pyx":726 + * t.move = move + * t.label = label + * if move == SHIFT: # <<<<<<<<<<<<<< + * t.is_valid = Shift.is_valid + * t.do = Shift.transition +*/ + break; + case __pyx_e_5spacy_8pipeline_17_parser_internals_9arc_eager_REDUCE: + + /* "spacy/pipeline/_parser_internals/arc_eager.pyx":731 + * t.get_cost = Shift.cost + * elif move == REDUCE: + * t.is_valid = Reduce.is_valid # <<<<<<<<<<<<<< + * t.do = Reduce.transition + * t.get_cost = Reduce.cost +*/ + __pyx_v_t.is_valid = __pyx_f_5spacy_8pipeline_17_parser_internals_9arc_eager_6Reduce_is_valid; + + /* "spacy/pipeline/_parser_internals/arc_eager.pyx":732 + * elif move == REDUCE: + * t.is_valid = Reduce.is_valid + * t.do = Reduce.transition # <<<<<<<<<<<<<< + * t.get_cost = Reduce.cost + * elif move == LEFT: +*/ + __pyx_v_t.__pyx_do = __pyx_f_5spacy_8pipeline_17_parser_internals_9arc_eager_6Reduce_transition; + + /* "spacy/pipeline/_parser_internals/arc_eager.pyx":733 + * t.is_valid = Reduce.is_valid + * t.do = Reduce.transition + * t.get_cost = Reduce.cost # <<<<<<<<<<<<<< + * elif move == LEFT: + * t.is_valid = LeftArc.is_valid +*/ + __pyx_v_t.get_cost = __pyx_f_5spacy_8pipeline_17_parser_internals_9arc_eager_6Reduce_cost; + + /* "spacy/pipeline/_parser_internals/arc_eager.pyx":730 + * t.do = Shift.transition + * t.get_cost = Shift.cost + * elif move == REDUCE: # <<<<<<<<<<<<<< + * t.is_valid = Reduce.is_valid + * t.do = Reduce.transition +*/ + break; + case __pyx_e_5spacy_8pipeline_17_parser_internals_9arc_eager_LEFT: + + /* "spacy/pipeline/_parser_internals/arc_eager.pyx":735 + * t.get_cost = Reduce.cost + * elif move == LEFT: + * t.is_valid = LeftArc.is_valid # <<<<<<<<<<<<<< + * t.do = LeftArc.transition + * t.get_cost = LeftArc.cost +*/ + __pyx_v_t.is_valid = __pyx_f_5spacy_8pipeline_17_parser_internals_9arc_eager_7LeftArc_is_valid; + + /* "spacy/pipeline/_parser_internals/arc_eager.pyx":736 + * elif move == LEFT: + * t.is_valid = LeftArc.is_valid + * t.do = LeftArc.transition # <<<<<<<<<<<<<< + * t.get_cost = LeftArc.cost + * elif move == RIGHT: +*/ + __pyx_v_t.__pyx_do = __pyx_f_5spacy_8pipeline_17_parser_internals_9arc_eager_7LeftArc_transition; + + /* "spacy/pipeline/_parser_internals/arc_eager.pyx":737 + * t.is_valid = LeftArc.is_valid + * t.do = LeftArc.transition + * t.get_cost = LeftArc.cost # <<<<<<<<<<<<<< + * elif move == RIGHT: + * t.is_valid = RightArc.is_valid +*/ + __pyx_v_t.get_cost = __pyx_f_5spacy_8pipeline_17_parser_internals_9arc_eager_7LeftArc_cost; + + /* "spacy/pipeline/_parser_internals/arc_eager.pyx":734 + * t.do = Reduce.transition + * t.get_cost = Reduce.cost + * elif move == LEFT: # <<<<<<<<<<<<<< + * t.is_valid = LeftArc.is_valid + * t.do = LeftArc.transition +*/ + break; + case __pyx_e_5spacy_8pipeline_17_parser_internals_9arc_eager_RIGHT: + + /* "spacy/pipeline/_parser_internals/arc_eager.pyx":739 + * t.get_cost = LeftArc.cost + * elif move == RIGHT: + * t.is_valid = RightArc.is_valid # <<<<<<<<<<<<<< + * t.do = RightArc.transition + * t.get_cost = RightArc.cost +*/ + __pyx_v_t.is_valid = __pyx_f_5spacy_8pipeline_17_parser_internals_9arc_eager_8RightArc_is_valid; + + /* "spacy/pipeline/_parser_internals/arc_eager.pyx":740 + * elif move == RIGHT: + * t.is_valid = RightArc.is_valid + * t.do = RightArc.transition # <<<<<<<<<<<<<< + * t.get_cost = RightArc.cost + * elif move == BREAK: +*/ + __pyx_v_t.__pyx_do = __pyx_f_5spacy_8pipeline_17_parser_internals_9arc_eager_8RightArc_transition; + + /* "spacy/pipeline/_parser_internals/arc_eager.pyx":741 + * t.is_valid = RightArc.is_valid + * t.do = RightArc.transition + * t.get_cost = RightArc.cost # <<<<<<<<<<<<<< + * elif move == BREAK: + * t.is_valid = Break.is_valid +*/ + __pyx_v_t.get_cost = __pyx_f_5spacy_8pipeline_17_parser_internals_9arc_eager_8RightArc_cost; + + /* "spacy/pipeline/_parser_internals/arc_eager.pyx":738 + * t.do = LeftArc.transition + * t.get_cost = LeftArc.cost + * elif move == RIGHT: # <<<<<<<<<<<<<< + * t.is_valid = RightArc.is_valid + * t.do = RightArc.transition +*/ + break; + case __pyx_e_5spacy_8pipeline_17_parser_internals_9arc_eager_BREAK: + + /* "spacy/pipeline/_parser_internals/arc_eager.pyx":743 + * t.get_cost = RightArc.cost + * elif move == BREAK: + * t.is_valid = Break.is_valid # <<<<<<<<<<<<<< + * t.do = Break.transition + * t.get_cost = Break.cost +*/ + __pyx_v_t.is_valid = __pyx_f_5spacy_8pipeline_17_parser_internals_9arc_eager_5Break_is_valid; + + /* "spacy/pipeline/_parser_internals/arc_eager.pyx":744 + * elif move == BREAK: + * t.is_valid = Break.is_valid + * t.do = Break.transition # <<<<<<<<<<<<<< + * t.get_cost = Break.cost + * else: +*/ + __pyx_v_t.__pyx_do = __pyx_f_5spacy_8pipeline_17_parser_internals_9arc_eager_5Break_transition; + + /* "spacy/pipeline/_parser_internals/arc_eager.pyx":745 + * t.is_valid = Break.is_valid + * t.do = Break.transition + * t.get_cost = Break.cost # <<<<<<<<<<<<<< + * else: + * raise ValueError(Errors.E019.format(action=move, src='arc_eager')) +*/ + __pyx_v_t.get_cost = __pyx_f_5spacy_8pipeline_17_parser_internals_9arc_eager_5Break_cost; + + /* "spacy/pipeline/_parser_internals/arc_eager.pyx":742 + * t.do = RightArc.transition + * t.get_cost = RightArc.cost + * elif move == BREAK: # <<<<<<<<<<<<<< + * t.is_valid = Break.is_valid + * t.do = Break.transition +*/ + break; + default: + + /* "spacy/pipeline/_parser_internals/arc_eager.pyx":747 + * t.get_cost = Break.cost + * else: + * raise ValueError(Errors.E019.format(action=move, src='arc_eager')) # <<<<<<<<<<<<<< + * return t + * +*/ + __pyx_t_2 = NULL; + __Pyx_GetModuleGlobalName(__pyx_t_5, __pyx_mstate_global->__pyx_n_u_Errors); if (unlikely(!__pyx_t_5)) __PYX_ERR(0, 747, __pyx_L1_error) + __Pyx_GOTREF(__pyx_t_5); + __pyx_t_6 = __Pyx_PyObject_GetAttrStr(__pyx_t_5, __pyx_mstate_global->__pyx_n_u_E019); if (unlikely(!__pyx_t_6)) __PYX_ERR(0, 747, __pyx_L1_error) + __Pyx_GOTREF(__pyx_t_6); + __Pyx_DECREF(__pyx_t_5); __pyx_t_5 = 0; + __pyx_t_4 = __pyx_t_6; + __Pyx_INCREF(__pyx_t_4); + __pyx_t_5 = __Pyx_PyLong_From_int(__pyx_v_move); if (unlikely(!__pyx_t_5)) __PYX_ERR(0, 747, __pyx_L1_error) + __Pyx_GOTREF(__pyx_t_5); + __pyx_t_7 = 0; + { + PyObject *__pyx_callargs[2 + ((CYTHON_VECTORCALL) ? 2 : 0)] = {__pyx_t_4, NULL}; + __pyx_t_8 = __Pyx_MakeVectorcallBuilderKwds(2); if (unlikely(!__pyx_t_8)) __PYX_ERR(0, 747, __pyx_L1_error) + __Pyx_GOTREF(__pyx_t_8); + if (__Pyx_VectorcallBuilder_AddArg(__pyx_mstate_global->__pyx_n_u_action, __pyx_t_5, __pyx_t_8, __pyx_callargs+1, 0) < (0)) __PYX_ERR(0, 747, __pyx_L1_error) + if (__Pyx_VectorcallBuilder_AddArg(__pyx_mstate_global->__pyx_n_u_src, __pyx_mstate_global->__pyx_n_u_arc_eager, __pyx_t_8, __pyx_callargs+1, 1) < (0)) __PYX_ERR(0, 747, __pyx_L1_error) + __pyx_t_3 = __Pyx_Object_VectorcallMethod_CallFromBuilder((PyObject*)__pyx_mstate_global->__pyx_n_u_format, __pyx_callargs+__pyx_t_7, (1-__pyx_t_7) | (1*__Pyx_PY_VECTORCALL_ARGUMENTS_OFFSET), __pyx_t_8); + __Pyx_XDECREF(__pyx_t_4); __pyx_t_4 = 0; + __Pyx_DECREF(__pyx_t_5); __pyx_t_5 = 0; + __Pyx_DECREF(__pyx_t_8); __pyx_t_8 = 0; + __Pyx_DECREF(__pyx_t_6); __pyx_t_6 = 0; + if (unlikely(!__pyx_t_3)) __PYX_ERR(0, 747, __pyx_L1_error) + __Pyx_GOTREF(__pyx_t_3); + } + __pyx_t_7 = 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_7, (2-__pyx_t_7) | (__pyx_t_7*__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, 747, __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, 747, __pyx_L1_error) + break; + } + + /* "spacy/pipeline/_parser_internals/arc_eager.pyx":748 + * else: + * raise ValueError(Errors.E019.format(action=move, src='arc_eager')) + * return t # <<<<<<<<<<<<<< + * + * def set_annotations(self, StateClass state, Doc doc): +*/ + __pyx_r = __pyx_v_t; + goto __pyx_L0; + + /* "spacy/pipeline/_parser_internals/arc_eager.pyx":718 + * return self.move_name(self.c[i].move, self.c[i].label) + * + * cdef Transition init_transition(self, int clas, int move, attr_t label) except *: # <<<<<<<<<<<<<< + * # TODO: Apparent Cython bug here when we try to use the Transition() + * # constructor with the function pointers +*/ + + /* function exit code */ + __pyx_L1_error:; + __Pyx_XDECREF(__pyx_t_1); + __Pyx_XDECREF(__pyx_t_2); + __Pyx_XDECREF(__pyx_t_3); + __Pyx_XDECREF(__pyx_t_4); + __Pyx_XDECREF(__pyx_t_5); + __Pyx_XDECREF(__pyx_t_6); + __Pyx_XDECREF(__pyx_t_8); + __Pyx_AddTraceback("spacy.pipeline._parser_internals.arc_eager.ArcEager.init_transition", __pyx_clineno, __pyx_lineno, __pyx_filename); + __Pyx_pretend_to_initialize(&__pyx_r); + __pyx_L0:; + __Pyx_RefNannyFinishContext(); + return __pyx_r; +} + +/* "spacy/pipeline/_parser_internals/arc_eager.pyx":750 + * return t + * + * def set_annotations(self, StateClass state, Doc doc): # <<<<<<<<<<<<<< + * for arc in state.arcs: + * doc.c[arc["child"]].head = arc["head"] - arc["child"] +*/ + +/* Python wrapper */ +static PyObject *__pyx_pw_5spacy_8pipeline_17_parser_internals_9arc_eager_8ArcEager_21set_annotations(PyObject *__pyx_v_self, +#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_5spacy_8pipeline_17_parser_internals_9arc_eager_8ArcEager_20set_annotations, "ArcEager.set_annotations(self, StateClass state, Doc doc)"); +static PyMethodDef __pyx_mdef_5spacy_8pipeline_17_parser_internals_9arc_eager_8ArcEager_21set_annotations = {"set_annotations", (PyCFunction)(void(*)(void))(__Pyx_PyCFunction_FastCallWithKeywords)__pyx_pw_5spacy_8pipeline_17_parser_internals_9arc_eager_8ArcEager_21set_annotations, __Pyx_METH_FASTCALL|METH_KEYWORDS, __pyx_doc_5spacy_8pipeline_17_parser_internals_9arc_eager_8ArcEager_20set_annotations}; +static PyObject *__pyx_pw_5spacy_8pipeline_17_parser_internals_9arc_eager_8ArcEager_21set_annotations(PyObject *__pyx_v_self, +#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_5spacy_8pipeline_17_parser_internals_10stateclass_StateClass *__pyx_v_state = 0; + struct __pyx_obj_5spacy_6tokens_3doc_Doc *__pyx_v_doc = 0; + #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("set_annotations (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_state,&__pyx_mstate_global->__pyx_n_u_doc,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, 750, __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, 750, __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, 750, __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, "set_annotations", 0) < (0)) __PYX_ERR(0, 750, __pyx_L3_error) + for (Py_ssize_t i = __pyx_nargs; i < 2; i++) { + if (unlikely(!values[i])) { __Pyx_RaiseArgtupleInvalid("set_annotations", 1, 2, 2, i); __PYX_ERR(0, 750, __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, 750, __pyx_L3_error) + values[1] = __Pyx_ArgRef_FASTCALL(__pyx_args, 1); + if (!CYTHON_ASSUME_SAFE_MACROS && unlikely(!values[1])) __PYX_ERR(0, 750, __pyx_L3_error) + } + __pyx_v_state = ((struct __pyx_obj_5spacy_8pipeline_17_parser_internals_10stateclass_StateClass *)values[0]); + __pyx_v_doc = ((struct __pyx_obj_5spacy_6tokens_3doc_Doc *)values[1]); + } + goto __pyx_L6_skip; + __pyx_L5_argtuple_error:; + __Pyx_RaiseArgtupleInvalid("set_annotations", 1, 2, 2, __pyx_nargs); __PYX_ERR(0, 750, __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("spacy.pipeline._parser_internals.arc_eager.ArcEager.set_annotations", __pyx_clineno, __pyx_lineno, __pyx_filename); + __Pyx_RefNannyFinishContext(); + return NULL; + __pyx_L4_argument_unpacking_done:; + if (unlikely(!__Pyx_ArgTypeTest(((PyObject *)__pyx_v_state), __pyx_mstate_global->__pyx_ptype_5spacy_8pipeline_17_parser_internals_10stateclass_StateClass, 1, "state", 0))) __PYX_ERR(0, 750, __pyx_L1_error) + if (unlikely(!__Pyx_ArgTypeTest(((PyObject *)__pyx_v_doc), __pyx_mstate_global->__pyx_ptype_5spacy_6tokens_3doc_Doc, 1, "doc", 0))) __PYX_ERR(0, 750, __pyx_L1_error) + __pyx_r = __pyx_pf_5spacy_8pipeline_17_parser_internals_9arc_eager_8ArcEager_20set_annotations(((struct __pyx_obj_5spacy_8pipeline_17_parser_internals_9arc_eager_ArcEager *)__pyx_v_self), __pyx_v_state, __pyx_v_doc); + + /* 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_5spacy_8pipeline_17_parser_internals_9arc_eager_8ArcEager_20set_annotations(struct __pyx_obj_5spacy_8pipeline_17_parser_internals_9arc_eager_ArcEager *__pyx_v_self, struct __pyx_obj_5spacy_8pipeline_17_parser_internals_10stateclass_StateClass *__pyx_v_state, struct __pyx_obj_5spacy_6tokens_3doc_Doc *__pyx_v_doc) { + PyObject *__pyx_v_arc = NULL; + int __pyx_v_i; + PyObject *__pyx_r = NULL; + __Pyx_RefNannyDeclarations + PyObject *__pyx_t_1 = NULL; + PyObject *__pyx_t_2 = NULL; + Py_ssize_t __pyx_t_3; + PyObject *(*__pyx_t_4)(PyObject *); + PyObject *__pyx_t_5 = NULL; + PyObject *__pyx_t_6 = NULL; + int __pyx_t_7; + Py_ssize_t __pyx_t_8; + __pyx_t_5spacy_8typedefs_attr_t __pyx_t_9; + int __pyx_t_10; + int __pyx_t_11; + int __pyx_t_12; + int __pyx_lineno = 0; + const char *__pyx_filename = NULL; + int __pyx_clineno = 0; + __Pyx_RefNannySetupContext("set_annotations", 0); + + /* "spacy/pipeline/_parser_internals/arc_eager.pyx":751 + * + * def set_annotations(self, StateClass state, Doc doc): + * for arc in state.arcs: # <<<<<<<<<<<<<< + * doc.c[arc["child"]].head = arc["head"] - arc["child"] + * doc.c[arc["child"]].dep = arc["label"] +*/ + __pyx_t_1 = __Pyx_PyObject_GetAttrStr(((PyObject *)__pyx_v_state), __pyx_mstate_global->__pyx_n_u_arcs); if (unlikely(!__pyx_t_1)) __PYX_ERR(0, 751, __pyx_L1_error) + __Pyx_GOTREF(__pyx_t_1); + if (likely(PyList_CheckExact(__pyx_t_1)) || PyTuple_CheckExact(__pyx_t_1)) { + __pyx_t_2 = __pyx_t_1; __Pyx_INCREF(__pyx_t_2); + __pyx_t_3 = 0; + __pyx_t_4 = NULL; + } else { + __pyx_t_3 = -1; __pyx_t_2 = PyObject_GetIter(__pyx_t_1); if (unlikely(!__pyx_t_2)) __PYX_ERR(0, 751, __pyx_L1_error) + __Pyx_GOTREF(__pyx_t_2); + __pyx_t_4 = (CYTHON_COMPILING_IN_LIMITED_API) ? PyIter_Next : __Pyx_PyObject_GetIterNextFunc(__pyx_t_2); if (unlikely(!__pyx_t_4)) __PYX_ERR(0, 751, __pyx_L1_error) + } + __Pyx_DECREF(__pyx_t_1); __pyx_t_1 = 0; + for (;;) { + if (likely(!__pyx_t_4)) { + if (likely(PyList_CheckExact(__pyx_t_2))) { + { + Py_ssize_t __pyx_temp = __Pyx_PyList_GET_SIZE(__pyx_t_2); + #if !CYTHON_ASSUME_SAFE_SIZE + if (unlikely((__pyx_temp < 0))) __PYX_ERR(0, 751, __pyx_L1_error) + #endif + if (__pyx_t_3 >= __pyx_temp) break; + } + __pyx_t_1 = __Pyx_PyList_GetItemRefFast(__pyx_t_2, __pyx_t_3, __Pyx_ReferenceSharing_OwnStrongReference); + ++__pyx_t_3; + } else { + { + Py_ssize_t __pyx_temp = __Pyx_PyTuple_GET_SIZE(__pyx_t_2); + #if !CYTHON_ASSUME_SAFE_SIZE + if (unlikely((__pyx_temp < 0))) __PYX_ERR(0, 751, __pyx_L1_error) + #endif + if (__pyx_t_3 >= __pyx_temp) break; + } + #if CYTHON_ASSUME_SAFE_MACROS && !CYTHON_AVOID_BORROWED_REFS + __pyx_t_1 = __Pyx_NewRef(PyTuple_GET_ITEM(__pyx_t_2, __pyx_t_3)); + #else + __pyx_t_1 = __Pyx_PySequence_ITEM(__pyx_t_2, __pyx_t_3); + #endif + ++__pyx_t_3; + } + if (unlikely(!__pyx_t_1)) __PYX_ERR(0, 751, __pyx_L1_error) + } else { + __pyx_t_1 = __pyx_t_4(__pyx_t_2); + if (unlikely(!__pyx_t_1)) { + PyObject* exc_type = PyErr_Occurred(); + if (exc_type) { + if (unlikely(!__Pyx_PyErr_GivenExceptionMatches(exc_type, PyExc_StopIteration))) __PYX_ERR(0, 751, __pyx_L1_error) + PyErr_Clear(); + } + break; + } + } + __Pyx_GOTREF(__pyx_t_1); + __Pyx_XDECREF_SET(__pyx_v_arc, __pyx_t_1); + __pyx_t_1 = 0; + + /* "spacy/pipeline/_parser_internals/arc_eager.pyx":752 + * def set_annotations(self, StateClass state, Doc doc): + * for arc in state.arcs: + * doc.c[arc["child"]].head = arc["head"] - arc["child"] # <<<<<<<<<<<<<< + * doc.c[arc["child"]].dep = arc["label"] + * for i in range(doc.length): +*/ + __pyx_t_1 = __Pyx_PyObject_Dict_GetItem(__pyx_v_arc, __pyx_mstate_global->__pyx_n_u_head); if (unlikely(!__pyx_t_1)) __PYX_ERR(0, 752, __pyx_L1_error) + __Pyx_GOTREF(__pyx_t_1); + __pyx_t_5 = __Pyx_PyObject_Dict_GetItem(__pyx_v_arc, __pyx_mstate_global->__pyx_n_u_child); if (unlikely(!__pyx_t_5)) __PYX_ERR(0, 752, __pyx_L1_error) + __Pyx_GOTREF(__pyx_t_5); + __pyx_t_6 = PyNumber_Subtract(__pyx_t_1, __pyx_t_5); if (unlikely(!__pyx_t_6)) __PYX_ERR(0, 752, __pyx_L1_error) + __Pyx_GOTREF(__pyx_t_6); + __Pyx_DECREF(__pyx_t_1); __pyx_t_1 = 0; + __Pyx_DECREF(__pyx_t_5); __pyx_t_5 = 0; + __pyx_t_7 = __Pyx_PyLong_As_int(__pyx_t_6); if (unlikely((__pyx_t_7 == (int)-1) && PyErr_Occurred())) __PYX_ERR(0, 752, __pyx_L1_error) + __Pyx_DECREF(__pyx_t_6); __pyx_t_6 = 0; + __pyx_t_6 = __Pyx_PyObject_Dict_GetItem(__pyx_v_arc, __pyx_mstate_global->__pyx_n_u_child); if (unlikely(!__pyx_t_6)) __PYX_ERR(0, 752, __pyx_L1_error) + __Pyx_GOTREF(__pyx_t_6); + __pyx_t_8 = __Pyx_PyIndex_AsSsize_t(__pyx_t_6); if (unlikely((__pyx_t_8 == (Py_ssize_t)-1) && PyErr_Occurred())) __PYX_ERR(0, 752, __pyx_L1_error) + __Pyx_DECREF(__pyx_t_6); __pyx_t_6 = 0; + (__pyx_v_doc->c[__pyx_t_8]).head = __pyx_t_7; + + /* "spacy/pipeline/_parser_internals/arc_eager.pyx":753 + * for arc in state.arcs: + * doc.c[arc["child"]].head = arc["head"] - arc["child"] + * doc.c[arc["child"]].dep = arc["label"] # <<<<<<<<<<<<<< + * for i in range(doc.length): + * if doc.c[i].head == 0: +*/ + __pyx_t_6 = __Pyx_PyObject_Dict_GetItem(__pyx_v_arc, __pyx_mstate_global->__pyx_n_u_label); if (unlikely(!__pyx_t_6)) __PYX_ERR(0, 753, __pyx_L1_error) + __Pyx_GOTREF(__pyx_t_6); + __pyx_t_9 = __Pyx_PyLong_As_uint64_t(__pyx_t_6); if (unlikely((__pyx_t_9 == ((uint64_t)-1)) && PyErr_Occurred())) __PYX_ERR(0, 753, __pyx_L1_error) + __Pyx_DECREF(__pyx_t_6); __pyx_t_6 = 0; + __pyx_t_6 = __Pyx_PyObject_Dict_GetItem(__pyx_v_arc, __pyx_mstate_global->__pyx_n_u_child); if (unlikely(!__pyx_t_6)) __PYX_ERR(0, 753, __pyx_L1_error) + __Pyx_GOTREF(__pyx_t_6); + __pyx_t_8 = __Pyx_PyIndex_AsSsize_t(__pyx_t_6); if (unlikely((__pyx_t_8 == (Py_ssize_t)-1) && PyErr_Occurred())) __PYX_ERR(0, 753, __pyx_L1_error) + __Pyx_DECREF(__pyx_t_6); __pyx_t_6 = 0; + (__pyx_v_doc->c[__pyx_t_8]).dep = __pyx_t_9; + + /* "spacy/pipeline/_parser_internals/arc_eager.pyx":751 + * + * def set_annotations(self, StateClass state, Doc doc): + * for arc in state.arcs: # <<<<<<<<<<<<<< + * doc.c[arc["child"]].head = arc["head"] - arc["child"] + * doc.c[arc["child"]].dep = arc["label"] +*/ + } + __Pyx_DECREF(__pyx_t_2); __pyx_t_2 = 0; + + /* "spacy/pipeline/_parser_internals/arc_eager.pyx":754 + * doc.c[arc["child"]].head = arc["head"] - arc["child"] + * doc.c[arc["child"]].dep = arc["label"] + * for i in range(doc.length): # <<<<<<<<<<<<<< + * if doc.c[i].head == 0: + * doc.c[i].dep = self.root_label +*/ + __pyx_t_7 = __pyx_v_doc->length; + __pyx_t_10 = __pyx_t_7; + for (__pyx_t_11 = 0; __pyx_t_11 < __pyx_t_10; __pyx_t_11+=1) { + __pyx_v_i = __pyx_t_11; + + /* "spacy/pipeline/_parser_internals/arc_eager.pyx":755 + * doc.c[arc["child"]].dep = arc["label"] + * for i in range(doc.length): + * if doc.c[i].head == 0: # <<<<<<<<<<<<<< + * doc.c[i].dep = self.root_label + * set_children_from_heads(doc.c, 0, doc.length) +*/ + __pyx_t_12 = ((__pyx_v_doc->c[__pyx_v_i]).head == 0); + if (__pyx_t_12) { + + /* "spacy/pipeline/_parser_internals/arc_eager.pyx":756 + * for i in range(doc.length): + * if doc.c[i].head == 0: + * doc.c[i].dep = self.root_label # <<<<<<<<<<<<<< + * set_children_from_heads(doc.c, 0, doc.length) + * +*/ + __pyx_t_9 = __pyx_v_self->__pyx_base.root_label; + (__pyx_v_doc->c[__pyx_v_i]).dep = __pyx_t_9; + + /* "spacy/pipeline/_parser_internals/arc_eager.pyx":755 + * doc.c[arc["child"]].dep = arc["label"] + * for i in range(doc.length): + * if doc.c[i].head == 0: # <<<<<<<<<<<<<< + * doc.c[i].dep = self.root_label + * set_children_from_heads(doc.c, 0, doc.length) +*/ + } + } + + /* "spacy/pipeline/_parser_internals/arc_eager.pyx":757 + * if doc.c[i].head == 0: + * doc.c[i].dep = self.root_label + * set_children_from_heads(doc.c, 0, doc.length) # <<<<<<<<<<<<<< + * + * def get_beam_parses(self, Beam beam): +*/ + __pyx_t_7 = __pyx_f_5spacy_6tokens_3doc_set_children_from_heads(__pyx_v_doc->c, 0, __pyx_v_doc->length); if (unlikely(__pyx_t_7 == ((int)-1))) __PYX_ERR(0, 757, __pyx_L1_error) + + /* "spacy/pipeline/_parser_internals/arc_eager.pyx":750 + * return t + * + * def set_annotations(self, StateClass state, Doc doc): # <<<<<<<<<<<<<< + * for arc in state.arcs: + * doc.c[arc["child"]].head = arc["head"] - arc["child"] +*/ + + /* 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_5); + __Pyx_XDECREF(__pyx_t_6); + __Pyx_AddTraceback("spacy.pipeline._parser_internals.arc_eager.ArcEager.set_annotations", __pyx_clineno, __pyx_lineno, __pyx_filename); + __pyx_r = NULL; + __pyx_L0:; + __Pyx_XDECREF(__pyx_v_arc); + __Pyx_XGIVEREF(__pyx_r); + __Pyx_RefNannyFinishContext(); + return __pyx_r; +} + +/* "spacy/pipeline/_parser_internals/arc_eager.pyx":759 + * set_children_from_heads(doc.c, 0, doc.length) + * + * def get_beam_parses(self, Beam beam): # <<<<<<<<<<<<<< + * parses = [] + * probs = beam.probs +*/ + +/* Python wrapper */ +static PyObject *__pyx_pw_5spacy_8pipeline_17_parser_internals_9arc_eager_8ArcEager_23get_beam_parses(PyObject *__pyx_v_self, +#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_5spacy_8pipeline_17_parser_internals_9arc_eager_8ArcEager_22get_beam_parses, "ArcEager.get_beam_parses(self, Beam beam)"); +static PyMethodDef __pyx_mdef_5spacy_8pipeline_17_parser_internals_9arc_eager_8ArcEager_23get_beam_parses = {"get_beam_parses", (PyCFunction)(void(*)(void))(__Pyx_PyCFunction_FastCallWithKeywords)__pyx_pw_5spacy_8pipeline_17_parser_internals_9arc_eager_8ArcEager_23get_beam_parses, __Pyx_METH_FASTCALL|METH_KEYWORDS, __pyx_doc_5spacy_8pipeline_17_parser_internals_9arc_eager_8ArcEager_22get_beam_parses}; +static PyObject *__pyx_pw_5spacy_8pipeline_17_parser_internals_9arc_eager_8ArcEager_23get_beam_parses(PyObject *__pyx_v_self, +#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_5thinc_5extra_6search_Beam *__pyx_v_beam = 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("get_beam_parses (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_beam,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, 759, __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, 759, __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, "get_beam_parses", 0) < (0)) __PYX_ERR(0, 759, __pyx_L3_error) + for (Py_ssize_t i = __pyx_nargs; i < 1; i++) { + if (unlikely(!values[i])) { __Pyx_RaiseArgtupleInvalid("get_beam_parses", 1, 1, 1, i); __PYX_ERR(0, 759, __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, 759, __pyx_L3_error) + } + __pyx_v_beam = ((struct __pyx_obj_5thinc_5extra_6search_Beam *)values[0]); + } + goto __pyx_L6_skip; + __pyx_L5_argtuple_error:; + __Pyx_RaiseArgtupleInvalid("get_beam_parses", 1, 1, 1, __pyx_nargs); __PYX_ERR(0, 759, __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("spacy.pipeline._parser_internals.arc_eager.ArcEager.get_beam_parses", __pyx_clineno, __pyx_lineno, __pyx_filename); + __Pyx_RefNannyFinishContext(); + return NULL; + __pyx_L4_argument_unpacking_done:; + if (unlikely(!__Pyx_ArgTypeTest(((PyObject *)__pyx_v_beam), __pyx_mstate_global->__pyx_ptype_5thinc_5extra_6search_Beam, 1, "beam", 0))) __PYX_ERR(0, 759, __pyx_L1_error) + __pyx_r = __pyx_pf_5spacy_8pipeline_17_parser_internals_9arc_eager_8ArcEager_22get_beam_parses(((struct __pyx_obj_5spacy_8pipeline_17_parser_internals_9arc_eager_ArcEager *)__pyx_v_self), __pyx_v_beam); + + /* 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_5spacy_8pipeline_17_parser_internals_9arc_eager_8ArcEager_22get_beam_parses(struct __pyx_obj_5spacy_8pipeline_17_parser_internals_9arc_eager_ArcEager *__pyx_v_self, struct __pyx_obj_5thinc_5extra_6search_Beam *__pyx_v_beam) { + PyObject *__pyx_v_parses = NULL; + PyObject *__pyx_v_probs = NULL; + __pyx_t_5thinc_5extra_6search_class_t __pyx_v_i; + __pyx_t_5spacy_8pipeline_17_parser_internals_6_state_StateC *__pyx_v_state; + PyObject *__pyx_v_prob = NULL; + PyObject *__pyx_v_parse = NULL; + PyObject *__pyx_v_arcs = NULL; + PyObject *__pyx_v_arc = NULL; + PyObject *__pyx_v_dep = NULL; + PyObject *__pyx_v_label = NULL; + PyObject *__pyx_r = NULL; + __Pyx_RefNannyDeclarations + PyObject *__pyx_t_1 = NULL; + __pyx_t_5thinc_5extra_6search_class_t __pyx_t_2; + __pyx_t_5thinc_5extra_6search_class_t __pyx_t_3; + __pyx_t_5thinc_5extra_6search_class_t __pyx_t_4; + void *__pyx_t_5; + int __pyx_t_6; + Py_ssize_t __pyx_t_7; + PyObject *(*__pyx_t_8)(PyObject *); + PyObject *__pyx_t_9 = NULL; + PyObject *__pyx_t_10 = NULL; + PyObject *__pyx_t_11 = NULL; + int __pyx_t_12; + int __pyx_lineno = 0; + const char *__pyx_filename = NULL; + int __pyx_clineno = 0; + __Pyx_RefNannySetupContext("get_beam_parses", 0); + + /* "spacy/pipeline/_parser_internals/arc_eager.pyx":760 + * + * def get_beam_parses(self, Beam beam): + * parses = [] # <<<<<<<<<<<<<< + * probs = beam.probs + * for i in range(beam.size): +*/ + __pyx_t_1 = PyList_New(0); if (unlikely(!__pyx_t_1)) __PYX_ERR(0, 760, __pyx_L1_error) + __Pyx_GOTREF(__pyx_t_1); + __pyx_v_parses = ((PyObject*)__pyx_t_1); + __pyx_t_1 = 0; + + /* "spacy/pipeline/_parser_internals/arc_eager.pyx":761 + * def get_beam_parses(self, Beam beam): + * parses = [] + * probs = beam.probs # <<<<<<<<<<<<<< + * for i in range(beam.size): + * state = beam.at(i) +*/ + __pyx_t_1 = __Pyx_PyObject_GetAttrStr(((PyObject *)__pyx_v_beam), __pyx_mstate_global->__pyx_n_u_probs); if (unlikely(!__pyx_t_1)) __PYX_ERR(0, 761, __pyx_L1_error) + __Pyx_GOTREF(__pyx_t_1); + __pyx_v_probs = __pyx_t_1; + __pyx_t_1 = 0; + + /* "spacy/pipeline/_parser_internals/arc_eager.pyx":762 + * parses = [] + * probs = beam.probs + * for i in range(beam.size): # <<<<<<<<<<<<<< + * state = beam.at(i) + * if state.is_final(): +*/ + __pyx_t_2 = __pyx_v_beam->size; + __pyx_t_3 = __pyx_t_2; + for (__pyx_t_4 = 0; __pyx_t_4 < __pyx_t_3; __pyx_t_4+=1) { + __pyx_v_i = __pyx_t_4; + + /* "spacy/pipeline/_parser_internals/arc_eager.pyx":763 + * probs = beam.probs + * for i in range(beam.size): + * state = beam.at(i) # <<<<<<<<<<<<<< + * if state.is_final(): + * prob = probs[i] +*/ + __pyx_t_5 = __pyx_f_5thinc_5extra_6search_4Beam_at(__pyx_v_beam, __pyx_v_i); if (unlikely(PyErr_Occurred())) __PYX_ERR(0, 763, __pyx_L1_error) + __pyx_v_state = ((__pyx_t_5spacy_8pipeline_17_parser_internals_6_state_StateC *)__pyx_t_5); + + /* "spacy/pipeline/_parser_internals/arc_eager.pyx":764 + * for i in range(beam.size): + * state = beam.at(i) + * if state.is_final(): # <<<<<<<<<<<<<< + * prob = probs[i] + * parse = [] +*/ + __pyx_t_6 = __pyx_v_state->is_final(); + if (__pyx_t_6) { + + /* "spacy/pipeline/_parser_internals/arc_eager.pyx":765 + * state = beam.at(i) + * if state.is_final(): + * prob = probs[i] # <<<<<<<<<<<<<< + * parse = [] + * arcs = self.get_arcs(state) +*/ + __pyx_t_1 = __Pyx_GetItemInt(__pyx_v_probs, __pyx_v_i, __pyx_t_5thinc_5extra_6search_class_t, 0, __Pyx_PyLong_From_uint64_t, 0, 0, 1, 1, __Pyx_ReferenceSharing_OwnStrongReference); if (unlikely(!__pyx_t_1)) __PYX_ERR(0, 765, __pyx_L1_error) + __Pyx_GOTREF(__pyx_t_1); + __Pyx_XDECREF_SET(__pyx_v_prob, __pyx_t_1); + __pyx_t_1 = 0; + + /* "spacy/pipeline/_parser_internals/arc_eager.pyx":766 + * if state.is_final(): + * prob = probs[i] + * parse = [] # <<<<<<<<<<<<<< + * arcs = self.get_arcs(state) + * if arcs: +*/ + __pyx_t_1 = PyList_New(0); if (unlikely(!__pyx_t_1)) __PYX_ERR(0, 766, __pyx_L1_error) + __Pyx_GOTREF(__pyx_t_1); + __Pyx_XDECREF_SET(__pyx_v_parse, ((PyObject*)__pyx_t_1)); + __pyx_t_1 = 0; + + /* "spacy/pipeline/_parser_internals/arc_eager.pyx":767 + * prob = probs[i] + * parse = [] + * arcs = self.get_arcs(state) # <<<<<<<<<<<<<< + * if arcs: + * for arc in arcs: +*/ + __pyx_t_1 = ((struct __pyx_vtabstruct_5spacy_8pipeline_17_parser_internals_9arc_eager_ArcEager *)__pyx_v_self->__pyx_base.__pyx_vtab)->get_arcs(__pyx_v_self, __pyx_v_state); if (unlikely(!__pyx_t_1)) __PYX_ERR(0, 767, __pyx_L1_error) + __Pyx_GOTREF(__pyx_t_1); + __Pyx_XDECREF_SET(__pyx_v_arcs, __pyx_t_1); + __pyx_t_1 = 0; + + /* "spacy/pipeline/_parser_internals/arc_eager.pyx":768 + * parse = [] + * arcs = self.get_arcs(state) + * if arcs: # <<<<<<<<<<<<<< + * for arc in arcs: + * dep = arc["label"] +*/ + __pyx_t_6 = __Pyx_PyObject_IsTrue(__pyx_v_arcs); if (unlikely((__pyx_t_6 < 0))) __PYX_ERR(0, 768, __pyx_L1_error) + if (__pyx_t_6) { + + /* "spacy/pipeline/_parser_internals/arc_eager.pyx":769 + * arcs = self.get_arcs(state) + * if arcs: + * for arc in arcs: # <<<<<<<<<<<<<< + * dep = arc["label"] + * label = self.strings[dep] +*/ + if (likely(PyList_CheckExact(__pyx_v_arcs)) || PyTuple_CheckExact(__pyx_v_arcs)) { + __pyx_t_1 = __pyx_v_arcs; __Pyx_INCREF(__pyx_t_1); + __pyx_t_7 = 0; + __pyx_t_8 = NULL; + } else { + __pyx_t_7 = -1; __pyx_t_1 = PyObject_GetIter(__pyx_v_arcs); if (unlikely(!__pyx_t_1)) __PYX_ERR(0, 769, __pyx_L1_error) + __Pyx_GOTREF(__pyx_t_1); + __pyx_t_8 = (CYTHON_COMPILING_IN_LIMITED_API) ? PyIter_Next : __Pyx_PyObject_GetIterNextFunc(__pyx_t_1); if (unlikely(!__pyx_t_8)) __PYX_ERR(0, 769, __pyx_L1_error) + } + for (;;) { + if (likely(!__pyx_t_8)) { + if (likely(PyList_CheckExact(__pyx_t_1))) { + { + Py_ssize_t __pyx_temp = __Pyx_PyList_GET_SIZE(__pyx_t_1); + #if !CYTHON_ASSUME_SAFE_SIZE + if (unlikely((__pyx_temp < 0))) __PYX_ERR(0, 769, __pyx_L1_error) + #endif + if (__pyx_t_7 >= __pyx_temp) break; + } + __pyx_t_9 = __Pyx_PyList_GetItemRefFast(__pyx_t_1, __pyx_t_7, __Pyx_ReferenceSharing_OwnStrongReference); + ++__pyx_t_7; + } else { + { + Py_ssize_t __pyx_temp = __Pyx_PyTuple_GET_SIZE(__pyx_t_1); + #if !CYTHON_ASSUME_SAFE_SIZE + if (unlikely((__pyx_temp < 0))) __PYX_ERR(0, 769, __pyx_L1_error) + #endif + if (__pyx_t_7 >= __pyx_temp) break; + } + #if CYTHON_ASSUME_SAFE_MACROS && !CYTHON_AVOID_BORROWED_REFS + __pyx_t_9 = __Pyx_NewRef(PyTuple_GET_ITEM(__pyx_t_1, __pyx_t_7)); + #else + __pyx_t_9 = __Pyx_PySequence_ITEM(__pyx_t_1, __pyx_t_7); + #endif + ++__pyx_t_7; + } + if (unlikely(!__pyx_t_9)) __PYX_ERR(0, 769, __pyx_L1_error) + } else { + __pyx_t_9 = __pyx_t_8(__pyx_t_1); + if (unlikely(!__pyx_t_9)) { + PyObject* exc_type = PyErr_Occurred(); + if (exc_type) { + if (unlikely(!__Pyx_PyErr_GivenExceptionMatches(exc_type, PyExc_StopIteration))) __PYX_ERR(0, 769, __pyx_L1_error) + PyErr_Clear(); + } + break; + } + } + __Pyx_GOTREF(__pyx_t_9); + __Pyx_XDECREF_SET(__pyx_v_arc, __pyx_t_9); + __pyx_t_9 = 0; + + /* "spacy/pipeline/_parser_internals/arc_eager.pyx":770 + * if arcs: + * for arc in arcs: + * dep = arc["label"] # <<<<<<<<<<<<<< + * label = self.strings[dep] + * parse.append((arc["head"], arc["child"], label)) +*/ + __pyx_t_9 = __Pyx_PyObject_Dict_GetItem(__pyx_v_arc, __pyx_mstate_global->__pyx_n_u_label); if (unlikely(!__pyx_t_9)) __PYX_ERR(0, 770, __pyx_L1_error) + __Pyx_GOTREF(__pyx_t_9); + __Pyx_XDECREF_SET(__pyx_v_dep, __pyx_t_9); + __pyx_t_9 = 0; + + /* "spacy/pipeline/_parser_internals/arc_eager.pyx":771 + * for arc in arcs: + * dep = arc["label"] + * label = self.strings[dep] # <<<<<<<<<<<<<< + * parse.append((arc["head"], arc["child"], label)) + * parses.append((prob, parse)) +*/ + __pyx_t_9 = __Pyx_PyObject_GetItem(((PyObject *)__pyx_v_self->__pyx_base.strings), __pyx_v_dep); if (unlikely(!__pyx_t_9)) __PYX_ERR(0, 771, __pyx_L1_error) + __Pyx_GOTREF(__pyx_t_9); + __Pyx_XDECREF_SET(__pyx_v_label, __pyx_t_9); + __pyx_t_9 = 0; + + /* "spacy/pipeline/_parser_internals/arc_eager.pyx":772 + * dep = arc["label"] + * label = self.strings[dep] + * parse.append((arc["head"], arc["child"], label)) # <<<<<<<<<<<<<< + * parses.append((prob, parse)) + * return parses +*/ + __pyx_t_9 = __Pyx_PyObject_Dict_GetItem(__pyx_v_arc, __pyx_mstate_global->__pyx_n_u_head); if (unlikely(!__pyx_t_9)) __PYX_ERR(0, 772, __pyx_L1_error) + __Pyx_GOTREF(__pyx_t_9); + __pyx_t_10 = __Pyx_PyObject_Dict_GetItem(__pyx_v_arc, __pyx_mstate_global->__pyx_n_u_child); if (unlikely(!__pyx_t_10)) __PYX_ERR(0, 772, __pyx_L1_error) + __Pyx_GOTREF(__pyx_t_10); + __pyx_t_11 = PyTuple_New(3); if (unlikely(!__pyx_t_11)) __PYX_ERR(0, 772, __pyx_L1_error) + __Pyx_GOTREF(__pyx_t_11); + __Pyx_GIVEREF(__pyx_t_9); + if (__Pyx_PyTuple_SET_ITEM(__pyx_t_11, 0, __pyx_t_9) != (0)) __PYX_ERR(0, 772, __pyx_L1_error); + __Pyx_GIVEREF(__pyx_t_10); + if (__Pyx_PyTuple_SET_ITEM(__pyx_t_11, 1, __pyx_t_10) != (0)) __PYX_ERR(0, 772, __pyx_L1_error); + __Pyx_INCREF(__pyx_v_label); + __Pyx_GIVEREF(__pyx_v_label); + if (__Pyx_PyTuple_SET_ITEM(__pyx_t_11, 2, __pyx_v_label) != (0)) __PYX_ERR(0, 772, __pyx_L1_error); + __pyx_t_9 = 0; + __pyx_t_10 = 0; + __pyx_t_12 = __Pyx_PyList_Append(__pyx_v_parse, __pyx_t_11); if (unlikely(__pyx_t_12 == ((int)-1))) __PYX_ERR(0, 772, __pyx_L1_error) + __Pyx_DECREF(__pyx_t_11); __pyx_t_11 = 0; + + /* "spacy/pipeline/_parser_internals/arc_eager.pyx":769 + * arcs = self.get_arcs(state) + * if arcs: + * for arc in arcs: # <<<<<<<<<<<<<< + * dep = arc["label"] + * label = self.strings[dep] +*/ + } + __Pyx_DECREF(__pyx_t_1); __pyx_t_1 = 0; + + /* "spacy/pipeline/_parser_internals/arc_eager.pyx":773 + * label = self.strings[dep] + * parse.append((arc["head"], arc["child"], label)) + * parses.append((prob, parse)) # <<<<<<<<<<<<<< + * return parses + * +*/ + __pyx_t_1 = PyTuple_New(2); if (unlikely(!__pyx_t_1)) __PYX_ERR(0, 773, __pyx_L1_error) + __Pyx_GOTREF(__pyx_t_1); + __Pyx_INCREF(__pyx_v_prob); + __Pyx_GIVEREF(__pyx_v_prob); + if (__Pyx_PyTuple_SET_ITEM(__pyx_t_1, 0, __pyx_v_prob) != (0)) __PYX_ERR(0, 773, __pyx_L1_error); + __Pyx_INCREF(__pyx_v_parse); + __Pyx_GIVEREF(__pyx_v_parse); + if (__Pyx_PyTuple_SET_ITEM(__pyx_t_1, 1, __pyx_v_parse) != (0)) __PYX_ERR(0, 773, __pyx_L1_error); + __pyx_t_12 = __Pyx_PyList_Append(__pyx_v_parses, __pyx_t_1); if (unlikely(__pyx_t_12 == ((int)-1))) __PYX_ERR(0, 773, __pyx_L1_error) + __Pyx_DECREF(__pyx_t_1); __pyx_t_1 = 0; + + /* "spacy/pipeline/_parser_internals/arc_eager.pyx":768 + * parse = [] + * arcs = self.get_arcs(state) + * if arcs: # <<<<<<<<<<<<<< + * for arc in arcs: + * dep = arc["label"] +*/ + } + + /* "spacy/pipeline/_parser_internals/arc_eager.pyx":764 + * for i in range(beam.size): + * state = beam.at(i) + * if state.is_final(): # <<<<<<<<<<<<<< + * prob = probs[i] + * parse = [] +*/ + } + } + + /* "spacy/pipeline/_parser_internals/arc_eager.pyx":774 + * parse.append((arc["head"], arc["child"], label)) + * parses.append((prob, parse)) + * return parses # <<<<<<<<<<<<<< + * + * cdef get_arcs(self, StateC* state): +*/ + __Pyx_XDECREF(__pyx_r); + __Pyx_INCREF(__pyx_v_parses); + __pyx_r = __pyx_v_parses; + goto __pyx_L0; + + /* "spacy/pipeline/_parser_internals/arc_eager.pyx":759 + * set_children_from_heads(doc.c, 0, doc.length) + * + * def get_beam_parses(self, Beam beam): # <<<<<<<<<<<<<< + * parses = [] + * probs = beam.probs +*/ + + /* function exit code */ + __pyx_L1_error:; + __Pyx_XDECREF(__pyx_t_1); + __Pyx_XDECREF(__pyx_t_9); + __Pyx_XDECREF(__pyx_t_10); + __Pyx_XDECREF(__pyx_t_11); + __Pyx_AddTraceback("spacy.pipeline._parser_internals.arc_eager.ArcEager.get_beam_parses", __pyx_clineno, __pyx_lineno, __pyx_filename); + __pyx_r = NULL; + __pyx_L0:; + __Pyx_XDECREF(__pyx_v_parses); + __Pyx_XDECREF(__pyx_v_probs); + __Pyx_XDECREF(__pyx_v_prob); + __Pyx_XDECREF(__pyx_v_parse); + __Pyx_XDECREF(__pyx_v_arcs); + __Pyx_XDECREF(__pyx_v_arc); + __Pyx_XDECREF(__pyx_v_dep); + __Pyx_XDECREF(__pyx_v_label); + __Pyx_XGIVEREF(__pyx_r); + __Pyx_RefNannyFinishContext(); + return __pyx_r; +} + +/* "spacy/pipeline/_parser_internals/arc_eager.pyx":776 + * return parses + * + * cdef get_arcs(self, StateC* state): # <<<<<<<<<<<<<< + * cdef vector[ArcC] arcs + * state.get_arcs(&arcs) +*/ + +static PyObject *__pyx_f_5spacy_8pipeline_17_parser_internals_9arc_eager_8ArcEager_get_arcs(CYTHON_UNUSED struct __pyx_obj_5spacy_8pipeline_17_parser_internals_9arc_eager_ArcEager *__pyx_v_self, __pyx_t_5spacy_8pipeline_17_parser_internals_6_state_StateC *__pyx_v_state) { + std::vector __pyx_v_arcs; + PyObject *__pyx_r = NULL; + __Pyx_RefNannyDeclarations + PyObject *__pyx_t_1 = NULL; + PyObject *__pyx_t_2 = NULL; + int __pyx_lineno = 0; + const char *__pyx_filename = NULL; + int __pyx_clineno = 0; + __Pyx_RefNannySetupContext("get_arcs", 0); + + /* "spacy/pipeline/_parser_internals/arc_eager.pyx":778 + * cdef get_arcs(self, StateC* state): + * cdef vector[ArcC] arcs + * state.get_arcs(&arcs) # <<<<<<<<<<<<<< + * return list(arcs) + * +*/ + __pyx_v_state->get_arcs((&__pyx_v_arcs)); + + /* "spacy/pipeline/_parser_internals/arc_eager.pyx":779 + * cdef vector[ArcC] arcs + * state.get_arcs(&arcs) + * return list(arcs) # <<<<<<<<<<<<<< + * + * def has_gold(self, Example eg, start=0, end=None): +*/ + __Pyx_XDECREF(__pyx_r); + __pyx_t_1 = __pyx_convert_vector_to_py_struct____pyx_t_5spacy_8pipeline_17_parser_internals_6_state_ArcC(__pyx_v_arcs); if (unlikely(!__pyx_t_1)) __PYX_ERR(0, 779, __pyx_L1_error) + __Pyx_GOTREF(__pyx_t_1); + __pyx_t_2 = __Pyx_PySequence_ListKeepNew(__pyx_t_1); if (unlikely(!__pyx_t_2)) __PYX_ERR(0, 779, __pyx_L1_error) + __Pyx_GOTREF(__pyx_t_2); + __Pyx_DECREF(__pyx_t_1); __pyx_t_1 = 0; + __pyx_r = __pyx_t_2; + __pyx_t_2 = 0; + goto __pyx_L0; + + /* "spacy/pipeline/_parser_internals/arc_eager.pyx":776 + * return parses + * + * cdef get_arcs(self, StateC* state): # <<<<<<<<<<<<<< + * cdef vector[ArcC] arcs + * state.get_arcs(&arcs) +*/ + + /* function exit code */ + __pyx_L1_error:; + __Pyx_XDECREF(__pyx_t_1); + __Pyx_XDECREF(__pyx_t_2); + __Pyx_AddTraceback("spacy.pipeline._parser_internals.arc_eager.ArcEager.get_arcs", __pyx_clineno, __pyx_lineno, __pyx_filename); + __pyx_r = 0; + __pyx_L0:; + __Pyx_XGIVEREF(__pyx_r); + __Pyx_RefNannyFinishContext(); + return __pyx_r; +} + +/* "spacy/pipeline/_parser_internals/arc_eager.pyx":781 + * return list(arcs) + * + * def has_gold(self, Example eg, start=0, end=None): # <<<<<<<<<<<<<< + * for word in eg.y[start:end]: + * if word.dep != 0: +*/ + +/* Python wrapper */ +static PyObject *__pyx_pw_5spacy_8pipeline_17_parser_internals_9arc_eager_8ArcEager_25has_gold(PyObject *__pyx_v_self, +#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_5spacy_8pipeline_17_parser_internals_9arc_eager_8ArcEager_24has_gold, "ArcEager.has_gold(self, Example eg, start=0, end=None)"); +static PyMethodDef __pyx_mdef_5spacy_8pipeline_17_parser_internals_9arc_eager_8ArcEager_25has_gold = {"has_gold", (PyCFunction)(void(*)(void))(__Pyx_PyCFunction_FastCallWithKeywords)__pyx_pw_5spacy_8pipeline_17_parser_internals_9arc_eager_8ArcEager_25has_gold, __Pyx_METH_FASTCALL|METH_KEYWORDS, __pyx_doc_5spacy_8pipeline_17_parser_internals_9arc_eager_8ArcEager_24has_gold}; +static PyObject *__pyx_pw_5spacy_8pipeline_17_parser_internals_9arc_eager_8ArcEager_25has_gold(PyObject *__pyx_v_self, +#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_5spacy_8training_7example_Example *__pyx_v_eg = 0; + PyObject *__pyx_v_start = 0; + PyObject *__pyx_v_end = 0; + #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("has_gold (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_eg,&__pyx_mstate_global->__pyx_n_u_start,&__pyx_mstate_global->__pyx_n_u_end,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, 781, __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, 781, __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, 781, __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, 781, __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, "has_gold", 0) < (0)) __PYX_ERR(0, 781, __pyx_L3_error) + if (!values[1]) values[1] = __Pyx_NewRef(((PyObject *)__pyx_mstate_global->__pyx_int_0)); + if (!values[2]) values[2] = __Pyx_NewRef(((PyObject *)Py_None)); + for (Py_ssize_t i = __pyx_nargs; i < 1; i++) { + if (unlikely(!values[i])) { __Pyx_RaiseArgtupleInvalid("has_gold", 0, 1, 3, i); __PYX_ERR(0, 781, __pyx_L3_error) } + } + } else { + switch (__pyx_nargs) { + case 3: + values[2] = __Pyx_ArgRef_FASTCALL(__pyx_args, 2); + if (!CYTHON_ASSUME_SAFE_MACROS && unlikely(!values[2])) __PYX_ERR(0, 781, __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, 781, __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, 781, __pyx_L3_error) + break; + default: goto __pyx_L5_argtuple_error; + } + if (!values[1]) values[1] = __Pyx_NewRef(((PyObject *)__pyx_mstate_global->__pyx_int_0)); + if (!values[2]) values[2] = __Pyx_NewRef(((PyObject *)Py_None)); + } + __pyx_v_eg = ((struct __pyx_obj_5spacy_8training_7example_Example *)values[0]); + __pyx_v_start = values[1]; + __pyx_v_end = values[2]; + } + goto __pyx_L6_skip; + __pyx_L5_argtuple_error:; + __Pyx_RaiseArgtupleInvalid("has_gold", 0, 1, 3, __pyx_nargs); __PYX_ERR(0, 781, __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("spacy.pipeline._parser_internals.arc_eager.ArcEager.has_gold", __pyx_clineno, __pyx_lineno, __pyx_filename); + __Pyx_RefNannyFinishContext(); + return NULL; + __pyx_L4_argument_unpacking_done:; + if (unlikely(!__Pyx_ArgTypeTest(((PyObject *)__pyx_v_eg), __pyx_mstate_global->__pyx_ptype_5spacy_8training_7example_Example, 1, "eg", 0))) __PYX_ERR(0, 781, __pyx_L1_error) + __pyx_r = __pyx_pf_5spacy_8pipeline_17_parser_internals_9arc_eager_8ArcEager_24has_gold(((struct __pyx_obj_5spacy_8pipeline_17_parser_internals_9arc_eager_ArcEager *)__pyx_v_self), __pyx_v_eg, __pyx_v_start, __pyx_v_end); + + /* 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_5spacy_8pipeline_17_parser_internals_9arc_eager_8ArcEager_24has_gold(CYTHON_UNUSED struct __pyx_obj_5spacy_8pipeline_17_parser_internals_9arc_eager_ArcEager *__pyx_v_self, struct __pyx_obj_5spacy_8training_7example_Example *__pyx_v_eg, PyObject *__pyx_v_start, PyObject *__pyx_v_end) { + PyObject *__pyx_v_word = NULL; + PyObject *__pyx_r = NULL; + __Pyx_RefNannyDeclarations + PyObject *__pyx_t_1 = NULL; + PyObject *__pyx_t_2 = NULL; + Py_ssize_t __pyx_t_3; + PyObject *(*__pyx_t_4)(PyObject *); + int __pyx_t_5; + int __pyx_lineno = 0; + const char *__pyx_filename = NULL; + int __pyx_clineno = 0; + __Pyx_RefNannySetupContext("has_gold", 0); + + /* "spacy/pipeline/_parser_internals/arc_eager.pyx":782 + * + * def has_gold(self, Example eg, start=0, end=None): + * for word in eg.y[start:end]: # <<<<<<<<<<<<<< + * if word.dep != 0: + * return True +*/ + __pyx_t_1 = __Pyx_PyObject_GetSlice(((PyObject *)__pyx_v_eg->y), 0, 0, &__pyx_v_start, &__pyx_v_end, NULL, 0, 0, 1); if (unlikely(!__pyx_t_1)) __PYX_ERR(0, 782, __pyx_L1_error) + __Pyx_GOTREF(__pyx_t_1); + if (likely(PyList_CheckExact(__pyx_t_1)) || PyTuple_CheckExact(__pyx_t_1)) { + __pyx_t_2 = __pyx_t_1; __Pyx_INCREF(__pyx_t_2); + __pyx_t_3 = 0; + __pyx_t_4 = NULL; + } else { + __pyx_t_3 = -1; __pyx_t_2 = PyObject_GetIter(__pyx_t_1); if (unlikely(!__pyx_t_2)) __PYX_ERR(0, 782, __pyx_L1_error) + __Pyx_GOTREF(__pyx_t_2); + __pyx_t_4 = (CYTHON_COMPILING_IN_LIMITED_API) ? PyIter_Next : __Pyx_PyObject_GetIterNextFunc(__pyx_t_2); if (unlikely(!__pyx_t_4)) __PYX_ERR(0, 782, __pyx_L1_error) + } + __Pyx_DECREF(__pyx_t_1); __pyx_t_1 = 0; + for (;;) { + if (likely(!__pyx_t_4)) { + if (likely(PyList_CheckExact(__pyx_t_2))) { + { + Py_ssize_t __pyx_temp = __Pyx_PyList_GET_SIZE(__pyx_t_2); + #if !CYTHON_ASSUME_SAFE_SIZE + if (unlikely((__pyx_temp < 0))) __PYX_ERR(0, 782, __pyx_L1_error) + #endif + if (__pyx_t_3 >= __pyx_temp) break; + } + __pyx_t_1 = __Pyx_PyList_GetItemRefFast(__pyx_t_2, __pyx_t_3, __Pyx_ReferenceSharing_OwnStrongReference); + ++__pyx_t_3; + } else { + { + Py_ssize_t __pyx_temp = __Pyx_PyTuple_GET_SIZE(__pyx_t_2); + #if !CYTHON_ASSUME_SAFE_SIZE + if (unlikely((__pyx_temp < 0))) __PYX_ERR(0, 782, __pyx_L1_error) + #endif + if (__pyx_t_3 >= __pyx_temp) break; + } + #if CYTHON_ASSUME_SAFE_MACROS && !CYTHON_AVOID_BORROWED_REFS + __pyx_t_1 = __Pyx_NewRef(PyTuple_GET_ITEM(__pyx_t_2, __pyx_t_3)); + #else + __pyx_t_1 = __Pyx_PySequence_ITEM(__pyx_t_2, __pyx_t_3); + #endif + ++__pyx_t_3; + } + if (unlikely(!__pyx_t_1)) __PYX_ERR(0, 782, __pyx_L1_error) + } else { + __pyx_t_1 = __pyx_t_4(__pyx_t_2); + if (unlikely(!__pyx_t_1)) { + PyObject* exc_type = PyErr_Occurred(); + if (exc_type) { + if (unlikely(!__Pyx_PyErr_GivenExceptionMatches(exc_type, PyExc_StopIteration))) __PYX_ERR(0, 782, __pyx_L1_error) + PyErr_Clear(); + } + break; + } + } + __Pyx_GOTREF(__pyx_t_1); + __Pyx_XDECREF_SET(__pyx_v_word, __pyx_t_1); + __pyx_t_1 = 0; + + /* "spacy/pipeline/_parser_internals/arc_eager.pyx":783 + * def has_gold(self, Example eg, start=0, end=None): + * for word in eg.y[start:end]: + * if word.dep != 0: # <<<<<<<<<<<<<< + * return True + * else: +*/ + __pyx_t_1 = __Pyx_PyObject_GetAttrStr(__pyx_v_word, __pyx_mstate_global->__pyx_n_u_dep); if (unlikely(!__pyx_t_1)) __PYX_ERR(0, 783, __pyx_L1_error) + __Pyx_GOTREF(__pyx_t_1); + __pyx_t_5 = (__Pyx_PyLong_BoolNeObjC(__pyx_t_1, __pyx_mstate_global->__pyx_int_0, 0, 0)); if (unlikely((__pyx_t_5 < 0))) __PYX_ERR(0, 783, __pyx_L1_error) + __Pyx_DECREF(__pyx_t_1); __pyx_t_1 = 0; + if (__pyx_t_5) { + + /* "spacy/pipeline/_parser_internals/arc_eager.pyx":784 + * for word in eg.y[start:end]: + * if word.dep != 0: + * return True # <<<<<<<<<<<<<< + * else: + * return False +*/ + __Pyx_XDECREF(__pyx_r); + __Pyx_INCREF(Py_True); + __pyx_r = Py_True; + __Pyx_DECREF(__pyx_t_2); __pyx_t_2 = 0; + goto __pyx_L0; + + /* "spacy/pipeline/_parser_internals/arc_eager.pyx":783 + * def has_gold(self, Example eg, start=0, end=None): + * for word in eg.y[start:end]: + * if word.dep != 0: # <<<<<<<<<<<<<< + * return True + * else: +*/ + } + + /* "spacy/pipeline/_parser_internals/arc_eager.pyx":782 + * + * def has_gold(self, Example eg, start=0, end=None): + * for word in eg.y[start:end]: # <<<<<<<<<<<<<< + * if word.dep != 0: + * return True +*/ + } + __Pyx_DECREF(__pyx_t_2); __pyx_t_2 = 0; + /*else*/ { + + /* "spacy/pipeline/_parser_internals/arc_eager.pyx":786 + * return True + * else: + * return False # <<<<<<<<<<<<<< + * + * cdef int set_valid(self, int* output, const StateC* st) noexcept nogil: +*/ + __Pyx_XDECREF(__pyx_r); + __Pyx_INCREF(Py_False); + __pyx_r = Py_False; + goto __pyx_L0; + } + + /* "spacy/pipeline/_parser_internals/arc_eager.pyx":781 + * return list(arcs) + * + * def has_gold(self, Example eg, start=0, end=None): # <<<<<<<<<<<<<< + * for word in eg.y[start:end]: + * if word.dep != 0: +*/ + + /* function exit code */ + __pyx_L1_error:; + __Pyx_XDECREF(__pyx_t_1); + __Pyx_XDECREF(__pyx_t_2); + __Pyx_AddTraceback("spacy.pipeline._parser_internals.arc_eager.ArcEager.has_gold", __pyx_clineno, __pyx_lineno, __pyx_filename); + __pyx_r = NULL; + __pyx_L0:; + __Pyx_XDECREF(__pyx_v_word); + __Pyx_XGIVEREF(__pyx_r); + __Pyx_RefNannyFinishContext(); + return __pyx_r; +} + +/* "spacy/pipeline/_parser_internals/arc_eager.pyx":788 + * return False + * + * cdef int set_valid(self, int* output, const StateC* st) noexcept nogil: # <<<<<<<<<<<<<< + * cdef int[N_MOVES] is_valid + * is_valid[SHIFT] = Shift.is_valid(st, 0) +*/ + +static int __pyx_f_5spacy_8pipeline_17_parser_internals_9arc_eager_8ArcEager_set_valid(struct __pyx_obj_5spacy_8pipeline_17_parser_internals_9arc_eager_ArcEager *__pyx_v_self, int *__pyx_v_output, __pyx_t_5spacy_8pipeline_17_parser_internals_6_state_StateC const *__pyx_v_st) { + int __pyx_v_is_valid[__pyx_e_5spacy_8pipeline_17_parser_internals_9arc_eager_N_MOVES]; + int __pyx_v_i; + int __pyx_r; + int __pyx_t_1; + int __pyx_t_2; + int __pyx_t_3; + int __pyx_t_4; + + /* "spacy/pipeline/_parser_internals/arc_eager.pyx":790 + * cdef int set_valid(self, int* output, const StateC* st) noexcept nogil: + * cdef int[N_MOVES] is_valid + * is_valid[SHIFT] = Shift.is_valid(st, 0) # <<<<<<<<<<<<<< + * is_valid[REDUCE] = Reduce.is_valid(st, 0) + * is_valid[LEFT] = LeftArc.is_valid(st, 0) +*/ + (__pyx_v_is_valid[__pyx_e_5spacy_8pipeline_17_parser_internals_9arc_eager_SHIFT]) = __pyx_f_5spacy_8pipeline_17_parser_internals_9arc_eager_5Shift_is_valid(__pyx_v_st, 0); + + /* "spacy/pipeline/_parser_internals/arc_eager.pyx":791 + * cdef int[N_MOVES] is_valid + * is_valid[SHIFT] = Shift.is_valid(st, 0) + * is_valid[REDUCE] = Reduce.is_valid(st, 0) # <<<<<<<<<<<<<< + * is_valid[LEFT] = LeftArc.is_valid(st, 0) + * is_valid[RIGHT] = RightArc.is_valid(st, 0) +*/ + (__pyx_v_is_valid[__pyx_e_5spacy_8pipeline_17_parser_internals_9arc_eager_REDUCE]) = __pyx_f_5spacy_8pipeline_17_parser_internals_9arc_eager_6Reduce_is_valid(__pyx_v_st, 0); + + /* "spacy/pipeline/_parser_internals/arc_eager.pyx":792 + * is_valid[SHIFT] = Shift.is_valid(st, 0) + * is_valid[REDUCE] = Reduce.is_valid(st, 0) + * is_valid[LEFT] = LeftArc.is_valid(st, 0) # <<<<<<<<<<<<<< + * is_valid[RIGHT] = RightArc.is_valid(st, 0) + * is_valid[BREAK] = Break.is_valid(st, 0) +*/ + (__pyx_v_is_valid[__pyx_e_5spacy_8pipeline_17_parser_internals_9arc_eager_LEFT]) = __pyx_f_5spacy_8pipeline_17_parser_internals_9arc_eager_7LeftArc_is_valid(__pyx_v_st, 0); + + /* "spacy/pipeline/_parser_internals/arc_eager.pyx":793 + * is_valid[REDUCE] = Reduce.is_valid(st, 0) + * is_valid[LEFT] = LeftArc.is_valid(st, 0) + * is_valid[RIGHT] = RightArc.is_valid(st, 0) # <<<<<<<<<<<<<< + * is_valid[BREAK] = Break.is_valid(st, 0) + * cdef int i +*/ + (__pyx_v_is_valid[__pyx_e_5spacy_8pipeline_17_parser_internals_9arc_eager_RIGHT]) = __pyx_f_5spacy_8pipeline_17_parser_internals_9arc_eager_8RightArc_is_valid(__pyx_v_st, 0); + + /* "spacy/pipeline/_parser_internals/arc_eager.pyx":794 + * is_valid[LEFT] = LeftArc.is_valid(st, 0) + * is_valid[RIGHT] = RightArc.is_valid(st, 0) + * is_valid[BREAK] = Break.is_valid(st, 0) # <<<<<<<<<<<<<< + * cdef int i + * for i in range(self.n_moves): +*/ + (__pyx_v_is_valid[__pyx_e_5spacy_8pipeline_17_parser_internals_9arc_eager_BREAK]) = __pyx_f_5spacy_8pipeline_17_parser_internals_9arc_eager_5Break_is_valid(__pyx_v_st, 0); + + /* "spacy/pipeline/_parser_internals/arc_eager.pyx":796 + * is_valid[BREAK] = Break.is_valid(st, 0) + * cdef int i + * for i in range(self.n_moves): # <<<<<<<<<<<<<< + * if self.c[i].label == SUBTOK_LABEL: + * output[i] = self.c[i].is_valid(st, self.c[i].label) +*/ + __pyx_t_1 = __pyx_v_self->__pyx_base.n_moves; + __pyx_t_2 = __pyx_t_1; + for (__pyx_t_3 = 0; __pyx_t_3 < __pyx_t_2; __pyx_t_3+=1) { + __pyx_v_i = __pyx_t_3; + + /* "spacy/pipeline/_parser_internals/arc_eager.pyx":797 + * cdef int i + * for i in range(self.n_moves): + * if self.c[i].label == SUBTOK_LABEL: # <<<<<<<<<<<<<< + * output[i] = self.c[i].is_valid(st, self.c[i].label) + * else: +*/ + __pyx_t_4 = ((__pyx_v_self->__pyx_base.c[__pyx_v_i]).label == __pyx_v_5spacy_8pipeline_17_parser_internals_9arc_eager_SUBTOK_LABEL); + if (__pyx_t_4) { + + /* "spacy/pipeline/_parser_internals/arc_eager.pyx":798 + * for i in range(self.n_moves): + * if self.c[i].label == SUBTOK_LABEL: + * output[i] = self.c[i].is_valid(st, self.c[i].label) # <<<<<<<<<<<<<< + * else: + * output[i] = is_valid[self.c[i].move] +*/ + (__pyx_v_output[__pyx_v_i]) = (__pyx_v_self->__pyx_base.c[__pyx_v_i]).is_valid(__pyx_v_st, (__pyx_v_self->__pyx_base.c[__pyx_v_i]).label); + + /* "spacy/pipeline/_parser_internals/arc_eager.pyx":797 + * cdef int i + * for i in range(self.n_moves): + * if self.c[i].label == SUBTOK_LABEL: # <<<<<<<<<<<<<< + * output[i] = self.c[i].is_valid(st, self.c[i].label) + * else: +*/ + goto __pyx_L5; + } + + /* "spacy/pipeline/_parser_internals/arc_eager.pyx":800 + * output[i] = self.c[i].is_valid(st, self.c[i].label) + * else: + * output[i] = is_valid[self.c[i].move] # <<<<<<<<<<<<<< + * + * def get_cost(self, StateClass stcls, gold, int i): +*/ + /*else*/ { + (__pyx_v_output[__pyx_v_i]) = (__pyx_v_is_valid[(__pyx_v_self->__pyx_base.c[__pyx_v_i]).move]); + } + __pyx_L5:; + } + + /* "spacy/pipeline/_parser_internals/arc_eager.pyx":788 + * return False + * + * cdef int set_valid(self, int* output, const StateC* st) noexcept nogil: # <<<<<<<<<<<<<< + * cdef int[N_MOVES] is_valid + * is_valid[SHIFT] = Shift.is_valid(st, 0) +*/ + + /* function exit code */ + __pyx_r = 0; + return __pyx_r; +} + +/* "spacy/pipeline/_parser_internals/arc_eager.pyx":802 + * output[i] = is_valid[self.c[i].move] + * + * def get_cost(self, StateClass stcls, gold, int i): # <<<<<<<<<<<<<< + * if not isinstance(gold, ArcEagerGold): + * raise TypeError(Errors.E909.format(name="ArcEagerGold")) +*/ + +/* Python wrapper */ +static PyObject *__pyx_pw_5spacy_8pipeline_17_parser_internals_9arc_eager_8ArcEager_27get_cost(PyObject *__pyx_v_self, +#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_5spacy_8pipeline_17_parser_internals_9arc_eager_8ArcEager_26get_cost, "ArcEager.get_cost(self, StateClass stcls, gold, int i)"); +static PyMethodDef __pyx_mdef_5spacy_8pipeline_17_parser_internals_9arc_eager_8ArcEager_27get_cost = {"get_cost", (PyCFunction)(void(*)(void))(__Pyx_PyCFunction_FastCallWithKeywords)__pyx_pw_5spacy_8pipeline_17_parser_internals_9arc_eager_8ArcEager_27get_cost, __Pyx_METH_FASTCALL|METH_KEYWORDS, __pyx_doc_5spacy_8pipeline_17_parser_internals_9arc_eager_8ArcEager_26get_cost}; +static PyObject *__pyx_pw_5spacy_8pipeline_17_parser_internals_9arc_eager_8ArcEager_27get_cost(PyObject *__pyx_v_self, +#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_5spacy_8pipeline_17_parser_internals_10stateclass_StateClass *__pyx_v_stcls = 0; + PyObject *__pyx_v_gold = 0; + int __pyx_v_i; + #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("get_cost (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_stcls,&__pyx_mstate_global->__pyx_n_u_gold,&__pyx_mstate_global->__pyx_n_u_i,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, 802, __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, 802, __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, 802, __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, 802, __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, "get_cost", 0) < (0)) __PYX_ERR(0, 802, __pyx_L3_error) + for (Py_ssize_t i = __pyx_nargs; i < 3; i++) { + if (unlikely(!values[i])) { __Pyx_RaiseArgtupleInvalid("get_cost", 1, 3, 3, i); __PYX_ERR(0, 802, __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, 802, __pyx_L3_error) + values[1] = __Pyx_ArgRef_FASTCALL(__pyx_args, 1); + if (!CYTHON_ASSUME_SAFE_MACROS && unlikely(!values[1])) __PYX_ERR(0, 802, __pyx_L3_error) + values[2] = __Pyx_ArgRef_FASTCALL(__pyx_args, 2); + if (!CYTHON_ASSUME_SAFE_MACROS && unlikely(!values[2])) __PYX_ERR(0, 802, __pyx_L3_error) + } + __pyx_v_stcls = ((struct __pyx_obj_5spacy_8pipeline_17_parser_internals_10stateclass_StateClass *)values[0]); + __pyx_v_gold = values[1]; + __pyx_v_i = __Pyx_PyLong_As_int(values[2]); if (unlikely((__pyx_v_i == (int)-1) && PyErr_Occurred())) __PYX_ERR(0, 802, __pyx_L3_error) + } + goto __pyx_L6_skip; + __pyx_L5_argtuple_error:; + __Pyx_RaiseArgtupleInvalid("get_cost", 1, 3, 3, __pyx_nargs); __PYX_ERR(0, 802, __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("spacy.pipeline._parser_internals.arc_eager.ArcEager.get_cost", __pyx_clineno, __pyx_lineno, __pyx_filename); + __Pyx_RefNannyFinishContext(); + return NULL; + __pyx_L4_argument_unpacking_done:; + if (unlikely(!__Pyx_ArgTypeTest(((PyObject *)__pyx_v_stcls), __pyx_mstate_global->__pyx_ptype_5spacy_8pipeline_17_parser_internals_10stateclass_StateClass, 1, "stcls", 0))) __PYX_ERR(0, 802, __pyx_L1_error) + __pyx_r = __pyx_pf_5spacy_8pipeline_17_parser_internals_9arc_eager_8ArcEager_26get_cost(((struct __pyx_obj_5spacy_8pipeline_17_parser_internals_9arc_eager_ArcEager *)__pyx_v_self), __pyx_v_stcls, __pyx_v_gold, __pyx_v_i); + + /* 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_5spacy_8pipeline_17_parser_internals_9arc_eager_8ArcEager_26get_cost(struct __pyx_obj_5spacy_8pipeline_17_parser_internals_9arc_eager_ArcEager *__pyx_v_self, struct __pyx_obj_5spacy_8pipeline_17_parser_internals_10stateclass_StateClass *__pyx_v_stcls, PyObject *__pyx_v_gold, int __pyx_v_i) { + struct __pyx_obj_5spacy_8pipeline_17_parser_internals_9arc_eager_ArcEagerGold *__pyx_v_gold_ = 0; + struct __pyx_t_5spacy_8pipeline_17_parser_internals_9arc_eager_GoldParseStateC __pyx_v_gold_state; + __pyx_t_5spacy_8typedefs_weight_t __pyx_v_cost; + PyObject *__pyx_r = NULL; + __Pyx_RefNannyDeclarations + int __pyx_t_1; + int __pyx_t_2; + PyObject *__pyx_t_3 = NULL; + PyObject *__pyx_t_4 = NULL; + PyObject *__pyx_t_5 = NULL; + PyObject *__pyx_t_6 = NULL; + PyObject *__pyx_t_7 = NULL; + PyObject *__pyx_t_8 = NULL; + size_t __pyx_t_9; + struct __pyx_t_5spacy_8pipeline_17_parser_internals_9arc_eager_GoldParseStateC __pyx_t_10; + int __pyx_lineno = 0; + const char *__pyx_filename = NULL; + int __pyx_clineno = 0; + __Pyx_RefNannySetupContext("get_cost", 0); + + /* "spacy/pipeline/_parser_internals/arc_eager.pyx":803 + * + * def get_cost(self, StateClass stcls, gold, int i): + * if not isinstance(gold, ArcEagerGold): # <<<<<<<<<<<<<< + * raise TypeError(Errors.E909.format(name="ArcEagerGold")) + * cdef ArcEagerGold gold_ = gold +*/ + __pyx_t_1 = __Pyx_TypeCheck(__pyx_v_gold, __pyx_mstate_global->__pyx_ptype_5spacy_8pipeline_17_parser_internals_9arc_eager_ArcEagerGold); + __pyx_t_2 = (!__pyx_t_1); + if (unlikely(__pyx_t_2)) { + + /* "spacy/pipeline/_parser_internals/arc_eager.pyx":804 + * def get_cost(self, StateClass stcls, gold, int i): + * if not isinstance(gold, ArcEagerGold): + * raise TypeError(Errors.E909.format(name="ArcEagerGold")) # <<<<<<<<<<<<<< + * cdef ArcEagerGold gold_ = gold + * gold_state = gold_.c +*/ + __pyx_t_4 = NULL; + __Pyx_GetModuleGlobalName(__pyx_t_7, __pyx_mstate_global->__pyx_n_u_Errors); if (unlikely(!__pyx_t_7)) __PYX_ERR(0, 804, __pyx_L1_error) + __Pyx_GOTREF(__pyx_t_7); + __pyx_t_8 = __Pyx_PyObject_GetAttrStr(__pyx_t_7, __pyx_mstate_global->__pyx_n_u_E909); if (unlikely(!__pyx_t_8)) __PYX_ERR(0, 804, __pyx_L1_error) + __Pyx_GOTREF(__pyx_t_8); + __Pyx_DECREF(__pyx_t_7); __pyx_t_7 = 0; + __pyx_t_6 = __pyx_t_8; + __Pyx_INCREF(__pyx_t_6); + __pyx_t_9 = 0; + { + PyObject *__pyx_callargs[2 + ((CYTHON_VECTORCALL) ? 1 : 0)] = {__pyx_t_6, NULL}; + __pyx_t_7 = __Pyx_MakeVectorcallBuilderKwds(1); if (unlikely(!__pyx_t_7)) __PYX_ERR(0, 804, __pyx_L1_error) + __Pyx_GOTREF(__pyx_t_7); + if (__Pyx_VectorcallBuilder_AddArg(__pyx_mstate_global->__pyx_n_u_name, __pyx_mstate_global->__pyx_n_u_ArcEagerGold, __pyx_t_7, __pyx_callargs+1, 0) < (0)) __PYX_ERR(0, 804, __pyx_L1_error) + __pyx_t_5 = __Pyx_Object_VectorcallMethod_CallFromBuilder((PyObject*)__pyx_mstate_global->__pyx_n_u_format, __pyx_callargs+__pyx_t_9, (1-__pyx_t_9) | (1*__Pyx_PY_VECTORCALL_ARGUMENTS_OFFSET), __pyx_t_7); + __Pyx_XDECREF(__pyx_t_6); __pyx_t_6 = 0; + __Pyx_DECREF(__pyx_t_7); __pyx_t_7 = 0; + __Pyx_DECREF(__pyx_t_8); __pyx_t_8 = 0; + if (unlikely(!__pyx_t_5)) __PYX_ERR(0, 804, __pyx_L1_error) + __Pyx_GOTREF(__pyx_t_5); + } + __pyx_t_9 = 1; + { + PyObject *__pyx_callargs[2] = {__pyx_t_4, __pyx_t_5}; + __pyx_t_3 = __Pyx_PyObject_FastCall((PyObject*)(((PyTypeObject*)PyExc_TypeError)), __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_5); __pyx_t_5 = 0; + if (unlikely(!__pyx_t_3)) __PYX_ERR(0, 804, __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, 804, __pyx_L1_error) + + /* "spacy/pipeline/_parser_internals/arc_eager.pyx":803 + * + * def get_cost(self, StateClass stcls, gold, int i): + * if not isinstance(gold, ArcEagerGold): # <<<<<<<<<<<<<< + * raise TypeError(Errors.E909.format(name="ArcEagerGold")) + * cdef ArcEagerGold gold_ = gold +*/ + } + + /* "spacy/pipeline/_parser_internals/arc_eager.pyx":805 + * if not isinstance(gold, ArcEagerGold): + * raise TypeError(Errors.E909.format(name="ArcEagerGold")) + * cdef ArcEagerGold gold_ = gold # <<<<<<<<<<<<<< + * gold_state = gold_.c + * if self.c[i].is_valid(stcls.c, self.c[i].label): +*/ + __pyx_t_3 = __pyx_v_gold; + __Pyx_INCREF(__pyx_t_3); + if (!(likely(((__pyx_t_3) == Py_None) || likely(__Pyx_TypeTest(__pyx_t_3, __pyx_mstate_global->__pyx_ptype_5spacy_8pipeline_17_parser_internals_9arc_eager_ArcEagerGold))))) __PYX_ERR(0, 805, __pyx_L1_error) + __pyx_v_gold_ = ((struct __pyx_obj_5spacy_8pipeline_17_parser_internals_9arc_eager_ArcEagerGold *)__pyx_t_3); + __pyx_t_3 = 0; + + /* "spacy/pipeline/_parser_internals/arc_eager.pyx":806 + * raise TypeError(Errors.E909.format(name="ArcEagerGold")) + * cdef ArcEagerGold gold_ = gold + * gold_state = gold_.c # <<<<<<<<<<<<<< + * if self.c[i].is_valid(stcls.c, self.c[i].label): + * cost = self.c[i].get_cost(stcls.c, &gold_state, self.c[i].label) +*/ + __pyx_t_10 = __pyx_v_gold_->c; + __pyx_v_gold_state = __pyx_t_10; + + /* "spacy/pipeline/_parser_internals/arc_eager.pyx":807 + * cdef ArcEagerGold gold_ = gold + * gold_state = gold_.c + * if self.c[i].is_valid(stcls.c, self.c[i].label): # <<<<<<<<<<<<<< + * cost = self.c[i].get_cost(stcls.c, &gold_state, self.c[i].label) + * else: +*/ + __pyx_t_2 = (__pyx_v_self->__pyx_base.c[__pyx_v_i]).is_valid(__pyx_v_stcls->c, (__pyx_v_self->__pyx_base.c[__pyx_v_i]).label); + if (__pyx_t_2) { + + /* "spacy/pipeline/_parser_internals/arc_eager.pyx":808 + * gold_state = gold_.c + * if self.c[i].is_valid(stcls.c, self.c[i].label): + * cost = self.c[i].get_cost(stcls.c, &gold_state, self.c[i].label) # <<<<<<<<<<<<<< + * else: + * cost = 9000 +*/ + __pyx_v_cost = (__pyx_v_self->__pyx_base.c[__pyx_v_i]).get_cost(__pyx_v_stcls->c, (&__pyx_v_gold_state), (__pyx_v_self->__pyx_base.c[__pyx_v_i]).label); + + /* "spacy/pipeline/_parser_internals/arc_eager.pyx":807 + * cdef ArcEagerGold gold_ = gold + * gold_state = gold_.c + * if self.c[i].is_valid(stcls.c, self.c[i].label): # <<<<<<<<<<<<<< + * cost = self.c[i].get_cost(stcls.c, &gold_state, self.c[i].label) + * else: +*/ + goto __pyx_L4; + } + + /* "spacy/pipeline/_parser_internals/arc_eager.pyx":810 + * cost = self.c[i].get_cost(stcls.c, &gold_state, self.c[i].label) + * else: + * cost = 9000 # <<<<<<<<<<<<<< + * return cost + * +*/ + /*else*/ { + __pyx_v_cost = 9000.0; + } + __pyx_L4:; + + /* "spacy/pipeline/_parser_internals/arc_eager.pyx":811 + * else: + * cost = 9000 + * return cost # <<<<<<<<<<<<<< + * + * cdef int set_costs(self, int* is_valid, weight_t* costs, +*/ + __Pyx_XDECREF(__pyx_r); + __pyx_t_3 = PyFloat_FromDouble(__pyx_v_cost); if (unlikely(!__pyx_t_3)) __PYX_ERR(0, 811, __pyx_L1_error) + __Pyx_GOTREF(__pyx_t_3); + __pyx_r = __pyx_t_3; + __pyx_t_3 = 0; + goto __pyx_L0; + + /* "spacy/pipeline/_parser_internals/arc_eager.pyx":802 + * output[i] = is_valid[self.c[i].move] + * + * def get_cost(self, StateClass stcls, gold, int i): # <<<<<<<<<<<<<< + * if not isinstance(gold, ArcEagerGold): + * raise TypeError(Errors.E909.format(name="ArcEagerGold")) +*/ + + /* function exit code */ + __pyx_L1_error:; + __Pyx_XDECREF(__pyx_t_3); + __Pyx_XDECREF(__pyx_t_4); + __Pyx_XDECREF(__pyx_t_5); + __Pyx_XDECREF(__pyx_t_6); + __Pyx_XDECREF(__pyx_t_7); + __Pyx_XDECREF(__pyx_t_8); + __Pyx_AddTraceback("spacy.pipeline._parser_internals.arc_eager.ArcEager.get_cost", __pyx_clineno, __pyx_lineno, __pyx_filename); + __pyx_r = NULL; + __pyx_L0:; + __Pyx_XDECREF((PyObject *)__pyx_v_gold_); + __Pyx_XGIVEREF(__pyx_r); + __Pyx_RefNannyFinishContext(); + return __pyx_r; +} + +/* "spacy/pipeline/_parser_internals/arc_eager.pyx":813 + * return cost + * + * cdef int set_costs(self, int* is_valid, weight_t* costs, # <<<<<<<<<<<<<< + * const StateC* state, gold) except -1: + * if not isinstance(gold, ArcEagerGold): +*/ + +static int __pyx_f_5spacy_8pipeline_17_parser_internals_9arc_eager_8ArcEager_set_costs(struct __pyx_obj_5spacy_8pipeline_17_parser_internals_9arc_eager_ArcEager *__pyx_v_self, int *__pyx_v_is_valid, __pyx_t_5spacy_8typedefs_weight_t *__pyx_v_costs, __pyx_t_5spacy_8pipeline_17_parser_internals_6_state_StateC const *__pyx_v_state, PyObject *__pyx_v_gold) { + struct __pyx_obj_5spacy_8pipeline_17_parser_internals_9arc_eager_ArcEagerGold *__pyx_v_gold_ = 0; + struct __pyx_t_5spacy_8pipeline_17_parser_internals_9arc_eager_GoldParseStateC __pyx_v_gold_state; + int __pyx_v_n_gold; + int __pyx_v_i; + int __pyx_r; + __Pyx_RefNannyDeclarations + int __pyx_t_1; + int __pyx_t_2; + PyObject *__pyx_t_3 = NULL; + PyObject *__pyx_t_4 = NULL; + PyObject *__pyx_t_5 = NULL; + PyObject *__pyx_t_6 = NULL; + PyObject *__pyx_t_7 = NULL; + PyObject *__pyx_t_8 = NULL; + size_t __pyx_t_9; + struct __pyx_t_5spacy_8pipeline_17_parser_internals_9arc_eager_GoldParseStateC __pyx_t_10; + int __pyx_t_11; + int __pyx_t_12; + int __pyx_t_13; + int __pyx_lineno = 0; + const char *__pyx_filename = NULL; + int __pyx_clineno = 0; + __Pyx_RefNannySetupContext("set_costs", 0); + + /* "spacy/pipeline/_parser_internals/arc_eager.pyx":815 + * cdef int set_costs(self, int* is_valid, weight_t* costs, + * const StateC* state, gold) except -1: + * if not isinstance(gold, ArcEagerGold): # <<<<<<<<<<<<<< + * raise TypeError(Errors.E909.format(name="ArcEagerGold")) + * cdef ArcEagerGold gold_ = gold +*/ + __pyx_t_1 = __Pyx_TypeCheck(__pyx_v_gold, __pyx_mstate_global->__pyx_ptype_5spacy_8pipeline_17_parser_internals_9arc_eager_ArcEagerGold); + __pyx_t_2 = (!__pyx_t_1); + if (unlikely(__pyx_t_2)) { + + /* "spacy/pipeline/_parser_internals/arc_eager.pyx":816 + * const StateC* state, gold) except -1: + * if not isinstance(gold, ArcEagerGold): + * raise TypeError(Errors.E909.format(name="ArcEagerGold")) # <<<<<<<<<<<<<< + * cdef ArcEagerGold gold_ = gold + * gold_state = gold_.c +*/ + __pyx_t_4 = NULL; + __Pyx_GetModuleGlobalName(__pyx_t_7, __pyx_mstate_global->__pyx_n_u_Errors); if (unlikely(!__pyx_t_7)) __PYX_ERR(0, 816, __pyx_L1_error) + __Pyx_GOTREF(__pyx_t_7); + __pyx_t_8 = __Pyx_PyObject_GetAttrStr(__pyx_t_7, __pyx_mstate_global->__pyx_n_u_E909); if (unlikely(!__pyx_t_8)) __PYX_ERR(0, 816, __pyx_L1_error) + __Pyx_GOTREF(__pyx_t_8); + __Pyx_DECREF(__pyx_t_7); __pyx_t_7 = 0; + __pyx_t_6 = __pyx_t_8; + __Pyx_INCREF(__pyx_t_6); + __pyx_t_9 = 0; + { + PyObject *__pyx_callargs[2 + ((CYTHON_VECTORCALL) ? 1 : 0)] = {__pyx_t_6, NULL}; + __pyx_t_7 = __Pyx_MakeVectorcallBuilderKwds(1); if (unlikely(!__pyx_t_7)) __PYX_ERR(0, 816, __pyx_L1_error) + __Pyx_GOTREF(__pyx_t_7); + if (__Pyx_VectorcallBuilder_AddArg(__pyx_mstate_global->__pyx_n_u_name, __pyx_mstate_global->__pyx_n_u_ArcEagerGold, __pyx_t_7, __pyx_callargs+1, 0) < (0)) __PYX_ERR(0, 816, __pyx_L1_error) + __pyx_t_5 = __Pyx_Object_VectorcallMethod_CallFromBuilder((PyObject*)__pyx_mstate_global->__pyx_n_u_format, __pyx_callargs+__pyx_t_9, (1-__pyx_t_9) | (1*__Pyx_PY_VECTORCALL_ARGUMENTS_OFFSET), __pyx_t_7); + __Pyx_XDECREF(__pyx_t_6); __pyx_t_6 = 0; + __Pyx_DECREF(__pyx_t_7); __pyx_t_7 = 0; + __Pyx_DECREF(__pyx_t_8); __pyx_t_8 = 0; + if (unlikely(!__pyx_t_5)) __PYX_ERR(0, 816, __pyx_L1_error) + __Pyx_GOTREF(__pyx_t_5); + } + __pyx_t_9 = 1; + { + PyObject *__pyx_callargs[2] = {__pyx_t_4, __pyx_t_5}; + __pyx_t_3 = __Pyx_PyObject_FastCall((PyObject*)(((PyTypeObject*)PyExc_TypeError)), __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_5); __pyx_t_5 = 0; + if (unlikely(!__pyx_t_3)) __PYX_ERR(0, 816, __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, 816, __pyx_L1_error) + + /* "spacy/pipeline/_parser_internals/arc_eager.pyx":815 + * cdef int set_costs(self, int* is_valid, weight_t* costs, + * const StateC* state, gold) except -1: + * if not isinstance(gold, ArcEagerGold): # <<<<<<<<<<<<<< + * raise TypeError(Errors.E909.format(name="ArcEagerGold")) + * cdef ArcEagerGold gold_ = gold +*/ + } + + /* "spacy/pipeline/_parser_internals/arc_eager.pyx":817 + * if not isinstance(gold, ArcEagerGold): + * raise TypeError(Errors.E909.format(name="ArcEagerGold")) + * cdef ArcEagerGold gold_ = gold # <<<<<<<<<<<<<< + * gold_state = gold_.c + * update_gold_state(&gold_state, state) +*/ + __pyx_t_3 = __pyx_v_gold; + __Pyx_INCREF(__pyx_t_3); + if (!(likely(((__pyx_t_3) == Py_None) || likely(__Pyx_TypeTest(__pyx_t_3, __pyx_mstate_global->__pyx_ptype_5spacy_8pipeline_17_parser_internals_9arc_eager_ArcEagerGold))))) __PYX_ERR(0, 817, __pyx_L1_error) + __pyx_v_gold_ = ((struct __pyx_obj_5spacy_8pipeline_17_parser_internals_9arc_eager_ArcEagerGold *)__pyx_t_3); + __pyx_t_3 = 0; + + /* "spacy/pipeline/_parser_internals/arc_eager.pyx":818 + * raise TypeError(Errors.E909.format(name="ArcEagerGold")) + * cdef ArcEagerGold gold_ = gold + * gold_state = gold_.c # <<<<<<<<<<<<<< + * update_gold_state(&gold_state, state) + * self.set_valid(is_valid, state) +*/ + __pyx_t_10 = __pyx_v_gold_->c; + __pyx_v_gold_state = __pyx_t_10; + + /* "spacy/pipeline/_parser_internals/arc_eager.pyx":819 + * cdef ArcEagerGold gold_ = gold + * gold_state = gold_.c + * update_gold_state(&gold_state, state) # <<<<<<<<<<<<<< + * self.set_valid(is_valid, state) + * cdef int n_gold = 0 +*/ + __pyx_f_5spacy_8pipeline_17_parser_internals_9arc_eager_update_gold_state((&__pyx_v_gold_state), __pyx_v_state); + + /* "spacy/pipeline/_parser_internals/arc_eager.pyx":820 + * gold_state = gold_.c + * update_gold_state(&gold_state, state) + * self.set_valid(is_valid, state) # <<<<<<<<<<<<<< + * cdef int n_gold = 0 + * for i in range(self.n_moves): +*/ + (void)(((struct __pyx_vtabstruct_5spacy_8pipeline_17_parser_internals_9arc_eager_ArcEager *)__pyx_v_self->__pyx_base.__pyx_vtab)->__pyx_base.set_valid(((struct __pyx_obj_5spacy_8pipeline_17_parser_internals_17transition_system_TransitionSystem *)__pyx_v_self), __pyx_v_is_valid, __pyx_v_state)); + + /* "spacy/pipeline/_parser_internals/arc_eager.pyx":821 + * update_gold_state(&gold_state, state) + * self.set_valid(is_valid, state) + * cdef int n_gold = 0 # <<<<<<<<<<<<<< + * for i in range(self.n_moves): + * if is_valid[i]: +*/ + __pyx_v_n_gold = 0; + + /* "spacy/pipeline/_parser_internals/arc_eager.pyx":822 + * self.set_valid(is_valid, state) + * cdef int n_gold = 0 + * for i in range(self.n_moves): # <<<<<<<<<<<<<< + * if is_valid[i]: + * costs[i] = self.c[i].get_cost(state, &gold_state, self.c[i].label) +*/ + __pyx_t_11 = __pyx_v_self->__pyx_base.n_moves; + __pyx_t_12 = __pyx_t_11; + for (__pyx_t_13 = 0; __pyx_t_13 < __pyx_t_12; __pyx_t_13+=1) { + __pyx_v_i = __pyx_t_13; + + /* "spacy/pipeline/_parser_internals/arc_eager.pyx":823 + * cdef int n_gold = 0 + * for i in range(self.n_moves): + * if is_valid[i]: # <<<<<<<<<<<<<< + * costs[i] = self.c[i].get_cost(state, &gold_state, self.c[i].label) + * if costs[i] <= 0: +*/ + __pyx_t_2 = ((__pyx_v_is_valid[__pyx_v_i]) != 0); + if (__pyx_t_2) { + + /* "spacy/pipeline/_parser_internals/arc_eager.pyx":824 + * for i in range(self.n_moves): + * if is_valid[i]: + * costs[i] = self.c[i].get_cost(state, &gold_state, self.c[i].label) # <<<<<<<<<<<<<< + * if costs[i] <= 0: + * n_gold += 1 +*/ + (__pyx_v_costs[__pyx_v_i]) = (__pyx_v_self->__pyx_base.c[__pyx_v_i]).get_cost(__pyx_v_state, (&__pyx_v_gold_state), (__pyx_v_self->__pyx_base.c[__pyx_v_i]).label); + + /* "spacy/pipeline/_parser_internals/arc_eager.pyx":825 + * if is_valid[i]: + * costs[i] = self.c[i].get_cost(state, &gold_state, self.c[i].label) + * if costs[i] <= 0: # <<<<<<<<<<<<<< + * n_gold += 1 + * else: +*/ + __pyx_t_2 = ((__pyx_v_costs[__pyx_v_i]) <= 0.0); + if (__pyx_t_2) { + + /* "spacy/pipeline/_parser_internals/arc_eager.pyx":826 + * costs[i] = self.c[i].get_cost(state, &gold_state, self.c[i].label) + * if costs[i] <= 0: + * n_gold += 1 # <<<<<<<<<<<<<< + * else: + * costs[i] = 9000 +*/ + __pyx_v_n_gold = (__pyx_v_n_gold + 1); + + /* "spacy/pipeline/_parser_internals/arc_eager.pyx":825 + * if is_valid[i]: + * costs[i] = self.c[i].get_cost(state, &gold_state, self.c[i].label) + * if costs[i] <= 0: # <<<<<<<<<<<<<< + * n_gold += 1 + * else: +*/ + } + + /* "spacy/pipeline/_parser_internals/arc_eager.pyx":823 + * cdef int n_gold = 0 + * for i in range(self.n_moves): + * if is_valid[i]: # <<<<<<<<<<<<<< + * costs[i] = self.c[i].get_cost(state, &gold_state, self.c[i].label) + * if costs[i] <= 0: +*/ + goto __pyx_L6; + } + + /* "spacy/pipeline/_parser_internals/arc_eager.pyx":828 + * n_gold += 1 + * else: + * costs[i] = 9000 # <<<<<<<<<<<<<< + * if n_gold < 1: + * for i in range(self.n_moves): +*/ + /*else*/ { + (__pyx_v_costs[__pyx_v_i]) = 9000.0; + } + __pyx_L6:; + } + + /* "spacy/pipeline/_parser_internals/arc_eager.pyx":829 + * else: + * costs[i] = 9000 + * if n_gold < 1: # <<<<<<<<<<<<<< + * for i in range(self.n_moves): + * print(self.get_class_name(i), is_valid[i], costs[i]) +*/ + __pyx_t_2 = (__pyx_v_n_gold < 1); + if (__pyx_t_2) { + + /* "spacy/pipeline/_parser_internals/arc_eager.pyx":830 + * costs[i] = 9000 + * if n_gold < 1: + * for i in range(self.n_moves): # <<<<<<<<<<<<<< + * print(self.get_class_name(i), is_valid[i], costs[i]) + * print("Gold sent starts?", is_sent_start(&gold_state, state.B(0)), is_sent_start(&gold_state, state.B(1))) +*/ + __pyx_t_11 = __pyx_v_self->__pyx_base.n_moves; + __pyx_t_12 = __pyx_t_11; + for (__pyx_t_13 = 0; __pyx_t_13 < __pyx_t_12; __pyx_t_13+=1) { + __pyx_v_i = __pyx_t_13; + + /* "spacy/pipeline/_parser_internals/arc_eager.pyx":831 + * if n_gold < 1: + * for i in range(self.n_moves): + * print(self.get_class_name(i), is_valid[i], costs[i]) # <<<<<<<<<<<<<< + * print("Gold sent starts?", is_sent_start(&gold_state, state.B(0)), is_sent_start(&gold_state, state.B(1))) + * raise ValueError(Errors.E1031) +*/ + __pyx_t_5 = ((PyObject *)__pyx_v_self); + __Pyx_INCREF(__pyx_t_5); + __pyx_t_4 = __Pyx_PyLong_From_int(__pyx_v_i); if (unlikely(!__pyx_t_4)) __PYX_ERR(0, 831, __pyx_L1_error) + __Pyx_GOTREF(__pyx_t_4); + __pyx_t_9 = 0; + { + PyObject *__pyx_callargs[2] = {__pyx_t_5, __pyx_t_4}; + __pyx_t_3 = __Pyx_PyObject_FastCallMethod((PyObject*)__pyx_mstate_global->__pyx_n_u_get_class_name, __pyx_callargs+__pyx_t_9, (2-__pyx_t_9) | (1*__Pyx_PY_VECTORCALL_ARGUMENTS_OFFSET)); + __Pyx_XDECREF(__pyx_t_5); __pyx_t_5 = 0; + __Pyx_DECREF(__pyx_t_4); __pyx_t_4 = 0; + if (unlikely(!__pyx_t_3)) __PYX_ERR(0, 831, __pyx_L1_error) + __Pyx_GOTREF(__pyx_t_3); + } + __pyx_t_4 = __Pyx_PyLong_From_int((__pyx_v_is_valid[__pyx_v_i])); if (unlikely(!__pyx_t_4)) __PYX_ERR(0, 831, __pyx_L1_error) + __Pyx_GOTREF(__pyx_t_4); + __pyx_t_5 = PyFloat_FromDouble((__pyx_v_costs[__pyx_v_i])); if (unlikely(!__pyx_t_5)) __PYX_ERR(0, 831, __pyx_L1_error) + __Pyx_GOTREF(__pyx_t_5); + __pyx_t_8 = PyTuple_New(3); if (unlikely(!__pyx_t_8)) __PYX_ERR(0, 831, __pyx_L1_error) + __Pyx_GOTREF(__pyx_t_8); + __Pyx_GIVEREF(__pyx_t_3); + if (__Pyx_PyTuple_SET_ITEM(__pyx_t_8, 0, __pyx_t_3) != (0)) __PYX_ERR(0, 831, __pyx_L1_error); + __Pyx_GIVEREF(__pyx_t_4); + if (__Pyx_PyTuple_SET_ITEM(__pyx_t_8, 1, __pyx_t_4) != (0)) __PYX_ERR(0, 831, __pyx_L1_error); + __Pyx_GIVEREF(__pyx_t_5); + if (__Pyx_PyTuple_SET_ITEM(__pyx_t_8, 2, __pyx_t_5) != (0)) __PYX_ERR(0, 831, __pyx_L1_error); + __pyx_t_3 = 0; + __pyx_t_4 = 0; + __pyx_t_5 = 0; + if (__Pyx_PrintOne(0, __pyx_t_8) < 0) __PYX_ERR(0, 831, __pyx_L1_error) + __Pyx_DECREF(__pyx_t_8); __pyx_t_8 = 0; + } + + /* "spacy/pipeline/_parser_internals/arc_eager.pyx":832 + * for i in range(self.n_moves): + * print(self.get_class_name(i), is_valid[i], costs[i]) + * print("Gold sent starts?", is_sent_start(&gold_state, state.B(0)), is_sent_start(&gold_state, state.B(1))) # <<<<<<<<<<<<<< + * raise ValueError(Errors.E1031) + * +*/ + __pyx_t_8 = __Pyx_PyLong_From_int(__pyx_f_5spacy_8pipeline_17_parser_internals_9arc_eager_is_sent_start((&__pyx_v_gold_state), __pyx_v_state->B(0))); if (unlikely(!__pyx_t_8)) __PYX_ERR(0, 832, __pyx_L1_error) + __Pyx_GOTREF(__pyx_t_8); + __pyx_t_5 = __Pyx_PyLong_From_int(__pyx_f_5spacy_8pipeline_17_parser_internals_9arc_eager_is_sent_start((&__pyx_v_gold_state), __pyx_v_state->B(1))); if (unlikely(!__pyx_t_5)) __PYX_ERR(0, 832, __pyx_L1_error) + __Pyx_GOTREF(__pyx_t_5); + __pyx_t_4 = PyTuple_New(3); if (unlikely(!__pyx_t_4)) __PYX_ERR(0, 832, __pyx_L1_error) + __Pyx_GOTREF(__pyx_t_4); + __Pyx_INCREF(__pyx_mstate_global->__pyx_kp_u_Gold_sent_starts); + __Pyx_GIVEREF(__pyx_mstate_global->__pyx_kp_u_Gold_sent_starts); + if (__Pyx_PyTuple_SET_ITEM(__pyx_t_4, 0, __pyx_mstate_global->__pyx_kp_u_Gold_sent_starts) != (0)) __PYX_ERR(0, 832, __pyx_L1_error); + __Pyx_GIVEREF(__pyx_t_8); + if (__Pyx_PyTuple_SET_ITEM(__pyx_t_4, 1, __pyx_t_8) != (0)) __PYX_ERR(0, 832, __pyx_L1_error); + __Pyx_GIVEREF(__pyx_t_5); + if (__Pyx_PyTuple_SET_ITEM(__pyx_t_4, 2, __pyx_t_5) != (0)) __PYX_ERR(0, 832, __pyx_L1_error); + __pyx_t_8 = 0; + __pyx_t_5 = 0; + if (__Pyx_PrintOne(0, __pyx_t_4) < 0) __PYX_ERR(0, 832, __pyx_L1_error) + __Pyx_DECREF(__pyx_t_4); __pyx_t_4 = 0; + + /* "spacy/pipeline/_parser_internals/arc_eager.pyx":833 + * print(self.get_class_name(i), is_valid[i], costs[i]) + * print("Gold sent starts?", is_sent_start(&gold_state, state.B(0)), is_sent_start(&gold_state, state.B(1))) + * raise ValueError(Errors.E1031) # <<<<<<<<<<<<<< + * + * def get_oracle_sequence_from_state(self, StateClass state, ArcEagerGold gold, _debug=None): +*/ + __pyx_t_5 = NULL; + __Pyx_GetModuleGlobalName(__pyx_t_8, __pyx_mstate_global->__pyx_n_u_Errors); if (unlikely(!__pyx_t_8)) __PYX_ERR(0, 833, __pyx_L1_error) + __Pyx_GOTREF(__pyx_t_8); + __pyx_t_3 = __Pyx_PyObject_GetAttrStr(__pyx_t_8, __pyx_mstate_global->__pyx_n_u_E1031); if (unlikely(!__pyx_t_3)) __PYX_ERR(0, 833, __pyx_L1_error) + __Pyx_GOTREF(__pyx_t_3); + __Pyx_DECREF(__pyx_t_8); __pyx_t_8 = 0; + __pyx_t_9 = 1; + { + PyObject *__pyx_callargs[2] = {__pyx_t_5, __pyx_t_3}; + __pyx_t_4 = __Pyx_PyObject_FastCall((PyObject*)(((PyTypeObject*)PyExc_ValueError)), __pyx_callargs+__pyx_t_9, (2-__pyx_t_9) | (__pyx_t_9*__Pyx_PY_VECTORCALL_ARGUMENTS_OFFSET)); + __Pyx_XDECREF(__pyx_t_5); __pyx_t_5 = 0; + __Pyx_DECREF(__pyx_t_3); __pyx_t_3 = 0; + if (unlikely(!__pyx_t_4)) __PYX_ERR(0, 833, __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, 833, __pyx_L1_error) + + /* "spacy/pipeline/_parser_internals/arc_eager.pyx":829 + * else: + * costs[i] = 9000 + * if n_gold < 1: # <<<<<<<<<<<<<< + * for i in range(self.n_moves): + * print(self.get_class_name(i), is_valid[i], costs[i]) +*/ + } + + /* "spacy/pipeline/_parser_internals/arc_eager.pyx":813 + * return cost + * + * cdef int set_costs(self, int* is_valid, weight_t* costs, # <<<<<<<<<<<<<< + * const StateC* state, gold) except -1: + * if not isinstance(gold, ArcEagerGold): +*/ + + /* function exit code */ + __pyx_r = 0; + goto __pyx_L0; + __pyx_L1_error:; + __Pyx_XDECREF(__pyx_t_3); + __Pyx_XDECREF(__pyx_t_4); + __Pyx_XDECREF(__pyx_t_5); + __Pyx_XDECREF(__pyx_t_6); + __Pyx_XDECREF(__pyx_t_7); + __Pyx_XDECREF(__pyx_t_8); + __Pyx_AddTraceback("spacy.pipeline._parser_internals.arc_eager.ArcEager.set_costs", __pyx_clineno, __pyx_lineno, __pyx_filename); + __pyx_r = -1; + __pyx_L0:; + __Pyx_XDECREF((PyObject *)__pyx_v_gold_); + __Pyx_RefNannyFinishContext(); + return __pyx_r; +} + +/* "spacy/pipeline/_parser_internals/arc_eager.pyx":835 + * raise ValueError(Errors.E1031) + * + * def get_oracle_sequence_from_state(self, StateClass state, ArcEagerGold gold, _debug=None): # <<<<<<<<<<<<<< + * cdef int i + * cdef Pool mem = Pool() +*/ + +/* Python wrapper */ +static PyObject *__pyx_pw_5spacy_8pipeline_17_parser_internals_9arc_eager_8ArcEager_29get_oracle_sequence_from_state(PyObject *__pyx_v_self, +#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_5spacy_8pipeline_17_parser_internals_9arc_eager_8ArcEager_28get_oracle_sequence_from_state, "ArcEager.get_oracle_sequence_from_state(self, StateClass state, ArcEagerGold gold, _debug=None)"); +static PyMethodDef __pyx_mdef_5spacy_8pipeline_17_parser_internals_9arc_eager_8ArcEager_29get_oracle_sequence_from_state = {"get_oracle_sequence_from_state", (PyCFunction)(void(*)(void))(__Pyx_PyCFunction_FastCallWithKeywords)__pyx_pw_5spacy_8pipeline_17_parser_internals_9arc_eager_8ArcEager_29get_oracle_sequence_from_state, __Pyx_METH_FASTCALL|METH_KEYWORDS, __pyx_doc_5spacy_8pipeline_17_parser_internals_9arc_eager_8ArcEager_28get_oracle_sequence_from_state}; +static PyObject *__pyx_pw_5spacy_8pipeline_17_parser_internals_9arc_eager_8ArcEager_29get_oracle_sequence_from_state(PyObject *__pyx_v_self, +#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_5spacy_8pipeline_17_parser_internals_10stateclass_StateClass *__pyx_v_state = 0; + struct __pyx_obj_5spacy_8pipeline_17_parser_internals_9arc_eager_ArcEagerGold *__pyx_v_gold = 0; + PyObject *__pyx_v__debug = 0; + #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("get_oracle_sequence_from_state (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_state,&__pyx_mstate_global->__pyx_n_u_gold,&__pyx_mstate_global->__pyx_n_u_debug,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, 835, __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, 835, __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, 835, __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, 835, __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, "get_oracle_sequence_from_state", 0) < (0)) __PYX_ERR(0, 835, __pyx_L3_error) + if (!values[2]) values[2] = __Pyx_NewRef(((PyObject *)Py_None)); + for (Py_ssize_t i = __pyx_nargs; i < 2; i++) { + if (unlikely(!values[i])) { __Pyx_RaiseArgtupleInvalid("get_oracle_sequence_from_state", 0, 2, 3, i); __PYX_ERR(0, 835, __pyx_L3_error) } + } + } else { + switch (__pyx_nargs) { + case 3: + values[2] = __Pyx_ArgRef_FASTCALL(__pyx_args, 2); + if (!CYTHON_ASSUME_SAFE_MACROS && unlikely(!values[2])) __PYX_ERR(0, 835, __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, 835, __pyx_L3_error) + values[0] = __Pyx_ArgRef_FASTCALL(__pyx_args, 0); + if (!CYTHON_ASSUME_SAFE_MACROS && unlikely(!values[0])) __PYX_ERR(0, 835, __pyx_L3_error) + break; + default: goto __pyx_L5_argtuple_error; + } + if (!values[2]) values[2] = __Pyx_NewRef(((PyObject *)Py_None)); + } + __pyx_v_state = ((struct __pyx_obj_5spacy_8pipeline_17_parser_internals_10stateclass_StateClass *)values[0]); + __pyx_v_gold = ((struct __pyx_obj_5spacy_8pipeline_17_parser_internals_9arc_eager_ArcEagerGold *)values[1]); + __pyx_v__debug = values[2]; + } + goto __pyx_L6_skip; + __pyx_L5_argtuple_error:; + __Pyx_RaiseArgtupleInvalid("get_oracle_sequence_from_state", 0, 2, 3, __pyx_nargs); __PYX_ERR(0, 835, __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("spacy.pipeline._parser_internals.arc_eager.ArcEager.get_oracle_sequence_from_state", __pyx_clineno, __pyx_lineno, __pyx_filename); + __Pyx_RefNannyFinishContext(); + return NULL; + __pyx_L4_argument_unpacking_done:; + if (unlikely(!__Pyx_ArgTypeTest(((PyObject *)__pyx_v_state), __pyx_mstate_global->__pyx_ptype_5spacy_8pipeline_17_parser_internals_10stateclass_StateClass, 1, "state", 0))) __PYX_ERR(0, 835, __pyx_L1_error) + if (unlikely(!__Pyx_ArgTypeTest(((PyObject *)__pyx_v_gold), __pyx_mstate_global->__pyx_ptype_5spacy_8pipeline_17_parser_internals_9arc_eager_ArcEagerGold, 1, "gold", 0))) __PYX_ERR(0, 835, __pyx_L1_error) + __pyx_r = __pyx_pf_5spacy_8pipeline_17_parser_internals_9arc_eager_8ArcEager_28get_oracle_sequence_from_state(((struct __pyx_obj_5spacy_8pipeline_17_parser_internals_9arc_eager_ArcEager *)__pyx_v_self), __pyx_v_state, __pyx_v_gold, __pyx_v__debug); + + /* 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_gb_5spacy_8pipeline_17_parser_internals_9arc_eager_8ArcEager_30get_oracle_sequence_from_state_2generator1(__pyx_CoroutineObject *__pyx_generator, CYTHON_UNUSED PyThreadState *__pyx_tstate, PyObject *__pyx_sent_value); /* proto */ + +/* "spacy/pipeline/_parser_internals/arc_eager.pyx":852 + * failed = True + * break + * min_cost = min(costs[i] for i in range(self.n_moves)) # <<<<<<<<<<<<<< + * for i in range(self.n_moves): + * if is_valid[i] and costs[i] <= min_cost: +*/ + +static PyObject *__pyx_pf_5spacy_8pipeline_17_parser_internals_9arc_eager_8ArcEager_30get_oracle_sequence_from_state_genexpr(PyObject *__pyx_self, int __pyx_genexpr_arg_0) { + struct __pyx_obj_5spacy_8pipeline_17_parser_internals_9arc_eager___pyx_scope_struct_3_genexpr *__pyx_cur_scope; + PyObject *__pyx_r = NULL; + __Pyx_RefNannyDeclarations + int __pyx_lineno = 0; + const char *__pyx_filename = NULL; + int __pyx_clineno = 0; + __Pyx_RefNannySetupContext("genexpr", 0); + __pyx_cur_scope = (struct __pyx_obj_5spacy_8pipeline_17_parser_internals_9arc_eager___pyx_scope_struct_3_genexpr *)__pyx_tp_new_5spacy_8pipeline_17_parser_internals_9arc_eager___pyx_scope_struct_3_genexpr(__pyx_mstate_global->__pyx_ptype_5spacy_8pipeline_17_parser_internals_9arc_eager___pyx_scope_struct_3_genexpr, __pyx_mstate_global->__pyx_empty_tuple, NULL); + if (unlikely(!__pyx_cur_scope)) { + __pyx_cur_scope = ((struct __pyx_obj_5spacy_8pipeline_17_parser_internals_9arc_eager___pyx_scope_struct_3_genexpr *)Py_None); + __Pyx_INCREF(Py_None); + __PYX_ERR(0, 852, __pyx_L1_error) + } else { + __Pyx_GOTREF((PyObject *)__pyx_cur_scope); + } + __pyx_cur_scope->__pyx_outer_scope = (struct __pyx_obj_5spacy_8pipeline_17_parser_internals_9arc_eager___pyx_scope_struct_2_get_oracle_sequence_from_state *) __pyx_self; + __Pyx_INCREF((PyObject *)__pyx_cur_scope->__pyx_outer_scope); + __Pyx_GIVEREF((PyObject *)__pyx_cur_scope->__pyx_outer_scope); + __pyx_cur_scope->__pyx_genexpr_arg_0 = __pyx_genexpr_arg_0; + { + __pyx_CoroutineObject *gen = __Pyx_Generator_New((__pyx_coroutine_body_t) __pyx_gb_5spacy_8pipeline_17_parser_internals_9arc_eager_8ArcEager_30get_oracle_sequence_from_state_2generator1, ((PyObject *)__pyx_mstate_global->__pyx_codeobj_tab[2]), (PyObject *) __pyx_cur_scope, __pyx_mstate_global->__pyx_n_u_genexpr, __pyx_mstate_global->__pyx_n_u_get_oracle_sequence_from_state_l, __pyx_mstate_global->__pyx_n_u_spacy_pipeline__parser_internals); if (unlikely(!gen)) __PYX_ERR(0, 852, __pyx_L1_error) + __Pyx_DECREF(__pyx_cur_scope); + __Pyx_RefNannyFinishContext(); + return (PyObject *) gen; + } + + /* function exit code */ + __pyx_L1_error:; + __Pyx_AddTraceback("spacy.pipeline._parser_internals.arc_eager.ArcEager.get_oracle_sequence_from_state.genexpr", __pyx_clineno, __pyx_lineno, __pyx_filename); + __pyx_r = NULL; + __Pyx_DECREF((PyObject *)__pyx_cur_scope); + __Pyx_XGIVEREF(__pyx_r); + __Pyx_RefNannyFinishContext(); + return __pyx_r; +} + +static PyObject *__pyx_gb_5spacy_8pipeline_17_parser_internals_9arc_eager_8ArcEager_30get_oracle_sequence_from_state_2generator1(__pyx_CoroutineObject *__pyx_generator, CYTHON_UNUSED PyThreadState *__pyx_tstate, PyObject *__pyx_sent_value) /* generator body */ +{ + struct __pyx_obj_5spacy_8pipeline_17_parser_internals_9arc_eager___pyx_scope_struct_3_genexpr *__pyx_cur_scope = ((struct __pyx_obj_5spacy_8pipeline_17_parser_internals_9arc_eager___pyx_scope_struct_3_genexpr *)__pyx_generator->closure); + PyObject *__pyx_r = NULL; + int __pyx_t_1; + int __pyx_t_2; + int __pyx_t_3; + PyObject *__pyx_t_4 = NULL; + int __pyx_lineno = 0; + const char *__pyx_filename = NULL; + int __pyx_clineno = 0; + __Pyx_RefNannyDeclarations + __Pyx_RefNannySetupContext("genexpr", 0); + switch (__pyx_generator->resume_label) { + case 0: goto __pyx_L3_first_run; + case 1: goto __pyx_L6_resume_from_yield; + default: /* CPython raises the right error here */ + __Pyx_RefNannyFinishContext(); + return NULL; + } + __pyx_L3_first_run:; + if (unlikely(__pyx_sent_value != Py_None)) { + if (unlikely(__pyx_sent_value)) PyErr_SetString(PyExc_TypeError, "can't send non-None value to a just-started generator"); + __PYX_ERR(0, 852, __pyx_L1_error) + } + __pyx_t_1 = __pyx_cur_scope->__pyx_genexpr_arg_0; + __pyx_t_2 = __pyx_t_1; + for (__pyx_t_3 = 0; __pyx_t_3 < __pyx_t_2; __pyx_t_3+=1) { + __pyx_cur_scope->__pyx_v_i = __pyx_t_3; + __pyx_t_4 = PyFloat_FromDouble((__pyx_cur_scope->__pyx_outer_scope->__pyx_v_costs[__pyx_cur_scope->__pyx_v_i])); if (unlikely(!__pyx_t_4)) __PYX_ERR(0, 852, __pyx_L1_error) + __Pyx_GOTREF(__pyx_t_4); + __pyx_r = __pyx_t_4; + __pyx_t_4 = 0; + __pyx_cur_scope->__pyx_t_0 = __pyx_t_1; + __pyx_cur_scope->__pyx_t_1 = __pyx_t_2; + __pyx_cur_scope->__pyx_t_2 = __pyx_t_3; + __Pyx_XGIVEREF(__pyx_r); + __Pyx_RefNannyFinishContext(); + __Pyx_Coroutine_ResetAndClearException(__pyx_generator); + /* return from generator, yielding value */ + __pyx_generator->resume_label = 1; + return __pyx_r; + __pyx_L6_resume_from_yield:; + __pyx_t_1 = __pyx_cur_scope->__pyx_t_0; + __pyx_t_2 = __pyx_cur_scope->__pyx_t_1; + __pyx_t_3 = __pyx_cur_scope->__pyx_t_2; + if (unlikely(!__pyx_sent_value)) __PYX_ERR(0, 852, __pyx_L1_error) + } + CYTHON_MAYBE_UNUSED_VAR(__pyx_cur_scope); + + /* function exit code */ + __pyx_r = Py_None; __Pyx_INCREF(Py_None); + goto __pyx_L0; + __pyx_L1_error:; + __Pyx_XDECREF(__pyx_t_4); + if (__Pyx_PyErr_Occurred()) { + __Pyx_AddTraceback("genexpr", __pyx_clineno, __pyx_lineno, __pyx_filename); + } + __pyx_L0:; + __Pyx_XGIVEREF(__pyx_r); + #if !CYTHON_USE_EXC_INFO_STACK + __Pyx_Coroutine_ResetAndClearException(__pyx_generator); + #endif + __pyx_generator->resume_label = -1; + __Pyx_Coroutine_clear((PyObject*)__pyx_generator); + __Pyx_RefNannyFinishContext(); + return __pyx_r; +} + +/* "spacy/pipeline/_parser_internals/arc_eager.pyx":835 + * raise ValueError(Errors.E1031) + * + * def get_oracle_sequence_from_state(self, StateClass state, ArcEagerGold gold, _debug=None): # <<<<<<<<<<<<<< + * cdef int i + * cdef Pool mem = Pool() +*/ + +static PyObject *__pyx_pf_5spacy_8pipeline_17_parser_internals_9arc_eager_8ArcEager_28get_oracle_sequence_from_state(struct __pyx_obj_5spacy_8pipeline_17_parser_internals_9arc_eager_ArcEager *__pyx_v_self, struct __pyx_obj_5spacy_8pipeline_17_parser_internals_10stateclass_StateClass *__pyx_v_state, struct __pyx_obj_5spacy_8pipeline_17_parser_internals_9arc_eager_ArcEagerGold *__pyx_v_gold, PyObject *__pyx_v__debug) { + struct __pyx_obj_5spacy_8pipeline_17_parser_internals_9arc_eager___pyx_scope_struct_2_get_oracle_sequence_from_state *__pyx_cur_scope; + int __pyx_v_i; + struct __pyx_obj_5cymem_5cymem_Pool *__pyx_v_mem = 0; + int *__pyx_v_is_valid; + PyObject *__pyx_v_history = NULL; + PyObject *__pyx_v_debug_log = NULL; + int __pyx_v_failed; + PyObject *__pyx_v_min_cost = NULL; + struct __pyx_t_5spacy_8pipeline_17_parser_internals_17transition_system_Transition __pyx_v_action; + PyObject *__pyx_v_s0 = NULL; + PyObject *__pyx_v_b0 = NULL; + PyObject *__pyx_v_example = NULL; + PyObject *__pyx_v_token = NULL; + PyObject *__pyx_v_aligned_heads = NULL; + CYTHON_UNUSED PyObject *__pyx_v__aligned_labels = NULL; + PyObject *__pyx_v_head = NULL; + PyObject *__pyx_gb_5spacy_8pipeline_17_parser_internals_9arc_eager_8ArcEager_30get_oracle_sequence_from_state_2generator1 = 0; + PyObject *__pyx_v_w = NULL; + 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; + void *__pyx_t_5; + int __pyx_t_6; + PyObject *__pyx_t_7 = NULL; + PyObject *__pyx_t_8 = NULL; + PyObject *__pyx_t_9 = NULL; + int __pyx_t_10; + PyObject *__pyx_t_11 = NULL; + int __pyx_t_12; + int __pyx_t_13; + int __pyx_t_14; + int __pyx_t_15; + Py_ssize_t __pyx_t_16; + PyObject *(*__pyx_t_17)(PyObject *); + PyObject *__pyx_t_18 = NULL; + PyObject *__pyx_t_19 = NULL; + PyObject *__pyx_t_20 = NULL; + PyObject *(*__pyx_t_21)(PyObject *); + int __pyx_lineno = 0; + const char *__pyx_filename = NULL; + int __pyx_clineno = 0; + __Pyx_RefNannySetupContext("get_oracle_sequence_from_state", 0); + __pyx_cur_scope = (struct __pyx_obj_5spacy_8pipeline_17_parser_internals_9arc_eager___pyx_scope_struct_2_get_oracle_sequence_from_state *)__pyx_tp_new_5spacy_8pipeline_17_parser_internals_9arc_eager___pyx_scope_struct_2_get_oracle_sequence_from_state(__pyx_mstate_global->__pyx_ptype_5spacy_8pipeline_17_parser_internals_9arc_eager___pyx_scope_struct_2_get_oracle_sequence_from_state, __pyx_mstate_global->__pyx_empty_tuple, NULL); + if (unlikely(!__pyx_cur_scope)) { + __pyx_cur_scope = ((struct __pyx_obj_5spacy_8pipeline_17_parser_internals_9arc_eager___pyx_scope_struct_2_get_oracle_sequence_from_state *)Py_None); + __Pyx_INCREF(Py_None); + __PYX_ERR(0, 835, __pyx_L1_error) + } else { + __Pyx_GOTREF((PyObject *)__pyx_cur_scope); + } + + /* "spacy/pipeline/_parser_internals/arc_eager.pyx":837 + * def get_oracle_sequence_from_state(self, StateClass state, ArcEagerGold gold, _debug=None): + * cdef int i + * cdef Pool mem = Pool() # <<<<<<<<<<<<<< + * # n_moves should not be zero at this point, but make sure to avoid zero-length mem alloc + * assert self.n_moves > 0 +*/ + __pyx_t_2 = NULL; + __pyx_t_3 = 1; + { + PyObject *__pyx_callargs[2] = {__pyx_t_2, NULL}; + __pyx_t_1 = __Pyx_PyObject_FastCall((PyObject*)__pyx_mstate_global->__pyx_ptype_5cymem_5cymem_Pool, __pyx_callargs+__pyx_t_3, (1-__pyx_t_3) | (__pyx_t_3*__Pyx_PY_VECTORCALL_ARGUMENTS_OFFSET)); + __Pyx_XDECREF(__pyx_t_2); __pyx_t_2 = 0; + if (unlikely(!__pyx_t_1)) __PYX_ERR(0, 837, __pyx_L1_error) + __Pyx_GOTREF((PyObject *)__pyx_t_1); + } + __pyx_v_mem = ((struct __pyx_obj_5cymem_5cymem_Pool *)__pyx_t_1); + __pyx_t_1 = 0; + + /* "spacy/pipeline/_parser_internals/arc_eager.pyx":839 + * cdef Pool mem = Pool() + * # n_moves should not be zero at this point, but make sure to avoid zero-length mem alloc + * assert self.n_moves > 0 # <<<<<<<<<<<<<< + * costs = mem.alloc(self.n_moves, sizeof(float)) + * is_valid = mem.alloc(self.n_moves, sizeof(int)) +*/ + #ifndef CYTHON_WITHOUT_ASSERTIONS + if (unlikely(__pyx_assertions_enabled())) { + __pyx_t_4 = (__pyx_v_self->__pyx_base.n_moves > 0); + if (unlikely(!__pyx_t_4)) { + __Pyx_Raise(((PyObject *)(((PyTypeObject*)PyExc_AssertionError))), 0, 0, 0); + __PYX_ERR(0, 839, __pyx_L1_error) + } + } + #else + if ((1)); else __PYX_ERR(0, 839, __pyx_L1_error) + #endif + + /* "spacy/pipeline/_parser_internals/arc_eager.pyx":840 + * # n_moves should not be zero at this point, but make sure to avoid zero-length mem alloc + * assert self.n_moves > 0 + * costs = mem.alloc(self.n_moves, sizeof(float)) # <<<<<<<<<<<<<< + * is_valid = mem.alloc(self.n_moves, sizeof(int)) + * +*/ + __pyx_t_5 = ((struct __pyx_vtabstruct_5cymem_5cymem_Pool *)__pyx_v_mem->__pyx_vtab)->alloc(__pyx_v_mem, __pyx_v_self->__pyx_base.n_moves, (sizeof(float))); if (unlikely(__pyx_t_5 == ((void *)NULL))) __PYX_ERR(0, 840, __pyx_L1_error) + __pyx_cur_scope->__pyx_v_costs = ((float *)__pyx_t_5); + + /* "spacy/pipeline/_parser_internals/arc_eager.pyx":841 + * assert self.n_moves > 0 + * costs = mem.alloc(self.n_moves, sizeof(float)) + * is_valid = mem.alloc(self.n_moves, sizeof(int)) # <<<<<<<<<<<<<< + * + * history = [] +*/ + __pyx_t_5 = ((struct __pyx_vtabstruct_5cymem_5cymem_Pool *)__pyx_v_mem->__pyx_vtab)->alloc(__pyx_v_mem, __pyx_v_self->__pyx_base.n_moves, (sizeof(int))); if (unlikely(__pyx_t_5 == ((void *)NULL))) __PYX_ERR(0, 841, __pyx_L1_error) + __pyx_v_is_valid = ((int *)__pyx_t_5); + + /* "spacy/pipeline/_parser_internals/arc_eager.pyx":843 + * is_valid = mem.alloc(self.n_moves, sizeof(int)) + * + * history = [] # <<<<<<<<<<<<<< + * debug_log = [] + * failed = False +*/ + __pyx_t_1 = PyList_New(0); if (unlikely(!__pyx_t_1)) __PYX_ERR(0, 843, __pyx_L1_error) + __Pyx_GOTREF(__pyx_t_1); + __pyx_v_history = ((PyObject*)__pyx_t_1); + __pyx_t_1 = 0; + + /* "spacy/pipeline/_parser_internals/arc_eager.pyx":844 + * + * history = [] + * debug_log = [] # <<<<<<<<<<<<<< + * failed = False + * while not state.is_final(): +*/ + __pyx_t_1 = PyList_New(0); if (unlikely(!__pyx_t_1)) __PYX_ERR(0, 844, __pyx_L1_error) + __Pyx_GOTREF(__pyx_t_1); + __pyx_v_debug_log = ((PyObject*)__pyx_t_1); + __pyx_t_1 = 0; + + /* "spacy/pipeline/_parser_internals/arc_eager.pyx":845 + * history = [] + * debug_log = [] + * failed = False # <<<<<<<<<<<<<< + * while not state.is_final(): + * try: +*/ + __pyx_v_failed = 0; + + /* "spacy/pipeline/_parser_internals/arc_eager.pyx":846 + * debug_log = [] + * failed = False + * while not state.is_final(): # <<<<<<<<<<<<<< + * try: + * self.set_costs(is_valid, costs, state.c, gold) +*/ + while (1) { + __pyx_t_2 = ((PyObject *)__pyx_v_state); + __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_final, __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, 846, __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, 846, __pyx_L1_error) + __Pyx_DECREF(__pyx_t_1); __pyx_t_1 = 0; + __pyx_t_6 = (!__pyx_t_4); + if (!__pyx_t_6) break; + + /* "spacy/pipeline/_parser_internals/arc_eager.pyx":847 + * failed = False + * while not state.is_final(): + * try: # <<<<<<<<<<<<<< + * self.set_costs(is_valid, costs, state.c, gold) + * except ValueError: +*/ + { + __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:*/ { + + /* "spacy/pipeline/_parser_internals/arc_eager.pyx":848 + * while not state.is_final(): + * try: + * self.set_costs(is_valid, costs, state.c, gold) # <<<<<<<<<<<<<< + * except ValueError: + * failed = True +*/ + __pyx_t_10 = ((struct __pyx_vtabstruct_5spacy_8pipeline_17_parser_internals_9arc_eager_ArcEager *)__pyx_v_self->__pyx_base.__pyx_vtab)->__pyx_base.set_costs(((struct __pyx_obj_5spacy_8pipeline_17_parser_internals_17transition_system_TransitionSystem *)__pyx_v_self), __pyx_v_is_valid, __pyx_cur_scope->__pyx_v_costs, __pyx_v_state->c, ((PyObject *)__pyx_v_gold)); if (unlikely(__pyx_t_10 == ((int)-1))) __PYX_ERR(0, 848, __pyx_L5_error) + + /* "spacy/pipeline/_parser_internals/arc_eager.pyx":847 + * failed = False + * while not state.is_final(): + * try: # <<<<<<<<<<<<<< + * self.set_costs(is_valid, costs, state.c, gold) + * except ValueError: +*/ + } + __Pyx_XDECREF(__pyx_t_7); __pyx_t_7 = 0; + __Pyx_XDECREF(__pyx_t_8); __pyx_t_8 = 0; + __Pyx_XDECREF(__pyx_t_9); __pyx_t_9 = 0; + goto __pyx_L12_try_end; + __pyx_L5_error:; + __Pyx_XDECREF(__pyx_t_1); __pyx_t_1 = 0; + __Pyx_XDECREF(__pyx_t_2); __pyx_t_2 = 0; + + /* "spacy/pipeline/_parser_internals/arc_eager.pyx":849 + * try: + * self.set_costs(is_valid, costs, state.c, gold) + * except ValueError: # <<<<<<<<<<<<<< + * failed = True + * break +*/ + __pyx_t_10 = __Pyx_PyErr_ExceptionMatches(((PyObject *)(((PyTypeObject*)PyExc_ValueError)))); + if (__pyx_t_10) { + __Pyx_AddTraceback("spacy.pipeline._parser_internals.arc_eager.ArcEager.get_oracle_sequence_from_state", __pyx_clineno, __pyx_lineno, __pyx_filename); + if (__Pyx_GetException(&__pyx_t_1, &__pyx_t_2, &__pyx_t_11) < 0) __PYX_ERR(0, 849, __pyx_L7_except_error) + __Pyx_XGOTREF(__pyx_t_1); + __Pyx_XGOTREF(__pyx_t_2); + __Pyx_XGOTREF(__pyx_t_11); + + /* "spacy/pipeline/_parser_internals/arc_eager.pyx":850 + * self.set_costs(is_valid, costs, state.c, gold) + * except ValueError: + * failed = True # <<<<<<<<<<<<<< + * break + * min_cost = min(costs[i] for i in range(self.n_moves)) +*/ + __pyx_v_failed = 1; + + /* "spacy/pipeline/_parser_internals/arc_eager.pyx":851 + * except ValueError: + * failed = True + * break # <<<<<<<<<<<<<< + * min_cost = min(costs[i] for i in range(self.n_moves)) + * for i in range(self.n_moves): +*/ + goto __pyx_L14_except_break; + __pyx_L14_except_break:; + __Pyx_DECREF(__pyx_t_1); __pyx_t_1 = 0; + __Pyx_DECREF(__pyx_t_2); __pyx_t_2 = 0; + __Pyx_XDECREF(__pyx_t_11); __pyx_t_11 = 0; + goto __pyx_L10_try_break; + } + goto __pyx_L7_except_error; + + /* "spacy/pipeline/_parser_internals/arc_eager.pyx":847 + * failed = False + * while not state.is_final(): + * try: # <<<<<<<<<<<<<< + * self.set_costs(is_valid, costs, state.c, gold) + * except ValueError: +*/ + __pyx_L7_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_L10_try_break:; + __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_L4_break; + __pyx_L12_try_end:; + } + + /* "spacy/pipeline/_parser_internals/arc_eager.pyx":852 + * failed = True + * break + * min_cost = min(costs[i] for i in range(self.n_moves)) # <<<<<<<<<<<<<< + * for i in range(self.n_moves): + * if is_valid[i] and costs[i] <= min_cost: +*/ + __pyx_t_2 = NULL; + __pyx_t_1 = __pyx_pf_5spacy_8pipeline_17_parser_internals_9arc_eager_8ArcEager_30get_oracle_sequence_from_state_genexpr(((PyObject*)__pyx_cur_scope), __pyx_v_self->__pyx_base.n_moves); if (unlikely(!__pyx_t_1)) __PYX_ERR(0, 852, __pyx_L1_error) + __Pyx_GOTREF(__pyx_t_1); + __pyx_t_3 = 1; + { + PyObject *__pyx_callargs[2] = {__pyx_t_2, __pyx_t_1}; + __pyx_t_11 = __Pyx_PyObject_FastCall((PyObject*)__pyx_builtin_min, __pyx_callargs+__pyx_t_3, (2-__pyx_t_3) | (__pyx_t_3*__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_11)) __PYX_ERR(0, 852, __pyx_L1_error) + __Pyx_GOTREF(__pyx_t_11); + } + __Pyx_XDECREF_SET(__pyx_v_min_cost, __pyx_t_11); + __pyx_t_11 = 0; + + /* "spacy/pipeline/_parser_internals/arc_eager.pyx":853 + * break + * min_cost = min(costs[i] for i in range(self.n_moves)) + * for i in range(self.n_moves): # <<<<<<<<<<<<<< + * if is_valid[i] and costs[i] <= min_cost: + * action = self.c[i] +*/ + __pyx_t_10 = __pyx_v_self->__pyx_base.n_moves; + __pyx_t_12 = __pyx_t_10; + for (__pyx_t_13 = 0; __pyx_t_13 < __pyx_t_12; __pyx_t_13+=1) { + __pyx_v_i = __pyx_t_13; + + /* "spacy/pipeline/_parser_internals/arc_eager.pyx":854 + * min_cost = min(costs[i] for i in range(self.n_moves)) + * for i in range(self.n_moves): + * if is_valid[i] and costs[i] <= min_cost: # <<<<<<<<<<<<<< + * action = self.c[i] + * history.append(i) +*/ + __pyx_t_4 = ((__pyx_v_is_valid[__pyx_v_i]) != 0); + if (__pyx_t_4) { + } else { + __pyx_t_6 = __pyx_t_4; + goto __pyx_L18_bool_binop_done; + } + __pyx_t_11 = PyFloat_FromDouble((__pyx_cur_scope->__pyx_v_costs[__pyx_v_i])); if (unlikely(!__pyx_t_11)) __PYX_ERR(0, 854, __pyx_L1_error) + __Pyx_GOTREF(__pyx_t_11); + __pyx_t_1 = PyObject_RichCompare(__pyx_t_11, __pyx_v_min_cost, Py_LE); __Pyx_XGOTREF(__pyx_t_1); if (unlikely(!__pyx_t_1)) __PYX_ERR(0, 854, __pyx_L1_error) + __Pyx_DECREF(__pyx_t_11); __pyx_t_11 = 0; + __pyx_t_4 = __Pyx_PyObject_IsTrue(__pyx_t_1); if (unlikely((__pyx_t_4 < 0))) __PYX_ERR(0, 854, __pyx_L1_error) + __Pyx_DECREF(__pyx_t_1); __pyx_t_1 = 0; + __pyx_t_6 = __pyx_t_4; + __pyx_L18_bool_binop_done:; + if (__pyx_t_6) { + + /* "spacy/pipeline/_parser_internals/arc_eager.pyx":855 + * for i in range(self.n_moves): + * if is_valid[i] and costs[i] <= min_cost: + * action = self.c[i] # <<<<<<<<<<<<<< + * history.append(i) + * s0 = state.S(0) +*/ + __pyx_v_action = (__pyx_v_self->__pyx_base.c[__pyx_v_i]); + + /* "spacy/pipeline/_parser_internals/arc_eager.pyx":856 + * if is_valid[i] and costs[i] <= min_cost: + * action = self.c[i] + * history.append(i) # <<<<<<<<<<<<<< + * s0 = state.S(0) + * b0 = state.B(0) +*/ + __pyx_t_1 = __Pyx_PyLong_From_int(__pyx_v_i); if (unlikely(!__pyx_t_1)) __PYX_ERR(0, 856, __pyx_L1_error) + __Pyx_GOTREF(__pyx_t_1); + __pyx_t_14 = __Pyx_PyList_Append(__pyx_v_history, __pyx_t_1); if (unlikely(__pyx_t_14 == ((int)-1))) __PYX_ERR(0, 856, __pyx_L1_error) + __Pyx_DECREF(__pyx_t_1); __pyx_t_1 = 0; + + /* "spacy/pipeline/_parser_internals/arc_eager.pyx":857 + * action = self.c[i] + * history.append(i) + * s0 = state.S(0) # <<<<<<<<<<<<<< + * b0 = state.B(0) + * if _debug: +*/ + __pyx_t_11 = ((PyObject *)__pyx_v_state); + __Pyx_INCREF(__pyx_t_11); + __pyx_t_3 = 0; + { + PyObject *__pyx_callargs[2] = {__pyx_t_11, __pyx_mstate_global->__pyx_int_0}; + __pyx_t_1 = __Pyx_PyObject_FastCallMethod((PyObject*)__pyx_mstate_global->__pyx_n_u_S, __pyx_callargs+__pyx_t_3, (2-__pyx_t_3) | (1*__Pyx_PY_VECTORCALL_ARGUMENTS_OFFSET)); + __Pyx_XDECREF(__pyx_t_11); __pyx_t_11 = 0; + if (unlikely(!__pyx_t_1)) __PYX_ERR(0, 857, __pyx_L1_error) + __Pyx_GOTREF(__pyx_t_1); + } + __Pyx_XDECREF_SET(__pyx_v_s0, __pyx_t_1); + __pyx_t_1 = 0; + + /* "spacy/pipeline/_parser_internals/arc_eager.pyx":858 + * history.append(i) + * s0 = state.S(0) + * b0 = state.B(0) # <<<<<<<<<<<<<< + * if _debug: + * example = _debug +*/ + __pyx_t_11 = ((PyObject *)__pyx_v_state); + __Pyx_INCREF(__pyx_t_11); + __pyx_t_3 = 0; + { + PyObject *__pyx_callargs[2] = {__pyx_t_11, __pyx_mstate_global->__pyx_int_0}; + __pyx_t_1 = __Pyx_PyObject_FastCallMethod((PyObject*)__pyx_mstate_global->__pyx_n_u_B, __pyx_callargs+__pyx_t_3, (2-__pyx_t_3) | (1*__Pyx_PY_VECTORCALL_ARGUMENTS_OFFSET)); + __Pyx_XDECREF(__pyx_t_11); __pyx_t_11 = 0; + if (unlikely(!__pyx_t_1)) __PYX_ERR(0, 858, __pyx_L1_error) + __Pyx_GOTREF(__pyx_t_1); + } + __Pyx_XDECREF_SET(__pyx_v_b0, __pyx_t_1); + __pyx_t_1 = 0; + + /* "spacy/pipeline/_parser_internals/arc_eager.pyx":859 + * s0 = state.S(0) + * b0 = state.B(0) + * if _debug: # <<<<<<<<<<<<<< + * example = _debug + * debug_log.append(" ".join(( +*/ + __pyx_t_6 = __Pyx_PyObject_IsTrue(__pyx_v__debug); if (unlikely((__pyx_t_6 < 0))) __PYX_ERR(0, 859, __pyx_L1_error) + if (__pyx_t_6) { + + /* "spacy/pipeline/_parser_internals/arc_eager.pyx":860 + * b0 = state.B(0) + * if _debug: + * example = _debug # <<<<<<<<<<<<<< + * debug_log.append(" ".join(( + * self.get_class_name(i), +*/ + __Pyx_INCREF(__pyx_v__debug); + __Pyx_XDECREF_SET(__pyx_v_example, __pyx_v__debug); + + /* "spacy/pipeline/_parser_internals/arc_eager.pyx":862 + * example = _debug + * debug_log.append(" ".join(( + * self.get_class_name(i), # <<<<<<<<<<<<<< + * state.print_state() + * ))) +*/ + __pyx_t_11 = ((PyObject *)__pyx_v_self); + __Pyx_INCREF(__pyx_t_11); + __pyx_t_2 = __Pyx_PyLong_From_int(__pyx_v_i); if (unlikely(!__pyx_t_2)) __PYX_ERR(0, 862, __pyx_L1_error) + __Pyx_GOTREF(__pyx_t_2); + __pyx_t_3 = 0; + { + PyObject *__pyx_callargs[2] = {__pyx_t_11, __pyx_t_2}; + __pyx_t_1 = __Pyx_PyObject_FastCallMethod((PyObject*)__pyx_mstate_global->__pyx_n_u_get_class_name, __pyx_callargs+__pyx_t_3, (2-__pyx_t_3) | (1*__Pyx_PY_VECTORCALL_ARGUMENTS_OFFSET)); + __Pyx_XDECREF(__pyx_t_11); __pyx_t_11 = 0; + __Pyx_DECREF(__pyx_t_2); __pyx_t_2 = 0; + if (unlikely(!__pyx_t_1)) __PYX_ERR(0, 862, __pyx_L1_error) + __Pyx_GOTREF(__pyx_t_1); + } + + /* "spacy/pipeline/_parser_internals/arc_eager.pyx":863 + * debug_log.append(" ".join(( + * self.get_class_name(i), + * state.print_state() # <<<<<<<<<<<<<< + * ))) + * action.do(state.c, action.label) +*/ + __pyx_t_11 = ((PyObject *)__pyx_v_state); + __Pyx_INCREF(__pyx_t_11); + __pyx_t_3 = 0; + { + PyObject *__pyx_callargs[2] = {__pyx_t_11, NULL}; + __pyx_t_2 = __Pyx_PyObject_FastCallMethod((PyObject*)__pyx_mstate_global->__pyx_n_u_print_state, __pyx_callargs+__pyx_t_3, (1-__pyx_t_3) | (1*__Pyx_PY_VECTORCALL_ARGUMENTS_OFFSET)); + __Pyx_XDECREF(__pyx_t_11); __pyx_t_11 = 0; + if (unlikely(!__pyx_t_2)) __PYX_ERR(0, 863, __pyx_L1_error) + __Pyx_GOTREF(__pyx_t_2); + } + + /* "spacy/pipeline/_parser_internals/arc_eager.pyx":862 + * example = _debug + * debug_log.append(" ".join(( + * self.get_class_name(i), # <<<<<<<<<<<<<< + * state.print_state() + * ))) +*/ + __pyx_t_11 = PyTuple_New(2); if (unlikely(!__pyx_t_11)) __PYX_ERR(0, 862, __pyx_L1_error) + __Pyx_GOTREF(__pyx_t_11); + __Pyx_GIVEREF(__pyx_t_1); + if (__Pyx_PyTuple_SET_ITEM(__pyx_t_11, 0, __pyx_t_1) != (0)) __PYX_ERR(0, 862, __pyx_L1_error); + __Pyx_GIVEREF(__pyx_t_2); + if (__Pyx_PyTuple_SET_ITEM(__pyx_t_11, 1, __pyx_t_2) != (0)) __PYX_ERR(0, 862, __pyx_L1_error); + __pyx_t_1 = 0; + __pyx_t_2 = 0; + + /* "spacy/pipeline/_parser_internals/arc_eager.pyx":861 + * if _debug: + * example = _debug + * debug_log.append(" ".join(( # <<<<<<<<<<<<<< + * self.get_class_name(i), + * state.print_state() +*/ + __pyx_t_2 = PyUnicode_Join(__pyx_mstate_global->__pyx_kp_u__8, __pyx_t_11); if (unlikely(!__pyx_t_2)) __PYX_ERR(0, 861, __pyx_L1_error) + __Pyx_GOTREF(__pyx_t_2); + __Pyx_DECREF(__pyx_t_11); __pyx_t_11 = 0; + __pyx_t_14 = __Pyx_PyList_Append(__pyx_v_debug_log, __pyx_t_2); if (unlikely(__pyx_t_14 == ((int)-1))) __PYX_ERR(0, 861, __pyx_L1_error) + __Pyx_DECREF(__pyx_t_2); __pyx_t_2 = 0; + + /* "spacy/pipeline/_parser_internals/arc_eager.pyx":859 + * s0 = state.S(0) + * b0 = state.B(0) + * if _debug: # <<<<<<<<<<<<<< + * example = _debug + * debug_log.append(" ".join(( +*/ + } + + /* "spacy/pipeline/_parser_internals/arc_eager.pyx":865 + * state.print_state() + * ))) + * action.do(state.c, action.label) # <<<<<<<<<<<<<< + * break + * else: +*/ + (void)(__pyx_v_action.__pyx_do(__pyx_v_state->c, __pyx_v_action.label)); + + /* "spacy/pipeline/_parser_internals/arc_eager.pyx":866 + * ))) + * action.do(state.c, action.label) + * break # <<<<<<<<<<<<<< + * else: + * failed = False +*/ + goto __pyx_L16_break; + + /* "spacy/pipeline/_parser_internals/arc_eager.pyx":854 + * min_cost = min(costs[i] for i in range(self.n_moves)) + * for i in range(self.n_moves): + * if is_valid[i] and costs[i] <= min_cost: # <<<<<<<<<<<<<< + * action = self.c[i] + * history.append(i) +*/ + } + } + /*else*/ { + + /* "spacy/pipeline/_parser_internals/arc_eager.pyx":868 + * break + * else: + * failed = False # <<<<<<<<<<<<<< + * break + * if failed and _debug not in (False, None): +*/ + __pyx_v_failed = 0; + + /* "spacy/pipeline/_parser_internals/arc_eager.pyx":869 + * else: + * failed = False + * break # <<<<<<<<<<<<<< + * if failed and _debug not in (False, None): + * example = _debug +*/ + goto __pyx_L4_break; + } + __pyx_L16_break:; + } + __pyx_L4_break:; + + /* "spacy/pipeline/_parser_internals/arc_eager.pyx":870 + * failed = False + * break + * if failed and _debug not in (False, None): # <<<<<<<<<<<<<< + * example = _debug + * print("Actions") +*/ + if (__pyx_v_failed) { + } else { + __pyx_t_6 = __pyx_v_failed; + goto __pyx_L22_bool_binop_done; + } + __Pyx_INCREF(__pyx_v__debug); + __pyx_t_2 = __pyx_v__debug; + __pyx_t_11 = PyObject_RichCompare(__pyx_t_2, Py_False, Py_NE); __Pyx_XGOTREF(__pyx_t_11); if (unlikely(!__pyx_t_11)) __PYX_ERR(0, 870, __pyx_L1_error) + __pyx_t_15 = __Pyx_PyObject_IsTrue(__pyx_t_11); if (unlikely((__pyx_t_15 < 0))) __PYX_ERR(0, 870, __pyx_L1_error) + __Pyx_DECREF(__pyx_t_11); __pyx_t_11 = 0; + if (__pyx_t_15) { + } else { + __pyx_t_4 = __pyx_t_15; + goto __pyx_L24_bool_binop_done; + } + __pyx_t_11 = PyObject_RichCompare(__pyx_t_2, Py_None, Py_NE); __Pyx_XGOTREF(__pyx_t_11); if (unlikely(!__pyx_t_11)) __PYX_ERR(0, 870, __pyx_L1_error) + __pyx_t_15 = __Pyx_PyObject_IsTrue(__pyx_t_11); if (unlikely((__pyx_t_15 < 0))) __PYX_ERR(0, 870, __pyx_L1_error) + __Pyx_DECREF(__pyx_t_11); __pyx_t_11 = 0; + __pyx_t_4 = __pyx_t_15; + __pyx_L24_bool_binop_done:; + __Pyx_DECREF(__pyx_t_2); __pyx_t_2 = 0; + __pyx_t_15 = __pyx_t_4; + __pyx_t_6 = __pyx_t_15; + __pyx_L22_bool_binop_done:; + if (__pyx_t_6) { + + /* "spacy/pipeline/_parser_internals/arc_eager.pyx":871 + * break + * if failed and _debug not in (False, None): + * example = _debug # <<<<<<<<<<<<<< + * print("Actions") + * for i in range(self.n_moves): +*/ + __Pyx_INCREF(__pyx_v__debug); + __Pyx_XDECREF_SET(__pyx_v_example, __pyx_v__debug); + + /* "spacy/pipeline/_parser_internals/arc_eager.pyx":872 + * if failed and _debug not in (False, None): + * example = _debug + * print("Actions") # <<<<<<<<<<<<<< + * for i in range(self.n_moves): + * print(self.get_class_name(i)) +*/ + if (__Pyx_PrintOne(0, __pyx_mstate_global->__pyx_n_u_Actions) < 0) __PYX_ERR(0, 872, __pyx_L1_error) + + /* "spacy/pipeline/_parser_internals/arc_eager.pyx":873 + * example = _debug + * print("Actions") + * for i in range(self.n_moves): # <<<<<<<<<<<<<< + * print(self.get_class_name(i)) + * print("Gold") +*/ + __pyx_t_10 = __pyx_v_self->__pyx_base.n_moves; + __pyx_t_12 = __pyx_t_10; + for (__pyx_t_13 = 0; __pyx_t_13 < __pyx_t_12; __pyx_t_13+=1) { + __pyx_v_i = __pyx_t_13; + + /* "spacy/pipeline/_parser_internals/arc_eager.pyx":874 + * print("Actions") + * for i in range(self.n_moves): + * print(self.get_class_name(i)) # <<<<<<<<<<<<<< + * print("Gold") + * for token in example.y: +*/ + __pyx_t_11 = ((PyObject *)__pyx_v_self); + __Pyx_INCREF(__pyx_t_11); + __pyx_t_1 = __Pyx_PyLong_From_int(__pyx_v_i); if (unlikely(!__pyx_t_1)) __PYX_ERR(0, 874, __pyx_L1_error) + __Pyx_GOTREF(__pyx_t_1); + __pyx_t_3 = 0; + { + PyObject *__pyx_callargs[2] = {__pyx_t_11, __pyx_t_1}; + __pyx_t_2 = __Pyx_PyObject_FastCallMethod((PyObject*)__pyx_mstate_global->__pyx_n_u_get_class_name, __pyx_callargs+__pyx_t_3, (2-__pyx_t_3) | (1*__Pyx_PY_VECTORCALL_ARGUMENTS_OFFSET)); + __Pyx_XDECREF(__pyx_t_11); __pyx_t_11 = 0; + __Pyx_DECREF(__pyx_t_1); __pyx_t_1 = 0; + if (unlikely(!__pyx_t_2)) __PYX_ERR(0, 874, __pyx_L1_error) + __Pyx_GOTREF(__pyx_t_2); + } + if (__Pyx_PrintOne(0, __pyx_t_2) < 0) __PYX_ERR(0, 874, __pyx_L1_error) + __Pyx_DECREF(__pyx_t_2); __pyx_t_2 = 0; + } + + /* "spacy/pipeline/_parser_internals/arc_eager.pyx":875 + * for i in range(self.n_moves): + * print(self.get_class_name(i)) + * print("Gold") # <<<<<<<<<<<<<< + * for token in example.y: + * print(token.i, token.text, token.dep_, token.head.text) +*/ + if (__Pyx_PrintOne(0, __pyx_mstate_global->__pyx_n_u_Gold) < 0) __PYX_ERR(0, 875, __pyx_L1_error) + + /* "spacy/pipeline/_parser_internals/arc_eager.pyx":876 + * print(self.get_class_name(i)) + * print("Gold") + * for token in example.y: # <<<<<<<<<<<<<< + * print(token.i, token.text, token.dep_, token.head.text) + * aligned_heads, _aligned_labels = example.get_aligned_parse() +*/ + __pyx_t_2 = __Pyx_PyObject_GetAttrStr(__pyx_v_example, __pyx_mstate_global->__pyx_n_u_y); if (unlikely(!__pyx_t_2)) __PYX_ERR(0, 876, __pyx_L1_error) + __Pyx_GOTREF(__pyx_t_2); + if (likely(PyList_CheckExact(__pyx_t_2)) || PyTuple_CheckExact(__pyx_t_2)) { + __pyx_t_1 = __pyx_t_2; __Pyx_INCREF(__pyx_t_1); + __pyx_t_16 = 0; + __pyx_t_17 = NULL; + } else { + __pyx_t_16 = -1; __pyx_t_1 = PyObject_GetIter(__pyx_t_2); if (unlikely(!__pyx_t_1)) __PYX_ERR(0, 876, __pyx_L1_error) + __Pyx_GOTREF(__pyx_t_1); + __pyx_t_17 = (CYTHON_COMPILING_IN_LIMITED_API) ? PyIter_Next : __Pyx_PyObject_GetIterNextFunc(__pyx_t_1); if (unlikely(!__pyx_t_17)) __PYX_ERR(0, 876, __pyx_L1_error) + } + __Pyx_DECREF(__pyx_t_2); __pyx_t_2 = 0; + for (;;) { + if (likely(!__pyx_t_17)) { + if (likely(PyList_CheckExact(__pyx_t_1))) { + { + Py_ssize_t __pyx_temp = __Pyx_PyList_GET_SIZE(__pyx_t_1); + #if !CYTHON_ASSUME_SAFE_SIZE + if (unlikely((__pyx_temp < 0))) __PYX_ERR(0, 876, __pyx_L1_error) + #endif + if (__pyx_t_16 >= __pyx_temp) break; + } + __pyx_t_2 = __Pyx_PyList_GetItemRefFast(__pyx_t_1, __pyx_t_16, __Pyx_ReferenceSharing_OwnStrongReference); + ++__pyx_t_16; + } else { + { + Py_ssize_t __pyx_temp = __Pyx_PyTuple_GET_SIZE(__pyx_t_1); + #if !CYTHON_ASSUME_SAFE_SIZE + if (unlikely((__pyx_temp < 0))) __PYX_ERR(0, 876, __pyx_L1_error) + #endif + if (__pyx_t_16 >= __pyx_temp) break; + } + #if CYTHON_ASSUME_SAFE_MACROS && !CYTHON_AVOID_BORROWED_REFS + __pyx_t_2 = __Pyx_NewRef(PyTuple_GET_ITEM(__pyx_t_1, __pyx_t_16)); + #else + __pyx_t_2 = __Pyx_PySequence_ITEM(__pyx_t_1, __pyx_t_16); + #endif + ++__pyx_t_16; + } + if (unlikely(!__pyx_t_2)) __PYX_ERR(0, 876, __pyx_L1_error) + } else { + __pyx_t_2 = __pyx_t_17(__pyx_t_1); + 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, 876, __pyx_L1_error) + PyErr_Clear(); + } + break; + } + } + __Pyx_GOTREF(__pyx_t_2); + __Pyx_XDECREF_SET(__pyx_v_token, __pyx_t_2); + __pyx_t_2 = 0; + + /* "spacy/pipeline/_parser_internals/arc_eager.pyx":877 + * print("Gold") + * for token in example.y: + * print(token.i, token.text, token.dep_, token.head.text) # <<<<<<<<<<<<<< + * aligned_heads, _aligned_labels = example.get_aligned_parse() + * print("Aligned heads") +*/ + __pyx_t_2 = __Pyx_PyObject_GetAttrStr(__pyx_v_token, __pyx_mstate_global->__pyx_n_u_i); if (unlikely(!__pyx_t_2)) __PYX_ERR(0, 877, __pyx_L1_error) + __Pyx_GOTREF(__pyx_t_2); + __pyx_t_11 = __Pyx_PyObject_GetAttrStr(__pyx_v_token, __pyx_mstate_global->__pyx_n_u_text); if (unlikely(!__pyx_t_11)) __PYX_ERR(0, 877, __pyx_L1_error) + __Pyx_GOTREF(__pyx_t_11); + __pyx_t_18 = __Pyx_PyObject_GetAttrStr(__pyx_v_token, __pyx_mstate_global->__pyx_n_u_dep_2); if (unlikely(!__pyx_t_18)) __PYX_ERR(0, 877, __pyx_L1_error) + __Pyx_GOTREF(__pyx_t_18); + __pyx_t_19 = __Pyx_PyObject_GetAttrStr(__pyx_v_token, __pyx_mstate_global->__pyx_n_u_head); if (unlikely(!__pyx_t_19)) __PYX_ERR(0, 877, __pyx_L1_error) + __Pyx_GOTREF(__pyx_t_19); + __pyx_t_20 = __Pyx_PyObject_GetAttrStr(__pyx_t_19, __pyx_mstate_global->__pyx_n_u_text); if (unlikely(!__pyx_t_20)) __PYX_ERR(0, 877, __pyx_L1_error) + __Pyx_GOTREF(__pyx_t_20); + __Pyx_DECREF(__pyx_t_19); __pyx_t_19 = 0; + __pyx_t_19 = PyTuple_New(4); if (unlikely(!__pyx_t_19)) __PYX_ERR(0, 877, __pyx_L1_error) + __Pyx_GOTREF(__pyx_t_19); + __Pyx_GIVEREF(__pyx_t_2); + if (__Pyx_PyTuple_SET_ITEM(__pyx_t_19, 0, __pyx_t_2) != (0)) __PYX_ERR(0, 877, __pyx_L1_error); + __Pyx_GIVEREF(__pyx_t_11); + if (__Pyx_PyTuple_SET_ITEM(__pyx_t_19, 1, __pyx_t_11) != (0)) __PYX_ERR(0, 877, __pyx_L1_error); + __Pyx_GIVEREF(__pyx_t_18); + if (__Pyx_PyTuple_SET_ITEM(__pyx_t_19, 2, __pyx_t_18) != (0)) __PYX_ERR(0, 877, __pyx_L1_error); + __Pyx_GIVEREF(__pyx_t_20); + if (__Pyx_PyTuple_SET_ITEM(__pyx_t_19, 3, __pyx_t_20) != (0)) __PYX_ERR(0, 877, __pyx_L1_error); + __pyx_t_2 = 0; + __pyx_t_11 = 0; + __pyx_t_18 = 0; + __pyx_t_20 = 0; + if (__Pyx_PrintOne(0, __pyx_t_19) < 0) __PYX_ERR(0, 877, __pyx_L1_error) + __Pyx_DECREF(__pyx_t_19); __pyx_t_19 = 0; + + /* "spacy/pipeline/_parser_internals/arc_eager.pyx":876 + * print(self.get_class_name(i)) + * print("Gold") + * for token in example.y: # <<<<<<<<<<<<<< + * print(token.i, token.text, token.dep_, token.head.text) + * aligned_heads, _aligned_labels = example.get_aligned_parse() +*/ + } + __Pyx_DECREF(__pyx_t_1); __pyx_t_1 = 0; + + /* "spacy/pipeline/_parser_internals/arc_eager.pyx":878 + * for token in example.y: + * print(token.i, token.text, token.dep_, token.head.text) + * aligned_heads, _aligned_labels = example.get_aligned_parse() # <<<<<<<<<<<<<< + * print("Aligned heads") + * for i, head in enumerate(aligned_heads): +*/ + __pyx_t_19 = __pyx_v_example; + __Pyx_INCREF(__pyx_t_19); + __pyx_t_3 = 0; + { + PyObject *__pyx_callargs[2] = {__pyx_t_19, NULL}; + __pyx_t_1 = __Pyx_PyObject_FastCallMethod((PyObject*)__pyx_mstate_global->__pyx_n_u_get_aligned_parse, __pyx_callargs+__pyx_t_3, (1-__pyx_t_3) | (1*__Pyx_PY_VECTORCALL_ARGUMENTS_OFFSET)); + __Pyx_XDECREF(__pyx_t_19); __pyx_t_19 = 0; + if (unlikely(!__pyx_t_1)) __PYX_ERR(0, 878, __pyx_L1_error) + __Pyx_GOTREF(__pyx_t_1); + } + if ((likely(PyTuple_CheckExact(__pyx_t_1))) || (PyList_CheckExact(__pyx_t_1))) { + PyObject* sequence = __pyx_t_1; + 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, 878, __pyx_L1_error) + } + #if CYTHON_ASSUME_SAFE_MACROS && !CYTHON_AVOID_BORROWED_REFS + if (likely(PyTuple_CheckExact(sequence))) { + __pyx_t_19 = PyTuple_GET_ITEM(sequence, 0); + __Pyx_INCREF(__pyx_t_19); + __pyx_t_20 = PyTuple_GET_ITEM(sequence, 1); + __Pyx_INCREF(__pyx_t_20); + } else { + __pyx_t_19 = __Pyx_PyList_GetItemRefFast(sequence, 0, __Pyx_ReferenceSharing_SharedReference); + if (unlikely(!__pyx_t_19)) __PYX_ERR(0, 878, __pyx_L1_error) + __Pyx_XGOTREF(__pyx_t_19); + __pyx_t_20 = __Pyx_PyList_GetItemRefFast(sequence, 1, __Pyx_ReferenceSharing_SharedReference); + if (unlikely(!__pyx_t_20)) __PYX_ERR(0, 878, __pyx_L1_error) + __Pyx_XGOTREF(__pyx_t_20); + } + #else + __pyx_t_19 = __Pyx_PySequence_ITEM(sequence, 0); if (unlikely(!__pyx_t_19)) __PYX_ERR(0, 878, __pyx_L1_error) + __Pyx_GOTREF(__pyx_t_19); + __pyx_t_20 = __Pyx_PySequence_ITEM(sequence, 1); if (unlikely(!__pyx_t_20)) __PYX_ERR(0, 878, __pyx_L1_error) + __Pyx_GOTREF(__pyx_t_20); + #endif + __Pyx_DECREF(__pyx_t_1); __pyx_t_1 = 0; + } else { + Py_ssize_t index = -1; + __pyx_t_18 = PyObject_GetIter(__pyx_t_1); if (unlikely(!__pyx_t_18)) __PYX_ERR(0, 878, __pyx_L1_error) + __Pyx_GOTREF(__pyx_t_18); + __Pyx_DECREF(__pyx_t_1); __pyx_t_1 = 0; + __pyx_t_21 = (CYTHON_COMPILING_IN_LIMITED_API) ? PyIter_Next : __Pyx_PyObject_GetIterNextFunc(__pyx_t_18); + index = 0; __pyx_t_19 = __pyx_t_21(__pyx_t_18); if (unlikely(!__pyx_t_19)) goto __pyx_L31_unpacking_failed; + __Pyx_GOTREF(__pyx_t_19); + index = 1; __pyx_t_20 = __pyx_t_21(__pyx_t_18); if (unlikely(!__pyx_t_20)) goto __pyx_L31_unpacking_failed; + __Pyx_GOTREF(__pyx_t_20); + if (__Pyx_IternextUnpackEndCheck(__pyx_t_21(__pyx_t_18), 2) < (0)) __PYX_ERR(0, 878, __pyx_L1_error) + __pyx_t_21 = NULL; + __Pyx_DECREF(__pyx_t_18); __pyx_t_18 = 0; + goto __pyx_L32_unpacking_done; + __pyx_L31_unpacking_failed:; + __Pyx_DECREF(__pyx_t_18); __pyx_t_18 = 0; + __pyx_t_21 = NULL; + if (__Pyx_IterFinish() == 0) __Pyx_RaiseNeedMoreValuesError(index); + __PYX_ERR(0, 878, __pyx_L1_error) + __pyx_L32_unpacking_done:; + } + __pyx_v_aligned_heads = __pyx_t_19; + __pyx_t_19 = 0; + __pyx_v__aligned_labels = __pyx_t_20; + __pyx_t_20 = 0; + + /* "spacy/pipeline/_parser_internals/arc_eager.pyx":879 + * print(token.i, token.text, token.dep_, token.head.text) + * aligned_heads, _aligned_labels = example.get_aligned_parse() + * print("Aligned heads") # <<<<<<<<<<<<<< + * for i, head in enumerate(aligned_heads): + * print(example.x[i], example.x[head] if head is not None else "__") +*/ + if (__Pyx_PrintOne(0, __pyx_mstate_global->__pyx_kp_u_Aligned_heads) < 0) __PYX_ERR(0, 879, __pyx_L1_error) + + /* "spacy/pipeline/_parser_internals/arc_eager.pyx":880 + * aligned_heads, _aligned_labels = example.get_aligned_parse() + * print("Aligned heads") + * for i, head in enumerate(aligned_heads): # <<<<<<<<<<<<<< + * print(example.x[i], example.x[head] if head is not None else "__") + * print("Aligned sent starts") +*/ + __pyx_t_10 = 0; + if (likely(PyList_CheckExact(__pyx_v_aligned_heads)) || PyTuple_CheckExact(__pyx_v_aligned_heads)) { + __pyx_t_1 = __pyx_v_aligned_heads; __Pyx_INCREF(__pyx_t_1); + __pyx_t_16 = 0; + __pyx_t_17 = NULL; + } else { + __pyx_t_16 = -1; __pyx_t_1 = PyObject_GetIter(__pyx_v_aligned_heads); if (unlikely(!__pyx_t_1)) __PYX_ERR(0, 880, __pyx_L1_error) + __Pyx_GOTREF(__pyx_t_1); + __pyx_t_17 = (CYTHON_COMPILING_IN_LIMITED_API) ? PyIter_Next : __Pyx_PyObject_GetIterNextFunc(__pyx_t_1); if (unlikely(!__pyx_t_17)) __PYX_ERR(0, 880, __pyx_L1_error) + } + for (;;) { + if (likely(!__pyx_t_17)) { + if (likely(PyList_CheckExact(__pyx_t_1))) { + { + Py_ssize_t __pyx_temp = __Pyx_PyList_GET_SIZE(__pyx_t_1); + #if !CYTHON_ASSUME_SAFE_SIZE + if (unlikely((__pyx_temp < 0))) __PYX_ERR(0, 880, __pyx_L1_error) + #endif + if (__pyx_t_16 >= __pyx_temp) break; + } + __pyx_t_20 = __Pyx_PyList_GetItemRefFast(__pyx_t_1, __pyx_t_16, __Pyx_ReferenceSharing_OwnStrongReference); + ++__pyx_t_16; + } else { + { + Py_ssize_t __pyx_temp = __Pyx_PyTuple_GET_SIZE(__pyx_t_1); + #if !CYTHON_ASSUME_SAFE_SIZE + if (unlikely((__pyx_temp < 0))) __PYX_ERR(0, 880, __pyx_L1_error) + #endif + if (__pyx_t_16 >= __pyx_temp) break; + } + #if CYTHON_ASSUME_SAFE_MACROS && !CYTHON_AVOID_BORROWED_REFS + __pyx_t_20 = __Pyx_NewRef(PyTuple_GET_ITEM(__pyx_t_1, __pyx_t_16)); + #else + __pyx_t_20 = __Pyx_PySequence_ITEM(__pyx_t_1, __pyx_t_16); + #endif + ++__pyx_t_16; + } + if (unlikely(!__pyx_t_20)) __PYX_ERR(0, 880, __pyx_L1_error) + } else { + __pyx_t_20 = __pyx_t_17(__pyx_t_1); + if (unlikely(!__pyx_t_20)) { + PyObject* exc_type = PyErr_Occurred(); + if (exc_type) { + if (unlikely(!__Pyx_PyErr_GivenExceptionMatches(exc_type, PyExc_StopIteration))) __PYX_ERR(0, 880, __pyx_L1_error) + PyErr_Clear(); + } + break; + } + } + __Pyx_GOTREF(__pyx_t_20); + __Pyx_XDECREF_SET(__pyx_v_head, __pyx_t_20); + __pyx_t_20 = 0; + __pyx_v_i = __pyx_t_10; + __pyx_t_10 = (__pyx_t_10 + 1); + + /* "spacy/pipeline/_parser_internals/arc_eager.pyx":881 + * print("Aligned heads") + * for i, head in enumerate(aligned_heads): + * print(example.x[i], example.x[head] if head is not None else "__") # <<<<<<<<<<<<<< + * print("Aligned sent starts") + * print(example.get_aligned_sent_starts()) +*/ + __pyx_t_20 = __Pyx_PyObject_GetAttrStr(__pyx_v_example, __pyx_mstate_global->__pyx_n_u_x); if (unlikely(!__pyx_t_20)) __PYX_ERR(0, 881, __pyx_L1_error) + __Pyx_GOTREF(__pyx_t_20); + __pyx_t_19 = __Pyx_GetItemInt(__pyx_t_20, __pyx_v_i, int, 1, __Pyx_PyLong_From_int, 0, 1, 1, 1, __Pyx_ReferenceSharing_OwnStrongReference); if (unlikely(!__pyx_t_19)) __PYX_ERR(0, 881, __pyx_L1_error) + __Pyx_GOTREF(__pyx_t_19); + __Pyx_DECREF(__pyx_t_20); __pyx_t_20 = 0; + __pyx_t_6 = (__pyx_v_head != Py_None); + if (__pyx_t_6) { + __pyx_t_18 = __Pyx_PyObject_GetAttrStr(__pyx_v_example, __pyx_mstate_global->__pyx_n_u_x); if (unlikely(!__pyx_t_18)) __PYX_ERR(0, 881, __pyx_L1_error) + __Pyx_GOTREF(__pyx_t_18); + __pyx_t_11 = __Pyx_PyObject_GetItem(__pyx_t_18, __pyx_v_head); if (unlikely(!__pyx_t_11)) __PYX_ERR(0, 881, __pyx_L1_error) + __Pyx_GOTREF(__pyx_t_11); + __Pyx_DECREF(__pyx_t_18); __pyx_t_18 = 0; + __pyx_t_20 = __pyx_t_11; + __pyx_t_11 = 0; + } else { + __Pyx_INCREF(__pyx_mstate_global->__pyx_n_u__9); + __pyx_t_20 = __pyx_mstate_global->__pyx_n_u__9; + } + __pyx_t_11 = PyTuple_New(2); if (unlikely(!__pyx_t_11)) __PYX_ERR(0, 881, __pyx_L1_error) + __Pyx_GOTREF(__pyx_t_11); + __Pyx_GIVEREF(__pyx_t_19); + if (__Pyx_PyTuple_SET_ITEM(__pyx_t_11, 0, __pyx_t_19) != (0)) __PYX_ERR(0, 881, __pyx_L1_error); + __Pyx_GIVEREF(__pyx_t_20); + if (__Pyx_PyTuple_SET_ITEM(__pyx_t_11, 1, __pyx_t_20) != (0)) __PYX_ERR(0, 881, __pyx_L1_error); + __pyx_t_19 = 0; + __pyx_t_20 = 0; + if (__Pyx_PrintOne(0, __pyx_t_11) < 0) __PYX_ERR(0, 881, __pyx_L1_error) + __Pyx_DECREF(__pyx_t_11); __pyx_t_11 = 0; + + /* "spacy/pipeline/_parser_internals/arc_eager.pyx":880 + * aligned_heads, _aligned_labels = example.get_aligned_parse() + * print("Aligned heads") + * for i, head in enumerate(aligned_heads): # <<<<<<<<<<<<<< + * print(example.x[i], example.x[head] if head is not None else "__") + * print("Aligned sent starts") +*/ + } + __Pyx_DECREF(__pyx_t_1); __pyx_t_1 = 0; + + /* "spacy/pipeline/_parser_internals/arc_eager.pyx":882 + * for i, head in enumerate(aligned_heads): + * print(example.x[i], example.x[head] if head is not None else "__") + * print("Aligned sent starts") # <<<<<<<<<<<<<< + * print(example.get_aligned_sent_starts()) + * +*/ + if (__Pyx_PrintOne(0, __pyx_mstate_global->__pyx_kp_u_Aligned_sent_starts) < 0) __PYX_ERR(0, 882, __pyx_L1_error) + + /* "spacy/pipeline/_parser_internals/arc_eager.pyx":883 + * print(example.x[i], example.x[head] if head is not None else "__") + * print("Aligned sent starts") + * print(example.get_aligned_sent_starts()) # <<<<<<<<<<<<<< + * + * print("Predicted tokens") +*/ + __pyx_t_11 = __pyx_v_example; + __Pyx_INCREF(__pyx_t_11); + __pyx_t_3 = 0; + { + PyObject *__pyx_callargs[2] = {__pyx_t_11, NULL}; + __pyx_t_1 = __Pyx_PyObject_FastCallMethod((PyObject*)__pyx_mstate_global->__pyx_n_u_get_aligned_sent_starts_2, __pyx_callargs+__pyx_t_3, (1-__pyx_t_3) | (1*__Pyx_PY_VECTORCALL_ARGUMENTS_OFFSET)); + __Pyx_XDECREF(__pyx_t_11); __pyx_t_11 = 0; + if (unlikely(!__pyx_t_1)) __PYX_ERR(0, 883, __pyx_L1_error) + __Pyx_GOTREF(__pyx_t_1); + } + if (__Pyx_PrintOne(0, __pyx_t_1) < 0) __PYX_ERR(0, 883, __pyx_L1_error) + __Pyx_DECREF(__pyx_t_1); __pyx_t_1 = 0; + + /* "spacy/pipeline/_parser_internals/arc_eager.pyx":885 + * print(example.get_aligned_sent_starts()) + * + * print("Predicted tokens") # <<<<<<<<<<<<<< + * print([(w.i, w.text) for w in example.x]) + * s0 = state.S(0) +*/ + if (__Pyx_PrintOne(0, __pyx_mstate_global->__pyx_kp_u_Predicted_tokens) < 0) __PYX_ERR(0, 885, __pyx_L1_error) + + /* "spacy/pipeline/_parser_internals/arc_eager.pyx":886 + * + * print("Predicted tokens") + * print([(w.i, w.text) for w in example.x]) # <<<<<<<<<<<<<< + * s0 = state.S(0) + * b0 = state.B(0) +*/ + __pyx_t_1 = PyList_New(0); if (unlikely(!__pyx_t_1)) __PYX_ERR(0, 886, __pyx_L1_error) + __Pyx_GOTREF(__pyx_t_1); + __pyx_t_11 = __Pyx_PyObject_GetAttrStr(__pyx_v_example, __pyx_mstate_global->__pyx_n_u_x); if (unlikely(!__pyx_t_11)) __PYX_ERR(0, 886, __pyx_L1_error) + __Pyx_GOTREF(__pyx_t_11); + if (likely(PyList_CheckExact(__pyx_t_11)) || PyTuple_CheckExact(__pyx_t_11)) { + __pyx_t_20 = __pyx_t_11; __Pyx_INCREF(__pyx_t_20); + __pyx_t_16 = 0; + __pyx_t_17 = NULL; + } else { + __pyx_t_16 = -1; __pyx_t_20 = PyObject_GetIter(__pyx_t_11); if (unlikely(!__pyx_t_20)) __PYX_ERR(0, 886, __pyx_L1_error) + __Pyx_GOTREF(__pyx_t_20); + __pyx_t_17 = (CYTHON_COMPILING_IN_LIMITED_API) ? PyIter_Next : __Pyx_PyObject_GetIterNextFunc(__pyx_t_20); if (unlikely(!__pyx_t_17)) __PYX_ERR(0, 886, __pyx_L1_error) + } + __Pyx_DECREF(__pyx_t_11); __pyx_t_11 = 0; + for (;;) { + if (likely(!__pyx_t_17)) { + if (likely(PyList_CheckExact(__pyx_t_20))) { + { + Py_ssize_t __pyx_temp = __Pyx_PyList_GET_SIZE(__pyx_t_20); + #if !CYTHON_ASSUME_SAFE_SIZE + if (unlikely((__pyx_temp < 0))) __PYX_ERR(0, 886, __pyx_L1_error) + #endif + if (__pyx_t_16 >= __pyx_temp) break; + } + __pyx_t_11 = __Pyx_PyList_GetItemRefFast(__pyx_t_20, __pyx_t_16, __Pyx_ReferenceSharing_OwnStrongReference); + ++__pyx_t_16; + } else { + { + Py_ssize_t __pyx_temp = __Pyx_PyTuple_GET_SIZE(__pyx_t_20); + #if !CYTHON_ASSUME_SAFE_SIZE + if (unlikely((__pyx_temp < 0))) __PYX_ERR(0, 886, __pyx_L1_error) + #endif + if (__pyx_t_16 >= __pyx_temp) break; + } + #if CYTHON_ASSUME_SAFE_MACROS && !CYTHON_AVOID_BORROWED_REFS + __pyx_t_11 = __Pyx_NewRef(PyTuple_GET_ITEM(__pyx_t_20, __pyx_t_16)); + #else + __pyx_t_11 = __Pyx_PySequence_ITEM(__pyx_t_20, __pyx_t_16); + #endif + ++__pyx_t_16; + } + if (unlikely(!__pyx_t_11)) __PYX_ERR(0, 886, __pyx_L1_error) + } else { + __pyx_t_11 = __pyx_t_17(__pyx_t_20); + if (unlikely(!__pyx_t_11)) { + PyObject* exc_type = PyErr_Occurred(); + if (exc_type) { + if (unlikely(!__Pyx_PyErr_GivenExceptionMatches(exc_type, PyExc_StopIteration))) __PYX_ERR(0, 886, __pyx_L1_error) + PyErr_Clear(); + } + break; + } + } + __Pyx_GOTREF(__pyx_t_11); + __Pyx_XDECREF_SET(__pyx_v_w, __pyx_t_11); + __pyx_t_11 = 0; + __pyx_t_11 = __Pyx_PyObject_GetAttrStr(__pyx_v_w, __pyx_mstate_global->__pyx_n_u_i); if (unlikely(!__pyx_t_11)) __PYX_ERR(0, 886, __pyx_L1_error) + __Pyx_GOTREF(__pyx_t_11); + __pyx_t_19 = __Pyx_PyObject_GetAttrStr(__pyx_v_w, __pyx_mstate_global->__pyx_n_u_text); if (unlikely(!__pyx_t_19)) __PYX_ERR(0, 886, __pyx_L1_error) + __Pyx_GOTREF(__pyx_t_19); + __pyx_t_18 = PyTuple_New(2); if (unlikely(!__pyx_t_18)) __PYX_ERR(0, 886, __pyx_L1_error) + __Pyx_GOTREF(__pyx_t_18); + __Pyx_GIVEREF(__pyx_t_11); + if (__Pyx_PyTuple_SET_ITEM(__pyx_t_18, 0, __pyx_t_11) != (0)) __PYX_ERR(0, 886, __pyx_L1_error); + __Pyx_GIVEREF(__pyx_t_19); + if (__Pyx_PyTuple_SET_ITEM(__pyx_t_18, 1, __pyx_t_19) != (0)) __PYX_ERR(0, 886, __pyx_L1_error); + __pyx_t_11 = 0; + __pyx_t_19 = 0; + if (unlikely(__Pyx_ListComp_Append(__pyx_t_1, (PyObject*)__pyx_t_18))) __PYX_ERR(0, 886, __pyx_L1_error) + __Pyx_DECREF(__pyx_t_18); __pyx_t_18 = 0; + } + __Pyx_DECREF(__pyx_t_20); __pyx_t_20 = 0; + if (__Pyx_PrintOne(0, __pyx_t_1) < 0) __PYX_ERR(0, 886, __pyx_L1_error) + __Pyx_DECREF(__pyx_t_1); __pyx_t_1 = 0; + + /* "spacy/pipeline/_parser_internals/arc_eager.pyx":887 + * print("Predicted tokens") + * print([(w.i, w.text) for w in example.x]) + * s0 = state.S(0) # <<<<<<<<<<<<<< + * b0 = state.B(0) + * debug_log.append(" ".join(( +*/ + __pyx_t_20 = ((PyObject *)__pyx_v_state); + __Pyx_INCREF(__pyx_t_20); + __pyx_t_3 = 0; + { + PyObject *__pyx_callargs[2] = {__pyx_t_20, __pyx_mstate_global->__pyx_int_0}; + __pyx_t_1 = __Pyx_PyObject_FastCallMethod((PyObject*)__pyx_mstate_global->__pyx_n_u_S, __pyx_callargs+__pyx_t_3, (2-__pyx_t_3) | (1*__Pyx_PY_VECTORCALL_ARGUMENTS_OFFSET)); + __Pyx_XDECREF(__pyx_t_20); __pyx_t_20 = 0; + if (unlikely(!__pyx_t_1)) __PYX_ERR(0, 887, __pyx_L1_error) + __Pyx_GOTREF(__pyx_t_1); + } + __Pyx_XDECREF_SET(__pyx_v_s0, __pyx_t_1); + __pyx_t_1 = 0; + + /* "spacy/pipeline/_parser_internals/arc_eager.pyx":888 + * print([(w.i, w.text) for w in example.x]) + * s0 = state.S(0) + * b0 = state.B(0) # <<<<<<<<<<<<<< + * debug_log.append(" ".join(( + * "?", +*/ + __pyx_t_20 = ((PyObject *)__pyx_v_state); + __Pyx_INCREF(__pyx_t_20); + __pyx_t_3 = 0; + { + PyObject *__pyx_callargs[2] = {__pyx_t_20, __pyx_mstate_global->__pyx_int_0}; + __pyx_t_1 = __Pyx_PyObject_FastCallMethod((PyObject*)__pyx_mstate_global->__pyx_n_u_B, __pyx_callargs+__pyx_t_3, (2-__pyx_t_3) | (1*__Pyx_PY_VECTORCALL_ARGUMENTS_OFFSET)); + __Pyx_XDECREF(__pyx_t_20); __pyx_t_20 = 0; + if (unlikely(!__pyx_t_1)) __PYX_ERR(0, 888, __pyx_L1_error) + __Pyx_GOTREF(__pyx_t_1); + } + __Pyx_XDECREF_SET(__pyx_v_b0, __pyx_t_1); + __pyx_t_1 = 0; + + /* "spacy/pipeline/_parser_internals/arc_eager.pyx":891 + * debug_log.append(" ".join(( + * "?", + * "S0=", (example.x[s0].text if s0 >= 0 else "-"), # <<<<<<<<<<<<<< + * "B0=", (example.x[b0].text if b0 >= 0 else "-"), + * "S0 head?", str(state.has_head(state.S(0))), +*/ + __pyx_t_20 = PyObject_RichCompare(__pyx_v_s0, __pyx_mstate_global->__pyx_int_0, Py_GE); __Pyx_XGOTREF(__pyx_t_20); if (unlikely(!__pyx_t_20)) __PYX_ERR(0, 891, __pyx_L1_error) + __pyx_t_6 = __Pyx_PyObject_IsTrue(__pyx_t_20); if (unlikely((__pyx_t_6 < 0))) __PYX_ERR(0, 891, __pyx_L1_error) + __Pyx_DECREF(__pyx_t_20); __pyx_t_20 = 0; + if (__pyx_t_6) { + __pyx_t_20 = __Pyx_PyObject_GetAttrStr(__pyx_v_example, __pyx_mstate_global->__pyx_n_u_x); if (unlikely(!__pyx_t_20)) __PYX_ERR(0, 891, __pyx_L1_error) + __Pyx_GOTREF(__pyx_t_20); + __pyx_t_18 = __Pyx_PyObject_GetItem(__pyx_t_20, __pyx_v_s0); if (unlikely(!__pyx_t_18)) __PYX_ERR(0, 891, __pyx_L1_error) + __Pyx_GOTREF(__pyx_t_18); + __Pyx_DECREF(__pyx_t_20); __pyx_t_20 = 0; + __pyx_t_20 = __Pyx_PyObject_GetAttrStr(__pyx_t_18, __pyx_mstate_global->__pyx_n_u_text); if (unlikely(!__pyx_t_20)) __PYX_ERR(0, 891, __pyx_L1_error) + __Pyx_GOTREF(__pyx_t_20); + __Pyx_DECREF(__pyx_t_18); __pyx_t_18 = 0; + __pyx_t_1 = __pyx_t_20; + __pyx_t_20 = 0; + } else { + __Pyx_INCREF(__pyx_mstate_global->__pyx_kp_u__7); + __pyx_t_1 = __pyx_mstate_global->__pyx_kp_u__7; + } + + /* "spacy/pipeline/_parser_internals/arc_eager.pyx":892 + * "?", + * "S0=", (example.x[s0].text if s0 >= 0 else "-"), + * "B0=", (example.x[b0].text if b0 >= 0 else "-"), # <<<<<<<<<<<<<< + * "S0 head?", str(state.has_head(state.S(0))), + * ))) +*/ + __pyx_t_18 = PyObject_RichCompare(__pyx_v_b0, __pyx_mstate_global->__pyx_int_0, Py_GE); __Pyx_XGOTREF(__pyx_t_18); if (unlikely(!__pyx_t_18)) __PYX_ERR(0, 892, __pyx_L1_error) + __pyx_t_6 = __Pyx_PyObject_IsTrue(__pyx_t_18); if (unlikely((__pyx_t_6 < 0))) __PYX_ERR(0, 892, __pyx_L1_error) + __Pyx_DECREF(__pyx_t_18); __pyx_t_18 = 0; + if (__pyx_t_6) { + __pyx_t_18 = __Pyx_PyObject_GetAttrStr(__pyx_v_example, __pyx_mstate_global->__pyx_n_u_x); if (unlikely(!__pyx_t_18)) __PYX_ERR(0, 892, __pyx_L1_error) + __Pyx_GOTREF(__pyx_t_18); + __pyx_t_19 = __Pyx_PyObject_GetItem(__pyx_t_18, __pyx_v_b0); if (unlikely(!__pyx_t_19)) __PYX_ERR(0, 892, __pyx_L1_error) + __Pyx_GOTREF(__pyx_t_19); + __Pyx_DECREF(__pyx_t_18); __pyx_t_18 = 0; + __pyx_t_18 = __Pyx_PyObject_GetAttrStr(__pyx_t_19, __pyx_mstate_global->__pyx_n_u_text); if (unlikely(!__pyx_t_18)) __PYX_ERR(0, 892, __pyx_L1_error) + __Pyx_GOTREF(__pyx_t_18); + __Pyx_DECREF(__pyx_t_19); __pyx_t_19 = 0; + __pyx_t_20 = __pyx_t_18; + __pyx_t_18 = 0; + } else { + __Pyx_INCREF(__pyx_mstate_global->__pyx_kp_u__7); + __pyx_t_20 = __pyx_mstate_global->__pyx_kp_u__7; + } + + /* "spacy/pipeline/_parser_internals/arc_eager.pyx":893 + * "S0=", (example.x[s0].text if s0 >= 0 else "-"), + * "B0=", (example.x[b0].text if b0 >= 0 else "-"), + * "S0 head?", str(state.has_head(state.S(0))), # <<<<<<<<<<<<<< + * ))) + * s0 = state.S(0) +*/ + __pyx_t_19 = ((PyObject *)__pyx_v_state); + __Pyx_INCREF(__pyx_t_19); + __pyx_t_2 = ((PyObject *)__pyx_v_state); + __Pyx_INCREF(__pyx_t_2); + __pyx_t_3 = 0; + { + PyObject *__pyx_callargs[2] = {__pyx_t_2, __pyx_mstate_global->__pyx_int_0}; + __pyx_t_11 = __Pyx_PyObject_FastCallMethod((PyObject*)__pyx_mstate_global->__pyx_n_u_S, __pyx_callargs+__pyx_t_3, (2-__pyx_t_3) | (1*__Pyx_PY_VECTORCALL_ARGUMENTS_OFFSET)); + __Pyx_XDECREF(__pyx_t_2); __pyx_t_2 = 0; + if (unlikely(!__pyx_t_11)) __PYX_ERR(0, 893, __pyx_L1_error) + __Pyx_GOTREF(__pyx_t_11); + } + __pyx_t_3 = 0; + { + PyObject *__pyx_callargs[2] = {__pyx_t_19, __pyx_t_11}; + __pyx_t_18 = __Pyx_PyObject_FastCallMethod((PyObject*)__pyx_mstate_global->__pyx_n_u_has_head, __pyx_callargs+__pyx_t_3, (2-__pyx_t_3) | (1*__Pyx_PY_VECTORCALL_ARGUMENTS_OFFSET)); + __Pyx_XDECREF(__pyx_t_19); __pyx_t_19 = 0; + __Pyx_DECREF(__pyx_t_11); __pyx_t_11 = 0; + if (unlikely(!__pyx_t_18)) __PYX_ERR(0, 893, __pyx_L1_error) + __Pyx_GOTREF(__pyx_t_18); + } + __pyx_t_11 = __Pyx_PyObject_Unicode(__pyx_t_18); if (unlikely(!__pyx_t_11)) __PYX_ERR(0, 893, __pyx_L1_error) + __Pyx_GOTREF(__pyx_t_11); + __Pyx_DECREF(__pyx_t_18); __pyx_t_18 = 0; + + /* "spacy/pipeline/_parser_internals/arc_eager.pyx":890 + * b0 = state.B(0) + * debug_log.append(" ".join(( + * "?", # <<<<<<<<<<<<<< + * "S0=", (example.x[s0].text if s0 >= 0 else "-"), + * "B0=", (example.x[b0].text if b0 >= 0 else "-"), +*/ + __pyx_t_18 = PyTuple_New(7); if (unlikely(!__pyx_t_18)) __PYX_ERR(0, 890, __pyx_L1_error) + __Pyx_GOTREF(__pyx_t_18); + __Pyx_INCREF(__pyx_mstate_global->__pyx_kp_u__10); + __Pyx_GIVEREF(__pyx_mstate_global->__pyx_kp_u__10); + if (__Pyx_PyTuple_SET_ITEM(__pyx_t_18, 0, __pyx_mstate_global->__pyx_kp_u__10) != (0)) __PYX_ERR(0, 890, __pyx_L1_error); + __Pyx_INCREF(__pyx_mstate_global->__pyx_kp_u_S0); + __Pyx_GIVEREF(__pyx_mstate_global->__pyx_kp_u_S0); + if (__Pyx_PyTuple_SET_ITEM(__pyx_t_18, 1, __pyx_mstate_global->__pyx_kp_u_S0) != (0)) __PYX_ERR(0, 890, __pyx_L1_error); + __Pyx_GIVEREF(__pyx_t_1); + if (__Pyx_PyTuple_SET_ITEM(__pyx_t_18, 2, __pyx_t_1) != (0)) __PYX_ERR(0, 890, __pyx_L1_error); + __Pyx_INCREF(__pyx_mstate_global->__pyx_kp_u_B0); + __Pyx_GIVEREF(__pyx_mstate_global->__pyx_kp_u_B0); + if (__Pyx_PyTuple_SET_ITEM(__pyx_t_18, 3, __pyx_mstate_global->__pyx_kp_u_B0) != (0)) __PYX_ERR(0, 890, __pyx_L1_error); + __Pyx_GIVEREF(__pyx_t_20); + if (__Pyx_PyTuple_SET_ITEM(__pyx_t_18, 4, __pyx_t_20) != (0)) __PYX_ERR(0, 890, __pyx_L1_error); + __Pyx_INCREF(__pyx_mstate_global->__pyx_kp_u_S0_head); + __Pyx_GIVEREF(__pyx_mstate_global->__pyx_kp_u_S0_head); + if (__Pyx_PyTuple_SET_ITEM(__pyx_t_18, 5, __pyx_mstate_global->__pyx_kp_u_S0_head) != (0)) __PYX_ERR(0, 890, __pyx_L1_error); + __Pyx_GIVEREF(__pyx_t_11); + if (__Pyx_PyTuple_SET_ITEM(__pyx_t_18, 6, __pyx_t_11) != (0)) __PYX_ERR(0, 890, __pyx_L1_error); + __pyx_t_1 = 0; + __pyx_t_20 = 0; + __pyx_t_11 = 0; + + /* "spacy/pipeline/_parser_internals/arc_eager.pyx":889 + * s0 = state.S(0) + * b0 = state.B(0) + * debug_log.append(" ".join(( # <<<<<<<<<<<<<< + * "?", + * "S0=", (example.x[s0].text if s0 >= 0 else "-"), +*/ + __pyx_t_11 = PyUnicode_Join(__pyx_mstate_global->__pyx_kp_u__8, __pyx_t_18); if (unlikely(!__pyx_t_11)) __PYX_ERR(0, 889, __pyx_L1_error) + __Pyx_GOTREF(__pyx_t_11); + __Pyx_DECREF(__pyx_t_18); __pyx_t_18 = 0; + __pyx_t_14 = __Pyx_PyList_Append(__pyx_v_debug_log, __pyx_t_11); if (unlikely(__pyx_t_14 == ((int)-1))) __PYX_ERR(0, 889, __pyx_L1_error) + __Pyx_DECREF(__pyx_t_11); __pyx_t_11 = 0; + + /* "spacy/pipeline/_parser_internals/arc_eager.pyx":895 + * "S0 head?", str(state.has_head(state.S(0))), + * ))) + * s0 = state.S(0) # <<<<<<<<<<<<<< + * b0 = state.B(0) + * print("\n".join(debug_log)) +*/ + __pyx_t_18 = ((PyObject *)__pyx_v_state); + __Pyx_INCREF(__pyx_t_18); + __pyx_t_3 = 0; + { + PyObject *__pyx_callargs[2] = {__pyx_t_18, __pyx_mstate_global->__pyx_int_0}; + __pyx_t_11 = __Pyx_PyObject_FastCallMethod((PyObject*)__pyx_mstate_global->__pyx_n_u_S, __pyx_callargs+__pyx_t_3, (2-__pyx_t_3) | (1*__Pyx_PY_VECTORCALL_ARGUMENTS_OFFSET)); + __Pyx_XDECREF(__pyx_t_18); __pyx_t_18 = 0; + if (unlikely(!__pyx_t_11)) __PYX_ERR(0, 895, __pyx_L1_error) + __Pyx_GOTREF(__pyx_t_11); + } + __Pyx_DECREF_SET(__pyx_v_s0, __pyx_t_11); + __pyx_t_11 = 0; + + /* "spacy/pipeline/_parser_internals/arc_eager.pyx":896 + * ))) + * s0 = state.S(0) + * b0 = state.B(0) # <<<<<<<<<<<<<< + * print("\n".join(debug_log)) + * print("Arc is gold B0, S0?", arc_is_gold(&gold.c, b0, s0)) +*/ + __pyx_t_18 = ((PyObject *)__pyx_v_state); + __Pyx_INCREF(__pyx_t_18); + __pyx_t_3 = 0; + { + PyObject *__pyx_callargs[2] = {__pyx_t_18, __pyx_mstate_global->__pyx_int_0}; + __pyx_t_11 = __Pyx_PyObject_FastCallMethod((PyObject*)__pyx_mstate_global->__pyx_n_u_B, __pyx_callargs+__pyx_t_3, (2-__pyx_t_3) | (1*__Pyx_PY_VECTORCALL_ARGUMENTS_OFFSET)); + __Pyx_XDECREF(__pyx_t_18); __pyx_t_18 = 0; + if (unlikely(!__pyx_t_11)) __PYX_ERR(0, 896, __pyx_L1_error) + __Pyx_GOTREF(__pyx_t_11); + } + __Pyx_DECREF_SET(__pyx_v_b0, __pyx_t_11); + __pyx_t_11 = 0; + + /* "spacy/pipeline/_parser_internals/arc_eager.pyx":897 + * s0 = state.S(0) + * b0 = state.B(0) + * print("\n".join(debug_log)) # <<<<<<<<<<<<<< + * print("Arc is gold B0, S0?", arc_is_gold(&gold.c, b0, s0)) + * print("Arc is gold S0, B0?", arc_is_gold(&gold.c, s0, b0)) +*/ + __pyx_t_11 = PyUnicode_Join(__pyx_mstate_global->__pyx_kp_u__11, __pyx_v_debug_log); if (unlikely(!__pyx_t_11)) __PYX_ERR(0, 897, __pyx_L1_error) + __Pyx_GOTREF(__pyx_t_11); + if (__Pyx_PrintOne(0, __pyx_t_11) < 0) __PYX_ERR(0, 897, __pyx_L1_error) + __Pyx_DECREF(__pyx_t_11); __pyx_t_11 = 0; + + /* "spacy/pipeline/_parser_internals/arc_eager.pyx":898 + * b0 = state.B(0) + * print("\n".join(debug_log)) + * print("Arc is gold B0, S0?", arc_is_gold(&gold.c, b0, s0)) # <<<<<<<<<<<<<< + * print("Arc is gold S0, B0?", arc_is_gold(&gold.c, s0, b0)) + * print("is_head_unknown(s0)", is_head_unknown(&gold.c, s0)) +*/ + __pyx_t_10 = __Pyx_PyLong_As_int(__pyx_v_b0); if (unlikely((__pyx_t_10 == (int)-1) && PyErr_Occurred())) __PYX_ERR(0, 898, __pyx_L1_error) + __pyx_t_12 = __Pyx_PyLong_As_int(__pyx_v_s0); if (unlikely((__pyx_t_12 == (int)-1) && PyErr_Occurred())) __PYX_ERR(0, 898, __pyx_L1_error) + __pyx_t_11 = __Pyx_PyBool_FromLong(__pyx_f_5spacy_8pipeline_17_parser_internals_9arc_eager_arc_is_gold((&__pyx_v_gold->c), __pyx_t_10, __pyx_t_12)); if (unlikely(!__pyx_t_11)) __PYX_ERR(0, 898, __pyx_L1_error) + __Pyx_GOTREF(__pyx_t_11); + __pyx_t_18 = PyTuple_New(2); if (unlikely(!__pyx_t_18)) __PYX_ERR(0, 898, __pyx_L1_error) + __Pyx_GOTREF(__pyx_t_18); + __Pyx_INCREF(__pyx_mstate_global->__pyx_kp_u_Arc_is_gold_B0_S0); + __Pyx_GIVEREF(__pyx_mstate_global->__pyx_kp_u_Arc_is_gold_B0_S0); + if (__Pyx_PyTuple_SET_ITEM(__pyx_t_18, 0, __pyx_mstate_global->__pyx_kp_u_Arc_is_gold_B0_S0) != (0)) __PYX_ERR(0, 898, __pyx_L1_error); + __Pyx_GIVEREF(__pyx_t_11); + if (__Pyx_PyTuple_SET_ITEM(__pyx_t_18, 1, __pyx_t_11) != (0)) __PYX_ERR(0, 898, __pyx_L1_error); + __pyx_t_11 = 0; + if (__Pyx_PrintOne(0, __pyx_t_18) < 0) __PYX_ERR(0, 898, __pyx_L1_error) + __Pyx_DECREF(__pyx_t_18); __pyx_t_18 = 0; + + /* "spacy/pipeline/_parser_internals/arc_eager.pyx":899 + * print("\n".join(debug_log)) + * print("Arc is gold B0, S0?", arc_is_gold(&gold.c, b0, s0)) + * print("Arc is gold S0, B0?", arc_is_gold(&gold.c, s0, b0)) # <<<<<<<<<<<<<< + * print("is_head_unknown(s0)", is_head_unknown(&gold.c, s0)) + * print("is_head_unknown(b0)", is_head_unknown(&gold.c, b0)) +*/ + __pyx_t_12 = __Pyx_PyLong_As_int(__pyx_v_s0); if (unlikely((__pyx_t_12 == (int)-1) && PyErr_Occurred())) __PYX_ERR(0, 899, __pyx_L1_error) + __pyx_t_10 = __Pyx_PyLong_As_int(__pyx_v_b0); if (unlikely((__pyx_t_10 == (int)-1) && PyErr_Occurred())) __PYX_ERR(0, 899, __pyx_L1_error) + __pyx_t_18 = __Pyx_PyBool_FromLong(__pyx_f_5spacy_8pipeline_17_parser_internals_9arc_eager_arc_is_gold((&__pyx_v_gold->c), __pyx_t_12, __pyx_t_10)); if (unlikely(!__pyx_t_18)) __PYX_ERR(0, 899, __pyx_L1_error) + __Pyx_GOTREF(__pyx_t_18); + __pyx_t_11 = PyTuple_New(2); if (unlikely(!__pyx_t_11)) __PYX_ERR(0, 899, __pyx_L1_error) + __Pyx_GOTREF(__pyx_t_11); + __Pyx_INCREF(__pyx_mstate_global->__pyx_kp_u_Arc_is_gold_S0_B0); + __Pyx_GIVEREF(__pyx_mstate_global->__pyx_kp_u_Arc_is_gold_S0_B0); + if (__Pyx_PyTuple_SET_ITEM(__pyx_t_11, 0, __pyx_mstate_global->__pyx_kp_u_Arc_is_gold_S0_B0) != (0)) __PYX_ERR(0, 899, __pyx_L1_error); + __Pyx_GIVEREF(__pyx_t_18); + if (__Pyx_PyTuple_SET_ITEM(__pyx_t_11, 1, __pyx_t_18) != (0)) __PYX_ERR(0, 899, __pyx_L1_error); + __pyx_t_18 = 0; + if (__Pyx_PrintOne(0, __pyx_t_11) < 0) __PYX_ERR(0, 899, __pyx_L1_error) + __Pyx_DECREF(__pyx_t_11); __pyx_t_11 = 0; + + /* "spacy/pipeline/_parser_internals/arc_eager.pyx":900 + * print("Arc is gold B0, S0?", arc_is_gold(&gold.c, b0, s0)) + * print("Arc is gold S0, B0?", arc_is_gold(&gold.c, s0, b0)) + * print("is_head_unknown(s0)", is_head_unknown(&gold.c, s0)) # <<<<<<<<<<<<<< + * print("is_head_unknown(b0)", is_head_unknown(&gold.c, b0)) + * print("b0", b0, "gold.heads[s0]", gold.c.heads[s0]) +*/ + __pyx_t_10 = __Pyx_PyLong_As_int(__pyx_v_s0); if (unlikely((__pyx_t_10 == (int)-1) && PyErr_Occurred())) __PYX_ERR(0, 900, __pyx_L1_error) + __pyx_t_11 = __Pyx_PyLong_From_int(__pyx_f_5spacy_8pipeline_17_parser_internals_9arc_eager_is_head_unknown((&__pyx_v_gold->c), __pyx_t_10)); if (unlikely(!__pyx_t_11)) __PYX_ERR(0, 900, __pyx_L1_error) + __Pyx_GOTREF(__pyx_t_11); + __pyx_t_18 = PyTuple_New(2); if (unlikely(!__pyx_t_18)) __PYX_ERR(0, 900, __pyx_L1_error) + __Pyx_GOTREF(__pyx_t_18); + __Pyx_INCREF(__pyx_mstate_global->__pyx_kp_u_is_head_unknown_s0); + __Pyx_GIVEREF(__pyx_mstate_global->__pyx_kp_u_is_head_unknown_s0); + if (__Pyx_PyTuple_SET_ITEM(__pyx_t_18, 0, __pyx_mstate_global->__pyx_kp_u_is_head_unknown_s0) != (0)) __PYX_ERR(0, 900, __pyx_L1_error); + __Pyx_GIVEREF(__pyx_t_11); + if (__Pyx_PyTuple_SET_ITEM(__pyx_t_18, 1, __pyx_t_11) != (0)) __PYX_ERR(0, 900, __pyx_L1_error); + __pyx_t_11 = 0; + if (__Pyx_PrintOne(0, __pyx_t_18) < 0) __PYX_ERR(0, 900, __pyx_L1_error) + __Pyx_DECREF(__pyx_t_18); __pyx_t_18 = 0; + + /* "spacy/pipeline/_parser_internals/arc_eager.pyx":901 + * print("Arc is gold S0, B0?", arc_is_gold(&gold.c, s0, b0)) + * print("is_head_unknown(s0)", is_head_unknown(&gold.c, s0)) + * print("is_head_unknown(b0)", is_head_unknown(&gold.c, b0)) # <<<<<<<<<<<<<< + * print("b0", b0, "gold.heads[s0]", gold.c.heads[s0]) + * print("Stack", [example.x[i] for i in state.stack]) +*/ + __pyx_t_10 = __Pyx_PyLong_As_int(__pyx_v_b0); if (unlikely((__pyx_t_10 == (int)-1) && PyErr_Occurred())) __PYX_ERR(0, 901, __pyx_L1_error) + __pyx_t_18 = __Pyx_PyLong_From_int(__pyx_f_5spacy_8pipeline_17_parser_internals_9arc_eager_is_head_unknown((&__pyx_v_gold->c), __pyx_t_10)); if (unlikely(!__pyx_t_18)) __PYX_ERR(0, 901, __pyx_L1_error) + __Pyx_GOTREF(__pyx_t_18); + __pyx_t_11 = PyTuple_New(2); if (unlikely(!__pyx_t_11)) __PYX_ERR(0, 901, __pyx_L1_error) + __Pyx_GOTREF(__pyx_t_11); + __Pyx_INCREF(__pyx_mstate_global->__pyx_kp_u_is_head_unknown_b0); + __Pyx_GIVEREF(__pyx_mstate_global->__pyx_kp_u_is_head_unknown_b0); + if (__Pyx_PyTuple_SET_ITEM(__pyx_t_11, 0, __pyx_mstate_global->__pyx_kp_u_is_head_unknown_b0) != (0)) __PYX_ERR(0, 901, __pyx_L1_error); + __Pyx_GIVEREF(__pyx_t_18); + if (__Pyx_PyTuple_SET_ITEM(__pyx_t_11, 1, __pyx_t_18) != (0)) __PYX_ERR(0, 901, __pyx_L1_error); + __pyx_t_18 = 0; + if (__Pyx_PrintOne(0, __pyx_t_11) < 0) __PYX_ERR(0, 901, __pyx_L1_error) + __Pyx_DECREF(__pyx_t_11); __pyx_t_11 = 0; + + /* "spacy/pipeline/_parser_internals/arc_eager.pyx":902 + * print("is_head_unknown(s0)", is_head_unknown(&gold.c, s0)) + * print("is_head_unknown(b0)", is_head_unknown(&gold.c, b0)) + * print("b0", b0, "gold.heads[s0]", gold.c.heads[s0]) # <<<<<<<<<<<<<< + * print("Stack", [example.x[i] for i in state.stack]) + * print("Buffer", [example.x[i] for i in state.queue]) +*/ + __pyx_t_16 = __Pyx_PyIndex_AsSsize_t(__pyx_v_s0); if (unlikely((__pyx_t_16 == (Py_ssize_t)-1) && PyErr_Occurred())) __PYX_ERR(0, 902, __pyx_L1_error) + __pyx_t_11 = __Pyx_PyLong_From_int32_t((__pyx_v_gold->c.heads[__pyx_t_16])); if (unlikely(!__pyx_t_11)) __PYX_ERR(0, 902, __pyx_L1_error) + __Pyx_GOTREF(__pyx_t_11); + __pyx_t_18 = PyTuple_New(4); if (unlikely(!__pyx_t_18)) __PYX_ERR(0, 902, __pyx_L1_error) + __Pyx_GOTREF(__pyx_t_18); + __Pyx_INCREF(__pyx_mstate_global->__pyx_n_u_b0); + __Pyx_GIVEREF(__pyx_mstate_global->__pyx_n_u_b0); + if (__Pyx_PyTuple_SET_ITEM(__pyx_t_18, 0, __pyx_mstate_global->__pyx_n_u_b0) != (0)) __PYX_ERR(0, 902, __pyx_L1_error); + __Pyx_INCREF(__pyx_v_b0); + __Pyx_GIVEREF(__pyx_v_b0); + if (__Pyx_PyTuple_SET_ITEM(__pyx_t_18, 1, __pyx_v_b0) != (0)) __PYX_ERR(0, 902, __pyx_L1_error); + __Pyx_INCREF(__pyx_mstate_global->__pyx_kp_u_gold_heads_s0); + __Pyx_GIVEREF(__pyx_mstate_global->__pyx_kp_u_gold_heads_s0); + if (__Pyx_PyTuple_SET_ITEM(__pyx_t_18, 2, __pyx_mstate_global->__pyx_kp_u_gold_heads_s0) != (0)) __PYX_ERR(0, 902, __pyx_L1_error); + __Pyx_GIVEREF(__pyx_t_11); + if (__Pyx_PyTuple_SET_ITEM(__pyx_t_18, 3, __pyx_t_11) != (0)) __PYX_ERR(0, 902, __pyx_L1_error); + __pyx_t_11 = 0; + if (__Pyx_PrintOne(0, __pyx_t_18) < 0) __PYX_ERR(0, 902, __pyx_L1_error) + __Pyx_DECREF(__pyx_t_18); __pyx_t_18 = 0; + + /* "spacy/pipeline/_parser_internals/arc_eager.pyx":903 + * print("is_head_unknown(b0)", is_head_unknown(&gold.c, b0)) + * print("b0", b0, "gold.heads[s0]", gold.c.heads[s0]) + * print("Stack", [example.x[i] for i in state.stack]) # <<<<<<<<<<<<<< + * print("Buffer", [example.x[i] for i in state.queue]) + * raise ValueError(Errors.E024) +*/ + __pyx_t_18 = PyList_New(0); if (unlikely(!__pyx_t_18)) __PYX_ERR(0, 903, __pyx_L1_error) + __Pyx_GOTREF(__pyx_t_18); + __pyx_t_11 = __Pyx_PyObject_GetAttrStr(((PyObject *)__pyx_v_state), __pyx_mstate_global->__pyx_n_u_stack); if (unlikely(!__pyx_t_11)) __PYX_ERR(0, 903, __pyx_L1_error) + __Pyx_GOTREF(__pyx_t_11); + if (likely(PyList_CheckExact(__pyx_t_11)) || PyTuple_CheckExact(__pyx_t_11)) { + __pyx_t_20 = __pyx_t_11; __Pyx_INCREF(__pyx_t_20); + __pyx_t_16 = 0; + __pyx_t_17 = NULL; + } else { + __pyx_t_16 = -1; __pyx_t_20 = PyObject_GetIter(__pyx_t_11); if (unlikely(!__pyx_t_20)) __PYX_ERR(0, 903, __pyx_L1_error) + __Pyx_GOTREF(__pyx_t_20); + __pyx_t_17 = (CYTHON_COMPILING_IN_LIMITED_API) ? PyIter_Next : __Pyx_PyObject_GetIterNextFunc(__pyx_t_20); if (unlikely(!__pyx_t_17)) __PYX_ERR(0, 903, __pyx_L1_error) + } + __Pyx_DECREF(__pyx_t_11); __pyx_t_11 = 0; + for (;;) { + if (likely(!__pyx_t_17)) { + if (likely(PyList_CheckExact(__pyx_t_20))) { + { + Py_ssize_t __pyx_temp = __Pyx_PyList_GET_SIZE(__pyx_t_20); + #if !CYTHON_ASSUME_SAFE_SIZE + if (unlikely((__pyx_temp < 0))) __PYX_ERR(0, 903, __pyx_L1_error) + #endif + if (__pyx_t_16 >= __pyx_temp) break; + } + __pyx_t_11 = __Pyx_PyList_GetItemRefFast(__pyx_t_20, __pyx_t_16, __Pyx_ReferenceSharing_OwnStrongReference); + ++__pyx_t_16; + } else { + { + Py_ssize_t __pyx_temp = __Pyx_PyTuple_GET_SIZE(__pyx_t_20); + #if !CYTHON_ASSUME_SAFE_SIZE + if (unlikely((__pyx_temp < 0))) __PYX_ERR(0, 903, __pyx_L1_error) + #endif + if (__pyx_t_16 >= __pyx_temp) break; + } + #if CYTHON_ASSUME_SAFE_MACROS && !CYTHON_AVOID_BORROWED_REFS + __pyx_t_11 = __Pyx_NewRef(PyTuple_GET_ITEM(__pyx_t_20, __pyx_t_16)); + #else + __pyx_t_11 = __Pyx_PySequence_ITEM(__pyx_t_20, __pyx_t_16); + #endif + ++__pyx_t_16; + } + if (unlikely(!__pyx_t_11)) __PYX_ERR(0, 903, __pyx_L1_error) + } else { + __pyx_t_11 = __pyx_t_17(__pyx_t_20); + if (unlikely(!__pyx_t_11)) { + PyObject* exc_type = PyErr_Occurred(); + if (exc_type) { + if (unlikely(!__Pyx_PyErr_GivenExceptionMatches(exc_type, PyExc_StopIteration))) __PYX_ERR(0, 903, __pyx_L1_error) + PyErr_Clear(); + } + break; + } + } + __Pyx_GOTREF(__pyx_t_11); + __pyx_t_10 = __Pyx_PyLong_As_int(__pyx_t_11); if (unlikely((__pyx_t_10 == (int)-1) && PyErr_Occurred())) __PYX_ERR(0, 903, __pyx_L1_error) + __Pyx_DECREF(__pyx_t_11); __pyx_t_11 = 0; + __pyx_v_i = __pyx_t_10; + __pyx_t_11 = __Pyx_PyObject_GetAttrStr(__pyx_v_example, __pyx_mstate_global->__pyx_n_u_x); if (unlikely(!__pyx_t_11)) __PYX_ERR(0, 903, __pyx_L1_error) + __Pyx_GOTREF(__pyx_t_11); + __pyx_t_1 = __Pyx_GetItemInt(__pyx_t_11, __pyx_v_i, int, 1, __Pyx_PyLong_From_int, 0, 1, 1, 1, __Pyx_ReferenceSharing_OwnStrongReference); if (unlikely(!__pyx_t_1)) __PYX_ERR(0, 903, __pyx_L1_error) + __Pyx_GOTREF(__pyx_t_1); + __Pyx_DECREF(__pyx_t_11); __pyx_t_11 = 0; + if (unlikely(__Pyx_ListComp_Append(__pyx_t_18, (PyObject*)__pyx_t_1))) __PYX_ERR(0, 903, __pyx_L1_error) + __Pyx_DECREF(__pyx_t_1); __pyx_t_1 = 0; + } + __Pyx_DECREF(__pyx_t_20); __pyx_t_20 = 0; + __pyx_t_20 = PyTuple_New(2); if (unlikely(!__pyx_t_20)) __PYX_ERR(0, 903, __pyx_L1_error) + __Pyx_GOTREF(__pyx_t_20); + __Pyx_INCREF(__pyx_mstate_global->__pyx_n_u_Stack); + __Pyx_GIVEREF(__pyx_mstate_global->__pyx_n_u_Stack); + if (__Pyx_PyTuple_SET_ITEM(__pyx_t_20, 0, __pyx_mstate_global->__pyx_n_u_Stack) != (0)) __PYX_ERR(0, 903, __pyx_L1_error); + __Pyx_GIVEREF(__pyx_t_18); + if (__Pyx_PyTuple_SET_ITEM(__pyx_t_20, 1, __pyx_t_18) != (0)) __PYX_ERR(0, 903, __pyx_L1_error); + __pyx_t_18 = 0; + if (__Pyx_PrintOne(0, __pyx_t_20) < 0) __PYX_ERR(0, 903, __pyx_L1_error) + __Pyx_DECREF(__pyx_t_20); __pyx_t_20 = 0; + + /* "spacy/pipeline/_parser_internals/arc_eager.pyx":904 + * print("b0", b0, "gold.heads[s0]", gold.c.heads[s0]) + * print("Stack", [example.x[i] for i in state.stack]) + * print("Buffer", [example.x[i] for i in state.queue]) # <<<<<<<<<<<<<< + * raise ValueError(Errors.E024) + * return history +*/ + __pyx_t_20 = PyList_New(0); if (unlikely(!__pyx_t_20)) __PYX_ERR(0, 904, __pyx_L1_error) + __Pyx_GOTREF(__pyx_t_20); + __pyx_t_18 = __Pyx_PyObject_GetAttrStr(((PyObject *)__pyx_v_state), __pyx_mstate_global->__pyx_n_u_queue); if (unlikely(!__pyx_t_18)) __PYX_ERR(0, 904, __pyx_L1_error) + __Pyx_GOTREF(__pyx_t_18); + if (likely(PyList_CheckExact(__pyx_t_18)) || PyTuple_CheckExact(__pyx_t_18)) { + __pyx_t_1 = __pyx_t_18; __Pyx_INCREF(__pyx_t_1); + __pyx_t_16 = 0; + __pyx_t_17 = NULL; + } else { + __pyx_t_16 = -1; __pyx_t_1 = PyObject_GetIter(__pyx_t_18); if (unlikely(!__pyx_t_1)) __PYX_ERR(0, 904, __pyx_L1_error) + __Pyx_GOTREF(__pyx_t_1); + __pyx_t_17 = (CYTHON_COMPILING_IN_LIMITED_API) ? PyIter_Next : __Pyx_PyObject_GetIterNextFunc(__pyx_t_1); if (unlikely(!__pyx_t_17)) __PYX_ERR(0, 904, __pyx_L1_error) + } + __Pyx_DECREF(__pyx_t_18); __pyx_t_18 = 0; + for (;;) { + if (likely(!__pyx_t_17)) { + if (likely(PyList_CheckExact(__pyx_t_1))) { + { + Py_ssize_t __pyx_temp = __Pyx_PyList_GET_SIZE(__pyx_t_1); + #if !CYTHON_ASSUME_SAFE_SIZE + if (unlikely((__pyx_temp < 0))) __PYX_ERR(0, 904, __pyx_L1_error) + #endif + if (__pyx_t_16 >= __pyx_temp) break; + } + __pyx_t_18 = __Pyx_PyList_GetItemRefFast(__pyx_t_1, __pyx_t_16, __Pyx_ReferenceSharing_OwnStrongReference); + ++__pyx_t_16; + } else { + { + Py_ssize_t __pyx_temp = __Pyx_PyTuple_GET_SIZE(__pyx_t_1); + #if !CYTHON_ASSUME_SAFE_SIZE + if (unlikely((__pyx_temp < 0))) __PYX_ERR(0, 904, __pyx_L1_error) + #endif + if (__pyx_t_16 >= __pyx_temp) break; + } + #if CYTHON_ASSUME_SAFE_MACROS && !CYTHON_AVOID_BORROWED_REFS + __pyx_t_18 = __Pyx_NewRef(PyTuple_GET_ITEM(__pyx_t_1, __pyx_t_16)); + #else + __pyx_t_18 = __Pyx_PySequence_ITEM(__pyx_t_1, __pyx_t_16); + #endif + ++__pyx_t_16; + } + if (unlikely(!__pyx_t_18)) __PYX_ERR(0, 904, __pyx_L1_error) + } else { + __pyx_t_18 = __pyx_t_17(__pyx_t_1); + if (unlikely(!__pyx_t_18)) { + PyObject* exc_type = PyErr_Occurred(); + if (exc_type) { + if (unlikely(!__Pyx_PyErr_GivenExceptionMatches(exc_type, PyExc_StopIteration))) __PYX_ERR(0, 904, __pyx_L1_error) + PyErr_Clear(); + } + break; + } + } + __Pyx_GOTREF(__pyx_t_18); + __pyx_t_10 = __Pyx_PyLong_As_int(__pyx_t_18); if (unlikely((__pyx_t_10 == (int)-1) && PyErr_Occurred())) __PYX_ERR(0, 904, __pyx_L1_error) + __Pyx_DECREF(__pyx_t_18); __pyx_t_18 = 0; + __pyx_v_i = __pyx_t_10; + __pyx_t_18 = __Pyx_PyObject_GetAttrStr(__pyx_v_example, __pyx_mstate_global->__pyx_n_u_x); if (unlikely(!__pyx_t_18)) __PYX_ERR(0, 904, __pyx_L1_error) + __Pyx_GOTREF(__pyx_t_18); + __pyx_t_11 = __Pyx_GetItemInt(__pyx_t_18, __pyx_v_i, int, 1, __Pyx_PyLong_From_int, 0, 1, 1, 1, __Pyx_ReferenceSharing_OwnStrongReference); if (unlikely(!__pyx_t_11)) __PYX_ERR(0, 904, __pyx_L1_error) + __Pyx_GOTREF(__pyx_t_11); + __Pyx_DECREF(__pyx_t_18); __pyx_t_18 = 0; + if (unlikely(__Pyx_ListComp_Append(__pyx_t_20, (PyObject*)__pyx_t_11))) __PYX_ERR(0, 904, __pyx_L1_error) + __Pyx_DECREF(__pyx_t_11); __pyx_t_11 = 0; + } + __Pyx_DECREF(__pyx_t_1); __pyx_t_1 = 0; + __pyx_t_1 = PyTuple_New(2); if (unlikely(!__pyx_t_1)) __PYX_ERR(0, 904, __pyx_L1_error) + __Pyx_GOTREF(__pyx_t_1); + __Pyx_INCREF(__pyx_mstate_global->__pyx_n_u_Buffer); + __Pyx_GIVEREF(__pyx_mstate_global->__pyx_n_u_Buffer); + if (__Pyx_PyTuple_SET_ITEM(__pyx_t_1, 0, __pyx_mstate_global->__pyx_n_u_Buffer) != (0)) __PYX_ERR(0, 904, __pyx_L1_error); + __Pyx_GIVEREF(__pyx_t_20); + if (__Pyx_PyTuple_SET_ITEM(__pyx_t_1, 1, __pyx_t_20) != (0)) __PYX_ERR(0, 904, __pyx_L1_error); + __pyx_t_20 = 0; + if (__Pyx_PrintOne(0, __pyx_t_1) < 0) __PYX_ERR(0, 904, __pyx_L1_error) + __Pyx_DECREF(__pyx_t_1); __pyx_t_1 = 0; + + /* "spacy/pipeline/_parser_internals/arc_eager.pyx":905 + * print("Stack", [example.x[i] for i in state.stack]) + * print("Buffer", [example.x[i] for i in state.queue]) + * raise ValueError(Errors.E024) # <<<<<<<<<<<<<< + * return history +*/ + __pyx_t_20 = NULL; + __Pyx_GetModuleGlobalName(__pyx_t_11, __pyx_mstate_global->__pyx_n_u_Errors); if (unlikely(!__pyx_t_11)) __PYX_ERR(0, 905, __pyx_L1_error) + __Pyx_GOTREF(__pyx_t_11); + __pyx_t_18 = __Pyx_PyObject_GetAttrStr(__pyx_t_11, __pyx_mstate_global->__pyx_n_u_E024); if (unlikely(!__pyx_t_18)) __PYX_ERR(0, 905, __pyx_L1_error) + __Pyx_GOTREF(__pyx_t_18); + __Pyx_DECREF(__pyx_t_11); __pyx_t_11 = 0; + __pyx_t_3 = 1; + { + PyObject *__pyx_callargs[2] = {__pyx_t_20, __pyx_t_18}; + __pyx_t_1 = __Pyx_PyObject_FastCall((PyObject*)(((PyTypeObject*)PyExc_ValueError)), __pyx_callargs+__pyx_t_3, (2-__pyx_t_3) | (__pyx_t_3*__Pyx_PY_VECTORCALL_ARGUMENTS_OFFSET)); + __Pyx_XDECREF(__pyx_t_20); __pyx_t_20 = 0; + __Pyx_DECREF(__pyx_t_18); __pyx_t_18 = 0; + if (unlikely(!__pyx_t_1)) __PYX_ERR(0, 905, __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, 905, __pyx_L1_error) + + /* "spacy/pipeline/_parser_internals/arc_eager.pyx":870 + * failed = False + * break + * if failed and _debug not in (False, None): # <<<<<<<<<<<<<< + * example = _debug + * print("Actions") +*/ + } + + /* "spacy/pipeline/_parser_internals/arc_eager.pyx":906 + * print("Buffer", [example.x[i] for i in state.queue]) + * raise ValueError(Errors.E024) + * return history # <<<<<<<<<<<<<< +*/ + __Pyx_XDECREF(__pyx_r); + __Pyx_INCREF(__pyx_v_history); + __pyx_r = __pyx_v_history; + goto __pyx_L0; + + /* "spacy/pipeline/_parser_internals/arc_eager.pyx":835 + * raise ValueError(Errors.E1031) + * + * def get_oracle_sequence_from_state(self, StateClass state, ArcEagerGold gold, _debug=None): # <<<<<<<<<<<<<< + * cdef int i + * cdef Pool mem = Pool() +*/ + + /* function exit code */ + __pyx_L1_error:; + __Pyx_XDECREF(__pyx_t_1); + __Pyx_XDECREF(__pyx_t_2); + __Pyx_XDECREF(__pyx_t_11); + __Pyx_XDECREF(__pyx_t_18); + __Pyx_XDECREF(__pyx_t_19); + __Pyx_XDECREF(__pyx_t_20); + __Pyx_AddTraceback("spacy.pipeline._parser_internals.arc_eager.ArcEager.get_oracle_sequence_from_state", __pyx_clineno, __pyx_lineno, __pyx_filename); + __pyx_r = NULL; + __pyx_L0:; + __Pyx_XDECREF((PyObject *)__pyx_v_mem); + __Pyx_XDECREF(__pyx_v_history); + __Pyx_XDECREF(__pyx_v_debug_log); + __Pyx_XDECREF(__pyx_v_min_cost); + __Pyx_XDECREF(__pyx_v_s0); + __Pyx_XDECREF(__pyx_v_b0); + __Pyx_XDECREF(__pyx_v_example); + __Pyx_XDECREF(__pyx_v_token); + __Pyx_XDECREF(__pyx_v_aligned_heads); + __Pyx_XDECREF(__pyx_v__aligned_labels); + __Pyx_XDECREF(__pyx_v_head); + __Pyx_XDECREF(__pyx_gb_5spacy_8pipeline_17_parser_internals_9arc_eager_8ArcEager_30get_oracle_sequence_from_state_2generator1); + __Pyx_XDECREF(__pyx_v_w); + __Pyx_DECREF((PyObject *)__pyx_cur_scope); + __Pyx_XGIVEREF(__pyx_r); + __Pyx_RefNannyFinishContext(); + return __pyx_r; +} + +/* "(tree fragment)":1 + * def __reduce_cython__(self): # <<<<<<<<<<<<<< + * raise TypeError, "self.c,self.del_beam_state,self.init_beam_state cannot be converted to a Python object for pickling" + * def __setstate_cython__(self, __pyx_state): +*/ + +/* Python wrapper */ +static PyObject *__pyx_pw_5spacy_8pipeline_17_parser_internals_9arc_eager_8ArcEager_31__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_5spacy_8pipeline_17_parser_internals_9arc_eager_8ArcEager_30__reduce_cython__, "ArcEager.__reduce_cython__(self)"); +static PyMethodDef __pyx_mdef_5spacy_8pipeline_17_parser_internals_9arc_eager_8ArcEager_31__reduce_cython__ = {"__reduce_cython__", (PyCFunction)(void(*)(void))(__Pyx_PyCFunction_FastCallWithKeywords)__pyx_pw_5spacy_8pipeline_17_parser_internals_9arc_eager_8ArcEager_31__reduce_cython__, __Pyx_METH_FASTCALL|METH_KEYWORDS, __pyx_doc_5spacy_8pipeline_17_parser_internals_9arc_eager_8ArcEager_30__reduce_cython__}; +static PyObject *__pyx_pw_5spacy_8pipeline_17_parser_internals_9arc_eager_8ArcEager_31__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_5spacy_8pipeline_17_parser_internals_9arc_eager_8ArcEager_30__reduce_cython__(((struct __pyx_obj_5spacy_8pipeline_17_parser_internals_9arc_eager_ArcEager *)__pyx_v_self)); + + /* function exit code */ + __Pyx_RefNannyFinishContext(); + return __pyx_r; +} + +static PyObject *__pyx_pf_5spacy_8pipeline_17_parser_internals_9arc_eager_8ArcEager_30__reduce_cython__(CYTHON_UNUSED struct __pyx_obj_5spacy_8pipeline_17_parser_internals_9arc_eager_ArcEager *__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.c,self.del_beam_state,self.init_beam_state cannot be converted to a Python object for pickling" # <<<<<<<<<<<<<< + * def __setstate_cython__(self, __pyx_state): + * raise TypeError, "self.c,self.del_beam_state,self.init_beam_state cannot be converted to a Python object for pickling" +*/ + __Pyx_Raise(((PyObject *)(((PyTypeObject*)PyExc_TypeError))), __pyx_mstate_global->__pyx_kp_u_self_c_self_del_beam_state_self, 0, 0); + __PYX_ERR(1, 2, __pyx_L1_error) + + /* "(tree fragment)":1 + * def __reduce_cython__(self): # <<<<<<<<<<<<<< + * raise TypeError, "self.c,self.del_beam_state,self.init_beam_state cannot be converted to a Python object for pickling" + * def __setstate_cython__(self, __pyx_state): +*/ + + /* function exit code */ + __pyx_L1_error:; + __Pyx_AddTraceback("spacy.pipeline._parser_internals.arc_eager.ArcEager.__reduce_cython__", __pyx_clineno, __pyx_lineno, __pyx_filename); + __pyx_r = NULL; + __Pyx_XGIVEREF(__pyx_r); + __Pyx_RefNannyFinishContext(); + return __pyx_r; +} + +/* "(tree fragment)":3 + * def __reduce_cython__(self): + * raise TypeError, "self.c,self.del_beam_state,self.init_beam_state cannot be converted to a Python object for pickling" + * def __setstate_cython__(self, __pyx_state): # <<<<<<<<<<<<<< + * raise TypeError, "self.c,self.del_beam_state,self.init_beam_state cannot be converted to a Python object for pickling" +*/ + +/* Python wrapper */ +static PyObject *__pyx_pw_5spacy_8pipeline_17_parser_internals_9arc_eager_8ArcEager_33__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_5spacy_8pipeline_17_parser_internals_9arc_eager_8ArcEager_32__setstate_cython__, "ArcEager.__setstate_cython__(self, __pyx_state)"); +static PyMethodDef __pyx_mdef_5spacy_8pipeline_17_parser_internals_9arc_eager_8ArcEager_33__setstate_cython__ = {"__setstate_cython__", (PyCFunction)(void(*)(void))(__Pyx_PyCFunction_FastCallWithKeywords)__pyx_pw_5spacy_8pipeline_17_parser_internals_9arc_eager_8ArcEager_33__setstate_cython__, __Pyx_METH_FASTCALL|METH_KEYWORDS, __pyx_doc_5spacy_8pipeline_17_parser_internals_9arc_eager_8ArcEager_32__setstate_cython__}; +static PyObject *__pyx_pw_5spacy_8pipeline_17_parser_internals_9arc_eager_8ArcEager_33__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("spacy.pipeline._parser_internals.arc_eager.ArcEager.__setstate_cython__", __pyx_clineno, __pyx_lineno, __pyx_filename); + __Pyx_RefNannyFinishContext(); + return NULL; + __pyx_L4_argument_unpacking_done:; + __pyx_r = __pyx_pf_5spacy_8pipeline_17_parser_internals_9arc_eager_8ArcEager_32__setstate_cython__(((struct __pyx_obj_5spacy_8pipeline_17_parser_internals_9arc_eager_ArcEager *)__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_5spacy_8pipeline_17_parser_internals_9arc_eager_8ArcEager_32__setstate_cython__(CYTHON_UNUSED struct __pyx_obj_5spacy_8pipeline_17_parser_internals_9arc_eager_ArcEager *__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.c,self.del_beam_state,self.init_beam_state cannot be converted to a Python object for pickling" + * def __setstate_cython__(self, __pyx_state): + * raise TypeError, "self.c,self.del_beam_state,self.init_beam_state cannot be converted to a Python object for pickling" # <<<<<<<<<<<<<< +*/ + __Pyx_Raise(((PyObject *)(((PyTypeObject*)PyExc_TypeError))), __pyx_mstate_global->__pyx_kp_u_self_c_self_del_beam_state_self, 0, 0); + __PYX_ERR(1, 4, __pyx_L1_error) + + /* "(tree fragment)":3 + * def __reduce_cython__(self): + * raise TypeError, "self.c,self.del_beam_state,self.init_beam_state cannot be converted to a Python object for pickling" + * def __setstate_cython__(self, __pyx_state): # <<<<<<<<<<<<<< + * raise TypeError, "self.c,self.del_beam_state,self.init_beam_state cannot be converted to a Python object for pickling" +*/ + + /* function exit code */ + __pyx_L1_error:; + __Pyx_AddTraceback("spacy.pipeline._parser_internals.arc_eager.ArcEager.__setstate_cython__", __pyx_clineno, __pyx_lineno, __pyx_filename); + __pyx_r = NULL; + __Pyx_XGIVEREF(__pyx_r); + __Pyx_RefNannyFinishContext(); + return __pyx_r; +} + +/* "(tree fragment)":4 + * int __Pyx_CheckUnpickleChecksum(long, long, long, long, const char*) except -1 + * int __Pyx_UpdateUnpickledDict(object, object, Py_ssize_t) except -1 + * def __pyx_unpickle_Shift(__pyx_type, long __pyx_checksum, tuple __pyx_state): # <<<<<<<<<<<<<< + * cdef object __pyx_result + * __Pyx_CheckUnpickleChecksum(__pyx_checksum, 0xe3b0c44, 0xda39a3e, 0xd41d8cd, b'') +*/ + +/* Python wrapper */ +static PyObject *__pyx_pw_5spacy_8pipeline_17_parser_internals_9arc_eager_3__pyx_unpickle_Shift(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_5spacy_8pipeline_17_parser_internals_9arc_eager_2__pyx_unpickle_Shift, "__pyx_unpickle_Shift(__pyx_type, long __pyx_checksum, tuple __pyx_state)"); +static PyMethodDef __pyx_mdef_5spacy_8pipeline_17_parser_internals_9arc_eager_3__pyx_unpickle_Shift = {"__pyx_unpickle_Shift", (PyCFunction)(void(*)(void))(__Pyx_PyCFunction_FastCallWithKeywords)__pyx_pw_5spacy_8pipeline_17_parser_internals_9arc_eager_3__pyx_unpickle_Shift, __Pyx_METH_FASTCALL|METH_KEYWORDS, __pyx_doc_5spacy_8pipeline_17_parser_internals_9arc_eager_2__pyx_unpickle_Shift}; +static PyObject *__pyx_pw_5spacy_8pipeline_17_parser_internals_9arc_eager_3__pyx_unpickle_Shift(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 +) { + PyObject *__pyx_v___pyx_type = 0; + long __pyx_v___pyx_checksum; + 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[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("__pyx_unpickle_Shift (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_type,&__pyx_mstate_global->__pyx_n_u_pyx_checksum,&__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, 4, __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(1, 4, __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(1, 4, __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(1, 4, __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, "__pyx_unpickle_Shift", 0) < (0)) __PYX_ERR(1, 4, __pyx_L3_error) + for (Py_ssize_t i = __pyx_nargs; i < 3; i++) { + if (unlikely(!values[i])) { __Pyx_RaiseArgtupleInvalid("__pyx_unpickle_Shift", 1, 3, 3, i); __PYX_ERR(1, 4, __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(1, 4, __pyx_L3_error) + values[1] = __Pyx_ArgRef_FASTCALL(__pyx_args, 1); + if (!CYTHON_ASSUME_SAFE_MACROS && unlikely(!values[1])) __PYX_ERR(1, 4, __pyx_L3_error) + values[2] = __Pyx_ArgRef_FASTCALL(__pyx_args, 2); + if (!CYTHON_ASSUME_SAFE_MACROS && unlikely(!values[2])) __PYX_ERR(1, 4, __pyx_L3_error) + } + __pyx_v___pyx_type = values[0]; + __pyx_v___pyx_checksum = __Pyx_PyLong_As_long(values[1]); if (unlikely((__pyx_v___pyx_checksum == (long)-1) && PyErr_Occurred())) __PYX_ERR(1, 4, __pyx_L3_error) + __pyx_v___pyx_state = ((PyObject*)values[2]); + } + goto __pyx_L6_skip; + __pyx_L5_argtuple_error:; + __Pyx_RaiseArgtupleInvalid("__pyx_unpickle_Shift", 1, 3, 3, __pyx_nargs); __PYX_ERR(1, 4, __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("spacy.pipeline._parser_internals.arc_eager.__pyx_unpickle_Shift", __pyx_clineno, __pyx_lineno, __pyx_filename); + __Pyx_RefNannyFinishContext(); + return NULL; + __pyx_L4_argument_unpacking_done:; + if (unlikely(!__Pyx_ArgTypeTest(((PyObject *)__pyx_v___pyx_state), (&PyTuple_Type), 1, "__pyx_state", 1))) __PYX_ERR(1, 4, __pyx_L1_error) + __pyx_r = __pyx_pf_5spacy_8pipeline_17_parser_internals_9arc_eager_2__pyx_unpickle_Shift(__pyx_self, __pyx_v___pyx_type, __pyx_v___pyx_checksum, __pyx_v___pyx_state); + + /* 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_5spacy_8pipeline_17_parser_internals_9arc_eager_2__pyx_unpickle_Shift(CYTHON_UNUSED PyObject *__pyx_self, PyObject *__pyx_v___pyx_type, long __pyx_v___pyx_checksum, PyObject *__pyx_v___pyx_state) { + PyObject *__pyx_v___pyx_result = 0; + 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_t_5; + int __pyx_lineno = 0; + const char *__pyx_filename = NULL; + int __pyx_clineno = 0; + __Pyx_RefNannySetupContext("__pyx_unpickle_Shift", 0); + + /* "(tree fragment)":6 + * def __pyx_unpickle_Shift(__pyx_type, long __pyx_checksum, tuple __pyx_state): + * cdef object __pyx_result + * __Pyx_CheckUnpickleChecksum(__pyx_checksum, 0xe3b0c44, 0xda39a3e, 0xd41d8cd, b'') # <<<<<<<<<<<<<< + * __pyx_result = Shift.__new__(__pyx_type) + * if __pyx_state is not None: +*/ + __pyx_t_1 = __Pyx_CheckUnpickleChecksum(__pyx_v___pyx_checksum, 0xe3b0c44, 0xda39a3e, 0xd41d8cd, ((char const *)"")); if (unlikely(__pyx_t_1 == ((int)-1))) __PYX_ERR(1, 6, __pyx_L1_error) + + /* "(tree fragment)":7 + * cdef object __pyx_result + * __Pyx_CheckUnpickleChecksum(__pyx_checksum, 0xe3b0c44, 0xda39a3e, 0xd41d8cd, b'') + * __pyx_result = Shift.__new__(__pyx_type) # <<<<<<<<<<<<<< + * if __pyx_state is not None: + * __pyx_unpickle_Shift__set_state( __pyx_result, __pyx_state) +*/ + __pyx_t_3 = ((PyObject *)__pyx_mstate_global->__pyx_ptype_5spacy_8pipeline_17_parser_internals_9arc_eager_Shift); + __Pyx_INCREF(__pyx_t_3); + __pyx_t_4 = 0; + { + PyObject *__pyx_callargs[2] = {__pyx_t_3, __pyx_v___pyx_type}; + __pyx_t_2 = __Pyx_PyObject_FastCallMethod((PyObject*)__pyx_mstate_global->__pyx_n_u_new, __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_2)) __PYX_ERR(1, 7, __pyx_L1_error) + __Pyx_GOTREF(__pyx_t_2); + } + __pyx_v___pyx_result = __pyx_t_2; + __pyx_t_2 = 0; + + /* "(tree fragment)":8 + * __Pyx_CheckUnpickleChecksum(__pyx_checksum, 0xe3b0c44, 0xda39a3e, 0xd41d8cd, b'') + * __pyx_result = Shift.__new__(__pyx_type) + * if __pyx_state is not None: # <<<<<<<<<<<<<< + * __pyx_unpickle_Shift__set_state( __pyx_result, __pyx_state) + * return __pyx_result +*/ + __pyx_t_5 = (__pyx_v___pyx_state != ((PyObject*)Py_None)); + if (__pyx_t_5) { + + /* "(tree fragment)":9 + * __pyx_result = Shift.__new__(__pyx_type) + * if __pyx_state is not None: + * __pyx_unpickle_Shift__set_state( __pyx_result, __pyx_state) # <<<<<<<<<<<<<< + * return __pyx_result + * cdef __pyx_unpickle_Shift__set_state(Shift __pyx_result, __pyx_state: tuple): +*/ + __pyx_t_2 = __pyx_f_5spacy_8pipeline_17_parser_internals_9arc_eager___pyx_unpickle_Shift__set_state(((struct __pyx_obj_5spacy_8pipeline_17_parser_internals_9arc_eager_Shift *)__pyx_v___pyx_result), __pyx_v___pyx_state); if (unlikely(!__pyx_t_2)) __PYX_ERR(1, 9, __pyx_L1_error) + __Pyx_GOTREF(__pyx_t_2); + __Pyx_DECREF(__pyx_t_2); __pyx_t_2 = 0; + + /* "(tree fragment)":8 + * __Pyx_CheckUnpickleChecksum(__pyx_checksum, 0xe3b0c44, 0xda39a3e, 0xd41d8cd, b'') + * __pyx_result = Shift.__new__(__pyx_type) + * if __pyx_state is not None: # <<<<<<<<<<<<<< + * __pyx_unpickle_Shift__set_state( __pyx_result, __pyx_state) + * return __pyx_result +*/ + } + + /* "(tree fragment)":10 + * if __pyx_state is not None: + * __pyx_unpickle_Shift__set_state( __pyx_result, __pyx_state) + * return __pyx_result # <<<<<<<<<<<<<< + * cdef __pyx_unpickle_Shift__set_state(Shift __pyx_result, __pyx_state: tuple): + * __Pyx_UpdateUnpickledDict(__pyx_result, __pyx_state, 0) +*/ + __Pyx_XDECREF(__pyx_r); + __Pyx_INCREF(__pyx_v___pyx_result); + __pyx_r = __pyx_v___pyx_result; + goto __pyx_L0; + + /* "(tree fragment)":4 + * int __Pyx_CheckUnpickleChecksum(long, long, long, long, const char*) except -1 + * int __Pyx_UpdateUnpickledDict(object, object, Py_ssize_t) except -1 + * def __pyx_unpickle_Shift(__pyx_type, long __pyx_checksum, tuple __pyx_state): # <<<<<<<<<<<<<< + * cdef object __pyx_result + * __Pyx_CheckUnpickleChecksum(__pyx_checksum, 0xe3b0c44, 0xda39a3e, 0xd41d8cd, b'') +*/ + + /* function exit code */ + __pyx_L1_error:; + __Pyx_XDECREF(__pyx_t_2); + __Pyx_XDECREF(__pyx_t_3); + __Pyx_AddTraceback("spacy.pipeline._parser_internals.arc_eager.__pyx_unpickle_Shift", __pyx_clineno, __pyx_lineno, __pyx_filename); + __pyx_r = NULL; + __pyx_L0:; + __Pyx_XDECREF(__pyx_v___pyx_result); + __Pyx_XGIVEREF(__pyx_r); + __Pyx_RefNannyFinishContext(); + return __pyx_r; +} + +/* "(tree fragment)":11 + * __pyx_unpickle_Shift__set_state( __pyx_result, __pyx_state) + * return __pyx_result + * cdef __pyx_unpickle_Shift__set_state(Shift __pyx_result, __pyx_state: tuple): # <<<<<<<<<<<<<< + * __Pyx_UpdateUnpickledDict(__pyx_result, __pyx_state, 0) +*/ + +static PyObject *__pyx_f_5spacy_8pipeline_17_parser_internals_9arc_eager___pyx_unpickle_Shift__set_state(struct __pyx_obj_5spacy_8pipeline_17_parser_internals_9arc_eager_Shift *__pyx_v___pyx_result, PyObject *__pyx_v___pyx_state) { + PyObject *__pyx_r = NULL; + __Pyx_RefNannyDeclarations + int __pyx_t_1; + int __pyx_lineno = 0; + const char *__pyx_filename = NULL; + int __pyx_clineno = 0; + __Pyx_RefNannySetupContext("__pyx_unpickle_Shift__set_state", 0); + + /* "(tree fragment)":12 + * return __pyx_result + * cdef __pyx_unpickle_Shift__set_state(Shift __pyx_result, __pyx_state: tuple): + * __Pyx_UpdateUnpickledDict(__pyx_result, __pyx_state, 0) # <<<<<<<<<<<<<< +*/ + __pyx_t_1 = __Pyx_UpdateUnpickledDict(((PyObject *)__pyx_v___pyx_result), __pyx_v___pyx_state, 0); if (unlikely(__pyx_t_1 == ((int)-1))) __PYX_ERR(1, 12, __pyx_L1_error) + + /* "(tree fragment)":11 + * __pyx_unpickle_Shift__set_state( __pyx_result, __pyx_state) + * return __pyx_result + * cdef __pyx_unpickle_Shift__set_state(Shift __pyx_result, __pyx_state: tuple): # <<<<<<<<<<<<<< + * __Pyx_UpdateUnpickledDict(__pyx_result, __pyx_state, 0) +*/ + + /* function exit code */ + __pyx_r = Py_None; __Pyx_INCREF(Py_None); + goto __pyx_L0; + __pyx_L1_error:; + __Pyx_AddTraceback("spacy.pipeline._parser_internals.arc_eager.__pyx_unpickle_Shift__set_state", __pyx_clineno, __pyx_lineno, __pyx_filename); + __pyx_r = 0; + __pyx_L0:; + __Pyx_XGIVEREF(__pyx_r); + __Pyx_RefNannyFinishContext(); + return __pyx_r; +} + +/* "(tree fragment)":4 + * int __Pyx_CheckUnpickleChecksum(long, long, long, long, const char*) except -1 + * int __Pyx_UpdateUnpickledDict(object, object, Py_ssize_t) except -1 + * def __pyx_unpickle_Reduce(__pyx_type, long __pyx_checksum, tuple __pyx_state): # <<<<<<<<<<<<<< + * cdef object __pyx_result + * __Pyx_CheckUnpickleChecksum(__pyx_checksum, 0xe3b0c44, 0xda39a3e, 0xd41d8cd, b'') +*/ + +/* Python wrapper */ +static PyObject *__pyx_pw_5spacy_8pipeline_17_parser_internals_9arc_eager_5__pyx_unpickle_Reduce(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_5spacy_8pipeline_17_parser_internals_9arc_eager_4__pyx_unpickle_Reduce, "__pyx_unpickle_Reduce(__pyx_type, long __pyx_checksum, tuple __pyx_state)"); +static PyMethodDef __pyx_mdef_5spacy_8pipeline_17_parser_internals_9arc_eager_5__pyx_unpickle_Reduce = {"__pyx_unpickle_Reduce", (PyCFunction)(void(*)(void))(__Pyx_PyCFunction_FastCallWithKeywords)__pyx_pw_5spacy_8pipeline_17_parser_internals_9arc_eager_5__pyx_unpickle_Reduce, __Pyx_METH_FASTCALL|METH_KEYWORDS, __pyx_doc_5spacy_8pipeline_17_parser_internals_9arc_eager_4__pyx_unpickle_Reduce}; +static PyObject *__pyx_pw_5spacy_8pipeline_17_parser_internals_9arc_eager_5__pyx_unpickle_Reduce(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 +) { + PyObject *__pyx_v___pyx_type = 0; + long __pyx_v___pyx_checksum; + 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[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("__pyx_unpickle_Reduce (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_type,&__pyx_mstate_global->__pyx_n_u_pyx_checksum,&__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, 4, __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(1, 4, __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(1, 4, __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(1, 4, __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, "__pyx_unpickle_Reduce", 0) < (0)) __PYX_ERR(1, 4, __pyx_L3_error) + for (Py_ssize_t i = __pyx_nargs; i < 3; i++) { + if (unlikely(!values[i])) { __Pyx_RaiseArgtupleInvalid("__pyx_unpickle_Reduce", 1, 3, 3, i); __PYX_ERR(1, 4, __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(1, 4, __pyx_L3_error) + values[1] = __Pyx_ArgRef_FASTCALL(__pyx_args, 1); + if (!CYTHON_ASSUME_SAFE_MACROS && unlikely(!values[1])) __PYX_ERR(1, 4, __pyx_L3_error) + values[2] = __Pyx_ArgRef_FASTCALL(__pyx_args, 2); + if (!CYTHON_ASSUME_SAFE_MACROS && unlikely(!values[2])) __PYX_ERR(1, 4, __pyx_L3_error) + } + __pyx_v___pyx_type = values[0]; + __pyx_v___pyx_checksum = __Pyx_PyLong_As_long(values[1]); if (unlikely((__pyx_v___pyx_checksum == (long)-1) && PyErr_Occurred())) __PYX_ERR(1, 4, __pyx_L3_error) + __pyx_v___pyx_state = ((PyObject*)values[2]); + } + goto __pyx_L6_skip; + __pyx_L5_argtuple_error:; + __Pyx_RaiseArgtupleInvalid("__pyx_unpickle_Reduce", 1, 3, 3, __pyx_nargs); __PYX_ERR(1, 4, __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("spacy.pipeline._parser_internals.arc_eager.__pyx_unpickle_Reduce", __pyx_clineno, __pyx_lineno, __pyx_filename); + __Pyx_RefNannyFinishContext(); + return NULL; + __pyx_L4_argument_unpacking_done:; + if (unlikely(!__Pyx_ArgTypeTest(((PyObject *)__pyx_v___pyx_state), (&PyTuple_Type), 1, "__pyx_state", 1))) __PYX_ERR(1, 4, __pyx_L1_error) + __pyx_r = __pyx_pf_5spacy_8pipeline_17_parser_internals_9arc_eager_4__pyx_unpickle_Reduce(__pyx_self, __pyx_v___pyx_type, __pyx_v___pyx_checksum, __pyx_v___pyx_state); + + /* 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_5spacy_8pipeline_17_parser_internals_9arc_eager_4__pyx_unpickle_Reduce(CYTHON_UNUSED PyObject *__pyx_self, PyObject *__pyx_v___pyx_type, long __pyx_v___pyx_checksum, PyObject *__pyx_v___pyx_state) { + PyObject *__pyx_v___pyx_result = 0; + 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_t_5; + int __pyx_lineno = 0; + const char *__pyx_filename = NULL; + int __pyx_clineno = 0; + __Pyx_RefNannySetupContext("__pyx_unpickle_Reduce", 0); + + /* "(tree fragment)":6 + * def __pyx_unpickle_Reduce(__pyx_type, long __pyx_checksum, tuple __pyx_state): + * cdef object __pyx_result + * __Pyx_CheckUnpickleChecksum(__pyx_checksum, 0xe3b0c44, 0xda39a3e, 0xd41d8cd, b'') # <<<<<<<<<<<<<< + * __pyx_result = Reduce.__new__(__pyx_type) + * if __pyx_state is not None: +*/ + __pyx_t_1 = __Pyx_CheckUnpickleChecksum(__pyx_v___pyx_checksum, 0xe3b0c44, 0xda39a3e, 0xd41d8cd, ((char const *)"")); if (unlikely(__pyx_t_1 == ((int)-1))) __PYX_ERR(1, 6, __pyx_L1_error) + + /* "(tree fragment)":7 + * cdef object __pyx_result + * __Pyx_CheckUnpickleChecksum(__pyx_checksum, 0xe3b0c44, 0xda39a3e, 0xd41d8cd, b'') + * __pyx_result = Reduce.__new__(__pyx_type) # <<<<<<<<<<<<<< + * if __pyx_state is not None: + * __pyx_unpickle_Reduce__set_state( __pyx_result, __pyx_state) +*/ + __pyx_t_3 = ((PyObject *)__pyx_mstate_global->__pyx_ptype_5spacy_8pipeline_17_parser_internals_9arc_eager_Reduce); + __Pyx_INCREF(__pyx_t_3); + __pyx_t_4 = 0; + { + PyObject *__pyx_callargs[2] = {__pyx_t_3, __pyx_v___pyx_type}; + __pyx_t_2 = __Pyx_PyObject_FastCallMethod((PyObject*)__pyx_mstate_global->__pyx_n_u_new, __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_2)) __PYX_ERR(1, 7, __pyx_L1_error) + __Pyx_GOTREF(__pyx_t_2); + } + __pyx_v___pyx_result = __pyx_t_2; + __pyx_t_2 = 0; + + /* "(tree fragment)":8 + * __Pyx_CheckUnpickleChecksum(__pyx_checksum, 0xe3b0c44, 0xda39a3e, 0xd41d8cd, b'') + * __pyx_result = Reduce.__new__(__pyx_type) + * if __pyx_state is not None: # <<<<<<<<<<<<<< + * __pyx_unpickle_Reduce__set_state( __pyx_result, __pyx_state) + * return __pyx_result +*/ + __pyx_t_5 = (__pyx_v___pyx_state != ((PyObject*)Py_None)); + if (__pyx_t_5) { + + /* "(tree fragment)":9 + * __pyx_result = Reduce.__new__(__pyx_type) + * if __pyx_state is not None: + * __pyx_unpickle_Reduce__set_state( __pyx_result, __pyx_state) # <<<<<<<<<<<<<< + * return __pyx_result + * cdef __pyx_unpickle_Reduce__set_state(Reduce __pyx_result, __pyx_state: tuple): +*/ + __pyx_t_2 = __pyx_f_5spacy_8pipeline_17_parser_internals_9arc_eager___pyx_unpickle_Reduce__set_state(((struct __pyx_obj_5spacy_8pipeline_17_parser_internals_9arc_eager_Reduce *)__pyx_v___pyx_result), __pyx_v___pyx_state); if (unlikely(!__pyx_t_2)) __PYX_ERR(1, 9, __pyx_L1_error) + __Pyx_GOTREF(__pyx_t_2); + __Pyx_DECREF(__pyx_t_2); __pyx_t_2 = 0; + + /* "(tree fragment)":8 + * __Pyx_CheckUnpickleChecksum(__pyx_checksum, 0xe3b0c44, 0xda39a3e, 0xd41d8cd, b'') + * __pyx_result = Reduce.__new__(__pyx_type) + * if __pyx_state is not None: # <<<<<<<<<<<<<< + * __pyx_unpickle_Reduce__set_state( __pyx_result, __pyx_state) + * return __pyx_result +*/ + } + + /* "(tree fragment)":10 + * if __pyx_state is not None: + * __pyx_unpickle_Reduce__set_state( __pyx_result, __pyx_state) + * return __pyx_result # <<<<<<<<<<<<<< + * cdef __pyx_unpickle_Reduce__set_state(Reduce __pyx_result, __pyx_state: tuple): + * __Pyx_UpdateUnpickledDict(__pyx_result, __pyx_state, 0) +*/ + __Pyx_XDECREF(__pyx_r); + __Pyx_INCREF(__pyx_v___pyx_result); + __pyx_r = __pyx_v___pyx_result; + goto __pyx_L0; + + /* "(tree fragment)":4 + * int __Pyx_CheckUnpickleChecksum(long, long, long, long, const char*) except -1 + * int __Pyx_UpdateUnpickledDict(object, object, Py_ssize_t) except -1 + * def __pyx_unpickle_Reduce(__pyx_type, long __pyx_checksum, tuple __pyx_state): # <<<<<<<<<<<<<< + * cdef object __pyx_result + * __Pyx_CheckUnpickleChecksum(__pyx_checksum, 0xe3b0c44, 0xda39a3e, 0xd41d8cd, b'') +*/ + + /* function exit code */ + __pyx_L1_error:; + __Pyx_XDECREF(__pyx_t_2); + __Pyx_XDECREF(__pyx_t_3); + __Pyx_AddTraceback("spacy.pipeline._parser_internals.arc_eager.__pyx_unpickle_Reduce", __pyx_clineno, __pyx_lineno, __pyx_filename); + __pyx_r = NULL; + __pyx_L0:; + __Pyx_XDECREF(__pyx_v___pyx_result); + __Pyx_XGIVEREF(__pyx_r); + __Pyx_RefNannyFinishContext(); + return __pyx_r; +} + +/* "(tree fragment)":11 + * __pyx_unpickle_Reduce__set_state( __pyx_result, __pyx_state) + * return __pyx_result + * cdef __pyx_unpickle_Reduce__set_state(Reduce __pyx_result, __pyx_state: tuple): # <<<<<<<<<<<<<< + * __Pyx_UpdateUnpickledDict(__pyx_result, __pyx_state, 0) +*/ + +static PyObject *__pyx_f_5spacy_8pipeline_17_parser_internals_9arc_eager___pyx_unpickle_Reduce__set_state(struct __pyx_obj_5spacy_8pipeline_17_parser_internals_9arc_eager_Reduce *__pyx_v___pyx_result, PyObject *__pyx_v___pyx_state) { + PyObject *__pyx_r = NULL; + __Pyx_RefNannyDeclarations + int __pyx_t_1; + int __pyx_lineno = 0; + const char *__pyx_filename = NULL; + int __pyx_clineno = 0; + __Pyx_RefNannySetupContext("__pyx_unpickle_Reduce__set_state", 0); + + /* "(tree fragment)":12 + * return __pyx_result + * cdef __pyx_unpickle_Reduce__set_state(Reduce __pyx_result, __pyx_state: tuple): + * __Pyx_UpdateUnpickledDict(__pyx_result, __pyx_state, 0) # <<<<<<<<<<<<<< +*/ + __pyx_t_1 = __Pyx_UpdateUnpickledDict(((PyObject *)__pyx_v___pyx_result), __pyx_v___pyx_state, 0); if (unlikely(__pyx_t_1 == ((int)-1))) __PYX_ERR(1, 12, __pyx_L1_error) + + /* "(tree fragment)":11 + * __pyx_unpickle_Reduce__set_state( __pyx_result, __pyx_state) + * return __pyx_result + * cdef __pyx_unpickle_Reduce__set_state(Reduce __pyx_result, __pyx_state: tuple): # <<<<<<<<<<<<<< + * __Pyx_UpdateUnpickledDict(__pyx_result, __pyx_state, 0) +*/ + + /* function exit code */ + __pyx_r = Py_None; __Pyx_INCREF(Py_None); + goto __pyx_L0; + __pyx_L1_error:; + __Pyx_AddTraceback("spacy.pipeline._parser_internals.arc_eager.__pyx_unpickle_Reduce__set_state", __pyx_clineno, __pyx_lineno, __pyx_filename); + __pyx_r = 0; + __pyx_L0:; + __Pyx_XGIVEREF(__pyx_r); + __Pyx_RefNannyFinishContext(); + return __pyx_r; +} + +/* "(tree fragment)":4 + * int __Pyx_CheckUnpickleChecksum(long, long, long, long, const char*) except -1 + * int __Pyx_UpdateUnpickledDict(object, object, Py_ssize_t) except -1 + * def __pyx_unpickle_LeftArc(__pyx_type, long __pyx_checksum, tuple __pyx_state): # <<<<<<<<<<<<<< + * cdef object __pyx_result + * __Pyx_CheckUnpickleChecksum(__pyx_checksum, 0xe3b0c44, 0xda39a3e, 0xd41d8cd, b'') +*/ + +/* Python wrapper */ +static PyObject *__pyx_pw_5spacy_8pipeline_17_parser_internals_9arc_eager_7__pyx_unpickle_LeftArc(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_5spacy_8pipeline_17_parser_internals_9arc_eager_6__pyx_unpickle_LeftArc, "__pyx_unpickle_LeftArc(__pyx_type, long __pyx_checksum, tuple __pyx_state)"); +static PyMethodDef __pyx_mdef_5spacy_8pipeline_17_parser_internals_9arc_eager_7__pyx_unpickle_LeftArc = {"__pyx_unpickle_LeftArc", (PyCFunction)(void(*)(void))(__Pyx_PyCFunction_FastCallWithKeywords)__pyx_pw_5spacy_8pipeline_17_parser_internals_9arc_eager_7__pyx_unpickle_LeftArc, __Pyx_METH_FASTCALL|METH_KEYWORDS, __pyx_doc_5spacy_8pipeline_17_parser_internals_9arc_eager_6__pyx_unpickle_LeftArc}; +static PyObject *__pyx_pw_5spacy_8pipeline_17_parser_internals_9arc_eager_7__pyx_unpickle_LeftArc(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 +) { + PyObject *__pyx_v___pyx_type = 0; + long __pyx_v___pyx_checksum; + 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[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("__pyx_unpickle_LeftArc (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_type,&__pyx_mstate_global->__pyx_n_u_pyx_checksum,&__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, 4, __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(1, 4, __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(1, 4, __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(1, 4, __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, "__pyx_unpickle_LeftArc", 0) < (0)) __PYX_ERR(1, 4, __pyx_L3_error) + for (Py_ssize_t i = __pyx_nargs; i < 3; i++) { + if (unlikely(!values[i])) { __Pyx_RaiseArgtupleInvalid("__pyx_unpickle_LeftArc", 1, 3, 3, i); __PYX_ERR(1, 4, __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(1, 4, __pyx_L3_error) + values[1] = __Pyx_ArgRef_FASTCALL(__pyx_args, 1); + if (!CYTHON_ASSUME_SAFE_MACROS && unlikely(!values[1])) __PYX_ERR(1, 4, __pyx_L3_error) + values[2] = __Pyx_ArgRef_FASTCALL(__pyx_args, 2); + if (!CYTHON_ASSUME_SAFE_MACROS && unlikely(!values[2])) __PYX_ERR(1, 4, __pyx_L3_error) + } + __pyx_v___pyx_type = values[0]; + __pyx_v___pyx_checksum = __Pyx_PyLong_As_long(values[1]); if (unlikely((__pyx_v___pyx_checksum == (long)-1) && PyErr_Occurred())) __PYX_ERR(1, 4, __pyx_L3_error) + __pyx_v___pyx_state = ((PyObject*)values[2]); + } + goto __pyx_L6_skip; + __pyx_L5_argtuple_error:; + __Pyx_RaiseArgtupleInvalid("__pyx_unpickle_LeftArc", 1, 3, 3, __pyx_nargs); __PYX_ERR(1, 4, __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("spacy.pipeline._parser_internals.arc_eager.__pyx_unpickle_LeftArc", __pyx_clineno, __pyx_lineno, __pyx_filename); + __Pyx_RefNannyFinishContext(); + return NULL; + __pyx_L4_argument_unpacking_done:; + if (unlikely(!__Pyx_ArgTypeTest(((PyObject *)__pyx_v___pyx_state), (&PyTuple_Type), 1, "__pyx_state", 1))) __PYX_ERR(1, 4, __pyx_L1_error) + __pyx_r = __pyx_pf_5spacy_8pipeline_17_parser_internals_9arc_eager_6__pyx_unpickle_LeftArc(__pyx_self, __pyx_v___pyx_type, __pyx_v___pyx_checksum, __pyx_v___pyx_state); + + /* 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_5spacy_8pipeline_17_parser_internals_9arc_eager_6__pyx_unpickle_LeftArc(CYTHON_UNUSED PyObject *__pyx_self, PyObject *__pyx_v___pyx_type, long __pyx_v___pyx_checksum, PyObject *__pyx_v___pyx_state) { + PyObject *__pyx_v___pyx_result = 0; + 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_t_5; + int __pyx_lineno = 0; + const char *__pyx_filename = NULL; + int __pyx_clineno = 0; + __Pyx_RefNannySetupContext("__pyx_unpickle_LeftArc", 0); + + /* "(tree fragment)":6 + * def __pyx_unpickle_LeftArc(__pyx_type, long __pyx_checksum, tuple __pyx_state): + * cdef object __pyx_result + * __Pyx_CheckUnpickleChecksum(__pyx_checksum, 0xe3b0c44, 0xda39a3e, 0xd41d8cd, b'') # <<<<<<<<<<<<<< + * __pyx_result = LeftArc.__new__(__pyx_type) + * if __pyx_state is not None: +*/ + __pyx_t_1 = __Pyx_CheckUnpickleChecksum(__pyx_v___pyx_checksum, 0xe3b0c44, 0xda39a3e, 0xd41d8cd, ((char const *)"")); if (unlikely(__pyx_t_1 == ((int)-1))) __PYX_ERR(1, 6, __pyx_L1_error) + + /* "(tree fragment)":7 + * cdef object __pyx_result + * __Pyx_CheckUnpickleChecksum(__pyx_checksum, 0xe3b0c44, 0xda39a3e, 0xd41d8cd, b'') + * __pyx_result = LeftArc.__new__(__pyx_type) # <<<<<<<<<<<<<< + * if __pyx_state is not None: + * __pyx_unpickle_LeftArc__set_state( __pyx_result, __pyx_state) +*/ + __pyx_t_3 = ((PyObject *)__pyx_mstate_global->__pyx_ptype_5spacy_8pipeline_17_parser_internals_9arc_eager_LeftArc); + __Pyx_INCREF(__pyx_t_3); + __pyx_t_4 = 0; + { + PyObject *__pyx_callargs[2] = {__pyx_t_3, __pyx_v___pyx_type}; + __pyx_t_2 = __Pyx_PyObject_FastCallMethod((PyObject*)__pyx_mstate_global->__pyx_n_u_new, __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_2)) __PYX_ERR(1, 7, __pyx_L1_error) + __Pyx_GOTREF(__pyx_t_2); + } + __pyx_v___pyx_result = __pyx_t_2; + __pyx_t_2 = 0; + + /* "(tree fragment)":8 + * __Pyx_CheckUnpickleChecksum(__pyx_checksum, 0xe3b0c44, 0xda39a3e, 0xd41d8cd, b'') + * __pyx_result = LeftArc.__new__(__pyx_type) + * if __pyx_state is not None: # <<<<<<<<<<<<<< + * __pyx_unpickle_LeftArc__set_state( __pyx_result, __pyx_state) + * return __pyx_result +*/ + __pyx_t_5 = (__pyx_v___pyx_state != ((PyObject*)Py_None)); + if (__pyx_t_5) { + + /* "(tree fragment)":9 + * __pyx_result = LeftArc.__new__(__pyx_type) + * if __pyx_state is not None: + * __pyx_unpickle_LeftArc__set_state( __pyx_result, __pyx_state) # <<<<<<<<<<<<<< + * return __pyx_result + * cdef __pyx_unpickle_LeftArc__set_state(LeftArc __pyx_result, __pyx_state: tuple): +*/ + __pyx_t_2 = __pyx_f_5spacy_8pipeline_17_parser_internals_9arc_eager___pyx_unpickle_LeftArc__set_state(((struct __pyx_obj_5spacy_8pipeline_17_parser_internals_9arc_eager_LeftArc *)__pyx_v___pyx_result), __pyx_v___pyx_state); if (unlikely(!__pyx_t_2)) __PYX_ERR(1, 9, __pyx_L1_error) + __Pyx_GOTREF(__pyx_t_2); + __Pyx_DECREF(__pyx_t_2); __pyx_t_2 = 0; + + /* "(tree fragment)":8 + * __Pyx_CheckUnpickleChecksum(__pyx_checksum, 0xe3b0c44, 0xda39a3e, 0xd41d8cd, b'') + * __pyx_result = LeftArc.__new__(__pyx_type) + * if __pyx_state is not None: # <<<<<<<<<<<<<< + * __pyx_unpickle_LeftArc__set_state( __pyx_result, __pyx_state) + * return __pyx_result +*/ + } + + /* "(tree fragment)":10 + * if __pyx_state is not None: + * __pyx_unpickle_LeftArc__set_state( __pyx_result, __pyx_state) + * return __pyx_result # <<<<<<<<<<<<<< + * cdef __pyx_unpickle_LeftArc__set_state(LeftArc __pyx_result, __pyx_state: tuple): + * __Pyx_UpdateUnpickledDict(__pyx_result, __pyx_state, 0) +*/ + __Pyx_XDECREF(__pyx_r); + __Pyx_INCREF(__pyx_v___pyx_result); + __pyx_r = __pyx_v___pyx_result; + goto __pyx_L0; + + /* "(tree fragment)":4 + * int __Pyx_CheckUnpickleChecksum(long, long, long, long, const char*) except -1 + * int __Pyx_UpdateUnpickledDict(object, object, Py_ssize_t) except -1 + * def __pyx_unpickle_LeftArc(__pyx_type, long __pyx_checksum, tuple __pyx_state): # <<<<<<<<<<<<<< + * cdef object __pyx_result + * __Pyx_CheckUnpickleChecksum(__pyx_checksum, 0xe3b0c44, 0xda39a3e, 0xd41d8cd, b'') +*/ + + /* function exit code */ + __pyx_L1_error:; + __Pyx_XDECREF(__pyx_t_2); + __Pyx_XDECREF(__pyx_t_3); + __Pyx_AddTraceback("spacy.pipeline._parser_internals.arc_eager.__pyx_unpickle_LeftArc", __pyx_clineno, __pyx_lineno, __pyx_filename); + __pyx_r = NULL; + __pyx_L0:; + __Pyx_XDECREF(__pyx_v___pyx_result); + __Pyx_XGIVEREF(__pyx_r); + __Pyx_RefNannyFinishContext(); + return __pyx_r; +} + +/* "(tree fragment)":11 + * __pyx_unpickle_LeftArc__set_state( __pyx_result, __pyx_state) + * return __pyx_result + * cdef __pyx_unpickle_LeftArc__set_state(LeftArc __pyx_result, __pyx_state: tuple): # <<<<<<<<<<<<<< + * __Pyx_UpdateUnpickledDict(__pyx_result, __pyx_state, 0) +*/ + +static PyObject *__pyx_f_5spacy_8pipeline_17_parser_internals_9arc_eager___pyx_unpickle_LeftArc__set_state(struct __pyx_obj_5spacy_8pipeline_17_parser_internals_9arc_eager_LeftArc *__pyx_v___pyx_result, PyObject *__pyx_v___pyx_state) { + PyObject *__pyx_r = NULL; + __Pyx_RefNannyDeclarations + int __pyx_t_1; + int __pyx_lineno = 0; + const char *__pyx_filename = NULL; + int __pyx_clineno = 0; + __Pyx_RefNannySetupContext("__pyx_unpickle_LeftArc__set_state", 0); + + /* "(tree fragment)":12 + * return __pyx_result + * cdef __pyx_unpickle_LeftArc__set_state(LeftArc __pyx_result, __pyx_state: tuple): + * __Pyx_UpdateUnpickledDict(__pyx_result, __pyx_state, 0) # <<<<<<<<<<<<<< +*/ + __pyx_t_1 = __Pyx_UpdateUnpickledDict(((PyObject *)__pyx_v___pyx_result), __pyx_v___pyx_state, 0); if (unlikely(__pyx_t_1 == ((int)-1))) __PYX_ERR(1, 12, __pyx_L1_error) + + /* "(tree fragment)":11 + * __pyx_unpickle_LeftArc__set_state( __pyx_result, __pyx_state) + * return __pyx_result + * cdef __pyx_unpickle_LeftArc__set_state(LeftArc __pyx_result, __pyx_state: tuple): # <<<<<<<<<<<<<< + * __Pyx_UpdateUnpickledDict(__pyx_result, __pyx_state, 0) +*/ + + /* function exit code */ + __pyx_r = Py_None; __Pyx_INCREF(Py_None); + goto __pyx_L0; + __pyx_L1_error:; + __Pyx_AddTraceback("spacy.pipeline._parser_internals.arc_eager.__pyx_unpickle_LeftArc__set_state", __pyx_clineno, __pyx_lineno, __pyx_filename); + __pyx_r = 0; + __pyx_L0:; + __Pyx_XGIVEREF(__pyx_r); + __Pyx_RefNannyFinishContext(); + return __pyx_r; +} + +/* "(tree fragment)":4 + * int __Pyx_CheckUnpickleChecksum(long, long, long, long, const char*) except -1 + * int __Pyx_UpdateUnpickledDict(object, object, Py_ssize_t) except -1 + * def __pyx_unpickle_RightArc(__pyx_type, long __pyx_checksum, tuple __pyx_state): # <<<<<<<<<<<<<< + * cdef object __pyx_result + * __Pyx_CheckUnpickleChecksum(__pyx_checksum, 0xe3b0c44, 0xda39a3e, 0xd41d8cd, b'') +*/ + +/* Python wrapper */ +static PyObject *__pyx_pw_5spacy_8pipeline_17_parser_internals_9arc_eager_9__pyx_unpickle_RightArc(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_5spacy_8pipeline_17_parser_internals_9arc_eager_8__pyx_unpickle_RightArc, "__pyx_unpickle_RightArc(__pyx_type, long __pyx_checksum, tuple __pyx_state)"); +static PyMethodDef __pyx_mdef_5spacy_8pipeline_17_parser_internals_9arc_eager_9__pyx_unpickle_RightArc = {"__pyx_unpickle_RightArc", (PyCFunction)(void(*)(void))(__Pyx_PyCFunction_FastCallWithKeywords)__pyx_pw_5spacy_8pipeline_17_parser_internals_9arc_eager_9__pyx_unpickle_RightArc, __Pyx_METH_FASTCALL|METH_KEYWORDS, __pyx_doc_5spacy_8pipeline_17_parser_internals_9arc_eager_8__pyx_unpickle_RightArc}; +static PyObject *__pyx_pw_5spacy_8pipeline_17_parser_internals_9arc_eager_9__pyx_unpickle_RightArc(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 +) { + PyObject *__pyx_v___pyx_type = 0; + long __pyx_v___pyx_checksum; + 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[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("__pyx_unpickle_RightArc (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_type,&__pyx_mstate_global->__pyx_n_u_pyx_checksum,&__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, 4, __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(1, 4, __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(1, 4, __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(1, 4, __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, "__pyx_unpickle_RightArc", 0) < (0)) __PYX_ERR(1, 4, __pyx_L3_error) + for (Py_ssize_t i = __pyx_nargs; i < 3; i++) { + if (unlikely(!values[i])) { __Pyx_RaiseArgtupleInvalid("__pyx_unpickle_RightArc", 1, 3, 3, i); __PYX_ERR(1, 4, __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(1, 4, __pyx_L3_error) + values[1] = __Pyx_ArgRef_FASTCALL(__pyx_args, 1); + if (!CYTHON_ASSUME_SAFE_MACROS && unlikely(!values[1])) __PYX_ERR(1, 4, __pyx_L3_error) + values[2] = __Pyx_ArgRef_FASTCALL(__pyx_args, 2); + if (!CYTHON_ASSUME_SAFE_MACROS && unlikely(!values[2])) __PYX_ERR(1, 4, __pyx_L3_error) + } + __pyx_v___pyx_type = values[0]; + __pyx_v___pyx_checksum = __Pyx_PyLong_As_long(values[1]); if (unlikely((__pyx_v___pyx_checksum == (long)-1) && PyErr_Occurred())) __PYX_ERR(1, 4, __pyx_L3_error) + __pyx_v___pyx_state = ((PyObject*)values[2]); + } + goto __pyx_L6_skip; + __pyx_L5_argtuple_error:; + __Pyx_RaiseArgtupleInvalid("__pyx_unpickle_RightArc", 1, 3, 3, __pyx_nargs); __PYX_ERR(1, 4, __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("spacy.pipeline._parser_internals.arc_eager.__pyx_unpickle_RightArc", __pyx_clineno, __pyx_lineno, __pyx_filename); + __Pyx_RefNannyFinishContext(); + return NULL; + __pyx_L4_argument_unpacking_done:; + if (unlikely(!__Pyx_ArgTypeTest(((PyObject *)__pyx_v___pyx_state), (&PyTuple_Type), 1, "__pyx_state", 1))) __PYX_ERR(1, 4, __pyx_L1_error) + __pyx_r = __pyx_pf_5spacy_8pipeline_17_parser_internals_9arc_eager_8__pyx_unpickle_RightArc(__pyx_self, __pyx_v___pyx_type, __pyx_v___pyx_checksum, __pyx_v___pyx_state); + + /* 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_5spacy_8pipeline_17_parser_internals_9arc_eager_8__pyx_unpickle_RightArc(CYTHON_UNUSED PyObject *__pyx_self, PyObject *__pyx_v___pyx_type, long __pyx_v___pyx_checksum, PyObject *__pyx_v___pyx_state) { + PyObject *__pyx_v___pyx_result = 0; + 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_t_5; + int __pyx_lineno = 0; + const char *__pyx_filename = NULL; + int __pyx_clineno = 0; + __Pyx_RefNannySetupContext("__pyx_unpickle_RightArc", 0); + + /* "(tree fragment)":6 + * def __pyx_unpickle_RightArc(__pyx_type, long __pyx_checksum, tuple __pyx_state): + * cdef object __pyx_result + * __Pyx_CheckUnpickleChecksum(__pyx_checksum, 0xe3b0c44, 0xda39a3e, 0xd41d8cd, b'') # <<<<<<<<<<<<<< + * __pyx_result = RightArc.__new__(__pyx_type) + * if __pyx_state is not None: +*/ + __pyx_t_1 = __Pyx_CheckUnpickleChecksum(__pyx_v___pyx_checksum, 0xe3b0c44, 0xda39a3e, 0xd41d8cd, ((char const *)"")); if (unlikely(__pyx_t_1 == ((int)-1))) __PYX_ERR(1, 6, __pyx_L1_error) + + /* "(tree fragment)":7 + * cdef object __pyx_result + * __Pyx_CheckUnpickleChecksum(__pyx_checksum, 0xe3b0c44, 0xda39a3e, 0xd41d8cd, b'') + * __pyx_result = RightArc.__new__(__pyx_type) # <<<<<<<<<<<<<< + * if __pyx_state is not None: + * __pyx_unpickle_RightArc__set_state( __pyx_result, __pyx_state) +*/ + __pyx_t_3 = ((PyObject *)__pyx_mstate_global->__pyx_ptype_5spacy_8pipeline_17_parser_internals_9arc_eager_RightArc); + __Pyx_INCREF(__pyx_t_3); + __pyx_t_4 = 0; + { + PyObject *__pyx_callargs[2] = {__pyx_t_3, __pyx_v___pyx_type}; + __pyx_t_2 = __Pyx_PyObject_FastCallMethod((PyObject*)__pyx_mstate_global->__pyx_n_u_new, __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_2)) __PYX_ERR(1, 7, __pyx_L1_error) + __Pyx_GOTREF(__pyx_t_2); + } + __pyx_v___pyx_result = __pyx_t_2; + __pyx_t_2 = 0; + + /* "(tree fragment)":8 + * __Pyx_CheckUnpickleChecksum(__pyx_checksum, 0xe3b0c44, 0xda39a3e, 0xd41d8cd, b'') + * __pyx_result = RightArc.__new__(__pyx_type) + * if __pyx_state is not None: # <<<<<<<<<<<<<< + * __pyx_unpickle_RightArc__set_state( __pyx_result, __pyx_state) + * return __pyx_result +*/ + __pyx_t_5 = (__pyx_v___pyx_state != ((PyObject*)Py_None)); + if (__pyx_t_5) { + + /* "(tree fragment)":9 + * __pyx_result = RightArc.__new__(__pyx_type) + * if __pyx_state is not None: + * __pyx_unpickle_RightArc__set_state( __pyx_result, __pyx_state) # <<<<<<<<<<<<<< + * return __pyx_result + * cdef __pyx_unpickle_RightArc__set_state(RightArc __pyx_result, __pyx_state: tuple): +*/ + __pyx_t_2 = __pyx_f_5spacy_8pipeline_17_parser_internals_9arc_eager___pyx_unpickle_RightArc__set_state(((struct __pyx_obj_5spacy_8pipeline_17_parser_internals_9arc_eager_RightArc *)__pyx_v___pyx_result), __pyx_v___pyx_state); if (unlikely(!__pyx_t_2)) __PYX_ERR(1, 9, __pyx_L1_error) + __Pyx_GOTREF(__pyx_t_2); + __Pyx_DECREF(__pyx_t_2); __pyx_t_2 = 0; + + /* "(tree fragment)":8 + * __Pyx_CheckUnpickleChecksum(__pyx_checksum, 0xe3b0c44, 0xda39a3e, 0xd41d8cd, b'') + * __pyx_result = RightArc.__new__(__pyx_type) + * if __pyx_state is not None: # <<<<<<<<<<<<<< + * __pyx_unpickle_RightArc__set_state( __pyx_result, __pyx_state) + * return __pyx_result +*/ + } + + /* "(tree fragment)":10 + * if __pyx_state is not None: + * __pyx_unpickle_RightArc__set_state( __pyx_result, __pyx_state) + * return __pyx_result # <<<<<<<<<<<<<< + * cdef __pyx_unpickle_RightArc__set_state(RightArc __pyx_result, __pyx_state: tuple): + * __Pyx_UpdateUnpickledDict(__pyx_result, __pyx_state, 0) +*/ + __Pyx_XDECREF(__pyx_r); + __Pyx_INCREF(__pyx_v___pyx_result); + __pyx_r = __pyx_v___pyx_result; + goto __pyx_L0; + + /* "(tree fragment)":4 + * int __Pyx_CheckUnpickleChecksum(long, long, long, long, const char*) except -1 + * int __Pyx_UpdateUnpickledDict(object, object, Py_ssize_t) except -1 + * def __pyx_unpickle_RightArc(__pyx_type, long __pyx_checksum, tuple __pyx_state): # <<<<<<<<<<<<<< + * cdef object __pyx_result + * __Pyx_CheckUnpickleChecksum(__pyx_checksum, 0xe3b0c44, 0xda39a3e, 0xd41d8cd, b'') +*/ + + /* function exit code */ + __pyx_L1_error:; + __Pyx_XDECREF(__pyx_t_2); + __Pyx_XDECREF(__pyx_t_3); + __Pyx_AddTraceback("spacy.pipeline._parser_internals.arc_eager.__pyx_unpickle_RightArc", __pyx_clineno, __pyx_lineno, __pyx_filename); + __pyx_r = NULL; + __pyx_L0:; + __Pyx_XDECREF(__pyx_v___pyx_result); + __Pyx_XGIVEREF(__pyx_r); + __Pyx_RefNannyFinishContext(); + return __pyx_r; +} + +/* "(tree fragment)":11 + * __pyx_unpickle_RightArc__set_state( __pyx_result, __pyx_state) + * return __pyx_result + * cdef __pyx_unpickle_RightArc__set_state(RightArc __pyx_result, __pyx_state: tuple): # <<<<<<<<<<<<<< + * __Pyx_UpdateUnpickledDict(__pyx_result, __pyx_state, 0) +*/ + +static PyObject *__pyx_f_5spacy_8pipeline_17_parser_internals_9arc_eager___pyx_unpickle_RightArc__set_state(struct __pyx_obj_5spacy_8pipeline_17_parser_internals_9arc_eager_RightArc *__pyx_v___pyx_result, PyObject *__pyx_v___pyx_state) { + PyObject *__pyx_r = NULL; + __Pyx_RefNannyDeclarations + int __pyx_t_1; + int __pyx_lineno = 0; + const char *__pyx_filename = NULL; + int __pyx_clineno = 0; + __Pyx_RefNannySetupContext("__pyx_unpickle_RightArc__set_state", 0); + + /* "(tree fragment)":12 + * return __pyx_result + * cdef __pyx_unpickle_RightArc__set_state(RightArc __pyx_result, __pyx_state: tuple): + * __Pyx_UpdateUnpickledDict(__pyx_result, __pyx_state, 0) # <<<<<<<<<<<<<< +*/ + __pyx_t_1 = __Pyx_UpdateUnpickledDict(((PyObject *)__pyx_v___pyx_result), __pyx_v___pyx_state, 0); if (unlikely(__pyx_t_1 == ((int)-1))) __PYX_ERR(1, 12, __pyx_L1_error) + + /* "(tree fragment)":11 + * __pyx_unpickle_RightArc__set_state( __pyx_result, __pyx_state) + * return __pyx_result + * cdef __pyx_unpickle_RightArc__set_state(RightArc __pyx_result, __pyx_state: tuple): # <<<<<<<<<<<<<< + * __Pyx_UpdateUnpickledDict(__pyx_result, __pyx_state, 0) +*/ + + /* function exit code */ + __pyx_r = Py_None; __Pyx_INCREF(Py_None); + goto __pyx_L0; + __pyx_L1_error:; + __Pyx_AddTraceback("spacy.pipeline._parser_internals.arc_eager.__pyx_unpickle_RightArc__set_state", __pyx_clineno, __pyx_lineno, __pyx_filename); + __pyx_r = 0; + __pyx_L0:; + __Pyx_XGIVEREF(__pyx_r); + __Pyx_RefNannyFinishContext(); + return __pyx_r; +} + +/* "(tree fragment)":4 + * int __Pyx_CheckUnpickleChecksum(long, long, long, long, const char*) except -1 + * int __Pyx_UpdateUnpickledDict(object, object, Py_ssize_t) except -1 + * def __pyx_unpickle_Break(__pyx_type, long __pyx_checksum, tuple __pyx_state): # <<<<<<<<<<<<<< + * cdef object __pyx_result + * __Pyx_CheckUnpickleChecksum(__pyx_checksum, 0xe3b0c44, 0xda39a3e, 0xd41d8cd, b'') +*/ + +/* Python wrapper */ +static PyObject *__pyx_pw_5spacy_8pipeline_17_parser_internals_9arc_eager_11__pyx_unpickle_Break(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_5spacy_8pipeline_17_parser_internals_9arc_eager_10__pyx_unpickle_Break, "__pyx_unpickle_Break(__pyx_type, long __pyx_checksum, tuple __pyx_state)"); +static PyMethodDef __pyx_mdef_5spacy_8pipeline_17_parser_internals_9arc_eager_11__pyx_unpickle_Break = {"__pyx_unpickle_Break", (PyCFunction)(void(*)(void))(__Pyx_PyCFunction_FastCallWithKeywords)__pyx_pw_5spacy_8pipeline_17_parser_internals_9arc_eager_11__pyx_unpickle_Break, __Pyx_METH_FASTCALL|METH_KEYWORDS, __pyx_doc_5spacy_8pipeline_17_parser_internals_9arc_eager_10__pyx_unpickle_Break}; +static PyObject *__pyx_pw_5spacy_8pipeline_17_parser_internals_9arc_eager_11__pyx_unpickle_Break(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 +) { + PyObject *__pyx_v___pyx_type = 0; + long __pyx_v___pyx_checksum; + 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[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("__pyx_unpickle_Break (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_type,&__pyx_mstate_global->__pyx_n_u_pyx_checksum,&__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, 4, __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(1, 4, __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(1, 4, __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(1, 4, __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, "__pyx_unpickle_Break", 0) < (0)) __PYX_ERR(1, 4, __pyx_L3_error) + for (Py_ssize_t i = __pyx_nargs; i < 3; i++) { + if (unlikely(!values[i])) { __Pyx_RaiseArgtupleInvalid("__pyx_unpickle_Break", 1, 3, 3, i); __PYX_ERR(1, 4, __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(1, 4, __pyx_L3_error) + values[1] = __Pyx_ArgRef_FASTCALL(__pyx_args, 1); + if (!CYTHON_ASSUME_SAFE_MACROS && unlikely(!values[1])) __PYX_ERR(1, 4, __pyx_L3_error) + values[2] = __Pyx_ArgRef_FASTCALL(__pyx_args, 2); + if (!CYTHON_ASSUME_SAFE_MACROS && unlikely(!values[2])) __PYX_ERR(1, 4, __pyx_L3_error) + } + __pyx_v___pyx_type = values[0]; + __pyx_v___pyx_checksum = __Pyx_PyLong_As_long(values[1]); if (unlikely((__pyx_v___pyx_checksum == (long)-1) && PyErr_Occurred())) __PYX_ERR(1, 4, __pyx_L3_error) + __pyx_v___pyx_state = ((PyObject*)values[2]); + } + goto __pyx_L6_skip; + __pyx_L5_argtuple_error:; + __Pyx_RaiseArgtupleInvalid("__pyx_unpickle_Break", 1, 3, 3, __pyx_nargs); __PYX_ERR(1, 4, __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("spacy.pipeline._parser_internals.arc_eager.__pyx_unpickle_Break", __pyx_clineno, __pyx_lineno, __pyx_filename); + __Pyx_RefNannyFinishContext(); + return NULL; + __pyx_L4_argument_unpacking_done:; + if (unlikely(!__Pyx_ArgTypeTest(((PyObject *)__pyx_v___pyx_state), (&PyTuple_Type), 1, "__pyx_state", 1))) __PYX_ERR(1, 4, __pyx_L1_error) + __pyx_r = __pyx_pf_5spacy_8pipeline_17_parser_internals_9arc_eager_10__pyx_unpickle_Break(__pyx_self, __pyx_v___pyx_type, __pyx_v___pyx_checksum, __pyx_v___pyx_state); + + /* 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_5spacy_8pipeline_17_parser_internals_9arc_eager_10__pyx_unpickle_Break(CYTHON_UNUSED PyObject *__pyx_self, PyObject *__pyx_v___pyx_type, long __pyx_v___pyx_checksum, PyObject *__pyx_v___pyx_state) { + PyObject *__pyx_v___pyx_result = 0; + 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_t_5; + int __pyx_lineno = 0; + const char *__pyx_filename = NULL; + int __pyx_clineno = 0; + __Pyx_RefNannySetupContext("__pyx_unpickle_Break", 0); + + /* "(tree fragment)":6 + * def __pyx_unpickle_Break(__pyx_type, long __pyx_checksum, tuple __pyx_state): + * cdef object __pyx_result + * __Pyx_CheckUnpickleChecksum(__pyx_checksum, 0xe3b0c44, 0xda39a3e, 0xd41d8cd, b'') # <<<<<<<<<<<<<< + * __pyx_result = Break.__new__(__pyx_type) + * if __pyx_state is not None: +*/ + __pyx_t_1 = __Pyx_CheckUnpickleChecksum(__pyx_v___pyx_checksum, 0xe3b0c44, 0xda39a3e, 0xd41d8cd, ((char const *)"")); if (unlikely(__pyx_t_1 == ((int)-1))) __PYX_ERR(1, 6, __pyx_L1_error) + + /* "(tree fragment)":7 + * cdef object __pyx_result + * __Pyx_CheckUnpickleChecksum(__pyx_checksum, 0xe3b0c44, 0xda39a3e, 0xd41d8cd, b'') + * __pyx_result = Break.__new__(__pyx_type) # <<<<<<<<<<<<<< + * if __pyx_state is not None: + * __pyx_unpickle_Break__set_state( __pyx_result, __pyx_state) +*/ + __pyx_t_3 = ((PyObject *)__pyx_mstate_global->__pyx_ptype_5spacy_8pipeline_17_parser_internals_9arc_eager_Break); + __Pyx_INCREF(__pyx_t_3); + __pyx_t_4 = 0; + { + PyObject *__pyx_callargs[2] = {__pyx_t_3, __pyx_v___pyx_type}; + __pyx_t_2 = __Pyx_PyObject_FastCallMethod((PyObject*)__pyx_mstate_global->__pyx_n_u_new, __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_2)) __PYX_ERR(1, 7, __pyx_L1_error) + __Pyx_GOTREF(__pyx_t_2); + } + __pyx_v___pyx_result = __pyx_t_2; + __pyx_t_2 = 0; + + /* "(tree fragment)":8 + * __Pyx_CheckUnpickleChecksum(__pyx_checksum, 0xe3b0c44, 0xda39a3e, 0xd41d8cd, b'') + * __pyx_result = Break.__new__(__pyx_type) + * if __pyx_state is not None: # <<<<<<<<<<<<<< + * __pyx_unpickle_Break__set_state( __pyx_result, __pyx_state) + * return __pyx_result +*/ + __pyx_t_5 = (__pyx_v___pyx_state != ((PyObject*)Py_None)); + if (__pyx_t_5) { + + /* "(tree fragment)":9 + * __pyx_result = Break.__new__(__pyx_type) + * if __pyx_state is not None: + * __pyx_unpickle_Break__set_state( __pyx_result, __pyx_state) # <<<<<<<<<<<<<< + * return __pyx_result + * cdef __pyx_unpickle_Break__set_state(Break __pyx_result, __pyx_state: tuple): +*/ + __pyx_t_2 = __pyx_f_5spacy_8pipeline_17_parser_internals_9arc_eager___pyx_unpickle_Break__set_state(((struct __pyx_obj_5spacy_8pipeline_17_parser_internals_9arc_eager_Break *)__pyx_v___pyx_result), __pyx_v___pyx_state); if (unlikely(!__pyx_t_2)) __PYX_ERR(1, 9, __pyx_L1_error) + __Pyx_GOTREF(__pyx_t_2); + __Pyx_DECREF(__pyx_t_2); __pyx_t_2 = 0; + + /* "(tree fragment)":8 + * __Pyx_CheckUnpickleChecksum(__pyx_checksum, 0xe3b0c44, 0xda39a3e, 0xd41d8cd, b'') + * __pyx_result = Break.__new__(__pyx_type) + * if __pyx_state is not None: # <<<<<<<<<<<<<< + * __pyx_unpickle_Break__set_state( __pyx_result, __pyx_state) + * return __pyx_result +*/ + } + + /* "(tree fragment)":10 + * if __pyx_state is not None: + * __pyx_unpickle_Break__set_state( __pyx_result, __pyx_state) + * return __pyx_result # <<<<<<<<<<<<<< + * cdef __pyx_unpickle_Break__set_state(Break __pyx_result, __pyx_state: tuple): + * __Pyx_UpdateUnpickledDict(__pyx_result, __pyx_state, 0) +*/ + __Pyx_XDECREF(__pyx_r); + __Pyx_INCREF(__pyx_v___pyx_result); + __pyx_r = __pyx_v___pyx_result; + goto __pyx_L0; + + /* "(tree fragment)":4 + * int __Pyx_CheckUnpickleChecksum(long, long, long, long, const char*) except -1 + * int __Pyx_UpdateUnpickledDict(object, object, Py_ssize_t) except -1 + * def __pyx_unpickle_Break(__pyx_type, long __pyx_checksum, tuple __pyx_state): # <<<<<<<<<<<<<< + * cdef object __pyx_result + * __Pyx_CheckUnpickleChecksum(__pyx_checksum, 0xe3b0c44, 0xda39a3e, 0xd41d8cd, b'') +*/ + + /* function exit code */ + __pyx_L1_error:; + __Pyx_XDECREF(__pyx_t_2); + __Pyx_XDECREF(__pyx_t_3); + __Pyx_AddTraceback("spacy.pipeline._parser_internals.arc_eager.__pyx_unpickle_Break", __pyx_clineno, __pyx_lineno, __pyx_filename); + __pyx_r = NULL; + __pyx_L0:; + __Pyx_XDECREF(__pyx_v___pyx_result); + __Pyx_XGIVEREF(__pyx_r); + __Pyx_RefNannyFinishContext(); + return __pyx_r; +} + +/* "(tree fragment)":11 + * __pyx_unpickle_Break__set_state( __pyx_result, __pyx_state) + * return __pyx_result + * cdef __pyx_unpickle_Break__set_state(Break __pyx_result, __pyx_state: tuple): # <<<<<<<<<<<<<< + * __Pyx_UpdateUnpickledDict(__pyx_result, __pyx_state, 0) +*/ + +static PyObject *__pyx_f_5spacy_8pipeline_17_parser_internals_9arc_eager___pyx_unpickle_Break__set_state(struct __pyx_obj_5spacy_8pipeline_17_parser_internals_9arc_eager_Break *__pyx_v___pyx_result, PyObject *__pyx_v___pyx_state) { + PyObject *__pyx_r = NULL; + __Pyx_RefNannyDeclarations + int __pyx_t_1; + int __pyx_lineno = 0; + const char *__pyx_filename = NULL; + int __pyx_clineno = 0; + __Pyx_RefNannySetupContext("__pyx_unpickle_Break__set_state", 0); + + /* "(tree fragment)":12 + * return __pyx_result + * cdef __pyx_unpickle_Break__set_state(Break __pyx_result, __pyx_state: tuple): + * __Pyx_UpdateUnpickledDict(__pyx_result, __pyx_state, 0) # <<<<<<<<<<<<<< +*/ + __pyx_t_1 = __Pyx_UpdateUnpickledDict(((PyObject *)__pyx_v___pyx_result), __pyx_v___pyx_state, 0); if (unlikely(__pyx_t_1 == ((int)-1))) __PYX_ERR(1, 12, __pyx_L1_error) + + /* "(tree fragment)":11 + * __pyx_unpickle_Break__set_state( __pyx_result, __pyx_state) + * return __pyx_result + * cdef __pyx_unpickle_Break__set_state(Break __pyx_result, __pyx_state: tuple): # <<<<<<<<<<<<<< + * __Pyx_UpdateUnpickledDict(__pyx_result, __pyx_state, 0) +*/ + + /* function exit code */ + __pyx_r = Py_None; __Pyx_INCREF(Py_None); + goto __pyx_L0; + __pyx_L1_error:; + __Pyx_AddTraceback("spacy.pipeline._parser_internals.arc_eager.__pyx_unpickle_Break__set_state", __pyx_clineno, __pyx_lineno, __pyx_filename); + __pyx_r = 0; + __pyx_L0:; + __Pyx_XGIVEREF(__pyx_r); + __Pyx_RefNannyFinishContext(); + return __pyx_r; +} +/* #### Code section: module_exttypes ### */ +static struct __pyx_vtabstruct_5spacy_8pipeline_17_parser_internals_9arc_eager_ArcEager __pyx_vtable_5spacy_8pipeline_17_parser_internals_9arc_eager_ArcEager; + +static PyObject *__pyx_tp_new_5spacy_8pipeline_17_parser_internals_9arc_eager_ArcEager(PyTypeObject *t, PyObject *a, PyObject *k) { + struct __pyx_obj_5spacy_8pipeline_17_parser_internals_9arc_eager_ArcEager *p; + PyObject *o = __Pyx_PyType_GetSlot(__pyx_mstate_global->__pyx_ptype_5spacy_8pipeline_17_parser_internals_17transition_system_TransitionSystem, tp_new, newfunc)(t, a, k); + if (unlikely(!o)) return 0; + p = ((struct __pyx_obj_5spacy_8pipeline_17_parser_internals_9arc_eager_ArcEager *)o); + p->__pyx_base.__pyx_vtab = (struct __pyx_vtabstruct_5spacy_8pipeline_17_parser_internals_17transition_system_TransitionSystem*)__pyx_vtabptr_5spacy_8pipeline_17_parser_internals_9arc_eager_ArcEager; + return o; +} + +static void __pyx_tp_dealloc_5spacy_8pipeline_17_parser_internals_9arc_eager_ArcEager(PyObject *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_5spacy_8pipeline_17_parser_internals_9arc_eager_ArcEager) { + if (PyObject_CallFinalizerFromDealloc(o)) return; + } + } + #endif + PyObject_GC_UnTrack(o); + if (PyType_IS_GC(__pyx_mstate_global->__pyx_ptype_5spacy_8pipeline_17_parser_internals_17transition_system_TransitionSystem)) PyObject_GC_Track(o); + #if !CYTHON_USE_MODULE_STATE + if (likely(__pyx_mstate_global->__pyx_ptype_5spacy_8pipeline_17_parser_internals_17transition_system_TransitionSystem)) __Pyx_PyType_GetSlot(__pyx_mstate_global->__pyx_ptype_5spacy_8pipeline_17_parser_internals_17transition_system_TransitionSystem, tp_dealloc, destructor)(o); else + #endif + __Pyx_call_next_tp_dealloc(o, __pyx_tp_dealloc_5spacy_8pipeline_17_parser_internals_9arc_eager_ArcEager); +} + +static int __pyx_tp_traverse_5spacy_8pipeline_17_parser_internals_9arc_eager_ArcEager(PyObject *o, visitproc v, void *a) { + int e; + #if !CYTHON_USE_MODULE_STATE + e = 0; + if (likely(__pyx_mstate_global->__pyx_ptype_5spacy_8pipeline_17_parser_internals_17transition_system_TransitionSystem)) { + traverseproc traverse = __Pyx_PyType_GetSlot(__pyx_mstate_global->__pyx_ptype_5spacy_8pipeline_17_parser_internals_17transition_system_TransitionSystem, tp_traverse, traverseproc); + if (traverse) { e = traverse(o, v, a); } + } else + #endif + { e = __Pyx_call_next_tp_traverse(o, v, a, __pyx_tp_traverse_5spacy_8pipeline_17_parser_internals_9arc_eager_ArcEager); } + if (e) return e; + { + e = __Pyx_call_type_traverse(o, 0, v, a); + if (e) return e; + } + return 0; +} + +static int __pyx_tp_clear_5spacy_8pipeline_17_parser_internals_9arc_eager_ArcEager(PyObject *o) { + #if !CYTHON_USE_MODULE_STATE + if (likely(__pyx_mstate_global->__pyx_ptype_5spacy_8pipeline_17_parser_internals_17transition_system_TransitionSystem)) { + inquiry clear = __Pyx_PyType_GetSlot(__pyx_mstate_global->__pyx_ptype_5spacy_8pipeline_17_parser_internals_17transition_system_TransitionSystem, tp_clear, inquiry); + if (clear) clear(o); + } else + #endif + { __Pyx_call_next_tp_clear(o, __pyx_tp_clear_5spacy_8pipeline_17_parser_internals_9arc_eager_ArcEager); } + return 0; +} + +static PyObject *__pyx_getprop_5spacy_8pipeline_17_parser_internals_9arc_eager_8ArcEager_builtin_labels(PyObject *o, CYTHON_UNUSED void *x) { + return __pyx_pw_5spacy_8pipeline_17_parser_internals_9arc_eager_8ArcEager_14builtin_labels_1__get__(o); +} + +static PyObject *__pyx_getprop_5spacy_8pipeline_17_parser_internals_9arc_eager_8ArcEager_action_types(PyObject *o, CYTHON_UNUSED void *x) { + return __pyx_pw_5spacy_8pipeline_17_parser_internals_9arc_eager_8ArcEager_12action_types_1__get__(o); +} + +static PyMethodDef __pyx_methods_5spacy_8pipeline_17_parser_internals_9arc_eager_ArcEager[] = { + {"get_actions", (PyCFunction)(void(*)(void))(__Pyx_PyCFunction_FastCallWithKeywords)__pyx_pw_5spacy_8pipeline_17_parser_internals_9arc_eager_8ArcEager_3get_actions, __Pyx_METH_FASTCALL|METH_KEYWORDS, __pyx_doc_5spacy_8pipeline_17_parser_internals_9arc_eager_8ArcEager_2get_actions}, + {"get_doc_labels", (PyCFunction)(void(*)(void))(__Pyx_PyCFunction_FastCallWithKeywords)__pyx_pw_5spacy_8pipeline_17_parser_internals_9arc_eager_8ArcEager_5get_doc_labels, __Pyx_METH_FASTCALL|METH_KEYWORDS, __pyx_doc_5spacy_8pipeline_17_parser_internals_9arc_eager_8ArcEager_4get_doc_labels}, + {"transition", (PyCFunction)(void(*)(void))(__Pyx_PyCFunction_FastCallWithKeywords)__pyx_pw_5spacy_8pipeline_17_parser_internals_9arc_eager_8ArcEager_7transition, __Pyx_METH_FASTCALL|METH_KEYWORDS, __pyx_doc_5spacy_8pipeline_17_parser_internals_9arc_eager_8ArcEager_6transition}, + {"is_gold_parse", (PyCFunction)(void(*)(void))(__Pyx_PyCFunction_FastCallWithKeywords)__pyx_pw_5spacy_8pipeline_17_parser_internals_9arc_eager_8ArcEager_9is_gold_parse, __Pyx_METH_FASTCALL|METH_KEYWORDS, __pyx_doc_5spacy_8pipeline_17_parser_internals_9arc_eager_8ArcEager_8is_gold_parse}, + {"init_gold", (PyCFunction)(void(*)(void))(__Pyx_PyCFunction_FastCallWithKeywords)__pyx_pw_5spacy_8pipeline_17_parser_internals_9arc_eager_8ArcEager_11init_gold, __Pyx_METH_FASTCALL|METH_KEYWORDS, __pyx_doc_5spacy_8pipeline_17_parser_internals_9arc_eager_8ArcEager_10init_gold}, + {"init_gold_batch", (PyCFunction)(void(*)(void))(__Pyx_PyCFunction_FastCallWithKeywords)__pyx_pw_5spacy_8pipeline_17_parser_internals_9arc_eager_8ArcEager_13init_gold_batch, __Pyx_METH_FASTCALL|METH_KEYWORDS, __pyx_doc_5spacy_8pipeline_17_parser_internals_9arc_eager_8ArcEager_12init_gold_batch}, + {"_replace_unseen_labels", (PyCFunction)(void(*)(void))(__Pyx_PyCFunction_FastCallWithKeywords)__pyx_pw_5spacy_8pipeline_17_parser_internals_9arc_eager_8ArcEager_15_replace_unseen_labels, __Pyx_METH_FASTCALL|METH_KEYWORDS, __pyx_doc_5spacy_8pipeline_17_parser_internals_9arc_eager_8ArcEager_14_replace_unseen_labels}, + {"move_name", (PyCFunction)(void(*)(void))(__Pyx_PyCFunction_FastCallWithKeywords)__pyx_pw_5spacy_8pipeline_17_parser_internals_9arc_eager_8ArcEager_17move_name, __Pyx_METH_FASTCALL|METH_KEYWORDS, __pyx_doc_5spacy_8pipeline_17_parser_internals_9arc_eager_8ArcEager_16move_name}, + {"class_name", (PyCFunction)(void(*)(void))(__Pyx_PyCFunction_FastCallWithKeywords)__pyx_pw_5spacy_8pipeline_17_parser_internals_9arc_eager_8ArcEager_19class_name, __Pyx_METH_FASTCALL|METH_KEYWORDS, __pyx_doc_5spacy_8pipeline_17_parser_internals_9arc_eager_8ArcEager_18class_name}, + {"set_annotations", (PyCFunction)(void(*)(void))(__Pyx_PyCFunction_FastCallWithKeywords)__pyx_pw_5spacy_8pipeline_17_parser_internals_9arc_eager_8ArcEager_21set_annotations, __Pyx_METH_FASTCALL|METH_KEYWORDS, __pyx_doc_5spacy_8pipeline_17_parser_internals_9arc_eager_8ArcEager_20set_annotations}, + {"get_beam_parses", (PyCFunction)(void(*)(void))(__Pyx_PyCFunction_FastCallWithKeywords)__pyx_pw_5spacy_8pipeline_17_parser_internals_9arc_eager_8ArcEager_23get_beam_parses, __Pyx_METH_FASTCALL|METH_KEYWORDS, __pyx_doc_5spacy_8pipeline_17_parser_internals_9arc_eager_8ArcEager_22get_beam_parses}, + {"has_gold", (PyCFunction)(void(*)(void))(__Pyx_PyCFunction_FastCallWithKeywords)__pyx_pw_5spacy_8pipeline_17_parser_internals_9arc_eager_8ArcEager_25has_gold, __Pyx_METH_FASTCALL|METH_KEYWORDS, __pyx_doc_5spacy_8pipeline_17_parser_internals_9arc_eager_8ArcEager_24has_gold}, + {"get_cost", (PyCFunction)(void(*)(void))(__Pyx_PyCFunction_FastCallWithKeywords)__pyx_pw_5spacy_8pipeline_17_parser_internals_9arc_eager_8ArcEager_27get_cost, __Pyx_METH_FASTCALL|METH_KEYWORDS, __pyx_doc_5spacy_8pipeline_17_parser_internals_9arc_eager_8ArcEager_26get_cost}, + {"get_oracle_sequence_from_state", (PyCFunction)(void(*)(void))(__Pyx_PyCFunction_FastCallWithKeywords)__pyx_pw_5spacy_8pipeline_17_parser_internals_9arc_eager_8ArcEager_29get_oracle_sequence_from_state, __Pyx_METH_FASTCALL|METH_KEYWORDS, __pyx_doc_5spacy_8pipeline_17_parser_internals_9arc_eager_8ArcEager_28get_oracle_sequence_from_state}, + {"__reduce_cython__", (PyCFunction)(void(*)(void))(__Pyx_PyCFunction_FastCallWithKeywords)__pyx_pw_5spacy_8pipeline_17_parser_internals_9arc_eager_8ArcEager_31__reduce_cython__, __Pyx_METH_FASTCALL|METH_KEYWORDS, __pyx_doc_5spacy_8pipeline_17_parser_internals_9arc_eager_8ArcEager_30__reduce_cython__}, + {"__setstate_cython__", (PyCFunction)(void(*)(void))(__Pyx_PyCFunction_FastCallWithKeywords)__pyx_pw_5spacy_8pipeline_17_parser_internals_9arc_eager_8ArcEager_33__setstate_cython__, __Pyx_METH_FASTCALL|METH_KEYWORDS, __pyx_doc_5spacy_8pipeline_17_parser_internals_9arc_eager_8ArcEager_32__setstate_cython__}, + {0, 0, 0, 0} +}; + +static struct PyGetSetDef __pyx_getsets_5spacy_8pipeline_17_parser_internals_9arc_eager_ArcEager[] = { + {"builtin_labels", __pyx_getprop_5spacy_8pipeline_17_parser_internals_9arc_eager_8ArcEager_builtin_labels, 0, 0, 0}, + {"action_types", __pyx_getprop_5spacy_8pipeline_17_parser_internals_9arc_eager_8ArcEager_action_types, 0, 0, 0}, + {0, 0, 0, 0, 0} +}; +#if CYTHON_USE_TYPE_SPECS +static PyType_Slot __pyx_type_5spacy_8pipeline_17_parser_internals_9arc_eager_ArcEager_slots[] = { + {Py_tp_dealloc, (void *)__pyx_tp_dealloc_5spacy_8pipeline_17_parser_internals_9arc_eager_ArcEager}, + {Py_tp_doc, (void *)PyDoc_STR("ArcEager(*args, **kwargs)")}, + {Py_tp_traverse, (void *)__pyx_tp_traverse_5spacy_8pipeline_17_parser_internals_9arc_eager_ArcEager}, + {Py_tp_clear, (void *)__pyx_tp_clear_5spacy_8pipeline_17_parser_internals_9arc_eager_ArcEager}, + {Py_tp_methods, (void *)__pyx_methods_5spacy_8pipeline_17_parser_internals_9arc_eager_ArcEager}, + {Py_tp_getset, (void *)__pyx_getsets_5spacy_8pipeline_17_parser_internals_9arc_eager_ArcEager}, + {Py_tp_init, (void *)__pyx_pw_5spacy_8pipeline_17_parser_internals_9arc_eager_8ArcEager_1__init__}, + {Py_tp_new, (void *)__pyx_tp_new_5spacy_8pipeline_17_parser_internals_9arc_eager_ArcEager}, + {0, 0}, +}; +static PyType_Spec __pyx_type_5spacy_8pipeline_17_parser_internals_9arc_eager_ArcEager_spec = { + "spacy.pipeline._parser_internals.arc_eager.ArcEager", + sizeof(struct __pyx_obj_5spacy_8pipeline_17_parser_internals_9arc_eager_ArcEager), + 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_5spacy_8pipeline_17_parser_internals_9arc_eager_ArcEager_slots, +}; +#else + +static PyTypeObject __pyx_type_5spacy_8pipeline_17_parser_internals_9arc_eager_ArcEager = { + PyVarObject_HEAD_INIT(0, 0) + "spacy.pipeline._parser_internals.arc_eager.""ArcEager", /*tp_name*/ + sizeof(struct __pyx_obj_5spacy_8pipeline_17_parser_internals_9arc_eager_ArcEager), /*tp_basicsize*/ + 0, /*tp_itemsize*/ + __pyx_tp_dealloc_5spacy_8pipeline_17_parser_internals_9arc_eager_ArcEager, /*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("ArcEager(*args, **kwargs)"), /*tp_doc*/ + __pyx_tp_traverse_5spacy_8pipeline_17_parser_internals_9arc_eager_ArcEager, /*tp_traverse*/ + __pyx_tp_clear_5spacy_8pipeline_17_parser_internals_9arc_eager_ArcEager, /*tp_clear*/ + 0, /*tp_richcompare*/ + 0, /*tp_weaklistoffset*/ + 0, /*tp_iter*/ + 0, /*tp_iternext*/ + __pyx_methods_5spacy_8pipeline_17_parser_internals_9arc_eager_ArcEager, /*tp_methods*/ + 0, /*tp_members*/ + __pyx_getsets_5spacy_8pipeline_17_parser_internals_9arc_eager_ArcEager, /*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_5spacy_8pipeline_17_parser_internals_9arc_eager_8ArcEager_1__init__, /*tp_init*/ + 0, /*tp_alloc*/ + __pyx_tp_new_5spacy_8pipeline_17_parser_internals_9arc_eager_ArcEager, /*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_5spacy_8pipeline_17_parser_internals_9arc_eager_ArcEagerGold(PyTypeObject *t, CYTHON_UNUSED PyObject *a, CYTHON_UNUSED PyObject *k) { + struct __pyx_obj_5spacy_8pipeline_17_parser_internals_9arc_eager_ArcEagerGold *p; + PyObject *o; + o = __Pyx_AllocateExtensionType(t, 0); + if (unlikely(!o)) return 0; + p = ((struct __pyx_obj_5spacy_8pipeline_17_parser_internals_9arc_eager_ArcEagerGold *)o); + __Pyx_default_placement_construct(&(p->c)); + p->mem = ((struct __pyx_obj_5cymem_5cymem_Pool *)Py_None); Py_INCREF(Py_None); + return o; +} + +static void __pyx_tp_dealloc_5spacy_8pipeline_17_parser_internals_9arc_eager_ArcEagerGold(PyObject *o) { + struct __pyx_obj_5spacy_8pipeline_17_parser_internals_9arc_eager_ArcEagerGold *p = (struct __pyx_obj_5spacy_8pipeline_17_parser_internals_9arc_eager_ArcEagerGold *)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_5spacy_8pipeline_17_parser_internals_9arc_eager_ArcEagerGold) { + if (PyObject_CallFinalizerFromDealloc(o)) return; + } + } + #endif + PyObject_GC_UnTrack(o); + __Pyx_call_destructor(p->c); + Py_CLEAR(p->mem); + 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_5spacy_8pipeline_17_parser_internals_9arc_eager_ArcEagerGold(PyObject *o, visitproc v, void *a) { + int e; + struct __pyx_obj_5spacy_8pipeline_17_parser_internals_9arc_eager_ArcEagerGold *p = (struct __pyx_obj_5spacy_8pipeline_17_parser_internals_9arc_eager_ArcEagerGold *)o; + { + e = __Pyx_call_type_traverse(o, 1, v, a); + if (e) return e; + } + if (p->mem) { + e = (*v)(((PyObject *)p->mem), a); if (e) return e; + } + return 0; +} + +static int __pyx_tp_clear_5spacy_8pipeline_17_parser_internals_9arc_eager_ArcEagerGold(PyObject *o) { + PyObject* tmp; + struct __pyx_obj_5spacy_8pipeline_17_parser_internals_9arc_eager_ArcEagerGold *p = (struct __pyx_obj_5spacy_8pipeline_17_parser_internals_9arc_eager_ArcEagerGold *)o; + tmp = ((PyObject*)p->mem); + p->mem = ((struct __pyx_obj_5cymem_5cymem_Pool *)Py_None); Py_INCREF(Py_None); + Py_XDECREF(tmp); + return 0; +} + +static PyMethodDef __pyx_methods_5spacy_8pipeline_17_parser_internals_9arc_eager_ArcEagerGold[] = { + {"update", (PyCFunction)(void(*)(void))(__Pyx_PyCFunction_FastCallWithKeywords)__pyx_pw_5spacy_8pipeline_17_parser_internals_9arc_eager_12ArcEagerGold_3update, __Pyx_METH_FASTCALL|METH_KEYWORDS, __pyx_doc_5spacy_8pipeline_17_parser_internals_9arc_eager_12ArcEagerGold_2update}, + {"__reduce_cython__", (PyCFunction)(void(*)(void))(__Pyx_PyCFunction_FastCallWithKeywords)__pyx_pw_5spacy_8pipeline_17_parser_internals_9arc_eager_12ArcEagerGold_5__reduce_cython__, __Pyx_METH_FASTCALL|METH_KEYWORDS, __pyx_doc_5spacy_8pipeline_17_parser_internals_9arc_eager_12ArcEagerGold_4__reduce_cython__}, + {"__setstate_cython__", (PyCFunction)(void(*)(void))(__Pyx_PyCFunction_FastCallWithKeywords)__pyx_pw_5spacy_8pipeline_17_parser_internals_9arc_eager_12ArcEagerGold_7__setstate_cython__, __Pyx_METH_FASTCALL|METH_KEYWORDS, __pyx_doc_5spacy_8pipeline_17_parser_internals_9arc_eager_12ArcEagerGold_6__setstate_cython__}, + {0, 0, 0, 0} +}; +#if CYTHON_USE_TYPE_SPECS +static PyType_Slot __pyx_type_5spacy_8pipeline_17_parser_internals_9arc_eager_ArcEagerGold_slots[] = { + {Py_tp_dealloc, (void *)__pyx_tp_dealloc_5spacy_8pipeline_17_parser_internals_9arc_eager_ArcEagerGold}, + {Py_tp_doc, (void *)PyDoc_STR("ArcEagerGold(ArcEager moves, StateClass stcls, Example example)")}, + {Py_tp_traverse, (void *)__pyx_tp_traverse_5spacy_8pipeline_17_parser_internals_9arc_eager_ArcEagerGold}, + {Py_tp_clear, (void *)__pyx_tp_clear_5spacy_8pipeline_17_parser_internals_9arc_eager_ArcEagerGold}, + {Py_tp_methods, (void *)__pyx_methods_5spacy_8pipeline_17_parser_internals_9arc_eager_ArcEagerGold}, + {Py_tp_init, (void *)__pyx_pw_5spacy_8pipeline_17_parser_internals_9arc_eager_12ArcEagerGold_1__init__}, + {Py_tp_new, (void *)__pyx_tp_new_5spacy_8pipeline_17_parser_internals_9arc_eager_ArcEagerGold}, + {0, 0}, +}; +static PyType_Spec __pyx_type_5spacy_8pipeline_17_parser_internals_9arc_eager_ArcEagerGold_spec = { + "spacy.pipeline._parser_internals.arc_eager.ArcEagerGold", + sizeof(struct __pyx_obj_5spacy_8pipeline_17_parser_internals_9arc_eager_ArcEagerGold), + 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_5spacy_8pipeline_17_parser_internals_9arc_eager_ArcEagerGold_slots, +}; +#else + +static PyTypeObject __pyx_type_5spacy_8pipeline_17_parser_internals_9arc_eager_ArcEagerGold = { + PyVarObject_HEAD_INIT(0, 0) + "spacy.pipeline._parser_internals.arc_eager.""ArcEagerGold", /*tp_name*/ + sizeof(struct __pyx_obj_5spacy_8pipeline_17_parser_internals_9arc_eager_ArcEagerGold), /*tp_basicsize*/ + 0, /*tp_itemsize*/ + __pyx_tp_dealloc_5spacy_8pipeline_17_parser_internals_9arc_eager_ArcEagerGold, /*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("ArcEagerGold(ArcEager moves, StateClass stcls, Example example)"), /*tp_doc*/ + __pyx_tp_traverse_5spacy_8pipeline_17_parser_internals_9arc_eager_ArcEagerGold, /*tp_traverse*/ + __pyx_tp_clear_5spacy_8pipeline_17_parser_internals_9arc_eager_ArcEagerGold, /*tp_clear*/ + 0, /*tp_richcompare*/ + 0, /*tp_weaklistoffset*/ + 0, /*tp_iter*/ + 0, /*tp_iternext*/ + __pyx_methods_5spacy_8pipeline_17_parser_internals_9arc_eager_ArcEagerGold, /*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_5spacy_8pipeline_17_parser_internals_9arc_eager_12ArcEagerGold_1__init__, /*tp_init*/ + 0, /*tp_alloc*/ + __pyx_tp_new_5spacy_8pipeline_17_parser_internals_9arc_eager_ArcEagerGold, /*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 struct __pyx_vtabstruct_5spacy_8pipeline_17_parser_internals_9arc_eager_Shift __pyx_vtable_5spacy_8pipeline_17_parser_internals_9arc_eager_Shift; + +static PyObject *__pyx_tp_new_5spacy_8pipeline_17_parser_internals_9arc_eager_Shift(PyTypeObject *t, CYTHON_UNUSED PyObject *a, CYTHON_UNUSED PyObject *k) { + struct __pyx_obj_5spacy_8pipeline_17_parser_internals_9arc_eager_Shift *p; + PyObject *o; + o = __Pyx_AllocateExtensionType(t, 0); + if (unlikely(!o)) return 0; + p = ((struct __pyx_obj_5spacy_8pipeline_17_parser_internals_9arc_eager_Shift *)o); + p->__pyx_vtab = __pyx_vtabptr_5spacy_8pipeline_17_parser_internals_9arc_eager_Shift; + return o; +} + +static void __pyx_tp_dealloc_5spacy_8pipeline_17_parser_internals_9arc_eager_Shift(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_5spacy_8pipeline_17_parser_internals_9arc_eager_Shift) { + if (PyObject_CallFinalizerFromDealloc(o)) return; + } + } + #endif + 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_5spacy_8pipeline_17_parser_internals_9arc_eager_Shift[] = { + {"__reduce_cython__", (PyCFunction)(void(*)(void))(__Pyx_PyCFunction_FastCallWithKeywords)__pyx_pw_5spacy_8pipeline_17_parser_internals_9arc_eager_5Shift_1__reduce_cython__, __Pyx_METH_FASTCALL|METH_KEYWORDS, __pyx_doc_5spacy_8pipeline_17_parser_internals_9arc_eager_5Shift___reduce_cython__}, + {"__setstate_cython__", (PyCFunction)(void(*)(void))(__Pyx_PyCFunction_FastCallWithKeywords)__pyx_pw_5spacy_8pipeline_17_parser_internals_9arc_eager_5Shift_3__setstate_cython__, __Pyx_METH_FASTCALL|METH_KEYWORDS, __pyx_doc_5spacy_8pipeline_17_parser_internals_9arc_eager_5Shift_2__setstate_cython__}, + {0, 0, 0, 0} +}; +#if CYTHON_USE_TYPE_SPECS +static PyType_Slot __pyx_type_5spacy_8pipeline_17_parser_internals_9arc_eager_Shift_slots[] = { + {Py_tp_dealloc, (void *)__pyx_tp_dealloc_5spacy_8pipeline_17_parser_internals_9arc_eager_Shift}, + {Py_tp_doc, (void *)PyDoc_STR("Move the first word of the buffer onto the stack and mark it as \"shifted\"\n\n Validity:\n * If stack is empty\n * At least two words in sentence\n * Word has not been shifted before\n\n Cost: push_cost \n\n Action:\n * Mark B[0] as 'shifted'\n * Push stack\n * Advance buffer\n ")}, + {Py_tp_methods, (void *)__pyx_methods_5spacy_8pipeline_17_parser_internals_9arc_eager_Shift}, + {Py_tp_new, (void *)__pyx_tp_new_5spacy_8pipeline_17_parser_internals_9arc_eager_Shift}, + {0, 0}, +}; +static PyType_Spec __pyx_type_5spacy_8pipeline_17_parser_internals_9arc_eager_Shift_spec = { + "spacy.pipeline._parser_internals.arc_eager.Shift", + sizeof(struct __pyx_obj_5spacy_8pipeline_17_parser_internals_9arc_eager_Shift), + 0, + Py_TPFLAGS_DEFAULT|Py_TPFLAGS_HAVE_VERSION_TAG|Py_TPFLAGS_CHECKTYPES|Py_TPFLAGS_HAVE_NEWBUFFER|Py_TPFLAGS_BASETYPE, + __pyx_type_5spacy_8pipeline_17_parser_internals_9arc_eager_Shift_slots, +}; +#else + +static PyTypeObject __pyx_type_5spacy_8pipeline_17_parser_internals_9arc_eager_Shift = { + PyVarObject_HEAD_INIT(0, 0) + "spacy.pipeline._parser_internals.arc_eager.""Shift", /*tp_name*/ + sizeof(struct __pyx_obj_5spacy_8pipeline_17_parser_internals_9arc_eager_Shift), /*tp_basicsize*/ + 0, /*tp_itemsize*/ + __pyx_tp_dealloc_5spacy_8pipeline_17_parser_internals_9arc_eager_Shift, /*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*/ + PyDoc_STR("Move the first word of the buffer onto the stack and mark it as \"shifted\"\n\n Validity:\n * If stack is empty\n * At least two words in sentence\n * Word has not been shifted before\n\n Cost: push_cost \n\n Action:\n * Mark B[0] as 'shifted'\n * Push stack\n * Advance buffer\n "), /*tp_doc*/ + 0, /*tp_traverse*/ + 0, /*tp_clear*/ + 0, /*tp_richcompare*/ + 0, /*tp_weaklistoffset*/ + 0, /*tp_iter*/ + 0, /*tp_iternext*/ + __pyx_methods_5spacy_8pipeline_17_parser_internals_9arc_eager_Shift, /*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_5spacy_8pipeline_17_parser_internals_9arc_eager_Shift, /*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 struct __pyx_vtabstruct_5spacy_8pipeline_17_parser_internals_9arc_eager_Reduce __pyx_vtable_5spacy_8pipeline_17_parser_internals_9arc_eager_Reduce; + +static PyObject *__pyx_tp_new_5spacy_8pipeline_17_parser_internals_9arc_eager_Reduce(PyTypeObject *t, CYTHON_UNUSED PyObject *a, CYTHON_UNUSED PyObject *k) { + struct __pyx_obj_5spacy_8pipeline_17_parser_internals_9arc_eager_Reduce *p; + PyObject *o; + o = __Pyx_AllocateExtensionType(t, 0); + if (unlikely(!o)) return 0; + p = ((struct __pyx_obj_5spacy_8pipeline_17_parser_internals_9arc_eager_Reduce *)o); + p->__pyx_vtab = __pyx_vtabptr_5spacy_8pipeline_17_parser_internals_9arc_eager_Reduce; + return o; +} + +static void __pyx_tp_dealloc_5spacy_8pipeline_17_parser_internals_9arc_eager_Reduce(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_5spacy_8pipeline_17_parser_internals_9arc_eager_Reduce) { + if (PyObject_CallFinalizerFromDealloc(o)) return; + } + } + #endif + 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_5spacy_8pipeline_17_parser_internals_9arc_eager_Reduce[] = { + {"__reduce_cython__", (PyCFunction)(void(*)(void))(__Pyx_PyCFunction_FastCallWithKeywords)__pyx_pw_5spacy_8pipeline_17_parser_internals_9arc_eager_6Reduce_1__reduce_cython__, __Pyx_METH_FASTCALL|METH_KEYWORDS, __pyx_doc_5spacy_8pipeline_17_parser_internals_9arc_eager_6Reduce___reduce_cython__}, + {"__setstate_cython__", (PyCFunction)(void(*)(void))(__Pyx_PyCFunction_FastCallWithKeywords)__pyx_pw_5spacy_8pipeline_17_parser_internals_9arc_eager_6Reduce_3__setstate_cython__, __Pyx_METH_FASTCALL|METH_KEYWORDS, __pyx_doc_5spacy_8pipeline_17_parser_internals_9arc_eager_6Reduce_2__setstate_cython__}, + {0, 0, 0, 0} +}; +#if CYTHON_USE_TYPE_SPECS +static PyType_Slot __pyx_type_5spacy_8pipeline_17_parser_internals_9arc_eager_Reduce_slots[] = { + {Py_tp_dealloc, (void *)__pyx_tp_dealloc_5spacy_8pipeline_17_parser_internals_9arc_eager_Reduce}, + {Py_tp_doc, (void *)PyDoc_STR("\n Pop from the stack. If it has no head and the stack isn't empty, place\n it back on the buffer.\n\n Validity:\n * Stack not empty\n * Buffer nt empty\n * Stack depth 1 and cannot sent start l_edge(st.B(0))\n\n Cost:\n * If B[0] is the start of a sentence, cost is 0\n * Arcs between stack and buffer\n * If arc has no head, we're saving arcs between S[0] and S[1:], so decrement\n cost by those arcs.\n ")}, + {Py_tp_methods, (void *)__pyx_methods_5spacy_8pipeline_17_parser_internals_9arc_eager_Reduce}, + {Py_tp_new, (void *)__pyx_tp_new_5spacy_8pipeline_17_parser_internals_9arc_eager_Reduce}, + {0, 0}, +}; +static PyType_Spec __pyx_type_5spacy_8pipeline_17_parser_internals_9arc_eager_Reduce_spec = { + "spacy.pipeline._parser_internals.arc_eager.Reduce", + sizeof(struct __pyx_obj_5spacy_8pipeline_17_parser_internals_9arc_eager_Reduce), + 0, + Py_TPFLAGS_DEFAULT|Py_TPFLAGS_HAVE_VERSION_TAG|Py_TPFLAGS_CHECKTYPES|Py_TPFLAGS_HAVE_NEWBUFFER|Py_TPFLAGS_BASETYPE, + __pyx_type_5spacy_8pipeline_17_parser_internals_9arc_eager_Reduce_slots, +}; +#else + +static PyTypeObject __pyx_type_5spacy_8pipeline_17_parser_internals_9arc_eager_Reduce = { + PyVarObject_HEAD_INIT(0, 0) + "spacy.pipeline._parser_internals.arc_eager.""Reduce", /*tp_name*/ + sizeof(struct __pyx_obj_5spacy_8pipeline_17_parser_internals_9arc_eager_Reduce), /*tp_basicsize*/ + 0, /*tp_itemsize*/ + __pyx_tp_dealloc_5spacy_8pipeline_17_parser_internals_9arc_eager_Reduce, /*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*/ + PyDoc_STR("\n Pop from the stack. If it has no head and the stack isn't empty, place\n it back on the buffer.\n\n Validity:\n * Stack not empty\n * Buffer nt empty\n * Stack depth 1 and cannot sent start l_edge(st.B(0))\n\n Cost:\n * If B[0] is the start of a sentence, cost is 0\n * Arcs between stack and buffer\n * If arc has no head, we're saving arcs between S[0] and S[1:], so decrement\n cost by those arcs.\n "), /*tp_doc*/ + 0, /*tp_traverse*/ + 0, /*tp_clear*/ + 0, /*tp_richcompare*/ + 0, /*tp_weaklistoffset*/ + 0, /*tp_iter*/ + 0, /*tp_iternext*/ + __pyx_methods_5spacy_8pipeline_17_parser_internals_9arc_eager_Reduce, /*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_5spacy_8pipeline_17_parser_internals_9arc_eager_Reduce, /*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 struct __pyx_vtabstruct_5spacy_8pipeline_17_parser_internals_9arc_eager_LeftArc __pyx_vtable_5spacy_8pipeline_17_parser_internals_9arc_eager_LeftArc; + +static PyObject *__pyx_tp_new_5spacy_8pipeline_17_parser_internals_9arc_eager_LeftArc(PyTypeObject *t, CYTHON_UNUSED PyObject *a, CYTHON_UNUSED PyObject *k) { + struct __pyx_obj_5spacy_8pipeline_17_parser_internals_9arc_eager_LeftArc *p; + PyObject *o; + o = __Pyx_AllocateExtensionType(t, 0); + if (unlikely(!o)) return 0; + p = ((struct __pyx_obj_5spacy_8pipeline_17_parser_internals_9arc_eager_LeftArc *)o); + p->__pyx_vtab = __pyx_vtabptr_5spacy_8pipeline_17_parser_internals_9arc_eager_LeftArc; + return o; +} + +static void __pyx_tp_dealloc_5spacy_8pipeline_17_parser_internals_9arc_eager_LeftArc(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_5spacy_8pipeline_17_parser_internals_9arc_eager_LeftArc) { + if (PyObject_CallFinalizerFromDealloc(o)) return; + } + } + #endif + 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_5spacy_8pipeline_17_parser_internals_9arc_eager_LeftArc[] = { + {"__reduce_cython__", (PyCFunction)(void(*)(void))(__Pyx_PyCFunction_FastCallWithKeywords)__pyx_pw_5spacy_8pipeline_17_parser_internals_9arc_eager_7LeftArc_1__reduce_cython__, __Pyx_METH_FASTCALL|METH_KEYWORDS, __pyx_doc_5spacy_8pipeline_17_parser_internals_9arc_eager_7LeftArc___reduce_cython__}, + {"__setstate_cython__", (PyCFunction)(void(*)(void))(__Pyx_PyCFunction_FastCallWithKeywords)__pyx_pw_5spacy_8pipeline_17_parser_internals_9arc_eager_7LeftArc_3__setstate_cython__, __Pyx_METH_FASTCALL|METH_KEYWORDS, __pyx_doc_5spacy_8pipeline_17_parser_internals_9arc_eager_7LeftArc_2__setstate_cython__}, + {0, 0, 0, 0} +}; +#if CYTHON_USE_TYPE_SPECS +static PyType_Slot __pyx_type_5spacy_8pipeline_17_parser_internals_9arc_eager_LeftArc_slots[] = { + {Py_tp_dealloc, (void *)__pyx_tp_dealloc_5spacy_8pipeline_17_parser_internals_9arc_eager_LeftArc}, + {Py_tp_doc, (void *)PyDoc_STR("Add an arc between B[0] and S[0], replacing the previous head of S[0] if\n one is set. Pop S[0] from the stack.\n\n Validity:\n * len(S) >= 1\n * len(B) >= 1\n * not is_sent_start(B[0])\n\n Cost:\n pop_cost - Arc(B[0], S[0], label) + (Arc(S[1], S[0]) if H(S[0]) else Arcs(S, S[0]))\n ")}, + {Py_tp_methods, (void *)__pyx_methods_5spacy_8pipeline_17_parser_internals_9arc_eager_LeftArc}, + {Py_tp_new, (void *)__pyx_tp_new_5spacy_8pipeline_17_parser_internals_9arc_eager_LeftArc}, + {0, 0}, +}; +static PyType_Spec __pyx_type_5spacy_8pipeline_17_parser_internals_9arc_eager_LeftArc_spec = { + "spacy.pipeline._parser_internals.arc_eager.LeftArc", + sizeof(struct __pyx_obj_5spacy_8pipeline_17_parser_internals_9arc_eager_LeftArc), + 0, + Py_TPFLAGS_DEFAULT|Py_TPFLAGS_HAVE_VERSION_TAG|Py_TPFLAGS_CHECKTYPES|Py_TPFLAGS_HAVE_NEWBUFFER|Py_TPFLAGS_BASETYPE, + __pyx_type_5spacy_8pipeline_17_parser_internals_9arc_eager_LeftArc_slots, +}; +#else + +static PyTypeObject __pyx_type_5spacy_8pipeline_17_parser_internals_9arc_eager_LeftArc = { + PyVarObject_HEAD_INIT(0, 0) + "spacy.pipeline._parser_internals.arc_eager.""LeftArc", /*tp_name*/ + sizeof(struct __pyx_obj_5spacy_8pipeline_17_parser_internals_9arc_eager_LeftArc), /*tp_basicsize*/ + 0, /*tp_itemsize*/ + __pyx_tp_dealloc_5spacy_8pipeline_17_parser_internals_9arc_eager_LeftArc, /*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*/ + PyDoc_STR("Add an arc between B[0] and S[0], replacing the previous head of S[0] if\n one is set. Pop S[0] from the stack.\n\n Validity:\n * len(S) >= 1\n * len(B) >= 1\n * not is_sent_start(B[0])\n\n Cost:\n pop_cost - Arc(B[0], S[0], label) + (Arc(S[1], S[0]) if H(S[0]) else Arcs(S, S[0]))\n "), /*tp_doc*/ + 0, /*tp_traverse*/ + 0, /*tp_clear*/ + 0, /*tp_richcompare*/ + 0, /*tp_weaklistoffset*/ + 0, /*tp_iter*/ + 0, /*tp_iternext*/ + __pyx_methods_5spacy_8pipeline_17_parser_internals_9arc_eager_LeftArc, /*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_5spacy_8pipeline_17_parser_internals_9arc_eager_LeftArc, /*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 struct __pyx_vtabstruct_5spacy_8pipeline_17_parser_internals_9arc_eager_RightArc __pyx_vtable_5spacy_8pipeline_17_parser_internals_9arc_eager_RightArc; + +static PyObject *__pyx_tp_new_5spacy_8pipeline_17_parser_internals_9arc_eager_RightArc(PyTypeObject *t, CYTHON_UNUSED PyObject *a, CYTHON_UNUSED PyObject *k) { + struct __pyx_obj_5spacy_8pipeline_17_parser_internals_9arc_eager_RightArc *p; + PyObject *o; + o = __Pyx_AllocateExtensionType(t, 0); + if (unlikely(!o)) return 0; + p = ((struct __pyx_obj_5spacy_8pipeline_17_parser_internals_9arc_eager_RightArc *)o); + p->__pyx_vtab = __pyx_vtabptr_5spacy_8pipeline_17_parser_internals_9arc_eager_RightArc; + return o; +} + +static void __pyx_tp_dealloc_5spacy_8pipeline_17_parser_internals_9arc_eager_RightArc(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_5spacy_8pipeline_17_parser_internals_9arc_eager_RightArc) { + if (PyObject_CallFinalizerFromDealloc(o)) return; + } + } + #endif + 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_5spacy_8pipeline_17_parser_internals_9arc_eager_RightArc[] = { + {"__reduce_cython__", (PyCFunction)(void(*)(void))(__Pyx_PyCFunction_FastCallWithKeywords)__pyx_pw_5spacy_8pipeline_17_parser_internals_9arc_eager_8RightArc_1__reduce_cython__, __Pyx_METH_FASTCALL|METH_KEYWORDS, __pyx_doc_5spacy_8pipeline_17_parser_internals_9arc_eager_8RightArc___reduce_cython__}, + {"__setstate_cython__", (PyCFunction)(void(*)(void))(__Pyx_PyCFunction_FastCallWithKeywords)__pyx_pw_5spacy_8pipeline_17_parser_internals_9arc_eager_8RightArc_3__setstate_cython__, __Pyx_METH_FASTCALL|METH_KEYWORDS, __pyx_doc_5spacy_8pipeline_17_parser_internals_9arc_eager_8RightArc_2__setstate_cython__}, + {0, 0, 0, 0} +}; +#if CYTHON_USE_TYPE_SPECS +static PyType_Slot __pyx_type_5spacy_8pipeline_17_parser_internals_9arc_eager_RightArc_slots[] = { + {Py_tp_dealloc, (void *)__pyx_tp_dealloc_5spacy_8pipeline_17_parser_internals_9arc_eager_RightArc}, + {Py_tp_doc, (void *)PyDoc_STR("\n Add an arc from S[0] to B[0]. Push B[0].\n\n Validity:\n * len(S) >= 1\n * len(B) >= 1\n * not is_sent_start(B[0])\n\n Cost:\n push_cost + (not shifted[b0] and Arc(B[1:], B[0])) - Arc(S[0], B[0], label)\n ")}, + {Py_tp_methods, (void *)__pyx_methods_5spacy_8pipeline_17_parser_internals_9arc_eager_RightArc}, + {Py_tp_new, (void *)__pyx_tp_new_5spacy_8pipeline_17_parser_internals_9arc_eager_RightArc}, + {0, 0}, +}; +static PyType_Spec __pyx_type_5spacy_8pipeline_17_parser_internals_9arc_eager_RightArc_spec = { + "spacy.pipeline._parser_internals.arc_eager.RightArc", + sizeof(struct __pyx_obj_5spacy_8pipeline_17_parser_internals_9arc_eager_RightArc), + 0, + Py_TPFLAGS_DEFAULT|Py_TPFLAGS_HAVE_VERSION_TAG|Py_TPFLAGS_CHECKTYPES|Py_TPFLAGS_HAVE_NEWBUFFER|Py_TPFLAGS_BASETYPE, + __pyx_type_5spacy_8pipeline_17_parser_internals_9arc_eager_RightArc_slots, +}; +#else + +static PyTypeObject __pyx_type_5spacy_8pipeline_17_parser_internals_9arc_eager_RightArc = { + PyVarObject_HEAD_INIT(0, 0) + "spacy.pipeline._parser_internals.arc_eager.""RightArc", /*tp_name*/ + sizeof(struct __pyx_obj_5spacy_8pipeline_17_parser_internals_9arc_eager_RightArc), /*tp_basicsize*/ + 0, /*tp_itemsize*/ + __pyx_tp_dealloc_5spacy_8pipeline_17_parser_internals_9arc_eager_RightArc, /*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*/ + PyDoc_STR("\n Add an arc from S[0] to B[0]. Push B[0].\n\n Validity:\n * len(S) >= 1\n * len(B) >= 1\n * not is_sent_start(B[0])\n\n Cost:\n push_cost + (not shifted[b0] and Arc(B[1:], B[0])) - Arc(S[0], B[0], label)\n "), /*tp_doc*/ + 0, /*tp_traverse*/ + 0, /*tp_clear*/ + 0, /*tp_richcompare*/ + 0, /*tp_weaklistoffset*/ + 0, /*tp_iter*/ + 0, /*tp_iternext*/ + __pyx_methods_5spacy_8pipeline_17_parser_internals_9arc_eager_RightArc, /*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_5spacy_8pipeline_17_parser_internals_9arc_eager_RightArc, /*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 struct __pyx_vtabstruct_5spacy_8pipeline_17_parser_internals_9arc_eager_Break __pyx_vtable_5spacy_8pipeline_17_parser_internals_9arc_eager_Break; + +static PyObject *__pyx_tp_new_5spacy_8pipeline_17_parser_internals_9arc_eager_Break(PyTypeObject *t, CYTHON_UNUSED PyObject *a, CYTHON_UNUSED PyObject *k) { + struct __pyx_obj_5spacy_8pipeline_17_parser_internals_9arc_eager_Break *p; + PyObject *o; + o = __Pyx_AllocateExtensionType(t, 0); + if (unlikely(!o)) return 0; + p = ((struct __pyx_obj_5spacy_8pipeline_17_parser_internals_9arc_eager_Break *)o); + p->__pyx_vtab = __pyx_vtabptr_5spacy_8pipeline_17_parser_internals_9arc_eager_Break; + return o; +} + +static void __pyx_tp_dealloc_5spacy_8pipeline_17_parser_internals_9arc_eager_Break(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_5spacy_8pipeline_17_parser_internals_9arc_eager_Break) { + if (PyObject_CallFinalizerFromDealloc(o)) return; + } + } + #endif + 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_5spacy_8pipeline_17_parser_internals_9arc_eager_Break[] = { + {"__reduce_cython__", (PyCFunction)(void(*)(void))(__Pyx_PyCFunction_FastCallWithKeywords)__pyx_pw_5spacy_8pipeline_17_parser_internals_9arc_eager_5Break_1__reduce_cython__, __Pyx_METH_FASTCALL|METH_KEYWORDS, __pyx_doc_5spacy_8pipeline_17_parser_internals_9arc_eager_5Break___reduce_cython__}, + {"__setstate_cython__", (PyCFunction)(void(*)(void))(__Pyx_PyCFunction_FastCallWithKeywords)__pyx_pw_5spacy_8pipeline_17_parser_internals_9arc_eager_5Break_3__setstate_cython__, __Pyx_METH_FASTCALL|METH_KEYWORDS, __pyx_doc_5spacy_8pipeline_17_parser_internals_9arc_eager_5Break_2__setstate_cython__}, + {0, 0, 0, 0} +}; +#if CYTHON_USE_TYPE_SPECS +static PyType_Slot __pyx_type_5spacy_8pipeline_17_parser_internals_9arc_eager_Break_slots[] = { + {Py_tp_dealloc, (void *)__pyx_tp_dealloc_5spacy_8pipeline_17_parser_internals_9arc_eager_Break}, + {Py_tp_doc, (void *)PyDoc_STR("Mark the second word of the buffer as the start of a \n sentence. \n\n Validity:\n * len(buffer) >= 2\n * B[1] == B[0] + 1\n * not is_sent_start(B[1])\n * not cannot_sent_start(B[1])\n\n Action:\n * mark_sent_start(B[1])\n\n Cost:\n * not is_sent_start(B[1])\n * Arcs between B[0] and B[1:]\n * Arcs between S and B[1]\n ")}, + {Py_tp_methods, (void *)__pyx_methods_5spacy_8pipeline_17_parser_internals_9arc_eager_Break}, + {Py_tp_new, (void *)__pyx_tp_new_5spacy_8pipeline_17_parser_internals_9arc_eager_Break}, + {0, 0}, +}; +static PyType_Spec __pyx_type_5spacy_8pipeline_17_parser_internals_9arc_eager_Break_spec = { + "spacy.pipeline._parser_internals.arc_eager.Break", + sizeof(struct __pyx_obj_5spacy_8pipeline_17_parser_internals_9arc_eager_Break), + 0, + Py_TPFLAGS_DEFAULT|Py_TPFLAGS_HAVE_VERSION_TAG|Py_TPFLAGS_CHECKTYPES|Py_TPFLAGS_HAVE_NEWBUFFER|Py_TPFLAGS_BASETYPE, + __pyx_type_5spacy_8pipeline_17_parser_internals_9arc_eager_Break_slots, +}; +#else + +static PyTypeObject __pyx_type_5spacy_8pipeline_17_parser_internals_9arc_eager_Break = { + PyVarObject_HEAD_INIT(0, 0) + "spacy.pipeline._parser_internals.arc_eager.""Break", /*tp_name*/ + sizeof(struct __pyx_obj_5spacy_8pipeline_17_parser_internals_9arc_eager_Break), /*tp_basicsize*/ + 0, /*tp_itemsize*/ + __pyx_tp_dealloc_5spacy_8pipeline_17_parser_internals_9arc_eager_Break, /*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*/ + PyDoc_STR("Mark the second word of the buffer as the start of a \n sentence. \n\n Validity:\n * len(buffer) >= 2\n * B[1] == B[0] + 1\n * not is_sent_start(B[1])\n * not cannot_sent_start(B[1])\n\n Action:\n * mark_sent_start(B[1])\n\n Cost:\n * not is_sent_start(B[1])\n * Arcs between B[0] and B[1:]\n * Arcs between S and B[1]\n "), /*tp_doc*/ + 0, /*tp_traverse*/ + 0, /*tp_clear*/ + 0, /*tp_richcompare*/ + 0, /*tp_weaklistoffset*/ + 0, /*tp_iter*/ + 0, /*tp_iternext*/ + __pyx_methods_5spacy_8pipeline_17_parser_internals_9arc_eager_Break, /*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_5spacy_8pipeline_17_parser_internals_9arc_eager_Break, /*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_5spacy_8pipeline_17_parser_internals_9arc_eager___pyx_scope_struct___get_aligned_sent_starts(PyTypeObject *t, CYTHON_UNUSED PyObject *a, CYTHON_UNUSED PyObject *k) { + PyObject *o; + #if CYTHON_USE_FREELISTS + if (likely((int)(__pyx_mstate_global->__pyx_freecount_5spacy_8pipeline_17_parser_internals_9arc_eager___pyx_scope_struct___get_aligned_sent_starts > 0) & __PYX_CHECK_FINAL_TYPE_FOR_FREELISTS(t, __pyx_mstate_global->__pyx_ptype_5spacy_8pipeline_17_parser_internals_9arc_eager___pyx_scope_struct___get_aligned_sent_starts, sizeof(struct __pyx_obj_5spacy_8pipeline_17_parser_internals_9arc_eager___pyx_scope_struct___get_aligned_sent_starts)))) + { + o = (PyObject*)__pyx_mstate_global->__pyx_freelist_5spacy_8pipeline_17_parser_internals_9arc_eager___pyx_scope_struct___get_aligned_sent_starts[--__pyx_mstate_global->__pyx_freecount_5spacy_8pipeline_17_parser_internals_9arc_eager___pyx_scope_struct___get_aligned_sent_starts]; + #if CYTHON_USE_TYPE_SPECS + Py_DECREF(Py_TYPE(o)); + #endif + memset(o, 0, sizeof(struct __pyx_obj_5spacy_8pipeline_17_parser_internals_9arc_eager___pyx_scope_struct___get_aligned_sent_starts)); + #if CYTHON_COMPILING_IN_LIMITED_API + (void) PyObject_Init(o, t); + #else + (void) PyObject_INIT(o, t); + #endif + PyObject_GC_Track(o); + } else + #endif + { + o = __Pyx_AllocateExtensionType(t, 1); + if (unlikely(!o)) return 0; + } + return o; +} + +static void __pyx_tp_dealloc_5spacy_8pipeline_17_parser_internals_9arc_eager___pyx_scope_struct___get_aligned_sent_starts(PyObject *o) { + struct __pyx_obj_5spacy_8pipeline_17_parser_internals_9arc_eager___pyx_scope_struct___get_aligned_sent_starts *p = (struct __pyx_obj_5spacy_8pipeline_17_parser_internals_9arc_eager___pyx_scope_struct___get_aligned_sent_starts *)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_5spacy_8pipeline_17_parser_internals_9arc_eager___pyx_scope_struct___get_aligned_sent_starts) { + if (PyObject_CallFinalizerFromDealloc(o)) return; + } + } + #endif + PyObject_GC_UnTrack(o); + Py_CLEAR(p->__pyx_v_seen_words); + #if CYTHON_USE_FREELISTS + if (likely((int)(__pyx_mstate_global->__pyx_freecount_5spacy_8pipeline_17_parser_internals_9arc_eager___pyx_scope_struct___get_aligned_sent_starts < 8) & __PYX_CHECK_FINAL_TYPE_FOR_FREELISTS(Py_TYPE(o), __pyx_mstate_global->__pyx_ptype_5spacy_8pipeline_17_parser_internals_9arc_eager___pyx_scope_struct___get_aligned_sent_starts, sizeof(struct __pyx_obj_5spacy_8pipeline_17_parser_internals_9arc_eager___pyx_scope_struct___get_aligned_sent_starts)))) + { + __pyx_mstate_global->__pyx_freelist_5spacy_8pipeline_17_parser_internals_9arc_eager___pyx_scope_struct___get_aligned_sent_starts[__pyx_mstate_global->__pyx_freecount_5spacy_8pipeline_17_parser_internals_9arc_eager___pyx_scope_struct___get_aligned_sent_starts++] = ((struct __pyx_obj_5spacy_8pipeline_17_parser_internals_9arc_eager___pyx_scope_struct___get_aligned_sent_starts *)o); + } else + #endif + { + 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_5spacy_8pipeline_17_parser_internals_9arc_eager___pyx_scope_struct___get_aligned_sent_starts(PyObject *o, visitproc v, void *a) { + int e; + struct __pyx_obj_5spacy_8pipeline_17_parser_internals_9arc_eager___pyx_scope_struct___get_aligned_sent_starts *p = (struct __pyx_obj_5spacy_8pipeline_17_parser_internals_9arc_eager___pyx_scope_struct___get_aligned_sent_starts *)o; + { + e = __Pyx_call_type_traverse(o, 1, v, a); + if (e) return e; + } + if (p->__pyx_v_seen_words) { + e = (*v)(p->__pyx_v_seen_words, a); if (e) return e; + } + return 0; +} + +static int __pyx_tp_clear_5spacy_8pipeline_17_parser_internals_9arc_eager___pyx_scope_struct___get_aligned_sent_starts(PyObject *o) { + PyObject* tmp; + struct __pyx_obj_5spacy_8pipeline_17_parser_internals_9arc_eager___pyx_scope_struct___get_aligned_sent_starts *p = (struct __pyx_obj_5spacy_8pipeline_17_parser_internals_9arc_eager___pyx_scope_struct___get_aligned_sent_starts *)o; + tmp = ((PyObject*)p->__pyx_v_seen_words); + p->__pyx_v_seen_words = ((PyObject*)Py_None); Py_INCREF(Py_None); + Py_XDECREF(tmp); + return 0; +} +#if CYTHON_USE_TYPE_SPECS +static PyType_Slot __pyx_type_5spacy_8pipeline_17_parser_internals_9arc_eager___pyx_scope_struct___get_aligned_sent_starts_slots[] = { + {Py_tp_dealloc, (void *)__pyx_tp_dealloc_5spacy_8pipeline_17_parser_internals_9arc_eager___pyx_scope_struct___get_aligned_sent_starts}, + {Py_tp_traverse, (void *)__pyx_tp_traverse_5spacy_8pipeline_17_parser_internals_9arc_eager___pyx_scope_struct___get_aligned_sent_starts}, + {Py_tp_clear, (void *)__pyx_tp_clear_5spacy_8pipeline_17_parser_internals_9arc_eager___pyx_scope_struct___get_aligned_sent_starts}, + {Py_tp_new, (void *)__pyx_tp_new_5spacy_8pipeline_17_parser_internals_9arc_eager___pyx_scope_struct___get_aligned_sent_starts}, + {0, 0}, +}; +static PyType_Spec __pyx_type_5spacy_8pipeline_17_parser_internals_9arc_eager___pyx_scope_struct___get_aligned_sent_starts_spec = { + "spacy.pipeline._parser_internals.arc_eager.__pyx_scope_struct___get_aligned_sent_starts", + sizeof(struct __pyx_obj_5spacy_8pipeline_17_parser_internals_9arc_eager___pyx_scope_struct___get_aligned_sent_starts), + 0, + Py_TPFLAGS_DEFAULT|Py_TPFLAGS_HAVE_VERSION_TAG|Py_TPFLAGS_CHECKTYPES|Py_TPFLAGS_HAVE_NEWBUFFER|Py_TPFLAGS_HAVE_GC, + __pyx_type_5spacy_8pipeline_17_parser_internals_9arc_eager___pyx_scope_struct___get_aligned_sent_starts_slots, +}; +#else + +static PyTypeObject __pyx_type_5spacy_8pipeline_17_parser_internals_9arc_eager___pyx_scope_struct___get_aligned_sent_starts = { + PyVarObject_HEAD_INIT(0, 0) + "spacy.pipeline._parser_internals.arc_eager.""__pyx_scope_struct___get_aligned_sent_starts", /*tp_name*/ + sizeof(struct __pyx_obj_5spacy_8pipeline_17_parser_internals_9arc_eager___pyx_scope_struct___get_aligned_sent_starts), /*tp_basicsize*/ + 0, /*tp_itemsize*/ + __pyx_tp_dealloc_5spacy_8pipeline_17_parser_internals_9arc_eager___pyx_scope_struct___get_aligned_sent_starts, /*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_HAVE_GC, /*tp_flags*/ + 0, /*tp_doc*/ + __pyx_tp_traverse_5spacy_8pipeline_17_parser_internals_9arc_eager___pyx_scope_struct___get_aligned_sent_starts, /*tp_traverse*/ + __pyx_tp_clear_5spacy_8pipeline_17_parser_internals_9arc_eager___pyx_scope_struct___get_aligned_sent_starts, /*tp_clear*/ + 0, /*tp_richcompare*/ + 0, /*tp_weaklistoffset*/ + 0, /*tp_iter*/ + 0, /*tp_iternext*/ + 0, /*tp_methods*/ + 0, /*tp_members*/ + 0, /*tp_getset*/ + 0, /*tp_base*/ + 0, /*tp_dict*/ + 0, /*tp_descr_get*/ + 0, /*tp_descr_set*/ + #if !CYTHON_USE_TYPE_SPECS + 0, /*tp_dictoffset*/ + #endif + 0, /*tp_init*/ + 0, /*tp_alloc*/ + __pyx_tp_new_5spacy_8pipeline_17_parser_internals_9arc_eager___pyx_scope_struct___get_aligned_sent_starts, /*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_5spacy_8pipeline_17_parser_internals_9arc_eager___pyx_scope_struct_1_genexpr(PyTypeObject *t, CYTHON_UNUSED PyObject *a, CYTHON_UNUSED PyObject *k) { + PyObject *o; + #if CYTHON_USE_FREELISTS + if (likely((int)(__pyx_mstate_global->__pyx_freecount_5spacy_8pipeline_17_parser_internals_9arc_eager___pyx_scope_struct_1_genexpr > 0) & __PYX_CHECK_FINAL_TYPE_FOR_FREELISTS(t, __pyx_mstate_global->__pyx_ptype_5spacy_8pipeline_17_parser_internals_9arc_eager___pyx_scope_struct_1_genexpr, sizeof(struct __pyx_obj_5spacy_8pipeline_17_parser_internals_9arc_eager___pyx_scope_struct_1_genexpr)))) + { + o = (PyObject*)__pyx_mstate_global->__pyx_freelist_5spacy_8pipeline_17_parser_internals_9arc_eager___pyx_scope_struct_1_genexpr[--__pyx_mstate_global->__pyx_freecount_5spacy_8pipeline_17_parser_internals_9arc_eager___pyx_scope_struct_1_genexpr]; + #if CYTHON_USE_TYPE_SPECS + Py_DECREF(Py_TYPE(o)); + #endif + memset(o, 0, sizeof(struct __pyx_obj_5spacy_8pipeline_17_parser_internals_9arc_eager___pyx_scope_struct_1_genexpr)); + #if CYTHON_COMPILING_IN_LIMITED_API + (void) PyObject_Init(o, t); + #else + (void) PyObject_INIT(o, t); + #endif + PyObject_GC_Track(o); + } else + #endif + { + o = __Pyx_AllocateExtensionType(t, 1); + if (unlikely(!o)) return 0; + } + return o; +} + +static void __pyx_tp_dealloc_5spacy_8pipeline_17_parser_internals_9arc_eager___pyx_scope_struct_1_genexpr(PyObject *o) { + struct __pyx_obj_5spacy_8pipeline_17_parser_internals_9arc_eager___pyx_scope_struct_1_genexpr *p = (struct __pyx_obj_5spacy_8pipeline_17_parser_internals_9arc_eager___pyx_scope_struct_1_genexpr *)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_5spacy_8pipeline_17_parser_internals_9arc_eager___pyx_scope_struct_1_genexpr) { + if (PyObject_CallFinalizerFromDealloc(o)) return; + } + } + #endif + PyObject_GC_UnTrack(o); + Py_CLEAR(p->__pyx_outer_scope); + Py_CLEAR(p->__pyx_genexpr_arg_0); + Py_CLEAR(p->__pyx_v_x_idx); + #if CYTHON_USE_FREELISTS + if (likely((int)(__pyx_mstate_global->__pyx_freecount_5spacy_8pipeline_17_parser_internals_9arc_eager___pyx_scope_struct_1_genexpr < 8) & __PYX_CHECK_FINAL_TYPE_FOR_FREELISTS(Py_TYPE(o), __pyx_mstate_global->__pyx_ptype_5spacy_8pipeline_17_parser_internals_9arc_eager___pyx_scope_struct_1_genexpr, sizeof(struct __pyx_obj_5spacy_8pipeline_17_parser_internals_9arc_eager___pyx_scope_struct_1_genexpr)))) + { + __pyx_mstate_global->__pyx_freelist_5spacy_8pipeline_17_parser_internals_9arc_eager___pyx_scope_struct_1_genexpr[__pyx_mstate_global->__pyx_freecount_5spacy_8pipeline_17_parser_internals_9arc_eager___pyx_scope_struct_1_genexpr++] = ((struct __pyx_obj_5spacy_8pipeline_17_parser_internals_9arc_eager___pyx_scope_struct_1_genexpr *)o); + } else + #endif + { + 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_5spacy_8pipeline_17_parser_internals_9arc_eager___pyx_scope_struct_1_genexpr(PyObject *o, visitproc v, void *a) { + int e; + struct __pyx_obj_5spacy_8pipeline_17_parser_internals_9arc_eager___pyx_scope_struct_1_genexpr *p = (struct __pyx_obj_5spacy_8pipeline_17_parser_internals_9arc_eager___pyx_scope_struct_1_genexpr *)o; + { + e = __Pyx_call_type_traverse(o, 1, v, a); + if (e) return e; + } + if (p->__pyx_outer_scope) { + e = (*v)(((PyObject *)p->__pyx_outer_scope), a); if (e) return e; + } + if (p->__pyx_genexpr_arg_0) { + e = (*v)(p->__pyx_genexpr_arg_0, a); if (e) return e; + } + if (p->__pyx_v_x_idx) { + e = (*v)(p->__pyx_v_x_idx, a); if (e) return e; + } + return 0; +} +#if CYTHON_USE_TYPE_SPECS +static PyType_Slot __pyx_type_5spacy_8pipeline_17_parser_internals_9arc_eager___pyx_scope_struct_1_genexpr_slots[] = { + {Py_tp_dealloc, (void *)__pyx_tp_dealloc_5spacy_8pipeline_17_parser_internals_9arc_eager___pyx_scope_struct_1_genexpr}, + {Py_tp_traverse, (void *)__pyx_tp_traverse_5spacy_8pipeline_17_parser_internals_9arc_eager___pyx_scope_struct_1_genexpr}, + {Py_tp_new, (void *)__pyx_tp_new_5spacy_8pipeline_17_parser_internals_9arc_eager___pyx_scope_struct_1_genexpr}, + {0, 0}, +}; +static PyType_Spec __pyx_type_5spacy_8pipeline_17_parser_internals_9arc_eager___pyx_scope_struct_1_genexpr_spec = { + "spacy.pipeline._parser_internals.arc_eager.__pyx_scope_struct_1_genexpr", + sizeof(struct __pyx_obj_5spacy_8pipeline_17_parser_internals_9arc_eager___pyx_scope_struct_1_genexpr), + 0, + Py_TPFLAGS_DEFAULT|Py_TPFLAGS_HAVE_VERSION_TAG|Py_TPFLAGS_CHECKTYPES|Py_TPFLAGS_HAVE_NEWBUFFER|Py_TPFLAGS_HAVE_GC, + __pyx_type_5spacy_8pipeline_17_parser_internals_9arc_eager___pyx_scope_struct_1_genexpr_slots, +}; +#else + +static PyTypeObject __pyx_type_5spacy_8pipeline_17_parser_internals_9arc_eager___pyx_scope_struct_1_genexpr = { + PyVarObject_HEAD_INIT(0, 0) + "spacy.pipeline._parser_internals.arc_eager.""__pyx_scope_struct_1_genexpr", /*tp_name*/ + sizeof(struct __pyx_obj_5spacy_8pipeline_17_parser_internals_9arc_eager___pyx_scope_struct_1_genexpr), /*tp_basicsize*/ + 0, /*tp_itemsize*/ + __pyx_tp_dealloc_5spacy_8pipeline_17_parser_internals_9arc_eager___pyx_scope_struct_1_genexpr, /*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_HAVE_GC, /*tp_flags*/ + 0, /*tp_doc*/ + __pyx_tp_traverse_5spacy_8pipeline_17_parser_internals_9arc_eager___pyx_scope_struct_1_genexpr, /*tp_traverse*/ + 0, /*tp_clear*/ + 0, /*tp_richcompare*/ + 0, /*tp_weaklistoffset*/ + 0, /*tp_iter*/ + 0, /*tp_iternext*/ + 0, /*tp_methods*/ + 0, /*tp_members*/ + 0, /*tp_getset*/ + 0, /*tp_base*/ + 0, /*tp_dict*/ + 0, /*tp_descr_get*/ + 0, /*tp_descr_set*/ + #if !CYTHON_USE_TYPE_SPECS + 0, /*tp_dictoffset*/ + #endif + 0, /*tp_init*/ + 0, /*tp_alloc*/ + __pyx_tp_new_5spacy_8pipeline_17_parser_internals_9arc_eager___pyx_scope_struct_1_genexpr, /*tp_new*/ + 0, /*tp_free*/ + 0, /*tp_is_gc*/ + 0, /*tp_bases*/ + 0, /*tp_mro*/ + 0, /*tp_cache*/ + 0, /*tp_subclasses*/ + 0, /*tp_weaklist*/ + 0, /*tp_del*/ + 0, /*tp_version_tag*/ + #if 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_5spacy_8pipeline_17_parser_internals_9arc_eager___pyx_scope_struct_2_get_oracle_sequence_from_state(PyTypeObject *t, CYTHON_UNUSED PyObject *a, CYTHON_UNUSED PyObject *k) { + PyObject *o; + #if CYTHON_USE_FREELISTS + if (likely((int)(__pyx_mstate_global->__pyx_freecount_5spacy_8pipeline_17_parser_internals_9arc_eager___pyx_scope_struct_2_get_oracle_sequence_from_state > 0) & __PYX_CHECK_FINAL_TYPE_FOR_FREELISTS(t, __pyx_mstate_global->__pyx_ptype_5spacy_8pipeline_17_parser_internals_9arc_eager___pyx_scope_struct_2_get_oracle_sequence_from_state, sizeof(struct __pyx_obj_5spacy_8pipeline_17_parser_internals_9arc_eager___pyx_scope_struct_2_get_oracle_sequence_from_state)))) + { + o = (PyObject*)__pyx_mstate_global->__pyx_freelist_5spacy_8pipeline_17_parser_internals_9arc_eager___pyx_scope_struct_2_get_oracle_sequence_from_state[--__pyx_mstate_global->__pyx_freecount_5spacy_8pipeline_17_parser_internals_9arc_eager___pyx_scope_struct_2_get_oracle_sequence_from_state]; + #if CYTHON_USE_TYPE_SPECS + Py_DECREF(Py_TYPE(o)); + #endif + memset(o, 0, sizeof(struct __pyx_obj_5spacy_8pipeline_17_parser_internals_9arc_eager___pyx_scope_struct_2_get_oracle_sequence_from_state)); + #if CYTHON_COMPILING_IN_LIMITED_API + (void) PyObject_Init(o, t); + #else + (void) PyObject_INIT(o, t); + #endif + } else + #endif + { + o = __Pyx_AllocateExtensionType(t, 1); + if (unlikely(!o)) return 0; + } + return o; +} + +static void __pyx_tp_dealloc_5spacy_8pipeline_17_parser_internals_9arc_eager___pyx_scope_struct_2_get_oracle_sequence_from_state(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_5spacy_8pipeline_17_parser_internals_9arc_eager___pyx_scope_struct_2_get_oracle_sequence_from_state) { + if (PyObject_CallFinalizerFromDealloc(o)) return; + } + } + #endif + #if CYTHON_USE_FREELISTS + if (likely((int)(__pyx_mstate_global->__pyx_freecount_5spacy_8pipeline_17_parser_internals_9arc_eager___pyx_scope_struct_2_get_oracle_sequence_from_state < 8) & __PYX_CHECK_FINAL_TYPE_FOR_FREELISTS(Py_TYPE(o), __pyx_mstate_global->__pyx_ptype_5spacy_8pipeline_17_parser_internals_9arc_eager___pyx_scope_struct_2_get_oracle_sequence_from_state, sizeof(struct __pyx_obj_5spacy_8pipeline_17_parser_internals_9arc_eager___pyx_scope_struct_2_get_oracle_sequence_from_state)))) + { + __pyx_mstate_global->__pyx_freelist_5spacy_8pipeline_17_parser_internals_9arc_eager___pyx_scope_struct_2_get_oracle_sequence_from_state[__pyx_mstate_global->__pyx_freecount_5spacy_8pipeline_17_parser_internals_9arc_eager___pyx_scope_struct_2_get_oracle_sequence_from_state++] = ((struct __pyx_obj_5spacy_8pipeline_17_parser_internals_9arc_eager___pyx_scope_struct_2_get_oracle_sequence_from_state *)o); + } else + #endif + { + 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 + } +} +#if CYTHON_USE_TYPE_SPECS +static PyType_Slot __pyx_type_5spacy_8pipeline_17_parser_internals_9arc_eager___pyx_scope_struct_2_get_oracle_sequence_from_state_slots[] = { + {Py_tp_dealloc, (void *)__pyx_tp_dealloc_5spacy_8pipeline_17_parser_internals_9arc_eager___pyx_scope_struct_2_get_oracle_sequence_from_state}, + {Py_tp_new, (void *)__pyx_tp_new_5spacy_8pipeline_17_parser_internals_9arc_eager___pyx_scope_struct_2_get_oracle_sequence_from_state}, + {0, 0}, +}; +static PyType_Spec __pyx_type_5spacy_8pipeline_17_parser_internals_9arc_eager___pyx_scope_struct_2_get_oracle_sequence_from_state_spec = { + "spacy.pipeline._parser_internals.arc_eager.__pyx_scope_struct_2_get_oracle_sequence_from_state", + sizeof(struct __pyx_obj_5spacy_8pipeline_17_parser_internals_9arc_eager___pyx_scope_struct_2_get_oracle_sequence_from_state), + 0, + Py_TPFLAGS_DEFAULT|Py_TPFLAGS_HAVE_VERSION_TAG|Py_TPFLAGS_CHECKTYPES|Py_TPFLAGS_HAVE_NEWBUFFER, + __pyx_type_5spacy_8pipeline_17_parser_internals_9arc_eager___pyx_scope_struct_2_get_oracle_sequence_from_state_slots, +}; +#else + +static PyTypeObject __pyx_type_5spacy_8pipeline_17_parser_internals_9arc_eager___pyx_scope_struct_2_get_oracle_sequence_from_state = { + PyVarObject_HEAD_INIT(0, 0) + "spacy.pipeline._parser_internals.arc_eager.""__pyx_scope_struct_2_get_oracle_sequence_from_state", /*tp_name*/ + sizeof(struct __pyx_obj_5spacy_8pipeline_17_parser_internals_9arc_eager___pyx_scope_struct_2_get_oracle_sequence_from_state), /*tp_basicsize*/ + 0, /*tp_itemsize*/ + __pyx_tp_dealloc_5spacy_8pipeline_17_parser_internals_9arc_eager___pyx_scope_struct_2_get_oracle_sequence_from_state, /*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, /*tp_flags*/ + 0, /*tp_doc*/ + 0, /*tp_traverse*/ + 0, /*tp_clear*/ + 0, /*tp_richcompare*/ + 0, /*tp_weaklistoffset*/ + 0, /*tp_iter*/ + 0, /*tp_iternext*/ + 0, /*tp_methods*/ + 0, /*tp_members*/ + 0, /*tp_getset*/ + 0, /*tp_base*/ + 0, /*tp_dict*/ + 0, /*tp_descr_get*/ + 0, /*tp_descr_set*/ + #if !CYTHON_USE_TYPE_SPECS + 0, /*tp_dictoffset*/ + #endif + 0, /*tp_init*/ + 0, /*tp_alloc*/ + __pyx_tp_new_5spacy_8pipeline_17_parser_internals_9arc_eager___pyx_scope_struct_2_get_oracle_sequence_from_state, /*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_5spacy_8pipeline_17_parser_internals_9arc_eager___pyx_scope_struct_3_genexpr(PyTypeObject *t, CYTHON_UNUSED PyObject *a, CYTHON_UNUSED PyObject *k) { + PyObject *o; + #if CYTHON_USE_FREELISTS + if (likely((int)(__pyx_mstate_global->__pyx_freecount_5spacy_8pipeline_17_parser_internals_9arc_eager___pyx_scope_struct_3_genexpr > 0) & __PYX_CHECK_FINAL_TYPE_FOR_FREELISTS(t, __pyx_mstate_global->__pyx_ptype_5spacy_8pipeline_17_parser_internals_9arc_eager___pyx_scope_struct_3_genexpr, sizeof(struct __pyx_obj_5spacy_8pipeline_17_parser_internals_9arc_eager___pyx_scope_struct_3_genexpr)))) + { + o = (PyObject*)__pyx_mstate_global->__pyx_freelist_5spacy_8pipeline_17_parser_internals_9arc_eager___pyx_scope_struct_3_genexpr[--__pyx_mstate_global->__pyx_freecount_5spacy_8pipeline_17_parser_internals_9arc_eager___pyx_scope_struct_3_genexpr]; + #if CYTHON_USE_TYPE_SPECS + Py_DECREF(Py_TYPE(o)); + #endif + memset(o, 0, sizeof(struct __pyx_obj_5spacy_8pipeline_17_parser_internals_9arc_eager___pyx_scope_struct_3_genexpr)); + #if CYTHON_COMPILING_IN_LIMITED_API + (void) PyObject_Init(o, t); + #else + (void) PyObject_INIT(o, t); + #endif + PyObject_GC_Track(o); + } else + #endif + { + o = __Pyx_AllocateExtensionType(t, 1); + if (unlikely(!o)) return 0; + } + return o; +} + +static void __pyx_tp_dealloc_5spacy_8pipeline_17_parser_internals_9arc_eager___pyx_scope_struct_3_genexpr(PyObject *o) { + struct __pyx_obj_5spacy_8pipeline_17_parser_internals_9arc_eager___pyx_scope_struct_3_genexpr *p = (struct __pyx_obj_5spacy_8pipeline_17_parser_internals_9arc_eager___pyx_scope_struct_3_genexpr *)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_5spacy_8pipeline_17_parser_internals_9arc_eager___pyx_scope_struct_3_genexpr) { + if (PyObject_CallFinalizerFromDealloc(o)) return; + } + } + #endif + PyObject_GC_UnTrack(o); + Py_CLEAR(p->__pyx_outer_scope); + #if CYTHON_USE_FREELISTS + if (likely((int)(__pyx_mstate_global->__pyx_freecount_5spacy_8pipeline_17_parser_internals_9arc_eager___pyx_scope_struct_3_genexpr < 8) & __PYX_CHECK_FINAL_TYPE_FOR_FREELISTS(Py_TYPE(o), __pyx_mstate_global->__pyx_ptype_5spacy_8pipeline_17_parser_internals_9arc_eager___pyx_scope_struct_3_genexpr, sizeof(struct __pyx_obj_5spacy_8pipeline_17_parser_internals_9arc_eager___pyx_scope_struct_3_genexpr)))) + { + __pyx_mstate_global->__pyx_freelist_5spacy_8pipeline_17_parser_internals_9arc_eager___pyx_scope_struct_3_genexpr[__pyx_mstate_global->__pyx_freecount_5spacy_8pipeline_17_parser_internals_9arc_eager___pyx_scope_struct_3_genexpr++] = ((struct __pyx_obj_5spacy_8pipeline_17_parser_internals_9arc_eager___pyx_scope_struct_3_genexpr *)o); + } else + #endif + { + 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_5spacy_8pipeline_17_parser_internals_9arc_eager___pyx_scope_struct_3_genexpr(PyObject *o, visitproc v, void *a) { + int e; + struct __pyx_obj_5spacy_8pipeline_17_parser_internals_9arc_eager___pyx_scope_struct_3_genexpr *p = (struct __pyx_obj_5spacy_8pipeline_17_parser_internals_9arc_eager___pyx_scope_struct_3_genexpr *)o; + { + e = __Pyx_call_type_traverse(o, 1, v, a); + if (e) return e; + } + if (p->__pyx_outer_scope) { + e = (*v)(((PyObject *)p->__pyx_outer_scope), a); if (e) return e; + } + return 0; +} +#if CYTHON_USE_TYPE_SPECS +static PyType_Slot __pyx_type_5spacy_8pipeline_17_parser_internals_9arc_eager___pyx_scope_struct_3_genexpr_slots[] = { + {Py_tp_dealloc, (void *)__pyx_tp_dealloc_5spacy_8pipeline_17_parser_internals_9arc_eager___pyx_scope_struct_3_genexpr}, + {Py_tp_traverse, (void *)__pyx_tp_traverse_5spacy_8pipeline_17_parser_internals_9arc_eager___pyx_scope_struct_3_genexpr}, + {Py_tp_new, (void *)__pyx_tp_new_5spacy_8pipeline_17_parser_internals_9arc_eager___pyx_scope_struct_3_genexpr}, + {0, 0}, +}; +static PyType_Spec __pyx_type_5spacy_8pipeline_17_parser_internals_9arc_eager___pyx_scope_struct_3_genexpr_spec = { + "spacy.pipeline._parser_internals.arc_eager.__pyx_scope_struct_3_genexpr", + sizeof(struct __pyx_obj_5spacy_8pipeline_17_parser_internals_9arc_eager___pyx_scope_struct_3_genexpr), + 0, + Py_TPFLAGS_DEFAULT|Py_TPFLAGS_HAVE_VERSION_TAG|Py_TPFLAGS_CHECKTYPES|Py_TPFLAGS_HAVE_NEWBUFFER|Py_TPFLAGS_HAVE_GC, + __pyx_type_5spacy_8pipeline_17_parser_internals_9arc_eager___pyx_scope_struct_3_genexpr_slots, +}; +#else + +static PyTypeObject __pyx_type_5spacy_8pipeline_17_parser_internals_9arc_eager___pyx_scope_struct_3_genexpr = { + PyVarObject_HEAD_INIT(0, 0) + "spacy.pipeline._parser_internals.arc_eager.""__pyx_scope_struct_3_genexpr", /*tp_name*/ + sizeof(struct __pyx_obj_5spacy_8pipeline_17_parser_internals_9arc_eager___pyx_scope_struct_3_genexpr), /*tp_basicsize*/ + 0, /*tp_itemsize*/ + __pyx_tp_dealloc_5spacy_8pipeline_17_parser_internals_9arc_eager___pyx_scope_struct_3_genexpr, /*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_HAVE_GC, /*tp_flags*/ + 0, /*tp_doc*/ + __pyx_tp_traverse_5spacy_8pipeline_17_parser_internals_9arc_eager___pyx_scope_struct_3_genexpr, /*tp_traverse*/ + 0, /*tp_clear*/ + 0, /*tp_richcompare*/ + 0, /*tp_weaklistoffset*/ + 0, /*tp_iter*/ + 0, /*tp_iternext*/ + 0, /*tp_methods*/ + 0, /*tp_members*/ + 0, /*tp_getset*/ + 0, /*tp_base*/ + 0, /*tp_dict*/ + 0, /*tp_descr_get*/ + 0, /*tp_descr_set*/ + #if !CYTHON_USE_TYPE_SPECS + 0, /*tp_dictoffset*/ + #endif + 0, /*tp_init*/ + 0, /*tp_alloc*/ + __pyx_tp_new_5spacy_8pipeline_17_parser_internals_9arc_eager___pyx_scope_struct_3_genexpr, /*tp_new*/ + 0, /*tp_free*/ + 0, /*tp_is_gc*/ + 0, /*tp_bases*/ + 0, /*tp_mro*/ + 0, /*tp_cache*/ + 0, /*tp_subclasses*/ + 0, /*tp_weaklist*/ + 0, /*tp_del*/ + 0, /*tp_version_tag*/ + #if 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 struct __pyx_vtabstruct_array __pyx_vtable_array; + +static PyObject *__pyx_tp_new_array(PyTypeObject *t, PyObject *a, PyObject *k) { + struct __pyx_array_obj *p; + PyObject *o; + o = __Pyx_AllocateExtensionType(t, 0); + if (unlikely(!o)) return 0; + p = ((struct __pyx_array_obj *)o); + p->__pyx_vtab = __pyx_vtabptr_array; + p->mode = ((PyObject*)Py_None); Py_INCREF(Py_None); + p->_format = ((PyObject*)Py_None); Py_INCREF(Py_None); + if (unlikely(__pyx_array___cinit__(o, a, k) < 0)) goto bad; + return o; + bad: + Py_DECREF(o); o = 0; + return NULL; +} + +static void __pyx_tp_dealloc_array(PyObject *o) { + struct __pyx_array_obj *p = (struct __pyx_array_obj *)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_array) { + if (PyObject_CallFinalizerFromDealloc(o)) return; + } + } + #endif + { + PyObject *etype, *eval, *etb; + PyErr_Fetch(&etype, &eval, &etb); + __Pyx_SET_REFCNT(o, Py_REFCNT(o) + 1); + __pyx_array___dealloc__(o); + __Pyx_SET_REFCNT(o, Py_REFCNT(o) - 1); + PyErr_Restore(etype, eval, etb); + } + Py_CLEAR(p->mode); + Py_CLEAR(p->_format); + 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 PyObject *__pyx_sq_item_array(PyObject *o, Py_ssize_t i) { + PyObject *r; + PyObject *x = PyLong_FromSsize_t(i); if(!x) return 0; + #if CYTHON_USE_TYPE_SLOTS || (!CYTHON_USE_TYPE_SPECS && __PYX_LIMITED_VERSION_HEX < 0x030A0000) + r = Py_TYPE(o)->tp_as_mapping->mp_subscript(o, x); + #else + r = ((binaryfunc)PyType_GetSlot(Py_TYPE(o), Py_mp_subscript))(o, x); + #endif + Py_DECREF(x); + return r; +} + +static int __pyx_mp_ass_subscript_array(PyObject *o, PyObject *i, PyObject *v) { + if (v) { + return __pyx_array___setitem__(o, i, v); + } + else { + __Pyx_TypeName o_type_name; + o_type_name = __Pyx_PyType_GetFullyQualifiedName(Py_TYPE(o)); + PyErr_Format(PyExc_NotImplementedError, + "Subscript deletion not supported by " __Pyx_FMT_TYPENAME, o_type_name); + __Pyx_DECREF_TypeName(o_type_name); + return -1; + } +} + +static PyObject *__pyx_tp_getattro_array(PyObject *o, PyObject *n) { + PyObject *v = PyObject_GenericGetAttr(o, n); + if (!v && PyErr_ExceptionMatches(PyExc_AttributeError)) { + PyErr_Clear(); + v = __pyx_array___getattr__(o, n); + } + return v; +} + +static PyObject *__pyx_getprop___pyx_array_memview(PyObject *o, CYTHON_UNUSED void *x) { + return __pyx_pw_15View_dot_MemoryView_5array_7memview_1__get__(o); +} + +static PyMethodDef __pyx_methods_array[] = { + {"__getattr__", (PyCFunction)__pyx_array___getattr__, METH_O|METH_COEXIST, 0}, + {"__reduce_cython__", (PyCFunction)(void(*)(void))(__Pyx_PyCFunction_FastCallWithKeywords)__pyx_pw___pyx_array_1__reduce_cython__, __Pyx_METH_FASTCALL|METH_KEYWORDS, 0}, + {"__setstate_cython__", (PyCFunction)(void(*)(void))(__Pyx_PyCFunction_FastCallWithKeywords)__pyx_pw___pyx_array_3__setstate_cython__, __Pyx_METH_FASTCALL|METH_KEYWORDS, 0}, + {0, 0, 0, 0} +}; + +static struct PyGetSetDef __pyx_getsets_array[] = { + {"memview", __pyx_getprop___pyx_array_memview, 0, 0, 0}, + {0, 0, 0, 0, 0} +}; +#if CYTHON_USE_TYPE_SPECS +#if !CYTHON_COMPILING_IN_LIMITED_API + +static PyBufferProcs __pyx_tp_as_buffer_array = { + __pyx_array_getbuffer, /*bf_getbuffer*/ + 0, /*bf_releasebuffer*/ +}; +#endif +static PyType_Slot __pyx_type___pyx_array_slots[] = { + {Py_tp_dealloc, (void *)__pyx_tp_dealloc_array}, + {Py_sq_length, (void *)__pyx_array___len__}, + {Py_sq_item, (void *)__pyx_sq_item_array}, + {Py_mp_length, (void *)__pyx_array___len__}, + {Py_mp_subscript, (void *)__pyx_array___getitem__}, + {Py_mp_ass_subscript, (void *)__pyx_mp_ass_subscript_array}, + {Py_tp_getattro, (void *)__pyx_tp_getattro_array}, + #if defined(Py_bf_getbuffer) + {Py_bf_getbuffer, (void *)__pyx_array_getbuffer}, + #endif + {Py_tp_methods, (void *)__pyx_methods_array}, + {Py_tp_getset, (void *)__pyx_getsets_array}, + {Py_tp_new, (void *)__pyx_tp_new_array}, + {0, 0}, +}; +static PyType_Spec __pyx_type___pyx_array_spec = { + "spacy.pipeline._parser_internals.arc_eager.array", + sizeof(struct __pyx_array_obj), + 0, + Py_TPFLAGS_DEFAULT|Py_TPFLAGS_HAVE_VERSION_TAG|Py_TPFLAGS_CHECKTYPES|Py_TPFLAGS_HAVE_NEWBUFFER|Py_TPFLAGS_BASETYPE|Py_TPFLAGS_SEQUENCE, + __pyx_type___pyx_array_slots, +}; +#else + +static PySequenceMethods __pyx_tp_as_sequence_array = { + __pyx_array___len__, /*sq_length*/ + 0, /*sq_concat*/ + 0, /*sq_repeat*/ + __pyx_sq_item_array, /*sq_item*/ + 0, /*sq_slice*/ + 0, /*sq_ass_item*/ + 0, /*sq_ass_slice*/ + 0, /*sq_contains*/ + 0, /*sq_inplace_concat*/ + 0, /*sq_inplace_repeat*/ +}; + +static PyMappingMethods __pyx_tp_as_mapping_array = { + __pyx_array___len__, /*mp_length*/ + __pyx_array___getitem__, /*mp_subscript*/ + __pyx_mp_ass_subscript_array, /*mp_ass_subscript*/ +}; + +static PyBufferProcs __pyx_tp_as_buffer_array = { + __pyx_array_getbuffer, /*bf_getbuffer*/ + 0, /*bf_releasebuffer*/ +}; + +static PyTypeObject __pyx_type___pyx_array = { + PyVarObject_HEAD_INIT(0, 0) + "spacy.pipeline._parser_internals.arc_eager.""array", /*tp_name*/ + sizeof(struct __pyx_array_obj), /*tp_basicsize*/ + 0, /*tp_itemsize*/ + __pyx_tp_dealloc_array, /*tp_dealloc*/ + 0, /*tp_vectorcall_offset*/ + 0, /*tp_getattr*/ + 0, /*tp_setattr*/ + 0, /*tp_as_async*/ + 0, /*tp_repr*/ + 0, /*tp_as_number*/ + &__pyx_tp_as_sequence_array, /*tp_as_sequence*/ + &__pyx_tp_as_mapping_array, /*tp_as_mapping*/ + 0, /*tp_hash*/ + 0, /*tp_call*/ + 0, /*tp_str*/ + __pyx_tp_getattro_array, /*tp_getattro*/ + 0, /*tp_setattro*/ + &__pyx_tp_as_buffer_array, /*tp_as_buffer*/ + Py_TPFLAGS_DEFAULT|Py_TPFLAGS_HAVE_VERSION_TAG|Py_TPFLAGS_CHECKTYPES|Py_TPFLAGS_HAVE_NEWBUFFER|Py_TPFLAGS_BASETYPE|Py_TPFLAGS_SEQUENCE, /*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_array, /*tp_methods*/ + 0, /*tp_members*/ + __pyx_getsets_array, /*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_array, /*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_Enum(PyTypeObject *t, CYTHON_UNUSED PyObject *a, CYTHON_UNUSED PyObject *k) { + struct __pyx_MemviewEnum_obj *p; + PyObject *o; + o = __Pyx_AllocateExtensionType(t, 0); + if (unlikely(!o)) return 0; + p = ((struct __pyx_MemviewEnum_obj *)o); + p->name = Py_None; Py_INCREF(Py_None); + return o; +} + +static void __pyx_tp_dealloc_Enum(PyObject *o) { + struct __pyx_MemviewEnum_obj *p = (struct __pyx_MemviewEnum_obj *)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_Enum) { + if (PyObject_CallFinalizerFromDealloc(o)) return; + } + } + #endif + PyObject_GC_UnTrack(o); + Py_CLEAR(p->name); + 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_Enum(PyObject *o, visitproc v, void *a) { + int e; + struct __pyx_MemviewEnum_obj *p = (struct __pyx_MemviewEnum_obj *)o; + { + e = __Pyx_call_type_traverse(o, 1, v, a); + if (e) return e; + } + if (p->name) { + e = (*v)(p->name, a); if (e) return e; + } + return 0; +} + +static int __pyx_tp_clear_Enum(PyObject *o) { + PyObject* tmp; + struct __pyx_MemviewEnum_obj *p = (struct __pyx_MemviewEnum_obj *)o; + tmp = ((PyObject*)p->name); + p->name = Py_None; Py_INCREF(Py_None); + Py_XDECREF(tmp); + return 0; +} + +static PyMethodDef __pyx_methods_Enum[] = { + {"__reduce_cython__", (PyCFunction)(void(*)(void))(__Pyx_PyCFunction_FastCallWithKeywords)__pyx_pw___pyx_MemviewEnum_1__reduce_cython__, __Pyx_METH_FASTCALL|METH_KEYWORDS, 0}, + {"__setstate_cython__", (PyCFunction)(void(*)(void))(__Pyx_PyCFunction_FastCallWithKeywords)__pyx_pw___pyx_MemviewEnum_3__setstate_cython__, __Pyx_METH_FASTCALL|METH_KEYWORDS, 0}, + {0, 0, 0, 0} +}; +#if CYTHON_USE_TYPE_SPECS +static PyType_Slot __pyx_type___pyx_MemviewEnum_slots[] = { + {Py_tp_dealloc, (void *)__pyx_tp_dealloc_Enum}, + {Py_tp_repr, (void *)__pyx_MemviewEnum___repr__}, + {Py_tp_traverse, (void *)__pyx_tp_traverse_Enum}, + {Py_tp_clear, (void *)__pyx_tp_clear_Enum}, + {Py_tp_methods, (void *)__pyx_methods_Enum}, + {Py_tp_init, (void *)__pyx_MemviewEnum___init__}, + {Py_tp_new, (void *)__pyx_tp_new_Enum}, + {0, 0}, +}; +static PyType_Spec __pyx_type___pyx_MemviewEnum_spec = { + "spacy.pipeline._parser_internals.arc_eager.Enum", + sizeof(struct __pyx_MemviewEnum_obj), + 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___pyx_MemviewEnum_slots, +}; +#else + +static PyTypeObject __pyx_type___pyx_MemviewEnum = { + PyVarObject_HEAD_INIT(0, 0) + "spacy.pipeline._parser_internals.arc_eager.""Enum", /*tp_name*/ + sizeof(struct __pyx_MemviewEnum_obj), /*tp_basicsize*/ + 0, /*tp_itemsize*/ + __pyx_tp_dealloc_Enum, /*tp_dealloc*/ + 0, /*tp_vectorcall_offset*/ + 0, /*tp_getattr*/ + 0, /*tp_setattr*/ + 0, /*tp_as_async*/ + __pyx_MemviewEnum___repr__, /*tp_repr*/ + 0, /*tp_as_number*/ + 0, /*tp_as_sequence*/ + 0, /*tp_as_mapping*/ + 0, /*tp_hash*/ + 0, /*tp_call*/ + 0, /*tp_str*/ + 0, /*tp_getattro*/ + 0, /*tp_setattro*/ + 0, /*tp_as_buffer*/ + Py_TPFLAGS_DEFAULT|Py_TPFLAGS_HAVE_VERSION_TAG|Py_TPFLAGS_CHECKTYPES|Py_TPFLAGS_HAVE_NEWBUFFER|Py_TPFLAGS_BASETYPE|Py_TPFLAGS_HAVE_GC, /*tp_flags*/ + 0, /*tp_doc*/ + __pyx_tp_traverse_Enum, /*tp_traverse*/ + __pyx_tp_clear_Enum, /*tp_clear*/ + 0, /*tp_richcompare*/ + 0, /*tp_weaklistoffset*/ + 0, /*tp_iter*/ + 0, /*tp_iternext*/ + __pyx_methods_Enum, /*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_MemviewEnum___init__, /*tp_init*/ + 0, /*tp_alloc*/ + __pyx_tp_new_Enum, /*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 struct __pyx_vtabstruct_memoryview __pyx_vtable_memoryview; + +static PyObject *__pyx_tp_new_memoryview(PyTypeObject *t, PyObject *a, PyObject *k) { + struct __pyx_memoryview_obj *p; + PyObject *o; + o = __Pyx_AllocateExtensionType(t, 0); + if (unlikely(!o)) return 0; + p = ((struct __pyx_memoryview_obj *)o); + p->__pyx_vtab = __pyx_vtabptr_memoryview; + p->obj = Py_None; Py_INCREF(Py_None); + p->_size = Py_None; Py_INCREF(Py_None); + p->view.obj = NULL; + if (unlikely(__pyx_memoryview___cinit__(o, a, k) < 0)) goto bad; + return o; + bad: + Py_DECREF(o); o = 0; + return NULL; +} + +static void __pyx_tp_dealloc_memoryview(PyObject *o) { + struct __pyx_memoryview_obj *p = (struct __pyx_memoryview_obj *)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_memoryview) { + 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_memoryview___dealloc__(o); + __Pyx_SET_REFCNT(o, Py_REFCNT(o) - 1); + PyErr_Restore(etype, eval, etb); + } + Py_CLEAR(p->obj); + Py_CLEAR(p->_size); + 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_memoryview(PyObject *o, visitproc v, void *a) { + int e; + struct __pyx_memoryview_obj *p = (struct __pyx_memoryview_obj *)o; + { + e = __Pyx_call_type_traverse(o, 1, v, a); + if (e) return e; + } + if (p->obj) { + e = (*v)(p->obj, a); if (e) return e; + } + if (p->_size) { + e = (*v)(p->_size, a); if (e) return e; + } + if (p->view.obj) { + e = (*v)(p->view.obj, a); if (e) return e; + } + return 0; +} + +static int __pyx_tp_clear_memoryview(PyObject *o) { + PyObject* tmp; + struct __pyx_memoryview_obj *p = (struct __pyx_memoryview_obj *)o; + tmp = ((PyObject*)p->obj); + p->obj = Py_None; Py_INCREF(Py_None); + Py_XDECREF(tmp); + tmp = ((PyObject*)p->_size); + p->_size = Py_None; Py_INCREF(Py_None); + Py_XDECREF(tmp); + Py_CLEAR(p->view.obj); + return 0; +} + +static PyObject *__pyx_sq_item_memoryview(PyObject *o, Py_ssize_t i) { + PyObject *r; + PyObject *x = PyLong_FromSsize_t(i); if(!x) return 0; + #if CYTHON_USE_TYPE_SLOTS || (!CYTHON_USE_TYPE_SPECS && __PYX_LIMITED_VERSION_HEX < 0x030A0000) + r = Py_TYPE(o)->tp_as_mapping->mp_subscript(o, x); + #else + r = ((binaryfunc)PyType_GetSlot(Py_TYPE(o), Py_mp_subscript))(o, x); + #endif + Py_DECREF(x); + return r; +} + +static int __pyx_mp_ass_subscript_memoryview(PyObject *o, PyObject *i, PyObject *v) { + if (v) { + return __pyx_memoryview___setitem__(o, i, v); + } + else { + __Pyx_TypeName o_type_name; + o_type_name = __Pyx_PyType_GetFullyQualifiedName(Py_TYPE(o)); + PyErr_Format(PyExc_NotImplementedError, + "Subscript deletion not supported by " __Pyx_FMT_TYPENAME, o_type_name); + __Pyx_DECREF_TypeName(o_type_name); + return -1; + } +} + +static PyObject *__pyx_getprop___pyx_memoryview_T(PyObject *o, CYTHON_UNUSED void *x) { + return __pyx_pw_15View_dot_MemoryView_10memoryview_1T_1__get__(o); +} + +static PyObject *__pyx_getprop___pyx_memoryview_base(PyObject *o, CYTHON_UNUSED void *x) { + return __pyx_pw_15View_dot_MemoryView_10memoryview_4base_1__get__(o); +} + +static PyObject *__pyx_getprop___pyx_memoryview_shape(PyObject *o, CYTHON_UNUSED void *x) { + return __pyx_pw_15View_dot_MemoryView_10memoryview_5shape_1__get__(o); +} + +static PyObject *__pyx_getprop___pyx_memoryview_strides(PyObject *o, CYTHON_UNUSED void *x) { + return __pyx_pw_15View_dot_MemoryView_10memoryview_7strides_1__get__(o); +} + +static PyObject *__pyx_getprop___pyx_memoryview_suboffsets(PyObject *o, CYTHON_UNUSED void *x) { + return __pyx_pw_15View_dot_MemoryView_10memoryview_10suboffsets_1__get__(o); +} + +static PyObject *__pyx_getprop___pyx_memoryview_ndim(PyObject *o, CYTHON_UNUSED void *x) { + return __pyx_pw_15View_dot_MemoryView_10memoryview_4ndim_1__get__(o); +} + +static PyObject *__pyx_getprop___pyx_memoryview_itemsize(PyObject *o, CYTHON_UNUSED void *x) { + return __pyx_pw_15View_dot_MemoryView_10memoryview_8itemsize_1__get__(o); +} + +static PyObject *__pyx_getprop___pyx_memoryview_nbytes(PyObject *o, CYTHON_UNUSED void *x) { + return __pyx_pw_15View_dot_MemoryView_10memoryview_6nbytes_1__get__(o); +} + +static PyObject *__pyx_getprop___pyx_memoryview_size(PyObject *o, CYTHON_UNUSED void *x) { + return __pyx_pw_15View_dot_MemoryView_10memoryview_4size_1__get__(o); +} + +static PyMethodDef __pyx_methods_memoryview[] = { + {"is_c_contig", (PyCFunction)(void(*)(void))(__Pyx_PyCFunction_FastCallWithKeywords)__pyx_memoryview_is_c_contig, __Pyx_METH_FASTCALL|METH_KEYWORDS, 0}, + {"is_f_contig", (PyCFunction)(void(*)(void))(__Pyx_PyCFunction_FastCallWithKeywords)__pyx_memoryview_is_f_contig, __Pyx_METH_FASTCALL|METH_KEYWORDS, 0}, + {"copy", (PyCFunction)(void(*)(void))(__Pyx_PyCFunction_FastCallWithKeywords)__pyx_memoryview_copy, __Pyx_METH_FASTCALL|METH_KEYWORDS, 0}, + {"copy_fortran", (PyCFunction)(void(*)(void))(__Pyx_PyCFunction_FastCallWithKeywords)__pyx_memoryview_copy_fortran, __Pyx_METH_FASTCALL|METH_KEYWORDS, 0}, + {"__reduce_cython__", (PyCFunction)(void(*)(void))(__Pyx_PyCFunction_FastCallWithKeywords)__pyx_pw___pyx_memoryview_1__reduce_cython__, __Pyx_METH_FASTCALL|METH_KEYWORDS, 0}, + {"__setstate_cython__", (PyCFunction)(void(*)(void))(__Pyx_PyCFunction_FastCallWithKeywords)__pyx_pw___pyx_memoryview_3__setstate_cython__, __Pyx_METH_FASTCALL|METH_KEYWORDS, 0}, + {0, 0, 0, 0} +}; + +static struct PyGetSetDef __pyx_getsets_memoryview[] = { + {"T", __pyx_getprop___pyx_memoryview_T, 0, 0, 0}, + {"base", __pyx_getprop___pyx_memoryview_base, 0, 0, 0}, + {"shape", __pyx_getprop___pyx_memoryview_shape, 0, 0, 0}, + {"strides", __pyx_getprop___pyx_memoryview_strides, 0, 0, 0}, + {"suboffsets", __pyx_getprop___pyx_memoryview_suboffsets, 0, 0, 0}, + {"ndim", __pyx_getprop___pyx_memoryview_ndim, 0, 0, 0}, + {"itemsize", __pyx_getprop___pyx_memoryview_itemsize, 0, 0, 0}, + {"nbytes", __pyx_getprop___pyx_memoryview_nbytes, 0, 0, 0}, + {"size", __pyx_getprop___pyx_memoryview_size, 0, 0, 0}, + {0, 0, 0, 0, 0} +}; +#if CYTHON_USE_TYPE_SPECS +#if !CYTHON_COMPILING_IN_LIMITED_API + +static PyBufferProcs __pyx_tp_as_buffer_memoryview = { + __pyx_memoryview_getbuffer, /*bf_getbuffer*/ + 0, /*bf_releasebuffer*/ +}; +#endif +static PyType_Slot __pyx_type___pyx_memoryview_slots[] = { + {Py_tp_dealloc, (void *)__pyx_tp_dealloc_memoryview}, + {Py_tp_repr, (void *)__pyx_memoryview___repr__}, + {Py_sq_length, (void *)__pyx_memoryview___len__}, + {Py_sq_item, (void *)__pyx_sq_item_memoryview}, + {Py_mp_length, (void *)__pyx_memoryview___len__}, + {Py_mp_subscript, (void *)__pyx_memoryview___getitem__}, + {Py_mp_ass_subscript, (void *)__pyx_mp_ass_subscript_memoryview}, + {Py_tp_str, (void *)__pyx_memoryview___str__}, + #if defined(Py_bf_getbuffer) + {Py_bf_getbuffer, (void *)__pyx_memoryview_getbuffer}, + #endif + {Py_tp_traverse, (void *)__pyx_tp_traverse_memoryview}, + {Py_tp_clear, (void *)__pyx_tp_clear_memoryview}, + {Py_tp_methods, (void *)__pyx_methods_memoryview}, + {Py_tp_getset, (void *)__pyx_getsets_memoryview}, + {Py_tp_new, (void *)__pyx_tp_new_memoryview}, + {0, 0}, +}; +static PyType_Spec __pyx_type___pyx_memoryview_spec = { + "spacy.pipeline._parser_internals.arc_eager.memoryview", + sizeof(struct __pyx_memoryview_obj), + 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___pyx_memoryview_slots, +}; +#else + +static PySequenceMethods __pyx_tp_as_sequence_memoryview = { + __pyx_memoryview___len__, /*sq_length*/ + 0, /*sq_concat*/ + 0, /*sq_repeat*/ + __pyx_sq_item_memoryview, /*sq_item*/ + 0, /*sq_slice*/ + 0, /*sq_ass_item*/ + 0, /*sq_ass_slice*/ + 0, /*sq_contains*/ + 0, /*sq_inplace_concat*/ + 0, /*sq_inplace_repeat*/ +}; + +static PyMappingMethods __pyx_tp_as_mapping_memoryview = { + __pyx_memoryview___len__, /*mp_length*/ + __pyx_memoryview___getitem__, /*mp_subscript*/ + __pyx_mp_ass_subscript_memoryview, /*mp_ass_subscript*/ +}; + +static PyBufferProcs __pyx_tp_as_buffer_memoryview = { + __pyx_memoryview_getbuffer, /*bf_getbuffer*/ + 0, /*bf_releasebuffer*/ +}; + +static PyTypeObject __pyx_type___pyx_memoryview = { + PyVarObject_HEAD_INIT(0, 0) + "spacy.pipeline._parser_internals.arc_eager.""memoryview", /*tp_name*/ + sizeof(struct __pyx_memoryview_obj), /*tp_basicsize*/ + 0, /*tp_itemsize*/ + __pyx_tp_dealloc_memoryview, /*tp_dealloc*/ + 0, /*tp_vectorcall_offset*/ + 0, /*tp_getattr*/ + 0, /*tp_setattr*/ + 0, /*tp_as_async*/ + __pyx_memoryview___repr__, /*tp_repr*/ + 0, /*tp_as_number*/ + &__pyx_tp_as_sequence_memoryview, /*tp_as_sequence*/ + &__pyx_tp_as_mapping_memoryview, /*tp_as_mapping*/ + 0, /*tp_hash*/ + 0, /*tp_call*/ + __pyx_memoryview___str__, /*tp_str*/ + 0, /*tp_getattro*/ + 0, /*tp_setattro*/ + &__pyx_tp_as_buffer_memoryview, /*tp_as_buffer*/ + Py_TPFLAGS_DEFAULT|Py_TPFLAGS_HAVE_VERSION_TAG|Py_TPFLAGS_CHECKTYPES|Py_TPFLAGS_HAVE_NEWBUFFER|Py_TPFLAGS_BASETYPE|Py_TPFLAGS_HAVE_GC, /*tp_flags*/ + 0, /*tp_doc*/ + __pyx_tp_traverse_memoryview, /*tp_traverse*/ + __pyx_tp_clear_memoryview, /*tp_clear*/ + 0, /*tp_richcompare*/ + 0, /*tp_weaklistoffset*/ + 0, /*tp_iter*/ + 0, /*tp_iternext*/ + __pyx_methods_memoryview, /*tp_methods*/ + 0, /*tp_members*/ + __pyx_getsets_memoryview, /*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_memoryview, /*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 struct __pyx_vtabstruct__memoryviewslice __pyx_vtable__memoryviewslice; + +static PyObject *__pyx_tp_new__memoryviewslice(PyTypeObject *t, PyObject *a, PyObject *k) { + struct __pyx_memoryviewslice_obj *p; + PyObject *o = __pyx_tp_new_memoryview(t, a, k); + if (unlikely(!o)) return 0; + p = ((struct __pyx_memoryviewslice_obj *)o); + p->__pyx_base.__pyx_vtab = (struct __pyx_vtabstruct_memoryview*)__pyx_vtabptr__memoryviewslice; + __Pyx_default_placement_construct(&(p->from_slice)); + p->from_object = Py_None; Py_INCREF(Py_None); + p->from_slice.memview = NULL; + return o; +} + +static void __pyx_tp_dealloc__memoryviewslice(PyObject *o) { + struct __pyx_memoryviewslice_obj *p = (struct __pyx_memoryviewslice_obj *)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__memoryviewslice) { + 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_memoryviewslice___dealloc__(o); + __Pyx_SET_REFCNT(o, Py_REFCNT(o) - 1); + PyErr_Restore(etype, eval, etb); + } + __Pyx_call_destructor(p->from_slice); + Py_CLEAR(p->from_object); + PyObject_GC_Track(o); + __pyx_tp_dealloc_memoryview(o); +} + +static int __pyx_tp_traverse__memoryviewslice(PyObject *o, visitproc v, void *a) { + int e; + struct __pyx_memoryviewslice_obj *p = (struct __pyx_memoryviewslice_obj *)o; + e = __pyx_tp_traverse_memoryview(o, v, a); if (e) return e; + if (p->from_object) { + e = (*v)(p->from_object, a); if (e) return e; + } + return 0; +} + +static int __pyx_tp_clear__memoryviewslice(PyObject *o) { + PyObject* tmp; + struct __pyx_memoryviewslice_obj *p = (struct __pyx_memoryviewslice_obj *)o; + __pyx_tp_clear_memoryview(o); + tmp = ((PyObject*)p->from_object); + p->from_object = Py_None; Py_INCREF(Py_None); + Py_XDECREF(tmp); + __PYX_XCLEAR_MEMVIEW(&p->from_slice, 1); + return 0; +} + +static PyMethodDef __pyx_methods__memoryviewslice[] = { + {"__reduce_cython__", (PyCFunction)(void(*)(void))(__Pyx_PyCFunction_FastCallWithKeywords)__pyx_pw___pyx_memoryviewslice_1__reduce_cython__, __Pyx_METH_FASTCALL|METH_KEYWORDS, 0}, + {"__setstate_cython__", (PyCFunction)(void(*)(void))(__Pyx_PyCFunction_FastCallWithKeywords)__pyx_pw___pyx_memoryviewslice_3__setstate_cython__, __Pyx_METH_FASTCALL|METH_KEYWORDS, 0}, + {0, 0, 0, 0} +}; +#if CYTHON_USE_TYPE_SPECS +static PyType_Slot __pyx_type___pyx_memoryviewslice_slots[] = { + {Py_tp_dealloc, (void *)__pyx_tp_dealloc__memoryviewslice}, + {Py_tp_doc, (void *)PyDoc_STR("Internal class for passing memoryview slices to Python")}, + {Py_tp_traverse, (void *)__pyx_tp_traverse__memoryviewslice}, + {Py_tp_clear, (void *)__pyx_tp_clear__memoryviewslice}, + {Py_tp_methods, (void *)__pyx_methods__memoryviewslice}, + {Py_tp_new, (void *)__pyx_tp_new__memoryviewslice}, + {0, 0}, +}; +static PyType_Spec __pyx_type___pyx_memoryviewslice_spec = { + "spacy.pipeline._parser_internals.arc_eager._memoryviewslice", + sizeof(struct __pyx_memoryviewslice_obj), + 0, + Py_TPFLAGS_DEFAULT|Py_TPFLAGS_HAVE_VERSION_TAG|Py_TPFLAGS_CHECKTYPES|Py_TPFLAGS_HAVE_NEWBUFFER|Py_TPFLAGS_BASETYPE|Py_TPFLAGS_HAVE_GC|Py_TPFLAGS_SEQUENCE, + __pyx_type___pyx_memoryviewslice_slots, +}; +#else + +static PyTypeObject __pyx_type___pyx_memoryviewslice = { + PyVarObject_HEAD_INIT(0, 0) + "spacy.pipeline._parser_internals.arc_eager.""_memoryviewslice", /*tp_name*/ + sizeof(struct __pyx_memoryviewslice_obj), /*tp_basicsize*/ + 0, /*tp_itemsize*/ + __pyx_tp_dealloc__memoryviewslice, /*tp_dealloc*/ + 0, /*tp_vectorcall_offset*/ + 0, /*tp_getattr*/ + 0, /*tp_setattr*/ + 0, /*tp_as_async*/ + #if CYTHON_COMPILING_IN_PYPY || 0 + __pyx_memoryview___repr__, /*tp_repr*/ + #else + 0, /*tp_repr*/ + #endif + 0, /*tp_as_number*/ + 0, /*tp_as_sequence*/ + 0, /*tp_as_mapping*/ + 0, /*tp_hash*/ + 0, /*tp_call*/ + #if CYTHON_COMPILING_IN_PYPY || 0 + __pyx_memoryview___str__, /*tp_str*/ + #else + 0, /*tp_str*/ + #endif + 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|Py_TPFLAGS_SEQUENCE, /*tp_flags*/ + PyDoc_STR("Internal class for passing memoryview slices to Python"), /*tp_doc*/ + __pyx_tp_traverse__memoryviewslice, /*tp_traverse*/ + __pyx_tp_clear__memoryviewslice, /*tp_clear*/ + 0, /*tp_richcompare*/ + 0, /*tp_weaklistoffset*/ + 0, /*tp_iter*/ + 0, /*tp_iternext*/ + __pyx_methods__memoryviewslice, /*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__memoryviewslice, /*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_collections_abc_Sequence = Py_None; Py_INCREF(Py_None); + generic = Py_None; Py_INCREF(Py_None); + strided = Py_None; Py_INCREF(Py_None); + indirect = Py_None; Py_INCREF(Py_None); + contiguous = Py_None; Py_INCREF(Py_None); + indirect_contiguous = Py_None; Py_INCREF(Py_None); + __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); + PyObject *__pyx_t_1 = NULL; + PyObject *__pyx_t_2 = NULL; + int __pyx_lineno = 0; + const char *__pyx_filename = NULL; + int __pyx_clineno = 0; + __Pyx_RefNannySetupContext("__Pyx_modinit_type_init_code", 0); + /*--- Type init code ---*/ + __pyx_t_1 = PyImport_ImportModule("spacy.pipeline._parser_internals.transition_system"); if (unlikely(!__pyx_t_1)) __PYX_ERR(0, 1, __pyx_L1_error) + __Pyx_GOTREF(__pyx_t_1); + __pyx_mstate->__pyx_ptype_5spacy_8pipeline_17_parser_internals_17transition_system_TransitionSystem = __Pyx_ImportType_3_2_1(__pyx_t_1, "spacy.pipeline._parser_internals.transition_system", "TransitionSystem", + #if defined(PYPY_VERSION_NUM) && PYPY_VERSION_NUM < 0x050B0000 + sizeof(struct __pyx_obj_5spacy_8pipeline_17_parser_internals_17transition_system_TransitionSystem), __PYX_GET_STRUCT_ALIGNMENT_3_2_1(struct __pyx_obj_5spacy_8pipeline_17_parser_internals_17transition_system_TransitionSystem), + #elif CYTHON_COMPILING_IN_LIMITED_API + sizeof(struct __pyx_obj_5spacy_8pipeline_17_parser_internals_17transition_system_TransitionSystem), __PYX_GET_STRUCT_ALIGNMENT_3_2_1(struct __pyx_obj_5spacy_8pipeline_17_parser_internals_17transition_system_TransitionSystem), + #else + sizeof(struct __pyx_obj_5spacy_8pipeline_17_parser_internals_17transition_system_TransitionSystem), __PYX_GET_STRUCT_ALIGNMENT_3_2_1(struct __pyx_obj_5spacy_8pipeline_17_parser_internals_17transition_system_TransitionSystem), + #endif + __Pyx_ImportType_CheckSize_Warn_3_2_1); if (!__pyx_mstate->__pyx_ptype_5spacy_8pipeline_17_parser_internals_17transition_system_TransitionSystem) __PYX_ERR(0, 1, __pyx_L1_error) + __pyx_vtabptr_5spacy_8pipeline_17_parser_internals_17transition_system_TransitionSystem = (struct __pyx_vtabstruct_5spacy_8pipeline_17_parser_internals_17transition_system_TransitionSystem*)__Pyx_GetVtable(__pyx_mstate->__pyx_ptype_5spacy_8pipeline_17_parser_internals_17transition_system_TransitionSystem); if (unlikely(!__pyx_vtabptr_5spacy_8pipeline_17_parser_internals_17transition_system_TransitionSystem)) __PYX_ERR(0, 1, __pyx_L1_error) + __pyx_vtabptr_5spacy_8pipeline_17_parser_internals_9arc_eager_ArcEager = &__pyx_vtable_5spacy_8pipeline_17_parser_internals_9arc_eager_ArcEager; + __pyx_vtable_5spacy_8pipeline_17_parser_internals_9arc_eager_ArcEager.__pyx_base = *__pyx_vtabptr_5spacy_8pipeline_17_parser_internals_17transition_system_TransitionSystem; + __pyx_vtable_5spacy_8pipeline_17_parser_internals_9arc_eager_ArcEager.__pyx_base.lookup_transition = (struct __pyx_t_5spacy_8pipeline_17_parser_internals_17transition_system_Transition (*)(struct __pyx_obj_5spacy_8pipeline_17_parser_internals_17transition_system_TransitionSystem *, PyObject *))__pyx_f_5spacy_8pipeline_17_parser_internals_9arc_eager_8ArcEager_lookup_transition; + __pyx_vtable_5spacy_8pipeline_17_parser_internals_9arc_eager_ArcEager.__pyx_base.init_transition = (struct __pyx_t_5spacy_8pipeline_17_parser_internals_17transition_system_Transition (*)(struct __pyx_obj_5spacy_8pipeline_17_parser_internals_17transition_system_TransitionSystem *, int, int, __pyx_t_5spacy_8typedefs_attr_t))__pyx_f_5spacy_8pipeline_17_parser_internals_9arc_eager_8ArcEager_init_transition; + __pyx_vtable_5spacy_8pipeline_17_parser_internals_9arc_eager_ArcEager.__pyx_base.set_valid = (int (*)(struct __pyx_obj_5spacy_8pipeline_17_parser_internals_17transition_system_TransitionSystem *, int *, __pyx_t_5spacy_8pipeline_17_parser_internals_6_state_StateC const *))__pyx_f_5spacy_8pipeline_17_parser_internals_9arc_eager_8ArcEager_set_valid; + __pyx_vtable_5spacy_8pipeline_17_parser_internals_9arc_eager_ArcEager.__pyx_base.set_costs = (int (*)(struct __pyx_obj_5spacy_8pipeline_17_parser_internals_17transition_system_TransitionSystem *, int *, __pyx_t_5spacy_8typedefs_weight_t *, __pyx_t_5spacy_8pipeline_17_parser_internals_6_state_StateC const *, PyObject *))__pyx_f_5spacy_8pipeline_17_parser_internals_9arc_eager_8ArcEager_set_costs; + __pyx_vtable_5spacy_8pipeline_17_parser_internals_9arc_eager_ArcEager.get_arcs = (PyObject *(*)(struct __pyx_obj_5spacy_8pipeline_17_parser_internals_9arc_eager_ArcEager *, __pyx_t_5spacy_8pipeline_17_parser_internals_6_state_StateC *))__pyx_f_5spacy_8pipeline_17_parser_internals_9arc_eager_8ArcEager_get_arcs; + #if CYTHON_USE_TYPE_SPECS + __pyx_t_2 = PyTuple_Pack(1, (PyObject *)__pyx_mstate_global->__pyx_ptype_5spacy_8pipeline_17_parser_internals_17transition_system_TransitionSystem); if (unlikely(!__pyx_t_2)) __PYX_ERR(0, 576, __pyx_L1_error) + __Pyx_GOTREF(__pyx_t_2); + __pyx_mstate->__pyx_ptype_5spacy_8pipeline_17_parser_internals_9arc_eager_ArcEager = (PyTypeObject *) __Pyx_PyType_FromModuleAndSpec(__pyx_m, &__pyx_type_5spacy_8pipeline_17_parser_internals_9arc_eager_ArcEager_spec, __pyx_t_2); + __Pyx_XDECREF(__pyx_t_2); __pyx_t_2 = 0; + if (unlikely(!__pyx_mstate->__pyx_ptype_5spacy_8pipeline_17_parser_internals_9arc_eager_ArcEager)) __PYX_ERR(0, 576, __pyx_L1_error) + if (__Pyx_fix_up_extension_type_from_spec(&__pyx_type_5spacy_8pipeline_17_parser_internals_9arc_eager_ArcEager_spec, __pyx_mstate->__pyx_ptype_5spacy_8pipeline_17_parser_internals_9arc_eager_ArcEager) < (0)) __PYX_ERR(0, 576, __pyx_L1_error) + #else + __pyx_mstate->__pyx_ptype_5spacy_8pipeline_17_parser_internals_9arc_eager_ArcEager = &__pyx_type_5spacy_8pipeline_17_parser_internals_9arc_eager_ArcEager; + #endif + #if !CYTHON_COMPILING_IN_LIMITED_API + __pyx_mstate_global->__pyx_ptype_5spacy_8pipeline_17_parser_internals_9arc_eager_ArcEager->tp_base = __pyx_mstate_global->__pyx_ptype_5spacy_8pipeline_17_parser_internals_17transition_system_TransitionSystem; + #endif + #if !CYTHON_USE_TYPE_SPECS + if (__Pyx_PyType_Ready(__pyx_mstate->__pyx_ptype_5spacy_8pipeline_17_parser_internals_9arc_eager_ArcEager) < (0)) __PYX_ERR(0, 576, __pyx_L1_error) + #endif + #if CYTHON_COMPILING_IN_CPYTHON && PY_VERSION_HEX >= 0x030E0000 + PyUnstable_Object_EnableDeferredRefcount((PyObject*)__pyx_mstate->__pyx_ptype_5spacy_8pipeline_17_parser_internals_9arc_eager_ArcEager); + #endif + #if !CYTHON_COMPILING_IN_LIMITED_API + if ((CYTHON_USE_TYPE_SLOTS && CYTHON_USE_PYTYPE_LOOKUP) && likely(!__pyx_mstate->__pyx_ptype_5spacy_8pipeline_17_parser_internals_9arc_eager_ArcEager->tp_dictoffset && __pyx_mstate->__pyx_ptype_5spacy_8pipeline_17_parser_internals_9arc_eager_ArcEager->tp_getattro == PyObject_GenericGetAttr)) { + __pyx_mstate->__pyx_ptype_5spacy_8pipeline_17_parser_internals_9arc_eager_ArcEager->tp_getattro = PyObject_GenericGetAttr; + } + #endif + if (__Pyx_SetVtable(__pyx_mstate->__pyx_ptype_5spacy_8pipeline_17_parser_internals_9arc_eager_ArcEager, __pyx_vtabptr_5spacy_8pipeline_17_parser_internals_9arc_eager_ArcEager) < (0)) __PYX_ERR(0, 576, __pyx_L1_error) + if (__Pyx_MergeVtables(__pyx_mstate->__pyx_ptype_5spacy_8pipeline_17_parser_internals_9arc_eager_ArcEager) < (0)) __PYX_ERR(0, 576, __pyx_L1_error) + if (PyObject_SetAttr(__pyx_m, __pyx_mstate_global->__pyx_n_u_ArcEager, (PyObject *) __pyx_mstate->__pyx_ptype_5spacy_8pipeline_17_parser_internals_9arc_eager_ArcEager) < (0)) __PYX_ERR(0, 576, __pyx_L1_error) + if (__Pyx_setup_reduce((PyObject *) __pyx_mstate->__pyx_ptype_5spacy_8pipeline_17_parser_internals_9arc_eager_ArcEager) < (0)) __PYX_ERR(0, 576, __pyx_L1_error) + #if CYTHON_USE_TYPE_SPECS + __pyx_mstate->__pyx_ptype_5spacy_8pipeline_17_parser_internals_9arc_eager_ArcEagerGold = (PyTypeObject *) __Pyx_PyType_FromModuleAndSpec(__pyx_m, &__pyx_type_5spacy_8pipeline_17_parser_internals_9arc_eager_ArcEagerGold_spec, NULL); if (unlikely(!__pyx_mstate->__pyx_ptype_5spacy_8pipeline_17_parser_internals_9arc_eager_ArcEagerGold)) __PYX_ERR(0, 199, __pyx_L1_error) + if (__Pyx_fix_up_extension_type_from_spec(&__pyx_type_5spacy_8pipeline_17_parser_internals_9arc_eager_ArcEagerGold_spec, __pyx_mstate->__pyx_ptype_5spacy_8pipeline_17_parser_internals_9arc_eager_ArcEagerGold) < (0)) __PYX_ERR(0, 199, __pyx_L1_error) + #else + __pyx_mstate->__pyx_ptype_5spacy_8pipeline_17_parser_internals_9arc_eager_ArcEagerGold = &__pyx_type_5spacy_8pipeline_17_parser_internals_9arc_eager_ArcEagerGold; + #endif + #if !CYTHON_COMPILING_IN_LIMITED_API + #endif + #if !CYTHON_USE_TYPE_SPECS + if (__Pyx_PyType_Ready(__pyx_mstate->__pyx_ptype_5spacy_8pipeline_17_parser_internals_9arc_eager_ArcEagerGold) < (0)) __PYX_ERR(0, 199, __pyx_L1_error) + #endif + #if CYTHON_COMPILING_IN_CPYTHON && PY_VERSION_HEX >= 0x030E0000 + PyUnstable_Object_EnableDeferredRefcount((PyObject*)__pyx_mstate->__pyx_ptype_5spacy_8pipeline_17_parser_internals_9arc_eager_ArcEagerGold); + #endif + #if !CYTHON_COMPILING_IN_LIMITED_API + if ((CYTHON_USE_TYPE_SLOTS && CYTHON_USE_PYTYPE_LOOKUP) && likely(!__pyx_mstate->__pyx_ptype_5spacy_8pipeline_17_parser_internals_9arc_eager_ArcEagerGold->tp_dictoffset && __pyx_mstate->__pyx_ptype_5spacy_8pipeline_17_parser_internals_9arc_eager_ArcEagerGold->tp_getattro == PyObject_GenericGetAttr)) { + __pyx_mstate->__pyx_ptype_5spacy_8pipeline_17_parser_internals_9arc_eager_ArcEagerGold->tp_getattro = PyObject_GenericGetAttr; + } + #endif + if (PyObject_SetAttr(__pyx_m, __pyx_mstate_global->__pyx_n_u_ArcEagerGold, (PyObject *) __pyx_mstate->__pyx_ptype_5spacy_8pipeline_17_parser_internals_9arc_eager_ArcEagerGold) < (0)) __PYX_ERR(0, 199, __pyx_L1_error) + if (__Pyx_setup_reduce((PyObject *) __pyx_mstate->__pyx_ptype_5spacy_8pipeline_17_parser_internals_9arc_eager_ArcEagerGold) < (0)) __PYX_ERR(0, 199, __pyx_L1_error) + __pyx_vtabptr_5spacy_8pipeline_17_parser_internals_9arc_eager_Shift = &__pyx_vtable_5spacy_8pipeline_17_parser_internals_9arc_eager_Shift; + __pyx_vtable_5spacy_8pipeline_17_parser_internals_9arc_eager_Shift.is_valid = (int (*)(__pyx_t_5spacy_8pipeline_17_parser_internals_6_state_StateC const *, __pyx_t_5spacy_8typedefs_attr_t))__pyx_f_5spacy_8pipeline_17_parser_internals_9arc_eager_5Shift_is_valid; + __pyx_vtable_5spacy_8pipeline_17_parser_internals_9arc_eager_Shift.transition = (int (*)(__pyx_t_5spacy_8pipeline_17_parser_internals_6_state_StateC *, __pyx_t_5spacy_8typedefs_attr_t))__pyx_f_5spacy_8pipeline_17_parser_internals_9arc_eager_5Shift_transition; + __pyx_vtable_5spacy_8pipeline_17_parser_internals_9arc_eager_Shift.cost = (__pyx_t_5spacy_8typedefs_weight_t (*)(__pyx_t_5spacy_8pipeline_17_parser_internals_6_state_StateC const *, void const *, __pyx_t_5spacy_8typedefs_attr_t))__pyx_f_5spacy_8pipeline_17_parser_internals_9arc_eager_5Shift_cost; + #if CYTHON_USE_TYPE_SPECS + __pyx_mstate->__pyx_ptype_5spacy_8pipeline_17_parser_internals_9arc_eager_Shift = (PyTypeObject *) __Pyx_PyType_FromModuleAndSpec(__pyx_m, &__pyx_type_5spacy_8pipeline_17_parser_internals_9arc_eager_Shift_spec, NULL); if (unlikely(!__pyx_mstate->__pyx_ptype_5spacy_8pipeline_17_parser_internals_9arc_eager_Shift)) __PYX_ERR(0, 323, __pyx_L1_error) + if (__Pyx_fix_up_extension_type_from_spec(&__pyx_type_5spacy_8pipeline_17_parser_internals_9arc_eager_Shift_spec, __pyx_mstate->__pyx_ptype_5spacy_8pipeline_17_parser_internals_9arc_eager_Shift) < (0)) __PYX_ERR(0, 323, __pyx_L1_error) + #else + __pyx_mstate->__pyx_ptype_5spacy_8pipeline_17_parser_internals_9arc_eager_Shift = &__pyx_type_5spacy_8pipeline_17_parser_internals_9arc_eager_Shift; + #endif + #if !CYTHON_COMPILING_IN_LIMITED_API + #endif + #if !CYTHON_USE_TYPE_SPECS + if (__Pyx_PyType_Ready(__pyx_mstate->__pyx_ptype_5spacy_8pipeline_17_parser_internals_9arc_eager_Shift) < (0)) __PYX_ERR(0, 323, __pyx_L1_error) + #endif + #if CYTHON_COMPILING_IN_CPYTHON && PY_VERSION_HEX >= 0x030E0000 + PyUnstable_Object_EnableDeferredRefcount((PyObject*)__pyx_mstate->__pyx_ptype_5spacy_8pipeline_17_parser_internals_9arc_eager_Shift); + #endif + #if !CYTHON_COMPILING_IN_LIMITED_API + if ((CYTHON_USE_TYPE_SLOTS && CYTHON_USE_PYTYPE_LOOKUP) && likely(!__pyx_mstate->__pyx_ptype_5spacy_8pipeline_17_parser_internals_9arc_eager_Shift->tp_dictoffset && __pyx_mstate->__pyx_ptype_5spacy_8pipeline_17_parser_internals_9arc_eager_Shift->tp_getattro == PyObject_GenericGetAttr)) { + __pyx_mstate->__pyx_ptype_5spacy_8pipeline_17_parser_internals_9arc_eager_Shift->tp_getattro = PyObject_GenericGetAttr; + } + #endif + if (__Pyx_SetVtable(__pyx_mstate->__pyx_ptype_5spacy_8pipeline_17_parser_internals_9arc_eager_Shift, __pyx_vtabptr_5spacy_8pipeline_17_parser_internals_9arc_eager_Shift) < (0)) __PYX_ERR(0, 323, __pyx_L1_error) + if (__Pyx_MergeVtables(__pyx_mstate->__pyx_ptype_5spacy_8pipeline_17_parser_internals_9arc_eager_Shift) < (0)) __PYX_ERR(0, 323, __pyx_L1_error) + if (PyObject_SetAttr(__pyx_m, __pyx_mstate_global->__pyx_n_u_Shift, (PyObject *) __pyx_mstate->__pyx_ptype_5spacy_8pipeline_17_parser_internals_9arc_eager_Shift) < (0)) __PYX_ERR(0, 323, __pyx_L1_error) + if (__Pyx_setup_reduce((PyObject *) __pyx_mstate->__pyx_ptype_5spacy_8pipeline_17_parser_internals_9arc_eager_Shift) < (0)) __PYX_ERR(0, 323, __pyx_L1_error) + __pyx_vtabptr_5spacy_8pipeline_17_parser_internals_9arc_eager_Reduce = &__pyx_vtable_5spacy_8pipeline_17_parser_internals_9arc_eager_Reduce; + __pyx_vtable_5spacy_8pipeline_17_parser_internals_9arc_eager_Reduce.is_valid = (int (*)(__pyx_t_5spacy_8pipeline_17_parser_internals_6_state_StateC const *, __pyx_t_5spacy_8typedefs_attr_t))__pyx_f_5spacy_8pipeline_17_parser_internals_9arc_eager_6Reduce_is_valid; + __pyx_vtable_5spacy_8pipeline_17_parser_internals_9arc_eager_Reduce.transition = (int (*)(__pyx_t_5spacy_8pipeline_17_parser_internals_6_state_StateC *, __pyx_t_5spacy_8typedefs_attr_t))__pyx_f_5spacy_8pipeline_17_parser_internals_9arc_eager_6Reduce_transition; + __pyx_vtable_5spacy_8pipeline_17_parser_internals_9arc_eager_Reduce.cost = (__pyx_t_5spacy_8typedefs_weight_t (*)(__pyx_t_5spacy_8pipeline_17_parser_internals_6_state_StateC const *, void const *, __pyx_t_5spacy_8typedefs_attr_t))__pyx_f_5spacy_8pipeline_17_parser_internals_9arc_eager_6Reduce_cost; + #if CYTHON_USE_TYPE_SPECS + __pyx_mstate->__pyx_ptype_5spacy_8pipeline_17_parser_internals_9arc_eager_Reduce = (PyTypeObject *) __Pyx_PyType_FromModuleAndSpec(__pyx_m, &__pyx_type_5spacy_8pipeline_17_parser_internals_9arc_eager_Reduce_spec, NULL); if (unlikely(!__pyx_mstate->__pyx_ptype_5spacy_8pipeline_17_parser_internals_9arc_eager_Reduce)) __PYX_ERR(0, 361, __pyx_L1_error) + if (__Pyx_fix_up_extension_type_from_spec(&__pyx_type_5spacy_8pipeline_17_parser_internals_9arc_eager_Reduce_spec, __pyx_mstate->__pyx_ptype_5spacy_8pipeline_17_parser_internals_9arc_eager_Reduce) < (0)) __PYX_ERR(0, 361, __pyx_L1_error) + #else + __pyx_mstate->__pyx_ptype_5spacy_8pipeline_17_parser_internals_9arc_eager_Reduce = &__pyx_type_5spacy_8pipeline_17_parser_internals_9arc_eager_Reduce; + #endif + #if !CYTHON_COMPILING_IN_LIMITED_API + #endif + #if !CYTHON_USE_TYPE_SPECS + if (__Pyx_PyType_Ready(__pyx_mstate->__pyx_ptype_5spacy_8pipeline_17_parser_internals_9arc_eager_Reduce) < (0)) __PYX_ERR(0, 361, __pyx_L1_error) + #endif + #if CYTHON_COMPILING_IN_CPYTHON && PY_VERSION_HEX >= 0x030E0000 + PyUnstable_Object_EnableDeferredRefcount((PyObject*)__pyx_mstate->__pyx_ptype_5spacy_8pipeline_17_parser_internals_9arc_eager_Reduce); + #endif + #if !CYTHON_COMPILING_IN_LIMITED_API + if ((CYTHON_USE_TYPE_SLOTS && CYTHON_USE_PYTYPE_LOOKUP) && likely(!__pyx_mstate->__pyx_ptype_5spacy_8pipeline_17_parser_internals_9arc_eager_Reduce->tp_dictoffset && __pyx_mstate->__pyx_ptype_5spacy_8pipeline_17_parser_internals_9arc_eager_Reduce->tp_getattro == PyObject_GenericGetAttr)) { + __pyx_mstate->__pyx_ptype_5spacy_8pipeline_17_parser_internals_9arc_eager_Reduce->tp_getattro = PyObject_GenericGetAttr; + } + #endif + if (__Pyx_SetVtable(__pyx_mstate->__pyx_ptype_5spacy_8pipeline_17_parser_internals_9arc_eager_Reduce, __pyx_vtabptr_5spacy_8pipeline_17_parser_internals_9arc_eager_Reduce) < (0)) __PYX_ERR(0, 361, __pyx_L1_error) + if (__Pyx_MergeVtables(__pyx_mstate->__pyx_ptype_5spacy_8pipeline_17_parser_internals_9arc_eager_Reduce) < (0)) __PYX_ERR(0, 361, __pyx_L1_error) + if (PyObject_SetAttr(__pyx_m, __pyx_mstate_global->__pyx_n_u_Reduce, (PyObject *) __pyx_mstate->__pyx_ptype_5spacy_8pipeline_17_parser_internals_9arc_eager_Reduce) < (0)) __PYX_ERR(0, 361, __pyx_L1_error) + if (__Pyx_setup_reduce((PyObject *) __pyx_mstate->__pyx_ptype_5spacy_8pipeline_17_parser_internals_9arc_eager_Reduce) < (0)) __PYX_ERR(0, 361, __pyx_L1_error) + __pyx_vtabptr_5spacy_8pipeline_17_parser_internals_9arc_eager_LeftArc = &__pyx_vtable_5spacy_8pipeline_17_parser_internals_9arc_eager_LeftArc; + __pyx_vtable_5spacy_8pipeline_17_parser_internals_9arc_eager_LeftArc.is_valid = (int (*)(__pyx_t_5spacy_8pipeline_17_parser_internals_6_state_StateC const *, __pyx_t_5spacy_8typedefs_attr_t))__pyx_f_5spacy_8pipeline_17_parser_internals_9arc_eager_7LeftArc_is_valid; + __pyx_vtable_5spacy_8pipeline_17_parser_internals_9arc_eager_LeftArc.transition = (int (*)(__pyx_t_5spacy_8pipeline_17_parser_internals_6_state_StateC *, __pyx_t_5spacy_8typedefs_attr_t))__pyx_f_5spacy_8pipeline_17_parser_internals_9arc_eager_7LeftArc_transition; + __pyx_vtable_5spacy_8pipeline_17_parser_internals_9arc_eager_LeftArc.cost = (__pyx_t_5spacy_8typedefs_weight_t (*)(__pyx_t_5spacy_8pipeline_17_parser_internals_6_state_StateC const *, void const *, __pyx_t_5spacy_8typedefs_attr_t))__pyx_f_5spacy_8pipeline_17_parser_internals_9arc_eager_7LeftArc_cost; + #if CYTHON_USE_TYPE_SPECS + __pyx_mstate->__pyx_ptype_5spacy_8pipeline_17_parser_internals_9arc_eager_LeftArc = (PyTypeObject *) __Pyx_PyType_FromModuleAndSpec(__pyx_m, &__pyx_type_5spacy_8pipeline_17_parser_internals_9arc_eager_LeftArc_spec, NULL); if (unlikely(!__pyx_mstate->__pyx_ptype_5spacy_8pipeline_17_parser_internals_9arc_eager_LeftArc)) __PYX_ERR(0, 411, __pyx_L1_error) + if (__Pyx_fix_up_extension_type_from_spec(&__pyx_type_5spacy_8pipeline_17_parser_internals_9arc_eager_LeftArc_spec, __pyx_mstate->__pyx_ptype_5spacy_8pipeline_17_parser_internals_9arc_eager_LeftArc) < (0)) __PYX_ERR(0, 411, __pyx_L1_error) + #else + __pyx_mstate->__pyx_ptype_5spacy_8pipeline_17_parser_internals_9arc_eager_LeftArc = &__pyx_type_5spacy_8pipeline_17_parser_internals_9arc_eager_LeftArc; + #endif + #if !CYTHON_COMPILING_IN_LIMITED_API + #endif + #if !CYTHON_USE_TYPE_SPECS + if (__Pyx_PyType_Ready(__pyx_mstate->__pyx_ptype_5spacy_8pipeline_17_parser_internals_9arc_eager_LeftArc) < (0)) __PYX_ERR(0, 411, __pyx_L1_error) + #endif + #if CYTHON_COMPILING_IN_CPYTHON && PY_VERSION_HEX >= 0x030E0000 + PyUnstable_Object_EnableDeferredRefcount((PyObject*)__pyx_mstate->__pyx_ptype_5spacy_8pipeline_17_parser_internals_9arc_eager_LeftArc); + #endif + #if !CYTHON_COMPILING_IN_LIMITED_API + if ((CYTHON_USE_TYPE_SLOTS && CYTHON_USE_PYTYPE_LOOKUP) && likely(!__pyx_mstate->__pyx_ptype_5spacy_8pipeline_17_parser_internals_9arc_eager_LeftArc->tp_dictoffset && __pyx_mstate->__pyx_ptype_5spacy_8pipeline_17_parser_internals_9arc_eager_LeftArc->tp_getattro == PyObject_GenericGetAttr)) { + __pyx_mstate->__pyx_ptype_5spacy_8pipeline_17_parser_internals_9arc_eager_LeftArc->tp_getattro = PyObject_GenericGetAttr; + } + #endif + if (__Pyx_SetVtable(__pyx_mstate->__pyx_ptype_5spacy_8pipeline_17_parser_internals_9arc_eager_LeftArc, __pyx_vtabptr_5spacy_8pipeline_17_parser_internals_9arc_eager_LeftArc) < (0)) __PYX_ERR(0, 411, __pyx_L1_error) + if (__Pyx_MergeVtables(__pyx_mstate->__pyx_ptype_5spacy_8pipeline_17_parser_internals_9arc_eager_LeftArc) < (0)) __PYX_ERR(0, 411, __pyx_L1_error) + if (PyObject_SetAttr(__pyx_m, __pyx_mstate_global->__pyx_n_u_LeftArc, (PyObject *) __pyx_mstate->__pyx_ptype_5spacy_8pipeline_17_parser_internals_9arc_eager_LeftArc) < (0)) __PYX_ERR(0, 411, __pyx_L1_error) + if (__Pyx_setup_reduce((PyObject *) __pyx_mstate->__pyx_ptype_5spacy_8pipeline_17_parser_internals_9arc_eager_LeftArc) < (0)) __PYX_ERR(0, 411, __pyx_L1_error) + __pyx_vtabptr_5spacy_8pipeline_17_parser_internals_9arc_eager_RightArc = &__pyx_vtable_5spacy_8pipeline_17_parser_internals_9arc_eager_RightArc; + __pyx_vtable_5spacy_8pipeline_17_parser_internals_9arc_eager_RightArc.is_valid = (int (*)(__pyx_t_5spacy_8pipeline_17_parser_internals_6_state_StateC const *, __pyx_t_5spacy_8typedefs_attr_t))__pyx_f_5spacy_8pipeline_17_parser_internals_9arc_eager_8RightArc_is_valid; + __pyx_vtable_5spacy_8pipeline_17_parser_internals_9arc_eager_RightArc.transition = (int (*)(__pyx_t_5spacy_8pipeline_17_parser_internals_6_state_StateC *, __pyx_t_5spacy_8typedefs_attr_t))__pyx_f_5spacy_8pipeline_17_parser_internals_9arc_eager_8RightArc_transition; + __pyx_vtable_5spacy_8pipeline_17_parser_internals_9arc_eager_RightArc.cost = (__pyx_t_5spacy_8typedefs_weight_t (*)(__pyx_t_5spacy_8pipeline_17_parser_internals_6_state_StateC const *, void const *, __pyx_t_5spacy_8typedefs_attr_t))__pyx_f_5spacy_8pipeline_17_parser_internals_9arc_eager_8RightArc_cost; + #if CYTHON_USE_TYPE_SPECS + __pyx_mstate->__pyx_ptype_5spacy_8pipeline_17_parser_internals_9arc_eager_RightArc = (PyTypeObject *) __Pyx_PyType_FromModuleAndSpec(__pyx_m, &__pyx_type_5spacy_8pipeline_17_parser_internals_9arc_eager_RightArc_spec, NULL); if (unlikely(!__pyx_mstate->__pyx_ptype_5spacy_8pipeline_17_parser_internals_9arc_eager_RightArc)) __PYX_ERR(0, 464, __pyx_L1_error) + if (__Pyx_fix_up_extension_type_from_spec(&__pyx_type_5spacy_8pipeline_17_parser_internals_9arc_eager_RightArc_spec, __pyx_mstate->__pyx_ptype_5spacy_8pipeline_17_parser_internals_9arc_eager_RightArc) < (0)) __PYX_ERR(0, 464, __pyx_L1_error) + #else + __pyx_mstate->__pyx_ptype_5spacy_8pipeline_17_parser_internals_9arc_eager_RightArc = &__pyx_type_5spacy_8pipeline_17_parser_internals_9arc_eager_RightArc; + #endif + #if !CYTHON_COMPILING_IN_LIMITED_API + #endif + #if !CYTHON_USE_TYPE_SPECS + if (__Pyx_PyType_Ready(__pyx_mstate->__pyx_ptype_5spacy_8pipeline_17_parser_internals_9arc_eager_RightArc) < (0)) __PYX_ERR(0, 464, __pyx_L1_error) + #endif + #if CYTHON_COMPILING_IN_CPYTHON && PY_VERSION_HEX >= 0x030E0000 + PyUnstable_Object_EnableDeferredRefcount((PyObject*)__pyx_mstate->__pyx_ptype_5spacy_8pipeline_17_parser_internals_9arc_eager_RightArc); + #endif + #if !CYTHON_COMPILING_IN_LIMITED_API + if ((CYTHON_USE_TYPE_SLOTS && CYTHON_USE_PYTYPE_LOOKUP) && likely(!__pyx_mstate->__pyx_ptype_5spacy_8pipeline_17_parser_internals_9arc_eager_RightArc->tp_dictoffset && __pyx_mstate->__pyx_ptype_5spacy_8pipeline_17_parser_internals_9arc_eager_RightArc->tp_getattro == PyObject_GenericGetAttr)) { + __pyx_mstate->__pyx_ptype_5spacy_8pipeline_17_parser_internals_9arc_eager_RightArc->tp_getattro = PyObject_GenericGetAttr; + } + #endif + if (__Pyx_SetVtable(__pyx_mstate->__pyx_ptype_5spacy_8pipeline_17_parser_internals_9arc_eager_RightArc, __pyx_vtabptr_5spacy_8pipeline_17_parser_internals_9arc_eager_RightArc) < (0)) __PYX_ERR(0, 464, __pyx_L1_error) + if (__Pyx_MergeVtables(__pyx_mstate->__pyx_ptype_5spacy_8pipeline_17_parser_internals_9arc_eager_RightArc) < (0)) __PYX_ERR(0, 464, __pyx_L1_error) + if (PyObject_SetAttr(__pyx_m, __pyx_mstate_global->__pyx_n_u_RightArc, (PyObject *) __pyx_mstate->__pyx_ptype_5spacy_8pipeline_17_parser_internals_9arc_eager_RightArc) < (0)) __PYX_ERR(0, 464, __pyx_L1_error) + if (__Pyx_setup_reduce((PyObject *) __pyx_mstate->__pyx_ptype_5spacy_8pipeline_17_parser_internals_9arc_eager_RightArc) < (0)) __PYX_ERR(0, 464, __pyx_L1_error) + __pyx_vtabptr_5spacy_8pipeline_17_parser_internals_9arc_eager_Break = &__pyx_vtable_5spacy_8pipeline_17_parser_internals_9arc_eager_Break; + __pyx_vtable_5spacy_8pipeline_17_parser_internals_9arc_eager_Break.is_valid = (int (*)(__pyx_t_5spacy_8pipeline_17_parser_internals_6_state_StateC const *, __pyx_t_5spacy_8typedefs_attr_t))__pyx_f_5spacy_8pipeline_17_parser_internals_9arc_eager_5Break_is_valid; + __pyx_vtable_5spacy_8pipeline_17_parser_internals_9arc_eager_Break.transition = (int (*)(__pyx_t_5spacy_8pipeline_17_parser_internals_6_state_StateC *, __pyx_t_5spacy_8typedefs_attr_t))__pyx_f_5spacy_8pipeline_17_parser_internals_9arc_eager_5Break_transition; + __pyx_vtable_5spacy_8pipeline_17_parser_internals_9arc_eager_Break.cost = (__pyx_t_5spacy_8typedefs_weight_t (*)(__pyx_t_5spacy_8pipeline_17_parser_internals_6_state_StateC const *, void const *, __pyx_t_5spacy_8typedefs_attr_t))__pyx_f_5spacy_8pipeline_17_parser_internals_9arc_eager_5Break_cost; + #if CYTHON_USE_TYPE_SPECS + __pyx_mstate->__pyx_ptype_5spacy_8pipeline_17_parser_internals_9arc_eager_Break = (PyTypeObject *) __Pyx_PyType_FromModuleAndSpec(__pyx_m, &__pyx_type_5spacy_8pipeline_17_parser_internals_9arc_eager_Break_spec, NULL); if (unlikely(!__pyx_mstate->__pyx_ptype_5spacy_8pipeline_17_parser_internals_9arc_eager_Break)) __PYX_ERR(0, 509, __pyx_L1_error) + if (__Pyx_fix_up_extension_type_from_spec(&__pyx_type_5spacy_8pipeline_17_parser_internals_9arc_eager_Break_spec, __pyx_mstate->__pyx_ptype_5spacy_8pipeline_17_parser_internals_9arc_eager_Break) < (0)) __PYX_ERR(0, 509, __pyx_L1_error) + #else + __pyx_mstate->__pyx_ptype_5spacy_8pipeline_17_parser_internals_9arc_eager_Break = &__pyx_type_5spacy_8pipeline_17_parser_internals_9arc_eager_Break; + #endif + #if !CYTHON_COMPILING_IN_LIMITED_API + #endif + #if !CYTHON_USE_TYPE_SPECS + if (__Pyx_PyType_Ready(__pyx_mstate->__pyx_ptype_5spacy_8pipeline_17_parser_internals_9arc_eager_Break) < (0)) __PYX_ERR(0, 509, __pyx_L1_error) + #endif + #if CYTHON_COMPILING_IN_CPYTHON && PY_VERSION_HEX >= 0x030E0000 + PyUnstable_Object_EnableDeferredRefcount((PyObject*)__pyx_mstate->__pyx_ptype_5spacy_8pipeline_17_parser_internals_9arc_eager_Break); + #endif + #if !CYTHON_COMPILING_IN_LIMITED_API + if ((CYTHON_USE_TYPE_SLOTS && CYTHON_USE_PYTYPE_LOOKUP) && likely(!__pyx_mstate->__pyx_ptype_5spacy_8pipeline_17_parser_internals_9arc_eager_Break->tp_dictoffset && __pyx_mstate->__pyx_ptype_5spacy_8pipeline_17_parser_internals_9arc_eager_Break->tp_getattro == PyObject_GenericGetAttr)) { + __pyx_mstate->__pyx_ptype_5spacy_8pipeline_17_parser_internals_9arc_eager_Break->tp_getattro = PyObject_GenericGetAttr; + } + #endif + if (__Pyx_SetVtable(__pyx_mstate->__pyx_ptype_5spacy_8pipeline_17_parser_internals_9arc_eager_Break, __pyx_vtabptr_5spacy_8pipeline_17_parser_internals_9arc_eager_Break) < (0)) __PYX_ERR(0, 509, __pyx_L1_error) + if (__Pyx_MergeVtables(__pyx_mstate->__pyx_ptype_5spacy_8pipeline_17_parser_internals_9arc_eager_Break) < (0)) __PYX_ERR(0, 509, __pyx_L1_error) + if (PyObject_SetAttr(__pyx_m, __pyx_mstate_global->__pyx_n_u_Break, (PyObject *) __pyx_mstate->__pyx_ptype_5spacy_8pipeline_17_parser_internals_9arc_eager_Break) < (0)) __PYX_ERR(0, 509, __pyx_L1_error) + if (__Pyx_setup_reduce((PyObject *) __pyx_mstate->__pyx_ptype_5spacy_8pipeline_17_parser_internals_9arc_eager_Break) < (0)) __PYX_ERR(0, 509, __pyx_L1_error) + #if CYTHON_USE_TYPE_SPECS + __pyx_mstate->__pyx_ptype_5spacy_8pipeline_17_parser_internals_9arc_eager___pyx_scope_struct___get_aligned_sent_starts = (PyTypeObject *) __Pyx_PyType_FromModuleAndSpec(__pyx_m, &__pyx_type_5spacy_8pipeline_17_parser_internals_9arc_eager___pyx_scope_struct___get_aligned_sent_starts_spec, NULL); if (unlikely(!__pyx_mstate->__pyx_ptype_5spacy_8pipeline_17_parser_internals_9arc_eager___pyx_scope_struct___get_aligned_sent_starts)) __PYX_ERR(0, 215, __pyx_L1_error) + if (__Pyx_fix_up_extension_type_from_spec(&__pyx_type_5spacy_8pipeline_17_parser_internals_9arc_eager___pyx_scope_struct___get_aligned_sent_starts_spec, __pyx_mstate->__pyx_ptype_5spacy_8pipeline_17_parser_internals_9arc_eager___pyx_scope_struct___get_aligned_sent_starts) < (0)) __PYX_ERR(0, 215, __pyx_L1_error) + #else + __pyx_mstate->__pyx_ptype_5spacy_8pipeline_17_parser_internals_9arc_eager___pyx_scope_struct___get_aligned_sent_starts = &__pyx_type_5spacy_8pipeline_17_parser_internals_9arc_eager___pyx_scope_struct___get_aligned_sent_starts; + #endif + #if !CYTHON_COMPILING_IN_LIMITED_API + #endif + #if !CYTHON_USE_TYPE_SPECS + if (__Pyx_PyType_Ready(__pyx_mstate->__pyx_ptype_5spacy_8pipeline_17_parser_internals_9arc_eager___pyx_scope_struct___get_aligned_sent_starts) < (0)) __PYX_ERR(0, 215, __pyx_L1_error) + #endif + #if CYTHON_COMPILING_IN_CPYTHON && PY_VERSION_HEX >= 0x030E0000 + PyUnstable_Object_EnableDeferredRefcount((PyObject*)__pyx_mstate->__pyx_ptype_5spacy_8pipeline_17_parser_internals_9arc_eager___pyx_scope_struct___get_aligned_sent_starts); + #endif + #if !CYTHON_COMPILING_IN_LIMITED_API + if ((CYTHON_USE_TYPE_SLOTS && CYTHON_USE_PYTYPE_LOOKUP) && likely(!__pyx_mstate->__pyx_ptype_5spacy_8pipeline_17_parser_internals_9arc_eager___pyx_scope_struct___get_aligned_sent_starts->tp_dictoffset && __pyx_mstate->__pyx_ptype_5spacy_8pipeline_17_parser_internals_9arc_eager___pyx_scope_struct___get_aligned_sent_starts->tp_getattro == PyObject_GenericGetAttr)) { + __pyx_mstate->__pyx_ptype_5spacy_8pipeline_17_parser_internals_9arc_eager___pyx_scope_struct___get_aligned_sent_starts->tp_getattro = PyObject_GenericGetAttr; + } + #endif + #if CYTHON_USE_TYPE_SPECS + __pyx_mstate->__pyx_ptype_5spacy_8pipeline_17_parser_internals_9arc_eager___pyx_scope_struct_1_genexpr = (PyTypeObject *) __Pyx_PyType_FromModuleAndSpec(__pyx_m, &__pyx_type_5spacy_8pipeline_17_parser_internals_9arc_eager___pyx_scope_struct_1_genexpr_spec, NULL); if (unlikely(!__pyx_mstate->__pyx_ptype_5spacy_8pipeline_17_parser_internals_9arc_eager___pyx_scope_struct_1_genexpr)) __PYX_ERR(0, 230, __pyx_L1_error) + if (__Pyx_fix_up_extension_type_from_spec(&__pyx_type_5spacy_8pipeline_17_parser_internals_9arc_eager___pyx_scope_struct_1_genexpr_spec, __pyx_mstate->__pyx_ptype_5spacy_8pipeline_17_parser_internals_9arc_eager___pyx_scope_struct_1_genexpr) < (0)) __PYX_ERR(0, 230, __pyx_L1_error) + #else + __pyx_mstate->__pyx_ptype_5spacy_8pipeline_17_parser_internals_9arc_eager___pyx_scope_struct_1_genexpr = &__pyx_type_5spacy_8pipeline_17_parser_internals_9arc_eager___pyx_scope_struct_1_genexpr; + #endif + #if !CYTHON_COMPILING_IN_LIMITED_API + #endif + #if !CYTHON_USE_TYPE_SPECS + if (__Pyx_PyType_Ready(__pyx_mstate->__pyx_ptype_5spacy_8pipeline_17_parser_internals_9arc_eager___pyx_scope_struct_1_genexpr) < (0)) __PYX_ERR(0, 230, __pyx_L1_error) + #endif + #if CYTHON_COMPILING_IN_CPYTHON && PY_VERSION_HEX >= 0x030E0000 + PyUnstable_Object_EnableDeferredRefcount((PyObject*)__pyx_mstate->__pyx_ptype_5spacy_8pipeline_17_parser_internals_9arc_eager___pyx_scope_struct_1_genexpr); + #endif + #if !CYTHON_COMPILING_IN_LIMITED_API + if ((CYTHON_USE_TYPE_SLOTS && CYTHON_USE_PYTYPE_LOOKUP) && likely(!__pyx_mstate->__pyx_ptype_5spacy_8pipeline_17_parser_internals_9arc_eager___pyx_scope_struct_1_genexpr->tp_dictoffset && __pyx_mstate->__pyx_ptype_5spacy_8pipeline_17_parser_internals_9arc_eager___pyx_scope_struct_1_genexpr->tp_getattro == PyObject_GenericGetAttr)) { + __pyx_mstate->__pyx_ptype_5spacy_8pipeline_17_parser_internals_9arc_eager___pyx_scope_struct_1_genexpr->tp_getattro = PyObject_GenericGetAttr; + } + #endif + #if CYTHON_USE_TYPE_SPECS + __pyx_mstate->__pyx_ptype_5spacy_8pipeline_17_parser_internals_9arc_eager___pyx_scope_struct_2_get_oracle_sequence_from_state = (PyTypeObject *) __Pyx_PyType_FromModuleAndSpec(__pyx_m, &__pyx_type_5spacy_8pipeline_17_parser_internals_9arc_eager___pyx_scope_struct_2_get_oracle_sequence_from_state_spec, NULL); if (unlikely(!__pyx_mstate->__pyx_ptype_5spacy_8pipeline_17_parser_internals_9arc_eager___pyx_scope_struct_2_get_oracle_sequence_from_state)) __PYX_ERR(0, 835, __pyx_L1_error) + if (__Pyx_fix_up_extension_type_from_spec(&__pyx_type_5spacy_8pipeline_17_parser_internals_9arc_eager___pyx_scope_struct_2_get_oracle_sequence_from_state_spec, __pyx_mstate->__pyx_ptype_5spacy_8pipeline_17_parser_internals_9arc_eager___pyx_scope_struct_2_get_oracle_sequence_from_state) < (0)) __PYX_ERR(0, 835, __pyx_L1_error) + #else + __pyx_mstate->__pyx_ptype_5spacy_8pipeline_17_parser_internals_9arc_eager___pyx_scope_struct_2_get_oracle_sequence_from_state = &__pyx_type_5spacy_8pipeline_17_parser_internals_9arc_eager___pyx_scope_struct_2_get_oracle_sequence_from_state; + #endif + #if !CYTHON_COMPILING_IN_LIMITED_API + #endif + #if !CYTHON_USE_TYPE_SPECS + if (__Pyx_PyType_Ready(__pyx_mstate->__pyx_ptype_5spacy_8pipeline_17_parser_internals_9arc_eager___pyx_scope_struct_2_get_oracle_sequence_from_state) < (0)) __PYX_ERR(0, 835, __pyx_L1_error) + #endif + #if CYTHON_COMPILING_IN_CPYTHON && PY_VERSION_HEX >= 0x030E0000 + PyUnstable_Object_EnableDeferredRefcount((PyObject*)__pyx_mstate->__pyx_ptype_5spacy_8pipeline_17_parser_internals_9arc_eager___pyx_scope_struct_2_get_oracle_sequence_from_state); + #endif + #if !CYTHON_COMPILING_IN_LIMITED_API + if ((CYTHON_USE_TYPE_SLOTS && CYTHON_USE_PYTYPE_LOOKUP) && likely(!__pyx_mstate->__pyx_ptype_5spacy_8pipeline_17_parser_internals_9arc_eager___pyx_scope_struct_2_get_oracle_sequence_from_state->tp_dictoffset && __pyx_mstate->__pyx_ptype_5spacy_8pipeline_17_parser_internals_9arc_eager___pyx_scope_struct_2_get_oracle_sequence_from_state->tp_getattro == PyObject_GenericGetAttr)) { + __pyx_mstate->__pyx_ptype_5spacy_8pipeline_17_parser_internals_9arc_eager___pyx_scope_struct_2_get_oracle_sequence_from_state->tp_getattro = PyObject_GenericGetAttr; + } + #endif + #if CYTHON_USE_TYPE_SPECS + __pyx_mstate->__pyx_ptype_5spacy_8pipeline_17_parser_internals_9arc_eager___pyx_scope_struct_3_genexpr = (PyTypeObject *) __Pyx_PyType_FromModuleAndSpec(__pyx_m, &__pyx_type_5spacy_8pipeline_17_parser_internals_9arc_eager___pyx_scope_struct_3_genexpr_spec, NULL); if (unlikely(!__pyx_mstate->__pyx_ptype_5spacy_8pipeline_17_parser_internals_9arc_eager___pyx_scope_struct_3_genexpr)) __PYX_ERR(0, 852, __pyx_L1_error) + if (__Pyx_fix_up_extension_type_from_spec(&__pyx_type_5spacy_8pipeline_17_parser_internals_9arc_eager___pyx_scope_struct_3_genexpr_spec, __pyx_mstate->__pyx_ptype_5spacy_8pipeline_17_parser_internals_9arc_eager___pyx_scope_struct_3_genexpr) < (0)) __PYX_ERR(0, 852, __pyx_L1_error) + #else + __pyx_mstate->__pyx_ptype_5spacy_8pipeline_17_parser_internals_9arc_eager___pyx_scope_struct_3_genexpr = &__pyx_type_5spacy_8pipeline_17_parser_internals_9arc_eager___pyx_scope_struct_3_genexpr; + #endif + #if !CYTHON_COMPILING_IN_LIMITED_API + #endif + #if !CYTHON_USE_TYPE_SPECS + if (__Pyx_PyType_Ready(__pyx_mstate->__pyx_ptype_5spacy_8pipeline_17_parser_internals_9arc_eager___pyx_scope_struct_3_genexpr) < (0)) __PYX_ERR(0, 852, __pyx_L1_error) + #endif + #if CYTHON_COMPILING_IN_CPYTHON && PY_VERSION_HEX >= 0x030E0000 + PyUnstable_Object_EnableDeferredRefcount((PyObject*)__pyx_mstate->__pyx_ptype_5spacy_8pipeline_17_parser_internals_9arc_eager___pyx_scope_struct_3_genexpr); + #endif + #if !CYTHON_COMPILING_IN_LIMITED_API + if ((CYTHON_USE_TYPE_SLOTS && CYTHON_USE_PYTYPE_LOOKUP) && likely(!__pyx_mstate->__pyx_ptype_5spacy_8pipeline_17_parser_internals_9arc_eager___pyx_scope_struct_3_genexpr->tp_dictoffset && __pyx_mstate->__pyx_ptype_5spacy_8pipeline_17_parser_internals_9arc_eager___pyx_scope_struct_3_genexpr->tp_getattro == PyObject_GenericGetAttr)) { + __pyx_mstate->__pyx_ptype_5spacy_8pipeline_17_parser_internals_9arc_eager___pyx_scope_struct_3_genexpr->tp_getattro = PyObject_GenericGetAttr; + } + #endif + __pyx_vtabptr_array = &__pyx_vtable_array; + __pyx_vtable_array.get_memview = (PyObject *(*)(struct __pyx_array_obj *))__pyx_array_get_memview; + #if CYTHON_USE_TYPE_SPECS + __pyx_mstate->__pyx_array_type = (PyTypeObject *) __Pyx_PyType_FromModuleAndSpec(__pyx_m, &__pyx_type___pyx_array_spec, NULL); if (unlikely(!__pyx_mstate->__pyx_array_type)) __PYX_ERR(1, 110, __pyx_L1_error) + #if !CYTHON_COMPILING_IN_LIMITED_API + __pyx_mstate->__pyx_array_type->tp_as_buffer = &__pyx_tp_as_buffer_array; + if (!__pyx_mstate->__pyx_array_type->tp_as_buffer->bf_releasebuffer && __pyx_mstate->__pyx_array_type->tp_base->tp_as_buffer && __pyx_mstate->__pyx_array_type->tp_base->tp_as_buffer->bf_releasebuffer) { + __pyx_mstate->__pyx_array_type->tp_as_buffer->bf_releasebuffer = __pyx_mstate->__pyx_array_type->tp_base->tp_as_buffer->bf_releasebuffer; + } + #elif defined(Py_bf_getbuffer) && defined(Py_bf_releasebuffer) + /* PY_VERSION_HEX >= 0x03090000 || Py_LIMITED_API >= 0x030B0000 */ + #elif defined(_MSC_VER) + #pragma message ("The buffer protocol is not supported in the Limited C-API < 3.11.") + #else + #warning "The buffer protocol is not supported in the Limited C-API < 3.11." + #endif + if (__Pyx_fix_up_extension_type_from_spec(&__pyx_type___pyx_array_spec, __pyx_mstate->__pyx_array_type) < (0)) __PYX_ERR(1, 110, __pyx_L1_error) + #else + __pyx_mstate->__pyx_array_type = &__pyx_type___pyx_array; + #endif + #if !CYTHON_COMPILING_IN_LIMITED_API + #endif + #if !CYTHON_USE_TYPE_SPECS + if (__Pyx_PyType_Ready(__pyx_mstate->__pyx_array_type) < (0)) __PYX_ERR(1, 110, __pyx_L1_error) + #endif + #if CYTHON_COMPILING_IN_CPYTHON && PY_VERSION_HEX >= 0x030E0000 + PyUnstable_Object_EnableDeferredRefcount((PyObject*)__pyx_mstate->__pyx_array_type); + #endif + if (__Pyx_SetVtable(__pyx_mstate->__pyx_array_type, __pyx_vtabptr_array) < (0)) __PYX_ERR(1, 110, __pyx_L1_error) + if (__Pyx_MergeVtables(__pyx_mstate->__pyx_array_type) < (0)) __PYX_ERR(1, 110, __pyx_L1_error) + if (__Pyx_setup_reduce((PyObject *) __pyx_mstate->__pyx_array_type) < (0)) __PYX_ERR(1, 110, __pyx_L1_error) + #if CYTHON_USE_TYPE_SPECS + __pyx_mstate->__pyx_MemviewEnum_type = (PyTypeObject *) __Pyx_PyType_FromModuleAndSpec(__pyx_m, &__pyx_type___pyx_MemviewEnum_spec, NULL); if (unlikely(!__pyx_mstate->__pyx_MemviewEnum_type)) __PYX_ERR(1, 299, __pyx_L1_error) + if (__Pyx_fix_up_extension_type_from_spec(&__pyx_type___pyx_MemviewEnum_spec, __pyx_mstate->__pyx_MemviewEnum_type) < (0)) __PYX_ERR(1, 299, __pyx_L1_error) + #else + __pyx_mstate->__pyx_MemviewEnum_type = &__pyx_type___pyx_MemviewEnum; + #endif + #if !CYTHON_COMPILING_IN_LIMITED_API + #endif + #if !CYTHON_USE_TYPE_SPECS + if (__Pyx_PyType_Ready(__pyx_mstate->__pyx_MemviewEnum_type) < (0)) __PYX_ERR(1, 299, __pyx_L1_error) + #endif + #if CYTHON_COMPILING_IN_CPYTHON && PY_VERSION_HEX >= 0x030E0000 + PyUnstable_Object_EnableDeferredRefcount((PyObject*)__pyx_mstate->__pyx_MemviewEnum_type); + #endif + #if !CYTHON_COMPILING_IN_LIMITED_API + if ((CYTHON_USE_TYPE_SLOTS && CYTHON_USE_PYTYPE_LOOKUP) && likely(!__pyx_mstate->__pyx_MemviewEnum_type->tp_dictoffset && __pyx_mstate->__pyx_MemviewEnum_type->tp_getattro == PyObject_GenericGetAttr)) { + __pyx_mstate->__pyx_MemviewEnum_type->tp_getattro = PyObject_GenericGetAttr; + } + #endif + if (__Pyx_setup_reduce((PyObject *) __pyx_mstate->__pyx_MemviewEnum_type) < (0)) __PYX_ERR(1, 299, __pyx_L1_error) + __pyx_vtabptr_memoryview = &__pyx_vtable_memoryview; + __pyx_vtable_memoryview.get_item_pointer = (char *(*)(struct __pyx_memoryview_obj *, PyObject *))__pyx_memoryview_get_item_pointer; + __pyx_vtable_memoryview.is_slice = (PyObject *(*)(struct __pyx_memoryview_obj *, PyObject *))__pyx_memoryview_is_slice; + __pyx_vtable_memoryview.setitem_slice_assignment = (PyObject *(*)(struct __pyx_memoryview_obj *, PyObject *, PyObject *))__pyx_memoryview_setitem_slice_assignment; + __pyx_vtable_memoryview.setitem_slice_assign_scalar = (PyObject *(*)(struct __pyx_memoryview_obj *, struct __pyx_memoryview_obj *, PyObject *))__pyx_memoryview_setitem_slice_assign_scalar; + __pyx_vtable_memoryview.setitem_indexed = (PyObject *(*)(struct __pyx_memoryview_obj *, PyObject *, PyObject *))__pyx_memoryview_setitem_indexed; + __pyx_vtable_memoryview.convert_item_to_object = (PyObject *(*)(struct __pyx_memoryview_obj *, char *))__pyx_memoryview_convert_item_to_object; + __pyx_vtable_memoryview.assign_item_from_object = (PyObject *(*)(struct __pyx_memoryview_obj *, char *, PyObject *))__pyx_memoryview_assign_item_from_object; + __pyx_vtable_memoryview._get_base = (PyObject *(*)(struct __pyx_memoryview_obj *))__pyx_memoryview__get_base; + #if CYTHON_USE_TYPE_SPECS + __pyx_mstate->__pyx_memoryview_type = (PyTypeObject *) __Pyx_PyType_FromModuleAndSpec(__pyx_m, &__pyx_type___pyx_memoryview_spec, NULL); if (unlikely(!__pyx_mstate->__pyx_memoryview_type)) __PYX_ERR(1, 334, __pyx_L1_error) + #if !CYTHON_COMPILING_IN_LIMITED_API + __pyx_mstate->__pyx_memoryview_type->tp_as_buffer = &__pyx_tp_as_buffer_memoryview; + if (!__pyx_mstate->__pyx_memoryview_type->tp_as_buffer->bf_releasebuffer && __pyx_mstate->__pyx_memoryview_type->tp_base->tp_as_buffer && __pyx_mstate->__pyx_memoryview_type->tp_base->tp_as_buffer->bf_releasebuffer) { + __pyx_mstate->__pyx_memoryview_type->tp_as_buffer->bf_releasebuffer = __pyx_mstate->__pyx_memoryview_type->tp_base->tp_as_buffer->bf_releasebuffer; + } + #elif defined(Py_bf_getbuffer) && defined(Py_bf_releasebuffer) + /* PY_VERSION_HEX >= 0x03090000 || Py_LIMITED_API >= 0x030B0000 */ + #elif defined(_MSC_VER) + #pragma message ("The buffer protocol is not supported in the Limited C-API < 3.11.") + #else + #warning "The buffer protocol is not supported in the Limited C-API < 3.11." + #endif + if (__Pyx_fix_up_extension_type_from_spec(&__pyx_type___pyx_memoryview_spec, __pyx_mstate->__pyx_memoryview_type) < (0)) __PYX_ERR(1, 334, __pyx_L1_error) + #else + __pyx_mstate->__pyx_memoryview_type = &__pyx_type___pyx_memoryview; + #endif + #if !CYTHON_COMPILING_IN_LIMITED_API + #endif + #if !CYTHON_USE_TYPE_SPECS + if (__Pyx_PyType_Ready(__pyx_mstate->__pyx_memoryview_type) < (0)) __PYX_ERR(1, 334, __pyx_L1_error) + #endif + #if CYTHON_COMPILING_IN_CPYTHON && PY_VERSION_HEX >= 0x030E0000 + PyUnstable_Object_EnableDeferredRefcount((PyObject*)__pyx_mstate->__pyx_memoryview_type); + #endif + #if !CYTHON_COMPILING_IN_LIMITED_API + if ((CYTHON_USE_TYPE_SLOTS && CYTHON_USE_PYTYPE_LOOKUP) && likely(!__pyx_mstate->__pyx_memoryview_type->tp_dictoffset && __pyx_mstate->__pyx_memoryview_type->tp_getattro == PyObject_GenericGetAttr)) { + __pyx_mstate->__pyx_memoryview_type->tp_getattro = PyObject_GenericGetAttr; + } + #endif + if (__Pyx_SetVtable(__pyx_mstate->__pyx_memoryview_type, __pyx_vtabptr_memoryview) < (0)) __PYX_ERR(1, 334, __pyx_L1_error) + if (__Pyx_MergeVtables(__pyx_mstate->__pyx_memoryview_type) < (0)) __PYX_ERR(1, 334, __pyx_L1_error) + if (__Pyx_setup_reduce((PyObject *) __pyx_mstate->__pyx_memoryview_type) < (0)) __PYX_ERR(1, 334, __pyx_L1_error) + __pyx_vtabptr__memoryviewslice = &__pyx_vtable__memoryviewslice; + __pyx_vtable__memoryviewslice.__pyx_base = *__pyx_vtabptr_memoryview; + __pyx_vtable__memoryviewslice.__pyx_base.convert_item_to_object = (PyObject *(*)(struct __pyx_memoryview_obj *, char *))__pyx_memoryviewslice_convert_item_to_object; + __pyx_vtable__memoryviewslice.__pyx_base.assign_item_from_object = (PyObject *(*)(struct __pyx_memoryview_obj *, char *, PyObject *))__pyx_memoryviewslice_assign_item_from_object; + __pyx_vtable__memoryviewslice.__pyx_base._get_base = (PyObject *(*)(struct __pyx_memoryview_obj *))__pyx_memoryviewslice__get_base; + #if CYTHON_USE_TYPE_SPECS + __pyx_t_2 = PyTuple_Pack(1, (PyObject *)__pyx_mstate_global->__pyx_memoryview_type); if (unlikely(!__pyx_t_2)) __PYX_ERR(1, 951, __pyx_L1_error) + __Pyx_GOTREF(__pyx_t_2); + __pyx_mstate->__pyx_memoryviewslice_type = (PyTypeObject *) __Pyx_PyType_FromModuleAndSpec(__pyx_m, &__pyx_type___pyx_memoryviewslice_spec, __pyx_t_2); + __Pyx_XDECREF(__pyx_t_2); __pyx_t_2 = 0; + if (unlikely(!__pyx_mstate->__pyx_memoryviewslice_type)) __PYX_ERR(1, 951, __pyx_L1_error) + if (__Pyx_fix_up_extension_type_from_spec(&__pyx_type___pyx_memoryviewslice_spec, __pyx_mstate->__pyx_memoryviewslice_type) < (0)) __PYX_ERR(1, 951, __pyx_L1_error) + #else + __pyx_mstate->__pyx_memoryviewslice_type = &__pyx_type___pyx_memoryviewslice; + #endif + #if !CYTHON_COMPILING_IN_LIMITED_API + __pyx_mstate_global->__pyx_memoryviewslice_type->tp_base = __pyx_mstate_global->__pyx_memoryview_type; + #endif + #if !CYTHON_USE_TYPE_SPECS + if (__Pyx_PyType_Ready(__pyx_mstate->__pyx_memoryviewslice_type) < (0)) __PYX_ERR(1, 951, __pyx_L1_error) + #endif + #if CYTHON_COMPILING_IN_CPYTHON && PY_VERSION_HEX >= 0x030E0000 + PyUnstable_Object_EnableDeferredRefcount((PyObject*)__pyx_mstate->__pyx_memoryviewslice_type); + #endif + #if !CYTHON_COMPILING_IN_LIMITED_API + if ((CYTHON_USE_TYPE_SLOTS && CYTHON_USE_PYTYPE_LOOKUP) && likely(!__pyx_mstate->__pyx_memoryviewslice_type->tp_dictoffset && __pyx_mstate->__pyx_memoryviewslice_type->tp_getattro == PyObject_GenericGetAttr)) { + __pyx_mstate->__pyx_memoryviewslice_type->tp_getattro = PyObject_GenericGetAttr; + } + #endif + if (__Pyx_SetVtable(__pyx_mstate->__pyx_memoryviewslice_type, __pyx_vtabptr__memoryviewslice) < (0)) __PYX_ERR(1, 951, __pyx_L1_error) + if (__Pyx_MergeVtables(__pyx_mstate->__pyx_memoryviewslice_type) < (0)) __PYX_ERR(1, 951, __pyx_L1_error) + if (__Pyx_setup_reduce((PyObject *) __pyx_mstate->__pyx_memoryviewslice_type) < (0)) __PYX_ERR(1, 951, __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_XDECREF(__pyx_t_2); + __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(__Pyx_BUILTIN_MODULE_NAME); if (unlikely(!__pyx_t_1)) __PYX_ERR(7, 9, __pyx_L1_error) + __Pyx_GOTREF(__pyx_t_1); + __pyx_mstate->__pyx_ptype_7cpython_4type_type = __Pyx_ImportType_3_2_1(__pyx_t_1, __Pyx_BUILTIN_MODULE_NAME, "type", + #if defined(PYPY_VERSION_NUM) && PYPY_VERSION_NUM < 0x050B0000 + sizeof(PyTypeObject), __PYX_GET_STRUCT_ALIGNMENT_3_2_1(PyTypeObject), + #elif CYTHON_COMPILING_IN_LIMITED_API + 0, 0, + #else + sizeof(PyHeapTypeObject), __PYX_GET_STRUCT_ALIGNMENT_3_2_1(PyHeapTypeObject), + #endif + __Pyx_ImportType_CheckSize_Warn_3_2_1); if (!__pyx_mstate->__pyx_ptype_7cpython_4type_type) __PYX_ERR(7, 9, __pyx_L1_error) + __Pyx_DECREF(__pyx_t_1); __pyx_t_1 = 0; + __pyx_t_1 = PyImport_ImportModule("numpy"); if (unlikely(!__pyx_t_1)) __PYX_ERR(2, 228, __pyx_L1_error) + __Pyx_GOTREF(__pyx_t_1); + __pyx_mstate->__pyx_ptype_5numpy_dtype = __Pyx_ImportType_3_2_1(__pyx_t_1, "numpy", "dtype", + #if defined(PYPY_VERSION_NUM) && PYPY_VERSION_NUM < 0x050B0000 + sizeof(PyArray_Descr), __PYX_GET_STRUCT_ALIGNMENT_3_2_1(PyArray_Descr), + #elif CYTHON_COMPILING_IN_LIMITED_API + sizeof(PyArray_Descr), __PYX_GET_STRUCT_ALIGNMENT_3_2_1(PyArray_Descr), + #else + sizeof(PyArray_Descr), __PYX_GET_STRUCT_ALIGNMENT_3_2_1(PyArray_Descr), + #endif + __Pyx_ImportType_CheckSize_Ignore_3_2_1); if (!__pyx_mstate->__pyx_ptype_5numpy_dtype) __PYX_ERR(2, 228, __pyx_L1_error) + __pyx_mstate->__pyx_ptype_5numpy_flatiter = __Pyx_ImportType_3_2_1(__pyx_t_1, "numpy", "flatiter", + #if defined(PYPY_VERSION_NUM) && PYPY_VERSION_NUM < 0x050B0000 + sizeof(PyArrayIterObject), __PYX_GET_STRUCT_ALIGNMENT_3_2_1(PyArrayIterObject), + #elif CYTHON_COMPILING_IN_LIMITED_API + sizeof(PyArrayIterObject), __PYX_GET_STRUCT_ALIGNMENT_3_2_1(PyArrayIterObject), + #else + sizeof(PyArrayIterObject), __PYX_GET_STRUCT_ALIGNMENT_3_2_1(PyArrayIterObject), + #endif + __Pyx_ImportType_CheckSize_Ignore_3_2_1); if (!__pyx_mstate->__pyx_ptype_5numpy_flatiter) __PYX_ERR(2, 273, __pyx_L1_error) + __pyx_mstate->__pyx_ptype_5numpy_broadcast = __Pyx_ImportType_3_2_1(__pyx_t_1, "numpy", "broadcast", + #if defined(PYPY_VERSION_NUM) && PYPY_VERSION_NUM < 0x050B0000 + sizeof(PyArrayMultiIterObject), __PYX_GET_STRUCT_ALIGNMENT_3_2_1(PyArrayMultiIterObject), + #elif CYTHON_COMPILING_IN_LIMITED_API + sizeof(PyArrayMultiIterObject), __PYX_GET_STRUCT_ALIGNMENT_3_2_1(PyArrayMultiIterObject), + #else + sizeof(PyArrayMultiIterObject), __PYX_GET_STRUCT_ALIGNMENT_3_2_1(PyArrayMultiIterObject), + #endif + __Pyx_ImportType_CheckSize_Ignore_3_2_1); if (!__pyx_mstate->__pyx_ptype_5numpy_broadcast) __PYX_ERR(2, 277, __pyx_L1_error) + __pyx_mstate->__pyx_ptype_5numpy_ndarray = __Pyx_ImportType_3_2_1(__pyx_t_1, "numpy", "ndarray", + #if defined(PYPY_VERSION_NUM) && PYPY_VERSION_NUM < 0x050B0000 + sizeof(PyArrayObject), __PYX_GET_STRUCT_ALIGNMENT_3_2_1(PyArrayObject), + #elif CYTHON_COMPILING_IN_LIMITED_API + sizeof(PyArrayObject), __PYX_GET_STRUCT_ALIGNMENT_3_2_1(PyArrayObject), + #else + sizeof(PyArrayObject), __PYX_GET_STRUCT_ALIGNMENT_3_2_1(PyArrayObject), + #endif + __Pyx_ImportType_CheckSize_Ignore_3_2_1); if (!__pyx_mstate->__pyx_ptype_5numpy_ndarray) __PYX_ERR(2, 316, __pyx_L1_error) + __pyx_mstate->__pyx_ptype_5numpy_generic = __Pyx_ImportType_3_2_1(__pyx_t_1, "numpy", "generic", + #if defined(PYPY_VERSION_NUM) && PYPY_VERSION_NUM < 0x050B0000 + sizeof(PyObject), __PYX_GET_STRUCT_ALIGNMENT_3_2_1(PyObject), + #elif CYTHON_COMPILING_IN_LIMITED_API + sizeof(PyObject), __PYX_GET_STRUCT_ALIGNMENT_3_2_1(PyObject), + #else + sizeof(PyObject), __PYX_GET_STRUCT_ALIGNMENT_3_2_1(PyObject), + #endif + __Pyx_ImportType_CheckSize_Warn_3_2_1); if (!__pyx_mstate->__pyx_ptype_5numpy_generic) __PYX_ERR(2, 825, __pyx_L1_error) + __pyx_mstate->__pyx_ptype_5numpy_number = __Pyx_ImportType_3_2_1(__pyx_t_1, "numpy", "number", + #if defined(PYPY_VERSION_NUM) && PYPY_VERSION_NUM < 0x050B0000 + sizeof(PyObject), __PYX_GET_STRUCT_ALIGNMENT_3_2_1(PyObject), + #elif CYTHON_COMPILING_IN_LIMITED_API + sizeof(PyObject), __PYX_GET_STRUCT_ALIGNMENT_3_2_1(PyObject), + #else + sizeof(PyObject), __PYX_GET_STRUCT_ALIGNMENT_3_2_1(PyObject), + #endif + __Pyx_ImportType_CheckSize_Warn_3_2_1); if (!__pyx_mstate->__pyx_ptype_5numpy_number) __PYX_ERR(2, 827, __pyx_L1_error) + __pyx_mstate->__pyx_ptype_5numpy_integer = __Pyx_ImportType_3_2_1(__pyx_t_1, "numpy", "integer", + #if defined(PYPY_VERSION_NUM) && PYPY_VERSION_NUM < 0x050B0000 + sizeof(PyObject), __PYX_GET_STRUCT_ALIGNMENT_3_2_1(PyObject), + #elif CYTHON_COMPILING_IN_LIMITED_API + sizeof(PyObject), __PYX_GET_STRUCT_ALIGNMENT_3_2_1(PyObject), + #else + sizeof(PyObject), __PYX_GET_STRUCT_ALIGNMENT_3_2_1(PyObject), + #endif + __Pyx_ImportType_CheckSize_Warn_3_2_1); if (!__pyx_mstate->__pyx_ptype_5numpy_integer) __PYX_ERR(2, 829, __pyx_L1_error) + __pyx_mstate->__pyx_ptype_5numpy_signedinteger = __Pyx_ImportType_3_2_1(__pyx_t_1, "numpy", "signedinteger", + #if defined(PYPY_VERSION_NUM) && PYPY_VERSION_NUM < 0x050B0000 + sizeof(PyObject), __PYX_GET_STRUCT_ALIGNMENT_3_2_1(PyObject), + #elif CYTHON_COMPILING_IN_LIMITED_API + sizeof(PyObject), __PYX_GET_STRUCT_ALIGNMENT_3_2_1(PyObject), + #else + sizeof(PyObject), __PYX_GET_STRUCT_ALIGNMENT_3_2_1(PyObject), + #endif + __Pyx_ImportType_CheckSize_Warn_3_2_1); if (!__pyx_mstate->__pyx_ptype_5numpy_signedinteger) __PYX_ERR(2, 831, __pyx_L1_error) + __pyx_mstate->__pyx_ptype_5numpy_unsignedinteger = __Pyx_ImportType_3_2_1(__pyx_t_1, "numpy", "unsignedinteger", + #if defined(PYPY_VERSION_NUM) && PYPY_VERSION_NUM < 0x050B0000 + sizeof(PyObject), __PYX_GET_STRUCT_ALIGNMENT_3_2_1(PyObject), + #elif CYTHON_COMPILING_IN_LIMITED_API + sizeof(PyObject), __PYX_GET_STRUCT_ALIGNMENT_3_2_1(PyObject), + #else + sizeof(PyObject), __PYX_GET_STRUCT_ALIGNMENT_3_2_1(PyObject), + #endif + __Pyx_ImportType_CheckSize_Warn_3_2_1); if (!__pyx_mstate->__pyx_ptype_5numpy_unsignedinteger) __PYX_ERR(2, 833, __pyx_L1_error) + __pyx_mstate->__pyx_ptype_5numpy_inexact = __Pyx_ImportType_3_2_1(__pyx_t_1, "numpy", "inexact", + #if defined(PYPY_VERSION_NUM) && PYPY_VERSION_NUM < 0x050B0000 + sizeof(PyObject), __PYX_GET_STRUCT_ALIGNMENT_3_2_1(PyObject), + #elif CYTHON_COMPILING_IN_LIMITED_API + sizeof(PyObject), __PYX_GET_STRUCT_ALIGNMENT_3_2_1(PyObject), + #else + sizeof(PyObject), __PYX_GET_STRUCT_ALIGNMENT_3_2_1(PyObject), + #endif + __Pyx_ImportType_CheckSize_Warn_3_2_1); if (!__pyx_mstate->__pyx_ptype_5numpy_inexact) __PYX_ERR(2, 835, __pyx_L1_error) + __pyx_mstate->__pyx_ptype_5numpy_floating = __Pyx_ImportType_3_2_1(__pyx_t_1, "numpy", "floating", + #if defined(PYPY_VERSION_NUM) && PYPY_VERSION_NUM < 0x050B0000 + sizeof(PyObject), __PYX_GET_STRUCT_ALIGNMENT_3_2_1(PyObject), + #elif CYTHON_COMPILING_IN_LIMITED_API + sizeof(PyObject), __PYX_GET_STRUCT_ALIGNMENT_3_2_1(PyObject), + #else + sizeof(PyObject), __PYX_GET_STRUCT_ALIGNMENT_3_2_1(PyObject), + #endif + __Pyx_ImportType_CheckSize_Warn_3_2_1); if (!__pyx_mstate->__pyx_ptype_5numpy_floating) __PYX_ERR(2, 837, __pyx_L1_error) + __pyx_mstate->__pyx_ptype_5numpy_complexfloating = __Pyx_ImportType_3_2_1(__pyx_t_1, "numpy", "complexfloating", + #if defined(PYPY_VERSION_NUM) && PYPY_VERSION_NUM < 0x050B0000 + sizeof(PyObject), __PYX_GET_STRUCT_ALIGNMENT_3_2_1(PyObject), + #elif CYTHON_COMPILING_IN_LIMITED_API + sizeof(PyObject), __PYX_GET_STRUCT_ALIGNMENT_3_2_1(PyObject), + #else + sizeof(PyObject), __PYX_GET_STRUCT_ALIGNMENT_3_2_1(PyObject), + #endif + __Pyx_ImportType_CheckSize_Warn_3_2_1); if (!__pyx_mstate->__pyx_ptype_5numpy_complexfloating) __PYX_ERR(2, 839, __pyx_L1_error) + __pyx_mstate->__pyx_ptype_5numpy_flexible = __Pyx_ImportType_3_2_1(__pyx_t_1, "numpy", "flexible", + #if defined(PYPY_VERSION_NUM) && PYPY_VERSION_NUM < 0x050B0000 + sizeof(PyObject), __PYX_GET_STRUCT_ALIGNMENT_3_2_1(PyObject), + #elif CYTHON_COMPILING_IN_LIMITED_API + sizeof(PyObject), __PYX_GET_STRUCT_ALIGNMENT_3_2_1(PyObject), + #else + sizeof(PyObject), __PYX_GET_STRUCT_ALIGNMENT_3_2_1(PyObject), + #endif + __Pyx_ImportType_CheckSize_Warn_3_2_1); if (!__pyx_mstate->__pyx_ptype_5numpy_flexible) __PYX_ERR(2, 841, __pyx_L1_error) + __pyx_mstate->__pyx_ptype_5numpy_character = __Pyx_ImportType_3_2_1(__pyx_t_1, "numpy", "character", + #if defined(PYPY_VERSION_NUM) && PYPY_VERSION_NUM < 0x050B0000 + sizeof(PyObject), __PYX_GET_STRUCT_ALIGNMENT_3_2_1(PyObject), + #elif CYTHON_COMPILING_IN_LIMITED_API + sizeof(PyObject), __PYX_GET_STRUCT_ALIGNMENT_3_2_1(PyObject), + #else + sizeof(PyObject), __PYX_GET_STRUCT_ALIGNMENT_3_2_1(PyObject), + #endif + __Pyx_ImportType_CheckSize_Warn_3_2_1); if (!__pyx_mstate->__pyx_ptype_5numpy_character) __PYX_ERR(2, 843, __pyx_L1_error) + __pyx_mstate->__pyx_ptype_5numpy_ufunc = __Pyx_ImportType_3_2_1(__pyx_t_1, "numpy", "ufunc", + #if defined(PYPY_VERSION_NUM) && PYPY_VERSION_NUM < 0x050B0000 + sizeof(PyUFuncObject), __PYX_GET_STRUCT_ALIGNMENT_3_2_1(PyUFuncObject), + #elif CYTHON_COMPILING_IN_LIMITED_API + sizeof(PyUFuncObject), __PYX_GET_STRUCT_ALIGNMENT_3_2_1(PyUFuncObject), + #else + sizeof(PyUFuncObject), __PYX_GET_STRUCT_ALIGNMENT_3_2_1(PyUFuncObject), + #endif + __Pyx_ImportType_CheckSize_Ignore_3_2_1); if (!__pyx_mstate->__pyx_ptype_5numpy_ufunc) __PYX_ERR(2, 907, __pyx_L1_error) + __Pyx_DECREF(__pyx_t_1); __pyx_t_1 = 0; + __pyx_t_1 = PyImport_ImportModule("cymem.cymem"); if (unlikely(!__pyx_t_1)) __PYX_ERR(8, 4, __pyx_L1_error) + __Pyx_GOTREF(__pyx_t_1); + __pyx_mstate->__pyx_ptype_5cymem_5cymem_PyMalloc = __Pyx_ImportType_3_2_1(__pyx_t_1, "cymem.cymem", "PyMalloc", + #if defined(PYPY_VERSION_NUM) && PYPY_VERSION_NUM < 0x050B0000 + sizeof(struct __pyx_obj_5cymem_5cymem_PyMalloc), __PYX_GET_STRUCT_ALIGNMENT_3_2_1(struct __pyx_obj_5cymem_5cymem_PyMalloc), + #elif CYTHON_COMPILING_IN_LIMITED_API + sizeof(struct __pyx_obj_5cymem_5cymem_PyMalloc), __PYX_GET_STRUCT_ALIGNMENT_3_2_1(struct __pyx_obj_5cymem_5cymem_PyMalloc), + #else + sizeof(struct __pyx_obj_5cymem_5cymem_PyMalloc), __PYX_GET_STRUCT_ALIGNMENT_3_2_1(struct __pyx_obj_5cymem_5cymem_PyMalloc), + #endif + __Pyx_ImportType_CheckSize_Warn_3_2_1); if (!__pyx_mstate->__pyx_ptype_5cymem_5cymem_PyMalloc) __PYX_ERR(8, 4, __pyx_L1_error) + __pyx_vtabptr_5cymem_5cymem_PyMalloc = (struct __pyx_vtabstruct_5cymem_5cymem_PyMalloc*)__Pyx_GetVtable(__pyx_mstate->__pyx_ptype_5cymem_5cymem_PyMalloc); if (unlikely(!__pyx_vtabptr_5cymem_5cymem_PyMalloc)) __PYX_ERR(8, 4, __pyx_L1_error) + __pyx_mstate->__pyx_ptype_5cymem_5cymem_PyFree = __Pyx_ImportType_3_2_1(__pyx_t_1, "cymem.cymem", "PyFree", + #if defined(PYPY_VERSION_NUM) && PYPY_VERSION_NUM < 0x050B0000 + sizeof(struct __pyx_obj_5cymem_5cymem_PyFree), __PYX_GET_STRUCT_ALIGNMENT_3_2_1(struct __pyx_obj_5cymem_5cymem_PyFree), + #elif CYTHON_COMPILING_IN_LIMITED_API + sizeof(struct __pyx_obj_5cymem_5cymem_PyFree), __PYX_GET_STRUCT_ALIGNMENT_3_2_1(struct __pyx_obj_5cymem_5cymem_PyFree), + #else + sizeof(struct __pyx_obj_5cymem_5cymem_PyFree), __PYX_GET_STRUCT_ALIGNMENT_3_2_1(struct __pyx_obj_5cymem_5cymem_PyFree), + #endif + __Pyx_ImportType_CheckSize_Warn_3_2_1); if (!__pyx_mstate->__pyx_ptype_5cymem_5cymem_PyFree) __PYX_ERR(8, 10, __pyx_L1_error) + __pyx_vtabptr_5cymem_5cymem_PyFree = (struct __pyx_vtabstruct_5cymem_5cymem_PyFree*)__Pyx_GetVtable(__pyx_mstate->__pyx_ptype_5cymem_5cymem_PyFree); if (unlikely(!__pyx_vtabptr_5cymem_5cymem_PyFree)) __PYX_ERR(8, 10, __pyx_L1_error) + __pyx_mstate->__pyx_ptype_5cymem_5cymem_Pool = __Pyx_ImportType_3_2_1(__pyx_t_1, "cymem.cymem", "Pool", + #if defined(PYPY_VERSION_NUM) && PYPY_VERSION_NUM < 0x050B0000 + sizeof(struct __pyx_obj_5cymem_5cymem_Pool), __PYX_GET_STRUCT_ALIGNMENT_3_2_1(struct __pyx_obj_5cymem_5cymem_Pool), + #elif CYTHON_COMPILING_IN_LIMITED_API + sizeof(struct __pyx_obj_5cymem_5cymem_Pool), __PYX_GET_STRUCT_ALIGNMENT_3_2_1(struct __pyx_obj_5cymem_5cymem_Pool), + #else + sizeof(struct __pyx_obj_5cymem_5cymem_Pool), __PYX_GET_STRUCT_ALIGNMENT_3_2_1(struct __pyx_obj_5cymem_5cymem_Pool), + #endif + __Pyx_ImportType_CheckSize_Warn_3_2_1); if (!__pyx_mstate->__pyx_ptype_5cymem_5cymem_Pool) __PYX_ERR(8, 16, __pyx_L1_error) + __pyx_vtabptr_5cymem_5cymem_Pool = (struct __pyx_vtabstruct_5cymem_5cymem_Pool*)__Pyx_GetVtable(__pyx_mstate->__pyx_ptype_5cymem_5cymem_Pool); if (unlikely(!__pyx_vtabptr_5cymem_5cymem_Pool)) __PYX_ERR(8, 16, __pyx_L1_error) + __pyx_mstate->__pyx_ptype_5cymem_5cymem_Address = __Pyx_ImportType_3_2_1(__pyx_t_1, "cymem.cymem", "Address", + #if defined(PYPY_VERSION_NUM) && PYPY_VERSION_NUM < 0x050B0000 + sizeof(struct __pyx_obj_5cymem_5cymem_Address), __PYX_GET_STRUCT_ALIGNMENT_3_2_1(struct __pyx_obj_5cymem_5cymem_Address), + #elif CYTHON_COMPILING_IN_LIMITED_API + sizeof(struct __pyx_obj_5cymem_5cymem_Address), __PYX_GET_STRUCT_ALIGNMENT_3_2_1(struct __pyx_obj_5cymem_5cymem_Address), + #else + sizeof(struct __pyx_obj_5cymem_5cymem_Address), __PYX_GET_STRUCT_ALIGNMENT_3_2_1(struct __pyx_obj_5cymem_5cymem_Address), + #endif + __Pyx_ImportType_CheckSize_Warn_3_2_1); if (!__pyx_mstate->__pyx_ptype_5cymem_5cymem_Address) __PYX_ERR(8, 28, __pyx_L1_error) + __Pyx_DECREF(__pyx_t_1); __pyx_t_1 = 0; + __pyx_t_1 = PyImport_ImportModule("preshed.maps"); if (unlikely(!__pyx_t_1)) __PYX_ERR(9, 45, __pyx_L1_error) + __Pyx_GOTREF(__pyx_t_1); + __pyx_mstate->__pyx_ptype_7preshed_4maps_PreshMap = __Pyx_ImportType_3_2_1(__pyx_t_1, "preshed.maps", "PreshMap", + #if defined(PYPY_VERSION_NUM) && PYPY_VERSION_NUM < 0x050B0000 + sizeof(struct __pyx_obj_7preshed_4maps_PreshMap), __PYX_GET_STRUCT_ALIGNMENT_3_2_1(struct __pyx_obj_7preshed_4maps_PreshMap), + #elif CYTHON_COMPILING_IN_LIMITED_API + sizeof(struct __pyx_obj_7preshed_4maps_PreshMap), __PYX_GET_STRUCT_ALIGNMENT_3_2_1(struct __pyx_obj_7preshed_4maps_PreshMap), + #else + sizeof(struct __pyx_obj_7preshed_4maps_PreshMap), __PYX_GET_STRUCT_ALIGNMENT_3_2_1(struct __pyx_obj_7preshed_4maps_PreshMap), + #endif + __Pyx_ImportType_CheckSize_Warn_3_2_1); if (!__pyx_mstate->__pyx_ptype_7preshed_4maps_PreshMap) __PYX_ERR(9, 45, __pyx_L1_error) + __pyx_vtabptr_7preshed_4maps_PreshMap = (struct __pyx_vtabstruct_7preshed_4maps_PreshMap*)__Pyx_GetVtable(__pyx_mstate->__pyx_ptype_7preshed_4maps_PreshMap); if (unlikely(!__pyx_vtabptr_7preshed_4maps_PreshMap)) __PYX_ERR(9, 45, __pyx_L1_error) + __pyx_mstate->__pyx_ptype_7preshed_4maps_PreshMapArray = __Pyx_ImportType_3_2_1(__pyx_t_1, "preshed.maps", "PreshMapArray", + #if defined(PYPY_VERSION_NUM) && PYPY_VERSION_NUM < 0x050B0000 + sizeof(struct __pyx_obj_7preshed_4maps_PreshMapArray), __PYX_GET_STRUCT_ALIGNMENT_3_2_1(struct __pyx_obj_7preshed_4maps_PreshMapArray), + #elif CYTHON_COMPILING_IN_LIMITED_API + sizeof(struct __pyx_obj_7preshed_4maps_PreshMapArray), __PYX_GET_STRUCT_ALIGNMENT_3_2_1(struct __pyx_obj_7preshed_4maps_PreshMapArray), + #else + sizeof(struct __pyx_obj_7preshed_4maps_PreshMapArray), __PYX_GET_STRUCT_ALIGNMENT_3_2_1(struct __pyx_obj_7preshed_4maps_PreshMapArray), + #endif + __Pyx_ImportType_CheckSize_Warn_3_2_1); if (!__pyx_mstate->__pyx_ptype_7preshed_4maps_PreshMapArray) __PYX_ERR(9, 53, __pyx_L1_error) + __pyx_vtabptr_7preshed_4maps_PreshMapArray = (struct __pyx_vtabstruct_7preshed_4maps_PreshMapArray*)__Pyx_GetVtable(__pyx_mstate->__pyx_ptype_7preshed_4maps_PreshMapArray); if (unlikely(!__pyx_vtabptr_7preshed_4maps_PreshMapArray)) __PYX_ERR(9, 53, __pyx_L1_error) + __Pyx_DECREF(__pyx_t_1); __pyx_t_1 = 0; + __pyx_t_1 = PyImport_ImportModule("spacy.strings"); if (unlikely(!__pyx_t_1)) __PYX_ERR(10, 22, __pyx_L1_error) + __Pyx_GOTREF(__pyx_t_1); + __pyx_mstate->__pyx_ptype_5spacy_7strings_StringStore = __Pyx_ImportType_3_2_1(__pyx_t_1, "spacy.strings", "StringStore", + #if defined(PYPY_VERSION_NUM) && PYPY_VERSION_NUM < 0x050B0000 + sizeof(struct __pyx_obj_5spacy_7strings_StringStore), __PYX_GET_STRUCT_ALIGNMENT_3_2_1(struct __pyx_obj_5spacy_7strings_StringStore), + #elif CYTHON_COMPILING_IN_LIMITED_API + sizeof(struct __pyx_obj_5spacy_7strings_StringStore), __PYX_GET_STRUCT_ALIGNMENT_3_2_1(struct __pyx_obj_5spacy_7strings_StringStore), + #else + sizeof(struct __pyx_obj_5spacy_7strings_StringStore), __PYX_GET_STRUCT_ALIGNMENT_3_2_1(struct __pyx_obj_5spacy_7strings_StringStore), + #endif + __Pyx_ImportType_CheckSize_Warn_3_2_1); if (!__pyx_mstate->__pyx_ptype_5spacy_7strings_StringStore) __PYX_ERR(10, 22, __pyx_L1_error) + __pyx_vtabptr_5spacy_7strings_StringStore = (struct __pyx_vtabstruct_5spacy_7strings_StringStore*)__Pyx_GetVtable(__pyx_mstate->__pyx_ptype_5spacy_7strings_StringStore); if (unlikely(!__pyx_vtabptr_5spacy_7strings_StringStore)) __PYX_ERR(10, 22, __pyx_L1_error) + __Pyx_DECREF(__pyx_t_1); __pyx_t_1 = 0; + __pyx_t_1 = PyImport_ImportModule("spacy.morphology"); if (unlikely(!__pyx_t_1)) __PYX_ERR(11, 11, __pyx_L1_error) + __Pyx_GOTREF(__pyx_t_1); + __pyx_mstate->__pyx_ptype_5spacy_10morphology_Morphology = __Pyx_ImportType_3_2_1(__pyx_t_1, "spacy.morphology", "Morphology", + #if defined(PYPY_VERSION_NUM) && PYPY_VERSION_NUM < 0x050B0000 + sizeof(struct __pyx_obj_5spacy_10morphology_Morphology), __PYX_GET_STRUCT_ALIGNMENT_3_2_1(struct __pyx_obj_5spacy_10morphology_Morphology), + #elif CYTHON_COMPILING_IN_LIMITED_API + sizeof(struct __pyx_obj_5spacy_10morphology_Morphology), __PYX_GET_STRUCT_ALIGNMENT_3_2_1(struct __pyx_obj_5spacy_10morphology_Morphology), + #else + sizeof(struct __pyx_obj_5spacy_10morphology_Morphology), __PYX_GET_STRUCT_ALIGNMENT_3_2_1(struct __pyx_obj_5spacy_10morphology_Morphology), + #endif + __Pyx_ImportType_CheckSize_Warn_3_2_1); if (!__pyx_mstate->__pyx_ptype_5spacy_10morphology_Morphology) __PYX_ERR(11, 11, __pyx_L1_error) + __pyx_vtabptr_5spacy_10morphology_Morphology = (struct __pyx_vtabstruct_5spacy_10morphology_Morphology*)__Pyx_GetVtable(__pyx_mstate->__pyx_ptype_5spacy_10morphology_Morphology); if (unlikely(!__pyx_vtabptr_5spacy_10morphology_Morphology)) __PYX_ERR(11, 11, __pyx_L1_error) + __Pyx_DECREF(__pyx_t_1); __pyx_t_1 = 0; + __pyx_t_1 = PyImport_ImportModule("spacy.vocab"); if (unlikely(!__pyx_t_1)) __PYX_ERR(12, 26, __pyx_L1_error) + __Pyx_GOTREF(__pyx_t_1); + __pyx_mstate->__pyx_ptype_5spacy_5vocab_Vocab = __Pyx_ImportType_3_2_1(__pyx_t_1, "spacy.vocab", "Vocab", + #if defined(PYPY_VERSION_NUM) && PYPY_VERSION_NUM < 0x050B0000 + sizeof(struct __pyx_obj_5spacy_5vocab_Vocab), __PYX_GET_STRUCT_ALIGNMENT_3_2_1(struct __pyx_obj_5spacy_5vocab_Vocab), + #elif CYTHON_COMPILING_IN_LIMITED_API + sizeof(struct __pyx_obj_5spacy_5vocab_Vocab), __PYX_GET_STRUCT_ALIGNMENT_3_2_1(struct __pyx_obj_5spacy_5vocab_Vocab), + #else + sizeof(struct __pyx_obj_5spacy_5vocab_Vocab), __PYX_GET_STRUCT_ALIGNMENT_3_2_1(struct __pyx_obj_5spacy_5vocab_Vocab), + #endif + __Pyx_ImportType_CheckSize_Warn_3_2_1); if (!__pyx_mstate->__pyx_ptype_5spacy_5vocab_Vocab) __PYX_ERR(12, 26, __pyx_L1_error) + __pyx_vtabptr_5spacy_5vocab_Vocab = (struct __pyx_vtabstruct_5spacy_5vocab_Vocab*)__Pyx_GetVtable(__pyx_mstate->__pyx_ptype_5spacy_5vocab_Vocab); if (unlikely(!__pyx_vtabptr_5spacy_5vocab_Vocab)) __PYX_ERR(12, 26, __pyx_L1_error) + __Pyx_DECREF(__pyx_t_1); __pyx_t_1 = 0; + __pyx_t_1 = PyImport_ImportModule("spacy.lexeme"); if (unlikely(!__pyx_t_1)) __PYX_ERR(3, 24, __pyx_L1_error) + __Pyx_GOTREF(__pyx_t_1); + __pyx_mstate->__pyx_ptype_5spacy_6lexeme_Lexeme = __Pyx_ImportType_3_2_1(__pyx_t_1, "spacy.lexeme", "Lexeme", + #if defined(PYPY_VERSION_NUM) && PYPY_VERSION_NUM < 0x050B0000 + sizeof(struct __pyx_obj_5spacy_6lexeme_Lexeme), __PYX_GET_STRUCT_ALIGNMENT_3_2_1(struct __pyx_obj_5spacy_6lexeme_Lexeme), + #elif CYTHON_COMPILING_IN_LIMITED_API + sizeof(struct __pyx_obj_5spacy_6lexeme_Lexeme), __PYX_GET_STRUCT_ALIGNMENT_3_2_1(struct __pyx_obj_5spacy_6lexeme_Lexeme), + #else + sizeof(struct __pyx_obj_5spacy_6lexeme_Lexeme), __PYX_GET_STRUCT_ALIGNMENT_3_2_1(struct __pyx_obj_5spacy_6lexeme_Lexeme), + #endif + __Pyx_ImportType_CheckSize_Warn_3_2_1); if (!__pyx_mstate->__pyx_ptype_5spacy_6lexeme_Lexeme) __PYX_ERR(3, 24, __pyx_L1_error) + __pyx_vtabptr_5spacy_6lexeme_Lexeme = (struct __pyx_vtabstruct_5spacy_6lexeme_Lexeme*)__Pyx_GetVtable(__pyx_mstate->__pyx_ptype_5spacy_6lexeme_Lexeme); if (unlikely(!__pyx_vtabptr_5spacy_6lexeme_Lexeme)) __PYX_ERR(3, 24, __pyx_L1_error) + __Pyx_DECREF(__pyx_t_1); __pyx_t_1 = 0; + __pyx_t_1 = PyImport_ImportModule("spacy.tokens.doc"); if (unlikely(!__pyx_t_1)) __PYX_ERR(13, 37, __pyx_L1_error) + __Pyx_GOTREF(__pyx_t_1); + __pyx_mstate->__pyx_ptype_5spacy_6tokens_3doc_Doc = __Pyx_ImportType_3_2_1(__pyx_t_1, "spacy.tokens.doc", "Doc", + #if defined(PYPY_VERSION_NUM) && PYPY_VERSION_NUM < 0x050B0000 + sizeof(struct __pyx_obj_5spacy_6tokens_3doc_Doc), __PYX_GET_STRUCT_ALIGNMENT_3_2_1(struct __pyx_obj_5spacy_6tokens_3doc_Doc), + #elif CYTHON_COMPILING_IN_LIMITED_API + sizeof(struct __pyx_obj_5spacy_6tokens_3doc_Doc), __PYX_GET_STRUCT_ALIGNMENT_3_2_1(struct __pyx_obj_5spacy_6tokens_3doc_Doc), + #else + sizeof(struct __pyx_obj_5spacy_6tokens_3doc_Doc), __PYX_GET_STRUCT_ALIGNMENT_3_2_1(struct __pyx_obj_5spacy_6tokens_3doc_Doc), + #endif + __Pyx_ImportType_CheckSize_Warn_3_2_1); if (!__pyx_mstate->__pyx_ptype_5spacy_6tokens_3doc_Doc) __PYX_ERR(13, 37, __pyx_L1_error) + __pyx_vtabptr_5spacy_6tokens_3doc_Doc = (struct __pyx_vtabstruct_5spacy_6tokens_3doc_Doc*)__Pyx_GetVtable(__pyx_mstate->__pyx_ptype_5spacy_6tokens_3doc_Doc); if (unlikely(!__pyx_vtabptr_5spacy_6tokens_3doc_Doc)) __PYX_ERR(13, 37, __pyx_L1_error) + __Pyx_DECREF(__pyx_t_1); __pyx_t_1 = 0; + __pyx_t_1 = PyImport_ImportModule("spacy.training.example"); if (unlikely(!__pyx_t_1)) __PYX_ERR(14, 6, __pyx_L1_error) + __Pyx_GOTREF(__pyx_t_1); + __pyx_mstate->__pyx_ptype_5spacy_8training_7example_Example = __Pyx_ImportType_3_2_1(__pyx_t_1, "spacy.training.example", "Example", + #if defined(PYPY_VERSION_NUM) && PYPY_VERSION_NUM < 0x050B0000 + sizeof(struct __pyx_obj_5spacy_8training_7example_Example), __PYX_GET_STRUCT_ALIGNMENT_3_2_1(struct __pyx_obj_5spacy_8training_7example_Example), + #elif CYTHON_COMPILING_IN_LIMITED_API + sizeof(struct __pyx_obj_5spacy_8training_7example_Example), __PYX_GET_STRUCT_ALIGNMENT_3_2_1(struct __pyx_obj_5spacy_8training_7example_Example), + #else + sizeof(struct __pyx_obj_5spacy_8training_7example_Example), __PYX_GET_STRUCT_ALIGNMENT_3_2_1(struct __pyx_obj_5spacy_8training_7example_Example), + #endif + __Pyx_ImportType_CheckSize_Warn_3_2_1); if (!__pyx_mstate->__pyx_ptype_5spacy_8training_7example_Example) __PYX_ERR(14, 6, __pyx_L1_error) + __Pyx_DECREF(__pyx_t_1); __pyx_t_1 = 0; + __pyx_t_1 = PyImport_ImportModule("spacy.pipeline._parser_internals.stateclass"); if (unlikely(!__pyx_t_1)) __PYX_ERR(5, 9, __pyx_L1_error) + __Pyx_GOTREF(__pyx_t_1); + __pyx_mstate->__pyx_ptype_5spacy_8pipeline_17_parser_internals_10stateclass_StateClass = __Pyx_ImportType_3_2_1(__pyx_t_1, "spacy.pipeline._parser_internals.stateclass", "StateClass", + #if defined(PYPY_VERSION_NUM) && PYPY_VERSION_NUM < 0x050B0000 + sizeof(struct __pyx_obj_5spacy_8pipeline_17_parser_internals_10stateclass_StateClass), __PYX_GET_STRUCT_ALIGNMENT_3_2_1(struct __pyx_obj_5spacy_8pipeline_17_parser_internals_10stateclass_StateClass), + #elif CYTHON_COMPILING_IN_LIMITED_API + sizeof(struct __pyx_obj_5spacy_8pipeline_17_parser_internals_10stateclass_StateClass), __PYX_GET_STRUCT_ALIGNMENT_3_2_1(struct __pyx_obj_5spacy_8pipeline_17_parser_internals_10stateclass_StateClass), + #else + sizeof(struct __pyx_obj_5spacy_8pipeline_17_parser_internals_10stateclass_StateClass), __PYX_GET_STRUCT_ALIGNMENT_3_2_1(struct __pyx_obj_5spacy_8pipeline_17_parser_internals_10stateclass_StateClass), + #endif + __Pyx_ImportType_CheckSize_Warn_3_2_1); if (!__pyx_mstate->__pyx_ptype_5spacy_8pipeline_17_parser_internals_10stateclass_StateClass) __PYX_ERR(5, 9, __pyx_L1_error) + __pyx_vtabptr_5spacy_8pipeline_17_parser_internals_10stateclass_StateClass = (struct __pyx_vtabstruct_5spacy_8pipeline_17_parser_internals_10stateclass_StateClass*)__Pyx_GetVtable(__pyx_mstate->__pyx_ptype_5spacy_8pipeline_17_parser_internals_10stateclass_StateClass); if (unlikely(!__pyx_vtabptr_5spacy_8pipeline_17_parser_internals_10stateclass_StateClass)) __PYX_ERR(5, 9, __pyx_L1_error) + __Pyx_DECREF(__pyx_t_1); __pyx_t_1 = 0; + __pyx_t_1 = PyImport_ImportModule("spacy.tokens.token"); if (unlikely(!__pyx_t_1)) __PYX_ERR(6, 16, __pyx_L1_error) + __Pyx_GOTREF(__pyx_t_1); + __pyx_mstate->__pyx_ptype_5spacy_6tokens_5token_Token = __Pyx_ImportType_3_2_1(__pyx_t_1, "spacy.tokens.token", "Token", + #if defined(PYPY_VERSION_NUM) && PYPY_VERSION_NUM < 0x050B0000 + sizeof(struct __pyx_obj_5spacy_6tokens_5token_Token), __PYX_GET_STRUCT_ALIGNMENT_3_2_1(struct __pyx_obj_5spacy_6tokens_5token_Token), + #elif CYTHON_COMPILING_IN_LIMITED_API + sizeof(struct __pyx_obj_5spacy_6tokens_5token_Token), __PYX_GET_STRUCT_ALIGNMENT_3_2_1(struct __pyx_obj_5spacy_6tokens_5token_Token), + #else + sizeof(struct __pyx_obj_5spacy_6tokens_5token_Token), __PYX_GET_STRUCT_ALIGNMENT_3_2_1(struct __pyx_obj_5spacy_6tokens_5token_Token), + #endif + __Pyx_ImportType_CheckSize_Warn_3_2_1); if (!__pyx_mstate->__pyx_ptype_5spacy_6tokens_5token_Token) __PYX_ERR(6, 16, __pyx_L1_error) + __pyx_vtabptr_5spacy_6tokens_5token_Token = (struct __pyx_vtabstruct_5spacy_6tokens_5token_Token*)__Pyx_GetVtable(__pyx_mstate->__pyx_ptype_5spacy_6tokens_5token_Token); if (unlikely(!__pyx_vtabptr_5spacy_6tokens_5token_Token)) __PYX_ERR(6, 16, __pyx_L1_error) + __Pyx_DECREF(__pyx_t_1); __pyx_t_1 = 0; + __pyx_t_1 = PyImport_ImportModule("thinc.extra.search"); if (unlikely(!__pyx_t_1)) __PYX_ERR(15, 37, __pyx_L1_error) + __Pyx_GOTREF(__pyx_t_1); + __pyx_mstate->__pyx_ptype_5thinc_5extra_6search_Beam = __Pyx_ImportType_3_2_1(__pyx_t_1, "thinc.extra.search", "Beam", + #if defined(PYPY_VERSION_NUM) && PYPY_VERSION_NUM < 0x050B0000 + sizeof(struct __pyx_obj_5thinc_5extra_6search_Beam), __PYX_GET_STRUCT_ALIGNMENT_3_2_1(struct __pyx_obj_5thinc_5extra_6search_Beam), + #elif CYTHON_COMPILING_IN_LIMITED_API + sizeof(struct __pyx_obj_5thinc_5extra_6search_Beam), __PYX_GET_STRUCT_ALIGNMENT_3_2_1(struct __pyx_obj_5thinc_5extra_6search_Beam), + #else + sizeof(struct __pyx_obj_5thinc_5extra_6search_Beam), __PYX_GET_STRUCT_ALIGNMENT_3_2_1(struct __pyx_obj_5thinc_5extra_6search_Beam), + #endif + __Pyx_ImportType_CheckSize_Warn_3_2_1); if (!__pyx_mstate->__pyx_ptype_5thinc_5extra_6search_Beam) __PYX_ERR(15, 37, __pyx_L1_error) + __pyx_vtabptr_5thinc_5extra_6search_Beam = (struct __pyx_vtabstruct_5thinc_5extra_6search_Beam*)__Pyx_GetVtable(__pyx_mstate->__pyx_ptype_5thinc_5extra_6search_Beam); if (unlikely(!__pyx_vtabptr_5thinc_5extra_6search_Beam)) __PYX_ERR(15, 37, __pyx_L1_error) + __pyx_mstate->__pyx_ptype_5thinc_5extra_6search_MaxViolation = __Pyx_ImportType_3_2_1(__pyx_t_1, "thinc.extra.search", "MaxViolation", + #if defined(PYPY_VERSION_NUM) && PYPY_VERSION_NUM < 0x050B0000 + sizeof(struct __pyx_obj_5thinc_5extra_6search_MaxViolation), __PYX_GET_STRUCT_ALIGNMENT_3_2_1(struct __pyx_obj_5thinc_5extra_6search_MaxViolation), + #elif CYTHON_COMPILING_IN_LIMITED_API + sizeof(struct __pyx_obj_5thinc_5extra_6search_MaxViolation), __PYX_GET_STRUCT_ALIGNMENT_3_2_1(struct __pyx_obj_5thinc_5extra_6search_MaxViolation), + #else + sizeof(struct __pyx_obj_5thinc_5extra_6search_MaxViolation), __PYX_GET_STRUCT_ALIGNMENT_3_2_1(struct __pyx_obj_5thinc_5extra_6search_MaxViolation), + #endif + __Pyx_ImportType_CheckSize_Warn_3_2_1); if (!__pyx_mstate->__pyx_ptype_5thinc_5extra_6search_MaxViolation) __PYX_ERR(15, 75, __pyx_L1_error) + __pyx_vtabptr_5thinc_5extra_6search_MaxViolation = (struct __pyx_vtabstruct_5thinc_5extra_6search_MaxViolation*)__Pyx_GetVtable(__pyx_mstate->__pyx_ptype_5thinc_5extra_6search_MaxViolation); if (unlikely(!__pyx_vtabptr_5thinc_5extra_6search_MaxViolation)) __PYX_ERR(15, 75, __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); + PyObject *__pyx_t_1 = NULL; + int __pyx_lineno = 0; + const char *__pyx_filename = NULL; + int __pyx_clineno = 0; + __Pyx_RefNannySetupContext("__Pyx_modinit_variable_import_code", 0); + /*--- Variable import code ---*/ + { + __pyx_t_1 = PyImport_ImportModule("spacy.vocab"); 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_struct___pyx_t_5spacy_7structs_L); + #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 + 39; + void **const __pyx_import_pointers[] = {(void **)&__pyx_vp_5spacy_5vocab_EMPTY_LEXEME, (void **) NULL}; + void **const *__pyx_import_pointer = __pyx_import_pointers; + const char *__pyx_import_current_signature = __pyx_import_signature; + while (*__pyx_import_pointer) { + if (__Pyx_ImportVoidPtr_3_2_1(__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_t_1 = PyImport_ImportModule("spacy.lexeme"); 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_pyx_t_5spacy_8typedefs_attr_t); + #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 + 71; + void **const __pyx_import_pointers[] = {(void **)&__pyx_vp_5spacy_6lexeme_OOV_RANK, (void **)&__pyx_vp_5spacy_6lexeme_EMPTY_LEXEME, (void **) NULL}; + void **const *__pyx_import_pointer = __pyx_import_pointers; + const char *__pyx_import_current_signature = __pyx_import_signature; + while (*__pyx_import_pointer) { + if (__Pyx_ImportVoidPtr_3_2_1(__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_t_1 = PyImport_ImportModule("spacy.tokens.token"); 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_const_MISSING_DEP); + #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 + 11; + void **const __pyx_import_pointers[] = {(void **)&__pyx_vp_5spacy_6tokens_5token_MISSING_DEP, (void **) NULL}; + void **const *__pyx_import_pointer = __pyx_import_pointers; + const char *__pyx_import_current_signature = __pyx_import_signature; + while (*__pyx_import_pointer) { + if (__Pyx_ImportVoidPtr_3_2_1(__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; +} + +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("murmurhash.mrmr"); 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_uint64_t_void_int_uint64_t_hash6); + #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 + 33; + void (**const __pyx_import_pointers[])(void) = {(void (**)(void))&__pyx_f_10murmurhash_4mrmr_hash64, (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_1(__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_t_1 = PyImport_ImportModule("spacy.strings"); 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_pyx_t_5spacy_8typedefs_hash_t); + #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 + 70; + void (**const __pyx_import_pointers[])(void) = {(void (**)(void))&__pyx_f_5spacy_7strings_hash_string, (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_1(__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_t_1 = PyImport_ImportModule("spacy.tokens.doc"); 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_struct___pyx_t_5spacy_7struc); + #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 + 56; + void (**const __pyx_import_pointers[])(void) = {(void (**)(void))&__pyx_f_5spacy_6tokens_3doc_set_children_from_heads, (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_1(__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_arc_eager(PyObject* module); /*proto*/ +static PyModuleDef_Slot __pyx_moduledef_slots[] = { + {Py_mod_create, (void*)__pyx_pymod_create}, + {Py_mod_exec, (void*)__pyx_pymod_exec_arc_eager}, + #if CYTHON_COMPILING_IN_CPYTHON_FREETHREADING + {Py_mod_gil, Py_MOD_GIL_USED}, + #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, + "arc_eager", + 0, /* 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_arc_eager(void) CYTHON_SMALL_CODE; /*proto*/ +__Pyx_PyMODINIT_FUNC PyInit_arc_eager(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_arc_eager(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; + PyObject *__pyx_t_4 = NULL; + PyObject *__pyx_t_5 = NULL; + size_t __pyx_t_6; + static PyThread_type_lock __pyx_t_7[8]; + int __pyx_t_8; + Py_ssize_t __pyx_t_9; + __pyx_t_5spacy_8typedefs_hash_t __pyx_t_10; + 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 'arc_eager' 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 "arc_eager" 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_arc_eager", 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_spacy__pipeline___parser_internals__arc_eager) { + if (PyObject_SetAttr(__pyx_m, __pyx_mstate_global->__pyx_n_u_name_2, __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, "spacy.pipeline._parser_internals.arc_eager")) { + if (unlikely((PyDict_SetItemString(modules, "spacy.pipeline._parser_internals.arc_eager", __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) + if (unlikely((__Pyx_modinit_variable_import_code(__pyx_mstate) < 0))) __PYX_ERR(0, 1, __pyx_L1_error) + if (unlikely((__Pyx_modinit_function_import_code(__pyx_mstate) < 0))) __PYX_ERR(0, 1, __pyx_L1_error) + /*--- Execution code ---*/ + + /* "View.MemoryView":100 + * + * cdef object __pyx_collections_abc_Sequence "__pyx_collections_abc_Sequence" + * try: # <<<<<<<<<<<<<< + * __pyx_collections_abc_Sequence = __import__("collections.abc").abc.Sequence + * except: +*/ + { + __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:*/ { + + /* "View.MemoryView":101 + * cdef object __pyx_collections_abc_Sequence "__pyx_collections_abc_Sequence" + * try: + * __pyx_collections_abc_Sequence = __import__("collections.abc").abc.Sequence # <<<<<<<<<<<<<< + * except: + * +*/ + __pyx_t_5 = NULL; + __pyx_t_6 = 1; + { + PyObject *__pyx_callargs[2] = {__pyx_t_5, __pyx_mstate_global->__pyx_kp_u_collections_abc}; + __pyx_t_4 = __Pyx_PyObject_FastCall((PyObject*)__pyx_builtin___import__, __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(1, 101, __pyx_L2_error) + __Pyx_GOTREF(__pyx_t_4); + } + __pyx_t_5 = __Pyx_PyObject_GetAttrStr(__pyx_t_4, __pyx_mstate_global->__pyx_n_u_abc); if (unlikely(!__pyx_t_5)) __PYX_ERR(1, 101, __pyx_L2_error) + __Pyx_GOTREF(__pyx_t_5); + __Pyx_DECREF(__pyx_t_4); __pyx_t_4 = 0; + __pyx_t_4 = __Pyx_PyObject_GetAttrStr(__pyx_t_5, __pyx_mstate_global->__pyx_n_u_Sequence); if (unlikely(!__pyx_t_4)) __PYX_ERR(1, 101, __pyx_L2_error) + __Pyx_GOTREF(__pyx_t_4); + __Pyx_DECREF(__pyx_t_5); __pyx_t_5 = 0; + __Pyx_XGOTREF(__pyx_collections_abc_Sequence); + __Pyx_DECREF_SET(__pyx_collections_abc_Sequence, __pyx_t_4); + __Pyx_GIVEREF(__pyx_t_4); + __pyx_t_4 = 0; + + /* "View.MemoryView":100 + * + * cdef object __pyx_collections_abc_Sequence "__pyx_collections_abc_Sequence" + * try: # <<<<<<<<<<<<<< + * __pyx_collections_abc_Sequence = __import__("collections.abc").abc.Sequence + * except: +*/ + } + __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_L7_try_end; + __pyx_L2_error:; + __Pyx_XDECREF(__pyx_t_4); __pyx_t_4 = 0; + __Pyx_XDECREF(__pyx_t_5); __pyx_t_5 = 0; + + /* "View.MemoryView":102 + * try: + * __pyx_collections_abc_Sequence = __import__("collections.abc").abc.Sequence + * except: # <<<<<<<<<<<<<< + * + * __pyx_collections_abc_Sequence = None +*/ + /*except:*/ { + __Pyx_ErrRestore(0,0,0); + + /* "View.MemoryView":104 + * except: + * + * __pyx_collections_abc_Sequence = None # <<<<<<<<<<<<<< + * + * +*/ + __Pyx_INCREF(Py_None); + __Pyx_XGOTREF(__pyx_collections_abc_Sequence); + __Pyx_DECREF_SET(__pyx_collections_abc_Sequence, Py_None); + __Pyx_GIVEREF(Py_None); + goto __pyx_L3_exception_handled; + } + __pyx_L3_exception_handled:; + __Pyx_XGIVEREF(__pyx_t_1); + __Pyx_XGIVEREF(__pyx_t_2); + __Pyx_XGIVEREF(__pyx_t_3); + __Pyx_ExceptionReset(__pyx_t_1, __pyx_t_2, __pyx_t_3); + __pyx_L7_try_end:; + } + + /* "View.MemoryView":239 + * + * + * try: # <<<<<<<<<<<<<< + * count = __pyx_collections_abc_Sequence.count + * index = __pyx_collections_abc_Sequence.index +*/ + { + __Pyx_PyThreadState_declare + __Pyx_PyThreadState_assign + __Pyx_ExceptionSave(&__pyx_t_3, &__pyx_t_2, &__pyx_t_1); + __Pyx_XGOTREF(__pyx_t_3); + __Pyx_XGOTREF(__pyx_t_2); + __Pyx_XGOTREF(__pyx_t_1); + /*try:*/ { + + /* "View.MemoryView":240 + * + * try: + * count = __pyx_collections_abc_Sequence.count # <<<<<<<<<<<<<< + * index = __pyx_collections_abc_Sequence.index + * except: +*/ + __pyx_t_4 = __Pyx_PyObject_GetAttrStr(__pyx_collections_abc_Sequence, __pyx_mstate_global->__pyx_n_u_count); if (unlikely(!__pyx_t_4)) __PYX_ERR(1, 240, __pyx_L10_error) + __Pyx_GOTREF(__pyx_t_4); + if (__Pyx_SetItemOnTypeDict(__pyx_mstate_global->__pyx_array_type, __pyx_mstate_global->__pyx_n_u_count, __pyx_t_4) < (0)) __PYX_ERR(1, 240, __pyx_L10_error) + __Pyx_DECREF(__pyx_t_4); __pyx_t_4 = 0; + + /* "View.MemoryView":241 + * try: + * count = __pyx_collections_abc_Sequence.count + * index = __pyx_collections_abc_Sequence.index # <<<<<<<<<<<<<< + * except: + * pass +*/ + __pyx_t_4 = __Pyx_PyObject_GetAttrStr(__pyx_collections_abc_Sequence, __pyx_mstate_global->__pyx_n_u_index); if (unlikely(!__pyx_t_4)) __PYX_ERR(1, 241, __pyx_L10_error) + __Pyx_GOTREF(__pyx_t_4); + if (__Pyx_SetItemOnTypeDict(__pyx_mstate_global->__pyx_array_type, __pyx_mstate_global->__pyx_n_u_index, __pyx_t_4) < (0)) __PYX_ERR(1, 241, __pyx_L10_error) + __Pyx_DECREF(__pyx_t_4); __pyx_t_4 = 0; + + /* "View.MemoryView":239 + * + * + * try: # <<<<<<<<<<<<<< + * count = __pyx_collections_abc_Sequence.count + * index = __pyx_collections_abc_Sequence.index +*/ + } + __Pyx_XDECREF(__pyx_t_3); __pyx_t_3 = 0; + __Pyx_XDECREF(__pyx_t_2); __pyx_t_2 = 0; + __Pyx_XDECREF(__pyx_t_1); __pyx_t_1 = 0; + goto __pyx_L15_try_end; + __pyx_L10_error:; + __Pyx_XDECREF(__pyx_t_4); __pyx_t_4 = 0; + __Pyx_XDECREF(__pyx_t_5); __pyx_t_5 = 0; + + /* "View.MemoryView":242 + * count = __pyx_collections_abc_Sequence.count + * index = __pyx_collections_abc_Sequence.index + * except: # <<<<<<<<<<<<<< + * pass + * +*/ + /*except:*/ { + __Pyx_ErrRestore(0,0,0); + goto __pyx_L11_exception_handled; + } + __pyx_L11_exception_handled:; + __Pyx_XGIVEREF(__pyx_t_3); + __Pyx_XGIVEREF(__pyx_t_2); + __Pyx_XGIVEREF(__pyx_t_1); + __Pyx_ExceptionReset(__pyx_t_3, __pyx_t_2, __pyx_t_1); + __pyx_L15_try_end:; + } + + /* "View.MemoryView":307 + * return self.name + * + * cdef generic = Enum("") # <<<<<<<<<<<<<< + * cdef strided = Enum("") # default + * cdef indirect = Enum("") +*/ + __pyx_t_5 = NULL; + __pyx_t_6 = 1; + { + PyObject *__pyx_callargs[2] = {__pyx_t_5, __pyx_mstate_global->__pyx_kp_u_strided_and_direct_or_indirect}; + __pyx_t_4 = __Pyx_PyObject_FastCall((PyObject*)__pyx_mstate_global->__pyx_MemviewEnum_type, __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(1, 307, __pyx_L1_error) + __Pyx_GOTREF((PyObject *)__pyx_t_4); + } + __Pyx_XGOTREF(generic); + __Pyx_DECREF_SET(generic, ((PyObject *)__pyx_t_4)); + __Pyx_GIVEREF((PyObject *)__pyx_t_4); + __pyx_t_4 = 0; + + /* "View.MemoryView":308 + * + * cdef generic = Enum("") + * cdef strided = Enum("") # default # <<<<<<<<<<<<<< + * cdef indirect = Enum("") + * +*/ + __pyx_t_5 = NULL; + __pyx_t_6 = 1; + { + PyObject *__pyx_callargs[2] = {__pyx_t_5, __pyx_mstate_global->__pyx_kp_u_strided_and_direct}; + __pyx_t_4 = __Pyx_PyObject_FastCall((PyObject*)__pyx_mstate_global->__pyx_MemviewEnum_type, __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(1, 308, __pyx_L1_error) + __Pyx_GOTREF((PyObject *)__pyx_t_4); + } + __Pyx_XGOTREF(strided); + __Pyx_DECREF_SET(strided, ((PyObject *)__pyx_t_4)); + __Pyx_GIVEREF((PyObject *)__pyx_t_4); + __pyx_t_4 = 0; + + /* "View.MemoryView":309 + * cdef generic = Enum("") + * cdef strided = Enum("") # default + * cdef indirect = Enum("") # <<<<<<<<<<<<<< + * + * +*/ + __pyx_t_5 = NULL; + __pyx_t_6 = 1; + { + PyObject *__pyx_callargs[2] = {__pyx_t_5, __pyx_mstate_global->__pyx_kp_u_strided_and_indirect}; + __pyx_t_4 = __Pyx_PyObject_FastCall((PyObject*)__pyx_mstate_global->__pyx_MemviewEnum_type, __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(1, 309, __pyx_L1_error) + __Pyx_GOTREF((PyObject *)__pyx_t_4); + } + __Pyx_XGOTREF(indirect); + __Pyx_DECREF_SET(indirect, ((PyObject *)__pyx_t_4)); + __Pyx_GIVEREF((PyObject *)__pyx_t_4); + __pyx_t_4 = 0; + + /* "View.MemoryView":312 + * + * + * cdef contiguous = Enum("") # <<<<<<<<<<<<<< + * cdef indirect_contiguous = Enum("") + * +*/ + __pyx_t_5 = NULL; + __pyx_t_6 = 1; + { + PyObject *__pyx_callargs[2] = {__pyx_t_5, __pyx_mstate_global->__pyx_kp_u_contiguous_and_direct}; + __pyx_t_4 = __Pyx_PyObject_FastCall((PyObject*)__pyx_mstate_global->__pyx_MemviewEnum_type, __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(1, 312, __pyx_L1_error) + __Pyx_GOTREF((PyObject *)__pyx_t_4); + } + __Pyx_XGOTREF(contiguous); + __Pyx_DECREF_SET(contiguous, ((PyObject *)__pyx_t_4)); + __Pyx_GIVEREF((PyObject *)__pyx_t_4); + __pyx_t_4 = 0; + + /* "View.MemoryView":313 + * + * cdef contiguous = Enum("") + * cdef indirect_contiguous = Enum("") # <<<<<<<<<<<<<< + * + * +*/ + __pyx_t_5 = NULL; + __pyx_t_6 = 1; + { + PyObject *__pyx_callargs[2] = {__pyx_t_5, __pyx_mstate_global->__pyx_kp_u_contiguous_and_indirect}; + __pyx_t_4 = __Pyx_PyObject_FastCall((PyObject*)__pyx_mstate_global->__pyx_MemviewEnum_type, __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(1, 313, __pyx_L1_error) + __Pyx_GOTREF((PyObject *)__pyx_t_4); + } + __Pyx_XGOTREF(indirect_contiguous); + __Pyx_DECREF_SET(indirect_contiguous, ((PyObject *)__pyx_t_4)); + __Pyx_GIVEREF((PyObject *)__pyx_t_4); + __pyx_t_4 = 0; + + /* "View.MemoryView":321 + * + * + * cdef int __pyx_memoryview_thread_locks_used = 0 # <<<<<<<<<<<<<< + * cdef PyThread_type_lock[8] __pyx_memoryview_thread_locks = [ + * PyThread_allocate_lock(), +*/ + __pyx_memoryview_thread_locks_used = 0; + + /* "View.MemoryView":322 + * + * cdef int __pyx_memoryview_thread_locks_used = 0 + * cdef PyThread_type_lock[8] __pyx_memoryview_thread_locks = [ # <<<<<<<<<<<<<< + * PyThread_allocate_lock(), + * PyThread_allocate_lock(), +*/ + __pyx_t_7[0] = PyThread_allocate_lock(); + __pyx_t_7[1] = PyThread_allocate_lock(); + __pyx_t_7[2] = PyThread_allocate_lock(); + __pyx_t_7[3] = PyThread_allocate_lock(); + __pyx_t_7[4] = PyThread_allocate_lock(); + __pyx_t_7[5] = PyThread_allocate_lock(); + __pyx_t_7[6] = PyThread_allocate_lock(); + __pyx_t_7[7] = PyThread_allocate_lock(); + memcpy(&(__pyx_memoryview_thread_locks[0]), __pyx_t_7, sizeof(__pyx_memoryview_thread_locks[0]) * (8)); + + /* "View.MemoryView":983 + * + * + * try: # <<<<<<<<<<<<<< + * count = __pyx_collections_abc_Sequence.count + * index = __pyx_collections_abc_Sequence.index +*/ + { + __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:*/ { + + /* "View.MemoryView":984 + * + * try: + * count = __pyx_collections_abc_Sequence.count # <<<<<<<<<<<<<< + * index = __pyx_collections_abc_Sequence.index + * except: +*/ + __pyx_t_4 = __Pyx_PyObject_GetAttrStr(__pyx_collections_abc_Sequence, __pyx_mstate_global->__pyx_n_u_count); if (unlikely(!__pyx_t_4)) __PYX_ERR(1, 984, __pyx_L18_error) + __Pyx_GOTREF(__pyx_t_4); + if (__Pyx_SetItemOnTypeDict(__pyx_mstate_global->__pyx_memoryviewslice_type, __pyx_mstate_global->__pyx_n_u_count, __pyx_t_4) < (0)) __PYX_ERR(1, 984, __pyx_L18_error) + __Pyx_DECREF(__pyx_t_4); __pyx_t_4 = 0; + + /* "View.MemoryView":985 + * try: + * count = __pyx_collections_abc_Sequence.count + * index = __pyx_collections_abc_Sequence.index # <<<<<<<<<<<<<< + * except: + * pass +*/ + __pyx_t_4 = __Pyx_PyObject_GetAttrStr(__pyx_collections_abc_Sequence, __pyx_mstate_global->__pyx_n_u_index); if (unlikely(!__pyx_t_4)) __PYX_ERR(1, 985, __pyx_L18_error) + __Pyx_GOTREF(__pyx_t_4); + if (__Pyx_SetItemOnTypeDict(__pyx_mstate_global->__pyx_memoryviewslice_type, __pyx_mstate_global->__pyx_n_u_index, __pyx_t_4) < (0)) __PYX_ERR(1, 985, __pyx_L18_error) + __Pyx_DECREF(__pyx_t_4); __pyx_t_4 = 0; + + /* "View.MemoryView":983 + * + * + * try: # <<<<<<<<<<<<<< + * count = __pyx_collections_abc_Sequence.count + * index = __pyx_collections_abc_Sequence.index +*/ + } + __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_L23_try_end; + __pyx_L18_error:; + __Pyx_XDECREF(__pyx_t_4); __pyx_t_4 = 0; + __Pyx_XDECREF(__pyx_t_5); __pyx_t_5 = 0; + + /* "View.MemoryView":986 + * count = __pyx_collections_abc_Sequence.count + * index = __pyx_collections_abc_Sequence.index + * except: # <<<<<<<<<<<<<< + * pass + * +*/ + /*except:*/ { + __Pyx_ErrRestore(0,0,0); + goto __pyx_L19_exception_handled; + } + __pyx_L19_exception_handled:; + __Pyx_XGIVEREF(__pyx_t_1); + __Pyx_XGIVEREF(__pyx_t_2); + __Pyx_XGIVEREF(__pyx_t_3); + __Pyx_ExceptionReset(__pyx_t_1, __pyx_t_2, __pyx_t_3); + __pyx_L23_try_end:; + } + + /* "View.MemoryView":989 + * pass + * + * try: # <<<<<<<<<<<<<< + * if __pyx_collections_abc_Sequence: + * +*/ + { + __Pyx_PyThreadState_declare + __Pyx_PyThreadState_assign + __Pyx_ExceptionSave(&__pyx_t_3, &__pyx_t_2, &__pyx_t_1); + __Pyx_XGOTREF(__pyx_t_3); + __Pyx_XGOTREF(__pyx_t_2); + __Pyx_XGOTREF(__pyx_t_1); + /*try:*/ { + + /* "View.MemoryView":990 + * + * try: + * if __pyx_collections_abc_Sequence: # <<<<<<<<<<<<<< + * + * +*/ + __pyx_t_8 = __Pyx_PyObject_IsTrue(__pyx_collections_abc_Sequence); if (unlikely((__pyx_t_8 < 0))) __PYX_ERR(1, 990, __pyx_L26_error) + if (__pyx_t_8) { + + /* "View.MemoryView":994 + * + * + * __pyx_collections_abc_Sequence.register(_memoryviewslice) # <<<<<<<<<<<<<< + * __pyx_collections_abc_Sequence.register(array) + * except: +*/ + __pyx_t_5 = __pyx_collections_abc_Sequence; + __Pyx_INCREF(__pyx_t_5); + __pyx_t_6 = 0; + { + PyObject *__pyx_callargs[2] = {__pyx_t_5, ((PyObject *)__pyx_mstate_global->__pyx_memoryviewslice_type)}; + __pyx_t_4 = __Pyx_PyObject_FastCallMethod((PyObject*)__pyx_mstate_global->__pyx_n_u_register, __pyx_callargs+__pyx_t_6, (2-__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(1, 994, __pyx_L26_error) + __Pyx_GOTREF(__pyx_t_4); + } + __Pyx_DECREF(__pyx_t_4); __pyx_t_4 = 0; + + /* "View.MemoryView":995 + * + * __pyx_collections_abc_Sequence.register(_memoryviewslice) + * __pyx_collections_abc_Sequence.register(array) # <<<<<<<<<<<<<< + * except: + * pass # ignore failure, it's a minor issue +*/ + __pyx_t_5 = __pyx_collections_abc_Sequence; + __Pyx_INCREF(__pyx_t_5); + __pyx_t_6 = 0; + { + PyObject *__pyx_callargs[2] = {__pyx_t_5, ((PyObject *)__pyx_mstate_global->__pyx_array_type)}; + __pyx_t_4 = __Pyx_PyObject_FastCallMethod((PyObject*)__pyx_mstate_global->__pyx_n_u_register, __pyx_callargs+__pyx_t_6, (2-__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(1, 995, __pyx_L26_error) + __Pyx_GOTREF(__pyx_t_4); + } + __Pyx_DECREF(__pyx_t_4); __pyx_t_4 = 0; + + /* "View.MemoryView":990 + * + * try: + * if __pyx_collections_abc_Sequence: # <<<<<<<<<<<<<< + * + * +*/ + } + + /* "View.MemoryView":989 + * pass + * + * try: # <<<<<<<<<<<<<< + * if __pyx_collections_abc_Sequence: + * +*/ + } + __Pyx_XDECREF(__pyx_t_3); __pyx_t_3 = 0; + __Pyx_XDECREF(__pyx_t_2); __pyx_t_2 = 0; + __Pyx_XDECREF(__pyx_t_1); __pyx_t_1 = 0; + goto __pyx_L31_try_end; + __pyx_L26_error:; + __Pyx_XDECREF(__pyx_t_4); __pyx_t_4 = 0; + __Pyx_XDECREF(__pyx_t_5); __pyx_t_5 = 0; + + /* "View.MemoryView":996 + * __pyx_collections_abc_Sequence.register(_memoryviewslice) + * __pyx_collections_abc_Sequence.register(array) + * except: # <<<<<<<<<<<<<< + * pass # ignore failure, it's a minor issue + * +*/ + /*except:*/ { + __Pyx_ErrRestore(0,0,0); + goto __pyx_L27_exception_handled; + } + __pyx_L27_exception_handled:; + __Pyx_XGIVEREF(__pyx_t_3); + __Pyx_XGIVEREF(__pyx_t_2); + __Pyx_XGIVEREF(__pyx_t_1); + __Pyx_ExceptionReset(__pyx_t_3, __pyx_t_2, __pyx_t_1); + __pyx_L31_try_end:; + } + + /* "(tree fragment)":4 + * int __Pyx_CheckUnpickleChecksum(long, long, long, long, const char*) except -1 + * int __Pyx_UpdateUnpickledDict(object, object, Py_ssize_t) except -1 + * def __pyx_unpickle_Enum(__pyx_type, long __pyx_checksum, tuple __pyx_state): # <<<<<<<<<<<<<< + * cdef object __pyx_result + * __Pyx_CheckUnpickleChecksum(__pyx_checksum, 0x82a3537, 0x6ae9995, 0xb068931, b'name') +*/ + __pyx_t_4 = PyCFunction_NewEx(&__pyx_mdef_15View_dot_MemoryView_1__pyx_unpickle_Enum, NULL, __pyx_mstate_global->__pyx_n_u_View_MemoryView); if (unlikely(!__pyx_t_4)) __PYX_ERR(1, 4, __pyx_L1_error) + __Pyx_GOTREF(__pyx_t_4); + if (PyDict_SetItem(__pyx_mstate_global->__pyx_d, __pyx_mstate_global->__pyx_n_u_pyx_unpickle_Enum, __pyx_t_4) < (0)) __PYX_ERR(1, 4, __pyx_L1_error) + __Pyx_DECREF(__pyx_t_4); __pyx_t_4 = 0; + + /* "spacy/pipeline/_parser_internals/arc_eager.pyx":6 + * from libcpp.vector cimport vector + * + * from collections import Counter, defaultdict # <<<<<<<<<<<<<< + * + * from ...strings cimport hash_string +*/ + { + PyObject* const __pyx_imported_names[] = {__pyx_mstate_global->__pyx_n_u_Counter,__pyx_mstate_global->__pyx_n_u_defaultdict}; + __pyx_t_1 = __Pyx_Import(__pyx_mstate_global->__pyx_n_u_collections, __pyx_imported_names, 2, __pyx_mstate_global->__pyx_kp_u_spacy_pipeline__parser_internals_2, -1); if (unlikely(!__pyx_t_1)) __PYX_ERR(0, 6, __pyx_L1_error) + } + __pyx_t_4 = __pyx_t_1; + __Pyx_GOTREF(__pyx_t_4); + { + PyObject* const __pyx_imported_names[] = {__pyx_mstate_global->__pyx_n_u_Counter,__pyx_mstate_global->__pyx_n_u_defaultdict}; + for (__pyx_t_9=0; __pyx_t_9 < 2; __pyx_t_9++) { + __pyx_t_5 = __Pyx_ImportFrom(__pyx_t_4, __pyx_imported_names[__pyx_t_9]); if (unlikely(!__pyx_t_5)) __PYX_ERR(0, 6, __pyx_L1_error) + __Pyx_GOTREF(__pyx_t_5); + if (PyDict_SetItem(__pyx_mstate_global->__pyx_d, __pyx_imported_names[__pyx_t_9], __pyx_t_5) < (0)) __PYX_ERR(0, 6, __pyx_L1_error) + __Pyx_DECREF(__pyx_t_5); __pyx_t_5 = 0; + } + } + __Pyx_DECREF(__pyx_t_4); __pyx_t_4 = 0; + + /* "spacy/pipeline/_parser_internals/arc_eager.pyx":14 + * from ...typedefs cimport attr_t + * + * from ...training import split_bilu_label # <<<<<<<<<<<<<< + * + * from ...training.example cimport Example +*/ + { + PyObject* const __pyx_imported_names[] = {__pyx_mstate_global->__pyx_n_u_split_bilu_label}; + __pyx_t_1 = __Pyx_Import(__pyx_mstate_global->__pyx_n_u_training, __pyx_imported_names, 1, __pyx_mstate_global->__pyx_kp_u_spacy_training, 3); if (unlikely(!__pyx_t_1)) __PYX_ERR(0, 14, __pyx_L1_error) + } + __pyx_t_4 = __pyx_t_1; + __Pyx_GOTREF(__pyx_t_4); + { + PyObject* const __pyx_imported_names[] = {__pyx_mstate_global->__pyx_n_u_split_bilu_label}; + __pyx_t_9 = 0; { + __pyx_t_5 = __Pyx_ImportFrom(__pyx_t_4, __pyx_imported_names[__pyx_t_9]); if (unlikely(!__pyx_t_5)) __PYX_ERR(0, 14, __pyx_L1_error) + __Pyx_GOTREF(__pyx_t_5); + if (PyDict_SetItem(__pyx_mstate_global->__pyx_d, __pyx_imported_names[__pyx_t_9], __pyx_t_5) < (0)) __PYX_ERR(0, 14, __pyx_L1_error) + __Pyx_DECREF(__pyx_t_5); __pyx_t_5 = 0; + } + } + __Pyx_DECREF(__pyx_t_4); __pyx_t_4 = 0; + + /* "spacy/pipeline/_parser_internals/arc_eager.pyx":20 + * from .stateclass cimport StateClass + * + * from ...errors import Errors # <<<<<<<<<<<<<< + * + * from thinc.extra.search cimport Beam +*/ + { + PyObject* const __pyx_imported_names[] = {__pyx_mstate_global->__pyx_n_u_Errors}; + __pyx_t_1 = __Pyx_Import(__pyx_mstate_global->__pyx_n_u_errors, __pyx_imported_names, 1, __pyx_mstate_global->__pyx_kp_u_spacy_errors, 3); if (unlikely(!__pyx_t_1)) __PYX_ERR(0, 20, __pyx_L1_error) + } + __pyx_t_4 = __pyx_t_1; + __Pyx_GOTREF(__pyx_t_4); + { + PyObject* const __pyx_imported_names[] = {__pyx_mstate_global->__pyx_n_u_Errors}; + __pyx_t_9 = 0; { + __pyx_t_5 = __Pyx_ImportFrom(__pyx_t_4, __pyx_imported_names[__pyx_t_9]); if (unlikely(!__pyx_t_5)) __PYX_ERR(0, 20, __pyx_L1_error) + __Pyx_GOTREF(__pyx_t_5); + if (PyDict_SetItem(__pyx_mstate_global->__pyx_d, __pyx_imported_names[__pyx_t_9], __pyx_t_5) < (0)) __PYX_ERR(0, 20, __pyx_L1_error) + __Pyx_DECREF(__pyx_t_5); __pyx_t_5 = 0; + } + } + __Pyx_DECREF(__pyx_t_4); __pyx_t_4 = 0; + + /* "spacy/pipeline/_parser_internals/arc_eager.pyx":25 + * + * + * cdef weight_t MIN_SCORE = -90000 # <<<<<<<<<<<<<< + * cdef attr_t SUBTOK_LABEL = hash_string('subtok') + * +*/ + __pyx_v_5spacy_8pipeline_17_parser_internals_9arc_eager_MIN_SCORE = -90000.0; + + /* "spacy/pipeline/_parser_internals/arc_eager.pyx":26 + * + * cdef weight_t MIN_SCORE = -90000 + * cdef attr_t SUBTOK_LABEL = hash_string('subtok') # <<<<<<<<<<<<<< + * + * DEF NON_MONOTONIC = True +*/ + __pyx_t_10 = __pyx_f_5spacy_7strings_hash_string(__pyx_mstate_global->__pyx_n_u_subtok, 0); if (unlikely(__pyx_t_10 == ((__pyx_t_5spacy_8typedefs_hash_t)0))) __PYX_ERR(0, 26, __pyx_L1_error) + __pyx_v_5spacy_8pipeline_17_parser_internals_9arc_eager_SUBTOK_LABEL = __pyx_t_10; + + /* "spacy/pipeline/_parser_internals/arc_eager.pyx":41 + * + * + * MOVE_NAMES = [None] * N_MOVES # <<<<<<<<<<<<<< + * MOVE_NAMES[SHIFT] = 'S' + * MOVE_NAMES[REDUCE] = 'D' +*/ + __pyx_t_4 = PyList_New(1 * ((__pyx_e_5spacy_8pipeline_17_parser_internals_9arc_eager_N_MOVES<0) ? 0:__pyx_e_5spacy_8pipeline_17_parser_internals_9arc_eager_N_MOVES)); if (unlikely(!__pyx_t_4)) __PYX_ERR(0, 41, __pyx_L1_error) + __Pyx_GOTREF(__pyx_t_4); + { Py_ssize_t __pyx_temp; + for (__pyx_temp=0; __pyx_temp < __pyx_e_5spacy_8pipeline_17_parser_internals_9arc_eager_N_MOVES; __pyx_temp++) { + __Pyx_INCREF(Py_None); + __Pyx_GIVEREF(Py_None); + if (__Pyx_PyList_SET_ITEM(__pyx_t_4, __pyx_temp, Py_None) != (0)) __PYX_ERR(0, 41, __pyx_L1_error); + } + } + if (PyDict_SetItem(__pyx_mstate_global->__pyx_d, __pyx_mstate_global->__pyx_n_u_MOVE_NAMES, __pyx_t_4) < (0)) __PYX_ERR(0, 41, __pyx_L1_error) + __Pyx_DECREF(__pyx_t_4); __pyx_t_4 = 0; + + /* "spacy/pipeline/_parser_internals/arc_eager.pyx":42 + * + * MOVE_NAMES = [None] * N_MOVES + * MOVE_NAMES[SHIFT] = 'S' # <<<<<<<<<<<<<< + * MOVE_NAMES[REDUCE] = 'D' + * MOVE_NAMES[LEFT] = 'L' +*/ + __Pyx_GetModuleGlobalName(__pyx_t_4, __pyx_mstate_global->__pyx_n_u_MOVE_NAMES); if (unlikely(!__pyx_t_4)) __PYX_ERR(0, 42, __pyx_L1_error) + __Pyx_GOTREF(__pyx_t_4); + if (unlikely((__Pyx_SetItemInt(__pyx_t_4, __pyx_e_5spacy_8pipeline_17_parser_internals_9arc_eager_SHIFT, __pyx_mstate_global->__pyx_n_u_S, int, 1, __Pyx_PyLong_From___pyx_anon_enum, 0, 1, 1, 1, __Pyx_ReferenceSharing_OwnStrongReference) < 0))) __PYX_ERR(0, 42, __pyx_L1_error) + __Pyx_DECREF(__pyx_t_4); __pyx_t_4 = 0; + + /* "spacy/pipeline/_parser_internals/arc_eager.pyx":43 + * MOVE_NAMES = [None] * N_MOVES + * MOVE_NAMES[SHIFT] = 'S' + * MOVE_NAMES[REDUCE] = 'D' # <<<<<<<<<<<<<< + * MOVE_NAMES[LEFT] = 'L' + * MOVE_NAMES[RIGHT] = 'R' +*/ + __Pyx_GetModuleGlobalName(__pyx_t_4, __pyx_mstate_global->__pyx_n_u_MOVE_NAMES); if (unlikely(!__pyx_t_4)) __PYX_ERR(0, 43, __pyx_L1_error) + __Pyx_GOTREF(__pyx_t_4); + if (unlikely((__Pyx_SetItemInt(__pyx_t_4, __pyx_e_5spacy_8pipeline_17_parser_internals_9arc_eager_REDUCE, __pyx_mstate_global->__pyx_n_u_D, int, 1, __Pyx_PyLong_From___pyx_anon_enum, 0, 1, 1, 1, __Pyx_ReferenceSharing_OwnStrongReference) < 0))) __PYX_ERR(0, 43, __pyx_L1_error) + __Pyx_DECREF(__pyx_t_4); __pyx_t_4 = 0; + + /* "spacy/pipeline/_parser_internals/arc_eager.pyx":44 + * MOVE_NAMES[SHIFT] = 'S' + * MOVE_NAMES[REDUCE] = 'D' + * MOVE_NAMES[LEFT] = 'L' # <<<<<<<<<<<<<< + * MOVE_NAMES[RIGHT] = 'R' + * MOVE_NAMES[BREAK] = 'B' +*/ + __Pyx_GetModuleGlobalName(__pyx_t_4, __pyx_mstate_global->__pyx_n_u_MOVE_NAMES); if (unlikely(!__pyx_t_4)) __PYX_ERR(0, 44, __pyx_L1_error) + __Pyx_GOTREF(__pyx_t_4); + if (unlikely((__Pyx_SetItemInt(__pyx_t_4, __pyx_e_5spacy_8pipeline_17_parser_internals_9arc_eager_LEFT, __pyx_mstate_global->__pyx_n_u_L, int, 1, __Pyx_PyLong_From___pyx_anon_enum, 0, 1, 1, 1, __Pyx_ReferenceSharing_OwnStrongReference) < 0))) __PYX_ERR(0, 44, __pyx_L1_error) + __Pyx_DECREF(__pyx_t_4); __pyx_t_4 = 0; + + /* "spacy/pipeline/_parser_internals/arc_eager.pyx":45 + * MOVE_NAMES[REDUCE] = 'D' + * MOVE_NAMES[LEFT] = 'L' + * MOVE_NAMES[RIGHT] = 'R' # <<<<<<<<<<<<<< + * MOVE_NAMES[BREAK] = 'B' + * +*/ + __Pyx_GetModuleGlobalName(__pyx_t_4, __pyx_mstate_global->__pyx_n_u_MOVE_NAMES); if (unlikely(!__pyx_t_4)) __PYX_ERR(0, 45, __pyx_L1_error) + __Pyx_GOTREF(__pyx_t_4); + if (unlikely((__Pyx_SetItemInt(__pyx_t_4, __pyx_e_5spacy_8pipeline_17_parser_internals_9arc_eager_RIGHT, __pyx_mstate_global->__pyx_n_u_R, int, 1, __Pyx_PyLong_From___pyx_anon_enum, 0, 1, 1, 1, __Pyx_ReferenceSharing_OwnStrongReference) < 0))) __PYX_ERR(0, 45, __pyx_L1_error) + __Pyx_DECREF(__pyx_t_4); __pyx_t_4 = 0; + + /* "spacy/pipeline/_parser_internals/arc_eager.pyx":46 + * MOVE_NAMES[LEFT] = 'L' + * MOVE_NAMES[RIGHT] = 'R' + * MOVE_NAMES[BREAK] = 'B' # <<<<<<<<<<<<<< + * + * +*/ + __Pyx_GetModuleGlobalName(__pyx_t_4, __pyx_mstate_global->__pyx_n_u_MOVE_NAMES); if (unlikely(!__pyx_t_4)) __PYX_ERR(0, 46, __pyx_L1_error) + __Pyx_GOTREF(__pyx_t_4); + if (unlikely((__Pyx_SetItemInt(__pyx_t_4, __pyx_e_5spacy_8pipeline_17_parser_internals_9arc_eager_BREAK, __pyx_mstate_global->__pyx_n_u_B, int, 1, __Pyx_PyLong_From___pyx_anon_enum, 0, 1, 1, 1, __Pyx_ReferenceSharing_OwnStrongReference) < 0))) __PYX_ERR(0, 46, __pyx_L1_error) + __Pyx_DECREF(__pyx_t_4); __pyx_t_4 = 0; + + /* "spacy/pipeline/_parser_internals/arc_eager.pyx":211 + * self.c = create_gold_state(self.mem, stcls.c, heads, labels, sent_starts) + * + * def update(self, StateClass stcls): # <<<<<<<<<<<<<< + * update_gold_state(&self.c, stcls.c) + * +*/ + __pyx_t_4 = __Pyx_CyFunction_New(&__pyx_mdef_5spacy_8pipeline_17_parser_internals_9arc_eager_12ArcEagerGold_3update, __Pyx_CYFUNCTION_CCLASS, __pyx_mstate_global->__pyx_n_u_ArcEagerGold_update, NULL, __pyx_mstate_global->__pyx_n_u_spacy_pipeline__parser_internals, __pyx_mstate_global->__pyx_d, ((PyObject *)__pyx_mstate_global->__pyx_codeobj_tab[3])); if (unlikely(!__pyx_t_4)) __PYX_ERR(0, 211, __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 (__Pyx_SetItemOnTypeDict(__pyx_mstate_global->__pyx_ptype_5spacy_8pipeline_17_parser_internals_9arc_eager_ArcEagerGold, __pyx_mstate_global->__pyx_n_u_update, __pyx_t_4) < (0)) __PYX_ERR(0, 211, __pyx_L1_error) + __Pyx_DECREF(__pyx_t_4); __pyx_t_4 = 0; + + /* "(tree fragment)":1 + * def __reduce_cython__(self): # <<<<<<<<<<<<<< + * raise TypeError, "self.c cannot be converted to a Python object for pickling" + * def __setstate_cython__(self, __pyx_state): +*/ + __pyx_t_4 = __Pyx_CyFunction_New(&__pyx_mdef_5spacy_8pipeline_17_parser_internals_9arc_eager_12ArcEagerGold_5__reduce_cython__, __Pyx_CYFUNCTION_CCLASS, __pyx_mstate_global->__pyx_n_u_ArcEagerGold___reduce_cython, NULL, __pyx_mstate_global->__pyx_n_u_spacy_pipeline__parser_internals, __pyx_mstate_global->__pyx_d, ((PyObject *)__pyx_mstate_global->__pyx_codeobj_tab[4])); 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, "self.c cannot be converted to a Python object for pickling" + * def __setstate_cython__(self, __pyx_state): # <<<<<<<<<<<<<< + * raise TypeError, "self.c cannot be converted to a Python object for pickling" +*/ + __pyx_t_4 = __Pyx_CyFunction_New(&__pyx_mdef_5spacy_8pipeline_17_parser_internals_9arc_eager_12ArcEagerGold_7__setstate_cython__, __Pyx_CYFUNCTION_CCLASS, __pyx_mstate_global->__pyx_n_u_ArcEagerGold___setstate_cython, NULL, __pyx_mstate_global->__pyx_n_u_spacy_pipeline__parser_internals, __pyx_mstate_global->__pyx_d, ((PyObject *)__pyx_mstate_global->__pyx_codeobj_tab[5])); 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; + + /* "spacy/pipeline/_parser_internals/arc_eager.pyx":215 + * + * + * def _get_aligned_sent_starts(example): # <<<<<<<<<<<<<< + * """Get list of SENT_START attributes aligned to the predicted tokenization. + * If the reference has not sentence starts, return a list of None values. +*/ + __pyx_t_4 = __Pyx_CyFunction_New(&__pyx_mdef_5spacy_8pipeline_17_parser_internals_9arc_eager_1_get_aligned_sent_starts, 0, __pyx_mstate_global->__pyx_n_u_get_aligned_sent_starts, NULL, __pyx_mstate_global->__pyx_n_u_spacy_pipeline__parser_internals, __pyx_mstate_global->__pyx_d, ((PyObject *)__pyx_mstate_global->__pyx_codeobj_tab[6])); if (unlikely(!__pyx_t_4)) __PYX_ERR(0, 215, __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_get_aligned_sent_starts, __pyx_t_4) < (0)) __PYX_ERR(0, 215, __pyx_L1_error) + __Pyx_DECREF(__pyx_t_4); __pyx_t_4 = 0; + + /* "(tree fragment)":1 + * def __reduce_cython__(self): # <<<<<<<<<<<<<< + * cdef tuple state + * cdef object _dict +*/ + __pyx_t_4 = __Pyx_CyFunction_New(&__pyx_mdef_5spacy_8pipeline_17_parser_internals_9arc_eager_5Shift_1__reduce_cython__, __Pyx_CYFUNCTION_CCLASS, __pyx_mstate_global->__pyx_n_u_Shift___reduce_cython, NULL, __pyx_mstate_global->__pyx_n_u_spacy_pipeline__parser_internals, __pyx_mstate_global->__pyx_d, ((PyObject *)__pyx_mstate_global->__pyx_codeobj_tab[7])); 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 (__Pyx_SetItemOnTypeDict(__pyx_mstate_global->__pyx_ptype_5spacy_8pipeline_17_parser_internals_9arc_eager_Shift, __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)":16 + * else: + * return __pyx_unpickle_Shift, (type(self), 0xe3b0c44, state) + * def __setstate_cython__(self, __pyx_state): # <<<<<<<<<<<<<< + * __pyx_unpickle_Shift__set_state(self, __pyx_state) +*/ + __pyx_t_4 = __Pyx_CyFunction_New(&__pyx_mdef_5spacy_8pipeline_17_parser_internals_9arc_eager_5Shift_3__setstate_cython__, __Pyx_CYFUNCTION_CCLASS, __pyx_mstate_global->__pyx_n_u_Shift___setstate_cython, NULL, __pyx_mstate_global->__pyx_n_u_spacy_pipeline__parser_internals, __pyx_mstate_global->__pyx_d, ((PyObject *)__pyx_mstate_global->__pyx_codeobj_tab[8])); if (unlikely(!__pyx_t_4)) __PYX_ERR(1, 16, __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 (__Pyx_SetItemOnTypeDict(__pyx_mstate_global->__pyx_ptype_5spacy_8pipeline_17_parser_internals_9arc_eager_Shift, __pyx_mstate_global->__pyx_n_u_setstate_cython, __pyx_t_4) < (0)) __PYX_ERR(1, 16, __pyx_L1_error) + __Pyx_DECREF(__pyx_t_4); __pyx_t_4 = 0; + + /* "(tree fragment)":1 + * def __reduce_cython__(self): # <<<<<<<<<<<<<< + * cdef tuple state + * cdef object _dict +*/ + __pyx_t_4 = __Pyx_CyFunction_New(&__pyx_mdef_5spacy_8pipeline_17_parser_internals_9arc_eager_6Reduce_1__reduce_cython__, __Pyx_CYFUNCTION_CCLASS, __pyx_mstate_global->__pyx_n_u_Reduce___reduce_cython, NULL, __pyx_mstate_global->__pyx_n_u_spacy_pipeline__parser_internals, __pyx_mstate_global->__pyx_d, ((PyObject *)__pyx_mstate_global->__pyx_codeobj_tab[9])); 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 (__Pyx_SetItemOnTypeDict(__pyx_mstate_global->__pyx_ptype_5spacy_8pipeline_17_parser_internals_9arc_eager_Reduce, __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)":16 + * else: + * return __pyx_unpickle_Reduce, (type(self), 0xe3b0c44, state) + * def __setstate_cython__(self, __pyx_state): # <<<<<<<<<<<<<< + * __pyx_unpickle_Reduce__set_state(self, __pyx_state) +*/ + __pyx_t_4 = __Pyx_CyFunction_New(&__pyx_mdef_5spacy_8pipeline_17_parser_internals_9arc_eager_6Reduce_3__setstate_cython__, __Pyx_CYFUNCTION_CCLASS, __pyx_mstate_global->__pyx_n_u_Reduce___setstate_cython, NULL, __pyx_mstate_global->__pyx_n_u_spacy_pipeline__parser_internals, __pyx_mstate_global->__pyx_d, ((PyObject *)__pyx_mstate_global->__pyx_codeobj_tab[10])); if (unlikely(!__pyx_t_4)) __PYX_ERR(1, 16, __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 (__Pyx_SetItemOnTypeDict(__pyx_mstate_global->__pyx_ptype_5spacy_8pipeline_17_parser_internals_9arc_eager_Reduce, __pyx_mstate_global->__pyx_n_u_setstate_cython, __pyx_t_4) < (0)) __PYX_ERR(1, 16, __pyx_L1_error) + __Pyx_DECREF(__pyx_t_4); __pyx_t_4 = 0; + + /* "(tree fragment)":1 + * def __reduce_cython__(self): # <<<<<<<<<<<<<< + * cdef tuple state + * cdef object _dict +*/ + __pyx_t_4 = __Pyx_CyFunction_New(&__pyx_mdef_5spacy_8pipeline_17_parser_internals_9arc_eager_7LeftArc_1__reduce_cython__, __Pyx_CYFUNCTION_CCLASS, __pyx_mstate_global->__pyx_n_u_LeftArc___reduce_cython, NULL, __pyx_mstate_global->__pyx_n_u_spacy_pipeline__parser_internals, __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 (__Pyx_SetItemOnTypeDict(__pyx_mstate_global->__pyx_ptype_5spacy_8pipeline_17_parser_internals_9arc_eager_LeftArc, __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)":16 + * else: + * return __pyx_unpickle_LeftArc, (type(self), 0xe3b0c44, state) + * def __setstate_cython__(self, __pyx_state): # <<<<<<<<<<<<<< + * __pyx_unpickle_LeftArc__set_state(self, __pyx_state) +*/ + __pyx_t_4 = __Pyx_CyFunction_New(&__pyx_mdef_5spacy_8pipeline_17_parser_internals_9arc_eager_7LeftArc_3__setstate_cython__, __Pyx_CYFUNCTION_CCLASS, __pyx_mstate_global->__pyx_n_u_LeftArc___setstate_cython, NULL, __pyx_mstate_global->__pyx_n_u_spacy_pipeline__parser_internals, __pyx_mstate_global->__pyx_d, ((PyObject *)__pyx_mstate_global->__pyx_codeobj_tab[12])); if (unlikely(!__pyx_t_4)) __PYX_ERR(1, 16, __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 (__Pyx_SetItemOnTypeDict(__pyx_mstate_global->__pyx_ptype_5spacy_8pipeline_17_parser_internals_9arc_eager_LeftArc, __pyx_mstate_global->__pyx_n_u_setstate_cython, __pyx_t_4) < (0)) __PYX_ERR(1, 16, __pyx_L1_error) + __Pyx_DECREF(__pyx_t_4); __pyx_t_4 = 0; + + /* "(tree fragment)":1 + * def __reduce_cython__(self): # <<<<<<<<<<<<<< + * cdef tuple state + * cdef object _dict +*/ + __pyx_t_4 = __Pyx_CyFunction_New(&__pyx_mdef_5spacy_8pipeline_17_parser_internals_9arc_eager_8RightArc_1__reduce_cython__, __Pyx_CYFUNCTION_CCLASS, __pyx_mstate_global->__pyx_n_u_RightArc___reduce_cython, NULL, __pyx_mstate_global->__pyx_n_u_spacy_pipeline__parser_internals, __pyx_mstate_global->__pyx_d, ((PyObject *)__pyx_mstate_global->__pyx_codeobj_tab[13])); 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 (__Pyx_SetItemOnTypeDict(__pyx_mstate_global->__pyx_ptype_5spacy_8pipeline_17_parser_internals_9arc_eager_RightArc, __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)":16 + * else: + * return __pyx_unpickle_RightArc, (type(self), 0xe3b0c44, state) + * def __setstate_cython__(self, __pyx_state): # <<<<<<<<<<<<<< + * __pyx_unpickle_RightArc__set_state(self, __pyx_state) +*/ + __pyx_t_4 = __Pyx_CyFunction_New(&__pyx_mdef_5spacy_8pipeline_17_parser_internals_9arc_eager_8RightArc_3__setstate_cython__, __Pyx_CYFUNCTION_CCLASS, __pyx_mstate_global->__pyx_n_u_RightArc___setstate_cython, NULL, __pyx_mstate_global->__pyx_n_u_spacy_pipeline__parser_internals, __pyx_mstate_global->__pyx_d, ((PyObject *)__pyx_mstate_global->__pyx_codeobj_tab[14])); if (unlikely(!__pyx_t_4)) __PYX_ERR(1, 16, __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 (__Pyx_SetItemOnTypeDict(__pyx_mstate_global->__pyx_ptype_5spacy_8pipeline_17_parser_internals_9arc_eager_RightArc, __pyx_mstate_global->__pyx_n_u_setstate_cython, __pyx_t_4) < (0)) __PYX_ERR(1, 16, __pyx_L1_error) + __Pyx_DECREF(__pyx_t_4); __pyx_t_4 = 0; + + /* "(tree fragment)":1 + * def __reduce_cython__(self): # <<<<<<<<<<<<<< + * cdef tuple state + * cdef object _dict +*/ + __pyx_t_4 = __Pyx_CyFunction_New(&__pyx_mdef_5spacy_8pipeline_17_parser_internals_9arc_eager_5Break_1__reduce_cython__, __Pyx_CYFUNCTION_CCLASS, __pyx_mstate_global->__pyx_n_u_Break___reduce_cython, NULL, __pyx_mstate_global->__pyx_n_u_spacy_pipeline__parser_internals, __pyx_mstate_global->__pyx_d, ((PyObject *)__pyx_mstate_global->__pyx_codeobj_tab[15])); 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 (__Pyx_SetItemOnTypeDict(__pyx_mstate_global->__pyx_ptype_5spacy_8pipeline_17_parser_internals_9arc_eager_Break, __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)":16 + * else: + * return __pyx_unpickle_Break, (type(self), 0xe3b0c44, state) + * def __setstate_cython__(self, __pyx_state): # <<<<<<<<<<<<<< + * __pyx_unpickle_Break__set_state(self, __pyx_state) +*/ + __pyx_t_4 = __Pyx_CyFunction_New(&__pyx_mdef_5spacy_8pipeline_17_parser_internals_9arc_eager_5Break_3__setstate_cython__, __Pyx_CYFUNCTION_CCLASS, __pyx_mstate_global->__pyx_n_u_Break___setstate_cython, NULL, __pyx_mstate_global->__pyx_n_u_spacy_pipeline__parser_internals, __pyx_mstate_global->__pyx_d, ((PyObject *)__pyx_mstate_global->__pyx_codeobj_tab[16])); if (unlikely(!__pyx_t_4)) __PYX_ERR(1, 16, __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 (__Pyx_SetItemOnTypeDict(__pyx_mstate_global->__pyx_ptype_5spacy_8pipeline_17_parser_internals_9arc_eager_Break, __pyx_mstate_global->__pyx_n_u_setstate_cython, __pyx_t_4) < (0)) __PYX_ERR(1, 16, __pyx_L1_error) + __Pyx_DECREF(__pyx_t_4); __pyx_t_4 = 0; + + /* "spacy/pipeline/_parser_internals/arc_eager.pyx":582 + * self.del_beam_state = _del_state + * + * @classmethod # <<<<<<<<<<<<<< + * def get_actions(cls, **kwargs): + * min_freq = kwargs.get('min_freq', None) +*/ + __pyx_t_4 = __Pyx_CyFunction_New(&__pyx_mdef_5spacy_8pipeline_17_parser_internals_9arc_eager_8ArcEager_3get_actions, __Pyx_CYFUNCTION_CLASSMETHOD | __Pyx_CYFUNCTION_CCLASS, __pyx_mstate_global->__pyx_n_u_ArcEager_get_actions, NULL, __pyx_mstate_global->__pyx_n_u_spacy_pipeline__parser_internals, __pyx_mstate_global->__pyx_d, ((PyObject *)__pyx_mstate_global->__pyx_codeobj_tab[17])); if (unlikely(!__pyx_t_4)) __PYX_ERR(0, 582, __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 (__Pyx_SetItemOnTypeDict(__pyx_mstate_global->__pyx_ptype_5spacy_8pipeline_17_parser_internals_9arc_eager_ArcEager, __pyx_mstate_global->__pyx_n_u_get_actions, __pyx_t_4) < (0)) __PYX_ERR(0, 582, __pyx_L1_error) + __Pyx_DECREF(__pyx_t_4); __pyx_t_4 = 0; + __Pyx_GetNameInClass(__pyx_t_4, (PyObject*)__pyx_mstate_global->__pyx_ptype_5spacy_8pipeline_17_parser_internals_9arc_eager_ArcEager, __pyx_mstate_global->__pyx_n_u_get_actions); if (unlikely(!__pyx_t_4)) __PYX_ERR(0, 582, __pyx_L1_error) + __Pyx_GOTREF(__pyx_t_4); + __pyx_t_5 = __Pyx_Method_ClassMethod(__pyx_t_4); if (unlikely(!__pyx_t_5)) __PYX_ERR(0, 582, __pyx_L1_error) + __Pyx_GOTREF(__pyx_t_5); + __Pyx_DECREF(__pyx_t_4); __pyx_t_4 = 0; + if (__Pyx_SetItemOnTypeDict(__pyx_mstate_global->__pyx_ptype_5spacy_8pipeline_17_parser_internals_9arc_eager_ArcEager, __pyx_mstate_global->__pyx_n_u_get_actions, __pyx_t_5) < (0)) __PYX_ERR(0, 582, __pyx_L1_error) + __Pyx_DECREF(__pyx_t_5); __pyx_t_5 = 0; + + /* "spacy/pipeline/_parser_internals/arc_eager.pyx":635 + * return (SHIFT, REDUCE, LEFT, RIGHT, BREAK) + * + * def get_doc_labels(self, doc): # <<<<<<<<<<<<<< + * """Get the labels required for a given Doc.""" + * labels = set(self.builtin_labels) +*/ + __pyx_t_5 = __Pyx_CyFunction_New(&__pyx_mdef_5spacy_8pipeline_17_parser_internals_9arc_eager_8ArcEager_5get_doc_labels, __Pyx_CYFUNCTION_CCLASS, __pyx_mstate_global->__pyx_n_u_ArcEager_get_doc_labels, NULL, __pyx_mstate_global->__pyx_n_u_spacy_pipeline__parser_internals, __pyx_mstate_global->__pyx_d, ((PyObject *)__pyx_mstate_global->__pyx_codeobj_tab[18])); if (unlikely(!__pyx_t_5)) __PYX_ERR(0, 635, __pyx_L1_error) + __Pyx_GOTREF(__pyx_t_5); + #if CYTHON_COMPILING_IN_CPYTHON && PY_VERSION_HEX >= 0x030E0000 + PyUnstable_Object_EnableDeferredRefcount(__pyx_t_5); + #endif + if (__Pyx_SetItemOnTypeDict(__pyx_mstate_global->__pyx_ptype_5spacy_8pipeline_17_parser_internals_9arc_eager_ArcEager, __pyx_mstate_global->__pyx_n_u_get_doc_labels, __pyx_t_5) < (0)) __PYX_ERR(0, 635, __pyx_L1_error) + __Pyx_DECREF(__pyx_t_5); __pyx_t_5 = 0; + + /* "spacy/pipeline/_parser_internals/arc_eager.pyx":643 + * return labels + * + * def transition(self, StateClass state, action): # <<<<<<<<<<<<<< + * cdef Transition t = self.lookup_transition(action) + * t.do(state.c, t.label) +*/ + __pyx_t_5 = __Pyx_CyFunction_New(&__pyx_mdef_5spacy_8pipeline_17_parser_internals_9arc_eager_8ArcEager_7transition, __Pyx_CYFUNCTION_CCLASS, __pyx_mstate_global->__pyx_n_u_ArcEager_transition, NULL, __pyx_mstate_global->__pyx_n_u_spacy_pipeline__parser_internals, __pyx_mstate_global->__pyx_d, ((PyObject *)__pyx_mstate_global->__pyx_codeobj_tab[19])); if (unlikely(!__pyx_t_5)) __PYX_ERR(0, 643, __pyx_L1_error) + __Pyx_GOTREF(__pyx_t_5); + #if CYTHON_COMPILING_IN_CPYTHON && PY_VERSION_HEX >= 0x030E0000 + PyUnstable_Object_EnableDeferredRefcount(__pyx_t_5); + #endif + if (__Pyx_SetItemOnTypeDict(__pyx_mstate_global->__pyx_ptype_5spacy_8pipeline_17_parser_internals_9arc_eager_ArcEager, __pyx_mstate_global->__pyx_n_u_transition, __pyx_t_5) < (0)) __PYX_ERR(0, 643, __pyx_L1_error) + __Pyx_DECREF(__pyx_t_5); __pyx_t_5 = 0; + + /* "spacy/pipeline/_parser_internals/arc_eager.pyx":648 + * return state + * + * def is_gold_parse(self, StateClass state, ArcEagerGold gold): # <<<<<<<<<<<<<< + * for i in range(state.c.length): + * token = state.c.safe_get(i) +*/ + __pyx_t_5 = __Pyx_CyFunction_New(&__pyx_mdef_5spacy_8pipeline_17_parser_internals_9arc_eager_8ArcEager_9is_gold_parse, __Pyx_CYFUNCTION_CCLASS, __pyx_mstate_global->__pyx_n_u_ArcEager_is_gold_parse, NULL, __pyx_mstate_global->__pyx_n_u_spacy_pipeline__parser_internals, __pyx_mstate_global->__pyx_d, ((PyObject *)__pyx_mstate_global->__pyx_codeobj_tab[20])); if (unlikely(!__pyx_t_5)) __PYX_ERR(0, 648, __pyx_L1_error) + __Pyx_GOTREF(__pyx_t_5); + #if CYTHON_COMPILING_IN_CPYTHON && PY_VERSION_HEX >= 0x030E0000 + PyUnstable_Object_EnableDeferredRefcount(__pyx_t_5); + #endif + if (__Pyx_SetItemOnTypeDict(__pyx_mstate_global->__pyx_ptype_5spacy_8pipeline_17_parser_internals_9arc_eager_ArcEager, __pyx_mstate_global->__pyx_n_u_is_gold_parse, __pyx_t_5) < (0)) __PYX_ERR(0, 648, __pyx_L1_error) + __Pyx_DECREF(__pyx_t_5); __pyx_t_5 = 0; + + /* "spacy/pipeline/_parser_internals/arc_eager.pyx":657 + * return True + * + * def init_gold(self, StateClass state, Example example): # <<<<<<<<<<<<<< + * gold = ArcEagerGold(self, state, example) + * self._replace_unseen_labels(gold) +*/ + __pyx_t_5 = __Pyx_CyFunction_New(&__pyx_mdef_5spacy_8pipeline_17_parser_internals_9arc_eager_8ArcEager_11init_gold, __Pyx_CYFUNCTION_CCLASS, __pyx_mstate_global->__pyx_n_u_ArcEager_init_gold, NULL, __pyx_mstate_global->__pyx_n_u_spacy_pipeline__parser_internals, __pyx_mstate_global->__pyx_d, ((PyObject *)__pyx_mstate_global->__pyx_codeobj_tab[21])); if (unlikely(!__pyx_t_5)) __PYX_ERR(0, 657, __pyx_L1_error) + __Pyx_GOTREF(__pyx_t_5); + #if CYTHON_COMPILING_IN_CPYTHON && PY_VERSION_HEX >= 0x030E0000 + PyUnstable_Object_EnableDeferredRefcount(__pyx_t_5); + #endif + if (__Pyx_SetItemOnTypeDict(__pyx_mstate_global->__pyx_ptype_5spacy_8pipeline_17_parser_internals_9arc_eager_ArcEager, __pyx_mstate_global->__pyx_n_u_init_gold, __pyx_t_5) < (0)) __PYX_ERR(0, 657, __pyx_L1_error) + __Pyx_DECREF(__pyx_t_5); __pyx_t_5 = 0; + + /* "spacy/pipeline/_parser_internals/arc_eager.pyx":662 + * return gold + * + * def init_gold_batch(self, examples): # <<<<<<<<<<<<<< + * # TODO: Projectivity? + * all_states = self.init_batch([eg.predicted for eg in examples]) +*/ + __pyx_t_5 = __Pyx_CyFunction_New(&__pyx_mdef_5spacy_8pipeline_17_parser_internals_9arc_eager_8ArcEager_13init_gold_batch, __Pyx_CYFUNCTION_CCLASS, __pyx_mstate_global->__pyx_n_u_ArcEager_init_gold_batch, NULL, __pyx_mstate_global->__pyx_n_u_spacy_pipeline__parser_internals, __pyx_mstate_global->__pyx_d, ((PyObject *)__pyx_mstate_global->__pyx_codeobj_tab[22])); if (unlikely(!__pyx_t_5)) __PYX_ERR(0, 662, __pyx_L1_error) + __Pyx_GOTREF(__pyx_t_5); + #if CYTHON_COMPILING_IN_CPYTHON && PY_VERSION_HEX >= 0x030E0000 + PyUnstable_Object_EnableDeferredRefcount(__pyx_t_5); + #endif + if (__Pyx_SetItemOnTypeDict(__pyx_mstate_global->__pyx_ptype_5spacy_8pipeline_17_parser_internals_9arc_eager_ArcEager, __pyx_mstate_global->__pyx_n_u_init_gold_batch, __pyx_t_5) < (0)) __PYX_ERR(0, 662, __pyx_L1_error) + __Pyx_DECREF(__pyx_t_5); __pyx_t_5 = 0; + + /* "spacy/pipeline/_parser_internals/arc_eager.pyx":674 + * return states, golds, n_steps + * + * def _replace_unseen_labels(self, ArcEagerGold gold): # <<<<<<<<<<<<<< + * backoff_label = self.strings["dep"] + * root_label = self.strings["ROOT"] +*/ + __pyx_t_5 = __Pyx_CyFunction_New(&__pyx_mdef_5spacy_8pipeline_17_parser_internals_9arc_eager_8ArcEager_15_replace_unseen_labels, __Pyx_CYFUNCTION_CCLASS, __pyx_mstate_global->__pyx_n_u_ArcEager__replace_unseen_labels, NULL, __pyx_mstate_global->__pyx_n_u_spacy_pipeline__parser_internals, __pyx_mstate_global->__pyx_d, ((PyObject *)__pyx_mstate_global->__pyx_codeobj_tab[23])); if (unlikely(!__pyx_t_5)) __PYX_ERR(0, 674, __pyx_L1_error) + __Pyx_GOTREF(__pyx_t_5); + #if CYTHON_COMPILING_IN_CPYTHON && PY_VERSION_HEX >= 0x030E0000 + PyUnstable_Object_EnableDeferredRefcount(__pyx_t_5); + #endif + if (__Pyx_SetItemOnTypeDict(__pyx_mstate_global->__pyx_ptype_5spacy_8pipeline_17_parser_internals_9arc_eager_ArcEager, __pyx_mstate_global->__pyx_n_u_replace_unseen_labels, __pyx_t_5) < (0)) __PYX_ERR(0, 674, __pyx_L1_error) + __Pyx_DECREF(__pyx_t_5); __pyx_t_5 = 0; + + /* "spacy/pipeline/_parser_internals/arc_eager.pyx":708 + * raise KeyError(f"Unknown transition: {name}") + * + * def move_name(self, int move, attr_t label): # <<<<<<<<<<<<<< + * label_str = self.strings[label] + * if label_str: +*/ + __pyx_t_5 = __Pyx_CyFunction_New(&__pyx_mdef_5spacy_8pipeline_17_parser_internals_9arc_eager_8ArcEager_17move_name, __Pyx_CYFUNCTION_CCLASS, __pyx_mstate_global->__pyx_n_u_ArcEager_move_name, NULL, __pyx_mstate_global->__pyx_n_u_spacy_pipeline__parser_internals, __pyx_mstate_global->__pyx_d, ((PyObject *)__pyx_mstate_global->__pyx_codeobj_tab[24])); if (unlikely(!__pyx_t_5)) __PYX_ERR(0, 708, __pyx_L1_error) + __Pyx_GOTREF(__pyx_t_5); + #if CYTHON_COMPILING_IN_CPYTHON && PY_VERSION_HEX >= 0x030E0000 + PyUnstable_Object_EnableDeferredRefcount(__pyx_t_5); + #endif + if (__Pyx_SetItemOnTypeDict(__pyx_mstate_global->__pyx_ptype_5spacy_8pipeline_17_parser_internals_9arc_eager_ArcEager, __pyx_mstate_global->__pyx_n_u_move_name, __pyx_t_5) < (0)) __PYX_ERR(0, 708, __pyx_L1_error) + __Pyx_DECREF(__pyx_t_5); __pyx_t_5 = 0; + + /* "spacy/pipeline/_parser_internals/arc_eager.pyx":715 + * return MOVE_NAMES[move] + * + * def class_name(self, int i): # <<<<<<<<<<<<<< + * return self.move_name(self.c[i].move, self.c[i].label) + * +*/ + __pyx_t_5 = __Pyx_CyFunction_New(&__pyx_mdef_5spacy_8pipeline_17_parser_internals_9arc_eager_8ArcEager_19class_name, __Pyx_CYFUNCTION_CCLASS, __pyx_mstate_global->__pyx_n_u_ArcEager_class_name, NULL, __pyx_mstate_global->__pyx_n_u_spacy_pipeline__parser_internals, __pyx_mstate_global->__pyx_d, ((PyObject *)__pyx_mstate_global->__pyx_codeobj_tab[25])); if (unlikely(!__pyx_t_5)) __PYX_ERR(0, 715, __pyx_L1_error) + __Pyx_GOTREF(__pyx_t_5); + #if CYTHON_COMPILING_IN_CPYTHON && PY_VERSION_HEX >= 0x030E0000 + PyUnstable_Object_EnableDeferredRefcount(__pyx_t_5); + #endif + if (__Pyx_SetItemOnTypeDict(__pyx_mstate_global->__pyx_ptype_5spacy_8pipeline_17_parser_internals_9arc_eager_ArcEager, __pyx_mstate_global->__pyx_n_u_class_name, __pyx_t_5) < (0)) __PYX_ERR(0, 715, __pyx_L1_error) + __Pyx_DECREF(__pyx_t_5); __pyx_t_5 = 0; + + /* "spacy/pipeline/_parser_internals/arc_eager.pyx":750 + * return t + * + * def set_annotations(self, StateClass state, Doc doc): # <<<<<<<<<<<<<< + * for arc in state.arcs: + * doc.c[arc["child"]].head = arc["head"] - arc["child"] +*/ + __pyx_t_5 = __Pyx_CyFunction_New(&__pyx_mdef_5spacy_8pipeline_17_parser_internals_9arc_eager_8ArcEager_21set_annotations, __Pyx_CYFUNCTION_CCLASS, __pyx_mstate_global->__pyx_n_u_ArcEager_set_annotations, NULL, __pyx_mstate_global->__pyx_n_u_spacy_pipeline__parser_internals, __pyx_mstate_global->__pyx_d, ((PyObject *)__pyx_mstate_global->__pyx_codeobj_tab[26])); if (unlikely(!__pyx_t_5)) __PYX_ERR(0, 750, __pyx_L1_error) + __Pyx_GOTREF(__pyx_t_5); + #if CYTHON_COMPILING_IN_CPYTHON && PY_VERSION_HEX >= 0x030E0000 + PyUnstable_Object_EnableDeferredRefcount(__pyx_t_5); + #endif + if (__Pyx_SetItemOnTypeDict(__pyx_mstate_global->__pyx_ptype_5spacy_8pipeline_17_parser_internals_9arc_eager_ArcEager, __pyx_mstate_global->__pyx_n_u_set_annotations, __pyx_t_5) < (0)) __PYX_ERR(0, 750, __pyx_L1_error) + __Pyx_DECREF(__pyx_t_5); __pyx_t_5 = 0; + + /* "spacy/pipeline/_parser_internals/arc_eager.pyx":759 + * set_children_from_heads(doc.c, 0, doc.length) + * + * def get_beam_parses(self, Beam beam): # <<<<<<<<<<<<<< + * parses = [] + * probs = beam.probs +*/ + __pyx_t_5 = __Pyx_CyFunction_New(&__pyx_mdef_5spacy_8pipeline_17_parser_internals_9arc_eager_8ArcEager_23get_beam_parses, __Pyx_CYFUNCTION_CCLASS, __pyx_mstate_global->__pyx_n_u_ArcEager_get_beam_parses, NULL, __pyx_mstate_global->__pyx_n_u_spacy_pipeline__parser_internals, __pyx_mstate_global->__pyx_d, ((PyObject *)__pyx_mstate_global->__pyx_codeobj_tab[27])); if (unlikely(!__pyx_t_5)) __PYX_ERR(0, 759, __pyx_L1_error) + __Pyx_GOTREF(__pyx_t_5); + #if CYTHON_COMPILING_IN_CPYTHON && PY_VERSION_HEX >= 0x030E0000 + PyUnstable_Object_EnableDeferredRefcount(__pyx_t_5); + #endif + if (__Pyx_SetItemOnTypeDict(__pyx_mstate_global->__pyx_ptype_5spacy_8pipeline_17_parser_internals_9arc_eager_ArcEager, __pyx_mstate_global->__pyx_n_u_get_beam_parses, __pyx_t_5) < (0)) __PYX_ERR(0, 759, __pyx_L1_error) + __Pyx_DECREF(__pyx_t_5); __pyx_t_5 = 0; + + /* "spacy/pipeline/_parser_internals/arc_eager.pyx":781 + * return list(arcs) + * + * def has_gold(self, Example eg, start=0, end=None): # <<<<<<<<<<<<<< + * for word in eg.y[start:end]: + * if word.dep != 0: +*/ + __pyx_t_5 = __Pyx_CyFunction_New(&__pyx_mdef_5spacy_8pipeline_17_parser_internals_9arc_eager_8ArcEager_25has_gold, __Pyx_CYFUNCTION_CCLASS, __pyx_mstate_global->__pyx_n_u_ArcEager_has_gold, NULL, __pyx_mstate_global->__pyx_n_u_spacy_pipeline__parser_internals, __pyx_mstate_global->__pyx_d, ((PyObject *)__pyx_mstate_global->__pyx_codeobj_tab[28])); if (unlikely(!__pyx_t_5)) __PYX_ERR(0, 781, __pyx_L1_error) + __Pyx_GOTREF(__pyx_t_5); + #if CYTHON_COMPILING_IN_CPYTHON && PY_VERSION_HEX >= 0x030E0000 + PyUnstable_Object_EnableDeferredRefcount(__pyx_t_5); + #endif + __Pyx_CyFunction_SetDefaultsTuple(__pyx_t_5, __pyx_mstate_global->__pyx_tuple[6]); + if (__Pyx_SetItemOnTypeDict(__pyx_mstate_global->__pyx_ptype_5spacy_8pipeline_17_parser_internals_9arc_eager_ArcEager, __pyx_mstate_global->__pyx_n_u_has_gold, __pyx_t_5) < (0)) __PYX_ERR(0, 781, __pyx_L1_error) + __Pyx_DECREF(__pyx_t_5); __pyx_t_5 = 0; + + /* "spacy/pipeline/_parser_internals/arc_eager.pyx":802 + * output[i] = is_valid[self.c[i].move] + * + * def get_cost(self, StateClass stcls, gold, int i): # <<<<<<<<<<<<<< + * if not isinstance(gold, ArcEagerGold): + * raise TypeError(Errors.E909.format(name="ArcEagerGold")) +*/ + __pyx_t_5 = __Pyx_CyFunction_New(&__pyx_mdef_5spacy_8pipeline_17_parser_internals_9arc_eager_8ArcEager_27get_cost, __Pyx_CYFUNCTION_CCLASS, __pyx_mstate_global->__pyx_n_u_ArcEager_get_cost, NULL, __pyx_mstate_global->__pyx_n_u_spacy_pipeline__parser_internals, __pyx_mstate_global->__pyx_d, ((PyObject *)__pyx_mstate_global->__pyx_codeobj_tab[29])); if (unlikely(!__pyx_t_5)) __PYX_ERR(0, 802, __pyx_L1_error) + __Pyx_GOTREF(__pyx_t_5); + #if CYTHON_COMPILING_IN_CPYTHON && PY_VERSION_HEX >= 0x030E0000 + PyUnstable_Object_EnableDeferredRefcount(__pyx_t_5); + #endif + if (__Pyx_SetItemOnTypeDict(__pyx_mstate_global->__pyx_ptype_5spacy_8pipeline_17_parser_internals_9arc_eager_ArcEager, __pyx_mstate_global->__pyx_n_u_get_cost, __pyx_t_5) < (0)) __PYX_ERR(0, 802, __pyx_L1_error) + __Pyx_DECREF(__pyx_t_5); __pyx_t_5 = 0; + + /* "spacy/pipeline/_parser_internals/arc_eager.pyx":835 + * raise ValueError(Errors.E1031) + * + * def get_oracle_sequence_from_state(self, StateClass state, ArcEagerGold gold, _debug=None): # <<<<<<<<<<<<<< + * cdef int i + * cdef Pool mem = Pool() +*/ + __pyx_t_5 = __Pyx_CyFunction_New(&__pyx_mdef_5spacy_8pipeline_17_parser_internals_9arc_eager_8ArcEager_29get_oracle_sequence_from_state, __Pyx_CYFUNCTION_CCLASS, __pyx_mstate_global->__pyx_n_u_ArcEager_get_oracle_sequence_fro, NULL, __pyx_mstate_global->__pyx_n_u_spacy_pipeline__parser_internals, __pyx_mstate_global->__pyx_d, ((PyObject *)__pyx_mstate_global->__pyx_codeobj_tab[30])); if (unlikely(!__pyx_t_5)) __PYX_ERR(0, 835, __pyx_L1_error) + __Pyx_GOTREF(__pyx_t_5); + #if CYTHON_COMPILING_IN_CPYTHON && PY_VERSION_HEX >= 0x030E0000 + PyUnstable_Object_EnableDeferredRefcount(__pyx_t_5); + #endif + __Pyx_CyFunction_SetDefaultsTuple(__pyx_t_5, __pyx_mstate_global->__pyx_tuple[7]); + if (__Pyx_SetItemOnTypeDict(__pyx_mstate_global->__pyx_ptype_5spacy_8pipeline_17_parser_internals_9arc_eager_ArcEager, __pyx_mstate_global->__pyx_n_u_get_oracle_sequence_from_state, __pyx_t_5) < (0)) __PYX_ERR(0, 835, __pyx_L1_error) + __Pyx_DECREF(__pyx_t_5); __pyx_t_5 = 0; + + /* "(tree fragment)":1 + * def __reduce_cython__(self): # <<<<<<<<<<<<<< + * raise TypeError, "self.c,self.del_beam_state,self.init_beam_state cannot be converted to a Python object for pickling" + * def __setstate_cython__(self, __pyx_state): +*/ + __pyx_t_5 = __Pyx_CyFunction_New(&__pyx_mdef_5spacy_8pipeline_17_parser_internals_9arc_eager_8ArcEager_31__reduce_cython__, __Pyx_CYFUNCTION_CCLASS, __pyx_mstate_global->__pyx_n_u_ArcEager___reduce_cython, NULL, __pyx_mstate_global->__pyx_n_u_spacy_pipeline__parser_internals, __pyx_mstate_global->__pyx_d, ((PyObject *)__pyx_mstate_global->__pyx_codeobj_tab[31])); if (unlikely(!__pyx_t_5)) __PYX_ERR(1, 1, __pyx_L1_error) + __Pyx_GOTREF(__pyx_t_5); + #if CYTHON_COMPILING_IN_CPYTHON && PY_VERSION_HEX >= 0x030E0000 + PyUnstable_Object_EnableDeferredRefcount(__pyx_t_5); + #endif + if (PyDict_SetItem(__pyx_mstate_global->__pyx_d, __pyx_mstate_global->__pyx_n_u_reduce_cython, __pyx_t_5) < (0)) __PYX_ERR(1, 1, __pyx_L1_error) + __Pyx_DECREF(__pyx_t_5); __pyx_t_5 = 0; + + /* "(tree fragment)":3 + * def __reduce_cython__(self): + * raise TypeError, "self.c,self.del_beam_state,self.init_beam_state cannot be converted to a Python object for pickling" + * def __setstate_cython__(self, __pyx_state): # <<<<<<<<<<<<<< + * raise TypeError, "self.c,self.del_beam_state,self.init_beam_state cannot be converted to a Python object for pickling" +*/ + __pyx_t_5 = __Pyx_CyFunction_New(&__pyx_mdef_5spacy_8pipeline_17_parser_internals_9arc_eager_8ArcEager_33__setstate_cython__, __Pyx_CYFUNCTION_CCLASS, __pyx_mstate_global->__pyx_n_u_ArcEager___setstate_cython, NULL, __pyx_mstate_global->__pyx_n_u_spacy_pipeline__parser_internals, __pyx_mstate_global->__pyx_d, ((PyObject *)__pyx_mstate_global->__pyx_codeobj_tab[32])); if (unlikely(!__pyx_t_5)) __PYX_ERR(1, 3, __pyx_L1_error) + __Pyx_GOTREF(__pyx_t_5); + #if CYTHON_COMPILING_IN_CPYTHON && PY_VERSION_HEX >= 0x030E0000 + PyUnstable_Object_EnableDeferredRefcount(__pyx_t_5); + #endif + if (PyDict_SetItem(__pyx_mstate_global->__pyx_d, __pyx_mstate_global->__pyx_n_u_setstate_cython, __pyx_t_5) < (0)) __PYX_ERR(1, 3, __pyx_L1_error) + __Pyx_DECREF(__pyx_t_5); __pyx_t_5 = 0; + + /* "(tree fragment)":4 + * int __Pyx_CheckUnpickleChecksum(long, long, long, long, const char*) except -1 + * int __Pyx_UpdateUnpickledDict(object, object, Py_ssize_t) except -1 + * def __pyx_unpickle_Shift(__pyx_type, long __pyx_checksum, tuple __pyx_state): # <<<<<<<<<<<<<< + * cdef object __pyx_result + * __Pyx_CheckUnpickleChecksum(__pyx_checksum, 0xe3b0c44, 0xda39a3e, 0xd41d8cd, b'') +*/ + __pyx_t_5 = __Pyx_CyFunction_New(&__pyx_mdef_5spacy_8pipeline_17_parser_internals_9arc_eager_3__pyx_unpickle_Shift, 0, __pyx_mstate_global->__pyx_n_u_pyx_unpickle_Shift, NULL, __pyx_mstate_global->__pyx_n_u_spacy_pipeline__parser_internals, __pyx_mstate_global->__pyx_d, ((PyObject *)__pyx_mstate_global->__pyx_codeobj_tab[33])); if (unlikely(!__pyx_t_5)) __PYX_ERR(1, 4, __pyx_L1_error) + __Pyx_GOTREF(__pyx_t_5); + #if CYTHON_COMPILING_IN_CPYTHON && PY_VERSION_HEX >= 0x030E0000 + PyUnstable_Object_EnableDeferredRefcount(__pyx_t_5); + #endif + if (PyDict_SetItem(__pyx_mstate_global->__pyx_d, __pyx_mstate_global->__pyx_n_u_pyx_unpickle_Shift, __pyx_t_5) < (0)) __PYX_ERR(1, 4, __pyx_L1_error) + __Pyx_DECREF(__pyx_t_5); __pyx_t_5 = 0; + + /* "(tree fragment)":1 + * cdef extern from *: # <<<<<<<<<<<<<< + * int __Pyx_CheckUnpickleChecksum(long, long, long, long, const char*) except -1 + * int __Pyx_UpdateUnpickledDict(object, object, Py_ssize_t) except -1 +*/ + __pyx_t_5 = __Pyx_CyFunction_New(&__pyx_mdef_5spacy_8pipeline_17_parser_internals_9arc_eager_5__pyx_unpickle_Reduce, 0, __pyx_mstate_global->__pyx_n_u_pyx_unpickle_Reduce, NULL, __pyx_mstate_global->__pyx_n_u_spacy_pipeline__parser_internals, __pyx_mstate_global->__pyx_d, ((PyObject *)__pyx_mstate_global->__pyx_codeobj_tab[34])); if (unlikely(!__pyx_t_5)) __PYX_ERR(1, 4, __pyx_L1_error) + __Pyx_GOTREF(__pyx_t_5); + #if CYTHON_COMPILING_IN_CPYTHON && PY_VERSION_HEX >= 0x030E0000 + PyUnstable_Object_EnableDeferredRefcount(__pyx_t_5); + #endif + if (PyDict_SetItem(__pyx_mstate_global->__pyx_d, __pyx_mstate_global->__pyx_n_u_pyx_unpickle_Reduce, __pyx_t_5) < (0)) __PYX_ERR(1, 4, __pyx_L1_error) + __Pyx_DECREF(__pyx_t_5); __pyx_t_5 = 0; + + /* "(tree fragment)":4 + * int __Pyx_CheckUnpickleChecksum(long, long, long, long, const char*) except -1 + * int __Pyx_UpdateUnpickledDict(object, object, Py_ssize_t) except -1 + * def __pyx_unpickle_LeftArc(__pyx_type, long __pyx_checksum, tuple __pyx_state): # <<<<<<<<<<<<<< + * cdef object __pyx_result + * __Pyx_CheckUnpickleChecksum(__pyx_checksum, 0xe3b0c44, 0xda39a3e, 0xd41d8cd, b'') +*/ + __pyx_t_5 = __Pyx_CyFunction_New(&__pyx_mdef_5spacy_8pipeline_17_parser_internals_9arc_eager_7__pyx_unpickle_LeftArc, 0, __pyx_mstate_global->__pyx_n_u_pyx_unpickle_LeftArc, NULL, __pyx_mstate_global->__pyx_n_u_spacy_pipeline__parser_internals, __pyx_mstate_global->__pyx_d, ((PyObject *)__pyx_mstate_global->__pyx_codeobj_tab[35])); if (unlikely(!__pyx_t_5)) __PYX_ERR(1, 4, __pyx_L1_error) + __Pyx_GOTREF(__pyx_t_5); + #if CYTHON_COMPILING_IN_CPYTHON && PY_VERSION_HEX >= 0x030E0000 + PyUnstable_Object_EnableDeferredRefcount(__pyx_t_5); + #endif + if (PyDict_SetItem(__pyx_mstate_global->__pyx_d, __pyx_mstate_global->__pyx_n_u_pyx_unpickle_LeftArc, __pyx_t_5) < (0)) __PYX_ERR(1, 4, __pyx_L1_error) + __Pyx_DECREF(__pyx_t_5); __pyx_t_5 = 0; + + /* "(tree fragment)":1 + * cdef extern from *: # <<<<<<<<<<<<<< + * int __Pyx_CheckUnpickleChecksum(long, long, long, long, const char*) except -1 + * int __Pyx_UpdateUnpickledDict(object, object, Py_ssize_t) except -1 +*/ + __pyx_t_5 = __Pyx_CyFunction_New(&__pyx_mdef_5spacy_8pipeline_17_parser_internals_9arc_eager_9__pyx_unpickle_RightArc, 0, __pyx_mstate_global->__pyx_n_u_pyx_unpickle_RightArc, NULL, __pyx_mstate_global->__pyx_n_u_spacy_pipeline__parser_internals, __pyx_mstate_global->__pyx_d, ((PyObject *)__pyx_mstate_global->__pyx_codeobj_tab[36])); if (unlikely(!__pyx_t_5)) __PYX_ERR(1, 4, __pyx_L1_error) + __Pyx_GOTREF(__pyx_t_5); + #if CYTHON_COMPILING_IN_CPYTHON && PY_VERSION_HEX >= 0x030E0000 + PyUnstable_Object_EnableDeferredRefcount(__pyx_t_5); + #endif + if (PyDict_SetItem(__pyx_mstate_global->__pyx_d, __pyx_mstate_global->__pyx_n_u_pyx_unpickle_RightArc, __pyx_t_5) < (0)) __PYX_ERR(1, 4, __pyx_L1_error) + __Pyx_DECREF(__pyx_t_5); __pyx_t_5 = 0; + + /* "(tree fragment)":4 + * int __Pyx_CheckUnpickleChecksum(long, long, long, long, const char*) except -1 + * int __Pyx_UpdateUnpickledDict(object, object, Py_ssize_t) except -1 + * def __pyx_unpickle_Break(__pyx_type, long __pyx_checksum, tuple __pyx_state): # <<<<<<<<<<<<<< + * cdef object __pyx_result + * __Pyx_CheckUnpickleChecksum(__pyx_checksum, 0xe3b0c44, 0xda39a3e, 0xd41d8cd, b'') +*/ + __pyx_t_5 = __Pyx_CyFunction_New(&__pyx_mdef_5spacy_8pipeline_17_parser_internals_9arc_eager_11__pyx_unpickle_Break, 0, __pyx_mstate_global->__pyx_n_u_pyx_unpickle_Break, NULL, __pyx_mstate_global->__pyx_n_u_spacy_pipeline__parser_internals, __pyx_mstate_global->__pyx_d, ((PyObject *)__pyx_mstate_global->__pyx_codeobj_tab[37])); if (unlikely(!__pyx_t_5)) __PYX_ERR(1, 4, __pyx_L1_error) + __Pyx_GOTREF(__pyx_t_5); + #if CYTHON_COMPILING_IN_CPYTHON && PY_VERSION_HEX >= 0x030E0000 + PyUnstable_Object_EnableDeferredRefcount(__pyx_t_5); + #endif + if (PyDict_SetItem(__pyx_mstate_global->__pyx_d, __pyx_mstate_global->__pyx_n_u_pyx_unpickle_Break, __pyx_t_5) < (0)) __PYX_ERR(1, 4, __pyx_L1_error) + __Pyx_DECREF(__pyx_t_5); __pyx_t_5 = 0; + + /* "spacy/pipeline/_parser_internals/arc_eager.pyx":1 + * # cython: cdivision=True, infer_types=True # <<<<<<<<<<<<<< + * from cymem.cymem cimport Address, Pool + * from libc.stdint cimport int32_t +*/ + __pyx_t_5 = __Pyx_PyDict_NewPresized(0); if (unlikely(!__pyx_t_5)) __PYX_ERR(0, 1, __pyx_L1_error) + __Pyx_GOTREF(__pyx_t_5); + if (PyDict_SetItem(__pyx_mstate_global->__pyx_d, __pyx_mstate_global->__pyx_n_u_test, __pyx_t_5) < (0)) __PYX_ERR(0, 1, __pyx_L1_error) + __Pyx_DECREF(__pyx_t_5); __pyx_t_5 = 0; + + /*--- Wrapped vars code ---*/ + + goto __pyx_L0; + __pyx_L1_error:; + __Pyx_XDECREF(__pyx_t_4); + __Pyx_XDECREF(__pyx_t_5); + if (__pyx_m) { + if (__pyx_mstate->__pyx_d && stringtab_initialized) { + __Pyx_AddTraceback("init spacy.pipeline._parser_internals.arc_eager", __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 spacy.pipeline._parser_internals.arc_eager"); + } + __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_enumerate = __Pyx_GetBuiltinName(__pyx_mstate->__pyx_n_u_enumerate); if (!__pyx_builtin_enumerate) __PYX_ERR(0, 85, __pyx_L1_error) + __pyx_builtin_zip = __Pyx_GetBuiltinName(__pyx_mstate->__pyx_n_u_zip); if (!__pyx_builtin_zip) __PYX_ERR(0, 121, __pyx_L1_error) + __pyx_builtin_sum = __Pyx_GetBuiltinName(__pyx_mstate->__pyx_n_u_sum); if (!__pyx_builtin_sum) __PYX_ERR(0, 671, __pyx_L1_error) + __pyx_builtin_min = __Pyx_GetBuiltinName(__pyx_mstate->__pyx_n_u_min); if (!__pyx_builtin_min) __PYX_ERR(0, 852, __pyx_L1_error) + __pyx_builtin___import__ = __Pyx_GetBuiltinName(__pyx_mstate->__pyx_n_u_import); if (!__pyx_builtin___import__) __PYX_ERR(1, 101, __pyx_L1_error) + __pyx_builtin_Ellipsis = __Pyx_GetBuiltinName(__pyx_mstate->__pyx_n_u_Ellipsis); if (!__pyx_builtin_Ellipsis) __PYX_ERR(1, 409, __pyx_L1_error) + __pyx_builtin_id = __Pyx_GetBuiltinName(__pyx_mstate->__pyx_n_u_id); if (!__pyx_builtin_id) __PYX_ERR(1, 619, __pyx_L1_error) + + /* Cached unbound methods */ + __pyx_mstate->__pyx_umethod_PyDict_Type_get.type = (PyObject*)&PyDict_Type; + __pyx_mstate->__pyx_umethod_PyDict_Type_get.method_name = &__pyx_mstate->__pyx_n_u_get; + __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; + __pyx_mstate->__pyx_umethod_PySet_Type__update.type = (PyObject*)(&PySet_Type); + __pyx_mstate->__pyx_umethod_PySet_Type__update.method_name = &__pyx_mstate->__pyx_n_u_update; + 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); + + /* "(tree fragment)":11 + * use_setstate = True + * else: + * use_setstate = ('self.name is not None',) # <<<<<<<<<<<<<< + * if use_setstate: + * return __pyx_unpickle_Enum, (type(self), 0x82a3537, None), state +*/ + __pyx_mstate_global->__pyx_tuple[0] = PyTuple_Pack(1, __pyx_mstate_global->__pyx_kp_u_self_name_is_not_None); if (unlikely(!__pyx_mstate_global->__pyx_tuple[0])) __PYX_ERR(1, 11, __pyx_L1_error) + __Pyx_GOTREF(__pyx_mstate_global->__pyx_tuple[0]); + __Pyx_GIVEREF(__pyx_mstate_global->__pyx_tuple[0]); + + /* "View.MemoryView":583 + * def suboffsets(self): + * if self.view.suboffsets == NULL: + * return (-1,) * self.view.ndim # <<<<<<<<<<<<<< + * + * return tuple([suboffset for suboffset in self.view.suboffsets[:self.view.ndim]]) +*/ + __pyx_mstate_global->__pyx_tuple[1] = PyTuple_New(1); if (unlikely(!__pyx_mstate_global->__pyx_tuple[1])) __PYX_ERR(1, 583, __pyx_L1_error) + __Pyx_GOTREF(__pyx_mstate_global->__pyx_tuple[1]); + __Pyx_INCREF(__pyx_mstate_global->__pyx_int_neg_1); + __Pyx_GIVEREF(__pyx_mstate_global->__pyx_int_neg_1); + if (__Pyx_PyTuple_SET_ITEM(__pyx_mstate_global->__pyx_tuple[1], 0, __pyx_mstate_global->__pyx_int_neg_1) != (0)) __PYX_ERR(1, 583, __pyx_L1_error); + __Pyx_GIVEREF(__pyx_mstate_global->__pyx_tuple[1]); + + /* "View.MemoryView":680 + * tup = index if isinstance(index, tuple) else (index,) + * + * result = [slice(None)] * ndim # <<<<<<<<<<<<<< + * have_slices = False + * seen_ellipsis = False +*/ + __pyx_mstate_global->__pyx_slice[0] = PySlice_New(Py_None, Py_None, Py_None); if (unlikely(!__pyx_mstate_global->__pyx_slice[0])) __PYX_ERR(1, 680, __pyx_L1_error) + __Pyx_GOTREF(__pyx_mstate_global->__pyx_slice[0]); + __Pyx_GIVEREF(__pyx_mstate_global->__pyx_slice[0]); + + /* "(tree fragment)":11 + * use_setstate = True + * else: + * use_setstate = ('False',) # <<<<<<<<<<<<<< + * if use_setstate: + * return __pyx_unpickle_Shift, (type(self), 0xe3b0c44, None), state +*/ + __pyx_mstate_global->__pyx_tuple[2] = PyTuple_Pack(1, __pyx_mstate_global->__pyx_n_u_False); if (unlikely(!__pyx_mstate_global->__pyx_tuple[2])) __PYX_ERR(1, 11, __pyx_L1_error) + __Pyx_GOTREF(__pyx_mstate_global->__pyx_tuple[2]); + __Pyx_GIVEREF(__pyx_mstate_global->__pyx_tuple[2]); + + /* "spacy/pipeline/_parser_internals/arc_eager.pyx":618 + * label_freqs.pop(label) + * # Ensure these actions are present + * actions[BREAK].setdefault('ROOT', 0) # <<<<<<<<<<<<<< + * if kwargs.get("learn_tokens") is True: + * actions[RIGHT].setdefault('subtok', 0) +*/ + __pyx_mstate_global->__pyx_tuple[3] = PyTuple_Pack(2, __pyx_mstate_global->__pyx_n_u_ROOT, __pyx_mstate_global->__pyx_int_0); if (unlikely(!__pyx_mstate_global->__pyx_tuple[3])) __PYX_ERR(0, 618, __pyx_L1_error) + __Pyx_GOTREF(__pyx_mstate_global->__pyx_tuple[3]); + __Pyx_GIVEREF(__pyx_mstate_global->__pyx_tuple[3]); + + /* "spacy/pipeline/_parser_internals/arc_eager.pyx":620 + * actions[BREAK].setdefault('ROOT', 0) + * if kwargs.get("learn_tokens") is True: + * actions[RIGHT].setdefault('subtok', 0) # <<<<<<<<<<<<<< + * actions[LEFT].setdefault('subtok', 0) + * # Used for backoff +*/ + __pyx_mstate_global->__pyx_tuple[4] = PyTuple_Pack(2, __pyx_mstate_global->__pyx_n_u_subtok, __pyx_mstate_global->__pyx_int_0); if (unlikely(!__pyx_mstate_global->__pyx_tuple[4])) __PYX_ERR(0, 620, __pyx_L1_error) + __Pyx_GOTREF(__pyx_mstate_global->__pyx_tuple[4]); + __Pyx_GIVEREF(__pyx_mstate_global->__pyx_tuple[4]); + + /* "spacy/pipeline/_parser_internals/arc_eager.pyx":623 + * actions[LEFT].setdefault('subtok', 0) + * # Used for backoff + * actions[RIGHT].setdefault('dep', 0) # <<<<<<<<<<<<<< + * actions[LEFT].setdefault('dep', 0) + * return actions +*/ + __pyx_mstate_global->__pyx_tuple[5] = PyTuple_Pack(2, __pyx_mstate_global->__pyx_n_u_dep, __pyx_mstate_global->__pyx_int_0); if (unlikely(!__pyx_mstate_global->__pyx_tuple[5])) __PYX_ERR(0, 623, __pyx_L1_error) + __Pyx_GOTREF(__pyx_mstate_global->__pyx_tuple[5]); + __Pyx_GIVEREF(__pyx_mstate_global->__pyx_tuple[5]); + + /* "spacy/pipeline/_parser_internals/arc_eager.pyx":781 + * return list(arcs) + * + * def has_gold(self, Example eg, start=0, end=None): # <<<<<<<<<<<<<< + * for word in eg.y[start:end]: + * if word.dep != 0: +*/ + __pyx_mstate_global->__pyx_tuple[6] = PyTuple_Pack(2, __pyx_mstate_global->__pyx_int_0, Py_None); if (unlikely(!__pyx_mstate_global->__pyx_tuple[6])) __PYX_ERR(0, 781, __pyx_L1_error) + __Pyx_GOTREF(__pyx_mstate_global->__pyx_tuple[6]); + __Pyx_GIVEREF(__pyx_mstate_global->__pyx_tuple[6]); + + /* "spacy/pipeline/_parser_internals/arc_eager.pyx":835 + * raise ValueError(Errors.E1031) + * + * def get_oracle_sequence_from_state(self, StateClass state, ArcEagerGold gold, _debug=None): # <<<<<<<<<<<<<< + * cdef int i + * cdef Pool mem = Pool() +*/ + __pyx_mstate_global->__pyx_tuple[7] = PyTuple_Pack(1, Py_None); if (unlikely(!__pyx_mstate_global->__pyx_tuple[7])) __PYX_ERR(0, 835, __pyx_L1_error) + __Pyx_GOTREF(__pyx_mstate_global->__pyx_tuple[7]); + __Pyx_GIVEREF(__pyx_mstate_global->__pyx_tuple[7]); + #if CYTHON_IMMORTAL_CONSTANTS + { + PyObject **table = __pyx_mstate->__pyx_tuple; + for (Py_ssize_t i=0; i<8; ++i) { + #if CYTHON_COMPILING_IN_CPYTHON_FREETHREADING + Py_SET_REFCNT(table[i], _Py_IMMORTAL_REFCNT_LOCAL); + #else + Py_SET_REFCNT(table[i], _Py_IMMORTAL_INITIAL_REFCNT); + #endif + } + } + #endif + #if CYTHON_IMMORTAL_CONSTANTS + { + PyObject **table = __pyx_mstate->__pyx_slice; + for (Py_ssize_t i=0; i<1; ++i) { + #if CYTHON_COMPILING_IN_CPYTHON_FREETHREADING + Py_SET_REFCNT(table[i], _Py_IMMORTAL_REFCNT_LOCAL); + #else + 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: 10; } index[] = {{2},{13},{19},{68},{19},{19},{3},{35},{54},{37},{60},{24},{52},{26},{34},{17},{29},{33},{45},{22},{15},{179},{37},{16},{3},{8},{30},{32},{20},{1},{1},{1},{1},{1},{1},{0},{1},{1},{8},{5},{6},{15},{23},{25},{7},{6},{2},{14},{6},{35},{19},{19},{9},{30},{50},{39},{34},{8},{58},{99},{21},{12},{44},{46},{14},{20},{32},{22},{14},{30},{37},{5},{7},{8},{12},{30},{32},{19},{26},{28},{31},{19},{20},{24},{17},{23},{39},{17},{18},{24},{22},{18},{24},{19},{1},{5},{23},{25},{6},{7},{1},{4},{4},{4},{5},{4},{8},{6},{5},{4},{1},{7},{25},{27},{10},{20},{1},{4},{6},{24},{26},{8},{26},{28},{1},{10},{8},{5},{23},{25},{5},{15},{2},{3},{6},{7},{3},{5},{13},{15},{9},{10},{15},{15},{3},{9},{4},{18},{2},{13},{4},{4},{12},{14},{1},{5},{9},{17},{10},{18},{5},{3},{11},{4},{4},{5},{5},{6},{9},{11},{3},{4},{8},{5},{3},{15},{2},{6},{3},{9},{5},{6},{7},{20},{8},{6},{4},{5},{6},{7},{4},{8},{7},{3},{11},{29},{17},{24},{23},{41},{15},{14},{8},{14},{30},{47},{12},{4},{5},{10},{5},{14},{8},{8},{4},{5},{7},{1},{2},{10},{5},{8},{10},{9},{15},{13},{8},{13},{8},{5},{8},{6},{5},{11},{9},{6},{8},{12},{11},{8},{10},{3},{7},{3},{8},{8},{4},{10},{4},{9},{5},{7},{4},{8},{4},{7},{4},{3},{4},{5},{6},{3},{9},{5},{11},{4},{5},{12},{14},{12},{11},{10},{20},{19},{22},{21},{23},{20},{14},{12},{5},{10},{17},{13},{9},{8},{22},{12},{10},{1},{2},{10},{4},{4},{11},{5},{15},{12},{10},{12},{19},{5},{4},{42},{16},{3},{5},{5},{5},{6},{5},{4},{4},{6},{6},{3},{1},{8},{4},{5},{5},{8},{10},{6},{6},{5},{12},{5},{6},{1},{4},{1},{5},{9},{1},{3},{6},{3},{22},{79},{11},{11},{30},{17},{118},{485},{43},{143},{44},{34},{89},{89},{89},{89},{89},{121},{212},{127},{31},{43},{9},{11},{740},{2},{2},{11},{6},{55},{55},{55},{55},{142},{92},{81},{51},{39},{1}}; + #if (CYTHON_COMPRESS_STRINGS) == 2 /* compression: bz2 (3811 bytes) */ +const char* const cstring = "BZh91AY&SY]~v\200\000\002\372\177\377\377\377\377\377\377\377\377\377\277\377\377\376\277\377\377\364@@@@@@@@@@@@@\000@\000`\017n\016\272\331e\233\355\255\261m,-E\206\205\240)`b\252\273n\265 \333\335\000\000{\240J\230\204\222\201\243\311=F\232h<\246A\2612i\262i\206\212y\014&\224yOS\323F\"z\206\302\215<\246\217&\211\344\306\2054\031\020\004h&I\211OL\246\233b\231&M\036\240\3654\036\240\006\200\r\000\000\000\000\36522\003@\032\2304\241\024\364z\240\003@m@\000\001\240\000h\000\000\000\000\000\000\r\032\000H\204 \202\006\223I\351\2524\362\231\224\365=0\223&\201\221\241\243@\001\240\000\000\006\200\000\001\352\0202a0\002d\300\000& `\000\000\004\300\230\004`\000\002`\000\000\004\211\020\023C!2bdM\240E6\010\324\362\215\250\310\365\032h\017Pz\200\000\006\200\000\003@\r/o\002bZ\255\200\232\370B9\023\317\353\273\313\312\341\234+\256\271\203\222\010\027Z1\022\353\325\350bS\202d\270]\242Q\214B.\026\377\250\027\214\030x\313\334.\256\021\314\212TV\237\372\225\325\272\340\244\220\275\365\3024I-F\330\332m\266\333\001\215&\323h\0306\320y\031\006K.\0233\362\265E\205:\206@\031\2616\204\330\233\033H\335`\2700,\367j\036L\325\300\200\tC\0303f\315\344\201\242\022\325\221v\3065\032HHb\222)4\245.\201e\241\205\362J\240G\2061ECj\205\202\034\322-\274\005\312\032\211\264\235`\322\203o\216\000\3306\216<\206C\225\273335\260\320E\310@\230\214\321%\"$$u\304\304\306:\344\000\220\217,[\030\305P\252=T:\202%\300\311\255L-\005\246\021\214,\244\231fFu%\254d{B\033\322TR\241\000\330 EU\324\332\200\330 V3\036\237\230\306\036\300\330\320\377d\365\2650\317A\255\024\224:A\376;\347\321Q\371Y\037\304F=h\021!U\336[\003!$\010\236\213\0049\265\250\024\013E\351\275\322\233\007\366\332\005k\233\371\315mK\ny\235~\327\006\307\253]\235'\010\320E\215\252\301\007\207,\260\010\250\010\300\301\023\014\377\207d\310\010\030\367n\272\007B*\213\312\034=\255\3737\201\\z\326[#\\\323\211\301YK\211\232\032c\304a\273W\024\361e\236\335\230\340\373_\033\263\335Jg\266\221H\360\236w\234S\305\203\303C\007(\205.\233W\253\024\240;\271\326""\0104#U\247\231\0233M\371\210\270\005\360\014@\022\326\007\305\305\004\034=\007w3p\013\001\276BB\312<\010\" \204 !\265\264\234\235\261\272*\022\224\206O\000\013(`\037F\360\266X\n\207ag\253r\004\305\260\002\250\361}\370\014\276n\274\3514\350\246\235-\325/\352\346\245\356s\232\344t\004\227\310\330yd\317vo\264\260\265\250\014\242\304\215\317\202\335\316Z\323\034:\277w\370\264~?\312}\247\355Jc\365|\225V\354\026K;_{\233\207@t\300\214\020\246\"A\364#\211\320\311\272;\313\0065\341\\^\366:Y\\\320\347\nDv\321_\225{\317\213/\310m\024\2404\"\225w\2448\005\213\026\267\233\345\031`1\200\311U\"\225\031\007^\345\225\212\347\352\342\316\345\320\364\361\251\250b\253;F`6\006\275\\[hW\270A\364^(\347\235\2025\204\325T\003\265\337\307\323\352b\375\266VW\350\270.\334Q\014\223\212\016X$J\203\273Hn\312\267\001\264F\320\332\234s\334>~\031C!\242\370\254D\331\315:pF.\253\213\211\373\017\026\3571\372\257n\240Vi\263\210\237i\227?\000\356\363_X\3002\336l\256}\300n\257\335\301\277\206\367Xzc\036\204z\235A\325^q\004W\273\216\016\335\003\022rf\307<\034K\201\330\333\315\277\243d\r\312\003##\"(f(\367\027r\374\355\027\337\247\213y\2236\032\202\256E\260e\020\316\273(x\370\006\343\024s\3653\027\271\226\212\272|\032{n\017\253f\231\371\367&u\365\340\213\007\016\256\247\001\320\004>\244@q\252\232\253@Hs\216\237s\303\"\252\242\242A1\333\237\327\323\317?\023\352\335\013.%u\377\320<:;\036>\242{\211\242\333Yr\rV\213%\267\216\201\2468\201\0221\022\325MO/~\201X\344\360#\303\303\347XL\231:\315\317A>^\"\225\354\277\355\266\333\212\3742\316,\310\275\020\215o\371\305\244\242\3222\325\362\345\340t\261\273\334:\232#\306\007#\024\2219\222~\213<\234\376\017\235a\377;\271n\240Ctg\267&yg\314\261*\356*\304\305\311\331\t\226?\271\255\322t\032\242;\351\373\221\205\316\227*\342\313\225\010\272\365\010\220\203\336\27247g\014\201\0179\206!\260\030Q\005\365N2\310\317\025\373\304\307I\243V\377\360\253\262\263\025\330\311Fw\315\331\354\256\362\337\310\370>l\315\245J\347\225wL\241\214e\272\307X\252\260\366\274\345o\031@\243\245\273b\033\227$\242\2242""\335\206:\036\373.AC\030\303\023 /\256\312\013#u\375\017{\235\206\204\260\027\0101\267c\2534\332\0026\215\270mh\215\372Ne\264\206\244\336\323z\324dpGc\315B:\373\364L\3460e\261\264\333a\030\240\305\226\340Y^N\3375&<\224p\225\204\253\236\021P\0366\005WV\232rd\261\210\207\037~\022\320/846u0\206\275\300k\370$\221\016\032\\\222\320Q\270u\251\264\rT\241A55=\225U)\320<\364Z\222Tx7\203\361\227F\226\014\246\014\371\271$\345\375\036\344\3061\3642)\355\253\315\023\037Br\013\336'\023\273\204\324\352\315L\203?\243\t\330\266\363\265\373x\213\212\336C[\013>\323\263\255\366\276\264O\253\350,`\206\337\322i\327\353\257\307\267L*\266\321\261\337\322Y\263v\273<\227\341\177~\236\234;\343\355\353\346^\207j\334\270\235\214\3003\303\022Y\3275\357\034|\265\357\271\366\002\346\030wC\017\257\227\325\204\021\354\342p\014\004\030\204T\n\310\031\320\263d\\^\014\256\245\334\227\202\310@R\345,PN)\325E\2320\335&\340-N17\t\247\027\212X\"\234\261\020\206^\212\316\221\n^R!Y\211Z\020\251\005x\345\274\312\250Iz\331]\302\324\374\244\226xW-\014\350\220\026a\204:\006G\ta\232\006D\220a\232\020(\034\224d\207\270\246@)\377\027rE8P\220]~v\200"; + PyObject *data = __Pyx_DecompressString(cstring, 3811, 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 (3793 bytes) */ +const char* const cstring = "x\332\245YIW\334V\026\246\332\330&\035\322\246\030l\022\273;\302\023\306\261+\005\215\361\030\373\024P&$\261M1\330q\247\373\350\250\244WU\n*\251J\003P>\275\360\222\245\226Zj\251\245\226,Y\366\222e-\371\t\371\t\375\335\367\244\032\300v\372t\3161\252\367\256\336p\207\357~\367*y$\025\014\275j2M\2521Es\322\211\303LWr\\\305v!2$M\2573\323\321-\323\221\0326S\231\246\233\325\256P\272\241Iu\317q\2452\223tSc{8@15\311\264p\206\241cy\301V%\335\221\252\226\241I\213\371;\322F\376Y\257h\003\242\305\374\263\305\374w\213^\245\302liGg\273\222f1\207\237\301\366\032\226\303\240\216\255k\314YRL\3112\215\226\244\332Lq\231\244He\261\311\255).\035\251Z\246\253W=\313s\240\215Tgu\313n\345\260\213\216R\034\007\006J\256%a\263v\227\237#V\320\225\311\242\344\340][w\225\262\301\222\005B\251\212m\325?\265\227\333/\355\352nMr[\r&M'r\327VL\207\233\321\335\"\226a\207\016\237\272=N^\356\365\254.\234 \026\025\353\r\267%95\005G\273^\003\312U,[R[n\3152s\212m+\255\025rhO\370\236\255r\215,\317\225\254\212T\266\351I\007Z$\314{zR\234\242\360\251\246;\244\016\343JUU\312\317\034\247\206_\234\374\277\244[\024\346*\207#y\200h\200\355\271@\033\317\265.#\350\216L\233dO\350~\253\234\2379)rH$\256\321\310`G\177\307\244'\337I\371S\2206-\000""\244\242x\206+\3112\274\354\251L\226%\315\343>3-\363.\000\263\243+\006\336\252\272\251\273\262lz\365F+'\253\226\315ru\354\323\3719RE\321\r\201\n\275N\360\356]\346\325\025$\343\311\025I\010\236:\314\250\344TI\025\311\214\020&\241\022k\025iM@Y\254\346\0064tu\333\200\177\304\316;\374\0070\227\313L\251\313HM\227\t\031W\270+\374\277\2570\225:K\271\342\245e2\247\241\250\255\034\263m\313v\304\270\2417\220f&\313\311\r\305v\230-\353&\262\314\004\302s=\230\341k\277M\327~{j\355\267\212\255\312L\2512;\327h\355\211\223\201L\230aV\237\010\212\326\372\200vZF\314\321\301[\337\373~),\263<[eO\275N\206(\206a\251\234\365y@5\305Ur\037x+\010\210NL\212F\256\260\261\264\272Z\020&\242\364\024\311\200\364\227(\263w\234\353\240L\240P\226O\274\005}\360`}\370\275\327\200Z,\025}\374\260O\035\224\303\246\206\241`\227g:HF\331P\312\314\350h\236\343l&S\314;\242*se\245\337@.\343\330\342Q\354\227\253\226\343\366\t4K=y\r\211-[Q\r\006U\233\0363\241\020U@\201\325\316\262\232\342\310\325\036'\nP\177X\"\227\025W\255u\345b\247P\260#\255[;\254\337:\207\254\353\220uW\303.)..\242,o\363\307i\237\247\342S\016\027\r\307\022\230\035\370^.\346g\037\026\363s\363\305\374|\2768\233\377\373l\361a\376a\3210\364\206\243;E\236K\274\"P\234\177\372\211U\310\201\311\317\351;\273/N\335\372\342\325\353\242\374\262\360\242\270!\313k\255=\374-\243t\310/\301\245\353\254\262\276\376\352\325\346:?L\025gt)V\265\032-\312>\372\303\004\320\2235V\366\252\374!\033V5\251v\324Nh\254\201\177\270\222&\311\017\022U\243fGF\362\210r\300\252\210\024:4\206^""\017E\215wR\234\372\005\377\263=\245\216^1\371I\022\016\004c[j\"sD\341\253\340Q1\224\252\203\362\202z\230tw\025\2335e\271\342\231\252\014\233M4\2016L\357\341\233\236a\356\t\305\306p\236b\000\227j\312S\3762\t)\317r\271WB\235\252,:\325\217\210?\266\274{SW\247^\262\343\034\327\tL\312x\375D\367i~\373\364\333S\367\223s\2224\340.\346n\346\017q\032F\0161e\227\306R\336\244_\302~\372\347\324t\307E\326\350:@'\032\021\374R\037O?\272\233<9\223v\210\365\004\303\0228:\220\307\270\242S\232\365\262-&\274]\027\315W\322\201m\357*v\325\341\336\341\017\231\202/\3460\303\026nKCk0\305\006\324y\273\013\340\270\211We\271\216~\200\236{\262\301\314\252[\3037\017\376\3217O]7\361\217\207\202~\351t\372\264\300bK\363\014\376\273\303:\364O\003\307\304\305\254\341\320\\\226\223':M<\211S\340z\027I\200>d\233[%\202\337\260\032\215\264\037o\240\223p\371C\004\002\260/\323\237\203\307\257\274\325\207\335\262\214nFVkL\335v\274\272\230\331\314A\026\212q\022W\032\362\324\343#\317\344-\030\023\345\345\204\254h\246\347tDIE8!]O:\332~aB\322'\304\234p\205l\207\177\234\022\0335=\305\020~\001H=\326\355\221O\361uG@H\262\031\310\223@m\263*\360\206&\357\203=\207M\232\244c\313J\207N\236\257\331\265l\315\241\006\024\231\251\365d'\r\235\023E\233\327\211$\202\030%,\327S=\344\017T\022\336\312\0212\177\267\211\355\260\276\3230(;t\303K\325V\035\252GB3^B\370\003\014\014;\010[\256\205?\333\303\267\245W\006\234\201\000\250E\313\350\271\347\2725\333\332\3450O;\335n\333\201\320\340h\321\363\341\243\231\331\236\303:V \277<\361pv\311S{{\262\316\037\0000>\035[\255\271\275\026\347\264w:>>]j\371\035W\032x\261\272\261\261\372rE^.\256\221\364\226\320MJ\340'\337\343\256\220\357'*\313\233\244\331\222t\373\016\372g\227?f\006\310\323\274j!\302\202\2648\261\274\317\264\007\257\205\263\341\363h\212\206\327\303B\370:\232}_h\017]\330\377w0\033<\017\247\243l{h\370h\230Vqq\223\336~\031d\203\251`>p\303{Q\206\004\237\357\317\357\277\203\360f\230i\017\217\3723|\357\215p7R\"/\306\373\253\341T{h\302\337\n\246\304Z\333\317\372W\375\325\240\024\260p>t""\243\271\250\024\225c\354\035\363\347}\033\007]\rV\303R\310\242\371\250\031\017\037,\037\376\351p\352p\356\260t\214\005\263\211\032\307Cc\376B0\2163\214\010\307\216\372\337`\250\360\227\3769_\361w\202\222\230\234\367\233\3019z3\274\277\352\277\206\332\315\360B\324\244\273f\375\"\356\232\tg\305\3449\214zHfv\026\036Iy\241U\367%\237\254\300@(H+\177\304E\233a6\274\023)\277\235\033\370\342zx?\232\212\356\307w\016\252\207%Z\374\360\350J\376(\277\010\375\277;Z\203d\304\037\2026\277F\237\305\331\370Z\\\212\253\007\245\366\310\230\177/8\023\334\013\317\204\013\321XTh\217O\010\331\271@\r\307p\351\370\225\240\220\256\232m\217_\346\376\235\n\037E\311\336?\301\261}R>YA\320V\242\331\366\304W\360gA\310\212P\365vT\350\256\276\037\361\230<$\233\204v\027\020\267\n\24262\016\331\203\360q\304\342\271\370\365\001\356\275\344{\301\"<9y\rQkF\231\343\304\331\3338\364\2268g\301\037\367KG\027o\206*\220\2238\356\033\204\362\327\324\217\305\3402`\366\217\250\331\273\231\303\214\246g\375_\302Lx)\312t\202\234\365\307\374\202\277\031dEX\340\301\013\373\236\017\355.\372\032Br/\314t`\231\365\261h\304\037\364y\010\213\376\004P\340\222U\343\200\332&92L\266\003y\355\021\262\246@\203\311 C3\227\342\033r\217\302\326\311\340|\320lO\376\r\021\310\002\275\223R8\030~\037\025\340\333\311\277\006o\302E20\232\211\377\036+\361\273\303l{\374\253`:\034E\370\262\035u\306\375\345`\010\326d\311/\034b\217\200\320\n\266j\321\325\250p\234\010\024Z{%X>\222\346\342\251\030\350\376l\177l\277\260\277\345_\207\372\315\316i\251A\"\0020\251\030\214&\n\303$\327\177\034(\000\366`\270\034\235\211f\241\347V\303\n\017\325\357^|>\366\016\212`\350\341\313G\227\357Fo\216\346\237\037v\017;\003;\023\326'\010\254s\n]\341\375\210\216}+\207\217\376SJ\026\217\372\323G_\316\302\327\351\364\252\250K\300\347x\270\025M\303\300\341,\262\206\242\336?\024h\333\010\317\3225YJ\230\363\201\215X^\013\337Fj<\026\257\240\266~Xx\005!hb\337[\336H-\242\326\000=\037\276d\024\376b\210\031\2745z4:\023]\006$K\261vp\375@;\234\372\204\354k\342\236OH\374\233\301\340\321\225\034\007\371\363\203)h\2254x+\341\034`\253\202\232\267\342\033H*\210o\303L*\215\n\010\350:\332\206{\007\231T\374:""\024}[\220\r3\004\371\233X\204\240\0075\342\207\367\231\343\301\257E\267\365\371\301\343\303\355\243\322z{\2208D\224O\360\354\277\375\373\324;N\243\353\030\212\377r\000^FI\375\310\266\205\204\346\272\333n\001\202_\306\271\303\314\247\266\335\017nqHw\267\315\000Z\267\343\227p\303'\266=@\213D)\321\335v\033\254\37686\017\013\311\266\337F\007\316\016\275\337\335/\373\027\020\314\014e\363y\377\035\265\005\2005X\245\014\312\026\215\032\257* \217\037\004\024\333\303\234\t\202-\350\265\000\003n\222;\221!(T\331I4\265C\235\215\303)\177!\235\233\301g0\377f\322B\211.\213\330\203\367\203'>\032\036\320\327+\276\274\034Yq][v\007~\347\333\342'\266\307\352li\340\325\253\327\362z\341\345\217\003\305\027k\233o\345\237\212?\027_\024?zvMqj2>\\\326Z\257\304\377\256\020\337&\311-\316\266\336\2205\035\233\\\26563\300\027'\377\275\377\177S\246W\007\017\347.\314\323e;\226\256u>\202R\2618~a\376\325\177\001N?\007\325"; + PyObject *data = __Pyx_DecompressString(cstring, 3793, 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 (7913 bytes) */ +const char* const bytes = ": Aligned headsAligned sent startsAll dimensions preceding dimension %d must be indexed and not slicedArc is gold B0, S0?Arc is gold S0, B0?B0=Buffer view does not expose stridesCan only create a buffer that is contiguous in memory.Cannot assign to read-only memoryviewCannot create writable memory view from read-only memoryviewCannot index with type 'Cannot transpose memoryview with indirect dimensionsDimension %d is not directEmpty shape tuple for cython.arrayGold sent starts?Index out of bounds (axis %d)Indirect dimensions not supportedInvalid mode, expected 'c' or 'fortran', got Invalid shape in axis ')- add_note and at 0xcollections.abcdisableenablegcgold.heads[s0] (got got differing extents in dimension is_head_unknown(b0)is_head_unknown(s0)isenableditemsize <= 0 for cython.arrayno default __reduce__ due to non-trivial __cinit__numpy._core.multiarray failed to importnumpy._core.umath failed to import object>self.c cannot be converted to a Python object for picklingself.c,self.del_beam_state,self.init_beam_state cannot be converted to a Python object for picklingself.name is not Nonespacy.errorsspacy.pipeline._parser_internals.collectionsspacy/pipeline/_parser_internals/arc_eager.pyxspacy.trainingunable to allocate array data.unable to allocate shape and strides.ASCIIActionsArcEagerArcEagerGoldArcEagerGold.__reduce_cython__ArcEagerGold.__setstate_cython__ArcEagerGold.updateArcEager.__reduce_cython__ArcEager.__setstate_cython__ArcEager._replace_unseen_labelsArcEager.class_nameArcEager.get_a""ctionsArcEager.get_beam_parsesArcEager.get_costArcEager.get_doc_labelsArcEager.get_oracle_sequence_from_stateArcEager.has_goldArcEager.init_goldArcEager.init_gold_batchArcEager.is_gold_parseArcEager.move_nameArcEager.set_annotationsArcEager.transitionBBreakBreak.__reduce_cython__Break.__setstate_cython__BufferCounterDE019E024E040E1031E909EllipsisErrorsFalseGoldLLeftArcLeftArc.__reduce_cython__LeftArc.__setstate_cython__MOVE_NAMES__Pyx_PyDict_NextRefRROOTReduceReduce.__reduce_cython__Reduce.__setstate_cython__RightArcRightArc.__reduce_cython__RightArc.__setstate_cython__SSENT_STARTSequenceShiftShift.__reduce_cython__Shift.__setstate_cython__StackView.MemoryView__abcactionactionsaddalignaligned_heads_aligned_labelsalignmentall_statesallocate_bufferallow_transientarcarc_eagerarcsasyncio.coroutinesb0backoff_labelbasebeambreak_labelsbuiltin_labelscchild__class____class_getitem__class_namecline_in_tracebackcloseclscollectionscopycostcostscount_debugdebug_logdefaultdictdepdep___dict___dictdocdtype_is_objectegencodeendenumerateerrorerrorsexampleexample_gold_preprocexamplesfailedfileflagsformatfortranfreq__func__genexprgetget_actionsget_actions..get_aligned_parse_get_aligned_sent_startsget_aligned_sent_starts_get_aligned_sent_starts..genexprget_beam_parsesget_class_nameget_costget_doc_labelsget_oracle_sequence_from_stateget_oracle_sequence_from_state..genexpr__getstate__goldgold_gold_stategoldshas_annotationhas_goldhas_headheadheadshistoryiid__import__index__init__init_batchinit_goldinit_gold_batch_is_coroutineis_finalis_gold_parseis_validitemsitemsizekwargslabellabel_freqslabel_strlabelslearn_tokensleft_labels__main__max_lengthmemmemviewminmin_costmin_freqmode__module__movemove_namemovesn_stepsname__name__ndim__new__nextobjpackparseparsespoppredictedprintprint_stateprobprobsprojectivize__pyx_checksum__pyx_result__pyx_state__pyx_type__pyx_unpickle_Break__pyx_unpickle_Enum__pyx_unpickle_LeftArc__pyx_unpickle_Reduce__pyx_unpickle_RightAr""c__pyx_unpickle_Shift__pyx_vtable____qualname__queue__reduce____reduce_cython____reduce_ex__referenceregister_replace_unseen_labelsright_labelsroot_labelss0seen_wordsselfsendsent_startssentsset_annotations__set_name__setdefault__setstate____setstate_cython__shapesizespacy.pipeline._parser_internals.arc_eagersplit_bilu_labelsrcstackstartstatestatesstclsstepstopstructsubtoksumt__test__textthrowtokentrainingtransitionunpackupdateupperuse_setstatevaluevalueswwordxx_idxx_indicesyy2xy_sentzipint const \000MISSING_DEPint (struct __pyx_t_5spacy_7structs_TokenC *, int, int)\000set_children_from_heads\200\001\330\004#\2401\240F\250!\200\001\330\004$\240A\240V\2501\200A\330\010\017\210|\2301\230F\240'\250\021\330\010\014\320\014#\2401\240A\330\010\017\210q\200A\330\010\031\230\021\230!\2304\230t\2405\250\001\200A\330\010\013\2104\210z\230\021\230&\240\001\330\014\022\220)\2301\230F\240%\240w\250a\250u\260A\330\010\"\240!\330\010\025\220U\230!\330\010\013\2104\210r\220\021\220\"\220I\230Q\230e\2404\240t\2502\250Q\250b\260\001\330\014\023\2204\220r\230\021\230\"\230I\240Q\240e\2504\250q\260\014\270D\300\002\300!\3002\300Q\340\014\023\2201\330\010\017\210q\200A\340\010\023\2206\230\024\230Q\230l\250!\330\010\022\220+\230Q\230a\330\010\017\210q\220\006\220a\220v\230Q\330\010\017\210q\220\007\220q\230\006\230a\330\010\014\210I\220V\2304\230q\240\017\250q\330\014\023\2201\220E\230\021\230)\2401\330\014\023\2201\220F\230!\2309\240A\330\010\014\210I\220V\2304\230q\320 0\260\001\330\014\023\2201\220F\230!\2309\240A\330\014\023\2201\220G\2301\230I\240Q\330\010\014\210K\220v\230T\240\021\240,\250a\360\006\000\r$\2407\250!\2507\260,\270g\300Q\330\014\023\2209\320\0340\3200B\300!\300=\320PQ\330\014\020\220\010\230\006\230j\250\t\260\021\260#\260Q\260g\270Q\330\020\023\2205\230\003\2305\240\003\2406\250\023\250A\330\024\025\330\020\023\2205\230\006\230c\240\023\240A\330\024\034\230A\330\020\023\2205\230\003\2301\330\024\033\2301\230F\240!\240:\250Q\330\020\023\2205\230\002\230!\330\024\033""\2301\230F\240!\240:\250Q\330\024\033\2301\230G\2401\240G\2501\330\025\032\230\"\230A\330\024\033\2301\230E\240\021\240*\250A\330\024\033\2301\230F\240!\2407\250!\330\010\013\2109\220G\2301\330\014\020\220\010\230\017\240w\250f\260A\330\020\024\220G\2308\240;\250e\2602\260V\2701\330\024\027\220u\230B\230a\330\030#\2404\240q\250\001\340\010\017\210q\220\006\220k\240\021\240(\250!\330\010\013\2106\220\024\220Q\320\026&\240c\250\021\330\014\023\2201\220F\230+\240Q\240j\260\001\330\014\023\2201\220E\230\033\240A\240Z\250q\340\010\017\210q\220\006\220k\240\021\240'\250\021\330\010\017\210q\220\005\220[\240\001\240\027\250\001\330\010\017\210q\200A\340\010\021\220\023\220A\220T\230\021\330\010\014\210I\220Q\330\014\017\210u\220A\330\020\026\220d\230!\2305\240\001\330\010\017\210q\200A\330\010\021\220\021\330\010\020\220\004\220A\330\010\014\210E\220\025\220a\220t\2301\330\014\024\220I\230T\240\023\240A\240Q\330\014\017\210u\220I\230Q\330\020\027\220u\230A\230Q\330\020\030\230\001\330\020\027\220t\2309\240A\240Q\330\020\023\2201\330\024\030\230\007\230q\330\030\036\230c\240\021\240!\330\030 \240\004\240H\250A\250Q\330\030\035\230W\240B\240c\250\021\250)\2603\260a\260z\300\021\330\024\032\230'\240\022\2406\250\021\330\010\017\210q\200A\330\010\024\220D\230\010\240\001\240\021\330\010\013\2101\330\014\023\220:\230Q\230f\240B\240d\250\"\250A\340\014\023\220:\230Q\230a\200A\330\010\034\230D\320 2\260!\2601\330\010\t\210\023\210A\210U\220$\220a\220q\330\010\017\210q\200A\330\010\014\210E\220\025\220a\220u\230B\230a\330\014\024\220E\230\022\2309\240A\240Q\330\014\017\210t\220;\230a\230q\240\004\240D\250\003\2501\250A\250U\260!\330\020\027\220q\330\021\025\220]\240!\2401\240D\250\004\250C\250u\260A\330\020\027\220q\330\010\017\210q\200\001\360\010\000\005\r\210A\330\004\014\210G\2201\220F\230,\240a\330\004\007\200v\210W\220E\230\024\230Q\330\010\022\220!\330\010\027\220q\340\010\030\230\001\330\004\007\200q\330\010\017\320\017(\250\004\250A\250W\260K\270w\300a\340\010\017\320""\017(\250\004\250A\250W\260K\270q\200\001\360\010\000\005\r\210A\330\004\014\210G\2201\220F\230,\240a\330\004\007\200v\210W\220E\230\024\230Q\330\010\022\220!\330\010\027\220q\340\010\030\230\001\330\004\007\200q\330\010\017\320\017)\250\024\250Q\250g\260[\300\007\300q\340\010\017\320\017)\250\024\250Q\250g\260[\300\001\200\001\360\010\000\005\r\210A\330\004\014\210G\2201\220F\230,\240a\330\004\007\200v\210W\220E\230\024\230Q\330\010\022\220!\330\010\027\220q\340\010\030\230\001\330\004\007\200q\330\010\017\320\017&\240d\250!\2507\260+\270W\300A\340\010\017\320\017&\240d\250!\2507\260+\270Q\200\001\360\010\000\005\r\210A\330\004\014\210G\2201\220F\230,\240a\330\004\007\200v\210W\220E\230\024\230Q\330\010\022\220!\330\010\027\220q\340\010\030\230\001\330\004\007\200q\330\010\017\320\017'\240t\2501\250G\260;\270g\300Q\340\010\017\320\017'\240t\2501\250G\260;\270a\200A\330\010\014\210G\2205\230\001\330\014\017\210r\220\021\220#\220Q\220i\230x\240s\250!\2508\2602\260S\270\001\270\021\330\014\017\210r\220\021\220#\220Q\220i\230w\240c\250\021\250!\330\010\014\210E\220\025\220a\220s\230!\330\014\017\210s\220\"\220A\220R\220v\230S\240\001\330\020\023\2202\220Q\220b\230\007\230t\2401\330\010\037\230q\240\003\2404\240s\250#\250Q\200A\330\010\030\230\004\230H\240A\240Q\330\010\025\220T\230\030\240\021\240!\330\010\026\220d\230'\240\021\240!\330\010\027\220t\2307\240!\2401\330\010\027\220t\2307\240!\2401\330\010\014\210E\220\025\220a\220t\2302\230Q\330\014\017\210t\220?\240!\2401\240D\250\004\250A\330\020\027\220t\2302\230V\2401\240A\330\020\030\230\004\230H\240A\240T\250\022\2507\260!\2601\330\020\023\2205\230\002\230\"\230D\240\006\240g\250Q\330\024\030\230\002\230'\240\021\240%\240q\330\025\032\230\"\230B\230d\240&\250\007\250q\330\024\030\230\002\230'\240\021\240%\240q\330\025\032\230#\230R\230t\2406\250\027\260\001\330\024\030\230\002\230'\240\021\240%\240q\330\010\017\210q\200A\340\010\025\220T\230\033\240A\240Q\240b\250\013\2604\260v\270Q\330\010\020\220\001\330\010\021""\220\021\330\010\014\210G\2206\230\023\230A\230\\\250\021\330\014\017\210t\2209\230A\230T\240\024\240T\250\025\250i\260q\330\020\025\220W\230A\230T\240\032\2501\250G\2601\330\020\026\220g\230Q\230a\330\010\022\220#\220Q\220a\220s\230!\2301\230H\240D\250\005\250Q\330\010\017\210x\220w\230a\200A\330\010\017\210t\220:\230Q\230d\240\"\240A\240R\240w\250d\260\"\260A\260R\260q\320\004)\250\027\260\001\330\010\014\210H\220B\220b\230\001\230\026\230q\330\014\017\210t\2205\230\003\2301\330\020\027\220q\340\014\023\2201\200\001\330\004\n\210+\220Q\200\001\330\004%\240Q\240f\250A\320\004Y\320YZ\340\010\030\230\004\230A\340\010\017\210t\2209\230B\230a\330\010\020\220\010\230\003\2306\240\021\240$\240j\260\001\330\010\023\2206\230\023\230F\240!\2404\240z\260\021\340\010\022\220!\330\010\024\220A\330\010\021\220\021\330\010\016\210d\220%\220y\240\001\330\014\r\330\020\024\220J\230a\230z\250\027\260\005\260T\270\021\330\023\024\330\020\031\230\021\330\020\021\330\014\027\220s\230&\240\001\330\014\020\220\005\220U\230!\2304\230q\330\020\023\2208\2301\230C\230t\2405\250\001\250\023\250C\250q\330\024\035\230T\240\022\2401\240A\330\024\033\2307\240!\2401\330\024\031\230\025\230b\240\001\240\021\330\024\031\230\025\230b\240\001\240\021\330\024\027\220q\330\030\"\240!\330\030!\240\027\250\001\250\023\250E\260\021\330\034 \240\017\250q\260\001\330\034!\240\034\250Q\340\024\032\230#\230Q\230e\2404\240v\250Q\330\024\025\340\020\031\230\021\330\020\021\330\010\013\2107\220$\220g\230X\240W\250A\330\014\026\220a\330\014\022\220!\330\014\020\220\005\220U\230!\2304\230q\330\020\026\220d\230/\250\021\250!\330\014\022\220!\330\014\020\220\t\230\027\240\001\330\020\026\220e\2304\230u\240G\2505\260\007\260u\270E\300\021\330\014\033\320\033-\250W\3204F\300a\330\014\022\220!\330\014\020\220\003\2208\2309\240A\240Q\330\020\026\220g\230R\230q\240\004\240G\2502\250Q\250i\260u\270G\300:\310Q\330\014\022\220!\330\014\022\220'\320\0311\260\021\340\014\022\220!\330\014\022\220\"\220A\220T\230\021\230'\240""\024\240U\250'\260\021\330\014\021\220\025\220b\230\001\230\021\330\014\021\220\025\220b\230\001\230\021\330\014\025\220W\230A\230S\240\005\240Q\330\020\021\330\020\030\230\007\230r\240\021\240#\240Y\250c\260\023\260G\2701\330\020\030\230\007\230r\240\021\240#\240Y\250c\260\023\260G\2701\330\020\034\230C\230q\240\005\240Y\250a\250u\260B\260a\260q\340\014\021\220\025\220b\230\001\230\021\330\014\021\220\025\220b\230\001\230\021\330\014\022\220$\220e\2301\230A\330\014\022\320\022)\250\033\260A\260Q\260d\270$\270d\300!\330\014\022\320\022)\250\033\260A\260Q\260d\270$\270d\300!\330\014\022\320\022)\250\037\270\001\270\021\270$\270d\300!\330\014\022\320\022)\250\037\270\001\270\021\270$\270d\300!\330\014\022\220&\230\004\320\034.\250d\260\"\260F\270!\2701\330\014\022\220)\2301\230G\2402\240Q\240c\250\024\250U\260%\260q\330\014\022\220*\230A\230W\240B\240a\240s\250$\250e\2605\270\001\330\014\022\220*\230A\230V\2401\330\010\017\210q\230\021\240\001\200\001\330\004&\240a\240v\250Q\230h\240g\250Q\200\001\340\004\037\230q\320 0\260\013\270;\300k\320QR\330\004\023\2205\230\010\240\001\240\021\330\004\007\200|\2207\230!\330\010'\240q\250\010\260\016\270a\330\004\013\2101\200\001\340\004\037\230q\320 0\260\013\270;\300k\320QR\330\004\023\2206\230\030\240\021\240!\330\004\007\200|\2207\230!\330\010(\250\001\250\031\260.\300\001\330\004\013\2101\200\001\340\004\037\230q\320 0\260\013\270;\300k\320QR\330\004\023\2207\230(\240!\2401\330\004\007\200|\2207\230!\330\010)\250\021\250*\260N\300!\330\004\013\2101\200\001\340\004\037\230q\320 0\260\013\270;\300k\320QR\330\004\023\2208\2308\2401\240A\330\004\007\200|\2207\230!\330\010*\250!\250;\260n\300A\330\004\013\2101\200\001\360\022\000\005\010\200w\210b\220\017\230q\240\001\330\010\020\220\007\220z\240\021\330\010\026\220a\220w\230b\240\003\2401\240G\2501\330\010\030\230\001\330\010\014\210J\220g\230R\230q\330\014\030\230\004\230A\230U\240!\2406\250\031\260&\270\001\330\014\031\230\021\360\010\000\021\030\220q\230\010\240\003\2401""\240G\2501\330\014\026\220g\230Q\230a\330\014\027\220q\230\t\240\021\240&\250\001\330\010\017\210q\340\010\017\210q\220\010\230\003\2301\230G\2401__pyx_t_5spacy_8typedefs_attr_t\000struct __pyx_t_5spacy_7structs_LexemeC\000OOV_RANK\000EMPTY_LEXEME__pyx_t_5spacy_8typedefs_hash_t (PyObject *, int __pyx_skip_dispatch)\000hash_stringstruct __pyx_t_5spacy_7structs_LexemeC\000EMPTY_LEXEMEuint64_t (void *, int, uint64_t)\000hash64O"; + 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 < 338; i++) { + Py_ssize_t bytes_length = index[i].length; + PyObject *string = PyUnicode_DecodeUTF8(bytes + pos, bytes_length, NULL); + if (likely(string) && i >= 71) 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 = 338; i < 377; 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 < 377; i++) { + if (unlikely(PyObject_Hash(stringtab[i]) == -1)) { + __PYX_ERR(0, 1, __pyx_L1_error) + } + } + #if CYTHON_IMMORTAL_CONSTANTS + { + PyObject **table = stringtab + 338; + for (Py_ssize_t i=0; i<39; ++i) { + #if CYTHON_COMPILING_IN_CPYTHON_FREETHREADING + Py_SET_REFCNT(table[i], _Py_IMMORTAL_REFCNT_LOCAL); + #else + 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,-1,1}; + int32_t const cint_constants_4[] = {136983863L,238750788L}; + for (int i = 0; i < 5; i++) { + numbertab[i] = PyLong_FromLong((i < 3 ? cint_constants_1[i - 0] : cint_constants_4[i - 3])); + 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<5; ++i) { + #if CYTHON_COMPILING_IN_CPYTHON_FREETHREADING + Py_SET_REFCNT(table[i], _Py_IMMORTAL_REFCNT_LOCAL); + #else + 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 : 5; + unsigned int flags : 10; + unsigned int first_line : 10; +} __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, 1, (unsigned int)(CO_OPTIMIZED|CO_NEWLOCALS|CO_GENERATOR), 230}; + PyObject* const varnames[] = {__pyx_mstate->__pyx_n_u_x_idx}; + __pyx_mstate_global->__pyx_codeobj_tab[0] = __Pyx_PyCode_New(descr, varnames, __pyx_mstate->__pyx_kp_u_spacy_pipeline__parser_internals_3, __pyx_mstate->__pyx_n_u_genexpr, __pyx_mstate->__pyx_kp_b_iso88591__12, tuple_dedup_map); if (unlikely(!__pyx_mstate_global->__pyx_codeobj_tab[0])) goto bad; + } + { + const __Pyx_PyCode_New_function_description descr = {0, 0, 0, 0, (unsigned int)(CO_OPTIMIZED|CO_NEWLOCALS), 585}; + PyObject* const varnames[] = {0}; + __pyx_mstate_global->__pyx_codeobj_tab[1] = __Pyx_PyCode_New(descr, varnames, __pyx_mstate->__pyx_kp_u_spacy_pipeline__parser_internals_3, __pyx_mstate->__pyx_n_u_lambda, __pyx_mstate->__pyx_kp_b_iso88591_hgQ, 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|CO_GENERATOR), 852}; + PyObject* const varnames[] = {__pyx_mstate->__pyx_n_u_i}; + __pyx_mstate_global->__pyx_codeobj_tab[2] = __Pyx_PyCode_New(descr, varnames, __pyx_mstate->__pyx_kp_u_spacy_pipeline__parser_internals_3, __pyx_mstate->__pyx_n_u_genexpr, __pyx_mstate->__pyx_kp_b_iso88591__13, tuple_dedup_map); if (unlikely(!__pyx_mstate_global->__pyx_codeobj_tab[2])) goto bad; + } + { + const __Pyx_PyCode_New_function_description descr = {2, 0, 0, 2, (unsigned int)(CO_OPTIMIZED|CO_NEWLOCALS), 211}; + PyObject* const varnames[] = {__pyx_mstate->__pyx_n_u_self, __pyx_mstate->__pyx_n_u_stcls}; + __pyx_mstate_global->__pyx_codeobj_tab[3] = __Pyx_PyCode_New(descr, varnames, __pyx_mstate->__pyx_kp_u_spacy_pipeline__parser_internals_3, __pyx_mstate->__pyx_n_u_update, __pyx_mstate->__pyx_kp_b_iso88591_A_4t5, 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), 1}; + 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_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[4])) 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[5] = __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[5])) goto bad; + } + { + const __Pyx_PyCode_New_function_description descr = {1, 0, 0, 8, (unsigned int)(CO_OPTIMIZED|CO_NEWLOCALS), 215}; + PyObject* const varnames[] = {__pyx_mstate->__pyx_n_u_example, __pyx_mstate->__pyx_n_u_align, __pyx_mstate->__pyx_n_u_sent_starts, __pyx_mstate->__pyx_n_u_seen_words, __pyx_mstate->__pyx_n_u_y_sent, __pyx_mstate->__pyx_n_u_x_indices, __pyx_mstate->__pyx_n_u_genexpr, __pyx_mstate->__pyx_n_u_genexpr}; + __pyx_mstate_global->__pyx_codeobj_tab[6] = __Pyx_PyCode_New(descr, varnames, __pyx_mstate->__pyx_kp_u_spacy_pipeline__parser_internals_3, __pyx_mstate->__pyx_n_u_get_aligned_sent_starts, __pyx_mstate->__pyx_kp_b_iso88591_wb_q_z_awb_1G1_JgRq_AU_6_q_1G1, tuple_dedup_map); if (unlikely(!__pyx_mstate_global->__pyx_codeobj_tab[6])) goto bad; + } + { + const __Pyx_PyCode_New_function_description descr = {1, 0, 0, 4, (unsigned int)(CO_OPTIMIZED|CO_NEWLOCALS), 1}; + PyObject* const varnames[] = {__pyx_mstate->__pyx_n_u_self, __pyx_mstate->__pyx_n_u_state, __pyx_mstate->__pyx_n_u_dict_2, __pyx_mstate->__pyx_n_u_use_setstate}; + __pyx_mstate_global->__pyx_codeobj_tab[7] = __Pyx_PyCode_New(descr, varnames, __pyx_mstate->__pyx_kp_u_stringsource, __pyx_mstate->__pyx_n_u_reduce_cython, __pyx_mstate->__pyx_kp_b_iso88591_A_G1F_a_vWE_Q_q_q_d_7_WA_d_7_Q, tuple_dedup_map); if (unlikely(!__pyx_mstate_global->__pyx_codeobj_tab[7])) goto bad; + } + { + const __Pyx_PyCode_New_function_description descr = {2, 0, 0, 2, (unsigned int)(CO_OPTIMIZED|CO_NEWLOCALS), 16}; + PyObject* const varnames[] = {__pyx_mstate->__pyx_n_u_self, __pyx_mstate->__pyx_n_u_pyx_state}; + __pyx_mstate_global->__pyx_codeobj_tab[8] = __Pyx_PyCode_New(descr, varnames, __pyx_mstate->__pyx_kp_u_stringsource, __pyx_mstate->__pyx_n_u_setstate_cython, __pyx_mstate->__pyx_kp_b_iso88591_1F, tuple_dedup_map); if (unlikely(!__pyx_mstate_global->__pyx_codeobj_tab[8])) goto bad; + } + { + const __Pyx_PyCode_New_function_description descr = {1, 0, 0, 4, (unsigned int)(CO_OPTIMIZED|CO_NEWLOCALS), 1}; + PyObject* const varnames[] = {__pyx_mstate->__pyx_n_u_self, __pyx_mstate->__pyx_n_u_state, __pyx_mstate->__pyx_n_u_dict_2, __pyx_mstate->__pyx_n_u_use_setstate}; + __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_A_G1F_a_vWE_Q_q_q_t1G_gQ_t1G_a, 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), 16}; + 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_AV1, tuple_dedup_map); if (unlikely(!__pyx_mstate_global->__pyx_codeobj_tab[10])) goto bad; + } + { + const __Pyx_PyCode_New_function_description descr = {1, 0, 0, 4, (unsigned int)(CO_OPTIMIZED|CO_NEWLOCALS), 1}; + PyObject* const varnames[] = {__pyx_mstate->__pyx_n_u_self, __pyx_mstate->__pyx_n_u_state, __pyx_mstate->__pyx_n_u_dict_2, __pyx_mstate->__pyx_n_u_use_setstate}; + __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_A_G1F_a_vWE_Q_q_q_AWKwa_AWKq, 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), 16}; + 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_QfA, tuple_dedup_map); if (unlikely(!__pyx_mstate_global->__pyx_codeobj_tab[12])) goto bad; + } + { + const __Pyx_PyCode_New_function_description descr = {1, 0, 0, 4, (unsigned int)(CO_OPTIMIZED|CO_NEWLOCALS), 1}; + PyObject* const varnames[] = {__pyx_mstate->__pyx_n_u_self, __pyx_mstate->__pyx_n_u_state, __pyx_mstate->__pyx_n_u_dict_2, __pyx_mstate->__pyx_n_u_use_setstate}; + __pyx_mstate_global->__pyx_codeobj_tab[13] = __Pyx_PyCode_New(descr, varnames, __pyx_mstate->__pyx_kp_u_stringsource, __pyx_mstate->__pyx_n_u_reduce_cython, __pyx_mstate->__pyx_kp_b_iso88591_A_G1F_a_vWE_Q_q_q_Qg_q_Qg, 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), 16}; + PyObject* const varnames[] = {__pyx_mstate->__pyx_n_u_self, __pyx_mstate->__pyx_n_u_pyx_state}; + __pyx_mstate_global->__pyx_codeobj_tab[14] = __Pyx_PyCode_New(descr, varnames, __pyx_mstate->__pyx_kp_u_stringsource, __pyx_mstate->__pyx_n_u_setstate_cython, __pyx_mstate->__pyx_kp_b_iso88591_avQ, tuple_dedup_map); if (unlikely(!__pyx_mstate_global->__pyx_codeobj_tab[14])) goto bad; + } + { + const __Pyx_PyCode_New_function_description descr = {1, 0, 0, 4, (unsigned int)(CO_OPTIMIZED|CO_NEWLOCALS), 1}; + PyObject* const varnames[] = {__pyx_mstate->__pyx_n_u_self, __pyx_mstate->__pyx_n_u_state, __pyx_mstate->__pyx_n_u_dict_2, __pyx_mstate->__pyx_n_u_use_setstate}; + __pyx_mstate_global->__pyx_codeobj_tab[15] = __Pyx_PyCode_New(descr, varnames, __pyx_mstate->__pyx_kp_u_stringsource, __pyx_mstate->__pyx_n_u_reduce_cython, __pyx_mstate->__pyx_kp_b_iso88591_A_G1F_a_vWE_Q_q_q_d_7_WA_d_7_Q, tuple_dedup_map); if (unlikely(!__pyx_mstate_global->__pyx_codeobj_tab[15])) goto bad; + } + { + const __Pyx_PyCode_New_function_description descr = {2, 0, 0, 2, (unsigned int)(CO_OPTIMIZED|CO_NEWLOCALS), 16}; + PyObject* const varnames[] = {__pyx_mstate->__pyx_n_u_self, __pyx_mstate->__pyx_n_u_pyx_state}; + __pyx_mstate_global->__pyx_codeobj_tab[16] = __Pyx_PyCode_New(descr, varnames, __pyx_mstate->__pyx_kp_u_stringsource, __pyx_mstate->__pyx_n_u_setstate_cython, __pyx_mstate->__pyx_kp_b_iso88591_1F, tuple_dedup_map); if (unlikely(!__pyx_mstate_global->__pyx_codeobj_tab[16])) goto bad; + } + { + const __Pyx_PyCode_New_function_description descr = {1, 0, 0, 14, (unsigned int)(CO_OPTIMIZED|CO_NEWLOCALS|CO_VARKEYWORDS), 582}; + PyObject* const varnames[] = {__pyx_mstate->__pyx_n_u_cls, __pyx_mstate->__pyx_n_u_kwargs, __pyx_mstate->__pyx_n_u_min_freq, __pyx_mstate->__pyx_n_u_actions, __pyx_mstate->__pyx_n_u_label, __pyx_mstate->__pyx_n_u_example, __pyx_mstate->__pyx_n_u_example_gold_preproc, __pyx_mstate->__pyx_n_u_heads, __pyx_mstate->__pyx_n_u_labels, __pyx_mstate->__pyx_n_u_child, __pyx_mstate->__pyx_n_u_head, __pyx_mstate->__pyx_n_u_action, __pyx_mstate->__pyx_n_u_label_freqs, __pyx_mstate->__pyx_n_u_freq}; + __pyx_mstate_global->__pyx_codeobj_tab[17] = __Pyx_PyCode_New(descr, varnames, __pyx_mstate->__pyx_kp_u_spacy_pipeline__parser_internals_3, __pyx_mstate->__pyx_n_u_get_actions, __pyx_mstate->__pyx_kp_b_iso88591_A_6_Ql_Qa_q_avQ_q_q_a_IV4q_q_1E, tuple_dedup_map); if (unlikely(!__pyx_mstate_global->__pyx_codeobj_tab[17])) goto bad; + } + { + const __Pyx_PyCode_New_function_description descr = {2, 0, 0, 4, (unsigned int)(CO_OPTIMIZED|CO_NEWLOCALS), 635}; + PyObject* const varnames[] = {__pyx_mstate->__pyx_n_u_self, __pyx_mstate->__pyx_n_u_doc, __pyx_mstate->__pyx_n_u_labels, __pyx_mstate->__pyx_n_u_token}; + __pyx_mstate_global->__pyx_codeobj_tab[18] = __Pyx_PyCode_New(descr, varnames, __pyx_mstate->__pyx_kp_u_spacy_pipeline__parser_internals_3, __pyx_mstate->__pyx_n_u_get_doc_labels, __pyx_mstate->__pyx_kp_b_iso88591_A_AT_IQ_uA_d_5_q, tuple_dedup_map); if (unlikely(!__pyx_mstate_global->__pyx_codeobj_tab[18])) goto bad; + } + { + const __Pyx_PyCode_New_function_description descr = {3, 0, 0, 4, (unsigned int)(CO_OPTIMIZED|CO_NEWLOCALS), 643}; + PyObject* const varnames[] = {__pyx_mstate->__pyx_n_u_self, __pyx_mstate->__pyx_n_u_state, __pyx_mstate->__pyx_n_u_action, __pyx_mstate->__pyx_n_u_t}; + __pyx_mstate_global->__pyx_codeobj_tab[19] = __Pyx_PyCode_New(descr, varnames, __pyx_mstate->__pyx_kp_u_spacy_pipeline__parser_internals_3, __pyx_mstate->__pyx_n_u_transition, __pyx_mstate->__pyx_kp_b_iso88591_A_D_2_1_AU_aq_q, tuple_dedup_map); if (unlikely(!__pyx_mstate_global->__pyx_codeobj_tab[19])) goto bad; + } + { + const __Pyx_PyCode_New_function_description descr = {3, 0, 0, 5, (unsigned int)(CO_OPTIMIZED|CO_NEWLOCALS), 648}; + PyObject* const varnames[] = {__pyx_mstate->__pyx_n_u_self, __pyx_mstate->__pyx_n_u_state, __pyx_mstate->__pyx_n_u_gold, __pyx_mstate->__pyx_n_u_i, __pyx_mstate->__pyx_n_u_token}; + __pyx_mstate_global->__pyx_codeobj_tab[20] = __Pyx_PyCode_New(descr, varnames, __pyx_mstate->__pyx_kp_u_spacy_pipeline__parser_internals_3, __pyx_mstate->__pyx_n_u_is_gold_parse, __pyx_mstate->__pyx_kp_b_iso88591_A_E_auBa_E_9AQ_t_aq_D_1AU_q_1D_C, tuple_dedup_map); if (unlikely(!__pyx_mstate_global->__pyx_codeobj_tab[20])) goto bad; + } + { + const __Pyx_PyCode_New_function_description descr = {3, 0, 0, 4, (unsigned int)(CO_OPTIMIZED|CO_NEWLOCALS), 657}; + PyObject* const varnames[] = {__pyx_mstate->__pyx_n_u_self, __pyx_mstate->__pyx_n_u_state, __pyx_mstate->__pyx_n_u_example, __pyx_mstate->__pyx_n_u_gold}; + __pyx_mstate_global->__pyx_codeobj_tab[21] = __Pyx_PyCode_New(descr, varnames, __pyx_mstate->__pyx_kp_u_spacy_pipeline__parser_internals_3, __pyx_mstate->__pyx_n_u_init_gold, __pyx_mstate->__pyx_kp_b_iso88591_A_1F_1A_q, tuple_dedup_map); if (unlikely(!__pyx_mstate_global->__pyx_codeobj_tab[21])) goto bad; + } + { + const __Pyx_PyCode_New_function_description descr = {2, 0, 0, 9, (unsigned int)(CO_OPTIMIZED|CO_NEWLOCALS), 662}; + PyObject* const varnames[] = {__pyx_mstate->__pyx_n_u_self, __pyx_mstate->__pyx_n_u_examples, __pyx_mstate->__pyx_n_u_all_states, __pyx_mstate->__pyx_n_u_golds, __pyx_mstate->__pyx_n_u_states, __pyx_mstate->__pyx_n_u_state, __pyx_mstate->__pyx_n_u_eg, __pyx_mstate->__pyx_n_u_n_steps, __pyx_mstate->__pyx_n_u_s}; + __pyx_mstate_global->__pyx_codeobj_tab[22] = __Pyx_PyCode_New(descr, varnames, __pyx_mstate->__pyx_kp_u_spacy_pipeline__parser_internals_3, __pyx_mstate->__pyx_n_u_init_gold_batch, __pyx_mstate->__pyx_kp_b_iso88591_A_T_AQb_4vQ_G6_A_t9AT_T_iq_WAT_1, tuple_dedup_map); if (unlikely(!__pyx_mstate_global->__pyx_codeobj_tab[22])) goto bad; + } + { + const __Pyx_PyCode_New_function_description descr = {2, 0, 0, 10, (unsigned int)(CO_OPTIMIZED|CO_NEWLOCALS), 674}; + PyObject* const varnames[] = {__pyx_mstate->__pyx_n_u_self, __pyx_mstate->__pyx_n_u_gold, __pyx_mstate->__pyx_n_u_backoff_label, __pyx_mstate->__pyx_n_u_root_label, __pyx_mstate->__pyx_n_u_left_labels, __pyx_mstate->__pyx_n_u_right_labels, __pyx_mstate->__pyx_n_u_break_labels, __pyx_mstate->__pyx_n_u_i, __pyx_mstate->__pyx_n_u_head, __pyx_mstate->__pyx_n_u_label}; + __pyx_mstate_global->__pyx_codeobj_tab[23] = __Pyx_PyCode_New(descr, varnames, __pyx_mstate->__pyx_kp_u_spacy_pipeline__parser_internals_3, __pyx_mstate->__pyx_n_u_replace_unseen_labels, __pyx_mstate->__pyx_kp_b_iso88591_A_HAQ_T_d_t7_1_t7_1_E_at2Q_t_1D, tuple_dedup_map); if (unlikely(!__pyx_mstate_global->__pyx_codeobj_tab[23])) goto bad; + } + { + const __Pyx_PyCode_New_function_description descr = {3, 0, 0, 4, (unsigned int)(CO_OPTIMIZED|CO_NEWLOCALS), 708}; + PyObject* const varnames[] = {__pyx_mstate->__pyx_n_u_self, __pyx_mstate->__pyx_n_u_move, __pyx_mstate->__pyx_n_u_label, __pyx_mstate->__pyx_n_u_label_str}; + __pyx_mstate_global->__pyx_codeobj_tab[24] = __Pyx_PyCode_New(descr, varnames, __pyx_mstate->__pyx_kp_u_spacy_pipeline__parser_internals_3, __pyx_mstate->__pyx_n_u_move_name, __pyx_mstate->__pyx_kp_b_iso88591_A_D_1_QfBd_A_Qa, tuple_dedup_map); if (unlikely(!__pyx_mstate_global->__pyx_codeobj_tab[24])) goto bad; + } + { + const __Pyx_PyCode_New_function_description descr = {2, 0, 0, 2, (unsigned int)(CO_OPTIMIZED|CO_NEWLOCALS), 715}; + PyObject* const varnames[] = {__pyx_mstate->__pyx_n_u_self, __pyx_mstate->__pyx_n_u_i}; + __pyx_mstate_global->__pyx_codeobj_tab[25] = __Pyx_PyCode_New(descr, varnames, __pyx_mstate->__pyx_kp_u_spacy_pipeline__parser_internals_3, __pyx_mstate->__pyx_n_u_class_name, __pyx_mstate->__pyx_kp_b_iso88591_A_t_Qd_ARwd_ARq, tuple_dedup_map); if (unlikely(!__pyx_mstate_global->__pyx_codeobj_tab[25])) goto bad; + } + { + const __Pyx_PyCode_New_function_description descr = {3, 0, 0, 5, (unsigned int)(CO_OPTIMIZED|CO_NEWLOCALS), 750}; + PyObject* const varnames[] = {__pyx_mstate->__pyx_n_u_self, __pyx_mstate->__pyx_n_u_state, __pyx_mstate->__pyx_n_u_doc, __pyx_mstate->__pyx_n_u_arc, __pyx_mstate->__pyx_n_u_i}; + __pyx_mstate_global->__pyx_codeobj_tab[26] = __Pyx_PyCode_New(descr, varnames, __pyx_mstate->__pyx_kp_u_spacy_pipeline__parser_internals_3, __pyx_mstate->__pyx_n_u_set_annotations, __pyx_mstate->__pyx_kp_b_iso88591_A_G5_r_Qixs_82S_r_Qiwc_E_as_s_AR, tuple_dedup_map); if (unlikely(!__pyx_mstate_global->__pyx_codeobj_tab[26])) goto bad; + } + { + const __Pyx_PyCode_New_function_description descr = {2, 0, 0, 12, (unsigned int)(CO_OPTIMIZED|CO_NEWLOCALS), 759}; + PyObject* const varnames[] = {__pyx_mstate->__pyx_n_u_self, __pyx_mstate->__pyx_n_u_beam, __pyx_mstate->__pyx_n_u_parses, __pyx_mstate->__pyx_n_u_probs, __pyx_mstate->__pyx_n_u_i, __pyx_mstate->__pyx_n_u_state, __pyx_mstate->__pyx_n_u_prob, __pyx_mstate->__pyx_n_u_parse, __pyx_mstate->__pyx_n_u_arcs, __pyx_mstate->__pyx_n_u_arc, __pyx_mstate->__pyx_n_u_dep, __pyx_mstate->__pyx_n_u_label}; + __pyx_mstate_global->__pyx_codeobj_tab[27] = __Pyx_PyCode_New(descr, varnames, __pyx_mstate->__pyx_kp_u_spacy_pipeline__parser_internals_3, __pyx_mstate->__pyx_n_u_get_beam_parses, __pyx_mstate->__pyx_kp_b_iso88591_A_A_E_at1_IT_AQ_uIQ_uAQ_t9AQ_1_q, 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), 781}; + PyObject* const varnames[] = {__pyx_mstate->__pyx_n_u_self, __pyx_mstate->__pyx_n_u_eg, __pyx_mstate->__pyx_n_u_start, __pyx_mstate->__pyx_n_u_end, __pyx_mstate->__pyx_n_u_word}; + __pyx_mstate_global->__pyx_codeobj_tab[28] = __Pyx_PyCode_New(descr, varnames, __pyx_mstate->__pyx_kp_u_spacy_pipeline__parser_internals_3, __pyx_mstate->__pyx_n_u_has_gold, __pyx_mstate->__pyx_kp_b_iso88591_HBb_q_t5_1_q_1, tuple_dedup_map); if (unlikely(!__pyx_mstate_global->__pyx_codeobj_tab[28])) goto bad; + } + { + const __Pyx_PyCode_New_function_description descr = {4, 0, 0, 7, (unsigned int)(CO_OPTIMIZED|CO_NEWLOCALS), 802}; + PyObject* const varnames[] = {__pyx_mstate->__pyx_n_u_self, __pyx_mstate->__pyx_n_u_stcls, __pyx_mstate->__pyx_n_u_gold, __pyx_mstate->__pyx_n_u_i, __pyx_mstate->__pyx_n_u_gold_2, __pyx_mstate->__pyx_n_u_gold_state, __pyx_mstate->__pyx_n_u_cost}; + __pyx_mstate_global->__pyx_codeobj_tab[29] = __Pyx_PyCode_New(descr, varnames, __pyx_mstate->__pyx_kp_u_spacy_pipeline__parser_internals_3, __pyx_mstate->__pyx_n_u_get_cost, __pyx_mstate->__pyx_kp_b_iso88591_A_4z_1F_wauA_U_4r_IQe4t2Qb_4r_IQ, tuple_dedup_map); if (unlikely(!__pyx_mstate_global->__pyx_codeobj_tab[29])) goto bad; + } + { + const __Pyx_PyCode_New_function_description descr = {4, 0, 0, 23, (unsigned int)(CO_OPTIMIZED|CO_NEWLOCALS), 835}; + PyObject* const varnames[] = {__pyx_mstate->__pyx_n_u_self, __pyx_mstate->__pyx_n_u_state, __pyx_mstate->__pyx_n_u_gold, __pyx_mstate->__pyx_n_u_debug, __pyx_mstate->__pyx_n_u_i, __pyx_mstate->__pyx_n_u_mem, __pyx_mstate->__pyx_n_u_costs, __pyx_mstate->__pyx_n_u_is_valid, __pyx_mstate->__pyx_n_u_history, __pyx_mstate->__pyx_n_u_debug_log, __pyx_mstate->__pyx_n_u_failed, __pyx_mstate->__pyx_n_u_min_cost, __pyx_mstate->__pyx_n_u_action, __pyx_mstate->__pyx_n_u_s0, __pyx_mstate->__pyx_n_u_b0, __pyx_mstate->__pyx_n_u_example, __pyx_mstate->__pyx_n_u_token, __pyx_mstate->__pyx_n_u_aligned_heads, __pyx_mstate->__pyx_n_u_aligned_labels, __pyx_mstate->__pyx_n_u_head, __pyx_mstate->__pyx_n_u_genexpr, __pyx_mstate->__pyx_n_u_genexpr, __pyx_mstate->__pyx_n_u_w}; + __pyx_mstate_global->__pyx_codeobj_tab[30] = __Pyx_PyCode_New(descr, varnames, __pyx_mstate->__pyx_kp_u_spacy_pipeline__parser_internals_3, __pyx_mstate->__pyx_n_u_get_oracle_sequence_from_state, __pyx_mstate->__pyx_kp_b_iso88591_YYZ_A_t9Ba_6_j_6_F_4z_A_d_y_Jaz, tuple_dedup_map); if (unlikely(!__pyx_mstate_global->__pyx_codeobj_tab[30])) 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[31] = __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[31])) 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[32] = __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[32])) goto bad; + } + { + const __Pyx_PyCode_New_function_description descr = {3, 0, 0, 4, (unsigned int)(CO_OPTIMIZED|CO_NEWLOCALS), 4}; + PyObject* const varnames[] = {__pyx_mstate->__pyx_n_u_pyx_type, __pyx_mstate->__pyx_n_u_pyx_checksum, __pyx_mstate->__pyx_n_u_pyx_state, __pyx_mstate->__pyx_n_u_pyx_result}; + __pyx_mstate_global->__pyx_codeobj_tab[33] = __Pyx_PyCode_New(descr, varnames, __pyx_mstate->__pyx_kp_u_stringsource, __pyx_mstate->__pyx_n_u_pyx_unpickle_Shift, __pyx_mstate->__pyx_kp_b_iso88591_q_0_kQR_5_7_q_a_1, tuple_dedup_map); if (unlikely(!__pyx_mstate_global->__pyx_codeobj_tab[33])) goto bad; + } + { + const __Pyx_PyCode_New_function_description descr = {3, 0, 0, 4, (unsigned int)(CO_OPTIMIZED|CO_NEWLOCALS), 4}; + PyObject* const varnames[] = {__pyx_mstate->__pyx_n_u_pyx_type, __pyx_mstate->__pyx_n_u_pyx_checksum, __pyx_mstate->__pyx_n_u_pyx_state, __pyx_mstate->__pyx_n_u_pyx_result}; + __pyx_mstate_global->__pyx_codeobj_tab[34] = __Pyx_PyCode_New(descr, varnames, __pyx_mstate->__pyx_kp_u_stringsource, __pyx_mstate->__pyx_n_u_pyx_unpickle_Reduce, __pyx_mstate->__pyx_kp_b_iso88591_q_0_kQR_6_7_1, tuple_dedup_map); if (unlikely(!__pyx_mstate_global->__pyx_codeobj_tab[34])) goto bad; + } + { + const __Pyx_PyCode_New_function_description descr = {3, 0, 0, 4, (unsigned int)(CO_OPTIMIZED|CO_NEWLOCALS), 4}; + PyObject* const varnames[] = {__pyx_mstate->__pyx_n_u_pyx_type, __pyx_mstate->__pyx_n_u_pyx_checksum, __pyx_mstate->__pyx_n_u_pyx_state, __pyx_mstate->__pyx_n_u_pyx_result}; + __pyx_mstate_global->__pyx_codeobj_tab[35] = __Pyx_PyCode_New(descr, varnames, __pyx_mstate->__pyx_kp_u_stringsource, __pyx_mstate->__pyx_n_u_pyx_unpickle_LeftArc, __pyx_mstate->__pyx_kp_b_iso88591_q_0_kQR_7_1_7_N_1, tuple_dedup_map); if (unlikely(!__pyx_mstate_global->__pyx_codeobj_tab[35])) goto bad; + } + { + const __Pyx_PyCode_New_function_description descr = {3, 0, 0, 4, (unsigned int)(CO_OPTIMIZED|CO_NEWLOCALS), 4}; + PyObject* const varnames[] = {__pyx_mstate->__pyx_n_u_pyx_type, __pyx_mstate->__pyx_n_u_pyx_checksum, __pyx_mstate->__pyx_n_u_pyx_state, __pyx_mstate->__pyx_n_u_pyx_result}; + __pyx_mstate_global->__pyx_codeobj_tab[36] = __Pyx_PyCode_New(descr, varnames, __pyx_mstate->__pyx_kp_u_stringsource, __pyx_mstate->__pyx_n_u_pyx_unpickle_RightArc, __pyx_mstate->__pyx_kp_b_iso88591_q_0_kQR_881A_7_nA_1, tuple_dedup_map); if (unlikely(!__pyx_mstate_global->__pyx_codeobj_tab[36])) goto bad; + } + { + const __Pyx_PyCode_New_function_description descr = {3, 0, 0, 4, (unsigned int)(CO_OPTIMIZED|CO_NEWLOCALS), 4}; + PyObject* const varnames[] = {__pyx_mstate->__pyx_n_u_pyx_type, __pyx_mstate->__pyx_n_u_pyx_checksum, __pyx_mstate->__pyx_n_u_pyx_state, __pyx_mstate->__pyx_n_u_pyx_result}; + __pyx_mstate_global->__pyx_codeobj_tab[37] = __Pyx_PyCode_New(descr, varnames, __pyx_mstate->__pyx_kp_u_stringsource, __pyx_mstate->__pyx_n_u_pyx_unpickle_Break, __pyx_mstate->__pyx_kp_b_iso88591_q_0_kQR_5_7_q_a_1, tuple_dedup_map); if (unlikely(!__pyx_mstate_global->__pyx_codeobj_tab[37])) 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) + + /* AssertionsEnabled.init */ + if (likely(__Pyx_init_assertions_enabled() == 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) + + /* Generator.init */ + if (likely(__pyx_Generator_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++) { + if (unlikely(__Pyx_PyTuple_SET_ITEM(res, i, src[i]) < (0))) { + Py_DECREF(res); + return NULL; + } + Py_INCREF(src[i]); + } + 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); +} + +/* 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; +} + +/* 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; +} + +/* 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 + +/* RaiseUnexpectedTypeError */ +static int +__Pyx_RaiseUnexpectedTypeError(const char *expected, PyObject *obj) +{ + __Pyx_TypeName obj_type_name = __Pyx_PyType_GetFullyQualifiedName(Py_TYPE(obj)); + PyErr_Format(PyExc_TypeError, "Expected %s, got " __Pyx_FMT_TYPENAME, + expected, obj_type_name); + __Pyx_DECREF_TypeName(obj_type_name); + return 0; +} + +/* 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); +} + +/* CIntToPyUnicode */ +static CYTHON_INLINE PyObject* __Pyx_uchar___Pyx_PyUnicode_From_Py_ssize_t(Py_ssize_t value, Py_ssize_t width, char padding_char) { +#ifdef __Pyx_HAS_GCC_DIAGNOSTIC +#pragma GCC diagnostic push +#pragma GCC diagnostic ignored "-Wconversion" +#endif + const Py_ssize_t neg_one = (Py_ssize_t) -1, const_zero = (Py_ssize_t) 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 & ~ (Py_ssize_t) 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_Py_ssize_t(Py_ssize_t value, Py_ssize_t width, char padding_char, char format_char) { + char digits[sizeof(Py_ssize_t)*3+2]; + char *dpos, *end = digits + sizeof(Py_ssize_t)*3+2; + const char *hex_digits = DIGITS_HEX; + Py_ssize_t length, ulength; + int prepend_sign, last_one_off; + Py_ssize_t remaining; +#ifdef __Pyx_HAS_GCC_DIAGNOSTIC +#pragma GCC diagnostic push +#pragma GCC diagnostic ignored "-Wconversion" +#endif + const Py_ssize_t neg_one = (Py_ssize_t) -1, const_zero = (Py_ssize_t) 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 = (Py_ssize_t) (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 = (Py_ssize_t) (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 = (Py_ssize_t) (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 +} + +/* GetAttr */ +static CYTHON_INLINE PyObject *__Pyx_GetAttr(PyObject *o, PyObject *n) { +#if CYTHON_USE_TYPE_SLOTS + if (likely(PyUnicode_Check(n))) + return __Pyx_PyObject_GetAttrStr(o, n); +#endif + return PyObject_GetAttr(o, n); +} + +/* GetItemInt */ +static PyObject *__Pyx_GetItemInt_Generic(PyObject *o, PyObject* j) { + PyObject *r; + if (unlikely(!j)) return NULL; + r = PyObject_GetItem(o, j); + Py_DECREF(j); + return r; +} +static CYTHON_INLINE PyObject *__Pyx_GetItemInt_List_Fast(PyObject *o, Py_ssize_t i, + int wraparound, int boundscheck, int unsafe_shared) { + CYTHON_MAYBE_UNUSED_VAR(unsafe_shared); +#if CYTHON_ASSUME_SAFE_SIZE + Py_ssize_t wrapped_i = i; + if (wraparound & unlikely(i < 0)) { + wrapped_i += PyList_GET_SIZE(o); + } + if ((CYTHON_AVOID_BORROWED_REFS || CYTHON_AVOID_THREAD_UNSAFE_BORROWED_REFS || !CYTHON_ASSUME_SAFE_MACROS)) { + return __Pyx_PyList_GetItemRefFast(o, wrapped_i, unsafe_shared); + } else + if ((!boundscheck) || likely(__Pyx_is_valid_index(wrapped_i, PyList_GET_SIZE(o)))) { + return __Pyx_NewRef(PyList_GET_ITEM(o, wrapped_i)); + } + return __Pyx_GetItemInt_Generic(o, PyLong_FromSsize_t(i)); +#else + (void)wraparound; + (void)boundscheck; + return PySequence_GetItem(o, i); +#endif +} +static CYTHON_INLINE PyObject *__Pyx_GetItemInt_Tuple_Fast(PyObject *o, Py_ssize_t i, + int wraparound, int boundscheck, int unsafe_shared) { + CYTHON_MAYBE_UNUSED_VAR(unsafe_shared); +#if CYTHON_ASSUME_SAFE_SIZE && CYTHON_ASSUME_SAFE_MACROS && !CYTHON_AVOID_BORROWED_REFS + Py_ssize_t wrapped_i = i; + if (wraparound & unlikely(i < 0)) { + wrapped_i += PyTuple_GET_SIZE(o); + } + if ((!boundscheck) || likely(__Pyx_is_valid_index(wrapped_i, PyTuple_GET_SIZE(o)))) { + return __Pyx_NewRef(PyTuple_GET_ITEM(o, wrapped_i)); + } + return __Pyx_GetItemInt_Generic(o, PyLong_FromSsize_t(i)); +#else + (void)wraparound; + (void)boundscheck; + return PySequence_GetItem(o, i); +#endif +} +static CYTHON_INLINE PyObject *__Pyx_GetItemInt_Fast(PyObject *o, Py_ssize_t i, int is_list, + int wraparound, int boundscheck, int unsafe_shared) { + CYTHON_MAYBE_UNUSED_VAR(unsafe_shared); +#if CYTHON_ASSUME_SAFE_MACROS && CYTHON_ASSUME_SAFE_SIZE + if (is_list || PyList_CheckExact(o)) { + Py_ssize_t n = ((!wraparound) | likely(i >= 0)) ? i : i + PyList_GET_SIZE(o); + if ((CYTHON_AVOID_BORROWED_REFS || CYTHON_AVOID_THREAD_UNSAFE_BORROWED_REFS)) { + return __Pyx_PyList_GetItemRefFast(o, n, unsafe_shared); + } else if ((!boundscheck) || (likely(__Pyx_is_valid_index(n, PyList_GET_SIZE(o))))) { + return __Pyx_NewRef(PyList_GET_ITEM(o, n)); + } + } else + #if !CYTHON_AVOID_BORROWED_REFS + if (PyTuple_CheckExact(o)) { + Py_ssize_t n = ((!wraparound) | likely(i >= 0)) ? i : i + PyTuple_GET_SIZE(o); + if ((!boundscheck) || likely(__Pyx_is_valid_index(n, PyTuple_GET_SIZE(o)))) { + return __Pyx_NewRef(PyTuple_GET_ITEM(o, n)); + } + } else + #endif +#endif +#if CYTHON_USE_TYPE_SLOTS && !CYTHON_COMPILING_IN_PYPY + { + PyMappingMethods *mm = Py_TYPE(o)->tp_as_mapping; + PySequenceMethods *sm = Py_TYPE(o)->tp_as_sequence; + if (!is_list && mm && mm->mp_subscript) { + PyObject *r, *key = PyLong_FromSsize_t(i); + if (unlikely(!key)) return NULL; + r = mm->mp_subscript(o, key); + Py_DECREF(key); + return r; + } + if (is_list || likely(sm && sm->sq_item)) { + if (wraparound && unlikely(i < 0) && likely(sm->sq_length)) { + Py_ssize_t l = sm->sq_length(o); + if (likely(l >= 0)) { + i += l; + } else { + if (!PyErr_ExceptionMatches(PyExc_OverflowError)) + return NULL; + PyErr_Clear(); + } + } + return sm->sq_item(o, i); + } + } +#else + if (is_list || !PyMapping_Check(o)) { + return PySequence_GetItem(o, i); + } +#endif + (void)wraparound; + (void)boundscheck; + return __Pyx_GetItemInt_Generic(o, PyLong_FromSsize_t(i)); +} + +/* ObjectGetItem */ +#if CYTHON_USE_TYPE_SLOTS +static PyObject *__Pyx_PyObject_GetIndex(PyObject *obj, PyObject *index) { + PyObject *runerr = NULL; + Py_ssize_t key_value; + key_value = __Pyx_PyIndex_AsSsize_t(index); + if (likely(key_value != -1 || !(runerr = PyErr_Occurred()))) { + return __Pyx_GetItemInt_Fast(obj, key_value, 0, 1, 1, 1); + } + if (PyErr_GivenExceptionMatches(runerr, PyExc_OverflowError)) { + __Pyx_TypeName index_type_name = __Pyx_PyType_GetFullyQualifiedName(Py_TYPE(index)); + PyErr_Clear(); + PyErr_Format(PyExc_IndexError, + "cannot fit '" __Pyx_FMT_TYPENAME "' into an index-sized integer", index_type_name); + __Pyx_DECREF_TypeName(index_type_name); + } + return NULL; +} +static PyObject *__Pyx_PyObject_GetItem_Slow(PyObject *obj, PyObject *key) { + __Pyx_TypeName obj_type_name; + if (likely(PyType_Check(obj))) { + PyObject *meth = __Pyx_PyObject_GetAttrStrNoError(obj, __pyx_mstate_global->__pyx_n_u_class_getitem); + if (!meth) { + PyErr_Clear(); + } else { + PyObject *result = __Pyx_PyObject_CallOneArg(meth, key); + Py_DECREF(meth); + return result; + } + } + obj_type_name = __Pyx_PyType_GetFullyQualifiedName(Py_TYPE(obj)); + PyErr_Format(PyExc_TypeError, + "'" __Pyx_FMT_TYPENAME "' object is not subscriptable", obj_type_name); + __Pyx_DECREF_TypeName(obj_type_name); + return NULL; +} +static PyObject *__Pyx_PyObject_GetItem(PyObject *obj, PyObject *key) { + PyTypeObject *tp = Py_TYPE(obj); + PyMappingMethods *mm = tp->tp_as_mapping; + PySequenceMethods *sm = tp->tp_as_sequence; + if (likely(mm && mm->mp_subscript)) { + return mm->mp_subscript(obj, key); + } + if (likely(sm && sm->sq_item)) { + return __Pyx_PyObject_GetIndex(obj, key); + } + return __Pyx_PyObject_GetItem_Slow(obj, key); +} +#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); + } +} + +/* DivInt[Py_ssize_t] */ +static CYTHON_INLINE Py_ssize_t __Pyx_div_Py_ssize_t(Py_ssize_t a, Py_ssize_t b, int b_is_constant) { + Py_ssize_t q = a / b; + Py_ssize_t r = a - q*b; + Py_ssize_t adapt_python = (b_is_constant ? + ((r != 0) & ((r < 0) ^ (b < 0))) : + ((r != 0) & ((r ^ b) < 0)) + ); + return q - adapt_python; +} + +/* GetAttr3 */ +#if __PYX_LIMITED_VERSION_HEX < 0x030d0000 +static PyObject *__Pyx_GetAttr3Default(PyObject *d) { + __Pyx_PyThreadState_declare + __Pyx_PyThreadState_assign + if (unlikely(!__Pyx_PyErr_ExceptionMatches(PyExc_AttributeError))) + return NULL; + __Pyx_PyErr_Clear(); + Py_INCREF(d); + return d; +} +#endif +static CYTHON_INLINE PyObject *__Pyx_GetAttr3(PyObject *o, PyObject *n, PyObject *d) { + PyObject *r; +#if __PYX_LIMITED_VERSION_HEX >= 0x030d0000 + int res = PyObject_GetOptionalAttr(o, n, &r); + return (res != 0) ? r : __Pyx_NewRef(d); +#else + #if CYTHON_USE_TYPE_SLOTS + if (likely(PyUnicode_Check(n))) { + r = __Pyx_PyObject_GetAttrStrNoError(o, n); + if (unlikely(!r) && likely(!PyErr_Occurred())) { + r = __Pyx_NewRef(d); + } + return r; + } + #endif + r = PyObject_GetAttr(o, n); + return (likely(r)) ? r : __Pyx_GetAttr3Default(d); +#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); +} + +/* RaiseTooManyValuesToUnpack */ +static CYTHON_INLINE void __Pyx_RaiseTooManyValuesError(Py_ssize_t expected) { + PyErr_Format(PyExc_ValueError, + "too many values to unpack (expected %" CYTHON_FORMAT_SSIZE_T "d)", expected); +} + +/* RaiseNeedMoreValuesToUnpack */ +static CYTHON_INLINE void __Pyx_RaiseNeedMoreValuesError(Py_ssize_t index) { + PyErr_Format(PyExc_ValueError, + "need more than %" CYTHON_FORMAT_SSIZE_T "d value%.1s to unpack", + index, (index == 1) ? "" : "s"); +} + +/* RaiseNoneIterError */ +static CYTHON_INLINE void __Pyx_RaiseNoneNotIterableError(void) { + PyErr_SetString(PyExc_TypeError, "'NoneType' object is not iterable"); +} + +/* ExtTypeTest */ +static CYTHON_INLINE int __Pyx_TypeTest(PyObject *obj, PyTypeObject *type) { + __Pyx_TypeName obj_type_name; + __Pyx_TypeName type_name; + if (unlikely(!type)) { + PyErr_SetString(PyExc_SystemError, "Missing type object"); + return 0; + } + if (likely(__Pyx_TypeCheck(obj, type))) + return 1; + obj_type_name = __Pyx_PyType_GetFullyQualifiedName(Py_TYPE(obj)); + type_name = __Pyx_PyType_GetFullyQualifiedName(type); + PyErr_Format(PyExc_TypeError, + "Cannot convert " __Pyx_FMT_TYPENAME " to " __Pyx_FMT_TYPENAME, + obj_type_name, type_name); + __Pyx_DECREF_TypeName(obj_type_name); + __Pyx_DECREF_TypeName(type_name); + return 0; +} + +/* 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 + +/* 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); +} + +/* 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; itp_as_sequence && type->tp_as_sequence->sq_repeat)) { + return type->tp_as_sequence->sq_repeat(seq, mul); + } else +#endif + { + return __Pyx_PySequence_Multiply_Generic(seq, mul); + } +} + +/* PyObjectFormatAndDecref */ +static CYTHON_INLINE PyObject* __Pyx_PyObject_FormatSimpleAndDecref(PyObject* s, PyObject* f) { + if (unlikely(!s)) return NULL; + if (likely(PyUnicode_CheckExact(s))) return s; + return __Pyx_PyObject_FormatAndDecref(s, f); +} +static CYTHON_INLINE PyObject* __Pyx_PyObject_FormatAndDecref(PyObject* s, PyObject* f) { + PyObject *result; + if (unlikely(!s)) return NULL; + result = PyObject_Format(s, f); + Py_DECREF(s); + return result; +} + +/* PyObjectFormat */ +#if CYTHON_USE_UNICODE_WRITER +static PyObject* __Pyx_PyObject_Format(PyObject* obj, PyObject* format_spec) { + int ret; + _PyUnicodeWriter writer; + if (likely(PyFloat_CheckExact(obj))) { + _PyUnicodeWriter_Init(&writer); + ret = _PyFloat_FormatAdvancedWriter( + &writer, + obj, + format_spec, 0, PyUnicode_GET_LENGTH(format_spec)); + } else if (likely(PyLong_CheckExact(obj))) { + _PyUnicodeWriter_Init(&writer); + ret = _PyLong_FormatAdvancedWriter( + &writer, + obj, + format_spec, 0, PyUnicode_GET_LENGTH(format_spec)); + } else { + return PyObject_Format(obj, format_spec); + } + if (unlikely(ret == -1)) { + _PyUnicodeWriter_Dealloc(&writer); + return NULL; + } + return _PyUnicodeWriter_Finish(&writer); +} +#endif + +/* SetItemInt */ +static int __Pyx_SetItemInt_Generic(PyObject *o, PyObject *j, PyObject *v) { + int r; + if (unlikely(!j)) return -1; + r = PyObject_SetItem(o, j, v); + Py_DECREF(j); + return r; +} +static CYTHON_INLINE int __Pyx_SetItemInt_Fast(PyObject *o, Py_ssize_t i, PyObject *v, int is_list, + int wraparound, int boundscheck, int unsafe_shared) { + CYTHON_MAYBE_UNUSED_VAR(unsafe_shared); +#if CYTHON_ASSUME_SAFE_MACROS && CYTHON_ASSUME_SAFE_SIZE && !CYTHON_AVOID_BORROWED_REFS + if (is_list || PyList_CheckExact(o)) { + Py_ssize_t n = (!wraparound) ? i : ((likely(i >= 0)) ? i : i + PyList_GET_SIZE(o)); + if ((CYTHON_AVOID_THREAD_UNSAFE_BORROWED_REFS && !__Pyx_IS_UNIQUELY_REFERENCED(o, unsafe_shared))) { + Py_INCREF(v); + return PyList_SetItem(o, n, v); + } else if ((!boundscheck) || likely(__Pyx_is_valid_index(n, PyList_GET_SIZE(o)))) { + PyObject* old; + Py_INCREF(v); + old = PyList_GET_ITEM(o, n); + PyList_SET_ITEM(o, n, v); + Py_DECREF(old); + return 0; + } + } else +#endif +#if CYTHON_USE_TYPE_SLOTS && !CYTHON_COMPILING_IN_PYPY + { + PyMappingMethods *mm = Py_TYPE(o)->tp_as_mapping; + PySequenceMethods *sm = Py_TYPE(o)->tp_as_sequence; + if (!is_list && mm && mm->mp_ass_subscript) { + int r; + PyObject *key = PyLong_FromSsize_t(i); + if (unlikely(!key)) return -1; + r = mm->mp_ass_subscript(o, key, v); + Py_DECREF(key); + return r; + } + if (is_list || likely(sm && sm->sq_ass_item)) { + if (wraparound && unlikely(i < 0) && likely(sm->sq_length)) { + Py_ssize_t l = sm->sq_length(o); + if (likely(l >= 0)) { + i += l; + } else { + if (!PyErr_ExceptionMatches(PyExc_OverflowError)) + return -1; + PyErr_Clear(); + } + } + return sm->sq_ass_item(o, i, v); + } + } +#else + if (is_list || !PyMapping_Check(o)) { + return PySequence_SetItem(o, i, v); + } +#endif + (void)wraparound; + (void)boundscheck; + return __Pyx_SetItemInt_Generic(o, PyLong_FromSsize_t(i), v); +} + +/* RaiseUnboundLocalError */ +static void __Pyx_RaiseUnboundLocalError(const char *varname) { + PyErr_Format(PyExc_UnboundLocalError, "local variable '%s' referenced before assignment", varname); +} + +/* DivInt[long] */ +static CYTHON_INLINE long __Pyx_div_long(long a, long b, int b_is_constant) { + long q = a / b; + long r = a - q*b; + long adapt_python = (b_is_constant ? + ((r != 0) & ((r < 0) ^ (b < 0))) : + ((r != 0) & ((r ^ b) < 0)) + ); + return q - adapt_python; +} + +/* tp_new */ +#if CYTHON_COMPILING_IN_LIMITED_API && __PYX_LIMITED_VERSION_HEX < 0x030A0000 +static PyObject* __Pyx_tp_new_fallback(PyObject* type_obj, PyObject* args, PyObject* kwargs) { + PyObject *new_func = NULL, *new_args = NULL, *obj; + Py_ssize_t i, nargs = PyTuple_Size(args); + if (unlikely(nargs < 0)) goto bad; + new_args = PyTuple_New(nargs + 1); + if (unlikely(!new_args)) goto bad; + for (i = 0; i < nargs + 1; i++) { + PyObject *item = (i == 0) ? type_obj : PyTuple_GetItem(args, i - 1); + if (unlikely(!item)) goto bad; + Py_INCREF(item); + if (unlikely(PyTuple_SetItem(new_args, i, item)) < 0) goto bad; + } + new_func = PyObject_GetAttrString(type_obj, "__new__"); + if (unlikely(!new_func)) goto bad; + obj = PyObject_Call(new_func, new_args, kwargs); + Py_DECREF(new_func); + Py_DECREF(new_args); + return obj; + bad: + Py_XDECREF(new_func); + Py_XDECREF(new_args); + return NULL; +} +#endif +static PyObject* __Pyx_tp_new_kwargs(PyObject* type_obj, PyObject* args, PyObject* kwargs) { + newfunc tp_new = __Pyx_PyType_TryGetSlot((PyTypeObject*)type_obj, tp_new, newfunc); +#if CYTHON_COMPILING_IN_LIMITED_API && __PYX_LIMITED_VERSION_HEX < 0x030A0000 + if (!tp_new) return __Pyx_tp_new_fallback(type_obj, args, kwargs); +#else + assert(tp_new != NULL); +#endif + return tp_new((PyTypeObject*)type_obj, args, kwargs); +} + +/* 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); +} + +/* 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; + if (__Pyx_PyTuple_SET_ITEM(builder, n, key) != (0)) return -1; + Py_INCREF(key); + 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 + +/* 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 + +/* IterFinish */ +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; +} + +/* UnpackItemEndCheck */ +static int __Pyx_IternextUnpackEndCheck(PyObject *retval, Py_ssize_t expected) { + if (unlikely(retval)) { + Py_DECREF(retval); + __Pyx_RaiseTooManyValuesError(expected); + return -1; + } + return __Pyx_IterFinish(); +} + +/* RaiseClosureNameError */ +static void __Pyx_RaiseClosureNameError(const char *varname) { + PyErr_Format(PyExc_NameError, "free variable '%s' referenced before assignment in enclosing scope", varname); +} + +/* PyObjectCallNoArg (used by pyfrozenset_new) */ +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); +} + +/* 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)); +} + +/* SliceObject */ +static CYTHON_INLINE PyObject* __Pyx_PyObject_GetSlice(PyObject* obj, + Py_ssize_t cstart, Py_ssize_t cstop, + PyObject** _py_start, PyObject** _py_stop, PyObject** _py_slice, + int has_cstart, int has_cstop, CYTHON_UNUSED int wraparound) { + __Pyx_TypeName obj_type_name; +#if CYTHON_USE_TYPE_SLOTS + PyMappingMethods* mp = Py_TYPE(obj)->tp_as_mapping; + if (likely(mp && mp->mp_subscript)) +#endif + { + PyObject* result; + PyObject *py_slice, *py_start, *py_stop; + if (_py_slice) { + py_slice = *_py_slice; + } else { + PyObject* owned_start = NULL; + PyObject* owned_stop = NULL; + if (_py_start) { + py_start = *_py_start; + } else { + if (has_cstart) { + owned_start = py_start = PyLong_FromSsize_t(cstart); + if (unlikely(!py_start)) goto bad; + } else + py_start = Py_None; + } + if (_py_stop) { + py_stop = *_py_stop; + } else { + if (has_cstop) { + owned_stop = py_stop = PyLong_FromSsize_t(cstop); + if (unlikely(!py_stop)) { + Py_XDECREF(owned_start); + goto bad; + } + } else + py_stop = Py_None; + } + py_slice = PySlice_New(py_start, py_stop, Py_None); + Py_XDECREF(owned_start); + Py_XDECREF(owned_stop); + if (unlikely(!py_slice)) goto bad; + } +#if CYTHON_USE_TYPE_SLOTS + result = mp->mp_subscript(obj, py_slice); +#else + result = PyObject_GetItem(obj, py_slice); +#endif + if (!_py_slice) { + Py_DECREF(py_slice); + } + return result; + } + obj_type_name = __Pyx_PyType_GetFullyQualifiedName(Py_TYPE(obj)); + PyErr_Format(PyExc_TypeError, + "'" __Pyx_FMT_TYPENAME "' object is unsliceable", obj_type_name); + __Pyx_DECREF_TypeName(obj_type_name); +bad: + return NULL; +} + +/* PyObjectCall2Args (used by CallUnboundCMethod1) */ +static CYTHON_INLINE PyObject* __Pyx_PyObject_Call2Args(PyObject* function, PyObject* arg1, PyObject* arg2) { + PyObject *args[3] = {NULL, arg1, arg2}; + return __Pyx_PyObject_FastCall(function, args+1, 2 | __Pyx_PY_VECTORCALL_ARGUMENTS_OFFSET); +} + +/* CallUnboundCMethod1 */ +#if CYTHON_COMPILING_IN_CPYTHON +static CYTHON_INLINE PyObject* __Pyx_CallUnboundCMethod1(__Pyx_CachedCFunction* cfunc, PyObject* self, PyObject* arg) { + int was_initialized = __Pyx_CachedCFunction_GetAndSetInitializing(cfunc); + if (likely(was_initialized == 2 && cfunc->func)) { + int flag = cfunc->flag; + if (flag == METH_O) { + return __Pyx_CallCFunction(cfunc, self, arg); + } else if (flag == METH_FASTCALL) { + return __Pyx_CallCFunctionFast(cfunc, self, &arg, 1); + } else if (flag == (METH_FASTCALL | METH_KEYWORDS)) { + return __Pyx_CallCFunctionFastWithKeywords(cfunc, self, &arg, 1, 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__CallUnboundCMethod1(&tmp_cfunc, self, arg); + } +#endif + PyObject* result = __Pyx__CallUnboundCMethod1(cfunc, self, arg); + __Pyx_CachedCFunction_SetFinishedInitializing(cfunc); + return result; +} +#endif +static PyObject* __Pyx__CallUnboundCMethod1(__Pyx_CachedCFunction* cfunc, PyObject* self, PyObject* arg){ + PyObject *result = NULL; + if (unlikely(!cfunc->func && !cfunc->method) && unlikely(__Pyx_TryUnpackUnboundCMethod(cfunc) < 0)) return NULL; +#if CYTHON_COMPILING_IN_CPYTHON + if (cfunc->func && (cfunc->flag & METH_VARARGS)) { + PyObject *args = PyTuple_New(1); + if (unlikely(!args)) return NULL; + Py_INCREF(arg); + PyTuple_SET_ITEM(args, 0, arg); + if (cfunc->flag & METH_KEYWORDS) + result = __Pyx_CallCFunctionWithKeywords(cfunc, self, args, NULL); + else + result = __Pyx_CallCFunction(cfunc, self, args); + Py_DECREF(args); + } else +#endif + { + result = __Pyx_PyObject_Call2Args(cfunc->method, self, arg); + } + return result; +} + +/* KeywordStringCheck */ +static int __Pyx_CheckKeywordStrings( + const char* function_name, + PyObject *kw) +{ +#if CYTHON_COMPILING_IN_PYPY && !defined(PyArg_ValidateKeywordArguments) + CYTHON_UNUSED_VAR(function_name); + CYTHON_UNUSED_VAR(kw); + return 0; +#else + if (CYTHON_METH_FASTCALL && likely(PyTuple_Check(kw))) { +#if PY_VERSION_HEX >= 0x03090000 + CYTHON_UNUSED_VAR(function_name); +#else + Py_ssize_t kwsize; + #if CYTHON_ASSUME_SAFE_SIZE + kwsize = PyTuple_GET_SIZE(kw); + #else + kwsize = PyTuple_Size(kw); + if (unlikely(kwsize < 0)) return -1; + #endif + for (Py_ssize_t pos = 0; pos < kwsize; pos++) { + PyObject* key = NULL; + #if CYTHON_ASSUME_SAFE_MACROS + key = PyTuple_GET_ITEM(kw, pos); + #else + key = PyTuple_GetItem(kw, pos); + if (unlikely(!key)) return -1; + #endif + if (unlikely(!PyUnicode_Check(key))) { + PyErr_Format(PyExc_TypeError, + "%.200s() keywords must be strings", function_name); + return -1; + } + } +#endif + } else { + if (unlikely(!PyArg_ValidateKeywordArguments(kw))) return -1; + } + return 0; +#endif +} + +/* dict_getitem_default */ +static PyObject* __Pyx_PyDict_GetItemDefault(PyObject* d, PyObject* key, PyObject* default_value) { + PyObject* value; +#if !CYTHON_COMPILING_IN_PYPY || PYPY_VERSION_NUM >= 0x07020000 + value = PyDict_GetItemWithError(d, key); + if (unlikely(!value)) { + if (unlikely(PyErr_Occurred())) + return NULL; + value = default_value; + } + Py_INCREF(value); + if ((1)); +#else + if (PyBytes_CheckExact(key) || PyUnicode_CheckExact(key) || PyLong_CheckExact(key)) { + value = PyDict_GetItem(d, key); + if (unlikely(!value)) { + value = default_value; + } + Py_INCREF(value); + } +#endif + else { + if (default_value == Py_None) + value = __Pyx_CallUnboundCMethod1(&__pyx_mstate_global->__pyx_umethod_PyDict_Type_get, d, key); + else + value = __Pyx_CallUnboundCMethod2(&__pyx_mstate_global->__pyx_umethod_PyDict_Type_get, d, key, default_value); + } + return value; +} + +/* dict_setdefault (used by FetchCommonType) */ +static CYTHON_INLINE PyObject *__Pyx_PyDict_SetDefault(PyObject *d, PyObject *key, PyObject *default_value) { + PyObject* value; +#if 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); +#elif PY_VERSION_HEX >= 0x030d0000 + PyDict_SetDefaultRef(d, key, default_value, &value); +#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_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(marker); + 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}, + {"_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 !CYTHON_COMPILING_IN_LIMITED_API +#if PY_VERSION_HEX < 0x030900B1 + Py_CLEAR(__Pyx_CyFunction_GetClassObj(m)); +#else + { + PyObject *cls = (PyObject*) ((PyCMethodObject *) (m))->mm_class; + ((PyCMethodObject *) (m))->mm_class = NULL; + Py_XDECREF(cls); + } +#endif +#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); +#if !CYTHON_COMPILING_IN_LIMITED_API + Py_VISIT(__Pyx_CyFunction_GetClassObj(m)); +#endif + Py_VISIT(m->defaults_tuple); + Py_VISIT(m->defaults_kwdict); + 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; +} + +/* 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 + +/* PyLongCompare */ +static CYTHON_INLINE int __Pyx_PyLong_BoolNeObjC(PyObject *op1, PyObject *op2, long intval, long inplace) { + CYTHON_MAYBE_UNUSED_VAR(intval); + CYTHON_UNUSED_VAR(inplace); + if (op1 == op2) { + return 0; + } + #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 1; + intval = -intval; + } else { + if (__Pyx_PyLong_IsNeg(op1)) + return 1; + } + 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_NE)); +} + +/* CallNextTpDealloc */ +static void __Pyx_call_next_tp_dealloc(PyObject* obj, destructor current_tp_dealloc) { + PyTypeObject* type = Py_TYPE(obj); + destructor tp_dealloc = NULL; + while (type && __Pyx_PyType_GetSlot(type, tp_dealloc, destructor) != current_tp_dealloc) + type = __Pyx_PyType_GetSlot(type, tp_base, PyTypeObject*); + while (type && (tp_dealloc = __Pyx_PyType_GetSlot(type, tp_dealloc, destructor)) == current_tp_dealloc) + type = __Pyx_PyType_GetSlot(type, tp_base, PyTypeObject*); + if (type) + tp_dealloc(obj); +} + +/* CallNextTpTraverse */ +static int __Pyx_call_next_tp_traverse(PyObject* obj, visitproc v, void *a, traverseproc current_tp_traverse) { + PyTypeObject* type = Py_TYPE(obj); + traverseproc tp_traverse = NULL; + while (type && __Pyx_PyType_GetSlot(type, tp_traverse, traverseproc) != current_tp_traverse) + type = __Pyx_PyType_GetSlot(type, tp_base, PyTypeObject*); + while (type && (tp_traverse = __Pyx_PyType_GetSlot(type, tp_traverse, traverseproc)) == current_tp_traverse) + type = __Pyx_PyType_GetSlot(type, tp_base, PyTypeObject*); + if (type && tp_traverse) + return tp_traverse(obj, v, a); + return 0; +} + +/* CallNextTpClear */ +static void __Pyx_call_next_tp_clear(PyObject* obj, inquiry current_tp_clear) { + PyTypeObject* type = Py_TYPE(obj); + inquiry tp_clear = NULL; + while (type && __Pyx_PyType_GetSlot(type, tp_clear, inquiry) != current_tp_clear) + type = __Pyx_PyType_GetSlot(type, tp_base, PyTypeObject*); + while (type && (tp_clear = __Pyx_PyType_GetSlot(type, tp_clear, inquiry)) == current_tp_clear) + type = __Pyx_PyType_GetSlot(type, tp_base, PyTypeObject*); + if (type && tp_clear) + tp_clear(obj); +} + +/* 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); + } +} + +/* TypeImport */ +#ifndef __PYX_HAVE_RT_ImportType_3_2_1 +#define __PYX_HAVE_RT_ImportType_3_2_1 +static PyTypeObject *__Pyx_ImportType_3_2_1(PyObject *module, const char *module_name, const char *class_name, + size_t size, size_t alignment, enum __Pyx_ImportType_CheckSize_3_2_1 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_1 && + ((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_1 && (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 + +/* GetVTable */ +static void* __Pyx_GetVtable(PyTypeObject *type) { + void* ptr; +#if CYTHON_COMPILING_IN_LIMITED_API + PyObject *ob = PyObject_GetAttr((PyObject *)type, __pyx_mstate_global->__pyx_n_u_pyx_vtable); +#else + PyObject *ob = PyObject_GetItem(type->tp_dict, __pyx_mstate_global->__pyx_n_u_pyx_vtable); +#endif + if (!ob) + goto bad; + ptr = PyCapsule_GetPointer(ob, 0); + if (!ptr && !PyErr_Occurred()) + PyErr_SetString(PyExc_RuntimeError, "invalid vtable found for imported type"); + Py_DECREF(ob); + return ptr; +bad: + Py_XDECREF(ob); + return NULL; +} + +/* 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 +} + +/* SetVTable */ +static int __Pyx_SetVtable(PyTypeObject *type, void *vtable) { + PyObject *ob = PyCapsule_New(vtable, 0, 0); + if (unlikely(!ob)) + goto bad; +#if CYTHON_COMPILING_IN_LIMITED_API + if (unlikely(PyObject_SetAttr((PyObject *) type, __pyx_mstate_global->__pyx_n_u_pyx_vtable, ob) < 0)) +#else + if (unlikely(PyDict_SetItem(type->tp_dict, __pyx_mstate_global->__pyx_n_u_pyx_vtable, ob) < 0)) +#endif + goto bad; + Py_DECREF(ob); + return 0; +bad: + Py_XDECREF(ob); + return -1; +} + +/* MergeVTables */ +static int __Pyx_MergeVtables(PyTypeObject *type) { + int i=0; + Py_ssize_t size; + void** base_vtables; + __Pyx_TypeName tp_base_name = NULL; + __Pyx_TypeName base_name = NULL; + void* unknown = (void*)-1; + PyObject* bases = __Pyx_PyType_GetSlot(type, tp_bases, PyObject*); + int base_depth = 0; + { + PyTypeObject* base = __Pyx_PyType_GetSlot(type, tp_base, PyTypeObject*); + while (base) { + base_depth += 1; + base = __Pyx_PyType_GetSlot(base, tp_base, PyTypeObject*); + } + } + base_vtables = (void**) PyMem_Malloc(sizeof(void*) * (size_t)(base_depth + 1)); + base_vtables[0] = unknown; +#if CYTHON_COMPILING_IN_LIMITED_API + size = PyTuple_Size(bases); + if (size < 0) goto other_failure; +#else + size = PyTuple_GET_SIZE(bases); +#endif + for (i = 1; i < size; i++) { + PyObject *basei; + void* base_vtable; +#if CYTHON_AVOID_BORROWED_REFS + basei = PySequence_GetItem(bases, i); + if (unlikely(!basei)) goto other_failure; +#elif !CYTHON_ASSUME_SAFE_MACROS + basei = PyTuple_GetItem(bases, i); + if (unlikely(!basei)) goto other_failure; +#else + basei = PyTuple_GET_ITEM(bases, i); +#endif + base_vtable = __Pyx_GetVtable((PyTypeObject*)basei); +#if CYTHON_AVOID_BORROWED_REFS + Py_DECREF(basei); +#endif + if (base_vtable != NULL) { + int j; + PyTypeObject* base = __Pyx_PyType_GetSlot(type, tp_base, PyTypeObject*); + for (j = 0; j < base_depth; j++) { + if (base_vtables[j] == unknown) { + base_vtables[j] = __Pyx_GetVtable(base); + base_vtables[j + 1] = unknown; + } + if (base_vtables[j] == base_vtable) { + break; + } else if (base_vtables[j] == NULL) { + goto bad; + } + base = __Pyx_PyType_GetSlot(base, tp_base, PyTypeObject*); + } + } + } + PyErr_Clear(); + PyMem_Free(base_vtables); + return 0; +bad: + { + PyTypeObject* basei = NULL; + PyTypeObject* tp_base = __Pyx_PyType_GetSlot(type, tp_base, PyTypeObject*); + tp_base_name = __Pyx_PyType_GetFullyQualifiedName(tp_base); +#if CYTHON_AVOID_BORROWED_REFS + basei = (PyTypeObject*)PySequence_GetItem(bases, i); + if (unlikely(!basei)) goto really_bad; +#elif !CYTHON_ASSUME_SAFE_MACROS + basei = (PyTypeObject*)PyTuple_GetItem(bases, i); + if (unlikely(!basei)) goto really_bad; +#else + basei = (PyTypeObject*)PyTuple_GET_ITEM(bases, i); +#endif + base_name = __Pyx_PyType_GetFullyQualifiedName(basei); +#if CYTHON_AVOID_BORROWED_REFS + Py_DECREF(basei); +#endif + } + PyErr_Format(PyExc_TypeError, + "multiple bases have vtable conflict: '" __Pyx_FMT_TYPENAME "' and '" __Pyx_FMT_TYPENAME "'", tp_base_name, base_name); +#if CYTHON_AVOID_BORROWED_REFS || !CYTHON_ASSUME_SAFE_MACROS +really_bad: // bad has failed! +#endif + __Pyx_DECREF_TypeName(tp_base_name); + __Pyx_DECREF_TypeName(base_name); +#if CYTHON_COMPILING_IN_LIMITED_API || CYTHON_AVOID_BORROWED_REFS || !CYTHON_ASSUME_SAFE_MACROS +other_failure: +#endif + PyMem_Free(base_vtables); + return -1; +} + +/* 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_2); + if (likely(name_attr)) { + ret = PyObject_RichCompareBool(name_attr, name, Py_EQ); + } else { + ret = -1; + } + if (unlikely(ret < 0)) { + PyErr_Clear(); + ret = 0; + } + Py_XDECREF(name_attr); + return ret; +} +static int __Pyx_setup_reduce(PyObject* type_obj) { + int ret = 0; + PyObject *object_reduce = NULL; + PyObject *object_getstate = NULL; + PyObject *object_reduce_ex = NULL; + PyObject *reduce = NULL; + PyObject *reduce_ex = NULL; + PyObject *reduce_cython = NULL; + PyObject *setstate = NULL; + PyObject *setstate_cython = NULL; + PyObject *getstate = NULL; +#if CYTHON_USE_PYTYPE_LOOKUP + getstate = _PyType_Lookup((PyTypeObject*)type_obj, __pyx_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 VoidPtrImport) */ +#ifndef __PYX_HAVE_RT_ImportFromPxd_3_2_1 +#define __PYX_HAVE_RT_ImportFromPxd_3_2_1 +static int __Pyx_ImportFromPxd_3_2_1(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 + +/* VoidPtrImport */ +#ifndef __PYX_HAVE_RT_ImportVoidPtr_3_2_1 +#define __PYX_HAVE_RT_ImportVoidPtr_3_2_1 +static int __Pyx_ImportVoidPtr_3_2_1(PyObject *module, const char *name, void **p, const char *sig) { + return __Pyx_ImportFromPxd_3_2_1(module, name, p, sig, "variable"); +} +#endif + +/* FunctionImport */ +#ifndef __PYX_HAVE_RT_ImportFunction_3_2_1 +#define __PYX_HAVE_RT_ImportFunction_3_2_1 +static int __Pyx_ImportFunction_3_2_1(PyObject *module, const char *funcname, void (**f)(void), const char *sig) { + union { + void (*fp)(void); + void *p; + } tmp; + int result = __Pyx_ImportFromPxd_3_2_1(module, funcname, &tmp.p, sig, "function"); + if (result == 0) { + *f = tmp.fp; + } + return result; +} +#endif + +/* 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__2); + 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; +} + +/* ClassMethod */ +static PyObject* __Pyx_Method_ClassMethod(PyObject *method) { +#if CYTHON_COMPILING_IN_PYPY && PYPY_VERSION_NUM <= 0x05080000 + if (PyObject_TypeCheck(method, &PyWrapperDescr_Type)) { + return PyClassMethod_New(method); + } +#else +#if CYTHON_COMPILING_IN_PYPY + if (PyMethodDescr_Check(method)) +#else + if (__Pyx_TypeCheck(method, &PyMethodDescr_Type)) +#endif + { +#if CYTHON_COMPILING_IN_LIMITED_API + return PyErr_Format( + PyExc_SystemError, + "Cython cannot yet handle classmethod on a MethodDescriptorType (%S) in limited API mode. " + "This is most likely a classmethod in a cdef class method with binding=False. " + "Try setting 'binding' to True.", + method); +#elif CYTHON_COMPILING_IN_GRAAL && defined(GRAALPY_VERSION_NUM) && GRAALPY_VERSION_NUM > 0x19000000 + PyTypeObject *d_type = GraalPyDescrObject_GetType(method); + return PyDescr_NewClassMethod(d_type, GraalPyMethodDescrObject_GetMethod(method)); +#elif CYTHON_COMPILING_IN_GRAAL + PyTypeObject *d_type = PyDescrObject_GetType(method); + return PyDescr_NewClassMethod(d_type, PyMethodDescrObject_GetMethod(method)); +#else + PyMethodDescrObject *descr = (PyMethodDescrObject *)method; + PyTypeObject *d_type = descr->d_common.d_type; + return PyDescr_NewClassMethod(d_type, descr->d_method); +#endif + } +#endif +#if !CYTHON_COMPILING_IN_LIMITED_API + else if (PyMethod_Check(method)) { + return PyClassMethod_New(PyMethod_GET_FUNCTION(method)); + } + else { + return PyClassMethod_New(method); + } +#else + { + PyObject *func=NULL; + PyObject *builtins, *classmethod, *classmethod_str, *result=NULL; + if (__Pyx_TypeCheck(method, __pyx_mstate_global->__Pyx_CachedMethodType)) { + func = PyObject_GetAttrString(method, "__func__"); + if (!func) goto bad; + } else { + func = method; + Py_INCREF(func); + } + builtins = PyEval_GetBuiltins(); // borrowed + if (unlikely(!builtins)) goto bad; + classmethod_str = PyUnicode_FromString("classmethod"); + if (unlikely(!classmethod_str)) goto bad; + classmethod = PyObject_GetItem(builtins, classmethod_str); + Py_DECREF(classmethod_str); + if (unlikely(!classmethod)) goto bad; + result = PyObject_CallFunctionObjArgs(classmethod, func, NULL); + Py_DECREF(classmethod); + bad: + Py_XDECREF(func); + return result; + } +#endif +} + +/* GetNameInClass */ +static PyObject *__Pyx__GetNameInClass(PyObject *nmspace, PyObject *name) { + PyObject *result; + PyObject *dict; + assert(PyType_Check(nmspace)); +#if CYTHON_USE_TYPE_SLOTS + dict = ((PyTypeObject*)nmspace)->tp_dict; + Py_XINCREF(dict); +#else + dict = PyObject_GetAttr(nmspace, __pyx_mstate_global->__pyx_n_u_dict); +#endif + if (likely(dict)) { + result = PyObject_GetItem(dict, name); + Py_DECREF(dict); + if (result) { + return result; + } + } + PyErr_Clear(); + __Pyx_GetModuleGlobalNameUncached(result, name); + return result; +} + +/* 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 + +/* CheckUnpickleChecksum */ +static void __Pyx_RaiseUnpickleChecksumError(long checksum, long checksum1, long checksum2, long checksum3, const char *members) { + PyObject *pickle_module = PyImport_ImportModule("pickle"); + if (unlikely(!pickle_module)) return; + PyObject *pickle_error = PyObject_GetAttrString(pickle_module, "PickleError"); + Py_DECREF(pickle_module); + if (unlikely(!pickle_error)) return; + if (checksum2 == checksum1) { + PyErr_Format(pickle_error, "Incompatible checksums (0x%x vs (0x%x) = (%s))", + checksum, checksum1, members); + } else if (checksum3 == checksum2) { + PyErr_Format(pickle_error, "Incompatible checksums (0x%x vs (0x%x, 0x%x) = (%s))", + checksum, checksum1, checksum2, members); + } else { + PyErr_Format(pickle_error, "Incompatible checksums (0x%x vs (0x%x, 0x%x, 0x%x) = (%s))", + checksum, checksum1, checksum2, checksum3, members); + } + Py_DECREF(pickle_error); +} +static int __Pyx_CheckUnpickleChecksum(long checksum, long checksum1, long checksum2, long checksum3, const char *members) { + int found = 0; + found |= checksum1 == checksum; + found |= checksum2 == checksum; + found |= checksum3 == checksum; + if (likely(found)) + return 0; + __Pyx_RaiseUnpickleChecksumError(checksum, checksum1, checksum2, checksum3, members); + return -1; +} + +/* 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;\ + } + +static PyObject* __pyx_convert__to_py_struct____pyx_t_5spacy_8pipeline_17_parser_internals_6_state_ArcC(struct __pyx_t_5spacy_8pipeline_17_parser_internals_6_state_ArcC s) { + PyObject* res; + PyObject* member; + res = __Pyx_PyDict_NewPresized(3); if (unlikely(!res)) return NULL; + member = __Pyx_PyLong_From_int(s.head); if (unlikely(!member)) goto bad; + if (unlikely(PyDict_SetItem(res, __pyx_mstate_global->__pyx_n_u_head, member) < 0)) goto bad; + Py_DECREF(member); + member = __Pyx_PyLong_From_int(s.child); if (unlikely(!member)) goto bad; + if (unlikely(PyDict_SetItem(res, __pyx_mstate_global->__pyx_n_u_child, member) < 0)) goto bad; + Py_DECREF(member); + member = __Pyx_PyLong_From_uint64_t(s.label); if (unlikely(!member)) goto bad; + if (unlikely(PyDict_SetItem(res, __pyx_mstate_global->__pyx_n_u_label, member) < 0)) goto bad; + Py_DECREF(member); + return res; + bad: + Py_XDECREF(member); + Py_DECREF(res); + return NULL; +} +/* Print */ +static int __Pyx_Print(PyObject* stream, PyObject *arg_tuple, int newline) { + PyObject* kwargs = 0; + PyObject* result = 0; + PyObject* end_string; + if (unlikely(!__pyx_mstate_global->__pyx_print)) { + __pyx_mstate_global->__pyx_print = PyObject_GetAttr(__pyx_mstate_global->__pyx_b, __pyx_mstate_global->__pyx_n_u_print); + if (!__pyx_mstate_global->__pyx_print) + return -1; + } + if (stream) { + kwargs = PyDict_New(); + if (unlikely(!kwargs)) + return -1; + if (unlikely(PyDict_SetItem(kwargs, __pyx_mstate_global->__pyx_n_u_file, stream) < 0)) + goto bad; + if (!newline) { + end_string = PyUnicode_FromStringAndSize(" ", 1); + if (unlikely(!end_string)) + goto bad; + if (PyDict_SetItem(kwargs, __pyx_mstate_global->__pyx_n_u_end, end_string) < 0) { + Py_DECREF(end_string); + goto bad; + } + Py_DECREF(end_string); + } + } else if (!newline) { + if (unlikely(!__pyx_mstate_global->__pyx_print_kwargs)) { + __pyx_mstate_global->__pyx_print_kwargs = PyDict_New(); + if (unlikely(!__pyx_mstate_global->__pyx_print_kwargs)) + return -1; + end_string = PyUnicode_FromStringAndSize(" ", 1); + if (unlikely(!end_string)) + return -1; + if (PyDict_SetItem(__pyx_mstate_global->__pyx_print_kwargs, __pyx_mstate_global->__pyx_n_u_end, end_string) < 0) { + Py_DECREF(end_string); + return -1; + } + Py_DECREF(end_string); + } + kwargs = __pyx_mstate_global->__pyx_print_kwargs; + } + result = PyObject_Call(__pyx_mstate_global->__pyx_print, arg_tuple, kwargs); + if (unlikely(kwargs) && (kwargs != __pyx_mstate_global->__pyx_print_kwargs)) + Py_DECREF(kwargs); + if (!result) + return -1; + Py_DECREF(result); + return 0; +bad: + if (kwargs != __pyx_mstate_global->__pyx_print_kwargs) + Py_XDECREF(kwargs); + return -1; +} + +/* Declarations */ +#if CYTHON_CCOMPLEX && (1) && (!0 || __cplusplus) + #ifdef __cplusplus + static CYTHON_INLINE __pyx_t_float_complex __pyx_t_float_complex_from_parts(float x, float y) { + return ::std::complex< float >(x, y); + } + #else + static CYTHON_INLINE __pyx_t_float_complex __pyx_t_float_complex_from_parts(float x, float y) { + return x + y*(__pyx_t_float_complex)_Complex_I; + } + #endif +#else + static CYTHON_INLINE __pyx_t_float_complex __pyx_t_float_complex_from_parts(float x, float y) { + __pyx_t_float_complex z; + z.real = x; + z.imag = y; + return z; + } +#endif + +/* Arithmetic */ +#if CYTHON_CCOMPLEX && (1) && (!0 || __cplusplus) +#else + static CYTHON_INLINE int __Pyx_c_eq_float(__pyx_t_float_complex a, __pyx_t_float_complex b) { + return (a.real == b.real) && (a.imag == b.imag); + } + static CYTHON_INLINE __pyx_t_float_complex __Pyx_c_sum_float(__pyx_t_float_complex a, __pyx_t_float_complex b) { + __pyx_t_float_complex z; + z.real = a.real + b.real; + z.imag = a.imag + b.imag; + return z; + } + static CYTHON_INLINE __pyx_t_float_complex __Pyx_c_diff_float(__pyx_t_float_complex a, __pyx_t_float_complex b) { + __pyx_t_float_complex z; + z.real = a.real - b.real; + z.imag = a.imag - b.imag; + return z; + } + static CYTHON_INLINE __pyx_t_float_complex __Pyx_c_prod_float(__pyx_t_float_complex a, __pyx_t_float_complex b) { + __pyx_t_float_complex z; + z.real = a.real * b.real - a.imag * b.imag; + z.imag = a.real * b.imag + a.imag * b.real; + return z; + } + #if 1 + static CYTHON_INLINE __pyx_t_float_complex __Pyx_c_quot_float(__pyx_t_float_complex a, __pyx_t_float_complex b) { + if (b.imag == 0) { + return __pyx_t_float_complex_from_parts(a.real / b.real, a.imag / b.real); + } else if (fabsf(b.real) >= fabsf(b.imag)) { + if (b.real == 0 && b.imag == 0) { + return __pyx_t_float_complex_from_parts(a.real / b.real, a.imag / b.imag); + } else { + float r = b.imag / b.real; + float s = (float)(1.0) / (b.real + b.imag * r); + return __pyx_t_float_complex_from_parts( + (a.real + a.imag * r) * s, (a.imag - a.real * r) * s); + } + } else { + float r = b.real / b.imag; + float s = (float)(1.0) / (b.imag + b.real * r); + return __pyx_t_float_complex_from_parts( + (a.real * r + a.imag) * s, (a.imag * r - a.real) * s); + } + } + #else + static CYTHON_INLINE __pyx_t_float_complex __Pyx_c_quot_float(__pyx_t_float_complex a, __pyx_t_float_complex b) { + if (b.imag == 0) { + return __pyx_t_float_complex_from_parts(a.real / b.real, a.imag / b.real); + } else { + float denom = b.real * b.real + b.imag * b.imag; + return __pyx_t_float_complex_from_parts( + (a.real * b.real + a.imag * b.imag) / denom, + (a.imag * b.real - a.real * b.imag) / denom); + } + } + #endif + static CYTHON_INLINE __pyx_t_float_complex __Pyx_c_neg_float(__pyx_t_float_complex a) { + __pyx_t_float_complex z; + z.real = -a.real; + z.imag = -a.imag; + return z; + } + static CYTHON_INLINE int __Pyx_c_is_zero_float(__pyx_t_float_complex a) { + return (a.real == 0) && (a.imag == 0); + } + static CYTHON_INLINE __pyx_t_float_complex __Pyx_c_conj_float(__pyx_t_float_complex a) { + __pyx_t_float_complex z; + z.real = a.real; + z.imag = -a.imag; + return z; + } + #if 1 + static CYTHON_INLINE float __Pyx_c_abs_float(__pyx_t_float_complex z) { + #if !defined(HAVE_HYPOT) || defined(_MSC_VER) + return sqrtf(z.real*z.real + z.imag*z.imag); + #else + return hypotf(z.real, z.imag); + #endif + } + static CYTHON_INLINE __pyx_t_float_complex __Pyx_c_pow_float(__pyx_t_float_complex a, __pyx_t_float_complex b) { + __pyx_t_float_complex z; + float r, lnr, theta, z_r, z_theta; + if (b.imag == 0 && b.real == (int)b.real) { + if (b.real < 0) { + float denom = a.real * a.real + a.imag * a.imag; + a.real = a.real / denom; + a.imag = -a.imag / denom; + b.real = -b.real; + } + switch ((int)b.real) { + case 0: + z.real = 1; + z.imag = 0; + return z; + case 1: + return a; + case 2: + return __Pyx_c_prod_float(a, a); + case 3: + z = __Pyx_c_prod_float(a, a); + return __Pyx_c_prod_float(z, a); + case 4: + z = __Pyx_c_prod_float(a, a); + return __Pyx_c_prod_float(z, z); + } + } + if (a.imag == 0) { + if (a.real == 0) { + return a; + } else if ((b.imag == 0) && (a.real >= 0)) { + z.real = powf(a.real, b.real); + z.imag = 0; + return z; + } else if (a.real > 0) { + r = a.real; + theta = 0; + } else { + r = -a.real; + theta = atan2f(0.0, -1.0); + } + } else { + r = __Pyx_c_abs_float(a); + theta = atan2f(a.imag, a.real); + } + lnr = logf(r); + z_r = expf(lnr * b.real - theta * b.imag); + z_theta = theta * b.real + lnr * b.imag; + z.real = z_r * cosf(z_theta); + z.imag = z_r * sinf(z_theta); + return z; + } + #endif +#endif + +/* Declarations */ +#if CYTHON_CCOMPLEX && (1) && (!0 || __cplusplus) + #ifdef __cplusplus + static CYTHON_INLINE __pyx_t_double_complex __pyx_t_double_complex_from_parts(double x, double y) { + return ::std::complex< double >(x, y); + } + #else + static CYTHON_INLINE __pyx_t_double_complex __pyx_t_double_complex_from_parts(double x, double y) { + return x + y*(__pyx_t_double_complex)_Complex_I; + } + #endif +#else + static CYTHON_INLINE __pyx_t_double_complex __pyx_t_double_complex_from_parts(double x, double y) { + __pyx_t_double_complex z; + z.real = x; + z.imag = y; + return z; + } +#endif + +/* Arithmetic */ +#if CYTHON_CCOMPLEX && (1) && (!0 || __cplusplus) +#else + static CYTHON_INLINE int __Pyx_c_eq_double(__pyx_t_double_complex a, __pyx_t_double_complex b) { + return (a.real == b.real) && (a.imag == b.imag); + } + static CYTHON_INLINE __pyx_t_double_complex __Pyx_c_sum_double(__pyx_t_double_complex a, __pyx_t_double_complex b) { + __pyx_t_double_complex z; + z.real = a.real + b.real; + z.imag = a.imag + b.imag; + return z; + } + static CYTHON_INLINE __pyx_t_double_complex __Pyx_c_diff_double(__pyx_t_double_complex a, __pyx_t_double_complex b) { + __pyx_t_double_complex z; + z.real = a.real - b.real; + z.imag = a.imag - b.imag; + return z; + } + static CYTHON_INLINE __pyx_t_double_complex __Pyx_c_prod_double(__pyx_t_double_complex a, __pyx_t_double_complex b) { + __pyx_t_double_complex z; + z.real = a.real * b.real - a.imag * b.imag; + z.imag = a.real * b.imag + a.imag * b.real; + return z; + } + #if 1 + static CYTHON_INLINE __pyx_t_double_complex __Pyx_c_quot_double(__pyx_t_double_complex a, __pyx_t_double_complex b) { + if (b.imag == 0) { + return __pyx_t_double_complex_from_parts(a.real / b.real, a.imag / b.real); + } else if (fabs(b.real) >= fabs(b.imag)) { + if (b.real == 0 && b.imag == 0) { + return __pyx_t_double_complex_from_parts(a.real / b.real, a.imag / b.imag); + } else { + double r = b.imag / b.real; + double s = (double)(1.0) / (b.real + b.imag * r); + return __pyx_t_double_complex_from_parts( + (a.real + a.imag * r) * s, (a.imag - a.real * r) * s); + } + } else { + double r = b.real / b.imag; + double s = (double)(1.0) / (b.imag + b.real * r); + return __pyx_t_double_complex_from_parts( + (a.real * r + a.imag) * s, (a.imag * r - a.real) * s); + } + } + #else + static CYTHON_INLINE __pyx_t_double_complex __Pyx_c_quot_double(__pyx_t_double_complex a, __pyx_t_double_complex b) { + if (b.imag == 0) { + return __pyx_t_double_complex_from_parts(a.real / b.real, a.imag / b.real); + } else { + double denom = b.real * b.real + b.imag * b.imag; + return __pyx_t_double_complex_from_parts( + (a.real * b.real + a.imag * b.imag) / denom, + (a.imag * b.real - a.real * b.imag) / denom); + } + } + #endif + static CYTHON_INLINE __pyx_t_double_complex __Pyx_c_neg_double(__pyx_t_double_complex a) { + __pyx_t_double_complex z; + z.real = -a.real; + z.imag = -a.imag; + return z; + } + static CYTHON_INLINE int __Pyx_c_is_zero_double(__pyx_t_double_complex a) { + return (a.real == 0) && (a.imag == 0); + } + static CYTHON_INLINE __pyx_t_double_complex __Pyx_c_conj_double(__pyx_t_double_complex a) { + __pyx_t_double_complex z; + z.real = a.real; + z.imag = -a.imag; + return z; + } + #if 1 + static CYTHON_INLINE double __Pyx_c_abs_double(__pyx_t_double_complex z) { + #if !defined(HAVE_HYPOT) || defined(_MSC_VER) + return sqrt(z.real*z.real + z.imag*z.imag); + #else + return hypot(z.real, z.imag); + #endif + } + static CYTHON_INLINE __pyx_t_double_complex __Pyx_c_pow_double(__pyx_t_double_complex a, __pyx_t_double_complex b) { + __pyx_t_double_complex z; + double r, lnr, theta, z_r, z_theta; + if (b.imag == 0 && b.real == (int)b.real) { + if (b.real < 0) { + double denom = a.real * a.real + a.imag * a.imag; + a.real = a.real / denom; + a.imag = -a.imag / denom; + b.real = -b.real; + } + switch ((int)b.real) { + case 0: + z.real = 1; + z.imag = 0; + return z; + case 1: + return a; + case 2: + return __Pyx_c_prod_double(a, a); + case 3: + z = __Pyx_c_prod_double(a, a); + return __Pyx_c_prod_double(z, a); + case 4: + z = __Pyx_c_prod_double(a, a); + return __Pyx_c_prod_double(z, z); + } + } + if (a.imag == 0) { + if (a.real == 0) { + return a; + } else if ((b.imag == 0) && (a.real >= 0)) { + z.real = pow(a.real, b.real); + z.imag = 0; + return z; + } else if (a.real > 0) { + r = a.real; + theta = 0; + } else { + r = -a.real; + theta = atan2(0.0, -1.0); + } + } else { + r = __Pyx_c_abs_double(a); + theta = atan2(a.imag, a.real); + } + lnr = log(r); + z_r = exp(lnr * b.real - theta * b.imag); + z_theta = theta * b.real + lnr * b.imag; + z.real = z_r * cos(z_theta); + z.imag = z_r * sin(z_theta); + return z; + } + #endif +#endif + +/* Declarations */ +#if CYTHON_CCOMPLEX && (1) && (!0 || __cplusplus) + #ifdef __cplusplus + static CYTHON_INLINE __pyx_t_long_double_complex __pyx_t_long_double_complex_from_parts(long double x, long double y) { + return ::std::complex< long double >(x, y); + } + #else + static CYTHON_INLINE __pyx_t_long_double_complex __pyx_t_long_double_complex_from_parts(long double x, long double y) { + return x + y*(__pyx_t_long_double_complex)_Complex_I; + } + #endif +#else + static CYTHON_INLINE __pyx_t_long_double_complex __pyx_t_long_double_complex_from_parts(long double x, long double y) { + __pyx_t_long_double_complex z; + z.real = x; + z.imag = y; + return z; + } +#endif + +/* Arithmetic */ +#if CYTHON_CCOMPLEX && (1) && (!0 || __cplusplus) +#else + static CYTHON_INLINE int __Pyx_c_eq_long__double(__pyx_t_long_double_complex a, __pyx_t_long_double_complex b) { + return (a.real == b.real) && (a.imag == b.imag); + } + static CYTHON_INLINE __pyx_t_long_double_complex __Pyx_c_sum_long__double(__pyx_t_long_double_complex a, __pyx_t_long_double_complex b) { + __pyx_t_long_double_complex z; + z.real = a.real + b.real; + z.imag = a.imag + b.imag; + return z; + } + static CYTHON_INLINE __pyx_t_long_double_complex __Pyx_c_diff_long__double(__pyx_t_long_double_complex a, __pyx_t_long_double_complex b) { + __pyx_t_long_double_complex z; + z.real = a.real - b.real; + z.imag = a.imag - b.imag; + return z; + } + static CYTHON_INLINE __pyx_t_long_double_complex __Pyx_c_prod_long__double(__pyx_t_long_double_complex a, __pyx_t_long_double_complex b) { + __pyx_t_long_double_complex z; + z.real = a.real * b.real - a.imag * b.imag; + z.imag = a.real * b.imag + a.imag * b.real; + return z; + } + #if 1 + static CYTHON_INLINE __pyx_t_long_double_complex __Pyx_c_quot_long__double(__pyx_t_long_double_complex a, __pyx_t_long_double_complex b) { + if (b.imag == 0) { + return __pyx_t_long_double_complex_from_parts(a.real / b.real, a.imag / b.real); + } else if (fabsl(b.real) >= fabsl(b.imag)) { + if (b.real == 0 && b.imag == 0) { + return __pyx_t_long_double_complex_from_parts(a.real / b.real, a.imag / b.imag); + } else { + long double r = b.imag / b.real; + long double s = (long double)(1.0) / (b.real + b.imag * r); + return __pyx_t_long_double_complex_from_parts( + (a.real + a.imag * r) * s, (a.imag - a.real * r) * s); + } + } else { + long double r = b.real / b.imag; + long double s = (long double)(1.0) / (b.imag + b.real * r); + return __pyx_t_long_double_complex_from_parts( + (a.real * r + a.imag) * s, (a.imag * r - a.real) * s); + } + } + #else + static CYTHON_INLINE __pyx_t_long_double_complex __Pyx_c_quot_long__double(__pyx_t_long_double_complex a, __pyx_t_long_double_complex b) { + if (b.imag == 0) { + return __pyx_t_long_double_complex_from_parts(a.real / b.real, a.imag / b.real); + } else { + long double denom = b.real * b.real + b.imag * b.imag; + return __pyx_t_long_double_complex_from_parts( + (a.real * b.real + a.imag * b.imag) / denom, + (a.imag * b.real - a.real * b.imag) / denom); + } + } + #endif + static CYTHON_INLINE __pyx_t_long_double_complex __Pyx_c_neg_long__double(__pyx_t_long_double_complex a) { + __pyx_t_long_double_complex z; + z.real = -a.real; + z.imag = -a.imag; + return z; + } + static CYTHON_INLINE int __Pyx_c_is_zero_long__double(__pyx_t_long_double_complex a) { + return (a.real == 0) && (a.imag == 0); + } + static CYTHON_INLINE __pyx_t_long_double_complex __Pyx_c_conj_long__double(__pyx_t_long_double_complex a) { + __pyx_t_long_double_complex z; + z.real = a.real; + z.imag = -a.imag; + return z; + } + #if 1 + static CYTHON_INLINE long double __Pyx_c_abs_long__double(__pyx_t_long_double_complex z) { + #if !defined(HAVE_HYPOT) || defined(_MSC_VER) + return sqrtl(z.real*z.real + z.imag*z.imag); + #else + return hypotl(z.real, z.imag); + #endif + } + static CYTHON_INLINE __pyx_t_long_double_complex __Pyx_c_pow_long__double(__pyx_t_long_double_complex a, __pyx_t_long_double_complex b) { + __pyx_t_long_double_complex z; + long double r, lnr, theta, z_r, z_theta; + if (b.imag == 0 && b.real == (int)b.real) { + if (b.real < 0) { + long double denom = a.real * a.real + a.imag * a.imag; + a.real = a.real / denom; + a.imag = -a.imag / denom; + b.real = -b.real; + } + switch ((int)b.real) { + case 0: + z.real = 1; + z.imag = 0; + return z; + case 1: + return a; + case 2: + return __Pyx_c_prod_long__double(a, a); + case 3: + z = __Pyx_c_prod_long__double(a, a); + return __Pyx_c_prod_long__double(z, a); + case 4: + z = __Pyx_c_prod_long__double(a, a); + return __Pyx_c_prod_long__double(z, z); + } + } + if (a.imag == 0) { + if (a.real == 0) { + return a; + } else if ((b.imag == 0) && (a.real >= 0)) { + z.real = powl(a.real, b.real); + z.imag = 0; + return z; + } else if (a.real > 0) { + r = a.real; + theta = 0; + } else { + r = -a.real; + theta = atan2l(0.0, -1.0); + } + } else { + r = __Pyx_c_abs_long__double(a); + theta = atan2l(a.imag, a.real); + } + lnr = logl(r); + z_r = expl(lnr * b.real - theta * b.imag); + z_theta = theta * b.real + lnr * b.imag; + z.real = z_r * cosl(z_theta); + z.imag = z_r * sinl(z_theta); + return z; + } + #endif +#endif + +/* MemviewRefcount */ +#include +#ifndef _Py_NO_RETURN +#define _Py_NO_RETURN +#endif +_Py_NO_RETURN +static void __pyx_fatalerror(const char *fmt, ...) { + va_list vargs; + char msg[200]; +#if PY_VERSION_HEX >= 0x030A0000 || defined(HAVE_STDARG_PROTOTYPES) + va_start(vargs, fmt); +#else + va_start(vargs); +#endif + vsnprintf(msg, 200, fmt, vargs); + va_end(vargs); + Py_FatalError(msg); +} +static CYTHON_INLINE int +__pyx_add_acquisition_count_locked(__pyx_atomic_int_type *acquisition_count, + PyThread_type_lock lock) +{ + int result; + PyThread_acquire_lock(lock, 1); + result = (*acquisition_count)++; + PyThread_release_lock(lock); + return result; +} +static CYTHON_INLINE int +__pyx_sub_acquisition_count_locked(__pyx_atomic_int_type *acquisition_count, + PyThread_type_lock lock) +{ + int result; + PyThread_acquire_lock(lock, 1); + result = (*acquisition_count)--; + PyThread_release_lock(lock); + return result; +} +static CYTHON_INLINE void +__Pyx_INC_MEMVIEW(__Pyx_memviewslice *memslice, int have_gil, int lineno) +{ + __pyx_nonatomic_int_type old_acquisition_count; + struct __pyx_memoryview_obj *memview = memslice->memview; + if (unlikely(!memview || (PyObject *) memview == Py_None)) { + return; + } + old_acquisition_count = __pyx_add_acquisition_count(memview); + if (unlikely(old_acquisition_count <= 0)) { + if (likely(old_acquisition_count == 0)) { + if (have_gil) { + Py_INCREF((PyObject *) memview); + } else { + PyGILState_STATE _gilstate = PyGILState_Ensure(); + Py_INCREF((PyObject *) memview); + PyGILState_Release(_gilstate); + } + } else { + __pyx_fatalerror("Acquisition count is %d (line %d)", + old_acquisition_count+1, lineno); + } + } +} +static CYTHON_INLINE void __Pyx_XCLEAR_MEMVIEW(__Pyx_memviewslice *memslice, + int have_gil, int lineno) { + __pyx_nonatomic_int_type old_acquisition_count; + struct __pyx_memoryview_obj *memview = memslice->memview; + if (unlikely(!memview || (PyObject *) memview == Py_None)) { + memslice->memview = NULL; + return; + } + old_acquisition_count = __pyx_sub_acquisition_count(memview); + memslice->data = NULL; + if (likely(old_acquisition_count > 1)) { + memslice->memview = NULL; + } else if (likely(old_acquisition_count == 1)) { + if (have_gil) { + Py_CLEAR(memslice->memview); + } else { + PyGILState_STATE _gilstate = PyGILState_Ensure(); + Py_CLEAR(memslice->memview); + PyGILState_Release(_gilstate); + } + } else { + __pyx_fatalerror("Acquisition count is %d (line %d)", + old_acquisition_count-1, lineno); + } +} + +/* MemviewSliceIsContig */ +static int +__pyx_memviewslice_is_contig(const __Pyx_memviewslice mvs, char order, int ndim) +{ + int i, index, step, start; + Py_ssize_t itemsize = mvs.memview->view.itemsize; + if (order == 'F') { + step = 1; + start = 0; + } else { + step = -1; + start = ndim - 1; + } + for (i = 0; i < ndim; i++) { + index = start + step * i; + if (mvs.suboffsets[index] >= 0 || mvs.strides[index] != itemsize) + return 0; + itemsize *= mvs.shape[index]; + } + return 1; +} + +/* OverlappingSlices */ +static void +__pyx_get_array_memory_extents(__Pyx_memviewslice *slice, + void **out_start, void **out_end, + int ndim, size_t itemsize) +{ + char *start, *end; + int i; + start = end = slice->data; + for (i = 0; i < ndim; i++) { + Py_ssize_t stride = slice->strides[i]; + Py_ssize_t extent = slice->shape[i]; + if (extent == 0) { + *out_start = *out_end = start; + return; + } else { + if (stride > 0) + end += stride * (extent - 1); + else + start += stride * (extent - 1); + } + } + *out_start = start; + *out_end = end + itemsize; +} +static int +__pyx_slices_overlap(__Pyx_memviewslice *slice1, + __Pyx_memviewslice *slice2, + int ndim, size_t itemsize) +{ + void *start1, *end1, *start2, *end2; + __pyx_get_array_memory_extents(slice1, &start1, &end1, ndim, itemsize); + __pyx_get_array_memory_extents(slice2, &start2, &end2, ndim, itemsize); + return (start1 < end2) && (start2 < end1); +} + +/* MemviewSliceInit */ +static int +__Pyx_init_memviewslice(struct __pyx_memoryview_obj *memview, + int ndim, + __Pyx_memviewslice *memviewslice, + int memview_is_new_reference) +{ + __Pyx_RefNannyDeclarations + int i, retval=-1; + Py_buffer *buf = &memview->view; + __Pyx_RefNannySetupContext("init_memviewslice", 0); + if (unlikely(memviewslice->memview || memviewslice->data)) { + PyErr_SetString(PyExc_ValueError, + "memviewslice is already initialized!"); + goto fail; + } + if (buf->strides) { + for (i = 0; i < ndim; i++) { + memviewslice->strides[i] = buf->strides[i]; + } + } else { + Py_ssize_t stride = buf->itemsize; + for (i = ndim - 1; i >= 0; i--) { + memviewslice->strides[i] = stride; + stride *= buf->shape[i]; + } + } + for (i = 0; i < ndim; i++) { + memviewslice->shape[i] = buf->shape[i]; + if (buf->suboffsets) { + memviewslice->suboffsets[i] = buf->suboffsets[i]; + } else { + memviewslice->suboffsets[i] = -1; + } + } + memviewslice->memview = memview; + memviewslice->data = (char *)buf->buf; + if (__pyx_add_acquisition_count(memview) == 0 && !memview_is_new_reference) { + Py_INCREF((PyObject*)memview); + } + retval = 0; + goto no_fail; +fail: + memviewslice->memview = 0; + memviewslice->data = 0; + retval = -1; +no_fail: + __Pyx_RefNannyFinishContext(); + return retval; +} + +/* CIntToPy */ +static CYTHON_INLINE PyObject* __Pyx_PyLong_From___pyx_anon_enum(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; +} + +/* CIntFromPy */ +static CYTHON_INLINE uint64_t __Pyx_PyLong_As_uint64_t(PyObject *x) { +#ifdef __Pyx_HAS_GCC_DIAGNOSTIC +#pragma GCC diagnostic push +#pragma GCC diagnostic ignored "-Wconversion" +#endif + const uint64_t neg_one = (uint64_t) -1, const_zero = (uint64_t) 0; +#ifdef __Pyx_HAS_GCC_DIAGNOSTIC +#pragma GCC diagnostic pop +#endif + const int is_unsigned = neg_one > const_zero; + if (unlikely(!PyLong_Check(x))) { + uint64_t val; + PyObject *tmp = __Pyx_PyNumber_Long(x); + if (!tmp) return (uint64_t) -1; + val = __Pyx_PyLong_As_uint64_t(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(uint64_t, __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(uint64_t) > 1 * PyLong_SHIFT)) { + if ((8 * sizeof(unsigned long) > 2 * PyLong_SHIFT)) { + __PYX_VERIFY_RETURN_INT(uint64_t, unsigned long, (((((unsigned long)digits[1]) << PyLong_SHIFT) | (unsigned long)digits[0]))) + } else if ((8 * sizeof(uint64_t) >= 2 * PyLong_SHIFT)) { + return (uint64_t) (((((uint64_t)digits[1]) << PyLong_SHIFT) | (uint64_t)digits[0])); + } + } + break; + case 3: + if ((8 * sizeof(uint64_t) > 2 * PyLong_SHIFT)) { + if ((8 * sizeof(unsigned long) > 3 * PyLong_SHIFT)) { + __PYX_VERIFY_RETURN_INT(uint64_t, unsigned long, (((((((unsigned long)digits[2]) << PyLong_SHIFT) | (unsigned long)digits[1]) << PyLong_SHIFT) | (unsigned long)digits[0]))) + } else if ((8 * sizeof(uint64_t) >= 3 * PyLong_SHIFT)) { + return (uint64_t) (((((((uint64_t)digits[2]) << PyLong_SHIFT) | (uint64_t)digits[1]) << PyLong_SHIFT) | (uint64_t)digits[0])); + } + } + break; + case 4: + if ((8 * sizeof(uint64_t) > 3 * PyLong_SHIFT)) { + if ((8 * sizeof(unsigned long) > 4 * PyLong_SHIFT)) { + __PYX_VERIFY_RETURN_INT(uint64_t, unsigned long, (((((((((unsigned long)digits[3]) << PyLong_SHIFT) | (unsigned long)digits[2]) << PyLong_SHIFT) | (unsigned long)digits[1]) << PyLong_SHIFT) | (unsigned long)digits[0]))) + } else if ((8 * sizeof(uint64_t) >= 4 * PyLong_SHIFT)) { + return (uint64_t) (((((((((uint64_t)digits[3]) << PyLong_SHIFT) | (uint64_t)digits[2]) << PyLong_SHIFT) | (uint64_t)digits[1]) << PyLong_SHIFT) | (uint64_t)digits[0])); + } + } + break; + } + } +#endif +#if CYTHON_COMPILING_IN_CPYTHON && 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 (uint64_t) -1; + if (unlikely(result == 1)) + goto raise_neg_overflow; + } +#endif + if ((sizeof(uint64_t) <= sizeof(unsigned long))) { + __PYX_VERIFY_RETURN_INT_EXC(uint64_t, unsigned long, PyLong_AsUnsignedLong(x)) + } else if ((sizeof(uint64_t) <= sizeof(unsigned PY_LONG_LONG))) { + __PYX_VERIFY_RETURN_INT_EXC(uint64_t, unsigned PY_LONG_LONG, PyLong_AsUnsignedLongLong(x)) + } + } else { +#if CYTHON_USE_PYLONG_INTERNALS + if (__Pyx_PyLong_IsCompact(x)) { + __PYX_VERIFY_RETURN_INT(uint64_t, __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(uint64_t) - 1 > 1 * PyLong_SHIFT)) { + if ((8 * sizeof(unsigned long) > 2 * PyLong_SHIFT)) { + __PYX_VERIFY_RETURN_INT(uint64_t, long, -(long) (((((unsigned long)digits[1]) << PyLong_SHIFT) | (unsigned long)digits[0]))) + } else if ((8 * sizeof(uint64_t) - 1 > 2 * PyLong_SHIFT)) { + return (uint64_t) (((uint64_t)-1)*(((((uint64_t)digits[1]) << PyLong_SHIFT) | (uint64_t)digits[0]))); + } + } + break; + case 2: + if ((8 * sizeof(uint64_t) > 1 * PyLong_SHIFT)) { + if ((8 * sizeof(unsigned long) > 2 * PyLong_SHIFT)) { + __PYX_VERIFY_RETURN_INT(uint64_t, unsigned long, (((((unsigned long)digits[1]) << PyLong_SHIFT) | (unsigned long)digits[0]))) + } else if ((8 * sizeof(uint64_t) - 1 > 2 * PyLong_SHIFT)) { + return (uint64_t) ((((((uint64_t)digits[1]) << PyLong_SHIFT) | (uint64_t)digits[0]))); + } + } + break; + case -3: + if ((8 * sizeof(uint64_t) - 1 > 2 * PyLong_SHIFT)) { + if ((8 * sizeof(unsigned long) > 3 * PyLong_SHIFT)) { + __PYX_VERIFY_RETURN_INT(uint64_t, long, -(long) (((((((unsigned long)digits[2]) << PyLong_SHIFT) | (unsigned long)digits[1]) << PyLong_SHIFT) | (unsigned long)digits[0]))) + } else if ((8 * sizeof(uint64_t) - 1 > 3 * PyLong_SHIFT)) { + return (uint64_t) (((uint64_t)-1)*(((((((uint64_t)digits[2]) << PyLong_SHIFT) | (uint64_t)digits[1]) << PyLong_SHIFT) | (uint64_t)digits[0]))); + } + } + break; + case 3: + if ((8 * sizeof(uint64_t) > 2 * PyLong_SHIFT)) { + if ((8 * sizeof(unsigned long) > 3 * PyLong_SHIFT)) { + __PYX_VERIFY_RETURN_INT(uint64_t, unsigned long, (((((((unsigned long)digits[2]) << PyLong_SHIFT) | (unsigned long)digits[1]) << PyLong_SHIFT) | (unsigned long)digits[0]))) + } else if ((8 * sizeof(uint64_t) - 1 > 3 * PyLong_SHIFT)) { + return (uint64_t) ((((((((uint64_t)digits[2]) << PyLong_SHIFT) | (uint64_t)digits[1]) << PyLong_SHIFT) | (uint64_t)digits[0]))); + } + } + break; + case -4: + if ((8 * sizeof(uint64_t) - 1 > 3 * PyLong_SHIFT)) { + if ((8 * sizeof(unsigned long) > 4 * PyLong_SHIFT)) { + __PYX_VERIFY_RETURN_INT(uint64_t, long, -(long) (((((((((unsigned long)digits[3]) << PyLong_SHIFT) | (unsigned long)digits[2]) << PyLong_SHIFT) | (unsigned long)digits[1]) << PyLong_SHIFT) | (unsigned long)digits[0]))) + } else if ((8 * sizeof(uint64_t) - 1 > 4 * PyLong_SHIFT)) { + return (uint64_t) (((uint64_t)-1)*(((((((((uint64_t)digits[3]) << PyLong_SHIFT) | (uint64_t)digits[2]) << PyLong_SHIFT) | (uint64_t)digits[1]) << PyLong_SHIFT) | (uint64_t)digits[0]))); + } + } + break; + case 4: + if ((8 * sizeof(uint64_t) > 3 * PyLong_SHIFT)) { + if ((8 * sizeof(unsigned long) > 4 * PyLong_SHIFT)) { + __PYX_VERIFY_RETURN_INT(uint64_t, unsigned long, (((((((((unsigned long)digits[3]) << PyLong_SHIFT) | (unsigned long)digits[2]) << PyLong_SHIFT) | (unsigned long)digits[1]) << PyLong_SHIFT) | (unsigned long)digits[0]))) + } else if ((8 * sizeof(uint64_t) - 1 > 4 * PyLong_SHIFT)) { + return (uint64_t) ((((((((((uint64_t)digits[3]) << PyLong_SHIFT) | (uint64_t)digits[2]) << PyLong_SHIFT) | (uint64_t)digits[1]) << PyLong_SHIFT) | (uint64_t)digits[0]))); + } + } + break; + } + } +#endif + if ((sizeof(uint64_t) <= sizeof(long))) { + __PYX_VERIFY_RETURN_INT_EXC(uint64_t, long, PyLong_AsLong(x)) + } else if ((sizeof(uint64_t) <= sizeof(PY_LONG_LONG))) { + __PYX_VERIFY_RETURN_INT_EXC(uint64_t, PY_LONG_LONG, PyLong_AsLongLong(x)) + } + } + { + uint64_t 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 (uint64_t) -1; + assert(PyLong_CheckExact(v)); + } + { + int result = PyObject_RichCompareBool(v, Py_False, Py_LT); + if (unlikely(result < 0)) { + Py_DECREF(v); + return (uint64_t) -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 (uint64_t) -1; + } else { + stepval = v; + } + v = NULL; + val = (uint64_t) 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(uint64_t) * 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 |= ((uint64_t) 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(uint64_t) * 8) - bits - (is_unsigned ? 0 : 1); + if (unlikely(idigit >= (1L << remaining_bits))) + goto raise_overflow; + val |= ((uint64_t) idigit) << bits; + } + if (!is_unsigned) { + if (unlikely(val & (((uint64_t) 1) << (sizeof(uint64_t) * 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 (uint64_t) -1; + return val; + } +raise_overflow: + PyErr_SetString(PyExc_OverflowError, + "value too large to convert to uint64_t"); + return (uint64_t) -1; +raise_neg_overflow: + PyErr_SetString(PyExc_OverflowError, + "can't convert negative value to uint64_t"); + return (uint64_t) -1; +} + +/* CIntFromPy */ +static CYTHON_INLINE 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 int32_t __Pyx_PyLong_As_int32_t(PyObject *x) { +#ifdef __Pyx_HAS_GCC_DIAGNOSTIC +#pragma GCC diagnostic push +#pragma GCC diagnostic ignored "-Wconversion" +#endif + const int32_t neg_one = (int32_t) -1, const_zero = (int32_t) 0; +#ifdef __Pyx_HAS_GCC_DIAGNOSTIC +#pragma GCC diagnostic pop +#endif + const int is_unsigned = neg_one > const_zero; + if (unlikely(!PyLong_Check(x))) { + int32_t val; + PyObject *tmp = __Pyx_PyNumber_Long(x); + if (!tmp) return (int32_t) -1; + val = __Pyx_PyLong_As_int32_t(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(int32_t, __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(int32_t) > 1 * PyLong_SHIFT)) { + if ((8 * sizeof(unsigned long) > 2 * PyLong_SHIFT)) { + __PYX_VERIFY_RETURN_INT(int32_t, unsigned long, (((((unsigned long)digits[1]) << PyLong_SHIFT) | (unsigned long)digits[0]))) + } else if ((8 * sizeof(int32_t) >= 2 * PyLong_SHIFT)) { + return (int32_t) (((((int32_t)digits[1]) << PyLong_SHIFT) | (int32_t)digits[0])); + } + } + break; + case 3: + if ((8 * sizeof(int32_t) > 2 * PyLong_SHIFT)) { + if ((8 * sizeof(unsigned long) > 3 * PyLong_SHIFT)) { + __PYX_VERIFY_RETURN_INT(int32_t, unsigned long, (((((((unsigned long)digits[2]) << PyLong_SHIFT) | (unsigned long)digits[1]) << PyLong_SHIFT) | (unsigned long)digits[0]))) + } else if ((8 * sizeof(int32_t) >= 3 * PyLong_SHIFT)) { + return (int32_t) (((((((int32_t)digits[2]) << PyLong_SHIFT) | (int32_t)digits[1]) << PyLong_SHIFT) | (int32_t)digits[0])); + } + } + break; + case 4: + if ((8 * sizeof(int32_t) > 3 * PyLong_SHIFT)) { + if ((8 * sizeof(unsigned long) > 4 * PyLong_SHIFT)) { + __PYX_VERIFY_RETURN_INT(int32_t, unsigned long, (((((((((unsigned long)digits[3]) << PyLong_SHIFT) | (unsigned long)digits[2]) << PyLong_SHIFT) | (unsigned long)digits[1]) << PyLong_SHIFT) | (unsigned long)digits[0]))) + } else if ((8 * sizeof(int32_t) >= 4 * PyLong_SHIFT)) { + return (int32_t) (((((((((int32_t)digits[3]) << PyLong_SHIFT) | (int32_t)digits[2]) << PyLong_SHIFT) | (int32_t)digits[1]) << PyLong_SHIFT) | (int32_t)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 (int32_t) -1; + if (unlikely(result == 1)) + goto raise_neg_overflow; + } +#endif + if ((sizeof(int32_t) <= sizeof(unsigned long))) { + __PYX_VERIFY_RETURN_INT_EXC(int32_t, unsigned long, PyLong_AsUnsignedLong(x)) + } else if ((sizeof(int32_t) <= sizeof(unsigned PY_LONG_LONG))) { + __PYX_VERIFY_RETURN_INT_EXC(int32_t, unsigned PY_LONG_LONG, PyLong_AsUnsignedLongLong(x)) + } + } else { +#if CYTHON_USE_PYLONG_INTERNALS + if (__Pyx_PyLong_IsCompact(x)) { + __PYX_VERIFY_RETURN_INT(int32_t, __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(int32_t) - 1 > 1 * PyLong_SHIFT)) { + if ((8 * sizeof(unsigned long) > 2 * PyLong_SHIFT)) { + __PYX_VERIFY_RETURN_INT(int32_t, long, -(long) (((((unsigned long)digits[1]) << PyLong_SHIFT) | (unsigned long)digits[0]))) + } else if ((8 * sizeof(int32_t) - 1 > 2 * PyLong_SHIFT)) { + return (int32_t) (((int32_t)-1)*(((((int32_t)digits[1]) << PyLong_SHIFT) | (int32_t)digits[0]))); + } + } + break; + case 2: + if ((8 * sizeof(int32_t) > 1 * PyLong_SHIFT)) { + if ((8 * sizeof(unsigned long) > 2 * PyLong_SHIFT)) { + __PYX_VERIFY_RETURN_INT(int32_t, unsigned long, (((((unsigned long)digits[1]) << PyLong_SHIFT) | (unsigned long)digits[0]))) + } else if ((8 * sizeof(int32_t) - 1 > 2 * PyLong_SHIFT)) { + return (int32_t) ((((((int32_t)digits[1]) << PyLong_SHIFT) | (int32_t)digits[0]))); + } + } + break; + case -3: + if ((8 * sizeof(int32_t) - 1 > 2 * PyLong_SHIFT)) { + if ((8 * sizeof(unsigned long) > 3 * PyLong_SHIFT)) { + __PYX_VERIFY_RETURN_INT(int32_t, long, -(long) (((((((unsigned long)digits[2]) << PyLong_SHIFT) | (unsigned long)digits[1]) << PyLong_SHIFT) | (unsigned long)digits[0]))) + } else if ((8 * sizeof(int32_t) - 1 > 3 * PyLong_SHIFT)) { + return (int32_t) (((int32_t)-1)*(((((((int32_t)digits[2]) << PyLong_SHIFT) | (int32_t)digits[1]) << PyLong_SHIFT) | (int32_t)digits[0]))); + } + } + break; + case 3: + if ((8 * sizeof(int32_t) > 2 * PyLong_SHIFT)) { + if ((8 * sizeof(unsigned long) > 3 * PyLong_SHIFT)) { + __PYX_VERIFY_RETURN_INT(int32_t, unsigned long, (((((((unsigned long)digits[2]) << PyLong_SHIFT) | (unsigned long)digits[1]) << PyLong_SHIFT) | (unsigned long)digits[0]))) + } else if ((8 * sizeof(int32_t) - 1 > 3 * PyLong_SHIFT)) { + return (int32_t) ((((((((int32_t)digits[2]) << PyLong_SHIFT) | (int32_t)digits[1]) << PyLong_SHIFT) | (int32_t)digits[0]))); + } + } + break; + case -4: + if ((8 * sizeof(int32_t) - 1 > 3 * PyLong_SHIFT)) { + if ((8 * sizeof(unsigned long) > 4 * PyLong_SHIFT)) { + __PYX_VERIFY_RETURN_INT(int32_t, long, -(long) (((((((((unsigned long)digits[3]) << PyLong_SHIFT) | (unsigned long)digits[2]) << PyLong_SHIFT) | (unsigned long)digits[1]) << PyLong_SHIFT) | (unsigned long)digits[0]))) + } else if ((8 * sizeof(int32_t) - 1 > 4 * PyLong_SHIFT)) { + return (int32_t) (((int32_t)-1)*(((((((((int32_t)digits[3]) << PyLong_SHIFT) | (int32_t)digits[2]) << PyLong_SHIFT) | (int32_t)digits[1]) << PyLong_SHIFT) | (int32_t)digits[0]))); + } + } + break; + case 4: + if ((8 * sizeof(int32_t) > 3 * PyLong_SHIFT)) { + if ((8 * sizeof(unsigned long) > 4 * PyLong_SHIFT)) { + __PYX_VERIFY_RETURN_INT(int32_t, unsigned long, (((((((((unsigned long)digits[3]) << PyLong_SHIFT) | (unsigned long)digits[2]) << PyLong_SHIFT) | (unsigned long)digits[1]) << PyLong_SHIFT) | (unsigned long)digits[0]))) + } else if ((8 * sizeof(int32_t) - 1 > 4 * PyLong_SHIFT)) { + return (int32_t) ((((((((((int32_t)digits[3]) << PyLong_SHIFT) | (int32_t)digits[2]) << PyLong_SHIFT) | (int32_t)digits[1]) << PyLong_SHIFT) | (int32_t)digits[0]))); + } + } + break; + } + } +#endif + if ((sizeof(int32_t) <= sizeof(long))) { + __PYX_VERIFY_RETURN_INT_EXC(int32_t, long, PyLong_AsLong(x)) + } else if ((sizeof(int32_t) <= sizeof(PY_LONG_LONG))) { + __PYX_VERIFY_RETURN_INT_EXC(int32_t, PY_LONG_LONG, PyLong_AsLongLong(x)) + } + } + { + int32_t 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 (int32_t) -1; + assert(PyLong_CheckExact(v)); + } + { + int result = PyObject_RichCompareBool(v, Py_False, Py_LT); + if (unlikely(result < 0)) { + Py_DECREF(v); + return (int32_t) -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 (int32_t) -1; + } else { + stepval = v; + } + v = NULL; + val = (int32_t) 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(int32_t) * 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 |= ((int32_t) 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(int32_t) * 8) - bits - (is_unsigned ? 0 : 1); + if (unlikely(idigit >= (1L << remaining_bits))) + goto raise_overflow; + val |= ((int32_t) idigit) << bits; + } + if (!is_unsigned) { + if (unlikely(val & (((int32_t) 1) << (sizeof(int32_t) * 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 (int32_t) -1; + return val; + } +raise_overflow: + PyErr_SetString(PyExc_OverflowError, + "value too large to convert to int32_t"); + return (int32_t) -1; +raise_neg_overflow: + PyErr_SetString(PyExc_OverflowError, + "can't convert negative value to int32_t"); + return (int32_t) -1; +} + +/* CIntToPy */ +static CYTHON_INLINE PyObject* __Pyx_PyLong_From_int32_t(int32_t value) { +#ifdef __Pyx_HAS_GCC_DIAGNOSTIC +#pragma GCC diagnostic push +#pragma GCC diagnostic ignored "-Wconversion" +#endif + const int32_t neg_one = (int32_t) -1, const_zero = (int32_t) 0; +#ifdef __Pyx_HAS_GCC_DIAGNOSTIC +#pragma GCC diagnostic pop +#endif + const int is_unsigned = neg_one > const_zero; + if (is_unsigned) { + if (sizeof(int32_t) < sizeof(long)) { + return PyLong_FromLong((long) value); + } else if (sizeof(int32_t) <= sizeof(unsigned long)) { + return PyLong_FromUnsignedLong((unsigned long) value); +#if !CYTHON_COMPILING_IN_PYPY + } else if (sizeof(int32_t) <= sizeof(unsigned PY_LONG_LONG)) { + return PyLong_FromUnsignedLongLong((unsigned PY_LONG_LONG) value); +#endif + } + } else { + if (sizeof(int32_t) <= sizeof(long)) { + return PyLong_FromLong((long) value); + } else if (sizeof(int32_t) <= 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(int32_t), + 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(int32_t)); + 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 + } +} + +/* 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 + } +} + +/* 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 + } +} + +/* CIntToPy */ +static CYTHON_INLINE PyObject* __Pyx_PyLong_From_uint64_t(uint64_t value) { +#ifdef __Pyx_HAS_GCC_DIAGNOSTIC +#pragma GCC diagnostic push +#pragma GCC diagnostic ignored "-Wconversion" +#endif + const uint64_t neg_one = (uint64_t) -1, const_zero = (uint64_t) 0; +#ifdef __Pyx_HAS_GCC_DIAGNOSTIC +#pragma GCC diagnostic pop +#endif + const int is_unsigned = neg_one > const_zero; + if (is_unsigned) { + if (sizeof(uint64_t) < sizeof(long)) { + return PyLong_FromLong((long) value); + } else if (sizeof(uint64_t) <= sizeof(unsigned long)) { + return PyLong_FromUnsignedLong((unsigned long) value); +#if !CYTHON_COMPILING_IN_PYPY + } else if (sizeof(uint64_t) <= sizeof(unsigned PY_LONG_LONG)) { + return PyLong_FromUnsignedLongLong((unsigned PY_LONG_LONG) value); +#endif + } + } else { + if (sizeof(uint64_t) <= sizeof(long)) { + return PyLong_FromLong((long) value); + } else if (sizeof(uint64_t) <= 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(uint64_t), + 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(uint64_t)); + 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 size_t __Pyx_PyLong_As_size_t(PyObject *x) { +#ifdef __Pyx_HAS_GCC_DIAGNOSTIC +#pragma GCC diagnostic push +#pragma GCC diagnostic ignored "-Wconversion" +#endif + const size_t neg_one = (size_t) -1, const_zero = (size_t) 0; +#ifdef __Pyx_HAS_GCC_DIAGNOSTIC +#pragma GCC diagnostic pop +#endif + const int is_unsigned = neg_one > const_zero; + if (unlikely(!PyLong_Check(x))) { + size_t val; + PyObject *tmp = __Pyx_PyNumber_Long(x); + if (!tmp) return (size_t) -1; + val = __Pyx_PyLong_As_size_t(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(size_t, __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(size_t) > 1 * PyLong_SHIFT)) { + if ((8 * sizeof(unsigned long) > 2 * PyLong_SHIFT)) { + __PYX_VERIFY_RETURN_INT(size_t, unsigned long, (((((unsigned long)digits[1]) << PyLong_SHIFT) | (unsigned long)digits[0]))) + } else if ((8 * sizeof(size_t) >= 2 * PyLong_SHIFT)) { + return (size_t) (((((size_t)digits[1]) << PyLong_SHIFT) | (size_t)digits[0])); + } + } + break; + case 3: + if ((8 * sizeof(size_t) > 2 * PyLong_SHIFT)) { + if ((8 * sizeof(unsigned long) > 3 * PyLong_SHIFT)) { + __PYX_VERIFY_RETURN_INT(size_t, unsigned long, (((((((unsigned long)digits[2]) << PyLong_SHIFT) | (unsigned long)digits[1]) << PyLong_SHIFT) | (unsigned long)digits[0]))) + } else if ((8 * sizeof(size_t) >= 3 * PyLong_SHIFT)) { + return (size_t) (((((((size_t)digits[2]) << PyLong_SHIFT) | (size_t)digits[1]) << PyLong_SHIFT) | (size_t)digits[0])); + } + } + break; + case 4: + if ((8 * sizeof(size_t) > 3 * PyLong_SHIFT)) { + if ((8 * sizeof(unsigned long) > 4 * PyLong_SHIFT)) { + __PYX_VERIFY_RETURN_INT(size_t, unsigned long, (((((((((unsigned long)digits[3]) << PyLong_SHIFT) | (unsigned long)digits[2]) << PyLong_SHIFT) | (unsigned long)digits[1]) << PyLong_SHIFT) | (unsigned long)digits[0]))) + } else if ((8 * sizeof(size_t) >= 4 * PyLong_SHIFT)) { + return (size_t) (((((((((size_t)digits[3]) << PyLong_SHIFT) | (size_t)digits[2]) << PyLong_SHIFT) | (size_t)digits[1]) << PyLong_SHIFT) | (size_t)digits[0])); + } + } + break; + } + } +#endif +#if CYTHON_COMPILING_IN_CPYTHON && 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 (size_t) -1; + if (unlikely(result == 1)) + goto raise_neg_overflow; + } +#endif + if ((sizeof(size_t) <= sizeof(unsigned long))) { + __PYX_VERIFY_RETURN_INT_EXC(size_t, unsigned long, PyLong_AsUnsignedLong(x)) + } else if ((sizeof(size_t) <= sizeof(unsigned PY_LONG_LONG))) { + __PYX_VERIFY_RETURN_INT_EXC(size_t, unsigned PY_LONG_LONG, PyLong_AsUnsignedLongLong(x)) + } + } else { +#if CYTHON_USE_PYLONG_INTERNALS + if (__Pyx_PyLong_IsCompact(x)) { + __PYX_VERIFY_RETURN_INT(size_t, __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(size_t) - 1 > 1 * PyLong_SHIFT)) { + if ((8 * sizeof(unsigned long) > 2 * PyLong_SHIFT)) { + __PYX_VERIFY_RETURN_INT(size_t, long, -(long) (((((unsigned long)digits[1]) << PyLong_SHIFT) | (unsigned long)digits[0]))) + } else if ((8 * sizeof(size_t) - 1 > 2 * PyLong_SHIFT)) { + return (size_t) (((size_t)-1)*(((((size_t)digits[1]) << PyLong_SHIFT) | (size_t)digits[0]))); + } + } + break; + case 2: + if ((8 * sizeof(size_t) > 1 * PyLong_SHIFT)) { + if ((8 * sizeof(unsigned long) > 2 * PyLong_SHIFT)) { + __PYX_VERIFY_RETURN_INT(size_t, unsigned long, (((((unsigned long)digits[1]) << PyLong_SHIFT) | (unsigned long)digits[0]))) + } else if ((8 * sizeof(size_t) - 1 > 2 * PyLong_SHIFT)) { + return (size_t) ((((((size_t)digits[1]) << PyLong_SHIFT) | (size_t)digits[0]))); + } + } + break; + case -3: + if ((8 * sizeof(size_t) - 1 > 2 * PyLong_SHIFT)) { + if ((8 * sizeof(unsigned long) > 3 * PyLong_SHIFT)) { + __PYX_VERIFY_RETURN_INT(size_t, long, -(long) (((((((unsigned long)digits[2]) << PyLong_SHIFT) | (unsigned long)digits[1]) << PyLong_SHIFT) | (unsigned long)digits[0]))) + } else if ((8 * sizeof(size_t) - 1 > 3 * PyLong_SHIFT)) { + return (size_t) (((size_t)-1)*(((((((size_t)digits[2]) << PyLong_SHIFT) | (size_t)digits[1]) << PyLong_SHIFT) | (size_t)digits[0]))); + } + } + break; + case 3: + if ((8 * sizeof(size_t) > 2 * PyLong_SHIFT)) { + if ((8 * sizeof(unsigned long) > 3 * PyLong_SHIFT)) { + __PYX_VERIFY_RETURN_INT(size_t, unsigned long, (((((((unsigned long)digits[2]) << PyLong_SHIFT) | (unsigned long)digits[1]) << PyLong_SHIFT) | (unsigned long)digits[0]))) + } else if ((8 * sizeof(size_t) - 1 > 3 * PyLong_SHIFT)) { + return (size_t) ((((((((size_t)digits[2]) << PyLong_SHIFT) | (size_t)digits[1]) << PyLong_SHIFT) | (size_t)digits[0]))); + } + } + break; + case -4: + if ((8 * sizeof(size_t) - 1 > 3 * PyLong_SHIFT)) { + if ((8 * sizeof(unsigned long) > 4 * PyLong_SHIFT)) { + __PYX_VERIFY_RETURN_INT(size_t, long, -(long) (((((((((unsigned long)digits[3]) << PyLong_SHIFT) | (unsigned long)digits[2]) << PyLong_SHIFT) | (unsigned long)digits[1]) << PyLong_SHIFT) | (unsigned long)digits[0]))) + } else if ((8 * sizeof(size_t) - 1 > 4 * PyLong_SHIFT)) { + return (size_t) (((size_t)-1)*(((((((((size_t)digits[3]) << PyLong_SHIFT) | (size_t)digits[2]) << PyLong_SHIFT) | (size_t)digits[1]) << PyLong_SHIFT) | (size_t)digits[0]))); + } + } + break; + case 4: + if ((8 * sizeof(size_t) > 3 * PyLong_SHIFT)) { + if ((8 * sizeof(unsigned long) > 4 * PyLong_SHIFT)) { + __PYX_VERIFY_RETURN_INT(size_t, unsigned long, (((((((((unsigned long)digits[3]) << PyLong_SHIFT) | (unsigned long)digits[2]) << PyLong_SHIFT) | (unsigned long)digits[1]) << PyLong_SHIFT) | (unsigned long)digits[0]))) + } else if ((8 * sizeof(size_t) - 1 > 4 * PyLong_SHIFT)) { + return (size_t) ((((((((((size_t)digits[3]) << PyLong_SHIFT) | (size_t)digits[2]) << PyLong_SHIFT) | (size_t)digits[1]) << PyLong_SHIFT) | (size_t)digits[0]))); + } + } + break; + } + } +#endif + if ((sizeof(size_t) <= sizeof(long))) { + __PYX_VERIFY_RETURN_INT_EXC(size_t, long, PyLong_AsLong(x)) + } else if ((sizeof(size_t) <= sizeof(PY_LONG_LONG))) { + __PYX_VERIFY_RETURN_INT_EXC(size_t, PY_LONG_LONG, PyLong_AsLongLong(x)) + } + } + { + size_t 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 (size_t) -1; + assert(PyLong_CheckExact(v)); + } + { + int result = PyObject_RichCompareBool(v, Py_False, Py_LT); + if (unlikely(result < 0)) { + Py_DECREF(v); + return (size_t) -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 (size_t) -1; + } else { + stepval = v; + } + v = NULL; + val = (size_t) 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(size_t) * 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 |= ((size_t) 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(size_t) * 8) - bits - (is_unsigned ? 0 : 1); + if (unlikely(idigit >= (1L << remaining_bits))) + goto raise_overflow; + val |= ((size_t) idigit) << bits; + } + if (!is_unsigned) { + if (unlikely(val & (((size_t) 1) << (sizeof(size_t) * 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 (size_t) -1; + return val; + } +raise_overflow: + PyErr_SetString(PyExc_OverflowError, + "value too large to convert to size_t"); + return (size_t) -1; +raise_neg_overflow: + PyErr_SetString(PyExc_OverflowError, + "can't convert negative value to size_t"); + return (size_t) -1; +} + +/* PrintOne */ +static int __Pyx_PrintOne(PyObject* stream, PyObject *o) { + int res; + PyObject* arg_tuple = PyTuple_Pack(1, o); + if (unlikely(!arg_tuple)) + return -1; + res = __Pyx_Print(stream, arg_tuple, 1); + Py_DECREF(arg_tuple); + return res; +} + +/* MemviewSliceCopy */ +static __Pyx_memviewslice +__pyx_memoryview_copy_new_contig(const __Pyx_memviewslice *from_mvs, + const char *mode, int ndim, + size_t sizeof_dtype, int contig_flag, + int dtype_is_object) +{ + __Pyx_RefNannyDeclarations + int i; + __Pyx_memviewslice new_mvs = __Pyx_MEMSLICE_INIT; + struct __pyx_memoryview_obj *from_memview = from_mvs->memview; + Py_buffer *buf = &from_memview->view; + PyObject *shape_tuple = NULL; + PyObject *temp_int = NULL; + struct __pyx_array_obj *array_obj = NULL; + struct __pyx_memoryview_obj *memview_obj = NULL; + __Pyx_RefNannySetupContext("__pyx_memoryview_copy_new_contig", 0); + for (i = 0; i < ndim; i++) { + if (unlikely(from_mvs->suboffsets[i] >= 0)) { + PyErr_Format(PyExc_ValueError, "Cannot copy memoryview slice with " + "indirect dimensions (axis %d)", i); + goto fail; + } + } + shape_tuple = PyTuple_New(ndim); + if (unlikely(!shape_tuple)) { + goto fail; + } + __Pyx_GOTREF(shape_tuple); + for(i = 0; i < ndim; i++) { + temp_int = PyLong_FromSsize_t(from_mvs->shape[i]); + if(unlikely(!temp_int)) { + goto fail; + } else { +#if CYTHON_ASSUME_SAFE_MACROS + PyTuple_SET_ITEM(shape_tuple, i, temp_int); +#else + if (PyTuple_SetItem(shape_tuple, i, temp_int) < 0) { + goto fail; + } +#endif + temp_int = NULL; + } + } + array_obj = __pyx_array_new(shape_tuple, sizeof_dtype, buf->format, mode, NULL); + if (unlikely(!array_obj)) { + goto fail; + } + __Pyx_GOTREF(array_obj); + memview_obj = (struct __pyx_memoryview_obj *) __pyx_memoryview_new( + (PyObject *) array_obj, contig_flag, + dtype_is_object, + from_mvs->memview->typeinfo); + if (unlikely(!memview_obj)) + goto fail; + if (unlikely(__Pyx_init_memviewslice(memview_obj, ndim, &new_mvs, 1) < 0)) + goto fail; + if (unlikely(__pyx_memoryview_copy_contents(*from_mvs, new_mvs, ndim, ndim, + dtype_is_object) < 0)) + goto fail; + goto no_fail; +fail: + __Pyx_XDECREF((PyObject *) new_mvs.memview); + new_mvs.memview = NULL; + new_mvs.data = NULL; +no_fail: + __Pyx_XDECREF(shape_tuple); + __Pyx_XDECREF(temp_int); + __Pyx_XDECREF((PyObject *) array_obj); + __Pyx_RefNannyFinishContext(); + return new_mvs; +} + +/* PyObjectCallMethod1 */ +#if !(CYTHON_VECTORCALL && (__PYX_LIMITED_VERSION_HEX >= 0x030C0000 || (!CYTHON_COMPILING_IN_LIMITED_API && PY_VERSION_HEX >= 0x03090000))) +static PyObject* __Pyx__PyObject_CallMethod1(PyObject* method, PyObject* arg) { + PyObject *result = __Pyx_PyObject_CallOneArg(method, arg); + Py_DECREF(method); + return result; +} +#endif +static PyObject* __Pyx_PyObject_CallMethod1(PyObject* obj, PyObject* method_name, PyObject* arg) { +#if CYTHON_VECTORCALL && (__PYX_LIMITED_VERSION_HEX >= 0x030C0000 || (!CYTHON_COMPILING_IN_LIMITED_API && PY_VERSION_HEX >= 0x03090000)) + PyObject *args[2] = {obj, arg}; + (void) __Pyx_PyObject_CallOneArg; + (void) __Pyx_PyObject_Call2Args; + return PyObject_VectorcallMethod(method_name, args, 2 | PY_VECTORCALL_ARGUMENTS_OFFSET, NULL); +#else + PyObject *method = NULL, *result; + int is_method = __Pyx_PyObject_GetMethod(obj, method_name, &method); + if (likely(is_method)) { + result = __Pyx_PyObject_Call2Args(method, obj, arg); + Py_DECREF(method); + return result; + } + if (unlikely(!method)) return NULL; + return __Pyx__PyObject_CallMethod1(method, arg); +#endif +} + +/* UpdateUnpickledDict */ +static int __Pyx__UpdateUnpickledDict(PyObject *obj, PyObject *state, Py_ssize_t index) { + PyObject *state_dict = __Pyx_PySequence_ITEM(state, index); + if (unlikely(!state_dict)) { + return -1; + } + int non_empty = PyObject_IsTrue(state_dict); + if (non_empty == 0) { + Py_DECREF(state_dict); + return 0; + } else if (unlikely(non_empty == -1)) { + return -1; + } + PyObject *dict; + #if CYTHON_COMPILING_IN_LIMITED_API && __PYX_LIMITED_VERSION_HEX < 0x030A0000 + dict = PyObject_GetAttrString(obj, "__dict__"); + #else + dict = PyObject_GenericGetDict(obj, NULL); + #endif + if (unlikely(!dict)) { + Py_DECREF(state_dict); + return -1; + } + int result; + if (likely(PyDict_CheckExact(dict))) { + result = PyDict_Update(dict, state_dict); + } else { + PyObject *obj_result = __Pyx_PyObject_CallMethod1(dict, __pyx_mstate_global->__pyx_n_u_update, state_dict); + if (likely(obj_result)) { + Py_DECREF(obj_result); + result = 0; + } else { + result = -1; + } + } + Py_DECREF(state_dict); + Py_DECREF(dict); + return result; +} +static int __Pyx_UpdateUnpickledDict(PyObject *obj, PyObject *state, Py_ssize_t index) { + Py_ssize_t state_size = __Pyx_PyTuple_GET_SIZE(state); + #if !CYTHON_ASSUME_SAFE_SIZE + if (unlikely(state_size == -1)) return -1; + #endif + if (state_size <= index) { + return 0; + } + return __Pyx__UpdateUnpickledDict(obj, state, index); +} + +/* CIntFromPy */ +static CYTHON_INLINE char __Pyx_PyLong_As_char(PyObject *x) { +#ifdef __Pyx_HAS_GCC_DIAGNOSTIC +#pragma GCC diagnostic push +#pragma GCC diagnostic ignored "-Wconversion" +#endif + const char neg_one = (char) -1, const_zero = (char) 0; +#ifdef __Pyx_HAS_GCC_DIAGNOSTIC +#pragma GCC diagnostic pop +#endif + const int is_unsigned = neg_one > const_zero; + if (unlikely(!PyLong_Check(x))) { + char val; + PyObject *tmp = __Pyx_PyNumber_Long(x); + if (!tmp) return (char) -1; + val = __Pyx_PyLong_As_char(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(char, __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(char) > 1 * PyLong_SHIFT)) { + if ((8 * sizeof(unsigned long) > 2 * PyLong_SHIFT)) { + __PYX_VERIFY_RETURN_INT(char, unsigned long, (((((unsigned long)digits[1]) << PyLong_SHIFT) | (unsigned long)digits[0]))) + } else if ((8 * sizeof(char) >= 2 * PyLong_SHIFT)) { + return (char) (((((char)digits[1]) << PyLong_SHIFT) | (char)digits[0])); + } + } + break; + case 3: + if ((8 * sizeof(char) > 2 * PyLong_SHIFT)) { + if ((8 * sizeof(unsigned long) > 3 * PyLong_SHIFT)) { + __PYX_VERIFY_RETURN_INT(char, unsigned long, (((((((unsigned long)digits[2]) << PyLong_SHIFT) | (unsigned long)digits[1]) << PyLong_SHIFT) | (unsigned long)digits[0]))) + } else if ((8 * sizeof(char) >= 3 * PyLong_SHIFT)) { + return (char) (((((((char)digits[2]) << PyLong_SHIFT) | (char)digits[1]) << PyLong_SHIFT) | (char)digits[0])); + } + } + break; + case 4: + if ((8 * sizeof(char) > 3 * PyLong_SHIFT)) { + if ((8 * sizeof(unsigned long) > 4 * PyLong_SHIFT)) { + __PYX_VERIFY_RETURN_INT(char, 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(char) >= 4 * PyLong_SHIFT)) { + return (char) (((((((((char)digits[3]) << PyLong_SHIFT) | (char)digits[2]) << PyLong_SHIFT) | (char)digits[1]) << PyLong_SHIFT) | (char)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 (char) -1; + if (unlikely(result == 1)) + goto raise_neg_overflow; + } +#endif + if ((sizeof(char) <= sizeof(unsigned long))) { + __PYX_VERIFY_RETURN_INT_EXC(char, unsigned long, PyLong_AsUnsignedLong(x)) + } else if ((sizeof(char) <= sizeof(unsigned PY_LONG_LONG))) { + __PYX_VERIFY_RETURN_INT_EXC(char, unsigned PY_LONG_LONG, PyLong_AsUnsignedLongLong(x)) + } + } else { +#if CYTHON_USE_PYLONG_INTERNALS + if (__Pyx_PyLong_IsCompact(x)) { + __PYX_VERIFY_RETURN_INT(char, __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(char) - 1 > 1 * PyLong_SHIFT)) { + if ((8 * sizeof(unsigned long) > 2 * PyLong_SHIFT)) { + __PYX_VERIFY_RETURN_INT(char, long, -(long) (((((unsigned long)digits[1]) << PyLong_SHIFT) | (unsigned long)digits[0]))) + } else if ((8 * sizeof(char) - 1 > 2 * PyLong_SHIFT)) { + return (char) (((char)-1)*(((((char)digits[1]) << PyLong_SHIFT) | (char)digits[0]))); + } + } + break; + case 2: + if ((8 * sizeof(char) > 1 * PyLong_SHIFT)) { + if ((8 * sizeof(unsigned long) > 2 * PyLong_SHIFT)) { + __PYX_VERIFY_RETURN_INT(char, unsigned long, (((((unsigned long)digits[1]) << PyLong_SHIFT) | (unsigned long)digits[0]))) + } else if ((8 * sizeof(char) - 1 > 2 * PyLong_SHIFT)) { + return (char) ((((((char)digits[1]) << PyLong_SHIFT) | (char)digits[0]))); + } + } + break; + case -3: + if ((8 * sizeof(char) - 1 > 2 * PyLong_SHIFT)) { + if ((8 * sizeof(unsigned long) > 3 * PyLong_SHIFT)) { + __PYX_VERIFY_RETURN_INT(char, long, -(long) (((((((unsigned long)digits[2]) << PyLong_SHIFT) | (unsigned long)digits[1]) << PyLong_SHIFT) | (unsigned long)digits[0]))) + } else if ((8 * sizeof(char) - 1 > 3 * PyLong_SHIFT)) { + return (char) (((char)-1)*(((((((char)digits[2]) << PyLong_SHIFT) | (char)digits[1]) << PyLong_SHIFT) | (char)digits[0]))); + } + } + break; + case 3: + if ((8 * sizeof(char) > 2 * PyLong_SHIFT)) { + if ((8 * sizeof(unsigned long) > 3 * PyLong_SHIFT)) { + __PYX_VERIFY_RETURN_INT(char, unsigned long, (((((((unsigned long)digits[2]) << PyLong_SHIFT) | (unsigned long)digits[1]) << PyLong_SHIFT) | (unsigned long)digits[0]))) + } else if ((8 * sizeof(char) - 1 > 3 * PyLong_SHIFT)) { + return (char) ((((((((char)digits[2]) << PyLong_SHIFT) | (char)digits[1]) << PyLong_SHIFT) | (char)digits[0]))); + } + } + break; + case -4: + if ((8 * sizeof(char) - 1 > 3 * PyLong_SHIFT)) { + if ((8 * sizeof(unsigned long) > 4 * PyLong_SHIFT)) { + __PYX_VERIFY_RETURN_INT(char, 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(char) - 1 > 4 * PyLong_SHIFT)) { + return (char) (((char)-1)*(((((((((char)digits[3]) << PyLong_SHIFT) | (char)digits[2]) << PyLong_SHIFT) | (char)digits[1]) << PyLong_SHIFT) | (char)digits[0]))); + } + } + break; + case 4: + if ((8 * sizeof(char) > 3 * PyLong_SHIFT)) { + if ((8 * sizeof(unsigned long) > 4 * PyLong_SHIFT)) { + __PYX_VERIFY_RETURN_INT(char, 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(char) - 1 > 4 * PyLong_SHIFT)) { + return (char) ((((((((((char)digits[3]) << PyLong_SHIFT) | (char)digits[2]) << PyLong_SHIFT) | (char)digits[1]) << PyLong_SHIFT) | (char)digits[0]))); + } + } + break; + } + } +#endif + if ((sizeof(char) <= sizeof(long))) { + __PYX_VERIFY_RETURN_INT_EXC(char, long, PyLong_AsLong(x)) + } else if ((sizeof(char) <= sizeof(PY_LONG_LONG))) { + __PYX_VERIFY_RETURN_INT_EXC(char, PY_LONG_LONG, PyLong_AsLongLong(x)) + } + } + { + char 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 (char) -1; + assert(PyLong_CheckExact(v)); + } + { + int result = PyObject_RichCompareBool(v, Py_False, Py_LT); + if (unlikely(result < 0)) { + Py_DECREF(v); + return (char) -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 (char) -1; + } else { + stepval = v; + } + v = NULL; + val = (char) 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(char) * 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 |= ((char) 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(char) * 8) - bits - (is_unsigned ? 0 : 1); + if (unlikely(idigit >= (1L << remaining_bits))) + goto raise_overflow; + val |= ((char) idigit) << bits; + } + if (!is_unsigned) { + if (unlikely(val & (((char) 1) << (sizeof(char) * 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 (char) -1; + return val; + } +raise_overflow: + PyErr_SetString(PyExc_OverflowError, + "value too large to convert to char"); + return (char) -1; +raise_neg_overflow: + PyErr_SetString(PyExc_OverflowError, + "can't convert negative value to char"); + return (char) -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__10); + } + goto done; +} +#endif + +/* GetRuntimeVersion */ +#if __PYX_LIMITED_VERSION_HEX < 0x030b0000 +void __Pyx_init_runtime_version(void) { + if (__Pyx_cached_runtime_version == 0) { + const char* rt_version = Py_GetVersion(); + unsigned long version = 0; + unsigned long factor = 0x01000000UL; + unsigned int digit = 0; + int i = 0; + while (factor) { + while ('0' <= rt_version[i] && rt_version[i] <= '9') { + digit = digit * 10 + (unsigned int) (rt_version[i] - '0'); + ++i; + } + version += factor * digit; + if (rt_version[i] != '.') + break; + digit = 0; + factor >>= 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 +} + +/* IterNextPlain (used by CoroutineBase) */ +#if CYTHON_COMPILING_IN_LIMITED_API && __PYX_LIMITED_VERSION_HEX < 0x030A0000 +static PyObject *__Pyx_GetBuiltinNext_LimitedAPI(void) { + if (unlikely(!__pyx_mstate_global->__Pyx_GetBuiltinNext_LimitedAPI_cache)) + __pyx_mstate_global->__Pyx_GetBuiltinNext_LimitedAPI_cache = __Pyx_GetBuiltinName(__pyx_mstate_global->__pyx_n_u_next); + return __pyx_mstate_global->__Pyx_GetBuiltinNext_LimitedAPI_cache; +} +#endif +static CYTHON_INLINE PyObject *__Pyx_PyIter_Next_Plain(PyObject *iterator) { +#if CYTHON_COMPILING_IN_LIMITED_API && __PYX_LIMITED_VERSION_HEX < 0x030A0000 + PyObject *result; + PyObject *next = __Pyx_GetBuiltinNext_LimitedAPI(); + if (unlikely(!next)) return NULL; + result = PyObject_CallFunctionObjArgs(next, iterator, NULL); + return result; +#else + (void)__Pyx_GetBuiltinName; // only for early limited API + iternextfunc iternext = __Pyx_PyObject_GetIterNextFunc(iterator); + assert(iternext); + return iternext(iterator); +#endif +} + +/* ReturnWithStopIteration (used by CoroutineBase) */ +static void __Pyx__ReturnWithStopIteration(PyObject* value, int async); +static CYTHON_INLINE void __Pyx_ReturnWithStopIteration(PyObject* value, int async, int iternext) { + if (value == Py_None) { + if (async || !iternext) + PyErr_SetNone(async ? PyExc_StopAsyncIteration : PyExc_StopIteration); + return; + } + __Pyx__ReturnWithStopIteration(value, async); +} +static void __Pyx__ReturnWithStopIteration(PyObject* value, int async) { +#if CYTHON_COMPILING_IN_CPYTHON + __Pyx_PyThreadState_declare +#endif + PyObject *exc; + PyObject *exc_type = async ? PyExc_StopAsyncIteration : PyExc_StopIteration; +#if CYTHON_COMPILING_IN_CPYTHON + if ((PY_VERSION_HEX >= (0x030C00A6)) || unlikely(PyTuple_Check(value) || PyExceptionInstance_Check(value))) { + if (PY_VERSION_HEX >= (0x030e00A1)) { + exc = __Pyx_PyObject_CallOneArg(exc_type, value); + } else { + PyObject *args_tuple = PyTuple_New(1); + if (unlikely(!args_tuple)) return; + Py_INCREF(value); + PyTuple_SET_ITEM(args_tuple, 0, value); + exc = PyObject_Call(exc_type, args_tuple, NULL); + Py_DECREF(args_tuple); + } + if (unlikely(!exc)) return; + } else { + Py_INCREF(value); + exc = value; + } + #if CYTHON_FAST_THREAD_STATE + __Pyx_PyThreadState_assign + #if CYTHON_USE_EXC_INFO_STACK + if (!__pyx_tstate->exc_info->exc_value) + #else + if (!__pyx_tstate->exc_type) + #endif + { + Py_INCREF(exc_type); + __Pyx_ErrRestore(exc_type, exc, NULL); + return; + } + #endif +#else + exc = __Pyx_PyObject_CallOneArg(exc_type, value); + if (unlikely(!exc)) return; +#endif + PyErr_SetObject(exc_type, exc); + Py_DECREF(exc); +} + +/* CoroutineBase (used by Generator) */ +#if !CYTHON_COMPILING_IN_LIMITED_API +#include +#if PY_VERSION_HEX >= 0x030b00a6 && !defined(PYPY_VERSION) + #ifndef Py_BUILD_CORE + #define Py_BUILD_CORE 1 + #endif + #include "internal/pycore_frame.h" +#endif +#endif // CYTHON_COMPILING_IN_LIMITED_API +static CYTHON_INLINE void +__Pyx_Coroutine_Undelegate(__pyx_CoroutineObject *gen) { +#if CYTHON_USE_AM_SEND + gen->yieldfrom_am_send = NULL; +#endif + Py_CLEAR(gen->yieldfrom); +} +static int __Pyx_PyGen__FetchStopIterationValue(PyThreadState *__pyx_tstate, PyObject **pvalue) { + PyObject *et, *ev, *tb; + PyObject *value = NULL; + CYTHON_UNUSED_VAR(__pyx_tstate); + __Pyx_ErrFetch(&et, &ev, &tb); + if (!et) { + Py_XDECREF(tb); + Py_XDECREF(ev); + Py_INCREF(Py_None); + *pvalue = Py_None; + return 0; + } + if (likely(et == PyExc_StopIteration)) { + if (!ev) { + Py_INCREF(Py_None); + value = Py_None; + } + else if (likely(__Pyx_IS_TYPE(ev, (PyTypeObject*)PyExc_StopIteration))) { + #if CYTHON_COMPILING_IN_LIMITED_API || CYTHON_COMPILING_IN_GRAAL + value = PyObject_GetAttr(ev, __pyx_mstate_global->__pyx_n_u_value); + if (unlikely(!value)) goto limited_api_failure; + #else + value = ((PyStopIterationObject *)ev)->value; + Py_INCREF(value); + #endif + Py_DECREF(ev); + } + else if (unlikely(PyTuple_Check(ev))) { + Py_ssize_t tuple_size = __Pyx_PyTuple_GET_SIZE(ev); + #if !CYTHON_ASSUME_SAFE_SIZE + if (unlikely(tuple_size < 0)) { + Py_XDECREF(tb); + Py_DECREF(ev); + Py_DECREF(et); + return -1; + } + #endif + if (tuple_size >= 1) { +#if CYTHON_ASSUME_SAFE_MACROS && !CYTHON_AVOID_BORROWED_REFS + value = PyTuple_GET_ITEM(ev, 0); + Py_INCREF(value); +#elif CYTHON_ASSUME_SAFE_MACROS + value = PySequence_ITEM(ev, 0); +#else + value = PySequence_GetItem(ev, 0); + if (!value) goto limited_api_failure; +#endif + } else { + Py_INCREF(Py_None); + value = Py_None; + } + Py_DECREF(ev); + } + else if (!__Pyx_TypeCheck(ev, (PyTypeObject*)PyExc_StopIteration)) { + value = ev; + } + if (likely(value)) { + Py_XDECREF(tb); + Py_DECREF(et); + *pvalue = value; + return 0; + } + } else if (!__Pyx_PyErr_GivenExceptionMatches(et, PyExc_StopIteration)) { + __Pyx_ErrRestore(et, ev, tb); + return -1; + } + PyErr_NormalizeException(&et, &ev, &tb); + if (unlikely(!PyObject_TypeCheck(ev, (PyTypeObject*)PyExc_StopIteration))) { + __Pyx_ErrRestore(et, ev, tb); + return -1; + } + Py_XDECREF(tb); + Py_DECREF(et); +#if CYTHON_COMPILING_IN_LIMITED_API + value = PyObject_GetAttr(ev, __pyx_mstate_global->__pyx_n_u_value); +#else + value = ((PyStopIterationObject *)ev)->value; + Py_INCREF(value); +#endif + Py_DECREF(ev); +#if CYTHON_COMPILING_IN_LIMITED_API + if (unlikely(!value)) return -1; +#endif + *pvalue = value; + return 0; +#if CYTHON_COMPILING_IN_LIMITED_API || CYTHON_COMPILING_IN_GRAAL || !CYTHON_ASSUME_SAFE_MACROS + limited_api_failure: + Py_XDECREF(et); + Py_XDECREF(tb); + Py_XDECREF(ev); + return -1; +#endif +} +static CYTHON_INLINE +__Pyx_PySendResult __Pyx_Coroutine_status_from_result(PyObject **retval) { + if (*retval) { + return PYGEN_NEXT; + } else if (likely(__Pyx_PyGen__FetchStopIterationValue(__Pyx_PyThreadState_Current, retval) == 0)) { + return PYGEN_RETURN; + } else { + return PYGEN_ERROR; + } +} +static CYTHON_INLINE +void __Pyx_Coroutine_ExceptionClear(__Pyx_ExcInfoStruct *exc_state) { +#if PY_VERSION_HEX >= 0x030B00a4 + Py_CLEAR(exc_state->exc_value); +#else + PyObject *t, *v, *tb; + t = exc_state->exc_type; + v = exc_state->exc_value; + tb = exc_state->exc_traceback; + exc_state->exc_type = NULL; + exc_state->exc_value = NULL; + exc_state->exc_traceback = NULL; + Py_XDECREF(t); + Py_XDECREF(v); + Py_XDECREF(tb); +#endif +} +#define __Pyx_Coroutine_AlreadyRunningError(gen) (__Pyx__Coroutine_AlreadyRunningError(gen), (PyObject*)NULL) +static void __Pyx__Coroutine_AlreadyRunningError(__pyx_CoroutineObject *gen) { + const char *msg; + CYTHON_MAYBE_UNUSED_VAR(gen); + if ((0)) { + #ifdef __Pyx_Coroutine_USED + } else if (__Pyx_Coroutine_Check((PyObject*)gen)) { + msg = "coroutine already executing"; + #endif + #ifdef __Pyx_AsyncGen_USED + } else if (__Pyx_AsyncGen_CheckExact((PyObject*)gen)) { + msg = "async generator already executing"; + #endif + } else { + msg = "generator already executing"; + } + PyErr_SetString(PyExc_ValueError, msg); +} +static void __Pyx_Coroutine_AlreadyTerminatedError(PyObject *gen, PyObject *value, int closing) { + CYTHON_MAYBE_UNUSED_VAR(gen); + CYTHON_MAYBE_UNUSED_VAR(closing); + #ifdef __Pyx_Coroutine_USED + if (!closing && __Pyx_Coroutine_Check(gen)) { + PyErr_SetString(PyExc_RuntimeError, "cannot reuse already awaited coroutine"); + } else + #endif + if (value) { + #ifdef __Pyx_AsyncGen_USED + if (__Pyx_AsyncGen_CheckExact(gen)) + PyErr_SetNone(PyExc_StopAsyncIteration); + else + #endif + PyErr_SetNone(PyExc_StopIteration); + } +} +static +__Pyx_PySendResult __Pyx_Coroutine_SendEx(__pyx_CoroutineObject *self, PyObject *value, PyObject **result, int closing) { + __Pyx_PyThreadState_declare + PyThreadState *tstate; + __Pyx_ExcInfoStruct *exc_state; + PyObject *retval; + assert(__Pyx_Coroutine_get_is_running(self)); // Callers should ensure is_running + if (unlikely(self->resume_label == -1)) { + __Pyx_Coroutine_AlreadyTerminatedError((PyObject*)self, value, closing); + return PYGEN_ERROR; + } +#if CYTHON_FAST_THREAD_STATE + __Pyx_PyThreadState_assign + tstate = __pyx_tstate; +#else + tstate = __Pyx_PyThreadState_Current; +#endif + exc_state = &self->gi_exc_state; + if (exc_state->exc_value) { + #if CYTHON_COMPILING_IN_LIMITED_API || CYTHON_COMPILING_IN_PYPY + #else + PyObject *exc_tb; + #if PY_VERSION_HEX >= 0x030B00a4 && !CYTHON_COMPILING_IN_CPYTHON + exc_tb = PyException_GetTraceback(exc_state->exc_value); + #elif PY_VERSION_HEX >= 0x030B00a4 + exc_tb = ((PyBaseExceptionObject*) exc_state->exc_value)->traceback; + #else + exc_tb = exc_state->exc_traceback; + #endif + if (exc_tb) { + PyTracebackObject *tb = (PyTracebackObject *) exc_tb; + PyFrameObject *f = tb->tb_frame; + assert(f->f_back == NULL); + #if PY_VERSION_HEX >= 0x030B00A1 + f->f_back = PyThreadState_GetFrame(tstate); + #else + Py_XINCREF(tstate->frame); + f->f_back = tstate->frame; + #endif + #if PY_VERSION_HEX >= 0x030B00a4 && !CYTHON_COMPILING_IN_CPYTHON + Py_DECREF(exc_tb); + #endif + } + #endif + } +#if CYTHON_USE_EXC_INFO_STACK + exc_state->previous_item = tstate->exc_info; + tstate->exc_info = exc_state; +#else + if (exc_state->exc_type) { + __Pyx_ExceptionSwap(&exc_state->exc_type, &exc_state->exc_value, &exc_state->exc_traceback); + } else { + __Pyx_Coroutine_ExceptionClear(exc_state); + __Pyx_ExceptionSave(&exc_state->exc_type, &exc_state->exc_value, &exc_state->exc_traceback); + } +#endif + retval = self->body(self, tstate, value); +#if CYTHON_USE_EXC_INFO_STACK + exc_state = &self->gi_exc_state; + tstate->exc_info = exc_state->previous_item; + exc_state->previous_item = NULL; + __Pyx_Coroutine_ResetFrameBackpointer(exc_state); +#endif + *result = retval; + if (self->resume_label == -1) { + return likely(retval) ? PYGEN_RETURN : PYGEN_ERROR; + } + return PYGEN_NEXT; +} +static CYTHON_INLINE void __Pyx_Coroutine_ResetFrameBackpointer(__Pyx_ExcInfoStruct *exc_state) { +#if CYTHON_COMPILING_IN_PYPY || CYTHON_COMPILING_IN_LIMITED_API + CYTHON_UNUSED_VAR(exc_state); +#else + PyObject *exc_tb; + #if PY_VERSION_HEX >= 0x030B00a4 + if (!exc_state->exc_value) return; + exc_tb = PyException_GetTraceback(exc_state->exc_value); + #else + exc_tb = exc_state->exc_traceback; + #endif + if (likely(exc_tb)) { + PyTracebackObject *tb = (PyTracebackObject *) exc_tb; + PyFrameObject *f = tb->tb_frame; + Py_CLEAR(f->f_back); + #if PY_VERSION_HEX >= 0x030B00a4 + Py_DECREF(exc_tb); + #endif + } +#endif +} +#define __Pyx_Coroutine_MethodReturnFromResult(gen, result, retval, iternext)\ + ((result) == PYGEN_NEXT ? (retval) : __Pyx__Coroutine_MethodReturnFromResult(gen, result, retval, iternext)) +static PyObject * +__Pyx__Coroutine_MethodReturnFromResult(PyObject* gen, __Pyx_PySendResult result, PyObject *retval, int iternext) { + CYTHON_MAYBE_UNUSED_VAR(gen); + if (likely(result == PYGEN_RETURN)) { + int is_async = 0; + #ifdef __Pyx_AsyncGen_USED + is_async = __Pyx_AsyncGen_CheckExact(gen); + #endif + __Pyx_ReturnWithStopIteration(retval, is_async, iternext); + Py_XDECREF(retval); + } + return NULL; +} +#if CYTHON_COMPILING_IN_CPYTHON +static CYTHON_INLINE +PyObject *__Pyx_PyGen_Send(PyGenObject *gen, PyObject *arg) { +#if PY_VERSION_HEX <= 0x030A00A1 + return _PyGen_Send(gen, arg); +#else + PyObject *result; + if (PyIter_Send((PyObject*)gen, arg ? arg : Py_None, &result) == PYGEN_RETURN) { + if (PyAsyncGen_CheckExact(gen)) { + assert(result == Py_None); + PyErr_SetNone(PyExc_StopAsyncIteration); + } + else if (result == Py_None) { + PyErr_SetNone(PyExc_StopIteration); + } + else { +#if PY_VERSION_HEX < 0x030d00A1 + _PyGen_SetStopIterationValue(result); +#else + if (!PyTuple_Check(result) && !PyExceptionInstance_Check(result)) { + PyErr_SetObject(PyExc_StopIteration, result); + } else { + PyObject *exc = __Pyx_PyObject_CallOneArg(PyExc_StopIteration, result); + if (likely(exc != NULL)) { + PyErr_SetObject(PyExc_StopIteration, exc); + Py_DECREF(exc); + } + } +#endif + } + Py_DECREF(result); + result = NULL; + } + return result; +#endif +} +#endif +static CYTHON_INLINE __Pyx_PySendResult +__Pyx_Coroutine_FinishDelegation(__pyx_CoroutineObject *gen, PyObject** retval) { + __Pyx_PySendResult result; + PyObject *val = NULL; + assert(__Pyx_Coroutine_get_is_running(gen)); + __Pyx_Coroutine_Undelegate(gen); + __Pyx_PyGen__FetchStopIterationValue(__Pyx_PyThreadState_Current, &val); + result = __Pyx_Coroutine_SendEx(gen, val, retval, 0); + Py_XDECREF(val); + return result; +} +#if CYTHON_USE_AM_SEND +static __Pyx_PySendResult +__Pyx_Coroutine_SendToDelegate(__pyx_CoroutineObject *gen, __Pyx_pyiter_sendfunc gen_am_send, PyObject *value, PyObject **retval) { + PyObject *ret = NULL; + __Pyx_PySendResult delegate_result, result; + assert(__Pyx_Coroutine_get_is_running(gen)); + delegate_result = gen_am_send(gen->yieldfrom, value, &ret); + if (delegate_result == PYGEN_NEXT) { + assert (ret != NULL); + *retval = ret; + return PYGEN_NEXT; + } + assert (delegate_result != PYGEN_ERROR || ret == NULL); + __Pyx_Coroutine_Undelegate(gen); + result = __Pyx_Coroutine_SendEx(gen, ret, retval, 0); + Py_XDECREF(ret); + return result; +} +#endif +static PyObject *__Pyx_Coroutine_Send(PyObject *self, PyObject *value) { + PyObject *retval = NULL; + __Pyx_PySendResult result = __Pyx_Coroutine_AmSend(self, value, &retval); + return __Pyx_Coroutine_MethodReturnFromResult(self, result, retval, 0); +} +static __Pyx_PySendResult +__Pyx_Coroutine_AmSend(PyObject *self, PyObject *value, PyObject **retval) { + __Pyx_PySendResult result; + __pyx_CoroutineObject *gen = (__pyx_CoroutineObject*) self; + if (unlikely(__Pyx_Coroutine_test_and_set_is_running(gen))) { + *retval = __Pyx_Coroutine_AlreadyRunningError(gen); + return PYGEN_ERROR; + } + #if CYTHON_USE_AM_SEND + if (gen->yieldfrom_am_send) { + result = __Pyx_Coroutine_SendToDelegate(gen, gen->yieldfrom_am_send, value, retval); + } else + #endif + if (gen->yieldfrom) { + PyObject *yf = gen->yieldfrom; + PyObject *ret; + #if !CYTHON_USE_AM_SEND + #ifdef __Pyx_Generator_USED + if (__Pyx_Generator_CheckExact(yf)) { + ret = __Pyx_Coroutine_Send(yf, value); + } else + #endif + #ifdef __Pyx_Coroutine_USED + if (__Pyx_Coroutine_Check(yf)) { + ret = __Pyx_Coroutine_Send(yf, value); + } else + #endif + #ifdef __Pyx_AsyncGen_USED + if (__pyx_PyAsyncGenASend_CheckExact(yf)) { + ret = __Pyx_async_gen_asend_send(yf, value); + } else + #endif + #if CYTHON_COMPILING_IN_CPYTHON + if (PyGen_CheckExact(yf)) { + ret = __Pyx_PyGen_Send((PyGenObject*)yf, value == Py_None ? NULL : value); + } else + if (PyCoro_CheckExact(yf)) { + ret = __Pyx_PyGen_Send((PyGenObject*)yf, value == Py_None ? NULL : value); + } else + #endif + #endif + { + #if !CYTHON_COMPILING_IN_LIMITED_API || __PYX_LIMITED_VERSION_HEX >= 0x03080000 + if (value == Py_None && PyIter_Check(yf)) + ret = __Pyx_PyIter_Next_Plain(yf); + else + #endif + ret = __Pyx_PyObject_CallMethod1(yf, __pyx_mstate_global->__pyx_n_u_send, value); + } + if (likely(ret)) { + __Pyx_Coroutine_unset_is_running(gen); + *retval = ret; + return PYGEN_NEXT; + } + result = __Pyx_Coroutine_FinishDelegation(gen, retval); + } else { + result = __Pyx_Coroutine_SendEx(gen, value, retval, 0); + } + __Pyx_Coroutine_unset_is_running(gen); + return result; +} +static int __Pyx_Coroutine_CloseIter(__pyx_CoroutineObject *gen, PyObject *yf) { + __Pyx_PySendResult result; + PyObject *retval = NULL; + CYTHON_UNUSED_VAR(gen); + assert(__Pyx_Coroutine_get_is_running(gen)); + #ifdef __Pyx_Generator_USED + if (__Pyx_Generator_CheckExact(yf)) { + result = __Pyx_Coroutine_Close(yf, &retval); + } else + #endif + #ifdef __Pyx_Coroutine_USED + if (__Pyx_Coroutine_Check(yf)) { + result = __Pyx_Coroutine_Close(yf, &retval); + } else + if (__Pyx_CoroutineAwait_CheckExact(yf)) { + result = __Pyx_CoroutineAwait_Close((__pyx_CoroutineAwaitObject*)yf); + } else + #endif + #ifdef __Pyx_AsyncGen_USED + if (__pyx_PyAsyncGenASend_CheckExact(yf)) { + retval = __Pyx_async_gen_asend_close(yf, NULL); + result = PYGEN_RETURN; + } else + if (__pyx_PyAsyncGenAThrow_CheckExact(yf)) { + retval = __Pyx_async_gen_athrow_close(yf, NULL); + result = PYGEN_RETURN; + } else + #endif + { + PyObject *meth; + result = PYGEN_RETURN; + meth = __Pyx_PyObject_GetAttrStrNoError(yf, __pyx_mstate_global->__pyx_n_u_close); + if (unlikely(!meth)) { + if (unlikely(PyErr_Occurred())) { + PyErr_WriteUnraisable(yf); + } + } else { + retval = __Pyx_PyObject_CallNoArg(meth); + Py_DECREF(meth); + if (unlikely(!retval)) { + result = PYGEN_ERROR; + } + } + } + Py_XDECREF(retval); + return result == PYGEN_ERROR ? -1 : 0; +} +static PyObject *__Pyx_Generator_Next(PyObject *self) { + __Pyx_PySendResult result; + PyObject *retval = NULL; + __pyx_CoroutineObject *gen = (__pyx_CoroutineObject*) self; + if (unlikely(__Pyx_Coroutine_test_and_set_is_running(gen))) { + return __Pyx_Coroutine_AlreadyRunningError(gen); + } + #if CYTHON_USE_AM_SEND + if (gen->yieldfrom_am_send) { + result = __Pyx_Coroutine_SendToDelegate(gen, gen->yieldfrom_am_send, Py_None, &retval); + } else + #endif + if (gen->yieldfrom) { + PyObject *yf = gen->yieldfrom; + PyObject *ret; + #ifdef __Pyx_Generator_USED + if (__Pyx_Generator_CheckExact(yf)) { + ret = __Pyx_Generator_Next(yf); + } else + #endif + #ifdef __Pyx_Coroutine_USED + if (__Pyx_Coroutine_CheckExact(yf)) { + ret = __Pyx_Coroutine_Send(yf, Py_None); + } else + #endif + #if CYTHON_COMPILING_IN_CPYTHON && (PY_VERSION_HEX < 0x030A00A3 || !CYTHON_USE_AM_SEND) + if (PyGen_CheckExact(yf)) { + ret = __Pyx_PyGen_Send((PyGenObject*)yf, NULL); + } else + #endif + ret = __Pyx_PyIter_Next_Plain(yf); + if (likely(ret)) { + __Pyx_Coroutine_unset_is_running(gen); + return ret; + } + result = __Pyx_Coroutine_FinishDelegation(gen, &retval); + } else { + result = __Pyx_Coroutine_SendEx(gen, Py_None, &retval, 0); + } + __Pyx_Coroutine_unset_is_running(gen); + return __Pyx_Coroutine_MethodReturnFromResult(self, result, retval, 1); +} +static PyObject *__Pyx_Coroutine_Close_Method(PyObject *self, PyObject *arg) { + PyObject *retval = NULL; + __Pyx_PySendResult result; + CYTHON_UNUSED_VAR(arg); + result = __Pyx_Coroutine_Close(self, &retval); + if (unlikely(result == PYGEN_ERROR)) + return NULL; + Py_XDECREF(retval); + Py_RETURN_NONE; +} +static __Pyx_PySendResult +__Pyx_Coroutine_Close(PyObject *self, PyObject **retval) { + __pyx_CoroutineObject *gen = (__pyx_CoroutineObject *) self; + __Pyx_PySendResult result; + PyObject *yf; + int err = 0; + if (unlikely(__Pyx_Coroutine_test_and_set_is_running(gen))) { + *retval = __Pyx_Coroutine_AlreadyRunningError(gen); + return PYGEN_ERROR; + } + yf = gen->yieldfrom; + if (yf) { + Py_INCREF(yf); + err = __Pyx_Coroutine_CloseIter(gen, yf); + __Pyx_Coroutine_Undelegate(gen); + Py_DECREF(yf); + } + if (err == 0) + PyErr_SetNone(PyExc_GeneratorExit); + result = __Pyx_Coroutine_SendEx(gen, NULL, retval, 1); + if (result == PYGEN_ERROR) { + __Pyx_PyThreadState_declare + __Pyx_PyThreadState_assign + __Pyx_Coroutine_unset_is_running(gen); + if (!__Pyx_PyErr_Occurred()) { + return PYGEN_RETURN; + } else if (likely(__Pyx_PyErr_ExceptionMatches2(PyExc_GeneratorExit, PyExc_StopIteration))) { + __Pyx_PyErr_Clear(); + return PYGEN_RETURN; + } + return PYGEN_ERROR; + } else if (likely(result == PYGEN_RETURN && *retval == Py_None)) { + __Pyx_Coroutine_unset_is_running(gen); + return PYGEN_RETURN; + } else { + const char *msg; + Py_DECREF(*retval); + *retval = NULL; + if ((0)) { + #ifdef __Pyx_Coroutine_USED + } else if (__Pyx_Coroutine_Check(self)) { + msg = "coroutine ignored GeneratorExit"; + #endif + #ifdef __Pyx_AsyncGen_USED + } else if (__Pyx_AsyncGen_CheckExact(self)) { + msg = "async generator ignored GeneratorExit"; + #endif + } else { + msg = "generator ignored GeneratorExit"; + } + PyErr_SetString(PyExc_RuntimeError, msg); + __Pyx_Coroutine_unset_is_running(gen); + return PYGEN_ERROR; + } +} +static PyObject *__Pyx__Coroutine_Throw(PyObject *self, PyObject *typ, PyObject *val, PyObject *tb, + PyObject *args, int close_on_genexit) { + __pyx_CoroutineObject *gen = (__pyx_CoroutineObject *) self; + PyObject *yf; + if (unlikely(__Pyx_Coroutine_test_and_set_is_running(gen))) + return __Pyx_Coroutine_AlreadyRunningError(gen); + yf = gen->yieldfrom; + if (yf) { + __Pyx_PySendResult result; + PyObject *ret; + Py_INCREF(yf); + if (__Pyx_PyErr_GivenExceptionMatches(typ, PyExc_GeneratorExit) && close_on_genexit) { + int err = __Pyx_Coroutine_CloseIter(gen, yf); + Py_DECREF(yf); + __Pyx_Coroutine_Undelegate(gen); + if (err < 0) + goto propagate_exception; + goto throw_here; + } + if (0 + #ifdef __Pyx_Generator_USED + || __Pyx_Generator_CheckExact(yf) + #endif + #ifdef __Pyx_Coroutine_USED + || __Pyx_Coroutine_Check(yf) + #endif + ) { + ret = __Pyx__Coroutine_Throw(yf, typ, val, tb, args, close_on_genexit); + #ifdef __Pyx_Coroutine_USED + } else if (__Pyx_CoroutineAwait_CheckExact(yf)) { + ret = __Pyx__Coroutine_Throw(((__pyx_CoroutineAwaitObject*)yf)->coroutine, typ, val, tb, args, close_on_genexit); + #endif + } else { + PyObject *meth = __Pyx_PyObject_GetAttrStrNoError(yf, __pyx_mstate_global->__pyx_n_u_throw); + if (unlikely(!meth)) { + Py_DECREF(yf); + if (unlikely(PyErr_Occurred())) { + __Pyx_Coroutine_unset_is_running(gen); + return NULL; + } + __Pyx_Coroutine_Undelegate(gen); + goto throw_here; + } + if (likely(args)) { + ret = __Pyx_PyObject_Call(meth, args, NULL); + } else { + PyObject *cargs[4] = {NULL, typ, val, tb}; + ret = __Pyx_PyObject_FastCall(meth, cargs+1, 3 | __Pyx_PY_VECTORCALL_ARGUMENTS_OFFSET); + } + Py_DECREF(meth); + } + Py_DECREF(yf); + if (ret) { + __Pyx_Coroutine_unset_is_running(gen); + return ret; + } + result = __Pyx_Coroutine_FinishDelegation(gen, &ret); + __Pyx_Coroutine_unset_is_running(gen); + return __Pyx_Coroutine_MethodReturnFromResult(self, result, ret, 0); + } +throw_here: + __Pyx_Raise(typ, val, tb, NULL); +propagate_exception: + { + PyObject *retval = NULL; + __Pyx_PySendResult result = __Pyx_Coroutine_SendEx(gen, NULL, &retval, 0); + __Pyx_Coroutine_unset_is_running(gen); + return __Pyx_Coroutine_MethodReturnFromResult(self, result, retval, 0); + } +} +static PyObject *__Pyx_Coroutine_Throw(PyObject *self, PyObject *args) { + PyObject *typ; + PyObject *val = NULL; + PyObject *tb = NULL; + if (unlikely(!PyArg_UnpackTuple(args, "throw", 1, 3, &typ, &val, &tb))) + return NULL; + return __Pyx__Coroutine_Throw(self, typ, val, tb, args, 1); +} +static CYTHON_INLINE int __Pyx_Coroutine_traverse_excstate(__Pyx_ExcInfoStruct *exc_state, visitproc visit, void *arg) { +#if PY_VERSION_HEX >= 0x030B00a4 + Py_VISIT(exc_state->exc_value); +#else + Py_VISIT(exc_state->exc_type); + Py_VISIT(exc_state->exc_value); + Py_VISIT(exc_state->exc_traceback); +#endif + return 0; +} +static int __Pyx_Coroutine_traverse(__pyx_CoroutineObject *gen, visitproc visit, void *arg) { + { + int e = __Pyx_call_type_traverse((PyObject*)gen, 1, visit, arg); + if (e) return e; + } + Py_VISIT(gen->closure); + Py_VISIT(gen->classobj); + Py_VISIT(gen->yieldfrom); + return __Pyx_Coroutine_traverse_excstate(&gen->gi_exc_state, visit, arg); +} +static int __Pyx_Coroutine_clear(PyObject *self) { + __pyx_CoroutineObject *gen = (__pyx_CoroutineObject *) self; + Py_CLEAR(gen->closure); + Py_CLEAR(gen->classobj); + __Pyx_Coroutine_Undelegate(gen); + __Pyx_Coroutine_ExceptionClear(&gen->gi_exc_state); +#ifdef __Pyx_AsyncGen_USED + if (__Pyx_AsyncGen_CheckExact(self)) { + Py_CLEAR(((__pyx_PyAsyncGenObject*)gen)->ag_finalizer); + } +#endif + Py_CLEAR(gen->gi_code); + Py_CLEAR(gen->gi_frame); + Py_CLEAR(gen->gi_name); + Py_CLEAR(gen->gi_qualname); + Py_CLEAR(gen->gi_modulename); + return 0; +} +static void __Pyx_Coroutine_dealloc(PyObject *self) { + __pyx_CoroutineObject *gen = (__pyx_CoroutineObject *) self; + PyObject_GC_UnTrack(gen); + #if PY_VERSION_HEX < 0x030C0000 || CYTHON_COMPILING_IN_LIMITED_API + if (gen->gi_weakreflist != NULL) + #endif + PyObject_ClearWeakRefs(self); + if (gen->resume_label >= 0) { + PyObject_GC_Track(self); +#if CYTHON_USE_TP_FINALIZE + if (unlikely(PyObject_CallFinalizerFromDealloc(self))) +#else + { + destructor del = __Pyx_PyObject_GetSlot(gen, tp_del, destructor); + if (del) del(self); + } + if (unlikely(Py_REFCNT(self) > 0)) +#endif + { + return; + } + PyObject_GC_UnTrack(self); + } +#ifdef __Pyx_AsyncGen_USED + if (__Pyx_AsyncGen_CheckExact(self)) { + /* We have to handle this case for asynchronous generators + right here, because this code has to be between UNTRACK + and GC_Del. */ + Py_CLEAR(((__pyx_PyAsyncGenObject*)self)->ag_finalizer); + } +#endif + __Pyx_Coroutine_clear(self); + __Pyx_PyHeapTypeObject_GC_Del(gen); +} +#if CYTHON_USE_TP_FINALIZE +static void __Pyx_Coroutine_del(PyObject *self) { + PyObject *error_type, *error_value, *error_traceback; + __pyx_CoroutineObject *gen = (__pyx_CoroutineObject *) self; + __Pyx_PyThreadState_declare + if (gen->resume_label < 0) { + return; + } + __Pyx_PyThreadState_assign + __Pyx_ErrFetch(&error_type, &error_value, &error_traceback); +#ifdef __Pyx_AsyncGen_USED + if (__Pyx_AsyncGen_CheckExact(self)) { + __pyx_PyAsyncGenObject *agen = (__pyx_PyAsyncGenObject*)self; + PyObject *finalizer = agen->ag_finalizer; + if (finalizer && !agen->ag_closed) { + PyObject *res = __Pyx_PyObject_CallOneArg(finalizer, self); + if (unlikely(!res)) { + PyErr_WriteUnraisable(self); + } else { + Py_DECREF(res); + } + __Pyx_ErrRestore(error_type, error_value, error_traceback); + return; + } + } +#endif + if (unlikely(gen->resume_label == 0 && !error_value)) { +#ifdef __Pyx_Coroutine_USED +#ifdef __Pyx_Generator_USED + if (!__Pyx_Generator_CheckExact(self)) +#endif + { + PyObject_GC_UnTrack(self); + if (unlikely(PyErr_WarnFormat(PyExc_RuntimeWarning, 1, "coroutine '%.50S' was never awaited", gen->gi_qualname) < 0)) + PyErr_WriteUnraisable(self); + PyObject_GC_Track(self); + } +#endif + } else { + PyObject *retval = NULL; + __Pyx_PySendResult result = __Pyx_Coroutine_Close(self, &retval); + if (result == PYGEN_ERROR) { + PyErr_WriteUnraisable(self); + } else { + Py_XDECREF(retval); + } + } + __Pyx_ErrRestore(error_type, error_value, error_traceback); +} +#endif +static PyObject * +__Pyx_Coroutine_get_name(__pyx_CoroutineObject *self, void *context) +{ + PyObject *name = self->gi_name; + CYTHON_UNUSED_VAR(context); + if (unlikely(!name)) name = Py_None; + Py_INCREF(name); + return name; +} +static int +__Pyx_Coroutine_set_name(__pyx_CoroutineObject *self, 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_Py_XDECREF_SET(self->gi_name, value); + return 0; +} +static PyObject * +__Pyx_Coroutine_get_qualname(__pyx_CoroutineObject *self, void *context) +{ + PyObject *name = self->gi_qualname; + CYTHON_UNUSED_VAR(context); + if (unlikely(!name)) name = Py_None; + Py_INCREF(name); + return name; +} +static int +__Pyx_Coroutine_set_qualname(__pyx_CoroutineObject *self, 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_Py_XDECREF_SET(self->gi_qualname, value); + return 0; +} +static PyObject * +__Pyx__Coroutine_get_frame(__pyx_CoroutineObject *self) +{ +#if !CYTHON_COMPILING_IN_LIMITED_API + PyObject *frame; + #if PY_VERSION_HEX >= 0x030d0000 + Py_BEGIN_CRITICAL_SECTION(self); + #endif + frame = self->gi_frame; + if (!frame) { + if (unlikely(!self->gi_code)) { + Py_RETURN_NONE; + } + PyObject *globals = PyDict_New(); + if (unlikely(!globals)) return NULL; + frame = (PyObject *) PyFrame_New( + PyThreadState_Get(), /*PyThreadState *tstate,*/ + (PyCodeObject*) self->gi_code, /*PyCodeObject *code,*/ + globals, /*PyObject *globals,*/ + 0 /*PyObject *locals*/ + ); + Py_DECREF(globals); + if (unlikely(!frame)) + return NULL; + if (unlikely(self->gi_frame)) { + Py_DECREF(frame); + frame = self->gi_frame; + } else { + self->gi_frame = frame; + } + } + Py_INCREF(frame); + #if PY_VERSION_HEX >= 0x030d0000 + Py_END_CRITICAL_SECTION(); + #endif + return frame; +#else + CYTHON_UNUSED_VAR(self); + Py_RETURN_NONE; +#endif +} +static PyObject * +__Pyx_Coroutine_get_frame(__pyx_CoroutineObject *self, void *context) { + CYTHON_UNUSED_VAR(context); + PyObject *frame = self->gi_frame; + if (frame) + return __Pyx_NewRef(frame); + return __Pyx__Coroutine_get_frame(self); +} +static __pyx_CoroutineObject *__Pyx__Coroutine_New( + PyTypeObject* type, __pyx_coroutine_body_t body, PyObject *code, PyObject *closure, + PyObject *name, PyObject *qualname, PyObject *module_name) { + __pyx_CoroutineObject *gen = PyObject_GC_New(__pyx_CoroutineObject, type); + if (unlikely(!gen)) + return NULL; + return __Pyx__Coroutine_NewInit(gen, body, code, closure, name, qualname, module_name); +} +static __pyx_CoroutineObject *__Pyx__Coroutine_NewInit( + __pyx_CoroutineObject *gen, __pyx_coroutine_body_t body, PyObject *code, PyObject *closure, + PyObject *name, PyObject *qualname, PyObject *module_name) { + gen->body = body; + gen->closure = closure; + Py_XINCREF(closure); + gen->is_running = 0; + gen->resume_label = 0; + gen->classobj = NULL; + gen->yieldfrom = NULL; + gen->yieldfrom_am_send = NULL; + #if PY_VERSION_HEX >= 0x030B00a4 && !CYTHON_COMPILING_IN_LIMITED_API + gen->gi_exc_state.exc_value = NULL; + #else + gen->gi_exc_state.exc_type = NULL; + gen->gi_exc_state.exc_value = NULL; + gen->gi_exc_state.exc_traceback = NULL; + #endif +#if CYTHON_USE_EXC_INFO_STACK + gen->gi_exc_state.previous_item = NULL; +#endif +#if PY_VERSION_HEX < 0x030C0000 || CYTHON_COMPILING_IN_LIMITED_API + gen->gi_weakreflist = NULL; +#endif + Py_XINCREF(qualname); + gen->gi_qualname = qualname; + Py_XINCREF(name); + gen->gi_name = name; + Py_XINCREF(module_name); + gen->gi_modulename = module_name; + Py_XINCREF(code); + gen->gi_code = code; + gen->gi_frame = NULL; + PyObject_GC_Track(gen); + return gen; +} +static char __Pyx_Coroutine_test_and_set_is_running(__pyx_CoroutineObject *gen) { + char result; + #if PY_VERSION_HEX >= 0x030d0000 && !CYTHON_COMPILING_IN_LIMITED_API + Py_BEGIN_CRITICAL_SECTION(gen); + #endif + result = gen->is_running; + gen->is_running = 1; + #if PY_VERSION_HEX >= 0x030d0000 && !CYTHON_COMPILING_IN_LIMITED_API + Py_END_CRITICAL_SECTION(); + #endif + return result; +} +static void __Pyx_Coroutine_unset_is_running(__pyx_CoroutineObject *gen) { + #if PY_VERSION_HEX >= 0x030d0000 && !CYTHON_COMPILING_IN_LIMITED_API + Py_BEGIN_CRITICAL_SECTION(gen); + #endif + assert(gen->is_running); + gen->is_running = 0; + #if PY_VERSION_HEX >= 0x030d0000 && !CYTHON_COMPILING_IN_LIMITED_API + Py_END_CRITICAL_SECTION(); + #endif +} +static char __Pyx_Coroutine_get_is_running(__pyx_CoroutineObject *gen) { + char result; + #if PY_VERSION_HEX >= 0x030d0000 && !CYTHON_COMPILING_IN_LIMITED_API + Py_BEGIN_CRITICAL_SECTION(gen); + #endif + result = gen->is_running; + #if PY_VERSION_HEX >= 0x030d0000 && !CYTHON_COMPILING_IN_LIMITED_API + Py_END_CRITICAL_SECTION(); + #endif + return result; +} +static PyObject *__Pyx_Coroutine_get_is_running_getter(PyObject *gen, void *closure) { + CYTHON_UNUSED_VAR(closure); + char result = __Pyx_Coroutine_get_is_running((__pyx_CoroutineObject*)gen); + if (result) Py_RETURN_TRUE; + else Py_RETURN_FALSE; +} +#if __PYX_HAS_PY_AM_SEND == 2 +static void __Pyx_SetBackportTypeAmSend(PyTypeObject *type, __Pyx_PyAsyncMethodsStruct *static_amsend_methods, __Pyx_pyiter_sendfunc am_send) { + Py_ssize_t ptr_offset = (char*)(type->tp_as_async) - (char*)type; + if (ptr_offset < 0 || ptr_offset > type->tp_basicsize) { + return; + } + memcpy((void*)static_amsend_methods, (void*)(type->tp_as_async), sizeof(*type->tp_as_async)); + static_amsend_methods->am_send = am_send; + type->tp_as_async = __Pyx_SlotTpAsAsync(static_amsend_methods); +} +#endif +static PyObject *__Pyx_Coroutine_fail_reduce_ex(PyObject *self, PyObject *arg) { + CYTHON_UNUSED_VAR(arg); + __Pyx_TypeName self_type_name = __Pyx_PyType_GetFullyQualifiedName(Py_TYPE((PyObject*)self)); + PyErr_Format(PyExc_TypeError, "cannot pickle '" __Pyx_FMT_TYPENAME "' object", + self_type_name); + __Pyx_DECREF_TypeName(self_type_name); + return NULL; +} + +/* Generator */ +static PyMethodDef __pyx_Generator_methods[] = { + {"send", (PyCFunction) __Pyx_Coroutine_Send, METH_O, + PyDoc_STR("send(arg) -> send 'arg' into generator,\nreturn next yielded value or raise StopIteration.")}, + {"throw", (PyCFunction) __Pyx_Coroutine_Throw, METH_VARARGS, + PyDoc_STR("throw(typ[,val[,tb]]) -> raise exception in generator,\nreturn next yielded value or raise StopIteration.")}, + {"close", (PyCFunction) __Pyx_Coroutine_Close_Method, METH_NOARGS, + PyDoc_STR("close() -> raise GeneratorExit inside generator.")}, + {"__reduce_ex__", (PyCFunction) __Pyx_Coroutine_fail_reduce_ex, METH_O, 0}, + {"__reduce__", (PyCFunction) __Pyx_Coroutine_fail_reduce_ex, METH_NOARGS, 0}, + {0, 0, 0, 0} +}; +static PyMemberDef __pyx_Generator_memberlist[] = { + {"gi_yieldfrom", T_OBJECT, offsetof(__pyx_CoroutineObject, yieldfrom), READONLY, + PyDoc_STR("object being iterated by 'yield from', or None")}, + {"gi_code", T_OBJECT, offsetof(__pyx_CoroutineObject, gi_code), READONLY, NULL}, + {"__module__", T_OBJECT, offsetof(__pyx_CoroutineObject, gi_modulename), 0, 0}, +#if PY_VERSION_HEX < 0x030C0000 || CYTHON_COMPILING_IN_LIMITED_API + {"__weaklistoffset__", T_PYSSIZET, offsetof(__pyx_CoroutineObject, gi_weakreflist), READONLY, 0}, +#endif + {0, 0, 0, 0, 0} +}; +static PyGetSetDef __pyx_Generator_getsets[] = { + {"__name__", (getter)__Pyx_Coroutine_get_name, (setter)__Pyx_Coroutine_set_name, + PyDoc_STR("name of the generator"), 0}, + {"__qualname__", (getter)__Pyx_Coroutine_get_qualname, (setter)__Pyx_Coroutine_set_qualname, + PyDoc_STR("qualified name of the generator"), 0}, + {"gi_frame", (getter)__Pyx_Coroutine_get_frame, NULL, + PyDoc_STR("Frame of the generator"), 0}, + {"gi_running", __Pyx_Coroutine_get_is_running_getter, NULL, NULL, NULL}, + {0, 0, 0, 0, 0} +}; +static PyType_Slot __pyx_GeneratorType_slots[] = { + {Py_tp_dealloc, (void *)__Pyx_Coroutine_dealloc}, + {Py_tp_traverse, (void *)__Pyx_Coroutine_traverse}, + {Py_tp_iter, (void *)PyObject_SelfIter}, + {Py_tp_iternext, (void *)__Pyx_Generator_Next}, + {Py_tp_methods, (void *)__pyx_Generator_methods}, + {Py_tp_members, (void *)__pyx_Generator_memberlist}, + {Py_tp_getset, (void *)__pyx_Generator_getsets}, + {Py_tp_getattro, (void *) PyObject_GenericGetAttr}, +#if CYTHON_USE_TP_FINALIZE + {Py_tp_finalize, (void *)__Pyx_Coroutine_del}, +#endif +#if __PYX_HAS_PY_AM_SEND == 1 + {Py_am_send, (void *)__Pyx_Coroutine_AmSend}, +#endif + {0, 0}, +}; +static PyType_Spec __pyx_GeneratorType_spec = { + __PYX_TYPE_MODULE_PREFIX "generator", + sizeof(__pyx_CoroutineObject), + 0, +#if PY_VERSION_HEX >= 0x030C0000 && !CYTHON_COMPILING_IN_LIMITED_API + Py_TPFLAGS_MANAGED_WEAKREF | +#endif + Py_TPFLAGS_IMMUTABLETYPE | Py_TPFLAGS_DISALLOW_INSTANTIATION | + Py_TPFLAGS_DEFAULT | Py_TPFLAGS_HAVE_GC | __Pyx_TPFLAGS_HAVE_AM_SEND, + __pyx_GeneratorType_slots +}; +#if __PYX_HAS_PY_AM_SEND == 2 +static __Pyx_PyAsyncMethodsStruct __pyx_Generator_as_async; +#endif +static int __pyx_Generator_init(PyObject *module) { + __pyx_mstatetype *mstate = __Pyx_PyModule_GetState(module); + mstate->__pyx_GeneratorType = __Pyx_FetchCommonTypeFromSpec( + mstate->__pyx_CommonTypesMetaclassType, module, &__pyx_GeneratorType_spec, NULL); + if (unlikely(!mstate->__pyx_GeneratorType)) { + return -1; + } +#if __PYX_HAS_PY_AM_SEND == 2 + __Pyx_SetBackportTypeAmSend(mstate->__pyx_GeneratorType, &__pyx_Generator_as_async, &__Pyx_Coroutine_AmSend); +#endif + return 0; +} +static PyObject *__Pyx_Generator_GetInlinedResult(PyObject *self) { + __pyx_CoroutineObject *gen = (__pyx_CoroutineObject*) self; + PyObject *retval = NULL; + if (unlikely(__Pyx_Coroutine_test_and_set_is_running(gen))) { + return __Pyx_Coroutine_AlreadyRunningError(gen); + } + __Pyx_PySendResult result = __Pyx_Coroutine_SendEx(gen, Py_None, &retval, 0); + __Pyx_Coroutine_unset_is_running(gen); + (void) result; + assert (result == PYGEN_RETURN || result == PYGEN_ERROR); + assert ((result == PYGEN_RETURN && retval != NULL) || (result == PYGEN_ERROR && retval == NULL)); + return retval; +} + +/* 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, *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)) return NULL; + 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 */ diff --git a/TTS/Kokoro/.venv/Lib/site-packages/spacy/pipeline/_parser_internals/arc_eager.pxd b/TTS/Kokoro/.venv/Lib/site-packages/spacy/pipeline/_parser_internals/arc_eager.pxd new file mode 100644 index 0000000000000000000000000000000000000000..eb7641ef846fa387cb8a17925c4e5e02af1d195d --- /dev/null +++ b/TTS/Kokoro/.venv/Lib/site-packages/spacy/pipeline/_parser_internals/arc_eager.pxd @@ -0,0 +1,7 @@ +from ...typedefs cimport attr_t, weight_t +from ._state cimport StateC +from .transition_system cimport Transition, TransitionSystem + + +cdef class ArcEager(TransitionSystem): + cdef get_arcs(self, StateC* state) diff --git a/TTS/Kokoro/.venv/Lib/site-packages/spacy/pipeline/_parser_internals/arc_eager.pyx b/TTS/Kokoro/.venv/Lib/site-packages/spacy/pipeline/_parser_internals/arc_eager.pyx new file mode 100644 index 0000000000000000000000000000000000000000..6ab3e65dccb854ed3a11d080fb9f8b9994624d56 --- /dev/null +++ b/TTS/Kokoro/.venv/Lib/site-packages/spacy/pipeline/_parser_internals/arc_eager.pyx @@ -0,0 +1,906 @@ +# cython: cdivision=True, infer_types=True +from cymem.cymem cimport Address, Pool +from libc.stdint cimport int32_t +from libcpp.vector cimport vector + +from collections import Counter, defaultdict + +from ...strings cimport hash_string +from ...structs cimport TokenC +from ...tokens.doc cimport Doc, set_children_from_heads +from ...tokens.token cimport MISSING_DEP +from ...typedefs cimport attr_t + +from ...training import split_bilu_label + +from ...training.example cimport Example +from ._state cimport ArcC, StateC +from .stateclass cimport StateClass + +from ...errors import Errors + +from thinc.extra.search cimport Beam + + +cdef weight_t MIN_SCORE = -90000 +cdef attr_t SUBTOK_LABEL = hash_string('subtok') + +DEF NON_MONOTONIC = True + +cdef enum: + SHIFT + REDUCE + LEFT + RIGHT + + BREAK + + N_MOVES + + +MOVE_NAMES = [None] * N_MOVES +MOVE_NAMES[SHIFT] = 'S' +MOVE_NAMES[REDUCE] = 'D' +MOVE_NAMES[LEFT] = 'L' +MOVE_NAMES[RIGHT] = 'R' +MOVE_NAMES[BREAK] = 'B' + + +cdef enum: + HEAD_IN_STACK = 0 + HEAD_IN_BUFFER + HEAD_UNKNOWN + IS_SENT_START + SENT_START_UNKNOWN + + +cdef struct GoldParseStateC: + char* state_bits + int32_t* n_kids_in_buffer + int32_t* n_kids_in_stack + int32_t* heads + attr_t* labels + int32_t** kids + int32_t* n_kids + int32_t length + int32_t stride + weight_t push_cost + weight_t pop_cost + + +cdef GoldParseStateC create_gold_state( + Pool mem, const StateC* state, heads, labels, sent_starts +) except *: + cdef GoldParseStateC gs + gs.length = len(heads) + gs.stride = 1 + assert gs.length > 0 + gs.labels = mem.alloc(gs.length, sizeof(gs.labels[0])) + gs.heads = mem.alloc(gs.length, sizeof(gs.heads[0])) + gs.n_kids = mem.alloc(gs.length, sizeof(gs.n_kids[0])) + gs.state_bits = mem.alloc(gs.length, sizeof(gs.state_bits[0])) + gs.n_kids_in_buffer = mem.alloc(gs.length, sizeof(gs.n_kids_in_buffer[0])) + gs.n_kids_in_stack = mem.alloc(gs.length, sizeof(gs.n_kids_in_stack[0])) + + for i, is_sent_start in enumerate(sent_starts): + if is_sent_start is True: + gs.state_bits[i] = set_state_flag( + gs.state_bits[i], + IS_SENT_START, + 1 + ) + gs.state_bits[i] = set_state_flag( + gs.state_bits[i], + SENT_START_UNKNOWN, + 0 + ) + + elif is_sent_start is None: + gs.state_bits[i] = set_state_flag( + gs.state_bits[i], + SENT_START_UNKNOWN, + 1 + ) + gs.state_bits[i] = set_state_flag( + gs.state_bits[i], + IS_SENT_START, + 0 + ) + else: + gs.state_bits[i] = set_state_flag( + gs.state_bits[i], + SENT_START_UNKNOWN, + 0 + ) + gs.state_bits[i] = set_state_flag( + gs.state_bits[i], + IS_SENT_START, + 0 + ) + + for i, (head, label) in enumerate(zip(heads, labels)): + if head is not None: + gs.heads[i] = head + gs.labels[i] = label + if i != head: + gs.n_kids[head] += 1 + gs.state_bits[i] = set_state_flag( + gs.state_bits[i], + HEAD_UNKNOWN, + 0 + ) + else: + gs.state_bits[i] = set_state_flag( + gs.state_bits[i], + HEAD_UNKNOWN, + 1 + ) + # Make an array of pointers, pointing into the gs_kids_flat array. + assert gs.length > 0 + gs.kids = mem.alloc(gs.length, sizeof(int32_t*)) + for i in range(gs.length): + if gs.n_kids[i] != 0: + gs.kids[i] = mem.alloc(gs.n_kids[i], sizeof(int32_t)) + # This is a temporary buffer + js_addr = Address(gs.length, sizeof(int32_t)) + js = js_addr.ptr + for i in range(gs.length): + if not is_head_unknown(&gs, i): + head = gs.heads[i] + if head != i: + gs.kids[head][js[head]] = i + js[head] += 1 + gs.push_cost = push_cost(state, &gs) + gs.pop_cost = pop_cost(state, &gs) + return gs + + +cdef void update_gold_state(GoldParseStateC* gs, const StateC* s) noexcept nogil: + for i in range(gs.length): + gs.state_bits[i] = set_state_flag( + gs.state_bits[i], + HEAD_IN_BUFFER, + 0 + ) + gs.state_bits[i] = set_state_flag( + gs.state_bits[i], + HEAD_IN_STACK, + 0 + ) + gs.n_kids_in_stack[i] = 0 + gs.n_kids_in_buffer[i] = 0 + + for i in range(s.stack_depth()): + s_i = s.S(i) + if not is_head_unknown(gs, s_i) and gs.heads[s_i] != s_i: + gs.n_kids_in_stack[gs.heads[s_i]] += 1 + for kid in gs.kids[s_i][:gs.n_kids[s_i]]: + gs.state_bits[kid] = set_state_flag( + gs.state_bits[kid], + HEAD_IN_STACK, + 1 + ) + for i in range(s.buffer_length()): + b_i = s.B(i) + if s.is_sent_start(b_i): + break + if not is_head_unknown(gs, b_i) and gs.heads[b_i] != b_i: + gs.n_kids_in_buffer[gs.heads[b_i]] += 1 + for kid in gs.kids[b_i][:gs.n_kids[b_i]]: + gs.state_bits[kid] = set_state_flag( + gs.state_bits[kid], + HEAD_IN_BUFFER, + 1 + ) + gs.push_cost = push_cost(s, gs) + gs.pop_cost = pop_cost(s, gs) + + +cdef class ArcEagerGold: + cdef GoldParseStateC c + cdef Pool mem + + def __init__(self, ArcEager moves, StateClass stcls, Example example): + self.mem = Pool() + heads, labels = example.get_aligned_parse(projectivize=True) + labels = [example.x.vocab.strings.add(label, allow_transient=False) if label is not None else MISSING_DEP for label in labels] + sent_starts = _get_aligned_sent_starts(example) + assert len(heads) == len(labels) == len(sent_starts), (len(heads), len(labels), len(sent_starts)) + self.c = create_gold_state(self.mem, stcls.c, heads, labels, sent_starts) + + def update(self, StateClass stcls): + update_gold_state(&self.c, stcls.c) + + +def _get_aligned_sent_starts(example): + """Get list of SENT_START attributes aligned to the predicted tokenization. + If the reference has not sentence starts, return a list of None values. + + This function is slightly different from the one on Example, because we also + check whether the reference sentences align across multiple sentences, + and return missing values if they do. This prevents a problem where you have + the start of a sentence merged onto a token that belongs to two sentences. + """ + if example.y.has_annotation("SENT_START"): + align = example.alignment.y2x + sent_starts = [False] * len(example.x) + seen_words = set() + for y_sent in example.y.sents: + x_indices = list(align[y_sent.start : y_sent.end]) + if any(x_idx in seen_words for x_idx in x_indices): + # If there are any tokens in X that align across two sentences, + # regard the sentence annotations as missing, as we can't + # reliably use them. + return [None] * len(example.x) + seen_words.update(x_indices) + sent_starts[x_indices[0]] = True + return sent_starts + else: + return [None] * len(example.x) + + +cdef int check_state_gold(char state_bits, char flag) noexcept nogil: + cdef char one = 1 + return 1 if (state_bits & (one << flag)) else 0 + + +cdef int set_state_flag(char state_bits, char flag, int value) noexcept nogil: + cdef char one = 1 + if value: + return state_bits | (one << flag) + else: + return state_bits & ~(one << flag) + + +cdef int is_head_in_stack(const GoldParseStateC* gold, int i) noexcept nogil: + return check_state_gold(gold.state_bits[i], HEAD_IN_STACK) + + +cdef int is_head_in_buffer(const GoldParseStateC* gold, int i) noexcept nogil: + return check_state_gold(gold.state_bits[i], HEAD_IN_BUFFER) + + +cdef int is_head_unknown(const GoldParseStateC* gold, int i) noexcept nogil: + return check_state_gold(gold.state_bits[i], HEAD_UNKNOWN) + +cdef int is_sent_start(const GoldParseStateC* gold, int i) noexcept nogil: + return check_state_gold(gold.state_bits[i], IS_SENT_START) + +cdef int is_sent_start_unknown(const GoldParseStateC* gold, int i) noexcept nogil: + return check_state_gold(gold.state_bits[i], SENT_START_UNKNOWN) + + +# Helper functions for the arc-eager oracle + +cdef weight_t push_cost(const StateC* state, const GoldParseStateC* gold) noexcept nogil: + cdef weight_t cost = 0 + b0 = state.B(0) + if b0 < 0: + return 9000 + if is_head_in_stack(gold, b0): + cost += 1 + cost += gold.n_kids_in_stack[b0] + if Break.is_valid(state, 0) and is_sent_start(gold, state.B(1)): + cost += 1 + return cost + + +cdef weight_t pop_cost(const StateC* state, const GoldParseStateC* gold) noexcept nogil: + cdef weight_t cost = 0 + s0 = state.S(0) + if s0 < 0: + return 9000 + if is_head_in_buffer(gold, s0): + cost += 1 + cost += gold.n_kids_in_buffer[s0] + return cost + + +cdef bint arc_is_gold(const GoldParseStateC* gold, int head, int child) noexcept nogil: + if is_head_unknown(gold, child): + return True + elif gold.heads[child] == head: + return True + else: + return False + + +cdef bint label_is_gold(const GoldParseStateC* gold, int child, attr_t label) noexcept nogil: + if is_head_unknown(gold, child): + return True + elif label == 0: + return True + elif gold.labels[child] == label: + return True + else: + return False + + +cdef bint _is_gold_root(const GoldParseStateC* gold, int word) noexcept nogil: + return gold.heads[word] == word or is_head_unknown(gold, word) + + +cdef class Shift: + """Move the first word of the buffer onto the stack and mark it as "shifted" + + Validity: + * If stack is empty + * At least two words in sentence + * Word has not been shifted before + + Cost: push_cost + + Action: + * Mark B[0] as 'shifted' + * Push stack + * Advance buffer + """ + @staticmethod + cdef bint is_valid(const StateC* st, attr_t label) noexcept nogil: + if st.stack_depth() == 0: + return 1 + elif st.buffer_length() < 2: + return 0 + elif st.is_sent_start(st.B(0)): + return 0 + elif st.is_unshiftable(st.B(0)): + return 0 + else: + return 1 + + @staticmethod + cdef int transition(StateC* st, attr_t label) noexcept nogil: + st.push() + + @staticmethod + cdef weight_t cost(const StateC* state, const void* _gold, attr_t label) noexcept nogil: + gold = _gold + return gold.push_cost + + +cdef class Reduce: + """ + Pop from the stack. If it has no head and the stack isn't empty, place + it back on the buffer. + + Validity: + * Stack not empty + * Buffer nt empty + * Stack depth 1 and cannot sent start l_edge(st.B(0)) + + Cost: + * If B[0] is the start of a sentence, cost is 0 + * Arcs between stack and buffer + * If arc has no head, we're saving arcs between S[0] and S[1:], so decrement + cost by those arcs. + """ + @staticmethod + cdef bint is_valid(const StateC* st, attr_t label) noexcept nogil: + if st.stack_depth() == 0: + return False + elif st.buffer_length() == 0: + return True + elif st.stack_depth() == 1 and st.cannot_sent_start(st.l_edge(st.B(0))): + return False + else: + return True + + @staticmethod + cdef int transition(StateC* st, attr_t label) noexcept nogil: + if st.has_head(st.S(0)) or st.stack_depth() == 1: + st.pop() + else: + st.unshift() + + @staticmethod + cdef weight_t cost(const StateC* state, const void* _gold, attr_t label) noexcept nogil: + gold = _gold + if state.is_sent_start(state.B(0)): + return 0 + s0 = state.S(0) + cost = gold.pop_cost + if not state.has_head(s0): + # Decrement cost for the arcs we save, as we'll be putting this + # back to the buffer + if is_head_in_stack(gold, s0): + cost -= 1 + cost -= gold.n_kids_in_stack[s0] + return cost + + +cdef class LeftArc: + """Add an arc between B[0] and S[0], replacing the previous head of S[0] if + one is set. Pop S[0] from the stack. + + Validity: + * len(S) >= 1 + * len(B) >= 1 + * not is_sent_start(B[0]) + + Cost: + pop_cost - Arc(B[0], S[0], label) + (Arc(S[1], S[0]) if H(S[0]) else Arcs(S, S[0])) + """ + @staticmethod + cdef bint is_valid(const StateC* st, attr_t label) noexcept nogil: + if st.stack_depth() == 0: + return 0 + elif st.buffer_length() == 0: + return 0 + elif st.is_sent_start(st.B(0)): + return 0 + elif label == SUBTOK_LABEL and st.S(0) != (st.B(0)-1): + return 0 + else: + return 1 + + @staticmethod + cdef int transition(StateC* st, attr_t label) noexcept nogil: + st.add_arc(st.B(0), st.S(0), label) + # If we change the stack, it's okay to remove the shifted mark, as + # we can't get in an infinite loop this way. + st.set_reshiftable(st.B(0)) + st.pop() + + @staticmethod + cdef inline weight_t cost(const StateC* state, const void* _gold, attr_t label) noexcept nogil: + gold = _gold + cdef weight_t cost = gold.pop_cost + s0 = state.S(0) + s1 = state.S(1) + b0 = state.B(0) + if state.has_head(s0): + # Increment cost if we're clobbering a correct arc + cost += gold.heads[s0] == s1 + else: + # If there's no head, we're losing arcs between S0 and S[1:]. + cost += is_head_in_stack(gold, s0) + cost += gold.n_kids_in_stack[s0] + if b0 != -1 and s0 != -1 and gold.heads[s0] == b0: + cost -= 1 + cost += not label_is_gold(gold, s0, label) + return cost + + +cdef class RightArc: + """ + Add an arc from S[0] to B[0]. Push B[0]. + + Validity: + * len(S) >= 1 + * len(B) >= 1 + * not is_sent_start(B[0]) + + Cost: + push_cost + (not shifted[b0] and Arc(B[1:], B[0])) - Arc(S[0], B[0], label) + """ + @staticmethod + cdef bint is_valid(const StateC* st, attr_t label) noexcept nogil: + if st.stack_depth() == 0: + return 0 + elif st.buffer_length() == 0: + return 0 + elif st.is_sent_start(st.B(0)): + return 0 + elif label == SUBTOK_LABEL and st.S(0) != (st.B(0)-1): + # If there's (perhaps partial) parse pre-set, don't allow cycle. + return 0 + else: + return 1 + + @staticmethod + cdef int transition(StateC* st, attr_t label) noexcept nogil: + st.add_arc(st.S(0), st.B(0), label) + st.push() + + @staticmethod + cdef inline weight_t cost(const StateC* state, const void* _gold, attr_t label) noexcept nogil: + gold = _gold + cost = gold.push_cost + s0 = state.S(0) + b0 = state.B(0) + if s0 != -1 and b0 != -1 and gold.heads[b0] == s0: + cost -= 1 + cost += not label_is_gold(gold, b0, label) + elif is_head_in_buffer(gold, b0) and not state.is_unshiftable(b0): + cost += 1 + return cost + + +cdef class Break: + """Mark the second word of the buffer as the start of a + sentence. + + Validity: + * len(buffer) >= 2 + * B[1] == B[0] + 1 + * not is_sent_start(B[1]) + * not cannot_sent_start(B[1]) + + Action: + * mark_sent_start(B[1]) + + Cost: + * not is_sent_start(B[1]) + * Arcs between B[0] and B[1:] + * Arcs between S and B[1] + """ + @staticmethod + cdef bint is_valid(const StateC* st, attr_t label) noexcept nogil: + if st.buffer_length() < 2: + return False + elif st.B(1) != st.B(0) + 1: + return False + elif st.is_sent_start(st.B(1)): + return False + elif st.cannot_sent_start(st.B(1)): + return False + else: + return True + + @staticmethod + cdef int transition(StateC* st, attr_t label) noexcept nogil: + st.set_sent_start(st.B(1), 1) + + @staticmethod + cdef weight_t cost(const StateC* state, const void* _gold, attr_t label) noexcept nogil: + gold = _gold + cdef int b0 = state.B(0) + cdef int cost = 0 + cdef int si + for i in range(state.stack_depth()): + si = state.S(i) + if is_head_in_buffer(gold, si): + cost += 1 + cost += gold.n_kids_in_buffer[si] + # We need to score into B[1:], so subtract deps that are at b0 + if gold.heads[b0] == si: + cost -= 1 + if gold.heads[si] == b0: + cost -= 1 + if not is_sent_start(gold, state.B(1)) and\ + not is_sent_start_unknown(gold, state.B(1)): + cost += 1 + return cost + + +cdef void* _init_state(Pool mem, int length, void* tokens) except NULL: + st = new StateC(tokens, length) + return st + + +cdef int _del_state(Pool mem, void* state, void* x) except -1: + cdef StateC* st = state + del st + + +cdef class ArcEager(TransitionSystem): + def __init__(self, *args, **kwargs): + TransitionSystem.__init__(self, *args, **kwargs) + self.init_beam_state = _init_state + self.del_beam_state = _del_state + + @classmethod + def get_actions(cls, **kwargs): + min_freq = kwargs.get('min_freq', None) + actions = defaultdict(lambda: Counter()) + actions[SHIFT][''] = 1 + actions[REDUCE][''] = 1 + for label in kwargs.get('left_labels', []): + actions[LEFT][label] = 1 + actions[SHIFT][label] = 1 + for label in kwargs.get('right_labels', []): + actions[RIGHT][label] = 1 + actions[REDUCE][label] = 1 + for example in kwargs.get('examples', []): + # use heads and labels from the reference parse (without regard to + # misalignments between the predicted and reference) + example_gold_preproc = Example(example.reference, example.reference) + heads, labels = example_gold_preproc.get_aligned_parse(projectivize=True) + for child, (head, label) in enumerate(zip(heads, labels)): + if head is None or label is None: + continue + if label.upper() == 'ROOT' : + label = 'ROOT' + if head == child: + actions[BREAK][label] += 1 + if head < child: + actions[RIGHT][label] += 1 + actions[REDUCE][''] += 1 + elif head > child: + actions[LEFT][label] += 1 + actions[SHIFT][''] += 1 + if min_freq is not None: + for action, label_freqs in actions.items(): + for label, freq in label_freqs.copy().items(): + if freq < min_freq: + label_freqs.pop(label) + # Ensure these actions are present + actions[BREAK].setdefault('ROOT', 0) + if kwargs.get("learn_tokens") is True: + actions[RIGHT].setdefault('subtok', 0) + actions[LEFT].setdefault('subtok', 0) + # Used for backoff + actions[RIGHT].setdefault('dep', 0) + actions[LEFT].setdefault('dep', 0) + return actions + + @property + def builtin_labels(self): + return ["ROOT", "dep"] + + @property + def action_types(self): + return (SHIFT, REDUCE, LEFT, RIGHT, BREAK) + + def get_doc_labels(self, doc): + """Get the labels required for a given Doc.""" + labels = set(self.builtin_labels) + for token in doc: + if token.dep_: + labels.add(token.dep_) + return labels + + def transition(self, StateClass state, action): + cdef Transition t = self.lookup_transition(action) + t.do(state.c, t.label) + return state + + def is_gold_parse(self, StateClass state, ArcEagerGold gold): + for i in range(state.c.length): + token = state.c.safe_get(i) + if not arc_is_gold(&gold.c, i, i+token.head): + return False + elif not label_is_gold(&gold.c, i, token.dep): + return False + return True + + def init_gold(self, StateClass state, Example example): + gold = ArcEagerGold(self, state, example) + self._replace_unseen_labels(gold) + return gold + + def init_gold_batch(self, examples): + # TODO: Projectivity? + all_states = self.init_batch([eg.predicted for eg in examples]) + golds = [] + states = [] + for state, eg in zip(all_states, examples): + if self.has_gold(eg) and not state.is_final(): + golds.append(self.init_gold(state, eg)) + states.append(state) + n_steps = sum([len(s.queue) for s in states]) + return states, golds, n_steps + + def _replace_unseen_labels(self, ArcEagerGold gold): + backoff_label = self.strings["dep"] + root_label = self.strings["ROOT"] + left_labels = self.labels[LEFT] + right_labels = self.labels[RIGHT] + break_labels = self.labels[BREAK] + for i in range(gold.c.length): + if not is_head_unknown(&gold.c, i): + head = gold.c.heads[i] + label = self.strings[gold.c.labels[i]] + if head > i and label not in left_labels: + gold.c.labels[i] = backoff_label + elif head < i and label not in right_labels: + gold.c.labels[i] = backoff_label + elif head == i and label not in break_labels: + gold.c.labels[i] = root_label + return gold + + cdef Transition lookup_transition(self, object name_or_id) except *: + if isinstance(name_or_id, int): + return self.c[name_or_id] + name = name_or_id + if '-' in name: + move_str, label_str = split_bilu_label(name) + label = self.strings[label_str] + else: + move_str = name + label = 0 + move = MOVE_NAMES.index(move_str) + for i in range(self.n_moves): + if self.c[i].move == move and self.c[i].label == label: + return self.c[i] + raise KeyError(f"Unknown transition: {name}") + + def move_name(self, int move, attr_t label): + label_str = self.strings[label] + if label_str: + return MOVE_NAMES[move] + '-' + label_str + else: + return MOVE_NAMES[move] + + def class_name(self, int i): + return self.move_name(self.c[i].move, self.c[i].label) + + cdef Transition init_transition(self, int clas, int move, attr_t label) except *: + # TODO: Apparent Cython bug here when we try to use the Transition() + # constructor with the function pointers + cdef Transition t + t.score = 0 + t.clas = clas + t.move = move + t.label = label + if move == SHIFT: + t.is_valid = Shift.is_valid + t.do = Shift.transition + t.get_cost = Shift.cost + elif move == REDUCE: + t.is_valid = Reduce.is_valid + t.do = Reduce.transition + t.get_cost = Reduce.cost + elif move == LEFT: + t.is_valid = LeftArc.is_valid + t.do = LeftArc.transition + t.get_cost = LeftArc.cost + elif move == RIGHT: + t.is_valid = RightArc.is_valid + t.do = RightArc.transition + t.get_cost = RightArc.cost + elif move == BREAK: + t.is_valid = Break.is_valid + t.do = Break.transition + t.get_cost = Break.cost + else: + raise ValueError(Errors.E019.format(action=move, src='arc_eager')) + return t + + def set_annotations(self, StateClass state, Doc doc): + for arc in state.arcs: + doc.c[arc["child"]].head = arc["head"] - arc["child"] + doc.c[arc["child"]].dep = arc["label"] + for i in range(doc.length): + if doc.c[i].head == 0: + doc.c[i].dep = self.root_label + set_children_from_heads(doc.c, 0, doc.length) + + def get_beam_parses(self, Beam beam): + parses = [] + probs = beam.probs + for i in range(beam.size): + state = beam.at(i) + if state.is_final(): + prob = probs[i] + parse = [] + arcs = self.get_arcs(state) + if arcs: + for arc in arcs: + dep = arc["label"] + label = self.strings[dep] + parse.append((arc["head"], arc["child"], label)) + parses.append((prob, parse)) + return parses + + cdef get_arcs(self, StateC* state): + cdef vector[ArcC] arcs + state.get_arcs(&arcs) + return list(arcs) + + def has_gold(self, Example eg, start=0, end=None): + for word in eg.y[start:end]: + if word.dep != 0: + return True + else: + return False + + cdef int set_valid(self, int* output, const StateC* st) noexcept nogil: + cdef int[N_MOVES] is_valid + is_valid[SHIFT] = Shift.is_valid(st, 0) + is_valid[REDUCE] = Reduce.is_valid(st, 0) + is_valid[LEFT] = LeftArc.is_valid(st, 0) + is_valid[RIGHT] = RightArc.is_valid(st, 0) + is_valid[BREAK] = Break.is_valid(st, 0) + cdef int i + for i in range(self.n_moves): + if self.c[i].label == SUBTOK_LABEL: + output[i] = self.c[i].is_valid(st, self.c[i].label) + else: + output[i] = is_valid[self.c[i].move] + + def get_cost(self, StateClass stcls, gold, int i): + if not isinstance(gold, ArcEagerGold): + raise TypeError(Errors.E909.format(name="ArcEagerGold")) + cdef ArcEagerGold gold_ = gold + gold_state = gold_.c + if self.c[i].is_valid(stcls.c, self.c[i].label): + cost = self.c[i].get_cost(stcls.c, &gold_state, self.c[i].label) + else: + cost = 9000 + return cost + + cdef int set_costs(self, int* is_valid, weight_t* costs, + const StateC* state, gold) except -1: + if not isinstance(gold, ArcEagerGold): + raise TypeError(Errors.E909.format(name="ArcEagerGold")) + cdef ArcEagerGold gold_ = gold + gold_state = gold_.c + update_gold_state(&gold_state, state) + self.set_valid(is_valid, state) + cdef int n_gold = 0 + for i in range(self.n_moves): + if is_valid[i]: + costs[i] = self.c[i].get_cost(state, &gold_state, self.c[i].label) + if costs[i] <= 0: + n_gold += 1 + else: + costs[i] = 9000 + if n_gold < 1: + for i in range(self.n_moves): + print(self.get_class_name(i), is_valid[i], costs[i]) + print("Gold sent starts?", is_sent_start(&gold_state, state.B(0)), is_sent_start(&gold_state, state.B(1))) + raise ValueError(Errors.E1031) + + def get_oracle_sequence_from_state(self, StateClass state, ArcEagerGold gold, _debug=None): + cdef int i + cdef Pool mem = Pool() + # n_moves should not be zero at this point, but make sure to avoid zero-length mem alloc + assert self.n_moves > 0 + costs = mem.alloc(self.n_moves, sizeof(float)) + is_valid = mem.alloc(self.n_moves, sizeof(int)) + + history = [] + debug_log = [] + failed = False + while not state.is_final(): + try: + self.set_costs(is_valid, costs, state.c, gold) + except ValueError: + failed = True + break + min_cost = min(costs[i] for i in range(self.n_moves)) + for i in range(self.n_moves): + if is_valid[i] and costs[i] <= min_cost: + action = self.c[i] + history.append(i) + s0 = state.S(0) + b0 = state.B(0) + if _debug: + example = _debug + debug_log.append(" ".join(( + self.get_class_name(i), + state.print_state() + ))) + action.do(state.c, action.label) + break + else: + failed = False + break + if failed and _debug not in (False, None): + example = _debug + print("Actions") + for i in range(self.n_moves): + print(self.get_class_name(i)) + print("Gold") + for token in example.y: + print(token.i, token.text, token.dep_, token.head.text) + aligned_heads, _aligned_labels = example.get_aligned_parse() + print("Aligned heads") + for i, head in enumerate(aligned_heads): + print(example.x[i], example.x[head] if head is not None else "__") + print("Aligned sent starts") + print(example.get_aligned_sent_starts()) + + print("Predicted tokens") + print([(w.i, w.text) for w in example.x]) + s0 = state.S(0) + b0 = state.B(0) + debug_log.append(" ".join(( + "?", + "S0=", (example.x[s0].text if s0 >= 0 else "-"), + "B0=", (example.x[b0].text if b0 >= 0 else "-"), + "S0 head?", str(state.has_head(state.S(0))), + ))) + s0 = state.S(0) + b0 = state.B(0) + print("\n".join(debug_log)) + print("Arc is gold B0, S0?", arc_is_gold(&gold.c, b0, s0)) + print("Arc is gold S0, B0?", arc_is_gold(&gold.c, s0, b0)) + print("is_head_unknown(s0)", is_head_unknown(&gold.c, s0)) + print("is_head_unknown(b0)", is_head_unknown(&gold.c, b0)) + print("b0", b0, "gold.heads[s0]", gold.c.heads[s0]) + print("Stack", [example.x[i] for i in state.stack]) + print("Buffer", [example.x[i] for i in state.queue]) + raise ValueError(Errors.E024) + return history diff --git a/TTS/Kokoro/.venv/Lib/site-packages/spacy/pipeline/_parser_internals/ner.cpp b/TTS/Kokoro/.venv/Lib/site-packages/spacy/pipeline/_parser_internals/ner.cpp new file mode 100644 index 0000000000000000000000000000000000000000..d5e977791cf9a575e96fe9cf5b304eb942b37c6d --- /dev/null +++ b/TTS/Kokoro/.venv/Lib/site-packages/spacy/pipeline/_parser_internals/ner.cpp @@ -0,0 +1,54992 @@ +/* Generated by Cython 3.2.1 */ + +/* BEGIN: Cython Metadata +{ + "distutils": { + "depends": [ + "C:\\Users\\runneradmin\\AppData\\Local\\Temp\\build-env-ej_q3m8u\\Lib\\site-packages\\numpy\\_core\\include\\numpy\\arrayobject.h", + "C:\\Users\\runneradmin\\AppData\\Local\\Temp\\build-env-ej_q3m8u\\Lib\\site-packages\\numpy\\_core\\include\\numpy\\arrayscalars.h", + "C:\\Users\\runneradmin\\AppData\\Local\\Temp\\build-env-ej_q3m8u\\Lib\\site-packages\\numpy\\_core\\include\\numpy\\ndarrayobject.h", + "C:\\Users\\runneradmin\\AppData\\Local\\Temp\\build-env-ej_q3m8u\\Lib\\site-packages\\numpy\\_core\\include\\numpy\\ndarraytypes.h", + "C:\\Users\\runneradmin\\AppData\\Local\\Temp\\build-env-ej_q3m8u\\Lib\\site-packages\\numpy\\_core\\include\\numpy\\ufuncobject.h", + "C:\\Users\\runneradmin\\AppData\\Local\\pypa\\cibuildwheel\\Cache\\nuget-cpython\\python.3.12.10\\tools\\Include\\Python.h" + ], + "extra_compile_args": [ + "-std=c++11" + ], + "include_dirs": [ + "C:\\Users\\runneradmin\\AppData\\Local\\Temp\\build-env-ej_q3m8u\\Lib\\site-packages\\numpy\\_core\\include", + "C:\\Users\\runneradmin\\AppData\\Local\\pypa\\cibuildwheel\\Cache\\nuget-cpython\\python.3.12.10\\tools\\Include" + ], + "language": "c++", + "name": "spacy.pipeline._parser_internals.ner", + "sources": [ + "spacy/pipeline/_parser_internals/ner.pyx" + ] + }, + "module_name": "spacy.pipeline._parser_internals.ner" +} +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_1" +#define CYTHON_HEX_VERSION 0x030201F0 +#define CYTHON_FUTURE_DIVISION 0 +/* 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)) + +/* CppInitCode */ +#ifndef __cplusplus + #error "Cython files generated with the C++ option must be compiled with a C++ compiler." +#endif +#ifndef CYTHON_INLINE + #if defined(__clang__) + #define CYTHON_INLINE __inline__ __attribute__ ((__unused__)) + #else + #define CYTHON_INLINE inline + #endif +#endif +template +void __Pyx_call_destructor(T& x) { + x.~T(); +} +template +class __Pyx_FakeReference { + public: + __Pyx_FakeReference() : ptr(NULL) { } + __Pyx_FakeReference(const T& ref) : ptr(const_cast(&ref)) { } + T *operator->() { return ptr; } + T *operator&() { return ptr; } + operator T&() { return *ptr; } + template bool operator ==(const U& other) const { return *ptr == other; } + template bool operator !=(const U& other) const { return *ptr != other; } + template bool operator==(const __Pyx_FakeReference& other) const { return *ptr == *other.ptr; } + template bool operator!=(const __Pyx_FakeReference& other) const { return *ptr != *other.ptr; } + private: + T *ptr; +}; + +/* 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 + #define __PYX_EXTERN_C extern "C++" +#endif + +#define __PYX_HAVE__spacy__pipeline___parser_internals__ner +#define __PYX_HAVE_API__spacy__pipeline___parser_internals__ner +/* Early includes */ +#include +#include "ios" +#include "new" +#include "stdexcept" +#include "typeinfo" +#include + + #if __cplusplus >= 201103L || (defined(_MSC_VER) && _MSC_VER >= 1600) + // move should be defined for these versions of MSVC, but __cplusplus isn't set usefully + #include + + namespace cython_std { + template typename std::remove_reference::type&& move(T& t) noexcept { return std::move(t); } + template typename std::remove_reference::type&& move(T&& t) noexcept { return std::move(t); } + } + + #endif + +#include +#include +#include +#include +#include +#include + + /* Using NumPy API declarations from "numpy/__init__.cython-30.pxd" */ + +#include "numpy/arrayobject.h" +#include "numpy/ndarrayobject.h" +#include "numpy/ndarraytypes.h" +#include "numpy/arrayscalars.h" +#include "numpy/ufuncobject.h" +#include +#include +#include "pythread.h" +#ifdef _OPENMP +#include +#endif /* _OPENMP */ + +#if defined(PYREX_WITHOUT_ASSERTIONS) && !defined(CYTHON_WITHOUT_ASSERTIONS) +#define CYTHON_WITHOUT_ASSERTIONS +#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; + +/* Header.proto */ +#if !defined(CYTHON_CCOMPLEX) + #if defined(__cplusplus) + #define CYTHON_CCOMPLEX 1 + #elif (defined(_Complex_I) && !defined(_MSC_VER)) || ((defined (__STDC_VERSION__) && __STDC_VERSION__ >= 201112L) && !defined(__STDC_NO_COMPLEX__) && !defined(_MSC_VER)) + #define CYTHON_CCOMPLEX 1 + #else + #define CYTHON_CCOMPLEX 0 + #endif +#endif +#if CYTHON_CCOMPLEX + #ifdef __cplusplus + #include + #else + #include + #endif +#endif +#if CYTHON_CCOMPLEX && !defined(__cplusplus) && defined(__sun__) && defined(__GNUC__) + #undef _Complex_I + #define _Complex_I 1.0fj +#endif + +/* #### Code section: filename_table ### */ + +static const char* const __pyx_f[] = { + "spacy/pipeline/_parser_internals/ner.pyx", + "", + "C:/Users/runneradmin/AppData/Local/Temp/build-env-ej_q3m8u/Lib/site-packages/numpy/__init__.cython-30.pxd", + "spacy/lexeme.pxd", + "spacy/pipeline/_parser_internals/_state.pxd", + "spacy/pipeline/_parser_internals/stateclass.pxd", + "spacy/tokens/span.pxd", + "cymem/cymem.pxd", + "preshed/maps.pxd", + "spacy/strings.pxd", + "cpython/type.pxd", + "spacy/morphology.pxd", + "spacy/vocab.pxd", + "spacy/tokens/doc.pxd", + "spacy/training/example.pxd", + "thinc/extra/search.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 + +/* ForceInitThreads.proto */ +#ifndef __PYX_FORCE_INIT_THREADS + #define __PYX_FORCE_INIT_THREADS 0 +#endif + +/* NoFastGil.proto */ +#define __Pyx_PyGILState_Ensure PyGILState_Ensure +#define __Pyx_PyGILState_Release PyGILState_Release +#define __Pyx_FastGIL_Remember() +#define __Pyx_FastGIL_Forget() +#define __Pyx_FastGilFuncInit() + +/* IncludeStructmemberH.proto (used by FixUpExtensionType) */ +#include + +/* BufferFormatStructs.proto */ +struct __Pyx_StructField_; +#define __PYX_BUF_FLAGS_PACKED_STRUCT (1 << 0) +typedef struct { + const char* name; + const struct __Pyx_StructField_* fields; + size_t size; + size_t arraysize[8]; + int ndim; + char typegroup; + char is_unsigned; + int flags; +} __Pyx_TypeInfo; +typedef struct __Pyx_StructField_ { + const __Pyx_TypeInfo* type; + const char* name; + size_t offset; +} __Pyx_StructField; +typedef struct { + const __Pyx_StructField* field; + size_t parent_offset; +} __Pyx_BufFmt_StackElem; +typedef struct { + __Pyx_StructField root; + __Pyx_BufFmt_StackElem* head; + size_t fmt_offset; + size_t new_count, enc_count; + size_t struct_alignment; + int is_complex; + char enc_type; + char new_packmode; + char enc_packmode; + char is_valid_array; +} __Pyx_BufFmt_Context; + +/* MemviewSliceStruct.proto */ +struct __pyx_memoryview_obj; +typedef struct { + struct __pyx_memoryview_obj *memview; + char *data; + Py_ssize_t shape[8]; + Py_ssize_t strides[8]; + Py_ssize_t suboffsets[8]; +} __Pyx_memviewslice; +#define __Pyx_MemoryView_Len(m) (m.shape[0]) +#define __Pyx_MEMVIEW_DIRECT 1 +#define __Pyx_MEMVIEW_PTR 2 +#define __Pyx_MEMVIEW_FULL 4 +#define __Pyx_MEMVIEW_CONTIG 8 +#define __Pyx_MEMVIEW_STRIDED 16 +#define __Pyx_MEMVIEW_FOLLOW 32 +#define __Pyx_IS_C_CONTIG 1 +#define __Pyx_IS_F_CONTIG 2 +#define __Pyx_MEMSLICE_INIT { 0, 0, { 0 }, { 0 }, { 0 } } +#if CYTHON_ATOMICS + #define __pyx_add_acquisition_count(memview)\ + __pyx_atomic_incr_relaxed(__pyx_get_slice_count_pointer(memview)) + #define __pyx_sub_acquisition_count(memview)\ + __pyx_atomic_decr_acq_rel(__pyx_get_slice_count_pointer(memview)) +#else + #define __pyx_add_acquisition_count(memview)\ + __pyx_add_acquisition_count_locked(__pyx_get_slice_count_pointer(memview), memview->lock) + #define __pyx_sub_acquisition_count(memview)\ + __pyx_sub_acquisition_count_locked(__pyx_get_slice_count_pointer(memview), memview->lock) +#endif + +/* #### Code section: numeric_typedefs ### */ + +/* "preshed/maps.pxd":5 + * + * + * ctypedef uint64_t key_t # <<<<<<<<<<<<<< + * + * +*/ +typedef uint64_t __pyx_t_7preshed_4maps_key_t; + +/* "typedefs.pxd":3 + * from libc.stdint cimport int32_t, uint8_t, uint16_t, uint32_t, uint64_t, uintptr_t + * + * ctypedef float weight_t # <<<<<<<<<<<<<< + * ctypedef uint64_t hash_t + * ctypedef uint64_t class_t +*/ +typedef float __pyx_t_5spacy_8typedefs_weight_t; + +/* "typedefs.pxd":4 + * + * ctypedef float weight_t + * ctypedef uint64_t hash_t # <<<<<<<<<<<<<< + * ctypedef uint64_t class_t + * ctypedef uint64_t attr_t +*/ +typedef uint64_t __pyx_t_5spacy_8typedefs_hash_t; + +/* "typedefs.pxd":5 + * ctypedef float weight_t + * ctypedef uint64_t hash_t + * ctypedef uint64_t class_t # <<<<<<<<<<<<<< + * ctypedef uint64_t attr_t + * ctypedef uint64_t flags_t +*/ +typedef uint64_t __pyx_t_5spacy_8typedefs_class_t; + +/* "typedefs.pxd":6 + * ctypedef uint64_t hash_t + * ctypedef uint64_t class_t + * ctypedef uint64_t attr_t # <<<<<<<<<<<<<< + * ctypedef uint64_t flags_t + * ctypedef uint16_t len_t +*/ +typedef uint64_t __pyx_t_5spacy_8typedefs_attr_t; + +/* "typedefs.pxd":7 + * ctypedef uint64_t class_t + * ctypedef uint64_t attr_t + * ctypedef uint64_t flags_t # <<<<<<<<<<<<<< + * ctypedef uint16_t len_t + * ctypedef uint16_t tag_t +*/ +typedef uint64_t __pyx_t_5spacy_8typedefs_flags_t; + +/* "typedefs.pxd":8 + * ctypedef uint64_t attr_t + * ctypedef uint64_t flags_t + * ctypedef uint16_t len_t # <<<<<<<<<<<<<< + * ctypedef uint16_t tag_t +*/ +typedef uint16_t __pyx_t_5spacy_8typedefs_len_t; + +/* "typedefs.pxd":9 + * ctypedef uint64_t flags_t + * ctypedef uint16_t len_t + * ctypedef uint16_t tag_t # <<<<<<<<<<<<<< +*/ +typedef uint16_t __pyx_t_5spacy_8typedefs_tag_t; + +/* "C:/Users/runneradmin/AppData/Local/Temp/build-env-ej_q3m8u/Lib/site-packages/numpy/__init__.cython-30.pxd":743 + * # in Cython to enable them only on the right systems. + * + * ctypedef npy_int8 int8_t # <<<<<<<<<<<<<< + * ctypedef npy_int16 int16_t + * ctypedef npy_int32 int32_t +*/ +typedef npy_int8 __pyx_t_5numpy_int8_t; + +/* "C:/Users/runneradmin/AppData/Local/Temp/build-env-ej_q3m8u/Lib/site-packages/numpy/__init__.cython-30.pxd":744 + * + * ctypedef npy_int8 int8_t + * ctypedef npy_int16 int16_t # <<<<<<<<<<<<<< + * ctypedef npy_int32 int32_t + * ctypedef npy_int64 int64_t +*/ +typedef npy_int16 __pyx_t_5numpy_int16_t; + +/* "C:/Users/runneradmin/AppData/Local/Temp/build-env-ej_q3m8u/Lib/site-packages/numpy/__init__.cython-30.pxd":745 + * ctypedef npy_int8 int8_t + * ctypedef npy_int16 int16_t + * ctypedef npy_int32 int32_t # <<<<<<<<<<<<<< + * ctypedef npy_int64 int64_t + * +*/ +typedef npy_int32 __pyx_t_5numpy_int32_t; + +/* "C:/Users/runneradmin/AppData/Local/Temp/build-env-ej_q3m8u/Lib/site-packages/numpy/__init__.cython-30.pxd":746 + * ctypedef npy_int16 int16_t + * ctypedef npy_int32 int32_t + * ctypedef npy_int64 int64_t # <<<<<<<<<<<<<< + * + * ctypedef npy_uint8 uint8_t +*/ +typedef npy_int64 __pyx_t_5numpy_int64_t; + +/* "C:/Users/runneradmin/AppData/Local/Temp/build-env-ej_q3m8u/Lib/site-packages/numpy/__init__.cython-30.pxd":748 + * ctypedef npy_int64 int64_t + * + * ctypedef npy_uint8 uint8_t # <<<<<<<<<<<<<< + * ctypedef npy_uint16 uint16_t + * ctypedef npy_uint32 uint32_t +*/ +typedef npy_uint8 __pyx_t_5numpy_uint8_t; + +/* "C:/Users/runneradmin/AppData/Local/Temp/build-env-ej_q3m8u/Lib/site-packages/numpy/__init__.cython-30.pxd":749 + * + * ctypedef npy_uint8 uint8_t + * ctypedef npy_uint16 uint16_t # <<<<<<<<<<<<<< + * ctypedef npy_uint32 uint32_t + * ctypedef npy_uint64 uint64_t +*/ +typedef npy_uint16 __pyx_t_5numpy_uint16_t; + +/* "C:/Users/runneradmin/AppData/Local/Temp/build-env-ej_q3m8u/Lib/site-packages/numpy/__init__.cython-30.pxd":750 + * ctypedef npy_uint8 uint8_t + * ctypedef npy_uint16 uint16_t + * ctypedef npy_uint32 uint32_t # <<<<<<<<<<<<<< + * ctypedef npy_uint64 uint64_t + * +*/ +typedef npy_uint32 __pyx_t_5numpy_uint32_t; + +/* "C:/Users/runneradmin/AppData/Local/Temp/build-env-ej_q3m8u/Lib/site-packages/numpy/__init__.cython-30.pxd":751 + * ctypedef npy_uint16 uint16_t + * ctypedef npy_uint32 uint32_t + * ctypedef npy_uint64 uint64_t # <<<<<<<<<<<<<< + * + * ctypedef npy_float32 float32_t +*/ +typedef npy_uint64 __pyx_t_5numpy_uint64_t; + +/* "C:/Users/runneradmin/AppData/Local/Temp/build-env-ej_q3m8u/Lib/site-packages/numpy/__init__.cython-30.pxd":753 + * ctypedef npy_uint64 uint64_t + * + * ctypedef npy_float32 float32_t # <<<<<<<<<<<<<< + * ctypedef npy_float64 float64_t + * #ctypedef npy_float80 float80_t +*/ +typedef npy_float32 __pyx_t_5numpy_float32_t; + +/* "C:/Users/runneradmin/AppData/Local/Temp/build-env-ej_q3m8u/Lib/site-packages/numpy/__init__.cython-30.pxd":754 + * + * ctypedef npy_float32 float32_t + * ctypedef npy_float64 float64_t # <<<<<<<<<<<<<< + * #ctypedef npy_float80 float80_t + * #ctypedef npy_float128 float128_t +*/ +typedef npy_float64 __pyx_t_5numpy_float64_t; + +/* "C:/Users/runneradmin/AppData/Local/Temp/build-env-ej_q3m8u/Lib/site-packages/numpy/__init__.cython-30.pxd":761 + * ctypedef double complex complex128_t + * + * ctypedef npy_longlong longlong_t # <<<<<<<<<<<<<< + * ctypedef npy_ulonglong ulonglong_t + * +*/ +typedef npy_longlong __pyx_t_5numpy_longlong_t; + +/* "C:/Users/runneradmin/AppData/Local/Temp/build-env-ej_q3m8u/Lib/site-packages/numpy/__init__.cython-30.pxd":762 + * + * ctypedef npy_longlong longlong_t + * ctypedef npy_ulonglong ulonglong_t # <<<<<<<<<<<<<< + * + * ctypedef npy_intp intp_t +*/ +typedef npy_ulonglong __pyx_t_5numpy_ulonglong_t; + +/* "C:/Users/runneradmin/AppData/Local/Temp/build-env-ej_q3m8u/Lib/site-packages/numpy/__init__.cython-30.pxd":764 + * ctypedef npy_ulonglong ulonglong_t + * + * ctypedef npy_intp intp_t # <<<<<<<<<<<<<< + * ctypedef npy_uintp uintp_t + * +*/ +typedef npy_intp __pyx_t_5numpy_intp_t; + +/* "C:/Users/runneradmin/AppData/Local/Temp/build-env-ej_q3m8u/Lib/site-packages/numpy/__init__.cython-30.pxd":765 + * + * ctypedef npy_intp intp_t + * ctypedef npy_uintp uintp_t # <<<<<<<<<<<<<< + * + * ctypedef npy_double float_t +*/ +typedef npy_uintp __pyx_t_5numpy_uintp_t; + +/* "C:/Users/runneradmin/AppData/Local/Temp/build-env-ej_q3m8u/Lib/site-packages/numpy/__init__.cython-30.pxd":767 + * ctypedef npy_uintp uintp_t + * + * ctypedef npy_double float_t # <<<<<<<<<<<<<< + * ctypedef npy_double double_t + * ctypedef npy_longdouble longdouble_t +*/ +typedef npy_double __pyx_t_5numpy_float_t; + +/* "C:/Users/runneradmin/AppData/Local/Temp/build-env-ej_q3m8u/Lib/site-packages/numpy/__init__.cython-30.pxd":768 + * + * ctypedef npy_double float_t + * ctypedef npy_double double_t # <<<<<<<<<<<<<< + * ctypedef npy_longdouble longdouble_t + * +*/ +typedef npy_double __pyx_t_5numpy_double_t; + +/* "C:/Users/runneradmin/AppData/Local/Temp/build-env-ej_q3m8u/Lib/site-packages/numpy/__init__.cython-30.pxd":769 + * ctypedef npy_double float_t + * ctypedef npy_double double_t + * ctypedef npy_longdouble longdouble_t # <<<<<<<<<<<<<< + * + * ctypedef float complex cfloat_t +*/ +typedef npy_longdouble __pyx_t_5numpy_longdouble_t; + +/* "thinc/extra/search.pxd":7 + * from libcpp.vector cimport vector + * + * ctypedef uint64_t hash_t # <<<<<<<<<<<<<< + * ctypedef uint64_t class_t + * ctypedef float weight_t +*/ +typedef uint64_t __pyx_t_5thinc_5extra_6search_hash_t; + +/* "thinc/extra/search.pxd":8 + * + * ctypedef uint64_t hash_t + * ctypedef uint64_t class_t # <<<<<<<<<<<<<< + * ctypedef float weight_t + * +*/ +typedef uint64_t __pyx_t_5thinc_5extra_6search_class_t; + +/* "thinc/extra/search.pxd":9 + * ctypedef uint64_t hash_t + * ctypedef uint64_t class_t + * ctypedef float weight_t # <<<<<<<<<<<<<< + * + * +*/ +typedef float __pyx_t_5thinc_5extra_6search_weight_t; +/* #### Code section: complex_type_declarations ### */ +/* Declarations.proto */ +#if CYTHON_CCOMPLEX && (1) && (!0 || __cplusplus) + #ifdef __cplusplus + typedef ::std::complex< float > __pyx_t_float_complex; + #else + typedef float _Complex __pyx_t_float_complex; + #endif +#else + typedef struct { float real, imag; } __pyx_t_float_complex; +#endif +static CYTHON_INLINE __pyx_t_float_complex __pyx_t_float_complex_from_parts(float, float); + +/* Declarations.proto */ +#if CYTHON_CCOMPLEX && (1) && (!0 || __cplusplus) + #ifdef __cplusplus + typedef ::std::complex< double > __pyx_t_double_complex; + #else + typedef double _Complex __pyx_t_double_complex; + #endif +#else + typedef struct { double real, imag; } __pyx_t_double_complex; +#endif +static CYTHON_INLINE __pyx_t_double_complex __pyx_t_double_complex_from_parts(double, double); + +/* Declarations.proto */ +#if CYTHON_CCOMPLEX && (1) && (!0 || __cplusplus) + #ifdef __cplusplus + typedef ::std::complex< long double > __pyx_t_long_double_complex; + #else + typedef long double _Complex __pyx_t_long_double_complex; + #endif +#else + typedef struct { long double real, imag; } __pyx_t_long_double_complex; +#endif +static CYTHON_INLINE __pyx_t_long_double_complex __pyx_t_long_double_complex_from_parts(long double, long double); + +/* #### Code section: type_declarations ### */ + +/*--- Type declarations ---*/ +struct __pyx_obj_5cymem_5cymem_PyMalloc; +struct __pyx_obj_5cymem_5cymem_PyFree; +struct __pyx_obj_5cymem_5cymem_Pool; +struct __pyx_obj_5cymem_5cymem_Address; +struct __pyx_obj_7preshed_4maps_PreshMap; +struct __pyx_obj_7preshed_4maps_PreshMapArray; +struct __pyx_obj_5spacy_7strings_StringStore; +struct __pyx_obj_5spacy_10morphology_Morphology; +struct __pyx_obj_5spacy_5vocab_Vocab; +struct __pyx_obj_5spacy_6tokens_3doc_Doc; +struct __pyx_obj_5spacy_8training_7example_Example; +struct __pyx_obj_5spacy_6lexeme_Lexeme; +struct __pyx_obj_5spacy_8pipeline_17_parser_internals_10stateclass_StateClass; +struct __pyx_obj_5spacy_8pipeline_17_parser_internals_17transition_system_TransitionSystem; +struct __pyx_obj_5thinc_5extra_6search_Beam; +struct __pyx_obj_5thinc_5extra_6search_MaxViolation; +struct __pyx_obj_5spacy_6tokens_4span_Span; +struct __pyx_obj_5spacy_8pipeline_17_parser_internals_3ner_BiluoPushDown; +struct __pyx_obj_5spacy_8pipeline_17_parser_internals_3ner_BiluoGold; +struct __pyx_obj_5spacy_8pipeline_17_parser_internals_3ner_Missing; +struct __pyx_obj_5spacy_8pipeline_17_parser_internals_3ner_Begin; +struct __pyx_obj_5spacy_8pipeline_17_parser_internals_3ner_In; +struct __pyx_obj_5spacy_8pipeline_17_parser_internals_3ner_Last; +struct __pyx_obj_5spacy_8pipeline_17_parser_internals_3ner_Unit; +struct __pyx_obj_5spacy_8pipeline_17_parser_internals_3ner_Out; +struct __pyx_array_obj; +struct __pyx_MemviewEnum_obj; +struct __pyx_memoryview_obj; +struct __pyx_memoryviewslice_obj; + +/* "cymem/cymem.pxd":1 + * ctypedef void* (*malloc_t)(size_t n) # <<<<<<<<<<<<<< + * ctypedef void (*free_t)(void *p) + * +*/ +typedef void *(*__pyx_t_5cymem_5cymem_malloc_t)(size_t); + +/* "cymem/cymem.pxd":2 + * ctypedef void* (*malloc_t)(size_t n) + * ctypedef void (*free_t)(void *p) # <<<<<<<<<<<<<< + * + * cdef class PyMalloc: +*/ +typedef void (*__pyx_t_5cymem_5cymem_free_t)(void *); +struct __pyx_t_7preshed_4maps_Cell; +struct __pyx_t_7preshed_4maps_Result; +struct __pyx_t_7preshed_4maps_MapStruct; + +/* "preshed/maps.pxd":8 + * + * + * cdef struct Cell: # <<<<<<<<<<<<<< + * key_t key + * void* value +*/ +struct __pyx_t_7preshed_4maps_Cell { + __pyx_t_7preshed_4maps_key_t key; + void *value; +}; + +/* "preshed/maps.pxd":13 + * + * + * cdef struct Result: # <<<<<<<<<<<<<< + * int found + * void* value +*/ +struct __pyx_t_7preshed_4maps_Result { + int found; + void *value; +}; + +/* "preshed/maps.pxd":18 + * + * + * cdef struct MapStruct: # <<<<<<<<<<<<<< + * Cell* cells + * void* value_for_empty_key +*/ +struct __pyx_t_7preshed_4maps_MapStruct { + struct __pyx_t_7preshed_4maps_Cell *cells; + void *value_for_empty_key; + void *value_for_del_key; + __pyx_t_7preshed_4maps_key_t length; + __pyx_t_7preshed_4maps_key_t filled; + int is_empty_key_set; + int is_del_key_set; +}; +union __pyx_t_5spacy_7strings_Utf8Str; +typedef union __pyx_t_5spacy_7strings_Utf8Str __pyx_t_5spacy_7strings_Utf8Str; + +/* "strings.pxd":17 + * + * + * ctypedef union Utf8Str: # <<<<<<<<<<<<<< + * unsigned char[8] s + * unsigned char* p +*/ +union __pyx_t_5spacy_7strings_Utf8Str { + unsigned char s[8]; + unsigned char *p; +}; + +/* "symbols.pxd":1 + * cdef enum symbol_t: # <<<<<<<<<<<<<< + * NIL + * IS_ALPHA +*/ +enum __pyx_t_5spacy_7symbols_symbol_t { + __pyx_e_5spacy_7symbols_NIL, + __pyx_e_5spacy_7symbols_IS_ALPHA, + __pyx_e_5spacy_7symbols_IS_ASCII, + __pyx_e_5spacy_7symbols_IS_DIGIT, + __pyx_e_5spacy_7symbols_IS_LOWER, + __pyx_e_5spacy_7symbols_IS_PUNCT, + __pyx_e_5spacy_7symbols_IS_SPACE, + __pyx_e_5spacy_7symbols_IS_TITLE, + __pyx_e_5spacy_7symbols_IS_UPPER, + __pyx_e_5spacy_7symbols_LIKE_URL, + __pyx_e_5spacy_7symbols_LIKE_NUM, + __pyx_e_5spacy_7symbols_LIKE_EMAIL, + __pyx_e_5spacy_7symbols_IS_STOP, + __pyx_e_5spacy_7symbols_IS_OOV_DEPRECATED, + __pyx_e_5spacy_7symbols_IS_BRACKET, + __pyx_e_5spacy_7symbols_IS_QUOTE, + __pyx_e_5spacy_7symbols_IS_LEFT_PUNCT, + __pyx_e_5spacy_7symbols_IS_RIGHT_PUNCT, + __pyx_e_5spacy_7symbols_IS_CURRENCY, + __pyx_e_5spacy_7symbols_FLAG19 = 19, + __pyx_e_5spacy_7symbols_FLAG20, + __pyx_e_5spacy_7symbols_FLAG21, + __pyx_e_5spacy_7symbols_FLAG22, + __pyx_e_5spacy_7symbols_FLAG23, + __pyx_e_5spacy_7symbols_FLAG24, + __pyx_e_5spacy_7symbols_FLAG25, + __pyx_e_5spacy_7symbols_FLAG26, + __pyx_e_5spacy_7symbols_FLAG27, + __pyx_e_5spacy_7symbols_FLAG28, + __pyx_e_5spacy_7symbols_FLAG29, + __pyx_e_5spacy_7symbols_FLAG30, + __pyx_e_5spacy_7symbols_FLAG31, + __pyx_e_5spacy_7symbols_FLAG32, + __pyx_e_5spacy_7symbols_FLAG33, + __pyx_e_5spacy_7symbols_FLAG34, + __pyx_e_5spacy_7symbols_FLAG35, + __pyx_e_5spacy_7symbols_FLAG36, + __pyx_e_5spacy_7symbols_FLAG37, + __pyx_e_5spacy_7symbols_FLAG38, + __pyx_e_5spacy_7symbols_FLAG39, + __pyx_e_5spacy_7symbols_FLAG40, + __pyx_e_5spacy_7symbols_FLAG41, + __pyx_e_5spacy_7symbols_FLAG42, + __pyx_e_5spacy_7symbols_FLAG43, + __pyx_e_5spacy_7symbols_FLAG44, + __pyx_e_5spacy_7symbols_FLAG45, + __pyx_e_5spacy_7symbols_FLAG46, + __pyx_e_5spacy_7symbols_FLAG47, + __pyx_e_5spacy_7symbols_FLAG48, + __pyx_e_5spacy_7symbols_FLAG49, + __pyx_e_5spacy_7symbols_FLAG50, + __pyx_e_5spacy_7symbols_FLAG51, + __pyx_e_5spacy_7symbols_FLAG52, + __pyx_e_5spacy_7symbols_FLAG53, + __pyx_e_5spacy_7symbols_FLAG54, + __pyx_e_5spacy_7symbols_FLAG55, + __pyx_e_5spacy_7symbols_FLAG56, + __pyx_e_5spacy_7symbols_FLAG57, + __pyx_e_5spacy_7symbols_FLAG58, + __pyx_e_5spacy_7symbols_FLAG59, + __pyx_e_5spacy_7symbols_FLAG60, + __pyx_e_5spacy_7symbols_FLAG61, + __pyx_e_5spacy_7symbols_FLAG62, + __pyx_e_5spacy_7symbols_FLAG63, + __pyx_e_5spacy_7symbols_ID, + __pyx_e_5spacy_7symbols_ORTH, + __pyx_e_5spacy_7symbols_LOWER, + __pyx_e_5spacy_7symbols_NORM, + __pyx_e_5spacy_7symbols_SHAPE, + __pyx_e_5spacy_7symbols_PREFIX, + __pyx_e_5spacy_7symbols_SUFFIX, + __pyx_e_5spacy_7symbols_LENGTH, + __pyx_e_5spacy_7symbols_CLUSTER, + __pyx_e_5spacy_7symbols_LEMMA, + __pyx_e_5spacy_7symbols_POS, + __pyx_e_5spacy_7symbols_TAG, + __pyx_e_5spacy_7symbols_DEP, + __pyx_e_5spacy_7symbols_ENT_IOB, + __pyx_e_5spacy_7symbols_ENT_TYPE, + __pyx_e_5spacy_7symbols_HEAD, + __pyx_e_5spacy_7symbols_SENT_START, + __pyx_e_5spacy_7symbols_SPACY, + __pyx_e_5spacy_7symbols_PROB, + __pyx_e_5spacy_7symbols_LANG, + __pyx_e_5spacy_7symbols_ADJ, + __pyx_e_5spacy_7symbols_ADP, + __pyx_e_5spacy_7symbols_ADV, + __pyx_e_5spacy_7symbols_AUX, + __pyx_e_5spacy_7symbols_CONJ, + __pyx_e_5spacy_7symbols_CCONJ, + __pyx_e_5spacy_7symbols_DET, + __pyx_e_5spacy_7symbols_INTJ, + __pyx_e_5spacy_7symbols_NOUN, + __pyx_e_5spacy_7symbols_NUM, + __pyx_e_5spacy_7symbols_PART, + __pyx_e_5spacy_7symbols_PRON, + __pyx_e_5spacy_7symbols_PROPN, + __pyx_e_5spacy_7symbols_PUNCT, + __pyx_e_5spacy_7symbols_SCONJ, + __pyx_e_5spacy_7symbols_SYM, + __pyx_e_5spacy_7symbols_VERB, + __pyx_e_5spacy_7symbols_X, + __pyx_e_5spacy_7symbols_EOL, + __pyx_e_5spacy_7symbols_SPACE, + __pyx_e_5spacy_7symbols_DEPRECATED001, + __pyx_e_5spacy_7symbols_DEPRECATED002, + __pyx_e_5spacy_7symbols_DEPRECATED003, + __pyx_e_5spacy_7symbols_DEPRECATED004, + __pyx_e_5spacy_7symbols_DEPRECATED005, + __pyx_e_5spacy_7symbols_DEPRECATED006, + __pyx_e_5spacy_7symbols_DEPRECATED007, + __pyx_e_5spacy_7symbols_DEPRECATED008, + __pyx_e_5spacy_7symbols_DEPRECATED009, + __pyx_e_5spacy_7symbols_DEPRECATED010, + __pyx_e_5spacy_7symbols_DEPRECATED011, + __pyx_e_5spacy_7symbols_DEPRECATED012, + __pyx_e_5spacy_7symbols_DEPRECATED013, + __pyx_e_5spacy_7symbols_DEPRECATED014, + __pyx_e_5spacy_7symbols_DEPRECATED015, + __pyx_e_5spacy_7symbols_DEPRECATED016, + __pyx_e_5spacy_7symbols_DEPRECATED017, + __pyx_e_5spacy_7symbols_DEPRECATED018, + __pyx_e_5spacy_7symbols_DEPRECATED019, + __pyx_e_5spacy_7symbols_DEPRECATED020, + __pyx_e_5spacy_7symbols_DEPRECATED021, + __pyx_e_5spacy_7symbols_DEPRECATED022, + __pyx_e_5spacy_7symbols_DEPRECATED023, + __pyx_e_5spacy_7symbols_DEPRECATED024, + __pyx_e_5spacy_7symbols_DEPRECATED025, + __pyx_e_5spacy_7symbols_DEPRECATED026, + __pyx_e_5spacy_7symbols_DEPRECATED027, + __pyx_e_5spacy_7symbols_DEPRECATED028, + __pyx_e_5spacy_7symbols_DEPRECATED029, + __pyx_e_5spacy_7symbols_DEPRECATED030, + __pyx_e_5spacy_7symbols_DEPRECATED031, + __pyx_e_5spacy_7symbols_DEPRECATED032, + __pyx_e_5spacy_7symbols_DEPRECATED033, + __pyx_e_5spacy_7symbols_DEPRECATED034, + __pyx_e_5spacy_7symbols_DEPRECATED035, + __pyx_e_5spacy_7symbols_DEPRECATED036, + __pyx_e_5spacy_7symbols_DEPRECATED037, + __pyx_e_5spacy_7symbols_DEPRECATED038, + __pyx_e_5spacy_7symbols_DEPRECATED039, + __pyx_e_5spacy_7symbols_DEPRECATED040, + __pyx_e_5spacy_7symbols_DEPRECATED041, + __pyx_e_5spacy_7symbols_DEPRECATED042, + __pyx_e_5spacy_7symbols_DEPRECATED043, + __pyx_e_5spacy_7symbols_DEPRECATED044, + __pyx_e_5spacy_7symbols_DEPRECATED045, + __pyx_e_5spacy_7symbols_DEPRECATED046, + __pyx_e_5spacy_7symbols_DEPRECATED047, + __pyx_e_5spacy_7symbols_DEPRECATED048, + __pyx_e_5spacy_7symbols_DEPRECATED049, + __pyx_e_5spacy_7symbols_DEPRECATED050, + __pyx_e_5spacy_7symbols_DEPRECATED051, + __pyx_e_5spacy_7symbols_DEPRECATED052, + __pyx_e_5spacy_7symbols_DEPRECATED053, + __pyx_e_5spacy_7symbols_DEPRECATED054, + __pyx_e_5spacy_7symbols_DEPRECATED055, + __pyx_e_5spacy_7symbols_DEPRECATED056, + __pyx_e_5spacy_7symbols_DEPRECATED057, + __pyx_e_5spacy_7symbols_DEPRECATED058, + __pyx_e_5spacy_7symbols_DEPRECATED059, + __pyx_e_5spacy_7symbols_DEPRECATED060, + __pyx_e_5spacy_7symbols_DEPRECATED061, + __pyx_e_5spacy_7symbols_DEPRECATED062, + __pyx_e_5spacy_7symbols_DEPRECATED063, + __pyx_e_5spacy_7symbols_DEPRECATED064, + __pyx_e_5spacy_7symbols_DEPRECATED065, + __pyx_e_5spacy_7symbols_DEPRECATED066, + __pyx_e_5spacy_7symbols_DEPRECATED067, + __pyx_e_5spacy_7symbols_DEPRECATED068, + __pyx_e_5spacy_7symbols_DEPRECATED069, + __pyx_e_5spacy_7symbols_DEPRECATED070, + __pyx_e_5spacy_7symbols_DEPRECATED071, + __pyx_e_5spacy_7symbols_DEPRECATED072, + __pyx_e_5spacy_7symbols_DEPRECATED073, + __pyx_e_5spacy_7symbols_DEPRECATED074, + __pyx_e_5spacy_7symbols_DEPRECATED075, + __pyx_e_5spacy_7symbols_DEPRECATED076, + __pyx_e_5spacy_7symbols_DEPRECATED077, + __pyx_e_5spacy_7symbols_DEPRECATED078, + __pyx_e_5spacy_7symbols_DEPRECATED079, + __pyx_e_5spacy_7symbols_DEPRECATED080, + __pyx_e_5spacy_7symbols_DEPRECATED081, + __pyx_e_5spacy_7symbols_DEPRECATED082, + __pyx_e_5spacy_7symbols_DEPRECATED083, + __pyx_e_5spacy_7symbols_DEPRECATED084, + __pyx_e_5spacy_7symbols_DEPRECATED085, + __pyx_e_5spacy_7symbols_DEPRECATED086, + __pyx_e_5spacy_7symbols_DEPRECATED087, + __pyx_e_5spacy_7symbols_DEPRECATED088, + __pyx_e_5spacy_7symbols_DEPRECATED089, + __pyx_e_5spacy_7symbols_DEPRECATED090, + __pyx_e_5spacy_7symbols_DEPRECATED091, + __pyx_e_5spacy_7symbols_DEPRECATED092, + __pyx_e_5spacy_7symbols_DEPRECATED093, + __pyx_e_5spacy_7symbols_DEPRECATED094, + __pyx_e_5spacy_7symbols_DEPRECATED095, + __pyx_e_5spacy_7symbols_DEPRECATED096, + __pyx_e_5spacy_7symbols_DEPRECATED097, + __pyx_e_5spacy_7symbols_DEPRECATED098, + __pyx_e_5spacy_7symbols_DEPRECATED099, + __pyx_e_5spacy_7symbols_DEPRECATED100, + __pyx_e_5spacy_7symbols_DEPRECATED101, + __pyx_e_5spacy_7symbols_DEPRECATED102, + __pyx_e_5spacy_7symbols_DEPRECATED103, + __pyx_e_5spacy_7symbols_DEPRECATED104, + __pyx_e_5spacy_7symbols_DEPRECATED105, + __pyx_e_5spacy_7symbols_DEPRECATED106, + __pyx_e_5spacy_7symbols_DEPRECATED107, + __pyx_e_5spacy_7symbols_DEPRECATED108, + __pyx_e_5spacy_7symbols_DEPRECATED109, + __pyx_e_5spacy_7symbols_DEPRECATED110, + __pyx_e_5spacy_7symbols_DEPRECATED111, + __pyx_e_5spacy_7symbols_DEPRECATED112, + __pyx_e_5spacy_7symbols_DEPRECATED113, + __pyx_e_5spacy_7symbols_DEPRECATED114, + __pyx_e_5spacy_7symbols_DEPRECATED115, + __pyx_e_5spacy_7symbols_DEPRECATED116, + __pyx_e_5spacy_7symbols_DEPRECATED117, + __pyx_e_5spacy_7symbols_DEPRECATED118, + __pyx_e_5spacy_7symbols_DEPRECATED119, + __pyx_e_5spacy_7symbols_DEPRECATED120, + __pyx_e_5spacy_7symbols_DEPRECATED121, + __pyx_e_5spacy_7symbols_DEPRECATED122, + __pyx_e_5spacy_7symbols_DEPRECATED123, + __pyx_e_5spacy_7symbols_DEPRECATED124, + __pyx_e_5spacy_7symbols_DEPRECATED125, + __pyx_e_5spacy_7symbols_DEPRECATED126, + __pyx_e_5spacy_7symbols_DEPRECATED127, + __pyx_e_5spacy_7symbols_DEPRECATED128, + __pyx_e_5spacy_7symbols_DEPRECATED129, + __pyx_e_5spacy_7symbols_DEPRECATED130, + __pyx_e_5spacy_7symbols_DEPRECATED131, + __pyx_e_5spacy_7symbols_DEPRECATED132, + __pyx_e_5spacy_7symbols_DEPRECATED133, + __pyx_e_5spacy_7symbols_DEPRECATED134, + __pyx_e_5spacy_7symbols_DEPRECATED135, + __pyx_e_5spacy_7symbols_DEPRECATED136, + __pyx_e_5spacy_7symbols_DEPRECATED137, + __pyx_e_5spacy_7symbols_DEPRECATED138, + __pyx_e_5spacy_7symbols_DEPRECATED139, + __pyx_e_5spacy_7symbols_DEPRECATED140, + __pyx_e_5spacy_7symbols_DEPRECATED141, + __pyx_e_5spacy_7symbols_DEPRECATED142, + __pyx_e_5spacy_7symbols_DEPRECATED143, + __pyx_e_5spacy_7symbols_DEPRECATED144, + __pyx_e_5spacy_7symbols_DEPRECATED145, + __pyx_e_5spacy_7symbols_DEPRECATED146, + __pyx_e_5spacy_7symbols_DEPRECATED147, + __pyx_e_5spacy_7symbols_DEPRECATED148, + __pyx_e_5spacy_7symbols_DEPRECATED149, + __pyx_e_5spacy_7symbols_DEPRECATED150, + __pyx_e_5spacy_7symbols_DEPRECATED151, + __pyx_e_5spacy_7symbols_DEPRECATED152, + __pyx_e_5spacy_7symbols_DEPRECATED153, + __pyx_e_5spacy_7symbols_DEPRECATED154, + __pyx_e_5spacy_7symbols_DEPRECATED155, + __pyx_e_5spacy_7symbols_DEPRECATED156, + __pyx_e_5spacy_7symbols_DEPRECATED157, + __pyx_e_5spacy_7symbols_DEPRECATED158, + __pyx_e_5spacy_7symbols_DEPRECATED159, + __pyx_e_5spacy_7symbols_DEPRECATED160, + __pyx_e_5spacy_7symbols_DEPRECATED161, + __pyx_e_5spacy_7symbols_DEPRECATED162, + __pyx_e_5spacy_7symbols_DEPRECATED163, + __pyx_e_5spacy_7symbols_DEPRECATED164, + __pyx_e_5spacy_7symbols_DEPRECATED165, + __pyx_e_5spacy_7symbols_DEPRECATED166, + __pyx_e_5spacy_7symbols_DEPRECATED167, + __pyx_e_5spacy_7symbols_DEPRECATED168, + __pyx_e_5spacy_7symbols_DEPRECATED169, + __pyx_e_5spacy_7symbols_DEPRECATED170, + __pyx_e_5spacy_7symbols_DEPRECATED171, + __pyx_e_5spacy_7symbols_DEPRECATED172, + __pyx_e_5spacy_7symbols_DEPRECATED173, + __pyx_e_5spacy_7symbols_DEPRECATED174, + __pyx_e_5spacy_7symbols_DEPRECATED175, + __pyx_e_5spacy_7symbols_DEPRECATED176, + __pyx_e_5spacy_7symbols_DEPRECATED177, + __pyx_e_5spacy_7symbols_DEPRECATED178, + __pyx_e_5spacy_7symbols_DEPRECATED179, + __pyx_e_5spacy_7symbols_DEPRECATED180, + __pyx_e_5spacy_7symbols_DEPRECATED181, + __pyx_e_5spacy_7symbols_DEPRECATED182, + __pyx_e_5spacy_7symbols_DEPRECATED183, + __pyx_e_5spacy_7symbols_DEPRECATED184, + __pyx_e_5spacy_7symbols_DEPRECATED185, + __pyx_e_5spacy_7symbols_DEPRECATED186, + __pyx_e_5spacy_7symbols_DEPRECATED187, + __pyx_e_5spacy_7symbols_DEPRECATED188, + __pyx_e_5spacy_7symbols_DEPRECATED189, + __pyx_e_5spacy_7symbols_DEPRECATED190, + __pyx_e_5spacy_7symbols_DEPRECATED191, + __pyx_e_5spacy_7symbols_DEPRECATED192, + __pyx_e_5spacy_7symbols_DEPRECATED193, + __pyx_e_5spacy_7symbols_DEPRECATED194, + __pyx_e_5spacy_7symbols_DEPRECATED195, + __pyx_e_5spacy_7symbols_DEPRECATED196, + __pyx_e_5spacy_7symbols_DEPRECATED197, + __pyx_e_5spacy_7symbols_DEPRECATED198, + __pyx_e_5spacy_7symbols_DEPRECATED199, + __pyx_e_5spacy_7symbols_DEPRECATED200, + __pyx_e_5spacy_7symbols_DEPRECATED201, + __pyx_e_5spacy_7symbols_DEPRECATED202, + __pyx_e_5spacy_7symbols_DEPRECATED203, + __pyx_e_5spacy_7symbols_DEPRECATED204, + __pyx_e_5spacy_7symbols_DEPRECATED205, + __pyx_e_5spacy_7symbols_DEPRECATED206, + __pyx_e_5spacy_7symbols_DEPRECATED207, + __pyx_e_5spacy_7symbols_DEPRECATED208, + __pyx_e_5spacy_7symbols_DEPRECATED209, + __pyx_e_5spacy_7symbols_DEPRECATED210, + __pyx_e_5spacy_7symbols_DEPRECATED211, + __pyx_e_5spacy_7symbols_DEPRECATED212, + __pyx_e_5spacy_7symbols_DEPRECATED213, + __pyx_e_5spacy_7symbols_DEPRECATED214, + __pyx_e_5spacy_7symbols_DEPRECATED215, + __pyx_e_5spacy_7symbols_DEPRECATED216, + __pyx_e_5spacy_7symbols_DEPRECATED217, + __pyx_e_5spacy_7symbols_DEPRECATED218, + __pyx_e_5spacy_7symbols_DEPRECATED219, + __pyx_e_5spacy_7symbols_DEPRECATED220, + __pyx_e_5spacy_7symbols_DEPRECATED221, + __pyx_e_5spacy_7symbols_DEPRECATED222, + __pyx_e_5spacy_7symbols_DEPRECATED223, + __pyx_e_5spacy_7symbols_DEPRECATED224, + __pyx_e_5spacy_7symbols_DEPRECATED225, + __pyx_e_5spacy_7symbols_DEPRECATED226, + __pyx_e_5spacy_7symbols_DEPRECATED227, + __pyx_e_5spacy_7symbols_DEPRECATED228, + __pyx_e_5spacy_7symbols_DEPRECATED229, + __pyx_e_5spacy_7symbols_DEPRECATED230, + __pyx_e_5spacy_7symbols_DEPRECATED231, + __pyx_e_5spacy_7symbols_DEPRECATED232, + __pyx_e_5spacy_7symbols_DEPRECATED233, + __pyx_e_5spacy_7symbols_DEPRECATED234, + __pyx_e_5spacy_7symbols_DEPRECATED235, + __pyx_e_5spacy_7symbols_DEPRECATED236, + __pyx_e_5spacy_7symbols_DEPRECATED237, + __pyx_e_5spacy_7symbols_DEPRECATED238, + __pyx_e_5spacy_7symbols_DEPRECATED239, + __pyx_e_5spacy_7symbols_DEPRECATED240, + __pyx_e_5spacy_7symbols_DEPRECATED241, + __pyx_e_5spacy_7symbols_DEPRECATED242, + __pyx_e_5spacy_7symbols_DEPRECATED243, + __pyx_e_5spacy_7symbols_DEPRECATED244, + __pyx_e_5spacy_7symbols_DEPRECATED245, + __pyx_e_5spacy_7symbols_DEPRECATED246, + __pyx_e_5spacy_7symbols_DEPRECATED247, + __pyx_e_5spacy_7symbols_DEPRECATED248, + __pyx_e_5spacy_7symbols_DEPRECATED249, + __pyx_e_5spacy_7symbols_DEPRECATED250, + __pyx_e_5spacy_7symbols_DEPRECATED251, + __pyx_e_5spacy_7symbols_DEPRECATED252, + __pyx_e_5spacy_7symbols_DEPRECATED253, + __pyx_e_5spacy_7symbols_DEPRECATED254, + __pyx_e_5spacy_7symbols_DEPRECATED255, + __pyx_e_5spacy_7symbols_DEPRECATED256, + __pyx_e_5spacy_7symbols_DEPRECATED257, + __pyx_e_5spacy_7symbols_DEPRECATED258, + __pyx_e_5spacy_7symbols_DEPRECATED259, + __pyx_e_5spacy_7symbols_DEPRECATED260, + __pyx_e_5spacy_7symbols_DEPRECATED261, + __pyx_e_5spacy_7symbols_DEPRECATED262, + __pyx_e_5spacy_7symbols_DEPRECATED263, + __pyx_e_5spacy_7symbols_DEPRECATED264, + __pyx_e_5spacy_7symbols_DEPRECATED265, + __pyx_e_5spacy_7symbols_DEPRECATED266, + __pyx_e_5spacy_7symbols_DEPRECATED267, + __pyx_e_5spacy_7symbols_DEPRECATED268, + __pyx_e_5spacy_7symbols_DEPRECATED269, + __pyx_e_5spacy_7symbols_DEPRECATED270, + __pyx_e_5spacy_7symbols_DEPRECATED271, + __pyx_e_5spacy_7symbols_DEPRECATED272, + __pyx_e_5spacy_7symbols_DEPRECATED273, + __pyx_e_5spacy_7symbols_DEPRECATED274, + __pyx_e_5spacy_7symbols_DEPRECATED275, + __pyx_e_5spacy_7symbols_DEPRECATED276, + __pyx_e_5spacy_7symbols_PERSON, + __pyx_e_5spacy_7symbols_NORP, + __pyx_e_5spacy_7symbols_FACILITY, + __pyx_e_5spacy_7symbols_ORG, + __pyx_e_5spacy_7symbols_GPE, + __pyx_e_5spacy_7symbols_LOC, + __pyx_e_5spacy_7symbols_PRODUCT, + __pyx_e_5spacy_7symbols_EVENT, + __pyx_e_5spacy_7symbols_WORK_OF_ART, + __pyx_e_5spacy_7symbols_LANGUAGE, + __pyx_e_5spacy_7symbols_LAW, + __pyx_e_5spacy_7symbols_DATE, + __pyx_e_5spacy_7symbols_TIME, + __pyx_e_5spacy_7symbols_PERCENT, + __pyx_e_5spacy_7symbols_MONEY, + __pyx_e_5spacy_7symbols_QUANTITY, + __pyx_e_5spacy_7symbols_ORDINAL, + __pyx_e_5spacy_7symbols_CARDINAL, + __pyx_e_5spacy_7symbols_acomp, + __pyx_e_5spacy_7symbols_advcl, + __pyx_e_5spacy_7symbols_advmod, + __pyx_e_5spacy_7symbols_agent, + __pyx_e_5spacy_7symbols_amod, + __pyx_e_5spacy_7symbols_appos, + __pyx_e_5spacy_7symbols_attr, + __pyx_e_5spacy_7symbols_aux, + __pyx_e_5spacy_7symbols_auxpass, + __pyx_e_5spacy_7symbols_cc, + __pyx_e_5spacy_7symbols_ccomp, + __pyx_e_5spacy_7symbols_complm, + __pyx_e_5spacy_7symbols_conj, + __pyx_e_5spacy_7symbols_cop, + __pyx_e_5spacy_7symbols_csubj, + __pyx_e_5spacy_7symbols_csubjpass, + __pyx_e_5spacy_7symbols_dep, + __pyx_e_5spacy_7symbols_det, + __pyx_e_5spacy_7symbols_dobj, + __pyx_e_5spacy_7symbols_expl, + __pyx_e_5spacy_7symbols_hmod, + __pyx_e_5spacy_7symbols_hyph, + __pyx_e_5spacy_7symbols_infmod, + __pyx_e_5spacy_7symbols_intj, + __pyx_e_5spacy_7symbols_iobj, + __pyx_e_5spacy_7symbols_mark, + __pyx_e_5spacy_7symbols_meta, + __pyx_e_5spacy_7symbols_neg, + __pyx_e_5spacy_7symbols_nmod, + __pyx_e_5spacy_7symbols_nn, + __pyx_e_5spacy_7symbols_npadvmod, + __pyx_e_5spacy_7symbols_nsubj, + __pyx_e_5spacy_7symbols_nsubjpass, + __pyx_e_5spacy_7symbols_num, + __pyx_e_5spacy_7symbols_number, + __pyx_e_5spacy_7symbols_oprd, + __pyx_e_5spacy_7symbols_obj, + __pyx_e_5spacy_7symbols_obl, + __pyx_e_5spacy_7symbols_parataxis, + __pyx_e_5spacy_7symbols_partmod, + __pyx_e_5spacy_7symbols_pcomp, + __pyx_e_5spacy_7symbols_pobj, + __pyx_e_5spacy_7symbols_poss, + __pyx_e_5spacy_7symbols_possessive, + __pyx_e_5spacy_7symbols_preconj, + __pyx_e_5spacy_7symbols_prep, + __pyx_e_5spacy_7symbols_prt, + __pyx_e_5spacy_7symbols_punct, + __pyx_e_5spacy_7symbols_quantmod, + __pyx_e_5spacy_7symbols_relcl, + __pyx_e_5spacy_7symbols_rcmod, + __pyx_e_5spacy_7symbols_root, + __pyx_e_5spacy_7symbols_xcomp, + __pyx_e_5spacy_7symbols_acl, + __pyx_e_5spacy_7symbols_ENT_KB_ID, + __pyx_e_5spacy_7symbols_MORPH, + __pyx_e_5spacy_7symbols_ENT_ID, + __pyx_e_5spacy_7symbols_IDX, + __pyx_e_5spacy_7symbols__ +}; + +/* "parts_of_speech.pxd":4 + * + * + * cpdef enum univ_pos_t: # <<<<<<<<<<<<<< + * NO_TAG = 0 + * ADJ = symbols.ADJ +*/ +enum __pyx_t_5spacy_15parts_of_speech_univ_pos_t { + + /* "parts_of_speech.pxd":6 + * cpdef enum univ_pos_t: + * NO_TAG = 0 + * ADJ = symbols.ADJ # <<<<<<<<<<<<<< + * ADP + * ADV +*/ + __pyx_e_5spacy_15parts_of_speech_NO_TAG = 0, + __pyx_e_5spacy_15parts_of_speech_ADJ = __pyx_e_5spacy_7symbols_ADJ, + __pyx_e_5spacy_15parts_of_speech_ADP, + __pyx_e_5spacy_15parts_of_speech_ADV, + __pyx_e_5spacy_15parts_of_speech_AUX, + __pyx_e_5spacy_15parts_of_speech_CONJ, + __pyx_e_5spacy_15parts_of_speech_CCONJ, + __pyx_e_5spacy_15parts_of_speech_DET, + __pyx_e_5spacy_15parts_of_speech_INTJ, + __pyx_e_5spacy_15parts_of_speech_NOUN, + __pyx_e_5spacy_15parts_of_speech_NUM, + __pyx_e_5spacy_15parts_of_speech_PART, + __pyx_e_5spacy_15parts_of_speech_PRON, + __pyx_e_5spacy_15parts_of_speech_PROPN, + __pyx_e_5spacy_15parts_of_speech_PUNCT, + __pyx_e_5spacy_15parts_of_speech_SCONJ, + __pyx_e_5spacy_15parts_of_speech_SYM, + __pyx_e_5spacy_15parts_of_speech_VERB, + __pyx_e_5spacy_15parts_of_speech_X, + __pyx_e_5spacy_15parts_of_speech_EOL, + __pyx_e_5spacy_15parts_of_speech_SPACE +}; +struct __pyx_t_5spacy_7structs_LexemeC; +struct __pyx_t_5spacy_7structs_SpanC; +struct __pyx_t_5spacy_7structs_TokenC; +struct __pyx_t_5spacy_7structs_MorphAnalysisC; +struct __pyx_t_5spacy_7structs_KBEntryC; +struct __pyx_t_5spacy_7structs_AliasC; +struct __pyx_t_5spacy_7structs_EdgeC; +struct __pyx_t_5spacy_7structs_GraphC; + +/* "structs.pxd":10 + * + * + * cdef struct LexemeC: # <<<<<<<<<<<<<< + * flags_t flags + * +*/ +struct __pyx_t_5spacy_7structs_LexemeC { + __pyx_t_5spacy_8typedefs_flags_t flags; + __pyx_t_5spacy_8typedefs_attr_t lang; + __pyx_t_5spacy_8typedefs_attr_t id; + __pyx_t_5spacy_8typedefs_attr_t length; + __pyx_t_5spacy_8typedefs_attr_t orth; + __pyx_t_5spacy_8typedefs_attr_t lower; + __pyx_t_5spacy_8typedefs_attr_t norm; + __pyx_t_5spacy_8typedefs_attr_t shape; + __pyx_t_5spacy_8typedefs_attr_t prefix; + __pyx_t_5spacy_8typedefs_attr_t suffix; +}; + +/* "structs.pxd":26 + * + * + * cdef struct SpanC: # <<<<<<<<<<<<<< + * hash_t id + * int start +*/ +struct __pyx_t_5spacy_7structs_SpanC { + __pyx_t_5spacy_8typedefs_hash_t id; + int start; + int end; + int start_char; + int end_char; + __pyx_t_5spacy_8typedefs_attr_t label; + __pyx_t_5spacy_8typedefs_attr_t kb_id; +}; + +/* "structs.pxd":36 + * + * + * cdef struct TokenC: # <<<<<<<<<<<<<< + * const LexemeC* lex + * uint64_t morph +*/ +struct __pyx_t_5spacy_7structs_TokenC { + struct __pyx_t_5spacy_7structs_LexemeC const *lex; + uint64_t morph; + enum __pyx_t_5spacy_15parts_of_speech_univ_pos_t pos; + int spacy; + __pyx_t_5spacy_8typedefs_attr_t tag; + int idx; + __pyx_t_5spacy_8typedefs_attr_t lemma; + __pyx_t_5spacy_8typedefs_attr_t norm; + int head; + __pyx_t_5spacy_8typedefs_attr_t dep; + uint32_t l_kids; + uint32_t r_kids; + uint32_t l_edge; + uint32_t r_edge; + int sent_start; + int ent_iob; + __pyx_t_5spacy_8typedefs_attr_t ent_type; + __pyx_t_5spacy_8typedefs_attr_t ent_kb_id; + __pyx_t_5spacy_8typedefs_hash_t ent_id; +}; + +/* "structs.pxd":60 + * + * + * cdef struct MorphAnalysisC: # <<<<<<<<<<<<<< + * hash_t key + * int length +*/ +struct __pyx_t_5spacy_7structs_MorphAnalysisC { + __pyx_t_5spacy_8typedefs_hash_t key; + int length; + __pyx_t_5spacy_8typedefs_attr_t *fields; + __pyx_t_5spacy_8typedefs_attr_t *features; +}; + +/* "structs.pxd":69 + * + * # Internal struct, for storage and disambiguation of entities. + * cdef struct KBEntryC: # <<<<<<<<<<<<<< + * + * # The hash of this entry's unique ID/name in the kB +*/ +struct __pyx_t_5spacy_7structs_KBEntryC { + __pyx_t_5spacy_8typedefs_hash_t entity_hash; + int32_t vector_index; + int32_t feats_row; + float freq; +}; + +/* "structs.pxd":88 + * # Each alias struct stores a list of Entry pointers with their prior probabilities + * # for this specific mention/alias. + * cdef struct AliasC: # <<<<<<<<<<<<<< + * + * # All entry candidates for this alias +*/ +struct __pyx_t_5spacy_7structs_AliasC { + std::vector entry_indices; + std::vector probs; +}; + +/* "structs.pxd":97 + * + * + * cdef struct EdgeC: # <<<<<<<<<<<<<< + * hash_t label + * int32_t head +*/ +struct __pyx_t_5spacy_7structs_EdgeC { + __pyx_t_5spacy_8typedefs_hash_t label; + int32_t head; + int32_t tail; +}; + +/* "structs.pxd":103 + * + * + * cdef struct GraphC: # <<<<<<<<<<<<<< + * vector[vector[int32_t]] nodes + * vector[EdgeC] edges +*/ +struct __pyx_t_5spacy_7structs_GraphC { + std::vector > nodes; + std::vector edges; + std::vector weights; + std::vector n_heads; + std::vector n_tails; + std::vector first_head; + std::vector first_tail; + std::unordered_set *roots; + std::unordered_map<__pyx_t_5spacy_8typedefs_hash_t,int> *node_map; + std::unordered_map<__pyx_t_5spacy_8typedefs_hash_t,int> *edge_map; +}; + +/* "attrs.pxd":5 + * + * + * cdef enum attr_id_t: # <<<<<<<<<<<<<< + * NULL_ATTR + * IS_ALPHA +*/ +enum __pyx_t_5spacy_5attrs_attr_id_t { + + /* "attrs.pxd":96 + * ENT_KB_ID = symbols.ENT_KB_ID + * MORPH + * ENT_ID = symbols.ENT_ID # <<<<<<<<<<<<<< + * + * IDX +*/ + __pyx_e_5spacy_5attrs_NULL_ATTR, + __pyx_e_5spacy_5attrs_IS_ALPHA, + __pyx_e_5spacy_5attrs_IS_ASCII, + __pyx_e_5spacy_5attrs_IS_DIGIT, + __pyx_e_5spacy_5attrs_IS_LOWER, + __pyx_e_5spacy_5attrs_IS_PUNCT, + __pyx_e_5spacy_5attrs_IS_SPACE, + __pyx_e_5spacy_5attrs_IS_TITLE, + __pyx_e_5spacy_5attrs_IS_UPPER, + __pyx_e_5spacy_5attrs_LIKE_URL, + __pyx_e_5spacy_5attrs_LIKE_NUM, + __pyx_e_5spacy_5attrs_LIKE_EMAIL, + __pyx_e_5spacy_5attrs_IS_STOP, + __pyx_e_5spacy_5attrs_IS_OOV_DEPRECATED, + __pyx_e_5spacy_5attrs_IS_BRACKET, + __pyx_e_5spacy_5attrs_IS_QUOTE, + __pyx_e_5spacy_5attrs_IS_LEFT_PUNCT, + __pyx_e_5spacy_5attrs_IS_RIGHT_PUNCT, + __pyx_e_5spacy_5attrs_IS_CURRENCY, + __pyx_e_5spacy_5attrs_FLAG19 = 19, + __pyx_e_5spacy_5attrs_FLAG20, + __pyx_e_5spacy_5attrs_FLAG21, + __pyx_e_5spacy_5attrs_FLAG22, + __pyx_e_5spacy_5attrs_FLAG23, + __pyx_e_5spacy_5attrs_FLAG24, + __pyx_e_5spacy_5attrs_FLAG25, + __pyx_e_5spacy_5attrs_FLAG26, + __pyx_e_5spacy_5attrs_FLAG27, + __pyx_e_5spacy_5attrs_FLAG28, + __pyx_e_5spacy_5attrs_FLAG29, + __pyx_e_5spacy_5attrs_FLAG30, + __pyx_e_5spacy_5attrs_FLAG31, + __pyx_e_5spacy_5attrs_FLAG32, + __pyx_e_5spacy_5attrs_FLAG33, + __pyx_e_5spacy_5attrs_FLAG34, + __pyx_e_5spacy_5attrs_FLAG35, + __pyx_e_5spacy_5attrs_FLAG36, + __pyx_e_5spacy_5attrs_FLAG37, + __pyx_e_5spacy_5attrs_FLAG38, + __pyx_e_5spacy_5attrs_FLAG39, + __pyx_e_5spacy_5attrs_FLAG40, + __pyx_e_5spacy_5attrs_FLAG41, + __pyx_e_5spacy_5attrs_FLAG42, + __pyx_e_5spacy_5attrs_FLAG43, + __pyx_e_5spacy_5attrs_FLAG44, + __pyx_e_5spacy_5attrs_FLAG45, + __pyx_e_5spacy_5attrs_FLAG46, + __pyx_e_5spacy_5attrs_FLAG47, + __pyx_e_5spacy_5attrs_FLAG48, + __pyx_e_5spacy_5attrs_FLAG49, + __pyx_e_5spacy_5attrs_FLAG50, + __pyx_e_5spacy_5attrs_FLAG51, + __pyx_e_5spacy_5attrs_FLAG52, + __pyx_e_5spacy_5attrs_FLAG53, + __pyx_e_5spacy_5attrs_FLAG54, + __pyx_e_5spacy_5attrs_FLAG55, + __pyx_e_5spacy_5attrs_FLAG56, + __pyx_e_5spacy_5attrs_FLAG57, + __pyx_e_5spacy_5attrs_FLAG58, + __pyx_e_5spacy_5attrs_FLAG59, + __pyx_e_5spacy_5attrs_FLAG60, + __pyx_e_5spacy_5attrs_FLAG61, + __pyx_e_5spacy_5attrs_FLAG62, + __pyx_e_5spacy_5attrs_FLAG63, + __pyx_e_5spacy_5attrs_ID, + __pyx_e_5spacy_5attrs_ORTH, + __pyx_e_5spacy_5attrs_LOWER, + __pyx_e_5spacy_5attrs_NORM, + __pyx_e_5spacy_5attrs_SHAPE, + __pyx_e_5spacy_5attrs_PREFIX, + __pyx_e_5spacy_5attrs_SUFFIX, + __pyx_e_5spacy_5attrs_LENGTH, + __pyx_e_5spacy_5attrs_CLUSTER, + __pyx_e_5spacy_5attrs_LEMMA, + __pyx_e_5spacy_5attrs_POS, + __pyx_e_5spacy_5attrs_TAG, + __pyx_e_5spacy_5attrs_DEP, + __pyx_e_5spacy_5attrs_ENT_IOB, + __pyx_e_5spacy_5attrs_ENT_TYPE, + __pyx_e_5spacy_5attrs_HEAD, + __pyx_e_5spacy_5attrs_SENT_START, + __pyx_e_5spacy_5attrs_SPACY, + __pyx_e_5spacy_5attrs_PROB, + __pyx_e_5spacy_5attrs_LANG, + __pyx_e_5spacy_5attrs_ENT_KB_ID = __pyx_e_5spacy_7symbols_ENT_KB_ID, + __pyx_e_5spacy_5attrs_MORPH, + __pyx_e_5spacy_5attrs_ENT_ID = __pyx_e_5spacy_7symbols_ENT_ID, + __pyx_e_5spacy_5attrs_IDX, + __pyx_e_5spacy_5attrs_SENT_END +}; +union __pyx_t_5spacy_5vocab_LexemesOrTokens; +struct __pyx_t_5spacy_5vocab__Cached; + +/* "vocab.pxd":15 + * + * + * cdef union LexemesOrTokens: # <<<<<<<<<<<<<< + * const LexemeC* const* lexemes + * const TokenC* tokens +*/ +union __pyx_t_5spacy_5vocab_LexemesOrTokens { + struct __pyx_t_5spacy_7structs_LexemeC const *const *lexemes; + struct __pyx_t_5spacy_7structs_TokenC const *tokens; +}; + +/* "vocab.pxd":20 + * + * + * cdef struct _Cached: # <<<<<<<<<<<<<< + * LexemesOrTokens data + * bint is_lex +*/ +struct __pyx_t_5spacy_5vocab__Cached { + union __pyx_t_5spacy_5vocab_LexemesOrTokens data; + int is_lex; + int length; +}; + +/* "tokens/doc.pxd":14 + * + * + * ctypedef const LexemeC* const_Lexeme_ptr # <<<<<<<<<<<<<< + * ctypedef const TokenC* const_TokenC_ptr + * +*/ +typedef struct __pyx_t_5spacy_7structs_LexemeC const *__pyx_t_5spacy_6tokens_3doc_const_Lexeme_ptr; + +/* "tokens/doc.pxd":15 + * + * ctypedef const LexemeC* const_Lexeme_ptr + * ctypedef const TokenC* const_TokenC_ptr # <<<<<<<<<<<<<< + * + * ctypedef fused LexemeOrToken: +*/ +typedef struct __pyx_t_5spacy_7structs_TokenC const *__pyx_t_5spacy_6tokens_3doc_const_TokenC_ptr; +struct __pyx_t_5spacy_8pipeline_17_parser_internals_6_state_ArcC; +struct __pyx_t_5spacy_8pipeline_17_parser_internals_6_state_StateC; + +/* "_state.pxd":23 + * return Lexeme.c_check_flag(token.lex, IS_SPACE) + * + * cdef struct ArcC: # <<<<<<<<<<<<<< + * int head + * int child +*/ +struct __pyx_t_5spacy_8pipeline_17_parser_internals_6_state_ArcC { + int head; + int child; + __pyx_t_5spacy_8typedefs_attr_t label; +}; +struct __pyx_t_5spacy_8pipeline_17_parser_internals_6_state_StateC { + + /* "_state.pxd":29 + * + * + * cdef cppclass StateC: # <<<<<<<<<<<<<< + * int* _heads + * const TokenC* _sent +*/ + int *_heads; + struct __pyx_t_5spacy_7structs_TokenC const *_sent; + std::vector _stack; + std::vector _rebuffer; + std::vector _ents; + std::unordered_map > _left_arcs; + std::unordered_map > _right_arcs; + std::vector _unshiftable; + std::set _sent_starts; + struct __pyx_t_5spacy_7structs_TokenC _empty_token; + int length; + int offset; + int _b_i; + void __pyx_f___init__StateC(struct __pyx_t_5spacy_7structs_TokenC const *, int); + void __pyx_f___dealloc__StateC(void); + virtual void set_context_tokens(int *, int); + virtual int S(int) const; + virtual int B(int) const; + virtual struct __pyx_t_5spacy_7structs_TokenC const *B_(int) const; + virtual struct __pyx_t_5spacy_7structs_TokenC const *E_(int) const; + virtual struct __pyx_t_5spacy_7structs_TokenC const *safe_get(int) const; + virtual void map_get_arcs(std::unordered_map > const &, std::vector *) const; + virtual void get_arcs(std::vector *) const; + virtual int H(int) const; + virtual int E(int) const; + virtual int nth_child(std::unordered_map > const &, int, int) const; + virtual int L(int, int) const; + virtual int R(int, int) const; + virtual int empty(void) const; + virtual int eol(void) const; + virtual int is_final(void) const; + virtual int cannot_sent_start(int) const; + virtual int is_sent_start(int) const; + virtual void set_sent_start(int, int); + virtual int has_head(int) const; + virtual int l_edge(int) const; + virtual int r_edge(int) const; + virtual int n_arcs(std::unordered_map > const &, int) const; + virtual int n_L(int) const; + virtual int n_R(int) const; + virtual int stack_is_connected(void) const; + virtual int entity_is_open(void) const; + virtual int stack_depth(void) const; + virtual int buffer_length(void) const; + virtual void push(void); + virtual void pop(void); + virtual void force_final(void); + virtual void unshift(void); + virtual int is_unshiftable(int) const; + virtual void set_reshiftable(int); + virtual void add_arc(int, int, __pyx_t_5spacy_8typedefs_attr_t); + virtual void map_del_arc(std::unordered_map > *, int, int); + virtual void del_arc(int, int); + virtual struct __pyx_t_5spacy_7structs_SpanC get_ent(void) const; + virtual void open_ent(__pyx_t_5spacy_8typedefs_attr_t); + virtual void close_ent(void); + virtual void clone(__pyx_t_5spacy_8pipeline_17_parser_internals_6_state_StateC const *); + __pyx_t_5spacy_8pipeline_17_parser_internals_6_state_StateC(struct __pyx_t_5spacy_7structs_TokenC const *__pyx_v_sent, int __pyx_v_length) { + __pyx_f___init__StateC(__pyx_v_sent, __pyx_v_length); + } + virtual ~__pyx_t_5spacy_8pipeline_17_parser_internals_6_state_StateC() { + __pyx_f___dealloc__StateC(); + } +}; +struct __pyx_t_5spacy_8pipeline_17_parser_internals_17transition_system_Transition; + +/* "transition_system.pxd":11 + * + * + * cdef struct Transition: # <<<<<<<<<<<<<< + * int clas + * int move +*/ +struct __pyx_t_5spacy_8pipeline_17_parser_internals_17transition_system_Transition { + int clas; + int move; + __pyx_t_5spacy_8typedefs_attr_t label; + __pyx_t_5spacy_8typedefs_weight_t score; + int (*is_valid)(__pyx_t_5spacy_8pipeline_17_parser_internals_6_state_StateC const *, __pyx_t_5spacy_8typedefs_attr_t); + __pyx_t_5spacy_8typedefs_weight_t (*get_cost)(__pyx_t_5spacy_8pipeline_17_parser_internals_6_state_StateC const *, void const *, __pyx_t_5spacy_8typedefs_attr_t); + int (*__pyx_do)(__pyx_t_5spacy_8pipeline_17_parser_internals_6_state_StateC *, __pyx_t_5spacy_8typedefs_attr_t); +}; + +/* "transition_system.pxd":23 + * + * + * ctypedef weight_t (*get_cost_func_t)( # <<<<<<<<<<<<<< + * const StateC* state, const void* gold, attr_tlabel + * ) noexcept nogil +*/ +typedef __pyx_t_5spacy_8typedefs_weight_t (*__pyx_t_5spacy_8pipeline_17_parser_internals_17transition_system_get_cost_func_t)(__pyx_t_5spacy_8pipeline_17_parser_internals_6_state_StateC const *, void const *, PyObject *); + +/* "transition_system.pxd":26 + * const StateC* state, const void* gold, attr_tlabel + * ) noexcept nogil + * ctypedef weight_t (*move_cost_func_t)( # <<<<<<<<<<<<<< + * const StateC* state, const void* gold + * ) noexcept nogil +*/ +typedef __pyx_t_5spacy_8typedefs_weight_t (*__pyx_t_5spacy_8pipeline_17_parser_internals_17transition_system_move_cost_func_t)(__pyx_t_5spacy_8pipeline_17_parser_internals_6_state_StateC const *, void const *); + +/* "transition_system.pxd":29 + * const StateC* state, const void* gold + * ) noexcept nogil + * ctypedef weight_t (*label_cost_func_t)( # <<<<<<<<<<<<<< + * const StateC* state, const void* gold, attr_t label + * ) noexcept nogil +*/ +typedef __pyx_t_5spacy_8typedefs_weight_t (*__pyx_t_5spacy_8pipeline_17_parser_internals_17transition_system_label_cost_func_t)(__pyx_t_5spacy_8pipeline_17_parser_internals_6_state_StateC const *, void const *, __pyx_t_5spacy_8typedefs_attr_t); + +/* "transition_system.pxd":33 + * ) noexcept nogil + * + * ctypedef int (*do_func_t)(StateC* state, attr_t label) noexcept nogil # <<<<<<<<<<<<<< + * + * ctypedef void* (*init_state_t)(Pool mem, int length, void* tokens) except NULL +*/ +typedef int (*__pyx_t_5spacy_8pipeline_17_parser_internals_17transition_system_do_func_t)(__pyx_t_5spacy_8pipeline_17_parser_internals_6_state_StateC *, __pyx_t_5spacy_8typedefs_attr_t); + +/* "transition_system.pxd":35 + * ctypedef int (*do_func_t)(StateC* state, attr_t label) noexcept nogil + * + * ctypedef void* (*init_state_t)(Pool mem, int length, void* tokens) except NULL # <<<<<<<<<<<<<< + * + * ctypedef int (*del_state_t)(Pool mem, void* state, void* extra_args) except -1 +*/ +typedef void *(*__pyx_t_5spacy_8pipeline_17_parser_internals_17transition_system_init_state_t)(struct __pyx_obj_5cymem_5cymem_Pool *, int, void *); + +/* "transition_system.pxd":37 + * ctypedef void* (*init_state_t)(Pool mem, int length, void* tokens) except NULL + * + * ctypedef int (*del_state_t)(Pool mem, void* state, void* extra_args) except -1 # <<<<<<<<<<<<<< + * + * cdef class TransitionSystem: +*/ +typedef int (*__pyx_t_5spacy_8pipeline_17_parser_internals_17transition_system_del_state_t)(struct __pyx_obj_5cymem_5cymem_Pool *, void *, void *); +struct __pyx_t_5thinc_5extra_6search__State; + +/* "thinc/extra/search.pxd":12 + * + * + * ctypedef pair[weight_t, size_t] Entry # <<<<<<<<<<<<<< + * ctypedef priority_queue[Entry] Queue + * +*/ +typedef std::pair<__pyx_t_5thinc_5extra_6search_weight_t,size_t> __pyx_t_5thinc_5extra_6search_Entry; + +/* "thinc/extra/search.pxd":13 + * + * ctypedef pair[weight_t, size_t] Entry + * ctypedef priority_queue[Entry] Queue # <<<<<<<<<<<<<< + * + * +*/ +typedef std::priority_queue<__pyx_t_5thinc_5extra_6search_Entry> __pyx_t_5thinc_5extra_6search_Queue; + +/* "thinc/extra/search.pxd":16 + * + * + * ctypedef int (*trans_func_t)(void* dest, void* src, class_t clas, void* x) except -1 # <<<<<<<<<<<<<< + * + * ctypedef void* (*init_func_t)(Pool mem, int n, void* extra_args) except NULL +*/ +typedef int (*__pyx_t_5thinc_5extra_6search_trans_func_t)(void *, void *, __pyx_t_5thinc_5extra_6search_class_t, void *); + +/* "thinc/extra/search.pxd":18 + * ctypedef int (*trans_func_t)(void* dest, void* src, class_t clas, void* x) except -1 + * + * ctypedef void* (*init_func_t)(Pool mem, int n, void* extra_args) except NULL # <<<<<<<<<<<<<< + * + * ctypedef int (*del_func_t)(Pool mem, void* state, void* extra_args) except -1 +*/ +typedef void *(*__pyx_t_5thinc_5extra_6search_init_func_t)(struct __pyx_obj_5cymem_5cymem_Pool *, int, void *); + +/* "thinc/extra/search.pxd":20 + * ctypedef void* (*init_func_t)(Pool mem, int n, void* extra_args) except NULL + * + * ctypedef int (*del_func_t)(Pool mem, void* state, void* extra_args) except -1 # <<<<<<<<<<<<<< + * + * ctypedef int (*finish_func_t)(void* state, void* extra_args) except -1 +*/ +typedef int (*__pyx_t_5thinc_5extra_6search_del_func_t)(struct __pyx_obj_5cymem_5cymem_Pool *, void *, void *); + +/* "thinc/extra/search.pxd":22 + * ctypedef int (*del_func_t)(Pool mem, void* state, void* extra_args) except -1 + * + * ctypedef int (*finish_func_t)(void* state, void* extra_args) except -1 # <<<<<<<<<<<<<< + * + * ctypedef hash_t (*hash_func_t)(void* state, void* x) except 0 +*/ +typedef int (*__pyx_t_5thinc_5extra_6search_finish_func_t)(void *, void *); + +/* "thinc/extra/search.pxd":24 + * ctypedef int (*finish_func_t)(void* state, void* extra_args) except -1 + * + * ctypedef hash_t (*hash_func_t)(void* state, void* x) except 0 # <<<<<<<<<<<<<< + * + * +*/ +typedef __pyx_t_5thinc_5extra_6search_hash_t (*__pyx_t_5thinc_5extra_6search_hash_func_t)(void *, void *); + +/* "thinc/extra/search.pxd":27 + * + * + * cdef struct _State: # <<<<<<<<<<<<<< + * void* content + * class_t* hist +*/ +struct __pyx_t_5thinc_5extra_6search__State { + void *content; + __pyx_t_5thinc_5extra_6search_class_t *hist; + __pyx_t_5thinc_5extra_6search_weight_t score; + __pyx_t_5thinc_5extra_6search_weight_t loss; + int i; + int t; + int is_done; +}; +struct __pyx_t_5spacy_8pipeline_17_parser_internals_3ner_GoldNERStateC; + +/* "spacy/pipeline/_parser_internals/ner.pyx":29 + * + * + * cdef enum: # <<<<<<<<<<<<<< + * MISSING + * BEGIN +*/ +enum { + __pyx_e_5spacy_8pipeline_17_parser_internals_3ner_MISSING, + __pyx_e_5spacy_8pipeline_17_parser_internals_3ner_BEGIN, + __pyx_e_5spacy_8pipeline_17_parser_internals_3ner_IN, + __pyx_e_5spacy_8pipeline_17_parser_internals_3ner_LAST, + __pyx_e_5spacy_8pipeline_17_parser_internals_3ner_UNIT, + __pyx_e_5spacy_8pipeline_17_parser_internals_3ner_OUT, + __pyx_e_5spacy_8pipeline_17_parser_internals_3ner_N_MOVES +}; + +/* "spacy/pipeline/_parser_internals/ner.pyx":48 + * + * + * cdef struct GoldNERStateC: # <<<<<<<<<<<<<< + * Transition* ner + * SpanC* negs +*/ +struct __pyx_t_5spacy_8pipeline_17_parser_internals_3ner_GoldNERStateC { + struct __pyx_t_5spacy_8pipeline_17_parser_internals_17transition_system_Transition *ner; + struct __pyx_t_5spacy_7structs_SpanC *negs; + int32_t length; + int32_t nr_neg; +}; + +/* "cymem/cymem.pxd":4 + * ctypedef void (*free_t)(void *p) + * + * cdef class PyMalloc: # <<<<<<<<<<<<<< + * cdef malloc_t malloc + * cdef void _set(self, malloc_t malloc) +*/ +struct __pyx_obj_5cymem_5cymem_PyMalloc { + PyObject_HEAD + struct __pyx_vtabstruct_5cymem_5cymem_PyMalloc *__pyx_vtab; + __pyx_t_5cymem_5cymem_malloc_t malloc; +}; + + +/* "cymem/cymem.pxd":10 + * cdef PyMalloc WrapMalloc(malloc_t malloc) + * + * cdef class PyFree: # <<<<<<<<<<<<<< + * cdef free_t free + * cdef void _set(self, free_t free) +*/ +struct __pyx_obj_5cymem_5cymem_PyFree { + PyObject_HEAD + struct __pyx_vtabstruct_5cymem_5cymem_PyFree *__pyx_vtab; + __pyx_t_5cymem_5cymem_free_t free; +}; + + +/* "cymem/cymem.pxd":16 + * cdef PyFree WrapFree(free_t free) + * + * cdef class Pool: # <<<<<<<<<<<<<< + * cdef readonly size_t size + * cdef readonly dict addresses +*/ +struct __pyx_obj_5cymem_5cymem_Pool { + PyObject_HEAD + struct __pyx_vtabstruct_5cymem_5cymem_Pool *__pyx_vtab; + size_t size; + PyObject *addresses; + PyObject *refs; + struct __pyx_obj_5cymem_5cymem_PyMalloc *pymalloc; + struct __pyx_obj_5cymem_5cymem_PyFree *pyfree; +}; + + +/* "cymem/cymem.pxd":28 + * + * + * cdef class Address: # <<<<<<<<<<<<<< + * cdef void* ptr + * cdef readonly PyMalloc pymalloc +*/ +struct __pyx_obj_5cymem_5cymem_Address { + PyObject_HEAD + void *ptr; + struct __pyx_obj_5cymem_5cymem_PyMalloc *pymalloc; + struct __pyx_obj_5cymem_5cymem_PyFree *pyfree; +}; + + +/* "preshed/maps.pxd":45 + * + * + * cdef class PreshMap: # <<<<<<<<<<<<<< + * cdef MapStruct* c_map + * cdef Pool mem +*/ +struct __pyx_obj_7preshed_4maps_PreshMap { + PyObject_HEAD + struct __pyx_vtabstruct_7preshed_4maps_PreshMap *__pyx_vtab; + struct __pyx_t_7preshed_4maps_MapStruct *c_map; + struct __pyx_obj_5cymem_5cymem_Pool *mem; +}; + + +/* "preshed/maps.pxd":53 + * + * + * cdef class PreshMapArray: # <<<<<<<<<<<<<< + * cdef Pool mem + * cdef MapStruct* maps +*/ +struct __pyx_obj_7preshed_4maps_PreshMapArray { + PyObject_HEAD + struct __pyx_vtabstruct_7preshed_4maps_PreshMapArray *__pyx_vtab; + struct __pyx_obj_5cymem_5cymem_Pool *mem; + struct __pyx_t_7preshed_4maps_MapStruct *maps; + size_t length; +}; + + +/* "strings.pxd":22 + * + * + * cdef class StringStore: # <<<<<<<<<<<<<< + * cdef Pool mem + * +*/ +struct __pyx_obj_5spacy_7strings_StringStore { + PyObject_HEAD + struct __pyx_vtabstruct_5spacy_7strings_StringStore *__pyx_vtab; + struct __pyx_obj_5cymem_5cymem_Pool *mem; + std::vector<__pyx_t_5spacy_8typedefs_hash_t> keys; + struct __pyx_obj_7preshed_4maps_PreshMap *_map; + std::vector<__pyx_t_5spacy_8typedefs_hash_t> _transient_keys; + struct __pyx_obj_5cymem_5cymem_Pool *_non_temp_mem; +}; + + +/* "morphology.pxd":11 + * + * + * cdef class Morphology: # <<<<<<<<<<<<<< + * cdef readonly Pool mem + * cdef readonly StringStore strings +*/ +struct __pyx_obj_5spacy_10morphology_Morphology { + PyObject_HEAD + struct __pyx_vtabstruct_5spacy_10morphology_Morphology *__pyx_vtab; + struct __pyx_obj_5cymem_5cymem_Pool *mem; + struct __pyx_obj_5spacy_7strings_StringStore *strings; + struct __pyx_obj_7preshed_4maps_PreshMap *tags; +}; + + +/* "vocab.pxd":26 + * + * + * cdef class Vocab: # <<<<<<<<<<<<<< + * cdef Pool mem + * cdef readonly StringStore strings +*/ +struct __pyx_obj_5spacy_5vocab_Vocab { + PyObject_HEAD + struct __pyx_vtabstruct_5spacy_5vocab_Vocab *__pyx_vtab; + struct __pyx_obj_5cymem_5cymem_Pool *mem; + struct __pyx_obj_5spacy_7strings_StringStore *strings; + struct __pyx_obj_5spacy_10morphology_Morphology *morphology; + PyObject *_vectors; + PyObject *_lookups; + PyObject *writing_system; + PyObject *get_noun_chunks; + int length; + PyObject *_unused_object; + PyObject *lex_attr_getters; + PyObject *cfg; + struct __pyx_obj_7preshed_4maps_PreshMap *_by_orth; + struct __pyx_obj_5cymem_5cymem_Pool *_non_temp_mem; + std::vector<__pyx_t_5spacy_8typedefs_attr_t> _transient_orths; +}; + + +/* "tokens/doc.pxd":37 + * + * + * cdef class Doc: # <<<<<<<<<<<<<< + * cdef readonly Pool mem + * cdef readonly Vocab vocab +*/ +struct __pyx_obj_5spacy_6tokens_3doc_Doc { + PyObject_HEAD + struct __pyx_vtabstruct_5spacy_6tokens_3doc_Doc *__pyx_vtab; + struct __pyx_obj_5cymem_5cymem_Pool *mem; + struct __pyx_obj_5spacy_5vocab_Vocab *vocab; + PyObject *_vector; + PyObject *_vector_norm; + PyObject *tensor; + PyObject *cats; + PyObject *user_data; + PyObject *spans; + struct __pyx_t_5spacy_7structs_TokenC *c; + float sentiment; + PyObject *user_hooks; + PyObject *user_token_hooks; + PyObject *user_span_hooks; + int has_unknown_spaces; + PyObject *_context; + int length; + int max_length; + PyObject *noun_chunks_iterator; + PyObject *__weakref__; +}; + + +/* "training/example.pxd":6 + * + * + * cdef class Example: # <<<<<<<<<<<<<< + * cdef readonly Doc x + * cdef readonly Doc y +*/ +struct __pyx_obj_5spacy_8training_7example_Example { + PyObject_HEAD + struct __pyx_obj_5spacy_6tokens_3doc_Doc *x; + struct __pyx_obj_5spacy_6tokens_3doc_Doc *y; + PyObject *_cached_alignment; + PyObject *_cached_words_x; + PyObject *_cached_words_y; + uint64_t _x_sig; + uint64_t _y_sig; +}; + + +/* "lexeme.pxd":24 + * cdef attr_t OOV_RANK + * + * cdef class Lexeme: # <<<<<<<<<<<<<< + * cdef LexemeC* c + * cdef readonly Vocab vocab +*/ +struct __pyx_obj_5spacy_6lexeme_Lexeme { + PyObject_HEAD + struct __pyx_vtabstruct_5spacy_6lexeme_Lexeme *__pyx_vtab; + struct __pyx_t_5spacy_7structs_LexemeC *c; + struct __pyx_obj_5spacy_5vocab_Vocab *vocab; + __pyx_t_5spacy_8typedefs_attr_t orth; +}; + + +/* "stateclass.pxd":9 + * + * + * cdef class StateClass: # <<<<<<<<<<<<<< + * cdef StateC* c + * cdef readonly Doc doc +*/ +struct __pyx_obj_5spacy_8pipeline_17_parser_internals_10stateclass_StateClass { + PyObject_HEAD + struct __pyx_vtabstruct_5spacy_8pipeline_17_parser_internals_10stateclass_StateClass *__pyx_vtab; + __pyx_t_5spacy_8pipeline_17_parser_internals_6_state_StateC *c; + struct __pyx_obj_5spacy_6tokens_3doc_Doc *doc; + int _borrowed; +}; + + +/* "transition_system.pxd":39 + * ctypedef int (*del_state_t)(Pool mem, void* state, void* extra_args) except -1 + * + * cdef class TransitionSystem: # <<<<<<<<<<<<<< + * cdef Pool mem + * cdef StringStore strings +*/ +struct __pyx_obj_5spacy_8pipeline_17_parser_internals_17transition_system_TransitionSystem { + PyObject_HEAD + struct __pyx_vtabstruct_5spacy_8pipeline_17_parser_internals_17transition_system_TransitionSystem *__pyx_vtab; + struct __pyx_obj_5cymem_5cymem_Pool *mem; + struct __pyx_obj_5spacy_7strings_StringStore *strings; + struct __pyx_t_5spacy_8pipeline_17_parser_internals_17transition_system_Transition *c; + int n_moves; + int _size; + __pyx_t_5spacy_8typedefs_attr_t root_label; + PyObject *freqs; + PyObject *labels; + PyObject *cfg; + __pyx_t_5spacy_8pipeline_17_parser_internals_17transition_system_init_state_t init_beam_state; + __pyx_t_5spacy_8pipeline_17_parser_internals_17transition_system_del_state_t del_beam_state; +}; + + +/* "thinc/extra/search.pxd":37 + * + * + * cdef class Beam: # <<<<<<<<<<<<<< + * cdef Pool mem + * cdef class_t nr_class +*/ +struct __pyx_obj_5thinc_5extra_6search_Beam { + PyObject_HEAD + struct __pyx_vtabstruct_5thinc_5extra_6search_Beam *__pyx_vtab; + struct __pyx_obj_5cymem_5cymem_Pool *mem; + __pyx_t_5thinc_5extra_6search_class_t nr_class; + __pyx_t_5thinc_5extra_6search_class_t width; + __pyx_t_5thinc_5extra_6search_class_t size; + __pyx_t_5thinc_5extra_6search_weight_t min_density; + int t; + int is_done; + PyObject *histories; + PyObject *_parent_histories; + __pyx_t_5thinc_5extra_6search_weight_t **scores; + int **is_valid; + __pyx_t_5thinc_5extra_6search_weight_t **costs; + struct __pyx_t_5thinc_5extra_6search__State *_parents; + struct __pyx_t_5thinc_5extra_6search__State *_states; + __pyx_t_5thinc_5extra_6search_del_func_t del_func; +}; + + +/* "thinc/extra/search.pxd":75 + * + * + * cdef class MaxViolation: # <<<<<<<<<<<<<< + * cdef Pool mem + * cdef weight_t cost +*/ +struct __pyx_obj_5thinc_5extra_6search_MaxViolation { + PyObject_HEAD + struct __pyx_vtabstruct_5thinc_5extra_6search_MaxViolation *__pyx_vtab; + struct __pyx_obj_5cymem_5cymem_Pool *mem; + __pyx_t_5thinc_5extra_6search_weight_t cost; + __pyx_t_5thinc_5extra_6search_weight_t delta; + __pyx_t_5thinc_5extra_6search_weight_t p_score; + __pyx_t_5thinc_5extra_6search_weight_t g_score; + double Z; + double gZ; + __pyx_t_5thinc_5extra_6search_class_t n; + PyObject *p_hist; + PyObject *g_hist; + PyObject *p_probs; + PyObject *g_probs; +}; + + +/* "tokens/span.pxd":8 + * + * + * cdef class Span: # <<<<<<<<<<<<<< + * cdef readonly Doc doc + * cdef SpanC c +*/ +struct __pyx_obj_5spacy_6tokens_4span_Span { + PyObject_HEAD + struct __pyx_vtabstruct_5spacy_6tokens_4span_Span *__pyx_vtab; + struct __pyx_obj_5spacy_6tokens_3doc_Doc *doc; + struct __pyx_t_5spacy_7structs_SpanC c; + PyObject *_vector; + PyObject *_vector_norm; +}; + + +/* "spacy/pipeline/_parser_internals/ner.pxd":4 + * + * + * cdef class BiluoPushDown(TransitionSystem): # <<<<<<<<<<<<<< + * pass +*/ +struct __pyx_obj_5spacy_8pipeline_17_parser_internals_3ner_BiluoPushDown { + struct __pyx_obj_5spacy_8pipeline_17_parser_internals_17transition_system_TransitionSystem __pyx_base; +}; + + +/* "spacy/pipeline/_parser_internals/ner.pyx":55 + * + * + * cdef class BiluoGold: # <<<<<<<<<<<<<< + * cdef Pool mem + * cdef GoldNERStateC c +*/ +struct __pyx_obj_5spacy_8pipeline_17_parser_internals_3ner_BiluoGold { + PyObject_HEAD + struct __pyx_obj_5cymem_5cymem_Pool *mem; + struct __pyx_t_5spacy_8pipeline_17_parser_internals_3ner_GoldNERStateC c; +}; + + +/* "spacy/pipeline/_parser_internals/ner.pyx":348 + * + * + * cdef class Missing: # <<<<<<<<<<<<<< + * @staticmethod + * cdef bint is_valid(const StateC* st, attr_t label) noexcept nogil: +*/ +struct __pyx_obj_5spacy_8pipeline_17_parser_internals_3ner_Missing { + PyObject_HEAD + struct __pyx_vtabstruct_5spacy_8pipeline_17_parser_internals_3ner_Missing *__pyx_vtab; +}; + + +/* "spacy/pipeline/_parser_internals/ner.pyx":362 + * + * + * cdef class Begin: # <<<<<<<<<<<<<< + * @staticmethod + * cdef bint is_valid(const StateC* st, attr_t label) noexcept nogil: +*/ +struct __pyx_obj_5spacy_8pipeline_17_parser_internals_3ner_Begin { + PyObject_HEAD + struct __pyx_vtabstruct_5spacy_8pipeline_17_parser_internals_3ner_Begin *__pyx_vtab; +}; + + +/* "spacy/pipeline/_parser_internals/ner.pyx":440 + * + * + * cdef class In: # <<<<<<<<<<<<<< + * @staticmethod + * cdef bint is_valid(const StateC* st, attr_t label) noexcept nogil: +*/ +struct __pyx_obj_5spacy_8pipeline_17_parser_internals_3ner_In { + PyObject_HEAD + struct __pyx_vtabstruct_5spacy_8pipeline_17_parser_internals_3ner_In *__pyx_vtab; +}; + + +/* "spacy/pipeline/_parser_internals/ner.pyx":511 + * return 1 + * + * cdef class Last: # <<<<<<<<<<<<<< + * @staticmethod + * cdef bint is_valid(const StateC* st, attr_t label) noexcept nogil: +*/ +struct __pyx_obj_5spacy_8pipeline_17_parser_internals_3ner_Last { + PyObject_HEAD + struct __pyx_vtabstruct_5spacy_8pipeline_17_parser_internals_3ner_Last *__pyx_vtab; +}; + + +/* "spacy/pipeline/_parser_internals/ner.pyx":582 + * + * + * cdef class Unit: # <<<<<<<<<<<<<< + * @staticmethod + * cdef bint is_valid(const StateC* st, attr_t label) noexcept nogil: +*/ +struct __pyx_obj_5spacy_8pipeline_17_parser_internals_3ner_Unit { + PyObject_HEAD + struct __pyx_vtabstruct_5spacy_8pipeline_17_parser_internals_3ner_Unit *__pyx_vtab; +}; + + +/* "spacy/pipeline/_parser_internals/ner.pyx":647 + * + * + * cdef class Out: # <<<<<<<<<<<<<< + * @staticmethod + * cdef bint is_valid(const StateC* st, attr_t label) noexcept nogil: +*/ +struct __pyx_obj_5spacy_8pipeline_17_parser_internals_3ner_Out { + PyObject_HEAD + struct __pyx_vtabstruct_5spacy_8pipeline_17_parser_internals_3ner_Out *__pyx_vtab; +}; + + +/* "View.MemoryView":110 + * + * + * @cython.collection_type("sequence") # <<<<<<<<<<<<<< + * @cname("__pyx_array") + * cdef class array: +*/ +struct __pyx_array_obj { + PyObject_HEAD + struct __pyx_vtabstruct_array *__pyx_vtab; + char *data; + Py_ssize_t len; + char *format; + int ndim; + Py_ssize_t *_shape; + Py_ssize_t *_strides; + Py_ssize_t itemsize; + PyObject *mode; + PyObject *_format; + void (*callback_free_data)(void *); + int free_data; + int dtype_is_object; +}; + + +/* "View.MemoryView":299 + * + * + * @cname('__pyx_MemviewEnum') # <<<<<<<<<<<<<< + * cdef class Enum(object): + * cdef object name +*/ +struct __pyx_MemviewEnum_obj { + PyObject_HEAD + PyObject *name; +}; + + +/* "View.MemoryView":334 + * + * + * @cname('__pyx_memoryview') # <<<<<<<<<<<<<< + * cdef class memoryview: + * +*/ +struct __pyx_memoryview_obj { + PyObject_HEAD + struct __pyx_vtabstruct_memoryview *__pyx_vtab; + PyObject *obj; + PyObject *_size; + void *_unused; + PyThread_type_lock lock; + __pyx_atomic_int_type acquisition_count; + Py_buffer view; + int flags; + int dtype_is_object; + __Pyx_TypeInfo const *typeinfo; +}; + + +/* "View.MemoryView":951 + * + * + * @cython.collection_type("sequence") # <<<<<<<<<<<<<< + * @cname('__pyx_memoryviewslice') + * cdef class _memoryviewslice(memoryview): +*/ +struct __pyx_memoryviewslice_obj { + struct __pyx_memoryview_obj __pyx_base; + __Pyx_memviewslice from_slice; + PyObject *from_object; + PyObject *(*to_object_func)(char *); + int (*to_dtype_func)(char *, PyObject *); +}; + + + +/* "cymem/cymem.pxd":4 + * ctypedef void (*free_t)(void *p) + * + * cdef class PyMalloc: # <<<<<<<<<<<<<< + * cdef malloc_t malloc + * cdef void _set(self, malloc_t malloc) +*/ + +struct __pyx_vtabstruct_5cymem_5cymem_PyMalloc { + void (*_set)(struct __pyx_obj_5cymem_5cymem_PyMalloc *, __pyx_t_5cymem_5cymem_malloc_t); +}; +static struct __pyx_vtabstruct_5cymem_5cymem_PyMalloc *__pyx_vtabptr_5cymem_5cymem_PyMalloc; + + +/* "cymem/cymem.pxd":10 + * cdef PyMalloc WrapMalloc(malloc_t malloc) + * + * cdef class PyFree: # <<<<<<<<<<<<<< + * cdef free_t free + * cdef void _set(self, free_t free) +*/ + +struct __pyx_vtabstruct_5cymem_5cymem_PyFree { + void (*_set)(struct __pyx_obj_5cymem_5cymem_PyFree *, __pyx_t_5cymem_5cymem_free_t); +}; +static struct __pyx_vtabstruct_5cymem_5cymem_PyFree *__pyx_vtabptr_5cymem_5cymem_PyFree; + + +/* "cymem/cymem.pxd":16 + * cdef PyFree WrapFree(free_t free) + * + * cdef class Pool: # <<<<<<<<<<<<<< + * cdef readonly size_t size + * cdef readonly dict addresses +*/ + +struct __pyx_vtabstruct_5cymem_5cymem_Pool { + void *(*alloc)(struct __pyx_obj_5cymem_5cymem_Pool *, size_t, size_t); + void (*free)(struct __pyx_obj_5cymem_5cymem_Pool *, void *); + void *(*realloc)(struct __pyx_obj_5cymem_5cymem_Pool *, void *, size_t); +}; +static struct __pyx_vtabstruct_5cymem_5cymem_Pool *__pyx_vtabptr_5cymem_5cymem_Pool; + + +/* "preshed/maps.pxd":45 + * + * + * cdef class PreshMap: # <<<<<<<<<<<<<< + * cdef MapStruct* c_map + * cdef Pool mem +*/ + +struct __pyx_vtabstruct_7preshed_4maps_PreshMap { + void *(*get)(struct __pyx_obj_7preshed_4maps_PreshMap *, __pyx_t_7preshed_4maps_key_t); + void (*set)(struct __pyx_obj_7preshed_4maps_PreshMap *, __pyx_t_7preshed_4maps_key_t, void *); +}; +static struct __pyx_vtabstruct_7preshed_4maps_PreshMap *__pyx_vtabptr_7preshed_4maps_PreshMap; + + +/* "preshed/maps.pxd":53 + * + * + * cdef class PreshMapArray: # <<<<<<<<<<<<<< + * cdef Pool mem + * cdef MapStruct* maps +*/ + +struct __pyx_vtabstruct_7preshed_4maps_PreshMapArray { + void *(*get)(struct __pyx_obj_7preshed_4maps_PreshMapArray *, size_t, __pyx_t_7preshed_4maps_key_t); + void (*set)(struct __pyx_obj_7preshed_4maps_PreshMapArray *, size_t, __pyx_t_7preshed_4maps_key_t, void *); +}; +static struct __pyx_vtabstruct_7preshed_4maps_PreshMapArray *__pyx_vtabptr_7preshed_4maps_PreshMapArray; + + +/* "strings.pxd":22 + * + * + * cdef class StringStore: # <<<<<<<<<<<<<< + * cdef Pool mem + * +*/ + +struct __pyx_vtabstruct_5spacy_7strings_StringStore { + __pyx_t_5spacy_7strings_Utf8Str const *(*intern_unicode)(struct __pyx_obj_5spacy_7strings_StringStore *, PyObject *, int); + __pyx_t_5spacy_7strings_Utf8Str const *(*_intern_utf8)(struct __pyx_obj_5spacy_7strings_StringStore *, char *, int, __pyx_t_5spacy_8typedefs_hash_t *, int); +}; +static struct __pyx_vtabstruct_5spacy_7strings_StringStore *__pyx_vtabptr_5spacy_7strings_StringStore; + + +/* "morphology.pxd":11 + * + * + * cdef class Morphology: # <<<<<<<<<<<<<< + * cdef readonly Pool mem + * cdef readonly StringStore strings +*/ + +struct __pyx_vtabstruct_5spacy_10morphology_Morphology { + struct __pyx_t_5spacy_7structs_MorphAnalysisC (*create_morph_tag)(struct __pyx_obj_5spacy_10morphology_Morphology *, PyObject *); + int (*insert)(struct __pyx_obj_5spacy_10morphology_Morphology *, struct __pyx_t_5spacy_7structs_MorphAnalysisC); +}; +static struct __pyx_vtabstruct_5spacy_10morphology_Morphology *__pyx_vtabptr_5spacy_10morphology_Morphology; + + +/* "vocab.pxd":26 + * + * + * cdef class Vocab: # <<<<<<<<<<<<<< + * cdef Pool mem + * cdef readonly StringStore strings +*/ + +struct __pyx_vtabstruct_5spacy_5vocab_Vocab { + struct __pyx_t_5spacy_7structs_LexemeC const *(*get)(struct __pyx_obj_5spacy_5vocab_Vocab *, struct __pyx_obj_5cymem_5cymem_Pool *, PyObject *); + struct __pyx_t_5spacy_7structs_LexemeC const *(*get_by_orth)(struct __pyx_obj_5spacy_5vocab_Vocab *, struct __pyx_obj_5cymem_5cymem_Pool *, __pyx_t_5spacy_8typedefs_attr_t); + struct __pyx_t_5spacy_7structs_TokenC const *(*make_fused_token)(struct __pyx_obj_5spacy_5vocab_Vocab *, PyObject *); + struct __pyx_t_5spacy_7structs_LexemeC const *(*_new_lexeme)(struct __pyx_obj_5spacy_5vocab_Vocab *, struct __pyx_obj_5cymem_5cymem_Pool *, PyObject *); + int (*_add_lex_to_vocab)(struct __pyx_obj_5spacy_5vocab_Vocab *, __pyx_t_5spacy_8typedefs_hash_t, struct __pyx_t_5spacy_7structs_LexemeC const *, int); +}; +static struct __pyx_vtabstruct_5spacy_5vocab_Vocab *__pyx_vtabptr_5spacy_5vocab_Vocab; + + +/* "tokens/doc.pxd":37 + * + * + * cdef class Doc: # <<<<<<<<<<<<<< + * cdef readonly Pool mem + * cdef readonly Vocab vocab +*/ + +struct __pyx_vtabstruct_5spacy_6tokens_3doc_Doc { + PyArrayObject *(*to_array)(struct __pyx_obj_5spacy_6tokens_3doc_Doc *, PyObject *, int __pyx_skip_dispatch); + int (*__pyx_fuse_0push_back)(struct __pyx_obj_5spacy_6tokens_3doc_Doc *, __pyx_t_5spacy_6tokens_3doc_const_Lexeme_ptr, int); + int (*__pyx_fuse_1push_back)(struct __pyx_obj_5spacy_6tokens_3doc_Doc *, __pyx_t_5spacy_6tokens_3doc_const_TokenC_ptr, int); +}; +static struct __pyx_vtabstruct_5spacy_6tokens_3doc_Doc *__pyx_vtabptr_5spacy_6tokens_3doc_Doc; + + +/* "lexeme.pxd":24 + * cdef attr_t OOV_RANK + * + * cdef class Lexeme: # <<<<<<<<<<<<<< + * cdef LexemeC* c + * cdef readonly Vocab vocab +*/ + +struct __pyx_vtabstruct_5spacy_6lexeme_Lexeme { + struct __pyx_obj_5spacy_6lexeme_Lexeme *(*from_ptr)(struct __pyx_t_5spacy_7structs_LexemeC *, struct __pyx_obj_5spacy_5vocab_Vocab *); + void (*set_struct_attr)(struct __pyx_t_5spacy_7structs_LexemeC *, enum __pyx_t_5spacy_5attrs_attr_id_t, __pyx_t_5spacy_8typedefs_attr_t); + __pyx_t_5spacy_8typedefs_attr_t (*get_struct_attr)(struct __pyx_t_5spacy_7structs_LexemeC const *, enum __pyx_t_5spacy_5attrs_attr_id_t); + int (*c_check_flag)(struct __pyx_t_5spacy_7structs_LexemeC const *, enum __pyx_t_5spacy_5attrs_attr_id_t); + int (*c_set_flag)(struct __pyx_t_5spacy_7structs_LexemeC *, enum __pyx_t_5spacy_5attrs_attr_id_t, int); +}; +static struct __pyx_vtabstruct_5spacy_6lexeme_Lexeme *__pyx_vtabptr_5spacy_6lexeme_Lexeme; +static CYTHON_INLINE struct __pyx_obj_5spacy_6lexeme_Lexeme *__pyx_f_5spacy_6lexeme_6Lexeme_from_ptr(struct __pyx_t_5spacy_7structs_LexemeC *, struct __pyx_obj_5spacy_5vocab_Vocab *); +static CYTHON_INLINE void __pyx_f_5spacy_6lexeme_6Lexeme_set_struct_attr(struct __pyx_t_5spacy_7structs_LexemeC *, enum __pyx_t_5spacy_5attrs_attr_id_t, __pyx_t_5spacy_8typedefs_attr_t); +static CYTHON_INLINE __pyx_t_5spacy_8typedefs_attr_t __pyx_f_5spacy_6lexeme_6Lexeme_get_struct_attr(struct __pyx_t_5spacy_7structs_LexemeC const *, enum __pyx_t_5spacy_5attrs_attr_id_t); +static CYTHON_INLINE int __pyx_f_5spacy_6lexeme_6Lexeme_c_check_flag(struct __pyx_t_5spacy_7structs_LexemeC const *, enum __pyx_t_5spacy_5attrs_attr_id_t); +static CYTHON_INLINE int __pyx_f_5spacy_6lexeme_6Lexeme_c_set_flag(struct __pyx_t_5spacy_7structs_LexemeC *, enum __pyx_t_5spacy_5attrs_attr_id_t, int); + + +/* "stateclass.pxd":9 + * + * + * cdef class StateClass: # <<<<<<<<<<<<<< + * cdef StateC* c + * cdef readonly Doc doc +*/ + +struct __pyx_vtabstruct_5spacy_8pipeline_17_parser_internals_10stateclass_StateClass { + struct __pyx_obj_5spacy_8pipeline_17_parser_internals_10stateclass_StateClass *(*borrow)(__pyx_t_5spacy_8pipeline_17_parser_internals_6_state_StateC *, struct __pyx_obj_5spacy_6tokens_3doc_Doc *); + struct __pyx_obj_5spacy_8pipeline_17_parser_internals_10stateclass_StateClass *(*init_offset)(struct __pyx_t_5spacy_7structs_TokenC const *, int, int); +}; +static struct __pyx_vtabstruct_5spacy_8pipeline_17_parser_internals_10stateclass_StateClass *__pyx_vtabptr_5spacy_8pipeline_17_parser_internals_10stateclass_StateClass; +static CYTHON_INLINE struct __pyx_obj_5spacy_8pipeline_17_parser_internals_10stateclass_StateClass *__pyx_f_5spacy_8pipeline_17_parser_internals_10stateclass_10StateClass_borrow(__pyx_t_5spacy_8pipeline_17_parser_internals_6_state_StateC *, struct __pyx_obj_5spacy_6tokens_3doc_Doc *); +static CYTHON_INLINE struct __pyx_obj_5spacy_8pipeline_17_parser_internals_10stateclass_StateClass *__pyx_f_5spacy_8pipeline_17_parser_internals_10stateclass_10StateClass_init_offset(struct __pyx_t_5spacy_7structs_TokenC const *, int, int); + + +/* "transition_system.pxd":39 + * ctypedef int (*del_state_t)(Pool mem, void* state, void* extra_args) except -1 + * + * cdef class TransitionSystem: # <<<<<<<<<<<<<< + * cdef Pool mem + * cdef StringStore strings +*/ + +struct __pyx_vtabstruct_5spacy_8pipeline_17_parser_internals_17transition_system_TransitionSystem { + struct __pyx_t_5spacy_8pipeline_17_parser_internals_17transition_system_Transition (*lookup_transition)(struct __pyx_obj_5spacy_8pipeline_17_parser_internals_17transition_system_TransitionSystem *, PyObject *); + struct __pyx_t_5spacy_8pipeline_17_parser_internals_17transition_system_Transition (*init_transition)(struct __pyx_obj_5spacy_8pipeline_17_parser_internals_17transition_system_TransitionSystem *, int, int, __pyx_t_5spacy_8typedefs_attr_t); + int (*set_valid)(struct __pyx_obj_5spacy_8pipeline_17_parser_internals_17transition_system_TransitionSystem *, int *, __pyx_t_5spacy_8pipeline_17_parser_internals_6_state_StateC const *); + int (*set_costs)(struct __pyx_obj_5spacy_8pipeline_17_parser_internals_17transition_system_TransitionSystem *, int *, __pyx_t_5spacy_8typedefs_weight_t *, __pyx_t_5spacy_8pipeline_17_parser_internals_6_state_StateC const *, PyObject *); +}; +static struct __pyx_vtabstruct_5spacy_8pipeline_17_parser_internals_17transition_system_TransitionSystem *__pyx_vtabptr_5spacy_8pipeline_17_parser_internals_17transition_system_TransitionSystem; + + +/* "thinc/extra/search.pxd":37 + * + * + * cdef class Beam: # <<<<<<<<<<<<<< + * cdef Pool mem + * cdef class_t nr_class +*/ + +struct __pyx_vtabstruct_5thinc_5extra_6search_Beam { + int (*_fill)(struct __pyx_obj_5thinc_5extra_6search_Beam *, __pyx_t_5thinc_5extra_6search_Queue *, __pyx_t_5thinc_5extra_6search_weight_t **, int **); + void *(*at)(struct __pyx_obj_5thinc_5extra_6search_Beam *, int); + int (*initialize)(struct __pyx_obj_5thinc_5extra_6search_Beam *, __pyx_t_5thinc_5extra_6search_init_func_t, __pyx_t_5thinc_5extra_6search_del_func_t, int, void *); + int (*advance)(struct __pyx_obj_5thinc_5extra_6search_Beam *, __pyx_t_5thinc_5extra_6search_trans_func_t, __pyx_t_5thinc_5extra_6search_hash_func_t, void *); + int (*check_done)(struct __pyx_obj_5thinc_5extra_6search_Beam *, __pyx_t_5thinc_5extra_6search_finish_func_t, void *); + void (*set_cell)(struct __pyx_obj_5thinc_5extra_6search_Beam *, int, int, __pyx_t_5thinc_5extra_6search_weight_t, int, __pyx_t_5thinc_5extra_6search_weight_t); + int (*set_row)(struct __pyx_obj_5thinc_5extra_6search_Beam *, int, __pyx_t_5thinc_5extra_6search_weight_t const *, int const *, __pyx_t_5thinc_5extra_6search_weight_t const *); + int (*set_table)(struct __pyx_obj_5thinc_5extra_6search_Beam *, __pyx_t_5thinc_5extra_6search_weight_t **, int **, __pyx_t_5thinc_5extra_6search_weight_t **); +}; +static struct __pyx_vtabstruct_5thinc_5extra_6search_Beam *__pyx_vtabptr_5thinc_5extra_6search_Beam; +static CYTHON_INLINE void *__pyx_f_5thinc_5extra_6search_4Beam_at(struct __pyx_obj_5thinc_5extra_6search_Beam *, int); +static CYTHON_INLINE void __pyx_f_5thinc_5extra_6search_4Beam_set_cell(struct __pyx_obj_5thinc_5extra_6search_Beam *, int, int, __pyx_t_5thinc_5extra_6search_weight_t, int, __pyx_t_5thinc_5extra_6search_weight_t); + + +/* "thinc/extra/search.pxd":75 + * + * + * cdef class MaxViolation: # <<<<<<<<<<<<<< + * cdef Pool mem + * cdef weight_t cost +*/ + +struct __pyx_vtabstruct_5thinc_5extra_6search_MaxViolation { + int (*check)(struct __pyx_obj_5thinc_5extra_6search_MaxViolation *, struct __pyx_obj_5thinc_5extra_6search_Beam *, struct __pyx_obj_5thinc_5extra_6search_Beam *, int __pyx_skip_dispatch); + int (*check_crf)(struct __pyx_obj_5thinc_5extra_6search_MaxViolation *, struct __pyx_obj_5thinc_5extra_6search_Beam *, struct __pyx_obj_5thinc_5extra_6search_Beam *, int __pyx_skip_dispatch); +}; +static struct __pyx_vtabstruct_5thinc_5extra_6search_MaxViolation *__pyx_vtabptr_5thinc_5extra_6search_MaxViolation; + + +/* "tokens/span.pxd":8 + * + * + * cdef class Span: # <<<<<<<<<<<<<< + * cdef readonly Doc doc + * cdef SpanC c +*/ + +struct __pyx_vtabstruct_5spacy_6tokens_4span_Span { + struct __pyx_obj_5spacy_6tokens_4span_Span *(*cinit)(struct __pyx_obj_5spacy_6tokens_3doc_Doc *, struct __pyx_t_5spacy_7structs_SpanC); + PyArrayObject *(*to_array)(struct __pyx_obj_5spacy_6tokens_4span_Span *, PyObject *, int __pyx_skip_dispatch); +}; +static struct __pyx_vtabstruct_5spacy_6tokens_4span_Span *__pyx_vtabptr_5spacy_6tokens_4span_Span; +static CYTHON_INLINE struct __pyx_obj_5spacy_6tokens_4span_Span *__pyx_f_5spacy_6tokens_4span_4Span_cinit(struct __pyx_obj_5spacy_6tokens_3doc_Doc *, struct __pyx_t_5spacy_7structs_SpanC); + + +/* "spacy/pipeline/_parser_internals/ner.pyx":127 + * + * + * cdef class BiluoPushDown(TransitionSystem): # <<<<<<<<<<<<<< + * def __init__(self, *args, **kwargs): + * TransitionSystem.__init__(self, *args, **kwargs) +*/ + +struct __pyx_vtabstruct_5spacy_8pipeline_17_parser_internals_3ner_BiluoPushDown { + struct __pyx_vtabstruct_5spacy_8pipeline_17_parser_internals_17transition_system_TransitionSystem __pyx_base; +}; +static struct __pyx_vtabstruct_5spacy_8pipeline_17_parser_internals_3ner_BiluoPushDown *__pyx_vtabptr_5spacy_8pipeline_17_parser_internals_3ner_BiluoPushDown; + + +/* "spacy/pipeline/_parser_internals/ner.pyx":348 + * + * + * cdef class Missing: # <<<<<<<<<<<<<< + * @staticmethod + * cdef bint is_valid(const StateC* st, attr_t label) noexcept nogil: +*/ + +struct __pyx_vtabstruct_5spacy_8pipeline_17_parser_internals_3ner_Missing { + int (*is_valid)(__pyx_t_5spacy_8pipeline_17_parser_internals_6_state_StateC const *, __pyx_t_5spacy_8typedefs_attr_t); + int (*transition)(__pyx_t_5spacy_8pipeline_17_parser_internals_6_state_StateC *, __pyx_t_5spacy_8typedefs_attr_t); + __pyx_t_5spacy_8typedefs_weight_t (*cost)(__pyx_t_5spacy_8pipeline_17_parser_internals_6_state_StateC const *, void const *, __pyx_t_5spacy_8typedefs_attr_t); +}; +static struct __pyx_vtabstruct_5spacy_8pipeline_17_parser_internals_3ner_Missing *__pyx_vtabptr_5spacy_8pipeline_17_parser_internals_3ner_Missing; + + +/* "spacy/pipeline/_parser_internals/ner.pyx":362 + * + * + * cdef class Begin: # <<<<<<<<<<<<<< + * @staticmethod + * cdef bint is_valid(const StateC* st, attr_t label) noexcept nogil: +*/ + +struct __pyx_vtabstruct_5spacy_8pipeline_17_parser_internals_3ner_Begin { + int (*is_valid)(__pyx_t_5spacy_8pipeline_17_parser_internals_6_state_StateC const *, __pyx_t_5spacy_8typedefs_attr_t); + int (*transition)(__pyx_t_5spacy_8pipeline_17_parser_internals_6_state_StateC *, __pyx_t_5spacy_8typedefs_attr_t); + __pyx_t_5spacy_8typedefs_weight_t (*cost)(__pyx_t_5spacy_8pipeline_17_parser_internals_6_state_StateC const *, void const *, __pyx_t_5spacy_8typedefs_attr_t); +}; +static struct __pyx_vtabstruct_5spacy_8pipeline_17_parser_internals_3ner_Begin *__pyx_vtabptr_5spacy_8pipeline_17_parser_internals_3ner_Begin; + + +/* "spacy/pipeline/_parser_internals/ner.pyx":440 + * + * + * cdef class In: # <<<<<<<<<<<<<< + * @staticmethod + * cdef bint is_valid(const StateC* st, attr_t label) noexcept nogil: +*/ + +struct __pyx_vtabstruct_5spacy_8pipeline_17_parser_internals_3ner_In { + int (*is_valid)(__pyx_t_5spacy_8pipeline_17_parser_internals_6_state_StateC const *, __pyx_t_5spacy_8typedefs_attr_t); + int (*transition)(__pyx_t_5spacy_8pipeline_17_parser_internals_6_state_StateC *, __pyx_t_5spacy_8typedefs_attr_t); + __pyx_t_5spacy_8typedefs_weight_t (*cost)(__pyx_t_5spacy_8pipeline_17_parser_internals_6_state_StateC const *, void const *, __pyx_t_5spacy_8typedefs_attr_t); +}; +static struct __pyx_vtabstruct_5spacy_8pipeline_17_parser_internals_3ner_In *__pyx_vtabptr_5spacy_8pipeline_17_parser_internals_3ner_In; + + +/* "spacy/pipeline/_parser_internals/ner.pyx":511 + * return 1 + * + * cdef class Last: # <<<<<<<<<<<<<< + * @staticmethod + * cdef bint is_valid(const StateC* st, attr_t label) noexcept nogil: +*/ + +struct __pyx_vtabstruct_5spacy_8pipeline_17_parser_internals_3ner_Last { + int (*is_valid)(__pyx_t_5spacy_8pipeline_17_parser_internals_6_state_StateC const *, __pyx_t_5spacy_8typedefs_attr_t); + int (*transition)(__pyx_t_5spacy_8pipeline_17_parser_internals_6_state_StateC *, __pyx_t_5spacy_8typedefs_attr_t); + __pyx_t_5spacy_8typedefs_weight_t (*cost)(__pyx_t_5spacy_8pipeline_17_parser_internals_6_state_StateC const *, void const *, __pyx_t_5spacy_8typedefs_attr_t); +}; +static struct __pyx_vtabstruct_5spacy_8pipeline_17_parser_internals_3ner_Last *__pyx_vtabptr_5spacy_8pipeline_17_parser_internals_3ner_Last; + + +/* "spacy/pipeline/_parser_internals/ner.pyx":582 + * + * + * cdef class Unit: # <<<<<<<<<<<<<< + * @staticmethod + * cdef bint is_valid(const StateC* st, attr_t label) noexcept nogil: +*/ + +struct __pyx_vtabstruct_5spacy_8pipeline_17_parser_internals_3ner_Unit { + int (*is_valid)(__pyx_t_5spacy_8pipeline_17_parser_internals_6_state_StateC const *, __pyx_t_5spacy_8typedefs_attr_t); + int (*transition)(__pyx_t_5spacy_8pipeline_17_parser_internals_6_state_StateC *, __pyx_t_5spacy_8typedefs_attr_t); + __pyx_t_5spacy_8typedefs_weight_t (*cost)(__pyx_t_5spacy_8pipeline_17_parser_internals_6_state_StateC const *, void const *, __pyx_t_5spacy_8typedefs_attr_t); +}; +static struct __pyx_vtabstruct_5spacy_8pipeline_17_parser_internals_3ner_Unit *__pyx_vtabptr_5spacy_8pipeline_17_parser_internals_3ner_Unit; + + +/* "spacy/pipeline/_parser_internals/ner.pyx":647 + * + * + * cdef class Out: # <<<<<<<<<<<<<< + * @staticmethod + * cdef bint is_valid(const StateC* st, attr_t label) noexcept nogil: +*/ + +struct __pyx_vtabstruct_5spacy_8pipeline_17_parser_internals_3ner_Out { + int (*is_valid)(__pyx_t_5spacy_8pipeline_17_parser_internals_6_state_StateC const *, __pyx_t_5spacy_8typedefs_attr_t); + int (*transition)(__pyx_t_5spacy_8pipeline_17_parser_internals_6_state_StateC *, __pyx_t_5spacy_8typedefs_attr_t); + __pyx_t_5spacy_8typedefs_weight_t (*cost)(__pyx_t_5spacy_8pipeline_17_parser_internals_6_state_StateC const *, void const *, __pyx_t_5spacy_8typedefs_attr_t); +}; +static struct __pyx_vtabstruct_5spacy_8pipeline_17_parser_internals_3ner_Out *__pyx_vtabptr_5spacy_8pipeline_17_parser_internals_3ner_Out; + + +/* "View.MemoryView":110 + * + * + * @cython.collection_type("sequence") # <<<<<<<<<<<<<< + * @cname("__pyx_array") + * cdef class array: +*/ + +struct __pyx_vtabstruct_array { + PyObject *(*get_memview)(struct __pyx_array_obj *); +}; +static struct __pyx_vtabstruct_array *__pyx_vtabptr_array; + + +/* "View.MemoryView":334 + * + * + * @cname('__pyx_memoryview') # <<<<<<<<<<<<<< + * cdef class memoryview: + * +*/ + +struct __pyx_vtabstruct_memoryview { + char *(*get_item_pointer)(struct __pyx_memoryview_obj *, PyObject *); + PyObject *(*is_slice)(struct __pyx_memoryview_obj *, PyObject *); + PyObject *(*setitem_slice_assignment)(struct __pyx_memoryview_obj *, PyObject *, PyObject *); + PyObject *(*setitem_slice_assign_scalar)(struct __pyx_memoryview_obj *, struct __pyx_memoryview_obj *, PyObject *); + PyObject *(*setitem_indexed)(struct __pyx_memoryview_obj *, PyObject *, PyObject *); + PyObject *(*convert_item_to_object)(struct __pyx_memoryview_obj *, char *); + PyObject *(*assign_item_from_object)(struct __pyx_memoryview_obj *, char *, PyObject *); + PyObject *(*_get_base)(struct __pyx_memoryview_obj *); +}; +static struct __pyx_vtabstruct_memoryview *__pyx_vtabptr_memoryview; + + +/* "View.MemoryView":951 + * + * + * @cython.collection_type("sequence") # <<<<<<<<<<<<<< + * @cname('__pyx_memoryviewslice') + * cdef class _memoryviewslice(memoryview): +*/ + +struct __pyx_vtabstruct__memoryviewslice { + struct __pyx_vtabstruct_memoryview __pyx_base; +}; +static struct __pyx_vtabstruct__memoryviewslice *__pyx_vtabptr__memoryviewslice; +/* #### 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); + +/* 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) + +/* RaiseException.export */ +static void __Pyx_Raise(PyObject *type, PyObject *value, PyObject *tb, PyObject *cause); + +/* 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 + +/* RaiseUnexpectedTypeError.proto */ +static int __Pyx_RaiseUnexpectedTypeError(const char *expected, PyObject *obj); + +/* PyMemoryError_Check.proto */ +#define __Pyx_PyExc_MemoryError_Check(obj) __Pyx_TypeCheck(obj, PyExc_MemoryError) + +/* 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); + +/* CIntToPyUnicode.proto */ +#define __Pyx_PyUnicode_From_Py_ssize_t(value, width, padding_char, format_char) (\ + ((format_char) == ('c')) ?\ + __Pyx_uchar___Pyx_PyUnicode_From_Py_ssize_t(value, width, padding_char) :\ + __Pyx____Pyx_PyUnicode_From_Py_ssize_t(value, width, padding_char, format_char)\ + ) +static CYTHON_INLINE PyObject* __Pyx_uchar___Pyx_PyUnicode_From_Py_ssize_t(Py_ssize_t value, Py_ssize_t width, char padding_char); +static CYTHON_INLINE PyObject* __Pyx____Pyx_PyUnicode_From_Py_ssize_t(Py_ssize_t 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); + +/* 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 + +CYTHON_UNUSED static int __pyx_array_getbuffer(PyObject *__pyx_v_self, Py_buffer *__pyx_v_info, int __pyx_v_flags); /*proto*/ +static PyObject *__pyx_array_get_memview(struct __pyx_array_obj *); /*proto*/ +/* GetAttr.proto */ +static CYTHON_INLINE PyObject *__Pyx_GetAttr(PyObject *, PyObject *); + +/* GetItemInt.proto */ +#define __Pyx_GetItemInt(o, i, type, is_signed, to_py_func, is_list, wraparound, boundscheck, has_gil, unsafe_shared)\ + (__Pyx_fits_Py_ssize_t(i, type, is_signed) ?\ + __Pyx_GetItemInt_Fast(o, (Py_ssize_t)i, is_list, wraparound, boundscheck, unsafe_shared) :\ + (is_list ? (PyErr_SetString(PyExc_IndexError, "list index out of range"), (PyObject*)NULL) :\ + __Pyx_GetItemInt_Generic(o, to_py_func(i)))) +#define __Pyx_GetItemInt_List(o, i, type, is_signed, to_py_func, is_list, wraparound, boundscheck, has_gil, unsafe_shared)\ + (__Pyx_fits_Py_ssize_t(i, type, is_signed) ?\ + __Pyx_GetItemInt_List_Fast(o, (Py_ssize_t)i, wraparound, boundscheck, unsafe_shared) :\ + (PyErr_SetString(PyExc_IndexError, "list index out of range"), (PyObject*)NULL)) +static CYTHON_INLINE PyObject *__Pyx_GetItemInt_List_Fast(PyObject *o, Py_ssize_t i, + int wraparound, int boundscheck, int unsafe_shared); +#define __Pyx_GetItemInt_Tuple(o, i, type, is_signed, to_py_func, is_list, wraparound, boundscheck, has_gil, unsafe_shared)\ + (__Pyx_fits_Py_ssize_t(i, type, is_signed) ?\ + __Pyx_GetItemInt_Tuple_Fast(o, (Py_ssize_t)i, wraparound, boundscheck, unsafe_shared) :\ + (PyErr_SetString(PyExc_IndexError, "tuple index out of range"), (PyObject*)NULL)) +static CYTHON_INLINE PyObject *__Pyx_GetItemInt_Tuple_Fast(PyObject *o, Py_ssize_t i, + int wraparound, int boundscheck, int unsafe_shared); +static PyObject *__Pyx_GetItemInt_Generic(PyObject *o, PyObject* j); +static CYTHON_INLINE PyObject *__Pyx_GetItemInt_Fast(PyObject *o, Py_ssize_t i, + int is_list, int wraparound, int boundscheck, int unsafe_shared); + +/* ObjectGetItem.proto */ +#if CYTHON_USE_TYPE_SLOTS +static CYTHON_INLINE PyObject *__Pyx_PyObject_GetItem(PyObject *obj, PyObject *key); +#else +#define __Pyx_PyObject_GetItem(obj, key) PyObject_GetItem(obj, key) +#endif + +/* RejectKeywords.export */ +static void __Pyx_RejectKeywords(const char* function_name, PyObject *kwds); + +/* PyTypeError_Check.proto */ +#define __Pyx_PyExc_TypeError_Check(obj) __Pyx_TypeCheck(obj, PyExc_TypeError) + +/* DivInt[Py_ssize_t].proto */ +static CYTHON_INLINE Py_ssize_t __Pyx_div_Py_ssize_t(Py_ssize_t, Py_ssize_t, int b_is_constant); + +/* UnaryNegOverflows.proto */ +#define __Pyx_UNARY_NEG_WOULD_OVERFLOW(x)\ + (((x) < 0) & ((unsigned long)(x) == 0-(unsigned long)(x))) + +/* GetAttr3.proto */ +static CYTHON_INLINE PyObject *__Pyx_GetAttr3(PyObject *, PyObject *, PyObject *); + +/* 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 + +/* AssertionsEnabled.proto */ +#if CYTHON_COMPILING_IN_LIMITED_API || PY_VERSION_HEX >= 0x030C0000 + static int __pyx_assertions_enabled_flag; + #define __pyx_assertions_enabled() (__pyx_assertions_enabled_flag) + static int __Pyx_init_assertions_enabled(void) { + PyObject *builtins, *debug, *debug_str; + int flag; + builtins = PyEval_GetBuiltins(); + if (!builtins) goto bad; + debug_str = PyUnicode_FromStringAndSize("__debug__", 9); + if (!debug_str) goto bad; + debug = PyObject_GetItem(builtins, debug_str); + Py_DECREF(debug_str); + if (!debug) goto bad; + flag = PyObject_IsTrue(debug); + Py_DECREF(debug); + if (flag == -1) goto bad; + __pyx_assertions_enabled_flag = flag; + return 0; + bad: + __pyx_assertions_enabled_flag = 1; + return -1; + } +#else + #define __Pyx_init_assertions_enabled() (0) + #define __pyx_assertions_enabled() (!Py_OptimizeFlag) +#endif + +/* PyAssertionError_Check.proto */ +#define __Pyx_PyExc_AssertionError_Check(obj) __Pyx_TypeCheck(obj, PyExc_AssertionError) + +/* RaiseTooManyValuesToUnpack.proto */ +static CYTHON_INLINE void __Pyx_RaiseTooManyValuesError(Py_ssize_t expected); + +/* RaiseNeedMoreValuesToUnpack.proto */ +static CYTHON_INLINE void __Pyx_RaiseNeedMoreValuesError(Py_ssize_t index); + +/* RaiseNoneIterError.proto */ +static CYTHON_INLINE void __Pyx_RaiseNoneNotIterableError(void); + +/* ExtTypeTest.proto */ +static CYTHON_INLINE int __Pyx_TypeTest(PyObject *obj, PyTypeObject *type); + +/* 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 + +/* 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); + +/* 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 + +CYTHON_UNUSED static int __pyx_memoryview_getbuffer(PyObject *__pyx_v_self, Py_buffer *__pyx_v_info, int __pyx_v_flags); /*proto*/ +/* 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 + +/* PySequenceMultiply.proto */ +#define __Pyx_PySequence_Multiply_Left(mul, seq) __Pyx_PySequence_Multiply(seq, mul) +static CYTHON_INLINE PyObject* __Pyx_PySequence_Multiply(PyObject *seq, Py_ssize_t mul); + +/* PyObjectFormatAndDecref.proto */ +static CYTHON_INLINE PyObject* __Pyx_PyObject_FormatSimpleAndDecref(PyObject* s, PyObject* f); +static CYTHON_INLINE PyObject* __Pyx_PyObject_FormatAndDecref(PyObject* s, PyObject* f); + +/* PyObjectFormat.proto */ +#if CYTHON_USE_UNICODE_WRITER +static PyObject* __Pyx_PyObject_Format(PyObject* s, PyObject* f); +#else +#define __Pyx_PyObject_Format(s, f) PyObject_Format(s, f) +#endif + +/* SetItemInt.proto */ +#define __Pyx_SetItemInt(o, i, v, type, is_signed, to_py_func, is_list, wraparound, boundscheck, has_gil, unsafe_shared)\ + (__Pyx_fits_Py_ssize_t(i, type, is_signed) ?\ + __Pyx_SetItemInt_Fast(o, (Py_ssize_t)i, v, is_list, wraparound, boundscheck, unsafe_shared) :\ + (is_list ? (PyErr_SetString(PyExc_IndexError, "list assignment index out of range"), -1) :\ + __Pyx_SetItemInt_Generic(o, to_py_func(i), v))) +static int __Pyx_SetItemInt_Generic(PyObject *o, PyObject *j, PyObject *v); +static CYTHON_INLINE int __Pyx_SetItemInt_Fast(PyObject *o, Py_ssize_t i, PyObject *v, + int is_list, int wraparound, int boundscheck, int unsafe_shared); + +/* RaiseUnboundLocalError.proto */ +static void __Pyx_RaiseUnboundLocalError(const char *varname); + +/* PyIndexError_Check.proto */ +#define __Pyx_PyExc_IndexError_Check(obj) __Pyx_TypeCheck(obj, PyExc_IndexError) + +/* DivInt[long].proto */ +static CYTHON_INLINE long __Pyx_div_long(long, long, int b_is_constant); + +/* PyImportError_Check.proto */ +#define __Pyx_PyExc_ImportError_Check(obj) __Pyx_TypeCheck(obj, PyExc_ImportError) + +/* tp_new.proto */ +#define __Pyx_tp_new(type_obj, args) __Pyx_tp_new_kwargs(type_obj, args, NULL) +static CYTHON_INLINE PyObject* __Pyx_tp_new_kwargs(PyObject* type_obj, PyObject* args, PyObject* kwargs); + +/* WriteUnraisableException.proto */ +static void __Pyx_WriteUnraisable(const char *name, int clineno, + int lineno, const char *filename, + int full_traceback, int nogil); + +/* MoveIfSupported.proto */ +#if CYTHON_USE_CPP_STD_MOVE + #include + #define __PYX_STD_MOVE_IF_SUPPORTED(x) std::move(x) +#else + #define __PYX_STD_MOVE_IF_SUPPORTED(x) x +#endif + +/* 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 + +/* IterFinish.proto */ +static CYTHON_INLINE int __Pyx_IterFinish(void); + +/* UnpackItemEndCheck.proto */ +static int __Pyx_IternextUnpackEndCheck(PyObject *retval, Py_ssize_t expected); + +/* 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 + +/* PyObjectCallNoArg.proto (used by pyfrozenset_new) */ +static CYTHON_INLINE PyObject* __Pyx_PyObject_CallNoArg(PyObject *func); + +/* 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); + +/* KeywordStringCheck.proto */ +static CYTHON_INLINE int __Pyx_CheckKeywordStrings(const char* function_name, PyObject *kw); + +/* 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 + +/* dict_getitem_default.proto */ +static PyObject* __Pyx_PyDict_GetItemDefault(PyObject* d, PyObject* key, PyObject* default_value); + +/* PyObjectCall2Args.proto (used by CallUnboundCMethod1) */ +static CYTHON_INLINE PyObject* __Pyx_PyObject_Call2Args(PyObject* function, PyObject* arg1, PyObject* arg2); + +/* CallUnboundCMethod1.proto */ +CYTHON_UNUSED +static PyObject* __Pyx__CallUnboundCMethod1(__Pyx_CachedCFunction* cfunc, PyObject* self, PyObject* arg); +#if CYTHON_COMPILING_IN_CPYTHON +static CYTHON_INLINE PyObject* __Pyx_CallUnboundCMethod1(__Pyx_CachedCFunction* cfunc, PyObject* self, PyObject* arg); +#else +#define __Pyx_CallUnboundCMethod1(cfunc, self, arg) __Pyx__CallUnboundCMethod1(cfunc, self, arg) +#endif + +/* 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 + +/* PySequenceContains.proto */ +static CYTHON_INLINE int __Pyx_PySequence_ContainsTF(PyObject* item, PyObject* seq, int eq) { + int result = PySequence_Contains(seq, item); + return unlikely(result < 0) ? result : (result == (eq == Py_EQ)); +} + +/* PyKeyError_Check.proto */ +#define __Pyx_PyExc_KeyError_Check(obj) __Pyx_TypeCheck(obj, PyExc_KeyError) + +/* PyLongBinop.proto */ +#if !CYTHON_COMPILING_IN_PYPY +static CYTHON_INLINE PyObject* __Pyx_PyLong_SubtractObjC(PyObject *op1, PyObject *op2, long intval, int inplace, int zerodivision_check); +#else +#define __Pyx_PyLong_SubtractObjC(op1, op2, intval, inplace, zerodivision_check)\ + (inplace ? PyNumber_InPlaceSubtract(op1, op2) : PyNumber_Subtract(op1, op2)) +#endif + +/* SliceObject.proto */ +static CYTHON_INLINE PyObject* __Pyx_PyObject_GetSlice( + PyObject* obj, Py_ssize_t cstart, Py_ssize_t cstop, + PyObject** py_start, PyObject** py_stop, PyObject** py_slice, + int has_cstart, int has_cstop, int wraparound); + +/* PyLongCompare.proto */ +static CYTHON_INLINE int __Pyx_PyLong_BoolNeObjC(PyObject *op1, PyObject *op2, long intval, long inplace); + +/* CallNextTpDealloc.proto */ +static void __Pyx_call_next_tp_dealloc(PyObject* obj, destructor current_tp_dealloc); + +/* CallNextTpTraverse.proto */ +static int __Pyx_call_next_tp_traverse(PyObject* obj, visitproc v, void *a, traverseproc current_tp_traverse); + +/* 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 + +/* CallNextTpClear.proto */ +static void __Pyx_call_next_tp_clear(PyObject* obj, inquiry current_tp_clear); + +/* AllocateExtensionType.proto */ +static PyObject *__Pyx_AllocateExtensionType(PyTypeObject *t, int is_final); + +/* DefaultPlacementNew.proto */ +#include +template +void __Pyx_default_placement_construct(T* x) { + new (static_cast(x)) T(); +} + +/* TypeImport.proto */ +#ifndef __PYX_HAVE_RT_ImportType_proto_3_2_1 +#define __PYX_HAVE_RT_ImportType_proto_3_2_1 +#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_1(s) alignof(s) +#else +#define __PYX_GET_STRUCT_ALIGNMENT_3_2_1(s) sizeof(void*) +#endif +enum __Pyx_ImportType_CheckSize_3_2_1 { + __Pyx_ImportType_CheckSize_Error_3_2_1 = 0, + __Pyx_ImportType_CheckSize_Warn_3_2_1 = 1, + __Pyx_ImportType_CheckSize_Ignore_3_2_1 = 2 +}; +static PyTypeObject *__Pyx_ImportType_3_2_1(PyObject* module, const char *module_name, const char *class_name, size_t size, size_t alignment, enum __Pyx_ImportType_CheckSize_3_2_1 check_size); +#endif + +/* GetVTable.proto */ +static void* __Pyx_GetVtable(PyTypeObject *type); + +/* 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); + +/* 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); + +/* SetVTable.proto */ +static int __Pyx_SetVtable(PyTypeObject* typeptr , void* vtable); + +/* MergeVTables.proto */ +static int __Pyx_MergeVtables(PyTypeObject *type); + +/* 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); + +/* VoidPtrImport.proto */ +static int __Pyx_ImportVoidPtr_3_2_1(PyObject *module, const char *name, void **p, const char *sig); + +/* FunctionImport.proto */ +static int __Pyx_ImportFunction_3_2_1(PyObject *module, const char *funcname, void (**f)(void), const char *sig); + +/* 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 + +/* 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); + +/* ClassMethod.proto */ +#if !CYTHON_COMPILING_IN_LIMITED_API +#include "descrobject.h" +#endif +CYTHON_UNUSED static PyObject* __Pyx_Method_ClassMethod(PyObject *method); + +/* GetNameInClass.proto */ +#define __Pyx_GetNameInClass(var, nmspace, name) (var) = __Pyx__GetNameInClass(nmspace, name) +static PyObject *__Pyx__GetNameInClass(PyObject *nmspace, PyObject *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); + +/* CheckUnpickleChecksum.proto */ +static CYTHON_INLINE int __Pyx_CheckUnpickleChecksum(long checksum, long checksum1, long checksum2, long checksum3, const char *members); + +/* CppExceptionConversion.proto */ +#ifndef __Pyx_CppExn2PyErr +#include +#include +#include +#include +static void __Pyx_CppExn2PyErr() { + try { + if (PyErr_Occurred()) + ; // let the latest Python exn pass through and ignore the current one + else + throw; + } catch (const std::bad_alloc& exn) { + PyErr_SetString(PyExc_MemoryError, exn.what()); + } catch (const std::bad_cast& exn) { + PyErr_SetString(PyExc_TypeError, exn.what()); + } catch (const std::bad_typeid& exn) { + PyErr_SetString(PyExc_TypeError, exn.what()); + } catch (const std::domain_error& exn) { + PyErr_SetString(PyExc_ValueError, exn.what()); + } catch (const std::invalid_argument& exn) { + PyErr_SetString(PyExc_ValueError, exn.what()); + } catch (const std::ios_base::failure& exn) { + PyErr_SetString(PyExc_IOError, exn.what()); + } catch (const std::out_of_range& exn) { + PyErr_SetString(PyExc_IndexError, exn.what()); + } catch (const std::overflow_error& exn) { + PyErr_SetString(PyExc_OverflowError, exn.what()); + } catch (const std::range_error& exn) { + PyErr_SetString(PyExc_ArithmeticError, exn.what()); + } catch (const std::underflow_error& exn) { + PyErr_SetString(PyExc_ArithmeticError, exn.what()); + } catch (const std::exception& exn) { + PyErr_SetString(PyExc_RuntimeError, exn.what()); + } + catch (...) + { + PyErr_SetString(PyExc_RuntimeError, "Unknown exception"); + } +} +#endif + +/* RealImag.proto */ +#if CYTHON_CCOMPLEX + #ifdef __cplusplus + #define __Pyx_CREAL(z) ((z).real()) + #define __Pyx_CIMAG(z) ((z).imag()) + #else + #define __Pyx_CREAL(z) (__real__(z)) + #define __Pyx_CIMAG(z) (__imag__(z)) + #endif +#else + #define __Pyx_CREAL(z) ((z).real) + #define __Pyx_CIMAG(z) ((z).imag) +#endif +#if defined(__cplusplus) && CYTHON_CCOMPLEX\ + && (defined(_WIN32) || defined(__clang__) || (defined(__GNUC__) && (__GNUC__ >= 5 || __GNUC__ == 4 && __GNUC_MINOR__ >= 4 )) || __cplusplus >= 201103) + #define __Pyx_SET_CREAL(z,x) ((z).real(x)) + #define __Pyx_SET_CIMAG(z,y) ((z).imag(y)) +#else + #define __Pyx_SET_CREAL(z,x) __Pyx_CREAL(z) = (x) + #define __Pyx_SET_CIMAG(z,y) __Pyx_CIMAG(z) = (y) +#endif + +/* Arithmetic.proto */ +#if CYTHON_CCOMPLEX && (1) && (!0 || __cplusplus) + #define __Pyx_c_eq_float(a, b) ((a)==(b)) + #define __Pyx_c_sum_float(a, b) ((a)+(b)) + #define __Pyx_c_diff_float(a, b) ((a)-(b)) + #define __Pyx_c_prod_float(a, b) ((a)*(b)) + #define __Pyx_c_quot_float(a, b) ((a)/(b)) + #define __Pyx_c_neg_float(a) (-(a)) + #ifdef __cplusplus + #define __Pyx_c_is_zero_float(z) ((z)==(float)0) + #define __Pyx_c_conj_float(z) (::std::conj(z)) + #if 1 + #define __Pyx_c_abs_float(z) (::std::abs(z)) + #define __Pyx_c_pow_float(a, b) (::std::pow(a, b)) + #endif + #else + #define __Pyx_c_is_zero_float(z) ((z)==0) + #define __Pyx_c_conj_float(z) (conjf(z)) + #if 1 + #define __Pyx_c_abs_float(z) (cabsf(z)) + #define __Pyx_c_pow_float(a, b) (cpowf(a, b)) + #endif + #endif +#else + static CYTHON_INLINE int __Pyx_c_eq_float(__pyx_t_float_complex, __pyx_t_float_complex); + static CYTHON_INLINE __pyx_t_float_complex __Pyx_c_sum_float(__pyx_t_float_complex, __pyx_t_float_complex); + static CYTHON_INLINE __pyx_t_float_complex __Pyx_c_diff_float(__pyx_t_float_complex, __pyx_t_float_complex); + static CYTHON_INLINE __pyx_t_float_complex __Pyx_c_prod_float(__pyx_t_float_complex, __pyx_t_float_complex); + static CYTHON_INLINE __pyx_t_float_complex __Pyx_c_quot_float(__pyx_t_float_complex, __pyx_t_float_complex); + static CYTHON_INLINE __pyx_t_float_complex __Pyx_c_neg_float(__pyx_t_float_complex); + static CYTHON_INLINE int __Pyx_c_is_zero_float(__pyx_t_float_complex); + static CYTHON_INLINE __pyx_t_float_complex __Pyx_c_conj_float(__pyx_t_float_complex); + #if 1 + static CYTHON_INLINE float __Pyx_c_abs_float(__pyx_t_float_complex); + static CYTHON_INLINE __pyx_t_float_complex __Pyx_c_pow_float(__pyx_t_float_complex, __pyx_t_float_complex); + #endif +#endif + +/* Arithmetic.proto */ +#if CYTHON_CCOMPLEX && (1) && (!0 || __cplusplus) + #define __Pyx_c_eq_double(a, b) ((a)==(b)) + #define __Pyx_c_sum_double(a, b) ((a)+(b)) + #define __Pyx_c_diff_double(a, b) ((a)-(b)) + #define __Pyx_c_prod_double(a, b) ((a)*(b)) + #define __Pyx_c_quot_double(a, b) ((a)/(b)) + #define __Pyx_c_neg_double(a) (-(a)) + #ifdef __cplusplus + #define __Pyx_c_is_zero_double(z) ((z)==(double)0) + #define __Pyx_c_conj_double(z) (::std::conj(z)) + #if 1 + #define __Pyx_c_abs_double(z) (::std::abs(z)) + #define __Pyx_c_pow_double(a, b) (::std::pow(a, b)) + #endif + #else + #define __Pyx_c_is_zero_double(z) ((z)==0) + #define __Pyx_c_conj_double(z) (conj(z)) + #if 1 + #define __Pyx_c_abs_double(z) (cabs(z)) + #define __Pyx_c_pow_double(a, b) (cpow(a, b)) + #endif + #endif +#else + static CYTHON_INLINE int __Pyx_c_eq_double(__pyx_t_double_complex, __pyx_t_double_complex); + static CYTHON_INLINE __pyx_t_double_complex __Pyx_c_sum_double(__pyx_t_double_complex, __pyx_t_double_complex); + static CYTHON_INLINE __pyx_t_double_complex __Pyx_c_diff_double(__pyx_t_double_complex, __pyx_t_double_complex); + static CYTHON_INLINE __pyx_t_double_complex __Pyx_c_prod_double(__pyx_t_double_complex, __pyx_t_double_complex); + static CYTHON_INLINE __pyx_t_double_complex __Pyx_c_quot_double(__pyx_t_double_complex, __pyx_t_double_complex); + static CYTHON_INLINE __pyx_t_double_complex __Pyx_c_neg_double(__pyx_t_double_complex); + static CYTHON_INLINE int __Pyx_c_is_zero_double(__pyx_t_double_complex); + static CYTHON_INLINE __pyx_t_double_complex __Pyx_c_conj_double(__pyx_t_double_complex); + #if 1 + static CYTHON_INLINE double __Pyx_c_abs_double(__pyx_t_double_complex); + static CYTHON_INLINE __pyx_t_double_complex __Pyx_c_pow_double(__pyx_t_double_complex, __pyx_t_double_complex); + #endif +#endif + +/* Arithmetic.proto */ +#if CYTHON_CCOMPLEX && (1) && (!0 || __cplusplus) + #define __Pyx_c_eq_long__double(a, b) ((a)==(b)) + #define __Pyx_c_sum_long__double(a, b) ((a)+(b)) + #define __Pyx_c_diff_long__double(a, b) ((a)-(b)) + #define __Pyx_c_prod_long__double(a, b) ((a)*(b)) + #define __Pyx_c_quot_long__double(a, b) ((a)/(b)) + #define __Pyx_c_neg_long__double(a) (-(a)) + #ifdef __cplusplus + #define __Pyx_c_is_zero_long__double(z) ((z)==(long double)0) + #define __Pyx_c_conj_long__double(z) (::std::conj(z)) + #if 1 + #define __Pyx_c_abs_long__double(z) (::std::abs(z)) + #define __Pyx_c_pow_long__double(a, b) (::std::pow(a, b)) + #endif + #else + #define __Pyx_c_is_zero_long__double(z) ((z)==0) + #define __Pyx_c_conj_long__double(z) (conjl(z)) + #if 1 + #define __Pyx_c_abs_long__double(z) (cabsl(z)) + #define __Pyx_c_pow_long__double(a, b) (cpowl(a, b)) + #endif + #endif +#else + static CYTHON_INLINE int __Pyx_c_eq_long__double(__pyx_t_long_double_complex, __pyx_t_long_double_complex); + static CYTHON_INLINE __pyx_t_long_double_complex __Pyx_c_sum_long__double(__pyx_t_long_double_complex, __pyx_t_long_double_complex); + static CYTHON_INLINE __pyx_t_long_double_complex __Pyx_c_diff_long__double(__pyx_t_long_double_complex, __pyx_t_long_double_complex); + static CYTHON_INLINE __pyx_t_long_double_complex __Pyx_c_prod_long__double(__pyx_t_long_double_complex, __pyx_t_long_double_complex); + static CYTHON_INLINE __pyx_t_long_double_complex __Pyx_c_quot_long__double(__pyx_t_long_double_complex, __pyx_t_long_double_complex); + static CYTHON_INLINE __pyx_t_long_double_complex __Pyx_c_neg_long__double(__pyx_t_long_double_complex); + static CYTHON_INLINE int __Pyx_c_is_zero_long__double(__pyx_t_long_double_complex); + static CYTHON_INLINE __pyx_t_long_double_complex __Pyx_c_conj_long__double(__pyx_t_long_double_complex); + #if 1 + static CYTHON_INLINE long double __Pyx_c_abs_long__double(__pyx_t_long_double_complex); + static CYTHON_INLINE __pyx_t_long_double_complex __Pyx_c_pow_long__double(__pyx_t_long_double_complex, __pyx_t_long_double_complex); + #endif +#endif + +/* BufferStructDeclare.proto */ +typedef struct { + Py_ssize_t shape, strides, suboffsets; +} __Pyx_Buf_DimInfo; +typedef struct { + size_t refcount; + Py_buffer pybuffer; +} __Pyx_Buffer; +typedef struct { + __Pyx_Buffer *rcbuffer; + char *data; + __Pyx_Buf_DimInfo diminfo[8]; +} __Pyx_LocalBuf_ND; + +/* MemviewRefcount.proto */ +static CYTHON_INLINE int __pyx_add_acquisition_count_locked( + __pyx_atomic_int_type *acquisition_count, PyThread_type_lock lock); +static CYTHON_INLINE int __pyx_sub_acquisition_count_locked( + __pyx_atomic_int_type *acquisition_count, PyThread_type_lock lock); +#define __pyx_get_slice_count_pointer(memview) (&memview->acquisition_count) +#define __PYX_INC_MEMVIEW(slice, have_gil) __Pyx_INC_MEMVIEW(slice, have_gil, __LINE__) +#define __PYX_XCLEAR_MEMVIEW(slice, have_gil) __Pyx_XCLEAR_MEMVIEW(slice, have_gil, __LINE__) +static CYTHON_INLINE void __Pyx_INC_MEMVIEW(__Pyx_memviewslice *, int, int); +static CYTHON_INLINE void __Pyx_XCLEAR_MEMVIEW(__Pyx_memviewslice *, int, int); + +/* MemviewSliceIsContig.proto */ +static int __pyx_memviewslice_is_contig(const __Pyx_memviewslice mvs, char order, int ndim); + +/* OverlappingSlices.proto */ +static int __pyx_slices_overlap(__Pyx_memviewslice *slice1, + __Pyx_memviewslice *slice2, + int ndim, size_t itemsize); + +/* MemviewSliceInit.proto */ +static int __Pyx_init_memviewslice( + struct __pyx_memoryview_obj *memview, + int ndim, + __Pyx_memviewslice *memviewslice, + int memview_is_new_reference); + +/* CIntToPy.proto */ +static CYTHON_INLINE PyObject* __Pyx_PyLong_From___pyx_anon_enum(int value); + +/* CIntFromPy.proto */ +static CYTHON_INLINE int __Pyx_PyLong_As_int(PyObject *); + +/* CIntFromPy.proto */ +static CYTHON_INLINE uint64_t __Pyx_PyLong_As_uint64_t(PyObject *); + +/* CIntFromPy.proto */ +static CYTHON_INLINE long __Pyx_PyLong_As_long(PyObject *); + +/* CIntFromPy.proto */ +static CYTHON_INLINE int __Pyx_PyLong_As___pyx_anon_enum(PyObject *); + +/* CIntToPy.proto */ +static CYTHON_INLINE PyObject* __Pyx_PyLong_From_int(int value); + +/* CIntToPy.proto */ +static CYTHON_INLINE PyObject* __Pyx_PyLong_From_uint64_t(uint64_t value); + +/* CIntToPy.proto */ +static CYTHON_INLINE PyObject* __Pyx_PyLong_From_long(long value); + +/* CIntFromPy.proto */ +static CYTHON_INLINE size_t __Pyx_PyLong_As_size_t(PyObject *); + +/* MemviewSliceCopy.proto */ +static __Pyx_memviewslice +__pyx_memoryview_copy_new_contig(const __Pyx_memviewslice *from_mvs, + const char *mode, int ndim, + size_t sizeof_dtype, int contig_flag, + int dtype_is_object); + +/* PyObjectCallMethod1.proto */ +static PyObject* __Pyx_PyObject_CallMethod1(PyObject* obj, PyObject* method_name, PyObject* arg); + +/* UpdateUnpickledDict.proto */ +static int __Pyx_UpdateUnpickledDict(PyObject *obj, PyObject *state, Py_ssize_t index); + +/* CIntFromPy.proto */ +static CYTHON_INLINE char __Pyx_PyLong_As_char(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 + +/* 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 "." + +static PyObject *__pyx_array_get_memview(struct __pyx_array_obj *__pyx_v_self); /* proto*/ +static char *__pyx_memoryview_get_item_pointer(struct __pyx_memoryview_obj *__pyx_v_self, PyObject *__pyx_v_index); /* proto*/ +static PyObject *__pyx_memoryview_is_slice(struct __pyx_memoryview_obj *__pyx_v_self, PyObject *__pyx_v_obj); /* proto*/ +static PyObject *__pyx_memoryview_setitem_slice_assignment(struct __pyx_memoryview_obj *__pyx_v_self, PyObject *__pyx_v_dst, PyObject *__pyx_v_src); /* proto*/ +static PyObject *__pyx_memoryview_setitem_slice_assign_scalar(struct __pyx_memoryview_obj *__pyx_v_self, struct __pyx_memoryview_obj *__pyx_v_dst, PyObject *__pyx_v_value); /* proto*/ +static PyObject *__pyx_memoryview_setitem_indexed(struct __pyx_memoryview_obj *__pyx_v_self, PyObject *__pyx_v_index, PyObject *__pyx_v_value); /* proto*/ +static PyObject *__pyx_memoryview_convert_item_to_object(struct __pyx_memoryview_obj *__pyx_v_self, char *__pyx_v_itemp); /* proto*/ +static PyObject *__pyx_memoryview_assign_item_from_object(struct __pyx_memoryview_obj *__pyx_v_self, char *__pyx_v_itemp, PyObject *__pyx_v_value); /* proto*/ +static PyObject *__pyx_memoryview__get_base(struct __pyx_memoryview_obj *__pyx_v_self); /* proto*/ +static PyObject *__pyx_memoryviewslice_convert_item_to_object(struct __pyx_memoryviewslice_obj *__pyx_v_self, char *__pyx_v_itemp); /* proto*/ +static PyObject *__pyx_memoryviewslice_assign_item_from_object(struct __pyx_memoryviewslice_obj *__pyx_v_self, char *__pyx_v_itemp, PyObject *__pyx_v_value); /* proto*/ +static PyObject *__pyx_memoryviewslice__get_base(struct __pyx_memoryviewslice_obj *__pyx_v_self); /* proto*/ +static CYTHON_INLINE npy_intp __pyx_f_5numpy_5dtype_8itemsize_itemsize(PyArray_Descr *__pyx_v_self); /* proto*/ +static CYTHON_INLINE npy_intp __pyx_f_5numpy_5dtype_9alignment_alignment(PyArray_Descr *__pyx_v_self); /* proto*/ +static CYTHON_INLINE PyObject *__pyx_f_5numpy_5dtype_6fields_fields(PyArray_Descr *__pyx_v_self); /* proto*/ +static CYTHON_INLINE PyObject *__pyx_f_5numpy_5dtype_5names_names(PyArray_Descr *__pyx_v_self); /* proto*/ +static CYTHON_INLINE PyArray_ArrayDescr *__pyx_f_5numpy_5dtype_8subarray_subarray(PyArray_Descr *__pyx_v_self); /* proto*/ +static CYTHON_INLINE npy_uint64 __pyx_f_5numpy_5dtype_5flags_flags(PyArray_Descr *__pyx_v_self); /* proto*/ +static CYTHON_INLINE int __pyx_f_5numpy_9broadcast_7numiter_numiter(PyArrayMultiIterObject *__pyx_v_self); /* proto*/ +static CYTHON_INLINE npy_intp __pyx_f_5numpy_9broadcast_4size_size(PyArrayMultiIterObject *__pyx_v_self); /* proto*/ +static CYTHON_INLINE npy_intp __pyx_f_5numpy_9broadcast_5index_index(PyArrayMultiIterObject *__pyx_v_self); /* proto*/ +static CYTHON_INLINE int __pyx_f_5numpy_9broadcast_2nd_nd(PyArrayMultiIterObject *__pyx_v_self); /* proto*/ +static CYTHON_INLINE npy_intp *__pyx_f_5numpy_9broadcast_10dimensions_dimensions(PyArrayMultiIterObject *__pyx_v_self); /* proto*/ +static CYTHON_INLINE void **__pyx_f_5numpy_9broadcast_5iters_iters(PyArrayMultiIterObject *__pyx_v_self); /* proto*/ +static CYTHON_INLINE PyObject *__pyx_f_5numpy_7ndarray_4base_base(PyArrayObject *__pyx_v_self); /* proto*/ +static CYTHON_INLINE PyArray_Descr *__pyx_f_5numpy_7ndarray_5descr_descr(PyArrayObject *__pyx_v_self); /* proto*/ +static CYTHON_INLINE int __pyx_f_5numpy_7ndarray_4ndim_ndim(PyArrayObject *__pyx_v_self); /* proto*/ +static CYTHON_INLINE npy_intp *__pyx_f_5numpy_7ndarray_5shape_shape(PyArrayObject *__pyx_v_self); /* proto*/ +static CYTHON_INLINE npy_intp *__pyx_f_5numpy_7ndarray_7strides_strides(PyArrayObject *__pyx_v_self); /* proto*/ +static CYTHON_INLINE npy_intp __pyx_f_5numpy_7ndarray_4size_size(PyArrayObject *__pyx_v_self); /* proto*/ +static CYTHON_INLINE char *__pyx_f_5numpy_7ndarray_4data_data(PyArrayObject *__pyx_v_self); /* proto*/ +static CYTHON_INLINE struct __pyx_obj_5spacy_6lexeme_Lexeme *__pyx_f_5spacy_6lexeme_6Lexeme_from_ptr(struct __pyx_t_5spacy_7structs_LexemeC *__pyx_v_lex, struct __pyx_obj_5spacy_5vocab_Vocab *__pyx_v_vocab); /* proto*/ +static CYTHON_INLINE void __pyx_f_5spacy_6lexeme_6Lexeme_set_struct_attr(struct __pyx_t_5spacy_7structs_LexemeC *__pyx_v_lex, enum __pyx_t_5spacy_5attrs_attr_id_t __pyx_v_name, __pyx_t_5spacy_8typedefs_attr_t __pyx_v_value); /* proto*/ +static CYTHON_INLINE __pyx_t_5spacy_8typedefs_attr_t __pyx_f_5spacy_6lexeme_6Lexeme_get_struct_attr(struct __pyx_t_5spacy_7structs_LexemeC const *__pyx_v_lex, enum __pyx_t_5spacy_5attrs_attr_id_t __pyx_v_feat_name); /* proto*/ +static CYTHON_INLINE int __pyx_f_5spacy_6lexeme_6Lexeme_c_check_flag(struct __pyx_t_5spacy_7structs_LexemeC const *__pyx_v_lexeme, enum __pyx_t_5spacy_5attrs_attr_id_t __pyx_v_flag_id); /* proto*/ +static CYTHON_INLINE int __pyx_f_5spacy_6lexeme_6Lexeme_c_set_flag(struct __pyx_t_5spacy_7structs_LexemeC *__pyx_v_lex, enum __pyx_t_5spacy_5attrs_attr_id_t __pyx_v_flag_id, int __pyx_v_value); /* proto*/ +static CYTHON_INLINE struct __pyx_obj_5spacy_8pipeline_17_parser_internals_10stateclass_StateClass *__pyx_f_5spacy_8pipeline_17_parser_internals_10stateclass_10StateClass_borrow(__pyx_t_5spacy_8pipeline_17_parser_internals_6_state_StateC *__pyx_v_ptr, struct __pyx_obj_5spacy_6tokens_3doc_Doc *__pyx_v_doc); /* proto*/ +static CYTHON_INLINE struct __pyx_obj_5spacy_8pipeline_17_parser_internals_10stateclass_StateClass *__pyx_f_5spacy_8pipeline_17_parser_internals_10stateclass_10StateClass_init_offset(struct __pyx_t_5spacy_7structs_TokenC const *__pyx_v_sent, int __pyx_v_length, int __pyx_v_offset); /* proto*/ +static CYTHON_INLINE void *__pyx_f_5thinc_5extra_6search_4Beam_at(struct __pyx_obj_5thinc_5extra_6search_Beam *__pyx_v_self, int __pyx_v_i); /* proto*/ +static CYTHON_INLINE void __pyx_f_5thinc_5extra_6search_4Beam_set_cell(struct __pyx_obj_5thinc_5extra_6search_Beam *__pyx_v_self, int __pyx_v_i, int __pyx_v_j, __pyx_t_5thinc_5extra_6search_weight_t __pyx_v_score, int __pyx_v_is_valid, __pyx_t_5thinc_5extra_6search_weight_t __pyx_v_cost); /* proto*/ +static CYTHON_INLINE struct __pyx_obj_5spacy_6tokens_4span_Span *__pyx_f_5spacy_6tokens_4span_4Span_cinit(struct __pyx_obj_5spacy_6tokens_3doc_Doc *__pyx_v_doc, struct __pyx_t_5spacy_7structs_SpanC __pyx_v_span); /* proto*/ +static struct __pyx_t_5spacy_8pipeline_17_parser_internals_17transition_system_Transition __pyx_f_5spacy_8pipeline_17_parser_internals_3ner_13BiluoPushDown_lookup_transition(struct __pyx_obj_5spacy_8pipeline_17_parser_internals_3ner_BiluoPushDown *__pyx_v_self, PyObject *__pyx_v_name); /* proto*/ +static struct __pyx_t_5spacy_8pipeline_17_parser_internals_17transition_system_Transition __pyx_f_5spacy_8pipeline_17_parser_internals_3ner_13BiluoPushDown_init_transition(CYTHON_UNUSED struct __pyx_obj_5spacy_8pipeline_17_parser_internals_3ner_BiluoPushDown *__pyx_v_self, int __pyx_v_clas, int __pyx_v_move, __pyx_t_5spacy_8typedefs_attr_t __pyx_v_label); /* proto*/ +static int __pyx_f_5spacy_8pipeline_17_parser_internals_3ner_13BiluoPushDown_set_costs(struct __pyx_obj_5spacy_8pipeline_17_parser_internals_3ner_BiluoPushDown *__pyx_v_self, int *__pyx_v_is_valid, __pyx_t_5spacy_8typedefs_weight_t *__pyx_v_costs, __pyx_t_5spacy_8pipeline_17_parser_internals_6_state_StateC const *__pyx_v_state, PyObject *__pyx_v_gold); /* proto*/ +static int __pyx_f_5spacy_8pipeline_17_parser_internals_3ner_7Missing_is_valid(CYTHON_UNUSED __pyx_t_5spacy_8pipeline_17_parser_internals_6_state_StateC const *__pyx_v_st, CYTHON_UNUSED __pyx_t_5spacy_8typedefs_attr_t __pyx_v_label); /* proto*/ +static int __pyx_f_5spacy_8pipeline_17_parser_internals_3ner_7Missing_transition(CYTHON_UNUSED __pyx_t_5spacy_8pipeline_17_parser_internals_6_state_StateC *__pyx_v_s, CYTHON_UNUSED __pyx_t_5spacy_8typedefs_attr_t __pyx_v_label); /* proto*/ +static __pyx_t_5spacy_8typedefs_weight_t __pyx_f_5spacy_8pipeline_17_parser_internals_3ner_7Missing_cost(CYTHON_UNUSED __pyx_t_5spacy_8pipeline_17_parser_internals_6_state_StateC const *__pyx_v_s, CYTHON_UNUSED void const *__pyx_v__gold, CYTHON_UNUSED __pyx_t_5spacy_8typedefs_attr_t __pyx_v_label); /* proto*/ +static int __pyx_f_5spacy_8pipeline_17_parser_internals_3ner_5Begin_is_valid(__pyx_t_5spacy_8pipeline_17_parser_internals_6_state_StateC const *__pyx_v_st, __pyx_t_5spacy_8typedefs_attr_t __pyx_v_label); /* proto*/ +static int __pyx_f_5spacy_8pipeline_17_parser_internals_3ner_5Begin_transition(__pyx_t_5spacy_8pipeline_17_parser_internals_6_state_StateC *__pyx_v_st, __pyx_t_5spacy_8typedefs_attr_t __pyx_v_label); /* proto*/ +static __pyx_t_5spacy_8typedefs_weight_t __pyx_f_5spacy_8pipeline_17_parser_internals_3ner_5Begin_cost(__pyx_t_5spacy_8pipeline_17_parser_internals_6_state_StateC const *__pyx_v_s, void const *__pyx_v__gold, __pyx_t_5spacy_8typedefs_attr_t __pyx_v_label); /* proto*/ +static int __pyx_f_5spacy_8pipeline_17_parser_internals_3ner_2In_is_valid(__pyx_t_5spacy_8pipeline_17_parser_internals_6_state_StateC const *__pyx_v_st, __pyx_t_5spacy_8typedefs_attr_t __pyx_v_label); /* proto*/ +static int __pyx_f_5spacy_8pipeline_17_parser_internals_3ner_2In_transition(__pyx_t_5spacy_8pipeline_17_parser_internals_6_state_StateC *__pyx_v_st, CYTHON_UNUSED __pyx_t_5spacy_8typedefs_attr_t __pyx_v_label); /* proto*/ +static __pyx_t_5spacy_8typedefs_weight_t __pyx_f_5spacy_8pipeline_17_parser_internals_3ner_2In_cost(__pyx_t_5spacy_8pipeline_17_parser_internals_6_state_StateC const *__pyx_v_s, void const *__pyx_v__gold, CYTHON_UNUSED __pyx_t_5spacy_8typedefs_attr_t __pyx_v_label); /* proto*/ +static int __pyx_f_5spacy_8pipeline_17_parser_internals_3ner_4Last_is_valid(__pyx_t_5spacy_8pipeline_17_parser_internals_6_state_StateC const *__pyx_v_st, __pyx_t_5spacy_8typedefs_attr_t __pyx_v_label); /* proto*/ +static int __pyx_f_5spacy_8pipeline_17_parser_internals_3ner_4Last_transition(__pyx_t_5spacy_8pipeline_17_parser_internals_6_state_StateC *__pyx_v_st, CYTHON_UNUSED __pyx_t_5spacy_8typedefs_attr_t __pyx_v_label); /* proto*/ +static __pyx_t_5spacy_8typedefs_weight_t __pyx_f_5spacy_8pipeline_17_parser_internals_3ner_4Last_cost(__pyx_t_5spacy_8pipeline_17_parser_internals_6_state_StateC const *__pyx_v_s, void const *__pyx_v__gold, __pyx_t_5spacy_8typedefs_attr_t __pyx_v_label); /* proto*/ +static int __pyx_f_5spacy_8pipeline_17_parser_internals_3ner_4Unit_is_valid(__pyx_t_5spacy_8pipeline_17_parser_internals_6_state_StateC const *__pyx_v_st, __pyx_t_5spacy_8typedefs_attr_t __pyx_v_label); /* proto*/ +static int __pyx_f_5spacy_8pipeline_17_parser_internals_3ner_4Unit_transition(__pyx_t_5spacy_8pipeline_17_parser_internals_6_state_StateC *__pyx_v_st, __pyx_t_5spacy_8typedefs_attr_t __pyx_v_label); /* proto*/ +static __pyx_t_5spacy_8typedefs_weight_t __pyx_f_5spacy_8pipeline_17_parser_internals_3ner_4Unit_cost(__pyx_t_5spacy_8pipeline_17_parser_internals_6_state_StateC const *__pyx_v_s, void const *__pyx_v__gold, __pyx_t_5spacy_8typedefs_attr_t __pyx_v_label); /* proto*/ +static int __pyx_f_5spacy_8pipeline_17_parser_internals_3ner_3Out_is_valid(__pyx_t_5spacy_8pipeline_17_parser_internals_6_state_StateC const *__pyx_v_st, CYTHON_UNUSED __pyx_t_5spacy_8typedefs_attr_t __pyx_v_label); /* proto*/ +static int __pyx_f_5spacy_8pipeline_17_parser_internals_3ner_3Out_transition(__pyx_t_5spacy_8pipeline_17_parser_internals_6_state_StateC *__pyx_v_st, CYTHON_UNUSED __pyx_t_5spacy_8typedefs_attr_t __pyx_v_label); /* proto*/ +static __pyx_t_5spacy_8typedefs_weight_t __pyx_f_5spacy_8pipeline_17_parser_internals_3ner_3Out_cost(__pyx_t_5spacy_8pipeline_17_parser_internals_6_state_StateC const *__pyx_v_s, void const *__pyx_v__gold, CYTHON_UNUSED __pyx_t_5spacy_8typedefs_attr_t __pyx_v_label); /* proto*/ + +/* Module declarations from "cymem.cymem" */ + +/* Module declarations from "libc.stdint" */ + +/* Module declarations from "libcpp.utility" */ + +/* Module declarations from "libcpp.set" */ + +/* Module declarations from "libcpp.vector" */ + +/* Module declarations from "murmurhash.mrmr" */ +static uint64_t (*__pyx_f_10murmurhash_4mrmr_hash64)(void *, int, uint64_t); /*proto*/ + +/* Module declarations from "preshed.maps" */ + +/* Module declarations from "spacy.typedefs" */ + +/* Module declarations from "spacy.strings" */ + +/* Module declarations from "libcpp.unordered_map" */ + +/* Module declarations from "libcpp.unordered_set" */ + +/* Module declarations from "spacy" */ + +/* Module declarations from "spacy.symbols" */ + +/* Module declarations from "spacy.parts_of_speech" */ + +/* Module declarations from "spacy.structs" */ + +/* Module declarations from "libc.string" */ + +/* Module declarations from "libc.stdio" */ + +/* Module declarations from "__builtin__" */ + +/* Module declarations from "cpython.type" */ + +/* Module declarations from "cpython" */ + +/* Module declarations from "cpython.object" */ + +/* Module declarations from "cpython.ref" */ + +/* Module declarations from "numpy" */ + +/* Module declarations from "numpy" */ + +/* Module declarations from "spacy.attrs" */ + +/* Module declarations from "spacy.morphology" */ + +/* Module declarations from "spacy.vocab" */ +static struct __pyx_t_5spacy_7structs_LexemeC *__pyx_vp_5spacy_5vocab_EMPTY_LEXEME = 0; +#define __pyx_v_5spacy_5vocab_EMPTY_LEXEME (*__pyx_vp_5spacy_5vocab_EMPTY_LEXEME) + +/* Module declarations from "spacy.tokens.doc" */ + +/* Module declarations from "spacy.training.example" */ + +/* Module declarations from "libcpp" */ + +/* Module declarations from "cpython.exc" */ + +/* Module declarations from "libc.stdlib" */ + +/* Module declarations from "spacy.lexeme" */ +static struct __pyx_t_5spacy_7structs_LexemeC *__pyx_vp_5spacy_6lexeme_EMPTY_LEXEME = 0; +#define __pyx_v_5spacy_6lexeme_EMPTY_LEXEME (*__pyx_vp_5spacy_6lexeme_EMPTY_LEXEME) +static __pyx_t_5spacy_8typedefs_attr_t *__pyx_vp_5spacy_6lexeme_OOV_RANK = 0; +#define __pyx_v_5spacy_6lexeme_OOV_RANK (*__pyx_vp_5spacy_6lexeme_OOV_RANK) + +/* Module declarations from "spacy.pipeline._parser_internals._state" */ + +/* Module declarations from "spacy.pipeline._parser_internals.stateclass" */ + +/* Module declarations from "spacy.pipeline._parser_internals.transition_system" */ + +/* Module declarations from "libcpp.pair" */ + +/* Module declarations from "libcpp.queue" */ + +/* Module declarations from "thinc.extra.search" */ + +/* Module declarations from "spacy.tokens.span" */ + +/* Module declarations from "spacy.pipeline._parser_internals.ner" */ +static PyObject *__pyx_collections_abc_Sequence = 0; +static PyObject *generic = 0; +static PyObject *strided = 0; +static PyObject *indirect = 0; +static PyObject *contiguous = 0; +static PyObject *indirect_contiguous = 0; +static int __pyx_memoryview_thread_locks_used; +static PyThread_type_lock __pyx_memoryview_thread_locks[8]; +static struct __pyx_t_5spacy_8pipeline_17_parser_internals_3ner_GoldNERStateC __pyx_f_5spacy_8pipeline_17_parser_internals_3ner_create_gold_state(struct __pyx_obj_5cymem_5cymem_Pool *, struct __pyx_obj_5spacy_8pipeline_17_parser_internals_3ner_BiluoPushDown *, __pyx_t_5spacy_8pipeline_17_parser_internals_6_state_StateC const *, struct __pyx_obj_5spacy_8training_7example_Example *, PyObject *); /*proto*/ +static void __pyx_f_5spacy_8pipeline_17_parser_internals_3ner_update_gold_state(struct __pyx_t_5spacy_8pipeline_17_parser_internals_3ner_GoldNERStateC *, __pyx_t_5spacy_8pipeline_17_parser_internals_6_state_StateC const *); /*proto*/ +static int __pyx_f_5spacy_8pipeline_17_parser_internals_3ner__entity_is_sunk(__pyx_t_5spacy_8pipeline_17_parser_internals_6_state_StateC const *, struct __pyx_t_5spacy_8pipeline_17_parser_internals_17transition_system_Transition *); /*proto*/ +static PyObject *__pyx_f_5spacy_8pipeline_17_parser_internals_3ner___pyx_unpickle_Missing__set_state(struct __pyx_obj_5spacy_8pipeline_17_parser_internals_3ner_Missing *, PyObject *); /*proto*/ +static PyObject *__pyx_f_5spacy_8pipeline_17_parser_internals_3ner___pyx_unpickle_Begin__set_state(struct __pyx_obj_5spacy_8pipeline_17_parser_internals_3ner_Begin *, PyObject *); /*proto*/ +static PyObject *__pyx_f_5spacy_8pipeline_17_parser_internals_3ner___pyx_unpickle_In__set_state(struct __pyx_obj_5spacy_8pipeline_17_parser_internals_3ner_In *, PyObject *); /*proto*/ +static PyObject *__pyx_f_5spacy_8pipeline_17_parser_internals_3ner___pyx_unpickle_Last__set_state(struct __pyx_obj_5spacy_8pipeline_17_parser_internals_3ner_Last *, PyObject *); /*proto*/ +static PyObject *__pyx_f_5spacy_8pipeline_17_parser_internals_3ner___pyx_unpickle_Unit__set_state(struct __pyx_obj_5spacy_8pipeline_17_parser_internals_3ner_Unit *, PyObject *); /*proto*/ +static PyObject *__pyx_f_5spacy_8pipeline_17_parser_internals_3ner___pyx_unpickle_Out__set_state(struct __pyx_obj_5spacy_8pipeline_17_parser_internals_3ner_Out *, PyObject *); /*proto*/ +static int __pyx_array_allocate_buffer(struct __pyx_array_obj *); /*proto*/ +static struct __pyx_array_obj *__pyx_array_new(PyObject *, Py_ssize_t, char *, char const *, char *); /*proto*/ +static PyObject *__pyx_memoryview_new(PyObject *, int, int, __Pyx_TypeInfo const *); /*proto*/ +static CYTHON_INLINE int __pyx_memoryview_check(PyObject *); /*proto*/ +static PyObject *_unellipsify(PyObject *, int); /*proto*/ +static int assert_direct_dimensions(Py_ssize_t *, int); /*proto*/ +static struct __pyx_memoryview_obj *__pyx_memview_slice(struct __pyx_memoryview_obj *, PyObject *); /*proto*/ +static int __pyx_memoryview_slice_memviewslice(__Pyx_memviewslice *, Py_ssize_t, Py_ssize_t, Py_ssize_t, int, int, int *, Py_ssize_t, Py_ssize_t, Py_ssize_t, int, int, int, int); /*proto*/ +static char *__pyx_pybuffer_index(Py_buffer *, char *, Py_ssize_t, Py_ssize_t); /*proto*/ +static int __pyx_memslice_transpose(__Pyx_memviewslice *); /*proto*/ +static PyObject *__pyx_memoryview_fromslice(__Pyx_memviewslice, int, PyObject *(*)(char *), int (*)(char *, PyObject *), int); /*proto*/ +static __Pyx_memviewslice *__pyx_memoryview_get_slice_from_memoryview(struct __pyx_memoryview_obj *, __Pyx_memviewslice *); /*proto*/ +static void __pyx_memoryview_slice_copy(struct __pyx_memoryview_obj *, __Pyx_memviewslice *); /*proto*/ +static PyObject *__pyx_memoryview_copy_object(struct __pyx_memoryview_obj *); /*proto*/ +static PyObject *__pyx_memoryview_copy_object_from_slice(struct __pyx_memoryview_obj *, __Pyx_memviewslice *); /*proto*/ +static Py_ssize_t abs_py_ssize_t(Py_ssize_t); /*proto*/ +static char __pyx_get_best_slice_order(__Pyx_memviewslice *, int); /*proto*/ +static void _copy_strided_to_strided(char *, Py_ssize_t *, char *, Py_ssize_t *, Py_ssize_t *, Py_ssize_t *, int, size_t); /*proto*/ +static void copy_strided_to_strided(__Pyx_memviewslice *, __Pyx_memviewslice *, int, size_t); /*proto*/ +static Py_ssize_t __pyx_memoryview_slice_get_size(__Pyx_memviewslice *, int); /*proto*/ +static Py_ssize_t __pyx_fill_contig_strides_array(Py_ssize_t *, Py_ssize_t *, Py_ssize_t, int, char); /*proto*/ +static void *__pyx_memoryview_copy_data_to_temp(__Pyx_memviewslice *, __Pyx_memviewslice *, char, int); /*proto*/ +static int __pyx_memoryview_err_extents(int, Py_ssize_t, Py_ssize_t); /*proto*/ +static int __pyx_memoryview_err_dim(PyObject *, PyObject *, int); /*proto*/ +static int __pyx_memoryview_err(PyObject *, PyObject *); /*proto*/ +static int __pyx_memoryview_err_no_memory(void); /*proto*/ +static int __pyx_memoryview_copy_contents(__Pyx_memviewslice, __Pyx_memviewslice, int, int, int); /*proto*/ +static void __pyx_memoryview_broadcast_leading(__Pyx_memviewslice *, int, int); /*proto*/ +static void __pyx_memoryview_refcount_copying(__Pyx_memviewslice *, int, int, int); /*proto*/ +static void __pyx_memoryview_refcount_objects_in_slice_with_gil(char *, Py_ssize_t *, Py_ssize_t *, int, int); /*proto*/ +static void __pyx_memoryview_refcount_objects_in_slice(char *, Py_ssize_t *, Py_ssize_t *, int, int); /*proto*/ +static void __pyx_memoryview_slice_assign_scalar(__Pyx_memviewslice *, int, size_t, void *, int); /*proto*/ +static void __pyx_memoryview__slice_assign_scalar(char *, Py_ssize_t *, Py_ssize_t *, int, size_t, void *); /*proto*/ +static PyObject *__pyx_unpickle_Enum__set_state(struct __pyx_MemviewEnum_obj *, PyObject *); /*proto*/ +/* #### Code section: typeinfo ### */ +/* #### Code section: before_global_var ### */ +#define __Pyx_MODULE_NAME "spacy.pipeline._parser_internals.ner" +extern int __pyx_module_is_main_spacy__pipeline___parser_internals__ner; +int __pyx_module_is_main_spacy__pipeline___parser_internals__ner = 0; + +/* Implementation of "spacy.pipeline._parser_internals.ner" */ +/* #### Code section: global_var ### */ +static PyObject *__pyx_builtin_enumerate; +static PyObject *__pyx_builtin_zip; +static PyObject *__pyx_builtin_sum; +static PyObject *__pyx_builtin_min; +static PyObject *__pyx_builtin___import__; +static PyObject *__pyx_builtin_Ellipsis; +static PyObject *__pyx_builtin_id; +/* #### Code section: string_decls ### */ +/* #### Code section: decls ### */ +static int __pyx_array___pyx_pf_15View_dot_MemoryView_5array___cinit__(struct __pyx_array_obj *__pyx_v_self, PyObject *__pyx_v_shape, Py_ssize_t __pyx_v_itemsize, PyObject *__pyx_v_format, PyObject *__pyx_v_mode, int __pyx_v_allocate_buffer); /* proto */ +static int __pyx_array___pyx_pf_15View_dot_MemoryView_5array_2__getbuffer__(struct __pyx_array_obj *__pyx_v_self, Py_buffer *__pyx_v_info, int __pyx_v_flags); /* proto */ +static void __pyx_array___pyx_pf_15View_dot_MemoryView_5array_4__dealloc__(struct __pyx_array_obj *__pyx_v_self); /* proto */ +static PyObject *__pyx_pf_15View_dot_MemoryView_5array_7memview___get__(struct __pyx_array_obj *__pyx_v_self); /* proto */ +static Py_ssize_t __pyx_array___pyx_pf_15View_dot_MemoryView_5array_6__len__(struct __pyx_array_obj *__pyx_v_self); /* proto */ +static PyObject *__pyx_array___pyx_pf_15View_dot_MemoryView_5array_8__getattr__(struct __pyx_array_obj *__pyx_v_self, PyObject *__pyx_v_attr); /* proto */ +static PyObject *__pyx_array___pyx_pf_15View_dot_MemoryView_5array_10__getitem__(struct __pyx_array_obj *__pyx_v_self, PyObject *__pyx_v_item); /* proto */ +static int __pyx_array___pyx_pf_15View_dot_MemoryView_5array_12__setitem__(struct __pyx_array_obj *__pyx_v_self, PyObject *__pyx_v_item, PyObject *__pyx_v_value); /* proto */ +static PyObject *__pyx_pf___pyx_array___reduce_cython__(CYTHON_UNUSED struct __pyx_array_obj *__pyx_v_self); /* proto */ +static PyObject *__pyx_pf___pyx_array_2__setstate_cython__(CYTHON_UNUSED struct __pyx_array_obj *__pyx_v_self, CYTHON_UNUSED PyObject *__pyx_v___pyx_state); /* proto */ +static int __pyx_MemviewEnum___pyx_pf_15View_dot_MemoryView_4Enum___init__(struct __pyx_MemviewEnum_obj *__pyx_v_self, PyObject *__pyx_v_name); /* proto */ +static PyObject *__pyx_MemviewEnum___pyx_pf_15View_dot_MemoryView_4Enum_2__repr__(struct __pyx_MemviewEnum_obj *__pyx_v_self); /* proto */ +static PyObject *__pyx_pf___pyx_MemviewEnum___reduce_cython__(struct __pyx_MemviewEnum_obj *__pyx_v_self); /* proto */ +static PyObject *__pyx_pf___pyx_MemviewEnum_2__setstate_cython__(struct __pyx_MemviewEnum_obj *__pyx_v_self, PyObject *__pyx_v___pyx_state); /* proto */ +static int __pyx_memoryview___pyx_pf_15View_dot_MemoryView_10memoryview___cinit__(struct __pyx_memoryview_obj *__pyx_v_self, PyObject *__pyx_v_obj, int __pyx_v_flags, int __pyx_v_dtype_is_object); /* proto */ +static void __pyx_memoryview___pyx_pf_15View_dot_MemoryView_10memoryview_2__dealloc__(struct __pyx_memoryview_obj *__pyx_v_self); /* proto */ +static PyObject *__pyx_memoryview___pyx_pf_15View_dot_MemoryView_10memoryview_4__getitem__(struct __pyx_memoryview_obj *__pyx_v_self, PyObject *__pyx_v_index); /* proto */ +static int __pyx_memoryview___pyx_pf_15View_dot_MemoryView_10memoryview_6__setitem__(struct __pyx_memoryview_obj *__pyx_v_self, PyObject *__pyx_v_index, PyObject *__pyx_v_value); /* proto */ +static int __pyx_memoryview___pyx_pf_15View_dot_MemoryView_10memoryview_8__getbuffer__(struct __pyx_memoryview_obj *__pyx_v_self, Py_buffer *__pyx_v_info, int __pyx_v_flags); /* proto */ +static PyObject *__pyx_pf_15View_dot_MemoryView_10memoryview_1T___get__(struct __pyx_memoryview_obj *__pyx_v_self); /* proto */ +static PyObject *__pyx_pf_15View_dot_MemoryView_10memoryview_4base___get__(struct __pyx_memoryview_obj *__pyx_v_self); /* proto */ +static PyObject *__pyx_pf_15View_dot_MemoryView_10memoryview_5shape___get__(struct __pyx_memoryview_obj *__pyx_v_self); /* proto */ +static PyObject *__pyx_pf_15View_dot_MemoryView_10memoryview_7strides___get__(struct __pyx_memoryview_obj *__pyx_v_self); /* proto */ +static PyObject *__pyx_pf_15View_dot_MemoryView_10memoryview_10suboffsets___get__(struct __pyx_memoryview_obj *__pyx_v_self); /* proto */ +static PyObject *__pyx_pf_15View_dot_MemoryView_10memoryview_4ndim___get__(struct __pyx_memoryview_obj *__pyx_v_self); /* proto */ +static PyObject *__pyx_pf_15View_dot_MemoryView_10memoryview_8itemsize___get__(struct __pyx_memoryview_obj *__pyx_v_self); /* proto */ +static PyObject *__pyx_pf_15View_dot_MemoryView_10memoryview_6nbytes___get__(struct __pyx_memoryview_obj *__pyx_v_self); /* proto */ +static PyObject *__pyx_pf_15View_dot_MemoryView_10memoryview_4size___get__(struct __pyx_memoryview_obj *__pyx_v_self); /* proto */ +static Py_ssize_t __pyx_memoryview___pyx_pf_15View_dot_MemoryView_10memoryview_10__len__(struct __pyx_memoryview_obj *__pyx_v_self); /* proto */ +static PyObject *__pyx_memoryview___pyx_pf_15View_dot_MemoryView_10memoryview_12__repr__(struct __pyx_memoryview_obj *__pyx_v_self); /* proto */ +static PyObject *__pyx_memoryview___pyx_pf_15View_dot_MemoryView_10memoryview_14__str__(struct __pyx_memoryview_obj *__pyx_v_self); /* proto */ +static PyObject *__pyx_memoryview___pyx_pf_15View_dot_MemoryView_10memoryview_16is_c_contig(struct __pyx_memoryview_obj *__pyx_v_self); /* proto */ +static PyObject *__pyx_memoryview___pyx_pf_15View_dot_MemoryView_10memoryview_18is_f_contig(struct __pyx_memoryview_obj *__pyx_v_self); /* proto */ +static PyObject *__pyx_memoryview___pyx_pf_15View_dot_MemoryView_10memoryview_20copy(struct __pyx_memoryview_obj *__pyx_v_self); /* proto */ +static PyObject *__pyx_memoryview___pyx_pf_15View_dot_MemoryView_10memoryview_22copy_fortran(struct __pyx_memoryview_obj *__pyx_v_self); /* proto */ +static PyObject *__pyx_pf___pyx_memoryview___reduce_cython__(CYTHON_UNUSED struct __pyx_memoryview_obj *__pyx_v_self); /* proto */ +static PyObject *__pyx_pf___pyx_memoryview_2__setstate_cython__(CYTHON_UNUSED struct __pyx_memoryview_obj *__pyx_v_self, CYTHON_UNUSED PyObject *__pyx_v___pyx_state); /* proto */ +static void __pyx_memoryviewslice___pyx_pf_15View_dot_MemoryView_16_memoryviewslice___dealloc__(struct __pyx_memoryviewslice_obj *__pyx_v_self); /* proto */ +static PyObject *__pyx_pf___pyx_memoryviewslice___reduce_cython__(CYTHON_UNUSED struct __pyx_memoryviewslice_obj *__pyx_v_self); /* proto */ +static PyObject *__pyx_pf___pyx_memoryviewslice_2__setstate_cython__(CYTHON_UNUSED struct __pyx_memoryviewslice_obj *__pyx_v_self, CYTHON_UNUSED PyObject *__pyx_v___pyx_state); /* proto */ +static PyObject *__pyx_pf_15View_dot_MemoryView___pyx_unpickle_Enum(CYTHON_UNUSED PyObject *__pyx_self, PyObject *__pyx_v___pyx_type, long __pyx_v___pyx_checksum, PyObject *__pyx_v___pyx_state); /* proto */ +static int __pyx_pf_5spacy_8pipeline_17_parser_internals_3ner_9BiluoGold___init__(struct __pyx_obj_5spacy_8pipeline_17_parser_internals_3ner_BiluoGold *__pyx_v_self, struct __pyx_obj_5spacy_8pipeline_17_parser_internals_3ner_BiluoPushDown *__pyx_v_moves, struct __pyx_obj_5spacy_8pipeline_17_parser_internals_10stateclass_StateClass *__pyx_v_stcls, struct __pyx_obj_5spacy_8training_7example_Example *__pyx_v_example, PyObject *__pyx_v_neg_key); /* proto */ +static PyObject *__pyx_pf_5spacy_8pipeline_17_parser_internals_3ner_9BiluoGold_2update(struct __pyx_obj_5spacy_8pipeline_17_parser_internals_3ner_BiluoGold *__pyx_v_self, struct __pyx_obj_5spacy_8pipeline_17_parser_internals_10stateclass_StateClass *__pyx_v_stcls); /* proto */ +static PyObject *__pyx_pf_5spacy_8pipeline_17_parser_internals_3ner_9BiluoGold_4__reduce_cython__(CYTHON_UNUSED struct __pyx_obj_5spacy_8pipeline_17_parser_internals_3ner_BiluoGold *__pyx_v_self); /* proto */ +static PyObject *__pyx_pf_5spacy_8pipeline_17_parser_internals_3ner_9BiluoGold_6__setstate_cython__(CYTHON_UNUSED struct __pyx_obj_5spacy_8pipeline_17_parser_internals_3ner_BiluoGold *__pyx_v_self, CYTHON_UNUSED PyObject *__pyx_v___pyx_state); /* proto */ +static int __pyx_pf_5spacy_8pipeline_17_parser_internals_3ner_13BiluoPushDown___init__(struct __pyx_obj_5spacy_8pipeline_17_parser_internals_3ner_BiluoPushDown *__pyx_v_self, PyObject *__pyx_v_args, PyObject *__pyx_v_kwargs); /* proto */ +static PyObject *__pyx_pf_5spacy_8pipeline_17_parser_internals_3ner_13BiluoPushDown_2get_actions(CYTHON_UNUSED PyTypeObject *__pyx_v_cls, PyObject *__pyx_v_kwargs); /* proto */ +static PyObject *__pyx_pf_5spacy_8pipeline_17_parser_internals_3ner_13BiluoPushDown_12action_types___get__(CYTHON_UNUSED struct __pyx_obj_5spacy_8pipeline_17_parser_internals_3ner_BiluoPushDown *__pyx_v_self); /* proto */ +static PyObject *__pyx_pf_5spacy_8pipeline_17_parser_internals_3ner_13BiluoPushDown_4get_doc_labels(CYTHON_UNUSED struct __pyx_obj_5spacy_8pipeline_17_parser_internals_3ner_BiluoPushDown *__pyx_v_self, PyObject *__pyx_v_doc); /* proto */ +static PyObject *__pyx_pf_5spacy_8pipeline_17_parser_internals_3ner_13BiluoPushDown_6move_name(struct __pyx_obj_5spacy_8pipeline_17_parser_internals_3ner_BiluoPushDown *__pyx_v_self, int __pyx_v_move, __pyx_t_5spacy_8typedefs_attr_t __pyx_v_label); /* proto */ +static PyObject *__pyx_pf_5spacy_8pipeline_17_parser_internals_3ner_13BiluoPushDown_8init_gold_batch(struct __pyx_obj_5spacy_8pipeline_17_parser_internals_3ner_BiluoPushDown *__pyx_v_self, PyObject *__pyx_v_examples); /* proto */ +static PyObject *__pyx_pf_5spacy_8pipeline_17_parser_internals_3ner_13BiluoPushDown_10add_action(struct __pyx_obj_5spacy_8pipeline_17_parser_internals_3ner_BiluoPushDown *__pyx_v_self, int __pyx_v_action, PyObject *__pyx_v_label_name, PyObject *__pyx_v_freq); /* proto */ +static PyObject *__pyx_pf_5spacy_8pipeline_17_parser_internals_3ner_13BiluoPushDown_12set_annotations(CYTHON_UNUSED struct __pyx_obj_5spacy_8pipeline_17_parser_internals_3ner_BiluoPushDown *__pyx_v_self, struct __pyx_obj_5spacy_8pipeline_17_parser_internals_10stateclass_StateClass *__pyx_v_state, struct __pyx_obj_5spacy_6tokens_3doc_Doc *__pyx_v_doc); /* proto */ +static PyObject *__pyx_pf_5spacy_8pipeline_17_parser_internals_3ner_13BiluoPushDown_14get_beam_parses(struct __pyx_obj_5spacy_8pipeline_17_parser_internals_3ner_BiluoPushDown *__pyx_v_self, struct __pyx_obj_5thinc_5extra_6search_Beam *__pyx_v_beam); /* proto */ +static PyObject *__pyx_pf_5spacy_8pipeline_17_parser_internals_3ner_13BiluoPushDown_16init_gold(struct __pyx_obj_5spacy_8pipeline_17_parser_internals_3ner_BiluoPushDown *__pyx_v_self, struct __pyx_obj_5spacy_8pipeline_17_parser_internals_10stateclass_StateClass *__pyx_v_state, struct __pyx_obj_5spacy_8training_7example_Example *__pyx_v_example); /* proto */ +static PyObject *__pyx_pf_5spacy_8pipeline_17_parser_internals_3ner_13BiluoPushDown_18has_gold(struct __pyx_obj_5spacy_8pipeline_17_parser_internals_3ner_BiluoPushDown *__pyx_v_self, struct __pyx_obj_5spacy_8training_7example_Example *__pyx_v_eg, PyObject *__pyx_v_start, PyObject *__pyx_v_end); /* proto */ +static PyObject *__pyx_pf_5spacy_8pipeline_17_parser_internals_3ner_13BiluoPushDown_20get_cost(struct __pyx_obj_5spacy_8pipeline_17_parser_internals_3ner_BiluoPushDown *__pyx_v_self, struct __pyx_obj_5spacy_8pipeline_17_parser_internals_10stateclass_StateClass *__pyx_v_stcls, PyObject *__pyx_v_gold, int __pyx_v_i); /* proto */ +static PyObject *__pyx_pf_5spacy_8pipeline_17_parser_internals_3ner_13BiluoPushDown_22__reduce_cython__(CYTHON_UNUSED struct __pyx_obj_5spacy_8pipeline_17_parser_internals_3ner_BiluoPushDown *__pyx_v_self); /* proto */ +static PyObject *__pyx_pf_5spacy_8pipeline_17_parser_internals_3ner_13BiluoPushDown_24__setstate_cython__(CYTHON_UNUSED struct __pyx_obj_5spacy_8pipeline_17_parser_internals_3ner_BiluoPushDown *__pyx_v_self, CYTHON_UNUSED PyObject *__pyx_v___pyx_state); /* proto */ +static PyObject *__pyx_pf_5spacy_8pipeline_17_parser_internals_3ner_7Missing___reduce_cython__(struct __pyx_obj_5spacy_8pipeline_17_parser_internals_3ner_Missing *__pyx_v_self); /* proto */ +static PyObject *__pyx_pf_5spacy_8pipeline_17_parser_internals_3ner_7Missing_2__setstate_cython__(struct __pyx_obj_5spacy_8pipeline_17_parser_internals_3ner_Missing *__pyx_v_self, PyObject *__pyx_v___pyx_state); /* proto */ +static PyObject *__pyx_pf_5spacy_8pipeline_17_parser_internals_3ner_5Begin___reduce_cython__(struct __pyx_obj_5spacy_8pipeline_17_parser_internals_3ner_Begin *__pyx_v_self); /* proto */ +static PyObject *__pyx_pf_5spacy_8pipeline_17_parser_internals_3ner_5Begin_2__setstate_cython__(struct __pyx_obj_5spacy_8pipeline_17_parser_internals_3ner_Begin *__pyx_v_self, PyObject *__pyx_v___pyx_state); /* proto */ +static PyObject *__pyx_pf_5spacy_8pipeline_17_parser_internals_3ner_2In___reduce_cython__(struct __pyx_obj_5spacy_8pipeline_17_parser_internals_3ner_In *__pyx_v_self); /* proto */ +static PyObject *__pyx_pf_5spacy_8pipeline_17_parser_internals_3ner_2In_2__setstate_cython__(struct __pyx_obj_5spacy_8pipeline_17_parser_internals_3ner_In *__pyx_v_self, PyObject *__pyx_v___pyx_state); /* proto */ +static PyObject *__pyx_pf_5spacy_8pipeline_17_parser_internals_3ner_4Last___reduce_cython__(struct __pyx_obj_5spacy_8pipeline_17_parser_internals_3ner_Last *__pyx_v_self); /* proto */ +static PyObject *__pyx_pf_5spacy_8pipeline_17_parser_internals_3ner_4Last_2__setstate_cython__(struct __pyx_obj_5spacy_8pipeline_17_parser_internals_3ner_Last *__pyx_v_self, PyObject *__pyx_v___pyx_state); /* proto */ +static PyObject *__pyx_pf_5spacy_8pipeline_17_parser_internals_3ner_4Unit___reduce_cython__(struct __pyx_obj_5spacy_8pipeline_17_parser_internals_3ner_Unit *__pyx_v_self); /* proto */ +static PyObject *__pyx_pf_5spacy_8pipeline_17_parser_internals_3ner_4Unit_2__setstate_cython__(struct __pyx_obj_5spacy_8pipeline_17_parser_internals_3ner_Unit *__pyx_v_self, PyObject *__pyx_v___pyx_state); /* proto */ +static PyObject *__pyx_pf_5spacy_8pipeline_17_parser_internals_3ner_3Out___reduce_cython__(struct __pyx_obj_5spacy_8pipeline_17_parser_internals_3ner_Out *__pyx_v_self); /* proto */ +static PyObject *__pyx_pf_5spacy_8pipeline_17_parser_internals_3ner_3Out_2__setstate_cython__(struct __pyx_obj_5spacy_8pipeline_17_parser_internals_3ner_Out *__pyx_v_self, PyObject *__pyx_v___pyx_state); /* proto */ +static PyObject *__pyx_pf_5spacy_8pipeline_17_parser_internals_3ner___pyx_unpickle_Missing(CYTHON_UNUSED PyObject *__pyx_self, PyObject *__pyx_v___pyx_type, long __pyx_v___pyx_checksum, PyObject *__pyx_v___pyx_state); /* proto */ +static PyObject *__pyx_pf_5spacy_8pipeline_17_parser_internals_3ner_2__pyx_unpickle_Begin(CYTHON_UNUSED PyObject *__pyx_self, PyObject *__pyx_v___pyx_type, long __pyx_v___pyx_checksum, PyObject *__pyx_v___pyx_state); /* proto */ +static PyObject *__pyx_pf_5spacy_8pipeline_17_parser_internals_3ner_4__pyx_unpickle_In(CYTHON_UNUSED PyObject *__pyx_self, PyObject *__pyx_v___pyx_type, long __pyx_v___pyx_checksum, PyObject *__pyx_v___pyx_state); /* proto */ +static PyObject *__pyx_pf_5spacy_8pipeline_17_parser_internals_3ner_6__pyx_unpickle_Last(CYTHON_UNUSED PyObject *__pyx_self, PyObject *__pyx_v___pyx_type, long __pyx_v___pyx_checksum, PyObject *__pyx_v___pyx_state); /* proto */ +static PyObject *__pyx_pf_5spacy_8pipeline_17_parser_internals_3ner_8__pyx_unpickle_Unit(CYTHON_UNUSED PyObject *__pyx_self, PyObject *__pyx_v___pyx_type, long __pyx_v___pyx_checksum, PyObject *__pyx_v___pyx_state); /* proto */ +static PyObject *__pyx_pf_5spacy_8pipeline_17_parser_internals_3ner_10__pyx_unpickle_Out(CYTHON_UNUSED PyObject *__pyx_self, PyObject *__pyx_v___pyx_type, long __pyx_v___pyx_checksum, PyObject *__pyx_v___pyx_state); /* proto */ +static PyObject *__pyx_tp_new_5spacy_8pipeline_17_parser_internals_3ner_BiluoPushDown(PyTypeObject *t, PyObject *a, PyObject *k); /*proto*/ +static PyObject *__pyx_tp_new_5spacy_8pipeline_17_parser_internals_3ner_BiluoGold(PyTypeObject *t, PyObject *a, PyObject *k); /*proto*/ +static PyObject *__pyx_tp_new_5spacy_8pipeline_17_parser_internals_3ner_Missing(PyTypeObject *t, PyObject *a, PyObject *k); /*proto*/ +static PyObject *__pyx_tp_new_5spacy_8pipeline_17_parser_internals_3ner_Begin(PyTypeObject *t, PyObject *a, PyObject *k); /*proto*/ +static PyObject *__pyx_tp_new_5spacy_8pipeline_17_parser_internals_3ner_In(PyTypeObject *t, PyObject *a, PyObject *k); /*proto*/ +static PyObject *__pyx_tp_new_5spacy_8pipeline_17_parser_internals_3ner_Last(PyTypeObject *t, PyObject *a, PyObject *k); /*proto*/ +static PyObject *__pyx_tp_new_5spacy_8pipeline_17_parser_internals_3ner_Unit(PyTypeObject *t, PyObject *a, PyObject *k); /*proto*/ +static PyObject *__pyx_tp_new_5spacy_8pipeline_17_parser_internals_3ner_Out(PyTypeObject *t, PyObject *a, PyObject *k); /*proto*/ +static PyObject *__pyx_tp_new_array(PyTypeObject *t, PyObject *a, PyObject *k); /*proto*/ +static PyObject *__pyx_tp_new_Enum(PyTypeObject *t, PyObject *a, PyObject *k); /*proto*/ +static PyObject *__pyx_tp_new_memoryview(PyTypeObject *t, PyObject *a, PyObject *k); /*proto*/ +static PyObject *__pyx_tp_new__memoryviewslice(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_5cymem_5cymem_PyMalloc; + PyTypeObject *__pyx_ptype_5cymem_5cymem_PyFree; + PyTypeObject *__pyx_ptype_5cymem_5cymem_Pool; + PyTypeObject *__pyx_ptype_5cymem_5cymem_Address; + PyTypeObject *__pyx_ptype_7preshed_4maps_PreshMap; + PyTypeObject *__pyx_ptype_7preshed_4maps_PreshMapArray; + PyTypeObject *__pyx_ptype_5spacy_7strings_StringStore; + PyTypeObject *__pyx_ptype_7cpython_4type_type; + PyTypeObject *__pyx_ptype_5numpy_dtype; + PyTypeObject *__pyx_ptype_5numpy_flatiter; + PyTypeObject *__pyx_ptype_5numpy_broadcast; + PyTypeObject *__pyx_ptype_5numpy_ndarray; + PyTypeObject *__pyx_ptype_5numpy_generic; + PyTypeObject *__pyx_ptype_5numpy_number; + PyTypeObject *__pyx_ptype_5numpy_integer; + PyTypeObject *__pyx_ptype_5numpy_signedinteger; + PyTypeObject *__pyx_ptype_5numpy_unsignedinteger; + PyTypeObject *__pyx_ptype_5numpy_inexact; + PyTypeObject *__pyx_ptype_5numpy_floating; + PyTypeObject *__pyx_ptype_5numpy_complexfloating; + PyTypeObject *__pyx_ptype_5numpy_flexible; + PyTypeObject *__pyx_ptype_5numpy_character; + PyTypeObject *__pyx_ptype_5numpy_ufunc; + PyTypeObject *__pyx_ptype_5spacy_10morphology_Morphology; + PyTypeObject *__pyx_ptype_5spacy_5vocab_Vocab; + PyTypeObject *__pyx_ptype_5spacy_6tokens_3doc_Doc; + PyTypeObject *__pyx_ptype_5spacy_8training_7example_Example; + PyTypeObject *__pyx_ptype_5spacy_6lexeme_Lexeme; + PyTypeObject *__pyx_ptype_5spacy_8pipeline_17_parser_internals_10stateclass_StateClass; + PyTypeObject *__pyx_ptype_5spacy_8pipeline_17_parser_internals_17transition_system_TransitionSystem; + PyTypeObject *__pyx_ptype_5thinc_5extra_6search_Beam; + PyTypeObject *__pyx_ptype_5thinc_5extra_6search_MaxViolation; + PyTypeObject *__pyx_ptype_5spacy_6tokens_4span_Span; + PyObject *__pyx_type_5spacy_8pipeline_17_parser_internals_3ner_BiluoPushDown; + PyObject *__pyx_type_5spacy_8pipeline_17_parser_internals_3ner_BiluoGold; + PyObject *__pyx_type_5spacy_8pipeline_17_parser_internals_3ner_Missing; + PyObject *__pyx_type_5spacy_8pipeline_17_parser_internals_3ner_Begin; + PyObject *__pyx_type_5spacy_8pipeline_17_parser_internals_3ner_In; + PyObject *__pyx_type_5spacy_8pipeline_17_parser_internals_3ner_Last; + PyObject *__pyx_type_5spacy_8pipeline_17_parser_internals_3ner_Unit; + PyObject *__pyx_type_5spacy_8pipeline_17_parser_internals_3ner_Out; + PyObject *__pyx_type___pyx_array; + PyObject *__pyx_type___pyx_MemviewEnum; + PyObject *__pyx_type___pyx_memoryview; + PyObject *__pyx_type___pyx_memoryviewslice; + PyTypeObject *__pyx_ptype_5spacy_8pipeline_17_parser_internals_3ner_BiluoPushDown; + PyTypeObject *__pyx_ptype_5spacy_8pipeline_17_parser_internals_3ner_BiluoGold; + PyTypeObject *__pyx_ptype_5spacy_8pipeline_17_parser_internals_3ner_Missing; + PyTypeObject *__pyx_ptype_5spacy_8pipeline_17_parser_internals_3ner_Begin; + PyTypeObject *__pyx_ptype_5spacy_8pipeline_17_parser_internals_3ner_In; + PyTypeObject *__pyx_ptype_5spacy_8pipeline_17_parser_internals_3ner_Last; + PyTypeObject *__pyx_ptype_5spacy_8pipeline_17_parser_internals_3ner_Unit; + PyTypeObject *__pyx_ptype_5spacy_8pipeline_17_parser_internals_3ner_Out; + PyTypeObject *__pyx_array_type; + PyTypeObject *__pyx_MemviewEnum_type; + PyTypeObject *__pyx_memoryview_type; + PyTypeObject *__pyx_memoryviewslice_type; + __Pyx_CachedCFunction __pyx_umethod_PyDict_Type_get; + __Pyx_CachedCFunction __pyx_umethod_PyDict_Type_items; + __Pyx_CachedCFunction __pyx_umethod_PyDict_Type_pop; + __Pyx_CachedCFunction __pyx_umethod_PyDict_Type_values; + PyObject *__pyx_slice[1]; + PyObject *__pyx_tuple[5]; + PyObject *__pyx_codeobj_tab[33]; + PyObject *__pyx_string_tab[307]; + PyObject *__pyx_number_tab[6]; +/* #### 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_All_dimensions_preceding_dimensi __pyx_string_tab[1] +#define __pyx_kp_u_Buffer_view_does_not_expose_stri __pyx_string_tab[2] +#define __pyx_kp_u_Can_only_create_a_buffer_that_is __pyx_string_tab[3] +#define __pyx_kp_u_Cannot_assign_to_read_only_memor __pyx_string_tab[4] +#define __pyx_kp_u_Cannot_create_writable_memory_vi __pyx_string_tab[5] +#define __pyx_kp_u_Cannot_index_with_type __pyx_string_tab[6] +#define __pyx_kp_u_Cannot_transpose_memoryview_with __pyx_string_tab[7] +#define __pyx_kp_u_Dimension_d_is_not_direct __pyx_string_tab[8] +#define __pyx_kp_u_Empty_shape_tuple_for_cython_arr __pyx_string_tab[9] +#define __pyx_kp_u_Index_out_of_bounds_axis_d __pyx_string_tab[10] +#define __pyx_kp_u_Indirect_dimensions_not_supporte __pyx_string_tab[11] +#define __pyx_kp_u_Invalid_mode_expected_c_or_fortr __pyx_string_tab[12] +#define __pyx_kp_u_Invalid_shape_in_axis __pyx_string_tab[13] +#define __pyx_kp_u_MemoryView_of __pyx_string_tab[14] +#define __pyx_kp_u_Note_that_Cython_is_deliberately __pyx_string_tab[15] +#define __pyx_kp_u_Out_of_bounds_on_buffer_access_a __pyx_string_tab[16] +#define __pyx_kp_u_Step_may_not_be_zero_axis_d __pyx_string_tab[17] +#define __pyx_kp_u_Unable_to_convert_item_to_object __pyx_string_tab[18] +#define __pyx_kp_u__2 __pyx_string_tab[19] +#define __pyx_kp_u__3 __pyx_string_tab[20] +#define __pyx_kp_u__4 __pyx_string_tab[21] +#define __pyx_kp_u__5 __pyx_string_tab[22] +#define __pyx_kp_u__6 __pyx_string_tab[23] +#define __pyx_kp_u__7 __pyx_string_tab[24] +#define __pyx_kp_u__8 __pyx_string_tab[25] +#define __pyx_kp_u__9 __pyx_string_tab[26] +#define __pyx_kp_u_add_note __pyx_string_tab[27] +#define __pyx_kp_u_and __pyx_string_tab[28] +#define __pyx_kp_u_at_0x __pyx_string_tab[29] +#define __pyx_kp_u_collections_abc __pyx_string_tab[30] +#define __pyx_kp_u_contiguous_and_direct __pyx_string_tab[31] +#define __pyx_kp_u_contiguous_and_indirect __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_gc __pyx_string_tab[35] +#define __pyx_kp_u_got __pyx_string_tab[36] +#define __pyx_kp_u_got_differing_extents_in_dimensi __pyx_string_tab[37] +#define __pyx_kp_u_isenabled __pyx_string_tab[38] +#define __pyx_kp_u_itemsize_0_for_cython_array __pyx_string_tab[39] +#define __pyx_kp_u_no_default___reduce___due_to_non __pyx_string_tab[40] +#define __pyx_kp_u_numpy__core_multiarray_failed_to __pyx_string_tab[41] +#define __pyx_kp_u_numpy__core_umath_failed_to_impo __pyx_string_tab[42] +#define __pyx_kp_u_object __pyx_string_tab[43] +#define __pyx_kp_u_self_c_cannot_be_converted_to_a __pyx_string_tab[44] +#define __pyx_kp_u_self_c_self_del_beam_state_self __pyx_string_tab[45] +#define __pyx_kp_u_self_name_is_not_None __pyx_string_tab[46] +#define __pyx_kp_u_spacy_errors __pyx_string_tab[47] +#define __pyx_kp_u_spacy_pipeline__parser_internals __pyx_string_tab[48] +#define __pyx_kp_u_spacy_pipeline__parser_internals_3 __pyx_string_tab[49] +#define __pyx_kp_u_spacy_tokens_span __pyx_string_tab[50] +#define __pyx_kp_u_spacy_training __pyx_string_tab[51] +#define __pyx_kp_u_strided_and_direct __pyx_string_tab[52] +#define __pyx_kp_u_strided_and_direct_or_indirect __pyx_string_tab[53] +#define __pyx_kp_u_strided_and_indirect __pyx_string_tab[54] +#define __pyx_kp_u_stringsource __pyx_string_tab[55] +#define __pyx_kp_u_unable_to_allocate_array_data __pyx_string_tab[56] +#define __pyx_kp_u_unable_to_allocate_shape_and_str __pyx_string_tab[57] +#define __pyx_n_u_ASCII __pyx_string_tab[58] +#define __pyx_n_u_B __pyx_string_tab[59] +#define __pyx_n_u_Begin __pyx_string_tab[60] +#define __pyx_n_u_Begin___reduce_cython __pyx_string_tab[61] +#define __pyx_n_u_Begin___setstate_cython __pyx_string_tab[62] +#define __pyx_n_u_BiluoGold __pyx_string_tab[63] +#define __pyx_n_u_BiluoGold___reduce_cython __pyx_string_tab[64] +#define __pyx_n_u_BiluoGold___setstate_cython __pyx_string_tab[65] +#define __pyx_n_u_BiluoGold_update __pyx_string_tab[66] +#define __pyx_n_u_BiluoPushDown __pyx_string_tab[67] +#define __pyx_n_u_BiluoPushDown___reduce_cython __pyx_string_tab[68] +#define __pyx_n_u_BiluoPushDown___setstate_cython __pyx_string_tab[69] +#define __pyx_n_u_BiluoPushDown_add_action __pyx_string_tab[70] +#define __pyx_n_u_BiluoPushDown_get_actions __pyx_string_tab[71] +#define __pyx_n_u_BiluoPushDown_get_beam_parses __pyx_string_tab[72] +#define __pyx_n_u_BiluoPushDown_get_cost __pyx_string_tab[73] +#define __pyx_n_u_BiluoPushDown_get_doc_labels __pyx_string_tab[74] +#define __pyx_n_u_BiluoPushDown_has_gold __pyx_string_tab[75] +#define __pyx_n_u_BiluoPushDown_init_gold __pyx_string_tab[76] +#define __pyx_n_u_BiluoPushDown_init_gold_batch __pyx_string_tab[77] +#define __pyx_n_u_BiluoPushDown_move_name __pyx_string_tab[78] +#define __pyx_n_u_BiluoPushDown_set_annotations __pyx_string_tab[79] +#define __pyx_n_u_Counter __pyx_string_tab[80] +#define __pyx_n_u_E019 __pyx_string_tab[81] +#define __pyx_n_u_E022 __pyx_string_tab[82] +#define __pyx_n_u_E868 __pyx_string_tab[83] +#define __pyx_n_u_E869 __pyx_string_tab[84] +#define __pyx_n_u_E909 __pyx_string_tab[85] +#define __pyx_n_u_Ellipsis __pyx_string_tab[86] +#define __pyx_n_u_Errors __pyx_string_tab[87] +#define __pyx_n_u_False __pyx_string_tab[88] +#define __pyx_n_u_I __pyx_string_tab[89] +#define __pyx_n_u_In __pyx_string_tab[90] +#define __pyx_n_u_In___reduce_cython __pyx_string_tab[91] +#define __pyx_n_u_In___setstate_cython __pyx_string_tab[92] +#define __pyx_n_u_L __pyx_string_tab[93] +#define __pyx_n_u_Last __pyx_string_tab[94] +#define __pyx_n_u_Last___reduce_cython __pyx_string_tab[95] +#define __pyx_n_u_Last___setstate_cython __pyx_string_tab[96] +#define __pyx_n_u_M __pyx_string_tab[97] +#define __pyx_n_u_MOVE_NAMES __pyx_string_tab[98] +#define __pyx_n_u_Missing __pyx_string_tab[99] +#define __pyx_n_u_Missing___reduce_cython __pyx_string_tab[100] +#define __pyx_n_u_Missing___setstate_cython __pyx_string_tab[101] +#define __pyx_n_u_O __pyx_string_tab[102] +#define __pyx_n_u_Out __pyx_string_tab[103] +#define __pyx_n_u_Out___reduce_cython __pyx_string_tab[104] +#define __pyx_n_u_Out___setstate_cython __pyx_string_tab[105] +#define __pyx_n_u_Pyx_PyDict_NextRef __pyx_string_tab[106] +#define __pyx_n_u_Sequence __pyx_string_tab[107] +#define __pyx_n_u_Span __pyx_string_tab[108] +#define __pyx_n_u_U __pyx_string_tab[109] +#define __pyx_n_u_Unit __pyx_string_tab[110] +#define __pyx_n_u_Unit___reduce_cython __pyx_string_tab[111] +#define __pyx_n_u_Unit___setstate_cython __pyx_string_tab[112] +#define __pyx_n_u_View_MemoryView __pyx_string_tab[113] +#define __pyx_n_u_abc __pyx_string_tab[114] +#define __pyx_n_u_action __pyx_string_tab[115] +#define __pyx_n_u_actions __pyx_string_tab[116] +#define __pyx_n_u_add __pyx_string_tab[117] +#define __pyx_n_u_add_action __pyx_string_tab[118] +#define __pyx_n_u_all_states __pyx_string_tab[119] +#define __pyx_n_u_allocate_buffer __pyx_string_tab[120] +#define __pyx_n_u_allow_overlap __pyx_string_tab[121] +#define __pyx_n_u_asyncio_coroutines __pyx_string_tab[122] +#define __pyx_n_u_base __pyx_string_tab[123] +#define __pyx_n_u_beam __pyx_string_tab[124] +#define __pyx_n_u_c __pyx_string_tab[125] +#define __pyx_n_u_clas __pyx_string_tab[126] +#define __pyx_n_u_class __pyx_string_tab[127] +#define __pyx_n_u_class_getitem __pyx_string_tab[128] +#define __pyx_n_u_cline_in_traceback __pyx_string_tab[129] +#define __pyx_n_u_cls __pyx_string_tab[130] +#define __pyx_n_u_collections __pyx_string_tab[131] +#define __pyx_n_u_cost __pyx_string_tab[132] +#define __pyx_n_u_count __pyx_string_tab[133] +#define __pyx_n_u_default __pyx_string_tab[134] +#define __pyx_n_u_dict __pyx_string_tab[135] +#define __pyx_n_u_dict_2 __pyx_string_tab[136] +#define __pyx_n_u_doc __pyx_string_tab[137] +#define __pyx_n_u_dtype_is_object __pyx_string_tab[138] +#define __pyx_n_u_eg __pyx_string_tab[139] +#define __pyx_n_u_encode __pyx_string_tab[140] +#define __pyx_n_u_end __pyx_string_tab[141] +#define __pyx_n_u_end_char __pyx_string_tab[142] +#define __pyx_n_u_ent __pyx_string_tab[143] +#define __pyx_n_u_ent_iob __pyx_string_tab[144] +#define __pyx_n_u_ent_type __pyx_string_tab[145] +#define __pyx_n_u_ent_type_2 __pyx_string_tab[146] +#define __pyx_n_u_entity_type __pyx_string_tab[147] +#define __pyx_n_u_entity_types __pyx_string_tab[148] +#define __pyx_n_u_ents __pyx_string_tab[149] +#define __pyx_n_u_enumerate __pyx_string_tab[150] +#define __pyx_n_u_error __pyx_string_tab[151] +#define __pyx_n_u_errors __pyx_string_tab[152] +#define __pyx_n_u_example __pyx_string_tab[153] +#define __pyx_n_u_examples __pyx_string_tab[154] +#define __pyx_n_u_flags __pyx_string_tab[155] +#define __pyx_n_u_format __pyx_string_tab[156] +#define __pyx_n_u_fortran __pyx_string_tab[157] +#define __pyx_n_u_freq __pyx_string_tab[158] +#define __pyx_n_u_func __pyx_string_tab[159] +#define __pyx_n_u_get __pyx_string_tab[160] +#define __pyx_n_u_get_actions __pyx_string_tab[161] +#define __pyx_n_u_get_aligned_ents_and_ner __pyx_string_tab[162] +#define __pyx_n_u_get_aligned_spans_x2y __pyx_string_tab[163] +#define __pyx_n_u_get_aligned_spans_y2x __pyx_string_tab[164] +#define __pyx_n_u_get_beam_parses __pyx_string_tab[165] +#define __pyx_n_u_get_cost __pyx_string_tab[166] +#define __pyx_n_u_get_doc_labels __pyx_string_tab[167] +#define __pyx_n_u_getstate __pyx_string_tab[168] +#define __pyx_n_u_gold __pyx_string_tab[169] +#define __pyx_n_u_gold_2 __pyx_string_tab[170] +#define __pyx_n_u_gold_state __pyx_string_tab[171] +#define __pyx_n_u_golds __pyx_string_tab[172] +#define __pyx_n_u_has_gold __pyx_string_tab[173] +#define __pyx_n_u_i __pyx_string_tab[174] +#define __pyx_n_u_id __pyx_string_tab[175] +#define __pyx_n_u_import __pyx_string_tab[176] +#define __pyx_n_u_index __pyx_string_tab[177] +#define __pyx_n_u_init __pyx_string_tab[178] +#define __pyx_n_u_init_batch __pyx_string_tab[179] +#define __pyx_n_u_init_gold __pyx_string_tab[180] +#define __pyx_n_u_init_gold_batch __pyx_string_tab[181] +#define __pyx_n_u_is_coroutine __pyx_string_tab[182] +#define __pyx_n_u_is_final __pyx_string_tab[183] +#define __pyx_n_u_items __pyx_string_tab[184] +#define __pyx_n_u_itemsize __pyx_string_tab[185] +#define __pyx_n_u_j __pyx_string_tab[186] +#define __pyx_n_u_kb_id __pyx_string_tab[187] +#define __pyx_n_u_kwargs __pyx_string_tab[188] +#define __pyx_n_u_label __pyx_string_tab[189] +#define __pyx_n_u_label_2 __pyx_string_tab[190] +#define __pyx_n_u_label_id __pyx_string_tab[191] +#define __pyx_n_u_label_name __pyx_string_tab[192] +#define __pyx_n_u_labels __pyx_string_tab[193] +#define __pyx_n_u_main __pyx_string_tab[194] +#define __pyx_n_u_memview __pyx_string_tab[195] +#define __pyx_n_u_min __pyx_string_tab[196] +#define __pyx_n_u_mode __pyx_string_tab[197] +#define __pyx_n_u_module __pyx_string_tab[198] +#define __pyx_n_u_move __pyx_string_tab[199] +#define __pyx_n_u_move_name __pyx_string_tab[200] +#define __pyx_n_u_moves __pyx_string_tab[201] +#define __pyx_n_u_n_steps __pyx_string_tab[202] +#define __pyx_n_u_name __pyx_string_tab[203] +#define __pyx_n_u_name_2 __pyx_string_tab[204] +#define __pyx_n_u_ndim __pyx_string_tab[205] +#define __pyx_n_u_neg_key __pyx_string_tab[206] +#define __pyx_n_u_ner __pyx_string_tab[207] +#define __pyx_n_u_new __pyx_string_tab[208] +#define __pyx_n_u_obj __pyx_string_tab[209] +#define __pyx_n_u_pack __pyx_string_tab[210] +#define __pyx_n_u_parse __pyx_string_tab[211] +#define __pyx_n_u_parses __pyx_string_tab[212] +#define __pyx_n_u_pop __pyx_string_tab[213] +#define __pyx_n_u_predicted __pyx_string_tab[214] +#define __pyx_n_u_prob __pyx_string_tab[215] +#define __pyx_n_u_probs __pyx_string_tab[216] +#define __pyx_n_u_pyx_checksum __pyx_string_tab[217] +#define __pyx_n_u_pyx_result __pyx_string_tab[218] +#define __pyx_n_u_pyx_state __pyx_string_tab[219] +#define __pyx_n_u_pyx_type __pyx_string_tab[220] +#define __pyx_n_u_pyx_unpickle_Begin __pyx_string_tab[221] +#define __pyx_n_u_pyx_unpickle_Enum __pyx_string_tab[222] +#define __pyx_n_u_pyx_unpickle_In __pyx_string_tab[223] +#define __pyx_n_u_pyx_unpickle_Last __pyx_string_tab[224] +#define __pyx_n_u_pyx_unpickle_Missing __pyx_string_tab[225] +#define __pyx_n_u_pyx_unpickle_Out __pyx_string_tab[226] +#define __pyx_n_u_pyx_unpickle_Unit __pyx_string_tab[227] +#define __pyx_n_u_pyx_vtable __pyx_string_tab[228] +#define __pyx_n_u_qualname __pyx_string_tab[229] +#define __pyx_n_u_queue __pyx_string_tab[230] +#define __pyx_n_u_reduce __pyx_string_tab[231] +#define __pyx_n_u_reduce_cython __pyx_string_tab[232] +#define __pyx_n_u_reduce_ex __pyx_string_tab[233] +#define __pyx_n_u_register __pyx_string_tab[234] +#define __pyx_n_u_s __pyx_string_tab[235] +#define __pyx_n_u_score __pyx_string_tab[236] +#define __pyx_n_u_self __pyx_string_tab[237] +#define __pyx_n_u_set_annotations __pyx_string_tab[238] +#define __pyx_n_u_set_ents __pyx_string_tab[239] +#define __pyx_n_u_set_name __pyx_string_tab[240] +#define __pyx_n_u_setdefault __pyx_string_tab[241] +#define __pyx_n_u_setstate __pyx_string_tab[242] +#define __pyx_n_u_setstate_cython __pyx_string_tab[243] +#define __pyx_n_u_shape __pyx_string_tab[244] +#define __pyx_n_u_size __pyx_string_tab[245] +#define __pyx_n_u_spacy_pipeline__parser_internals_2 __pyx_string_tab[246] +#define __pyx_n_u_span __pyx_string_tab[247] +#define __pyx_n_u_split_bilu_label __pyx_string_tab[248] +#define __pyx_n_u_src __pyx_string_tab[249] +#define __pyx_n_u_start __pyx_string_tab[250] +#define __pyx_n_u_start_char __pyx_string_tab[251] +#define __pyx_n_u_startswith __pyx_string_tab[252] +#define __pyx_n_u_state __pyx_string_tab[253] +#define __pyx_n_u_states __pyx_string_tab[254] +#define __pyx_n_u_stcls __pyx_string_tab[255] +#define __pyx_n_u_step __pyx_string_tab[256] +#define __pyx_n_u_stop __pyx_string_tab[257] +#define __pyx_n_u_struct __pyx_string_tab[258] +#define __pyx_n_u_sum __pyx_string_tab[259] +#define __pyx_n_u_test __pyx_string_tab[260] +#define __pyx_n_u_token __pyx_string_tab[261] +#define __pyx_n_u_tokens_span __pyx_string_tab[262] +#define __pyx_n_u_training __pyx_string_tab[263] +#define __pyx_n_u_trans __pyx_string_tab[264] +#define __pyx_n_u_unmodified __pyx_string_tab[265] +#define __pyx_n_u_unpack __pyx_string_tab[266] +#define __pyx_n_u_update __pyx_string_tab[267] +#define __pyx_n_u_use_setstate __pyx_string_tab[268] +#define __pyx_n_u_values __pyx_string_tab[269] +#define __pyx_n_u_word __pyx_string_tab[270] +#define __pyx_n_u_x __pyx_string_tab[271] +#define __pyx_n_u_y __pyx_string_tab[272] +#define __pyx_n_u_y_span __pyx_string_tab[273] +#define __pyx_n_u_y_spans __pyx_string_tab[274] +#define __pyx_n_u_zip __pyx_string_tab[275] +#define __pyx_kp_b_iso88591_1Bb_q_4q_ar_1_a_fA_a_87_F_ay_4w __pyx_string_tab[276] +#define __pyx_kp_b_iso88591_1F __pyx_string_tab[277] +#define __pyx_kp_b_iso88591_6 __pyx_string_tab[278] +#define __pyx_kp_b_iso88591_6a_4z_a_t84q_q_7_T_Yc_1_7_Q_1_I __pyx_string_tab[279] +#define __pyx_kp_b_iso88591_A_4t5 __pyx_string_tab[280] +#define __pyx_kp_b_iso88591_A_4z_1F_wauA_q_U_4r_IQe4t2Qb_4r __pyx_string_tab[281] +#define __pyx_kp_b_iso88591_A_5_1_1_Q_1_QfBd_D __pyx_string_tab[282] +#define __pyx_kp_b_iso88591_A_A_E_at1_IT_AQ_uIQ_uAQ_E_auF_q __pyx_string_tab[283] +#define __pyx_kp_b_iso88591_A_A_IQ_uA_d_5_q __pyx_string_tab[284] +#define __pyx_kp_b_iso88591_A_G1F_a_vWE_Q_q_q_4q_4q __pyx_string_tab[285] +#define __pyx_kp_b_iso88591_A_G1F_a_vWE_Q_q_q_AWKwa_AWKq __pyx_string_tab[286] +#define __pyx_kp_b_iso88591_A_G1F_a_vWE_Q_q_q_D_7_D_1 __pyx_string_tab[287] +#define __pyx_kp_b_iso88591_A_G1F_a_vWE_Q_q_q_T_G1_T_A __pyx_string_tab[288] +#define __pyx_kp_b_iso88591_A_G1F_a_vWE_Q_q_q_d_7_WA_d_7_Q __pyx_string_tab[289] +#define __pyx_kp_b_iso88591_A_T_AQb_4vQ_G6_A_t9AT_T_iq_WAT_1 __pyx_string_tab[290] +#define __pyx_kp_b_iso88591_A_WA_7_q_q_AV1_q_QfA_O6_Q_6a_7_f __pyx_string_tab[291] +#define __pyx_kp_b_iso88591_A_q_E_auBfE_r_s_1_s_Rt3e4q_G1D_c __pyx_string_tab[292] +#define __pyx_kp_b_iso88591_A_y_wit1 __pyx_string_tab[293] +#define __pyx_kp_b_iso88591_Q __pyx_string_tab[294] +#define __pyx_kp_b_iso88591_QfA __pyx_string_tab[295] +#define __pyx_kp_b_iso88591__10 __pyx_string_tab[296] +#define __pyx_kp_b_iso88591_q __pyx_string_tab[297] +#define __pyx_kp_b_iso88591_q_0_kQR_2XQa_7_AU_1 __pyx_string_tab[298] +#define __pyx_kp_b_iso88591_q_0_kQR_3haq_7_QfN_1 __pyx_string_tab[299] +#define __pyx_kp_b_iso88591_q_0_kQR_4xq_7_awnA_1 __pyx_string_tab[300] +#define __pyx_kp_b_iso88591_q_0_kQR_5_7_q_a_1 __pyx_string_tab[301] +#define __pyx_kp_b_iso88591_q_0_kQR_7_1_7_N_1 __pyx_string_tab[302] +#define __pyx_kp_b_pyx_t_5spacy_8typedefs_attr_t __pyx_string_tab[303] +#define __pyx_kp_b_struct___pyx_t_5spacy_7structs_L __pyx_string_tab[304] +#define __pyx_kp_b_uint64_t_void_int_uint64_t_hash6 __pyx_string_tab[305] +#define __pyx_n_b_O __pyx_string_tab[306] +#define __pyx_int_0 __pyx_number_tab[0] +#define __pyx_int_neg_1 __pyx_number_tab[1] +#define __pyx_int_1 __pyx_number_tab[2] +#define __pyx_int_9000 __pyx_number_tab[3] +#define __pyx_int_136983863 __pyx_number_tab[4] +#define __pyx_int_238750788 __pyx_number_tab[5] +/* #### 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_5cymem_5cymem_PyMalloc); + Py_CLEAR(clear_module_state->__pyx_ptype_5cymem_5cymem_PyFree); + Py_CLEAR(clear_module_state->__pyx_ptype_5cymem_5cymem_Pool); + Py_CLEAR(clear_module_state->__pyx_ptype_5cymem_5cymem_Address); + Py_CLEAR(clear_module_state->__pyx_ptype_7preshed_4maps_PreshMap); + Py_CLEAR(clear_module_state->__pyx_ptype_7preshed_4maps_PreshMapArray); + Py_CLEAR(clear_module_state->__pyx_ptype_5spacy_7strings_StringStore); + Py_CLEAR(clear_module_state->__pyx_ptype_7cpython_4type_type); + Py_CLEAR(clear_module_state->__pyx_ptype_5numpy_dtype); + Py_CLEAR(clear_module_state->__pyx_ptype_5numpy_flatiter); + Py_CLEAR(clear_module_state->__pyx_ptype_5numpy_broadcast); + Py_CLEAR(clear_module_state->__pyx_ptype_5numpy_ndarray); + Py_CLEAR(clear_module_state->__pyx_ptype_5numpy_generic); + Py_CLEAR(clear_module_state->__pyx_ptype_5numpy_number); + Py_CLEAR(clear_module_state->__pyx_ptype_5numpy_integer); + Py_CLEAR(clear_module_state->__pyx_ptype_5numpy_signedinteger); + Py_CLEAR(clear_module_state->__pyx_ptype_5numpy_unsignedinteger); + Py_CLEAR(clear_module_state->__pyx_ptype_5numpy_inexact); + Py_CLEAR(clear_module_state->__pyx_ptype_5numpy_floating); + Py_CLEAR(clear_module_state->__pyx_ptype_5numpy_complexfloating); + Py_CLEAR(clear_module_state->__pyx_ptype_5numpy_flexible); + Py_CLEAR(clear_module_state->__pyx_ptype_5numpy_character); + Py_CLEAR(clear_module_state->__pyx_ptype_5numpy_ufunc); + Py_CLEAR(clear_module_state->__pyx_ptype_5spacy_10morphology_Morphology); + Py_CLEAR(clear_module_state->__pyx_ptype_5spacy_5vocab_Vocab); + Py_CLEAR(clear_module_state->__pyx_ptype_5spacy_6tokens_3doc_Doc); + Py_CLEAR(clear_module_state->__pyx_ptype_5spacy_8training_7example_Example); + Py_CLEAR(clear_module_state->__pyx_ptype_5spacy_6lexeme_Lexeme); + Py_CLEAR(clear_module_state->__pyx_ptype_5spacy_8pipeline_17_parser_internals_10stateclass_StateClass); + Py_CLEAR(clear_module_state->__pyx_ptype_5spacy_8pipeline_17_parser_internals_17transition_system_TransitionSystem); + Py_CLEAR(clear_module_state->__pyx_ptype_5thinc_5extra_6search_Beam); + Py_CLEAR(clear_module_state->__pyx_ptype_5thinc_5extra_6search_MaxViolation); + Py_CLEAR(clear_module_state->__pyx_ptype_5spacy_6tokens_4span_Span); + Py_CLEAR(clear_module_state->__pyx_ptype_5spacy_8pipeline_17_parser_internals_3ner_BiluoPushDown); + Py_CLEAR(clear_module_state->__pyx_type_5spacy_8pipeline_17_parser_internals_3ner_BiluoPushDown); + Py_CLEAR(clear_module_state->__pyx_ptype_5spacy_8pipeline_17_parser_internals_3ner_BiluoGold); + Py_CLEAR(clear_module_state->__pyx_type_5spacy_8pipeline_17_parser_internals_3ner_BiluoGold); + Py_CLEAR(clear_module_state->__pyx_ptype_5spacy_8pipeline_17_parser_internals_3ner_Missing); + Py_CLEAR(clear_module_state->__pyx_type_5spacy_8pipeline_17_parser_internals_3ner_Missing); + Py_CLEAR(clear_module_state->__pyx_ptype_5spacy_8pipeline_17_parser_internals_3ner_Begin); + Py_CLEAR(clear_module_state->__pyx_type_5spacy_8pipeline_17_parser_internals_3ner_Begin); + Py_CLEAR(clear_module_state->__pyx_ptype_5spacy_8pipeline_17_parser_internals_3ner_In); + Py_CLEAR(clear_module_state->__pyx_type_5spacy_8pipeline_17_parser_internals_3ner_In); + Py_CLEAR(clear_module_state->__pyx_ptype_5spacy_8pipeline_17_parser_internals_3ner_Last); + Py_CLEAR(clear_module_state->__pyx_type_5spacy_8pipeline_17_parser_internals_3ner_Last); + Py_CLEAR(clear_module_state->__pyx_ptype_5spacy_8pipeline_17_parser_internals_3ner_Unit); + Py_CLEAR(clear_module_state->__pyx_type_5spacy_8pipeline_17_parser_internals_3ner_Unit); + Py_CLEAR(clear_module_state->__pyx_ptype_5spacy_8pipeline_17_parser_internals_3ner_Out); + Py_CLEAR(clear_module_state->__pyx_type_5spacy_8pipeline_17_parser_internals_3ner_Out); + Py_CLEAR(clear_module_state->__pyx_array_type); + Py_CLEAR(clear_module_state->__pyx_type___pyx_array); + Py_CLEAR(clear_module_state->__pyx_MemviewEnum_type); + Py_CLEAR(clear_module_state->__pyx_type___pyx_MemviewEnum); + Py_CLEAR(clear_module_state->__pyx_memoryview_type); + Py_CLEAR(clear_module_state->__pyx_type___pyx_memoryview); + Py_CLEAR(clear_module_state->__pyx_memoryviewslice_type); + Py_CLEAR(clear_module_state->__pyx_type___pyx_memoryviewslice); + for (int i=0; i<1; ++i) { Py_CLEAR(clear_module_state->__pyx_slice[i]); } + for (int i=0; i<5; ++i) { Py_CLEAR(clear_module_state->__pyx_tuple[i]); } + for (int i=0; i<33; ++i) { Py_CLEAR(clear_module_state->__pyx_codeobj_tab[i]); } + for (int i=0; i<307; ++i) { Py_CLEAR(clear_module_state->__pyx_string_tab[i]); } + for (int i=0; i<6; ++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_5cymem_5cymem_PyMalloc); + Py_VISIT(traverse_module_state->__pyx_ptype_5cymem_5cymem_PyFree); + Py_VISIT(traverse_module_state->__pyx_ptype_5cymem_5cymem_Pool); + Py_VISIT(traverse_module_state->__pyx_ptype_5cymem_5cymem_Address); + Py_VISIT(traverse_module_state->__pyx_ptype_7preshed_4maps_PreshMap); + Py_VISIT(traverse_module_state->__pyx_ptype_7preshed_4maps_PreshMapArray); + Py_VISIT(traverse_module_state->__pyx_ptype_5spacy_7strings_StringStore); + Py_VISIT(traverse_module_state->__pyx_ptype_7cpython_4type_type); + Py_VISIT(traverse_module_state->__pyx_ptype_5numpy_dtype); + Py_VISIT(traverse_module_state->__pyx_ptype_5numpy_flatiter); + Py_VISIT(traverse_module_state->__pyx_ptype_5numpy_broadcast); + Py_VISIT(traverse_module_state->__pyx_ptype_5numpy_ndarray); + Py_VISIT(traverse_module_state->__pyx_ptype_5numpy_generic); + Py_VISIT(traverse_module_state->__pyx_ptype_5numpy_number); + Py_VISIT(traverse_module_state->__pyx_ptype_5numpy_integer); + Py_VISIT(traverse_module_state->__pyx_ptype_5numpy_signedinteger); + Py_VISIT(traverse_module_state->__pyx_ptype_5numpy_unsignedinteger); + Py_VISIT(traverse_module_state->__pyx_ptype_5numpy_inexact); + Py_VISIT(traverse_module_state->__pyx_ptype_5numpy_floating); + Py_VISIT(traverse_module_state->__pyx_ptype_5numpy_complexfloating); + Py_VISIT(traverse_module_state->__pyx_ptype_5numpy_flexible); + Py_VISIT(traverse_module_state->__pyx_ptype_5numpy_character); + Py_VISIT(traverse_module_state->__pyx_ptype_5numpy_ufunc); + Py_VISIT(traverse_module_state->__pyx_ptype_5spacy_10morphology_Morphology); + Py_VISIT(traverse_module_state->__pyx_ptype_5spacy_5vocab_Vocab); + Py_VISIT(traverse_module_state->__pyx_ptype_5spacy_6tokens_3doc_Doc); + Py_VISIT(traverse_module_state->__pyx_ptype_5spacy_8training_7example_Example); + Py_VISIT(traverse_module_state->__pyx_ptype_5spacy_6lexeme_Lexeme); + Py_VISIT(traverse_module_state->__pyx_ptype_5spacy_8pipeline_17_parser_internals_10stateclass_StateClass); + Py_VISIT(traverse_module_state->__pyx_ptype_5spacy_8pipeline_17_parser_internals_17transition_system_TransitionSystem); + Py_VISIT(traverse_module_state->__pyx_ptype_5thinc_5extra_6search_Beam); + Py_VISIT(traverse_module_state->__pyx_ptype_5thinc_5extra_6search_MaxViolation); + Py_VISIT(traverse_module_state->__pyx_ptype_5spacy_6tokens_4span_Span); + Py_VISIT(traverse_module_state->__pyx_ptype_5spacy_8pipeline_17_parser_internals_3ner_BiluoPushDown); + Py_VISIT(traverse_module_state->__pyx_type_5spacy_8pipeline_17_parser_internals_3ner_BiluoPushDown); + Py_VISIT(traverse_module_state->__pyx_ptype_5spacy_8pipeline_17_parser_internals_3ner_BiluoGold); + Py_VISIT(traverse_module_state->__pyx_type_5spacy_8pipeline_17_parser_internals_3ner_BiluoGold); + Py_VISIT(traverse_module_state->__pyx_ptype_5spacy_8pipeline_17_parser_internals_3ner_Missing); + Py_VISIT(traverse_module_state->__pyx_type_5spacy_8pipeline_17_parser_internals_3ner_Missing); + Py_VISIT(traverse_module_state->__pyx_ptype_5spacy_8pipeline_17_parser_internals_3ner_Begin); + Py_VISIT(traverse_module_state->__pyx_type_5spacy_8pipeline_17_parser_internals_3ner_Begin); + Py_VISIT(traverse_module_state->__pyx_ptype_5spacy_8pipeline_17_parser_internals_3ner_In); + Py_VISIT(traverse_module_state->__pyx_type_5spacy_8pipeline_17_parser_internals_3ner_In); + Py_VISIT(traverse_module_state->__pyx_ptype_5spacy_8pipeline_17_parser_internals_3ner_Last); + Py_VISIT(traverse_module_state->__pyx_type_5spacy_8pipeline_17_parser_internals_3ner_Last); + Py_VISIT(traverse_module_state->__pyx_ptype_5spacy_8pipeline_17_parser_internals_3ner_Unit); + Py_VISIT(traverse_module_state->__pyx_type_5spacy_8pipeline_17_parser_internals_3ner_Unit); + Py_VISIT(traverse_module_state->__pyx_ptype_5spacy_8pipeline_17_parser_internals_3ner_Out); + Py_VISIT(traverse_module_state->__pyx_type_5spacy_8pipeline_17_parser_internals_3ner_Out); + Py_VISIT(traverse_module_state->__pyx_array_type); + Py_VISIT(traverse_module_state->__pyx_type___pyx_array); + Py_VISIT(traverse_module_state->__pyx_MemviewEnum_type); + Py_VISIT(traverse_module_state->__pyx_type___pyx_MemviewEnum); + Py_VISIT(traverse_module_state->__pyx_memoryview_type); + Py_VISIT(traverse_module_state->__pyx_type___pyx_memoryview); + Py_VISIT(traverse_module_state->__pyx_memoryviewslice_type); + Py_VISIT(traverse_module_state->__pyx_type___pyx_memoryviewslice); + for (int i=0; i<1; ++i) { __Pyx_VISIT_CONST(traverse_module_state->__pyx_slice[i]); } + for (int i=0; i<5; ++i) { __Pyx_VISIT_CONST(traverse_module_state->__pyx_tuple[i]); } + for (int i=0; i<33; ++i) { __Pyx_VISIT_CONST(traverse_module_state->__pyx_codeobj_tab[i]); } + for (int i=0; i<307; ++i) { __Pyx_VISIT_CONST(traverse_module_state->__pyx_string_tab[i]); } + for (int i=0; i<6; ++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 ### */ + +/* "View.MemoryView":129 + * cdef bint dtype_is_object + * + * def __cinit__(array self, tuple shape, Py_ssize_t itemsize, format not None, # <<<<<<<<<<<<<< + * mode="c", bint allocate_buffer=True): + * +*/ + +/* Python wrapper */ +static int __pyx_array___cinit__(PyObject *__pyx_v_self, PyObject *__pyx_args, PyObject *__pyx_kwds); /*proto*/ +static int __pyx_array___cinit__(PyObject *__pyx_v_self, PyObject *__pyx_args, PyObject *__pyx_kwds) { + PyObject *__pyx_v_shape = 0; + Py_ssize_t __pyx_v_itemsize; + PyObject *__pyx_v_format = 0; + PyObject *__pyx_v_mode = 0; + int __pyx_v_allocate_buffer; + CYTHON_UNUSED Py_ssize_t __pyx_nargs; + CYTHON_UNUSED PyObject *const *__pyx_kwvalues; + PyObject* values[5] = {0,0,0,0,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_shape,&__pyx_mstate_global->__pyx_n_u_itemsize,&__pyx_mstate_global->__pyx_n_u_format,&__pyx_mstate_global->__pyx_n_u_mode,&__pyx_mstate_global->__pyx_n_u_allocate_buffer,0}; + const Py_ssize_t __pyx_kwds_len = (__pyx_kwds) ? __Pyx_NumKwargs_VARARGS(__pyx_kwds) : 0; + if (unlikely(__pyx_kwds_len) < 0) __PYX_ERR(1, 129, __pyx_L3_error) + if (__pyx_kwds_len > 0) { + switch (__pyx_nargs) { + case 5: + values[4] = __Pyx_ArgRef_VARARGS(__pyx_args, 4); + if (!CYTHON_ASSUME_SAFE_MACROS && unlikely(!values[4])) __PYX_ERR(1, 129, __pyx_L3_error) + CYTHON_FALLTHROUGH; + case 4: + values[3] = __Pyx_ArgRef_VARARGS(__pyx_args, 3); + if (!CYTHON_ASSUME_SAFE_MACROS && unlikely(!values[3])) __PYX_ERR(1, 129, __pyx_L3_error) + CYTHON_FALLTHROUGH; + case 3: + values[2] = __Pyx_ArgRef_VARARGS(__pyx_args, 2); + if (!CYTHON_ASSUME_SAFE_MACROS && unlikely(!values[2])) __PYX_ERR(1, 129, __pyx_L3_error) + CYTHON_FALLTHROUGH; + case 2: + values[1] = __Pyx_ArgRef_VARARGS(__pyx_args, 1); + if (!CYTHON_ASSUME_SAFE_MACROS && unlikely(!values[1])) __PYX_ERR(1, 129, __pyx_L3_error) + CYTHON_FALLTHROUGH; + case 1: + values[0] = __Pyx_ArgRef_VARARGS(__pyx_args, 0); + if (!CYTHON_ASSUME_SAFE_MACROS && unlikely(!values[0])) __PYX_ERR(1, 129, __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(1, 129, __pyx_L3_error) + if (!values[3]) values[3] = __Pyx_NewRef(((PyObject *)__pyx_mstate_global->__pyx_n_u_c)); + for (Py_ssize_t i = __pyx_nargs; i < 3; i++) { + if (unlikely(!values[i])) { __Pyx_RaiseArgtupleInvalid("__cinit__", 0, 3, 5, i); __PYX_ERR(1, 129, __pyx_L3_error) } + } + } else { + switch (__pyx_nargs) { + case 5: + values[4] = __Pyx_ArgRef_VARARGS(__pyx_args, 4); + if (!CYTHON_ASSUME_SAFE_MACROS && unlikely(!values[4])) __PYX_ERR(1, 129, __pyx_L3_error) + CYTHON_FALLTHROUGH; + case 4: + values[3] = __Pyx_ArgRef_VARARGS(__pyx_args, 3); + if (!CYTHON_ASSUME_SAFE_MACROS && unlikely(!values[3])) __PYX_ERR(1, 129, __pyx_L3_error) + CYTHON_FALLTHROUGH; + case 3: + values[2] = __Pyx_ArgRef_VARARGS(__pyx_args, 2); + if (!CYTHON_ASSUME_SAFE_MACROS && unlikely(!values[2])) __PYX_ERR(1, 129, __pyx_L3_error) + values[1] = __Pyx_ArgRef_VARARGS(__pyx_args, 1); + if (!CYTHON_ASSUME_SAFE_MACROS && unlikely(!values[1])) __PYX_ERR(1, 129, __pyx_L3_error) + values[0] = __Pyx_ArgRef_VARARGS(__pyx_args, 0); + if (!CYTHON_ASSUME_SAFE_MACROS && unlikely(!values[0])) __PYX_ERR(1, 129, __pyx_L3_error) + break; + default: goto __pyx_L5_argtuple_error; + } + if (!values[3]) values[3] = __Pyx_NewRef(((PyObject *)__pyx_mstate_global->__pyx_n_u_c)); + } + __pyx_v_shape = ((PyObject*)values[0]); + __pyx_v_itemsize = __Pyx_PyIndex_AsSsize_t(values[1]); if (unlikely((__pyx_v_itemsize == (Py_ssize_t)-1) && PyErr_Occurred())) __PYX_ERR(1, 129, __pyx_L3_error) + __pyx_v_format = values[2]; + __pyx_v_mode = values[3]; + if (values[4]) { + __pyx_v_allocate_buffer = __Pyx_PyObject_IsTrue(values[4]); if (unlikely((__pyx_v_allocate_buffer == (int)-1) && PyErr_Occurred())) __PYX_ERR(1, 130, __pyx_L3_error) + } else { + + /* "View.MemoryView":130 + * + * def __cinit__(array self, tuple shape, Py_ssize_t itemsize, format not None, + * mode="c", bint allocate_buffer=True): # <<<<<<<<<<<<<< + * + * cdef int idx +*/ + __pyx_v_allocate_buffer = ((int)1); + } + } + goto __pyx_L6_skip; + __pyx_L5_argtuple_error:; + __Pyx_RaiseArgtupleInvalid("__cinit__", 0, 3, 5, __pyx_nargs); __PYX_ERR(1, 129, __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("View.MemoryView.array.__cinit__", __pyx_clineno, __pyx_lineno, __pyx_filename); + __Pyx_RefNannyFinishContext(); + return -1; + __pyx_L4_argument_unpacking_done:; + if (unlikely(!__Pyx_ArgTypeTest(((PyObject *)__pyx_v_shape), (&PyTuple_Type), 1, "shape", 1))) __PYX_ERR(1, 129, __pyx_L1_error) + if (unlikely(((PyObject *)__pyx_v_format) == Py_None)) { + PyErr_Format(PyExc_TypeError, "Argument '%.200s' must not be None", "format"); __PYX_ERR(1, 129, __pyx_L1_error) + } + __pyx_r = __pyx_array___pyx_pf_15View_dot_MemoryView_5array___cinit__(((struct __pyx_array_obj *)__pyx_v_self), __pyx_v_shape, __pyx_v_itemsize, __pyx_v_format, __pyx_v_mode, __pyx_v_allocate_buffer); + + /* "View.MemoryView":129 + * cdef bint dtype_is_object + * + * def __cinit__(array self, tuple shape, Py_ssize_t itemsize, format not None, # <<<<<<<<<<<<<< + * mode="c", bint allocate_buffer=True): + * +*/ + + /* 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_array___pyx_pf_15View_dot_MemoryView_5array___cinit__(struct __pyx_array_obj *__pyx_v_self, PyObject *__pyx_v_shape, Py_ssize_t __pyx_v_itemsize, PyObject *__pyx_v_format, PyObject *__pyx_v_mode, int __pyx_v_allocate_buffer) { + int __pyx_v_idx; + Py_ssize_t __pyx_v_dim; + char __pyx_v_order; + int __pyx_r; + __Pyx_RefNannyDeclarations + Py_ssize_t __pyx_t_1; + int __pyx_t_2; + int __pyx_t_3; + PyObject *__pyx_t_4 = NULL; + PyObject *__pyx_t_5 = NULL; + size_t __pyx_t_6; + char *__pyx_t_7; + int __pyx_t_8; + Py_ssize_t __pyx_t_9; + PyObject *__pyx_t_10 = NULL; + PyObject *__pyx_t_11[5]; + PyObject *__pyx_t_12 = NULL; + int __pyx_lineno = 0; + const char *__pyx_filename = NULL; + int __pyx_clineno = 0; + __Pyx_RefNannySetupContext("__cinit__", 0); + __Pyx_INCREF(__pyx_v_format); + + /* "View.MemoryView":135 + * cdef Py_ssize_t dim + * + * self.ndim = len(shape) # <<<<<<<<<<<<<< + * self.itemsize = itemsize + * +*/ + if (unlikely(__pyx_v_shape == Py_None)) { + PyErr_SetString(PyExc_TypeError, "object of type 'NoneType' has no len()"); + __PYX_ERR(1, 135, __pyx_L1_error) + } + __pyx_t_1 = __Pyx_PyTuple_GET_SIZE(__pyx_v_shape); if (unlikely(__pyx_t_1 == ((Py_ssize_t)-1))) __PYX_ERR(1, 135, __pyx_L1_error) + __pyx_v_self->ndim = ((int)__pyx_t_1); + + /* "View.MemoryView":136 + * + * self.ndim = len(shape) + * self.itemsize = itemsize # <<<<<<<<<<<<<< + * + * if not self.ndim: +*/ + __pyx_v_self->itemsize = __pyx_v_itemsize; + + /* "View.MemoryView":138 + * self.itemsize = itemsize + * + * if not self.ndim: # <<<<<<<<<<<<<< + * raise ValueError, "Empty shape tuple for cython.array" + * +*/ + __pyx_t_2 = (!(__pyx_v_self->ndim != 0)); + if (unlikely(__pyx_t_2)) { + + /* "View.MemoryView":139 + * + * if not self.ndim: + * raise ValueError, "Empty shape tuple for cython.array" # <<<<<<<<<<<<<< + * + * if itemsize <= 0: +*/ + __Pyx_Raise(((PyObject *)(((PyTypeObject*)PyExc_ValueError))), __pyx_mstate_global->__pyx_kp_u_Empty_shape_tuple_for_cython_arr, 0, 0); + __PYX_ERR(1, 139, __pyx_L1_error) + + /* "View.MemoryView":138 + * self.itemsize = itemsize + * + * if not self.ndim: # <<<<<<<<<<<<<< + * raise ValueError, "Empty shape tuple for cython.array" + * +*/ + } + + /* "View.MemoryView":141 + * raise ValueError, "Empty shape tuple for cython.array" + * + * if itemsize <= 0: # <<<<<<<<<<<<<< + * raise ValueError, "itemsize <= 0 for cython.array" + * +*/ + __pyx_t_2 = (__pyx_v_itemsize <= 0); + if (unlikely(__pyx_t_2)) { + + /* "View.MemoryView":142 + * + * if itemsize <= 0: + * raise ValueError, "itemsize <= 0 for cython.array" # <<<<<<<<<<<<<< + * + * if not isinstance(format, bytes): +*/ + __Pyx_Raise(((PyObject *)(((PyTypeObject*)PyExc_ValueError))), __pyx_mstate_global->__pyx_kp_u_itemsize_0_for_cython_array, 0, 0); + __PYX_ERR(1, 142, __pyx_L1_error) + + /* "View.MemoryView":141 + * raise ValueError, "Empty shape tuple for cython.array" + * + * if itemsize <= 0: # <<<<<<<<<<<<<< + * raise ValueError, "itemsize <= 0 for cython.array" + * +*/ + } + + /* "View.MemoryView":144 + * raise ValueError, "itemsize <= 0 for cython.array" + * + * if not isinstance(format, bytes): # <<<<<<<<<<<<<< + * format = format.encode('ASCII') + * self._format = format # keep a reference to the byte string +*/ + __pyx_t_2 = PyBytes_Check(__pyx_v_format); + __pyx_t_3 = (!__pyx_t_2); + if (__pyx_t_3) { + + /* "View.MemoryView":145 + * + * if not isinstance(format, bytes): + * format = format.encode('ASCII') # <<<<<<<<<<<<<< + * self._format = format # keep a reference to the byte string + * self.format = self._format +*/ + __pyx_t_5 = __pyx_v_format; + __Pyx_INCREF(__pyx_t_5); + __pyx_t_6 = 0; + { + PyObject *__pyx_callargs[2] = {__pyx_t_5, __pyx_mstate_global->__pyx_n_u_ASCII}; + __pyx_t_4 = __Pyx_PyObject_FastCallMethod((PyObject*)__pyx_mstate_global->__pyx_n_u_encode, __pyx_callargs+__pyx_t_6, (2-__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(1, 145, __pyx_L1_error) + __Pyx_GOTREF(__pyx_t_4); + } + __Pyx_DECREF_SET(__pyx_v_format, __pyx_t_4); + __pyx_t_4 = 0; + + /* "View.MemoryView":144 + * raise ValueError, "itemsize <= 0 for cython.array" + * + * if not isinstance(format, bytes): # <<<<<<<<<<<<<< + * format = format.encode('ASCII') + * self._format = format # keep a reference to the byte string +*/ + } + + /* "View.MemoryView":146 + * if not isinstance(format, bytes): + * format = format.encode('ASCII') + * self._format = format # keep a reference to the byte string # <<<<<<<<<<<<<< + * self.format = self._format + * +*/ + __pyx_t_4 = __pyx_v_format; + __Pyx_INCREF(__pyx_t_4); + if (!(likely(PyBytes_CheckExact(__pyx_t_4))||((__pyx_t_4) == Py_None) || __Pyx_RaiseUnexpectedTypeError("bytes", __pyx_t_4))) __PYX_ERR(1, 146, __pyx_L1_error) + __Pyx_GIVEREF(__pyx_t_4); + __Pyx_GOTREF(__pyx_v_self->_format); + __Pyx_DECREF(__pyx_v_self->_format); + __pyx_v_self->_format = ((PyObject*)__pyx_t_4); + __pyx_t_4 = 0; + + /* "View.MemoryView":147 + * format = format.encode('ASCII') + * self._format = format # keep a reference to the byte string + * self.format = self._format # <<<<<<<<<<<<<< + * + * +*/ + if (unlikely(__pyx_v_self->_format == Py_None)) { + PyErr_SetString(PyExc_TypeError, "expected bytes, NoneType found"); + __PYX_ERR(1, 147, __pyx_L1_error) + } + __pyx_t_7 = __Pyx_PyBytes_AsWritableString(__pyx_v_self->_format); if (unlikely((!__pyx_t_7) && PyErr_Occurred())) __PYX_ERR(1, 147, __pyx_L1_error) + __pyx_v_self->format = __pyx_t_7; + + /* "View.MemoryView":150 + * + * + * self._shape = PyObject_Malloc(sizeof(Py_ssize_t)*self.ndim*2) # <<<<<<<<<<<<<< + * self._strides = self._shape + self.ndim + * +*/ + __pyx_v_self->_shape = ((Py_ssize_t *)PyObject_Malloc((((sizeof(Py_ssize_t)) * __pyx_v_self->ndim) * 2))); + + /* "View.MemoryView":151 + * + * self._shape = PyObject_Malloc(sizeof(Py_ssize_t)*self.ndim*2) + * self._strides = self._shape + self.ndim # <<<<<<<<<<<<<< + * + * if not self._shape: +*/ + __pyx_v_self->_strides = (__pyx_v_self->_shape + __pyx_v_self->ndim); + + /* "View.MemoryView":153 + * self._strides = self._shape + self.ndim + * + * if not self._shape: # <<<<<<<<<<<<<< + * raise MemoryError, "unable to allocate shape and strides." + * +*/ + __pyx_t_3 = (!(__pyx_v_self->_shape != 0)); + if (unlikely(__pyx_t_3)) { + + /* "View.MemoryView":154 + * + * if not self._shape: + * raise MemoryError, "unable to allocate shape and strides." # <<<<<<<<<<<<<< + * + * +*/ + __Pyx_Raise(((PyObject *)(((PyTypeObject*)PyExc_MemoryError))), __pyx_mstate_global->__pyx_kp_u_unable_to_allocate_shape_and_str, 0, 0); + __PYX_ERR(1, 154, __pyx_L1_error) + + /* "View.MemoryView":153 + * self._strides = self._shape + self.ndim + * + * if not self._shape: # <<<<<<<<<<<<<< + * raise MemoryError, "unable to allocate shape and strides." + * +*/ + } + + /* "View.MemoryView":157 + * + * + * for idx, dim in enumerate(shape): # <<<<<<<<<<<<<< + * if dim <= 0: + * raise ValueError, f"Invalid shape in axis {idx}: {dim}." +*/ + __pyx_t_8 = 0; + __pyx_t_4 = __pyx_v_shape; __Pyx_INCREF(__pyx_t_4); + __pyx_t_1 = 0; + for (;;) { + { + Py_ssize_t __pyx_temp = __Pyx_PyTuple_GET_SIZE(__pyx_t_4); + #if !CYTHON_ASSUME_SAFE_SIZE + if (unlikely((__pyx_temp < 0))) __PYX_ERR(1, 157, __pyx_L1_error) + #endif + if (__pyx_t_1 >= __pyx_temp) break; + } + #if CYTHON_ASSUME_SAFE_MACROS && !CYTHON_AVOID_BORROWED_REFS + __pyx_t_5 = __Pyx_NewRef(PyTuple_GET_ITEM(__pyx_t_4, __pyx_t_1)); + #else + __pyx_t_5 = __Pyx_PySequence_ITEM(__pyx_t_4, __pyx_t_1); + #endif + ++__pyx_t_1; + if (unlikely(!__pyx_t_5)) __PYX_ERR(1, 157, __pyx_L1_error) + __Pyx_GOTREF(__pyx_t_5); + __pyx_t_9 = __Pyx_PyIndex_AsSsize_t(__pyx_t_5); if (unlikely((__pyx_t_9 == (Py_ssize_t)-1) && PyErr_Occurred())) __PYX_ERR(1, 157, __pyx_L1_error) + __Pyx_DECREF(__pyx_t_5); __pyx_t_5 = 0; + __pyx_v_dim = __pyx_t_9; + __pyx_v_idx = __pyx_t_8; + __pyx_t_8 = (__pyx_t_8 + 1); + + /* "View.MemoryView":158 + * + * for idx, dim in enumerate(shape): + * if dim <= 0: # <<<<<<<<<<<<<< + * raise ValueError, f"Invalid shape in axis {idx}: {dim}." + * self._shape[idx] = dim +*/ + __pyx_t_3 = (__pyx_v_dim <= 0); + if (unlikely(__pyx_t_3)) { + + /* "View.MemoryView":159 + * for idx, dim in enumerate(shape): + * if dim <= 0: + * raise ValueError, f"Invalid shape in axis {idx}: {dim}." # <<<<<<<<<<<<<< + * self._shape[idx] = dim + * +*/ + __pyx_t_5 = __Pyx_PyUnicode_From_int(__pyx_v_idx, 0, ' ', 'd'); if (unlikely(!__pyx_t_5)) __PYX_ERR(1, 159, __pyx_L1_error) + __Pyx_GOTREF(__pyx_t_5); + __pyx_t_10 = __Pyx_PyUnicode_From_Py_ssize_t(__pyx_v_dim, 0, ' ', 'd'); if (unlikely(!__pyx_t_10)) __PYX_ERR(1, 159, __pyx_L1_error) + __Pyx_GOTREF(__pyx_t_10); + __pyx_t_11[0] = __pyx_mstate_global->__pyx_kp_u_Invalid_shape_in_axis; + __pyx_t_11[1] = __pyx_t_5; + __pyx_t_11[2] = __pyx_mstate_global->__pyx_kp_u_; + __pyx_t_11[3] = __pyx_t_10; + __pyx_t_11[4] = __pyx_mstate_global->__pyx_kp_u__2; + __pyx_t_12 = __Pyx_PyUnicode_Join(__pyx_t_11, 5, 22 + __Pyx_PyUnicode_GET_LENGTH(__pyx_t_5) + 2 + __Pyx_PyUnicode_GET_LENGTH(__pyx_t_10) + 1, 127); + if (unlikely(!__pyx_t_12)) __PYX_ERR(1, 159, __pyx_L1_error) + __Pyx_GOTREF(__pyx_t_12); + __Pyx_DECREF(__pyx_t_5); __pyx_t_5 = 0; + __Pyx_DECREF(__pyx_t_10); __pyx_t_10 = 0; + __Pyx_Raise(((PyObject *)(((PyTypeObject*)PyExc_ValueError))), __pyx_t_12, 0, 0); + __Pyx_DECREF(__pyx_t_12); __pyx_t_12 = 0; + __PYX_ERR(1, 159, __pyx_L1_error) + + /* "View.MemoryView":158 + * + * for idx, dim in enumerate(shape): + * if dim <= 0: # <<<<<<<<<<<<<< + * raise ValueError, f"Invalid shape in axis {idx}: {dim}." + * self._shape[idx] = dim +*/ + } + + /* "View.MemoryView":160 + * if dim <= 0: + * raise ValueError, f"Invalid shape in axis {idx}: {dim}." + * self._shape[idx] = dim # <<<<<<<<<<<<<< + * + * cdef char order +*/ + (__pyx_v_self->_shape[__pyx_v_idx]) = __pyx_v_dim; + + /* "View.MemoryView":157 + * + * + * for idx, dim in enumerate(shape): # <<<<<<<<<<<<<< + * if dim <= 0: + * raise ValueError, f"Invalid shape in axis {idx}: {dim}." +*/ + } + __Pyx_DECREF(__pyx_t_4); __pyx_t_4 = 0; + + /* "View.MemoryView":163 + * + * cdef char order + * if mode == 'c': # <<<<<<<<<<<<<< + * order = b'C' + * self.mode = u'c' +*/ + __pyx_t_3 = (__Pyx_PyUnicode_Equals(__pyx_v_mode, __pyx_mstate_global->__pyx_n_u_c, Py_EQ)); if (unlikely((__pyx_t_3 < 0))) __PYX_ERR(1, 163, __pyx_L1_error) + if (__pyx_t_3) { + + /* "View.MemoryView":164 + * cdef char order + * if mode == 'c': + * order = b'C' # <<<<<<<<<<<<<< + * self.mode = u'c' + * elif mode == 'fortran': +*/ + __pyx_v_order = 'C'; + + /* "View.MemoryView":165 + * if mode == 'c': + * order = b'C' + * self.mode = u'c' # <<<<<<<<<<<<<< + * elif mode == 'fortran': + * order = b'F' +*/ + __Pyx_INCREF(__pyx_mstate_global->__pyx_n_u_c); + __Pyx_GIVEREF(__pyx_mstate_global->__pyx_n_u_c); + __Pyx_GOTREF(__pyx_v_self->mode); + __Pyx_DECREF(__pyx_v_self->mode); + __pyx_v_self->mode = __pyx_mstate_global->__pyx_n_u_c; + + /* "View.MemoryView":163 + * + * cdef char order + * if mode == 'c': # <<<<<<<<<<<<<< + * order = b'C' + * self.mode = u'c' +*/ + goto __pyx_L11; + } + + /* "View.MemoryView":166 + * order = b'C' + * self.mode = u'c' + * elif mode == 'fortran': # <<<<<<<<<<<<<< + * order = b'F' + * self.mode = u'fortran' +*/ + __pyx_t_3 = (__Pyx_PyUnicode_Equals(__pyx_v_mode, __pyx_mstate_global->__pyx_n_u_fortran, Py_EQ)); if (unlikely((__pyx_t_3 < 0))) __PYX_ERR(1, 166, __pyx_L1_error) + if (likely(__pyx_t_3)) { + + /* "View.MemoryView":167 + * self.mode = u'c' + * elif mode == 'fortran': + * order = b'F' # <<<<<<<<<<<<<< + * self.mode = u'fortran' + * else: +*/ + __pyx_v_order = 'F'; + + /* "View.MemoryView":168 + * elif mode == 'fortran': + * order = b'F' + * self.mode = u'fortran' # <<<<<<<<<<<<<< + * else: + * raise ValueError, f"Invalid mode, expected 'c' or 'fortran', got {mode}" +*/ + __Pyx_INCREF(__pyx_mstate_global->__pyx_n_u_fortran); + __Pyx_GIVEREF(__pyx_mstate_global->__pyx_n_u_fortran); + __Pyx_GOTREF(__pyx_v_self->mode); + __Pyx_DECREF(__pyx_v_self->mode); + __pyx_v_self->mode = __pyx_mstate_global->__pyx_n_u_fortran; + + /* "View.MemoryView":166 + * order = b'C' + * self.mode = u'c' + * elif mode == 'fortran': # <<<<<<<<<<<<<< + * order = b'F' + * self.mode = u'fortran' +*/ + goto __pyx_L11; + } + + /* "View.MemoryView":170 + * self.mode = u'fortran' + * else: + * raise ValueError, f"Invalid mode, expected 'c' or 'fortran', got {mode}" # <<<<<<<<<<<<<< + * + * self.len = fill_contig_strides_array(self._shape, self._strides, itemsize, self.ndim, order) +*/ + /*else*/ { + __pyx_t_4 = __Pyx_PyObject_FormatSimple(__pyx_v_mode, __pyx_mstate_global->__pyx_empty_unicode); if (unlikely(!__pyx_t_4)) __PYX_ERR(1, 170, __pyx_L1_error) + __Pyx_GOTREF(__pyx_t_4); + __pyx_t_12 = __Pyx_PyUnicode_Concat(__pyx_mstate_global->__pyx_kp_u_Invalid_mode_expected_c_or_fortr, __pyx_t_4); if (unlikely(!__pyx_t_12)) __PYX_ERR(1, 170, __pyx_L1_error) + __Pyx_GOTREF(__pyx_t_12); + __Pyx_DECREF(__pyx_t_4); __pyx_t_4 = 0; + __Pyx_Raise(((PyObject *)(((PyTypeObject*)PyExc_ValueError))), __pyx_t_12, 0, 0); + __Pyx_DECREF(__pyx_t_12); __pyx_t_12 = 0; + __PYX_ERR(1, 170, __pyx_L1_error) + } + __pyx_L11:; + + /* "View.MemoryView":172 + * raise ValueError, f"Invalid mode, expected 'c' or 'fortran', got {mode}" + * + * self.len = fill_contig_strides_array(self._shape, self._strides, itemsize, self.ndim, order) # <<<<<<<<<<<<<< + * + * self.free_data = allocate_buffer +*/ + __pyx_v_self->len = __pyx_fill_contig_strides_array(__pyx_v_self->_shape, __pyx_v_self->_strides, __pyx_v_itemsize, __pyx_v_self->ndim, __pyx_v_order); + + /* "View.MemoryView":174 + * self.len = fill_contig_strides_array(self._shape, self._strides, itemsize, self.ndim, order) + * + * self.free_data = allocate_buffer # <<<<<<<<<<<<<< + * self.dtype_is_object = format == b'O' + * +*/ + __pyx_v_self->free_data = __pyx_v_allocate_buffer; + + /* "View.MemoryView":175 + * + * self.free_data = allocate_buffer + * self.dtype_is_object = format == b'O' # <<<<<<<<<<<<<< + * + * if allocate_buffer: +*/ + __pyx_t_12 = PyObject_RichCompare(__pyx_v_format, __pyx_mstate_global->__pyx_n_b_O, Py_EQ); __Pyx_XGOTREF(__pyx_t_12); if (unlikely(!__pyx_t_12)) __PYX_ERR(1, 175, __pyx_L1_error) + __pyx_t_3 = __Pyx_PyObject_IsTrue(__pyx_t_12); if (unlikely((__pyx_t_3 == (int)-1) && PyErr_Occurred())) __PYX_ERR(1, 175, __pyx_L1_error) + __Pyx_DECREF(__pyx_t_12); __pyx_t_12 = 0; + __pyx_v_self->dtype_is_object = __pyx_t_3; + + /* "View.MemoryView":177 + * self.dtype_is_object = format == b'O' + * + * if allocate_buffer: # <<<<<<<<<<<<<< + * _allocate_buffer(self) + * +*/ + if (__pyx_v_allocate_buffer) { + + /* "View.MemoryView":178 + * + * if allocate_buffer: + * _allocate_buffer(self) # <<<<<<<<<<<<<< + * + * @cname('getbuffer') +*/ + __pyx_t_8 = __pyx_array_allocate_buffer(__pyx_v_self); if (unlikely(__pyx_t_8 == ((int)-1))) __PYX_ERR(1, 178, __pyx_L1_error) + + /* "View.MemoryView":177 + * self.dtype_is_object = format == b'O' + * + * if allocate_buffer: # <<<<<<<<<<<<<< + * _allocate_buffer(self) + * +*/ + } + + /* "View.MemoryView":129 + * cdef bint dtype_is_object + * + * def __cinit__(array self, tuple shape, Py_ssize_t itemsize, format not None, # <<<<<<<<<<<<<< + * mode="c", bint allocate_buffer=True): + * +*/ + + /* 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_10); + __Pyx_XDECREF(__pyx_t_12); + __Pyx_AddTraceback("View.MemoryView.array.__cinit__", __pyx_clineno, __pyx_lineno, __pyx_filename); + __pyx_r = -1; + __pyx_L0:; + __Pyx_XDECREF(__pyx_v_format); + __Pyx_RefNannyFinishContext(); + return __pyx_r; +} + +/* "View.MemoryView":180 + * _allocate_buffer(self) + * + * @cname('getbuffer') # <<<<<<<<<<<<<< + * def __getbuffer__(self, Py_buffer *info, int flags): + * cdef int bufmode = -1 +*/ + +/* Python wrapper */ +CYTHON_UNUSED static int __pyx_array_getbuffer(PyObject *__pyx_v_self, Py_buffer *__pyx_v_info, int __pyx_v_flags); /*proto*/ +CYTHON_UNUSED static int __pyx_array_getbuffer(PyObject *__pyx_v_self, Py_buffer *__pyx_v_info, int __pyx_v_flags) { + CYTHON_UNUSED PyObject *const *__pyx_kwvalues; + int __pyx_r; + __Pyx_RefNannyDeclarations + __Pyx_RefNannySetupContext("__getbuffer__ (wrapper)", 0); + __pyx_kwvalues = __Pyx_KwValues_VARARGS(__pyx_args, __pyx_nargs); + __pyx_r = __pyx_array___pyx_pf_15View_dot_MemoryView_5array_2__getbuffer__(((struct __pyx_array_obj *)__pyx_v_self), ((Py_buffer *)__pyx_v_info), ((int)__pyx_v_flags)); + + /* function exit code */ + __Pyx_RefNannyFinishContext(); + return __pyx_r; +} + +static int __pyx_array___pyx_pf_15View_dot_MemoryView_5array_2__getbuffer__(struct __pyx_array_obj *__pyx_v_self, Py_buffer *__pyx_v_info, int __pyx_v_flags) { + int __pyx_v_bufmode; + int __pyx_r; + __Pyx_RefNannyDeclarations + int __pyx_t_1; + char *__pyx_t_2; + Py_ssize_t __pyx_t_3; + int __pyx_t_4; + Py_ssize_t *__pyx_t_5; + int __pyx_lineno = 0; + const char *__pyx_filename = NULL; + int __pyx_clineno = 0; + if (unlikely(__pyx_v_info == NULL)) { + PyErr_SetString(PyExc_BufferError, "PyObject_GetBuffer: view==NULL argument is obsolete"); + return -1; + } + __Pyx_RefNannySetupContext("__getbuffer__", 0); + __pyx_v_info->obj = Py_None; __Pyx_INCREF(Py_None); + __Pyx_GIVEREF(__pyx_v_info->obj); + + /* "View.MemoryView":182 + * @cname('getbuffer') + * def __getbuffer__(self, Py_buffer *info, int flags): + * cdef int bufmode = -1 # <<<<<<<<<<<<<< + * if flags & (PyBUF_C_CONTIGUOUS | PyBUF_F_CONTIGUOUS | PyBUF_ANY_CONTIGUOUS): + * if self.mode == u"c": +*/ + __pyx_v_bufmode = -1; + + /* "View.MemoryView":183 + * def __getbuffer__(self, Py_buffer *info, int flags): + * cdef int bufmode = -1 + * if flags & (PyBUF_C_CONTIGUOUS | PyBUF_F_CONTIGUOUS | PyBUF_ANY_CONTIGUOUS): # <<<<<<<<<<<<<< + * if self.mode == u"c": + * bufmode = PyBUF_C_CONTIGUOUS | PyBUF_ANY_CONTIGUOUS +*/ + __pyx_t_1 = ((__pyx_v_flags & ((PyBUF_C_CONTIGUOUS | PyBUF_F_CONTIGUOUS) | PyBUF_ANY_CONTIGUOUS)) != 0); + if (__pyx_t_1) { + + /* "View.MemoryView":184 + * cdef int bufmode = -1 + * if flags & (PyBUF_C_CONTIGUOUS | PyBUF_F_CONTIGUOUS | PyBUF_ANY_CONTIGUOUS): + * if self.mode == u"c": # <<<<<<<<<<<<<< + * bufmode = PyBUF_C_CONTIGUOUS | PyBUF_ANY_CONTIGUOUS + * elif self.mode == u"fortran": +*/ + __pyx_t_1 = (__Pyx_PyUnicode_Equals(__pyx_v_self->mode, __pyx_mstate_global->__pyx_n_u_c, Py_EQ)); if (unlikely((__pyx_t_1 < 0))) __PYX_ERR(1, 184, __pyx_L1_error) + if (__pyx_t_1) { + + /* "View.MemoryView":185 + * if flags & (PyBUF_C_CONTIGUOUS | PyBUF_F_CONTIGUOUS | PyBUF_ANY_CONTIGUOUS): + * if self.mode == u"c": + * bufmode = PyBUF_C_CONTIGUOUS | PyBUF_ANY_CONTIGUOUS # <<<<<<<<<<<<<< + * elif self.mode == u"fortran": + * bufmode = PyBUF_F_CONTIGUOUS | PyBUF_ANY_CONTIGUOUS +*/ + __pyx_v_bufmode = (PyBUF_C_CONTIGUOUS | PyBUF_ANY_CONTIGUOUS); + + /* "View.MemoryView":184 + * cdef int bufmode = -1 + * if flags & (PyBUF_C_CONTIGUOUS | PyBUF_F_CONTIGUOUS | PyBUF_ANY_CONTIGUOUS): + * if self.mode == u"c": # <<<<<<<<<<<<<< + * bufmode = PyBUF_C_CONTIGUOUS | PyBUF_ANY_CONTIGUOUS + * elif self.mode == u"fortran": +*/ + goto __pyx_L4; + } + + /* "View.MemoryView":186 + * if self.mode == u"c": + * bufmode = PyBUF_C_CONTIGUOUS | PyBUF_ANY_CONTIGUOUS + * elif self.mode == u"fortran": # <<<<<<<<<<<<<< + * bufmode = PyBUF_F_CONTIGUOUS | PyBUF_ANY_CONTIGUOUS + * if not (flags & bufmode): +*/ + __pyx_t_1 = (__Pyx_PyUnicode_Equals(__pyx_v_self->mode, __pyx_mstate_global->__pyx_n_u_fortran, Py_EQ)); if (unlikely((__pyx_t_1 < 0))) __PYX_ERR(1, 186, __pyx_L1_error) + if (__pyx_t_1) { + + /* "View.MemoryView":187 + * bufmode = PyBUF_C_CONTIGUOUS | PyBUF_ANY_CONTIGUOUS + * elif self.mode == u"fortran": + * bufmode = PyBUF_F_CONTIGUOUS | PyBUF_ANY_CONTIGUOUS # <<<<<<<<<<<<<< + * if not (flags & bufmode): + * raise ValueError, "Can only create a buffer that is contiguous in memory." +*/ + __pyx_v_bufmode = (PyBUF_F_CONTIGUOUS | PyBUF_ANY_CONTIGUOUS); + + /* "View.MemoryView":186 + * if self.mode == u"c": + * bufmode = PyBUF_C_CONTIGUOUS | PyBUF_ANY_CONTIGUOUS + * elif self.mode == u"fortran": # <<<<<<<<<<<<<< + * bufmode = PyBUF_F_CONTIGUOUS | PyBUF_ANY_CONTIGUOUS + * if not (flags & bufmode): +*/ + } + __pyx_L4:; + + /* "View.MemoryView":188 + * elif self.mode == u"fortran": + * bufmode = PyBUF_F_CONTIGUOUS | PyBUF_ANY_CONTIGUOUS + * if not (flags & bufmode): # <<<<<<<<<<<<<< + * raise ValueError, "Can only create a buffer that is contiguous in memory." + * info.buf = self.data +*/ + __pyx_t_1 = (!((__pyx_v_flags & __pyx_v_bufmode) != 0)); + if (unlikely(__pyx_t_1)) { + + /* "View.MemoryView":189 + * bufmode = PyBUF_F_CONTIGUOUS | PyBUF_ANY_CONTIGUOUS + * if not (flags & bufmode): + * raise ValueError, "Can only create a buffer that is contiguous in memory." # <<<<<<<<<<<<<< + * info.buf = self.data + * info.len = self.len +*/ + __Pyx_Raise(((PyObject *)(((PyTypeObject*)PyExc_ValueError))), __pyx_mstate_global->__pyx_kp_u_Can_only_create_a_buffer_that_is, 0, 0); + __PYX_ERR(1, 189, __pyx_L1_error) + + /* "View.MemoryView":188 + * elif self.mode == u"fortran": + * bufmode = PyBUF_F_CONTIGUOUS | PyBUF_ANY_CONTIGUOUS + * if not (flags & bufmode): # <<<<<<<<<<<<<< + * raise ValueError, "Can only create a buffer that is contiguous in memory." + * info.buf = self.data +*/ + } + + /* "View.MemoryView":183 + * def __getbuffer__(self, Py_buffer *info, int flags): + * cdef int bufmode = -1 + * if flags & (PyBUF_C_CONTIGUOUS | PyBUF_F_CONTIGUOUS | PyBUF_ANY_CONTIGUOUS): # <<<<<<<<<<<<<< + * if self.mode == u"c": + * bufmode = PyBUF_C_CONTIGUOUS | PyBUF_ANY_CONTIGUOUS +*/ + } + + /* "View.MemoryView":190 + * if not (flags & bufmode): + * raise ValueError, "Can only create a buffer that is contiguous in memory." + * info.buf = self.data # <<<<<<<<<<<<<< + * info.len = self.len + * +*/ + __pyx_t_2 = __pyx_v_self->data; + __pyx_v_info->buf = __pyx_t_2; + + /* "View.MemoryView":191 + * raise ValueError, "Can only create a buffer that is contiguous in memory." + * info.buf = self.data + * info.len = self.len # <<<<<<<<<<<<<< + * + * if flags & PyBUF_STRIDES: +*/ + __pyx_t_3 = __pyx_v_self->len; + __pyx_v_info->len = __pyx_t_3; + + /* "View.MemoryView":193 + * info.len = self.len + * + * if flags & PyBUF_STRIDES: # <<<<<<<<<<<<<< + * info.ndim = self.ndim + * info.shape = self._shape +*/ + __pyx_t_1 = ((__pyx_v_flags & PyBUF_STRIDES) != 0); + if (__pyx_t_1) { + + /* "View.MemoryView":194 + * + * if flags & PyBUF_STRIDES: + * info.ndim = self.ndim # <<<<<<<<<<<<<< + * info.shape = self._shape + * info.strides = self._strides +*/ + __pyx_t_4 = __pyx_v_self->ndim; + __pyx_v_info->ndim = __pyx_t_4; + + /* "View.MemoryView":195 + * if flags & PyBUF_STRIDES: + * info.ndim = self.ndim + * info.shape = self._shape # <<<<<<<<<<<<<< + * info.strides = self._strides + * else: +*/ + __pyx_t_5 = __pyx_v_self->_shape; + __pyx_v_info->shape = __pyx_t_5; + + /* "View.MemoryView":196 + * info.ndim = self.ndim + * info.shape = self._shape + * info.strides = self._strides # <<<<<<<<<<<<<< + * else: + * info.ndim = 1 +*/ + __pyx_t_5 = __pyx_v_self->_strides; + __pyx_v_info->strides = __pyx_t_5; + + /* "View.MemoryView":193 + * info.len = self.len + * + * if flags & PyBUF_STRIDES: # <<<<<<<<<<<<<< + * info.ndim = self.ndim + * info.shape = self._shape +*/ + goto __pyx_L6; + } + + /* "View.MemoryView":198 + * info.strides = self._strides + * else: + * info.ndim = 1 # <<<<<<<<<<<<<< + * info.shape = &self.len if flags & PyBUF_ND else NULL + * info.strides = NULL +*/ + /*else*/ { + __pyx_v_info->ndim = 1; + + /* "View.MemoryView":199 + * else: + * info.ndim = 1 + * info.shape = &self.len if flags & PyBUF_ND else NULL # <<<<<<<<<<<<<< + * info.strides = NULL + * +*/ + __pyx_t_1 = ((__pyx_v_flags & PyBUF_ND) != 0); + if (__pyx_t_1) { + __pyx_t_5 = (&__pyx_v_self->len); + } else { + __pyx_t_5 = NULL; + } + __pyx_v_info->shape = __pyx_t_5; + + /* "View.MemoryView":200 + * info.ndim = 1 + * info.shape = &self.len if flags & PyBUF_ND else NULL + * info.strides = NULL # <<<<<<<<<<<<<< + * + * info.suboffsets = NULL +*/ + __pyx_v_info->strides = NULL; + } + __pyx_L6:; + + /* "View.MemoryView":202 + * info.strides = NULL + * + * info.suboffsets = NULL # <<<<<<<<<<<<<< + * info.itemsize = self.itemsize + * info.readonly = 0 +*/ + __pyx_v_info->suboffsets = NULL; + + /* "View.MemoryView":203 + * + * info.suboffsets = NULL + * info.itemsize = self.itemsize # <<<<<<<<<<<<<< + * info.readonly = 0 + * info.format = self.format if flags & PyBUF_FORMAT else NULL +*/ + __pyx_t_3 = __pyx_v_self->itemsize; + __pyx_v_info->itemsize = __pyx_t_3; + + /* "View.MemoryView":204 + * info.suboffsets = NULL + * info.itemsize = self.itemsize + * info.readonly = 0 # <<<<<<<<<<<<<< + * info.format = self.format if flags & PyBUF_FORMAT else NULL + * info.obj = self +*/ + __pyx_v_info->readonly = 0; + + /* "View.MemoryView":205 + * info.itemsize = self.itemsize + * info.readonly = 0 + * info.format = self.format if flags & PyBUF_FORMAT else NULL # <<<<<<<<<<<<<< + * info.obj = self + * +*/ + __pyx_t_1 = ((__pyx_v_flags & PyBUF_FORMAT) != 0); + if (__pyx_t_1) { + __pyx_t_2 = __pyx_v_self->format; + } else { + __pyx_t_2 = NULL; + } + __pyx_v_info->format = __pyx_t_2; + + /* "View.MemoryView":206 + * info.readonly = 0 + * info.format = self.format if flags & PyBUF_FORMAT else NULL + * info.obj = self # <<<<<<<<<<<<<< + * + * def __dealloc__(array self): +*/ + __Pyx_INCREF((PyObject *)__pyx_v_self); + __Pyx_GIVEREF((PyObject *)__pyx_v_self); + __Pyx_GOTREF(__pyx_v_info->obj); + __Pyx_DECREF(__pyx_v_info->obj); + __pyx_v_info->obj = ((PyObject *)__pyx_v_self); + + /* "View.MemoryView":180 + * _allocate_buffer(self) + * + * @cname('getbuffer') # <<<<<<<<<<<<<< + * def __getbuffer__(self, Py_buffer *info, int flags): + * cdef int bufmode = -1 +*/ + + /* function exit code */ + __pyx_r = 0; + goto __pyx_L0; + __pyx_L1_error:; + __Pyx_AddTraceback("View.MemoryView.array.__getbuffer__", __pyx_clineno, __pyx_lineno, __pyx_filename); + __pyx_r = -1; + if (__pyx_v_info->obj != NULL) { + __Pyx_GOTREF(__pyx_v_info->obj); + __Pyx_DECREF(__pyx_v_info->obj); __pyx_v_info->obj = 0; + } + goto __pyx_L2; + __pyx_L0:; + if (__pyx_v_info->obj == Py_None) { + __Pyx_GOTREF(__pyx_v_info->obj); + __Pyx_DECREF(__pyx_v_info->obj); __pyx_v_info->obj = 0; + } + __pyx_L2:; + __Pyx_RefNannyFinishContext(); + return __pyx_r; +} + +/* "View.MemoryView":208 + * info.obj = self + * + * def __dealloc__(array self): # <<<<<<<<<<<<<< + * if self.callback_free_data != NULL: + * self.callback_free_data(self.data) +*/ + +/* Python wrapper */ +static void __pyx_array___dealloc__(PyObject *__pyx_v_self); /*proto*/ +static void __pyx_array___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_array___pyx_pf_15View_dot_MemoryView_5array_4__dealloc__(((struct __pyx_array_obj *)__pyx_v_self)); + + /* function exit code */ + __Pyx_RefNannyFinishContext(); +} + +static void __pyx_array___pyx_pf_15View_dot_MemoryView_5array_4__dealloc__(struct __pyx_array_obj *__pyx_v_self) { + int __pyx_t_1; + int __pyx_t_2; + + /* "View.MemoryView":209 + * + * def __dealloc__(array self): + * if self.callback_free_data != NULL: # <<<<<<<<<<<<<< + * self.callback_free_data(self.data) + * elif self.free_data and self.data is not NULL: +*/ + __pyx_t_1 = (__pyx_v_self->callback_free_data != NULL); + if (__pyx_t_1) { + + /* "View.MemoryView":210 + * def __dealloc__(array self): + * if self.callback_free_data != NULL: + * self.callback_free_data(self.data) # <<<<<<<<<<<<<< + * elif self.free_data and self.data is not NULL: + * if self.dtype_is_object: +*/ + __pyx_v_self->callback_free_data(__pyx_v_self->data); + + /* "View.MemoryView":209 + * + * def __dealloc__(array self): + * if self.callback_free_data != NULL: # <<<<<<<<<<<<<< + * self.callback_free_data(self.data) + * elif self.free_data and self.data is not NULL: +*/ + goto __pyx_L3; + } + + /* "View.MemoryView":211 + * if self.callback_free_data != NULL: + * self.callback_free_data(self.data) + * elif self.free_data and self.data is not NULL: # <<<<<<<<<<<<<< + * if self.dtype_is_object: + * refcount_objects_in_slice(self.data, self._shape, self._strides, self.ndim, inc=False) +*/ + if (__pyx_v_self->free_data) { + } else { + __pyx_t_1 = __pyx_v_self->free_data; + goto __pyx_L4_bool_binop_done; + } + __pyx_t_2 = (__pyx_v_self->data != NULL); + __pyx_t_1 = __pyx_t_2; + __pyx_L4_bool_binop_done:; + if (__pyx_t_1) { + + /* "View.MemoryView":212 + * self.callback_free_data(self.data) + * elif self.free_data and self.data is not NULL: + * if self.dtype_is_object: # <<<<<<<<<<<<<< + * refcount_objects_in_slice(self.data, self._shape, self._strides, self.ndim, inc=False) + * free(self.data) +*/ + if (__pyx_v_self->dtype_is_object) { + + /* "View.MemoryView":213 + * elif self.free_data and self.data is not NULL: + * if self.dtype_is_object: + * refcount_objects_in_slice(self.data, self._shape, self._strides, self.ndim, inc=False) # <<<<<<<<<<<<<< + * free(self.data) + * PyObject_Free(self._shape) +*/ + __pyx_memoryview_refcount_objects_in_slice(__pyx_v_self->data, __pyx_v_self->_shape, __pyx_v_self->_strides, __pyx_v_self->ndim, 0); + + /* "View.MemoryView":212 + * self.callback_free_data(self.data) + * elif self.free_data and self.data is not NULL: + * if self.dtype_is_object: # <<<<<<<<<<<<<< + * refcount_objects_in_slice(self.data, self._shape, self._strides, self.ndim, inc=False) + * free(self.data) +*/ + } + + /* "View.MemoryView":214 + * if self.dtype_is_object: + * refcount_objects_in_slice(self.data, self._shape, self._strides, self.ndim, inc=False) + * free(self.data) # <<<<<<<<<<<<<< + * PyObject_Free(self._shape) + * +*/ + free(__pyx_v_self->data); + + /* "View.MemoryView":211 + * if self.callback_free_data != NULL: + * self.callback_free_data(self.data) + * elif self.free_data and self.data is not NULL: # <<<<<<<<<<<<<< + * if self.dtype_is_object: + * refcount_objects_in_slice(self.data, self._shape, self._strides, self.ndim, inc=False) +*/ + } + __pyx_L3:; + + /* "View.MemoryView":215 + * refcount_objects_in_slice(self.data, self._shape, self._strides, self.ndim, inc=False) + * free(self.data) + * PyObject_Free(self._shape) # <<<<<<<<<<<<<< + * + * @property +*/ + PyObject_Free(__pyx_v_self->_shape); + + /* "View.MemoryView":208 + * info.obj = self + * + * def __dealloc__(array self): # <<<<<<<<<<<<<< + * if self.callback_free_data != NULL: + * self.callback_free_data(self.data) +*/ + + /* function exit code */ +} + +/* "View.MemoryView":217 + * PyObject_Free(self._shape) + * + * @property # <<<<<<<<<<<<<< + * def memview(self): + * return self.get_memview() +*/ + +/* Python wrapper */ +static PyObject *__pyx_pw_15View_dot_MemoryView_5array_7memview_1__get__(PyObject *__pyx_v_self); /*proto*/ +static PyObject *__pyx_pw_15View_dot_MemoryView_5array_7memview_1__get__(PyObject *__pyx_v_self) { + CYTHON_UNUSED PyObject *const *__pyx_kwvalues; + PyObject *__pyx_r = 0; + __Pyx_RefNannyDeclarations + __Pyx_RefNannySetupContext("__get__ (wrapper)", 0); + __pyx_kwvalues = __Pyx_KwValues_VARARGS(__pyx_args, __pyx_nargs); + __pyx_r = __pyx_pf_15View_dot_MemoryView_5array_7memview___get__(((struct __pyx_array_obj *)__pyx_v_self)); + + /* function exit code */ + __Pyx_RefNannyFinishContext(); + return __pyx_r; +} + +static PyObject *__pyx_pf_15View_dot_MemoryView_5array_7memview___get__(struct __pyx_array_obj *__pyx_v_self) { + PyObject *__pyx_r = NULL; + __Pyx_RefNannyDeclarations + PyObject *__pyx_t_1 = NULL; + int __pyx_lineno = 0; + const char *__pyx_filename = NULL; + int __pyx_clineno = 0; + __Pyx_RefNannySetupContext("__get__", 0); + + /* "View.MemoryView":219 + * @property + * def memview(self): + * return self.get_memview() # <<<<<<<<<<<<<< + * + * @cname('get_memview') +*/ + __Pyx_XDECREF(__pyx_r); + __pyx_t_1 = ((struct __pyx_vtabstruct_array *)__pyx_v_self->__pyx_vtab)->get_memview(__pyx_v_self); if (unlikely(!__pyx_t_1)) __PYX_ERR(1, 219, __pyx_L1_error) + __Pyx_GOTREF(__pyx_t_1); + __pyx_r = __pyx_t_1; + __pyx_t_1 = 0; + goto __pyx_L0; + + /* "View.MemoryView":217 + * PyObject_Free(self._shape) + * + * @property # <<<<<<<<<<<<<< + * def memview(self): + * return self.get_memview() +*/ + + /* function exit code */ + __pyx_L1_error:; + __Pyx_XDECREF(__pyx_t_1); + __Pyx_AddTraceback("View.MemoryView.array.memview.__get__", __pyx_clineno, __pyx_lineno, __pyx_filename); + __pyx_r = NULL; + __pyx_L0:; + __Pyx_XGIVEREF(__pyx_r); + __Pyx_RefNannyFinishContext(); + return __pyx_r; +} + +/* "View.MemoryView":221 + * return self.get_memview() + * + * @cname('get_memview') # <<<<<<<<<<<<<< + * cdef get_memview(self): + * flags = PyBUF_ANY_CONTIGUOUS|PyBUF_FORMAT|PyBUF_WRITABLE +*/ + +static PyObject *__pyx_array_get_memview(struct __pyx_array_obj *__pyx_v_self) { + int __pyx_v_flags; + PyObject *__pyx_r = NULL; + __Pyx_RefNannyDeclarations + PyObject *__pyx_t_1 = NULL; + PyObject *__pyx_t_2 = NULL; + PyObject *__pyx_t_3 = NULL; + PyObject *__pyx_t_4 = NULL; + size_t __pyx_t_5; + int __pyx_lineno = 0; + const char *__pyx_filename = NULL; + int __pyx_clineno = 0; + __Pyx_RefNannySetupContext("get_memview", 0); + + /* "View.MemoryView":223 + * @cname('get_memview') + * cdef get_memview(self): + * flags = PyBUF_ANY_CONTIGUOUS|PyBUF_FORMAT|PyBUF_WRITABLE # <<<<<<<<<<<<<< + * return memoryview(self, flags, self.dtype_is_object) + * +*/ + __pyx_v_flags = ((PyBUF_ANY_CONTIGUOUS | PyBUF_FORMAT) | PyBUF_WRITABLE); + + /* "View.MemoryView":224 + * cdef get_memview(self): + * flags = PyBUF_ANY_CONTIGUOUS|PyBUF_FORMAT|PyBUF_WRITABLE + * return memoryview(self, flags, self.dtype_is_object) # <<<<<<<<<<<<<< + * + * def __len__(self): +*/ + __Pyx_XDECREF(__pyx_r); + __pyx_t_2 = NULL; + __pyx_t_3 = __Pyx_PyLong_From_int(__pyx_v_flags); if (unlikely(!__pyx_t_3)) __PYX_ERR(1, 224, __pyx_L1_error) + __Pyx_GOTREF(__pyx_t_3); + __pyx_t_4 = __Pyx_PyBool_FromLong(__pyx_v_self->dtype_is_object); if (unlikely(!__pyx_t_4)) __PYX_ERR(1, 224, __pyx_L1_error) + __Pyx_GOTREF(__pyx_t_4); + __pyx_t_5 = 1; + { + PyObject *__pyx_callargs[4] = {__pyx_t_2, ((PyObject *)__pyx_v_self), __pyx_t_3, __pyx_t_4}; + __pyx_t_1 = __Pyx_PyObject_FastCall((PyObject*)__pyx_mstate_global->__pyx_memoryview_type, __pyx_callargs+__pyx_t_5, (4-__pyx_t_5) | (__pyx_t_5*__Pyx_PY_VECTORCALL_ARGUMENTS_OFFSET)); + __Pyx_XDECREF(__pyx_t_2); __pyx_t_2 = 0; + __Pyx_DECREF(__pyx_t_3); __pyx_t_3 = 0; + __Pyx_DECREF(__pyx_t_4); __pyx_t_4 = 0; + if (unlikely(!__pyx_t_1)) __PYX_ERR(1, 224, __pyx_L1_error) + __Pyx_GOTREF((PyObject *)__pyx_t_1); + } + __pyx_r = ((PyObject *)__pyx_t_1); + __pyx_t_1 = 0; + goto __pyx_L0; + + /* "View.MemoryView":221 + * return self.get_memview() + * + * @cname('get_memview') # <<<<<<<<<<<<<< + * cdef get_memview(self): + * flags = PyBUF_ANY_CONTIGUOUS|PyBUF_FORMAT|PyBUF_WRITABLE +*/ + + /* function exit code */ + __pyx_L1_error:; + __Pyx_XDECREF(__pyx_t_1); + __Pyx_XDECREF(__pyx_t_2); + __Pyx_XDECREF(__pyx_t_3); + __Pyx_XDECREF(__pyx_t_4); + __Pyx_AddTraceback("View.MemoryView.array.get_memview", __pyx_clineno, __pyx_lineno, __pyx_filename); + __pyx_r = 0; + __pyx_L0:; + __Pyx_XGIVEREF(__pyx_r); + __Pyx_RefNannyFinishContext(); + return __pyx_r; +} + +/* "View.MemoryView":226 + * return memoryview(self, flags, self.dtype_is_object) + * + * def __len__(self): # <<<<<<<<<<<<<< + * return self._shape[0] + * +*/ + +/* Python wrapper */ +static Py_ssize_t __pyx_array___len__(PyObject *__pyx_v_self); /*proto*/ +static Py_ssize_t __pyx_array___len__(PyObject *__pyx_v_self) { + CYTHON_UNUSED PyObject *const *__pyx_kwvalues; + Py_ssize_t __pyx_r; + __Pyx_RefNannyDeclarations + __Pyx_RefNannySetupContext("__len__ (wrapper)", 0); + __pyx_kwvalues = __Pyx_KwValues_VARARGS(__pyx_args, __pyx_nargs); + __pyx_r = __pyx_array___pyx_pf_15View_dot_MemoryView_5array_6__len__(((struct __pyx_array_obj *)__pyx_v_self)); + + /* function exit code */ + __Pyx_RefNannyFinishContext(); + return __pyx_r; +} + +static Py_ssize_t __pyx_array___pyx_pf_15View_dot_MemoryView_5array_6__len__(struct __pyx_array_obj *__pyx_v_self) { + Py_ssize_t __pyx_r; + + /* "View.MemoryView":227 + * + * def __len__(self): + * return self._shape[0] # <<<<<<<<<<<<<< + * + * def __getattr__(self, attr): +*/ + __pyx_r = (__pyx_v_self->_shape[0]); + goto __pyx_L0; + + /* "View.MemoryView":226 + * return memoryview(self, flags, self.dtype_is_object) + * + * def __len__(self): # <<<<<<<<<<<<<< + * return self._shape[0] + * +*/ + + /* function exit code */ + __pyx_L0:; + return __pyx_r; +} + +/* "View.MemoryView":229 + * return self._shape[0] + * + * def __getattr__(self, attr): # <<<<<<<<<<<<<< + * return getattr(self.memview, attr) + * +*/ + +/* Python wrapper */ +static PyObject *__pyx_array___getattr__(PyObject *__pyx_v_self, PyObject *__pyx_v_attr); /*proto*/ +static PyObject *__pyx_array___getattr__(PyObject *__pyx_v_self, PyObject *__pyx_v_attr) { + CYTHON_UNUSED PyObject *const *__pyx_kwvalues; + PyObject *__pyx_r = 0; + __Pyx_RefNannyDeclarations + __Pyx_RefNannySetupContext("__getattr__ (wrapper)", 0); + __pyx_kwvalues = __Pyx_KwValues_VARARGS(__pyx_args, __pyx_nargs); + __pyx_r = __pyx_array___pyx_pf_15View_dot_MemoryView_5array_8__getattr__(((struct __pyx_array_obj *)__pyx_v_self), ((PyObject *)__pyx_v_attr)); + + /* function exit code */ + __Pyx_RefNannyFinishContext(); + return __pyx_r; +} + +static PyObject *__pyx_array___pyx_pf_15View_dot_MemoryView_5array_8__getattr__(struct __pyx_array_obj *__pyx_v_self, PyObject *__pyx_v_attr) { + PyObject *__pyx_r = NULL; + __Pyx_RefNannyDeclarations + PyObject *__pyx_t_1 = NULL; + PyObject *__pyx_t_2 = NULL; + int __pyx_lineno = 0; + const char *__pyx_filename = NULL; + int __pyx_clineno = 0; + __Pyx_RefNannySetupContext("__getattr__", 0); + + /* "View.MemoryView":230 + * + * def __getattr__(self, attr): + * return getattr(self.memview, attr) # <<<<<<<<<<<<<< + * + * def __getitem__(self, item): +*/ + __Pyx_XDECREF(__pyx_r); + __pyx_t_1 = __Pyx_PyObject_GetAttrStr(((PyObject *)__pyx_v_self), __pyx_mstate_global->__pyx_n_u_memview); if (unlikely(!__pyx_t_1)) __PYX_ERR(1, 230, __pyx_L1_error) + __Pyx_GOTREF(__pyx_t_1); + __pyx_t_2 = __Pyx_GetAttr(__pyx_t_1, __pyx_v_attr); if (unlikely(!__pyx_t_2)) __PYX_ERR(1, 230, __pyx_L1_error) + __Pyx_GOTREF(__pyx_t_2); + __Pyx_DECREF(__pyx_t_1); __pyx_t_1 = 0; + __pyx_r = __pyx_t_2; + __pyx_t_2 = 0; + goto __pyx_L0; + + /* "View.MemoryView":229 + * return self._shape[0] + * + * def __getattr__(self, attr): # <<<<<<<<<<<<<< + * return getattr(self.memview, attr) + * +*/ + + /* function exit code */ + __pyx_L1_error:; + __Pyx_XDECREF(__pyx_t_1); + __Pyx_XDECREF(__pyx_t_2); + __Pyx_AddTraceback("View.MemoryView.array.__getattr__", __pyx_clineno, __pyx_lineno, __pyx_filename); + __pyx_r = NULL; + __pyx_L0:; + __Pyx_XGIVEREF(__pyx_r); + __Pyx_RefNannyFinishContext(); + return __pyx_r; +} + +/* "View.MemoryView":232 + * return getattr(self.memview, attr) + * + * def __getitem__(self, item): # <<<<<<<<<<<<<< + * return self.memview[item] + * +*/ + +/* Python wrapper */ +static PyObject *__pyx_array___getitem__(PyObject *__pyx_v_self, PyObject *__pyx_v_item); /*proto*/ +static PyObject *__pyx_array___getitem__(PyObject *__pyx_v_self, PyObject *__pyx_v_item) { + CYTHON_UNUSED PyObject *const *__pyx_kwvalues; + PyObject *__pyx_r = 0; + __Pyx_RefNannyDeclarations + __Pyx_RefNannySetupContext("__getitem__ (wrapper)", 0); + __pyx_kwvalues = __Pyx_KwValues_VARARGS(__pyx_args, __pyx_nargs); + __pyx_r = __pyx_array___pyx_pf_15View_dot_MemoryView_5array_10__getitem__(((struct __pyx_array_obj *)__pyx_v_self), ((PyObject *)__pyx_v_item)); + + /* function exit code */ + __Pyx_RefNannyFinishContext(); + return __pyx_r; +} + +static PyObject *__pyx_array___pyx_pf_15View_dot_MemoryView_5array_10__getitem__(struct __pyx_array_obj *__pyx_v_self, PyObject *__pyx_v_item) { + PyObject *__pyx_r = NULL; + __Pyx_RefNannyDeclarations + PyObject *__pyx_t_1 = NULL; + PyObject *__pyx_t_2 = NULL; + int __pyx_lineno = 0; + const char *__pyx_filename = NULL; + int __pyx_clineno = 0; + __Pyx_RefNannySetupContext("__getitem__", 0); + + /* "View.MemoryView":233 + * + * def __getitem__(self, item): + * return self.memview[item] # <<<<<<<<<<<<<< + * + * def __setitem__(self, item, value): +*/ + __Pyx_XDECREF(__pyx_r); + __pyx_t_1 = __Pyx_PyObject_GetAttrStr(((PyObject *)__pyx_v_self), __pyx_mstate_global->__pyx_n_u_memview); if (unlikely(!__pyx_t_1)) __PYX_ERR(1, 233, __pyx_L1_error) + __Pyx_GOTREF(__pyx_t_1); + __pyx_t_2 = __Pyx_PyObject_GetItem(__pyx_t_1, __pyx_v_item); if (unlikely(!__pyx_t_2)) __PYX_ERR(1, 233, __pyx_L1_error) + __Pyx_GOTREF(__pyx_t_2); + __Pyx_DECREF(__pyx_t_1); __pyx_t_1 = 0; + __pyx_r = __pyx_t_2; + __pyx_t_2 = 0; + goto __pyx_L0; + + /* "View.MemoryView":232 + * return getattr(self.memview, attr) + * + * def __getitem__(self, item): # <<<<<<<<<<<<<< + * return self.memview[item] + * +*/ + + /* function exit code */ + __pyx_L1_error:; + __Pyx_XDECREF(__pyx_t_1); + __Pyx_XDECREF(__pyx_t_2); + __Pyx_AddTraceback("View.MemoryView.array.__getitem__", __pyx_clineno, __pyx_lineno, __pyx_filename); + __pyx_r = NULL; + __pyx_L0:; + __Pyx_XGIVEREF(__pyx_r); + __Pyx_RefNannyFinishContext(); + return __pyx_r; +} + +/* "View.MemoryView":235 + * return self.memview[item] + * + * def __setitem__(self, item, value): # <<<<<<<<<<<<<< + * self.memview[item] = value + * +*/ + +/* Python wrapper */ +static int __pyx_array___setitem__(PyObject *__pyx_v_self, PyObject *__pyx_v_item, PyObject *__pyx_v_value); /*proto*/ +static int __pyx_array___setitem__(PyObject *__pyx_v_self, PyObject *__pyx_v_item, PyObject *__pyx_v_value) { + CYTHON_UNUSED PyObject *const *__pyx_kwvalues; + int __pyx_r; + __Pyx_RefNannyDeclarations + __Pyx_RefNannySetupContext("__setitem__ (wrapper)", 0); + __pyx_kwvalues = __Pyx_KwValues_VARARGS(__pyx_args, __pyx_nargs); + __pyx_r = __pyx_array___pyx_pf_15View_dot_MemoryView_5array_12__setitem__(((struct __pyx_array_obj *)__pyx_v_self), ((PyObject *)__pyx_v_item), ((PyObject *)__pyx_v_value)); + + /* function exit code */ + __Pyx_RefNannyFinishContext(); + return __pyx_r; +} + +static int __pyx_array___pyx_pf_15View_dot_MemoryView_5array_12__setitem__(struct __pyx_array_obj *__pyx_v_self, PyObject *__pyx_v_item, PyObject *__pyx_v_value) { + int __pyx_r; + __Pyx_RefNannyDeclarations + PyObject *__pyx_t_1 = NULL; + int __pyx_lineno = 0; + const char *__pyx_filename = NULL; + int __pyx_clineno = 0; + __Pyx_RefNannySetupContext("__setitem__", 0); + + /* "View.MemoryView":236 + * + * def __setitem__(self, item, value): + * self.memview[item] = value # <<<<<<<<<<<<<< + * + * +*/ + __pyx_t_1 = __Pyx_PyObject_GetAttrStr(((PyObject *)__pyx_v_self), __pyx_mstate_global->__pyx_n_u_memview); if (unlikely(!__pyx_t_1)) __PYX_ERR(1, 236, __pyx_L1_error) + __Pyx_GOTREF(__pyx_t_1); + if (unlikely((PyObject_SetItem(__pyx_t_1, __pyx_v_item, __pyx_v_value) < 0))) __PYX_ERR(1, 236, __pyx_L1_error) + __Pyx_DECREF(__pyx_t_1); __pyx_t_1 = 0; + + /* "View.MemoryView":235 + * return self.memview[item] + * + * def __setitem__(self, item, value): # <<<<<<<<<<<<<< + * self.memview[item] = value + * +*/ + + /* function exit code */ + __pyx_r = 0; + goto __pyx_L0; + __pyx_L1_error:; + __Pyx_XDECREF(__pyx_t_1); + __Pyx_AddTraceback("View.MemoryView.array.__setitem__", __pyx_clineno, __pyx_lineno, __pyx_filename); + __pyx_r = -1; + __pyx_L0:; + __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___pyx_array_1__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*/ +static PyObject *__pyx_pw___pyx_array_1__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___pyx_array___reduce_cython__(((struct __pyx_array_obj *)__pyx_v_self)); + + /* function exit code */ + __Pyx_RefNannyFinishContext(); + return __pyx_r; +} + +static PyObject *__pyx_pf___pyx_array___reduce_cython__(CYTHON_UNUSED struct __pyx_array_obj *__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("View.MemoryView.array.__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___pyx_array_3__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*/ +static PyObject *__pyx_pw___pyx_array_3__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("View.MemoryView.array.__setstate_cython__", __pyx_clineno, __pyx_lineno, __pyx_filename); + __Pyx_RefNannyFinishContext(); + return NULL; + __pyx_L4_argument_unpacking_done:; + __pyx_r = __pyx_pf___pyx_array_2__setstate_cython__(((struct __pyx_array_obj *)__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___pyx_array_2__setstate_cython__(CYTHON_UNUSED struct __pyx_array_obj *__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("View.MemoryView.array.__setstate_cython__", __pyx_clineno, __pyx_lineno, __pyx_filename); + __pyx_r = NULL; + __Pyx_XGIVEREF(__pyx_r); + __Pyx_RefNannyFinishContext(); + return __pyx_r; +} + +/* "View.MemoryView":245 + * pass + * + * @cname("__pyx_array_allocate_buffer") # <<<<<<<<<<<<<< + * cdef int _allocate_buffer(array self) except -1: + * +*/ + +static int __pyx_array_allocate_buffer(struct __pyx_array_obj *__pyx_v_self) { + Py_ssize_t __pyx_v_i; + PyObject **__pyx_v_p; + int __pyx_r; + int __pyx_t_1; + Py_ssize_t __pyx_t_2; + Py_ssize_t __pyx_t_3; + Py_ssize_t __pyx_t_4; + int __pyx_lineno = 0; + const char *__pyx_filename = NULL; + int __pyx_clineno = 0; + + /* "View.MemoryView":252 + * cdef PyObject **p + * + * self.free_data = True # <<<<<<<<<<<<<< + * self.data = malloc(self.len) + * if not self.data: +*/ + __pyx_v_self->free_data = 1; + + /* "View.MemoryView":253 + * + * self.free_data = True + * self.data = malloc(self.len) # <<<<<<<<<<<<<< + * if not self.data: + * raise MemoryError, "unable to allocate array data." +*/ + __pyx_v_self->data = ((char *)malloc(__pyx_v_self->len)); + + /* "View.MemoryView":254 + * self.free_data = True + * self.data = malloc(self.len) + * if not self.data: # <<<<<<<<<<<<<< + * raise MemoryError, "unable to allocate array data." + * +*/ + __pyx_t_1 = (!(__pyx_v_self->data != 0)); + if (unlikely(__pyx_t_1)) { + + /* "View.MemoryView":255 + * self.data = malloc(self.len) + * if not self.data: + * raise MemoryError, "unable to allocate array data." # <<<<<<<<<<<<<< + * + * if self.dtype_is_object: +*/ + __Pyx_Raise(((PyObject *)(((PyTypeObject*)PyExc_MemoryError))), __pyx_mstate_global->__pyx_kp_u_unable_to_allocate_array_data, 0, 0); + __PYX_ERR(1, 255, __pyx_L1_error) + + /* "View.MemoryView":254 + * self.free_data = True + * self.data = malloc(self.len) + * if not self.data: # <<<<<<<<<<<<<< + * raise MemoryError, "unable to allocate array data." + * +*/ + } + + /* "View.MemoryView":257 + * raise MemoryError, "unable to allocate array data." + * + * if self.dtype_is_object: # <<<<<<<<<<<<<< + * p = self.data + * for i in range(self.len // self.itemsize): +*/ + if (__pyx_v_self->dtype_is_object) { + + /* "View.MemoryView":258 + * + * if self.dtype_is_object: + * p = self.data # <<<<<<<<<<<<<< + * for i in range(self.len // self.itemsize): + * p[i] = Py_None +*/ + __pyx_v_p = ((PyObject **)__pyx_v_self->data); + + /* "View.MemoryView":259 + * if self.dtype_is_object: + * p = self.data + * for i in range(self.len // self.itemsize): # <<<<<<<<<<<<<< + * p[i] = Py_None + * Py_INCREF(Py_None) +*/ + if (unlikely(__pyx_v_self->itemsize == 0)) { + PyErr_SetString(PyExc_ZeroDivisionError, "integer division or modulo by zero"); + __PYX_ERR(1, 259, __pyx_L1_error) + } + else if (sizeof(Py_ssize_t) == sizeof(long) && (!(((Py_ssize_t)-1) > 0)) && unlikely(__pyx_v_self->itemsize == (Py_ssize_t)-1) && unlikely(__Pyx_UNARY_NEG_WOULD_OVERFLOW(__pyx_v_self->len))) { + PyErr_SetString(PyExc_OverflowError, "value too large to perform division"); + __PYX_ERR(1, 259, __pyx_L1_error) + } + __pyx_t_2 = __Pyx_div_Py_ssize_t(__pyx_v_self->len, __pyx_v_self->itemsize, 0); + __pyx_t_3 = __pyx_t_2; + for (__pyx_t_4 = 0; __pyx_t_4 < __pyx_t_3; __pyx_t_4+=1) { + __pyx_v_i = __pyx_t_4; + + /* "View.MemoryView":260 + * p = self.data + * for i in range(self.len // self.itemsize): + * p[i] = Py_None # <<<<<<<<<<<<<< + * Py_INCREF(Py_None) + * return 0 +*/ + (__pyx_v_p[__pyx_v_i]) = Py_None; + + /* "View.MemoryView":261 + * for i in range(self.len // self.itemsize): + * p[i] = Py_None + * Py_INCREF(Py_None) # <<<<<<<<<<<<<< + * return 0 + * +*/ + Py_INCREF(Py_None); + } + + /* "View.MemoryView":257 + * raise MemoryError, "unable to allocate array data." + * + * if self.dtype_is_object: # <<<<<<<<<<<<<< + * p = self.data + * for i in range(self.len // self.itemsize): +*/ + } + + /* "View.MemoryView":262 + * p[i] = Py_None + * Py_INCREF(Py_None) + * return 0 # <<<<<<<<<<<<<< + * + * +*/ + __pyx_r = 0; + goto __pyx_L0; + + /* "View.MemoryView":245 + * pass + * + * @cname("__pyx_array_allocate_buffer") # <<<<<<<<<<<<<< + * cdef int _allocate_buffer(array self) except -1: + * +*/ + + /* function exit code */ + __pyx_L1_error:; + __Pyx_AddTraceback("View.MemoryView._allocate_buffer", __pyx_clineno, __pyx_lineno, __pyx_filename); + __pyx_r = -1; + __pyx_L0:; + return __pyx_r; +} + +/* "View.MemoryView":265 + * + * + * @cname("__pyx_array_new") # <<<<<<<<<<<<<< + * cdef array array_cwrapper(tuple shape, Py_ssize_t itemsize, char *format, const char *c_mode, char *buf): + * cdef array result +*/ + +static struct __pyx_array_obj *__pyx_array_new(PyObject *__pyx_v_shape, Py_ssize_t __pyx_v_itemsize, char *__pyx_v_format, char const *__pyx_v_c_mode, char *__pyx_v_buf) { + struct __pyx_array_obj *__pyx_v_result = 0; + PyObject *__pyx_v_mode = 0; + struct __pyx_array_obj *__pyx_r = NULL; + __Pyx_RefNannyDeclarations + PyObject *__pyx_t_1 = NULL; + int __pyx_t_2; + PyObject *__pyx_t_3 = NULL; + PyObject *__pyx_t_4 = NULL; + int __pyx_lineno = 0; + const char *__pyx_filename = NULL; + int __pyx_clineno = 0; + __Pyx_RefNannySetupContext("array_cwrapper", 0); + + /* "View.MemoryView":268 + * cdef array array_cwrapper(tuple shape, Py_ssize_t itemsize, char *format, const char *c_mode, char *buf): + * cdef array result + * cdef str mode = "fortran" if c_mode[0] == b'f' else "c" # this often comes from a constant C string. # <<<<<<<<<<<<<< + * + * if buf is NULL: +*/ + __pyx_t_2 = ((__pyx_v_c_mode[0]) == 'f'); + if (__pyx_t_2) { + __Pyx_INCREF(__pyx_mstate_global->__pyx_n_u_fortran); + __pyx_t_1 = __pyx_mstate_global->__pyx_n_u_fortran; + } else { + __Pyx_INCREF(__pyx_mstate_global->__pyx_n_u_c); + __pyx_t_1 = __pyx_mstate_global->__pyx_n_u_c; + } + __pyx_v_mode = ((PyObject*)__pyx_t_1); + __pyx_t_1 = 0; + + /* "View.MemoryView":270 + * cdef str mode = "fortran" if c_mode[0] == b'f' else "c" # this often comes from a constant C string. + * + * if buf is NULL: # <<<<<<<<<<<<<< + * result = array.__new__(array, shape, itemsize, format, mode) + * else: +*/ + __pyx_t_2 = (__pyx_v_buf == NULL); + if (__pyx_t_2) { + + /* "View.MemoryView":271 + * + * if buf is NULL: + * result = array.__new__(array, shape, itemsize, format, mode) # <<<<<<<<<<<<<< + * else: + * result = array.__new__(array, shape, itemsize, format, mode, allocate_buffer=False) +*/ + __pyx_t_1 = PyLong_FromSsize_t(__pyx_v_itemsize); if (unlikely(!__pyx_t_1)) __PYX_ERR(1, 271, __pyx_L1_error) + __Pyx_GOTREF(__pyx_t_1); + __pyx_t_3 = __Pyx_PyBytes_FromString(__pyx_v_format); if (unlikely(!__pyx_t_3)) __PYX_ERR(1, 271, __pyx_L1_error) + __Pyx_GOTREF(__pyx_t_3); + __pyx_t_4 = PyTuple_New(4); if (unlikely(!__pyx_t_4)) __PYX_ERR(1, 271, __pyx_L1_error) + __Pyx_GOTREF(__pyx_t_4); + __Pyx_INCREF(__pyx_v_shape); + __Pyx_GIVEREF(__pyx_v_shape); + if (__Pyx_PyTuple_SET_ITEM(__pyx_t_4, 0, __pyx_v_shape) != (0)) __PYX_ERR(1, 271, __pyx_L1_error); + __Pyx_GIVEREF(__pyx_t_1); + if (__Pyx_PyTuple_SET_ITEM(__pyx_t_4, 1, __pyx_t_1) != (0)) __PYX_ERR(1, 271, __pyx_L1_error); + __Pyx_GIVEREF(__pyx_t_3); + if (__Pyx_PyTuple_SET_ITEM(__pyx_t_4, 2, __pyx_t_3) != (0)) __PYX_ERR(1, 271, __pyx_L1_error); + __Pyx_INCREF(__pyx_v_mode); + __Pyx_GIVEREF(__pyx_v_mode); + if (__Pyx_PyTuple_SET_ITEM(__pyx_t_4, 3, __pyx_v_mode) != (0)) __PYX_ERR(1, 271, __pyx_L1_error); + __pyx_t_1 = 0; + __pyx_t_3 = 0; + __pyx_t_3 = ((PyObject *)__pyx_tp_new_array(((PyTypeObject *)__pyx_mstate_global->__pyx_array_type), __pyx_t_4, NULL)); if (unlikely(!__pyx_t_3)) __PYX_ERR(1, 271, __pyx_L1_error) + __Pyx_GOTREF((PyObject *)__pyx_t_3); + __Pyx_DECREF(__pyx_t_4); __pyx_t_4 = 0; + __pyx_v_result = ((struct __pyx_array_obj *)__pyx_t_3); + __pyx_t_3 = 0; + + /* "View.MemoryView":270 + * cdef str mode = "fortran" if c_mode[0] == b'f' else "c" # this often comes from a constant C string. + * + * if buf is NULL: # <<<<<<<<<<<<<< + * result = array.__new__(array, shape, itemsize, format, mode) + * else: +*/ + goto __pyx_L3; + } + + /* "View.MemoryView":273 + * result = array.__new__(array, shape, itemsize, format, mode) + * else: + * result = array.__new__(array, shape, itemsize, format, mode, allocate_buffer=False) # <<<<<<<<<<<<<< + * result.data = buf + * +*/ + /*else*/ { + __pyx_t_3 = PyLong_FromSsize_t(__pyx_v_itemsize); if (unlikely(!__pyx_t_3)) __PYX_ERR(1, 273, __pyx_L1_error) + __Pyx_GOTREF(__pyx_t_3); + __pyx_t_4 = __Pyx_PyBytes_FromString(__pyx_v_format); if (unlikely(!__pyx_t_4)) __PYX_ERR(1, 273, __pyx_L1_error) + __Pyx_GOTREF(__pyx_t_4); + __pyx_t_1 = PyTuple_New(4); if (unlikely(!__pyx_t_1)) __PYX_ERR(1, 273, __pyx_L1_error) + __Pyx_GOTREF(__pyx_t_1); + __Pyx_INCREF(__pyx_v_shape); + __Pyx_GIVEREF(__pyx_v_shape); + if (__Pyx_PyTuple_SET_ITEM(__pyx_t_1, 0, __pyx_v_shape) != (0)) __PYX_ERR(1, 273, __pyx_L1_error); + __Pyx_GIVEREF(__pyx_t_3); + if (__Pyx_PyTuple_SET_ITEM(__pyx_t_1, 1, __pyx_t_3) != (0)) __PYX_ERR(1, 273, __pyx_L1_error); + __Pyx_GIVEREF(__pyx_t_4); + if (__Pyx_PyTuple_SET_ITEM(__pyx_t_1, 2, __pyx_t_4) != (0)) __PYX_ERR(1, 273, __pyx_L1_error); + __Pyx_INCREF(__pyx_v_mode); + __Pyx_GIVEREF(__pyx_v_mode); + if (__Pyx_PyTuple_SET_ITEM(__pyx_t_1, 3, __pyx_v_mode) != (0)) __PYX_ERR(1, 273, __pyx_L1_error); + __pyx_t_3 = 0; + __pyx_t_4 = 0; + __pyx_t_4 = __Pyx_PyDict_NewPresized(1); if (unlikely(!__pyx_t_4)) __PYX_ERR(1, 273, __pyx_L1_error) + __Pyx_GOTREF(__pyx_t_4); + if (PyDict_SetItem(__pyx_t_4, __pyx_mstate_global->__pyx_n_u_allocate_buffer, Py_False) < (0)) __PYX_ERR(1, 273, __pyx_L1_error) + __pyx_t_3 = ((PyObject *)__pyx_tp_new_array(((PyTypeObject *)__pyx_mstate_global->__pyx_array_type), __pyx_t_1, __pyx_t_4)); if (unlikely(!__pyx_t_3)) __PYX_ERR(1, 273, __pyx_L1_error) + __Pyx_GOTREF((PyObject *)__pyx_t_3); + __Pyx_DECREF(__pyx_t_1); __pyx_t_1 = 0; + __Pyx_DECREF(__pyx_t_4); __pyx_t_4 = 0; + __pyx_v_result = ((struct __pyx_array_obj *)__pyx_t_3); + __pyx_t_3 = 0; + + /* "View.MemoryView":274 + * else: + * result = array.__new__(array, shape, itemsize, format, mode, allocate_buffer=False) + * result.data = buf # <<<<<<<<<<<<<< + * + * return result +*/ + __pyx_v_result->data = __pyx_v_buf; + } + __pyx_L3:; + + /* "View.MemoryView":276 + * result.data = buf + * + * return result # <<<<<<<<<<<<<< + * + * +*/ + __Pyx_XDECREF((PyObject *)__pyx_r); + __Pyx_INCREF((PyObject *)__pyx_v_result); + __pyx_r = __pyx_v_result; + goto __pyx_L0; + + /* "View.MemoryView":265 + * + * + * @cname("__pyx_array_new") # <<<<<<<<<<<<<< + * cdef array array_cwrapper(tuple shape, Py_ssize_t itemsize, char *format, const char *c_mode, char *buf): + * cdef array result +*/ + + /* function exit code */ + __pyx_L1_error:; + __Pyx_XDECREF(__pyx_t_1); + __Pyx_XDECREF(__pyx_t_3); + __Pyx_XDECREF(__pyx_t_4); + __Pyx_AddTraceback("View.MemoryView.array_cwrapper", __pyx_clineno, __pyx_lineno, __pyx_filename); + __pyx_r = 0; + __pyx_L0:; + __Pyx_XDECREF((PyObject *)__pyx_v_result); + __Pyx_XDECREF(__pyx_v_mode); + __Pyx_XGIVEREF((PyObject *)__pyx_r); + __Pyx_RefNannyFinishContext(); + return __pyx_r; +} + +/* "View.MemoryView":302 + * cdef class Enum(object): + * cdef object name + * def __init__(self, name): # <<<<<<<<<<<<<< + * self.name = name + * def __repr__(self): +*/ + +/* Python wrapper */ +static int __pyx_MemviewEnum___init__(PyObject *__pyx_v_self, PyObject *__pyx_args, PyObject *__pyx_kwds); /*proto*/ +static int __pyx_MemviewEnum___init__(PyObject *__pyx_v_self, PyObject *__pyx_args, PyObject *__pyx_kwds) { + PyObject *__pyx_v_name = 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_name,0}; + const Py_ssize_t __pyx_kwds_len = (__pyx_kwds) ? __Pyx_NumKwargs_VARARGS(__pyx_kwds) : 0; + if (unlikely(__pyx_kwds_len) < 0) __PYX_ERR(1, 302, __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(1, 302, __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(1, 302, __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(1, 302, __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(1, 302, __pyx_L3_error) + } + __pyx_v_name = values[0]; + } + goto __pyx_L6_skip; + __pyx_L5_argtuple_error:; + __Pyx_RaiseArgtupleInvalid("__init__", 1, 1, 1, __pyx_nargs); __PYX_ERR(1, 302, __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("View.MemoryView.Enum.__init__", __pyx_clineno, __pyx_lineno, __pyx_filename); + __Pyx_RefNannyFinishContext(); + return -1; + __pyx_L4_argument_unpacking_done:; + __pyx_r = __pyx_MemviewEnum___pyx_pf_15View_dot_MemoryView_4Enum___init__(((struct __pyx_MemviewEnum_obj *)__pyx_v_self), __pyx_v_name); + + /* 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_MemviewEnum___pyx_pf_15View_dot_MemoryView_4Enum___init__(struct __pyx_MemviewEnum_obj *__pyx_v_self, PyObject *__pyx_v_name) { + int __pyx_r; + __Pyx_RefNannyDeclarations + __Pyx_RefNannySetupContext("__init__", 0); + + /* "View.MemoryView":303 + * cdef object name + * def __init__(self, name): + * self.name = name # <<<<<<<<<<<<<< + * def __repr__(self): + * return self.name +*/ + __Pyx_INCREF(__pyx_v_name); + __Pyx_GIVEREF(__pyx_v_name); + __Pyx_GOTREF(__pyx_v_self->name); + __Pyx_DECREF(__pyx_v_self->name); + __pyx_v_self->name = __pyx_v_name; + + /* "View.MemoryView":302 + * cdef class Enum(object): + * cdef object name + * def __init__(self, name): # <<<<<<<<<<<<<< + * self.name = name + * def __repr__(self): +*/ + + /* function exit code */ + __pyx_r = 0; + __Pyx_RefNannyFinishContext(); + return __pyx_r; +} + +/* "View.MemoryView":304 + * def __init__(self, name): + * self.name = name + * def __repr__(self): # <<<<<<<<<<<<<< + * return self.name + * +*/ + +/* Python wrapper */ +static PyObject *__pyx_MemviewEnum___repr__(PyObject *__pyx_v_self); /*proto*/ +static PyObject *__pyx_MemviewEnum___repr__(PyObject *__pyx_v_self) { + CYTHON_UNUSED PyObject *const *__pyx_kwvalues; + PyObject *__pyx_r = 0; + __Pyx_RefNannyDeclarations + __Pyx_RefNannySetupContext("__repr__ (wrapper)", 0); + __pyx_kwvalues = __Pyx_KwValues_VARARGS(__pyx_args, __pyx_nargs); + __pyx_r = __pyx_MemviewEnum___pyx_pf_15View_dot_MemoryView_4Enum_2__repr__(((struct __pyx_MemviewEnum_obj *)__pyx_v_self)); + + /* function exit code */ + __Pyx_RefNannyFinishContext(); + return __pyx_r; +} + +static PyObject *__pyx_MemviewEnum___pyx_pf_15View_dot_MemoryView_4Enum_2__repr__(struct __pyx_MemviewEnum_obj *__pyx_v_self) { + PyObject *__pyx_r = NULL; + __Pyx_RefNannyDeclarations + __Pyx_RefNannySetupContext("__repr__", 0); + + /* "View.MemoryView":305 + * self.name = name + * def __repr__(self): + * return self.name # <<<<<<<<<<<<<< + * + * cdef generic = Enum("") +*/ + __Pyx_XDECREF(__pyx_r); + __Pyx_INCREF(__pyx_v_self->name); + __pyx_r = __pyx_v_self->name; + goto __pyx_L0; + + /* "View.MemoryView":304 + * def __init__(self, name): + * self.name = name + * def __repr__(self): # <<<<<<<<<<<<<< + * return self.name + * +*/ + + /* function exit code */ + __pyx_L0:; + __Pyx_XGIVEREF(__pyx_r); + __Pyx_RefNannyFinishContext(); + return __pyx_r; +} + +/* "(tree fragment)":1 + * def __reduce_cython__(self): # <<<<<<<<<<<<<< + * cdef tuple state + * cdef object _dict +*/ + +/* Python wrapper */ +static PyObject *__pyx_pw___pyx_MemviewEnum_1__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*/ +static PyObject *__pyx_pw___pyx_MemviewEnum_1__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___pyx_MemviewEnum___reduce_cython__(((struct __pyx_MemviewEnum_obj *)__pyx_v_self)); + + /* function exit code */ + __Pyx_RefNannyFinishContext(); + return __pyx_r; +} + +static PyObject *__pyx_pf___pyx_MemviewEnum___reduce_cython__(struct __pyx_MemviewEnum_obj *__pyx_v_self) { + PyObject *__pyx_v_state = 0; + PyObject *__pyx_v__dict = 0; + int __pyx_v_use_setstate; + PyObject *__pyx_r = NULL; + __Pyx_RefNannyDeclarations + PyObject *__pyx_t_1 = NULL; + int __pyx_t_2; + int __pyx_t_3; + PyObject *__pyx_t_4 = NULL; + PyObject *__pyx_t_5 = NULL; + int __pyx_lineno = 0; + const char *__pyx_filename = NULL; + int __pyx_clineno = 0; + __Pyx_RefNannySetupContext("__reduce_cython__", 0); + + /* "(tree fragment)":5 + * cdef object _dict + * cdef bint use_setstate + * state = (self.name,) # <<<<<<<<<<<<<< + * _dict = getattr(self, '__dict__', None) + * if _dict is not None and _dict: +*/ + __pyx_t_1 = PyTuple_New(1); if (unlikely(!__pyx_t_1)) __PYX_ERR(1, 5, __pyx_L1_error) + __Pyx_GOTREF(__pyx_t_1); + __Pyx_INCREF(__pyx_v_self->name); + __Pyx_GIVEREF(__pyx_v_self->name); + if (__Pyx_PyTuple_SET_ITEM(__pyx_t_1, 0, __pyx_v_self->name) != (0)) __PYX_ERR(1, 5, __pyx_L1_error); + __pyx_v_state = ((PyObject*)__pyx_t_1); + __pyx_t_1 = 0; + + /* "(tree fragment)":6 + * cdef bint use_setstate + * state = (self.name,) + * _dict = getattr(self, '__dict__', None) # <<<<<<<<<<<<<< + * if _dict is not None and _dict: + * state += (_dict,) +*/ + __pyx_t_1 = __Pyx_GetAttr3(((PyObject *)__pyx_v_self), __pyx_mstate_global->__pyx_n_u_dict, Py_None); if (unlikely(!__pyx_t_1)) __PYX_ERR(1, 6, __pyx_L1_error) + __Pyx_GOTREF(__pyx_t_1); + __pyx_v__dict = __pyx_t_1; + __pyx_t_1 = 0; + + /* "(tree fragment)":7 + * state = (self.name,) + * _dict = getattr(self, '__dict__', None) + * if _dict is not None and _dict: # <<<<<<<<<<<<<< + * state += (_dict,) + * use_setstate = True +*/ + __pyx_t_3 = (__pyx_v__dict != Py_None); + if (__pyx_t_3) { + } else { + __pyx_t_2 = __pyx_t_3; + goto __pyx_L4_bool_binop_done; + } + __pyx_t_3 = __Pyx_PyObject_IsTrue(__pyx_v__dict); if (unlikely((__pyx_t_3 < 0))) __PYX_ERR(1, 7, __pyx_L1_error) + __pyx_t_2 = __pyx_t_3; + __pyx_L4_bool_binop_done:; + if (__pyx_t_2) { + + /* "(tree fragment)":8 + * _dict = getattr(self, '__dict__', None) + * if _dict is not None and _dict: + * state += (_dict,) # <<<<<<<<<<<<<< + * use_setstate = True + * else: +*/ + __pyx_t_1 = PyTuple_New(1); if (unlikely(!__pyx_t_1)) __PYX_ERR(1, 8, __pyx_L1_error) + __Pyx_GOTREF(__pyx_t_1); + __Pyx_INCREF(__pyx_v__dict); + __Pyx_GIVEREF(__pyx_v__dict); + if (__Pyx_PyTuple_SET_ITEM(__pyx_t_1, 0, __pyx_v__dict) != (0)) __PYX_ERR(1, 8, __pyx_L1_error); + __pyx_t_4 = PyNumber_InPlaceAdd(__pyx_v_state, __pyx_t_1); if (unlikely(!__pyx_t_4)) __PYX_ERR(1, 8, __pyx_L1_error) + __Pyx_GOTREF(__pyx_t_4); + __Pyx_DECREF(__pyx_t_1); __pyx_t_1 = 0; + __Pyx_DECREF_SET(__pyx_v_state, ((PyObject*)__pyx_t_4)); + __pyx_t_4 = 0; + + /* "(tree fragment)":9 + * if _dict is not None and _dict: + * state += (_dict,) + * use_setstate = True # <<<<<<<<<<<<<< + * else: + * use_setstate = ('self.name is not None',) +*/ + __pyx_v_use_setstate = 1; + + /* "(tree fragment)":7 + * state = (self.name,) + * _dict = getattr(self, '__dict__', None) + * if _dict is not None and _dict: # <<<<<<<<<<<<<< + * state += (_dict,) + * use_setstate = True +*/ + goto __pyx_L3; + } + + /* "(tree fragment)":11 + * use_setstate = True + * else: + * use_setstate = ('self.name is not None',) # <<<<<<<<<<<<<< + * if use_setstate: + * return __pyx_unpickle_Enum, (type(self), 0x82a3537, None), state +*/ + /*else*/ { + __pyx_t_2 = __Pyx_PyObject_IsTrue(__pyx_mstate_global->__pyx_tuple[0]); if (unlikely((__pyx_t_2 == (int)-1) && PyErr_Occurred())) __PYX_ERR(1, 11, __pyx_L1_error) + __pyx_v_use_setstate = __pyx_t_2; + } + __pyx_L3:; + + /* "(tree fragment)":12 + * else: + * use_setstate = ('self.name is not None',) + * if use_setstate: # <<<<<<<<<<<<<< + * return __pyx_unpickle_Enum, (type(self), 0x82a3537, None), state + * else: +*/ + if (__pyx_v_use_setstate) { + + /* "(tree fragment)":13 + * use_setstate = ('self.name is not None',) + * if use_setstate: + * return __pyx_unpickle_Enum, (type(self), 0x82a3537, None), state # <<<<<<<<<<<<<< + * else: + * return __pyx_unpickle_Enum, (type(self), 0x82a3537, state) +*/ + __Pyx_XDECREF(__pyx_r); + __Pyx_GetModuleGlobalName(__pyx_t_4, __pyx_mstate_global->__pyx_n_u_pyx_unpickle_Enum); if (unlikely(!__pyx_t_4)) __PYX_ERR(1, 13, __pyx_L1_error) + __Pyx_GOTREF(__pyx_t_4); + __pyx_t_1 = PyTuple_New(3); if (unlikely(!__pyx_t_1)) __PYX_ERR(1, 13, __pyx_L1_error) + __Pyx_GOTREF(__pyx_t_1); + __Pyx_INCREF(((PyObject *)Py_TYPE(((PyObject *)__pyx_v_self)))); + __Pyx_GIVEREF(((PyObject *)Py_TYPE(((PyObject *)__pyx_v_self)))); + if (__Pyx_PyTuple_SET_ITEM(__pyx_t_1, 0, ((PyObject *)Py_TYPE(((PyObject *)__pyx_v_self)))) != (0)) __PYX_ERR(1, 13, __pyx_L1_error); + __Pyx_INCREF(__pyx_mstate_global->__pyx_int_136983863); + __Pyx_GIVEREF(__pyx_mstate_global->__pyx_int_136983863); + if (__Pyx_PyTuple_SET_ITEM(__pyx_t_1, 1, __pyx_mstate_global->__pyx_int_136983863) != (0)) __PYX_ERR(1, 13, __pyx_L1_error); + __Pyx_INCREF(Py_None); + __Pyx_GIVEREF(Py_None); + if (__Pyx_PyTuple_SET_ITEM(__pyx_t_1, 2, Py_None) != (0)) __PYX_ERR(1, 13, __pyx_L1_error); + __pyx_t_5 = PyTuple_New(3); if (unlikely(!__pyx_t_5)) __PYX_ERR(1, 13, __pyx_L1_error) + __Pyx_GOTREF(__pyx_t_5); + __Pyx_GIVEREF(__pyx_t_4); + if (__Pyx_PyTuple_SET_ITEM(__pyx_t_5, 0, __pyx_t_4) != (0)) __PYX_ERR(1, 13, __pyx_L1_error); + __Pyx_GIVEREF(__pyx_t_1); + if (__Pyx_PyTuple_SET_ITEM(__pyx_t_5, 1, __pyx_t_1) != (0)) __PYX_ERR(1, 13, __pyx_L1_error); + __Pyx_INCREF(__pyx_v_state); + __Pyx_GIVEREF(__pyx_v_state); + if (__Pyx_PyTuple_SET_ITEM(__pyx_t_5, 2, __pyx_v_state) != (0)) __PYX_ERR(1, 13, __pyx_L1_error); + __pyx_t_4 = 0; + __pyx_t_1 = 0; + __pyx_r = __pyx_t_5; + __pyx_t_5 = 0; + goto __pyx_L0; + + /* "(tree fragment)":12 + * else: + * use_setstate = ('self.name is not None',) + * if use_setstate: # <<<<<<<<<<<<<< + * return __pyx_unpickle_Enum, (type(self), 0x82a3537, None), state + * else: +*/ + } + + /* "(tree fragment)":15 + * return __pyx_unpickle_Enum, (type(self), 0x82a3537, None), state + * else: + * return __pyx_unpickle_Enum, (type(self), 0x82a3537, state) # <<<<<<<<<<<<<< + * def __setstate_cython__(self, __pyx_state): + * __pyx_unpickle_Enum__set_state(self, __pyx_state) +*/ + /*else*/ { + __Pyx_XDECREF(__pyx_r); + __Pyx_GetModuleGlobalName(__pyx_t_5, __pyx_mstate_global->__pyx_n_u_pyx_unpickle_Enum); if (unlikely(!__pyx_t_5)) __PYX_ERR(1, 15, __pyx_L1_error) + __Pyx_GOTREF(__pyx_t_5); + __pyx_t_1 = PyTuple_New(3); if (unlikely(!__pyx_t_1)) __PYX_ERR(1, 15, __pyx_L1_error) + __Pyx_GOTREF(__pyx_t_1); + __Pyx_INCREF(((PyObject *)Py_TYPE(((PyObject *)__pyx_v_self)))); + __Pyx_GIVEREF(((PyObject *)Py_TYPE(((PyObject *)__pyx_v_self)))); + if (__Pyx_PyTuple_SET_ITEM(__pyx_t_1, 0, ((PyObject *)Py_TYPE(((PyObject *)__pyx_v_self)))) != (0)) __PYX_ERR(1, 15, __pyx_L1_error); + __Pyx_INCREF(__pyx_mstate_global->__pyx_int_136983863); + __Pyx_GIVEREF(__pyx_mstate_global->__pyx_int_136983863); + if (__Pyx_PyTuple_SET_ITEM(__pyx_t_1, 1, __pyx_mstate_global->__pyx_int_136983863) != (0)) __PYX_ERR(1, 15, __pyx_L1_error); + __Pyx_INCREF(__pyx_v_state); + __Pyx_GIVEREF(__pyx_v_state); + if (__Pyx_PyTuple_SET_ITEM(__pyx_t_1, 2, __pyx_v_state) != (0)) __PYX_ERR(1, 15, __pyx_L1_error); + __pyx_t_4 = PyTuple_New(2); if (unlikely(!__pyx_t_4)) __PYX_ERR(1, 15, __pyx_L1_error) + __Pyx_GOTREF(__pyx_t_4); + __Pyx_GIVEREF(__pyx_t_5); + if (__Pyx_PyTuple_SET_ITEM(__pyx_t_4, 0, __pyx_t_5) != (0)) __PYX_ERR(1, 15, __pyx_L1_error); + __Pyx_GIVEREF(__pyx_t_1); + if (__Pyx_PyTuple_SET_ITEM(__pyx_t_4, 1, __pyx_t_1) != (0)) __PYX_ERR(1, 15, __pyx_L1_error); + __pyx_t_5 = 0; + __pyx_t_1 = 0; + __pyx_r = __pyx_t_4; + __pyx_t_4 = 0; + goto __pyx_L0; + } + + /* "(tree fragment)":1 + * def __reduce_cython__(self): # <<<<<<<<<<<<<< + * cdef tuple state + * cdef object _dict +*/ + + /* function exit code */ + __pyx_L1_error:; + __Pyx_XDECREF(__pyx_t_1); + __Pyx_XDECREF(__pyx_t_4); + __Pyx_XDECREF(__pyx_t_5); + __Pyx_AddTraceback("View.MemoryView.Enum.__reduce_cython__", __pyx_clineno, __pyx_lineno, __pyx_filename); + __pyx_r = NULL; + __pyx_L0:; + __Pyx_XDECREF(__pyx_v_state); + __Pyx_XDECREF(__pyx_v__dict); + __Pyx_XGIVEREF(__pyx_r); + __Pyx_RefNannyFinishContext(); + return __pyx_r; +} + +/* "(tree fragment)":16 + * else: + * return __pyx_unpickle_Enum, (type(self), 0x82a3537, state) + * def __setstate_cython__(self, __pyx_state): # <<<<<<<<<<<<<< + * __pyx_unpickle_Enum__set_state(self, __pyx_state) +*/ + +/* Python wrapper */ +static PyObject *__pyx_pw___pyx_MemviewEnum_3__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*/ +static PyObject *__pyx_pw___pyx_MemviewEnum_3__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 +) { + 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, 16, __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, 16, __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, 16, __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, 16, __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, 16, __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, 16, __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("View.MemoryView.Enum.__setstate_cython__", __pyx_clineno, __pyx_lineno, __pyx_filename); + __Pyx_RefNannyFinishContext(); + return NULL; + __pyx_L4_argument_unpacking_done:; + __pyx_r = __pyx_pf___pyx_MemviewEnum_2__setstate_cython__(((struct __pyx_MemviewEnum_obj *)__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___pyx_MemviewEnum_2__setstate_cython__(struct __pyx_MemviewEnum_obj *__pyx_v_self, PyObject *__pyx_v___pyx_state) { + PyObject *__pyx_r = NULL; + __Pyx_RefNannyDeclarations + PyObject *__pyx_t_1 = NULL; + PyObject *__pyx_t_2 = NULL; + int __pyx_lineno = 0; + const char *__pyx_filename = NULL; + int __pyx_clineno = 0; + __Pyx_RefNannySetupContext("__setstate_cython__", 0); + + /* "(tree fragment)":17 + * return __pyx_unpickle_Enum, (type(self), 0x82a3537, state) + * def __setstate_cython__(self, __pyx_state): + * __pyx_unpickle_Enum__set_state(self, __pyx_state) # <<<<<<<<<<<<<< +*/ + __pyx_t_1 = __pyx_v___pyx_state; + __Pyx_INCREF(__pyx_t_1); + if (!(likely(PyTuple_CheckExact(__pyx_t_1))||((__pyx_t_1) == Py_None) || __Pyx_RaiseUnexpectedTypeError("tuple", __pyx_t_1))) __PYX_ERR(1, 17, __pyx_L1_error) + if (unlikely(__pyx_t_1 == Py_None)) { + PyErr_SetString(PyExc_TypeError, "cannot pass None into a C function argument that is declared 'not None'"); + __PYX_ERR(1, 17, __pyx_L1_error) + } + __pyx_t_2 = __pyx_unpickle_Enum__set_state(__pyx_v_self, ((PyObject*)__pyx_t_1)); if (unlikely(!__pyx_t_2)) __PYX_ERR(1, 17, __pyx_L1_error) + __Pyx_GOTREF(__pyx_t_2); + __Pyx_DECREF(__pyx_t_1); __pyx_t_1 = 0; + __Pyx_DECREF(__pyx_t_2); __pyx_t_2 = 0; + + /* "(tree fragment)":16 + * else: + * return __pyx_unpickle_Enum, (type(self), 0x82a3537, state) + * def __setstate_cython__(self, __pyx_state): # <<<<<<<<<<<<<< + * __pyx_unpickle_Enum__set_state(self, __pyx_state) +*/ + + /* 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("View.MemoryView.Enum.__setstate_cython__", __pyx_clineno, __pyx_lineno, __pyx_filename); + __pyx_r = NULL; + __pyx_L0:; + __Pyx_XGIVEREF(__pyx_r); + __Pyx_RefNannyFinishContext(); + return __pyx_r; +} + +/* "View.MemoryView":348 + * cdef const __Pyx_TypeInfo *typeinfo + * + * def __cinit__(memoryview self, object obj, int flags, bint dtype_is_object=False): # <<<<<<<<<<<<<< + * self.obj = obj + * self.flags = flags +*/ + +/* Python wrapper */ +static int __pyx_memoryview___cinit__(PyObject *__pyx_v_self, PyObject *__pyx_args, PyObject *__pyx_kwds); /*proto*/ +static int __pyx_memoryview___cinit__(PyObject *__pyx_v_self, PyObject *__pyx_args, PyObject *__pyx_kwds) { + PyObject *__pyx_v_obj = 0; + int __pyx_v_flags; + int __pyx_v_dtype_is_object; + CYTHON_UNUSED Py_ssize_t __pyx_nargs; + 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; + 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_obj,&__pyx_mstate_global->__pyx_n_u_flags,&__pyx_mstate_global->__pyx_n_u_dtype_is_object,0}; + const Py_ssize_t __pyx_kwds_len = (__pyx_kwds) ? __Pyx_NumKwargs_VARARGS(__pyx_kwds) : 0; + if (unlikely(__pyx_kwds_len) < 0) __PYX_ERR(1, 348, __pyx_L3_error) + if (__pyx_kwds_len > 0) { + switch (__pyx_nargs) { + case 3: + values[2] = __Pyx_ArgRef_VARARGS(__pyx_args, 2); + if (!CYTHON_ASSUME_SAFE_MACROS && unlikely(!values[2])) __PYX_ERR(1, 348, __pyx_L3_error) + CYTHON_FALLTHROUGH; + case 2: + values[1] = __Pyx_ArgRef_VARARGS(__pyx_args, 1); + if (!CYTHON_ASSUME_SAFE_MACROS && unlikely(!values[1])) __PYX_ERR(1, 348, __pyx_L3_error) + CYTHON_FALLTHROUGH; + case 1: + values[0] = __Pyx_ArgRef_VARARGS(__pyx_args, 0); + if (!CYTHON_ASSUME_SAFE_MACROS && unlikely(!values[0])) __PYX_ERR(1, 348, __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(1, 348, __pyx_L3_error) + for (Py_ssize_t i = __pyx_nargs; i < 2; i++) { + if (unlikely(!values[i])) { __Pyx_RaiseArgtupleInvalid("__cinit__", 0, 2, 3, i); __PYX_ERR(1, 348, __pyx_L3_error) } + } + } else { + switch (__pyx_nargs) { + case 3: + values[2] = __Pyx_ArgRef_VARARGS(__pyx_args, 2); + if (!CYTHON_ASSUME_SAFE_MACROS && unlikely(!values[2])) __PYX_ERR(1, 348, __pyx_L3_error) + CYTHON_FALLTHROUGH; + case 2: + values[1] = __Pyx_ArgRef_VARARGS(__pyx_args, 1); + if (!CYTHON_ASSUME_SAFE_MACROS && unlikely(!values[1])) __PYX_ERR(1, 348, __pyx_L3_error) + values[0] = __Pyx_ArgRef_VARARGS(__pyx_args, 0); + if (!CYTHON_ASSUME_SAFE_MACROS && unlikely(!values[0])) __PYX_ERR(1, 348, __pyx_L3_error) + break; + default: goto __pyx_L5_argtuple_error; + } + } + __pyx_v_obj = values[0]; + __pyx_v_flags = __Pyx_PyLong_As_int(values[1]); if (unlikely((__pyx_v_flags == (int)-1) && PyErr_Occurred())) __PYX_ERR(1, 348, __pyx_L3_error) + if (values[2]) { + __pyx_v_dtype_is_object = __Pyx_PyObject_IsTrue(values[2]); if (unlikely((__pyx_v_dtype_is_object == (int)-1) && PyErr_Occurred())) __PYX_ERR(1, 348, __pyx_L3_error) + } else { + __pyx_v_dtype_is_object = ((int)0); + } + } + goto __pyx_L6_skip; + __pyx_L5_argtuple_error:; + __Pyx_RaiseArgtupleInvalid("__cinit__", 0, 2, 3, __pyx_nargs); __PYX_ERR(1, 348, __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("View.MemoryView.memoryview.__cinit__", __pyx_clineno, __pyx_lineno, __pyx_filename); + __Pyx_RefNannyFinishContext(); + return -1; + __pyx_L4_argument_unpacking_done:; + __pyx_r = __pyx_memoryview___pyx_pf_15View_dot_MemoryView_10memoryview___cinit__(((struct __pyx_memoryview_obj *)__pyx_v_self), __pyx_v_obj, __pyx_v_flags, __pyx_v_dtype_is_object); + + /* 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_memoryview___pyx_pf_15View_dot_MemoryView_10memoryview___cinit__(struct __pyx_memoryview_obj *__pyx_v_self, PyObject *__pyx_v_obj, int __pyx_v_flags, int __pyx_v_dtype_is_object) { + int __pyx_r; + __Pyx_RefNannyDeclarations + int __pyx_t_1; + int __pyx_t_2; + int __pyx_t_3; + Py_intptr_t __pyx_t_4; + size_t __pyx_t_5; + int __pyx_lineno = 0; + const char *__pyx_filename = NULL; + int __pyx_clineno = 0; + __Pyx_RefNannySetupContext("__cinit__", 0); + + /* "View.MemoryView":349 + * + * def __cinit__(memoryview self, object obj, int flags, bint dtype_is_object=False): + * self.obj = obj # <<<<<<<<<<<<<< + * self.flags = flags + * if type(self) is memoryview or obj is not None: +*/ + __Pyx_INCREF(__pyx_v_obj); + __Pyx_GIVEREF(__pyx_v_obj); + __Pyx_GOTREF(__pyx_v_self->obj); + __Pyx_DECREF(__pyx_v_self->obj); + __pyx_v_self->obj = __pyx_v_obj; + + /* "View.MemoryView":350 + * def __cinit__(memoryview self, object obj, int flags, bint dtype_is_object=False): + * self.obj = obj + * self.flags = flags # <<<<<<<<<<<<<< + * if type(self) is memoryview or obj is not None: + * PyObject_GetBuffer(obj, &self.view, flags) +*/ + __pyx_v_self->flags = __pyx_v_flags; + + /* "View.MemoryView":351 + * self.obj = obj + * self.flags = flags + * if type(self) is memoryview or obj is not None: # <<<<<<<<<<<<<< + * PyObject_GetBuffer(obj, &self.view, flags) + * if self.view.obj == NULL: +*/ + __pyx_t_2 = (((PyObject *)Py_TYPE(((PyObject *)__pyx_v_self))) == ((PyObject *)__pyx_mstate_global->__pyx_memoryview_type)); + if (!__pyx_t_2) { + } else { + __pyx_t_1 = __pyx_t_2; + goto __pyx_L4_bool_binop_done; + } + __pyx_t_2 = (__pyx_v_obj != Py_None); + __pyx_t_1 = __pyx_t_2; + __pyx_L4_bool_binop_done:; + if (__pyx_t_1) { + + /* "View.MemoryView":352 + * self.flags = flags + * if type(self) is memoryview or obj is not None: + * PyObject_GetBuffer(obj, &self.view, flags) # <<<<<<<<<<<<<< + * if self.view.obj == NULL: + * (<__pyx_buffer *> &self.view).obj = Py_None +*/ + __pyx_t_3 = PyObject_GetBuffer(__pyx_v_obj, (&__pyx_v_self->view), __pyx_v_flags); if (unlikely(__pyx_t_3 == ((int)-1))) __PYX_ERR(1, 352, __pyx_L1_error) + + /* "View.MemoryView":353 + * if type(self) is memoryview or obj is not None: + * PyObject_GetBuffer(obj, &self.view, flags) + * if self.view.obj == NULL: # <<<<<<<<<<<<<< + * (<__pyx_buffer *> &self.view).obj = Py_None + * Py_INCREF(Py_None) +*/ + __pyx_t_1 = (((PyObject *)__pyx_v_self->view.obj) == NULL); + if (__pyx_t_1) { + + /* "View.MemoryView":354 + * PyObject_GetBuffer(obj, &self.view, flags) + * if self.view.obj == NULL: + * (<__pyx_buffer *> &self.view).obj = Py_None # <<<<<<<<<<<<<< + * Py_INCREF(Py_None) + * +*/ + ((Py_buffer *)(&__pyx_v_self->view))->obj = Py_None; + + /* "View.MemoryView":355 + * if self.view.obj == NULL: + * (<__pyx_buffer *> &self.view).obj = Py_None + * Py_INCREF(Py_None) # <<<<<<<<<<<<<< + * + * if not __PYX_CYTHON_ATOMICS_ENABLED(): +*/ + Py_INCREF(Py_None); + + /* "View.MemoryView":353 + * if type(self) is memoryview or obj is not None: + * PyObject_GetBuffer(obj, &self.view, flags) + * if self.view.obj == NULL: # <<<<<<<<<<<<<< + * (<__pyx_buffer *> &self.view).obj = Py_None + * Py_INCREF(Py_None) +*/ + } + + /* "View.MemoryView":351 + * self.obj = obj + * self.flags = flags + * if type(self) is memoryview or obj is not None: # <<<<<<<<<<<<<< + * PyObject_GetBuffer(obj, &self.view, flags) + * if self.view.obj == NULL: +*/ + } + + /* "View.MemoryView":357 + * Py_INCREF(Py_None) + * + * if not __PYX_CYTHON_ATOMICS_ENABLED(): # <<<<<<<<<<<<<< + * global __pyx_memoryview_thread_locks_used + * if (__pyx_memoryview_thread_locks_used < 8 and +*/ + __pyx_t_1 = (!__PYX_CYTHON_ATOMICS_ENABLED()); + if (__pyx_t_1) { + + /* "View.MemoryView":359 + * if not __PYX_CYTHON_ATOMICS_ENABLED(): + * global __pyx_memoryview_thread_locks_used + * if (__pyx_memoryview_thread_locks_used < 8 and # <<<<<<<<<<<<<< + * + * not __PYX_GET_CYTHON_COMPILING_IN_CPYTHON_FREETHREADING()): +*/ + __pyx_t_2 = (__pyx_memoryview_thread_locks_used < 8); + if (__pyx_t_2) { + } else { + __pyx_t_1 = __pyx_t_2; + goto __pyx_L9_bool_binop_done; + } + + /* "View.MemoryView":361 + * if (__pyx_memoryview_thread_locks_used < 8 and + * + * not __PYX_GET_CYTHON_COMPILING_IN_CPYTHON_FREETHREADING()): # <<<<<<<<<<<<<< + * self.lock = __pyx_memoryview_thread_locks[__pyx_memoryview_thread_locks_used] + * __pyx_memoryview_thread_locks_used += 1 +*/ + __pyx_t_2 = (!__PYX_GET_CYTHON_COMPILING_IN_CPYTHON_FREETHREADING()); + __pyx_t_1 = __pyx_t_2; + __pyx_L9_bool_binop_done:; + + /* "View.MemoryView":359 + * if not __PYX_CYTHON_ATOMICS_ENABLED(): + * global __pyx_memoryview_thread_locks_used + * if (__pyx_memoryview_thread_locks_used < 8 and # <<<<<<<<<<<<<< + * + * not __PYX_GET_CYTHON_COMPILING_IN_CPYTHON_FREETHREADING()): +*/ + if (__pyx_t_1) { + + /* "View.MemoryView":362 + * + * not __PYX_GET_CYTHON_COMPILING_IN_CPYTHON_FREETHREADING()): + * self.lock = __pyx_memoryview_thread_locks[__pyx_memoryview_thread_locks_used] # <<<<<<<<<<<<<< + * __pyx_memoryview_thread_locks_used += 1 + * if self.lock is NULL: +*/ + __pyx_v_self->lock = (__pyx_memoryview_thread_locks[__pyx_memoryview_thread_locks_used]); + + /* "View.MemoryView":363 + * not __PYX_GET_CYTHON_COMPILING_IN_CPYTHON_FREETHREADING()): + * self.lock = __pyx_memoryview_thread_locks[__pyx_memoryview_thread_locks_used] + * __pyx_memoryview_thread_locks_used += 1 # <<<<<<<<<<<<<< + * if self.lock is NULL: + * self.lock = PyThread_allocate_lock() +*/ + __pyx_memoryview_thread_locks_used = (__pyx_memoryview_thread_locks_used + 1); + + /* "View.MemoryView":359 + * if not __PYX_CYTHON_ATOMICS_ENABLED(): + * global __pyx_memoryview_thread_locks_used + * if (__pyx_memoryview_thread_locks_used < 8 and # <<<<<<<<<<<<<< + * + * not __PYX_GET_CYTHON_COMPILING_IN_CPYTHON_FREETHREADING()): +*/ + } + + /* "View.MemoryView":364 + * self.lock = __pyx_memoryview_thread_locks[__pyx_memoryview_thread_locks_used] + * __pyx_memoryview_thread_locks_used += 1 + * if self.lock is NULL: # <<<<<<<<<<<<<< + * self.lock = PyThread_allocate_lock() + * if self.lock is NULL: +*/ + __pyx_t_1 = (__pyx_v_self->lock == NULL); + if (__pyx_t_1) { + + /* "View.MemoryView":365 + * __pyx_memoryview_thread_locks_used += 1 + * if self.lock is NULL: + * self.lock = PyThread_allocate_lock() # <<<<<<<<<<<<<< + * if self.lock is NULL: + * raise MemoryError +*/ + __pyx_v_self->lock = PyThread_allocate_lock(); + + /* "View.MemoryView":366 + * if self.lock is NULL: + * self.lock = PyThread_allocate_lock() + * if self.lock is NULL: # <<<<<<<<<<<<<< + * raise MemoryError + * +*/ + __pyx_t_1 = (__pyx_v_self->lock == NULL); + if (unlikely(__pyx_t_1)) { + + /* "View.MemoryView":367 + * self.lock = PyThread_allocate_lock() + * if self.lock is NULL: + * raise MemoryError # <<<<<<<<<<<<<< + * + * if flags & PyBUF_FORMAT: +*/ + PyErr_NoMemory(); __PYX_ERR(1, 367, __pyx_L1_error) + + /* "View.MemoryView":366 + * if self.lock is NULL: + * self.lock = PyThread_allocate_lock() + * if self.lock is NULL: # <<<<<<<<<<<<<< + * raise MemoryError + * +*/ + } + + /* "View.MemoryView":364 + * self.lock = __pyx_memoryview_thread_locks[__pyx_memoryview_thread_locks_used] + * __pyx_memoryview_thread_locks_used += 1 + * if self.lock is NULL: # <<<<<<<<<<<<<< + * self.lock = PyThread_allocate_lock() + * if self.lock is NULL: +*/ + } + + /* "View.MemoryView":357 + * Py_INCREF(Py_None) + * + * if not __PYX_CYTHON_ATOMICS_ENABLED(): # <<<<<<<<<<<<<< + * global __pyx_memoryview_thread_locks_used + * if (__pyx_memoryview_thread_locks_used < 8 and +*/ + } + + /* "View.MemoryView":369 + * raise MemoryError + * + * if flags & PyBUF_FORMAT: # <<<<<<<<<<<<<< + * self.dtype_is_object = (self.view.format[0] == b'O' and self.view.format[1] == b'\0') + * else: +*/ + __pyx_t_1 = ((__pyx_v_flags & PyBUF_FORMAT) != 0); + if (__pyx_t_1) { + + /* "View.MemoryView":370 + * + * if flags & PyBUF_FORMAT: + * self.dtype_is_object = (self.view.format[0] == b'O' and self.view.format[1] == b'\0') # <<<<<<<<<<<<<< + * else: + * self.dtype_is_object = dtype_is_object +*/ + __pyx_t_2 = ((__pyx_v_self->view.format[0]) == 'O'); + if (__pyx_t_2) { + } else { + __pyx_t_1 = __pyx_t_2; + goto __pyx_L14_bool_binop_done; + } + __pyx_t_2 = ((__pyx_v_self->view.format[1]) == '\x00'); + __pyx_t_1 = __pyx_t_2; + __pyx_L14_bool_binop_done:; + __pyx_v_self->dtype_is_object = __pyx_t_1; + + /* "View.MemoryView":369 + * raise MemoryError + * + * if flags & PyBUF_FORMAT: # <<<<<<<<<<<<<< + * self.dtype_is_object = (self.view.format[0] == b'O' and self.view.format[1] == b'\0') + * else: +*/ + goto __pyx_L13; + } + + /* "View.MemoryView":372 + * self.dtype_is_object = (self.view.format[0] == b'O' and self.view.format[1] == b'\0') + * else: + * self.dtype_is_object = dtype_is_object # <<<<<<<<<<<<<< + * + * assert (&self.acquisition_count) % sizeof(__pyx_atomic_int_type) == 0 +*/ + /*else*/ { + __pyx_v_self->dtype_is_object = __pyx_v_dtype_is_object; + } + __pyx_L13:; + + /* "View.MemoryView":374 + * self.dtype_is_object = dtype_is_object + * + * assert (&self.acquisition_count) % sizeof(__pyx_atomic_int_type) == 0 # <<<<<<<<<<<<<< + * self.typeinfo = NULL + * +*/ + #ifndef CYTHON_WITHOUT_ASSERTIONS + if (unlikely(__pyx_assertions_enabled())) { + __pyx_t_4 = ((Py_intptr_t)((void *)(&__pyx_v_self->acquisition_count))); + __pyx_t_5 = (sizeof(__pyx_atomic_int_type)); + if (unlikely(__pyx_t_5 == 0)) { + PyErr_SetString(PyExc_ZeroDivisionError, "integer division or modulo by zero"); + __PYX_ERR(1, 374, __pyx_L1_error) + } + __pyx_t_1 = ((__pyx_t_4 % __pyx_t_5) == 0); + if (unlikely(!__pyx_t_1)) { + __Pyx_Raise(((PyObject *)(((PyTypeObject*)PyExc_AssertionError))), 0, 0, 0); + __PYX_ERR(1, 374, __pyx_L1_error) + } + } + #else + if ((1)); else __PYX_ERR(1, 374, __pyx_L1_error) + #endif + + /* "View.MemoryView":375 + * + * assert (&self.acquisition_count) % sizeof(__pyx_atomic_int_type) == 0 + * self.typeinfo = NULL # <<<<<<<<<<<<<< + * + * def __dealloc__(memoryview self): +*/ + __pyx_v_self->typeinfo = NULL; + + /* "View.MemoryView":348 + * cdef const __Pyx_TypeInfo *typeinfo + * + * def __cinit__(memoryview self, object obj, int flags, bint dtype_is_object=False): # <<<<<<<<<<<<<< + * self.obj = obj + * self.flags = flags +*/ + + /* function exit code */ + __pyx_r = 0; + goto __pyx_L0; + __pyx_L1_error:; + __Pyx_AddTraceback("View.MemoryView.memoryview.__cinit__", __pyx_clineno, __pyx_lineno, __pyx_filename); + __pyx_r = -1; + __pyx_L0:; + __Pyx_RefNannyFinishContext(); + return __pyx_r; +} + +/* "View.MemoryView":377 + * self.typeinfo = NULL + * + * def __dealloc__(memoryview self): # <<<<<<<<<<<<<< + * if self.obj is not None: + * PyBuffer_Release(&self.view) +*/ + +/* Python wrapper */ +static void __pyx_memoryview___dealloc__(PyObject *__pyx_v_self); /*proto*/ +static void __pyx_memoryview___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_memoryview___pyx_pf_15View_dot_MemoryView_10memoryview_2__dealloc__(((struct __pyx_memoryview_obj *)__pyx_v_self)); + + /* function exit code */ + __Pyx_RefNannyFinishContext(); +} + +static void __pyx_memoryview___pyx_pf_15View_dot_MemoryView_10memoryview_2__dealloc__(struct __pyx_memoryview_obj *__pyx_v_self) { + int __pyx_v_i; + int __pyx_t_1; + Py_ssize_t __pyx_t_2; + Py_ssize_t __pyx_t_3; + int __pyx_t_4; + PyThread_type_lock __pyx_t_5; + PyThread_type_lock __pyx_t_6; + + /* "View.MemoryView":378 + * + * def __dealloc__(memoryview self): + * if self.obj is not None: # <<<<<<<<<<<<<< + * PyBuffer_Release(&self.view) + * elif (<__pyx_buffer *> &self.view).obj == Py_None: +*/ + __pyx_t_1 = (__pyx_v_self->obj != Py_None); + if (__pyx_t_1) { + + /* "View.MemoryView":379 + * def __dealloc__(memoryview self): + * if self.obj is not None: + * PyBuffer_Release(&self.view) # <<<<<<<<<<<<<< + * elif (<__pyx_buffer *> &self.view).obj == Py_None: + * +*/ + PyBuffer_Release((&__pyx_v_self->view)); + + /* "View.MemoryView":378 + * + * def __dealloc__(memoryview self): + * if self.obj is not None: # <<<<<<<<<<<<<< + * PyBuffer_Release(&self.view) + * elif (<__pyx_buffer *> &self.view).obj == Py_None: +*/ + goto __pyx_L3; + } + + /* "View.MemoryView":380 + * if self.obj is not None: + * PyBuffer_Release(&self.view) + * elif (<__pyx_buffer *> &self.view).obj == Py_None: # <<<<<<<<<<<<<< + * + * (<__pyx_buffer *> &self.view).obj = NULL +*/ + __pyx_t_1 = (((Py_buffer *)(&__pyx_v_self->view))->obj == Py_None); + if (__pyx_t_1) { + + /* "View.MemoryView":382 + * elif (<__pyx_buffer *> &self.view).obj == Py_None: + * + * (<__pyx_buffer *> &self.view).obj = NULL # <<<<<<<<<<<<<< + * Py_DECREF(Py_None) + * +*/ + ((Py_buffer *)(&__pyx_v_self->view))->obj = NULL; + + /* "View.MemoryView":383 + * + * (<__pyx_buffer *> &self.view).obj = NULL + * Py_DECREF(Py_None) # <<<<<<<<<<<<<< + * + * cdef int i +*/ + Py_DECREF(Py_None); + + /* "View.MemoryView":380 + * if self.obj is not None: + * PyBuffer_Release(&self.view) + * elif (<__pyx_buffer *> &self.view).obj == Py_None: # <<<<<<<<<<<<<< + * + * (<__pyx_buffer *> &self.view).obj = NULL +*/ + } + __pyx_L3:; + + /* "View.MemoryView":387 + * cdef int i + * global __pyx_memoryview_thread_locks_used + * if self.lock != NULL: # <<<<<<<<<<<<<< + * for i in range(0 if __PYX_GET_CYTHON_COMPILING_IN_CPYTHON_FREETHREADING() else __pyx_memoryview_thread_locks_used): + * if __pyx_memoryview_thread_locks[i] is self.lock: +*/ + __pyx_t_1 = (__pyx_v_self->lock != NULL); + if (__pyx_t_1) { + + /* "View.MemoryView":388 + * global __pyx_memoryview_thread_locks_used + * if self.lock != NULL: + * for i in range(0 if __PYX_GET_CYTHON_COMPILING_IN_CPYTHON_FREETHREADING() else __pyx_memoryview_thread_locks_used): # <<<<<<<<<<<<<< + * if __pyx_memoryview_thread_locks[i] is self.lock: + * __pyx_memoryview_thread_locks_used -= 1 +*/ + __pyx_t_1 = __PYX_GET_CYTHON_COMPILING_IN_CPYTHON_FREETHREADING(); + if (__pyx_t_1) { + __pyx_t_2 = 0; + } else { + __pyx_t_2 = __pyx_memoryview_thread_locks_used; + } + __pyx_t_3 = __pyx_t_2; + for (__pyx_t_4 = 0; __pyx_t_4 < __pyx_t_3; __pyx_t_4+=1) { + __pyx_v_i = __pyx_t_4; + + /* "View.MemoryView":389 + * if self.lock != NULL: + * for i in range(0 if __PYX_GET_CYTHON_COMPILING_IN_CPYTHON_FREETHREADING() else __pyx_memoryview_thread_locks_used): + * if __pyx_memoryview_thread_locks[i] is self.lock: # <<<<<<<<<<<<<< + * __pyx_memoryview_thread_locks_used -= 1 + * if i != __pyx_memoryview_thread_locks_used: +*/ + __pyx_t_1 = ((__pyx_memoryview_thread_locks[__pyx_v_i]) == __pyx_v_self->lock); + if (__pyx_t_1) { + + /* "View.MemoryView":390 + * for i in range(0 if __PYX_GET_CYTHON_COMPILING_IN_CPYTHON_FREETHREADING() else __pyx_memoryview_thread_locks_used): + * if __pyx_memoryview_thread_locks[i] is self.lock: + * __pyx_memoryview_thread_locks_used -= 1 # <<<<<<<<<<<<<< + * if i != __pyx_memoryview_thread_locks_used: + * __pyx_memoryview_thread_locks[i], __pyx_memoryview_thread_locks[__pyx_memoryview_thread_locks_used] = ( +*/ + __pyx_memoryview_thread_locks_used = (__pyx_memoryview_thread_locks_used - 1); + + /* "View.MemoryView":391 + * if __pyx_memoryview_thread_locks[i] is self.lock: + * __pyx_memoryview_thread_locks_used -= 1 + * if i != __pyx_memoryview_thread_locks_used: # <<<<<<<<<<<<<< + * __pyx_memoryview_thread_locks[i], __pyx_memoryview_thread_locks[__pyx_memoryview_thread_locks_used] = ( + * __pyx_memoryview_thread_locks[__pyx_memoryview_thread_locks_used], __pyx_memoryview_thread_locks[i]) +*/ + __pyx_t_1 = (__pyx_v_i != __pyx_memoryview_thread_locks_used); + if (__pyx_t_1) { + + /* "View.MemoryView":393 + * if i != __pyx_memoryview_thread_locks_used: + * __pyx_memoryview_thread_locks[i], __pyx_memoryview_thread_locks[__pyx_memoryview_thread_locks_used] = ( + * __pyx_memoryview_thread_locks[__pyx_memoryview_thread_locks_used], __pyx_memoryview_thread_locks[i]) # <<<<<<<<<<<<<< + * break + * else: +*/ + __pyx_t_5 = (__pyx_memoryview_thread_locks[__pyx_memoryview_thread_locks_used]); + __pyx_t_6 = (__pyx_memoryview_thread_locks[__pyx_v_i]); + + /* "View.MemoryView":392 + * __pyx_memoryview_thread_locks_used -= 1 + * if i != __pyx_memoryview_thread_locks_used: + * __pyx_memoryview_thread_locks[i], __pyx_memoryview_thread_locks[__pyx_memoryview_thread_locks_used] = ( # <<<<<<<<<<<<<< + * __pyx_memoryview_thread_locks[__pyx_memoryview_thread_locks_used], __pyx_memoryview_thread_locks[i]) + * break +*/ + (__pyx_memoryview_thread_locks[__pyx_v_i]) = __pyx_t_5; + (__pyx_memoryview_thread_locks[__pyx_memoryview_thread_locks_used]) = __pyx_t_6; + + /* "View.MemoryView":391 + * if __pyx_memoryview_thread_locks[i] is self.lock: + * __pyx_memoryview_thread_locks_used -= 1 + * if i != __pyx_memoryview_thread_locks_used: # <<<<<<<<<<<<<< + * __pyx_memoryview_thread_locks[i], __pyx_memoryview_thread_locks[__pyx_memoryview_thread_locks_used] = ( + * __pyx_memoryview_thread_locks[__pyx_memoryview_thread_locks_used], __pyx_memoryview_thread_locks[i]) +*/ + } + + /* "View.MemoryView":394 + * __pyx_memoryview_thread_locks[i], __pyx_memoryview_thread_locks[__pyx_memoryview_thread_locks_used] = ( + * __pyx_memoryview_thread_locks[__pyx_memoryview_thread_locks_used], __pyx_memoryview_thread_locks[i]) + * break # <<<<<<<<<<<<<< + * else: + * PyThread_free_lock(self.lock) +*/ + goto __pyx_L6_break; + + /* "View.MemoryView":389 + * if self.lock != NULL: + * for i in range(0 if __PYX_GET_CYTHON_COMPILING_IN_CPYTHON_FREETHREADING() else __pyx_memoryview_thread_locks_used): + * if __pyx_memoryview_thread_locks[i] is self.lock: # <<<<<<<<<<<<<< + * __pyx_memoryview_thread_locks_used -= 1 + * if i != __pyx_memoryview_thread_locks_used: +*/ + } + } + /*else*/ { + + /* "View.MemoryView":396 + * break + * else: + * PyThread_free_lock(self.lock) # <<<<<<<<<<<<<< + * + * cdef char *get_item_pointer(memoryview self, object index) except NULL: +*/ + PyThread_free_lock(__pyx_v_self->lock); + } + __pyx_L6_break:; + + /* "View.MemoryView":387 + * cdef int i + * global __pyx_memoryview_thread_locks_used + * if self.lock != NULL: # <<<<<<<<<<<<<< + * for i in range(0 if __PYX_GET_CYTHON_COMPILING_IN_CPYTHON_FREETHREADING() else __pyx_memoryview_thread_locks_used): + * if __pyx_memoryview_thread_locks[i] is self.lock: +*/ + } + + /* "View.MemoryView":377 + * self.typeinfo = NULL + * + * def __dealloc__(memoryview self): # <<<<<<<<<<<<<< + * if self.obj is not None: + * PyBuffer_Release(&self.view) +*/ + + /* function exit code */ +} + +/* "View.MemoryView":398 + * PyThread_free_lock(self.lock) + * + * cdef char *get_item_pointer(memoryview self, object index) except NULL: # <<<<<<<<<<<<<< + * cdef Py_ssize_t dim + * cdef char *itemp = self.view.buf +*/ + +static char *__pyx_memoryview_get_item_pointer(struct __pyx_memoryview_obj *__pyx_v_self, PyObject *__pyx_v_index) { + Py_ssize_t __pyx_v_dim; + char *__pyx_v_itemp; + PyObject *__pyx_v_idx = NULL; + char *__pyx_r; + __Pyx_RefNannyDeclarations + Py_ssize_t __pyx_t_1; + PyObject *__pyx_t_2 = NULL; + Py_ssize_t __pyx_t_3; + PyObject *(*__pyx_t_4)(PyObject *); + PyObject *__pyx_t_5 = NULL; + Py_ssize_t __pyx_t_6; + char *__pyx_t_7; + int __pyx_lineno = 0; + const char *__pyx_filename = NULL; + int __pyx_clineno = 0; + __Pyx_RefNannySetupContext("get_item_pointer", 0); + + /* "View.MemoryView":400 + * cdef char *get_item_pointer(memoryview self, object index) except NULL: + * cdef Py_ssize_t dim + * cdef char *itemp = self.view.buf # <<<<<<<<<<<<<< + * + * for dim, idx in enumerate(index): +*/ + __pyx_v_itemp = ((char *)__pyx_v_self->view.buf); + + /* "View.MemoryView":402 + * cdef char *itemp = self.view.buf + * + * for dim, idx in enumerate(index): # <<<<<<<<<<<<<< + * itemp = pybuffer_index(&self.view, itemp, idx, dim) + * +*/ + __pyx_t_1 = 0; + if (likely(PyList_CheckExact(__pyx_v_index)) || PyTuple_CheckExact(__pyx_v_index)) { + __pyx_t_2 = __pyx_v_index; __Pyx_INCREF(__pyx_t_2); + __pyx_t_3 = 0; + __pyx_t_4 = NULL; + } else { + __pyx_t_3 = -1; __pyx_t_2 = PyObject_GetIter(__pyx_v_index); if (unlikely(!__pyx_t_2)) __PYX_ERR(1, 402, __pyx_L1_error) + __Pyx_GOTREF(__pyx_t_2); + __pyx_t_4 = (CYTHON_COMPILING_IN_LIMITED_API) ? PyIter_Next : __Pyx_PyObject_GetIterNextFunc(__pyx_t_2); if (unlikely(!__pyx_t_4)) __PYX_ERR(1, 402, __pyx_L1_error) + } + for (;;) { + if (likely(!__pyx_t_4)) { + if (likely(PyList_CheckExact(__pyx_t_2))) { + { + Py_ssize_t __pyx_temp = __Pyx_PyList_GET_SIZE(__pyx_t_2); + #if !CYTHON_ASSUME_SAFE_SIZE + if (unlikely((__pyx_temp < 0))) __PYX_ERR(1, 402, __pyx_L1_error) + #endif + if (__pyx_t_3 >= __pyx_temp) break; + } + __pyx_t_5 = __Pyx_PyList_GetItemRefFast(__pyx_t_2, __pyx_t_3, __Pyx_ReferenceSharing_OwnStrongReference); + ++__pyx_t_3; + } else { + { + Py_ssize_t __pyx_temp = __Pyx_PyTuple_GET_SIZE(__pyx_t_2); + #if !CYTHON_ASSUME_SAFE_SIZE + if (unlikely((__pyx_temp < 0))) __PYX_ERR(1, 402, __pyx_L1_error) + #endif + if (__pyx_t_3 >= __pyx_temp) break; + } + #if CYTHON_ASSUME_SAFE_MACROS && !CYTHON_AVOID_BORROWED_REFS + __pyx_t_5 = __Pyx_NewRef(PyTuple_GET_ITEM(__pyx_t_2, __pyx_t_3)); + #else + __pyx_t_5 = __Pyx_PySequence_ITEM(__pyx_t_2, __pyx_t_3); + #endif + ++__pyx_t_3; + } + if (unlikely(!__pyx_t_5)) __PYX_ERR(1, 402, __pyx_L1_error) + } else { + __pyx_t_5 = __pyx_t_4(__pyx_t_2); + if (unlikely(!__pyx_t_5)) { + PyObject* exc_type = PyErr_Occurred(); + if (exc_type) { + if (unlikely(!__Pyx_PyErr_GivenExceptionMatches(exc_type, PyExc_StopIteration))) __PYX_ERR(1, 402, __pyx_L1_error) + PyErr_Clear(); + } + break; + } + } + __Pyx_GOTREF(__pyx_t_5); + __Pyx_XDECREF_SET(__pyx_v_idx, __pyx_t_5); + __pyx_t_5 = 0; + __pyx_v_dim = __pyx_t_1; + __pyx_t_1 = (__pyx_t_1 + 1); + + /* "View.MemoryView":403 + * + * for dim, idx in enumerate(index): + * itemp = pybuffer_index(&self.view, itemp, idx, dim) # <<<<<<<<<<<<<< + * + * return itemp +*/ + __pyx_t_6 = __Pyx_PyIndex_AsSsize_t(__pyx_v_idx); if (unlikely((__pyx_t_6 == (Py_ssize_t)-1) && PyErr_Occurred())) __PYX_ERR(1, 403, __pyx_L1_error) + __pyx_t_7 = __pyx_pybuffer_index((&__pyx_v_self->view), __pyx_v_itemp, __pyx_t_6, __pyx_v_dim); if (unlikely(__pyx_t_7 == ((void *)NULL))) __PYX_ERR(1, 403, __pyx_L1_error) + __pyx_v_itemp = __pyx_t_7; + + /* "View.MemoryView":402 + * cdef char *itemp = self.view.buf + * + * for dim, idx in enumerate(index): # <<<<<<<<<<<<<< + * itemp = pybuffer_index(&self.view, itemp, idx, dim) + * +*/ + } + __Pyx_DECREF(__pyx_t_2); __pyx_t_2 = 0; + + /* "View.MemoryView":405 + * itemp = pybuffer_index(&self.view, itemp, idx, dim) + * + * return itemp # <<<<<<<<<<<<<< + * + * +*/ + __pyx_r = __pyx_v_itemp; + goto __pyx_L0; + + /* "View.MemoryView":398 + * PyThread_free_lock(self.lock) + * + * cdef char *get_item_pointer(memoryview self, object index) except NULL: # <<<<<<<<<<<<<< + * cdef Py_ssize_t dim + * cdef char *itemp = self.view.buf +*/ + + /* function exit code */ + __pyx_L1_error:; + __Pyx_XDECREF(__pyx_t_2); + __Pyx_XDECREF(__pyx_t_5); + __Pyx_AddTraceback("View.MemoryView.memoryview.get_item_pointer", __pyx_clineno, __pyx_lineno, __pyx_filename); + __pyx_r = NULL; + __pyx_L0:; + __Pyx_XDECREF(__pyx_v_idx); + __Pyx_RefNannyFinishContext(); + return __pyx_r; +} + +/* "View.MemoryView":408 + * + * + * def __getitem__(memoryview self, object index): # <<<<<<<<<<<<<< + * if index is Ellipsis: + * return self +*/ + +/* Python wrapper */ +static PyObject *__pyx_memoryview___getitem__(PyObject *__pyx_v_self, PyObject *__pyx_v_index); /*proto*/ +static PyObject *__pyx_memoryview___getitem__(PyObject *__pyx_v_self, PyObject *__pyx_v_index) { + CYTHON_UNUSED PyObject *const *__pyx_kwvalues; + PyObject *__pyx_r = 0; + __Pyx_RefNannyDeclarations + __Pyx_RefNannySetupContext("__getitem__ (wrapper)", 0); + __pyx_kwvalues = __Pyx_KwValues_VARARGS(__pyx_args, __pyx_nargs); + __pyx_r = __pyx_memoryview___pyx_pf_15View_dot_MemoryView_10memoryview_4__getitem__(((struct __pyx_memoryview_obj *)__pyx_v_self), ((PyObject *)__pyx_v_index)); + + /* function exit code */ + __Pyx_RefNannyFinishContext(); + return __pyx_r; +} + +static PyObject *__pyx_memoryview___pyx_pf_15View_dot_MemoryView_10memoryview_4__getitem__(struct __pyx_memoryview_obj *__pyx_v_self, PyObject *__pyx_v_index) { + PyObject *__pyx_v_have_slices = NULL; + PyObject *__pyx_v_indices = NULL; + char *__pyx_v_itemp; + 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; + char *__pyx_t_5; + int __pyx_lineno = 0; + const char *__pyx_filename = NULL; + int __pyx_clineno = 0; + __Pyx_RefNannySetupContext("__getitem__", 0); + + /* "View.MemoryView":409 + * + * def __getitem__(memoryview self, object index): + * if index is Ellipsis: # <<<<<<<<<<<<<< + * return self + * +*/ + __pyx_t_1 = (__pyx_v_index == __pyx_builtin_Ellipsis); + if (__pyx_t_1) { + + /* "View.MemoryView":410 + * def __getitem__(memoryview self, object index): + * if index is Ellipsis: + * return self # <<<<<<<<<<<<<< + * + * have_slices, indices = _unellipsify(index, self.view.ndim) +*/ + __Pyx_XDECREF(__pyx_r); + __Pyx_INCREF((PyObject *)__pyx_v_self); + __pyx_r = ((PyObject *)__pyx_v_self); + goto __pyx_L0; + + /* "View.MemoryView":409 + * + * def __getitem__(memoryview self, object index): + * if index is Ellipsis: # <<<<<<<<<<<<<< + * return self + * +*/ + } + + /* "View.MemoryView":412 + * return self + * + * have_slices, indices = _unellipsify(index, self.view.ndim) # <<<<<<<<<<<<<< + * + * cdef char *itemp +*/ + __pyx_t_2 = _unellipsify(__pyx_v_index, __pyx_v_self->view.ndim); if (unlikely(!__pyx_t_2)) __PYX_ERR(1, 412, __pyx_L1_error) + __Pyx_GOTREF(__pyx_t_2); + if (likely(__pyx_t_2 != Py_None)) { + PyObject* sequence = __pyx_t_2; + Py_ssize_t size = __Pyx_PyTuple_GET_SIZE(sequence); + if (unlikely(size != 2)) { + if (size > 2) __Pyx_RaiseTooManyValuesError(2); + else if (size >= 0) __Pyx_RaiseNeedMoreValuesError(size); + __PYX_ERR(1, 412, __pyx_L1_error) + } + #if CYTHON_ASSUME_SAFE_MACROS && !CYTHON_AVOID_BORROWED_REFS + __pyx_t_3 = PyTuple_GET_ITEM(sequence, 0); + __Pyx_INCREF(__pyx_t_3); + __pyx_t_4 = PyTuple_GET_ITEM(sequence, 1); + __Pyx_INCREF(__pyx_t_4); + #else + __pyx_t_3 = __Pyx_PySequence_ITEM(sequence, 0); if (unlikely(!__pyx_t_3)) __PYX_ERR(1, 412, __pyx_L1_error) + __Pyx_GOTREF(__pyx_t_3); + __pyx_t_4 = __Pyx_PySequence_ITEM(sequence, 1); if (unlikely(!__pyx_t_4)) __PYX_ERR(1, 412, __pyx_L1_error) + __Pyx_GOTREF(__pyx_t_4); + #endif + __Pyx_DECREF(__pyx_t_2); __pyx_t_2 = 0; + } else { + __Pyx_RaiseNoneNotIterableError(); __PYX_ERR(1, 412, __pyx_L1_error) + } + __pyx_v_have_slices = __pyx_t_3; + __pyx_t_3 = 0; + __pyx_v_indices = __pyx_t_4; + __pyx_t_4 = 0; + + /* "View.MemoryView":415 + * + * cdef char *itemp + * if have_slices: # <<<<<<<<<<<<<< + * return memview_slice(self, indices) + * else: +*/ + __pyx_t_1 = __Pyx_PyObject_IsTrue(__pyx_v_have_slices); if (unlikely((__pyx_t_1 < 0))) __PYX_ERR(1, 415, __pyx_L1_error) + if (__pyx_t_1) { + + /* "View.MemoryView":416 + * cdef char *itemp + * if have_slices: + * return memview_slice(self, indices) # <<<<<<<<<<<<<< + * else: + * itemp = self.get_item_pointer(indices) +*/ + __Pyx_XDECREF(__pyx_r); + __pyx_t_2 = ((PyObject *)__pyx_memview_slice(__pyx_v_self, __pyx_v_indices)); if (unlikely(!__pyx_t_2)) __PYX_ERR(1, 416, __pyx_L1_error) + __Pyx_GOTREF(__pyx_t_2); + __pyx_r = __pyx_t_2; + __pyx_t_2 = 0; + goto __pyx_L0; + + /* "View.MemoryView":415 + * + * cdef char *itemp + * if have_slices: # <<<<<<<<<<<<<< + * return memview_slice(self, indices) + * else: +*/ + } + + /* "View.MemoryView":418 + * return memview_slice(self, indices) + * else: + * itemp = self.get_item_pointer(indices) # <<<<<<<<<<<<<< + * return self.convert_item_to_object(itemp) + * +*/ + /*else*/ { + __pyx_t_5 = ((struct __pyx_vtabstruct_memoryview *)__pyx_v_self->__pyx_vtab)->get_item_pointer(__pyx_v_self, __pyx_v_indices); if (unlikely(__pyx_t_5 == ((void *)NULL))) __PYX_ERR(1, 418, __pyx_L1_error) + __pyx_v_itemp = __pyx_t_5; + + /* "View.MemoryView":419 + * else: + * itemp = self.get_item_pointer(indices) + * return self.convert_item_to_object(itemp) # <<<<<<<<<<<<<< + * + * def __setitem__(memoryview self, object index, object value): +*/ + __Pyx_XDECREF(__pyx_r); + __pyx_t_2 = ((struct __pyx_vtabstruct_memoryview *)__pyx_v_self->__pyx_vtab)->convert_item_to_object(__pyx_v_self, __pyx_v_itemp); if (unlikely(!__pyx_t_2)) __PYX_ERR(1, 419, __pyx_L1_error) + __Pyx_GOTREF(__pyx_t_2); + __pyx_r = __pyx_t_2; + __pyx_t_2 = 0; + goto __pyx_L0; + } + + /* "View.MemoryView":408 + * + * + * def __getitem__(memoryview self, object index): # <<<<<<<<<<<<<< + * if index is Ellipsis: + * return self +*/ + + /* function exit code */ + __pyx_L1_error:; + __Pyx_XDECREF(__pyx_t_2); + __Pyx_XDECREF(__pyx_t_3); + __Pyx_XDECREF(__pyx_t_4); + __Pyx_AddTraceback("View.MemoryView.memoryview.__getitem__", __pyx_clineno, __pyx_lineno, __pyx_filename); + __pyx_r = NULL; + __pyx_L0:; + __Pyx_XDECREF(__pyx_v_have_slices); + __Pyx_XDECREF(__pyx_v_indices); + __Pyx_XGIVEREF(__pyx_r); + __Pyx_RefNannyFinishContext(); + return __pyx_r; +} + +/* "View.MemoryView":421 + * return self.convert_item_to_object(itemp) + * + * def __setitem__(memoryview self, object index, object value): # <<<<<<<<<<<<<< + * if self.view.readonly: + * raise TypeError, "Cannot assign to read-only memoryview" +*/ + +/* Python wrapper */ +static int __pyx_memoryview___setitem__(PyObject *__pyx_v_self, PyObject *__pyx_v_index, PyObject *__pyx_v_value); /*proto*/ +static int __pyx_memoryview___setitem__(PyObject *__pyx_v_self, PyObject *__pyx_v_index, PyObject *__pyx_v_value) { + CYTHON_UNUSED PyObject *const *__pyx_kwvalues; + int __pyx_r; + __Pyx_RefNannyDeclarations + __Pyx_RefNannySetupContext("__setitem__ (wrapper)", 0); + __pyx_kwvalues = __Pyx_KwValues_VARARGS(__pyx_args, __pyx_nargs); + __pyx_r = __pyx_memoryview___pyx_pf_15View_dot_MemoryView_10memoryview_6__setitem__(((struct __pyx_memoryview_obj *)__pyx_v_self), ((PyObject *)__pyx_v_index), ((PyObject *)__pyx_v_value)); + + /* function exit code */ + __Pyx_RefNannyFinishContext(); + return __pyx_r; +} + +static int __pyx_memoryview___pyx_pf_15View_dot_MemoryView_10memoryview_6__setitem__(struct __pyx_memoryview_obj *__pyx_v_self, PyObject *__pyx_v_index, PyObject *__pyx_v_value) { + PyObject *__pyx_v_have_slices = NULL; + PyObject *__pyx_v_obj = NULL; + int __pyx_r; + __Pyx_RefNannyDeclarations + PyObject *__pyx_t_1 = NULL; + PyObject *__pyx_t_2 = NULL; + PyObject *__pyx_t_3 = NULL; + int __pyx_t_4; + int __pyx_lineno = 0; + const char *__pyx_filename = NULL; + int __pyx_clineno = 0; + __Pyx_RefNannySetupContext("__setitem__", 0); + __Pyx_INCREF(__pyx_v_index); + + /* "View.MemoryView":422 + * + * def __setitem__(memoryview self, object index, object value): + * if self.view.readonly: # <<<<<<<<<<<<<< + * raise TypeError, "Cannot assign to read-only memoryview" + * +*/ + if (unlikely(__pyx_v_self->view.readonly)) { + + /* "View.MemoryView":423 + * def __setitem__(memoryview self, object index, object value): + * if self.view.readonly: + * raise TypeError, "Cannot assign to read-only memoryview" # <<<<<<<<<<<<<< + * + * have_slices, index = _unellipsify(index, self.view.ndim) +*/ + __Pyx_Raise(((PyObject *)(((PyTypeObject*)PyExc_TypeError))), __pyx_mstate_global->__pyx_kp_u_Cannot_assign_to_read_only_memor, 0, 0); + __PYX_ERR(1, 423, __pyx_L1_error) + + /* "View.MemoryView":422 + * + * def __setitem__(memoryview self, object index, object value): + * if self.view.readonly: # <<<<<<<<<<<<<< + * raise TypeError, "Cannot assign to read-only memoryview" + * +*/ + } + + /* "View.MemoryView":425 + * raise TypeError, "Cannot assign to read-only memoryview" + * + * have_slices, index = _unellipsify(index, self.view.ndim) # <<<<<<<<<<<<<< + * + * if have_slices: +*/ + __pyx_t_1 = _unellipsify(__pyx_v_index, __pyx_v_self->view.ndim); if (unlikely(!__pyx_t_1)) __PYX_ERR(1, 425, __pyx_L1_error) + __Pyx_GOTREF(__pyx_t_1); + if (likely(__pyx_t_1 != Py_None)) { + PyObject* sequence = __pyx_t_1; + Py_ssize_t size = __Pyx_PyTuple_GET_SIZE(sequence); + if (unlikely(size != 2)) { + if (size > 2) __Pyx_RaiseTooManyValuesError(2); + else if (size >= 0) __Pyx_RaiseNeedMoreValuesError(size); + __PYX_ERR(1, 425, __pyx_L1_error) + } + #if CYTHON_ASSUME_SAFE_MACROS && !CYTHON_AVOID_BORROWED_REFS + __pyx_t_2 = PyTuple_GET_ITEM(sequence, 0); + __Pyx_INCREF(__pyx_t_2); + __pyx_t_3 = PyTuple_GET_ITEM(sequence, 1); + __Pyx_INCREF(__pyx_t_3); + #else + __pyx_t_2 = __Pyx_PySequence_ITEM(sequence, 0); if (unlikely(!__pyx_t_2)) __PYX_ERR(1, 425, __pyx_L1_error) + __Pyx_GOTREF(__pyx_t_2); + __pyx_t_3 = __Pyx_PySequence_ITEM(sequence, 1); if (unlikely(!__pyx_t_3)) __PYX_ERR(1, 425, __pyx_L1_error) + __Pyx_GOTREF(__pyx_t_3); + #endif + __Pyx_DECREF(__pyx_t_1); __pyx_t_1 = 0; + } else { + __Pyx_RaiseNoneNotIterableError(); __PYX_ERR(1, 425, __pyx_L1_error) + } + __pyx_v_have_slices = __pyx_t_2; + __pyx_t_2 = 0; + __Pyx_DECREF_SET(__pyx_v_index, __pyx_t_3); + __pyx_t_3 = 0; + + /* "View.MemoryView":427 + * have_slices, index = _unellipsify(index, self.view.ndim) + * + * if have_slices: # <<<<<<<<<<<<<< + * obj = self.is_slice(value) + * if obj is not None: +*/ + __pyx_t_4 = __Pyx_PyObject_IsTrue(__pyx_v_have_slices); if (unlikely((__pyx_t_4 < 0))) __PYX_ERR(1, 427, __pyx_L1_error) + if (__pyx_t_4) { + + /* "View.MemoryView":428 + * + * if have_slices: + * obj = self.is_slice(value) # <<<<<<<<<<<<<< + * if obj is not None: + * self.setitem_slice_assignment(self[index], obj) +*/ + __pyx_t_1 = ((struct __pyx_vtabstruct_memoryview *)__pyx_v_self->__pyx_vtab)->is_slice(__pyx_v_self, __pyx_v_value); if (unlikely(!__pyx_t_1)) __PYX_ERR(1, 428, __pyx_L1_error) + __Pyx_GOTREF(__pyx_t_1); + __pyx_v_obj = __pyx_t_1; + __pyx_t_1 = 0; + + /* "View.MemoryView":429 + * if have_slices: + * obj = self.is_slice(value) + * if obj is not None: # <<<<<<<<<<<<<< + * self.setitem_slice_assignment(self[index], obj) + * else: +*/ + __pyx_t_4 = (__pyx_v_obj != Py_None); + if (__pyx_t_4) { + + /* "View.MemoryView":430 + * obj = self.is_slice(value) + * if obj is not None: + * self.setitem_slice_assignment(self[index], obj) # <<<<<<<<<<<<<< + * else: + * self.setitem_slice_assign_scalar(self[index], value) +*/ + __pyx_t_1 = __Pyx_PyObject_GetItem(((PyObject *)__pyx_v_self), __pyx_v_index); if (unlikely(!__pyx_t_1)) __PYX_ERR(1, 430, __pyx_L1_error) + __Pyx_GOTREF(__pyx_t_1); + __pyx_t_3 = ((struct __pyx_vtabstruct_memoryview *)__pyx_v_self->__pyx_vtab)->setitem_slice_assignment(__pyx_v_self, __pyx_t_1, __pyx_v_obj); if (unlikely(!__pyx_t_3)) __PYX_ERR(1, 430, __pyx_L1_error) + __Pyx_GOTREF(__pyx_t_3); + __Pyx_DECREF(__pyx_t_1); __pyx_t_1 = 0; + __Pyx_DECREF(__pyx_t_3); __pyx_t_3 = 0; + + /* "View.MemoryView":429 + * if have_slices: + * obj = self.is_slice(value) + * if obj is not None: # <<<<<<<<<<<<<< + * self.setitem_slice_assignment(self[index], obj) + * else: +*/ + goto __pyx_L5; + } + + /* "View.MemoryView":432 + * self.setitem_slice_assignment(self[index], obj) + * else: + * self.setitem_slice_assign_scalar(self[index], value) # <<<<<<<<<<<<<< + * else: + * self.setitem_indexed(index, value) +*/ + /*else*/ { + __pyx_t_3 = __Pyx_PyObject_GetItem(((PyObject *)__pyx_v_self), __pyx_v_index); if (unlikely(!__pyx_t_3)) __PYX_ERR(1, 432, __pyx_L1_error) + __Pyx_GOTREF(__pyx_t_3); + if (!(likely(((__pyx_t_3) == Py_None) || likely(__Pyx_TypeTest(__pyx_t_3, __pyx_mstate_global->__pyx_memoryview_type))))) __PYX_ERR(1, 432, __pyx_L1_error) + __pyx_t_1 = ((struct __pyx_vtabstruct_memoryview *)__pyx_v_self->__pyx_vtab)->setitem_slice_assign_scalar(__pyx_v_self, ((struct __pyx_memoryview_obj *)__pyx_t_3), __pyx_v_value); if (unlikely(!__pyx_t_1)) __PYX_ERR(1, 432, __pyx_L1_error) + __Pyx_GOTREF(__pyx_t_1); + __Pyx_DECREF(__pyx_t_3); __pyx_t_3 = 0; + __Pyx_DECREF(__pyx_t_1); __pyx_t_1 = 0; + } + __pyx_L5:; + + /* "View.MemoryView":427 + * have_slices, index = _unellipsify(index, self.view.ndim) + * + * if have_slices: # <<<<<<<<<<<<<< + * obj = self.is_slice(value) + * if obj is not None: +*/ + goto __pyx_L4; + } + + /* "View.MemoryView":434 + * self.setitem_slice_assign_scalar(self[index], value) + * else: + * self.setitem_indexed(index, value) # <<<<<<<<<<<<<< + * + * cdef is_slice(self, obj): +*/ + /*else*/ { + __pyx_t_1 = ((struct __pyx_vtabstruct_memoryview *)__pyx_v_self->__pyx_vtab)->setitem_indexed(__pyx_v_self, __pyx_v_index, __pyx_v_value); if (unlikely(!__pyx_t_1)) __PYX_ERR(1, 434, __pyx_L1_error) + __Pyx_GOTREF(__pyx_t_1); + __Pyx_DECREF(__pyx_t_1); __pyx_t_1 = 0; + } + __pyx_L4:; + + /* "View.MemoryView":421 + * return self.convert_item_to_object(itemp) + * + * def __setitem__(memoryview self, object index, object value): # <<<<<<<<<<<<<< + * if self.view.readonly: + * raise TypeError, "Cannot assign to read-only memoryview" +*/ + + /* function exit code */ + __pyx_r = 0; + goto __pyx_L0; + __pyx_L1_error:; + __Pyx_XDECREF(__pyx_t_1); + __Pyx_XDECREF(__pyx_t_2); + __Pyx_XDECREF(__pyx_t_3); + __Pyx_AddTraceback("View.MemoryView.memoryview.__setitem__", __pyx_clineno, __pyx_lineno, __pyx_filename); + __pyx_r = -1; + __pyx_L0:; + __Pyx_XDECREF(__pyx_v_have_slices); + __Pyx_XDECREF(__pyx_v_obj); + __Pyx_XDECREF(__pyx_v_index); + __Pyx_RefNannyFinishContext(); + return __pyx_r; +} + +/* "View.MemoryView":436 + * self.setitem_indexed(index, value) + * + * cdef is_slice(self, obj): # <<<<<<<<<<<<<< + * if not isinstance(obj, memoryview): + * try: +*/ + +static PyObject *__pyx_memoryview_is_slice(struct __pyx_memoryview_obj *__pyx_v_self, PyObject *__pyx_v_obj) { + PyObject *__pyx_r = NULL; + __Pyx_RefNannyDeclarations + int __pyx_t_1; + int __pyx_t_2; + PyObject *__pyx_t_3 = NULL; + PyObject *__pyx_t_4 = NULL; + PyObject *__pyx_t_5 = NULL; + PyObject *__pyx_t_6 = NULL; + PyObject *__pyx_t_7 = NULL; + PyObject *__pyx_t_8 = NULL; + PyObject *__pyx_t_9 = NULL; + size_t __pyx_t_10; + int __pyx_t_11; + int __pyx_lineno = 0; + const char *__pyx_filename = NULL; + int __pyx_clineno = 0; + __Pyx_RefNannySetupContext("is_slice", 0); + __Pyx_INCREF(__pyx_v_obj); + + /* "View.MemoryView":437 + * + * cdef is_slice(self, obj): + * if not isinstance(obj, memoryview): # <<<<<<<<<<<<<< + * try: + * obj = memoryview(obj, self.flags & ~PyBUF_WRITABLE | PyBUF_ANY_CONTIGUOUS, +*/ + __pyx_t_1 = __Pyx_TypeCheck(__pyx_v_obj, __pyx_mstate_global->__pyx_memoryview_type); + __pyx_t_2 = (!__pyx_t_1); + if (__pyx_t_2) { + + /* "View.MemoryView":438 + * cdef is_slice(self, obj): + * if not isinstance(obj, memoryview): + * try: # <<<<<<<<<<<<<< + * obj = memoryview(obj, self.flags & ~PyBUF_WRITABLE | PyBUF_ANY_CONTIGUOUS, + * self.dtype_is_object) +*/ + { + __Pyx_PyThreadState_declare + __Pyx_PyThreadState_assign + __Pyx_ExceptionSave(&__pyx_t_3, &__pyx_t_4, &__pyx_t_5); + __Pyx_XGOTREF(__pyx_t_3); + __Pyx_XGOTREF(__pyx_t_4); + __Pyx_XGOTREF(__pyx_t_5); + /*try:*/ { + + /* "View.MemoryView":439 + * if not isinstance(obj, memoryview): + * try: + * obj = memoryview(obj, self.flags & ~PyBUF_WRITABLE | PyBUF_ANY_CONTIGUOUS, # <<<<<<<<<<<<<< + * self.dtype_is_object) + * except TypeError: +*/ + __pyx_t_7 = NULL; + __pyx_t_8 = __Pyx_PyLong_From_int(((__pyx_v_self->flags & (~PyBUF_WRITABLE)) | PyBUF_ANY_CONTIGUOUS)); if (unlikely(!__pyx_t_8)) __PYX_ERR(1, 439, __pyx_L4_error) + __Pyx_GOTREF(__pyx_t_8); + + /* "View.MemoryView":440 + * try: + * obj = memoryview(obj, self.flags & ~PyBUF_WRITABLE | PyBUF_ANY_CONTIGUOUS, + * self.dtype_is_object) # <<<<<<<<<<<<<< + * except TypeError: + * return None +*/ + __pyx_t_9 = __Pyx_PyBool_FromLong(__pyx_v_self->dtype_is_object); if (unlikely(!__pyx_t_9)) __PYX_ERR(1, 440, __pyx_L4_error) + __Pyx_GOTREF(__pyx_t_9); + __pyx_t_10 = 1; + { + PyObject *__pyx_callargs[4] = {__pyx_t_7, __pyx_v_obj, __pyx_t_8, __pyx_t_9}; + __pyx_t_6 = __Pyx_PyObject_FastCall((PyObject*)__pyx_mstate_global->__pyx_memoryview_type, __pyx_callargs+__pyx_t_10, (4-__pyx_t_10) | (__pyx_t_10*__Pyx_PY_VECTORCALL_ARGUMENTS_OFFSET)); + __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; + if (unlikely(!__pyx_t_6)) __PYX_ERR(1, 439, __pyx_L4_error) + __Pyx_GOTREF((PyObject *)__pyx_t_6); + } + __Pyx_DECREF_SET(__pyx_v_obj, ((PyObject *)__pyx_t_6)); + __pyx_t_6 = 0; + + /* "View.MemoryView":438 + * cdef is_slice(self, obj): + * if not isinstance(obj, memoryview): + * try: # <<<<<<<<<<<<<< + * obj = memoryview(obj, self.flags & ~PyBUF_WRITABLE | PyBUF_ANY_CONTIGUOUS, + * self.dtype_is_object) +*/ + } + __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; + goto __pyx_L9_try_end; + __pyx_L4_error:; + __Pyx_XDECREF(__pyx_t_6); __pyx_t_6 = 0; + __Pyx_XDECREF(__pyx_t_7); __pyx_t_7 = 0; + __Pyx_XDECREF(__pyx_t_8); __pyx_t_8 = 0; + __Pyx_XDECREF(__pyx_t_9); __pyx_t_9 = 0; + + /* "View.MemoryView":441 + * obj = memoryview(obj, self.flags & ~PyBUF_WRITABLE | PyBUF_ANY_CONTIGUOUS, + * self.dtype_is_object) + * except TypeError: # <<<<<<<<<<<<<< + * return None + * +*/ + __pyx_t_11 = __Pyx_PyErr_ExceptionMatches(((PyObject *)(((PyTypeObject*)PyExc_TypeError)))); + if (__pyx_t_11) { + __Pyx_ErrRestore(0,0,0); + + /* "View.MemoryView":442 + * self.dtype_is_object) + * except TypeError: + * return None # <<<<<<<<<<<<<< + * + * return obj +*/ + __Pyx_XDECREF(__pyx_r); + __pyx_r = Py_None; __Pyx_INCREF(Py_None); + goto __pyx_L7_except_return; + } + goto __pyx_L6_except_error; + + /* "View.MemoryView":438 + * cdef is_slice(self, obj): + * if not isinstance(obj, memoryview): + * try: # <<<<<<<<<<<<<< + * obj = memoryview(obj, self.flags & ~PyBUF_WRITABLE | PyBUF_ANY_CONTIGUOUS, + * self.dtype_is_object) +*/ + __pyx_L6_except_error:; + __Pyx_XGIVEREF(__pyx_t_3); + __Pyx_XGIVEREF(__pyx_t_4); + __Pyx_XGIVEREF(__pyx_t_5); + __Pyx_ExceptionReset(__pyx_t_3, __pyx_t_4, __pyx_t_5); + goto __pyx_L1_error; + __pyx_L7_except_return:; + __Pyx_XGIVEREF(__pyx_t_3); + __Pyx_XGIVEREF(__pyx_t_4); + __Pyx_XGIVEREF(__pyx_t_5); + __Pyx_ExceptionReset(__pyx_t_3, __pyx_t_4, __pyx_t_5); + goto __pyx_L0; + __pyx_L9_try_end:; + } + + /* "View.MemoryView":437 + * + * cdef is_slice(self, obj): + * if not isinstance(obj, memoryview): # <<<<<<<<<<<<<< + * try: + * obj = memoryview(obj, self.flags & ~PyBUF_WRITABLE | PyBUF_ANY_CONTIGUOUS, +*/ + } + + /* "View.MemoryView":444 + * return None + * + * return obj # <<<<<<<<<<<<<< + * + * cdef setitem_slice_assignment(self, dst, src): +*/ + __Pyx_XDECREF(__pyx_r); + __Pyx_INCREF(__pyx_v_obj); + __pyx_r = __pyx_v_obj; + goto __pyx_L0; + + /* "View.MemoryView":436 + * self.setitem_indexed(index, value) + * + * cdef is_slice(self, obj): # <<<<<<<<<<<<<< + * if not isinstance(obj, memoryview): + * try: +*/ + + /* function exit code */ + __pyx_L1_error:; + __Pyx_XDECREF(__pyx_t_6); + __Pyx_XDECREF(__pyx_t_7); + __Pyx_XDECREF(__pyx_t_8); + __Pyx_XDECREF(__pyx_t_9); + __Pyx_AddTraceback("View.MemoryView.memoryview.is_slice", __pyx_clineno, __pyx_lineno, __pyx_filename); + __pyx_r = 0; + __pyx_L0:; + __Pyx_XDECREF(__pyx_v_obj); + __Pyx_XGIVEREF(__pyx_r); + __Pyx_RefNannyFinishContext(); + return __pyx_r; +} + +/* "View.MemoryView":446 + * return obj + * + * cdef setitem_slice_assignment(self, dst, src): # <<<<<<<<<<<<<< + * cdef __Pyx_memviewslice dst_slice + * cdef __Pyx_memviewslice src_slice +*/ + +static PyObject *__pyx_memoryview_setitem_slice_assignment(struct __pyx_memoryview_obj *__pyx_v_self, PyObject *__pyx_v_dst, PyObject *__pyx_v_src) { + __Pyx_memviewslice __pyx_v_dst_slice; + __Pyx_memviewslice __pyx_v_src_slice; + __Pyx_memviewslice __pyx_v_msrc; + __Pyx_memviewslice __pyx_v_mdst; + PyObject *__pyx_r = NULL; + __Pyx_RefNannyDeclarations + __Pyx_memviewslice *__pyx_t_1; + PyObject *__pyx_t_2 = NULL; + int __pyx_t_3; + int __pyx_t_4; + int __pyx_t_5; + int __pyx_lineno = 0; + const char *__pyx_filename = NULL; + int __pyx_clineno = 0; + __Pyx_RefNannySetupContext("setitem_slice_assignment", 0); + + /* "View.MemoryView":449 + * cdef __Pyx_memviewslice dst_slice + * cdef __Pyx_memviewslice src_slice + * cdef __Pyx_memviewslice msrc = get_slice_from_memview(src, &src_slice)[0] # <<<<<<<<<<<<<< + * cdef __Pyx_memviewslice mdst = get_slice_from_memview(dst, &dst_slice)[0] + * +*/ + if (!(likely(((__pyx_v_src) == Py_None) || likely(__Pyx_TypeTest(__pyx_v_src, __pyx_mstate_global->__pyx_memoryview_type))))) __PYX_ERR(1, 449, __pyx_L1_error) + __pyx_t_1 = __pyx_memoryview_get_slice_from_memoryview(((struct __pyx_memoryview_obj *)__pyx_v_src), (&__pyx_v_src_slice)); if (unlikely(__pyx_t_1 == ((void *)NULL))) __PYX_ERR(1, 449, __pyx_L1_error) + __pyx_v_msrc = (__pyx_t_1[0]); + + /* "View.MemoryView":450 + * cdef __Pyx_memviewslice src_slice + * cdef __Pyx_memviewslice msrc = get_slice_from_memview(src, &src_slice)[0] + * cdef __Pyx_memviewslice mdst = get_slice_from_memview(dst, &dst_slice)[0] # <<<<<<<<<<<<<< + * + * memoryview_copy_contents(msrc, mdst, src.ndim, dst.ndim, self.dtype_is_object) +*/ + if (!(likely(((__pyx_v_dst) == Py_None) || likely(__Pyx_TypeTest(__pyx_v_dst, __pyx_mstate_global->__pyx_memoryview_type))))) __PYX_ERR(1, 450, __pyx_L1_error) + __pyx_t_1 = __pyx_memoryview_get_slice_from_memoryview(((struct __pyx_memoryview_obj *)__pyx_v_dst), (&__pyx_v_dst_slice)); if (unlikely(__pyx_t_1 == ((void *)NULL))) __PYX_ERR(1, 450, __pyx_L1_error) + __pyx_v_mdst = (__pyx_t_1[0]); + + /* "View.MemoryView":452 + * cdef __Pyx_memviewslice mdst = get_slice_from_memview(dst, &dst_slice)[0] + * + * memoryview_copy_contents(msrc, mdst, src.ndim, dst.ndim, self.dtype_is_object) # <<<<<<<<<<<<<< + * + * cdef setitem_slice_assign_scalar(self, memoryview dst, value): +*/ + __pyx_t_2 = __Pyx_PyObject_GetAttrStr(__pyx_v_src, __pyx_mstate_global->__pyx_n_u_ndim); if (unlikely(!__pyx_t_2)) __PYX_ERR(1, 452, __pyx_L1_error) + __Pyx_GOTREF(__pyx_t_2); + __pyx_t_3 = __Pyx_PyLong_As_int(__pyx_t_2); if (unlikely((__pyx_t_3 == (int)-1) && PyErr_Occurred())) __PYX_ERR(1, 452, __pyx_L1_error) + __Pyx_DECREF(__pyx_t_2); __pyx_t_2 = 0; + __pyx_t_2 = __Pyx_PyObject_GetAttrStr(__pyx_v_dst, __pyx_mstate_global->__pyx_n_u_ndim); if (unlikely(!__pyx_t_2)) __PYX_ERR(1, 452, __pyx_L1_error) + __Pyx_GOTREF(__pyx_t_2); + __pyx_t_4 = __Pyx_PyLong_As_int(__pyx_t_2); if (unlikely((__pyx_t_4 == (int)-1) && PyErr_Occurred())) __PYX_ERR(1, 452, __pyx_L1_error) + __Pyx_DECREF(__pyx_t_2); __pyx_t_2 = 0; + __pyx_t_5 = __pyx_memoryview_copy_contents(__pyx_v_msrc, __pyx_v_mdst, __pyx_t_3, __pyx_t_4, __pyx_v_self->dtype_is_object); if (unlikely(__pyx_t_5 == ((int)-1))) __PYX_ERR(1, 452, __pyx_L1_error) + + /* "View.MemoryView":446 + * return obj + * + * cdef setitem_slice_assignment(self, dst, src): # <<<<<<<<<<<<<< + * cdef __Pyx_memviewslice dst_slice + * cdef __Pyx_memviewslice src_slice +*/ + + /* function exit code */ + __pyx_r = Py_None; __Pyx_INCREF(Py_None); + goto __pyx_L0; + __pyx_L1_error:; + __Pyx_XDECREF(__pyx_t_2); + __Pyx_AddTraceback("View.MemoryView.memoryview.setitem_slice_assignment", __pyx_clineno, __pyx_lineno, __pyx_filename); + __pyx_r = 0; + __pyx_L0:; + __Pyx_XGIVEREF(__pyx_r); + __Pyx_RefNannyFinishContext(); + return __pyx_r; +} + +/* "View.MemoryView":454 + * memoryview_copy_contents(msrc, mdst, src.ndim, dst.ndim, self.dtype_is_object) + * + * cdef setitem_slice_assign_scalar(self, memoryview dst, value): # <<<<<<<<<<<<<< + * cdef int array[128] + * cdef void *tmp = NULL +*/ + +static PyObject *__pyx_memoryview_setitem_slice_assign_scalar(struct __pyx_memoryview_obj *__pyx_v_self, struct __pyx_memoryview_obj *__pyx_v_dst, PyObject *__pyx_v_value) { + int __pyx_v_array[128]; + void *__pyx_v_tmp; + void *__pyx_v_item; + __Pyx_memviewslice *__pyx_v_dst_slice; + __Pyx_memviewslice __pyx_v_tmp_slice; + PyObject *__pyx_r = NULL; + __Pyx_RefNannyDeclarations + __Pyx_memviewslice *__pyx_t_1; + int __pyx_t_2; + PyObject *__pyx_t_3 = NULL; + int __pyx_t_4; + int __pyx_t_5; + char const *__pyx_t_6; + PyObject *__pyx_t_7 = NULL; + PyObject *__pyx_t_8 = NULL; + PyObject *__pyx_t_9 = NULL; + PyObject *__pyx_t_10 = NULL; + PyObject *__pyx_t_11 = NULL; + PyObject *__pyx_t_12 = NULL; + int __pyx_lineno = 0; + const char *__pyx_filename = NULL; + int __pyx_clineno = 0; + __Pyx_RefNannySetupContext("setitem_slice_assign_scalar", 0); + + /* "View.MemoryView":456 + * cdef setitem_slice_assign_scalar(self, memoryview dst, value): + * cdef int array[128] + * cdef void *tmp = NULL # <<<<<<<<<<<<<< + * cdef void *item + * +*/ + __pyx_v_tmp = NULL; + + /* "View.MemoryView":461 + * cdef __Pyx_memviewslice *dst_slice + * cdef __Pyx_memviewslice tmp_slice + * dst_slice = get_slice_from_memview(dst, &tmp_slice) # <<<<<<<<<<<<<< + * + * if self.view.itemsize > sizeof(array): +*/ + __pyx_t_1 = __pyx_memoryview_get_slice_from_memoryview(__pyx_v_dst, (&__pyx_v_tmp_slice)); if (unlikely(__pyx_t_1 == ((void *)NULL))) __PYX_ERR(1, 461, __pyx_L1_error) + __pyx_v_dst_slice = __pyx_t_1; + + /* "View.MemoryView":463 + * dst_slice = get_slice_from_memview(dst, &tmp_slice) + * + * if self.view.itemsize > sizeof(array): # <<<<<<<<<<<<<< + * tmp = PyMem_Malloc(self.view.itemsize) + * if tmp == NULL: +*/ + __pyx_t_2 = (((size_t)__pyx_v_self->view.itemsize) > (sizeof(__pyx_v_array))); + if (__pyx_t_2) { + + /* "View.MemoryView":464 + * + * if self.view.itemsize > sizeof(array): + * tmp = PyMem_Malloc(self.view.itemsize) # <<<<<<<<<<<<<< + * if tmp == NULL: + * raise MemoryError +*/ + __pyx_v_tmp = PyMem_Malloc(__pyx_v_self->view.itemsize); + + /* "View.MemoryView":465 + * if self.view.itemsize > sizeof(array): + * tmp = PyMem_Malloc(self.view.itemsize) + * if tmp == NULL: # <<<<<<<<<<<<<< + * raise MemoryError + * item = tmp +*/ + __pyx_t_2 = (__pyx_v_tmp == NULL); + if (unlikely(__pyx_t_2)) { + + /* "View.MemoryView":466 + * tmp = PyMem_Malloc(self.view.itemsize) + * if tmp == NULL: + * raise MemoryError # <<<<<<<<<<<<<< + * item = tmp + * else: +*/ + PyErr_NoMemory(); __PYX_ERR(1, 466, __pyx_L1_error) + + /* "View.MemoryView":465 + * if self.view.itemsize > sizeof(array): + * tmp = PyMem_Malloc(self.view.itemsize) + * if tmp == NULL: # <<<<<<<<<<<<<< + * raise MemoryError + * item = tmp +*/ + } + + /* "View.MemoryView":467 + * if tmp == NULL: + * raise MemoryError + * item = tmp # <<<<<<<<<<<<<< + * else: + * item = array +*/ + __pyx_v_item = __pyx_v_tmp; + + /* "View.MemoryView":463 + * dst_slice = get_slice_from_memview(dst, &tmp_slice) + * + * if self.view.itemsize > sizeof(array): # <<<<<<<<<<<<<< + * tmp = PyMem_Malloc(self.view.itemsize) + * if tmp == NULL: +*/ + goto __pyx_L3; + } + + /* "View.MemoryView":469 + * item = tmp + * else: + * item = array # <<<<<<<<<<<<<< + * + * try: +*/ + /*else*/ { + __pyx_v_item = ((void *)__pyx_v_array); + } + __pyx_L3:; + + /* "View.MemoryView":471 + * item = array + * + * try: # <<<<<<<<<<<<<< + * if self.dtype_is_object: + * ( item)[0] = value +*/ + /*try:*/ { + + /* "View.MemoryView":472 + * + * try: + * if self.dtype_is_object: # <<<<<<<<<<<<<< + * ( item)[0] = value + * else: +*/ + if (__pyx_v_self->dtype_is_object) { + + /* "View.MemoryView":473 + * try: + * if self.dtype_is_object: + * ( item)[0] = value # <<<<<<<<<<<<<< + * else: + * self.assign_item_from_object( item, value) +*/ + (((PyObject **)__pyx_v_item)[0]) = ((PyObject *)__pyx_v_value); + + /* "View.MemoryView":472 + * + * try: + * if self.dtype_is_object: # <<<<<<<<<<<<<< + * ( item)[0] = value + * else: +*/ + goto __pyx_L8; + } + + /* "View.MemoryView":475 + * ( item)[0] = value + * else: + * self.assign_item_from_object( item, value) # <<<<<<<<<<<<<< + * + * +*/ + /*else*/ { + __pyx_t_3 = ((struct __pyx_vtabstruct_memoryview *)__pyx_v_self->__pyx_vtab)->assign_item_from_object(__pyx_v_self, ((char *)__pyx_v_item), __pyx_v_value); if (unlikely(!__pyx_t_3)) __PYX_ERR(1, 475, __pyx_L6_error) + __Pyx_GOTREF(__pyx_t_3); + __Pyx_DECREF(__pyx_t_3); __pyx_t_3 = 0; + } + __pyx_L8:; + + /* "View.MemoryView":479 + * + * + * if self.view.suboffsets != NULL: # <<<<<<<<<<<<<< + * assert_direct_dimensions(self.view.suboffsets, self.view.ndim) + * slice_assign_scalar(dst_slice, dst.view.ndim, self.view.itemsize, +*/ + __pyx_t_2 = (__pyx_v_self->view.suboffsets != NULL); + if (__pyx_t_2) { + + /* "View.MemoryView":480 + * + * if self.view.suboffsets != NULL: + * assert_direct_dimensions(self.view.suboffsets, self.view.ndim) # <<<<<<<<<<<<<< + * slice_assign_scalar(dst_slice, dst.view.ndim, self.view.itemsize, + * item, self.dtype_is_object) +*/ + __pyx_t_4 = assert_direct_dimensions(__pyx_v_self->view.suboffsets, __pyx_v_self->view.ndim); if (unlikely(__pyx_t_4 == ((int)-1))) __PYX_ERR(1, 480, __pyx_L6_error) + + /* "View.MemoryView":479 + * + * + * if self.view.suboffsets != NULL: # <<<<<<<<<<<<<< + * assert_direct_dimensions(self.view.suboffsets, self.view.ndim) + * slice_assign_scalar(dst_slice, dst.view.ndim, self.view.itemsize, +*/ + } + + /* "View.MemoryView":481 + * if self.view.suboffsets != NULL: + * assert_direct_dimensions(self.view.suboffsets, self.view.ndim) + * slice_assign_scalar(dst_slice, dst.view.ndim, self.view.itemsize, # <<<<<<<<<<<<<< + * item, self.dtype_is_object) + * finally: +*/ + __pyx_memoryview_slice_assign_scalar(__pyx_v_dst_slice, __pyx_v_dst->view.ndim, __pyx_v_self->view.itemsize, __pyx_v_item, __pyx_v_self->dtype_is_object); + } + + /* "View.MemoryView":484 + * item, self.dtype_is_object) + * finally: + * PyMem_Free(tmp) # <<<<<<<<<<<<<< + * + * cdef setitem_indexed(self, index, value): +*/ + /*finally:*/ { + /*normal exit:*/{ + PyMem_Free(__pyx_v_tmp); + goto __pyx_L7; + } + __pyx_L6_error:; + /*exception exit:*/{ + __Pyx_PyThreadState_declare + __Pyx_PyThreadState_assign + __pyx_t_7 = 0; __pyx_t_8 = 0; __pyx_t_9 = 0; __pyx_t_10 = 0; __pyx_t_11 = 0; __pyx_t_12 = 0; + __Pyx_XDECREF(__pyx_t_3); __pyx_t_3 = 0; + __Pyx_ExceptionSwap(&__pyx_t_10, &__pyx_t_11, &__pyx_t_12); + if ( unlikely(__Pyx_GetException(&__pyx_t_7, &__pyx_t_8, &__pyx_t_9) < 0)) __Pyx_ErrFetch(&__pyx_t_7, &__pyx_t_8, &__pyx_t_9); + __Pyx_XGOTREF(__pyx_t_7); + __Pyx_XGOTREF(__pyx_t_8); + __Pyx_XGOTREF(__pyx_t_9); + __Pyx_XGOTREF(__pyx_t_10); + __Pyx_XGOTREF(__pyx_t_11); + __Pyx_XGOTREF(__pyx_t_12); + __pyx_t_4 = __pyx_lineno; __pyx_t_5 = __pyx_clineno; __pyx_t_6 = __pyx_filename; + { + PyMem_Free(__pyx_v_tmp); + } + __Pyx_XGIVEREF(__pyx_t_10); + __Pyx_XGIVEREF(__pyx_t_11); + __Pyx_XGIVEREF(__pyx_t_12); + __Pyx_ExceptionReset(__pyx_t_10, __pyx_t_11, __pyx_t_12); + __Pyx_XGIVEREF(__pyx_t_7); + __Pyx_XGIVEREF(__pyx_t_8); + __Pyx_XGIVEREF(__pyx_t_9); + __Pyx_ErrRestore(__pyx_t_7, __pyx_t_8, __pyx_t_9); + __pyx_t_7 = 0; __pyx_t_8 = 0; __pyx_t_9 = 0; __pyx_t_10 = 0; __pyx_t_11 = 0; __pyx_t_12 = 0; + __pyx_lineno = __pyx_t_4; __pyx_clineno = __pyx_t_5; __pyx_filename = __pyx_t_6; + goto __pyx_L1_error; + } + __pyx_L7:; + } + + /* "View.MemoryView":454 + * memoryview_copy_contents(msrc, mdst, src.ndim, dst.ndim, self.dtype_is_object) + * + * cdef setitem_slice_assign_scalar(self, memoryview dst, value): # <<<<<<<<<<<<<< + * cdef int array[128] + * cdef void *tmp = NULL +*/ + + /* function exit code */ + __pyx_r = Py_None; __Pyx_INCREF(Py_None); + goto __pyx_L0; + __pyx_L1_error:; + __Pyx_XDECREF(__pyx_t_3); + __Pyx_AddTraceback("View.MemoryView.memoryview.setitem_slice_assign_scalar", __pyx_clineno, __pyx_lineno, __pyx_filename); + __pyx_r = 0; + __pyx_L0:; + __Pyx_XGIVEREF(__pyx_r); + __Pyx_RefNannyFinishContext(); + return __pyx_r; +} + +/* "View.MemoryView":486 + * PyMem_Free(tmp) + * + * cdef setitem_indexed(self, index, value): # <<<<<<<<<<<<<< + * cdef char *itemp = self.get_item_pointer(index) + * self.assign_item_from_object(itemp, value) +*/ + +static PyObject *__pyx_memoryview_setitem_indexed(struct __pyx_memoryview_obj *__pyx_v_self, PyObject *__pyx_v_index, PyObject *__pyx_v_value) { + char *__pyx_v_itemp; + PyObject *__pyx_r = NULL; + __Pyx_RefNannyDeclarations + char *__pyx_t_1; + PyObject *__pyx_t_2 = NULL; + int __pyx_lineno = 0; + const char *__pyx_filename = NULL; + int __pyx_clineno = 0; + __Pyx_RefNannySetupContext("setitem_indexed", 0); + + /* "View.MemoryView":487 + * + * cdef setitem_indexed(self, index, value): + * cdef char *itemp = self.get_item_pointer(index) # <<<<<<<<<<<<<< + * self.assign_item_from_object(itemp, value) + * +*/ + __pyx_t_1 = ((struct __pyx_vtabstruct_memoryview *)__pyx_v_self->__pyx_vtab)->get_item_pointer(__pyx_v_self, __pyx_v_index); if (unlikely(__pyx_t_1 == ((void *)NULL))) __PYX_ERR(1, 487, __pyx_L1_error) + __pyx_v_itemp = __pyx_t_1; + + /* "View.MemoryView":488 + * cdef setitem_indexed(self, index, value): + * cdef char *itemp = self.get_item_pointer(index) + * self.assign_item_from_object(itemp, value) # <<<<<<<<<<<<<< + * + * cdef convert_item_to_object(self, char *itemp): +*/ + __pyx_t_2 = ((struct __pyx_vtabstruct_memoryview *)__pyx_v_self->__pyx_vtab)->assign_item_from_object(__pyx_v_self, __pyx_v_itemp, __pyx_v_value); if (unlikely(!__pyx_t_2)) __PYX_ERR(1, 488, __pyx_L1_error) + __Pyx_GOTREF(__pyx_t_2); + __Pyx_DECREF(__pyx_t_2); __pyx_t_2 = 0; + + /* "View.MemoryView":486 + * PyMem_Free(tmp) + * + * cdef setitem_indexed(self, index, value): # <<<<<<<<<<<<<< + * cdef char *itemp = self.get_item_pointer(index) + * self.assign_item_from_object(itemp, value) +*/ + + /* function exit code */ + __pyx_r = Py_None; __Pyx_INCREF(Py_None); + goto __pyx_L0; + __pyx_L1_error:; + __Pyx_XDECREF(__pyx_t_2); + __Pyx_AddTraceback("View.MemoryView.memoryview.setitem_indexed", __pyx_clineno, __pyx_lineno, __pyx_filename); + __pyx_r = 0; + __pyx_L0:; + __Pyx_XGIVEREF(__pyx_r); + __Pyx_RefNannyFinishContext(); + return __pyx_r; +} + +/* "View.MemoryView":490 + * self.assign_item_from_object(itemp, value) + * + * cdef convert_item_to_object(self, char *itemp): # <<<<<<<<<<<<<< + * """Only used if instantiated manually by the user, or if Cython doesn't + * know how to convert the type""" +*/ + +static PyObject *__pyx_memoryview_convert_item_to_object(struct __pyx_memoryview_obj *__pyx_v_self, char *__pyx_v_itemp) { + PyObject *__pyx_v_struct = NULL; + PyObject *__pyx_v_bytesitem = 0; + PyObject *__pyx_v_result = NULL; + PyObject *__pyx_r = NULL; + __Pyx_RefNannyDeclarations + PyObject *__pyx_t_1 = NULL; + PyObject *__pyx_t_2 = NULL; + PyObject *__pyx_t_3 = NULL; + PyObject *__pyx_t_4 = NULL; + PyObject *__pyx_t_5 = NULL; + PyObject *__pyx_t_6 = NULL; + size_t __pyx_t_7; + Py_ssize_t __pyx_t_8; + int __pyx_t_9; + PyObject *__pyx_t_10 = NULL; + int __pyx_t_11; + int __pyx_lineno = 0; + const char *__pyx_filename = NULL; + int __pyx_clineno = 0; + __Pyx_RefNannySetupContext("convert_item_to_object", 0); + + /* "View.MemoryView":493 + * """Only used if instantiated manually by the user, or if Cython doesn't + * know how to convert the type""" + * import struct # <<<<<<<<<<<<<< + * cdef bytes bytesitem + * +*/ + __pyx_t_2 = __Pyx_Import(__pyx_mstate_global->__pyx_n_u_struct, 0, 0, NULL, 0); if (unlikely(!__pyx_t_2)) __PYX_ERR(1, 493, __pyx_L1_error) + __pyx_t_1 = __pyx_t_2; + __Pyx_GOTREF(__pyx_t_1); + __pyx_v_struct = __pyx_t_1; + __pyx_t_1 = 0; + + /* "View.MemoryView":496 + * cdef bytes bytesitem + * + * bytesitem = itemp[:self.view.itemsize] # <<<<<<<<<<<<<< + * try: + * result = struct.unpack(self.view.format, bytesitem) +*/ + __pyx_t_1 = __Pyx_PyBytes_FromStringAndSize(__pyx_v_itemp + 0, __pyx_v_self->view.itemsize - 0); if (unlikely(!__pyx_t_1)) __PYX_ERR(1, 496, __pyx_L1_error) + __Pyx_GOTREF(__pyx_t_1); + __pyx_v_bytesitem = ((PyObject*)__pyx_t_1); + __pyx_t_1 = 0; + + /* "View.MemoryView":497 + * + * bytesitem = itemp[:self.view.itemsize] + * try: # <<<<<<<<<<<<<< + * result = struct.unpack(self.view.format, bytesitem) + * except struct.error: +*/ + { + __Pyx_PyThreadState_declare + __Pyx_PyThreadState_assign + __Pyx_ExceptionSave(&__pyx_t_2, &__pyx_t_3, &__pyx_t_4); + __Pyx_XGOTREF(__pyx_t_2); + __Pyx_XGOTREF(__pyx_t_3); + __Pyx_XGOTREF(__pyx_t_4); + /*try:*/ { + + /* "View.MemoryView":498 + * bytesitem = itemp[:self.view.itemsize] + * try: + * result = struct.unpack(self.view.format, bytesitem) # <<<<<<<<<<<<<< + * except struct.error: + * raise ValueError, "Unable to convert item to object" +*/ + __pyx_t_5 = __pyx_v_struct; + __Pyx_INCREF(__pyx_t_5); + __pyx_t_6 = __Pyx_PyBytes_FromString(__pyx_v_self->view.format); if (unlikely(!__pyx_t_6)) __PYX_ERR(1, 498, __pyx_L3_error) + __Pyx_GOTREF(__pyx_t_6); + __pyx_t_7 = 0; + { + PyObject *__pyx_callargs[3] = {__pyx_t_5, __pyx_t_6, __pyx_v_bytesitem}; + __pyx_t_1 = __Pyx_PyObject_FastCallMethod((PyObject*)__pyx_mstate_global->__pyx_n_u_unpack, __pyx_callargs+__pyx_t_7, (3-__pyx_t_7) | (1*__Pyx_PY_VECTORCALL_ARGUMENTS_OFFSET)); + __Pyx_XDECREF(__pyx_t_5); __pyx_t_5 = 0; + __Pyx_DECREF(__pyx_t_6); __pyx_t_6 = 0; + if (unlikely(!__pyx_t_1)) __PYX_ERR(1, 498, __pyx_L3_error) + __Pyx_GOTREF(__pyx_t_1); + } + __pyx_v_result = __pyx_t_1; + __pyx_t_1 = 0; + + /* "View.MemoryView":497 + * + * bytesitem = itemp[:self.view.itemsize] + * try: # <<<<<<<<<<<<<< + * result = struct.unpack(self.view.format, bytesitem) + * except struct.error: +*/ + } + + /* "View.MemoryView":502 + * raise ValueError, "Unable to convert item to object" + * else: + * if len(self.view.format) == 1: # <<<<<<<<<<<<<< + * return result[0] + * return result +*/ + /*else:*/ { + __pyx_t_8 = __Pyx_ssize_strlen(__pyx_v_self->view.format); if (unlikely(__pyx_t_8 == ((Py_ssize_t)-1))) __PYX_ERR(1, 502, __pyx_L5_except_error) + __pyx_t_9 = (__pyx_t_8 == 1); + if (__pyx_t_9) { + + /* "View.MemoryView":503 + * else: + * if len(self.view.format) == 1: + * return result[0] # <<<<<<<<<<<<<< + * return result + * +*/ + __Pyx_XDECREF(__pyx_r); + __pyx_t_1 = __Pyx_GetItemInt(__pyx_v_result, 0, long, 1, __Pyx_PyLong_From_long, 0, 0, 1, 1, __Pyx_ReferenceSharing_OwnStrongReference); if (unlikely(!__pyx_t_1)) __PYX_ERR(1, 503, __pyx_L5_except_error) + __Pyx_GOTREF(__pyx_t_1); + __pyx_r = __pyx_t_1; + __pyx_t_1 = 0; + goto __pyx_L6_except_return; + + /* "View.MemoryView":502 + * raise ValueError, "Unable to convert item to object" + * else: + * if len(self.view.format) == 1: # <<<<<<<<<<<<<< + * return result[0] + * return result +*/ + } + + /* "View.MemoryView":504 + * if len(self.view.format) == 1: + * return result[0] + * return result # <<<<<<<<<<<<<< + * + * cdef assign_item_from_object(self, char *itemp, object value): +*/ + __Pyx_XDECREF(__pyx_r); + __Pyx_INCREF(__pyx_v_result); + __pyx_r = __pyx_v_result; + goto __pyx_L6_except_return; + } + __pyx_L3_error:; + __Pyx_XDECREF(__pyx_t_1); __pyx_t_1 = 0; + __Pyx_XDECREF(__pyx_t_5); __pyx_t_5 = 0; + __Pyx_XDECREF(__pyx_t_6); __pyx_t_6 = 0; + + /* "View.MemoryView":499 + * try: + * result = struct.unpack(self.view.format, bytesitem) + * except struct.error: # <<<<<<<<<<<<<< + * raise ValueError, "Unable to convert item to object" + * else: +*/ + __Pyx_ErrFetch(&__pyx_t_1, &__pyx_t_6, &__pyx_t_5); + __pyx_t_10 = __Pyx_PyObject_GetAttrStr(__pyx_v_struct, __pyx_mstate_global->__pyx_n_u_error); if (unlikely(!__pyx_t_10)) __PYX_ERR(1, 499, __pyx_L5_except_error) + __Pyx_GOTREF(__pyx_t_10); + __pyx_t_11 = __Pyx_PyErr_GivenExceptionMatches(__pyx_t_1, __pyx_t_10); + __Pyx_DECREF(__pyx_t_10); __pyx_t_10 = 0; + __Pyx_ErrRestore(__pyx_t_1, __pyx_t_6, __pyx_t_5); + __pyx_t_1 = 0; __pyx_t_6 = 0; __pyx_t_5 = 0; + if (__pyx_t_11) { + __Pyx_AddTraceback("View.MemoryView.memoryview.convert_item_to_object", __pyx_clineno, __pyx_lineno, __pyx_filename); + if (__Pyx_GetException(&__pyx_t_5, &__pyx_t_6, &__pyx_t_1) < 0) __PYX_ERR(1, 499, __pyx_L5_except_error) + __Pyx_XGOTREF(__pyx_t_5); + __Pyx_XGOTREF(__pyx_t_6); + __Pyx_XGOTREF(__pyx_t_1); + + /* "View.MemoryView":500 + * result = struct.unpack(self.view.format, bytesitem) + * except struct.error: + * raise ValueError, "Unable to convert item to object" # <<<<<<<<<<<<<< + * else: + * if len(self.view.format) == 1: +*/ + __Pyx_Raise(((PyObject *)(((PyTypeObject*)PyExc_ValueError))), __pyx_mstate_global->__pyx_kp_u_Unable_to_convert_item_to_object, 0, 0); + __PYX_ERR(1, 500, __pyx_L5_except_error) + } + goto __pyx_L5_except_error; + + /* "View.MemoryView":497 + * + * bytesitem = itemp[:self.view.itemsize] + * try: # <<<<<<<<<<<<<< + * result = struct.unpack(self.view.format, bytesitem) + * except struct.error: +*/ + __pyx_L5_except_error:; + __Pyx_XGIVEREF(__pyx_t_2); + __Pyx_XGIVEREF(__pyx_t_3); + __Pyx_XGIVEREF(__pyx_t_4); + __Pyx_ExceptionReset(__pyx_t_2, __pyx_t_3, __pyx_t_4); + goto __pyx_L1_error; + __pyx_L6_except_return:; + __Pyx_XGIVEREF(__pyx_t_2); + __Pyx_XGIVEREF(__pyx_t_3); + __Pyx_XGIVEREF(__pyx_t_4); + __Pyx_ExceptionReset(__pyx_t_2, __pyx_t_3, __pyx_t_4); + goto __pyx_L0; + } + + /* "View.MemoryView":490 + * self.assign_item_from_object(itemp, value) + * + * cdef convert_item_to_object(self, char *itemp): # <<<<<<<<<<<<<< + * """Only used if instantiated manually by the user, or if Cython doesn't + * know how to convert the type""" +*/ + + /* function exit code */ + __pyx_L1_error:; + __Pyx_XDECREF(__pyx_t_1); + __Pyx_XDECREF(__pyx_t_5); + __Pyx_XDECREF(__pyx_t_6); + __Pyx_XDECREF(__pyx_t_10); + __Pyx_AddTraceback("View.MemoryView.memoryview.convert_item_to_object", __pyx_clineno, __pyx_lineno, __pyx_filename); + __pyx_r = 0; + __pyx_L0:; + __Pyx_XDECREF(__pyx_v_struct); + __Pyx_XDECREF(__pyx_v_bytesitem); + __Pyx_XDECREF(__pyx_v_result); + __Pyx_XGIVEREF(__pyx_r); + __Pyx_RefNannyFinishContext(); + return __pyx_r; +} + +/* "View.MemoryView":506 + * return result + * + * cdef assign_item_from_object(self, char *itemp, object value): # <<<<<<<<<<<<<< + * """Only used if instantiated manually by the user, or if Cython doesn't + * know how to convert the type""" +*/ + +static PyObject *__pyx_memoryview_assign_item_from_object(struct __pyx_memoryview_obj *__pyx_v_self, char *__pyx_v_itemp, PyObject *__pyx_v_value) { + PyObject *__pyx_v_struct = NULL; + char __pyx_v_c; + PyObject *__pyx_v_bytesvalue = 0; + Py_ssize_t __pyx_v_i; + PyObject *__pyx_r = NULL; + __Pyx_RefNannyDeclarations + PyObject *__pyx_t_1 = NULL; + PyObject *__pyx_t_2 = NULL; + int __pyx_t_3; + PyObject *__pyx_t_4 = NULL; + PyObject *__pyx_t_5 = NULL; + PyObject *__pyx_t_6 = NULL; + size_t __pyx_t_7; + Py_ssize_t __pyx_t_8; + PyObject *__pyx_t_9 = NULL; + char *__pyx_t_10; + char *__pyx_t_11; + Py_ssize_t __pyx_t_12; + char *__pyx_t_13; + char *__pyx_t_14; + int __pyx_lineno = 0; + const char *__pyx_filename = NULL; + int __pyx_clineno = 0; + __Pyx_RefNannySetupContext("assign_item_from_object", 0); + + /* "View.MemoryView":509 + * """Only used if instantiated manually by the user, or if Cython doesn't + * know how to convert the type""" + * import struct # <<<<<<<<<<<<<< + * cdef char c + * cdef bytes bytesvalue +*/ + __pyx_t_2 = __Pyx_Import(__pyx_mstate_global->__pyx_n_u_struct, 0, 0, NULL, 0); if (unlikely(!__pyx_t_2)) __PYX_ERR(1, 509, __pyx_L1_error) + __pyx_t_1 = __pyx_t_2; + __Pyx_GOTREF(__pyx_t_1); + __pyx_v_struct = __pyx_t_1; + __pyx_t_1 = 0; + + /* "View.MemoryView":514 + * cdef Py_ssize_t i + * + * if isinstance(value, tuple): # <<<<<<<<<<<<<< + * bytesvalue = struct.pack(self.view.format, *value) + * else: +*/ + __pyx_t_3 = PyTuple_Check(__pyx_v_value); + if (__pyx_t_3) { + + /* "View.MemoryView":515 + * + * if isinstance(value, tuple): + * bytesvalue = struct.pack(self.view.format, *value) # <<<<<<<<<<<<<< + * else: + * bytesvalue = struct.pack(self.view.format, value) +*/ + __pyx_t_1 = __Pyx_PyObject_GetAttrStr(__pyx_v_struct, __pyx_mstate_global->__pyx_n_u_pack); if (unlikely(!__pyx_t_1)) __PYX_ERR(1, 515, __pyx_L1_error) + __Pyx_GOTREF(__pyx_t_1); + __pyx_t_4 = __Pyx_PyBytes_FromString(__pyx_v_self->view.format); if (unlikely(!__pyx_t_4)) __PYX_ERR(1, 515, __pyx_L1_error) + __Pyx_GOTREF(__pyx_t_4); + __pyx_t_5 = PyTuple_New(1); if (unlikely(!__pyx_t_5)) __PYX_ERR(1, 515, __pyx_L1_error) + __Pyx_GOTREF(__pyx_t_5); + __Pyx_GIVEREF(__pyx_t_4); + if (__Pyx_PyTuple_SET_ITEM(__pyx_t_5, 0, __pyx_t_4) != (0)) __PYX_ERR(1, 515, __pyx_L1_error); + __pyx_t_4 = 0; + __pyx_t_4 = __Pyx_PySequence_Tuple(__pyx_v_value); if (unlikely(!__pyx_t_4)) __PYX_ERR(1, 515, __pyx_L1_error) + __Pyx_GOTREF(__pyx_t_4); + __pyx_t_6 = PyNumber_Add(__pyx_t_5, __pyx_t_4); if (unlikely(!__pyx_t_6)) __PYX_ERR(1, 515, __pyx_L1_error) + __Pyx_GOTREF(__pyx_t_6); + __Pyx_DECREF(__pyx_t_5); __pyx_t_5 = 0; + __Pyx_DECREF(__pyx_t_4); __pyx_t_4 = 0; + __pyx_t_4 = __Pyx_PyObject_Call(__pyx_t_1, __pyx_t_6, NULL); if (unlikely(!__pyx_t_4)) __PYX_ERR(1, 515, __pyx_L1_error) + __Pyx_GOTREF(__pyx_t_4); + __Pyx_DECREF(__pyx_t_1); __pyx_t_1 = 0; + __Pyx_DECREF(__pyx_t_6); __pyx_t_6 = 0; + if (!(likely(PyBytes_CheckExact(__pyx_t_4))||((__pyx_t_4) == Py_None) || __Pyx_RaiseUnexpectedTypeError("bytes", __pyx_t_4))) __PYX_ERR(1, 515, __pyx_L1_error) + __pyx_v_bytesvalue = ((PyObject*)__pyx_t_4); + __pyx_t_4 = 0; + + /* "View.MemoryView":514 + * cdef Py_ssize_t i + * + * if isinstance(value, tuple): # <<<<<<<<<<<<<< + * bytesvalue = struct.pack(self.view.format, *value) + * else: +*/ + goto __pyx_L3; + } + + /* "View.MemoryView":517 + * bytesvalue = struct.pack(self.view.format, *value) + * else: + * bytesvalue = struct.pack(self.view.format, value) # <<<<<<<<<<<<<< + * + * for i, c in enumerate(bytesvalue): +*/ + /*else*/ { + __pyx_t_6 = __pyx_v_struct; + __Pyx_INCREF(__pyx_t_6); + __pyx_t_1 = __Pyx_PyBytes_FromString(__pyx_v_self->view.format); if (unlikely(!__pyx_t_1)) __PYX_ERR(1, 517, __pyx_L1_error) + __Pyx_GOTREF(__pyx_t_1); + __pyx_t_7 = 0; + { + PyObject *__pyx_callargs[3] = {__pyx_t_6, __pyx_t_1, __pyx_v_value}; + __pyx_t_4 = __Pyx_PyObject_FastCallMethod((PyObject*)__pyx_mstate_global->__pyx_n_u_pack, __pyx_callargs+__pyx_t_7, (3-__pyx_t_7) | (1*__Pyx_PY_VECTORCALL_ARGUMENTS_OFFSET)); + __Pyx_XDECREF(__pyx_t_6); __pyx_t_6 = 0; + __Pyx_DECREF(__pyx_t_1); __pyx_t_1 = 0; + if (unlikely(!__pyx_t_4)) __PYX_ERR(1, 517, __pyx_L1_error) + __Pyx_GOTREF(__pyx_t_4); + } + if (!(likely(PyBytes_CheckExact(__pyx_t_4))||((__pyx_t_4) == Py_None) || __Pyx_RaiseUnexpectedTypeError("bytes", __pyx_t_4))) __PYX_ERR(1, 517, __pyx_L1_error) + __pyx_v_bytesvalue = ((PyObject*)__pyx_t_4); + __pyx_t_4 = 0; + } + __pyx_L3:; + + /* "View.MemoryView":519 + * bytesvalue = struct.pack(self.view.format, value) + * + * for i, c in enumerate(bytesvalue): # <<<<<<<<<<<<<< + * itemp[i] = c + * +*/ + __pyx_t_8 = 0; + if (unlikely(__pyx_v_bytesvalue == Py_None)) { + PyErr_SetString(PyExc_TypeError, "'NoneType' is not iterable"); + __PYX_ERR(1, 519, __pyx_L1_error) + } + __Pyx_INCREF(__pyx_v_bytesvalue); + __pyx_t_9 = __pyx_v_bytesvalue; + __pyx_t_11 = __Pyx_PyBytes_AsWritableString(__pyx_t_9); if (unlikely(__pyx_t_11 == ((char *)NULL))) __PYX_ERR(1, 519, __pyx_L1_error) + __pyx_t_12 = __Pyx_PyBytes_GET_SIZE(__pyx_t_9); if (unlikely(__pyx_t_12 == ((Py_ssize_t)-1))) __PYX_ERR(1, 519, __pyx_L1_error) + __pyx_t_13 = (__pyx_t_11 + __pyx_t_12); + for (__pyx_t_14 = __pyx_t_11; __pyx_t_14 < __pyx_t_13; __pyx_t_14++) { + __pyx_t_10 = __pyx_t_14; + __pyx_v_c = (__pyx_t_10[0]); + + /* "View.MemoryView":520 + * + * for i, c in enumerate(bytesvalue): + * itemp[i] = c # <<<<<<<<<<<<<< + * + * @cname('getbuffer') +*/ + __pyx_v_i = __pyx_t_8; + + /* "View.MemoryView":519 + * bytesvalue = struct.pack(self.view.format, value) + * + * for i, c in enumerate(bytesvalue): # <<<<<<<<<<<<<< + * itemp[i] = c + * +*/ + __pyx_t_8 = (__pyx_t_8 + 1); + + /* "View.MemoryView":520 + * + * for i, c in enumerate(bytesvalue): + * itemp[i] = c # <<<<<<<<<<<<<< + * + * @cname('getbuffer') +*/ + (__pyx_v_itemp[__pyx_v_i]) = __pyx_v_c; + } + __Pyx_DECREF(__pyx_t_9); __pyx_t_9 = 0; + + /* "View.MemoryView":506 + * return result + * + * cdef assign_item_from_object(self, char *itemp, object value): # <<<<<<<<<<<<<< + * """Only used if instantiated manually by the user, or if Cython doesn't + * know how to convert the 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_4); + __Pyx_XDECREF(__pyx_t_5); + __Pyx_XDECREF(__pyx_t_6); + __Pyx_XDECREF(__pyx_t_9); + __Pyx_AddTraceback("View.MemoryView.memoryview.assign_item_from_object", __pyx_clineno, __pyx_lineno, __pyx_filename); + __pyx_r = 0; + __pyx_L0:; + __Pyx_XDECREF(__pyx_v_struct); + __Pyx_XDECREF(__pyx_v_bytesvalue); + __Pyx_XGIVEREF(__pyx_r); + __Pyx_RefNannyFinishContext(); + return __pyx_r; +} + +/* "View.MemoryView":522 + * itemp[i] = c + * + * @cname('getbuffer') # <<<<<<<<<<<<<< + * def __getbuffer__(self, Py_buffer *info, int flags): + * if flags & PyBUF_WRITABLE and self.view.readonly: +*/ + +/* Python wrapper */ +CYTHON_UNUSED static int __pyx_memoryview_getbuffer(PyObject *__pyx_v_self, Py_buffer *__pyx_v_info, int __pyx_v_flags); /*proto*/ +CYTHON_UNUSED static int __pyx_memoryview_getbuffer(PyObject *__pyx_v_self, Py_buffer *__pyx_v_info, int __pyx_v_flags) { + CYTHON_UNUSED PyObject *const *__pyx_kwvalues; + int __pyx_r; + __Pyx_RefNannyDeclarations + __Pyx_RefNannySetupContext("__getbuffer__ (wrapper)", 0); + __pyx_kwvalues = __Pyx_KwValues_VARARGS(__pyx_args, __pyx_nargs); + __pyx_r = __pyx_memoryview___pyx_pf_15View_dot_MemoryView_10memoryview_8__getbuffer__(((struct __pyx_memoryview_obj *)__pyx_v_self), ((Py_buffer *)__pyx_v_info), ((int)__pyx_v_flags)); + + /* function exit code */ + __Pyx_RefNannyFinishContext(); + return __pyx_r; +} + +static int __pyx_memoryview___pyx_pf_15View_dot_MemoryView_10memoryview_8__getbuffer__(struct __pyx_memoryview_obj *__pyx_v_self, Py_buffer *__pyx_v_info, int __pyx_v_flags) { + int __pyx_r; + __Pyx_RefNannyDeclarations + int __pyx_t_1; + int __pyx_t_2; + Py_ssize_t *__pyx_t_3; + char *__pyx_t_4; + void *__pyx_t_5; + int __pyx_t_6; + Py_ssize_t __pyx_t_7; + int __pyx_lineno = 0; + const char *__pyx_filename = NULL; + int __pyx_clineno = 0; + if (unlikely(__pyx_v_info == NULL)) { + PyErr_SetString(PyExc_BufferError, "PyObject_GetBuffer: view==NULL argument is obsolete"); + return -1; + } + __Pyx_RefNannySetupContext("__getbuffer__", 0); + __pyx_v_info->obj = Py_None; __Pyx_INCREF(Py_None); + __Pyx_GIVEREF(__pyx_v_info->obj); + + /* "View.MemoryView":524 + * @cname('getbuffer') + * def __getbuffer__(self, Py_buffer *info, int flags): + * if flags & PyBUF_WRITABLE and self.view.readonly: # <<<<<<<<<<<<<< + * raise ValueError, "Cannot create writable memory view from read-only memoryview" + * +*/ + __pyx_t_2 = ((__pyx_v_flags & PyBUF_WRITABLE) != 0); + if (__pyx_t_2) { + } else { + __pyx_t_1 = __pyx_t_2; + goto __pyx_L4_bool_binop_done; + } + __pyx_t_1 = __pyx_v_self->view.readonly; + __pyx_L4_bool_binop_done:; + if (unlikely(__pyx_t_1)) { + + /* "View.MemoryView":525 + * def __getbuffer__(self, Py_buffer *info, int flags): + * if flags & PyBUF_WRITABLE and self.view.readonly: + * raise ValueError, "Cannot create writable memory view from read-only memoryview" # <<<<<<<<<<<<<< + * + * if flags & PyBUF_ND: +*/ + __Pyx_Raise(((PyObject *)(((PyTypeObject*)PyExc_ValueError))), __pyx_mstate_global->__pyx_kp_u_Cannot_create_writable_memory_vi, 0, 0); + __PYX_ERR(1, 525, __pyx_L1_error) + + /* "View.MemoryView":524 + * @cname('getbuffer') + * def __getbuffer__(self, Py_buffer *info, int flags): + * if flags & PyBUF_WRITABLE and self.view.readonly: # <<<<<<<<<<<<<< + * raise ValueError, "Cannot create writable memory view from read-only memoryview" + * +*/ + } + + /* "View.MemoryView":527 + * raise ValueError, "Cannot create writable memory view from read-only memoryview" + * + * if flags & PyBUF_ND: # <<<<<<<<<<<<<< + * info.shape = self.view.shape + * else: +*/ + __pyx_t_1 = ((__pyx_v_flags & PyBUF_ND) != 0); + if (__pyx_t_1) { + + /* "View.MemoryView":528 + * + * if flags & PyBUF_ND: + * info.shape = self.view.shape # <<<<<<<<<<<<<< + * else: + * info.shape = NULL +*/ + __pyx_t_3 = __pyx_v_self->view.shape; + __pyx_v_info->shape = __pyx_t_3; + + /* "View.MemoryView":527 + * raise ValueError, "Cannot create writable memory view from read-only memoryview" + * + * if flags & PyBUF_ND: # <<<<<<<<<<<<<< + * info.shape = self.view.shape + * else: +*/ + goto __pyx_L6; + } + + /* "View.MemoryView":530 + * info.shape = self.view.shape + * else: + * info.shape = NULL # <<<<<<<<<<<<<< + * + * if flags & PyBUF_STRIDES: +*/ + /*else*/ { + __pyx_v_info->shape = NULL; + } + __pyx_L6:; + + /* "View.MemoryView":532 + * info.shape = NULL + * + * if flags & PyBUF_STRIDES: # <<<<<<<<<<<<<< + * info.strides = self.view.strides + * else: +*/ + __pyx_t_1 = ((__pyx_v_flags & PyBUF_STRIDES) != 0); + if (__pyx_t_1) { + + /* "View.MemoryView":533 + * + * if flags & PyBUF_STRIDES: + * info.strides = self.view.strides # <<<<<<<<<<<<<< + * else: + * info.strides = NULL +*/ + __pyx_t_3 = __pyx_v_self->view.strides; + __pyx_v_info->strides = __pyx_t_3; + + /* "View.MemoryView":532 + * info.shape = NULL + * + * if flags & PyBUF_STRIDES: # <<<<<<<<<<<<<< + * info.strides = self.view.strides + * else: +*/ + goto __pyx_L7; + } + + /* "View.MemoryView":535 + * info.strides = self.view.strides + * else: + * info.strides = NULL # <<<<<<<<<<<<<< + * + * if flags & PyBUF_INDIRECT: +*/ + /*else*/ { + __pyx_v_info->strides = NULL; + } + __pyx_L7:; + + /* "View.MemoryView":537 + * info.strides = NULL + * + * if flags & PyBUF_INDIRECT: # <<<<<<<<<<<<<< + * info.suboffsets = self.view.suboffsets + * else: +*/ + __pyx_t_1 = ((__pyx_v_flags & PyBUF_INDIRECT) != 0); + if (__pyx_t_1) { + + /* "View.MemoryView":538 + * + * if flags & PyBUF_INDIRECT: + * info.suboffsets = self.view.suboffsets # <<<<<<<<<<<<<< + * else: + * info.suboffsets = NULL +*/ + __pyx_t_3 = __pyx_v_self->view.suboffsets; + __pyx_v_info->suboffsets = __pyx_t_3; + + /* "View.MemoryView":537 + * info.strides = NULL + * + * if flags & PyBUF_INDIRECT: # <<<<<<<<<<<<<< + * info.suboffsets = self.view.suboffsets + * else: +*/ + goto __pyx_L8; + } + + /* "View.MemoryView":540 + * info.suboffsets = self.view.suboffsets + * else: + * info.suboffsets = NULL # <<<<<<<<<<<<<< + * + * if flags & PyBUF_FORMAT: +*/ + /*else*/ { + __pyx_v_info->suboffsets = NULL; + } + __pyx_L8:; + + /* "View.MemoryView":542 + * info.suboffsets = NULL + * + * if flags & PyBUF_FORMAT: # <<<<<<<<<<<<<< + * info.format = self.view.format + * else: +*/ + __pyx_t_1 = ((__pyx_v_flags & PyBUF_FORMAT) != 0); + if (__pyx_t_1) { + + /* "View.MemoryView":543 + * + * if flags & PyBUF_FORMAT: + * info.format = self.view.format # <<<<<<<<<<<<<< + * else: + * info.format = NULL +*/ + __pyx_t_4 = __pyx_v_self->view.format; + __pyx_v_info->format = __pyx_t_4; + + /* "View.MemoryView":542 + * info.suboffsets = NULL + * + * if flags & PyBUF_FORMAT: # <<<<<<<<<<<<<< + * info.format = self.view.format + * else: +*/ + goto __pyx_L9; + } + + /* "View.MemoryView":545 + * info.format = self.view.format + * else: + * info.format = NULL # <<<<<<<<<<<<<< + * + * info.buf = self.view.buf +*/ + /*else*/ { + __pyx_v_info->format = NULL; + } + __pyx_L9:; + + /* "View.MemoryView":547 + * info.format = NULL + * + * info.buf = self.view.buf # <<<<<<<<<<<<<< + * info.ndim = self.view.ndim + * info.itemsize = self.view.itemsize +*/ + __pyx_t_5 = __pyx_v_self->view.buf; + __pyx_v_info->buf = __pyx_t_5; + + /* "View.MemoryView":548 + * + * info.buf = self.view.buf + * info.ndim = self.view.ndim # <<<<<<<<<<<<<< + * info.itemsize = self.view.itemsize + * info.len = self.view.len +*/ + __pyx_t_6 = __pyx_v_self->view.ndim; + __pyx_v_info->ndim = __pyx_t_6; + + /* "View.MemoryView":549 + * info.buf = self.view.buf + * info.ndim = self.view.ndim + * info.itemsize = self.view.itemsize # <<<<<<<<<<<<<< + * info.len = self.view.len + * info.readonly = self.view.readonly +*/ + __pyx_t_7 = __pyx_v_self->view.itemsize; + __pyx_v_info->itemsize = __pyx_t_7; + + /* "View.MemoryView":550 + * info.ndim = self.view.ndim + * info.itemsize = self.view.itemsize + * info.len = self.view.len # <<<<<<<<<<<<<< + * info.readonly = self.view.readonly + * info.obj = self +*/ + __pyx_t_7 = __pyx_v_self->view.len; + __pyx_v_info->len = __pyx_t_7; + + /* "View.MemoryView":551 + * info.itemsize = self.view.itemsize + * info.len = self.view.len + * info.readonly = self.view.readonly # <<<<<<<<<<<<<< + * info.obj = self + * +*/ + __pyx_t_1 = __pyx_v_self->view.readonly; + __pyx_v_info->readonly = __pyx_t_1; + + /* "View.MemoryView":552 + * info.len = self.view.len + * info.readonly = self.view.readonly + * info.obj = self # <<<<<<<<<<<<<< + * + * +*/ + __Pyx_INCREF((PyObject *)__pyx_v_self); + __Pyx_GIVEREF((PyObject *)__pyx_v_self); + __Pyx_GOTREF(__pyx_v_info->obj); + __Pyx_DECREF(__pyx_v_info->obj); + __pyx_v_info->obj = ((PyObject *)__pyx_v_self); + + /* "View.MemoryView":522 + * itemp[i] = c + * + * @cname('getbuffer') # <<<<<<<<<<<<<< + * def __getbuffer__(self, Py_buffer *info, int flags): + * if flags & PyBUF_WRITABLE and self.view.readonly: +*/ + + /* function exit code */ + __pyx_r = 0; + goto __pyx_L0; + __pyx_L1_error:; + __Pyx_AddTraceback("View.MemoryView.memoryview.__getbuffer__", __pyx_clineno, __pyx_lineno, __pyx_filename); + __pyx_r = -1; + if (__pyx_v_info->obj != NULL) { + __Pyx_GOTREF(__pyx_v_info->obj); + __Pyx_DECREF(__pyx_v_info->obj); __pyx_v_info->obj = 0; + } + goto __pyx_L2; + __pyx_L0:; + if (__pyx_v_info->obj == Py_None) { + __Pyx_GOTREF(__pyx_v_info->obj); + __Pyx_DECREF(__pyx_v_info->obj); __pyx_v_info->obj = 0; + } + __pyx_L2:; + __Pyx_RefNannyFinishContext(); + return __pyx_r; +} + +/* "View.MemoryView":555 + * + * + * @property # <<<<<<<<<<<<<< + * def T(self): + * cdef _memoryviewslice result = memoryview_copy(self) +*/ + +/* Python wrapper */ +static PyObject *__pyx_pw_15View_dot_MemoryView_10memoryview_1T_1__get__(PyObject *__pyx_v_self); /*proto*/ +static PyObject *__pyx_pw_15View_dot_MemoryView_10memoryview_1T_1__get__(PyObject *__pyx_v_self) { + CYTHON_UNUSED PyObject *const *__pyx_kwvalues; + PyObject *__pyx_r = 0; + __Pyx_RefNannyDeclarations + __Pyx_RefNannySetupContext("__get__ (wrapper)", 0); + __pyx_kwvalues = __Pyx_KwValues_VARARGS(__pyx_args, __pyx_nargs); + __pyx_r = __pyx_pf_15View_dot_MemoryView_10memoryview_1T___get__(((struct __pyx_memoryview_obj *)__pyx_v_self)); + + /* function exit code */ + __Pyx_RefNannyFinishContext(); + return __pyx_r; +} + +static PyObject *__pyx_pf_15View_dot_MemoryView_10memoryview_1T___get__(struct __pyx_memoryview_obj *__pyx_v_self) { + struct __pyx_memoryviewslice_obj *__pyx_v_result = 0; + PyObject *__pyx_r = NULL; + __Pyx_RefNannyDeclarations + PyObject *__pyx_t_1 = NULL; + int __pyx_t_2; + int __pyx_lineno = 0; + const char *__pyx_filename = NULL; + int __pyx_clineno = 0; + __Pyx_RefNannySetupContext("__get__", 0); + + /* "View.MemoryView":557 + * @property + * def T(self): + * cdef _memoryviewslice result = memoryview_copy(self) # <<<<<<<<<<<<<< + * transpose_memslice(&result.from_slice) + * return result +*/ + __pyx_t_1 = __pyx_memoryview_copy_object(__pyx_v_self); if (unlikely(!__pyx_t_1)) __PYX_ERR(1, 557, __pyx_L1_error) + __Pyx_GOTREF(__pyx_t_1); + if (!(likely(((__pyx_t_1) == Py_None) || likely(__Pyx_TypeTest(__pyx_t_1, __pyx_mstate_global->__pyx_memoryviewslice_type))))) __PYX_ERR(1, 557, __pyx_L1_error) + __pyx_v_result = ((struct __pyx_memoryviewslice_obj *)__pyx_t_1); + __pyx_t_1 = 0; + + /* "View.MemoryView":558 + * def T(self): + * cdef _memoryviewslice result = memoryview_copy(self) + * transpose_memslice(&result.from_slice) # <<<<<<<<<<<<<< + * return result + * +*/ + __pyx_t_2 = __pyx_memslice_transpose((&__pyx_v_result->from_slice)); if (unlikely(__pyx_t_2 == ((int)-1))) __PYX_ERR(1, 558, __pyx_L1_error) + + /* "View.MemoryView":559 + * cdef _memoryviewslice result = memoryview_copy(self) + * transpose_memslice(&result.from_slice) + * return result # <<<<<<<<<<<<<< + * + * @property +*/ + __Pyx_XDECREF(__pyx_r); + __Pyx_INCREF((PyObject *)__pyx_v_result); + __pyx_r = ((PyObject *)__pyx_v_result); + goto __pyx_L0; + + /* "View.MemoryView":555 + * + * + * @property # <<<<<<<<<<<<<< + * def T(self): + * cdef _memoryviewslice result = memoryview_copy(self) +*/ + + /* function exit code */ + __pyx_L1_error:; + __Pyx_XDECREF(__pyx_t_1); + __Pyx_AddTraceback("View.MemoryView.memoryview.T.__get__", __pyx_clineno, __pyx_lineno, __pyx_filename); + __pyx_r = NULL; + __pyx_L0:; + __Pyx_XDECREF((PyObject *)__pyx_v_result); + __Pyx_XGIVEREF(__pyx_r); + __Pyx_RefNannyFinishContext(); + return __pyx_r; +} + +/* "View.MemoryView":561 + * return result + * + * @property # <<<<<<<<<<<<<< + * def base(self): + * return self._get_base() +*/ + +/* Python wrapper */ +static PyObject *__pyx_pw_15View_dot_MemoryView_10memoryview_4base_1__get__(PyObject *__pyx_v_self); /*proto*/ +static PyObject *__pyx_pw_15View_dot_MemoryView_10memoryview_4base_1__get__(PyObject *__pyx_v_self) { + CYTHON_UNUSED PyObject *const *__pyx_kwvalues; + PyObject *__pyx_r = 0; + __Pyx_RefNannyDeclarations + __Pyx_RefNannySetupContext("__get__ (wrapper)", 0); + __pyx_kwvalues = __Pyx_KwValues_VARARGS(__pyx_args, __pyx_nargs); + __pyx_r = __pyx_pf_15View_dot_MemoryView_10memoryview_4base___get__(((struct __pyx_memoryview_obj *)__pyx_v_self)); + + /* function exit code */ + __Pyx_RefNannyFinishContext(); + return __pyx_r; +} + +static PyObject *__pyx_pf_15View_dot_MemoryView_10memoryview_4base___get__(struct __pyx_memoryview_obj *__pyx_v_self) { + PyObject *__pyx_r = NULL; + __Pyx_RefNannyDeclarations + PyObject *__pyx_t_1 = NULL; + int __pyx_lineno = 0; + const char *__pyx_filename = NULL; + int __pyx_clineno = 0; + __Pyx_RefNannySetupContext("__get__", 0); + + /* "View.MemoryView":563 + * @property + * def base(self): + * return self._get_base() # <<<<<<<<<<<<<< + * + * cdef _get_base(self): +*/ + __Pyx_XDECREF(__pyx_r); + __pyx_t_1 = ((struct __pyx_vtabstruct_memoryview *)__pyx_v_self->__pyx_vtab)->_get_base(__pyx_v_self); if (unlikely(!__pyx_t_1)) __PYX_ERR(1, 563, __pyx_L1_error) + __Pyx_GOTREF(__pyx_t_1); + __pyx_r = __pyx_t_1; + __pyx_t_1 = 0; + goto __pyx_L0; + + /* "View.MemoryView":561 + * return result + * + * @property # <<<<<<<<<<<<<< + * def base(self): + * return self._get_base() +*/ + + /* function exit code */ + __pyx_L1_error:; + __Pyx_XDECREF(__pyx_t_1); + __Pyx_AddTraceback("View.MemoryView.memoryview.base.__get__", __pyx_clineno, __pyx_lineno, __pyx_filename); + __pyx_r = NULL; + __pyx_L0:; + __Pyx_XGIVEREF(__pyx_r); + __Pyx_RefNannyFinishContext(); + return __pyx_r; +} + +/* "View.MemoryView":565 + * return self._get_base() + * + * cdef _get_base(self): # <<<<<<<<<<<<<< + * return self.obj + * +*/ + +static PyObject *__pyx_memoryview__get_base(struct __pyx_memoryview_obj *__pyx_v_self) { + PyObject *__pyx_r = NULL; + __Pyx_RefNannyDeclarations + __Pyx_RefNannySetupContext("_get_base", 0); + + /* "View.MemoryView":566 + * + * cdef _get_base(self): + * return self.obj # <<<<<<<<<<<<<< + * + * @property +*/ + __Pyx_XDECREF(__pyx_r); + __Pyx_INCREF(__pyx_v_self->obj); + __pyx_r = __pyx_v_self->obj; + goto __pyx_L0; + + /* "View.MemoryView":565 + * return self._get_base() + * + * cdef _get_base(self): # <<<<<<<<<<<<<< + * return self.obj + * +*/ + + /* function exit code */ + __pyx_L0:; + __Pyx_XGIVEREF(__pyx_r); + __Pyx_RefNannyFinishContext(); + return __pyx_r; +} + +/* "View.MemoryView":568 + * return self.obj + * + * @property # <<<<<<<<<<<<<< + * def shape(self): + * return tuple([length for length in self.view.shape[:self.view.ndim]]) +*/ + +/* Python wrapper */ +static PyObject *__pyx_pw_15View_dot_MemoryView_10memoryview_5shape_1__get__(PyObject *__pyx_v_self); /*proto*/ +static PyObject *__pyx_pw_15View_dot_MemoryView_10memoryview_5shape_1__get__(PyObject *__pyx_v_self) { + CYTHON_UNUSED PyObject *const *__pyx_kwvalues; + PyObject *__pyx_r = 0; + __Pyx_RefNannyDeclarations + __Pyx_RefNannySetupContext("__get__ (wrapper)", 0); + __pyx_kwvalues = __Pyx_KwValues_VARARGS(__pyx_args, __pyx_nargs); + __pyx_r = __pyx_pf_15View_dot_MemoryView_10memoryview_5shape___get__(((struct __pyx_memoryview_obj *)__pyx_v_self)); + + /* function exit code */ + __Pyx_RefNannyFinishContext(); + return __pyx_r; +} + +static PyObject *__pyx_pf_15View_dot_MemoryView_10memoryview_5shape___get__(struct __pyx_memoryview_obj *__pyx_v_self) { + Py_ssize_t __pyx_7genexpr__pyx_v_length; + PyObject *__pyx_r = NULL; + __Pyx_RefNannyDeclarations + PyObject *__pyx_t_1 = NULL; + Py_ssize_t *__pyx_t_2; + Py_ssize_t *__pyx_t_3; + Py_ssize_t *__pyx_t_4; + PyObject *__pyx_t_5 = NULL; + int __pyx_lineno = 0; + const char *__pyx_filename = NULL; + int __pyx_clineno = 0; + __Pyx_RefNannySetupContext("__get__", 0); + + /* "View.MemoryView":570 + * @property + * def shape(self): + * return tuple([length for length in self.view.shape[:self.view.ndim]]) # <<<<<<<<<<<<<< + * + * @property +*/ + __Pyx_XDECREF(__pyx_r); + { /* enter inner scope */ + __pyx_t_1 = PyList_New(0); if (unlikely(!__pyx_t_1)) __PYX_ERR(1, 570, __pyx_L1_error) + __Pyx_GOTREF(__pyx_t_1); + __pyx_t_3 = (__pyx_v_self->view.shape + __pyx_v_self->view.ndim); + for (__pyx_t_4 = __pyx_v_self->view.shape; __pyx_t_4 < __pyx_t_3; __pyx_t_4++) { + __pyx_t_2 = __pyx_t_4; + __pyx_7genexpr__pyx_v_length = (__pyx_t_2[0]); + __pyx_t_5 = PyLong_FromSsize_t(__pyx_7genexpr__pyx_v_length); if (unlikely(!__pyx_t_5)) __PYX_ERR(1, 570, __pyx_L1_error) + __Pyx_GOTREF(__pyx_t_5); + if (unlikely(__Pyx_ListComp_Append(__pyx_t_1, (PyObject*)__pyx_t_5))) __PYX_ERR(1, 570, __pyx_L1_error) + __Pyx_DECREF(__pyx_t_5); __pyx_t_5 = 0; + } + } /* exit inner scope */ + __pyx_t_5 = PyList_AsTuple(((PyObject*)__pyx_t_1)); if (unlikely(!__pyx_t_5)) __PYX_ERR(1, 570, __pyx_L1_error) + __Pyx_GOTREF(__pyx_t_5); + __Pyx_DECREF(__pyx_t_1); __pyx_t_1 = 0; + __pyx_r = __pyx_t_5; + __pyx_t_5 = 0; + goto __pyx_L0; + + /* "View.MemoryView":568 + * return self.obj + * + * @property # <<<<<<<<<<<<<< + * def shape(self): + * return tuple([length for length in self.view.shape[:self.view.ndim]]) +*/ + + /* function exit code */ + __pyx_L1_error:; + __Pyx_XDECREF(__pyx_t_1); + __Pyx_XDECREF(__pyx_t_5); + __Pyx_AddTraceback("View.MemoryView.memoryview.shape.__get__", __pyx_clineno, __pyx_lineno, __pyx_filename); + __pyx_r = NULL; + __pyx_L0:; + __Pyx_XGIVEREF(__pyx_r); + __Pyx_RefNannyFinishContext(); + return __pyx_r; +} + +/* "View.MemoryView":572 + * return tuple([length for length in self.view.shape[:self.view.ndim]]) + * + * @property # <<<<<<<<<<<<<< + * def strides(self): + * if self.view.strides == NULL: +*/ + +/* Python wrapper */ +static PyObject *__pyx_pw_15View_dot_MemoryView_10memoryview_7strides_1__get__(PyObject *__pyx_v_self); /*proto*/ +static PyObject *__pyx_pw_15View_dot_MemoryView_10memoryview_7strides_1__get__(PyObject *__pyx_v_self) { + CYTHON_UNUSED PyObject *const *__pyx_kwvalues; + PyObject *__pyx_r = 0; + __Pyx_RefNannyDeclarations + __Pyx_RefNannySetupContext("__get__ (wrapper)", 0); + __pyx_kwvalues = __Pyx_KwValues_VARARGS(__pyx_args, __pyx_nargs); + __pyx_r = __pyx_pf_15View_dot_MemoryView_10memoryview_7strides___get__(((struct __pyx_memoryview_obj *)__pyx_v_self)); + + /* function exit code */ + __Pyx_RefNannyFinishContext(); + return __pyx_r; +} + +static PyObject *__pyx_pf_15View_dot_MemoryView_10memoryview_7strides___get__(struct __pyx_memoryview_obj *__pyx_v_self) { + Py_ssize_t __pyx_8genexpr1__pyx_v_stride; + PyObject *__pyx_r = NULL; + __Pyx_RefNannyDeclarations + int __pyx_t_1; + PyObject *__pyx_t_2 = NULL; + Py_ssize_t *__pyx_t_3; + Py_ssize_t *__pyx_t_4; + Py_ssize_t *__pyx_t_5; + PyObject *__pyx_t_6 = NULL; + int __pyx_lineno = 0; + const char *__pyx_filename = NULL; + int __pyx_clineno = 0; + __Pyx_RefNannySetupContext("__get__", 0); + + /* "View.MemoryView":574 + * @property + * def strides(self): + * if self.view.strides == NULL: # <<<<<<<<<<<<<< + * + * raise ValueError, "Buffer view does not expose strides" +*/ + __pyx_t_1 = (__pyx_v_self->view.strides == NULL); + if (unlikely(__pyx_t_1)) { + + /* "View.MemoryView":576 + * if self.view.strides == NULL: + * + * raise ValueError, "Buffer view does not expose strides" # <<<<<<<<<<<<<< + * + * return tuple([stride for stride in self.view.strides[:self.view.ndim]]) +*/ + __Pyx_Raise(((PyObject *)(((PyTypeObject*)PyExc_ValueError))), __pyx_mstate_global->__pyx_kp_u_Buffer_view_does_not_expose_stri, 0, 0); + __PYX_ERR(1, 576, __pyx_L1_error) + + /* "View.MemoryView":574 + * @property + * def strides(self): + * if self.view.strides == NULL: # <<<<<<<<<<<<<< + * + * raise ValueError, "Buffer view does not expose strides" +*/ + } + + /* "View.MemoryView":578 + * raise ValueError, "Buffer view does not expose strides" + * + * return tuple([stride for stride in self.view.strides[:self.view.ndim]]) # <<<<<<<<<<<<<< + * + * @property +*/ + __Pyx_XDECREF(__pyx_r); + { /* enter inner scope */ + __pyx_t_2 = PyList_New(0); if (unlikely(!__pyx_t_2)) __PYX_ERR(1, 578, __pyx_L1_error) + __Pyx_GOTREF(__pyx_t_2); + __pyx_t_4 = (__pyx_v_self->view.strides + __pyx_v_self->view.ndim); + for (__pyx_t_5 = __pyx_v_self->view.strides; __pyx_t_5 < __pyx_t_4; __pyx_t_5++) { + __pyx_t_3 = __pyx_t_5; + __pyx_8genexpr1__pyx_v_stride = (__pyx_t_3[0]); + __pyx_t_6 = PyLong_FromSsize_t(__pyx_8genexpr1__pyx_v_stride); if (unlikely(!__pyx_t_6)) __PYX_ERR(1, 578, __pyx_L1_error) + __Pyx_GOTREF(__pyx_t_6); + if (unlikely(__Pyx_ListComp_Append(__pyx_t_2, (PyObject*)__pyx_t_6))) __PYX_ERR(1, 578, __pyx_L1_error) + __Pyx_DECREF(__pyx_t_6); __pyx_t_6 = 0; + } + } /* exit inner scope */ + __pyx_t_6 = PyList_AsTuple(((PyObject*)__pyx_t_2)); if (unlikely(!__pyx_t_6)) __PYX_ERR(1, 578, __pyx_L1_error) + __Pyx_GOTREF(__pyx_t_6); + __Pyx_DECREF(__pyx_t_2); __pyx_t_2 = 0; + __pyx_r = __pyx_t_6; + __pyx_t_6 = 0; + goto __pyx_L0; + + /* "View.MemoryView":572 + * return tuple([length for length in self.view.shape[:self.view.ndim]]) + * + * @property # <<<<<<<<<<<<<< + * def strides(self): + * if self.view.strides == NULL: +*/ + + /* function exit code */ + __pyx_L1_error:; + __Pyx_XDECREF(__pyx_t_2); + __Pyx_XDECREF(__pyx_t_6); + __Pyx_AddTraceback("View.MemoryView.memoryview.strides.__get__", __pyx_clineno, __pyx_lineno, __pyx_filename); + __pyx_r = NULL; + __pyx_L0:; + __Pyx_XGIVEREF(__pyx_r); + __Pyx_RefNannyFinishContext(); + return __pyx_r; +} + +/* "View.MemoryView":580 + * return tuple([stride for stride in self.view.strides[:self.view.ndim]]) + * + * @property # <<<<<<<<<<<<<< + * def suboffsets(self): + * if self.view.suboffsets == NULL: +*/ + +/* Python wrapper */ +static PyObject *__pyx_pw_15View_dot_MemoryView_10memoryview_10suboffsets_1__get__(PyObject *__pyx_v_self); /*proto*/ +static PyObject *__pyx_pw_15View_dot_MemoryView_10memoryview_10suboffsets_1__get__(PyObject *__pyx_v_self) { + CYTHON_UNUSED PyObject *const *__pyx_kwvalues; + PyObject *__pyx_r = 0; + __Pyx_RefNannyDeclarations + __Pyx_RefNannySetupContext("__get__ (wrapper)", 0); + __pyx_kwvalues = __Pyx_KwValues_VARARGS(__pyx_args, __pyx_nargs); + __pyx_r = __pyx_pf_15View_dot_MemoryView_10memoryview_10suboffsets___get__(((struct __pyx_memoryview_obj *)__pyx_v_self)); + + /* function exit code */ + __Pyx_RefNannyFinishContext(); + return __pyx_r; +} + +static PyObject *__pyx_pf_15View_dot_MemoryView_10memoryview_10suboffsets___get__(struct __pyx_memoryview_obj *__pyx_v_self) { + Py_ssize_t __pyx_8genexpr2__pyx_v_suboffset; + PyObject *__pyx_r = NULL; + __Pyx_RefNannyDeclarations + int __pyx_t_1; + PyObject *__pyx_t_2 = NULL; + Py_ssize_t *__pyx_t_3; + Py_ssize_t *__pyx_t_4; + Py_ssize_t *__pyx_t_5; + PyObject *__pyx_t_6 = NULL; + int __pyx_lineno = 0; + const char *__pyx_filename = NULL; + int __pyx_clineno = 0; + __Pyx_RefNannySetupContext("__get__", 0); + + /* "View.MemoryView":582 + * @property + * def suboffsets(self): + * if self.view.suboffsets == NULL: # <<<<<<<<<<<<<< + * return (-1,) * self.view.ndim + * +*/ + __pyx_t_1 = (__pyx_v_self->view.suboffsets == NULL); + if (__pyx_t_1) { + + /* "View.MemoryView":583 + * def suboffsets(self): + * if self.view.suboffsets == NULL: + * return (-1,) * self.view.ndim # <<<<<<<<<<<<<< + * + * return tuple([suboffset for suboffset in self.view.suboffsets[:self.view.ndim]]) +*/ + __Pyx_XDECREF(__pyx_r); + __pyx_t_2 = __Pyx_PySequence_Multiply(__pyx_mstate_global->__pyx_tuple[1], __pyx_v_self->view.ndim); if (unlikely(!__pyx_t_2)) __PYX_ERR(1, 583, __pyx_L1_error) + __Pyx_GOTREF(__pyx_t_2); + __pyx_r = __pyx_t_2; + __pyx_t_2 = 0; + goto __pyx_L0; + + /* "View.MemoryView":582 + * @property + * def suboffsets(self): + * if self.view.suboffsets == NULL: # <<<<<<<<<<<<<< + * return (-1,) * self.view.ndim + * +*/ + } + + /* "View.MemoryView":585 + * return (-1,) * self.view.ndim + * + * return tuple([suboffset for suboffset in self.view.suboffsets[:self.view.ndim]]) # <<<<<<<<<<<<<< + * + * @property +*/ + __Pyx_XDECREF(__pyx_r); + { /* enter inner scope */ + __pyx_t_2 = PyList_New(0); if (unlikely(!__pyx_t_2)) __PYX_ERR(1, 585, __pyx_L1_error) + __Pyx_GOTREF(__pyx_t_2); + __pyx_t_4 = (__pyx_v_self->view.suboffsets + __pyx_v_self->view.ndim); + for (__pyx_t_5 = __pyx_v_self->view.suboffsets; __pyx_t_5 < __pyx_t_4; __pyx_t_5++) { + __pyx_t_3 = __pyx_t_5; + __pyx_8genexpr2__pyx_v_suboffset = (__pyx_t_3[0]); + __pyx_t_6 = PyLong_FromSsize_t(__pyx_8genexpr2__pyx_v_suboffset); if (unlikely(!__pyx_t_6)) __PYX_ERR(1, 585, __pyx_L1_error) + __Pyx_GOTREF(__pyx_t_6); + if (unlikely(__Pyx_ListComp_Append(__pyx_t_2, (PyObject*)__pyx_t_6))) __PYX_ERR(1, 585, __pyx_L1_error) + __Pyx_DECREF(__pyx_t_6); __pyx_t_6 = 0; + } + } /* exit inner scope */ + __pyx_t_6 = PyList_AsTuple(((PyObject*)__pyx_t_2)); if (unlikely(!__pyx_t_6)) __PYX_ERR(1, 585, __pyx_L1_error) + __Pyx_GOTREF(__pyx_t_6); + __Pyx_DECREF(__pyx_t_2); __pyx_t_2 = 0; + __pyx_r = __pyx_t_6; + __pyx_t_6 = 0; + goto __pyx_L0; + + /* "View.MemoryView":580 + * return tuple([stride for stride in self.view.strides[:self.view.ndim]]) + * + * @property # <<<<<<<<<<<<<< + * def suboffsets(self): + * if self.view.suboffsets == NULL: +*/ + + /* function exit code */ + __pyx_L1_error:; + __Pyx_XDECREF(__pyx_t_2); + __Pyx_XDECREF(__pyx_t_6); + __Pyx_AddTraceback("View.MemoryView.memoryview.suboffsets.__get__", __pyx_clineno, __pyx_lineno, __pyx_filename); + __pyx_r = NULL; + __pyx_L0:; + __Pyx_XGIVEREF(__pyx_r); + __Pyx_RefNannyFinishContext(); + return __pyx_r; +} + +/* "View.MemoryView":587 + * return tuple([suboffset for suboffset in self.view.suboffsets[:self.view.ndim]]) + * + * @property # <<<<<<<<<<<<<< + * def ndim(self): + * return self.view.ndim +*/ + +/* Python wrapper */ +static PyObject *__pyx_pw_15View_dot_MemoryView_10memoryview_4ndim_1__get__(PyObject *__pyx_v_self); /*proto*/ +static PyObject *__pyx_pw_15View_dot_MemoryView_10memoryview_4ndim_1__get__(PyObject *__pyx_v_self) { + CYTHON_UNUSED PyObject *const *__pyx_kwvalues; + PyObject *__pyx_r = 0; + __Pyx_RefNannyDeclarations + __Pyx_RefNannySetupContext("__get__ (wrapper)", 0); + __pyx_kwvalues = __Pyx_KwValues_VARARGS(__pyx_args, __pyx_nargs); + __pyx_r = __pyx_pf_15View_dot_MemoryView_10memoryview_4ndim___get__(((struct __pyx_memoryview_obj *)__pyx_v_self)); + + /* function exit code */ + __Pyx_RefNannyFinishContext(); + return __pyx_r; +} + +static PyObject *__pyx_pf_15View_dot_MemoryView_10memoryview_4ndim___get__(struct __pyx_memoryview_obj *__pyx_v_self) { + PyObject *__pyx_r = NULL; + __Pyx_RefNannyDeclarations + PyObject *__pyx_t_1 = NULL; + int __pyx_lineno = 0; + const char *__pyx_filename = NULL; + int __pyx_clineno = 0; + __Pyx_RefNannySetupContext("__get__", 0); + + /* "View.MemoryView":589 + * @property + * def ndim(self): + * return self.view.ndim # <<<<<<<<<<<<<< + * + * @property +*/ + __Pyx_XDECREF(__pyx_r); + __pyx_t_1 = __Pyx_PyLong_From_int(__pyx_v_self->view.ndim); if (unlikely(!__pyx_t_1)) __PYX_ERR(1, 589, __pyx_L1_error) + __Pyx_GOTREF(__pyx_t_1); + __pyx_r = __pyx_t_1; + __pyx_t_1 = 0; + goto __pyx_L0; + + /* "View.MemoryView":587 + * return tuple([suboffset for suboffset in self.view.suboffsets[:self.view.ndim]]) + * + * @property # <<<<<<<<<<<<<< + * def ndim(self): + * return self.view.ndim +*/ + + /* function exit code */ + __pyx_L1_error:; + __Pyx_XDECREF(__pyx_t_1); + __Pyx_AddTraceback("View.MemoryView.memoryview.ndim.__get__", __pyx_clineno, __pyx_lineno, __pyx_filename); + __pyx_r = NULL; + __pyx_L0:; + __Pyx_XGIVEREF(__pyx_r); + __Pyx_RefNannyFinishContext(); + return __pyx_r; +} + +/* "View.MemoryView":591 + * return self.view.ndim + * + * @property # <<<<<<<<<<<<<< + * def itemsize(self): + * return self.view.itemsize +*/ + +/* Python wrapper */ +static PyObject *__pyx_pw_15View_dot_MemoryView_10memoryview_8itemsize_1__get__(PyObject *__pyx_v_self); /*proto*/ +static PyObject *__pyx_pw_15View_dot_MemoryView_10memoryview_8itemsize_1__get__(PyObject *__pyx_v_self) { + CYTHON_UNUSED PyObject *const *__pyx_kwvalues; + PyObject *__pyx_r = 0; + __Pyx_RefNannyDeclarations + __Pyx_RefNannySetupContext("__get__ (wrapper)", 0); + __pyx_kwvalues = __Pyx_KwValues_VARARGS(__pyx_args, __pyx_nargs); + __pyx_r = __pyx_pf_15View_dot_MemoryView_10memoryview_8itemsize___get__(((struct __pyx_memoryview_obj *)__pyx_v_self)); + + /* function exit code */ + __Pyx_RefNannyFinishContext(); + return __pyx_r; +} + +static PyObject *__pyx_pf_15View_dot_MemoryView_10memoryview_8itemsize___get__(struct __pyx_memoryview_obj *__pyx_v_self) { + PyObject *__pyx_r = NULL; + __Pyx_RefNannyDeclarations + PyObject *__pyx_t_1 = NULL; + int __pyx_lineno = 0; + const char *__pyx_filename = NULL; + int __pyx_clineno = 0; + __Pyx_RefNannySetupContext("__get__", 0); + + /* "View.MemoryView":593 + * @property + * def itemsize(self): + * return self.view.itemsize # <<<<<<<<<<<<<< + * + * @property +*/ + __Pyx_XDECREF(__pyx_r); + __pyx_t_1 = PyLong_FromSsize_t(__pyx_v_self->view.itemsize); if (unlikely(!__pyx_t_1)) __PYX_ERR(1, 593, __pyx_L1_error) + __Pyx_GOTREF(__pyx_t_1); + __pyx_r = __pyx_t_1; + __pyx_t_1 = 0; + goto __pyx_L0; + + /* "View.MemoryView":591 + * return self.view.ndim + * + * @property # <<<<<<<<<<<<<< + * def itemsize(self): + * return self.view.itemsize +*/ + + /* function exit code */ + __pyx_L1_error:; + __Pyx_XDECREF(__pyx_t_1); + __Pyx_AddTraceback("View.MemoryView.memoryview.itemsize.__get__", __pyx_clineno, __pyx_lineno, __pyx_filename); + __pyx_r = NULL; + __pyx_L0:; + __Pyx_XGIVEREF(__pyx_r); + __Pyx_RefNannyFinishContext(); + return __pyx_r; +} + +/* "View.MemoryView":595 + * return self.view.itemsize + * + * @property # <<<<<<<<<<<<<< + * def nbytes(self): + * return self.size * self.view.itemsize +*/ + +/* Python wrapper */ +static PyObject *__pyx_pw_15View_dot_MemoryView_10memoryview_6nbytes_1__get__(PyObject *__pyx_v_self); /*proto*/ +static PyObject *__pyx_pw_15View_dot_MemoryView_10memoryview_6nbytes_1__get__(PyObject *__pyx_v_self) { + CYTHON_UNUSED PyObject *const *__pyx_kwvalues; + PyObject *__pyx_r = 0; + __Pyx_RefNannyDeclarations + __Pyx_RefNannySetupContext("__get__ (wrapper)", 0); + __pyx_kwvalues = __Pyx_KwValues_VARARGS(__pyx_args, __pyx_nargs); + __pyx_r = __pyx_pf_15View_dot_MemoryView_10memoryview_6nbytes___get__(((struct __pyx_memoryview_obj *)__pyx_v_self)); + + /* function exit code */ + __Pyx_RefNannyFinishContext(); + return __pyx_r; +} + +static PyObject *__pyx_pf_15View_dot_MemoryView_10memoryview_6nbytes___get__(struct __pyx_memoryview_obj *__pyx_v_self) { + PyObject *__pyx_r = NULL; + __Pyx_RefNannyDeclarations + PyObject *__pyx_t_1 = NULL; + PyObject *__pyx_t_2 = NULL; + PyObject *__pyx_t_3 = NULL; + int __pyx_lineno = 0; + const char *__pyx_filename = NULL; + int __pyx_clineno = 0; + __Pyx_RefNannySetupContext("__get__", 0); + + /* "View.MemoryView":597 + * @property + * def nbytes(self): + * return self.size * self.view.itemsize # <<<<<<<<<<<<<< + * + * @property +*/ + __Pyx_XDECREF(__pyx_r); + __pyx_t_1 = __Pyx_PyObject_GetAttrStr(((PyObject *)__pyx_v_self), __pyx_mstate_global->__pyx_n_u_size); if (unlikely(!__pyx_t_1)) __PYX_ERR(1, 597, __pyx_L1_error) + __Pyx_GOTREF(__pyx_t_1); + __pyx_t_2 = PyLong_FromSsize_t(__pyx_v_self->view.itemsize); if (unlikely(!__pyx_t_2)) __PYX_ERR(1, 597, __pyx_L1_error) + __Pyx_GOTREF(__pyx_t_2); + __pyx_t_3 = PyNumber_Multiply(__pyx_t_1, __pyx_t_2); if (unlikely(!__pyx_t_3)) __PYX_ERR(1, 597, __pyx_L1_error) + __Pyx_GOTREF(__pyx_t_3); + __Pyx_DECREF(__pyx_t_1); __pyx_t_1 = 0; + __Pyx_DECREF(__pyx_t_2); __pyx_t_2 = 0; + __pyx_r = __pyx_t_3; + __pyx_t_3 = 0; + goto __pyx_L0; + + /* "View.MemoryView":595 + * return self.view.itemsize + * + * @property # <<<<<<<<<<<<<< + * def nbytes(self): + * return self.size * self.view.itemsize +*/ + + /* function exit code */ + __pyx_L1_error:; + __Pyx_XDECREF(__pyx_t_1); + __Pyx_XDECREF(__pyx_t_2); + __Pyx_XDECREF(__pyx_t_3); + __Pyx_AddTraceback("View.MemoryView.memoryview.nbytes.__get__", __pyx_clineno, __pyx_lineno, __pyx_filename); + __pyx_r = NULL; + __pyx_L0:; + __Pyx_XGIVEREF(__pyx_r); + __Pyx_RefNannyFinishContext(); + return __pyx_r; +} + +/* "View.MemoryView":599 + * return self.size * self.view.itemsize + * + * @property # <<<<<<<<<<<<<< + * def size(self): + * if self._size is None: +*/ + +/* Python wrapper */ +static PyObject *__pyx_pw_15View_dot_MemoryView_10memoryview_4size_1__get__(PyObject *__pyx_v_self); /*proto*/ +static PyObject *__pyx_pw_15View_dot_MemoryView_10memoryview_4size_1__get__(PyObject *__pyx_v_self) { + CYTHON_UNUSED PyObject *const *__pyx_kwvalues; + PyObject *__pyx_r = 0; + __Pyx_RefNannyDeclarations + __Pyx_RefNannySetupContext("__get__ (wrapper)", 0); + __pyx_kwvalues = __Pyx_KwValues_VARARGS(__pyx_args, __pyx_nargs); + __pyx_r = __pyx_pf_15View_dot_MemoryView_10memoryview_4size___get__(((struct __pyx_memoryview_obj *)__pyx_v_self)); + + /* function exit code */ + __Pyx_RefNannyFinishContext(); + return __pyx_r; +} + +static PyObject *__pyx_pf_15View_dot_MemoryView_10memoryview_4size___get__(struct __pyx_memoryview_obj *__pyx_v_self) { + PyObject *__pyx_v_result = NULL; + PyObject *__pyx_v_length = NULL; + PyObject *__pyx_r = NULL; + __Pyx_RefNannyDeclarations + int __pyx_t_1; + Py_ssize_t *__pyx_t_2; + Py_ssize_t *__pyx_t_3; + Py_ssize_t *__pyx_t_4; + PyObject *__pyx_t_5 = NULL; + int __pyx_lineno = 0; + const char *__pyx_filename = NULL; + int __pyx_clineno = 0; + __Pyx_RefNannySetupContext("__get__", 0); + + /* "View.MemoryView":601 + * @property + * def size(self): + * if self._size is None: # <<<<<<<<<<<<<< + * result = 1 + * +*/ + __pyx_t_1 = (__pyx_v_self->_size == Py_None); + if (__pyx_t_1) { + + /* "View.MemoryView":602 + * def size(self): + * if self._size is None: + * result = 1 # <<<<<<<<<<<<<< + * + * for length in self.view.shape[:self.view.ndim]: +*/ + __Pyx_INCREF(__pyx_mstate_global->__pyx_int_1); + __pyx_v_result = __pyx_mstate_global->__pyx_int_1; + + /* "View.MemoryView":604 + * result = 1 + * + * for length in self.view.shape[:self.view.ndim]: # <<<<<<<<<<<<<< + * result *= length + * +*/ + __pyx_t_3 = (__pyx_v_self->view.shape + __pyx_v_self->view.ndim); + for (__pyx_t_4 = __pyx_v_self->view.shape; __pyx_t_4 < __pyx_t_3; __pyx_t_4++) { + __pyx_t_2 = __pyx_t_4; + __pyx_t_5 = PyLong_FromSsize_t((__pyx_t_2[0])); if (unlikely(!__pyx_t_5)) __PYX_ERR(1, 604, __pyx_L1_error) + __Pyx_GOTREF(__pyx_t_5); + __Pyx_XDECREF_SET(__pyx_v_length, __pyx_t_5); + __pyx_t_5 = 0; + + /* "View.MemoryView":605 + * + * for length in self.view.shape[:self.view.ndim]: + * result *= length # <<<<<<<<<<<<<< + * + * self._size = result +*/ + __pyx_t_5 = PyNumber_InPlaceMultiply(__pyx_v_result, __pyx_v_length); if (unlikely(!__pyx_t_5)) __PYX_ERR(1, 605, __pyx_L1_error) + __Pyx_GOTREF(__pyx_t_5); + __Pyx_DECREF_SET(__pyx_v_result, __pyx_t_5); + __pyx_t_5 = 0; + } + + /* "View.MemoryView":607 + * result *= length + * + * self._size = result # <<<<<<<<<<<<<< + * + * return self._size +*/ + __Pyx_INCREF(__pyx_v_result); + __Pyx_GIVEREF(__pyx_v_result); + __Pyx_GOTREF(__pyx_v_self->_size); + __Pyx_DECREF(__pyx_v_self->_size); + __pyx_v_self->_size = __pyx_v_result; + + /* "View.MemoryView":601 + * @property + * def size(self): + * if self._size is None: # <<<<<<<<<<<<<< + * result = 1 + * +*/ + } + + /* "View.MemoryView":609 + * self._size = result + * + * return self._size # <<<<<<<<<<<<<< + * + * def __len__(self): +*/ + __Pyx_XDECREF(__pyx_r); + __Pyx_INCREF(__pyx_v_self->_size); + __pyx_r = __pyx_v_self->_size; + goto __pyx_L0; + + /* "View.MemoryView":599 + * return self.size * self.view.itemsize + * + * @property # <<<<<<<<<<<<<< + * def size(self): + * if self._size is None: +*/ + + /* function exit code */ + __pyx_L1_error:; + __Pyx_XDECREF(__pyx_t_5); + __Pyx_AddTraceback("View.MemoryView.memoryview.size.__get__", __pyx_clineno, __pyx_lineno, __pyx_filename); + __pyx_r = NULL; + __pyx_L0:; + __Pyx_XDECREF(__pyx_v_result); + __Pyx_XDECREF(__pyx_v_length); + __Pyx_XGIVEREF(__pyx_r); + __Pyx_RefNannyFinishContext(); + return __pyx_r; +} + +/* "View.MemoryView":611 + * return self._size + * + * def __len__(self): # <<<<<<<<<<<<<< + * if self.view.ndim >= 1: + * return self.view.shape[0] +*/ + +/* Python wrapper */ +static Py_ssize_t __pyx_memoryview___len__(PyObject *__pyx_v_self); /*proto*/ +static Py_ssize_t __pyx_memoryview___len__(PyObject *__pyx_v_self) { + CYTHON_UNUSED PyObject *const *__pyx_kwvalues; + Py_ssize_t __pyx_r; + __Pyx_RefNannyDeclarations + __Pyx_RefNannySetupContext("__len__ (wrapper)", 0); + __pyx_kwvalues = __Pyx_KwValues_VARARGS(__pyx_args, __pyx_nargs); + __pyx_r = __pyx_memoryview___pyx_pf_15View_dot_MemoryView_10memoryview_10__len__(((struct __pyx_memoryview_obj *)__pyx_v_self)); + + /* function exit code */ + __Pyx_RefNannyFinishContext(); + return __pyx_r; +} + +static Py_ssize_t __pyx_memoryview___pyx_pf_15View_dot_MemoryView_10memoryview_10__len__(struct __pyx_memoryview_obj *__pyx_v_self) { + Py_ssize_t __pyx_r; + int __pyx_t_1; + + /* "View.MemoryView":612 + * + * def __len__(self): + * if self.view.ndim >= 1: # <<<<<<<<<<<<<< + * return self.view.shape[0] + * +*/ + __pyx_t_1 = (__pyx_v_self->view.ndim >= 1); + if (__pyx_t_1) { + + /* "View.MemoryView":613 + * def __len__(self): + * if self.view.ndim >= 1: + * return self.view.shape[0] # <<<<<<<<<<<<<< + * + * return 0 +*/ + __pyx_r = (__pyx_v_self->view.shape[0]); + goto __pyx_L0; + + /* "View.MemoryView":612 + * + * def __len__(self): + * if self.view.ndim >= 1: # <<<<<<<<<<<<<< + * return self.view.shape[0] + * +*/ + } + + /* "View.MemoryView":615 + * return self.view.shape[0] + * + * return 0 # <<<<<<<<<<<<<< + * + * def __repr__(self): +*/ + __pyx_r = 0; + goto __pyx_L0; + + /* "View.MemoryView":611 + * return self._size + * + * def __len__(self): # <<<<<<<<<<<<<< + * if self.view.ndim >= 1: + * return self.view.shape[0] +*/ + + /* function exit code */ + __pyx_L0:; + return __pyx_r; +} + +/* "View.MemoryView":617 + * return 0 + * + * def __repr__(self): # <<<<<<<<<<<<<< + * return "" % (self.base.__class__.__name__, + * id(self)) +*/ + +/* Python wrapper */ +static PyObject *__pyx_memoryview___repr__(PyObject *__pyx_v_self); /*proto*/ +static PyObject *__pyx_memoryview___repr__(PyObject *__pyx_v_self) { + CYTHON_UNUSED PyObject *const *__pyx_kwvalues; + PyObject *__pyx_r = 0; + __Pyx_RefNannyDeclarations + __Pyx_RefNannySetupContext("__repr__ (wrapper)", 0); + __pyx_kwvalues = __Pyx_KwValues_VARARGS(__pyx_args, __pyx_nargs); + __pyx_r = __pyx_memoryview___pyx_pf_15View_dot_MemoryView_10memoryview_12__repr__(((struct __pyx_memoryview_obj *)__pyx_v_self)); + + /* function exit code */ + __Pyx_RefNannyFinishContext(); + return __pyx_r; +} + +static PyObject *__pyx_memoryview___pyx_pf_15View_dot_MemoryView_10memoryview_12__repr__(struct __pyx_memoryview_obj *__pyx_v_self) { + PyObject *__pyx_r = NULL; + __Pyx_RefNannyDeclarations + PyObject *__pyx_t_1 = NULL; + PyObject *__pyx_t_2 = NULL; + PyObject *__pyx_t_3 = NULL; + PyObject *__pyx_t_4[5]; + int __pyx_lineno = 0; + const char *__pyx_filename = NULL; + int __pyx_clineno = 0; + __Pyx_RefNannySetupContext("__repr__", 0); + + /* "View.MemoryView":618 + * + * def __repr__(self): + * return "" % (self.base.__class__.__name__, # <<<<<<<<<<<<<< + * id(self)) + * +*/ + __Pyx_XDECREF(__pyx_r); + __pyx_t_1 = __Pyx_PyObject_GetAttrStr(((PyObject *)__pyx_v_self), __pyx_mstate_global->__pyx_n_u_base); if (unlikely(!__pyx_t_1)) __PYX_ERR(1, 618, __pyx_L1_error) + __Pyx_GOTREF(__pyx_t_1); + __pyx_t_2 = __Pyx_PyObject_GetAttrStr(__pyx_t_1, __pyx_mstate_global->__pyx_n_u_class); if (unlikely(!__pyx_t_2)) __PYX_ERR(1, 618, __pyx_L1_error) + __Pyx_GOTREF(__pyx_t_2); + __Pyx_DECREF(__pyx_t_1); __pyx_t_1 = 0; + __pyx_t_1 = __Pyx_PyObject_GetAttrStr(__pyx_t_2, __pyx_mstate_global->__pyx_n_u_name_2); if (unlikely(!__pyx_t_1)) __PYX_ERR(1, 618, __pyx_L1_error) + __Pyx_GOTREF(__pyx_t_1); + __Pyx_DECREF(__pyx_t_2); __pyx_t_2 = 0; + __pyx_t_2 = __Pyx_PyObject_FormatSimpleAndDecref(PyObject_Repr(__pyx_t_1), __pyx_mstate_global->__pyx_empty_unicode); if (unlikely(!__pyx_t_2)) __PYX_ERR(1, 618, __pyx_L1_error) + __Pyx_GOTREF(__pyx_t_2); + __Pyx_DECREF(__pyx_t_1); __pyx_t_1 = 0; + + /* "View.MemoryView":619 + * def __repr__(self): + * return "" % (self.base.__class__.__name__, + * id(self)) # <<<<<<<<<<<<<< + * + * def __str__(self): +*/ + __pyx_t_1 = __Pyx_PyObject_CallOneArg(__pyx_builtin_id, ((PyObject *)__pyx_v_self)); if (unlikely(!__pyx_t_1)) __PYX_ERR(1, 619, __pyx_L1_error) + __Pyx_GOTREF(__pyx_t_1); + __pyx_t_3 = __Pyx_PyObject_Format(__pyx_t_1, __pyx_mstate_global->__pyx_n_u_x); if (unlikely(!__pyx_t_3)) __PYX_ERR(1, 619, __pyx_L1_error) + __Pyx_GOTREF(__pyx_t_3); + __Pyx_DECREF(__pyx_t_1); __pyx_t_1 = 0; + __pyx_t_4[0] = __pyx_mstate_global->__pyx_kp_u_MemoryView_of; + __pyx_t_4[1] = __pyx_t_2; + __pyx_t_4[2] = __pyx_mstate_global->__pyx_kp_u_at_0x; + __pyx_t_4[3] = __pyx_t_3; + __pyx_t_4[4] = __pyx_mstate_global->__pyx_kp_u__3; + + /* "View.MemoryView":618 + * + * def __repr__(self): + * return "" % (self.base.__class__.__name__, # <<<<<<<<<<<<<< + * id(self)) + * +*/ + __pyx_t_1 = __Pyx_PyUnicode_Join(__pyx_t_4, 5, 15 + __Pyx_PyUnicode_GET_LENGTH(__pyx_t_2) + 6 + __Pyx_PyUnicode_GET_LENGTH(__pyx_t_3) + 1, 127 | __Pyx_PyUnicode_MAX_CHAR_VALUE(__pyx_t_2) | __Pyx_PyUnicode_MAX_CHAR_VALUE(__pyx_t_3)); + if (unlikely(!__pyx_t_1)) __PYX_ERR(1, 618, __pyx_L1_error) + __Pyx_GOTREF(__pyx_t_1); + __Pyx_DECREF(__pyx_t_2); __pyx_t_2 = 0; + __Pyx_DECREF(__pyx_t_3); __pyx_t_3 = 0; + __pyx_r = __pyx_t_1; + __pyx_t_1 = 0; + goto __pyx_L0; + + /* "View.MemoryView":617 + * return 0 + * + * def __repr__(self): # <<<<<<<<<<<<<< + * return "" % (self.base.__class__.__name__, + * id(self)) +*/ + + /* function exit code */ + __pyx_L1_error:; + __Pyx_XDECREF(__pyx_t_1); + __Pyx_XDECREF(__pyx_t_2); + __Pyx_XDECREF(__pyx_t_3); + __Pyx_AddTraceback("View.MemoryView.memoryview.__repr__", __pyx_clineno, __pyx_lineno, __pyx_filename); + __pyx_r = NULL; + __pyx_L0:; + __Pyx_XGIVEREF(__pyx_r); + __Pyx_RefNannyFinishContext(); + return __pyx_r; +} + +/* "View.MemoryView":621 + * id(self)) + * + * def __str__(self): # <<<<<<<<<<<<<< + * return "" % (self.base.__class__.__name__,) + * +*/ + +/* Python wrapper */ +static PyObject *__pyx_memoryview___str__(PyObject *__pyx_v_self); /*proto*/ +static PyObject *__pyx_memoryview___str__(PyObject *__pyx_v_self) { + CYTHON_UNUSED PyObject *const *__pyx_kwvalues; + PyObject *__pyx_r = 0; + __Pyx_RefNannyDeclarations + __Pyx_RefNannySetupContext("__str__ (wrapper)", 0); + __pyx_kwvalues = __Pyx_KwValues_VARARGS(__pyx_args, __pyx_nargs); + __pyx_r = __pyx_memoryview___pyx_pf_15View_dot_MemoryView_10memoryview_14__str__(((struct __pyx_memoryview_obj *)__pyx_v_self)); + + /* function exit code */ + __Pyx_RefNannyFinishContext(); + return __pyx_r; +} + +static PyObject *__pyx_memoryview___pyx_pf_15View_dot_MemoryView_10memoryview_14__str__(struct __pyx_memoryview_obj *__pyx_v_self) { + PyObject *__pyx_r = NULL; + __Pyx_RefNannyDeclarations + PyObject *__pyx_t_1 = NULL; + PyObject *__pyx_t_2 = NULL; + PyObject *__pyx_t_3[3]; + int __pyx_lineno = 0; + const char *__pyx_filename = NULL; + int __pyx_clineno = 0; + __Pyx_RefNannySetupContext("__str__", 0); + + /* "View.MemoryView":622 + * + * def __str__(self): + * return "" % (self.base.__class__.__name__,) # <<<<<<<<<<<<<< + * + * +*/ + __Pyx_XDECREF(__pyx_r); + __pyx_t_1 = __Pyx_PyObject_GetAttrStr(((PyObject *)__pyx_v_self), __pyx_mstate_global->__pyx_n_u_base); if (unlikely(!__pyx_t_1)) __PYX_ERR(1, 622, __pyx_L1_error) + __Pyx_GOTREF(__pyx_t_1); + __pyx_t_2 = __Pyx_PyObject_GetAttrStr(__pyx_t_1, __pyx_mstate_global->__pyx_n_u_class); if (unlikely(!__pyx_t_2)) __PYX_ERR(1, 622, __pyx_L1_error) + __Pyx_GOTREF(__pyx_t_2); + __Pyx_DECREF(__pyx_t_1); __pyx_t_1 = 0; + __pyx_t_1 = __Pyx_PyObject_GetAttrStr(__pyx_t_2, __pyx_mstate_global->__pyx_n_u_name_2); if (unlikely(!__pyx_t_1)) __PYX_ERR(1, 622, __pyx_L1_error) + __Pyx_GOTREF(__pyx_t_1); + __Pyx_DECREF(__pyx_t_2); __pyx_t_2 = 0; + __pyx_t_2 = __Pyx_PyObject_FormatSimpleAndDecref(PyObject_Repr(__pyx_t_1), __pyx_mstate_global->__pyx_empty_unicode); if (unlikely(!__pyx_t_2)) __PYX_ERR(1, 622, __pyx_L1_error) + __Pyx_GOTREF(__pyx_t_2); + __Pyx_DECREF(__pyx_t_1); __pyx_t_1 = 0; + __pyx_t_3[0] = __pyx_mstate_global->__pyx_kp_u_MemoryView_of; + __pyx_t_3[1] = __pyx_t_2; + __pyx_t_3[2] = __pyx_mstate_global->__pyx_kp_u_object; + __pyx_t_1 = __Pyx_PyUnicode_Join(__pyx_t_3, 3, 15 + __Pyx_PyUnicode_GET_LENGTH(__pyx_t_2) + 8, 127 | __Pyx_PyUnicode_MAX_CHAR_VALUE(__pyx_t_2)); + if (unlikely(!__pyx_t_1)) __PYX_ERR(1, 622, __pyx_L1_error) + __Pyx_GOTREF(__pyx_t_1); + __Pyx_DECREF(__pyx_t_2); __pyx_t_2 = 0; + __pyx_r = __pyx_t_1; + __pyx_t_1 = 0; + goto __pyx_L0; + + /* "View.MemoryView":621 + * id(self)) + * + * def __str__(self): # <<<<<<<<<<<<<< + * return "" % (self.base.__class__.__name__,) + * +*/ + + /* function exit code */ + __pyx_L1_error:; + __Pyx_XDECREF(__pyx_t_1); + __Pyx_XDECREF(__pyx_t_2); + __Pyx_AddTraceback("View.MemoryView.memoryview.__str__", __pyx_clineno, __pyx_lineno, __pyx_filename); + __pyx_r = NULL; + __pyx_L0:; + __Pyx_XGIVEREF(__pyx_r); + __Pyx_RefNannyFinishContext(); + return __pyx_r; +} + +/* "View.MemoryView":625 + * + * + * def is_c_contig(self): # <<<<<<<<<<<<<< + * cdef __Pyx_memviewslice *mslice + * cdef __Pyx_memviewslice tmp +*/ + +/* Python wrapper */ +static PyObject *__pyx_memoryview_is_c_contig(PyObject *__pyx_v_self, +#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*/ +static PyObject *__pyx_memoryview_is_c_contig(PyObject *__pyx_v_self, +#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_c_contig (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_c_contig", 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_c_contig", __pyx_kwds); return NULL;} + __pyx_r = __pyx_memoryview___pyx_pf_15View_dot_MemoryView_10memoryview_16is_c_contig(((struct __pyx_memoryview_obj *)__pyx_v_self)); + + /* function exit code */ + __Pyx_RefNannyFinishContext(); + return __pyx_r; +} + +static PyObject *__pyx_memoryview___pyx_pf_15View_dot_MemoryView_10memoryview_16is_c_contig(struct __pyx_memoryview_obj *__pyx_v_self) { + __Pyx_memviewslice *__pyx_v_mslice; + __Pyx_memviewslice __pyx_v_tmp; + PyObject *__pyx_r = NULL; + __Pyx_RefNannyDeclarations + __Pyx_memviewslice *__pyx_t_1; + PyObject *__pyx_t_2 = NULL; + int __pyx_lineno = 0; + const char *__pyx_filename = NULL; + int __pyx_clineno = 0; + __Pyx_RefNannySetupContext("is_c_contig", 0); + + /* "View.MemoryView":628 + * cdef __Pyx_memviewslice *mslice + * cdef __Pyx_memviewslice tmp + * mslice = get_slice_from_memview(self, &tmp) # <<<<<<<<<<<<<< + * return slice_is_contig(mslice[0], 'C', self.view.ndim) + * +*/ + __pyx_t_1 = __pyx_memoryview_get_slice_from_memoryview(__pyx_v_self, (&__pyx_v_tmp)); if (unlikely(__pyx_t_1 == ((void *)NULL))) __PYX_ERR(1, 628, __pyx_L1_error) + __pyx_v_mslice = __pyx_t_1; + + /* "View.MemoryView":629 + * cdef __Pyx_memviewslice tmp + * mslice = get_slice_from_memview(self, &tmp) + * return slice_is_contig(mslice[0], 'C', self.view.ndim) # <<<<<<<<<<<<<< + * + * def is_f_contig(self): +*/ + __Pyx_XDECREF(__pyx_r); + __pyx_t_2 = __Pyx_PyBool_FromLong(__pyx_memviewslice_is_contig((__pyx_v_mslice[0]), 'C', __pyx_v_self->view.ndim)); if (unlikely(!__pyx_t_2)) __PYX_ERR(1, 629, __pyx_L1_error) + __Pyx_GOTREF(__pyx_t_2); + __pyx_r = __pyx_t_2; + __pyx_t_2 = 0; + goto __pyx_L0; + + /* "View.MemoryView":625 + * + * + * def is_c_contig(self): # <<<<<<<<<<<<<< + * cdef __Pyx_memviewslice *mslice + * cdef __Pyx_memviewslice tmp +*/ + + /* function exit code */ + __pyx_L1_error:; + __Pyx_XDECREF(__pyx_t_2); + __Pyx_AddTraceback("View.MemoryView.memoryview.is_c_contig", __pyx_clineno, __pyx_lineno, __pyx_filename); + __pyx_r = NULL; + __pyx_L0:; + __Pyx_XGIVEREF(__pyx_r); + __Pyx_RefNannyFinishContext(); + return __pyx_r; +} + +/* "View.MemoryView":631 + * return slice_is_contig(mslice[0], 'C', self.view.ndim) + * + * def is_f_contig(self): # <<<<<<<<<<<<<< + * cdef __Pyx_memviewslice *mslice + * cdef __Pyx_memviewslice tmp +*/ + +/* Python wrapper */ +static PyObject *__pyx_memoryview_is_f_contig(PyObject *__pyx_v_self, +#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*/ +static PyObject *__pyx_memoryview_is_f_contig(PyObject *__pyx_v_self, +#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_f_contig (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_f_contig", 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_f_contig", __pyx_kwds); return NULL;} + __pyx_r = __pyx_memoryview___pyx_pf_15View_dot_MemoryView_10memoryview_18is_f_contig(((struct __pyx_memoryview_obj *)__pyx_v_self)); + + /* function exit code */ + __Pyx_RefNannyFinishContext(); + return __pyx_r; +} + +static PyObject *__pyx_memoryview___pyx_pf_15View_dot_MemoryView_10memoryview_18is_f_contig(struct __pyx_memoryview_obj *__pyx_v_self) { + __Pyx_memviewslice *__pyx_v_mslice; + __Pyx_memviewslice __pyx_v_tmp; + PyObject *__pyx_r = NULL; + __Pyx_RefNannyDeclarations + __Pyx_memviewslice *__pyx_t_1; + PyObject *__pyx_t_2 = NULL; + int __pyx_lineno = 0; + const char *__pyx_filename = NULL; + int __pyx_clineno = 0; + __Pyx_RefNannySetupContext("is_f_contig", 0); + + /* "View.MemoryView":634 + * cdef __Pyx_memviewslice *mslice + * cdef __Pyx_memviewslice tmp + * mslice = get_slice_from_memview(self, &tmp) # <<<<<<<<<<<<<< + * return slice_is_contig(mslice[0], 'F', self.view.ndim) + * +*/ + __pyx_t_1 = __pyx_memoryview_get_slice_from_memoryview(__pyx_v_self, (&__pyx_v_tmp)); if (unlikely(__pyx_t_1 == ((void *)NULL))) __PYX_ERR(1, 634, __pyx_L1_error) + __pyx_v_mslice = __pyx_t_1; + + /* "View.MemoryView":635 + * cdef __Pyx_memviewslice tmp + * mslice = get_slice_from_memview(self, &tmp) + * return slice_is_contig(mslice[0], 'F', self.view.ndim) # <<<<<<<<<<<<<< + * + * def copy(self): +*/ + __Pyx_XDECREF(__pyx_r); + __pyx_t_2 = __Pyx_PyBool_FromLong(__pyx_memviewslice_is_contig((__pyx_v_mslice[0]), 'F', __pyx_v_self->view.ndim)); if (unlikely(!__pyx_t_2)) __PYX_ERR(1, 635, __pyx_L1_error) + __Pyx_GOTREF(__pyx_t_2); + __pyx_r = __pyx_t_2; + __pyx_t_2 = 0; + goto __pyx_L0; + + /* "View.MemoryView":631 + * return slice_is_contig(mslice[0], 'C', self.view.ndim) + * + * def is_f_contig(self): # <<<<<<<<<<<<<< + * cdef __Pyx_memviewslice *mslice + * cdef __Pyx_memviewslice tmp +*/ + + /* function exit code */ + __pyx_L1_error:; + __Pyx_XDECREF(__pyx_t_2); + __Pyx_AddTraceback("View.MemoryView.memoryview.is_f_contig", __pyx_clineno, __pyx_lineno, __pyx_filename); + __pyx_r = NULL; + __pyx_L0:; + __Pyx_XGIVEREF(__pyx_r); + __Pyx_RefNannyFinishContext(); + return __pyx_r; +} + +/* "View.MemoryView":637 + * return slice_is_contig(mslice[0], 'F', self.view.ndim) + * + * def copy(self): # <<<<<<<<<<<<<< + * cdef __Pyx_memviewslice mslice + * cdef int flags = self.flags & ~PyBUF_F_CONTIGUOUS +*/ + +/* Python wrapper */ +static PyObject *__pyx_memoryview_copy(PyObject *__pyx_v_self, +#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*/ +static PyObject *__pyx_memoryview_copy(PyObject *__pyx_v_self, +#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("copy (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("copy", 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("copy", __pyx_kwds); return NULL;} + __pyx_r = __pyx_memoryview___pyx_pf_15View_dot_MemoryView_10memoryview_20copy(((struct __pyx_memoryview_obj *)__pyx_v_self)); + + /* function exit code */ + __Pyx_RefNannyFinishContext(); + return __pyx_r; +} + +static PyObject *__pyx_memoryview___pyx_pf_15View_dot_MemoryView_10memoryview_20copy(struct __pyx_memoryview_obj *__pyx_v_self) { + __Pyx_memviewslice __pyx_v_mslice; + int __pyx_v_flags; + PyObject *__pyx_r = NULL; + __Pyx_RefNannyDeclarations + __Pyx_memviewslice __pyx_t_1; + PyObject *__pyx_t_2 = NULL; + int __pyx_lineno = 0; + const char *__pyx_filename = NULL; + int __pyx_clineno = 0; + __Pyx_RefNannySetupContext("copy", 0); + + /* "View.MemoryView":639 + * def copy(self): + * cdef __Pyx_memviewslice mslice + * cdef int flags = self.flags & ~PyBUF_F_CONTIGUOUS # <<<<<<<<<<<<<< + * + * slice_copy(self, &mslice) +*/ + __pyx_v_flags = (__pyx_v_self->flags & (~PyBUF_F_CONTIGUOUS)); + + /* "View.MemoryView":641 + * cdef int flags = self.flags & ~PyBUF_F_CONTIGUOUS + * + * slice_copy(self, &mslice) # <<<<<<<<<<<<<< + * mslice = slice_copy_contig(&mslice, "c", self.view.ndim, + * self.view.itemsize, +*/ + __pyx_memoryview_slice_copy(__pyx_v_self, (&__pyx_v_mslice)); + + /* "View.MemoryView":642 + * + * slice_copy(self, &mslice) + * mslice = slice_copy_contig(&mslice, "c", self.view.ndim, # <<<<<<<<<<<<<< + * self.view.itemsize, + * flags|PyBUF_C_CONTIGUOUS, +*/ + __pyx_t_1 = __pyx_memoryview_copy_new_contig((&__pyx_v_mslice), ((char const *)"c"), __pyx_v_self->view.ndim, __pyx_v_self->view.itemsize, (__pyx_v_flags | PyBUF_C_CONTIGUOUS), __pyx_v_self->dtype_is_object); if (unlikely(PyErr_Occurred())) __PYX_ERR(1, 642, __pyx_L1_error) + __pyx_v_mslice = __pyx_t_1; + + /* "View.MemoryView":647 + * self.dtype_is_object) + * + * return memoryview_copy_from_slice(self, &mslice) # <<<<<<<<<<<<<< + * + * def copy_fortran(self): +*/ + __Pyx_XDECREF(__pyx_r); + __pyx_t_2 = __pyx_memoryview_copy_object_from_slice(__pyx_v_self, (&__pyx_v_mslice)); if (unlikely(!__pyx_t_2)) __PYX_ERR(1, 647, __pyx_L1_error) + __Pyx_GOTREF(__pyx_t_2); + __pyx_r = __pyx_t_2; + __pyx_t_2 = 0; + goto __pyx_L0; + + /* "View.MemoryView":637 + * return slice_is_contig(mslice[0], 'F', self.view.ndim) + * + * def copy(self): # <<<<<<<<<<<<<< + * cdef __Pyx_memviewslice mslice + * cdef int flags = self.flags & ~PyBUF_F_CONTIGUOUS +*/ + + /* function exit code */ + __pyx_L1_error:; + __Pyx_XDECREF(__pyx_t_2); + __Pyx_AddTraceback("View.MemoryView.memoryview.copy", __pyx_clineno, __pyx_lineno, __pyx_filename); + __pyx_r = NULL; + __pyx_L0:; + __Pyx_XGIVEREF(__pyx_r); + __Pyx_RefNannyFinishContext(); + return __pyx_r; +} + +/* "View.MemoryView":649 + * return memoryview_copy_from_slice(self, &mslice) + * + * def copy_fortran(self): # <<<<<<<<<<<<<< + * cdef __Pyx_memviewslice src, dst + * cdef int flags = self.flags & ~PyBUF_C_CONTIGUOUS +*/ + +/* Python wrapper */ +static PyObject *__pyx_memoryview_copy_fortran(PyObject *__pyx_v_self, +#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*/ +static PyObject *__pyx_memoryview_copy_fortran(PyObject *__pyx_v_self, +#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("copy_fortran (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("copy_fortran", 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("copy_fortran", __pyx_kwds); return NULL;} + __pyx_r = __pyx_memoryview___pyx_pf_15View_dot_MemoryView_10memoryview_22copy_fortran(((struct __pyx_memoryview_obj *)__pyx_v_self)); + + /* function exit code */ + __Pyx_RefNannyFinishContext(); + return __pyx_r; +} + +static PyObject *__pyx_memoryview___pyx_pf_15View_dot_MemoryView_10memoryview_22copy_fortran(struct __pyx_memoryview_obj *__pyx_v_self) { + __Pyx_memviewslice __pyx_v_src; + __Pyx_memviewslice __pyx_v_dst; + int __pyx_v_flags; + PyObject *__pyx_r = NULL; + __Pyx_RefNannyDeclarations + __Pyx_memviewslice __pyx_t_1; + PyObject *__pyx_t_2 = NULL; + int __pyx_lineno = 0; + const char *__pyx_filename = NULL; + int __pyx_clineno = 0; + __Pyx_RefNannySetupContext("copy_fortran", 0); + + /* "View.MemoryView":651 + * def copy_fortran(self): + * cdef __Pyx_memviewslice src, dst + * cdef int flags = self.flags & ~PyBUF_C_CONTIGUOUS # <<<<<<<<<<<<<< + * + * slice_copy(self, &src) +*/ + __pyx_v_flags = (__pyx_v_self->flags & (~PyBUF_C_CONTIGUOUS)); + + /* "View.MemoryView":653 + * cdef int flags = self.flags & ~PyBUF_C_CONTIGUOUS + * + * slice_copy(self, &src) # <<<<<<<<<<<<<< + * dst = slice_copy_contig(&src, "fortran", self.view.ndim, + * self.view.itemsize, +*/ + __pyx_memoryview_slice_copy(__pyx_v_self, (&__pyx_v_src)); + + /* "View.MemoryView":654 + * + * slice_copy(self, &src) + * dst = slice_copy_contig(&src, "fortran", self.view.ndim, # <<<<<<<<<<<<<< + * self.view.itemsize, + * flags|PyBUF_F_CONTIGUOUS, +*/ + __pyx_t_1 = __pyx_memoryview_copy_new_contig((&__pyx_v_src), ((char const *)"fortran"), __pyx_v_self->view.ndim, __pyx_v_self->view.itemsize, (__pyx_v_flags | PyBUF_F_CONTIGUOUS), __pyx_v_self->dtype_is_object); if (unlikely(PyErr_Occurred())) __PYX_ERR(1, 654, __pyx_L1_error) + __pyx_v_dst = __pyx_t_1; + + /* "View.MemoryView":659 + * self.dtype_is_object) + * + * return memoryview_copy_from_slice(self, &dst) # <<<<<<<<<<<<<< + * + * +*/ + __Pyx_XDECREF(__pyx_r); + __pyx_t_2 = __pyx_memoryview_copy_object_from_slice(__pyx_v_self, (&__pyx_v_dst)); if (unlikely(!__pyx_t_2)) __PYX_ERR(1, 659, __pyx_L1_error) + __Pyx_GOTREF(__pyx_t_2); + __pyx_r = __pyx_t_2; + __pyx_t_2 = 0; + goto __pyx_L0; + + /* "View.MemoryView":649 + * return memoryview_copy_from_slice(self, &mslice) + * + * def copy_fortran(self): # <<<<<<<<<<<<<< + * cdef __Pyx_memviewslice src, dst + * cdef int flags = self.flags & ~PyBUF_C_CONTIGUOUS +*/ + + /* function exit code */ + __pyx_L1_error:; + __Pyx_XDECREF(__pyx_t_2); + __Pyx_AddTraceback("View.MemoryView.memoryview.copy_fortran", __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___pyx_memoryview_1__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*/ +static PyObject *__pyx_pw___pyx_memoryview_1__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___pyx_memoryview___reduce_cython__(((struct __pyx_memoryview_obj *)__pyx_v_self)); + + /* function exit code */ + __Pyx_RefNannyFinishContext(); + return __pyx_r; +} + +static PyObject *__pyx_pf___pyx_memoryview___reduce_cython__(CYTHON_UNUSED struct __pyx_memoryview_obj *__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("View.MemoryView.memoryview.__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___pyx_memoryview_3__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*/ +static PyObject *__pyx_pw___pyx_memoryview_3__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("View.MemoryView.memoryview.__setstate_cython__", __pyx_clineno, __pyx_lineno, __pyx_filename); + __Pyx_RefNannyFinishContext(); + return NULL; + __pyx_L4_argument_unpacking_done:; + __pyx_r = __pyx_pf___pyx_memoryview_2__setstate_cython__(((struct __pyx_memoryview_obj *)__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___pyx_memoryview_2__setstate_cython__(CYTHON_UNUSED struct __pyx_memoryview_obj *__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("View.MemoryView.memoryview.__setstate_cython__", __pyx_clineno, __pyx_lineno, __pyx_filename); + __pyx_r = NULL; + __Pyx_XGIVEREF(__pyx_r); + __Pyx_RefNannyFinishContext(); + return __pyx_r; +} + +/* "View.MemoryView":662 + * + * + * @cname('__pyx_memoryview_new') # <<<<<<<<<<<<<< + * cdef memoryview_cwrapper(object o, int flags, bint dtype_is_object, const __Pyx_TypeInfo *typeinfo): + * cdef memoryview result = memoryview(o, flags, dtype_is_object) +*/ + +static PyObject *__pyx_memoryview_new(PyObject *__pyx_v_o, int __pyx_v_flags, int __pyx_v_dtype_is_object, __Pyx_TypeInfo const *__pyx_v_typeinfo) { + struct __pyx_memoryview_obj *__pyx_v_result = 0; + PyObject *__pyx_r = NULL; + __Pyx_RefNannyDeclarations + PyObject *__pyx_t_1 = NULL; + PyObject *__pyx_t_2 = NULL; + PyObject *__pyx_t_3 = NULL; + PyObject *__pyx_t_4 = NULL; + size_t __pyx_t_5; + int __pyx_lineno = 0; + const char *__pyx_filename = NULL; + int __pyx_clineno = 0; + __Pyx_RefNannySetupContext("memoryview_cwrapper", 0); + + /* "View.MemoryView":664 + * @cname('__pyx_memoryview_new') + * cdef memoryview_cwrapper(object o, int flags, bint dtype_is_object, const __Pyx_TypeInfo *typeinfo): + * cdef memoryview result = memoryview(o, flags, dtype_is_object) # <<<<<<<<<<<<<< + * result.typeinfo = typeinfo + * return result +*/ + __pyx_t_2 = NULL; + __pyx_t_3 = __Pyx_PyLong_From_int(__pyx_v_flags); if (unlikely(!__pyx_t_3)) __PYX_ERR(1, 664, __pyx_L1_error) + __Pyx_GOTREF(__pyx_t_3); + __pyx_t_4 = __Pyx_PyBool_FromLong(__pyx_v_dtype_is_object); if (unlikely(!__pyx_t_4)) __PYX_ERR(1, 664, __pyx_L1_error) + __Pyx_GOTREF(__pyx_t_4); + __pyx_t_5 = 1; + { + PyObject *__pyx_callargs[4] = {__pyx_t_2, __pyx_v_o, __pyx_t_3, __pyx_t_4}; + __pyx_t_1 = __Pyx_PyObject_FastCall((PyObject*)__pyx_mstate_global->__pyx_memoryview_type, __pyx_callargs+__pyx_t_5, (4-__pyx_t_5) | (__pyx_t_5*__Pyx_PY_VECTORCALL_ARGUMENTS_OFFSET)); + __Pyx_XDECREF(__pyx_t_2); __pyx_t_2 = 0; + __Pyx_DECREF(__pyx_t_3); __pyx_t_3 = 0; + __Pyx_DECREF(__pyx_t_4); __pyx_t_4 = 0; + if (unlikely(!__pyx_t_1)) __PYX_ERR(1, 664, __pyx_L1_error) + __Pyx_GOTREF((PyObject *)__pyx_t_1); + } + __pyx_v_result = ((struct __pyx_memoryview_obj *)__pyx_t_1); + __pyx_t_1 = 0; + + /* "View.MemoryView":665 + * cdef memoryview_cwrapper(object o, int flags, bint dtype_is_object, const __Pyx_TypeInfo *typeinfo): + * cdef memoryview result = memoryview(o, flags, dtype_is_object) + * result.typeinfo = typeinfo # <<<<<<<<<<<<<< + * return result + * +*/ + __pyx_v_result->typeinfo = __pyx_v_typeinfo; + + /* "View.MemoryView":666 + * cdef memoryview result = memoryview(o, flags, dtype_is_object) + * result.typeinfo = typeinfo + * return result # <<<<<<<<<<<<<< + * + * @cname('__pyx_memoryview_check') +*/ + __Pyx_XDECREF(__pyx_r); + __Pyx_INCREF((PyObject *)__pyx_v_result); + __pyx_r = ((PyObject *)__pyx_v_result); + goto __pyx_L0; + + /* "View.MemoryView":662 + * + * + * @cname('__pyx_memoryview_new') # <<<<<<<<<<<<<< + * cdef memoryview_cwrapper(object o, int flags, bint dtype_is_object, const __Pyx_TypeInfo *typeinfo): + * cdef memoryview result = memoryview(o, flags, dtype_is_object) +*/ + + /* function exit code */ + __pyx_L1_error:; + __Pyx_XDECREF(__pyx_t_1); + __Pyx_XDECREF(__pyx_t_2); + __Pyx_XDECREF(__pyx_t_3); + __Pyx_XDECREF(__pyx_t_4); + __Pyx_AddTraceback("View.MemoryView.memoryview_cwrapper", __pyx_clineno, __pyx_lineno, __pyx_filename); + __pyx_r = 0; + __pyx_L0:; + __Pyx_XDECREF((PyObject *)__pyx_v_result); + __Pyx_XGIVEREF(__pyx_r); + __Pyx_RefNannyFinishContext(); + return __pyx_r; +} + +/* "View.MemoryView":668 + * return result + * + * @cname('__pyx_memoryview_check') # <<<<<<<<<<<<<< + * cdef inline bint memoryview_check(object o) noexcept: + * return isinstance(o, memoryview) +*/ + +static CYTHON_INLINE int __pyx_memoryview_check(PyObject *__pyx_v_o) { + int __pyx_r; + int __pyx_t_1; + + /* "View.MemoryView":670 + * @cname('__pyx_memoryview_check') + * cdef inline bint memoryview_check(object o) noexcept: + * return isinstance(o, memoryview) # <<<<<<<<<<<<<< + * + * cdef tuple _unellipsify(object index, int ndim): +*/ + __pyx_t_1 = __Pyx_TypeCheck(__pyx_v_o, __pyx_mstate_global->__pyx_memoryview_type); + __pyx_r = __pyx_t_1; + goto __pyx_L0; + + /* "View.MemoryView":668 + * return result + * + * @cname('__pyx_memoryview_check') # <<<<<<<<<<<<<< + * cdef inline bint memoryview_check(object o) noexcept: + * return isinstance(o, memoryview) +*/ + + /* function exit code */ + __pyx_L0:; + return __pyx_r; +} + +/* "View.MemoryView":672 + * return isinstance(o, memoryview) + * + * cdef tuple _unellipsify(object index, int ndim): # <<<<<<<<<<<<<< + * """ + * Replace all ellipses with full slices and fill incomplete indices with +*/ + +static PyObject *_unellipsify(PyObject *__pyx_v_index, int __pyx_v_ndim) { + Py_ssize_t __pyx_v_idx; + PyObject *__pyx_v_tup = NULL; + PyObject *__pyx_v_result = NULL; + int __pyx_v_have_slices; + int __pyx_v_seen_ellipsis; + PyObject *__pyx_v_item = NULL; + Py_ssize_t __pyx_v_nslices; + PyObject *__pyx_r = NULL; + __Pyx_RefNannyDeclarations + PyObject *__pyx_t_1 = NULL; + int __pyx_t_2; + PyObject *__pyx_t_3 = NULL; + Py_ssize_t __pyx_t_4; + Py_ssize_t __pyx_t_5; + PyObject *__pyx_t_6[3]; + PyObject *__pyx_t_7 = NULL; + int __pyx_lineno = 0; + const char *__pyx_filename = NULL; + int __pyx_clineno = 0; + __Pyx_RefNannySetupContext("_unellipsify", 0); + + /* "View.MemoryView":678 + * """ + * cdef Py_ssize_t idx + * tup = index if isinstance(index, tuple) else (index,) # <<<<<<<<<<<<<< + * + * result = [slice(None)] * ndim +*/ + __pyx_t_2 = PyTuple_Check(__pyx_v_index); + if (__pyx_t_2) { + __Pyx_INCREF(((PyObject*)__pyx_v_index)); + __pyx_t_1 = __pyx_v_index; + } else { + __pyx_t_3 = PyTuple_New(1); if (unlikely(!__pyx_t_3)) __PYX_ERR(1, 678, __pyx_L1_error) + __Pyx_GOTREF(__pyx_t_3); + __Pyx_INCREF(__pyx_v_index); + __Pyx_GIVEREF(__pyx_v_index); + if (__Pyx_PyTuple_SET_ITEM(__pyx_t_3, 0, __pyx_v_index) != (0)) __PYX_ERR(1, 678, __pyx_L1_error); + __pyx_t_1 = __pyx_t_3; + __pyx_t_3 = 0; + } + __pyx_v_tup = ((PyObject*)__pyx_t_1); + __pyx_t_1 = 0; + + /* "View.MemoryView":680 + * tup = index if isinstance(index, tuple) else (index,) + * + * result = [slice(None)] * ndim # <<<<<<<<<<<<<< + * have_slices = False + * seen_ellipsis = False +*/ + __pyx_t_1 = PyList_New(1 * ((__pyx_v_ndim<0) ? 0:__pyx_v_ndim)); if (unlikely(!__pyx_t_1)) __PYX_ERR(1, 680, __pyx_L1_error) + __Pyx_GOTREF(__pyx_t_1); + { Py_ssize_t __pyx_temp; + for (__pyx_temp=0; __pyx_temp < __pyx_v_ndim; __pyx_temp++) { + __Pyx_INCREF(__pyx_mstate_global->__pyx_slice[0]); + __Pyx_GIVEREF(__pyx_mstate_global->__pyx_slice[0]); + if (__Pyx_PyList_SET_ITEM(__pyx_t_1, __pyx_temp, __pyx_mstate_global->__pyx_slice[0]) != (0)) __PYX_ERR(1, 680, __pyx_L1_error); + } + } + __pyx_v_result = ((PyObject*)__pyx_t_1); + __pyx_t_1 = 0; + + /* "View.MemoryView":681 + * + * result = [slice(None)] * ndim + * have_slices = False # <<<<<<<<<<<<<< + * seen_ellipsis = False + * idx = 0 +*/ + __pyx_v_have_slices = 0; + + /* "View.MemoryView":682 + * result = [slice(None)] * ndim + * have_slices = False + * seen_ellipsis = False # <<<<<<<<<<<<<< + * idx = 0 + * for item in tup: +*/ + __pyx_v_seen_ellipsis = 0; + + /* "View.MemoryView":683 + * have_slices = False + * seen_ellipsis = False + * idx = 0 # <<<<<<<<<<<<<< + * for item in tup: + * if item is Ellipsis: +*/ + __pyx_v_idx = 0; + + /* "View.MemoryView":684 + * seen_ellipsis = False + * idx = 0 + * for item in tup: # <<<<<<<<<<<<<< + * if item is Ellipsis: + * if not seen_ellipsis: +*/ + if (unlikely(__pyx_v_tup == Py_None)) { + PyErr_SetString(PyExc_TypeError, "'NoneType' object is not iterable"); + __PYX_ERR(1, 684, __pyx_L1_error) + } + __pyx_t_1 = __pyx_v_tup; __Pyx_INCREF(__pyx_t_1); + __pyx_t_4 = 0; + for (;;) { + { + Py_ssize_t __pyx_temp = __Pyx_PyTuple_GET_SIZE(__pyx_t_1); + #if !CYTHON_ASSUME_SAFE_SIZE + if (unlikely((__pyx_temp < 0))) __PYX_ERR(1, 684, __pyx_L1_error) + #endif + if (__pyx_t_4 >= __pyx_temp) break; + } + #if CYTHON_ASSUME_SAFE_MACROS && !CYTHON_AVOID_BORROWED_REFS + __pyx_t_3 = __Pyx_NewRef(PyTuple_GET_ITEM(__pyx_t_1, __pyx_t_4)); + #else + __pyx_t_3 = __Pyx_PySequence_ITEM(__pyx_t_1, __pyx_t_4); + #endif + ++__pyx_t_4; + if (unlikely(!__pyx_t_3)) __PYX_ERR(1, 684, __pyx_L1_error) + __Pyx_GOTREF(__pyx_t_3); + __Pyx_XDECREF_SET(__pyx_v_item, __pyx_t_3); + __pyx_t_3 = 0; + + /* "View.MemoryView":685 + * idx = 0 + * for item in tup: + * if item is Ellipsis: # <<<<<<<<<<<<<< + * if not seen_ellipsis: + * idx += ndim - len(tup) +*/ + __pyx_t_2 = (__pyx_v_item == __pyx_builtin_Ellipsis); + if (__pyx_t_2) { + + /* "View.MemoryView":686 + * for item in tup: + * if item is Ellipsis: + * if not seen_ellipsis: # <<<<<<<<<<<<<< + * idx += ndim - len(tup) + * seen_ellipsis = True +*/ + __pyx_t_2 = (!__pyx_v_seen_ellipsis); + if (__pyx_t_2) { + + /* "View.MemoryView":687 + * if item is Ellipsis: + * if not seen_ellipsis: + * idx += ndim - len(tup) # <<<<<<<<<<<<<< + * seen_ellipsis = True + * have_slices = True +*/ + if (unlikely(__pyx_v_tup == Py_None)) { + PyErr_SetString(PyExc_TypeError, "object of type 'NoneType' has no len()"); + __PYX_ERR(1, 687, __pyx_L1_error) + } + __pyx_t_5 = __Pyx_PyTuple_GET_SIZE(__pyx_v_tup); if (unlikely(__pyx_t_5 == ((Py_ssize_t)-1))) __PYX_ERR(1, 687, __pyx_L1_error) + __pyx_v_idx = (__pyx_v_idx + (__pyx_v_ndim - __pyx_t_5)); + + /* "View.MemoryView":688 + * if not seen_ellipsis: + * idx += ndim - len(tup) + * seen_ellipsis = True # <<<<<<<<<<<<<< + * have_slices = True + * else: +*/ + __pyx_v_seen_ellipsis = 1; + + /* "View.MemoryView":686 + * for item in tup: + * if item is Ellipsis: + * if not seen_ellipsis: # <<<<<<<<<<<<<< + * idx += ndim - len(tup) + * seen_ellipsis = True +*/ + } + + /* "View.MemoryView":689 + * idx += ndim - len(tup) + * seen_ellipsis = True + * have_slices = True # <<<<<<<<<<<<<< + * else: + * if isinstance(item, slice): +*/ + __pyx_v_have_slices = 1; + + /* "View.MemoryView":685 + * idx = 0 + * for item in tup: + * if item is Ellipsis: # <<<<<<<<<<<<<< + * if not seen_ellipsis: + * idx += ndim - len(tup) +*/ + goto __pyx_L5; + } + + /* "View.MemoryView":691 + * have_slices = True + * else: + * if isinstance(item, slice): # <<<<<<<<<<<<<< + * have_slices = True + * elif not PyIndex_Check(item): +*/ + /*else*/ { + __pyx_t_2 = PySlice_Check(__pyx_v_item); + if (__pyx_t_2) { + + /* "View.MemoryView":692 + * else: + * if isinstance(item, slice): + * have_slices = True # <<<<<<<<<<<<<< + * elif not PyIndex_Check(item): + * raise TypeError, f"Cannot index with type '{type(item)}'" +*/ + __pyx_v_have_slices = 1; + + /* "View.MemoryView":691 + * have_slices = True + * else: + * if isinstance(item, slice): # <<<<<<<<<<<<<< + * have_slices = True + * elif not PyIndex_Check(item): +*/ + goto __pyx_L7; + } + + /* "View.MemoryView":693 + * if isinstance(item, slice): + * have_slices = True + * elif not PyIndex_Check(item): # <<<<<<<<<<<<<< + * raise TypeError, f"Cannot index with type '{type(item)}'" + * result[idx] = item +*/ + __pyx_t_2 = (!(PyIndex_Check(__pyx_v_item) != 0)); + if (unlikely(__pyx_t_2)) { + + /* "View.MemoryView":694 + * have_slices = True + * elif not PyIndex_Check(item): + * raise TypeError, f"Cannot index with type '{type(item)}'" # <<<<<<<<<<<<<< + * result[idx] = item + * idx += 1 +*/ + __pyx_t_3 = __Pyx_PyObject_FormatSimple(((PyObject *)Py_TYPE(__pyx_v_item)), __pyx_mstate_global->__pyx_empty_unicode); if (unlikely(!__pyx_t_3)) __PYX_ERR(1, 694, __pyx_L1_error) + __Pyx_GOTREF(__pyx_t_3); + __pyx_t_6[0] = __pyx_mstate_global->__pyx_kp_u_Cannot_index_with_type; + __pyx_t_6[1] = __pyx_t_3; + __pyx_t_6[2] = __pyx_mstate_global->__pyx_kp_u__4; + __pyx_t_7 = __Pyx_PyUnicode_Join(__pyx_t_6, 3, 24 + __Pyx_PyUnicode_GET_LENGTH(__pyx_t_3) + 1, 127 | __Pyx_PyUnicode_MAX_CHAR_VALUE(__pyx_t_3)); + if (unlikely(!__pyx_t_7)) __PYX_ERR(1, 694, __pyx_L1_error) + __Pyx_GOTREF(__pyx_t_7); + __Pyx_DECREF(__pyx_t_3); __pyx_t_3 = 0; + __Pyx_Raise(((PyObject *)(((PyTypeObject*)PyExc_TypeError))), __pyx_t_7, 0, 0); + __Pyx_DECREF(__pyx_t_7); __pyx_t_7 = 0; + __PYX_ERR(1, 694, __pyx_L1_error) + + /* "View.MemoryView":693 + * if isinstance(item, slice): + * have_slices = True + * elif not PyIndex_Check(item): # <<<<<<<<<<<<<< + * raise TypeError, f"Cannot index with type '{type(item)}'" + * result[idx] = item +*/ + } + __pyx_L7:; + + /* "View.MemoryView":695 + * elif not PyIndex_Check(item): + * raise TypeError, f"Cannot index with type '{type(item)}'" + * result[idx] = item # <<<<<<<<<<<<<< + * idx += 1 + * +*/ + if (unlikely((__Pyx_SetItemInt(__pyx_v_result, __pyx_v_idx, __pyx_v_item, Py_ssize_t, 1, PyLong_FromSsize_t, 1, 1, 1, 1, __Pyx_ReferenceSharing_OwnStrongReference) < 0))) __PYX_ERR(1, 695, __pyx_L1_error) + } + __pyx_L5:; + + /* "View.MemoryView":696 + * raise TypeError, f"Cannot index with type '{type(item)}'" + * result[idx] = item + * idx += 1 # <<<<<<<<<<<<<< + * + * nslices = ndim - idx +*/ + __pyx_v_idx = (__pyx_v_idx + 1); + + /* "View.MemoryView":684 + * seen_ellipsis = False + * idx = 0 + * for item in tup: # <<<<<<<<<<<<<< + * if item is Ellipsis: + * if not seen_ellipsis: +*/ + } + __Pyx_DECREF(__pyx_t_1); __pyx_t_1 = 0; + + /* "View.MemoryView":698 + * idx += 1 + * + * nslices = ndim - idx # <<<<<<<<<<<<<< + * return have_slices or nslices, tuple(result) + * +*/ + __pyx_v_nslices = (__pyx_v_ndim - __pyx_v_idx); + + /* "View.MemoryView":699 + * + * nslices = ndim - idx + * return have_slices or nslices, tuple(result) # <<<<<<<<<<<<<< + * + * cdef int assert_direct_dimensions(Py_ssize_t *suboffsets, int ndim) except -1: +*/ + __Pyx_XDECREF(__pyx_r); + if (!__pyx_v_have_slices) { + } else { + __pyx_t_7 = __Pyx_PyBool_FromLong(__pyx_v_have_slices); if (unlikely(!__pyx_t_7)) __PYX_ERR(1, 699, __pyx_L1_error) + __Pyx_GOTREF(__pyx_t_7); + __pyx_t_1 = __pyx_t_7; + __pyx_t_7 = 0; + goto __pyx_L9_bool_binop_done; + } + __pyx_t_7 = PyLong_FromSsize_t(__pyx_v_nslices); if (unlikely(!__pyx_t_7)) __PYX_ERR(1, 699, __pyx_L1_error) + __Pyx_GOTREF(__pyx_t_7); + __pyx_t_1 = __pyx_t_7; + __pyx_t_7 = 0; + __pyx_L9_bool_binop_done:; + __pyx_t_7 = PyList_AsTuple(__pyx_v_result); if (unlikely(!__pyx_t_7)) __PYX_ERR(1, 699, __pyx_L1_error) + __Pyx_GOTREF(__pyx_t_7); + __pyx_t_3 = PyTuple_New(2); if (unlikely(!__pyx_t_3)) __PYX_ERR(1, 699, __pyx_L1_error) + __Pyx_GOTREF(__pyx_t_3); + __Pyx_GIVEREF(__pyx_t_1); + if (__Pyx_PyTuple_SET_ITEM(__pyx_t_3, 0, __pyx_t_1) != (0)) __PYX_ERR(1, 699, __pyx_L1_error); + __Pyx_GIVEREF(__pyx_t_7); + if (__Pyx_PyTuple_SET_ITEM(__pyx_t_3, 1, __pyx_t_7) != (0)) __PYX_ERR(1, 699, __pyx_L1_error); + __pyx_t_1 = 0; + __pyx_t_7 = 0; + __pyx_r = ((PyObject*)__pyx_t_3); + __pyx_t_3 = 0; + goto __pyx_L0; + + /* "View.MemoryView":672 + * return isinstance(o, memoryview) + * + * cdef tuple _unellipsify(object index, int ndim): # <<<<<<<<<<<<<< + * """ + * Replace all ellipses with full slices and fill incomplete indices with +*/ + + /* function exit code */ + __pyx_L1_error:; + __Pyx_XDECREF(__pyx_t_1); + __Pyx_XDECREF(__pyx_t_3); + __Pyx_XDECREF(__pyx_t_7); + __Pyx_AddTraceback("View.MemoryView._unellipsify", __pyx_clineno, __pyx_lineno, __pyx_filename); + __pyx_r = 0; + __pyx_L0:; + __Pyx_XDECREF(__pyx_v_tup); + __Pyx_XDECREF(__pyx_v_result); + __Pyx_XDECREF(__pyx_v_item); + __Pyx_XGIVEREF(__pyx_r); + __Pyx_RefNannyFinishContext(); + return __pyx_r; +} + +/* "View.MemoryView":701 + * return have_slices or nslices, tuple(result) + * + * cdef int assert_direct_dimensions(Py_ssize_t *suboffsets, int ndim) except -1: # <<<<<<<<<<<<<< + * for suboffset in suboffsets[:ndim]: + * if suboffset >= 0: +*/ + +static int assert_direct_dimensions(Py_ssize_t *__pyx_v_suboffsets, int __pyx_v_ndim) { + Py_ssize_t __pyx_v_suboffset; + int __pyx_r; + Py_ssize_t *__pyx_t_1; + Py_ssize_t *__pyx_t_2; + Py_ssize_t *__pyx_t_3; + int __pyx_t_4; + int __pyx_lineno = 0; + const char *__pyx_filename = NULL; + int __pyx_clineno = 0; + + /* "View.MemoryView":702 + * + * cdef int assert_direct_dimensions(Py_ssize_t *suboffsets, int ndim) except -1: + * for suboffset in suboffsets[:ndim]: # <<<<<<<<<<<<<< + * if suboffset >= 0: + * raise ValueError, "Indirect dimensions not supported" +*/ + __pyx_t_2 = (__pyx_v_suboffsets + __pyx_v_ndim); + for (__pyx_t_3 = __pyx_v_suboffsets; __pyx_t_3 < __pyx_t_2; __pyx_t_3++) { + __pyx_t_1 = __pyx_t_3; + __pyx_v_suboffset = (__pyx_t_1[0]); + + /* "View.MemoryView":703 + * cdef int assert_direct_dimensions(Py_ssize_t *suboffsets, int ndim) except -1: + * for suboffset in suboffsets[:ndim]: + * if suboffset >= 0: # <<<<<<<<<<<<<< + * raise ValueError, "Indirect dimensions not supported" + * return 0 # return type just used as an error flag +*/ + __pyx_t_4 = (__pyx_v_suboffset >= 0); + if (unlikely(__pyx_t_4)) { + + /* "View.MemoryView":704 + * for suboffset in suboffsets[:ndim]: + * if suboffset >= 0: + * raise ValueError, "Indirect dimensions not supported" # <<<<<<<<<<<<<< + * return 0 # return type just used as an error flag + * +*/ + __Pyx_Raise(((PyObject *)(((PyTypeObject*)PyExc_ValueError))), __pyx_mstate_global->__pyx_kp_u_Indirect_dimensions_not_supporte, 0, 0); + __PYX_ERR(1, 704, __pyx_L1_error) + + /* "View.MemoryView":703 + * cdef int assert_direct_dimensions(Py_ssize_t *suboffsets, int ndim) except -1: + * for suboffset in suboffsets[:ndim]: + * if suboffset >= 0: # <<<<<<<<<<<<<< + * raise ValueError, "Indirect dimensions not supported" + * return 0 # return type just used as an error flag +*/ + } + } + + /* "View.MemoryView":705 + * if suboffset >= 0: + * raise ValueError, "Indirect dimensions not supported" + * return 0 # return type just used as an error flag # <<<<<<<<<<<<<< + * + * +*/ + __pyx_r = 0; + goto __pyx_L0; + + /* "View.MemoryView":701 + * return have_slices or nslices, tuple(result) + * + * cdef int assert_direct_dimensions(Py_ssize_t *suboffsets, int ndim) except -1: # <<<<<<<<<<<<<< + * for suboffset in suboffsets[:ndim]: + * if suboffset >= 0: +*/ + + /* function exit code */ + __pyx_L1_error:; + __Pyx_AddTraceback("View.MemoryView.assert_direct_dimensions", __pyx_clineno, __pyx_lineno, __pyx_filename); + __pyx_r = -1; + __pyx_L0:; + return __pyx_r; +} + +/* "View.MemoryView":711 + * + * + * @cname('__pyx_memview_slice') # <<<<<<<<<<<<<< + * cdef memoryview memview_slice(memoryview memview, object indices): + * cdef int new_ndim = 0, suboffset_dim = -1, dim +*/ + +static struct __pyx_memoryview_obj *__pyx_memview_slice(struct __pyx_memoryview_obj *__pyx_v_memview, PyObject *__pyx_v_indices) { + int __pyx_v_new_ndim; + int __pyx_v_suboffset_dim; + int __pyx_v_dim; + __Pyx_memviewslice __pyx_v_src; + __Pyx_memviewslice __pyx_v_dst; + __Pyx_memviewslice *__pyx_v_p_src; + struct __pyx_memoryviewslice_obj *__pyx_v_memviewsliceobj = 0; + __Pyx_memviewslice *__pyx_v_p_dst; + int *__pyx_v_p_suboffset_dim; + Py_ssize_t __pyx_v_start; + Py_ssize_t __pyx_v_stop; + Py_ssize_t __pyx_v_step; + Py_ssize_t __pyx_v_cindex; + int __pyx_v_have_start; + int __pyx_v_have_stop; + int __pyx_v_have_step; + PyObject *__pyx_v_index = NULL; + struct __pyx_memoryview_obj *__pyx_r = NULL; + __Pyx_RefNannyDeclarations + int __pyx_t_1; + PyObject *__pyx_t_2 = NULL; + struct __pyx_memoryview_obj *__pyx_t_3; + char *__pyx_t_4; + int __pyx_t_5; + Py_ssize_t __pyx_t_6; + PyObject *(*__pyx_t_7)(PyObject *); + PyObject *__pyx_t_8 = NULL; + Py_ssize_t __pyx_t_9; + int __pyx_t_10; + Py_ssize_t __pyx_t_11; + int __pyx_lineno = 0; + const char *__pyx_filename = NULL; + int __pyx_clineno = 0; + __Pyx_RefNannySetupContext("memview_slice", 0); + + /* "View.MemoryView":713 + * @cname('__pyx_memview_slice') + * cdef memoryview memview_slice(memoryview memview, object indices): + * cdef int new_ndim = 0, suboffset_dim = -1, dim # <<<<<<<<<<<<<< + * cdef bint negative_step + * cdef __Pyx_memviewslice src, dst +*/ + __pyx_v_new_ndim = 0; + __pyx_v_suboffset_dim = -1; + + /* "View.MemoryView":720 + * + * + * memset(&dst, 0, sizeof(dst)) # <<<<<<<<<<<<<< + * + * cdef _memoryviewslice memviewsliceobj +*/ + (void)(memset((&__pyx_v_dst), 0, (sizeof(__pyx_v_dst)))); + + /* "View.MemoryView":724 + * cdef _memoryviewslice memviewsliceobj + * + * assert memview.view.ndim > 0 # <<<<<<<<<<<<<< + * + * if isinstance(memview, _memoryviewslice): +*/ + #ifndef CYTHON_WITHOUT_ASSERTIONS + if (unlikely(__pyx_assertions_enabled())) { + __pyx_t_1 = (__pyx_v_memview->view.ndim > 0); + if (unlikely(!__pyx_t_1)) { + __Pyx_Raise(((PyObject *)(((PyTypeObject*)PyExc_AssertionError))), 0, 0, 0); + __PYX_ERR(1, 724, __pyx_L1_error) + } + } + #else + if ((1)); else __PYX_ERR(1, 724, __pyx_L1_error) + #endif + + /* "View.MemoryView":726 + * assert memview.view.ndim > 0 + * + * if isinstance(memview, _memoryviewslice): # <<<<<<<<<<<<<< + * memviewsliceobj = memview + * p_src = &memviewsliceobj.from_slice +*/ + __pyx_t_1 = __Pyx_TypeCheck(((PyObject *)__pyx_v_memview), __pyx_mstate_global->__pyx_memoryviewslice_type); + if (__pyx_t_1) { + + /* "View.MemoryView":727 + * + * if isinstance(memview, _memoryviewslice): + * memviewsliceobj = memview # <<<<<<<<<<<<<< + * p_src = &memviewsliceobj.from_slice + * else: +*/ + __pyx_t_2 = ((PyObject *)__pyx_v_memview); + __Pyx_INCREF(__pyx_t_2); + if (!(likely(((__pyx_t_2) == Py_None) || likely(__Pyx_TypeTest(__pyx_t_2, __pyx_mstate_global->__pyx_memoryviewslice_type))))) __PYX_ERR(1, 727, __pyx_L1_error) + __pyx_v_memviewsliceobj = ((struct __pyx_memoryviewslice_obj *)__pyx_t_2); + __pyx_t_2 = 0; + + /* "View.MemoryView":728 + * if isinstance(memview, _memoryviewslice): + * memviewsliceobj = memview + * p_src = &memviewsliceobj.from_slice # <<<<<<<<<<<<<< + * else: + * slice_copy(memview, &src) +*/ + __pyx_v_p_src = (&__pyx_v_memviewsliceobj->from_slice); + + /* "View.MemoryView":726 + * assert memview.view.ndim > 0 + * + * if isinstance(memview, _memoryviewslice): # <<<<<<<<<<<<<< + * memviewsliceobj = memview + * p_src = &memviewsliceobj.from_slice +*/ + goto __pyx_L3; + } + + /* "View.MemoryView":730 + * p_src = &memviewsliceobj.from_slice + * else: + * slice_copy(memview, &src) # <<<<<<<<<<<<<< + * p_src = &src + * +*/ + /*else*/ { + __pyx_memoryview_slice_copy(__pyx_v_memview, (&__pyx_v_src)); + + /* "View.MemoryView":731 + * else: + * slice_copy(memview, &src) + * p_src = &src # <<<<<<<<<<<<<< + * + * +*/ + __pyx_v_p_src = (&__pyx_v_src); + } + __pyx_L3:; + + /* "View.MemoryView":737 + * + * + * dst.memview = p_src.memview # <<<<<<<<<<<<<< + * dst.data = p_src.data + * +*/ + __pyx_t_3 = __pyx_v_p_src->memview; + __pyx_v_dst.memview = __pyx_t_3; + + /* "View.MemoryView":738 + * + * dst.memview = p_src.memview + * dst.data = p_src.data # <<<<<<<<<<<<<< + * + * +*/ + __pyx_t_4 = __pyx_v_p_src->data; + __pyx_v_dst.data = __pyx_t_4; + + /* "View.MemoryView":743 + * + * + * cdef __Pyx_memviewslice *p_dst = &dst # <<<<<<<<<<<<<< + * cdef int *p_suboffset_dim = &suboffset_dim + * cdef Py_ssize_t start, stop, step, cindex +*/ + __pyx_v_p_dst = (&__pyx_v_dst); + + /* "View.MemoryView":744 + * + * cdef __Pyx_memviewslice *p_dst = &dst + * cdef int *p_suboffset_dim = &suboffset_dim # <<<<<<<<<<<<<< + * cdef Py_ssize_t start, stop, step, cindex + * cdef bint have_start, have_stop, have_step +*/ + __pyx_v_p_suboffset_dim = (&__pyx_v_suboffset_dim); + + /* "View.MemoryView":748 + * cdef bint have_start, have_stop, have_step + * + * for dim, index in enumerate(indices): # <<<<<<<<<<<<<< + * if PyIndex_Check(index): + * cindex = index +*/ + __pyx_t_5 = 0; + if (likely(PyList_CheckExact(__pyx_v_indices)) || PyTuple_CheckExact(__pyx_v_indices)) { + __pyx_t_2 = __pyx_v_indices; __Pyx_INCREF(__pyx_t_2); + __pyx_t_6 = 0; + __pyx_t_7 = NULL; + } else { + __pyx_t_6 = -1; __pyx_t_2 = PyObject_GetIter(__pyx_v_indices); if (unlikely(!__pyx_t_2)) __PYX_ERR(1, 748, __pyx_L1_error) + __Pyx_GOTREF(__pyx_t_2); + __pyx_t_7 = (CYTHON_COMPILING_IN_LIMITED_API) ? PyIter_Next : __Pyx_PyObject_GetIterNextFunc(__pyx_t_2); if (unlikely(!__pyx_t_7)) __PYX_ERR(1, 748, __pyx_L1_error) + } + for (;;) { + if (likely(!__pyx_t_7)) { + if (likely(PyList_CheckExact(__pyx_t_2))) { + { + Py_ssize_t __pyx_temp = __Pyx_PyList_GET_SIZE(__pyx_t_2); + #if !CYTHON_ASSUME_SAFE_SIZE + if (unlikely((__pyx_temp < 0))) __PYX_ERR(1, 748, __pyx_L1_error) + #endif + if (__pyx_t_6 >= __pyx_temp) break; + } + __pyx_t_8 = __Pyx_PyList_GetItemRefFast(__pyx_t_2, __pyx_t_6, __Pyx_ReferenceSharing_OwnStrongReference); + ++__pyx_t_6; + } else { + { + Py_ssize_t __pyx_temp = __Pyx_PyTuple_GET_SIZE(__pyx_t_2); + #if !CYTHON_ASSUME_SAFE_SIZE + if (unlikely((__pyx_temp < 0))) __PYX_ERR(1, 748, __pyx_L1_error) + #endif + if (__pyx_t_6 >= __pyx_temp) break; + } + #if CYTHON_ASSUME_SAFE_MACROS && !CYTHON_AVOID_BORROWED_REFS + __pyx_t_8 = __Pyx_NewRef(PyTuple_GET_ITEM(__pyx_t_2, __pyx_t_6)); + #else + __pyx_t_8 = __Pyx_PySequence_ITEM(__pyx_t_2, __pyx_t_6); + #endif + ++__pyx_t_6; + } + if (unlikely(!__pyx_t_8)) __PYX_ERR(1, 748, __pyx_L1_error) + } else { + __pyx_t_8 = __pyx_t_7(__pyx_t_2); + if (unlikely(!__pyx_t_8)) { + PyObject* exc_type = PyErr_Occurred(); + if (exc_type) { + if (unlikely(!__Pyx_PyErr_GivenExceptionMatches(exc_type, PyExc_StopIteration))) __PYX_ERR(1, 748, __pyx_L1_error) + PyErr_Clear(); + } + break; + } + } + __Pyx_GOTREF(__pyx_t_8); + __Pyx_XDECREF_SET(__pyx_v_index, __pyx_t_8); + __pyx_t_8 = 0; + __pyx_v_dim = __pyx_t_5; + __pyx_t_5 = (__pyx_t_5 + 1); + + /* "View.MemoryView":749 + * + * for dim, index in enumerate(indices): + * if PyIndex_Check(index): # <<<<<<<<<<<<<< + * cindex = index + * slice_memviewslice( +*/ + __pyx_t_1 = (PyIndex_Check(__pyx_v_index) != 0); + if (__pyx_t_1) { + + /* "View.MemoryView":750 + * for dim, index in enumerate(indices): + * if PyIndex_Check(index): + * cindex = index # <<<<<<<<<<<<<< + * slice_memviewslice( + * p_dst, p_src.shape[dim], p_src.strides[dim], p_src.suboffsets[dim], +*/ + __pyx_t_9 = __Pyx_PyIndex_AsSsize_t(__pyx_v_index); if (unlikely((__pyx_t_9 == (Py_ssize_t)-1) && PyErr_Occurred())) __PYX_ERR(1, 750, __pyx_L1_error) + __pyx_v_cindex = __pyx_t_9; + + /* "View.MemoryView":751 + * if PyIndex_Check(index): + * cindex = index + * slice_memviewslice( # <<<<<<<<<<<<<< + * p_dst, p_src.shape[dim], p_src.strides[dim], p_src.suboffsets[dim], + * dim, new_ndim, p_suboffset_dim, +*/ + __pyx_t_10 = __pyx_memoryview_slice_memviewslice(__pyx_v_p_dst, (__pyx_v_p_src->shape[__pyx_v_dim]), (__pyx_v_p_src->strides[__pyx_v_dim]), (__pyx_v_p_src->suboffsets[__pyx_v_dim]), __pyx_v_dim, __pyx_v_new_ndim, __pyx_v_p_suboffset_dim, __pyx_v_cindex, 0, 0, 0, 0, 0, 0); if (unlikely(__pyx_t_10 == ((int)-1))) __PYX_ERR(1, 751, __pyx_L1_error) + + /* "View.MemoryView":749 + * + * for dim, index in enumerate(indices): + * if PyIndex_Check(index): # <<<<<<<<<<<<<< + * cindex = index + * slice_memviewslice( +*/ + goto __pyx_L6; + } + + /* "View.MemoryView":757 + * 0, 0, 0, # have_{start,stop,step} + * False) + * elif index is None: # <<<<<<<<<<<<<< + * p_dst.shape[new_ndim] = 1 + * p_dst.strides[new_ndim] = 0 +*/ + __pyx_t_1 = (__pyx_v_index == Py_None); + if (__pyx_t_1) { + + /* "View.MemoryView":758 + * False) + * elif index is None: + * p_dst.shape[new_ndim] = 1 # <<<<<<<<<<<<<< + * p_dst.strides[new_ndim] = 0 + * p_dst.suboffsets[new_ndim] = -1 +*/ + (__pyx_v_p_dst->shape[__pyx_v_new_ndim]) = 1; + + /* "View.MemoryView":759 + * elif index is None: + * p_dst.shape[new_ndim] = 1 + * p_dst.strides[new_ndim] = 0 # <<<<<<<<<<<<<< + * p_dst.suboffsets[new_ndim] = -1 + * new_ndim += 1 +*/ + (__pyx_v_p_dst->strides[__pyx_v_new_ndim]) = 0; + + /* "View.MemoryView":760 + * p_dst.shape[new_ndim] = 1 + * p_dst.strides[new_ndim] = 0 + * p_dst.suboffsets[new_ndim] = -1 # <<<<<<<<<<<<<< + * new_ndim += 1 + * else: +*/ + (__pyx_v_p_dst->suboffsets[__pyx_v_new_ndim]) = -1L; + + /* "View.MemoryView":761 + * p_dst.strides[new_ndim] = 0 + * p_dst.suboffsets[new_ndim] = -1 + * new_ndim += 1 # <<<<<<<<<<<<<< + * else: + * start = index.start or 0 +*/ + __pyx_v_new_ndim = (__pyx_v_new_ndim + 1); + + /* "View.MemoryView":757 + * 0, 0, 0, # have_{start,stop,step} + * False) + * elif index is None: # <<<<<<<<<<<<<< + * p_dst.shape[new_ndim] = 1 + * p_dst.strides[new_ndim] = 0 +*/ + goto __pyx_L6; + } + + /* "View.MemoryView":763 + * new_ndim += 1 + * else: + * start = index.start or 0 # <<<<<<<<<<<<<< + * stop = index.stop or 0 + * step = index.step or 0 +*/ + /*else*/ { + __pyx_t_8 = __Pyx_PyObject_GetAttrStr(__pyx_v_index, __pyx_mstate_global->__pyx_n_u_start); if (unlikely(!__pyx_t_8)) __PYX_ERR(1, 763, __pyx_L1_error) + __Pyx_GOTREF(__pyx_t_8); + __pyx_t_1 = __Pyx_PyObject_IsTrue(__pyx_t_8); if (unlikely((__pyx_t_1 < 0))) __PYX_ERR(1, 763, __pyx_L1_error) + if (!__pyx_t_1) { + __Pyx_DECREF(__pyx_t_8); __pyx_t_8 = 0; + } else { + __pyx_t_11 = __Pyx_PyIndex_AsSsize_t(__pyx_t_8); if (unlikely((__pyx_t_11 == (Py_ssize_t)-1) && PyErr_Occurred())) __PYX_ERR(1, 763, __pyx_L1_error) + __pyx_t_9 = __pyx_t_11; + __Pyx_DECREF(__pyx_t_8); __pyx_t_8 = 0; + goto __pyx_L7_bool_binop_done; + } + __pyx_t_9 = 0; + __pyx_L7_bool_binop_done:; + __pyx_v_start = __pyx_t_9; + + /* "View.MemoryView":764 + * else: + * start = index.start or 0 + * stop = index.stop or 0 # <<<<<<<<<<<<<< + * step = index.step or 0 + * +*/ + __pyx_t_8 = __Pyx_PyObject_GetAttrStr(__pyx_v_index, __pyx_mstate_global->__pyx_n_u_stop); if (unlikely(!__pyx_t_8)) __PYX_ERR(1, 764, __pyx_L1_error) + __Pyx_GOTREF(__pyx_t_8); + __pyx_t_1 = __Pyx_PyObject_IsTrue(__pyx_t_8); if (unlikely((__pyx_t_1 < 0))) __PYX_ERR(1, 764, __pyx_L1_error) + if (!__pyx_t_1) { + __Pyx_DECREF(__pyx_t_8); __pyx_t_8 = 0; + } else { + __pyx_t_11 = __Pyx_PyIndex_AsSsize_t(__pyx_t_8); if (unlikely((__pyx_t_11 == (Py_ssize_t)-1) && PyErr_Occurred())) __PYX_ERR(1, 764, __pyx_L1_error) + __pyx_t_9 = __pyx_t_11; + __Pyx_DECREF(__pyx_t_8); __pyx_t_8 = 0; + goto __pyx_L9_bool_binop_done; + } + __pyx_t_9 = 0; + __pyx_L9_bool_binop_done:; + __pyx_v_stop = __pyx_t_9; + + /* "View.MemoryView":765 + * start = index.start or 0 + * stop = index.stop or 0 + * step = index.step or 0 # <<<<<<<<<<<<<< + * + * have_start = index.start is not None +*/ + __pyx_t_8 = __Pyx_PyObject_GetAttrStr(__pyx_v_index, __pyx_mstate_global->__pyx_n_u_step); if (unlikely(!__pyx_t_8)) __PYX_ERR(1, 765, __pyx_L1_error) + __Pyx_GOTREF(__pyx_t_8); + __pyx_t_1 = __Pyx_PyObject_IsTrue(__pyx_t_8); if (unlikely((__pyx_t_1 < 0))) __PYX_ERR(1, 765, __pyx_L1_error) + if (!__pyx_t_1) { + __Pyx_DECREF(__pyx_t_8); __pyx_t_8 = 0; + } else { + __pyx_t_11 = __Pyx_PyIndex_AsSsize_t(__pyx_t_8); if (unlikely((__pyx_t_11 == (Py_ssize_t)-1) && PyErr_Occurred())) __PYX_ERR(1, 765, __pyx_L1_error) + __pyx_t_9 = __pyx_t_11; + __Pyx_DECREF(__pyx_t_8); __pyx_t_8 = 0; + goto __pyx_L11_bool_binop_done; + } + __pyx_t_9 = 0; + __pyx_L11_bool_binop_done:; + __pyx_v_step = __pyx_t_9; + + /* "View.MemoryView":767 + * step = index.step or 0 + * + * have_start = index.start is not None # <<<<<<<<<<<<<< + * have_stop = index.stop is not None + * have_step = index.step is not None +*/ + __pyx_t_8 = __Pyx_PyObject_GetAttrStr(__pyx_v_index, __pyx_mstate_global->__pyx_n_u_start); if (unlikely(!__pyx_t_8)) __PYX_ERR(1, 767, __pyx_L1_error) + __Pyx_GOTREF(__pyx_t_8); + __pyx_t_1 = (__pyx_t_8 != Py_None); + __Pyx_DECREF(__pyx_t_8); __pyx_t_8 = 0; + __pyx_v_have_start = __pyx_t_1; + + /* "View.MemoryView":768 + * + * have_start = index.start is not None + * have_stop = index.stop is not None # <<<<<<<<<<<<<< + * have_step = index.step is not None + * +*/ + __pyx_t_8 = __Pyx_PyObject_GetAttrStr(__pyx_v_index, __pyx_mstate_global->__pyx_n_u_stop); if (unlikely(!__pyx_t_8)) __PYX_ERR(1, 768, __pyx_L1_error) + __Pyx_GOTREF(__pyx_t_8); + __pyx_t_1 = (__pyx_t_8 != Py_None); + __Pyx_DECREF(__pyx_t_8); __pyx_t_8 = 0; + __pyx_v_have_stop = __pyx_t_1; + + /* "View.MemoryView":769 + * have_start = index.start is not None + * have_stop = index.stop is not None + * have_step = index.step is not None # <<<<<<<<<<<<<< + * + * slice_memviewslice( +*/ + __pyx_t_8 = __Pyx_PyObject_GetAttrStr(__pyx_v_index, __pyx_mstate_global->__pyx_n_u_step); if (unlikely(!__pyx_t_8)) __PYX_ERR(1, 769, __pyx_L1_error) + __Pyx_GOTREF(__pyx_t_8); + __pyx_t_1 = (__pyx_t_8 != Py_None); + __Pyx_DECREF(__pyx_t_8); __pyx_t_8 = 0; + __pyx_v_have_step = __pyx_t_1; + + /* "View.MemoryView":771 + * have_step = index.step is not None + * + * slice_memviewslice( # <<<<<<<<<<<<<< + * p_dst, p_src.shape[dim], p_src.strides[dim], p_src.suboffsets[dim], + * dim, new_ndim, p_suboffset_dim, +*/ + __pyx_t_10 = __pyx_memoryview_slice_memviewslice(__pyx_v_p_dst, (__pyx_v_p_src->shape[__pyx_v_dim]), (__pyx_v_p_src->strides[__pyx_v_dim]), (__pyx_v_p_src->suboffsets[__pyx_v_dim]), __pyx_v_dim, __pyx_v_new_ndim, __pyx_v_p_suboffset_dim, __pyx_v_start, __pyx_v_stop, __pyx_v_step, __pyx_v_have_start, __pyx_v_have_stop, __pyx_v_have_step, 1); if (unlikely(__pyx_t_10 == ((int)-1))) __PYX_ERR(1, 771, __pyx_L1_error) + + /* "View.MemoryView":777 + * have_start, have_stop, have_step, + * True) + * new_ndim += 1 # <<<<<<<<<<<<<< + * + * if isinstance(memview, _memoryviewslice): +*/ + __pyx_v_new_ndim = (__pyx_v_new_ndim + 1); + } + __pyx_L6:; + + /* "View.MemoryView":748 + * cdef bint have_start, have_stop, have_step + * + * for dim, index in enumerate(indices): # <<<<<<<<<<<<<< + * if PyIndex_Check(index): + * cindex = index +*/ + } + __Pyx_DECREF(__pyx_t_2); __pyx_t_2 = 0; + + /* "View.MemoryView":779 + * new_ndim += 1 + * + * if isinstance(memview, _memoryviewslice): # <<<<<<<<<<<<<< + * return memoryview_fromslice(dst, new_ndim, + * memviewsliceobj.to_object_func, +*/ + __pyx_t_1 = __Pyx_TypeCheck(((PyObject *)__pyx_v_memview), __pyx_mstate_global->__pyx_memoryviewslice_type); + if (__pyx_t_1) { + + /* "View.MemoryView":780 + * + * if isinstance(memview, _memoryviewslice): + * return memoryview_fromslice(dst, new_ndim, # <<<<<<<<<<<<<< + * memviewsliceobj.to_object_func, + * memviewsliceobj.to_dtype_func, +*/ + __Pyx_XDECREF((PyObject *)__pyx_r); + + /* "View.MemoryView":781 + * if isinstance(memview, _memoryviewslice): + * return memoryview_fromslice(dst, new_ndim, + * memviewsliceobj.to_object_func, # <<<<<<<<<<<<<< + * memviewsliceobj.to_dtype_func, + * memview.dtype_is_object) +*/ + if (unlikely(!__pyx_v_memviewsliceobj)) { __Pyx_RaiseUnboundLocalError("memviewsliceobj"); __PYX_ERR(1, 781, __pyx_L1_error) } + + /* "View.MemoryView":782 + * return memoryview_fromslice(dst, new_ndim, + * memviewsliceobj.to_object_func, + * memviewsliceobj.to_dtype_func, # <<<<<<<<<<<<<< + * memview.dtype_is_object) + * else: +*/ + if (unlikely(!__pyx_v_memviewsliceobj)) { __Pyx_RaiseUnboundLocalError("memviewsliceobj"); __PYX_ERR(1, 782, __pyx_L1_error) } + + /* "View.MemoryView":780 + * + * if isinstance(memview, _memoryviewslice): + * return memoryview_fromslice(dst, new_ndim, # <<<<<<<<<<<<<< + * memviewsliceobj.to_object_func, + * memviewsliceobj.to_dtype_func, +*/ + __pyx_t_2 = __pyx_memoryview_fromslice(__pyx_v_dst, __pyx_v_new_ndim, __pyx_v_memviewsliceobj->to_object_func, __pyx_v_memviewsliceobj->to_dtype_func, __pyx_v_memview->dtype_is_object); if (unlikely(!__pyx_t_2)) __PYX_ERR(1, 780, __pyx_L1_error) + __Pyx_GOTREF(__pyx_t_2); + if (!(likely(((__pyx_t_2) == Py_None) || likely(__Pyx_TypeTest(__pyx_t_2, __pyx_mstate_global->__pyx_memoryview_type))))) __PYX_ERR(1, 780, __pyx_L1_error) + __pyx_r = ((struct __pyx_memoryview_obj *)__pyx_t_2); + __pyx_t_2 = 0; + goto __pyx_L0; + + /* "View.MemoryView":779 + * new_ndim += 1 + * + * if isinstance(memview, _memoryviewslice): # <<<<<<<<<<<<<< + * return memoryview_fromslice(dst, new_ndim, + * memviewsliceobj.to_object_func, +*/ + } + + /* "View.MemoryView":785 + * memview.dtype_is_object) + * else: + * return memoryview_fromslice(dst, new_ndim, NULL, NULL, # <<<<<<<<<<<<<< + * memview.dtype_is_object) + * +*/ + /*else*/ { + __Pyx_XDECREF((PyObject *)__pyx_r); + + /* "View.MemoryView":786 + * else: + * return memoryview_fromslice(dst, new_ndim, NULL, NULL, + * memview.dtype_is_object) # <<<<<<<<<<<<<< + * + * +*/ + __pyx_t_2 = __pyx_memoryview_fromslice(__pyx_v_dst, __pyx_v_new_ndim, NULL, NULL, __pyx_v_memview->dtype_is_object); if (unlikely(!__pyx_t_2)) __PYX_ERR(1, 785, __pyx_L1_error) + __Pyx_GOTREF(__pyx_t_2); + + /* "View.MemoryView":785 + * memview.dtype_is_object) + * else: + * return memoryview_fromslice(dst, new_ndim, NULL, NULL, # <<<<<<<<<<<<<< + * memview.dtype_is_object) + * +*/ + if (!(likely(((__pyx_t_2) == Py_None) || likely(__Pyx_TypeTest(__pyx_t_2, __pyx_mstate_global->__pyx_memoryview_type))))) __PYX_ERR(1, 785, __pyx_L1_error) + __pyx_r = ((struct __pyx_memoryview_obj *)__pyx_t_2); + __pyx_t_2 = 0; + goto __pyx_L0; + } + + /* "View.MemoryView":711 + * + * + * @cname('__pyx_memview_slice') # <<<<<<<<<<<<<< + * cdef memoryview memview_slice(memoryview memview, object indices): + * cdef int new_ndim = 0, suboffset_dim = -1, dim +*/ + + /* function exit code */ + __pyx_L1_error:; + __Pyx_XDECREF(__pyx_t_2); + __Pyx_XDECREF(__pyx_t_8); + __Pyx_AddTraceback("View.MemoryView.memview_slice", __pyx_clineno, __pyx_lineno, __pyx_filename); + __pyx_r = 0; + __pyx_L0:; + __Pyx_XDECREF((PyObject *)__pyx_v_memviewsliceobj); + __Pyx_XDECREF(__pyx_v_index); + __Pyx_XGIVEREF((PyObject *)__pyx_r); + __Pyx_RefNannyFinishContext(); + return __pyx_r; +} + +/* "View.MemoryView":793 + * + * + * @cname('__pyx_memoryview_slice_memviewslice') # <<<<<<<<<<<<<< + * cdef int slice_memviewslice( + * __Pyx_memviewslice *dst, +*/ + +static int __pyx_memoryview_slice_memviewslice(__Pyx_memviewslice *__pyx_v_dst, Py_ssize_t __pyx_v_shape, Py_ssize_t __pyx_v_stride, Py_ssize_t __pyx_v_suboffset, int __pyx_v_dim, int __pyx_v_new_ndim, int *__pyx_v_suboffset_dim, Py_ssize_t __pyx_v_start, Py_ssize_t __pyx_v_stop, Py_ssize_t __pyx_v_step, int __pyx_v_have_start, int __pyx_v_have_stop, int __pyx_v_have_step, int __pyx_v_is_slice) { + Py_ssize_t __pyx_v_new_shape; + int __pyx_v_negative_step; + int __pyx_r; + int __pyx_t_1; + int __pyx_t_2; + int __pyx_t_3; + int __pyx_lineno = 0; + const char *__pyx_filename = NULL; + int __pyx_clineno = 0; + PyGILState_STATE __pyx_gilstate_save; + + /* "View.MemoryView":814 + * cdef bint negative_step + * + * if not is_slice: # <<<<<<<<<<<<<< + * + * if start < 0: +*/ + __pyx_t_1 = (!__pyx_v_is_slice); + if (__pyx_t_1) { + + /* "View.MemoryView":816 + * if not is_slice: + * + * if start < 0: # <<<<<<<<<<<<<< + * start += shape + * if not 0 <= start < shape: +*/ + __pyx_t_1 = (__pyx_v_start < 0); + if (__pyx_t_1) { + + /* "View.MemoryView":817 + * + * if start < 0: + * start += shape # <<<<<<<<<<<<<< + * if not 0 <= start < shape: + * _err_dim(PyExc_IndexError, "Index out of bounds (axis %d)", dim) +*/ + __pyx_v_start = (__pyx_v_start + __pyx_v_shape); + + /* "View.MemoryView":816 + * if not is_slice: + * + * if start < 0: # <<<<<<<<<<<<<< + * start += shape + * if not 0 <= start < shape: +*/ + } + + /* "View.MemoryView":818 + * if start < 0: + * start += shape + * if not 0 <= start < shape: # <<<<<<<<<<<<<< + * _err_dim(PyExc_IndexError, "Index out of bounds (axis %d)", dim) + * else: +*/ + __pyx_t_1 = (0 <= __pyx_v_start); + if (__pyx_t_1) { + __pyx_t_1 = (__pyx_v_start < __pyx_v_shape); + } + __pyx_t_2 = (!__pyx_t_1); + if (__pyx_t_2) { + + /* "View.MemoryView":819 + * start += shape + * if not 0 <= start < shape: + * _err_dim(PyExc_IndexError, "Index out of bounds (axis %d)", dim) # <<<<<<<<<<<<<< + * else: + * +*/ + __pyx_t_3 = __pyx_memoryview_err_dim(PyExc_IndexError, __pyx_mstate_global->__pyx_kp_u_Index_out_of_bounds_axis_d, __pyx_v_dim); if (unlikely(__pyx_t_3 == ((int)-1))) __PYX_ERR(1, 819, __pyx_L1_error) + + /* "View.MemoryView":818 + * if start < 0: + * start += shape + * if not 0 <= start < shape: # <<<<<<<<<<<<<< + * _err_dim(PyExc_IndexError, "Index out of bounds (axis %d)", dim) + * else: +*/ + } + + /* "View.MemoryView":814 + * cdef bint negative_step + * + * if not is_slice: # <<<<<<<<<<<<<< + * + * if start < 0: +*/ + goto __pyx_L3; + } + + /* "View.MemoryView":822 + * else: + * + * if have_step: # <<<<<<<<<<<<<< + * negative_step = step < 0 + * if step == 0: +*/ + /*else*/ { + __pyx_t_2 = (__pyx_v_have_step != 0); + if (__pyx_t_2) { + + /* "View.MemoryView":823 + * + * if have_step: + * negative_step = step < 0 # <<<<<<<<<<<<<< + * if step == 0: + * _err_dim(PyExc_ValueError, "Step may not be zero (axis %d)", dim) +*/ + __pyx_v_negative_step = (__pyx_v_step < 0); + + /* "View.MemoryView":824 + * if have_step: + * negative_step = step < 0 + * if step == 0: # <<<<<<<<<<<<<< + * _err_dim(PyExc_ValueError, "Step may not be zero (axis %d)", dim) + * else: +*/ + __pyx_t_2 = (__pyx_v_step == 0); + if (__pyx_t_2) { + + /* "View.MemoryView":825 + * negative_step = step < 0 + * if step == 0: + * _err_dim(PyExc_ValueError, "Step may not be zero (axis %d)", dim) # <<<<<<<<<<<<<< + * else: + * negative_step = False +*/ + __pyx_t_3 = __pyx_memoryview_err_dim(PyExc_ValueError, __pyx_mstate_global->__pyx_kp_u_Step_may_not_be_zero_axis_d, __pyx_v_dim); if (unlikely(__pyx_t_3 == ((int)-1))) __PYX_ERR(1, 825, __pyx_L1_error) + + /* "View.MemoryView":824 + * if have_step: + * negative_step = step < 0 + * if step == 0: # <<<<<<<<<<<<<< + * _err_dim(PyExc_ValueError, "Step may not be zero (axis %d)", dim) + * else: +*/ + } + + /* "View.MemoryView":822 + * else: + * + * if have_step: # <<<<<<<<<<<<<< + * negative_step = step < 0 + * if step == 0: +*/ + goto __pyx_L6; + } + + /* "View.MemoryView":827 + * _err_dim(PyExc_ValueError, "Step may not be zero (axis %d)", dim) + * else: + * negative_step = False # <<<<<<<<<<<<<< + * step = 1 + * +*/ + /*else*/ { + __pyx_v_negative_step = 0; + + /* "View.MemoryView":828 + * else: + * negative_step = False + * step = 1 # <<<<<<<<<<<<<< + * + * +*/ + __pyx_v_step = 1; + } + __pyx_L6:; + + /* "View.MemoryView":831 + * + * + * if have_start: # <<<<<<<<<<<<<< + * if start < 0: + * start += shape +*/ + __pyx_t_2 = (__pyx_v_have_start != 0); + if (__pyx_t_2) { + + /* "View.MemoryView":832 + * + * if have_start: + * if start < 0: # <<<<<<<<<<<<<< + * start += shape + * if start < 0: +*/ + __pyx_t_2 = (__pyx_v_start < 0); + if (__pyx_t_2) { + + /* "View.MemoryView":833 + * if have_start: + * if start < 0: + * start += shape # <<<<<<<<<<<<<< + * if start < 0: + * start = 0 +*/ + __pyx_v_start = (__pyx_v_start + __pyx_v_shape); + + /* "View.MemoryView":834 + * if start < 0: + * start += shape + * if start < 0: # <<<<<<<<<<<<<< + * start = 0 + * elif start >= shape: +*/ + __pyx_t_2 = (__pyx_v_start < 0); + if (__pyx_t_2) { + + /* "View.MemoryView":835 + * start += shape + * if start < 0: + * start = 0 # <<<<<<<<<<<<<< + * elif start >= shape: + * if negative_step: +*/ + __pyx_v_start = 0; + + /* "View.MemoryView":834 + * if start < 0: + * start += shape + * if start < 0: # <<<<<<<<<<<<<< + * start = 0 + * elif start >= shape: +*/ + } + + /* "View.MemoryView":832 + * + * if have_start: + * if start < 0: # <<<<<<<<<<<<<< + * start += shape + * if start < 0: +*/ + goto __pyx_L9; + } + + /* "View.MemoryView":836 + * if start < 0: + * start = 0 + * elif start >= shape: # <<<<<<<<<<<<<< + * if negative_step: + * start = shape - 1 +*/ + __pyx_t_2 = (__pyx_v_start >= __pyx_v_shape); + if (__pyx_t_2) { + + /* "View.MemoryView":837 + * start = 0 + * elif start >= shape: + * if negative_step: # <<<<<<<<<<<<<< + * start = shape - 1 + * else: +*/ + if (__pyx_v_negative_step) { + + /* "View.MemoryView":838 + * elif start >= shape: + * if negative_step: + * start = shape - 1 # <<<<<<<<<<<<<< + * else: + * start = shape +*/ + __pyx_v_start = (__pyx_v_shape - 1); + + /* "View.MemoryView":837 + * start = 0 + * elif start >= shape: + * if negative_step: # <<<<<<<<<<<<<< + * start = shape - 1 + * else: +*/ + goto __pyx_L11; + } + + /* "View.MemoryView":840 + * start = shape - 1 + * else: + * start = shape # <<<<<<<<<<<<<< + * else: + * if negative_step: +*/ + /*else*/ { + __pyx_v_start = __pyx_v_shape; + } + __pyx_L11:; + + /* "View.MemoryView":836 + * if start < 0: + * start = 0 + * elif start >= shape: # <<<<<<<<<<<<<< + * if negative_step: + * start = shape - 1 +*/ + } + __pyx_L9:; + + /* "View.MemoryView":831 + * + * + * if have_start: # <<<<<<<<<<<<<< + * if start < 0: + * start += shape +*/ + goto __pyx_L8; + } + + /* "View.MemoryView":842 + * start = shape + * else: + * if negative_step: # <<<<<<<<<<<<<< + * start = shape - 1 + * else: +*/ + /*else*/ { + if (__pyx_v_negative_step) { + + /* "View.MemoryView":843 + * else: + * if negative_step: + * start = shape - 1 # <<<<<<<<<<<<<< + * else: + * start = 0 +*/ + __pyx_v_start = (__pyx_v_shape - 1); + + /* "View.MemoryView":842 + * start = shape + * else: + * if negative_step: # <<<<<<<<<<<<<< + * start = shape - 1 + * else: +*/ + goto __pyx_L12; + } + + /* "View.MemoryView":845 + * start = shape - 1 + * else: + * start = 0 # <<<<<<<<<<<<<< + * + * if have_stop: +*/ + /*else*/ { + __pyx_v_start = 0; + } + __pyx_L12:; + } + __pyx_L8:; + + /* "View.MemoryView":847 + * start = 0 + * + * if have_stop: # <<<<<<<<<<<<<< + * if stop < 0: + * stop += shape +*/ + __pyx_t_2 = (__pyx_v_have_stop != 0); + if (__pyx_t_2) { + + /* "View.MemoryView":848 + * + * if have_stop: + * if stop < 0: # <<<<<<<<<<<<<< + * stop += shape + * if stop < 0: +*/ + __pyx_t_2 = (__pyx_v_stop < 0); + if (__pyx_t_2) { + + /* "View.MemoryView":849 + * if have_stop: + * if stop < 0: + * stop += shape # <<<<<<<<<<<<<< + * if stop < 0: + * stop = 0 +*/ + __pyx_v_stop = (__pyx_v_stop + __pyx_v_shape); + + /* "View.MemoryView":850 + * if stop < 0: + * stop += shape + * if stop < 0: # <<<<<<<<<<<<<< + * stop = 0 + * elif stop > shape: +*/ + __pyx_t_2 = (__pyx_v_stop < 0); + if (__pyx_t_2) { + + /* "View.MemoryView":851 + * stop += shape + * if stop < 0: + * stop = 0 # <<<<<<<<<<<<<< + * elif stop > shape: + * stop = shape +*/ + __pyx_v_stop = 0; + + /* "View.MemoryView":850 + * if stop < 0: + * stop += shape + * if stop < 0: # <<<<<<<<<<<<<< + * stop = 0 + * elif stop > shape: +*/ + } + + /* "View.MemoryView":848 + * + * if have_stop: + * if stop < 0: # <<<<<<<<<<<<<< + * stop += shape + * if stop < 0: +*/ + goto __pyx_L14; + } + + /* "View.MemoryView":852 + * if stop < 0: + * stop = 0 + * elif stop > shape: # <<<<<<<<<<<<<< + * stop = shape + * else: +*/ + __pyx_t_2 = (__pyx_v_stop > __pyx_v_shape); + if (__pyx_t_2) { + + /* "View.MemoryView":853 + * stop = 0 + * elif stop > shape: + * stop = shape # <<<<<<<<<<<<<< + * else: + * if negative_step: +*/ + __pyx_v_stop = __pyx_v_shape; + + /* "View.MemoryView":852 + * if stop < 0: + * stop = 0 + * elif stop > shape: # <<<<<<<<<<<<<< + * stop = shape + * else: +*/ + } + __pyx_L14:; + + /* "View.MemoryView":847 + * start = 0 + * + * if have_stop: # <<<<<<<<<<<<<< + * if stop < 0: + * stop += shape +*/ + goto __pyx_L13; + } + + /* "View.MemoryView":855 + * stop = shape + * else: + * if negative_step: # <<<<<<<<<<<<<< + * stop = -1 + * else: +*/ + /*else*/ { + if (__pyx_v_negative_step) { + + /* "View.MemoryView":856 + * else: + * if negative_step: + * stop = -1 # <<<<<<<<<<<<<< + * else: + * stop = shape +*/ + __pyx_v_stop = -1L; + + /* "View.MemoryView":855 + * stop = shape + * else: + * if negative_step: # <<<<<<<<<<<<<< + * stop = -1 + * else: +*/ + goto __pyx_L16; + } + + /* "View.MemoryView":858 + * stop = -1 + * else: + * stop = shape # <<<<<<<<<<<<<< + * + * +*/ + /*else*/ { + __pyx_v_stop = __pyx_v_shape; + } + __pyx_L16:; + } + __pyx_L13:; + + /* "View.MemoryView":862 + * + * with cython.cdivision(True): + * new_shape = (stop - start) // step # <<<<<<<<<<<<<< + * + * if (stop - start) - step * new_shape: +*/ + __pyx_v_new_shape = ((__pyx_v_stop - __pyx_v_start) / __pyx_v_step); + + /* "View.MemoryView":864 + * new_shape = (stop - start) // step + * + * if (stop - start) - step * new_shape: # <<<<<<<<<<<<<< + * new_shape += 1 + * +*/ + __pyx_t_2 = (((__pyx_v_stop - __pyx_v_start) - (__pyx_v_step * __pyx_v_new_shape)) != 0); + if (__pyx_t_2) { + + /* "View.MemoryView":865 + * + * if (stop - start) - step * new_shape: + * new_shape += 1 # <<<<<<<<<<<<<< + * + * if new_shape < 0: +*/ + __pyx_v_new_shape = (__pyx_v_new_shape + 1); + + /* "View.MemoryView":864 + * new_shape = (stop - start) // step + * + * if (stop - start) - step * new_shape: # <<<<<<<<<<<<<< + * new_shape += 1 + * +*/ + } + + /* "View.MemoryView":867 + * new_shape += 1 + * + * if new_shape < 0: # <<<<<<<<<<<<<< + * new_shape = 0 + * +*/ + __pyx_t_2 = (__pyx_v_new_shape < 0); + if (__pyx_t_2) { + + /* "View.MemoryView":868 + * + * if new_shape < 0: + * new_shape = 0 # <<<<<<<<<<<<<< + * + * +*/ + __pyx_v_new_shape = 0; + + /* "View.MemoryView":867 + * new_shape += 1 + * + * if new_shape < 0: # <<<<<<<<<<<<<< + * new_shape = 0 + * +*/ + } + + /* "View.MemoryView":871 + * + * + * dst.strides[new_ndim] = stride * step # <<<<<<<<<<<<<< + * dst.shape[new_ndim] = new_shape + * dst.suboffsets[new_ndim] = suboffset +*/ + (__pyx_v_dst->strides[__pyx_v_new_ndim]) = (__pyx_v_stride * __pyx_v_step); + + /* "View.MemoryView":872 + * + * dst.strides[new_ndim] = stride * step + * dst.shape[new_ndim] = new_shape # <<<<<<<<<<<<<< + * dst.suboffsets[new_ndim] = suboffset + * +*/ + (__pyx_v_dst->shape[__pyx_v_new_ndim]) = __pyx_v_new_shape; + + /* "View.MemoryView":873 + * dst.strides[new_ndim] = stride * step + * dst.shape[new_ndim] = new_shape + * dst.suboffsets[new_ndim] = suboffset # <<<<<<<<<<<<<< + * + * +*/ + (__pyx_v_dst->suboffsets[__pyx_v_new_ndim]) = __pyx_v_suboffset; + } + __pyx_L3:; + + /* "View.MemoryView":876 + * + * + * if suboffset_dim[0] < 0: # <<<<<<<<<<<<<< + * dst.data += start * stride + * else: +*/ + __pyx_t_2 = ((__pyx_v_suboffset_dim[0]) < 0); + if (__pyx_t_2) { + + /* "View.MemoryView":877 + * + * if suboffset_dim[0] < 0: + * dst.data += start * stride # <<<<<<<<<<<<<< + * else: + * dst.suboffsets[suboffset_dim[0]] += start * stride +*/ + __pyx_v_dst->data = (__pyx_v_dst->data + (__pyx_v_start * __pyx_v_stride)); + + /* "View.MemoryView":876 + * + * + * if suboffset_dim[0] < 0: # <<<<<<<<<<<<<< + * dst.data += start * stride + * else: +*/ + goto __pyx_L19; + } + + /* "View.MemoryView":879 + * dst.data += start * stride + * else: + * dst.suboffsets[suboffset_dim[0]] += start * stride # <<<<<<<<<<<<<< + * + * if suboffset >= 0: +*/ + /*else*/ { + __pyx_t_3 = (__pyx_v_suboffset_dim[0]); + (__pyx_v_dst->suboffsets[__pyx_t_3]) = ((__pyx_v_dst->suboffsets[__pyx_t_3]) + (__pyx_v_start * __pyx_v_stride)); + } + __pyx_L19:; + + /* "View.MemoryView":881 + * dst.suboffsets[suboffset_dim[0]] += start * stride + * + * if suboffset >= 0: # <<<<<<<<<<<<<< + * if not is_slice: + * if new_ndim == 0: +*/ + __pyx_t_2 = (__pyx_v_suboffset >= 0); + if (__pyx_t_2) { + + /* "View.MemoryView":882 + * + * if suboffset >= 0: + * if not is_slice: # <<<<<<<<<<<<<< + * if new_ndim == 0: + * dst.data = ( dst.data)[0] + suboffset +*/ + __pyx_t_2 = (!__pyx_v_is_slice); + if (__pyx_t_2) { + + /* "View.MemoryView":883 + * if suboffset >= 0: + * if not is_slice: + * if new_ndim == 0: # <<<<<<<<<<<<<< + * dst.data = ( dst.data)[0] + suboffset + * else: +*/ + __pyx_t_2 = (__pyx_v_new_ndim == 0); + if (__pyx_t_2) { + + /* "View.MemoryView":884 + * if not is_slice: + * if new_ndim == 0: + * dst.data = ( dst.data)[0] + suboffset # <<<<<<<<<<<<<< + * else: + * _err_dim(PyExc_IndexError, "All dimensions preceding dimension %d " +*/ + __pyx_v_dst->data = ((((char **)__pyx_v_dst->data)[0]) + __pyx_v_suboffset); + + /* "View.MemoryView":883 + * if suboffset >= 0: + * if not is_slice: + * if new_ndim == 0: # <<<<<<<<<<<<<< + * dst.data = ( dst.data)[0] + suboffset + * else: +*/ + goto __pyx_L22; + } + + /* "View.MemoryView":886 + * dst.data = ( dst.data)[0] + suboffset + * else: + * _err_dim(PyExc_IndexError, "All dimensions preceding dimension %d " # <<<<<<<<<<<<<< + * "must be indexed and not sliced", dim) + * else: +*/ + /*else*/ { + + /* "View.MemoryView":887 + * else: + * _err_dim(PyExc_IndexError, "All dimensions preceding dimension %d " + * "must be indexed and not sliced", dim) # <<<<<<<<<<<<<< + * else: + * suboffset_dim[0] = new_ndim +*/ + __pyx_t_3 = __pyx_memoryview_err_dim(PyExc_IndexError, __pyx_mstate_global->__pyx_kp_u_All_dimensions_preceding_dimensi, __pyx_v_dim); if (unlikely(__pyx_t_3 == ((int)-1))) __PYX_ERR(1, 886, __pyx_L1_error) + } + __pyx_L22:; + + /* "View.MemoryView":882 + * + * if suboffset >= 0: + * if not is_slice: # <<<<<<<<<<<<<< + * if new_ndim == 0: + * dst.data = ( dst.data)[0] + suboffset +*/ + goto __pyx_L21; + } + + /* "View.MemoryView":889 + * "must be indexed and not sliced", dim) + * else: + * suboffset_dim[0] = new_ndim # <<<<<<<<<<<<<< + * + * return 0 +*/ + /*else*/ { + (__pyx_v_suboffset_dim[0]) = __pyx_v_new_ndim; + } + __pyx_L21:; + + /* "View.MemoryView":881 + * dst.suboffsets[suboffset_dim[0]] += start * stride + * + * if suboffset >= 0: # <<<<<<<<<<<<<< + * if not is_slice: + * if new_ndim == 0: +*/ + } + + /* "View.MemoryView":891 + * suboffset_dim[0] = new_ndim + * + * return 0 # <<<<<<<<<<<<<< + * + * +*/ + __pyx_r = 0; + goto __pyx_L0; + + /* "View.MemoryView":793 + * + * + * @cname('__pyx_memoryview_slice_memviewslice') # <<<<<<<<<<<<<< + * cdef int slice_memviewslice( + * __Pyx_memviewslice *dst, +*/ + + /* function exit code */ + __pyx_L1_error:; + __pyx_gilstate_save = __Pyx_PyGILState_Ensure(); + __Pyx_AddTraceback("View.MemoryView.slice_memviewslice", __pyx_clineno, __pyx_lineno, __pyx_filename); + __pyx_r = -1; + __Pyx_PyGILState_Release(__pyx_gilstate_save); + __pyx_L0:; + return __pyx_r; +} + +/* "View.MemoryView":896 + * + * + * @cname('__pyx_pybuffer_index') # <<<<<<<<<<<<<< + * cdef char *pybuffer_index(Py_buffer *view, char *bufp, Py_ssize_t index, + * Py_ssize_t dim) except NULL: +*/ + +static char *__pyx_pybuffer_index(Py_buffer *__pyx_v_view, char *__pyx_v_bufp, Py_ssize_t __pyx_v_index, Py_ssize_t __pyx_v_dim) { + Py_ssize_t __pyx_v_shape; + Py_ssize_t __pyx_v_stride; + Py_ssize_t __pyx_v_suboffset; + Py_ssize_t __pyx_v_itemsize; + char *__pyx_v_resultp; + char *__pyx_r; + __Pyx_RefNannyDeclarations + Py_ssize_t __pyx_t_1; + int __pyx_t_2; + PyObject *__pyx_t_3 = NULL; + PyObject *__pyx_t_4[3]; + PyObject *__pyx_t_5 = NULL; + int __pyx_lineno = 0; + const char *__pyx_filename = NULL; + int __pyx_clineno = 0; + __Pyx_RefNannySetupContext("pybuffer_index", 0); + + /* "View.MemoryView":899 + * cdef char *pybuffer_index(Py_buffer *view, char *bufp, Py_ssize_t index, + * Py_ssize_t dim) except NULL: + * cdef Py_ssize_t shape, stride, suboffset = -1 # <<<<<<<<<<<<<< + * cdef Py_ssize_t itemsize = view.itemsize + * cdef char *resultp +*/ + __pyx_v_suboffset = -1L; + + /* "View.MemoryView":900 + * Py_ssize_t dim) except NULL: + * cdef Py_ssize_t shape, stride, suboffset = -1 + * cdef Py_ssize_t itemsize = view.itemsize # <<<<<<<<<<<<<< + * cdef char *resultp + * +*/ + __pyx_t_1 = __pyx_v_view->itemsize; + __pyx_v_itemsize = __pyx_t_1; + + /* "View.MemoryView":903 + * cdef char *resultp + * + * if view.ndim == 0: # <<<<<<<<<<<<<< + * shape = view.len // itemsize + * stride = itemsize +*/ + __pyx_t_2 = (__pyx_v_view->ndim == 0); + if (__pyx_t_2) { + + /* "View.MemoryView":904 + * + * if view.ndim == 0: + * shape = view.len // itemsize # <<<<<<<<<<<<<< + * stride = itemsize + * else: +*/ + if (unlikely(__pyx_v_itemsize == 0)) { + PyErr_SetString(PyExc_ZeroDivisionError, "integer division or modulo by zero"); + __PYX_ERR(1, 904, __pyx_L1_error) + } + else if (sizeof(Py_ssize_t) == sizeof(long) && (!(((Py_ssize_t)-1) > 0)) && unlikely(__pyx_v_itemsize == (Py_ssize_t)-1) && unlikely(__Pyx_UNARY_NEG_WOULD_OVERFLOW(__pyx_v_view->len))) { + PyErr_SetString(PyExc_OverflowError, "value too large to perform division"); + __PYX_ERR(1, 904, __pyx_L1_error) + } + __pyx_v_shape = __Pyx_div_Py_ssize_t(__pyx_v_view->len, __pyx_v_itemsize, 0); + + /* "View.MemoryView":905 + * if view.ndim == 0: + * shape = view.len // itemsize + * stride = itemsize # <<<<<<<<<<<<<< + * else: + * shape = view.shape[dim] +*/ + __pyx_v_stride = __pyx_v_itemsize; + + /* "View.MemoryView":903 + * cdef char *resultp + * + * if view.ndim == 0: # <<<<<<<<<<<<<< + * shape = view.len // itemsize + * stride = itemsize +*/ + goto __pyx_L3; + } + + /* "View.MemoryView":907 + * stride = itemsize + * else: + * shape = view.shape[dim] # <<<<<<<<<<<<<< + * stride = view.strides[dim] + * if view.suboffsets != NULL: +*/ + /*else*/ { + __pyx_v_shape = (__pyx_v_view->shape[__pyx_v_dim]); + + /* "View.MemoryView":908 + * else: + * shape = view.shape[dim] + * stride = view.strides[dim] # <<<<<<<<<<<<<< + * if view.suboffsets != NULL: + * suboffset = view.suboffsets[dim] +*/ + __pyx_v_stride = (__pyx_v_view->strides[__pyx_v_dim]); + + /* "View.MemoryView":909 + * shape = view.shape[dim] + * stride = view.strides[dim] + * if view.suboffsets != NULL: # <<<<<<<<<<<<<< + * suboffset = view.suboffsets[dim] + * +*/ + __pyx_t_2 = (__pyx_v_view->suboffsets != NULL); + if (__pyx_t_2) { + + /* "View.MemoryView":910 + * stride = view.strides[dim] + * if view.suboffsets != NULL: + * suboffset = view.suboffsets[dim] # <<<<<<<<<<<<<< + * + * if index < 0: +*/ + __pyx_v_suboffset = (__pyx_v_view->suboffsets[__pyx_v_dim]); + + /* "View.MemoryView":909 + * shape = view.shape[dim] + * stride = view.strides[dim] + * if view.suboffsets != NULL: # <<<<<<<<<<<<<< + * suboffset = view.suboffsets[dim] + * +*/ + } + } + __pyx_L3:; + + /* "View.MemoryView":912 + * suboffset = view.suboffsets[dim] + * + * if index < 0: # <<<<<<<<<<<<<< + * index += view.shape[dim] + * if index < 0: +*/ + __pyx_t_2 = (__pyx_v_index < 0); + if (__pyx_t_2) { + + /* "View.MemoryView":913 + * + * if index < 0: + * index += view.shape[dim] # <<<<<<<<<<<<<< + * if index < 0: + * raise IndexError, f"Out of bounds on buffer access (axis {dim})" +*/ + __pyx_v_index = (__pyx_v_index + (__pyx_v_view->shape[__pyx_v_dim])); + + /* "View.MemoryView":914 + * if index < 0: + * index += view.shape[dim] + * if index < 0: # <<<<<<<<<<<<<< + * raise IndexError, f"Out of bounds on buffer access (axis {dim})" + * +*/ + __pyx_t_2 = (__pyx_v_index < 0); + if (unlikely(__pyx_t_2)) { + + /* "View.MemoryView":915 + * index += view.shape[dim] + * if index < 0: + * raise IndexError, f"Out of bounds on buffer access (axis {dim})" # <<<<<<<<<<<<<< + * + * if index >= shape: +*/ + __pyx_t_3 = __Pyx_PyUnicode_From_Py_ssize_t(__pyx_v_dim, 0, ' ', 'd'); if (unlikely(!__pyx_t_3)) __PYX_ERR(1, 915, __pyx_L1_error) + __Pyx_GOTREF(__pyx_t_3); + __pyx_t_4[0] = __pyx_mstate_global->__pyx_kp_u_Out_of_bounds_on_buffer_access_a; + __pyx_t_4[1] = __pyx_t_3; + __pyx_t_4[2] = __pyx_mstate_global->__pyx_kp_u__5; + __pyx_t_5 = __Pyx_PyUnicode_Join(__pyx_t_4, 3, 37 + __Pyx_PyUnicode_GET_LENGTH(__pyx_t_3) + 1, 127); + if (unlikely(!__pyx_t_5)) __PYX_ERR(1, 915, __pyx_L1_error) + __Pyx_GOTREF(__pyx_t_5); + __Pyx_DECREF(__pyx_t_3); __pyx_t_3 = 0; + __Pyx_Raise(((PyObject *)(((PyTypeObject*)PyExc_IndexError))), __pyx_t_5, 0, 0); + __Pyx_DECREF(__pyx_t_5); __pyx_t_5 = 0; + __PYX_ERR(1, 915, __pyx_L1_error) + + /* "View.MemoryView":914 + * if index < 0: + * index += view.shape[dim] + * if index < 0: # <<<<<<<<<<<<<< + * raise IndexError, f"Out of bounds on buffer access (axis {dim})" + * +*/ + } + + /* "View.MemoryView":912 + * suboffset = view.suboffsets[dim] + * + * if index < 0: # <<<<<<<<<<<<<< + * index += view.shape[dim] + * if index < 0: +*/ + } + + /* "View.MemoryView":917 + * raise IndexError, f"Out of bounds on buffer access (axis {dim})" + * + * if index >= shape: # <<<<<<<<<<<<<< + * raise IndexError, f"Out of bounds on buffer access (axis {dim})" + * +*/ + __pyx_t_2 = (__pyx_v_index >= __pyx_v_shape); + if (unlikely(__pyx_t_2)) { + + /* "View.MemoryView":918 + * + * if index >= shape: + * raise IndexError, f"Out of bounds on buffer access (axis {dim})" # <<<<<<<<<<<<<< + * + * resultp = bufp + index * stride +*/ + __pyx_t_5 = __Pyx_PyUnicode_From_Py_ssize_t(__pyx_v_dim, 0, ' ', 'd'); if (unlikely(!__pyx_t_5)) __PYX_ERR(1, 918, __pyx_L1_error) + __Pyx_GOTREF(__pyx_t_5); + __pyx_t_4[0] = __pyx_mstate_global->__pyx_kp_u_Out_of_bounds_on_buffer_access_a; + __pyx_t_4[1] = __pyx_t_5; + __pyx_t_4[2] = __pyx_mstate_global->__pyx_kp_u__5; + __pyx_t_3 = __Pyx_PyUnicode_Join(__pyx_t_4, 3, 37 + __Pyx_PyUnicode_GET_LENGTH(__pyx_t_5) + 1, 127); + if (unlikely(!__pyx_t_3)) __PYX_ERR(1, 918, __pyx_L1_error) + __Pyx_GOTREF(__pyx_t_3); + __Pyx_DECREF(__pyx_t_5); __pyx_t_5 = 0; + __Pyx_Raise(((PyObject *)(((PyTypeObject*)PyExc_IndexError))), __pyx_t_3, 0, 0); + __Pyx_DECREF(__pyx_t_3); __pyx_t_3 = 0; + __PYX_ERR(1, 918, __pyx_L1_error) + + /* "View.MemoryView":917 + * raise IndexError, f"Out of bounds on buffer access (axis {dim})" + * + * if index >= shape: # <<<<<<<<<<<<<< + * raise IndexError, f"Out of bounds on buffer access (axis {dim})" + * +*/ + } + + /* "View.MemoryView":920 + * raise IndexError, f"Out of bounds on buffer access (axis {dim})" + * + * resultp = bufp + index * stride # <<<<<<<<<<<<<< + * if suboffset >= 0: + * resultp = ( resultp)[0] + suboffset +*/ + __pyx_v_resultp = (__pyx_v_bufp + (__pyx_v_index * __pyx_v_stride)); + + /* "View.MemoryView":921 + * + * resultp = bufp + index * stride + * if suboffset >= 0: # <<<<<<<<<<<<<< + * resultp = ( resultp)[0] + suboffset + * +*/ + __pyx_t_2 = (__pyx_v_suboffset >= 0); + if (__pyx_t_2) { + + /* "View.MemoryView":922 + * resultp = bufp + index * stride + * if suboffset >= 0: + * resultp = ( resultp)[0] + suboffset # <<<<<<<<<<<<<< + * + * return resultp +*/ + __pyx_v_resultp = ((((char **)__pyx_v_resultp)[0]) + __pyx_v_suboffset); + + /* "View.MemoryView":921 + * + * resultp = bufp + index * stride + * if suboffset >= 0: # <<<<<<<<<<<<<< + * resultp = ( resultp)[0] + suboffset + * +*/ + } + + /* "View.MemoryView":924 + * resultp = ( resultp)[0] + suboffset + * + * return resultp # <<<<<<<<<<<<<< + * + * +*/ + __pyx_r = __pyx_v_resultp; + goto __pyx_L0; + + /* "View.MemoryView":896 + * + * + * @cname('__pyx_pybuffer_index') # <<<<<<<<<<<<<< + * cdef char *pybuffer_index(Py_buffer *view, char *bufp, Py_ssize_t index, + * Py_ssize_t dim) except NULL: +*/ + + /* function exit code */ + __pyx_L1_error:; + __Pyx_XDECREF(__pyx_t_3); + __Pyx_XDECREF(__pyx_t_5); + __Pyx_AddTraceback("View.MemoryView.pybuffer_index", __pyx_clineno, __pyx_lineno, __pyx_filename); + __pyx_r = NULL; + __pyx_L0:; + __Pyx_RefNannyFinishContext(); + return __pyx_r; +} + +/* "View.MemoryView":929 + * + * + * @cname('__pyx_memslice_transpose') # <<<<<<<<<<<<<< + * cdef int transpose_memslice(__Pyx_memviewslice *memslice) except -1 nogil: + * cdef int ndim = memslice.memview.view.ndim +*/ + +static int __pyx_memslice_transpose(__Pyx_memviewslice *__pyx_v_memslice) { + int __pyx_v_ndim; + Py_ssize_t *__pyx_v_shape; + Py_ssize_t *__pyx_v_strides; + int __pyx_v_i; + int __pyx_v_j; + int __pyx_r; + int __pyx_t_1; + Py_ssize_t *__pyx_t_2; + long __pyx_t_3; + long __pyx_t_4; + Py_ssize_t __pyx_t_5; + Py_ssize_t __pyx_t_6; + int __pyx_t_7; + int __pyx_t_8; + int __pyx_t_9; + int __pyx_lineno = 0; + const char *__pyx_filename = NULL; + int __pyx_clineno = 0; + PyGILState_STATE __pyx_gilstate_save; + + /* "View.MemoryView":931 + * @cname('__pyx_memslice_transpose') + * cdef int transpose_memslice(__Pyx_memviewslice *memslice) except -1 nogil: + * cdef int ndim = memslice.memview.view.ndim # <<<<<<<<<<<<<< + * + * cdef Py_ssize_t *shape = memslice.shape +*/ + __pyx_t_1 = __pyx_v_memslice->memview->view.ndim; + __pyx_v_ndim = __pyx_t_1; + + /* "View.MemoryView":933 + * cdef int ndim = memslice.memview.view.ndim + * + * cdef Py_ssize_t *shape = memslice.shape # <<<<<<<<<<<<<< + * cdef Py_ssize_t *strides = memslice.strides + * +*/ + __pyx_t_2 = __pyx_v_memslice->shape; + __pyx_v_shape = __pyx_t_2; + + /* "View.MemoryView":934 + * + * cdef Py_ssize_t *shape = memslice.shape + * cdef Py_ssize_t *strides = memslice.strides # <<<<<<<<<<<<<< + * + * +*/ + __pyx_t_2 = __pyx_v_memslice->strides; + __pyx_v_strides = __pyx_t_2; + + /* "View.MemoryView":938 + * + * cdef int i, j + * for i in range(ndim // 2): # <<<<<<<<<<<<<< + * j = ndim - 1 - i + * strides[i], strides[j] = strides[j], strides[i] +*/ + __pyx_t_3 = __Pyx_div_long(__pyx_v_ndim, 2, 1); + __pyx_t_4 = __pyx_t_3; + for (__pyx_t_1 = 0; __pyx_t_1 < __pyx_t_4; __pyx_t_1+=1) { + __pyx_v_i = __pyx_t_1; + + /* "View.MemoryView":939 + * cdef int i, j + * for i in range(ndim // 2): + * j = ndim - 1 - i # <<<<<<<<<<<<<< + * strides[i], strides[j] = strides[j], strides[i] + * shape[i], shape[j] = shape[j], shape[i] +*/ + __pyx_v_j = ((__pyx_v_ndim - 1) - __pyx_v_i); + + /* "View.MemoryView":940 + * for i in range(ndim // 2): + * j = ndim - 1 - i + * strides[i], strides[j] = strides[j], strides[i] # <<<<<<<<<<<<<< + * shape[i], shape[j] = shape[j], shape[i] + * +*/ + __pyx_t_5 = (__pyx_v_strides[__pyx_v_j]); + __pyx_t_6 = (__pyx_v_strides[__pyx_v_i]); + (__pyx_v_strides[__pyx_v_i]) = __pyx_t_5; + (__pyx_v_strides[__pyx_v_j]) = __pyx_t_6; + + /* "View.MemoryView":941 + * j = ndim - 1 - i + * strides[i], strides[j] = strides[j], strides[i] + * shape[i], shape[j] = shape[j], shape[i] # <<<<<<<<<<<<<< + * + * if memslice.suboffsets[i] >= 0 or memslice.suboffsets[j] >= 0: +*/ + __pyx_t_6 = (__pyx_v_shape[__pyx_v_j]); + __pyx_t_5 = (__pyx_v_shape[__pyx_v_i]); + (__pyx_v_shape[__pyx_v_i]) = __pyx_t_6; + (__pyx_v_shape[__pyx_v_j]) = __pyx_t_5; + + /* "View.MemoryView":943 + * shape[i], shape[j] = shape[j], shape[i] + * + * if memslice.suboffsets[i] >= 0 or memslice.suboffsets[j] >= 0: # <<<<<<<<<<<<<< + * _err(PyExc_ValueError, "Cannot transpose memoryview with indirect dimensions") + * +*/ + __pyx_t_8 = ((__pyx_v_memslice->suboffsets[__pyx_v_i]) >= 0); + if (!__pyx_t_8) { + } else { + __pyx_t_7 = __pyx_t_8; + goto __pyx_L6_bool_binop_done; + } + __pyx_t_8 = ((__pyx_v_memslice->suboffsets[__pyx_v_j]) >= 0); + __pyx_t_7 = __pyx_t_8; + __pyx_L6_bool_binop_done:; + if (__pyx_t_7) { + + /* "View.MemoryView":944 + * + * if memslice.suboffsets[i] >= 0 or memslice.suboffsets[j] >= 0: + * _err(PyExc_ValueError, "Cannot transpose memoryview with indirect dimensions") # <<<<<<<<<<<<<< + * + * return 0 +*/ + __pyx_t_9 = __pyx_memoryview_err(PyExc_ValueError, __pyx_mstate_global->__pyx_kp_u_Cannot_transpose_memoryview_with); if (unlikely(__pyx_t_9 == ((int)-1))) __PYX_ERR(1, 944, __pyx_L1_error) + + /* "View.MemoryView":943 + * shape[i], shape[j] = shape[j], shape[i] + * + * if memslice.suboffsets[i] >= 0 or memslice.suboffsets[j] >= 0: # <<<<<<<<<<<<<< + * _err(PyExc_ValueError, "Cannot transpose memoryview with indirect dimensions") + * +*/ + } + } + + /* "View.MemoryView":946 + * _err(PyExc_ValueError, "Cannot transpose memoryview with indirect dimensions") + * + * return 0 # <<<<<<<<<<<<<< + * + * +*/ + __pyx_r = 0; + goto __pyx_L0; + + /* "View.MemoryView":929 + * + * + * @cname('__pyx_memslice_transpose') # <<<<<<<<<<<<<< + * cdef int transpose_memslice(__Pyx_memviewslice *memslice) except -1 nogil: + * cdef int ndim = memslice.memview.view.ndim +*/ + + /* function exit code */ + __pyx_L1_error:; + __pyx_gilstate_save = __Pyx_PyGILState_Ensure(); + __Pyx_AddTraceback("View.MemoryView.transpose_memslice", __pyx_clineno, __pyx_lineno, __pyx_filename); + __pyx_r = -1; + __Pyx_PyGILState_Release(__pyx_gilstate_save); + __pyx_L0:; + return __pyx_r; +} + +/* "View.MemoryView":964 + * cdef int (*to_dtype_func)(char *, object) except 0 + * + * def __dealloc__(self): # <<<<<<<<<<<<<< + * __PYX_XCLEAR_MEMVIEW(&self.from_slice, 1) + * +*/ + +/* Python wrapper */ +static void __pyx_memoryviewslice___dealloc__(PyObject *__pyx_v_self); /*proto*/ +static void __pyx_memoryviewslice___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_memoryviewslice___pyx_pf_15View_dot_MemoryView_16_memoryviewslice___dealloc__(((struct __pyx_memoryviewslice_obj *)__pyx_v_self)); + + /* function exit code */ + __Pyx_RefNannyFinishContext(); +} + +static void __pyx_memoryviewslice___pyx_pf_15View_dot_MemoryView_16_memoryviewslice___dealloc__(struct __pyx_memoryviewslice_obj *__pyx_v_self) { + + /* "View.MemoryView":965 + * + * def __dealloc__(self): + * __PYX_XCLEAR_MEMVIEW(&self.from_slice, 1) # <<<<<<<<<<<<<< + * + * cdef convert_item_to_object(self, char *itemp): +*/ + __PYX_XCLEAR_MEMVIEW((&__pyx_v_self->from_slice), 1); + + /* "View.MemoryView":964 + * cdef int (*to_dtype_func)(char *, object) except 0 + * + * def __dealloc__(self): # <<<<<<<<<<<<<< + * __PYX_XCLEAR_MEMVIEW(&self.from_slice, 1) + * +*/ + + /* function exit code */ +} + +/* "View.MemoryView":967 + * __PYX_XCLEAR_MEMVIEW(&self.from_slice, 1) + * + * cdef convert_item_to_object(self, char *itemp): # <<<<<<<<<<<<<< + * if self.to_object_func != NULL: + * return self.to_object_func(itemp) +*/ + +static PyObject *__pyx_memoryviewslice_convert_item_to_object(struct __pyx_memoryviewslice_obj *__pyx_v_self, char *__pyx_v_itemp) { + 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("convert_item_to_object", 0); + + /* "View.MemoryView":968 + * + * cdef convert_item_to_object(self, char *itemp): + * if self.to_object_func != NULL: # <<<<<<<<<<<<<< + * return self.to_object_func(itemp) + * else: +*/ + __pyx_t_1 = (__pyx_v_self->to_object_func != NULL); + if (__pyx_t_1) { + + /* "View.MemoryView":969 + * cdef convert_item_to_object(self, char *itemp): + * if self.to_object_func != NULL: + * return self.to_object_func(itemp) # <<<<<<<<<<<<<< + * else: + * return memoryview.convert_item_to_object(self, itemp) +*/ + __Pyx_XDECREF(__pyx_r); + __pyx_t_2 = __pyx_v_self->to_object_func(__pyx_v_itemp); if (unlikely(!__pyx_t_2)) __PYX_ERR(1, 969, __pyx_L1_error) + __Pyx_GOTREF(__pyx_t_2); + __pyx_r = __pyx_t_2; + __pyx_t_2 = 0; + goto __pyx_L0; + + /* "View.MemoryView":968 + * + * cdef convert_item_to_object(self, char *itemp): + * if self.to_object_func != NULL: # <<<<<<<<<<<<<< + * return self.to_object_func(itemp) + * else: +*/ + } + + /* "View.MemoryView":971 + * return self.to_object_func(itemp) + * else: + * return memoryview.convert_item_to_object(self, itemp) # <<<<<<<<<<<<<< + * + * cdef assign_item_from_object(self, char *itemp, object value): +*/ + /*else*/ { + __Pyx_XDECREF(__pyx_r); + __pyx_t_2 = __pyx_memoryview_convert_item_to_object(((struct __pyx_memoryview_obj *)__pyx_v_self), __pyx_v_itemp); if (unlikely(!__pyx_t_2)) __PYX_ERR(1, 971, __pyx_L1_error) + __Pyx_GOTREF(__pyx_t_2); + __pyx_r = __pyx_t_2; + __pyx_t_2 = 0; + goto __pyx_L0; + } + + /* "View.MemoryView":967 + * __PYX_XCLEAR_MEMVIEW(&self.from_slice, 1) + * + * cdef convert_item_to_object(self, char *itemp): # <<<<<<<<<<<<<< + * if self.to_object_func != NULL: + * return self.to_object_func(itemp) +*/ + + /* function exit code */ + __pyx_L1_error:; + __Pyx_XDECREF(__pyx_t_2); + __Pyx_AddTraceback("View.MemoryView._memoryviewslice.convert_item_to_object", __pyx_clineno, __pyx_lineno, __pyx_filename); + __pyx_r = 0; + __pyx_L0:; + __Pyx_XGIVEREF(__pyx_r); + __Pyx_RefNannyFinishContext(); + return __pyx_r; +} + +/* "View.MemoryView":973 + * return memoryview.convert_item_to_object(self, itemp) + * + * cdef assign_item_from_object(self, char *itemp, object value): # <<<<<<<<<<<<<< + * if self.to_dtype_func != NULL: + * self.to_dtype_func(itemp, value) +*/ + +static PyObject *__pyx_memoryviewslice_assign_item_from_object(struct __pyx_memoryviewslice_obj *__pyx_v_self, char *__pyx_v_itemp, PyObject *__pyx_v_value) { + PyObject *__pyx_r = NULL; + __Pyx_RefNannyDeclarations + int __pyx_t_1; + int __pyx_t_2; + PyObject *__pyx_t_3 = NULL; + int __pyx_lineno = 0; + const char *__pyx_filename = NULL; + int __pyx_clineno = 0; + __Pyx_RefNannySetupContext("assign_item_from_object", 0); + + /* "View.MemoryView":974 + * + * cdef assign_item_from_object(self, char *itemp, object value): + * if self.to_dtype_func != NULL: # <<<<<<<<<<<<<< + * self.to_dtype_func(itemp, value) + * else: +*/ + __pyx_t_1 = (__pyx_v_self->to_dtype_func != NULL); + if (__pyx_t_1) { + + /* "View.MemoryView":975 + * cdef assign_item_from_object(self, char *itemp, object value): + * if self.to_dtype_func != NULL: + * self.to_dtype_func(itemp, value) # <<<<<<<<<<<<<< + * else: + * memoryview.assign_item_from_object(self, itemp, value) +*/ + __pyx_t_2 = __pyx_v_self->to_dtype_func(__pyx_v_itemp, __pyx_v_value); if (unlikely(__pyx_t_2 == ((int)0))) __PYX_ERR(1, 975, __pyx_L1_error) + + /* "View.MemoryView":974 + * + * cdef assign_item_from_object(self, char *itemp, object value): + * if self.to_dtype_func != NULL: # <<<<<<<<<<<<<< + * self.to_dtype_func(itemp, value) + * else: +*/ + goto __pyx_L3; + } + + /* "View.MemoryView":977 + * self.to_dtype_func(itemp, value) + * else: + * memoryview.assign_item_from_object(self, itemp, value) # <<<<<<<<<<<<<< + * + * cdef _get_base(self): +*/ + /*else*/ { + __pyx_t_3 = __pyx_memoryview_assign_item_from_object(((struct __pyx_memoryview_obj *)__pyx_v_self), __pyx_v_itemp, __pyx_v_value); if (unlikely(!__pyx_t_3)) __PYX_ERR(1, 977, __pyx_L1_error) + __Pyx_GOTREF(__pyx_t_3); + __Pyx_DECREF(__pyx_t_3); __pyx_t_3 = 0; + } + __pyx_L3:; + + /* "View.MemoryView":973 + * return memoryview.convert_item_to_object(self, itemp) + * + * cdef assign_item_from_object(self, char *itemp, object value): # <<<<<<<<<<<<<< + * if self.to_dtype_func != NULL: + * self.to_dtype_func(itemp, value) +*/ + + /* function exit code */ + __pyx_r = Py_None; __Pyx_INCREF(Py_None); + goto __pyx_L0; + __pyx_L1_error:; + __Pyx_XDECREF(__pyx_t_3); + __Pyx_AddTraceback("View.MemoryView._memoryviewslice.assign_item_from_object", __pyx_clineno, __pyx_lineno, __pyx_filename); + __pyx_r = 0; + __pyx_L0:; + __Pyx_XGIVEREF(__pyx_r); + __Pyx_RefNannyFinishContext(); + return __pyx_r; +} + +/* "View.MemoryView":979 + * memoryview.assign_item_from_object(self, itemp, value) + * + * cdef _get_base(self): # <<<<<<<<<<<<<< + * return self.from_object + * +*/ + +static PyObject *__pyx_memoryviewslice__get_base(struct __pyx_memoryviewslice_obj *__pyx_v_self) { + PyObject *__pyx_r = NULL; + __Pyx_RefNannyDeclarations + __Pyx_RefNannySetupContext("_get_base", 0); + + /* "View.MemoryView":980 + * + * cdef _get_base(self): + * return self.from_object # <<<<<<<<<<<<<< + * + * +*/ + __Pyx_XDECREF(__pyx_r); + __Pyx_INCREF(__pyx_v_self->from_object); + __pyx_r = __pyx_v_self->from_object; + goto __pyx_L0; + + /* "View.MemoryView":979 + * memoryview.assign_item_from_object(self, itemp, value) + * + * cdef _get_base(self): # <<<<<<<<<<<<<< + * return self.from_object + * +*/ + + /* function exit code */ + __pyx_L0:; + __Pyx_XGIVEREF(__pyx_r); + __Pyx_RefNannyFinishContext(); + return __pyx_r; +} + +/* "(tree fragment)":1 + * def __reduce_cython__(self): # <<<<<<<<<<<<<< + * raise TypeError, "no default __reduce__ due to non-trivial __cinit__" + * def __setstate_cython__(self, __pyx_state): +*/ + +/* Python wrapper */ +static PyObject *__pyx_pw___pyx_memoryviewslice_1__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*/ +static PyObject *__pyx_pw___pyx_memoryviewslice_1__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___pyx_memoryviewslice___reduce_cython__(((struct __pyx_memoryviewslice_obj *)__pyx_v_self)); + + /* function exit code */ + __Pyx_RefNannyFinishContext(); + return __pyx_r; +} + +static PyObject *__pyx_pf___pyx_memoryviewslice___reduce_cython__(CYTHON_UNUSED struct __pyx_memoryviewslice_obj *__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("View.MemoryView._memoryviewslice.__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___pyx_memoryviewslice_3__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*/ +static PyObject *__pyx_pw___pyx_memoryviewslice_3__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("View.MemoryView._memoryviewslice.__setstate_cython__", __pyx_clineno, __pyx_lineno, __pyx_filename); + __Pyx_RefNannyFinishContext(); + return NULL; + __pyx_L4_argument_unpacking_done:; + __pyx_r = __pyx_pf___pyx_memoryviewslice_2__setstate_cython__(((struct __pyx_memoryviewslice_obj *)__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___pyx_memoryviewslice_2__setstate_cython__(CYTHON_UNUSED struct __pyx_memoryviewslice_obj *__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("View.MemoryView._memoryviewslice.__setstate_cython__", __pyx_clineno, __pyx_lineno, __pyx_filename); + __pyx_r = NULL; + __Pyx_XGIVEREF(__pyx_r); + __Pyx_RefNannyFinishContext(); + return __pyx_r; +} + +/* "View.MemoryView":999 + * pass # ignore failure, it's a minor issue + * + * @cname('__pyx_memoryview_fromslice') # <<<<<<<<<<<<<< + * cdef memoryview_fromslice(__Pyx_memviewslice memviewslice, + * int ndim, +*/ + +static PyObject *__pyx_memoryview_fromslice(__Pyx_memviewslice __pyx_v_memviewslice, int __pyx_v_ndim, PyObject *(*__pyx_v_to_object_func)(char *), int (*__pyx_v_to_dtype_func)(char *, PyObject *), int __pyx_v_dtype_is_object) { + struct __pyx_memoryviewslice_obj *__pyx_v_result = 0; + Py_ssize_t __pyx_v_suboffset; + PyObject *__pyx_v_length = NULL; + PyObject *__pyx_r = NULL; + __Pyx_RefNannyDeclarations + int __pyx_t_1; + PyObject *__pyx_t_2 = NULL; + PyObject *__pyx_t_3 = NULL; + __Pyx_TypeInfo const *__pyx_t_4; + Py_buffer __pyx_t_5; + Py_ssize_t *__pyx_t_6; + Py_ssize_t *__pyx_t_7; + Py_ssize_t *__pyx_t_8; + Py_ssize_t __pyx_t_9; + int __pyx_lineno = 0; + const char *__pyx_filename = NULL; + int __pyx_clineno = 0; + __Pyx_RefNannySetupContext("memoryview_fromslice", 0); + + /* "View.MemoryView":1008 + * cdef _memoryviewslice result + * + * if memviewslice.memview == Py_None: # <<<<<<<<<<<<<< + * return None + * +*/ + __pyx_t_1 = (((PyObject *)__pyx_v_memviewslice.memview) == Py_None); + if (__pyx_t_1) { + + /* "View.MemoryView":1009 + * + * if memviewslice.memview == Py_None: + * return None # <<<<<<<<<<<<<< + * + * +*/ + __Pyx_XDECREF(__pyx_r); + __pyx_r = Py_None; __Pyx_INCREF(Py_None); + goto __pyx_L0; + + /* "View.MemoryView":1008 + * cdef _memoryviewslice result + * + * if memviewslice.memview == Py_None: # <<<<<<<<<<<<<< + * return None + * +*/ + } + + /* "View.MemoryView":1014 + * + * + * result = _memoryviewslice.__new__(_memoryviewslice, None, 0, dtype_is_object) # <<<<<<<<<<<<<< + * + * result.from_slice = memviewslice +*/ + __pyx_t_2 = __Pyx_PyBool_FromLong(__pyx_v_dtype_is_object); if (unlikely(!__pyx_t_2)) __PYX_ERR(1, 1014, __pyx_L1_error) + __Pyx_GOTREF(__pyx_t_2); + __pyx_t_3 = PyTuple_New(3); if (unlikely(!__pyx_t_3)) __PYX_ERR(1, 1014, __pyx_L1_error) + __Pyx_GOTREF(__pyx_t_3); + __Pyx_INCREF(Py_None); + __Pyx_GIVEREF(Py_None); + if (__Pyx_PyTuple_SET_ITEM(__pyx_t_3, 0, Py_None) != (0)) __PYX_ERR(1, 1014, __pyx_L1_error); + __Pyx_INCREF(__pyx_mstate_global->__pyx_int_0); + __Pyx_GIVEREF(__pyx_mstate_global->__pyx_int_0); + if (__Pyx_PyTuple_SET_ITEM(__pyx_t_3, 1, __pyx_mstate_global->__pyx_int_0) != (0)) __PYX_ERR(1, 1014, __pyx_L1_error); + __Pyx_GIVEREF(__pyx_t_2); + if (__Pyx_PyTuple_SET_ITEM(__pyx_t_3, 2, __pyx_t_2) != (0)) __PYX_ERR(1, 1014, __pyx_L1_error); + __pyx_t_2 = 0; + __pyx_t_2 = ((PyObject *)__pyx_tp_new__memoryviewslice(((PyTypeObject *)__pyx_mstate_global->__pyx_memoryviewslice_type), __pyx_t_3, NULL)); if (unlikely(!__pyx_t_2)) __PYX_ERR(1, 1014, __pyx_L1_error) + __Pyx_GOTREF((PyObject *)__pyx_t_2); + __Pyx_DECREF(__pyx_t_3); __pyx_t_3 = 0; + __pyx_v_result = ((struct __pyx_memoryviewslice_obj *)__pyx_t_2); + __pyx_t_2 = 0; + + /* "View.MemoryView":1016 + * result = _memoryviewslice.__new__(_memoryviewslice, None, 0, dtype_is_object) + * + * result.from_slice = memviewslice # <<<<<<<<<<<<<< + * __PYX_INC_MEMVIEW(&memviewslice, 1) + * +*/ + __pyx_v_result->from_slice = __pyx_v_memviewslice; + + /* "View.MemoryView":1017 + * + * result.from_slice = memviewslice + * __PYX_INC_MEMVIEW(&memviewslice, 1) # <<<<<<<<<<<<<< + * + * result.from_object = ( memviewslice.memview)._get_base() +*/ + __PYX_INC_MEMVIEW((&__pyx_v_memviewslice), 1); + + /* "View.MemoryView":1019 + * __PYX_INC_MEMVIEW(&memviewslice, 1) + * + * result.from_object = ( memviewslice.memview)._get_base() # <<<<<<<<<<<<<< + * result.typeinfo = memviewslice.memview.typeinfo + * +*/ + __pyx_t_2 = ((struct __pyx_vtabstruct_memoryview *)((struct __pyx_memoryview_obj *)__pyx_v_memviewslice.memview)->__pyx_vtab)->_get_base(((struct __pyx_memoryview_obj *)__pyx_v_memviewslice.memview)); if (unlikely(!__pyx_t_2)) __PYX_ERR(1, 1019, __pyx_L1_error) + __Pyx_GOTREF(__pyx_t_2); + __Pyx_GIVEREF(__pyx_t_2); + __Pyx_GOTREF(__pyx_v_result->from_object); + __Pyx_DECREF(__pyx_v_result->from_object); + __pyx_v_result->from_object = __pyx_t_2; + __pyx_t_2 = 0; + + /* "View.MemoryView":1020 + * + * result.from_object = ( memviewslice.memview)._get_base() + * result.typeinfo = memviewslice.memview.typeinfo # <<<<<<<<<<<<<< + * + * result.view = memviewslice.memview.view +*/ + __pyx_t_4 = __pyx_v_memviewslice.memview->typeinfo; + __pyx_v_result->__pyx_base.typeinfo = __pyx_t_4; + + /* "View.MemoryView":1022 + * result.typeinfo = memviewslice.memview.typeinfo + * + * result.view = memviewslice.memview.view # <<<<<<<<<<<<<< + * result.view.buf = memviewslice.data + * result.view.ndim = ndim +*/ + __pyx_t_5 = __pyx_v_memviewslice.memview->view; + __pyx_v_result->__pyx_base.view = __pyx_t_5; + + /* "View.MemoryView":1023 + * + * result.view = memviewslice.memview.view + * result.view.buf = memviewslice.data # <<<<<<<<<<<<<< + * result.view.ndim = ndim + * (<__pyx_buffer *> &result.view).obj = Py_None +*/ + __pyx_v_result->__pyx_base.view.buf = ((void *)__pyx_v_memviewslice.data); + + /* "View.MemoryView":1024 + * result.view = memviewslice.memview.view + * result.view.buf = memviewslice.data + * result.view.ndim = ndim # <<<<<<<<<<<<<< + * (<__pyx_buffer *> &result.view).obj = Py_None + * Py_INCREF(Py_None) +*/ + __pyx_v_result->__pyx_base.view.ndim = __pyx_v_ndim; + + /* "View.MemoryView":1025 + * result.view.buf = memviewslice.data + * result.view.ndim = ndim + * (<__pyx_buffer *> &result.view).obj = Py_None # <<<<<<<<<<<<<< + * Py_INCREF(Py_None) + * +*/ + ((Py_buffer *)(&__pyx_v_result->__pyx_base.view))->obj = Py_None; + + /* "View.MemoryView":1026 + * result.view.ndim = ndim + * (<__pyx_buffer *> &result.view).obj = Py_None + * Py_INCREF(Py_None) # <<<<<<<<<<<<<< + * + * if (memviewslice.memview).flags & PyBUF_WRITABLE: +*/ + Py_INCREF(Py_None); + + /* "View.MemoryView":1028 + * Py_INCREF(Py_None) + * + * if (memviewslice.memview).flags & PyBUF_WRITABLE: # <<<<<<<<<<<<<< + * result.flags = PyBUF_RECORDS + * else: +*/ + __pyx_t_1 = ((((struct __pyx_memoryview_obj *)__pyx_v_memviewslice.memview)->flags & PyBUF_WRITABLE) != 0); + if (__pyx_t_1) { + + /* "View.MemoryView":1029 + * + * if (memviewslice.memview).flags & PyBUF_WRITABLE: + * result.flags = PyBUF_RECORDS # <<<<<<<<<<<<<< + * else: + * result.flags = PyBUF_RECORDS_RO +*/ + __pyx_v_result->__pyx_base.flags = PyBUF_RECORDS; + + /* "View.MemoryView":1028 + * Py_INCREF(Py_None) + * + * if (memviewslice.memview).flags & PyBUF_WRITABLE: # <<<<<<<<<<<<<< + * result.flags = PyBUF_RECORDS + * else: +*/ + goto __pyx_L4; + } + + /* "View.MemoryView":1031 + * result.flags = PyBUF_RECORDS + * else: + * result.flags = PyBUF_RECORDS_RO # <<<<<<<<<<<<<< + * + * result.view.shape = result.from_slice.shape +*/ + /*else*/ { + __pyx_v_result->__pyx_base.flags = PyBUF_RECORDS_RO; + } + __pyx_L4:; + + /* "View.MemoryView":1033 + * result.flags = PyBUF_RECORDS_RO + * + * result.view.shape = result.from_slice.shape # <<<<<<<<<<<<<< + * result.view.strides = result.from_slice.strides + * +*/ + __pyx_v_result->__pyx_base.view.shape = ((Py_ssize_t *)__pyx_v_result->from_slice.shape); + + /* "View.MemoryView":1034 + * + * result.view.shape = result.from_slice.shape + * result.view.strides = result.from_slice.strides # <<<<<<<<<<<<<< + * + * +*/ + __pyx_v_result->__pyx_base.view.strides = ((Py_ssize_t *)__pyx_v_result->from_slice.strides); + + /* "View.MemoryView":1037 + * + * + * result.view.suboffsets = NULL # <<<<<<<<<<<<<< + * for suboffset in result.from_slice.suboffsets[:ndim]: + * if suboffset >= 0: +*/ + __pyx_v_result->__pyx_base.view.suboffsets = NULL; + + /* "View.MemoryView":1038 + * + * result.view.suboffsets = NULL + * for suboffset in result.from_slice.suboffsets[:ndim]: # <<<<<<<<<<<<<< + * if suboffset >= 0: + * result.view.suboffsets = result.from_slice.suboffsets +*/ + __pyx_t_7 = (__pyx_v_result->from_slice.suboffsets + __pyx_v_ndim); + for (__pyx_t_8 = __pyx_v_result->from_slice.suboffsets; __pyx_t_8 < __pyx_t_7; __pyx_t_8++) { + __pyx_t_6 = __pyx_t_8; + __pyx_v_suboffset = (__pyx_t_6[0]); + + /* "View.MemoryView":1039 + * result.view.suboffsets = NULL + * for suboffset in result.from_slice.suboffsets[:ndim]: + * if suboffset >= 0: # <<<<<<<<<<<<<< + * result.view.suboffsets = result.from_slice.suboffsets + * break +*/ + __pyx_t_1 = (__pyx_v_suboffset >= 0); + if (__pyx_t_1) { + + /* "View.MemoryView":1040 + * for suboffset in result.from_slice.suboffsets[:ndim]: + * if suboffset >= 0: + * result.view.suboffsets = result.from_slice.suboffsets # <<<<<<<<<<<<<< + * break + * +*/ + __pyx_v_result->__pyx_base.view.suboffsets = ((Py_ssize_t *)__pyx_v_result->from_slice.suboffsets); + + /* "View.MemoryView":1041 + * if suboffset >= 0: + * result.view.suboffsets = result.from_slice.suboffsets + * break # <<<<<<<<<<<<<< + * + * result.view.len = result.view.itemsize +*/ + goto __pyx_L6_break; + + /* "View.MemoryView":1039 + * result.view.suboffsets = NULL + * for suboffset in result.from_slice.suboffsets[:ndim]: + * if suboffset >= 0: # <<<<<<<<<<<<<< + * result.view.suboffsets = result.from_slice.suboffsets + * break +*/ + } + } + __pyx_L6_break:; + + /* "View.MemoryView":1043 + * break + * + * result.view.len = result.view.itemsize # <<<<<<<<<<<<<< + * for length in result.view.shape[:ndim]: + * result.view.len *= length +*/ + __pyx_t_9 = __pyx_v_result->__pyx_base.view.itemsize; + __pyx_v_result->__pyx_base.view.len = __pyx_t_9; + + /* "View.MemoryView":1044 + * + * result.view.len = result.view.itemsize + * for length in result.view.shape[:ndim]: # <<<<<<<<<<<<<< + * result.view.len *= length + * +*/ + __pyx_t_7 = (__pyx_v_result->__pyx_base.view.shape + __pyx_v_ndim); + for (__pyx_t_8 = __pyx_v_result->__pyx_base.view.shape; __pyx_t_8 < __pyx_t_7; __pyx_t_8++) { + __pyx_t_6 = __pyx_t_8; + __pyx_t_2 = PyLong_FromSsize_t((__pyx_t_6[0])); if (unlikely(!__pyx_t_2)) __PYX_ERR(1, 1044, __pyx_L1_error) + __Pyx_GOTREF(__pyx_t_2); + __Pyx_XDECREF_SET(__pyx_v_length, __pyx_t_2); + __pyx_t_2 = 0; + + /* "View.MemoryView":1045 + * result.view.len = result.view.itemsize + * for length in result.view.shape[:ndim]: + * result.view.len *= length # <<<<<<<<<<<<<< + * + * result.to_object_func = to_object_func +*/ + __pyx_t_2 = PyLong_FromSsize_t(__pyx_v_result->__pyx_base.view.len); if (unlikely(!__pyx_t_2)) __PYX_ERR(1, 1045, __pyx_L1_error) + __Pyx_GOTREF(__pyx_t_2); + __pyx_t_3 = PyNumber_InPlaceMultiply(__pyx_t_2, __pyx_v_length); if (unlikely(!__pyx_t_3)) __PYX_ERR(1, 1045, __pyx_L1_error) + __Pyx_GOTREF(__pyx_t_3); + __Pyx_DECREF(__pyx_t_2); __pyx_t_2 = 0; + __pyx_t_9 = __Pyx_PyIndex_AsSsize_t(__pyx_t_3); if (unlikely((__pyx_t_9 == (Py_ssize_t)-1) && PyErr_Occurred())) __PYX_ERR(1, 1045, __pyx_L1_error) + __Pyx_DECREF(__pyx_t_3); __pyx_t_3 = 0; + __pyx_v_result->__pyx_base.view.len = __pyx_t_9; + } + + /* "View.MemoryView":1047 + * result.view.len *= length + * + * result.to_object_func = to_object_func # <<<<<<<<<<<<<< + * result.to_dtype_func = to_dtype_func + * +*/ + __pyx_v_result->to_object_func = __pyx_v_to_object_func; + + /* "View.MemoryView":1048 + * + * result.to_object_func = to_object_func + * result.to_dtype_func = to_dtype_func # <<<<<<<<<<<<<< + * + * return result +*/ + __pyx_v_result->to_dtype_func = __pyx_v_to_dtype_func; + + /* "View.MemoryView":1050 + * result.to_dtype_func = to_dtype_func + * + * return result # <<<<<<<<<<<<<< + * + * @cname('__pyx_memoryview_get_slice_from_memoryview') +*/ + __Pyx_XDECREF(__pyx_r); + __Pyx_INCREF((PyObject *)__pyx_v_result); + __pyx_r = ((PyObject *)__pyx_v_result); + goto __pyx_L0; + + /* "View.MemoryView":999 + * pass # ignore failure, it's a minor issue + * + * @cname('__pyx_memoryview_fromslice') # <<<<<<<<<<<<<< + * cdef memoryview_fromslice(__Pyx_memviewslice memviewslice, + * int ndim, +*/ + + /* function exit code */ + __pyx_L1_error:; + __Pyx_XDECREF(__pyx_t_2); + __Pyx_XDECREF(__pyx_t_3); + __Pyx_AddTraceback("View.MemoryView.memoryview_fromslice", __pyx_clineno, __pyx_lineno, __pyx_filename); + __pyx_r = 0; + __pyx_L0:; + __Pyx_XDECREF((PyObject *)__pyx_v_result); + __Pyx_XDECREF(__pyx_v_length); + __Pyx_XGIVEREF(__pyx_r); + __Pyx_RefNannyFinishContext(); + return __pyx_r; +} + +/* "View.MemoryView":1052 + * return result + * + * @cname('__pyx_memoryview_get_slice_from_memoryview') # <<<<<<<<<<<<<< + * cdef __Pyx_memviewslice *get_slice_from_memview(memoryview memview, + * __Pyx_memviewslice *mslice) except NULL: +*/ + +static __Pyx_memviewslice *__pyx_memoryview_get_slice_from_memoryview(struct __pyx_memoryview_obj *__pyx_v_memview, __Pyx_memviewslice *__pyx_v_mslice) { + struct __pyx_memoryviewslice_obj *__pyx_v_obj = 0; + __Pyx_memviewslice *__pyx_r; + __Pyx_RefNannyDeclarations + int __pyx_t_1; + PyObject *__pyx_t_2 = NULL; + int __pyx_lineno = 0; + const char *__pyx_filename = NULL; + int __pyx_clineno = 0; + __Pyx_RefNannySetupContext("get_slice_from_memview", 0); + + /* "View.MemoryView":1056 + * __Pyx_memviewslice *mslice) except NULL: + * cdef _memoryviewslice obj + * if isinstance(memview, _memoryviewslice): # <<<<<<<<<<<<<< + * obj = memview + * return &obj.from_slice +*/ + __pyx_t_1 = __Pyx_TypeCheck(((PyObject *)__pyx_v_memview), __pyx_mstate_global->__pyx_memoryviewslice_type); + if (__pyx_t_1) { + + /* "View.MemoryView":1057 + * cdef _memoryviewslice obj + * if isinstance(memview, _memoryviewslice): + * obj = memview # <<<<<<<<<<<<<< + * return &obj.from_slice + * else: +*/ + __pyx_t_2 = ((PyObject *)__pyx_v_memview); + __Pyx_INCREF(__pyx_t_2); + if (!(likely(((__pyx_t_2) == Py_None) || likely(__Pyx_TypeTest(__pyx_t_2, __pyx_mstate_global->__pyx_memoryviewslice_type))))) __PYX_ERR(1, 1057, __pyx_L1_error) + __pyx_v_obj = ((struct __pyx_memoryviewslice_obj *)__pyx_t_2); + __pyx_t_2 = 0; + + /* "View.MemoryView":1058 + * if isinstance(memview, _memoryviewslice): + * obj = memview + * return &obj.from_slice # <<<<<<<<<<<<<< + * else: + * slice_copy(memview, mslice) +*/ + __pyx_r = (&__pyx_v_obj->from_slice); + goto __pyx_L0; + + /* "View.MemoryView":1056 + * __Pyx_memviewslice *mslice) except NULL: + * cdef _memoryviewslice obj + * if isinstance(memview, _memoryviewslice): # <<<<<<<<<<<<<< + * obj = memview + * return &obj.from_slice +*/ + } + + /* "View.MemoryView":1060 + * return &obj.from_slice + * else: + * slice_copy(memview, mslice) # <<<<<<<<<<<<<< + * return mslice + * +*/ + /*else*/ { + __pyx_memoryview_slice_copy(__pyx_v_memview, __pyx_v_mslice); + + /* "View.MemoryView":1061 + * else: + * slice_copy(memview, mslice) + * return mslice # <<<<<<<<<<<<<< + * + * @cname('__pyx_memoryview_slice_copy') +*/ + __pyx_r = __pyx_v_mslice; + goto __pyx_L0; + } + + /* "View.MemoryView":1052 + * return result + * + * @cname('__pyx_memoryview_get_slice_from_memoryview') # <<<<<<<<<<<<<< + * cdef __Pyx_memviewslice *get_slice_from_memview(memoryview memview, + * __Pyx_memviewslice *mslice) except NULL: +*/ + + /* function exit code */ + __pyx_L1_error:; + __Pyx_XDECREF(__pyx_t_2); + __Pyx_AddTraceback("View.MemoryView.get_slice_from_memview", __pyx_clineno, __pyx_lineno, __pyx_filename); + __pyx_r = NULL; + __pyx_L0:; + __Pyx_XDECREF((PyObject *)__pyx_v_obj); + __Pyx_RefNannyFinishContext(); + return __pyx_r; +} + +/* "View.MemoryView":1063 + * return mslice + * + * @cname('__pyx_memoryview_slice_copy') # <<<<<<<<<<<<<< + * cdef void slice_copy(memoryview memview, __Pyx_memviewslice *dst) noexcept: + * cdef int dim +*/ + +static void __pyx_memoryview_slice_copy(struct __pyx_memoryview_obj *__pyx_v_memview, __Pyx_memviewslice *__pyx_v_dst) { + int __pyx_v_dim; + Py_ssize_t *__pyx_v_shape; + Py_ssize_t *__pyx_v_strides; + Py_ssize_t *__pyx_v_suboffsets; + Py_ssize_t *__pyx_t_1; + int __pyx_t_2; + int __pyx_t_3; + int __pyx_t_4; + Py_ssize_t __pyx_t_5; + int __pyx_t_6; + + /* "View.MemoryView":1068 + * cdef (Py_ssize_t*) shape, strides, suboffsets + * + * shape = memview.view.shape # <<<<<<<<<<<<<< + * strides = memview.view.strides + * suboffsets = memview.view.suboffsets +*/ + __pyx_t_1 = __pyx_v_memview->view.shape; + __pyx_v_shape = __pyx_t_1; + + /* "View.MemoryView":1069 + * + * shape = memview.view.shape + * strides = memview.view.strides # <<<<<<<<<<<<<< + * suboffsets = memview.view.suboffsets + * +*/ + __pyx_t_1 = __pyx_v_memview->view.strides; + __pyx_v_strides = __pyx_t_1; + + /* "View.MemoryView":1070 + * shape = memview.view.shape + * strides = memview.view.strides + * suboffsets = memview.view.suboffsets # <<<<<<<<<<<<<< + * + * dst.memview = <__pyx_memoryview *> memview +*/ + __pyx_t_1 = __pyx_v_memview->view.suboffsets; + __pyx_v_suboffsets = __pyx_t_1; + + /* "View.MemoryView":1072 + * suboffsets = memview.view.suboffsets + * + * dst.memview = <__pyx_memoryview *> memview # <<<<<<<<<<<<<< + * dst.data = memview.view.buf + * +*/ + __pyx_v_dst->memview = ((struct __pyx_memoryview_obj *)__pyx_v_memview); + + /* "View.MemoryView":1073 + * + * dst.memview = <__pyx_memoryview *> memview + * dst.data = memview.view.buf # <<<<<<<<<<<<<< + * + * for dim in range(memview.view.ndim): +*/ + __pyx_v_dst->data = ((char *)__pyx_v_memview->view.buf); + + /* "View.MemoryView":1075 + * dst.data = memview.view.buf + * + * for dim in range(memview.view.ndim): # <<<<<<<<<<<<<< + * dst.shape[dim] = shape[dim] + * dst.strides[dim] = strides[dim] +*/ + __pyx_t_2 = __pyx_v_memview->view.ndim; + __pyx_t_3 = __pyx_t_2; + for (__pyx_t_4 = 0; __pyx_t_4 < __pyx_t_3; __pyx_t_4+=1) { + __pyx_v_dim = __pyx_t_4; + + /* "View.MemoryView":1076 + * + * for dim in range(memview.view.ndim): + * dst.shape[dim] = shape[dim] # <<<<<<<<<<<<<< + * dst.strides[dim] = strides[dim] + * dst.suboffsets[dim] = suboffsets[dim] if suboffsets else -1 +*/ + (__pyx_v_dst->shape[__pyx_v_dim]) = (__pyx_v_shape[__pyx_v_dim]); + + /* "View.MemoryView":1077 + * for dim in range(memview.view.ndim): + * dst.shape[dim] = shape[dim] + * dst.strides[dim] = strides[dim] # <<<<<<<<<<<<<< + * dst.suboffsets[dim] = suboffsets[dim] if suboffsets else -1 + * +*/ + (__pyx_v_dst->strides[__pyx_v_dim]) = (__pyx_v_strides[__pyx_v_dim]); + + /* "View.MemoryView":1078 + * dst.shape[dim] = shape[dim] + * dst.strides[dim] = strides[dim] + * dst.suboffsets[dim] = suboffsets[dim] if suboffsets else -1 # <<<<<<<<<<<<<< + * + * @cname('__pyx_memoryview_copy_object') +*/ + __pyx_t_6 = (__pyx_v_suboffsets != 0); + if (__pyx_t_6) { + __pyx_t_5 = (__pyx_v_suboffsets[__pyx_v_dim]); + } else { + __pyx_t_5 = -1L; + } + (__pyx_v_dst->suboffsets[__pyx_v_dim]) = __pyx_t_5; + } + + /* "View.MemoryView":1063 + * return mslice + * + * @cname('__pyx_memoryview_slice_copy') # <<<<<<<<<<<<<< + * cdef void slice_copy(memoryview memview, __Pyx_memviewslice *dst) noexcept: + * cdef int dim +*/ + + /* function exit code */ +} + +/* "View.MemoryView":1080 + * dst.suboffsets[dim] = suboffsets[dim] if suboffsets else -1 + * + * @cname('__pyx_memoryview_copy_object') # <<<<<<<<<<<<<< + * cdef memoryview_copy(memoryview memview): + * "Create a new memoryview object" +*/ + +static PyObject *__pyx_memoryview_copy_object(struct __pyx_memoryview_obj *__pyx_v_memview) { + __Pyx_memviewslice __pyx_v_memviewslice; + 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("memoryview_copy", 0); + + /* "View.MemoryView":1084 + * "Create a new memoryview object" + * cdef __Pyx_memviewslice memviewslice + * slice_copy(memview, &memviewslice) # <<<<<<<<<<<<<< + * return memoryview_copy_from_slice(memview, &memviewslice) + * +*/ + __pyx_memoryview_slice_copy(__pyx_v_memview, (&__pyx_v_memviewslice)); + + /* "View.MemoryView":1085 + * cdef __Pyx_memviewslice memviewslice + * slice_copy(memview, &memviewslice) + * return memoryview_copy_from_slice(memview, &memviewslice) # <<<<<<<<<<<<<< + * + * @cname('__pyx_memoryview_copy_object_from_slice') +*/ + __Pyx_XDECREF(__pyx_r); + __pyx_t_1 = __pyx_memoryview_copy_object_from_slice(__pyx_v_memview, (&__pyx_v_memviewslice)); if (unlikely(!__pyx_t_1)) __PYX_ERR(1, 1085, __pyx_L1_error) + __Pyx_GOTREF(__pyx_t_1); + __pyx_r = __pyx_t_1; + __pyx_t_1 = 0; + goto __pyx_L0; + + /* "View.MemoryView":1080 + * dst.suboffsets[dim] = suboffsets[dim] if suboffsets else -1 + * + * @cname('__pyx_memoryview_copy_object') # <<<<<<<<<<<<<< + * cdef memoryview_copy(memoryview memview): + * "Create a new memoryview object" +*/ + + /* function exit code */ + __pyx_L1_error:; + __Pyx_XDECREF(__pyx_t_1); + __Pyx_AddTraceback("View.MemoryView.memoryview_copy", __pyx_clineno, __pyx_lineno, __pyx_filename); + __pyx_r = 0; + __pyx_L0:; + __Pyx_XGIVEREF(__pyx_r); + __Pyx_RefNannyFinishContext(); + return __pyx_r; +} + +/* "View.MemoryView":1087 + * return memoryview_copy_from_slice(memview, &memviewslice) + * + * @cname('__pyx_memoryview_copy_object_from_slice') # <<<<<<<<<<<<<< + * cdef memoryview_copy_from_slice(memoryview memview, __Pyx_memviewslice *memviewslice): + * """ +*/ + +static PyObject *__pyx_memoryview_copy_object_from_slice(struct __pyx_memoryview_obj *__pyx_v_memview, __Pyx_memviewslice *__pyx_v_memviewslice) { + PyObject *(*__pyx_v_to_object_func)(char *); + int (*__pyx_v_to_dtype_func)(char *, PyObject *); + PyObject *__pyx_r = NULL; + __Pyx_RefNannyDeclarations + int __pyx_t_1; + PyObject *(*__pyx_t_2)(char *); + int (*__pyx_t_3)(char *, PyObject *); + PyObject *__pyx_t_4 = NULL; + int __pyx_lineno = 0; + const char *__pyx_filename = NULL; + int __pyx_clineno = 0; + __Pyx_RefNannySetupContext("memoryview_copy_from_slice", 0); + + /* "View.MemoryView":1095 + * cdef int (*to_dtype_func)(char *, object) except 0 + * + * if isinstance(memview, _memoryviewslice): # <<<<<<<<<<<<<< + * to_object_func = (<_memoryviewslice> memview).to_object_func + * to_dtype_func = (<_memoryviewslice> memview).to_dtype_func +*/ + __pyx_t_1 = __Pyx_TypeCheck(((PyObject *)__pyx_v_memview), __pyx_mstate_global->__pyx_memoryviewslice_type); + if (__pyx_t_1) { + + /* "View.MemoryView":1096 + * + * if isinstance(memview, _memoryviewslice): + * to_object_func = (<_memoryviewslice> memview).to_object_func # <<<<<<<<<<<<<< + * to_dtype_func = (<_memoryviewslice> memview).to_dtype_func + * else: +*/ + __pyx_t_2 = ((struct __pyx_memoryviewslice_obj *)__pyx_v_memview)->to_object_func; + __pyx_v_to_object_func = __pyx_t_2; + + /* "View.MemoryView":1097 + * if isinstance(memview, _memoryviewslice): + * to_object_func = (<_memoryviewslice> memview).to_object_func + * to_dtype_func = (<_memoryviewslice> memview).to_dtype_func # <<<<<<<<<<<<<< + * else: + * to_object_func = NULL +*/ + __pyx_t_3 = ((struct __pyx_memoryviewslice_obj *)__pyx_v_memview)->to_dtype_func; + __pyx_v_to_dtype_func = __pyx_t_3; + + /* "View.MemoryView":1095 + * cdef int (*to_dtype_func)(char *, object) except 0 + * + * if isinstance(memview, _memoryviewslice): # <<<<<<<<<<<<<< + * to_object_func = (<_memoryviewslice> memview).to_object_func + * to_dtype_func = (<_memoryviewslice> memview).to_dtype_func +*/ + goto __pyx_L3; + } + + /* "View.MemoryView":1099 + * to_dtype_func = (<_memoryviewslice> memview).to_dtype_func + * else: + * to_object_func = NULL # <<<<<<<<<<<<<< + * to_dtype_func = NULL + * +*/ + /*else*/ { + __pyx_v_to_object_func = NULL; + + /* "View.MemoryView":1100 + * else: + * to_object_func = NULL + * to_dtype_func = NULL # <<<<<<<<<<<<<< + * + * return memoryview_fromslice(memviewslice[0], memview.view.ndim, +*/ + __pyx_v_to_dtype_func = NULL; + } + __pyx_L3:; + + /* "View.MemoryView":1102 + * to_dtype_func = NULL + * + * return memoryview_fromslice(memviewslice[0], memview.view.ndim, # <<<<<<<<<<<<<< + * to_object_func, to_dtype_func, + * memview.dtype_is_object) +*/ + __Pyx_XDECREF(__pyx_r); + + /* "View.MemoryView":1104 + * return memoryview_fromslice(memviewslice[0], memview.view.ndim, + * to_object_func, to_dtype_func, + * memview.dtype_is_object) # <<<<<<<<<<<<<< + * + * +*/ + __pyx_t_4 = __pyx_memoryview_fromslice((__pyx_v_memviewslice[0]), __pyx_v_memview->view.ndim, __pyx_v_to_object_func, __pyx_v_to_dtype_func, __pyx_v_memview->dtype_is_object); if (unlikely(!__pyx_t_4)) __PYX_ERR(1, 1102, __pyx_L1_error) + __Pyx_GOTREF(__pyx_t_4); + __pyx_r = __pyx_t_4; + __pyx_t_4 = 0; + goto __pyx_L0; + + /* "View.MemoryView":1087 + * return memoryview_copy_from_slice(memview, &memviewslice) + * + * @cname('__pyx_memoryview_copy_object_from_slice') # <<<<<<<<<<<<<< + * cdef memoryview_copy_from_slice(memoryview memview, __Pyx_memviewslice *memviewslice): + * """ +*/ + + /* function exit code */ + __pyx_L1_error:; + __Pyx_XDECREF(__pyx_t_4); + __Pyx_AddTraceback("View.MemoryView.memoryview_copy_from_slice", __pyx_clineno, __pyx_lineno, __pyx_filename); + __pyx_r = 0; + __pyx_L0:; + __Pyx_XGIVEREF(__pyx_r); + __Pyx_RefNannyFinishContext(); + return __pyx_r; +} + +/* "View.MemoryView":1110 + * + * + * cdef Py_ssize_t abs_py_ssize_t(Py_ssize_t arg) noexcept nogil: # <<<<<<<<<<<<<< + * return -arg if arg < 0 else arg + * +*/ + +static Py_ssize_t abs_py_ssize_t(Py_ssize_t __pyx_v_arg) { + Py_ssize_t __pyx_r; + Py_ssize_t __pyx_t_1; + int __pyx_t_2; + + /* "View.MemoryView":1111 + * + * cdef Py_ssize_t abs_py_ssize_t(Py_ssize_t arg) noexcept nogil: + * return -arg if arg < 0 else arg # <<<<<<<<<<<<<< + * + * @cname('__pyx_get_best_slice_order') +*/ + __pyx_t_2 = (__pyx_v_arg < 0); + if (__pyx_t_2) { + __pyx_t_1 = (-__pyx_v_arg); + } else { + __pyx_t_1 = __pyx_v_arg; + } + __pyx_r = __pyx_t_1; + goto __pyx_L0; + + /* "View.MemoryView":1110 + * + * + * cdef Py_ssize_t abs_py_ssize_t(Py_ssize_t arg) noexcept nogil: # <<<<<<<<<<<<<< + * return -arg if arg < 0 else arg + * +*/ + + /* function exit code */ + __pyx_L0:; + return __pyx_r; +} + +/* "View.MemoryView":1113 + * return -arg if arg < 0 else arg + * + * @cname('__pyx_get_best_slice_order') # <<<<<<<<<<<<<< + * cdef char get_best_order(__Pyx_memviewslice *mslice, int ndim) noexcept nogil: + * """ +*/ + +static char __pyx_get_best_slice_order(__Pyx_memviewslice *__pyx_v_mslice, int __pyx_v_ndim) { + int __pyx_v_i; + Py_ssize_t __pyx_v_c_stride; + Py_ssize_t __pyx_v_f_stride; + char __pyx_r; + int __pyx_t_1; + int __pyx_t_2; + int __pyx_t_3; + int __pyx_t_4; + + /* "View.MemoryView":1119 + * """ + * cdef int i + * cdef Py_ssize_t c_stride = 0 # <<<<<<<<<<<<<< + * cdef Py_ssize_t f_stride = 0 + * +*/ + __pyx_v_c_stride = 0; + + /* "View.MemoryView":1120 + * cdef int i + * cdef Py_ssize_t c_stride = 0 + * cdef Py_ssize_t f_stride = 0 # <<<<<<<<<<<<<< + * + * for i in range(ndim - 1, -1, -1): +*/ + __pyx_v_f_stride = 0; + + /* "View.MemoryView":1122 + * cdef Py_ssize_t f_stride = 0 + * + * for i in range(ndim - 1, -1, -1): # <<<<<<<<<<<<<< + * if mslice.shape[i] > 1: + * c_stride = mslice.strides[i] +*/ + for (__pyx_t_1 = (__pyx_v_ndim - 1); __pyx_t_1 > -1; __pyx_t_1-=1) { + __pyx_v_i = __pyx_t_1; + + /* "View.MemoryView":1123 + * + * for i in range(ndim - 1, -1, -1): + * if mslice.shape[i] > 1: # <<<<<<<<<<<<<< + * c_stride = mslice.strides[i] + * break +*/ + __pyx_t_2 = ((__pyx_v_mslice->shape[__pyx_v_i]) > 1); + if (__pyx_t_2) { + + /* "View.MemoryView":1124 + * for i in range(ndim - 1, -1, -1): + * if mslice.shape[i] > 1: + * c_stride = mslice.strides[i] # <<<<<<<<<<<<<< + * break + * +*/ + __pyx_v_c_stride = (__pyx_v_mslice->strides[__pyx_v_i]); + + /* "View.MemoryView":1125 + * if mslice.shape[i] > 1: + * c_stride = mslice.strides[i] + * break # <<<<<<<<<<<<<< + * + * for i in range(ndim): +*/ + goto __pyx_L4_break; + + /* "View.MemoryView":1123 + * + * for i in range(ndim - 1, -1, -1): + * if mslice.shape[i] > 1: # <<<<<<<<<<<<<< + * c_stride = mslice.strides[i] + * break +*/ + } + } + __pyx_L4_break:; + + /* "View.MemoryView":1127 + * break + * + * for i in range(ndim): # <<<<<<<<<<<<<< + * if mslice.shape[i] > 1: + * f_stride = mslice.strides[i] +*/ + __pyx_t_1 = __pyx_v_ndim; + __pyx_t_3 = __pyx_t_1; + for (__pyx_t_4 = 0; __pyx_t_4 < __pyx_t_3; __pyx_t_4+=1) { + __pyx_v_i = __pyx_t_4; + + /* "View.MemoryView":1128 + * + * for i in range(ndim): + * if mslice.shape[i] > 1: # <<<<<<<<<<<<<< + * f_stride = mslice.strides[i] + * break +*/ + __pyx_t_2 = ((__pyx_v_mslice->shape[__pyx_v_i]) > 1); + if (__pyx_t_2) { + + /* "View.MemoryView":1129 + * for i in range(ndim): + * if mslice.shape[i] > 1: + * f_stride = mslice.strides[i] # <<<<<<<<<<<<<< + * break + * +*/ + __pyx_v_f_stride = (__pyx_v_mslice->strides[__pyx_v_i]); + + /* "View.MemoryView":1130 + * if mslice.shape[i] > 1: + * f_stride = mslice.strides[i] + * break # <<<<<<<<<<<<<< + * + * if abs_py_ssize_t(c_stride) <= abs_py_ssize_t(f_stride): +*/ + goto __pyx_L7_break; + + /* "View.MemoryView":1128 + * + * for i in range(ndim): + * if mslice.shape[i] > 1: # <<<<<<<<<<<<<< + * f_stride = mslice.strides[i] + * break +*/ + } + } + __pyx_L7_break:; + + /* "View.MemoryView":1132 + * break + * + * if abs_py_ssize_t(c_stride) <= abs_py_ssize_t(f_stride): # <<<<<<<<<<<<<< + * return 'C' + * else: +*/ + __pyx_t_2 = (abs_py_ssize_t(__pyx_v_c_stride) <= abs_py_ssize_t(__pyx_v_f_stride)); + if (__pyx_t_2) { + + /* "View.MemoryView":1133 + * + * if abs_py_ssize_t(c_stride) <= abs_py_ssize_t(f_stride): + * return 'C' # <<<<<<<<<<<<<< + * else: + * return 'F' +*/ + __pyx_r = 'C'; + goto __pyx_L0; + + /* "View.MemoryView":1132 + * break + * + * if abs_py_ssize_t(c_stride) <= abs_py_ssize_t(f_stride): # <<<<<<<<<<<<<< + * return 'C' + * else: +*/ + } + + /* "View.MemoryView":1135 + * return 'C' + * else: + * return 'F' # <<<<<<<<<<<<<< + * + * @cython.cdivision(True) +*/ + /*else*/ { + __pyx_r = 'F'; + goto __pyx_L0; + } + + /* "View.MemoryView":1113 + * return -arg if arg < 0 else arg + * + * @cname('__pyx_get_best_slice_order') # <<<<<<<<<<<<<< + * cdef char get_best_order(__Pyx_memviewslice *mslice, int ndim) noexcept nogil: + * """ +*/ + + /* function exit code */ + __pyx_L0:; + return __pyx_r; +} + +/* "View.MemoryView":1137 + * return 'F' + * + * @cython.cdivision(True) # <<<<<<<<<<<<<< + * cdef void _copy_strided_to_strided(char *src_data, Py_ssize_t *src_strides, + * char *dst_data, Py_ssize_t *dst_strides, +*/ + +static void _copy_strided_to_strided(char *__pyx_v_src_data, Py_ssize_t *__pyx_v_src_strides, char *__pyx_v_dst_data, Py_ssize_t *__pyx_v_dst_strides, Py_ssize_t *__pyx_v_src_shape, Py_ssize_t *__pyx_v_dst_shape, int __pyx_v_ndim, size_t __pyx_v_itemsize) { + CYTHON_UNUSED Py_ssize_t __pyx_v_i; + CYTHON_UNUSED Py_ssize_t __pyx_v_src_extent; + Py_ssize_t __pyx_v_dst_extent; + Py_ssize_t __pyx_v_src_stride; + Py_ssize_t __pyx_v_dst_stride; + int __pyx_t_1; + int __pyx_t_2; + Py_ssize_t __pyx_t_3; + Py_ssize_t __pyx_t_4; + Py_ssize_t __pyx_t_5; + + /* "View.MemoryView":1145 + * + * cdef Py_ssize_t i + * cdef Py_ssize_t src_extent = src_shape[0] # <<<<<<<<<<<<<< + * cdef Py_ssize_t dst_extent = dst_shape[0] + * cdef Py_ssize_t src_stride = src_strides[0] +*/ + __pyx_v_src_extent = (__pyx_v_src_shape[0]); + + /* "View.MemoryView":1146 + * cdef Py_ssize_t i + * cdef Py_ssize_t src_extent = src_shape[0] + * cdef Py_ssize_t dst_extent = dst_shape[0] # <<<<<<<<<<<<<< + * cdef Py_ssize_t src_stride = src_strides[0] + * cdef Py_ssize_t dst_stride = dst_strides[0] +*/ + __pyx_v_dst_extent = (__pyx_v_dst_shape[0]); + + /* "View.MemoryView":1147 + * cdef Py_ssize_t src_extent = src_shape[0] + * cdef Py_ssize_t dst_extent = dst_shape[0] + * cdef Py_ssize_t src_stride = src_strides[0] # <<<<<<<<<<<<<< + * cdef Py_ssize_t dst_stride = dst_strides[0] + * +*/ + __pyx_v_src_stride = (__pyx_v_src_strides[0]); + + /* "View.MemoryView":1148 + * cdef Py_ssize_t dst_extent = dst_shape[0] + * cdef Py_ssize_t src_stride = src_strides[0] + * cdef Py_ssize_t dst_stride = dst_strides[0] # <<<<<<<<<<<<<< + * + * if ndim == 1: +*/ + __pyx_v_dst_stride = (__pyx_v_dst_strides[0]); + + /* "View.MemoryView":1150 + * cdef Py_ssize_t dst_stride = dst_strides[0] + * + * if ndim == 1: # <<<<<<<<<<<<<< + * if (src_stride > 0 and dst_stride > 0 and + * src_stride == itemsize == dst_stride): +*/ + __pyx_t_1 = (__pyx_v_ndim == 1); + if (__pyx_t_1) { + + /* "View.MemoryView":1151 + * + * if ndim == 1: + * if (src_stride > 0 and dst_stride > 0 and # <<<<<<<<<<<<<< + * src_stride == itemsize == dst_stride): + * memcpy(dst_data, src_data, itemsize * dst_extent) +*/ + __pyx_t_2 = (__pyx_v_src_stride > 0); + if (__pyx_t_2) { + } else { + __pyx_t_1 = __pyx_t_2; + goto __pyx_L5_bool_binop_done; + } + __pyx_t_2 = (__pyx_v_dst_stride > 0); + if (__pyx_t_2) { + } else { + __pyx_t_1 = __pyx_t_2; + goto __pyx_L5_bool_binop_done; + } + + /* "View.MemoryView":1152 + * if ndim == 1: + * if (src_stride > 0 and dst_stride > 0 and + * src_stride == itemsize == dst_stride): # <<<<<<<<<<<<<< + * memcpy(dst_data, src_data, itemsize * dst_extent) + * else: +*/ + __pyx_t_2 = (((size_t)__pyx_v_src_stride) == __pyx_v_itemsize); + if (__pyx_t_2) { + __pyx_t_2 = (__pyx_v_itemsize == ((size_t)__pyx_v_dst_stride)); + } + __pyx_t_1 = __pyx_t_2; + __pyx_L5_bool_binop_done:; + + /* "View.MemoryView":1151 + * + * if ndim == 1: + * if (src_stride > 0 and dst_stride > 0 and # <<<<<<<<<<<<<< + * src_stride == itemsize == dst_stride): + * memcpy(dst_data, src_data, itemsize * dst_extent) +*/ + if (__pyx_t_1) { + + /* "View.MemoryView":1153 + * if (src_stride > 0 and dst_stride > 0 and + * src_stride == itemsize == dst_stride): + * memcpy(dst_data, src_data, itemsize * dst_extent) # <<<<<<<<<<<<<< + * else: + * for i in range(dst_extent): +*/ + (void)(memcpy(__pyx_v_dst_data, __pyx_v_src_data, (__pyx_v_itemsize * __pyx_v_dst_extent))); + + /* "View.MemoryView":1151 + * + * if ndim == 1: + * if (src_stride > 0 and dst_stride > 0 and # <<<<<<<<<<<<<< + * src_stride == itemsize == dst_stride): + * memcpy(dst_data, src_data, itemsize * dst_extent) +*/ + goto __pyx_L4; + } + + /* "View.MemoryView":1155 + * memcpy(dst_data, src_data, itemsize * dst_extent) + * else: + * for i in range(dst_extent): # <<<<<<<<<<<<<< + * memcpy(dst_data, src_data, itemsize) + * src_data += src_stride +*/ + /*else*/ { + __pyx_t_3 = __pyx_v_dst_extent; + __pyx_t_4 = __pyx_t_3; + for (__pyx_t_5 = 0; __pyx_t_5 < __pyx_t_4; __pyx_t_5+=1) { + __pyx_v_i = __pyx_t_5; + + /* "View.MemoryView":1156 + * else: + * for i in range(dst_extent): + * memcpy(dst_data, src_data, itemsize) # <<<<<<<<<<<<<< + * src_data += src_stride + * dst_data += dst_stride +*/ + (void)(memcpy(__pyx_v_dst_data, __pyx_v_src_data, __pyx_v_itemsize)); + + /* "View.MemoryView":1157 + * for i in range(dst_extent): + * memcpy(dst_data, src_data, itemsize) + * src_data += src_stride # <<<<<<<<<<<<<< + * dst_data += dst_stride + * else: +*/ + __pyx_v_src_data = (__pyx_v_src_data + __pyx_v_src_stride); + + /* "View.MemoryView":1158 + * memcpy(dst_data, src_data, itemsize) + * src_data += src_stride + * dst_data += dst_stride # <<<<<<<<<<<<<< + * else: + * for i in range(dst_extent): +*/ + __pyx_v_dst_data = (__pyx_v_dst_data + __pyx_v_dst_stride); + } + } + __pyx_L4:; + + /* "View.MemoryView":1150 + * cdef Py_ssize_t dst_stride = dst_strides[0] + * + * if ndim == 1: # <<<<<<<<<<<<<< + * if (src_stride > 0 and dst_stride > 0 and + * src_stride == itemsize == dst_stride): +*/ + goto __pyx_L3; + } + + /* "View.MemoryView":1160 + * dst_data += dst_stride + * else: + * for i in range(dst_extent): # <<<<<<<<<<<<<< + * _copy_strided_to_strided(src_data, src_strides + 1, + * dst_data, dst_strides + 1, +*/ + /*else*/ { + __pyx_t_3 = __pyx_v_dst_extent; + __pyx_t_4 = __pyx_t_3; + for (__pyx_t_5 = 0; __pyx_t_5 < __pyx_t_4; __pyx_t_5+=1) { + __pyx_v_i = __pyx_t_5; + + /* "View.MemoryView":1161 + * else: + * for i in range(dst_extent): + * _copy_strided_to_strided(src_data, src_strides + 1, # <<<<<<<<<<<<<< + * dst_data, dst_strides + 1, + * src_shape + 1, dst_shape + 1, +*/ + _copy_strided_to_strided(__pyx_v_src_data, (__pyx_v_src_strides + 1), __pyx_v_dst_data, (__pyx_v_dst_strides + 1), (__pyx_v_src_shape + 1), (__pyx_v_dst_shape + 1), (__pyx_v_ndim - 1), __pyx_v_itemsize); + + /* "View.MemoryView":1165 + * src_shape + 1, dst_shape + 1, + * ndim - 1, itemsize) + * src_data += src_stride # <<<<<<<<<<<<<< + * dst_data += dst_stride + * +*/ + __pyx_v_src_data = (__pyx_v_src_data + __pyx_v_src_stride); + + /* "View.MemoryView":1166 + * ndim - 1, itemsize) + * src_data += src_stride + * dst_data += dst_stride # <<<<<<<<<<<<<< + * + * cdef void copy_strided_to_strided(__Pyx_memviewslice *src, +*/ + __pyx_v_dst_data = (__pyx_v_dst_data + __pyx_v_dst_stride); + } + } + __pyx_L3:; + + /* "View.MemoryView":1137 + * return 'F' + * + * @cython.cdivision(True) # <<<<<<<<<<<<<< + * cdef void _copy_strided_to_strided(char *src_data, Py_ssize_t *src_strides, + * char *dst_data, Py_ssize_t *dst_strides, +*/ + + /* function exit code */ +} + +/* "View.MemoryView":1168 + * dst_data += dst_stride + * + * cdef void copy_strided_to_strided(__Pyx_memviewslice *src, # <<<<<<<<<<<<<< + * __Pyx_memviewslice *dst, + * int ndim, size_t itemsize) noexcept nogil: +*/ + +static void copy_strided_to_strided(__Pyx_memviewslice *__pyx_v_src, __Pyx_memviewslice *__pyx_v_dst, int __pyx_v_ndim, size_t __pyx_v_itemsize) { + + /* "View.MemoryView":1171 + * __Pyx_memviewslice *dst, + * int ndim, size_t itemsize) noexcept nogil: + * _copy_strided_to_strided(src.data, src.strides, dst.data, dst.strides, # <<<<<<<<<<<<<< + * src.shape, dst.shape, ndim, itemsize) + * +*/ + _copy_strided_to_strided(__pyx_v_src->data, __pyx_v_src->strides, __pyx_v_dst->data, __pyx_v_dst->strides, __pyx_v_src->shape, __pyx_v_dst->shape, __pyx_v_ndim, __pyx_v_itemsize); + + /* "View.MemoryView":1168 + * dst_data += dst_stride + * + * cdef void copy_strided_to_strided(__Pyx_memviewslice *src, # <<<<<<<<<<<<<< + * __Pyx_memviewslice *dst, + * int ndim, size_t itemsize) noexcept nogil: +*/ + + /* function exit code */ +} + +/* "View.MemoryView":1174 + * src.shape, dst.shape, ndim, itemsize) + * + * @cname('__pyx_memoryview_slice_get_size') # <<<<<<<<<<<<<< + * cdef Py_ssize_t slice_get_size(__Pyx_memviewslice *src, int ndim) noexcept nogil: + * "Return the size of the memory occupied by the slice in number of bytes" +*/ + +static Py_ssize_t __pyx_memoryview_slice_get_size(__Pyx_memviewslice *__pyx_v_src, int __pyx_v_ndim) { + Py_ssize_t __pyx_v_shape; + Py_ssize_t __pyx_v_size; + Py_ssize_t __pyx_r; + Py_ssize_t __pyx_t_1; + Py_ssize_t *__pyx_t_2; + Py_ssize_t *__pyx_t_3; + Py_ssize_t *__pyx_t_4; + + /* "View.MemoryView":1177 + * cdef Py_ssize_t slice_get_size(__Pyx_memviewslice *src, int ndim) noexcept nogil: + * "Return the size of the memory occupied by the slice in number of bytes" + * cdef Py_ssize_t shape, size = src.memview.view.itemsize # <<<<<<<<<<<<<< + * + * for shape in src.shape[:ndim]: +*/ + __pyx_t_1 = __pyx_v_src->memview->view.itemsize; + __pyx_v_size = __pyx_t_1; + + /* "View.MemoryView":1179 + * cdef Py_ssize_t shape, size = src.memview.view.itemsize + * + * for shape in src.shape[:ndim]: # <<<<<<<<<<<<<< + * size *= shape + * +*/ + __pyx_t_3 = (__pyx_v_src->shape + __pyx_v_ndim); + for (__pyx_t_4 = __pyx_v_src->shape; __pyx_t_4 < __pyx_t_3; __pyx_t_4++) { + __pyx_t_2 = __pyx_t_4; + __pyx_v_shape = (__pyx_t_2[0]); + + /* "View.MemoryView":1180 + * + * for shape in src.shape[:ndim]: + * size *= shape # <<<<<<<<<<<<<< + * + * return size +*/ + __pyx_v_size = (__pyx_v_size * __pyx_v_shape); + } + + /* "View.MemoryView":1182 + * size *= shape + * + * return size # <<<<<<<<<<<<<< + * + * @cname('__pyx_fill_contig_strides_array') +*/ + __pyx_r = __pyx_v_size; + goto __pyx_L0; + + /* "View.MemoryView":1174 + * src.shape, dst.shape, ndim, itemsize) + * + * @cname('__pyx_memoryview_slice_get_size') # <<<<<<<<<<<<<< + * cdef Py_ssize_t slice_get_size(__Pyx_memviewslice *src, int ndim) noexcept nogil: + * "Return the size of the memory occupied by the slice in number of bytes" +*/ + + /* function exit code */ + __pyx_L0:; + return __pyx_r; +} + +/* "View.MemoryView":1184 + * return size + * + * @cname('__pyx_fill_contig_strides_array') # <<<<<<<<<<<<<< + * cdef Py_ssize_t fill_contig_strides_array( + * Py_ssize_t *shape, Py_ssize_t *strides, Py_ssize_t stride, +*/ + +static Py_ssize_t __pyx_fill_contig_strides_array(Py_ssize_t *__pyx_v_shape, Py_ssize_t *__pyx_v_strides, Py_ssize_t __pyx_v_stride, int __pyx_v_ndim, char __pyx_v_order) { + int __pyx_v_idx; + Py_ssize_t __pyx_r; + int __pyx_t_1; + int __pyx_t_2; + int __pyx_t_3; + int __pyx_t_4; + + /* "View.MemoryView":1194 + * cdef int idx + * + * if order == 'F': # <<<<<<<<<<<<<< + * for idx in range(ndim): + * strides[idx] = stride +*/ + __pyx_t_1 = (__pyx_v_order == 'F'); + if (__pyx_t_1) { + + /* "View.MemoryView":1195 + * + * if order == 'F': + * for idx in range(ndim): # <<<<<<<<<<<<<< + * strides[idx] = stride + * stride *= shape[idx] +*/ + __pyx_t_2 = __pyx_v_ndim; + __pyx_t_3 = __pyx_t_2; + for (__pyx_t_4 = 0; __pyx_t_4 < __pyx_t_3; __pyx_t_4+=1) { + __pyx_v_idx = __pyx_t_4; + + /* "View.MemoryView":1196 + * if order == 'F': + * for idx in range(ndim): + * strides[idx] = stride # <<<<<<<<<<<<<< + * stride *= shape[idx] + * else: +*/ + (__pyx_v_strides[__pyx_v_idx]) = __pyx_v_stride; + + /* "View.MemoryView":1197 + * for idx in range(ndim): + * strides[idx] = stride + * stride *= shape[idx] # <<<<<<<<<<<<<< + * else: + * for idx in range(ndim - 1, -1, -1): +*/ + __pyx_v_stride = (__pyx_v_stride * (__pyx_v_shape[__pyx_v_idx])); + } + + /* "View.MemoryView":1194 + * cdef int idx + * + * if order == 'F': # <<<<<<<<<<<<<< + * for idx in range(ndim): + * strides[idx] = stride +*/ + goto __pyx_L3; + } + + /* "View.MemoryView":1199 + * stride *= shape[idx] + * else: + * for idx in range(ndim - 1, -1, -1): # <<<<<<<<<<<<<< + * strides[idx] = stride + * stride *= shape[idx] +*/ + /*else*/ { + for (__pyx_t_2 = (__pyx_v_ndim - 1); __pyx_t_2 > -1; __pyx_t_2-=1) { + __pyx_v_idx = __pyx_t_2; + + /* "View.MemoryView":1200 + * else: + * for idx in range(ndim - 1, -1, -1): + * strides[idx] = stride # <<<<<<<<<<<<<< + * stride *= shape[idx] + * +*/ + (__pyx_v_strides[__pyx_v_idx]) = __pyx_v_stride; + + /* "View.MemoryView":1201 + * for idx in range(ndim - 1, -1, -1): + * strides[idx] = stride + * stride *= shape[idx] # <<<<<<<<<<<<<< + * + * return stride +*/ + __pyx_v_stride = (__pyx_v_stride * (__pyx_v_shape[__pyx_v_idx])); + } + } + __pyx_L3:; + + /* "View.MemoryView":1203 + * stride *= shape[idx] + * + * return stride # <<<<<<<<<<<<<< + * + * @cname('__pyx_memoryview_copy_data_to_temp') +*/ + __pyx_r = __pyx_v_stride; + goto __pyx_L0; + + /* "View.MemoryView":1184 + * return size + * + * @cname('__pyx_fill_contig_strides_array') # <<<<<<<<<<<<<< + * cdef Py_ssize_t fill_contig_strides_array( + * Py_ssize_t *shape, Py_ssize_t *strides, Py_ssize_t stride, +*/ + + /* function exit code */ + __pyx_L0:; + return __pyx_r; +} + +/* "View.MemoryView":1205 + * return stride + * + * @cname('__pyx_memoryview_copy_data_to_temp') # <<<<<<<<<<<<<< + * cdef void *copy_data_to_temp(__Pyx_memviewslice *src, + * __Pyx_memviewslice *tmpslice, +*/ + +static void *__pyx_memoryview_copy_data_to_temp(__Pyx_memviewslice *__pyx_v_src, __Pyx_memviewslice *__pyx_v_tmpslice, char __pyx_v_order, int __pyx_v_ndim) { + int __pyx_v_i; + void *__pyx_v_result; + size_t __pyx_v_itemsize; + size_t __pyx_v_size; + void *__pyx_r; + Py_ssize_t __pyx_t_1; + int __pyx_t_2; + int __pyx_t_3; + struct __pyx_memoryview_obj *__pyx_t_4; + int __pyx_t_5; + int __pyx_t_6; + int __pyx_lineno = 0; + const char *__pyx_filename = NULL; + int __pyx_clineno = 0; + PyGILState_STATE __pyx_gilstate_save; + + /* "View.MemoryView":1217 + * cdef void *result + * + * cdef size_t itemsize = src.memview.view.itemsize # <<<<<<<<<<<<<< + * cdef size_t size = slice_get_size(src, ndim) + * +*/ + __pyx_t_1 = __pyx_v_src->memview->view.itemsize; + __pyx_v_itemsize = __pyx_t_1; + + /* "View.MemoryView":1218 + * + * cdef size_t itemsize = src.memview.view.itemsize + * cdef size_t size = slice_get_size(src, ndim) # <<<<<<<<<<<<<< + * + * result = malloc(size) +*/ + __pyx_v_size = __pyx_memoryview_slice_get_size(__pyx_v_src, __pyx_v_ndim); + + /* "View.MemoryView":1220 + * cdef size_t size = slice_get_size(src, ndim) + * + * result = malloc(size) # <<<<<<<<<<<<<< + * if not result: + * _err_no_memory() +*/ + __pyx_v_result = malloc(__pyx_v_size); + + /* "View.MemoryView":1221 + * + * result = malloc(size) + * if not result: # <<<<<<<<<<<<<< + * _err_no_memory() + * +*/ + __pyx_t_2 = (!(__pyx_v_result != 0)); + if (__pyx_t_2) { + + /* "View.MemoryView":1222 + * result = malloc(size) + * if not result: + * _err_no_memory() # <<<<<<<<<<<<<< + * + * +*/ + __pyx_t_3 = __pyx_memoryview_err_no_memory(); if (unlikely(__pyx_t_3 == ((int)-1))) __PYX_ERR(1, 1222, __pyx_L1_error) + + /* "View.MemoryView":1221 + * + * result = malloc(size) + * if not result: # <<<<<<<<<<<<<< + * _err_no_memory() + * +*/ + } + + /* "View.MemoryView":1225 + * + * + * tmpslice.data = result # <<<<<<<<<<<<<< + * tmpslice.memview = src.memview + * for i in range(ndim): +*/ + __pyx_v_tmpslice->data = ((char *)__pyx_v_result); + + /* "View.MemoryView":1226 + * + * tmpslice.data = result + * tmpslice.memview = src.memview # <<<<<<<<<<<<<< + * for i in range(ndim): + * tmpslice.shape[i] = src.shape[i] +*/ + __pyx_t_4 = __pyx_v_src->memview; + __pyx_v_tmpslice->memview = __pyx_t_4; + + /* "View.MemoryView":1227 + * tmpslice.data = result + * tmpslice.memview = src.memview + * for i in range(ndim): # <<<<<<<<<<<<<< + * tmpslice.shape[i] = src.shape[i] + * tmpslice.suboffsets[i] = -1 +*/ + __pyx_t_3 = __pyx_v_ndim; + __pyx_t_5 = __pyx_t_3; + for (__pyx_t_6 = 0; __pyx_t_6 < __pyx_t_5; __pyx_t_6+=1) { + __pyx_v_i = __pyx_t_6; + + /* "View.MemoryView":1228 + * tmpslice.memview = src.memview + * for i in range(ndim): + * tmpslice.shape[i] = src.shape[i] # <<<<<<<<<<<<<< + * tmpslice.suboffsets[i] = -1 + * +*/ + (__pyx_v_tmpslice->shape[__pyx_v_i]) = (__pyx_v_src->shape[__pyx_v_i]); + + /* "View.MemoryView":1229 + * for i in range(ndim): + * tmpslice.shape[i] = src.shape[i] + * tmpslice.suboffsets[i] = -1 # <<<<<<<<<<<<<< + * + * fill_contig_strides_array(&tmpslice.shape[0], &tmpslice.strides[0], itemsize, ndim, order) +*/ + (__pyx_v_tmpslice->suboffsets[__pyx_v_i]) = -1L; + } + + /* "View.MemoryView":1231 + * tmpslice.suboffsets[i] = -1 + * + * fill_contig_strides_array(&tmpslice.shape[0], &tmpslice.strides[0], itemsize, ndim, order) # <<<<<<<<<<<<<< + * + * +*/ + (void)(__pyx_fill_contig_strides_array((&(__pyx_v_tmpslice->shape[0])), (&(__pyx_v_tmpslice->strides[0])), __pyx_v_itemsize, __pyx_v_ndim, __pyx_v_order)); + + /* "View.MemoryView":1234 + * + * + * for i in range(ndim): # <<<<<<<<<<<<<< + * if tmpslice.shape[i] == 1: + * tmpslice.strides[i] = 0 +*/ + __pyx_t_3 = __pyx_v_ndim; + __pyx_t_5 = __pyx_t_3; + for (__pyx_t_6 = 0; __pyx_t_6 < __pyx_t_5; __pyx_t_6+=1) { + __pyx_v_i = __pyx_t_6; + + /* "View.MemoryView":1235 + * + * for i in range(ndim): + * if tmpslice.shape[i] == 1: # <<<<<<<<<<<<<< + * tmpslice.strides[i] = 0 + * +*/ + __pyx_t_2 = ((__pyx_v_tmpslice->shape[__pyx_v_i]) == 1); + if (__pyx_t_2) { + + /* "View.MemoryView":1236 + * for i in range(ndim): + * if tmpslice.shape[i] == 1: + * tmpslice.strides[i] = 0 # <<<<<<<<<<<<<< + * + * if slice_is_contig(src[0], order, ndim): +*/ + (__pyx_v_tmpslice->strides[__pyx_v_i]) = 0; + + /* "View.MemoryView":1235 + * + * for i in range(ndim): + * if tmpslice.shape[i] == 1: # <<<<<<<<<<<<<< + * tmpslice.strides[i] = 0 + * +*/ + } + } + + /* "View.MemoryView":1238 + * tmpslice.strides[i] = 0 + * + * if slice_is_contig(src[0], order, ndim): # <<<<<<<<<<<<<< + * memcpy(result, src.data, size) + * else: +*/ + __pyx_t_2 = __pyx_memviewslice_is_contig((__pyx_v_src[0]), __pyx_v_order, __pyx_v_ndim); + if (__pyx_t_2) { + + /* "View.MemoryView":1239 + * + * if slice_is_contig(src[0], order, ndim): + * memcpy(result, src.data, size) # <<<<<<<<<<<<<< + * else: + * copy_strided_to_strided(src, tmpslice, ndim, itemsize) +*/ + (void)(memcpy(__pyx_v_result, __pyx_v_src->data, __pyx_v_size)); + + /* "View.MemoryView":1238 + * tmpslice.strides[i] = 0 + * + * if slice_is_contig(src[0], order, ndim): # <<<<<<<<<<<<<< + * memcpy(result, src.data, size) + * else: +*/ + goto __pyx_L9; + } + + /* "View.MemoryView":1241 + * memcpy(result, src.data, size) + * else: + * copy_strided_to_strided(src, tmpslice, ndim, itemsize) # <<<<<<<<<<<<<< + * + * return result +*/ + /*else*/ { + copy_strided_to_strided(__pyx_v_src, __pyx_v_tmpslice, __pyx_v_ndim, __pyx_v_itemsize); + } + __pyx_L9:; + + /* "View.MemoryView":1243 + * copy_strided_to_strided(src, tmpslice, ndim, itemsize) + * + * return result # <<<<<<<<<<<<<< + * + * +*/ + __pyx_r = __pyx_v_result; + goto __pyx_L0; + + /* "View.MemoryView":1205 + * return stride + * + * @cname('__pyx_memoryview_copy_data_to_temp') # <<<<<<<<<<<<<< + * cdef void *copy_data_to_temp(__Pyx_memviewslice *src, + * __Pyx_memviewslice *tmpslice, +*/ + + /* function exit code */ + __pyx_L1_error:; + __pyx_gilstate_save = __Pyx_PyGILState_Ensure(); + __Pyx_AddTraceback("View.MemoryView.copy_data_to_temp", __pyx_clineno, __pyx_lineno, __pyx_filename); + __pyx_r = NULL; + __Pyx_PyGILState_Release(__pyx_gilstate_save); + __pyx_L0:; + return __pyx_r; +} + +/* "View.MemoryView":1247 + * + * + * @cname('__pyx_memoryview_err_extents') # <<<<<<<<<<<<<< + * cdef int _err_extents(int i, Py_ssize_t extent1, + * Py_ssize_t extent2) except -1 with gil: +*/ + +static int __pyx_memoryview_err_extents(int __pyx_v_i, Py_ssize_t __pyx_v_extent1, Py_ssize_t __pyx_v_extent2) { + int __pyx_r; + __Pyx_RefNannyDeclarations + PyObject *__pyx_t_1 = NULL; + PyObject *__pyx_t_2 = NULL; + PyObject *__pyx_t_3 = NULL; + PyObject *__pyx_t_4[7]; + PyObject *__pyx_t_5 = NULL; + int __pyx_lineno = 0; + const char *__pyx_filename = NULL; + int __pyx_clineno = 0; + PyGILState_STATE __pyx_gilstate_save = __Pyx_PyGILState_Ensure(); + __Pyx_RefNannySetupContext("_err_extents", 0); + + /* "View.MemoryView":1250 + * cdef int _err_extents(int i, Py_ssize_t extent1, + * Py_ssize_t extent2) except -1 with gil: + * raise ValueError, f"got differing extents in dimension {i} (got {extent1} and {extent2})" # <<<<<<<<<<<<<< + * + * @cname('__pyx_memoryview_err_dim') +*/ + __pyx_t_1 = __Pyx_PyUnicode_From_int(__pyx_v_i, 0, ' ', 'd'); if (unlikely(!__pyx_t_1)) __PYX_ERR(1, 1250, __pyx_L1_error) + __Pyx_GOTREF(__pyx_t_1); + __pyx_t_2 = __Pyx_PyUnicode_From_Py_ssize_t(__pyx_v_extent1, 0, ' ', 'd'); if (unlikely(!__pyx_t_2)) __PYX_ERR(1, 1250, __pyx_L1_error) + __Pyx_GOTREF(__pyx_t_2); + __pyx_t_3 = __Pyx_PyUnicode_From_Py_ssize_t(__pyx_v_extent2, 0, ' ', 'd'); if (unlikely(!__pyx_t_3)) __PYX_ERR(1, 1250, __pyx_L1_error) + __Pyx_GOTREF(__pyx_t_3); + __pyx_t_4[0] = __pyx_mstate_global->__pyx_kp_u_got_differing_extents_in_dimensi; + __pyx_t_4[1] = __pyx_t_1; + __pyx_t_4[2] = __pyx_mstate_global->__pyx_kp_u_got; + __pyx_t_4[3] = __pyx_t_2; + __pyx_t_4[4] = __pyx_mstate_global->__pyx_kp_u_and; + __pyx_t_4[5] = __pyx_t_3; + __pyx_t_4[6] = __pyx_mstate_global->__pyx_kp_u__5; + __pyx_t_5 = __Pyx_PyUnicode_Join(__pyx_t_4, 7, 35 + __Pyx_PyUnicode_GET_LENGTH(__pyx_t_1) + 6 + __Pyx_PyUnicode_GET_LENGTH(__pyx_t_2) + 5 + __Pyx_PyUnicode_GET_LENGTH(__pyx_t_3) + 1, 127); + if (unlikely(!__pyx_t_5)) __PYX_ERR(1, 1250, __pyx_L1_error) + __Pyx_GOTREF(__pyx_t_5); + __Pyx_DECREF(__pyx_t_1); __pyx_t_1 = 0; + __Pyx_DECREF(__pyx_t_2); __pyx_t_2 = 0; + __Pyx_DECREF(__pyx_t_3); __pyx_t_3 = 0; + __Pyx_Raise(((PyObject *)(((PyTypeObject*)PyExc_ValueError))), __pyx_t_5, 0, 0); + __Pyx_DECREF(__pyx_t_5); __pyx_t_5 = 0; + __PYX_ERR(1, 1250, __pyx_L1_error) + + /* "View.MemoryView":1247 + * + * + * @cname('__pyx_memoryview_err_extents') # <<<<<<<<<<<<<< + * cdef int _err_extents(int i, Py_ssize_t extent1, + * Py_ssize_t extent2) except -1 with gil: +*/ + + /* function exit code */ + __pyx_L1_error:; + __Pyx_XDECREF(__pyx_t_1); + __Pyx_XDECREF(__pyx_t_2); + __Pyx_XDECREF(__pyx_t_3); + __Pyx_XDECREF(__pyx_t_5); + __Pyx_AddTraceback("View.MemoryView._err_extents", __pyx_clineno, __pyx_lineno, __pyx_filename); + __pyx_r = -1; + __Pyx_RefNannyFinishContext(); + __Pyx_PyGILState_Release(__pyx_gilstate_save); + return __pyx_r; +} + +/* "View.MemoryView":1252 + * raise ValueError, f"got differing extents in dimension {i} (got {extent1} and {extent2})" + * + * @cname('__pyx_memoryview_err_dim') # <<<<<<<<<<<<<< + * cdef int _err_dim(PyObject *error, str msg, int dim) except -1 with gil: + * raise error, msg % dim +*/ + +static int __pyx_memoryview_err_dim(PyObject *__pyx_v_error, PyObject *__pyx_v_msg, int __pyx_v_dim) { + int __pyx_r; + __Pyx_RefNannyDeclarations + PyObject *__pyx_t_1 = NULL; + PyObject *__pyx_t_2 = NULL; + int __pyx_lineno = 0; + const char *__pyx_filename = NULL; + int __pyx_clineno = 0; + PyGILState_STATE __pyx_gilstate_save = __Pyx_PyGILState_Ensure(); + __Pyx_RefNannySetupContext("_err_dim", 0); + __Pyx_INCREF(__pyx_v_msg); + + /* "View.MemoryView":1254 + * @cname('__pyx_memoryview_err_dim') + * cdef int _err_dim(PyObject *error, str msg, int dim) except -1 with gil: + * raise error, msg % dim # <<<<<<<<<<<<<< + * + * @cname('__pyx_memoryview_err') +*/ + __pyx_t_1 = __Pyx_PyLong_From_int(__pyx_v_dim); if (unlikely(!__pyx_t_1)) __PYX_ERR(1, 1254, __pyx_L1_error) + __Pyx_GOTREF(__pyx_t_1); + __pyx_t_2 = __Pyx_PyUnicode_FormatSafe(__pyx_v_msg, __pyx_t_1); if (unlikely(!__pyx_t_2)) __PYX_ERR(1, 1254, __pyx_L1_error) + __Pyx_GOTREF(__pyx_t_2); + __Pyx_DECREF(__pyx_t_1); __pyx_t_1 = 0; + __Pyx_Raise(((PyObject *)__pyx_v_error), __pyx_t_2, 0, 0); + __Pyx_DECREF(__pyx_t_2); __pyx_t_2 = 0; + __PYX_ERR(1, 1254, __pyx_L1_error) + + /* "View.MemoryView":1252 + * raise ValueError, f"got differing extents in dimension {i} (got {extent1} and {extent2})" + * + * @cname('__pyx_memoryview_err_dim') # <<<<<<<<<<<<<< + * cdef int _err_dim(PyObject *error, str msg, int dim) except -1 with gil: + * raise error, msg % dim +*/ + + /* function exit code */ + __pyx_L1_error:; + __Pyx_XDECREF(__pyx_t_1); + __Pyx_XDECREF(__pyx_t_2); + __Pyx_AddTraceback("View.MemoryView._err_dim", __pyx_clineno, __pyx_lineno, __pyx_filename); + __pyx_r = -1; + __Pyx_XDECREF(__pyx_v_msg); + __Pyx_RefNannyFinishContext(); + __Pyx_PyGILState_Release(__pyx_gilstate_save); + return __pyx_r; +} + +/* "View.MemoryView":1256 + * raise error, msg % dim + * + * @cname('__pyx_memoryview_err') # <<<<<<<<<<<<<< + * cdef int _err(PyObject *error, str msg) except -1 with gil: + * raise error, msg +*/ + +static int __pyx_memoryview_err(PyObject *__pyx_v_error, PyObject *__pyx_v_msg) { + int __pyx_r; + __Pyx_RefNannyDeclarations + int __pyx_lineno = 0; + const char *__pyx_filename = NULL; + int __pyx_clineno = 0; + PyGILState_STATE __pyx_gilstate_save = __Pyx_PyGILState_Ensure(); + __Pyx_RefNannySetupContext("_err", 0); + __Pyx_INCREF(__pyx_v_msg); + + /* "View.MemoryView":1258 + * @cname('__pyx_memoryview_err') + * cdef int _err(PyObject *error, str msg) except -1 with gil: + * raise error, msg # <<<<<<<<<<<<<< + * + * @cname('__pyx_memoryview_err_no_memory') +*/ + __Pyx_Raise(((PyObject *)__pyx_v_error), __pyx_v_msg, 0, 0); + __PYX_ERR(1, 1258, __pyx_L1_error) + + /* "View.MemoryView":1256 + * raise error, msg % dim + * + * @cname('__pyx_memoryview_err') # <<<<<<<<<<<<<< + * cdef int _err(PyObject *error, str msg) except -1 with gil: + * raise error, msg +*/ + + /* function exit code */ + __pyx_L1_error:; + __Pyx_AddTraceback("View.MemoryView._err", __pyx_clineno, __pyx_lineno, __pyx_filename); + __pyx_r = -1; + __Pyx_XDECREF(__pyx_v_msg); + __Pyx_RefNannyFinishContext(); + __Pyx_PyGILState_Release(__pyx_gilstate_save); + return __pyx_r; +} + +/* "View.MemoryView":1260 + * raise error, msg + * + * @cname('__pyx_memoryview_err_no_memory') # <<<<<<<<<<<<<< + * cdef int _err_no_memory() except -1 with gil: + * raise MemoryError +*/ + +static int __pyx_memoryview_err_no_memory(void) { + int __pyx_r; + int __pyx_lineno = 0; + const char *__pyx_filename = NULL; + int __pyx_clineno = 0; + PyGILState_STATE __pyx_gilstate_save = __Pyx_PyGILState_Ensure(); + + /* "View.MemoryView":1262 + * @cname('__pyx_memoryview_err_no_memory') + * cdef int _err_no_memory() except -1 with gil: + * raise MemoryError # <<<<<<<<<<<<<< + * + * +*/ + PyErr_NoMemory(); __PYX_ERR(1, 1262, __pyx_L1_error) + + /* "View.MemoryView":1260 + * raise error, msg + * + * @cname('__pyx_memoryview_err_no_memory') # <<<<<<<<<<<<<< + * cdef int _err_no_memory() except -1 with gil: + * raise MemoryError +*/ + + /* function exit code */ + __pyx_L1_error:; + __Pyx_AddTraceback("View.MemoryView._err_no_memory", __pyx_clineno, __pyx_lineno, __pyx_filename); + __pyx_r = -1; + __Pyx_PyGILState_Release(__pyx_gilstate_save); + return __pyx_r; +} + +/* "View.MemoryView":1265 + * + * + * @cname('__pyx_memoryview_copy_contents') # <<<<<<<<<<<<<< + * cdef int memoryview_copy_contents(__Pyx_memviewslice src, + * __Pyx_memviewslice dst, +*/ + +static int __pyx_memoryview_copy_contents(__Pyx_memviewslice __pyx_v_src, __Pyx_memviewslice __pyx_v_dst, int __pyx_v_src_ndim, int __pyx_v_dst_ndim, int __pyx_v_dtype_is_object) { + void *__pyx_v_tmpdata; + size_t __pyx_v_itemsize; + int __pyx_v_i; + char __pyx_v_order; + int __pyx_v_broadcasting; + int __pyx_v_direct_copy; + __Pyx_memviewslice __pyx_v_tmp; + int __pyx_v_ndim; + int __pyx_r; + Py_ssize_t __pyx_t_1; + int __pyx_t_2; + int __pyx_t_3; + int __pyx_t_4; + int __pyx_t_5; + int __pyx_t_6; + void *__pyx_t_7; + int __pyx_lineno = 0; + const char *__pyx_filename = NULL; + int __pyx_clineno = 0; + PyGILState_STATE __pyx_gilstate_save; + + /* "View.MemoryView":1274 + * Check for overlapping memory and verify the shapes. + * """ + * cdef void *tmpdata = NULL # <<<<<<<<<<<<<< + * cdef size_t itemsize = src.memview.view.itemsize + * cdef int i +*/ + __pyx_v_tmpdata = NULL; + + /* "View.MemoryView":1275 + * """ + * cdef void *tmpdata = NULL + * cdef size_t itemsize = src.memview.view.itemsize # <<<<<<<<<<<<<< + * cdef int i + * cdef char order = get_best_order(&src, src_ndim) +*/ + __pyx_t_1 = __pyx_v_src.memview->view.itemsize; + __pyx_v_itemsize = __pyx_t_1; + + /* "View.MemoryView":1277 + * cdef size_t itemsize = src.memview.view.itemsize + * cdef int i + * cdef char order = get_best_order(&src, src_ndim) # <<<<<<<<<<<<<< + * cdef bint broadcasting = False + * cdef bint direct_copy = False +*/ + __pyx_v_order = __pyx_get_best_slice_order((&__pyx_v_src), __pyx_v_src_ndim); + + /* "View.MemoryView":1278 + * cdef int i + * cdef char order = get_best_order(&src, src_ndim) + * cdef bint broadcasting = False # <<<<<<<<<<<<<< + * cdef bint direct_copy = False + * cdef __Pyx_memviewslice tmp +*/ + __pyx_v_broadcasting = 0; + + /* "View.MemoryView":1279 + * cdef char order = get_best_order(&src, src_ndim) + * cdef bint broadcasting = False + * cdef bint direct_copy = False # <<<<<<<<<<<<<< + * cdef __Pyx_memviewslice tmp + * +*/ + __pyx_v_direct_copy = 0; + + /* "View.MemoryView":1282 + * cdef __Pyx_memviewslice tmp + * + * if src_ndim < dst_ndim: # <<<<<<<<<<<<<< + * broadcast_leading(&src, src_ndim, dst_ndim) + * elif dst_ndim < src_ndim: +*/ + __pyx_t_2 = (__pyx_v_src_ndim < __pyx_v_dst_ndim); + if (__pyx_t_2) { + + /* "View.MemoryView":1283 + * + * if src_ndim < dst_ndim: + * broadcast_leading(&src, src_ndim, dst_ndim) # <<<<<<<<<<<<<< + * elif dst_ndim < src_ndim: + * broadcast_leading(&dst, dst_ndim, src_ndim) +*/ + __pyx_memoryview_broadcast_leading((&__pyx_v_src), __pyx_v_src_ndim, __pyx_v_dst_ndim); + + /* "View.MemoryView":1282 + * cdef __Pyx_memviewslice tmp + * + * if src_ndim < dst_ndim: # <<<<<<<<<<<<<< + * broadcast_leading(&src, src_ndim, dst_ndim) + * elif dst_ndim < src_ndim: +*/ + goto __pyx_L3; + } + + /* "View.MemoryView":1284 + * if src_ndim < dst_ndim: + * broadcast_leading(&src, src_ndim, dst_ndim) + * elif dst_ndim < src_ndim: # <<<<<<<<<<<<<< + * broadcast_leading(&dst, dst_ndim, src_ndim) + * +*/ + __pyx_t_2 = (__pyx_v_dst_ndim < __pyx_v_src_ndim); + if (__pyx_t_2) { + + /* "View.MemoryView":1285 + * broadcast_leading(&src, src_ndim, dst_ndim) + * elif dst_ndim < src_ndim: + * broadcast_leading(&dst, dst_ndim, src_ndim) # <<<<<<<<<<<<<< + * + * cdef int ndim = max(src_ndim, dst_ndim) +*/ + __pyx_memoryview_broadcast_leading((&__pyx_v_dst), __pyx_v_dst_ndim, __pyx_v_src_ndim); + + /* "View.MemoryView":1284 + * if src_ndim < dst_ndim: + * broadcast_leading(&src, src_ndim, dst_ndim) + * elif dst_ndim < src_ndim: # <<<<<<<<<<<<<< + * broadcast_leading(&dst, dst_ndim, src_ndim) + * +*/ + } + __pyx_L3:; + + /* "View.MemoryView":1287 + * broadcast_leading(&dst, dst_ndim, src_ndim) + * + * cdef int ndim = max(src_ndim, dst_ndim) # <<<<<<<<<<<<<< + * + * for i in range(ndim): +*/ + __pyx_t_3 = __pyx_v_dst_ndim; + __pyx_t_4 = __pyx_v_src_ndim; + __pyx_t_2 = (__pyx_t_3 > __pyx_t_4); + if (__pyx_t_2) { + __pyx_t_5 = __pyx_t_3; + } else { + __pyx_t_5 = __pyx_t_4; + } + __pyx_v_ndim = __pyx_t_5; + + /* "View.MemoryView":1289 + * cdef int ndim = max(src_ndim, dst_ndim) + * + * for i in range(ndim): # <<<<<<<<<<<<<< + * if src.shape[i] != dst.shape[i]: + * if src.shape[i] == 1: +*/ + __pyx_t_5 = __pyx_v_ndim; + __pyx_t_3 = __pyx_t_5; + for (__pyx_t_4 = 0; __pyx_t_4 < __pyx_t_3; __pyx_t_4+=1) { + __pyx_v_i = __pyx_t_4; + + /* "View.MemoryView":1290 + * + * for i in range(ndim): + * if src.shape[i] != dst.shape[i]: # <<<<<<<<<<<<<< + * if src.shape[i] == 1: + * broadcasting = True +*/ + __pyx_t_2 = ((__pyx_v_src.shape[__pyx_v_i]) != (__pyx_v_dst.shape[__pyx_v_i])); + if (__pyx_t_2) { + + /* "View.MemoryView":1291 + * for i in range(ndim): + * if src.shape[i] != dst.shape[i]: + * if src.shape[i] == 1: # <<<<<<<<<<<<<< + * broadcasting = True + * src.strides[i] = 0 +*/ + __pyx_t_2 = ((__pyx_v_src.shape[__pyx_v_i]) == 1); + if (__pyx_t_2) { + + /* "View.MemoryView":1292 + * if src.shape[i] != dst.shape[i]: + * if src.shape[i] == 1: + * broadcasting = True # <<<<<<<<<<<<<< + * src.strides[i] = 0 + * else: +*/ + __pyx_v_broadcasting = 1; + + /* "View.MemoryView":1293 + * if src.shape[i] == 1: + * broadcasting = True + * src.strides[i] = 0 # <<<<<<<<<<<<<< + * else: + * _err_extents(i, dst.shape[i], src.shape[i]) +*/ + (__pyx_v_src.strides[__pyx_v_i]) = 0; + + /* "View.MemoryView":1291 + * for i in range(ndim): + * if src.shape[i] != dst.shape[i]: + * if src.shape[i] == 1: # <<<<<<<<<<<<<< + * broadcasting = True + * src.strides[i] = 0 +*/ + goto __pyx_L7; + } + + /* "View.MemoryView":1295 + * src.strides[i] = 0 + * else: + * _err_extents(i, dst.shape[i], src.shape[i]) # <<<<<<<<<<<<<< + * + * if src.suboffsets[i] >= 0: +*/ + /*else*/ { + __pyx_t_6 = __pyx_memoryview_err_extents(__pyx_v_i, (__pyx_v_dst.shape[__pyx_v_i]), (__pyx_v_src.shape[__pyx_v_i])); if (unlikely(__pyx_t_6 == ((int)-1))) __PYX_ERR(1, 1295, __pyx_L1_error) + } + __pyx_L7:; + + /* "View.MemoryView":1290 + * + * for i in range(ndim): + * if src.shape[i] != dst.shape[i]: # <<<<<<<<<<<<<< + * if src.shape[i] == 1: + * broadcasting = True +*/ + } + + /* "View.MemoryView":1297 + * _err_extents(i, dst.shape[i], src.shape[i]) + * + * if src.suboffsets[i] >= 0: # <<<<<<<<<<<<<< + * _err_dim(PyExc_ValueError, "Dimension %d is not direct", i) + * +*/ + __pyx_t_2 = ((__pyx_v_src.suboffsets[__pyx_v_i]) >= 0); + if (__pyx_t_2) { + + /* "View.MemoryView":1298 + * + * if src.suboffsets[i] >= 0: + * _err_dim(PyExc_ValueError, "Dimension %d is not direct", i) # <<<<<<<<<<<<<< + * + * if slices_overlap(&src, &dst, ndim, itemsize): +*/ + __pyx_t_6 = __pyx_memoryview_err_dim(PyExc_ValueError, __pyx_mstate_global->__pyx_kp_u_Dimension_d_is_not_direct, __pyx_v_i); if (unlikely(__pyx_t_6 == ((int)-1))) __PYX_ERR(1, 1298, __pyx_L1_error) + + /* "View.MemoryView":1297 + * _err_extents(i, dst.shape[i], src.shape[i]) + * + * if src.suboffsets[i] >= 0: # <<<<<<<<<<<<<< + * _err_dim(PyExc_ValueError, "Dimension %d is not direct", i) + * +*/ + } + } + + /* "View.MemoryView":1300 + * _err_dim(PyExc_ValueError, "Dimension %d is not direct", i) + * + * if slices_overlap(&src, &dst, ndim, itemsize): # <<<<<<<<<<<<<< + * + * if not slice_is_contig(src, order, ndim): +*/ + __pyx_t_2 = __pyx_slices_overlap((&__pyx_v_src), (&__pyx_v_dst), __pyx_v_ndim, __pyx_v_itemsize); + if (__pyx_t_2) { + + /* "View.MemoryView":1302 + * if slices_overlap(&src, &dst, ndim, itemsize): + * + * if not slice_is_contig(src, order, ndim): # <<<<<<<<<<<<<< + * order = get_best_order(&dst, ndim) + * +*/ + __pyx_t_2 = (!__pyx_memviewslice_is_contig(__pyx_v_src, __pyx_v_order, __pyx_v_ndim)); + if (__pyx_t_2) { + + /* "View.MemoryView":1303 + * + * if not slice_is_contig(src, order, ndim): + * order = get_best_order(&dst, ndim) # <<<<<<<<<<<<<< + * + * tmpdata = copy_data_to_temp(&src, &tmp, order, ndim) +*/ + __pyx_v_order = __pyx_get_best_slice_order((&__pyx_v_dst), __pyx_v_ndim); + + /* "View.MemoryView":1302 + * if slices_overlap(&src, &dst, ndim, itemsize): + * + * if not slice_is_contig(src, order, ndim): # <<<<<<<<<<<<<< + * order = get_best_order(&dst, ndim) + * +*/ + } + + /* "View.MemoryView":1305 + * order = get_best_order(&dst, ndim) + * + * tmpdata = copy_data_to_temp(&src, &tmp, order, ndim) # <<<<<<<<<<<<<< + * src = tmp + * +*/ + __pyx_t_7 = __pyx_memoryview_copy_data_to_temp((&__pyx_v_src), (&__pyx_v_tmp), __pyx_v_order, __pyx_v_ndim); if (unlikely(__pyx_t_7 == ((void *)NULL))) __PYX_ERR(1, 1305, __pyx_L1_error) + __pyx_v_tmpdata = __pyx_t_7; + + /* "View.MemoryView":1306 + * + * tmpdata = copy_data_to_temp(&src, &tmp, order, ndim) + * src = tmp # <<<<<<<<<<<<<< + * + * if not broadcasting: +*/ + __pyx_v_src = __pyx_v_tmp; + + /* "View.MemoryView":1300 + * _err_dim(PyExc_ValueError, "Dimension %d is not direct", i) + * + * if slices_overlap(&src, &dst, ndim, itemsize): # <<<<<<<<<<<<<< + * + * if not slice_is_contig(src, order, ndim): +*/ + } + + /* "View.MemoryView":1308 + * src = tmp + * + * if not broadcasting: # <<<<<<<<<<<<<< + * + * +*/ + __pyx_t_2 = (!__pyx_v_broadcasting); + if (__pyx_t_2) { + + /* "View.MemoryView":1311 + * + * + * if slice_is_contig(src, 'C', ndim): # <<<<<<<<<<<<<< + * direct_copy = slice_is_contig(dst, 'C', ndim) + * elif slice_is_contig(src, 'F', ndim): +*/ + __pyx_t_2 = __pyx_memviewslice_is_contig(__pyx_v_src, 'C', __pyx_v_ndim); + if (__pyx_t_2) { + + /* "View.MemoryView":1312 + * + * if slice_is_contig(src, 'C', ndim): + * direct_copy = slice_is_contig(dst, 'C', ndim) # <<<<<<<<<<<<<< + * elif slice_is_contig(src, 'F', ndim): + * direct_copy = slice_is_contig(dst, 'F', ndim) +*/ + __pyx_v_direct_copy = __pyx_memviewslice_is_contig(__pyx_v_dst, 'C', __pyx_v_ndim); + + /* "View.MemoryView":1311 + * + * + * if slice_is_contig(src, 'C', ndim): # <<<<<<<<<<<<<< + * direct_copy = slice_is_contig(dst, 'C', ndim) + * elif slice_is_contig(src, 'F', ndim): +*/ + goto __pyx_L12; + } + + /* "View.MemoryView":1313 + * if slice_is_contig(src, 'C', ndim): + * direct_copy = slice_is_contig(dst, 'C', ndim) + * elif slice_is_contig(src, 'F', ndim): # <<<<<<<<<<<<<< + * direct_copy = slice_is_contig(dst, 'F', ndim) + * +*/ + __pyx_t_2 = __pyx_memviewslice_is_contig(__pyx_v_src, 'F', __pyx_v_ndim); + if (__pyx_t_2) { + + /* "View.MemoryView":1314 + * direct_copy = slice_is_contig(dst, 'C', ndim) + * elif slice_is_contig(src, 'F', ndim): + * direct_copy = slice_is_contig(dst, 'F', ndim) # <<<<<<<<<<<<<< + * + * if direct_copy: +*/ + __pyx_v_direct_copy = __pyx_memviewslice_is_contig(__pyx_v_dst, 'F', __pyx_v_ndim); + + /* "View.MemoryView":1313 + * if slice_is_contig(src, 'C', ndim): + * direct_copy = slice_is_contig(dst, 'C', ndim) + * elif slice_is_contig(src, 'F', ndim): # <<<<<<<<<<<<<< + * direct_copy = slice_is_contig(dst, 'F', ndim) + * +*/ + } + __pyx_L12:; + + /* "View.MemoryView":1316 + * direct_copy = slice_is_contig(dst, 'F', ndim) + * + * if direct_copy: # <<<<<<<<<<<<<< + * + * refcount_copying(&dst, dtype_is_object, ndim, inc=False) +*/ + if (__pyx_v_direct_copy) { + + /* "View.MemoryView":1318 + * if direct_copy: + * + * refcount_copying(&dst, dtype_is_object, ndim, inc=False) # <<<<<<<<<<<<<< + * memcpy(dst.data, src.data, slice_get_size(&src, ndim)) + * refcount_copying(&dst, dtype_is_object, ndim, inc=True) +*/ + __pyx_memoryview_refcount_copying((&__pyx_v_dst), __pyx_v_dtype_is_object, __pyx_v_ndim, 0); + + /* "View.MemoryView":1319 + * + * refcount_copying(&dst, dtype_is_object, ndim, inc=False) + * memcpy(dst.data, src.data, slice_get_size(&src, ndim)) # <<<<<<<<<<<<<< + * refcount_copying(&dst, dtype_is_object, ndim, inc=True) + * free(tmpdata) +*/ + (void)(memcpy(__pyx_v_dst.data, __pyx_v_src.data, __pyx_memoryview_slice_get_size((&__pyx_v_src), __pyx_v_ndim))); + + /* "View.MemoryView":1320 + * refcount_copying(&dst, dtype_is_object, ndim, inc=False) + * memcpy(dst.data, src.data, slice_get_size(&src, ndim)) + * refcount_copying(&dst, dtype_is_object, ndim, inc=True) # <<<<<<<<<<<<<< + * free(tmpdata) + * return 0 +*/ + __pyx_memoryview_refcount_copying((&__pyx_v_dst), __pyx_v_dtype_is_object, __pyx_v_ndim, 1); + + /* "View.MemoryView":1321 + * memcpy(dst.data, src.data, slice_get_size(&src, ndim)) + * refcount_copying(&dst, dtype_is_object, ndim, inc=True) + * free(tmpdata) # <<<<<<<<<<<<<< + * return 0 + * +*/ + free(__pyx_v_tmpdata); + + /* "View.MemoryView":1322 + * refcount_copying(&dst, dtype_is_object, ndim, inc=True) + * free(tmpdata) + * return 0 # <<<<<<<<<<<<<< + * + * if order == 'F' == get_best_order(&dst, ndim): +*/ + __pyx_r = 0; + goto __pyx_L0; + + /* "View.MemoryView":1316 + * direct_copy = slice_is_contig(dst, 'F', ndim) + * + * if direct_copy: # <<<<<<<<<<<<<< + * + * refcount_copying(&dst, dtype_is_object, ndim, inc=False) +*/ + } + + /* "View.MemoryView":1308 + * src = tmp + * + * if not broadcasting: # <<<<<<<<<<<<<< + * + * +*/ + } + + /* "View.MemoryView":1324 + * return 0 + * + * if order == 'F' == get_best_order(&dst, ndim): # <<<<<<<<<<<<<< + * + * +*/ + __pyx_t_2 = (__pyx_v_order == 'F'); + if (__pyx_t_2) { + __pyx_t_2 = ('F' == __pyx_get_best_slice_order((&__pyx_v_dst), __pyx_v_ndim)); + } + if (__pyx_t_2) { + + /* "View.MemoryView":1327 + * + * + * transpose_memslice(&src) # <<<<<<<<<<<<<< + * transpose_memslice(&dst) + * +*/ + __pyx_t_5 = __pyx_memslice_transpose((&__pyx_v_src)); if (unlikely(__pyx_t_5 == ((int)-1))) __PYX_ERR(1, 1327, __pyx_L1_error) + + /* "View.MemoryView":1328 + * + * transpose_memslice(&src) + * transpose_memslice(&dst) # <<<<<<<<<<<<<< + * + * refcount_copying(&dst, dtype_is_object, ndim, inc=False) +*/ + __pyx_t_5 = __pyx_memslice_transpose((&__pyx_v_dst)); if (unlikely(__pyx_t_5 == ((int)-1))) __PYX_ERR(1, 1328, __pyx_L1_error) + + /* "View.MemoryView":1324 + * return 0 + * + * if order == 'F' == get_best_order(&dst, ndim): # <<<<<<<<<<<<<< + * + * +*/ + } + + /* "View.MemoryView":1330 + * transpose_memslice(&dst) + * + * refcount_copying(&dst, dtype_is_object, ndim, inc=False) # <<<<<<<<<<<<<< + * copy_strided_to_strided(&src, &dst, ndim, itemsize) + * refcount_copying(&dst, dtype_is_object, ndim, inc=True) +*/ + __pyx_memoryview_refcount_copying((&__pyx_v_dst), __pyx_v_dtype_is_object, __pyx_v_ndim, 0); + + /* "View.MemoryView":1331 + * + * refcount_copying(&dst, dtype_is_object, ndim, inc=False) + * copy_strided_to_strided(&src, &dst, ndim, itemsize) # <<<<<<<<<<<<<< + * refcount_copying(&dst, dtype_is_object, ndim, inc=True) + * +*/ + copy_strided_to_strided((&__pyx_v_src), (&__pyx_v_dst), __pyx_v_ndim, __pyx_v_itemsize); + + /* "View.MemoryView":1332 + * refcount_copying(&dst, dtype_is_object, ndim, inc=False) + * copy_strided_to_strided(&src, &dst, ndim, itemsize) + * refcount_copying(&dst, dtype_is_object, ndim, inc=True) # <<<<<<<<<<<<<< + * + * free(tmpdata) +*/ + __pyx_memoryview_refcount_copying((&__pyx_v_dst), __pyx_v_dtype_is_object, __pyx_v_ndim, 1); + + /* "View.MemoryView":1334 + * refcount_copying(&dst, dtype_is_object, ndim, inc=True) + * + * free(tmpdata) # <<<<<<<<<<<<<< + * return 0 + * +*/ + free(__pyx_v_tmpdata); + + /* "View.MemoryView":1335 + * + * free(tmpdata) + * return 0 # <<<<<<<<<<<<<< + * + * @cname('__pyx_memoryview_broadcast_leading') +*/ + __pyx_r = 0; + goto __pyx_L0; + + /* "View.MemoryView":1265 + * + * + * @cname('__pyx_memoryview_copy_contents') # <<<<<<<<<<<<<< + * cdef int memoryview_copy_contents(__Pyx_memviewslice src, + * __Pyx_memviewslice dst, +*/ + + /* function exit code */ + __pyx_L1_error:; + __pyx_gilstate_save = __Pyx_PyGILState_Ensure(); + __Pyx_AddTraceback("View.MemoryView.memoryview_copy_contents", __pyx_clineno, __pyx_lineno, __pyx_filename); + __pyx_r = -1; + __Pyx_PyGILState_Release(__pyx_gilstate_save); + __pyx_L0:; + return __pyx_r; +} + +/* "View.MemoryView":1337 + * return 0 + * + * @cname('__pyx_memoryview_broadcast_leading') # <<<<<<<<<<<<<< + * cdef void broadcast_leading(__Pyx_memviewslice *mslice, + * int ndim, +*/ + +static void __pyx_memoryview_broadcast_leading(__Pyx_memviewslice *__pyx_v_mslice, int __pyx_v_ndim, int __pyx_v_ndim_other) { + int __pyx_v_i; + int __pyx_v_offset; + int __pyx_t_1; + int __pyx_t_2; + int __pyx_t_3; + + /* "View.MemoryView":1342 + * int ndim_other) noexcept nogil: + * cdef int i + * cdef int offset = ndim_other - ndim # <<<<<<<<<<<<<< + * + * for i in range(ndim - 1, -1, -1): +*/ + __pyx_v_offset = (__pyx_v_ndim_other - __pyx_v_ndim); + + /* "View.MemoryView":1344 + * cdef int offset = ndim_other - ndim + * + * for i in range(ndim - 1, -1, -1): # <<<<<<<<<<<<<< + * mslice.shape[i + offset] = mslice.shape[i] + * mslice.strides[i + offset] = mslice.strides[i] +*/ + for (__pyx_t_1 = (__pyx_v_ndim - 1); __pyx_t_1 > -1; __pyx_t_1-=1) { + __pyx_v_i = __pyx_t_1; + + /* "View.MemoryView":1345 + * + * for i in range(ndim - 1, -1, -1): + * mslice.shape[i + offset] = mslice.shape[i] # <<<<<<<<<<<<<< + * mslice.strides[i + offset] = mslice.strides[i] + * mslice.suboffsets[i + offset] = mslice.suboffsets[i] +*/ + (__pyx_v_mslice->shape[(__pyx_v_i + __pyx_v_offset)]) = (__pyx_v_mslice->shape[__pyx_v_i]); + + /* "View.MemoryView":1346 + * for i in range(ndim - 1, -1, -1): + * mslice.shape[i + offset] = mslice.shape[i] + * mslice.strides[i + offset] = mslice.strides[i] # <<<<<<<<<<<<<< + * mslice.suboffsets[i + offset] = mslice.suboffsets[i] + * +*/ + (__pyx_v_mslice->strides[(__pyx_v_i + __pyx_v_offset)]) = (__pyx_v_mslice->strides[__pyx_v_i]); + + /* "View.MemoryView":1347 + * mslice.shape[i + offset] = mslice.shape[i] + * mslice.strides[i + offset] = mslice.strides[i] + * mslice.suboffsets[i + offset] = mslice.suboffsets[i] # <<<<<<<<<<<<<< + * + * for i in range(offset): +*/ + (__pyx_v_mslice->suboffsets[(__pyx_v_i + __pyx_v_offset)]) = (__pyx_v_mslice->suboffsets[__pyx_v_i]); + } + + /* "View.MemoryView":1349 + * mslice.suboffsets[i + offset] = mslice.suboffsets[i] + * + * for i in range(offset): # <<<<<<<<<<<<<< + * mslice.shape[i] = 1 + * mslice.strides[i] = mslice.strides[0] +*/ + __pyx_t_1 = __pyx_v_offset; + __pyx_t_2 = __pyx_t_1; + for (__pyx_t_3 = 0; __pyx_t_3 < __pyx_t_2; __pyx_t_3+=1) { + __pyx_v_i = __pyx_t_3; + + /* "View.MemoryView":1350 + * + * for i in range(offset): + * mslice.shape[i] = 1 # <<<<<<<<<<<<<< + * mslice.strides[i] = mslice.strides[0] + * mslice.suboffsets[i] = -1 +*/ + (__pyx_v_mslice->shape[__pyx_v_i]) = 1; + + /* "View.MemoryView":1351 + * for i in range(offset): + * mslice.shape[i] = 1 + * mslice.strides[i] = mslice.strides[0] # <<<<<<<<<<<<<< + * mslice.suboffsets[i] = -1 + * +*/ + (__pyx_v_mslice->strides[__pyx_v_i]) = (__pyx_v_mslice->strides[0]); + + /* "View.MemoryView":1352 + * mslice.shape[i] = 1 + * mslice.strides[i] = mslice.strides[0] + * mslice.suboffsets[i] = -1 # <<<<<<<<<<<<<< + * + * +*/ + (__pyx_v_mslice->suboffsets[__pyx_v_i]) = -1L; + } + + /* "View.MemoryView":1337 + * return 0 + * + * @cname('__pyx_memoryview_broadcast_leading') # <<<<<<<<<<<<<< + * cdef void broadcast_leading(__Pyx_memviewslice *mslice, + * int ndim, +*/ + + /* function exit code */ +} + +/* "View.MemoryView":1359 + * + * + * @cname('__pyx_memoryview_refcount_copying') # <<<<<<<<<<<<<< + * cdef void refcount_copying(__Pyx_memviewslice *dst, bint dtype_is_object, int ndim, bint inc) noexcept nogil: + * +*/ + +static void __pyx_memoryview_refcount_copying(__Pyx_memviewslice *__pyx_v_dst, int __pyx_v_dtype_is_object, int __pyx_v_ndim, int __pyx_v_inc) { + + /* "View.MemoryView":1362 + * cdef void refcount_copying(__Pyx_memviewslice *dst, bint dtype_is_object, int ndim, bint inc) noexcept nogil: + * + * if dtype_is_object: # <<<<<<<<<<<<<< + * refcount_objects_in_slice_with_gil(dst.data, dst.shape, dst.strides, ndim, inc) + * +*/ + if (__pyx_v_dtype_is_object) { + + /* "View.MemoryView":1363 + * + * if dtype_is_object: + * refcount_objects_in_slice_with_gil(dst.data, dst.shape, dst.strides, ndim, inc) # <<<<<<<<<<<<<< + * + * @cname('__pyx_memoryview_refcount_objects_in_slice_with_gil') +*/ + __pyx_memoryview_refcount_objects_in_slice_with_gil(__pyx_v_dst->data, __pyx_v_dst->shape, __pyx_v_dst->strides, __pyx_v_ndim, __pyx_v_inc); + + /* "View.MemoryView":1362 + * cdef void refcount_copying(__Pyx_memviewslice *dst, bint dtype_is_object, int ndim, bint inc) noexcept nogil: + * + * if dtype_is_object: # <<<<<<<<<<<<<< + * refcount_objects_in_slice_with_gil(dst.data, dst.shape, dst.strides, ndim, inc) + * +*/ + } + + /* "View.MemoryView":1359 + * + * + * @cname('__pyx_memoryview_refcount_copying') # <<<<<<<<<<<<<< + * cdef void refcount_copying(__Pyx_memviewslice *dst, bint dtype_is_object, int ndim, bint inc) noexcept nogil: + * +*/ + + /* function exit code */ +} + +/* "View.MemoryView":1365 + * refcount_objects_in_slice_with_gil(dst.data, dst.shape, dst.strides, ndim, inc) + * + * @cname('__pyx_memoryview_refcount_objects_in_slice_with_gil') # <<<<<<<<<<<<<< + * cdef void refcount_objects_in_slice_with_gil(char *data, Py_ssize_t *shape, + * Py_ssize_t *strides, int ndim, +*/ + +static void __pyx_memoryview_refcount_objects_in_slice_with_gil(char *__pyx_v_data, Py_ssize_t *__pyx_v_shape, Py_ssize_t *__pyx_v_strides, int __pyx_v_ndim, int __pyx_v_inc) { + PyGILState_STATE __pyx_gilstate_save = __Pyx_PyGILState_Ensure(); + + /* "View.MemoryView":1369 + * Py_ssize_t *strides, int ndim, + * bint inc) noexcept with gil: + * refcount_objects_in_slice(data, shape, strides, ndim, inc) # <<<<<<<<<<<<<< + * + * @cname('__pyx_memoryview_refcount_objects_in_slice') +*/ + __pyx_memoryview_refcount_objects_in_slice(__pyx_v_data, __pyx_v_shape, __pyx_v_strides, __pyx_v_ndim, __pyx_v_inc); + + /* "View.MemoryView":1365 + * refcount_objects_in_slice_with_gil(dst.data, dst.shape, dst.strides, ndim, inc) + * + * @cname('__pyx_memoryview_refcount_objects_in_slice_with_gil') # <<<<<<<<<<<<<< + * cdef void refcount_objects_in_slice_with_gil(char *data, Py_ssize_t *shape, + * Py_ssize_t *strides, int ndim, +*/ + + /* function exit code */ + __Pyx_PyGILState_Release(__pyx_gilstate_save); +} + +/* "View.MemoryView":1371 + * refcount_objects_in_slice(data, shape, strides, ndim, inc) + * + * @cname('__pyx_memoryview_refcount_objects_in_slice') # <<<<<<<<<<<<<< + * cdef void refcount_objects_in_slice(char *data, Py_ssize_t *shape, + * Py_ssize_t *strides, int ndim, bint inc) noexcept: +*/ + +static void __pyx_memoryview_refcount_objects_in_slice(char *__pyx_v_data, Py_ssize_t *__pyx_v_shape, Py_ssize_t *__pyx_v_strides, int __pyx_v_ndim, int __pyx_v_inc) { + CYTHON_UNUSED Py_ssize_t __pyx_v_i; + Py_ssize_t __pyx_v_stride; + Py_ssize_t __pyx_t_1; + Py_ssize_t __pyx_t_2; + Py_ssize_t __pyx_t_3; + int __pyx_t_4; + + /* "View.MemoryView":1375 + * Py_ssize_t *strides, int ndim, bint inc) noexcept: + * cdef Py_ssize_t i + * cdef Py_ssize_t stride = strides[0] # <<<<<<<<<<<<<< + * + * for i in range(shape[0]): +*/ + __pyx_v_stride = (__pyx_v_strides[0]); + + /* "View.MemoryView":1377 + * cdef Py_ssize_t stride = strides[0] + * + * for i in range(shape[0]): # <<<<<<<<<<<<<< + * if ndim == 1: + * if inc: +*/ + __pyx_t_1 = (__pyx_v_shape[0]); + __pyx_t_2 = __pyx_t_1; + for (__pyx_t_3 = 0; __pyx_t_3 < __pyx_t_2; __pyx_t_3+=1) { + __pyx_v_i = __pyx_t_3; + + /* "View.MemoryView":1378 + * + * for i in range(shape[0]): + * if ndim == 1: # <<<<<<<<<<<<<< + * if inc: + * Py_INCREF(( data)[0]) +*/ + __pyx_t_4 = (__pyx_v_ndim == 1); + if (__pyx_t_4) { + + /* "View.MemoryView":1379 + * for i in range(shape[0]): + * if ndim == 1: + * if inc: # <<<<<<<<<<<<<< + * Py_INCREF(( data)[0]) + * else: +*/ + if (__pyx_v_inc) { + + /* "View.MemoryView":1380 + * if ndim == 1: + * if inc: + * Py_INCREF(( data)[0]) # <<<<<<<<<<<<<< + * else: + * Py_DECREF(( data)[0]) +*/ + Py_INCREF((((PyObject **)__pyx_v_data)[0])); + + /* "View.MemoryView":1379 + * for i in range(shape[0]): + * if ndim == 1: + * if inc: # <<<<<<<<<<<<<< + * Py_INCREF(( data)[0]) + * else: +*/ + goto __pyx_L6; + } + + /* "View.MemoryView":1382 + * Py_INCREF(( data)[0]) + * else: + * Py_DECREF(( data)[0]) # <<<<<<<<<<<<<< + * else: + * refcount_objects_in_slice(data, shape + 1, strides + 1, ndim - 1, inc) +*/ + /*else*/ { + Py_DECREF((((PyObject **)__pyx_v_data)[0])); + } + __pyx_L6:; + + /* "View.MemoryView":1378 + * + * for i in range(shape[0]): + * if ndim == 1: # <<<<<<<<<<<<<< + * if inc: + * Py_INCREF(( data)[0]) +*/ + goto __pyx_L5; + } + + /* "View.MemoryView":1384 + * Py_DECREF(( data)[0]) + * else: + * refcount_objects_in_slice(data, shape + 1, strides + 1, ndim - 1, inc) # <<<<<<<<<<<<<< + * + * data += stride +*/ + /*else*/ { + __pyx_memoryview_refcount_objects_in_slice(__pyx_v_data, (__pyx_v_shape + 1), (__pyx_v_strides + 1), (__pyx_v_ndim - 1), __pyx_v_inc); + } + __pyx_L5:; + + /* "View.MemoryView":1386 + * refcount_objects_in_slice(data, shape + 1, strides + 1, ndim - 1, inc) + * + * data += stride # <<<<<<<<<<<<<< + * + * +*/ + __pyx_v_data = (__pyx_v_data + __pyx_v_stride); + } + + /* "View.MemoryView":1371 + * refcount_objects_in_slice(data, shape, strides, ndim, inc) + * + * @cname('__pyx_memoryview_refcount_objects_in_slice') # <<<<<<<<<<<<<< + * cdef void refcount_objects_in_slice(char *data, Py_ssize_t *shape, + * Py_ssize_t *strides, int ndim, bint inc) noexcept: +*/ + + /* function exit code */ +} + +/* "View.MemoryView":1391 + * + * + * @cname('__pyx_memoryview_slice_assign_scalar') # <<<<<<<<<<<<<< + * cdef void slice_assign_scalar(__Pyx_memviewslice *dst, int ndim, + * size_t itemsize, void *item, +*/ + +static void __pyx_memoryview_slice_assign_scalar(__Pyx_memviewslice *__pyx_v_dst, int __pyx_v_ndim, size_t __pyx_v_itemsize, void *__pyx_v_item, int __pyx_v_dtype_is_object) { + + /* "View.MemoryView":1395 + * size_t itemsize, void *item, + * bint dtype_is_object) noexcept nogil: + * refcount_copying(dst, dtype_is_object, ndim, inc=False) # <<<<<<<<<<<<<< + * _slice_assign_scalar(dst.data, dst.shape, dst.strides, ndim, itemsize, item) + * refcount_copying(dst, dtype_is_object, ndim, inc=True) +*/ + __pyx_memoryview_refcount_copying(__pyx_v_dst, __pyx_v_dtype_is_object, __pyx_v_ndim, 0); + + /* "View.MemoryView":1396 + * bint dtype_is_object) noexcept nogil: + * refcount_copying(dst, dtype_is_object, ndim, inc=False) + * _slice_assign_scalar(dst.data, dst.shape, dst.strides, ndim, itemsize, item) # <<<<<<<<<<<<<< + * refcount_copying(dst, dtype_is_object, ndim, inc=True) + * +*/ + __pyx_memoryview__slice_assign_scalar(__pyx_v_dst->data, __pyx_v_dst->shape, __pyx_v_dst->strides, __pyx_v_ndim, __pyx_v_itemsize, __pyx_v_item); + + /* "View.MemoryView":1397 + * refcount_copying(dst, dtype_is_object, ndim, inc=False) + * _slice_assign_scalar(dst.data, dst.shape, dst.strides, ndim, itemsize, item) + * refcount_copying(dst, dtype_is_object, ndim, inc=True) # <<<<<<<<<<<<<< + * + * +*/ + __pyx_memoryview_refcount_copying(__pyx_v_dst, __pyx_v_dtype_is_object, __pyx_v_ndim, 1); + + /* "View.MemoryView":1391 + * + * + * @cname('__pyx_memoryview_slice_assign_scalar') # <<<<<<<<<<<<<< + * cdef void slice_assign_scalar(__Pyx_memviewslice *dst, int ndim, + * size_t itemsize, void *item, +*/ + + /* function exit code */ +} + +/* "View.MemoryView":1400 + * + * + * @cname('__pyx_memoryview__slice_assign_scalar') # <<<<<<<<<<<<<< + * cdef void _slice_assign_scalar(char *data, Py_ssize_t *shape, + * Py_ssize_t *strides, int ndim, +*/ + +static void __pyx_memoryview__slice_assign_scalar(char *__pyx_v_data, Py_ssize_t *__pyx_v_shape, Py_ssize_t *__pyx_v_strides, int __pyx_v_ndim, size_t __pyx_v_itemsize, void *__pyx_v_item) { + CYTHON_UNUSED Py_ssize_t __pyx_v_i; + Py_ssize_t __pyx_v_stride; + Py_ssize_t __pyx_v_extent; + int __pyx_t_1; + Py_ssize_t __pyx_t_2; + Py_ssize_t __pyx_t_3; + Py_ssize_t __pyx_t_4; + + /* "View.MemoryView":1405 + * size_t itemsize, void *item) noexcept nogil: + * cdef Py_ssize_t i + * cdef Py_ssize_t stride = strides[0] # <<<<<<<<<<<<<< + * cdef Py_ssize_t extent = shape[0] + * +*/ + __pyx_v_stride = (__pyx_v_strides[0]); + + /* "View.MemoryView":1406 + * cdef Py_ssize_t i + * cdef Py_ssize_t stride = strides[0] + * cdef Py_ssize_t extent = shape[0] # <<<<<<<<<<<<<< + * + * if ndim == 1: +*/ + __pyx_v_extent = (__pyx_v_shape[0]); + + /* "View.MemoryView":1408 + * cdef Py_ssize_t extent = shape[0] + * + * if ndim == 1: # <<<<<<<<<<<<<< + * for i in range(extent): + * memcpy(data, item, itemsize) +*/ + __pyx_t_1 = (__pyx_v_ndim == 1); + if (__pyx_t_1) { + + /* "View.MemoryView":1409 + * + * if ndim == 1: + * for i in range(extent): # <<<<<<<<<<<<<< + * memcpy(data, item, itemsize) + * data += stride +*/ + __pyx_t_2 = __pyx_v_extent; + __pyx_t_3 = __pyx_t_2; + for (__pyx_t_4 = 0; __pyx_t_4 < __pyx_t_3; __pyx_t_4+=1) { + __pyx_v_i = __pyx_t_4; + + /* "View.MemoryView":1410 + * if ndim == 1: + * for i in range(extent): + * memcpy(data, item, itemsize) # <<<<<<<<<<<<<< + * data += stride + * else: +*/ + (void)(memcpy(__pyx_v_data, __pyx_v_item, __pyx_v_itemsize)); + + /* "View.MemoryView":1411 + * for i in range(extent): + * memcpy(data, item, itemsize) + * data += stride # <<<<<<<<<<<<<< + * else: + * for i in range(extent): +*/ + __pyx_v_data = (__pyx_v_data + __pyx_v_stride); + } + + /* "View.MemoryView":1408 + * cdef Py_ssize_t extent = shape[0] + * + * if ndim == 1: # <<<<<<<<<<<<<< + * for i in range(extent): + * memcpy(data, item, itemsize) +*/ + goto __pyx_L3; + } + + /* "View.MemoryView":1413 + * data += stride + * else: + * for i in range(extent): # <<<<<<<<<<<<<< + * _slice_assign_scalar(data, shape + 1, strides + 1, ndim - 1, itemsize, item) + * data += stride +*/ + /*else*/ { + __pyx_t_2 = __pyx_v_extent; + __pyx_t_3 = __pyx_t_2; + for (__pyx_t_4 = 0; __pyx_t_4 < __pyx_t_3; __pyx_t_4+=1) { + __pyx_v_i = __pyx_t_4; + + /* "View.MemoryView":1414 + * else: + * for i in range(extent): + * _slice_assign_scalar(data, shape + 1, strides + 1, ndim - 1, itemsize, item) # <<<<<<<<<<<<<< + * data += stride + * +*/ + __pyx_memoryview__slice_assign_scalar(__pyx_v_data, (__pyx_v_shape + 1), (__pyx_v_strides + 1), (__pyx_v_ndim - 1), __pyx_v_itemsize, __pyx_v_item); + + /* "View.MemoryView":1415 + * for i in range(extent): + * _slice_assign_scalar(data, shape + 1, strides + 1, ndim - 1, itemsize, item) + * data += stride # <<<<<<<<<<<<<< + * +*/ + __pyx_v_data = (__pyx_v_data + __pyx_v_stride); + } + } + __pyx_L3:; + + /* "View.MemoryView":1400 + * + * + * @cname('__pyx_memoryview__slice_assign_scalar') # <<<<<<<<<<<<<< + * cdef void _slice_assign_scalar(char *data, Py_ssize_t *shape, + * Py_ssize_t *strides, int ndim, +*/ + + /* function exit code */ +} + +/* "(tree fragment)":4 + * int __Pyx_CheckUnpickleChecksum(long, long, long, long, const char*) except -1 + * int __Pyx_UpdateUnpickledDict(object, object, Py_ssize_t) except -1 + * def __pyx_unpickle_Enum(__pyx_type, long __pyx_checksum, tuple __pyx_state): # <<<<<<<<<<<<<< + * cdef object __pyx_result + * __Pyx_CheckUnpickleChecksum(__pyx_checksum, 0x82a3537, 0x6ae9995, 0xb068931, b'name') +*/ + +/* Python wrapper */ +static PyObject *__pyx_pw_15View_dot_MemoryView_1__pyx_unpickle_Enum(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*/ +static PyMethodDef __pyx_mdef_15View_dot_MemoryView_1__pyx_unpickle_Enum = {"__pyx_unpickle_Enum", (PyCFunction)(void(*)(void))(__Pyx_PyCFunction_FastCallWithKeywords)__pyx_pw_15View_dot_MemoryView_1__pyx_unpickle_Enum, __Pyx_METH_FASTCALL|METH_KEYWORDS, 0}; +static PyObject *__pyx_pw_15View_dot_MemoryView_1__pyx_unpickle_Enum(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 +) { + PyObject *__pyx_v___pyx_type = 0; + long __pyx_v___pyx_checksum; + 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[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("__pyx_unpickle_Enum (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_type,&__pyx_mstate_global->__pyx_n_u_pyx_checksum,&__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, 4, __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(1, 4, __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(1, 4, __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(1, 4, __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, "__pyx_unpickle_Enum", 0) < (0)) __PYX_ERR(1, 4, __pyx_L3_error) + for (Py_ssize_t i = __pyx_nargs; i < 3; i++) { + if (unlikely(!values[i])) { __Pyx_RaiseArgtupleInvalid("__pyx_unpickle_Enum", 1, 3, 3, i); __PYX_ERR(1, 4, __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(1, 4, __pyx_L3_error) + values[1] = __Pyx_ArgRef_FASTCALL(__pyx_args, 1); + if (!CYTHON_ASSUME_SAFE_MACROS && unlikely(!values[1])) __PYX_ERR(1, 4, __pyx_L3_error) + values[2] = __Pyx_ArgRef_FASTCALL(__pyx_args, 2); + if (!CYTHON_ASSUME_SAFE_MACROS && unlikely(!values[2])) __PYX_ERR(1, 4, __pyx_L3_error) + } + __pyx_v___pyx_type = values[0]; + __pyx_v___pyx_checksum = __Pyx_PyLong_As_long(values[1]); if (unlikely((__pyx_v___pyx_checksum == (long)-1) && PyErr_Occurred())) __PYX_ERR(1, 4, __pyx_L3_error) + __pyx_v___pyx_state = ((PyObject*)values[2]); + } + goto __pyx_L6_skip; + __pyx_L5_argtuple_error:; + __Pyx_RaiseArgtupleInvalid("__pyx_unpickle_Enum", 1, 3, 3, __pyx_nargs); __PYX_ERR(1, 4, __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("View.MemoryView.__pyx_unpickle_Enum", __pyx_clineno, __pyx_lineno, __pyx_filename); + __Pyx_RefNannyFinishContext(); + return NULL; + __pyx_L4_argument_unpacking_done:; + if (unlikely(!__Pyx_ArgTypeTest(((PyObject *)__pyx_v___pyx_state), (&PyTuple_Type), 1, "__pyx_state", 1))) __PYX_ERR(1, 4, __pyx_L1_error) + __pyx_r = __pyx_pf_15View_dot_MemoryView___pyx_unpickle_Enum(__pyx_self, __pyx_v___pyx_type, __pyx_v___pyx_checksum, __pyx_v___pyx_state); + + /* 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_15View_dot_MemoryView___pyx_unpickle_Enum(CYTHON_UNUSED PyObject *__pyx_self, PyObject *__pyx_v___pyx_type, long __pyx_v___pyx_checksum, PyObject *__pyx_v___pyx_state) { + PyObject *__pyx_v___pyx_result = 0; + 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_t_5; + int __pyx_lineno = 0; + const char *__pyx_filename = NULL; + int __pyx_clineno = 0; + __Pyx_RefNannySetupContext("__pyx_unpickle_Enum", 0); + + /* "(tree fragment)":6 + * def __pyx_unpickle_Enum(__pyx_type, long __pyx_checksum, tuple __pyx_state): + * cdef object __pyx_result + * __Pyx_CheckUnpickleChecksum(__pyx_checksum, 0x82a3537, 0x6ae9995, 0xb068931, b'name') # <<<<<<<<<<<<<< + * __pyx_result = Enum.__new__(__pyx_type) + * if __pyx_state is not None: +*/ + __pyx_t_1 = __Pyx_CheckUnpickleChecksum(__pyx_v___pyx_checksum, 0x82a3537, 0x6ae9995, 0xb068931, ((char const *)"name")); if (unlikely(__pyx_t_1 == ((int)-1))) __PYX_ERR(1, 6, __pyx_L1_error) + + /* "(tree fragment)":7 + * cdef object __pyx_result + * __Pyx_CheckUnpickleChecksum(__pyx_checksum, 0x82a3537, 0x6ae9995, 0xb068931, b'name') + * __pyx_result = Enum.__new__(__pyx_type) # <<<<<<<<<<<<<< + * if __pyx_state is not None: + * __pyx_unpickle_Enum__set_state( __pyx_result, __pyx_state) +*/ + __pyx_t_3 = ((PyObject *)__pyx_mstate_global->__pyx_MemviewEnum_type); + __Pyx_INCREF(__pyx_t_3); + __pyx_t_4 = 0; + { + PyObject *__pyx_callargs[2] = {__pyx_t_3, __pyx_v___pyx_type}; + __pyx_t_2 = __Pyx_PyObject_FastCallMethod((PyObject*)__pyx_mstate_global->__pyx_n_u_new, __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_2)) __PYX_ERR(1, 7, __pyx_L1_error) + __Pyx_GOTREF(__pyx_t_2); + } + __pyx_v___pyx_result = __pyx_t_2; + __pyx_t_2 = 0; + + /* "(tree fragment)":8 + * __Pyx_CheckUnpickleChecksum(__pyx_checksum, 0x82a3537, 0x6ae9995, 0xb068931, b'name') + * __pyx_result = Enum.__new__(__pyx_type) + * if __pyx_state is not None: # <<<<<<<<<<<<<< + * __pyx_unpickle_Enum__set_state( __pyx_result, __pyx_state) + * return __pyx_result +*/ + __pyx_t_5 = (__pyx_v___pyx_state != ((PyObject*)Py_None)); + if (__pyx_t_5) { + + /* "(tree fragment)":9 + * __pyx_result = Enum.__new__(__pyx_type) + * if __pyx_state is not None: + * __pyx_unpickle_Enum__set_state( __pyx_result, __pyx_state) # <<<<<<<<<<<<<< + * return __pyx_result + * cdef __pyx_unpickle_Enum__set_state(Enum __pyx_result, __pyx_state: tuple): +*/ + if (unlikely(__pyx_v___pyx_state == Py_None)) { + PyErr_SetString(PyExc_TypeError, "cannot pass None into a C function argument that is declared 'not None'"); + __PYX_ERR(1, 9, __pyx_L1_error) + } + __pyx_t_2 = __pyx_unpickle_Enum__set_state(((struct __pyx_MemviewEnum_obj *)__pyx_v___pyx_result), __pyx_v___pyx_state); if (unlikely(!__pyx_t_2)) __PYX_ERR(1, 9, __pyx_L1_error) + __Pyx_GOTREF(__pyx_t_2); + __Pyx_DECREF(__pyx_t_2); __pyx_t_2 = 0; + + /* "(tree fragment)":8 + * __Pyx_CheckUnpickleChecksum(__pyx_checksum, 0x82a3537, 0x6ae9995, 0xb068931, b'name') + * __pyx_result = Enum.__new__(__pyx_type) + * if __pyx_state is not None: # <<<<<<<<<<<<<< + * __pyx_unpickle_Enum__set_state( __pyx_result, __pyx_state) + * return __pyx_result +*/ + } + + /* "(tree fragment)":10 + * if __pyx_state is not None: + * __pyx_unpickle_Enum__set_state( __pyx_result, __pyx_state) + * return __pyx_result # <<<<<<<<<<<<<< + * cdef __pyx_unpickle_Enum__set_state(Enum __pyx_result, __pyx_state: tuple): + * __pyx_result.name = __pyx_state[0] +*/ + __Pyx_XDECREF(__pyx_r); + __Pyx_INCREF(__pyx_v___pyx_result); + __pyx_r = __pyx_v___pyx_result; + goto __pyx_L0; + + /* "(tree fragment)":4 + * int __Pyx_CheckUnpickleChecksum(long, long, long, long, const char*) except -1 + * int __Pyx_UpdateUnpickledDict(object, object, Py_ssize_t) except -1 + * def __pyx_unpickle_Enum(__pyx_type, long __pyx_checksum, tuple __pyx_state): # <<<<<<<<<<<<<< + * cdef object __pyx_result + * __Pyx_CheckUnpickleChecksum(__pyx_checksum, 0x82a3537, 0x6ae9995, 0xb068931, b'name') +*/ + + /* function exit code */ + __pyx_L1_error:; + __Pyx_XDECREF(__pyx_t_2); + __Pyx_XDECREF(__pyx_t_3); + __Pyx_AddTraceback("View.MemoryView.__pyx_unpickle_Enum", __pyx_clineno, __pyx_lineno, __pyx_filename); + __pyx_r = NULL; + __pyx_L0:; + __Pyx_XDECREF(__pyx_v___pyx_result); + __Pyx_XGIVEREF(__pyx_r); + __Pyx_RefNannyFinishContext(); + return __pyx_r; +} + +/* "(tree fragment)":11 + * __pyx_unpickle_Enum__set_state( __pyx_result, __pyx_state) + * return __pyx_result + * cdef __pyx_unpickle_Enum__set_state(Enum __pyx_result, __pyx_state: tuple): # <<<<<<<<<<<<<< + * __pyx_result.name = __pyx_state[0] + * __Pyx_UpdateUnpickledDict(__pyx_result, __pyx_state, 1) +*/ + +static PyObject *__pyx_unpickle_Enum__set_state(struct __pyx_MemviewEnum_obj *__pyx_v___pyx_result, PyObject *__pyx_v___pyx_state) { + PyObject *__pyx_r = NULL; + __Pyx_RefNannyDeclarations + PyObject *__pyx_t_1 = NULL; + int __pyx_t_2; + int __pyx_lineno = 0; + const char *__pyx_filename = NULL; + int __pyx_clineno = 0; + __Pyx_RefNannySetupContext("__pyx_unpickle_Enum__set_state", 0); + + /* "(tree fragment)":12 + * return __pyx_result + * cdef __pyx_unpickle_Enum__set_state(Enum __pyx_result, __pyx_state: tuple): + * __pyx_result.name = __pyx_state[0] # <<<<<<<<<<<<<< + * __Pyx_UpdateUnpickledDict(__pyx_result, __pyx_state, 1) +*/ + __pyx_t_1 = __Pyx_GetItemInt_Tuple(__pyx_v___pyx_state, 0, long, 1, __Pyx_PyLong_From_long, 0, 0, 1, 1, __Pyx_ReferenceSharing_FunctionArgument); if (unlikely(!__pyx_t_1)) __PYX_ERR(1, 12, __pyx_L1_error) + __Pyx_GOTREF(__pyx_t_1); + __Pyx_GIVEREF(__pyx_t_1); + __Pyx_GOTREF(__pyx_v___pyx_result->name); + __Pyx_DECREF(__pyx_v___pyx_result->name); + __pyx_v___pyx_result->name = __pyx_t_1; + __pyx_t_1 = 0; + + /* "(tree fragment)":13 + * cdef __pyx_unpickle_Enum__set_state(Enum __pyx_result, __pyx_state: tuple): + * __pyx_result.name = __pyx_state[0] + * __Pyx_UpdateUnpickledDict(__pyx_result, __pyx_state, 1) # <<<<<<<<<<<<<< +*/ + __pyx_t_2 = __Pyx_UpdateUnpickledDict(((PyObject *)__pyx_v___pyx_result), __pyx_v___pyx_state, 1); if (unlikely(__pyx_t_2 == ((int)-1))) __PYX_ERR(1, 13, __pyx_L1_error) + + /* "(tree fragment)":11 + * __pyx_unpickle_Enum__set_state( __pyx_result, __pyx_state) + * return __pyx_result + * cdef __pyx_unpickle_Enum__set_state(Enum __pyx_result, __pyx_state: tuple): # <<<<<<<<<<<<<< + * __pyx_result.name = __pyx_state[0] + * __Pyx_UpdateUnpickledDict(__pyx_result, __pyx_state, 1) +*/ + + /* function exit code */ + __pyx_r = Py_None; __Pyx_INCREF(Py_None); + goto __pyx_L0; + __pyx_L1_error:; + __Pyx_XDECREF(__pyx_t_1); + __Pyx_AddTraceback("View.MemoryView.__pyx_unpickle_Enum__set_state", __pyx_clineno, __pyx_lineno, __pyx_filename); + __pyx_r = 0; + __pyx_L0:; + __Pyx_XGIVEREF(__pyx_r); + __Pyx_RefNannyFinishContext(); + return __pyx_r; +} + +/* "C:/Users/runneradmin/AppData/Local/Temp/build-env-ej_q3m8u/Lib/site-packages/numpy/__init__.cython-30.pxd":242 + * cdef int type_num + * + * @property # <<<<<<<<<<<<<< + * cdef inline npy_intp itemsize(self) noexcept nogil: + * return PyDataType_ELSIZE(self) +*/ + +static CYTHON_INLINE npy_intp __pyx_f_5numpy_5dtype_8itemsize_itemsize(PyArray_Descr *__pyx_v_self) { + npy_intp __pyx_r; + + /* "C:/Users/runneradmin/AppData/Local/Temp/build-env-ej_q3m8u/Lib/site-packages/numpy/__init__.cython-30.pxd":244 + * @property + * cdef inline npy_intp itemsize(self) noexcept nogil: + * return PyDataType_ELSIZE(self) # <<<<<<<<<<<<<< + * + * @property +*/ + __pyx_r = PyDataType_ELSIZE(__pyx_v_self); + goto __pyx_L0; + + /* "C:/Users/runneradmin/AppData/Local/Temp/build-env-ej_q3m8u/Lib/site-packages/numpy/__init__.cython-30.pxd":242 + * cdef int type_num + * + * @property # <<<<<<<<<<<<<< + * cdef inline npy_intp itemsize(self) noexcept nogil: + * return PyDataType_ELSIZE(self) +*/ + + /* function exit code */ + __pyx_L0:; + return __pyx_r; +} + +/* "C:/Users/runneradmin/AppData/Local/Temp/build-env-ej_q3m8u/Lib/site-packages/numpy/__init__.cython-30.pxd":246 + * return PyDataType_ELSIZE(self) + * + * @property # <<<<<<<<<<<<<< + * cdef inline npy_intp alignment(self) noexcept nogil: + * return PyDataType_ALIGNMENT(self) +*/ + +static CYTHON_INLINE npy_intp __pyx_f_5numpy_5dtype_9alignment_alignment(PyArray_Descr *__pyx_v_self) { + npy_intp __pyx_r; + + /* "C:/Users/runneradmin/AppData/Local/Temp/build-env-ej_q3m8u/Lib/site-packages/numpy/__init__.cython-30.pxd":248 + * @property + * cdef inline npy_intp alignment(self) noexcept nogil: + * return PyDataType_ALIGNMENT(self) # <<<<<<<<<<<<<< + * + * # Use fields/names with care as they may be NULL. You must check +*/ + __pyx_r = PyDataType_ALIGNMENT(__pyx_v_self); + goto __pyx_L0; + + /* "C:/Users/runneradmin/AppData/Local/Temp/build-env-ej_q3m8u/Lib/site-packages/numpy/__init__.cython-30.pxd":246 + * return PyDataType_ELSIZE(self) + * + * @property # <<<<<<<<<<<<<< + * cdef inline npy_intp alignment(self) noexcept nogil: + * return PyDataType_ALIGNMENT(self) +*/ + + /* function exit code */ + __pyx_L0:; + return __pyx_r; +} + +/* "C:/Users/runneradmin/AppData/Local/Temp/build-env-ej_q3m8u/Lib/site-packages/numpy/__init__.cython-30.pxd":252 + * # Use fields/names with care as they may be NULL. You must check + * # for this using PyDataType_HASFIELDS. + * @property # <<<<<<<<<<<<<< + * cdef inline object fields(self): + * return PyDataType_FIELDS(self) +*/ + +static CYTHON_INLINE PyObject *__pyx_f_5numpy_5dtype_6fields_fields(PyArray_Descr *__pyx_v_self) { + PyObject *__pyx_r = NULL; + __Pyx_RefNannyDeclarations + PyObject *__pyx_t_1; + __Pyx_RefNannySetupContext("fields", 0); + + /* "C:/Users/runneradmin/AppData/Local/Temp/build-env-ej_q3m8u/Lib/site-packages/numpy/__init__.cython-30.pxd":254 + * @property + * cdef inline object fields(self): + * return PyDataType_FIELDS(self) # <<<<<<<<<<<<<< + * + * @property +*/ + __Pyx_XDECREF(__pyx_r); + __pyx_t_1 = PyDataType_FIELDS(__pyx_v_self); + __Pyx_INCREF(((PyObject *)__pyx_t_1)); + __pyx_r = ((PyObject *)__pyx_t_1); + goto __pyx_L0; + + /* "C:/Users/runneradmin/AppData/Local/Temp/build-env-ej_q3m8u/Lib/site-packages/numpy/__init__.cython-30.pxd":252 + * # Use fields/names with care as they may be NULL. You must check + * # for this using PyDataType_HASFIELDS. + * @property # <<<<<<<<<<<<<< + * cdef inline object fields(self): + * return PyDataType_FIELDS(self) +*/ + + /* function exit code */ + __pyx_L0:; + __Pyx_XGIVEREF(__pyx_r); + __Pyx_RefNannyFinishContext(); + return __pyx_r; +} + +/* "C:/Users/runneradmin/AppData/Local/Temp/build-env-ej_q3m8u/Lib/site-packages/numpy/__init__.cython-30.pxd":256 + * return PyDataType_FIELDS(self) + * + * @property # <<<<<<<<<<<<<< + * cdef inline tuple names(self): + * return PyDataType_NAMES(self) +*/ + +static CYTHON_INLINE PyObject *__pyx_f_5numpy_5dtype_5names_names(PyArray_Descr *__pyx_v_self) { + PyObject *__pyx_r = NULL; + __Pyx_RefNannyDeclarations + PyObject *__pyx_t_1; + __Pyx_RefNannySetupContext("names", 0); + + /* "C:/Users/runneradmin/AppData/Local/Temp/build-env-ej_q3m8u/Lib/site-packages/numpy/__init__.cython-30.pxd":258 + * @property + * cdef inline tuple names(self): + * return PyDataType_NAMES(self) # <<<<<<<<<<<<<< + * + * # Use PyDataType_HASSUBARRAY to test whether this field is +*/ + __Pyx_XDECREF(__pyx_r); + __pyx_t_1 = PyDataType_NAMES(__pyx_v_self); + __Pyx_INCREF(((PyObject*)__pyx_t_1)); + __pyx_r = ((PyObject*)__pyx_t_1); + goto __pyx_L0; + + /* "C:/Users/runneradmin/AppData/Local/Temp/build-env-ej_q3m8u/Lib/site-packages/numpy/__init__.cython-30.pxd":256 + * return PyDataType_FIELDS(self) + * + * @property # <<<<<<<<<<<<<< + * cdef inline tuple names(self): + * return PyDataType_NAMES(self) +*/ + + /* function exit code */ + __pyx_L0:; + __Pyx_XGIVEREF(__pyx_r); + __Pyx_RefNannyFinishContext(); + return __pyx_r; +} + +/* "C:/Users/runneradmin/AppData/Local/Temp/build-env-ej_q3m8u/Lib/site-packages/numpy/__init__.cython-30.pxd":263 + * # valid (the pointer can be NULL). Most users should access + * # this field via the inline helper method PyDataType_SHAPE. + * @property # <<<<<<<<<<<<<< + * cdef inline PyArray_ArrayDescr* subarray(self) noexcept nogil: + * return PyDataType_SUBARRAY(self) +*/ + +static CYTHON_INLINE PyArray_ArrayDescr *__pyx_f_5numpy_5dtype_8subarray_subarray(PyArray_Descr *__pyx_v_self) { + PyArray_ArrayDescr *__pyx_r; + + /* "C:/Users/runneradmin/AppData/Local/Temp/build-env-ej_q3m8u/Lib/site-packages/numpy/__init__.cython-30.pxd":265 + * @property + * cdef inline PyArray_ArrayDescr* subarray(self) noexcept nogil: + * return PyDataType_SUBARRAY(self) # <<<<<<<<<<<<<< + * + * @property +*/ + __pyx_r = PyDataType_SUBARRAY(__pyx_v_self); + goto __pyx_L0; + + /* "C:/Users/runneradmin/AppData/Local/Temp/build-env-ej_q3m8u/Lib/site-packages/numpy/__init__.cython-30.pxd":263 + * # valid (the pointer can be NULL). Most users should access + * # this field via the inline helper method PyDataType_SHAPE. + * @property # <<<<<<<<<<<<<< + * cdef inline PyArray_ArrayDescr* subarray(self) noexcept nogil: + * return PyDataType_SUBARRAY(self) +*/ + + /* function exit code */ + __pyx_L0:; + return __pyx_r; +} + +/* "C:/Users/runneradmin/AppData/Local/Temp/build-env-ej_q3m8u/Lib/site-packages/numpy/__init__.cython-30.pxd":267 + * return PyDataType_SUBARRAY(self) + * + * @property # <<<<<<<<<<<<<< + * cdef inline npy_uint64 flags(self) noexcept nogil: + * """The data types flags.""" +*/ + +static CYTHON_INLINE npy_uint64 __pyx_f_5numpy_5dtype_5flags_flags(PyArray_Descr *__pyx_v_self) { + npy_uint64 __pyx_r; + + /* "C:/Users/runneradmin/AppData/Local/Temp/build-env-ej_q3m8u/Lib/site-packages/numpy/__init__.cython-30.pxd":270 + * cdef inline npy_uint64 flags(self) noexcept nogil: + * """The data types flags.""" + * return PyDataType_FLAGS(self) # <<<<<<<<<<<<<< + * + * +*/ + __pyx_r = PyDataType_FLAGS(__pyx_v_self); + goto __pyx_L0; + + /* "C:/Users/runneradmin/AppData/Local/Temp/build-env-ej_q3m8u/Lib/site-packages/numpy/__init__.cython-30.pxd":267 + * return PyDataType_SUBARRAY(self) + * + * @property # <<<<<<<<<<<<<< + * cdef inline npy_uint64 flags(self) noexcept nogil: + * """The data types flags.""" +*/ + + /* function exit code */ + __pyx_L0:; + return __pyx_r; +} + +/* "C:/Users/runneradmin/AppData/Local/Temp/build-env-ej_q3m8u/Lib/site-packages/numpy/__init__.cython-30.pxd":279 + * ctypedef class numpy.broadcast [object PyArrayMultiIterObject, check_size ignore]: + * + * @property # <<<<<<<<<<<<<< + * cdef inline int numiter(self) noexcept nogil: + * """The number of arrays that need to be broadcast to the same shape.""" +*/ + +static CYTHON_INLINE int __pyx_f_5numpy_9broadcast_7numiter_numiter(PyArrayMultiIterObject *__pyx_v_self) { + int __pyx_r; + + /* "C:/Users/runneradmin/AppData/Local/Temp/build-env-ej_q3m8u/Lib/site-packages/numpy/__init__.cython-30.pxd":282 + * cdef inline int numiter(self) noexcept nogil: + * """The number of arrays that need to be broadcast to the same shape.""" + * return PyArray_MultiIter_NUMITER(self) # <<<<<<<<<<<<<< + * + * @property +*/ + __pyx_r = PyArray_MultiIter_NUMITER(__pyx_v_self); + goto __pyx_L0; + + /* "C:/Users/runneradmin/AppData/Local/Temp/build-env-ej_q3m8u/Lib/site-packages/numpy/__init__.cython-30.pxd":279 + * ctypedef class numpy.broadcast [object PyArrayMultiIterObject, check_size ignore]: + * + * @property # <<<<<<<<<<<<<< + * cdef inline int numiter(self) noexcept nogil: + * """The number of arrays that need to be broadcast to the same shape.""" +*/ + + /* function exit code */ + __pyx_L0:; + return __pyx_r; +} + +/* "C:/Users/runneradmin/AppData/Local/Temp/build-env-ej_q3m8u/Lib/site-packages/numpy/__init__.cython-30.pxd":284 + * return PyArray_MultiIter_NUMITER(self) + * + * @property # <<<<<<<<<<<<<< + * cdef inline npy_intp size(self) noexcept nogil: + * """The total broadcasted size.""" +*/ + +static CYTHON_INLINE npy_intp __pyx_f_5numpy_9broadcast_4size_size(PyArrayMultiIterObject *__pyx_v_self) { + npy_intp __pyx_r; + + /* "C:/Users/runneradmin/AppData/Local/Temp/build-env-ej_q3m8u/Lib/site-packages/numpy/__init__.cython-30.pxd":287 + * cdef inline npy_intp size(self) noexcept nogil: + * """The total broadcasted size.""" + * return PyArray_MultiIter_SIZE(self) # <<<<<<<<<<<<<< + * + * @property +*/ + __pyx_r = PyArray_MultiIter_SIZE(__pyx_v_self); + goto __pyx_L0; + + /* "C:/Users/runneradmin/AppData/Local/Temp/build-env-ej_q3m8u/Lib/site-packages/numpy/__init__.cython-30.pxd":284 + * return PyArray_MultiIter_NUMITER(self) + * + * @property # <<<<<<<<<<<<<< + * cdef inline npy_intp size(self) noexcept nogil: + * """The total broadcasted size.""" +*/ + + /* function exit code */ + __pyx_L0:; + return __pyx_r; +} + +/* "C:/Users/runneradmin/AppData/Local/Temp/build-env-ej_q3m8u/Lib/site-packages/numpy/__init__.cython-30.pxd":289 + * return PyArray_MultiIter_SIZE(self) + * + * @property # <<<<<<<<<<<<<< + * cdef inline npy_intp index(self) noexcept nogil: + * """The current (1-d) index into the broadcasted result.""" +*/ + +static CYTHON_INLINE npy_intp __pyx_f_5numpy_9broadcast_5index_index(PyArrayMultiIterObject *__pyx_v_self) { + npy_intp __pyx_r; + + /* "C:/Users/runneradmin/AppData/Local/Temp/build-env-ej_q3m8u/Lib/site-packages/numpy/__init__.cython-30.pxd":292 + * cdef inline npy_intp index(self) noexcept nogil: + * """The current (1-d) index into the broadcasted result.""" + * return PyArray_MultiIter_INDEX(self) # <<<<<<<<<<<<<< + * + * @property +*/ + __pyx_r = PyArray_MultiIter_INDEX(__pyx_v_self); + goto __pyx_L0; + + /* "C:/Users/runneradmin/AppData/Local/Temp/build-env-ej_q3m8u/Lib/site-packages/numpy/__init__.cython-30.pxd":289 + * return PyArray_MultiIter_SIZE(self) + * + * @property # <<<<<<<<<<<<<< + * cdef inline npy_intp index(self) noexcept nogil: + * """The current (1-d) index into the broadcasted result.""" +*/ + + /* function exit code */ + __pyx_L0:; + return __pyx_r; +} + +/* "C:/Users/runneradmin/AppData/Local/Temp/build-env-ej_q3m8u/Lib/site-packages/numpy/__init__.cython-30.pxd":294 + * return PyArray_MultiIter_INDEX(self) + * + * @property # <<<<<<<<<<<<<< + * cdef inline int nd(self) noexcept nogil: + * """The number of dimensions in the broadcasted result.""" +*/ + +static CYTHON_INLINE int __pyx_f_5numpy_9broadcast_2nd_nd(PyArrayMultiIterObject *__pyx_v_self) { + int __pyx_r; + + /* "C:/Users/runneradmin/AppData/Local/Temp/build-env-ej_q3m8u/Lib/site-packages/numpy/__init__.cython-30.pxd":297 + * cdef inline int nd(self) noexcept nogil: + * """The number of dimensions in the broadcasted result.""" + * return PyArray_MultiIter_NDIM(self) # <<<<<<<<<<<<<< + * + * @property +*/ + __pyx_r = PyArray_MultiIter_NDIM(__pyx_v_self); + goto __pyx_L0; + + /* "C:/Users/runneradmin/AppData/Local/Temp/build-env-ej_q3m8u/Lib/site-packages/numpy/__init__.cython-30.pxd":294 + * return PyArray_MultiIter_INDEX(self) + * + * @property # <<<<<<<<<<<<<< + * cdef inline int nd(self) noexcept nogil: + * """The number of dimensions in the broadcasted result.""" +*/ + + /* function exit code */ + __pyx_L0:; + return __pyx_r; +} + +/* "C:/Users/runneradmin/AppData/Local/Temp/build-env-ej_q3m8u/Lib/site-packages/numpy/__init__.cython-30.pxd":299 + * return PyArray_MultiIter_NDIM(self) + * + * @property # <<<<<<<<<<<<<< + * cdef inline npy_intp* dimensions(self) noexcept nogil: + * """The shape of the broadcasted result.""" +*/ + +static CYTHON_INLINE npy_intp *__pyx_f_5numpy_9broadcast_10dimensions_dimensions(PyArrayMultiIterObject *__pyx_v_self) { + npy_intp *__pyx_r; + + /* "C:/Users/runneradmin/AppData/Local/Temp/build-env-ej_q3m8u/Lib/site-packages/numpy/__init__.cython-30.pxd":302 + * cdef inline npy_intp* dimensions(self) noexcept nogil: + * """The shape of the broadcasted result.""" + * return PyArray_MultiIter_DIMS(self) # <<<<<<<<<<<<<< + * + * @property +*/ + __pyx_r = PyArray_MultiIter_DIMS(__pyx_v_self); + goto __pyx_L0; + + /* "C:/Users/runneradmin/AppData/Local/Temp/build-env-ej_q3m8u/Lib/site-packages/numpy/__init__.cython-30.pxd":299 + * return PyArray_MultiIter_NDIM(self) + * + * @property # <<<<<<<<<<<<<< + * cdef inline npy_intp* dimensions(self) noexcept nogil: + * """The shape of the broadcasted result.""" +*/ + + /* function exit code */ + __pyx_L0:; + return __pyx_r; +} + +/* "C:/Users/runneradmin/AppData/Local/Temp/build-env-ej_q3m8u/Lib/site-packages/numpy/__init__.cython-30.pxd":304 + * return PyArray_MultiIter_DIMS(self) + * + * @property # <<<<<<<<<<<<<< + * cdef inline void** iters(self) noexcept nogil: + * """An array of iterator objects that holds the iterators for the arrays to be broadcast together. +*/ + +static CYTHON_INLINE void **__pyx_f_5numpy_9broadcast_5iters_iters(PyArrayMultiIterObject *__pyx_v_self) { + void **__pyx_r; + + /* "C:/Users/runneradmin/AppData/Local/Temp/build-env-ej_q3m8u/Lib/site-packages/numpy/__init__.cython-30.pxd":308 + * """An array of iterator objects that holds the iterators for the arrays to be broadcast together. + * On return, the iterators are adjusted for broadcasting.""" + * return PyArray_MultiIter_ITERS(self) # <<<<<<<<<<<<<< + * + * +*/ + __pyx_r = PyArray_MultiIter_ITERS(__pyx_v_self); + goto __pyx_L0; + + /* "C:/Users/runneradmin/AppData/Local/Temp/build-env-ej_q3m8u/Lib/site-packages/numpy/__init__.cython-30.pxd":304 + * return PyArray_MultiIter_DIMS(self) + * + * @property # <<<<<<<<<<<<<< + * cdef inline void** iters(self) noexcept nogil: + * """An array of iterator objects that holds the iterators for the arrays to be broadcast together. +*/ + + /* function exit code */ + __pyx_L0:; + return __pyx_r; +} + +/* "C:/Users/runneradmin/AppData/Local/Temp/build-env-ej_q3m8u/Lib/site-packages/numpy/__init__.cython-30.pxd":322 + * # Instead, we use properties that map to the corresponding C-API functions. + * + * @property # <<<<<<<<<<<<<< + * cdef inline PyObject* base(self) noexcept nogil: + * """Returns a borrowed reference to the object owning the data/memory. +*/ + +static CYTHON_INLINE PyObject *__pyx_f_5numpy_7ndarray_4base_base(PyArrayObject *__pyx_v_self) { + PyObject *__pyx_r; + + /* "C:/Users/runneradmin/AppData/Local/Temp/build-env-ej_q3m8u/Lib/site-packages/numpy/__init__.cython-30.pxd":326 + * """Returns a borrowed reference to the object owning the data/memory. + * """ + * return PyArray_BASE(self) # <<<<<<<<<<<<<< + * + * @property +*/ + __pyx_r = PyArray_BASE(__pyx_v_self); + goto __pyx_L0; + + /* "C:/Users/runneradmin/AppData/Local/Temp/build-env-ej_q3m8u/Lib/site-packages/numpy/__init__.cython-30.pxd":322 + * # Instead, we use properties that map to the corresponding C-API functions. + * + * @property # <<<<<<<<<<<<<< + * cdef inline PyObject* base(self) noexcept nogil: + * """Returns a borrowed reference to the object owning the data/memory. +*/ + + /* function exit code */ + __pyx_L0:; + return __pyx_r; +} + +/* "C:/Users/runneradmin/AppData/Local/Temp/build-env-ej_q3m8u/Lib/site-packages/numpy/__init__.cython-30.pxd":328 + * return PyArray_BASE(self) + * + * @property # <<<<<<<<<<<<<< + * cdef inline dtype descr(self): + * """Returns an owned reference to the dtype of the array. +*/ + +static CYTHON_INLINE PyArray_Descr *__pyx_f_5numpy_7ndarray_5descr_descr(PyArrayObject *__pyx_v_self) { + PyArray_Descr *__pyx_r = NULL; + __Pyx_RefNannyDeclarations + PyArray_Descr *__pyx_t_1; + __Pyx_RefNannySetupContext("descr", 0); + + /* "C:/Users/runneradmin/AppData/Local/Temp/build-env-ej_q3m8u/Lib/site-packages/numpy/__init__.cython-30.pxd":332 + * """Returns an owned reference to the dtype of the array. + * """ + * return PyArray_DESCR(self) # <<<<<<<<<<<<<< + * + * @property +*/ + __Pyx_XDECREF((PyObject *)__pyx_r); + __pyx_t_1 = PyArray_DESCR(__pyx_v_self); + __Pyx_INCREF((PyObject *)((PyArray_Descr *)__pyx_t_1)); + __pyx_r = ((PyArray_Descr *)__pyx_t_1); + goto __pyx_L0; + + /* "C:/Users/runneradmin/AppData/Local/Temp/build-env-ej_q3m8u/Lib/site-packages/numpy/__init__.cython-30.pxd":328 + * return PyArray_BASE(self) + * + * @property # <<<<<<<<<<<<<< + * cdef inline dtype descr(self): + * """Returns an owned reference to the dtype of the array. +*/ + + /* function exit code */ + __pyx_L0:; + __Pyx_XGIVEREF((PyObject *)__pyx_r); + __Pyx_RefNannyFinishContext(); + return __pyx_r; +} + +/* "C:/Users/runneradmin/AppData/Local/Temp/build-env-ej_q3m8u/Lib/site-packages/numpy/__init__.cython-30.pxd":334 + * return PyArray_DESCR(self) + * + * @property # <<<<<<<<<<<<<< + * cdef inline int ndim(self) noexcept nogil: + * """Returns the number of dimensions in the array. +*/ + +static CYTHON_INLINE int __pyx_f_5numpy_7ndarray_4ndim_ndim(PyArrayObject *__pyx_v_self) { + int __pyx_r; + + /* "C:/Users/runneradmin/AppData/Local/Temp/build-env-ej_q3m8u/Lib/site-packages/numpy/__init__.cython-30.pxd":338 + * """Returns the number of dimensions in the array. + * """ + * return PyArray_NDIM(self) # <<<<<<<<<<<<<< + * + * @property +*/ + __pyx_r = PyArray_NDIM(__pyx_v_self); + goto __pyx_L0; + + /* "C:/Users/runneradmin/AppData/Local/Temp/build-env-ej_q3m8u/Lib/site-packages/numpy/__init__.cython-30.pxd":334 + * return PyArray_DESCR(self) + * + * @property # <<<<<<<<<<<<<< + * cdef inline int ndim(self) noexcept nogil: + * """Returns the number of dimensions in the array. +*/ + + /* function exit code */ + __pyx_L0:; + return __pyx_r; +} + +/* "C:/Users/runneradmin/AppData/Local/Temp/build-env-ej_q3m8u/Lib/site-packages/numpy/__init__.cython-30.pxd":340 + * return PyArray_NDIM(self) + * + * @property # <<<<<<<<<<<<<< + * cdef inline npy_intp *shape(self) noexcept nogil: + * """Returns a pointer to the dimensions/shape of the array. +*/ + +static CYTHON_INLINE npy_intp *__pyx_f_5numpy_7ndarray_5shape_shape(PyArrayObject *__pyx_v_self) { + npy_intp *__pyx_r; + + /* "C:/Users/runneradmin/AppData/Local/Temp/build-env-ej_q3m8u/Lib/site-packages/numpy/__init__.cython-30.pxd":346 + * Can return NULL for 0-dimensional arrays. + * """ + * return PyArray_DIMS(self) # <<<<<<<<<<<<<< + * + * @property +*/ + __pyx_r = PyArray_DIMS(__pyx_v_self); + goto __pyx_L0; + + /* "C:/Users/runneradmin/AppData/Local/Temp/build-env-ej_q3m8u/Lib/site-packages/numpy/__init__.cython-30.pxd":340 + * return PyArray_NDIM(self) + * + * @property # <<<<<<<<<<<<<< + * cdef inline npy_intp *shape(self) noexcept nogil: + * """Returns a pointer to the dimensions/shape of the array. +*/ + + /* function exit code */ + __pyx_L0:; + return __pyx_r; +} + +/* "C:/Users/runneradmin/AppData/Local/Temp/build-env-ej_q3m8u/Lib/site-packages/numpy/__init__.cython-30.pxd":348 + * return PyArray_DIMS(self) + * + * @property # <<<<<<<<<<<<<< + * cdef inline npy_intp *strides(self) noexcept nogil: + * """Returns a pointer to the strides of the array. +*/ + +static CYTHON_INLINE npy_intp *__pyx_f_5numpy_7ndarray_7strides_strides(PyArrayObject *__pyx_v_self) { + npy_intp *__pyx_r; + + /* "C:/Users/runneradmin/AppData/Local/Temp/build-env-ej_q3m8u/Lib/site-packages/numpy/__init__.cython-30.pxd":353 + * The number of elements matches the number of dimensions of the array (ndim). + * """ + * return PyArray_STRIDES(self) # <<<<<<<<<<<<<< + * + * @property +*/ + __pyx_r = PyArray_STRIDES(__pyx_v_self); + goto __pyx_L0; + + /* "C:/Users/runneradmin/AppData/Local/Temp/build-env-ej_q3m8u/Lib/site-packages/numpy/__init__.cython-30.pxd":348 + * return PyArray_DIMS(self) + * + * @property # <<<<<<<<<<<<<< + * cdef inline npy_intp *strides(self) noexcept nogil: + * """Returns a pointer to the strides of the array. +*/ + + /* function exit code */ + __pyx_L0:; + return __pyx_r; +} + +/* "C:/Users/runneradmin/AppData/Local/Temp/build-env-ej_q3m8u/Lib/site-packages/numpy/__init__.cython-30.pxd":355 + * return PyArray_STRIDES(self) + * + * @property # <<<<<<<<<<<<<< + * cdef inline npy_intp size(self) noexcept nogil: + * """Returns the total size (in number of elements) of the array. +*/ + +static CYTHON_INLINE npy_intp __pyx_f_5numpy_7ndarray_4size_size(PyArrayObject *__pyx_v_self) { + npy_intp __pyx_r; + + /* "C:/Users/runneradmin/AppData/Local/Temp/build-env-ej_q3m8u/Lib/site-packages/numpy/__init__.cython-30.pxd":359 + * """Returns the total size (in number of elements) of the array. + * """ + * return PyArray_SIZE(self) # <<<<<<<<<<<<<< + * + * @property +*/ + __pyx_r = PyArray_SIZE(__pyx_v_self); + goto __pyx_L0; + + /* "C:/Users/runneradmin/AppData/Local/Temp/build-env-ej_q3m8u/Lib/site-packages/numpy/__init__.cython-30.pxd":355 + * return PyArray_STRIDES(self) + * + * @property # <<<<<<<<<<<<<< + * cdef inline npy_intp size(self) noexcept nogil: + * """Returns the total size (in number of elements) of the array. +*/ + + /* function exit code */ + __pyx_L0:; + return __pyx_r; +} + +/* "C:/Users/runneradmin/AppData/Local/Temp/build-env-ej_q3m8u/Lib/site-packages/numpy/__init__.cython-30.pxd":361 + * return PyArray_SIZE(self) + * + * @property # <<<<<<<<<<<<<< + * cdef inline char* data(self) noexcept nogil: + * """The pointer to the data buffer as a char*. +*/ + +static CYTHON_INLINE char *__pyx_f_5numpy_7ndarray_4data_data(PyArrayObject *__pyx_v_self) { + char *__pyx_r; + + /* "C:/Users/runneradmin/AppData/Local/Temp/build-env-ej_q3m8u/Lib/site-packages/numpy/__init__.cython-30.pxd":368 + * of `PyArray_DATA()` instead, which returns a 'void*'. + * """ + * return PyArray_BYTES(self) # <<<<<<<<<<<<<< + * + * +*/ + __pyx_r = PyArray_BYTES(__pyx_v_self); + goto __pyx_L0; + + /* "C:/Users/runneradmin/AppData/Local/Temp/build-env-ej_q3m8u/Lib/site-packages/numpy/__init__.cython-30.pxd":361 + * return PyArray_SIZE(self) + * + * @property # <<<<<<<<<<<<<< + * cdef inline char* data(self) noexcept nogil: + * """The pointer to the data buffer as a char*. +*/ + + /* function exit code */ + __pyx_L0:; + return __pyx_r; +} + +/* "C:/Users/runneradmin/AppData/Local/Temp/build-env-ej_q3m8u/Lib/site-packages/numpy/__init__.cython-30.pxd":776 + * ctypedef long double complex clongdouble_t + * + * cdef inline object PyArray_MultiIterNew1(a): # <<<<<<<<<<<<<< + * return PyArray_MultiIterNew(1, a) + * +*/ + +static CYTHON_INLINE PyObject *__pyx_f_5numpy_PyArray_MultiIterNew1(PyObject *__pyx_v_a) { + PyObject *__pyx_r = NULL; + __Pyx_RefNannyDeclarations + PyObject *__pyx_t_1 = NULL; + int __pyx_lineno = 0; + const char *__pyx_filename = NULL; + int __pyx_clineno = 0; + __Pyx_RefNannySetupContext("PyArray_MultiIterNew1", 0); + + /* "C:/Users/runneradmin/AppData/Local/Temp/build-env-ej_q3m8u/Lib/site-packages/numpy/__init__.cython-30.pxd":777 + * + * cdef inline object PyArray_MultiIterNew1(a): + * return PyArray_MultiIterNew(1, a) # <<<<<<<<<<<<<< + * + * cdef inline object PyArray_MultiIterNew2(a, b): +*/ + __Pyx_XDECREF(__pyx_r); + __pyx_t_1 = PyArray_MultiIterNew(1, ((void *)__pyx_v_a)); if (unlikely(!__pyx_t_1)) __PYX_ERR(2, 777, __pyx_L1_error) + __Pyx_GOTREF(__pyx_t_1); + __pyx_r = __pyx_t_1; + __pyx_t_1 = 0; + goto __pyx_L0; + + /* "C:/Users/runneradmin/AppData/Local/Temp/build-env-ej_q3m8u/Lib/site-packages/numpy/__init__.cython-30.pxd":776 + * ctypedef long double complex clongdouble_t + * + * cdef inline object PyArray_MultiIterNew1(a): # <<<<<<<<<<<<<< + * return PyArray_MultiIterNew(1, a) + * +*/ + + /* function exit code */ + __pyx_L1_error:; + __Pyx_XDECREF(__pyx_t_1); + __Pyx_AddTraceback("numpy.PyArray_MultiIterNew1", __pyx_clineno, __pyx_lineno, __pyx_filename); + __pyx_r = 0; + __pyx_L0:; + __Pyx_XGIVEREF(__pyx_r); + __Pyx_RefNannyFinishContext(); + return __pyx_r; +} + +/* "C:/Users/runneradmin/AppData/Local/Temp/build-env-ej_q3m8u/Lib/site-packages/numpy/__init__.cython-30.pxd":779 + * return PyArray_MultiIterNew(1, a) + * + * cdef inline object PyArray_MultiIterNew2(a, b): # <<<<<<<<<<<<<< + * return PyArray_MultiIterNew(2, a, b) + * +*/ + +static CYTHON_INLINE PyObject *__pyx_f_5numpy_PyArray_MultiIterNew2(PyObject *__pyx_v_a, PyObject *__pyx_v_b) { + PyObject *__pyx_r = NULL; + __Pyx_RefNannyDeclarations + PyObject *__pyx_t_1 = NULL; + int __pyx_lineno = 0; + const char *__pyx_filename = NULL; + int __pyx_clineno = 0; + __Pyx_RefNannySetupContext("PyArray_MultiIterNew2", 0); + + /* "C:/Users/runneradmin/AppData/Local/Temp/build-env-ej_q3m8u/Lib/site-packages/numpy/__init__.cython-30.pxd":780 + * + * cdef inline object PyArray_MultiIterNew2(a, b): + * return PyArray_MultiIterNew(2, a, b) # <<<<<<<<<<<<<< + * + * cdef inline object PyArray_MultiIterNew3(a, b, c): +*/ + __Pyx_XDECREF(__pyx_r); + __pyx_t_1 = PyArray_MultiIterNew(2, ((void *)__pyx_v_a), ((void *)__pyx_v_b)); if (unlikely(!__pyx_t_1)) __PYX_ERR(2, 780, __pyx_L1_error) + __Pyx_GOTREF(__pyx_t_1); + __pyx_r = __pyx_t_1; + __pyx_t_1 = 0; + goto __pyx_L0; + + /* "C:/Users/runneradmin/AppData/Local/Temp/build-env-ej_q3m8u/Lib/site-packages/numpy/__init__.cython-30.pxd":779 + * return PyArray_MultiIterNew(1, a) + * + * cdef inline object PyArray_MultiIterNew2(a, b): # <<<<<<<<<<<<<< + * return PyArray_MultiIterNew(2, a, b) + * +*/ + + /* function exit code */ + __pyx_L1_error:; + __Pyx_XDECREF(__pyx_t_1); + __Pyx_AddTraceback("numpy.PyArray_MultiIterNew2", __pyx_clineno, __pyx_lineno, __pyx_filename); + __pyx_r = 0; + __pyx_L0:; + __Pyx_XGIVEREF(__pyx_r); + __Pyx_RefNannyFinishContext(); + return __pyx_r; +} + +/* "C:/Users/runneradmin/AppData/Local/Temp/build-env-ej_q3m8u/Lib/site-packages/numpy/__init__.cython-30.pxd":782 + * return PyArray_MultiIterNew(2, a, b) + * + * cdef inline object PyArray_MultiIterNew3(a, b, c): # <<<<<<<<<<<<<< + * return PyArray_MultiIterNew(3, a, b, c) + * +*/ + +static CYTHON_INLINE PyObject *__pyx_f_5numpy_PyArray_MultiIterNew3(PyObject *__pyx_v_a, PyObject *__pyx_v_b, PyObject *__pyx_v_c) { + PyObject *__pyx_r = NULL; + __Pyx_RefNannyDeclarations + PyObject *__pyx_t_1 = NULL; + int __pyx_lineno = 0; + const char *__pyx_filename = NULL; + int __pyx_clineno = 0; + __Pyx_RefNannySetupContext("PyArray_MultiIterNew3", 0); + + /* "C:/Users/runneradmin/AppData/Local/Temp/build-env-ej_q3m8u/Lib/site-packages/numpy/__init__.cython-30.pxd":783 + * + * cdef inline object PyArray_MultiIterNew3(a, b, c): + * return PyArray_MultiIterNew(3, a, b, c) # <<<<<<<<<<<<<< + * + * cdef inline object PyArray_MultiIterNew4(a, b, c, d): +*/ + __Pyx_XDECREF(__pyx_r); + __pyx_t_1 = PyArray_MultiIterNew(3, ((void *)__pyx_v_a), ((void *)__pyx_v_b), ((void *)__pyx_v_c)); if (unlikely(!__pyx_t_1)) __PYX_ERR(2, 783, __pyx_L1_error) + __Pyx_GOTREF(__pyx_t_1); + __pyx_r = __pyx_t_1; + __pyx_t_1 = 0; + goto __pyx_L0; + + /* "C:/Users/runneradmin/AppData/Local/Temp/build-env-ej_q3m8u/Lib/site-packages/numpy/__init__.cython-30.pxd":782 + * return PyArray_MultiIterNew(2, a, b) + * + * cdef inline object PyArray_MultiIterNew3(a, b, c): # <<<<<<<<<<<<<< + * return PyArray_MultiIterNew(3, a, b, c) + * +*/ + + /* function exit code */ + __pyx_L1_error:; + __Pyx_XDECREF(__pyx_t_1); + __Pyx_AddTraceback("numpy.PyArray_MultiIterNew3", __pyx_clineno, __pyx_lineno, __pyx_filename); + __pyx_r = 0; + __pyx_L0:; + __Pyx_XGIVEREF(__pyx_r); + __Pyx_RefNannyFinishContext(); + return __pyx_r; +} + +/* "C:/Users/runneradmin/AppData/Local/Temp/build-env-ej_q3m8u/Lib/site-packages/numpy/__init__.cython-30.pxd":785 + * return PyArray_MultiIterNew(3, a, b, c) + * + * cdef inline object PyArray_MultiIterNew4(a, b, c, d): # <<<<<<<<<<<<<< + * return PyArray_MultiIterNew(4, a, b, c, d) + * +*/ + +static CYTHON_INLINE PyObject *__pyx_f_5numpy_PyArray_MultiIterNew4(PyObject *__pyx_v_a, PyObject *__pyx_v_b, PyObject *__pyx_v_c, PyObject *__pyx_v_d) { + PyObject *__pyx_r = NULL; + __Pyx_RefNannyDeclarations + PyObject *__pyx_t_1 = NULL; + int __pyx_lineno = 0; + const char *__pyx_filename = NULL; + int __pyx_clineno = 0; + __Pyx_RefNannySetupContext("PyArray_MultiIterNew4", 0); + + /* "C:/Users/runneradmin/AppData/Local/Temp/build-env-ej_q3m8u/Lib/site-packages/numpy/__init__.cython-30.pxd":786 + * + * cdef inline object PyArray_MultiIterNew4(a, b, c, d): + * return PyArray_MultiIterNew(4, a, b, c, d) # <<<<<<<<<<<<<< + * + * cdef inline object PyArray_MultiIterNew5(a, b, c, d, e): +*/ + __Pyx_XDECREF(__pyx_r); + __pyx_t_1 = PyArray_MultiIterNew(4, ((void *)__pyx_v_a), ((void *)__pyx_v_b), ((void *)__pyx_v_c), ((void *)__pyx_v_d)); if (unlikely(!__pyx_t_1)) __PYX_ERR(2, 786, __pyx_L1_error) + __Pyx_GOTREF(__pyx_t_1); + __pyx_r = __pyx_t_1; + __pyx_t_1 = 0; + goto __pyx_L0; + + /* "C:/Users/runneradmin/AppData/Local/Temp/build-env-ej_q3m8u/Lib/site-packages/numpy/__init__.cython-30.pxd":785 + * return PyArray_MultiIterNew(3, a, b, c) + * + * cdef inline object PyArray_MultiIterNew4(a, b, c, d): # <<<<<<<<<<<<<< + * return PyArray_MultiIterNew(4, a, b, c, d) + * +*/ + + /* function exit code */ + __pyx_L1_error:; + __Pyx_XDECREF(__pyx_t_1); + __Pyx_AddTraceback("numpy.PyArray_MultiIterNew4", __pyx_clineno, __pyx_lineno, __pyx_filename); + __pyx_r = 0; + __pyx_L0:; + __Pyx_XGIVEREF(__pyx_r); + __Pyx_RefNannyFinishContext(); + return __pyx_r; +} + +/* "C:/Users/runneradmin/AppData/Local/Temp/build-env-ej_q3m8u/Lib/site-packages/numpy/__init__.cython-30.pxd":788 + * return PyArray_MultiIterNew(4, a, b, c, d) + * + * cdef inline object PyArray_MultiIterNew5(a, b, c, d, e): # <<<<<<<<<<<<<< + * return PyArray_MultiIterNew(5, a, b, c, d, e) + * +*/ + +static CYTHON_INLINE PyObject *__pyx_f_5numpy_PyArray_MultiIterNew5(PyObject *__pyx_v_a, PyObject *__pyx_v_b, PyObject *__pyx_v_c, PyObject *__pyx_v_d, PyObject *__pyx_v_e) { + PyObject *__pyx_r = NULL; + __Pyx_RefNannyDeclarations + PyObject *__pyx_t_1 = NULL; + int __pyx_lineno = 0; + const char *__pyx_filename = NULL; + int __pyx_clineno = 0; + __Pyx_RefNannySetupContext("PyArray_MultiIterNew5", 0); + + /* "C:/Users/runneradmin/AppData/Local/Temp/build-env-ej_q3m8u/Lib/site-packages/numpy/__init__.cython-30.pxd":789 + * + * cdef inline object PyArray_MultiIterNew5(a, b, c, d, e): + * return PyArray_MultiIterNew(5, a, b, c, d, e) # <<<<<<<<<<<<<< + * + * cdef inline tuple PyDataType_SHAPE(dtype d): +*/ + __Pyx_XDECREF(__pyx_r); + __pyx_t_1 = PyArray_MultiIterNew(5, ((void *)__pyx_v_a), ((void *)__pyx_v_b), ((void *)__pyx_v_c), ((void *)__pyx_v_d), ((void *)__pyx_v_e)); if (unlikely(!__pyx_t_1)) __PYX_ERR(2, 789, __pyx_L1_error) + __Pyx_GOTREF(__pyx_t_1); + __pyx_r = __pyx_t_1; + __pyx_t_1 = 0; + goto __pyx_L0; + + /* "C:/Users/runneradmin/AppData/Local/Temp/build-env-ej_q3m8u/Lib/site-packages/numpy/__init__.cython-30.pxd":788 + * return PyArray_MultiIterNew(4, a, b, c, d) + * + * cdef inline object PyArray_MultiIterNew5(a, b, c, d, e): # <<<<<<<<<<<<<< + * return PyArray_MultiIterNew(5, a, b, c, d, e) + * +*/ + + /* function exit code */ + __pyx_L1_error:; + __Pyx_XDECREF(__pyx_t_1); + __Pyx_AddTraceback("numpy.PyArray_MultiIterNew5", __pyx_clineno, __pyx_lineno, __pyx_filename); + __pyx_r = 0; + __pyx_L0:; + __Pyx_XGIVEREF(__pyx_r); + __Pyx_RefNannyFinishContext(); + return __pyx_r; +} + +/* "C:/Users/runneradmin/AppData/Local/Temp/build-env-ej_q3m8u/Lib/site-packages/numpy/__init__.cython-30.pxd":791 + * return PyArray_MultiIterNew(5, a, b, c, d, e) + * + * cdef inline tuple PyDataType_SHAPE(dtype d): # <<<<<<<<<<<<<< + * if PyDataType_HASSUBARRAY(d): + * return d.subarray.shape +*/ + +static CYTHON_INLINE PyObject *__pyx_f_5numpy_PyDataType_SHAPE(PyArray_Descr *__pyx_v_d) { + PyObject *__pyx_r = NULL; + __Pyx_RefNannyDeclarations + int __pyx_t_1; + PyObject *__pyx_t_2; + __Pyx_RefNannySetupContext("PyDataType_SHAPE", 0); + + /* "C:/Users/runneradmin/AppData/Local/Temp/build-env-ej_q3m8u/Lib/site-packages/numpy/__init__.cython-30.pxd":792 + * + * cdef inline tuple PyDataType_SHAPE(dtype d): + * if PyDataType_HASSUBARRAY(d): # <<<<<<<<<<<<<< + * return d.subarray.shape + * else: +*/ + __pyx_t_1 = PyDataType_HASSUBARRAY(__pyx_v_d); + if (__pyx_t_1) { + + /* "C:/Users/runneradmin/AppData/Local/Temp/build-env-ej_q3m8u/Lib/site-packages/numpy/__init__.cython-30.pxd":793 + * cdef inline tuple PyDataType_SHAPE(dtype d): + * if PyDataType_HASSUBARRAY(d): + * return d.subarray.shape # <<<<<<<<<<<<<< + * else: + * return () +*/ + __Pyx_XDECREF(__pyx_r); + __pyx_t_2 = __pyx_f_5numpy_5dtype_8subarray_subarray(__pyx_v_d)->shape; + __Pyx_INCREF(((PyObject*)__pyx_t_2)); + __pyx_r = ((PyObject*)__pyx_t_2); + goto __pyx_L0; + + /* "C:/Users/runneradmin/AppData/Local/Temp/build-env-ej_q3m8u/Lib/site-packages/numpy/__init__.cython-30.pxd":792 + * + * cdef inline tuple PyDataType_SHAPE(dtype d): + * if PyDataType_HASSUBARRAY(d): # <<<<<<<<<<<<<< + * return d.subarray.shape + * else: +*/ + } + + /* "C:/Users/runneradmin/AppData/Local/Temp/build-env-ej_q3m8u/Lib/site-packages/numpy/__init__.cython-30.pxd":795 + * return d.subarray.shape + * else: + * return () # <<<<<<<<<<<<<< + * + * +*/ + /*else*/ { + __Pyx_XDECREF(__pyx_r); + __Pyx_INCREF(__pyx_mstate_global->__pyx_empty_tuple); + __pyx_r = __pyx_mstate_global->__pyx_empty_tuple; + goto __pyx_L0; + } + + /* "C:/Users/runneradmin/AppData/Local/Temp/build-env-ej_q3m8u/Lib/site-packages/numpy/__init__.cython-30.pxd":791 + * return PyArray_MultiIterNew(5, a, b, c, d, e) + * + * cdef inline tuple PyDataType_SHAPE(dtype d): # <<<<<<<<<<<<<< + * if PyDataType_HASSUBARRAY(d): + * return d.subarray.shape +*/ + + /* function exit code */ + __pyx_L0:; + __Pyx_XGIVEREF(__pyx_r); + __Pyx_RefNannyFinishContext(); + return __pyx_r; +} + +/* "C:/Users/runneradmin/AppData/Local/Temp/build-env-ej_q3m8u/Lib/site-packages/numpy/__init__.cython-30.pxd":994 + * int _import_umath() except -1 + * + * cdef inline void set_array_base(ndarray arr, object base) except *: # <<<<<<<<<<<<<< + * Py_INCREF(base) # important to do this before stealing the reference below! + * PyArray_SetBaseObject(arr, base) +*/ + +static CYTHON_INLINE void __pyx_f_5numpy_set_array_base(PyArrayObject *__pyx_v_arr, PyObject *__pyx_v_base) { + int __pyx_t_1; + int __pyx_lineno = 0; + const char *__pyx_filename = NULL; + int __pyx_clineno = 0; + + /* "C:/Users/runneradmin/AppData/Local/Temp/build-env-ej_q3m8u/Lib/site-packages/numpy/__init__.cython-30.pxd":995 + * + * cdef inline void set_array_base(ndarray arr, object base) except *: + * Py_INCREF(base) # important to do this before stealing the reference below! # <<<<<<<<<<<<<< + * PyArray_SetBaseObject(arr, base) + * +*/ + Py_INCREF(__pyx_v_base); + + /* "C:/Users/runneradmin/AppData/Local/Temp/build-env-ej_q3m8u/Lib/site-packages/numpy/__init__.cython-30.pxd":996 + * cdef inline void set_array_base(ndarray arr, object base) except *: + * Py_INCREF(base) # important to do this before stealing the reference below! + * PyArray_SetBaseObject(arr, base) # <<<<<<<<<<<<<< + * + * cdef inline object get_array_base(ndarray arr): +*/ + __pyx_t_1 = PyArray_SetBaseObject(__pyx_v_arr, __pyx_v_base); if (unlikely(__pyx_t_1 == ((int)-1))) __PYX_ERR(2, 996, __pyx_L1_error) + + /* "C:/Users/runneradmin/AppData/Local/Temp/build-env-ej_q3m8u/Lib/site-packages/numpy/__init__.cython-30.pxd":994 + * int _import_umath() except -1 + * + * cdef inline void set_array_base(ndarray arr, object base) except *: # <<<<<<<<<<<<<< + * Py_INCREF(base) # important to do this before stealing the reference below! + * PyArray_SetBaseObject(arr, base) +*/ + + /* function exit code */ + goto __pyx_L0; + __pyx_L1_error:; + __Pyx_AddTraceback("numpy.set_array_base", __pyx_clineno, __pyx_lineno, __pyx_filename); + __pyx_L0:; +} + +/* "C:/Users/runneradmin/AppData/Local/Temp/build-env-ej_q3m8u/Lib/site-packages/numpy/__init__.cython-30.pxd":998 + * PyArray_SetBaseObject(arr, base) + * + * cdef inline object get_array_base(ndarray arr): # <<<<<<<<<<<<<< + * base = PyArray_BASE(arr) + * if base is NULL: +*/ + +static CYTHON_INLINE PyObject *__pyx_f_5numpy_get_array_base(PyArrayObject *__pyx_v_arr) { + PyObject *__pyx_v_base; + PyObject *__pyx_r = NULL; + __Pyx_RefNannyDeclarations + int __pyx_t_1; + __Pyx_RefNannySetupContext("get_array_base", 0); + + /* "C:/Users/runneradmin/AppData/Local/Temp/build-env-ej_q3m8u/Lib/site-packages/numpy/__init__.cython-30.pxd":999 + * + * cdef inline object get_array_base(ndarray arr): + * base = PyArray_BASE(arr) # <<<<<<<<<<<<<< + * if base is NULL: + * return None +*/ + __pyx_v_base = PyArray_BASE(__pyx_v_arr); + + /* "C:/Users/runneradmin/AppData/Local/Temp/build-env-ej_q3m8u/Lib/site-packages/numpy/__init__.cython-30.pxd":1000 + * cdef inline object get_array_base(ndarray arr): + * base = PyArray_BASE(arr) + * if base is NULL: # <<<<<<<<<<<<<< + * return None + * return base +*/ + __pyx_t_1 = (__pyx_v_base == NULL); + if (__pyx_t_1) { + + /* "C:/Users/runneradmin/AppData/Local/Temp/build-env-ej_q3m8u/Lib/site-packages/numpy/__init__.cython-30.pxd":1001 + * base = PyArray_BASE(arr) + * if base is NULL: + * return None # <<<<<<<<<<<<<< + * return base + * +*/ + __Pyx_XDECREF(__pyx_r); + __pyx_r = Py_None; __Pyx_INCREF(Py_None); + goto __pyx_L0; + + /* "C:/Users/runneradmin/AppData/Local/Temp/build-env-ej_q3m8u/Lib/site-packages/numpy/__init__.cython-30.pxd":1000 + * cdef inline object get_array_base(ndarray arr): + * base = PyArray_BASE(arr) + * if base is NULL: # <<<<<<<<<<<<<< + * return None + * return base +*/ + } + + /* "C:/Users/runneradmin/AppData/Local/Temp/build-env-ej_q3m8u/Lib/site-packages/numpy/__init__.cython-30.pxd":1002 + * if base is NULL: + * return None + * return base # <<<<<<<<<<<<<< + * + * # Versions of the import_* functions which are more suitable for +*/ + __Pyx_XDECREF(__pyx_r); + __Pyx_INCREF(((PyObject *)__pyx_v_base)); + __pyx_r = ((PyObject *)__pyx_v_base); + goto __pyx_L0; + + /* "C:/Users/runneradmin/AppData/Local/Temp/build-env-ej_q3m8u/Lib/site-packages/numpy/__init__.cython-30.pxd":998 + * PyArray_SetBaseObject(arr, base) + * + * cdef inline object get_array_base(ndarray arr): # <<<<<<<<<<<<<< + * base = PyArray_BASE(arr) + * if base is NULL: +*/ + + /* function exit code */ + __pyx_L0:; + __Pyx_XGIVEREF(__pyx_r); + __Pyx_RefNannyFinishContext(); + return __pyx_r; +} + +/* "C:/Users/runneradmin/AppData/Local/Temp/build-env-ej_q3m8u/Lib/site-packages/numpy/__init__.cython-30.pxd":1006 + * # Versions of the import_* functions which are more suitable for + * # Cython code. + * cdef inline int import_array() except -1: # <<<<<<<<<<<<<< + * try: + * __pyx_import_array() +*/ + +static CYTHON_INLINE int __pyx_f_5numpy_import_array(void) { + int __pyx_r; + __Pyx_RefNannyDeclarations + PyObject *__pyx_t_1 = NULL; + PyObject *__pyx_t_2 = NULL; + PyObject *__pyx_t_3 = NULL; + int __pyx_t_4; + PyObject *__pyx_t_5 = NULL; + PyObject *__pyx_t_6 = NULL; + PyObject *__pyx_t_7 = NULL; + PyObject *__pyx_t_8 = NULL; + PyObject *__pyx_t_9 = NULL; + size_t __pyx_t_10; + int __pyx_lineno = 0; + const char *__pyx_filename = NULL; + int __pyx_clineno = 0; + __Pyx_RefNannySetupContext("import_array", 0); + + /* "C:/Users/runneradmin/AppData/Local/Temp/build-env-ej_q3m8u/Lib/site-packages/numpy/__init__.cython-30.pxd":1007 + * # Cython code. + * cdef inline int import_array() except -1: + * try: # <<<<<<<<<<<<<< + * __pyx_import_array() + * except Exception: +*/ + { + __Pyx_PyThreadState_declare + __Pyx_PyThreadState_assign + __Pyx_ExceptionSave(&__pyx_t_1, &__pyx_t_2, &__pyx_t_3); + __Pyx_XGOTREF(__pyx_t_1); + __Pyx_XGOTREF(__pyx_t_2); + __Pyx_XGOTREF(__pyx_t_3); + /*try:*/ { + + /* "C:/Users/runneradmin/AppData/Local/Temp/build-env-ej_q3m8u/Lib/site-packages/numpy/__init__.cython-30.pxd":1008 + * cdef inline int import_array() except -1: + * try: + * __pyx_import_array() # <<<<<<<<<<<<<< + * except Exception: + * raise ImportError("numpy._core.multiarray failed to import") +*/ + __pyx_t_4 = _import_array(); if (unlikely(__pyx_t_4 == ((int)-1))) __PYX_ERR(2, 1008, __pyx_L3_error) + + /* "C:/Users/runneradmin/AppData/Local/Temp/build-env-ej_q3m8u/Lib/site-packages/numpy/__init__.cython-30.pxd":1007 + * # Cython code. + * cdef inline int import_array() except -1: + * try: # <<<<<<<<<<<<<< + * __pyx_import_array() + * except Exception: +*/ + } + __Pyx_XDECREF(__pyx_t_1); __pyx_t_1 = 0; + __Pyx_XDECREF(__pyx_t_2); __pyx_t_2 = 0; + __Pyx_XDECREF(__pyx_t_3); __pyx_t_3 = 0; + goto __pyx_L8_try_end; + __pyx_L3_error:; + + /* "C:/Users/runneradmin/AppData/Local/Temp/build-env-ej_q3m8u/Lib/site-packages/numpy/__init__.cython-30.pxd":1009 + * try: + * __pyx_import_array() + * except Exception: # <<<<<<<<<<<<<< + * raise ImportError("numpy._core.multiarray failed to import") + * +*/ + __pyx_t_4 = __Pyx_PyErr_ExceptionMatches(((PyObject *)(((PyTypeObject*)PyExc_Exception)))); + if (__pyx_t_4) { + __Pyx_AddTraceback("numpy.import_array", __pyx_clineno, __pyx_lineno, __pyx_filename); + if (__Pyx_GetException(&__pyx_t_5, &__pyx_t_6, &__pyx_t_7) < 0) __PYX_ERR(2, 1009, __pyx_L5_except_error) + __Pyx_XGOTREF(__pyx_t_5); + __Pyx_XGOTREF(__pyx_t_6); + __Pyx_XGOTREF(__pyx_t_7); + + /* "C:/Users/runneradmin/AppData/Local/Temp/build-env-ej_q3m8u/Lib/site-packages/numpy/__init__.cython-30.pxd":1010 + * __pyx_import_array() + * except Exception: + * raise ImportError("numpy._core.multiarray failed to import") # <<<<<<<<<<<<<< + * + * cdef inline int import_umath() except -1: +*/ + __pyx_t_9 = NULL; + __pyx_t_10 = 1; + { + PyObject *__pyx_callargs[2] = {__pyx_t_9, __pyx_mstate_global->__pyx_kp_u_numpy__core_multiarray_failed_to}; + __pyx_t_8 = __Pyx_PyObject_FastCall((PyObject*)(((PyTypeObject*)PyExc_ImportError)), __pyx_callargs+__pyx_t_10, (2-__pyx_t_10) | (__pyx_t_10*__Pyx_PY_VECTORCALL_ARGUMENTS_OFFSET)); + __Pyx_XDECREF(__pyx_t_9); __pyx_t_9 = 0; + if (unlikely(!__pyx_t_8)) __PYX_ERR(2, 1010, __pyx_L5_except_error) + __Pyx_GOTREF(__pyx_t_8); + } + __Pyx_Raise(__pyx_t_8, 0, 0, 0); + __Pyx_DECREF(__pyx_t_8); __pyx_t_8 = 0; + __PYX_ERR(2, 1010, __pyx_L5_except_error) + } + goto __pyx_L5_except_error; + + /* "C:/Users/runneradmin/AppData/Local/Temp/build-env-ej_q3m8u/Lib/site-packages/numpy/__init__.cython-30.pxd":1007 + * # Cython code. + * cdef inline int import_array() except -1: + * try: # <<<<<<<<<<<<<< + * __pyx_import_array() + * except Exception: +*/ + __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:; + } + + /* "C:/Users/runneradmin/AppData/Local/Temp/build-env-ej_q3m8u/Lib/site-packages/numpy/__init__.cython-30.pxd":1006 + * # Versions of the import_* functions which are more suitable for + * # Cython code. + * cdef inline int import_array() except -1: # <<<<<<<<<<<<<< + * try: + * __pyx_import_array() +*/ + + /* function exit code */ + __pyx_r = 0; + goto __pyx_L0; + __pyx_L1_error:; + __Pyx_XDECREF(__pyx_t_5); + __Pyx_XDECREF(__pyx_t_6); + __Pyx_XDECREF(__pyx_t_7); + __Pyx_XDECREF(__pyx_t_8); + __Pyx_XDECREF(__pyx_t_9); + __Pyx_AddTraceback("numpy.import_array", __pyx_clineno, __pyx_lineno, __pyx_filename); + __pyx_r = -1; + __pyx_L0:; + __Pyx_RefNannyFinishContext(); + return __pyx_r; +} + +/* "C:/Users/runneradmin/AppData/Local/Temp/build-env-ej_q3m8u/Lib/site-packages/numpy/__init__.cython-30.pxd":1012 + * raise ImportError("numpy._core.multiarray failed to import") + * + * cdef inline int import_umath() except -1: # <<<<<<<<<<<<<< + * try: + * _import_umath() +*/ + +static CYTHON_INLINE int __pyx_f_5numpy_import_umath(void) { + int __pyx_r; + __Pyx_RefNannyDeclarations + PyObject *__pyx_t_1 = NULL; + PyObject *__pyx_t_2 = NULL; + PyObject *__pyx_t_3 = NULL; + int __pyx_t_4; + PyObject *__pyx_t_5 = NULL; + PyObject *__pyx_t_6 = NULL; + PyObject *__pyx_t_7 = NULL; + PyObject *__pyx_t_8 = NULL; + PyObject *__pyx_t_9 = NULL; + size_t __pyx_t_10; + int __pyx_lineno = 0; + const char *__pyx_filename = NULL; + int __pyx_clineno = 0; + __Pyx_RefNannySetupContext("import_umath", 0); + + /* "C:/Users/runneradmin/AppData/Local/Temp/build-env-ej_q3m8u/Lib/site-packages/numpy/__init__.cython-30.pxd":1013 + * + * cdef inline int import_umath() except -1: + * try: # <<<<<<<<<<<<<< + * _import_umath() + * except Exception: +*/ + { + __Pyx_PyThreadState_declare + __Pyx_PyThreadState_assign + __Pyx_ExceptionSave(&__pyx_t_1, &__pyx_t_2, &__pyx_t_3); + __Pyx_XGOTREF(__pyx_t_1); + __Pyx_XGOTREF(__pyx_t_2); + __Pyx_XGOTREF(__pyx_t_3); + /*try:*/ { + + /* "C:/Users/runneradmin/AppData/Local/Temp/build-env-ej_q3m8u/Lib/site-packages/numpy/__init__.cython-30.pxd":1014 + * cdef inline int import_umath() except -1: + * try: + * _import_umath() # <<<<<<<<<<<<<< + * except Exception: + * raise ImportError("numpy._core.umath failed to import") +*/ + __pyx_t_4 = _import_umath(); if (unlikely(__pyx_t_4 == ((int)-1))) __PYX_ERR(2, 1014, __pyx_L3_error) + + /* "C:/Users/runneradmin/AppData/Local/Temp/build-env-ej_q3m8u/Lib/site-packages/numpy/__init__.cython-30.pxd":1013 + * + * cdef inline int import_umath() except -1: + * try: # <<<<<<<<<<<<<< + * _import_umath() + * except Exception: +*/ + } + __Pyx_XDECREF(__pyx_t_1); __pyx_t_1 = 0; + __Pyx_XDECREF(__pyx_t_2); __pyx_t_2 = 0; + __Pyx_XDECREF(__pyx_t_3); __pyx_t_3 = 0; + goto __pyx_L8_try_end; + __pyx_L3_error:; + + /* "C:/Users/runneradmin/AppData/Local/Temp/build-env-ej_q3m8u/Lib/site-packages/numpy/__init__.cython-30.pxd":1015 + * try: + * _import_umath() + * except Exception: # <<<<<<<<<<<<<< + * raise ImportError("numpy._core.umath failed to import") + * +*/ + __pyx_t_4 = __Pyx_PyErr_ExceptionMatches(((PyObject *)(((PyTypeObject*)PyExc_Exception)))); + if (__pyx_t_4) { + __Pyx_AddTraceback("numpy.import_umath", __pyx_clineno, __pyx_lineno, __pyx_filename); + if (__Pyx_GetException(&__pyx_t_5, &__pyx_t_6, &__pyx_t_7) < 0) __PYX_ERR(2, 1015, __pyx_L5_except_error) + __Pyx_XGOTREF(__pyx_t_5); + __Pyx_XGOTREF(__pyx_t_6); + __Pyx_XGOTREF(__pyx_t_7); + + /* "C:/Users/runneradmin/AppData/Local/Temp/build-env-ej_q3m8u/Lib/site-packages/numpy/__init__.cython-30.pxd":1016 + * _import_umath() + * except Exception: + * raise ImportError("numpy._core.umath failed to import") # <<<<<<<<<<<<<< + * + * cdef inline int import_ufunc() except -1: +*/ + __pyx_t_9 = NULL; + __pyx_t_10 = 1; + { + PyObject *__pyx_callargs[2] = {__pyx_t_9, __pyx_mstate_global->__pyx_kp_u_numpy__core_umath_failed_to_impo}; + __pyx_t_8 = __Pyx_PyObject_FastCall((PyObject*)(((PyTypeObject*)PyExc_ImportError)), __pyx_callargs+__pyx_t_10, (2-__pyx_t_10) | (__pyx_t_10*__Pyx_PY_VECTORCALL_ARGUMENTS_OFFSET)); + __Pyx_XDECREF(__pyx_t_9); __pyx_t_9 = 0; + if (unlikely(!__pyx_t_8)) __PYX_ERR(2, 1016, __pyx_L5_except_error) + __Pyx_GOTREF(__pyx_t_8); + } + __Pyx_Raise(__pyx_t_8, 0, 0, 0); + __Pyx_DECREF(__pyx_t_8); __pyx_t_8 = 0; + __PYX_ERR(2, 1016, __pyx_L5_except_error) + } + goto __pyx_L5_except_error; + + /* "C:/Users/runneradmin/AppData/Local/Temp/build-env-ej_q3m8u/Lib/site-packages/numpy/__init__.cython-30.pxd":1013 + * + * cdef inline int import_umath() except -1: + * try: # <<<<<<<<<<<<<< + * _import_umath() + * except Exception: +*/ + __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:; + } + + /* "C:/Users/runneradmin/AppData/Local/Temp/build-env-ej_q3m8u/Lib/site-packages/numpy/__init__.cython-30.pxd":1012 + * raise ImportError("numpy._core.multiarray failed to import") + * + * cdef inline int import_umath() except -1: # <<<<<<<<<<<<<< + * try: + * _import_umath() +*/ + + /* function exit code */ + __pyx_r = 0; + goto __pyx_L0; + __pyx_L1_error:; + __Pyx_XDECREF(__pyx_t_5); + __Pyx_XDECREF(__pyx_t_6); + __Pyx_XDECREF(__pyx_t_7); + __Pyx_XDECREF(__pyx_t_8); + __Pyx_XDECREF(__pyx_t_9); + __Pyx_AddTraceback("numpy.import_umath", __pyx_clineno, __pyx_lineno, __pyx_filename); + __pyx_r = -1; + __pyx_L0:; + __Pyx_RefNannyFinishContext(); + return __pyx_r; +} + +/* "C:/Users/runneradmin/AppData/Local/Temp/build-env-ej_q3m8u/Lib/site-packages/numpy/__init__.cython-30.pxd":1018 + * raise ImportError("numpy._core.umath failed to import") + * + * cdef inline int import_ufunc() except -1: # <<<<<<<<<<<<<< + * try: + * _import_umath() +*/ + +static CYTHON_INLINE int __pyx_f_5numpy_import_ufunc(void) { + int __pyx_r; + __Pyx_RefNannyDeclarations + PyObject *__pyx_t_1 = NULL; + PyObject *__pyx_t_2 = NULL; + PyObject *__pyx_t_3 = NULL; + int __pyx_t_4; + PyObject *__pyx_t_5 = NULL; + PyObject *__pyx_t_6 = NULL; + PyObject *__pyx_t_7 = NULL; + PyObject *__pyx_t_8 = NULL; + PyObject *__pyx_t_9 = NULL; + size_t __pyx_t_10; + int __pyx_lineno = 0; + const char *__pyx_filename = NULL; + int __pyx_clineno = 0; + __Pyx_RefNannySetupContext("import_ufunc", 0); + + /* "C:/Users/runneradmin/AppData/Local/Temp/build-env-ej_q3m8u/Lib/site-packages/numpy/__init__.cython-30.pxd":1019 + * + * cdef inline int import_ufunc() except -1: + * try: # <<<<<<<<<<<<<< + * _import_umath() + * except Exception: +*/ + { + __Pyx_PyThreadState_declare + __Pyx_PyThreadState_assign + __Pyx_ExceptionSave(&__pyx_t_1, &__pyx_t_2, &__pyx_t_3); + __Pyx_XGOTREF(__pyx_t_1); + __Pyx_XGOTREF(__pyx_t_2); + __Pyx_XGOTREF(__pyx_t_3); + /*try:*/ { + + /* "C:/Users/runneradmin/AppData/Local/Temp/build-env-ej_q3m8u/Lib/site-packages/numpy/__init__.cython-30.pxd":1020 + * cdef inline int import_ufunc() except -1: + * try: + * _import_umath() # <<<<<<<<<<<<<< + * except Exception: + * raise ImportError("numpy._core.umath failed to import") +*/ + __pyx_t_4 = _import_umath(); if (unlikely(__pyx_t_4 == ((int)-1))) __PYX_ERR(2, 1020, __pyx_L3_error) + + /* "C:/Users/runneradmin/AppData/Local/Temp/build-env-ej_q3m8u/Lib/site-packages/numpy/__init__.cython-30.pxd":1019 + * + * cdef inline int import_ufunc() except -1: + * try: # <<<<<<<<<<<<<< + * _import_umath() + * except Exception: +*/ + } + __Pyx_XDECREF(__pyx_t_1); __pyx_t_1 = 0; + __Pyx_XDECREF(__pyx_t_2); __pyx_t_2 = 0; + __Pyx_XDECREF(__pyx_t_3); __pyx_t_3 = 0; + goto __pyx_L8_try_end; + __pyx_L3_error:; + + /* "C:/Users/runneradmin/AppData/Local/Temp/build-env-ej_q3m8u/Lib/site-packages/numpy/__init__.cython-30.pxd":1021 + * try: + * _import_umath() + * except Exception: # <<<<<<<<<<<<<< + * raise ImportError("numpy._core.umath failed to import") + * +*/ + __pyx_t_4 = __Pyx_PyErr_ExceptionMatches(((PyObject *)(((PyTypeObject*)PyExc_Exception)))); + if (__pyx_t_4) { + __Pyx_AddTraceback("numpy.import_ufunc", __pyx_clineno, __pyx_lineno, __pyx_filename); + if (__Pyx_GetException(&__pyx_t_5, &__pyx_t_6, &__pyx_t_7) < 0) __PYX_ERR(2, 1021, __pyx_L5_except_error) + __Pyx_XGOTREF(__pyx_t_5); + __Pyx_XGOTREF(__pyx_t_6); + __Pyx_XGOTREF(__pyx_t_7); + + /* "C:/Users/runneradmin/AppData/Local/Temp/build-env-ej_q3m8u/Lib/site-packages/numpy/__init__.cython-30.pxd":1022 + * _import_umath() + * except Exception: + * raise ImportError("numpy._core.umath failed to import") # <<<<<<<<<<<<<< + * + * +*/ + __pyx_t_9 = NULL; + __pyx_t_10 = 1; + { + PyObject *__pyx_callargs[2] = {__pyx_t_9, __pyx_mstate_global->__pyx_kp_u_numpy__core_umath_failed_to_impo}; + __pyx_t_8 = __Pyx_PyObject_FastCall((PyObject*)(((PyTypeObject*)PyExc_ImportError)), __pyx_callargs+__pyx_t_10, (2-__pyx_t_10) | (__pyx_t_10*__Pyx_PY_VECTORCALL_ARGUMENTS_OFFSET)); + __Pyx_XDECREF(__pyx_t_9); __pyx_t_9 = 0; + if (unlikely(!__pyx_t_8)) __PYX_ERR(2, 1022, __pyx_L5_except_error) + __Pyx_GOTREF(__pyx_t_8); + } + __Pyx_Raise(__pyx_t_8, 0, 0, 0); + __Pyx_DECREF(__pyx_t_8); __pyx_t_8 = 0; + __PYX_ERR(2, 1022, __pyx_L5_except_error) + } + goto __pyx_L5_except_error; + + /* "C:/Users/runneradmin/AppData/Local/Temp/build-env-ej_q3m8u/Lib/site-packages/numpy/__init__.cython-30.pxd":1019 + * + * cdef inline int import_ufunc() except -1: + * try: # <<<<<<<<<<<<<< + * _import_umath() + * except Exception: +*/ + __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:; + } + + /* "C:/Users/runneradmin/AppData/Local/Temp/build-env-ej_q3m8u/Lib/site-packages/numpy/__init__.cython-30.pxd":1018 + * raise ImportError("numpy._core.umath failed to import") + * + * cdef inline int import_ufunc() except -1: # <<<<<<<<<<<<<< + * try: + * _import_umath() +*/ + + /* function exit code */ + __pyx_r = 0; + goto __pyx_L0; + __pyx_L1_error:; + __Pyx_XDECREF(__pyx_t_5); + __Pyx_XDECREF(__pyx_t_6); + __Pyx_XDECREF(__pyx_t_7); + __Pyx_XDECREF(__pyx_t_8); + __Pyx_XDECREF(__pyx_t_9); + __Pyx_AddTraceback("numpy.import_ufunc", __pyx_clineno, __pyx_lineno, __pyx_filename); + __pyx_r = -1; + __pyx_L0:; + __Pyx_RefNannyFinishContext(); + return __pyx_r; +} + +/* "C:/Users/runneradmin/AppData/Local/Temp/build-env-ej_q3m8u/Lib/site-packages/numpy/__init__.cython-30.pxd":1025 + * + * + * cdef inline bint is_timedelta64_object(object obj) noexcept: # <<<<<<<<<<<<<< + * """ + * Cython equivalent of `isinstance(obj, np.timedelta64)` +*/ + +static CYTHON_INLINE int __pyx_f_5numpy_is_timedelta64_object(PyObject *__pyx_v_obj) { + int __pyx_r; + + /* "C:/Users/runneradmin/AppData/Local/Temp/build-env-ej_q3m8u/Lib/site-packages/numpy/__init__.cython-30.pxd":1037 + * bool + * """ + * return PyObject_TypeCheck(obj, &PyTimedeltaArrType_Type) # <<<<<<<<<<<<<< + * + * +*/ + __pyx_r = PyObject_TypeCheck(__pyx_v_obj, (&PyTimedeltaArrType_Type)); + goto __pyx_L0; + + /* "C:/Users/runneradmin/AppData/Local/Temp/build-env-ej_q3m8u/Lib/site-packages/numpy/__init__.cython-30.pxd":1025 + * + * + * cdef inline bint is_timedelta64_object(object obj) noexcept: # <<<<<<<<<<<<<< + * """ + * Cython equivalent of `isinstance(obj, np.timedelta64)` +*/ + + /* function exit code */ + __pyx_L0:; + return __pyx_r; +} + +/* "C:/Users/runneradmin/AppData/Local/Temp/build-env-ej_q3m8u/Lib/site-packages/numpy/__init__.cython-30.pxd":1040 + * + * + * cdef inline bint is_datetime64_object(object obj) noexcept: # <<<<<<<<<<<<<< + * """ + * Cython equivalent of `isinstance(obj, np.datetime64)` +*/ + +static CYTHON_INLINE int __pyx_f_5numpy_is_datetime64_object(PyObject *__pyx_v_obj) { + int __pyx_r; + + /* "C:/Users/runneradmin/AppData/Local/Temp/build-env-ej_q3m8u/Lib/site-packages/numpy/__init__.cython-30.pxd":1052 + * bool + * """ + * return PyObject_TypeCheck(obj, &PyDatetimeArrType_Type) # <<<<<<<<<<<<<< + * + * +*/ + __pyx_r = PyObject_TypeCheck(__pyx_v_obj, (&PyDatetimeArrType_Type)); + goto __pyx_L0; + + /* "C:/Users/runneradmin/AppData/Local/Temp/build-env-ej_q3m8u/Lib/site-packages/numpy/__init__.cython-30.pxd":1040 + * + * + * cdef inline bint is_datetime64_object(object obj) noexcept: # <<<<<<<<<<<<<< + * """ + * Cython equivalent of `isinstance(obj, np.datetime64)` +*/ + + /* function exit code */ + __pyx_L0:; + return __pyx_r; +} + +/* "C:/Users/runneradmin/AppData/Local/Temp/build-env-ej_q3m8u/Lib/site-packages/numpy/__init__.cython-30.pxd":1055 + * + * + * cdef inline npy_datetime get_datetime64_value(object obj) noexcept nogil: # <<<<<<<<<<<<<< + * """ + * returns the int64 value underlying scalar numpy datetime64 object +*/ + +static CYTHON_INLINE npy_datetime __pyx_f_5numpy_get_datetime64_value(PyObject *__pyx_v_obj) { + npy_datetime __pyx_r; + + /* "C:/Users/runneradmin/AppData/Local/Temp/build-env-ej_q3m8u/Lib/site-packages/numpy/__init__.cython-30.pxd":1062 + * also needed. That can be found using `get_datetime64_unit`. + * """ + * return (obj).obval # <<<<<<<<<<<<<< + * + * +*/ + __pyx_r = ((PyDatetimeScalarObject *)__pyx_v_obj)->obval; + goto __pyx_L0; + + /* "C:/Users/runneradmin/AppData/Local/Temp/build-env-ej_q3m8u/Lib/site-packages/numpy/__init__.cython-30.pxd":1055 + * + * + * cdef inline npy_datetime get_datetime64_value(object obj) noexcept nogil: # <<<<<<<<<<<<<< + * """ + * returns the int64 value underlying scalar numpy datetime64 object +*/ + + /* function exit code */ + __pyx_L0:; + return __pyx_r; +} + +/* "C:/Users/runneradmin/AppData/Local/Temp/build-env-ej_q3m8u/Lib/site-packages/numpy/__init__.cython-30.pxd":1065 + * + * + * cdef inline npy_timedelta get_timedelta64_value(object obj) noexcept nogil: # <<<<<<<<<<<<<< + * """ + * returns the int64 value underlying scalar numpy timedelta64 object +*/ + +static CYTHON_INLINE npy_timedelta __pyx_f_5numpy_get_timedelta64_value(PyObject *__pyx_v_obj) { + npy_timedelta __pyx_r; + + /* "C:/Users/runneradmin/AppData/Local/Temp/build-env-ej_q3m8u/Lib/site-packages/numpy/__init__.cython-30.pxd":1069 + * returns the int64 value underlying scalar numpy timedelta64 object + * """ + * return (obj).obval # <<<<<<<<<<<<<< + * + * +*/ + __pyx_r = ((PyTimedeltaScalarObject *)__pyx_v_obj)->obval; + goto __pyx_L0; + + /* "C:/Users/runneradmin/AppData/Local/Temp/build-env-ej_q3m8u/Lib/site-packages/numpy/__init__.cython-30.pxd":1065 + * + * + * cdef inline npy_timedelta get_timedelta64_value(object obj) noexcept nogil: # <<<<<<<<<<<<<< + * """ + * returns the int64 value underlying scalar numpy timedelta64 object +*/ + + /* function exit code */ + __pyx_L0:; + return __pyx_r; +} + +/* "C:/Users/runneradmin/AppData/Local/Temp/build-env-ej_q3m8u/Lib/site-packages/numpy/__init__.cython-30.pxd":1072 + * + * + * cdef inline NPY_DATETIMEUNIT get_datetime64_unit(object obj) noexcept nogil: # <<<<<<<<<<<<<< + * """ + * returns the unit part of the dtype for a numpy datetime64 object. +*/ + +static CYTHON_INLINE NPY_DATETIMEUNIT __pyx_f_5numpy_get_datetime64_unit(PyObject *__pyx_v_obj) { + NPY_DATETIMEUNIT __pyx_r; + + /* "C:/Users/runneradmin/AppData/Local/Temp/build-env-ej_q3m8u/Lib/site-packages/numpy/__init__.cython-30.pxd":1076 + * returns the unit part of the dtype for a numpy datetime64 object. + * """ + * return (obj).obmeta.base # <<<<<<<<<<<<<< + * + * +*/ + __pyx_r = ((NPY_DATETIMEUNIT)((PyDatetimeScalarObject *)__pyx_v_obj)->obmeta.base); + goto __pyx_L0; + + /* "C:/Users/runneradmin/AppData/Local/Temp/build-env-ej_q3m8u/Lib/site-packages/numpy/__init__.cython-30.pxd":1072 + * + * + * cdef inline NPY_DATETIMEUNIT get_datetime64_unit(object obj) noexcept nogil: # <<<<<<<<<<<<<< + * """ + * returns the unit part of the dtype for a numpy datetime64 object. +*/ + + /* function exit code */ + __pyx_L0:; + return __pyx_r; +} + +/* "lexeme.pxd":29 + * cdef readonly attr_t orth + * + * @staticmethod # <<<<<<<<<<<<<< + * cdef inline Lexeme from_ptr(LexemeC* lex, Vocab vocab): + * cdef Lexeme self = Lexeme.__new__(Lexeme, vocab, lex.orth) +*/ + +static CYTHON_INLINE struct __pyx_obj_5spacy_6lexeme_Lexeme *__pyx_f_5spacy_6lexeme_6Lexeme_from_ptr(struct __pyx_t_5spacy_7structs_LexemeC *__pyx_v_lex, struct __pyx_obj_5spacy_5vocab_Vocab *__pyx_v_vocab) { + struct __pyx_obj_5spacy_6lexeme_Lexeme *__pyx_v_self = 0; + struct __pyx_obj_5spacy_6lexeme_Lexeme *__pyx_r = NULL; + __Pyx_RefNannyDeclarations + PyObject *__pyx_t_1 = NULL; + PyObject *__pyx_t_2 = NULL; + __pyx_t_5spacy_8typedefs_attr_t __pyx_t_3; + int __pyx_lineno = 0; + const char *__pyx_filename = NULL; + int __pyx_clineno = 0; + __Pyx_RefNannySetupContext("from_ptr", 0); + + /* "lexeme.pxd":31 + * @staticmethod + * cdef inline Lexeme from_ptr(LexemeC* lex, Vocab vocab): + * cdef Lexeme self = Lexeme.__new__(Lexeme, vocab, lex.orth) # <<<<<<<<<<<<<< + * self.c = lex + * self.vocab = vocab +*/ + __pyx_t_1 = __Pyx_PyLong_From_uint64_t(__pyx_v_lex->orth); if (unlikely(!__pyx_t_1)) __PYX_ERR(3, 31, __pyx_L1_error) + __Pyx_GOTREF(__pyx_t_1); + __pyx_t_2 = PyTuple_New(2); if (unlikely(!__pyx_t_2)) __PYX_ERR(3, 31, __pyx_L1_error) + __Pyx_GOTREF(__pyx_t_2); + __Pyx_INCREF((PyObject *)__pyx_v_vocab); + __Pyx_GIVEREF((PyObject *)__pyx_v_vocab); + if (__Pyx_PyTuple_SET_ITEM(__pyx_t_2, 0, ((PyObject *)__pyx_v_vocab)) != (0)) __PYX_ERR(3, 31, __pyx_L1_error); + __Pyx_GIVEREF(__pyx_t_1); + if (__Pyx_PyTuple_SET_ITEM(__pyx_t_2, 1, __pyx_t_1) != (0)) __PYX_ERR(3, 31, __pyx_L1_error); + __pyx_t_1 = 0; + __pyx_t_1 = __Pyx_tp_new(((PyObject *)__pyx_mstate_global->__pyx_ptype_5spacy_6lexeme_Lexeme), ((PyObject*)__pyx_t_2)); if (unlikely(!__pyx_t_1)) __PYX_ERR(3, 31, __pyx_L1_error) + __Pyx_GOTREF(__pyx_t_1); + __Pyx_DECREF(__pyx_t_2); __pyx_t_2 = 0; + if (!(likely(__Pyx_TypeTest(__pyx_t_1, __pyx_mstate_global->__pyx_ptype_5spacy_6lexeme_Lexeme)))) __PYX_ERR(3, 31, __pyx_L1_error) + __pyx_v_self = ((struct __pyx_obj_5spacy_6lexeme_Lexeme *)__pyx_t_1); + __pyx_t_1 = 0; + + /* "lexeme.pxd":32 + * cdef inline Lexeme from_ptr(LexemeC* lex, Vocab vocab): + * cdef Lexeme self = Lexeme.__new__(Lexeme, vocab, lex.orth) + * self.c = lex # <<<<<<<<<<<<<< + * self.vocab = vocab + * self.orth = lex.orth +*/ + __pyx_v_self->c = __pyx_v_lex; + + /* "lexeme.pxd":33 + * cdef Lexeme self = Lexeme.__new__(Lexeme, vocab, lex.orth) + * self.c = lex + * self.vocab = vocab # <<<<<<<<<<<<<< + * self.orth = lex.orth + * return self +*/ + __Pyx_INCREF((PyObject *)__pyx_v_vocab); + __Pyx_GIVEREF((PyObject *)__pyx_v_vocab); + __Pyx_GOTREF((PyObject *)__pyx_v_self->vocab); + __Pyx_DECREF((PyObject *)__pyx_v_self->vocab); + __pyx_v_self->vocab = __pyx_v_vocab; + + /* "lexeme.pxd":34 + * self.c = lex + * self.vocab = vocab + * self.orth = lex.orth # <<<<<<<<<<<<<< + * return self + * +*/ + __pyx_t_3 = __pyx_v_lex->orth; + __pyx_v_self->orth = __pyx_t_3; + + /* "lexeme.pxd":35 + * self.vocab = vocab + * self.orth = lex.orth + * return self # <<<<<<<<<<<<<< + * + * @staticmethod +*/ + __Pyx_XDECREF((PyObject *)__pyx_r); + __Pyx_INCREF((PyObject *)__pyx_v_self); + __pyx_r = __pyx_v_self; + goto __pyx_L0; + + /* "lexeme.pxd":29 + * cdef readonly attr_t orth + * + * @staticmethod # <<<<<<<<<<<<<< + * cdef inline Lexeme from_ptr(LexemeC* lex, Vocab vocab): + * cdef Lexeme self = Lexeme.__new__(Lexeme, vocab, lex.orth) +*/ + + /* function exit code */ + __pyx_L1_error:; + __Pyx_XDECREF(__pyx_t_1); + __Pyx_XDECREF(__pyx_t_2); + __Pyx_AddTraceback("spacy.lexeme.Lexeme.from_ptr", __pyx_clineno, __pyx_lineno, __pyx_filename); + __pyx_r = 0; + __pyx_L0:; + __Pyx_XDECREF((PyObject *)__pyx_v_self); + __Pyx_XGIVEREF((PyObject *)__pyx_r); + __Pyx_RefNannyFinishContext(); + return __pyx_r; +} + +/* "lexeme.pxd":37 + * return self + * + * @staticmethod # <<<<<<<<<<<<<< + * cdef inline void set_struct_attr(LexemeC* lex, attr_id_t name, attr_t value) noexcept nogil: + * if name < (sizeof(flags_t) * 8): +*/ + +static CYTHON_INLINE void __pyx_f_5spacy_6lexeme_6Lexeme_set_struct_attr(struct __pyx_t_5spacy_7structs_LexemeC *__pyx_v_lex, enum __pyx_t_5spacy_5attrs_attr_id_t __pyx_v_name, __pyx_t_5spacy_8typedefs_attr_t __pyx_v_value) { + int __pyx_t_1; + + /* "lexeme.pxd":39 + * @staticmethod + * cdef inline void set_struct_attr(LexemeC* lex, attr_id_t name, attr_t value) noexcept nogil: + * if name < (sizeof(flags_t) * 8): # <<<<<<<<<<<<<< + * Lexeme.c_set_flag(lex, name, value) + * elif name == ID: +*/ + __pyx_t_1 = (__pyx_v_name < ((sizeof(__pyx_t_5spacy_8typedefs_flags_t)) * 8)); + if (__pyx_t_1) { + + /* "lexeme.pxd":40 + * cdef inline void set_struct_attr(LexemeC* lex, attr_id_t name, attr_t value) noexcept nogil: + * if name < (sizeof(flags_t) * 8): + * Lexeme.c_set_flag(lex, name, value) # <<<<<<<<<<<<<< + * elif name == ID: + * lex.id = value +*/ + (void)(__pyx_f_5spacy_6lexeme_6Lexeme_c_set_flag(__pyx_v_lex, __pyx_v_name, __pyx_v_value)); + + /* "lexeme.pxd":39 + * @staticmethod + * cdef inline void set_struct_attr(LexemeC* lex, attr_id_t name, attr_t value) noexcept nogil: + * if name < (sizeof(flags_t) * 8): # <<<<<<<<<<<<<< + * Lexeme.c_set_flag(lex, name, value) + * elif name == ID: +*/ + goto __pyx_L3; + } + + /* "lexeme.pxd":41 + * if name < (sizeof(flags_t) * 8): + * Lexeme.c_set_flag(lex, name, value) + * elif name == ID: # <<<<<<<<<<<<<< + * lex.id = value + * elif name == LOWER: +*/ + __pyx_t_1 = (__pyx_v_name == __pyx_e_5spacy_5attrs_ID); + if (__pyx_t_1) { + + /* "lexeme.pxd":42 + * Lexeme.c_set_flag(lex, name, value) + * elif name == ID: + * lex.id = value # <<<<<<<<<<<<<< + * elif name == LOWER: + * lex.lower = value +*/ + __pyx_v_lex->id = __pyx_v_value; + + /* "lexeme.pxd":41 + * if name < (sizeof(flags_t) * 8): + * Lexeme.c_set_flag(lex, name, value) + * elif name == ID: # <<<<<<<<<<<<<< + * lex.id = value + * elif name == LOWER: +*/ + goto __pyx_L3; + } + + /* "lexeme.pxd":43 + * elif name == ID: + * lex.id = value + * elif name == LOWER: # <<<<<<<<<<<<<< + * lex.lower = value + * elif name == NORM: +*/ + __pyx_t_1 = (__pyx_v_name == __pyx_e_5spacy_5attrs_LOWER); + if (__pyx_t_1) { + + /* "lexeme.pxd":44 + * lex.id = value + * elif name == LOWER: + * lex.lower = value # <<<<<<<<<<<<<< + * elif name == NORM: + * lex.norm = value +*/ + __pyx_v_lex->lower = __pyx_v_value; + + /* "lexeme.pxd":43 + * elif name == ID: + * lex.id = value + * elif name == LOWER: # <<<<<<<<<<<<<< + * lex.lower = value + * elif name == NORM: +*/ + goto __pyx_L3; + } + + /* "lexeme.pxd":45 + * elif name == LOWER: + * lex.lower = value + * elif name == NORM: # <<<<<<<<<<<<<< + * lex.norm = value + * elif name == SHAPE: +*/ + __pyx_t_1 = (__pyx_v_name == __pyx_e_5spacy_5attrs_NORM); + if (__pyx_t_1) { + + /* "lexeme.pxd":46 + * lex.lower = value + * elif name == NORM: + * lex.norm = value # <<<<<<<<<<<<<< + * elif name == SHAPE: + * lex.shape = value +*/ + __pyx_v_lex->norm = __pyx_v_value; + + /* "lexeme.pxd":45 + * elif name == LOWER: + * lex.lower = value + * elif name == NORM: # <<<<<<<<<<<<<< + * lex.norm = value + * elif name == SHAPE: +*/ + goto __pyx_L3; + } + + /* "lexeme.pxd":47 + * elif name == NORM: + * lex.norm = value + * elif name == SHAPE: # <<<<<<<<<<<<<< + * lex.shape = value + * elif name == PREFIX: +*/ + __pyx_t_1 = (__pyx_v_name == __pyx_e_5spacy_5attrs_SHAPE); + if (__pyx_t_1) { + + /* "lexeme.pxd":48 + * lex.norm = value + * elif name == SHAPE: + * lex.shape = value # <<<<<<<<<<<<<< + * elif name == PREFIX: + * lex.prefix = value +*/ + __pyx_v_lex->shape = __pyx_v_value; + + /* "lexeme.pxd":47 + * elif name == NORM: + * lex.norm = value + * elif name == SHAPE: # <<<<<<<<<<<<<< + * lex.shape = value + * elif name == PREFIX: +*/ + goto __pyx_L3; + } + + /* "lexeme.pxd":49 + * elif name == SHAPE: + * lex.shape = value + * elif name == PREFIX: # <<<<<<<<<<<<<< + * lex.prefix = value + * elif name == SUFFIX: +*/ + __pyx_t_1 = (__pyx_v_name == __pyx_e_5spacy_5attrs_PREFIX); + if (__pyx_t_1) { + + /* "lexeme.pxd":50 + * lex.shape = value + * elif name == PREFIX: + * lex.prefix = value # <<<<<<<<<<<<<< + * elif name == SUFFIX: + * lex.suffix = value +*/ + __pyx_v_lex->prefix = __pyx_v_value; + + /* "lexeme.pxd":49 + * elif name == SHAPE: + * lex.shape = value + * elif name == PREFIX: # <<<<<<<<<<<<<< + * lex.prefix = value + * elif name == SUFFIX: +*/ + goto __pyx_L3; + } + + /* "lexeme.pxd":51 + * elif name == PREFIX: + * lex.prefix = value + * elif name == SUFFIX: # <<<<<<<<<<<<<< + * lex.suffix = value + * elif name == LANG: +*/ + __pyx_t_1 = (__pyx_v_name == __pyx_e_5spacy_5attrs_SUFFIX); + if (__pyx_t_1) { + + /* "lexeme.pxd":52 + * lex.prefix = value + * elif name == SUFFIX: + * lex.suffix = value # <<<<<<<<<<<<<< + * elif name == LANG: + * lex.lang = value +*/ + __pyx_v_lex->suffix = __pyx_v_value; + + /* "lexeme.pxd":51 + * elif name == PREFIX: + * lex.prefix = value + * elif name == SUFFIX: # <<<<<<<<<<<<<< + * lex.suffix = value + * elif name == LANG: +*/ + goto __pyx_L3; + } + + /* "lexeme.pxd":53 + * elif name == SUFFIX: + * lex.suffix = value + * elif name == LANG: # <<<<<<<<<<<<<< + * lex.lang = value + * +*/ + __pyx_t_1 = (__pyx_v_name == __pyx_e_5spacy_5attrs_LANG); + if (__pyx_t_1) { + + /* "lexeme.pxd":54 + * lex.suffix = value + * elif name == LANG: + * lex.lang = value # <<<<<<<<<<<<<< + * + * @staticmethod +*/ + __pyx_v_lex->lang = __pyx_v_value; + + /* "lexeme.pxd":53 + * elif name == SUFFIX: + * lex.suffix = value + * elif name == LANG: # <<<<<<<<<<<<<< + * lex.lang = value + * +*/ + } + __pyx_L3:; + + /* "lexeme.pxd":37 + * return self + * + * @staticmethod # <<<<<<<<<<<<<< + * cdef inline void set_struct_attr(LexemeC* lex, attr_id_t name, attr_t value) noexcept nogil: + * if name < (sizeof(flags_t) * 8): +*/ + + /* function exit code */ +} + +/* "lexeme.pxd":56 + * lex.lang = value + * + * @staticmethod # <<<<<<<<<<<<<< + * cdef inline attr_t get_struct_attr(const LexemeC* lex, attr_id_t feat_name) noexcept nogil: + * if feat_name < (sizeof(flags_t) * 8): +*/ + +static CYTHON_INLINE __pyx_t_5spacy_8typedefs_attr_t __pyx_f_5spacy_6lexeme_6Lexeme_get_struct_attr(struct __pyx_t_5spacy_7structs_LexemeC const *__pyx_v_lex, enum __pyx_t_5spacy_5attrs_attr_id_t __pyx_v_feat_name) { + __pyx_t_5spacy_8typedefs_attr_t __pyx_r; + int __pyx_t_1; + + /* "lexeme.pxd":58 + * @staticmethod + * cdef inline attr_t get_struct_attr(const LexemeC* lex, attr_id_t feat_name) noexcept nogil: + * if feat_name < (sizeof(flags_t) * 8): # <<<<<<<<<<<<<< + * if Lexeme.c_check_flag(lex, feat_name): + * return 1 +*/ + __pyx_t_1 = (__pyx_v_feat_name < ((sizeof(__pyx_t_5spacy_8typedefs_flags_t)) * 8)); + if (__pyx_t_1) { + + /* "lexeme.pxd":59 + * cdef inline attr_t get_struct_attr(const LexemeC* lex, attr_id_t feat_name) noexcept nogil: + * if feat_name < (sizeof(flags_t) * 8): + * if Lexeme.c_check_flag(lex, feat_name): # <<<<<<<<<<<<<< + * return 1 + * else: +*/ + __pyx_t_1 = __pyx_f_5spacy_6lexeme_6Lexeme_c_check_flag(__pyx_v_lex, __pyx_v_feat_name); + if (__pyx_t_1) { + + /* "lexeme.pxd":60 + * if feat_name < (sizeof(flags_t) * 8): + * if Lexeme.c_check_flag(lex, feat_name): + * return 1 # <<<<<<<<<<<<<< + * else: + * return 0 +*/ + __pyx_r = 1; + goto __pyx_L0; + + /* "lexeme.pxd":59 + * cdef inline attr_t get_struct_attr(const LexemeC* lex, attr_id_t feat_name) noexcept nogil: + * if feat_name < (sizeof(flags_t) * 8): + * if Lexeme.c_check_flag(lex, feat_name): # <<<<<<<<<<<<<< + * return 1 + * else: +*/ + } + + /* "lexeme.pxd":62 + * return 1 + * else: + * return 0 # <<<<<<<<<<<<<< + * elif feat_name == ID: + * return lex.id +*/ + /*else*/ { + __pyx_r = 0; + goto __pyx_L0; + } + + /* "lexeme.pxd":58 + * @staticmethod + * cdef inline attr_t get_struct_attr(const LexemeC* lex, attr_id_t feat_name) noexcept nogil: + * if feat_name < (sizeof(flags_t) * 8): # <<<<<<<<<<<<<< + * if Lexeme.c_check_flag(lex, feat_name): + * return 1 +*/ + } + + /* "lexeme.pxd":63 + * else: + * return 0 + * elif feat_name == ID: # <<<<<<<<<<<<<< + * return lex.id + * elif feat_name == ORTH: +*/ + __pyx_t_1 = (__pyx_v_feat_name == __pyx_e_5spacy_5attrs_ID); + if (__pyx_t_1) { + + /* "lexeme.pxd":64 + * return 0 + * elif feat_name == ID: + * return lex.id # <<<<<<<<<<<<<< + * elif feat_name == ORTH: + * return lex.orth +*/ + __pyx_r = __pyx_v_lex->id; + goto __pyx_L0; + + /* "lexeme.pxd":63 + * else: + * return 0 + * elif feat_name == ID: # <<<<<<<<<<<<<< + * return lex.id + * elif feat_name == ORTH: +*/ + } + + /* "lexeme.pxd":65 + * elif feat_name == ID: + * return lex.id + * elif feat_name == ORTH: # <<<<<<<<<<<<<< + * return lex.orth + * elif feat_name == LOWER: +*/ + __pyx_t_1 = (__pyx_v_feat_name == __pyx_e_5spacy_5attrs_ORTH); + if (__pyx_t_1) { + + /* "lexeme.pxd":66 + * return lex.id + * elif feat_name == ORTH: + * return lex.orth # <<<<<<<<<<<<<< + * elif feat_name == LOWER: + * return lex.lower +*/ + __pyx_r = __pyx_v_lex->orth; + goto __pyx_L0; + + /* "lexeme.pxd":65 + * elif feat_name == ID: + * return lex.id + * elif feat_name == ORTH: # <<<<<<<<<<<<<< + * return lex.orth + * elif feat_name == LOWER: +*/ + } + + /* "lexeme.pxd":67 + * elif feat_name == ORTH: + * return lex.orth + * elif feat_name == LOWER: # <<<<<<<<<<<<<< + * return lex.lower + * elif feat_name == NORM: +*/ + __pyx_t_1 = (__pyx_v_feat_name == __pyx_e_5spacy_5attrs_LOWER); + if (__pyx_t_1) { + + /* "lexeme.pxd":68 + * return lex.orth + * elif feat_name == LOWER: + * return lex.lower # <<<<<<<<<<<<<< + * elif feat_name == NORM: + * return lex.norm +*/ + __pyx_r = __pyx_v_lex->lower; + goto __pyx_L0; + + /* "lexeme.pxd":67 + * elif feat_name == ORTH: + * return lex.orth + * elif feat_name == LOWER: # <<<<<<<<<<<<<< + * return lex.lower + * elif feat_name == NORM: +*/ + } + + /* "lexeme.pxd":69 + * elif feat_name == LOWER: + * return lex.lower + * elif feat_name == NORM: # <<<<<<<<<<<<<< + * return lex.norm + * elif feat_name == SHAPE: +*/ + __pyx_t_1 = (__pyx_v_feat_name == __pyx_e_5spacy_5attrs_NORM); + if (__pyx_t_1) { + + /* "lexeme.pxd":70 + * return lex.lower + * elif feat_name == NORM: + * return lex.norm # <<<<<<<<<<<<<< + * elif feat_name == SHAPE: + * return lex.shape +*/ + __pyx_r = __pyx_v_lex->norm; + goto __pyx_L0; + + /* "lexeme.pxd":69 + * elif feat_name == LOWER: + * return lex.lower + * elif feat_name == NORM: # <<<<<<<<<<<<<< + * return lex.norm + * elif feat_name == SHAPE: +*/ + } + + /* "lexeme.pxd":71 + * elif feat_name == NORM: + * return lex.norm + * elif feat_name == SHAPE: # <<<<<<<<<<<<<< + * return lex.shape + * elif feat_name == PREFIX: +*/ + __pyx_t_1 = (__pyx_v_feat_name == __pyx_e_5spacy_5attrs_SHAPE); + if (__pyx_t_1) { + + /* "lexeme.pxd":72 + * return lex.norm + * elif feat_name == SHAPE: + * return lex.shape # <<<<<<<<<<<<<< + * elif feat_name == PREFIX: + * return lex.prefix +*/ + __pyx_r = __pyx_v_lex->shape; + goto __pyx_L0; + + /* "lexeme.pxd":71 + * elif feat_name == NORM: + * return lex.norm + * elif feat_name == SHAPE: # <<<<<<<<<<<<<< + * return lex.shape + * elif feat_name == PREFIX: +*/ + } + + /* "lexeme.pxd":73 + * elif feat_name == SHAPE: + * return lex.shape + * elif feat_name == PREFIX: # <<<<<<<<<<<<<< + * return lex.prefix + * elif feat_name == SUFFIX: +*/ + __pyx_t_1 = (__pyx_v_feat_name == __pyx_e_5spacy_5attrs_PREFIX); + if (__pyx_t_1) { + + /* "lexeme.pxd":74 + * return lex.shape + * elif feat_name == PREFIX: + * return lex.prefix # <<<<<<<<<<<<<< + * elif feat_name == SUFFIX: + * return lex.suffix +*/ + __pyx_r = __pyx_v_lex->prefix; + goto __pyx_L0; + + /* "lexeme.pxd":73 + * elif feat_name == SHAPE: + * return lex.shape + * elif feat_name == PREFIX: # <<<<<<<<<<<<<< + * return lex.prefix + * elif feat_name == SUFFIX: +*/ + } + + /* "lexeme.pxd":75 + * elif feat_name == PREFIX: + * return lex.prefix + * elif feat_name == SUFFIX: # <<<<<<<<<<<<<< + * return lex.suffix + * elif feat_name == LENGTH: +*/ + __pyx_t_1 = (__pyx_v_feat_name == __pyx_e_5spacy_5attrs_SUFFIX); + if (__pyx_t_1) { + + /* "lexeme.pxd":76 + * return lex.prefix + * elif feat_name == SUFFIX: + * return lex.suffix # <<<<<<<<<<<<<< + * elif feat_name == LENGTH: + * return lex.length +*/ + __pyx_r = __pyx_v_lex->suffix; + goto __pyx_L0; + + /* "lexeme.pxd":75 + * elif feat_name == PREFIX: + * return lex.prefix + * elif feat_name == SUFFIX: # <<<<<<<<<<<<<< + * return lex.suffix + * elif feat_name == LENGTH: +*/ + } + + /* "lexeme.pxd":77 + * elif feat_name == SUFFIX: + * return lex.suffix + * elif feat_name == LENGTH: # <<<<<<<<<<<<<< + * return lex.length + * elif feat_name == LANG: +*/ + __pyx_t_1 = (__pyx_v_feat_name == __pyx_e_5spacy_5attrs_LENGTH); + if (__pyx_t_1) { + + /* "lexeme.pxd":78 + * return lex.suffix + * elif feat_name == LENGTH: + * return lex.length # <<<<<<<<<<<<<< + * elif feat_name == LANG: + * return lex.lang +*/ + __pyx_r = __pyx_v_lex->length; + goto __pyx_L0; + + /* "lexeme.pxd":77 + * elif feat_name == SUFFIX: + * return lex.suffix + * elif feat_name == LENGTH: # <<<<<<<<<<<<<< + * return lex.length + * elif feat_name == LANG: +*/ + } + + /* "lexeme.pxd":79 + * elif feat_name == LENGTH: + * return lex.length + * elif feat_name == LANG: # <<<<<<<<<<<<<< + * return lex.lang + * else: +*/ + __pyx_t_1 = (__pyx_v_feat_name == __pyx_e_5spacy_5attrs_LANG); + if (__pyx_t_1) { + + /* "lexeme.pxd":80 + * return lex.length + * elif feat_name == LANG: + * return lex.lang # <<<<<<<<<<<<<< + * else: + * return 0 +*/ + __pyx_r = __pyx_v_lex->lang; + goto __pyx_L0; + + /* "lexeme.pxd":79 + * elif feat_name == LENGTH: + * return lex.length + * elif feat_name == LANG: # <<<<<<<<<<<<<< + * return lex.lang + * else: +*/ + } + + /* "lexeme.pxd":82 + * return lex.lang + * else: + * return 0 # <<<<<<<<<<<<<< + * + * @staticmethod +*/ + /*else*/ { + __pyx_r = 0; + goto __pyx_L0; + } + + /* "lexeme.pxd":56 + * lex.lang = value + * + * @staticmethod # <<<<<<<<<<<<<< + * cdef inline attr_t get_struct_attr(const LexemeC* lex, attr_id_t feat_name) noexcept nogil: + * if feat_name < (sizeof(flags_t) * 8): +*/ + + /* function exit code */ + __pyx_L0:; + return __pyx_r; +} + +/* "lexeme.pxd":84 + * return 0 + * + * @staticmethod # <<<<<<<<<<<<<< + * cdef inline bint c_check_flag(const LexemeC* lexeme, attr_id_t flag_id) noexcept nogil: + * cdef flags_t one = 1 +*/ + +static CYTHON_INLINE int __pyx_f_5spacy_6lexeme_6Lexeme_c_check_flag(struct __pyx_t_5spacy_7structs_LexemeC const *__pyx_v_lexeme, enum __pyx_t_5spacy_5attrs_attr_id_t __pyx_v_flag_id) { + __pyx_t_5spacy_8typedefs_flags_t __pyx_v_one; + int __pyx_r; + int __pyx_t_1; + + /* "lexeme.pxd":86 + * @staticmethod + * cdef inline bint c_check_flag(const LexemeC* lexeme, attr_id_t flag_id) noexcept nogil: + * cdef flags_t one = 1 # <<<<<<<<<<<<<< + * if lexeme.flags & (one << flag_id): + * return True +*/ + __pyx_v_one = 1; + + /* "lexeme.pxd":87 + * cdef inline bint c_check_flag(const LexemeC* lexeme, attr_id_t flag_id) noexcept nogil: + * cdef flags_t one = 1 + * if lexeme.flags & (one << flag_id): # <<<<<<<<<<<<<< + * return True + * else: +*/ + __pyx_t_1 = ((__pyx_v_lexeme->flags & (__pyx_v_one << __pyx_v_flag_id)) != 0); + if (__pyx_t_1) { + + /* "lexeme.pxd":88 + * cdef flags_t one = 1 + * if lexeme.flags & (one << flag_id): + * return True # <<<<<<<<<<<<<< + * else: + * return False +*/ + __pyx_r = 1; + goto __pyx_L0; + + /* "lexeme.pxd":87 + * cdef inline bint c_check_flag(const LexemeC* lexeme, attr_id_t flag_id) noexcept nogil: + * cdef flags_t one = 1 + * if lexeme.flags & (one << flag_id): # <<<<<<<<<<<<<< + * return True + * else: +*/ + } + + /* "lexeme.pxd":90 + * return True + * else: + * return False # <<<<<<<<<<<<<< + * + * @staticmethod +*/ + /*else*/ { + __pyx_r = 0; + goto __pyx_L0; + } + + /* "lexeme.pxd":84 + * return 0 + * + * @staticmethod # <<<<<<<<<<<<<< + * cdef inline bint c_check_flag(const LexemeC* lexeme, attr_id_t flag_id) noexcept nogil: + * cdef flags_t one = 1 +*/ + + /* function exit code */ + __pyx_L0:; + return __pyx_r; +} + +/* "lexeme.pxd":92 + * return False + * + * @staticmethod # <<<<<<<<<<<<<< + * cdef inline bint c_set_flag(LexemeC* lex, attr_id_t flag_id, bint value) noexcept nogil: + * cdef flags_t one = 1 +*/ + +static CYTHON_INLINE int __pyx_f_5spacy_6lexeme_6Lexeme_c_set_flag(struct __pyx_t_5spacy_7structs_LexemeC *__pyx_v_lex, enum __pyx_t_5spacy_5attrs_attr_id_t __pyx_v_flag_id, int __pyx_v_value) { + __pyx_t_5spacy_8typedefs_flags_t __pyx_v_one; + int __pyx_r; + + /* "lexeme.pxd":94 + * @staticmethod + * cdef inline bint c_set_flag(LexemeC* lex, attr_id_t flag_id, bint value) noexcept nogil: + * cdef flags_t one = 1 # <<<<<<<<<<<<<< + * if value: + * lex.flags |= one << flag_id +*/ + __pyx_v_one = 1; + + /* "lexeme.pxd":95 + * cdef inline bint c_set_flag(LexemeC* lex, attr_id_t flag_id, bint value) noexcept nogil: + * cdef flags_t one = 1 + * if value: # <<<<<<<<<<<<<< + * lex.flags |= one << flag_id + * else: +*/ + if (__pyx_v_value) { + + /* "lexeme.pxd":96 + * cdef flags_t one = 1 + * if value: + * lex.flags |= one << flag_id # <<<<<<<<<<<<<< + * else: + * lex.flags &= ~(one << flag_id) +*/ + __pyx_v_lex->flags = (__pyx_v_lex->flags | (__pyx_v_one << __pyx_v_flag_id)); + + /* "lexeme.pxd":95 + * cdef inline bint c_set_flag(LexemeC* lex, attr_id_t flag_id, bint value) noexcept nogil: + * cdef flags_t one = 1 + * if value: # <<<<<<<<<<<<<< + * lex.flags |= one << flag_id + * else: +*/ + goto __pyx_L3; + } + + /* "lexeme.pxd":98 + * lex.flags |= one << flag_id + * else: + * lex.flags &= ~(one << flag_id) # <<<<<<<<<<<<<< +*/ + /*else*/ { + __pyx_v_lex->flags = (__pyx_v_lex->flags & (~(__pyx_v_one << __pyx_v_flag_id))); + } + __pyx_L3:; + + /* "lexeme.pxd":92 + * return False + * + * @staticmethod # <<<<<<<<<<<<<< + * cdef inline bint c_set_flag(LexemeC* lex, attr_id_t flag_id, bint value) noexcept nogil: + * cdef flags_t one = 1 +*/ + + /* function exit code */ + __pyx_r = 0; + return __pyx_r; +} + +/* "_state.pxd":20 + * + * + * cdef inline bint is_space_token(const TokenC* token) noexcept nogil: # <<<<<<<<<<<<<< + * return Lexeme.c_check_flag(token.lex, IS_SPACE) + * +*/ + +static CYTHON_INLINE int __pyx_f_5spacy_8pipeline_17_parser_internals_6_state_is_space_token(struct __pyx_t_5spacy_7structs_TokenC const *__pyx_v_token) { + int __pyx_r; + + /* "_state.pxd":21 + * + * cdef inline bint is_space_token(const TokenC* token) noexcept nogil: + * return Lexeme.c_check_flag(token.lex, IS_SPACE) # <<<<<<<<<<<<<< + * + * cdef struct ArcC: +*/ + __pyx_r = __pyx_f_5spacy_6lexeme_6Lexeme_c_check_flag(__pyx_v_token->lex, __pyx_e_5spacy_5attrs_IS_SPACE); + goto __pyx_L0; + + /* "_state.pxd":20 + * + * + * cdef inline bint is_space_token(const TokenC* token) noexcept nogil: # <<<<<<<<<<<<<< + * return Lexeme.c_check_flag(token.lex, IS_SPACE) + * +*/ + + /* function exit code */ + __pyx_L0:; + return __pyx_r; +} + +/* "_state.pxd":44 + * int _b_i + * + * inline __init__(const TokenC* sent, int length) noexcept nogil: # <<<<<<<<<<<<<< + * this._sent = sent + * this._heads = calloc(length, sizeof(int)) +*/ + +void __pyx_t_5spacy_8pipeline_17_parser_internals_6_state_StateC::__pyx_f___init__StateC(struct __pyx_t_5spacy_7structs_TokenC const *__pyx_v_sent, int __pyx_v_length) { + int __pyx_v_i; + int __pyx_t_1; + int __pyx_t_2; + PyObject *__pyx_t_3; + int __pyx_t_4; + int __pyx_t_5; + int __pyx_t_6; + int __pyx_lineno = 0; + const char *__pyx_filename = NULL; + int __pyx_clineno = 0; + PyGILState_STATE __pyx_gilstate_save; + + /* "_state.pxd":45 + * + * inline __init__(const TokenC* sent, int length) noexcept nogil: + * this._sent = sent # <<<<<<<<<<<<<< + * this._heads = calloc(length, sizeof(int)) + * if not (this._sent and this._heads): +*/ + this->_sent = __pyx_v_sent; + + /* "_state.pxd":46 + * inline __init__(const TokenC* sent, int length) noexcept nogil: + * this._sent = sent + * this._heads = calloc(length, sizeof(int)) # <<<<<<<<<<<<<< + * if not (this._sent and this._heads): + * with gil: +*/ + this->_heads = ((int *)calloc(__pyx_v_length, (sizeof(int)))); + + /* "_state.pxd":47 + * this._sent = sent + * this._heads = calloc(length, sizeof(int)) + * if not (this._sent and this._heads): # <<<<<<<<<<<<<< + * with gil: + * PyErr_SetFromErrno(MemoryError) +*/ + __pyx_t_2 = (this->_sent != 0); + if (__pyx_t_2) { + } else { + __pyx_t_1 = __pyx_t_2; + goto __pyx_L4_bool_binop_done; + } + __pyx_t_2 = (this->_heads != 0); + __pyx_t_1 = __pyx_t_2; + __pyx_L4_bool_binop_done:; + __pyx_t_2 = (!__pyx_t_1); + if (__pyx_t_2) { + + /* "_state.pxd":48 + * this._heads = calloc(length, sizeof(int)) + * if not (this._sent and this._heads): + * with gil: # <<<<<<<<<<<<<< + * PyErr_SetFromErrno(MemoryError) + * PyErr_CheckSignals() +*/ + { + PyGILState_STATE __pyx_gilstate_save = __Pyx_PyGILState_Ensure(); + /*try:*/ { + + /* "_state.pxd":49 + * if not (this._sent and this._heads): + * with gil: + * PyErr_SetFromErrno(MemoryError) # <<<<<<<<<<<<<< + * PyErr_CheckSignals() + * this.offset = 0 +*/ + __pyx_t_3 = PyErr_SetFromErrno(((PyObject *)(((PyTypeObject*)PyExc_MemoryError)))); if (unlikely(__pyx_t_3 == ((void *)NULL))) __PYX_ERR(4, 49, __pyx_L7_error) + + /* "_state.pxd":50 + * with gil: + * PyErr_SetFromErrno(MemoryError) + * PyErr_CheckSignals() # <<<<<<<<<<<<<< + * this.offset = 0 + * this.length = length +*/ + __pyx_t_4 = PyErr_CheckSignals(); if (unlikely(__pyx_t_4 == ((int)-1))) __PYX_ERR(4, 50, __pyx_L7_error) + } + + /* "_state.pxd":48 + * this._heads = calloc(length, sizeof(int)) + * if not (this._sent and this._heads): + * with gil: # <<<<<<<<<<<<<< + * PyErr_SetFromErrno(MemoryError) + * PyErr_CheckSignals() +*/ + /*finally:*/ { + /*normal exit:*/{ + __Pyx_PyGILState_Release(__pyx_gilstate_save); + goto __pyx_L8; + } + __pyx_L7_error: { + __Pyx_PyGILState_Release(__pyx_gilstate_save); + goto __pyx_L1_error; + } + __pyx_L8:; + } + } + + /* "_state.pxd":47 + * this._sent = sent + * this._heads = calloc(length, sizeof(int)) + * if not (this._sent and this._heads): # <<<<<<<<<<<<<< + * with gil: + * PyErr_SetFromErrno(MemoryError) +*/ + } + + /* "_state.pxd":51 + * PyErr_SetFromErrno(MemoryError) + * PyErr_CheckSignals() + * this.offset = 0 # <<<<<<<<<<<<<< + * this.length = length + * this._b_i = 0 +*/ + this->offset = 0; + + /* "_state.pxd":52 + * PyErr_CheckSignals() + * this.offset = 0 + * this.length = length # <<<<<<<<<<<<<< + * this._b_i = 0 + * for i in range(length): +*/ + this->length = __pyx_v_length; + + /* "_state.pxd":53 + * this.offset = 0 + * this.length = length + * this._b_i = 0 # <<<<<<<<<<<<<< + * for i in range(length): + * this._heads[i] = -1 +*/ + this->_b_i = 0; + + /* "_state.pxd":54 + * this.length = length + * this._b_i = 0 + * for i in range(length): # <<<<<<<<<<<<<< + * this._heads[i] = -1 + * this._unshiftable.push_back(0) +*/ + __pyx_t_4 = __pyx_v_length; + __pyx_t_5 = __pyx_t_4; + for (__pyx_t_6 = 0; __pyx_t_6 < __pyx_t_5; __pyx_t_6+=1) { + __pyx_v_i = __pyx_t_6; + + /* "_state.pxd":55 + * this._b_i = 0 + * for i in range(length): + * this._heads[i] = -1 # <<<<<<<<<<<<<< + * this._unshiftable.push_back(0) + * memset(&this._empty_token, 0, sizeof(TokenC)) +*/ + (this->_heads[__pyx_v_i]) = -1; + + /* "_state.pxd":56 + * for i in range(length): + * this._heads[i] = -1 + * this._unshiftable.push_back(0) # <<<<<<<<<<<<<< + * memset(&this._empty_token, 0, sizeof(TokenC)) + * this._empty_token.lex = &EMPTY_LEXEME +*/ + try { + this->_unshiftable.push_back(0); + } catch(...) { + PyGILState_STATE __pyx_gilstate_save = __Pyx_PyGILState_Ensure(); + __Pyx_CppExn2PyErr(); + __Pyx_PyGILState_Release(__pyx_gilstate_save); + __PYX_ERR(4, 56, __pyx_L1_error) + } + } + + /* "_state.pxd":57 + * this._heads[i] = -1 + * this._unshiftable.push_back(0) + * memset(&this._empty_token, 0, sizeof(TokenC)) # <<<<<<<<<<<<<< + * this._empty_token.lex = &EMPTY_LEXEME + * +*/ + (void)(memset((&this->_empty_token), 0, (sizeof(struct __pyx_t_5spacy_7structs_TokenC)))); + + /* "_state.pxd":58 + * this._unshiftable.push_back(0) + * memset(&this._empty_token, 0, sizeof(TokenC)) + * this._empty_token.lex = &EMPTY_LEXEME # <<<<<<<<<<<<<< + * + * inline __dealloc__(): +*/ + this->_empty_token.lex = (&__pyx_v_5spacy_5vocab_EMPTY_LEXEME); + + /* "_state.pxd":44 + * int _b_i + * + * inline __init__(const TokenC* sent, int length) noexcept nogil: # <<<<<<<<<<<<<< + * this._sent = sent + * this._heads = calloc(length, sizeof(int)) +*/ + + /* function exit code */ + goto __pyx_L0; + __pyx_L1_error:; + __pyx_gilstate_save = __Pyx_PyGILState_Ensure(); + __Pyx_WriteUnraisable("StateC.", __pyx_clineno, __pyx_lineno, __pyx_filename, 1, 0); + __Pyx_PyGILState_Release(__pyx_gilstate_save); + __pyx_L0:; +} + +/* "_state.pxd":60 + * this._empty_token.lex = &EMPTY_LEXEME + * + * inline __dealloc__(): # <<<<<<<<<<<<<< + * free(this._heads) + * +*/ + +void __pyx_t_5spacy_8pipeline_17_parser_internals_6_state_StateC::__pyx_f___dealloc__StateC(void) { + + /* "_state.pxd":61 + * + * inline __dealloc__(): + * free(this._heads) # <<<<<<<<<<<<<< + * + * inline void set_context_tokens(int* ids, int n) noexcept nogil: +*/ + free(this->_heads); + + /* "_state.pxd":60 + * this._empty_token.lex = &EMPTY_LEXEME + * + * inline __dealloc__(): # <<<<<<<<<<<<<< + * free(this._heads) + * +*/ + + /* function exit code */ +} + +/* "_state.pxd":63 + * free(this._heads) + * + * inline void set_context_tokens(int* ids, int n) noexcept nogil: # <<<<<<<<<<<<<< + * cdef int i, j + * if n == 1: +*/ + +void __pyx_t_5spacy_8pipeline_17_parser_internals_6_state_StateC::set_context_tokens(int *__pyx_v_ids, int __pyx_v_n) { + int __pyx_v_i; + int __pyx_v_j; + struct __pyx_t_5spacy_7structs_SpanC __pyx_v_ent; + int __pyx_t_1; + int __pyx_t_2; + int __pyx_t_3; + int __pyx_t_4; + int __pyx_t_5; + int __pyx_t_6; + + /* "_state.pxd":65 + * inline void set_context_tokens(int* ids, int n) noexcept nogil: + * cdef int i, j + * if n == 1: # <<<<<<<<<<<<<< + * if this.B(0) >= 0: + * ids[0] = this.B(0) +*/ + switch (__pyx_v_n) { + case 1: + + /* "_state.pxd":66 + * cdef int i, j + * if n == 1: + * if this.B(0) >= 0: # <<<<<<<<<<<<<< + * ids[0] = this.B(0) + * else: +*/ + __pyx_t_1 = (this->B(0) >= 0); + if (__pyx_t_1) { + + /* "_state.pxd":67 + * if n == 1: + * if this.B(0) >= 0: + * ids[0] = this.B(0) # <<<<<<<<<<<<<< + * else: + * ids[0] = -1 +*/ + (__pyx_v_ids[0]) = this->B(0); + + /* "_state.pxd":66 + * cdef int i, j + * if n == 1: + * if this.B(0) >= 0: # <<<<<<<<<<<<<< + * ids[0] = this.B(0) + * else: +*/ + goto __pyx_L3; + } + + /* "_state.pxd":69 + * ids[0] = this.B(0) + * else: + * ids[0] = -1 # <<<<<<<<<<<<<< + * elif n == 2: + * ids[0] = this.B(0) +*/ + /*else*/ { + (__pyx_v_ids[0]) = -1; + } + __pyx_L3:; + + /* "_state.pxd":65 + * inline void set_context_tokens(int* ids, int n) noexcept nogil: + * cdef int i, j + * if n == 1: # <<<<<<<<<<<<<< + * if this.B(0) >= 0: + * ids[0] = this.B(0) +*/ + break; + case 2: + + /* "_state.pxd":71 + * ids[0] = -1 + * elif n == 2: + * ids[0] = this.B(0) # <<<<<<<<<<<<<< + * ids[1] = this.S(0) + * elif n == 3: +*/ + (__pyx_v_ids[0]) = this->B(0); + + /* "_state.pxd":72 + * elif n == 2: + * ids[0] = this.B(0) + * ids[1] = this.S(0) # <<<<<<<<<<<<<< + * elif n == 3: + * if this.B(0) >= 0: +*/ + (__pyx_v_ids[1]) = this->S(0); + + /* "_state.pxd":70 + * else: + * ids[0] = -1 + * elif n == 2: # <<<<<<<<<<<<<< + * ids[0] = this.B(0) + * ids[1] = this.S(0) +*/ + break; + case 3: + + /* "_state.pxd":74 + * ids[1] = this.S(0) + * elif n == 3: + * if this.B(0) >= 0: # <<<<<<<<<<<<<< + * ids[0] = this.B(0) + * else: +*/ + __pyx_t_1 = (this->B(0) >= 0); + if (__pyx_t_1) { + + /* "_state.pxd":75 + * elif n == 3: + * if this.B(0) >= 0: + * ids[0] = this.B(0) # <<<<<<<<<<<<<< + * else: + * ids[0] = -1 +*/ + (__pyx_v_ids[0]) = this->B(0); + + /* "_state.pxd":74 + * ids[1] = this.S(0) + * elif n == 3: + * if this.B(0) >= 0: # <<<<<<<<<<<<<< + * ids[0] = this.B(0) + * else: +*/ + goto __pyx_L4; + } + + /* "_state.pxd":77 + * ids[0] = this.B(0) + * else: + * ids[0] = -1 # <<<<<<<<<<<<<< + * # First word of entity, if any + * if this.entity_is_open(): +*/ + /*else*/ { + (__pyx_v_ids[0]) = -1; + } + __pyx_L4:; + + /* "_state.pxd":79 + * ids[0] = -1 + * # First word of entity, if any + * if this.entity_is_open(): # <<<<<<<<<<<<<< + * ids[1] = this.E(0) + * else: +*/ + __pyx_t_1 = this->entity_is_open(); + if (__pyx_t_1) { + + /* "_state.pxd":80 + * # First word of entity, if any + * if this.entity_is_open(): + * ids[1] = this.E(0) # <<<<<<<<<<<<<< + * else: + * ids[1] = -1 +*/ + (__pyx_v_ids[1]) = this->E(0); + + /* "_state.pxd":79 + * ids[0] = -1 + * # First word of entity, if any + * if this.entity_is_open(): # <<<<<<<<<<<<<< + * ids[1] = this.E(0) + * else: +*/ + goto __pyx_L5; + } + + /* "_state.pxd":82 + * ids[1] = this.E(0) + * else: + * ids[1] = -1 # <<<<<<<<<<<<<< + * # Last word of entity, if within entity + * if ids[0] == -1 or ids[1] == -1: +*/ + /*else*/ { + (__pyx_v_ids[1]) = -1; + } + __pyx_L5:; + + /* "_state.pxd":84 + * ids[1] = -1 + * # Last word of entity, if within entity + * if ids[0] == -1 or ids[1] == -1: # <<<<<<<<<<<<<< + * ids[2] = -1 + * else: +*/ + __pyx_t_2 = ((__pyx_v_ids[0]) == -1L); + if (!__pyx_t_2) { + } else { + __pyx_t_1 = __pyx_t_2; + goto __pyx_L7_bool_binop_done; + } + __pyx_t_2 = ((__pyx_v_ids[1]) == -1L); + __pyx_t_1 = __pyx_t_2; + __pyx_L7_bool_binop_done:; + if (__pyx_t_1) { + + /* "_state.pxd":85 + * # Last word of entity, if within entity + * if ids[0] == -1 or ids[1] == -1: + * ids[2] = -1 # <<<<<<<<<<<<<< + * else: + * ids[2] = ids[0] - 1 +*/ + (__pyx_v_ids[2]) = -1; + + /* "_state.pxd":84 + * ids[1] = -1 + * # Last word of entity, if within entity + * if ids[0] == -1 or ids[1] == -1: # <<<<<<<<<<<<<< + * ids[2] = -1 + * else: +*/ + goto __pyx_L6; + } + + /* "_state.pxd":87 + * ids[2] = -1 + * else: + * ids[2] = ids[0] - 1 # <<<<<<<<<<<<<< + * elif n == 8: + * ids[0] = this.B(0) +*/ + /*else*/ { + (__pyx_v_ids[2]) = ((__pyx_v_ids[0]) - 1); + } + __pyx_L6:; + + /* "_state.pxd":73 + * ids[0] = this.B(0) + * ids[1] = this.S(0) + * elif n == 3: # <<<<<<<<<<<<<< + * if this.B(0) >= 0: + * ids[0] = this.B(0) +*/ + break; + case 8: + + /* "_state.pxd":89 + * ids[2] = ids[0] - 1 + * elif n == 8: + * ids[0] = this.B(0) # <<<<<<<<<<<<<< + * ids[1] = this.B(1) + * ids[2] = this.S(0) +*/ + (__pyx_v_ids[0]) = this->B(0); + + /* "_state.pxd":90 + * elif n == 8: + * ids[0] = this.B(0) + * ids[1] = this.B(1) # <<<<<<<<<<<<<< + * ids[2] = this.S(0) + * ids[3] = this.S(1) +*/ + (__pyx_v_ids[1]) = this->B(1); + + /* "_state.pxd":91 + * ids[0] = this.B(0) + * ids[1] = this.B(1) + * ids[2] = this.S(0) # <<<<<<<<<<<<<< + * ids[3] = this.S(1) + * ids[4] = this.S(2) +*/ + (__pyx_v_ids[2]) = this->S(0); + + /* "_state.pxd":92 + * ids[1] = this.B(1) + * ids[2] = this.S(0) + * ids[3] = this.S(1) # <<<<<<<<<<<<<< + * ids[4] = this.S(2) + * ids[5] = this.L(this.B(0), 1) +*/ + (__pyx_v_ids[3]) = this->S(1); + + /* "_state.pxd":93 + * ids[2] = this.S(0) + * ids[3] = this.S(1) + * ids[4] = this.S(2) # <<<<<<<<<<<<<< + * ids[5] = this.L(this.B(0), 1) + * ids[6] = this.L(this.S(0), 1) +*/ + (__pyx_v_ids[4]) = this->S(2); + + /* "_state.pxd":94 + * ids[3] = this.S(1) + * ids[4] = this.S(2) + * ids[5] = this.L(this.B(0), 1) # <<<<<<<<<<<<<< + * ids[6] = this.L(this.S(0), 1) + * ids[7] = this.R(this.S(0), 1) +*/ + (__pyx_v_ids[5]) = this->L(this->B(0), 1); + + /* "_state.pxd":95 + * ids[4] = this.S(2) + * ids[5] = this.L(this.B(0), 1) + * ids[6] = this.L(this.S(0), 1) # <<<<<<<<<<<<<< + * ids[7] = this.R(this.S(0), 1) + * elif n == 13: +*/ + (__pyx_v_ids[6]) = this->L(this->S(0), 1); + + /* "_state.pxd":96 + * ids[5] = this.L(this.B(0), 1) + * ids[6] = this.L(this.S(0), 1) + * ids[7] = this.R(this.S(0), 1) # <<<<<<<<<<<<<< + * elif n == 13: + * ids[0] = this.B(0) +*/ + (__pyx_v_ids[7]) = this->R(this->S(0), 1); + + /* "_state.pxd":88 + * else: + * ids[2] = ids[0] - 1 + * elif n == 8: # <<<<<<<<<<<<<< + * ids[0] = this.B(0) + * ids[1] = this.B(1) +*/ + break; + case 13: + + /* "_state.pxd":98 + * ids[7] = this.R(this.S(0), 1) + * elif n == 13: + * ids[0] = this.B(0) # <<<<<<<<<<<<<< + * ids[1] = this.B(1) + * ids[2] = this.S(0) +*/ + (__pyx_v_ids[0]) = this->B(0); + + /* "_state.pxd":99 + * elif n == 13: + * ids[0] = this.B(0) + * ids[1] = this.B(1) # <<<<<<<<<<<<<< + * ids[2] = this.S(0) + * ids[3] = this.S(1) +*/ + (__pyx_v_ids[1]) = this->B(1); + + /* "_state.pxd":100 + * ids[0] = this.B(0) + * ids[1] = this.B(1) + * ids[2] = this.S(0) # <<<<<<<<<<<<<< + * ids[3] = this.S(1) + * ids[4] = this.S(2) +*/ + (__pyx_v_ids[2]) = this->S(0); + + /* "_state.pxd":101 + * ids[1] = this.B(1) + * ids[2] = this.S(0) + * ids[3] = this.S(1) # <<<<<<<<<<<<<< + * ids[4] = this.S(2) + * ids[5] = this.L(this.S(0), 1) +*/ + (__pyx_v_ids[3]) = this->S(1); + + /* "_state.pxd":102 + * ids[2] = this.S(0) + * ids[3] = this.S(1) + * ids[4] = this.S(2) # <<<<<<<<<<<<<< + * ids[5] = this.L(this.S(0), 1) + * ids[6] = this.L(this.S(0), 2) +*/ + (__pyx_v_ids[4]) = this->S(2); + + /* "_state.pxd":103 + * ids[3] = this.S(1) + * ids[4] = this.S(2) + * ids[5] = this.L(this.S(0), 1) # <<<<<<<<<<<<<< + * ids[6] = this.L(this.S(0), 2) + * ids[6] = this.R(this.S(0), 1) +*/ + (__pyx_v_ids[5]) = this->L(this->S(0), 1); + + /* "_state.pxd":104 + * ids[4] = this.S(2) + * ids[5] = this.L(this.S(0), 1) + * ids[6] = this.L(this.S(0), 2) # <<<<<<<<<<<<<< + * ids[6] = this.R(this.S(0), 1) + * ids[7] = this.L(this.B(0), 1) +*/ + (__pyx_v_ids[6]) = this->L(this->S(0), 2); + + /* "_state.pxd":105 + * ids[5] = this.L(this.S(0), 1) + * ids[6] = this.L(this.S(0), 2) + * ids[6] = this.R(this.S(0), 1) # <<<<<<<<<<<<<< + * ids[7] = this.L(this.B(0), 1) + * ids[8] = this.R(this.S(0), 2) +*/ + (__pyx_v_ids[6]) = this->R(this->S(0), 1); + + /* "_state.pxd":106 + * ids[6] = this.L(this.S(0), 2) + * ids[6] = this.R(this.S(0), 1) + * ids[7] = this.L(this.B(0), 1) # <<<<<<<<<<<<<< + * ids[8] = this.R(this.S(0), 2) + * ids[9] = this.L(this.S(1), 1) +*/ + (__pyx_v_ids[7]) = this->L(this->B(0), 1); + + /* "_state.pxd":107 + * ids[6] = this.R(this.S(0), 1) + * ids[7] = this.L(this.B(0), 1) + * ids[8] = this.R(this.S(0), 2) # <<<<<<<<<<<<<< + * ids[9] = this.L(this.S(1), 1) + * ids[10] = this.L(this.S(1), 2) +*/ + (__pyx_v_ids[8]) = this->R(this->S(0), 2); + + /* "_state.pxd":108 + * ids[7] = this.L(this.B(0), 1) + * ids[8] = this.R(this.S(0), 2) + * ids[9] = this.L(this.S(1), 1) # <<<<<<<<<<<<<< + * ids[10] = this.L(this.S(1), 2) + * ids[11] = this.R(this.S(1), 1) +*/ + (__pyx_v_ids[9]) = this->L(this->S(1), 1); + + /* "_state.pxd":109 + * ids[8] = this.R(this.S(0), 2) + * ids[9] = this.L(this.S(1), 1) + * ids[10] = this.L(this.S(1), 2) # <<<<<<<<<<<<<< + * ids[11] = this.R(this.S(1), 1) + * ids[12] = this.R(this.S(1), 2) +*/ + (__pyx_v_ids[10]) = this->L(this->S(1), 2); + + /* "_state.pxd":110 + * ids[9] = this.L(this.S(1), 1) + * ids[10] = this.L(this.S(1), 2) + * ids[11] = this.R(this.S(1), 1) # <<<<<<<<<<<<<< + * ids[12] = this.R(this.S(1), 2) + * elif n == 6: +*/ + (__pyx_v_ids[11]) = this->R(this->S(1), 1); + + /* "_state.pxd":111 + * ids[10] = this.L(this.S(1), 2) + * ids[11] = this.R(this.S(1), 1) + * ids[12] = this.R(this.S(1), 2) # <<<<<<<<<<<<<< + * elif n == 6: + * for i in range(6): +*/ + (__pyx_v_ids[12]) = this->R(this->S(1), 2); + + /* "_state.pxd":97 + * ids[6] = this.L(this.S(0), 1) + * ids[7] = this.R(this.S(0), 1) + * elif n == 13: # <<<<<<<<<<<<<< + * ids[0] = this.B(0) + * ids[1] = this.B(1) +*/ + break; + case 6: + + /* "_state.pxd":113 + * ids[12] = this.R(this.S(1), 2) + * elif n == 6: + * for i in range(6): # <<<<<<<<<<<<<< + * ids[i] = -1 + * if this.B(0) >= 0: +*/ + for (__pyx_t_3 = 0; __pyx_t_3 < 6; __pyx_t_3+=1) { + __pyx_v_i = __pyx_t_3; + + /* "_state.pxd":114 + * elif n == 6: + * for i in range(6): + * ids[i] = -1 # <<<<<<<<<<<<<< + * if this.B(0) >= 0: + * ids[0] = this.B(0) +*/ + (__pyx_v_ids[__pyx_v_i]) = -1; + } + + /* "_state.pxd":115 + * for i in range(6): + * ids[i] = -1 + * if this.B(0) >= 0: # <<<<<<<<<<<<<< + * ids[0] = this.B(0) + * if this.entity_is_open(): +*/ + __pyx_t_1 = (this->B(0) >= 0); + if (__pyx_t_1) { + + /* "_state.pxd":116 + * ids[i] = -1 + * if this.B(0) >= 0: + * ids[0] = this.B(0) # <<<<<<<<<<<<<< + * if this.entity_is_open(): + * ent = this.get_ent() +*/ + (__pyx_v_ids[0]) = this->B(0); + + /* "_state.pxd":115 + * for i in range(6): + * ids[i] = -1 + * if this.B(0) >= 0: # <<<<<<<<<<<<<< + * ids[0] = this.B(0) + * if this.entity_is_open(): +*/ + } + + /* "_state.pxd":117 + * if this.B(0) >= 0: + * ids[0] = this.B(0) + * if this.entity_is_open(): # <<<<<<<<<<<<<< + * ent = this.get_ent() + * j = 1 +*/ + __pyx_t_1 = this->entity_is_open(); + if (__pyx_t_1) { + + /* "_state.pxd":118 + * ids[0] = this.B(0) + * if this.entity_is_open(): + * ent = this.get_ent() # <<<<<<<<<<<<<< + * j = 1 + * for i in range(ent.start, this.B(0)): +*/ + __pyx_v_ent = this->get_ent(); + + /* "_state.pxd":119 + * if this.entity_is_open(): + * ent = this.get_ent() + * j = 1 # <<<<<<<<<<<<<< + * for i in range(ent.start, this.B(0)): + * ids[j] = i +*/ + __pyx_v_j = 1; + + /* "_state.pxd":120 + * ent = this.get_ent() + * j = 1 + * for i in range(ent.start, this.B(0)): # <<<<<<<<<<<<<< + * ids[j] = i + * j += 1 +*/ + __pyx_t_3 = this->B(0); + __pyx_t_4 = __pyx_t_3; + for (__pyx_t_5 = __pyx_v_ent.start; __pyx_t_5 < __pyx_t_4; __pyx_t_5+=1) { + __pyx_v_i = __pyx_t_5; + + /* "_state.pxd":121 + * j = 1 + * for i in range(ent.start, this.B(0)): + * ids[j] = i # <<<<<<<<<<<<<< + * j += 1 + * if j >= 6: +*/ + (__pyx_v_ids[__pyx_v_j]) = __pyx_v_i; + + /* "_state.pxd":122 + * for i in range(ent.start, this.B(0)): + * ids[j] = i + * j += 1 # <<<<<<<<<<<<<< + * if j >= 6: + * break +*/ + __pyx_v_j = (__pyx_v_j + 1); + + /* "_state.pxd":123 + * ids[j] = i + * j += 1 + * if j >= 6: # <<<<<<<<<<<<<< + * break + * else: +*/ + __pyx_t_1 = (__pyx_v_j >= 6); + if (__pyx_t_1) { + + /* "_state.pxd":124 + * j += 1 + * if j >= 6: + * break # <<<<<<<<<<<<<< + * else: + * # TODO error =/ +*/ + goto __pyx_L14_break; + + /* "_state.pxd":123 + * ids[j] = i + * j += 1 + * if j >= 6: # <<<<<<<<<<<<<< + * break + * else: +*/ + } + } + __pyx_L14_break:; + + /* "_state.pxd":117 + * if this.B(0) >= 0: + * ids[0] = this.B(0) + * if this.entity_is_open(): # <<<<<<<<<<<<<< + * ent = this.get_ent() + * j = 1 +*/ + } + + /* "_state.pxd":112 + * ids[11] = this.R(this.S(1), 1) + * ids[12] = this.R(this.S(1), 2) + * elif n == 6: # <<<<<<<<<<<<<< + * for i in range(6): + * ids[i] = -1 +*/ + break; + default: + break; + } + + /* "_state.pxd":128 + * # TODO error =/ + * pass + * for i in range(n): # <<<<<<<<<<<<<< + * if ids[i] >= 0: + * ids[i] += this.offset +*/ + __pyx_t_3 = __pyx_v_n; + __pyx_t_4 = __pyx_t_3; + for (__pyx_t_5 = 0; __pyx_t_5 < __pyx_t_4; __pyx_t_5+=1) { + __pyx_v_i = __pyx_t_5; + + /* "_state.pxd":129 + * pass + * for i in range(n): + * if ids[i] >= 0: # <<<<<<<<<<<<<< + * ids[i] += this.offset + * else: +*/ + __pyx_t_1 = ((__pyx_v_ids[__pyx_v_i]) >= 0); + if (__pyx_t_1) { + + /* "_state.pxd":130 + * for i in range(n): + * if ids[i] >= 0: + * ids[i] += this.offset # <<<<<<<<<<<<<< + * else: + * ids[i] = -1 +*/ + __pyx_t_6 = __pyx_v_i; + (__pyx_v_ids[__pyx_t_6]) = ((__pyx_v_ids[__pyx_t_6]) + this->offset); + + /* "_state.pxd":129 + * pass + * for i in range(n): + * if ids[i] >= 0: # <<<<<<<<<<<<<< + * ids[i] += this.offset + * else: +*/ + goto __pyx_L18; + } + + /* "_state.pxd":132 + * ids[i] += this.offset + * else: + * ids[i] = -1 # <<<<<<<<<<<<<< + * + * inline int S(int i) noexcept nogil const: +*/ + /*else*/ { + (__pyx_v_ids[__pyx_v_i]) = -1; + } + __pyx_L18:; + } + + /* "_state.pxd":63 + * free(this._heads) + * + * inline void set_context_tokens(int* ids, int n) noexcept nogil: # <<<<<<<<<<<<<< + * cdef int i, j + * if n == 1: +*/ + + /* function exit code */ +} + +/* "_state.pxd":134 + * ids[i] = -1 + * + * inline int S(int i) noexcept nogil const: # <<<<<<<<<<<<<< + * if i >= this._stack.size(): + * return -1 +*/ + +int __pyx_t_5spacy_8pipeline_17_parser_internals_6_state_StateC::S(int __pyx_v_i) const { + int __pyx_r; + int __pyx_t_1; + __Pyx_FakeReference __pyx_t_2; + int __pyx_lineno = 0; + const char *__pyx_filename = NULL; + int __pyx_clineno = 0; + PyGILState_STATE __pyx_gilstate_save; + + /* "_state.pxd":135 + * + * inline int S(int i) noexcept nogil const: + * if i >= this._stack.size(): # <<<<<<<<<<<<<< + * return -1 + * elif i < 0: +*/ + __pyx_t_1 = (__pyx_v_i >= this->_stack.size()); + if (__pyx_t_1) { + + /* "_state.pxd":136 + * inline int S(int i) noexcept nogil const: + * if i >= this._stack.size(): + * return -1 # <<<<<<<<<<<<<< + * elif i < 0: + * return -1 +*/ + __pyx_r = -1; + goto __pyx_L0; + + /* "_state.pxd":135 + * + * inline int S(int i) noexcept nogil const: + * if i >= this._stack.size(): # <<<<<<<<<<<<<< + * return -1 + * elif i < 0: +*/ + } + + /* "_state.pxd":137 + * if i >= this._stack.size(): + * return -1 + * elif i < 0: # <<<<<<<<<<<<<< + * return -1 + * return this._stack.at(this._stack.size() - (i+1)) +*/ + __pyx_t_1 = (__pyx_v_i < 0); + if (__pyx_t_1) { + + /* "_state.pxd":138 + * return -1 + * elif i < 0: + * return -1 # <<<<<<<<<<<<<< + * return this._stack.at(this._stack.size() - (i+1)) + * +*/ + __pyx_r = -1; + goto __pyx_L0; + + /* "_state.pxd":137 + * if i >= this._stack.size(): + * return -1 + * elif i < 0: # <<<<<<<<<<<<<< + * return -1 + * return this._stack.at(this._stack.size() - (i+1)) +*/ + } + + /* "_state.pxd":139 + * elif i < 0: + * return -1 + * return this._stack.at(this._stack.size() - (i+1)) # <<<<<<<<<<<<<< + * + * inline int B(int i) noexcept nogil const: +*/ + try { + __pyx_t_2 = this->_stack.at((this->_stack.size() - (__pyx_v_i + 1))); + } catch(...) { + PyGILState_STATE __pyx_gilstate_save = __Pyx_PyGILState_Ensure(); + __Pyx_CppExn2PyErr(); + __Pyx_PyGILState_Release(__pyx_gilstate_save); + __PYX_ERR(4, 139, __pyx_L1_error) + } + __pyx_r = __pyx_t_2; + goto __pyx_L0; + + /* "_state.pxd":134 + * ids[i] = -1 + * + * inline int S(int i) noexcept nogil const: # <<<<<<<<<<<<<< + * if i >= this._stack.size(): + * return -1 +*/ + + /* function exit code */ + __pyx_L1_error:; + __pyx_gilstate_save = __Pyx_PyGILState_Ensure(); + __Pyx_WriteUnraisable("StateC.S", __pyx_clineno, __pyx_lineno, __pyx_filename, 1, 0); + __pyx_r = 0; + __Pyx_PyGILState_Release(__pyx_gilstate_save); + __pyx_L0:; + return __pyx_r; +} + +/* "_state.pxd":141 + * return this._stack.at(this._stack.size() - (i+1)) + * + * inline int B(int i) noexcept nogil const: # <<<<<<<<<<<<<< + * if i < 0: + * return -1 +*/ + +int __pyx_t_5spacy_8pipeline_17_parser_internals_6_state_StateC::B(int __pyx_v_i) const { + std::vector ::size_type __pyx_v_b_i; + int __pyx_r; + int __pyx_t_1; + __Pyx_FakeReference __pyx_t_2; + int __pyx_lineno = 0; + const char *__pyx_filename = NULL; + int __pyx_clineno = 0; + PyGILState_STATE __pyx_gilstate_save; + + /* "_state.pxd":142 + * + * inline int B(int i) noexcept nogil const: + * if i < 0: # <<<<<<<<<<<<<< + * return -1 + * elif i < this._rebuffer.size(): +*/ + __pyx_t_1 = (__pyx_v_i < 0); + if (__pyx_t_1) { + + /* "_state.pxd":143 + * inline int B(int i) noexcept nogil const: + * if i < 0: + * return -1 # <<<<<<<<<<<<<< + * elif i < this._rebuffer.size(): + * return this._rebuffer.at(this._rebuffer.size() - (i+1)) +*/ + __pyx_r = -1; + goto __pyx_L0; + + /* "_state.pxd":142 + * + * inline int B(int i) noexcept nogil const: + * if i < 0: # <<<<<<<<<<<<<< + * return -1 + * elif i < this._rebuffer.size(): +*/ + } + + /* "_state.pxd":144 + * if i < 0: + * return -1 + * elif i < this._rebuffer.size(): # <<<<<<<<<<<<<< + * return this._rebuffer.at(this._rebuffer.size() - (i+1)) + * else: +*/ + __pyx_t_1 = (__pyx_v_i < this->_rebuffer.size()); + if (__pyx_t_1) { + + /* "_state.pxd":145 + * return -1 + * elif i < this._rebuffer.size(): + * return this._rebuffer.at(this._rebuffer.size() - (i+1)) # <<<<<<<<<<<<<< + * else: + * b_i = this._b_i + (i - this._rebuffer.size()) +*/ + try { + __pyx_t_2 = this->_rebuffer.at((this->_rebuffer.size() - (__pyx_v_i + 1))); + } catch(...) { + PyGILState_STATE __pyx_gilstate_save = __Pyx_PyGILState_Ensure(); + __Pyx_CppExn2PyErr(); + __Pyx_PyGILState_Release(__pyx_gilstate_save); + __PYX_ERR(4, 145, __pyx_L1_error) + } + __pyx_r = __pyx_t_2; + goto __pyx_L0; + + /* "_state.pxd":144 + * if i < 0: + * return -1 + * elif i < this._rebuffer.size(): # <<<<<<<<<<<<<< + * return this._rebuffer.at(this._rebuffer.size() - (i+1)) + * else: +*/ + } + + /* "_state.pxd":147 + * return this._rebuffer.at(this._rebuffer.size() - (i+1)) + * else: + * b_i = this._b_i + (i - this._rebuffer.size()) # <<<<<<<<<<<<<< + * if b_i >= this.length: + * return -1 +*/ + /*else*/ { + __pyx_v_b_i = (this->_b_i + (__pyx_v_i - this->_rebuffer.size())); + + /* "_state.pxd":148 + * else: + * b_i = this._b_i + (i - this._rebuffer.size()) + * if b_i >= this.length: # <<<<<<<<<<<<<< + * return -1 + * else: +*/ + __pyx_t_1 = (__pyx_v_b_i >= this->length); + if (__pyx_t_1) { + + /* "_state.pxd":149 + * b_i = this._b_i + (i - this._rebuffer.size()) + * if b_i >= this.length: + * return -1 # <<<<<<<<<<<<<< + * else: + * return b_i +*/ + __pyx_r = -1; + goto __pyx_L0; + + /* "_state.pxd":148 + * else: + * b_i = this._b_i + (i - this._rebuffer.size()) + * if b_i >= this.length: # <<<<<<<<<<<<<< + * return -1 + * else: +*/ + } + + /* "_state.pxd":151 + * return -1 + * else: + * return b_i # <<<<<<<<<<<<<< + * + * inline const TokenC* B_(int i) noexcept nogil const: +*/ + /*else*/ { + __pyx_r = __pyx_v_b_i; + goto __pyx_L0; + } + } + + /* "_state.pxd":141 + * return this._stack.at(this._stack.size() - (i+1)) + * + * inline int B(int i) noexcept nogil const: # <<<<<<<<<<<<<< + * if i < 0: + * return -1 +*/ + + /* function exit code */ + __pyx_L1_error:; + __pyx_gilstate_save = __Pyx_PyGILState_Ensure(); + __Pyx_WriteUnraisable("StateC.B", __pyx_clineno, __pyx_lineno, __pyx_filename, 1, 0); + __pyx_r = 0; + __Pyx_PyGILState_Release(__pyx_gilstate_save); + __pyx_L0:; + return __pyx_r; +} + +/* "_state.pxd":153 + * return b_i + * + * inline const TokenC* B_(int i) noexcept nogil const: # <<<<<<<<<<<<<< + * return this.safe_get(this.B(i)) + * +*/ + +struct __pyx_t_5spacy_7structs_TokenC const *__pyx_t_5spacy_8pipeline_17_parser_internals_6_state_StateC::B_(int __pyx_v_i) const { + struct __pyx_t_5spacy_7structs_TokenC const *__pyx_r; + + /* "_state.pxd":154 + * + * inline const TokenC* B_(int i) noexcept nogil const: + * return this.safe_get(this.B(i)) # <<<<<<<<<<<<<< + * + * inline const TokenC* E_(int i) noexcept nogil const: +*/ + __pyx_r = this->safe_get(this->B(__pyx_v_i)); + goto __pyx_L0; + + /* "_state.pxd":153 + * return b_i + * + * inline const TokenC* B_(int i) noexcept nogil const: # <<<<<<<<<<<<<< + * return this.safe_get(this.B(i)) + * +*/ + + /* function exit code */ + __pyx_L0:; + return __pyx_r; +} + +/* "_state.pxd":156 + * return this.safe_get(this.B(i)) + * + * inline const TokenC* E_(int i) noexcept nogil const: # <<<<<<<<<<<<<< + * return this.safe_get(this.E(i)) + * +*/ + +struct __pyx_t_5spacy_7structs_TokenC const *__pyx_t_5spacy_8pipeline_17_parser_internals_6_state_StateC::E_(int __pyx_v_i) const { + struct __pyx_t_5spacy_7structs_TokenC const *__pyx_r; + + /* "_state.pxd":157 + * + * inline const TokenC* E_(int i) noexcept nogil const: + * return this.safe_get(this.E(i)) # <<<<<<<<<<<<<< + * + * inline const TokenC* safe_get(int i) noexcept nogil const: +*/ + __pyx_r = this->safe_get(this->E(__pyx_v_i)); + goto __pyx_L0; + + /* "_state.pxd":156 + * return this.safe_get(this.B(i)) + * + * inline const TokenC* E_(int i) noexcept nogil const: # <<<<<<<<<<<<<< + * return this.safe_get(this.E(i)) + * +*/ + + /* function exit code */ + __pyx_L0:; + return __pyx_r; +} + +/* "_state.pxd":159 + * return this.safe_get(this.E(i)) + * + * inline const TokenC* safe_get(int i) noexcept nogil const: # <<<<<<<<<<<<<< + * if i < 0 or i >= this.length: + * return &this._empty_token +*/ + +struct __pyx_t_5spacy_7structs_TokenC const *__pyx_t_5spacy_8pipeline_17_parser_internals_6_state_StateC::safe_get(int __pyx_v_i) const { + struct __pyx_t_5spacy_7structs_TokenC const *__pyx_r; + int __pyx_t_1; + int __pyx_t_2; + + /* "_state.pxd":160 + * + * inline const TokenC* safe_get(int i) noexcept nogil const: + * if i < 0 or i >= this.length: # <<<<<<<<<<<<<< + * return &this._empty_token + * else: +*/ + __pyx_t_2 = (__pyx_v_i < 0); + if (!__pyx_t_2) { + } else { + __pyx_t_1 = __pyx_t_2; + goto __pyx_L4_bool_binop_done; + } + __pyx_t_2 = (__pyx_v_i >= this->length); + __pyx_t_1 = __pyx_t_2; + __pyx_L4_bool_binop_done:; + if (__pyx_t_1) { + + /* "_state.pxd":161 + * inline const TokenC* safe_get(int i) noexcept nogil const: + * if i < 0 or i >= this.length: + * return &this._empty_token # <<<<<<<<<<<<<< + * else: + * return &this._sent[i] +*/ + __pyx_r = (&this->_empty_token); + goto __pyx_L0; + + /* "_state.pxd":160 + * + * inline const TokenC* safe_get(int i) noexcept nogil const: + * if i < 0 or i >= this.length: # <<<<<<<<<<<<<< + * return &this._empty_token + * else: +*/ + } + + /* "_state.pxd":163 + * return &this._empty_token + * else: + * return &this._sent[i] # <<<<<<<<<<<<<< + * + * inline void map_get_arcs(const unordered_map[int, vector[ArcC]] &heads_arcs, vector[ArcC]* out) noexcept nogil const: +*/ + /*else*/ { + __pyx_r = (&(this->_sent[__pyx_v_i])); + goto __pyx_L0; + } + + /* "_state.pxd":159 + * return this.safe_get(this.E(i)) + * + * inline const TokenC* safe_get(int i) noexcept nogil const: # <<<<<<<<<<<<<< + * if i < 0 or i >= this.length: + * return &this._empty_token +*/ + + /* function exit code */ + __pyx_L0:; + return __pyx_r; +} + +/* "_state.pxd":165 + * return &this._sent[i] + * + * inline void map_get_arcs(const unordered_map[int, vector[ArcC]] &heads_arcs, vector[ArcC]* out) noexcept nogil const: # <<<<<<<<<<<<<< + * cdef const vector[ArcC]* arcs + * head_arcs_it = heads_arcs.const_begin() +*/ + +void __pyx_t_5spacy_8pipeline_17_parser_internals_6_state_StateC::map_get_arcs(std::unordered_map > const &__pyx_v_heads_arcs, std::vector *__pyx_v_out) const { + std::vector const *__pyx_v_arcs; + std::unordered_map > ::const_iterator __pyx_v_head_arcs_it; + std::vector ::const_iterator __pyx_v_arcs_it; + struct __pyx_t_5spacy_8pipeline_17_parser_internals_6_state_ArcC __pyx_v_arc; + int __pyx_t_1; + int __pyx_t_2; + int __pyx_lineno = 0; + const char *__pyx_filename = NULL; + int __pyx_clineno = 0; + PyGILState_STATE __pyx_gilstate_save; + + /* "_state.pxd":167 + * inline void map_get_arcs(const unordered_map[int, vector[ArcC]] &heads_arcs, vector[ArcC]* out) noexcept nogil const: + * cdef const vector[ArcC]* arcs + * head_arcs_it = heads_arcs.const_begin() # <<<<<<<<<<<<<< + * while head_arcs_it != heads_arcs.const_end(): + * arcs = &deref(head_arcs_it).second +*/ + try { + __pyx_v_head_arcs_it = __pyx_v_heads_arcs.begin(); + } catch(...) { + PyGILState_STATE __pyx_gilstate_save = __Pyx_PyGILState_Ensure(); + __Pyx_CppExn2PyErr(); + __Pyx_PyGILState_Release(__pyx_gilstate_save); + __PYX_ERR(4, 167, __pyx_L1_error) + } + + /* "_state.pxd":168 + * cdef const vector[ArcC]* arcs + * head_arcs_it = heads_arcs.const_begin() + * while head_arcs_it != heads_arcs.const_end(): # <<<<<<<<<<<<<< + * arcs = &deref(head_arcs_it).second + * arcs_it = arcs.const_begin() +*/ + while (1) { + __pyx_t_1 = (__pyx_v_head_arcs_it != __pyx_v_heads_arcs.end()); + if (!__pyx_t_1) break; + + /* "_state.pxd":169 + * head_arcs_it = heads_arcs.const_begin() + * while head_arcs_it != heads_arcs.const_end(): + * arcs = &deref(head_arcs_it).second # <<<<<<<<<<<<<< + * arcs_it = arcs.const_begin() + * while arcs_it != arcs.const_end(): +*/ + __pyx_v_arcs = (&(*__pyx_v_head_arcs_it).second); + + /* "_state.pxd":170 + * while head_arcs_it != heads_arcs.const_end(): + * arcs = &deref(head_arcs_it).second + * arcs_it = arcs.const_begin() # <<<<<<<<<<<<<< + * while arcs_it != arcs.const_end(): + * arc = deref(arcs_it) +*/ + try { + __pyx_v_arcs_it = __pyx_v_arcs->begin(); + } catch(...) { + PyGILState_STATE __pyx_gilstate_save = __Pyx_PyGILState_Ensure(); + __Pyx_CppExn2PyErr(); + __Pyx_PyGILState_Release(__pyx_gilstate_save); + __PYX_ERR(4, 170, __pyx_L1_error) + } + + /* "_state.pxd":171 + * arcs = &deref(head_arcs_it).second + * arcs_it = arcs.const_begin() + * while arcs_it != arcs.const_end(): # <<<<<<<<<<<<<< + * arc = deref(arcs_it) + * if arc.head != -1 and arc.child != -1: +*/ + while (1) { + __pyx_t_1 = (__pyx_v_arcs_it != __pyx_v_arcs->end()); + if (!__pyx_t_1) break; + + /* "_state.pxd":172 + * arcs_it = arcs.const_begin() + * while arcs_it != arcs.const_end(): + * arc = deref(arcs_it) # <<<<<<<<<<<<<< + * if arc.head != -1 and arc.child != -1: + * out.push_back(arc) +*/ + __pyx_v_arc = (*__pyx_v_arcs_it); + + /* "_state.pxd":173 + * while arcs_it != arcs.const_end(): + * arc = deref(arcs_it) + * if arc.head != -1 and arc.child != -1: # <<<<<<<<<<<<<< + * out.push_back(arc) + * incr(arcs_it) +*/ + __pyx_t_2 = (__pyx_v_arc.head != -1L); + if (__pyx_t_2) { + } else { + __pyx_t_1 = __pyx_t_2; + goto __pyx_L8_bool_binop_done; + } + __pyx_t_2 = (__pyx_v_arc.child != -1L); + __pyx_t_1 = __pyx_t_2; + __pyx_L8_bool_binop_done:; + if (__pyx_t_1) { + + /* "_state.pxd":174 + * arc = deref(arcs_it) + * if arc.head != -1 and arc.child != -1: + * out.push_back(arc) # <<<<<<<<<<<<<< + * incr(arcs_it) + * incr(head_arcs_it) +*/ + try { + __pyx_v_out->push_back(__pyx_v_arc); + } catch(...) { + PyGILState_STATE __pyx_gilstate_save = __Pyx_PyGILState_Ensure(); + __Pyx_CppExn2PyErr(); + __Pyx_PyGILState_Release(__pyx_gilstate_save); + __PYX_ERR(4, 174, __pyx_L1_error) + } + + /* "_state.pxd":173 + * while arcs_it != arcs.const_end(): + * arc = deref(arcs_it) + * if arc.head != -1 and arc.child != -1: # <<<<<<<<<<<<<< + * out.push_back(arc) + * incr(arcs_it) +*/ + } + + /* "_state.pxd":175 + * if arc.head != -1 and arc.child != -1: + * out.push_back(arc) + * incr(arcs_it) # <<<<<<<<<<<<<< + * incr(head_arcs_it) + * +*/ + (void)((++__pyx_v_arcs_it)); + } + + /* "_state.pxd":176 + * out.push_back(arc) + * incr(arcs_it) + * incr(head_arcs_it) # <<<<<<<<<<<<<< + * + * inline void get_arcs(vector[ArcC]* out) noexcept nogil const: +*/ + (void)((++__pyx_v_head_arcs_it)); + } + + /* "_state.pxd":165 + * return &this._sent[i] + * + * inline void map_get_arcs(const unordered_map[int, vector[ArcC]] &heads_arcs, vector[ArcC]* out) noexcept nogil const: # <<<<<<<<<<<<<< + * cdef const vector[ArcC]* arcs + * head_arcs_it = heads_arcs.const_begin() +*/ + + /* function exit code */ + goto __pyx_L0; + __pyx_L1_error:; + __pyx_gilstate_save = __Pyx_PyGILState_Ensure(); + __Pyx_WriteUnraisable("StateC.map_get_arcs", __pyx_clineno, __pyx_lineno, __pyx_filename, 1, 0); + __Pyx_PyGILState_Release(__pyx_gilstate_save); + __pyx_L0:; +} + +/* "_state.pxd":178 + * incr(head_arcs_it) + * + * inline void get_arcs(vector[ArcC]* out) noexcept nogil const: # <<<<<<<<<<<<<< + * this.map_get_arcs(this._left_arcs, out) + * this.map_get_arcs(this._right_arcs, out) +*/ + +void __pyx_t_5spacy_8pipeline_17_parser_internals_6_state_StateC::get_arcs(std::vector *__pyx_v_out) const { + + /* "_state.pxd":179 + * + * inline void get_arcs(vector[ArcC]* out) noexcept nogil const: + * this.map_get_arcs(this._left_arcs, out) # <<<<<<<<<<<<<< + * this.map_get_arcs(this._right_arcs, out) + * +*/ + this->map_get_arcs(this->_left_arcs, __pyx_v_out); + + /* "_state.pxd":180 + * inline void get_arcs(vector[ArcC]* out) noexcept nogil const: + * this.map_get_arcs(this._left_arcs, out) + * this.map_get_arcs(this._right_arcs, out) # <<<<<<<<<<<<<< + * + * inline int H(int child) noexcept nogil const: +*/ + this->map_get_arcs(this->_right_arcs, __pyx_v_out); + + /* "_state.pxd":178 + * incr(head_arcs_it) + * + * inline void get_arcs(vector[ArcC]* out) noexcept nogil const: # <<<<<<<<<<<<<< + * this.map_get_arcs(this._left_arcs, out) + * this.map_get_arcs(this._right_arcs, out) +*/ + + /* function exit code */ +} + +/* "_state.pxd":182 + * this.map_get_arcs(this._right_arcs, out) + * + * inline int H(int child) noexcept nogil const: # <<<<<<<<<<<<<< + * if child >= this.length or child < 0: + * return -1 +*/ + +int __pyx_t_5spacy_8pipeline_17_parser_internals_6_state_StateC::H(int __pyx_v_child) const { + int __pyx_r; + int __pyx_t_1; + int __pyx_t_2; + + /* "_state.pxd":183 + * + * inline int H(int child) noexcept nogil const: + * if child >= this.length or child < 0: # <<<<<<<<<<<<<< + * return -1 + * else: +*/ + __pyx_t_2 = (__pyx_v_child >= this->length); + if (!__pyx_t_2) { + } else { + __pyx_t_1 = __pyx_t_2; + goto __pyx_L4_bool_binop_done; + } + __pyx_t_2 = (__pyx_v_child < 0); + __pyx_t_1 = __pyx_t_2; + __pyx_L4_bool_binop_done:; + if (__pyx_t_1) { + + /* "_state.pxd":184 + * inline int H(int child) noexcept nogil const: + * if child >= this.length or child < 0: + * return -1 # <<<<<<<<<<<<<< + * else: + * return this._heads[child] +*/ + __pyx_r = -1; + goto __pyx_L0; + + /* "_state.pxd":183 + * + * inline int H(int child) noexcept nogil const: + * if child >= this.length or child < 0: # <<<<<<<<<<<<<< + * return -1 + * else: +*/ + } + + /* "_state.pxd":186 + * return -1 + * else: + * return this._heads[child] # <<<<<<<<<<<<<< + * + * inline int E(int i) noexcept nogil const: +*/ + /*else*/ { + __pyx_r = (this->_heads[__pyx_v_child]); + goto __pyx_L0; + } + + /* "_state.pxd":182 + * this.map_get_arcs(this._right_arcs, out) + * + * inline int H(int child) noexcept nogil const: # <<<<<<<<<<<<<< + * if child >= this.length or child < 0: + * return -1 +*/ + + /* function exit code */ + __pyx_L0:; + return __pyx_r; +} + +/* "_state.pxd":188 + * return this._heads[child] + * + * inline int E(int i) noexcept nogil const: # <<<<<<<<<<<<<< + * if this._ents.size() == 0: + * return -1 +*/ + +int __pyx_t_5spacy_8pipeline_17_parser_internals_6_state_StateC::E(CYTHON_UNUSED int __pyx_v_i) const { + int __pyx_r; + int __pyx_t_1; + + /* "_state.pxd":189 + * + * inline int E(int i) noexcept nogil const: + * if this._ents.size() == 0: # <<<<<<<<<<<<<< + * return -1 + * else: +*/ + __pyx_t_1 = (this->_ents.size() == 0); + if (__pyx_t_1) { + + /* "_state.pxd":190 + * inline int E(int i) noexcept nogil const: + * if this._ents.size() == 0: + * return -1 # <<<<<<<<<<<<<< + * else: + * return this._ents.back().start +*/ + __pyx_r = -1; + goto __pyx_L0; + + /* "_state.pxd":189 + * + * inline int E(int i) noexcept nogil const: + * if this._ents.size() == 0: # <<<<<<<<<<<<<< + * return -1 + * else: +*/ + } + + /* "_state.pxd":192 + * return -1 + * else: + * return this._ents.back().start # <<<<<<<<<<<<<< + * + * inline int nth_child(const unordered_map[int, vector[ArcC]]& heads_arcs, int head, int idx) noexcept nogil const: +*/ + /*else*/ { + __pyx_r = this->_ents.back().start; + goto __pyx_L0; + } + + /* "_state.pxd":188 + * return this._heads[child] + * + * inline int E(int i) noexcept nogil const: # <<<<<<<<<<<<<< + * if this._ents.size() == 0: + * return -1 +*/ + + /* function exit code */ + __pyx_L0:; + return __pyx_r; +} + +/* "_state.pxd":194 + * return this._ents.back().start + * + * inline int nth_child(const unordered_map[int, vector[ArcC]]& heads_arcs, int head, int idx) noexcept nogil const: # <<<<<<<<<<<<<< + * if idx < 1: + * return -1 +*/ + +int __pyx_t_5spacy_8pipeline_17_parser_internals_6_state_StateC::nth_child(std::unordered_map > const &__pyx_v_heads_arcs, int __pyx_v_head, int __pyx_v_idx) const { + std::unordered_map > ::const_iterator __pyx_v_head_arcs_it; + std::vector const *__pyx_v_arcs; + size_t __pyx_v_child_index; + std::vector ::const_reverse_iterator __pyx_v_arcs_it; + struct __pyx_t_5spacy_8pipeline_17_parser_internals_6_state_ArcC __pyx_v_arc; + int __pyx_r; + int __pyx_t_1; + int __pyx_t_2; + int __pyx_lineno = 0; + const char *__pyx_filename = NULL; + int __pyx_clineno = 0; + PyGILState_STATE __pyx_gilstate_save; + + /* "_state.pxd":195 + * + * inline int nth_child(const unordered_map[int, vector[ArcC]]& heads_arcs, int head, int idx) noexcept nogil const: + * if idx < 1: # <<<<<<<<<<<<<< + * return -1 + * +*/ + __pyx_t_1 = (__pyx_v_idx < 1); + if (__pyx_t_1) { + + /* "_state.pxd":196 + * inline int nth_child(const unordered_map[int, vector[ArcC]]& heads_arcs, int head, int idx) noexcept nogil const: + * if idx < 1: + * return -1 # <<<<<<<<<<<<<< + * + * head_arcs_it = heads_arcs.const_find(head) +*/ + __pyx_r = -1; + goto __pyx_L0; + + /* "_state.pxd":195 + * + * inline int nth_child(const unordered_map[int, vector[ArcC]]& heads_arcs, int head, int idx) noexcept nogil const: + * if idx < 1: # <<<<<<<<<<<<<< + * return -1 + * +*/ + } + + /* "_state.pxd":198 + * return -1 + * + * head_arcs_it = heads_arcs.const_find(head) # <<<<<<<<<<<<<< + * if head_arcs_it == heads_arcs.const_end(): + * return -1 +*/ + try { + __pyx_v_head_arcs_it = __pyx_v_heads_arcs.find(__pyx_v_head); + } catch(...) { + PyGILState_STATE __pyx_gilstate_save = __Pyx_PyGILState_Ensure(); + __Pyx_CppExn2PyErr(); + __Pyx_PyGILState_Release(__pyx_gilstate_save); + __PYX_ERR(4, 198, __pyx_L1_error) + } + + /* "_state.pxd":199 + * + * head_arcs_it = heads_arcs.const_find(head) + * if head_arcs_it == heads_arcs.const_end(): # <<<<<<<<<<<<<< + * return -1 + * +*/ + __pyx_t_1 = (__pyx_v_head_arcs_it == __pyx_v_heads_arcs.end()); + if (__pyx_t_1) { + + /* "_state.pxd":200 + * head_arcs_it = heads_arcs.const_find(head) + * if head_arcs_it == heads_arcs.const_end(): + * return -1 # <<<<<<<<<<<<<< + * + * cdef const vector[ArcC]* arcs = &deref(head_arcs_it).second +*/ + __pyx_r = -1; + goto __pyx_L0; + + /* "_state.pxd":199 + * + * head_arcs_it = heads_arcs.const_find(head) + * if head_arcs_it == heads_arcs.const_end(): # <<<<<<<<<<<<<< + * return -1 + * +*/ + } + + /* "_state.pxd":202 + * return -1 + * + * cdef const vector[ArcC]* arcs = &deref(head_arcs_it).second # <<<<<<<<<<<<<< + * + * # Work backwards through arcs to find the arc at the +*/ + __pyx_v_arcs = (&(*__pyx_v_head_arcs_it).second); + + /* "_state.pxd":206 + * # Work backwards through arcs to find the arc at the + * # requested index more quickly. + * cdef size_t child_index = 0 # <<<<<<<<<<<<<< + * arcs_it = arcs.const_rbegin() + * while arcs_it != arcs.const_rend() and child_index != idx: +*/ + __pyx_v_child_index = 0; + + /* "_state.pxd":207 + * # requested index more quickly. + * cdef size_t child_index = 0 + * arcs_it = arcs.const_rbegin() # <<<<<<<<<<<<<< + * while arcs_it != arcs.const_rend() and child_index != idx: + * arc = deref(arcs_it) +*/ + try { + __pyx_v_arcs_it = __pyx_v_arcs->rbegin(); + } catch(...) { + PyGILState_STATE __pyx_gilstate_save = __Pyx_PyGILState_Ensure(); + __Pyx_CppExn2PyErr(); + __Pyx_PyGILState_Release(__pyx_gilstate_save); + __PYX_ERR(4, 207, __pyx_L1_error) + } + + /* "_state.pxd":208 + * cdef size_t child_index = 0 + * arcs_it = arcs.const_rbegin() + * while arcs_it != arcs.const_rend() and child_index != idx: # <<<<<<<<<<<<<< + * arc = deref(arcs_it) + * if arc.child != -1: +*/ + while (1) { + __pyx_t_2 = (__pyx_v_arcs_it != __pyx_v_arcs->rend()); + if (__pyx_t_2) { + } else { + __pyx_t_1 = __pyx_t_2; + goto __pyx_L7_bool_binop_done; + } + __pyx_t_2 = (__pyx_v_child_index != __pyx_v_idx); + __pyx_t_1 = __pyx_t_2; + __pyx_L7_bool_binop_done:; + if (!__pyx_t_1) break; + + /* "_state.pxd":209 + * arcs_it = arcs.const_rbegin() + * while arcs_it != arcs.const_rend() and child_index != idx: + * arc = deref(arcs_it) # <<<<<<<<<<<<<< + * if arc.child != -1: + * child_index += 1 +*/ + __pyx_v_arc = (*__pyx_v_arcs_it); + + /* "_state.pxd":210 + * while arcs_it != arcs.const_rend() and child_index != idx: + * arc = deref(arcs_it) + * if arc.child != -1: # <<<<<<<<<<<<<< + * child_index += 1 + * if child_index == idx: +*/ + __pyx_t_1 = (__pyx_v_arc.child != -1L); + if (__pyx_t_1) { + + /* "_state.pxd":211 + * arc = deref(arcs_it) + * if arc.child != -1: + * child_index += 1 # <<<<<<<<<<<<<< + * if child_index == idx: + * return arc.child +*/ + __pyx_v_child_index = (__pyx_v_child_index + 1); + + /* "_state.pxd":212 + * if arc.child != -1: + * child_index += 1 + * if child_index == idx: # <<<<<<<<<<<<<< + * return arc.child + * incr(arcs_it) +*/ + __pyx_t_1 = (__pyx_v_child_index == __pyx_v_idx); + if (__pyx_t_1) { + + /* "_state.pxd":213 + * child_index += 1 + * if child_index == idx: + * return arc.child # <<<<<<<<<<<<<< + * incr(arcs_it) + * +*/ + __pyx_r = __pyx_v_arc.child; + goto __pyx_L0; + + /* "_state.pxd":212 + * if arc.child != -1: + * child_index += 1 + * if child_index == idx: # <<<<<<<<<<<<<< + * return arc.child + * incr(arcs_it) +*/ + } + + /* "_state.pxd":210 + * while arcs_it != arcs.const_rend() and child_index != idx: + * arc = deref(arcs_it) + * if arc.child != -1: # <<<<<<<<<<<<<< + * child_index += 1 + * if child_index == idx: +*/ + } + + /* "_state.pxd":214 + * if child_index == idx: + * return arc.child + * incr(arcs_it) # <<<<<<<<<<<<<< + * + * return -1 +*/ + (void)((++__pyx_v_arcs_it)); + } + + /* "_state.pxd":216 + * incr(arcs_it) + * + * return -1 # <<<<<<<<<<<<<< + * + * inline int L(int head, int idx) noexcept nogil const: +*/ + __pyx_r = -1; + goto __pyx_L0; + + /* "_state.pxd":194 + * return this._ents.back().start + * + * inline int nth_child(const unordered_map[int, vector[ArcC]]& heads_arcs, int head, int idx) noexcept nogil const: # <<<<<<<<<<<<<< + * if idx < 1: + * return -1 +*/ + + /* function exit code */ + __pyx_L1_error:; + __pyx_gilstate_save = __Pyx_PyGILState_Ensure(); + __Pyx_WriteUnraisable("StateC.nth_child", __pyx_clineno, __pyx_lineno, __pyx_filename, 1, 0); + __pyx_r = 0; + __Pyx_PyGILState_Release(__pyx_gilstate_save); + __pyx_L0:; + return __pyx_r; +} + +/* "_state.pxd":218 + * return -1 + * + * inline int L(int head, int idx) noexcept nogil const: # <<<<<<<<<<<<<< + * return this.nth_child(this._left_arcs, head, idx) + * +*/ + +int __pyx_t_5spacy_8pipeline_17_parser_internals_6_state_StateC::L(int __pyx_v_head, int __pyx_v_idx) const { + int __pyx_r; + + /* "_state.pxd":219 + * + * inline int L(int head, int idx) noexcept nogil const: + * return this.nth_child(this._left_arcs, head, idx) # <<<<<<<<<<<<<< + * + * inline int R(int head, int idx) noexcept nogil const: +*/ + __pyx_r = this->nth_child(this->_left_arcs, __pyx_v_head, __pyx_v_idx); + goto __pyx_L0; + + /* "_state.pxd":218 + * return -1 + * + * inline int L(int head, int idx) noexcept nogil const: # <<<<<<<<<<<<<< + * return this.nth_child(this._left_arcs, head, idx) + * +*/ + + /* function exit code */ + __pyx_L0:; + return __pyx_r; +} + +/* "_state.pxd":221 + * return this.nth_child(this._left_arcs, head, idx) + * + * inline int R(int head, int idx) noexcept nogil const: # <<<<<<<<<<<<<< + * return this.nth_child(this._right_arcs, head, idx) + * +*/ + +int __pyx_t_5spacy_8pipeline_17_parser_internals_6_state_StateC::R(int __pyx_v_head, int __pyx_v_idx) const { + int __pyx_r; + + /* "_state.pxd":222 + * + * inline int R(int head, int idx) noexcept nogil const: + * return this.nth_child(this._right_arcs, head, idx) # <<<<<<<<<<<<<< + * + * inline bint empty() noexcept nogil const: +*/ + __pyx_r = this->nth_child(this->_right_arcs, __pyx_v_head, __pyx_v_idx); + goto __pyx_L0; + + /* "_state.pxd":221 + * return this.nth_child(this._left_arcs, head, idx) + * + * inline int R(int head, int idx) noexcept nogil const: # <<<<<<<<<<<<<< + * return this.nth_child(this._right_arcs, head, idx) + * +*/ + + /* function exit code */ + __pyx_L0:; + return __pyx_r; +} + +/* "_state.pxd":224 + * return this.nth_child(this._right_arcs, head, idx) + * + * inline bint empty() noexcept nogil const: # <<<<<<<<<<<<<< + * return this._stack.size() == 0 + * +*/ + +int __pyx_t_5spacy_8pipeline_17_parser_internals_6_state_StateC::empty(void) const { + int __pyx_r; + + /* "_state.pxd":225 + * + * inline bint empty() noexcept nogil const: + * return this._stack.size() == 0 # <<<<<<<<<<<<<< + * + * inline bint eol() noexcept nogil const: +*/ + __pyx_r = (this->_stack.size() == 0); + goto __pyx_L0; + + /* "_state.pxd":224 + * return this.nth_child(this._right_arcs, head, idx) + * + * inline bint empty() noexcept nogil const: # <<<<<<<<<<<<<< + * return this._stack.size() == 0 + * +*/ + + /* function exit code */ + __pyx_L0:; + return __pyx_r; +} + +/* "_state.pxd":227 + * return this._stack.size() == 0 + * + * inline bint eol() noexcept nogil const: # <<<<<<<<<<<<<< + * return this.buffer_length() == 0 + * +*/ + +int __pyx_t_5spacy_8pipeline_17_parser_internals_6_state_StateC::eol(void) const { + int __pyx_r; + + /* "_state.pxd":228 + * + * inline bint eol() noexcept nogil const: + * return this.buffer_length() == 0 # <<<<<<<<<<<<<< + * + * inline bint is_final() noexcept nogil const: +*/ + __pyx_r = (this->buffer_length() == 0); + goto __pyx_L0; + + /* "_state.pxd":227 + * return this._stack.size() == 0 + * + * inline bint eol() noexcept nogil const: # <<<<<<<<<<<<<< + * return this.buffer_length() == 0 + * +*/ + + /* function exit code */ + __pyx_L0:; + return __pyx_r; +} + +/* "_state.pxd":230 + * return this.buffer_length() == 0 + * + * inline bint is_final() noexcept nogil const: # <<<<<<<<<<<<<< + * return this.stack_depth() <= 0 and this.eol() + * +*/ + +int __pyx_t_5spacy_8pipeline_17_parser_internals_6_state_StateC::is_final(void) const { + int __pyx_r; + int __pyx_t_1; + int __pyx_t_2; + + /* "_state.pxd":231 + * + * inline bint is_final() noexcept nogil const: + * return this.stack_depth() <= 0 and this.eol() # <<<<<<<<<<<<<< + * + * inline int cannot_sent_start(int word) noexcept nogil const: +*/ + __pyx_t_2 = (this->stack_depth() <= 0); + if (__pyx_t_2) { + } else { + __pyx_t_1 = __pyx_t_2; + goto __pyx_L3_bool_binop_done; + } + __pyx_t_2 = this->eol(); + __pyx_t_1 = __pyx_t_2; + __pyx_L3_bool_binop_done:; + __pyx_r = __pyx_t_1; + goto __pyx_L0; + + /* "_state.pxd":230 + * return this.buffer_length() == 0 + * + * inline bint is_final() noexcept nogil const: # <<<<<<<<<<<<<< + * return this.stack_depth() <= 0 and this.eol() + * +*/ + + /* function exit code */ + __pyx_L0:; + return __pyx_r; +} + +/* "_state.pxd":233 + * return this.stack_depth() <= 0 and this.eol() + * + * inline int cannot_sent_start(int word) noexcept nogil const: # <<<<<<<<<<<<<< + * if word < 0 or word >= this.length: + * return 0 +*/ + +int __pyx_t_5spacy_8pipeline_17_parser_internals_6_state_StateC::cannot_sent_start(int __pyx_v_word) const { + int __pyx_r; + int __pyx_t_1; + int __pyx_t_2; + + /* "_state.pxd":234 + * + * inline int cannot_sent_start(int word) noexcept nogil const: + * if word < 0 or word >= this.length: # <<<<<<<<<<<<<< + * return 0 + * elif this._sent[word].sent_start == -1: +*/ + __pyx_t_2 = (__pyx_v_word < 0); + if (!__pyx_t_2) { + } else { + __pyx_t_1 = __pyx_t_2; + goto __pyx_L4_bool_binop_done; + } + __pyx_t_2 = (__pyx_v_word >= this->length); + __pyx_t_1 = __pyx_t_2; + __pyx_L4_bool_binop_done:; + if (__pyx_t_1) { + + /* "_state.pxd":235 + * inline int cannot_sent_start(int word) noexcept nogil const: + * if word < 0 or word >= this.length: + * return 0 # <<<<<<<<<<<<<< + * elif this._sent[word].sent_start == -1: + * return 1 +*/ + __pyx_r = 0; + goto __pyx_L0; + + /* "_state.pxd":234 + * + * inline int cannot_sent_start(int word) noexcept nogil const: + * if word < 0 or word >= this.length: # <<<<<<<<<<<<<< + * return 0 + * elif this._sent[word].sent_start == -1: +*/ + } + + /* "_state.pxd":236 + * if word < 0 or word >= this.length: + * return 0 + * elif this._sent[word].sent_start == -1: # <<<<<<<<<<<<<< + * return 1 + * else: +*/ + __pyx_t_1 = ((this->_sent[__pyx_v_word]).sent_start == -1L); + if (__pyx_t_1) { + + /* "_state.pxd":237 + * return 0 + * elif this._sent[word].sent_start == -1: + * return 1 # <<<<<<<<<<<<<< + * else: + * return 0 +*/ + __pyx_r = 1; + goto __pyx_L0; + + /* "_state.pxd":236 + * if word < 0 or word >= this.length: + * return 0 + * elif this._sent[word].sent_start == -1: # <<<<<<<<<<<<<< + * return 1 + * else: +*/ + } + + /* "_state.pxd":239 + * return 1 + * else: + * return 0 # <<<<<<<<<<<<<< + * + * inline int is_sent_start(int word) noexcept nogil const: +*/ + /*else*/ { + __pyx_r = 0; + goto __pyx_L0; + } + + /* "_state.pxd":233 + * return this.stack_depth() <= 0 and this.eol() + * + * inline int cannot_sent_start(int word) noexcept nogil const: # <<<<<<<<<<<<<< + * if word < 0 or word >= this.length: + * return 0 +*/ + + /* function exit code */ + __pyx_L0:; + return __pyx_r; +} + +/* "_state.pxd":241 + * return 0 + * + * inline int is_sent_start(int word) noexcept nogil const: # <<<<<<<<<<<<<< + * if word < 0 or word >= this.length: + * return 0 +*/ + +int __pyx_t_5spacy_8pipeline_17_parser_internals_6_state_StateC::is_sent_start(int __pyx_v_word) const { + int __pyx_r; + int __pyx_t_1; + int __pyx_t_2; + + /* "_state.pxd":242 + * + * inline int is_sent_start(int word) noexcept nogil const: + * if word < 0 or word >= this.length: # <<<<<<<<<<<<<< + * return 0 + * elif this._sent[word].sent_start == 1: +*/ + __pyx_t_2 = (__pyx_v_word < 0); + if (!__pyx_t_2) { + } else { + __pyx_t_1 = __pyx_t_2; + goto __pyx_L4_bool_binop_done; + } + __pyx_t_2 = (__pyx_v_word >= this->length); + __pyx_t_1 = __pyx_t_2; + __pyx_L4_bool_binop_done:; + if (__pyx_t_1) { + + /* "_state.pxd":243 + * inline int is_sent_start(int word) noexcept nogil const: + * if word < 0 or word >= this.length: + * return 0 # <<<<<<<<<<<<<< + * elif this._sent[word].sent_start == 1: + * return 1 +*/ + __pyx_r = 0; + goto __pyx_L0; + + /* "_state.pxd":242 + * + * inline int is_sent_start(int word) noexcept nogil const: + * if word < 0 or word >= this.length: # <<<<<<<<<<<<<< + * return 0 + * elif this._sent[word].sent_start == 1: +*/ + } + + /* "_state.pxd":244 + * if word < 0 or word >= this.length: + * return 0 + * elif this._sent[word].sent_start == 1: # <<<<<<<<<<<<<< + * return 1 + * elif this._sent_starts.count(word) >= 1: +*/ + __pyx_t_1 = ((this->_sent[__pyx_v_word]).sent_start == 1); + if (__pyx_t_1) { + + /* "_state.pxd":245 + * return 0 + * elif this._sent[word].sent_start == 1: + * return 1 # <<<<<<<<<<<<<< + * elif this._sent_starts.count(word) >= 1: + * return 1 +*/ + __pyx_r = 1; + goto __pyx_L0; + + /* "_state.pxd":244 + * if word < 0 or word >= this.length: + * return 0 + * elif this._sent[word].sent_start == 1: # <<<<<<<<<<<<<< + * return 1 + * elif this._sent_starts.count(word) >= 1: +*/ + } + + /* "_state.pxd":246 + * elif this._sent[word].sent_start == 1: + * return 1 + * elif this._sent_starts.count(word) >= 1: # <<<<<<<<<<<<<< + * return 1 + * else: +*/ + __pyx_t_1 = (this->_sent_starts.count(__pyx_v_word) >= 1); + if (__pyx_t_1) { + + /* "_state.pxd":247 + * return 1 + * elif this._sent_starts.count(word) >= 1: + * return 1 # <<<<<<<<<<<<<< + * else: + * return 0 +*/ + __pyx_r = 1; + goto __pyx_L0; + + /* "_state.pxd":246 + * elif this._sent[word].sent_start == 1: + * return 1 + * elif this._sent_starts.count(word) >= 1: # <<<<<<<<<<<<<< + * return 1 + * else: +*/ + } + + /* "_state.pxd":249 + * return 1 + * else: + * return 0 # <<<<<<<<<<<<<< + * + * inline void set_sent_start(int word, int value) noexcept nogil: +*/ + /*else*/ { + __pyx_r = 0; + goto __pyx_L0; + } + + /* "_state.pxd":241 + * return 0 + * + * inline int is_sent_start(int word) noexcept nogil const: # <<<<<<<<<<<<<< + * if word < 0 or word >= this.length: + * return 0 +*/ + + /* function exit code */ + __pyx_L0:; + return __pyx_r; +} + +/* "_state.pxd":251 + * return 0 + * + * inline void set_sent_start(int word, int value) noexcept nogil: # <<<<<<<<<<<<<< + * if value >= 1: + * this._sent_starts.insert(word) +*/ + +void __pyx_t_5spacy_8pipeline_17_parser_internals_6_state_StateC::set_sent_start(int __pyx_v_word, int __pyx_v_value) { + int __pyx_t_1; + int __pyx_lineno = 0; + const char *__pyx_filename = NULL; + int __pyx_clineno = 0; + PyGILState_STATE __pyx_gilstate_save; + + /* "_state.pxd":252 + * + * inline void set_sent_start(int word, int value) noexcept nogil: + * if value >= 1: # <<<<<<<<<<<<<< + * this._sent_starts.insert(word) + * +*/ + __pyx_t_1 = (__pyx_v_value >= 1); + if (__pyx_t_1) { + + /* "_state.pxd":253 + * inline void set_sent_start(int word, int value) noexcept nogil: + * if value >= 1: + * this._sent_starts.insert(word) # <<<<<<<<<<<<<< + * + * inline bint has_head(int child) noexcept nogil const: +*/ + try { + this->_sent_starts.insert(__pyx_v_word); + } catch(...) { + PyGILState_STATE __pyx_gilstate_save = __Pyx_PyGILState_Ensure(); + __Pyx_CppExn2PyErr(); + __Pyx_PyGILState_Release(__pyx_gilstate_save); + __PYX_ERR(4, 253, __pyx_L1_error) + } + + /* "_state.pxd":252 + * + * inline void set_sent_start(int word, int value) noexcept nogil: + * if value >= 1: # <<<<<<<<<<<<<< + * this._sent_starts.insert(word) + * +*/ + } + + /* "_state.pxd":251 + * return 0 + * + * inline void set_sent_start(int word, int value) noexcept nogil: # <<<<<<<<<<<<<< + * if value >= 1: + * this._sent_starts.insert(word) +*/ + + /* function exit code */ + goto __pyx_L0; + __pyx_L1_error:; + __pyx_gilstate_save = __Pyx_PyGILState_Ensure(); + __Pyx_WriteUnraisable("StateC.set_sent_start", __pyx_clineno, __pyx_lineno, __pyx_filename, 1, 0); + __Pyx_PyGILState_Release(__pyx_gilstate_save); + __pyx_L0:; +} + +/* "_state.pxd":255 + * this._sent_starts.insert(word) + * + * inline bint has_head(int child) noexcept nogil const: # <<<<<<<<<<<<<< + * return this._heads[child] >= 0 + * +*/ + +int __pyx_t_5spacy_8pipeline_17_parser_internals_6_state_StateC::has_head(int __pyx_v_child) const { + int __pyx_r; + + /* "_state.pxd":256 + * + * inline bint has_head(int child) noexcept nogil const: + * return this._heads[child] >= 0 # <<<<<<<<<<<<<< + * + * inline int l_edge(int word) noexcept nogil const: +*/ + __pyx_r = ((this->_heads[__pyx_v_child]) >= 0); + goto __pyx_L0; + + /* "_state.pxd":255 + * this._sent_starts.insert(word) + * + * inline bint has_head(int child) noexcept nogil const: # <<<<<<<<<<<<<< + * return this._heads[child] >= 0 + * +*/ + + /* function exit code */ + __pyx_L0:; + return __pyx_r; +} + +/* "_state.pxd":258 + * return this._heads[child] >= 0 + * + * inline int l_edge(int word) noexcept nogil const: # <<<<<<<<<<<<<< + * return word + * +*/ + +int __pyx_t_5spacy_8pipeline_17_parser_internals_6_state_StateC::l_edge(int __pyx_v_word) const { + int __pyx_r; + + /* "_state.pxd":259 + * + * inline int l_edge(int word) noexcept nogil const: + * return word # <<<<<<<<<<<<<< + * + * inline int r_edge(int word) noexcept nogil const: +*/ + __pyx_r = __pyx_v_word; + goto __pyx_L0; + + /* "_state.pxd":258 + * return this._heads[child] >= 0 + * + * inline int l_edge(int word) noexcept nogil const: # <<<<<<<<<<<<<< + * return word + * +*/ + + /* function exit code */ + __pyx_L0:; + return __pyx_r; +} + +/* "_state.pxd":261 + * return word + * + * inline int r_edge(int word) noexcept nogil const: # <<<<<<<<<<<<<< + * return word + * +*/ + +int __pyx_t_5spacy_8pipeline_17_parser_internals_6_state_StateC::r_edge(int __pyx_v_word) const { + int __pyx_r; + + /* "_state.pxd":262 + * + * inline int r_edge(int word) noexcept nogil const: + * return word # <<<<<<<<<<<<<< + * + * inline int n_arcs(const unordered_map[int, vector[ArcC]] &heads_arcs, int head) noexcept nogil const: +*/ + __pyx_r = __pyx_v_word; + goto __pyx_L0; + + /* "_state.pxd":261 + * return word + * + * inline int r_edge(int word) noexcept nogil const: # <<<<<<<<<<<<<< + * return word + * +*/ + + /* function exit code */ + __pyx_L0:; + return __pyx_r; +} + +/* "_state.pxd":264 + * return word + * + * inline int n_arcs(const unordered_map[int, vector[ArcC]] &heads_arcs, int head) noexcept nogil const: # <<<<<<<<<<<<<< + * cdef int n = 0 + * head_arcs_it = heads_arcs.const_find(head) +*/ + +int __pyx_t_5spacy_8pipeline_17_parser_internals_6_state_StateC::n_arcs(std::unordered_map > const &__pyx_v_heads_arcs, int __pyx_v_head) const { + int __pyx_v_n; + std::unordered_map > ::const_iterator __pyx_v_head_arcs_it; + std::vector const *__pyx_v_arcs; + std::vector ::const_iterator __pyx_v_arcs_it; + struct __pyx_t_5spacy_8pipeline_17_parser_internals_6_state_ArcC __pyx_v_arc; + int __pyx_r; + int __pyx_t_1; + int __pyx_lineno = 0; + const char *__pyx_filename = NULL; + int __pyx_clineno = 0; + PyGILState_STATE __pyx_gilstate_save; + + /* "_state.pxd":265 + * + * inline int n_arcs(const unordered_map[int, vector[ArcC]] &heads_arcs, int head) noexcept nogil const: + * cdef int n = 0 # <<<<<<<<<<<<<< + * head_arcs_it = heads_arcs.const_find(head) + * if head_arcs_it == heads_arcs.const_end(): +*/ + __pyx_v_n = 0; + + /* "_state.pxd":266 + * inline int n_arcs(const unordered_map[int, vector[ArcC]] &heads_arcs, int head) noexcept nogil const: + * cdef int n = 0 + * head_arcs_it = heads_arcs.const_find(head) # <<<<<<<<<<<<<< + * if head_arcs_it == heads_arcs.const_end(): + * return n +*/ + try { + __pyx_v_head_arcs_it = __pyx_v_heads_arcs.find(__pyx_v_head); + } catch(...) { + PyGILState_STATE __pyx_gilstate_save = __Pyx_PyGILState_Ensure(); + __Pyx_CppExn2PyErr(); + __Pyx_PyGILState_Release(__pyx_gilstate_save); + __PYX_ERR(4, 266, __pyx_L1_error) + } + + /* "_state.pxd":267 + * cdef int n = 0 + * head_arcs_it = heads_arcs.const_find(head) + * if head_arcs_it == heads_arcs.const_end(): # <<<<<<<<<<<<<< + * return n + * +*/ + __pyx_t_1 = (__pyx_v_head_arcs_it == __pyx_v_heads_arcs.end()); + if (__pyx_t_1) { + + /* "_state.pxd":268 + * head_arcs_it = heads_arcs.const_find(head) + * if head_arcs_it == heads_arcs.const_end(): + * return n # <<<<<<<<<<<<<< + * + * cdef const vector[ArcC]* arcs = &deref(head_arcs_it).second +*/ + __pyx_r = __pyx_v_n; + goto __pyx_L0; + + /* "_state.pxd":267 + * cdef int n = 0 + * head_arcs_it = heads_arcs.const_find(head) + * if head_arcs_it == heads_arcs.const_end(): # <<<<<<<<<<<<<< + * return n + * +*/ + } + + /* "_state.pxd":270 + * return n + * + * cdef const vector[ArcC]* arcs = &deref(head_arcs_it).second # <<<<<<<<<<<<<< + * arcs_it = arcs.const_begin() + * while arcs_it != arcs.end(): +*/ + __pyx_v_arcs = (&(*__pyx_v_head_arcs_it).second); + + /* "_state.pxd":271 + * + * cdef const vector[ArcC]* arcs = &deref(head_arcs_it).second + * arcs_it = arcs.const_begin() # <<<<<<<<<<<<<< + * while arcs_it != arcs.end(): + * arc = deref(arcs_it) +*/ + try { + __pyx_v_arcs_it = __pyx_v_arcs->begin(); + } catch(...) { + PyGILState_STATE __pyx_gilstate_save = __Pyx_PyGILState_Ensure(); + __Pyx_CppExn2PyErr(); + __Pyx_PyGILState_Release(__pyx_gilstate_save); + __PYX_ERR(4, 271, __pyx_L1_error) + } + + /* "_state.pxd":272 + * cdef const vector[ArcC]* arcs = &deref(head_arcs_it).second + * arcs_it = arcs.const_begin() + * while arcs_it != arcs.end(): # <<<<<<<<<<<<<< + * arc = deref(arcs_it) + * if arc.child != -1: +*/ + while (1) { + __pyx_t_1 = (__pyx_v_arcs_it != __pyx_v_arcs->end()); + if (!__pyx_t_1) break; + + /* "_state.pxd":273 + * arcs_it = arcs.const_begin() + * while arcs_it != arcs.end(): + * arc = deref(arcs_it) # <<<<<<<<<<<<<< + * if arc.child != -1: + * n += 1 +*/ + __pyx_v_arc = (*__pyx_v_arcs_it); + + /* "_state.pxd":274 + * while arcs_it != arcs.end(): + * arc = deref(arcs_it) + * if arc.child != -1: # <<<<<<<<<<<<<< + * n += 1 + * incr(arcs_it) +*/ + __pyx_t_1 = (__pyx_v_arc.child != -1L); + if (__pyx_t_1) { + + /* "_state.pxd":275 + * arc = deref(arcs_it) + * if arc.child != -1: + * n += 1 # <<<<<<<<<<<<<< + * incr(arcs_it) + * +*/ + __pyx_v_n = (__pyx_v_n + 1); + + /* "_state.pxd":274 + * while arcs_it != arcs.end(): + * arc = deref(arcs_it) + * if arc.child != -1: # <<<<<<<<<<<<<< + * n += 1 + * incr(arcs_it) +*/ + } + + /* "_state.pxd":276 + * if arc.child != -1: + * n += 1 + * incr(arcs_it) # <<<<<<<<<<<<<< + * + * return n +*/ + (void)((++__pyx_v_arcs_it)); + } + + /* "_state.pxd":278 + * incr(arcs_it) + * + * return n # <<<<<<<<<<<<<< + * + * inline int n_L(int head) noexcept nogil const: +*/ + __pyx_r = __pyx_v_n; + goto __pyx_L0; + + /* "_state.pxd":264 + * return word + * + * inline int n_arcs(const unordered_map[int, vector[ArcC]] &heads_arcs, int head) noexcept nogil const: # <<<<<<<<<<<<<< + * cdef int n = 0 + * head_arcs_it = heads_arcs.const_find(head) +*/ + + /* function exit code */ + __pyx_L1_error:; + __pyx_gilstate_save = __Pyx_PyGILState_Ensure(); + __Pyx_WriteUnraisable("StateC.n_arcs", __pyx_clineno, __pyx_lineno, __pyx_filename, 1, 0); + __pyx_r = 0; + __Pyx_PyGILState_Release(__pyx_gilstate_save); + __pyx_L0:; + return __pyx_r; +} + +/* "_state.pxd":280 + * return n + * + * inline int n_L(int head) noexcept nogil const: # <<<<<<<<<<<<<< + * return n_arcs(this._left_arcs, head) + * +*/ + +int __pyx_t_5spacy_8pipeline_17_parser_internals_6_state_StateC::n_L(int __pyx_v_head) const { + int __pyx_r; + + /* "_state.pxd":281 + * + * inline int n_L(int head) noexcept nogil const: + * return n_arcs(this._left_arcs, head) # <<<<<<<<<<<<<< + * + * inline int n_R(int head) noexcept nogil const: +*/ + __pyx_r = n_arcs(this->_left_arcs, __pyx_v_head); + goto __pyx_L0; + + /* "_state.pxd":280 + * return n + * + * inline int n_L(int head) noexcept nogil const: # <<<<<<<<<<<<<< + * return n_arcs(this._left_arcs, head) + * +*/ + + /* function exit code */ + __pyx_L0:; + return __pyx_r; +} + +/* "_state.pxd":283 + * return n_arcs(this._left_arcs, head) + * + * inline int n_R(int head) noexcept nogil const: # <<<<<<<<<<<<<< + * return n_arcs(this._right_arcs, head) + * +*/ + +int __pyx_t_5spacy_8pipeline_17_parser_internals_6_state_StateC::n_R(int __pyx_v_head) const { + int __pyx_r; + + /* "_state.pxd":284 + * + * inline int n_R(int head) noexcept nogil const: + * return n_arcs(this._right_arcs, head) # <<<<<<<<<<<<<< + * + * inline bint stack_is_connected() noexcept nogil const: +*/ + __pyx_r = n_arcs(this->_right_arcs, __pyx_v_head); + goto __pyx_L0; + + /* "_state.pxd":283 + * return n_arcs(this._left_arcs, head) + * + * inline int n_R(int head) noexcept nogil const: # <<<<<<<<<<<<<< + * return n_arcs(this._right_arcs, head) + * +*/ + + /* function exit code */ + __pyx_L0:; + return __pyx_r; +} + +/* "_state.pxd":286 + * return n_arcs(this._right_arcs, head) + * + * inline bint stack_is_connected() noexcept nogil const: # <<<<<<<<<<<<<< + * return False + * +*/ + +int __pyx_t_5spacy_8pipeline_17_parser_internals_6_state_StateC::stack_is_connected(void) const { + int __pyx_r; + + /* "_state.pxd":287 + * + * inline bint stack_is_connected() noexcept nogil const: + * return False # <<<<<<<<<<<<<< + * + * inline bint entity_is_open() noexcept nogil const: +*/ + __pyx_r = 0; + goto __pyx_L0; + + /* "_state.pxd":286 + * return n_arcs(this._right_arcs, head) + * + * inline bint stack_is_connected() noexcept nogil const: # <<<<<<<<<<<<<< + * return False + * +*/ + + /* function exit code */ + __pyx_L0:; + return __pyx_r; +} + +/* "_state.pxd":289 + * return False + * + * inline bint entity_is_open() noexcept nogil const: # <<<<<<<<<<<<<< + * if this._ents.size() == 0: + * return False +*/ + +int __pyx_t_5spacy_8pipeline_17_parser_internals_6_state_StateC::entity_is_open(void) const { + int __pyx_r; + int __pyx_t_1; + + /* "_state.pxd":290 + * + * inline bint entity_is_open() noexcept nogil const: + * if this._ents.size() == 0: # <<<<<<<<<<<<<< + * return False + * else: +*/ + __pyx_t_1 = (this->_ents.size() == 0); + if (__pyx_t_1) { + + /* "_state.pxd":291 + * inline bint entity_is_open() noexcept nogil const: + * if this._ents.size() == 0: + * return False # <<<<<<<<<<<<<< + * else: + * return this._ents.back().end == -1 +*/ + __pyx_r = 0; + goto __pyx_L0; + + /* "_state.pxd":290 + * + * inline bint entity_is_open() noexcept nogil const: + * if this._ents.size() == 0: # <<<<<<<<<<<<<< + * return False + * else: +*/ + } + + /* "_state.pxd":293 + * return False + * else: + * return this._ents.back().end == -1 # <<<<<<<<<<<<<< + * + * inline int stack_depth() noexcept nogil const: +*/ + /*else*/ { + __pyx_r = (this->_ents.back().end == -1L); + goto __pyx_L0; + } + + /* "_state.pxd":289 + * return False + * + * inline bint entity_is_open() noexcept nogil const: # <<<<<<<<<<<<<< + * if this._ents.size() == 0: + * return False +*/ + + /* function exit code */ + __pyx_L0:; + return __pyx_r; +} + +/* "_state.pxd":295 + * return this._ents.back().end == -1 + * + * inline int stack_depth() noexcept nogil const: # <<<<<<<<<<<<<< + * return this._stack.size() + * +*/ + +int __pyx_t_5spacy_8pipeline_17_parser_internals_6_state_StateC::stack_depth(void) const { + int __pyx_r; + + /* "_state.pxd":296 + * + * inline int stack_depth() noexcept nogil const: + * return this._stack.size() # <<<<<<<<<<<<<< + * + * inline int buffer_length() noexcept nogil const: +*/ + __pyx_r = this->_stack.size(); + goto __pyx_L0; + + /* "_state.pxd":295 + * return this._ents.back().end == -1 + * + * inline int stack_depth() noexcept nogil const: # <<<<<<<<<<<<<< + * return this._stack.size() + * +*/ + + /* function exit code */ + __pyx_L0:; + return __pyx_r; +} + +/* "_state.pxd":298 + * return this._stack.size() + * + * inline int buffer_length() noexcept nogil const: # <<<<<<<<<<<<<< + * return (this.length - this._b_i) + this._rebuffer.size() + * +*/ + +int __pyx_t_5spacy_8pipeline_17_parser_internals_6_state_StateC::buffer_length(void) const { + int __pyx_r; + + /* "_state.pxd":299 + * + * inline int buffer_length() noexcept nogil const: + * return (this.length - this._b_i) + this._rebuffer.size() # <<<<<<<<<<<<<< + * + * inline void push() noexcept nogil: +*/ + __pyx_r = ((this->length - this->_b_i) + this->_rebuffer.size()); + goto __pyx_L0; + + /* "_state.pxd":298 + * return this._stack.size() + * + * inline int buffer_length() noexcept nogil const: # <<<<<<<<<<<<<< + * return (this.length - this._b_i) + this._rebuffer.size() + * +*/ + + /* function exit code */ + __pyx_L0:; + return __pyx_r; +} + +/* "_state.pxd":301 + * return (this.length - this._b_i) + this._rebuffer.size() + * + * inline void push() noexcept nogil: # <<<<<<<<<<<<<< + * b0 = this.B(0) + * if this._rebuffer.size(): +*/ + +void __pyx_t_5spacy_8pipeline_17_parser_internals_6_state_StateC::push(void) { + int __pyx_v_b0; + int __pyx_t_1; + int __pyx_t_2; + int __pyx_lineno = 0; + const char *__pyx_filename = NULL; + int __pyx_clineno = 0; + PyGILState_STATE __pyx_gilstate_save; + + /* "_state.pxd":302 + * + * inline void push() noexcept nogil: + * b0 = this.B(0) # <<<<<<<<<<<<<< + * if this._rebuffer.size(): + * b0 = this._rebuffer.back() +*/ + __pyx_v_b0 = this->B(0); + + /* "_state.pxd":303 + * inline void push() noexcept nogil: + * b0 = this.B(0) + * if this._rebuffer.size(): # <<<<<<<<<<<<<< + * b0 = this._rebuffer.back() + * this._rebuffer.pop_back() +*/ + __pyx_t_1 = (this->_rebuffer.size() != 0); + if (__pyx_t_1) { + + /* "_state.pxd":304 + * b0 = this.B(0) + * if this._rebuffer.size(): + * b0 = this._rebuffer.back() # <<<<<<<<<<<<<< + * this._rebuffer.pop_back() + * else: +*/ + __pyx_v_b0 = this->_rebuffer.back(); + + /* "_state.pxd":305 + * if this._rebuffer.size(): + * b0 = this._rebuffer.back() + * this._rebuffer.pop_back() # <<<<<<<<<<<<<< + * else: + * b0 = this._b_i +*/ + this->_rebuffer.pop_back(); + + /* "_state.pxd":303 + * inline void push() noexcept nogil: + * b0 = this.B(0) + * if this._rebuffer.size(): # <<<<<<<<<<<<<< + * b0 = this._rebuffer.back() + * this._rebuffer.pop_back() +*/ + goto __pyx_L3; + } + + /* "_state.pxd":307 + * this._rebuffer.pop_back() + * else: + * b0 = this._b_i # <<<<<<<<<<<<<< + * this._b_i += 1 + * this._stack.push_back(b0) +*/ + /*else*/ { + __pyx_t_2 = this->_b_i; + __pyx_v_b0 = __pyx_t_2; + + /* "_state.pxd":308 + * else: + * b0 = this._b_i + * this._b_i += 1 # <<<<<<<<<<<<<< + * this._stack.push_back(b0) + * +*/ + this->_b_i = (this->_b_i + 1); + } + __pyx_L3:; + + /* "_state.pxd":309 + * b0 = this._b_i + * this._b_i += 1 + * this._stack.push_back(b0) # <<<<<<<<<<<<<< + * + * inline void pop() noexcept nogil: +*/ + try { + this->_stack.push_back(__pyx_v_b0); + } catch(...) { + PyGILState_STATE __pyx_gilstate_save = __Pyx_PyGILState_Ensure(); + __Pyx_CppExn2PyErr(); + __Pyx_PyGILState_Release(__pyx_gilstate_save); + __PYX_ERR(4, 309, __pyx_L1_error) + } + + /* "_state.pxd":301 + * return (this.length - this._b_i) + this._rebuffer.size() + * + * inline void push() noexcept nogil: # <<<<<<<<<<<<<< + * b0 = this.B(0) + * if this._rebuffer.size(): +*/ + + /* function exit code */ + goto __pyx_L0; + __pyx_L1_error:; + __pyx_gilstate_save = __Pyx_PyGILState_Ensure(); + __Pyx_WriteUnraisable("StateC.push", __pyx_clineno, __pyx_lineno, __pyx_filename, 1, 0); + __Pyx_PyGILState_Release(__pyx_gilstate_save); + __pyx_L0:; +} + +/* "_state.pxd":311 + * this._stack.push_back(b0) + * + * inline void pop() noexcept nogil: # <<<<<<<<<<<<<< + * this._stack.pop_back() + * +*/ + +void __pyx_t_5spacy_8pipeline_17_parser_internals_6_state_StateC::pop(void) { + + /* "_state.pxd":312 + * + * inline void pop() noexcept nogil: + * this._stack.pop_back() # <<<<<<<<<<<<<< + * + * inline void force_final() noexcept nogil: +*/ + this->_stack.pop_back(); + + /* "_state.pxd":311 + * this._stack.push_back(b0) + * + * inline void pop() noexcept nogil: # <<<<<<<<<<<<<< + * this._stack.pop_back() + * +*/ + + /* function exit code */ +} + +/* "_state.pxd":314 + * this._stack.pop_back() + * + * inline void force_final() noexcept nogil: # <<<<<<<<<<<<<< + * # This should only be used in desperate situations, as it may leave + * # the analysis in an unexpected state. +*/ + +void __pyx_t_5spacy_8pipeline_17_parser_internals_6_state_StateC::force_final(void) { + int __pyx_t_1; + + /* "_state.pxd":317 + * # This should only be used in desperate situations, as it may leave + * # the analysis in an unexpected state. + * this._stack.clear() # <<<<<<<<<<<<<< + * this._b_i = this.length + * +*/ + this->_stack.clear(); + + /* "_state.pxd":318 + * # the analysis in an unexpected state. + * this._stack.clear() + * this._b_i = this.length # <<<<<<<<<<<<<< + * + * inline void unshift() noexcept nogil: +*/ + __pyx_t_1 = this->length; + this->_b_i = __pyx_t_1; + + /* "_state.pxd":314 + * this._stack.pop_back() + * + * inline void force_final() noexcept nogil: # <<<<<<<<<<<<<< + * # This should only be used in desperate situations, as it may leave + * # the analysis in an unexpected state. +*/ + + /* function exit code */ +} + +/* "_state.pxd":320 + * this._b_i = this.length + * + * inline void unshift() noexcept nogil: # <<<<<<<<<<<<<< + * s0 = this._stack.back() + * this._unshiftable[s0] = 1 +*/ + +void __pyx_t_5spacy_8pipeline_17_parser_internals_6_state_StateC::unshift(void) { + int __pyx_v_s0; + int __pyx_lineno = 0; + const char *__pyx_filename = NULL; + int __pyx_clineno = 0; + PyGILState_STATE __pyx_gilstate_save; + + /* "_state.pxd":321 + * + * inline void unshift() noexcept nogil: + * s0 = this._stack.back() # <<<<<<<<<<<<<< + * this._unshiftable[s0] = 1 + * this._rebuffer.push_back(s0) +*/ + __pyx_v_s0 = this->_stack.back(); + + /* "_state.pxd":322 + * inline void unshift() noexcept nogil: + * s0 = this._stack.back() + * this._unshiftable[s0] = 1 # <<<<<<<<<<<<<< + * this._rebuffer.push_back(s0) + * this._stack.pop_back() +*/ + (this->_unshiftable[__pyx_v_s0]) = 1; + + /* "_state.pxd":323 + * s0 = this._stack.back() + * this._unshiftable[s0] = 1 + * this._rebuffer.push_back(s0) # <<<<<<<<<<<<<< + * this._stack.pop_back() + * +*/ + try { + this->_rebuffer.push_back(__pyx_v_s0); + } catch(...) { + PyGILState_STATE __pyx_gilstate_save = __Pyx_PyGILState_Ensure(); + __Pyx_CppExn2PyErr(); + __Pyx_PyGILState_Release(__pyx_gilstate_save); + __PYX_ERR(4, 323, __pyx_L1_error) + } + + /* "_state.pxd":324 + * this._unshiftable[s0] = 1 + * this._rebuffer.push_back(s0) + * this._stack.pop_back() # <<<<<<<<<<<<<< + * + * inline int is_unshiftable(int item) noexcept nogil const: +*/ + this->_stack.pop_back(); + + /* "_state.pxd":320 + * this._b_i = this.length + * + * inline void unshift() noexcept nogil: # <<<<<<<<<<<<<< + * s0 = this._stack.back() + * this._unshiftable[s0] = 1 +*/ + + /* function exit code */ + goto __pyx_L0; + __pyx_L1_error:; + __pyx_gilstate_save = __Pyx_PyGILState_Ensure(); + __Pyx_WriteUnraisable("StateC.unshift", __pyx_clineno, __pyx_lineno, __pyx_filename, 1, 0); + __Pyx_PyGILState_Release(__pyx_gilstate_save); + __pyx_L0:; +} + +/* "_state.pxd":326 + * this._stack.pop_back() + * + * inline int is_unshiftable(int item) noexcept nogil const: # <<<<<<<<<<<<<< + * if item >= this._unshiftable.size(): + * return 0 +*/ + +int __pyx_t_5spacy_8pipeline_17_parser_internals_6_state_StateC::is_unshiftable(int __pyx_v_item) const { + int __pyx_r; + int __pyx_t_1; + bool __pyx_t_2; + int __pyx_lineno = 0; + const char *__pyx_filename = NULL; + int __pyx_clineno = 0; + PyGILState_STATE __pyx_gilstate_save; + + /* "_state.pxd":327 + * + * inline int is_unshiftable(int item) noexcept nogil const: + * if item >= this._unshiftable.size(): # <<<<<<<<<<<<<< + * return 0 + * else: +*/ + __pyx_t_1 = (__pyx_v_item >= this->_unshiftable.size()); + if (__pyx_t_1) { + + /* "_state.pxd":328 + * inline int is_unshiftable(int item) noexcept nogil const: + * if item >= this._unshiftable.size(): + * return 0 # <<<<<<<<<<<<<< + * else: + * return this._unshiftable.at(item) +*/ + __pyx_r = 0; + goto __pyx_L0; + + /* "_state.pxd":327 + * + * inline int is_unshiftable(int item) noexcept nogil const: + * if item >= this._unshiftable.size(): # <<<<<<<<<<<<<< + * return 0 + * else: +*/ + } + + /* "_state.pxd":330 + * return 0 + * else: + * return this._unshiftable.at(item) # <<<<<<<<<<<<<< + * + * inline void set_reshiftable(int item) noexcept nogil: +*/ + /*else*/ { + try { + __pyx_t_2 = this->_unshiftable.at(__pyx_v_item); + } catch(...) { + PyGILState_STATE __pyx_gilstate_save = __Pyx_PyGILState_Ensure(); + __Pyx_CppExn2PyErr(); + __Pyx_PyGILState_Release(__pyx_gilstate_save); + __PYX_ERR(4, 330, __pyx_L1_error) + } + __pyx_r = __pyx_t_2; + goto __pyx_L0; + } + + /* "_state.pxd":326 + * this._stack.pop_back() + * + * inline int is_unshiftable(int item) noexcept nogil const: # <<<<<<<<<<<<<< + * if item >= this._unshiftable.size(): + * return 0 +*/ + + /* function exit code */ + __pyx_L1_error:; + __pyx_gilstate_save = __Pyx_PyGILState_Ensure(); + __Pyx_WriteUnraisable("StateC.is_unshiftable", __pyx_clineno, __pyx_lineno, __pyx_filename, 1, 0); + __pyx_r = 0; + __Pyx_PyGILState_Release(__pyx_gilstate_save); + __pyx_L0:; + return __pyx_r; +} + +/* "_state.pxd":332 + * return this._unshiftable.at(item) + * + * inline void set_reshiftable(int item) noexcept nogil: # <<<<<<<<<<<<<< + * if item < this._unshiftable.size(): + * this._unshiftable[item] = 0 +*/ + +void __pyx_t_5spacy_8pipeline_17_parser_internals_6_state_StateC::set_reshiftable(int __pyx_v_item) { + int __pyx_t_1; + + /* "_state.pxd":333 + * + * inline void set_reshiftable(int item) noexcept nogil: + * if item < this._unshiftable.size(): # <<<<<<<<<<<<<< + * this._unshiftable[item] = 0 + * +*/ + __pyx_t_1 = (__pyx_v_item < this->_unshiftable.size()); + if (__pyx_t_1) { + + /* "_state.pxd":334 + * inline void set_reshiftable(int item) noexcept nogil: + * if item < this._unshiftable.size(): + * this._unshiftable[item] = 0 # <<<<<<<<<<<<<< + * + * inline void add_arc(int head, int child, attr_t label) noexcept nogil: +*/ + (this->_unshiftable[__pyx_v_item]) = 0; + + /* "_state.pxd":333 + * + * inline void set_reshiftable(int item) noexcept nogil: + * if item < this._unshiftable.size(): # <<<<<<<<<<<<<< + * this._unshiftable[item] = 0 + * +*/ + } + + /* "_state.pxd":332 + * return this._unshiftable.at(item) + * + * inline void set_reshiftable(int item) noexcept nogil: # <<<<<<<<<<<<<< + * if item < this._unshiftable.size(): + * this._unshiftable[item] = 0 +*/ + + /* function exit code */ +} + +/* "_state.pxd":336 + * this._unshiftable[item] = 0 + * + * inline void add_arc(int head, int child, attr_t label) noexcept nogil: # <<<<<<<<<<<<<< + * if this.has_head(child): + * this.del_arc(this.H(child), child) +*/ + +void __pyx_t_5spacy_8pipeline_17_parser_internals_6_state_StateC::add_arc(int __pyx_v_head, int __pyx_v_child, __pyx_t_5spacy_8typedefs_attr_t __pyx_v_label) { + struct __pyx_t_5spacy_8pipeline_17_parser_internals_6_state_ArcC __pyx_v_arc; + int __pyx_t_1; + int __pyx_lineno = 0; + const char *__pyx_filename = NULL; + int __pyx_clineno = 0; + PyGILState_STATE __pyx_gilstate_save; + + /* "_state.pxd":337 + * + * inline void add_arc(int head, int child, attr_t label) noexcept nogil: + * if this.has_head(child): # <<<<<<<<<<<<<< + * this.del_arc(this.H(child), child) + * cdef ArcC arc +*/ + __pyx_t_1 = this->has_head(__pyx_v_child); + if (__pyx_t_1) { + + /* "_state.pxd":338 + * inline void add_arc(int head, int child, attr_t label) noexcept nogil: + * if this.has_head(child): + * this.del_arc(this.H(child), child) # <<<<<<<<<<<<<< + * cdef ArcC arc + * arc.head = head +*/ + this->del_arc(this->H(__pyx_v_child), __pyx_v_child); + + /* "_state.pxd":337 + * + * inline void add_arc(int head, int child, attr_t label) noexcept nogil: + * if this.has_head(child): # <<<<<<<<<<<<<< + * this.del_arc(this.H(child), child) + * cdef ArcC arc +*/ + } + + /* "_state.pxd":340 + * this.del_arc(this.H(child), child) + * cdef ArcC arc + * arc.head = head # <<<<<<<<<<<<<< + * arc.child = child + * arc.label = label +*/ + __pyx_v_arc.head = __pyx_v_head; + + /* "_state.pxd":341 + * cdef ArcC arc + * arc.head = head + * arc.child = child # <<<<<<<<<<<<<< + * arc.label = label + * if head > child: +*/ + __pyx_v_arc.child = __pyx_v_child; + + /* "_state.pxd":342 + * arc.head = head + * arc.child = child + * arc.label = label # <<<<<<<<<<<<<< + * if head > child: + * this._left_arcs[arc.head].push_back(arc) +*/ + __pyx_v_arc.label = __pyx_v_label; + + /* "_state.pxd":343 + * arc.child = child + * arc.label = label + * if head > child: # <<<<<<<<<<<<<< + * this._left_arcs[arc.head].push_back(arc) + * else: +*/ + __pyx_t_1 = (__pyx_v_head > __pyx_v_child); + if (__pyx_t_1) { + + /* "_state.pxd":344 + * arc.label = label + * if head > child: + * this._left_arcs[arc.head].push_back(arc) # <<<<<<<<<<<<<< + * else: + * this._right_arcs[arc.head].push_back(arc) +*/ + try { + (this->_left_arcs[__pyx_v_arc.head]).push_back(__pyx_v_arc); + } catch(...) { + PyGILState_STATE __pyx_gilstate_save = __Pyx_PyGILState_Ensure(); + __Pyx_CppExn2PyErr(); + __Pyx_PyGILState_Release(__pyx_gilstate_save); + __PYX_ERR(4, 344, __pyx_L1_error) + } + + /* "_state.pxd":343 + * arc.child = child + * arc.label = label + * if head > child: # <<<<<<<<<<<<<< + * this._left_arcs[arc.head].push_back(arc) + * else: +*/ + goto __pyx_L4; + } + + /* "_state.pxd":346 + * this._left_arcs[arc.head].push_back(arc) + * else: + * this._right_arcs[arc.head].push_back(arc) # <<<<<<<<<<<<<< + * this._heads[child] = head + * +*/ + /*else*/ { + try { + (this->_right_arcs[__pyx_v_arc.head]).push_back(__pyx_v_arc); + } catch(...) { + PyGILState_STATE __pyx_gilstate_save = __Pyx_PyGILState_Ensure(); + __Pyx_CppExn2PyErr(); + __Pyx_PyGILState_Release(__pyx_gilstate_save); + __PYX_ERR(4, 346, __pyx_L1_error) + } + } + __pyx_L4:; + + /* "_state.pxd":347 + * else: + * this._right_arcs[arc.head].push_back(arc) + * this._heads[child] = head # <<<<<<<<<<<<<< + * + * inline void map_del_arc(unordered_map[int, vector[ArcC]]* heads_arcs, int h_i, int c_i) noexcept nogil: +*/ + (this->_heads[__pyx_v_child]) = __pyx_v_head; + + /* "_state.pxd":336 + * this._unshiftable[item] = 0 + * + * inline void add_arc(int head, int child, attr_t label) noexcept nogil: # <<<<<<<<<<<<<< + * if this.has_head(child): + * this.del_arc(this.H(child), child) +*/ + + /* function exit code */ + goto __pyx_L0; + __pyx_L1_error:; + __pyx_gilstate_save = __Pyx_PyGILState_Ensure(); + __Pyx_WriteUnraisable("StateC.add_arc", __pyx_clineno, __pyx_lineno, __pyx_filename, 1, 0); + __Pyx_PyGILState_Release(__pyx_gilstate_save); + __pyx_L0:; +} + +/* "_state.pxd":349 + * this._heads[child] = head + * + * inline void map_del_arc(unordered_map[int, vector[ArcC]]* heads_arcs, int h_i, int c_i) noexcept nogil: # <<<<<<<<<<<<<< + * arcs_it = heads_arcs.find(h_i) + * if arcs_it == heads_arcs.end(): +*/ + +void __pyx_t_5spacy_8pipeline_17_parser_internals_6_state_StateC::map_del_arc(std::unordered_map > *__pyx_v_heads_arcs, int __pyx_v_h_i, int __pyx_v_c_i) { + std::unordered_map > ::iterator __pyx_v_arcs_it; + std::vector *__pyx_v_arcs; + struct __pyx_t_5spacy_8pipeline_17_parser_internals_6_state_ArcC __pyx_v_arc; + std::vector ::size_type __pyx_v_i; + int __pyx_t_1; + int __pyx_t_2; + std::vector ::size_type __pyx_t_3; + std::vector ::size_type __pyx_t_4; + std::vector ::size_type __pyx_t_5; + __Pyx_FakeReference __pyx_t_6; + int __pyx_lineno = 0; + const char *__pyx_filename = NULL; + int __pyx_clineno = 0; + PyGILState_STATE __pyx_gilstate_save; + + /* "_state.pxd":350 + * + * inline void map_del_arc(unordered_map[int, vector[ArcC]]* heads_arcs, int h_i, int c_i) noexcept nogil: + * arcs_it = heads_arcs.find(h_i) # <<<<<<<<<<<<<< + * if arcs_it == heads_arcs.end(): + * return +*/ + __pyx_v_arcs_it = __pyx_v_heads_arcs->find(__pyx_v_h_i); + + /* "_state.pxd":351 + * inline void map_del_arc(unordered_map[int, vector[ArcC]]* heads_arcs, int h_i, int c_i) noexcept nogil: + * arcs_it = heads_arcs.find(h_i) + * if arcs_it == heads_arcs.end(): # <<<<<<<<<<<<<< + * return + * +*/ + __pyx_t_1 = (__pyx_v_arcs_it == __pyx_v_heads_arcs->end()); + if (__pyx_t_1) { + + /* "_state.pxd":352 + * arcs_it = heads_arcs.find(h_i) + * if arcs_it == heads_arcs.end(): + * return # <<<<<<<<<<<<<< + * + * arcs = &deref(arcs_it).second +*/ + goto __pyx_L0; + + /* "_state.pxd":351 + * inline void map_del_arc(unordered_map[int, vector[ArcC]]* heads_arcs, int h_i, int c_i) noexcept nogil: + * arcs_it = heads_arcs.find(h_i) + * if arcs_it == heads_arcs.end(): # <<<<<<<<<<<<<< + * return + * +*/ + } + + /* "_state.pxd":354 + * return + * + * arcs = &deref(arcs_it).second # <<<<<<<<<<<<<< + * if arcs.size() == 0: + * return +*/ + __pyx_v_arcs = (&(*__pyx_v_arcs_it).second); + + /* "_state.pxd":355 + * + * arcs = &deref(arcs_it).second + * if arcs.size() == 0: # <<<<<<<<<<<<<< + * return + * +*/ + __pyx_t_1 = (__pyx_v_arcs->size() == 0); + if (__pyx_t_1) { + + /* "_state.pxd":356 + * arcs = &deref(arcs_it).second + * if arcs.size() == 0: + * return # <<<<<<<<<<<<<< + * + * arc = arcs.back() +*/ + goto __pyx_L0; + + /* "_state.pxd":355 + * + * arcs = &deref(arcs_it).second + * if arcs.size() == 0: # <<<<<<<<<<<<<< + * return + * +*/ + } + + /* "_state.pxd":358 + * return + * + * arc = arcs.back() # <<<<<<<<<<<<<< + * if arc.head == h_i and arc.child == c_i: + * arcs.pop_back() +*/ + __pyx_v_arc = __pyx_v_arcs->back(); + + /* "_state.pxd":359 + * + * arc = arcs.back() + * if arc.head == h_i and arc.child == c_i: # <<<<<<<<<<<<<< + * arcs.pop_back() + * else: +*/ + __pyx_t_2 = (__pyx_v_arc.head == __pyx_v_h_i); + if (__pyx_t_2) { + } else { + __pyx_t_1 = __pyx_t_2; + goto __pyx_L6_bool_binop_done; + } + __pyx_t_2 = (__pyx_v_arc.child == __pyx_v_c_i); + __pyx_t_1 = __pyx_t_2; + __pyx_L6_bool_binop_done:; + if (__pyx_t_1) { + + /* "_state.pxd":360 + * arc = arcs.back() + * if arc.head == h_i and arc.child == c_i: + * arcs.pop_back() # <<<<<<<<<<<<<< + * else: + * for i in range(arcs.size()-1): +*/ + __pyx_v_arcs->pop_back(); + + /* "_state.pxd":359 + * + * arc = arcs.back() + * if arc.head == h_i and arc.child == c_i: # <<<<<<<<<<<<<< + * arcs.pop_back() + * else: +*/ + goto __pyx_L5; + } + + /* "_state.pxd":362 + * arcs.pop_back() + * else: + * for i in range(arcs.size()-1): # <<<<<<<<<<<<<< + * arc = arcs.at(i) + * if arc.head == h_i and arc.child == c_i: +*/ + /*else*/ { + __pyx_t_3 = (__pyx_v_arcs->size() - 1); + __pyx_t_4 = __pyx_t_3; + for (__pyx_t_5 = 0; __pyx_t_5 < __pyx_t_4; __pyx_t_5+=1) { + __pyx_v_i = __pyx_t_5; + + /* "_state.pxd":363 + * else: + * for i in range(arcs.size()-1): + * arc = arcs.at(i) # <<<<<<<<<<<<<< + * if arc.head == h_i and arc.child == c_i: + * arc.head = -1 +*/ + try { + __pyx_t_6 = __pyx_v_arcs->at(__pyx_v_i); + } catch(...) { + PyGILState_STATE __pyx_gilstate_save = __Pyx_PyGILState_Ensure(); + __Pyx_CppExn2PyErr(); + __Pyx_PyGILState_Release(__pyx_gilstate_save); + __PYX_ERR(4, 363, __pyx_L1_error) + } + __pyx_v_arc = __pyx_t_6; + + /* "_state.pxd":364 + * for i in range(arcs.size()-1): + * arc = arcs.at(i) + * if arc.head == h_i and arc.child == c_i: # <<<<<<<<<<<<<< + * arc.head = -1 + * arc.child = -1 +*/ + __pyx_t_2 = (__pyx_v_arc.head == __pyx_v_h_i); + if (__pyx_t_2) { + } else { + __pyx_t_1 = __pyx_t_2; + goto __pyx_L11_bool_binop_done; + } + __pyx_t_2 = (__pyx_v_arc.child == __pyx_v_c_i); + __pyx_t_1 = __pyx_t_2; + __pyx_L11_bool_binop_done:; + if (__pyx_t_1) { + + /* "_state.pxd":365 + * arc = arcs.at(i) + * if arc.head == h_i and arc.child == c_i: + * arc.head = -1 # <<<<<<<<<<<<<< + * arc.child = -1 + * arc.label = 0 +*/ + __pyx_v_arc.head = -1; + + /* "_state.pxd":366 + * if arc.head == h_i and arc.child == c_i: + * arc.head = -1 + * arc.child = -1 # <<<<<<<<<<<<<< + * arc.label = 0 + * break +*/ + __pyx_v_arc.child = -1; + + /* "_state.pxd":367 + * arc.head = -1 + * arc.child = -1 + * arc.label = 0 # <<<<<<<<<<<<<< + * break + * +*/ + __pyx_v_arc.label = 0; + + /* "_state.pxd":368 + * arc.child = -1 + * arc.label = 0 + * break # <<<<<<<<<<<<<< + * + * inline void del_arc(int h_i, int c_i) noexcept nogil: +*/ + goto __pyx_L9_break; + + /* "_state.pxd":364 + * for i in range(arcs.size()-1): + * arc = arcs.at(i) + * if arc.head == h_i and arc.child == c_i: # <<<<<<<<<<<<<< + * arc.head = -1 + * arc.child = -1 +*/ + } + } + __pyx_L9_break:; + } + __pyx_L5:; + + /* "_state.pxd":349 + * this._heads[child] = head + * + * inline void map_del_arc(unordered_map[int, vector[ArcC]]* heads_arcs, int h_i, int c_i) noexcept nogil: # <<<<<<<<<<<<<< + * arcs_it = heads_arcs.find(h_i) + * if arcs_it == heads_arcs.end(): +*/ + + /* function exit code */ + goto __pyx_L0; + __pyx_L1_error:; + __pyx_gilstate_save = __Pyx_PyGILState_Ensure(); + __Pyx_WriteUnraisable("StateC.map_del_arc", __pyx_clineno, __pyx_lineno, __pyx_filename, 1, 0); + __Pyx_PyGILState_Release(__pyx_gilstate_save); + __pyx_L0:; +} + +/* "_state.pxd":370 + * break + * + * inline void del_arc(int h_i, int c_i) noexcept nogil: # <<<<<<<<<<<<<< + * if h_i > c_i: + * this.map_del_arc(&this._left_arcs, h_i, c_i) +*/ + +void __pyx_t_5spacy_8pipeline_17_parser_internals_6_state_StateC::del_arc(int __pyx_v_h_i, int __pyx_v_c_i) { + int __pyx_t_1; + + /* "_state.pxd":371 + * + * inline void del_arc(int h_i, int c_i) noexcept nogil: + * if h_i > c_i: # <<<<<<<<<<<<<< + * this.map_del_arc(&this._left_arcs, h_i, c_i) + * else: +*/ + __pyx_t_1 = (__pyx_v_h_i > __pyx_v_c_i); + if (__pyx_t_1) { + + /* "_state.pxd":372 + * inline void del_arc(int h_i, int c_i) noexcept nogil: + * if h_i > c_i: + * this.map_del_arc(&this._left_arcs, h_i, c_i) # <<<<<<<<<<<<<< + * else: + * this.map_del_arc(&this._right_arcs, h_i, c_i) +*/ + this->map_del_arc((&this->_left_arcs), __pyx_v_h_i, __pyx_v_c_i); + + /* "_state.pxd":371 + * + * inline void del_arc(int h_i, int c_i) noexcept nogil: + * if h_i > c_i: # <<<<<<<<<<<<<< + * this.map_del_arc(&this._left_arcs, h_i, c_i) + * else: +*/ + goto __pyx_L3; + } + + /* "_state.pxd":374 + * this.map_del_arc(&this._left_arcs, h_i, c_i) + * else: + * this.map_del_arc(&this._right_arcs, h_i, c_i) # <<<<<<<<<<<<<< + * + * inline SpanC get_ent() noexcept nogil const: +*/ + /*else*/ { + this->map_del_arc((&this->_right_arcs), __pyx_v_h_i, __pyx_v_c_i); + } + __pyx_L3:; + + /* "_state.pxd":370 + * break + * + * inline void del_arc(int h_i, int c_i) noexcept nogil: # <<<<<<<<<<<<<< + * if h_i > c_i: + * this.map_del_arc(&this._left_arcs, h_i, c_i) +*/ + + /* function exit code */ +} + +/* "_state.pxd":376 + * this.map_del_arc(&this._right_arcs, h_i, c_i) + * + * inline SpanC get_ent() noexcept nogil const: # <<<<<<<<<<<<<< + * cdef SpanC ent + * if this._ents.size() == 0: +*/ + +struct __pyx_t_5spacy_7structs_SpanC __pyx_t_5spacy_8pipeline_17_parser_internals_6_state_StateC::get_ent(void) const { + struct __pyx_t_5spacy_7structs_SpanC __pyx_v_ent; + struct __pyx_t_5spacy_7structs_SpanC __pyx_r; + int __pyx_t_1; + + /* "_state.pxd":378 + * inline SpanC get_ent() noexcept nogil const: + * cdef SpanC ent + * if this._ents.size() == 0: # <<<<<<<<<<<<<< + * ent.start = 0 + * ent.end = 0 +*/ + __pyx_t_1 = (this->_ents.size() == 0); + if (__pyx_t_1) { + + /* "_state.pxd":379 + * cdef SpanC ent + * if this._ents.size() == 0: + * ent.start = 0 # <<<<<<<<<<<<<< + * ent.end = 0 + * ent.label = 0 +*/ + __pyx_v_ent.start = 0; + + /* "_state.pxd":380 + * if this._ents.size() == 0: + * ent.start = 0 + * ent.end = 0 # <<<<<<<<<<<<<< + * ent.label = 0 + * return ent +*/ + __pyx_v_ent.end = 0; + + /* "_state.pxd":381 + * ent.start = 0 + * ent.end = 0 + * ent.label = 0 # <<<<<<<<<<<<<< + * return ent + * else: +*/ + __pyx_v_ent.label = 0; + + /* "_state.pxd":382 + * ent.end = 0 + * ent.label = 0 + * return ent # <<<<<<<<<<<<<< + * else: + * return this._ents.back() +*/ + __pyx_r = __pyx_v_ent; + goto __pyx_L0; + + /* "_state.pxd":378 + * inline SpanC get_ent() noexcept nogil const: + * cdef SpanC ent + * if this._ents.size() == 0: # <<<<<<<<<<<<<< + * ent.start = 0 + * ent.end = 0 +*/ + } + + /* "_state.pxd":384 + * return ent + * else: + * return this._ents.back() # <<<<<<<<<<<<<< + * + * inline void open_ent(attr_t label) noexcept nogil: +*/ + /*else*/ { + __pyx_r = this->_ents.back(); + goto __pyx_L0; + } + + /* "_state.pxd":376 + * this.map_del_arc(&this._right_arcs, h_i, c_i) + * + * inline SpanC get_ent() noexcept nogil const: # <<<<<<<<<<<<<< + * cdef SpanC ent + * if this._ents.size() == 0: +*/ + + /* function exit code */ + __pyx_L0:; + return __pyx_r; +} + +/* "_state.pxd":386 + * return this._ents.back() + * + * inline void open_ent(attr_t label) noexcept nogil: # <<<<<<<<<<<<<< + * cdef SpanC ent + * ent.start = this.B(0) +*/ + +void __pyx_t_5spacy_8pipeline_17_parser_internals_6_state_StateC::open_ent(__pyx_t_5spacy_8typedefs_attr_t __pyx_v_label) { + struct __pyx_t_5spacy_7structs_SpanC __pyx_v_ent; + int __pyx_lineno = 0; + const char *__pyx_filename = NULL; + int __pyx_clineno = 0; + PyGILState_STATE __pyx_gilstate_save; + + /* "_state.pxd":388 + * inline void open_ent(attr_t label) noexcept nogil: + * cdef SpanC ent + * ent.start = this.B(0) # <<<<<<<<<<<<<< + * ent.label = label + * ent.end = -1 +*/ + __pyx_v_ent.start = this->B(0); + + /* "_state.pxd":389 + * cdef SpanC ent + * ent.start = this.B(0) + * ent.label = label # <<<<<<<<<<<<<< + * ent.end = -1 + * this._ents.push_back(ent) +*/ + __pyx_v_ent.label = __pyx_v_label; + + /* "_state.pxd":390 + * ent.start = this.B(0) + * ent.label = label + * ent.end = -1 # <<<<<<<<<<<<<< + * this._ents.push_back(ent) + * +*/ + __pyx_v_ent.end = -1; + + /* "_state.pxd":391 + * ent.label = label + * ent.end = -1 + * this._ents.push_back(ent) # <<<<<<<<<<<<<< + * + * inline void close_ent() noexcept nogil: +*/ + try { + this->_ents.push_back(__pyx_v_ent); + } catch(...) { + PyGILState_STATE __pyx_gilstate_save = __Pyx_PyGILState_Ensure(); + __Pyx_CppExn2PyErr(); + __Pyx_PyGILState_Release(__pyx_gilstate_save); + __PYX_ERR(4, 391, __pyx_L1_error) + } + + /* "_state.pxd":386 + * return this._ents.back() + * + * inline void open_ent(attr_t label) noexcept nogil: # <<<<<<<<<<<<<< + * cdef SpanC ent + * ent.start = this.B(0) +*/ + + /* function exit code */ + goto __pyx_L0; + __pyx_L1_error:; + __pyx_gilstate_save = __Pyx_PyGILState_Ensure(); + __Pyx_WriteUnraisable("StateC.open_ent", __pyx_clineno, __pyx_lineno, __pyx_filename, 1, 0); + __Pyx_PyGILState_Release(__pyx_gilstate_save); + __pyx_L0:; +} + +/* "_state.pxd":393 + * this._ents.push_back(ent) + * + * inline void close_ent() noexcept nogil: # <<<<<<<<<<<<<< + * this._ents.back().end = this.B(0)+1 + * +*/ + +void __pyx_t_5spacy_8pipeline_17_parser_internals_6_state_StateC::close_ent(void) { + + /* "_state.pxd":394 + * + * inline void close_ent() noexcept nogil: + * this._ents.back().end = this.B(0)+1 # <<<<<<<<<<<<<< + * + * inline void clone(const StateC* src) noexcept nogil: +*/ + this->_ents.back().end = (this->B(0) + 1); + + /* "_state.pxd":393 + * this._ents.push_back(ent) + * + * inline void close_ent() noexcept nogil: # <<<<<<<<<<<<<< + * this._ents.back().end = this.B(0)+1 + * +*/ + + /* function exit code */ +} + +/* "_state.pxd":396 + * this._ents.back().end = this.B(0)+1 + * + * inline void clone(const StateC* src) noexcept nogil: # <<<<<<<<<<<<<< + * this.length = src.length + * this._sent = src._sent +*/ + +void __pyx_t_5spacy_8pipeline_17_parser_internals_6_state_StateC::clone(__pyx_t_5spacy_8pipeline_17_parser_internals_6_state_StateC const *__pyx_v_src) { + int __pyx_t_1; + struct __pyx_t_5spacy_7structs_TokenC const *__pyx_t_2; + std::vector __pyx_t_3; + std::set __pyx_t_4; + std::vector __pyx_t_5; + std::vector __pyx_t_6; + std::unordered_map > __pyx_t_7; + struct __pyx_t_5spacy_7structs_TokenC __pyx_t_8; + + /* "_state.pxd":397 + * + * inline void clone(const StateC* src) noexcept nogil: + * this.length = src.length # <<<<<<<<<<<<<< + * this._sent = src._sent + * this._stack = src._stack +*/ + __pyx_t_1 = __pyx_v_src->length; + this->length = __pyx_t_1; + + /* "_state.pxd":398 + * inline void clone(const StateC* src) noexcept nogil: + * this.length = src.length + * this._sent = src._sent # <<<<<<<<<<<<<< + * this._stack = src._stack + * this._rebuffer = src._rebuffer +*/ + __pyx_t_2 = __pyx_v_src->_sent; + this->_sent = __pyx_t_2; + + /* "_state.pxd":399 + * this.length = src.length + * this._sent = src._sent + * this._stack = src._stack # <<<<<<<<<<<<<< + * this._rebuffer = src._rebuffer + * this._sent_starts = src._sent_starts +*/ + __pyx_t_3 = __pyx_v_src->_stack; + this->_stack = __PYX_STD_MOVE_IF_SUPPORTED(__pyx_t_3); + + /* "_state.pxd":400 + * this._sent = src._sent + * this._stack = src._stack + * this._rebuffer = src._rebuffer # <<<<<<<<<<<<<< + * this._sent_starts = src._sent_starts + * this._unshiftable = src._unshiftable +*/ + __pyx_t_3 = __pyx_v_src->_rebuffer; + this->_rebuffer = __PYX_STD_MOVE_IF_SUPPORTED(__pyx_t_3); + + /* "_state.pxd":401 + * this._stack = src._stack + * this._rebuffer = src._rebuffer + * this._sent_starts = src._sent_starts # <<<<<<<<<<<<<< + * this._unshiftable = src._unshiftable + * memcpy(this._heads, src._heads, this.length * sizeof(this._heads[0])) +*/ + __pyx_t_4 = __pyx_v_src->_sent_starts; + this->_sent_starts = __PYX_STD_MOVE_IF_SUPPORTED(__pyx_t_4); + + /* "_state.pxd":402 + * this._rebuffer = src._rebuffer + * this._sent_starts = src._sent_starts + * this._unshiftable = src._unshiftable # <<<<<<<<<<<<<< + * memcpy(this._heads, src._heads, this.length * sizeof(this._heads[0])) + * this._ents = src._ents +*/ + __pyx_t_5 = __pyx_v_src->_unshiftable; + this->_unshiftable = __PYX_STD_MOVE_IF_SUPPORTED(__pyx_t_5); + + /* "_state.pxd":403 + * this._sent_starts = src._sent_starts + * this._unshiftable = src._unshiftable + * memcpy(this._heads, src._heads, this.length * sizeof(this._heads[0])) # <<<<<<<<<<<<<< + * this._ents = src._ents + * this._left_arcs = src._left_arcs +*/ + (void)(memcpy(this->_heads, __pyx_v_src->_heads, (this->length * (sizeof((this->_heads[0])))))); + + /* "_state.pxd":404 + * this._unshiftable = src._unshiftable + * memcpy(this._heads, src._heads, this.length * sizeof(this._heads[0])) + * this._ents = src._ents # <<<<<<<<<<<<<< + * this._left_arcs = src._left_arcs + * this._right_arcs = src._right_arcs +*/ + __pyx_t_6 = __pyx_v_src->_ents; + this->_ents = __PYX_STD_MOVE_IF_SUPPORTED(__pyx_t_6); + + /* "_state.pxd":405 + * memcpy(this._heads, src._heads, this.length * sizeof(this._heads[0])) + * this._ents = src._ents + * this._left_arcs = src._left_arcs # <<<<<<<<<<<<<< + * this._right_arcs = src._right_arcs + * this._b_i = src._b_i +*/ + __pyx_t_7 = __pyx_v_src->_left_arcs; + this->_left_arcs = __PYX_STD_MOVE_IF_SUPPORTED(__pyx_t_7); + + /* "_state.pxd":406 + * this._ents = src._ents + * this._left_arcs = src._left_arcs + * this._right_arcs = src._right_arcs # <<<<<<<<<<<<<< + * this._b_i = src._b_i + * this.offset = src.offset +*/ + __pyx_t_7 = __pyx_v_src->_right_arcs; + this->_right_arcs = __PYX_STD_MOVE_IF_SUPPORTED(__pyx_t_7); + + /* "_state.pxd":407 + * this._left_arcs = src._left_arcs + * this._right_arcs = src._right_arcs + * this._b_i = src._b_i # <<<<<<<<<<<<<< + * this.offset = src.offset + * this._empty_token = src._empty_token +*/ + __pyx_t_1 = __pyx_v_src->_b_i; + this->_b_i = __pyx_t_1; + + /* "_state.pxd":408 + * this._right_arcs = src._right_arcs + * this._b_i = src._b_i + * this.offset = src.offset # <<<<<<<<<<<<<< + * this._empty_token = src._empty_token +*/ + __pyx_t_1 = __pyx_v_src->offset; + this->offset = __pyx_t_1; + + /* "_state.pxd":409 + * this._b_i = src._b_i + * this.offset = src.offset + * this._empty_token = src._empty_token # <<<<<<<<<<<<<< +*/ + __pyx_t_8 = __pyx_v_src->_empty_token; + this->_empty_token = __pyx_t_8; + + /* "_state.pxd":396 + * this._ents.back().end = this.B(0)+1 + * + * inline void clone(const StateC* src) noexcept nogil: # <<<<<<<<<<<<<< + * this.length = src.length + * this._sent = src._sent +*/ + + /* function exit code */ +} + +/* "stateclass.pxd":14 + * cdef int _borrowed + * + * @staticmethod # <<<<<<<<<<<<<< + * cdef inline StateClass borrow(StateC* ptr, Doc doc): + * cdef StateClass self = StateClass() +*/ + +static CYTHON_INLINE struct __pyx_obj_5spacy_8pipeline_17_parser_internals_10stateclass_StateClass *__pyx_f_5spacy_8pipeline_17_parser_internals_10stateclass_10StateClass_borrow(__pyx_t_5spacy_8pipeline_17_parser_internals_6_state_StateC *__pyx_v_ptr, struct __pyx_obj_5spacy_6tokens_3doc_Doc *__pyx_v_doc) { + struct __pyx_obj_5spacy_8pipeline_17_parser_internals_10stateclass_StateClass *__pyx_v_self = 0; + struct __pyx_obj_5spacy_8pipeline_17_parser_internals_10stateclass_StateClass *__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("borrow", 0); + + /* "stateclass.pxd":16 + * @staticmethod + * cdef inline StateClass borrow(StateC* ptr, Doc doc): + * cdef StateClass self = StateClass() # <<<<<<<<<<<<<< + * self.c = ptr + * self._borrowed = 1 +*/ + __pyx_t_2 = NULL; + __pyx_t_3 = 1; + { + PyObject *__pyx_callargs[2] = {__pyx_t_2, NULL}; + __pyx_t_1 = __Pyx_PyObject_FastCall((PyObject*)__pyx_mstate_global->__pyx_ptype_5spacy_8pipeline_17_parser_internals_10stateclass_StateClass, __pyx_callargs+__pyx_t_3, (1-__pyx_t_3) | (__pyx_t_3*__Pyx_PY_VECTORCALL_ARGUMENTS_OFFSET)); + __Pyx_XDECREF(__pyx_t_2); __pyx_t_2 = 0; + if (unlikely(!__pyx_t_1)) __PYX_ERR(5, 16, __pyx_L1_error) + __Pyx_GOTREF((PyObject *)__pyx_t_1); + } + __pyx_v_self = ((struct __pyx_obj_5spacy_8pipeline_17_parser_internals_10stateclass_StateClass *)__pyx_t_1); + __pyx_t_1 = 0; + + /* "stateclass.pxd":17 + * cdef inline StateClass borrow(StateC* ptr, Doc doc): + * cdef StateClass self = StateClass() + * self.c = ptr # <<<<<<<<<<<<<< + * self._borrowed = 1 + * self.doc = doc +*/ + __pyx_v_self->c = __pyx_v_ptr; + + /* "stateclass.pxd":18 + * cdef StateClass self = StateClass() + * self.c = ptr + * self._borrowed = 1 # <<<<<<<<<<<<<< + * self.doc = doc + * return self +*/ + __pyx_v_self->_borrowed = 1; + + /* "stateclass.pxd":19 + * self.c = ptr + * self._borrowed = 1 + * self.doc = doc # <<<<<<<<<<<<<< + * return self + * +*/ + __Pyx_INCREF((PyObject *)__pyx_v_doc); + __Pyx_GIVEREF((PyObject *)__pyx_v_doc); + __Pyx_GOTREF((PyObject *)__pyx_v_self->doc); + __Pyx_DECREF((PyObject *)__pyx_v_self->doc); + __pyx_v_self->doc = __pyx_v_doc; + + /* "stateclass.pxd":20 + * self._borrowed = 1 + * self.doc = doc + * return self # <<<<<<<<<<<<<< + * + * @staticmethod +*/ + __Pyx_XDECREF((PyObject *)__pyx_r); + __Pyx_INCREF((PyObject *)__pyx_v_self); + __pyx_r = __pyx_v_self; + goto __pyx_L0; + + /* "stateclass.pxd":14 + * cdef int _borrowed + * + * @staticmethod # <<<<<<<<<<<<<< + * cdef inline StateClass borrow(StateC* ptr, Doc doc): + * cdef StateClass self = StateClass() +*/ + + /* function exit code */ + __pyx_L1_error:; + __Pyx_XDECREF(__pyx_t_1); + __Pyx_XDECREF(__pyx_t_2); + __Pyx_AddTraceback("spacy.pipeline._parser_internals.stateclass.StateClass.borrow", __pyx_clineno, __pyx_lineno, __pyx_filename); + __pyx_r = 0; + __pyx_L0:; + __Pyx_XDECREF((PyObject *)__pyx_v_self); + __Pyx_XGIVEREF((PyObject *)__pyx_r); + __Pyx_RefNannyFinishContext(); + return __pyx_r; +} + +/* "stateclass.pxd":22 + * return self + * + * @staticmethod # <<<<<<<<<<<<<< + * cdef inline StateClass init_offset(const TokenC* sent, int length, int + * offset): +*/ + +static CYTHON_INLINE struct __pyx_obj_5spacy_8pipeline_17_parser_internals_10stateclass_StateClass *__pyx_f_5spacy_8pipeline_17_parser_internals_10stateclass_10StateClass_init_offset(struct __pyx_t_5spacy_7structs_TokenC const *__pyx_v_sent, int __pyx_v_length, int __pyx_v_offset) { + struct __pyx_obj_5spacy_8pipeline_17_parser_internals_10stateclass_StateClass *__pyx_v_self = 0; + struct __pyx_obj_5spacy_8pipeline_17_parser_internals_10stateclass_StateClass *__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("init_offset", 0); + + /* "stateclass.pxd":25 + * cdef inline StateClass init_offset(const TokenC* sent, int length, int + * offset): + * cdef StateClass self = StateClass() # <<<<<<<<<<<<<< + * self.c = new StateC(sent, length) + * self.c.offset = offset +*/ + __pyx_t_2 = NULL; + __pyx_t_3 = 1; + { + PyObject *__pyx_callargs[2] = {__pyx_t_2, NULL}; + __pyx_t_1 = __Pyx_PyObject_FastCall((PyObject*)__pyx_mstate_global->__pyx_ptype_5spacy_8pipeline_17_parser_internals_10stateclass_StateClass, __pyx_callargs+__pyx_t_3, (1-__pyx_t_3) | (__pyx_t_3*__Pyx_PY_VECTORCALL_ARGUMENTS_OFFSET)); + __Pyx_XDECREF(__pyx_t_2); __pyx_t_2 = 0; + if (unlikely(!__pyx_t_1)) __PYX_ERR(5, 25, __pyx_L1_error) + __Pyx_GOTREF((PyObject *)__pyx_t_1); + } + __pyx_v_self = ((struct __pyx_obj_5spacy_8pipeline_17_parser_internals_10stateclass_StateClass *)__pyx_t_1); + __pyx_t_1 = 0; + + /* "stateclass.pxd":26 + * offset): + * cdef StateClass self = StateClass() + * self.c = new StateC(sent, length) # <<<<<<<<<<<<<< + * self.c.offset = offset + * return self +*/ + __pyx_v_self->c = new __pyx_t_5spacy_8pipeline_17_parser_internals_6_state_StateC(__pyx_v_sent, __pyx_v_length); + + /* "stateclass.pxd":27 + * cdef StateClass self = StateClass() + * self.c = new StateC(sent, length) + * self.c.offset = offset # <<<<<<<<<<<<<< + * return self +*/ + __pyx_v_self->c->offset = __pyx_v_offset; + + /* "stateclass.pxd":28 + * self.c = new StateC(sent, length) + * self.c.offset = offset + * return self # <<<<<<<<<<<<<< +*/ + __Pyx_XDECREF((PyObject *)__pyx_r); + __Pyx_INCREF((PyObject *)__pyx_v_self); + __pyx_r = __pyx_v_self; + goto __pyx_L0; + + /* "stateclass.pxd":22 + * return self + * + * @staticmethod # <<<<<<<<<<<<<< + * cdef inline StateClass init_offset(const TokenC* sent, int length, int + * offset): +*/ + + /* function exit code */ + __pyx_L1_error:; + __Pyx_XDECREF(__pyx_t_1); + __Pyx_XDECREF(__pyx_t_2); + __Pyx_AddTraceback("spacy.pipeline._parser_internals.stateclass.StateClass.init_offset", __pyx_clineno, __pyx_lineno, __pyx_filename); + __pyx_r = 0; + __pyx_L0:; + __Pyx_XDECREF((PyObject *)__pyx_v_self); + __Pyx_XGIVEREF((PyObject *)__pyx_r); + __Pyx_RefNannyFinishContext(); + return __pyx_r; +} + +/* "thinc/extra/search.pxd":56 + * cdef int _fill(self, Queue* q, weight_t** scores, int** is_valid) except -1 + * + * cdef inline void* at(self, int i) nogil: # <<<<<<<<<<<<<< + * return self._states[i].content + * +*/ + +static CYTHON_INLINE void *__pyx_f_5thinc_5extra_6search_4Beam_at(struct __pyx_obj_5thinc_5extra_6search_Beam *__pyx_v_self, int __pyx_v_i) { + void *__pyx_r; + + /* "thinc/extra/search.pxd":57 + * + * cdef inline void* at(self, int i) nogil: + * return self._states[i].content # <<<<<<<<<<<<<< + * + * cdef int initialize(self, init_func_t init_func, del_func_t del_func, int n, void* extra_args) except -1 +*/ + __pyx_r = (__pyx_v_self->_states[__pyx_v_i]).content; + goto __pyx_L0; + + /* "thinc/extra/search.pxd":56 + * cdef int _fill(self, Queue* q, weight_t** scores, int** is_valid) except -1 + * + * cdef inline void* at(self, int i) nogil: # <<<<<<<<<<<<<< + * return self._states[i].content + * +*/ + + /* function exit code */ + __pyx_L0:; + return __pyx_r; +} + +/* "thinc/extra/search.pxd":65 + * + * + * cdef inline void set_cell(self, int i, int j, weight_t score, int is_valid, weight_t cost) nogil: # <<<<<<<<<<<<<< + * self.scores[i][j] = score + * self.is_valid[i][j] = is_valid +*/ + +static CYTHON_INLINE void __pyx_f_5thinc_5extra_6search_4Beam_set_cell(struct __pyx_obj_5thinc_5extra_6search_Beam *__pyx_v_self, int __pyx_v_i, int __pyx_v_j, __pyx_t_5thinc_5extra_6search_weight_t __pyx_v_score, int __pyx_v_is_valid, __pyx_t_5thinc_5extra_6search_weight_t __pyx_v_cost) { + + /* "thinc/extra/search.pxd":66 + * + * cdef inline void set_cell(self, int i, int j, weight_t score, int is_valid, weight_t cost) nogil: + * self.scores[i][j] = score # <<<<<<<<<<<<<< + * self.is_valid[i][j] = is_valid + * self.costs[i][j] = cost +*/ + ((__pyx_v_self->scores[__pyx_v_i])[__pyx_v_j]) = __pyx_v_score; + + /* "thinc/extra/search.pxd":67 + * cdef inline void set_cell(self, int i, int j, weight_t score, int is_valid, weight_t cost) nogil: + * self.scores[i][j] = score + * self.is_valid[i][j] = is_valid # <<<<<<<<<<<<<< + * self.costs[i][j] = cost + * +*/ + ((__pyx_v_self->is_valid[__pyx_v_i])[__pyx_v_j]) = __pyx_v_is_valid; + + /* "thinc/extra/search.pxd":68 + * self.scores[i][j] = score + * self.is_valid[i][j] = is_valid + * self.costs[i][j] = cost # <<<<<<<<<<<<<< + * + * cdef int set_row(self, int i, const weight_t* scores, const int* is_valid, +*/ + ((__pyx_v_self->costs[__pyx_v_i])[__pyx_v_j]) = __pyx_v_cost; + + /* "thinc/extra/search.pxd":65 + * + * + * cdef inline void set_cell(self, int i, int j, weight_t score, int is_valid, weight_t cost) nogil: # <<<<<<<<<<<<<< + * self.scores[i][j] = score + * self.is_valid[i][j] = is_valid +*/ + + /* function exit code */ +} + +/* "tokens/span.pxd":14 + * cdef public _vector_norm + * + * @staticmethod # <<<<<<<<<<<<<< + * cdef inline Span cinit(Doc doc, SpanC span): + * cdef Span self = Span.__new__( +*/ + +static CYTHON_INLINE struct __pyx_obj_5spacy_6tokens_4span_Span *__pyx_f_5spacy_6tokens_4span_4Span_cinit(struct __pyx_obj_5spacy_6tokens_3doc_Doc *__pyx_v_doc, struct __pyx_t_5spacy_7structs_SpanC __pyx_v_span) { + struct __pyx_obj_5spacy_6tokens_4span_Span *__pyx_v_self = 0; + struct __pyx_obj_5spacy_6tokens_4span_Span *__pyx_r = NULL; + __Pyx_RefNannyDeclarations + PyObject *__pyx_t_1 = NULL; + PyObject *__pyx_t_2 = NULL; + PyObject *__pyx_t_3 = NULL; + int __pyx_lineno = 0; + const char *__pyx_filename = NULL; + int __pyx_clineno = 0; + __Pyx_RefNannySetupContext("cinit", 0); + + /* "tokens/span.pxd":16 + * @staticmethod + * cdef inline Span cinit(Doc doc, SpanC span): + * cdef Span self = Span.__new__( # <<<<<<<<<<<<<< + * Span, + * doc, +*/ + __pyx_t_1 = PyTuple_New(1); if (unlikely(!__pyx_t_1)) __PYX_ERR(6, 16, __pyx_L1_error) + __Pyx_GOTREF(__pyx_t_1); + __Pyx_INCREF((PyObject *)__pyx_v_doc); + __Pyx_GIVEREF((PyObject *)__pyx_v_doc); + if (__Pyx_PyTuple_SET_ITEM(__pyx_t_1, 0, ((PyObject *)__pyx_v_doc)) != (0)) __PYX_ERR(6, 16, __pyx_L1_error); + + /* "tokens/span.pxd":19 + * Span, + * doc, + * start=span.start, # <<<<<<<<<<<<<< + * end=span.end + * ) +*/ + __pyx_t_2 = __Pyx_PyDict_NewPresized(2); if (unlikely(!__pyx_t_2)) __PYX_ERR(6, 19, __pyx_L1_error) + __Pyx_GOTREF(__pyx_t_2); + __pyx_t_3 = __Pyx_PyLong_From_int(__pyx_v_span.start); if (unlikely(!__pyx_t_3)) __PYX_ERR(6, 19, __pyx_L1_error) + __Pyx_GOTREF(__pyx_t_3); + if (PyDict_SetItem(__pyx_t_2, __pyx_mstate_global->__pyx_n_u_start, __pyx_t_3) < (0)) __PYX_ERR(6, 19, __pyx_L1_error) + __Pyx_DECREF(__pyx_t_3); __pyx_t_3 = 0; + + /* "tokens/span.pxd":20 + * doc, + * start=span.start, + * end=span.end # <<<<<<<<<<<<<< + * ) + * self.c = span +*/ + __pyx_t_3 = __Pyx_PyLong_From_int(__pyx_v_span.end); if (unlikely(!__pyx_t_3)) __PYX_ERR(6, 20, __pyx_L1_error) + __Pyx_GOTREF(__pyx_t_3); + if (PyDict_SetItem(__pyx_t_2, __pyx_mstate_global->__pyx_n_u_end, __pyx_t_3) < (0)) __PYX_ERR(6, 19, __pyx_L1_error) + __Pyx_DECREF(__pyx_t_3); __pyx_t_3 = 0; + + /* "tokens/span.pxd":16 + * @staticmethod + * cdef inline Span cinit(Doc doc, SpanC span): + * cdef Span self = Span.__new__( # <<<<<<<<<<<<<< + * Span, + * doc, +*/ + __pyx_t_3 = __Pyx_tp_new_kwargs(((PyObject *)__pyx_mstate_global->__pyx_ptype_5spacy_6tokens_4span_Span), ((PyObject*)__pyx_t_1), ((PyObject*)__pyx_t_2)); if (unlikely(!__pyx_t_3)) __PYX_ERR(6, 16, __pyx_L1_error) + __Pyx_GOTREF(__pyx_t_3); + __Pyx_DECREF(__pyx_t_1); __pyx_t_1 = 0; + __Pyx_DECREF(__pyx_t_2); __pyx_t_2 = 0; + if (!(likely(__Pyx_TypeTest(__pyx_t_3, __pyx_mstate_global->__pyx_ptype_5spacy_6tokens_4span_Span)))) __PYX_ERR(6, 16, __pyx_L1_error) + __pyx_v_self = ((struct __pyx_obj_5spacy_6tokens_4span_Span *)__pyx_t_3); + __pyx_t_3 = 0; + + /* "tokens/span.pxd":22 + * end=span.end + * ) + * self.c = span # <<<<<<<<<<<<<< + * return self + * +*/ + __pyx_v_self->c = __pyx_v_span; + + /* "tokens/span.pxd":23 + * ) + * self.c = span + * return self # <<<<<<<<<<<<<< + * + * cpdef np.ndarray to_array(self, object features) +*/ + __Pyx_XDECREF((PyObject *)__pyx_r); + __Pyx_INCREF((PyObject *)__pyx_v_self); + __pyx_r = __pyx_v_self; + goto __pyx_L0; + + /* "tokens/span.pxd":14 + * cdef public _vector_norm + * + * @staticmethod # <<<<<<<<<<<<<< + * cdef inline Span cinit(Doc doc, SpanC span): + * cdef Span self = Span.__new__( +*/ + + /* function exit code */ + __pyx_L1_error:; + __Pyx_XDECREF(__pyx_t_1); + __Pyx_XDECREF(__pyx_t_2); + __Pyx_XDECREF(__pyx_t_3); + __Pyx_AddTraceback("spacy.tokens.span.Span.cinit", __pyx_clineno, __pyx_lineno, __pyx_filename); + __pyx_r = 0; + __pyx_L0:; + __Pyx_XDECREF((PyObject *)__pyx_v_self); + __Pyx_XGIVEREF((PyObject *)__pyx_r); + __Pyx_RefNannyFinishContext(); + return __pyx_r; +} + +/* "spacy/pipeline/_parser_internals/ner.pyx":59 + * cdef GoldNERStateC c + * + * def __init__(self, BiluoPushDown moves, StateClass stcls, Example example, neg_key): # <<<<<<<<<<<<<< + * self.mem = Pool() + * self.c = create_gold_state(self.mem, moves, stcls.c, example, neg_key) +*/ + +/* Python wrapper */ +static int __pyx_pw_5spacy_8pipeline_17_parser_internals_3ner_9BiluoGold_1__init__(PyObject *__pyx_v_self, PyObject *__pyx_args, PyObject *__pyx_kwds); /*proto*/ +static int __pyx_pw_5spacy_8pipeline_17_parser_internals_3ner_9BiluoGold_1__init__(PyObject *__pyx_v_self, PyObject *__pyx_args, PyObject *__pyx_kwds) { + struct __pyx_obj_5spacy_8pipeline_17_parser_internals_3ner_BiluoPushDown *__pyx_v_moves = 0; + struct __pyx_obj_5spacy_8pipeline_17_parser_internals_10stateclass_StateClass *__pyx_v_stcls = 0; + struct __pyx_obj_5spacy_8training_7example_Example *__pyx_v_example = 0; + PyObject *__pyx_v_neg_key = 0; + CYTHON_UNUSED Py_ssize_t __pyx_nargs; + 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; + 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_moves,&__pyx_mstate_global->__pyx_n_u_stcls,&__pyx_mstate_global->__pyx_n_u_example,&__pyx_mstate_global->__pyx_n_u_neg_key,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, 59, __pyx_L3_error) + if (__pyx_kwds_len > 0) { + switch (__pyx_nargs) { + case 4: + values[3] = __Pyx_ArgRef_VARARGS(__pyx_args, 3); + if (!CYTHON_ASSUME_SAFE_MACROS && unlikely(!values[3])) __PYX_ERR(0, 59, __pyx_L3_error) + CYTHON_FALLTHROUGH; + case 3: + values[2] = __Pyx_ArgRef_VARARGS(__pyx_args, 2); + if (!CYTHON_ASSUME_SAFE_MACROS && unlikely(!values[2])) __PYX_ERR(0, 59, __pyx_L3_error) + CYTHON_FALLTHROUGH; + case 2: + values[1] = __Pyx_ArgRef_VARARGS(__pyx_args, 1); + if (!CYTHON_ASSUME_SAFE_MACROS && unlikely(!values[1])) __PYX_ERR(0, 59, __pyx_L3_error) + CYTHON_FALLTHROUGH; + case 1: + values[0] = __Pyx_ArgRef_VARARGS(__pyx_args, 0); + if (!CYTHON_ASSUME_SAFE_MACROS && unlikely(!values[0])) __PYX_ERR(0, 59, __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, 59, __pyx_L3_error) + for (Py_ssize_t i = __pyx_nargs; i < 4; i++) { + if (unlikely(!values[i])) { __Pyx_RaiseArgtupleInvalid("__init__", 1, 4, 4, i); __PYX_ERR(0, 59, __pyx_L3_error) } + } + } else if (unlikely(__pyx_nargs != 4)) { + 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, 59, __pyx_L3_error) + values[1] = __Pyx_ArgRef_VARARGS(__pyx_args, 1); + if (!CYTHON_ASSUME_SAFE_MACROS && unlikely(!values[1])) __PYX_ERR(0, 59, __pyx_L3_error) + values[2] = __Pyx_ArgRef_VARARGS(__pyx_args, 2); + if (!CYTHON_ASSUME_SAFE_MACROS && unlikely(!values[2])) __PYX_ERR(0, 59, __pyx_L3_error) + values[3] = __Pyx_ArgRef_VARARGS(__pyx_args, 3); + if (!CYTHON_ASSUME_SAFE_MACROS && unlikely(!values[3])) __PYX_ERR(0, 59, __pyx_L3_error) + } + __pyx_v_moves = ((struct __pyx_obj_5spacy_8pipeline_17_parser_internals_3ner_BiluoPushDown *)values[0]); + __pyx_v_stcls = ((struct __pyx_obj_5spacy_8pipeline_17_parser_internals_10stateclass_StateClass *)values[1]); + __pyx_v_example = ((struct __pyx_obj_5spacy_8training_7example_Example *)values[2]); + __pyx_v_neg_key = values[3]; + } + goto __pyx_L6_skip; + __pyx_L5_argtuple_error:; + __Pyx_RaiseArgtupleInvalid("__init__", 1, 4, 4, __pyx_nargs); __PYX_ERR(0, 59, __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("spacy.pipeline._parser_internals.ner.BiluoGold.__init__", __pyx_clineno, __pyx_lineno, __pyx_filename); + __Pyx_RefNannyFinishContext(); + return -1; + __pyx_L4_argument_unpacking_done:; + if (unlikely(!__Pyx_ArgTypeTest(((PyObject *)__pyx_v_moves), __pyx_mstate_global->__pyx_ptype_5spacy_8pipeline_17_parser_internals_3ner_BiluoPushDown, 1, "moves", 0))) __PYX_ERR(0, 59, __pyx_L1_error) + if (unlikely(!__Pyx_ArgTypeTest(((PyObject *)__pyx_v_stcls), __pyx_mstate_global->__pyx_ptype_5spacy_8pipeline_17_parser_internals_10stateclass_StateClass, 1, "stcls", 0))) __PYX_ERR(0, 59, __pyx_L1_error) + if (unlikely(!__Pyx_ArgTypeTest(((PyObject *)__pyx_v_example), __pyx_mstate_global->__pyx_ptype_5spacy_8training_7example_Example, 1, "example", 0))) __PYX_ERR(0, 59, __pyx_L1_error) + __pyx_r = __pyx_pf_5spacy_8pipeline_17_parser_internals_3ner_9BiluoGold___init__(((struct __pyx_obj_5spacy_8pipeline_17_parser_internals_3ner_BiluoGold *)__pyx_v_self), __pyx_v_moves, __pyx_v_stcls, __pyx_v_example, __pyx_v_neg_key); + + /* 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_5spacy_8pipeline_17_parser_internals_3ner_9BiluoGold___init__(struct __pyx_obj_5spacy_8pipeline_17_parser_internals_3ner_BiluoGold *__pyx_v_self, struct __pyx_obj_5spacy_8pipeline_17_parser_internals_3ner_BiluoPushDown *__pyx_v_moves, struct __pyx_obj_5spacy_8pipeline_17_parser_internals_10stateclass_StateClass *__pyx_v_stcls, struct __pyx_obj_5spacy_8training_7example_Example *__pyx_v_example, PyObject *__pyx_v_neg_key) { + int __pyx_r; + __Pyx_RefNannyDeclarations + PyObject *__pyx_t_1 = NULL; + PyObject *__pyx_t_2 = NULL; + size_t __pyx_t_3; + struct __pyx_t_5spacy_8pipeline_17_parser_internals_3ner_GoldNERStateC __pyx_t_4; + int __pyx_lineno = 0; + const char *__pyx_filename = NULL; + int __pyx_clineno = 0; + __Pyx_RefNannySetupContext("__init__", 0); + + /* "spacy/pipeline/_parser_internals/ner.pyx":60 + * + * def __init__(self, BiluoPushDown moves, StateClass stcls, Example example, neg_key): + * self.mem = Pool() # <<<<<<<<<<<<<< + * self.c = create_gold_state(self.mem, moves, stcls.c, example, neg_key) + * +*/ + __pyx_t_2 = NULL; + __pyx_t_3 = 1; + { + PyObject *__pyx_callargs[2] = {__pyx_t_2, NULL}; + __pyx_t_1 = __Pyx_PyObject_FastCall((PyObject*)__pyx_mstate_global->__pyx_ptype_5cymem_5cymem_Pool, __pyx_callargs+__pyx_t_3, (1-__pyx_t_3) | (__pyx_t_3*__Pyx_PY_VECTORCALL_ARGUMENTS_OFFSET)); + __Pyx_XDECREF(__pyx_t_2); __pyx_t_2 = 0; + if (unlikely(!__pyx_t_1)) __PYX_ERR(0, 60, __pyx_L1_error) + __Pyx_GOTREF((PyObject *)__pyx_t_1); + } + __Pyx_GIVEREF((PyObject *)__pyx_t_1); + __Pyx_GOTREF((PyObject *)__pyx_v_self->mem); + __Pyx_DECREF((PyObject *)__pyx_v_self->mem); + __pyx_v_self->mem = ((struct __pyx_obj_5cymem_5cymem_Pool *)__pyx_t_1); + __pyx_t_1 = 0; + + /* "spacy/pipeline/_parser_internals/ner.pyx":61 + * def __init__(self, BiluoPushDown moves, StateClass stcls, Example example, neg_key): + * self.mem = Pool() + * self.c = create_gold_state(self.mem, moves, stcls.c, example, neg_key) # <<<<<<<<<<<<<< + * + * def update(self, StateClass stcls): +*/ + __pyx_t_1 = ((PyObject *)__pyx_v_self->mem); + __Pyx_INCREF(__pyx_t_1); + __pyx_t_4 = __pyx_f_5spacy_8pipeline_17_parser_internals_3ner_create_gold_state(((struct __pyx_obj_5cymem_5cymem_Pool *)__pyx_t_1), __pyx_v_moves, __pyx_v_stcls->c, __pyx_v_example, __pyx_v_neg_key); if (unlikely(PyErr_Occurred())) __PYX_ERR(0, 61, __pyx_L1_error) + __Pyx_DECREF(__pyx_t_1); __pyx_t_1 = 0; + __pyx_v_self->c = __pyx_t_4; + + /* "spacy/pipeline/_parser_internals/ner.pyx":59 + * cdef GoldNERStateC c + * + * def __init__(self, BiluoPushDown moves, StateClass stcls, Example example, neg_key): # <<<<<<<<<<<<<< + * self.mem = Pool() + * self.c = create_gold_state(self.mem, moves, stcls.c, example, neg_key) +*/ + + /* function exit code */ + __pyx_r = 0; + goto __pyx_L0; + __pyx_L1_error:; + __Pyx_XDECREF(__pyx_t_1); + __Pyx_XDECREF(__pyx_t_2); + __Pyx_AddTraceback("spacy.pipeline._parser_internals.ner.BiluoGold.__init__", __pyx_clineno, __pyx_lineno, __pyx_filename); + __pyx_r = -1; + __pyx_L0:; + __Pyx_RefNannyFinishContext(); + return __pyx_r; +} + +/* "spacy/pipeline/_parser_internals/ner.pyx":63 + * self.c = create_gold_state(self.mem, moves, stcls.c, example, neg_key) + * + * def update(self, StateClass stcls): # <<<<<<<<<<<<<< + * update_gold_state(&self.c, stcls.c) + * +*/ + +/* Python wrapper */ +static PyObject *__pyx_pw_5spacy_8pipeline_17_parser_internals_3ner_9BiluoGold_3update(PyObject *__pyx_v_self, +#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_5spacy_8pipeline_17_parser_internals_3ner_9BiluoGold_2update, "BiluoGold.update(self, StateClass stcls)"); +static PyMethodDef __pyx_mdef_5spacy_8pipeline_17_parser_internals_3ner_9BiluoGold_3update = {"update", (PyCFunction)(void(*)(void))(__Pyx_PyCFunction_FastCallWithKeywords)__pyx_pw_5spacy_8pipeline_17_parser_internals_3ner_9BiluoGold_3update, __Pyx_METH_FASTCALL|METH_KEYWORDS, __pyx_doc_5spacy_8pipeline_17_parser_internals_3ner_9BiluoGold_2update}; +static PyObject *__pyx_pw_5spacy_8pipeline_17_parser_internals_3ner_9BiluoGold_3update(PyObject *__pyx_v_self, +#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_5spacy_8pipeline_17_parser_internals_10stateclass_StateClass *__pyx_v_stcls = 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("update (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_stcls,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, 63, __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, 63, __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, "update", 0) < (0)) __PYX_ERR(0, 63, __pyx_L3_error) + for (Py_ssize_t i = __pyx_nargs; i < 1; i++) { + if (unlikely(!values[i])) { __Pyx_RaiseArgtupleInvalid("update", 1, 1, 1, i); __PYX_ERR(0, 63, __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, 63, __pyx_L3_error) + } + __pyx_v_stcls = ((struct __pyx_obj_5spacy_8pipeline_17_parser_internals_10stateclass_StateClass *)values[0]); + } + goto __pyx_L6_skip; + __pyx_L5_argtuple_error:; + __Pyx_RaiseArgtupleInvalid("update", 1, 1, 1, __pyx_nargs); __PYX_ERR(0, 63, __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("spacy.pipeline._parser_internals.ner.BiluoGold.update", __pyx_clineno, __pyx_lineno, __pyx_filename); + __Pyx_RefNannyFinishContext(); + return NULL; + __pyx_L4_argument_unpacking_done:; + if (unlikely(!__Pyx_ArgTypeTest(((PyObject *)__pyx_v_stcls), __pyx_mstate_global->__pyx_ptype_5spacy_8pipeline_17_parser_internals_10stateclass_StateClass, 1, "stcls", 0))) __PYX_ERR(0, 63, __pyx_L1_error) + __pyx_r = __pyx_pf_5spacy_8pipeline_17_parser_internals_3ner_9BiluoGold_2update(((struct __pyx_obj_5spacy_8pipeline_17_parser_internals_3ner_BiluoGold *)__pyx_v_self), __pyx_v_stcls); + + /* 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_5spacy_8pipeline_17_parser_internals_3ner_9BiluoGold_2update(struct __pyx_obj_5spacy_8pipeline_17_parser_internals_3ner_BiluoGold *__pyx_v_self, struct __pyx_obj_5spacy_8pipeline_17_parser_internals_10stateclass_StateClass *__pyx_v_stcls) { + PyObject *__pyx_r = NULL; + __Pyx_RefNannyDeclarations + int __pyx_lineno = 0; + const char *__pyx_filename = NULL; + int __pyx_clineno = 0; + __Pyx_RefNannySetupContext("update", 0); + + /* "spacy/pipeline/_parser_internals/ner.pyx":64 + * + * def update(self, StateClass stcls): + * update_gold_state(&self.c, stcls.c) # <<<<<<<<<<<<<< + * + * +*/ + __pyx_f_5spacy_8pipeline_17_parser_internals_3ner_update_gold_state((&__pyx_v_self->c), __pyx_v_stcls->c); if (unlikely(PyErr_Occurred())) __PYX_ERR(0, 64, __pyx_L1_error) + + /* "spacy/pipeline/_parser_internals/ner.pyx":63 + * self.c = create_gold_state(self.mem, moves, stcls.c, example, neg_key) + * + * def update(self, StateClass stcls): # <<<<<<<<<<<<<< + * update_gold_state(&self.c, stcls.c) + * +*/ + + /* function exit code */ + __pyx_r = Py_None; __Pyx_INCREF(Py_None); + goto __pyx_L0; + __pyx_L1_error:; + __Pyx_AddTraceback("spacy.pipeline._parser_internals.ner.BiluoGold.update", __pyx_clineno, __pyx_lineno, __pyx_filename); + __pyx_r = NULL; + __pyx_L0:; + __Pyx_XGIVEREF(__pyx_r); + __Pyx_RefNannyFinishContext(); + return __pyx_r; +} + +/* "(tree fragment)":1 + * def __reduce_cython__(self): # <<<<<<<<<<<<<< + * raise TypeError, "self.c cannot be converted to a Python object for pickling" + * def __setstate_cython__(self, __pyx_state): +*/ + +/* Python wrapper */ +static PyObject *__pyx_pw_5spacy_8pipeline_17_parser_internals_3ner_9BiluoGold_5__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_5spacy_8pipeline_17_parser_internals_3ner_9BiluoGold_4__reduce_cython__, "BiluoGold.__reduce_cython__(self)"); +static PyMethodDef __pyx_mdef_5spacy_8pipeline_17_parser_internals_3ner_9BiluoGold_5__reduce_cython__ = {"__reduce_cython__", (PyCFunction)(void(*)(void))(__Pyx_PyCFunction_FastCallWithKeywords)__pyx_pw_5spacy_8pipeline_17_parser_internals_3ner_9BiluoGold_5__reduce_cython__, __Pyx_METH_FASTCALL|METH_KEYWORDS, __pyx_doc_5spacy_8pipeline_17_parser_internals_3ner_9BiluoGold_4__reduce_cython__}; +static PyObject *__pyx_pw_5spacy_8pipeline_17_parser_internals_3ner_9BiluoGold_5__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_5spacy_8pipeline_17_parser_internals_3ner_9BiluoGold_4__reduce_cython__(((struct __pyx_obj_5spacy_8pipeline_17_parser_internals_3ner_BiluoGold *)__pyx_v_self)); + + /* function exit code */ + __Pyx_RefNannyFinishContext(); + return __pyx_r; +} + +static PyObject *__pyx_pf_5spacy_8pipeline_17_parser_internals_3ner_9BiluoGold_4__reduce_cython__(CYTHON_UNUSED struct __pyx_obj_5spacy_8pipeline_17_parser_internals_3ner_BiluoGold *__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.c cannot be converted to a Python object for pickling" # <<<<<<<<<<<<<< + * def __setstate_cython__(self, __pyx_state): + * raise TypeError, "self.c cannot be converted to a Python object for pickling" +*/ + __Pyx_Raise(((PyObject *)(((PyTypeObject*)PyExc_TypeError))), __pyx_mstate_global->__pyx_kp_u_self_c_cannot_be_converted_to_a, 0, 0); + __PYX_ERR(1, 2, __pyx_L1_error) + + /* "(tree fragment)":1 + * def __reduce_cython__(self): # <<<<<<<<<<<<<< + * raise TypeError, "self.c cannot be converted to a Python object for pickling" + * def __setstate_cython__(self, __pyx_state): +*/ + + /* function exit code */ + __pyx_L1_error:; + __Pyx_AddTraceback("spacy.pipeline._parser_internals.ner.BiluoGold.__reduce_cython__", __pyx_clineno, __pyx_lineno, __pyx_filename); + __pyx_r = NULL; + __Pyx_XGIVEREF(__pyx_r); + __Pyx_RefNannyFinishContext(); + return __pyx_r; +} + +/* "(tree fragment)":3 + * def __reduce_cython__(self): + * raise TypeError, "self.c cannot be converted to a Python object for pickling" + * def __setstate_cython__(self, __pyx_state): # <<<<<<<<<<<<<< + * raise TypeError, "self.c cannot be converted to a Python object for pickling" +*/ + +/* Python wrapper */ +static PyObject *__pyx_pw_5spacy_8pipeline_17_parser_internals_3ner_9BiluoGold_7__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_5spacy_8pipeline_17_parser_internals_3ner_9BiluoGold_6__setstate_cython__, "BiluoGold.__setstate_cython__(self, __pyx_state)"); +static PyMethodDef __pyx_mdef_5spacy_8pipeline_17_parser_internals_3ner_9BiluoGold_7__setstate_cython__ = {"__setstate_cython__", (PyCFunction)(void(*)(void))(__Pyx_PyCFunction_FastCallWithKeywords)__pyx_pw_5spacy_8pipeline_17_parser_internals_3ner_9BiluoGold_7__setstate_cython__, __Pyx_METH_FASTCALL|METH_KEYWORDS, __pyx_doc_5spacy_8pipeline_17_parser_internals_3ner_9BiluoGold_6__setstate_cython__}; +static PyObject *__pyx_pw_5spacy_8pipeline_17_parser_internals_3ner_9BiluoGold_7__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("spacy.pipeline._parser_internals.ner.BiluoGold.__setstate_cython__", __pyx_clineno, __pyx_lineno, __pyx_filename); + __Pyx_RefNannyFinishContext(); + return NULL; + __pyx_L4_argument_unpacking_done:; + __pyx_r = __pyx_pf_5spacy_8pipeline_17_parser_internals_3ner_9BiluoGold_6__setstate_cython__(((struct __pyx_obj_5spacy_8pipeline_17_parser_internals_3ner_BiluoGold *)__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_5spacy_8pipeline_17_parser_internals_3ner_9BiluoGold_6__setstate_cython__(CYTHON_UNUSED struct __pyx_obj_5spacy_8pipeline_17_parser_internals_3ner_BiluoGold *__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.c cannot be converted to a Python object for pickling" + * def __setstate_cython__(self, __pyx_state): + * raise TypeError, "self.c cannot be converted to a Python object for pickling" # <<<<<<<<<<<<<< +*/ + __Pyx_Raise(((PyObject *)(((PyTypeObject*)PyExc_TypeError))), __pyx_mstate_global->__pyx_kp_u_self_c_cannot_be_converted_to_a, 0, 0); + __PYX_ERR(1, 4, __pyx_L1_error) + + /* "(tree fragment)":3 + * def __reduce_cython__(self): + * raise TypeError, "self.c cannot be converted to a Python object for pickling" + * def __setstate_cython__(self, __pyx_state): # <<<<<<<<<<<<<< + * raise TypeError, "self.c cannot be converted to a Python object for pickling" +*/ + + /* function exit code */ + __pyx_L1_error:; + __Pyx_AddTraceback("spacy.pipeline._parser_internals.ner.BiluoGold.__setstate_cython__", __pyx_clineno, __pyx_lineno, __pyx_filename); + __pyx_r = NULL; + __Pyx_XGIVEREF(__pyx_r); + __Pyx_RefNannyFinishContext(); + return __pyx_r; +} + +/* "spacy/pipeline/_parser_internals/ner.pyx":67 + * + * + * cdef GoldNERStateC create_gold_state( # <<<<<<<<<<<<<< + * Pool mem, + * BiluoPushDown moves, +*/ + +static struct __pyx_t_5spacy_8pipeline_17_parser_internals_3ner_GoldNERStateC __pyx_f_5spacy_8pipeline_17_parser_internals_3ner_create_gold_state(struct __pyx_obj_5cymem_5cymem_Pool *__pyx_v_mem, struct __pyx_obj_5spacy_8pipeline_17_parser_internals_3ner_BiluoPushDown *__pyx_v_moves, CYTHON_UNUSED __pyx_t_5spacy_8pipeline_17_parser_internals_6_state_StateC const *__pyx_v_stcls, struct __pyx_obj_5spacy_8training_7example_Example *__pyx_v_example, PyObject *__pyx_v_neg_key) { + struct __pyx_t_5spacy_8pipeline_17_parser_internals_3ner_GoldNERStateC __pyx_v_gs; + struct __pyx_obj_5spacy_6tokens_4span_Span *__pyx_v_neg = 0; + PyObject *__pyx_v_negs = NULL; + PyObject *__pyx_v_ner_ents = NULL; + PyObject *__pyx_v_ner_tags = NULL; + PyObject *__pyx_v_i = NULL; + PyObject *__pyx_v_ner_tag = NULL; + PyObject *__pyx_v_neg_span_triples = NULL; + PyObject *__pyx_v_pos_span = NULL; + PyObject *__pyx_7genexpr__pyx_v_neg_ent = NULL; + struct __pyx_t_5spacy_8pipeline_17_parser_internals_3ner_GoldNERStateC __pyx_r; + __Pyx_RefNannyDeclarations + int __pyx_t_1; + PyObject *__pyx_t_2 = NULL; + PyObject *__pyx_t_3 = NULL; + PyObject *__pyx_t_4 = NULL; + PyObject *__pyx_t_5 = NULL; + PyObject *__pyx_t_6 = NULL; + size_t __pyx_t_7; + void *__pyx_t_8; + Py_ssize_t __pyx_t_9; + PyObject *(*__pyx_t_10)(PyObject *); + PyObject *(*__pyx_t_11)(PyObject *); + struct __pyx_t_5spacy_8pipeline_17_parser_internals_17transition_system_Transition __pyx_t_12; + Py_ssize_t __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; + struct __pyx_t_5spacy_7structs_SpanC __pyx_t_19; + int __pyx_lineno = 0; + const char *__pyx_filename = NULL; + int __pyx_clineno = 0; + __Pyx_RefNannySetupContext("create_gold_state", 0); + + /* "spacy/pipeline/_parser_internals/ner.pyx":76 + * cdef GoldNERStateC gs + * cdef Span neg + * if neg_key is not None: # <<<<<<<<<<<<<< + * negs = example.get_aligned_spans_y2x( + * example.y.spans.get(neg_key, []), +*/ + __pyx_t_1 = (__pyx_v_neg_key != Py_None); + if (__pyx_t_1) { + + /* "spacy/pipeline/_parser_internals/ner.pyx":77 + * cdef Span neg + * if neg_key is not None: + * negs = example.get_aligned_spans_y2x( # <<<<<<<<<<<<<< + * example.y.spans.get(neg_key, []), + * allow_overlap=True +*/ + __pyx_t_3 = ((PyObject *)__pyx_v_example); + __Pyx_INCREF(__pyx_t_3); + + /* "spacy/pipeline/_parser_internals/ner.pyx":78 + * if neg_key is not None: + * negs = example.get_aligned_spans_y2x( + * example.y.spans.get(neg_key, []), # <<<<<<<<<<<<<< + * allow_overlap=True + * ) +*/ + __pyx_t_5 = __pyx_v_example->y->spans; + __Pyx_INCREF(__pyx_t_5); + __pyx_t_6 = PyList_New(0); if (unlikely(!__pyx_t_6)) __PYX_ERR(0, 78, __pyx_L1_error) + __Pyx_GOTREF(__pyx_t_6); + __pyx_t_7 = 0; + { + PyObject *__pyx_callargs[3] = {__pyx_t_5, __pyx_v_neg_key, __pyx_t_6}; + __pyx_t_4 = __Pyx_PyObject_FastCallMethod((PyObject*)__pyx_mstate_global->__pyx_n_u_get, __pyx_callargs+__pyx_t_7, (3-__pyx_t_7) | (1*__Pyx_PY_VECTORCALL_ARGUMENTS_OFFSET)); + __Pyx_XDECREF(__pyx_t_5); __pyx_t_5 = 0; + __Pyx_DECREF(__pyx_t_6); __pyx_t_6 = 0; + if (unlikely(!__pyx_t_4)) __PYX_ERR(0, 78, __pyx_L1_error) + __Pyx_GOTREF(__pyx_t_4); + } + + /* "spacy/pipeline/_parser_internals/ner.pyx":79 + * negs = example.get_aligned_spans_y2x( + * example.y.spans.get(neg_key, []), + * allow_overlap=True # <<<<<<<<<<<<<< + * ) + * else: +*/ + __pyx_t_7 = 0; + { + PyObject *__pyx_callargs[2 + ((CYTHON_VECTORCALL) ? 1 : 0)] = {__pyx_t_3, __pyx_t_4}; + __pyx_t_6 = __Pyx_MakeVectorcallBuilderKwds(1); if (unlikely(!__pyx_t_6)) __PYX_ERR(0, 77, __pyx_L1_error) + __Pyx_GOTREF(__pyx_t_6); + if (__Pyx_VectorcallBuilder_AddArg(__pyx_mstate_global->__pyx_n_u_allow_overlap, Py_True, __pyx_t_6, __pyx_callargs+2, 0) < (0)) __PYX_ERR(0, 77, __pyx_L1_error) + __pyx_t_2 = __Pyx_Object_VectorcallMethod_CallFromBuilder((PyObject*)__pyx_mstate_global->__pyx_n_u_get_aligned_spans_y2x, __pyx_callargs+__pyx_t_7, (2-__pyx_t_7) | (1*__Pyx_PY_VECTORCALL_ARGUMENTS_OFFSET), __pyx_t_6); + __Pyx_XDECREF(__pyx_t_3); __pyx_t_3 = 0; + __Pyx_DECREF(__pyx_t_4); __pyx_t_4 = 0; + __Pyx_DECREF(__pyx_t_6); __pyx_t_6 = 0; + if (unlikely(!__pyx_t_2)) __PYX_ERR(0, 77, __pyx_L1_error) + __Pyx_GOTREF(__pyx_t_2); + } + __pyx_v_negs = __pyx_t_2; + __pyx_t_2 = 0; + + /* "spacy/pipeline/_parser_internals/ner.pyx":76 + * cdef GoldNERStateC gs + * cdef Span neg + * if neg_key is not None: # <<<<<<<<<<<<<< + * negs = example.get_aligned_spans_y2x( + * example.y.spans.get(neg_key, []), +*/ + goto __pyx_L3; + } + + /* "spacy/pipeline/_parser_internals/ner.pyx":82 + * ) + * else: + * negs = [] # <<<<<<<<<<<<<< + * assert example.x.length > 0 + * gs.ner = mem.alloc(example.x.length, sizeof(Transition)) +*/ + /*else*/ { + __pyx_t_2 = PyList_New(0); if (unlikely(!__pyx_t_2)) __PYX_ERR(0, 82, __pyx_L1_error) + __Pyx_GOTREF(__pyx_t_2); + __pyx_v_negs = __pyx_t_2; + __pyx_t_2 = 0; + } + __pyx_L3:; + + /* "spacy/pipeline/_parser_internals/ner.pyx":83 + * else: + * negs = [] + * assert example.x.length > 0 # <<<<<<<<<<<<<< + * gs.ner = mem.alloc(example.x.length, sizeof(Transition)) + * gs.negs = mem.alloc(len(negs), sizeof(SpanC)) +*/ + #ifndef CYTHON_WITHOUT_ASSERTIONS + if (unlikely(__pyx_assertions_enabled())) { + __pyx_t_1 = (__pyx_v_example->x->length > 0); + if (unlikely(!__pyx_t_1)) { + __Pyx_Raise(((PyObject *)(((PyTypeObject*)PyExc_AssertionError))), 0, 0, 0); + __PYX_ERR(0, 83, __pyx_L1_error) + } + } + #else + if ((1)); else __PYX_ERR(0, 83, __pyx_L1_error) + #endif + + /* "spacy/pipeline/_parser_internals/ner.pyx":84 + * negs = [] + * assert example.x.length > 0 + * gs.ner = mem.alloc(example.x.length, sizeof(Transition)) # <<<<<<<<<<<<<< + * gs.negs = mem.alloc(len(negs), sizeof(SpanC)) + * gs.nr_neg = len(negs) +*/ + __pyx_t_8 = ((struct __pyx_vtabstruct_5cymem_5cymem_Pool *)__pyx_v_mem->__pyx_vtab)->alloc(__pyx_v_mem, __pyx_v_example->x->length, (sizeof(struct __pyx_t_5spacy_8pipeline_17_parser_internals_17transition_system_Transition))); if (unlikely(__pyx_t_8 == ((void *)NULL))) __PYX_ERR(0, 84, __pyx_L1_error) + __pyx_v_gs.ner = ((struct __pyx_t_5spacy_8pipeline_17_parser_internals_17transition_system_Transition *)__pyx_t_8); + + /* "spacy/pipeline/_parser_internals/ner.pyx":85 + * assert example.x.length > 0 + * gs.ner = mem.alloc(example.x.length, sizeof(Transition)) + * gs.negs = mem.alloc(len(negs), sizeof(SpanC)) # <<<<<<<<<<<<<< + * gs.nr_neg = len(negs) + * ner_ents, ner_tags = example.get_aligned_ents_and_ner() +*/ + __pyx_t_9 = PyObject_Length(__pyx_v_negs); if (unlikely(__pyx_t_9 == ((Py_ssize_t)-1))) __PYX_ERR(0, 85, __pyx_L1_error) + __pyx_t_8 = ((struct __pyx_vtabstruct_5cymem_5cymem_Pool *)__pyx_v_mem->__pyx_vtab)->alloc(__pyx_v_mem, __pyx_t_9, (sizeof(struct __pyx_t_5spacy_7structs_SpanC))); if (unlikely(__pyx_t_8 == ((void *)NULL))) __PYX_ERR(0, 85, __pyx_L1_error) + __pyx_v_gs.negs = ((struct __pyx_t_5spacy_7structs_SpanC *)__pyx_t_8); + + /* "spacy/pipeline/_parser_internals/ner.pyx":86 + * gs.ner = mem.alloc(example.x.length, sizeof(Transition)) + * gs.negs = mem.alloc(len(negs), sizeof(SpanC)) + * gs.nr_neg = len(negs) # <<<<<<<<<<<<<< + * ner_ents, ner_tags = example.get_aligned_ents_and_ner() + * for i, ner_tag in enumerate(ner_tags): +*/ + __pyx_t_9 = PyObject_Length(__pyx_v_negs); if (unlikely(__pyx_t_9 == ((Py_ssize_t)-1))) __PYX_ERR(0, 86, __pyx_L1_error) + __pyx_v_gs.nr_neg = __pyx_t_9; + + /* "spacy/pipeline/_parser_internals/ner.pyx":87 + * gs.negs = mem.alloc(len(negs), sizeof(SpanC)) + * gs.nr_neg = len(negs) + * ner_ents, ner_tags = example.get_aligned_ents_and_ner() # <<<<<<<<<<<<<< + * for i, ner_tag in enumerate(ner_tags): + * gs.ner[i] = moves.lookup_transition(ner_tag) +*/ + __pyx_t_6 = ((PyObject *)__pyx_v_example); + __Pyx_INCREF(__pyx_t_6); + __pyx_t_7 = 0; + { + PyObject *__pyx_callargs[2] = {__pyx_t_6, NULL}; + __pyx_t_2 = __Pyx_PyObject_FastCallMethod((PyObject*)__pyx_mstate_global->__pyx_n_u_get_aligned_ents_and_ner, __pyx_callargs+__pyx_t_7, (1-__pyx_t_7) | (1*__Pyx_PY_VECTORCALL_ARGUMENTS_OFFSET)); + __Pyx_XDECREF(__pyx_t_6); __pyx_t_6 = 0; + if (unlikely(!__pyx_t_2)) __PYX_ERR(0, 87, __pyx_L1_error) + __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, 87, __pyx_L1_error) + } + #if CYTHON_ASSUME_SAFE_MACROS && !CYTHON_AVOID_BORROWED_REFS + if (likely(PyTuple_CheckExact(sequence))) { + __pyx_t_6 = PyTuple_GET_ITEM(sequence, 0); + __Pyx_INCREF(__pyx_t_6); + __pyx_t_4 = PyTuple_GET_ITEM(sequence, 1); + __Pyx_INCREF(__pyx_t_4); + } else { + __pyx_t_6 = __Pyx_PyList_GetItemRefFast(sequence, 0, __Pyx_ReferenceSharing_SharedReference); + if (unlikely(!__pyx_t_6)) __PYX_ERR(0, 87, __pyx_L1_error) + __Pyx_XGOTREF(__pyx_t_6); + __pyx_t_4 = __Pyx_PyList_GetItemRefFast(sequence, 1, __Pyx_ReferenceSharing_SharedReference); + if (unlikely(!__pyx_t_4)) __PYX_ERR(0, 87, __pyx_L1_error) + __Pyx_XGOTREF(__pyx_t_4); + } + #else + __pyx_t_6 = __Pyx_PySequence_ITEM(sequence, 0); if (unlikely(!__pyx_t_6)) __PYX_ERR(0, 87, __pyx_L1_error) + __Pyx_GOTREF(__pyx_t_6); + __pyx_t_4 = __Pyx_PySequence_ITEM(sequence, 1); if (unlikely(!__pyx_t_4)) __PYX_ERR(0, 87, __pyx_L1_error) + __Pyx_GOTREF(__pyx_t_4); + #endif + __Pyx_DECREF(__pyx_t_2); __pyx_t_2 = 0; + } else { + Py_ssize_t index = -1; + __pyx_t_3 = PyObject_GetIter(__pyx_t_2); if (unlikely(!__pyx_t_3)) __PYX_ERR(0, 87, __pyx_L1_error) + __Pyx_GOTREF(__pyx_t_3); + __Pyx_DECREF(__pyx_t_2); __pyx_t_2 = 0; + __pyx_t_10 = (CYTHON_COMPILING_IN_LIMITED_API) ? PyIter_Next : __Pyx_PyObject_GetIterNextFunc(__pyx_t_3); + index = 0; __pyx_t_6 = __pyx_t_10(__pyx_t_3); if (unlikely(!__pyx_t_6)) goto __pyx_L4_unpacking_failed; + __Pyx_GOTREF(__pyx_t_6); + index = 1; __pyx_t_4 = __pyx_t_10(__pyx_t_3); if (unlikely(!__pyx_t_4)) goto __pyx_L4_unpacking_failed; + __Pyx_GOTREF(__pyx_t_4); + if (__Pyx_IternextUnpackEndCheck(__pyx_t_10(__pyx_t_3), 2) < (0)) __PYX_ERR(0, 87, __pyx_L1_error) + __pyx_t_10 = NULL; + __Pyx_DECREF(__pyx_t_3); __pyx_t_3 = 0; + goto __pyx_L5_unpacking_done; + __pyx_L4_unpacking_failed:; + __Pyx_DECREF(__pyx_t_3); __pyx_t_3 = 0; + __pyx_t_10 = NULL; + if (__Pyx_IterFinish() == 0) __Pyx_RaiseNeedMoreValuesError(index); + __PYX_ERR(0, 87, __pyx_L1_error) + __pyx_L5_unpacking_done:; + } + __pyx_v_ner_ents = __pyx_t_6; + __pyx_t_6 = 0; + __pyx_v_ner_tags = __pyx_t_4; + __pyx_t_4 = 0; + + /* "spacy/pipeline/_parser_internals/ner.pyx":88 + * gs.nr_neg = len(negs) + * ner_ents, ner_tags = example.get_aligned_ents_and_ner() + * for i, ner_tag in enumerate(ner_tags): # <<<<<<<<<<<<<< + * gs.ner[i] = moves.lookup_transition(ner_tag) + * +*/ + __Pyx_INCREF(__pyx_mstate_global->__pyx_int_0); + __pyx_t_2 = __pyx_mstate_global->__pyx_int_0; + if (likely(PyList_CheckExact(__pyx_v_ner_tags)) || PyTuple_CheckExact(__pyx_v_ner_tags)) { + __pyx_t_4 = __pyx_v_ner_tags; __Pyx_INCREF(__pyx_t_4); + __pyx_t_9 = 0; + __pyx_t_11 = NULL; + } else { + __pyx_t_9 = -1; __pyx_t_4 = PyObject_GetIter(__pyx_v_ner_tags); if (unlikely(!__pyx_t_4)) __PYX_ERR(0, 88, __pyx_L1_error) + __Pyx_GOTREF(__pyx_t_4); + __pyx_t_11 = (CYTHON_COMPILING_IN_LIMITED_API) ? PyIter_Next : __Pyx_PyObject_GetIterNextFunc(__pyx_t_4); if (unlikely(!__pyx_t_11)) __PYX_ERR(0, 88, __pyx_L1_error) + } + for (;;) { + if (likely(!__pyx_t_11)) { + if (likely(PyList_CheckExact(__pyx_t_4))) { + { + Py_ssize_t __pyx_temp = __Pyx_PyList_GET_SIZE(__pyx_t_4); + #if !CYTHON_ASSUME_SAFE_SIZE + if (unlikely((__pyx_temp < 0))) __PYX_ERR(0, 88, __pyx_L1_error) + #endif + if (__pyx_t_9 >= __pyx_temp) break; + } + __pyx_t_6 = __Pyx_PyList_GetItemRefFast(__pyx_t_4, __pyx_t_9, __Pyx_ReferenceSharing_OwnStrongReference); + ++__pyx_t_9; + } else { + { + Py_ssize_t __pyx_temp = __Pyx_PyTuple_GET_SIZE(__pyx_t_4); + #if !CYTHON_ASSUME_SAFE_SIZE + if (unlikely((__pyx_temp < 0))) __PYX_ERR(0, 88, __pyx_L1_error) + #endif + if (__pyx_t_9 >= __pyx_temp) break; + } + #if CYTHON_ASSUME_SAFE_MACROS && !CYTHON_AVOID_BORROWED_REFS + __pyx_t_6 = __Pyx_NewRef(PyTuple_GET_ITEM(__pyx_t_4, __pyx_t_9)); + #else + __pyx_t_6 = __Pyx_PySequence_ITEM(__pyx_t_4, __pyx_t_9); + #endif + ++__pyx_t_9; + } + if (unlikely(!__pyx_t_6)) __PYX_ERR(0, 88, __pyx_L1_error) + } else { + __pyx_t_6 = __pyx_t_11(__pyx_t_4); + if (unlikely(!__pyx_t_6)) { + PyObject* exc_type = PyErr_Occurred(); + if (exc_type) { + if (unlikely(!__Pyx_PyErr_GivenExceptionMatches(exc_type, PyExc_StopIteration))) __PYX_ERR(0, 88, __pyx_L1_error) + PyErr_Clear(); + } + break; + } + } + __Pyx_GOTREF(__pyx_t_6); + __Pyx_XDECREF_SET(__pyx_v_ner_tag, __pyx_t_6); + __pyx_t_6 = 0; + __Pyx_INCREF(__pyx_t_2); + __Pyx_XDECREF_SET(__pyx_v_i, __pyx_t_2); + __pyx_t_6 = __Pyx_PyLong_AddObjC(__pyx_t_2, __pyx_mstate_global->__pyx_int_1, 1, 0, 0); if (unlikely(!__pyx_t_6)) __PYX_ERR(0, 88, __pyx_L1_error) + __Pyx_GOTREF(__pyx_t_6); + __Pyx_DECREF(__pyx_t_2); + __pyx_t_2 = __pyx_t_6; + __pyx_t_6 = 0; + + /* "spacy/pipeline/_parser_internals/ner.pyx":89 + * ner_ents, ner_tags = example.get_aligned_ents_and_ner() + * for i, ner_tag in enumerate(ner_tags): + * gs.ner[i] = moves.lookup_transition(ner_tag) # <<<<<<<<<<<<<< + * + * # Prevent conflicting spans in the data. For NER, spans are equal if they have the same offsets and label. +*/ + __pyx_t_12 = ((struct __pyx_vtabstruct_5spacy_8pipeline_17_parser_internals_3ner_BiluoPushDown *)__pyx_v_moves->__pyx_base.__pyx_vtab)->__pyx_base.lookup_transition(((struct __pyx_obj_5spacy_8pipeline_17_parser_internals_17transition_system_TransitionSystem *)__pyx_v_moves), __pyx_v_ner_tag); if (unlikely(PyErr_Occurred())) __PYX_ERR(0, 89, __pyx_L1_error) + __pyx_t_13 = __Pyx_PyIndex_AsSsize_t(__pyx_v_i); if (unlikely((__pyx_t_13 == (Py_ssize_t)-1) && PyErr_Occurred())) __PYX_ERR(0, 89, __pyx_L1_error) + (__pyx_v_gs.ner[__pyx_t_13]) = __pyx_t_12; + + /* "spacy/pipeline/_parser_internals/ner.pyx":88 + * gs.nr_neg = len(negs) + * ner_ents, ner_tags = example.get_aligned_ents_and_ner() + * for i, ner_tag in enumerate(ner_tags): # <<<<<<<<<<<<<< + * gs.ner[i] = moves.lookup_transition(ner_tag) + * +*/ + } + __Pyx_DECREF(__pyx_t_4); __pyx_t_4 = 0; + __Pyx_DECREF(__pyx_t_2); __pyx_t_2 = 0; + + /* "spacy/pipeline/_parser_internals/ner.pyx":92 + * + * # Prevent conflicting spans in the data. For NER, spans are equal if they have the same offsets and label. + * neg_span_triples = {(neg_ent.start_char, neg_ent.end_char, neg_ent.label) for neg_ent in negs} # <<<<<<<<<<<<<< + * for pos_span in ner_ents: + * if (pos_span.start_char, pos_span.end_char, pos_span.label) in neg_span_triples: +*/ + { /* enter inner scope */ + __pyx_t_2 = PySet_New(NULL); if (unlikely(!__pyx_t_2)) __PYX_ERR(0, 92, __pyx_L11_error) + __Pyx_GOTREF(__pyx_t_2); + if (likely(PyList_CheckExact(__pyx_v_negs)) || PyTuple_CheckExact(__pyx_v_negs)) { + __pyx_t_4 = __pyx_v_negs; __Pyx_INCREF(__pyx_t_4); + __pyx_t_9 = 0; + __pyx_t_11 = NULL; + } else { + __pyx_t_9 = -1; __pyx_t_4 = PyObject_GetIter(__pyx_v_negs); if (unlikely(!__pyx_t_4)) __PYX_ERR(0, 92, __pyx_L11_error) + __Pyx_GOTREF(__pyx_t_4); + __pyx_t_11 = (CYTHON_COMPILING_IN_LIMITED_API) ? PyIter_Next : __Pyx_PyObject_GetIterNextFunc(__pyx_t_4); if (unlikely(!__pyx_t_11)) __PYX_ERR(0, 92, __pyx_L11_error) + } + for (;;) { + if (likely(!__pyx_t_11)) { + if (likely(PyList_CheckExact(__pyx_t_4))) { + { + Py_ssize_t __pyx_temp = __Pyx_PyList_GET_SIZE(__pyx_t_4); + #if !CYTHON_ASSUME_SAFE_SIZE + if (unlikely((__pyx_temp < 0))) __PYX_ERR(0, 92, __pyx_L11_error) + #endif + if (__pyx_t_9 >= __pyx_temp) break; + } + __pyx_t_6 = __Pyx_PyList_GetItemRefFast(__pyx_t_4, __pyx_t_9, __Pyx_ReferenceSharing_OwnStrongReference); + ++__pyx_t_9; + } else { + { + Py_ssize_t __pyx_temp = __Pyx_PyTuple_GET_SIZE(__pyx_t_4); + #if !CYTHON_ASSUME_SAFE_SIZE + if (unlikely((__pyx_temp < 0))) __PYX_ERR(0, 92, __pyx_L11_error) + #endif + if (__pyx_t_9 >= __pyx_temp) break; + } + #if CYTHON_ASSUME_SAFE_MACROS && !CYTHON_AVOID_BORROWED_REFS + __pyx_t_6 = __Pyx_NewRef(PyTuple_GET_ITEM(__pyx_t_4, __pyx_t_9)); + #else + __pyx_t_6 = __Pyx_PySequence_ITEM(__pyx_t_4, __pyx_t_9); + #endif + ++__pyx_t_9; + } + if (unlikely(!__pyx_t_6)) __PYX_ERR(0, 92, __pyx_L11_error) + } else { + __pyx_t_6 = __pyx_t_11(__pyx_t_4); + if (unlikely(!__pyx_t_6)) { + PyObject* exc_type = PyErr_Occurred(); + if (exc_type) { + if (unlikely(!__Pyx_PyErr_GivenExceptionMatches(exc_type, PyExc_StopIteration))) __PYX_ERR(0, 92, __pyx_L11_error) + PyErr_Clear(); + } + break; + } + } + __Pyx_GOTREF(__pyx_t_6); + __Pyx_XDECREF_SET(__pyx_7genexpr__pyx_v_neg_ent, __pyx_t_6); + __pyx_t_6 = 0; + __pyx_t_6 = __Pyx_PyObject_GetAttrStr(__pyx_7genexpr__pyx_v_neg_ent, __pyx_mstate_global->__pyx_n_u_start_char); if (unlikely(!__pyx_t_6)) __PYX_ERR(0, 92, __pyx_L11_error) + __Pyx_GOTREF(__pyx_t_6); + __pyx_t_3 = __Pyx_PyObject_GetAttrStr(__pyx_7genexpr__pyx_v_neg_ent, __pyx_mstate_global->__pyx_n_u_end_char); if (unlikely(!__pyx_t_3)) __PYX_ERR(0, 92, __pyx_L11_error) + __Pyx_GOTREF(__pyx_t_3); + __pyx_t_5 = __Pyx_PyObject_GetAttrStr(__pyx_7genexpr__pyx_v_neg_ent, __pyx_mstate_global->__pyx_n_u_label); if (unlikely(!__pyx_t_5)) __PYX_ERR(0, 92, __pyx_L11_error) + __Pyx_GOTREF(__pyx_t_5); + __pyx_t_14 = PyTuple_New(3); if (unlikely(!__pyx_t_14)) __PYX_ERR(0, 92, __pyx_L11_error) + __Pyx_GOTREF(__pyx_t_14); + __Pyx_GIVEREF(__pyx_t_6); + if (__Pyx_PyTuple_SET_ITEM(__pyx_t_14, 0, __pyx_t_6) != (0)) __PYX_ERR(0, 92, __pyx_L11_error); + __Pyx_GIVEREF(__pyx_t_3); + if (__Pyx_PyTuple_SET_ITEM(__pyx_t_14, 1, __pyx_t_3) != (0)) __PYX_ERR(0, 92, __pyx_L11_error); + __Pyx_GIVEREF(__pyx_t_5); + if (__Pyx_PyTuple_SET_ITEM(__pyx_t_14, 2, __pyx_t_5) != (0)) __PYX_ERR(0, 92, __pyx_L11_error); + __pyx_t_6 = 0; + __pyx_t_3 = 0; + __pyx_t_5 = 0; + if (unlikely(PySet_Add(__pyx_t_2, (PyObject*)__pyx_t_14))) __PYX_ERR(0, 92, __pyx_L11_error) + __Pyx_DECREF(__pyx_t_14); __pyx_t_14 = 0; + } + __Pyx_DECREF(__pyx_t_4); __pyx_t_4 = 0; + __Pyx_XDECREF(__pyx_7genexpr__pyx_v_neg_ent); __pyx_7genexpr__pyx_v_neg_ent = 0; + goto __pyx_L15_exit_scope; + __pyx_L11_error:; + __Pyx_XDECREF(__pyx_7genexpr__pyx_v_neg_ent); __pyx_7genexpr__pyx_v_neg_ent = 0; + goto __pyx_L1_error; + __pyx_L15_exit_scope:; + } /* exit inner scope */ + __pyx_v_neg_span_triples = ((PyObject*)__pyx_t_2); + __pyx_t_2 = 0; + + /* "spacy/pipeline/_parser_internals/ner.pyx":93 + * # Prevent conflicting spans in the data. For NER, spans are equal if they have the same offsets and label. + * neg_span_triples = {(neg_ent.start_char, neg_ent.end_char, neg_ent.label) for neg_ent in negs} + * for pos_span in ner_ents: # <<<<<<<<<<<<<< + * if (pos_span.start_char, pos_span.end_char, pos_span.label) in neg_span_triples: + * raise ValueError(Errors.E868.format(span=(pos_span.start_char, pos_span.end_char, pos_span.label_))) +*/ + if (likely(PyList_CheckExact(__pyx_v_ner_ents)) || PyTuple_CheckExact(__pyx_v_ner_ents)) { + __pyx_t_2 = __pyx_v_ner_ents; __Pyx_INCREF(__pyx_t_2); + __pyx_t_9 = 0; + __pyx_t_11 = NULL; + } else { + __pyx_t_9 = -1; __pyx_t_2 = PyObject_GetIter(__pyx_v_ner_ents); if (unlikely(!__pyx_t_2)) __PYX_ERR(0, 93, __pyx_L1_error) + __Pyx_GOTREF(__pyx_t_2); + __pyx_t_11 = (CYTHON_COMPILING_IN_LIMITED_API) ? PyIter_Next : __Pyx_PyObject_GetIterNextFunc(__pyx_t_2); if (unlikely(!__pyx_t_11)) __PYX_ERR(0, 93, __pyx_L1_error) + } + for (;;) { + if (likely(!__pyx_t_11)) { + if (likely(PyList_CheckExact(__pyx_t_2))) { + { + Py_ssize_t __pyx_temp = __Pyx_PyList_GET_SIZE(__pyx_t_2); + #if !CYTHON_ASSUME_SAFE_SIZE + if (unlikely((__pyx_temp < 0))) __PYX_ERR(0, 93, __pyx_L1_error) + #endif + if (__pyx_t_9 >= __pyx_temp) break; + } + __pyx_t_4 = __Pyx_PyList_GetItemRefFast(__pyx_t_2, __pyx_t_9, __Pyx_ReferenceSharing_OwnStrongReference); + ++__pyx_t_9; + } else { + { + Py_ssize_t __pyx_temp = __Pyx_PyTuple_GET_SIZE(__pyx_t_2); + #if !CYTHON_ASSUME_SAFE_SIZE + if (unlikely((__pyx_temp < 0))) __PYX_ERR(0, 93, __pyx_L1_error) + #endif + if (__pyx_t_9 >= __pyx_temp) break; + } + #if CYTHON_ASSUME_SAFE_MACROS && !CYTHON_AVOID_BORROWED_REFS + __pyx_t_4 = __Pyx_NewRef(PyTuple_GET_ITEM(__pyx_t_2, __pyx_t_9)); + #else + __pyx_t_4 = __Pyx_PySequence_ITEM(__pyx_t_2, __pyx_t_9); + #endif + ++__pyx_t_9; + } + if (unlikely(!__pyx_t_4)) __PYX_ERR(0, 93, __pyx_L1_error) + } else { + __pyx_t_4 = __pyx_t_11(__pyx_t_2); + if (unlikely(!__pyx_t_4)) { + PyObject* exc_type = PyErr_Occurred(); + if (exc_type) { + if (unlikely(!__Pyx_PyErr_GivenExceptionMatches(exc_type, PyExc_StopIteration))) __PYX_ERR(0, 93, __pyx_L1_error) + PyErr_Clear(); + } + break; + } + } + __Pyx_GOTREF(__pyx_t_4); + __Pyx_XDECREF_SET(__pyx_v_pos_span, __pyx_t_4); + __pyx_t_4 = 0; + + /* "spacy/pipeline/_parser_internals/ner.pyx":94 + * neg_span_triples = {(neg_ent.start_char, neg_ent.end_char, neg_ent.label) for neg_ent in negs} + * for pos_span in ner_ents: + * if (pos_span.start_char, pos_span.end_char, pos_span.label) in neg_span_triples: # <<<<<<<<<<<<<< + * raise ValueError(Errors.E868.format(span=(pos_span.start_char, pos_span.end_char, pos_span.label_))) + * +*/ + __pyx_t_4 = __Pyx_PyObject_GetAttrStr(__pyx_v_pos_span, __pyx_mstate_global->__pyx_n_u_start_char); if (unlikely(!__pyx_t_4)) __PYX_ERR(0, 94, __pyx_L1_error) + __Pyx_GOTREF(__pyx_t_4); + __pyx_t_14 = __Pyx_PyObject_GetAttrStr(__pyx_v_pos_span, __pyx_mstate_global->__pyx_n_u_end_char); if (unlikely(!__pyx_t_14)) __PYX_ERR(0, 94, __pyx_L1_error) + __Pyx_GOTREF(__pyx_t_14); + __pyx_t_5 = __Pyx_PyObject_GetAttrStr(__pyx_v_pos_span, __pyx_mstate_global->__pyx_n_u_label); if (unlikely(!__pyx_t_5)) __PYX_ERR(0, 94, __pyx_L1_error) + __Pyx_GOTREF(__pyx_t_5); + __pyx_t_3 = PyTuple_New(3); if (unlikely(!__pyx_t_3)) __PYX_ERR(0, 94, __pyx_L1_error) + __Pyx_GOTREF(__pyx_t_3); + __Pyx_GIVEREF(__pyx_t_4); + if (__Pyx_PyTuple_SET_ITEM(__pyx_t_3, 0, __pyx_t_4) != (0)) __PYX_ERR(0, 94, __pyx_L1_error); + __Pyx_GIVEREF(__pyx_t_14); + if (__Pyx_PyTuple_SET_ITEM(__pyx_t_3, 1, __pyx_t_14) != (0)) __PYX_ERR(0, 94, __pyx_L1_error); + __Pyx_GIVEREF(__pyx_t_5); + if (__Pyx_PyTuple_SET_ITEM(__pyx_t_3, 2, __pyx_t_5) != (0)) __PYX_ERR(0, 94, __pyx_L1_error); + __pyx_t_4 = 0; + __pyx_t_14 = 0; + __pyx_t_5 = 0; + __pyx_t_1 = (__Pyx_PySet_ContainsTF(__pyx_t_3, __pyx_v_neg_span_triples, Py_EQ)); if (unlikely((__pyx_t_1 < 0))) __PYX_ERR(0, 94, __pyx_L1_error) + __Pyx_DECREF(__pyx_t_3); __pyx_t_3 = 0; + if (unlikely(__pyx_t_1)) { + + /* "spacy/pipeline/_parser_internals/ner.pyx":95 + * for pos_span in ner_ents: + * if (pos_span.start_char, pos_span.end_char, pos_span.label) in neg_span_triples: + * raise ValueError(Errors.E868.format(span=(pos_span.start_char, pos_span.end_char, pos_span.label_))) # <<<<<<<<<<<<<< + * + * # In order to handle negative samples, we need to maintain the full +*/ + __pyx_t_5 = NULL; + __Pyx_GetModuleGlobalName(__pyx_t_6, __pyx_mstate_global->__pyx_n_u_Errors); if (unlikely(!__pyx_t_6)) __PYX_ERR(0, 95, __pyx_L1_error) + __Pyx_GOTREF(__pyx_t_6); + __pyx_t_15 = __Pyx_PyObject_GetAttrStr(__pyx_t_6, __pyx_mstate_global->__pyx_n_u_E868); if (unlikely(!__pyx_t_15)) __PYX_ERR(0, 95, __pyx_L1_error) + __Pyx_GOTREF(__pyx_t_15); + __Pyx_DECREF(__pyx_t_6); __pyx_t_6 = 0; + __pyx_t_4 = __pyx_t_15; + __Pyx_INCREF(__pyx_t_4); + __pyx_t_6 = __Pyx_PyObject_GetAttrStr(__pyx_v_pos_span, __pyx_mstate_global->__pyx_n_u_start_char); if (unlikely(!__pyx_t_6)) __PYX_ERR(0, 95, __pyx_L1_error) + __Pyx_GOTREF(__pyx_t_6); + __pyx_t_16 = __Pyx_PyObject_GetAttrStr(__pyx_v_pos_span, __pyx_mstate_global->__pyx_n_u_end_char); if (unlikely(!__pyx_t_16)) __PYX_ERR(0, 95, __pyx_L1_error) + __Pyx_GOTREF(__pyx_t_16); + __pyx_t_17 = __Pyx_PyObject_GetAttrStr(__pyx_v_pos_span, __pyx_mstate_global->__pyx_n_u_label_2); if (unlikely(!__pyx_t_17)) __PYX_ERR(0, 95, __pyx_L1_error) + __Pyx_GOTREF(__pyx_t_17); + __pyx_t_18 = PyTuple_New(3); if (unlikely(!__pyx_t_18)) __PYX_ERR(0, 95, __pyx_L1_error) + __Pyx_GOTREF(__pyx_t_18); + __Pyx_GIVEREF(__pyx_t_6); + if (__Pyx_PyTuple_SET_ITEM(__pyx_t_18, 0, __pyx_t_6) != (0)) __PYX_ERR(0, 95, __pyx_L1_error); + __Pyx_GIVEREF(__pyx_t_16); + if (__Pyx_PyTuple_SET_ITEM(__pyx_t_18, 1, __pyx_t_16) != (0)) __PYX_ERR(0, 95, __pyx_L1_error); + __Pyx_GIVEREF(__pyx_t_17); + if (__Pyx_PyTuple_SET_ITEM(__pyx_t_18, 2, __pyx_t_17) != (0)) __PYX_ERR(0, 95, __pyx_L1_error); + __pyx_t_6 = 0; + __pyx_t_16 = 0; + __pyx_t_17 = 0; + __pyx_t_7 = 0; + { + PyObject *__pyx_callargs[2 + ((CYTHON_VECTORCALL) ? 1 : 0)] = {__pyx_t_4, NULL}; + __pyx_t_17 = __Pyx_MakeVectorcallBuilderKwds(1); if (unlikely(!__pyx_t_17)) __PYX_ERR(0, 95, __pyx_L1_error) + __Pyx_GOTREF(__pyx_t_17); + if (__Pyx_VectorcallBuilder_AddArg(__pyx_mstate_global->__pyx_n_u_span, __pyx_t_18, __pyx_t_17, __pyx_callargs+1, 0) < (0)) __PYX_ERR(0, 95, __pyx_L1_error) + __pyx_t_14 = __Pyx_Object_VectorcallMethod_CallFromBuilder((PyObject*)__pyx_mstate_global->__pyx_n_u_format, __pyx_callargs+__pyx_t_7, (1-__pyx_t_7) | (1*__Pyx_PY_VECTORCALL_ARGUMENTS_OFFSET), __pyx_t_17); + __Pyx_XDECREF(__pyx_t_4); __pyx_t_4 = 0; + __Pyx_DECREF(__pyx_t_18); __pyx_t_18 = 0; + __Pyx_DECREF(__pyx_t_17); __pyx_t_17 = 0; + __Pyx_DECREF(__pyx_t_15); __pyx_t_15 = 0; + if (unlikely(!__pyx_t_14)) __PYX_ERR(0, 95, __pyx_L1_error) + __Pyx_GOTREF(__pyx_t_14); + } + __pyx_t_7 = 1; + { + PyObject *__pyx_callargs[2] = {__pyx_t_5, __pyx_t_14}; + __pyx_t_3 = __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_5); __pyx_t_5 = 0; + __Pyx_DECREF(__pyx_t_14); __pyx_t_14 = 0; + if (unlikely(!__pyx_t_3)) __PYX_ERR(0, 95, __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, 95, __pyx_L1_error) + + /* "spacy/pipeline/_parser_internals/ner.pyx":94 + * neg_span_triples = {(neg_ent.start_char, neg_ent.end_char, neg_ent.label) for neg_ent in negs} + * for pos_span in ner_ents: + * if (pos_span.start_char, pos_span.end_char, pos_span.label) in neg_span_triples: # <<<<<<<<<<<<<< + * raise ValueError(Errors.E868.format(span=(pos_span.start_char, pos_span.end_char, pos_span.label_))) + * +*/ + } + + /* "spacy/pipeline/_parser_internals/ner.pyx":93 + * # Prevent conflicting spans in the data. For NER, spans are equal if they have the same offsets and label. + * neg_span_triples = {(neg_ent.start_char, neg_ent.end_char, neg_ent.label) for neg_ent in negs} + * for pos_span in ner_ents: # <<<<<<<<<<<<<< + * if (pos_span.start_char, pos_span.end_char, pos_span.label) in neg_span_triples: + * raise ValueError(Errors.E868.format(span=(pos_span.start_char, pos_span.end_char, pos_span.label_))) +*/ + } + __Pyx_DECREF(__pyx_t_2); __pyx_t_2 = 0; + + /* "spacy/pipeline/_parser_internals/ner.pyx":100 + * # (start, end, label) triple. If we break it down to the 'isnt B-LOC' + * # thing, we'll get blocked if there's an incorrect prefix. + * for i, neg in enumerate(negs): # <<<<<<<<<<<<<< + * gs.negs[i] = neg.c + * return gs +*/ + __Pyx_INCREF(__pyx_mstate_global->__pyx_int_0); + __pyx_t_2 = __pyx_mstate_global->__pyx_int_0; + if (likely(PyList_CheckExact(__pyx_v_negs)) || PyTuple_CheckExact(__pyx_v_negs)) { + __pyx_t_3 = __pyx_v_negs; __Pyx_INCREF(__pyx_t_3); + __pyx_t_9 = 0; + __pyx_t_11 = NULL; + } else { + __pyx_t_9 = -1; __pyx_t_3 = PyObject_GetIter(__pyx_v_negs); if (unlikely(!__pyx_t_3)) __PYX_ERR(0, 100, __pyx_L1_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, 100, __pyx_L1_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, 100, __pyx_L1_error) + #endif + if (__pyx_t_9 >= __pyx_temp) break; + } + __pyx_t_14 = __Pyx_PyList_GetItemRefFast(__pyx_t_3, __pyx_t_9, __Pyx_ReferenceSharing_OwnStrongReference); + ++__pyx_t_9; + } 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, 100, __pyx_L1_error) + #endif + if (__pyx_t_9 >= __pyx_temp) break; + } + #if CYTHON_ASSUME_SAFE_MACROS && !CYTHON_AVOID_BORROWED_REFS + __pyx_t_14 = __Pyx_NewRef(PyTuple_GET_ITEM(__pyx_t_3, __pyx_t_9)); + #else + __pyx_t_14 = __Pyx_PySequence_ITEM(__pyx_t_3, __pyx_t_9); + #endif + ++__pyx_t_9; + } + if (unlikely(!__pyx_t_14)) __PYX_ERR(0, 100, __pyx_L1_error) + } else { + __pyx_t_14 = __pyx_t_11(__pyx_t_3); + if (unlikely(!__pyx_t_14)) { + PyObject* exc_type = PyErr_Occurred(); + if (exc_type) { + if (unlikely(!__Pyx_PyErr_GivenExceptionMatches(exc_type, PyExc_StopIteration))) __PYX_ERR(0, 100, __pyx_L1_error) + PyErr_Clear(); + } + break; + } + } + __Pyx_GOTREF(__pyx_t_14); + if (!(likely(((__pyx_t_14) == Py_None) || likely(__Pyx_TypeTest(__pyx_t_14, __pyx_mstate_global->__pyx_ptype_5spacy_6tokens_4span_Span))))) __PYX_ERR(0, 100, __pyx_L1_error) + __Pyx_XDECREF_SET(__pyx_v_neg, ((struct __pyx_obj_5spacy_6tokens_4span_Span *)__pyx_t_14)); + __pyx_t_14 = 0; + __Pyx_INCREF(__pyx_t_2); + __Pyx_XDECREF_SET(__pyx_v_i, __pyx_t_2); + __pyx_t_14 = __Pyx_PyLong_AddObjC(__pyx_t_2, __pyx_mstate_global->__pyx_int_1, 1, 0, 0); if (unlikely(!__pyx_t_14)) __PYX_ERR(0, 100, __pyx_L1_error) + __Pyx_GOTREF(__pyx_t_14); + __Pyx_DECREF(__pyx_t_2); + __pyx_t_2 = __pyx_t_14; + __pyx_t_14 = 0; + + /* "spacy/pipeline/_parser_internals/ner.pyx":101 + * # thing, we'll get blocked if there's an incorrect prefix. + * for i, neg in enumerate(negs): + * gs.negs[i] = neg.c # <<<<<<<<<<<<<< + * return gs + * +*/ + __pyx_t_19 = __pyx_v_neg->c; + __pyx_t_13 = __Pyx_PyIndex_AsSsize_t(__pyx_v_i); if (unlikely((__pyx_t_13 == (Py_ssize_t)-1) && PyErr_Occurred())) __PYX_ERR(0, 101, __pyx_L1_error) + (__pyx_v_gs.negs[__pyx_t_13]) = __pyx_t_19; + + /* "spacy/pipeline/_parser_internals/ner.pyx":100 + * # (start, end, label) triple. If we break it down to the 'isnt B-LOC' + * # thing, we'll get blocked if there's an incorrect prefix. + * for i, neg in enumerate(negs): # <<<<<<<<<<<<<< + * gs.negs[i] = neg.c + * return gs +*/ + } + __Pyx_DECREF(__pyx_t_3); __pyx_t_3 = 0; + __Pyx_DECREF(__pyx_t_2); __pyx_t_2 = 0; + + /* "spacy/pipeline/_parser_internals/ner.pyx":102 + * for i, neg in enumerate(negs): + * gs.negs[i] = neg.c + * return gs # <<<<<<<<<<<<<< + * + * +*/ + __pyx_r = __pyx_v_gs; + goto __pyx_L0; + + /* "spacy/pipeline/_parser_internals/ner.pyx":67 + * + * + * cdef GoldNERStateC create_gold_state( # <<<<<<<<<<<<<< + * Pool mem, + * BiluoPushDown moves, +*/ + + /* function exit code */ + __pyx_L1_error:; + __Pyx_XDECREF(__pyx_t_2); + __Pyx_XDECREF(__pyx_t_3); + __Pyx_XDECREF(__pyx_t_4); + __Pyx_XDECREF(__pyx_t_5); + __Pyx_XDECREF(__pyx_t_6); + __Pyx_XDECREF(__pyx_t_14); + __Pyx_XDECREF(__pyx_t_15); + __Pyx_XDECREF(__pyx_t_16); + __Pyx_XDECREF(__pyx_t_17); + __Pyx_XDECREF(__pyx_t_18); + __Pyx_AddTraceback("spacy.pipeline._parser_internals.ner.create_gold_state", __pyx_clineno, __pyx_lineno, __pyx_filename); + __Pyx_pretend_to_initialize(&__pyx_r); + __pyx_L0:; + __Pyx_XDECREF((PyObject *)__pyx_v_neg); + __Pyx_XDECREF(__pyx_v_negs); + __Pyx_XDECREF(__pyx_v_ner_ents); + __Pyx_XDECREF(__pyx_v_ner_tags); + __Pyx_XDECREF(__pyx_v_i); + __Pyx_XDECREF(__pyx_v_ner_tag); + __Pyx_XDECREF(__pyx_v_neg_span_triples); + __Pyx_XDECREF(__pyx_v_pos_span); + __Pyx_XDECREF(__pyx_7genexpr__pyx_v_neg_ent); + __Pyx_RefNannyFinishContext(); + return __pyx_r; +} + +/* "spacy/pipeline/_parser_internals/ner.pyx":105 + * + * + * cdef void update_gold_state(GoldNERStateC* gs, const StateC* state) except *: # <<<<<<<<<<<<<< + * # We don't need to update each time, unlike the parser. + * pass +*/ + +static void __pyx_f_5spacy_8pipeline_17_parser_internals_3ner_update_gold_state(CYTHON_UNUSED struct __pyx_t_5spacy_8pipeline_17_parser_internals_3ner_GoldNERStateC *__pyx_v_gs, CYTHON_UNUSED __pyx_t_5spacy_8pipeline_17_parser_internals_6_state_StateC const *__pyx_v_state) { + + /* function exit code */ +} + +/* "spacy/pipeline/_parser_internals/ner.pyx":113 + * + * + * cdef bint _entity_is_sunk(const StateC* state, Transition* golds) noexcept nogil: # <<<<<<<<<<<<<< + * if not state.entity_is_open(): + * return False +*/ + +static int __pyx_f_5spacy_8pipeline_17_parser_internals_3ner__entity_is_sunk(__pyx_t_5spacy_8pipeline_17_parser_internals_6_state_StateC const *__pyx_v_state, struct __pyx_t_5spacy_8pipeline_17_parser_internals_17transition_system_Transition *__pyx_v_golds) { + struct __pyx_t_5spacy_8pipeline_17_parser_internals_17transition_system_Transition const *__pyx_v_gold; + struct __pyx_t_5spacy_7structs_SpanC __pyx_v_ent; + int __pyx_r; + int __pyx_t_1; + + /* "spacy/pipeline/_parser_internals/ner.pyx":114 + * + * cdef bint _entity_is_sunk(const StateC* state, Transition* golds) noexcept nogil: + * if not state.entity_is_open(): # <<<<<<<<<<<<<< + * return False + * +*/ + __pyx_t_1 = (!__pyx_v_state->entity_is_open()); + if (__pyx_t_1) { + + /* "spacy/pipeline/_parser_internals/ner.pyx":115 + * cdef bint _entity_is_sunk(const StateC* state, Transition* golds) noexcept nogil: + * if not state.entity_is_open(): + * return False # <<<<<<<<<<<<<< + * + * cdef const Transition* gold = &golds[state.E(0)] +*/ + __pyx_r = 0; + goto __pyx_L0; + + /* "spacy/pipeline/_parser_internals/ner.pyx":114 + * + * cdef bint _entity_is_sunk(const StateC* state, Transition* golds) noexcept nogil: + * if not state.entity_is_open(): # <<<<<<<<<<<<<< + * return False + * +*/ + } + + /* "spacy/pipeline/_parser_internals/ner.pyx":117 + * return False + * + * cdef const Transition* gold = &golds[state.E(0)] # <<<<<<<<<<<<<< + * ent = state.get_ent() + * if gold.move != BEGIN and gold.move != UNIT: +*/ + __pyx_v_gold = (&(__pyx_v_golds[__pyx_v_state->E(0)])); + + /* "spacy/pipeline/_parser_internals/ner.pyx":118 + * + * cdef const Transition* gold = &golds[state.E(0)] + * ent = state.get_ent() # <<<<<<<<<<<<<< + * if gold.move != BEGIN and gold.move != UNIT: + * return True +*/ + __pyx_v_ent = __pyx_v_state->get_ent(); + + /* "spacy/pipeline/_parser_internals/ner.pyx":119 + * cdef const Transition* gold = &golds[state.E(0)] + * ent = state.get_ent() + * if gold.move != BEGIN and gold.move != UNIT: # <<<<<<<<<<<<<< + * return True + * elif gold.label != ent.label: +*/ + switch (__pyx_v_gold->move) { + case __pyx_e_5spacy_8pipeline_17_parser_internals_3ner_BEGIN: + case __pyx_e_5spacy_8pipeline_17_parser_internals_3ner_UNIT: + __pyx_t_1 = 0; + break; + default: + __pyx_t_1 = 1; + break; + } + if (__pyx_t_1) { + + /* "spacy/pipeline/_parser_internals/ner.pyx":120 + * ent = state.get_ent() + * if gold.move != BEGIN and gold.move != UNIT: + * return True # <<<<<<<<<<<<<< + * elif gold.label != ent.label: + * return True +*/ + __pyx_r = 1; + goto __pyx_L0; + + /* "spacy/pipeline/_parser_internals/ner.pyx":119 + * cdef const Transition* gold = &golds[state.E(0)] + * ent = state.get_ent() + * if gold.move != BEGIN and gold.move != UNIT: # <<<<<<<<<<<<<< + * return True + * elif gold.label != ent.label: +*/ + } + + /* "spacy/pipeline/_parser_internals/ner.pyx":121 + * if gold.move != BEGIN and gold.move != UNIT: + * return True + * elif gold.label != ent.label: # <<<<<<<<<<<<<< + * return True + * else: +*/ + __pyx_t_1 = (__pyx_v_gold->label != __pyx_v_ent.label); + if (__pyx_t_1) { + + /* "spacy/pipeline/_parser_internals/ner.pyx":122 + * return True + * elif gold.label != ent.label: + * return True # <<<<<<<<<<<<<< + * else: + * return False +*/ + __pyx_r = 1; + goto __pyx_L0; + + /* "spacy/pipeline/_parser_internals/ner.pyx":121 + * if gold.move != BEGIN and gold.move != UNIT: + * return True + * elif gold.label != ent.label: # <<<<<<<<<<<<<< + * return True + * else: +*/ + } + + /* "spacy/pipeline/_parser_internals/ner.pyx":124 + * return True + * else: + * return False # <<<<<<<<<<<<<< + * + * +*/ + /*else*/ { + __pyx_r = 0; + goto __pyx_L0; + } + + /* "spacy/pipeline/_parser_internals/ner.pyx":113 + * + * + * cdef bint _entity_is_sunk(const StateC* state, Transition* golds) noexcept nogil: # <<<<<<<<<<<<<< + * if not state.entity_is_open(): + * return False +*/ + + /* function exit code */ + __pyx_L0:; + return __pyx_r; +} + +/* "spacy/pipeline/_parser_internals/ner.pyx":128 + * + * cdef class BiluoPushDown(TransitionSystem): + * def __init__(self, *args, **kwargs): # <<<<<<<<<<<<<< + * TransitionSystem.__init__(self, *args, **kwargs) + * +*/ + +/* Python wrapper */ +static int __pyx_pw_5spacy_8pipeline_17_parser_internals_3ner_13BiluoPushDown_1__init__(PyObject *__pyx_v_self, PyObject *__pyx_args, PyObject *__pyx_kwds); /*proto*/ +static int __pyx_pw_5spacy_8pipeline_17_parser_internals_3ner_13BiluoPushDown_1__init__(PyObject *__pyx_v_self, PyObject *__pyx_args, PyObject *__pyx_kwds) { + PyObject *__pyx_v_args = 0; + PyObject *__pyx_v_kwargs = 0; + CYTHON_UNUSED Py_ssize_t __pyx_nargs; + CYTHON_UNUSED PyObject *const *__pyx_kwvalues; + 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); + const Py_ssize_t __pyx_kwds_len = (__pyx_kwds) ? __Pyx_NumKwargs_VARARGS(__pyx_kwds) : 0; + if (unlikely(__pyx_kwds_len < 0)) return -1; + if (__pyx_kwds_len > 0) { + if (unlikely(__Pyx_CheckKeywordStrings("__init__", __pyx_kwds) == -1)) return -1; + __pyx_v_kwargs = __Pyx_KwargsAsDict_VARARGS(__pyx_kwds, __pyx_kwvalues); + if (unlikely(!__pyx_v_kwargs)) return -1; + __Pyx_GOTREF(__pyx_v_kwargs); + } else { + __pyx_v_kwargs = PyDict_New(); + if (unlikely(!__pyx_v_kwargs)) return -1; + __Pyx_GOTREF(__pyx_v_kwargs); + } + __Pyx_INCREF(__pyx_args); + __pyx_v_args = __pyx_args; + __pyx_r = __pyx_pf_5spacy_8pipeline_17_parser_internals_3ner_13BiluoPushDown___init__(((struct __pyx_obj_5spacy_8pipeline_17_parser_internals_3ner_BiluoPushDown *)__pyx_v_self), __pyx_v_args, __pyx_v_kwargs); + + /* function exit code */ + __Pyx_DECREF(__pyx_v_args); + __Pyx_DECREF(__pyx_v_kwargs); + __Pyx_RefNannyFinishContext(); + return __pyx_r; +} + +static int __pyx_pf_5spacy_8pipeline_17_parser_internals_3ner_13BiluoPushDown___init__(struct __pyx_obj_5spacy_8pipeline_17_parser_internals_3ner_BiluoPushDown *__pyx_v_self, PyObject *__pyx_v_args, PyObject *__pyx_v_kwargs) { + 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; + int __pyx_lineno = 0; + const char *__pyx_filename = NULL; + int __pyx_clineno = 0; + __Pyx_RefNannySetupContext("__init__", 0); + + /* "spacy/pipeline/_parser_internals/ner.pyx":129 + * cdef class BiluoPushDown(TransitionSystem): + * def __init__(self, *args, **kwargs): + * TransitionSystem.__init__(self, *args, **kwargs) # <<<<<<<<<<<<<< + * + * @classmethod +*/ + __pyx_t_1 = __Pyx_PyObject_GetAttrStr(((PyObject *)__pyx_mstate_global->__pyx_ptype_5spacy_8pipeline_17_parser_internals_17transition_system_TransitionSystem), __pyx_mstate_global->__pyx_n_u_init); if (unlikely(!__pyx_t_1)) __PYX_ERR(0, 129, __pyx_L1_error) + __Pyx_GOTREF(__pyx_t_1); + __pyx_t_2 = PyTuple_New(1); if (unlikely(!__pyx_t_2)) __PYX_ERR(0, 129, __pyx_L1_error) + __Pyx_GOTREF(__pyx_t_2); + __Pyx_INCREF((PyObject *)__pyx_v_self); + __Pyx_GIVEREF((PyObject *)__pyx_v_self); + if (__Pyx_PyTuple_SET_ITEM(__pyx_t_2, 0, ((PyObject *)__pyx_v_self)) != (0)) __PYX_ERR(0, 129, __pyx_L1_error); + __pyx_t_3 = PyNumber_Add(__pyx_t_2, __pyx_v_args); if (unlikely(!__pyx_t_3)) __PYX_ERR(0, 129, __pyx_L1_error) + __Pyx_GOTREF(__pyx_t_3); + __Pyx_DECREF(__pyx_t_2); __pyx_t_2 = 0; + __pyx_t_2 = PyDict_Copy(__pyx_v_kwargs); if (unlikely(!__pyx_t_2)) __PYX_ERR(0, 129, __pyx_L1_error) + __Pyx_GOTREF(__pyx_t_2); + __pyx_t_4 = __Pyx_PyObject_Call(__pyx_t_1, __pyx_t_3, __pyx_t_2); if (unlikely(!__pyx_t_4)) __PYX_ERR(0, 129, __pyx_L1_error) + __Pyx_GOTREF(__pyx_t_4); + __Pyx_DECREF(__pyx_t_1); __pyx_t_1 = 0; + __Pyx_DECREF(__pyx_t_3); __pyx_t_3 = 0; + __Pyx_DECREF(__pyx_t_2); __pyx_t_2 = 0; + __Pyx_DECREF(__pyx_t_4); __pyx_t_4 = 0; + + /* "spacy/pipeline/_parser_internals/ner.pyx":128 + * + * cdef class BiluoPushDown(TransitionSystem): + * def __init__(self, *args, **kwargs): # <<<<<<<<<<<<<< + * TransitionSystem.__init__(self, *args, **kwargs) + * +*/ + + /* function exit code */ + __pyx_r = 0; + goto __pyx_L0; + __pyx_L1_error:; + __Pyx_XDECREF(__pyx_t_1); + __Pyx_XDECREF(__pyx_t_2); + __Pyx_XDECREF(__pyx_t_3); + __Pyx_XDECREF(__pyx_t_4); + __Pyx_AddTraceback("spacy.pipeline._parser_internals.ner.BiluoPushDown.__init__", __pyx_clineno, __pyx_lineno, __pyx_filename); + __pyx_r = -1; + __pyx_L0:; + __Pyx_RefNannyFinishContext(); + return __pyx_r; +} + +/* "spacy/pipeline/_parser_internals/ner.pyx":131 + * TransitionSystem.__init__(self, *args, **kwargs) + * + * @classmethod # <<<<<<<<<<<<<< + * def get_actions(cls, **kwargs): + * actions = { +*/ + +/* Python wrapper */ +static PyObject *__pyx_pw_5spacy_8pipeline_17_parser_internals_3ner_13BiluoPushDown_3get_actions(PyObject *__pyx_v_cls, +#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_5spacy_8pipeline_17_parser_internals_3ner_13BiluoPushDown_2get_actions, "BiluoPushDown.get_actions(cls, **kwargs)"); +static PyMethodDef __pyx_mdef_5spacy_8pipeline_17_parser_internals_3ner_13BiluoPushDown_3get_actions = {"get_actions", (PyCFunction)(void(*)(void))(__Pyx_PyCFunction_FastCallWithKeywords)__pyx_pw_5spacy_8pipeline_17_parser_internals_3ner_13BiluoPushDown_3get_actions, __Pyx_METH_FASTCALL|METH_KEYWORDS, __pyx_doc_5spacy_8pipeline_17_parser_internals_3ner_13BiluoPushDown_2get_actions}; +static PyObject *__pyx_pw_5spacy_8pipeline_17_parser_internals_3ner_13BiluoPushDown_3get_actions(PyObject *__pyx_v_cls, +#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_kwargs = 0; + #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("get_actions (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("get_actions", 1, 0, 0, __pyx_nargs); return NULL; } + const Py_ssize_t __pyx_kwds_len = (__pyx_kwds) ? __Pyx_NumKwargs_FASTCALL(__pyx_kwds) : 0; + if (unlikely(__pyx_kwds_len < 0)) return NULL; + if (__pyx_kwds_len > 0) { + if (unlikely(__Pyx_CheckKeywordStrings("get_actions", __pyx_kwds) == -1)) return NULL; + __pyx_v_kwargs = __Pyx_KwargsAsDict_FASTCALL(__pyx_kwds, __pyx_kwvalues); + if (unlikely(!__pyx_v_kwargs)) return NULL; + __Pyx_GOTREF(__pyx_v_kwargs); + } else { + __pyx_v_kwargs = PyDict_New(); + if (unlikely(!__pyx_v_kwargs)) return NULL; + __Pyx_GOTREF(__pyx_v_kwargs); + } + __pyx_r = __pyx_pf_5spacy_8pipeline_17_parser_internals_3ner_13BiluoPushDown_2get_actions(((PyTypeObject*)__pyx_v_cls), __pyx_v_kwargs); + + /* function exit code */ + __Pyx_DECREF(__pyx_v_kwargs); + __Pyx_RefNannyFinishContext(); + return __pyx_r; +} + +static PyObject *__pyx_pf_5spacy_8pipeline_17_parser_internals_3ner_13BiluoPushDown_2get_actions(CYTHON_UNUSED PyTypeObject *__pyx_v_cls, PyObject *__pyx_v_kwargs) { + PyObject *__pyx_v_actions = NULL; + PyObject *__pyx_v_entity_type = NULL; + int __pyx_v_action; + PyObject *__pyx_v_example = NULL; + PyObject *__pyx_v_token = NULL; + PyObject *__pyx_v_ent_type = NULL; + PyObject *__pyx_r = NULL; + __Pyx_RefNannyDeclarations + PyObject *__pyx_t_1 = NULL; + PyObject *__pyx_t_2 = NULL; + PyObject *__pyx_t_3 = NULL; + PyObject *__pyx_t_4 = NULL; + PyObject *__pyx_t_5 = NULL; + size_t __pyx_t_6; + Py_ssize_t __pyx_t_7; + PyObject *(*__pyx_t_8)(PyObject *); + PyObject *__pyx_t_9 = NULL; + Py_ssize_t __pyx_t_10; + int __pyx_t_11; + PyObject *(*__pyx_t_12)(PyObject *); + int __pyx_t_13; + PyObject *__pyx_t_14 = NULL; + Py_ssize_t __pyx_t_15; + int __pyx_lineno = 0; + const char *__pyx_filename = NULL; + int __pyx_clineno = 0; + __Pyx_RefNannySetupContext("get_actions", 0); + + /* "spacy/pipeline/_parser_internals/ner.pyx":134 + * def get_actions(cls, **kwargs): + * actions = { + * MISSING: Counter(), # <<<<<<<<<<<<<< + * BEGIN: Counter(), + * IN: Counter(), +*/ + __pyx_t_1 = __Pyx_PyDict_NewPresized(6); if (unlikely(!__pyx_t_1)) __PYX_ERR(0, 134, __pyx_L1_error) + __Pyx_GOTREF(__pyx_t_1); + __pyx_t_2 = __Pyx_PyLong_From___pyx_anon_enum(__pyx_e_5spacy_8pipeline_17_parser_internals_3ner_MISSING); if (unlikely(!__pyx_t_2)) __PYX_ERR(0, 134, __pyx_L1_error) + __Pyx_GOTREF(__pyx_t_2); + __pyx_t_4 = NULL; + __Pyx_GetModuleGlobalName(__pyx_t_5, __pyx_mstate_global->__pyx_n_u_Counter); if (unlikely(!__pyx_t_5)) __PYX_ERR(0, 134, __pyx_L1_error) + __Pyx_GOTREF(__pyx_t_5); + __pyx_t_6 = 1; + #if CYTHON_UNPACK_METHODS + if (unlikely(PyMethod_Check(__pyx_t_5))) { + __pyx_t_4 = PyMethod_GET_SELF(__pyx_t_5); + assert(__pyx_t_4); + PyObject* __pyx__function = PyMethod_GET_FUNCTION(__pyx_t_5); + __Pyx_INCREF(__pyx_t_4); + __Pyx_INCREF(__pyx__function); + __Pyx_DECREF_SET(__pyx_t_5, __pyx__function); + __pyx_t_6 = 0; + } + #endif + { + PyObject *__pyx_callargs[2] = {__pyx_t_4, NULL}; + __pyx_t_3 = __Pyx_PyObject_FastCall((PyObject*)__pyx_t_5, __pyx_callargs+__pyx_t_6, (1-__pyx_t_6) | (__pyx_t_6*__Pyx_PY_VECTORCALL_ARGUMENTS_OFFSET)); + __Pyx_XDECREF(__pyx_t_4); __pyx_t_4 = 0; + __Pyx_DECREF(__pyx_t_5); __pyx_t_5 = 0; + if (unlikely(!__pyx_t_3)) __PYX_ERR(0, 134, __pyx_L1_error) + __Pyx_GOTREF(__pyx_t_3); + } + if (PyDict_SetItem(__pyx_t_1, __pyx_t_2, __pyx_t_3) < (0)) __PYX_ERR(0, 134, __pyx_L1_error) + __Pyx_DECREF(__pyx_t_2); __pyx_t_2 = 0; + __Pyx_DECREF(__pyx_t_3); __pyx_t_3 = 0; + + /* "spacy/pipeline/_parser_internals/ner.pyx":135 + * actions = { + * MISSING: Counter(), + * BEGIN: Counter(), # <<<<<<<<<<<<<< + * IN: Counter(), + * LAST: Counter(), +*/ + __pyx_t_3 = __Pyx_PyLong_From___pyx_anon_enum(__pyx_e_5spacy_8pipeline_17_parser_internals_3ner_BEGIN); if (unlikely(!__pyx_t_3)) __PYX_ERR(0, 135, __pyx_L1_error) + __Pyx_GOTREF(__pyx_t_3); + __pyx_t_5 = NULL; + __Pyx_GetModuleGlobalName(__pyx_t_4, __pyx_mstate_global->__pyx_n_u_Counter); if (unlikely(!__pyx_t_4)) __PYX_ERR(0, 135, __pyx_L1_error) + __Pyx_GOTREF(__pyx_t_4); + __pyx_t_6 = 1; + #if CYTHON_UNPACK_METHODS + if (unlikely(PyMethod_Check(__pyx_t_4))) { + __pyx_t_5 = PyMethod_GET_SELF(__pyx_t_4); + assert(__pyx_t_5); + PyObject* __pyx__function = PyMethod_GET_FUNCTION(__pyx_t_4); + __Pyx_INCREF(__pyx_t_5); + __Pyx_INCREF(__pyx__function); + __Pyx_DECREF_SET(__pyx_t_4, __pyx__function); + __pyx_t_6 = 0; + } + #endif + { + PyObject *__pyx_callargs[2] = {__pyx_t_5, NULL}; + __pyx_t_2 = __Pyx_PyObject_FastCall((PyObject*)__pyx_t_4, __pyx_callargs+__pyx_t_6, (1-__pyx_t_6) | (__pyx_t_6*__Pyx_PY_VECTORCALL_ARGUMENTS_OFFSET)); + __Pyx_XDECREF(__pyx_t_5); __pyx_t_5 = 0; + __Pyx_DECREF(__pyx_t_4); __pyx_t_4 = 0; + if (unlikely(!__pyx_t_2)) __PYX_ERR(0, 135, __pyx_L1_error) + __Pyx_GOTREF(__pyx_t_2); + } + if (PyDict_SetItem(__pyx_t_1, __pyx_t_3, __pyx_t_2) < (0)) __PYX_ERR(0, 134, __pyx_L1_error) + __Pyx_DECREF(__pyx_t_3); __pyx_t_3 = 0; + __Pyx_DECREF(__pyx_t_2); __pyx_t_2 = 0; + + /* "spacy/pipeline/_parser_internals/ner.pyx":136 + * MISSING: Counter(), + * BEGIN: Counter(), + * IN: Counter(), # <<<<<<<<<<<<<< + * LAST: Counter(), + * UNIT: Counter(), +*/ + __pyx_t_2 = __Pyx_PyLong_From___pyx_anon_enum(__pyx_e_5spacy_8pipeline_17_parser_internals_3ner_IN); if (unlikely(!__pyx_t_2)) __PYX_ERR(0, 136, __pyx_L1_error) + __Pyx_GOTREF(__pyx_t_2); + __pyx_t_4 = NULL; + __Pyx_GetModuleGlobalName(__pyx_t_5, __pyx_mstate_global->__pyx_n_u_Counter); if (unlikely(!__pyx_t_5)) __PYX_ERR(0, 136, __pyx_L1_error) + __Pyx_GOTREF(__pyx_t_5); + __pyx_t_6 = 1; + #if CYTHON_UNPACK_METHODS + if (unlikely(PyMethod_Check(__pyx_t_5))) { + __pyx_t_4 = PyMethod_GET_SELF(__pyx_t_5); + assert(__pyx_t_4); + PyObject* __pyx__function = PyMethod_GET_FUNCTION(__pyx_t_5); + __Pyx_INCREF(__pyx_t_4); + __Pyx_INCREF(__pyx__function); + __Pyx_DECREF_SET(__pyx_t_5, __pyx__function); + __pyx_t_6 = 0; + } + #endif + { + PyObject *__pyx_callargs[2] = {__pyx_t_4, NULL}; + __pyx_t_3 = __Pyx_PyObject_FastCall((PyObject*)__pyx_t_5, __pyx_callargs+__pyx_t_6, (1-__pyx_t_6) | (__pyx_t_6*__Pyx_PY_VECTORCALL_ARGUMENTS_OFFSET)); + __Pyx_XDECREF(__pyx_t_4); __pyx_t_4 = 0; + __Pyx_DECREF(__pyx_t_5); __pyx_t_5 = 0; + if (unlikely(!__pyx_t_3)) __PYX_ERR(0, 136, __pyx_L1_error) + __Pyx_GOTREF(__pyx_t_3); + } + if (PyDict_SetItem(__pyx_t_1, __pyx_t_2, __pyx_t_3) < (0)) __PYX_ERR(0, 134, __pyx_L1_error) + __Pyx_DECREF(__pyx_t_2); __pyx_t_2 = 0; + __Pyx_DECREF(__pyx_t_3); __pyx_t_3 = 0; + + /* "spacy/pipeline/_parser_internals/ner.pyx":137 + * BEGIN: Counter(), + * IN: Counter(), + * LAST: Counter(), # <<<<<<<<<<<<<< + * UNIT: Counter(), + * OUT: Counter() +*/ + __pyx_t_3 = __Pyx_PyLong_From___pyx_anon_enum(__pyx_e_5spacy_8pipeline_17_parser_internals_3ner_LAST); if (unlikely(!__pyx_t_3)) __PYX_ERR(0, 137, __pyx_L1_error) + __Pyx_GOTREF(__pyx_t_3); + __pyx_t_5 = NULL; + __Pyx_GetModuleGlobalName(__pyx_t_4, __pyx_mstate_global->__pyx_n_u_Counter); if (unlikely(!__pyx_t_4)) __PYX_ERR(0, 137, __pyx_L1_error) + __Pyx_GOTREF(__pyx_t_4); + __pyx_t_6 = 1; + #if CYTHON_UNPACK_METHODS + if (unlikely(PyMethod_Check(__pyx_t_4))) { + __pyx_t_5 = PyMethod_GET_SELF(__pyx_t_4); + assert(__pyx_t_5); + PyObject* __pyx__function = PyMethod_GET_FUNCTION(__pyx_t_4); + __Pyx_INCREF(__pyx_t_5); + __Pyx_INCREF(__pyx__function); + __Pyx_DECREF_SET(__pyx_t_4, __pyx__function); + __pyx_t_6 = 0; + } + #endif + { + PyObject *__pyx_callargs[2] = {__pyx_t_5, NULL}; + __pyx_t_2 = __Pyx_PyObject_FastCall((PyObject*)__pyx_t_4, __pyx_callargs+__pyx_t_6, (1-__pyx_t_6) | (__pyx_t_6*__Pyx_PY_VECTORCALL_ARGUMENTS_OFFSET)); + __Pyx_XDECREF(__pyx_t_5); __pyx_t_5 = 0; + __Pyx_DECREF(__pyx_t_4); __pyx_t_4 = 0; + if (unlikely(!__pyx_t_2)) __PYX_ERR(0, 137, __pyx_L1_error) + __Pyx_GOTREF(__pyx_t_2); + } + if (PyDict_SetItem(__pyx_t_1, __pyx_t_3, __pyx_t_2) < (0)) __PYX_ERR(0, 134, __pyx_L1_error) + __Pyx_DECREF(__pyx_t_3); __pyx_t_3 = 0; + __Pyx_DECREF(__pyx_t_2); __pyx_t_2 = 0; + + /* "spacy/pipeline/_parser_internals/ner.pyx":138 + * IN: Counter(), + * LAST: Counter(), + * UNIT: Counter(), # <<<<<<<<<<<<<< + * OUT: Counter() + * } +*/ + __pyx_t_2 = __Pyx_PyLong_From___pyx_anon_enum(__pyx_e_5spacy_8pipeline_17_parser_internals_3ner_UNIT); if (unlikely(!__pyx_t_2)) __PYX_ERR(0, 138, __pyx_L1_error) + __Pyx_GOTREF(__pyx_t_2); + __pyx_t_4 = NULL; + __Pyx_GetModuleGlobalName(__pyx_t_5, __pyx_mstate_global->__pyx_n_u_Counter); if (unlikely(!__pyx_t_5)) __PYX_ERR(0, 138, __pyx_L1_error) + __Pyx_GOTREF(__pyx_t_5); + __pyx_t_6 = 1; + #if CYTHON_UNPACK_METHODS + if (unlikely(PyMethod_Check(__pyx_t_5))) { + __pyx_t_4 = PyMethod_GET_SELF(__pyx_t_5); + assert(__pyx_t_4); + PyObject* __pyx__function = PyMethod_GET_FUNCTION(__pyx_t_5); + __Pyx_INCREF(__pyx_t_4); + __Pyx_INCREF(__pyx__function); + __Pyx_DECREF_SET(__pyx_t_5, __pyx__function); + __pyx_t_6 = 0; + } + #endif + { + PyObject *__pyx_callargs[2] = {__pyx_t_4, NULL}; + __pyx_t_3 = __Pyx_PyObject_FastCall((PyObject*)__pyx_t_5, __pyx_callargs+__pyx_t_6, (1-__pyx_t_6) | (__pyx_t_6*__Pyx_PY_VECTORCALL_ARGUMENTS_OFFSET)); + __Pyx_XDECREF(__pyx_t_4); __pyx_t_4 = 0; + __Pyx_DECREF(__pyx_t_5); __pyx_t_5 = 0; + if (unlikely(!__pyx_t_3)) __PYX_ERR(0, 138, __pyx_L1_error) + __Pyx_GOTREF(__pyx_t_3); + } + if (PyDict_SetItem(__pyx_t_1, __pyx_t_2, __pyx_t_3) < (0)) __PYX_ERR(0, 134, __pyx_L1_error) + __Pyx_DECREF(__pyx_t_2); __pyx_t_2 = 0; + __Pyx_DECREF(__pyx_t_3); __pyx_t_3 = 0; + + /* "spacy/pipeline/_parser_internals/ner.pyx":139 + * LAST: Counter(), + * UNIT: Counter(), + * OUT: Counter() # <<<<<<<<<<<<<< + * } + * actions[OUT][''] = 1 # Represents a token predicted to be outside of any entity +*/ + __pyx_t_3 = __Pyx_PyLong_From___pyx_anon_enum(__pyx_e_5spacy_8pipeline_17_parser_internals_3ner_OUT); if (unlikely(!__pyx_t_3)) __PYX_ERR(0, 139, __pyx_L1_error) + __Pyx_GOTREF(__pyx_t_3); + __pyx_t_5 = NULL; + __Pyx_GetModuleGlobalName(__pyx_t_4, __pyx_mstate_global->__pyx_n_u_Counter); if (unlikely(!__pyx_t_4)) __PYX_ERR(0, 139, __pyx_L1_error) + __Pyx_GOTREF(__pyx_t_4); + __pyx_t_6 = 1; + #if CYTHON_UNPACK_METHODS + if (unlikely(PyMethod_Check(__pyx_t_4))) { + __pyx_t_5 = PyMethod_GET_SELF(__pyx_t_4); + assert(__pyx_t_5); + PyObject* __pyx__function = PyMethod_GET_FUNCTION(__pyx_t_4); + __Pyx_INCREF(__pyx_t_5); + __Pyx_INCREF(__pyx__function); + __Pyx_DECREF_SET(__pyx_t_4, __pyx__function); + __pyx_t_6 = 0; + } + #endif + { + PyObject *__pyx_callargs[2] = {__pyx_t_5, NULL}; + __pyx_t_2 = __Pyx_PyObject_FastCall((PyObject*)__pyx_t_4, __pyx_callargs+__pyx_t_6, (1-__pyx_t_6) | (__pyx_t_6*__Pyx_PY_VECTORCALL_ARGUMENTS_OFFSET)); + __Pyx_XDECREF(__pyx_t_5); __pyx_t_5 = 0; + __Pyx_DECREF(__pyx_t_4); __pyx_t_4 = 0; + if (unlikely(!__pyx_t_2)) __PYX_ERR(0, 139, __pyx_L1_error) + __Pyx_GOTREF(__pyx_t_2); + } + if (PyDict_SetItem(__pyx_t_1, __pyx_t_3, __pyx_t_2) < (0)) __PYX_ERR(0, 134, __pyx_L1_error) + __Pyx_DECREF(__pyx_t_3); __pyx_t_3 = 0; + __Pyx_DECREF(__pyx_t_2); __pyx_t_2 = 0; + __pyx_v_actions = ((PyObject*)__pyx_t_1); + __pyx_t_1 = 0; + + /* "spacy/pipeline/_parser_internals/ner.pyx":141 + * OUT: Counter() + * } + * actions[OUT][''] = 1 # Represents a token predicted to be outside of any entity # <<<<<<<<<<<<<< + * actions[UNIT][''] = 1 # Represents a token prohibited to be in an entity + * for entity_type in kwargs.get('entity_types', []): +*/ + __pyx_t_1 = __Pyx_PyLong_From___pyx_anon_enum(__pyx_e_5spacy_8pipeline_17_parser_internals_3ner_OUT); if (unlikely(!__pyx_t_1)) __PYX_ERR(0, 141, __pyx_L1_error) + __Pyx_GOTREF(__pyx_t_1); + __pyx_t_2 = __Pyx_PyDict_GetItem(__pyx_v_actions, __pyx_t_1); if (unlikely(!__pyx_t_2)) __PYX_ERR(0, 141, __pyx_L1_error) + __Pyx_GOTREF(__pyx_t_2); + __Pyx_DECREF(__pyx_t_1); __pyx_t_1 = 0; + if (unlikely((PyObject_SetItem(__pyx_t_2, __pyx_mstate_global->__pyx_kp_u__6, __pyx_mstate_global->__pyx_int_1) < 0))) __PYX_ERR(0, 141, __pyx_L1_error) + __Pyx_DECREF(__pyx_t_2); __pyx_t_2 = 0; + + /* "spacy/pipeline/_parser_internals/ner.pyx":142 + * } + * actions[OUT][''] = 1 # Represents a token predicted to be outside of any entity + * actions[UNIT][''] = 1 # Represents a token prohibited to be in an entity # <<<<<<<<<<<<<< + * for entity_type in kwargs.get('entity_types', []): + * for action in (BEGIN, IN, LAST, UNIT): +*/ + __pyx_t_2 = __Pyx_PyLong_From___pyx_anon_enum(__pyx_e_5spacy_8pipeline_17_parser_internals_3ner_UNIT); if (unlikely(!__pyx_t_2)) __PYX_ERR(0, 142, __pyx_L1_error) + __Pyx_GOTREF(__pyx_t_2); + __pyx_t_1 = __Pyx_PyDict_GetItem(__pyx_v_actions, __pyx_t_2); if (unlikely(!__pyx_t_1)) __PYX_ERR(0, 142, __pyx_L1_error) + __Pyx_GOTREF(__pyx_t_1); + __Pyx_DECREF(__pyx_t_2); __pyx_t_2 = 0; + if (unlikely((PyObject_SetItem(__pyx_t_1, __pyx_mstate_global->__pyx_kp_u__6, __pyx_mstate_global->__pyx_int_1) < 0))) __PYX_ERR(0, 142, __pyx_L1_error) + __Pyx_DECREF(__pyx_t_1); __pyx_t_1 = 0; + + /* "spacy/pipeline/_parser_internals/ner.pyx":143 + * actions[OUT][''] = 1 # Represents a token predicted to be outside of any entity + * actions[UNIT][''] = 1 # Represents a token prohibited to be in an entity + * for entity_type in kwargs.get('entity_types', []): # <<<<<<<<<<<<<< + * for action in (BEGIN, IN, LAST, UNIT): + * actions[action][entity_type] = 1 +*/ + __pyx_t_1 = PyList_New(0); if (unlikely(!__pyx_t_1)) __PYX_ERR(0, 143, __pyx_L1_error) + __Pyx_GOTREF(__pyx_t_1); + __pyx_t_2 = __Pyx_PyDict_GetItemDefault(__pyx_v_kwargs, __pyx_mstate_global->__pyx_n_u_entity_types, __pyx_t_1); if (unlikely(!__pyx_t_2)) __PYX_ERR(0, 143, __pyx_L1_error) + __Pyx_GOTREF(__pyx_t_2); + __Pyx_DECREF(__pyx_t_1); __pyx_t_1 = 0; + if (likely(PyList_CheckExact(__pyx_t_2)) || PyTuple_CheckExact(__pyx_t_2)) { + __pyx_t_1 = __pyx_t_2; __Pyx_INCREF(__pyx_t_1); + __pyx_t_7 = 0; + __pyx_t_8 = NULL; + } else { + __pyx_t_7 = -1; __pyx_t_1 = PyObject_GetIter(__pyx_t_2); if (unlikely(!__pyx_t_1)) __PYX_ERR(0, 143, __pyx_L1_error) + __Pyx_GOTREF(__pyx_t_1); + __pyx_t_8 = (CYTHON_COMPILING_IN_LIMITED_API) ? PyIter_Next : __Pyx_PyObject_GetIterNextFunc(__pyx_t_1); if (unlikely(!__pyx_t_8)) __PYX_ERR(0, 143, __pyx_L1_error) + } + __Pyx_DECREF(__pyx_t_2); __pyx_t_2 = 0; + for (;;) { + if (likely(!__pyx_t_8)) { + if (likely(PyList_CheckExact(__pyx_t_1))) { + { + Py_ssize_t __pyx_temp = __Pyx_PyList_GET_SIZE(__pyx_t_1); + #if !CYTHON_ASSUME_SAFE_SIZE + if (unlikely((__pyx_temp < 0))) __PYX_ERR(0, 143, __pyx_L1_error) + #endif + if (__pyx_t_7 >= __pyx_temp) break; + } + __pyx_t_2 = __Pyx_PyList_GetItemRefFast(__pyx_t_1, __pyx_t_7, __Pyx_ReferenceSharing_OwnStrongReference); + ++__pyx_t_7; + } else { + { + Py_ssize_t __pyx_temp = __Pyx_PyTuple_GET_SIZE(__pyx_t_1); + #if !CYTHON_ASSUME_SAFE_SIZE + if (unlikely((__pyx_temp < 0))) __PYX_ERR(0, 143, __pyx_L1_error) + #endif + if (__pyx_t_7 >= __pyx_temp) break; + } + #if CYTHON_ASSUME_SAFE_MACROS && !CYTHON_AVOID_BORROWED_REFS + __pyx_t_2 = __Pyx_NewRef(PyTuple_GET_ITEM(__pyx_t_1, __pyx_t_7)); + #else + __pyx_t_2 = __Pyx_PySequence_ITEM(__pyx_t_1, __pyx_t_7); + #endif + ++__pyx_t_7; + } + if (unlikely(!__pyx_t_2)) __PYX_ERR(0, 143, __pyx_L1_error) + } else { + __pyx_t_2 = __pyx_t_8(__pyx_t_1); + 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, 143, __pyx_L1_error) + PyErr_Clear(); + } + break; + } + } + __Pyx_GOTREF(__pyx_t_2); + __Pyx_XDECREF_SET(__pyx_v_entity_type, __pyx_t_2); + __pyx_t_2 = 0; + + /* "spacy/pipeline/_parser_internals/ner.pyx":144 + * actions[UNIT][''] = 1 # Represents a token prohibited to be in an entity + * for entity_type in kwargs.get('entity_types', []): + * for action in (BEGIN, IN, LAST, UNIT): # <<<<<<<<<<<<<< + * actions[action][entity_type] = 1 + * for example in kwargs.get('examples', []): +*/ + __pyx_t_2 = __Pyx_PyLong_From___pyx_anon_enum(__pyx_e_5spacy_8pipeline_17_parser_internals_3ner_BEGIN); if (unlikely(!__pyx_t_2)) __PYX_ERR(0, 144, __pyx_L1_error) + __Pyx_GOTREF(__pyx_t_2); + __pyx_t_3 = __Pyx_PyLong_From___pyx_anon_enum(__pyx_e_5spacy_8pipeline_17_parser_internals_3ner_IN); if (unlikely(!__pyx_t_3)) __PYX_ERR(0, 144, __pyx_L1_error) + __Pyx_GOTREF(__pyx_t_3); + __pyx_t_4 = __Pyx_PyLong_From___pyx_anon_enum(__pyx_e_5spacy_8pipeline_17_parser_internals_3ner_LAST); if (unlikely(!__pyx_t_4)) __PYX_ERR(0, 144, __pyx_L1_error) + __Pyx_GOTREF(__pyx_t_4); + __pyx_t_5 = __Pyx_PyLong_From___pyx_anon_enum(__pyx_e_5spacy_8pipeline_17_parser_internals_3ner_UNIT); if (unlikely(!__pyx_t_5)) __PYX_ERR(0, 144, __pyx_L1_error) + __Pyx_GOTREF(__pyx_t_5); + __pyx_t_9 = PyTuple_New(4); if (unlikely(!__pyx_t_9)) __PYX_ERR(0, 144, __pyx_L1_error) + __Pyx_GOTREF(__pyx_t_9); + __Pyx_GIVEREF(__pyx_t_2); + if (__Pyx_PyTuple_SET_ITEM(__pyx_t_9, 0, __pyx_t_2) != (0)) __PYX_ERR(0, 144, __pyx_L1_error); + __Pyx_GIVEREF(__pyx_t_3); + if (__Pyx_PyTuple_SET_ITEM(__pyx_t_9, 1, __pyx_t_3) != (0)) __PYX_ERR(0, 144, __pyx_L1_error); + __Pyx_GIVEREF(__pyx_t_4); + if (__Pyx_PyTuple_SET_ITEM(__pyx_t_9, 2, __pyx_t_4) != (0)) __PYX_ERR(0, 144, __pyx_L1_error); + __Pyx_GIVEREF(__pyx_t_5); + if (__Pyx_PyTuple_SET_ITEM(__pyx_t_9, 3, __pyx_t_5) != (0)) __PYX_ERR(0, 144, __pyx_L1_error); + __pyx_t_2 = 0; + __pyx_t_3 = 0; + __pyx_t_4 = 0; + __pyx_t_5 = 0; + __pyx_t_5 = __pyx_t_9; __Pyx_INCREF(__pyx_t_5); + __pyx_t_10 = 0; + __Pyx_DECREF(__pyx_t_9); __pyx_t_9 = 0; + for (;;) { + if (__pyx_t_10 >= 4) break; + #if CYTHON_ASSUME_SAFE_MACROS && !CYTHON_AVOID_BORROWED_REFS + __pyx_t_9 = __Pyx_NewRef(PyTuple_GET_ITEM(__pyx_t_5, __pyx_t_10)); + #else + __pyx_t_9 = __Pyx_PySequence_ITEM(__pyx_t_5, __pyx_t_10); + #endif + ++__pyx_t_10; + if (unlikely(!__pyx_t_9)) __PYX_ERR(0, 144, __pyx_L1_error) + __Pyx_GOTREF(__pyx_t_9); + __pyx_t_11 = __Pyx_PyLong_As___pyx_anon_enum(__pyx_t_9); if (unlikely((__pyx_t_11 == (int)-1) && PyErr_Occurred())) __PYX_ERR(0, 144, __pyx_L1_error) + __Pyx_DECREF(__pyx_t_9); __pyx_t_9 = 0; + __pyx_v_action = __pyx_t_11; + + /* "spacy/pipeline/_parser_internals/ner.pyx":145 + * for entity_type in kwargs.get('entity_types', []): + * for action in (BEGIN, IN, LAST, UNIT): + * actions[action][entity_type] = 1 # <<<<<<<<<<<<<< + * for example in kwargs.get('examples', []): + * for token in example.y: +*/ + __pyx_t_9 = __Pyx_PyLong_From___pyx_anon_enum(__pyx_v_action); if (unlikely(!__pyx_t_9)) __PYX_ERR(0, 145, __pyx_L1_error) + __Pyx_GOTREF(__pyx_t_9); + __pyx_t_4 = __Pyx_PyDict_GetItem(__pyx_v_actions, __pyx_t_9); if (unlikely(!__pyx_t_4)) __PYX_ERR(0, 145, __pyx_L1_error) + __Pyx_GOTREF(__pyx_t_4); + __Pyx_DECREF(__pyx_t_9); __pyx_t_9 = 0; + if (unlikely((PyObject_SetItem(__pyx_t_4, __pyx_v_entity_type, __pyx_mstate_global->__pyx_int_1) < 0))) __PYX_ERR(0, 145, __pyx_L1_error) + __Pyx_DECREF(__pyx_t_4); __pyx_t_4 = 0; + + /* "spacy/pipeline/_parser_internals/ner.pyx":144 + * actions[UNIT][''] = 1 # Represents a token prohibited to be in an entity + * for entity_type in kwargs.get('entity_types', []): + * for action in (BEGIN, IN, LAST, UNIT): # <<<<<<<<<<<<<< + * actions[action][entity_type] = 1 + * for example in kwargs.get('examples', []): +*/ + } + __Pyx_DECREF(__pyx_t_5); __pyx_t_5 = 0; + + /* "spacy/pipeline/_parser_internals/ner.pyx":143 + * actions[OUT][''] = 1 # Represents a token predicted to be outside of any entity + * actions[UNIT][''] = 1 # Represents a token prohibited to be in an entity + * for entity_type in kwargs.get('entity_types', []): # <<<<<<<<<<<<<< + * for action in (BEGIN, IN, LAST, UNIT): + * actions[action][entity_type] = 1 +*/ + } + __Pyx_DECREF(__pyx_t_1); __pyx_t_1 = 0; + + /* "spacy/pipeline/_parser_internals/ner.pyx":146 + * for action in (BEGIN, IN, LAST, UNIT): + * actions[action][entity_type] = 1 + * for example in kwargs.get('examples', []): # <<<<<<<<<<<<<< + * for token in example.y: + * ent_type = token.ent_type_ +*/ + __pyx_t_1 = PyList_New(0); if (unlikely(!__pyx_t_1)) __PYX_ERR(0, 146, __pyx_L1_error) + __Pyx_GOTREF(__pyx_t_1); + __pyx_t_5 = __Pyx_PyDict_GetItemDefault(__pyx_v_kwargs, __pyx_mstate_global->__pyx_n_u_examples, __pyx_t_1); if (unlikely(!__pyx_t_5)) __PYX_ERR(0, 146, __pyx_L1_error) + __Pyx_GOTREF(__pyx_t_5); + __Pyx_DECREF(__pyx_t_1); __pyx_t_1 = 0; + if (likely(PyList_CheckExact(__pyx_t_5)) || PyTuple_CheckExact(__pyx_t_5)) { + __pyx_t_1 = __pyx_t_5; __Pyx_INCREF(__pyx_t_1); + __pyx_t_7 = 0; + __pyx_t_8 = NULL; + } else { + __pyx_t_7 = -1; __pyx_t_1 = PyObject_GetIter(__pyx_t_5); if (unlikely(!__pyx_t_1)) __PYX_ERR(0, 146, __pyx_L1_error) + __Pyx_GOTREF(__pyx_t_1); + __pyx_t_8 = (CYTHON_COMPILING_IN_LIMITED_API) ? PyIter_Next : __Pyx_PyObject_GetIterNextFunc(__pyx_t_1); if (unlikely(!__pyx_t_8)) __PYX_ERR(0, 146, __pyx_L1_error) + } + __Pyx_DECREF(__pyx_t_5); __pyx_t_5 = 0; + for (;;) { + if (likely(!__pyx_t_8)) { + if (likely(PyList_CheckExact(__pyx_t_1))) { + { + Py_ssize_t __pyx_temp = __Pyx_PyList_GET_SIZE(__pyx_t_1); + #if !CYTHON_ASSUME_SAFE_SIZE + if (unlikely((__pyx_temp < 0))) __PYX_ERR(0, 146, __pyx_L1_error) + #endif + if (__pyx_t_7 >= __pyx_temp) break; + } + __pyx_t_5 = __Pyx_PyList_GetItemRefFast(__pyx_t_1, __pyx_t_7, __Pyx_ReferenceSharing_OwnStrongReference); + ++__pyx_t_7; + } else { + { + Py_ssize_t __pyx_temp = __Pyx_PyTuple_GET_SIZE(__pyx_t_1); + #if !CYTHON_ASSUME_SAFE_SIZE + if (unlikely((__pyx_temp < 0))) __PYX_ERR(0, 146, __pyx_L1_error) + #endif + if (__pyx_t_7 >= __pyx_temp) break; + } + #if CYTHON_ASSUME_SAFE_MACROS && !CYTHON_AVOID_BORROWED_REFS + __pyx_t_5 = __Pyx_NewRef(PyTuple_GET_ITEM(__pyx_t_1, __pyx_t_7)); + #else + __pyx_t_5 = __Pyx_PySequence_ITEM(__pyx_t_1, __pyx_t_7); + #endif + ++__pyx_t_7; + } + if (unlikely(!__pyx_t_5)) __PYX_ERR(0, 146, __pyx_L1_error) + } else { + __pyx_t_5 = __pyx_t_8(__pyx_t_1); + if (unlikely(!__pyx_t_5)) { + PyObject* exc_type = PyErr_Occurred(); + if (exc_type) { + if (unlikely(!__Pyx_PyErr_GivenExceptionMatches(exc_type, PyExc_StopIteration))) __PYX_ERR(0, 146, __pyx_L1_error) + PyErr_Clear(); + } + break; + } + } + __Pyx_GOTREF(__pyx_t_5); + __Pyx_XDECREF_SET(__pyx_v_example, __pyx_t_5); + __pyx_t_5 = 0; + + /* "spacy/pipeline/_parser_internals/ner.pyx":147 + * actions[action][entity_type] = 1 + * for example in kwargs.get('examples', []): + * for token in example.y: # <<<<<<<<<<<<<< + * ent_type = token.ent_type_ + * if ent_type: +*/ + __pyx_t_5 = __Pyx_PyObject_GetAttrStr(__pyx_v_example, __pyx_mstate_global->__pyx_n_u_y); if (unlikely(!__pyx_t_5)) __PYX_ERR(0, 147, __pyx_L1_error) + __Pyx_GOTREF(__pyx_t_5); + if (likely(PyList_CheckExact(__pyx_t_5)) || PyTuple_CheckExact(__pyx_t_5)) { + __pyx_t_4 = __pyx_t_5; __Pyx_INCREF(__pyx_t_4); + __pyx_t_10 = 0; + __pyx_t_12 = NULL; + } else { + __pyx_t_10 = -1; __pyx_t_4 = PyObject_GetIter(__pyx_t_5); if (unlikely(!__pyx_t_4)) __PYX_ERR(0, 147, __pyx_L1_error) + __Pyx_GOTREF(__pyx_t_4); + __pyx_t_12 = (CYTHON_COMPILING_IN_LIMITED_API) ? PyIter_Next : __Pyx_PyObject_GetIterNextFunc(__pyx_t_4); if (unlikely(!__pyx_t_12)) __PYX_ERR(0, 147, __pyx_L1_error) + } + __Pyx_DECREF(__pyx_t_5); __pyx_t_5 = 0; + for (;;) { + if (likely(!__pyx_t_12)) { + if (likely(PyList_CheckExact(__pyx_t_4))) { + { + Py_ssize_t __pyx_temp = __Pyx_PyList_GET_SIZE(__pyx_t_4); + #if !CYTHON_ASSUME_SAFE_SIZE + if (unlikely((__pyx_temp < 0))) __PYX_ERR(0, 147, __pyx_L1_error) + #endif + if (__pyx_t_10 >= __pyx_temp) break; + } + __pyx_t_5 = __Pyx_PyList_GetItemRefFast(__pyx_t_4, __pyx_t_10, __Pyx_ReferenceSharing_OwnStrongReference); + ++__pyx_t_10; + } else { + { + Py_ssize_t __pyx_temp = __Pyx_PyTuple_GET_SIZE(__pyx_t_4); + #if !CYTHON_ASSUME_SAFE_SIZE + if (unlikely((__pyx_temp < 0))) __PYX_ERR(0, 147, __pyx_L1_error) + #endif + if (__pyx_t_10 >= __pyx_temp) break; + } + #if CYTHON_ASSUME_SAFE_MACROS && !CYTHON_AVOID_BORROWED_REFS + __pyx_t_5 = __Pyx_NewRef(PyTuple_GET_ITEM(__pyx_t_4, __pyx_t_10)); + #else + __pyx_t_5 = __Pyx_PySequence_ITEM(__pyx_t_4, __pyx_t_10); + #endif + ++__pyx_t_10; + } + if (unlikely(!__pyx_t_5)) __PYX_ERR(0, 147, __pyx_L1_error) + } else { + __pyx_t_5 = __pyx_t_12(__pyx_t_4); + if (unlikely(!__pyx_t_5)) { + PyObject* exc_type = PyErr_Occurred(); + if (exc_type) { + if (unlikely(!__Pyx_PyErr_GivenExceptionMatches(exc_type, PyExc_StopIteration))) __PYX_ERR(0, 147, __pyx_L1_error) + PyErr_Clear(); + } + break; + } + } + __Pyx_GOTREF(__pyx_t_5); + __Pyx_XDECREF_SET(__pyx_v_token, __pyx_t_5); + __pyx_t_5 = 0; + + /* "spacy/pipeline/_parser_internals/ner.pyx":148 + * for example in kwargs.get('examples', []): + * for token in example.y: + * ent_type = token.ent_type_ # <<<<<<<<<<<<<< + * if ent_type: + * for action in (BEGIN, IN, LAST, UNIT): +*/ + __pyx_t_5 = __Pyx_PyObject_GetAttrStr(__pyx_v_token, __pyx_mstate_global->__pyx_n_u_ent_type); if (unlikely(!__pyx_t_5)) __PYX_ERR(0, 148, __pyx_L1_error) + __Pyx_GOTREF(__pyx_t_5); + __Pyx_XDECREF_SET(__pyx_v_ent_type, __pyx_t_5); + __pyx_t_5 = 0; + + /* "spacy/pipeline/_parser_internals/ner.pyx":149 + * for token in example.y: + * ent_type = token.ent_type_ + * if ent_type: # <<<<<<<<<<<<<< + * for action in (BEGIN, IN, LAST, UNIT): + * actions[action][ent_type] += 1 +*/ + __pyx_t_13 = __Pyx_PyObject_IsTrue(__pyx_v_ent_type); if (unlikely((__pyx_t_13 < 0))) __PYX_ERR(0, 149, __pyx_L1_error) + if (__pyx_t_13) { + + /* "spacy/pipeline/_parser_internals/ner.pyx":150 + * ent_type = token.ent_type_ + * if ent_type: + * for action in (BEGIN, IN, LAST, UNIT): # <<<<<<<<<<<<<< + * actions[action][ent_type] += 1 + * return actions +*/ + __pyx_t_5 = __Pyx_PyLong_From___pyx_anon_enum(__pyx_e_5spacy_8pipeline_17_parser_internals_3ner_BEGIN); if (unlikely(!__pyx_t_5)) __PYX_ERR(0, 150, __pyx_L1_error) + __Pyx_GOTREF(__pyx_t_5); + __pyx_t_9 = __Pyx_PyLong_From___pyx_anon_enum(__pyx_e_5spacy_8pipeline_17_parser_internals_3ner_IN); if (unlikely(!__pyx_t_9)) __PYX_ERR(0, 150, __pyx_L1_error) + __Pyx_GOTREF(__pyx_t_9); + __pyx_t_3 = __Pyx_PyLong_From___pyx_anon_enum(__pyx_e_5spacy_8pipeline_17_parser_internals_3ner_LAST); if (unlikely(!__pyx_t_3)) __PYX_ERR(0, 150, __pyx_L1_error) + __Pyx_GOTREF(__pyx_t_3); + __pyx_t_2 = __Pyx_PyLong_From___pyx_anon_enum(__pyx_e_5spacy_8pipeline_17_parser_internals_3ner_UNIT); if (unlikely(!__pyx_t_2)) __PYX_ERR(0, 150, __pyx_L1_error) + __Pyx_GOTREF(__pyx_t_2); + __pyx_t_14 = PyTuple_New(4); if (unlikely(!__pyx_t_14)) __PYX_ERR(0, 150, __pyx_L1_error) + __Pyx_GOTREF(__pyx_t_14); + __Pyx_GIVEREF(__pyx_t_5); + if (__Pyx_PyTuple_SET_ITEM(__pyx_t_14, 0, __pyx_t_5) != (0)) __PYX_ERR(0, 150, __pyx_L1_error); + __Pyx_GIVEREF(__pyx_t_9); + if (__Pyx_PyTuple_SET_ITEM(__pyx_t_14, 1, __pyx_t_9) != (0)) __PYX_ERR(0, 150, __pyx_L1_error); + __Pyx_GIVEREF(__pyx_t_3); + if (__Pyx_PyTuple_SET_ITEM(__pyx_t_14, 2, __pyx_t_3) != (0)) __PYX_ERR(0, 150, __pyx_L1_error); + __Pyx_GIVEREF(__pyx_t_2); + if (__Pyx_PyTuple_SET_ITEM(__pyx_t_14, 3, __pyx_t_2) != (0)) __PYX_ERR(0, 150, __pyx_L1_error); + __pyx_t_5 = 0; + __pyx_t_9 = 0; + __pyx_t_3 = 0; + __pyx_t_2 = 0; + __pyx_t_2 = __pyx_t_14; __Pyx_INCREF(__pyx_t_2); + __pyx_t_15 = 0; + __Pyx_DECREF(__pyx_t_14); __pyx_t_14 = 0; + for (;;) { + if (__pyx_t_15 >= 4) break; + #if CYTHON_ASSUME_SAFE_MACROS && !CYTHON_AVOID_BORROWED_REFS + __pyx_t_14 = __Pyx_NewRef(PyTuple_GET_ITEM(__pyx_t_2, __pyx_t_15)); + #else + __pyx_t_14 = __Pyx_PySequence_ITEM(__pyx_t_2, __pyx_t_15); + #endif + ++__pyx_t_15; + if (unlikely(!__pyx_t_14)) __PYX_ERR(0, 150, __pyx_L1_error) + __Pyx_GOTREF(__pyx_t_14); + __pyx_t_11 = __Pyx_PyLong_As___pyx_anon_enum(__pyx_t_14); if (unlikely((__pyx_t_11 == (int)-1) && PyErr_Occurred())) __PYX_ERR(0, 150, __pyx_L1_error) + __Pyx_DECREF(__pyx_t_14); __pyx_t_14 = 0; + __pyx_v_action = __pyx_t_11; + + /* "spacy/pipeline/_parser_internals/ner.pyx":151 + * if ent_type: + * for action in (BEGIN, IN, LAST, UNIT): + * actions[action][ent_type] += 1 # <<<<<<<<<<<<<< + * return actions + * +*/ + __pyx_t_14 = __Pyx_PyLong_From___pyx_anon_enum(__pyx_v_action); if (unlikely(!__pyx_t_14)) __PYX_ERR(0, 151, __pyx_L1_error) + __Pyx_GOTREF(__pyx_t_14); + __pyx_t_3 = __Pyx_PyDict_GetItem(__pyx_v_actions, __pyx_t_14); if (unlikely(!__pyx_t_3)) __PYX_ERR(0, 151, __pyx_L1_error) + __Pyx_GOTREF(__pyx_t_3); + __Pyx_DECREF(__pyx_t_14); __pyx_t_14 = 0; + __Pyx_INCREF(__pyx_v_ent_type); + __pyx_t_14 = __pyx_v_ent_type; + __pyx_t_9 = __Pyx_PyObject_GetItem(__pyx_t_3, __pyx_t_14); if (unlikely(!__pyx_t_9)) __PYX_ERR(0, 151, __pyx_L1_error) + __Pyx_GOTREF(__pyx_t_9); + __pyx_t_5 = __Pyx_PyLong_AddObjC(__pyx_t_9, __pyx_mstate_global->__pyx_int_1, 1, 1, 0); if (unlikely(!__pyx_t_5)) __PYX_ERR(0, 151, __pyx_L1_error) + __Pyx_GOTREF(__pyx_t_5); + __Pyx_DECREF(__pyx_t_9); __pyx_t_9 = 0; + if (unlikely((PyObject_SetItem(__pyx_t_3, __pyx_t_14, __pyx_t_5) < 0))) __PYX_ERR(0, 151, __pyx_L1_error) + __Pyx_DECREF(__pyx_t_5); __pyx_t_5 = 0; + __Pyx_DECREF(__pyx_t_14); __pyx_t_14 = 0; + __Pyx_DECREF(__pyx_t_3); __pyx_t_3 = 0; + + /* "spacy/pipeline/_parser_internals/ner.pyx":150 + * ent_type = token.ent_type_ + * if ent_type: + * for action in (BEGIN, IN, LAST, UNIT): # <<<<<<<<<<<<<< + * actions[action][ent_type] += 1 + * return actions +*/ + } + __Pyx_DECREF(__pyx_t_2); __pyx_t_2 = 0; + + /* "spacy/pipeline/_parser_internals/ner.pyx":149 + * for token in example.y: + * ent_type = token.ent_type_ + * if ent_type: # <<<<<<<<<<<<<< + * for action in (BEGIN, IN, LAST, UNIT): + * actions[action][ent_type] += 1 +*/ + } + + /* "spacy/pipeline/_parser_internals/ner.pyx":147 + * actions[action][entity_type] = 1 + * for example in kwargs.get('examples', []): + * for token in example.y: # <<<<<<<<<<<<<< + * ent_type = token.ent_type_ + * if ent_type: +*/ + } + __Pyx_DECREF(__pyx_t_4); __pyx_t_4 = 0; + + /* "spacy/pipeline/_parser_internals/ner.pyx":146 + * for action in (BEGIN, IN, LAST, UNIT): + * actions[action][entity_type] = 1 + * for example in kwargs.get('examples', []): # <<<<<<<<<<<<<< + * for token in example.y: + * ent_type = token.ent_type_ +*/ + } + __Pyx_DECREF(__pyx_t_1); __pyx_t_1 = 0; + + /* "spacy/pipeline/_parser_internals/ner.pyx":152 + * for action in (BEGIN, IN, LAST, UNIT): + * actions[action][ent_type] += 1 + * return actions # <<<<<<<<<<<<<< + * + * @property +*/ + __Pyx_XDECREF(__pyx_r); + __Pyx_INCREF(__pyx_v_actions); + __pyx_r = __pyx_v_actions; + goto __pyx_L0; + + /* "spacy/pipeline/_parser_internals/ner.pyx":131 + * TransitionSystem.__init__(self, *args, **kwargs) + * + * @classmethod # <<<<<<<<<<<<<< + * def get_actions(cls, **kwargs): + * actions = { +*/ + + /* function exit code */ + __pyx_L1_error:; + __Pyx_XDECREF(__pyx_t_1); + __Pyx_XDECREF(__pyx_t_2); + __Pyx_XDECREF(__pyx_t_3); + __Pyx_XDECREF(__pyx_t_4); + __Pyx_XDECREF(__pyx_t_5); + __Pyx_XDECREF(__pyx_t_9); + __Pyx_XDECREF(__pyx_t_14); + __Pyx_AddTraceback("spacy.pipeline._parser_internals.ner.BiluoPushDown.get_actions", __pyx_clineno, __pyx_lineno, __pyx_filename); + __pyx_r = NULL; + __pyx_L0:; + __Pyx_XDECREF(__pyx_v_actions); + __Pyx_XDECREF(__pyx_v_entity_type); + __Pyx_XDECREF(__pyx_v_example); + __Pyx_XDECREF(__pyx_v_token); + __Pyx_XDECREF(__pyx_v_ent_type); + __Pyx_XGIVEREF(__pyx_r); + __Pyx_RefNannyFinishContext(); + return __pyx_r; +} + +/* "spacy/pipeline/_parser_internals/ner.pyx":154 + * return actions + * + * @property # <<<<<<<<<<<<<< + * def action_types(self): + * return (BEGIN, IN, LAST, UNIT, OUT) +*/ + +/* Python wrapper */ +static PyObject *__pyx_pw_5spacy_8pipeline_17_parser_internals_3ner_13BiluoPushDown_12action_types_1__get__(PyObject *__pyx_v_self); /*proto*/ +static PyObject *__pyx_pw_5spacy_8pipeline_17_parser_internals_3ner_13BiluoPushDown_12action_types_1__get__(PyObject *__pyx_v_self) { + CYTHON_UNUSED PyObject *const *__pyx_kwvalues; + PyObject *__pyx_r = 0; + __Pyx_RefNannyDeclarations + __Pyx_RefNannySetupContext("__get__ (wrapper)", 0); + __pyx_kwvalues = __Pyx_KwValues_VARARGS(__pyx_args, __pyx_nargs); + __pyx_r = __pyx_pf_5spacy_8pipeline_17_parser_internals_3ner_13BiluoPushDown_12action_types___get__(((struct __pyx_obj_5spacy_8pipeline_17_parser_internals_3ner_BiluoPushDown *)__pyx_v_self)); + + /* function exit code */ + __Pyx_RefNannyFinishContext(); + return __pyx_r; +} + +static PyObject *__pyx_pf_5spacy_8pipeline_17_parser_internals_3ner_13BiluoPushDown_12action_types___get__(CYTHON_UNUSED struct __pyx_obj_5spacy_8pipeline_17_parser_internals_3ner_BiluoPushDown *__pyx_v_self) { + PyObject *__pyx_r = NULL; + __Pyx_RefNannyDeclarations + PyObject *__pyx_t_1 = NULL; + PyObject *__pyx_t_2 = NULL; + PyObject *__pyx_t_3 = NULL; + PyObject *__pyx_t_4 = NULL; + PyObject *__pyx_t_5 = NULL; + PyObject *__pyx_t_6 = NULL; + int __pyx_lineno = 0; + const char *__pyx_filename = NULL; + int __pyx_clineno = 0; + __Pyx_RefNannySetupContext("__get__", 0); + + /* "spacy/pipeline/_parser_internals/ner.pyx":156 + * @property + * def action_types(self): + * return (BEGIN, IN, LAST, UNIT, OUT) # <<<<<<<<<<<<<< + * + * def get_doc_labels(self, doc): +*/ + __Pyx_XDECREF(__pyx_r); + __pyx_t_1 = __Pyx_PyLong_From___pyx_anon_enum(__pyx_e_5spacy_8pipeline_17_parser_internals_3ner_BEGIN); if (unlikely(!__pyx_t_1)) __PYX_ERR(0, 156, __pyx_L1_error) + __Pyx_GOTREF(__pyx_t_1); + __pyx_t_2 = __Pyx_PyLong_From___pyx_anon_enum(__pyx_e_5spacy_8pipeline_17_parser_internals_3ner_IN); if (unlikely(!__pyx_t_2)) __PYX_ERR(0, 156, __pyx_L1_error) + __Pyx_GOTREF(__pyx_t_2); + __pyx_t_3 = __Pyx_PyLong_From___pyx_anon_enum(__pyx_e_5spacy_8pipeline_17_parser_internals_3ner_LAST); if (unlikely(!__pyx_t_3)) __PYX_ERR(0, 156, __pyx_L1_error) + __Pyx_GOTREF(__pyx_t_3); + __pyx_t_4 = __Pyx_PyLong_From___pyx_anon_enum(__pyx_e_5spacy_8pipeline_17_parser_internals_3ner_UNIT); if (unlikely(!__pyx_t_4)) __PYX_ERR(0, 156, __pyx_L1_error) + __Pyx_GOTREF(__pyx_t_4); + __pyx_t_5 = __Pyx_PyLong_From___pyx_anon_enum(__pyx_e_5spacy_8pipeline_17_parser_internals_3ner_OUT); if (unlikely(!__pyx_t_5)) __PYX_ERR(0, 156, __pyx_L1_error) + __Pyx_GOTREF(__pyx_t_5); + __pyx_t_6 = PyTuple_New(5); if (unlikely(!__pyx_t_6)) __PYX_ERR(0, 156, __pyx_L1_error) + __Pyx_GOTREF(__pyx_t_6); + __Pyx_GIVEREF(__pyx_t_1); + if (__Pyx_PyTuple_SET_ITEM(__pyx_t_6, 0, __pyx_t_1) != (0)) __PYX_ERR(0, 156, __pyx_L1_error); + __Pyx_GIVEREF(__pyx_t_2); + if (__Pyx_PyTuple_SET_ITEM(__pyx_t_6, 1, __pyx_t_2) != (0)) __PYX_ERR(0, 156, __pyx_L1_error); + __Pyx_GIVEREF(__pyx_t_3); + if (__Pyx_PyTuple_SET_ITEM(__pyx_t_6, 2, __pyx_t_3) != (0)) __PYX_ERR(0, 156, __pyx_L1_error); + __Pyx_GIVEREF(__pyx_t_4); + if (__Pyx_PyTuple_SET_ITEM(__pyx_t_6, 3, __pyx_t_4) != (0)) __PYX_ERR(0, 156, __pyx_L1_error); + __Pyx_GIVEREF(__pyx_t_5); + if (__Pyx_PyTuple_SET_ITEM(__pyx_t_6, 4, __pyx_t_5) != (0)) __PYX_ERR(0, 156, __pyx_L1_error); + __pyx_t_1 = 0; + __pyx_t_2 = 0; + __pyx_t_3 = 0; + __pyx_t_4 = 0; + __pyx_t_5 = 0; + __pyx_r = __pyx_t_6; + __pyx_t_6 = 0; + goto __pyx_L0; + + /* "spacy/pipeline/_parser_internals/ner.pyx":154 + * return actions + * + * @property # <<<<<<<<<<<<<< + * def action_types(self): + * return (BEGIN, IN, LAST, UNIT, OUT) +*/ + + /* function exit code */ + __pyx_L1_error:; + __Pyx_XDECREF(__pyx_t_1); + __Pyx_XDECREF(__pyx_t_2); + __Pyx_XDECREF(__pyx_t_3); + __Pyx_XDECREF(__pyx_t_4); + __Pyx_XDECREF(__pyx_t_5); + __Pyx_XDECREF(__pyx_t_6); + __Pyx_AddTraceback("spacy.pipeline._parser_internals.ner.BiluoPushDown.action_types.__get__", __pyx_clineno, __pyx_lineno, __pyx_filename); + __pyx_r = NULL; + __pyx_L0:; + __Pyx_XGIVEREF(__pyx_r); + __Pyx_RefNannyFinishContext(); + return __pyx_r; +} + +/* "spacy/pipeline/_parser_internals/ner.pyx":158 + * return (BEGIN, IN, LAST, UNIT, OUT) + * + * def get_doc_labels(self, doc): # <<<<<<<<<<<<<< + * labels = set() + * for token in doc: +*/ + +/* Python wrapper */ +static PyObject *__pyx_pw_5spacy_8pipeline_17_parser_internals_3ner_13BiluoPushDown_5get_doc_labels(PyObject *__pyx_v_self, +#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_5spacy_8pipeline_17_parser_internals_3ner_13BiluoPushDown_4get_doc_labels, "BiluoPushDown.get_doc_labels(self, doc)"); +static PyMethodDef __pyx_mdef_5spacy_8pipeline_17_parser_internals_3ner_13BiluoPushDown_5get_doc_labels = {"get_doc_labels", (PyCFunction)(void(*)(void))(__Pyx_PyCFunction_FastCallWithKeywords)__pyx_pw_5spacy_8pipeline_17_parser_internals_3ner_13BiluoPushDown_5get_doc_labels, __Pyx_METH_FASTCALL|METH_KEYWORDS, __pyx_doc_5spacy_8pipeline_17_parser_internals_3ner_13BiluoPushDown_4get_doc_labels}; +static PyObject *__pyx_pw_5spacy_8pipeline_17_parser_internals_3ner_13BiluoPushDown_5get_doc_labels(PyObject *__pyx_v_self, +#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_doc = 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("get_doc_labels (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_doc,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, 158, __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, 158, __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, "get_doc_labels", 0) < (0)) __PYX_ERR(0, 158, __pyx_L3_error) + for (Py_ssize_t i = __pyx_nargs; i < 1; i++) { + if (unlikely(!values[i])) { __Pyx_RaiseArgtupleInvalid("get_doc_labels", 1, 1, 1, i); __PYX_ERR(0, 158, __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, 158, __pyx_L3_error) + } + __pyx_v_doc = values[0]; + } + goto __pyx_L6_skip; + __pyx_L5_argtuple_error:; + __Pyx_RaiseArgtupleInvalid("get_doc_labels", 1, 1, 1, __pyx_nargs); __PYX_ERR(0, 158, __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("spacy.pipeline._parser_internals.ner.BiluoPushDown.get_doc_labels", __pyx_clineno, __pyx_lineno, __pyx_filename); + __Pyx_RefNannyFinishContext(); + return NULL; + __pyx_L4_argument_unpacking_done:; + __pyx_r = __pyx_pf_5spacy_8pipeline_17_parser_internals_3ner_13BiluoPushDown_4get_doc_labels(((struct __pyx_obj_5spacy_8pipeline_17_parser_internals_3ner_BiluoPushDown *)__pyx_v_self), __pyx_v_doc); + + /* 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_5spacy_8pipeline_17_parser_internals_3ner_13BiluoPushDown_4get_doc_labels(CYTHON_UNUSED struct __pyx_obj_5spacy_8pipeline_17_parser_internals_3ner_BiluoPushDown *__pyx_v_self, PyObject *__pyx_v_doc) { + PyObject *__pyx_v_labels = NULL; + PyObject *__pyx_v_token = NULL; + PyObject *__pyx_r = NULL; + __Pyx_RefNannyDeclarations + PyObject *__pyx_t_1 = NULL; + Py_ssize_t __pyx_t_2; + PyObject *(*__pyx_t_3)(PyObject *); + PyObject *__pyx_t_4 = NULL; + int __pyx_t_5; + int __pyx_t_6; + int __pyx_lineno = 0; + const char *__pyx_filename = NULL; + int __pyx_clineno = 0; + __Pyx_RefNannySetupContext("get_doc_labels", 0); + + /* "spacy/pipeline/_parser_internals/ner.pyx":159 + * + * def get_doc_labels(self, doc): + * labels = set() # <<<<<<<<<<<<<< + * for token in doc: + * if token.ent_type: +*/ + __pyx_t_1 = PySet_New(0); if (unlikely(!__pyx_t_1)) __PYX_ERR(0, 159, __pyx_L1_error) + __Pyx_GOTREF(__pyx_t_1); + __pyx_v_labels = ((PyObject*)__pyx_t_1); + __pyx_t_1 = 0; + + /* "spacy/pipeline/_parser_internals/ner.pyx":160 + * def get_doc_labels(self, doc): + * labels = set() + * for token in doc: # <<<<<<<<<<<<<< + * if token.ent_type: + * labels.add(token.ent_type_) +*/ + if (likely(PyList_CheckExact(__pyx_v_doc)) || PyTuple_CheckExact(__pyx_v_doc)) { + __pyx_t_1 = __pyx_v_doc; __Pyx_INCREF(__pyx_t_1); + __pyx_t_2 = 0; + __pyx_t_3 = NULL; + } else { + __pyx_t_2 = -1; __pyx_t_1 = PyObject_GetIter(__pyx_v_doc); if (unlikely(!__pyx_t_1)) __PYX_ERR(0, 160, __pyx_L1_error) + __Pyx_GOTREF(__pyx_t_1); + __pyx_t_3 = (CYTHON_COMPILING_IN_LIMITED_API) ? PyIter_Next : __Pyx_PyObject_GetIterNextFunc(__pyx_t_1); if (unlikely(!__pyx_t_3)) __PYX_ERR(0, 160, __pyx_L1_error) + } + for (;;) { + if (likely(!__pyx_t_3)) { + if (likely(PyList_CheckExact(__pyx_t_1))) { + { + Py_ssize_t __pyx_temp = __Pyx_PyList_GET_SIZE(__pyx_t_1); + #if !CYTHON_ASSUME_SAFE_SIZE + if (unlikely((__pyx_temp < 0))) __PYX_ERR(0, 160, __pyx_L1_error) + #endif + if (__pyx_t_2 >= __pyx_temp) break; + } + __pyx_t_4 = __Pyx_PyList_GetItemRefFast(__pyx_t_1, __pyx_t_2, __Pyx_ReferenceSharing_OwnStrongReference); + ++__pyx_t_2; + } else { + { + Py_ssize_t __pyx_temp = __Pyx_PyTuple_GET_SIZE(__pyx_t_1); + #if !CYTHON_ASSUME_SAFE_SIZE + if (unlikely((__pyx_temp < 0))) __PYX_ERR(0, 160, __pyx_L1_error) + #endif + if (__pyx_t_2 >= __pyx_temp) break; + } + #if CYTHON_ASSUME_SAFE_MACROS && !CYTHON_AVOID_BORROWED_REFS + __pyx_t_4 = __Pyx_NewRef(PyTuple_GET_ITEM(__pyx_t_1, __pyx_t_2)); + #else + __pyx_t_4 = __Pyx_PySequence_ITEM(__pyx_t_1, __pyx_t_2); + #endif + ++__pyx_t_2; + } + if (unlikely(!__pyx_t_4)) __PYX_ERR(0, 160, __pyx_L1_error) + } else { + __pyx_t_4 = __pyx_t_3(__pyx_t_1); + if (unlikely(!__pyx_t_4)) { + PyObject* exc_type = PyErr_Occurred(); + if (exc_type) { + if (unlikely(!__Pyx_PyErr_GivenExceptionMatches(exc_type, PyExc_StopIteration))) __PYX_ERR(0, 160, __pyx_L1_error) + PyErr_Clear(); + } + break; + } + } + __Pyx_GOTREF(__pyx_t_4); + __Pyx_XDECREF_SET(__pyx_v_token, __pyx_t_4); + __pyx_t_4 = 0; + + /* "spacy/pipeline/_parser_internals/ner.pyx":161 + * labels = set() + * for token in doc: + * if token.ent_type: # <<<<<<<<<<<<<< + * labels.add(token.ent_type_) + * return labels +*/ + __pyx_t_4 = __Pyx_PyObject_GetAttrStr(__pyx_v_token, __pyx_mstate_global->__pyx_n_u_ent_type_2); if (unlikely(!__pyx_t_4)) __PYX_ERR(0, 161, __pyx_L1_error) + __Pyx_GOTREF(__pyx_t_4); + __pyx_t_5 = __Pyx_PyObject_IsTrue(__pyx_t_4); if (unlikely((__pyx_t_5 < 0))) __PYX_ERR(0, 161, __pyx_L1_error) + __Pyx_DECREF(__pyx_t_4); __pyx_t_4 = 0; + if (__pyx_t_5) { + + /* "spacy/pipeline/_parser_internals/ner.pyx":162 + * for token in doc: + * if token.ent_type: + * labels.add(token.ent_type_) # <<<<<<<<<<<<<< + * return labels + * +*/ + __pyx_t_4 = __Pyx_PyObject_GetAttrStr(__pyx_v_token, __pyx_mstate_global->__pyx_n_u_ent_type); if (unlikely(!__pyx_t_4)) __PYX_ERR(0, 162, __pyx_L1_error) + __Pyx_GOTREF(__pyx_t_4); + __pyx_t_6 = PySet_Add(__pyx_v_labels, __pyx_t_4); if (unlikely(__pyx_t_6 == ((int)-1))) __PYX_ERR(0, 162, __pyx_L1_error) + __Pyx_DECREF(__pyx_t_4); __pyx_t_4 = 0; + + /* "spacy/pipeline/_parser_internals/ner.pyx":161 + * labels = set() + * for token in doc: + * if token.ent_type: # <<<<<<<<<<<<<< + * labels.add(token.ent_type_) + * return labels +*/ + } + + /* "spacy/pipeline/_parser_internals/ner.pyx":160 + * def get_doc_labels(self, doc): + * labels = set() + * for token in doc: # <<<<<<<<<<<<<< + * if token.ent_type: + * labels.add(token.ent_type_) +*/ + } + __Pyx_DECREF(__pyx_t_1); __pyx_t_1 = 0; + + /* "spacy/pipeline/_parser_internals/ner.pyx":163 + * if token.ent_type: + * labels.add(token.ent_type_) + * return labels # <<<<<<<<<<<<<< + * + * def move_name(self, int move, attr_t label): +*/ + __Pyx_XDECREF(__pyx_r); + __Pyx_INCREF(__pyx_v_labels); + __pyx_r = __pyx_v_labels; + goto __pyx_L0; + + /* "spacy/pipeline/_parser_internals/ner.pyx":158 + * return (BEGIN, IN, LAST, UNIT, OUT) + * + * def get_doc_labels(self, doc): # <<<<<<<<<<<<<< + * labels = set() + * for token in doc: +*/ + + /* function exit code */ + __pyx_L1_error:; + __Pyx_XDECREF(__pyx_t_1); + __Pyx_XDECREF(__pyx_t_4); + __Pyx_AddTraceback("spacy.pipeline._parser_internals.ner.BiluoPushDown.get_doc_labels", __pyx_clineno, __pyx_lineno, __pyx_filename); + __pyx_r = NULL; + __pyx_L0:; + __Pyx_XDECREF(__pyx_v_labels); + __Pyx_XDECREF(__pyx_v_token); + __Pyx_XGIVEREF(__pyx_r); + __Pyx_RefNannyFinishContext(); + return __pyx_r; +} + +/* "spacy/pipeline/_parser_internals/ner.pyx":165 + * return labels + * + * def move_name(self, int move, attr_t label): # <<<<<<<<<<<<<< + * if move == OUT: + * return 'O' +*/ + +/* Python wrapper */ +static PyObject *__pyx_pw_5spacy_8pipeline_17_parser_internals_3ner_13BiluoPushDown_7move_name(PyObject *__pyx_v_self, +#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_5spacy_8pipeline_17_parser_internals_3ner_13BiluoPushDown_6move_name, "BiluoPushDown.move_name(self, int move, attr_t label)"); +static PyMethodDef __pyx_mdef_5spacy_8pipeline_17_parser_internals_3ner_13BiluoPushDown_7move_name = {"move_name", (PyCFunction)(void(*)(void))(__Pyx_PyCFunction_FastCallWithKeywords)__pyx_pw_5spacy_8pipeline_17_parser_internals_3ner_13BiluoPushDown_7move_name, __Pyx_METH_FASTCALL|METH_KEYWORDS, __pyx_doc_5spacy_8pipeline_17_parser_internals_3ner_13BiluoPushDown_6move_name}; +static PyObject *__pyx_pw_5spacy_8pipeline_17_parser_internals_3ner_13BiluoPushDown_7move_name(PyObject *__pyx_v_self, +#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_move; + __pyx_t_5spacy_8typedefs_attr_t __pyx_v_label; + #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("move_name (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_move,&__pyx_mstate_global->__pyx_n_u_label,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, 165, __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, 165, __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, 165, __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, "move_name", 0) < (0)) __PYX_ERR(0, 165, __pyx_L3_error) + for (Py_ssize_t i = __pyx_nargs; i < 2; i++) { + if (unlikely(!values[i])) { __Pyx_RaiseArgtupleInvalid("move_name", 1, 2, 2, i); __PYX_ERR(0, 165, __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, 165, __pyx_L3_error) + values[1] = __Pyx_ArgRef_FASTCALL(__pyx_args, 1); + if (!CYTHON_ASSUME_SAFE_MACROS && unlikely(!values[1])) __PYX_ERR(0, 165, __pyx_L3_error) + } + __pyx_v_move = __Pyx_PyLong_As_int(values[0]); if (unlikely((__pyx_v_move == (int)-1) && PyErr_Occurred())) __PYX_ERR(0, 165, __pyx_L3_error) + __pyx_v_label = __Pyx_PyLong_As_uint64_t(values[1]); if (unlikely((__pyx_v_label == ((uint64_t)-1)) && PyErr_Occurred())) __PYX_ERR(0, 165, __pyx_L3_error) + } + goto __pyx_L6_skip; + __pyx_L5_argtuple_error:; + __Pyx_RaiseArgtupleInvalid("move_name", 1, 2, 2, __pyx_nargs); __PYX_ERR(0, 165, __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("spacy.pipeline._parser_internals.ner.BiluoPushDown.move_name", __pyx_clineno, __pyx_lineno, __pyx_filename); + __Pyx_RefNannyFinishContext(); + return NULL; + __pyx_L4_argument_unpacking_done:; + __pyx_r = __pyx_pf_5spacy_8pipeline_17_parser_internals_3ner_13BiluoPushDown_6move_name(((struct __pyx_obj_5spacy_8pipeline_17_parser_internals_3ner_BiluoPushDown *)__pyx_v_self), __pyx_v_move, __pyx_v_label); + + /* 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_5spacy_8pipeline_17_parser_internals_3ner_13BiluoPushDown_6move_name(struct __pyx_obj_5spacy_8pipeline_17_parser_internals_3ner_BiluoPushDown *__pyx_v_self, int __pyx_v_move, __pyx_t_5spacy_8typedefs_attr_t __pyx_v_label) { + PyObject *__pyx_r = NULL; + __Pyx_RefNannyDeclarations + PyObject *__pyx_t_1 = NULL; + PyObject *__pyx_t_2 = NULL; + PyObject *__pyx_t_3 = NULL; + int __pyx_lineno = 0; + const char *__pyx_filename = NULL; + int __pyx_clineno = 0; + __Pyx_RefNannySetupContext("move_name", 0); + + /* "spacy/pipeline/_parser_internals/ner.pyx":166 + * + * def move_name(self, int move, attr_t label): + * if move == OUT: # <<<<<<<<<<<<<< + * return 'O' + * elif move == MISSING: +*/ + switch (__pyx_v_move) { + case __pyx_e_5spacy_8pipeline_17_parser_internals_3ner_OUT: + + /* "spacy/pipeline/_parser_internals/ner.pyx":167 + * def move_name(self, int move, attr_t label): + * if move == OUT: + * return 'O' # <<<<<<<<<<<<<< + * elif move == MISSING: + * return 'M' +*/ + __Pyx_XDECREF(__pyx_r); + __Pyx_INCREF(__pyx_mstate_global->__pyx_n_u_O); + __pyx_r = __pyx_mstate_global->__pyx_n_u_O; + goto __pyx_L0; + + /* "spacy/pipeline/_parser_internals/ner.pyx":166 + * + * def move_name(self, int move, attr_t label): + * if move == OUT: # <<<<<<<<<<<<<< + * return 'O' + * elif move == MISSING: +*/ + break; + case __pyx_e_5spacy_8pipeline_17_parser_internals_3ner_MISSING: + + /* "spacy/pipeline/_parser_internals/ner.pyx":169 + * return 'O' + * elif move == MISSING: + * return 'M' # <<<<<<<<<<<<<< + * else: + * return MOVE_NAMES[move] + '-' + self.strings[label] +*/ + __Pyx_XDECREF(__pyx_r); + __Pyx_INCREF(__pyx_mstate_global->__pyx_n_u_M); + __pyx_r = __pyx_mstate_global->__pyx_n_u_M; + goto __pyx_L0; + + /* "spacy/pipeline/_parser_internals/ner.pyx":168 + * if move == OUT: + * return 'O' + * elif move == MISSING: # <<<<<<<<<<<<<< + * return 'M' + * else: +*/ + break; + default: + + /* "spacy/pipeline/_parser_internals/ner.pyx":171 + * return 'M' + * else: + * return MOVE_NAMES[move] + '-' + self.strings[label] # <<<<<<<<<<<<<< + * + * def init_gold_batch(self, examples): +*/ + __Pyx_XDECREF(__pyx_r); + __Pyx_GetModuleGlobalName(__pyx_t_1, __pyx_mstate_global->__pyx_n_u_MOVE_NAMES); if (unlikely(!__pyx_t_1)) __PYX_ERR(0, 171, __pyx_L1_error) + __Pyx_GOTREF(__pyx_t_1); + __pyx_t_2 = __Pyx_GetItemInt(__pyx_t_1, __pyx_v_move, int, 1, __Pyx_PyLong_From_int, 0, 1, 1, 1, __Pyx_ReferenceSharing_OwnStrongReference); if (unlikely(!__pyx_t_2)) __PYX_ERR(0, 171, __pyx_L1_error) + __Pyx_GOTREF(__pyx_t_2); + __Pyx_DECREF(__pyx_t_1); __pyx_t_1 = 0; + __pyx_t_1 = PyNumber_Add(__pyx_t_2, __pyx_mstate_global->__pyx_kp_u__7); if (unlikely(!__pyx_t_1)) __PYX_ERR(0, 171, __pyx_L1_error) + __Pyx_GOTREF(__pyx_t_1); + __Pyx_DECREF(__pyx_t_2); __pyx_t_2 = 0; + __pyx_t_2 = __Pyx_GetItemInt(((PyObject *)__pyx_v_self->__pyx_base.strings), __pyx_v_label, __pyx_t_5spacy_8typedefs_attr_t, 0, __Pyx_PyLong_From_uint64_t, 0, 0, 1, 1, __Pyx_ReferenceSharing_SharedReference); if (unlikely(!__pyx_t_2)) __PYX_ERR(0, 171, __pyx_L1_error) + __Pyx_GOTREF(__pyx_t_2); + __pyx_t_3 = PyNumber_Add(__pyx_t_1, __pyx_t_2); if (unlikely(!__pyx_t_3)) __PYX_ERR(0, 171, __pyx_L1_error) + __Pyx_GOTREF(__pyx_t_3); + __Pyx_DECREF(__pyx_t_1); __pyx_t_1 = 0; + __Pyx_DECREF(__pyx_t_2); __pyx_t_2 = 0; + __pyx_r = __pyx_t_3; + __pyx_t_3 = 0; + goto __pyx_L0; + break; + } + + /* "spacy/pipeline/_parser_internals/ner.pyx":165 + * return labels + * + * def move_name(self, int move, attr_t label): # <<<<<<<<<<<<<< + * if move == OUT: + * return 'O' +*/ + + /* function exit code */ + __pyx_L1_error:; + __Pyx_XDECREF(__pyx_t_1); + __Pyx_XDECREF(__pyx_t_2); + __Pyx_XDECREF(__pyx_t_3); + __Pyx_AddTraceback("spacy.pipeline._parser_internals.ner.BiluoPushDown.move_name", __pyx_clineno, __pyx_lineno, __pyx_filename); + __pyx_r = NULL; + __pyx_L0:; + __Pyx_XGIVEREF(__pyx_r); + __Pyx_RefNannyFinishContext(); + return __pyx_r; +} + +/* "spacy/pipeline/_parser_internals/ner.pyx":173 + * return MOVE_NAMES[move] + '-' + self.strings[label] + * + * def init_gold_batch(self, examples): # <<<<<<<<<<<<<< + * all_states = self.init_batch([eg.predicted for eg in examples]) + * golds = [] +*/ + +/* Python wrapper */ +static PyObject *__pyx_pw_5spacy_8pipeline_17_parser_internals_3ner_13BiluoPushDown_9init_gold_batch(PyObject *__pyx_v_self, +#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_5spacy_8pipeline_17_parser_internals_3ner_13BiluoPushDown_8init_gold_batch, "BiluoPushDown.init_gold_batch(self, examples)"); +static PyMethodDef __pyx_mdef_5spacy_8pipeline_17_parser_internals_3ner_13BiluoPushDown_9init_gold_batch = {"init_gold_batch", (PyCFunction)(void(*)(void))(__Pyx_PyCFunction_FastCallWithKeywords)__pyx_pw_5spacy_8pipeline_17_parser_internals_3ner_13BiluoPushDown_9init_gold_batch, __Pyx_METH_FASTCALL|METH_KEYWORDS, __pyx_doc_5spacy_8pipeline_17_parser_internals_3ner_13BiluoPushDown_8init_gold_batch}; +static PyObject *__pyx_pw_5spacy_8pipeline_17_parser_internals_3ner_13BiluoPushDown_9init_gold_batch(PyObject *__pyx_v_self, +#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_examples = 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("init_gold_batch (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_examples,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, 173, __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, 173, __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_gold_batch", 0) < (0)) __PYX_ERR(0, 173, __pyx_L3_error) + for (Py_ssize_t i = __pyx_nargs; i < 1; i++) { + if (unlikely(!values[i])) { __Pyx_RaiseArgtupleInvalid("init_gold_batch", 1, 1, 1, i); __PYX_ERR(0, 173, __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, 173, __pyx_L3_error) + } + __pyx_v_examples = values[0]; + } + goto __pyx_L6_skip; + __pyx_L5_argtuple_error:; + __Pyx_RaiseArgtupleInvalid("init_gold_batch", 1, 1, 1, __pyx_nargs); __PYX_ERR(0, 173, __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("spacy.pipeline._parser_internals.ner.BiluoPushDown.init_gold_batch", __pyx_clineno, __pyx_lineno, __pyx_filename); + __Pyx_RefNannyFinishContext(); + return NULL; + __pyx_L4_argument_unpacking_done:; + __pyx_r = __pyx_pf_5spacy_8pipeline_17_parser_internals_3ner_13BiluoPushDown_8init_gold_batch(((struct __pyx_obj_5spacy_8pipeline_17_parser_internals_3ner_BiluoPushDown *)__pyx_v_self), __pyx_v_examples); + + /* 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_5spacy_8pipeline_17_parser_internals_3ner_13BiluoPushDown_8init_gold_batch(struct __pyx_obj_5spacy_8pipeline_17_parser_internals_3ner_BiluoPushDown *__pyx_v_self, PyObject *__pyx_v_examples) { + PyObject *__pyx_v_all_states = NULL; + PyObject *__pyx_v_golds = NULL; + PyObject *__pyx_v_states = NULL; + PyObject *__pyx_v_state = NULL; + PyObject *__pyx_v_eg = NULL; + PyObject *__pyx_v_n_steps = NULL; + PyObject *__pyx_v_s = NULL; + PyObject *__pyx_r = NULL; + __Pyx_RefNannyDeclarations + PyObject *__pyx_t_1 = NULL; + PyObject *__pyx_t_2 = NULL; + PyObject *__pyx_t_3 = NULL; + PyObject *__pyx_t_4 = NULL; + Py_ssize_t __pyx_t_5; + PyObject *(*__pyx_t_6)(PyObject *); + PyObject *__pyx_t_7 = NULL; + size_t __pyx_t_8; + PyObject *(*__pyx_t_9)(PyObject *); + int __pyx_t_10; + int __pyx_t_11; + int __pyx_t_12; + int __pyx_t_13; + Py_ssize_t __pyx_t_14; + int __pyx_lineno = 0; + const char *__pyx_filename = NULL; + int __pyx_clineno = 0; + __Pyx_RefNannySetupContext("init_gold_batch", 0); + + /* "spacy/pipeline/_parser_internals/ner.pyx":174 + * + * def init_gold_batch(self, examples): + * all_states = self.init_batch([eg.predicted for eg in examples]) # <<<<<<<<<<<<<< + * golds = [] + * states = [] +*/ + __pyx_t_2 = ((PyObject *)__pyx_v_self); + __Pyx_INCREF(__pyx_t_2); + __pyx_t_3 = PyList_New(0); if (unlikely(!__pyx_t_3)) __PYX_ERR(0, 174, __pyx_L1_error) + __Pyx_GOTREF(__pyx_t_3); + if (likely(PyList_CheckExact(__pyx_v_examples)) || PyTuple_CheckExact(__pyx_v_examples)) { + __pyx_t_4 = __pyx_v_examples; __Pyx_INCREF(__pyx_t_4); + __pyx_t_5 = 0; + __pyx_t_6 = NULL; + } else { + __pyx_t_5 = -1; __pyx_t_4 = PyObject_GetIter(__pyx_v_examples); if (unlikely(!__pyx_t_4)) __PYX_ERR(0, 174, __pyx_L1_error) + __Pyx_GOTREF(__pyx_t_4); + __pyx_t_6 = (CYTHON_COMPILING_IN_LIMITED_API) ? PyIter_Next : __Pyx_PyObject_GetIterNextFunc(__pyx_t_4); if (unlikely(!__pyx_t_6)) __PYX_ERR(0, 174, __pyx_L1_error) + } + for (;;) { + if (likely(!__pyx_t_6)) { + if (likely(PyList_CheckExact(__pyx_t_4))) { + { + Py_ssize_t __pyx_temp = __Pyx_PyList_GET_SIZE(__pyx_t_4); + #if !CYTHON_ASSUME_SAFE_SIZE + if (unlikely((__pyx_temp < 0))) __PYX_ERR(0, 174, __pyx_L1_error) + #endif + if (__pyx_t_5 >= __pyx_temp) break; + } + __pyx_t_7 = __Pyx_PyList_GetItemRefFast(__pyx_t_4, __pyx_t_5, __Pyx_ReferenceSharing_OwnStrongReference); + ++__pyx_t_5; + } else { + { + Py_ssize_t __pyx_temp = __Pyx_PyTuple_GET_SIZE(__pyx_t_4); + #if !CYTHON_ASSUME_SAFE_SIZE + if (unlikely((__pyx_temp < 0))) __PYX_ERR(0, 174, __pyx_L1_error) + #endif + if (__pyx_t_5 >= __pyx_temp) break; + } + #if CYTHON_ASSUME_SAFE_MACROS && !CYTHON_AVOID_BORROWED_REFS + __pyx_t_7 = __Pyx_NewRef(PyTuple_GET_ITEM(__pyx_t_4, __pyx_t_5)); + #else + __pyx_t_7 = __Pyx_PySequence_ITEM(__pyx_t_4, __pyx_t_5); + #endif + ++__pyx_t_5; + } + if (unlikely(!__pyx_t_7)) __PYX_ERR(0, 174, __pyx_L1_error) + } else { + __pyx_t_7 = __pyx_t_6(__pyx_t_4); + if (unlikely(!__pyx_t_7)) { + PyObject* exc_type = PyErr_Occurred(); + if (exc_type) { + if (unlikely(!__Pyx_PyErr_GivenExceptionMatches(exc_type, PyExc_StopIteration))) __PYX_ERR(0, 174, __pyx_L1_error) + PyErr_Clear(); + } + break; + } + } + __Pyx_GOTREF(__pyx_t_7); + __Pyx_XDECREF_SET(__pyx_v_eg, __pyx_t_7); + __pyx_t_7 = 0; + __pyx_t_7 = __Pyx_PyObject_GetAttrStr(__pyx_v_eg, __pyx_mstate_global->__pyx_n_u_predicted); if (unlikely(!__pyx_t_7)) __PYX_ERR(0, 174, __pyx_L1_error) + __Pyx_GOTREF(__pyx_t_7); + if (unlikely(__Pyx_ListComp_Append(__pyx_t_3, (PyObject*)__pyx_t_7))) __PYX_ERR(0, 174, __pyx_L1_error) + __Pyx_DECREF(__pyx_t_7); __pyx_t_7 = 0; + } + __Pyx_DECREF(__pyx_t_4); __pyx_t_4 = 0; + __pyx_t_8 = 0; + { + PyObject *__pyx_callargs[2] = {__pyx_t_2, __pyx_t_3}; + __pyx_t_1 = __Pyx_PyObject_FastCallMethod((PyObject*)__pyx_mstate_global->__pyx_n_u_init_batch, __pyx_callargs+__pyx_t_8, (2-__pyx_t_8) | (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, 174, __pyx_L1_error) + __Pyx_GOTREF(__pyx_t_1); + } + __pyx_v_all_states = __pyx_t_1; + __pyx_t_1 = 0; + + /* "spacy/pipeline/_parser_internals/ner.pyx":175 + * def init_gold_batch(self, examples): + * all_states = self.init_batch([eg.predicted for eg in examples]) + * golds = [] # <<<<<<<<<<<<<< + * states = [] + * for state, eg in zip(all_states, examples): +*/ + __pyx_t_1 = PyList_New(0); if (unlikely(!__pyx_t_1)) __PYX_ERR(0, 175, __pyx_L1_error) + __Pyx_GOTREF(__pyx_t_1); + __pyx_v_golds = ((PyObject*)__pyx_t_1); + __pyx_t_1 = 0; + + /* "spacy/pipeline/_parser_internals/ner.pyx":176 + * all_states = self.init_batch([eg.predicted for eg in examples]) + * golds = [] + * states = [] # <<<<<<<<<<<<<< + * for state, eg in zip(all_states, examples): + * if self.has_gold(eg) and not state.is_final(): +*/ + __pyx_t_1 = PyList_New(0); if (unlikely(!__pyx_t_1)) __PYX_ERR(0, 176, __pyx_L1_error) + __Pyx_GOTREF(__pyx_t_1); + __pyx_v_states = ((PyObject*)__pyx_t_1); + __pyx_t_1 = 0; + + /* "spacy/pipeline/_parser_internals/ner.pyx":177 + * golds = [] + * states = [] + * for state, eg in zip(all_states, examples): # <<<<<<<<<<<<<< + * if self.has_gold(eg) and not state.is_final(): + * golds.append(self.init_gold(state, eg)) +*/ + __pyx_t_3 = NULL; + __pyx_t_8 = 1; + { + PyObject *__pyx_callargs[3] = {__pyx_t_3, __pyx_v_all_states, __pyx_v_examples}; + __pyx_t_1 = __Pyx_PyObject_FastCall((PyObject*)__pyx_builtin_zip, __pyx_callargs+__pyx_t_8, (3-__pyx_t_8) | (__pyx_t_8*__Pyx_PY_VECTORCALL_ARGUMENTS_OFFSET)); + __Pyx_XDECREF(__pyx_t_3); __pyx_t_3 = 0; + if (unlikely(!__pyx_t_1)) __PYX_ERR(0, 177, __pyx_L1_error) + __Pyx_GOTREF(__pyx_t_1); + } + if (likely(PyList_CheckExact(__pyx_t_1)) || PyTuple_CheckExact(__pyx_t_1)) { + __pyx_t_3 = __pyx_t_1; __Pyx_INCREF(__pyx_t_3); + __pyx_t_5 = 0; + __pyx_t_6 = NULL; + } else { + __pyx_t_5 = -1; __pyx_t_3 = PyObject_GetIter(__pyx_t_1); if (unlikely(!__pyx_t_3)) __PYX_ERR(0, 177, __pyx_L1_error) + __Pyx_GOTREF(__pyx_t_3); + __pyx_t_6 = (CYTHON_COMPILING_IN_LIMITED_API) ? PyIter_Next : __Pyx_PyObject_GetIterNextFunc(__pyx_t_3); if (unlikely(!__pyx_t_6)) __PYX_ERR(0, 177, __pyx_L1_error) + } + __Pyx_DECREF(__pyx_t_1); __pyx_t_1 = 0; + for (;;) { + if (likely(!__pyx_t_6)) { + 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, 177, __pyx_L1_error) + #endif + if (__pyx_t_5 >= __pyx_temp) break; + } + __pyx_t_1 = __Pyx_PyList_GetItemRefFast(__pyx_t_3, __pyx_t_5, __Pyx_ReferenceSharing_OwnStrongReference); + ++__pyx_t_5; + } 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, 177, __pyx_L1_error) + #endif + if (__pyx_t_5 >= __pyx_temp) break; + } + #if CYTHON_ASSUME_SAFE_MACROS && !CYTHON_AVOID_BORROWED_REFS + __pyx_t_1 = __Pyx_NewRef(PyTuple_GET_ITEM(__pyx_t_3, __pyx_t_5)); + #else + __pyx_t_1 = __Pyx_PySequence_ITEM(__pyx_t_3, __pyx_t_5); + #endif + ++__pyx_t_5; + } + if (unlikely(!__pyx_t_1)) __PYX_ERR(0, 177, __pyx_L1_error) + } else { + __pyx_t_1 = __pyx_t_6(__pyx_t_3); + if (unlikely(!__pyx_t_1)) { + PyObject* exc_type = PyErr_Occurred(); + if (exc_type) { + if (unlikely(!__Pyx_PyErr_GivenExceptionMatches(exc_type, PyExc_StopIteration))) __PYX_ERR(0, 177, __pyx_L1_error) + PyErr_Clear(); + } + break; + } + } + __Pyx_GOTREF(__pyx_t_1); + if ((likely(PyTuple_CheckExact(__pyx_t_1))) || (PyList_CheckExact(__pyx_t_1))) { + PyObject* sequence = __pyx_t_1; + 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, 177, __pyx_L1_error) + } + #if CYTHON_ASSUME_SAFE_MACROS && !CYTHON_AVOID_BORROWED_REFS + if (likely(PyTuple_CheckExact(sequence))) { + __pyx_t_2 = PyTuple_GET_ITEM(sequence, 0); + __Pyx_INCREF(__pyx_t_2); + __pyx_t_4 = PyTuple_GET_ITEM(sequence, 1); + __Pyx_INCREF(__pyx_t_4); + } else { + __pyx_t_2 = __Pyx_PyList_GetItemRefFast(sequence, 0, __Pyx_ReferenceSharing_SharedReference); + if (unlikely(!__pyx_t_2)) __PYX_ERR(0, 177, __pyx_L1_error) + __Pyx_XGOTREF(__pyx_t_2); + __pyx_t_4 = __Pyx_PyList_GetItemRefFast(sequence, 1, __Pyx_ReferenceSharing_SharedReference); + if (unlikely(!__pyx_t_4)) __PYX_ERR(0, 177, __pyx_L1_error) + __Pyx_XGOTREF(__pyx_t_4); + } + #else + __pyx_t_2 = __Pyx_PySequence_ITEM(sequence, 0); if (unlikely(!__pyx_t_2)) __PYX_ERR(0, 177, __pyx_L1_error) + __Pyx_GOTREF(__pyx_t_2); + __pyx_t_4 = __Pyx_PySequence_ITEM(sequence, 1); if (unlikely(!__pyx_t_4)) __PYX_ERR(0, 177, __pyx_L1_error) + __Pyx_GOTREF(__pyx_t_4); + #endif + __Pyx_DECREF(__pyx_t_1); __pyx_t_1 = 0; + } else { + Py_ssize_t index = -1; + __pyx_t_7 = PyObject_GetIter(__pyx_t_1); if (unlikely(!__pyx_t_7)) __PYX_ERR(0, 177, __pyx_L1_error) + __Pyx_GOTREF(__pyx_t_7); + __Pyx_DECREF(__pyx_t_1); __pyx_t_1 = 0; + __pyx_t_9 = (CYTHON_COMPILING_IN_LIMITED_API) ? PyIter_Next : __Pyx_PyObject_GetIterNextFunc(__pyx_t_7); + index = 0; __pyx_t_2 = __pyx_t_9(__pyx_t_7); if (unlikely(!__pyx_t_2)) goto __pyx_L8_unpacking_failed; + __Pyx_GOTREF(__pyx_t_2); + index = 1; __pyx_t_4 = __pyx_t_9(__pyx_t_7); if (unlikely(!__pyx_t_4)) goto __pyx_L8_unpacking_failed; + __Pyx_GOTREF(__pyx_t_4); + if (__Pyx_IternextUnpackEndCheck(__pyx_t_9(__pyx_t_7), 2) < (0)) __PYX_ERR(0, 177, __pyx_L1_error) + __pyx_t_9 = NULL; + __Pyx_DECREF(__pyx_t_7); __pyx_t_7 = 0; + goto __pyx_L9_unpacking_done; + __pyx_L8_unpacking_failed:; + __Pyx_DECREF(__pyx_t_7); __pyx_t_7 = 0; + __pyx_t_9 = NULL; + if (__Pyx_IterFinish() == 0) __Pyx_RaiseNeedMoreValuesError(index); + __PYX_ERR(0, 177, __pyx_L1_error) + __pyx_L9_unpacking_done:; + } + __Pyx_XDECREF_SET(__pyx_v_state, __pyx_t_2); + __pyx_t_2 = 0; + __Pyx_XDECREF_SET(__pyx_v_eg, __pyx_t_4); + __pyx_t_4 = 0; + + /* "spacy/pipeline/_parser_internals/ner.pyx":178 + * states = [] + * for state, eg in zip(all_states, examples): + * if self.has_gold(eg) and not state.is_final(): # <<<<<<<<<<<<<< + * golds.append(self.init_gold(state, eg)) + * states.append(state) +*/ + __pyx_t_4 = ((PyObject *)__pyx_v_self); + __Pyx_INCREF(__pyx_t_4); + __pyx_t_8 = 0; + { + PyObject *__pyx_callargs[2] = {__pyx_t_4, __pyx_v_eg}; + __pyx_t_1 = __Pyx_PyObject_FastCallMethod((PyObject*)__pyx_mstate_global->__pyx_n_u_has_gold, __pyx_callargs+__pyx_t_8, (2-__pyx_t_8) | (1*__Pyx_PY_VECTORCALL_ARGUMENTS_OFFSET)); + __Pyx_XDECREF(__pyx_t_4); __pyx_t_4 = 0; + if (unlikely(!__pyx_t_1)) __PYX_ERR(0, 178, __pyx_L1_error) + __Pyx_GOTREF(__pyx_t_1); + } + __pyx_t_11 = __Pyx_PyObject_IsTrue(__pyx_t_1); if (unlikely((__pyx_t_11 < 0))) __PYX_ERR(0, 178, __pyx_L1_error) + __Pyx_DECREF(__pyx_t_1); __pyx_t_1 = 0; + if (__pyx_t_11) { + } else { + __pyx_t_10 = __pyx_t_11; + goto __pyx_L11_bool_binop_done; + } + __pyx_t_4 = __pyx_v_state; + __Pyx_INCREF(__pyx_t_4); + __pyx_t_8 = 0; + { + PyObject *__pyx_callargs[2] = {__pyx_t_4, NULL}; + __pyx_t_1 = __Pyx_PyObject_FastCallMethod((PyObject*)__pyx_mstate_global->__pyx_n_u_is_final, __pyx_callargs+__pyx_t_8, (1-__pyx_t_8) | (1*__Pyx_PY_VECTORCALL_ARGUMENTS_OFFSET)); + __Pyx_XDECREF(__pyx_t_4); __pyx_t_4 = 0; + if (unlikely(!__pyx_t_1)) __PYX_ERR(0, 178, __pyx_L1_error) + __Pyx_GOTREF(__pyx_t_1); + } + __pyx_t_11 = __Pyx_PyObject_IsTrue(__pyx_t_1); if (unlikely((__pyx_t_11 < 0))) __PYX_ERR(0, 178, __pyx_L1_error) + __Pyx_DECREF(__pyx_t_1); __pyx_t_1 = 0; + __pyx_t_12 = (!__pyx_t_11); + __pyx_t_10 = __pyx_t_12; + __pyx_L11_bool_binop_done:; + if (__pyx_t_10) { + + /* "spacy/pipeline/_parser_internals/ner.pyx":179 + * for state, eg in zip(all_states, examples): + * if self.has_gold(eg) and not state.is_final(): + * golds.append(self.init_gold(state, eg)) # <<<<<<<<<<<<<< + * states.append(state) + * n_steps = sum([len(s.queue) for s in states]) +*/ + __pyx_t_4 = ((PyObject *)__pyx_v_self); + __Pyx_INCREF(__pyx_t_4); + __pyx_t_8 = 0; + { + PyObject *__pyx_callargs[3] = {__pyx_t_4, __pyx_v_state, __pyx_v_eg}; + __pyx_t_1 = __Pyx_PyObject_FastCallMethod((PyObject*)__pyx_mstate_global->__pyx_n_u_init_gold, __pyx_callargs+__pyx_t_8, (3-__pyx_t_8) | (1*__Pyx_PY_VECTORCALL_ARGUMENTS_OFFSET)); + __Pyx_XDECREF(__pyx_t_4); __pyx_t_4 = 0; + if (unlikely(!__pyx_t_1)) __PYX_ERR(0, 179, __pyx_L1_error) + __Pyx_GOTREF(__pyx_t_1); + } + __pyx_t_13 = __Pyx_PyList_Append(__pyx_v_golds, __pyx_t_1); if (unlikely(__pyx_t_13 == ((int)-1))) __PYX_ERR(0, 179, __pyx_L1_error) + __Pyx_DECREF(__pyx_t_1); __pyx_t_1 = 0; + + /* "spacy/pipeline/_parser_internals/ner.pyx":180 + * if self.has_gold(eg) and not state.is_final(): + * golds.append(self.init_gold(state, eg)) + * states.append(state) # <<<<<<<<<<<<<< + * n_steps = sum([len(s.queue) for s in states]) + * return states, golds, n_steps +*/ + __pyx_t_13 = __Pyx_PyList_Append(__pyx_v_states, __pyx_v_state); if (unlikely(__pyx_t_13 == ((int)-1))) __PYX_ERR(0, 180, __pyx_L1_error) + + /* "spacy/pipeline/_parser_internals/ner.pyx":178 + * states = [] + * for state, eg in zip(all_states, examples): + * if self.has_gold(eg) and not state.is_final(): # <<<<<<<<<<<<<< + * golds.append(self.init_gold(state, eg)) + * states.append(state) +*/ + } + + /* "spacy/pipeline/_parser_internals/ner.pyx":177 + * golds = [] + * states = [] + * for state, eg in zip(all_states, examples): # <<<<<<<<<<<<<< + * if self.has_gold(eg) and not state.is_final(): + * golds.append(self.init_gold(state, eg)) +*/ + } + __Pyx_DECREF(__pyx_t_3); __pyx_t_3 = 0; + + /* "spacy/pipeline/_parser_internals/ner.pyx":181 + * golds.append(self.init_gold(state, eg)) + * states.append(state) + * n_steps = sum([len(s.queue) for s in states]) # <<<<<<<<<<<<<< + * return states, golds, n_steps + * +*/ + __pyx_t_1 = NULL; + __pyx_t_4 = PyList_New(0); if (unlikely(!__pyx_t_4)) __PYX_ERR(0, 181, __pyx_L1_error) + __Pyx_GOTREF(__pyx_t_4); + __pyx_t_2 = __pyx_v_states; __Pyx_INCREF(__pyx_t_2); + __pyx_t_5 = 0; + for (;;) { + { + Py_ssize_t __pyx_temp = __Pyx_PyList_GET_SIZE(__pyx_t_2); + #if !CYTHON_ASSUME_SAFE_SIZE + if (unlikely((__pyx_temp < 0))) __PYX_ERR(0, 181, __pyx_L1_error) + #endif + if (__pyx_t_5 >= __pyx_temp) break; + } + __pyx_t_7 = __Pyx_PyList_GetItemRefFast(__pyx_t_2, __pyx_t_5, __Pyx_ReferenceSharing_OwnStrongReference); + ++__pyx_t_5; + if (unlikely(!__pyx_t_7)) __PYX_ERR(0, 181, __pyx_L1_error) + __Pyx_GOTREF(__pyx_t_7); + __Pyx_XDECREF_SET(__pyx_v_s, __pyx_t_7); + __pyx_t_7 = 0; + __pyx_t_7 = __Pyx_PyObject_GetAttrStr(__pyx_v_s, __pyx_mstate_global->__pyx_n_u_queue); if (unlikely(!__pyx_t_7)) __PYX_ERR(0, 181, __pyx_L1_error) + __Pyx_GOTREF(__pyx_t_7); + __pyx_t_14 = PyObject_Length(__pyx_t_7); if (unlikely(__pyx_t_14 == ((Py_ssize_t)-1))) __PYX_ERR(0, 181, __pyx_L1_error) + __Pyx_DECREF(__pyx_t_7); __pyx_t_7 = 0; + __pyx_t_7 = PyLong_FromSsize_t(__pyx_t_14); if (unlikely(!__pyx_t_7)) __PYX_ERR(0, 181, __pyx_L1_error) + __Pyx_GOTREF(__pyx_t_7); + if (unlikely(__Pyx_ListComp_Append(__pyx_t_4, (PyObject*)__pyx_t_7))) __PYX_ERR(0, 181, __pyx_L1_error) + __Pyx_DECREF(__pyx_t_7); __pyx_t_7 = 0; + } + __Pyx_DECREF(__pyx_t_2); __pyx_t_2 = 0; + __pyx_t_8 = 1; + { + PyObject *__pyx_callargs[2] = {__pyx_t_1, __pyx_t_4}; + __pyx_t_3 = __Pyx_PyObject_FastCall((PyObject*)__pyx_builtin_sum, __pyx_callargs+__pyx_t_8, (2-__pyx_t_8) | (__pyx_t_8*__Pyx_PY_VECTORCALL_ARGUMENTS_OFFSET)); + __Pyx_XDECREF(__pyx_t_1); __pyx_t_1 = 0; + __Pyx_DECREF(__pyx_t_4); __pyx_t_4 = 0; + if (unlikely(!__pyx_t_3)) __PYX_ERR(0, 181, __pyx_L1_error) + __Pyx_GOTREF(__pyx_t_3); + } + __pyx_v_n_steps = __pyx_t_3; + __pyx_t_3 = 0; + + /* "spacy/pipeline/_parser_internals/ner.pyx":182 + * states.append(state) + * n_steps = sum([len(s.queue) for s in states]) + * return states, golds, n_steps # <<<<<<<<<<<<<< + * + * cdef Transition lookup_transition(self, object name) except *: +*/ + __Pyx_XDECREF(__pyx_r); + __pyx_t_3 = PyTuple_New(3); if (unlikely(!__pyx_t_3)) __PYX_ERR(0, 182, __pyx_L1_error) + __Pyx_GOTREF(__pyx_t_3); + __Pyx_INCREF(__pyx_v_states); + __Pyx_GIVEREF(__pyx_v_states); + if (__Pyx_PyTuple_SET_ITEM(__pyx_t_3, 0, __pyx_v_states) != (0)) __PYX_ERR(0, 182, __pyx_L1_error); + __Pyx_INCREF(__pyx_v_golds); + __Pyx_GIVEREF(__pyx_v_golds); + if (__Pyx_PyTuple_SET_ITEM(__pyx_t_3, 1, __pyx_v_golds) != (0)) __PYX_ERR(0, 182, __pyx_L1_error); + __Pyx_INCREF(__pyx_v_n_steps); + __Pyx_GIVEREF(__pyx_v_n_steps); + if (__Pyx_PyTuple_SET_ITEM(__pyx_t_3, 2, __pyx_v_n_steps) != (0)) __PYX_ERR(0, 182, __pyx_L1_error); + __pyx_r = __pyx_t_3; + __pyx_t_3 = 0; + goto __pyx_L0; + + /* "spacy/pipeline/_parser_internals/ner.pyx":173 + * return MOVE_NAMES[move] + '-' + self.strings[label] + * + * def init_gold_batch(self, examples): # <<<<<<<<<<<<<< + * all_states = self.init_batch([eg.predicted for eg in examples]) + * golds = [] +*/ + + /* function exit code */ + __pyx_L1_error:; + __Pyx_XDECREF(__pyx_t_1); + __Pyx_XDECREF(__pyx_t_2); + __Pyx_XDECREF(__pyx_t_3); + __Pyx_XDECREF(__pyx_t_4); + __Pyx_XDECREF(__pyx_t_7); + __Pyx_AddTraceback("spacy.pipeline._parser_internals.ner.BiluoPushDown.init_gold_batch", __pyx_clineno, __pyx_lineno, __pyx_filename); + __pyx_r = NULL; + __pyx_L0:; + __Pyx_XDECREF(__pyx_v_all_states); + __Pyx_XDECREF(__pyx_v_golds); + __Pyx_XDECREF(__pyx_v_states); + __Pyx_XDECREF(__pyx_v_state); + __Pyx_XDECREF(__pyx_v_eg); + __Pyx_XDECREF(__pyx_v_n_steps); + __Pyx_XDECREF(__pyx_v_s); + __Pyx_XGIVEREF(__pyx_r); + __Pyx_RefNannyFinishContext(); + return __pyx_r; +} + +/* "spacy/pipeline/_parser_internals/ner.pyx":184 + * return states, golds, n_steps + * + * cdef Transition lookup_transition(self, object name) except *: # <<<<<<<<<<<<<< + * cdef attr_t label + * if name == '-' or name == '' or name is None: +*/ + +static struct __pyx_t_5spacy_8pipeline_17_parser_internals_17transition_system_Transition __pyx_f_5spacy_8pipeline_17_parser_internals_3ner_13BiluoPushDown_lookup_transition(struct __pyx_obj_5spacy_8pipeline_17_parser_internals_3ner_BiluoPushDown *__pyx_v_self, PyObject *__pyx_v_name) { + __pyx_t_5spacy_8typedefs_attr_t __pyx_v_label; + PyObject *__pyx_v_move_str = NULL; + PyObject *__pyx_v_label_str = NULL; + PyObject *__pyx_v_move = NULL; + int __pyx_v_i; + struct __pyx_t_5spacy_8pipeline_17_parser_internals_17transition_system_Transition __pyx_r; + __Pyx_RefNannyDeclarations + int __pyx_t_1; + int __pyx_t_2; + struct __pyx_t_5spacy_8pipeline_17_parser_internals_17transition_system_Transition __pyx_t_3; + PyObject *__pyx_t_4 = NULL; + PyObject *__pyx_t_5 = NULL; + PyObject *__pyx_t_6 = NULL; + size_t __pyx_t_7; + PyObject *__pyx_t_8 = NULL; + PyObject *(*__pyx_t_9)(PyObject *); + PyObject *__pyx_t_10 = NULL; + PyObject *__pyx_t_11 = NULL; + __pyx_t_5spacy_8typedefs_attr_t __pyx_t_12; + int __pyx_t_13; + int __pyx_t_14; + int __pyx_t_15; + int __pyx_lineno = 0; + const char *__pyx_filename = NULL; + int __pyx_clineno = 0; + __Pyx_RefNannySetupContext("lookup_transition", 0); + + /* "spacy/pipeline/_parser_internals/ner.pyx":186 + * cdef Transition lookup_transition(self, object name) except *: + * cdef attr_t label + * if name == '-' or name == '' or name is None: # <<<<<<<<<<<<<< + * return Transition(clas=0, move=MISSING, label=0, score=0) + * elif '-' in name: +*/ + __pyx_t_2 = (__Pyx_PyUnicode_Equals(__pyx_v_name, __pyx_mstate_global->__pyx_kp_u__7, Py_EQ)); if (unlikely((__pyx_t_2 < 0))) __PYX_ERR(0, 186, __pyx_L1_error) + if (!__pyx_t_2) { + } else { + __pyx_t_1 = __pyx_t_2; + goto __pyx_L4_bool_binop_done; + } + __pyx_t_2 = (__Pyx_PyUnicode_Equals(__pyx_v_name, __pyx_mstate_global->__pyx_kp_u__6, Py_EQ)); if (unlikely((__pyx_t_2 < 0))) __PYX_ERR(0, 186, __pyx_L1_error) + if (!__pyx_t_2) { + } else { + __pyx_t_1 = __pyx_t_2; + goto __pyx_L4_bool_binop_done; + } + __pyx_t_2 = (__pyx_v_name == Py_None); + __pyx_t_1 = __pyx_t_2; + __pyx_L4_bool_binop_done:; + if (__pyx_t_1) { + + /* "spacy/pipeline/_parser_internals/ner.pyx":187 + * cdef attr_t label + * if name == '-' or name == '' or name is None: + * return Transition(clas=0, move=MISSING, label=0, score=0) # <<<<<<<<<<<<<< + * elif '-' in name: + * move_str, label_str = split_bilu_label(name) +*/ + __pyx_t_3.clas = 0; + __pyx_t_3.move = __pyx_e_5spacy_8pipeline_17_parser_internals_3ner_MISSING; + __pyx_t_3.label = 0; + __pyx_t_3.score = 0.0; + __pyx_r = __pyx_t_3; + goto __pyx_L0; + + /* "spacy/pipeline/_parser_internals/ner.pyx":186 + * cdef Transition lookup_transition(self, object name) except *: + * cdef attr_t label + * if name == '-' or name == '' or name is None: # <<<<<<<<<<<<<< + * return Transition(clas=0, move=MISSING, label=0, score=0) + * elif '-' in name: +*/ + } + + /* "spacy/pipeline/_parser_internals/ner.pyx":188 + * if name == '-' or name == '' or name is None: + * return Transition(clas=0, move=MISSING, label=0, score=0) + * elif '-' in name: # <<<<<<<<<<<<<< + * move_str, label_str = split_bilu_label(name) + * # Deprecated, hacky way to denote 'not this entity' +*/ + __pyx_t_1 = (__Pyx_PySequence_ContainsTF(__pyx_mstate_global->__pyx_kp_u__7, __pyx_v_name, Py_EQ)); if (unlikely((__pyx_t_1 < 0))) __PYX_ERR(0, 188, __pyx_L1_error) + if (__pyx_t_1) { + + /* "spacy/pipeline/_parser_internals/ner.pyx":189 + * return Transition(clas=0, move=MISSING, label=0, score=0) + * elif '-' in name: + * move_str, label_str = split_bilu_label(name) # <<<<<<<<<<<<<< + * # Deprecated, hacky way to denote 'not this entity' + * if label_str.startswith('!'): +*/ + __pyx_t_5 = NULL; + __Pyx_GetModuleGlobalName(__pyx_t_6, __pyx_mstate_global->__pyx_n_u_split_bilu_label); if (unlikely(!__pyx_t_6)) __PYX_ERR(0, 189, __pyx_L1_error) + __Pyx_GOTREF(__pyx_t_6); + __pyx_t_7 = 1; + #if CYTHON_UNPACK_METHODS + if (unlikely(PyMethod_Check(__pyx_t_6))) { + __pyx_t_5 = PyMethod_GET_SELF(__pyx_t_6); + assert(__pyx_t_5); + PyObject* __pyx__function = PyMethod_GET_FUNCTION(__pyx_t_6); + __Pyx_INCREF(__pyx_t_5); + __Pyx_INCREF(__pyx__function); + __Pyx_DECREF_SET(__pyx_t_6, __pyx__function); + __pyx_t_7 = 0; + } + #endif + { + PyObject *__pyx_callargs[2] = {__pyx_t_5, __pyx_v_name}; + __pyx_t_4 = __Pyx_PyObject_FastCall((PyObject*)__pyx_t_6, __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; + __Pyx_DECREF(__pyx_t_6); __pyx_t_6 = 0; + if (unlikely(!__pyx_t_4)) __PYX_ERR(0, 189, __pyx_L1_error) + __Pyx_GOTREF(__pyx_t_4); + } + if ((likely(PyTuple_CheckExact(__pyx_t_4))) || (PyList_CheckExact(__pyx_t_4))) { + PyObject* sequence = __pyx_t_4; + 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, 189, __pyx_L1_error) + } + #if CYTHON_ASSUME_SAFE_MACROS && !CYTHON_AVOID_BORROWED_REFS + if (likely(PyTuple_CheckExact(sequence))) { + __pyx_t_6 = PyTuple_GET_ITEM(sequence, 0); + __Pyx_INCREF(__pyx_t_6); + __pyx_t_5 = PyTuple_GET_ITEM(sequence, 1); + __Pyx_INCREF(__pyx_t_5); + } else { + __pyx_t_6 = __Pyx_PyList_GetItemRefFast(sequence, 0, __Pyx_ReferenceSharing_SharedReference); + if (unlikely(!__pyx_t_6)) __PYX_ERR(0, 189, __pyx_L1_error) + __Pyx_XGOTREF(__pyx_t_6); + __pyx_t_5 = __Pyx_PyList_GetItemRefFast(sequence, 1, __Pyx_ReferenceSharing_SharedReference); + if (unlikely(!__pyx_t_5)) __PYX_ERR(0, 189, __pyx_L1_error) + __Pyx_XGOTREF(__pyx_t_5); + } + #else + __pyx_t_6 = __Pyx_PySequence_ITEM(sequence, 0); if (unlikely(!__pyx_t_6)) __PYX_ERR(0, 189, __pyx_L1_error) + __Pyx_GOTREF(__pyx_t_6); + __pyx_t_5 = __Pyx_PySequence_ITEM(sequence, 1); if (unlikely(!__pyx_t_5)) __PYX_ERR(0, 189, __pyx_L1_error) + __Pyx_GOTREF(__pyx_t_5); + #endif + __Pyx_DECREF(__pyx_t_4); __pyx_t_4 = 0; + } else { + Py_ssize_t index = -1; + __pyx_t_8 = PyObject_GetIter(__pyx_t_4); if (unlikely(!__pyx_t_8)) __PYX_ERR(0, 189, __pyx_L1_error) + __Pyx_GOTREF(__pyx_t_8); + __Pyx_DECREF(__pyx_t_4); __pyx_t_4 = 0; + __pyx_t_9 = (CYTHON_COMPILING_IN_LIMITED_API) ? PyIter_Next : __Pyx_PyObject_GetIterNextFunc(__pyx_t_8); + index = 0; __pyx_t_6 = __pyx_t_9(__pyx_t_8); if (unlikely(!__pyx_t_6)) goto __pyx_L7_unpacking_failed; + __Pyx_GOTREF(__pyx_t_6); + index = 1; __pyx_t_5 = __pyx_t_9(__pyx_t_8); if (unlikely(!__pyx_t_5)) goto __pyx_L7_unpacking_failed; + __Pyx_GOTREF(__pyx_t_5); + if (__Pyx_IternextUnpackEndCheck(__pyx_t_9(__pyx_t_8), 2) < (0)) __PYX_ERR(0, 189, __pyx_L1_error) + __pyx_t_9 = NULL; + __Pyx_DECREF(__pyx_t_8); __pyx_t_8 = 0; + goto __pyx_L8_unpacking_done; + __pyx_L7_unpacking_failed:; + __Pyx_DECREF(__pyx_t_8); __pyx_t_8 = 0; + __pyx_t_9 = NULL; + if (__Pyx_IterFinish() == 0) __Pyx_RaiseNeedMoreValuesError(index); + __PYX_ERR(0, 189, __pyx_L1_error) + __pyx_L8_unpacking_done:; + } + __pyx_v_move_str = __pyx_t_6; + __pyx_t_6 = 0; + __pyx_v_label_str = __pyx_t_5; + __pyx_t_5 = 0; + + /* "spacy/pipeline/_parser_internals/ner.pyx":191 + * move_str, label_str = split_bilu_label(name) + * # Deprecated, hacky way to denote 'not this entity' + * if label_str.startswith('!'): # <<<<<<<<<<<<<< + * raise ValueError(Errors.E869.format(label=name)) + * label = self.strings.add(label_str) +*/ + __pyx_t_5 = __pyx_v_label_str; + __Pyx_INCREF(__pyx_t_5); + __pyx_t_7 = 0; + { + PyObject *__pyx_callargs[2] = {__pyx_t_5, __pyx_mstate_global->__pyx_kp_u__8}; + __pyx_t_4 = __Pyx_PyObject_FastCallMethod((PyObject*)__pyx_mstate_global->__pyx_n_u_startswith, __pyx_callargs+__pyx_t_7, (2-__pyx_t_7) | (1*__Pyx_PY_VECTORCALL_ARGUMENTS_OFFSET)); + __Pyx_XDECREF(__pyx_t_5); __pyx_t_5 = 0; + if (unlikely(!__pyx_t_4)) __PYX_ERR(0, 191, __pyx_L1_error) + __Pyx_GOTREF(__pyx_t_4); + } + __pyx_t_1 = __Pyx_PyObject_IsTrue(__pyx_t_4); if (unlikely((__pyx_t_1 < 0))) __PYX_ERR(0, 191, __pyx_L1_error) + __Pyx_DECREF(__pyx_t_4); __pyx_t_4 = 0; + if (unlikely(__pyx_t_1)) { + + /* "spacy/pipeline/_parser_internals/ner.pyx":192 + * # Deprecated, hacky way to denote 'not this entity' + * if label_str.startswith('!'): + * raise ValueError(Errors.E869.format(label=name)) # <<<<<<<<<<<<<< + * label = self.strings.add(label_str) + * else: +*/ + __pyx_t_5 = NULL; + __Pyx_GetModuleGlobalName(__pyx_t_10, __pyx_mstate_global->__pyx_n_u_Errors); if (unlikely(!__pyx_t_10)) __PYX_ERR(0, 192, __pyx_L1_error) + __Pyx_GOTREF(__pyx_t_10); + __pyx_t_11 = __Pyx_PyObject_GetAttrStr(__pyx_t_10, __pyx_mstate_global->__pyx_n_u_E869); if (unlikely(!__pyx_t_11)) __PYX_ERR(0, 192, __pyx_L1_error) + __Pyx_GOTREF(__pyx_t_11); + __Pyx_DECREF(__pyx_t_10); __pyx_t_10 = 0; + __pyx_t_8 = __pyx_t_11; + __Pyx_INCREF(__pyx_t_8); + __pyx_t_7 = 0; + { + PyObject *__pyx_callargs[2 + ((CYTHON_VECTORCALL) ? 1 : 0)] = {__pyx_t_8, NULL}; + __pyx_t_10 = __Pyx_MakeVectorcallBuilderKwds(1); if (unlikely(!__pyx_t_10)) __PYX_ERR(0, 192, __pyx_L1_error) + __Pyx_GOTREF(__pyx_t_10); + if (__Pyx_VectorcallBuilder_AddArg(__pyx_mstate_global->__pyx_n_u_label, __pyx_v_name, __pyx_t_10, __pyx_callargs+1, 0) < (0)) __PYX_ERR(0, 192, __pyx_L1_error) + __pyx_t_6 = __Pyx_Object_VectorcallMethod_CallFromBuilder((PyObject*)__pyx_mstate_global->__pyx_n_u_format, __pyx_callargs+__pyx_t_7, (1-__pyx_t_7) | (1*__Pyx_PY_VECTORCALL_ARGUMENTS_OFFSET), __pyx_t_10); + __Pyx_XDECREF(__pyx_t_8); __pyx_t_8 = 0; + __Pyx_DECREF(__pyx_t_10); __pyx_t_10 = 0; + __Pyx_DECREF(__pyx_t_11); __pyx_t_11 = 0; + if (unlikely(!__pyx_t_6)) __PYX_ERR(0, 192, __pyx_L1_error) + __Pyx_GOTREF(__pyx_t_6); + } + __pyx_t_7 = 1; + { + PyObject *__pyx_callargs[2] = {__pyx_t_5, __pyx_t_6}; + __pyx_t_4 = __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_5); __pyx_t_5 = 0; + __Pyx_DECREF(__pyx_t_6); __pyx_t_6 = 0; + if (unlikely(!__pyx_t_4)) __PYX_ERR(0, 192, __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, 192, __pyx_L1_error) + + /* "spacy/pipeline/_parser_internals/ner.pyx":191 + * move_str, label_str = split_bilu_label(name) + * # Deprecated, hacky way to denote 'not this entity' + * if label_str.startswith('!'): # <<<<<<<<<<<<<< + * raise ValueError(Errors.E869.format(label=name)) + * label = self.strings.add(label_str) +*/ + } + + /* "spacy/pipeline/_parser_internals/ner.pyx":193 + * if label_str.startswith('!'): + * raise ValueError(Errors.E869.format(label=name)) + * label = self.strings.add(label_str) # <<<<<<<<<<<<<< + * else: + * move_str = name +*/ + __pyx_t_6 = ((PyObject *)__pyx_v_self->__pyx_base.strings); + __Pyx_INCREF(__pyx_t_6); + __pyx_t_7 = 0; + { + PyObject *__pyx_callargs[2] = {__pyx_t_6, __pyx_v_label_str}; + __pyx_t_4 = __Pyx_PyObject_FastCallMethod((PyObject*)__pyx_mstate_global->__pyx_n_u_add, __pyx_callargs+__pyx_t_7, (2-__pyx_t_7) | (1*__Pyx_PY_VECTORCALL_ARGUMENTS_OFFSET)); + __Pyx_XDECREF(__pyx_t_6); __pyx_t_6 = 0; + if (unlikely(!__pyx_t_4)) __PYX_ERR(0, 193, __pyx_L1_error) + __Pyx_GOTREF(__pyx_t_4); + } + __pyx_t_12 = __Pyx_PyLong_As_uint64_t(__pyx_t_4); if (unlikely((__pyx_t_12 == ((uint64_t)-1)) && PyErr_Occurred())) __PYX_ERR(0, 193, __pyx_L1_error) + __Pyx_DECREF(__pyx_t_4); __pyx_t_4 = 0; + __pyx_v_label = __pyx_t_12; + + /* "spacy/pipeline/_parser_internals/ner.pyx":188 + * if name == '-' or name == '' or name is None: + * return Transition(clas=0, move=MISSING, label=0, score=0) + * elif '-' in name: # <<<<<<<<<<<<<< + * move_str, label_str = split_bilu_label(name) + * # Deprecated, hacky way to denote 'not this entity' +*/ + goto __pyx_L3; + } + + /* "spacy/pipeline/_parser_internals/ner.pyx":195 + * label = self.strings.add(label_str) + * else: + * move_str = name # <<<<<<<<<<<<<< + * label = 0 + * move = MOVE_NAMES.index(move_str) +*/ + /*else*/ { + __Pyx_INCREF(__pyx_v_name); + __pyx_v_move_str = __pyx_v_name; + + /* "spacy/pipeline/_parser_internals/ner.pyx":196 + * else: + * move_str = name + * label = 0 # <<<<<<<<<<<<<< + * move = MOVE_NAMES.index(move_str) + * for i in range(self.n_moves): +*/ + __pyx_v_label = 0; + } + __pyx_L3:; + + /* "spacy/pipeline/_parser_internals/ner.pyx":197 + * move_str = name + * label = 0 + * move = MOVE_NAMES.index(move_str) # <<<<<<<<<<<<<< + * for i in range(self.n_moves): + * if self.c[i].move == move and self.c[i].label == label: +*/ + __pyx_t_6 = NULL; + __Pyx_GetModuleGlobalName(__pyx_t_5, __pyx_mstate_global->__pyx_n_u_MOVE_NAMES); if (unlikely(!__pyx_t_5)) __PYX_ERR(0, 197, __pyx_L1_error) + __Pyx_GOTREF(__pyx_t_5); + __pyx_t_11 = __Pyx_PyObject_GetAttrStr(__pyx_t_5, __pyx_mstate_global->__pyx_n_u_index); if (unlikely(!__pyx_t_11)) __PYX_ERR(0, 197, __pyx_L1_error) + __Pyx_GOTREF(__pyx_t_11); + __Pyx_DECREF(__pyx_t_5); __pyx_t_5 = 0; + __pyx_t_7 = 1; + #if CYTHON_UNPACK_METHODS + if (unlikely(PyMethod_Check(__pyx_t_11))) { + __pyx_t_6 = PyMethod_GET_SELF(__pyx_t_11); + assert(__pyx_t_6); + PyObject* __pyx__function = PyMethod_GET_FUNCTION(__pyx_t_11); + __Pyx_INCREF(__pyx_t_6); + __Pyx_INCREF(__pyx__function); + __Pyx_DECREF_SET(__pyx_t_11, __pyx__function); + __pyx_t_7 = 0; + } + #endif + { + PyObject *__pyx_callargs[2] = {__pyx_t_6, __pyx_v_move_str}; + __pyx_t_4 = __Pyx_PyObject_FastCall((PyObject*)__pyx_t_11, __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_11); __pyx_t_11 = 0; + if (unlikely(!__pyx_t_4)) __PYX_ERR(0, 197, __pyx_L1_error) + __Pyx_GOTREF(__pyx_t_4); + } + __pyx_v_move = __pyx_t_4; + __pyx_t_4 = 0; + + /* "spacy/pipeline/_parser_internals/ner.pyx":198 + * label = 0 + * move = MOVE_NAMES.index(move_str) + * for i in range(self.n_moves): # <<<<<<<<<<<<<< + * if self.c[i].move == move and self.c[i].label == label: + * return self.c[i] +*/ + __pyx_t_13 = __pyx_v_self->__pyx_base.n_moves; + __pyx_t_14 = __pyx_t_13; + for (__pyx_t_15 = 0; __pyx_t_15 < __pyx_t_14; __pyx_t_15+=1) { + __pyx_v_i = __pyx_t_15; + + /* "spacy/pipeline/_parser_internals/ner.pyx":199 + * move = MOVE_NAMES.index(move_str) + * for i in range(self.n_moves): + * if self.c[i].move == move and self.c[i].label == label: # <<<<<<<<<<<<<< + * return self.c[i] + * raise KeyError(Errors.E022.format(name=name)) +*/ + __pyx_t_4 = __Pyx_PyLong_From_int((__pyx_v_self->__pyx_base.c[__pyx_v_i]).move); if (unlikely(!__pyx_t_4)) __PYX_ERR(0, 199, __pyx_L1_error) + __Pyx_GOTREF(__pyx_t_4); + __pyx_t_11 = PyObject_RichCompare(__pyx_t_4, __pyx_v_move, Py_EQ); __Pyx_XGOTREF(__pyx_t_11); if (unlikely(!__pyx_t_11)) __PYX_ERR(0, 199, __pyx_L1_error) + __Pyx_DECREF(__pyx_t_4); __pyx_t_4 = 0; + __pyx_t_2 = __Pyx_PyObject_IsTrue(__pyx_t_11); if (unlikely((__pyx_t_2 < 0))) __PYX_ERR(0, 199, __pyx_L1_error) + __Pyx_DECREF(__pyx_t_11); __pyx_t_11 = 0; + if (__pyx_t_2) { + } else { + __pyx_t_1 = __pyx_t_2; + goto __pyx_L13_bool_binop_done; + } + __pyx_t_2 = ((__pyx_v_self->__pyx_base.c[__pyx_v_i]).label == __pyx_v_label); + __pyx_t_1 = __pyx_t_2; + __pyx_L13_bool_binop_done:; + if (__pyx_t_1) { + + /* "spacy/pipeline/_parser_internals/ner.pyx":200 + * for i in range(self.n_moves): + * if self.c[i].move == move and self.c[i].label == label: + * return self.c[i] # <<<<<<<<<<<<<< + * raise KeyError(Errors.E022.format(name=name)) + * +*/ + __pyx_r = (__pyx_v_self->__pyx_base.c[__pyx_v_i]); + goto __pyx_L0; + + /* "spacy/pipeline/_parser_internals/ner.pyx":199 + * move = MOVE_NAMES.index(move_str) + * for i in range(self.n_moves): + * if self.c[i].move == move and self.c[i].label == label: # <<<<<<<<<<<<<< + * return self.c[i] + * raise KeyError(Errors.E022.format(name=name)) +*/ + } + } + + /* "spacy/pipeline/_parser_internals/ner.pyx":201 + * if self.c[i].move == move and self.c[i].label == label: + * return self.c[i] + * raise KeyError(Errors.E022.format(name=name)) # <<<<<<<<<<<<<< + * + * cdef Transition init_transition(self, int clas, int move, attr_t label) except *: +*/ + __pyx_t_4 = NULL; + __Pyx_GetModuleGlobalName(__pyx_t_10, __pyx_mstate_global->__pyx_n_u_Errors); if (unlikely(!__pyx_t_10)) __PYX_ERR(0, 201, __pyx_L1_error) + __Pyx_GOTREF(__pyx_t_10); + __pyx_t_8 = __Pyx_PyObject_GetAttrStr(__pyx_t_10, __pyx_mstate_global->__pyx_n_u_E022); if (unlikely(!__pyx_t_8)) __PYX_ERR(0, 201, __pyx_L1_error) + __Pyx_GOTREF(__pyx_t_8); + __Pyx_DECREF(__pyx_t_10); __pyx_t_10 = 0; + __pyx_t_5 = __pyx_t_8; + __Pyx_INCREF(__pyx_t_5); + __pyx_t_7 = 0; + { + PyObject *__pyx_callargs[2 + ((CYTHON_VECTORCALL) ? 1 : 0)] = {__pyx_t_5, NULL}; + __pyx_t_10 = __Pyx_MakeVectorcallBuilderKwds(1); if (unlikely(!__pyx_t_10)) __PYX_ERR(0, 201, __pyx_L1_error) + __Pyx_GOTREF(__pyx_t_10); + if (__Pyx_VectorcallBuilder_AddArg(__pyx_mstate_global->__pyx_n_u_name, __pyx_v_name, __pyx_t_10, __pyx_callargs+1, 0) < (0)) __PYX_ERR(0, 201, __pyx_L1_error) + __pyx_t_6 = __Pyx_Object_VectorcallMethod_CallFromBuilder((PyObject*)__pyx_mstate_global->__pyx_n_u_format, __pyx_callargs+__pyx_t_7, (1-__pyx_t_7) | (1*__Pyx_PY_VECTORCALL_ARGUMENTS_OFFSET), __pyx_t_10); + __Pyx_XDECREF(__pyx_t_5); __pyx_t_5 = 0; + __Pyx_DECREF(__pyx_t_10); __pyx_t_10 = 0; + __Pyx_DECREF(__pyx_t_8); __pyx_t_8 = 0; + if (unlikely(!__pyx_t_6)) __PYX_ERR(0, 201, __pyx_L1_error) + __Pyx_GOTREF(__pyx_t_6); + } + __pyx_t_7 = 1; + { + PyObject *__pyx_callargs[2] = {__pyx_t_4, __pyx_t_6}; + __pyx_t_11 = __Pyx_PyObject_FastCall((PyObject*)(((PyTypeObject*)PyExc_KeyError)), __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_6); __pyx_t_6 = 0; + if (unlikely(!__pyx_t_11)) __PYX_ERR(0, 201, __pyx_L1_error) + __Pyx_GOTREF(__pyx_t_11); + } + __Pyx_Raise(__pyx_t_11, 0, 0, 0); + __Pyx_DECREF(__pyx_t_11); __pyx_t_11 = 0; + __PYX_ERR(0, 201, __pyx_L1_error) + + /* "spacy/pipeline/_parser_internals/ner.pyx":184 + * return states, golds, n_steps + * + * cdef Transition lookup_transition(self, object name) except *: # <<<<<<<<<<<<<< + * cdef attr_t label + * if name == '-' or name == '' or name is None: +*/ + + /* function exit code */ + __pyx_L1_error:; + __Pyx_XDECREF(__pyx_t_4); + __Pyx_XDECREF(__pyx_t_5); + __Pyx_XDECREF(__pyx_t_6); + __Pyx_XDECREF(__pyx_t_8); + __Pyx_XDECREF(__pyx_t_10); + __Pyx_XDECREF(__pyx_t_11); + __Pyx_AddTraceback("spacy.pipeline._parser_internals.ner.BiluoPushDown.lookup_transition", __pyx_clineno, __pyx_lineno, __pyx_filename); + __Pyx_pretend_to_initialize(&__pyx_r); + __pyx_L0:; + __Pyx_XDECREF(__pyx_v_move_str); + __Pyx_XDECREF(__pyx_v_label_str); + __Pyx_XDECREF(__pyx_v_move); + __Pyx_RefNannyFinishContext(); + return __pyx_r; +} + +/* "spacy/pipeline/_parser_internals/ner.pyx":203 + * raise KeyError(Errors.E022.format(name=name)) + * + * cdef Transition init_transition(self, int clas, int move, attr_t label) except *: # <<<<<<<<<<<<<< + * # TODO: Apparent Cython bug here when we try to use the Transition() + * # constructor with the function pointers +*/ + +static struct __pyx_t_5spacy_8pipeline_17_parser_internals_17transition_system_Transition __pyx_f_5spacy_8pipeline_17_parser_internals_3ner_13BiluoPushDown_init_transition(CYTHON_UNUSED struct __pyx_obj_5spacy_8pipeline_17_parser_internals_3ner_BiluoPushDown *__pyx_v_self, int __pyx_v_clas, int __pyx_v_move, __pyx_t_5spacy_8typedefs_attr_t __pyx_v_label) { + struct __pyx_t_5spacy_8pipeline_17_parser_internals_17transition_system_Transition __pyx_v_t; + struct __pyx_t_5spacy_8pipeline_17_parser_internals_17transition_system_Transition __pyx_r; + __Pyx_RefNannyDeclarations + PyObject *__pyx_t_1 = NULL; + PyObject *__pyx_t_2 = NULL; + PyObject *__pyx_t_3 = NULL; + PyObject *__pyx_t_4 = NULL; + PyObject *__pyx_t_5 = NULL; + PyObject *__pyx_t_6 = NULL; + size_t __pyx_t_7; + PyObject *__pyx_t_8 = NULL; + int __pyx_lineno = 0; + const char *__pyx_filename = NULL; + int __pyx_clineno = 0; + __Pyx_RefNannySetupContext("init_transition", 0); + + /* "spacy/pipeline/_parser_internals/ner.pyx":207 + * # constructor with the function pointers + * cdef Transition t + * t.score = 0 # <<<<<<<<<<<<<< + * t.clas = clas + * t.move = move +*/ + __pyx_v_t.score = 0.0; + + /* "spacy/pipeline/_parser_internals/ner.pyx":208 + * cdef Transition t + * t.score = 0 + * t.clas = clas # <<<<<<<<<<<<<< + * t.move = move + * t.label = label +*/ + __pyx_v_t.clas = __pyx_v_clas; + + /* "spacy/pipeline/_parser_internals/ner.pyx":209 + * t.score = 0 + * t.clas = clas + * t.move = move # <<<<<<<<<<<<<< + * t.label = label + * if move == MISSING: +*/ + __pyx_v_t.move = __pyx_v_move; + + /* "spacy/pipeline/_parser_internals/ner.pyx":210 + * t.clas = clas + * t.move = move + * t.label = label # <<<<<<<<<<<<<< + * if move == MISSING: + * t.is_valid = Missing.is_valid +*/ + __pyx_v_t.label = __pyx_v_label; + + /* "spacy/pipeline/_parser_internals/ner.pyx":211 + * t.move = move + * t.label = label + * if move == MISSING: # <<<<<<<<<<<<<< + * t.is_valid = Missing.is_valid + * t.do = Missing.transition +*/ + switch (__pyx_v_move) { + case __pyx_e_5spacy_8pipeline_17_parser_internals_3ner_MISSING: + + /* "spacy/pipeline/_parser_internals/ner.pyx":212 + * t.label = label + * if move == MISSING: + * t.is_valid = Missing.is_valid # <<<<<<<<<<<<<< + * t.do = Missing.transition + * t.get_cost = Missing.cost +*/ + __pyx_v_t.is_valid = __pyx_f_5spacy_8pipeline_17_parser_internals_3ner_7Missing_is_valid; + + /* "spacy/pipeline/_parser_internals/ner.pyx":213 + * if move == MISSING: + * t.is_valid = Missing.is_valid + * t.do = Missing.transition # <<<<<<<<<<<<<< + * t.get_cost = Missing.cost + * elif move == BEGIN: +*/ + __pyx_v_t.__pyx_do = __pyx_f_5spacy_8pipeline_17_parser_internals_3ner_7Missing_transition; + + /* "spacy/pipeline/_parser_internals/ner.pyx":214 + * t.is_valid = Missing.is_valid + * t.do = Missing.transition + * t.get_cost = Missing.cost # <<<<<<<<<<<<<< + * elif move == BEGIN: + * t.is_valid = Begin.is_valid +*/ + __pyx_v_t.get_cost = __pyx_f_5spacy_8pipeline_17_parser_internals_3ner_7Missing_cost; + + /* "spacy/pipeline/_parser_internals/ner.pyx":211 + * t.move = move + * t.label = label + * if move == MISSING: # <<<<<<<<<<<<<< + * t.is_valid = Missing.is_valid + * t.do = Missing.transition +*/ + break; + case __pyx_e_5spacy_8pipeline_17_parser_internals_3ner_BEGIN: + + /* "spacy/pipeline/_parser_internals/ner.pyx":216 + * t.get_cost = Missing.cost + * elif move == BEGIN: + * t.is_valid = Begin.is_valid # <<<<<<<<<<<<<< + * t.do = Begin.transition + * t.get_cost = Begin.cost +*/ + __pyx_v_t.is_valid = __pyx_f_5spacy_8pipeline_17_parser_internals_3ner_5Begin_is_valid; + + /* "spacy/pipeline/_parser_internals/ner.pyx":217 + * elif move == BEGIN: + * t.is_valid = Begin.is_valid + * t.do = Begin.transition # <<<<<<<<<<<<<< + * t.get_cost = Begin.cost + * elif move == IN: +*/ + __pyx_v_t.__pyx_do = __pyx_f_5spacy_8pipeline_17_parser_internals_3ner_5Begin_transition; + + /* "spacy/pipeline/_parser_internals/ner.pyx":218 + * t.is_valid = Begin.is_valid + * t.do = Begin.transition + * t.get_cost = Begin.cost # <<<<<<<<<<<<<< + * elif move == IN: + * t.is_valid = In.is_valid +*/ + __pyx_v_t.get_cost = __pyx_f_5spacy_8pipeline_17_parser_internals_3ner_5Begin_cost; + + /* "spacy/pipeline/_parser_internals/ner.pyx":215 + * t.do = Missing.transition + * t.get_cost = Missing.cost + * elif move == BEGIN: # <<<<<<<<<<<<<< + * t.is_valid = Begin.is_valid + * t.do = Begin.transition +*/ + break; + case __pyx_e_5spacy_8pipeline_17_parser_internals_3ner_IN: + + /* "spacy/pipeline/_parser_internals/ner.pyx":220 + * t.get_cost = Begin.cost + * elif move == IN: + * t.is_valid = In.is_valid # <<<<<<<<<<<<<< + * t.do = In.transition + * t.get_cost = In.cost +*/ + __pyx_v_t.is_valid = __pyx_f_5spacy_8pipeline_17_parser_internals_3ner_2In_is_valid; + + /* "spacy/pipeline/_parser_internals/ner.pyx":221 + * elif move == IN: + * t.is_valid = In.is_valid + * t.do = In.transition # <<<<<<<<<<<<<< + * t.get_cost = In.cost + * elif move == LAST: +*/ + __pyx_v_t.__pyx_do = __pyx_f_5spacy_8pipeline_17_parser_internals_3ner_2In_transition; + + /* "spacy/pipeline/_parser_internals/ner.pyx":222 + * t.is_valid = In.is_valid + * t.do = In.transition + * t.get_cost = In.cost # <<<<<<<<<<<<<< + * elif move == LAST: + * t.is_valid = Last.is_valid +*/ + __pyx_v_t.get_cost = __pyx_f_5spacy_8pipeline_17_parser_internals_3ner_2In_cost; + + /* "spacy/pipeline/_parser_internals/ner.pyx":219 + * t.do = Begin.transition + * t.get_cost = Begin.cost + * elif move == IN: # <<<<<<<<<<<<<< + * t.is_valid = In.is_valid + * t.do = In.transition +*/ + break; + case __pyx_e_5spacy_8pipeline_17_parser_internals_3ner_LAST: + + /* "spacy/pipeline/_parser_internals/ner.pyx":224 + * t.get_cost = In.cost + * elif move == LAST: + * t.is_valid = Last.is_valid # <<<<<<<<<<<<<< + * t.do = Last.transition + * t.get_cost = Last.cost +*/ + __pyx_v_t.is_valid = __pyx_f_5spacy_8pipeline_17_parser_internals_3ner_4Last_is_valid; + + /* "spacy/pipeline/_parser_internals/ner.pyx":225 + * elif move == LAST: + * t.is_valid = Last.is_valid + * t.do = Last.transition # <<<<<<<<<<<<<< + * t.get_cost = Last.cost + * elif move == UNIT: +*/ + __pyx_v_t.__pyx_do = __pyx_f_5spacy_8pipeline_17_parser_internals_3ner_4Last_transition; + + /* "spacy/pipeline/_parser_internals/ner.pyx":226 + * t.is_valid = Last.is_valid + * t.do = Last.transition + * t.get_cost = Last.cost # <<<<<<<<<<<<<< + * elif move == UNIT: + * t.is_valid = Unit.is_valid +*/ + __pyx_v_t.get_cost = __pyx_f_5spacy_8pipeline_17_parser_internals_3ner_4Last_cost; + + /* "spacy/pipeline/_parser_internals/ner.pyx":223 + * t.do = In.transition + * t.get_cost = In.cost + * elif move == LAST: # <<<<<<<<<<<<<< + * t.is_valid = Last.is_valid + * t.do = Last.transition +*/ + break; + case __pyx_e_5spacy_8pipeline_17_parser_internals_3ner_UNIT: + + /* "spacy/pipeline/_parser_internals/ner.pyx":228 + * t.get_cost = Last.cost + * elif move == UNIT: + * t.is_valid = Unit.is_valid # <<<<<<<<<<<<<< + * t.do = Unit.transition + * t.get_cost = Unit.cost +*/ + __pyx_v_t.is_valid = __pyx_f_5spacy_8pipeline_17_parser_internals_3ner_4Unit_is_valid; + + /* "spacy/pipeline/_parser_internals/ner.pyx":229 + * elif move == UNIT: + * t.is_valid = Unit.is_valid + * t.do = Unit.transition # <<<<<<<<<<<<<< + * t.get_cost = Unit.cost + * elif move == OUT: +*/ + __pyx_v_t.__pyx_do = __pyx_f_5spacy_8pipeline_17_parser_internals_3ner_4Unit_transition; + + /* "spacy/pipeline/_parser_internals/ner.pyx":230 + * t.is_valid = Unit.is_valid + * t.do = Unit.transition + * t.get_cost = Unit.cost # <<<<<<<<<<<<<< + * elif move == OUT: + * t.is_valid = Out.is_valid +*/ + __pyx_v_t.get_cost = __pyx_f_5spacy_8pipeline_17_parser_internals_3ner_4Unit_cost; + + /* "spacy/pipeline/_parser_internals/ner.pyx":227 + * t.do = Last.transition + * t.get_cost = Last.cost + * elif move == UNIT: # <<<<<<<<<<<<<< + * t.is_valid = Unit.is_valid + * t.do = Unit.transition +*/ + break; + case __pyx_e_5spacy_8pipeline_17_parser_internals_3ner_OUT: + + /* "spacy/pipeline/_parser_internals/ner.pyx":232 + * t.get_cost = Unit.cost + * elif move == OUT: + * t.is_valid = Out.is_valid # <<<<<<<<<<<<<< + * t.do = Out.transition + * t.get_cost = Out.cost +*/ + __pyx_v_t.is_valid = __pyx_f_5spacy_8pipeline_17_parser_internals_3ner_3Out_is_valid; + + /* "spacy/pipeline/_parser_internals/ner.pyx":233 + * elif move == OUT: + * t.is_valid = Out.is_valid + * t.do = Out.transition # <<<<<<<<<<<<<< + * t.get_cost = Out.cost + * else: +*/ + __pyx_v_t.__pyx_do = __pyx_f_5spacy_8pipeline_17_parser_internals_3ner_3Out_transition; + + /* "spacy/pipeline/_parser_internals/ner.pyx":234 + * t.is_valid = Out.is_valid + * t.do = Out.transition + * t.get_cost = Out.cost # <<<<<<<<<<<<<< + * else: + * raise ValueError(Errors.E019.format(action=move, src='ner')) +*/ + __pyx_v_t.get_cost = __pyx_f_5spacy_8pipeline_17_parser_internals_3ner_3Out_cost; + + /* "spacy/pipeline/_parser_internals/ner.pyx":231 + * t.do = Unit.transition + * t.get_cost = Unit.cost + * elif move == OUT: # <<<<<<<<<<<<<< + * t.is_valid = Out.is_valid + * t.do = Out.transition +*/ + break; + default: + + /* "spacy/pipeline/_parser_internals/ner.pyx":236 + * t.get_cost = Out.cost + * else: + * raise ValueError(Errors.E019.format(action=move, src='ner')) # <<<<<<<<<<<<<< + * return t + * +*/ + __pyx_t_2 = NULL; + __Pyx_GetModuleGlobalName(__pyx_t_5, __pyx_mstate_global->__pyx_n_u_Errors); if (unlikely(!__pyx_t_5)) __PYX_ERR(0, 236, __pyx_L1_error) + __Pyx_GOTREF(__pyx_t_5); + __pyx_t_6 = __Pyx_PyObject_GetAttrStr(__pyx_t_5, __pyx_mstate_global->__pyx_n_u_E019); if (unlikely(!__pyx_t_6)) __PYX_ERR(0, 236, __pyx_L1_error) + __Pyx_GOTREF(__pyx_t_6); + __Pyx_DECREF(__pyx_t_5); __pyx_t_5 = 0; + __pyx_t_4 = __pyx_t_6; + __Pyx_INCREF(__pyx_t_4); + __pyx_t_5 = __Pyx_PyLong_From_int(__pyx_v_move); if (unlikely(!__pyx_t_5)) __PYX_ERR(0, 236, __pyx_L1_error) + __Pyx_GOTREF(__pyx_t_5); + __pyx_t_7 = 0; + { + PyObject *__pyx_callargs[2 + ((CYTHON_VECTORCALL) ? 2 : 0)] = {__pyx_t_4, NULL}; + __pyx_t_8 = __Pyx_MakeVectorcallBuilderKwds(2); if (unlikely(!__pyx_t_8)) __PYX_ERR(0, 236, __pyx_L1_error) + __Pyx_GOTREF(__pyx_t_8); + if (__Pyx_VectorcallBuilder_AddArg(__pyx_mstate_global->__pyx_n_u_action, __pyx_t_5, __pyx_t_8, __pyx_callargs+1, 0) < (0)) __PYX_ERR(0, 236, __pyx_L1_error) + if (__Pyx_VectorcallBuilder_AddArg(__pyx_mstate_global->__pyx_n_u_src, __pyx_mstate_global->__pyx_n_u_ner, __pyx_t_8, __pyx_callargs+1, 1) < (0)) __PYX_ERR(0, 236, __pyx_L1_error) + __pyx_t_3 = __Pyx_Object_VectorcallMethod_CallFromBuilder((PyObject*)__pyx_mstate_global->__pyx_n_u_format, __pyx_callargs+__pyx_t_7, (1-__pyx_t_7) | (1*__Pyx_PY_VECTORCALL_ARGUMENTS_OFFSET), __pyx_t_8); + __Pyx_XDECREF(__pyx_t_4); __pyx_t_4 = 0; + __Pyx_DECREF(__pyx_t_5); __pyx_t_5 = 0; + __Pyx_DECREF(__pyx_t_8); __pyx_t_8 = 0; + __Pyx_DECREF(__pyx_t_6); __pyx_t_6 = 0; + if (unlikely(!__pyx_t_3)) __PYX_ERR(0, 236, __pyx_L1_error) + __Pyx_GOTREF(__pyx_t_3); + } + __pyx_t_7 = 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_7, (2-__pyx_t_7) | (__pyx_t_7*__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, 236, __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, 236, __pyx_L1_error) + break; + } + + /* "spacy/pipeline/_parser_internals/ner.pyx":237 + * else: + * raise ValueError(Errors.E019.format(action=move, src='ner')) + * return t # <<<<<<<<<<<<<< + * + * def add_action(self, int action, label_name, freq=None): +*/ + __pyx_r = __pyx_v_t; + goto __pyx_L0; + + /* "spacy/pipeline/_parser_internals/ner.pyx":203 + * raise KeyError(Errors.E022.format(name=name)) + * + * cdef Transition init_transition(self, int clas, int move, attr_t label) except *: # <<<<<<<<<<<<<< + * # TODO: Apparent Cython bug here when we try to use the Transition() + * # constructor with the function pointers +*/ + + /* function exit code */ + __pyx_L1_error:; + __Pyx_XDECREF(__pyx_t_1); + __Pyx_XDECREF(__pyx_t_2); + __Pyx_XDECREF(__pyx_t_3); + __Pyx_XDECREF(__pyx_t_4); + __Pyx_XDECREF(__pyx_t_5); + __Pyx_XDECREF(__pyx_t_6); + __Pyx_XDECREF(__pyx_t_8); + __Pyx_AddTraceback("spacy.pipeline._parser_internals.ner.BiluoPushDown.init_transition", __pyx_clineno, __pyx_lineno, __pyx_filename); + __Pyx_pretend_to_initialize(&__pyx_r); + __pyx_L0:; + __Pyx_RefNannyFinishContext(); + return __pyx_r; +} + +/* "spacy/pipeline/_parser_internals/ner.pyx":239 + * return t + * + * def add_action(self, int action, label_name, freq=None): # <<<<<<<<<<<<<< + * cdef attr_t label_id + * if not isinstance(label_name, int): +*/ + +/* Python wrapper */ +static PyObject *__pyx_pw_5spacy_8pipeline_17_parser_internals_3ner_13BiluoPushDown_11add_action(PyObject *__pyx_v_self, +#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_5spacy_8pipeline_17_parser_internals_3ner_13BiluoPushDown_10add_action, "BiluoPushDown.add_action(self, int action, label_name, freq=None)"); +static PyMethodDef __pyx_mdef_5spacy_8pipeline_17_parser_internals_3ner_13BiluoPushDown_11add_action = {"add_action", (PyCFunction)(void(*)(void))(__Pyx_PyCFunction_FastCallWithKeywords)__pyx_pw_5spacy_8pipeline_17_parser_internals_3ner_13BiluoPushDown_11add_action, __Pyx_METH_FASTCALL|METH_KEYWORDS, __pyx_doc_5spacy_8pipeline_17_parser_internals_3ner_13BiluoPushDown_10add_action}; +static PyObject *__pyx_pw_5spacy_8pipeline_17_parser_internals_3ner_13BiluoPushDown_11add_action(PyObject *__pyx_v_self, +#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_action; + PyObject *__pyx_v_label_name = 0; + PyObject *__pyx_v_freq = 0; + #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("add_action (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_action,&__pyx_mstate_global->__pyx_n_u_label_name,&__pyx_mstate_global->__pyx_n_u_freq,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, 239, __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, 239, __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, 239, __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, 239, __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, "add_action", 0) < (0)) __PYX_ERR(0, 239, __pyx_L3_error) + if (!values[2]) values[2] = __Pyx_NewRef(((PyObject *)Py_None)); + for (Py_ssize_t i = __pyx_nargs; i < 2; i++) { + if (unlikely(!values[i])) { __Pyx_RaiseArgtupleInvalid("add_action", 0, 2, 3, i); __PYX_ERR(0, 239, __pyx_L3_error) } + } + } else { + switch (__pyx_nargs) { + case 3: + values[2] = __Pyx_ArgRef_FASTCALL(__pyx_args, 2); + if (!CYTHON_ASSUME_SAFE_MACROS && unlikely(!values[2])) __PYX_ERR(0, 239, __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, 239, __pyx_L3_error) + values[0] = __Pyx_ArgRef_FASTCALL(__pyx_args, 0); + if (!CYTHON_ASSUME_SAFE_MACROS && unlikely(!values[0])) __PYX_ERR(0, 239, __pyx_L3_error) + break; + default: goto __pyx_L5_argtuple_error; + } + if (!values[2]) values[2] = __Pyx_NewRef(((PyObject *)Py_None)); + } + __pyx_v_action = __Pyx_PyLong_As_int(values[0]); if (unlikely((__pyx_v_action == (int)-1) && PyErr_Occurred())) __PYX_ERR(0, 239, __pyx_L3_error) + __pyx_v_label_name = values[1]; + __pyx_v_freq = values[2]; + } + goto __pyx_L6_skip; + __pyx_L5_argtuple_error:; + __Pyx_RaiseArgtupleInvalid("add_action", 0, 2, 3, __pyx_nargs); __PYX_ERR(0, 239, __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("spacy.pipeline._parser_internals.ner.BiluoPushDown.add_action", __pyx_clineno, __pyx_lineno, __pyx_filename); + __Pyx_RefNannyFinishContext(); + return NULL; + __pyx_L4_argument_unpacking_done:; + __pyx_r = __pyx_pf_5spacy_8pipeline_17_parser_internals_3ner_13BiluoPushDown_10add_action(((struct __pyx_obj_5spacy_8pipeline_17_parser_internals_3ner_BiluoPushDown *)__pyx_v_self), __pyx_v_action, __pyx_v_label_name, __pyx_v_freq); + + /* 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_5spacy_8pipeline_17_parser_internals_3ner_13BiluoPushDown_10add_action(struct __pyx_obj_5spacy_8pipeline_17_parser_internals_3ner_BiluoPushDown *__pyx_v_self, int __pyx_v_action, PyObject *__pyx_v_label_name, PyObject *__pyx_v_freq) { + __pyx_t_5spacy_8typedefs_attr_t __pyx_v_label_id; + struct __pyx_t_5spacy_8pipeline_17_parser_internals_17transition_system_Transition __pyx_v_trans; + 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; + __pyx_t_5spacy_8typedefs_attr_t __pyx_t_6; + struct __pyx_t_5spacy_8pipeline_17_parser_internals_17transition_system_Transition *__pyx_t_7; + struct __pyx_t_5spacy_8pipeline_17_parser_internals_17transition_system_Transition *__pyx_t_8; + struct __pyx_t_5spacy_8pipeline_17_parser_internals_17transition_system_Transition *__pyx_t_9; + int __pyx_t_10; + void *__pyx_t_11; + struct __pyx_t_5spacy_8pipeline_17_parser_internals_17transition_system_Transition __pyx_t_12; + PyObject *__pyx_t_13 = NULL; + PyObject *__pyx_t_14 = NULL; + PyObject *__pyx_t_15 = NULL; + long __pyx_t_16; + int __pyx_lineno = 0; + const char *__pyx_filename = NULL; + int __pyx_clineno = 0; + __Pyx_RefNannySetupContext("add_action", 0); + __Pyx_INCREF(__pyx_v_freq); + + /* "spacy/pipeline/_parser_internals/ner.pyx":241 + * def add_action(self, int action, label_name, freq=None): + * cdef attr_t label_id + * if not isinstance(label_name, int): # <<<<<<<<<<<<<< + * label_id = self.strings.add(label_name) + * else: +*/ + __pyx_t_1 = PyLong_Check(__pyx_v_label_name); + __pyx_t_2 = (!__pyx_t_1); + if (__pyx_t_2) { + + /* "spacy/pipeline/_parser_internals/ner.pyx":242 + * cdef attr_t label_id + * if not isinstance(label_name, int): + * label_id = self.strings.add(label_name) # <<<<<<<<<<<<<< + * else: + * label_id = label_name +*/ + __pyx_t_4 = ((PyObject *)__pyx_v_self->__pyx_base.strings); + __Pyx_INCREF(__pyx_t_4); + __pyx_t_5 = 0; + { + PyObject *__pyx_callargs[2] = {__pyx_t_4, __pyx_v_label_name}; + __pyx_t_3 = __Pyx_PyObject_FastCallMethod((PyObject*)__pyx_mstate_global->__pyx_n_u_add, __pyx_callargs+__pyx_t_5, (2-__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, 242, __pyx_L1_error) + __Pyx_GOTREF(__pyx_t_3); + } + __pyx_t_6 = __Pyx_PyLong_As_uint64_t(__pyx_t_3); if (unlikely((__pyx_t_6 == ((uint64_t)-1)) && PyErr_Occurred())) __PYX_ERR(0, 242, __pyx_L1_error) + __Pyx_DECREF(__pyx_t_3); __pyx_t_3 = 0; + __pyx_v_label_id = __pyx_t_6; + + /* "spacy/pipeline/_parser_internals/ner.pyx":241 + * def add_action(self, int action, label_name, freq=None): + * cdef attr_t label_id + * if not isinstance(label_name, int): # <<<<<<<<<<<<<< + * label_id = self.strings.add(label_name) + * else: +*/ + goto __pyx_L3; + } + + /* "spacy/pipeline/_parser_internals/ner.pyx":244 + * label_id = self.strings.add(label_name) + * else: + * label_id = label_name # <<<<<<<<<<<<<< + * if action == OUT and label_id != 0: + * return None +*/ + /*else*/ { + __pyx_t_6 = __Pyx_PyLong_As_uint64_t(__pyx_v_label_name); if (unlikely((__pyx_t_6 == ((uint64_t)-1)) && PyErr_Occurred())) __PYX_ERR(0, 244, __pyx_L1_error) + __pyx_v_label_id = __pyx_t_6; + } + __pyx_L3:; + + /* "spacy/pipeline/_parser_internals/ner.pyx":245 + * else: + * label_id = label_name + * if action == OUT and label_id != 0: # <<<<<<<<<<<<<< + * return None + * if action == MISSING: +*/ + __pyx_t_1 = (__pyx_v_action == __pyx_e_5spacy_8pipeline_17_parser_internals_3ner_OUT); + if (__pyx_t_1) { + } else { + __pyx_t_2 = __pyx_t_1; + goto __pyx_L5_bool_binop_done; + } + __pyx_t_1 = (__pyx_v_label_id != 0); + __pyx_t_2 = __pyx_t_1; + __pyx_L5_bool_binop_done:; + if (__pyx_t_2) { + + /* "spacy/pipeline/_parser_internals/ner.pyx":246 + * label_id = label_name + * if action == OUT and label_id != 0: + * return None # <<<<<<<<<<<<<< + * if action == MISSING: + * return None +*/ + __Pyx_XDECREF(__pyx_r); + __pyx_r = Py_None; __Pyx_INCREF(Py_None); + goto __pyx_L0; + + /* "spacy/pipeline/_parser_internals/ner.pyx":245 + * else: + * label_id = label_name + * if action == OUT and label_id != 0: # <<<<<<<<<<<<<< + * return None + * if action == MISSING: +*/ + } + + /* "spacy/pipeline/_parser_internals/ner.pyx":247 + * if action == OUT and label_id != 0: + * return None + * if action == MISSING: # <<<<<<<<<<<<<< + * return None + * # Check we're not creating a move we already have, so that this is +*/ + __pyx_t_2 = (__pyx_v_action == __pyx_e_5spacy_8pipeline_17_parser_internals_3ner_MISSING); + if (__pyx_t_2) { + + /* "spacy/pipeline/_parser_internals/ner.pyx":248 + * return None + * if action == MISSING: + * return None # <<<<<<<<<<<<<< + * # Check we're not creating a move we already have, so that this is + * # idempotent +*/ + __Pyx_XDECREF(__pyx_r); + __pyx_r = Py_None; __Pyx_INCREF(Py_None); + goto __pyx_L0; + + /* "spacy/pipeline/_parser_internals/ner.pyx":247 + * if action == OUT and label_id != 0: + * return None + * if action == MISSING: # <<<<<<<<<<<<<< + * return None + * # Check we're not creating a move we already have, so that this is +*/ + } + + /* "spacy/pipeline/_parser_internals/ner.pyx":251 + * # Check we're not creating a move we already have, so that this is + * # idempotent + * for trans in self.c[:self.n_moves]: # <<<<<<<<<<<<<< + * if trans.move == action and trans.label == label_id: + * return 0 +*/ + __pyx_t_8 = (__pyx_v_self->__pyx_base.c + __pyx_v_self->__pyx_base.n_moves); + for (__pyx_t_9 = __pyx_v_self->__pyx_base.c; __pyx_t_9 < __pyx_t_8; __pyx_t_9++) { + __pyx_t_7 = __pyx_t_9; + __pyx_v_trans = (__pyx_t_7[0]); + + /* "spacy/pipeline/_parser_internals/ner.pyx":252 + * # idempotent + * for trans in self.c[:self.n_moves]: + * if trans.move == action and trans.label == label_id: # <<<<<<<<<<<<<< + * return 0 + * if self.n_moves >= self._size: +*/ + __pyx_t_1 = (__pyx_v_trans.move == __pyx_v_action); + if (__pyx_t_1) { + } else { + __pyx_t_2 = __pyx_t_1; + goto __pyx_L11_bool_binop_done; + } + __pyx_t_1 = (__pyx_v_trans.label == __pyx_v_label_id); + __pyx_t_2 = __pyx_t_1; + __pyx_L11_bool_binop_done:; + if (__pyx_t_2) { + + /* "spacy/pipeline/_parser_internals/ner.pyx":253 + * for trans in self.c[:self.n_moves]: + * if trans.move == action and trans.label == label_id: + * return 0 # <<<<<<<<<<<<<< + * if self.n_moves >= self._size: + * self._size = self.n_moves +*/ + __Pyx_XDECREF(__pyx_r); + __Pyx_INCREF(__pyx_mstate_global->__pyx_int_0); + __pyx_r = __pyx_mstate_global->__pyx_int_0; + goto __pyx_L0; + + /* "spacy/pipeline/_parser_internals/ner.pyx":252 + * # idempotent + * for trans in self.c[:self.n_moves]: + * if trans.move == action and trans.label == label_id: # <<<<<<<<<<<<<< + * return 0 + * if self.n_moves >= self._size: +*/ + } + } + + /* "spacy/pipeline/_parser_internals/ner.pyx":254 + * if trans.move == action and trans.label == label_id: + * return 0 + * if self.n_moves >= self._size: # <<<<<<<<<<<<<< + * self._size = self.n_moves + * self._size *= 2 +*/ + __pyx_t_2 = (__pyx_v_self->__pyx_base.n_moves >= __pyx_v_self->__pyx_base._size); + if (__pyx_t_2) { + + /* "spacy/pipeline/_parser_internals/ner.pyx":255 + * return 0 + * if self.n_moves >= self._size: + * self._size = self.n_moves # <<<<<<<<<<<<<< + * self._size *= 2 + * self.c = self.mem.realloc(self.c, self._size * sizeof(self.c[0])) +*/ + __pyx_t_10 = __pyx_v_self->__pyx_base.n_moves; + __pyx_v_self->__pyx_base._size = __pyx_t_10; + + /* "spacy/pipeline/_parser_internals/ner.pyx":256 + * if self.n_moves >= self._size: + * self._size = self.n_moves + * self._size *= 2 # <<<<<<<<<<<<<< + * self.c = self.mem.realloc(self.c, self._size * sizeof(self.c[0])) + * self.c[self.n_moves] = self.init_transition(self.n_moves, action, label_id) +*/ + __pyx_v_self->__pyx_base._size = (__pyx_v_self->__pyx_base._size * 2); + + /* "spacy/pipeline/_parser_internals/ner.pyx":257 + * self._size = self.n_moves + * self._size *= 2 + * self.c = self.mem.realloc(self.c, self._size * sizeof(self.c[0])) # <<<<<<<<<<<<<< + * self.c[self.n_moves] = self.init_transition(self.n_moves, action, label_id) + * self.n_moves += 1 +*/ + __pyx_t_11 = ((struct __pyx_vtabstruct_5cymem_5cymem_Pool *)__pyx_v_self->__pyx_base.mem->__pyx_vtab)->realloc(__pyx_v_self->__pyx_base.mem, __pyx_v_self->__pyx_base.c, (__pyx_v_self->__pyx_base._size * (sizeof((__pyx_v_self->__pyx_base.c[0]))))); if (unlikely(__pyx_t_11 == ((void *)NULL))) __PYX_ERR(0, 257, __pyx_L1_error) + __pyx_v_self->__pyx_base.c = ((struct __pyx_t_5spacy_8pipeline_17_parser_internals_17transition_system_Transition *)__pyx_t_11); + + /* "spacy/pipeline/_parser_internals/ner.pyx":254 + * if trans.move == action and trans.label == label_id: + * return 0 + * if self.n_moves >= self._size: # <<<<<<<<<<<<<< + * self._size = self.n_moves + * self._size *= 2 +*/ + } + + /* "spacy/pipeline/_parser_internals/ner.pyx":258 + * self._size *= 2 + * self.c = self.mem.realloc(self.c, self._size * sizeof(self.c[0])) + * self.c[self.n_moves] = self.init_transition(self.n_moves, action, label_id) # <<<<<<<<<<<<<< + * self.n_moves += 1 + * if self.labels.get(action, []): +*/ + __pyx_t_12 = ((struct __pyx_vtabstruct_5spacy_8pipeline_17_parser_internals_3ner_BiluoPushDown *)__pyx_v_self->__pyx_base.__pyx_vtab)->__pyx_base.init_transition(((struct __pyx_obj_5spacy_8pipeline_17_parser_internals_17transition_system_TransitionSystem *)__pyx_v_self), __pyx_v_self->__pyx_base.n_moves, __pyx_v_action, __pyx_v_label_id); if (unlikely(PyErr_Occurred())) __PYX_ERR(0, 258, __pyx_L1_error) + (__pyx_v_self->__pyx_base.c[__pyx_v_self->__pyx_base.n_moves]) = __pyx_t_12; + + /* "spacy/pipeline/_parser_internals/ner.pyx":259 + * self.c = self.mem.realloc(self.c, self._size * sizeof(self.c[0])) + * self.c[self.n_moves] = self.init_transition(self.n_moves, action, label_id) + * self.n_moves += 1 # <<<<<<<<<<<<<< + * if self.labels.get(action, []): + * freq = min(0, min(self.labels[action].values())) +*/ + __pyx_v_self->__pyx_base.n_moves = (__pyx_v_self->__pyx_base.n_moves + 1); + + /* "spacy/pipeline/_parser_internals/ner.pyx":260 + * self.c[self.n_moves] = self.init_transition(self.n_moves, action, label_id) + * self.n_moves += 1 + * if self.labels.get(action, []): # <<<<<<<<<<<<<< + * freq = min(0, min(self.labels[action].values())) + * self.labels[action][label_name] = freq-1 +*/ + __pyx_t_4 = __pyx_v_self->__pyx_base.labels; + __Pyx_INCREF(__pyx_t_4); + __pyx_t_13 = __Pyx_PyLong_From_int(__pyx_v_action); if (unlikely(!__pyx_t_13)) __PYX_ERR(0, 260, __pyx_L1_error) + __Pyx_GOTREF(__pyx_t_13); + __pyx_t_14 = PyList_New(0); if (unlikely(!__pyx_t_14)) __PYX_ERR(0, 260, __pyx_L1_error) + __Pyx_GOTREF(__pyx_t_14); + __pyx_t_5 = 0; + { + PyObject *__pyx_callargs[3] = {__pyx_t_4, __pyx_t_13, __pyx_t_14}; + __pyx_t_3 = __Pyx_PyObject_FastCallMethod((PyObject*)__pyx_mstate_global->__pyx_n_u_get, __pyx_callargs+__pyx_t_5, (3-__pyx_t_5) | (1*__Pyx_PY_VECTORCALL_ARGUMENTS_OFFSET)); + __Pyx_XDECREF(__pyx_t_4); __pyx_t_4 = 0; + __Pyx_DECREF(__pyx_t_13); __pyx_t_13 = 0; + __Pyx_DECREF(__pyx_t_14); __pyx_t_14 = 0; + if (unlikely(!__pyx_t_3)) __PYX_ERR(0, 260, __pyx_L1_error) + __Pyx_GOTREF(__pyx_t_3); + } + __pyx_t_2 = __Pyx_PyObject_IsTrue(__pyx_t_3); if (unlikely((__pyx_t_2 < 0))) __PYX_ERR(0, 260, __pyx_L1_error) + __Pyx_DECREF(__pyx_t_3); __pyx_t_3 = 0; + if (__pyx_t_2) { + + /* "spacy/pipeline/_parser_internals/ner.pyx":261 + * self.n_moves += 1 + * if self.labels.get(action, []): + * freq = min(0, min(self.labels[action].values())) # <<<<<<<<<<<<<< + * self.labels[action][label_name] = freq-1 + * else: +*/ + __pyx_t_14 = NULL; + __pyx_t_15 = __Pyx_GetItemInt(__pyx_v_self->__pyx_base.labels, __pyx_v_action, int, 1, __Pyx_PyLong_From_int, 0, 1, 1, 1, __Pyx_ReferenceSharing_SharedReference); if (unlikely(!__pyx_t_15)) __PYX_ERR(0, 261, __pyx_L1_error) + __Pyx_GOTREF(__pyx_t_15); + __pyx_t_4 = __pyx_t_15; + __Pyx_INCREF(__pyx_t_4); + __pyx_t_5 = 0; + { + PyObject *__pyx_callargs[2] = {__pyx_t_4, NULL}; + __pyx_t_13 = __Pyx_PyObject_FastCallMethod((PyObject*)__pyx_mstate_global->__pyx_n_u_values, __pyx_callargs+__pyx_t_5, (1-__pyx_t_5) | (1*__Pyx_PY_VECTORCALL_ARGUMENTS_OFFSET)); + __Pyx_XDECREF(__pyx_t_4); __pyx_t_4 = 0; + __Pyx_DECREF(__pyx_t_15); __pyx_t_15 = 0; + if (unlikely(!__pyx_t_13)) __PYX_ERR(0, 261, __pyx_L1_error) + __Pyx_GOTREF(__pyx_t_13); + } + __pyx_t_5 = 1; + { + PyObject *__pyx_callargs[2] = {__pyx_t_14, __pyx_t_13}; + __pyx_t_3 = __Pyx_PyObject_FastCall((PyObject*)__pyx_builtin_min, __pyx_callargs+__pyx_t_5, (2-__pyx_t_5) | (__pyx_t_5*__Pyx_PY_VECTORCALL_ARGUMENTS_OFFSET)); + __Pyx_XDECREF(__pyx_t_14); __pyx_t_14 = 0; + __Pyx_DECREF(__pyx_t_13); __pyx_t_13 = 0; + if (unlikely(!__pyx_t_3)) __PYX_ERR(0, 261, __pyx_L1_error) + __Pyx_GOTREF(__pyx_t_3); + } + __pyx_t_16 = 0; + __pyx_t_14 = __Pyx_PyLong_From_long(__pyx_t_16); if (unlikely(!__pyx_t_14)) __PYX_ERR(0, 261, __pyx_L1_error) + __Pyx_GOTREF(__pyx_t_14); + __pyx_t_15 = PyObject_RichCompare(__pyx_t_3, __pyx_t_14, Py_LT); __Pyx_XGOTREF(__pyx_t_15); if (unlikely(!__pyx_t_15)) __PYX_ERR(0, 261, __pyx_L1_error) + __Pyx_DECREF(__pyx_t_14); __pyx_t_14 = 0; + __pyx_t_2 = __Pyx_PyObject_IsTrue(__pyx_t_15); if (unlikely((__pyx_t_2 < 0))) __PYX_ERR(0, 261, __pyx_L1_error) + __Pyx_DECREF(__pyx_t_15); __pyx_t_15 = 0; + if (__pyx_t_2) { + __Pyx_INCREF(__pyx_t_3); + __pyx_t_13 = __pyx_t_3; + } else { + __pyx_t_15 = __Pyx_PyLong_From_long(__pyx_t_16); if (unlikely(!__pyx_t_15)) __PYX_ERR(0, 261, __pyx_L1_error) + __Pyx_GOTREF(__pyx_t_15); + __pyx_t_13 = __pyx_t_15; + __pyx_t_15 = 0; + } + __Pyx_DECREF(__pyx_t_3); __pyx_t_3 = 0; + __pyx_t_3 = __pyx_t_13; + __Pyx_INCREF(__pyx_t_3); + __Pyx_DECREF(__pyx_t_13); __pyx_t_13 = 0; + __Pyx_DECREF_SET(__pyx_v_freq, __pyx_t_3); + __pyx_t_3 = 0; + + /* "spacy/pipeline/_parser_internals/ner.pyx":262 + * if self.labels.get(action, []): + * freq = min(0, min(self.labels[action].values())) + * self.labels[action][label_name] = freq-1 # <<<<<<<<<<<<<< + * else: + * self.labels[action] = Counter() +*/ + __pyx_t_3 = __Pyx_PyLong_SubtractObjC(__pyx_v_freq, __pyx_mstate_global->__pyx_int_1, 1, 0, 0); if (unlikely(!__pyx_t_3)) __PYX_ERR(0, 262, __pyx_L1_error) + __Pyx_GOTREF(__pyx_t_3); + __pyx_t_13 = __Pyx_GetItemInt(__pyx_v_self->__pyx_base.labels, __pyx_v_action, int, 1, __Pyx_PyLong_From_int, 0, 1, 1, 1, __Pyx_ReferenceSharing_SharedReference); if (unlikely(!__pyx_t_13)) __PYX_ERR(0, 262, __pyx_L1_error) + __Pyx_GOTREF(__pyx_t_13); + if (unlikely((PyObject_SetItem(__pyx_t_13, __pyx_v_label_name, __pyx_t_3) < 0))) __PYX_ERR(0, 262, __pyx_L1_error) + __Pyx_DECREF(__pyx_t_13); __pyx_t_13 = 0; + __Pyx_DECREF(__pyx_t_3); __pyx_t_3 = 0; + + /* "spacy/pipeline/_parser_internals/ner.pyx":260 + * self.c[self.n_moves] = self.init_transition(self.n_moves, action, label_id) + * self.n_moves += 1 + * if self.labels.get(action, []): # <<<<<<<<<<<<<< + * freq = min(0, min(self.labels[action].values())) + * self.labels[action][label_name] = freq-1 +*/ + goto __pyx_L14; + } + + /* "spacy/pipeline/_parser_internals/ner.pyx":264 + * self.labels[action][label_name] = freq-1 + * else: + * self.labels[action] = Counter() # <<<<<<<<<<<<<< + * self.labels[action][label_name] = -1 + * return 1 +*/ + /*else*/ { + __pyx_t_13 = NULL; + __Pyx_GetModuleGlobalName(__pyx_t_15, __pyx_mstate_global->__pyx_n_u_Counter); if (unlikely(!__pyx_t_15)) __PYX_ERR(0, 264, __pyx_L1_error) + __Pyx_GOTREF(__pyx_t_15); + __pyx_t_5 = 1; + #if CYTHON_UNPACK_METHODS + if (unlikely(PyMethod_Check(__pyx_t_15))) { + __pyx_t_13 = PyMethod_GET_SELF(__pyx_t_15); + assert(__pyx_t_13); + PyObject* __pyx__function = PyMethod_GET_FUNCTION(__pyx_t_15); + __Pyx_INCREF(__pyx_t_13); + __Pyx_INCREF(__pyx__function); + __Pyx_DECREF_SET(__pyx_t_15, __pyx__function); + __pyx_t_5 = 0; + } + #endif + { + PyObject *__pyx_callargs[2] = {__pyx_t_13, NULL}; + __pyx_t_3 = __Pyx_PyObject_FastCall((PyObject*)__pyx_t_15, __pyx_callargs+__pyx_t_5, (1-__pyx_t_5) | (__pyx_t_5*__Pyx_PY_VECTORCALL_ARGUMENTS_OFFSET)); + __Pyx_XDECREF(__pyx_t_13); __pyx_t_13 = 0; + __Pyx_DECREF(__pyx_t_15); __pyx_t_15 = 0; + if (unlikely(!__pyx_t_3)) __PYX_ERR(0, 264, __pyx_L1_error) + __Pyx_GOTREF(__pyx_t_3); + } + if (unlikely((__Pyx_SetItemInt(__pyx_v_self->__pyx_base.labels, __pyx_v_action, __pyx_t_3, int, 1, __Pyx_PyLong_From_int, 0, 1, 1, 1, __Pyx_ReferenceSharing_SharedReference) < 0))) __PYX_ERR(0, 264, __pyx_L1_error) + __Pyx_DECREF(__pyx_t_3); __pyx_t_3 = 0; + + /* "spacy/pipeline/_parser_internals/ner.pyx":265 + * else: + * self.labels[action] = Counter() + * self.labels[action][label_name] = -1 # <<<<<<<<<<<<<< + * return 1 + * +*/ + __pyx_t_3 = __Pyx_GetItemInt(__pyx_v_self->__pyx_base.labels, __pyx_v_action, int, 1, __Pyx_PyLong_From_int, 0, 1, 1, 1, __Pyx_ReferenceSharing_SharedReference); if (unlikely(!__pyx_t_3)) __PYX_ERR(0, 265, __pyx_L1_error) + __Pyx_GOTREF(__pyx_t_3); + if (unlikely((PyObject_SetItem(__pyx_t_3, __pyx_v_label_name, __pyx_mstate_global->__pyx_int_neg_1) < 0))) __PYX_ERR(0, 265, __pyx_L1_error) + __Pyx_DECREF(__pyx_t_3); __pyx_t_3 = 0; + } + __pyx_L14:; + + /* "spacy/pipeline/_parser_internals/ner.pyx":266 + * self.labels[action] = Counter() + * self.labels[action][label_name] = -1 + * return 1 # <<<<<<<<<<<<<< + * + * def set_annotations(self, StateClass state, Doc doc): +*/ + __Pyx_XDECREF(__pyx_r); + __Pyx_INCREF(__pyx_mstate_global->__pyx_int_1); + __pyx_r = __pyx_mstate_global->__pyx_int_1; + goto __pyx_L0; + + /* "spacy/pipeline/_parser_internals/ner.pyx":239 + * return t + * + * def add_action(self, int action, label_name, freq=None): # <<<<<<<<<<<<<< + * cdef attr_t label_id + * if not isinstance(label_name, int): +*/ + + /* function exit code */ + __pyx_L1_error:; + __Pyx_XDECREF(__pyx_t_3); + __Pyx_XDECREF(__pyx_t_4); + __Pyx_XDECREF(__pyx_t_13); + __Pyx_XDECREF(__pyx_t_14); + __Pyx_XDECREF(__pyx_t_15); + __Pyx_AddTraceback("spacy.pipeline._parser_internals.ner.BiluoPushDown.add_action", __pyx_clineno, __pyx_lineno, __pyx_filename); + __pyx_r = NULL; + __pyx_L0:; + __Pyx_XDECREF(__pyx_v_freq); + __Pyx_XGIVEREF(__pyx_r); + __Pyx_RefNannyFinishContext(); + return __pyx_r; +} + +/* "spacy/pipeline/_parser_internals/ner.pyx":268 + * return 1 + * + * def set_annotations(self, StateClass state, Doc doc): # <<<<<<<<<<<<<< + * cdef int i + * ents = [] +*/ + +/* Python wrapper */ +static PyObject *__pyx_pw_5spacy_8pipeline_17_parser_internals_3ner_13BiluoPushDown_13set_annotations(PyObject *__pyx_v_self, +#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_5spacy_8pipeline_17_parser_internals_3ner_13BiluoPushDown_12set_annotations, "BiluoPushDown.set_annotations(self, StateClass state, Doc doc)"); +static PyMethodDef __pyx_mdef_5spacy_8pipeline_17_parser_internals_3ner_13BiluoPushDown_13set_annotations = {"set_annotations", (PyCFunction)(void(*)(void))(__Pyx_PyCFunction_FastCallWithKeywords)__pyx_pw_5spacy_8pipeline_17_parser_internals_3ner_13BiluoPushDown_13set_annotations, __Pyx_METH_FASTCALL|METH_KEYWORDS, __pyx_doc_5spacy_8pipeline_17_parser_internals_3ner_13BiluoPushDown_12set_annotations}; +static PyObject *__pyx_pw_5spacy_8pipeline_17_parser_internals_3ner_13BiluoPushDown_13set_annotations(PyObject *__pyx_v_self, +#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_5spacy_8pipeline_17_parser_internals_10stateclass_StateClass *__pyx_v_state = 0; + struct __pyx_obj_5spacy_6tokens_3doc_Doc *__pyx_v_doc = 0; + #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("set_annotations (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_state,&__pyx_mstate_global->__pyx_n_u_doc,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, 268, __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, 268, __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, 268, __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, "set_annotations", 0) < (0)) __PYX_ERR(0, 268, __pyx_L3_error) + for (Py_ssize_t i = __pyx_nargs; i < 2; i++) { + if (unlikely(!values[i])) { __Pyx_RaiseArgtupleInvalid("set_annotations", 1, 2, 2, i); __PYX_ERR(0, 268, __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, 268, __pyx_L3_error) + values[1] = __Pyx_ArgRef_FASTCALL(__pyx_args, 1); + if (!CYTHON_ASSUME_SAFE_MACROS && unlikely(!values[1])) __PYX_ERR(0, 268, __pyx_L3_error) + } + __pyx_v_state = ((struct __pyx_obj_5spacy_8pipeline_17_parser_internals_10stateclass_StateClass *)values[0]); + __pyx_v_doc = ((struct __pyx_obj_5spacy_6tokens_3doc_Doc *)values[1]); + } + goto __pyx_L6_skip; + __pyx_L5_argtuple_error:; + __Pyx_RaiseArgtupleInvalid("set_annotations", 1, 2, 2, __pyx_nargs); __PYX_ERR(0, 268, __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("spacy.pipeline._parser_internals.ner.BiluoPushDown.set_annotations", __pyx_clineno, __pyx_lineno, __pyx_filename); + __Pyx_RefNannyFinishContext(); + return NULL; + __pyx_L4_argument_unpacking_done:; + if (unlikely(!__Pyx_ArgTypeTest(((PyObject *)__pyx_v_state), __pyx_mstate_global->__pyx_ptype_5spacy_8pipeline_17_parser_internals_10stateclass_StateClass, 1, "state", 0))) __PYX_ERR(0, 268, __pyx_L1_error) + if (unlikely(!__Pyx_ArgTypeTest(((PyObject *)__pyx_v_doc), __pyx_mstate_global->__pyx_ptype_5spacy_6tokens_3doc_Doc, 1, "doc", 0))) __PYX_ERR(0, 268, __pyx_L1_error) + __pyx_r = __pyx_pf_5spacy_8pipeline_17_parser_internals_3ner_13BiluoPushDown_12set_annotations(((struct __pyx_obj_5spacy_8pipeline_17_parser_internals_3ner_BiluoPushDown *)__pyx_v_self), __pyx_v_state, __pyx_v_doc); + + /* 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_5spacy_8pipeline_17_parser_internals_3ner_13BiluoPushDown_12set_annotations(CYTHON_UNUSED struct __pyx_obj_5spacy_8pipeline_17_parser_internals_3ner_BiluoPushDown *__pyx_v_self, struct __pyx_obj_5spacy_8pipeline_17_parser_internals_10stateclass_StateClass *__pyx_v_state, struct __pyx_obj_5spacy_6tokens_3doc_Doc *__pyx_v_doc) { + int __pyx_v_i; + PyObject *__pyx_v_ents = NULL; + struct __pyx_t_5spacy_7structs_SpanC __pyx_v_ent; + PyObject *__pyx_r = NULL; + __Pyx_RefNannyDeclarations + PyObject *__pyx_t_1 = NULL; + std::vector ::size_type __pyx_t_2; + std::vector ::size_type __pyx_t_3; + int __pyx_t_4; + __Pyx_FakeReference __pyx_t_5; + int __pyx_t_6; + int __pyx_t_7; + PyObject *__pyx_t_8 = NULL; + PyObject *__pyx_t_9 = NULL; + PyObject *__pyx_t_10 = NULL; + PyObject *__pyx_t_11 = NULL; + PyObject *__pyx_t_12 = NULL; + size_t __pyx_t_13; + PyObject *__pyx_t_14 = NULL; + int __pyx_t_15; + int __pyx_t_16; + int __pyx_t_17; + int __pyx_lineno = 0; + const char *__pyx_filename = NULL; + int __pyx_clineno = 0; + __Pyx_RefNannySetupContext("set_annotations", 0); + + /* "spacy/pipeline/_parser_internals/ner.pyx":270 + * def set_annotations(self, StateClass state, Doc doc): + * cdef int i + * ents = [] # <<<<<<<<<<<<<< + * for i in range(state.c._ents.size()): + * ent = state.c._ents.at(i) +*/ + __pyx_t_1 = PyList_New(0); if (unlikely(!__pyx_t_1)) __PYX_ERR(0, 270, __pyx_L1_error) + __Pyx_GOTREF(__pyx_t_1); + __pyx_v_ents = ((PyObject*)__pyx_t_1); + __pyx_t_1 = 0; + + /* "spacy/pipeline/_parser_internals/ner.pyx":271 + * cdef int i + * ents = [] + * for i in range(state.c._ents.size()): # <<<<<<<<<<<<<< + * ent = state.c._ents.at(i) + * if ent.start != -1 and ent.end != -1: +*/ + __pyx_t_2 = __pyx_v_state->c->_ents.size(); + __pyx_t_3 = __pyx_t_2; + for (__pyx_t_4 = 0; __pyx_t_4 < __pyx_t_3; __pyx_t_4+=1) { + __pyx_v_i = __pyx_t_4; + + /* "spacy/pipeline/_parser_internals/ner.pyx":272 + * ents = [] + * for i in range(state.c._ents.size()): + * ent = state.c._ents.at(i) # <<<<<<<<<<<<<< + * if ent.start != -1 and ent.end != -1: + * ents.append(Span(doc, ent.start, ent.end, label=ent.label, kb_id=doc.c[ent.start].ent_kb_id)) +*/ + try { + __pyx_t_5 = __pyx_v_state->c->_ents.at(__pyx_v_i); + } catch(...) { + __Pyx_CppExn2PyErr(); + __PYX_ERR(0, 272, __pyx_L1_error) + } + __pyx_v_ent = __pyx_t_5; + + /* "spacy/pipeline/_parser_internals/ner.pyx":273 + * for i in range(state.c._ents.size()): + * ent = state.c._ents.at(i) + * if ent.start != -1 and ent.end != -1: # <<<<<<<<<<<<<< + * ents.append(Span(doc, ent.start, ent.end, label=ent.label, kb_id=doc.c[ent.start].ent_kb_id)) + * doc.set_ents(ents, default="unmodified") +*/ + __pyx_t_7 = (__pyx_v_ent.start != -1L); + if (__pyx_t_7) { + } else { + __pyx_t_6 = __pyx_t_7; + goto __pyx_L6_bool_binop_done; + } + __pyx_t_7 = (__pyx_v_ent.end != -1L); + __pyx_t_6 = __pyx_t_7; + __pyx_L6_bool_binop_done:; + if (__pyx_t_6) { + + /* "spacy/pipeline/_parser_internals/ner.pyx":274 + * ent = state.c._ents.at(i) + * if ent.start != -1 and ent.end != -1: + * ents.append(Span(doc, ent.start, ent.end, label=ent.label, kb_id=doc.c[ent.start].ent_kb_id)) # <<<<<<<<<<<<<< + * doc.set_ents(ents, default="unmodified") + * # Set non-blocked tokens to O +*/ + __pyx_t_8 = NULL; + __pyx_t_9 = __Pyx_PyLong_From_int(__pyx_v_ent.start); if (unlikely(!__pyx_t_9)) __PYX_ERR(0, 274, __pyx_L1_error) + __Pyx_GOTREF(__pyx_t_9); + __pyx_t_10 = __Pyx_PyLong_From_int(__pyx_v_ent.end); if (unlikely(!__pyx_t_10)) __PYX_ERR(0, 274, __pyx_L1_error) + __Pyx_GOTREF(__pyx_t_10); + __pyx_t_11 = __Pyx_PyLong_From_uint64_t(__pyx_v_ent.label); if (unlikely(!__pyx_t_11)) __PYX_ERR(0, 274, __pyx_L1_error) + __Pyx_GOTREF(__pyx_t_11); + __pyx_t_12 = __Pyx_PyLong_From_uint64_t((__pyx_v_doc->c[__pyx_v_ent.start]).ent_kb_id); if (unlikely(!__pyx_t_12)) __PYX_ERR(0, 274, __pyx_L1_error) + __Pyx_GOTREF(__pyx_t_12); + __pyx_t_13 = 1; + { + PyObject *__pyx_callargs[4 + ((CYTHON_VECTORCALL) ? 2 : 0)] = {__pyx_t_8, ((PyObject *)__pyx_v_doc), __pyx_t_9, __pyx_t_10}; + __pyx_t_14 = __Pyx_MakeVectorcallBuilderKwds(2); if (unlikely(!__pyx_t_14)) __PYX_ERR(0, 274, __pyx_L1_error) + __Pyx_GOTREF(__pyx_t_14); + if (__Pyx_VectorcallBuilder_AddArg(__pyx_mstate_global->__pyx_n_u_label, __pyx_t_11, __pyx_t_14, __pyx_callargs+4, 0) < (0)) __PYX_ERR(0, 274, __pyx_L1_error) + if (__Pyx_VectorcallBuilder_AddArg(__pyx_mstate_global->__pyx_n_u_kb_id, __pyx_t_12, __pyx_t_14, __pyx_callargs+4, 1) < (0)) __PYX_ERR(0, 274, __pyx_L1_error) + __pyx_t_1 = __Pyx_Object_Vectorcall_CallFromBuilder((PyObject*)__pyx_mstate_global->__pyx_ptype_5spacy_6tokens_4span_Span, __pyx_callargs+__pyx_t_13, (4-__pyx_t_13) | (__pyx_t_13*__Pyx_PY_VECTORCALL_ARGUMENTS_OFFSET), __pyx_t_14); + __Pyx_XDECREF(__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_DECREF(__pyx_t_12); __pyx_t_12 = 0; + __Pyx_DECREF(__pyx_t_14); __pyx_t_14 = 0; + if (unlikely(!__pyx_t_1)) __PYX_ERR(0, 274, __pyx_L1_error) + __Pyx_GOTREF((PyObject *)__pyx_t_1); + } + __pyx_t_15 = __Pyx_PyList_Append(__pyx_v_ents, ((PyObject *)__pyx_t_1)); if (unlikely(__pyx_t_15 == ((int)-1))) __PYX_ERR(0, 274, __pyx_L1_error) + __Pyx_DECREF((PyObject *)__pyx_t_1); __pyx_t_1 = 0; + + /* "spacy/pipeline/_parser_internals/ner.pyx":273 + * for i in range(state.c._ents.size()): + * ent = state.c._ents.at(i) + * if ent.start != -1 and ent.end != -1: # <<<<<<<<<<<<<< + * ents.append(Span(doc, ent.start, ent.end, label=ent.label, kb_id=doc.c[ent.start].ent_kb_id)) + * doc.set_ents(ents, default="unmodified") +*/ + } + } + + /* "spacy/pipeline/_parser_internals/ner.pyx":275 + * if ent.start != -1 and ent.end != -1: + * ents.append(Span(doc, ent.start, ent.end, label=ent.label, kb_id=doc.c[ent.start].ent_kb_id)) + * doc.set_ents(ents, default="unmodified") # <<<<<<<<<<<<<< + * # Set non-blocked tokens to O + * for i in range(doc.length): +*/ + __pyx_t_14 = ((PyObject *)__pyx_v_doc); + __Pyx_INCREF(__pyx_t_14); + __pyx_t_13 = 0; + { + PyObject *__pyx_callargs[2 + ((CYTHON_VECTORCALL) ? 1 : 0)] = {__pyx_t_14, __pyx_v_ents}; + __pyx_t_12 = __Pyx_MakeVectorcallBuilderKwds(1); if (unlikely(!__pyx_t_12)) __PYX_ERR(0, 275, __pyx_L1_error) + __Pyx_GOTREF(__pyx_t_12); + if (__Pyx_VectorcallBuilder_AddArg(__pyx_mstate_global->__pyx_n_u_default, __pyx_mstate_global->__pyx_n_u_unmodified, __pyx_t_12, __pyx_callargs+2, 0) < (0)) __PYX_ERR(0, 275, __pyx_L1_error) + __pyx_t_1 = __Pyx_Object_VectorcallMethod_CallFromBuilder((PyObject*)__pyx_mstate_global->__pyx_n_u_set_ents, __pyx_callargs+__pyx_t_13, (2-__pyx_t_13) | (1*__Pyx_PY_VECTORCALL_ARGUMENTS_OFFSET), __pyx_t_12); + __Pyx_XDECREF(__pyx_t_14); __pyx_t_14 = 0; + __Pyx_DECREF(__pyx_t_12); __pyx_t_12 = 0; + if (unlikely(!__pyx_t_1)) __PYX_ERR(0, 275, __pyx_L1_error) + __Pyx_GOTREF(__pyx_t_1); + } + __Pyx_DECREF(__pyx_t_1); __pyx_t_1 = 0; + + /* "spacy/pipeline/_parser_internals/ner.pyx":277 + * doc.set_ents(ents, default="unmodified") + * # Set non-blocked tokens to O + * for i in range(doc.length): # <<<<<<<<<<<<<< + * if doc.c[i].ent_iob == 0: + * doc.c[i].ent_iob = 2 +*/ + __pyx_t_4 = __pyx_v_doc->length; + __pyx_t_16 = __pyx_t_4; + for (__pyx_t_17 = 0; __pyx_t_17 < __pyx_t_16; __pyx_t_17+=1) { + __pyx_v_i = __pyx_t_17; + + /* "spacy/pipeline/_parser_internals/ner.pyx":278 + * # Set non-blocked tokens to O + * for i in range(doc.length): + * if doc.c[i].ent_iob == 0: # <<<<<<<<<<<<<< + * doc.c[i].ent_iob = 2 + * +*/ + __pyx_t_6 = ((__pyx_v_doc->c[__pyx_v_i]).ent_iob == 0); + if (__pyx_t_6) { + + /* "spacy/pipeline/_parser_internals/ner.pyx":279 + * for i in range(doc.length): + * if doc.c[i].ent_iob == 0: + * doc.c[i].ent_iob = 2 # <<<<<<<<<<<<<< + * + * def get_beam_parses(self, Beam beam): +*/ + (__pyx_v_doc->c[__pyx_v_i]).ent_iob = 2; + + /* "spacy/pipeline/_parser_internals/ner.pyx":278 + * # Set non-blocked tokens to O + * for i in range(doc.length): + * if doc.c[i].ent_iob == 0: # <<<<<<<<<<<<<< + * doc.c[i].ent_iob = 2 + * +*/ + } + } + + /* "spacy/pipeline/_parser_internals/ner.pyx":268 + * return 1 + * + * def set_annotations(self, StateClass state, Doc doc): # <<<<<<<<<<<<<< + * cdef int i + * ents = [] +*/ + + /* 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_8); + __Pyx_XDECREF(__pyx_t_9); + __Pyx_XDECREF(__pyx_t_10); + __Pyx_XDECREF(__pyx_t_11); + __Pyx_XDECREF(__pyx_t_12); + __Pyx_XDECREF(__pyx_t_14); + __Pyx_AddTraceback("spacy.pipeline._parser_internals.ner.BiluoPushDown.set_annotations", __pyx_clineno, __pyx_lineno, __pyx_filename); + __pyx_r = NULL; + __pyx_L0:; + __Pyx_XDECREF(__pyx_v_ents); + __Pyx_XGIVEREF(__pyx_r); + __Pyx_RefNannyFinishContext(); + return __pyx_r; +} + +/* "spacy/pipeline/_parser_internals/ner.pyx":281 + * doc.c[i].ent_iob = 2 + * + * def get_beam_parses(self, Beam beam): # <<<<<<<<<<<<<< + * parses = [] + * probs = beam.probs +*/ + +/* Python wrapper */ +static PyObject *__pyx_pw_5spacy_8pipeline_17_parser_internals_3ner_13BiluoPushDown_15get_beam_parses(PyObject *__pyx_v_self, +#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_5spacy_8pipeline_17_parser_internals_3ner_13BiluoPushDown_14get_beam_parses, "BiluoPushDown.get_beam_parses(self, Beam beam)"); +static PyMethodDef __pyx_mdef_5spacy_8pipeline_17_parser_internals_3ner_13BiluoPushDown_15get_beam_parses = {"get_beam_parses", (PyCFunction)(void(*)(void))(__Pyx_PyCFunction_FastCallWithKeywords)__pyx_pw_5spacy_8pipeline_17_parser_internals_3ner_13BiluoPushDown_15get_beam_parses, __Pyx_METH_FASTCALL|METH_KEYWORDS, __pyx_doc_5spacy_8pipeline_17_parser_internals_3ner_13BiluoPushDown_14get_beam_parses}; +static PyObject *__pyx_pw_5spacy_8pipeline_17_parser_internals_3ner_13BiluoPushDown_15get_beam_parses(PyObject *__pyx_v_self, +#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_5thinc_5extra_6search_Beam *__pyx_v_beam = 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("get_beam_parses (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_beam,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, 281, __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, 281, __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, "get_beam_parses", 0) < (0)) __PYX_ERR(0, 281, __pyx_L3_error) + for (Py_ssize_t i = __pyx_nargs; i < 1; i++) { + if (unlikely(!values[i])) { __Pyx_RaiseArgtupleInvalid("get_beam_parses", 1, 1, 1, i); __PYX_ERR(0, 281, __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, 281, __pyx_L3_error) + } + __pyx_v_beam = ((struct __pyx_obj_5thinc_5extra_6search_Beam *)values[0]); + } + goto __pyx_L6_skip; + __pyx_L5_argtuple_error:; + __Pyx_RaiseArgtupleInvalid("get_beam_parses", 1, 1, 1, __pyx_nargs); __PYX_ERR(0, 281, __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("spacy.pipeline._parser_internals.ner.BiluoPushDown.get_beam_parses", __pyx_clineno, __pyx_lineno, __pyx_filename); + __Pyx_RefNannyFinishContext(); + return NULL; + __pyx_L4_argument_unpacking_done:; + if (unlikely(!__Pyx_ArgTypeTest(((PyObject *)__pyx_v_beam), __pyx_mstate_global->__pyx_ptype_5thinc_5extra_6search_Beam, 1, "beam", 0))) __PYX_ERR(0, 281, __pyx_L1_error) + __pyx_r = __pyx_pf_5spacy_8pipeline_17_parser_internals_3ner_13BiluoPushDown_14get_beam_parses(((struct __pyx_obj_5spacy_8pipeline_17_parser_internals_3ner_BiluoPushDown *)__pyx_v_self), __pyx_v_beam); + + /* 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_5spacy_8pipeline_17_parser_internals_3ner_13BiluoPushDown_14get_beam_parses(struct __pyx_obj_5spacy_8pipeline_17_parser_internals_3ner_BiluoPushDown *__pyx_v_self, struct __pyx_obj_5thinc_5extra_6search_Beam *__pyx_v_beam) { + PyObject *__pyx_v_parses = NULL; + PyObject *__pyx_v_probs = NULL; + __pyx_t_5thinc_5extra_6search_class_t __pyx_v_i; + __pyx_t_5spacy_8pipeline_17_parser_internals_6_state_StateC *__pyx_v_state; + PyObject *__pyx_v_prob = NULL; + PyObject *__pyx_v_parse = NULL; + std::vector ::size_type __pyx_v_j; + struct __pyx_t_5spacy_7structs_SpanC __pyx_v_ent; + PyObject *__pyx_r = NULL; + __Pyx_RefNannyDeclarations + PyObject *__pyx_t_1 = NULL; + __pyx_t_5thinc_5extra_6search_class_t __pyx_t_2; + __pyx_t_5thinc_5extra_6search_class_t __pyx_t_3; + __pyx_t_5thinc_5extra_6search_class_t __pyx_t_4; + void *__pyx_t_5; + int __pyx_t_6; + std::vector ::size_type __pyx_t_7; + std::vector ::size_type __pyx_t_8; + std::vector ::size_type __pyx_t_9; + __Pyx_FakeReference __pyx_t_10; + int __pyx_t_11; + PyObject *__pyx_t_12 = NULL; + PyObject *__pyx_t_13 = NULL; + PyObject *__pyx_t_14 = NULL; + int __pyx_t_15; + int __pyx_lineno = 0; + const char *__pyx_filename = NULL; + int __pyx_clineno = 0; + __Pyx_RefNannySetupContext("get_beam_parses", 0); + + /* "spacy/pipeline/_parser_internals/ner.pyx":282 + * + * def get_beam_parses(self, Beam beam): + * parses = [] # <<<<<<<<<<<<<< + * probs = beam.probs + * for i in range(beam.size): +*/ + __pyx_t_1 = PyList_New(0); if (unlikely(!__pyx_t_1)) __PYX_ERR(0, 282, __pyx_L1_error) + __Pyx_GOTREF(__pyx_t_1); + __pyx_v_parses = ((PyObject*)__pyx_t_1); + __pyx_t_1 = 0; + + /* "spacy/pipeline/_parser_internals/ner.pyx":283 + * def get_beam_parses(self, Beam beam): + * parses = [] + * probs = beam.probs # <<<<<<<<<<<<<< + * for i in range(beam.size): + * state = beam.at(i) +*/ + __pyx_t_1 = __Pyx_PyObject_GetAttrStr(((PyObject *)__pyx_v_beam), __pyx_mstate_global->__pyx_n_u_probs); if (unlikely(!__pyx_t_1)) __PYX_ERR(0, 283, __pyx_L1_error) + __Pyx_GOTREF(__pyx_t_1); + __pyx_v_probs = __pyx_t_1; + __pyx_t_1 = 0; + + /* "spacy/pipeline/_parser_internals/ner.pyx":284 + * parses = [] + * probs = beam.probs + * for i in range(beam.size): # <<<<<<<<<<<<<< + * state = beam.at(i) + * if state.is_final(): +*/ + __pyx_t_2 = __pyx_v_beam->size; + __pyx_t_3 = __pyx_t_2; + for (__pyx_t_4 = 0; __pyx_t_4 < __pyx_t_3; __pyx_t_4+=1) { + __pyx_v_i = __pyx_t_4; + + /* "spacy/pipeline/_parser_internals/ner.pyx":285 + * probs = beam.probs + * for i in range(beam.size): + * state = beam.at(i) # <<<<<<<<<<<<<< + * if state.is_final(): + * prob = probs[i] +*/ + __pyx_t_5 = __pyx_f_5thinc_5extra_6search_4Beam_at(__pyx_v_beam, __pyx_v_i); if (unlikely(PyErr_Occurred())) __PYX_ERR(0, 285, __pyx_L1_error) + __pyx_v_state = ((__pyx_t_5spacy_8pipeline_17_parser_internals_6_state_StateC *)__pyx_t_5); + + /* "spacy/pipeline/_parser_internals/ner.pyx":286 + * for i in range(beam.size): + * state = beam.at(i) + * if state.is_final(): # <<<<<<<<<<<<<< + * prob = probs[i] + * parse = [] +*/ + __pyx_t_6 = __pyx_v_state->is_final(); + if (__pyx_t_6) { + + /* "spacy/pipeline/_parser_internals/ner.pyx":287 + * state = beam.at(i) + * if state.is_final(): + * prob = probs[i] # <<<<<<<<<<<<<< + * parse = [] + * for j in range(state._ents.size()): +*/ + __pyx_t_1 = __Pyx_GetItemInt(__pyx_v_probs, __pyx_v_i, __pyx_t_5thinc_5extra_6search_class_t, 0, __Pyx_PyLong_From_uint64_t, 0, 0, 1, 1, __Pyx_ReferenceSharing_OwnStrongReference); if (unlikely(!__pyx_t_1)) __PYX_ERR(0, 287, __pyx_L1_error) + __Pyx_GOTREF(__pyx_t_1); + __Pyx_XDECREF_SET(__pyx_v_prob, __pyx_t_1); + __pyx_t_1 = 0; + + /* "spacy/pipeline/_parser_internals/ner.pyx":288 + * if state.is_final(): + * prob = probs[i] + * parse = [] # <<<<<<<<<<<<<< + * for j in range(state._ents.size()): + * ent = state._ents.at(j) +*/ + __pyx_t_1 = PyList_New(0); if (unlikely(!__pyx_t_1)) __PYX_ERR(0, 288, __pyx_L1_error) + __Pyx_GOTREF(__pyx_t_1); + __Pyx_XDECREF_SET(__pyx_v_parse, ((PyObject*)__pyx_t_1)); + __pyx_t_1 = 0; + + /* "spacy/pipeline/_parser_internals/ner.pyx":289 + * prob = probs[i] + * parse = [] + * for j in range(state._ents.size()): # <<<<<<<<<<<<<< + * ent = state._ents.at(j) + * if ent.start != -1 and ent.end != -1: +*/ + __pyx_t_7 = __pyx_v_state->_ents.size(); + __pyx_t_8 = __pyx_t_7; + for (__pyx_t_9 = 0; __pyx_t_9 < __pyx_t_8; __pyx_t_9+=1) { + __pyx_v_j = __pyx_t_9; + + /* "spacy/pipeline/_parser_internals/ner.pyx":290 + * parse = [] + * for j in range(state._ents.size()): + * ent = state._ents.at(j) # <<<<<<<<<<<<<< + * if ent.start != -1 and ent.end != -1: + * parse.append((ent.start, ent.end, self.strings[ent.label])) +*/ + try { + __pyx_t_10 = __pyx_v_state->_ents.at(__pyx_v_j); + } catch(...) { + __Pyx_CppExn2PyErr(); + __PYX_ERR(0, 290, __pyx_L1_error) + } + __pyx_v_ent = __pyx_t_10; + + /* "spacy/pipeline/_parser_internals/ner.pyx":291 + * for j in range(state._ents.size()): + * ent = state._ents.at(j) + * if ent.start != -1 and ent.end != -1: # <<<<<<<<<<<<<< + * parse.append((ent.start, ent.end, self.strings[ent.label])) + * parses.append((prob, parse)) +*/ + __pyx_t_11 = (__pyx_v_ent.start != -1L); + if (__pyx_t_11) { + } else { + __pyx_t_6 = __pyx_t_11; + goto __pyx_L9_bool_binop_done; + } + __pyx_t_11 = (__pyx_v_ent.end != -1L); + __pyx_t_6 = __pyx_t_11; + __pyx_L9_bool_binop_done:; + if (__pyx_t_6) { + + /* "spacy/pipeline/_parser_internals/ner.pyx":292 + * ent = state._ents.at(j) + * if ent.start != -1 and ent.end != -1: + * parse.append((ent.start, ent.end, self.strings[ent.label])) # <<<<<<<<<<<<<< + * parses.append((prob, parse)) + * return parses +*/ + __pyx_t_1 = __Pyx_PyLong_From_int(__pyx_v_ent.start); if (unlikely(!__pyx_t_1)) __PYX_ERR(0, 292, __pyx_L1_error) + __Pyx_GOTREF(__pyx_t_1); + __pyx_t_12 = __Pyx_PyLong_From_int(__pyx_v_ent.end); if (unlikely(!__pyx_t_12)) __PYX_ERR(0, 292, __pyx_L1_error) + __Pyx_GOTREF(__pyx_t_12); + __pyx_t_13 = __Pyx_GetItemInt(((PyObject *)__pyx_v_self->__pyx_base.strings), __pyx_v_ent.label, __pyx_t_5spacy_8typedefs_attr_t, 0, __Pyx_PyLong_From_uint64_t, 0, 0, 1, 1, __Pyx_ReferenceSharing_SharedReference); if (unlikely(!__pyx_t_13)) __PYX_ERR(0, 292, __pyx_L1_error) + __Pyx_GOTREF(__pyx_t_13); + __pyx_t_14 = PyTuple_New(3); if (unlikely(!__pyx_t_14)) __PYX_ERR(0, 292, __pyx_L1_error) + __Pyx_GOTREF(__pyx_t_14); + __Pyx_GIVEREF(__pyx_t_1); + if (__Pyx_PyTuple_SET_ITEM(__pyx_t_14, 0, __pyx_t_1) != (0)) __PYX_ERR(0, 292, __pyx_L1_error); + __Pyx_GIVEREF(__pyx_t_12); + if (__Pyx_PyTuple_SET_ITEM(__pyx_t_14, 1, __pyx_t_12) != (0)) __PYX_ERR(0, 292, __pyx_L1_error); + __Pyx_GIVEREF(__pyx_t_13); + if (__Pyx_PyTuple_SET_ITEM(__pyx_t_14, 2, __pyx_t_13) != (0)) __PYX_ERR(0, 292, __pyx_L1_error); + __pyx_t_1 = 0; + __pyx_t_12 = 0; + __pyx_t_13 = 0; + __pyx_t_15 = __Pyx_PyList_Append(__pyx_v_parse, __pyx_t_14); if (unlikely(__pyx_t_15 == ((int)-1))) __PYX_ERR(0, 292, __pyx_L1_error) + __Pyx_DECREF(__pyx_t_14); __pyx_t_14 = 0; + + /* "spacy/pipeline/_parser_internals/ner.pyx":291 + * for j in range(state._ents.size()): + * ent = state._ents.at(j) + * if ent.start != -1 and ent.end != -1: # <<<<<<<<<<<<<< + * parse.append((ent.start, ent.end, self.strings[ent.label])) + * parses.append((prob, parse)) +*/ + } + } + + /* "spacy/pipeline/_parser_internals/ner.pyx":293 + * if ent.start != -1 and ent.end != -1: + * parse.append((ent.start, ent.end, self.strings[ent.label])) + * parses.append((prob, parse)) # <<<<<<<<<<<<<< + * return parses + * +*/ + __pyx_t_14 = PyTuple_New(2); if (unlikely(!__pyx_t_14)) __PYX_ERR(0, 293, __pyx_L1_error) + __Pyx_GOTREF(__pyx_t_14); + __Pyx_INCREF(__pyx_v_prob); + __Pyx_GIVEREF(__pyx_v_prob); + if (__Pyx_PyTuple_SET_ITEM(__pyx_t_14, 0, __pyx_v_prob) != (0)) __PYX_ERR(0, 293, __pyx_L1_error); + __Pyx_INCREF(__pyx_v_parse); + __Pyx_GIVEREF(__pyx_v_parse); + if (__Pyx_PyTuple_SET_ITEM(__pyx_t_14, 1, __pyx_v_parse) != (0)) __PYX_ERR(0, 293, __pyx_L1_error); + __pyx_t_15 = __Pyx_PyList_Append(__pyx_v_parses, __pyx_t_14); if (unlikely(__pyx_t_15 == ((int)-1))) __PYX_ERR(0, 293, __pyx_L1_error) + __Pyx_DECREF(__pyx_t_14); __pyx_t_14 = 0; + + /* "spacy/pipeline/_parser_internals/ner.pyx":286 + * for i in range(beam.size): + * state = beam.at(i) + * if state.is_final(): # <<<<<<<<<<<<<< + * prob = probs[i] + * parse = [] +*/ + } + } + + /* "spacy/pipeline/_parser_internals/ner.pyx":294 + * parse.append((ent.start, ent.end, self.strings[ent.label])) + * parses.append((prob, parse)) + * return parses # <<<<<<<<<<<<<< + * + * def init_gold(self, StateClass state, Example example): +*/ + __Pyx_XDECREF(__pyx_r); + __Pyx_INCREF(__pyx_v_parses); + __pyx_r = __pyx_v_parses; + goto __pyx_L0; + + /* "spacy/pipeline/_parser_internals/ner.pyx":281 + * doc.c[i].ent_iob = 2 + * + * def get_beam_parses(self, Beam beam): # <<<<<<<<<<<<<< + * parses = [] + * probs = beam.probs +*/ + + /* function exit code */ + __pyx_L1_error:; + __Pyx_XDECREF(__pyx_t_1); + __Pyx_XDECREF(__pyx_t_12); + __Pyx_XDECREF(__pyx_t_13); + __Pyx_XDECREF(__pyx_t_14); + __Pyx_AddTraceback("spacy.pipeline._parser_internals.ner.BiluoPushDown.get_beam_parses", __pyx_clineno, __pyx_lineno, __pyx_filename); + __pyx_r = NULL; + __pyx_L0:; + __Pyx_XDECREF(__pyx_v_parses); + __Pyx_XDECREF(__pyx_v_probs); + __Pyx_XDECREF(__pyx_v_prob); + __Pyx_XDECREF(__pyx_v_parse); + __Pyx_XGIVEREF(__pyx_r); + __Pyx_RefNannyFinishContext(); + return __pyx_r; +} + +/* "spacy/pipeline/_parser_internals/ner.pyx":296 + * return parses + * + * def init_gold(self, StateClass state, Example example): # <<<<<<<<<<<<<< + * return BiluoGold(self, state, example, self.neg_key) + * +*/ + +/* Python wrapper */ +static PyObject *__pyx_pw_5spacy_8pipeline_17_parser_internals_3ner_13BiluoPushDown_17init_gold(PyObject *__pyx_v_self, +#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_5spacy_8pipeline_17_parser_internals_3ner_13BiluoPushDown_16init_gold, "BiluoPushDown.init_gold(self, StateClass state, Example example)"); +static PyMethodDef __pyx_mdef_5spacy_8pipeline_17_parser_internals_3ner_13BiluoPushDown_17init_gold = {"init_gold", (PyCFunction)(void(*)(void))(__Pyx_PyCFunction_FastCallWithKeywords)__pyx_pw_5spacy_8pipeline_17_parser_internals_3ner_13BiluoPushDown_17init_gold, __Pyx_METH_FASTCALL|METH_KEYWORDS, __pyx_doc_5spacy_8pipeline_17_parser_internals_3ner_13BiluoPushDown_16init_gold}; +static PyObject *__pyx_pw_5spacy_8pipeline_17_parser_internals_3ner_13BiluoPushDown_17init_gold(PyObject *__pyx_v_self, +#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_5spacy_8pipeline_17_parser_internals_10stateclass_StateClass *__pyx_v_state = 0; + struct __pyx_obj_5spacy_8training_7example_Example *__pyx_v_example = 0; + #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("init_gold (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_state,&__pyx_mstate_global->__pyx_n_u_example,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, 296, __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, 296, __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, 296, __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_gold", 0) < (0)) __PYX_ERR(0, 296, __pyx_L3_error) + for (Py_ssize_t i = __pyx_nargs; i < 2; i++) { + if (unlikely(!values[i])) { __Pyx_RaiseArgtupleInvalid("init_gold", 1, 2, 2, i); __PYX_ERR(0, 296, __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, 296, __pyx_L3_error) + values[1] = __Pyx_ArgRef_FASTCALL(__pyx_args, 1); + if (!CYTHON_ASSUME_SAFE_MACROS && unlikely(!values[1])) __PYX_ERR(0, 296, __pyx_L3_error) + } + __pyx_v_state = ((struct __pyx_obj_5spacy_8pipeline_17_parser_internals_10stateclass_StateClass *)values[0]); + __pyx_v_example = ((struct __pyx_obj_5spacy_8training_7example_Example *)values[1]); + } + goto __pyx_L6_skip; + __pyx_L5_argtuple_error:; + __Pyx_RaiseArgtupleInvalid("init_gold", 1, 2, 2, __pyx_nargs); __PYX_ERR(0, 296, __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("spacy.pipeline._parser_internals.ner.BiluoPushDown.init_gold", __pyx_clineno, __pyx_lineno, __pyx_filename); + __Pyx_RefNannyFinishContext(); + return NULL; + __pyx_L4_argument_unpacking_done:; + if (unlikely(!__Pyx_ArgTypeTest(((PyObject *)__pyx_v_state), __pyx_mstate_global->__pyx_ptype_5spacy_8pipeline_17_parser_internals_10stateclass_StateClass, 1, "state", 0))) __PYX_ERR(0, 296, __pyx_L1_error) + if (unlikely(!__Pyx_ArgTypeTest(((PyObject *)__pyx_v_example), __pyx_mstate_global->__pyx_ptype_5spacy_8training_7example_Example, 1, "example", 0))) __PYX_ERR(0, 296, __pyx_L1_error) + __pyx_r = __pyx_pf_5spacy_8pipeline_17_parser_internals_3ner_13BiluoPushDown_16init_gold(((struct __pyx_obj_5spacy_8pipeline_17_parser_internals_3ner_BiluoPushDown *)__pyx_v_self), __pyx_v_state, __pyx_v_example); + + /* 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_5spacy_8pipeline_17_parser_internals_3ner_13BiluoPushDown_16init_gold(struct __pyx_obj_5spacy_8pipeline_17_parser_internals_3ner_BiluoPushDown *__pyx_v_self, struct __pyx_obj_5spacy_8pipeline_17_parser_internals_10stateclass_StateClass *__pyx_v_state, struct __pyx_obj_5spacy_8training_7example_Example *__pyx_v_example) { + 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_lineno = 0; + const char *__pyx_filename = NULL; + int __pyx_clineno = 0; + __Pyx_RefNannySetupContext("init_gold", 0); + + /* "spacy/pipeline/_parser_internals/ner.pyx":297 + * + * def init_gold(self, StateClass state, Example example): + * return BiluoGold(self, state, example, self.neg_key) # <<<<<<<<<<<<<< + * + * def has_gold(self, Example eg, start=0, end=None): +*/ + __Pyx_XDECREF(__pyx_r); + __pyx_t_2 = NULL; + __pyx_t_3 = __Pyx_PyObject_GetAttrStr(((PyObject *)__pyx_v_self), __pyx_mstate_global->__pyx_n_u_neg_key); if (unlikely(!__pyx_t_3)) __PYX_ERR(0, 297, __pyx_L1_error) + __Pyx_GOTREF(__pyx_t_3); + __pyx_t_4 = 1; + { + PyObject *__pyx_callargs[5] = {__pyx_t_2, ((PyObject *)__pyx_v_self), ((PyObject *)__pyx_v_state), ((PyObject *)__pyx_v_example), __pyx_t_3}; + __pyx_t_1 = __Pyx_PyObject_FastCall((PyObject*)__pyx_mstate_global->__pyx_ptype_5spacy_8pipeline_17_parser_internals_3ner_BiluoGold, __pyx_callargs+__pyx_t_4, (5-__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, 297, __pyx_L1_error) + __Pyx_GOTREF((PyObject *)__pyx_t_1); + } + __pyx_r = ((PyObject *)__pyx_t_1); + __pyx_t_1 = 0; + goto __pyx_L0; + + /* "spacy/pipeline/_parser_internals/ner.pyx":296 + * return parses + * + * def init_gold(self, StateClass state, Example example): # <<<<<<<<<<<<<< + * return BiluoGold(self, state, example, self.neg_key) + * +*/ + + /* function exit code */ + __pyx_L1_error:; + __Pyx_XDECREF(__pyx_t_1); + __Pyx_XDECREF(__pyx_t_2); + __Pyx_XDECREF(__pyx_t_3); + __Pyx_AddTraceback("spacy.pipeline._parser_internals.ner.BiluoPushDown.init_gold", __pyx_clineno, __pyx_lineno, __pyx_filename); + __pyx_r = NULL; + __pyx_L0:; + __Pyx_XGIVEREF(__pyx_r); + __Pyx_RefNannyFinishContext(); + return __pyx_r; +} + +/* "spacy/pipeline/_parser_internals/ner.pyx":299 + * return BiluoGold(self, state, example, self.neg_key) + * + * def has_gold(self, Example eg, start=0, end=None): # <<<<<<<<<<<<<< + * # We get x and y referring to X, we want to check relative to Y, + * # the reference +*/ + +/* Python wrapper */ +static PyObject *__pyx_pw_5spacy_8pipeline_17_parser_internals_3ner_13BiluoPushDown_19has_gold(PyObject *__pyx_v_self, +#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_5spacy_8pipeline_17_parser_internals_3ner_13BiluoPushDown_18has_gold, "BiluoPushDown.has_gold(self, Example eg, start=0, end=None)"); +static PyMethodDef __pyx_mdef_5spacy_8pipeline_17_parser_internals_3ner_13BiluoPushDown_19has_gold = {"has_gold", (PyCFunction)(void(*)(void))(__Pyx_PyCFunction_FastCallWithKeywords)__pyx_pw_5spacy_8pipeline_17_parser_internals_3ner_13BiluoPushDown_19has_gold, __Pyx_METH_FASTCALL|METH_KEYWORDS, __pyx_doc_5spacy_8pipeline_17_parser_internals_3ner_13BiluoPushDown_18has_gold}; +static PyObject *__pyx_pw_5spacy_8pipeline_17_parser_internals_3ner_13BiluoPushDown_19has_gold(PyObject *__pyx_v_self, +#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_5spacy_8training_7example_Example *__pyx_v_eg = 0; + PyObject *__pyx_v_start = 0; + PyObject *__pyx_v_end = 0; + #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("has_gold (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_eg,&__pyx_mstate_global->__pyx_n_u_start,&__pyx_mstate_global->__pyx_n_u_end,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, 299, __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, 299, __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, 299, __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, 299, __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, "has_gold", 0) < (0)) __PYX_ERR(0, 299, __pyx_L3_error) + if (!values[1]) values[1] = __Pyx_NewRef(((PyObject *)__pyx_mstate_global->__pyx_int_0)); + if (!values[2]) values[2] = __Pyx_NewRef(((PyObject *)Py_None)); + for (Py_ssize_t i = __pyx_nargs; i < 1; i++) { + if (unlikely(!values[i])) { __Pyx_RaiseArgtupleInvalid("has_gold", 0, 1, 3, i); __PYX_ERR(0, 299, __pyx_L3_error) } + } + } else { + switch (__pyx_nargs) { + case 3: + values[2] = __Pyx_ArgRef_FASTCALL(__pyx_args, 2); + if (!CYTHON_ASSUME_SAFE_MACROS && unlikely(!values[2])) __PYX_ERR(0, 299, __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, 299, __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, 299, __pyx_L3_error) + break; + default: goto __pyx_L5_argtuple_error; + } + if (!values[1]) values[1] = __Pyx_NewRef(((PyObject *)__pyx_mstate_global->__pyx_int_0)); + if (!values[2]) values[2] = __Pyx_NewRef(((PyObject *)Py_None)); + } + __pyx_v_eg = ((struct __pyx_obj_5spacy_8training_7example_Example *)values[0]); + __pyx_v_start = values[1]; + __pyx_v_end = values[2]; + } + goto __pyx_L6_skip; + __pyx_L5_argtuple_error:; + __Pyx_RaiseArgtupleInvalid("has_gold", 0, 1, 3, __pyx_nargs); __PYX_ERR(0, 299, __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("spacy.pipeline._parser_internals.ner.BiluoPushDown.has_gold", __pyx_clineno, __pyx_lineno, __pyx_filename); + __Pyx_RefNannyFinishContext(); + return NULL; + __pyx_L4_argument_unpacking_done:; + if (unlikely(!__Pyx_ArgTypeTest(((PyObject *)__pyx_v_eg), __pyx_mstate_global->__pyx_ptype_5spacy_8training_7example_Example, 1, "eg", 0))) __PYX_ERR(0, 299, __pyx_L1_error) + __pyx_r = __pyx_pf_5spacy_8pipeline_17_parser_internals_3ner_13BiluoPushDown_18has_gold(((struct __pyx_obj_5spacy_8pipeline_17_parser_internals_3ner_BiluoPushDown *)__pyx_v_self), __pyx_v_eg, __pyx_v_start, __pyx_v_end); + + /* 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_5spacy_8pipeline_17_parser_internals_3ner_13BiluoPushDown_18has_gold(struct __pyx_obj_5spacy_8pipeline_17_parser_internals_3ner_BiluoPushDown *__pyx_v_self, struct __pyx_obj_5spacy_8training_7example_Example *__pyx_v_eg, PyObject *__pyx_v_start, PyObject *__pyx_v_end) { + PyObject *__pyx_v_y_spans = NULL; + PyObject *__pyx_v_y_span = NULL; + PyObject *__pyx_v_neg_key = NULL; + PyObject *__pyx_v_span = NULL; + PyObject *__pyx_v_word = NULL; + PyObject *__pyx_r = NULL; + __Pyx_RefNannyDeclarations + PyObject *__pyx_t_1 = NULL; + PyObject *__pyx_t_2 = NULL; + PyObject *__pyx_t_3 = NULL; + PyObject *__pyx_t_4 = NULL; + size_t __pyx_t_5; + int __pyx_t_6; + int __pyx_t_7; + Py_ssize_t __pyx_t_8; + PyObject *(*__pyx_t_9)(PyObject *); + int __pyx_lineno = 0; + const char *__pyx_filename = NULL; + int __pyx_clineno = 0; + __Pyx_RefNannySetupContext("has_gold", 0); + __Pyx_INCREF(__pyx_v_start); + __Pyx_INCREF(__pyx_v_end); + + /* "spacy/pipeline/_parser_internals/ner.pyx":302 + * # We get x and y referring to X, we want to check relative to Y, + * # the reference + * y_spans = eg.get_aligned_spans_x2y([eg.x[start:end]]) # <<<<<<<<<<<<<< + * if not y_spans: + * y_spans = [eg.y[:]] +*/ + __pyx_t_2 = ((PyObject *)__pyx_v_eg); + __Pyx_INCREF(__pyx_t_2); + __pyx_t_3 = __Pyx_PyObject_GetSlice(((PyObject *)__pyx_v_eg->x), 0, 0, &__pyx_v_start, &__pyx_v_end, NULL, 0, 0, 1); if (unlikely(!__pyx_t_3)) __PYX_ERR(0, 302, __pyx_L1_error) + __Pyx_GOTREF(__pyx_t_3); + __pyx_t_4 = PyList_New(1); if (unlikely(!__pyx_t_4)) __PYX_ERR(0, 302, __pyx_L1_error) + __Pyx_GOTREF(__pyx_t_4); + __Pyx_GIVEREF(__pyx_t_3); + if (__Pyx_PyList_SET_ITEM(__pyx_t_4, 0, __pyx_t_3) != (0)) __PYX_ERR(0, 302, __pyx_L1_error); + __pyx_t_3 = 0; + __pyx_t_5 = 0; + { + PyObject *__pyx_callargs[2] = {__pyx_t_2, __pyx_t_4}; + __pyx_t_1 = __Pyx_PyObject_FastCallMethod((PyObject*)__pyx_mstate_global->__pyx_n_u_get_aligned_spans_x2y, __pyx_callargs+__pyx_t_5, (2-__pyx_t_5) | (1*__Pyx_PY_VECTORCALL_ARGUMENTS_OFFSET)); + __Pyx_XDECREF(__pyx_t_2); __pyx_t_2 = 0; + __Pyx_DECREF(__pyx_t_4); __pyx_t_4 = 0; + if (unlikely(!__pyx_t_1)) __PYX_ERR(0, 302, __pyx_L1_error) + __Pyx_GOTREF(__pyx_t_1); + } + __pyx_v_y_spans = __pyx_t_1; + __pyx_t_1 = 0; + + /* "spacy/pipeline/_parser_internals/ner.pyx":303 + * # the reference + * y_spans = eg.get_aligned_spans_x2y([eg.x[start:end]]) + * if not y_spans: # <<<<<<<<<<<<<< + * y_spans = [eg.y[:]] + * y_span = y_spans[0] +*/ + __pyx_t_6 = __Pyx_PyObject_IsTrue(__pyx_v_y_spans); if (unlikely((__pyx_t_6 < 0))) __PYX_ERR(0, 303, __pyx_L1_error) + __pyx_t_7 = (!__pyx_t_6); + if (__pyx_t_7) { + + /* "spacy/pipeline/_parser_internals/ner.pyx":304 + * y_spans = eg.get_aligned_spans_x2y([eg.x[start:end]]) + * if not y_spans: + * y_spans = [eg.y[:]] # <<<<<<<<<<<<<< + * y_span = y_spans[0] + * start = y_span.start +*/ + __pyx_t_1 = __Pyx_PyObject_GetSlice(((PyObject *)__pyx_v_eg->y), 0, 0, NULL, NULL, &__pyx_mstate_global->__pyx_slice[0], 0, 0, 1); if (unlikely(!__pyx_t_1)) __PYX_ERR(0, 304, __pyx_L1_error) + __Pyx_GOTREF(__pyx_t_1); + __pyx_t_4 = PyList_New(1); if (unlikely(!__pyx_t_4)) __PYX_ERR(0, 304, __pyx_L1_error) + __Pyx_GOTREF(__pyx_t_4); + __Pyx_GIVEREF(__pyx_t_1); + if (__Pyx_PyList_SET_ITEM(__pyx_t_4, 0, __pyx_t_1) != (0)) __PYX_ERR(0, 304, __pyx_L1_error); + __pyx_t_1 = 0; + __Pyx_DECREF_SET(__pyx_v_y_spans, __pyx_t_4); + __pyx_t_4 = 0; + + /* "spacy/pipeline/_parser_internals/ner.pyx":303 + * # the reference + * y_spans = eg.get_aligned_spans_x2y([eg.x[start:end]]) + * if not y_spans: # <<<<<<<<<<<<<< + * y_spans = [eg.y[:]] + * y_span = y_spans[0] +*/ + } + + /* "spacy/pipeline/_parser_internals/ner.pyx":305 + * if not y_spans: + * y_spans = [eg.y[:]] + * y_span = y_spans[0] # <<<<<<<<<<<<<< + * start = y_span.start + * end = y_span.end +*/ + __pyx_t_4 = __Pyx_GetItemInt(__pyx_v_y_spans, 0, long, 1, __Pyx_PyLong_From_long, 0, 0, 1, 1, __Pyx_ReferenceSharing_OwnStrongReference); if (unlikely(!__pyx_t_4)) __PYX_ERR(0, 305, __pyx_L1_error) + __Pyx_GOTREF(__pyx_t_4); + __pyx_v_y_span = __pyx_t_4; + __pyx_t_4 = 0; + + /* "spacy/pipeline/_parser_internals/ner.pyx":306 + * y_spans = [eg.y[:]] + * y_span = y_spans[0] + * start = y_span.start # <<<<<<<<<<<<<< + * end = y_span.end + * neg_key = self.neg_key +*/ + __pyx_t_4 = __Pyx_PyObject_GetAttrStr(__pyx_v_y_span, __pyx_mstate_global->__pyx_n_u_start); if (unlikely(!__pyx_t_4)) __PYX_ERR(0, 306, __pyx_L1_error) + __Pyx_GOTREF(__pyx_t_4); + __Pyx_DECREF_SET(__pyx_v_start, __pyx_t_4); + __pyx_t_4 = 0; + + /* "spacy/pipeline/_parser_internals/ner.pyx":307 + * y_span = y_spans[0] + * start = y_span.start + * end = y_span.end # <<<<<<<<<<<<<< + * neg_key = self.neg_key + * if neg_key is not None: +*/ + __pyx_t_4 = __Pyx_PyObject_GetAttrStr(__pyx_v_y_span, __pyx_mstate_global->__pyx_n_u_end); if (unlikely(!__pyx_t_4)) __PYX_ERR(0, 307, __pyx_L1_error) + __Pyx_GOTREF(__pyx_t_4); + __Pyx_DECREF_SET(__pyx_v_end, __pyx_t_4); + __pyx_t_4 = 0; + + /* "spacy/pipeline/_parser_internals/ner.pyx":308 + * start = y_span.start + * end = y_span.end + * neg_key = self.neg_key # <<<<<<<<<<<<<< + * if neg_key is not None: + * # If we have any negative samples, count that as having annotation. +*/ + __pyx_t_4 = __Pyx_PyObject_GetAttrStr(((PyObject *)__pyx_v_self), __pyx_mstate_global->__pyx_n_u_neg_key); if (unlikely(!__pyx_t_4)) __PYX_ERR(0, 308, __pyx_L1_error) + __Pyx_GOTREF(__pyx_t_4); + __pyx_v_neg_key = __pyx_t_4; + __pyx_t_4 = 0; + + /* "spacy/pipeline/_parser_internals/ner.pyx":309 + * end = y_span.end + * neg_key = self.neg_key + * if neg_key is not None: # <<<<<<<<<<<<<< + * # If we have any negative samples, count that as having annotation. + * for span in eg.y.spans.get(neg_key, []): +*/ + __pyx_t_7 = (__pyx_v_neg_key != Py_None); + if (__pyx_t_7) { + + /* "spacy/pipeline/_parser_internals/ner.pyx":311 + * if neg_key is not None: + * # If we have any negative samples, count that as having annotation. + * for span in eg.y.spans.get(neg_key, []): # <<<<<<<<<<<<<< + * if span.start >= start and span.end <= end: + * return True +*/ + __pyx_t_1 = __pyx_v_eg->y->spans; + __Pyx_INCREF(__pyx_t_1); + __pyx_t_2 = PyList_New(0); if (unlikely(!__pyx_t_2)) __PYX_ERR(0, 311, __pyx_L1_error) + __Pyx_GOTREF(__pyx_t_2); + __pyx_t_5 = 0; + { + PyObject *__pyx_callargs[3] = {__pyx_t_1, __pyx_v_neg_key, __pyx_t_2}; + __pyx_t_4 = __Pyx_PyObject_FastCallMethod((PyObject*)__pyx_mstate_global->__pyx_n_u_get, __pyx_callargs+__pyx_t_5, (3-__pyx_t_5) | (1*__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_4)) __PYX_ERR(0, 311, __pyx_L1_error) + __Pyx_GOTREF(__pyx_t_4); + } + if (likely(PyList_CheckExact(__pyx_t_4)) || PyTuple_CheckExact(__pyx_t_4)) { + __pyx_t_2 = __pyx_t_4; __Pyx_INCREF(__pyx_t_2); + __pyx_t_8 = 0; + __pyx_t_9 = NULL; + } else { + __pyx_t_8 = -1; __pyx_t_2 = PyObject_GetIter(__pyx_t_4); if (unlikely(!__pyx_t_2)) __PYX_ERR(0, 311, __pyx_L1_error) + __Pyx_GOTREF(__pyx_t_2); + __pyx_t_9 = (CYTHON_COMPILING_IN_LIMITED_API) ? PyIter_Next : __Pyx_PyObject_GetIterNextFunc(__pyx_t_2); if (unlikely(!__pyx_t_9)) __PYX_ERR(0, 311, __pyx_L1_error) + } + __Pyx_DECREF(__pyx_t_4); __pyx_t_4 = 0; + for (;;) { + if (likely(!__pyx_t_9)) { + if (likely(PyList_CheckExact(__pyx_t_2))) { + { + Py_ssize_t __pyx_temp = __Pyx_PyList_GET_SIZE(__pyx_t_2); + #if !CYTHON_ASSUME_SAFE_SIZE + if (unlikely((__pyx_temp < 0))) __PYX_ERR(0, 311, __pyx_L1_error) + #endif + if (__pyx_t_8 >= __pyx_temp) break; + } + __pyx_t_4 = __Pyx_PyList_GetItemRefFast(__pyx_t_2, __pyx_t_8, __Pyx_ReferenceSharing_OwnStrongReference); + ++__pyx_t_8; + } else { + { + Py_ssize_t __pyx_temp = __Pyx_PyTuple_GET_SIZE(__pyx_t_2); + #if !CYTHON_ASSUME_SAFE_SIZE + if (unlikely((__pyx_temp < 0))) __PYX_ERR(0, 311, __pyx_L1_error) + #endif + if (__pyx_t_8 >= __pyx_temp) break; + } + #if CYTHON_ASSUME_SAFE_MACROS && !CYTHON_AVOID_BORROWED_REFS + __pyx_t_4 = __Pyx_NewRef(PyTuple_GET_ITEM(__pyx_t_2, __pyx_t_8)); + #else + __pyx_t_4 = __Pyx_PySequence_ITEM(__pyx_t_2, __pyx_t_8); + #endif + ++__pyx_t_8; + } + if (unlikely(!__pyx_t_4)) __PYX_ERR(0, 311, __pyx_L1_error) + } else { + __pyx_t_4 = __pyx_t_9(__pyx_t_2); + if (unlikely(!__pyx_t_4)) { + PyObject* exc_type = PyErr_Occurred(); + if (exc_type) { + if (unlikely(!__Pyx_PyErr_GivenExceptionMatches(exc_type, PyExc_StopIteration))) __PYX_ERR(0, 311, __pyx_L1_error) + PyErr_Clear(); + } + break; + } + } + __Pyx_GOTREF(__pyx_t_4); + __Pyx_XDECREF_SET(__pyx_v_span, __pyx_t_4); + __pyx_t_4 = 0; + + /* "spacy/pipeline/_parser_internals/ner.pyx":312 + * # If we have any negative samples, count that as having annotation. + * for span in eg.y.spans.get(neg_key, []): + * if span.start >= start and span.end <= end: # <<<<<<<<<<<<<< + * return True + * for word in eg.y[start:end]: +*/ + __pyx_t_4 = __Pyx_PyObject_GetAttrStr(__pyx_v_span, __pyx_mstate_global->__pyx_n_u_start); if (unlikely(!__pyx_t_4)) __PYX_ERR(0, 312, __pyx_L1_error) + __Pyx_GOTREF(__pyx_t_4); + __pyx_t_1 = PyObject_RichCompare(__pyx_t_4, __pyx_v_start, Py_GE); __Pyx_XGOTREF(__pyx_t_1); if (unlikely(!__pyx_t_1)) __PYX_ERR(0, 312, __pyx_L1_error) + __Pyx_DECREF(__pyx_t_4); __pyx_t_4 = 0; + __pyx_t_6 = __Pyx_PyObject_IsTrue(__pyx_t_1); if (unlikely((__pyx_t_6 < 0))) __PYX_ERR(0, 312, __pyx_L1_error) + __Pyx_DECREF(__pyx_t_1); __pyx_t_1 = 0; + if (__pyx_t_6) { + } else { + __pyx_t_7 = __pyx_t_6; + goto __pyx_L8_bool_binop_done; + } + __pyx_t_1 = __Pyx_PyObject_GetAttrStr(__pyx_v_span, __pyx_mstate_global->__pyx_n_u_end); if (unlikely(!__pyx_t_1)) __PYX_ERR(0, 312, __pyx_L1_error) + __Pyx_GOTREF(__pyx_t_1); + __pyx_t_4 = PyObject_RichCompare(__pyx_t_1, __pyx_v_end, Py_LE); __Pyx_XGOTREF(__pyx_t_4); if (unlikely(!__pyx_t_4)) __PYX_ERR(0, 312, __pyx_L1_error) + __Pyx_DECREF(__pyx_t_1); __pyx_t_1 = 0; + __pyx_t_6 = __Pyx_PyObject_IsTrue(__pyx_t_4); if (unlikely((__pyx_t_6 < 0))) __PYX_ERR(0, 312, __pyx_L1_error) + __Pyx_DECREF(__pyx_t_4); __pyx_t_4 = 0; + __pyx_t_7 = __pyx_t_6; + __pyx_L8_bool_binop_done:; + if (__pyx_t_7) { + + /* "spacy/pipeline/_parser_internals/ner.pyx":313 + * for span in eg.y.spans.get(neg_key, []): + * if span.start >= start and span.end <= end: + * return True # <<<<<<<<<<<<<< + * for word in eg.y[start:end]: + * if word.ent_iob != 0: +*/ + __Pyx_XDECREF(__pyx_r); + __Pyx_INCREF(Py_True); + __pyx_r = Py_True; + __Pyx_DECREF(__pyx_t_2); __pyx_t_2 = 0; + goto __pyx_L0; + + /* "spacy/pipeline/_parser_internals/ner.pyx":312 + * # If we have any negative samples, count that as having annotation. + * for span in eg.y.spans.get(neg_key, []): + * if span.start >= start and span.end <= end: # <<<<<<<<<<<<<< + * return True + * for word in eg.y[start:end]: +*/ + } + + /* "spacy/pipeline/_parser_internals/ner.pyx":311 + * if neg_key is not None: + * # If we have any negative samples, count that as having annotation. + * for span in eg.y.spans.get(neg_key, []): # <<<<<<<<<<<<<< + * if span.start >= start and span.end <= end: + * return True +*/ + } + __Pyx_DECREF(__pyx_t_2); __pyx_t_2 = 0; + + /* "spacy/pipeline/_parser_internals/ner.pyx":309 + * end = y_span.end + * neg_key = self.neg_key + * if neg_key is not None: # <<<<<<<<<<<<<< + * # If we have any negative samples, count that as having annotation. + * for span in eg.y.spans.get(neg_key, []): +*/ + } + + /* "spacy/pipeline/_parser_internals/ner.pyx":314 + * if span.start >= start and span.end <= end: + * return True + * for word in eg.y[start:end]: # <<<<<<<<<<<<<< + * if word.ent_iob != 0: + * return True +*/ + __pyx_t_2 = __Pyx_PyObject_GetSlice(((PyObject *)__pyx_v_eg->y), 0, 0, &__pyx_v_start, &__pyx_v_end, NULL, 0, 0, 1); if (unlikely(!__pyx_t_2)) __PYX_ERR(0, 314, __pyx_L1_error) + __Pyx_GOTREF(__pyx_t_2); + if (likely(PyList_CheckExact(__pyx_t_2)) || PyTuple_CheckExact(__pyx_t_2)) { + __pyx_t_4 = __pyx_t_2; __Pyx_INCREF(__pyx_t_4); + __pyx_t_8 = 0; + __pyx_t_9 = NULL; + } else { + __pyx_t_8 = -1; __pyx_t_4 = PyObject_GetIter(__pyx_t_2); if (unlikely(!__pyx_t_4)) __PYX_ERR(0, 314, __pyx_L1_error) + __Pyx_GOTREF(__pyx_t_4); + __pyx_t_9 = (CYTHON_COMPILING_IN_LIMITED_API) ? PyIter_Next : __Pyx_PyObject_GetIterNextFunc(__pyx_t_4); if (unlikely(!__pyx_t_9)) __PYX_ERR(0, 314, __pyx_L1_error) + } + __Pyx_DECREF(__pyx_t_2); __pyx_t_2 = 0; + for (;;) { + if (likely(!__pyx_t_9)) { + if (likely(PyList_CheckExact(__pyx_t_4))) { + { + Py_ssize_t __pyx_temp = __Pyx_PyList_GET_SIZE(__pyx_t_4); + #if !CYTHON_ASSUME_SAFE_SIZE + if (unlikely((__pyx_temp < 0))) __PYX_ERR(0, 314, __pyx_L1_error) + #endif + if (__pyx_t_8 >= __pyx_temp) break; + } + __pyx_t_2 = __Pyx_PyList_GetItemRefFast(__pyx_t_4, __pyx_t_8, __Pyx_ReferenceSharing_OwnStrongReference); + ++__pyx_t_8; + } else { + { + Py_ssize_t __pyx_temp = __Pyx_PyTuple_GET_SIZE(__pyx_t_4); + #if !CYTHON_ASSUME_SAFE_SIZE + if (unlikely((__pyx_temp < 0))) __PYX_ERR(0, 314, __pyx_L1_error) + #endif + if (__pyx_t_8 >= __pyx_temp) break; + } + #if CYTHON_ASSUME_SAFE_MACROS && !CYTHON_AVOID_BORROWED_REFS + __pyx_t_2 = __Pyx_NewRef(PyTuple_GET_ITEM(__pyx_t_4, __pyx_t_8)); + #else + __pyx_t_2 = __Pyx_PySequence_ITEM(__pyx_t_4, __pyx_t_8); + #endif + ++__pyx_t_8; + } + if (unlikely(!__pyx_t_2)) __PYX_ERR(0, 314, __pyx_L1_error) + } else { + __pyx_t_2 = __pyx_t_9(__pyx_t_4); + 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, 314, __pyx_L1_error) + PyErr_Clear(); + } + break; + } + } + __Pyx_GOTREF(__pyx_t_2); + __Pyx_XDECREF_SET(__pyx_v_word, __pyx_t_2); + __pyx_t_2 = 0; + + /* "spacy/pipeline/_parser_internals/ner.pyx":315 + * return True + * for word in eg.y[start:end]: + * if word.ent_iob != 0: # <<<<<<<<<<<<<< + * return True + * else: +*/ + __pyx_t_2 = __Pyx_PyObject_GetAttrStr(__pyx_v_word, __pyx_mstate_global->__pyx_n_u_ent_iob); if (unlikely(!__pyx_t_2)) __PYX_ERR(0, 315, __pyx_L1_error) + __Pyx_GOTREF(__pyx_t_2); + __pyx_t_7 = (__Pyx_PyLong_BoolNeObjC(__pyx_t_2, __pyx_mstate_global->__pyx_int_0, 0, 0)); if (unlikely((__pyx_t_7 < 0))) __PYX_ERR(0, 315, __pyx_L1_error) + __Pyx_DECREF(__pyx_t_2); __pyx_t_2 = 0; + if (__pyx_t_7) { + + /* "spacy/pipeline/_parser_internals/ner.pyx":316 + * for word in eg.y[start:end]: + * if word.ent_iob != 0: + * return True # <<<<<<<<<<<<<< + * else: + * return False +*/ + __Pyx_XDECREF(__pyx_r); + __Pyx_INCREF(Py_True); + __pyx_r = Py_True; + __Pyx_DECREF(__pyx_t_4); __pyx_t_4 = 0; + goto __pyx_L0; + + /* "spacy/pipeline/_parser_internals/ner.pyx":315 + * return True + * for word in eg.y[start:end]: + * if word.ent_iob != 0: # <<<<<<<<<<<<<< + * return True + * else: +*/ + } + + /* "spacy/pipeline/_parser_internals/ner.pyx":314 + * if span.start >= start and span.end <= end: + * return True + * for word in eg.y[start:end]: # <<<<<<<<<<<<<< + * if word.ent_iob != 0: + * return True +*/ + } + __Pyx_DECREF(__pyx_t_4); __pyx_t_4 = 0; + /*else*/ { + + /* "spacy/pipeline/_parser_internals/ner.pyx":318 + * return True + * else: + * return False # <<<<<<<<<<<<<< + * + * def get_cost(self, StateClass stcls, gold, int i): +*/ + __Pyx_XDECREF(__pyx_r); + __Pyx_INCREF(Py_False); + __pyx_r = Py_False; + goto __pyx_L0; + } + + /* "spacy/pipeline/_parser_internals/ner.pyx":299 + * return BiluoGold(self, state, example, self.neg_key) + * + * def has_gold(self, Example eg, start=0, end=None): # <<<<<<<<<<<<<< + * # We get x and y referring to X, we want to check relative to Y, + * # the reference +*/ + + /* function exit code */ + __pyx_L1_error:; + __Pyx_XDECREF(__pyx_t_1); + __Pyx_XDECREF(__pyx_t_2); + __Pyx_XDECREF(__pyx_t_3); + __Pyx_XDECREF(__pyx_t_4); + __Pyx_AddTraceback("spacy.pipeline._parser_internals.ner.BiluoPushDown.has_gold", __pyx_clineno, __pyx_lineno, __pyx_filename); + __pyx_r = NULL; + __pyx_L0:; + __Pyx_XDECREF(__pyx_v_y_spans); + __Pyx_XDECREF(__pyx_v_y_span); + __Pyx_XDECREF(__pyx_v_neg_key); + __Pyx_XDECREF(__pyx_v_span); + __Pyx_XDECREF(__pyx_v_word); + __Pyx_XDECREF(__pyx_v_start); + __Pyx_XDECREF(__pyx_v_end); + __Pyx_XGIVEREF(__pyx_r); + __Pyx_RefNannyFinishContext(); + return __pyx_r; +} + +/* "spacy/pipeline/_parser_internals/ner.pyx":320 + * return False + * + * def get_cost(self, StateClass stcls, gold, int i): # <<<<<<<<<<<<<< + * if not isinstance(gold, BiluoGold): + * raise TypeError(Errors.E909.format(name="BiluoGold")) +*/ + +/* Python wrapper */ +static PyObject *__pyx_pw_5spacy_8pipeline_17_parser_internals_3ner_13BiluoPushDown_21get_cost(PyObject *__pyx_v_self, +#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_5spacy_8pipeline_17_parser_internals_3ner_13BiluoPushDown_20get_cost, "BiluoPushDown.get_cost(self, StateClass stcls, gold, int i)"); +static PyMethodDef __pyx_mdef_5spacy_8pipeline_17_parser_internals_3ner_13BiluoPushDown_21get_cost = {"get_cost", (PyCFunction)(void(*)(void))(__Pyx_PyCFunction_FastCallWithKeywords)__pyx_pw_5spacy_8pipeline_17_parser_internals_3ner_13BiluoPushDown_21get_cost, __Pyx_METH_FASTCALL|METH_KEYWORDS, __pyx_doc_5spacy_8pipeline_17_parser_internals_3ner_13BiluoPushDown_20get_cost}; +static PyObject *__pyx_pw_5spacy_8pipeline_17_parser_internals_3ner_13BiluoPushDown_21get_cost(PyObject *__pyx_v_self, +#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_5spacy_8pipeline_17_parser_internals_10stateclass_StateClass *__pyx_v_stcls = 0; + PyObject *__pyx_v_gold = 0; + int __pyx_v_i; + #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("get_cost (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_stcls,&__pyx_mstate_global->__pyx_n_u_gold,&__pyx_mstate_global->__pyx_n_u_i,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, 320, __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, 320, __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, 320, __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, 320, __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, "get_cost", 0) < (0)) __PYX_ERR(0, 320, __pyx_L3_error) + for (Py_ssize_t i = __pyx_nargs; i < 3; i++) { + if (unlikely(!values[i])) { __Pyx_RaiseArgtupleInvalid("get_cost", 1, 3, 3, i); __PYX_ERR(0, 320, __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, 320, __pyx_L3_error) + values[1] = __Pyx_ArgRef_FASTCALL(__pyx_args, 1); + if (!CYTHON_ASSUME_SAFE_MACROS && unlikely(!values[1])) __PYX_ERR(0, 320, __pyx_L3_error) + values[2] = __Pyx_ArgRef_FASTCALL(__pyx_args, 2); + if (!CYTHON_ASSUME_SAFE_MACROS && unlikely(!values[2])) __PYX_ERR(0, 320, __pyx_L3_error) + } + __pyx_v_stcls = ((struct __pyx_obj_5spacy_8pipeline_17_parser_internals_10stateclass_StateClass *)values[0]); + __pyx_v_gold = values[1]; + __pyx_v_i = __Pyx_PyLong_As_int(values[2]); if (unlikely((__pyx_v_i == (int)-1) && PyErr_Occurred())) __PYX_ERR(0, 320, __pyx_L3_error) + } + goto __pyx_L6_skip; + __pyx_L5_argtuple_error:; + __Pyx_RaiseArgtupleInvalid("get_cost", 1, 3, 3, __pyx_nargs); __PYX_ERR(0, 320, __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("spacy.pipeline._parser_internals.ner.BiluoPushDown.get_cost", __pyx_clineno, __pyx_lineno, __pyx_filename); + __Pyx_RefNannyFinishContext(); + return NULL; + __pyx_L4_argument_unpacking_done:; + if (unlikely(!__Pyx_ArgTypeTest(((PyObject *)__pyx_v_stcls), __pyx_mstate_global->__pyx_ptype_5spacy_8pipeline_17_parser_internals_10stateclass_StateClass, 1, "stcls", 0))) __PYX_ERR(0, 320, __pyx_L1_error) + __pyx_r = __pyx_pf_5spacy_8pipeline_17_parser_internals_3ner_13BiluoPushDown_20get_cost(((struct __pyx_obj_5spacy_8pipeline_17_parser_internals_3ner_BiluoPushDown *)__pyx_v_self), __pyx_v_stcls, __pyx_v_gold, __pyx_v_i); + + /* 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_5spacy_8pipeline_17_parser_internals_3ner_13BiluoPushDown_20get_cost(struct __pyx_obj_5spacy_8pipeline_17_parser_internals_3ner_BiluoPushDown *__pyx_v_self, struct __pyx_obj_5spacy_8pipeline_17_parser_internals_10stateclass_StateClass *__pyx_v_stcls, PyObject *__pyx_v_gold, int __pyx_v_i) { + struct __pyx_obj_5spacy_8pipeline_17_parser_internals_3ner_BiluoGold *__pyx_v_gold_ = 0; + struct __pyx_t_5spacy_8pipeline_17_parser_internals_3ner_GoldNERStateC __pyx_v_gold_state; + PyObject *__pyx_v_cost = NULL; + PyObject *__pyx_r = NULL; + __Pyx_RefNannyDeclarations + int __pyx_t_1; + int __pyx_t_2; + PyObject *__pyx_t_3 = NULL; + PyObject *__pyx_t_4 = NULL; + PyObject *__pyx_t_5 = NULL; + PyObject *__pyx_t_6 = NULL; + PyObject *__pyx_t_7 = NULL; + PyObject *__pyx_t_8 = NULL; + size_t __pyx_t_9; + struct __pyx_t_5spacy_8pipeline_17_parser_internals_3ner_GoldNERStateC __pyx_t_10; + int __pyx_lineno = 0; + const char *__pyx_filename = NULL; + int __pyx_clineno = 0; + __Pyx_RefNannySetupContext("get_cost", 0); + + /* "spacy/pipeline/_parser_internals/ner.pyx":321 + * + * def get_cost(self, StateClass stcls, gold, int i): + * if not isinstance(gold, BiluoGold): # <<<<<<<<<<<<<< + * raise TypeError(Errors.E909.format(name="BiluoGold")) + * cdef BiluoGold gold_ = gold +*/ + __pyx_t_1 = __Pyx_TypeCheck(__pyx_v_gold, __pyx_mstate_global->__pyx_ptype_5spacy_8pipeline_17_parser_internals_3ner_BiluoGold); + __pyx_t_2 = (!__pyx_t_1); + if (unlikely(__pyx_t_2)) { + + /* "spacy/pipeline/_parser_internals/ner.pyx":322 + * def get_cost(self, StateClass stcls, gold, int i): + * if not isinstance(gold, BiluoGold): + * raise TypeError(Errors.E909.format(name="BiluoGold")) # <<<<<<<<<<<<<< + * cdef BiluoGold gold_ = gold + * gold_state = gold_.c +*/ + __pyx_t_4 = NULL; + __Pyx_GetModuleGlobalName(__pyx_t_7, __pyx_mstate_global->__pyx_n_u_Errors); if (unlikely(!__pyx_t_7)) __PYX_ERR(0, 322, __pyx_L1_error) + __Pyx_GOTREF(__pyx_t_7); + __pyx_t_8 = __Pyx_PyObject_GetAttrStr(__pyx_t_7, __pyx_mstate_global->__pyx_n_u_E909); if (unlikely(!__pyx_t_8)) __PYX_ERR(0, 322, __pyx_L1_error) + __Pyx_GOTREF(__pyx_t_8); + __Pyx_DECREF(__pyx_t_7); __pyx_t_7 = 0; + __pyx_t_6 = __pyx_t_8; + __Pyx_INCREF(__pyx_t_6); + __pyx_t_9 = 0; + { + PyObject *__pyx_callargs[2 + ((CYTHON_VECTORCALL) ? 1 : 0)] = {__pyx_t_6, NULL}; + __pyx_t_7 = __Pyx_MakeVectorcallBuilderKwds(1); if (unlikely(!__pyx_t_7)) __PYX_ERR(0, 322, __pyx_L1_error) + __Pyx_GOTREF(__pyx_t_7); + if (__Pyx_VectorcallBuilder_AddArg(__pyx_mstate_global->__pyx_n_u_name, __pyx_mstate_global->__pyx_n_u_BiluoGold, __pyx_t_7, __pyx_callargs+1, 0) < (0)) __PYX_ERR(0, 322, __pyx_L1_error) + __pyx_t_5 = __Pyx_Object_VectorcallMethod_CallFromBuilder((PyObject*)__pyx_mstate_global->__pyx_n_u_format, __pyx_callargs+__pyx_t_9, (1-__pyx_t_9) | (1*__Pyx_PY_VECTORCALL_ARGUMENTS_OFFSET), __pyx_t_7); + __Pyx_XDECREF(__pyx_t_6); __pyx_t_6 = 0; + __Pyx_DECREF(__pyx_t_7); __pyx_t_7 = 0; + __Pyx_DECREF(__pyx_t_8); __pyx_t_8 = 0; + if (unlikely(!__pyx_t_5)) __PYX_ERR(0, 322, __pyx_L1_error) + __Pyx_GOTREF(__pyx_t_5); + } + __pyx_t_9 = 1; + { + PyObject *__pyx_callargs[2] = {__pyx_t_4, __pyx_t_5}; + __pyx_t_3 = __Pyx_PyObject_FastCall((PyObject*)(((PyTypeObject*)PyExc_TypeError)), __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_5); __pyx_t_5 = 0; + if (unlikely(!__pyx_t_3)) __PYX_ERR(0, 322, __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, 322, __pyx_L1_error) + + /* "spacy/pipeline/_parser_internals/ner.pyx":321 + * + * def get_cost(self, StateClass stcls, gold, int i): + * if not isinstance(gold, BiluoGold): # <<<<<<<<<<<<<< + * raise TypeError(Errors.E909.format(name="BiluoGold")) + * cdef BiluoGold gold_ = gold +*/ + } + + /* "spacy/pipeline/_parser_internals/ner.pyx":323 + * if not isinstance(gold, BiluoGold): + * raise TypeError(Errors.E909.format(name="BiluoGold")) + * cdef BiluoGold gold_ = gold # <<<<<<<<<<<<<< + * gold_state = gold_.c + * if self.c[i].is_valid(stcls.c, self.c[i].label): +*/ + __pyx_t_3 = __pyx_v_gold; + __Pyx_INCREF(__pyx_t_3); + if (!(likely(((__pyx_t_3) == Py_None) || likely(__Pyx_TypeTest(__pyx_t_3, __pyx_mstate_global->__pyx_ptype_5spacy_8pipeline_17_parser_internals_3ner_BiluoGold))))) __PYX_ERR(0, 323, __pyx_L1_error) + __pyx_v_gold_ = ((struct __pyx_obj_5spacy_8pipeline_17_parser_internals_3ner_BiluoGold *)__pyx_t_3); + __pyx_t_3 = 0; + + /* "spacy/pipeline/_parser_internals/ner.pyx":324 + * raise TypeError(Errors.E909.format(name="BiluoGold")) + * cdef BiluoGold gold_ = gold + * gold_state = gold_.c # <<<<<<<<<<<<<< + * if self.c[i].is_valid(stcls.c, self.c[i].label): + * cost = self.c[i].get_cost(stcls.c, &gold_state, self.c[i].label) +*/ + __pyx_t_10 = __pyx_v_gold_->c; + __pyx_v_gold_state = __pyx_t_10; + + /* "spacy/pipeline/_parser_internals/ner.pyx":325 + * cdef BiluoGold gold_ = gold + * gold_state = gold_.c + * if self.c[i].is_valid(stcls.c, self.c[i].label): # <<<<<<<<<<<<<< + * cost = self.c[i].get_cost(stcls.c, &gold_state, self.c[i].label) + * else: +*/ + __pyx_t_2 = (__pyx_v_self->__pyx_base.c[__pyx_v_i]).is_valid(__pyx_v_stcls->c, (__pyx_v_self->__pyx_base.c[__pyx_v_i]).label); + if (__pyx_t_2) { + + /* "spacy/pipeline/_parser_internals/ner.pyx":326 + * gold_state = gold_.c + * if self.c[i].is_valid(stcls.c, self.c[i].label): + * cost = self.c[i].get_cost(stcls.c, &gold_state, self.c[i].label) # <<<<<<<<<<<<<< + * else: + * cost = 9000 +*/ + __pyx_t_3 = PyFloat_FromDouble((__pyx_v_self->__pyx_base.c[__pyx_v_i]).get_cost(__pyx_v_stcls->c, (&__pyx_v_gold_state), (__pyx_v_self->__pyx_base.c[__pyx_v_i]).label)); if (unlikely(!__pyx_t_3)) __PYX_ERR(0, 326, __pyx_L1_error) + __Pyx_GOTREF(__pyx_t_3); + __pyx_v_cost = __pyx_t_3; + __pyx_t_3 = 0; + + /* "spacy/pipeline/_parser_internals/ner.pyx":325 + * cdef BiluoGold gold_ = gold + * gold_state = gold_.c + * if self.c[i].is_valid(stcls.c, self.c[i].label): # <<<<<<<<<<<<<< + * cost = self.c[i].get_cost(stcls.c, &gold_state, self.c[i].label) + * else: +*/ + goto __pyx_L4; + } + + /* "spacy/pipeline/_parser_internals/ner.pyx":328 + * cost = self.c[i].get_cost(stcls.c, &gold_state, self.c[i].label) + * else: + * cost = 9000 # <<<<<<<<<<<<<< + * return cost + * +*/ + /*else*/ { + __Pyx_INCREF(__pyx_mstate_global->__pyx_int_9000); + __pyx_v_cost = __pyx_mstate_global->__pyx_int_9000; + } + __pyx_L4:; + + /* "spacy/pipeline/_parser_internals/ner.pyx":329 + * else: + * cost = 9000 + * return cost # <<<<<<<<<<<<<< + * + * cdef int set_costs(self, int* is_valid, weight_t* costs, +*/ + __Pyx_XDECREF(__pyx_r); + __Pyx_INCREF(__pyx_v_cost); + __pyx_r = __pyx_v_cost; + goto __pyx_L0; + + /* "spacy/pipeline/_parser_internals/ner.pyx":320 + * return False + * + * def get_cost(self, StateClass stcls, gold, int i): # <<<<<<<<<<<<<< + * if not isinstance(gold, BiluoGold): + * raise TypeError(Errors.E909.format(name="BiluoGold")) +*/ + + /* function exit code */ + __pyx_L1_error:; + __Pyx_XDECREF(__pyx_t_3); + __Pyx_XDECREF(__pyx_t_4); + __Pyx_XDECREF(__pyx_t_5); + __Pyx_XDECREF(__pyx_t_6); + __Pyx_XDECREF(__pyx_t_7); + __Pyx_XDECREF(__pyx_t_8); + __Pyx_AddTraceback("spacy.pipeline._parser_internals.ner.BiluoPushDown.get_cost", __pyx_clineno, __pyx_lineno, __pyx_filename); + __pyx_r = NULL; + __pyx_L0:; + __Pyx_XDECREF((PyObject *)__pyx_v_gold_); + __Pyx_XDECREF(__pyx_v_cost); + __Pyx_XGIVEREF(__pyx_r); + __Pyx_RefNannyFinishContext(); + return __pyx_r; +} + +/* "spacy/pipeline/_parser_internals/ner.pyx":331 + * return cost + * + * cdef int set_costs(self, int* is_valid, weight_t* costs, # <<<<<<<<<<<<<< + * const StateC* state, gold) except -1: + * if not isinstance(gold, BiluoGold): +*/ + +static int __pyx_f_5spacy_8pipeline_17_parser_internals_3ner_13BiluoPushDown_set_costs(struct __pyx_obj_5spacy_8pipeline_17_parser_internals_3ner_BiluoPushDown *__pyx_v_self, int *__pyx_v_is_valid, __pyx_t_5spacy_8typedefs_weight_t *__pyx_v_costs, __pyx_t_5spacy_8pipeline_17_parser_internals_6_state_StateC const *__pyx_v_state, PyObject *__pyx_v_gold) { + struct __pyx_obj_5spacy_8pipeline_17_parser_internals_3ner_BiluoGold *__pyx_v_gold_ = 0; + struct __pyx_t_5spacy_8pipeline_17_parser_internals_3ner_GoldNERStateC __pyx_v_gold_state; + PyObject *__pyx_v_n_gold = NULL; + int __pyx_v_i; + int __pyx_r; + __Pyx_RefNannyDeclarations + int __pyx_t_1; + int __pyx_t_2; + PyObject *__pyx_t_3 = NULL; + PyObject *__pyx_t_4 = NULL; + PyObject *__pyx_t_5 = NULL; + PyObject *__pyx_t_6 = NULL; + PyObject *__pyx_t_7 = NULL; + PyObject *__pyx_t_8 = NULL; + size_t __pyx_t_9; + struct __pyx_t_5spacy_8pipeline_17_parser_internals_3ner_GoldNERStateC __pyx_t_10; + int __pyx_t_11; + int __pyx_t_12; + int __pyx_t_13; + int __pyx_lineno = 0; + const char *__pyx_filename = NULL; + int __pyx_clineno = 0; + __Pyx_RefNannySetupContext("set_costs", 0); + + /* "spacy/pipeline/_parser_internals/ner.pyx":333 + * cdef int set_costs(self, int* is_valid, weight_t* costs, + * const StateC* state, gold) except -1: + * if not isinstance(gold, BiluoGold): # <<<<<<<<<<<<<< + * raise TypeError(Errors.E909.format(name="BiluoGold")) + * cdef BiluoGold gold_ = gold +*/ + __pyx_t_1 = __Pyx_TypeCheck(__pyx_v_gold, __pyx_mstate_global->__pyx_ptype_5spacy_8pipeline_17_parser_internals_3ner_BiluoGold); + __pyx_t_2 = (!__pyx_t_1); + if (unlikely(__pyx_t_2)) { + + /* "spacy/pipeline/_parser_internals/ner.pyx":334 + * const StateC* state, gold) except -1: + * if not isinstance(gold, BiluoGold): + * raise TypeError(Errors.E909.format(name="BiluoGold")) # <<<<<<<<<<<<<< + * cdef BiluoGold gold_ = gold + * gold_state = gold_.c +*/ + __pyx_t_4 = NULL; + __Pyx_GetModuleGlobalName(__pyx_t_7, __pyx_mstate_global->__pyx_n_u_Errors); if (unlikely(!__pyx_t_7)) __PYX_ERR(0, 334, __pyx_L1_error) + __Pyx_GOTREF(__pyx_t_7); + __pyx_t_8 = __Pyx_PyObject_GetAttrStr(__pyx_t_7, __pyx_mstate_global->__pyx_n_u_E909); if (unlikely(!__pyx_t_8)) __PYX_ERR(0, 334, __pyx_L1_error) + __Pyx_GOTREF(__pyx_t_8); + __Pyx_DECREF(__pyx_t_7); __pyx_t_7 = 0; + __pyx_t_6 = __pyx_t_8; + __Pyx_INCREF(__pyx_t_6); + __pyx_t_9 = 0; + { + PyObject *__pyx_callargs[2 + ((CYTHON_VECTORCALL) ? 1 : 0)] = {__pyx_t_6, NULL}; + __pyx_t_7 = __Pyx_MakeVectorcallBuilderKwds(1); if (unlikely(!__pyx_t_7)) __PYX_ERR(0, 334, __pyx_L1_error) + __Pyx_GOTREF(__pyx_t_7); + if (__Pyx_VectorcallBuilder_AddArg(__pyx_mstate_global->__pyx_n_u_name, __pyx_mstate_global->__pyx_n_u_BiluoGold, __pyx_t_7, __pyx_callargs+1, 0) < (0)) __PYX_ERR(0, 334, __pyx_L1_error) + __pyx_t_5 = __Pyx_Object_VectorcallMethod_CallFromBuilder((PyObject*)__pyx_mstate_global->__pyx_n_u_format, __pyx_callargs+__pyx_t_9, (1-__pyx_t_9) | (1*__Pyx_PY_VECTORCALL_ARGUMENTS_OFFSET), __pyx_t_7); + __Pyx_XDECREF(__pyx_t_6); __pyx_t_6 = 0; + __Pyx_DECREF(__pyx_t_7); __pyx_t_7 = 0; + __Pyx_DECREF(__pyx_t_8); __pyx_t_8 = 0; + if (unlikely(!__pyx_t_5)) __PYX_ERR(0, 334, __pyx_L1_error) + __Pyx_GOTREF(__pyx_t_5); + } + __pyx_t_9 = 1; + { + PyObject *__pyx_callargs[2] = {__pyx_t_4, __pyx_t_5}; + __pyx_t_3 = __Pyx_PyObject_FastCall((PyObject*)(((PyTypeObject*)PyExc_TypeError)), __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_5); __pyx_t_5 = 0; + if (unlikely(!__pyx_t_3)) __PYX_ERR(0, 334, __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, 334, __pyx_L1_error) + + /* "spacy/pipeline/_parser_internals/ner.pyx":333 + * cdef int set_costs(self, int* is_valid, weight_t* costs, + * const StateC* state, gold) except -1: + * if not isinstance(gold, BiluoGold): # <<<<<<<<<<<<<< + * raise TypeError(Errors.E909.format(name="BiluoGold")) + * cdef BiluoGold gold_ = gold +*/ + } + + /* "spacy/pipeline/_parser_internals/ner.pyx":335 + * if not isinstance(gold, BiluoGold): + * raise TypeError(Errors.E909.format(name="BiluoGold")) + * cdef BiluoGold gold_ = gold # <<<<<<<<<<<<<< + * gold_state = gold_.c + * update_gold_state(&gold_state, state) +*/ + __pyx_t_3 = __pyx_v_gold; + __Pyx_INCREF(__pyx_t_3); + if (!(likely(((__pyx_t_3) == Py_None) || likely(__Pyx_TypeTest(__pyx_t_3, __pyx_mstate_global->__pyx_ptype_5spacy_8pipeline_17_parser_internals_3ner_BiluoGold))))) __PYX_ERR(0, 335, __pyx_L1_error) + __pyx_v_gold_ = ((struct __pyx_obj_5spacy_8pipeline_17_parser_internals_3ner_BiluoGold *)__pyx_t_3); + __pyx_t_3 = 0; + + /* "spacy/pipeline/_parser_internals/ner.pyx":336 + * raise TypeError(Errors.E909.format(name="BiluoGold")) + * cdef BiluoGold gold_ = gold + * gold_state = gold_.c # <<<<<<<<<<<<<< + * update_gold_state(&gold_state, state) + * n_gold = 0 +*/ + __pyx_t_10 = __pyx_v_gold_->c; + __pyx_v_gold_state = __pyx_t_10; + + /* "spacy/pipeline/_parser_internals/ner.pyx":337 + * cdef BiluoGold gold_ = gold + * gold_state = gold_.c + * update_gold_state(&gold_state, state) # <<<<<<<<<<<<<< + * n_gold = 0 + * self.set_valid(is_valid, state) +*/ + __pyx_f_5spacy_8pipeline_17_parser_internals_3ner_update_gold_state((&__pyx_v_gold_state), __pyx_v_state); if (unlikely(PyErr_Occurred())) __PYX_ERR(0, 337, __pyx_L1_error) + + /* "spacy/pipeline/_parser_internals/ner.pyx":338 + * gold_state = gold_.c + * update_gold_state(&gold_state, state) + * n_gold = 0 # <<<<<<<<<<<<<< + * self.set_valid(is_valid, state) + * for i in range(self.n_moves): +*/ + __Pyx_INCREF(__pyx_mstate_global->__pyx_int_0); + __pyx_v_n_gold = __pyx_mstate_global->__pyx_int_0; + + /* "spacy/pipeline/_parser_internals/ner.pyx":339 + * update_gold_state(&gold_state, state) + * n_gold = 0 + * self.set_valid(is_valid, state) # <<<<<<<<<<<<<< + * for i in range(self.n_moves): + * if is_valid[i]: +*/ + (void)(((struct __pyx_vtabstruct_5spacy_8pipeline_17_parser_internals_3ner_BiluoPushDown *)__pyx_v_self->__pyx_base.__pyx_vtab)->__pyx_base.set_valid(((struct __pyx_obj_5spacy_8pipeline_17_parser_internals_17transition_system_TransitionSystem *)__pyx_v_self), __pyx_v_is_valid, __pyx_v_state)); + + /* "spacy/pipeline/_parser_internals/ner.pyx":340 + * n_gold = 0 + * self.set_valid(is_valid, state) + * for i in range(self.n_moves): # <<<<<<<<<<<<<< + * if is_valid[i]: + * costs[i] = self.c[i].get_cost(state, &gold_state, self.c[i].label) +*/ + __pyx_t_11 = __pyx_v_self->__pyx_base.n_moves; + __pyx_t_12 = __pyx_t_11; + for (__pyx_t_13 = 0; __pyx_t_13 < __pyx_t_12; __pyx_t_13+=1) { + __pyx_v_i = __pyx_t_13; + + /* "spacy/pipeline/_parser_internals/ner.pyx":341 + * self.set_valid(is_valid, state) + * for i in range(self.n_moves): + * if is_valid[i]: # <<<<<<<<<<<<<< + * costs[i] = self.c[i].get_cost(state, &gold_state, self.c[i].label) + * n_gold += costs[i] <= 0 +*/ + __pyx_t_2 = ((__pyx_v_is_valid[__pyx_v_i]) != 0); + if (__pyx_t_2) { + + /* "spacy/pipeline/_parser_internals/ner.pyx":342 + * for i in range(self.n_moves): + * if is_valid[i]: + * costs[i] = self.c[i].get_cost(state, &gold_state, self.c[i].label) # <<<<<<<<<<<<<< + * n_gold += costs[i] <= 0 + * else: +*/ + (__pyx_v_costs[__pyx_v_i]) = (__pyx_v_self->__pyx_base.c[__pyx_v_i]).get_cost(__pyx_v_state, (&__pyx_v_gold_state), (__pyx_v_self->__pyx_base.c[__pyx_v_i]).label); + + /* "spacy/pipeline/_parser_internals/ner.pyx":343 + * if is_valid[i]: + * costs[i] = self.c[i].get_cost(state, &gold_state, self.c[i].label) + * n_gold += costs[i] <= 0 # <<<<<<<<<<<<<< + * else: + * costs[i] = 9000 +*/ + __pyx_t_3 = __Pyx_PyBool_FromLong(((__pyx_v_costs[__pyx_v_i]) <= 0.0)); if (unlikely(!__pyx_t_3)) __PYX_ERR(0, 343, __pyx_L1_error) + __Pyx_GOTREF(__pyx_t_3); + __pyx_t_5 = PyNumber_InPlaceAdd(__pyx_v_n_gold, __pyx_t_3); if (unlikely(!__pyx_t_5)) __PYX_ERR(0, 343, __pyx_L1_error) + __Pyx_GOTREF(__pyx_t_5); + __Pyx_DECREF(__pyx_t_3); __pyx_t_3 = 0; + __Pyx_DECREF_SET(__pyx_v_n_gold, __pyx_t_5); + __pyx_t_5 = 0; + + /* "spacy/pipeline/_parser_internals/ner.pyx":341 + * self.set_valid(is_valid, state) + * for i in range(self.n_moves): + * if is_valid[i]: # <<<<<<<<<<<<<< + * costs[i] = self.c[i].get_cost(state, &gold_state, self.c[i].label) + * n_gold += costs[i] <= 0 +*/ + goto __pyx_L6; + } + + /* "spacy/pipeline/_parser_internals/ner.pyx":345 + * n_gold += costs[i] <= 0 + * else: + * costs[i] = 9000 # <<<<<<<<<<<<<< + * + * +*/ + /*else*/ { + (__pyx_v_costs[__pyx_v_i]) = 9000.0; + } + __pyx_L6:; + } + + /* "spacy/pipeline/_parser_internals/ner.pyx":331 + * return cost + * + * cdef int set_costs(self, int* is_valid, weight_t* costs, # <<<<<<<<<<<<<< + * const StateC* state, gold) except -1: + * if not isinstance(gold, BiluoGold): +*/ + + /* function exit code */ + __pyx_r = 0; + goto __pyx_L0; + __pyx_L1_error:; + __Pyx_XDECREF(__pyx_t_3); + __Pyx_XDECREF(__pyx_t_4); + __Pyx_XDECREF(__pyx_t_5); + __Pyx_XDECREF(__pyx_t_6); + __Pyx_XDECREF(__pyx_t_7); + __Pyx_XDECREF(__pyx_t_8); + __Pyx_AddTraceback("spacy.pipeline._parser_internals.ner.BiluoPushDown.set_costs", __pyx_clineno, __pyx_lineno, __pyx_filename); + __pyx_r = -1; + __pyx_L0:; + __Pyx_XDECREF((PyObject *)__pyx_v_gold_); + __Pyx_XDECREF(__pyx_v_n_gold); + __Pyx_RefNannyFinishContext(); + return __pyx_r; +} + +/* "(tree fragment)":1 + * def __reduce_cython__(self): # <<<<<<<<<<<<<< + * raise TypeError, "self.c,self.del_beam_state,self.init_beam_state cannot be converted to a Python object for pickling" + * def __setstate_cython__(self, __pyx_state): +*/ + +/* Python wrapper */ +static PyObject *__pyx_pw_5spacy_8pipeline_17_parser_internals_3ner_13BiluoPushDown_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_5spacy_8pipeline_17_parser_internals_3ner_13BiluoPushDown_22__reduce_cython__, "BiluoPushDown.__reduce_cython__(self)"); +static PyMethodDef __pyx_mdef_5spacy_8pipeline_17_parser_internals_3ner_13BiluoPushDown_23__reduce_cython__ = {"__reduce_cython__", (PyCFunction)(void(*)(void))(__Pyx_PyCFunction_FastCallWithKeywords)__pyx_pw_5spacy_8pipeline_17_parser_internals_3ner_13BiluoPushDown_23__reduce_cython__, __Pyx_METH_FASTCALL|METH_KEYWORDS, __pyx_doc_5spacy_8pipeline_17_parser_internals_3ner_13BiluoPushDown_22__reduce_cython__}; +static PyObject *__pyx_pw_5spacy_8pipeline_17_parser_internals_3ner_13BiluoPushDown_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_5spacy_8pipeline_17_parser_internals_3ner_13BiluoPushDown_22__reduce_cython__(((struct __pyx_obj_5spacy_8pipeline_17_parser_internals_3ner_BiluoPushDown *)__pyx_v_self)); + + /* function exit code */ + __Pyx_RefNannyFinishContext(); + return __pyx_r; +} + +static PyObject *__pyx_pf_5spacy_8pipeline_17_parser_internals_3ner_13BiluoPushDown_22__reduce_cython__(CYTHON_UNUSED struct __pyx_obj_5spacy_8pipeline_17_parser_internals_3ner_BiluoPushDown *__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.c,self.del_beam_state,self.init_beam_state cannot be converted to a Python object for pickling" # <<<<<<<<<<<<<< + * def __setstate_cython__(self, __pyx_state): + * raise TypeError, "self.c,self.del_beam_state,self.init_beam_state cannot be converted to a Python object for pickling" +*/ + __Pyx_Raise(((PyObject *)(((PyTypeObject*)PyExc_TypeError))), __pyx_mstate_global->__pyx_kp_u_self_c_self_del_beam_state_self, 0, 0); + __PYX_ERR(1, 2, __pyx_L1_error) + + /* "(tree fragment)":1 + * def __reduce_cython__(self): # <<<<<<<<<<<<<< + * raise TypeError, "self.c,self.del_beam_state,self.init_beam_state cannot be converted to a Python object for pickling" + * def __setstate_cython__(self, __pyx_state): +*/ + + /* function exit code */ + __pyx_L1_error:; + __Pyx_AddTraceback("spacy.pipeline._parser_internals.ner.BiluoPushDown.__reduce_cython__", __pyx_clineno, __pyx_lineno, __pyx_filename); + __pyx_r = NULL; + __Pyx_XGIVEREF(__pyx_r); + __Pyx_RefNannyFinishContext(); + return __pyx_r; +} + +/* "(tree fragment)":3 + * def __reduce_cython__(self): + * raise TypeError, "self.c,self.del_beam_state,self.init_beam_state cannot be converted to a Python object for pickling" + * def __setstate_cython__(self, __pyx_state): # <<<<<<<<<<<<<< + * raise TypeError, "self.c,self.del_beam_state,self.init_beam_state cannot be converted to a Python object for pickling" +*/ + +/* Python wrapper */ +static PyObject *__pyx_pw_5spacy_8pipeline_17_parser_internals_3ner_13BiluoPushDown_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_5spacy_8pipeline_17_parser_internals_3ner_13BiluoPushDown_24__setstate_cython__, "BiluoPushDown.__setstate_cython__(self, __pyx_state)"); +static PyMethodDef __pyx_mdef_5spacy_8pipeline_17_parser_internals_3ner_13BiluoPushDown_25__setstate_cython__ = {"__setstate_cython__", (PyCFunction)(void(*)(void))(__Pyx_PyCFunction_FastCallWithKeywords)__pyx_pw_5spacy_8pipeline_17_parser_internals_3ner_13BiluoPushDown_25__setstate_cython__, __Pyx_METH_FASTCALL|METH_KEYWORDS, __pyx_doc_5spacy_8pipeline_17_parser_internals_3ner_13BiluoPushDown_24__setstate_cython__}; +static PyObject *__pyx_pw_5spacy_8pipeline_17_parser_internals_3ner_13BiluoPushDown_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("spacy.pipeline._parser_internals.ner.BiluoPushDown.__setstate_cython__", __pyx_clineno, __pyx_lineno, __pyx_filename); + __Pyx_RefNannyFinishContext(); + return NULL; + __pyx_L4_argument_unpacking_done:; + __pyx_r = __pyx_pf_5spacy_8pipeline_17_parser_internals_3ner_13BiluoPushDown_24__setstate_cython__(((struct __pyx_obj_5spacy_8pipeline_17_parser_internals_3ner_BiluoPushDown *)__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_5spacy_8pipeline_17_parser_internals_3ner_13BiluoPushDown_24__setstate_cython__(CYTHON_UNUSED struct __pyx_obj_5spacy_8pipeline_17_parser_internals_3ner_BiluoPushDown *__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.c,self.del_beam_state,self.init_beam_state cannot be converted to a Python object for pickling" + * def __setstate_cython__(self, __pyx_state): + * raise TypeError, "self.c,self.del_beam_state,self.init_beam_state cannot be converted to a Python object for pickling" # <<<<<<<<<<<<<< +*/ + __Pyx_Raise(((PyObject *)(((PyTypeObject*)PyExc_TypeError))), __pyx_mstate_global->__pyx_kp_u_self_c_self_del_beam_state_self, 0, 0); + __PYX_ERR(1, 4, __pyx_L1_error) + + /* "(tree fragment)":3 + * def __reduce_cython__(self): + * raise TypeError, "self.c,self.del_beam_state,self.init_beam_state cannot be converted to a Python object for pickling" + * def __setstate_cython__(self, __pyx_state): # <<<<<<<<<<<<<< + * raise TypeError, "self.c,self.del_beam_state,self.init_beam_state cannot be converted to a Python object for pickling" +*/ + + /* function exit code */ + __pyx_L1_error:; + __Pyx_AddTraceback("spacy.pipeline._parser_internals.ner.BiluoPushDown.__setstate_cython__", __pyx_clineno, __pyx_lineno, __pyx_filename); + __pyx_r = NULL; + __Pyx_XGIVEREF(__pyx_r); + __Pyx_RefNannyFinishContext(); + return __pyx_r; +} + +/* "spacy/pipeline/_parser_internals/ner.pyx":349 + * + * cdef class Missing: + * @staticmethod # <<<<<<<<<<<<<< + * cdef bint is_valid(const StateC* st, attr_t label) noexcept nogil: + * return False +*/ + +static int __pyx_f_5spacy_8pipeline_17_parser_internals_3ner_7Missing_is_valid(CYTHON_UNUSED __pyx_t_5spacy_8pipeline_17_parser_internals_6_state_StateC const *__pyx_v_st, CYTHON_UNUSED __pyx_t_5spacy_8typedefs_attr_t __pyx_v_label) { + int __pyx_r; + + /* "spacy/pipeline/_parser_internals/ner.pyx":351 + * @staticmethod + * cdef bint is_valid(const StateC* st, attr_t label) noexcept nogil: + * return False # <<<<<<<<<<<<<< + * + * @staticmethod +*/ + __pyx_r = 0; + goto __pyx_L0; + + /* "spacy/pipeline/_parser_internals/ner.pyx":349 + * + * cdef class Missing: + * @staticmethod # <<<<<<<<<<<<<< + * cdef bint is_valid(const StateC* st, attr_t label) noexcept nogil: + * return False +*/ + + /* function exit code */ + __pyx_L0:; + return __pyx_r; +} + +/* "spacy/pipeline/_parser_internals/ner.pyx":353 + * return False + * + * @staticmethod # <<<<<<<<<<<<<< + * cdef int transition(StateC* s, attr_t label) noexcept nogil: + * pass +*/ + +static int __pyx_f_5spacy_8pipeline_17_parser_internals_3ner_7Missing_transition(CYTHON_UNUSED __pyx_t_5spacy_8pipeline_17_parser_internals_6_state_StateC *__pyx_v_s, CYTHON_UNUSED __pyx_t_5spacy_8typedefs_attr_t __pyx_v_label) { + int __pyx_r; + + /* function exit code */ + __pyx_r = 0; + return __pyx_r; +} + +/* "spacy/pipeline/_parser_internals/ner.pyx":357 + * pass + * + * @staticmethod # <<<<<<<<<<<<<< + * cdef weight_t cost(const StateC* s, const void* _gold, attr_t label) noexcept nogil: + * return 9000 +*/ + +static __pyx_t_5spacy_8typedefs_weight_t __pyx_f_5spacy_8pipeline_17_parser_internals_3ner_7Missing_cost(CYTHON_UNUSED __pyx_t_5spacy_8pipeline_17_parser_internals_6_state_StateC const *__pyx_v_s, CYTHON_UNUSED void const *__pyx_v__gold, CYTHON_UNUSED __pyx_t_5spacy_8typedefs_attr_t __pyx_v_label) { + __pyx_t_5spacy_8typedefs_weight_t __pyx_r; + + /* "spacy/pipeline/_parser_internals/ner.pyx":359 + * @staticmethod + * cdef weight_t cost(const StateC* s, const void* _gold, attr_t label) noexcept nogil: + * return 9000 # <<<<<<<<<<<<<< + * + * +*/ + __pyx_r = 9000.0; + goto __pyx_L0; + + /* "spacy/pipeline/_parser_internals/ner.pyx":357 + * pass + * + * @staticmethod # <<<<<<<<<<<<<< + * cdef weight_t cost(const StateC* s, const void* _gold, attr_t label) noexcept nogil: + * return 9000 +*/ + + /* function exit code */ + __pyx_L0:; + return __pyx_r; +} + +/* "(tree fragment)":1 + * def __reduce_cython__(self): # <<<<<<<<<<<<<< + * cdef tuple state + * cdef object _dict +*/ + +/* Python wrapper */ +static PyObject *__pyx_pw_5spacy_8pipeline_17_parser_internals_3ner_7Missing_1__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_5spacy_8pipeline_17_parser_internals_3ner_7Missing___reduce_cython__, "Missing.__reduce_cython__(self)"); +static PyMethodDef __pyx_mdef_5spacy_8pipeline_17_parser_internals_3ner_7Missing_1__reduce_cython__ = {"__reduce_cython__", (PyCFunction)(void(*)(void))(__Pyx_PyCFunction_FastCallWithKeywords)__pyx_pw_5spacy_8pipeline_17_parser_internals_3ner_7Missing_1__reduce_cython__, __Pyx_METH_FASTCALL|METH_KEYWORDS, __pyx_doc_5spacy_8pipeline_17_parser_internals_3ner_7Missing___reduce_cython__}; +static PyObject *__pyx_pw_5spacy_8pipeline_17_parser_internals_3ner_7Missing_1__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_5spacy_8pipeline_17_parser_internals_3ner_7Missing___reduce_cython__(((struct __pyx_obj_5spacy_8pipeline_17_parser_internals_3ner_Missing *)__pyx_v_self)); + + /* function exit code */ + __Pyx_RefNannyFinishContext(); + return __pyx_r; +} + +static PyObject *__pyx_pf_5spacy_8pipeline_17_parser_internals_3ner_7Missing___reduce_cython__(struct __pyx_obj_5spacy_8pipeline_17_parser_internals_3ner_Missing *__pyx_v_self) { + PyObject *__pyx_v_state = 0; + PyObject *__pyx_v__dict = 0; + int __pyx_v_use_setstate; + PyObject *__pyx_r = NULL; + __Pyx_RefNannyDeclarations + PyObject *__pyx_t_1 = NULL; + int __pyx_t_2; + int __pyx_t_3; + PyObject *__pyx_t_4 = NULL; + PyObject *__pyx_t_5 = NULL; + int __pyx_lineno = 0; + const char *__pyx_filename = NULL; + int __pyx_clineno = 0; + __Pyx_RefNannySetupContext("__reduce_cython__", 0); + + /* "(tree fragment)":5 + * cdef object _dict + * cdef bint use_setstate + * state = () # <<<<<<<<<<<<<< + * _dict = getattr(self, '__dict__', None) + * if _dict is not None and _dict: +*/ + __Pyx_INCREF(__pyx_mstate_global->__pyx_empty_tuple); + __pyx_v_state = __pyx_mstate_global->__pyx_empty_tuple; + + /* "(tree fragment)":6 + * cdef bint use_setstate + * state = () + * _dict = getattr(self, '__dict__', None) # <<<<<<<<<<<<<< + * if _dict is not None and _dict: + * state += (_dict,) +*/ + __pyx_t_1 = __Pyx_GetAttr3(((PyObject *)__pyx_v_self), __pyx_mstate_global->__pyx_n_u_dict, Py_None); if (unlikely(!__pyx_t_1)) __PYX_ERR(1, 6, __pyx_L1_error) + __Pyx_GOTREF(__pyx_t_1); + __pyx_v__dict = __pyx_t_1; + __pyx_t_1 = 0; + + /* "(tree fragment)":7 + * state = () + * _dict = getattr(self, '__dict__', None) + * if _dict is not None and _dict: # <<<<<<<<<<<<<< + * state += (_dict,) + * use_setstate = True +*/ + __pyx_t_3 = (__pyx_v__dict != Py_None); + if (__pyx_t_3) { + } else { + __pyx_t_2 = __pyx_t_3; + goto __pyx_L4_bool_binop_done; + } + __pyx_t_3 = __Pyx_PyObject_IsTrue(__pyx_v__dict); if (unlikely((__pyx_t_3 < 0))) __PYX_ERR(1, 7, __pyx_L1_error) + __pyx_t_2 = __pyx_t_3; + __pyx_L4_bool_binop_done:; + if (__pyx_t_2) { + + /* "(tree fragment)":8 + * _dict = getattr(self, '__dict__', None) + * if _dict is not None and _dict: + * state += (_dict,) # <<<<<<<<<<<<<< + * use_setstate = True + * else: +*/ + __pyx_t_1 = PyTuple_New(1); if (unlikely(!__pyx_t_1)) __PYX_ERR(1, 8, __pyx_L1_error) + __Pyx_GOTREF(__pyx_t_1); + __Pyx_INCREF(__pyx_v__dict); + __Pyx_GIVEREF(__pyx_v__dict); + if (__Pyx_PyTuple_SET_ITEM(__pyx_t_1, 0, __pyx_v__dict) != (0)) __PYX_ERR(1, 8, __pyx_L1_error); + __pyx_t_4 = PyNumber_InPlaceAdd(__pyx_v_state, __pyx_t_1); if (unlikely(!__pyx_t_4)) __PYX_ERR(1, 8, __pyx_L1_error) + __Pyx_GOTREF(__pyx_t_4); + __Pyx_DECREF(__pyx_t_1); __pyx_t_1 = 0; + __Pyx_DECREF_SET(__pyx_v_state, ((PyObject*)__pyx_t_4)); + __pyx_t_4 = 0; + + /* "(tree fragment)":9 + * if _dict is not None and _dict: + * state += (_dict,) + * use_setstate = True # <<<<<<<<<<<<<< + * else: + * use_setstate = ('False',) +*/ + __pyx_v_use_setstate = 1; + + /* "(tree fragment)":7 + * state = () + * _dict = getattr(self, '__dict__', None) + * if _dict is not None and _dict: # <<<<<<<<<<<<<< + * state += (_dict,) + * use_setstate = True +*/ + goto __pyx_L3; + } + + /* "(tree fragment)":11 + * use_setstate = True + * else: + * use_setstate = ('False',) # <<<<<<<<<<<<<< + * if use_setstate: + * return __pyx_unpickle_Missing, (type(self), 0xe3b0c44, None), state +*/ + /*else*/ { + __pyx_t_2 = __Pyx_PyObject_IsTrue(__pyx_mstate_global->__pyx_tuple[2]); if (unlikely((__pyx_t_2 == (int)-1) && PyErr_Occurred())) __PYX_ERR(1, 11, __pyx_L1_error) + __pyx_v_use_setstate = __pyx_t_2; + } + __pyx_L3:; + + /* "(tree fragment)":12 + * else: + * use_setstate = ('False',) + * if use_setstate: # <<<<<<<<<<<<<< + * return __pyx_unpickle_Missing, (type(self), 0xe3b0c44, None), state + * else: +*/ + if (__pyx_v_use_setstate) { + + /* "(tree fragment)":13 + * use_setstate = ('False',) + * if use_setstate: + * return __pyx_unpickle_Missing, (type(self), 0xe3b0c44, None), state # <<<<<<<<<<<<<< + * else: + * return __pyx_unpickle_Missing, (type(self), 0xe3b0c44, state) +*/ + __Pyx_XDECREF(__pyx_r); + __Pyx_GetModuleGlobalName(__pyx_t_4, __pyx_mstate_global->__pyx_n_u_pyx_unpickle_Missing); if (unlikely(!__pyx_t_4)) __PYX_ERR(1, 13, __pyx_L1_error) + __Pyx_GOTREF(__pyx_t_4); + __pyx_t_1 = PyTuple_New(3); if (unlikely(!__pyx_t_1)) __PYX_ERR(1, 13, __pyx_L1_error) + __Pyx_GOTREF(__pyx_t_1); + __Pyx_INCREF(((PyObject *)Py_TYPE(((PyObject *)__pyx_v_self)))); + __Pyx_GIVEREF(((PyObject *)Py_TYPE(((PyObject *)__pyx_v_self)))); + if (__Pyx_PyTuple_SET_ITEM(__pyx_t_1, 0, ((PyObject *)Py_TYPE(((PyObject *)__pyx_v_self)))) != (0)) __PYX_ERR(1, 13, __pyx_L1_error); + __Pyx_INCREF(__pyx_mstate_global->__pyx_int_238750788); + __Pyx_GIVEREF(__pyx_mstate_global->__pyx_int_238750788); + if (__Pyx_PyTuple_SET_ITEM(__pyx_t_1, 1, __pyx_mstate_global->__pyx_int_238750788) != (0)) __PYX_ERR(1, 13, __pyx_L1_error); + __Pyx_INCREF(Py_None); + __Pyx_GIVEREF(Py_None); + if (__Pyx_PyTuple_SET_ITEM(__pyx_t_1, 2, Py_None) != (0)) __PYX_ERR(1, 13, __pyx_L1_error); + __pyx_t_5 = PyTuple_New(3); if (unlikely(!__pyx_t_5)) __PYX_ERR(1, 13, __pyx_L1_error) + __Pyx_GOTREF(__pyx_t_5); + __Pyx_GIVEREF(__pyx_t_4); + if (__Pyx_PyTuple_SET_ITEM(__pyx_t_5, 0, __pyx_t_4) != (0)) __PYX_ERR(1, 13, __pyx_L1_error); + __Pyx_GIVEREF(__pyx_t_1); + if (__Pyx_PyTuple_SET_ITEM(__pyx_t_5, 1, __pyx_t_1) != (0)) __PYX_ERR(1, 13, __pyx_L1_error); + __Pyx_INCREF(__pyx_v_state); + __Pyx_GIVEREF(__pyx_v_state); + if (__Pyx_PyTuple_SET_ITEM(__pyx_t_5, 2, __pyx_v_state) != (0)) __PYX_ERR(1, 13, __pyx_L1_error); + __pyx_t_4 = 0; + __pyx_t_1 = 0; + __pyx_r = __pyx_t_5; + __pyx_t_5 = 0; + goto __pyx_L0; + + /* "(tree fragment)":12 + * else: + * use_setstate = ('False',) + * if use_setstate: # <<<<<<<<<<<<<< + * return __pyx_unpickle_Missing, (type(self), 0xe3b0c44, None), state + * else: +*/ + } + + /* "(tree fragment)":15 + * return __pyx_unpickle_Missing, (type(self), 0xe3b0c44, None), state + * else: + * return __pyx_unpickle_Missing, (type(self), 0xe3b0c44, state) # <<<<<<<<<<<<<< + * def __setstate_cython__(self, __pyx_state): + * __pyx_unpickle_Missing__set_state(self, __pyx_state) +*/ + /*else*/ { + __Pyx_XDECREF(__pyx_r); + __Pyx_GetModuleGlobalName(__pyx_t_5, __pyx_mstate_global->__pyx_n_u_pyx_unpickle_Missing); if (unlikely(!__pyx_t_5)) __PYX_ERR(1, 15, __pyx_L1_error) + __Pyx_GOTREF(__pyx_t_5); + __pyx_t_1 = PyTuple_New(3); if (unlikely(!__pyx_t_1)) __PYX_ERR(1, 15, __pyx_L1_error) + __Pyx_GOTREF(__pyx_t_1); + __Pyx_INCREF(((PyObject *)Py_TYPE(((PyObject *)__pyx_v_self)))); + __Pyx_GIVEREF(((PyObject *)Py_TYPE(((PyObject *)__pyx_v_self)))); + if (__Pyx_PyTuple_SET_ITEM(__pyx_t_1, 0, ((PyObject *)Py_TYPE(((PyObject *)__pyx_v_self)))) != (0)) __PYX_ERR(1, 15, __pyx_L1_error); + __Pyx_INCREF(__pyx_mstate_global->__pyx_int_238750788); + __Pyx_GIVEREF(__pyx_mstate_global->__pyx_int_238750788); + if (__Pyx_PyTuple_SET_ITEM(__pyx_t_1, 1, __pyx_mstate_global->__pyx_int_238750788) != (0)) __PYX_ERR(1, 15, __pyx_L1_error); + __Pyx_INCREF(__pyx_v_state); + __Pyx_GIVEREF(__pyx_v_state); + if (__Pyx_PyTuple_SET_ITEM(__pyx_t_1, 2, __pyx_v_state) != (0)) __PYX_ERR(1, 15, __pyx_L1_error); + __pyx_t_4 = PyTuple_New(2); if (unlikely(!__pyx_t_4)) __PYX_ERR(1, 15, __pyx_L1_error) + __Pyx_GOTREF(__pyx_t_4); + __Pyx_GIVEREF(__pyx_t_5); + if (__Pyx_PyTuple_SET_ITEM(__pyx_t_4, 0, __pyx_t_5) != (0)) __PYX_ERR(1, 15, __pyx_L1_error); + __Pyx_GIVEREF(__pyx_t_1); + if (__Pyx_PyTuple_SET_ITEM(__pyx_t_4, 1, __pyx_t_1) != (0)) __PYX_ERR(1, 15, __pyx_L1_error); + __pyx_t_5 = 0; + __pyx_t_1 = 0; + __pyx_r = __pyx_t_4; + __pyx_t_4 = 0; + goto __pyx_L0; + } + + /* "(tree fragment)":1 + * def __reduce_cython__(self): # <<<<<<<<<<<<<< + * cdef tuple state + * cdef object _dict +*/ + + /* function exit code */ + __pyx_L1_error:; + __Pyx_XDECREF(__pyx_t_1); + __Pyx_XDECREF(__pyx_t_4); + __Pyx_XDECREF(__pyx_t_5); + __Pyx_AddTraceback("spacy.pipeline._parser_internals.ner.Missing.__reduce_cython__", __pyx_clineno, __pyx_lineno, __pyx_filename); + __pyx_r = NULL; + __pyx_L0:; + __Pyx_XDECREF(__pyx_v_state); + __Pyx_XDECREF(__pyx_v__dict); + __Pyx_XGIVEREF(__pyx_r); + __Pyx_RefNannyFinishContext(); + return __pyx_r; +} + +/* "(tree fragment)":16 + * else: + * return __pyx_unpickle_Missing, (type(self), 0xe3b0c44, state) + * def __setstate_cython__(self, __pyx_state): # <<<<<<<<<<<<<< + * __pyx_unpickle_Missing__set_state(self, __pyx_state) +*/ + +/* Python wrapper */ +static PyObject *__pyx_pw_5spacy_8pipeline_17_parser_internals_3ner_7Missing_3__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_5spacy_8pipeline_17_parser_internals_3ner_7Missing_2__setstate_cython__, "Missing.__setstate_cython__(self, __pyx_state)"); +static PyMethodDef __pyx_mdef_5spacy_8pipeline_17_parser_internals_3ner_7Missing_3__setstate_cython__ = {"__setstate_cython__", (PyCFunction)(void(*)(void))(__Pyx_PyCFunction_FastCallWithKeywords)__pyx_pw_5spacy_8pipeline_17_parser_internals_3ner_7Missing_3__setstate_cython__, __Pyx_METH_FASTCALL|METH_KEYWORDS, __pyx_doc_5spacy_8pipeline_17_parser_internals_3ner_7Missing_2__setstate_cython__}; +static PyObject *__pyx_pw_5spacy_8pipeline_17_parser_internals_3ner_7Missing_3__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 +) { + 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, 16, __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, 16, __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, 16, __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, 16, __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, 16, __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, 16, __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("spacy.pipeline._parser_internals.ner.Missing.__setstate_cython__", __pyx_clineno, __pyx_lineno, __pyx_filename); + __Pyx_RefNannyFinishContext(); + return NULL; + __pyx_L4_argument_unpacking_done:; + __pyx_r = __pyx_pf_5spacy_8pipeline_17_parser_internals_3ner_7Missing_2__setstate_cython__(((struct __pyx_obj_5spacy_8pipeline_17_parser_internals_3ner_Missing *)__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_5spacy_8pipeline_17_parser_internals_3ner_7Missing_2__setstate_cython__(struct __pyx_obj_5spacy_8pipeline_17_parser_internals_3ner_Missing *__pyx_v_self, PyObject *__pyx_v___pyx_state) { + PyObject *__pyx_r = NULL; + __Pyx_RefNannyDeclarations + PyObject *__pyx_t_1 = NULL; + int __pyx_lineno = 0; + const char *__pyx_filename = NULL; + int __pyx_clineno = 0; + __Pyx_RefNannySetupContext("__setstate_cython__", 0); + + /* "(tree fragment)":17 + * return __pyx_unpickle_Missing, (type(self), 0xe3b0c44, state) + * def __setstate_cython__(self, __pyx_state): + * __pyx_unpickle_Missing__set_state(self, __pyx_state) # <<<<<<<<<<<<<< +*/ + __pyx_t_1 = __pyx_f_5spacy_8pipeline_17_parser_internals_3ner___pyx_unpickle_Missing__set_state(__pyx_v_self, __pyx_v___pyx_state); if (unlikely(!__pyx_t_1)) __PYX_ERR(1, 17, __pyx_L1_error) + __Pyx_GOTREF(__pyx_t_1); + __Pyx_DECREF(__pyx_t_1); __pyx_t_1 = 0; + + /* "(tree fragment)":16 + * else: + * return __pyx_unpickle_Missing, (type(self), 0xe3b0c44, state) + * def __setstate_cython__(self, __pyx_state): # <<<<<<<<<<<<<< + * __pyx_unpickle_Missing__set_state(self, __pyx_state) +*/ + + /* function exit code */ + __pyx_r = Py_None; __Pyx_INCREF(Py_None); + goto __pyx_L0; + __pyx_L1_error:; + __Pyx_XDECREF(__pyx_t_1); + __Pyx_AddTraceback("spacy.pipeline._parser_internals.ner.Missing.__setstate_cython__", __pyx_clineno, __pyx_lineno, __pyx_filename); + __pyx_r = NULL; + __pyx_L0:; + __Pyx_XGIVEREF(__pyx_r); + __Pyx_RefNannyFinishContext(); + return __pyx_r; +} + +/* "spacy/pipeline/_parser_internals/ner.pyx":363 + * + * cdef class Begin: + * @staticmethod # <<<<<<<<<<<<<< + * cdef bint is_valid(const StateC* st, attr_t label) noexcept nogil: + * cdef int preset_ent_iob = st.B_(0).ent_iob +*/ + +static int __pyx_f_5spacy_8pipeline_17_parser_internals_3ner_5Begin_is_valid(__pyx_t_5spacy_8pipeline_17_parser_internals_6_state_StateC const *__pyx_v_st, __pyx_t_5spacy_8typedefs_attr_t __pyx_v_label) { + int __pyx_v_preset_ent_iob; + __pyx_t_5spacy_8typedefs_attr_t __pyx_v_preset_ent_label; + int __pyx_r; + int __pyx_t_1; + __pyx_t_5spacy_8typedefs_attr_t __pyx_t_2; + int __pyx_t_3; + + /* "spacy/pipeline/_parser_internals/ner.pyx":365 + * @staticmethod + * cdef bint is_valid(const StateC* st, attr_t label) noexcept nogil: + * cdef int preset_ent_iob = st.B_(0).ent_iob # <<<<<<<<<<<<<< + * cdef attr_t preset_ent_label = st.B_(0).ent_type + * if st.entity_is_open(): +*/ + __pyx_t_1 = __pyx_v_st->B_(0)->ent_iob; + __pyx_v_preset_ent_iob = __pyx_t_1; + + /* "spacy/pipeline/_parser_internals/ner.pyx":366 + * cdef bint is_valid(const StateC* st, attr_t label) noexcept nogil: + * cdef int preset_ent_iob = st.B_(0).ent_iob + * cdef attr_t preset_ent_label = st.B_(0).ent_type # <<<<<<<<<<<<<< + * if st.entity_is_open(): + * return False +*/ + __pyx_t_2 = __pyx_v_st->B_(0)->ent_type; + __pyx_v_preset_ent_label = __pyx_t_2; + + /* "spacy/pipeline/_parser_internals/ner.pyx":367 + * cdef int preset_ent_iob = st.B_(0).ent_iob + * cdef attr_t preset_ent_label = st.B_(0).ent_type + * if st.entity_is_open(): # <<<<<<<<<<<<<< + * return False + * if st.buffer_length() < 2: +*/ + __pyx_t_3 = __pyx_v_st->entity_is_open(); + if (__pyx_t_3) { + + /* "spacy/pipeline/_parser_internals/ner.pyx":368 + * cdef attr_t preset_ent_label = st.B_(0).ent_type + * if st.entity_is_open(): + * return False # <<<<<<<<<<<<<< + * if st.buffer_length() < 2: + * # If we're the last token of the input, we can't B -- must U or O. +*/ + __pyx_r = 0; + goto __pyx_L0; + + /* "spacy/pipeline/_parser_internals/ner.pyx":367 + * cdef int preset_ent_iob = st.B_(0).ent_iob + * cdef attr_t preset_ent_label = st.B_(0).ent_type + * if st.entity_is_open(): # <<<<<<<<<<<<<< + * return False + * if st.buffer_length() < 2: +*/ + } + + /* "spacy/pipeline/_parser_internals/ner.pyx":369 + * if st.entity_is_open(): + * return False + * if st.buffer_length() < 2: # <<<<<<<<<<<<<< + * # If we're the last token of the input, we can't B -- must U or O. + * return False +*/ + __pyx_t_3 = (__pyx_v_st->buffer_length() < 2); + if (__pyx_t_3) { + + /* "spacy/pipeline/_parser_internals/ner.pyx":371 + * if st.buffer_length() < 2: + * # If we're the last token of the input, we can't B -- must U or O. + * return False # <<<<<<<<<<<<<< + * elif label == 0: + * return False +*/ + __pyx_r = 0; + goto __pyx_L0; + + /* "spacy/pipeline/_parser_internals/ner.pyx":369 + * if st.entity_is_open(): + * return False + * if st.buffer_length() < 2: # <<<<<<<<<<<<<< + * # If we're the last token of the input, we can't B -- must U or O. + * return False +*/ + } + + /* "spacy/pipeline/_parser_internals/ner.pyx":372 + * # If we're the last token of the input, we can't B -- must U or O. + * return False + * elif label == 0: # <<<<<<<<<<<<<< + * return False + * elif preset_ent_iob == 1: +*/ + __pyx_t_3 = (__pyx_v_label == 0); + if (__pyx_t_3) { + + /* "spacy/pipeline/_parser_internals/ner.pyx":373 + * return False + * elif label == 0: + * return False # <<<<<<<<<<<<<< + * elif preset_ent_iob == 1: + * # Ensure we don't clobber preset entities. If no entity preset, +*/ + __pyx_r = 0; + goto __pyx_L0; + + /* "spacy/pipeline/_parser_internals/ner.pyx":372 + * # If we're the last token of the input, we can't B -- must U or O. + * return False + * elif label == 0: # <<<<<<<<<<<<<< + * return False + * elif preset_ent_iob == 1: +*/ + } + + /* "spacy/pipeline/_parser_internals/ner.pyx":374 + * elif label == 0: + * return False + * elif preset_ent_iob == 1: # <<<<<<<<<<<<<< + * # Ensure we don't clobber preset entities. If no entity preset, + * # ent_iob is 0 +*/ + __pyx_t_3 = (__pyx_v_preset_ent_iob == 1); + if (__pyx_t_3) { + + /* "spacy/pipeline/_parser_internals/ner.pyx":377 + * # Ensure we don't clobber preset entities. If no entity preset, + * # ent_iob is 0 + * return False # <<<<<<<<<<<<<< + * elif preset_ent_iob == 3: + * # Okay, we're in a preset entity. +*/ + __pyx_r = 0; + goto __pyx_L0; + + /* "spacy/pipeline/_parser_internals/ner.pyx":374 + * elif label == 0: + * return False + * elif preset_ent_iob == 1: # <<<<<<<<<<<<<< + * # Ensure we don't clobber preset entities. If no entity preset, + * # ent_iob is 0 +*/ + } + + /* "spacy/pipeline/_parser_internals/ner.pyx":378 + * # ent_iob is 0 + * return False + * elif preset_ent_iob == 3: # <<<<<<<<<<<<<< + * # Okay, we're in a preset entity. + * if label != preset_ent_label: +*/ + __pyx_t_3 = (__pyx_v_preset_ent_iob == 3); + if (__pyx_t_3) { + + /* "spacy/pipeline/_parser_internals/ner.pyx":380 + * elif preset_ent_iob == 3: + * # Okay, we're in a preset entity. + * if label != preset_ent_label: # <<<<<<<<<<<<<< + * # If label isn't right, reject + * return False +*/ + __pyx_t_3 = (__pyx_v_label != __pyx_v_preset_ent_label); + if (__pyx_t_3) { + + /* "spacy/pipeline/_parser_internals/ner.pyx":382 + * if label != preset_ent_label: + * # If label isn't right, reject + * return False # <<<<<<<<<<<<<< + * elif st.B_(1).ent_iob != 1: + * # If next token isn't marked I, we need to make U, not B. +*/ + __pyx_r = 0; + goto __pyx_L0; + + /* "spacy/pipeline/_parser_internals/ner.pyx":380 + * elif preset_ent_iob == 3: + * # Okay, we're in a preset entity. + * if label != preset_ent_label: # <<<<<<<<<<<<<< + * # If label isn't right, reject + * return False +*/ + } + + /* "spacy/pipeline/_parser_internals/ner.pyx":383 + * # If label isn't right, reject + * return False + * elif st.B_(1).ent_iob != 1: # <<<<<<<<<<<<<< + * # If next token isn't marked I, we need to make U, not B. + * return False +*/ + __pyx_t_3 = (__pyx_v_st->B_(1)->ent_iob != 1); + if (__pyx_t_3) { + + /* "spacy/pipeline/_parser_internals/ner.pyx":385 + * elif st.B_(1).ent_iob != 1: + * # If next token isn't marked I, we need to make U, not B. + * return False # <<<<<<<<<<<<<< + * else: + * # Otherwise, force acceptance, even if we're across a sentence +*/ + __pyx_r = 0; + goto __pyx_L0; + + /* "spacy/pipeline/_parser_internals/ner.pyx":383 + * # If label isn't right, reject + * return False + * elif st.B_(1).ent_iob != 1: # <<<<<<<<<<<<<< + * # If next token isn't marked I, we need to make U, not B. + * return False +*/ + } + + /* "spacy/pipeline/_parser_internals/ner.pyx":389 + * # Otherwise, force acceptance, even if we're across a sentence + * # boundary or the token is whitespace. + * return True # <<<<<<<<<<<<<< + * elif st.B_(1).ent_iob == 3: + * # If the next word is B, we can't B now +*/ + /*else*/ { + __pyx_r = 1; + goto __pyx_L0; + } + + /* "spacy/pipeline/_parser_internals/ner.pyx":378 + * # ent_iob is 0 + * return False + * elif preset_ent_iob == 3: # <<<<<<<<<<<<<< + * # Okay, we're in a preset entity. + * if label != preset_ent_label: +*/ + } + + /* "spacy/pipeline/_parser_internals/ner.pyx":390 + * # boundary or the token is whitespace. + * return True + * elif st.B_(1).ent_iob == 3: # <<<<<<<<<<<<<< + * # If the next word is B, we can't B now + * return False +*/ + __pyx_t_3 = (__pyx_v_st->B_(1)->ent_iob == 3); + if (__pyx_t_3) { + + /* "spacy/pipeline/_parser_internals/ner.pyx":392 + * elif st.B_(1).ent_iob == 3: + * # If the next word is B, we can't B now + * return False # <<<<<<<<<<<<<< + * elif st.B_(1).sent_start == 1: + * # Don't allow entities to extend across sentence boundaries +*/ + __pyx_r = 0; + goto __pyx_L0; + + /* "spacy/pipeline/_parser_internals/ner.pyx":390 + * # boundary or the token is whitespace. + * return True + * elif st.B_(1).ent_iob == 3: # <<<<<<<<<<<<<< + * # If the next word is B, we can't B now + * return False +*/ + } + + /* "spacy/pipeline/_parser_internals/ner.pyx":393 + * # If the next word is B, we can't B now + * return False + * elif st.B_(1).sent_start == 1: # <<<<<<<<<<<<<< + * # Don't allow entities to extend across sentence boundaries + * return False +*/ + __pyx_t_3 = (__pyx_v_st->B_(1)->sent_start == 1); + if (__pyx_t_3) { + + /* "spacy/pipeline/_parser_internals/ner.pyx":395 + * elif st.B_(1).sent_start == 1: + * # Don't allow entities to extend across sentence boundaries + * return False # <<<<<<<<<<<<<< + * # Don't allow entities to start on whitespace + * elif Lexeme.get_struct_attr(st.B_(0).lex, IS_SPACE): +*/ + __pyx_r = 0; + goto __pyx_L0; + + /* "spacy/pipeline/_parser_internals/ner.pyx":393 + * # If the next word is B, we can't B now + * return False + * elif st.B_(1).sent_start == 1: # <<<<<<<<<<<<<< + * # Don't allow entities to extend across sentence boundaries + * return False +*/ + } + + /* "spacy/pipeline/_parser_internals/ner.pyx":397 + * return False + * # Don't allow entities to start on whitespace + * elif Lexeme.get_struct_attr(st.B_(0).lex, IS_SPACE): # <<<<<<<<<<<<<< + * return False + * else: +*/ + __pyx_t_3 = (__pyx_f_5spacy_6lexeme_6Lexeme_get_struct_attr(__pyx_v_st->B_(0)->lex, __pyx_e_5spacy_5attrs_IS_SPACE) != 0); + if (__pyx_t_3) { + + /* "spacy/pipeline/_parser_internals/ner.pyx":398 + * # Don't allow entities to start on whitespace + * elif Lexeme.get_struct_attr(st.B_(0).lex, IS_SPACE): + * return False # <<<<<<<<<<<<<< + * else: + * return True +*/ + __pyx_r = 0; + goto __pyx_L0; + + /* "spacy/pipeline/_parser_internals/ner.pyx":397 + * return False + * # Don't allow entities to start on whitespace + * elif Lexeme.get_struct_attr(st.B_(0).lex, IS_SPACE): # <<<<<<<<<<<<<< + * return False + * else: +*/ + } + + /* "spacy/pipeline/_parser_internals/ner.pyx":400 + * return False + * else: + * return True # <<<<<<<<<<<<<< + * + * @staticmethod +*/ + /*else*/ { + __pyx_r = 1; + goto __pyx_L0; + } + + /* "spacy/pipeline/_parser_internals/ner.pyx":363 + * + * cdef class Begin: + * @staticmethod # <<<<<<<<<<<<<< + * cdef bint is_valid(const StateC* st, attr_t label) noexcept nogil: + * cdef int preset_ent_iob = st.B_(0).ent_iob +*/ + + /* function exit code */ + __pyx_L0:; + return __pyx_r; +} + +/* "spacy/pipeline/_parser_internals/ner.pyx":402 + * return True + * + * @staticmethod # <<<<<<<<<<<<<< + * cdef int transition(StateC* st, attr_t label) noexcept nogil: + * st.open_ent(label) +*/ + +static int __pyx_f_5spacy_8pipeline_17_parser_internals_3ner_5Begin_transition(__pyx_t_5spacy_8pipeline_17_parser_internals_6_state_StateC *__pyx_v_st, __pyx_t_5spacy_8typedefs_attr_t __pyx_v_label) { + int __pyx_r; + + /* "spacy/pipeline/_parser_internals/ner.pyx":404 + * @staticmethod + * cdef int transition(StateC* st, attr_t label) noexcept nogil: + * st.open_ent(label) # <<<<<<<<<<<<<< + * st.push() + * st.pop() +*/ + __pyx_v_st->open_ent(__pyx_v_label); + + /* "spacy/pipeline/_parser_internals/ner.pyx":405 + * cdef int transition(StateC* st, attr_t label) noexcept nogil: + * st.open_ent(label) + * st.push() # <<<<<<<<<<<<<< + * st.pop() + * +*/ + __pyx_v_st->push(); + + /* "spacy/pipeline/_parser_internals/ner.pyx":406 + * st.open_ent(label) + * st.push() + * st.pop() # <<<<<<<<<<<<<< + * + * @staticmethod +*/ + __pyx_v_st->pop(); + + /* "spacy/pipeline/_parser_internals/ner.pyx":402 + * return True + * + * @staticmethod # <<<<<<<<<<<<<< + * cdef int transition(StateC* st, attr_t label) noexcept nogil: + * st.open_ent(label) +*/ + + /* function exit code */ + __pyx_r = 0; + return __pyx_r; +} + +/* "spacy/pipeline/_parser_internals/ner.pyx":408 + * st.pop() + * + * @staticmethod # <<<<<<<<<<<<<< + * cdef weight_t cost(const StateC* s, const void* _gold, attr_t label) noexcept nogil: + * gold = _gold +*/ + +static __pyx_t_5spacy_8typedefs_weight_t __pyx_f_5spacy_8pipeline_17_parser_internals_3ner_5Begin_cost(__pyx_t_5spacy_8pipeline_17_parser_internals_6_state_StateC const *__pyx_v_s, void const *__pyx_v__gold, __pyx_t_5spacy_8typedefs_attr_t __pyx_v_label) { + struct __pyx_t_5spacy_8pipeline_17_parser_internals_3ner_GoldNERStateC *__pyx_v_gold; + int __pyx_v_b0; + int __pyx_v_cost; + int __pyx_v_g_act; + __pyx_t_5spacy_8typedefs_attr_t __pyx_v_g_tag; + struct __pyx_t_5spacy_7structs_SpanC __pyx_v_span; + __pyx_t_5spacy_8typedefs_weight_t __pyx_r; + int __pyx_t_1; + __pyx_t_5spacy_8typedefs_attr_t __pyx_t_2; + int __pyx_t_3; + struct __pyx_t_5spacy_7structs_SpanC *__pyx_t_4; + struct __pyx_t_5spacy_7structs_SpanC *__pyx_t_5; + struct __pyx_t_5spacy_7structs_SpanC *__pyx_t_6; + int __pyx_t_7; + + /* "spacy/pipeline/_parser_internals/ner.pyx":410 + * @staticmethod + * cdef weight_t cost(const StateC* s, const void* _gold, attr_t label) noexcept nogil: + * gold = _gold # <<<<<<<<<<<<<< + * b0 = s.B(0) + * cdef int cost = 0 +*/ + __pyx_v_gold = ((struct __pyx_t_5spacy_8pipeline_17_parser_internals_3ner_GoldNERStateC *)__pyx_v__gold); + + /* "spacy/pipeline/_parser_internals/ner.pyx":411 + * cdef weight_t cost(const StateC* s, const void* _gold, attr_t label) noexcept nogil: + * gold = _gold + * b0 = s.B(0) # <<<<<<<<<<<<<< + * cdef int cost = 0 + * cdef int g_act = gold.ner[b0].move +*/ + __pyx_v_b0 = __pyx_v_s->B(0); + + /* "spacy/pipeline/_parser_internals/ner.pyx":412 + * gold = _gold + * b0 = s.B(0) + * cdef int cost = 0 # <<<<<<<<<<<<<< + * cdef int g_act = gold.ner[b0].move + * cdef attr_t g_tag = gold.ner[b0].label +*/ + __pyx_v_cost = 0; + + /* "spacy/pipeline/_parser_internals/ner.pyx":413 + * b0 = s.B(0) + * cdef int cost = 0 + * cdef int g_act = gold.ner[b0].move # <<<<<<<<<<<<<< + * cdef attr_t g_tag = gold.ner[b0].label + * +*/ + __pyx_t_1 = (__pyx_v_gold->ner[__pyx_v_b0]).move; + __pyx_v_g_act = __pyx_t_1; + + /* "spacy/pipeline/_parser_internals/ner.pyx":414 + * cdef int cost = 0 + * cdef int g_act = gold.ner[b0].move + * cdef attr_t g_tag = gold.ner[b0].label # <<<<<<<<<<<<<< + * + * if g_act == MISSING: +*/ + __pyx_t_2 = (__pyx_v_gold->ner[__pyx_v_b0]).label; + __pyx_v_g_tag = __pyx_t_2; + + /* "spacy/pipeline/_parser_internals/ner.pyx":416 + * cdef attr_t g_tag = gold.ner[b0].label + * + * if g_act == MISSING: # <<<<<<<<<<<<<< + * pass + * elif g_act == BEGIN: +*/ + switch (__pyx_v_g_act) { + case __pyx_e_5spacy_8pipeline_17_parser_internals_3ner_MISSING: + break; + case __pyx_e_5spacy_8pipeline_17_parser_internals_3ner_BEGIN: + + /* "spacy/pipeline/_parser_internals/ner.pyx":420 + * elif g_act == BEGIN: + * # B, Gold B --> Label match + * cost += label != g_tag # <<<<<<<<<<<<<< + * else: + * # B, Gold I --> False (P) +*/ + __pyx_v_cost = (__pyx_v_cost + (__pyx_v_label != __pyx_v_g_tag)); + + /* "spacy/pipeline/_parser_internals/ner.pyx":418 + * if g_act == MISSING: + * pass + * elif g_act == BEGIN: # <<<<<<<<<<<<<< + * # B, Gold B --> Label match + * cost += label != g_tag +*/ + break; + default: + + /* "spacy/pipeline/_parser_internals/ner.pyx":426 + * # B, Gold O --> False (P) + * # B, Gold U --> False (P) + * cost += 1 # <<<<<<<<<<<<<< + * if s.buffer_length() < 3: + * # Handle negatives. In general we can't really do much to block +*/ + __pyx_v_cost = (__pyx_v_cost + 1); + break; + } + + /* "spacy/pipeline/_parser_internals/ner.pyx":427 + * # B, Gold U --> False (P) + * cost += 1 + * if s.buffer_length() < 3: # <<<<<<<<<<<<<< + * # Handle negatives. In general we can't really do much to block + * # B, because we don't know whether the whole entity is going to +*/ + __pyx_t_3 = (__pyx_v_s->buffer_length() < 3); + if (__pyx_t_3) { + + /* "spacy/pipeline/_parser_internals/ner.pyx":433 + * # going to be opening an entity where there's only one possible + * # L. + * for span in gold.negs[:gold.nr_neg]: # <<<<<<<<<<<<<< + * if span.label == label and span.start == b0: + * cost += 1 +*/ + __pyx_t_5 = (__pyx_v_gold->negs + __pyx_v_gold->nr_neg); + for (__pyx_t_6 = __pyx_v_gold->negs; __pyx_t_6 < __pyx_t_5; __pyx_t_6++) { + __pyx_t_4 = __pyx_t_6; + __pyx_v_span = (__pyx_t_4[0]); + + /* "spacy/pipeline/_parser_internals/ner.pyx":434 + * # L. + * for span in gold.negs[:gold.nr_neg]: + * if span.label == label and span.start == b0: # <<<<<<<<<<<<<< + * cost += 1 + * break +*/ + __pyx_t_7 = (__pyx_v_span.label == __pyx_v_label); + if (__pyx_t_7) { + } else { + __pyx_t_3 = __pyx_t_7; + goto __pyx_L7_bool_binop_done; + } + __pyx_t_7 = (__pyx_v_span.start == __pyx_v_b0); + __pyx_t_3 = __pyx_t_7; + __pyx_L7_bool_binop_done:; + if (__pyx_t_3) { + + /* "spacy/pipeline/_parser_internals/ner.pyx":435 + * for span in gold.negs[:gold.nr_neg]: + * if span.label == label and span.start == b0: + * cost += 1 # <<<<<<<<<<<<<< + * break + * return cost +*/ + __pyx_v_cost = (__pyx_v_cost + 1); + + /* "spacy/pipeline/_parser_internals/ner.pyx":436 + * if span.label == label and span.start == b0: + * cost += 1 + * break # <<<<<<<<<<<<<< + * return cost + * +*/ + goto __pyx_L5_break; + + /* "spacy/pipeline/_parser_internals/ner.pyx":434 + * # L. + * for span in gold.negs[:gold.nr_neg]: + * if span.label == label and span.start == b0: # <<<<<<<<<<<<<< + * cost += 1 + * break +*/ + } + } + __pyx_L5_break:; + + /* "spacy/pipeline/_parser_internals/ner.pyx":427 + * # B, Gold U --> False (P) + * cost += 1 + * if s.buffer_length() < 3: # <<<<<<<<<<<<<< + * # Handle negatives. In general we can't really do much to block + * # B, because we don't know whether the whole entity is going to +*/ + } + + /* "spacy/pipeline/_parser_internals/ner.pyx":437 + * cost += 1 + * break + * return cost # <<<<<<<<<<<<<< + * + * +*/ + __pyx_r = __pyx_v_cost; + goto __pyx_L0; + + /* "spacy/pipeline/_parser_internals/ner.pyx":408 + * st.pop() + * + * @staticmethod # <<<<<<<<<<<<<< + * cdef weight_t cost(const StateC* s, const void* _gold, attr_t label) noexcept nogil: + * gold = _gold +*/ + + /* function exit code */ + __pyx_L0:; + return __pyx_r; +} + +/* "(tree fragment)":1 + * def __reduce_cython__(self): # <<<<<<<<<<<<<< + * cdef tuple state + * cdef object _dict +*/ + +/* Python wrapper */ +static PyObject *__pyx_pw_5spacy_8pipeline_17_parser_internals_3ner_5Begin_1__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_5spacy_8pipeline_17_parser_internals_3ner_5Begin___reduce_cython__, "Begin.__reduce_cython__(self)"); +static PyMethodDef __pyx_mdef_5spacy_8pipeline_17_parser_internals_3ner_5Begin_1__reduce_cython__ = {"__reduce_cython__", (PyCFunction)(void(*)(void))(__Pyx_PyCFunction_FastCallWithKeywords)__pyx_pw_5spacy_8pipeline_17_parser_internals_3ner_5Begin_1__reduce_cython__, __Pyx_METH_FASTCALL|METH_KEYWORDS, __pyx_doc_5spacy_8pipeline_17_parser_internals_3ner_5Begin___reduce_cython__}; +static PyObject *__pyx_pw_5spacy_8pipeline_17_parser_internals_3ner_5Begin_1__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_5spacy_8pipeline_17_parser_internals_3ner_5Begin___reduce_cython__(((struct __pyx_obj_5spacy_8pipeline_17_parser_internals_3ner_Begin *)__pyx_v_self)); + + /* function exit code */ + __Pyx_RefNannyFinishContext(); + return __pyx_r; +} + +static PyObject *__pyx_pf_5spacy_8pipeline_17_parser_internals_3ner_5Begin___reduce_cython__(struct __pyx_obj_5spacy_8pipeline_17_parser_internals_3ner_Begin *__pyx_v_self) { + PyObject *__pyx_v_state = 0; + PyObject *__pyx_v__dict = 0; + int __pyx_v_use_setstate; + PyObject *__pyx_r = NULL; + __Pyx_RefNannyDeclarations + PyObject *__pyx_t_1 = NULL; + int __pyx_t_2; + int __pyx_t_3; + PyObject *__pyx_t_4 = NULL; + PyObject *__pyx_t_5 = NULL; + int __pyx_lineno = 0; + const char *__pyx_filename = NULL; + int __pyx_clineno = 0; + __Pyx_RefNannySetupContext("__reduce_cython__", 0); + + /* "(tree fragment)":5 + * cdef object _dict + * cdef bint use_setstate + * state = () # <<<<<<<<<<<<<< + * _dict = getattr(self, '__dict__', None) + * if _dict is not None and _dict: +*/ + __Pyx_INCREF(__pyx_mstate_global->__pyx_empty_tuple); + __pyx_v_state = __pyx_mstate_global->__pyx_empty_tuple; + + /* "(tree fragment)":6 + * cdef bint use_setstate + * state = () + * _dict = getattr(self, '__dict__', None) # <<<<<<<<<<<<<< + * if _dict is not None and _dict: + * state += (_dict,) +*/ + __pyx_t_1 = __Pyx_GetAttr3(((PyObject *)__pyx_v_self), __pyx_mstate_global->__pyx_n_u_dict, Py_None); if (unlikely(!__pyx_t_1)) __PYX_ERR(1, 6, __pyx_L1_error) + __Pyx_GOTREF(__pyx_t_1); + __pyx_v__dict = __pyx_t_1; + __pyx_t_1 = 0; + + /* "(tree fragment)":7 + * state = () + * _dict = getattr(self, '__dict__', None) + * if _dict is not None and _dict: # <<<<<<<<<<<<<< + * state += (_dict,) + * use_setstate = True +*/ + __pyx_t_3 = (__pyx_v__dict != Py_None); + if (__pyx_t_3) { + } else { + __pyx_t_2 = __pyx_t_3; + goto __pyx_L4_bool_binop_done; + } + __pyx_t_3 = __Pyx_PyObject_IsTrue(__pyx_v__dict); if (unlikely((__pyx_t_3 < 0))) __PYX_ERR(1, 7, __pyx_L1_error) + __pyx_t_2 = __pyx_t_3; + __pyx_L4_bool_binop_done:; + if (__pyx_t_2) { + + /* "(tree fragment)":8 + * _dict = getattr(self, '__dict__', None) + * if _dict is not None and _dict: + * state += (_dict,) # <<<<<<<<<<<<<< + * use_setstate = True + * else: +*/ + __pyx_t_1 = PyTuple_New(1); if (unlikely(!__pyx_t_1)) __PYX_ERR(1, 8, __pyx_L1_error) + __Pyx_GOTREF(__pyx_t_1); + __Pyx_INCREF(__pyx_v__dict); + __Pyx_GIVEREF(__pyx_v__dict); + if (__Pyx_PyTuple_SET_ITEM(__pyx_t_1, 0, __pyx_v__dict) != (0)) __PYX_ERR(1, 8, __pyx_L1_error); + __pyx_t_4 = PyNumber_InPlaceAdd(__pyx_v_state, __pyx_t_1); if (unlikely(!__pyx_t_4)) __PYX_ERR(1, 8, __pyx_L1_error) + __Pyx_GOTREF(__pyx_t_4); + __Pyx_DECREF(__pyx_t_1); __pyx_t_1 = 0; + __Pyx_DECREF_SET(__pyx_v_state, ((PyObject*)__pyx_t_4)); + __pyx_t_4 = 0; + + /* "(tree fragment)":9 + * if _dict is not None and _dict: + * state += (_dict,) + * use_setstate = True # <<<<<<<<<<<<<< + * else: + * use_setstate = ('False',) +*/ + __pyx_v_use_setstate = 1; + + /* "(tree fragment)":7 + * state = () + * _dict = getattr(self, '__dict__', None) + * if _dict is not None and _dict: # <<<<<<<<<<<<<< + * state += (_dict,) + * use_setstate = True +*/ + goto __pyx_L3; + } + + /* "(tree fragment)":11 + * use_setstate = True + * else: + * use_setstate = ('False',) # <<<<<<<<<<<<<< + * if use_setstate: + * return __pyx_unpickle_Begin, (type(self), 0xe3b0c44, None), state +*/ + /*else*/ { + __pyx_t_2 = __Pyx_PyObject_IsTrue(__pyx_mstate_global->__pyx_tuple[2]); if (unlikely((__pyx_t_2 == (int)-1) && PyErr_Occurred())) __PYX_ERR(1, 11, __pyx_L1_error) + __pyx_v_use_setstate = __pyx_t_2; + } + __pyx_L3:; + + /* "(tree fragment)":12 + * else: + * use_setstate = ('False',) + * if use_setstate: # <<<<<<<<<<<<<< + * return __pyx_unpickle_Begin, (type(self), 0xe3b0c44, None), state + * else: +*/ + if (__pyx_v_use_setstate) { + + /* "(tree fragment)":13 + * use_setstate = ('False',) + * if use_setstate: + * return __pyx_unpickle_Begin, (type(self), 0xe3b0c44, None), state # <<<<<<<<<<<<<< + * else: + * return __pyx_unpickle_Begin, (type(self), 0xe3b0c44, state) +*/ + __Pyx_XDECREF(__pyx_r); + __Pyx_GetModuleGlobalName(__pyx_t_4, __pyx_mstate_global->__pyx_n_u_pyx_unpickle_Begin); if (unlikely(!__pyx_t_4)) __PYX_ERR(1, 13, __pyx_L1_error) + __Pyx_GOTREF(__pyx_t_4); + __pyx_t_1 = PyTuple_New(3); if (unlikely(!__pyx_t_1)) __PYX_ERR(1, 13, __pyx_L1_error) + __Pyx_GOTREF(__pyx_t_1); + __Pyx_INCREF(((PyObject *)Py_TYPE(((PyObject *)__pyx_v_self)))); + __Pyx_GIVEREF(((PyObject *)Py_TYPE(((PyObject *)__pyx_v_self)))); + if (__Pyx_PyTuple_SET_ITEM(__pyx_t_1, 0, ((PyObject *)Py_TYPE(((PyObject *)__pyx_v_self)))) != (0)) __PYX_ERR(1, 13, __pyx_L1_error); + __Pyx_INCREF(__pyx_mstate_global->__pyx_int_238750788); + __Pyx_GIVEREF(__pyx_mstate_global->__pyx_int_238750788); + if (__Pyx_PyTuple_SET_ITEM(__pyx_t_1, 1, __pyx_mstate_global->__pyx_int_238750788) != (0)) __PYX_ERR(1, 13, __pyx_L1_error); + __Pyx_INCREF(Py_None); + __Pyx_GIVEREF(Py_None); + if (__Pyx_PyTuple_SET_ITEM(__pyx_t_1, 2, Py_None) != (0)) __PYX_ERR(1, 13, __pyx_L1_error); + __pyx_t_5 = PyTuple_New(3); if (unlikely(!__pyx_t_5)) __PYX_ERR(1, 13, __pyx_L1_error) + __Pyx_GOTREF(__pyx_t_5); + __Pyx_GIVEREF(__pyx_t_4); + if (__Pyx_PyTuple_SET_ITEM(__pyx_t_5, 0, __pyx_t_4) != (0)) __PYX_ERR(1, 13, __pyx_L1_error); + __Pyx_GIVEREF(__pyx_t_1); + if (__Pyx_PyTuple_SET_ITEM(__pyx_t_5, 1, __pyx_t_1) != (0)) __PYX_ERR(1, 13, __pyx_L1_error); + __Pyx_INCREF(__pyx_v_state); + __Pyx_GIVEREF(__pyx_v_state); + if (__Pyx_PyTuple_SET_ITEM(__pyx_t_5, 2, __pyx_v_state) != (0)) __PYX_ERR(1, 13, __pyx_L1_error); + __pyx_t_4 = 0; + __pyx_t_1 = 0; + __pyx_r = __pyx_t_5; + __pyx_t_5 = 0; + goto __pyx_L0; + + /* "(tree fragment)":12 + * else: + * use_setstate = ('False',) + * if use_setstate: # <<<<<<<<<<<<<< + * return __pyx_unpickle_Begin, (type(self), 0xe3b0c44, None), state + * else: +*/ + } + + /* "(tree fragment)":15 + * return __pyx_unpickle_Begin, (type(self), 0xe3b0c44, None), state + * else: + * return __pyx_unpickle_Begin, (type(self), 0xe3b0c44, state) # <<<<<<<<<<<<<< + * def __setstate_cython__(self, __pyx_state): + * __pyx_unpickle_Begin__set_state(self, __pyx_state) +*/ + /*else*/ { + __Pyx_XDECREF(__pyx_r); + __Pyx_GetModuleGlobalName(__pyx_t_5, __pyx_mstate_global->__pyx_n_u_pyx_unpickle_Begin); if (unlikely(!__pyx_t_5)) __PYX_ERR(1, 15, __pyx_L1_error) + __Pyx_GOTREF(__pyx_t_5); + __pyx_t_1 = PyTuple_New(3); if (unlikely(!__pyx_t_1)) __PYX_ERR(1, 15, __pyx_L1_error) + __Pyx_GOTREF(__pyx_t_1); + __Pyx_INCREF(((PyObject *)Py_TYPE(((PyObject *)__pyx_v_self)))); + __Pyx_GIVEREF(((PyObject *)Py_TYPE(((PyObject *)__pyx_v_self)))); + if (__Pyx_PyTuple_SET_ITEM(__pyx_t_1, 0, ((PyObject *)Py_TYPE(((PyObject *)__pyx_v_self)))) != (0)) __PYX_ERR(1, 15, __pyx_L1_error); + __Pyx_INCREF(__pyx_mstate_global->__pyx_int_238750788); + __Pyx_GIVEREF(__pyx_mstate_global->__pyx_int_238750788); + if (__Pyx_PyTuple_SET_ITEM(__pyx_t_1, 1, __pyx_mstate_global->__pyx_int_238750788) != (0)) __PYX_ERR(1, 15, __pyx_L1_error); + __Pyx_INCREF(__pyx_v_state); + __Pyx_GIVEREF(__pyx_v_state); + if (__Pyx_PyTuple_SET_ITEM(__pyx_t_1, 2, __pyx_v_state) != (0)) __PYX_ERR(1, 15, __pyx_L1_error); + __pyx_t_4 = PyTuple_New(2); if (unlikely(!__pyx_t_4)) __PYX_ERR(1, 15, __pyx_L1_error) + __Pyx_GOTREF(__pyx_t_4); + __Pyx_GIVEREF(__pyx_t_5); + if (__Pyx_PyTuple_SET_ITEM(__pyx_t_4, 0, __pyx_t_5) != (0)) __PYX_ERR(1, 15, __pyx_L1_error); + __Pyx_GIVEREF(__pyx_t_1); + if (__Pyx_PyTuple_SET_ITEM(__pyx_t_4, 1, __pyx_t_1) != (0)) __PYX_ERR(1, 15, __pyx_L1_error); + __pyx_t_5 = 0; + __pyx_t_1 = 0; + __pyx_r = __pyx_t_4; + __pyx_t_4 = 0; + goto __pyx_L0; + } + + /* "(tree fragment)":1 + * def __reduce_cython__(self): # <<<<<<<<<<<<<< + * cdef tuple state + * cdef object _dict +*/ + + /* function exit code */ + __pyx_L1_error:; + __Pyx_XDECREF(__pyx_t_1); + __Pyx_XDECREF(__pyx_t_4); + __Pyx_XDECREF(__pyx_t_5); + __Pyx_AddTraceback("spacy.pipeline._parser_internals.ner.Begin.__reduce_cython__", __pyx_clineno, __pyx_lineno, __pyx_filename); + __pyx_r = NULL; + __pyx_L0:; + __Pyx_XDECREF(__pyx_v_state); + __Pyx_XDECREF(__pyx_v__dict); + __Pyx_XGIVEREF(__pyx_r); + __Pyx_RefNannyFinishContext(); + return __pyx_r; +} + +/* "(tree fragment)":16 + * else: + * return __pyx_unpickle_Begin, (type(self), 0xe3b0c44, state) + * def __setstate_cython__(self, __pyx_state): # <<<<<<<<<<<<<< + * __pyx_unpickle_Begin__set_state(self, __pyx_state) +*/ + +/* Python wrapper */ +static PyObject *__pyx_pw_5spacy_8pipeline_17_parser_internals_3ner_5Begin_3__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_5spacy_8pipeline_17_parser_internals_3ner_5Begin_2__setstate_cython__, "Begin.__setstate_cython__(self, __pyx_state)"); +static PyMethodDef __pyx_mdef_5spacy_8pipeline_17_parser_internals_3ner_5Begin_3__setstate_cython__ = {"__setstate_cython__", (PyCFunction)(void(*)(void))(__Pyx_PyCFunction_FastCallWithKeywords)__pyx_pw_5spacy_8pipeline_17_parser_internals_3ner_5Begin_3__setstate_cython__, __Pyx_METH_FASTCALL|METH_KEYWORDS, __pyx_doc_5spacy_8pipeline_17_parser_internals_3ner_5Begin_2__setstate_cython__}; +static PyObject *__pyx_pw_5spacy_8pipeline_17_parser_internals_3ner_5Begin_3__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 +) { + 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, 16, __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, 16, __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, 16, __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, 16, __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, 16, __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, 16, __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("spacy.pipeline._parser_internals.ner.Begin.__setstate_cython__", __pyx_clineno, __pyx_lineno, __pyx_filename); + __Pyx_RefNannyFinishContext(); + return NULL; + __pyx_L4_argument_unpacking_done:; + __pyx_r = __pyx_pf_5spacy_8pipeline_17_parser_internals_3ner_5Begin_2__setstate_cython__(((struct __pyx_obj_5spacy_8pipeline_17_parser_internals_3ner_Begin *)__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_5spacy_8pipeline_17_parser_internals_3ner_5Begin_2__setstate_cython__(struct __pyx_obj_5spacy_8pipeline_17_parser_internals_3ner_Begin *__pyx_v_self, PyObject *__pyx_v___pyx_state) { + PyObject *__pyx_r = NULL; + __Pyx_RefNannyDeclarations + PyObject *__pyx_t_1 = NULL; + int __pyx_lineno = 0; + const char *__pyx_filename = NULL; + int __pyx_clineno = 0; + __Pyx_RefNannySetupContext("__setstate_cython__", 0); + + /* "(tree fragment)":17 + * return __pyx_unpickle_Begin, (type(self), 0xe3b0c44, state) + * def __setstate_cython__(self, __pyx_state): + * __pyx_unpickle_Begin__set_state(self, __pyx_state) # <<<<<<<<<<<<<< +*/ + __pyx_t_1 = __pyx_f_5spacy_8pipeline_17_parser_internals_3ner___pyx_unpickle_Begin__set_state(__pyx_v_self, __pyx_v___pyx_state); if (unlikely(!__pyx_t_1)) __PYX_ERR(1, 17, __pyx_L1_error) + __Pyx_GOTREF(__pyx_t_1); + __Pyx_DECREF(__pyx_t_1); __pyx_t_1 = 0; + + /* "(tree fragment)":16 + * else: + * return __pyx_unpickle_Begin, (type(self), 0xe3b0c44, state) + * def __setstate_cython__(self, __pyx_state): # <<<<<<<<<<<<<< + * __pyx_unpickle_Begin__set_state(self, __pyx_state) +*/ + + /* function exit code */ + __pyx_r = Py_None; __Pyx_INCREF(Py_None); + goto __pyx_L0; + __pyx_L1_error:; + __Pyx_XDECREF(__pyx_t_1); + __Pyx_AddTraceback("spacy.pipeline._parser_internals.ner.Begin.__setstate_cython__", __pyx_clineno, __pyx_lineno, __pyx_filename); + __pyx_r = NULL; + __pyx_L0:; + __Pyx_XGIVEREF(__pyx_r); + __Pyx_RefNannyFinishContext(); + return __pyx_r; +} + +/* "spacy/pipeline/_parser_internals/ner.pyx":441 + * + * cdef class In: + * @staticmethod # <<<<<<<<<<<<<< + * cdef bint is_valid(const StateC* st, attr_t label) noexcept nogil: + * if not st.entity_is_open(): +*/ + +static int __pyx_f_5spacy_8pipeline_17_parser_internals_3ner_2In_is_valid(__pyx_t_5spacy_8pipeline_17_parser_internals_6_state_StateC const *__pyx_v_st, __pyx_t_5spacy_8typedefs_attr_t __pyx_v_label) { + struct __pyx_t_5spacy_7structs_SpanC __pyx_v_ent; + int __pyx_v_preset_ent_iob; + __pyx_t_5spacy_8typedefs_attr_t __pyx_v_preset_ent_label; + int __pyx_r; + int __pyx_t_1; + int __pyx_t_2; + __pyx_t_5spacy_8typedefs_attr_t __pyx_t_3; + int __pyx_t_4; + + /* "spacy/pipeline/_parser_internals/ner.pyx":443 + * @staticmethod + * cdef bint is_valid(const StateC* st, attr_t label) noexcept nogil: + * if not st.entity_is_open(): # <<<<<<<<<<<<<< + * return False + * if st.buffer_length() < 2: +*/ + __pyx_t_1 = (!__pyx_v_st->entity_is_open()); + if (__pyx_t_1) { + + /* "spacy/pipeline/_parser_internals/ner.pyx":444 + * cdef bint is_valid(const StateC* st, attr_t label) noexcept nogil: + * if not st.entity_is_open(): + * return False # <<<<<<<<<<<<<< + * if st.buffer_length() < 2: + * # If we're at the end, we can't I. +*/ + __pyx_r = 0; + goto __pyx_L0; + + /* "spacy/pipeline/_parser_internals/ner.pyx":443 + * @staticmethod + * cdef bint is_valid(const StateC* st, attr_t label) noexcept nogil: + * if not st.entity_is_open(): # <<<<<<<<<<<<<< + * return False + * if st.buffer_length() < 2: +*/ + } + + /* "spacy/pipeline/_parser_internals/ner.pyx":445 + * if not st.entity_is_open(): + * return False + * if st.buffer_length() < 2: # <<<<<<<<<<<<<< + * # If we're at the end, we can't I. + * return False +*/ + __pyx_t_1 = (__pyx_v_st->buffer_length() < 2); + if (__pyx_t_1) { + + /* "spacy/pipeline/_parser_internals/ner.pyx":447 + * if st.buffer_length() < 2: + * # If we're at the end, we can't I. + * return False # <<<<<<<<<<<<<< + * ent = st.get_ent() + * cdef int preset_ent_iob = st.B_(0).ent_iob +*/ + __pyx_r = 0; + goto __pyx_L0; + + /* "spacy/pipeline/_parser_internals/ner.pyx":445 + * if not st.entity_is_open(): + * return False + * if st.buffer_length() < 2: # <<<<<<<<<<<<<< + * # If we're at the end, we can't I. + * return False +*/ + } + + /* "spacy/pipeline/_parser_internals/ner.pyx":448 + * # If we're at the end, we can't I. + * return False + * ent = st.get_ent() # <<<<<<<<<<<<<< + * cdef int preset_ent_iob = st.B_(0).ent_iob + * cdef attr_t preset_ent_label = st.B_(0).ent_type +*/ + __pyx_v_ent = __pyx_v_st->get_ent(); + + /* "spacy/pipeline/_parser_internals/ner.pyx":449 + * return False + * ent = st.get_ent() + * cdef int preset_ent_iob = st.B_(0).ent_iob # <<<<<<<<<<<<<< + * cdef attr_t preset_ent_label = st.B_(0).ent_type + * if label == 0: +*/ + __pyx_t_2 = __pyx_v_st->B_(0)->ent_iob; + __pyx_v_preset_ent_iob = __pyx_t_2; + + /* "spacy/pipeline/_parser_internals/ner.pyx":450 + * ent = st.get_ent() + * cdef int preset_ent_iob = st.B_(0).ent_iob + * cdef attr_t preset_ent_label = st.B_(0).ent_type # <<<<<<<<<<<<<< + * if label == 0: + * return False +*/ + __pyx_t_3 = __pyx_v_st->B_(0)->ent_type; + __pyx_v_preset_ent_label = __pyx_t_3; + + /* "spacy/pipeline/_parser_internals/ner.pyx":451 + * cdef int preset_ent_iob = st.B_(0).ent_iob + * cdef attr_t preset_ent_label = st.B_(0).ent_type + * if label == 0: # <<<<<<<<<<<<<< + * return False + * elif ent.label != label: +*/ + __pyx_t_1 = (__pyx_v_label == 0); + if (__pyx_t_1) { + + /* "spacy/pipeline/_parser_internals/ner.pyx":452 + * cdef attr_t preset_ent_label = st.B_(0).ent_type + * if label == 0: + * return False # <<<<<<<<<<<<<< + * elif ent.label != label: + * return False +*/ + __pyx_r = 0; + goto __pyx_L0; + + /* "spacy/pipeline/_parser_internals/ner.pyx":451 + * cdef int preset_ent_iob = st.B_(0).ent_iob + * cdef attr_t preset_ent_label = st.B_(0).ent_type + * if label == 0: # <<<<<<<<<<<<<< + * return False + * elif ent.label != label: +*/ + } + + /* "spacy/pipeline/_parser_internals/ner.pyx":453 + * if label == 0: + * return False + * elif ent.label != label: # <<<<<<<<<<<<<< + * return False + * elif preset_ent_iob == 3: +*/ + __pyx_t_1 = (__pyx_v_ent.label != __pyx_v_label); + if (__pyx_t_1) { + + /* "spacy/pipeline/_parser_internals/ner.pyx":454 + * return False + * elif ent.label != label: + * return False # <<<<<<<<<<<<<< + * elif preset_ent_iob == 3: + * return False +*/ + __pyx_r = 0; + goto __pyx_L0; + + /* "spacy/pipeline/_parser_internals/ner.pyx":453 + * if label == 0: + * return False + * elif ent.label != label: # <<<<<<<<<<<<<< + * return False + * elif preset_ent_iob == 3: +*/ + } + + /* "spacy/pipeline/_parser_internals/ner.pyx":455 + * elif ent.label != label: + * return False + * elif preset_ent_iob == 3: # <<<<<<<<<<<<<< + * return False + * elif st.B_(1).ent_iob == 3: +*/ + __pyx_t_1 = (__pyx_v_preset_ent_iob == 3); + if (__pyx_t_1) { + + /* "spacy/pipeline/_parser_internals/ner.pyx":456 + * return False + * elif preset_ent_iob == 3: + * return False # <<<<<<<<<<<<<< + * elif st.B_(1).ent_iob == 3: + * # If we know the next word is B, we can't be I (must be L) +*/ + __pyx_r = 0; + goto __pyx_L0; + + /* "spacy/pipeline/_parser_internals/ner.pyx":455 + * elif ent.label != label: + * return False + * elif preset_ent_iob == 3: # <<<<<<<<<<<<<< + * return False + * elif st.B_(1).ent_iob == 3: +*/ + } + + /* "spacy/pipeline/_parser_internals/ner.pyx":457 + * elif preset_ent_iob == 3: + * return False + * elif st.B_(1).ent_iob == 3: # <<<<<<<<<<<<<< + * # If we know the next word is B, we can't be I (must be L) + * return False +*/ + __pyx_t_1 = (__pyx_v_st->B_(1)->ent_iob == 3); + if (__pyx_t_1) { + + /* "spacy/pipeline/_parser_internals/ner.pyx":459 + * elif st.B_(1).ent_iob == 3: + * # If we know the next word is B, we can't be I (must be L) + * return False # <<<<<<<<<<<<<< + * elif preset_ent_iob == 1: + * if st.B_(1).ent_iob in (0, 2): +*/ + __pyx_r = 0; + goto __pyx_L0; + + /* "spacy/pipeline/_parser_internals/ner.pyx":457 + * elif preset_ent_iob == 3: + * return False + * elif st.B_(1).ent_iob == 3: # <<<<<<<<<<<<<< + * # If we know the next word is B, we can't be I (must be L) + * return False +*/ + } + + /* "spacy/pipeline/_parser_internals/ner.pyx":460 + * # If we know the next word is B, we can't be I (must be L) + * return False + * elif preset_ent_iob == 1: # <<<<<<<<<<<<<< + * if st.B_(1).ent_iob in (0, 2): + * # if next preset is missing or O, this can't be I (must be L) +*/ + __pyx_t_1 = (__pyx_v_preset_ent_iob == 1); + if (__pyx_t_1) { + + /* "spacy/pipeline/_parser_internals/ner.pyx":461 + * return False + * elif preset_ent_iob == 1: + * if st.B_(1).ent_iob in (0, 2): # <<<<<<<<<<<<<< + * # if next preset is missing or O, this can't be I (must be L) + * return False +*/ + __pyx_t_2 = __pyx_v_st->B_(1)->ent_iob; + __pyx_t_4 = (__pyx_t_2 == 0); + if (!__pyx_t_4) { + } else { + __pyx_t_1 = __pyx_t_4; + goto __pyx_L7_bool_binop_done; + } + __pyx_t_4 = (__pyx_t_2 == 2); + __pyx_t_1 = __pyx_t_4; + __pyx_L7_bool_binop_done:; + __pyx_t_4 = __pyx_t_1; + if (__pyx_t_4) { + + /* "spacy/pipeline/_parser_internals/ner.pyx":463 + * if st.B_(1).ent_iob in (0, 2): + * # if next preset is missing or O, this can't be I (must be L) + * return False # <<<<<<<<<<<<<< + * elif label != preset_ent_label: + * # If label isn't right, reject +*/ + __pyx_r = 0; + goto __pyx_L0; + + /* "spacy/pipeline/_parser_internals/ner.pyx":461 + * return False + * elif preset_ent_iob == 1: + * if st.B_(1).ent_iob in (0, 2): # <<<<<<<<<<<<<< + * # if next preset is missing or O, this can't be I (must be L) + * return False +*/ + } + + /* "spacy/pipeline/_parser_internals/ner.pyx":464 + * # if next preset is missing or O, this can't be I (must be L) + * return False + * elif label != preset_ent_label: # <<<<<<<<<<<<<< + * # If label isn't right, reject + * return False +*/ + __pyx_t_4 = (__pyx_v_label != __pyx_v_preset_ent_label); + if (__pyx_t_4) { + + /* "spacy/pipeline/_parser_internals/ner.pyx":466 + * elif label != preset_ent_label: + * # If label isn't right, reject + * return False # <<<<<<<<<<<<<< + * else: + * # Otherwise, force acceptance, even if we're across a sentence +*/ + __pyx_r = 0; + goto __pyx_L0; + + /* "spacy/pipeline/_parser_internals/ner.pyx":464 + * # if next preset is missing or O, this can't be I (must be L) + * return False + * elif label != preset_ent_label: # <<<<<<<<<<<<<< + * # If label isn't right, reject + * return False +*/ + } + + /* "spacy/pipeline/_parser_internals/ner.pyx":470 + * # Otherwise, force acceptance, even if we're across a sentence + * # boundary or the token is whitespace. + * return True # <<<<<<<<<<<<<< + * elif st.B(1) != -1 and st.B_(1).sent_start == 1: + * # Don't allow entities to extend across sentence boundaries +*/ + /*else*/ { + __pyx_r = 1; + goto __pyx_L0; + } + + /* "spacy/pipeline/_parser_internals/ner.pyx":460 + * # If we know the next word is B, we can't be I (must be L) + * return False + * elif preset_ent_iob == 1: # <<<<<<<<<<<<<< + * if st.B_(1).ent_iob in (0, 2): + * # if next preset is missing or O, this can't be I (must be L) +*/ + } + + /* "spacy/pipeline/_parser_internals/ner.pyx":471 + * # boundary or the token is whitespace. + * return True + * elif st.B(1) != -1 and st.B_(1).sent_start == 1: # <<<<<<<<<<<<<< + * # Don't allow entities to extend across sentence boundaries + * return False +*/ + __pyx_t_1 = (__pyx_v_st->B(1) != -1L); + if (__pyx_t_1) { + } else { + __pyx_t_4 = __pyx_t_1; + goto __pyx_L9_bool_binop_done; + } + __pyx_t_1 = (__pyx_v_st->B_(1)->sent_start == 1); + __pyx_t_4 = __pyx_t_1; + __pyx_L9_bool_binop_done:; + if (__pyx_t_4) { + + /* "spacy/pipeline/_parser_internals/ner.pyx":473 + * elif st.B(1) != -1 and st.B_(1).sent_start == 1: + * # Don't allow entities to extend across sentence boundaries + * return False # <<<<<<<<<<<<<< + * else: + * return True +*/ + __pyx_r = 0; + goto __pyx_L0; + + /* "spacy/pipeline/_parser_internals/ner.pyx":471 + * # boundary or the token is whitespace. + * return True + * elif st.B(1) != -1 and st.B_(1).sent_start == 1: # <<<<<<<<<<<<<< + * # Don't allow entities to extend across sentence boundaries + * return False +*/ + } + + /* "spacy/pipeline/_parser_internals/ner.pyx":475 + * return False + * else: + * return True # <<<<<<<<<<<<<< + * + * @staticmethod +*/ + /*else*/ { + __pyx_r = 1; + goto __pyx_L0; + } + + /* "spacy/pipeline/_parser_internals/ner.pyx":441 + * + * cdef class In: + * @staticmethod # <<<<<<<<<<<<<< + * cdef bint is_valid(const StateC* st, attr_t label) noexcept nogil: + * if not st.entity_is_open(): +*/ + + /* function exit code */ + __pyx_L0:; + return __pyx_r; +} + +/* "spacy/pipeline/_parser_internals/ner.pyx":477 + * return True + * + * @staticmethod # <<<<<<<<<<<<<< + * cdef int transition(StateC* st, attr_t label) noexcept nogil: + * st.push() +*/ + +static int __pyx_f_5spacy_8pipeline_17_parser_internals_3ner_2In_transition(__pyx_t_5spacy_8pipeline_17_parser_internals_6_state_StateC *__pyx_v_st, CYTHON_UNUSED __pyx_t_5spacy_8typedefs_attr_t __pyx_v_label) { + int __pyx_r; + + /* "spacy/pipeline/_parser_internals/ner.pyx":479 + * @staticmethod + * cdef int transition(StateC* st, attr_t label) noexcept nogil: + * st.push() # <<<<<<<<<<<<<< + * st.pop() + * +*/ + __pyx_v_st->push(); + + /* "spacy/pipeline/_parser_internals/ner.pyx":480 + * cdef int transition(StateC* st, attr_t label) noexcept nogil: + * st.push() + * st.pop() # <<<<<<<<<<<<<< + * + * @staticmethod +*/ + __pyx_v_st->pop(); + + /* "spacy/pipeline/_parser_internals/ner.pyx":477 + * return True + * + * @staticmethod # <<<<<<<<<<<<<< + * cdef int transition(StateC* st, attr_t label) noexcept nogil: + * st.push() +*/ + + /* function exit code */ + __pyx_r = 0; + return __pyx_r; +} + +/* "spacy/pipeline/_parser_internals/ner.pyx":482 + * st.pop() + * + * @staticmethod # <<<<<<<<<<<<<< + * cdef weight_t cost(const StateC* s, const void* _gold, attr_t label) noexcept nogil: + * gold = _gold +*/ + +static __pyx_t_5spacy_8typedefs_weight_t __pyx_f_5spacy_8pipeline_17_parser_internals_3ner_2In_cost(__pyx_t_5spacy_8pipeline_17_parser_internals_6_state_StateC const *__pyx_v_s, void const *__pyx_v__gold, CYTHON_UNUSED __pyx_t_5spacy_8typedefs_attr_t __pyx_v_label) { + struct __pyx_t_5spacy_8pipeline_17_parser_internals_3ner_GoldNERStateC *__pyx_v_gold; + int __pyx_v_next_act; + int __pyx_v_g_act; + int __pyx_v_is_sunk; + __pyx_t_5spacy_8typedefs_weight_t __pyx_r; + int __pyx_t_1; + int __pyx_t_2; + int __pyx_t_3; + + /* "spacy/pipeline/_parser_internals/ner.pyx":484 + * @staticmethod + * cdef weight_t cost(const StateC* s, const void* _gold, attr_t label) noexcept nogil: + * gold = _gold # <<<<<<<<<<<<<< + * cdef int next_act = gold.ner[s.B(1)].move if s.B(1) >= 0 else OUT + * cdef int g_act = gold.ner[s.B(0)].move +*/ + __pyx_v_gold = ((struct __pyx_t_5spacy_8pipeline_17_parser_internals_3ner_GoldNERStateC *)__pyx_v__gold); + + /* "spacy/pipeline/_parser_internals/ner.pyx":485 + * cdef weight_t cost(const StateC* s, const void* _gold, attr_t label) noexcept nogil: + * gold = _gold + * cdef int next_act = gold.ner[s.B(1)].move if s.B(1) >= 0 else OUT # <<<<<<<<<<<<<< + * cdef int g_act = gold.ner[s.B(0)].move + * cdef bint is_sunk = _entity_is_sunk(s, gold.ner) +*/ + __pyx_t_2 = (__pyx_v_s->B(1) >= 0); + if (__pyx_t_2) { + __pyx_t_1 = (__pyx_v_gold->ner[__pyx_v_s->B(1)]).move; + } else { + __pyx_t_1 = __pyx_e_5spacy_8pipeline_17_parser_internals_3ner_OUT; + } + __pyx_v_next_act = __pyx_t_1; + + /* "spacy/pipeline/_parser_internals/ner.pyx":486 + * gold = _gold + * cdef int next_act = gold.ner[s.B(1)].move if s.B(1) >= 0 else OUT + * cdef int g_act = gold.ner[s.B(0)].move # <<<<<<<<<<<<<< + * cdef bint is_sunk = _entity_is_sunk(s, gold.ner) + * +*/ + __pyx_t_1 = (__pyx_v_gold->ner[__pyx_v_s->B(0)]).move; + __pyx_v_g_act = __pyx_t_1; + + /* "spacy/pipeline/_parser_internals/ner.pyx":487 + * cdef int next_act = gold.ner[s.B(1)].move if s.B(1) >= 0 else OUT + * cdef int g_act = gold.ner[s.B(0)].move + * cdef bint is_sunk = _entity_is_sunk(s, gold.ner) # <<<<<<<<<<<<<< + * + * if g_act == MISSING: +*/ + __pyx_v_is_sunk = __pyx_f_5spacy_8pipeline_17_parser_internals_3ner__entity_is_sunk(__pyx_v_s, __pyx_v_gold->ner); + + /* "spacy/pipeline/_parser_internals/ner.pyx":489 + * cdef bint is_sunk = _entity_is_sunk(s, gold.ner) + * + * if g_act == MISSING: # <<<<<<<<<<<<<< + * return 0 + * elif g_act == BEGIN: +*/ + switch (__pyx_v_g_act) { + case __pyx_e_5spacy_8pipeline_17_parser_internals_3ner_MISSING: + + /* "spacy/pipeline/_parser_internals/ner.pyx":490 + * + * if g_act == MISSING: + * return 0 # <<<<<<<<<<<<<< + * elif g_act == BEGIN: + * # I, Gold B --> True +*/ + __pyx_r = 0.0; + goto __pyx_L0; + + /* "spacy/pipeline/_parser_internals/ner.pyx":489 + * cdef bint is_sunk = _entity_is_sunk(s, gold.ner) + * + * if g_act == MISSING: # <<<<<<<<<<<<<< + * return 0 + * elif g_act == BEGIN: +*/ + break; + case __pyx_e_5spacy_8pipeline_17_parser_internals_3ner_BEGIN: + + /* "spacy/pipeline/_parser_internals/ner.pyx":494 + * # I, Gold B --> True + * # (P of bad open entity sunk, R of this entity sunk) + * return 0 # <<<<<<<<<<<<<< + * elif g_act == IN: + * # I, Gold I --> True +*/ + __pyx_r = 0.0; + goto __pyx_L0; + + /* "spacy/pipeline/_parser_internals/ner.pyx":491 + * if g_act == MISSING: + * return 0 + * elif g_act == BEGIN: # <<<<<<<<<<<<<< + * # I, Gold B --> True + * # (P of bad open entity sunk, R of this entity sunk) +*/ + break; + case __pyx_e_5spacy_8pipeline_17_parser_internals_3ner_IN: + + /* "spacy/pipeline/_parser_internals/ner.pyx":498 + * # I, Gold I --> True + * # (label forced by prev, if mismatch, P and R both sunk) + * return 0 # <<<<<<<<<<<<<< + * elif g_act == LAST: + * # I, Gold L --> True iff this entity sunk and next tag == O +*/ + __pyx_r = 0.0; + goto __pyx_L0; + + /* "spacy/pipeline/_parser_internals/ner.pyx":495 + * # (P of bad open entity sunk, R of this entity sunk) + * return 0 + * elif g_act == IN: # <<<<<<<<<<<<<< + * # I, Gold I --> True + * # (label forced by prev, if mismatch, P and R both sunk) +*/ + break; + case __pyx_e_5spacy_8pipeline_17_parser_internals_3ner_LAST: + + /* "spacy/pipeline/_parser_internals/ner.pyx":501 + * elif g_act == LAST: + * # I, Gold L --> True iff this entity sunk and next tag == O + * return not (is_sunk and (next_act == OUT or next_act == MISSING)) # <<<<<<<<<<<<<< + * elif g_act == OUT: + * # I, Gold O --> True iff next tag == O +*/ + if (__pyx_v_is_sunk) { + } else { + __pyx_t_2 = __pyx_v_is_sunk; + goto __pyx_L3_bool_binop_done; + } + switch (__pyx_v_next_act) { + case __pyx_e_5spacy_8pipeline_17_parser_internals_3ner_OUT: + case __pyx_e_5spacy_8pipeline_17_parser_internals_3ner_MISSING: + __pyx_t_3 = 1; + break; + default: + __pyx_t_3 = 0; + break; + } + __pyx_t_2 = __pyx_t_3; + __pyx_L3_bool_binop_done:; + __pyx_r = (!__pyx_t_2); + goto __pyx_L0; + + /* "spacy/pipeline/_parser_internals/ner.pyx":499 + * # (label forced by prev, if mismatch, P and R both sunk) + * return 0 + * elif g_act == LAST: # <<<<<<<<<<<<<< + * # I, Gold L --> True iff this entity sunk and next tag == O + * return not (is_sunk and (next_act == OUT or next_act == MISSING)) +*/ + break; + case __pyx_e_5spacy_8pipeline_17_parser_internals_3ner_OUT: + + /* "spacy/pipeline/_parser_internals/ner.pyx":504 + * elif g_act == OUT: + * # I, Gold O --> True iff next tag == O + * return not (next_act == OUT or next_act == MISSING) # <<<<<<<<<<<<<< + * elif g_act == UNIT: + * # I, Gold U --> True iff next tag == O +*/ + switch (__pyx_v_next_act) { + case __pyx_e_5spacy_8pipeline_17_parser_internals_3ner_OUT: + case __pyx_e_5spacy_8pipeline_17_parser_internals_3ner_MISSING: + __pyx_t_2 = 1; + break; + default: + __pyx_t_2 = 0; + break; + } + __pyx_r = (!__pyx_t_2); + goto __pyx_L0; + + /* "spacy/pipeline/_parser_internals/ner.pyx":502 + * # I, Gold L --> True iff this entity sunk and next tag == O + * return not (is_sunk and (next_act == OUT or next_act == MISSING)) + * elif g_act == OUT: # <<<<<<<<<<<<<< + * # I, Gold O --> True iff next tag == O + * return not (next_act == OUT or next_act == MISSING) +*/ + break; + case __pyx_e_5spacy_8pipeline_17_parser_internals_3ner_UNIT: + + /* "spacy/pipeline/_parser_internals/ner.pyx":507 + * elif g_act == UNIT: + * # I, Gold U --> True iff next tag == O + * return next_act != OUT # <<<<<<<<<<<<<< + * else: + * return 1 +*/ + __pyx_r = (__pyx_v_next_act != __pyx_e_5spacy_8pipeline_17_parser_internals_3ner_OUT); + goto __pyx_L0; + + /* "spacy/pipeline/_parser_internals/ner.pyx":505 + * # I, Gold O --> True iff next tag == O + * return not (next_act == OUT or next_act == MISSING) + * elif g_act == UNIT: # <<<<<<<<<<<<<< + * # I, Gold U --> True iff next tag == O + * return next_act != OUT +*/ + break; + default: + + /* "spacy/pipeline/_parser_internals/ner.pyx":509 + * return next_act != OUT + * else: + * return 1 # <<<<<<<<<<<<<< + * + * cdef class Last: +*/ + __pyx_r = 1.0; + goto __pyx_L0; + break; + } + + /* "spacy/pipeline/_parser_internals/ner.pyx":482 + * st.pop() + * + * @staticmethod # <<<<<<<<<<<<<< + * cdef weight_t cost(const StateC* s, const void* _gold, attr_t label) noexcept nogil: + * gold = _gold +*/ + + /* function exit code */ + __pyx_L0:; + return __pyx_r; +} + +/* "(tree fragment)":1 + * def __reduce_cython__(self): # <<<<<<<<<<<<<< + * cdef tuple state + * cdef object _dict +*/ + +/* Python wrapper */ +static PyObject *__pyx_pw_5spacy_8pipeline_17_parser_internals_3ner_2In_1__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_5spacy_8pipeline_17_parser_internals_3ner_2In___reduce_cython__, "In.__reduce_cython__(self)"); +static PyMethodDef __pyx_mdef_5spacy_8pipeline_17_parser_internals_3ner_2In_1__reduce_cython__ = {"__reduce_cython__", (PyCFunction)(void(*)(void))(__Pyx_PyCFunction_FastCallWithKeywords)__pyx_pw_5spacy_8pipeline_17_parser_internals_3ner_2In_1__reduce_cython__, __Pyx_METH_FASTCALL|METH_KEYWORDS, __pyx_doc_5spacy_8pipeline_17_parser_internals_3ner_2In___reduce_cython__}; +static PyObject *__pyx_pw_5spacy_8pipeline_17_parser_internals_3ner_2In_1__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_5spacy_8pipeline_17_parser_internals_3ner_2In___reduce_cython__(((struct __pyx_obj_5spacy_8pipeline_17_parser_internals_3ner_In *)__pyx_v_self)); + + /* function exit code */ + __Pyx_RefNannyFinishContext(); + return __pyx_r; +} + +static PyObject *__pyx_pf_5spacy_8pipeline_17_parser_internals_3ner_2In___reduce_cython__(struct __pyx_obj_5spacy_8pipeline_17_parser_internals_3ner_In *__pyx_v_self) { + PyObject *__pyx_v_state = 0; + PyObject *__pyx_v__dict = 0; + int __pyx_v_use_setstate; + PyObject *__pyx_r = NULL; + __Pyx_RefNannyDeclarations + PyObject *__pyx_t_1 = NULL; + int __pyx_t_2; + int __pyx_t_3; + PyObject *__pyx_t_4 = NULL; + PyObject *__pyx_t_5 = NULL; + int __pyx_lineno = 0; + const char *__pyx_filename = NULL; + int __pyx_clineno = 0; + __Pyx_RefNannySetupContext("__reduce_cython__", 0); + + /* "(tree fragment)":5 + * cdef object _dict + * cdef bint use_setstate + * state = () # <<<<<<<<<<<<<< + * _dict = getattr(self, '__dict__', None) + * if _dict is not None and _dict: +*/ + __Pyx_INCREF(__pyx_mstate_global->__pyx_empty_tuple); + __pyx_v_state = __pyx_mstate_global->__pyx_empty_tuple; + + /* "(tree fragment)":6 + * cdef bint use_setstate + * state = () + * _dict = getattr(self, '__dict__', None) # <<<<<<<<<<<<<< + * if _dict is not None and _dict: + * state += (_dict,) +*/ + __pyx_t_1 = __Pyx_GetAttr3(((PyObject *)__pyx_v_self), __pyx_mstate_global->__pyx_n_u_dict, Py_None); if (unlikely(!__pyx_t_1)) __PYX_ERR(1, 6, __pyx_L1_error) + __Pyx_GOTREF(__pyx_t_1); + __pyx_v__dict = __pyx_t_1; + __pyx_t_1 = 0; + + /* "(tree fragment)":7 + * state = () + * _dict = getattr(self, '__dict__', None) + * if _dict is not None and _dict: # <<<<<<<<<<<<<< + * state += (_dict,) + * use_setstate = True +*/ + __pyx_t_3 = (__pyx_v__dict != Py_None); + if (__pyx_t_3) { + } else { + __pyx_t_2 = __pyx_t_3; + goto __pyx_L4_bool_binop_done; + } + __pyx_t_3 = __Pyx_PyObject_IsTrue(__pyx_v__dict); if (unlikely((__pyx_t_3 < 0))) __PYX_ERR(1, 7, __pyx_L1_error) + __pyx_t_2 = __pyx_t_3; + __pyx_L4_bool_binop_done:; + if (__pyx_t_2) { + + /* "(tree fragment)":8 + * _dict = getattr(self, '__dict__', None) + * if _dict is not None and _dict: + * state += (_dict,) # <<<<<<<<<<<<<< + * use_setstate = True + * else: +*/ + __pyx_t_1 = PyTuple_New(1); if (unlikely(!__pyx_t_1)) __PYX_ERR(1, 8, __pyx_L1_error) + __Pyx_GOTREF(__pyx_t_1); + __Pyx_INCREF(__pyx_v__dict); + __Pyx_GIVEREF(__pyx_v__dict); + if (__Pyx_PyTuple_SET_ITEM(__pyx_t_1, 0, __pyx_v__dict) != (0)) __PYX_ERR(1, 8, __pyx_L1_error); + __pyx_t_4 = PyNumber_InPlaceAdd(__pyx_v_state, __pyx_t_1); if (unlikely(!__pyx_t_4)) __PYX_ERR(1, 8, __pyx_L1_error) + __Pyx_GOTREF(__pyx_t_4); + __Pyx_DECREF(__pyx_t_1); __pyx_t_1 = 0; + __Pyx_DECREF_SET(__pyx_v_state, ((PyObject*)__pyx_t_4)); + __pyx_t_4 = 0; + + /* "(tree fragment)":9 + * if _dict is not None and _dict: + * state += (_dict,) + * use_setstate = True # <<<<<<<<<<<<<< + * else: + * use_setstate = ('False',) +*/ + __pyx_v_use_setstate = 1; + + /* "(tree fragment)":7 + * state = () + * _dict = getattr(self, '__dict__', None) + * if _dict is not None and _dict: # <<<<<<<<<<<<<< + * state += (_dict,) + * use_setstate = True +*/ + goto __pyx_L3; + } + + /* "(tree fragment)":11 + * use_setstate = True + * else: + * use_setstate = ('False',) # <<<<<<<<<<<<<< + * if use_setstate: + * return __pyx_unpickle_In, (type(self), 0xe3b0c44, None), state +*/ + /*else*/ { + __pyx_t_2 = __Pyx_PyObject_IsTrue(__pyx_mstate_global->__pyx_tuple[2]); if (unlikely((__pyx_t_2 == (int)-1) && PyErr_Occurred())) __PYX_ERR(1, 11, __pyx_L1_error) + __pyx_v_use_setstate = __pyx_t_2; + } + __pyx_L3:; + + /* "(tree fragment)":12 + * else: + * use_setstate = ('False',) + * if use_setstate: # <<<<<<<<<<<<<< + * return __pyx_unpickle_In, (type(self), 0xe3b0c44, None), state + * else: +*/ + if (__pyx_v_use_setstate) { + + /* "(tree fragment)":13 + * use_setstate = ('False',) + * if use_setstate: + * return __pyx_unpickle_In, (type(self), 0xe3b0c44, None), state # <<<<<<<<<<<<<< + * else: + * return __pyx_unpickle_In, (type(self), 0xe3b0c44, state) +*/ + __Pyx_XDECREF(__pyx_r); + __Pyx_GetModuleGlobalName(__pyx_t_4, __pyx_mstate_global->__pyx_n_u_pyx_unpickle_In); if (unlikely(!__pyx_t_4)) __PYX_ERR(1, 13, __pyx_L1_error) + __Pyx_GOTREF(__pyx_t_4); + __pyx_t_1 = PyTuple_New(3); if (unlikely(!__pyx_t_1)) __PYX_ERR(1, 13, __pyx_L1_error) + __Pyx_GOTREF(__pyx_t_1); + __Pyx_INCREF(((PyObject *)Py_TYPE(((PyObject *)__pyx_v_self)))); + __Pyx_GIVEREF(((PyObject *)Py_TYPE(((PyObject *)__pyx_v_self)))); + if (__Pyx_PyTuple_SET_ITEM(__pyx_t_1, 0, ((PyObject *)Py_TYPE(((PyObject *)__pyx_v_self)))) != (0)) __PYX_ERR(1, 13, __pyx_L1_error); + __Pyx_INCREF(__pyx_mstate_global->__pyx_int_238750788); + __Pyx_GIVEREF(__pyx_mstate_global->__pyx_int_238750788); + if (__Pyx_PyTuple_SET_ITEM(__pyx_t_1, 1, __pyx_mstate_global->__pyx_int_238750788) != (0)) __PYX_ERR(1, 13, __pyx_L1_error); + __Pyx_INCREF(Py_None); + __Pyx_GIVEREF(Py_None); + if (__Pyx_PyTuple_SET_ITEM(__pyx_t_1, 2, Py_None) != (0)) __PYX_ERR(1, 13, __pyx_L1_error); + __pyx_t_5 = PyTuple_New(3); if (unlikely(!__pyx_t_5)) __PYX_ERR(1, 13, __pyx_L1_error) + __Pyx_GOTREF(__pyx_t_5); + __Pyx_GIVEREF(__pyx_t_4); + if (__Pyx_PyTuple_SET_ITEM(__pyx_t_5, 0, __pyx_t_4) != (0)) __PYX_ERR(1, 13, __pyx_L1_error); + __Pyx_GIVEREF(__pyx_t_1); + if (__Pyx_PyTuple_SET_ITEM(__pyx_t_5, 1, __pyx_t_1) != (0)) __PYX_ERR(1, 13, __pyx_L1_error); + __Pyx_INCREF(__pyx_v_state); + __Pyx_GIVEREF(__pyx_v_state); + if (__Pyx_PyTuple_SET_ITEM(__pyx_t_5, 2, __pyx_v_state) != (0)) __PYX_ERR(1, 13, __pyx_L1_error); + __pyx_t_4 = 0; + __pyx_t_1 = 0; + __pyx_r = __pyx_t_5; + __pyx_t_5 = 0; + goto __pyx_L0; + + /* "(tree fragment)":12 + * else: + * use_setstate = ('False',) + * if use_setstate: # <<<<<<<<<<<<<< + * return __pyx_unpickle_In, (type(self), 0xe3b0c44, None), state + * else: +*/ + } + + /* "(tree fragment)":15 + * return __pyx_unpickle_In, (type(self), 0xe3b0c44, None), state + * else: + * return __pyx_unpickle_In, (type(self), 0xe3b0c44, state) # <<<<<<<<<<<<<< + * def __setstate_cython__(self, __pyx_state): + * __pyx_unpickle_In__set_state(self, __pyx_state) +*/ + /*else*/ { + __Pyx_XDECREF(__pyx_r); + __Pyx_GetModuleGlobalName(__pyx_t_5, __pyx_mstate_global->__pyx_n_u_pyx_unpickle_In); if (unlikely(!__pyx_t_5)) __PYX_ERR(1, 15, __pyx_L1_error) + __Pyx_GOTREF(__pyx_t_5); + __pyx_t_1 = PyTuple_New(3); if (unlikely(!__pyx_t_1)) __PYX_ERR(1, 15, __pyx_L1_error) + __Pyx_GOTREF(__pyx_t_1); + __Pyx_INCREF(((PyObject *)Py_TYPE(((PyObject *)__pyx_v_self)))); + __Pyx_GIVEREF(((PyObject *)Py_TYPE(((PyObject *)__pyx_v_self)))); + if (__Pyx_PyTuple_SET_ITEM(__pyx_t_1, 0, ((PyObject *)Py_TYPE(((PyObject *)__pyx_v_self)))) != (0)) __PYX_ERR(1, 15, __pyx_L1_error); + __Pyx_INCREF(__pyx_mstate_global->__pyx_int_238750788); + __Pyx_GIVEREF(__pyx_mstate_global->__pyx_int_238750788); + if (__Pyx_PyTuple_SET_ITEM(__pyx_t_1, 1, __pyx_mstate_global->__pyx_int_238750788) != (0)) __PYX_ERR(1, 15, __pyx_L1_error); + __Pyx_INCREF(__pyx_v_state); + __Pyx_GIVEREF(__pyx_v_state); + if (__Pyx_PyTuple_SET_ITEM(__pyx_t_1, 2, __pyx_v_state) != (0)) __PYX_ERR(1, 15, __pyx_L1_error); + __pyx_t_4 = PyTuple_New(2); if (unlikely(!__pyx_t_4)) __PYX_ERR(1, 15, __pyx_L1_error) + __Pyx_GOTREF(__pyx_t_4); + __Pyx_GIVEREF(__pyx_t_5); + if (__Pyx_PyTuple_SET_ITEM(__pyx_t_4, 0, __pyx_t_5) != (0)) __PYX_ERR(1, 15, __pyx_L1_error); + __Pyx_GIVEREF(__pyx_t_1); + if (__Pyx_PyTuple_SET_ITEM(__pyx_t_4, 1, __pyx_t_1) != (0)) __PYX_ERR(1, 15, __pyx_L1_error); + __pyx_t_5 = 0; + __pyx_t_1 = 0; + __pyx_r = __pyx_t_4; + __pyx_t_4 = 0; + goto __pyx_L0; + } + + /* "(tree fragment)":1 + * def __reduce_cython__(self): # <<<<<<<<<<<<<< + * cdef tuple state + * cdef object _dict +*/ + + /* function exit code */ + __pyx_L1_error:; + __Pyx_XDECREF(__pyx_t_1); + __Pyx_XDECREF(__pyx_t_4); + __Pyx_XDECREF(__pyx_t_5); + __Pyx_AddTraceback("spacy.pipeline._parser_internals.ner.In.__reduce_cython__", __pyx_clineno, __pyx_lineno, __pyx_filename); + __pyx_r = NULL; + __pyx_L0:; + __Pyx_XDECREF(__pyx_v_state); + __Pyx_XDECREF(__pyx_v__dict); + __Pyx_XGIVEREF(__pyx_r); + __Pyx_RefNannyFinishContext(); + return __pyx_r; +} + +/* "(tree fragment)":16 + * else: + * return __pyx_unpickle_In, (type(self), 0xe3b0c44, state) + * def __setstate_cython__(self, __pyx_state): # <<<<<<<<<<<<<< + * __pyx_unpickle_In__set_state(self, __pyx_state) +*/ + +/* Python wrapper */ +static PyObject *__pyx_pw_5spacy_8pipeline_17_parser_internals_3ner_2In_3__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_5spacy_8pipeline_17_parser_internals_3ner_2In_2__setstate_cython__, "In.__setstate_cython__(self, __pyx_state)"); +static PyMethodDef __pyx_mdef_5spacy_8pipeline_17_parser_internals_3ner_2In_3__setstate_cython__ = {"__setstate_cython__", (PyCFunction)(void(*)(void))(__Pyx_PyCFunction_FastCallWithKeywords)__pyx_pw_5spacy_8pipeline_17_parser_internals_3ner_2In_3__setstate_cython__, __Pyx_METH_FASTCALL|METH_KEYWORDS, __pyx_doc_5spacy_8pipeline_17_parser_internals_3ner_2In_2__setstate_cython__}; +static PyObject *__pyx_pw_5spacy_8pipeline_17_parser_internals_3ner_2In_3__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 +) { + 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, 16, __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, 16, __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, 16, __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, 16, __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, 16, __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, 16, __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("spacy.pipeline._parser_internals.ner.In.__setstate_cython__", __pyx_clineno, __pyx_lineno, __pyx_filename); + __Pyx_RefNannyFinishContext(); + return NULL; + __pyx_L4_argument_unpacking_done:; + __pyx_r = __pyx_pf_5spacy_8pipeline_17_parser_internals_3ner_2In_2__setstate_cython__(((struct __pyx_obj_5spacy_8pipeline_17_parser_internals_3ner_In *)__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_5spacy_8pipeline_17_parser_internals_3ner_2In_2__setstate_cython__(struct __pyx_obj_5spacy_8pipeline_17_parser_internals_3ner_In *__pyx_v_self, PyObject *__pyx_v___pyx_state) { + PyObject *__pyx_r = NULL; + __Pyx_RefNannyDeclarations + PyObject *__pyx_t_1 = NULL; + int __pyx_lineno = 0; + const char *__pyx_filename = NULL; + int __pyx_clineno = 0; + __Pyx_RefNannySetupContext("__setstate_cython__", 0); + + /* "(tree fragment)":17 + * return __pyx_unpickle_In, (type(self), 0xe3b0c44, state) + * def __setstate_cython__(self, __pyx_state): + * __pyx_unpickle_In__set_state(self, __pyx_state) # <<<<<<<<<<<<<< +*/ + __pyx_t_1 = __pyx_f_5spacy_8pipeline_17_parser_internals_3ner___pyx_unpickle_In__set_state(__pyx_v_self, __pyx_v___pyx_state); if (unlikely(!__pyx_t_1)) __PYX_ERR(1, 17, __pyx_L1_error) + __Pyx_GOTREF(__pyx_t_1); + __Pyx_DECREF(__pyx_t_1); __pyx_t_1 = 0; + + /* "(tree fragment)":16 + * else: + * return __pyx_unpickle_In, (type(self), 0xe3b0c44, state) + * def __setstate_cython__(self, __pyx_state): # <<<<<<<<<<<<<< + * __pyx_unpickle_In__set_state(self, __pyx_state) +*/ + + /* function exit code */ + __pyx_r = Py_None; __Pyx_INCREF(Py_None); + goto __pyx_L0; + __pyx_L1_error:; + __Pyx_XDECREF(__pyx_t_1); + __Pyx_AddTraceback("spacy.pipeline._parser_internals.ner.In.__setstate_cython__", __pyx_clineno, __pyx_lineno, __pyx_filename); + __pyx_r = NULL; + __pyx_L0:; + __Pyx_XGIVEREF(__pyx_r); + __Pyx_RefNannyFinishContext(); + return __pyx_r; +} + +/* "spacy/pipeline/_parser_internals/ner.pyx":512 + * + * cdef class Last: + * @staticmethod # <<<<<<<<<<<<<< + * cdef bint is_valid(const StateC* st, attr_t label) noexcept nogil: + * cdef int preset_ent_iob = st.B_(0).ent_iob +*/ + +static int __pyx_f_5spacy_8pipeline_17_parser_internals_3ner_4Last_is_valid(__pyx_t_5spacy_8pipeline_17_parser_internals_6_state_StateC const *__pyx_v_st, __pyx_t_5spacy_8typedefs_attr_t __pyx_v_label) { + int __pyx_v_preset_ent_iob; + __pyx_t_5spacy_8typedefs_attr_t __pyx_v_preset_ent_label; + int __pyx_r; + int __pyx_t_1; + __pyx_t_5spacy_8typedefs_attr_t __pyx_t_2; + int __pyx_t_3; + int __pyx_t_4; + + /* "spacy/pipeline/_parser_internals/ner.pyx":514 + * @staticmethod + * cdef bint is_valid(const StateC* st, attr_t label) noexcept nogil: + * cdef int preset_ent_iob = st.B_(0).ent_iob # <<<<<<<<<<<<<< + * cdef attr_t preset_ent_label = st.B_(0).ent_type + * if label == 0: +*/ + __pyx_t_1 = __pyx_v_st->B_(0)->ent_iob; + __pyx_v_preset_ent_iob = __pyx_t_1; + + /* "spacy/pipeline/_parser_internals/ner.pyx":515 + * cdef bint is_valid(const StateC* st, attr_t label) noexcept nogil: + * cdef int preset_ent_iob = st.B_(0).ent_iob + * cdef attr_t preset_ent_label = st.B_(0).ent_type # <<<<<<<<<<<<<< + * if label == 0: + * return False +*/ + __pyx_t_2 = __pyx_v_st->B_(0)->ent_type; + __pyx_v_preset_ent_label = __pyx_t_2; + + /* "spacy/pipeline/_parser_internals/ner.pyx":516 + * cdef int preset_ent_iob = st.B_(0).ent_iob + * cdef attr_t preset_ent_label = st.B_(0).ent_type + * if label == 0: # <<<<<<<<<<<<<< + * return False + * elif not st.entity_is_open(): +*/ + __pyx_t_3 = (__pyx_v_label == 0); + if (__pyx_t_3) { + + /* "spacy/pipeline/_parser_internals/ner.pyx":517 + * cdef attr_t preset_ent_label = st.B_(0).ent_type + * if label == 0: + * return False # <<<<<<<<<<<<<< + * elif not st.entity_is_open(): + * return False +*/ + __pyx_r = 0; + goto __pyx_L0; + + /* "spacy/pipeline/_parser_internals/ner.pyx":516 + * cdef int preset_ent_iob = st.B_(0).ent_iob + * cdef attr_t preset_ent_label = st.B_(0).ent_type + * if label == 0: # <<<<<<<<<<<<<< + * return False + * elif not st.entity_is_open(): +*/ + } + + /* "spacy/pipeline/_parser_internals/ner.pyx":518 + * if label == 0: + * return False + * elif not st.entity_is_open(): # <<<<<<<<<<<<<< + * return False + * elif preset_ent_iob == 1 and st.B_(1).ent_iob != 1: +*/ + __pyx_t_3 = (!__pyx_v_st->entity_is_open()); + if (__pyx_t_3) { + + /* "spacy/pipeline/_parser_internals/ner.pyx":519 + * return False + * elif not st.entity_is_open(): + * return False # <<<<<<<<<<<<<< + * elif preset_ent_iob == 1 and st.B_(1).ent_iob != 1: + * # If a preset entity has I followed by not-I, is L +*/ + __pyx_r = 0; + goto __pyx_L0; + + /* "spacy/pipeline/_parser_internals/ner.pyx":518 + * if label == 0: + * return False + * elif not st.entity_is_open(): # <<<<<<<<<<<<<< + * return False + * elif preset_ent_iob == 1 and st.B_(1).ent_iob != 1: +*/ + } + + /* "spacy/pipeline/_parser_internals/ner.pyx":520 + * elif not st.entity_is_open(): + * return False + * elif preset_ent_iob == 1 and st.B_(1).ent_iob != 1: # <<<<<<<<<<<<<< + * # If a preset entity has I followed by not-I, is L + * if label != preset_ent_label: +*/ + __pyx_t_4 = (__pyx_v_preset_ent_iob == 1); + if (__pyx_t_4) { + } else { + __pyx_t_3 = __pyx_t_4; + goto __pyx_L4_bool_binop_done; + } + __pyx_t_4 = (__pyx_v_st->B_(1)->ent_iob != 1); + __pyx_t_3 = __pyx_t_4; + __pyx_L4_bool_binop_done:; + if (__pyx_t_3) { + + /* "spacy/pipeline/_parser_internals/ner.pyx":522 + * elif preset_ent_iob == 1 and st.B_(1).ent_iob != 1: + * # If a preset entity has I followed by not-I, is L + * if label != preset_ent_label: # <<<<<<<<<<<<<< + * # If label isn't right, reject + * return False +*/ + __pyx_t_3 = (__pyx_v_label != __pyx_v_preset_ent_label); + if (__pyx_t_3) { + + /* "spacy/pipeline/_parser_internals/ner.pyx":524 + * if label != preset_ent_label: + * # If label isn't right, reject + * return False # <<<<<<<<<<<<<< + * else: + * # Otherwise, force acceptance, even if we're across a sentence +*/ + __pyx_r = 0; + goto __pyx_L0; + + /* "spacy/pipeline/_parser_internals/ner.pyx":522 + * elif preset_ent_iob == 1 and st.B_(1).ent_iob != 1: + * # If a preset entity has I followed by not-I, is L + * if label != preset_ent_label: # <<<<<<<<<<<<<< + * # If label isn't right, reject + * return False +*/ + } + + /* "spacy/pipeline/_parser_internals/ner.pyx":528 + * # Otherwise, force acceptance, even if we're across a sentence + * # boundary or the token is whitespace. + * return True # <<<<<<<<<<<<<< + * elif st.get_ent().label != label: + * return False +*/ + /*else*/ { + __pyx_r = 1; + goto __pyx_L0; + } + + /* "spacy/pipeline/_parser_internals/ner.pyx":520 + * elif not st.entity_is_open(): + * return False + * elif preset_ent_iob == 1 and st.B_(1).ent_iob != 1: # <<<<<<<<<<<<<< + * # If a preset entity has I followed by not-I, is L + * if label != preset_ent_label: +*/ + } + + /* "spacy/pipeline/_parser_internals/ner.pyx":529 + * # boundary or the token is whitespace. + * return True + * elif st.get_ent().label != label: # <<<<<<<<<<<<<< + * return False + * elif st.B_(1).ent_iob == 1: +*/ + __pyx_t_3 = (__pyx_v_st->get_ent().label != __pyx_v_label); + if (__pyx_t_3) { + + /* "spacy/pipeline/_parser_internals/ner.pyx":530 + * return True + * elif st.get_ent().label != label: + * return False # <<<<<<<<<<<<<< + * elif st.B_(1).ent_iob == 1: + * # If a preset entity has I next, we can't L here. +*/ + __pyx_r = 0; + goto __pyx_L0; + + /* "spacy/pipeline/_parser_internals/ner.pyx":529 + * # boundary or the token is whitespace. + * return True + * elif st.get_ent().label != label: # <<<<<<<<<<<<<< + * return False + * elif st.B_(1).ent_iob == 1: +*/ + } + + /* "spacy/pipeline/_parser_internals/ner.pyx":531 + * elif st.get_ent().label != label: + * return False + * elif st.B_(1).ent_iob == 1: # <<<<<<<<<<<<<< + * # If a preset entity has I next, we can't L here. + * return False +*/ + __pyx_t_3 = (__pyx_v_st->B_(1)->ent_iob == 1); + if (__pyx_t_3) { + + /* "spacy/pipeline/_parser_internals/ner.pyx":533 + * elif st.B_(1).ent_iob == 1: + * # If a preset entity has I next, we can't L here. + * return False # <<<<<<<<<<<<<< + * else: + * return True +*/ + __pyx_r = 0; + goto __pyx_L0; + + /* "spacy/pipeline/_parser_internals/ner.pyx":531 + * elif st.get_ent().label != label: + * return False + * elif st.B_(1).ent_iob == 1: # <<<<<<<<<<<<<< + * # If a preset entity has I next, we can't L here. + * return False +*/ + } + + /* "spacy/pipeline/_parser_internals/ner.pyx":535 + * return False + * else: + * return True # <<<<<<<<<<<<<< + * + * @staticmethod +*/ + /*else*/ { + __pyx_r = 1; + goto __pyx_L0; + } + + /* "spacy/pipeline/_parser_internals/ner.pyx":512 + * + * cdef class Last: + * @staticmethod # <<<<<<<<<<<<<< + * cdef bint is_valid(const StateC* st, attr_t label) noexcept nogil: + * cdef int preset_ent_iob = st.B_(0).ent_iob +*/ + + /* function exit code */ + __pyx_L0:; + return __pyx_r; +} + +/* "spacy/pipeline/_parser_internals/ner.pyx":537 + * return True + * + * @staticmethod # <<<<<<<<<<<<<< + * cdef int transition(StateC* st, attr_t label) noexcept nogil: + * st.close_ent() +*/ + +static int __pyx_f_5spacy_8pipeline_17_parser_internals_3ner_4Last_transition(__pyx_t_5spacy_8pipeline_17_parser_internals_6_state_StateC *__pyx_v_st, CYTHON_UNUSED __pyx_t_5spacy_8typedefs_attr_t __pyx_v_label) { + int __pyx_r; + + /* "spacy/pipeline/_parser_internals/ner.pyx":539 + * @staticmethod + * cdef int transition(StateC* st, attr_t label) noexcept nogil: + * st.close_ent() # <<<<<<<<<<<<<< + * st.push() + * st.pop() +*/ + __pyx_v_st->close_ent(); + + /* "spacy/pipeline/_parser_internals/ner.pyx":540 + * cdef int transition(StateC* st, attr_t label) noexcept nogil: + * st.close_ent() + * st.push() # <<<<<<<<<<<<<< + * st.pop() + * +*/ + __pyx_v_st->push(); + + /* "spacy/pipeline/_parser_internals/ner.pyx":541 + * st.close_ent() + * st.push() + * st.pop() # <<<<<<<<<<<<<< + * + * @staticmethod +*/ + __pyx_v_st->pop(); + + /* "spacy/pipeline/_parser_internals/ner.pyx":537 + * return True + * + * @staticmethod # <<<<<<<<<<<<<< + * cdef int transition(StateC* st, attr_t label) noexcept nogil: + * st.close_ent() +*/ + + /* function exit code */ + __pyx_r = 0; + return __pyx_r; +} + +/* "spacy/pipeline/_parser_internals/ner.pyx":543 + * st.pop() + * + * @staticmethod # <<<<<<<<<<<<<< + * cdef weight_t cost(const StateC* s, const void* _gold, attr_t label) noexcept nogil: + * gold = _gold +*/ + +static __pyx_t_5spacy_8typedefs_weight_t __pyx_f_5spacy_8pipeline_17_parser_internals_3ner_4Last_cost(__pyx_t_5spacy_8pipeline_17_parser_internals_6_state_StateC const *__pyx_v_s, void const *__pyx_v__gold, __pyx_t_5spacy_8typedefs_attr_t __pyx_v_label) { + struct __pyx_t_5spacy_8pipeline_17_parser_internals_3ner_GoldNERStateC *__pyx_v_gold; + int __pyx_v_b0; + int __pyx_v_ent_start; + int __pyx_v_g_act; + int __pyx_v_cost; + struct __pyx_t_5spacy_7structs_SpanC __pyx_v_span; + __pyx_t_5spacy_8typedefs_weight_t __pyx_r; + int __pyx_t_1; + struct __pyx_t_5spacy_7structs_SpanC *__pyx_t_2; + struct __pyx_t_5spacy_7structs_SpanC *__pyx_t_3; + struct __pyx_t_5spacy_7structs_SpanC *__pyx_t_4; + int __pyx_t_5; + int __pyx_t_6; + + /* "spacy/pipeline/_parser_internals/ner.pyx":545 + * @staticmethod + * cdef weight_t cost(const StateC* s, const void* _gold, attr_t label) noexcept nogil: + * gold = _gold # <<<<<<<<<<<<<< + * b0 = s.B(0) + * ent_start = s.E(0) +*/ + __pyx_v_gold = ((struct __pyx_t_5spacy_8pipeline_17_parser_internals_3ner_GoldNERStateC *)__pyx_v__gold); + + /* "spacy/pipeline/_parser_internals/ner.pyx":546 + * cdef weight_t cost(const StateC* s, const void* _gold, attr_t label) noexcept nogil: + * gold = _gold + * b0 = s.B(0) # <<<<<<<<<<<<<< + * ent_start = s.E(0) + * +*/ + __pyx_v_b0 = __pyx_v_s->B(0); + + /* "spacy/pipeline/_parser_internals/ner.pyx":547 + * gold = _gold + * b0 = s.B(0) + * ent_start = s.E(0) # <<<<<<<<<<<<<< + * + * cdef int g_act = gold.ner[b0].move +*/ + __pyx_v_ent_start = __pyx_v_s->E(0); + + /* "spacy/pipeline/_parser_internals/ner.pyx":549 + * ent_start = s.E(0) + * + * cdef int g_act = gold.ner[b0].move # <<<<<<<<<<<<<< + * + * cdef int cost = 0 +*/ + __pyx_t_1 = (__pyx_v_gold->ner[__pyx_v_b0]).move; + __pyx_v_g_act = __pyx_t_1; + + /* "spacy/pipeline/_parser_internals/ner.pyx":551 + * cdef int g_act = gold.ner[b0].move + * + * cdef int cost = 0 # <<<<<<<<<<<<<< + * + * if g_act == MISSING: +*/ + __pyx_v_cost = 0; + + /* "spacy/pipeline/_parser_internals/ner.pyx":553 + * cdef int cost = 0 + * + * if g_act == MISSING: # <<<<<<<<<<<<<< + * pass + * elif g_act == BEGIN: +*/ + switch (__pyx_v_g_act) { + case __pyx_e_5spacy_8pipeline_17_parser_internals_3ner_MISSING: + break; + case __pyx_e_5spacy_8pipeline_17_parser_internals_3ner_BEGIN: + + /* "spacy/pipeline/_parser_internals/ner.pyx":555 + * if g_act == MISSING: + * pass + * elif g_act == BEGIN: # <<<<<<<<<<<<<< + * # L, Gold B --> True + * pass +*/ + break; + case __pyx_e_5spacy_8pipeline_17_parser_internals_3ner_IN: + + /* "spacy/pipeline/_parser_internals/ner.pyx":560 + * elif g_act == IN: + * # L, Gold I --> True iff this entity sunk + * cost += not _entity_is_sunk(s, gold.ner) # <<<<<<<<<<<<<< + * elif g_act == LAST: + * # L, Gold L --> True +*/ + __pyx_v_cost = (__pyx_v_cost + (!__pyx_f_5spacy_8pipeline_17_parser_internals_3ner__entity_is_sunk(__pyx_v_s, __pyx_v_gold->ner))); + + /* "spacy/pipeline/_parser_internals/ner.pyx":558 + * # L, Gold B --> True + * pass + * elif g_act == IN: # <<<<<<<<<<<<<< + * # L, Gold I --> True iff this entity sunk + * cost += not _entity_is_sunk(s, gold.ner) +*/ + break; + case __pyx_e_5spacy_8pipeline_17_parser_internals_3ner_LAST: + + /* "spacy/pipeline/_parser_internals/ner.pyx":561 + * # L, Gold I --> True iff this entity sunk + * cost += not _entity_is_sunk(s, gold.ner) + * elif g_act == LAST: # <<<<<<<<<<<<<< + * # L, Gold L --> True + * pass +*/ + break; + case __pyx_e_5spacy_8pipeline_17_parser_internals_3ner_OUT: + + /* "spacy/pipeline/_parser_internals/ner.pyx":564 + * # L, Gold L --> True + * pass + * elif g_act == OUT: # <<<<<<<<<<<<<< + * # L, Gold O --> True + * pass +*/ + break; + case __pyx_e_5spacy_8pipeline_17_parser_internals_3ner_UNIT: + + /* "spacy/pipeline/_parser_internals/ner.pyx":567 + * # L, Gold O --> True + * pass + * elif g_act == UNIT: # <<<<<<<<<<<<<< + * # L, Gold U --> True + * pass +*/ + break; + default: + + /* "spacy/pipeline/_parser_internals/ner.pyx":571 + * pass + * else: + * cost += 1 # <<<<<<<<<<<<<< + * # If we have negative-example entities, integrate them into the objective, + * # by marking actions that close an entity that we know is incorrect +*/ + __pyx_v_cost = (__pyx_v_cost + 1); + break; + } + + /* "spacy/pipeline/_parser_internals/ner.pyx":575 + * # by marking actions that close an entity that we know is incorrect + * # as costly. + * for span in gold.negs[:gold.nr_neg]: # <<<<<<<<<<<<<< + * if span.label == label and (span.end-1) == b0 and span.start == ent_start: + * cost += 1 +*/ + __pyx_t_3 = (__pyx_v_gold->negs + __pyx_v_gold->nr_neg); + for (__pyx_t_4 = __pyx_v_gold->negs; __pyx_t_4 < __pyx_t_3; __pyx_t_4++) { + __pyx_t_2 = __pyx_t_4; + __pyx_v_span = (__pyx_t_2[0]); + + /* "spacy/pipeline/_parser_internals/ner.pyx":576 + * # as costly. + * for span in gold.negs[:gold.nr_neg]: + * if span.label == label and (span.end-1) == b0 and span.start == ent_start: # <<<<<<<<<<<<<< + * cost += 1 + * break +*/ + __pyx_t_6 = (__pyx_v_span.label == __pyx_v_label); + if (__pyx_t_6) { + } else { + __pyx_t_5 = __pyx_t_6; + goto __pyx_L6_bool_binop_done; + } + __pyx_t_6 = ((__pyx_v_span.end - 1) == __pyx_v_b0); + if (__pyx_t_6) { + } else { + __pyx_t_5 = __pyx_t_6; + goto __pyx_L6_bool_binop_done; + } + __pyx_t_6 = (__pyx_v_span.start == __pyx_v_ent_start); + __pyx_t_5 = __pyx_t_6; + __pyx_L6_bool_binop_done:; + if (__pyx_t_5) { + + /* "spacy/pipeline/_parser_internals/ner.pyx":577 + * for span in gold.negs[:gold.nr_neg]: + * if span.label == label and (span.end-1) == b0 and span.start == ent_start: + * cost += 1 # <<<<<<<<<<<<<< + * break + * return cost +*/ + __pyx_v_cost = (__pyx_v_cost + 1); + + /* "spacy/pipeline/_parser_internals/ner.pyx":578 + * if span.label == label and (span.end-1) == b0 and span.start == ent_start: + * cost += 1 + * break # <<<<<<<<<<<<<< + * return cost + * +*/ + goto __pyx_L4_break; + + /* "spacy/pipeline/_parser_internals/ner.pyx":576 + * # as costly. + * for span in gold.negs[:gold.nr_neg]: + * if span.label == label and (span.end-1) == b0 and span.start == ent_start: # <<<<<<<<<<<<<< + * cost += 1 + * break +*/ + } + } + __pyx_L4_break:; + + /* "spacy/pipeline/_parser_internals/ner.pyx":579 + * cost += 1 + * break + * return cost # <<<<<<<<<<<<<< + * + * +*/ + __pyx_r = __pyx_v_cost; + goto __pyx_L0; + + /* "spacy/pipeline/_parser_internals/ner.pyx":543 + * st.pop() + * + * @staticmethod # <<<<<<<<<<<<<< + * cdef weight_t cost(const StateC* s, const void* _gold, attr_t label) noexcept nogil: + * gold = _gold +*/ + + /* function exit code */ + __pyx_L0:; + return __pyx_r; +} + +/* "(tree fragment)":1 + * def __reduce_cython__(self): # <<<<<<<<<<<<<< + * cdef tuple state + * cdef object _dict +*/ + +/* Python wrapper */ +static PyObject *__pyx_pw_5spacy_8pipeline_17_parser_internals_3ner_4Last_1__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_5spacy_8pipeline_17_parser_internals_3ner_4Last___reduce_cython__, "Last.__reduce_cython__(self)"); +static PyMethodDef __pyx_mdef_5spacy_8pipeline_17_parser_internals_3ner_4Last_1__reduce_cython__ = {"__reduce_cython__", (PyCFunction)(void(*)(void))(__Pyx_PyCFunction_FastCallWithKeywords)__pyx_pw_5spacy_8pipeline_17_parser_internals_3ner_4Last_1__reduce_cython__, __Pyx_METH_FASTCALL|METH_KEYWORDS, __pyx_doc_5spacy_8pipeline_17_parser_internals_3ner_4Last___reduce_cython__}; +static PyObject *__pyx_pw_5spacy_8pipeline_17_parser_internals_3ner_4Last_1__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_5spacy_8pipeline_17_parser_internals_3ner_4Last___reduce_cython__(((struct __pyx_obj_5spacy_8pipeline_17_parser_internals_3ner_Last *)__pyx_v_self)); + + /* function exit code */ + __Pyx_RefNannyFinishContext(); + return __pyx_r; +} + +static PyObject *__pyx_pf_5spacy_8pipeline_17_parser_internals_3ner_4Last___reduce_cython__(struct __pyx_obj_5spacy_8pipeline_17_parser_internals_3ner_Last *__pyx_v_self) { + PyObject *__pyx_v_state = 0; + PyObject *__pyx_v__dict = 0; + int __pyx_v_use_setstate; + PyObject *__pyx_r = NULL; + __Pyx_RefNannyDeclarations + PyObject *__pyx_t_1 = NULL; + int __pyx_t_2; + int __pyx_t_3; + PyObject *__pyx_t_4 = NULL; + PyObject *__pyx_t_5 = NULL; + int __pyx_lineno = 0; + const char *__pyx_filename = NULL; + int __pyx_clineno = 0; + __Pyx_RefNannySetupContext("__reduce_cython__", 0); + + /* "(tree fragment)":5 + * cdef object _dict + * cdef bint use_setstate + * state = () # <<<<<<<<<<<<<< + * _dict = getattr(self, '__dict__', None) + * if _dict is not None and _dict: +*/ + __Pyx_INCREF(__pyx_mstate_global->__pyx_empty_tuple); + __pyx_v_state = __pyx_mstate_global->__pyx_empty_tuple; + + /* "(tree fragment)":6 + * cdef bint use_setstate + * state = () + * _dict = getattr(self, '__dict__', None) # <<<<<<<<<<<<<< + * if _dict is not None and _dict: + * state += (_dict,) +*/ + __pyx_t_1 = __Pyx_GetAttr3(((PyObject *)__pyx_v_self), __pyx_mstate_global->__pyx_n_u_dict, Py_None); if (unlikely(!__pyx_t_1)) __PYX_ERR(1, 6, __pyx_L1_error) + __Pyx_GOTREF(__pyx_t_1); + __pyx_v__dict = __pyx_t_1; + __pyx_t_1 = 0; + + /* "(tree fragment)":7 + * state = () + * _dict = getattr(self, '__dict__', None) + * if _dict is not None and _dict: # <<<<<<<<<<<<<< + * state += (_dict,) + * use_setstate = True +*/ + __pyx_t_3 = (__pyx_v__dict != Py_None); + if (__pyx_t_3) { + } else { + __pyx_t_2 = __pyx_t_3; + goto __pyx_L4_bool_binop_done; + } + __pyx_t_3 = __Pyx_PyObject_IsTrue(__pyx_v__dict); if (unlikely((__pyx_t_3 < 0))) __PYX_ERR(1, 7, __pyx_L1_error) + __pyx_t_2 = __pyx_t_3; + __pyx_L4_bool_binop_done:; + if (__pyx_t_2) { + + /* "(tree fragment)":8 + * _dict = getattr(self, '__dict__', None) + * if _dict is not None and _dict: + * state += (_dict,) # <<<<<<<<<<<<<< + * use_setstate = True + * else: +*/ + __pyx_t_1 = PyTuple_New(1); if (unlikely(!__pyx_t_1)) __PYX_ERR(1, 8, __pyx_L1_error) + __Pyx_GOTREF(__pyx_t_1); + __Pyx_INCREF(__pyx_v__dict); + __Pyx_GIVEREF(__pyx_v__dict); + if (__Pyx_PyTuple_SET_ITEM(__pyx_t_1, 0, __pyx_v__dict) != (0)) __PYX_ERR(1, 8, __pyx_L1_error); + __pyx_t_4 = PyNumber_InPlaceAdd(__pyx_v_state, __pyx_t_1); if (unlikely(!__pyx_t_4)) __PYX_ERR(1, 8, __pyx_L1_error) + __Pyx_GOTREF(__pyx_t_4); + __Pyx_DECREF(__pyx_t_1); __pyx_t_1 = 0; + __Pyx_DECREF_SET(__pyx_v_state, ((PyObject*)__pyx_t_4)); + __pyx_t_4 = 0; + + /* "(tree fragment)":9 + * if _dict is not None and _dict: + * state += (_dict,) + * use_setstate = True # <<<<<<<<<<<<<< + * else: + * use_setstate = ('False',) +*/ + __pyx_v_use_setstate = 1; + + /* "(tree fragment)":7 + * state = () + * _dict = getattr(self, '__dict__', None) + * if _dict is not None and _dict: # <<<<<<<<<<<<<< + * state += (_dict,) + * use_setstate = True +*/ + goto __pyx_L3; + } + + /* "(tree fragment)":11 + * use_setstate = True + * else: + * use_setstate = ('False',) # <<<<<<<<<<<<<< + * if use_setstate: + * return __pyx_unpickle_Last, (type(self), 0xe3b0c44, None), state +*/ + /*else*/ { + __pyx_t_2 = __Pyx_PyObject_IsTrue(__pyx_mstate_global->__pyx_tuple[2]); if (unlikely((__pyx_t_2 == (int)-1) && PyErr_Occurred())) __PYX_ERR(1, 11, __pyx_L1_error) + __pyx_v_use_setstate = __pyx_t_2; + } + __pyx_L3:; + + /* "(tree fragment)":12 + * else: + * use_setstate = ('False',) + * if use_setstate: # <<<<<<<<<<<<<< + * return __pyx_unpickle_Last, (type(self), 0xe3b0c44, None), state + * else: +*/ + if (__pyx_v_use_setstate) { + + /* "(tree fragment)":13 + * use_setstate = ('False',) + * if use_setstate: + * return __pyx_unpickle_Last, (type(self), 0xe3b0c44, None), state # <<<<<<<<<<<<<< + * else: + * return __pyx_unpickle_Last, (type(self), 0xe3b0c44, state) +*/ + __Pyx_XDECREF(__pyx_r); + __Pyx_GetModuleGlobalName(__pyx_t_4, __pyx_mstate_global->__pyx_n_u_pyx_unpickle_Last); if (unlikely(!__pyx_t_4)) __PYX_ERR(1, 13, __pyx_L1_error) + __Pyx_GOTREF(__pyx_t_4); + __pyx_t_1 = PyTuple_New(3); if (unlikely(!__pyx_t_1)) __PYX_ERR(1, 13, __pyx_L1_error) + __Pyx_GOTREF(__pyx_t_1); + __Pyx_INCREF(((PyObject *)Py_TYPE(((PyObject *)__pyx_v_self)))); + __Pyx_GIVEREF(((PyObject *)Py_TYPE(((PyObject *)__pyx_v_self)))); + if (__Pyx_PyTuple_SET_ITEM(__pyx_t_1, 0, ((PyObject *)Py_TYPE(((PyObject *)__pyx_v_self)))) != (0)) __PYX_ERR(1, 13, __pyx_L1_error); + __Pyx_INCREF(__pyx_mstate_global->__pyx_int_238750788); + __Pyx_GIVEREF(__pyx_mstate_global->__pyx_int_238750788); + if (__Pyx_PyTuple_SET_ITEM(__pyx_t_1, 1, __pyx_mstate_global->__pyx_int_238750788) != (0)) __PYX_ERR(1, 13, __pyx_L1_error); + __Pyx_INCREF(Py_None); + __Pyx_GIVEREF(Py_None); + if (__Pyx_PyTuple_SET_ITEM(__pyx_t_1, 2, Py_None) != (0)) __PYX_ERR(1, 13, __pyx_L1_error); + __pyx_t_5 = PyTuple_New(3); if (unlikely(!__pyx_t_5)) __PYX_ERR(1, 13, __pyx_L1_error) + __Pyx_GOTREF(__pyx_t_5); + __Pyx_GIVEREF(__pyx_t_4); + if (__Pyx_PyTuple_SET_ITEM(__pyx_t_5, 0, __pyx_t_4) != (0)) __PYX_ERR(1, 13, __pyx_L1_error); + __Pyx_GIVEREF(__pyx_t_1); + if (__Pyx_PyTuple_SET_ITEM(__pyx_t_5, 1, __pyx_t_1) != (0)) __PYX_ERR(1, 13, __pyx_L1_error); + __Pyx_INCREF(__pyx_v_state); + __Pyx_GIVEREF(__pyx_v_state); + if (__Pyx_PyTuple_SET_ITEM(__pyx_t_5, 2, __pyx_v_state) != (0)) __PYX_ERR(1, 13, __pyx_L1_error); + __pyx_t_4 = 0; + __pyx_t_1 = 0; + __pyx_r = __pyx_t_5; + __pyx_t_5 = 0; + goto __pyx_L0; + + /* "(tree fragment)":12 + * else: + * use_setstate = ('False',) + * if use_setstate: # <<<<<<<<<<<<<< + * return __pyx_unpickle_Last, (type(self), 0xe3b0c44, None), state + * else: +*/ + } + + /* "(tree fragment)":15 + * return __pyx_unpickle_Last, (type(self), 0xe3b0c44, None), state + * else: + * return __pyx_unpickle_Last, (type(self), 0xe3b0c44, state) # <<<<<<<<<<<<<< + * def __setstate_cython__(self, __pyx_state): + * __pyx_unpickle_Last__set_state(self, __pyx_state) +*/ + /*else*/ { + __Pyx_XDECREF(__pyx_r); + __Pyx_GetModuleGlobalName(__pyx_t_5, __pyx_mstate_global->__pyx_n_u_pyx_unpickle_Last); if (unlikely(!__pyx_t_5)) __PYX_ERR(1, 15, __pyx_L1_error) + __Pyx_GOTREF(__pyx_t_5); + __pyx_t_1 = PyTuple_New(3); if (unlikely(!__pyx_t_1)) __PYX_ERR(1, 15, __pyx_L1_error) + __Pyx_GOTREF(__pyx_t_1); + __Pyx_INCREF(((PyObject *)Py_TYPE(((PyObject *)__pyx_v_self)))); + __Pyx_GIVEREF(((PyObject *)Py_TYPE(((PyObject *)__pyx_v_self)))); + if (__Pyx_PyTuple_SET_ITEM(__pyx_t_1, 0, ((PyObject *)Py_TYPE(((PyObject *)__pyx_v_self)))) != (0)) __PYX_ERR(1, 15, __pyx_L1_error); + __Pyx_INCREF(__pyx_mstate_global->__pyx_int_238750788); + __Pyx_GIVEREF(__pyx_mstate_global->__pyx_int_238750788); + if (__Pyx_PyTuple_SET_ITEM(__pyx_t_1, 1, __pyx_mstate_global->__pyx_int_238750788) != (0)) __PYX_ERR(1, 15, __pyx_L1_error); + __Pyx_INCREF(__pyx_v_state); + __Pyx_GIVEREF(__pyx_v_state); + if (__Pyx_PyTuple_SET_ITEM(__pyx_t_1, 2, __pyx_v_state) != (0)) __PYX_ERR(1, 15, __pyx_L1_error); + __pyx_t_4 = PyTuple_New(2); if (unlikely(!__pyx_t_4)) __PYX_ERR(1, 15, __pyx_L1_error) + __Pyx_GOTREF(__pyx_t_4); + __Pyx_GIVEREF(__pyx_t_5); + if (__Pyx_PyTuple_SET_ITEM(__pyx_t_4, 0, __pyx_t_5) != (0)) __PYX_ERR(1, 15, __pyx_L1_error); + __Pyx_GIVEREF(__pyx_t_1); + if (__Pyx_PyTuple_SET_ITEM(__pyx_t_4, 1, __pyx_t_1) != (0)) __PYX_ERR(1, 15, __pyx_L1_error); + __pyx_t_5 = 0; + __pyx_t_1 = 0; + __pyx_r = __pyx_t_4; + __pyx_t_4 = 0; + goto __pyx_L0; + } + + /* "(tree fragment)":1 + * def __reduce_cython__(self): # <<<<<<<<<<<<<< + * cdef tuple state + * cdef object _dict +*/ + + /* function exit code */ + __pyx_L1_error:; + __Pyx_XDECREF(__pyx_t_1); + __Pyx_XDECREF(__pyx_t_4); + __Pyx_XDECREF(__pyx_t_5); + __Pyx_AddTraceback("spacy.pipeline._parser_internals.ner.Last.__reduce_cython__", __pyx_clineno, __pyx_lineno, __pyx_filename); + __pyx_r = NULL; + __pyx_L0:; + __Pyx_XDECREF(__pyx_v_state); + __Pyx_XDECREF(__pyx_v__dict); + __Pyx_XGIVEREF(__pyx_r); + __Pyx_RefNannyFinishContext(); + return __pyx_r; +} + +/* "(tree fragment)":16 + * else: + * return __pyx_unpickle_Last, (type(self), 0xe3b0c44, state) + * def __setstate_cython__(self, __pyx_state): # <<<<<<<<<<<<<< + * __pyx_unpickle_Last__set_state(self, __pyx_state) +*/ + +/* Python wrapper */ +static PyObject *__pyx_pw_5spacy_8pipeline_17_parser_internals_3ner_4Last_3__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_5spacy_8pipeline_17_parser_internals_3ner_4Last_2__setstate_cython__, "Last.__setstate_cython__(self, __pyx_state)"); +static PyMethodDef __pyx_mdef_5spacy_8pipeline_17_parser_internals_3ner_4Last_3__setstate_cython__ = {"__setstate_cython__", (PyCFunction)(void(*)(void))(__Pyx_PyCFunction_FastCallWithKeywords)__pyx_pw_5spacy_8pipeline_17_parser_internals_3ner_4Last_3__setstate_cython__, __Pyx_METH_FASTCALL|METH_KEYWORDS, __pyx_doc_5spacy_8pipeline_17_parser_internals_3ner_4Last_2__setstate_cython__}; +static PyObject *__pyx_pw_5spacy_8pipeline_17_parser_internals_3ner_4Last_3__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 +) { + 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, 16, __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, 16, __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, 16, __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, 16, __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, 16, __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, 16, __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("spacy.pipeline._parser_internals.ner.Last.__setstate_cython__", __pyx_clineno, __pyx_lineno, __pyx_filename); + __Pyx_RefNannyFinishContext(); + return NULL; + __pyx_L4_argument_unpacking_done:; + __pyx_r = __pyx_pf_5spacy_8pipeline_17_parser_internals_3ner_4Last_2__setstate_cython__(((struct __pyx_obj_5spacy_8pipeline_17_parser_internals_3ner_Last *)__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_5spacy_8pipeline_17_parser_internals_3ner_4Last_2__setstate_cython__(struct __pyx_obj_5spacy_8pipeline_17_parser_internals_3ner_Last *__pyx_v_self, PyObject *__pyx_v___pyx_state) { + PyObject *__pyx_r = NULL; + __Pyx_RefNannyDeclarations + PyObject *__pyx_t_1 = NULL; + int __pyx_lineno = 0; + const char *__pyx_filename = NULL; + int __pyx_clineno = 0; + __Pyx_RefNannySetupContext("__setstate_cython__", 0); + + /* "(tree fragment)":17 + * return __pyx_unpickle_Last, (type(self), 0xe3b0c44, state) + * def __setstate_cython__(self, __pyx_state): + * __pyx_unpickle_Last__set_state(self, __pyx_state) # <<<<<<<<<<<<<< +*/ + __pyx_t_1 = __pyx_f_5spacy_8pipeline_17_parser_internals_3ner___pyx_unpickle_Last__set_state(__pyx_v_self, __pyx_v___pyx_state); if (unlikely(!__pyx_t_1)) __PYX_ERR(1, 17, __pyx_L1_error) + __Pyx_GOTREF(__pyx_t_1); + __Pyx_DECREF(__pyx_t_1); __pyx_t_1 = 0; + + /* "(tree fragment)":16 + * else: + * return __pyx_unpickle_Last, (type(self), 0xe3b0c44, state) + * def __setstate_cython__(self, __pyx_state): # <<<<<<<<<<<<<< + * __pyx_unpickle_Last__set_state(self, __pyx_state) +*/ + + /* function exit code */ + __pyx_r = Py_None; __Pyx_INCREF(Py_None); + goto __pyx_L0; + __pyx_L1_error:; + __Pyx_XDECREF(__pyx_t_1); + __Pyx_AddTraceback("spacy.pipeline._parser_internals.ner.Last.__setstate_cython__", __pyx_clineno, __pyx_lineno, __pyx_filename); + __pyx_r = NULL; + __pyx_L0:; + __Pyx_XGIVEREF(__pyx_r); + __Pyx_RefNannyFinishContext(); + return __pyx_r; +} + +/* "spacy/pipeline/_parser_internals/ner.pyx":583 + * + * cdef class Unit: + * @staticmethod # <<<<<<<<<<<<<< + * cdef bint is_valid(const StateC* st, attr_t label) noexcept nogil: + * cdef int preset_ent_iob = st.B_(0).ent_iob +*/ + +static int __pyx_f_5spacy_8pipeline_17_parser_internals_3ner_4Unit_is_valid(__pyx_t_5spacy_8pipeline_17_parser_internals_6_state_StateC const *__pyx_v_st, __pyx_t_5spacy_8typedefs_attr_t __pyx_v_label) { + int __pyx_v_preset_ent_iob; + __pyx_t_5spacy_8typedefs_attr_t __pyx_v_preset_ent_label; + int __pyx_r; + int __pyx_t_1; + __pyx_t_5spacy_8typedefs_attr_t __pyx_t_2; + int __pyx_t_3; + int __pyx_t_4; + + /* "spacy/pipeline/_parser_internals/ner.pyx":585 + * @staticmethod + * cdef bint is_valid(const StateC* st, attr_t label) noexcept nogil: + * cdef int preset_ent_iob = st.B_(0).ent_iob # <<<<<<<<<<<<<< + * cdef attr_t preset_ent_label = st.B_(0).ent_type + * if label == 0: +*/ + __pyx_t_1 = __pyx_v_st->B_(0)->ent_iob; + __pyx_v_preset_ent_iob = __pyx_t_1; + + /* "spacy/pipeline/_parser_internals/ner.pyx":586 + * cdef bint is_valid(const StateC* st, attr_t label) noexcept nogil: + * cdef int preset_ent_iob = st.B_(0).ent_iob + * cdef attr_t preset_ent_label = st.B_(0).ent_type # <<<<<<<<<<<<<< + * if label == 0: + * # this is only allowed if it's a preset blocked annotation +*/ + __pyx_t_2 = __pyx_v_st->B_(0)->ent_type; + __pyx_v_preset_ent_label = __pyx_t_2; + + /* "spacy/pipeline/_parser_internals/ner.pyx":587 + * cdef int preset_ent_iob = st.B_(0).ent_iob + * cdef attr_t preset_ent_label = st.B_(0).ent_type + * if label == 0: # <<<<<<<<<<<<<< + * # this is only allowed if it's a preset blocked annotation + * if preset_ent_label == 0 and preset_ent_iob == 3: +*/ + __pyx_t_3 = (__pyx_v_label == 0); + if (__pyx_t_3) { + + /* "spacy/pipeline/_parser_internals/ner.pyx":589 + * if label == 0: + * # this is only allowed if it's a preset blocked annotation + * if preset_ent_label == 0 and preset_ent_iob == 3: # <<<<<<<<<<<<<< + * return True + * else: +*/ + __pyx_t_4 = (__pyx_v_preset_ent_label == 0); + if (__pyx_t_4) { + } else { + __pyx_t_3 = __pyx_t_4; + goto __pyx_L5_bool_binop_done; + } + __pyx_t_4 = (__pyx_v_preset_ent_iob == 3); + __pyx_t_3 = __pyx_t_4; + __pyx_L5_bool_binop_done:; + if (__pyx_t_3) { + + /* "spacy/pipeline/_parser_internals/ner.pyx":590 + * # this is only allowed if it's a preset blocked annotation + * if preset_ent_label == 0 and preset_ent_iob == 3: + * return True # <<<<<<<<<<<<<< + * else: + * return False +*/ + __pyx_r = 1; + goto __pyx_L0; + + /* "spacy/pipeline/_parser_internals/ner.pyx":589 + * if label == 0: + * # this is only allowed if it's a preset blocked annotation + * if preset_ent_label == 0 and preset_ent_iob == 3: # <<<<<<<<<<<<<< + * return True + * else: +*/ + } + + /* "spacy/pipeline/_parser_internals/ner.pyx":592 + * return True + * else: + * return False # <<<<<<<<<<<<<< + * elif st.entity_is_open(): + * return False +*/ + /*else*/ { + __pyx_r = 0; + goto __pyx_L0; + } + + /* "spacy/pipeline/_parser_internals/ner.pyx":587 + * cdef int preset_ent_iob = st.B_(0).ent_iob + * cdef attr_t preset_ent_label = st.B_(0).ent_type + * if label == 0: # <<<<<<<<<<<<<< + * # this is only allowed if it's a preset blocked annotation + * if preset_ent_label == 0 and preset_ent_iob == 3: +*/ + } + + /* "spacy/pipeline/_parser_internals/ner.pyx":593 + * else: + * return False + * elif st.entity_is_open(): # <<<<<<<<<<<<<< + * return False + * elif st.B_(1).ent_iob == 1: +*/ + __pyx_t_3 = __pyx_v_st->entity_is_open(); + if (__pyx_t_3) { + + /* "spacy/pipeline/_parser_internals/ner.pyx":594 + * return False + * elif st.entity_is_open(): + * return False # <<<<<<<<<<<<<< + * elif st.B_(1).ent_iob == 1: + * # If next token is In, we can't be Unit -- must be Begin +*/ + __pyx_r = 0; + goto __pyx_L0; + + /* "spacy/pipeline/_parser_internals/ner.pyx":593 + * else: + * return False + * elif st.entity_is_open(): # <<<<<<<<<<<<<< + * return False + * elif st.B_(1).ent_iob == 1: +*/ + } + + /* "spacy/pipeline/_parser_internals/ner.pyx":595 + * elif st.entity_is_open(): + * return False + * elif st.B_(1).ent_iob == 1: # <<<<<<<<<<<<<< + * # If next token is In, we can't be Unit -- must be Begin + * return False +*/ + __pyx_t_3 = (__pyx_v_st->B_(1)->ent_iob == 1); + if (__pyx_t_3) { + + /* "spacy/pipeline/_parser_internals/ner.pyx":597 + * elif st.B_(1).ent_iob == 1: + * # If next token is In, we can't be Unit -- must be Begin + * return False # <<<<<<<<<<<<<< + * elif preset_ent_iob == 3: + * # Okay, there's a preset entity here +*/ + __pyx_r = 0; + goto __pyx_L0; + + /* "spacy/pipeline/_parser_internals/ner.pyx":595 + * elif st.entity_is_open(): + * return False + * elif st.B_(1).ent_iob == 1: # <<<<<<<<<<<<<< + * # If next token is In, we can't be Unit -- must be Begin + * return False +*/ + } + + /* "spacy/pipeline/_parser_internals/ner.pyx":598 + * # If next token is In, we can't be Unit -- must be Begin + * return False + * elif preset_ent_iob == 3: # <<<<<<<<<<<<<< + * # Okay, there's a preset entity here + * if label != preset_ent_label: +*/ + __pyx_t_3 = (__pyx_v_preset_ent_iob == 3); + if (__pyx_t_3) { + + /* "spacy/pipeline/_parser_internals/ner.pyx":600 + * elif preset_ent_iob == 3: + * # Okay, there's a preset entity here + * if label != preset_ent_label: # <<<<<<<<<<<<<< + * # Require labels to match + * return False +*/ + __pyx_t_3 = (__pyx_v_label != __pyx_v_preset_ent_label); + if (__pyx_t_3) { + + /* "spacy/pipeline/_parser_internals/ner.pyx":602 + * if label != preset_ent_label: + * # Require labels to match + * return False # <<<<<<<<<<<<<< + * else: + * # Otherwise return True, ignoring the whitespace constraint. +*/ + __pyx_r = 0; + goto __pyx_L0; + + /* "spacy/pipeline/_parser_internals/ner.pyx":600 + * elif preset_ent_iob == 3: + * # Okay, there's a preset entity here + * if label != preset_ent_label: # <<<<<<<<<<<<<< + * # Require labels to match + * return False +*/ + } + + /* "spacy/pipeline/_parser_internals/ner.pyx":605 + * else: + * # Otherwise return True, ignoring the whitespace constraint. + * return True # <<<<<<<<<<<<<< + * elif Lexeme.get_struct_attr(st.B_(0).lex, IS_SPACE): + * return False +*/ + /*else*/ { + __pyx_r = 1; + goto __pyx_L0; + } + + /* "spacy/pipeline/_parser_internals/ner.pyx":598 + * # If next token is In, we can't be Unit -- must be Begin + * return False + * elif preset_ent_iob == 3: # <<<<<<<<<<<<<< + * # Okay, there's a preset entity here + * if label != preset_ent_label: +*/ + } + + /* "spacy/pipeline/_parser_internals/ner.pyx":606 + * # Otherwise return True, ignoring the whitespace constraint. + * return True + * elif Lexeme.get_struct_attr(st.B_(0).lex, IS_SPACE): # <<<<<<<<<<<<<< + * return False + * else: +*/ + __pyx_t_3 = (__pyx_f_5spacy_6lexeme_6Lexeme_get_struct_attr(__pyx_v_st->B_(0)->lex, __pyx_e_5spacy_5attrs_IS_SPACE) != 0); + if (__pyx_t_3) { + + /* "spacy/pipeline/_parser_internals/ner.pyx":607 + * return True + * elif Lexeme.get_struct_attr(st.B_(0).lex, IS_SPACE): + * return False # <<<<<<<<<<<<<< + * else: + * return True +*/ + __pyx_r = 0; + goto __pyx_L0; + + /* "spacy/pipeline/_parser_internals/ner.pyx":606 + * # Otherwise return True, ignoring the whitespace constraint. + * return True + * elif Lexeme.get_struct_attr(st.B_(0).lex, IS_SPACE): # <<<<<<<<<<<<<< + * return False + * else: +*/ + } + + /* "spacy/pipeline/_parser_internals/ner.pyx":609 + * return False + * else: + * return True # <<<<<<<<<<<<<< + * + * @staticmethod +*/ + /*else*/ { + __pyx_r = 1; + goto __pyx_L0; + } + + /* "spacy/pipeline/_parser_internals/ner.pyx":583 + * + * cdef class Unit: + * @staticmethod # <<<<<<<<<<<<<< + * cdef bint is_valid(const StateC* st, attr_t label) noexcept nogil: + * cdef int preset_ent_iob = st.B_(0).ent_iob +*/ + + /* function exit code */ + __pyx_L0:; + return __pyx_r; +} + +/* "spacy/pipeline/_parser_internals/ner.pyx":611 + * return True + * + * @staticmethod # <<<<<<<<<<<<<< + * cdef int transition(StateC* st, attr_t label) noexcept nogil: + * st.open_ent(label) +*/ + +static int __pyx_f_5spacy_8pipeline_17_parser_internals_3ner_4Unit_transition(__pyx_t_5spacy_8pipeline_17_parser_internals_6_state_StateC *__pyx_v_st, __pyx_t_5spacy_8typedefs_attr_t __pyx_v_label) { + int __pyx_r; + + /* "spacy/pipeline/_parser_internals/ner.pyx":613 + * @staticmethod + * cdef int transition(StateC* st, attr_t label) noexcept nogil: + * st.open_ent(label) # <<<<<<<<<<<<<< + * st.close_ent() + * st.push() +*/ + __pyx_v_st->open_ent(__pyx_v_label); + + /* "spacy/pipeline/_parser_internals/ner.pyx":614 + * cdef int transition(StateC* st, attr_t label) noexcept nogil: + * st.open_ent(label) + * st.close_ent() # <<<<<<<<<<<<<< + * st.push() + * st.pop() +*/ + __pyx_v_st->close_ent(); + + /* "spacy/pipeline/_parser_internals/ner.pyx":615 + * st.open_ent(label) + * st.close_ent() + * st.push() # <<<<<<<<<<<<<< + * st.pop() + * +*/ + __pyx_v_st->push(); + + /* "spacy/pipeline/_parser_internals/ner.pyx":616 + * st.close_ent() + * st.push() + * st.pop() # <<<<<<<<<<<<<< + * + * @staticmethod +*/ + __pyx_v_st->pop(); + + /* "spacy/pipeline/_parser_internals/ner.pyx":611 + * return True + * + * @staticmethod # <<<<<<<<<<<<<< + * cdef int transition(StateC* st, attr_t label) noexcept nogil: + * st.open_ent(label) +*/ + + /* function exit code */ + __pyx_r = 0; + return __pyx_r; +} + +/* "spacy/pipeline/_parser_internals/ner.pyx":618 + * st.pop() + * + * @staticmethod # <<<<<<<<<<<<<< + * cdef weight_t cost(const StateC* s, const void* _gold, attr_t label) noexcept nogil: + * gold = _gold +*/ + +static __pyx_t_5spacy_8typedefs_weight_t __pyx_f_5spacy_8pipeline_17_parser_internals_3ner_4Unit_cost(__pyx_t_5spacy_8pipeline_17_parser_internals_6_state_StateC const *__pyx_v_s, void const *__pyx_v__gold, __pyx_t_5spacy_8typedefs_attr_t __pyx_v_label) { + struct __pyx_t_5spacy_8pipeline_17_parser_internals_3ner_GoldNERStateC *__pyx_v_gold; + int __pyx_v_g_act; + __pyx_t_5spacy_8typedefs_attr_t __pyx_v_g_tag; + int __pyx_v_cost; + int __pyx_v_b0; + struct __pyx_t_5spacy_7structs_SpanC __pyx_v_span; + __pyx_t_5spacy_8typedefs_weight_t __pyx_r; + int __pyx_t_1; + __pyx_t_5spacy_8typedefs_attr_t __pyx_t_2; + struct __pyx_t_5spacy_7structs_SpanC *__pyx_t_3; + struct __pyx_t_5spacy_7structs_SpanC *__pyx_t_4; + struct __pyx_t_5spacy_7structs_SpanC *__pyx_t_5; + int __pyx_t_6; + int __pyx_t_7; + + /* "spacy/pipeline/_parser_internals/ner.pyx":620 + * @staticmethod + * cdef weight_t cost(const StateC* s, const void* _gold, attr_t label) noexcept nogil: + * gold = _gold # <<<<<<<<<<<<<< + * cdef int g_act = gold.ner[s.B(0)].move + * cdef attr_t g_tag = gold.ner[s.B(0)].label +*/ + __pyx_v_gold = ((struct __pyx_t_5spacy_8pipeline_17_parser_internals_3ner_GoldNERStateC *)__pyx_v__gold); + + /* "spacy/pipeline/_parser_internals/ner.pyx":621 + * cdef weight_t cost(const StateC* s, const void* _gold, attr_t label) noexcept nogil: + * gold = _gold + * cdef int g_act = gold.ner[s.B(0)].move # <<<<<<<<<<<<<< + * cdef attr_t g_tag = gold.ner[s.B(0)].label + * cdef int cost = 0 +*/ + __pyx_t_1 = (__pyx_v_gold->ner[__pyx_v_s->B(0)]).move; + __pyx_v_g_act = __pyx_t_1; + + /* "spacy/pipeline/_parser_internals/ner.pyx":622 + * gold = _gold + * cdef int g_act = gold.ner[s.B(0)].move + * cdef attr_t g_tag = gold.ner[s.B(0)].label # <<<<<<<<<<<<<< + * cdef int cost = 0 + * +*/ + __pyx_t_2 = (__pyx_v_gold->ner[__pyx_v_s->B(0)]).label; + __pyx_v_g_tag = __pyx_t_2; + + /* "spacy/pipeline/_parser_internals/ner.pyx":623 + * cdef int g_act = gold.ner[s.B(0)].move + * cdef attr_t g_tag = gold.ner[s.B(0)].label + * cdef int cost = 0 # <<<<<<<<<<<<<< + * + * if g_act == MISSING: +*/ + __pyx_v_cost = 0; + + /* "spacy/pipeline/_parser_internals/ner.pyx":625 + * cdef int cost = 0 + * + * if g_act == MISSING: # <<<<<<<<<<<<<< + * pass + * elif g_act == UNIT: +*/ + switch (__pyx_v_g_act) { + case __pyx_e_5spacy_8pipeline_17_parser_internals_3ner_MISSING: + break; + case __pyx_e_5spacy_8pipeline_17_parser_internals_3ner_UNIT: + + /* "spacy/pipeline/_parser_internals/ner.pyx":629 + * elif g_act == UNIT: + * # U, Gold U --> True iff tag match + * cost += label != g_tag # <<<<<<<<<<<<<< + * else: + * # U, Gold B --> False +*/ + __pyx_v_cost = (__pyx_v_cost + (__pyx_v_label != __pyx_v_g_tag)); + + /* "spacy/pipeline/_parser_internals/ner.pyx":627 + * if g_act == MISSING: + * pass + * elif g_act == UNIT: # <<<<<<<<<<<<<< + * # U, Gold U --> True iff tag match + * cost += label != g_tag +*/ + break; + default: + + /* "spacy/pipeline/_parser_internals/ner.pyx":635 + * # U, Gold L --> False + * # U, Gold O --> False + * cost += 1 # <<<<<<<<<<<<<< + * # If we have negative-example entities, integrate them into the objective. + * # This is fairly straight-forward for U- entities, as we have a single +*/ + __pyx_v_cost = (__pyx_v_cost + 1); + break; + } + + /* "spacy/pipeline/_parser_internals/ner.pyx":639 + * # This is fairly straight-forward for U- entities, as we have a single + * # action + * cdef int b0 = s.B(0) # <<<<<<<<<<<<<< + * for span in gold.negs[:gold.nr_neg]: + * if span.label == label and span.start == b0 and span.end == (b0+1): +*/ + __pyx_v_b0 = __pyx_v_s->B(0); + + /* "spacy/pipeline/_parser_internals/ner.pyx":640 + * # action + * cdef int b0 = s.B(0) + * for span in gold.negs[:gold.nr_neg]: # <<<<<<<<<<<<<< + * if span.label == label and span.start == b0 and span.end == (b0+1): + * cost += 1 +*/ + __pyx_t_4 = (__pyx_v_gold->negs + __pyx_v_gold->nr_neg); + for (__pyx_t_5 = __pyx_v_gold->negs; __pyx_t_5 < __pyx_t_4; __pyx_t_5++) { + __pyx_t_3 = __pyx_t_5; + __pyx_v_span = (__pyx_t_3[0]); + + /* "spacy/pipeline/_parser_internals/ner.pyx":641 + * cdef int b0 = s.B(0) + * for span in gold.negs[:gold.nr_neg]: + * if span.label == label and span.start == b0 and span.end == (b0+1): # <<<<<<<<<<<<<< + * cost += 1 + * break +*/ + __pyx_t_7 = (__pyx_v_span.label == __pyx_v_label); + if (__pyx_t_7) { + } else { + __pyx_t_6 = __pyx_t_7; + goto __pyx_L6_bool_binop_done; + } + __pyx_t_7 = (__pyx_v_span.start == __pyx_v_b0); + if (__pyx_t_7) { + } else { + __pyx_t_6 = __pyx_t_7; + goto __pyx_L6_bool_binop_done; + } + __pyx_t_7 = (__pyx_v_span.end == (__pyx_v_b0 + 1)); + __pyx_t_6 = __pyx_t_7; + __pyx_L6_bool_binop_done:; + if (__pyx_t_6) { + + /* "spacy/pipeline/_parser_internals/ner.pyx":642 + * for span in gold.negs[:gold.nr_neg]: + * if span.label == label and span.start == b0 and span.end == (b0+1): + * cost += 1 # <<<<<<<<<<<<<< + * break + * return cost +*/ + __pyx_v_cost = (__pyx_v_cost + 1); + + /* "spacy/pipeline/_parser_internals/ner.pyx":643 + * if span.label == label and span.start == b0 and span.end == (b0+1): + * cost += 1 + * break # <<<<<<<<<<<<<< + * return cost + * +*/ + goto __pyx_L4_break; + + /* "spacy/pipeline/_parser_internals/ner.pyx":641 + * cdef int b0 = s.B(0) + * for span in gold.negs[:gold.nr_neg]: + * if span.label == label and span.start == b0 and span.end == (b0+1): # <<<<<<<<<<<<<< + * cost += 1 + * break +*/ + } + } + __pyx_L4_break:; + + /* "spacy/pipeline/_parser_internals/ner.pyx":644 + * cost += 1 + * break + * return cost # <<<<<<<<<<<<<< + * + * +*/ + __pyx_r = __pyx_v_cost; + goto __pyx_L0; + + /* "spacy/pipeline/_parser_internals/ner.pyx":618 + * st.pop() + * + * @staticmethod # <<<<<<<<<<<<<< + * cdef weight_t cost(const StateC* s, const void* _gold, attr_t label) noexcept nogil: + * gold = _gold +*/ + + /* function exit code */ + __pyx_L0:; + return __pyx_r; +} + +/* "(tree fragment)":1 + * def __reduce_cython__(self): # <<<<<<<<<<<<<< + * cdef tuple state + * cdef object _dict +*/ + +/* Python wrapper */ +static PyObject *__pyx_pw_5spacy_8pipeline_17_parser_internals_3ner_4Unit_1__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_5spacy_8pipeline_17_parser_internals_3ner_4Unit___reduce_cython__, "Unit.__reduce_cython__(self)"); +static PyMethodDef __pyx_mdef_5spacy_8pipeline_17_parser_internals_3ner_4Unit_1__reduce_cython__ = {"__reduce_cython__", (PyCFunction)(void(*)(void))(__Pyx_PyCFunction_FastCallWithKeywords)__pyx_pw_5spacy_8pipeline_17_parser_internals_3ner_4Unit_1__reduce_cython__, __Pyx_METH_FASTCALL|METH_KEYWORDS, __pyx_doc_5spacy_8pipeline_17_parser_internals_3ner_4Unit___reduce_cython__}; +static PyObject *__pyx_pw_5spacy_8pipeline_17_parser_internals_3ner_4Unit_1__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_5spacy_8pipeline_17_parser_internals_3ner_4Unit___reduce_cython__(((struct __pyx_obj_5spacy_8pipeline_17_parser_internals_3ner_Unit *)__pyx_v_self)); + + /* function exit code */ + __Pyx_RefNannyFinishContext(); + return __pyx_r; +} + +static PyObject *__pyx_pf_5spacy_8pipeline_17_parser_internals_3ner_4Unit___reduce_cython__(struct __pyx_obj_5spacy_8pipeline_17_parser_internals_3ner_Unit *__pyx_v_self) { + PyObject *__pyx_v_state = 0; + PyObject *__pyx_v__dict = 0; + int __pyx_v_use_setstate; + PyObject *__pyx_r = NULL; + __Pyx_RefNannyDeclarations + PyObject *__pyx_t_1 = NULL; + int __pyx_t_2; + int __pyx_t_3; + PyObject *__pyx_t_4 = NULL; + PyObject *__pyx_t_5 = NULL; + int __pyx_lineno = 0; + const char *__pyx_filename = NULL; + int __pyx_clineno = 0; + __Pyx_RefNannySetupContext("__reduce_cython__", 0); + + /* "(tree fragment)":5 + * cdef object _dict + * cdef bint use_setstate + * state = () # <<<<<<<<<<<<<< + * _dict = getattr(self, '__dict__', None) + * if _dict is not None and _dict: +*/ + __Pyx_INCREF(__pyx_mstate_global->__pyx_empty_tuple); + __pyx_v_state = __pyx_mstate_global->__pyx_empty_tuple; + + /* "(tree fragment)":6 + * cdef bint use_setstate + * state = () + * _dict = getattr(self, '__dict__', None) # <<<<<<<<<<<<<< + * if _dict is not None and _dict: + * state += (_dict,) +*/ + __pyx_t_1 = __Pyx_GetAttr3(((PyObject *)__pyx_v_self), __pyx_mstate_global->__pyx_n_u_dict, Py_None); if (unlikely(!__pyx_t_1)) __PYX_ERR(1, 6, __pyx_L1_error) + __Pyx_GOTREF(__pyx_t_1); + __pyx_v__dict = __pyx_t_1; + __pyx_t_1 = 0; + + /* "(tree fragment)":7 + * state = () + * _dict = getattr(self, '__dict__', None) + * if _dict is not None and _dict: # <<<<<<<<<<<<<< + * state += (_dict,) + * use_setstate = True +*/ + __pyx_t_3 = (__pyx_v__dict != Py_None); + if (__pyx_t_3) { + } else { + __pyx_t_2 = __pyx_t_3; + goto __pyx_L4_bool_binop_done; + } + __pyx_t_3 = __Pyx_PyObject_IsTrue(__pyx_v__dict); if (unlikely((__pyx_t_3 < 0))) __PYX_ERR(1, 7, __pyx_L1_error) + __pyx_t_2 = __pyx_t_3; + __pyx_L4_bool_binop_done:; + if (__pyx_t_2) { + + /* "(tree fragment)":8 + * _dict = getattr(self, '__dict__', None) + * if _dict is not None and _dict: + * state += (_dict,) # <<<<<<<<<<<<<< + * use_setstate = True + * else: +*/ + __pyx_t_1 = PyTuple_New(1); if (unlikely(!__pyx_t_1)) __PYX_ERR(1, 8, __pyx_L1_error) + __Pyx_GOTREF(__pyx_t_1); + __Pyx_INCREF(__pyx_v__dict); + __Pyx_GIVEREF(__pyx_v__dict); + if (__Pyx_PyTuple_SET_ITEM(__pyx_t_1, 0, __pyx_v__dict) != (0)) __PYX_ERR(1, 8, __pyx_L1_error); + __pyx_t_4 = PyNumber_InPlaceAdd(__pyx_v_state, __pyx_t_1); if (unlikely(!__pyx_t_4)) __PYX_ERR(1, 8, __pyx_L1_error) + __Pyx_GOTREF(__pyx_t_4); + __Pyx_DECREF(__pyx_t_1); __pyx_t_1 = 0; + __Pyx_DECREF_SET(__pyx_v_state, ((PyObject*)__pyx_t_4)); + __pyx_t_4 = 0; + + /* "(tree fragment)":9 + * if _dict is not None and _dict: + * state += (_dict,) + * use_setstate = True # <<<<<<<<<<<<<< + * else: + * use_setstate = ('False',) +*/ + __pyx_v_use_setstate = 1; + + /* "(tree fragment)":7 + * state = () + * _dict = getattr(self, '__dict__', None) + * if _dict is not None and _dict: # <<<<<<<<<<<<<< + * state += (_dict,) + * use_setstate = True +*/ + goto __pyx_L3; + } + + /* "(tree fragment)":11 + * use_setstate = True + * else: + * use_setstate = ('False',) # <<<<<<<<<<<<<< + * if use_setstate: + * return __pyx_unpickle_Unit, (type(self), 0xe3b0c44, None), state +*/ + /*else*/ { + __pyx_t_2 = __Pyx_PyObject_IsTrue(__pyx_mstate_global->__pyx_tuple[2]); if (unlikely((__pyx_t_2 == (int)-1) && PyErr_Occurred())) __PYX_ERR(1, 11, __pyx_L1_error) + __pyx_v_use_setstate = __pyx_t_2; + } + __pyx_L3:; + + /* "(tree fragment)":12 + * else: + * use_setstate = ('False',) + * if use_setstate: # <<<<<<<<<<<<<< + * return __pyx_unpickle_Unit, (type(self), 0xe3b0c44, None), state + * else: +*/ + if (__pyx_v_use_setstate) { + + /* "(tree fragment)":13 + * use_setstate = ('False',) + * if use_setstate: + * return __pyx_unpickle_Unit, (type(self), 0xe3b0c44, None), state # <<<<<<<<<<<<<< + * else: + * return __pyx_unpickle_Unit, (type(self), 0xe3b0c44, state) +*/ + __Pyx_XDECREF(__pyx_r); + __Pyx_GetModuleGlobalName(__pyx_t_4, __pyx_mstate_global->__pyx_n_u_pyx_unpickle_Unit); if (unlikely(!__pyx_t_4)) __PYX_ERR(1, 13, __pyx_L1_error) + __Pyx_GOTREF(__pyx_t_4); + __pyx_t_1 = PyTuple_New(3); if (unlikely(!__pyx_t_1)) __PYX_ERR(1, 13, __pyx_L1_error) + __Pyx_GOTREF(__pyx_t_1); + __Pyx_INCREF(((PyObject *)Py_TYPE(((PyObject *)__pyx_v_self)))); + __Pyx_GIVEREF(((PyObject *)Py_TYPE(((PyObject *)__pyx_v_self)))); + if (__Pyx_PyTuple_SET_ITEM(__pyx_t_1, 0, ((PyObject *)Py_TYPE(((PyObject *)__pyx_v_self)))) != (0)) __PYX_ERR(1, 13, __pyx_L1_error); + __Pyx_INCREF(__pyx_mstate_global->__pyx_int_238750788); + __Pyx_GIVEREF(__pyx_mstate_global->__pyx_int_238750788); + if (__Pyx_PyTuple_SET_ITEM(__pyx_t_1, 1, __pyx_mstate_global->__pyx_int_238750788) != (0)) __PYX_ERR(1, 13, __pyx_L1_error); + __Pyx_INCREF(Py_None); + __Pyx_GIVEREF(Py_None); + if (__Pyx_PyTuple_SET_ITEM(__pyx_t_1, 2, Py_None) != (0)) __PYX_ERR(1, 13, __pyx_L1_error); + __pyx_t_5 = PyTuple_New(3); if (unlikely(!__pyx_t_5)) __PYX_ERR(1, 13, __pyx_L1_error) + __Pyx_GOTREF(__pyx_t_5); + __Pyx_GIVEREF(__pyx_t_4); + if (__Pyx_PyTuple_SET_ITEM(__pyx_t_5, 0, __pyx_t_4) != (0)) __PYX_ERR(1, 13, __pyx_L1_error); + __Pyx_GIVEREF(__pyx_t_1); + if (__Pyx_PyTuple_SET_ITEM(__pyx_t_5, 1, __pyx_t_1) != (0)) __PYX_ERR(1, 13, __pyx_L1_error); + __Pyx_INCREF(__pyx_v_state); + __Pyx_GIVEREF(__pyx_v_state); + if (__Pyx_PyTuple_SET_ITEM(__pyx_t_5, 2, __pyx_v_state) != (0)) __PYX_ERR(1, 13, __pyx_L1_error); + __pyx_t_4 = 0; + __pyx_t_1 = 0; + __pyx_r = __pyx_t_5; + __pyx_t_5 = 0; + goto __pyx_L0; + + /* "(tree fragment)":12 + * else: + * use_setstate = ('False',) + * if use_setstate: # <<<<<<<<<<<<<< + * return __pyx_unpickle_Unit, (type(self), 0xe3b0c44, None), state + * else: +*/ + } + + /* "(tree fragment)":15 + * return __pyx_unpickle_Unit, (type(self), 0xe3b0c44, None), state + * else: + * return __pyx_unpickle_Unit, (type(self), 0xe3b0c44, state) # <<<<<<<<<<<<<< + * def __setstate_cython__(self, __pyx_state): + * __pyx_unpickle_Unit__set_state(self, __pyx_state) +*/ + /*else*/ { + __Pyx_XDECREF(__pyx_r); + __Pyx_GetModuleGlobalName(__pyx_t_5, __pyx_mstate_global->__pyx_n_u_pyx_unpickle_Unit); if (unlikely(!__pyx_t_5)) __PYX_ERR(1, 15, __pyx_L1_error) + __Pyx_GOTREF(__pyx_t_5); + __pyx_t_1 = PyTuple_New(3); if (unlikely(!__pyx_t_1)) __PYX_ERR(1, 15, __pyx_L1_error) + __Pyx_GOTREF(__pyx_t_1); + __Pyx_INCREF(((PyObject *)Py_TYPE(((PyObject *)__pyx_v_self)))); + __Pyx_GIVEREF(((PyObject *)Py_TYPE(((PyObject *)__pyx_v_self)))); + if (__Pyx_PyTuple_SET_ITEM(__pyx_t_1, 0, ((PyObject *)Py_TYPE(((PyObject *)__pyx_v_self)))) != (0)) __PYX_ERR(1, 15, __pyx_L1_error); + __Pyx_INCREF(__pyx_mstate_global->__pyx_int_238750788); + __Pyx_GIVEREF(__pyx_mstate_global->__pyx_int_238750788); + if (__Pyx_PyTuple_SET_ITEM(__pyx_t_1, 1, __pyx_mstate_global->__pyx_int_238750788) != (0)) __PYX_ERR(1, 15, __pyx_L1_error); + __Pyx_INCREF(__pyx_v_state); + __Pyx_GIVEREF(__pyx_v_state); + if (__Pyx_PyTuple_SET_ITEM(__pyx_t_1, 2, __pyx_v_state) != (0)) __PYX_ERR(1, 15, __pyx_L1_error); + __pyx_t_4 = PyTuple_New(2); if (unlikely(!__pyx_t_4)) __PYX_ERR(1, 15, __pyx_L1_error) + __Pyx_GOTREF(__pyx_t_4); + __Pyx_GIVEREF(__pyx_t_5); + if (__Pyx_PyTuple_SET_ITEM(__pyx_t_4, 0, __pyx_t_5) != (0)) __PYX_ERR(1, 15, __pyx_L1_error); + __Pyx_GIVEREF(__pyx_t_1); + if (__Pyx_PyTuple_SET_ITEM(__pyx_t_4, 1, __pyx_t_1) != (0)) __PYX_ERR(1, 15, __pyx_L1_error); + __pyx_t_5 = 0; + __pyx_t_1 = 0; + __pyx_r = __pyx_t_4; + __pyx_t_4 = 0; + goto __pyx_L0; + } + + /* "(tree fragment)":1 + * def __reduce_cython__(self): # <<<<<<<<<<<<<< + * cdef tuple state + * cdef object _dict +*/ + + /* function exit code */ + __pyx_L1_error:; + __Pyx_XDECREF(__pyx_t_1); + __Pyx_XDECREF(__pyx_t_4); + __Pyx_XDECREF(__pyx_t_5); + __Pyx_AddTraceback("spacy.pipeline._parser_internals.ner.Unit.__reduce_cython__", __pyx_clineno, __pyx_lineno, __pyx_filename); + __pyx_r = NULL; + __pyx_L0:; + __Pyx_XDECREF(__pyx_v_state); + __Pyx_XDECREF(__pyx_v__dict); + __Pyx_XGIVEREF(__pyx_r); + __Pyx_RefNannyFinishContext(); + return __pyx_r; +} + +/* "(tree fragment)":16 + * else: + * return __pyx_unpickle_Unit, (type(self), 0xe3b0c44, state) + * def __setstate_cython__(self, __pyx_state): # <<<<<<<<<<<<<< + * __pyx_unpickle_Unit__set_state(self, __pyx_state) +*/ + +/* Python wrapper */ +static PyObject *__pyx_pw_5spacy_8pipeline_17_parser_internals_3ner_4Unit_3__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_5spacy_8pipeline_17_parser_internals_3ner_4Unit_2__setstate_cython__, "Unit.__setstate_cython__(self, __pyx_state)"); +static PyMethodDef __pyx_mdef_5spacy_8pipeline_17_parser_internals_3ner_4Unit_3__setstate_cython__ = {"__setstate_cython__", (PyCFunction)(void(*)(void))(__Pyx_PyCFunction_FastCallWithKeywords)__pyx_pw_5spacy_8pipeline_17_parser_internals_3ner_4Unit_3__setstate_cython__, __Pyx_METH_FASTCALL|METH_KEYWORDS, __pyx_doc_5spacy_8pipeline_17_parser_internals_3ner_4Unit_2__setstate_cython__}; +static PyObject *__pyx_pw_5spacy_8pipeline_17_parser_internals_3ner_4Unit_3__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 +) { + 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, 16, __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, 16, __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, 16, __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, 16, __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, 16, __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, 16, __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("spacy.pipeline._parser_internals.ner.Unit.__setstate_cython__", __pyx_clineno, __pyx_lineno, __pyx_filename); + __Pyx_RefNannyFinishContext(); + return NULL; + __pyx_L4_argument_unpacking_done:; + __pyx_r = __pyx_pf_5spacy_8pipeline_17_parser_internals_3ner_4Unit_2__setstate_cython__(((struct __pyx_obj_5spacy_8pipeline_17_parser_internals_3ner_Unit *)__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_5spacy_8pipeline_17_parser_internals_3ner_4Unit_2__setstate_cython__(struct __pyx_obj_5spacy_8pipeline_17_parser_internals_3ner_Unit *__pyx_v_self, PyObject *__pyx_v___pyx_state) { + PyObject *__pyx_r = NULL; + __Pyx_RefNannyDeclarations + PyObject *__pyx_t_1 = NULL; + int __pyx_lineno = 0; + const char *__pyx_filename = NULL; + int __pyx_clineno = 0; + __Pyx_RefNannySetupContext("__setstate_cython__", 0); + + /* "(tree fragment)":17 + * return __pyx_unpickle_Unit, (type(self), 0xe3b0c44, state) + * def __setstate_cython__(self, __pyx_state): + * __pyx_unpickle_Unit__set_state(self, __pyx_state) # <<<<<<<<<<<<<< +*/ + __pyx_t_1 = __pyx_f_5spacy_8pipeline_17_parser_internals_3ner___pyx_unpickle_Unit__set_state(__pyx_v_self, __pyx_v___pyx_state); if (unlikely(!__pyx_t_1)) __PYX_ERR(1, 17, __pyx_L1_error) + __Pyx_GOTREF(__pyx_t_1); + __Pyx_DECREF(__pyx_t_1); __pyx_t_1 = 0; + + /* "(tree fragment)":16 + * else: + * return __pyx_unpickle_Unit, (type(self), 0xe3b0c44, state) + * def __setstate_cython__(self, __pyx_state): # <<<<<<<<<<<<<< + * __pyx_unpickle_Unit__set_state(self, __pyx_state) +*/ + + /* function exit code */ + __pyx_r = Py_None; __Pyx_INCREF(Py_None); + goto __pyx_L0; + __pyx_L1_error:; + __Pyx_XDECREF(__pyx_t_1); + __Pyx_AddTraceback("spacy.pipeline._parser_internals.ner.Unit.__setstate_cython__", __pyx_clineno, __pyx_lineno, __pyx_filename); + __pyx_r = NULL; + __pyx_L0:; + __Pyx_XGIVEREF(__pyx_r); + __Pyx_RefNannyFinishContext(); + return __pyx_r; +} + +/* "spacy/pipeline/_parser_internals/ner.pyx":648 + * + * cdef class Out: + * @staticmethod # <<<<<<<<<<<<<< + * cdef bint is_valid(const StateC* st, attr_t label) noexcept nogil: + * cdef int preset_ent_iob = st.B_(0).ent_iob +*/ + +static int __pyx_f_5spacy_8pipeline_17_parser_internals_3ner_3Out_is_valid(__pyx_t_5spacy_8pipeline_17_parser_internals_6_state_StateC const *__pyx_v_st, CYTHON_UNUSED __pyx_t_5spacy_8typedefs_attr_t __pyx_v_label) { + int __pyx_v_preset_ent_iob; + int __pyx_r; + int __pyx_t_1; + int __pyx_t_2; + + /* "spacy/pipeline/_parser_internals/ner.pyx":650 + * @staticmethod + * cdef bint is_valid(const StateC* st, attr_t label) noexcept nogil: + * cdef int preset_ent_iob = st.B_(0).ent_iob # <<<<<<<<<<<<<< + * if st.entity_is_open(): + * return False +*/ + __pyx_t_1 = __pyx_v_st->B_(0)->ent_iob; + __pyx_v_preset_ent_iob = __pyx_t_1; + + /* "spacy/pipeline/_parser_internals/ner.pyx":651 + * cdef bint is_valid(const StateC* st, attr_t label) noexcept nogil: + * cdef int preset_ent_iob = st.B_(0).ent_iob + * if st.entity_is_open(): # <<<<<<<<<<<<<< + * return False + * elif preset_ent_iob == 3: +*/ + __pyx_t_2 = __pyx_v_st->entity_is_open(); + if (__pyx_t_2) { + + /* "spacy/pipeline/_parser_internals/ner.pyx":652 + * cdef int preset_ent_iob = st.B_(0).ent_iob + * if st.entity_is_open(): + * return False # <<<<<<<<<<<<<< + * elif preset_ent_iob == 3: + * return False +*/ + __pyx_r = 0; + goto __pyx_L0; + + /* "spacy/pipeline/_parser_internals/ner.pyx":651 + * cdef bint is_valid(const StateC* st, attr_t label) noexcept nogil: + * cdef int preset_ent_iob = st.B_(0).ent_iob + * if st.entity_is_open(): # <<<<<<<<<<<<<< + * return False + * elif preset_ent_iob == 3: +*/ + } + + /* "spacy/pipeline/_parser_internals/ner.pyx":653 + * if st.entity_is_open(): + * return False + * elif preset_ent_iob == 3: # <<<<<<<<<<<<<< + * return False + * elif preset_ent_iob == 1: +*/ + __pyx_t_2 = (__pyx_v_preset_ent_iob == 3); + if (__pyx_t_2) { + + /* "spacy/pipeline/_parser_internals/ner.pyx":654 + * return False + * elif preset_ent_iob == 3: + * return False # <<<<<<<<<<<<<< + * elif preset_ent_iob == 1: + * return False +*/ + __pyx_r = 0; + goto __pyx_L0; + + /* "spacy/pipeline/_parser_internals/ner.pyx":653 + * if st.entity_is_open(): + * return False + * elif preset_ent_iob == 3: # <<<<<<<<<<<<<< + * return False + * elif preset_ent_iob == 1: +*/ + } + + /* "spacy/pipeline/_parser_internals/ner.pyx":655 + * elif preset_ent_iob == 3: + * return False + * elif preset_ent_iob == 1: # <<<<<<<<<<<<<< + * return False + * else: +*/ + __pyx_t_2 = (__pyx_v_preset_ent_iob == 1); + if (__pyx_t_2) { + + /* "spacy/pipeline/_parser_internals/ner.pyx":656 + * return False + * elif preset_ent_iob == 1: + * return False # <<<<<<<<<<<<<< + * else: + * return True +*/ + __pyx_r = 0; + goto __pyx_L0; + + /* "spacy/pipeline/_parser_internals/ner.pyx":655 + * elif preset_ent_iob == 3: + * return False + * elif preset_ent_iob == 1: # <<<<<<<<<<<<<< + * return False + * else: +*/ + } + + /* "spacy/pipeline/_parser_internals/ner.pyx":658 + * return False + * else: + * return True # <<<<<<<<<<<<<< + * + * @staticmethod +*/ + /*else*/ { + __pyx_r = 1; + goto __pyx_L0; + } + + /* "spacy/pipeline/_parser_internals/ner.pyx":648 + * + * cdef class Out: + * @staticmethod # <<<<<<<<<<<<<< + * cdef bint is_valid(const StateC* st, attr_t label) noexcept nogil: + * cdef int preset_ent_iob = st.B_(0).ent_iob +*/ + + /* function exit code */ + __pyx_L0:; + return __pyx_r; +} + +/* "spacy/pipeline/_parser_internals/ner.pyx":660 + * return True + * + * @staticmethod # <<<<<<<<<<<<<< + * cdef int transition(StateC* st, attr_t label) noexcept nogil: + * st.push() +*/ + +static int __pyx_f_5spacy_8pipeline_17_parser_internals_3ner_3Out_transition(__pyx_t_5spacy_8pipeline_17_parser_internals_6_state_StateC *__pyx_v_st, CYTHON_UNUSED __pyx_t_5spacy_8typedefs_attr_t __pyx_v_label) { + int __pyx_r; + + /* "spacy/pipeline/_parser_internals/ner.pyx":662 + * @staticmethod + * cdef int transition(StateC* st, attr_t label) noexcept nogil: + * st.push() # <<<<<<<<<<<<<< + * st.pop() + * +*/ + __pyx_v_st->push(); + + /* "spacy/pipeline/_parser_internals/ner.pyx":663 + * cdef int transition(StateC* st, attr_t label) noexcept nogil: + * st.push() + * st.pop() # <<<<<<<<<<<<<< + * + * @staticmethod +*/ + __pyx_v_st->pop(); + + /* "spacy/pipeline/_parser_internals/ner.pyx":660 + * return True + * + * @staticmethod # <<<<<<<<<<<<<< + * cdef int transition(StateC* st, attr_t label) noexcept nogil: + * st.push() +*/ + + /* function exit code */ + __pyx_r = 0; + return __pyx_r; +} + +/* "spacy/pipeline/_parser_internals/ner.pyx":665 + * st.pop() + * + * @staticmethod # <<<<<<<<<<<<<< + * cdef weight_t cost(const StateC* s, const void* _gold, attr_t label) noexcept nogil: + * gold = _gold +*/ + +static __pyx_t_5spacy_8typedefs_weight_t __pyx_f_5spacy_8pipeline_17_parser_internals_3ner_3Out_cost(__pyx_t_5spacy_8pipeline_17_parser_internals_6_state_StateC const *__pyx_v_s, void const *__pyx_v__gold, CYTHON_UNUSED __pyx_t_5spacy_8typedefs_attr_t __pyx_v_label) { + struct __pyx_t_5spacy_8pipeline_17_parser_internals_3ner_GoldNERStateC *__pyx_v_gold; + int __pyx_v_g_act; + __pyx_t_5spacy_8typedefs_weight_t __pyx_v_cost; + __pyx_t_5spacy_8typedefs_weight_t __pyx_r; + int __pyx_t_1; + + /* "spacy/pipeline/_parser_internals/ner.pyx":667 + * @staticmethod + * cdef weight_t cost(const StateC* s, const void* _gold, attr_t label) noexcept nogil: + * gold = _gold # <<<<<<<<<<<<<< + * cdef int g_act = gold.ner[s.B(0)].move + * cdef weight_t cost = 0 +*/ + __pyx_v_gold = ((struct __pyx_t_5spacy_8pipeline_17_parser_internals_3ner_GoldNERStateC *)__pyx_v__gold); + + /* "spacy/pipeline/_parser_internals/ner.pyx":668 + * cdef weight_t cost(const StateC* s, const void* _gold, attr_t label) noexcept nogil: + * gold = _gold + * cdef int g_act = gold.ner[s.B(0)].move # <<<<<<<<<<<<<< + * cdef weight_t cost = 0 + * if g_act == MISSING: +*/ + __pyx_t_1 = (__pyx_v_gold->ner[__pyx_v_s->B(0)]).move; + __pyx_v_g_act = __pyx_t_1; + + /* "spacy/pipeline/_parser_internals/ner.pyx":669 + * gold = _gold + * cdef int g_act = gold.ner[s.B(0)].move + * cdef weight_t cost = 0 # <<<<<<<<<<<<<< + * if g_act == MISSING: + * pass +*/ + __pyx_v_cost = 0.0; + + /* "spacy/pipeline/_parser_internals/ner.pyx":670 + * cdef int g_act = gold.ner[s.B(0)].move + * cdef weight_t cost = 0 + * if g_act == MISSING: # <<<<<<<<<<<<<< + * pass + * elif g_act == BEGIN: +*/ + switch (__pyx_v_g_act) { + case __pyx_e_5spacy_8pipeline_17_parser_internals_3ner_MISSING: + break; + case __pyx_e_5spacy_8pipeline_17_parser_internals_3ner_BEGIN: + + /* "spacy/pipeline/_parser_internals/ner.pyx":674 + * elif g_act == BEGIN: + * # O, Gold B --> False + * cost += 1 # <<<<<<<<<<<<<< + * elif g_act == IN: + * # O, Gold I --> True +*/ + __pyx_v_cost = (__pyx_v_cost + 1.0); + + /* "spacy/pipeline/_parser_internals/ner.pyx":672 + * if g_act == MISSING: + * pass + * elif g_act == BEGIN: # <<<<<<<<<<<<<< + * # O, Gold B --> False + * cost += 1 +*/ + break; + case __pyx_e_5spacy_8pipeline_17_parser_internals_3ner_IN: + + /* "spacy/pipeline/_parser_internals/ner.pyx":675 + * # O, Gold B --> False + * cost += 1 + * elif g_act == IN: # <<<<<<<<<<<<<< + * # O, Gold I --> True + * pass +*/ + break; + case __pyx_e_5spacy_8pipeline_17_parser_internals_3ner_LAST: + + /* "spacy/pipeline/_parser_internals/ner.pyx":678 + * # O, Gold I --> True + * pass + * elif g_act == LAST: # <<<<<<<<<<<<<< + * # O, Gold L --> True + * pass +*/ + break; + case __pyx_e_5spacy_8pipeline_17_parser_internals_3ner_OUT: + + /* "spacy/pipeline/_parser_internals/ner.pyx":681 + * # O, Gold L --> True + * pass + * elif g_act == OUT: # <<<<<<<<<<<<<< + * # O, Gold O --> True + * pass +*/ + break; + case __pyx_e_5spacy_8pipeline_17_parser_internals_3ner_UNIT: + + /* "spacy/pipeline/_parser_internals/ner.pyx":686 + * elif g_act == UNIT: + * # O, Gold U --> False + * cost += 1 # <<<<<<<<<<<<<< + * else: + * cost += 1 +*/ + __pyx_v_cost = (__pyx_v_cost + 1.0); + + /* "spacy/pipeline/_parser_internals/ner.pyx":684 + * # O, Gold O --> True + * pass + * elif g_act == UNIT: # <<<<<<<<<<<<<< + * # O, Gold U --> False + * cost += 1 +*/ + break; + default: + + /* "spacy/pipeline/_parser_internals/ner.pyx":688 + * cost += 1 + * else: + * cost += 1 # <<<<<<<<<<<<<< + * return cost +*/ + __pyx_v_cost = (__pyx_v_cost + 1.0); + break; + } + + /* "spacy/pipeline/_parser_internals/ner.pyx":689 + * else: + * cost += 1 + * return cost # <<<<<<<<<<<<<< +*/ + __pyx_r = __pyx_v_cost; + goto __pyx_L0; + + /* "spacy/pipeline/_parser_internals/ner.pyx":665 + * st.pop() + * + * @staticmethod # <<<<<<<<<<<<<< + * cdef weight_t cost(const StateC* s, const void* _gold, attr_t label) noexcept nogil: + * gold = _gold +*/ + + /* function exit code */ + __pyx_L0:; + return __pyx_r; +} + +/* "(tree fragment)":1 + * def __reduce_cython__(self): # <<<<<<<<<<<<<< + * cdef tuple state + * cdef object _dict +*/ + +/* Python wrapper */ +static PyObject *__pyx_pw_5spacy_8pipeline_17_parser_internals_3ner_3Out_1__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_5spacy_8pipeline_17_parser_internals_3ner_3Out___reduce_cython__, "Out.__reduce_cython__(self)"); +static PyMethodDef __pyx_mdef_5spacy_8pipeline_17_parser_internals_3ner_3Out_1__reduce_cython__ = {"__reduce_cython__", (PyCFunction)(void(*)(void))(__Pyx_PyCFunction_FastCallWithKeywords)__pyx_pw_5spacy_8pipeline_17_parser_internals_3ner_3Out_1__reduce_cython__, __Pyx_METH_FASTCALL|METH_KEYWORDS, __pyx_doc_5spacy_8pipeline_17_parser_internals_3ner_3Out___reduce_cython__}; +static PyObject *__pyx_pw_5spacy_8pipeline_17_parser_internals_3ner_3Out_1__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_5spacy_8pipeline_17_parser_internals_3ner_3Out___reduce_cython__(((struct __pyx_obj_5spacy_8pipeline_17_parser_internals_3ner_Out *)__pyx_v_self)); + + /* function exit code */ + __Pyx_RefNannyFinishContext(); + return __pyx_r; +} + +static PyObject *__pyx_pf_5spacy_8pipeline_17_parser_internals_3ner_3Out___reduce_cython__(struct __pyx_obj_5spacy_8pipeline_17_parser_internals_3ner_Out *__pyx_v_self) { + PyObject *__pyx_v_state = 0; + PyObject *__pyx_v__dict = 0; + int __pyx_v_use_setstate; + PyObject *__pyx_r = NULL; + __Pyx_RefNannyDeclarations + PyObject *__pyx_t_1 = NULL; + int __pyx_t_2; + int __pyx_t_3; + PyObject *__pyx_t_4 = NULL; + PyObject *__pyx_t_5 = NULL; + int __pyx_lineno = 0; + const char *__pyx_filename = NULL; + int __pyx_clineno = 0; + __Pyx_RefNannySetupContext("__reduce_cython__", 0); + + /* "(tree fragment)":5 + * cdef object _dict + * cdef bint use_setstate + * state = () # <<<<<<<<<<<<<< + * _dict = getattr(self, '__dict__', None) + * if _dict is not None and _dict: +*/ + __Pyx_INCREF(__pyx_mstate_global->__pyx_empty_tuple); + __pyx_v_state = __pyx_mstate_global->__pyx_empty_tuple; + + /* "(tree fragment)":6 + * cdef bint use_setstate + * state = () + * _dict = getattr(self, '__dict__', None) # <<<<<<<<<<<<<< + * if _dict is not None and _dict: + * state += (_dict,) +*/ + __pyx_t_1 = __Pyx_GetAttr3(((PyObject *)__pyx_v_self), __pyx_mstate_global->__pyx_n_u_dict, Py_None); if (unlikely(!__pyx_t_1)) __PYX_ERR(1, 6, __pyx_L1_error) + __Pyx_GOTREF(__pyx_t_1); + __pyx_v__dict = __pyx_t_1; + __pyx_t_1 = 0; + + /* "(tree fragment)":7 + * state = () + * _dict = getattr(self, '__dict__', None) + * if _dict is not None and _dict: # <<<<<<<<<<<<<< + * state += (_dict,) + * use_setstate = True +*/ + __pyx_t_3 = (__pyx_v__dict != Py_None); + if (__pyx_t_3) { + } else { + __pyx_t_2 = __pyx_t_3; + goto __pyx_L4_bool_binop_done; + } + __pyx_t_3 = __Pyx_PyObject_IsTrue(__pyx_v__dict); if (unlikely((__pyx_t_3 < 0))) __PYX_ERR(1, 7, __pyx_L1_error) + __pyx_t_2 = __pyx_t_3; + __pyx_L4_bool_binop_done:; + if (__pyx_t_2) { + + /* "(tree fragment)":8 + * _dict = getattr(self, '__dict__', None) + * if _dict is not None and _dict: + * state += (_dict,) # <<<<<<<<<<<<<< + * use_setstate = True + * else: +*/ + __pyx_t_1 = PyTuple_New(1); if (unlikely(!__pyx_t_1)) __PYX_ERR(1, 8, __pyx_L1_error) + __Pyx_GOTREF(__pyx_t_1); + __Pyx_INCREF(__pyx_v__dict); + __Pyx_GIVEREF(__pyx_v__dict); + if (__Pyx_PyTuple_SET_ITEM(__pyx_t_1, 0, __pyx_v__dict) != (0)) __PYX_ERR(1, 8, __pyx_L1_error); + __pyx_t_4 = PyNumber_InPlaceAdd(__pyx_v_state, __pyx_t_1); if (unlikely(!__pyx_t_4)) __PYX_ERR(1, 8, __pyx_L1_error) + __Pyx_GOTREF(__pyx_t_4); + __Pyx_DECREF(__pyx_t_1); __pyx_t_1 = 0; + __Pyx_DECREF_SET(__pyx_v_state, ((PyObject*)__pyx_t_4)); + __pyx_t_4 = 0; + + /* "(tree fragment)":9 + * if _dict is not None and _dict: + * state += (_dict,) + * use_setstate = True # <<<<<<<<<<<<<< + * else: + * use_setstate = ('False',) +*/ + __pyx_v_use_setstate = 1; + + /* "(tree fragment)":7 + * state = () + * _dict = getattr(self, '__dict__', None) + * if _dict is not None and _dict: # <<<<<<<<<<<<<< + * state += (_dict,) + * use_setstate = True +*/ + goto __pyx_L3; + } + + /* "(tree fragment)":11 + * use_setstate = True + * else: + * use_setstate = ('False',) # <<<<<<<<<<<<<< + * if use_setstate: + * return __pyx_unpickle_Out, (type(self), 0xe3b0c44, None), state +*/ + /*else*/ { + __pyx_t_2 = __Pyx_PyObject_IsTrue(__pyx_mstate_global->__pyx_tuple[2]); if (unlikely((__pyx_t_2 == (int)-1) && PyErr_Occurred())) __PYX_ERR(1, 11, __pyx_L1_error) + __pyx_v_use_setstate = __pyx_t_2; + } + __pyx_L3:; + + /* "(tree fragment)":12 + * else: + * use_setstate = ('False',) + * if use_setstate: # <<<<<<<<<<<<<< + * return __pyx_unpickle_Out, (type(self), 0xe3b0c44, None), state + * else: +*/ + if (__pyx_v_use_setstate) { + + /* "(tree fragment)":13 + * use_setstate = ('False',) + * if use_setstate: + * return __pyx_unpickle_Out, (type(self), 0xe3b0c44, None), state # <<<<<<<<<<<<<< + * else: + * return __pyx_unpickle_Out, (type(self), 0xe3b0c44, state) +*/ + __Pyx_XDECREF(__pyx_r); + __Pyx_GetModuleGlobalName(__pyx_t_4, __pyx_mstate_global->__pyx_n_u_pyx_unpickle_Out); if (unlikely(!__pyx_t_4)) __PYX_ERR(1, 13, __pyx_L1_error) + __Pyx_GOTREF(__pyx_t_4); + __pyx_t_1 = PyTuple_New(3); if (unlikely(!__pyx_t_1)) __PYX_ERR(1, 13, __pyx_L1_error) + __Pyx_GOTREF(__pyx_t_1); + __Pyx_INCREF(((PyObject *)Py_TYPE(((PyObject *)__pyx_v_self)))); + __Pyx_GIVEREF(((PyObject *)Py_TYPE(((PyObject *)__pyx_v_self)))); + if (__Pyx_PyTuple_SET_ITEM(__pyx_t_1, 0, ((PyObject *)Py_TYPE(((PyObject *)__pyx_v_self)))) != (0)) __PYX_ERR(1, 13, __pyx_L1_error); + __Pyx_INCREF(__pyx_mstate_global->__pyx_int_238750788); + __Pyx_GIVEREF(__pyx_mstate_global->__pyx_int_238750788); + if (__Pyx_PyTuple_SET_ITEM(__pyx_t_1, 1, __pyx_mstate_global->__pyx_int_238750788) != (0)) __PYX_ERR(1, 13, __pyx_L1_error); + __Pyx_INCREF(Py_None); + __Pyx_GIVEREF(Py_None); + if (__Pyx_PyTuple_SET_ITEM(__pyx_t_1, 2, Py_None) != (0)) __PYX_ERR(1, 13, __pyx_L1_error); + __pyx_t_5 = PyTuple_New(3); if (unlikely(!__pyx_t_5)) __PYX_ERR(1, 13, __pyx_L1_error) + __Pyx_GOTREF(__pyx_t_5); + __Pyx_GIVEREF(__pyx_t_4); + if (__Pyx_PyTuple_SET_ITEM(__pyx_t_5, 0, __pyx_t_4) != (0)) __PYX_ERR(1, 13, __pyx_L1_error); + __Pyx_GIVEREF(__pyx_t_1); + if (__Pyx_PyTuple_SET_ITEM(__pyx_t_5, 1, __pyx_t_1) != (0)) __PYX_ERR(1, 13, __pyx_L1_error); + __Pyx_INCREF(__pyx_v_state); + __Pyx_GIVEREF(__pyx_v_state); + if (__Pyx_PyTuple_SET_ITEM(__pyx_t_5, 2, __pyx_v_state) != (0)) __PYX_ERR(1, 13, __pyx_L1_error); + __pyx_t_4 = 0; + __pyx_t_1 = 0; + __pyx_r = __pyx_t_5; + __pyx_t_5 = 0; + goto __pyx_L0; + + /* "(tree fragment)":12 + * else: + * use_setstate = ('False',) + * if use_setstate: # <<<<<<<<<<<<<< + * return __pyx_unpickle_Out, (type(self), 0xe3b0c44, None), state + * else: +*/ + } + + /* "(tree fragment)":15 + * return __pyx_unpickle_Out, (type(self), 0xe3b0c44, None), state + * else: + * return __pyx_unpickle_Out, (type(self), 0xe3b0c44, state) # <<<<<<<<<<<<<< + * def __setstate_cython__(self, __pyx_state): + * __pyx_unpickle_Out__set_state(self, __pyx_state) +*/ + /*else*/ { + __Pyx_XDECREF(__pyx_r); + __Pyx_GetModuleGlobalName(__pyx_t_5, __pyx_mstate_global->__pyx_n_u_pyx_unpickle_Out); if (unlikely(!__pyx_t_5)) __PYX_ERR(1, 15, __pyx_L1_error) + __Pyx_GOTREF(__pyx_t_5); + __pyx_t_1 = PyTuple_New(3); if (unlikely(!__pyx_t_1)) __PYX_ERR(1, 15, __pyx_L1_error) + __Pyx_GOTREF(__pyx_t_1); + __Pyx_INCREF(((PyObject *)Py_TYPE(((PyObject *)__pyx_v_self)))); + __Pyx_GIVEREF(((PyObject *)Py_TYPE(((PyObject *)__pyx_v_self)))); + if (__Pyx_PyTuple_SET_ITEM(__pyx_t_1, 0, ((PyObject *)Py_TYPE(((PyObject *)__pyx_v_self)))) != (0)) __PYX_ERR(1, 15, __pyx_L1_error); + __Pyx_INCREF(__pyx_mstate_global->__pyx_int_238750788); + __Pyx_GIVEREF(__pyx_mstate_global->__pyx_int_238750788); + if (__Pyx_PyTuple_SET_ITEM(__pyx_t_1, 1, __pyx_mstate_global->__pyx_int_238750788) != (0)) __PYX_ERR(1, 15, __pyx_L1_error); + __Pyx_INCREF(__pyx_v_state); + __Pyx_GIVEREF(__pyx_v_state); + if (__Pyx_PyTuple_SET_ITEM(__pyx_t_1, 2, __pyx_v_state) != (0)) __PYX_ERR(1, 15, __pyx_L1_error); + __pyx_t_4 = PyTuple_New(2); if (unlikely(!__pyx_t_4)) __PYX_ERR(1, 15, __pyx_L1_error) + __Pyx_GOTREF(__pyx_t_4); + __Pyx_GIVEREF(__pyx_t_5); + if (__Pyx_PyTuple_SET_ITEM(__pyx_t_4, 0, __pyx_t_5) != (0)) __PYX_ERR(1, 15, __pyx_L1_error); + __Pyx_GIVEREF(__pyx_t_1); + if (__Pyx_PyTuple_SET_ITEM(__pyx_t_4, 1, __pyx_t_1) != (0)) __PYX_ERR(1, 15, __pyx_L1_error); + __pyx_t_5 = 0; + __pyx_t_1 = 0; + __pyx_r = __pyx_t_4; + __pyx_t_4 = 0; + goto __pyx_L0; + } + + /* "(tree fragment)":1 + * def __reduce_cython__(self): # <<<<<<<<<<<<<< + * cdef tuple state + * cdef object _dict +*/ + + /* function exit code */ + __pyx_L1_error:; + __Pyx_XDECREF(__pyx_t_1); + __Pyx_XDECREF(__pyx_t_4); + __Pyx_XDECREF(__pyx_t_5); + __Pyx_AddTraceback("spacy.pipeline._parser_internals.ner.Out.__reduce_cython__", __pyx_clineno, __pyx_lineno, __pyx_filename); + __pyx_r = NULL; + __pyx_L0:; + __Pyx_XDECREF(__pyx_v_state); + __Pyx_XDECREF(__pyx_v__dict); + __Pyx_XGIVEREF(__pyx_r); + __Pyx_RefNannyFinishContext(); + return __pyx_r; +} + +/* "(tree fragment)":16 + * else: + * return __pyx_unpickle_Out, (type(self), 0xe3b0c44, state) + * def __setstate_cython__(self, __pyx_state): # <<<<<<<<<<<<<< + * __pyx_unpickle_Out__set_state(self, __pyx_state) +*/ + +/* Python wrapper */ +static PyObject *__pyx_pw_5spacy_8pipeline_17_parser_internals_3ner_3Out_3__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_5spacy_8pipeline_17_parser_internals_3ner_3Out_2__setstate_cython__, "Out.__setstate_cython__(self, __pyx_state)"); +static PyMethodDef __pyx_mdef_5spacy_8pipeline_17_parser_internals_3ner_3Out_3__setstate_cython__ = {"__setstate_cython__", (PyCFunction)(void(*)(void))(__Pyx_PyCFunction_FastCallWithKeywords)__pyx_pw_5spacy_8pipeline_17_parser_internals_3ner_3Out_3__setstate_cython__, __Pyx_METH_FASTCALL|METH_KEYWORDS, __pyx_doc_5spacy_8pipeline_17_parser_internals_3ner_3Out_2__setstate_cython__}; +static PyObject *__pyx_pw_5spacy_8pipeline_17_parser_internals_3ner_3Out_3__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 +) { + 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, 16, __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, 16, __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, 16, __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, 16, __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, 16, __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, 16, __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("spacy.pipeline._parser_internals.ner.Out.__setstate_cython__", __pyx_clineno, __pyx_lineno, __pyx_filename); + __Pyx_RefNannyFinishContext(); + return NULL; + __pyx_L4_argument_unpacking_done:; + __pyx_r = __pyx_pf_5spacy_8pipeline_17_parser_internals_3ner_3Out_2__setstate_cython__(((struct __pyx_obj_5spacy_8pipeline_17_parser_internals_3ner_Out *)__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_5spacy_8pipeline_17_parser_internals_3ner_3Out_2__setstate_cython__(struct __pyx_obj_5spacy_8pipeline_17_parser_internals_3ner_Out *__pyx_v_self, PyObject *__pyx_v___pyx_state) { + PyObject *__pyx_r = NULL; + __Pyx_RefNannyDeclarations + PyObject *__pyx_t_1 = NULL; + int __pyx_lineno = 0; + const char *__pyx_filename = NULL; + int __pyx_clineno = 0; + __Pyx_RefNannySetupContext("__setstate_cython__", 0); + + /* "(tree fragment)":17 + * return __pyx_unpickle_Out, (type(self), 0xe3b0c44, state) + * def __setstate_cython__(self, __pyx_state): + * __pyx_unpickle_Out__set_state(self, __pyx_state) # <<<<<<<<<<<<<< +*/ + __pyx_t_1 = __pyx_f_5spacy_8pipeline_17_parser_internals_3ner___pyx_unpickle_Out__set_state(__pyx_v_self, __pyx_v___pyx_state); if (unlikely(!__pyx_t_1)) __PYX_ERR(1, 17, __pyx_L1_error) + __Pyx_GOTREF(__pyx_t_1); + __Pyx_DECREF(__pyx_t_1); __pyx_t_1 = 0; + + /* "(tree fragment)":16 + * else: + * return __pyx_unpickle_Out, (type(self), 0xe3b0c44, state) + * def __setstate_cython__(self, __pyx_state): # <<<<<<<<<<<<<< + * __pyx_unpickle_Out__set_state(self, __pyx_state) +*/ + + /* function exit code */ + __pyx_r = Py_None; __Pyx_INCREF(Py_None); + goto __pyx_L0; + __pyx_L1_error:; + __Pyx_XDECREF(__pyx_t_1); + __Pyx_AddTraceback("spacy.pipeline._parser_internals.ner.Out.__setstate_cython__", __pyx_clineno, __pyx_lineno, __pyx_filename); + __pyx_r = NULL; + __pyx_L0:; + __Pyx_XGIVEREF(__pyx_r); + __Pyx_RefNannyFinishContext(); + return __pyx_r; +} + +/* "(tree fragment)":4 + * int __Pyx_CheckUnpickleChecksum(long, long, long, long, const char*) except -1 + * int __Pyx_UpdateUnpickledDict(object, object, Py_ssize_t) except -1 + * def __pyx_unpickle_Missing(__pyx_type, long __pyx_checksum, tuple __pyx_state): # <<<<<<<<<<<<<< + * cdef object __pyx_result + * __Pyx_CheckUnpickleChecksum(__pyx_checksum, 0xe3b0c44, 0xda39a3e, 0xd41d8cd, b'') +*/ + +/* Python wrapper */ +static PyObject *__pyx_pw_5spacy_8pipeline_17_parser_internals_3ner_1__pyx_unpickle_Missing(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_5spacy_8pipeline_17_parser_internals_3ner___pyx_unpickle_Missing, "__pyx_unpickle_Missing(__pyx_type, long __pyx_checksum, tuple __pyx_state)"); +static PyMethodDef __pyx_mdef_5spacy_8pipeline_17_parser_internals_3ner_1__pyx_unpickle_Missing = {"__pyx_unpickle_Missing", (PyCFunction)(void(*)(void))(__Pyx_PyCFunction_FastCallWithKeywords)__pyx_pw_5spacy_8pipeline_17_parser_internals_3ner_1__pyx_unpickle_Missing, __Pyx_METH_FASTCALL|METH_KEYWORDS, __pyx_doc_5spacy_8pipeline_17_parser_internals_3ner___pyx_unpickle_Missing}; +static PyObject *__pyx_pw_5spacy_8pipeline_17_parser_internals_3ner_1__pyx_unpickle_Missing(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 +) { + PyObject *__pyx_v___pyx_type = 0; + long __pyx_v___pyx_checksum; + 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[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("__pyx_unpickle_Missing (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_type,&__pyx_mstate_global->__pyx_n_u_pyx_checksum,&__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, 4, __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(1, 4, __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(1, 4, __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(1, 4, __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, "__pyx_unpickle_Missing", 0) < (0)) __PYX_ERR(1, 4, __pyx_L3_error) + for (Py_ssize_t i = __pyx_nargs; i < 3; i++) { + if (unlikely(!values[i])) { __Pyx_RaiseArgtupleInvalid("__pyx_unpickle_Missing", 1, 3, 3, i); __PYX_ERR(1, 4, __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(1, 4, __pyx_L3_error) + values[1] = __Pyx_ArgRef_FASTCALL(__pyx_args, 1); + if (!CYTHON_ASSUME_SAFE_MACROS && unlikely(!values[1])) __PYX_ERR(1, 4, __pyx_L3_error) + values[2] = __Pyx_ArgRef_FASTCALL(__pyx_args, 2); + if (!CYTHON_ASSUME_SAFE_MACROS && unlikely(!values[2])) __PYX_ERR(1, 4, __pyx_L3_error) + } + __pyx_v___pyx_type = values[0]; + __pyx_v___pyx_checksum = __Pyx_PyLong_As_long(values[1]); if (unlikely((__pyx_v___pyx_checksum == (long)-1) && PyErr_Occurred())) __PYX_ERR(1, 4, __pyx_L3_error) + __pyx_v___pyx_state = ((PyObject*)values[2]); + } + goto __pyx_L6_skip; + __pyx_L5_argtuple_error:; + __Pyx_RaiseArgtupleInvalid("__pyx_unpickle_Missing", 1, 3, 3, __pyx_nargs); __PYX_ERR(1, 4, __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("spacy.pipeline._parser_internals.ner.__pyx_unpickle_Missing", __pyx_clineno, __pyx_lineno, __pyx_filename); + __Pyx_RefNannyFinishContext(); + return NULL; + __pyx_L4_argument_unpacking_done:; + if (unlikely(!__Pyx_ArgTypeTest(((PyObject *)__pyx_v___pyx_state), (&PyTuple_Type), 1, "__pyx_state", 1))) __PYX_ERR(1, 4, __pyx_L1_error) + __pyx_r = __pyx_pf_5spacy_8pipeline_17_parser_internals_3ner___pyx_unpickle_Missing(__pyx_self, __pyx_v___pyx_type, __pyx_v___pyx_checksum, __pyx_v___pyx_state); + + /* 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_5spacy_8pipeline_17_parser_internals_3ner___pyx_unpickle_Missing(CYTHON_UNUSED PyObject *__pyx_self, PyObject *__pyx_v___pyx_type, long __pyx_v___pyx_checksum, PyObject *__pyx_v___pyx_state) { + PyObject *__pyx_v___pyx_result = 0; + 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_t_5; + int __pyx_lineno = 0; + const char *__pyx_filename = NULL; + int __pyx_clineno = 0; + __Pyx_RefNannySetupContext("__pyx_unpickle_Missing", 0); + + /* "(tree fragment)":6 + * def __pyx_unpickle_Missing(__pyx_type, long __pyx_checksum, tuple __pyx_state): + * cdef object __pyx_result + * __Pyx_CheckUnpickleChecksum(__pyx_checksum, 0xe3b0c44, 0xda39a3e, 0xd41d8cd, b'') # <<<<<<<<<<<<<< + * __pyx_result = Missing.__new__(__pyx_type) + * if __pyx_state is not None: +*/ + __pyx_t_1 = __Pyx_CheckUnpickleChecksum(__pyx_v___pyx_checksum, 0xe3b0c44, 0xda39a3e, 0xd41d8cd, ((char const *)"")); if (unlikely(__pyx_t_1 == ((int)-1))) __PYX_ERR(1, 6, __pyx_L1_error) + + /* "(tree fragment)":7 + * cdef object __pyx_result + * __Pyx_CheckUnpickleChecksum(__pyx_checksum, 0xe3b0c44, 0xda39a3e, 0xd41d8cd, b'') + * __pyx_result = Missing.__new__(__pyx_type) # <<<<<<<<<<<<<< + * if __pyx_state is not None: + * __pyx_unpickle_Missing__set_state( __pyx_result, __pyx_state) +*/ + __pyx_t_3 = ((PyObject *)__pyx_mstate_global->__pyx_ptype_5spacy_8pipeline_17_parser_internals_3ner_Missing); + __Pyx_INCREF(__pyx_t_3); + __pyx_t_4 = 0; + { + PyObject *__pyx_callargs[2] = {__pyx_t_3, __pyx_v___pyx_type}; + __pyx_t_2 = __Pyx_PyObject_FastCallMethod((PyObject*)__pyx_mstate_global->__pyx_n_u_new, __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_2)) __PYX_ERR(1, 7, __pyx_L1_error) + __Pyx_GOTREF(__pyx_t_2); + } + __pyx_v___pyx_result = __pyx_t_2; + __pyx_t_2 = 0; + + /* "(tree fragment)":8 + * __Pyx_CheckUnpickleChecksum(__pyx_checksum, 0xe3b0c44, 0xda39a3e, 0xd41d8cd, b'') + * __pyx_result = Missing.__new__(__pyx_type) + * if __pyx_state is not None: # <<<<<<<<<<<<<< + * __pyx_unpickle_Missing__set_state( __pyx_result, __pyx_state) + * return __pyx_result +*/ + __pyx_t_5 = (__pyx_v___pyx_state != ((PyObject*)Py_None)); + if (__pyx_t_5) { + + /* "(tree fragment)":9 + * __pyx_result = Missing.__new__(__pyx_type) + * if __pyx_state is not None: + * __pyx_unpickle_Missing__set_state( __pyx_result, __pyx_state) # <<<<<<<<<<<<<< + * return __pyx_result + * cdef __pyx_unpickle_Missing__set_state(Missing __pyx_result, __pyx_state: tuple): +*/ + __pyx_t_2 = __pyx_f_5spacy_8pipeline_17_parser_internals_3ner___pyx_unpickle_Missing__set_state(((struct __pyx_obj_5spacy_8pipeline_17_parser_internals_3ner_Missing *)__pyx_v___pyx_result), __pyx_v___pyx_state); if (unlikely(!__pyx_t_2)) __PYX_ERR(1, 9, __pyx_L1_error) + __Pyx_GOTREF(__pyx_t_2); + __Pyx_DECREF(__pyx_t_2); __pyx_t_2 = 0; + + /* "(tree fragment)":8 + * __Pyx_CheckUnpickleChecksum(__pyx_checksum, 0xe3b0c44, 0xda39a3e, 0xd41d8cd, b'') + * __pyx_result = Missing.__new__(__pyx_type) + * if __pyx_state is not None: # <<<<<<<<<<<<<< + * __pyx_unpickle_Missing__set_state( __pyx_result, __pyx_state) + * return __pyx_result +*/ + } + + /* "(tree fragment)":10 + * if __pyx_state is not None: + * __pyx_unpickle_Missing__set_state( __pyx_result, __pyx_state) + * return __pyx_result # <<<<<<<<<<<<<< + * cdef __pyx_unpickle_Missing__set_state(Missing __pyx_result, __pyx_state: tuple): + * __Pyx_UpdateUnpickledDict(__pyx_result, __pyx_state, 0) +*/ + __Pyx_XDECREF(__pyx_r); + __Pyx_INCREF(__pyx_v___pyx_result); + __pyx_r = __pyx_v___pyx_result; + goto __pyx_L0; + + /* "(tree fragment)":4 + * int __Pyx_CheckUnpickleChecksum(long, long, long, long, const char*) except -1 + * int __Pyx_UpdateUnpickledDict(object, object, Py_ssize_t) except -1 + * def __pyx_unpickle_Missing(__pyx_type, long __pyx_checksum, tuple __pyx_state): # <<<<<<<<<<<<<< + * cdef object __pyx_result + * __Pyx_CheckUnpickleChecksum(__pyx_checksum, 0xe3b0c44, 0xda39a3e, 0xd41d8cd, b'') +*/ + + /* function exit code */ + __pyx_L1_error:; + __Pyx_XDECREF(__pyx_t_2); + __Pyx_XDECREF(__pyx_t_3); + __Pyx_AddTraceback("spacy.pipeline._parser_internals.ner.__pyx_unpickle_Missing", __pyx_clineno, __pyx_lineno, __pyx_filename); + __pyx_r = NULL; + __pyx_L0:; + __Pyx_XDECREF(__pyx_v___pyx_result); + __Pyx_XGIVEREF(__pyx_r); + __Pyx_RefNannyFinishContext(); + return __pyx_r; +} + +/* "(tree fragment)":11 + * __pyx_unpickle_Missing__set_state( __pyx_result, __pyx_state) + * return __pyx_result + * cdef __pyx_unpickle_Missing__set_state(Missing __pyx_result, __pyx_state: tuple): # <<<<<<<<<<<<<< + * __Pyx_UpdateUnpickledDict(__pyx_result, __pyx_state, 0) +*/ + +static PyObject *__pyx_f_5spacy_8pipeline_17_parser_internals_3ner___pyx_unpickle_Missing__set_state(struct __pyx_obj_5spacy_8pipeline_17_parser_internals_3ner_Missing *__pyx_v___pyx_result, PyObject *__pyx_v___pyx_state) { + PyObject *__pyx_r = NULL; + __Pyx_RefNannyDeclarations + int __pyx_t_1; + int __pyx_lineno = 0; + const char *__pyx_filename = NULL; + int __pyx_clineno = 0; + __Pyx_RefNannySetupContext("__pyx_unpickle_Missing__set_state", 0); + + /* "(tree fragment)":12 + * return __pyx_result + * cdef __pyx_unpickle_Missing__set_state(Missing __pyx_result, __pyx_state: tuple): + * __Pyx_UpdateUnpickledDict(__pyx_result, __pyx_state, 0) # <<<<<<<<<<<<<< +*/ + __pyx_t_1 = __Pyx_UpdateUnpickledDict(((PyObject *)__pyx_v___pyx_result), __pyx_v___pyx_state, 0); if (unlikely(__pyx_t_1 == ((int)-1))) __PYX_ERR(1, 12, __pyx_L1_error) + + /* "(tree fragment)":11 + * __pyx_unpickle_Missing__set_state( __pyx_result, __pyx_state) + * return __pyx_result + * cdef __pyx_unpickle_Missing__set_state(Missing __pyx_result, __pyx_state: tuple): # <<<<<<<<<<<<<< + * __Pyx_UpdateUnpickledDict(__pyx_result, __pyx_state, 0) +*/ + + /* function exit code */ + __pyx_r = Py_None; __Pyx_INCREF(Py_None); + goto __pyx_L0; + __pyx_L1_error:; + __Pyx_AddTraceback("spacy.pipeline._parser_internals.ner.__pyx_unpickle_Missing__set_state", __pyx_clineno, __pyx_lineno, __pyx_filename); + __pyx_r = 0; + __pyx_L0:; + __Pyx_XGIVEREF(__pyx_r); + __Pyx_RefNannyFinishContext(); + return __pyx_r; +} + +/* "(tree fragment)":4 + * int __Pyx_CheckUnpickleChecksum(long, long, long, long, const char*) except -1 + * int __Pyx_UpdateUnpickledDict(object, object, Py_ssize_t) except -1 + * def __pyx_unpickle_Begin(__pyx_type, long __pyx_checksum, tuple __pyx_state): # <<<<<<<<<<<<<< + * cdef object __pyx_result + * __Pyx_CheckUnpickleChecksum(__pyx_checksum, 0xe3b0c44, 0xda39a3e, 0xd41d8cd, b'') +*/ + +/* Python wrapper */ +static PyObject *__pyx_pw_5spacy_8pipeline_17_parser_internals_3ner_3__pyx_unpickle_Begin(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_5spacy_8pipeline_17_parser_internals_3ner_2__pyx_unpickle_Begin, "__pyx_unpickle_Begin(__pyx_type, long __pyx_checksum, tuple __pyx_state)"); +static PyMethodDef __pyx_mdef_5spacy_8pipeline_17_parser_internals_3ner_3__pyx_unpickle_Begin = {"__pyx_unpickle_Begin", (PyCFunction)(void(*)(void))(__Pyx_PyCFunction_FastCallWithKeywords)__pyx_pw_5spacy_8pipeline_17_parser_internals_3ner_3__pyx_unpickle_Begin, __Pyx_METH_FASTCALL|METH_KEYWORDS, __pyx_doc_5spacy_8pipeline_17_parser_internals_3ner_2__pyx_unpickle_Begin}; +static PyObject *__pyx_pw_5spacy_8pipeline_17_parser_internals_3ner_3__pyx_unpickle_Begin(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 +) { + PyObject *__pyx_v___pyx_type = 0; + long __pyx_v___pyx_checksum; + 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[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("__pyx_unpickle_Begin (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_type,&__pyx_mstate_global->__pyx_n_u_pyx_checksum,&__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, 4, __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(1, 4, __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(1, 4, __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(1, 4, __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, "__pyx_unpickle_Begin", 0) < (0)) __PYX_ERR(1, 4, __pyx_L3_error) + for (Py_ssize_t i = __pyx_nargs; i < 3; i++) { + if (unlikely(!values[i])) { __Pyx_RaiseArgtupleInvalid("__pyx_unpickle_Begin", 1, 3, 3, i); __PYX_ERR(1, 4, __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(1, 4, __pyx_L3_error) + values[1] = __Pyx_ArgRef_FASTCALL(__pyx_args, 1); + if (!CYTHON_ASSUME_SAFE_MACROS && unlikely(!values[1])) __PYX_ERR(1, 4, __pyx_L3_error) + values[2] = __Pyx_ArgRef_FASTCALL(__pyx_args, 2); + if (!CYTHON_ASSUME_SAFE_MACROS && unlikely(!values[2])) __PYX_ERR(1, 4, __pyx_L3_error) + } + __pyx_v___pyx_type = values[0]; + __pyx_v___pyx_checksum = __Pyx_PyLong_As_long(values[1]); if (unlikely((__pyx_v___pyx_checksum == (long)-1) && PyErr_Occurred())) __PYX_ERR(1, 4, __pyx_L3_error) + __pyx_v___pyx_state = ((PyObject*)values[2]); + } + goto __pyx_L6_skip; + __pyx_L5_argtuple_error:; + __Pyx_RaiseArgtupleInvalid("__pyx_unpickle_Begin", 1, 3, 3, __pyx_nargs); __PYX_ERR(1, 4, __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("spacy.pipeline._parser_internals.ner.__pyx_unpickle_Begin", __pyx_clineno, __pyx_lineno, __pyx_filename); + __Pyx_RefNannyFinishContext(); + return NULL; + __pyx_L4_argument_unpacking_done:; + if (unlikely(!__Pyx_ArgTypeTest(((PyObject *)__pyx_v___pyx_state), (&PyTuple_Type), 1, "__pyx_state", 1))) __PYX_ERR(1, 4, __pyx_L1_error) + __pyx_r = __pyx_pf_5spacy_8pipeline_17_parser_internals_3ner_2__pyx_unpickle_Begin(__pyx_self, __pyx_v___pyx_type, __pyx_v___pyx_checksum, __pyx_v___pyx_state); + + /* 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_5spacy_8pipeline_17_parser_internals_3ner_2__pyx_unpickle_Begin(CYTHON_UNUSED PyObject *__pyx_self, PyObject *__pyx_v___pyx_type, long __pyx_v___pyx_checksum, PyObject *__pyx_v___pyx_state) { + PyObject *__pyx_v___pyx_result = 0; + 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_t_5; + int __pyx_lineno = 0; + const char *__pyx_filename = NULL; + int __pyx_clineno = 0; + __Pyx_RefNannySetupContext("__pyx_unpickle_Begin", 0); + + /* "(tree fragment)":6 + * def __pyx_unpickle_Begin(__pyx_type, long __pyx_checksum, tuple __pyx_state): + * cdef object __pyx_result + * __Pyx_CheckUnpickleChecksum(__pyx_checksum, 0xe3b0c44, 0xda39a3e, 0xd41d8cd, b'') # <<<<<<<<<<<<<< + * __pyx_result = Begin.__new__(__pyx_type) + * if __pyx_state is not None: +*/ + __pyx_t_1 = __Pyx_CheckUnpickleChecksum(__pyx_v___pyx_checksum, 0xe3b0c44, 0xda39a3e, 0xd41d8cd, ((char const *)"")); if (unlikely(__pyx_t_1 == ((int)-1))) __PYX_ERR(1, 6, __pyx_L1_error) + + /* "(tree fragment)":7 + * cdef object __pyx_result + * __Pyx_CheckUnpickleChecksum(__pyx_checksum, 0xe3b0c44, 0xda39a3e, 0xd41d8cd, b'') + * __pyx_result = Begin.__new__(__pyx_type) # <<<<<<<<<<<<<< + * if __pyx_state is not None: + * __pyx_unpickle_Begin__set_state( __pyx_result, __pyx_state) +*/ + __pyx_t_3 = ((PyObject *)__pyx_mstate_global->__pyx_ptype_5spacy_8pipeline_17_parser_internals_3ner_Begin); + __Pyx_INCREF(__pyx_t_3); + __pyx_t_4 = 0; + { + PyObject *__pyx_callargs[2] = {__pyx_t_3, __pyx_v___pyx_type}; + __pyx_t_2 = __Pyx_PyObject_FastCallMethod((PyObject*)__pyx_mstate_global->__pyx_n_u_new, __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_2)) __PYX_ERR(1, 7, __pyx_L1_error) + __Pyx_GOTREF(__pyx_t_2); + } + __pyx_v___pyx_result = __pyx_t_2; + __pyx_t_2 = 0; + + /* "(tree fragment)":8 + * __Pyx_CheckUnpickleChecksum(__pyx_checksum, 0xe3b0c44, 0xda39a3e, 0xd41d8cd, b'') + * __pyx_result = Begin.__new__(__pyx_type) + * if __pyx_state is not None: # <<<<<<<<<<<<<< + * __pyx_unpickle_Begin__set_state( __pyx_result, __pyx_state) + * return __pyx_result +*/ + __pyx_t_5 = (__pyx_v___pyx_state != ((PyObject*)Py_None)); + if (__pyx_t_5) { + + /* "(tree fragment)":9 + * __pyx_result = Begin.__new__(__pyx_type) + * if __pyx_state is not None: + * __pyx_unpickle_Begin__set_state( __pyx_result, __pyx_state) # <<<<<<<<<<<<<< + * return __pyx_result + * cdef __pyx_unpickle_Begin__set_state(Begin __pyx_result, __pyx_state: tuple): +*/ + __pyx_t_2 = __pyx_f_5spacy_8pipeline_17_parser_internals_3ner___pyx_unpickle_Begin__set_state(((struct __pyx_obj_5spacy_8pipeline_17_parser_internals_3ner_Begin *)__pyx_v___pyx_result), __pyx_v___pyx_state); if (unlikely(!__pyx_t_2)) __PYX_ERR(1, 9, __pyx_L1_error) + __Pyx_GOTREF(__pyx_t_2); + __Pyx_DECREF(__pyx_t_2); __pyx_t_2 = 0; + + /* "(tree fragment)":8 + * __Pyx_CheckUnpickleChecksum(__pyx_checksum, 0xe3b0c44, 0xda39a3e, 0xd41d8cd, b'') + * __pyx_result = Begin.__new__(__pyx_type) + * if __pyx_state is not None: # <<<<<<<<<<<<<< + * __pyx_unpickle_Begin__set_state( __pyx_result, __pyx_state) + * return __pyx_result +*/ + } + + /* "(tree fragment)":10 + * if __pyx_state is not None: + * __pyx_unpickle_Begin__set_state( __pyx_result, __pyx_state) + * return __pyx_result # <<<<<<<<<<<<<< + * cdef __pyx_unpickle_Begin__set_state(Begin __pyx_result, __pyx_state: tuple): + * __Pyx_UpdateUnpickledDict(__pyx_result, __pyx_state, 0) +*/ + __Pyx_XDECREF(__pyx_r); + __Pyx_INCREF(__pyx_v___pyx_result); + __pyx_r = __pyx_v___pyx_result; + goto __pyx_L0; + + /* "(tree fragment)":4 + * int __Pyx_CheckUnpickleChecksum(long, long, long, long, const char*) except -1 + * int __Pyx_UpdateUnpickledDict(object, object, Py_ssize_t) except -1 + * def __pyx_unpickle_Begin(__pyx_type, long __pyx_checksum, tuple __pyx_state): # <<<<<<<<<<<<<< + * cdef object __pyx_result + * __Pyx_CheckUnpickleChecksum(__pyx_checksum, 0xe3b0c44, 0xda39a3e, 0xd41d8cd, b'') +*/ + + /* function exit code */ + __pyx_L1_error:; + __Pyx_XDECREF(__pyx_t_2); + __Pyx_XDECREF(__pyx_t_3); + __Pyx_AddTraceback("spacy.pipeline._parser_internals.ner.__pyx_unpickle_Begin", __pyx_clineno, __pyx_lineno, __pyx_filename); + __pyx_r = NULL; + __pyx_L0:; + __Pyx_XDECREF(__pyx_v___pyx_result); + __Pyx_XGIVEREF(__pyx_r); + __Pyx_RefNannyFinishContext(); + return __pyx_r; +} + +/* "(tree fragment)":11 + * __pyx_unpickle_Begin__set_state( __pyx_result, __pyx_state) + * return __pyx_result + * cdef __pyx_unpickle_Begin__set_state(Begin __pyx_result, __pyx_state: tuple): # <<<<<<<<<<<<<< + * __Pyx_UpdateUnpickledDict(__pyx_result, __pyx_state, 0) +*/ + +static PyObject *__pyx_f_5spacy_8pipeline_17_parser_internals_3ner___pyx_unpickle_Begin__set_state(struct __pyx_obj_5spacy_8pipeline_17_parser_internals_3ner_Begin *__pyx_v___pyx_result, PyObject *__pyx_v___pyx_state) { + PyObject *__pyx_r = NULL; + __Pyx_RefNannyDeclarations + int __pyx_t_1; + int __pyx_lineno = 0; + const char *__pyx_filename = NULL; + int __pyx_clineno = 0; + __Pyx_RefNannySetupContext("__pyx_unpickle_Begin__set_state", 0); + + /* "(tree fragment)":12 + * return __pyx_result + * cdef __pyx_unpickle_Begin__set_state(Begin __pyx_result, __pyx_state: tuple): + * __Pyx_UpdateUnpickledDict(__pyx_result, __pyx_state, 0) # <<<<<<<<<<<<<< +*/ + __pyx_t_1 = __Pyx_UpdateUnpickledDict(((PyObject *)__pyx_v___pyx_result), __pyx_v___pyx_state, 0); if (unlikely(__pyx_t_1 == ((int)-1))) __PYX_ERR(1, 12, __pyx_L1_error) + + /* "(tree fragment)":11 + * __pyx_unpickle_Begin__set_state( __pyx_result, __pyx_state) + * return __pyx_result + * cdef __pyx_unpickle_Begin__set_state(Begin __pyx_result, __pyx_state: tuple): # <<<<<<<<<<<<<< + * __Pyx_UpdateUnpickledDict(__pyx_result, __pyx_state, 0) +*/ + + /* function exit code */ + __pyx_r = Py_None; __Pyx_INCREF(Py_None); + goto __pyx_L0; + __pyx_L1_error:; + __Pyx_AddTraceback("spacy.pipeline._parser_internals.ner.__pyx_unpickle_Begin__set_state", __pyx_clineno, __pyx_lineno, __pyx_filename); + __pyx_r = 0; + __pyx_L0:; + __Pyx_XGIVEREF(__pyx_r); + __Pyx_RefNannyFinishContext(); + return __pyx_r; +} + +/* "(tree fragment)":4 + * int __Pyx_CheckUnpickleChecksum(long, long, long, long, const char*) except -1 + * int __Pyx_UpdateUnpickledDict(object, object, Py_ssize_t) except -1 + * def __pyx_unpickle_In(__pyx_type, long __pyx_checksum, tuple __pyx_state): # <<<<<<<<<<<<<< + * cdef object __pyx_result + * __Pyx_CheckUnpickleChecksum(__pyx_checksum, 0xe3b0c44, 0xda39a3e, 0xd41d8cd, b'') +*/ + +/* Python wrapper */ +static PyObject *__pyx_pw_5spacy_8pipeline_17_parser_internals_3ner_5__pyx_unpickle_In(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_5spacy_8pipeline_17_parser_internals_3ner_4__pyx_unpickle_In, "__pyx_unpickle_In(__pyx_type, long __pyx_checksum, tuple __pyx_state)"); +static PyMethodDef __pyx_mdef_5spacy_8pipeline_17_parser_internals_3ner_5__pyx_unpickle_In = {"__pyx_unpickle_In", (PyCFunction)(void(*)(void))(__Pyx_PyCFunction_FastCallWithKeywords)__pyx_pw_5spacy_8pipeline_17_parser_internals_3ner_5__pyx_unpickle_In, __Pyx_METH_FASTCALL|METH_KEYWORDS, __pyx_doc_5spacy_8pipeline_17_parser_internals_3ner_4__pyx_unpickle_In}; +static PyObject *__pyx_pw_5spacy_8pipeline_17_parser_internals_3ner_5__pyx_unpickle_In(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 +) { + PyObject *__pyx_v___pyx_type = 0; + long __pyx_v___pyx_checksum; + 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[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("__pyx_unpickle_In (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_type,&__pyx_mstate_global->__pyx_n_u_pyx_checksum,&__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, 4, __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(1, 4, __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(1, 4, __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(1, 4, __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, "__pyx_unpickle_In", 0) < (0)) __PYX_ERR(1, 4, __pyx_L3_error) + for (Py_ssize_t i = __pyx_nargs; i < 3; i++) { + if (unlikely(!values[i])) { __Pyx_RaiseArgtupleInvalid("__pyx_unpickle_In", 1, 3, 3, i); __PYX_ERR(1, 4, __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(1, 4, __pyx_L3_error) + values[1] = __Pyx_ArgRef_FASTCALL(__pyx_args, 1); + if (!CYTHON_ASSUME_SAFE_MACROS && unlikely(!values[1])) __PYX_ERR(1, 4, __pyx_L3_error) + values[2] = __Pyx_ArgRef_FASTCALL(__pyx_args, 2); + if (!CYTHON_ASSUME_SAFE_MACROS && unlikely(!values[2])) __PYX_ERR(1, 4, __pyx_L3_error) + } + __pyx_v___pyx_type = values[0]; + __pyx_v___pyx_checksum = __Pyx_PyLong_As_long(values[1]); if (unlikely((__pyx_v___pyx_checksum == (long)-1) && PyErr_Occurred())) __PYX_ERR(1, 4, __pyx_L3_error) + __pyx_v___pyx_state = ((PyObject*)values[2]); + } + goto __pyx_L6_skip; + __pyx_L5_argtuple_error:; + __Pyx_RaiseArgtupleInvalid("__pyx_unpickle_In", 1, 3, 3, __pyx_nargs); __PYX_ERR(1, 4, __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("spacy.pipeline._parser_internals.ner.__pyx_unpickle_In", __pyx_clineno, __pyx_lineno, __pyx_filename); + __Pyx_RefNannyFinishContext(); + return NULL; + __pyx_L4_argument_unpacking_done:; + if (unlikely(!__Pyx_ArgTypeTest(((PyObject *)__pyx_v___pyx_state), (&PyTuple_Type), 1, "__pyx_state", 1))) __PYX_ERR(1, 4, __pyx_L1_error) + __pyx_r = __pyx_pf_5spacy_8pipeline_17_parser_internals_3ner_4__pyx_unpickle_In(__pyx_self, __pyx_v___pyx_type, __pyx_v___pyx_checksum, __pyx_v___pyx_state); + + /* 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_5spacy_8pipeline_17_parser_internals_3ner_4__pyx_unpickle_In(CYTHON_UNUSED PyObject *__pyx_self, PyObject *__pyx_v___pyx_type, long __pyx_v___pyx_checksum, PyObject *__pyx_v___pyx_state) { + PyObject *__pyx_v___pyx_result = 0; + 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_t_5; + int __pyx_lineno = 0; + const char *__pyx_filename = NULL; + int __pyx_clineno = 0; + __Pyx_RefNannySetupContext("__pyx_unpickle_In", 0); + + /* "(tree fragment)":6 + * def __pyx_unpickle_In(__pyx_type, long __pyx_checksum, tuple __pyx_state): + * cdef object __pyx_result + * __Pyx_CheckUnpickleChecksum(__pyx_checksum, 0xe3b0c44, 0xda39a3e, 0xd41d8cd, b'') # <<<<<<<<<<<<<< + * __pyx_result = In.__new__(__pyx_type) + * if __pyx_state is not None: +*/ + __pyx_t_1 = __Pyx_CheckUnpickleChecksum(__pyx_v___pyx_checksum, 0xe3b0c44, 0xda39a3e, 0xd41d8cd, ((char const *)"")); if (unlikely(__pyx_t_1 == ((int)-1))) __PYX_ERR(1, 6, __pyx_L1_error) + + /* "(tree fragment)":7 + * cdef object __pyx_result + * __Pyx_CheckUnpickleChecksum(__pyx_checksum, 0xe3b0c44, 0xda39a3e, 0xd41d8cd, b'') + * __pyx_result = In.__new__(__pyx_type) # <<<<<<<<<<<<<< + * if __pyx_state is not None: + * __pyx_unpickle_In__set_state( __pyx_result, __pyx_state) +*/ + __pyx_t_3 = ((PyObject *)__pyx_mstate_global->__pyx_ptype_5spacy_8pipeline_17_parser_internals_3ner_In); + __Pyx_INCREF(__pyx_t_3); + __pyx_t_4 = 0; + { + PyObject *__pyx_callargs[2] = {__pyx_t_3, __pyx_v___pyx_type}; + __pyx_t_2 = __Pyx_PyObject_FastCallMethod((PyObject*)__pyx_mstate_global->__pyx_n_u_new, __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_2)) __PYX_ERR(1, 7, __pyx_L1_error) + __Pyx_GOTREF(__pyx_t_2); + } + __pyx_v___pyx_result = __pyx_t_2; + __pyx_t_2 = 0; + + /* "(tree fragment)":8 + * __Pyx_CheckUnpickleChecksum(__pyx_checksum, 0xe3b0c44, 0xda39a3e, 0xd41d8cd, b'') + * __pyx_result = In.__new__(__pyx_type) + * if __pyx_state is not None: # <<<<<<<<<<<<<< + * __pyx_unpickle_In__set_state( __pyx_result, __pyx_state) + * return __pyx_result +*/ + __pyx_t_5 = (__pyx_v___pyx_state != ((PyObject*)Py_None)); + if (__pyx_t_5) { + + /* "(tree fragment)":9 + * __pyx_result = In.__new__(__pyx_type) + * if __pyx_state is not None: + * __pyx_unpickle_In__set_state( __pyx_result, __pyx_state) # <<<<<<<<<<<<<< + * return __pyx_result + * cdef __pyx_unpickle_In__set_state(In __pyx_result, __pyx_state: tuple): +*/ + __pyx_t_2 = __pyx_f_5spacy_8pipeline_17_parser_internals_3ner___pyx_unpickle_In__set_state(((struct __pyx_obj_5spacy_8pipeline_17_parser_internals_3ner_In *)__pyx_v___pyx_result), __pyx_v___pyx_state); if (unlikely(!__pyx_t_2)) __PYX_ERR(1, 9, __pyx_L1_error) + __Pyx_GOTREF(__pyx_t_2); + __Pyx_DECREF(__pyx_t_2); __pyx_t_2 = 0; + + /* "(tree fragment)":8 + * __Pyx_CheckUnpickleChecksum(__pyx_checksum, 0xe3b0c44, 0xda39a3e, 0xd41d8cd, b'') + * __pyx_result = In.__new__(__pyx_type) + * if __pyx_state is not None: # <<<<<<<<<<<<<< + * __pyx_unpickle_In__set_state( __pyx_result, __pyx_state) + * return __pyx_result +*/ + } + + /* "(tree fragment)":10 + * if __pyx_state is not None: + * __pyx_unpickle_In__set_state( __pyx_result, __pyx_state) + * return __pyx_result # <<<<<<<<<<<<<< + * cdef __pyx_unpickle_In__set_state(In __pyx_result, __pyx_state: tuple): + * __Pyx_UpdateUnpickledDict(__pyx_result, __pyx_state, 0) +*/ + __Pyx_XDECREF(__pyx_r); + __Pyx_INCREF(__pyx_v___pyx_result); + __pyx_r = __pyx_v___pyx_result; + goto __pyx_L0; + + /* "(tree fragment)":4 + * int __Pyx_CheckUnpickleChecksum(long, long, long, long, const char*) except -1 + * int __Pyx_UpdateUnpickledDict(object, object, Py_ssize_t) except -1 + * def __pyx_unpickle_In(__pyx_type, long __pyx_checksum, tuple __pyx_state): # <<<<<<<<<<<<<< + * cdef object __pyx_result + * __Pyx_CheckUnpickleChecksum(__pyx_checksum, 0xe3b0c44, 0xda39a3e, 0xd41d8cd, b'') +*/ + + /* function exit code */ + __pyx_L1_error:; + __Pyx_XDECREF(__pyx_t_2); + __Pyx_XDECREF(__pyx_t_3); + __Pyx_AddTraceback("spacy.pipeline._parser_internals.ner.__pyx_unpickle_In", __pyx_clineno, __pyx_lineno, __pyx_filename); + __pyx_r = NULL; + __pyx_L0:; + __Pyx_XDECREF(__pyx_v___pyx_result); + __Pyx_XGIVEREF(__pyx_r); + __Pyx_RefNannyFinishContext(); + return __pyx_r; +} + +/* "(tree fragment)":11 + * __pyx_unpickle_In__set_state( __pyx_result, __pyx_state) + * return __pyx_result + * cdef __pyx_unpickle_In__set_state(In __pyx_result, __pyx_state: tuple): # <<<<<<<<<<<<<< + * __Pyx_UpdateUnpickledDict(__pyx_result, __pyx_state, 0) +*/ + +static PyObject *__pyx_f_5spacy_8pipeline_17_parser_internals_3ner___pyx_unpickle_In__set_state(struct __pyx_obj_5spacy_8pipeline_17_parser_internals_3ner_In *__pyx_v___pyx_result, PyObject *__pyx_v___pyx_state) { + PyObject *__pyx_r = NULL; + __Pyx_RefNannyDeclarations + int __pyx_t_1; + int __pyx_lineno = 0; + const char *__pyx_filename = NULL; + int __pyx_clineno = 0; + __Pyx_RefNannySetupContext("__pyx_unpickle_In__set_state", 0); + + /* "(tree fragment)":12 + * return __pyx_result + * cdef __pyx_unpickle_In__set_state(In __pyx_result, __pyx_state: tuple): + * __Pyx_UpdateUnpickledDict(__pyx_result, __pyx_state, 0) # <<<<<<<<<<<<<< +*/ + __pyx_t_1 = __Pyx_UpdateUnpickledDict(((PyObject *)__pyx_v___pyx_result), __pyx_v___pyx_state, 0); if (unlikely(__pyx_t_1 == ((int)-1))) __PYX_ERR(1, 12, __pyx_L1_error) + + /* "(tree fragment)":11 + * __pyx_unpickle_In__set_state( __pyx_result, __pyx_state) + * return __pyx_result + * cdef __pyx_unpickle_In__set_state(In __pyx_result, __pyx_state: tuple): # <<<<<<<<<<<<<< + * __Pyx_UpdateUnpickledDict(__pyx_result, __pyx_state, 0) +*/ + + /* function exit code */ + __pyx_r = Py_None; __Pyx_INCREF(Py_None); + goto __pyx_L0; + __pyx_L1_error:; + __Pyx_AddTraceback("spacy.pipeline._parser_internals.ner.__pyx_unpickle_In__set_state", __pyx_clineno, __pyx_lineno, __pyx_filename); + __pyx_r = 0; + __pyx_L0:; + __Pyx_XGIVEREF(__pyx_r); + __Pyx_RefNannyFinishContext(); + return __pyx_r; +} + +/* "(tree fragment)":4 + * int __Pyx_CheckUnpickleChecksum(long, long, long, long, const char*) except -1 + * int __Pyx_UpdateUnpickledDict(object, object, Py_ssize_t) except -1 + * def __pyx_unpickle_Last(__pyx_type, long __pyx_checksum, tuple __pyx_state): # <<<<<<<<<<<<<< + * cdef object __pyx_result + * __Pyx_CheckUnpickleChecksum(__pyx_checksum, 0xe3b0c44, 0xda39a3e, 0xd41d8cd, b'') +*/ + +/* Python wrapper */ +static PyObject *__pyx_pw_5spacy_8pipeline_17_parser_internals_3ner_7__pyx_unpickle_Last(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_5spacy_8pipeline_17_parser_internals_3ner_6__pyx_unpickle_Last, "__pyx_unpickle_Last(__pyx_type, long __pyx_checksum, tuple __pyx_state)"); +static PyMethodDef __pyx_mdef_5spacy_8pipeline_17_parser_internals_3ner_7__pyx_unpickle_Last = {"__pyx_unpickle_Last", (PyCFunction)(void(*)(void))(__Pyx_PyCFunction_FastCallWithKeywords)__pyx_pw_5spacy_8pipeline_17_parser_internals_3ner_7__pyx_unpickle_Last, __Pyx_METH_FASTCALL|METH_KEYWORDS, __pyx_doc_5spacy_8pipeline_17_parser_internals_3ner_6__pyx_unpickle_Last}; +static PyObject *__pyx_pw_5spacy_8pipeline_17_parser_internals_3ner_7__pyx_unpickle_Last(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 +) { + PyObject *__pyx_v___pyx_type = 0; + long __pyx_v___pyx_checksum; + 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[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("__pyx_unpickle_Last (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_type,&__pyx_mstate_global->__pyx_n_u_pyx_checksum,&__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, 4, __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(1, 4, __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(1, 4, __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(1, 4, __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, "__pyx_unpickle_Last", 0) < (0)) __PYX_ERR(1, 4, __pyx_L3_error) + for (Py_ssize_t i = __pyx_nargs; i < 3; i++) { + if (unlikely(!values[i])) { __Pyx_RaiseArgtupleInvalid("__pyx_unpickle_Last", 1, 3, 3, i); __PYX_ERR(1, 4, __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(1, 4, __pyx_L3_error) + values[1] = __Pyx_ArgRef_FASTCALL(__pyx_args, 1); + if (!CYTHON_ASSUME_SAFE_MACROS && unlikely(!values[1])) __PYX_ERR(1, 4, __pyx_L3_error) + values[2] = __Pyx_ArgRef_FASTCALL(__pyx_args, 2); + if (!CYTHON_ASSUME_SAFE_MACROS && unlikely(!values[2])) __PYX_ERR(1, 4, __pyx_L3_error) + } + __pyx_v___pyx_type = values[0]; + __pyx_v___pyx_checksum = __Pyx_PyLong_As_long(values[1]); if (unlikely((__pyx_v___pyx_checksum == (long)-1) && PyErr_Occurred())) __PYX_ERR(1, 4, __pyx_L3_error) + __pyx_v___pyx_state = ((PyObject*)values[2]); + } + goto __pyx_L6_skip; + __pyx_L5_argtuple_error:; + __Pyx_RaiseArgtupleInvalid("__pyx_unpickle_Last", 1, 3, 3, __pyx_nargs); __PYX_ERR(1, 4, __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("spacy.pipeline._parser_internals.ner.__pyx_unpickle_Last", __pyx_clineno, __pyx_lineno, __pyx_filename); + __Pyx_RefNannyFinishContext(); + return NULL; + __pyx_L4_argument_unpacking_done:; + if (unlikely(!__Pyx_ArgTypeTest(((PyObject *)__pyx_v___pyx_state), (&PyTuple_Type), 1, "__pyx_state", 1))) __PYX_ERR(1, 4, __pyx_L1_error) + __pyx_r = __pyx_pf_5spacy_8pipeline_17_parser_internals_3ner_6__pyx_unpickle_Last(__pyx_self, __pyx_v___pyx_type, __pyx_v___pyx_checksum, __pyx_v___pyx_state); + + /* 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_5spacy_8pipeline_17_parser_internals_3ner_6__pyx_unpickle_Last(CYTHON_UNUSED PyObject *__pyx_self, PyObject *__pyx_v___pyx_type, long __pyx_v___pyx_checksum, PyObject *__pyx_v___pyx_state) { + PyObject *__pyx_v___pyx_result = 0; + 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_t_5; + int __pyx_lineno = 0; + const char *__pyx_filename = NULL; + int __pyx_clineno = 0; + __Pyx_RefNannySetupContext("__pyx_unpickle_Last", 0); + + /* "(tree fragment)":6 + * def __pyx_unpickle_Last(__pyx_type, long __pyx_checksum, tuple __pyx_state): + * cdef object __pyx_result + * __Pyx_CheckUnpickleChecksum(__pyx_checksum, 0xe3b0c44, 0xda39a3e, 0xd41d8cd, b'') # <<<<<<<<<<<<<< + * __pyx_result = Last.__new__(__pyx_type) + * if __pyx_state is not None: +*/ + __pyx_t_1 = __Pyx_CheckUnpickleChecksum(__pyx_v___pyx_checksum, 0xe3b0c44, 0xda39a3e, 0xd41d8cd, ((char const *)"")); if (unlikely(__pyx_t_1 == ((int)-1))) __PYX_ERR(1, 6, __pyx_L1_error) + + /* "(tree fragment)":7 + * cdef object __pyx_result + * __Pyx_CheckUnpickleChecksum(__pyx_checksum, 0xe3b0c44, 0xda39a3e, 0xd41d8cd, b'') + * __pyx_result = Last.__new__(__pyx_type) # <<<<<<<<<<<<<< + * if __pyx_state is not None: + * __pyx_unpickle_Last__set_state( __pyx_result, __pyx_state) +*/ + __pyx_t_3 = ((PyObject *)__pyx_mstate_global->__pyx_ptype_5spacy_8pipeline_17_parser_internals_3ner_Last); + __Pyx_INCREF(__pyx_t_3); + __pyx_t_4 = 0; + { + PyObject *__pyx_callargs[2] = {__pyx_t_3, __pyx_v___pyx_type}; + __pyx_t_2 = __Pyx_PyObject_FastCallMethod((PyObject*)__pyx_mstate_global->__pyx_n_u_new, __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_2)) __PYX_ERR(1, 7, __pyx_L1_error) + __Pyx_GOTREF(__pyx_t_2); + } + __pyx_v___pyx_result = __pyx_t_2; + __pyx_t_2 = 0; + + /* "(tree fragment)":8 + * __Pyx_CheckUnpickleChecksum(__pyx_checksum, 0xe3b0c44, 0xda39a3e, 0xd41d8cd, b'') + * __pyx_result = Last.__new__(__pyx_type) + * if __pyx_state is not None: # <<<<<<<<<<<<<< + * __pyx_unpickle_Last__set_state( __pyx_result, __pyx_state) + * return __pyx_result +*/ + __pyx_t_5 = (__pyx_v___pyx_state != ((PyObject*)Py_None)); + if (__pyx_t_5) { + + /* "(tree fragment)":9 + * __pyx_result = Last.__new__(__pyx_type) + * if __pyx_state is not None: + * __pyx_unpickle_Last__set_state( __pyx_result, __pyx_state) # <<<<<<<<<<<<<< + * return __pyx_result + * cdef __pyx_unpickle_Last__set_state(Last __pyx_result, __pyx_state: tuple): +*/ + __pyx_t_2 = __pyx_f_5spacy_8pipeline_17_parser_internals_3ner___pyx_unpickle_Last__set_state(((struct __pyx_obj_5spacy_8pipeline_17_parser_internals_3ner_Last *)__pyx_v___pyx_result), __pyx_v___pyx_state); if (unlikely(!__pyx_t_2)) __PYX_ERR(1, 9, __pyx_L1_error) + __Pyx_GOTREF(__pyx_t_2); + __Pyx_DECREF(__pyx_t_2); __pyx_t_2 = 0; + + /* "(tree fragment)":8 + * __Pyx_CheckUnpickleChecksum(__pyx_checksum, 0xe3b0c44, 0xda39a3e, 0xd41d8cd, b'') + * __pyx_result = Last.__new__(__pyx_type) + * if __pyx_state is not None: # <<<<<<<<<<<<<< + * __pyx_unpickle_Last__set_state( __pyx_result, __pyx_state) + * return __pyx_result +*/ + } + + /* "(tree fragment)":10 + * if __pyx_state is not None: + * __pyx_unpickle_Last__set_state( __pyx_result, __pyx_state) + * return __pyx_result # <<<<<<<<<<<<<< + * cdef __pyx_unpickle_Last__set_state(Last __pyx_result, __pyx_state: tuple): + * __Pyx_UpdateUnpickledDict(__pyx_result, __pyx_state, 0) +*/ + __Pyx_XDECREF(__pyx_r); + __Pyx_INCREF(__pyx_v___pyx_result); + __pyx_r = __pyx_v___pyx_result; + goto __pyx_L0; + + /* "(tree fragment)":4 + * int __Pyx_CheckUnpickleChecksum(long, long, long, long, const char*) except -1 + * int __Pyx_UpdateUnpickledDict(object, object, Py_ssize_t) except -1 + * def __pyx_unpickle_Last(__pyx_type, long __pyx_checksum, tuple __pyx_state): # <<<<<<<<<<<<<< + * cdef object __pyx_result + * __Pyx_CheckUnpickleChecksum(__pyx_checksum, 0xe3b0c44, 0xda39a3e, 0xd41d8cd, b'') +*/ + + /* function exit code */ + __pyx_L1_error:; + __Pyx_XDECREF(__pyx_t_2); + __Pyx_XDECREF(__pyx_t_3); + __Pyx_AddTraceback("spacy.pipeline._parser_internals.ner.__pyx_unpickle_Last", __pyx_clineno, __pyx_lineno, __pyx_filename); + __pyx_r = NULL; + __pyx_L0:; + __Pyx_XDECREF(__pyx_v___pyx_result); + __Pyx_XGIVEREF(__pyx_r); + __Pyx_RefNannyFinishContext(); + return __pyx_r; +} + +/* "(tree fragment)":11 + * __pyx_unpickle_Last__set_state( __pyx_result, __pyx_state) + * return __pyx_result + * cdef __pyx_unpickle_Last__set_state(Last __pyx_result, __pyx_state: tuple): # <<<<<<<<<<<<<< + * __Pyx_UpdateUnpickledDict(__pyx_result, __pyx_state, 0) +*/ + +static PyObject *__pyx_f_5spacy_8pipeline_17_parser_internals_3ner___pyx_unpickle_Last__set_state(struct __pyx_obj_5spacy_8pipeline_17_parser_internals_3ner_Last *__pyx_v___pyx_result, PyObject *__pyx_v___pyx_state) { + PyObject *__pyx_r = NULL; + __Pyx_RefNannyDeclarations + int __pyx_t_1; + int __pyx_lineno = 0; + const char *__pyx_filename = NULL; + int __pyx_clineno = 0; + __Pyx_RefNannySetupContext("__pyx_unpickle_Last__set_state", 0); + + /* "(tree fragment)":12 + * return __pyx_result + * cdef __pyx_unpickle_Last__set_state(Last __pyx_result, __pyx_state: tuple): + * __Pyx_UpdateUnpickledDict(__pyx_result, __pyx_state, 0) # <<<<<<<<<<<<<< +*/ + __pyx_t_1 = __Pyx_UpdateUnpickledDict(((PyObject *)__pyx_v___pyx_result), __pyx_v___pyx_state, 0); if (unlikely(__pyx_t_1 == ((int)-1))) __PYX_ERR(1, 12, __pyx_L1_error) + + /* "(tree fragment)":11 + * __pyx_unpickle_Last__set_state( __pyx_result, __pyx_state) + * return __pyx_result + * cdef __pyx_unpickle_Last__set_state(Last __pyx_result, __pyx_state: tuple): # <<<<<<<<<<<<<< + * __Pyx_UpdateUnpickledDict(__pyx_result, __pyx_state, 0) +*/ + + /* function exit code */ + __pyx_r = Py_None; __Pyx_INCREF(Py_None); + goto __pyx_L0; + __pyx_L1_error:; + __Pyx_AddTraceback("spacy.pipeline._parser_internals.ner.__pyx_unpickle_Last__set_state", __pyx_clineno, __pyx_lineno, __pyx_filename); + __pyx_r = 0; + __pyx_L0:; + __Pyx_XGIVEREF(__pyx_r); + __Pyx_RefNannyFinishContext(); + return __pyx_r; +} + +/* "(tree fragment)":4 + * int __Pyx_CheckUnpickleChecksum(long, long, long, long, const char*) except -1 + * int __Pyx_UpdateUnpickledDict(object, object, Py_ssize_t) except -1 + * def __pyx_unpickle_Unit(__pyx_type, long __pyx_checksum, tuple __pyx_state): # <<<<<<<<<<<<<< + * cdef object __pyx_result + * __Pyx_CheckUnpickleChecksum(__pyx_checksum, 0xe3b0c44, 0xda39a3e, 0xd41d8cd, b'') +*/ + +/* Python wrapper */ +static PyObject *__pyx_pw_5spacy_8pipeline_17_parser_internals_3ner_9__pyx_unpickle_Unit(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_5spacy_8pipeline_17_parser_internals_3ner_8__pyx_unpickle_Unit, "__pyx_unpickle_Unit(__pyx_type, long __pyx_checksum, tuple __pyx_state)"); +static PyMethodDef __pyx_mdef_5spacy_8pipeline_17_parser_internals_3ner_9__pyx_unpickle_Unit = {"__pyx_unpickle_Unit", (PyCFunction)(void(*)(void))(__Pyx_PyCFunction_FastCallWithKeywords)__pyx_pw_5spacy_8pipeline_17_parser_internals_3ner_9__pyx_unpickle_Unit, __Pyx_METH_FASTCALL|METH_KEYWORDS, __pyx_doc_5spacy_8pipeline_17_parser_internals_3ner_8__pyx_unpickle_Unit}; +static PyObject *__pyx_pw_5spacy_8pipeline_17_parser_internals_3ner_9__pyx_unpickle_Unit(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 +) { + PyObject *__pyx_v___pyx_type = 0; + long __pyx_v___pyx_checksum; + 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[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("__pyx_unpickle_Unit (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_type,&__pyx_mstate_global->__pyx_n_u_pyx_checksum,&__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, 4, __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(1, 4, __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(1, 4, __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(1, 4, __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, "__pyx_unpickle_Unit", 0) < (0)) __PYX_ERR(1, 4, __pyx_L3_error) + for (Py_ssize_t i = __pyx_nargs; i < 3; i++) { + if (unlikely(!values[i])) { __Pyx_RaiseArgtupleInvalid("__pyx_unpickle_Unit", 1, 3, 3, i); __PYX_ERR(1, 4, __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(1, 4, __pyx_L3_error) + values[1] = __Pyx_ArgRef_FASTCALL(__pyx_args, 1); + if (!CYTHON_ASSUME_SAFE_MACROS && unlikely(!values[1])) __PYX_ERR(1, 4, __pyx_L3_error) + values[2] = __Pyx_ArgRef_FASTCALL(__pyx_args, 2); + if (!CYTHON_ASSUME_SAFE_MACROS && unlikely(!values[2])) __PYX_ERR(1, 4, __pyx_L3_error) + } + __pyx_v___pyx_type = values[0]; + __pyx_v___pyx_checksum = __Pyx_PyLong_As_long(values[1]); if (unlikely((__pyx_v___pyx_checksum == (long)-1) && PyErr_Occurred())) __PYX_ERR(1, 4, __pyx_L3_error) + __pyx_v___pyx_state = ((PyObject*)values[2]); + } + goto __pyx_L6_skip; + __pyx_L5_argtuple_error:; + __Pyx_RaiseArgtupleInvalid("__pyx_unpickle_Unit", 1, 3, 3, __pyx_nargs); __PYX_ERR(1, 4, __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("spacy.pipeline._parser_internals.ner.__pyx_unpickle_Unit", __pyx_clineno, __pyx_lineno, __pyx_filename); + __Pyx_RefNannyFinishContext(); + return NULL; + __pyx_L4_argument_unpacking_done:; + if (unlikely(!__Pyx_ArgTypeTest(((PyObject *)__pyx_v___pyx_state), (&PyTuple_Type), 1, "__pyx_state", 1))) __PYX_ERR(1, 4, __pyx_L1_error) + __pyx_r = __pyx_pf_5spacy_8pipeline_17_parser_internals_3ner_8__pyx_unpickle_Unit(__pyx_self, __pyx_v___pyx_type, __pyx_v___pyx_checksum, __pyx_v___pyx_state); + + /* 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_5spacy_8pipeline_17_parser_internals_3ner_8__pyx_unpickle_Unit(CYTHON_UNUSED PyObject *__pyx_self, PyObject *__pyx_v___pyx_type, long __pyx_v___pyx_checksum, PyObject *__pyx_v___pyx_state) { + PyObject *__pyx_v___pyx_result = 0; + 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_t_5; + int __pyx_lineno = 0; + const char *__pyx_filename = NULL; + int __pyx_clineno = 0; + __Pyx_RefNannySetupContext("__pyx_unpickle_Unit", 0); + + /* "(tree fragment)":6 + * def __pyx_unpickle_Unit(__pyx_type, long __pyx_checksum, tuple __pyx_state): + * cdef object __pyx_result + * __Pyx_CheckUnpickleChecksum(__pyx_checksum, 0xe3b0c44, 0xda39a3e, 0xd41d8cd, b'') # <<<<<<<<<<<<<< + * __pyx_result = Unit.__new__(__pyx_type) + * if __pyx_state is not None: +*/ + __pyx_t_1 = __Pyx_CheckUnpickleChecksum(__pyx_v___pyx_checksum, 0xe3b0c44, 0xda39a3e, 0xd41d8cd, ((char const *)"")); if (unlikely(__pyx_t_1 == ((int)-1))) __PYX_ERR(1, 6, __pyx_L1_error) + + /* "(tree fragment)":7 + * cdef object __pyx_result + * __Pyx_CheckUnpickleChecksum(__pyx_checksum, 0xe3b0c44, 0xda39a3e, 0xd41d8cd, b'') + * __pyx_result = Unit.__new__(__pyx_type) # <<<<<<<<<<<<<< + * if __pyx_state is not None: + * __pyx_unpickle_Unit__set_state( __pyx_result, __pyx_state) +*/ + __pyx_t_3 = ((PyObject *)__pyx_mstate_global->__pyx_ptype_5spacy_8pipeline_17_parser_internals_3ner_Unit); + __Pyx_INCREF(__pyx_t_3); + __pyx_t_4 = 0; + { + PyObject *__pyx_callargs[2] = {__pyx_t_3, __pyx_v___pyx_type}; + __pyx_t_2 = __Pyx_PyObject_FastCallMethod((PyObject*)__pyx_mstate_global->__pyx_n_u_new, __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_2)) __PYX_ERR(1, 7, __pyx_L1_error) + __Pyx_GOTREF(__pyx_t_2); + } + __pyx_v___pyx_result = __pyx_t_2; + __pyx_t_2 = 0; + + /* "(tree fragment)":8 + * __Pyx_CheckUnpickleChecksum(__pyx_checksum, 0xe3b0c44, 0xda39a3e, 0xd41d8cd, b'') + * __pyx_result = Unit.__new__(__pyx_type) + * if __pyx_state is not None: # <<<<<<<<<<<<<< + * __pyx_unpickle_Unit__set_state( __pyx_result, __pyx_state) + * return __pyx_result +*/ + __pyx_t_5 = (__pyx_v___pyx_state != ((PyObject*)Py_None)); + if (__pyx_t_5) { + + /* "(tree fragment)":9 + * __pyx_result = Unit.__new__(__pyx_type) + * if __pyx_state is not None: + * __pyx_unpickle_Unit__set_state( __pyx_result, __pyx_state) # <<<<<<<<<<<<<< + * return __pyx_result + * cdef __pyx_unpickle_Unit__set_state(Unit __pyx_result, __pyx_state: tuple): +*/ + __pyx_t_2 = __pyx_f_5spacy_8pipeline_17_parser_internals_3ner___pyx_unpickle_Unit__set_state(((struct __pyx_obj_5spacy_8pipeline_17_parser_internals_3ner_Unit *)__pyx_v___pyx_result), __pyx_v___pyx_state); if (unlikely(!__pyx_t_2)) __PYX_ERR(1, 9, __pyx_L1_error) + __Pyx_GOTREF(__pyx_t_2); + __Pyx_DECREF(__pyx_t_2); __pyx_t_2 = 0; + + /* "(tree fragment)":8 + * __Pyx_CheckUnpickleChecksum(__pyx_checksum, 0xe3b0c44, 0xda39a3e, 0xd41d8cd, b'') + * __pyx_result = Unit.__new__(__pyx_type) + * if __pyx_state is not None: # <<<<<<<<<<<<<< + * __pyx_unpickle_Unit__set_state( __pyx_result, __pyx_state) + * return __pyx_result +*/ + } + + /* "(tree fragment)":10 + * if __pyx_state is not None: + * __pyx_unpickle_Unit__set_state( __pyx_result, __pyx_state) + * return __pyx_result # <<<<<<<<<<<<<< + * cdef __pyx_unpickle_Unit__set_state(Unit __pyx_result, __pyx_state: tuple): + * __Pyx_UpdateUnpickledDict(__pyx_result, __pyx_state, 0) +*/ + __Pyx_XDECREF(__pyx_r); + __Pyx_INCREF(__pyx_v___pyx_result); + __pyx_r = __pyx_v___pyx_result; + goto __pyx_L0; + + /* "(tree fragment)":4 + * int __Pyx_CheckUnpickleChecksum(long, long, long, long, const char*) except -1 + * int __Pyx_UpdateUnpickledDict(object, object, Py_ssize_t) except -1 + * def __pyx_unpickle_Unit(__pyx_type, long __pyx_checksum, tuple __pyx_state): # <<<<<<<<<<<<<< + * cdef object __pyx_result + * __Pyx_CheckUnpickleChecksum(__pyx_checksum, 0xe3b0c44, 0xda39a3e, 0xd41d8cd, b'') +*/ + + /* function exit code */ + __pyx_L1_error:; + __Pyx_XDECREF(__pyx_t_2); + __Pyx_XDECREF(__pyx_t_3); + __Pyx_AddTraceback("spacy.pipeline._parser_internals.ner.__pyx_unpickle_Unit", __pyx_clineno, __pyx_lineno, __pyx_filename); + __pyx_r = NULL; + __pyx_L0:; + __Pyx_XDECREF(__pyx_v___pyx_result); + __Pyx_XGIVEREF(__pyx_r); + __Pyx_RefNannyFinishContext(); + return __pyx_r; +} + +/* "(tree fragment)":11 + * __pyx_unpickle_Unit__set_state( __pyx_result, __pyx_state) + * return __pyx_result + * cdef __pyx_unpickle_Unit__set_state(Unit __pyx_result, __pyx_state: tuple): # <<<<<<<<<<<<<< + * __Pyx_UpdateUnpickledDict(__pyx_result, __pyx_state, 0) +*/ + +static PyObject *__pyx_f_5spacy_8pipeline_17_parser_internals_3ner___pyx_unpickle_Unit__set_state(struct __pyx_obj_5spacy_8pipeline_17_parser_internals_3ner_Unit *__pyx_v___pyx_result, PyObject *__pyx_v___pyx_state) { + PyObject *__pyx_r = NULL; + __Pyx_RefNannyDeclarations + int __pyx_t_1; + int __pyx_lineno = 0; + const char *__pyx_filename = NULL; + int __pyx_clineno = 0; + __Pyx_RefNannySetupContext("__pyx_unpickle_Unit__set_state", 0); + + /* "(tree fragment)":12 + * return __pyx_result + * cdef __pyx_unpickle_Unit__set_state(Unit __pyx_result, __pyx_state: tuple): + * __Pyx_UpdateUnpickledDict(__pyx_result, __pyx_state, 0) # <<<<<<<<<<<<<< +*/ + __pyx_t_1 = __Pyx_UpdateUnpickledDict(((PyObject *)__pyx_v___pyx_result), __pyx_v___pyx_state, 0); if (unlikely(__pyx_t_1 == ((int)-1))) __PYX_ERR(1, 12, __pyx_L1_error) + + /* "(tree fragment)":11 + * __pyx_unpickle_Unit__set_state( __pyx_result, __pyx_state) + * return __pyx_result + * cdef __pyx_unpickle_Unit__set_state(Unit __pyx_result, __pyx_state: tuple): # <<<<<<<<<<<<<< + * __Pyx_UpdateUnpickledDict(__pyx_result, __pyx_state, 0) +*/ + + /* function exit code */ + __pyx_r = Py_None; __Pyx_INCREF(Py_None); + goto __pyx_L0; + __pyx_L1_error:; + __Pyx_AddTraceback("spacy.pipeline._parser_internals.ner.__pyx_unpickle_Unit__set_state", __pyx_clineno, __pyx_lineno, __pyx_filename); + __pyx_r = 0; + __pyx_L0:; + __Pyx_XGIVEREF(__pyx_r); + __Pyx_RefNannyFinishContext(); + return __pyx_r; +} + +/* "(tree fragment)":4 + * int __Pyx_CheckUnpickleChecksum(long, long, long, long, const char*) except -1 + * int __Pyx_UpdateUnpickledDict(object, object, Py_ssize_t) except -1 + * def __pyx_unpickle_Out(__pyx_type, long __pyx_checksum, tuple __pyx_state): # <<<<<<<<<<<<<< + * cdef object __pyx_result + * __Pyx_CheckUnpickleChecksum(__pyx_checksum, 0xe3b0c44, 0xda39a3e, 0xd41d8cd, b'') +*/ + +/* Python wrapper */ +static PyObject *__pyx_pw_5spacy_8pipeline_17_parser_internals_3ner_11__pyx_unpickle_Out(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_5spacy_8pipeline_17_parser_internals_3ner_10__pyx_unpickle_Out, "__pyx_unpickle_Out(__pyx_type, long __pyx_checksum, tuple __pyx_state)"); +static PyMethodDef __pyx_mdef_5spacy_8pipeline_17_parser_internals_3ner_11__pyx_unpickle_Out = {"__pyx_unpickle_Out", (PyCFunction)(void(*)(void))(__Pyx_PyCFunction_FastCallWithKeywords)__pyx_pw_5spacy_8pipeline_17_parser_internals_3ner_11__pyx_unpickle_Out, __Pyx_METH_FASTCALL|METH_KEYWORDS, __pyx_doc_5spacy_8pipeline_17_parser_internals_3ner_10__pyx_unpickle_Out}; +static PyObject *__pyx_pw_5spacy_8pipeline_17_parser_internals_3ner_11__pyx_unpickle_Out(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 +) { + PyObject *__pyx_v___pyx_type = 0; + long __pyx_v___pyx_checksum; + 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[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("__pyx_unpickle_Out (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_type,&__pyx_mstate_global->__pyx_n_u_pyx_checksum,&__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, 4, __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(1, 4, __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(1, 4, __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(1, 4, __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, "__pyx_unpickle_Out", 0) < (0)) __PYX_ERR(1, 4, __pyx_L3_error) + for (Py_ssize_t i = __pyx_nargs; i < 3; i++) { + if (unlikely(!values[i])) { __Pyx_RaiseArgtupleInvalid("__pyx_unpickle_Out", 1, 3, 3, i); __PYX_ERR(1, 4, __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(1, 4, __pyx_L3_error) + values[1] = __Pyx_ArgRef_FASTCALL(__pyx_args, 1); + if (!CYTHON_ASSUME_SAFE_MACROS && unlikely(!values[1])) __PYX_ERR(1, 4, __pyx_L3_error) + values[2] = __Pyx_ArgRef_FASTCALL(__pyx_args, 2); + if (!CYTHON_ASSUME_SAFE_MACROS && unlikely(!values[2])) __PYX_ERR(1, 4, __pyx_L3_error) + } + __pyx_v___pyx_type = values[0]; + __pyx_v___pyx_checksum = __Pyx_PyLong_As_long(values[1]); if (unlikely((__pyx_v___pyx_checksum == (long)-1) && PyErr_Occurred())) __PYX_ERR(1, 4, __pyx_L3_error) + __pyx_v___pyx_state = ((PyObject*)values[2]); + } + goto __pyx_L6_skip; + __pyx_L5_argtuple_error:; + __Pyx_RaiseArgtupleInvalid("__pyx_unpickle_Out", 1, 3, 3, __pyx_nargs); __PYX_ERR(1, 4, __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("spacy.pipeline._parser_internals.ner.__pyx_unpickle_Out", __pyx_clineno, __pyx_lineno, __pyx_filename); + __Pyx_RefNannyFinishContext(); + return NULL; + __pyx_L4_argument_unpacking_done:; + if (unlikely(!__Pyx_ArgTypeTest(((PyObject *)__pyx_v___pyx_state), (&PyTuple_Type), 1, "__pyx_state", 1))) __PYX_ERR(1, 4, __pyx_L1_error) + __pyx_r = __pyx_pf_5spacy_8pipeline_17_parser_internals_3ner_10__pyx_unpickle_Out(__pyx_self, __pyx_v___pyx_type, __pyx_v___pyx_checksum, __pyx_v___pyx_state); + + /* 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_5spacy_8pipeline_17_parser_internals_3ner_10__pyx_unpickle_Out(CYTHON_UNUSED PyObject *__pyx_self, PyObject *__pyx_v___pyx_type, long __pyx_v___pyx_checksum, PyObject *__pyx_v___pyx_state) { + PyObject *__pyx_v___pyx_result = 0; + 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_t_5; + int __pyx_lineno = 0; + const char *__pyx_filename = NULL; + int __pyx_clineno = 0; + __Pyx_RefNannySetupContext("__pyx_unpickle_Out", 0); + + /* "(tree fragment)":6 + * def __pyx_unpickle_Out(__pyx_type, long __pyx_checksum, tuple __pyx_state): + * cdef object __pyx_result + * __Pyx_CheckUnpickleChecksum(__pyx_checksum, 0xe3b0c44, 0xda39a3e, 0xd41d8cd, b'') # <<<<<<<<<<<<<< + * __pyx_result = Out.__new__(__pyx_type) + * if __pyx_state is not None: +*/ + __pyx_t_1 = __Pyx_CheckUnpickleChecksum(__pyx_v___pyx_checksum, 0xe3b0c44, 0xda39a3e, 0xd41d8cd, ((char const *)"")); if (unlikely(__pyx_t_1 == ((int)-1))) __PYX_ERR(1, 6, __pyx_L1_error) + + /* "(tree fragment)":7 + * cdef object __pyx_result + * __Pyx_CheckUnpickleChecksum(__pyx_checksum, 0xe3b0c44, 0xda39a3e, 0xd41d8cd, b'') + * __pyx_result = Out.__new__(__pyx_type) # <<<<<<<<<<<<<< + * if __pyx_state is not None: + * __pyx_unpickle_Out__set_state( __pyx_result, __pyx_state) +*/ + __pyx_t_3 = ((PyObject *)__pyx_mstate_global->__pyx_ptype_5spacy_8pipeline_17_parser_internals_3ner_Out); + __Pyx_INCREF(__pyx_t_3); + __pyx_t_4 = 0; + { + PyObject *__pyx_callargs[2] = {__pyx_t_3, __pyx_v___pyx_type}; + __pyx_t_2 = __Pyx_PyObject_FastCallMethod((PyObject*)__pyx_mstate_global->__pyx_n_u_new, __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_2)) __PYX_ERR(1, 7, __pyx_L1_error) + __Pyx_GOTREF(__pyx_t_2); + } + __pyx_v___pyx_result = __pyx_t_2; + __pyx_t_2 = 0; + + /* "(tree fragment)":8 + * __Pyx_CheckUnpickleChecksum(__pyx_checksum, 0xe3b0c44, 0xda39a3e, 0xd41d8cd, b'') + * __pyx_result = Out.__new__(__pyx_type) + * if __pyx_state is not None: # <<<<<<<<<<<<<< + * __pyx_unpickle_Out__set_state( __pyx_result, __pyx_state) + * return __pyx_result +*/ + __pyx_t_5 = (__pyx_v___pyx_state != ((PyObject*)Py_None)); + if (__pyx_t_5) { + + /* "(tree fragment)":9 + * __pyx_result = Out.__new__(__pyx_type) + * if __pyx_state is not None: + * __pyx_unpickle_Out__set_state( __pyx_result, __pyx_state) # <<<<<<<<<<<<<< + * return __pyx_result + * cdef __pyx_unpickle_Out__set_state(Out __pyx_result, __pyx_state: tuple): +*/ + __pyx_t_2 = __pyx_f_5spacy_8pipeline_17_parser_internals_3ner___pyx_unpickle_Out__set_state(((struct __pyx_obj_5spacy_8pipeline_17_parser_internals_3ner_Out *)__pyx_v___pyx_result), __pyx_v___pyx_state); if (unlikely(!__pyx_t_2)) __PYX_ERR(1, 9, __pyx_L1_error) + __Pyx_GOTREF(__pyx_t_2); + __Pyx_DECREF(__pyx_t_2); __pyx_t_2 = 0; + + /* "(tree fragment)":8 + * __Pyx_CheckUnpickleChecksum(__pyx_checksum, 0xe3b0c44, 0xda39a3e, 0xd41d8cd, b'') + * __pyx_result = Out.__new__(__pyx_type) + * if __pyx_state is not None: # <<<<<<<<<<<<<< + * __pyx_unpickle_Out__set_state( __pyx_result, __pyx_state) + * return __pyx_result +*/ + } + + /* "(tree fragment)":10 + * if __pyx_state is not None: + * __pyx_unpickle_Out__set_state( __pyx_result, __pyx_state) + * return __pyx_result # <<<<<<<<<<<<<< + * cdef __pyx_unpickle_Out__set_state(Out __pyx_result, __pyx_state: tuple): + * __Pyx_UpdateUnpickledDict(__pyx_result, __pyx_state, 0) +*/ + __Pyx_XDECREF(__pyx_r); + __Pyx_INCREF(__pyx_v___pyx_result); + __pyx_r = __pyx_v___pyx_result; + goto __pyx_L0; + + /* "(tree fragment)":4 + * int __Pyx_CheckUnpickleChecksum(long, long, long, long, const char*) except -1 + * int __Pyx_UpdateUnpickledDict(object, object, Py_ssize_t) except -1 + * def __pyx_unpickle_Out(__pyx_type, long __pyx_checksum, tuple __pyx_state): # <<<<<<<<<<<<<< + * cdef object __pyx_result + * __Pyx_CheckUnpickleChecksum(__pyx_checksum, 0xe3b0c44, 0xda39a3e, 0xd41d8cd, b'') +*/ + + /* function exit code */ + __pyx_L1_error:; + __Pyx_XDECREF(__pyx_t_2); + __Pyx_XDECREF(__pyx_t_3); + __Pyx_AddTraceback("spacy.pipeline._parser_internals.ner.__pyx_unpickle_Out", __pyx_clineno, __pyx_lineno, __pyx_filename); + __pyx_r = NULL; + __pyx_L0:; + __Pyx_XDECREF(__pyx_v___pyx_result); + __Pyx_XGIVEREF(__pyx_r); + __Pyx_RefNannyFinishContext(); + return __pyx_r; +} + +/* "(tree fragment)":11 + * __pyx_unpickle_Out__set_state( __pyx_result, __pyx_state) + * return __pyx_result + * cdef __pyx_unpickle_Out__set_state(Out __pyx_result, __pyx_state: tuple): # <<<<<<<<<<<<<< + * __Pyx_UpdateUnpickledDict(__pyx_result, __pyx_state, 0) +*/ + +static PyObject *__pyx_f_5spacy_8pipeline_17_parser_internals_3ner___pyx_unpickle_Out__set_state(struct __pyx_obj_5spacy_8pipeline_17_parser_internals_3ner_Out *__pyx_v___pyx_result, PyObject *__pyx_v___pyx_state) { + PyObject *__pyx_r = NULL; + __Pyx_RefNannyDeclarations + int __pyx_t_1; + int __pyx_lineno = 0; + const char *__pyx_filename = NULL; + int __pyx_clineno = 0; + __Pyx_RefNannySetupContext("__pyx_unpickle_Out__set_state", 0); + + /* "(tree fragment)":12 + * return __pyx_result + * cdef __pyx_unpickle_Out__set_state(Out __pyx_result, __pyx_state: tuple): + * __Pyx_UpdateUnpickledDict(__pyx_result, __pyx_state, 0) # <<<<<<<<<<<<<< +*/ + __pyx_t_1 = __Pyx_UpdateUnpickledDict(((PyObject *)__pyx_v___pyx_result), __pyx_v___pyx_state, 0); if (unlikely(__pyx_t_1 == ((int)-1))) __PYX_ERR(1, 12, __pyx_L1_error) + + /* "(tree fragment)":11 + * __pyx_unpickle_Out__set_state( __pyx_result, __pyx_state) + * return __pyx_result + * cdef __pyx_unpickle_Out__set_state(Out __pyx_result, __pyx_state: tuple): # <<<<<<<<<<<<<< + * __Pyx_UpdateUnpickledDict(__pyx_result, __pyx_state, 0) +*/ + + /* function exit code */ + __pyx_r = Py_None; __Pyx_INCREF(Py_None); + goto __pyx_L0; + __pyx_L1_error:; + __Pyx_AddTraceback("spacy.pipeline._parser_internals.ner.__pyx_unpickle_Out__set_state", __pyx_clineno, __pyx_lineno, __pyx_filename); + __pyx_r = 0; + __pyx_L0:; + __Pyx_XGIVEREF(__pyx_r); + __Pyx_RefNannyFinishContext(); + return __pyx_r; +} +/* #### Code section: module_exttypes ### */ +static struct __pyx_vtabstruct_5spacy_8pipeline_17_parser_internals_3ner_BiluoPushDown __pyx_vtable_5spacy_8pipeline_17_parser_internals_3ner_BiluoPushDown; + +static PyObject *__pyx_tp_new_5spacy_8pipeline_17_parser_internals_3ner_BiluoPushDown(PyTypeObject *t, PyObject *a, PyObject *k) { + struct __pyx_obj_5spacy_8pipeline_17_parser_internals_3ner_BiluoPushDown *p; + PyObject *o = __Pyx_PyType_GetSlot(__pyx_mstate_global->__pyx_ptype_5spacy_8pipeline_17_parser_internals_17transition_system_TransitionSystem, tp_new, newfunc)(t, a, k); + if (unlikely(!o)) return 0; + p = ((struct __pyx_obj_5spacy_8pipeline_17_parser_internals_3ner_BiluoPushDown *)o); + p->__pyx_base.__pyx_vtab = (struct __pyx_vtabstruct_5spacy_8pipeline_17_parser_internals_17transition_system_TransitionSystem*)__pyx_vtabptr_5spacy_8pipeline_17_parser_internals_3ner_BiluoPushDown; + return o; +} + +static void __pyx_tp_dealloc_5spacy_8pipeline_17_parser_internals_3ner_BiluoPushDown(PyObject *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_5spacy_8pipeline_17_parser_internals_3ner_BiluoPushDown) { + if (PyObject_CallFinalizerFromDealloc(o)) return; + } + } + #endif + PyObject_GC_UnTrack(o); + if (PyType_IS_GC(__pyx_mstate_global->__pyx_ptype_5spacy_8pipeline_17_parser_internals_17transition_system_TransitionSystem)) PyObject_GC_Track(o); + #if !CYTHON_USE_MODULE_STATE + if (likely(__pyx_mstate_global->__pyx_ptype_5spacy_8pipeline_17_parser_internals_17transition_system_TransitionSystem)) __Pyx_PyType_GetSlot(__pyx_mstate_global->__pyx_ptype_5spacy_8pipeline_17_parser_internals_17transition_system_TransitionSystem, tp_dealloc, destructor)(o); else + #endif + __Pyx_call_next_tp_dealloc(o, __pyx_tp_dealloc_5spacy_8pipeline_17_parser_internals_3ner_BiluoPushDown); +} + +static int __pyx_tp_traverse_5spacy_8pipeline_17_parser_internals_3ner_BiluoPushDown(PyObject *o, visitproc v, void *a) { + int e; + #if !CYTHON_USE_MODULE_STATE + e = 0; + if (likely(__pyx_mstate_global->__pyx_ptype_5spacy_8pipeline_17_parser_internals_17transition_system_TransitionSystem)) { + traverseproc traverse = __Pyx_PyType_GetSlot(__pyx_mstate_global->__pyx_ptype_5spacy_8pipeline_17_parser_internals_17transition_system_TransitionSystem, tp_traverse, traverseproc); + if (traverse) { e = traverse(o, v, a); } + } else + #endif + { e = __Pyx_call_next_tp_traverse(o, v, a, __pyx_tp_traverse_5spacy_8pipeline_17_parser_internals_3ner_BiluoPushDown); } + if (e) return e; + { + e = __Pyx_call_type_traverse(o, 0, v, a); + if (e) return e; + } + return 0; +} + +static int __pyx_tp_clear_5spacy_8pipeline_17_parser_internals_3ner_BiluoPushDown(PyObject *o) { + #if !CYTHON_USE_MODULE_STATE + if (likely(__pyx_mstate_global->__pyx_ptype_5spacy_8pipeline_17_parser_internals_17transition_system_TransitionSystem)) { + inquiry clear = __Pyx_PyType_GetSlot(__pyx_mstate_global->__pyx_ptype_5spacy_8pipeline_17_parser_internals_17transition_system_TransitionSystem, tp_clear, inquiry); + if (clear) clear(o); + } else + #endif + { __Pyx_call_next_tp_clear(o, __pyx_tp_clear_5spacy_8pipeline_17_parser_internals_3ner_BiluoPushDown); } + return 0; +} + +static PyObject *__pyx_getprop_5spacy_8pipeline_17_parser_internals_3ner_13BiluoPushDown_action_types(PyObject *o, CYTHON_UNUSED void *x) { + return __pyx_pw_5spacy_8pipeline_17_parser_internals_3ner_13BiluoPushDown_12action_types_1__get__(o); +} + +static PyMethodDef __pyx_methods_5spacy_8pipeline_17_parser_internals_3ner_BiluoPushDown[] = { + {"get_actions", (PyCFunction)(void(*)(void))(__Pyx_PyCFunction_FastCallWithKeywords)__pyx_pw_5spacy_8pipeline_17_parser_internals_3ner_13BiluoPushDown_3get_actions, __Pyx_METH_FASTCALL|METH_KEYWORDS, __pyx_doc_5spacy_8pipeline_17_parser_internals_3ner_13BiluoPushDown_2get_actions}, + {"get_doc_labels", (PyCFunction)(void(*)(void))(__Pyx_PyCFunction_FastCallWithKeywords)__pyx_pw_5spacy_8pipeline_17_parser_internals_3ner_13BiluoPushDown_5get_doc_labels, __Pyx_METH_FASTCALL|METH_KEYWORDS, __pyx_doc_5spacy_8pipeline_17_parser_internals_3ner_13BiluoPushDown_4get_doc_labels}, + {"move_name", (PyCFunction)(void(*)(void))(__Pyx_PyCFunction_FastCallWithKeywords)__pyx_pw_5spacy_8pipeline_17_parser_internals_3ner_13BiluoPushDown_7move_name, __Pyx_METH_FASTCALL|METH_KEYWORDS, __pyx_doc_5spacy_8pipeline_17_parser_internals_3ner_13BiluoPushDown_6move_name}, + {"init_gold_batch", (PyCFunction)(void(*)(void))(__Pyx_PyCFunction_FastCallWithKeywords)__pyx_pw_5spacy_8pipeline_17_parser_internals_3ner_13BiluoPushDown_9init_gold_batch, __Pyx_METH_FASTCALL|METH_KEYWORDS, __pyx_doc_5spacy_8pipeline_17_parser_internals_3ner_13BiluoPushDown_8init_gold_batch}, + {"add_action", (PyCFunction)(void(*)(void))(__Pyx_PyCFunction_FastCallWithKeywords)__pyx_pw_5spacy_8pipeline_17_parser_internals_3ner_13BiluoPushDown_11add_action, __Pyx_METH_FASTCALL|METH_KEYWORDS, __pyx_doc_5spacy_8pipeline_17_parser_internals_3ner_13BiluoPushDown_10add_action}, + {"set_annotations", (PyCFunction)(void(*)(void))(__Pyx_PyCFunction_FastCallWithKeywords)__pyx_pw_5spacy_8pipeline_17_parser_internals_3ner_13BiluoPushDown_13set_annotations, __Pyx_METH_FASTCALL|METH_KEYWORDS, __pyx_doc_5spacy_8pipeline_17_parser_internals_3ner_13BiluoPushDown_12set_annotations}, + {"get_beam_parses", (PyCFunction)(void(*)(void))(__Pyx_PyCFunction_FastCallWithKeywords)__pyx_pw_5spacy_8pipeline_17_parser_internals_3ner_13BiluoPushDown_15get_beam_parses, __Pyx_METH_FASTCALL|METH_KEYWORDS, __pyx_doc_5spacy_8pipeline_17_parser_internals_3ner_13BiluoPushDown_14get_beam_parses}, + {"init_gold", (PyCFunction)(void(*)(void))(__Pyx_PyCFunction_FastCallWithKeywords)__pyx_pw_5spacy_8pipeline_17_parser_internals_3ner_13BiluoPushDown_17init_gold, __Pyx_METH_FASTCALL|METH_KEYWORDS, __pyx_doc_5spacy_8pipeline_17_parser_internals_3ner_13BiluoPushDown_16init_gold}, + {"has_gold", (PyCFunction)(void(*)(void))(__Pyx_PyCFunction_FastCallWithKeywords)__pyx_pw_5spacy_8pipeline_17_parser_internals_3ner_13BiluoPushDown_19has_gold, __Pyx_METH_FASTCALL|METH_KEYWORDS, __pyx_doc_5spacy_8pipeline_17_parser_internals_3ner_13BiluoPushDown_18has_gold}, + {"get_cost", (PyCFunction)(void(*)(void))(__Pyx_PyCFunction_FastCallWithKeywords)__pyx_pw_5spacy_8pipeline_17_parser_internals_3ner_13BiluoPushDown_21get_cost, __Pyx_METH_FASTCALL|METH_KEYWORDS, __pyx_doc_5spacy_8pipeline_17_parser_internals_3ner_13BiluoPushDown_20get_cost}, + {"__reduce_cython__", (PyCFunction)(void(*)(void))(__Pyx_PyCFunction_FastCallWithKeywords)__pyx_pw_5spacy_8pipeline_17_parser_internals_3ner_13BiluoPushDown_23__reduce_cython__, __Pyx_METH_FASTCALL|METH_KEYWORDS, __pyx_doc_5spacy_8pipeline_17_parser_internals_3ner_13BiluoPushDown_22__reduce_cython__}, + {"__setstate_cython__", (PyCFunction)(void(*)(void))(__Pyx_PyCFunction_FastCallWithKeywords)__pyx_pw_5spacy_8pipeline_17_parser_internals_3ner_13BiluoPushDown_25__setstate_cython__, __Pyx_METH_FASTCALL|METH_KEYWORDS, __pyx_doc_5spacy_8pipeline_17_parser_internals_3ner_13BiluoPushDown_24__setstate_cython__}, + {0, 0, 0, 0} +}; + +static struct PyGetSetDef __pyx_getsets_5spacy_8pipeline_17_parser_internals_3ner_BiluoPushDown[] = { + {"action_types", __pyx_getprop_5spacy_8pipeline_17_parser_internals_3ner_13BiluoPushDown_action_types, 0, 0, 0}, + {0, 0, 0, 0, 0} +}; +#if CYTHON_USE_TYPE_SPECS +static PyType_Slot __pyx_type_5spacy_8pipeline_17_parser_internals_3ner_BiluoPushDown_slots[] = { + {Py_tp_dealloc, (void *)__pyx_tp_dealloc_5spacy_8pipeline_17_parser_internals_3ner_BiluoPushDown}, + {Py_tp_doc, (void *)PyDoc_STR("BiluoPushDown(*args, **kwargs)")}, + {Py_tp_traverse, (void *)__pyx_tp_traverse_5spacy_8pipeline_17_parser_internals_3ner_BiluoPushDown}, + {Py_tp_clear, (void *)__pyx_tp_clear_5spacy_8pipeline_17_parser_internals_3ner_BiluoPushDown}, + {Py_tp_methods, (void *)__pyx_methods_5spacy_8pipeline_17_parser_internals_3ner_BiluoPushDown}, + {Py_tp_getset, (void *)__pyx_getsets_5spacy_8pipeline_17_parser_internals_3ner_BiluoPushDown}, + {Py_tp_init, (void *)__pyx_pw_5spacy_8pipeline_17_parser_internals_3ner_13BiluoPushDown_1__init__}, + {Py_tp_new, (void *)__pyx_tp_new_5spacy_8pipeline_17_parser_internals_3ner_BiluoPushDown}, + {0, 0}, +}; +static PyType_Spec __pyx_type_5spacy_8pipeline_17_parser_internals_3ner_BiluoPushDown_spec = { + "spacy.pipeline._parser_internals.ner.BiluoPushDown", + sizeof(struct __pyx_obj_5spacy_8pipeline_17_parser_internals_3ner_BiluoPushDown), + 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_5spacy_8pipeline_17_parser_internals_3ner_BiluoPushDown_slots, +}; +#else + +static PyTypeObject __pyx_type_5spacy_8pipeline_17_parser_internals_3ner_BiluoPushDown = { + PyVarObject_HEAD_INIT(0, 0) + "spacy.pipeline._parser_internals.ner.""BiluoPushDown", /*tp_name*/ + sizeof(struct __pyx_obj_5spacy_8pipeline_17_parser_internals_3ner_BiluoPushDown), /*tp_basicsize*/ + 0, /*tp_itemsize*/ + __pyx_tp_dealloc_5spacy_8pipeline_17_parser_internals_3ner_BiluoPushDown, /*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("BiluoPushDown(*args, **kwargs)"), /*tp_doc*/ + __pyx_tp_traverse_5spacy_8pipeline_17_parser_internals_3ner_BiluoPushDown, /*tp_traverse*/ + __pyx_tp_clear_5spacy_8pipeline_17_parser_internals_3ner_BiluoPushDown, /*tp_clear*/ + 0, /*tp_richcompare*/ + 0, /*tp_weaklistoffset*/ + 0, /*tp_iter*/ + 0, /*tp_iternext*/ + __pyx_methods_5spacy_8pipeline_17_parser_internals_3ner_BiluoPushDown, /*tp_methods*/ + 0, /*tp_members*/ + __pyx_getsets_5spacy_8pipeline_17_parser_internals_3ner_BiluoPushDown, /*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_5spacy_8pipeline_17_parser_internals_3ner_13BiluoPushDown_1__init__, /*tp_init*/ + 0, /*tp_alloc*/ + __pyx_tp_new_5spacy_8pipeline_17_parser_internals_3ner_BiluoPushDown, /*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_5spacy_8pipeline_17_parser_internals_3ner_BiluoGold(PyTypeObject *t, CYTHON_UNUSED PyObject *a, CYTHON_UNUSED PyObject *k) { + struct __pyx_obj_5spacy_8pipeline_17_parser_internals_3ner_BiluoGold *p; + PyObject *o; + o = __Pyx_AllocateExtensionType(t, 0); + if (unlikely(!o)) return 0; + p = ((struct __pyx_obj_5spacy_8pipeline_17_parser_internals_3ner_BiluoGold *)o); + __Pyx_default_placement_construct(&(p->c)); + p->mem = ((struct __pyx_obj_5cymem_5cymem_Pool *)Py_None); Py_INCREF(Py_None); + return o; +} + +static void __pyx_tp_dealloc_5spacy_8pipeline_17_parser_internals_3ner_BiluoGold(PyObject *o) { + struct __pyx_obj_5spacy_8pipeline_17_parser_internals_3ner_BiluoGold *p = (struct __pyx_obj_5spacy_8pipeline_17_parser_internals_3ner_BiluoGold *)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_5spacy_8pipeline_17_parser_internals_3ner_BiluoGold) { + if (PyObject_CallFinalizerFromDealloc(o)) return; + } + } + #endif + PyObject_GC_UnTrack(o); + __Pyx_call_destructor(p->c); + Py_CLEAR(p->mem); + 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_5spacy_8pipeline_17_parser_internals_3ner_BiluoGold(PyObject *o, visitproc v, void *a) { + int e; + struct __pyx_obj_5spacy_8pipeline_17_parser_internals_3ner_BiluoGold *p = (struct __pyx_obj_5spacy_8pipeline_17_parser_internals_3ner_BiluoGold *)o; + { + e = __Pyx_call_type_traverse(o, 1, v, a); + if (e) return e; + } + if (p->mem) { + e = (*v)(((PyObject *)p->mem), a); if (e) return e; + } + return 0; +} + +static int __pyx_tp_clear_5spacy_8pipeline_17_parser_internals_3ner_BiluoGold(PyObject *o) { + PyObject* tmp; + struct __pyx_obj_5spacy_8pipeline_17_parser_internals_3ner_BiluoGold *p = (struct __pyx_obj_5spacy_8pipeline_17_parser_internals_3ner_BiluoGold *)o; + tmp = ((PyObject*)p->mem); + p->mem = ((struct __pyx_obj_5cymem_5cymem_Pool *)Py_None); Py_INCREF(Py_None); + Py_XDECREF(tmp); + return 0; +} + +static PyMethodDef __pyx_methods_5spacy_8pipeline_17_parser_internals_3ner_BiluoGold[] = { + {"update", (PyCFunction)(void(*)(void))(__Pyx_PyCFunction_FastCallWithKeywords)__pyx_pw_5spacy_8pipeline_17_parser_internals_3ner_9BiluoGold_3update, __Pyx_METH_FASTCALL|METH_KEYWORDS, __pyx_doc_5spacy_8pipeline_17_parser_internals_3ner_9BiluoGold_2update}, + {"__reduce_cython__", (PyCFunction)(void(*)(void))(__Pyx_PyCFunction_FastCallWithKeywords)__pyx_pw_5spacy_8pipeline_17_parser_internals_3ner_9BiluoGold_5__reduce_cython__, __Pyx_METH_FASTCALL|METH_KEYWORDS, __pyx_doc_5spacy_8pipeline_17_parser_internals_3ner_9BiluoGold_4__reduce_cython__}, + {"__setstate_cython__", (PyCFunction)(void(*)(void))(__Pyx_PyCFunction_FastCallWithKeywords)__pyx_pw_5spacy_8pipeline_17_parser_internals_3ner_9BiluoGold_7__setstate_cython__, __Pyx_METH_FASTCALL|METH_KEYWORDS, __pyx_doc_5spacy_8pipeline_17_parser_internals_3ner_9BiluoGold_6__setstate_cython__}, + {0, 0, 0, 0} +}; +#if CYTHON_USE_TYPE_SPECS +static PyType_Slot __pyx_type_5spacy_8pipeline_17_parser_internals_3ner_BiluoGold_slots[] = { + {Py_tp_dealloc, (void *)__pyx_tp_dealloc_5spacy_8pipeline_17_parser_internals_3ner_BiluoGold}, + {Py_tp_doc, (void *)PyDoc_STR("BiluoGold(BiluoPushDown moves, StateClass stcls, Example example, neg_key)")}, + {Py_tp_traverse, (void *)__pyx_tp_traverse_5spacy_8pipeline_17_parser_internals_3ner_BiluoGold}, + {Py_tp_clear, (void *)__pyx_tp_clear_5spacy_8pipeline_17_parser_internals_3ner_BiluoGold}, + {Py_tp_methods, (void *)__pyx_methods_5spacy_8pipeline_17_parser_internals_3ner_BiluoGold}, + {Py_tp_init, (void *)__pyx_pw_5spacy_8pipeline_17_parser_internals_3ner_9BiluoGold_1__init__}, + {Py_tp_new, (void *)__pyx_tp_new_5spacy_8pipeline_17_parser_internals_3ner_BiluoGold}, + {0, 0}, +}; +static PyType_Spec __pyx_type_5spacy_8pipeline_17_parser_internals_3ner_BiluoGold_spec = { + "spacy.pipeline._parser_internals.ner.BiluoGold", + sizeof(struct __pyx_obj_5spacy_8pipeline_17_parser_internals_3ner_BiluoGold), + 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_5spacy_8pipeline_17_parser_internals_3ner_BiluoGold_slots, +}; +#else + +static PyTypeObject __pyx_type_5spacy_8pipeline_17_parser_internals_3ner_BiluoGold = { + PyVarObject_HEAD_INIT(0, 0) + "spacy.pipeline._parser_internals.ner.""BiluoGold", /*tp_name*/ + sizeof(struct __pyx_obj_5spacy_8pipeline_17_parser_internals_3ner_BiluoGold), /*tp_basicsize*/ + 0, /*tp_itemsize*/ + __pyx_tp_dealloc_5spacy_8pipeline_17_parser_internals_3ner_BiluoGold, /*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("BiluoGold(BiluoPushDown moves, StateClass stcls, Example example, neg_key)"), /*tp_doc*/ + __pyx_tp_traverse_5spacy_8pipeline_17_parser_internals_3ner_BiluoGold, /*tp_traverse*/ + __pyx_tp_clear_5spacy_8pipeline_17_parser_internals_3ner_BiluoGold, /*tp_clear*/ + 0, /*tp_richcompare*/ + 0, /*tp_weaklistoffset*/ + 0, /*tp_iter*/ + 0, /*tp_iternext*/ + __pyx_methods_5spacy_8pipeline_17_parser_internals_3ner_BiluoGold, /*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_5spacy_8pipeline_17_parser_internals_3ner_9BiluoGold_1__init__, /*tp_init*/ + 0, /*tp_alloc*/ + __pyx_tp_new_5spacy_8pipeline_17_parser_internals_3ner_BiluoGold, /*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 struct __pyx_vtabstruct_5spacy_8pipeline_17_parser_internals_3ner_Missing __pyx_vtable_5spacy_8pipeline_17_parser_internals_3ner_Missing; + +static PyObject *__pyx_tp_new_5spacy_8pipeline_17_parser_internals_3ner_Missing(PyTypeObject *t, CYTHON_UNUSED PyObject *a, CYTHON_UNUSED PyObject *k) { + struct __pyx_obj_5spacy_8pipeline_17_parser_internals_3ner_Missing *p; + PyObject *o; + o = __Pyx_AllocateExtensionType(t, 0); + if (unlikely(!o)) return 0; + p = ((struct __pyx_obj_5spacy_8pipeline_17_parser_internals_3ner_Missing *)o); + p->__pyx_vtab = __pyx_vtabptr_5spacy_8pipeline_17_parser_internals_3ner_Missing; + return o; +} + +static void __pyx_tp_dealloc_5spacy_8pipeline_17_parser_internals_3ner_Missing(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_5spacy_8pipeline_17_parser_internals_3ner_Missing) { + if (PyObject_CallFinalizerFromDealloc(o)) return; + } + } + #endif + 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_5spacy_8pipeline_17_parser_internals_3ner_Missing[] = { + {"__reduce_cython__", (PyCFunction)(void(*)(void))(__Pyx_PyCFunction_FastCallWithKeywords)__pyx_pw_5spacy_8pipeline_17_parser_internals_3ner_7Missing_1__reduce_cython__, __Pyx_METH_FASTCALL|METH_KEYWORDS, __pyx_doc_5spacy_8pipeline_17_parser_internals_3ner_7Missing___reduce_cython__}, + {"__setstate_cython__", (PyCFunction)(void(*)(void))(__Pyx_PyCFunction_FastCallWithKeywords)__pyx_pw_5spacy_8pipeline_17_parser_internals_3ner_7Missing_3__setstate_cython__, __Pyx_METH_FASTCALL|METH_KEYWORDS, __pyx_doc_5spacy_8pipeline_17_parser_internals_3ner_7Missing_2__setstate_cython__}, + {0, 0, 0, 0} +}; +#if CYTHON_USE_TYPE_SPECS +static PyType_Slot __pyx_type_5spacy_8pipeline_17_parser_internals_3ner_Missing_slots[] = { + {Py_tp_dealloc, (void *)__pyx_tp_dealloc_5spacy_8pipeline_17_parser_internals_3ner_Missing}, + {Py_tp_methods, (void *)__pyx_methods_5spacy_8pipeline_17_parser_internals_3ner_Missing}, + {Py_tp_new, (void *)__pyx_tp_new_5spacy_8pipeline_17_parser_internals_3ner_Missing}, + {0, 0}, +}; +static PyType_Spec __pyx_type_5spacy_8pipeline_17_parser_internals_3ner_Missing_spec = { + "spacy.pipeline._parser_internals.ner.Missing", + sizeof(struct __pyx_obj_5spacy_8pipeline_17_parser_internals_3ner_Missing), + 0, + Py_TPFLAGS_DEFAULT|Py_TPFLAGS_HAVE_VERSION_TAG|Py_TPFLAGS_CHECKTYPES|Py_TPFLAGS_HAVE_NEWBUFFER|Py_TPFLAGS_BASETYPE, + __pyx_type_5spacy_8pipeline_17_parser_internals_3ner_Missing_slots, +}; +#else + +static PyTypeObject __pyx_type_5spacy_8pipeline_17_parser_internals_3ner_Missing = { + PyVarObject_HEAD_INIT(0, 0) + "spacy.pipeline._parser_internals.ner.""Missing", /*tp_name*/ + sizeof(struct __pyx_obj_5spacy_8pipeline_17_parser_internals_3ner_Missing), /*tp_basicsize*/ + 0, /*tp_itemsize*/ + __pyx_tp_dealloc_5spacy_8pipeline_17_parser_internals_3ner_Missing, /*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_5spacy_8pipeline_17_parser_internals_3ner_Missing, /*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_5spacy_8pipeline_17_parser_internals_3ner_Missing, /*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 struct __pyx_vtabstruct_5spacy_8pipeline_17_parser_internals_3ner_Begin __pyx_vtable_5spacy_8pipeline_17_parser_internals_3ner_Begin; + +static PyObject *__pyx_tp_new_5spacy_8pipeline_17_parser_internals_3ner_Begin(PyTypeObject *t, CYTHON_UNUSED PyObject *a, CYTHON_UNUSED PyObject *k) { + struct __pyx_obj_5spacy_8pipeline_17_parser_internals_3ner_Begin *p; + PyObject *o; + o = __Pyx_AllocateExtensionType(t, 0); + if (unlikely(!o)) return 0; + p = ((struct __pyx_obj_5spacy_8pipeline_17_parser_internals_3ner_Begin *)o); + p->__pyx_vtab = __pyx_vtabptr_5spacy_8pipeline_17_parser_internals_3ner_Begin; + return o; +} + +static void __pyx_tp_dealloc_5spacy_8pipeline_17_parser_internals_3ner_Begin(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_5spacy_8pipeline_17_parser_internals_3ner_Begin) { + if (PyObject_CallFinalizerFromDealloc(o)) return; + } + } + #endif + 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_5spacy_8pipeline_17_parser_internals_3ner_Begin[] = { + {"__reduce_cython__", (PyCFunction)(void(*)(void))(__Pyx_PyCFunction_FastCallWithKeywords)__pyx_pw_5spacy_8pipeline_17_parser_internals_3ner_5Begin_1__reduce_cython__, __Pyx_METH_FASTCALL|METH_KEYWORDS, __pyx_doc_5spacy_8pipeline_17_parser_internals_3ner_5Begin___reduce_cython__}, + {"__setstate_cython__", (PyCFunction)(void(*)(void))(__Pyx_PyCFunction_FastCallWithKeywords)__pyx_pw_5spacy_8pipeline_17_parser_internals_3ner_5Begin_3__setstate_cython__, __Pyx_METH_FASTCALL|METH_KEYWORDS, __pyx_doc_5spacy_8pipeline_17_parser_internals_3ner_5Begin_2__setstate_cython__}, + {0, 0, 0, 0} +}; +#if CYTHON_USE_TYPE_SPECS +static PyType_Slot __pyx_type_5spacy_8pipeline_17_parser_internals_3ner_Begin_slots[] = { + {Py_tp_dealloc, (void *)__pyx_tp_dealloc_5spacy_8pipeline_17_parser_internals_3ner_Begin}, + {Py_tp_methods, (void *)__pyx_methods_5spacy_8pipeline_17_parser_internals_3ner_Begin}, + {Py_tp_new, (void *)__pyx_tp_new_5spacy_8pipeline_17_parser_internals_3ner_Begin}, + {0, 0}, +}; +static PyType_Spec __pyx_type_5spacy_8pipeline_17_parser_internals_3ner_Begin_spec = { + "spacy.pipeline._parser_internals.ner.Begin", + sizeof(struct __pyx_obj_5spacy_8pipeline_17_parser_internals_3ner_Begin), + 0, + Py_TPFLAGS_DEFAULT|Py_TPFLAGS_HAVE_VERSION_TAG|Py_TPFLAGS_CHECKTYPES|Py_TPFLAGS_HAVE_NEWBUFFER|Py_TPFLAGS_BASETYPE, + __pyx_type_5spacy_8pipeline_17_parser_internals_3ner_Begin_slots, +}; +#else + +static PyTypeObject __pyx_type_5spacy_8pipeline_17_parser_internals_3ner_Begin = { + PyVarObject_HEAD_INIT(0, 0) + "spacy.pipeline._parser_internals.ner.""Begin", /*tp_name*/ + sizeof(struct __pyx_obj_5spacy_8pipeline_17_parser_internals_3ner_Begin), /*tp_basicsize*/ + 0, /*tp_itemsize*/ + __pyx_tp_dealloc_5spacy_8pipeline_17_parser_internals_3ner_Begin, /*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_5spacy_8pipeline_17_parser_internals_3ner_Begin, /*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_5spacy_8pipeline_17_parser_internals_3ner_Begin, /*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 struct __pyx_vtabstruct_5spacy_8pipeline_17_parser_internals_3ner_In __pyx_vtable_5spacy_8pipeline_17_parser_internals_3ner_In; + +static PyObject *__pyx_tp_new_5spacy_8pipeline_17_parser_internals_3ner_In(PyTypeObject *t, CYTHON_UNUSED PyObject *a, CYTHON_UNUSED PyObject *k) { + struct __pyx_obj_5spacy_8pipeline_17_parser_internals_3ner_In *p; + PyObject *o; + o = __Pyx_AllocateExtensionType(t, 0); + if (unlikely(!o)) return 0; + p = ((struct __pyx_obj_5spacy_8pipeline_17_parser_internals_3ner_In *)o); + p->__pyx_vtab = __pyx_vtabptr_5spacy_8pipeline_17_parser_internals_3ner_In; + return o; +} + +static void __pyx_tp_dealloc_5spacy_8pipeline_17_parser_internals_3ner_In(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_5spacy_8pipeline_17_parser_internals_3ner_In) { + if (PyObject_CallFinalizerFromDealloc(o)) return; + } + } + #endif + 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_5spacy_8pipeline_17_parser_internals_3ner_In[] = { + {"__reduce_cython__", (PyCFunction)(void(*)(void))(__Pyx_PyCFunction_FastCallWithKeywords)__pyx_pw_5spacy_8pipeline_17_parser_internals_3ner_2In_1__reduce_cython__, __Pyx_METH_FASTCALL|METH_KEYWORDS, __pyx_doc_5spacy_8pipeline_17_parser_internals_3ner_2In___reduce_cython__}, + {"__setstate_cython__", (PyCFunction)(void(*)(void))(__Pyx_PyCFunction_FastCallWithKeywords)__pyx_pw_5spacy_8pipeline_17_parser_internals_3ner_2In_3__setstate_cython__, __Pyx_METH_FASTCALL|METH_KEYWORDS, __pyx_doc_5spacy_8pipeline_17_parser_internals_3ner_2In_2__setstate_cython__}, + {0, 0, 0, 0} +}; +#if CYTHON_USE_TYPE_SPECS +static PyType_Slot __pyx_type_5spacy_8pipeline_17_parser_internals_3ner_In_slots[] = { + {Py_tp_dealloc, (void *)__pyx_tp_dealloc_5spacy_8pipeline_17_parser_internals_3ner_In}, + {Py_tp_methods, (void *)__pyx_methods_5spacy_8pipeline_17_parser_internals_3ner_In}, + {Py_tp_new, (void *)__pyx_tp_new_5spacy_8pipeline_17_parser_internals_3ner_In}, + {0, 0}, +}; +static PyType_Spec __pyx_type_5spacy_8pipeline_17_parser_internals_3ner_In_spec = { + "spacy.pipeline._parser_internals.ner.In", + sizeof(struct __pyx_obj_5spacy_8pipeline_17_parser_internals_3ner_In), + 0, + Py_TPFLAGS_DEFAULT|Py_TPFLAGS_HAVE_VERSION_TAG|Py_TPFLAGS_CHECKTYPES|Py_TPFLAGS_HAVE_NEWBUFFER|Py_TPFLAGS_BASETYPE, + __pyx_type_5spacy_8pipeline_17_parser_internals_3ner_In_slots, +}; +#else + +static PyTypeObject __pyx_type_5spacy_8pipeline_17_parser_internals_3ner_In = { + PyVarObject_HEAD_INIT(0, 0) + "spacy.pipeline._parser_internals.ner.""In", /*tp_name*/ + sizeof(struct __pyx_obj_5spacy_8pipeline_17_parser_internals_3ner_In), /*tp_basicsize*/ + 0, /*tp_itemsize*/ + __pyx_tp_dealloc_5spacy_8pipeline_17_parser_internals_3ner_In, /*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_5spacy_8pipeline_17_parser_internals_3ner_In, /*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_5spacy_8pipeline_17_parser_internals_3ner_In, /*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 struct __pyx_vtabstruct_5spacy_8pipeline_17_parser_internals_3ner_Last __pyx_vtable_5spacy_8pipeline_17_parser_internals_3ner_Last; + +static PyObject *__pyx_tp_new_5spacy_8pipeline_17_parser_internals_3ner_Last(PyTypeObject *t, CYTHON_UNUSED PyObject *a, CYTHON_UNUSED PyObject *k) { + struct __pyx_obj_5spacy_8pipeline_17_parser_internals_3ner_Last *p; + PyObject *o; + o = __Pyx_AllocateExtensionType(t, 0); + if (unlikely(!o)) return 0; + p = ((struct __pyx_obj_5spacy_8pipeline_17_parser_internals_3ner_Last *)o); + p->__pyx_vtab = __pyx_vtabptr_5spacy_8pipeline_17_parser_internals_3ner_Last; + return o; +} + +static void __pyx_tp_dealloc_5spacy_8pipeline_17_parser_internals_3ner_Last(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_5spacy_8pipeline_17_parser_internals_3ner_Last) { + if (PyObject_CallFinalizerFromDealloc(o)) return; + } + } + #endif + 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_5spacy_8pipeline_17_parser_internals_3ner_Last[] = { + {"__reduce_cython__", (PyCFunction)(void(*)(void))(__Pyx_PyCFunction_FastCallWithKeywords)__pyx_pw_5spacy_8pipeline_17_parser_internals_3ner_4Last_1__reduce_cython__, __Pyx_METH_FASTCALL|METH_KEYWORDS, __pyx_doc_5spacy_8pipeline_17_parser_internals_3ner_4Last___reduce_cython__}, + {"__setstate_cython__", (PyCFunction)(void(*)(void))(__Pyx_PyCFunction_FastCallWithKeywords)__pyx_pw_5spacy_8pipeline_17_parser_internals_3ner_4Last_3__setstate_cython__, __Pyx_METH_FASTCALL|METH_KEYWORDS, __pyx_doc_5spacy_8pipeline_17_parser_internals_3ner_4Last_2__setstate_cython__}, + {0, 0, 0, 0} +}; +#if CYTHON_USE_TYPE_SPECS +static PyType_Slot __pyx_type_5spacy_8pipeline_17_parser_internals_3ner_Last_slots[] = { + {Py_tp_dealloc, (void *)__pyx_tp_dealloc_5spacy_8pipeline_17_parser_internals_3ner_Last}, + {Py_tp_methods, (void *)__pyx_methods_5spacy_8pipeline_17_parser_internals_3ner_Last}, + {Py_tp_new, (void *)__pyx_tp_new_5spacy_8pipeline_17_parser_internals_3ner_Last}, + {0, 0}, +}; +static PyType_Spec __pyx_type_5spacy_8pipeline_17_parser_internals_3ner_Last_spec = { + "spacy.pipeline._parser_internals.ner.Last", + sizeof(struct __pyx_obj_5spacy_8pipeline_17_parser_internals_3ner_Last), + 0, + Py_TPFLAGS_DEFAULT|Py_TPFLAGS_HAVE_VERSION_TAG|Py_TPFLAGS_CHECKTYPES|Py_TPFLAGS_HAVE_NEWBUFFER|Py_TPFLAGS_BASETYPE, + __pyx_type_5spacy_8pipeline_17_parser_internals_3ner_Last_slots, +}; +#else + +static PyTypeObject __pyx_type_5spacy_8pipeline_17_parser_internals_3ner_Last = { + PyVarObject_HEAD_INIT(0, 0) + "spacy.pipeline._parser_internals.ner.""Last", /*tp_name*/ + sizeof(struct __pyx_obj_5spacy_8pipeline_17_parser_internals_3ner_Last), /*tp_basicsize*/ + 0, /*tp_itemsize*/ + __pyx_tp_dealloc_5spacy_8pipeline_17_parser_internals_3ner_Last, /*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_5spacy_8pipeline_17_parser_internals_3ner_Last, /*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_5spacy_8pipeline_17_parser_internals_3ner_Last, /*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 struct __pyx_vtabstruct_5spacy_8pipeline_17_parser_internals_3ner_Unit __pyx_vtable_5spacy_8pipeline_17_parser_internals_3ner_Unit; + +static PyObject *__pyx_tp_new_5spacy_8pipeline_17_parser_internals_3ner_Unit(PyTypeObject *t, CYTHON_UNUSED PyObject *a, CYTHON_UNUSED PyObject *k) { + struct __pyx_obj_5spacy_8pipeline_17_parser_internals_3ner_Unit *p; + PyObject *o; + o = __Pyx_AllocateExtensionType(t, 0); + if (unlikely(!o)) return 0; + p = ((struct __pyx_obj_5spacy_8pipeline_17_parser_internals_3ner_Unit *)o); + p->__pyx_vtab = __pyx_vtabptr_5spacy_8pipeline_17_parser_internals_3ner_Unit; + return o; +} + +static void __pyx_tp_dealloc_5spacy_8pipeline_17_parser_internals_3ner_Unit(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_5spacy_8pipeline_17_parser_internals_3ner_Unit) { + if (PyObject_CallFinalizerFromDealloc(o)) return; + } + } + #endif + 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_5spacy_8pipeline_17_parser_internals_3ner_Unit[] = { + {"__reduce_cython__", (PyCFunction)(void(*)(void))(__Pyx_PyCFunction_FastCallWithKeywords)__pyx_pw_5spacy_8pipeline_17_parser_internals_3ner_4Unit_1__reduce_cython__, __Pyx_METH_FASTCALL|METH_KEYWORDS, __pyx_doc_5spacy_8pipeline_17_parser_internals_3ner_4Unit___reduce_cython__}, + {"__setstate_cython__", (PyCFunction)(void(*)(void))(__Pyx_PyCFunction_FastCallWithKeywords)__pyx_pw_5spacy_8pipeline_17_parser_internals_3ner_4Unit_3__setstate_cython__, __Pyx_METH_FASTCALL|METH_KEYWORDS, __pyx_doc_5spacy_8pipeline_17_parser_internals_3ner_4Unit_2__setstate_cython__}, + {0, 0, 0, 0} +}; +#if CYTHON_USE_TYPE_SPECS +static PyType_Slot __pyx_type_5spacy_8pipeline_17_parser_internals_3ner_Unit_slots[] = { + {Py_tp_dealloc, (void *)__pyx_tp_dealloc_5spacy_8pipeline_17_parser_internals_3ner_Unit}, + {Py_tp_methods, (void *)__pyx_methods_5spacy_8pipeline_17_parser_internals_3ner_Unit}, + {Py_tp_new, (void *)__pyx_tp_new_5spacy_8pipeline_17_parser_internals_3ner_Unit}, + {0, 0}, +}; +static PyType_Spec __pyx_type_5spacy_8pipeline_17_parser_internals_3ner_Unit_spec = { + "spacy.pipeline._parser_internals.ner.Unit", + sizeof(struct __pyx_obj_5spacy_8pipeline_17_parser_internals_3ner_Unit), + 0, + Py_TPFLAGS_DEFAULT|Py_TPFLAGS_HAVE_VERSION_TAG|Py_TPFLAGS_CHECKTYPES|Py_TPFLAGS_HAVE_NEWBUFFER|Py_TPFLAGS_BASETYPE, + __pyx_type_5spacy_8pipeline_17_parser_internals_3ner_Unit_slots, +}; +#else + +static PyTypeObject __pyx_type_5spacy_8pipeline_17_parser_internals_3ner_Unit = { + PyVarObject_HEAD_INIT(0, 0) + "spacy.pipeline._parser_internals.ner.""Unit", /*tp_name*/ + sizeof(struct __pyx_obj_5spacy_8pipeline_17_parser_internals_3ner_Unit), /*tp_basicsize*/ + 0, /*tp_itemsize*/ + __pyx_tp_dealloc_5spacy_8pipeline_17_parser_internals_3ner_Unit, /*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_5spacy_8pipeline_17_parser_internals_3ner_Unit, /*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_5spacy_8pipeline_17_parser_internals_3ner_Unit, /*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 struct __pyx_vtabstruct_5spacy_8pipeline_17_parser_internals_3ner_Out __pyx_vtable_5spacy_8pipeline_17_parser_internals_3ner_Out; + +static PyObject *__pyx_tp_new_5spacy_8pipeline_17_parser_internals_3ner_Out(PyTypeObject *t, CYTHON_UNUSED PyObject *a, CYTHON_UNUSED PyObject *k) { + struct __pyx_obj_5spacy_8pipeline_17_parser_internals_3ner_Out *p; + PyObject *o; + o = __Pyx_AllocateExtensionType(t, 0); + if (unlikely(!o)) return 0; + p = ((struct __pyx_obj_5spacy_8pipeline_17_parser_internals_3ner_Out *)o); + p->__pyx_vtab = __pyx_vtabptr_5spacy_8pipeline_17_parser_internals_3ner_Out; + return o; +} + +static void __pyx_tp_dealloc_5spacy_8pipeline_17_parser_internals_3ner_Out(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_5spacy_8pipeline_17_parser_internals_3ner_Out) { + if (PyObject_CallFinalizerFromDealloc(o)) return; + } + } + #endif + 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_5spacy_8pipeline_17_parser_internals_3ner_Out[] = { + {"__reduce_cython__", (PyCFunction)(void(*)(void))(__Pyx_PyCFunction_FastCallWithKeywords)__pyx_pw_5spacy_8pipeline_17_parser_internals_3ner_3Out_1__reduce_cython__, __Pyx_METH_FASTCALL|METH_KEYWORDS, __pyx_doc_5spacy_8pipeline_17_parser_internals_3ner_3Out___reduce_cython__}, + {"__setstate_cython__", (PyCFunction)(void(*)(void))(__Pyx_PyCFunction_FastCallWithKeywords)__pyx_pw_5spacy_8pipeline_17_parser_internals_3ner_3Out_3__setstate_cython__, __Pyx_METH_FASTCALL|METH_KEYWORDS, __pyx_doc_5spacy_8pipeline_17_parser_internals_3ner_3Out_2__setstate_cython__}, + {0, 0, 0, 0} +}; +#if CYTHON_USE_TYPE_SPECS +static PyType_Slot __pyx_type_5spacy_8pipeline_17_parser_internals_3ner_Out_slots[] = { + {Py_tp_dealloc, (void *)__pyx_tp_dealloc_5spacy_8pipeline_17_parser_internals_3ner_Out}, + {Py_tp_methods, (void *)__pyx_methods_5spacy_8pipeline_17_parser_internals_3ner_Out}, + {Py_tp_new, (void *)__pyx_tp_new_5spacy_8pipeline_17_parser_internals_3ner_Out}, + {0, 0}, +}; +static PyType_Spec __pyx_type_5spacy_8pipeline_17_parser_internals_3ner_Out_spec = { + "spacy.pipeline._parser_internals.ner.Out", + sizeof(struct __pyx_obj_5spacy_8pipeline_17_parser_internals_3ner_Out), + 0, + Py_TPFLAGS_DEFAULT|Py_TPFLAGS_HAVE_VERSION_TAG|Py_TPFLAGS_CHECKTYPES|Py_TPFLAGS_HAVE_NEWBUFFER|Py_TPFLAGS_BASETYPE, + __pyx_type_5spacy_8pipeline_17_parser_internals_3ner_Out_slots, +}; +#else + +static PyTypeObject __pyx_type_5spacy_8pipeline_17_parser_internals_3ner_Out = { + PyVarObject_HEAD_INIT(0, 0) + "spacy.pipeline._parser_internals.ner.""Out", /*tp_name*/ + sizeof(struct __pyx_obj_5spacy_8pipeline_17_parser_internals_3ner_Out), /*tp_basicsize*/ + 0, /*tp_itemsize*/ + __pyx_tp_dealloc_5spacy_8pipeline_17_parser_internals_3ner_Out, /*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_5spacy_8pipeline_17_parser_internals_3ner_Out, /*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_5spacy_8pipeline_17_parser_internals_3ner_Out, /*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 struct __pyx_vtabstruct_array __pyx_vtable_array; + +static PyObject *__pyx_tp_new_array(PyTypeObject *t, PyObject *a, PyObject *k) { + struct __pyx_array_obj *p; + PyObject *o; + o = __Pyx_AllocateExtensionType(t, 0); + if (unlikely(!o)) return 0; + p = ((struct __pyx_array_obj *)o); + p->__pyx_vtab = __pyx_vtabptr_array; + p->mode = ((PyObject*)Py_None); Py_INCREF(Py_None); + p->_format = ((PyObject*)Py_None); Py_INCREF(Py_None); + if (unlikely(__pyx_array___cinit__(o, a, k) < 0)) goto bad; + return o; + bad: + Py_DECREF(o); o = 0; + return NULL; +} + +static void __pyx_tp_dealloc_array(PyObject *o) { + struct __pyx_array_obj *p = (struct __pyx_array_obj *)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_array) { + if (PyObject_CallFinalizerFromDealloc(o)) return; + } + } + #endif + { + PyObject *etype, *eval, *etb; + PyErr_Fetch(&etype, &eval, &etb); + __Pyx_SET_REFCNT(o, Py_REFCNT(o) + 1); + __pyx_array___dealloc__(o); + __Pyx_SET_REFCNT(o, Py_REFCNT(o) - 1); + PyErr_Restore(etype, eval, etb); + } + Py_CLEAR(p->mode); + Py_CLEAR(p->_format); + 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 PyObject *__pyx_sq_item_array(PyObject *o, Py_ssize_t i) { + PyObject *r; + PyObject *x = PyLong_FromSsize_t(i); if(!x) return 0; + #if CYTHON_USE_TYPE_SLOTS || (!CYTHON_USE_TYPE_SPECS && __PYX_LIMITED_VERSION_HEX < 0x030A0000) + r = Py_TYPE(o)->tp_as_mapping->mp_subscript(o, x); + #else + r = ((binaryfunc)PyType_GetSlot(Py_TYPE(o), Py_mp_subscript))(o, x); + #endif + Py_DECREF(x); + return r; +} + +static int __pyx_mp_ass_subscript_array(PyObject *o, PyObject *i, PyObject *v) { + if (v) { + return __pyx_array___setitem__(o, i, v); + } + else { + __Pyx_TypeName o_type_name; + o_type_name = __Pyx_PyType_GetFullyQualifiedName(Py_TYPE(o)); + PyErr_Format(PyExc_NotImplementedError, + "Subscript deletion not supported by " __Pyx_FMT_TYPENAME, o_type_name); + __Pyx_DECREF_TypeName(o_type_name); + return -1; + } +} + +static PyObject *__pyx_tp_getattro_array(PyObject *o, PyObject *n) { + PyObject *v = PyObject_GenericGetAttr(o, n); + if (!v && PyErr_ExceptionMatches(PyExc_AttributeError)) { + PyErr_Clear(); + v = __pyx_array___getattr__(o, n); + } + return v; +} + +static PyObject *__pyx_getprop___pyx_array_memview(PyObject *o, CYTHON_UNUSED void *x) { + return __pyx_pw_15View_dot_MemoryView_5array_7memview_1__get__(o); +} + +static PyMethodDef __pyx_methods_array[] = { + {"__getattr__", (PyCFunction)__pyx_array___getattr__, METH_O|METH_COEXIST, 0}, + {"__reduce_cython__", (PyCFunction)(void(*)(void))(__Pyx_PyCFunction_FastCallWithKeywords)__pyx_pw___pyx_array_1__reduce_cython__, __Pyx_METH_FASTCALL|METH_KEYWORDS, 0}, + {"__setstate_cython__", (PyCFunction)(void(*)(void))(__Pyx_PyCFunction_FastCallWithKeywords)__pyx_pw___pyx_array_3__setstate_cython__, __Pyx_METH_FASTCALL|METH_KEYWORDS, 0}, + {0, 0, 0, 0} +}; + +static struct PyGetSetDef __pyx_getsets_array[] = { + {"memview", __pyx_getprop___pyx_array_memview, 0, 0, 0}, + {0, 0, 0, 0, 0} +}; +#if CYTHON_USE_TYPE_SPECS +#if !CYTHON_COMPILING_IN_LIMITED_API + +static PyBufferProcs __pyx_tp_as_buffer_array = { + __pyx_array_getbuffer, /*bf_getbuffer*/ + 0, /*bf_releasebuffer*/ +}; +#endif +static PyType_Slot __pyx_type___pyx_array_slots[] = { + {Py_tp_dealloc, (void *)__pyx_tp_dealloc_array}, + {Py_sq_length, (void *)__pyx_array___len__}, + {Py_sq_item, (void *)__pyx_sq_item_array}, + {Py_mp_length, (void *)__pyx_array___len__}, + {Py_mp_subscript, (void *)__pyx_array___getitem__}, + {Py_mp_ass_subscript, (void *)__pyx_mp_ass_subscript_array}, + {Py_tp_getattro, (void *)__pyx_tp_getattro_array}, + #if defined(Py_bf_getbuffer) + {Py_bf_getbuffer, (void *)__pyx_array_getbuffer}, + #endif + {Py_tp_methods, (void *)__pyx_methods_array}, + {Py_tp_getset, (void *)__pyx_getsets_array}, + {Py_tp_new, (void *)__pyx_tp_new_array}, + {0, 0}, +}; +static PyType_Spec __pyx_type___pyx_array_spec = { + "spacy.pipeline._parser_internals.ner.array", + sizeof(struct __pyx_array_obj), + 0, + Py_TPFLAGS_DEFAULT|Py_TPFLAGS_HAVE_VERSION_TAG|Py_TPFLAGS_CHECKTYPES|Py_TPFLAGS_HAVE_NEWBUFFER|Py_TPFLAGS_BASETYPE|Py_TPFLAGS_SEQUENCE, + __pyx_type___pyx_array_slots, +}; +#else + +static PySequenceMethods __pyx_tp_as_sequence_array = { + __pyx_array___len__, /*sq_length*/ + 0, /*sq_concat*/ + 0, /*sq_repeat*/ + __pyx_sq_item_array, /*sq_item*/ + 0, /*sq_slice*/ + 0, /*sq_ass_item*/ + 0, /*sq_ass_slice*/ + 0, /*sq_contains*/ + 0, /*sq_inplace_concat*/ + 0, /*sq_inplace_repeat*/ +}; + +static PyMappingMethods __pyx_tp_as_mapping_array = { + __pyx_array___len__, /*mp_length*/ + __pyx_array___getitem__, /*mp_subscript*/ + __pyx_mp_ass_subscript_array, /*mp_ass_subscript*/ +}; + +static PyBufferProcs __pyx_tp_as_buffer_array = { + __pyx_array_getbuffer, /*bf_getbuffer*/ + 0, /*bf_releasebuffer*/ +}; + +static PyTypeObject __pyx_type___pyx_array = { + PyVarObject_HEAD_INIT(0, 0) + "spacy.pipeline._parser_internals.ner.""array", /*tp_name*/ + sizeof(struct __pyx_array_obj), /*tp_basicsize*/ + 0, /*tp_itemsize*/ + __pyx_tp_dealloc_array, /*tp_dealloc*/ + 0, /*tp_vectorcall_offset*/ + 0, /*tp_getattr*/ + 0, /*tp_setattr*/ + 0, /*tp_as_async*/ + 0, /*tp_repr*/ + 0, /*tp_as_number*/ + &__pyx_tp_as_sequence_array, /*tp_as_sequence*/ + &__pyx_tp_as_mapping_array, /*tp_as_mapping*/ + 0, /*tp_hash*/ + 0, /*tp_call*/ + 0, /*tp_str*/ + __pyx_tp_getattro_array, /*tp_getattro*/ + 0, /*tp_setattro*/ + &__pyx_tp_as_buffer_array, /*tp_as_buffer*/ + Py_TPFLAGS_DEFAULT|Py_TPFLAGS_HAVE_VERSION_TAG|Py_TPFLAGS_CHECKTYPES|Py_TPFLAGS_HAVE_NEWBUFFER|Py_TPFLAGS_BASETYPE|Py_TPFLAGS_SEQUENCE, /*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_array, /*tp_methods*/ + 0, /*tp_members*/ + __pyx_getsets_array, /*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_array, /*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_Enum(PyTypeObject *t, CYTHON_UNUSED PyObject *a, CYTHON_UNUSED PyObject *k) { + struct __pyx_MemviewEnum_obj *p; + PyObject *o; + o = __Pyx_AllocateExtensionType(t, 0); + if (unlikely(!o)) return 0; + p = ((struct __pyx_MemviewEnum_obj *)o); + p->name = Py_None; Py_INCREF(Py_None); + return o; +} + +static void __pyx_tp_dealloc_Enum(PyObject *o) { + struct __pyx_MemviewEnum_obj *p = (struct __pyx_MemviewEnum_obj *)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_Enum) { + if (PyObject_CallFinalizerFromDealloc(o)) return; + } + } + #endif + PyObject_GC_UnTrack(o); + Py_CLEAR(p->name); + 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_Enum(PyObject *o, visitproc v, void *a) { + int e; + struct __pyx_MemviewEnum_obj *p = (struct __pyx_MemviewEnum_obj *)o; + { + e = __Pyx_call_type_traverse(o, 1, v, a); + if (e) return e; + } + if (p->name) { + e = (*v)(p->name, a); if (e) return e; + } + return 0; +} + +static int __pyx_tp_clear_Enum(PyObject *o) { + PyObject* tmp; + struct __pyx_MemviewEnum_obj *p = (struct __pyx_MemviewEnum_obj *)o; + tmp = ((PyObject*)p->name); + p->name = Py_None; Py_INCREF(Py_None); + Py_XDECREF(tmp); + return 0; +} + +static PyMethodDef __pyx_methods_Enum[] = { + {"__reduce_cython__", (PyCFunction)(void(*)(void))(__Pyx_PyCFunction_FastCallWithKeywords)__pyx_pw___pyx_MemviewEnum_1__reduce_cython__, __Pyx_METH_FASTCALL|METH_KEYWORDS, 0}, + {"__setstate_cython__", (PyCFunction)(void(*)(void))(__Pyx_PyCFunction_FastCallWithKeywords)__pyx_pw___pyx_MemviewEnum_3__setstate_cython__, __Pyx_METH_FASTCALL|METH_KEYWORDS, 0}, + {0, 0, 0, 0} +}; +#if CYTHON_USE_TYPE_SPECS +static PyType_Slot __pyx_type___pyx_MemviewEnum_slots[] = { + {Py_tp_dealloc, (void *)__pyx_tp_dealloc_Enum}, + {Py_tp_repr, (void *)__pyx_MemviewEnum___repr__}, + {Py_tp_traverse, (void *)__pyx_tp_traverse_Enum}, + {Py_tp_clear, (void *)__pyx_tp_clear_Enum}, + {Py_tp_methods, (void *)__pyx_methods_Enum}, + {Py_tp_init, (void *)__pyx_MemviewEnum___init__}, + {Py_tp_new, (void *)__pyx_tp_new_Enum}, + {0, 0}, +}; +static PyType_Spec __pyx_type___pyx_MemviewEnum_spec = { + "spacy.pipeline._parser_internals.ner.Enum", + sizeof(struct __pyx_MemviewEnum_obj), + 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___pyx_MemviewEnum_slots, +}; +#else + +static PyTypeObject __pyx_type___pyx_MemviewEnum = { + PyVarObject_HEAD_INIT(0, 0) + "spacy.pipeline._parser_internals.ner.""Enum", /*tp_name*/ + sizeof(struct __pyx_MemviewEnum_obj), /*tp_basicsize*/ + 0, /*tp_itemsize*/ + __pyx_tp_dealloc_Enum, /*tp_dealloc*/ + 0, /*tp_vectorcall_offset*/ + 0, /*tp_getattr*/ + 0, /*tp_setattr*/ + 0, /*tp_as_async*/ + __pyx_MemviewEnum___repr__, /*tp_repr*/ + 0, /*tp_as_number*/ + 0, /*tp_as_sequence*/ + 0, /*tp_as_mapping*/ + 0, /*tp_hash*/ + 0, /*tp_call*/ + 0, /*tp_str*/ + 0, /*tp_getattro*/ + 0, /*tp_setattro*/ + 0, /*tp_as_buffer*/ + Py_TPFLAGS_DEFAULT|Py_TPFLAGS_HAVE_VERSION_TAG|Py_TPFLAGS_CHECKTYPES|Py_TPFLAGS_HAVE_NEWBUFFER|Py_TPFLAGS_BASETYPE|Py_TPFLAGS_HAVE_GC, /*tp_flags*/ + 0, /*tp_doc*/ + __pyx_tp_traverse_Enum, /*tp_traverse*/ + __pyx_tp_clear_Enum, /*tp_clear*/ + 0, /*tp_richcompare*/ + 0, /*tp_weaklistoffset*/ + 0, /*tp_iter*/ + 0, /*tp_iternext*/ + __pyx_methods_Enum, /*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_MemviewEnum___init__, /*tp_init*/ + 0, /*tp_alloc*/ + __pyx_tp_new_Enum, /*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 struct __pyx_vtabstruct_memoryview __pyx_vtable_memoryview; + +static PyObject *__pyx_tp_new_memoryview(PyTypeObject *t, PyObject *a, PyObject *k) { + struct __pyx_memoryview_obj *p; + PyObject *o; + o = __Pyx_AllocateExtensionType(t, 0); + if (unlikely(!o)) return 0; + p = ((struct __pyx_memoryview_obj *)o); + p->__pyx_vtab = __pyx_vtabptr_memoryview; + p->obj = Py_None; Py_INCREF(Py_None); + p->_size = Py_None; Py_INCREF(Py_None); + p->view.obj = NULL; + if (unlikely(__pyx_memoryview___cinit__(o, a, k) < 0)) goto bad; + return o; + bad: + Py_DECREF(o); o = 0; + return NULL; +} + +static void __pyx_tp_dealloc_memoryview(PyObject *o) { + struct __pyx_memoryview_obj *p = (struct __pyx_memoryview_obj *)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_memoryview) { + 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_memoryview___dealloc__(o); + __Pyx_SET_REFCNT(o, Py_REFCNT(o) - 1); + PyErr_Restore(etype, eval, etb); + } + Py_CLEAR(p->obj); + Py_CLEAR(p->_size); + 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_memoryview(PyObject *o, visitproc v, void *a) { + int e; + struct __pyx_memoryview_obj *p = (struct __pyx_memoryview_obj *)o; + { + e = __Pyx_call_type_traverse(o, 1, v, a); + if (e) return e; + } + if (p->obj) { + e = (*v)(p->obj, a); if (e) return e; + } + if (p->_size) { + e = (*v)(p->_size, a); if (e) return e; + } + if (p->view.obj) { + e = (*v)(p->view.obj, a); if (e) return e; + } + return 0; +} + +static int __pyx_tp_clear_memoryview(PyObject *o) { + PyObject* tmp; + struct __pyx_memoryview_obj *p = (struct __pyx_memoryview_obj *)o; + tmp = ((PyObject*)p->obj); + p->obj = Py_None; Py_INCREF(Py_None); + Py_XDECREF(tmp); + tmp = ((PyObject*)p->_size); + p->_size = Py_None; Py_INCREF(Py_None); + Py_XDECREF(tmp); + Py_CLEAR(p->view.obj); + return 0; +} + +static PyObject *__pyx_sq_item_memoryview(PyObject *o, Py_ssize_t i) { + PyObject *r; + PyObject *x = PyLong_FromSsize_t(i); if(!x) return 0; + #if CYTHON_USE_TYPE_SLOTS || (!CYTHON_USE_TYPE_SPECS && __PYX_LIMITED_VERSION_HEX < 0x030A0000) + r = Py_TYPE(o)->tp_as_mapping->mp_subscript(o, x); + #else + r = ((binaryfunc)PyType_GetSlot(Py_TYPE(o), Py_mp_subscript))(o, x); + #endif + Py_DECREF(x); + return r; +} + +static int __pyx_mp_ass_subscript_memoryview(PyObject *o, PyObject *i, PyObject *v) { + if (v) { + return __pyx_memoryview___setitem__(o, i, v); + } + else { + __Pyx_TypeName o_type_name; + o_type_name = __Pyx_PyType_GetFullyQualifiedName(Py_TYPE(o)); + PyErr_Format(PyExc_NotImplementedError, + "Subscript deletion not supported by " __Pyx_FMT_TYPENAME, o_type_name); + __Pyx_DECREF_TypeName(o_type_name); + return -1; + } +} + +static PyObject *__pyx_getprop___pyx_memoryview_T(PyObject *o, CYTHON_UNUSED void *x) { + return __pyx_pw_15View_dot_MemoryView_10memoryview_1T_1__get__(o); +} + +static PyObject *__pyx_getprop___pyx_memoryview_base(PyObject *o, CYTHON_UNUSED void *x) { + return __pyx_pw_15View_dot_MemoryView_10memoryview_4base_1__get__(o); +} + +static PyObject *__pyx_getprop___pyx_memoryview_shape(PyObject *o, CYTHON_UNUSED void *x) { + return __pyx_pw_15View_dot_MemoryView_10memoryview_5shape_1__get__(o); +} + +static PyObject *__pyx_getprop___pyx_memoryview_strides(PyObject *o, CYTHON_UNUSED void *x) { + return __pyx_pw_15View_dot_MemoryView_10memoryview_7strides_1__get__(o); +} + +static PyObject *__pyx_getprop___pyx_memoryview_suboffsets(PyObject *o, CYTHON_UNUSED void *x) { + return __pyx_pw_15View_dot_MemoryView_10memoryview_10suboffsets_1__get__(o); +} + +static PyObject *__pyx_getprop___pyx_memoryview_ndim(PyObject *o, CYTHON_UNUSED void *x) { + return __pyx_pw_15View_dot_MemoryView_10memoryview_4ndim_1__get__(o); +} + +static PyObject *__pyx_getprop___pyx_memoryview_itemsize(PyObject *o, CYTHON_UNUSED void *x) { + return __pyx_pw_15View_dot_MemoryView_10memoryview_8itemsize_1__get__(o); +} + +static PyObject *__pyx_getprop___pyx_memoryview_nbytes(PyObject *o, CYTHON_UNUSED void *x) { + return __pyx_pw_15View_dot_MemoryView_10memoryview_6nbytes_1__get__(o); +} + +static PyObject *__pyx_getprop___pyx_memoryview_size(PyObject *o, CYTHON_UNUSED void *x) { + return __pyx_pw_15View_dot_MemoryView_10memoryview_4size_1__get__(o); +} + +static PyMethodDef __pyx_methods_memoryview[] = { + {"is_c_contig", (PyCFunction)(void(*)(void))(__Pyx_PyCFunction_FastCallWithKeywords)__pyx_memoryview_is_c_contig, __Pyx_METH_FASTCALL|METH_KEYWORDS, 0}, + {"is_f_contig", (PyCFunction)(void(*)(void))(__Pyx_PyCFunction_FastCallWithKeywords)__pyx_memoryview_is_f_contig, __Pyx_METH_FASTCALL|METH_KEYWORDS, 0}, + {"copy", (PyCFunction)(void(*)(void))(__Pyx_PyCFunction_FastCallWithKeywords)__pyx_memoryview_copy, __Pyx_METH_FASTCALL|METH_KEYWORDS, 0}, + {"copy_fortran", (PyCFunction)(void(*)(void))(__Pyx_PyCFunction_FastCallWithKeywords)__pyx_memoryview_copy_fortran, __Pyx_METH_FASTCALL|METH_KEYWORDS, 0}, + {"__reduce_cython__", (PyCFunction)(void(*)(void))(__Pyx_PyCFunction_FastCallWithKeywords)__pyx_pw___pyx_memoryview_1__reduce_cython__, __Pyx_METH_FASTCALL|METH_KEYWORDS, 0}, + {"__setstate_cython__", (PyCFunction)(void(*)(void))(__Pyx_PyCFunction_FastCallWithKeywords)__pyx_pw___pyx_memoryview_3__setstate_cython__, __Pyx_METH_FASTCALL|METH_KEYWORDS, 0}, + {0, 0, 0, 0} +}; + +static struct PyGetSetDef __pyx_getsets_memoryview[] = { + {"T", __pyx_getprop___pyx_memoryview_T, 0, 0, 0}, + {"base", __pyx_getprop___pyx_memoryview_base, 0, 0, 0}, + {"shape", __pyx_getprop___pyx_memoryview_shape, 0, 0, 0}, + {"strides", __pyx_getprop___pyx_memoryview_strides, 0, 0, 0}, + {"suboffsets", __pyx_getprop___pyx_memoryview_suboffsets, 0, 0, 0}, + {"ndim", __pyx_getprop___pyx_memoryview_ndim, 0, 0, 0}, + {"itemsize", __pyx_getprop___pyx_memoryview_itemsize, 0, 0, 0}, + {"nbytes", __pyx_getprop___pyx_memoryview_nbytes, 0, 0, 0}, + {"size", __pyx_getprop___pyx_memoryview_size, 0, 0, 0}, + {0, 0, 0, 0, 0} +}; +#if CYTHON_USE_TYPE_SPECS +#if !CYTHON_COMPILING_IN_LIMITED_API + +static PyBufferProcs __pyx_tp_as_buffer_memoryview = { + __pyx_memoryview_getbuffer, /*bf_getbuffer*/ + 0, /*bf_releasebuffer*/ +}; +#endif +static PyType_Slot __pyx_type___pyx_memoryview_slots[] = { + {Py_tp_dealloc, (void *)__pyx_tp_dealloc_memoryview}, + {Py_tp_repr, (void *)__pyx_memoryview___repr__}, + {Py_sq_length, (void *)__pyx_memoryview___len__}, + {Py_sq_item, (void *)__pyx_sq_item_memoryview}, + {Py_mp_length, (void *)__pyx_memoryview___len__}, + {Py_mp_subscript, (void *)__pyx_memoryview___getitem__}, + {Py_mp_ass_subscript, (void *)__pyx_mp_ass_subscript_memoryview}, + {Py_tp_str, (void *)__pyx_memoryview___str__}, + #if defined(Py_bf_getbuffer) + {Py_bf_getbuffer, (void *)__pyx_memoryview_getbuffer}, + #endif + {Py_tp_traverse, (void *)__pyx_tp_traverse_memoryview}, + {Py_tp_clear, (void *)__pyx_tp_clear_memoryview}, + {Py_tp_methods, (void *)__pyx_methods_memoryview}, + {Py_tp_getset, (void *)__pyx_getsets_memoryview}, + {Py_tp_new, (void *)__pyx_tp_new_memoryview}, + {0, 0}, +}; +static PyType_Spec __pyx_type___pyx_memoryview_spec = { + "spacy.pipeline._parser_internals.ner.memoryview", + sizeof(struct __pyx_memoryview_obj), + 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___pyx_memoryview_slots, +}; +#else + +static PySequenceMethods __pyx_tp_as_sequence_memoryview = { + __pyx_memoryview___len__, /*sq_length*/ + 0, /*sq_concat*/ + 0, /*sq_repeat*/ + __pyx_sq_item_memoryview, /*sq_item*/ + 0, /*sq_slice*/ + 0, /*sq_ass_item*/ + 0, /*sq_ass_slice*/ + 0, /*sq_contains*/ + 0, /*sq_inplace_concat*/ + 0, /*sq_inplace_repeat*/ +}; + +static PyMappingMethods __pyx_tp_as_mapping_memoryview = { + __pyx_memoryview___len__, /*mp_length*/ + __pyx_memoryview___getitem__, /*mp_subscript*/ + __pyx_mp_ass_subscript_memoryview, /*mp_ass_subscript*/ +}; + +static PyBufferProcs __pyx_tp_as_buffer_memoryview = { + __pyx_memoryview_getbuffer, /*bf_getbuffer*/ + 0, /*bf_releasebuffer*/ +}; + +static PyTypeObject __pyx_type___pyx_memoryview = { + PyVarObject_HEAD_INIT(0, 0) + "spacy.pipeline._parser_internals.ner.""memoryview", /*tp_name*/ + sizeof(struct __pyx_memoryview_obj), /*tp_basicsize*/ + 0, /*tp_itemsize*/ + __pyx_tp_dealloc_memoryview, /*tp_dealloc*/ + 0, /*tp_vectorcall_offset*/ + 0, /*tp_getattr*/ + 0, /*tp_setattr*/ + 0, /*tp_as_async*/ + __pyx_memoryview___repr__, /*tp_repr*/ + 0, /*tp_as_number*/ + &__pyx_tp_as_sequence_memoryview, /*tp_as_sequence*/ + &__pyx_tp_as_mapping_memoryview, /*tp_as_mapping*/ + 0, /*tp_hash*/ + 0, /*tp_call*/ + __pyx_memoryview___str__, /*tp_str*/ + 0, /*tp_getattro*/ + 0, /*tp_setattro*/ + &__pyx_tp_as_buffer_memoryview, /*tp_as_buffer*/ + Py_TPFLAGS_DEFAULT|Py_TPFLAGS_HAVE_VERSION_TAG|Py_TPFLAGS_CHECKTYPES|Py_TPFLAGS_HAVE_NEWBUFFER|Py_TPFLAGS_BASETYPE|Py_TPFLAGS_HAVE_GC, /*tp_flags*/ + 0, /*tp_doc*/ + __pyx_tp_traverse_memoryview, /*tp_traverse*/ + __pyx_tp_clear_memoryview, /*tp_clear*/ + 0, /*tp_richcompare*/ + 0, /*tp_weaklistoffset*/ + 0, /*tp_iter*/ + 0, /*tp_iternext*/ + __pyx_methods_memoryview, /*tp_methods*/ + 0, /*tp_members*/ + __pyx_getsets_memoryview, /*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_memoryview, /*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 struct __pyx_vtabstruct__memoryviewslice __pyx_vtable__memoryviewslice; + +static PyObject *__pyx_tp_new__memoryviewslice(PyTypeObject *t, PyObject *a, PyObject *k) { + struct __pyx_memoryviewslice_obj *p; + PyObject *o = __pyx_tp_new_memoryview(t, a, k); + if (unlikely(!o)) return 0; + p = ((struct __pyx_memoryviewslice_obj *)o); + p->__pyx_base.__pyx_vtab = (struct __pyx_vtabstruct_memoryview*)__pyx_vtabptr__memoryviewslice; + __Pyx_default_placement_construct(&(p->from_slice)); + p->from_object = Py_None; Py_INCREF(Py_None); + p->from_slice.memview = NULL; + return o; +} + +static void __pyx_tp_dealloc__memoryviewslice(PyObject *o) { + struct __pyx_memoryviewslice_obj *p = (struct __pyx_memoryviewslice_obj *)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__memoryviewslice) { + 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_memoryviewslice___dealloc__(o); + __Pyx_SET_REFCNT(o, Py_REFCNT(o) - 1); + PyErr_Restore(etype, eval, etb); + } + __Pyx_call_destructor(p->from_slice); + Py_CLEAR(p->from_object); + PyObject_GC_Track(o); + __pyx_tp_dealloc_memoryview(o); +} + +static int __pyx_tp_traverse__memoryviewslice(PyObject *o, visitproc v, void *a) { + int e; + struct __pyx_memoryviewslice_obj *p = (struct __pyx_memoryviewslice_obj *)o; + e = __pyx_tp_traverse_memoryview(o, v, a); if (e) return e; + if (p->from_object) { + e = (*v)(p->from_object, a); if (e) return e; + } + return 0; +} + +static int __pyx_tp_clear__memoryviewslice(PyObject *o) { + PyObject* tmp; + struct __pyx_memoryviewslice_obj *p = (struct __pyx_memoryviewslice_obj *)o; + __pyx_tp_clear_memoryview(o); + tmp = ((PyObject*)p->from_object); + p->from_object = Py_None; Py_INCREF(Py_None); + Py_XDECREF(tmp); + __PYX_XCLEAR_MEMVIEW(&p->from_slice, 1); + return 0; +} + +static PyMethodDef __pyx_methods__memoryviewslice[] = { + {"__reduce_cython__", (PyCFunction)(void(*)(void))(__Pyx_PyCFunction_FastCallWithKeywords)__pyx_pw___pyx_memoryviewslice_1__reduce_cython__, __Pyx_METH_FASTCALL|METH_KEYWORDS, 0}, + {"__setstate_cython__", (PyCFunction)(void(*)(void))(__Pyx_PyCFunction_FastCallWithKeywords)__pyx_pw___pyx_memoryviewslice_3__setstate_cython__, __Pyx_METH_FASTCALL|METH_KEYWORDS, 0}, + {0, 0, 0, 0} +}; +#if CYTHON_USE_TYPE_SPECS +static PyType_Slot __pyx_type___pyx_memoryviewslice_slots[] = { + {Py_tp_dealloc, (void *)__pyx_tp_dealloc__memoryviewslice}, + {Py_tp_doc, (void *)PyDoc_STR("Internal class for passing memoryview slices to Python")}, + {Py_tp_traverse, (void *)__pyx_tp_traverse__memoryviewslice}, + {Py_tp_clear, (void *)__pyx_tp_clear__memoryviewslice}, + {Py_tp_methods, (void *)__pyx_methods__memoryviewslice}, + {Py_tp_new, (void *)__pyx_tp_new__memoryviewslice}, + {0, 0}, +}; +static PyType_Spec __pyx_type___pyx_memoryviewslice_spec = { + "spacy.pipeline._parser_internals.ner._memoryviewslice", + sizeof(struct __pyx_memoryviewslice_obj), + 0, + Py_TPFLAGS_DEFAULT|Py_TPFLAGS_HAVE_VERSION_TAG|Py_TPFLAGS_CHECKTYPES|Py_TPFLAGS_HAVE_NEWBUFFER|Py_TPFLAGS_BASETYPE|Py_TPFLAGS_HAVE_GC|Py_TPFLAGS_SEQUENCE, + __pyx_type___pyx_memoryviewslice_slots, +}; +#else + +static PyTypeObject __pyx_type___pyx_memoryviewslice = { + PyVarObject_HEAD_INIT(0, 0) + "spacy.pipeline._parser_internals.ner.""_memoryviewslice", /*tp_name*/ + sizeof(struct __pyx_memoryviewslice_obj), /*tp_basicsize*/ + 0, /*tp_itemsize*/ + __pyx_tp_dealloc__memoryviewslice, /*tp_dealloc*/ + 0, /*tp_vectorcall_offset*/ + 0, /*tp_getattr*/ + 0, /*tp_setattr*/ + 0, /*tp_as_async*/ + #if CYTHON_COMPILING_IN_PYPY || 0 + __pyx_memoryview___repr__, /*tp_repr*/ + #else + 0, /*tp_repr*/ + #endif + 0, /*tp_as_number*/ + 0, /*tp_as_sequence*/ + 0, /*tp_as_mapping*/ + 0, /*tp_hash*/ + 0, /*tp_call*/ + #if CYTHON_COMPILING_IN_PYPY || 0 + __pyx_memoryview___str__, /*tp_str*/ + #else + 0, /*tp_str*/ + #endif + 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|Py_TPFLAGS_SEQUENCE, /*tp_flags*/ + PyDoc_STR("Internal class for passing memoryview slices to Python"), /*tp_doc*/ + __pyx_tp_traverse__memoryviewslice, /*tp_traverse*/ + __pyx_tp_clear__memoryviewslice, /*tp_clear*/ + 0, /*tp_richcompare*/ + 0, /*tp_weaklistoffset*/ + 0, /*tp_iter*/ + 0, /*tp_iternext*/ + __pyx_methods__memoryviewslice, /*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__memoryviewslice, /*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_collections_abc_Sequence = Py_None; Py_INCREF(Py_None); + generic = Py_None; Py_INCREF(Py_None); + strided = Py_None; Py_INCREF(Py_None); + indirect = Py_None; Py_INCREF(Py_None); + contiguous = Py_None; Py_INCREF(Py_None); + indirect_contiguous = Py_None; Py_INCREF(Py_None); + __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); + PyObject *__pyx_t_1 = NULL; + PyObject *__pyx_t_2 = NULL; + int __pyx_lineno = 0; + const char *__pyx_filename = NULL; + int __pyx_clineno = 0; + __Pyx_RefNannySetupContext("__Pyx_modinit_type_init_code", 0); + /*--- Type init code ---*/ + __pyx_t_1 = PyImport_ImportModule("spacy.pipeline._parser_internals.transition_system"); if (unlikely(!__pyx_t_1)) __PYX_ERR(0, 1, __pyx_L1_error) + __Pyx_GOTREF(__pyx_t_1); + __pyx_mstate->__pyx_ptype_5spacy_8pipeline_17_parser_internals_17transition_system_TransitionSystem = __Pyx_ImportType_3_2_1(__pyx_t_1, "spacy.pipeline._parser_internals.transition_system", "TransitionSystem", + #if defined(PYPY_VERSION_NUM) && PYPY_VERSION_NUM < 0x050B0000 + sizeof(struct __pyx_obj_5spacy_8pipeline_17_parser_internals_17transition_system_TransitionSystem), __PYX_GET_STRUCT_ALIGNMENT_3_2_1(struct __pyx_obj_5spacy_8pipeline_17_parser_internals_17transition_system_TransitionSystem), + #elif CYTHON_COMPILING_IN_LIMITED_API + sizeof(struct __pyx_obj_5spacy_8pipeline_17_parser_internals_17transition_system_TransitionSystem), __PYX_GET_STRUCT_ALIGNMENT_3_2_1(struct __pyx_obj_5spacy_8pipeline_17_parser_internals_17transition_system_TransitionSystem), + #else + sizeof(struct __pyx_obj_5spacy_8pipeline_17_parser_internals_17transition_system_TransitionSystem), __PYX_GET_STRUCT_ALIGNMENT_3_2_1(struct __pyx_obj_5spacy_8pipeline_17_parser_internals_17transition_system_TransitionSystem), + #endif + __Pyx_ImportType_CheckSize_Warn_3_2_1); if (!__pyx_mstate->__pyx_ptype_5spacy_8pipeline_17_parser_internals_17transition_system_TransitionSystem) __PYX_ERR(0, 1, __pyx_L1_error) + __pyx_vtabptr_5spacy_8pipeline_17_parser_internals_17transition_system_TransitionSystem = (struct __pyx_vtabstruct_5spacy_8pipeline_17_parser_internals_17transition_system_TransitionSystem*)__Pyx_GetVtable(__pyx_mstate->__pyx_ptype_5spacy_8pipeline_17_parser_internals_17transition_system_TransitionSystem); if (unlikely(!__pyx_vtabptr_5spacy_8pipeline_17_parser_internals_17transition_system_TransitionSystem)) __PYX_ERR(0, 1, __pyx_L1_error) + __pyx_vtabptr_5spacy_8pipeline_17_parser_internals_3ner_BiluoPushDown = &__pyx_vtable_5spacy_8pipeline_17_parser_internals_3ner_BiluoPushDown; + __pyx_vtable_5spacy_8pipeline_17_parser_internals_3ner_BiluoPushDown.__pyx_base = *__pyx_vtabptr_5spacy_8pipeline_17_parser_internals_17transition_system_TransitionSystem; + __pyx_vtable_5spacy_8pipeline_17_parser_internals_3ner_BiluoPushDown.__pyx_base.lookup_transition = (struct __pyx_t_5spacy_8pipeline_17_parser_internals_17transition_system_Transition (*)(struct __pyx_obj_5spacy_8pipeline_17_parser_internals_17transition_system_TransitionSystem *, PyObject *))__pyx_f_5spacy_8pipeline_17_parser_internals_3ner_13BiluoPushDown_lookup_transition; + __pyx_vtable_5spacy_8pipeline_17_parser_internals_3ner_BiluoPushDown.__pyx_base.init_transition = (struct __pyx_t_5spacy_8pipeline_17_parser_internals_17transition_system_Transition (*)(struct __pyx_obj_5spacy_8pipeline_17_parser_internals_17transition_system_TransitionSystem *, int, int, __pyx_t_5spacy_8typedefs_attr_t))__pyx_f_5spacy_8pipeline_17_parser_internals_3ner_13BiluoPushDown_init_transition; + __pyx_vtable_5spacy_8pipeline_17_parser_internals_3ner_BiluoPushDown.__pyx_base.set_costs = (int (*)(struct __pyx_obj_5spacy_8pipeline_17_parser_internals_17transition_system_TransitionSystem *, int *, __pyx_t_5spacy_8typedefs_weight_t *, __pyx_t_5spacy_8pipeline_17_parser_internals_6_state_StateC const *, PyObject *))__pyx_f_5spacy_8pipeline_17_parser_internals_3ner_13BiluoPushDown_set_costs; + #if CYTHON_USE_TYPE_SPECS + __pyx_t_2 = PyTuple_Pack(1, (PyObject *)__pyx_mstate_global->__pyx_ptype_5spacy_8pipeline_17_parser_internals_17transition_system_TransitionSystem); if (unlikely(!__pyx_t_2)) __PYX_ERR(0, 127, __pyx_L1_error) + __Pyx_GOTREF(__pyx_t_2); + __pyx_mstate->__pyx_ptype_5spacy_8pipeline_17_parser_internals_3ner_BiluoPushDown = (PyTypeObject *) __Pyx_PyType_FromModuleAndSpec(__pyx_m, &__pyx_type_5spacy_8pipeline_17_parser_internals_3ner_BiluoPushDown_spec, __pyx_t_2); + __Pyx_XDECREF(__pyx_t_2); __pyx_t_2 = 0; + if (unlikely(!__pyx_mstate->__pyx_ptype_5spacy_8pipeline_17_parser_internals_3ner_BiluoPushDown)) __PYX_ERR(0, 127, __pyx_L1_error) + if (__Pyx_fix_up_extension_type_from_spec(&__pyx_type_5spacy_8pipeline_17_parser_internals_3ner_BiluoPushDown_spec, __pyx_mstate->__pyx_ptype_5spacy_8pipeline_17_parser_internals_3ner_BiluoPushDown) < (0)) __PYX_ERR(0, 127, __pyx_L1_error) + #else + __pyx_mstate->__pyx_ptype_5spacy_8pipeline_17_parser_internals_3ner_BiluoPushDown = &__pyx_type_5spacy_8pipeline_17_parser_internals_3ner_BiluoPushDown; + #endif + #if !CYTHON_COMPILING_IN_LIMITED_API + __pyx_mstate_global->__pyx_ptype_5spacy_8pipeline_17_parser_internals_3ner_BiluoPushDown->tp_base = __pyx_mstate_global->__pyx_ptype_5spacy_8pipeline_17_parser_internals_17transition_system_TransitionSystem; + #endif + #if !CYTHON_USE_TYPE_SPECS + if (__Pyx_PyType_Ready(__pyx_mstate->__pyx_ptype_5spacy_8pipeline_17_parser_internals_3ner_BiluoPushDown) < (0)) __PYX_ERR(0, 127, __pyx_L1_error) + #endif + #if CYTHON_COMPILING_IN_CPYTHON && PY_VERSION_HEX >= 0x030E0000 + PyUnstable_Object_EnableDeferredRefcount((PyObject*)__pyx_mstate->__pyx_ptype_5spacy_8pipeline_17_parser_internals_3ner_BiluoPushDown); + #endif + #if !CYTHON_COMPILING_IN_LIMITED_API + if ((CYTHON_USE_TYPE_SLOTS && CYTHON_USE_PYTYPE_LOOKUP) && likely(!__pyx_mstate->__pyx_ptype_5spacy_8pipeline_17_parser_internals_3ner_BiluoPushDown->tp_dictoffset && __pyx_mstate->__pyx_ptype_5spacy_8pipeline_17_parser_internals_3ner_BiluoPushDown->tp_getattro == PyObject_GenericGetAttr)) { + __pyx_mstate->__pyx_ptype_5spacy_8pipeline_17_parser_internals_3ner_BiluoPushDown->tp_getattro = PyObject_GenericGetAttr; + } + #endif + if (__Pyx_SetVtable(__pyx_mstate->__pyx_ptype_5spacy_8pipeline_17_parser_internals_3ner_BiluoPushDown, __pyx_vtabptr_5spacy_8pipeline_17_parser_internals_3ner_BiluoPushDown) < (0)) __PYX_ERR(0, 127, __pyx_L1_error) + if (__Pyx_MergeVtables(__pyx_mstate->__pyx_ptype_5spacy_8pipeline_17_parser_internals_3ner_BiluoPushDown) < (0)) __PYX_ERR(0, 127, __pyx_L1_error) + if (PyObject_SetAttr(__pyx_m, __pyx_mstate_global->__pyx_n_u_BiluoPushDown, (PyObject *) __pyx_mstate->__pyx_ptype_5spacy_8pipeline_17_parser_internals_3ner_BiluoPushDown) < (0)) __PYX_ERR(0, 127, __pyx_L1_error) + if (__Pyx_setup_reduce((PyObject *) __pyx_mstate->__pyx_ptype_5spacy_8pipeline_17_parser_internals_3ner_BiluoPushDown) < (0)) __PYX_ERR(0, 127, __pyx_L1_error) + #if CYTHON_USE_TYPE_SPECS + __pyx_mstate->__pyx_ptype_5spacy_8pipeline_17_parser_internals_3ner_BiluoGold = (PyTypeObject *) __Pyx_PyType_FromModuleAndSpec(__pyx_m, &__pyx_type_5spacy_8pipeline_17_parser_internals_3ner_BiluoGold_spec, NULL); if (unlikely(!__pyx_mstate->__pyx_ptype_5spacy_8pipeline_17_parser_internals_3ner_BiluoGold)) __PYX_ERR(0, 55, __pyx_L1_error) + if (__Pyx_fix_up_extension_type_from_spec(&__pyx_type_5spacy_8pipeline_17_parser_internals_3ner_BiluoGold_spec, __pyx_mstate->__pyx_ptype_5spacy_8pipeline_17_parser_internals_3ner_BiluoGold) < (0)) __PYX_ERR(0, 55, __pyx_L1_error) + #else + __pyx_mstate->__pyx_ptype_5spacy_8pipeline_17_parser_internals_3ner_BiluoGold = &__pyx_type_5spacy_8pipeline_17_parser_internals_3ner_BiluoGold; + #endif + #if !CYTHON_COMPILING_IN_LIMITED_API + #endif + #if !CYTHON_USE_TYPE_SPECS + if (__Pyx_PyType_Ready(__pyx_mstate->__pyx_ptype_5spacy_8pipeline_17_parser_internals_3ner_BiluoGold) < (0)) __PYX_ERR(0, 55, __pyx_L1_error) + #endif + #if CYTHON_COMPILING_IN_CPYTHON && PY_VERSION_HEX >= 0x030E0000 + PyUnstable_Object_EnableDeferredRefcount((PyObject*)__pyx_mstate->__pyx_ptype_5spacy_8pipeline_17_parser_internals_3ner_BiluoGold); + #endif + #if !CYTHON_COMPILING_IN_LIMITED_API + if ((CYTHON_USE_TYPE_SLOTS && CYTHON_USE_PYTYPE_LOOKUP) && likely(!__pyx_mstate->__pyx_ptype_5spacy_8pipeline_17_parser_internals_3ner_BiluoGold->tp_dictoffset && __pyx_mstate->__pyx_ptype_5spacy_8pipeline_17_parser_internals_3ner_BiluoGold->tp_getattro == PyObject_GenericGetAttr)) { + __pyx_mstate->__pyx_ptype_5spacy_8pipeline_17_parser_internals_3ner_BiluoGold->tp_getattro = PyObject_GenericGetAttr; + } + #endif + if (PyObject_SetAttr(__pyx_m, __pyx_mstate_global->__pyx_n_u_BiluoGold, (PyObject *) __pyx_mstate->__pyx_ptype_5spacy_8pipeline_17_parser_internals_3ner_BiluoGold) < (0)) __PYX_ERR(0, 55, __pyx_L1_error) + if (__Pyx_setup_reduce((PyObject *) __pyx_mstate->__pyx_ptype_5spacy_8pipeline_17_parser_internals_3ner_BiluoGold) < (0)) __PYX_ERR(0, 55, __pyx_L1_error) + __pyx_vtabptr_5spacy_8pipeline_17_parser_internals_3ner_Missing = &__pyx_vtable_5spacy_8pipeline_17_parser_internals_3ner_Missing; + __pyx_vtable_5spacy_8pipeline_17_parser_internals_3ner_Missing.is_valid = (int (*)(__pyx_t_5spacy_8pipeline_17_parser_internals_6_state_StateC const *, __pyx_t_5spacy_8typedefs_attr_t))__pyx_f_5spacy_8pipeline_17_parser_internals_3ner_7Missing_is_valid; + __pyx_vtable_5spacy_8pipeline_17_parser_internals_3ner_Missing.transition = (int (*)(__pyx_t_5spacy_8pipeline_17_parser_internals_6_state_StateC *, __pyx_t_5spacy_8typedefs_attr_t))__pyx_f_5spacy_8pipeline_17_parser_internals_3ner_7Missing_transition; + __pyx_vtable_5spacy_8pipeline_17_parser_internals_3ner_Missing.cost = (__pyx_t_5spacy_8typedefs_weight_t (*)(__pyx_t_5spacy_8pipeline_17_parser_internals_6_state_StateC const *, void const *, __pyx_t_5spacy_8typedefs_attr_t))__pyx_f_5spacy_8pipeline_17_parser_internals_3ner_7Missing_cost; + #if CYTHON_USE_TYPE_SPECS + __pyx_mstate->__pyx_ptype_5spacy_8pipeline_17_parser_internals_3ner_Missing = (PyTypeObject *) __Pyx_PyType_FromModuleAndSpec(__pyx_m, &__pyx_type_5spacy_8pipeline_17_parser_internals_3ner_Missing_spec, NULL); if (unlikely(!__pyx_mstate->__pyx_ptype_5spacy_8pipeline_17_parser_internals_3ner_Missing)) __PYX_ERR(0, 348, __pyx_L1_error) + if (__Pyx_fix_up_extension_type_from_spec(&__pyx_type_5spacy_8pipeline_17_parser_internals_3ner_Missing_spec, __pyx_mstate->__pyx_ptype_5spacy_8pipeline_17_parser_internals_3ner_Missing) < (0)) __PYX_ERR(0, 348, __pyx_L1_error) + #else + __pyx_mstate->__pyx_ptype_5spacy_8pipeline_17_parser_internals_3ner_Missing = &__pyx_type_5spacy_8pipeline_17_parser_internals_3ner_Missing; + #endif + #if !CYTHON_COMPILING_IN_LIMITED_API + #endif + #if !CYTHON_USE_TYPE_SPECS + if (__Pyx_PyType_Ready(__pyx_mstate->__pyx_ptype_5spacy_8pipeline_17_parser_internals_3ner_Missing) < (0)) __PYX_ERR(0, 348, __pyx_L1_error) + #endif + #if CYTHON_COMPILING_IN_CPYTHON && PY_VERSION_HEX >= 0x030E0000 + PyUnstable_Object_EnableDeferredRefcount((PyObject*)__pyx_mstate->__pyx_ptype_5spacy_8pipeline_17_parser_internals_3ner_Missing); + #endif + #if !CYTHON_COMPILING_IN_LIMITED_API + if ((CYTHON_USE_TYPE_SLOTS && CYTHON_USE_PYTYPE_LOOKUP) && likely(!__pyx_mstate->__pyx_ptype_5spacy_8pipeline_17_parser_internals_3ner_Missing->tp_dictoffset && __pyx_mstate->__pyx_ptype_5spacy_8pipeline_17_parser_internals_3ner_Missing->tp_getattro == PyObject_GenericGetAttr)) { + __pyx_mstate->__pyx_ptype_5spacy_8pipeline_17_parser_internals_3ner_Missing->tp_getattro = PyObject_GenericGetAttr; + } + #endif + if (__Pyx_SetVtable(__pyx_mstate->__pyx_ptype_5spacy_8pipeline_17_parser_internals_3ner_Missing, __pyx_vtabptr_5spacy_8pipeline_17_parser_internals_3ner_Missing) < (0)) __PYX_ERR(0, 348, __pyx_L1_error) + if (__Pyx_MergeVtables(__pyx_mstate->__pyx_ptype_5spacy_8pipeline_17_parser_internals_3ner_Missing) < (0)) __PYX_ERR(0, 348, __pyx_L1_error) + if (PyObject_SetAttr(__pyx_m, __pyx_mstate_global->__pyx_n_u_Missing, (PyObject *) __pyx_mstate->__pyx_ptype_5spacy_8pipeline_17_parser_internals_3ner_Missing) < (0)) __PYX_ERR(0, 348, __pyx_L1_error) + if (__Pyx_setup_reduce((PyObject *) __pyx_mstate->__pyx_ptype_5spacy_8pipeline_17_parser_internals_3ner_Missing) < (0)) __PYX_ERR(0, 348, __pyx_L1_error) + __pyx_vtabptr_5spacy_8pipeline_17_parser_internals_3ner_Begin = &__pyx_vtable_5spacy_8pipeline_17_parser_internals_3ner_Begin; + __pyx_vtable_5spacy_8pipeline_17_parser_internals_3ner_Begin.is_valid = (int (*)(__pyx_t_5spacy_8pipeline_17_parser_internals_6_state_StateC const *, __pyx_t_5spacy_8typedefs_attr_t))__pyx_f_5spacy_8pipeline_17_parser_internals_3ner_5Begin_is_valid; + __pyx_vtable_5spacy_8pipeline_17_parser_internals_3ner_Begin.transition = (int (*)(__pyx_t_5spacy_8pipeline_17_parser_internals_6_state_StateC *, __pyx_t_5spacy_8typedefs_attr_t))__pyx_f_5spacy_8pipeline_17_parser_internals_3ner_5Begin_transition; + __pyx_vtable_5spacy_8pipeline_17_parser_internals_3ner_Begin.cost = (__pyx_t_5spacy_8typedefs_weight_t (*)(__pyx_t_5spacy_8pipeline_17_parser_internals_6_state_StateC const *, void const *, __pyx_t_5spacy_8typedefs_attr_t))__pyx_f_5spacy_8pipeline_17_parser_internals_3ner_5Begin_cost; + #if CYTHON_USE_TYPE_SPECS + __pyx_mstate->__pyx_ptype_5spacy_8pipeline_17_parser_internals_3ner_Begin = (PyTypeObject *) __Pyx_PyType_FromModuleAndSpec(__pyx_m, &__pyx_type_5spacy_8pipeline_17_parser_internals_3ner_Begin_spec, NULL); if (unlikely(!__pyx_mstate->__pyx_ptype_5spacy_8pipeline_17_parser_internals_3ner_Begin)) __PYX_ERR(0, 362, __pyx_L1_error) + if (__Pyx_fix_up_extension_type_from_spec(&__pyx_type_5spacy_8pipeline_17_parser_internals_3ner_Begin_spec, __pyx_mstate->__pyx_ptype_5spacy_8pipeline_17_parser_internals_3ner_Begin) < (0)) __PYX_ERR(0, 362, __pyx_L1_error) + #else + __pyx_mstate->__pyx_ptype_5spacy_8pipeline_17_parser_internals_3ner_Begin = &__pyx_type_5spacy_8pipeline_17_parser_internals_3ner_Begin; + #endif + #if !CYTHON_COMPILING_IN_LIMITED_API + #endif + #if !CYTHON_USE_TYPE_SPECS + if (__Pyx_PyType_Ready(__pyx_mstate->__pyx_ptype_5spacy_8pipeline_17_parser_internals_3ner_Begin) < (0)) __PYX_ERR(0, 362, __pyx_L1_error) + #endif + #if CYTHON_COMPILING_IN_CPYTHON && PY_VERSION_HEX >= 0x030E0000 + PyUnstable_Object_EnableDeferredRefcount((PyObject*)__pyx_mstate->__pyx_ptype_5spacy_8pipeline_17_parser_internals_3ner_Begin); + #endif + #if !CYTHON_COMPILING_IN_LIMITED_API + if ((CYTHON_USE_TYPE_SLOTS && CYTHON_USE_PYTYPE_LOOKUP) && likely(!__pyx_mstate->__pyx_ptype_5spacy_8pipeline_17_parser_internals_3ner_Begin->tp_dictoffset && __pyx_mstate->__pyx_ptype_5spacy_8pipeline_17_parser_internals_3ner_Begin->tp_getattro == PyObject_GenericGetAttr)) { + __pyx_mstate->__pyx_ptype_5spacy_8pipeline_17_parser_internals_3ner_Begin->tp_getattro = PyObject_GenericGetAttr; + } + #endif + if (__Pyx_SetVtable(__pyx_mstate->__pyx_ptype_5spacy_8pipeline_17_parser_internals_3ner_Begin, __pyx_vtabptr_5spacy_8pipeline_17_parser_internals_3ner_Begin) < (0)) __PYX_ERR(0, 362, __pyx_L1_error) + if (__Pyx_MergeVtables(__pyx_mstate->__pyx_ptype_5spacy_8pipeline_17_parser_internals_3ner_Begin) < (0)) __PYX_ERR(0, 362, __pyx_L1_error) + if (PyObject_SetAttr(__pyx_m, __pyx_mstate_global->__pyx_n_u_Begin, (PyObject *) __pyx_mstate->__pyx_ptype_5spacy_8pipeline_17_parser_internals_3ner_Begin) < (0)) __PYX_ERR(0, 362, __pyx_L1_error) + if (__Pyx_setup_reduce((PyObject *) __pyx_mstate->__pyx_ptype_5spacy_8pipeline_17_parser_internals_3ner_Begin) < (0)) __PYX_ERR(0, 362, __pyx_L1_error) + __pyx_vtabptr_5spacy_8pipeline_17_parser_internals_3ner_In = &__pyx_vtable_5spacy_8pipeline_17_parser_internals_3ner_In; + __pyx_vtable_5spacy_8pipeline_17_parser_internals_3ner_In.is_valid = (int (*)(__pyx_t_5spacy_8pipeline_17_parser_internals_6_state_StateC const *, __pyx_t_5spacy_8typedefs_attr_t))__pyx_f_5spacy_8pipeline_17_parser_internals_3ner_2In_is_valid; + __pyx_vtable_5spacy_8pipeline_17_parser_internals_3ner_In.transition = (int (*)(__pyx_t_5spacy_8pipeline_17_parser_internals_6_state_StateC *, __pyx_t_5spacy_8typedefs_attr_t))__pyx_f_5spacy_8pipeline_17_parser_internals_3ner_2In_transition; + __pyx_vtable_5spacy_8pipeline_17_parser_internals_3ner_In.cost = (__pyx_t_5spacy_8typedefs_weight_t (*)(__pyx_t_5spacy_8pipeline_17_parser_internals_6_state_StateC const *, void const *, __pyx_t_5spacy_8typedefs_attr_t))__pyx_f_5spacy_8pipeline_17_parser_internals_3ner_2In_cost; + #if CYTHON_USE_TYPE_SPECS + __pyx_mstate->__pyx_ptype_5spacy_8pipeline_17_parser_internals_3ner_In = (PyTypeObject *) __Pyx_PyType_FromModuleAndSpec(__pyx_m, &__pyx_type_5spacy_8pipeline_17_parser_internals_3ner_In_spec, NULL); if (unlikely(!__pyx_mstate->__pyx_ptype_5spacy_8pipeline_17_parser_internals_3ner_In)) __PYX_ERR(0, 440, __pyx_L1_error) + if (__Pyx_fix_up_extension_type_from_spec(&__pyx_type_5spacy_8pipeline_17_parser_internals_3ner_In_spec, __pyx_mstate->__pyx_ptype_5spacy_8pipeline_17_parser_internals_3ner_In) < (0)) __PYX_ERR(0, 440, __pyx_L1_error) + #else + __pyx_mstate->__pyx_ptype_5spacy_8pipeline_17_parser_internals_3ner_In = &__pyx_type_5spacy_8pipeline_17_parser_internals_3ner_In; + #endif + #if !CYTHON_COMPILING_IN_LIMITED_API + #endif + #if !CYTHON_USE_TYPE_SPECS + if (__Pyx_PyType_Ready(__pyx_mstate->__pyx_ptype_5spacy_8pipeline_17_parser_internals_3ner_In) < (0)) __PYX_ERR(0, 440, __pyx_L1_error) + #endif + #if CYTHON_COMPILING_IN_CPYTHON && PY_VERSION_HEX >= 0x030E0000 + PyUnstable_Object_EnableDeferredRefcount((PyObject*)__pyx_mstate->__pyx_ptype_5spacy_8pipeline_17_parser_internals_3ner_In); + #endif + #if !CYTHON_COMPILING_IN_LIMITED_API + if ((CYTHON_USE_TYPE_SLOTS && CYTHON_USE_PYTYPE_LOOKUP) && likely(!__pyx_mstate->__pyx_ptype_5spacy_8pipeline_17_parser_internals_3ner_In->tp_dictoffset && __pyx_mstate->__pyx_ptype_5spacy_8pipeline_17_parser_internals_3ner_In->tp_getattro == PyObject_GenericGetAttr)) { + __pyx_mstate->__pyx_ptype_5spacy_8pipeline_17_parser_internals_3ner_In->tp_getattro = PyObject_GenericGetAttr; + } + #endif + if (__Pyx_SetVtable(__pyx_mstate->__pyx_ptype_5spacy_8pipeline_17_parser_internals_3ner_In, __pyx_vtabptr_5spacy_8pipeline_17_parser_internals_3ner_In) < (0)) __PYX_ERR(0, 440, __pyx_L1_error) + if (__Pyx_MergeVtables(__pyx_mstate->__pyx_ptype_5spacy_8pipeline_17_parser_internals_3ner_In) < (0)) __PYX_ERR(0, 440, __pyx_L1_error) + if (PyObject_SetAttr(__pyx_m, __pyx_mstate_global->__pyx_n_u_In, (PyObject *) __pyx_mstate->__pyx_ptype_5spacy_8pipeline_17_parser_internals_3ner_In) < (0)) __PYX_ERR(0, 440, __pyx_L1_error) + if (__Pyx_setup_reduce((PyObject *) __pyx_mstate->__pyx_ptype_5spacy_8pipeline_17_parser_internals_3ner_In) < (0)) __PYX_ERR(0, 440, __pyx_L1_error) + __pyx_vtabptr_5spacy_8pipeline_17_parser_internals_3ner_Last = &__pyx_vtable_5spacy_8pipeline_17_parser_internals_3ner_Last; + __pyx_vtable_5spacy_8pipeline_17_parser_internals_3ner_Last.is_valid = (int (*)(__pyx_t_5spacy_8pipeline_17_parser_internals_6_state_StateC const *, __pyx_t_5spacy_8typedefs_attr_t))__pyx_f_5spacy_8pipeline_17_parser_internals_3ner_4Last_is_valid; + __pyx_vtable_5spacy_8pipeline_17_parser_internals_3ner_Last.transition = (int (*)(__pyx_t_5spacy_8pipeline_17_parser_internals_6_state_StateC *, __pyx_t_5spacy_8typedefs_attr_t))__pyx_f_5spacy_8pipeline_17_parser_internals_3ner_4Last_transition; + __pyx_vtable_5spacy_8pipeline_17_parser_internals_3ner_Last.cost = (__pyx_t_5spacy_8typedefs_weight_t (*)(__pyx_t_5spacy_8pipeline_17_parser_internals_6_state_StateC const *, void const *, __pyx_t_5spacy_8typedefs_attr_t))__pyx_f_5spacy_8pipeline_17_parser_internals_3ner_4Last_cost; + #if CYTHON_USE_TYPE_SPECS + __pyx_mstate->__pyx_ptype_5spacy_8pipeline_17_parser_internals_3ner_Last = (PyTypeObject *) __Pyx_PyType_FromModuleAndSpec(__pyx_m, &__pyx_type_5spacy_8pipeline_17_parser_internals_3ner_Last_spec, NULL); if (unlikely(!__pyx_mstate->__pyx_ptype_5spacy_8pipeline_17_parser_internals_3ner_Last)) __PYX_ERR(0, 511, __pyx_L1_error) + if (__Pyx_fix_up_extension_type_from_spec(&__pyx_type_5spacy_8pipeline_17_parser_internals_3ner_Last_spec, __pyx_mstate->__pyx_ptype_5spacy_8pipeline_17_parser_internals_3ner_Last) < (0)) __PYX_ERR(0, 511, __pyx_L1_error) + #else + __pyx_mstate->__pyx_ptype_5spacy_8pipeline_17_parser_internals_3ner_Last = &__pyx_type_5spacy_8pipeline_17_parser_internals_3ner_Last; + #endif + #if !CYTHON_COMPILING_IN_LIMITED_API + #endif + #if !CYTHON_USE_TYPE_SPECS + if (__Pyx_PyType_Ready(__pyx_mstate->__pyx_ptype_5spacy_8pipeline_17_parser_internals_3ner_Last) < (0)) __PYX_ERR(0, 511, __pyx_L1_error) + #endif + #if CYTHON_COMPILING_IN_CPYTHON && PY_VERSION_HEX >= 0x030E0000 + PyUnstable_Object_EnableDeferredRefcount((PyObject*)__pyx_mstate->__pyx_ptype_5spacy_8pipeline_17_parser_internals_3ner_Last); + #endif + #if !CYTHON_COMPILING_IN_LIMITED_API + if ((CYTHON_USE_TYPE_SLOTS && CYTHON_USE_PYTYPE_LOOKUP) && likely(!__pyx_mstate->__pyx_ptype_5spacy_8pipeline_17_parser_internals_3ner_Last->tp_dictoffset && __pyx_mstate->__pyx_ptype_5spacy_8pipeline_17_parser_internals_3ner_Last->tp_getattro == PyObject_GenericGetAttr)) { + __pyx_mstate->__pyx_ptype_5spacy_8pipeline_17_parser_internals_3ner_Last->tp_getattro = PyObject_GenericGetAttr; + } + #endif + if (__Pyx_SetVtable(__pyx_mstate->__pyx_ptype_5spacy_8pipeline_17_parser_internals_3ner_Last, __pyx_vtabptr_5spacy_8pipeline_17_parser_internals_3ner_Last) < (0)) __PYX_ERR(0, 511, __pyx_L1_error) + if (__Pyx_MergeVtables(__pyx_mstate->__pyx_ptype_5spacy_8pipeline_17_parser_internals_3ner_Last) < (0)) __PYX_ERR(0, 511, __pyx_L1_error) + if (PyObject_SetAttr(__pyx_m, __pyx_mstate_global->__pyx_n_u_Last, (PyObject *) __pyx_mstate->__pyx_ptype_5spacy_8pipeline_17_parser_internals_3ner_Last) < (0)) __PYX_ERR(0, 511, __pyx_L1_error) + if (__Pyx_setup_reduce((PyObject *) __pyx_mstate->__pyx_ptype_5spacy_8pipeline_17_parser_internals_3ner_Last) < (0)) __PYX_ERR(0, 511, __pyx_L1_error) + __pyx_vtabptr_5spacy_8pipeline_17_parser_internals_3ner_Unit = &__pyx_vtable_5spacy_8pipeline_17_parser_internals_3ner_Unit; + __pyx_vtable_5spacy_8pipeline_17_parser_internals_3ner_Unit.is_valid = (int (*)(__pyx_t_5spacy_8pipeline_17_parser_internals_6_state_StateC const *, __pyx_t_5spacy_8typedefs_attr_t))__pyx_f_5spacy_8pipeline_17_parser_internals_3ner_4Unit_is_valid; + __pyx_vtable_5spacy_8pipeline_17_parser_internals_3ner_Unit.transition = (int (*)(__pyx_t_5spacy_8pipeline_17_parser_internals_6_state_StateC *, __pyx_t_5spacy_8typedefs_attr_t))__pyx_f_5spacy_8pipeline_17_parser_internals_3ner_4Unit_transition; + __pyx_vtable_5spacy_8pipeline_17_parser_internals_3ner_Unit.cost = (__pyx_t_5spacy_8typedefs_weight_t (*)(__pyx_t_5spacy_8pipeline_17_parser_internals_6_state_StateC const *, void const *, __pyx_t_5spacy_8typedefs_attr_t))__pyx_f_5spacy_8pipeline_17_parser_internals_3ner_4Unit_cost; + #if CYTHON_USE_TYPE_SPECS + __pyx_mstate->__pyx_ptype_5spacy_8pipeline_17_parser_internals_3ner_Unit = (PyTypeObject *) __Pyx_PyType_FromModuleAndSpec(__pyx_m, &__pyx_type_5spacy_8pipeline_17_parser_internals_3ner_Unit_spec, NULL); if (unlikely(!__pyx_mstate->__pyx_ptype_5spacy_8pipeline_17_parser_internals_3ner_Unit)) __PYX_ERR(0, 582, __pyx_L1_error) + if (__Pyx_fix_up_extension_type_from_spec(&__pyx_type_5spacy_8pipeline_17_parser_internals_3ner_Unit_spec, __pyx_mstate->__pyx_ptype_5spacy_8pipeline_17_parser_internals_3ner_Unit) < (0)) __PYX_ERR(0, 582, __pyx_L1_error) + #else + __pyx_mstate->__pyx_ptype_5spacy_8pipeline_17_parser_internals_3ner_Unit = &__pyx_type_5spacy_8pipeline_17_parser_internals_3ner_Unit; + #endif + #if !CYTHON_COMPILING_IN_LIMITED_API + #endif + #if !CYTHON_USE_TYPE_SPECS + if (__Pyx_PyType_Ready(__pyx_mstate->__pyx_ptype_5spacy_8pipeline_17_parser_internals_3ner_Unit) < (0)) __PYX_ERR(0, 582, __pyx_L1_error) + #endif + #if CYTHON_COMPILING_IN_CPYTHON && PY_VERSION_HEX >= 0x030E0000 + PyUnstable_Object_EnableDeferredRefcount((PyObject*)__pyx_mstate->__pyx_ptype_5spacy_8pipeline_17_parser_internals_3ner_Unit); + #endif + #if !CYTHON_COMPILING_IN_LIMITED_API + if ((CYTHON_USE_TYPE_SLOTS && CYTHON_USE_PYTYPE_LOOKUP) && likely(!__pyx_mstate->__pyx_ptype_5spacy_8pipeline_17_parser_internals_3ner_Unit->tp_dictoffset && __pyx_mstate->__pyx_ptype_5spacy_8pipeline_17_parser_internals_3ner_Unit->tp_getattro == PyObject_GenericGetAttr)) { + __pyx_mstate->__pyx_ptype_5spacy_8pipeline_17_parser_internals_3ner_Unit->tp_getattro = PyObject_GenericGetAttr; + } + #endif + if (__Pyx_SetVtable(__pyx_mstate->__pyx_ptype_5spacy_8pipeline_17_parser_internals_3ner_Unit, __pyx_vtabptr_5spacy_8pipeline_17_parser_internals_3ner_Unit) < (0)) __PYX_ERR(0, 582, __pyx_L1_error) + if (__Pyx_MergeVtables(__pyx_mstate->__pyx_ptype_5spacy_8pipeline_17_parser_internals_3ner_Unit) < (0)) __PYX_ERR(0, 582, __pyx_L1_error) + if (PyObject_SetAttr(__pyx_m, __pyx_mstate_global->__pyx_n_u_Unit, (PyObject *) __pyx_mstate->__pyx_ptype_5spacy_8pipeline_17_parser_internals_3ner_Unit) < (0)) __PYX_ERR(0, 582, __pyx_L1_error) + if (__Pyx_setup_reduce((PyObject *) __pyx_mstate->__pyx_ptype_5spacy_8pipeline_17_parser_internals_3ner_Unit) < (0)) __PYX_ERR(0, 582, __pyx_L1_error) + __pyx_vtabptr_5spacy_8pipeline_17_parser_internals_3ner_Out = &__pyx_vtable_5spacy_8pipeline_17_parser_internals_3ner_Out; + __pyx_vtable_5spacy_8pipeline_17_parser_internals_3ner_Out.is_valid = (int (*)(__pyx_t_5spacy_8pipeline_17_parser_internals_6_state_StateC const *, __pyx_t_5spacy_8typedefs_attr_t))__pyx_f_5spacy_8pipeline_17_parser_internals_3ner_3Out_is_valid; + __pyx_vtable_5spacy_8pipeline_17_parser_internals_3ner_Out.transition = (int (*)(__pyx_t_5spacy_8pipeline_17_parser_internals_6_state_StateC *, __pyx_t_5spacy_8typedefs_attr_t))__pyx_f_5spacy_8pipeline_17_parser_internals_3ner_3Out_transition; + __pyx_vtable_5spacy_8pipeline_17_parser_internals_3ner_Out.cost = (__pyx_t_5spacy_8typedefs_weight_t (*)(__pyx_t_5spacy_8pipeline_17_parser_internals_6_state_StateC const *, void const *, __pyx_t_5spacy_8typedefs_attr_t))__pyx_f_5spacy_8pipeline_17_parser_internals_3ner_3Out_cost; + #if CYTHON_USE_TYPE_SPECS + __pyx_mstate->__pyx_ptype_5spacy_8pipeline_17_parser_internals_3ner_Out = (PyTypeObject *) __Pyx_PyType_FromModuleAndSpec(__pyx_m, &__pyx_type_5spacy_8pipeline_17_parser_internals_3ner_Out_spec, NULL); if (unlikely(!__pyx_mstate->__pyx_ptype_5spacy_8pipeline_17_parser_internals_3ner_Out)) __PYX_ERR(0, 647, __pyx_L1_error) + if (__Pyx_fix_up_extension_type_from_spec(&__pyx_type_5spacy_8pipeline_17_parser_internals_3ner_Out_spec, __pyx_mstate->__pyx_ptype_5spacy_8pipeline_17_parser_internals_3ner_Out) < (0)) __PYX_ERR(0, 647, __pyx_L1_error) + #else + __pyx_mstate->__pyx_ptype_5spacy_8pipeline_17_parser_internals_3ner_Out = &__pyx_type_5spacy_8pipeline_17_parser_internals_3ner_Out; + #endif + #if !CYTHON_COMPILING_IN_LIMITED_API + #endif + #if !CYTHON_USE_TYPE_SPECS + if (__Pyx_PyType_Ready(__pyx_mstate->__pyx_ptype_5spacy_8pipeline_17_parser_internals_3ner_Out) < (0)) __PYX_ERR(0, 647, __pyx_L1_error) + #endif + #if CYTHON_COMPILING_IN_CPYTHON && PY_VERSION_HEX >= 0x030E0000 + PyUnstable_Object_EnableDeferredRefcount((PyObject*)__pyx_mstate->__pyx_ptype_5spacy_8pipeline_17_parser_internals_3ner_Out); + #endif + #if !CYTHON_COMPILING_IN_LIMITED_API + if ((CYTHON_USE_TYPE_SLOTS && CYTHON_USE_PYTYPE_LOOKUP) && likely(!__pyx_mstate->__pyx_ptype_5spacy_8pipeline_17_parser_internals_3ner_Out->tp_dictoffset && __pyx_mstate->__pyx_ptype_5spacy_8pipeline_17_parser_internals_3ner_Out->tp_getattro == PyObject_GenericGetAttr)) { + __pyx_mstate->__pyx_ptype_5spacy_8pipeline_17_parser_internals_3ner_Out->tp_getattro = PyObject_GenericGetAttr; + } + #endif + if (__Pyx_SetVtable(__pyx_mstate->__pyx_ptype_5spacy_8pipeline_17_parser_internals_3ner_Out, __pyx_vtabptr_5spacy_8pipeline_17_parser_internals_3ner_Out) < (0)) __PYX_ERR(0, 647, __pyx_L1_error) + if (__Pyx_MergeVtables(__pyx_mstate->__pyx_ptype_5spacy_8pipeline_17_parser_internals_3ner_Out) < (0)) __PYX_ERR(0, 647, __pyx_L1_error) + if (PyObject_SetAttr(__pyx_m, __pyx_mstate_global->__pyx_n_u_Out, (PyObject *) __pyx_mstate->__pyx_ptype_5spacy_8pipeline_17_parser_internals_3ner_Out) < (0)) __PYX_ERR(0, 647, __pyx_L1_error) + if (__Pyx_setup_reduce((PyObject *) __pyx_mstate->__pyx_ptype_5spacy_8pipeline_17_parser_internals_3ner_Out) < (0)) __PYX_ERR(0, 647, __pyx_L1_error) + __pyx_vtabptr_array = &__pyx_vtable_array; + __pyx_vtable_array.get_memview = (PyObject *(*)(struct __pyx_array_obj *))__pyx_array_get_memview; + #if CYTHON_USE_TYPE_SPECS + __pyx_mstate->__pyx_array_type = (PyTypeObject *) __Pyx_PyType_FromModuleAndSpec(__pyx_m, &__pyx_type___pyx_array_spec, NULL); if (unlikely(!__pyx_mstate->__pyx_array_type)) __PYX_ERR(1, 110, __pyx_L1_error) + #if !CYTHON_COMPILING_IN_LIMITED_API + __pyx_mstate->__pyx_array_type->tp_as_buffer = &__pyx_tp_as_buffer_array; + if (!__pyx_mstate->__pyx_array_type->tp_as_buffer->bf_releasebuffer && __pyx_mstate->__pyx_array_type->tp_base->tp_as_buffer && __pyx_mstate->__pyx_array_type->tp_base->tp_as_buffer->bf_releasebuffer) { + __pyx_mstate->__pyx_array_type->tp_as_buffer->bf_releasebuffer = __pyx_mstate->__pyx_array_type->tp_base->tp_as_buffer->bf_releasebuffer; + } + #elif defined(Py_bf_getbuffer) && defined(Py_bf_releasebuffer) + /* PY_VERSION_HEX >= 0x03090000 || Py_LIMITED_API >= 0x030B0000 */ + #elif defined(_MSC_VER) + #pragma message ("The buffer protocol is not supported in the Limited C-API < 3.11.") + #else + #warning "The buffer protocol is not supported in the Limited C-API < 3.11." + #endif + if (__Pyx_fix_up_extension_type_from_spec(&__pyx_type___pyx_array_spec, __pyx_mstate->__pyx_array_type) < (0)) __PYX_ERR(1, 110, __pyx_L1_error) + #else + __pyx_mstate->__pyx_array_type = &__pyx_type___pyx_array; + #endif + #if !CYTHON_COMPILING_IN_LIMITED_API + #endif + #if !CYTHON_USE_TYPE_SPECS + if (__Pyx_PyType_Ready(__pyx_mstate->__pyx_array_type) < (0)) __PYX_ERR(1, 110, __pyx_L1_error) + #endif + #if CYTHON_COMPILING_IN_CPYTHON && PY_VERSION_HEX >= 0x030E0000 + PyUnstable_Object_EnableDeferredRefcount((PyObject*)__pyx_mstate->__pyx_array_type); + #endif + if (__Pyx_SetVtable(__pyx_mstate->__pyx_array_type, __pyx_vtabptr_array) < (0)) __PYX_ERR(1, 110, __pyx_L1_error) + if (__Pyx_MergeVtables(__pyx_mstate->__pyx_array_type) < (0)) __PYX_ERR(1, 110, __pyx_L1_error) + if (__Pyx_setup_reduce((PyObject *) __pyx_mstate->__pyx_array_type) < (0)) __PYX_ERR(1, 110, __pyx_L1_error) + #if CYTHON_USE_TYPE_SPECS + __pyx_mstate->__pyx_MemviewEnum_type = (PyTypeObject *) __Pyx_PyType_FromModuleAndSpec(__pyx_m, &__pyx_type___pyx_MemviewEnum_spec, NULL); if (unlikely(!__pyx_mstate->__pyx_MemviewEnum_type)) __PYX_ERR(1, 299, __pyx_L1_error) + if (__Pyx_fix_up_extension_type_from_spec(&__pyx_type___pyx_MemviewEnum_spec, __pyx_mstate->__pyx_MemviewEnum_type) < (0)) __PYX_ERR(1, 299, __pyx_L1_error) + #else + __pyx_mstate->__pyx_MemviewEnum_type = &__pyx_type___pyx_MemviewEnum; + #endif + #if !CYTHON_COMPILING_IN_LIMITED_API + #endif + #if !CYTHON_USE_TYPE_SPECS + if (__Pyx_PyType_Ready(__pyx_mstate->__pyx_MemviewEnum_type) < (0)) __PYX_ERR(1, 299, __pyx_L1_error) + #endif + #if CYTHON_COMPILING_IN_CPYTHON && PY_VERSION_HEX >= 0x030E0000 + PyUnstable_Object_EnableDeferredRefcount((PyObject*)__pyx_mstate->__pyx_MemviewEnum_type); + #endif + #if !CYTHON_COMPILING_IN_LIMITED_API + if ((CYTHON_USE_TYPE_SLOTS && CYTHON_USE_PYTYPE_LOOKUP) && likely(!__pyx_mstate->__pyx_MemviewEnum_type->tp_dictoffset && __pyx_mstate->__pyx_MemviewEnum_type->tp_getattro == PyObject_GenericGetAttr)) { + __pyx_mstate->__pyx_MemviewEnum_type->tp_getattro = PyObject_GenericGetAttr; + } + #endif + if (__Pyx_setup_reduce((PyObject *) __pyx_mstate->__pyx_MemviewEnum_type) < (0)) __PYX_ERR(1, 299, __pyx_L1_error) + __pyx_vtabptr_memoryview = &__pyx_vtable_memoryview; + __pyx_vtable_memoryview.get_item_pointer = (char *(*)(struct __pyx_memoryview_obj *, PyObject *))__pyx_memoryview_get_item_pointer; + __pyx_vtable_memoryview.is_slice = (PyObject *(*)(struct __pyx_memoryview_obj *, PyObject *))__pyx_memoryview_is_slice; + __pyx_vtable_memoryview.setitem_slice_assignment = (PyObject *(*)(struct __pyx_memoryview_obj *, PyObject *, PyObject *))__pyx_memoryview_setitem_slice_assignment; + __pyx_vtable_memoryview.setitem_slice_assign_scalar = (PyObject *(*)(struct __pyx_memoryview_obj *, struct __pyx_memoryview_obj *, PyObject *))__pyx_memoryview_setitem_slice_assign_scalar; + __pyx_vtable_memoryview.setitem_indexed = (PyObject *(*)(struct __pyx_memoryview_obj *, PyObject *, PyObject *))__pyx_memoryview_setitem_indexed; + __pyx_vtable_memoryview.convert_item_to_object = (PyObject *(*)(struct __pyx_memoryview_obj *, char *))__pyx_memoryview_convert_item_to_object; + __pyx_vtable_memoryview.assign_item_from_object = (PyObject *(*)(struct __pyx_memoryview_obj *, char *, PyObject *))__pyx_memoryview_assign_item_from_object; + __pyx_vtable_memoryview._get_base = (PyObject *(*)(struct __pyx_memoryview_obj *))__pyx_memoryview__get_base; + #if CYTHON_USE_TYPE_SPECS + __pyx_mstate->__pyx_memoryview_type = (PyTypeObject *) __Pyx_PyType_FromModuleAndSpec(__pyx_m, &__pyx_type___pyx_memoryview_spec, NULL); if (unlikely(!__pyx_mstate->__pyx_memoryview_type)) __PYX_ERR(1, 334, __pyx_L1_error) + #if !CYTHON_COMPILING_IN_LIMITED_API + __pyx_mstate->__pyx_memoryview_type->tp_as_buffer = &__pyx_tp_as_buffer_memoryview; + if (!__pyx_mstate->__pyx_memoryview_type->tp_as_buffer->bf_releasebuffer && __pyx_mstate->__pyx_memoryview_type->tp_base->tp_as_buffer && __pyx_mstate->__pyx_memoryview_type->tp_base->tp_as_buffer->bf_releasebuffer) { + __pyx_mstate->__pyx_memoryview_type->tp_as_buffer->bf_releasebuffer = __pyx_mstate->__pyx_memoryview_type->tp_base->tp_as_buffer->bf_releasebuffer; + } + #elif defined(Py_bf_getbuffer) && defined(Py_bf_releasebuffer) + /* PY_VERSION_HEX >= 0x03090000 || Py_LIMITED_API >= 0x030B0000 */ + #elif defined(_MSC_VER) + #pragma message ("The buffer protocol is not supported in the Limited C-API < 3.11.") + #else + #warning "The buffer protocol is not supported in the Limited C-API < 3.11." + #endif + if (__Pyx_fix_up_extension_type_from_spec(&__pyx_type___pyx_memoryview_spec, __pyx_mstate->__pyx_memoryview_type) < (0)) __PYX_ERR(1, 334, __pyx_L1_error) + #else + __pyx_mstate->__pyx_memoryview_type = &__pyx_type___pyx_memoryview; + #endif + #if !CYTHON_COMPILING_IN_LIMITED_API + #endif + #if !CYTHON_USE_TYPE_SPECS + if (__Pyx_PyType_Ready(__pyx_mstate->__pyx_memoryview_type) < (0)) __PYX_ERR(1, 334, __pyx_L1_error) + #endif + #if CYTHON_COMPILING_IN_CPYTHON && PY_VERSION_HEX >= 0x030E0000 + PyUnstable_Object_EnableDeferredRefcount((PyObject*)__pyx_mstate->__pyx_memoryview_type); + #endif + #if !CYTHON_COMPILING_IN_LIMITED_API + if ((CYTHON_USE_TYPE_SLOTS && CYTHON_USE_PYTYPE_LOOKUP) && likely(!__pyx_mstate->__pyx_memoryview_type->tp_dictoffset && __pyx_mstate->__pyx_memoryview_type->tp_getattro == PyObject_GenericGetAttr)) { + __pyx_mstate->__pyx_memoryview_type->tp_getattro = PyObject_GenericGetAttr; + } + #endif + if (__Pyx_SetVtable(__pyx_mstate->__pyx_memoryview_type, __pyx_vtabptr_memoryview) < (0)) __PYX_ERR(1, 334, __pyx_L1_error) + if (__Pyx_MergeVtables(__pyx_mstate->__pyx_memoryview_type) < (0)) __PYX_ERR(1, 334, __pyx_L1_error) + if (__Pyx_setup_reduce((PyObject *) __pyx_mstate->__pyx_memoryview_type) < (0)) __PYX_ERR(1, 334, __pyx_L1_error) + __pyx_vtabptr__memoryviewslice = &__pyx_vtable__memoryviewslice; + __pyx_vtable__memoryviewslice.__pyx_base = *__pyx_vtabptr_memoryview; + __pyx_vtable__memoryviewslice.__pyx_base.convert_item_to_object = (PyObject *(*)(struct __pyx_memoryview_obj *, char *))__pyx_memoryviewslice_convert_item_to_object; + __pyx_vtable__memoryviewslice.__pyx_base.assign_item_from_object = (PyObject *(*)(struct __pyx_memoryview_obj *, char *, PyObject *))__pyx_memoryviewslice_assign_item_from_object; + __pyx_vtable__memoryviewslice.__pyx_base._get_base = (PyObject *(*)(struct __pyx_memoryview_obj *))__pyx_memoryviewslice__get_base; + #if CYTHON_USE_TYPE_SPECS + __pyx_t_2 = PyTuple_Pack(1, (PyObject *)__pyx_mstate_global->__pyx_memoryview_type); if (unlikely(!__pyx_t_2)) __PYX_ERR(1, 951, __pyx_L1_error) + __Pyx_GOTREF(__pyx_t_2); + __pyx_mstate->__pyx_memoryviewslice_type = (PyTypeObject *) __Pyx_PyType_FromModuleAndSpec(__pyx_m, &__pyx_type___pyx_memoryviewslice_spec, __pyx_t_2); + __Pyx_XDECREF(__pyx_t_2); __pyx_t_2 = 0; + if (unlikely(!__pyx_mstate->__pyx_memoryviewslice_type)) __PYX_ERR(1, 951, __pyx_L1_error) + if (__Pyx_fix_up_extension_type_from_spec(&__pyx_type___pyx_memoryviewslice_spec, __pyx_mstate->__pyx_memoryviewslice_type) < (0)) __PYX_ERR(1, 951, __pyx_L1_error) + #else + __pyx_mstate->__pyx_memoryviewslice_type = &__pyx_type___pyx_memoryviewslice; + #endif + #if !CYTHON_COMPILING_IN_LIMITED_API + __pyx_mstate_global->__pyx_memoryviewslice_type->tp_base = __pyx_mstate_global->__pyx_memoryview_type; + #endif + #if !CYTHON_USE_TYPE_SPECS + if (__Pyx_PyType_Ready(__pyx_mstate->__pyx_memoryviewslice_type) < (0)) __PYX_ERR(1, 951, __pyx_L1_error) + #endif + #if CYTHON_COMPILING_IN_CPYTHON && PY_VERSION_HEX >= 0x030E0000 + PyUnstable_Object_EnableDeferredRefcount((PyObject*)__pyx_mstate->__pyx_memoryviewslice_type); + #endif + #if !CYTHON_COMPILING_IN_LIMITED_API + if ((CYTHON_USE_TYPE_SLOTS && CYTHON_USE_PYTYPE_LOOKUP) && likely(!__pyx_mstate->__pyx_memoryviewslice_type->tp_dictoffset && __pyx_mstate->__pyx_memoryviewslice_type->tp_getattro == PyObject_GenericGetAttr)) { + __pyx_mstate->__pyx_memoryviewslice_type->tp_getattro = PyObject_GenericGetAttr; + } + #endif + if (__Pyx_SetVtable(__pyx_mstate->__pyx_memoryviewslice_type, __pyx_vtabptr__memoryviewslice) < (0)) __PYX_ERR(1, 951, __pyx_L1_error) + if (__Pyx_MergeVtables(__pyx_mstate->__pyx_memoryviewslice_type) < (0)) __PYX_ERR(1, 951, __pyx_L1_error) + if (__Pyx_setup_reduce((PyObject *) __pyx_mstate->__pyx_memoryviewslice_type) < (0)) __PYX_ERR(1, 951, __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_XDECREF(__pyx_t_2); + __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("cymem.cymem"); if (unlikely(!__pyx_t_1)) __PYX_ERR(7, 4, __pyx_L1_error) + __Pyx_GOTREF(__pyx_t_1); + __pyx_mstate->__pyx_ptype_5cymem_5cymem_PyMalloc = __Pyx_ImportType_3_2_1(__pyx_t_1, "cymem.cymem", "PyMalloc", + #if defined(PYPY_VERSION_NUM) && PYPY_VERSION_NUM < 0x050B0000 + sizeof(struct __pyx_obj_5cymem_5cymem_PyMalloc), __PYX_GET_STRUCT_ALIGNMENT_3_2_1(struct __pyx_obj_5cymem_5cymem_PyMalloc), + #elif CYTHON_COMPILING_IN_LIMITED_API + sizeof(struct __pyx_obj_5cymem_5cymem_PyMalloc), __PYX_GET_STRUCT_ALIGNMENT_3_2_1(struct __pyx_obj_5cymem_5cymem_PyMalloc), + #else + sizeof(struct __pyx_obj_5cymem_5cymem_PyMalloc), __PYX_GET_STRUCT_ALIGNMENT_3_2_1(struct __pyx_obj_5cymem_5cymem_PyMalloc), + #endif + __Pyx_ImportType_CheckSize_Warn_3_2_1); if (!__pyx_mstate->__pyx_ptype_5cymem_5cymem_PyMalloc) __PYX_ERR(7, 4, __pyx_L1_error) + __pyx_vtabptr_5cymem_5cymem_PyMalloc = (struct __pyx_vtabstruct_5cymem_5cymem_PyMalloc*)__Pyx_GetVtable(__pyx_mstate->__pyx_ptype_5cymem_5cymem_PyMalloc); if (unlikely(!__pyx_vtabptr_5cymem_5cymem_PyMalloc)) __PYX_ERR(7, 4, __pyx_L1_error) + __pyx_mstate->__pyx_ptype_5cymem_5cymem_PyFree = __Pyx_ImportType_3_2_1(__pyx_t_1, "cymem.cymem", "PyFree", + #if defined(PYPY_VERSION_NUM) && PYPY_VERSION_NUM < 0x050B0000 + sizeof(struct __pyx_obj_5cymem_5cymem_PyFree), __PYX_GET_STRUCT_ALIGNMENT_3_2_1(struct __pyx_obj_5cymem_5cymem_PyFree), + #elif CYTHON_COMPILING_IN_LIMITED_API + sizeof(struct __pyx_obj_5cymem_5cymem_PyFree), __PYX_GET_STRUCT_ALIGNMENT_3_2_1(struct __pyx_obj_5cymem_5cymem_PyFree), + #else + sizeof(struct __pyx_obj_5cymem_5cymem_PyFree), __PYX_GET_STRUCT_ALIGNMENT_3_2_1(struct __pyx_obj_5cymem_5cymem_PyFree), + #endif + __Pyx_ImportType_CheckSize_Warn_3_2_1); if (!__pyx_mstate->__pyx_ptype_5cymem_5cymem_PyFree) __PYX_ERR(7, 10, __pyx_L1_error) + __pyx_vtabptr_5cymem_5cymem_PyFree = (struct __pyx_vtabstruct_5cymem_5cymem_PyFree*)__Pyx_GetVtable(__pyx_mstate->__pyx_ptype_5cymem_5cymem_PyFree); if (unlikely(!__pyx_vtabptr_5cymem_5cymem_PyFree)) __PYX_ERR(7, 10, __pyx_L1_error) + __pyx_mstate->__pyx_ptype_5cymem_5cymem_Pool = __Pyx_ImportType_3_2_1(__pyx_t_1, "cymem.cymem", "Pool", + #if defined(PYPY_VERSION_NUM) && PYPY_VERSION_NUM < 0x050B0000 + sizeof(struct __pyx_obj_5cymem_5cymem_Pool), __PYX_GET_STRUCT_ALIGNMENT_3_2_1(struct __pyx_obj_5cymem_5cymem_Pool), + #elif CYTHON_COMPILING_IN_LIMITED_API + sizeof(struct __pyx_obj_5cymem_5cymem_Pool), __PYX_GET_STRUCT_ALIGNMENT_3_2_1(struct __pyx_obj_5cymem_5cymem_Pool), + #else + sizeof(struct __pyx_obj_5cymem_5cymem_Pool), __PYX_GET_STRUCT_ALIGNMENT_3_2_1(struct __pyx_obj_5cymem_5cymem_Pool), + #endif + __Pyx_ImportType_CheckSize_Warn_3_2_1); if (!__pyx_mstate->__pyx_ptype_5cymem_5cymem_Pool) __PYX_ERR(7, 16, __pyx_L1_error) + __pyx_vtabptr_5cymem_5cymem_Pool = (struct __pyx_vtabstruct_5cymem_5cymem_Pool*)__Pyx_GetVtable(__pyx_mstate->__pyx_ptype_5cymem_5cymem_Pool); if (unlikely(!__pyx_vtabptr_5cymem_5cymem_Pool)) __PYX_ERR(7, 16, __pyx_L1_error) + __pyx_mstate->__pyx_ptype_5cymem_5cymem_Address = __Pyx_ImportType_3_2_1(__pyx_t_1, "cymem.cymem", "Address", + #if defined(PYPY_VERSION_NUM) && PYPY_VERSION_NUM < 0x050B0000 + sizeof(struct __pyx_obj_5cymem_5cymem_Address), __PYX_GET_STRUCT_ALIGNMENT_3_2_1(struct __pyx_obj_5cymem_5cymem_Address), + #elif CYTHON_COMPILING_IN_LIMITED_API + sizeof(struct __pyx_obj_5cymem_5cymem_Address), __PYX_GET_STRUCT_ALIGNMENT_3_2_1(struct __pyx_obj_5cymem_5cymem_Address), + #else + sizeof(struct __pyx_obj_5cymem_5cymem_Address), __PYX_GET_STRUCT_ALIGNMENT_3_2_1(struct __pyx_obj_5cymem_5cymem_Address), + #endif + __Pyx_ImportType_CheckSize_Warn_3_2_1); if (!__pyx_mstate->__pyx_ptype_5cymem_5cymem_Address) __PYX_ERR(7, 28, __pyx_L1_error) + __Pyx_DECREF(__pyx_t_1); __pyx_t_1 = 0; + __pyx_t_1 = PyImport_ImportModule("preshed.maps"); if (unlikely(!__pyx_t_1)) __PYX_ERR(8, 45, __pyx_L1_error) + __Pyx_GOTREF(__pyx_t_1); + __pyx_mstate->__pyx_ptype_7preshed_4maps_PreshMap = __Pyx_ImportType_3_2_1(__pyx_t_1, "preshed.maps", "PreshMap", + #if defined(PYPY_VERSION_NUM) && PYPY_VERSION_NUM < 0x050B0000 + sizeof(struct __pyx_obj_7preshed_4maps_PreshMap), __PYX_GET_STRUCT_ALIGNMENT_3_2_1(struct __pyx_obj_7preshed_4maps_PreshMap), + #elif CYTHON_COMPILING_IN_LIMITED_API + sizeof(struct __pyx_obj_7preshed_4maps_PreshMap), __PYX_GET_STRUCT_ALIGNMENT_3_2_1(struct __pyx_obj_7preshed_4maps_PreshMap), + #else + sizeof(struct __pyx_obj_7preshed_4maps_PreshMap), __PYX_GET_STRUCT_ALIGNMENT_3_2_1(struct __pyx_obj_7preshed_4maps_PreshMap), + #endif + __Pyx_ImportType_CheckSize_Warn_3_2_1); if (!__pyx_mstate->__pyx_ptype_7preshed_4maps_PreshMap) __PYX_ERR(8, 45, __pyx_L1_error) + __pyx_vtabptr_7preshed_4maps_PreshMap = (struct __pyx_vtabstruct_7preshed_4maps_PreshMap*)__Pyx_GetVtable(__pyx_mstate->__pyx_ptype_7preshed_4maps_PreshMap); if (unlikely(!__pyx_vtabptr_7preshed_4maps_PreshMap)) __PYX_ERR(8, 45, __pyx_L1_error) + __pyx_mstate->__pyx_ptype_7preshed_4maps_PreshMapArray = __Pyx_ImportType_3_2_1(__pyx_t_1, "preshed.maps", "PreshMapArray", + #if defined(PYPY_VERSION_NUM) && PYPY_VERSION_NUM < 0x050B0000 + sizeof(struct __pyx_obj_7preshed_4maps_PreshMapArray), __PYX_GET_STRUCT_ALIGNMENT_3_2_1(struct __pyx_obj_7preshed_4maps_PreshMapArray), + #elif CYTHON_COMPILING_IN_LIMITED_API + sizeof(struct __pyx_obj_7preshed_4maps_PreshMapArray), __PYX_GET_STRUCT_ALIGNMENT_3_2_1(struct __pyx_obj_7preshed_4maps_PreshMapArray), + #else + sizeof(struct __pyx_obj_7preshed_4maps_PreshMapArray), __PYX_GET_STRUCT_ALIGNMENT_3_2_1(struct __pyx_obj_7preshed_4maps_PreshMapArray), + #endif + __Pyx_ImportType_CheckSize_Warn_3_2_1); if (!__pyx_mstate->__pyx_ptype_7preshed_4maps_PreshMapArray) __PYX_ERR(8, 53, __pyx_L1_error) + __pyx_vtabptr_7preshed_4maps_PreshMapArray = (struct __pyx_vtabstruct_7preshed_4maps_PreshMapArray*)__Pyx_GetVtable(__pyx_mstate->__pyx_ptype_7preshed_4maps_PreshMapArray); if (unlikely(!__pyx_vtabptr_7preshed_4maps_PreshMapArray)) __PYX_ERR(8, 53, __pyx_L1_error) + __Pyx_DECREF(__pyx_t_1); __pyx_t_1 = 0; + __pyx_t_1 = PyImport_ImportModule("spacy.strings"); if (unlikely(!__pyx_t_1)) __PYX_ERR(9, 22, __pyx_L1_error) + __Pyx_GOTREF(__pyx_t_1); + __pyx_mstate->__pyx_ptype_5spacy_7strings_StringStore = __Pyx_ImportType_3_2_1(__pyx_t_1, "spacy.strings", "StringStore", + #if defined(PYPY_VERSION_NUM) && PYPY_VERSION_NUM < 0x050B0000 + sizeof(struct __pyx_obj_5spacy_7strings_StringStore), __PYX_GET_STRUCT_ALIGNMENT_3_2_1(struct __pyx_obj_5spacy_7strings_StringStore), + #elif CYTHON_COMPILING_IN_LIMITED_API + sizeof(struct __pyx_obj_5spacy_7strings_StringStore), __PYX_GET_STRUCT_ALIGNMENT_3_2_1(struct __pyx_obj_5spacy_7strings_StringStore), + #else + sizeof(struct __pyx_obj_5spacy_7strings_StringStore), __PYX_GET_STRUCT_ALIGNMENT_3_2_1(struct __pyx_obj_5spacy_7strings_StringStore), + #endif + __Pyx_ImportType_CheckSize_Warn_3_2_1); if (!__pyx_mstate->__pyx_ptype_5spacy_7strings_StringStore) __PYX_ERR(9, 22, __pyx_L1_error) + __pyx_vtabptr_5spacy_7strings_StringStore = (struct __pyx_vtabstruct_5spacy_7strings_StringStore*)__Pyx_GetVtable(__pyx_mstate->__pyx_ptype_5spacy_7strings_StringStore); if (unlikely(!__pyx_vtabptr_5spacy_7strings_StringStore)) __PYX_ERR(9, 22, __pyx_L1_error) + __Pyx_DECREF(__pyx_t_1); __pyx_t_1 = 0; + __pyx_t_1 = PyImport_ImportModule(__Pyx_BUILTIN_MODULE_NAME); if (unlikely(!__pyx_t_1)) __PYX_ERR(10, 9, __pyx_L1_error) + __Pyx_GOTREF(__pyx_t_1); + __pyx_mstate->__pyx_ptype_7cpython_4type_type = __Pyx_ImportType_3_2_1(__pyx_t_1, __Pyx_BUILTIN_MODULE_NAME, "type", + #if defined(PYPY_VERSION_NUM) && PYPY_VERSION_NUM < 0x050B0000 + sizeof(PyTypeObject), __PYX_GET_STRUCT_ALIGNMENT_3_2_1(PyTypeObject), + #elif CYTHON_COMPILING_IN_LIMITED_API + 0, 0, + #else + sizeof(PyHeapTypeObject), __PYX_GET_STRUCT_ALIGNMENT_3_2_1(PyHeapTypeObject), + #endif + __Pyx_ImportType_CheckSize_Warn_3_2_1); if (!__pyx_mstate->__pyx_ptype_7cpython_4type_type) __PYX_ERR(10, 9, __pyx_L1_error) + __Pyx_DECREF(__pyx_t_1); __pyx_t_1 = 0; + __pyx_t_1 = PyImport_ImportModule("numpy"); if (unlikely(!__pyx_t_1)) __PYX_ERR(2, 228, __pyx_L1_error) + __Pyx_GOTREF(__pyx_t_1); + __pyx_mstate->__pyx_ptype_5numpy_dtype = __Pyx_ImportType_3_2_1(__pyx_t_1, "numpy", "dtype", + #if defined(PYPY_VERSION_NUM) && PYPY_VERSION_NUM < 0x050B0000 + sizeof(PyArray_Descr), __PYX_GET_STRUCT_ALIGNMENT_3_2_1(PyArray_Descr), + #elif CYTHON_COMPILING_IN_LIMITED_API + sizeof(PyArray_Descr), __PYX_GET_STRUCT_ALIGNMENT_3_2_1(PyArray_Descr), + #else + sizeof(PyArray_Descr), __PYX_GET_STRUCT_ALIGNMENT_3_2_1(PyArray_Descr), + #endif + __Pyx_ImportType_CheckSize_Ignore_3_2_1); if (!__pyx_mstate->__pyx_ptype_5numpy_dtype) __PYX_ERR(2, 228, __pyx_L1_error) + __pyx_mstate->__pyx_ptype_5numpy_flatiter = __Pyx_ImportType_3_2_1(__pyx_t_1, "numpy", "flatiter", + #if defined(PYPY_VERSION_NUM) && PYPY_VERSION_NUM < 0x050B0000 + sizeof(PyArrayIterObject), __PYX_GET_STRUCT_ALIGNMENT_3_2_1(PyArrayIterObject), + #elif CYTHON_COMPILING_IN_LIMITED_API + sizeof(PyArrayIterObject), __PYX_GET_STRUCT_ALIGNMENT_3_2_1(PyArrayIterObject), + #else + sizeof(PyArrayIterObject), __PYX_GET_STRUCT_ALIGNMENT_3_2_1(PyArrayIterObject), + #endif + __Pyx_ImportType_CheckSize_Ignore_3_2_1); if (!__pyx_mstate->__pyx_ptype_5numpy_flatiter) __PYX_ERR(2, 273, __pyx_L1_error) + __pyx_mstate->__pyx_ptype_5numpy_broadcast = __Pyx_ImportType_3_2_1(__pyx_t_1, "numpy", "broadcast", + #if defined(PYPY_VERSION_NUM) && PYPY_VERSION_NUM < 0x050B0000 + sizeof(PyArrayMultiIterObject), __PYX_GET_STRUCT_ALIGNMENT_3_2_1(PyArrayMultiIterObject), + #elif CYTHON_COMPILING_IN_LIMITED_API + sizeof(PyArrayMultiIterObject), __PYX_GET_STRUCT_ALIGNMENT_3_2_1(PyArrayMultiIterObject), + #else + sizeof(PyArrayMultiIterObject), __PYX_GET_STRUCT_ALIGNMENT_3_2_1(PyArrayMultiIterObject), + #endif + __Pyx_ImportType_CheckSize_Ignore_3_2_1); if (!__pyx_mstate->__pyx_ptype_5numpy_broadcast) __PYX_ERR(2, 277, __pyx_L1_error) + __pyx_mstate->__pyx_ptype_5numpy_ndarray = __Pyx_ImportType_3_2_1(__pyx_t_1, "numpy", "ndarray", + #if defined(PYPY_VERSION_NUM) && PYPY_VERSION_NUM < 0x050B0000 + sizeof(PyArrayObject), __PYX_GET_STRUCT_ALIGNMENT_3_2_1(PyArrayObject), + #elif CYTHON_COMPILING_IN_LIMITED_API + sizeof(PyArrayObject), __PYX_GET_STRUCT_ALIGNMENT_3_2_1(PyArrayObject), + #else + sizeof(PyArrayObject), __PYX_GET_STRUCT_ALIGNMENT_3_2_1(PyArrayObject), + #endif + __Pyx_ImportType_CheckSize_Ignore_3_2_1); if (!__pyx_mstate->__pyx_ptype_5numpy_ndarray) __PYX_ERR(2, 316, __pyx_L1_error) + __pyx_mstate->__pyx_ptype_5numpy_generic = __Pyx_ImportType_3_2_1(__pyx_t_1, "numpy", "generic", + #if defined(PYPY_VERSION_NUM) && PYPY_VERSION_NUM < 0x050B0000 + sizeof(PyObject), __PYX_GET_STRUCT_ALIGNMENT_3_2_1(PyObject), + #elif CYTHON_COMPILING_IN_LIMITED_API + sizeof(PyObject), __PYX_GET_STRUCT_ALIGNMENT_3_2_1(PyObject), + #else + sizeof(PyObject), __PYX_GET_STRUCT_ALIGNMENT_3_2_1(PyObject), + #endif + __Pyx_ImportType_CheckSize_Warn_3_2_1); if (!__pyx_mstate->__pyx_ptype_5numpy_generic) __PYX_ERR(2, 825, __pyx_L1_error) + __pyx_mstate->__pyx_ptype_5numpy_number = __Pyx_ImportType_3_2_1(__pyx_t_1, "numpy", "number", + #if defined(PYPY_VERSION_NUM) && PYPY_VERSION_NUM < 0x050B0000 + sizeof(PyObject), __PYX_GET_STRUCT_ALIGNMENT_3_2_1(PyObject), + #elif CYTHON_COMPILING_IN_LIMITED_API + sizeof(PyObject), __PYX_GET_STRUCT_ALIGNMENT_3_2_1(PyObject), + #else + sizeof(PyObject), __PYX_GET_STRUCT_ALIGNMENT_3_2_1(PyObject), + #endif + __Pyx_ImportType_CheckSize_Warn_3_2_1); if (!__pyx_mstate->__pyx_ptype_5numpy_number) __PYX_ERR(2, 827, __pyx_L1_error) + __pyx_mstate->__pyx_ptype_5numpy_integer = __Pyx_ImportType_3_2_1(__pyx_t_1, "numpy", "integer", + #if defined(PYPY_VERSION_NUM) && PYPY_VERSION_NUM < 0x050B0000 + sizeof(PyObject), __PYX_GET_STRUCT_ALIGNMENT_3_2_1(PyObject), + #elif CYTHON_COMPILING_IN_LIMITED_API + sizeof(PyObject), __PYX_GET_STRUCT_ALIGNMENT_3_2_1(PyObject), + #else + sizeof(PyObject), __PYX_GET_STRUCT_ALIGNMENT_3_2_1(PyObject), + #endif + __Pyx_ImportType_CheckSize_Warn_3_2_1); if (!__pyx_mstate->__pyx_ptype_5numpy_integer) __PYX_ERR(2, 829, __pyx_L1_error) + __pyx_mstate->__pyx_ptype_5numpy_signedinteger = __Pyx_ImportType_3_2_1(__pyx_t_1, "numpy", "signedinteger", + #if defined(PYPY_VERSION_NUM) && PYPY_VERSION_NUM < 0x050B0000 + sizeof(PyObject), __PYX_GET_STRUCT_ALIGNMENT_3_2_1(PyObject), + #elif CYTHON_COMPILING_IN_LIMITED_API + sizeof(PyObject), __PYX_GET_STRUCT_ALIGNMENT_3_2_1(PyObject), + #else + sizeof(PyObject), __PYX_GET_STRUCT_ALIGNMENT_3_2_1(PyObject), + #endif + __Pyx_ImportType_CheckSize_Warn_3_2_1); if (!__pyx_mstate->__pyx_ptype_5numpy_signedinteger) __PYX_ERR(2, 831, __pyx_L1_error) + __pyx_mstate->__pyx_ptype_5numpy_unsignedinteger = __Pyx_ImportType_3_2_1(__pyx_t_1, "numpy", "unsignedinteger", + #if defined(PYPY_VERSION_NUM) && PYPY_VERSION_NUM < 0x050B0000 + sizeof(PyObject), __PYX_GET_STRUCT_ALIGNMENT_3_2_1(PyObject), + #elif CYTHON_COMPILING_IN_LIMITED_API + sizeof(PyObject), __PYX_GET_STRUCT_ALIGNMENT_3_2_1(PyObject), + #else + sizeof(PyObject), __PYX_GET_STRUCT_ALIGNMENT_3_2_1(PyObject), + #endif + __Pyx_ImportType_CheckSize_Warn_3_2_1); if (!__pyx_mstate->__pyx_ptype_5numpy_unsignedinteger) __PYX_ERR(2, 833, __pyx_L1_error) + __pyx_mstate->__pyx_ptype_5numpy_inexact = __Pyx_ImportType_3_2_1(__pyx_t_1, "numpy", "inexact", + #if defined(PYPY_VERSION_NUM) && PYPY_VERSION_NUM < 0x050B0000 + sizeof(PyObject), __PYX_GET_STRUCT_ALIGNMENT_3_2_1(PyObject), + #elif CYTHON_COMPILING_IN_LIMITED_API + sizeof(PyObject), __PYX_GET_STRUCT_ALIGNMENT_3_2_1(PyObject), + #else + sizeof(PyObject), __PYX_GET_STRUCT_ALIGNMENT_3_2_1(PyObject), + #endif + __Pyx_ImportType_CheckSize_Warn_3_2_1); if (!__pyx_mstate->__pyx_ptype_5numpy_inexact) __PYX_ERR(2, 835, __pyx_L1_error) + __pyx_mstate->__pyx_ptype_5numpy_floating = __Pyx_ImportType_3_2_1(__pyx_t_1, "numpy", "floating", + #if defined(PYPY_VERSION_NUM) && PYPY_VERSION_NUM < 0x050B0000 + sizeof(PyObject), __PYX_GET_STRUCT_ALIGNMENT_3_2_1(PyObject), + #elif CYTHON_COMPILING_IN_LIMITED_API + sizeof(PyObject), __PYX_GET_STRUCT_ALIGNMENT_3_2_1(PyObject), + #else + sizeof(PyObject), __PYX_GET_STRUCT_ALIGNMENT_3_2_1(PyObject), + #endif + __Pyx_ImportType_CheckSize_Warn_3_2_1); if (!__pyx_mstate->__pyx_ptype_5numpy_floating) __PYX_ERR(2, 837, __pyx_L1_error) + __pyx_mstate->__pyx_ptype_5numpy_complexfloating = __Pyx_ImportType_3_2_1(__pyx_t_1, "numpy", "complexfloating", + #if defined(PYPY_VERSION_NUM) && PYPY_VERSION_NUM < 0x050B0000 + sizeof(PyObject), __PYX_GET_STRUCT_ALIGNMENT_3_2_1(PyObject), + #elif CYTHON_COMPILING_IN_LIMITED_API + sizeof(PyObject), __PYX_GET_STRUCT_ALIGNMENT_3_2_1(PyObject), + #else + sizeof(PyObject), __PYX_GET_STRUCT_ALIGNMENT_3_2_1(PyObject), + #endif + __Pyx_ImportType_CheckSize_Warn_3_2_1); if (!__pyx_mstate->__pyx_ptype_5numpy_complexfloating) __PYX_ERR(2, 839, __pyx_L1_error) + __pyx_mstate->__pyx_ptype_5numpy_flexible = __Pyx_ImportType_3_2_1(__pyx_t_1, "numpy", "flexible", + #if defined(PYPY_VERSION_NUM) && PYPY_VERSION_NUM < 0x050B0000 + sizeof(PyObject), __PYX_GET_STRUCT_ALIGNMENT_3_2_1(PyObject), + #elif CYTHON_COMPILING_IN_LIMITED_API + sizeof(PyObject), __PYX_GET_STRUCT_ALIGNMENT_3_2_1(PyObject), + #else + sizeof(PyObject), __PYX_GET_STRUCT_ALIGNMENT_3_2_1(PyObject), + #endif + __Pyx_ImportType_CheckSize_Warn_3_2_1); if (!__pyx_mstate->__pyx_ptype_5numpy_flexible) __PYX_ERR(2, 841, __pyx_L1_error) + __pyx_mstate->__pyx_ptype_5numpy_character = __Pyx_ImportType_3_2_1(__pyx_t_1, "numpy", "character", + #if defined(PYPY_VERSION_NUM) && PYPY_VERSION_NUM < 0x050B0000 + sizeof(PyObject), __PYX_GET_STRUCT_ALIGNMENT_3_2_1(PyObject), + #elif CYTHON_COMPILING_IN_LIMITED_API + sizeof(PyObject), __PYX_GET_STRUCT_ALIGNMENT_3_2_1(PyObject), + #else + sizeof(PyObject), __PYX_GET_STRUCT_ALIGNMENT_3_2_1(PyObject), + #endif + __Pyx_ImportType_CheckSize_Warn_3_2_1); if (!__pyx_mstate->__pyx_ptype_5numpy_character) __PYX_ERR(2, 843, __pyx_L1_error) + __pyx_mstate->__pyx_ptype_5numpy_ufunc = __Pyx_ImportType_3_2_1(__pyx_t_1, "numpy", "ufunc", + #if defined(PYPY_VERSION_NUM) && PYPY_VERSION_NUM < 0x050B0000 + sizeof(PyUFuncObject), __PYX_GET_STRUCT_ALIGNMENT_3_2_1(PyUFuncObject), + #elif CYTHON_COMPILING_IN_LIMITED_API + sizeof(PyUFuncObject), __PYX_GET_STRUCT_ALIGNMENT_3_2_1(PyUFuncObject), + #else + sizeof(PyUFuncObject), __PYX_GET_STRUCT_ALIGNMENT_3_2_1(PyUFuncObject), + #endif + __Pyx_ImportType_CheckSize_Ignore_3_2_1); if (!__pyx_mstate->__pyx_ptype_5numpy_ufunc) __PYX_ERR(2, 907, __pyx_L1_error) + __Pyx_DECREF(__pyx_t_1); __pyx_t_1 = 0; + __pyx_t_1 = PyImport_ImportModule("spacy.morphology"); if (unlikely(!__pyx_t_1)) __PYX_ERR(11, 11, __pyx_L1_error) + __Pyx_GOTREF(__pyx_t_1); + __pyx_mstate->__pyx_ptype_5spacy_10morphology_Morphology = __Pyx_ImportType_3_2_1(__pyx_t_1, "spacy.morphology", "Morphology", + #if defined(PYPY_VERSION_NUM) && PYPY_VERSION_NUM < 0x050B0000 + sizeof(struct __pyx_obj_5spacy_10morphology_Morphology), __PYX_GET_STRUCT_ALIGNMENT_3_2_1(struct __pyx_obj_5spacy_10morphology_Morphology), + #elif CYTHON_COMPILING_IN_LIMITED_API + sizeof(struct __pyx_obj_5spacy_10morphology_Morphology), __PYX_GET_STRUCT_ALIGNMENT_3_2_1(struct __pyx_obj_5spacy_10morphology_Morphology), + #else + sizeof(struct __pyx_obj_5spacy_10morphology_Morphology), __PYX_GET_STRUCT_ALIGNMENT_3_2_1(struct __pyx_obj_5spacy_10morphology_Morphology), + #endif + __Pyx_ImportType_CheckSize_Warn_3_2_1); if (!__pyx_mstate->__pyx_ptype_5spacy_10morphology_Morphology) __PYX_ERR(11, 11, __pyx_L1_error) + __pyx_vtabptr_5spacy_10morphology_Morphology = (struct __pyx_vtabstruct_5spacy_10morphology_Morphology*)__Pyx_GetVtable(__pyx_mstate->__pyx_ptype_5spacy_10morphology_Morphology); if (unlikely(!__pyx_vtabptr_5spacy_10morphology_Morphology)) __PYX_ERR(11, 11, __pyx_L1_error) + __Pyx_DECREF(__pyx_t_1); __pyx_t_1 = 0; + __pyx_t_1 = PyImport_ImportModule("spacy.vocab"); if (unlikely(!__pyx_t_1)) __PYX_ERR(12, 26, __pyx_L1_error) + __Pyx_GOTREF(__pyx_t_1); + __pyx_mstate->__pyx_ptype_5spacy_5vocab_Vocab = __Pyx_ImportType_3_2_1(__pyx_t_1, "spacy.vocab", "Vocab", + #if defined(PYPY_VERSION_NUM) && PYPY_VERSION_NUM < 0x050B0000 + sizeof(struct __pyx_obj_5spacy_5vocab_Vocab), __PYX_GET_STRUCT_ALIGNMENT_3_2_1(struct __pyx_obj_5spacy_5vocab_Vocab), + #elif CYTHON_COMPILING_IN_LIMITED_API + sizeof(struct __pyx_obj_5spacy_5vocab_Vocab), __PYX_GET_STRUCT_ALIGNMENT_3_2_1(struct __pyx_obj_5spacy_5vocab_Vocab), + #else + sizeof(struct __pyx_obj_5spacy_5vocab_Vocab), __PYX_GET_STRUCT_ALIGNMENT_3_2_1(struct __pyx_obj_5spacy_5vocab_Vocab), + #endif + __Pyx_ImportType_CheckSize_Warn_3_2_1); if (!__pyx_mstate->__pyx_ptype_5spacy_5vocab_Vocab) __PYX_ERR(12, 26, __pyx_L1_error) + __pyx_vtabptr_5spacy_5vocab_Vocab = (struct __pyx_vtabstruct_5spacy_5vocab_Vocab*)__Pyx_GetVtable(__pyx_mstate->__pyx_ptype_5spacy_5vocab_Vocab); if (unlikely(!__pyx_vtabptr_5spacy_5vocab_Vocab)) __PYX_ERR(12, 26, __pyx_L1_error) + __Pyx_DECREF(__pyx_t_1); __pyx_t_1 = 0; + __pyx_t_1 = PyImport_ImportModule("spacy.tokens.doc"); if (unlikely(!__pyx_t_1)) __PYX_ERR(13, 37, __pyx_L1_error) + __Pyx_GOTREF(__pyx_t_1); + __pyx_mstate->__pyx_ptype_5spacy_6tokens_3doc_Doc = __Pyx_ImportType_3_2_1(__pyx_t_1, "spacy.tokens.doc", "Doc", + #if defined(PYPY_VERSION_NUM) && PYPY_VERSION_NUM < 0x050B0000 + sizeof(struct __pyx_obj_5spacy_6tokens_3doc_Doc), __PYX_GET_STRUCT_ALIGNMENT_3_2_1(struct __pyx_obj_5spacy_6tokens_3doc_Doc), + #elif CYTHON_COMPILING_IN_LIMITED_API + sizeof(struct __pyx_obj_5spacy_6tokens_3doc_Doc), __PYX_GET_STRUCT_ALIGNMENT_3_2_1(struct __pyx_obj_5spacy_6tokens_3doc_Doc), + #else + sizeof(struct __pyx_obj_5spacy_6tokens_3doc_Doc), __PYX_GET_STRUCT_ALIGNMENT_3_2_1(struct __pyx_obj_5spacy_6tokens_3doc_Doc), + #endif + __Pyx_ImportType_CheckSize_Warn_3_2_1); if (!__pyx_mstate->__pyx_ptype_5spacy_6tokens_3doc_Doc) __PYX_ERR(13, 37, __pyx_L1_error) + __pyx_vtabptr_5spacy_6tokens_3doc_Doc = (struct __pyx_vtabstruct_5spacy_6tokens_3doc_Doc*)__Pyx_GetVtable(__pyx_mstate->__pyx_ptype_5spacy_6tokens_3doc_Doc); if (unlikely(!__pyx_vtabptr_5spacy_6tokens_3doc_Doc)) __PYX_ERR(13, 37, __pyx_L1_error) + __Pyx_DECREF(__pyx_t_1); __pyx_t_1 = 0; + __pyx_t_1 = PyImport_ImportModule("spacy.training.example"); if (unlikely(!__pyx_t_1)) __PYX_ERR(14, 6, __pyx_L1_error) + __Pyx_GOTREF(__pyx_t_1); + __pyx_mstate->__pyx_ptype_5spacy_8training_7example_Example = __Pyx_ImportType_3_2_1(__pyx_t_1, "spacy.training.example", "Example", + #if defined(PYPY_VERSION_NUM) && PYPY_VERSION_NUM < 0x050B0000 + sizeof(struct __pyx_obj_5spacy_8training_7example_Example), __PYX_GET_STRUCT_ALIGNMENT_3_2_1(struct __pyx_obj_5spacy_8training_7example_Example), + #elif CYTHON_COMPILING_IN_LIMITED_API + sizeof(struct __pyx_obj_5spacy_8training_7example_Example), __PYX_GET_STRUCT_ALIGNMENT_3_2_1(struct __pyx_obj_5spacy_8training_7example_Example), + #else + sizeof(struct __pyx_obj_5spacy_8training_7example_Example), __PYX_GET_STRUCT_ALIGNMENT_3_2_1(struct __pyx_obj_5spacy_8training_7example_Example), + #endif + __Pyx_ImportType_CheckSize_Warn_3_2_1); if (!__pyx_mstate->__pyx_ptype_5spacy_8training_7example_Example) __PYX_ERR(14, 6, __pyx_L1_error) + __Pyx_DECREF(__pyx_t_1); __pyx_t_1 = 0; + __pyx_t_1 = PyImport_ImportModule("spacy.lexeme"); if (unlikely(!__pyx_t_1)) __PYX_ERR(3, 24, __pyx_L1_error) + __Pyx_GOTREF(__pyx_t_1); + __pyx_mstate->__pyx_ptype_5spacy_6lexeme_Lexeme = __Pyx_ImportType_3_2_1(__pyx_t_1, "spacy.lexeme", "Lexeme", + #if defined(PYPY_VERSION_NUM) && PYPY_VERSION_NUM < 0x050B0000 + sizeof(struct __pyx_obj_5spacy_6lexeme_Lexeme), __PYX_GET_STRUCT_ALIGNMENT_3_2_1(struct __pyx_obj_5spacy_6lexeme_Lexeme), + #elif CYTHON_COMPILING_IN_LIMITED_API + sizeof(struct __pyx_obj_5spacy_6lexeme_Lexeme), __PYX_GET_STRUCT_ALIGNMENT_3_2_1(struct __pyx_obj_5spacy_6lexeme_Lexeme), + #else + sizeof(struct __pyx_obj_5spacy_6lexeme_Lexeme), __PYX_GET_STRUCT_ALIGNMENT_3_2_1(struct __pyx_obj_5spacy_6lexeme_Lexeme), + #endif + __Pyx_ImportType_CheckSize_Warn_3_2_1); if (!__pyx_mstate->__pyx_ptype_5spacy_6lexeme_Lexeme) __PYX_ERR(3, 24, __pyx_L1_error) + __pyx_vtabptr_5spacy_6lexeme_Lexeme = (struct __pyx_vtabstruct_5spacy_6lexeme_Lexeme*)__Pyx_GetVtable(__pyx_mstate->__pyx_ptype_5spacy_6lexeme_Lexeme); if (unlikely(!__pyx_vtabptr_5spacy_6lexeme_Lexeme)) __PYX_ERR(3, 24, __pyx_L1_error) + __Pyx_DECREF(__pyx_t_1); __pyx_t_1 = 0; + __pyx_t_1 = PyImport_ImportModule("spacy.pipeline._parser_internals.stateclass"); if (unlikely(!__pyx_t_1)) __PYX_ERR(5, 9, __pyx_L1_error) + __Pyx_GOTREF(__pyx_t_1); + __pyx_mstate->__pyx_ptype_5spacy_8pipeline_17_parser_internals_10stateclass_StateClass = __Pyx_ImportType_3_2_1(__pyx_t_1, "spacy.pipeline._parser_internals.stateclass", "StateClass", + #if defined(PYPY_VERSION_NUM) && PYPY_VERSION_NUM < 0x050B0000 + sizeof(struct __pyx_obj_5spacy_8pipeline_17_parser_internals_10stateclass_StateClass), __PYX_GET_STRUCT_ALIGNMENT_3_2_1(struct __pyx_obj_5spacy_8pipeline_17_parser_internals_10stateclass_StateClass), + #elif CYTHON_COMPILING_IN_LIMITED_API + sizeof(struct __pyx_obj_5spacy_8pipeline_17_parser_internals_10stateclass_StateClass), __PYX_GET_STRUCT_ALIGNMENT_3_2_1(struct __pyx_obj_5spacy_8pipeline_17_parser_internals_10stateclass_StateClass), + #else + sizeof(struct __pyx_obj_5spacy_8pipeline_17_parser_internals_10stateclass_StateClass), __PYX_GET_STRUCT_ALIGNMENT_3_2_1(struct __pyx_obj_5spacy_8pipeline_17_parser_internals_10stateclass_StateClass), + #endif + __Pyx_ImportType_CheckSize_Warn_3_2_1); if (!__pyx_mstate->__pyx_ptype_5spacy_8pipeline_17_parser_internals_10stateclass_StateClass) __PYX_ERR(5, 9, __pyx_L1_error) + __pyx_vtabptr_5spacy_8pipeline_17_parser_internals_10stateclass_StateClass = (struct __pyx_vtabstruct_5spacy_8pipeline_17_parser_internals_10stateclass_StateClass*)__Pyx_GetVtable(__pyx_mstate->__pyx_ptype_5spacy_8pipeline_17_parser_internals_10stateclass_StateClass); if (unlikely(!__pyx_vtabptr_5spacy_8pipeline_17_parser_internals_10stateclass_StateClass)) __PYX_ERR(5, 9, __pyx_L1_error) + __Pyx_DECREF(__pyx_t_1); __pyx_t_1 = 0; + __pyx_t_1 = PyImport_ImportModule("thinc.extra.search"); if (unlikely(!__pyx_t_1)) __PYX_ERR(15, 37, __pyx_L1_error) + __Pyx_GOTREF(__pyx_t_1); + __pyx_mstate->__pyx_ptype_5thinc_5extra_6search_Beam = __Pyx_ImportType_3_2_1(__pyx_t_1, "thinc.extra.search", "Beam", + #if defined(PYPY_VERSION_NUM) && PYPY_VERSION_NUM < 0x050B0000 + sizeof(struct __pyx_obj_5thinc_5extra_6search_Beam), __PYX_GET_STRUCT_ALIGNMENT_3_2_1(struct __pyx_obj_5thinc_5extra_6search_Beam), + #elif CYTHON_COMPILING_IN_LIMITED_API + sizeof(struct __pyx_obj_5thinc_5extra_6search_Beam), __PYX_GET_STRUCT_ALIGNMENT_3_2_1(struct __pyx_obj_5thinc_5extra_6search_Beam), + #else + sizeof(struct __pyx_obj_5thinc_5extra_6search_Beam), __PYX_GET_STRUCT_ALIGNMENT_3_2_1(struct __pyx_obj_5thinc_5extra_6search_Beam), + #endif + __Pyx_ImportType_CheckSize_Warn_3_2_1); if (!__pyx_mstate->__pyx_ptype_5thinc_5extra_6search_Beam) __PYX_ERR(15, 37, __pyx_L1_error) + __pyx_vtabptr_5thinc_5extra_6search_Beam = (struct __pyx_vtabstruct_5thinc_5extra_6search_Beam*)__Pyx_GetVtable(__pyx_mstate->__pyx_ptype_5thinc_5extra_6search_Beam); if (unlikely(!__pyx_vtabptr_5thinc_5extra_6search_Beam)) __PYX_ERR(15, 37, __pyx_L1_error) + __pyx_mstate->__pyx_ptype_5thinc_5extra_6search_MaxViolation = __Pyx_ImportType_3_2_1(__pyx_t_1, "thinc.extra.search", "MaxViolation", + #if defined(PYPY_VERSION_NUM) && PYPY_VERSION_NUM < 0x050B0000 + sizeof(struct __pyx_obj_5thinc_5extra_6search_MaxViolation), __PYX_GET_STRUCT_ALIGNMENT_3_2_1(struct __pyx_obj_5thinc_5extra_6search_MaxViolation), + #elif CYTHON_COMPILING_IN_LIMITED_API + sizeof(struct __pyx_obj_5thinc_5extra_6search_MaxViolation), __PYX_GET_STRUCT_ALIGNMENT_3_2_1(struct __pyx_obj_5thinc_5extra_6search_MaxViolation), + #else + sizeof(struct __pyx_obj_5thinc_5extra_6search_MaxViolation), __PYX_GET_STRUCT_ALIGNMENT_3_2_1(struct __pyx_obj_5thinc_5extra_6search_MaxViolation), + #endif + __Pyx_ImportType_CheckSize_Warn_3_2_1); if (!__pyx_mstate->__pyx_ptype_5thinc_5extra_6search_MaxViolation) __PYX_ERR(15, 75, __pyx_L1_error) + __pyx_vtabptr_5thinc_5extra_6search_MaxViolation = (struct __pyx_vtabstruct_5thinc_5extra_6search_MaxViolation*)__Pyx_GetVtable(__pyx_mstate->__pyx_ptype_5thinc_5extra_6search_MaxViolation); if (unlikely(!__pyx_vtabptr_5thinc_5extra_6search_MaxViolation)) __PYX_ERR(15, 75, __pyx_L1_error) + __Pyx_DECREF(__pyx_t_1); __pyx_t_1 = 0; + __pyx_t_1 = PyImport_ImportModule("spacy.tokens.span"); if (unlikely(!__pyx_t_1)) __PYX_ERR(6, 8, __pyx_L1_error) + __Pyx_GOTREF(__pyx_t_1); + __pyx_mstate->__pyx_ptype_5spacy_6tokens_4span_Span = __Pyx_ImportType_3_2_1(__pyx_t_1, "spacy.tokens.span", "Span", + #if defined(PYPY_VERSION_NUM) && PYPY_VERSION_NUM < 0x050B0000 + sizeof(struct __pyx_obj_5spacy_6tokens_4span_Span), __PYX_GET_STRUCT_ALIGNMENT_3_2_1(struct __pyx_obj_5spacy_6tokens_4span_Span), + #elif CYTHON_COMPILING_IN_LIMITED_API + sizeof(struct __pyx_obj_5spacy_6tokens_4span_Span), __PYX_GET_STRUCT_ALIGNMENT_3_2_1(struct __pyx_obj_5spacy_6tokens_4span_Span), + #else + sizeof(struct __pyx_obj_5spacy_6tokens_4span_Span), __PYX_GET_STRUCT_ALIGNMENT_3_2_1(struct __pyx_obj_5spacy_6tokens_4span_Span), + #endif + __Pyx_ImportType_CheckSize_Warn_3_2_1); if (!__pyx_mstate->__pyx_ptype_5spacy_6tokens_4span_Span) __PYX_ERR(6, 8, __pyx_L1_error) + __pyx_vtabptr_5spacy_6tokens_4span_Span = (struct __pyx_vtabstruct_5spacy_6tokens_4span_Span*)__Pyx_GetVtable(__pyx_mstate->__pyx_ptype_5spacy_6tokens_4span_Span); if (unlikely(!__pyx_vtabptr_5spacy_6tokens_4span_Span)) __PYX_ERR(6, 8, __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); + PyObject *__pyx_t_1 = NULL; + int __pyx_lineno = 0; + const char *__pyx_filename = NULL; + int __pyx_clineno = 0; + __Pyx_RefNannySetupContext("__Pyx_modinit_variable_import_code", 0); + /*--- Variable import code ---*/ + { + __pyx_t_1 = PyImport_ImportModule("spacy.vocab"); 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_struct___pyx_t_5spacy_7structs_L); + #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 + 39; + void **const __pyx_import_pointers[] = {(void **)&__pyx_vp_5spacy_5vocab_EMPTY_LEXEME, (void **) NULL}; + void **const *__pyx_import_pointer = __pyx_import_pointers; + const char *__pyx_import_current_signature = __pyx_import_signature; + while (*__pyx_import_pointer) { + if (__Pyx_ImportVoidPtr_3_2_1(__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_t_1 = PyImport_ImportModule("spacy.lexeme"); 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_pyx_t_5spacy_8typedefs_attr_t); + #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 + 71; + void **const __pyx_import_pointers[] = {(void **)&__pyx_vp_5spacy_6lexeme_OOV_RANK, (void **)&__pyx_vp_5spacy_6lexeme_EMPTY_LEXEME, (void **) NULL}; + void **const *__pyx_import_pointer = __pyx_import_pointers; + const char *__pyx_import_current_signature = __pyx_import_signature; + while (*__pyx_import_pointer) { + if (__Pyx_ImportVoidPtr_3_2_1(__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; +} + +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("murmurhash.mrmr"); 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_uint64_t_void_int_uint64_t_hash6); + #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 + 33; + void (**const __pyx_import_pointers[])(void) = {(void (**)(void))&__pyx_f_10murmurhash_4mrmr_hash64, (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_1(__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_ner(PyObject* module); /*proto*/ +static PyModuleDef_Slot __pyx_moduledef_slots[] = { + {Py_mod_create, (void*)__pyx_pymod_create}, + {Py_mod_exec, (void*)__pyx_pymod_exec_ner}, + #if CYTHON_COMPILING_IN_CPYTHON_FREETHREADING + {Py_mod_gil, Py_MOD_GIL_USED}, + #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, + "ner", + 0, /* 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_ner(void) CYTHON_SMALL_CODE; /*proto*/ +__Pyx_PyMODINIT_FUNC PyInit_ner(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_ner(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; + PyObject *__pyx_t_4 = NULL; + PyObject *__pyx_t_5 = NULL; + size_t __pyx_t_6; + static PyThread_type_lock __pyx_t_7[8]; + int __pyx_t_8; + Py_ssize_t __pyx_t_9; + 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 'ner' 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 "ner" 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_ner", 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_spacy__pipeline___parser_internals__ner) { + if (PyObject_SetAttr(__pyx_m, __pyx_mstate_global->__pyx_n_u_name_2, __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, "spacy.pipeline._parser_internals.ner")) { + if (unlikely((PyDict_SetItemString(modules, "spacy.pipeline._parser_internals.ner", __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) + if (unlikely((__Pyx_modinit_variable_import_code(__pyx_mstate) < 0))) __PYX_ERR(0, 1, __pyx_L1_error) + if (unlikely((__Pyx_modinit_function_import_code(__pyx_mstate) < 0))) __PYX_ERR(0, 1, __pyx_L1_error) + /*--- Execution code ---*/ + + /* "View.MemoryView":100 + * + * cdef object __pyx_collections_abc_Sequence "__pyx_collections_abc_Sequence" + * try: # <<<<<<<<<<<<<< + * __pyx_collections_abc_Sequence = __import__("collections.abc").abc.Sequence + * except: +*/ + { + __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:*/ { + + /* "View.MemoryView":101 + * cdef object __pyx_collections_abc_Sequence "__pyx_collections_abc_Sequence" + * try: + * __pyx_collections_abc_Sequence = __import__("collections.abc").abc.Sequence # <<<<<<<<<<<<<< + * except: + * +*/ + __pyx_t_5 = NULL; + __pyx_t_6 = 1; + { + PyObject *__pyx_callargs[2] = {__pyx_t_5, __pyx_mstate_global->__pyx_kp_u_collections_abc}; + __pyx_t_4 = __Pyx_PyObject_FastCall((PyObject*)__pyx_builtin___import__, __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(1, 101, __pyx_L2_error) + __Pyx_GOTREF(__pyx_t_4); + } + __pyx_t_5 = __Pyx_PyObject_GetAttrStr(__pyx_t_4, __pyx_mstate_global->__pyx_n_u_abc); if (unlikely(!__pyx_t_5)) __PYX_ERR(1, 101, __pyx_L2_error) + __Pyx_GOTREF(__pyx_t_5); + __Pyx_DECREF(__pyx_t_4); __pyx_t_4 = 0; + __pyx_t_4 = __Pyx_PyObject_GetAttrStr(__pyx_t_5, __pyx_mstate_global->__pyx_n_u_Sequence); if (unlikely(!__pyx_t_4)) __PYX_ERR(1, 101, __pyx_L2_error) + __Pyx_GOTREF(__pyx_t_4); + __Pyx_DECREF(__pyx_t_5); __pyx_t_5 = 0; + __Pyx_XGOTREF(__pyx_collections_abc_Sequence); + __Pyx_DECREF_SET(__pyx_collections_abc_Sequence, __pyx_t_4); + __Pyx_GIVEREF(__pyx_t_4); + __pyx_t_4 = 0; + + /* "View.MemoryView":100 + * + * cdef object __pyx_collections_abc_Sequence "__pyx_collections_abc_Sequence" + * try: # <<<<<<<<<<<<<< + * __pyx_collections_abc_Sequence = __import__("collections.abc").abc.Sequence + * except: +*/ + } + __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_L7_try_end; + __pyx_L2_error:; + __Pyx_XDECREF(__pyx_t_4); __pyx_t_4 = 0; + __Pyx_XDECREF(__pyx_t_5); __pyx_t_5 = 0; + + /* "View.MemoryView":102 + * try: + * __pyx_collections_abc_Sequence = __import__("collections.abc").abc.Sequence + * except: # <<<<<<<<<<<<<< + * + * __pyx_collections_abc_Sequence = None +*/ + /*except:*/ { + __Pyx_ErrRestore(0,0,0); + + /* "View.MemoryView":104 + * except: + * + * __pyx_collections_abc_Sequence = None # <<<<<<<<<<<<<< + * + * +*/ + __Pyx_INCREF(Py_None); + __Pyx_XGOTREF(__pyx_collections_abc_Sequence); + __Pyx_DECREF_SET(__pyx_collections_abc_Sequence, Py_None); + __Pyx_GIVEREF(Py_None); + goto __pyx_L3_exception_handled; + } + __pyx_L3_exception_handled:; + __Pyx_XGIVEREF(__pyx_t_1); + __Pyx_XGIVEREF(__pyx_t_2); + __Pyx_XGIVEREF(__pyx_t_3); + __Pyx_ExceptionReset(__pyx_t_1, __pyx_t_2, __pyx_t_3); + __pyx_L7_try_end:; + } + + /* "View.MemoryView":239 + * + * + * try: # <<<<<<<<<<<<<< + * count = __pyx_collections_abc_Sequence.count + * index = __pyx_collections_abc_Sequence.index +*/ + { + __Pyx_PyThreadState_declare + __Pyx_PyThreadState_assign + __Pyx_ExceptionSave(&__pyx_t_3, &__pyx_t_2, &__pyx_t_1); + __Pyx_XGOTREF(__pyx_t_3); + __Pyx_XGOTREF(__pyx_t_2); + __Pyx_XGOTREF(__pyx_t_1); + /*try:*/ { + + /* "View.MemoryView":240 + * + * try: + * count = __pyx_collections_abc_Sequence.count # <<<<<<<<<<<<<< + * index = __pyx_collections_abc_Sequence.index + * except: +*/ + __pyx_t_4 = __Pyx_PyObject_GetAttrStr(__pyx_collections_abc_Sequence, __pyx_mstate_global->__pyx_n_u_count); if (unlikely(!__pyx_t_4)) __PYX_ERR(1, 240, __pyx_L10_error) + __Pyx_GOTREF(__pyx_t_4); + if (__Pyx_SetItemOnTypeDict(__pyx_mstate_global->__pyx_array_type, __pyx_mstate_global->__pyx_n_u_count, __pyx_t_4) < (0)) __PYX_ERR(1, 240, __pyx_L10_error) + __Pyx_DECREF(__pyx_t_4); __pyx_t_4 = 0; + + /* "View.MemoryView":241 + * try: + * count = __pyx_collections_abc_Sequence.count + * index = __pyx_collections_abc_Sequence.index # <<<<<<<<<<<<<< + * except: + * pass +*/ + __pyx_t_4 = __Pyx_PyObject_GetAttrStr(__pyx_collections_abc_Sequence, __pyx_mstate_global->__pyx_n_u_index); if (unlikely(!__pyx_t_4)) __PYX_ERR(1, 241, __pyx_L10_error) + __Pyx_GOTREF(__pyx_t_4); + if (__Pyx_SetItemOnTypeDict(__pyx_mstate_global->__pyx_array_type, __pyx_mstate_global->__pyx_n_u_index, __pyx_t_4) < (0)) __PYX_ERR(1, 241, __pyx_L10_error) + __Pyx_DECREF(__pyx_t_4); __pyx_t_4 = 0; + + /* "View.MemoryView":239 + * + * + * try: # <<<<<<<<<<<<<< + * count = __pyx_collections_abc_Sequence.count + * index = __pyx_collections_abc_Sequence.index +*/ + } + __Pyx_XDECREF(__pyx_t_3); __pyx_t_3 = 0; + __Pyx_XDECREF(__pyx_t_2); __pyx_t_2 = 0; + __Pyx_XDECREF(__pyx_t_1); __pyx_t_1 = 0; + goto __pyx_L15_try_end; + __pyx_L10_error:; + __Pyx_XDECREF(__pyx_t_4); __pyx_t_4 = 0; + __Pyx_XDECREF(__pyx_t_5); __pyx_t_5 = 0; + + /* "View.MemoryView":242 + * count = __pyx_collections_abc_Sequence.count + * index = __pyx_collections_abc_Sequence.index + * except: # <<<<<<<<<<<<<< + * pass + * +*/ + /*except:*/ { + __Pyx_ErrRestore(0,0,0); + goto __pyx_L11_exception_handled; + } + __pyx_L11_exception_handled:; + __Pyx_XGIVEREF(__pyx_t_3); + __Pyx_XGIVEREF(__pyx_t_2); + __Pyx_XGIVEREF(__pyx_t_1); + __Pyx_ExceptionReset(__pyx_t_3, __pyx_t_2, __pyx_t_1); + __pyx_L15_try_end:; + } + + /* "View.MemoryView":307 + * return self.name + * + * cdef generic = Enum("") # <<<<<<<<<<<<<< + * cdef strided = Enum("") # default + * cdef indirect = Enum("") +*/ + __pyx_t_5 = NULL; + __pyx_t_6 = 1; + { + PyObject *__pyx_callargs[2] = {__pyx_t_5, __pyx_mstate_global->__pyx_kp_u_strided_and_direct_or_indirect}; + __pyx_t_4 = __Pyx_PyObject_FastCall((PyObject*)__pyx_mstate_global->__pyx_MemviewEnum_type, __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(1, 307, __pyx_L1_error) + __Pyx_GOTREF((PyObject *)__pyx_t_4); + } + __Pyx_XGOTREF(generic); + __Pyx_DECREF_SET(generic, ((PyObject *)__pyx_t_4)); + __Pyx_GIVEREF((PyObject *)__pyx_t_4); + __pyx_t_4 = 0; + + /* "View.MemoryView":308 + * + * cdef generic = Enum("") + * cdef strided = Enum("") # default # <<<<<<<<<<<<<< + * cdef indirect = Enum("") + * +*/ + __pyx_t_5 = NULL; + __pyx_t_6 = 1; + { + PyObject *__pyx_callargs[2] = {__pyx_t_5, __pyx_mstate_global->__pyx_kp_u_strided_and_direct}; + __pyx_t_4 = __Pyx_PyObject_FastCall((PyObject*)__pyx_mstate_global->__pyx_MemviewEnum_type, __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(1, 308, __pyx_L1_error) + __Pyx_GOTREF((PyObject *)__pyx_t_4); + } + __Pyx_XGOTREF(strided); + __Pyx_DECREF_SET(strided, ((PyObject *)__pyx_t_4)); + __Pyx_GIVEREF((PyObject *)__pyx_t_4); + __pyx_t_4 = 0; + + /* "View.MemoryView":309 + * cdef generic = Enum("") + * cdef strided = Enum("") # default + * cdef indirect = Enum("") # <<<<<<<<<<<<<< + * + * +*/ + __pyx_t_5 = NULL; + __pyx_t_6 = 1; + { + PyObject *__pyx_callargs[2] = {__pyx_t_5, __pyx_mstate_global->__pyx_kp_u_strided_and_indirect}; + __pyx_t_4 = __Pyx_PyObject_FastCall((PyObject*)__pyx_mstate_global->__pyx_MemviewEnum_type, __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(1, 309, __pyx_L1_error) + __Pyx_GOTREF((PyObject *)__pyx_t_4); + } + __Pyx_XGOTREF(indirect); + __Pyx_DECREF_SET(indirect, ((PyObject *)__pyx_t_4)); + __Pyx_GIVEREF((PyObject *)__pyx_t_4); + __pyx_t_4 = 0; + + /* "View.MemoryView":312 + * + * + * cdef contiguous = Enum("") # <<<<<<<<<<<<<< + * cdef indirect_contiguous = Enum("") + * +*/ + __pyx_t_5 = NULL; + __pyx_t_6 = 1; + { + PyObject *__pyx_callargs[2] = {__pyx_t_5, __pyx_mstate_global->__pyx_kp_u_contiguous_and_direct}; + __pyx_t_4 = __Pyx_PyObject_FastCall((PyObject*)__pyx_mstate_global->__pyx_MemviewEnum_type, __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(1, 312, __pyx_L1_error) + __Pyx_GOTREF((PyObject *)__pyx_t_4); + } + __Pyx_XGOTREF(contiguous); + __Pyx_DECREF_SET(contiguous, ((PyObject *)__pyx_t_4)); + __Pyx_GIVEREF((PyObject *)__pyx_t_4); + __pyx_t_4 = 0; + + /* "View.MemoryView":313 + * + * cdef contiguous = Enum("") + * cdef indirect_contiguous = Enum("") # <<<<<<<<<<<<<< + * + * +*/ + __pyx_t_5 = NULL; + __pyx_t_6 = 1; + { + PyObject *__pyx_callargs[2] = {__pyx_t_5, __pyx_mstate_global->__pyx_kp_u_contiguous_and_indirect}; + __pyx_t_4 = __Pyx_PyObject_FastCall((PyObject*)__pyx_mstate_global->__pyx_MemviewEnum_type, __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(1, 313, __pyx_L1_error) + __Pyx_GOTREF((PyObject *)__pyx_t_4); + } + __Pyx_XGOTREF(indirect_contiguous); + __Pyx_DECREF_SET(indirect_contiguous, ((PyObject *)__pyx_t_4)); + __Pyx_GIVEREF((PyObject *)__pyx_t_4); + __pyx_t_4 = 0; + + /* "View.MemoryView":321 + * + * + * cdef int __pyx_memoryview_thread_locks_used = 0 # <<<<<<<<<<<<<< + * cdef PyThread_type_lock[8] __pyx_memoryview_thread_locks = [ + * PyThread_allocate_lock(), +*/ + __pyx_memoryview_thread_locks_used = 0; + + /* "View.MemoryView":322 + * + * cdef int __pyx_memoryview_thread_locks_used = 0 + * cdef PyThread_type_lock[8] __pyx_memoryview_thread_locks = [ # <<<<<<<<<<<<<< + * PyThread_allocate_lock(), + * PyThread_allocate_lock(), +*/ + __pyx_t_7[0] = PyThread_allocate_lock(); + __pyx_t_7[1] = PyThread_allocate_lock(); + __pyx_t_7[2] = PyThread_allocate_lock(); + __pyx_t_7[3] = PyThread_allocate_lock(); + __pyx_t_7[4] = PyThread_allocate_lock(); + __pyx_t_7[5] = PyThread_allocate_lock(); + __pyx_t_7[6] = PyThread_allocate_lock(); + __pyx_t_7[7] = PyThread_allocate_lock(); + memcpy(&(__pyx_memoryview_thread_locks[0]), __pyx_t_7, sizeof(__pyx_memoryview_thread_locks[0]) * (8)); + + /* "View.MemoryView":983 + * + * + * try: # <<<<<<<<<<<<<< + * count = __pyx_collections_abc_Sequence.count + * index = __pyx_collections_abc_Sequence.index +*/ + { + __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:*/ { + + /* "View.MemoryView":984 + * + * try: + * count = __pyx_collections_abc_Sequence.count # <<<<<<<<<<<<<< + * index = __pyx_collections_abc_Sequence.index + * except: +*/ + __pyx_t_4 = __Pyx_PyObject_GetAttrStr(__pyx_collections_abc_Sequence, __pyx_mstate_global->__pyx_n_u_count); if (unlikely(!__pyx_t_4)) __PYX_ERR(1, 984, __pyx_L18_error) + __Pyx_GOTREF(__pyx_t_4); + if (__Pyx_SetItemOnTypeDict(__pyx_mstate_global->__pyx_memoryviewslice_type, __pyx_mstate_global->__pyx_n_u_count, __pyx_t_4) < (0)) __PYX_ERR(1, 984, __pyx_L18_error) + __Pyx_DECREF(__pyx_t_4); __pyx_t_4 = 0; + + /* "View.MemoryView":985 + * try: + * count = __pyx_collections_abc_Sequence.count + * index = __pyx_collections_abc_Sequence.index # <<<<<<<<<<<<<< + * except: + * pass +*/ + __pyx_t_4 = __Pyx_PyObject_GetAttrStr(__pyx_collections_abc_Sequence, __pyx_mstate_global->__pyx_n_u_index); if (unlikely(!__pyx_t_4)) __PYX_ERR(1, 985, __pyx_L18_error) + __Pyx_GOTREF(__pyx_t_4); + if (__Pyx_SetItemOnTypeDict(__pyx_mstate_global->__pyx_memoryviewslice_type, __pyx_mstate_global->__pyx_n_u_index, __pyx_t_4) < (0)) __PYX_ERR(1, 985, __pyx_L18_error) + __Pyx_DECREF(__pyx_t_4); __pyx_t_4 = 0; + + /* "View.MemoryView":983 + * + * + * try: # <<<<<<<<<<<<<< + * count = __pyx_collections_abc_Sequence.count + * index = __pyx_collections_abc_Sequence.index +*/ + } + __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_L23_try_end; + __pyx_L18_error:; + __Pyx_XDECREF(__pyx_t_4); __pyx_t_4 = 0; + __Pyx_XDECREF(__pyx_t_5); __pyx_t_5 = 0; + + /* "View.MemoryView":986 + * count = __pyx_collections_abc_Sequence.count + * index = __pyx_collections_abc_Sequence.index + * except: # <<<<<<<<<<<<<< + * pass + * +*/ + /*except:*/ { + __Pyx_ErrRestore(0,0,0); + goto __pyx_L19_exception_handled; + } + __pyx_L19_exception_handled:; + __Pyx_XGIVEREF(__pyx_t_1); + __Pyx_XGIVEREF(__pyx_t_2); + __Pyx_XGIVEREF(__pyx_t_3); + __Pyx_ExceptionReset(__pyx_t_1, __pyx_t_2, __pyx_t_3); + __pyx_L23_try_end:; + } + + /* "View.MemoryView":989 + * pass + * + * try: # <<<<<<<<<<<<<< + * if __pyx_collections_abc_Sequence: + * +*/ + { + __Pyx_PyThreadState_declare + __Pyx_PyThreadState_assign + __Pyx_ExceptionSave(&__pyx_t_3, &__pyx_t_2, &__pyx_t_1); + __Pyx_XGOTREF(__pyx_t_3); + __Pyx_XGOTREF(__pyx_t_2); + __Pyx_XGOTREF(__pyx_t_1); + /*try:*/ { + + /* "View.MemoryView":990 + * + * try: + * if __pyx_collections_abc_Sequence: # <<<<<<<<<<<<<< + * + * +*/ + __pyx_t_8 = __Pyx_PyObject_IsTrue(__pyx_collections_abc_Sequence); if (unlikely((__pyx_t_8 < 0))) __PYX_ERR(1, 990, __pyx_L26_error) + if (__pyx_t_8) { + + /* "View.MemoryView":994 + * + * + * __pyx_collections_abc_Sequence.register(_memoryviewslice) # <<<<<<<<<<<<<< + * __pyx_collections_abc_Sequence.register(array) + * except: +*/ + __pyx_t_5 = __pyx_collections_abc_Sequence; + __Pyx_INCREF(__pyx_t_5); + __pyx_t_6 = 0; + { + PyObject *__pyx_callargs[2] = {__pyx_t_5, ((PyObject *)__pyx_mstate_global->__pyx_memoryviewslice_type)}; + __pyx_t_4 = __Pyx_PyObject_FastCallMethod((PyObject*)__pyx_mstate_global->__pyx_n_u_register, __pyx_callargs+__pyx_t_6, (2-__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(1, 994, __pyx_L26_error) + __Pyx_GOTREF(__pyx_t_4); + } + __Pyx_DECREF(__pyx_t_4); __pyx_t_4 = 0; + + /* "View.MemoryView":995 + * + * __pyx_collections_abc_Sequence.register(_memoryviewslice) + * __pyx_collections_abc_Sequence.register(array) # <<<<<<<<<<<<<< + * except: + * pass # ignore failure, it's a minor issue +*/ + __pyx_t_5 = __pyx_collections_abc_Sequence; + __Pyx_INCREF(__pyx_t_5); + __pyx_t_6 = 0; + { + PyObject *__pyx_callargs[2] = {__pyx_t_5, ((PyObject *)__pyx_mstate_global->__pyx_array_type)}; + __pyx_t_4 = __Pyx_PyObject_FastCallMethod((PyObject*)__pyx_mstate_global->__pyx_n_u_register, __pyx_callargs+__pyx_t_6, (2-__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(1, 995, __pyx_L26_error) + __Pyx_GOTREF(__pyx_t_4); + } + __Pyx_DECREF(__pyx_t_4); __pyx_t_4 = 0; + + /* "View.MemoryView":990 + * + * try: + * if __pyx_collections_abc_Sequence: # <<<<<<<<<<<<<< + * + * +*/ + } + + /* "View.MemoryView":989 + * pass + * + * try: # <<<<<<<<<<<<<< + * if __pyx_collections_abc_Sequence: + * +*/ + } + __Pyx_XDECREF(__pyx_t_3); __pyx_t_3 = 0; + __Pyx_XDECREF(__pyx_t_2); __pyx_t_2 = 0; + __Pyx_XDECREF(__pyx_t_1); __pyx_t_1 = 0; + goto __pyx_L31_try_end; + __pyx_L26_error:; + __Pyx_XDECREF(__pyx_t_4); __pyx_t_4 = 0; + __Pyx_XDECREF(__pyx_t_5); __pyx_t_5 = 0; + + /* "View.MemoryView":996 + * __pyx_collections_abc_Sequence.register(_memoryviewslice) + * __pyx_collections_abc_Sequence.register(array) + * except: # <<<<<<<<<<<<<< + * pass # ignore failure, it's a minor issue + * +*/ + /*except:*/ { + __Pyx_ErrRestore(0,0,0); + goto __pyx_L27_exception_handled; + } + __pyx_L27_exception_handled:; + __Pyx_XGIVEREF(__pyx_t_3); + __Pyx_XGIVEREF(__pyx_t_2); + __Pyx_XGIVEREF(__pyx_t_1); + __Pyx_ExceptionReset(__pyx_t_3, __pyx_t_2, __pyx_t_1); + __pyx_L31_try_end:; + } + + /* "(tree fragment)":4 + * int __Pyx_CheckUnpickleChecksum(long, long, long, long, const char*) except -1 + * int __Pyx_UpdateUnpickledDict(object, object, Py_ssize_t) except -1 + * def __pyx_unpickle_Enum(__pyx_type, long __pyx_checksum, tuple __pyx_state): # <<<<<<<<<<<<<< + * cdef object __pyx_result + * __Pyx_CheckUnpickleChecksum(__pyx_checksum, 0x82a3537, 0x6ae9995, 0xb068931, b'name') +*/ + __pyx_t_4 = PyCFunction_NewEx(&__pyx_mdef_15View_dot_MemoryView_1__pyx_unpickle_Enum, NULL, __pyx_mstate_global->__pyx_n_u_View_MemoryView); if (unlikely(!__pyx_t_4)) __PYX_ERR(1, 4, __pyx_L1_error) + __Pyx_GOTREF(__pyx_t_4); + if (PyDict_SetItem(__pyx_mstate_global->__pyx_d, __pyx_mstate_global->__pyx_n_u_pyx_unpickle_Enum, __pyx_t_4) < (0)) __PYX_ERR(1, 4, __pyx_L1_error) + __Pyx_DECREF(__pyx_t_4); __pyx_t_4 = 0; + + /* "spacy/pipeline/_parser_internals/ner.pyx":5 + * from libc.stdint cimport int32_t + * + * from collections import Counter # <<<<<<<<<<<<<< + * + * from thinc.extra.search cimport Beam +*/ + { + PyObject* const __pyx_imported_names[] = {__pyx_mstate_global->__pyx_n_u_Counter}; + __pyx_t_1 = __Pyx_Import(__pyx_mstate_global->__pyx_n_u_collections, __pyx_imported_names, 1, __pyx_mstate_global->__pyx_kp_u_spacy_pipeline__parser_internals, -1); if (unlikely(!__pyx_t_1)) __PYX_ERR(0, 5, __pyx_L1_error) + } + __pyx_t_4 = __pyx_t_1; + __Pyx_GOTREF(__pyx_t_4); + { + PyObject* const __pyx_imported_names[] = {__pyx_mstate_global->__pyx_n_u_Counter}; + __pyx_t_9 = 0; { + __pyx_t_5 = __Pyx_ImportFrom(__pyx_t_4, __pyx_imported_names[__pyx_t_9]); if (unlikely(!__pyx_t_5)) __PYX_ERR(0, 5, __pyx_L1_error) + __Pyx_GOTREF(__pyx_t_5); + if (PyDict_SetItem(__pyx_mstate_global->__pyx_d, __pyx_imported_names[__pyx_t_9], __pyx_t_5) < (0)) __PYX_ERR(0, 5, __pyx_L1_error) + __Pyx_DECREF(__pyx_t_5); __pyx_t_5 = 0; + } + } + __Pyx_DECREF(__pyx_t_4); __pyx_t_4 = 0; + + /* "spacy/pipeline/_parser_internals/ner.pyx":11 + * from ...tokens.doc cimport Doc + * + * from ...tokens.span import Span # <<<<<<<<<<<<<< + * + * from ...attrs cimport IS_SPACE +*/ + { + PyObject* const __pyx_imported_names[] = {__pyx_mstate_global->__pyx_n_u_Span}; + __pyx_t_1 = __Pyx_Import(__pyx_mstate_global->__pyx_n_u_tokens_span, __pyx_imported_names, 1, __pyx_mstate_global->__pyx_kp_u_spacy_tokens_span, 3); if (unlikely(!__pyx_t_1)) __PYX_ERR(0, 11, __pyx_L1_error) + } + __pyx_t_4 = __pyx_t_1; + __Pyx_GOTREF(__pyx_t_4); + __Pyx_DECREF(__pyx_t_4); __pyx_t_4 = 0; + + /* "spacy/pipeline/_parser_internals/ner.pyx":19 + * from ...typedefs cimport attr_t, weight_t + * + * from ...training import split_bilu_label # <<<<<<<<<<<<<< + * + * from ...training.example cimport Example +*/ + { + PyObject* const __pyx_imported_names[] = {__pyx_mstate_global->__pyx_n_u_split_bilu_label}; + __pyx_t_1 = __Pyx_Import(__pyx_mstate_global->__pyx_n_u_training, __pyx_imported_names, 1, __pyx_mstate_global->__pyx_kp_u_spacy_training, 3); if (unlikely(!__pyx_t_1)) __PYX_ERR(0, 19, __pyx_L1_error) + } + __pyx_t_4 = __pyx_t_1; + __Pyx_GOTREF(__pyx_t_4); + { + PyObject* const __pyx_imported_names[] = {__pyx_mstate_global->__pyx_n_u_split_bilu_label}; + __pyx_t_9 = 0; { + __pyx_t_5 = __Pyx_ImportFrom(__pyx_t_4, __pyx_imported_names[__pyx_t_9]); if (unlikely(!__pyx_t_5)) __PYX_ERR(0, 19, __pyx_L1_error) + __Pyx_GOTREF(__pyx_t_5); + if (PyDict_SetItem(__pyx_mstate_global->__pyx_d, __pyx_imported_names[__pyx_t_9], __pyx_t_5) < (0)) __PYX_ERR(0, 19, __pyx_L1_error) + __Pyx_DECREF(__pyx_t_5); __pyx_t_5 = 0; + } + } + __Pyx_DECREF(__pyx_t_4); __pyx_t_4 = 0; + + /* "spacy/pipeline/_parser_internals/ner.pyx":26 + * from .transition_system cimport Transition, do_func_t + * + * from ...errors import Errors # <<<<<<<<<<<<<< + * + * +*/ + { + PyObject* const __pyx_imported_names[] = {__pyx_mstate_global->__pyx_n_u_Errors}; + __pyx_t_1 = __Pyx_Import(__pyx_mstate_global->__pyx_n_u_errors, __pyx_imported_names, 1, __pyx_mstate_global->__pyx_kp_u_spacy_errors, 3); if (unlikely(!__pyx_t_1)) __PYX_ERR(0, 26, __pyx_L1_error) + } + __pyx_t_4 = __pyx_t_1; + __Pyx_GOTREF(__pyx_t_4); + { + PyObject* const __pyx_imported_names[] = {__pyx_mstate_global->__pyx_n_u_Errors}; + __pyx_t_9 = 0; { + __pyx_t_5 = __Pyx_ImportFrom(__pyx_t_4, __pyx_imported_names[__pyx_t_9]); if (unlikely(!__pyx_t_5)) __PYX_ERR(0, 26, __pyx_L1_error) + __Pyx_GOTREF(__pyx_t_5); + if (PyDict_SetItem(__pyx_mstate_global->__pyx_d, __pyx_imported_names[__pyx_t_9], __pyx_t_5) < (0)) __PYX_ERR(0, 26, __pyx_L1_error) + __Pyx_DECREF(__pyx_t_5); __pyx_t_5 = 0; + } + } + __Pyx_DECREF(__pyx_t_4); __pyx_t_4 = 0; + + /* "spacy/pipeline/_parser_internals/ner.pyx":39 + * + * + * MOVE_NAMES = [None] * N_MOVES # <<<<<<<<<<<<<< + * MOVE_NAMES[MISSING] = 'M' + * MOVE_NAMES[BEGIN] = 'B' +*/ + __pyx_t_4 = PyList_New(1 * ((__pyx_e_5spacy_8pipeline_17_parser_internals_3ner_N_MOVES<0) ? 0:__pyx_e_5spacy_8pipeline_17_parser_internals_3ner_N_MOVES)); if (unlikely(!__pyx_t_4)) __PYX_ERR(0, 39, __pyx_L1_error) + __Pyx_GOTREF(__pyx_t_4); + { Py_ssize_t __pyx_temp; + for (__pyx_temp=0; __pyx_temp < __pyx_e_5spacy_8pipeline_17_parser_internals_3ner_N_MOVES; __pyx_temp++) { + __Pyx_INCREF(Py_None); + __Pyx_GIVEREF(Py_None); + if (__Pyx_PyList_SET_ITEM(__pyx_t_4, __pyx_temp, Py_None) != (0)) __PYX_ERR(0, 39, __pyx_L1_error); + } + } + if (PyDict_SetItem(__pyx_mstate_global->__pyx_d, __pyx_mstate_global->__pyx_n_u_MOVE_NAMES, __pyx_t_4) < (0)) __PYX_ERR(0, 39, __pyx_L1_error) + __Pyx_DECREF(__pyx_t_4); __pyx_t_4 = 0; + + /* "spacy/pipeline/_parser_internals/ner.pyx":40 + * + * MOVE_NAMES = [None] * N_MOVES + * MOVE_NAMES[MISSING] = 'M' # <<<<<<<<<<<<<< + * MOVE_NAMES[BEGIN] = 'B' + * MOVE_NAMES[IN] = 'I' +*/ + __Pyx_GetModuleGlobalName(__pyx_t_4, __pyx_mstate_global->__pyx_n_u_MOVE_NAMES); if (unlikely(!__pyx_t_4)) __PYX_ERR(0, 40, __pyx_L1_error) + __Pyx_GOTREF(__pyx_t_4); + if (unlikely((__Pyx_SetItemInt(__pyx_t_4, __pyx_e_5spacy_8pipeline_17_parser_internals_3ner_MISSING, __pyx_mstate_global->__pyx_n_u_M, int, 1, __Pyx_PyLong_From___pyx_anon_enum, 0, 1, 1, 1, __Pyx_ReferenceSharing_OwnStrongReference) < 0))) __PYX_ERR(0, 40, __pyx_L1_error) + __Pyx_DECREF(__pyx_t_4); __pyx_t_4 = 0; + + /* "spacy/pipeline/_parser_internals/ner.pyx":41 + * MOVE_NAMES = [None] * N_MOVES + * MOVE_NAMES[MISSING] = 'M' + * MOVE_NAMES[BEGIN] = 'B' # <<<<<<<<<<<<<< + * MOVE_NAMES[IN] = 'I' + * MOVE_NAMES[LAST] = 'L' +*/ + __Pyx_GetModuleGlobalName(__pyx_t_4, __pyx_mstate_global->__pyx_n_u_MOVE_NAMES); if (unlikely(!__pyx_t_4)) __PYX_ERR(0, 41, __pyx_L1_error) + __Pyx_GOTREF(__pyx_t_4); + if (unlikely((__Pyx_SetItemInt(__pyx_t_4, __pyx_e_5spacy_8pipeline_17_parser_internals_3ner_BEGIN, __pyx_mstate_global->__pyx_n_u_B, int, 1, __Pyx_PyLong_From___pyx_anon_enum, 0, 1, 1, 1, __Pyx_ReferenceSharing_OwnStrongReference) < 0))) __PYX_ERR(0, 41, __pyx_L1_error) + __Pyx_DECREF(__pyx_t_4); __pyx_t_4 = 0; + + /* "spacy/pipeline/_parser_internals/ner.pyx":42 + * MOVE_NAMES[MISSING] = 'M' + * MOVE_NAMES[BEGIN] = 'B' + * MOVE_NAMES[IN] = 'I' # <<<<<<<<<<<<<< + * MOVE_NAMES[LAST] = 'L' + * MOVE_NAMES[UNIT] = 'U' +*/ + __Pyx_GetModuleGlobalName(__pyx_t_4, __pyx_mstate_global->__pyx_n_u_MOVE_NAMES); if (unlikely(!__pyx_t_4)) __PYX_ERR(0, 42, __pyx_L1_error) + __Pyx_GOTREF(__pyx_t_4); + if (unlikely((__Pyx_SetItemInt(__pyx_t_4, __pyx_e_5spacy_8pipeline_17_parser_internals_3ner_IN, __pyx_mstate_global->__pyx_n_u_I, int, 1, __Pyx_PyLong_From___pyx_anon_enum, 0, 1, 1, 1, __Pyx_ReferenceSharing_OwnStrongReference) < 0))) __PYX_ERR(0, 42, __pyx_L1_error) + __Pyx_DECREF(__pyx_t_4); __pyx_t_4 = 0; + + /* "spacy/pipeline/_parser_internals/ner.pyx":43 + * MOVE_NAMES[BEGIN] = 'B' + * MOVE_NAMES[IN] = 'I' + * MOVE_NAMES[LAST] = 'L' # <<<<<<<<<<<<<< + * MOVE_NAMES[UNIT] = 'U' + * MOVE_NAMES[OUT] = 'O' +*/ + __Pyx_GetModuleGlobalName(__pyx_t_4, __pyx_mstate_global->__pyx_n_u_MOVE_NAMES); if (unlikely(!__pyx_t_4)) __PYX_ERR(0, 43, __pyx_L1_error) + __Pyx_GOTREF(__pyx_t_4); + if (unlikely((__Pyx_SetItemInt(__pyx_t_4, __pyx_e_5spacy_8pipeline_17_parser_internals_3ner_LAST, __pyx_mstate_global->__pyx_n_u_L, int, 1, __Pyx_PyLong_From___pyx_anon_enum, 0, 1, 1, 1, __Pyx_ReferenceSharing_OwnStrongReference) < 0))) __PYX_ERR(0, 43, __pyx_L1_error) + __Pyx_DECREF(__pyx_t_4); __pyx_t_4 = 0; + + /* "spacy/pipeline/_parser_internals/ner.pyx":44 + * MOVE_NAMES[IN] = 'I' + * MOVE_NAMES[LAST] = 'L' + * MOVE_NAMES[UNIT] = 'U' # <<<<<<<<<<<<<< + * MOVE_NAMES[OUT] = 'O' + * +*/ + __Pyx_GetModuleGlobalName(__pyx_t_4, __pyx_mstate_global->__pyx_n_u_MOVE_NAMES); if (unlikely(!__pyx_t_4)) __PYX_ERR(0, 44, __pyx_L1_error) + __Pyx_GOTREF(__pyx_t_4); + if (unlikely((__Pyx_SetItemInt(__pyx_t_4, __pyx_e_5spacy_8pipeline_17_parser_internals_3ner_UNIT, __pyx_mstate_global->__pyx_n_u_U, int, 1, __Pyx_PyLong_From___pyx_anon_enum, 0, 1, 1, 1, __Pyx_ReferenceSharing_OwnStrongReference) < 0))) __PYX_ERR(0, 44, __pyx_L1_error) + __Pyx_DECREF(__pyx_t_4); __pyx_t_4 = 0; + + /* "spacy/pipeline/_parser_internals/ner.pyx":45 + * MOVE_NAMES[LAST] = 'L' + * MOVE_NAMES[UNIT] = 'U' + * MOVE_NAMES[OUT] = 'O' # <<<<<<<<<<<<<< + * + * +*/ + __Pyx_GetModuleGlobalName(__pyx_t_4, __pyx_mstate_global->__pyx_n_u_MOVE_NAMES); if (unlikely(!__pyx_t_4)) __PYX_ERR(0, 45, __pyx_L1_error) + __Pyx_GOTREF(__pyx_t_4); + if (unlikely((__Pyx_SetItemInt(__pyx_t_4, __pyx_e_5spacy_8pipeline_17_parser_internals_3ner_OUT, __pyx_mstate_global->__pyx_n_u_O, int, 1, __Pyx_PyLong_From___pyx_anon_enum, 0, 1, 1, 1, __Pyx_ReferenceSharing_OwnStrongReference) < 0))) __PYX_ERR(0, 45, __pyx_L1_error) + __Pyx_DECREF(__pyx_t_4); __pyx_t_4 = 0; + + /* "spacy/pipeline/_parser_internals/ner.pyx":63 + * self.c = create_gold_state(self.mem, moves, stcls.c, example, neg_key) + * + * def update(self, StateClass stcls): # <<<<<<<<<<<<<< + * update_gold_state(&self.c, stcls.c) + * +*/ + __pyx_t_4 = __Pyx_CyFunction_New(&__pyx_mdef_5spacy_8pipeline_17_parser_internals_3ner_9BiluoGold_3update, __Pyx_CYFUNCTION_CCLASS, __pyx_mstate_global->__pyx_n_u_BiluoGold_update, NULL, __pyx_mstate_global->__pyx_n_u_spacy_pipeline__parser_internals_2, __pyx_mstate_global->__pyx_d, ((PyObject *)__pyx_mstate_global->__pyx_codeobj_tab[0])); if (unlikely(!__pyx_t_4)) __PYX_ERR(0, 63, __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 (__Pyx_SetItemOnTypeDict(__pyx_mstate_global->__pyx_ptype_5spacy_8pipeline_17_parser_internals_3ner_BiluoGold, __pyx_mstate_global->__pyx_n_u_update, __pyx_t_4) < (0)) __PYX_ERR(0, 63, __pyx_L1_error) + __Pyx_DECREF(__pyx_t_4); __pyx_t_4 = 0; + + /* "(tree fragment)":1 + * def __reduce_cython__(self): # <<<<<<<<<<<<<< + * raise TypeError, "self.c cannot be converted to a Python object for pickling" + * def __setstate_cython__(self, __pyx_state): +*/ + __pyx_t_4 = __Pyx_CyFunction_New(&__pyx_mdef_5spacy_8pipeline_17_parser_internals_3ner_9BiluoGold_5__reduce_cython__, __Pyx_CYFUNCTION_CCLASS, __pyx_mstate_global->__pyx_n_u_BiluoGold___reduce_cython, NULL, __pyx_mstate_global->__pyx_n_u_spacy_pipeline__parser_internals_2, __pyx_mstate_global->__pyx_d, ((PyObject *)__pyx_mstate_global->__pyx_codeobj_tab[1])); 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, "self.c cannot be converted to a Python object for pickling" + * def __setstate_cython__(self, __pyx_state): # <<<<<<<<<<<<<< + * raise TypeError, "self.c cannot be converted to a Python object for pickling" +*/ + __pyx_t_4 = __Pyx_CyFunction_New(&__pyx_mdef_5spacy_8pipeline_17_parser_internals_3ner_9BiluoGold_7__setstate_cython__, __Pyx_CYFUNCTION_CCLASS, __pyx_mstate_global->__pyx_n_u_BiluoGold___setstate_cython, NULL, __pyx_mstate_global->__pyx_n_u_spacy_pipeline__parser_internals_2, __pyx_mstate_global->__pyx_d, ((PyObject *)__pyx_mstate_global->__pyx_codeobj_tab[2])); 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; + + /* "spacy/pipeline/_parser_internals/ner.pyx":131 + * TransitionSystem.__init__(self, *args, **kwargs) + * + * @classmethod # <<<<<<<<<<<<<< + * def get_actions(cls, **kwargs): + * actions = { +*/ + __pyx_t_4 = __Pyx_CyFunction_New(&__pyx_mdef_5spacy_8pipeline_17_parser_internals_3ner_13BiluoPushDown_3get_actions, __Pyx_CYFUNCTION_CLASSMETHOD | __Pyx_CYFUNCTION_CCLASS, __pyx_mstate_global->__pyx_n_u_BiluoPushDown_get_actions, NULL, __pyx_mstate_global->__pyx_n_u_spacy_pipeline__parser_internals_2, __pyx_mstate_global->__pyx_d, ((PyObject *)__pyx_mstate_global->__pyx_codeobj_tab[3])); if (unlikely(!__pyx_t_4)) __PYX_ERR(0, 131, __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 (__Pyx_SetItemOnTypeDict(__pyx_mstate_global->__pyx_ptype_5spacy_8pipeline_17_parser_internals_3ner_BiluoPushDown, __pyx_mstate_global->__pyx_n_u_get_actions, __pyx_t_4) < (0)) __PYX_ERR(0, 131, __pyx_L1_error) + __Pyx_DECREF(__pyx_t_4); __pyx_t_4 = 0; + __Pyx_GetNameInClass(__pyx_t_4, (PyObject*)__pyx_mstate_global->__pyx_ptype_5spacy_8pipeline_17_parser_internals_3ner_BiluoPushDown, __pyx_mstate_global->__pyx_n_u_get_actions); if (unlikely(!__pyx_t_4)) __PYX_ERR(0, 131, __pyx_L1_error) + __Pyx_GOTREF(__pyx_t_4); + __pyx_t_5 = __Pyx_Method_ClassMethod(__pyx_t_4); if (unlikely(!__pyx_t_5)) __PYX_ERR(0, 131, __pyx_L1_error) + __Pyx_GOTREF(__pyx_t_5); + __Pyx_DECREF(__pyx_t_4); __pyx_t_4 = 0; + if (__Pyx_SetItemOnTypeDict(__pyx_mstate_global->__pyx_ptype_5spacy_8pipeline_17_parser_internals_3ner_BiluoPushDown, __pyx_mstate_global->__pyx_n_u_get_actions, __pyx_t_5) < (0)) __PYX_ERR(0, 131, __pyx_L1_error) + __Pyx_DECREF(__pyx_t_5); __pyx_t_5 = 0; + + /* "spacy/pipeline/_parser_internals/ner.pyx":158 + * return (BEGIN, IN, LAST, UNIT, OUT) + * + * def get_doc_labels(self, doc): # <<<<<<<<<<<<<< + * labels = set() + * for token in doc: +*/ + __pyx_t_5 = __Pyx_CyFunction_New(&__pyx_mdef_5spacy_8pipeline_17_parser_internals_3ner_13BiluoPushDown_5get_doc_labels, __Pyx_CYFUNCTION_CCLASS, __pyx_mstate_global->__pyx_n_u_BiluoPushDown_get_doc_labels, NULL, __pyx_mstate_global->__pyx_n_u_spacy_pipeline__parser_internals_2, __pyx_mstate_global->__pyx_d, ((PyObject *)__pyx_mstate_global->__pyx_codeobj_tab[4])); if (unlikely(!__pyx_t_5)) __PYX_ERR(0, 158, __pyx_L1_error) + __Pyx_GOTREF(__pyx_t_5); + #if CYTHON_COMPILING_IN_CPYTHON && PY_VERSION_HEX >= 0x030E0000 + PyUnstable_Object_EnableDeferredRefcount(__pyx_t_5); + #endif + if (__Pyx_SetItemOnTypeDict(__pyx_mstate_global->__pyx_ptype_5spacy_8pipeline_17_parser_internals_3ner_BiluoPushDown, __pyx_mstate_global->__pyx_n_u_get_doc_labels, __pyx_t_5) < (0)) __PYX_ERR(0, 158, __pyx_L1_error) + __Pyx_DECREF(__pyx_t_5); __pyx_t_5 = 0; + + /* "spacy/pipeline/_parser_internals/ner.pyx":165 + * return labels + * + * def move_name(self, int move, attr_t label): # <<<<<<<<<<<<<< + * if move == OUT: + * return 'O' +*/ + __pyx_t_5 = __Pyx_CyFunction_New(&__pyx_mdef_5spacy_8pipeline_17_parser_internals_3ner_13BiluoPushDown_7move_name, __Pyx_CYFUNCTION_CCLASS, __pyx_mstate_global->__pyx_n_u_BiluoPushDown_move_name, NULL, __pyx_mstate_global->__pyx_n_u_spacy_pipeline__parser_internals_2, __pyx_mstate_global->__pyx_d, ((PyObject *)__pyx_mstate_global->__pyx_codeobj_tab[5])); if (unlikely(!__pyx_t_5)) __PYX_ERR(0, 165, __pyx_L1_error) + __Pyx_GOTREF(__pyx_t_5); + #if CYTHON_COMPILING_IN_CPYTHON && PY_VERSION_HEX >= 0x030E0000 + PyUnstable_Object_EnableDeferredRefcount(__pyx_t_5); + #endif + if (__Pyx_SetItemOnTypeDict(__pyx_mstate_global->__pyx_ptype_5spacy_8pipeline_17_parser_internals_3ner_BiluoPushDown, __pyx_mstate_global->__pyx_n_u_move_name, __pyx_t_5) < (0)) __PYX_ERR(0, 165, __pyx_L1_error) + __Pyx_DECREF(__pyx_t_5); __pyx_t_5 = 0; + + /* "spacy/pipeline/_parser_internals/ner.pyx":173 + * return MOVE_NAMES[move] + '-' + self.strings[label] + * + * def init_gold_batch(self, examples): # <<<<<<<<<<<<<< + * all_states = self.init_batch([eg.predicted for eg in examples]) + * golds = [] +*/ + __pyx_t_5 = __Pyx_CyFunction_New(&__pyx_mdef_5spacy_8pipeline_17_parser_internals_3ner_13BiluoPushDown_9init_gold_batch, __Pyx_CYFUNCTION_CCLASS, __pyx_mstate_global->__pyx_n_u_BiluoPushDown_init_gold_batch, NULL, __pyx_mstate_global->__pyx_n_u_spacy_pipeline__parser_internals_2, __pyx_mstate_global->__pyx_d, ((PyObject *)__pyx_mstate_global->__pyx_codeobj_tab[6])); if (unlikely(!__pyx_t_5)) __PYX_ERR(0, 173, __pyx_L1_error) + __Pyx_GOTREF(__pyx_t_5); + #if CYTHON_COMPILING_IN_CPYTHON && PY_VERSION_HEX >= 0x030E0000 + PyUnstable_Object_EnableDeferredRefcount(__pyx_t_5); + #endif + if (__Pyx_SetItemOnTypeDict(__pyx_mstate_global->__pyx_ptype_5spacy_8pipeline_17_parser_internals_3ner_BiluoPushDown, __pyx_mstate_global->__pyx_n_u_init_gold_batch, __pyx_t_5) < (0)) __PYX_ERR(0, 173, __pyx_L1_error) + __Pyx_DECREF(__pyx_t_5); __pyx_t_5 = 0; + + /* "spacy/pipeline/_parser_internals/ner.pyx":239 + * return t + * + * def add_action(self, int action, label_name, freq=None): # <<<<<<<<<<<<<< + * cdef attr_t label_id + * if not isinstance(label_name, int): +*/ + __pyx_t_5 = __Pyx_CyFunction_New(&__pyx_mdef_5spacy_8pipeline_17_parser_internals_3ner_13BiluoPushDown_11add_action, __Pyx_CYFUNCTION_CCLASS, __pyx_mstate_global->__pyx_n_u_BiluoPushDown_add_action, NULL, __pyx_mstate_global->__pyx_n_u_spacy_pipeline__parser_internals_2, __pyx_mstate_global->__pyx_d, ((PyObject *)__pyx_mstate_global->__pyx_codeobj_tab[7])); if (unlikely(!__pyx_t_5)) __PYX_ERR(0, 239, __pyx_L1_error) + __Pyx_GOTREF(__pyx_t_5); + #if CYTHON_COMPILING_IN_CPYTHON && PY_VERSION_HEX >= 0x030E0000 + PyUnstable_Object_EnableDeferredRefcount(__pyx_t_5); + #endif + __Pyx_CyFunction_SetDefaultsTuple(__pyx_t_5, __pyx_mstate_global->__pyx_tuple[3]); + if (__Pyx_SetItemOnTypeDict(__pyx_mstate_global->__pyx_ptype_5spacy_8pipeline_17_parser_internals_3ner_BiluoPushDown, __pyx_mstate_global->__pyx_n_u_add_action, __pyx_t_5) < (0)) __PYX_ERR(0, 239, __pyx_L1_error) + __Pyx_DECREF(__pyx_t_5); __pyx_t_5 = 0; + + /* "spacy/pipeline/_parser_internals/ner.pyx":268 + * return 1 + * + * def set_annotations(self, StateClass state, Doc doc): # <<<<<<<<<<<<<< + * cdef int i + * ents = [] +*/ + __pyx_t_5 = __Pyx_CyFunction_New(&__pyx_mdef_5spacy_8pipeline_17_parser_internals_3ner_13BiluoPushDown_13set_annotations, __Pyx_CYFUNCTION_CCLASS, __pyx_mstate_global->__pyx_n_u_BiluoPushDown_set_annotations, NULL, __pyx_mstate_global->__pyx_n_u_spacy_pipeline__parser_internals_2, __pyx_mstate_global->__pyx_d, ((PyObject *)__pyx_mstate_global->__pyx_codeobj_tab[8])); if (unlikely(!__pyx_t_5)) __PYX_ERR(0, 268, __pyx_L1_error) + __Pyx_GOTREF(__pyx_t_5); + #if CYTHON_COMPILING_IN_CPYTHON && PY_VERSION_HEX >= 0x030E0000 + PyUnstable_Object_EnableDeferredRefcount(__pyx_t_5); + #endif + if (__Pyx_SetItemOnTypeDict(__pyx_mstate_global->__pyx_ptype_5spacy_8pipeline_17_parser_internals_3ner_BiluoPushDown, __pyx_mstate_global->__pyx_n_u_set_annotations, __pyx_t_5) < (0)) __PYX_ERR(0, 268, __pyx_L1_error) + __Pyx_DECREF(__pyx_t_5); __pyx_t_5 = 0; + + /* "spacy/pipeline/_parser_internals/ner.pyx":281 + * doc.c[i].ent_iob = 2 + * + * def get_beam_parses(self, Beam beam): # <<<<<<<<<<<<<< + * parses = [] + * probs = beam.probs +*/ + __pyx_t_5 = __Pyx_CyFunction_New(&__pyx_mdef_5spacy_8pipeline_17_parser_internals_3ner_13BiluoPushDown_15get_beam_parses, __Pyx_CYFUNCTION_CCLASS, __pyx_mstate_global->__pyx_n_u_BiluoPushDown_get_beam_parses, NULL, __pyx_mstate_global->__pyx_n_u_spacy_pipeline__parser_internals_2, __pyx_mstate_global->__pyx_d, ((PyObject *)__pyx_mstate_global->__pyx_codeobj_tab[9])); if (unlikely(!__pyx_t_5)) __PYX_ERR(0, 281, __pyx_L1_error) + __Pyx_GOTREF(__pyx_t_5); + #if CYTHON_COMPILING_IN_CPYTHON && PY_VERSION_HEX >= 0x030E0000 + PyUnstable_Object_EnableDeferredRefcount(__pyx_t_5); + #endif + if (__Pyx_SetItemOnTypeDict(__pyx_mstate_global->__pyx_ptype_5spacy_8pipeline_17_parser_internals_3ner_BiluoPushDown, __pyx_mstate_global->__pyx_n_u_get_beam_parses, __pyx_t_5) < (0)) __PYX_ERR(0, 281, __pyx_L1_error) + __Pyx_DECREF(__pyx_t_5); __pyx_t_5 = 0; + + /* "spacy/pipeline/_parser_internals/ner.pyx":296 + * return parses + * + * def init_gold(self, StateClass state, Example example): # <<<<<<<<<<<<<< + * return BiluoGold(self, state, example, self.neg_key) + * +*/ + __pyx_t_5 = __Pyx_CyFunction_New(&__pyx_mdef_5spacy_8pipeline_17_parser_internals_3ner_13BiluoPushDown_17init_gold, __Pyx_CYFUNCTION_CCLASS, __pyx_mstate_global->__pyx_n_u_BiluoPushDown_init_gold, NULL, __pyx_mstate_global->__pyx_n_u_spacy_pipeline__parser_internals_2, __pyx_mstate_global->__pyx_d, ((PyObject *)__pyx_mstate_global->__pyx_codeobj_tab[10])); if (unlikely(!__pyx_t_5)) __PYX_ERR(0, 296, __pyx_L1_error) + __Pyx_GOTREF(__pyx_t_5); + #if CYTHON_COMPILING_IN_CPYTHON && PY_VERSION_HEX >= 0x030E0000 + PyUnstable_Object_EnableDeferredRefcount(__pyx_t_5); + #endif + if (__Pyx_SetItemOnTypeDict(__pyx_mstate_global->__pyx_ptype_5spacy_8pipeline_17_parser_internals_3ner_BiluoPushDown, __pyx_mstate_global->__pyx_n_u_init_gold, __pyx_t_5) < (0)) __PYX_ERR(0, 296, __pyx_L1_error) + __Pyx_DECREF(__pyx_t_5); __pyx_t_5 = 0; + + /* "spacy/pipeline/_parser_internals/ner.pyx":299 + * return BiluoGold(self, state, example, self.neg_key) + * + * def has_gold(self, Example eg, start=0, end=None): # <<<<<<<<<<<<<< + * # We get x and y referring to X, we want to check relative to Y, + * # the reference +*/ + __pyx_t_5 = __Pyx_CyFunction_New(&__pyx_mdef_5spacy_8pipeline_17_parser_internals_3ner_13BiluoPushDown_19has_gold, __Pyx_CYFUNCTION_CCLASS, __pyx_mstate_global->__pyx_n_u_BiluoPushDown_has_gold, NULL, __pyx_mstate_global->__pyx_n_u_spacy_pipeline__parser_internals_2, __pyx_mstate_global->__pyx_d, ((PyObject *)__pyx_mstate_global->__pyx_codeobj_tab[11])); if (unlikely(!__pyx_t_5)) __PYX_ERR(0, 299, __pyx_L1_error) + __Pyx_GOTREF(__pyx_t_5); + #if CYTHON_COMPILING_IN_CPYTHON && PY_VERSION_HEX >= 0x030E0000 + PyUnstable_Object_EnableDeferredRefcount(__pyx_t_5); + #endif + __Pyx_CyFunction_SetDefaultsTuple(__pyx_t_5, __pyx_mstate_global->__pyx_tuple[4]); + if (__Pyx_SetItemOnTypeDict(__pyx_mstate_global->__pyx_ptype_5spacy_8pipeline_17_parser_internals_3ner_BiluoPushDown, __pyx_mstate_global->__pyx_n_u_has_gold, __pyx_t_5) < (0)) __PYX_ERR(0, 299, __pyx_L1_error) + __Pyx_DECREF(__pyx_t_5); __pyx_t_5 = 0; + + /* "spacy/pipeline/_parser_internals/ner.pyx":320 + * return False + * + * def get_cost(self, StateClass stcls, gold, int i): # <<<<<<<<<<<<<< + * if not isinstance(gold, BiluoGold): + * raise TypeError(Errors.E909.format(name="BiluoGold")) +*/ + __pyx_t_5 = __Pyx_CyFunction_New(&__pyx_mdef_5spacy_8pipeline_17_parser_internals_3ner_13BiluoPushDown_21get_cost, __Pyx_CYFUNCTION_CCLASS, __pyx_mstate_global->__pyx_n_u_BiluoPushDown_get_cost, NULL, __pyx_mstate_global->__pyx_n_u_spacy_pipeline__parser_internals_2, __pyx_mstate_global->__pyx_d, ((PyObject *)__pyx_mstate_global->__pyx_codeobj_tab[12])); if (unlikely(!__pyx_t_5)) __PYX_ERR(0, 320, __pyx_L1_error) + __Pyx_GOTREF(__pyx_t_5); + #if CYTHON_COMPILING_IN_CPYTHON && PY_VERSION_HEX >= 0x030E0000 + PyUnstable_Object_EnableDeferredRefcount(__pyx_t_5); + #endif + if (__Pyx_SetItemOnTypeDict(__pyx_mstate_global->__pyx_ptype_5spacy_8pipeline_17_parser_internals_3ner_BiluoPushDown, __pyx_mstate_global->__pyx_n_u_get_cost, __pyx_t_5) < (0)) __PYX_ERR(0, 320, __pyx_L1_error) + __Pyx_DECREF(__pyx_t_5); __pyx_t_5 = 0; + + /* "(tree fragment)":1 + * def __reduce_cython__(self): # <<<<<<<<<<<<<< + * raise TypeError, "self.c,self.del_beam_state,self.init_beam_state cannot be converted to a Python object for pickling" + * def __setstate_cython__(self, __pyx_state): +*/ + __pyx_t_5 = __Pyx_CyFunction_New(&__pyx_mdef_5spacy_8pipeline_17_parser_internals_3ner_13BiluoPushDown_23__reduce_cython__, __Pyx_CYFUNCTION_CCLASS, __pyx_mstate_global->__pyx_n_u_BiluoPushDown___reduce_cython, NULL, __pyx_mstate_global->__pyx_n_u_spacy_pipeline__parser_internals_2, __pyx_mstate_global->__pyx_d, ((PyObject *)__pyx_mstate_global->__pyx_codeobj_tab[13])); if (unlikely(!__pyx_t_5)) __PYX_ERR(1, 1, __pyx_L1_error) + __Pyx_GOTREF(__pyx_t_5); + #if CYTHON_COMPILING_IN_CPYTHON && PY_VERSION_HEX >= 0x030E0000 + PyUnstable_Object_EnableDeferredRefcount(__pyx_t_5); + #endif + if (PyDict_SetItem(__pyx_mstate_global->__pyx_d, __pyx_mstate_global->__pyx_n_u_reduce_cython, __pyx_t_5) < (0)) __PYX_ERR(1, 1, __pyx_L1_error) + __Pyx_DECREF(__pyx_t_5); __pyx_t_5 = 0; + + /* "(tree fragment)":3 + * def __reduce_cython__(self): + * raise TypeError, "self.c,self.del_beam_state,self.init_beam_state cannot be converted to a Python object for pickling" + * def __setstate_cython__(self, __pyx_state): # <<<<<<<<<<<<<< + * raise TypeError, "self.c,self.del_beam_state,self.init_beam_state cannot be converted to a Python object for pickling" +*/ + __pyx_t_5 = __Pyx_CyFunction_New(&__pyx_mdef_5spacy_8pipeline_17_parser_internals_3ner_13BiluoPushDown_25__setstate_cython__, __Pyx_CYFUNCTION_CCLASS, __pyx_mstate_global->__pyx_n_u_BiluoPushDown___setstate_cython, NULL, __pyx_mstate_global->__pyx_n_u_spacy_pipeline__parser_internals_2, __pyx_mstate_global->__pyx_d, ((PyObject *)__pyx_mstate_global->__pyx_codeobj_tab[14])); if (unlikely(!__pyx_t_5)) __PYX_ERR(1, 3, __pyx_L1_error) + __Pyx_GOTREF(__pyx_t_5); + #if CYTHON_COMPILING_IN_CPYTHON && PY_VERSION_HEX >= 0x030E0000 + PyUnstable_Object_EnableDeferredRefcount(__pyx_t_5); + #endif + if (PyDict_SetItem(__pyx_mstate_global->__pyx_d, __pyx_mstate_global->__pyx_n_u_setstate_cython, __pyx_t_5) < (0)) __PYX_ERR(1, 3, __pyx_L1_error) + __Pyx_DECREF(__pyx_t_5); __pyx_t_5 = 0; + + /* "(tree fragment)":1 + * def __reduce_cython__(self): # <<<<<<<<<<<<<< + * cdef tuple state + * cdef object _dict +*/ + __pyx_t_5 = __Pyx_CyFunction_New(&__pyx_mdef_5spacy_8pipeline_17_parser_internals_3ner_7Missing_1__reduce_cython__, __Pyx_CYFUNCTION_CCLASS, __pyx_mstate_global->__pyx_n_u_Missing___reduce_cython, NULL, __pyx_mstate_global->__pyx_n_u_spacy_pipeline__parser_internals_2, __pyx_mstate_global->__pyx_d, ((PyObject *)__pyx_mstate_global->__pyx_codeobj_tab[15])); if (unlikely(!__pyx_t_5)) __PYX_ERR(1, 1, __pyx_L1_error) + __Pyx_GOTREF(__pyx_t_5); + #if CYTHON_COMPILING_IN_CPYTHON && PY_VERSION_HEX >= 0x030E0000 + PyUnstable_Object_EnableDeferredRefcount(__pyx_t_5); + #endif + if (__Pyx_SetItemOnTypeDict(__pyx_mstate_global->__pyx_ptype_5spacy_8pipeline_17_parser_internals_3ner_Missing, __pyx_mstate_global->__pyx_n_u_reduce_cython, __pyx_t_5) < (0)) __PYX_ERR(1, 1, __pyx_L1_error) + __Pyx_DECREF(__pyx_t_5); __pyx_t_5 = 0; + + /* "(tree fragment)":16 + * else: + * return __pyx_unpickle_Missing, (type(self), 0xe3b0c44, state) + * def __setstate_cython__(self, __pyx_state): # <<<<<<<<<<<<<< + * __pyx_unpickle_Missing__set_state(self, __pyx_state) +*/ + __pyx_t_5 = __Pyx_CyFunction_New(&__pyx_mdef_5spacy_8pipeline_17_parser_internals_3ner_7Missing_3__setstate_cython__, __Pyx_CYFUNCTION_CCLASS, __pyx_mstate_global->__pyx_n_u_Missing___setstate_cython, NULL, __pyx_mstate_global->__pyx_n_u_spacy_pipeline__parser_internals_2, __pyx_mstate_global->__pyx_d, ((PyObject *)__pyx_mstate_global->__pyx_codeobj_tab[16])); if (unlikely(!__pyx_t_5)) __PYX_ERR(1, 16, __pyx_L1_error) + __Pyx_GOTREF(__pyx_t_5); + #if CYTHON_COMPILING_IN_CPYTHON && PY_VERSION_HEX >= 0x030E0000 + PyUnstable_Object_EnableDeferredRefcount(__pyx_t_5); + #endif + if (__Pyx_SetItemOnTypeDict(__pyx_mstate_global->__pyx_ptype_5spacy_8pipeline_17_parser_internals_3ner_Missing, __pyx_mstate_global->__pyx_n_u_setstate_cython, __pyx_t_5) < (0)) __PYX_ERR(1, 16, __pyx_L1_error) + __Pyx_DECREF(__pyx_t_5); __pyx_t_5 = 0; + + /* "(tree fragment)":1 + * def __reduce_cython__(self): # <<<<<<<<<<<<<< + * cdef tuple state + * cdef object _dict +*/ + __pyx_t_5 = __Pyx_CyFunction_New(&__pyx_mdef_5spacy_8pipeline_17_parser_internals_3ner_5Begin_1__reduce_cython__, __Pyx_CYFUNCTION_CCLASS, __pyx_mstate_global->__pyx_n_u_Begin___reduce_cython, NULL, __pyx_mstate_global->__pyx_n_u_spacy_pipeline__parser_internals_2, __pyx_mstate_global->__pyx_d, ((PyObject *)__pyx_mstate_global->__pyx_codeobj_tab[17])); if (unlikely(!__pyx_t_5)) __PYX_ERR(1, 1, __pyx_L1_error) + __Pyx_GOTREF(__pyx_t_5); + #if CYTHON_COMPILING_IN_CPYTHON && PY_VERSION_HEX >= 0x030E0000 + PyUnstable_Object_EnableDeferredRefcount(__pyx_t_5); + #endif + if (__Pyx_SetItemOnTypeDict(__pyx_mstate_global->__pyx_ptype_5spacy_8pipeline_17_parser_internals_3ner_Begin, __pyx_mstate_global->__pyx_n_u_reduce_cython, __pyx_t_5) < (0)) __PYX_ERR(1, 1, __pyx_L1_error) + __Pyx_DECREF(__pyx_t_5); __pyx_t_5 = 0; + + /* "(tree fragment)":16 + * else: + * return __pyx_unpickle_Begin, (type(self), 0xe3b0c44, state) + * def __setstate_cython__(self, __pyx_state): # <<<<<<<<<<<<<< + * __pyx_unpickle_Begin__set_state(self, __pyx_state) +*/ + __pyx_t_5 = __Pyx_CyFunction_New(&__pyx_mdef_5spacy_8pipeline_17_parser_internals_3ner_5Begin_3__setstate_cython__, __Pyx_CYFUNCTION_CCLASS, __pyx_mstate_global->__pyx_n_u_Begin___setstate_cython, NULL, __pyx_mstate_global->__pyx_n_u_spacy_pipeline__parser_internals_2, __pyx_mstate_global->__pyx_d, ((PyObject *)__pyx_mstate_global->__pyx_codeobj_tab[18])); if (unlikely(!__pyx_t_5)) __PYX_ERR(1, 16, __pyx_L1_error) + __Pyx_GOTREF(__pyx_t_5); + #if CYTHON_COMPILING_IN_CPYTHON && PY_VERSION_HEX >= 0x030E0000 + PyUnstable_Object_EnableDeferredRefcount(__pyx_t_5); + #endif + if (__Pyx_SetItemOnTypeDict(__pyx_mstate_global->__pyx_ptype_5spacy_8pipeline_17_parser_internals_3ner_Begin, __pyx_mstate_global->__pyx_n_u_setstate_cython, __pyx_t_5) < (0)) __PYX_ERR(1, 16, __pyx_L1_error) + __Pyx_DECREF(__pyx_t_5); __pyx_t_5 = 0; + + /* "(tree fragment)":1 + * def __reduce_cython__(self): # <<<<<<<<<<<<<< + * cdef tuple state + * cdef object _dict +*/ + __pyx_t_5 = __Pyx_CyFunction_New(&__pyx_mdef_5spacy_8pipeline_17_parser_internals_3ner_2In_1__reduce_cython__, __Pyx_CYFUNCTION_CCLASS, __pyx_mstate_global->__pyx_n_u_In___reduce_cython, NULL, __pyx_mstate_global->__pyx_n_u_spacy_pipeline__parser_internals_2, __pyx_mstate_global->__pyx_d, ((PyObject *)__pyx_mstate_global->__pyx_codeobj_tab[19])); if (unlikely(!__pyx_t_5)) __PYX_ERR(1, 1, __pyx_L1_error) + __Pyx_GOTREF(__pyx_t_5); + #if CYTHON_COMPILING_IN_CPYTHON && PY_VERSION_HEX >= 0x030E0000 + PyUnstable_Object_EnableDeferredRefcount(__pyx_t_5); + #endif + if (__Pyx_SetItemOnTypeDict(__pyx_mstate_global->__pyx_ptype_5spacy_8pipeline_17_parser_internals_3ner_In, __pyx_mstate_global->__pyx_n_u_reduce_cython, __pyx_t_5) < (0)) __PYX_ERR(1, 1, __pyx_L1_error) + __Pyx_DECREF(__pyx_t_5); __pyx_t_5 = 0; + + /* "(tree fragment)":16 + * else: + * return __pyx_unpickle_In, (type(self), 0xe3b0c44, state) + * def __setstate_cython__(self, __pyx_state): # <<<<<<<<<<<<<< + * __pyx_unpickle_In__set_state(self, __pyx_state) +*/ + __pyx_t_5 = __Pyx_CyFunction_New(&__pyx_mdef_5spacy_8pipeline_17_parser_internals_3ner_2In_3__setstate_cython__, __Pyx_CYFUNCTION_CCLASS, __pyx_mstate_global->__pyx_n_u_In___setstate_cython, NULL, __pyx_mstate_global->__pyx_n_u_spacy_pipeline__parser_internals_2, __pyx_mstate_global->__pyx_d, ((PyObject *)__pyx_mstate_global->__pyx_codeobj_tab[20])); if (unlikely(!__pyx_t_5)) __PYX_ERR(1, 16, __pyx_L1_error) + __Pyx_GOTREF(__pyx_t_5); + #if CYTHON_COMPILING_IN_CPYTHON && PY_VERSION_HEX >= 0x030E0000 + PyUnstable_Object_EnableDeferredRefcount(__pyx_t_5); + #endif + if (__Pyx_SetItemOnTypeDict(__pyx_mstate_global->__pyx_ptype_5spacy_8pipeline_17_parser_internals_3ner_In, __pyx_mstate_global->__pyx_n_u_setstate_cython, __pyx_t_5) < (0)) __PYX_ERR(1, 16, __pyx_L1_error) + __Pyx_DECREF(__pyx_t_5); __pyx_t_5 = 0; + + /* "(tree fragment)":1 + * def __reduce_cython__(self): # <<<<<<<<<<<<<< + * cdef tuple state + * cdef object _dict +*/ + __pyx_t_5 = __Pyx_CyFunction_New(&__pyx_mdef_5spacy_8pipeline_17_parser_internals_3ner_4Last_1__reduce_cython__, __Pyx_CYFUNCTION_CCLASS, __pyx_mstate_global->__pyx_n_u_Last___reduce_cython, NULL, __pyx_mstate_global->__pyx_n_u_spacy_pipeline__parser_internals_2, __pyx_mstate_global->__pyx_d, ((PyObject *)__pyx_mstate_global->__pyx_codeobj_tab[21])); if (unlikely(!__pyx_t_5)) __PYX_ERR(1, 1, __pyx_L1_error) + __Pyx_GOTREF(__pyx_t_5); + #if CYTHON_COMPILING_IN_CPYTHON && PY_VERSION_HEX >= 0x030E0000 + PyUnstable_Object_EnableDeferredRefcount(__pyx_t_5); + #endif + if (__Pyx_SetItemOnTypeDict(__pyx_mstate_global->__pyx_ptype_5spacy_8pipeline_17_parser_internals_3ner_Last, __pyx_mstate_global->__pyx_n_u_reduce_cython, __pyx_t_5) < (0)) __PYX_ERR(1, 1, __pyx_L1_error) + __Pyx_DECREF(__pyx_t_5); __pyx_t_5 = 0; + + /* "(tree fragment)":16 + * else: + * return __pyx_unpickle_Last, (type(self), 0xe3b0c44, state) + * def __setstate_cython__(self, __pyx_state): # <<<<<<<<<<<<<< + * __pyx_unpickle_Last__set_state(self, __pyx_state) +*/ + __pyx_t_5 = __Pyx_CyFunction_New(&__pyx_mdef_5spacy_8pipeline_17_parser_internals_3ner_4Last_3__setstate_cython__, __Pyx_CYFUNCTION_CCLASS, __pyx_mstate_global->__pyx_n_u_Last___setstate_cython, NULL, __pyx_mstate_global->__pyx_n_u_spacy_pipeline__parser_internals_2, __pyx_mstate_global->__pyx_d, ((PyObject *)__pyx_mstate_global->__pyx_codeobj_tab[22])); if (unlikely(!__pyx_t_5)) __PYX_ERR(1, 16, __pyx_L1_error) + __Pyx_GOTREF(__pyx_t_5); + #if CYTHON_COMPILING_IN_CPYTHON && PY_VERSION_HEX >= 0x030E0000 + PyUnstable_Object_EnableDeferredRefcount(__pyx_t_5); + #endif + if (__Pyx_SetItemOnTypeDict(__pyx_mstate_global->__pyx_ptype_5spacy_8pipeline_17_parser_internals_3ner_Last, __pyx_mstate_global->__pyx_n_u_setstate_cython, __pyx_t_5) < (0)) __PYX_ERR(1, 16, __pyx_L1_error) + __Pyx_DECREF(__pyx_t_5); __pyx_t_5 = 0; + + /* "(tree fragment)":1 + * def __reduce_cython__(self): # <<<<<<<<<<<<<< + * cdef tuple state + * cdef object _dict +*/ + __pyx_t_5 = __Pyx_CyFunction_New(&__pyx_mdef_5spacy_8pipeline_17_parser_internals_3ner_4Unit_1__reduce_cython__, __Pyx_CYFUNCTION_CCLASS, __pyx_mstate_global->__pyx_n_u_Unit___reduce_cython, NULL, __pyx_mstate_global->__pyx_n_u_spacy_pipeline__parser_internals_2, __pyx_mstate_global->__pyx_d, ((PyObject *)__pyx_mstate_global->__pyx_codeobj_tab[23])); if (unlikely(!__pyx_t_5)) __PYX_ERR(1, 1, __pyx_L1_error) + __Pyx_GOTREF(__pyx_t_5); + #if CYTHON_COMPILING_IN_CPYTHON && PY_VERSION_HEX >= 0x030E0000 + PyUnstable_Object_EnableDeferredRefcount(__pyx_t_5); + #endif + if (__Pyx_SetItemOnTypeDict(__pyx_mstate_global->__pyx_ptype_5spacy_8pipeline_17_parser_internals_3ner_Unit, __pyx_mstate_global->__pyx_n_u_reduce_cython, __pyx_t_5) < (0)) __PYX_ERR(1, 1, __pyx_L1_error) + __Pyx_DECREF(__pyx_t_5); __pyx_t_5 = 0; + + /* "(tree fragment)":16 + * else: + * return __pyx_unpickle_Unit, (type(self), 0xe3b0c44, state) + * def __setstate_cython__(self, __pyx_state): # <<<<<<<<<<<<<< + * __pyx_unpickle_Unit__set_state(self, __pyx_state) +*/ + __pyx_t_5 = __Pyx_CyFunction_New(&__pyx_mdef_5spacy_8pipeline_17_parser_internals_3ner_4Unit_3__setstate_cython__, __Pyx_CYFUNCTION_CCLASS, __pyx_mstate_global->__pyx_n_u_Unit___setstate_cython, NULL, __pyx_mstate_global->__pyx_n_u_spacy_pipeline__parser_internals_2, __pyx_mstate_global->__pyx_d, ((PyObject *)__pyx_mstate_global->__pyx_codeobj_tab[24])); if (unlikely(!__pyx_t_5)) __PYX_ERR(1, 16, __pyx_L1_error) + __Pyx_GOTREF(__pyx_t_5); + #if CYTHON_COMPILING_IN_CPYTHON && PY_VERSION_HEX >= 0x030E0000 + PyUnstable_Object_EnableDeferredRefcount(__pyx_t_5); + #endif + if (__Pyx_SetItemOnTypeDict(__pyx_mstate_global->__pyx_ptype_5spacy_8pipeline_17_parser_internals_3ner_Unit, __pyx_mstate_global->__pyx_n_u_setstate_cython, __pyx_t_5) < (0)) __PYX_ERR(1, 16, __pyx_L1_error) + __Pyx_DECREF(__pyx_t_5); __pyx_t_5 = 0; + + /* "(tree fragment)":1 + * def __reduce_cython__(self): # <<<<<<<<<<<<<< + * cdef tuple state + * cdef object _dict +*/ + __pyx_t_5 = __Pyx_CyFunction_New(&__pyx_mdef_5spacy_8pipeline_17_parser_internals_3ner_3Out_1__reduce_cython__, __Pyx_CYFUNCTION_CCLASS, __pyx_mstate_global->__pyx_n_u_Out___reduce_cython, NULL, __pyx_mstate_global->__pyx_n_u_spacy_pipeline__parser_internals_2, __pyx_mstate_global->__pyx_d, ((PyObject *)__pyx_mstate_global->__pyx_codeobj_tab[25])); if (unlikely(!__pyx_t_5)) __PYX_ERR(1, 1, __pyx_L1_error) + __Pyx_GOTREF(__pyx_t_5); + #if CYTHON_COMPILING_IN_CPYTHON && PY_VERSION_HEX >= 0x030E0000 + PyUnstable_Object_EnableDeferredRefcount(__pyx_t_5); + #endif + if (__Pyx_SetItemOnTypeDict(__pyx_mstate_global->__pyx_ptype_5spacy_8pipeline_17_parser_internals_3ner_Out, __pyx_mstate_global->__pyx_n_u_reduce_cython, __pyx_t_5) < (0)) __PYX_ERR(1, 1, __pyx_L1_error) + __Pyx_DECREF(__pyx_t_5); __pyx_t_5 = 0; + + /* "(tree fragment)":16 + * else: + * return __pyx_unpickle_Out, (type(self), 0xe3b0c44, state) + * def __setstate_cython__(self, __pyx_state): # <<<<<<<<<<<<<< + * __pyx_unpickle_Out__set_state(self, __pyx_state) +*/ + __pyx_t_5 = __Pyx_CyFunction_New(&__pyx_mdef_5spacy_8pipeline_17_parser_internals_3ner_3Out_3__setstate_cython__, __Pyx_CYFUNCTION_CCLASS, __pyx_mstate_global->__pyx_n_u_Out___setstate_cython, NULL, __pyx_mstate_global->__pyx_n_u_spacy_pipeline__parser_internals_2, __pyx_mstate_global->__pyx_d, ((PyObject *)__pyx_mstate_global->__pyx_codeobj_tab[26])); if (unlikely(!__pyx_t_5)) __PYX_ERR(1, 16, __pyx_L1_error) + __Pyx_GOTREF(__pyx_t_5); + #if CYTHON_COMPILING_IN_CPYTHON && PY_VERSION_HEX >= 0x030E0000 + PyUnstable_Object_EnableDeferredRefcount(__pyx_t_5); + #endif + if (__Pyx_SetItemOnTypeDict(__pyx_mstate_global->__pyx_ptype_5spacy_8pipeline_17_parser_internals_3ner_Out, __pyx_mstate_global->__pyx_n_u_setstate_cython, __pyx_t_5) < (0)) __PYX_ERR(1, 16, __pyx_L1_error) + __Pyx_DECREF(__pyx_t_5); __pyx_t_5 = 0; + + /* "(tree fragment)":4 + * int __Pyx_CheckUnpickleChecksum(long, long, long, long, const char*) except -1 + * int __Pyx_UpdateUnpickledDict(object, object, Py_ssize_t) except -1 + * def __pyx_unpickle_Missing(__pyx_type, long __pyx_checksum, tuple __pyx_state): # <<<<<<<<<<<<<< + * cdef object __pyx_result + * __Pyx_CheckUnpickleChecksum(__pyx_checksum, 0xe3b0c44, 0xda39a3e, 0xd41d8cd, b'') +*/ + __pyx_t_5 = __Pyx_CyFunction_New(&__pyx_mdef_5spacy_8pipeline_17_parser_internals_3ner_1__pyx_unpickle_Missing, 0, __pyx_mstate_global->__pyx_n_u_pyx_unpickle_Missing, NULL, __pyx_mstate_global->__pyx_n_u_spacy_pipeline__parser_internals_2, __pyx_mstate_global->__pyx_d, ((PyObject *)__pyx_mstate_global->__pyx_codeobj_tab[27])); if (unlikely(!__pyx_t_5)) __PYX_ERR(1, 4, __pyx_L1_error) + __Pyx_GOTREF(__pyx_t_5); + #if CYTHON_COMPILING_IN_CPYTHON && PY_VERSION_HEX >= 0x030E0000 + PyUnstable_Object_EnableDeferredRefcount(__pyx_t_5); + #endif + if (PyDict_SetItem(__pyx_mstate_global->__pyx_d, __pyx_mstate_global->__pyx_n_u_pyx_unpickle_Missing, __pyx_t_5) < (0)) __PYX_ERR(1, 4, __pyx_L1_error) + __Pyx_DECREF(__pyx_t_5); __pyx_t_5 = 0; + + /* "(tree fragment)":1 + * cdef extern from *: # <<<<<<<<<<<<<< + * int __Pyx_CheckUnpickleChecksum(long, long, long, long, const char*) except -1 + * int __Pyx_UpdateUnpickledDict(object, object, Py_ssize_t) except -1 +*/ + __pyx_t_5 = __Pyx_CyFunction_New(&__pyx_mdef_5spacy_8pipeline_17_parser_internals_3ner_3__pyx_unpickle_Begin, 0, __pyx_mstate_global->__pyx_n_u_pyx_unpickle_Begin, NULL, __pyx_mstate_global->__pyx_n_u_spacy_pipeline__parser_internals_2, __pyx_mstate_global->__pyx_d, ((PyObject *)__pyx_mstate_global->__pyx_codeobj_tab[28])); if (unlikely(!__pyx_t_5)) __PYX_ERR(1, 4, __pyx_L1_error) + __Pyx_GOTREF(__pyx_t_5); + #if CYTHON_COMPILING_IN_CPYTHON && PY_VERSION_HEX >= 0x030E0000 + PyUnstable_Object_EnableDeferredRefcount(__pyx_t_5); + #endif + if (PyDict_SetItem(__pyx_mstate_global->__pyx_d, __pyx_mstate_global->__pyx_n_u_pyx_unpickle_Begin, __pyx_t_5) < (0)) __PYX_ERR(1, 4, __pyx_L1_error) + __Pyx_DECREF(__pyx_t_5); __pyx_t_5 = 0; + + /* "(tree fragment)":4 + * int __Pyx_CheckUnpickleChecksum(long, long, long, long, const char*) except -1 + * int __Pyx_UpdateUnpickledDict(object, object, Py_ssize_t) except -1 + * def __pyx_unpickle_In(__pyx_type, long __pyx_checksum, tuple __pyx_state): # <<<<<<<<<<<<<< + * cdef object __pyx_result + * __Pyx_CheckUnpickleChecksum(__pyx_checksum, 0xe3b0c44, 0xda39a3e, 0xd41d8cd, b'') +*/ + __pyx_t_5 = __Pyx_CyFunction_New(&__pyx_mdef_5spacy_8pipeline_17_parser_internals_3ner_5__pyx_unpickle_In, 0, __pyx_mstate_global->__pyx_n_u_pyx_unpickle_In, NULL, __pyx_mstate_global->__pyx_n_u_spacy_pipeline__parser_internals_2, __pyx_mstate_global->__pyx_d, ((PyObject *)__pyx_mstate_global->__pyx_codeobj_tab[29])); if (unlikely(!__pyx_t_5)) __PYX_ERR(1, 4, __pyx_L1_error) + __Pyx_GOTREF(__pyx_t_5); + #if CYTHON_COMPILING_IN_CPYTHON && PY_VERSION_HEX >= 0x030E0000 + PyUnstable_Object_EnableDeferredRefcount(__pyx_t_5); + #endif + if (PyDict_SetItem(__pyx_mstate_global->__pyx_d, __pyx_mstate_global->__pyx_n_u_pyx_unpickle_In, __pyx_t_5) < (0)) __PYX_ERR(1, 4, __pyx_L1_error) + __Pyx_DECREF(__pyx_t_5); __pyx_t_5 = 0; + + /* "(tree fragment)":1 + * cdef extern from *: # <<<<<<<<<<<<<< + * int __Pyx_CheckUnpickleChecksum(long, long, long, long, const char*) except -1 + * int __Pyx_UpdateUnpickledDict(object, object, Py_ssize_t) except -1 +*/ + __pyx_t_5 = __Pyx_CyFunction_New(&__pyx_mdef_5spacy_8pipeline_17_parser_internals_3ner_7__pyx_unpickle_Last, 0, __pyx_mstate_global->__pyx_n_u_pyx_unpickle_Last, NULL, __pyx_mstate_global->__pyx_n_u_spacy_pipeline__parser_internals_2, __pyx_mstate_global->__pyx_d, ((PyObject *)__pyx_mstate_global->__pyx_codeobj_tab[30])); if (unlikely(!__pyx_t_5)) __PYX_ERR(1, 4, __pyx_L1_error) + __Pyx_GOTREF(__pyx_t_5); + #if CYTHON_COMPILING_IN_CPYTHON && PY_VERSION_HEX >= 0x030E0000 + PyUnstable_Object_EnableDeferredRefcount(__pyx_t_5); + #endif + if (PyDict_SetItem(__pyx_mstate_global->__pyx_d, __pyx_mstate_global->__pyx_n_u_pyx_unpickle_Last, __pyx_t_5) < (0)) __PYX_ERR(1, 4, __pyx_L1_error) + __Pyx_DECREF(__pyx_t_5); __pyx_t_5 = 0; + + /* "(tree fragment)":4 + * int __Pyx_CheckUnpickleChecksum(long, long, long, long, const char*) except -1 + * int __Pyx_UpdateUnpickledDict(object, object, Py_ssize_t) except -1 + * def __pyx_unpickle_Unit(__pyx_type, long __pyx_checksum, tuple __pyx_state): # <<<<<<<<<<<<<< + * cdef object __pyx_result + * __Pyx_CheckUnpickleChecksum(__pyx_checksum, 0xe3b0c44, 0xda39a3e, 0xd41d8cd, b'') +*/ + __pyx_t_5 = __Pyx_CyFunction_New(&__pyx_mdef_5spacy_8pipeline_17_parser_internals_3ner_9__pyx_unpickle_Unit, 0, __pyx_mstate_global->__pyx_n_u_pyx_unpickle_Unit, NULL, __pyx_mstate_global->__pyx_n_u_spacy_pipeline__parser_internals_2, __pyx_mstate_global->__pyx_d, ((PyObject *)__pyx_mstate_global->__pyx_codeobj_tab[31])); if (unlikely(!__pyx_t_5)) __PYX_ERR(1, 4, __pyx_L1_error) + __Pyx_GOTREF(__pyx_t_5); + #if CYTHON_COMPILING_IN_CPYTHON && PY_VERSION_HEX >= 0x030E0000 + PyUnstable_Object_EnableDeferredRefcount(__pyx_t_5); + #endif + if (PyDict_SetItem(__pyx_mstate_global->__pyx_d, __pyx_mstate_global->__pyx_n_u_pyx_unpickle_Unit, __pyx_t_5) < (0)) __PYX_ERR(1, 4, __pyx_L1_error) + __Pyx_DECREF(__pyx_t_5); __pyx_t_5 = 0; + + /* "(tree fragment)":1 + * cdef extern from *: # <<<<<<<<<<<<<< + * int __Pyx_CheckUnpickleChecksum(long, long, long, long, const char*) except -1 + * int __Pyx_UpdateUnpickledDict(object, object, Py_ssize_t) except -1 +*/ + __pyx_t_5 = __Pyx_CyFunction_New(&__pyx_mdef_5spacy_8pipeline_17_parser_internals_3ner_11__pyx_unpickle_Out, 0, __pyx_mstate_global->__pyx_n_u_pyx_unpickle_Out, NULL, __pyx_mstate_global->__pyx_n_u_spacy_pipeline__parser_internals_2, __pyx_mstate_global->__pyx_d, ((PyObject *)__pyx_mstate_global->__pyx_codeobj_tab[32])); if (unlikely(!__pyx_t_5)) __PYX_ERR(1, 4, __pyx_L1_error) + __Pyx_GOTREF(__pyx_t_5); + #if CYTHON_COMPILING_IN_CPYTHON && PY_VERSION_HEX >= 0x030E0000 + PyUnstable_Object_EnableDeferredRefcount(__pyx_t_5); + #endif + if (PyDict_SetItem(__pyx_mstate_global->__pyx_d, __pyx_mstate_global->__pyx_n_u_pyx_unpickle_Out, __pyx_t_5) < (0)) __PYX_ERR(1, 4, __pyx_L1_error) + __Pyx_DECREF(__pyx_t_5); __pyx_t_5 = 0; + + /* "spacy/pipeline/_parser_internals/ner.pyx":1 + * # cython: profile=False # <<<<<<<<<<<<<< + * from cymem.cymem cimport Pool + * from libc.stdint cimport int32_t +*/ + __pyx_t_5 = __Pyx_PyDict_NewPresized(0); if (unlikely(!__pyx_t_5)) __PYX_ERR(0, 1, __pyx_L1_error) + __Pyx_GOTREF(__pyx_t_5); + if (PyDict_SetItem(__pyx_mstate_global->__pyx_d, __pyx_mstate_global->__pyx_n_u_test, __pyx_t_5) < (0)) __PYX_ERR(0, 1, __pyx_L1_error) + __Pyx_DECREF(__pyx_t_5); __pyx_t_5 = 0; + + /*--- Wrapped vars code ---*/ + + goto __pyx_L0; + __pyx_L1_error:; + __Pyx_XDECREF(__pyx_t_4); + __Pyx_XDECREF(__pyx_t_5); + if (__pyx_m) { + if (__pyx_mstate->__pyx_d && stringtab_initialized) { + __Pyx_AddTraceback("init spacy.pipeline._parser_internals.ner", __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 spacy.pipeline._parser_internals.ner"); + } + __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_enumerate = __Pyx_GetBuiltinName(__pyx_mstate->__pyx_n_u_enumerate); if (!__pyx_builtin_enumerate) __PYX_ERR(0, 88, __pyx_L1_error) + __pyx_builtin_zip = __Pyx_GetBuiltinName(__pyx_mstate->__pyx_n_u_zip); if (!__pyx_builtin_zip) __PYX_ERR(0, 177, __pyx_L1_error) + __pyx_builtin_sum = __Pyx_GetBuiltinName(__pyx_mstate->__pyx_n_u_sum); if (!__pyx_builtin_sum) __PYX_ERR(0, 181, __pyx_L1_error) + __pyx_builtin_min = __Pyx_GetBuiltinName(__pyx_mstate->__pyx_n_u_min); if (!__pyx_builtin_min) __PYX_ERR(0, 261, __pyx_L1_error) + __pyx_builtin___import__ = __Pyx_GetBuiltinName(__pyx_mstate->__pyx_n_u_import); if (!__pyx_builtin___import__) __PYX_ERR(1, 101, __pyx_L1_error) + __pyx_builtin_Ellipsis = __Pyx_GetBuiltinName(__pyx_mstate->__pyx_n_u_Ellipsis); if (!__pyx_builtin_Ellipsis) __PYX_ERR(1, 409, __pyx_L1_error) + __pyx_builtin_id = __Pyx_GetBuiltinName(__pyx_mstate->__pyx_n_u_id); if (!__pyx_builtin_id) __PYX_ERR(1, 619, __pyx_L1_error) + + /* Cached unbound methods */ + __pyx_mstate->__pyx_umethod_PyDict_Type_get.type = (PyObject*)&PyDict_Type; + __pyx_mstate->__pyx_umethod_PyDict_Type_get.method_name = &__pyx_mstate->__pyx_n_u_get; + __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); + + /* "(tree fragment)":11 + * use_setstate = True + * else: + * use_setstate = ('self.name is not None',) # <<<<<<<<<<<<<< + * if use_setstate: + * return __pyx_unpickle_Enum, (type(self), 0x82a3537, None), state +*/ + __pyx_mstate_global->__pyx_tuple[0] = PyTuple_Pack(1, __pyx_mstate_global->__pyx_kp_u_self_name_is_not_None); if (unlikely(!__pyx_mstate_global->__pyx_tuple[0])) __PYX_ERR(1, 11, __pyx_L1_error) + __Pyx_GOTREF(__pyx_mstate_global->__pyx_tuple[0]); + __Pyx_GIVEREF(__pyx_mstate_global->__pyx_tuple[0]); + + /* "View.MemoryView":583 + * def suboffsets(self): + * if self.view.suboffsets == NULL: + * return (-1,) * self.view.ndim # <<<<<<<<<<<<<< + * + * return tuple([suboffset for suboffset in self.view.suboffsets[:self.view.ndim]]) +*/ + __pyx_mstate_global->__pyx_tuple[1] = PyTuple_New(1); if (unlikely(!__pyx_mstate_global->__pyx_tuple[1])) __PYX_ERR(1, 583, __pyx_L1_error) + __Pyx_GOTREF(__pyx_mstate_global->__pyx_tuple[1]); + __Pyx_INCREF(__pyx_mstate_global->__pyx_int_neg_1); + __Pyx_GIVEREF(__pyx_mstate_global->__pyx_int_neg_1); + if (__Pyx_PyTuple_SET_ITEM(__pyx_mstate_global->__pyx_tuple[1], 0, __pyx_mstate_global->__pyx_int_neg_1) != (0)) __PYX_ERR(1, 583, __pyx_L1_error); + __Pyx_GIVEREF(__pyx_mstate_global->__pyx_tuple[1]); + + /* "View.MemoryView":680 + * tup = index if isinstance(index, tuple) else (index,) + * + * result = [slice(None)] * ndim # <<<<<<<<<<<<<< + * have_slices = False + * seen_ellipsis = False +*/ + __pyx_mstate_global->__pyx_slice[0] = PySlice_New(Py_None, Py_None, Py_None); if (unlikely(!__pyx_mstate_global->__pyx_slice[0])) __PYX_ERR(1, 680, __pyx_L1_error) + __Pyx_GOTREF(__pyx_mstate_global->__pyx_slice[0]); + __Pyx_GIVEREF(__pyx_mstate_global->__pyx_slice[0]); + + /* "(tree fragment)":11 + * use_setstate = True + * else: + * use_setstate = ('False',) # <<<<<<<<<<<<<< + * if use_setstate: + * return __pyx_unpickle_Missing, (type(self), 0xe3b0c44, None), state +*/ + __pyx_mstate_global->__pyx_tuple[2] = PyTuple_Pack(1, __pyx_mstate_global->__pyx_n_u_False); if (unlikely(!__pyx_mstate_global->__pyx_tuple[2])) __PYX_ERR(1, 11, __pyx_L1_error) + __Pyx_GOTREF(__pyx_mstate_global->__pyx_tuple[2]); + __Pyx_GIVEREF(__pyx_mstate_global->__pyx_tuple[2]); + + /* "spacy/pipeline/_parser_internals/ner.pyx":239 + * return t + * + * def add_action(self, int action, label_name, freq=None): # <<<<<<<<<<<<<< + * cdef attr_t label_id + * if not isinstance(label_name, int): +*/ + __pyx_mstate_global->__pyx_tuple[3] = PyTuple_Pack(1, Py_None); if (unlikely(!__pyx_mstate_global->__pyx_tuple[3])) __PYX_ERR(0, 239, __pyx_L1_error) + __Pyx_GOTREF(__pyx_mstate_global->__pyx_tuple[3]); + __Pyx_GIVEREF(__pyx_mstate_global->__pyx_tuple[3]); + + /* "spacy/pipeline/_parser_internals/ner.pyx":299 + * return BiluoGold(self, state, example, self.neg_key) + * + * def has_gold(self, Example eg, start=0, end=None): # <<<<<<<<<<<<<< + * # We get x and y referring to X, we want to check relative to Y, + * # the reference +*/ + __pyx_mstate_global->__pyx_tuple[4] = PyTuple_Pack(2, __pyx_mstate_global->__pyx_int_0, Py_None); if (unlikely(!__pyx_mstate_global->__pyx_tuple[4])) __PYX_ERR(0, 299, __pyx_L1_error) + __Pyx_GOTREF(__pyx_mstate_global->__pyx_tuple[4]); + __Pyx_GIVEREF(__pyx_mstate_global->__pyx_tuple[4]); + #if CYTHON_IMMORTAL_CONSTANTS + { + PyObject **table = __pyx_mstate->__pyx_tuple; + for (Py_ssize_t i=0; i<5; ++i) { + #if CYTHON_COMPILING_IN_CPYTHON_FREETHREADING + Py_SET_REFCNT(table[i], _Py_IMMORTAL_REFCNT_LOCAL); + #else + Py_SET_REFCNT(table[i], _Py_IMMORTAL_INITIAL_REFCNT); + #endif + } + } + #endif + #if CYTHON_IMMORTAL_CONSTANTS + { + PyObject **table = __pyx_mstate->__pyx_slice; + for (Py_ssize_t i=0; i<1; ++i) { + #if CYTHON_COMPILING_IN_CPYTHON_FREETHREADING + Py_SET_REFCNT(table[i], _Py_IMMORTAL_REFCNT_LOCAL); + #else + 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[] = {{2},{68},{35},{54},{37},{60},{24},{52},{26},{34},{29},{33},{45},{22},{15},{179},{37},{30},{32},{1},{1},{1},{1},{0},{1},{1},{1},{8},{5},{6},{15},{23},{25},{7},{6},{2},{6},{35},{9},{30},{50},{39},{34},{8},{58},{99},{21},{12},{44},{40},{17},{14},{20},{32},{22},{14},{30},{37},{5},{1},{5},{23},{25},{9},{27},{29},{16},{13},{31},{33},{24},{25},{29},{22},{28},{22},{23},{29},{23},{29},{7},{4},{4},{4},{4},{4},{8},{6},{5},{1},{2},{20},{22},{1},{4},{22},{24},{1},{10},{7},{25},{27},{1},{3},{21},{23},{20},{8},{4},{1},{4},{22},{24},{15},{3},{6},{7},{3},{10},{10},{15},{13},{18},{4},{4},{1},{4},{9},{17},{18},{3},{11},{4},{5},{7},{8},{5},{3},{15},{2},{6},{3},{8},{3},{7},{9},{8},{11},{12},{4},{9},{5},{6},{7},{8},{5},{6},{7},{4},{8},{3},{11},{24},{21},{21},{15},{8},{14},{12},{4},{5},{10},{5},{8},{1},{2},{10},{5},{8},{10},{9},{15},{13},{8},{5},{8},{1},{5},{6},{5},{6},{8},{10},{6},{8},{7},{3},{4},{10},{4},{9},{5},{7},{4},{8},{4},{7},{3},{7},{3},{4},{5},{6},{3},{9},{4},{5},{14},{12},{11},{10},{20},{19},{17},{19},{22},{18},{19},{14},{12},{5},{10},{17},{13},{8},{1},{5},{4},{15},{8},{12},{10},{12},{19},{5},{4},{36},{4},{16},{3},{5},{10},{10},{5},{6},{5},{4},{4},{6},{3},{8},{5},{11},{8},{5},{10},{6},{6},{12},{6},{4},{1},{1},{6},{7},{3},{169},{11},{11},{305},{17},{118},{51},{155},{37},{89},{89},{89},{89},{89},{127},{186},{165},{19},{9},{11},{11},{11},{55},{55},{55},{55},{55},{92},{51},{39},{1}}; + #if (CYTHON_COMPRESS_STRINGS) == 2 /* compression: bz2 (3026 bytes) */ +const char* const cstring = "BZh91AY&SY\201I\351\243\000\002-\177\377\377\377\377\372\377\377\377\377\277\357\377\366\277\377\377\374@@@@@@@@@@@@@\000@\000`\013\317\274/o]\235\335\300n\235\326\366\356\266{\232\350\262\264\326j\332\223[+x\000x\032\010\222CF\023F\2154\006\323M121\244\303I\262M\010\030\231\006\3244\031\032i\210`\214\233&\204\310%\020&\200\023CH\323M4\233I\232)\345\032z\206G\250\320\000h\000\000\000\001\3524= =@\006\223\032$D\200h\320\323@\003\324\032\032\006\200\003@\000\0004\003@\r\0004\000\t\021&@B\246\3116jM\224\365\000z\200\000\000\000\000\000\000\000\000\000\000\004\030\000&\000\002`\230\000\000\000\000&\0010\020\300\000\021\200\000\000\222!2&%O\364!\245=\243T\323\302#\305\036\232\200\310h\000i\240\323\324\000\000\000\001\240\006\214Kb\020\206d\003\332#\030\037\233\"\301Y$.;L \313*d\025m1\032f\304i\004q\220D:\263z\241\326I.\272\031\035r\242\263\"\034s\260>\262I\202\305d\216\305H\307\0246&\304\233lm\266\333lHhiZ\325\323\022\207'(*k\224Q\"md\257\021\203m\003m\241\260n\340\252\030\251;\350\345\332\355U\326\"@\340I\224\030\213\322L\226\320g\n4\320*`\207$\314\270m\234\325E\302\354\027\031\300s\314z\310\210!\272a\250\320/\256\204\346\004\324H\306\345)]\022J*%p#4>\364\036\204\350\247aDEHe\262\2172/\013\250'\321\361\031C\326\033)\276\224\311\302=%\277AX\350=q\224{n\344\213~W+\030j\2024\253\033\362\244\257s\214\006De\033+\2060\177W\346E.\247\337\214ju\"\371\037\317\007a\321\355QW\240\36222\241\365\rdk\244\221\365\301\314o\356\346\255\003\316\211\347r\224u)~l\241M\223\375WB\261\374a~q\226\016&\305/\227\0234\032c\264Z\350\343\206:Wu\263\324m\256M\356\035\304G\226\021[\247\tU\\{\350p\036/\001\212N\033\254\016\035\327\033\274\302t\222m\300\204c\030\221\214\260{\307\313\265\322\367\362R\024\244\323JP\223A\007\316:\255|\373\004\363\3337\014\277\366\"\371\275J0\272\3010uy\2551t\245\\\371\346|\024\206\272\215dV\240\200D\224\302\013\250R\350\026\210T\270\322\226\014\r\353o\330\234\366@\357(N=\375\376d\007;\312\224o(\320\254R\215\221\021\020\346#\206d\277\326\323\242\241~\027\316\023\347\374""\034\317}c\024\325e\002\212\365\217\271S\234\311\360l\226\222\224\275\236_\005\205\204\300\234\356-\352k\026K,R\347\373\260\311\n\016e\235\rs{\210\335Q\377\037w\220M\277g\233\357|\367\3232b\014\210\341\326\241\343\220 \301\212\231\332\3305\306O\267V_\245u*5E\324bW\033\230\306WUv\226@\354\313\207\2679\033\216\\G\003\253A\035@Q\013\370\370\270\270\031\332<\243\223\263\3319\341\2276\010\031S(\2301\275\242a\034\\w\201 \217\305\211\262my\3334mV\365\313\326\321\t\212R}\326\330J\230V\365Gsw\003oa\253s\205\373\252H\265\231)\352m>\2169\354sV\272\347\220\330A\036\322^\270\230\263*cCd-R\326=\310=\354`\247\004\3269\303\377\0240\331\313\265d+4\223$\3109&\321\014\364\325\316\262\307\237Z\"\355\301`>Hk\240\342\223\032c\351\230\207\312B=\246:\204\265\255\024rZ\033\177\221\004t\204\021\225d\236\353I\226\223\344\244\240N\322C\214\007\306h\375b\231\275\027(\366\2206o\2657\032\350\336H\251\241\275@\361M`\002\345\214\\\005\257\234\306\212\261\301\001\342\273L_\261`Z\205D\024 \207X\245\006\335\025&g\367\276\225kZ\273\261\246\252\363G\213x\\\355t\316M\274\237#C\353\330Q!ld\2125\014\344\211B\314\230w\004\225\010\275\345d \005\346e+\361\342\002\023L\320\\\322Q\213\260S\205I\025\250\030\nm\347\242\255F\032N\217\354\241),%\206G'\352IZ\020\003T\330\347S.$\026\3029\206]\010\225\004\206Y(\215z\360\325*JZ\352ngt\220\267f\023\0247\352\271\0330q\024jZ\r\033j_(k^\362\373\214\235\207\014D\217\204\t\004\221\"g\032\220d\227\0028\353N\0277_\002\350\263\2041v\002\200\326\000(w\242\342\200\022\034b\rym\305\263\337\323\312m\033\226\217\210u<\357\236\254\001K\262\303gAr*\311\010 ,\026\017\353R3\034\262\351\276\336S\000Dr\271X\2628\262\302\264\022\304\333{\0241\266\245B\013\213\0106\357-V\275\204#\360\227\0049D\2214\210\321\373cH9\214kF\262m\302@\274\212+\253#kf\200\2415D\037H\272%\0309\004\311\21723&W(\324O<\001F\267\311\264d\310\033Xn\365\257 \316Y\252c\231;\3677\307+m\251m\370\266\351\260{\271\\\313\247\024\233t-7\023\204b\346\243\033m\266\330\306\351\027\306F\030\231!\225\230\321\237\340\333Cr\267Q\226""\333\344\321(#9k_%\226<\026\0010!\354\221\r\310p\013?\034\n\253\255\320\2610Z#gG!\024\254\201\341\n\227+\221n\227\006\035\312\033\266H$h\315d\010=\304\303\025G\370|-R\346+\321\263L\346\327\004\272\211\264H\370&y\314V1_\010\276\3702/\312\233oW\356\323u\014bi\215\261\021CjW\2635\273]\223\324\034G|\367\270\270\215\030\303\305\275\t\342*k!\200,,\262\000\273\367\\\351f\223\213M\245\251l\240E6'\273?y\035\266\213J\3454`\016\032\354\020\300\342\264\355\256r\213\002\305n\313!3\2700\245\234.G*\250\010\376=\r\274\333@\350\271*\331ySP\302f\230\357\225TU\211dR\204m\306\316\235H\005o\023%*\021\322\222\253\252{\025\t\302\004\225\340\250\310\244\0076r\\k\221%\337\336\246\342\t\"\320\225\002\212\212\250T\225oN!\262\023\004\221\332iG\267\014\331\000\261\203,\256\214\354\356\224UP[{}\232/\033\207.\225\203\202\267\232\215\272\360\007WvrQ\362\365`\214D\271Z\007\032O\1775\304Isy%\236\244B\307\002\372\335\340:\344\273\211EA\252+\340\210\315\031\224h\r\345u\354\271\\\0331\303\214eJ\206\017\203[\"\247\025PI\0027\313U\255\034\226\320\227#\365\222\370S()r\276FB\241\325\251\357G\327m\305\311k\373\365\352A`\353V`\021\250\274a\367\321G\3056(\341\323\243\316\362<\373R\276\035\310\321x\350\033\006\242\264S\245\237I\344\032*\264\251\315\307\212'Pb\"\204X\235M\360N\331\235=\300\2167@\320\350c:Q\247\244\326\\\272-\345\357:%\311\010\020\263\317\253\2122\346\363\2639\331\320\241 Q.\324\302\232\263\tO6O\237\024c\003Q\211\\\034\232\006\231ZC\020D\304\217\207\247\"F$)\032`\343\352\310YB(~\010\3466HH\255\\E""\220X2\242\214\013\337L<\023\253J\033\311\023 (\223\363tP\357\371\007|\273[\327\375\333\356\213\016\204\274\355\230*\333_T\325\3129R\265\005\335\306LM;\254\034\334\030y\276\032>\247GA\t\263$\350z'mV\242\010A<\204:{\3041]\361\345\374\005\355\253\311D\014\025\272\\PK\363<\247\014\206y\006\020\222\252\342\0263\366\227\262\031\252\263S\231\212-\013 Y\005\313\240\206H\224\n(\020\313\302\321\345\225\344\027F+\016\032[\277\01344\240`Z\252\302A\254:\027AIvc.\306\0203\254\264\322\201?\342\356H\247\n\022\020)=4`"; + PyObject *data = __Pyx_DecompressString(cstring, 3026, 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 (2937 bytes) */ +const char* const cstring = "x\332\245W\315s\323H\026\307Cf\310@\030\022\010\037;\324\326\312@H\230\001\017\016!\201Y\226-\207\030\306\305\247!!3S\273\245jKmG\023Yr\324R\022\263{\340\350\243\216:\352\250\243\217>\372\310\321\307\034\363'\314\237\260\277\327-;N\314\260[K\225-u\277\356\367\372}\374\336{\255\037\265\202mk\246U\347\216\260\\Gh\r\217\033\334\264\234\332\001Q\2331\265z |\255\3025\3131\371.75\346\230\232\343\372\232\260-l_\016\252U\356i\333\026\337\321L\227\013\271\304w\033\256\340\232\360=\313\344\342\021s4\327\261\233\232\341q\346s\215i\025\305\344o0_\263\204f\270\216o\325\0027\0208D\253\363\272\3535s\340\"QL\010\253\346h\276\253\201\331\274%\345\250\035td\272)\025\274\343Y>\253\330<\335\240\224\252zn\375S\274\322,m\307\36274\277\331\340\332lJ\367=\346\010i\306\001\213\332\006\016\013\256\362\207|\2672\3540K9Am*\326\033~S\023\033\014\242\375\240\001\345\252\256\247\031M\177\303ur\314\363X\263$\025p\003_s\253Z\305\r\034Shsl\027Rf\314\033\245\321\263\224\363\203F\303\365|n\226\234mf[\210\222k\362\233\344xlF\220f\215Y\r\347\314\34202d\366\246V\003W\177\263R\007\276\226\307\r\264Y\031\013\346\303n\035\354\300\346l\352Wk\233\023\367cf\013\236{y\310yP9\005\0303\014.\372\336|\343\363\206VgM\351?\340\371\035\367\334\003G\2579\0229\020\t4ns\017\300\360y\235\346n\205\214\312=\234\275q+\373wf\232\272C\016\"s5\370\350\366\256\341\3326)\204\320\344X\305x0\204f\332\244\324}x\224\334\007\321C\323\022t2\227\347\327\014m\216\002U\223\370!\033(\035\371\256\317\035_&\307AfZB\261\230\244\247\260\336q\355\301\337\264\333#\350r\\\004\257\312\002\333\327t\335\343f`p]\327\314@\232\352\270\316-\004s\333b6V\r\313\261|]w\202z\243\231\323\r\327\343\271:\370,)G\2532\313V\021\263\352\004\275\341mA\235!/\216\356H=\367Pp\273\23234C\345\025<\237zX\355e\332+\0053\265[\032\320\260\214M""\033\226+\316\233\362\005\010\352\025\316\352\272\000\036\270\242I\205\017\210\377\367\021\016\253\363~\332\276p\035.\032\314h\346\270\347\271\236P\343\206\325@\n8<\2477\230'\270\247[\0162\300\001\372rC\361\227{\177\350\357\375ad\357\017\016\367r\215\346\256\222\351\273\233\210e\016\023'%x\014\0269\265\007\252p\232\207\3603J\243\004\037\300\350\320\372a*\214t\003\317\340\017\203\001\306\231m\273\206\254\3052\266&\363Y\356#\253\252N\220\304\264\224\347\no\036\225J\313\313\274f9\362\221\033\200J\201N\327\373d\244\260\014\312\301\202e\007\356\023\3276\007\203\2170\017-\375\261\200\\\320\200\306\\\316_\005bc\305\335q\016M\376@\360\320\362\307\205\0176P\2323\031\323\303\364\032\367S\272\030]\220@\224!\377\310\242\341\n\177\224j\272\206n\263\n\267\217pl0\241\327\372\256\032P%\334?A\326+\31476\016/\326\335m\256\023\276\017\223\005\0312\250\255\342\021*'0Z\274\235\277_\274=?_\274\267x\017\377\373\305\373\267\357\027m\333j\010K\024e6\310z[*9\245\217\370\270\364Q\307>{\306\204O\377Q\206\224:\302\362\374\371\313\267E\375E\341y\361\315s\013\375\337\251\245\257Q\021\007\013#R^\242+\3407\312\243\210#\373u\375Us\027\377\02547\375\005j\356k^}\303\267\002\356\030\374\rrtm\r~\246\377\250\304\224:\"\222Zj\356\240\273\242;(\360\244\020\002\312\016\200\206\244SUL\364\323OW]\214\246;:\302\350\331\014\315\262\351\030\226\213\242\343\341\306\200\"#*LpB\236A\r\024E\234\332(\031\243\006\000\031\365\007\232b3*\221\216\"c\360\n36\r[\014\225.\302\247A(H\273\205\256\233\344\007\365\002LM\352\336\272%tUCy\rn\301\225\203\343\362\342\230\272\261\301<\264(\374t\313\255\320Kn\357\017\360\266\374\346\321\241\240\246\306\321G\344\305BV[Ur\371.\253\343\246\224\276D\325f5\201\232\215&\223^g\252\036\337\322\365j\340\030:Y8\224\225rh\343\306\310M:]\000\344h\330\334\033\246\313\202\253\357\3167G\211\315\371\335#\231\334\317\335\303\331*\217U\261\226\231'\263O>$\221F\242\237\303\226e\352\272\352\210x\323e\217^\226\237>e\316\016R\370H.\223\303\007\241\306\270j\001'\252\341\247]\377\267\315\212n\231\233;\314""\253\t\251\233|(5\261\240\336\224\377}\305\353\3501x\362:]h\353\226C\027G\314]3\260\345{\233\017J\006\r\204\003\223xC\320\\\327\323'n!\016\257\351\233\274\t\327b\316wt\302\005\232\330\246\364\232r]\303m\340\223\202\360\303\315\206\347V\350\017\005\320\377\200\027nl\212\240\256f\036\027\022q4N\235JC\t!9\n\034\331\256\271j.GhE\247/g@*\035\335C\225\346\010)\255\034G\250\250\rG(k2TD\332\226\037\027\224[[\001\263\225+P\036\002~p\261\032\251\014\003\002E\335\203\366p&\356\024tk\242\233\307\2212LS\211Z*%\251\2631\032\244\344\240\300\350\037)6\262Y\023$\376\353\215\005AS\227\016\233\360\207\276\220\242\3323 \321\363\345C\246\264\232\322G\217\252L\362\201:a\013\211\t\337\305\337\013p\343\247\010\320:\236t\251\031\272\331\364\3574\362s* \264YU\013.q\010,\252\217\007\202\017\254\301\367I\300\305\216\353\231\273\315\246LJ\365\024\357\254Fo\354Fr\261\235\371\375\253c_\237\013\257\364\246\277K\262I>YN*\355L\373B{ko\374Tk\241\265\2657q!d\241\027\235\215\362{\343S\341\305(\023M\355\215O\206_\205lo\374\233V5,\354\215\237\r\257\321\354T\353^\270\024e\367'&\303\361\350\213\350J\3648\276\026\263\270\331\316\354M\236\013\027\302\235\310\210/\304~\262\220\004\355G8`\3722\311\234h\375\024.\207\025\310\275\020\341\2643-?\274\037=\302p\362b\270\265?q.\314\277\317\354\215]\215\363\361\343$K\303+q6^L\246zc\213m\266/\225|\027ME7c\2667q1\364\243{\361B\274\225d\3661\2216,\205W\303\325h:\372%6\222\251=\222\327\247\226\345\214\354?\335*a\317\331h>Z\215\247H\207 |\034]\215\326\343\225\344\313d]*;\231\212[h5\243\343\321\002\251:\031~\r\271e\032\234\214\262\364\3722\374'L6\223\271v\266\275\320\366;\013\235\235n\345\303\211\017Aou\255\267\366\266\367v\235\354]n1\030\371 \362{W\357\264\363\355\225\316\311\356\334\207,\255<\2132\352\214\235\320\214\2620%\257\334/\240L92\343\331d*\231m_\354d\350\260\023\341Vt\"\332\212\277IL\034\227\337OI'i\327\360\372\231\004\212\237im\275G\244\376\004Oe\241\275\037\337M2D\350\273\357z\014\231g\303\033Q\036Q\233\211w\022\206 a\375/0t\374|\270\006\373\344^/\234\n\257""\204%h\303\341g?\231O\312\004\030\362\344\002P2\205\250\227\342r\314\021\344\255\366Dg\245\373E7\333\235\357\226\367\225\343S5N\265\356\206\3071\227\304\323g\007\261\240]?Bv5^\206\027\257$+\355\361N\2463E,S\241\204\335\030\341m\242U\014\317\303->\36031\rmV\343sq!.\253\310A9\212V\020\025hp\t.\235\234\016\213\321\371\210E\00104\003wL\177\033\315D\333\361\233$\003WM_\204\177g\343\351\3705\354\271\223pDnk\357\322\237\021\375e@\346R\373\\\373q\347Zg\243\313\272\002Q\232\274\020\326\242\327`.\017\254\231V:\225\302T\201\002m\242\370\335\205S\345\246\314\357\343\307\276<\335*\354\215M\264\236\204y\200\213\340:v\342\375vk\035\252\021\210\220Dp1A~\234T\306\032E\255w\346\252\204\363\211\344_\235\331\356\324\376aJ\366s\004\317%cI\001\340~\n\214\262\375\303\224\317\322\370\032\262&\203\312r\252\263\324\315\356\037\246\344?G\360L\274*\361\177\271\363\244\233\337?L)|\216\340\353\000[6Yj\177\337Y\357\026\366\017S\312\024\341\363\250\016\227\taq%9\005|lw\312\004\306L\nK:p1:\007\300\375#\231\352\227\260\002P9\r\375\316'\026\225\217\363\341\272$}\213\032\373\244\235W8*G\214\224\002\374e\222g\221}?\311\232#\301\265\213\212\311\336C\241\257\367&$;\345\310\222\2524Hn\312\327Y\024\343\376K\026\347}\302\033eI\3706R\371\206\242T\016\253\221\204\350\313h\021:\225{\327Q:\323\262\025-\241bU\223\202,p\007\365b\242\3654\334\246j\030\337L\230*u\027\201\346\311\313\022\324\223\224\267\323\227Pk\262\361Rr-\251\242T\\B\251\210O\000\231\247\333\375\324\220\312\034\244k\020-#\263\213\211Ty\006\325\342B$ O\036\023\260a\032y\345\307wT\361\240\244}\002\177\254\304\231\370\374 \017\257w\217w\357}X\354\225W{\253TN{\353\277\366~e=V\241\232r_Z\215\242\271?8R\220\267H\372\025\254\275\016\233\361q\034\007\355\347\341\223Jt*\316St\317\240\244S\367\331\211\255\304o\313vs\262\365}X\246\301\014b\016\357\3200\013g\\G\325\304P\203R\027bd\311\376\030\254\356i\267\001\355\277v7{\345\327{c$\374g\031Y\340\353\3372^\343\327\200\235\265$\207\272=v\252\225\377\003\266;\341\006J\324\326\020\233:\374E'\373)\266\205p\027""\216\317\014\261]G\323\335I\234N\341Slw\243q\03015\3046\213\330\215\267\277\351\260O\261-Es2d\007l7\220\201\337\265_t\225\222\351US\277+oM\372=\272t\342\276\205\017\007\337\367t\377\230\272\340hG\266-\245\367\036\375\031\337\345u\376\350\330\313\227o\365\327\205\027O\217\025\237\277Z\375E\177V\374\271\370\274\370?\362\016\263\004\270\245-.\350\2766\267\355Z\246\366\335M\r\204\233Z\237|\343\030\276*6\026\027^\376\007WnB\320"; + PyObject *data = __Pyx_DecompressString(cstring, 2937, 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 (6077 bytes) */ +const char* const bytes = ": All dimensions preceding dimension %d must be indexed and not slicedBuffer view does not expose stridesCan only create a buffer that is contiguous in memory.Cannot assign to read-only memoryviewCannot create writable memory view from read-only memoryviewCannot index with type 'Cannot transpose memoryview with indirect dimensionsDimension %d is not directEmpty shape tuple for cython.arrayIndex out of bounds (axis %d)Indirect dimensions not supportedInvalid mode, expected 'c' or 'fortran', got Invalid shape in axis ')-!?add_note and at 0xcollections.abcdisableenablegc (got got differing extents in dimension isenableditemsize <= 0 for cython.arrayno default __reduce__ due to non-trivial __cinit__numpy._core.multiarray failed to importnumpy._core.umath failed to import object>self.c cannot be converted to a Python object for picklingself.c,self.del_beam_state,self.init_beam_state cannot be converted to a Python object for picklingself.name is not Nonespacy.errorsspacy.pipeline._parser_internals.collectionsspacy/pipeline/_parser_internals/ner.pyxspacy.tokens.spanspacy.trainingunable to allocate array data.unable to allocate shape and strides.ASCIIBBeginBegin.__reduce_cython__Begin.__setstate_cython__BiluoGoldBiluoGold.__reduce_cython__BiluoGold.__setstate_cython__BiluoGold.updateBiluoPushDownBiluoPushDown.__reduce_cython__BiluoPushDown.__setstate_cython__BiluoPushDown.add_actionBiluoPushDown.get_actionsBiluoPushDown.get_beam_parsesBiluoPushDown.get_costBiluoPushDown.get_doc_labelsBiluoPushDown.has_goldBiluoPushDown.init_goldBiluoPushDown.init_go""ld_batchBiluoPushDown.move_nameBiluoPushDown.set_annotationsCounterE019E022E868E869E909EllipsisErrorsFalseIInIn.__reduce_cython__In.__setstate_cython__LLastLast.__reduce_cython__Last.__setstate_cython__MMOVE_NAMESMissingMissing.__reduce_cython__Missing.__setstate_cython__OOutOut.__reduce_cython__Out.__setstate_cython____Pyx_PyDict_NextRefSequenceSpanUUnitUnit.__reduce_cython__Unit.__setstate_cython__View.MemoryViewabcactionactionsaddadd_actionall_statesallocate_bufferallow_overlapasyncio.coroutinesbasebeamcclas__class____class_getitem__cline_in_tracebackclscollectionscostcountdefault__dict___dictdocdtype_is_objectegencodeendend_charentent_iobent_type_ent_typeentity_typeentity_typesentsenumerateerrorerrorsexampleexamplesflagsformatfortranfreq__func__getget_actionsget_aligned_ents_and_nerget_aligned_spans_x2yget_aligned_spans_y2xget_beam_parsesget_costget_doc_labels__getstate__goldgold_gold_stategoldshas_goldiid__import__index__init__init_batchinit_goldinit_gold_batch_is_coroutineis_finalitemsitemsizejkb_idkwargslabellabel_label_idlabel_namelabels__main__memviewminmode__module__movemove_namemovesn_stepsname__name__ndimneg_keyner__new__objpackparseparsespoppredictedprobprobs__pyx_checksum__pyx_result__pyx_state__pyx_type__pyx_unpickle_Begin__pyx_unpickle_Enum__pyx_unpickle_In__pyx_unpickle_Last__pyx_unpickle_Missing__pyx_unpickle_Out__pyx_unpickle_Unit__pyx_vtable____qualname__queue__reduce____reduce_cython____reduce_ex__registersscoreselfset_annotationsset_ents__set_name__setdefault__setstate____setstate_cython__shapesizespacy.pipeline._parser_internals.nerspansplit_bilu_labelsrcstartstart_charstartswithstatestatesstclsstepstopstructsum__test__tokentokens.spantrainingtransunmodifiedunpackupdateuse_setstatevalueswordxyy_spany_spanszip\320\004)\250\027\260\001\360\006\000\t\023\220\"\320\024*\250!\2501\250B\250b\260\001\260\026\260q\330\010\013\2104\210q\330\014\026\220a\220r\230\022\2301\330\010\021\220\027\230\001\230\021\330\010\020\220\006\220a\330\010\016\210f\220A""\330\010\022\220$\220a\330\010\013\2108\2207\230!\340\014\020\220\010\230\002\230\"\230F\240$\240a\240y\260\001\330\020\023\2204\220w\230c\240\026\240t\2504\250u\260C\260q\330\024\033\2301\330\010\014\210H\220B\220b\230\001\230\026\230q\330\014\017\210t\2209\230C\230q\330\020\027\220q\340\014\023\2201\200\001\330\004#\2401\240F\250!\200\001\330\004\"\240!\2406\250\021\320\0046\260a\340\010\013\2104\210z\230\021\230,\240a\330\014\027\220t\2308\2404\240q\250\001\340\014\027\220q\330\010\013\2107\220#\220T\230\024\230Y\240c\250\021\330\014\023\2201\330\010\013\2107\220#\220Q\330\014\023\2201\360\006\000\t\r\210I\220T\230\022\2302\230T\240\021\330\014\017\210u\220F\230#\230W\240D\250\005\250W\260C\260q\330\020\027\220q\330\010\013\2104\210y\230\003\2304\230q\330\014\020\220\t\230\024\230Q\330\014\020\220\n\230!\330\014\020\220\005\220]\240$\240d\250(\260!\2604\260t\2704\270w\300b\310\007\310u\320TU\320UV\320VW\330\010\014\210B\210a\210t\220<\230t\320#3\2601\260D\270\n\300(\310!\330\010\014\210L\230\001\330\010\013\2104\210w\220d\230!\2308\2401\330\014\026\220a\220s\230#\230Q\230d\240'\250\021\250'\260\027\270\001\330\014\020\220\007\220q\230\007\230q\240\016\250d\260!\2601\340\014\020\220\007\220q\230\n\240'\250\021\330\014\020\220\007\220q\230\007\230q\240\017\250q\330\010\017\210q\200A\330\010\031\230\021\230!\2304\230t\2405\250\001\200A\330\010\013\2104\210z\230\021\230&\240\001\330\014\022\220)\2301\230F\240%\240w\250a\250u\260A\330\010\037\230q\330\010\025\220U\230!\330\010\013\2104\210r\220\021\220\"\220I\230Q\230e\2404\240t\2502\250Q\250b\260\001\330\014\023\2204\220r\230\021\230\"\230I\240Q\240e\2504\250q\260\014\270D\300\002\300!\3002\300Q\340\014\023\2201\330\010\017\210q\200A\330\010\013\2105\220\003\2201\330\014\023\2201\330\r\022\220#\220Q\330\014\023\2201\340\014\023\220:\230Q\230f\240B\240d\250\"\250D\260\010\270\001\270\021\200A\330\010\021\220\021\330\010\020\220\004\220A\330\010\014\210E\220\025\220a\220t\2301\330\014\024\220I\230T\240\023\240A\240Q""\330\014\017\210u\220I\230Q\330\020\027\220u\230A\230Q\330\020\030\230\001\330\020\024\220E\230\025\230a\230u\240F\250%\250q\330\024\032\230%\230v\240S\250\001\250\021\330\024\027\220s\230'\240\024\240R\240t\2503\250e\2604\260q\330\030\035\230W\240B\240c\250\030\260\023\260F\270$\270h\300a\300s\310!\330\020\026\220g\230R\230v\240Q\330\010\017\210q\200A\330\010\024\220A\330\010\014\210I\220Q\330\014\017\210u\220A\330\020\026\220d\230!\2305\240\001\330\010\017\210q\200\001\360\010\000\005\r\210A\330\004\014\210G\2201\220F\230,\240a\330\004\007\200v\210W\220E\230\024\230Q\330\010\022\220!\330\010\027\220q\340\010\030\230\001\330\004\007\200q\330\010\017\320\017#\2404\240q\250\007\250{\270'\300\021\340\010\017\320\017#\2404\240q\250\007\250{\270!\200\001\360\010\000\005\r\210A\330\004\014\210G\2201\220F\230,\240a\330\004\007\200v\210W\220E\230\024\230Q\330\010\022\220!\330\010\027\220q\340\010\030\230\001\330\004\007\200q\330\010\017\320\017(\250\004\250A\250W\260K\270w\300a\340\010\017\320\017(\250\004\250A\250W\260K\270q\200\001\360\010\000\005\r\210A\330\004\014\210G\2201\220F\230,\240a\330\004\007\200v\210W\220E\230\024\230Q\330\010\022\220!\330\010\027\220q\340\010\030\230\001\330\004\007\200q\330\010\017\320\017$\240D\250\001\250\027\260\013\2707\300!\340\010\017\320\017$\240D\250\001\250\027\260\013\2701\200\001\360\010\000\005\r\210A\330\004\014\210G\2201\220F\230,\240a\330\004\007\200v\210W\220E\230\024\230Q\330\010\022\220!\330\010\027\220q\340\010\030\230\001\330\004\007\200q\330\010\017\320\017%\240T\250\021\250'\260\033\270G\3001\340\010\017\320\017%\240T\250\021\250'\260\033\270A\200\001\360\010\000\005\r\210A\330\004\014\210G\2201\220F\230,\240a\330\004\007\200v\210W\220E\230\024\230Q\330\010\022\220!\330\010\027\220q\340\010\030\230\001\330\004\007\200q\330\010\017\320\017&\240d\250!\2507\260+\270W\300A\340\010\017\320\017&\240d\250!\2507\260+\270Q\200A\330\010\025\220T\230\033\240A\240Q\240b\250\013\2604\260v\270Q\330\010\020\220\001\330\010\021\220""\021\330\010\014\210G\2206\230\023\230A\230\\\250\021\330\014\017\210t\2209\230A\230T\240\024\240T\250\025\250i\260q\330\020\025\220W\230A\230T\240\032\2501\250G\2601\330\020\026\220g\230Q\230a\330\010\022\220#\220Q\220a\220s\230!\2301\230H\240D\250\005\250Q\330\010\017\210x\220w\230a\200A\340\010\t\330\014\025\220W\230A\330\014\023\2207\230!\330\014\020\220\007\220q\330\014\022\220'\230\021\330\014\022\220'\230\021\330\014\021\220\027\230\001\340\010\017\210q\220\004\220A\220V\2301\330\010\017\210q\220\005\220Q\220f\230A\330\010\014\210O\2306\240\024\240Q\320&6\260a\330\014\020\220\n\230!\2307\240$\240f\250A\330\020\027\220q\230\007\230q\240\017\250q\330\010\014\210K\220v\230T\240\021\240,\250a\330\014\020\220\t\230\027\240\001\330\020\033\2305\240\001\330\020\023\2201\330\024\030\230\n\240!\2407\250$\250f\260A\330\030\037\230q\240\007\240q\250\r\260Q\330\010\017\210q\200A\340\010\017\210q\330\010\014\210E\220\025\220a\220u\230B\230f\240E\250\021\330\014\022\220%\220r\230\026\230s\240!\2401\330\014\017\210s\220'\230\024\230R\230t\2403\240e\2504\250q\330\020\024\220G\2301\230D\240\001\240\025\240c\250\030\260\023\260F\270&\300\003\3008\3106\320QT\320TV\320VW\320WZ\320Za\320ab\330\010\013\2109\220A\220V\2308\2401\340\010\014\210E\220\025\220a\220s\230!\330\014\017\210s\220\"\220A\220R\220y\240\003\2401\330\020\023\2202\220Q\220b\230\013\2401\200A\330\010\017\210y\230\001\230\026\230w\240i\250t\2601\200\001\330\004\n\210+\220Q\200\001\330\004%\240Q\240f\250A\200\001\330\004!\240\021\240&\250\001\200\001\330\004 \240\001\240\026\240q\200\001\340\004\037\230q\320 0\260\013\270;\300k\320QR\330\004\023\2202\220X\230Q\230a\330\004\007\200|\2207\230!\330\010$\240A\240U\250.\270\001\330\004\013\2101\200\001\340\004\037\230q\320 0\260\013\270;\300k\320QR\330\004\023\2203\220h\230a\230q\330\004\007\200|\2207\230!\330\010%\240Q\240f\250N\270!\330\004\013\2101\200\001\340\004\037\230q\320 0\260\013\270;\300k\320QR\330\004\023\2204\220x\230q\240\001\330\004\007\200|\2207\230!""\330\010&\240a\240w\250n\270A\330\004\013\2101\200\001\340\004\037\230q\320 0\260\013\270;\300k\320QR\330\004\023\2205\230\010\240\001\240\021\330\004\007\200|\2207\230!\330\010'\240q\250\010\260\016\270a\330\004\013\2101\200\001\340\004\037\230q\320 0\260\013\270;\300k\320QR\330\004\023\2207\230(\240!\2401\330\004\007\200|\2207\230!\330\010)\250\021\250*\260N\300!\330\004\013\2101__pyx_t_5spacy_8typedefs_attr_t\000struct __pyx_t_5spacy_7structs_LexemeC\000OOV_RANK\000EMPTY_LEXEMEstruct __pyx_t_5spacy_7structs_LexemeC\000EMPTY_LEXEMEuint64_t (void *, int, uint64_t)\000hash64O"; + 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 < 276; i++) { + Py_ssize_t bytes_length = index[i].length; + PyObject *string = PyUnicode_DecodeUTF8(bytes + pos, bytes_length, NULL); + if (likely(string) && i >= 58) 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 = 276; i < 307; 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 < 307; i++) { + if (unlikely(PyObject_Hash(stringtab[i]) == -1)) { + __PYX_ERR(0, 1, __pyx_L1_error) + } + } + #if CYTHON_IMMORTAL_CONSTANTS + { + PyObject **table = stringtab + 276; + for (Py_ssize_t i=0; i<31; ++i) { + #if CYTHON_COMPILING_IN_CPYTHON_FREETHREADING + Py_SET_REFCNT(table[i], _Py_IMMORTAL_REFCNT_LOCAL); + #else + 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,-1,1}; + int16_t const cint_constants_2[] = {9000}; + int32_t const cint_constants_4[] = {136983863L,238750788L}; + for (int i = 0; i < 6; i++) { + numbertab[i] = PyLong_FromLong((i < 3 ? cint_constants_1[i - 0] : (i < 4 ? cint_constants_2[i - 3] : cint_constants_4[i - 4]))); + 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<6; ++i) { + #if CYTHON_COMPILING_IN_CPYTHON_FREETHREADING + Py_SET_REFCNT(table[i], _Py_IMMORTAL_REFCNT_LOCAL); + #else + 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 : 9; +} __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, 2, (unsigned int)(CO_OPTIMIZED|CO_NEWLOCALS), 63}; + PyObject* const varnames[] = {__pyx_mstate->__pyx_n_u_self, __pyx_mstate->__pyx_n_u_stcls}; + __pyx_mstate_global->__pyx_codeobj_tab[0] = __Pyx_PyCode_New(descr, varnames, __pyx_mstate->__pyx_kp_u_spacy_pipeline__parser_internals_3, __pyx_mstate->__pyx_n_u_update, __pyx_mstate->__pyx_kp_b_iso88591_A_4t5, 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), 1}; + PyObject* const varnames[] = {__pyx_mstate->__pyx_n_u_self}; + __pyx_mstate_global->__pyx_codeobj_tab[1] = __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[1])) 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[2] = __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[2])) goto bad; + } + { + const __Pyx_PyCode_New_function_description descr = {1, 0, 0, 8, (unsigned int)(CO_OPTIMIZED|CO_NEWLOCALS|CO_VARKEYWORDS), 131}; + PyObject* const varnames[] = {__pyx_mstate->__pyx_n_u_cls, __pyx_mstate->__pyx_n_u_kwargs, __pyx_mstate->__pyx_n_u_actions, __pyx_mstate->__pyx_n_u_entity_type, __pyx_mstate->__pyx_n_u_action, __pyx_mstate->__pyx_n_u_example, __pyx_mstate->__pyx_n_u_token, __pyx_mstate->__pyx_n_u_ent_type_2}; + __pyx_mstate_global->__pyx_codeobj_tab[3] = __Pyx_PyCode_New(descr, varnames, __pyx_mstate->__pyx_kp_u_spacy_pipeline__parser_internals_3, __pyx_mstate->__pyx_n_u_get_actions, __pyx_mstate->__pyx_kp_b_iso88591_A_WA_7_q_q_AV1_q_QfA_O6_Q_6a_7_f, tuple_dedup_map); if (unlikely(!__pyx_mstate_global->__pyx_codeobj_tab[3])) goto bad; + } + { + const __Pyx_PyCode_New_function_description descr = {2, 0, 0, 4, (unsigned int)(CO_OPTIMIZED|CO_NEWLOCALS), 158}; + PyObject* const varnames[] = {__pyx_mstate->__pyx_n_u_self, __pyx_mstate->__pyx_n_u_doc, __pyx_mstate->__pyx_n_u_labels, __pyx_mstate->__pyx_n_u_token}; + __pyx_mstate_global->__pyx_codeobj_tab[4] = __Pyx_PyCode_New(descr, varnames, __pyx_mstate->__pyx_kp_u_spacy_pipeline__parser_internals_3, __pyx_mstate->__pyx_n_u_get_doc_labels, __pyx_mstate->__pyx_kp_b_iso88591_A_A_IQ_uA_d_5_q, tuple_dedup_map); if (unlikely(!__pyx_mstate_global->__pyx_codeobj_tab[4])) goto bad; + } + { + const __Pyx_PyCode_New_function_description descr = {3, 0, 0, 3, (unsigned int)(CO_OPTIMIZED|CO_NEWLOCALS), 165}; + PyObject* const varnames[] = {__pyx_mstate->__pyx_n_u_self, __pyx_mstate->__pyx_n_u_move, __pyx_mstate->__pyx_n_u_label}; + __pyx_mstate_global->__pyx_codeobj_tab[5] = __Pyx_PyCode_New(descr, varnames, __pyx_mstate->__pyx_kp_u_spacy_pipeline__parser_internals_3, __pyx_mstate->__pyx_n_u_move_name, __pyx_mstate->__pyx_kp_b_iso88591_A_5_1_1_Q_1_QfBd_D, tuple_dedup_map); if (unlikely(!__pyx_mstate_global->__pyx_codeobj_tab[5])) goto bad; + } + { + const __Pyx_PyCode_New_function_description descr = {2, 0, 0, 9, (unsigned int)(CO_OPTIMIZED|CO_NEWLOCALS), 173}; + PyObject* const varnames[] = {__pyx_mstate->__pyx_n_u_self, __pyx_mstate->__pyx_n_u_examples, __pyx_mstate->__pyx_n_u_all_states, __pyx_mstate->__pyx_n_u_golds, __pyx_mstate->__pyx_n_u_states, __pyx_mstate->__pyx_n_u_state, __pyx_mstate->__pyx_n_u_eg, __pyx_mstate->__pyx_n_u_n_steps, __pyx_mstate->__pyx_n_u_s}; + __pyx_mstate_global->__pyx_codeobj_tab[6] = __Pyx_PyCode_New(descr, varnames, __pyx_mstate->__pyx_kp_u_spacy_pipeline__parser_internals_3, __pyx_mstate->__pyx_n_u_init_gold_batch, __pyx_mstate->__pyx_kp_b_iso88591_A_T_AQb_4vQ_G6_A_t9AT_T_iq_WAT_1, tuple_dedup_map); if (unlikely(!__pyx_mstate_global->__pyx_codeobj_tab[6])) goto bad; + } + { + const __Pyx_PyCode_New_function_description descr = {4, 0, 0, 6, (unsigned int)(CO_OPTIMIZED|CO_NEWLOCALS), 239}; + PyObject* const varnames[] = {__pyx_mstate->__pyx_n_u_self, __pyx_mstate->__pyx_n_u_action, __pyx_mstate->__pyx_n_u_label_name, __pyx_mstate->__pyx_n_u_freq, __pyx_mstate->__pyx_n_u_label_id, __pyx_mstate->__pyx_n_u_trans}; + __pyx_mstate_global->__pyx_codeobj_tab[7] = __Pyx_PyCode_New(descr, varnames, __pyx_mstate->__pyx_kp_u_spacy_pipeline__parser_internals_3, __pyx_mstate->__pyx_n_u_add_action, __pyx_mstate->__pyx_kp_b_iso88591_6a_4z_a_t84q_q_7_T_Yc_1_7_Q_1_I, tuple_dedup_map); if (unlikely(!__pyx_mstate_global->__pyx_codeobj_tab[7])) goto bad; + } + { + const __Pyx_PyCode_New_function_description descr = {3, 0, 0, 6, (unsigned int)(CO_OPTIMIZED|CO_NEWLOCALS), 268}; + PyObject* const varnames[] = {__pyx_mstate->__pyx_n_u_self, __pyx_mstate->__pyx_n_u_state, __pyx_mstate->__pyx_n_u_doc, __pyx_mstate->__pyx_n_u_i, __pyx_mstate->__pyx_n_u_ents, __pyx_mstate->__pyx_n_u_ent}; + __pyx_mstate_global->__pyx_codeobj_tab[8] = __Pyx_PyCode_New(descr, varnames, __pyx_mstate->__pyx_kp_u_spacy_pipeline__parser_internals_3, __pyx_mstate->__pyx_n_u_set_annotations, __pyx_mstate->__pyx_kp_b_iso88591_A_q_E_auBfE_r_s_1_s_Rt3e4q_G1D_c, tuple_dedup_map); if (unlikely(!__pyx_mstate_global->__pyx_codeobj_tab[8])) goto bad; + } + { + const __Pyx_PyCode_New_function_description descr = {2, 0, 0, 10, (unsigned int)(CO_OPTIMIZED|CO_NEWLOCALS), 281}; + PyObject* const varnames[] = {__pyx_mstate->__pyx_n_u_self, __pyx_mstate->__pyx_n_u_beam, __pyx_mstate->__pyx_n_u_parses, __pyx_mstate->__pyx_n_u_probs, __pyx_mstate->__pyx_n_u_i, __pyx_mstate->__pyx_n_u_state, __pyx_mstate->__pyx_n_u_prob, __pyx_mstate->__pyx_n_u_parse, __pyx_mstate->__pyx_n_u_j, __pyx_mstate->__pyx_n_u_ent}; + __pyx_mstate_global->__pyx_codeobj_tab[9] = __Pyx_PyCode_New(descr, varnames, __pyx_mstate->__pyx_kp_u_spacy_pipeline__parser_internals_3, __pyx_mstate->__pyx_n_u_get_beam_parses, __pyx_mstate->__pyx_kp_b_iso88591_A_A_E_at1_IT_AQ_uIQ_uAQ_E_auF_q, tuple_dedup_map); if (unlikely(!__pyx_mstate_global->__pyx_codeobj_tab[9])) goto bad; + } + { + const __Pyx_PyCode_New_function_description descr = {3, 0, 0, 3, (unsigned int)(CO_OPTIMIZED|CO_NEWLOCALS), 296}; + PyObject* const varnames[] = {__pyx_mstate->__pyx_n_u_self, __pyx_mstate->__pyx_n_u_state, __pyx_mstate->__pyx_n_u_example}; + __pyx_mstate_global->__pyx_codeobj_tab[10] = __Pyx_PyCode_New(descr, varnames, __pyx_mstate->__pyx_kp_u_spacy_pipeline__parser_internals_3, __pyx_mstate->__pyx_n_u_init_gold, __pyx_mstate->__pyx_kp_b_iso88591_A_y_wit1, tuple_dedup_map); if (unlikely(!__pyx_mstate_global->__pyx_codeobj_tab[10])) goto bad; + } + { + const __Pyx_PyCode_New_function_description descr = {4, 0, 0, 9, (unsigned int)(CO_OPTIMIZED|CO_NEWLOCALS), 299}; + PyObject* const varnames[] = {__pyx_mstate->__pyx_n_u_self, __pyx_mstate->__pyx_n_u_eg, __pyx_mstate->__pyx_n_u_start, __pyx_mstate->__pyx_n_u_end, __pyx_mstate->__pyx_n_u_y_spans, __pyx_mstate->__pyx_n_u_y_span, __pyx_mstate->__pyx_n_u_neg_key, __pyx_mstate->__pyx_n_u_span, __pyx_mstate->__pyx_n_u_word}; + __pyx_mstate_global->__pyx_codeobj_tab[11] = __Pyx_PyCode_New(descr, varnames, __pyx_mstate->__pyx_kp_u_spacy_pipeline__parser_internals_3, __pyx_mstate->__pyx_n_u_has_gold, __pyx_mstate->__pyx_kp_b_iso88591_1Bb_q_4q_ar_1_a_fA_a_87_F_ay_4w, tuple_dedup_map); if (unlikely(!__pyx_mstate_global->__pyx_codeobj_tab[11])) goto bad; + } + { + const __Pyx_PyCode_New_function_description descr = {4, 0, 0, 7, (unsigned int)(CO_OPTIMIZED|CO_NEWLOCALS), 320}; + PyObject* const varnames[] = {__pyx_mstate->__pyx_n_u_self, __pyx_mstate->__pyx_n_u_stcls, __pyx_mstate->__pyx_n_u_gold, __pyx_mstate->__pyx_n_u_i, __pyx_mstate->__pyx_n_u_gold_2, __pyx_mstate->__pyx_n_u_gold_state, __pyx_mstate->__pyx_n_u_cost}; + __pyx_mstate_global->__pyx_codeobj_tab[12] = __Pyx_PyCode_New(descr, varnames, __pyx_mstate->__pyx_kp_u_spacy_pipeline__parser_internals_3, __pyx_mstate->__pyx_n_u_get_cost, __pyx_mstate->__pyx_kp_b_iso88591_A_4z_1F_wauA_q_U_4r_IQe4t2Qb_4r, tuple_dedup_map); if (unlikely(!__pyx_mstate_global->__pyx_codeobj_tab[12])) 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[13] = __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[13])) 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[14] = __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[14])) goto bad; + } + { + const __Pyx_PyCode_New_function_description descr = {1, 0, 0, 4, (unsigned int)(CO_OPTIMIZED|CO_NEWLOCALS), 1}; + PyObject* const varnames[] = {__pyx_mstate->__pyx_n_u_self, __pyx_mstate->__pyx_n_u_state, __pyx_mstate->__pyx_n_u_dict_2, __pyx_mstate->__pyx_n_u_use_setstate}; + __pyx_mstate_global->__pyx_codeobj_tab[15] = __Pyx_PyCode_New(descr, varnames, __pyx_mstate->__pyx_kp_u_stringsource, __pyx_mstate->__pyx_n_u_reduce_cython, __pyx_mstate->__pyx_kp_b_iso88591_A_G1F_a_vWE_Q_q_q_AWKwa_AWKq, tuple_dedup_map); if (unlikely(!__pyx_mstate_global->__pyx_codeobj_tab[15])) goto bad; + } + { + const __Pyx_PyCode_New_function_description descr = {2, 0, 0, 2, (unsigned int)(CO_OPTIMIZED|CO_NEWLOCALS), 16}; + PyObject* const varnames[] = {__pyx_mstate->__pyx_n_u_self, __pyx_mstate->__pyx_n_u_pyx_state}; + __pyx_mstate_global->__pyx_codeobj_tab[16] = __Pyx_PyCode_New(descr, varnames, __pyx_mstate->__pyx_kp_u_stringsource, __pyx_mstate->__pyx_n_u_setstate_cython, __pyx_mstate->__pyx_kp_b_iso88591_QfA, tuple_dedup_map); if (unlikely(!__pyx_mstate_global->__pyx_codeobj_tab[16])) goto bad; + } + { + const __Pyx_PyCode_New_function_description descr = {1, 0, 0, 4, (unsigned int)(CO_OPTIMIZED|CO_NEWLOCALS), 1}; + PyObject* const varnames[] = {__pyx_mstate->__pyx_n_u_self, __pyx_mstate->__pyx_n_u_state, __pyx_mstate->__pyx_n_u_dict_2, __pyx_mstate->__pyx_n_u_use_setstate}; + __pyx_mstate_global->__pyx_codeobj_tab[17] = __Pyx_PyCode_New(descr, varnames, __pyx_mstate->__pyx_kp_u_stringsource, __pyx_mstate->__pyx_n_u_reduce_cython, __pyx_mstate->__pyx_kp_b_iso88591_A_G1F_a_vWE_Q_q_q_d_7_WA_d_7_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), 16}; + PyObject* const varnames[] = {__pyx_mstate->__pyx_n_u_self, __pyx_mstate->__pyx_n_u_pyx_state}; + __pyx_mstate_global->__pyx_codeobj_tab[18] = __Pyx_PyCode_New(descr, varnames, __pyx_mstate->__pyx_kp_u_stringsource, __pyx_mstate->__pyx_n_u_setstate_cython, __pyx_mstate->__pyx_kp_b_iso88591_1F, tuple_dedup_map); if (unlikely(!__pyx_mstate_global->__pyx_codeobj_tab[18])) goto bad; + } + { + const __Pyx_PyCode_New_function_description descr = {1, 0, 0, 4, (unsigned int)(CO_OPTIMIZED|CO_NEWLOCALS), 1}; + PyObject* const varnames[] = {__pyx_mstate->__pyx_n_u_self, __pyx_mstate->__pyx_n_u_state, __pyx_mstate->__pyx_n_u_dict_2, __pyx_mstate->__pyx_n_u_use_setstate}; + __pyx_mstate_global->__pyx_codeobj_tab[19] = __Pyx_PyCode_New(descr, varnames, __pyx_mstate->__pyx_kp_u_stringsource, __pyx_mstate->__pyx_n_u_reduce_cython, __pyx_mstate->__pyx_kp_b_iso88591_A_G1F_a_vWE_Q_q_q_4q_4q, tuple_dedup_map); if (unlikely(!__pyx_mstate_global->__pyx_codeobj_tab[19])) goto bad; + } + { + const __Pyx_PyCode_New_function_description descr = {2, 0, 0, 2, (unsigned int)(CO_OPTIMIZED|CO_NEWLOCALS), 16}; + PyObject* const varnames[] = {__pyx_mstate->__pyx_n_u_self, __pyx_mstate->__pyx_n_u_pyx_state}; + __pyx_mstate_global->__pyx_codeobj_tab[20] = __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[20])) goto bad; + } + { + const __Pyx_PyCode_New_function_description descr = {1, 0, 0, 4, (unsigned int)(CO_OPTIMIZED|CO_NEWLOCALS), 1}; + PyObject* const varnames[] = {__pyx_mstate->__pyx_n_u_self, __pyx_mstate->__pyx_n_u_state, __pyx_mstate->__pyx_n_u_dict_2, __pyx_mstate->__pyx_n_u_use_setstate}; + __pyx_mstate_global->__pyx_codeobj_tab[21] = __Pyx_PyCode_New(descr, varnames, __pyx_mstate->__pyx_kp_u_stringsource, __pyx_mstate->__pyx_n_u_reduce_cython, __pyx_mstate->__pyx_kp_b_iso88591_A_G1F_a_vWE_Q_q_q_T_G1_T_A, tuple_dedup_map); if (unlikely(!__pyx_mstate_global->__pyx_codeobj_tab[21])) goto bad; + } + { + const __Pyx_PyCode_New_function_description descr = {2, 0, 0, 2, (unsigned int)(CO_OPTIMIZED|CO_NEWLOCALS), 16}; + PyObject* const varnames[] = {__pyx_mstate->__pyx_n_u_self, __pyx_mstate->__pyx_n_u_pyx_state}; + __pyx_mstate_global->__pyx_codeobj_tab[22] = __Pyx_PyCode_New(descr, varnames, __pyx_mstate->__pyx_kp_u_stringsource, __pyx_mstate->__pyx_n_u_setstate_cython, __pyx_mstate->__pyx_kp_b_iso88591_6, tuple_dedup_map); if (unlikely(!__pyx_mstate_global->__pyx_codeobj_tab[22])) goto bad; + } + { + const __Pyx_PyCode_New_function_description descr = {1, 0, 0, 4, (unsigned int)(CO_OPTIMIZED|CO_NEWLOCALS), 1}; + PyObject* const varnames[] = {__pyx_mstate->__pyx_n_u_self, __pyx_mstate->__pyx_n_u_state, __pyx_mstate->__pyx_n_u_dict_2, __pyx_mstate->__pyx_n_u_use_setstate}; + __pyx_mstate_global->__pyx_codeobj_tab[23] = __Pyx_PyCode_New(descr, varnames, __pyx_mstate->__pyx_kp_u_stringsource, __pyx_mstate->__pyx_n_u_reduce_cython, __pyx_mstate->__pyx_kp_b_iso88591_A_G1F_a_vWE_Q_q_q_T_G1_T_A, 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), 16}; + PyObject* const varnames[] = {__pyx_mstate->__pyx_n_u_self, __pyx_mstate->__pyx_n_u_pyx_state}; + __pyx_mstate_global->__pyx_codeobj_tab[24] = __Pyx_PyCode_New(descr, varnames, __pyx_mstate->__pyx_kp_u_stringsource, __pyx_mstate->__pyx_n_u_setstate_cython, __pyx_mstate->__pyx_kp_b_iso88591_6, tuple_dedup_map); if (unlikely(!__pyx_mstate_global->__pyx_codeobj_tab[24])) goto bad; + } + { + const __Pyx_PyCode_New_function_description descr = {1, 0, 0, 4, (unsigned int)(CO_OPTIMIZED|CO_NEWLOCALS), 1}; + PyObject* const varnames[] = {__pyx_mstate->__pyx_n_u_self, __pyx_mstate->__pyx_n_u_state, __pyx_mstate->__pyx_n_u_dict_2, __pyx_mstate->__pyx_n_u_use_setstate}; + __pyx_mstate_global->__pyx_codeobj_tab[25] = __Pyx_PyCode_New(descr, varnames, __pyx_mstate->__pyx_kp_u_stringsource, __pyx_mstate->__pyx_n_u_reduce_cython, __pyx_mstate->__pyx_kp_b_iso88591_A_G1F_a_vWE_Q_q_q_D_7_D_1, tuple_dedup_map); if (unlikely(!__pyx_mstate_global->__pyx_codeobj_tab[25])) goto bad; + } + { + const __Pyx_PyCode_New_function_description descr = {2, 0, 0, 2, (unsigned int)(CO_OPTIMIZED|CO_NEWLOCALS), 16}; + PyObject* const varnames[] = {__pyx_mstate->__pyx_n_u_self, __pyx_mstate->__pyx_n_u_pyx_state}; + __pyx_mstate_global->__pyx_codeobj_tab[26] = __Pyx_PyCode_New(descr, varnames, __pyx_mstate->__pyx_kp_u_stringsource, __pyx_mstate->__pyx_n_u_setstate_cython, __pyx_mstate->__pyx_kp_b_iso88591__10, tuple_dedup_map); if (unlikely(!__pyx_mstate_global->__pyx_codeobj_tab[26])) goto bad; + } + { + const __Pyx_PyCode_New_function_description descr = {3, 0, 0, 4, (unsigned int)(CO_OPTIMIZED|CO_NEWLOCALS), 4}; + PyObject* const varnames[] = {__pyx_mstate->__pyx_n_u_pyx_type, __pyx_mstate->__pyx_n_u_pyx_checksum, __pyx_mstate->__pyx_n_u_pyx_state, __pyx_mstate->__pyx_n_u_pyx_result}; + __pyx_mstate_global->__pyx_codeobj_tab[27] = __Pyx_PyCode_New(descr, varnames, __pyx_mstate->__pyx_kp_u_stringsource, __pyx_mstate->__pyx_n_u_pyx_unpickle_Missing, __pyx_mstate->__pyx_kp_b_iso88591_q_0_kQR_7_1_7_N_1, tuple_dedup_map); if (unlikely(!__pyx_mstate_global->__pyx_codeobj_tab[27])) goto bad; + } + { + const __Pyx_PyCode_New_function_description descr = {3, 0, 0, 4, (unsigned int)(CO_OPTIMIZED|CO_NEWLOCALS), 4}; + PyObject* const varnames[] = {__pyx_mstate->__pyx_n_u_pyx_type, __pyx_mstate->__pyx_n_u_pyx_checksum, __pyx_mstate->__pyx_n_u_pyx_state, __pyx_mstate->__pyx_n_u_pyx_result}; + __pyx_mstate_global->__pyx_codeobj_tab[28] = __Pyx_PyCode_New(descr, varnames, __pyx_mstate->__pyx_kp_u_stringsource, __pyx_mstate->__pyx_n_u_pyx_unpickle_Begin, __pyx_mstate->__pyx_kp_b_iso88591_q_0_kQR_5_7_q_a_1, tuple_dedup_map); if (unlikely(!__pyx_mstate_global->__pyx_codeobj_tab[28])) goto bad; + } + { + const __Pyx_PyCode_New_function_description descr = {3, 0, 0, 4, (unsigned int)(CO_OPTIMIZED|CO_NEWLOCALS), 4}; + PyObject* const varnames[] = {__pyx_mstate->__pyx_n_u_pyx_type, __pyx_mstate->__pyx_n_u_pyx_checksum, __pyx_mstate->__pyx_n_u_pyx_state, __pyx_mstate->__pyx_n_u_pyx_result}; + __pyx_mstate_global->__pyx_codeobj_tab[29] = __Pyx_PyCode_New(descr, varnames, __pyx_mstate->__pyx_kp_u_stringsource, __pyx_mstate->__pyx_n_u_pyx_unpickle_In, __pyx_mstate->__pyx_kp_b_iso88591_q_0_kQR_2XQa_7_AU_1, tuple_dedup_map); if (unlikely(!__pyx_mstate_global->__pyx_codeobj_tab[29])) goto bad; + } + { + const __Pyx_PyCode_New_function_description descr = {3, 0, 0, 4, (unsigned int)(CO_OPTIMIZED|CO_NEWLOCALS), 4}; + PyObject* const varnames[] = {__pyx_mstate->__pyx_n_u_pyx_type, __pyx_mstate->__pyx_n_u_pyx_checksum, __pyx_mstate->__pyx_n_u_pyx_state, __pyx_mstate->__pyx_n_u_pyx_result}; + __pyx_mstate_global->__pyx_codeobj_tab[30] = __Pyx_PyCode_New(descr, varnames, __pyx_mstate->__pyx_kp_u_stringsource, __pyx_mstate->__pyx_n_u_pyx_unpickle_Last, __pyx_mstate->__pyx_kp_b_iso88591_q_0_kQR_4xq_7_awnA_1, tuple_dedup_map); if (unlikely(!__pyx_mstate_global->__pyx_codeobj_tab[30])) goto bad; + } + { + const __Pyx_PyCode_New_function_description descr = {3, 0, 0, 4, (unsigned int)(CO_OPTIMIZED|CO_NEWLOCALS), 4}; + PyObject* const varnames[] = {__pyx_mstate->__pyx_n_u_pyx_type, __pyx_mstate->__pyx_n_u_pyx_checksum, __pyx_mstate->__pyx_n_u_pyx_state, __pyx_mstate->__pyx_n_u_pyx_result}; + __pyx_mstate_global->__pyx_codeobj_tab[31] = __Pyx_PyCode_New(descr, varnames, __pyx_mstate->__pyx_kp_u_stringsource, __pyx_mstate->__pyx_n_u_pyx_unpickle_Unit, __pyx_mstate->__pyx_kp_b_iso88591_q_0_kQR_4xq_7_awnA_1, tuple_dedup_map); if (unlikely(!__pyx_mstate_global->__pyx_codeobj_tab[31])) goto bad; + } + { + const __Pyx_PyCode_New_function_description descr = {3, 0, 0, 4, (unsigned int)(CO_OPTIMIZED|CO_NEWLOCALS), 4}; + PyObject* const varnames[] = {__pyx_mstate->__pyx_n_u_pyx_type, __pyx_mstate->__pyx_n_u_pyx_checksum, __pyx_mstate->__pyx_n_u_pyx_state, __pyx_mstate->__pyx_n_u_pyx_result}; + __pyx_mstate_global->__pyx_codeobj_tab[32] = __Pyx_PyCode_New(descr, varnames, __pyx_mstate->__pyx_kp_u_stringsource, __pyx_mstate->__pyx_n_u_pyx_unpickle_Out, __pyx_mstate->__pyx_kp_b_iso88591_q_0_kQR_3haq_7_QfN_1, tuple_dedup_map); if (unlikely(!__pyx_mstate_global->__pyx_codeobj_tab[32])) 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) + + /* AssertionsEnabled.init */ + if (likely(__Pyx_init_assertions_enabled() == 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++) { + if (unlikely(__Pyx_PyTuple_SET_ITEM(res, i, src[i]) < (0))) { + Py_DECREF(res); + return NULL; + } + Py_INCREF(src[i]); + } + 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); +} + +/* 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; +} + +/* 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; +} + +/* 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 + +/* RaiseUnexpectedTypeError */ +static int +__Pyx_RaiseUnexpectedTypeError(const char *expected, PyObject *obj) +{ + __Pyx_TypeName obj_type_name = __Pyx_PyType_GetFullyQualifiedName(Py_TYPE(obj)); + PyErr_Format(PyExc_TypeError, "Expected %s, got " __Pyx_FMT_TYPENAME, + expected, obj_type_name); + __Pyx_DECREF_TypeName(obj_type_name); + return 0; +} + +/* 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); +} + +/* CIntToPyUnicode */ +static CYTHON_INLINE PyObject* __Pyx_uchar___Pyx_PyUnicode_From_Py_ssize_t(Py_ssize_t value, Py_ssize_t width, char padding_char) { +#ifdef __Pyx_HAS_GCC_DIAGNOSTIC +#pragma GCC diagnostic push +#pragma GCC diagnostic ignored "-Wconversion" +#endif + const Py_ssize_t neg_one = (Py_ssize_t) -1, const_zero = (Py_ssize_t) 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 & ~ (Py_ssize_t) 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_Py_ssize_t(Py_ssize_t value, Py_ssize_t width, char padding_char, char format_char) { + char digits[sizeof(Py_ssize_t)*3+2]; + char *dpos, *end = digits + sizeof(Py_ssize_t)*3+2; + const char *hex_digits = DIGITS_HEX; + Py_ssize_t length, ulength; + int prepend_sign, last_one_off; + Py_ssize_t remaining; +#ifdef __Pyx_HAS_GCC_DIAGNOSTIC +#pragma GCC diagnostic push +#pragma GCC diagnostic ignored "-Wconversion" +#endif + const Py_ssize_t neg_one = (Py_ssize_t) -1, const_zero = (Py_ssize_t) 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 = (Py_ssize_t) (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 = (Py_ssize_t) (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 = (Py_ssize_t) (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 +} + +/* GetAttr */ +static CYTHON_INLINE PyObject *__Pyx_GetAttr(PyObject *o, PyObject *n) { +#if CYTHON_USE_TYPE_SLOTS + if (likely(PyUnicode_Check(n))) + return __Pyx_PyObject_GetAttrStr(o, n); +#endif + return PyObject_GetAttr(o, n); +} + +/* GetItemInt */ +static PyObject *__Pyx_GetItemInt_Generic(PyObject *o, PyObject* j) { + PyObject *r; + if (unlikely(!j)) return NULL; + r = PyObject_GetItem(o, j); + Py_DECREF(j); + return r; +} +static CYTHON_INLINE PyObject *__Pyx_GetItemInt_List_Fast(PyObject *o, Py_ssize_t i, + int wraparound, int boundscheck, int unsafe_shared) { + CYTHON_MAYBE_UNUSED_VAR(unsafe_shared); +#if CYTHON_ASSUME_SAFE_SIZE + Py_ssize_t wrapped_i = i; + if (wraparound & unlikely(i < 0)) { + wrapped_i += PyList_GET_SIZE(o); + } + if ((CYTHON_AVOID_BORROWED_REFS || CYTHON_AVOID_THREAD_UNSAFE_BORROWED_REFS || !CYTHON_ASSUME_SAFE_MACROS)) { + return __Pyx_PyList_GetItemRefFast(o, wrapped_i, unsafe_shared); + } else + if ((!boundscheck) || likely(__Pyx_is_valid_index(wrapped_i, PyList_GET_SIZE(o)))) { + return __Pyx_NewRef(PyList_GET_ITEM(o, wrapped_i)); + } + return __Pyx_GetItemInt_Generic(o, PyLong_FromSsize_t(i)); +#else + (void)wraparound; + (void)boundscheck; + return PySequence_GetItem(o, i); +#endif +} +static CYTHON_INLINE PyObject *__Pyx_GetItemInt_Tuple_Fast(PyObject *o, Py_ssize_t i, + int wraparound, int boundscheck, int unsafe_shared) { + CYTHON_MAYBE_UNUSED_VAR(unsafe_shared); +#if CYTHON_ASSUME_SAFE_SIZE && CYTHON_ASSUME_SAFE_MACROS && !CYTHON_AVOID_BORROWED_REFS + Py_ssize_t wrapped_i = i; + if (wraparound & unlikely(i < 0)) { + wrapped_i += PyTuple_GET_SIZE(o); + } + if ((!boundscheck) || likely(__Pyx_is_valid_index(wrapped_i, PyTuple_GET_SIZE(o)))) { + return __Pyx_NewRef(PyTuple_GET_ITEM(o, wrapped_i)); + } + return __Pyx_GetItemInt_Generic(o, PyLong_FromSsize_t(i)); +#else + (void)wraparound; + (void)boundscheck; + return PySequence_GetItem(o, i); +#endif +} +static CYTHON_INLINE PyObject *__Pyx_GetItemInt_Fast(PyObject *o, Py_ssize_t i, int is_list, + int wraparound, int boundscheck, int unsafe_shared) { + CYTHON_MAYBE_UNUSED_VAR(unsafe_shared); +#if CYTHON_ASSUME_SAFE_MACROS && CYTHON_ASSUME_SAFE_SIZE + if (is_list || PyList_CheckExact(o)) { + Py_ssize_t n = ((!wraparound) | likely(i >= 0)) ? i : i + PyList_GET_SIZE(o); + if ((CYTHON_AVOID_BORROWED_REFS || CYTHON_AVOID_THREAD_UNSAFE_BORROWED_REFS)) { + return __Pyx_PyList_GetItemRefFast(o, n, unsafe_shared); + } else if ((!boundscheck) || (likely(__Pyx_is_valid_index(n, PyList_GET_SIZE(o))))) { + return __Pyx_NewRef(PyList_GET_ITEM(o, n)); + } + } else + #if !CYTHON_AVOID_BORROWED_REFS + if (PyTuple_CheckExact(o)) { + Py_ssize_t n = ((!wraparound) | likely(i >= 0)) ? i : i + PyTuple_GET_SIZE(o); + if ((!boundscheck) || likely(__Pyx_is_valid_index(n, PyTuple_GET_SIZE(o)))) { + return __Pyx_NewRef(PyTuple_GET_ITEM(o, n)); + } + } else + #endif +#endif +#if CYTHON_USE_TYPE_SLOTS && !CYTHON_COMPILING_IN_PYPY + { + PyMappingMethods *mm = Py_TYPE(o)->tp_as_mapping; + PySequenceMethods *sm = Py_TYPE(o)->tp_as_sequence; + if (!is_list && mm && mm->mp_subscript) { + PyObject *r, *key = PyLong_FromSsize_t(i); + if (unlikely(!key)) return NULL; + r = mm->mp_subscript(o, key); + Py_DECREF(key); + return r; + } + if (is_list || likely(sm && sm->sq_item)) { + if (wraparound && unlikely(i < 0) && likely(sm->sq_length)) { + Py_ssize_t l = sm->sq_length(o); + if (likely(l >= 0)) { + i += l; + } else { + if (!PyErr_ExceptionMatches(PyExc_OverflowError)) + return NULL; + PyErr_Clear(); + } + } + return sm->sq_item(o, i); + } + } +#else + if (is_list || !PyMapping_Check(o)) { + return PySequence_GetItem(o, i); + } +#endif + (void)wraparound; + (void)boundscheck; + return __Pyx_GetItemInt_Generic(o, PyLong_FromSsize_t(i)); +} + +/* ObjectGetItem */ +#if CYTHON_USE_TYPE_SLOTS +static PyObject *__Pyx_PyObject_GetIndex(PyObject *obj, PyObject *index) { + PyObject *runerr = NULL; + Py_ssize_t key_value; + key_value = __Pyx_PyIndex_AsSsize_t(index); + if (likely(key_value != -1 || !(runerr = PyErr_Occurred()))) { + return __Pyx_GetItemInt_Fast(obj, key_value, 0, 1, 1, 1); + } + if (PyErr_GivenExceptionMatches(runerr, PyExc_OverflowError)) { + __Pyx_TypeName index_type_name = __Pyx_PyType_GetFullyQualifiedName(Py_TYPE(index)); + PyErr_Clear(); + PyErr_Format(PyExc_IndexError, + "cannot fit '" __Pyx_FMT_TYPENAME "' into an index-sized integer", index_type_name); + __Pyx_DECREF_TypeName(index_type_name); + } + return NULL; +} +static PyObject *__Pyx_PyObject_GetItem_Slow(PyObject *obj, PyObject *key) { + __Pyx_TypeName obj_type_name; + if (likely(PyType_Check(obj))) { + PyObject *meth = __Pyx_PyObject_GetAttrStrNoError(obj, __pyx_mstate_global->__pyx_n_u_class_getitem); + if (!meth) { + PyErr_Clear(); + } else { + PyObject *result = __Pyx_PyObject_CallOneArg(meth, key); + Py_DECREF(meth); + return result; + } + } + obj_type_name = __Pyx_PyType_GetFullyQualifiedName(Py_TYPE(obj)); + PyErr_Format(PyExc_TypeError, + "'" __Pyx_FMT_TYPENAME "' object is not subscriptable", obj_type_name); + __Pyx_DECREF_TypeName(obj_type_name); + return NULL; +} +static PyObject *__Pyx_PyObject_GetItem(PyObject *obj, PyObject *key) { + PyTypeObject *tp = Py_TYPE(obj); + PyMappingMethods *mm = tp->tp_as_mapping; + PySequenceMethods *sm = tp->tp_as_sequence; + if (likely(mm && mm->mp_subscript)) { + return mm->mp_subscript(obj, key); + } + if (likely(sm && sm->sq_item)) { + return __Pyx_PyObject_GetIndex(obj, key); + } + return __Pyx_PyObject_GetItem_Slow(obj, key); +} +#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); + } +} + +/* DivInt[Py_ssize_t] */ +static CYTHON_INLINE Py_ssize_t __Pyx_div_Py_ssize_t(Py_ssize_t a, Py_ssize_t b, int b_is_constant) { + Py_ssize_t q = a / b; + Py_ssize_t r = a - q*b; + Py_ssize_t adapt_python = (b_is_constant ? + ((r != 0) & ((r < 0) ^ (b < 0))) : + ((r != 0) & ((r ^ b) < 0)) + ); + return q - adapt_python; +} + +/* GetAttr3 */ +#if __PYX_LIMITED_VERSION_HEX < 0x030d0000 +static PyObject *__Pyx_GetAttr3Default(PyObject *d) { + __Pyx_PyThreadState_declare + __Pyx_PyThreadState_assign + if (unlikely(!__Pyx_PyErr_ExceptionMatches(PyExc_AttributeError))) + return NULL; + __Pyx_PyErr_Clear(); + Py_INCREF(d); + return d; +} +#endif +static CYTHON_INLINE PyObject *__Pyx_GetAttr3(PyObject *o, PyObject *n, PyObject *d) { + PyObject *r; +#if __PYX_LIMITED_VERSION_HEX >= 0x030d0000 + int res = PyObject_GetOptionalAttr(o, n, &r); + return (res != 0) ? r : __Pyx_NewRef(d); +#else + #if CYTHON_USE_TYPE_SLOTS + if (likely(PyUnicode_Check(n))) { + r = __Pyx_PyObject_GetAttrStrNoError(o, n); + if (unlikely(!r) && likely(!PyErr_Occurred())) { + r = __Pyx_NewRef(d); + } + return r; + } + #endif + r = PyObject_GetAttr(o, n); + return (likely(r)) ? r : __Pyx_GetAttr3Default(d); +#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); +} + +/* RaiseTooManyValuesToUnpack */ +static CYTHON_INLINE void __Pyx_RaiseTooManyValuesError(Py_ssize_t expected) { + PyErr_Format(PyExc_ValueError, + "too many values to unpack (expected %" CYTHON_FORMAT_SSIZE_T "d)", expected); +} + +/* RaiseNeedMoreValuesToUnpack */ +static CYTHON_INLINE void __Pyx_RaiseNeedMoreValuesError(Py_ssize_t index) { + PyErr_Format(PyExc_ValueError, + "need more than %" CYTHON_FORMAT_SSIZE_T "d value%.1s to unpack", + index, (index == 1) ? "" : "s"); +} + +/* RaiseNoneIterError */ +static CYTHON_INLINE void __Pyx_RaiseNoneNotIterableError(void) { + PyErr_SetString(PyExc_TypeError, "'NoneType' object is not iterable"); +} + +/* ExtTypeTest */ +static CYTHON_INLINE int __Pyx_TypeTest(PyObject *obj, PyTypeObject *type) { + __Pyx_TypeName obj_type_name; + __Pyx_TypeName type_name; + if (unlikely(!type)) { + PyErr_SetString(PyExc_SystemError, "Missing type object"); + return 0; + } + if (likely(__Pyx_TypeCheck(obj, type))) + return 1; + obj_type_name = __Pyx_PyType_GetFullyQualifiedName(Py_TYPE(obj)); + type_name = __Pyx_PyType_GetFullyQualifiedName(type); + PyErr_Format(PyExc_TypeError, + "Cannot convert " __Pyx_FMT_TYPENAME " to " __Pyx_FMT_TYPENAME, + obj_type_name, type_name); + __Pyx_DECREF_TypeName(obj_type_name); + __Pyx_DECREF_TypeName(type_name); + return 0; +} + +/* 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 + +/* 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); +} + +/* 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; itp_as_sequence && type->tp_as_sequence->sq_repeat)) { + return type->tp_as_sequence->sq_repeat(seq, mul); + } else +#endif + { + return __Pyx_PySequence_Multiply_Generic(seq, mul); + } +} + +/* PyObjectFormatAndDecref */ +static CYTHON_INLINE PyObject* __Pyx_PyObject_FormatSimpleAndDecref(PyObject* s, PyObject* f) { + if (unlikely(!s)) return NULL; + if (likely(PyUnicode_CheckExact(s))) return s; + return __Pyx_PyObject_FormatAndDecref(s, f); +} +static CYTHON_INLINE PyObject* __Pyx_PyObject_FormatAndDecref(PyObject* s, PyObject* f) { + PyObject *result; + if (unlikely(!s)) return NULL; + result = PyObject_Format(s, f); + Py_DECREF(s); + return result; +} + +/* PyObjectFormat */ +#if CYTHON_USE_UNICODE_WRITER +static PyObject* __Pyx_PyObject_Format(PyObject* obj, PyObject* format_spec) { + int ret; + _PyUnicodeWriter writer; + if (likely(PyFloat_CheckExact(obj))) { + _PyUnicodeWriter_Init(&writer); + ret = _PyFloat_FormatAdvancedWriter( + &writer, + obj, + format_spec, 0, PyUnicode_GET_LENGTH(format_spec)); + } else if (likely(PyLong_CheckExact(obj))) { + _PyUnicodeWriter_Init(&writer); + ret = _PyLong_FormatAdvancedWriter( + &writer, + obj, + format_spec, 0, PyUnicode_GET_LENGTH(format_spec)); + } else { + return PyObject_Format(obj, format_spec); + } + if (unlikely(ret == -1)) { + _PyUnicodeWriter_Dealloc(&writer); + return NULL; + } + return _PyUnicodeWriter_Finish(&writer); +} +#endif + +/* SetItemInt */ +static int __Pyx_SetItemInt_Generic(PyObject *o, PyObject *j, PyObject *v) { + int r; + if (unlikely(!j)) return -1; + r = PyObject_SetItem(o, j, v); + Py_DECREF(j); + return r; +} +static CYTHON_INLINE int __Pyx_SetItemInt_Fast(PyObject *o, Py_ssize_t i, PyObject *v, int is_list, + int wraparound, int boundscheck, int unsafe_shared) { + CYTHON_MAYBE_UNUSED_VAR(unsafe_shared); +#if CYTHON_ASSUME_SAFE_MACROS && CYTHON_ASSUME_SAFE_SIZE && !CYTHON_AVOID_BORROWED_REFS + if (is_list || PyList_CheckExact(o)) { + Py_ssize_t n = (!wraparound) ? i : ((likely(i >= 0)) ? i : i + PyList_GET_SIZE(o)); + if ((CYTHON_AVOID_THREAD_UNSAFE_BORROWED_REFS && !__Pyx_IS_UNIQUELY_REFERENCED(o, unsafe_shared))) { + Py_INCREF(v); + return PyList_SetItem(o, n, v); + } else if ((!boundscheck) || likely(__Pyx_is_valid_index(n, PyList_GET_SIZE(o)))) { + PyObject* old; + Py_INCREF(v); + old = PyList_GET_ITEM(o, n); + PyList_SET_ITEM(o, n, v); + Py_DECREF(old); + return 0; + } + } else +#endif +#if CYTHON_USE_TYPE_SLOTS && !CYTHON_COMPILING_IN_PYPY + { + PyMappingMethods *mm = Py_TYPE(o)->tp_as_mapping; + PySequenceMethods *sm = Py_TYPE(o)->tp_as_sequence; + if (!is_list && mm && mm->mp_ass_subscript) { + int r; + PyObject *key = PyLong_FromSsize_t(i); + if (unlikely(!key)) return -1; + r = mm->mp_ass_subscript(o, key, v); + Py_DECREF(key); + return r; + } + if (is_list || likely(sm && sm->sq_ass_item)) { + if (wraparound && unlikely(i < 0) && likely(sm->sq_length)) { + Py_ssize_t l = sm->sq_length(o); + if (likely(l >= 0)) { + i += l; + } else { + if (!PyErr_ExceptionMatches(PyExc_OverflowError)) + return -1; + PyErr_Clear(); + } + } + return sm->sq_ass_item(o, i, v); + } + } +#else + if (is_list || !PyMapping_Check(o)) { + return PySequence_SetItem(o, i, v); + } +#endif + (void)wraparound; + (void)boundscheck; + return __Pyx_SetItemInt_Generic(o, PyLong_FromSsize_t(i), v); +} + +/* RaiseUnboundLocalError */ +static void __Pyx_RaiseUnboundLocalError(const char *varname) { + PyErr_Format(PyExc_UnboundLocalError, "local variable '%s' referenced before assignment", varname); +} + +/* DivInt[long] */ +static CYTHON_INLINE long __Pyx_div_long(long a, long b, int b_is_constant) { + long q = a / b; + long r = a - q*b; + long adapt_python = (b_is_constant ? + ((r != 0) & ((r < 0) ^ (b < 0))) : + ((r != 0) & ((r ^ b) < 0)) + ); + return q - adapt_python; +} + +/* tp_new */ +#if CYTHON_COMPILING_IN_LIMITED_API && __PYX_LIMITED_VERSION_HEX < 0x030A0000 +static PyObject* __Pyx_tp_new_fallback(PyObject* type_obj, PyObject* args, PyObject* kwargs) { + PyObject *new_func = NULL, *new_args = NULL, *obj; + Py_ssize_t i, nargs = PyTuple_Size(args); + if (unlikely(nargs < 0)) goto bad; + new_args = PyTuple_New(nargs + 1); + if (unlikely(!new_args)) goto bad; + for (i = 0; i < nargs + 1; i++) { + PyObject *item = (i == 0) ? type_obj : PyTuple_GetItem(args, i - 1); + if (unlikely(!item)) goto bad; + Py_INCREF(item); + if (unlikely(PyTuple_SetItem(new_args, i, item)) < 0) goto bad; + } + new_func = PyObject_GetAttrString(type_obj, "__new__"); + if (unlikely(!new_func)) goto bad; + obj = PyObject_Call(new_func, new_args, kwargs); + Py_DECREF(new_func); + Py_DECREF(new_args); + return obj; + bad: + Py_XDECREF(new_func); + Py_XDECREF(new_args); + return NULL; +} +#endif +static PyObject* __Pyx_tp_new_kwargs(PyObject* type_obj, PyObject* args, PyObject* kwargs) { + newfunc tp_new = __Pyx_PyType_TryGetSlot((PyTypeObject*)type_obj, tp_new, newfunc); +#if CYTHON_COMPILING_IN_LIMITED_API && __PYX_LIMITED_VERSION_HEX < 0x030A0000 + if (!tp_new) return __Pyx_tp_new_fallback(type_obj, args, kwargs); +#else + assert(tp_new != NULL); +#endif + return tp_new((PyTypeObject*)type_obj, args, kwargs); +} + +/* 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); +} + +/* 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; + if (__Pyx_PyTuple_SET_ITEM(builder, n, key) != (0)) return -1; + Py_INCREF(key); + 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 + +/* IterFinish */ +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; +} + +/* UnpackItemEndCheck */ +static int __Pyx_IternextUnpackEndCheck(PyObject *retval, Py_ssize_t expected) { + if (unlikely(retval)) { + Py_DECREF(retval); + __Pyx_RaiseTooManyValuesError(expected); + return -1; + } + return __Pyx_IterFinish(); +} + +/* 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 + +/* PyObjectCallNoArg (used by pyfrozenset_new) */ +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); +} + +/* 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)); +} + +/* KeywordStringCheck */ +static int __Pyx_CheckKeywordStrings( + const char* function_name, + PyObject *kw) +{ +#if CYTHON_COMPILING_IN_PYPY && !defined(PyArg_ValidateKeywordArguments) + CYTHON_UNUSED_VAR(function_name); + CYTHON_UNUSED_VAR(kw); + return 0; +#else + if (CYTHON_METH_FASTCALL && likely(PyTuple_Check(kw))) { +#if PY_VERSION_HEX >= 0x03090000 + CYTHON_UNUSED_VAR(function_name); +#else + Py_ssize_t kwsize; + #if CYTHON_ASSUME_SAFE_SIZE + kwsize = PyTuple_GET_SIZE(kw); + #else + kwsize = PyTuple_Size(kw); + if (unlikely(kwsize < 0)) return -1; + #endif + for (Py_ssize_t pos = 0; pos < kwsize; pos++) { + PyObject* key = NULL; + #if CYTHON_ASSUME_SAFE_MACROS + key = PyTuple_GET_ITEM(kw, pos); + #else + key = PyTuple_GetItem(kw, pos); + if (unlikely(!key)) return -1; + #endif + if (unlikely(!PyUnicode_Check(key))) { + PyErr_Format(PyExc_TypeError, + "%.200s() keywords must be strings", function_name); + return -1; + } + } +#endif + } else { + if (unlikely(!PyArg_ValidateKeywordArguments(kw))) return -1; + } + return 0; +#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 + +/* PyObjectCall2Args (used by CallUnboundCMethod1) */ +static CYTHON_INLINE PyObject* __Pyx_PyObject_Call2Args(PyObject* function, PyObject* arg1, PyObject* arg2) { + PyObject *args[3] = {NULL, arg1, arg2}; + return __Pyx_PyObject_FastCall(function, args+1, 2 | __Pyx_PY_VECTORCALL_ARGUMENTS_OFFSET); +} + +/* CallUnboundCMethod1 */ +#if CYTHON_COMPILING_IN_CPYTHON +static CYTHON_INLINE PyObject* __Pyx_CallUnboundCMethod1(__Pyx_CachedCFunction* cfunc, PyObject* self, PyObject* arg) { + int was_initialized = __Pyx_CachedCFunction_GetAndSetInitializing(cfunc); + if (likely(was_initialized == 2 && cfunc->func)) { + int flag = cfunc->flag; + if (flag == METH_O) { + return __Pyx_CallCFunction(cfunc, self, arg); + } else if (flag == METH_FASTCALL) { + return __Pyx_CallCFunctionFast(cfunc, self, &arg, 1); + } else if (flag == (METH_FASTCALL | METH_KEYWORDS)) { + return __Pyx_CallCFunctionFastWithKeywords(cfunc, self, &arg, 1, 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__CallUnboundCMethod1(&tmp_cfunc, self, arg); + } +#endif + PyObject* result = __Pyx__CallUnboundCMethod1(cfunc, self, arg); + __Pyx_CachedCFunction_SetFinishedInitializing(cfunc); + return result; +} +#endif +static PyObject* __Pyx__CallUnboundCMethod1(__Pyx_CachedCFunction* cfunc, PyObject* self, PyObject* arg){ + PyObject *result = NULL; + if (unlikely(!cfunc->func && !cfunc->method) && unlikely(__Pyx_TryUnpackUnboundCMethod(cfunc) < 0)) return NULL; +#if CYTHON_COMPILING_IN_CPYTHON + if (cfunc->func && (cfunc->flag & METH_VARARGS)) { + PyObject *args = PyTuple_New(1); + if (unlikely(!args)) return NULL; + Py_INCREF(arg); + PyTuple_SET_ITEM(args, 0, arg); + if (cfunc->flag & METH_KEYWORDS) + result = __Pyx_CallCFunctionWithKeywords(cfunc, self, args, NULL); + else + result = __Pyx_CallCFunction(cfunc, self, args); + Py_DECREF(args); + } else +#endif + { + result = __Pyx_PyObject_Call2Args(cfunc->method, self, arg); + } + return result; +} + +/* dict_getitem_default */ +static PyObject* __Pyx_PyDict_GetItemDefault(PyObject* d, PyObject* key, PyObject* default_value) { + PyObject* value; +#if !CYTHON_COMPILING_IN_PYPY || PYPY_VERSION_NUM >= 0x07020000 + value = PyDict_GetItemWithError(d, key); + if (unlikely(!value)) { + if (unlikely(PyErr_Occurred())) + return NULL; + value = default_value; + } + Py_INCREF(value); + if ((1)); +#else + if (PyBytes_CheckExact(key) || PyUnicode_CheckExact(key) || PyLong_CheckExact(key)) { + value = PyDict_GetItem(d, key); + if (unlikely(!value)) { + value = default_value; + } + Py_INCREF(value); + } +#endif + else { + if (default_value == Py_None) + value = __Pyx_CallUnboundCMethod1(&__pyx_mstate_global->__pyx_umethod_PyDict_Type_get, d, key); + else + value = __Pyx_CallUnboundCMethod2(&__pyx_mstate_global->__pyx_umethod_PyDict_Type_get, d, key, default_value); + } + return value; +} + +/* PyLongBinop */ +#if !CYTHON_COMPILING_IN_PYPY +static PyObject* __Pyx_Fallback___Pyx_PyLong_SubtractObjC(PyObject *op1, PyObject *op2, int inplace) { + return (inplace ? PyNumber_InPlaceSubtract : PyNumber_Subtract)(op1, op2); +} +#if CYTHON_USE_PYLONG_INTERNALS +static PyObject* __Pyx_Unpacked___Pyx_PyLong_SubtractObjC(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 PyLong_FromLong(-intval); + } + 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_subtract(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_SubtractObjC(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_SubtractObjC(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_SubtractObjC(op1, op2, intval, inplace, zerodivision_check); + } + #endif + if (PyFloat_CheckExact(op1)) { + return __Pyx_Float___Pyx_PyLong_SubtractObjC(op1, intval, zerodivision_check); + } + return __Pyx_Fallback___Pyx_PyLong_SubtractObjC(op1, op2, inplace); +} +#endif + +/* SliceObject */ +static CYTHON_INLINE PyObject* __Pyx_PyObject_GetSlice(PyObject* obj, + Py_ssize_t cstart, Py_ssize_t cstop, + PyObject** _py_start, PyObject** _py_stop, PyObject** _py_slice, + int has_cstart, int has_cstop, CYTHON_UNUSED int wraparound) { + __Pyx_TypeName obj_type_name; +#if CYTHON_USE_TYPE_SLOTS + PyMappingMethods* mp = Py_TYPE(obj)->tp_as_mapping; + if (likely(mp && mp->mp_subscript)) +#endif + { + PyObject* result; + PyObject *py_slice, *py_start, *py_stop; + if (_py_slice) { + py_slice = *_py_slice; + } else { + PyObject* owned_start = NULL; + PyObject* owned_stop = NULL; + if (_py_start) { + py_start = *_py_start; + } else { + if (has_cstart) { + owned_start = py_start = PyLong_FromSsize_t(cstart); + if (unlikely(!py_start)) goto bad; + } else + py_start = Py_None; + } + if (_py_stop) { + py_stop = *_py_stop; + } else { + if (has_cstop) { + owned_stop = py_stop = PyLong_FromSsize_t(cstop); + if (unlikely(!py_stop)) { + Py_XDECREF(owned_start); + goto bad; + } + } else + py_stop = Py_None; + } + py_slice = PySlice_New(py_start, py_stop, Py_None); + Py_XDECREF(owned_start); + Py_XDECREF(owned_stop); + if (unlikely(!py_slice)) goto bad; + } +#if CYTHON_USE_TYPE_SLOTS + result = mp->mp_subscript(obj, py_slice); +#else + result = PyObject_GetItem(obj, py_slice); +#endif + if (!_py_slice) { + Py_DECREF(py_slice); + } + return result; + } + obj_type_name = __Pyx_PyType_GetFullyQualifiedName(Py_TYPE(obj)); + PyErr_Format(PyExc_TypeError, + "'" __Pyx_FMT_TYPENAME "' object is unsliceable", obj_type_name); + __Pyx_DECREF_TypeName(obj_type_name); +bad: + return NULL; +} + +/* PyLongCompare */ +static CYTHON_INLINE int __Pyx_PyLong_BoolNeObjC(PyObject *op1, PyObject *op2, long intval, long inplace) { + CYTHON_MAYBE_UNUSED_VAR(intval); + CYTHON_UNUSED_VAR(inplace); + if (op1 == op2) { + return 0; + } + #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 1; + intval = -intval; + } else { + if (__Pyx_PyLong_IsNeg(op1)) + return 1; + } + 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_NE)); +} + +/* CallNextTpDealloc */ +static void __Pyx_call_next_tp_dealloc(PyObject* obj, destructor current_tp_dealloc) { + PyTypeObject* type = Py_TYPE(obj); + destructor tp_dealloc = NULL; + while (type && __Pyx_PyType_GetSlot(type, tp_dealloc, destructor) != current_tp_dealloc) + type = __Pyx_PyType_GetSlot(type, tp_base, PyTypeObject*); + while (type && (tp_dealloc = __Pyx_PyType_GetSlot(type, tp_dealloc, destructor)) == current_tp_dealloc) + type = __Pyx_PyType_GetSlot(type, tp_base, PyTypeObject*); + if (type) + tp_dealloc(obj); +} + +/* CallNextTpTraverse */ +static int __Pyx_call_next_tp_traverse(PyObject* obj, visitproc v, void *a, traverseproc current_tp_traverse) { + PyTypeObject* type = Py_TYPE(obj); + traverseproc tp_traverse = NULL; + while (type && __Pyx_PyType_GetSlot(type, tp_traverse, traverseproc) != current_tp_traverse) + type = __Pyx_PyType_GetSlot(type, tp_base, PyTypeObject*); + while (type && (tp_traverse = __Pyx_PyType_GetSlot(type, tp_traverse, traverseproc)) == current_tp_traverse) + type = __Pyx_PyType_GetSlot(type, tp_base, PyTypeObject*); + if (type && tp_traverse) + return tp_traverse(obj, v, a); + return 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 + +/* CallNextTpClear */ +static void __Pyx_call_next_tp_clear(PyObject* obj, inquiry current_tp_clear) { + PyTypeObject* type = Py_TYPE(obj); + inquiry tp_clear = NULL; + while (type && __Pyx_PyType_GetSlot(type, tp_clear, inquiry) != current_tp_clear) + type = __Pyx_PyType_GetSlot(type, tp_base, PyTypeObject*); + while (type && (tp_clear = __Pyx_PyType_GetSlot(type, tp_clear, inquiry)) == current_tp_clear) + type = __Pyx_PyType_GetSlot(type, tp_base, PyTypeObject*); + if (type && tp_clear) + tp_clear(obj); +} + +/* 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); + } +} + +/* TypeImport */ +#ifndef __PYX_HAVE_RT_ImportType_3_2_1 +#define __PYX_HAVE_RT_ImportType_3_2_1 +static PyTypeObject *__Pyx_ImportType_3_2_1(PyObject *module, const char *module_name, const char *class_name, + size_t size, size_t alignment, enum __Pyx_ImportType_CheckSize_3_2_1 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_1 && + ((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_1 && (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 + +/* GetVTable */ +static void* __Pyx_GetVtable(PyTypeObject *type) { + void* ptr; +#if CYTHON_COMPILING_IN_LIMITED_API + PyObject *ob = PyObject_GetAttr((PyObject *)type, __pyx_mstate_global->__pyx_n_u_pyx_vtable); +#else + PyObject *ob = PyObject_GetItem(type->tp_dict, __pyx_mstate_global->__pyx_n_u_pyx_vtable); +#endif + if (!ob) + goto bad; + ptr = PyCapsule_GetPointer(ob, 0); + if (!ptr && !PyErr_Occurred()) + PyErr_SetString(PyExc_RuntimeError, "invalid vtable found for imported type"); + Py_DECREF(ob); + return ptr; +bad: + Py_XDECREF(ob); + return NULL; +} + +/* 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; +} + +/* 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 +} + +/* SetVTable */ +static int __Pyx_SetVtable(PyTypeObject *type, void *vtable) { + PyObject *ob = PyCapsule_New(vtable, 0, 0); + if (unlikely(!ob)) + goto bad; +#if CYTHON_COMPILING_IN_LIMITED_API + if (unlikely(PyObject_SetAttr((PyObject *) type, __pyx_mstate_global->__pyx_n_u_pyx_vtable, ob) < 0)) +#else + if (unlikely(PyDict_SetItem(type->tp_dict, __pyx_mstate_global->__pyx_n_u_pyx_vtable, ob) < 0)) +#endif + goto bad; + Py_DECREF(ob); + return 0; +bad: + Py_XDECREF(ob); + return -1; +} + +/* MergeVTables */ +static int __Pyx_MergeVtables(PyTypeObject *type) { + int i=0; + Py_ssize_t size; + void** base_vtables; + __Pyx_TypeName tp_base_name = NULL; + __Pyx_TypeName base_name = NULL; + void* unknown = (void*)-1; + PyObject* bases = __Pyx_PyType_GetSlot(type, tp_bases, PyObject*); + int base_depth = 0; + { + PyTypeObject* base = __Pyx_PyType_GetSlot(type, tp_base, PyTypeObject*); + while (base) { + base_depth += 1; + base = __Pyx_PyType_GetSlot(base, tp_base, PyTypeObject*); + } + } + base_vtables = (void**) PyMem_Malloc(sizeof(void*) * (size_t)(base_depth + 1)); + base_vtables[0] = unknown; +#if CYTHON_COMPILING_IN_LIMITED_API + size = PyTuple_Size(bases); + if (size < 0) goto other_failure; +#else + size = PyTuple_GET_SIZE(bases); +#endif + for (i = 1; i < size; i++) { + PyObject *basei; + void* base_vtable; +#if CYTHON_AVOID_BORROWED_REFS + basei = PySequence_GetItem(bases, i); + if (unlikely(!basei)) goto other_failure; +#elif !CYTHON_ASSUME_SAFE_MACROS + basei = PyTuple_GetItem(bases, i); + if (unlikely(!basei)) goto other_failure; +#else + basei = PyTuple_GET_ITEM(bases, i); +#endif + base_vtable = __Pyx_GetVtable((PyTypeObject*)basei); +#if CYTHON_AVOID_BORROWED_REFS + Py_DECREF(basei); +#endif + if (base_vtable != NULL) { + int j; + PyTypeObject* base = __Pyx_PyType_GetSlot(type, tp_base, PyTypeObject*); + for (j = 0; j < base_depth; j++) { + if (base_vtables[j] == unknown) { + base_vtables[j] = __Pyx_GetVtable(base); + base_vtables[j + 1] = unknown; + } + if (base_vtables[j] == base_vtable) { + break; + } else if (base_vtables[j] == NULL) { + goto bad; + } + base = __Pyx_PyType_GetSlot(base, tp_base, PyTypeObject*); + } + } + } + PyErr_Clear(); + PyMem_Free(base_vtables); + return 0; +bad: + { + PyTypeObject* basei = NULL; + PyTypeObject* tp_base = __Pyx_PyType_GetSlot(type, tp_base, PyTypeObject*); + tp_base_name = __Pyx_PyType_GetFullyQualifiedName(tp_base); +#if CYTHON_AVOID_BORROWED_REFS + basei = (PyTypeObject*)PySequence_GetItem(bases, i); + if (unlikely(!basei)) goto really_bad; +#elif !CYTHON_ASSUME_SAFE_MACROS + basei = (PyTypeObject*)PyTuple_GetItem(bases, i); + if (unlikely(!basei)) goto really_bad; +#else + basei = (PyTypeObject*)PyTuple_GET_ITEM(bases, i); +#endif + base_name = __Pyx_PyType_GetFullyQualifiedName(basei); +#if CYTHON_AVOID_BORROWED_REFS + Py_DECREF(basei); +#endif + } + PyErr_Format(PyExc_TypeError, + "multiple bases have vtable conflict: '" __Pyx_FMT_TYPENAME "' and '" __Pyx_FMT_TYPENAME "'", tp_base_name, base_name); +#if CYTHON_AVOID_BORROWED_REFS || !CYTHON_ASSUME_SAFE_MACROS +really_bad: // bad has failed! +#endif + __Pyx_DECREF_TypeName(tp_base_name); + __Pyx_DECREF_TypeName(base_name); +#if CYTHON_COMPILING_IN_LIMITED_API || CYTHON_AVOID_BORROWED_REFS || !CYTHON_ASSUME_SAFE_MACROS +other_failure: +#endif + PyMem_Free(base_vtables); + return -1; +} + +/* 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_2); + if (likely(name_attr)) { + ret = PyObject_RichCompareBool(name_attr, name, Py_EQ); + } else { + ret = -1; + } + if (unlikely(ret < 0)) { + PyErr_Clear(); + ret = 0; + } + Py_XDECREF(name_attr); + return ret; +} +static int __Pyx_setup_reduce(PyObject* type_obj) { + int ret = 0; + PyObject *object_reduce = NULL; + PyObject *object_getstate = NULL; + PyObject *object_reduce_ex = NULL; + PyObject *reduce = NULL; + PyObject *reduce_ex = NULL; + PyObject *reduce_cython = NULL; + PyObject *setstate = NULL; + PyObject *setstate_cython = NULL; + PyObject *getstate = NULL; +#if CYTHON_USE_PYTYPE_LOOKUP + getstate = _PyType_Lookup((PyTypeObject*)type_obj, __pyx_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 VoidPtrImport) */ +#ifndef __PYX_HAVE_RT_ImportFromPxd_3_2_1 +#define __PYX_HAVE_RT_ImportFromPxd_3_2_1 +static int __Pyx_ImportFromPxd_3_2_1(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 + +/* VoidPtrImport */ +#ifndef __PYX_HAVE_RT_ImportVoidPtr_3_2_1 +#define __PYX_HAVE_RT_ImportVoidPtr_3_2_1 +static int __Pyx_ImportVoidPtr_3_2_1(PyObject *module, const char *name, void **p, const char *sig) { + return __Pyx_ImportFromPxd_3_2_1(module, name, p, sig, "variable"); +} +#endif + +/* FunctionImport */ +#ifndef __PYX_HAVE_RT_ImportFunction_3_2_1 +#define __PYX_HAVE_RT_ImportFunction_3_2_1 +static int __Pyx_ImportFunction_3_2_1(PyObject *module, const char *funcname, void (**f)(void), const char *sig) { + union { + void (*fp)(void); + void *p; + } tmp; + int result = __Pyx_ImportFromPxd_3_2_1(module, funcname, &tmp.p, sig, "function"); + if (result == 0) { + *f = tmp.fp; + } + return result; +} +#endif + +/* 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__2); + 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 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); +#elif PY_VERSION_HEX >= 0x030d0000 + PyDict_SetDefaultRef(d, key, default_value, &value); +#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_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(marker); + 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}, + {"_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 !CYTHON_COMPILING_IN_LIMITED_API +#if PY_VERSION_HEX < 0x030900B1 + Py_CLEAR(__Pyx_CyFunction_GetClassObj(m)); +#else + { + PyObject *cls = (PyObject*) ((PyCMethodObject *) (m))->mm_class; + ((PyCMethodObject *) (m))->mm_class = NULL; + Py_XDECREF(cls); + } +#endif +#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); +#if !CYTHON_COMPILING_IN_LIMITED_API + Py_VISIT(__Pyx_CyFunction_GetClassObj(m)); +#endif + Py_VISIT(m->defaults_tuple); + Py_VISIT(m->defaults_kwdict); + 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; +} + +/* ClassMethod */ +static PyObject* __Pyx_Method_ClassMethod(PyObject *method) { +#if CYTHON_COMPILING_IN_PYPY && PYPY_VERSION_NUM <= 0x05080000 + if (PyObject_TypeCheck(method, &PyWrapperDescr_Type)) { + return PyClassMethod_New(method); + } +#else +#if CYTHON_COMPILING_IN_PYPY + if (PyMethodDescr_Check(method)) +#else + if (__Pyx_TypeCheck(method, &PyMethodDescr_Type)) +#endif + { +#if CYTHON_COMPILING_IN_LIMITED_API + return PyErr_Format( + PyExc_SystemError, + "Cython cannot yet handle classmethod on a MethodDescriptorType (%S) in limited API mode. " + "This is most likely a classmethod in a cdef class method with binding=False. " + "Try setting 'binding' to True.", + method); +#elif CYTHON_COMPILING_IN_GRAAL && defined(GRAALPY_VERSION_NUM) && GRAALPY_VERSION_NUM > 0x19000000 + PyTypeObject *d_type = GraalPyDescrObject_GetType(method); + return PyDescr_NewClassMethod(d_type, GraalPyMethodDescrObject_GetMethod(method)); +#elif CYTHON_COMPILING_IN_GRAAL + PyTypeObject *d_type = PyDescrObject_GetType(method); + return PyDescr_NewClassMethod(d_type, PyMethodDescrObject_GetMethod(method)); +#else + PyMethodDescrObject *descr = (PyMethodDescrObject *)method; + PyTypeObject *d_type = descr->d_common.d_type; + return PyDescr_NewClassMethod(d_type, descr->d_method); +#endif + } +#endif +#if !CYTHON_COMPILING_IN_LIMITED_API + else if (PyMethod_Check(method)) { + return PyClassMethod_New(PyMethod_GET_FUNCTION(method)); + } + else { + return PyClassMethod_New(method); + } +#else + { + PyObject *func=NULL; + PyObject *builtins, *classmethod, *classmethod_str, *result=NULL; + if (__Pyx_TypeCheck(method, __pyx_mstate_global->__Pyx_CachedMethodType)) { + func = PyObject_GetAttrString(method, "__func__"); + if (!func) goto bad; + } else { + func = method; + Py_INCREF(func); + } + builtins = PyEval_GetBuiltins(); // borrowed + if (unlikely(!builtins)) goto bad; + classmethod_str = PyUnicode_FromString("classmethod"); + if (unlikely(!classmethod_str)) goto bad; + classmethod = PyObject_GetItem(builtins, classmethod_str); + Py_DECREF(classmethod_str); + if (unlikely(!classmethod)) goto bad; + result = PyObject_CallFunctionObjArgs(classmethod, func, NULL); + Py_DECREF(classmethod); + bad: + Py_XDECREF(func); + return result; + } +#endif +} + +/* GetNameInClass */ +static PyObject *__Pyx__GetNameInClass(PyObject *nmspace, PyObject *name) { + PyObject *result; + PyObject *dict; + assert(PyType_Check(nmspace)); +#if CYTHON_USE_TYPE_SLOTS + dict = ((PyTypeObject*)nmspace)->tp_dict; + Py_XINCREF(dict); +#else + dict = PyObject_GetAttr(nmspace, __pyx_mstate_global->__pyx_n_u_dict); +#endif + if (likely(dict)) { + result = PyObject_GetItem(dict, name); + Py_DECREF(dict); + if (result) { + return result; + } + } + PyErr_Clear(); + __Pyx_GetModuleGlobalNameUncached(result, name); + return result; +} + +/* 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 + +/* CheckUnpickleChecksum */ +static void __Pyx_RaiseUnpickleChecksumError(long checksum, long checksum1, long checksum2, long checksum3, const char *members) { + PyObject *pickle_module = PyImport_ImportModule("pickle"); + if (unlikely(!pickle_module)) return; + PyObject *pickle_error = PyObject_GetAttrString(pickle_module, "PickleError"); + Py_DECREF(pickle_module); + if (unlikely(!pickle_error)) return; + if (checksum2 == checksum1) { + PyErr_Format(pickle_error, "Incompatible checksums (0x%x vs (0x%x) = (%s))", + checksum, checksum1, members); + } else if (checksum3 == checksum2) { + PyErr_Format(pickle_error, "Incompatible checksums (0x%x vs (0x%x, 0x%x) = (%s))", + checksum, checksum1, checksum2, members); + } else { + PyErr_Format(pickle_error, "Incompatible checksums (0x%x vs (0x%x, 0x%x, 0x%x) = (%s))", + checksum, checksum1, checksum2, checksum3, members); + } + Py_DECREF(pickle_error); +} +static int __Pyx_CheckUnpickleChecksum(long checksum, long checksum1, long checksum2, long checksum3, const char *members) { + int found = 0; + found |= checksum1 == checksum; + found |= checksum2 == checksum; + found |= checksum3 == checksum; + if (likely(found)) + return 0; + __Pyx_RaiseUnpickleChecksumError(checksum, checksum1, checksum2, checksum3, members); + return -1; +} + +/* 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;\ + } + +/* Declarations */ +#if CYTHON_CCOMPLEX && (1) && (!0 || __cplusplus) + #ifdef __cplusplus + static CYTHON_INLINE __pyx_t_float_complex __pyx_t_float_complex_from_parts(float x, float y) { + return ::std::complex< float >(x, y); + } + #else + static CYTHON_INLINE __pyx_t_float_complex __pyx_t_float_complex_from_parts(float x, float y) { + return x + y*(__pyx_t_float_complex)_Complex_I; + } + #endif +#else + static CYTHON_INLINE __pyx_t_float_complex __pyx_t_float_complex_from_parts(float x, float y) { + __pyx_t_float_complex z; + z.real = x; + z.imag = y; + return z; + } +#endif + +/* Arithmetic */ +#if CYTHON_CCOMPLEX && (1) && (!0 || __cplusplus) +#else + static CYTHON_INLINE int __Pyx_c_eq_float(__pyx_t_float_complex a, __pyx_t_float_complex b) { + return (a.real == b.real) && (a.imag == b.imag); + } + static CYTHON_INLINE __pyx_t_float_complex __Pyx_c_sum_float(__pyx_t_float_complex a, __pyx_t_float_complex b) { + __pyx_t_float_complex z; + z.real = a.real + b.real; + z.imag = a.imag + b.imag; + return z; + } + static CYTHON_INLINE __pyx_t_float_complex __Pyx_c_diff_float(__pyx_t_float_complex a, __pyx_t_float_complex b) { + __pyx_t_float_complex z; + z.real = a.real - b.real; + z.imag = a.imag - b.imag; + return z; + } + static CYTHON_INLINE __pyx_t_float_complex __Pyx_c_prod_float(__pyx_t_float_complex a, __pyx_t_float_complex b) { + __pyx_t_float_complex z; + z.real = a.real * b.real - a.imag * b.imag; + z.imag = a.real * b.imag + a.imag * b.real; + return z; + } + #if 1 + static CYTHON_INLINE __pyx_t_float_complex __Pyx_c_quot_float(__pyx_t_float_complex a, __pyx_t_float_complex b) { + if (b.imag == 0) { + return __pyx_t_float_complex_from_parts(a.real / b.real, a.imag / b.real); + } else if (fabsf(b.real) >= fabsf(b.imag)) { + if (b.real == 0 && b.imag == 0) { + return __pyx_t_float_complex_from_parts(a.real / b.real, a.imag / b.imag); + } else { + float r = b.imag / b.real; + float s = (float)(1.0) / (b.real + b.imag * r); + return __pyx_t_float_complex_from_parts( + (a.real + a.imag * r) * s, (a.imag - a.real * r) * s); + } + } else { + float r = b.real / b.imag; + float s = (float)(1.0) / (b.imag + b.real * r); + return __pyx_t_float_complex_from_parts( + (a.real * r + a.imag) * s, (a.imag * r - a.real) * s); + } + } + #else + static CYTHON_INLINE __pyx_t_float_complex __Pyx_c_quot_float(__pyx_t_float_complex a, __pyx_t_float_complex b) { + if (b.imag == 0) { + return __pyx_t_float_complex_from_parts(a.real / b.real, a.imag / b.real); + } else { + float denom = b.real * b.real + b.imag * b.imag; + return __pyx_t_float_complex_from_parts( + (a.real * b.real + a.imag * b.imag) / denom, + (a.imag * b.real - a.real * b.imag) / denom); + } + } + #endif + static CYTHON_INLINE __pyx_t_float_complex __Pyx_c_neg_float(__pyx_t_float_complex a) { + __pyx_t_float_complex z; + z.real = -a.real; + z.imag = -a.imag; + return z; + } + static CYTHON_INLINE int __Pyx_c_is_zero_float(__pyx_t_float_complex a) { + return (a.real == 0) && (a.imag == 0); + } + static CYTHON_INLINE __pyx_t_float_complex __Pyx_c_conj_float(__pyx_t_float_complex a) { + __pyx_t_float_complex z; + z.real = a.real; + z.imag = -a.imag; + return z; + } + #if 1 + static CYTHON_INLINE float __Pyx_c_abs_float(__pyx_t_float_complex z) { + #if !defined(HAVE_HYPOT) || defined(_MSC_VER) + return sqrtf(z.real*z.real + z.imag*z.imag); + #else + return hypotf(z.real, z.imag); + #endif + } + static CYTHON_INLINE __pyx_t_float_complex __Pyx_c_pow_float(__pyx_t_float_complex a, __pyx_t_float_complex b) { + __pyx_t_float_complex z; + float r, lnr, theta, z_r, z_theta; + if (b.imag == 0 && b.real == (int)b.real) { + if (b.real < 0) { + float denom = a.real * a.real + a.imag * a.imag; + a.real = a.real / denom; + a.imag = -a.imag / denom; + b.real = -b.real; + } + switch ((int)b.real) { + case 0: + z.real = 1; + z.imag = 0; + return z; + case 1: + return a; + case 2: + return __Pyx_c_prod_float(a, a); + case 3: + z = __Pyx_c_prod_float(a, a); + return __Pyx_c_prod_float(z, a); + case 4: + z = __Pyx_c_prod_float(a, a); + return __Pyx_c_prod_float(z, z); + } + } + if (a.imag == 0) { + if (a.real == 0) { + return a; + } else if ((b.imag == 0) && (a.real >= 0)) { + z.real = powf(a.real, b.real); + z.imag = 0; + return z; + } else if (a.real > 0) { + r = a.real; + theta = 0; + } else { + r = -a.real; + theta = atan2f(0.0, -1.0); + } + } else { + r = __Pyx_c_abs_float(a); + theta = atan2f(a.imag, a.real); + } + lnr = logf(r); + z_r = expf(lnr * b.real - theta * b.imag); + z_theta = theta * b.real + lnr * b.imag; + z.real = z_r * cosf(z_theta); + z.imag = z_r * sinf(z_theta); + return z; + } + #endif +#endif + +/* Declarations */ +#if CYTHON_CCOMPLEX && (1) && (!0 || __cplusplus) + #ifdef __cplusplus + static CYTHON_INLINE __pyx_t_double_complex __pyx_t_double_complex_from_parts(double x, double y) { + return ::std::complex< double >(x, y); + } + #else + static CYTHON_INLINE __pyx_t_double_complex __pyx_t_double_complex_from_parts(double x, double y) { + return x + y*(__pyx_t_double_complex)_Complex_I; + } + #endif +#else + static CYTHON_INLINE __pyx_t_double_complex __pyx_t_double_complex_from_parts(double x, double y) { + __pyx_t_double_complex z; + z.real = x; + z.imag = y; + return z; + } +#endif + +/* Arithmetic */ +#if CYTHON_CCOMPLEX && (1) && (!0 || __cplusplus) +#else + static CYTHON_INLINE int __Pyx_c_eq_double(__pyx_t_double_complex a, __pyx_t_double_complex b) { + return (a.real == b.real) && (a.imag == b.imag); + } + static CYTHON_INLINE __pyx_t_double_complex __Pyx_c_sum_double(__pyx_t_double_complex a, __pyx_t_double_complex b) { + __pyx_t_double_complex z; + z.real = a.real + b.real; + z.imag = a.imag + b.imag; + return z; + } + static CYTHON_INLINE __pyx_t_double_complex __Pyx_c_diff_double(__pyx_t_double_complex a, __pyx_t_double_complex b) { + __pyx_t_double_complex z; + z.real = a.real - b.real; + z.imag = a.imag - b.imag; + return z; + } + static CYTHON_INLINE __pyx_t_double_complex __Pyx_c_prod_double(__pyx_t_double_complex a, __pyx_t_double_complex b) { + __pyx_t_double_complex z; + z.real = a.real * b.real - a.imag * b.imag; + z.imag = a.real * b.imag + a.imag * b.real; + return z; + } + #if 1 + static CYTHON_INLINE __pyx_t_double_complex __Pyx_c_quot_double(__pyx_t_double_complex a, __pyx_t_double_complex b) { + if (b.imag == 0) { + return __pyx_t_double_complex_from_parts(a.real / b.real, a.imag / b.real); + } else if (fabs(b.real) >= fabs(b.imag)) { + if (b.real == 0 && b.imag == 0) { + return __pyx_t_double_complex_from_parts(a.real / b.real, a.imag / b.imag); + } else { + double r = b.imag / b.real; + double s = (double)(1.0) / (b.real + b.imag * r); + return __pyx_t_double_complex_from_parts( + (a.real + a.imag * r) * s, (a.imag - a.real * r) * s); + } + } else { + double r = b.real / b.imag; + double s = (double)(1.0) / (b.imag + b.real * r); + return __pyx_t_double_complex_from_parts( + (a.real * r + a.imag) * s, (a.imag * r - a.real) * s); + } + } + #else + static CYTHON_INLINE __pyx_t_double_complex __Pyx_c_quot_double(__pyx_t_double_complex a, __pyx_t_double_complex b) { + if (b.imag == 0) { + return __pyx_t_double_complex_from_parts(a.real / b.real, a.imag / b.real); + } else { + double denom = b.real * b.real + b.imag * b.imag; + return __pyx_t_double_complex_from_parts( + (a.real * b.real + a.imag * b.imag) / denom, + (a.imag * b.real - a.real * b.imag) / denom); + } + } + #endif + static CYTHON_INLINE __pyx_t_double_complex __Pyx_c_neg_double(__pyx_t_double_complex a) { + __pyx_t_double_complex z; + z.real = -a.real; + z.imag = -a.imag; + return z; + } + static CYTHON_INLINE int __Pyx_c_is_zero_double(__pyx_t_double_complex a) { + return (a.real == 0) && (a.imag == 0); + } + static CYTHON_INLINE __pyx_t_double_complex __Pyx_c_conj_double(__pyx_t_double_complex a) { + __pyx_t_double_complex z; + z.real = a.real; + z.imag = -a.imag; + return z; + } + #if 1 + static CYTHON_INLINE double __Pyx_c_abs_double(__pyx_t_double_complex z) { + #if !defined(HAVE_HYPOT) || defined(_MSC_VER) + return sqrt(z.real*z.real + z.imag*z.imag); + #else + return hypot(z.real, z.imag); + #endif + } + static CYTHON_INLINE __pyx_t_double_complex __Pyx_c_pow_double(__pyx_t_double_complex a, __pyx_t_double_complex b) { + __pyx_t_double_complex z; + double r, lnr, theta, z_r, z_theta; + if (b.imag == 0 && b.real == (int)b.real) { + if (b.real < 0) { + double denom = a.real * a.real + a.imag * a.imag; + a.real = a.real / denom; + a.imag = -a.imag / denom; + b.real = -b.real; + } + switch ((int)b.real) { + case 0: + z.real = 1; + z.imag = 0; + return z; + case 1: + return a; + case 2: + return __Pyx_c_prod_double(a, a); + case 3: + z = __Pyx_c_prod_double(a, a); + return __Pyx_c_prod_double(z, a); + case 4: + z = __Pyx_c_prod_double(a, a); + return __Pyx_c_prod_double(z, z); + } + } + if (a.imag == 0) { + if (a.real == 0) { + return a; + } else if ((b.imag == 0) && (a.real >= 0)) { + z.real = pow(a.real, b.real); + z.imag = 0; + return z; + } else if (a.real > 0) { + r = a.real; + theta = 0; + } else { + r = -a.real; + theta = atan2(0.0, -1.0); + } + } else { + r = __Pyx_c_abs_double(a); + theta = atan2(a.imag, a.real); + } + lnr = log(r); + z_r = exp(lnr * b.real - theta * b.imag); + z_theta = theta * b.real + lnr * b.imag; + z.real = z_r * cos(z_theta); + z.imag = z_r * sin(z_theta); + return z; + } + #endif +#endif + +/* Declarations */ +#if CYTHON_CCOMPLEX && (1) && (!0 || __cplusplus) + #ifdef __cplusplus + static CYTHON_INLINE __pyx_t_long_double_complex __pyx_t_long_double_complex_from_parts(long double x, long double y) { + return ::std::complex< long double >(x, y); + } + #else + static CYTHON_INLINE __pyx_t_long_double_complex __pyx_t_long_double_complex_from_parts(long double x, long double y) { + return x + y*(__pyx_t_long_double_complex)_Complex_I; + } + #endif +#else + static CYTHON_INLINE __pyx_t_long_double_complex __pyx_t_long_double_complex_from_parts(long double x, long double y) { + __pyx_t_long_double_complex z; + z.real = x; + z.imag = y; + return z; + } +#endif + +/* Arithmetic */ +#if CYTHON_CCOMPLEX && (1) && (!0 || __cplusplus) +#else + static CYTHON_INLINE int __Pyx_c_eq_long__double(__pyx_t_long_double_complex a, __pyx_t_long_double_complex b) { + return (a.real == b.real) && (a.imag == b.imag); + } + static CYTHON_INLINE __pyx_t_long_double_complex __Pyx_c_sum_long__double(__pyx_t_long_double_complex a, __pyx_t_long_double_complex b) { + __pyx_t_long_double_complex z; + z.real = a.real + b.real; + z.imag = a.imag + b.imag; + return z; + } + static CYTHON_INLINE __pyx_t_long_double_complex __Pyx_c_diff_long__double(__pyx_t_long_double_complex a, __pyx_t_long_double_complex b) { + __pyx_t_long_double_complex z; + z.real = a.real - b.real; + z.imag = a.imag - b.imag; + return z; + } + static CYTHON_INLINE __pyx_t_long_double_complex __Pyx_c_prod_long__double(__pyx_t_long_double_complex a, __pyx_t_long_double_complex b) { + __pyx_t_long_double_complex z; + z.real = a.real * b.real - a.imag * b.imag; + z.imag = a.real * b.imag + a.imag * b.real; + return z; + } + #if 1 + static CYTHON_INLINE __pyx_t_long_double_complex __Pyx_c_quot_long__double(__pyx_t_long_double_complex a, __pyx_t_long_double_complex b) { + if (b.imag == 0) { + return __pyx_t_long_double_complex_from_parts(a.real / b.real, a.imag / b.real); + } else if (fabsl(b.real) >= fabsl(b.imag)) { + if (b.real == 0 && b.imag == 0) { + return __pyx_t_long_double_complex_from_parts(a.real / b.real, a.imag / b.imag); + } else { + long double r = b.imag / b.real; + long double s = (long double)(1.0) / (b.real + b.imag * r); + return __pyx_t_long_double_complex_from_parts( + (a.real + a.imag * r) * s, (a.imag - a.real * r) * s); + } + } else { + long double r = b.real / b.imag; + long double s = (long double)(1.0) / (b.imag + b.real * r); + return __pyx_t_long_double_complex_from_parts( + (a.real * r + a.imag) * s, (a.imag * r - a.real) * s); + } + } + #else + static CYTHON_INLINE __pyx_t_long_double_complex __Pyx_c_quot_long__double(__pyx_t_long_double_complex a, __pyx_t_long_double_complex b) { + if (b.imag == 0) { + return __pyx_t_long_double_complex_from_parts(a.real / b.real, a.imag / b.real); + } else { + long double denom = b.real * b.real + b.imag * b.imag; + return __pyx_t_long_double_complex_from_parts( + (a.real * b.real + a.imag * b.imag) / denom, + (a.imag * b.real - a.real * b.imag) / denom); + } + } + #endif + static CYTHON_INLINE __pyx_t_long_double_complex __Pyx_c_neg_long__double(__pyx_t_long_double_complex a) { + __pyx_t_long_double_complex z; + z.real = -a.real; + z.imag = -a.imag; + return z; + } + static CYTHON_INLINE int __Pyx_c_is_zero_long__double(__pyx_t_long_double_complex a) { + return (a.real == 0) && (a.imag == 0); + } + static CYTHON_INLINE __pyx_t_long_double_complex __Pyx_c_conj_long__double(__pyx_t_long_double_complex a) { + __pyx_t_long_double_complex z; + z.real = a.real; + z.imag = -a.imag; + return z; + } + #if 1 + static CYTHON_INLINE long double __Pyx_c_abs_long__double(__pyx_t_long_double_complex z) { + #if !defined(HAVE_HYPOT) || defined(_MSC_VER) + return sqrtl(z.real*z.real + z.imag*z.imag); + #else + return hypotl(z.real, z.imag); + #endif + } + static CYTHON_INLINE __pyx_t_long_double_complex __Pyx_c_pow_long__double(__pyx_t_long_double_complex a, __pyx_t_long_double_complex b) { + __pyx_t_long_double_complex z; + long double r, lnr, theta, z_r, z_theta; + if (b.imag == 0 && b.real == (int)b.real) { + if (b.real < 0) { + long double denom = a.real * a.real + a.imag * a.imag; + a.real = a.real / denom; + a.imag = -a.imag / denom; + b.real = -b.real; + } + switch ((int)b.real) { + case 0: + z.real = 1; + z.imag = 0; + return z; + case 1: + return a; + case 2: + return __Pyx_c_prod_long__double(a, a); + case 3: + z = __Pyx_c_prod_long__double(a, a); + return __Pyx_c_prod_long__double(z, a); + case 4: + z = __Pyx_c_prod_long__double(a, a); + return __Pyx_c_prod_long__double(z, z); + } + } + if (a.imag == 0) { + if (a.real == 0) { + return a; + } else if ((b.imag == 0) && (a.real >= 0)) { + z.real = powl(a.real, b.real); + z.imag = 0; + return z; + } else if (a.real > 0) { + r = a.real; + theta = 0; + } else { + r = -a.real; + theta = atan2l(0.0, -1.0); + } + } else { + r = __Pyx_c_abs_long__double(a); + theta = atan2l(a.imag, a.real); + } + lnr = logl(r); + z_r = expl(lnr * b.real - theta * b.imag); + z_theta = theta * b.real + lnr * b.imag; + z.real = z_r * cosl(z_theta); + z.imag = z_r * sinl(z_theta); + return z; + } + #endif +#endif + +/* MemviewRefcount */ +#include +#ifndef _Py_NO_RETURN +#define _Py_NO_RETURN +#endif +_Py_NO_RETURN +static void __pyx_fatalerror(const char *fmt, ...) { + va_list vargs; + char msg[200]; +#if PY_VERSION_HEX >= 0x030A0000 || defined(HAVE_STDARG_PROTOTYPES) + va_start(vargs, fmt); +#else + va_start(vargs); +#endif + vsnprintf(msg, 200, fmt, vargs); + va_end(vargs); + Py_FatalError(msg); +} +static CYTHON_INLINE int +__pyx_add_acquisition_count_locked(__pyx_atomic_int_type *acquisition_count, + PyThread_type_lock lock) +{ + int result; + PyThread_acquire_lock(lock, 1); + result = (*acquisition_count)++; + PyThread_release_lock(lock); + return result; +} +static CYTHON_INLINE int +__pyx_sub_acquisition_count_locked(__pyx_atomic_int_type *acquisition_count, + PyThread_type_lock lock) +{ + int result; + PyThread_acquire_lock(lock, 1); + result = (*acquisition_count)--; + PyThread_release_lock(lock); + return result; +} +static CYTHON_INLINE void +__Pyx_INC_MEMVIEW(__Pyx_memviewslice *memslice, int have_gil, int lineno) +{ + __pyx_nonatomic_int_type old_acquisition_count; + struct __pyx_memoryview_obj *memview = memslice->memview; + if (unlikely(!memview || (PyObject *) memview == Py_None)) { + return; + } + old_acquisition_count = __pyx_add_acquisition_count(memview); + if (unlikely(old_acquisition_count <= 0)) { + if (likely(old_acquisition_count == 0)) { + if (have_gil) { + Py_INCREF((PyObject *) memview); + } else { + PyGILState_STATE _gilstate = PyGILState_Ensure(); + Py_INCREF((PyObject *) memview); + PyGILState_Release(_gilstate); + } + } else { + __pyx_fatalerror("Acquisition count is %d (line %d)", + old_acquisition_count+1, lineno); + } + } +} +static CYTHON_INLINE void __Pyx_XCLEAR_MEMVIEW(__Pyx_memviewslice *memslice, + int have_gil, int lineno) { + __pyx_nonatomic_int_type old_acquisition_count; + struct __pyx_memoryview_obj *memview = memslice->memview; + if (unlikely(!memview || (PyObject *) memview == Py_None)) { + memslice->memview = NULL; + return; + } + old_acquisition_count = __pyx_sub_acquisition_count(memview); + memslice->data = NULL; + if (likely(old_acquisition_count > 1)) { + memslice->memview = NULL; + } else if (likely(old_acquisition_count == 1)) { + if (have_gil) { + Py_CLEAR(memslice->memview); + } else { + PyGILState_STATE _gilstate = PyGILState_Ensure(); + Py_CLEAR(memslice->memview); + PyGILState_Release(_gilstate); + } + } else { + __pyx_fatalerror("Acquisition count is %d (line %d)", + old_acquisition_count-1, lineno); + } +} + +/* MemviewSliceIsContig */ +static int +__pyx_memviewslice_is_contig(const __Pyx_memviewslice mvs, char order, int ndim) +{ + int i, index, step, start; + Py_ssize_t itemsize = mvs.memview->view.itemsize; + if (order == 'F') { + step = 1; + start = 0; + } else { + step = -1; + start = ndim - 1; + } + for (i = 0; i < ndim; i++) { + index = start + step * i; + if (mvs.suboffsets[index] >= 0 || mvs.strides[index] != itemsize) + return 0; + itemsize *= mvs.shape[index]; + } + return 1; +} + +/* OverlappingSlices */ +static void +__pyx_get_array_memory_extents(__Pyx_memviewslice *slice, + void **out_start, void **out_end, + int ndim, size_t itemsize) +{ + char *start, *end; + int i; + start = end = slice->data; + for (i = 0; i < ndim; i++) { + Py_ssize_t stride = slice->strides[i]; + Py_ssize_t extent = slice->shape[i]; + if (extent == 0) { + *out_start = *out_end = start; + return; + } else { + if (stride > 0) + end += stride * (extent - 1); + else + start += stride * (extent - 1); + } + } + *out_start = start; + *out_end = end + itemsize; +} +static int +__pyx_slices_overlap(__Pyx_memviewslice *slice1, + __Pyx_memviewslice *slice2, + int ndim, size_t itemsize) +{ + void *start1, *end1, *start2, *end2; + __pyx_get_array_memory_extents(slice1, &start1, &end1, ndim, itemsize); + __pyx_get_array_memory_extents(slice2, &start2, &end2, ndim, itemsize); + return (start1 < end2) && (start2 < end1); +} + +/* MemviewSliceInit */ +static int +__Pyx_init_memviewslice(struct __pyx_memoryview_obj *memview, + int ndim, + __Pyx_memviewslice *memviewslice, + int memview_is_new_reference) +{ + __Pyx_RefNannyDeclarations + int i, retval=-1; + Py_buffer *buf = &memview->view; + __Pyx_RefNannySetupContext("init_memviewslice", 0); + if (unlikely(memviewslice->memview || memviewslice->data)) { + PyErr_SetString(PyExc_ValueError, + "memviewslice is already initialized!"); + goto fail; + } + if (buf->strides) { + for (i = 0; i < ndim; i++) { + memviewslice->strides[i] = buf->strides[i]; + } + } else { + Py_ssize_t stride = buf->itemsize; + for (i = ndim - 1; i >= 0; i--) { + memviewslice->strides[i] = stride; + stride *= buf->shape[i]; + } + } + for (i = 0; i < ndim; i++) { + memviewslice->shape[i] = buf->shape[i]; + if (buf->suboffsets) { + memviewslice->suboffsets[i] = buf->suboffsets[i]; + } else { + memviewslice->suboffsets[i] = -1; + } + } + memviewslice->memview = memview; + memviewslice->data = (char *)buf->buf; + if (__pyx_add_acquisition_count(memview) == 0 && !memview_is_new_reference) { + Py_INCREF((PyObject*)memview); + } + retval = 0; + goto no_fail; +fail: + memviewslice->memview = 0; + memviewslice->data = 0; + retval = -1; +no_fail: + __Pyx_RefNannyFinishContext(); + return retval; +} + +/* CIntToPy */ +static CYTHON_INLINE PyObject* __Pyx_PyLong_From___pyx_anon_enum(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; +} + +/* CIntFromPy */ +static CYTHON_INLINE uint64_t __Pyx_PyLong_As_uint64_t(PyObject *x) { +#ifdef __Pyx_HAS_GCC_DIAGNOSTIC +#pragma GCC diagnostic push +#pragma GCC diagnostic ignored "-Wconversion" +#endif + const uint64_t neg_one = (uint64_t) -1, const_zero = (uint64_t) 0; +#ifdef __Pyx_HAS_GCC_DIAGNOSTIC +#pragma GCC diagnostic pop +#endif + const int is_unsigned = neg_one > const_zero; + if (unlikely(!PyLong_Check(x))) { + uint64_t val; + PyObject *tmp = __Pyx_PyNumber_Long(x); + if (!tmp) return (uint64_t) -1; + val = __Pyx_PyLong_As_uint64_t(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(uint64_t, __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(uint64_t) > 1 * PyLong_SHIFT)) { + if ((8 * sizeof(unsigned long) > 2 * PyLong_SHIFT)) { + __PYX_VERIFY_RETURN_INT(uint64_t, unsigned long, (((((unsigned long)digits[1]) << PyLong_SHIFT) | (unsigned long)digits[0]))) + } else if ((8 * sizeof(uint64_t) >= 2 * PyLong_SHIFT)) { + return (uint64_t) (((((uint64_t)digits[1]) << PyLong_SHIFT) | (uint64_t)digits[0])); + } + } + break; + case 3: + if ((8 * sizeof(uint64_t) > 2 * PyLong_SHIFT)) { + if ((8 * sizeof(unsigned long) > 3 * PyLong_SHIFT)) { + __PYX_VERIFY_RETURN_INT(uint64_t, unsigned long, (((((((unsigned long)digits[2]) << PyLong_SHIFT) | (unsigned long)digits[1]) << PyLong_SHIFT) | (unsigned long)digits[0]))) + } else if ((8 * sizeof(uint64_t) >= 3 * PyLong_SHIFT)) { + return (uint64_t) (((((((uint64_t)digits[2]) << PyLong_SHIFT) | (uint64_t)digits[1]) << PyLong_SHIFT) | (uint64_t)digits[0])); + } + } + break; + case 4: + if ((8 * sizeof(uint64_t) > 3 * PyLong_SHIFT)) { + if ((8 * sizeof(unsigned long) > 4 * PyLong_SHIFT)) { + __PYX_VERIFY_RETURN_INT(uint64_t, unsigned long, (((((((((unsigned long)digits[3]) << PyLong_SHIFT) | (unsigned long)digits[2]) << PyLong_SHIFT) | (unsigned long)digits[1]) << PyLong_SHIFT) | (unsigned long)digits[0]))) + } else if ((8 * sizeof(uint64_t) >= 4 * PyLong_SHIFT)) { + return (uint64_t) (((((((((uint64_t)digits[3]) << PyLong_SHIFT) | (uint64_t)digits[2]) << PyLong_SHIFT) | (uint64_t)digits[1]) << PyLong_SHIFT) | (uint64_t)digits[0])); + } + } + break; + } + } +#endif +#if CYTHON_COMPILING_IN_CPYTHON && 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 (uint64_t) -1; + if (unlikely(result == 1)) + goto raise_neg_overflow; + } +#endif + if ((sizeof(uint64_t) <= sizeof(unsigned long))) { + __PYX_VERIFY_RETURN_INT_EXC(uint64_t, unsigned long, PyLong_AsUnsignedLong(x)) + } else if ((sizeof(uint64_t) <= sizeof(unsigned PY_LONG_LONG))) { + __PYX_VERIFY_RETURN_INT_EXC(uint64_t, unsigned PY_LONG_LONG, PyLong_AsUnsignedLongLong(x)) + } + } else { +#if CYTHON_USE_PYLONG_INTERNALS + if (__Pyx_PyLong_IsCompact(x)) { + __PYX_VERIFY_RETURN_INT(uint64_t, __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(uint64_t) - 1 > 1 * PyLong_SHIFT)) { + if ((8 * sizeof(unsigned long) > 2 * PyLong_SHIFT)) { + __PYX_VERIFY_RETURN_INT(uint64_t, long, -(long) (((((unsigned long)digits[1]) << PyLong_SHIFT) | (unsigned long)digits[0]))) + } else if ((8 * sizeof(uint64_t) - 1 > 2 * PyLong_SHIFT)) { + return (uint64_t) (((uint64_t)-1)*(((((uint64_t)digits[1]) << PyLong_SHIFT) | (uint64_t)digits[0]))); + } + } + break; + case 2: + if ((8 * sizeof(uint64_t) > 1 * PyLong_SHIFT)) { + if ((8 * sizeof(unsigned long) > 2 * PyLong_SHIFT)) { + __PYX_VERIFY_RETURN_INT(uint64_t, unsigned long, (((((unsigned long)digits[1]) << PyLong_SHIFT) | (unsigned long)digits[0]))) + } else if ((8 * sizeof(uint64_t) - 1 > 2 * PyLong_SHIFT)) { + return (uint64_t) ((((((uint64_t)digits[1]) << PyLong_SHIFT) | (uint64_t)digits[0]))); + } + } + break; + case -3: + if ((8 * sizeof(uint64_t) - 1 > 2 * PyLong_SHIFT)) { + if ((8 * sizeof(unsigned long) > 3 * PyLong_SHIFT)) { + __PYX_VERIFY_RETURN_INT(uint64_t, long, -(long) (((((((unsigned long)digits[2]) << PyLong_SHIFT) | (unsigned long)digits[1]) << PyLong_SHIFT) | (unsigned long)digits[0]))) + } else if ((8 * sizeof(uint64_t) - 1 > 3 * PyLong_SHIFT)) { + return (uint64_t) (((uint64_t)-1)*(((((((uint64_t)digits[2]) << PyLong_SHIFT) | (uint64_t)digits[1]) << PyLong_SHIFT) | (uint64_t)digits[0]))); + } + } + break; + case 3: + if ((8 * sizeof(uint64_t) > 2 * PyLong_SHIFT)) { + if ((8 * sizeof(unsigned long) > 3 * PyLong_SHIFT)) { + __PYX_VERIFY_RETURN_INT(uint64_t, unsigned long, (((((((unsigned long)digits[2]) << PyLong_SHIFT) | (unsigned long)digits[1]) << PyLong_SHIFT) | (unsigned long)digits[0]))) + } else if ((8 * sizeof(uint64_t) - 1 > 3 * PyLong_SHIFT)) { + return (uint64_t) ((((((((uint64_t)digits[2]) << PyLong_SHIFT) | (uint64_t)digits[1]) << PyLong_SHIFT) | (uint64_t)digits[0]))); + } + } + break; + case -4: + if ((8 * sizeof(uint64_t) - 1 > 3 * PyLong_SHIFT)) { + if ((8 * sizeof(unsigned long) > 4 * PyLong_SHIFT)) { + __PYX_VERIFY_RETURN_INT(uint64_t, long, -(long) (((((((((unsigned long)digits[3]) << PyLong_SHIFT) | (unsigned long)digits[2]) << PyLong_SHIFT) | (unsigned long)digits[1]) << PyLong_SHIFT) | (unsigned long)digits[0]))) + } else if ((8 * sizeof(uint64_t) - 1 > 4 * PyLong_SHIFT)) { + return (uint64_t) (((uint64_t)-1)*(((((((((uint64_t)digits[3]) << PyLong_SHIFT) | (uint64_t)digits[2]) << PyLong_SHIFT) | (uint64_t)digits[1]) << PyLong_SHIFT) | (uint64_t)digits[0]))); + } + } + break; + case 4: + if ((8 * sizeof(uint64_t) > 3 * PyLong_SHIFT)) { + if ((8 * sizeof(unsigned long) > 4 * PyLong_SHIFT)) { + __PYX_VERIFY_RETURN_INT(uint64_t, unsigned long, (((((((((unsigned long)digits[3]) << PyLong_SHIFT) | (unsigned long)digits[2]) << PyLong_SHIFT) | (unsigned long)digits[1]) << PyLong_SHIFT) | (unsigned long)digits[0]))) + } else if ((8 * sizeof(uint64_t) - 1 > 4 * PyLong_SHIFT)) { + return (uint64_t) ((((((((((uint64_t)digits[3]) << PyLong_SHIFT) | (uint64_t)digits[2]) << PyLong_SHIFT) | (uint64_t)digits[1]) << PyLong_SHIFT) | (uint64_t)digits[0]))); + } + } + break; + } + } +#endif + if ((sizeof(uint64_t) <= sizeof(long))) { + __PYX_VERIFY_RETURN_INT_EXC(uint64_t, long, PyLong_AsLong(x)) + } else if ((sizeof(uint64_t) <= sizeof(PY_LONG_LONG))) { + __PYX_VERIFY_RETURN_INT_EXC(uint64_t, PY_LONG_LONG, PyLong_AsLongLong(x)) + } + } + { + uint64_t 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 (uint64_t) -1; + assert(PyLong_CheckExact(v)); + } + { + int result = PyObject_RichCompareBool(v, Py_False, Py_LT); + if (unlikely(result < 0)) { + Py_DECREF(v); + return (uint64_t) -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 (uint64_t) -1; + } else { + stepval = v; + } + v = NULL; + val = (uint64_t) 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(uint64_t) * 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 |= ((uint64_t) 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(uint64_t) * 8) - bits - (is_unsigned ? 0 : 1); + if (unlikely(idigit >= (1L << remaining_bits))) + goto raise_overflow; + val |= ((uint64_t) idigit) << bits; + } + if (!is_unsigned) { + if (unlikely(val & (((uint64_t) 1) << (sizeof(uint64_t) * 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 (uint64_t) -1; + return val; + } +raise_overflow: + PyErr_SetString(PyExc_OverflowError, + "value too large to convert to uint64_t"); + return (uint64_t) -1; +raise_neg_overflow: + PyErr_SetString(PyExc_OverflowError, + "can't convert negative value to uint64_t"); + return (uint64_t) -1; +} + +/* CIntFromPy */ +static CYTHON_INLINE 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___pyx_anon_enum(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___pyx_anon_enum(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 + PyErr_SetString(PyExc_RuntimeError, + "_PyLong_AsByteArray() or PyLong_AsNativeBytes() not available, cannot convert large enums"); + val = (int) -1; +#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 + } +} + +/* CIntToPy */ +static CYTHON_INLINE PyObject* __Pyx_PyLong_From_uint64_t(uint64_t value) { +#ifdef __Pyx_HAS_GCC_DIAGNOSTIC +#pragma GCC diagnostic push +#pragma GCC diagnostic ignored "-Wconversion" +#endif + const uint64_t neg_one = (uint64_t) -1, const_zero = (uint64_t) 0; +#ifdef __Pyx_HAS_GCC_DIAGNOSTIC +#pragma GCC diagnostic pop +#endif + const int is_unsigned = neg_one > const_zero; + if (is_unsigned) { + if (sizeof(uint64_t) < sizeof(long)) { + return PyLong_FromLong((long) value); + } else if (sizeof(uint64_t) <= sizeof(unsigned long)) { + return PyLong_FromUnsignedLong((unsigned long) value); +#if !CYTHON_COMPILING_IN_PYPY + } else if (sizeof(uint64_t) <= sizeof(unsigned PY_LONG_LONG)) { + return PyLong_FromUnsignedLongLong((unsigned PY_LONG_LONG) value); +#endif + } + } else { + if (sizeof(uint64_t) <= sizeof(long)) { + return PyLong_FromLong((long) value); + } else if (sizeof(uint64_t) <= 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(uint64_t), + 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(uint64_t)); + 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 + } +} + +/* 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 size_t __Pyx_PyLong_As_size_t(PyObject *x) { +#ifdef __Pyx_HAS_GCC_DIAGNOSTIC +#pragma GCC diagnostic push +#pragma GCC diagnostic ignored "-Wconversion" +#endif + const size_t neg_one = (size_t) -1, const_zero = (size_t) 0; +#ifdef __Pyx_HAS_GCC_DIAGNOSTIC +#pragma GCC diagnostic pop +#endif + const int is_unsigned = neg_one > const_zero; + if (unlikely(!PyLong_Check(x))) { + size_t val; + PyObject *tmp = __Pyx_PyNumber_Long(x); + if (!tmp) return (size_t) -1; + val = __Pyx_PyLong_As_size_t(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(size_t, __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(size_t) > 1 * PyLong_SHIFT)) { + if ((8 * sizeof(unsigned long) > 2 * PyLong_SHIFT)) { + __PYX_VERIFY_RETURN_INT(size_t, unsigned long, (((((unsigned long)digits[1]) << PyLong_SHIFT) | (unsigned long)digits[0]))) + } else if ((8 * sizeof(size_t) >= 2 * PyLong_SHIFT)) { + return (size_t) (((((size_t)digits[1]) << PyLong_SHIFT) | (size_t)digits[0])); + } + } + break; + case 3: + if ((8 * sizeof(size_t) > 2 * PyLong_SHIFT)) { + if ((8 * sizeof(unsigned long) > 3 * PyLong_SHIFT)) { + __PYX_VERIFY_RETURN_INT(size_t, unsigned long, (((((((unsigned long)digits[2]) << PyLong_SHIFT) | (unsigned long)digits[1]) << PyLong_SHIFT) | (unsigned long)digits[0]))) + } else if ((8 * sizeof(size_t) >= 3 * PyLong_SHIFT)) { + return (size_t) (((((((size_t)digits[2]) << PyLong_SHIFT) | (size_t)digits[1]) << PyLong_SHIFT) | (size_t)digits[0])); + } + } + break; + case 4: + if ((8 * sizeof(size_t) > 3 * PyLong_SHIFT)) { + if ((8 * sizeof(unsigned long) > 4 * PyLong_SHIFT)) { + __PYX_VERIFY_RETURN_INT(size_t, unsigned long, (((((((((unsigned long)digits[3]) << PyLong_SHIFT) | (unsigned long)digits[2]) << PyLong_SHIFT) | (unsigned long)digits[1]) << PyLong_SHIFT) | (unsigned long)digits[0]))) + } else if ((8 * sizeof(size_t) >= 4 * PyLong_SHIFT)) { + return (size_t) (((((((((size_t)digits[3]) << PyLong_SHIFT) | (size_t)digits[2]) << PyLong_SHIFT) | (size_t)digits[1]) << PyLong_SHIFT) | (size_t)digits[0])); + } + } + break; + } + } +#endif +#if CYTHON_COMPILING_IN_CPYTHON && 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 (size_t) -1; + if (unlikely(result == 1)) + goto raise_neg_overflow; + } +#endif + if ((sizeof(size_t) <= sizeof(unsigned long))) { + __PYX_VERIFY_RETURN_INT_EXC(size_t, unsigned long, PyLong_AsUnsignedLong(x)) + } else if ((sizeof(size_t) <= sizeof(unsigned PY_LONG_LONG))) { + __PYX_VERIFY_RETURN_INT_EXC(size_t, unsigned PY_LONG_LONG, PyLong_AsUnsignedLongLong(x)) + } + } else { +#if CYTHON_USE_PYLONG_INTERNALS + if (__Pyx_PyLong_IsCompact(x)) { + __PYX_VERIFY_RETURN_INT(size_t, __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(size_t) - 1 > 1 * PyLong_SHIFT)) { + if ((8 * sizeof(unsigned long) > 2 * PyLong_SHIFT)) { + __PYX_VERIFY_RETURN_INT(size_t, long, -(long) (((((unsigned long)digits[1]) << PyLong_SHIFT) | (unsigned long)digits[0]))) + } else if ((8 * sizeof(size_t) - 1 > 2 * PyLong_SHIFT)) { + return (size_t) (((size_t)-1)*(((((size_t)digits[1]) << PyLong_SHIFT) | (size_t)digits[0]))); + } + } + break; + case 2: + if ((8 * sizeof(size_t) > 1 * PyLong_SHIFT)) { + if ((8 * sizeof(unsigned long) > 2 * PyLong_SHIFT)) { + __PYX_VERIFY_RETURN_INT(size_t, unsigned long, (((((unsigned long)digits[1]) << PyLong_SHIFT) | (unsigned long)digits[0]))) + } else if ((8 * sizeof(size_t) - 1 > 2 * PyLong_SHIFT)) { + return (size_t) ((((((size_t)digits[1]) << PyLong_SHIFT) | (size_t)digits[0]))); + } + } + break; + case -3: + if ((8 * sizeof(size_t) - 1 > 2 * PyLong_SHIFT)) { + if ((8 * sizeof(unsigned long) > 3 * PyLong_SHIFT)) { + __PYX_VERIFY_RETURN_INT(size_t, long, -(long) (((((((unsigned long)digits[2]) << PyLong_SHIFT) | (unsigned long)digits[1]) << PyLong_SHIFT) | (unsigned long)digits[0]))) + } else if ((8 * sizeof(size_t) - 1 > 3 * PyLong_SHIFT)) { + return (size_t) (((size_t)-1)*(((((((size_t)digits[2]) << PyLong_SHIFT) | (size_t)digits[1]) << PyLong_SHIFT) | (size_t)digits[0]))); + } + } + break; + case 3: + if ((8 * sizeof(size_t) > 2 * PyLong_SHIFT)) { + if ((8 * sizeof(unsigned long) > 3 * PyLong_SHIFT)) { + __PYX_VERIFY_RETURN_INT(size_t, unsigned long, (((((((unsigned long)digits[2]) << PyLong_SHIFT) | (unsigned long)digits[1]) << PyLong_SHIFT) | (unsigned long)digits[0]))) + } else if ((8 * sizeof(size_t) - 1 > 3 * PyLong_SHIFT)) { + return (size_t) ((((((((size_t)digits[2]) << PyLong_SHIFT) | (size_t)digits[1]) << PyLong_SHIFT) | (size_t)digits[0]))); + } + } + break; + case -4: + if ((8 * sizeof(size_t) - 1 > 3 * PyLong_SHIFT)) { + if ((8 * sizeof(unsigned long) > 4 * PyLong_SHIFT)) { + __PYX_VERIFY_RETURN_INT(size_t, long, -(long) (((((((((unsigned long)digits[3]) << PyLong_SHIFT) | (unsigned long)digits[2]) << PyLong_SHIFT) | (unsigned long)digits[1]) << PyLong_SHIFT) | (unsigned long)digits[0]))) + } else if ((8 * sizeof(size_t) - 1 > 4 * PyLong_SHIFT)) { + return (size_t) (((size_t)-1)*(((((((((size_t)digits[3]) << PyLong_SHIFT) | (size_t)digits[2]) << PyLong_SHIFT) | (size_t)digits[1]) << PyLong_SHIFT) | (size_t)digits[0]))); + } + } + break; + case 4: + if ((8 * sizeof(size_t) > 3 * PyLong_SHIFT)) { + if ((8 * sizeof(unsigned long) > 4 * PyLong_SHIFT)) { + __PYX_VERIFY_RETURN_INT(size_t, unsigned long, (((((((((unsigned long)digits[3]) << PyLong_SHIFT) | (unsigned long)digits[2]) << PyLong_SHIFT) | (unsigned long)digits[1]) << PyLong_SHIFT) | (unsigned long)digits[0]))) + } else if ((8 * sizeof(size_t) - 1 > 4 * PyLong_SHIFT)) { + return (size_t) ((((((((((size_t)digits[3]) << PyLong_SHIFT) | (size_t)digits[2]) << PyLong_SHIFT) | (size_t)digits[1]) << PyLong_SHIFT) | (size_t)digits[0]))); + } + } + break; + } + } +#endif + if ((sizeof(size_t) <= sizeof(long))) { + __PYX_VERIFY_RETURN_INT_EXC(size_t, long, PyLong_AsLong(x)) + } else if ((sizeof(size_t) <= sizeof(PY_LONG_LONG))) { + __PYX_VERIFY_RETURN_INT_EXC(size_t, PY_LONG_LONG, PyLong_AsLongLong(x)) + } + } + { + size_t 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 (size_t) -1; + assert(PyLong_CheckExact(v)); + } + { + int result = PyObject_RichCompareBool(v, Py_False, Py_LT); + if (unlikely(result < 0)) { + Py_DECREF(v); + return (size_t) -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 (size_t) -1; + } else { + stepval = v; + } + v = NULL; + val = (size_t) 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(size_t) * 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 |= ((size_t) 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(size_t) * 8) - bits - (is_unsigned ? 0 : 1); + if (unlikely(idigit >= (1L << remaining_bits))) + goto raise_overflow; + val |= ((size_t) idigit) << bits; + } + if (!is_unsigned) { + if (unlikely(val & (((size_t) 1) << (sizeof(size_t) * 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 (size_t) -1; + return val; + } +raise_overflow: + PyErr_SetString(PyExc_OverflowError, + "value too large to convert to size_t"); + return (size_t) -1; +raise_neg_overflow: + PyErr_SetString(PyExc_OverflowError, + "can't convert negative value to size_t"); + return (size_t) -1; +} + +/* MemviewSliceCopy */ +static __Pyx_memviewslice +__pyx_memoryview_copy_new_contig(const __Pyx_memviewslice *from_mvs, + const char *mode, int ndim, + size_t sizeof_dtype, int contig_flag, + int dtype_is_object) +{ + __Pyx_RefNannyDeclarations + int i; + __Pyx_memviewslice new_mvs = __Pyx_MEMSLICE_INIT; + struct __pyx_memoryview_obj *from_memview = from_mvs->memview; + Py_buffer *buf = &from_memview->view; + PyObject *shape_tuple = NULL; + PyObject *temp_int = NULL; + struct __pyx_array_obj *array_obj = NULL; + struct __pyx_memoryview_obj *memview_obj = NULL; + __Pyx_RefNannySetupContext("__pyx_memoryview_copy_new_contig", 0); + for (i = 0; i < ndim; i++) { + if (unlikely(from_mvs->suboffsets[i] >= 0)) { + PyErr_Format(PyExc_ValueError, "Cannot copy memoryview slice with " + "indirect dimensions (axis %d)", i); + goto fail; + } + } + shape_tuple = PyTuple_New(ndim); + if (unlikely(!shape_tuple)) { + goto fail; + } + __Pyx_GOTREF(shape_tuple); + for(i = 0; i < ndim; i++) { + temp_int = PyLong_FromSsize_t(from_mvs->shape[i]); + if(unlikely(!temp_int)) { + goto fail; + } else { +#if CYTHON_ASSUME_SAFE_MACROS + PyTuple_SET_ITEM(shape_tuple, i, temp_int); +#else + if (PyTuple_SetItem(shape_tuple, i, temp_int) < 0) { + goto fail; + } +#endif + temp_int = NULL; + } + } + array_obj = __pyx_array_new(shape_tuple, sizeof_dtype, buf->format, mode, NULL); + if (unlikely(!array_obj)) { + goto fail; + } + __Pyx_GOTREF(array_obj); + memview_obj = (struct __pyx_memoryview_obj *) __pyx_memoryview_new( + (PyObject *) array_obj, contig_flag, + dtype_is_object, + from_mvs->memview->typeinfo); + if (unlikely(!memview_obj)) + goto fail; + if (unlikely(__Pyx_init_memviewslice(memview_obj, ndim, &new_mvs, 1) < 0)) + goto fail; + if (unlikely(__pyx_memoryview_copy_contents(*from_mvs, new_mvs, ndim, ndim, + dtype_is_object) < 0)) + goto fail; + goto no_fail; +fail: + __Pyx_XDECREF((PyObject *) new_mvs.memview); + new_mvs.memview = NULL; + new_mvs.data = NULL; +no_fail: + __Pyx_XDECREF(shape_tuple); + __Pyx_XDECREF(temp_int); + __Pyx_XDECREF((PyObject *) array_obj); + __Pyx_RefNannyFinishContext(); + return new_mvs; +} + +/* PyObjectCallMethod1 */ +#if !(CYTHON_VECTORCALL && (__PYX_LIMITED_VERSION_HEX >= 0x030C0000 || (!CYTHON_COMPILING_IN_LIMITED_API && PY_VERSION_HEX >= 0x03090000))) +static PyObject* __Pyx__PyObject_CallMethod1(PyObject* method, PyObject* arg) { + PyObject *result = __Pyx_PyObject_CallOneArg(method, arg); + Py_DECREF(method); + return result; +} +#endif +static PyObject* __Pyx_PyObject_CallMethod1(PyObject* obj, PyObject* method_name, PyObject* arg) { +#if CYTHON_VECTORCALL && (__PYX_LIMITED_VERSION_HEX >= 0x030C0000 || (!CYTHON_COMPILING_IN_LIMITED_API && PY_VERSION_HEX >= 0x03090000)) + PyObject *args[2] = {obj, arg}; + (void) __Pyx_PyObject_CallOneArg; + (void) __Pyx_PyObject_Call2Args; + return PyObject_VectorcallMethod(method_name, args, 2 | PY_VECTORCALL_ARGUMENTS_OFFSET, NULL); +#else + PyObject *method = NULL, *result; + int is_method = __Pyx_PyObject_GetMethod(obj, method_name, &method); + if (likely(is_method)) { + result = __Pyx_PyObject_Call2Args(method, obj, arg); + Py_DECREF(method); + return result; + } + if (unlikely(!method)) return NULL; + return __Pyx__PyObject_CallMethod1(method, arg); +#endif +} + +/* UpdateUnpickledDict */ +static int __Pyx__UpdateUnpickledDict(PyObject *obj, PyObject *state, Py_ssize_t index) { + PyObject *state_dict = __Pyx_PySequence_ITEM(state, index); + if (unlikely(!state_dict)) { + return -1; + } + int non_empty = PyObject_IsTrue(state_dict); + if (non_empty == 0) { + Py_DECREF(state_dict); + return 0; + } else if (unlikely(non_empty == -1)) { + return -1; + } + PyObject *dict; + #if CYTHON_COMPILING_IN_LIMITED_API && __PYX_LIMITED_VERSION_HEX < 0x030A0000 + dict = PyObject_GetAttrString(obj, "__dict__"); + #else + dict = PyObject_GenericGetDict(obj, NULL); + #endif + if (unlikely(!dict)) { + Py_DECREF(state_dict); + return -1; + } + int result; + if (likely(PyDict_CheckExact(dict))) { + result = PyDict_Update(dict, state_dict); + } else { + PyObject *obj_result = __Pyx_PyObject_CallMethod1(dict, __pyx_mstate_global->__pyx_n_u_update, state_dict); + if (likely(obj_result)) { + Py_DECREF(obj_result); + result = 0; + } else { + result = -1; + } + } + Py_DECREF(state_dict); + Py_DECREF(dict); + return result; +} +static int __Pyx_UpdateUnpickledDict(PyObject *obj, PyObject *state, Py_ssize_t index) { + Py_ssize_t state_size = __Pyx_PyTuple_GET_SIZE(state); + #if !CYTHON_ASSUME_SAFE_SIZE + if (unlikely(state_size == -1)) return -1; + #endif + if (state_size <= index) { + return 0; + } + return __Pyx__UpdateUnpickledDict(obj, state, index); +} + +/* CIntFromPy */ +static CYTHON_INLINE char __Pyx_PyLong_As_char(PyObject *x) { +#ifdef __Pyx_HAS_GCC_DIAGNOSTIC +#pragma GCC diagnostic push +#pragma GCC diagnostic ignored "-Wconversion" +#endif + const char neg_one = (char) -1, const_zero = (char) 0; +#ifdef __Pyx_HAS_GCC_DIAGNOSTIC +#pragma GCC diagnostic pop +#endif + const int is_unsigned = neg_one > const_zero; + if (unlikely(!PyLong_Check(x))) { + char val; + PyObject *tmp = __Pyx_PyNumber_Long(x); + if (!tmp) return (char) -1; + val = __Pyx_PyLong_As_char(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(char, __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(char) > 1 * PyLong_SHIFT)) { + if ((8 * sizeof(unsigned long) > 2 * PyLong_SHIFT)) { + __PYX_VERIFY_RETURN_INT(char, unsigned long, (((((unsigned long)digits[1]) << PyLong_SHIFT) | (unsigned long)digits[0]))) + } else if ((8 * sizeof(char) >= 2 * PyLong_SHIFT)) { + return (char) (((((char)digits[1]) << PyLong_SHIFT) | (char)digits[0])); + } + } + break; + case 3: + if ((8 * sizeof(char) > 2 * PyLong_SHIFT)) { + if ((8 * sizeof(unsigned long) > 3 * PyLong_SHIFT)) { + __PYX_VERIFY_RETURN_INT(char, unsigned long, (((((((unsigned long)digits[2]) << PyLong_SHIFT) | (unsigned long)digits[1]) << PyLong_SHIFT) | (unsigned long)digits[0]))) + } else if ((8 * sizeof(char) >= 3 * PyLong_SHIFT)) { + return (char) (((((((char)digits[2]) << PyLong_SHIFT) | (char)digits[1]) << PyLong_SHIFT) | (char)digits[0])); + } + } + break; + case 4: + if ((8 * sizeof(char) > 3 * PyLong_SHIFT)) { + if ((8 * sizeof(unsigned long) > 4 * PyLong_SHIFT)) { + __PYX_VERIFY_RETURN_INT(char, 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(char) >= 4 * PyLong_SHIFT)) { + return (char) (((((((((char)digits[3]) << PyLong_SHIFT) | (char)digits[2]) << PyLong_SHIFT) | (char)digits[1]) << PyLong_SHIFT) | (char)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 (char) -1; + if (unlikely(result == 1)) + goto raise_neg_overflow; + } +#endif + if ((sizeof(char) <= sizeof(unsigned long))) { + __PYX_VERIFY_RETURN_INT_EXC(char, unsigned long, PyLong_AsUnsignedLong(x)) + } else if ((sizeof(char) <= sizeof(unsigned PY_LONG_LONG))) { + __PYX_VERIFY_RETURN_INT_EXC(char, unsigned PY_LONG_LONG, PyLong_AsUnsignedLongLong(x)) + } + } else { +#if CYTHON_USE_PYLONG_INTERNALS + if (__Pyx_PyLong_IsCompact(x)) { + __PYX_VERIFY_RETURN_INT(char, __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(char) - 1 > 1 * PyLong_SHIFT)) { + if ((8 * sizeof(unsigned long) > 2 * PyLong_SHIFT)) { + __PYX_VERIFY_RETURN_INT(char, long, -(long) (((((unsigned long)digits[1]) << PyLong_SHIFT) | (unsigned long)digits[0]))) + } else if ((8 * sizeof(char) - 1 > 2 * PyLong_SHIFT)) { + return (char) (((char)-1)*(((((char)digits[1]) << PyLong_SHIFT) | (char)digits[0]))); + } + } + break; + case 2: + if ((8 * sizeof(char) > 1 * PyLong_SHIFT)) { + if ((8 * sizeof(unsigned long) > 2 * PyLong_SHIFT)) { + __PYX_VERIFY_RETURN_INT(char, unsigned long, (((((unsigned long)digits[1]) << PyLong_SHIFT) | (unsigned long)digits[0]))) + } else if ((8 * sizeof(char) - 1 > 2 * PyLong_SHIFT)) { + return (char) ((((((char)digits[1]) << PyLong_SHIFT) | (char)digits[0]))); + } + } + break; + case -3: + if ((8 * sizeof(char) - 1 > 2 * PyLong_SHIFT)) { + if ((8 * sizeof(unsigned long) > 3 * PyLong_SHIFT)) { + __PYX_VERIFY_RETURN_INT(char, long, -(long) (((((((unsigned long)digits[2]) << PyLong_SHIFT) | (unsigned long)digits[1]) << PyLong_SHIFT) | (unsigned long)digits[0]))) + } else if ((8 * sizeof(char) - 1 > 3 * PyLong_SHIFT)) { + return (char) (((char)-1)*(((((((char)digits[2]) << PyLong_SHIFT) | (char)digits[1]) << PyLong_SHIFT) | (char)digits[0]))); + } + } + break; + case 3: + if ((8 * sizeof(char) > 2 * PyLong_SHIFT)) { + if ((8 * sizeof(unsigned long) > 3 * PyLong_SHIFT)) { + __PYX_VERIFY_RETURN_INT(char, unsigned long, (((((((unsigned long)digits[2]) << PyLong_SHIFT) | (unsigned long)digits[1]) << PyLong_SHIFT) | (unsigned long)digits[0]))) + } else if ((8 * sizeof(char) - 1 > 3 * PyLong_SHIFT)) { + return (char) ((((((((char)digits[2]) << PyLong_SHIFT) | (char)digits[1]) << PyLong_SHIFT) | (char)digits[0]))); + } + } + break; + case -4: + if ((8 * sizeof(char) - 1 > 3 * PyLong_SHIFT)) { + if ((8 * sizeof(unsigned long) > 4 * PyLong_SHIFT)) { + __PYX_VERIFY_RETURN_INT(char, 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(char) - 1 > 4 * PyLong_SHIFT)) { + return (char) (((char)-1)*(((((((((char)digits[3]) << PyLong_SHIFT) | (char)digits[2]) << PyLong_SHIFT) | (char)digits[1]) << PyLong_SHIFT) | (char)digits[0]))); + } + } + break; + case 4: + if ((8 * sizeof(char) > 3 * PyLong_SHIFT)) { + if ((8 * sizeof(unsigned long) > 4 * PyLong_SHIFT)) { + __PYX_VERIFY_RETURN_INT(char, 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(char) - 1 > 4 * PyLong_SHIFT)) { + return (char) ((((((((((char)digits[3]) << PyLong_SHIFT) | (char)digits[2]) << PyLong_SHIFT) | (char)digits[1]) << PyLong_SHIFT) | (char)digits[0]))); + } + } + break; + } + } +#endif + if ((sizeof(char) <= sizeof(long))) { + __PYX_VERIFY_RETURN_INT_EXC(char, long, PyLong_AsLong(x)) + } else if ((sizeof(char) <= sizeof(PY_LONG_LONG))) { + __PYX_VERIFY_RETURN_INT_EXC(char, PY_LONG_LONG, PyLong_AsLongLong(x)) + } + } + { + char 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 (char) -1; + assert(PyLong_CheckExact(v)); + } + { + int result = PyObject_RichCompareBool(v, Py_False, Py_LT); + if (unlikely(result < 0)) { + Py_DECREF(v); + return (char) -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 (char) -1; + } else { + stepval = v; + } + v = NULL; + val = (char) 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(char) * 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 |= ((char) 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(char) * 8) - bits - (is_unsigned ? 0 : 1); + if (unlikely(idigit >= (1L << remaining_bits))) + goto raise_overflow; + val |= ((char) idigit) << bits; + } + if (!is_unsigned) { + if (unlikely(val & (((char) 1) << (sizeof(char) * 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 (char) -1; + return val; + } +raise_overflow: + PyErr_SetString(PyExc_OverflowError, + "value too large to convert to char"); + return (char) -1; +raise_neg_overflow: + PyErr_SetString(PyExc_OverflowError, + "can't convert negative value to char"); + return (char) -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__9); + } + goto done; +} +#endif + +/* GetRuntimeVersion */ +#if __PYX_LIMITED_VERSION_HEX < 0x030b0000 +void __Pyx_init_runtime_version(void) { + if (__Pyx_cached_runtime_version == 0) { + const char* rt_version = Py_GetVersion(); + unsigned long version = 0; + unsigned long factor = 0x01000000UL; + unsigned int digit = 0; + int i = 0; + while (factor) { + while ('0' <= rt_version[i] && rt_version[i] <= '9') { + digit = digit * 10 + (unsigned int) (rt_version[i] - '0'); + ++i; + } + version += factor * digit; + if (rt_version[i] != '.') + break; + digit = 0; + factor >>= 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, *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)) return NULL; + 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 */ diff --git a/TTS/Kokoro/.venv/Lib/site-packages/spacy/pipeline/_parser_internals/ner.pxd b/TTS/Kokoro/.venv/Lib/site-packages/spacy/pipeline/_parser_internals/ner.pxd new file mode 100644 index 0000000000000000000000000000000000000000..04126c977f5129dabfedf030b88497c04319a502 --- /dev/null +++ b/TTS/Kokoro/.venv/Lib/site-packages/spacy/pipeline/_parser_internals/ner.pxd @@ -0,0 +1,5 @@ +from .transition_system cimport TransitionSystem + + +cdef class BiluoPushDown(TransitionSystem): + pass diff --git a/TTS/Kokoro/.venv/Lib/site-packages/spacy/pipeline/_parser_internals/ner.pyx b/TTS/Kokoro/.venv/Lib/site-packages/spacy/pipeline/_parser_internals/ner.pyx new file mode 100644 index 0000000000000000000000000000000000000000..e91a3112b33ab114b8240e8bcdd8d66cb4c49b5b --- /dev/null +++ b/TTS/Kokoro/.venv/Lib/site-packages/spacy/pipeline/_parser_internals/ner.pyx @@ -0,0 +1,689 @@ +# cython: profile=False +from cymem.cymem cimport Pool +from libc.stdint cimport int32_t + +from collections import Counter + +from thinc.extra.search cimport Beam + +from ...tokens.doc cimport Doc + +from ...tokens.span import Span + +from ...attrs cimport IS_SPACE +from ...lexeme cimport Lexeme +from ...structs cimport SpanC +from ...tokens.span cimport Span +from ...typedefs cimport attr_t, weight_t + +from ...training import split_bilu_label + +from ...training.example cimport Example +from ._state cimport StateC +from .stateclass cimport StateClass +from .transition_system cimport Transition, do_func_t + +from ...errors import Errors + + +cdef enum: + MISSING + BEGIN + IN + LAST + UNIT + OUT + N_MOVES + + +MOVE_NAMES = [None] * N_MOVES +MOVE_NAMES[MISSING] = 'M' +MOVE_NAMES[BEGIN] = 'B' +MOVE_NAMES[IN] = 'I' +MOVE_NAMES[LAST] = 'L' +MOVE_NAMES[UNIT] = 'U' +MOVE_NAMES[OUT] = 'O' + + +cdef struct GoldNERStateC: + Transition* ner + SpanC* negs + int32_t length + int32_t nr_neg + + +cdef class BiluoGold: + cdef Pool mem + cdef GoldNERStateC c + + def __init__(self, BiluoPushDown moves, StateClass stcls, Example example, neg_key): + self.mem = Pool() + self.c = create_gold_state(self.mem, moves, stcls.c, example, neg_key) + + def update(self, StateClass stcls): + update_gold_state(&self.c, stcls.c) + + +cdef GoldNERStateC create_gold_state( + Pool mem, + BiluoPushDown moves, + const StateC* stcls, + Example example, + neg_key +) except *: + cdef GoldNERStateC gs + cdef Span neg + if neg_key is not None: + negs = example.get_aligned_spans_y2x( + example.y.spans.get(neg_key, []), + allow_overlap=True + ) + else: + negs = [] + assert example.x.length > 0 + gs.ner = mem.alloc(example.x.length, sizeof(Transition)) + gs.negs = mem.alloc(len(negs), sizeof(SpanC)) + gs.nr_neg = len(negs) + ner_ents, ner_tags = example.get_aligned_ents_and_ner() + for i, ner_tag in enumerate(ner_tags): + gs.ner[i] = moves.lookup_transition(ner_tag) + + # Prevent conflicting spans in the data. For NER, spans are equal if they have the same offsets and label. + neg_span_triples = {(neg_ent.start_char, neg_ent.end_char, neg_ent.label) for neg_ent in negs} + for pos_span in ner_ents: + if (pos_span.start_char, pos_span.end_char, pos_span.label) in neg_span_triples: + raise ValueError(Errors.E868.format(span=(pos_span.start_char, pos_span.end_char, pos_span.label_))) + + # In order to handle negative samples, we need to maintain the full + # (start, end, label) triple. If we break it down to the 'isnt B-LOC' + # thing, we'll get blocked if there's an incorrect prefix. + for i, neg in enumerate(negs): + gs.negs[i] = neg.c + return gs + + +cdef void update_gold_state(GoldNERStateC* gs, const StateC* state) except *: + # We don't need to update each time, unlike the parser. + pass + + +cdef do_func_t[N_MOVES] do_funcs + + +cdef bint _entity_is_sunk(const StateC* state, Transition* golds) noexcept nogil: + if not state.entity_is_open(): + return False + + cdef const Transition* gold = &golds[state.E(0)] + ent = state.get_ent() + if gold.move != BEGIN and gold.move != UNIT: + return True + elif gold.label != ent.label: + return True + else: + return False + + +cdef class BiluoPushDown(TransitionSystem): + def __init__(self, *args, **kwargs): + TransitionSystem.__init__(self, *args, **kwargs) + + @classmethod + def get_actions(cls, **kwargs): + actions = { + MISSING: Counter(), + BEGIN: Counter(), + IN: Counter(), + LAST: Counter(), + UNIT: Counter(), + OUT: Counter() + } + actions[OUT][''] = 1 # Represents a token predicted to be outside of any entity + actions[UNIT][''] = 1 # Represents a token prohibited to be in an entity + for entity_type in kwargs.get('entity_types', []): + for action in (BEGIN, IN, LAST, UNIT): + actions[action][entity_type] = 1 + for example in kwargs.get('examples', []): + for token in example.y: + ent_type = token.ent_type_ + if ent_type: + for action in (BEGIN, IN, LAST, UNIT): + actions[action][ent_type] += 1 + return actions + + @property + def action_types(self): + return (BEGIN, IN, LAST, UNIT, OUT) + + def get_doc_labels(self, doc): + labels = set() + for token in doc: + if token.ent_type: + labels.add(token.ent_type_) + return labels + + def move_name(self, int move, attr_t label): + if move == OUT: + return 'O' + elif move == MISSING: + return 'M' + else: + return MOVE_NAMES[move] + '-' + self.strings[label] + + def init_gold_batch(self, examples): + all_states = self.init_batch([eg.predicted for eg in examples]) + golds = [] + states = [] + for state, eg in zip(all_states, examples): + if self.has_gold(eg) and not state.is_final(): + golds.append(self.init_gold(state, eg)) + states.append(state) + n_steps = sum([len(s.queue) for s in states]) + return states, golds, n_steps + + cdef Transition lookup_transition(self, object name) except *: + cdef attr_t label + if name == '-' or name == '' or name is None: + return Transition(clas=0, move=MISSING, label=0, score=0) + elif '-' in name: + move_str, label_str = split_bilu_label(name) + # Deprecated, hacky way to denote 'not this entity' + if label_str.startswith('!'): + raise ValueError(Errors.E869.format(label=name)) + label = self.strings.add(label_str) + else: + move_str = name + label = 0 + move = MOVE_NAMES.index(move_str) + for i in range(self.n_moves): + if self.c[i].move == move and self.c[i].label == label: + return self.c[i] + raise KeyError(Errors.E022.format(name=name)) + + cdef Transition init_transition(self, int clas, int move, attr_t label) except *: + # TODO: Apparent Cython bug here when we try to use the Transition() + # constructor with the function pointers + cdef Transition t + t.score = 0 + t.clas = clas + t.move = move + t.label = label + if move == MISSING: + t.is_valid = Missing.is_valid + t.do = Missing.transition + t.get_cost = Missing.cost + elif move == BEGIN: + t.is_valid = Begin.is_valid + t.do = Begin.transition + t.get_cost = Begin.cost + elif move == IN: + t.is_valid = In.is_valid + t.do = In.transition + t.get_cost = In.cost + elif move == LAST: + t.is_valid = Last.is_valid + t.do = Last.transition + t.get_cost = Last.cost + elif move == UNIT: + t.is_valid = Unit.is_valid + t.do = Unit.transition + t.get_cost = Unit.cost + elif move == OUT: + t.is_valid = Out.is_valid + t.do = Out.transition + t.get_cost = Out.cost + else: + raise ValueError(Errors.E019.format(action=move, src='ner')) + return t + + def add_action(self, int action, label_name, freq=None): + cdef attr_t label_id + if not isinstance(label_name, int): + label_id = self.strings.add(label_name) + else: + label_id = label_name + if action == OUT and label_id != 0: + return None + if action == MISSING: + return None + # Check we're not creating a move we already have, so that this is + # idempotent + for trans in self.c[:self.n_moves]: + if trans.move == action and trans.label == label_id: + return 0 + if self.n_moves >= self._size: + self._size = self.n_moves + self._size *= 2 + self.c = self.mem.realloc(self.c, self._size * sizeof(self.c[0])) + self.c[self.n_moves] = self.init_transition(self.n_moves, action, label_id) + self.n_moves += 1 + if self.labels.get(action, []): + freq = min(0, min(self.labels[action].values())) + self.labels[action][label_name] = freq-1 + else: + self.labels[action] = Counter() + self.labels[action][label_name] = -1 + return 1 + + def set_annotations(self, StateClass state, Doc doc): + cdef int i + ents = [] + for i in range(state.c._ents.size()): + ent = state.c._ents.at(i) + if ent.start != -1 and ent.end != -1: + ents.append(Span(doc, ent.start, ent.end, label=ent.label, kb_id=doc.c[ent.start].ent_kb_id)) + doc.set_ents(ents, default="unmodified") + # Set non-blocked tokens to O + for i in range(doc.length): + if doc.c[i].ent_iob == 0: + doc.c[i].ent_iob = 2 + + def get_beam_parses(self, Beam beam): + parses = [] + probs = beam.probs + for i in range(beam.size): + state = beam.at(i) + if state.is_final(): + prob = probs[i] + parse = [] + for j in range(state._ents.size()): + ent = state._ents.at(j) + if ent.start != -1 and ent.end != -1: + parse.append((ent.start, ent.end, self.strings[ent.label])) + parses.append((prob, parse)) + return parses + + def init_gold(self, StateClass state, Example example): + return BiluoGold(self, state, example, self.neg_key) + + def has_gold(self, Example eg, start=0, end=None): + # We get x and y referring to X, we want to check relative to Y, + # the reference + y_spans = eg.get_aligned_spans_x2y([eg.x[start:end]]) + if not y_spans: + y_spans = [eg.y[:]] + y_span = y_spans[0] + start = y_span.start + end = y_span.end + neg_key = self.neg_key + if neg_key is not None: + # If we have any negative samples, count that as having annotation. + for span in eg.y.spans.get(neg_key, []): + if span.start >= start and span.end <= end: + return True + for word in eg.y[start:end]: + if word.ent_iob != 0: + return True + else: + return False + + def get_cost(self, StateClass stcls, gold, int i): + if not isinstance(gold, BiluoGold): + raise TypeError(Errors.E909.format(name="BiluoGold")) + cdef BiluoGold gold_ = gold + gold_state = gold_.c + if self.c[i].is_valid(stcls.c, self.c[i].label): + cost = self.c[i].get_cost(stcls.c, &gold_state, self.c[i].label) + else: + cost = 9000 + return cost + + cdef int set_costs(self, int* is_valid, weight_t* costs, + const StateC* state, gold) except -1: + if not isinstance(gold, BiluoGold): + raise TypeError(Errors.E909.format(name="BiluoGold")) + cdef BiluoGold gold_ = gold + gold_state = gold_.c + update_gold_state(&gold_state, state) + n_gold = 0 + self.set_valid(is_valid, state) + for i in range(self.n_moves): + if is_valid[i]: + costs[i] = self.c[i].get_cost(state, &gold_state, self.c[i].label) + n_gold += costs[i] <= 0 + else: + costs[i] = 9000 + + +cdef class Missing: + @staticmethod + cdef bint is_valid(const StateC* st, attr_t label) noexcept nogil: + return False + + @staticmethod + cdef int transition(StateC* s, attr_t label) noexcept nogil: + pass + + @staticmethod + cdef weight_t cost(const StateC* s, const void* _gold, attr_t label) noexcept nogil: + return 9000 + + +cdef class Begin: + @staticmethod + cdef bint is_valid(const StateC* st, attr_t label) noexcept nogil: + cdef int preset_ent_iob = st.B_(0).ent_iob + cdef attr_t preset_ent_label = st.B_(0).ent_type + if st.entity_is_open(): + return False + if st.buffer_length() < 2: + # If we're the last token of the input, we can't B -- must U or O. + return False + elif label == 0: + return False + elif preset_ent_iob == 1: + # Ensure we don't clobber preset entities. If no entity preset, + # ent_iob is 0 + return False + elif preset_ent_iob == 3: + # Okay, we're in a preset entity. + if label != preset_ent_label: + # If label isn't right, reject + return False + elif st.B_(1).ent_iob != 1: + # If next token isn't marked I, we need to make U, not B. + return False + else: + # Otherwise, force acceptance, even if we're across a sentence + # boundary or the token is whitespace. + return True + elif st.B_(1).ent_iob == 3: + # If the next word is B, we can't B now + return False + elif st.B_(1).sent_start == 1: + # Don't allow entities to extend across sentence boundaries + return False + # Don't allow entities to start on whitespace + elif Lexeme.get_struct_attr(st.B_(0).lex, IS_SPACE): + return False + else: + return True + + @staticmethod + cdef int transition(StateC* st, attr_t label) noexcept nogil: + st.open_ent(label) + st.push() + st.pop() + + @staticmethod + cdef weight_t cost(const StateC* s, const void* _gold, attr_t label) noexcept nogil: + gold = _gold + b0 = s.B(0) + cdef int cost = 0 + cdef int g_act = gold.ner[b0].move + cdef attr_t g_tag = gold.ner[b0].label + + if g_act == MISSING: + pass + elif g_act == BEGIN: + # B, Gold B --> Label match + cost += label != g_tag + else: + # B, Gold I --> False (P) + # B, Gold L --> False (P) + # B, Gold O --> False (P) + # B, Gold U --> False (P) + cost += 1 + if s.buffer_length() < 3: + # Handle negatives. In general we can't really do much to block + # B, because we don't know whether the whole entity is going to + # be correct or not. However, we can at least tell whether we're + # going to be opening an entity where there's only one possible + # L. + for span in gold.negs[:gold.nr_neg]: + if span.label == label and span.start == b0: + cost += 1 + break + return cost + + +cdef class In: + @staticmethod + cdef bint is_valid(const StateC* st, attr_t label) noexcept nogil: + if not st.entity_is_open(): + return False + if st.buffer_length() < 2: + # If we're at the end, we can't I. + return False + ent = st.get_ent() + cdef int preset_ent_iob = st.B_(0).ent_iob + cdef attr_t preset_ent_label = st.B_(0).ent_type + if label == 0: + return False + elif ent.label != label: + return False + elif preset_ent_iob == 3: + return False + elif st.B_(1).ent_iob == 3: + # If we know the next word is B, we can't be I (must be L) + return False + elif preset_ent_iob == 1: + if st.B_(1).ent_iob in (0, 2): + # if next preset is missing or O, this can't be I (must be L) + return False + elif label != preset_ent_label: + # If label isn't right, reject + return False + else: + # Otherwise, force acceptance, even if we're across a sentence + # boundary or the token is whitespace. + return True + elif st.B(1) != -1 and st.B_(1).sent_start == 1: + # Don't allow entities to extend across sentence boundaries + return False + else: + return True + + @staticmethod + cdef int transition(StateC* st, attr_t label) noexcept nogil: + st.push() + st.pop() + + @staticmethod + cdef weight_t cost(const StateC* s, const void* _gold, attr_t label) noexcept nogil: + gold = _gold + cdef int next_act = gold.ner[s.B(1)].move if s.B(1) >= 0 else OUT + cdef int g_act = gold.ner[s.B(0)].move + cdef bint is_sunk = _entity_is_sunk(s, gold.ner) + + if g_act == MISSING: + return 0 + elif g_act == BEGIN: + # I, Gold B --> True + # (P of bad open entity sunk, R of this entity sunk) + return 0 + elif g_act == IN: + # I, Gold I --> True + # (label forced by prev, if mismatch, P and R both sunk) + return 0 + elif g_act == LAST: + # I, Gold L --> True iff this entity sunk and next tag == O + return not (is_sunk and (next_act == OUT or next_act == MISSING)) + elif g_act == OUT: + # I, Gold O --> True iff next tag == O + return not (next_act == OUT or next_act == MISSING) + elif g_act == UNIT: + # I, Gold U --> True iff next tag == O + return next_act != OUT + else: + return 1 + +cdef class Last: + @staticmethod + cdef bint is_valid(const StateC* st, attr_t label) noexcept nogil: + cdef int preset_ent_iob = st.B_(0).ent_iob + cdef attr_t preset_ent_label = st.B_(0).ent_type + if label == 0: + return False + elif not st.entity_is_open(): + return False + elif preset_ent_iob == 1 and st.B_(1).ent_iob != 1: + # If a preset entity has I followed by not-I, is L + if label != preset_ent_label: + # If label isn't right, reject + return False + else: + # Otherwise, force acceptance, even if we're across a sentence + # boundary or the token is whitespace. + return True + elif st.get_ent().label != label: + return False + elif st.B_(1).ent_iob == 1: + # If a preset entity has I next, we can't L here. + return False + else: + return True + + @staticmethod + cdef int transition(StateC* st, attr_t label) noexcept nogil: + st.close_ent() + st.push() + st.pop() + + @staticmethod + cdef weight_t cost(const StateC* s, const void* _gold, attr_t label) noexcept nogil: + gold = _gold + b0 = s.B(0) + ent_start = s.E(0) + + cdef int g_act = gold.ner[b0].move + + cdef int cost = 0 + + if g_act == MISSING: + pass + elif g_act == BEGIN: + # L, Gold B --> True + pass + elif g_act == IN: + # L, Gold I --> True iff this entity sunk + cost += not _entity_is_sunk(s, gold.ner) + elif g_act == LAST: + # L, Gold L --> True + pass + elif g_act == OUT: + # L, Gold O --> True + pass + elif g_act == UNIT: + # L, Gold U --> True + pass + else: + cost += 1 + # If we have negative-example entities, integrate them into the objective, + # by marking actions that close an entity that we know is incorrect + # as costly. + for span in gold.negs[:gold.nr_neg]: + if span.label == label and (span.end-1) == b0 and span.start == ent_start: + cost += 1 + break + return cost + + +cdef class Unit: + @staticmethod + cdef bint is_valid(const StateC* st, attr_t label) noexcept nogil: + cdef int preset_ent_iob = st.B_(0).ent_iob + cdef attr_t preset_ent_label = st.B_(0).ent_type + if label == 0: + # this is only allowed if it's a preset blocked annotation + if preset_ent_label == 0 and preset_ent_iob == 3: + return True + else: + return False + elif st.entity_is_open(): + return False + elif st.B_(1).ent_iob == 1: + # If next token is In, we can't be Unit -- must be Begin + return False + elif preset_ent_iob == 3: + # Okay, there's a preset entity here + if label != preset_ent_label: + # Require labels to match + return False + else: + # Otherwise return True, ignoring the whitespace constraint. + return True + elif Lexeme.get_struct_attr(st.B_(0).lex, IS_SPACE): + return False + else: + return True + + @staticmethod + cdef int transition(StateC* st, attr_t label) noexcept nogil: + st.open_ent(label) + st.close_ent() + st.push() + st.pop() + + @staticmethod + cdef weight_t cost(const StateC* s, const void* _gold, attr_t label) noexcept nogil: + gold = _gold + cdef int g_act = gold.ner[s.B(0)].move + cdef attr_t g_tag = gold.ner[s.B(0)].label + cdef int cost = 0 + + if g_act == MISSING: + pass + elif g_act == UNIT: + # U, Gold U --> True iff tag match + cost += label != g_tag + else: + # U, Gold B --> False + # U, Gold I --> False + # U, Gold L --> False + # U, Gold O --> False + cost += 1 + # If we have negative-example entities, integrate them into the objective. + # This is fairly straight-forward for U- entities, as we have a single + # action + cdef int b0 = s.B(0) + for span in gold.negs[:gold.nr_neg]: + if span.label == label and span.start == b0 and span.end == (b0+1): + cost += 1 + break + return cost + + +cdef class Out: + @staticmethod + cdef bint is_valid(const StateC* st, attr_t label) noexcept nogil: + cdef int preset_ent_iob = st.B_(0).ent_iob + if st.entity_is_open(): + return False + elif preset_ent_iob == 3: + return False + elif preset_ent_iob == 1: + return False + else: + return True + + @staticmethod + cdef int transition(StateC* st, attr_t label) noexcept nogil: + st.push() + st.pop() + + @staticmethod + cdef weight_t cost(const StateC* s, const void* _gold, attr_t label) noexcept nogil: + gold = _gold + cdef int g_act = gold.ner[s.B(0)].move + cdef weight_t cost = 0 + if g_act == MISSING: + pass + elif g_act == BEGIN: + # O, Gold B --> False + cost += 1 + elif g_act == IN: + # O, Gold I --> True + pass + elif g_act == LAST: + # O, Gold L --> True + pass + elif g_act == OUT: + # O, Gold O --> True + pass + elif g_act == UNIT: + # O, Gold U --> False + cost += 1 + else: + cost += 1 + return cost diff --git a/TTS/Kokoro/.venv/Lib/site-packages/spacy/pipeline/_parser_internals/nonproj.cpp b/TTS/Kokoro/.venv/Lib/site-packages/spacy/pipeline/_parser_internals/nonproj.cpp new file mode 100644 index 0000000000000000000000000000000000000000..1531df044bb8b9ee3d53c49836fecc124b7ff7f7 --- /dev/null +++ b/TTS/Kokoro/.venv/Lib/site-packages/spacy/pipeline/_parser_internals/nonproj.cpp @@ -0,0 +1,38542 @@ +/* Generated by Cython 3.2.1 */ + +/* BEGIN: Cython Metadata +{ + "distutils": { + "depends": [ + "C:\\Users\\runneradmin\\AppData\\Local\\Temp\\build-env-ej_q3m8u\\Lib\\site-packages\\numpy\\_core\\include\\numpy\\arrayobject.h", + "C:\\Users\\runneradmin\\AppData\\Local\\Temp\\build-env-ej_q3m8u\\Lib\\site-packages\\numpy\\_core\\include\\numpy\\arrayscalars.h", + "C:\\Users\\runneradmin\\AppData\\Local\\Temp\\build-env-ej_q3m8u\\Lib\\site-packages\\numpy\\_core\\include\\numpy\\ndarrayobject.h", + "C:\\Users\\runneradmin\\AppData\\Local\\Temp\\build-env-ej_q3m8u\\Lib\\site-packages\\numpy\\_core\\include\\numpy\\ndarraytypes.h", + "C:\\Users\\runneradmin\\AppData\\Local\\Temp\\build-env-ej_q3m8u\\Lib\\site-packages\\numpy\\_core\\include\\numpy\\ufuncobject.h", + "C:\\Users\\runneradmin\\AppData\\Local\\pypa\\cibuildwheel\\Cache\\nuget-cpython\\python.3.12.10\\tools\\Include\\Python.h", + "spacy\\pipeline\\_parser_internals\\nonproj.hh" + ], + "extra_compile_args": [ + "-std=c++11" + ], + "include_dirs": [ + "spacy/pipeline/_parser_internals", + "C:\\Users\\runneradmin\\AppData\\Local\\Temp\\build-env-ej_q3m8u\\Lib\\site-packages\\numpy\\_core\\include", + "C:\\Users\\runneradmin\\AppData\\Local\\pypa\\cibuildwheel\\Cache\\nuget-cpython\\python.3.12.10\\tools\\Include" + ], + "language": "c++", + "name": "spacy.pipeline._parser_internals.nonproj", + "sources": [ + "spacy/pipeline/_parser_internals/nonproj.pyx" + ] + }, + "module_name": "spacy.pipeline._parser_internals.nonproj" +} +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_1" +#define CYTHON_HEX_VERSION 0x030201F0 +#define CYTHON_FUTURE_DIVISION 0 +/* 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)) + +/* CppInitCode */ +#ifndef __cplusplus + #error "Cython files generated with the C++ option must be compiled with a C++ compiler." +#endif +#ifndef CYTHON_INLINE + #if defined(__clang__) + #define CYTHON_INLINE __inline__ __attribute__ ((__unused__)) + #else + #define CYTHON_INLINE inline + #endif +#endif +template +void __Pyx_call_destructor(T& x) { + x.~T(); +} +template +class __Pyx_FakeReference { + public: + __Pyx_FakeReference() : ptr(NULL) { } + __Pyx_FakeReference(const T& ref) : ptr(const_cast(&ref)) { } + T *operator->() { return ptr; } + T *operator&() { return ptr; } + operator T&() { return *ptr; } + template bool operator ==(const U& other) const { return *ptr == other; } + template bool operator !=(const U& other) const { return *ptr != other; } + template bool operator==(const __Pyx_FakeReference& other) const { return *ptr == *other.ptr; } + template bool operator!=(const __Pyx_FakeReference& other) const { return *ptr != *other.ptr; } + private: + T *ptr; +}; + +/* 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 + #define __PYX_EXTERN_C extern "C++" +#endif + +#define __PYX_HAVE__spacy__pipeline___parser_internals__nonproj +#define __PYX_HAVE_API__spacy__pipeline___parser_internals__nonproj +/* Early includes */ +#include +#include +#include "ios" +#include "new" +#include "stdexcept" +#include "typeinfo" +#include +#include "nonproj.hh" +#include +#include +#include + + #if __cplusplus >= 201103L || (defined(_MSC_VER) && _MSC_VER >= 1600) + // move should be defined for these versions of MSVC, but __cplusplus isn't set usefully + #include + + namespace cython_std { + template typename std::remove_reference::type&& move(T& t) noexcept { return std::move(t); } + template typename std::remove_reference::type&& move(T&& t) noexcept { return std::move(t); } + } + + #endif + +#include +#include +#include + + /* Using NumPy API declarations from "numpy/__init__.cython-30.pxd" */ + +#include "numpy/arrayobject.h" +#include "numpy/ndarrayobject.h" +#include "numpy/ndarraytypes.h" +#include "numpy/arrayscalars.h" +#include "numpy/ufuncobject.h" +#include +#include +#include +#include "pythread.h" +#ifdef _OPENMP +#include +#endif /* _OPENMP */ + +#if defined(PYREX_WITHOUT_ASSERTIONS) && !defined(CYTHON_WITHOUT_ASSERTIONS) +#define CYTHON_WITHOUT_ASSERTIONS +#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; + +/* Header.proto */ +#if !defined(CYTHON_CCOMPLEX) + #if defined(__cplusplus) + #define CYTHON_CCOMPLEX 1 + #elif (defined(_Complex_I) && !defined(_MSC_VER)) || ((defined (__STDC_VERSION__) && __STDC_VERSION__ >= 201112L) && !defined(__STDC_NO_COMPLEX__) && !defined(_MSC_VER)) + #define CYTHON_CCOMPLEX 1 + #else + #define CYTHON_CCOMPLEX 0 + #endif +#endif +#if CYTHON_CCOMPLEX + #ifdef __cplusplus + #include + #else + #include + #endif +#endif +#if CYTHON_CCOMPLEX && !defined(__cplusplus) && defined(__sun__) && defined(__GNUC__) + #undef _Complex_I + #define _Complex_I 1.0fj +#endif + +/* #### Code section: filename_table ### */ + +static const char* const __pyx_f[] = { + "spacy/pipeline/_parser_internals/nonproj.pyx", + "", + "C:/Users/runneradmin/AppData/Local/Temp/build-env-ej_q3m8u/Lib/site-packages/numpy/__init__.cython-30.pxd", + "cpython/type.pxd", + "cymem/cymem.pxd", + "preshed/maps.pxd", + "spacy/strings.pxd", + "spacy/morphology.pxd", + "spacy/vocab.pxd", + "spacy/tokens/doc.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 + +/* ForceInitThreads.proto */ +#ifndef __PYX_FORCE_INIT_THREADS + #define __PYX_FORCE_INIT_THREADS 0 +#endif + +/* NoFastGil.proto */ +#define __Pyx_PyGILState_Ensure PyGILState_Ensure +#define __Pyx_PyGILState_Release PyGILState_Release +#define __Pyx_FastGIL_Remember() +#define __Pyx_FastGIL_Forget() +#define __Pyx_FastGilFuncInit() + +/* IncludeStructmemberH.proto (used by FixUpExtensionType) */ +#include + +/* BufferFormatStructs.proto */ +struct __Pyx_StructField_; +#define __PYX_BUF_FLAGS_PACKED_STRUCT (1 << 0) +typedef struct { + const char* name; + const struct __Pyx_StructField_* fields; + size_t size; + size_t arraysize[8]; + int ndim; + char typegroup; + char is_unsigned; + int flags; +} __Pyx_TypeInfo; +typedef struct __Pyx_StructField_ { + const __Pyx_TypeInfo* type; + const char* name; + size_t offset; +} __Pyx_StructField; +typedef struct { + const __Pyx_StructField* field; + size_t parent_offset; +} __Pyx_BufFmt_StackElem; +typedef struct { + __Pyx_StructField root; + __Pyx_BufFmt_StackElem* head; + size_t fmt_offset; + size_t new_count, enc_count; + size_t struct_alignment; + int is_complex; + char enc_type; + char new_packmode; + char enc_packmode; + char is_valid_array; +} __Pyx_BufFmt_Context; + +/* MemviewSliceStruct.proto */ +struct __pyx_memoryview_obj; +typedef struct { + struct __pyx_memoryview_obj *memview; + char *data; + Py_ssize_t shape[8]; + Py_ssize_t strides[8]; + Py_ssize_t suboffsets[8]; +} __Pyx_memviewslice; +#define __Pyx_MemoryView_Len(m) (m.shape[0]) +#define __Pyx_MEMVIEW_DIRECT 1 +#define __Pyx_MEMVIEW_PTR 2 +#define __Pyx_MEMVIEW_FULL 4 +#define __Pyx_MEMVIEW_CONTIG 8 +#define __Pyx_MEMVIEW_STRIDED 16 +#define __Pyx_MEMVIEW_FOLLOW 32 +#define __Pyx_IS_C_CONTIG 1 +#define __Pyx_IS_F_CONTIG 2 +#define __Pyx_MEMSLICE_INIT { 0, 0, { 0 }, { 0 }, { 0 } } +#if CYTHON_ATOMICS + #define __pyx_add_acquisition_count(memview)\ + __pyx_atomic_incr_relaxed(__pyx_get_slice_count_pointer(memview)) + #define __pyx_sub_acquisition_count(memview)\ + __pyx_atomic_decr_acq_rel(__pyx_get_slice_count_pointer(memview)) +#else + #define __pyx_add_acquisition_count(memview)\ + __pyx_add_acquisition_count_locked(__pyx_get_slice_count_pointer(memview), memview->lock) + #define __pyx_sub_acquisition_count(memview)\ + __pyx_sub_acquisition_count_locked(__pyx_get_slice_count_pointer(memview), memview->lock) +#endif + +/* #### Code section: numeric_typedefs ### */ + +/* "C:/Users/runneradmin/AppData/Local/Temp/build-env-ej_q3m8u/Lib/site-packages/numpy/__init__.cython-30.pxd":743 + * # in Cython to enable them only on the right systems. + * + * ctypedef npy_int8 int8_t # <<<<<<<<<<<<<< + * ctypedef npy_int16 int16_t + * ctypedef npy_int32 int32_t +*/ +typedef npy_int8 __pyx_t_5numpy_int8_t; + +/* "C:/Users/runneradmin/AppData/Local/Temp/build-env-ej_q3m8u/Lib/site-packages/numpy/__init__.cython-30.pxd":744 + * + * ctypedef npy_int8 int8_t + * ctypedef npy_int16 int16_t # <<<<<<<<<<<<<< + * ctypedef npy_int32 int32_t + * ctypedef npy_int64 int64_t +*/ +typedef npy_int16 __pyx_t_5numpy_int16_t; + +/* "C:/Users/runneradmin/AppData/Local/Temp/build-env-ej_q3m8u/Lib/site-packages/numpy/__init__.cython-30.pxd":745 + * ctypedef npy_int8 int8_t + * ctypedef npy_int16 int16_t + * ctypedef npy_int32 int32_t # <<<<<<<<<<<<<< + * ctypedef npy_int64 int64_t + * +*/ +typedef npy_int32 __pyx_t_5numpy_int32_t; + +/* "C:/Users/runneradmin/AppData/Local/Temp/build-env-ej_q3m8u/Lib/site-packages/numpy/__init__.cython-30.pxd":746 + * ctypedef npy_int16 int16_t + * ctypedef npy_int32 int32_t + * ctypedef npy_int64 int64_t # <<<<<<<<<<<<<< + * + * ctypedef npy_uint8 uint8_t +*/ +typedef npy_int64 __pyx_t_5numpy_int64_t; + +/* "C:/Users/runneradmin/AppData/Local/Temp/build-env-ej_q3m8u/Lib/site-packages/numpy/__init__.cython-30.pxd":748 + * ctypedef npy_int64 int64_t + * + * ctypedef npy_uint8 uint8_t # <<<<<<<<<<<<<< + * ctypedef npy_uint16 uint16_t + * ctypedef npy_uint32 uint32_t +*/ +typedef npy_uint8 __pyx_t_5numpy_uint8_t; + +/* "C:/Users/runneradmin/AppData/Local/Temp/build-env-ej_q3m8u/Lib/site-packages/numpy/__init__.cython-30.pxd":749 + * + * ctypedef npy_uint8 uint8_t + * ctypedef npy_uint16 uint16_t # <<<<<<<<<<<<<< + * ctypedef npy_uint32 uint32_t + * ctypedef npy_uint64 uint64_t +*/ +typedef npy_uint16 __pyx_t_5numpy_uint16_t; + +/* "C:/Users/runneradmin/AppData/Local/Temp/build-env-ej_q3m8u/Lib/site-packages/numpy/__init__.cython-30.pxd":750 + * ctypedef npy_uint8 uint8_t + * ctypedef npy_uint16 uint16_t + * ctypedef npy_uint32 uint32_t # <<<<<<<<<<<<<< + * ctypedef npy_uint64 uint64_t + * +*/ +typedef npy_uint32 __pyx_t_5numpy_uint32_t; + +/* "C:/Users/runneradmin/AppData/Local/Temp/build-env-ej_q3m8u/Lib/site-packages/numpy/__init__.cython-30.pxd":751 + * ctypedef npy_uint16 uint16_t + * ctypedef npy_uint32 uint32_t + * ctypedef npy_uint64 uint64_t # <<<<<<<<<<<<<< + * + * ctypedef npy_float32 float32_t +*/ +typedef npy_uint64 __pyx_t_5numpy_uint64_t; + +/* "C:/Users/runneradmin/AppData/Local/Temp/build-env-ej_q3m8u/Lib/site-packages/numpy/__init__.cython-30.pxd":753 + * ctypedef npy_uint64 uint64_t + * + * ctypedef npy_float32 float32_t # <<<<<<<<<<<<<< + * ctypedef npy_float64 float64_t + * #ctypedef npy_float80 float80_t +*/ +typedef npy_float32 __pyx_t_5numpy_float32_t; + +/* "C:/Users/runneradmin/AppData/Local/Temp/build-env-ej_q3m8u/Lib/site-packages/numpy/__init__.cython-30.pxd":754 + * + * ctypedef npy_float32 float32_t + * ctypedef npy_float64 float64_t # <<<<<<<<<<<<<< + * #ctypedef npy_float80 float80_t + * #ctypedef npy_float128 float128_t +*/ +typedef npy_float64 __pyx_t_5numpy_float64_t; + +/* "C:/Users/runneradmin/AppData/Local/Temp/build-env-ej_q3m8u/Lib/site-packages/numpy/__init__.cython-30.pxd":761 + * ctypedef double complex complex128_t + * + * ctypedef npy_longlong longlong_t # <<<<<<<<<<<<<< + * ctypedef npy_ulonglong ulonglong_t + * +*/ +typedef npy_longlong __pyx_t_5numpy_longlong_t; + +/* "C:/Users/runneradmin/AppData/Local/Temp/build-env-ej_q3m8u/Lib/site-packages/numpy/__init__.cython-30.pxd":762 + * + * ctypedef npy_longlong longlong_t + * ctypedef npy_ulonglong ulonglong_t # <<<<<<<<<<<<<< + * + * ctypedef npy_intp intp_t +*/ +typedef npy_ulonglong __pyx_t_5numpy_ulonglong_t; + +/* "C:/Users/runneradmin/AppData/Local/Temp/build-env-ej_q3m8u/Lib/site-packages/numpy/__init__.cython-30.pxd":764 + * ctypedef npy_ulonglong ulonglong_t + * + * ctypedef npy_intp intp_t # <<<<<<<<<<<<<< + * ctypedef npy_uintp uintp_t + * +*/ +typedef npy_intp __pyx_t_5numpy_intp_t; + +/* "C:/Users/runneradmin/AppData/Local/Temp/build-env-ej_q3m8u/Lib/site-packages/numpy/__init__.cython-30.pxd":765 + * + * ctypedef npy_intp intp_t + * ctypedef npy_uintp uintp_t # <<<<<<<<<<<<<< + * + * ctypedef npy_double float_t +*/ +typedef npy_uintp __pyx_t_5numpy_uintp_t; + +/* "C:/Users/runneradmin/AppData/Local/Temp/build-env-ej_q3m8u/Lib/site-packages/numpy/__init__.cython-30.pxd":767 + * ctypedef npy_uintp uintp_t + * + * ctypedef npy_double float_t # <<<<<<<<<<<<<< + * ctypedef npy_double double_t + * ctypedef npy_longdouble longdouble_t +*/ +typedef npy_double __pyx_t_5numpy_float_t; + +/* "C:/Users/runneradmin/AppData/Local/Temp/build-env-ej_q3m8u/Lib/site-packages/numpy/__init__.cython-30.pxd":768 + * + * ctypedef npy_double float_t + * ctypedef npy_double double_t # <<<<<<<<<<<<<< + * ctypedef npy_longdouble longdouble_t + * +*/ +typedef npy_double __pyx_t_5numpy_double_t; + +/* "C:/Users/runneradmin/AppData/Local/Temp/build-env-ej_q3m8u/Lib/site-packages/numpy/__init__.cython-30.pxd":769 + * ctypedef npy_double float_t + * ctypedef npy_double double_t + * ctypedef npy_longdouble longdouble_t # <<<<<<<<<<<<<< + * + * ctypedef float complex cfloat_t +*/ +typedef npy_longdouble __pyx_t_5numpy_longdouble_t; + +/* "typedefs.pxd":3 + * from libc.stdint cimport int32_t, uint8_t, uint16_t, uint32_t, uint64_t, uintptr_t + * + * ctypedef float weight_t # <<<<<<<<<<<<<< + * ctypedef uint64_t hash_t + * ctypedef uint64_t class_t +*/ +typedef float __pyx_t_5spacy_8typedefs_weight_t; + +/* "typedefs.pxd":4 + * + * ctypedef float weight_t + * ctypedef uint64_t hash_t # <<<<<<<<<<<<<< + * ctypedef uint64_t class_t + * ctypedef uint64_t attr_t +*/ +typedef uint64_t __pyx_t_5spacy_8typedefs_hash_t; + +/* "typedefs.pxd":5 + * ctypedef float weight_t + * ctypedef uint64_t hash_t + * ctypedef uint64_t class_t # <<<<<<<<<<<<<< + * ctypedef uint64_t attr_t + * ctypedef uint64_t flags_t +*/ +typedef uint64_t __pyx_t_5spacy_8typedefs_class_t; + +/* "typedefs.pxd":6 + * ctypedef uint64_t hash_t + * ctypedef uint64_t class_t + * ctypedef uint64_t attr_t # <<<<<<<<<<<<<< + * ctypedef uint64_t flags_t + * ctypedef uint16_t len_t +*/ +typedef uint64_t __pyx_t_5spacy_8typedefs_attr_t; + +/* "typedefs.pxd":7 + * ctypedef uint64_t class_t + * ctypedef uint64_t attr_t + * ctypedef uint64_t flags_t # <<<<<<<<<<<<<< + * ctypedef uint16_t len_t + * ctypedef uint16_t tag_t +*/ +typedef uint64_t __pyx_t_5spacy_8typedefs_flags_t; + +/* "typedefs.pxd":8 + * ctypedef uint64_t attr_t + * ctypedef uint64_t flags_t + * ctypedef uint16_t len_t # <<<<<<<<<<<<<< + * ctypedef uint16_t tag_t +*/ +typedef uint16_t __pyx_t_5spacy_8typedefs_len_t; + +/* "typedefs.pxd":9 + * ctypedef uint64_t flags_t + * ctypedef uint16_t len_t + * ctypedef uint16_t tag_t # <<<<<<<<<<<<<< +*/ +typedef uint16_t __pyx_t_5spacy_8typedefs_tag_t; + +/* "preshed/maps.pxd":5 + * + * + * ctypedef uint64_t key_t # <<<<<<<<<<<<<< + * + * +*/ +typedef uint64_t __pyx_t_7preshed_4maps_key_t; +/* #### Code section: complex_type_declarations ### */ +/* Declarations.proto */ +#if CYTHON_CCOMPLEX && (1) && (!0 || __cplusplus) + #ifdef __cplusplus + typedef ::std::complex< float > __pyx_t_float_complex; + #else + typedef float _Complex __pyx_t_float_complex; + #endif +#else + typedef struct { float real, imag; } __pyx_t_float_complex; +#endif +static CYTHON_INLINE __pyx_t_float_complex __pyx_t_float_complex_from_parts(float, float); + +/* Declarations.proto */ +#if CYTHON_CCOMPLEX && (1) && (!0 || __cplusplus) + #ifdef __cplusplus + typedef ::std::complex< double > __pyx_t_double_complex; + #else + typedef double _Complex __pyx_t_double_complex; + #endif +#else + typedef struct { double real, imag; } __pyx_t_double_complex; +#endif +static CYTHON_INLINE __pyx_t_double_complex __pyx_t_double_complex_from_parts(double, double); + +/* Declarations.proto */ +#if CYTHON_CCOMPLEX && (1) && (!0 || __cplusplus) + #ifdef __cplusplus + typedef ::std::complex< long double > __pyx_t_long_double_complex; + #else + typedef long double _Complex __pyx_t_long_double_complex; + #endif +#else + typedef struct { long double real, imag; } __pyx_t_long_double_complex; +#endif +static CYTHON_INLINE __pyx_t_long_double_complex __pyx_t_long_double_complex_from_parts(long double, long double); + +/* #### Code section: type_declarations ### */ + +/*--- Type declarations ---*/ +struct __pyx_obj_5cymem_5cymem_PyMalloc; +struct __pyx_obj_5cymem_5cymem_PyFree; +struct __pyx_obj_5cymem_5cymem_Pool; +struct __pyx_obj_5cymem_5cymem_Address; +struct __pyx_obj_7preshed_4maps_PreshMap; +struct __pyx_obj_7preshed_4maps_PreshMapArray; +struct __pyx_obj_5spacy_7strings_StringStore; +struct __pyx_obj_5spacy_10morphology_Morphology; +struct __pyx_obj_5spacy_5vocab_Vocab; +struct __pyx_obj_5spacy_6tokens_3doc_Doc; +struct __pyx_obj_5spacy_8pipeline_17_parser_internals_7nonproj___pyx_scope_struct__ancestors; +struct __pyx_obj_5spacy_8pipeline_17_parser_internals_7nonproj___pyx_scope_struct_1_is_nonproj_tree; +struct __pyx_obj_5spacy_8pipeline_17_parser_internals_7nonproj___pyx_scope_struct_2_genexpr; +struct __pyx_array_obj; +struct __pyx_MemviewEnum_obj; +struct __pyx_memoryview_obj; +struct __pyx_memoryviewslice_obj; + +/* "cymem/cymem.pxd":1 + * ctypedef void* (*malloc_t)(size_t n) # <<<<<<<<<<<<<< + * ctypedef void (*free_t)(void *p) + * +*/ +typedef void *(*__pyx_t_5cymem_5cymem_malloc_t)(size_t); + +/* "cymem/cymem.pxd":2 + * ctypedef void* (*malloc_t)(size_t n) + * ctypedef void (*free_t)(void *p) # <<<<<<<<<<<<<< + * + * cdef class PyMalloc: +*/ +typedef void (*__pyx_t_5cymem_5cymem_free_t)(void *); + +/* "symbols.pxd":1 + * cdef enum symbol_t: # <<<<<<<<<<<<<< + * NIL + * IS_ALPHA +*/ +enum __pyx_t_5spacy_7symbols_symbol_t { + __pyx_e_5spacy_7symbols_NIL, + __pyx_e_5spacy_7symbols_IS_ALPHA, + __pyx_e_5spacy_7symbols_IS_ASCII, + __pyx_e_5spacy_7symbols_IS_DIGIT, + __pyx_e_5spacy_7symbols_IS_LOWER, + __pyx_e_5spacy_7symbols_IS_PUNCT, + __pyx_e_5spacy_7symbols_IS_SPACE, + __pyx_e_5spacy_7symbols_IS_TITLE, + __pyx_e_5spacy_7symbols_IS_UPPER, + __pyx_e_5spacy_7symbols_LIKE_URL, + __pyx_e_5spacy_7symbols_LIKE_NUM, + __pyx_e_5spacy_7symbols_LIKE_EMAIL, + __pyx_e_5spacy_7symbols_IS_STOP, + __pyx_e_5spacy_7symbols_IS_OOV_DEPRECATED, + __pyx_e_5spacy_7symbols_IS_BRACKET, + __pyx_e_5spacy_7symbols_IS_QUOTE, + __pyx_e_5spacy_7symbols_IS_LEFT_PUNCT, + __pyx_e_5spacy_7symbols_IS_RIGHT_PUNCT, + __pyx_e_5spacy_7symbols_IS_CURRENCY, + __pyx_e_5spacy_7symbols_FLAG19 = 19, + __pyx_e_5spacy_7symbols_FLAG20, + __pyx_e_5spacy_7symbols_FLAG21, + __pyx_e_5spacy_7symbols_FLAG22, + __pyx_e_5spacy_7symbols_FLAG23, + __pyx_e_5spacy_7symbols_FLAG24, + __pyx_e_5spacy_7symbols_FLAG25, + __pyx_e_5spacy_7symbols_FLAG26, + __pyx_e_5spacy_7symbols_FLAG27, + __pyx_e_5spacy_7symbols_FLAG28, + __pyx_e_5spacy_7symbols_FLAG29, + __pyx_e_5spacy_7symbols_FLAG30, + __pyx_e_5spacy_7symbols_FLAG31, + __pyx_e_5spacy_7symbols_FLAG32, + __pyx_e_5spacy_7symbols_FLAG33, + __pyx_e_5spacy_7symbols_FLAG34, + __pyx_e_5spacy_7symbols_FLAG35, + __pyx_e_5spacy_7symbols_FLAG36, + __pyx_e_5spacy_7symbols_FLAG37, + __pyx_e_5spacy_7symbols_FLAG38, + __pyx_e_5spacy_7symbols_FLAG39, + __pyx_e_5spacy_7symbols_FLAG40, + __pyx_e_5spacy_7symbols_FLAG41, + __pyx_e_5spacy_7symbols_FLAG42, + __pyx_e_5spacy_7symbols_FLAG43, + __pyx_e_5spacy_7symbols_FLAG44, + __pyx_e_5spacy_7symbols_FLAG45, + __pyx_e_5spacy_7symbols_FLAG46, + __pyx_e_5spacy_7symbols_FLAG47, + __pyx_e_5spacy_7symbols_FLAG48, + __pyx_e_5spacy_7symbols_FLAG49, + __pyx_e_5spacy_7symbols_FLAG50, + __pyx_e_5spacy_7symbols_FLAG51, + __pyx_e_5spacy_7symbols_FLAG52, + __pyx_e_5spacy_7symbols_FLAG53, + __pyx_e_5spacy_7symbols_FLAG54, + __pyx_e_5spacy_7symbols_FLAG55, + __pyx_e_5spacy_7symbols_FLAG56, + __pyx_e_5spacy_7symbols_FLAG57, + __pyx_e_5spacy_7symbols_FLAG58, + __pyx_e_5spacy_7symbols_FLAG59, + __pyx_e_5spacy_7symbols_FLAG60, + __pyx_e_5spacy_7symbols_FLAG61, + __pyx_e_5spacy_7symbols_FLAG62, + __pyx_e_5spacy_7symbols_FLAG63, + __pyx_e_5spacy_7symbols_ID, + __pyx_e_5spacy_7symbols_ORTH, + __pyx_e_5spacy_7symbols_LOWER, + __pyx_e_5spacy_7symbols_NORM, + __pyx_e_5spacy_7symbols_SHAPE, + __pyx_e_5spacy_7symbols_PREFIX, + __pyx_e_5spacy_7symbols_SUFFIX, + __pyx_e_5spacy_7symbols_LENGTH, + __pyx_e_5spacy_7symbols_CLUSTER, + __pyx_e_5spacy_7symbols_LEMMA, + __pyx_e_5spacy_7symbols_POS, + __pyx_e_5spacy_7symbols_TAG, + __pyx_e_5spacy_7symbols_DEP, + __pyx_e_5spacy_7symbols_ENT_IOB, + __pyx_e_5spacy_7symbols_ENT_TYPE, + __pyx_e_5spacy_7symbols_HEAD, + __pyx_e_5spacy_7symbols_SENT_START, + __pyx_e_5spacy_7symbols_SPACY, + __pyx_e_5spacy_7symbols_PROB, + __pyx_e_5spacy_7symbols_LANG, + __pyx_e_5spacy_7symbols_ADJ, + __pyx_e_5spacy_7symbols_ADP, + __pyx_e_5spacy_7symbols_ADV, + __pyx_e_5spacy_7symbols_AUX, + __pyx_e_5spacy_7symbols_CONJ, + __pyx_e_5spacy_7symbols_CCONJ, + __pyx_e_5spacy_7symbols_DET, + __pyx_e_5spacy_7symbols_INTJ, + __pyx_e_5spacy_7symbols_NOUN, + __pyx_e_5spacy_7symbols_NUM, + __pyx_e_5spacy_7symbols_PART, + __pyx_e_5spacy_7symbols_PRON, + __pyx_e_5spacy_7symbols_PROPN, + __pyx_e_5spacy_7symbols_PUNCT, + __pyx_e_5spacy_7symbols_SCONJ, + __pyx_e_5spacy_7symbols_SYM, + __pyx_e_5spacy_7symbols_VERB, + __pyx_e_5spacy_7symbols_X, + __pyx_e_5spacy_7symbols_EOL, + __pyx_e_5spacy_7symbols_SPACE, + __pyx_e_5spacy_7symbols_DEPRECATED001, + __pyx_e_5spacy_7symbols_DEPRECATED002, + __pyx_e_5spacy_7symbols_DEPRECATED003, + __pyx_e_5spacy_7symbols_DEPRECATED004, + __pyx_e_5spacy_7symbols_DEPRECATED005, + __pyx_e_5spacy_7symbols_DEPRECATED006, + __pyx_e_5spacy_7symbols_DEPRECATED007, + __pyx_e_5spacy_7symbols_DEPRECATED008, + __pyx_e_5spacy_7symbols_DEPRECATED009, + __pyx_e_5spacy_7symbols_DEPRECATED010, + __pyx_e_5spacy_7symbols_DEPRECATED011, + __pyx_e_5spacy_7symbols_DEPRECATED012, + __pyx_e_5spacy_7symbols_DEPRECATED013, + __pyx_e_5spacy_7symbols_DEPRECATED014, + __pyx_e_5spacy_7symbols_DEPRECATED015, + __pyx_e_5spacy_7symbols_DEPRECATED016, + __pyx_e_5spacy_7symbols_DEPRECATED017, + __pyx_e_5spacy_7symbols_DEPRECATED018, + __pyx_e_5spacy_7symbols_DEPRECATED019, + __pyx_e_5spacy_7symbols_DEPRECATED020, + __pyx_e_5spacy_7symbols_DEPRECATED021, + __pyx_e_5spacy_7symbols_DEPRECATED022, + __pyx_e_5spacy_7symbols_DEPRECATED023, + __pyx_e_5spacy_7symbols_DEPRECATED024, + __pyx_e_5spacy_7symbols_DEPRECATED025, + __pyx_e_5spacy_7symbols_DEPRECATED026, + __pyx_e_5spacy_7symbols_DEPRECATED027, + __pyx_e_5spacy_7symbols_DEPRECATED028, + __pyx_e_5spacy_7symbols_DEPRECATED029, + __pyx_e_5spacy_7symbols_DEPRECATED030, + __pyx_e_5spacy_7symbols_DEPRECATED031, + __pyx_e_5spacy_7symbols_DEPRECATED032, + __pyx_e_5spacy_7symbols_DEPRECATED033, + __pyx_e_5spacy_7symbols_DEPRECATED034, + __pyx_e_5spacy_7symbols_DEPRECATED035, + __pyx_e_5spacy_7symbols_DEPRECATED036, + __pyx_e_5spacy_7symbols_DEPRECATED037, + __pyx_e_5spacy_7symbols_DEPRECATED038, + __pyx_e_5spacy_7symbols_DEPRECATED039, + __pyx_e_5spacy_7symbols_DEPRECATED040, + __pyx_e_5spacy_7symbols_DEPRECATED041, + __pyx_e_5spacy_7symbols_DEPRECATED042, + __pyx_e_5spacy_7symbols_DEPRECATED043, + __pyx_e_5spacy_7symbols_DEPRECATED044, + __pyx_e_5spacy_7symbols_DEPRECATED045, + __pyx_e_5spacy_7symbols_DEPRECATED046, + __pyx_e_5spacy_7symbols_DEPRECATED047, + __pyx_e_5spacy_7symbols_DEPRECATED048, + __pyx_e_5spacy_7symbols_DEPRECATED049, + __pyx_e_5spacy_7symbols_DEPRECATED050, + __pyx_e_5spacy_7symbols_DEPRECATED051, + __pyx_e_5spacy_7symbols_DEPRECATED052, + __pyx_e_5spacy_7symbols_DEPRECATED053, + __pyx_e_5spacy_7symbols_DEPRECATED054, + __pyx_e_5spacy_7symbols_DEPRECATED055, + __pyx_e_5spacy_7symbols_DEPRECATED056, + __pyx_e_5spacy_7symbols_DEPRECATED057, + __pyx_e_5spacy_7symbols_DEPRECATED058, + __pyx_e_5spacy_7symbols_DEPRECATED059, + __pyx_e_5spacy_7symbols_DEPRECATED060, + __pyx_e_5spacy_7symbols_DEPRECATED061, + __pyx_e_5spacy_7symbols_DEPRECATED062, + __pyx_e_5spacy_7symbols_DEPRECATED063, + __pyx_e_5spacy_7symbols_DEPRECATED064, + __pyx_e_5spacy_7symbols_DEPRECATED065, + __pyx_e_5spacy_7symbols_DEPRECATED066, + __pyx_e_5spacy_7symbols_DEPRECATED067, + __pyx_e_5spacy_7symbols_DEPRECATED068, + __pyx_e_5spacy_7symbols_DEPRECATED069, + __pyx_e_5spacy_7symbols_DEPRECATED070, + __pyx_e_5spacy_7symbols_DEPRECATED071, + __pyx_e_5spacy_7symbols_DEPRECATED072, + __pyx_e_5spacy_7symbols_DEPRECATED073, + __pyx_e_5spacy_7symbols_DEPRECATED074, + __pyx_e_5spacy_7symbols_DEPRECATED075, + __pyx_e_5spacy_7symbols_DEPRECATED076, + __pyx_e_5spacy_7symbols_DEPRECATED077, + __pyx_e_5spacy_7symbols_DEPRECATED078, + __pyx_e_5spacy_7symbols_DEPRECATED079, + __pyx_e_5spacy_7symbols_DEPRECATED080, + __pyx_e_5spacy_7symbols_DEPRECATED081, + __pyx_e_5spacy_7symbols_DEPRECATED082, + __pyx_e_5spacy_7symbols_DEPRECATED083, + __pyx_e_5spacy_7symbols_DEPRECATED084, + __pyx_e_5spacy_7symbols_DEPRECATED085, + __pyx_e_5spacy_7symbols_DEPRECATED086, + __pyx_e_5spacy_7symbols_DEPRECATED087, + __pyx_e_5spacy_7symbols_DEPRECATED088, + __pyx_e_5spacy_7symbols_DEPRECATED089, + __pyx_e_5spacy_7symbols_DEPRECATED090, + __pyx_e_5spacy_7symbols_DEPRECATED091, + __pyx_e_5spacy_7symbols_DEPRECATED092, + __pyx_e_5spacy_7symbols_DEPRECATED093, + __pyx_e_5spacy_7symbols_DEPRECATED094, + __pyx_e_5spacy_7symbols_DEPRECATED095, + __pyx_e_5spacy_7symbols_DEPRECATED096, + __pyx_e_5spacy_7symbols_DEPRECATED097, + __pyx_e_5spacy_7symbols_DEPRECATED098, + __pyx_e_5spacy_7symbols_DEPRECATED099, + __pyx_e_5spacy_7symbols_DEPRECATED100, + __pyx_e_5spacy_7symbols_DEPRECATED101, + __pyx_e_5spacy_7symbols_DEPRECATED102, + __pyx_e_5spacy_7symbols_DEPRECATED103, + __pyx_e_5spacy_7symbols_DEPRECATED104, + __pyx_e_5spacy_7symbols_DEPRECATED105, + __pyx_e_5spacy_7symbols_DEPRECATED106, + __pyx_e_5spacy_7symbols_DEPRECATED107, + __pyx_e_5spacy_7symbols_DEPRECATED108, + __pyx_e_5spacy_7symbols_DEPRECATED109, + __pyx_e_5spacy_7symbols_DEPRECATED110, + __pyx_e_5spacy_7symbols_DEPRECATED111, + __pyx_e_5spacy_7symbols_DEPRECATED112, + __pyx_e_5spacy_7symbols_DEPRECATED113, + __pyx_e_5spacy_7symbols_DEPRECATED114, + __pyx_e_5spacy_7symbols_DEPRECATED115, + __pyx_e_5spacy_7symbols_DEPRECATED116, + __pyx_e_5spacy_7symbols_DEPRECATED117, + __pyx_e_5spacy_7symbols_DEPRECATED118, + __pyx_e_5spacy_7symbols_DEPRECATED119, + __pyx_e_5spacy_7symbols_DEPRECATED120, + __pyx_e_5spacy_7symbols_DEPRECATED121, + __pyx_e_5spacy_7symbols_DEPRECATED122, + __pyx_e_5spacy_7symbols_DEPRECATED123, + __pyx_e_5spacy_7symbols_DEPRECATED124, + __pyx_e_5spacy_7symbols_DEPRECATED125, + __pyx_e_5spacy_7symbols_DEPRECATED126, + __pyx_e_5spacy_7symbols_DEPRECATED127, + __pyx_e_5spacy_7symbols_DEPRECATED128, + __pyx_e_5spacy_7symbols_DEPRECATED129, + __pyx_e_5spacy_7symbols_DEPRECATED130, + __pyx_e_5spacy_7symbols_DEPRECATED131, + __pyx_e_5spacy_7symbols_DEPRECATED132, + __pyx_e_5spacy_7symbols_DEPRECATED133, + __pyx_e_5spacy_7symbols_DEPRECATED134, + __pyx_e_5spacy_7symbols_DEPRECATED135, + __pyx_e_5spacy_7symbols_DEPRECATED136, + __pyx_e_5spacy_7symbols_DEPRECATED137, + __pyx_e_5spacy_7symbols_DEPRECATED138, + __pyx_e_5spacy_7symbols_DEPRECATED139, + __pyx_e_5spacy_7symbols_DEPRECATED140, + __pyx_e_5spacy_7symbols_DEPRECATED141, + __pyx_e_5spacy_7symbols_DEPRECATED142, + __pyx_e_5spacy_7symbols_DEPRECATED143, + __pyx_e_5spacy_7symbols_DEPRECATED144, + __pyx_e_5spacy_7symbols_DEPRECATED145, + __pyx_e_5spacy_7symbols_DEPRECATED146, + __pyx_e_5spacy_7symbols_DEPRECATED147, + __pyx_e_5spacy_7symbols_DEPRECATED148, + __pyx_e_5spacy_7symbols_DEPRECATED149, + __pyx_e_5spacy_7symbols_DEPRECATED150, + __pyx_e_5spacy_7symbols_DEPRECATED151, + __pyx_e_5spacy_7symbols_DEPRECATED152, + __pyx_e_5spacy_7symbols_DEPRECATED153, + __pyx_e_5spacy_7symbols_DEPRECATED154, + __pyx_e_5spacy_7symbols_DEPRECATED155, + __pyx_e_5spacy_7symbols_DEPRECATED156, + __pyx_e_5spacy_7symbols_DEPRECATED157, + __pyx_e_5spacy_7symbols_DEPRECATED158, + __pyx_e_5spacy_7symbols_DEPRECATED159, + __pyx_e_5spacy_7symbols_DEPRECATED160, + __pyx_e_5spacy_7symbols_DEPRECATED161, + __pyx_e_5spacy_7symbols_DEPRECATED162, + __pyx_e_5spacy_7symbols_DEPRECATED163, + __pyx_e_5spacy_7symbols_DEPRECATED164, + __pyx_e_5spacy_7symbols_DEPRECATED165, + __pyx_e_5spacy_7symbols_DEPRECATED166, + __pyx_e_5spacy_7symbols_DEPRECATED167, + __pyx_e_5spacy_7symbols_DEPRECATED168, + __pyx_e_5spacy_7symbols_DEPRECATED169, + __pyx_e_5spacy_7symbols_DEPRECATED170, + __pyx_e_5spacy_7symbols_DEPRECATED171, + __pyx_e_5spacy_7symbols_DEPRECATED172, + __pyx_e_5spacy_7symbols_DEPRECATED173, + __pyx_e_5spacy_7symbols_DEPRECATED174, + __pyx_e_5spacy_7symbols_DEPRECATED175, + __pyx_e_5spacy_7symbols_DEPRECATED176, + __pyx_e_5spacy_7symbols_DEPRECATED177, + __pyx_e_5spacy_7symbols_DEPRECATED178, + __pyx_e_5spacy_7symbols_DEPRECATED179, + __pyx_e_5spacy_7symbols_DEPRECATED180, + __pyx_e_5spacy_7symbols_DEPRECATED181, + __pyx_e_5spacy_7symbols_DEPRECATED182, + __pyx_e_5spacy_7symbols_DEPRECATED183, + __pyx_e_5spacy_7symbols_DEPRECATED184, + __pyx_e_5spacy_7symbols_DEPRECATED185, + __pyx_e_5spacy_7symbols_DEPRECATED186, + __pyx_e_5spacy_7symbols_DEPRECATED187, + __pyx_e_5spacy_7symbols_DEPRECATED188, + __pyx_e_5spacy_7symbols_DEPRECATED189, + __pyx_e_5spacy_7symbols_DEPRECATED190, + __pyx_e_5spacy_7symbols_DEPRECATED191, + __pyx_e_5spacy_7symbols_DEPRECATED192, + __pyx_e_5spacy_7symbols_DEPRECATED193, + __pyx_e_5spacy_7symbols_DEPRECATED194, + __pyx_e_5spacy_7symbols_DEPRECATED195, + __pyx_e_5spacy_7symbols_DEPRECATED196, + __pyx_e_5spacy_7symbols_DEPRECATED197, + __pyx_e_5spacy_7symbols_DEPRECATED198, + __pyx_e_5spacy_7symbols_DEPRECATED199, + __pyx_e_5spacy_7symbols_DEPRECATED200, + __pyx_e_5spacy_7symbols_DEPRECATED201, + __pyx_e_5spacy_7symbols_DEPRECATED202, + __pyx_e_5spacy_7symbols_DEPRECATED203, + __pyx_e_5spacy_7symbols_DEPRECATED204, + __pyx_e_5spacy_7symbols_DEPRECATED205, + __pyx_e_5spacy_7symbols_DEPRECATED206, + __pyx_e_5spacy_7symbols_DEPRECATED207, + __pyx_e_5spacy_7symbols_DEPRECATED208, + __pyx_e_5spacy_7symbols_DEPRECATED209, + __pyx_e_5spacy_7symbols_DEPRECATED210, + __pyx_e_5spacy_7symbols_DEPRECATED211, + __pyx_e_5spacy_7symbols_DEPRECATED212, + __pyx_e_5spacy_7symbols_DEPRECATED213, + __pyx_e_5spacy_7symbols_DEPRECATED214, + __pyx_e_5spacy_7symbols_DEPRECATED215, + __pyx_e_5spacy_7symbols_DEPRECATED216, + __pyx_e_5spacy_7symbols_DEPRECATED217, + __pyx_e_5spacy_7symbols_DEPRECATED218, + __pyx_e_5spacy_7symbols_DEPRECATED219, + __pyx_e_5spacy_7symbols_DEPRECATED220, + __pyx_e_5spacy_7symbols_DEPRECATED221, + __pyx_e_5spacy_7symbols_DEPRECATED222, + __pyx_e_5spacy_7symbols_DEPRECATED223, + __pyx_e_5spacy_7symbols_DEPRECATED224, + __pyx_e_5spacy_7symbols_DEPRECATED225, + __pyx_e_5spacy_7symbols_DEPRECATED226, + __pyx_e_5spacy_7symbols_DEPRECATED227, + __pyx_e_5spacy_7symbols_DEPRECATED228, + __pyx_e_5spacy_7symbols_DEPRECATED229, + __pyx_e_5spacy_7symbols_DEPRECATED230, + __pyx_e_5spacy_7symbols_DEPRECATED231, + __pyx_e_5spacy_7symbols_DEPRECATED232, + __pyx_e_5spacy_7symbols_DEPRECATED233, + __pyx_e_5spacy_7symbols_DEPRECATED234, + __pyx_e_5spacy_7symbols_DEPRECATED235, + __pyx_e_5spacy_7symbols_DEPRECATED236, + __pyx_e_5spacy_7symbols_DEPRECATED237, + __pyx_e_5spacy_7symbols_DEPRECATED238, + __pyx_e_5spacy_7symbols_DEPRECATED239, + __pyx_e_5spacy_7symbols_DEPRECATED240, + __pyx_e_5spacy_7symbols_DEPRECATED241, + __pyx_e_5spacy_7symbols_DEPRECATED242, + __pyx_e_5spacy_7symbols_DEPRECATED243, + __pyx_e_5spacy_7symbols_DEPRECATED244, + __pyx_e_5spacy_7symbols_DEPRECATED245, + __pyx_e_5spacy_7symbols_DEPRECATED246, + __pyx_e_5spacy_7symbols_DEPRECATED247, + __pyx_e_5spacy_7symbols_DEPRECATED248, + __pyx_e_5spacy_7symbols_DEPRECATED249, + __pyx_e_5spacy_7symbols_DEPRECATED250, + __pyx_e_5spacy_7symbols_DEPRECATED251, + __pyx_e_5spacy_7symbols_DEPRECATED252, + __pyx_e_5spacy_7symbols_DEPRECATED253, + __pyx_e_5spacy_7symbols_DEPRECATED254, + __pyx_e_5spacy_7symbols_DEPRECATED255, + __pyx_e_5spacy_7symbols_DEPRECATED256, + __pyx_e_5spacy_7symbols_DEPRECATED257, + __pyx_e_5spacy_7symbols_DEPRECATED258, + __pyx_e_5spacy_7symbols_DEPRECATED259, + __pyx_e_5spacy_7symbols_DEPRECATED260, + __pyx_e_5spacy_7symbols_DEPRECATED261, + __pyx_e_5spacy_7symbols_DEPRECATED262, + __pyx_e_5spacy_7symbols_DEPRECATED263, + __pyx_e_5spacy_7symbols_DEPRECATED264, + __pyx_e_5spacy_7symbols_DEPRECATED265, + __pyx_e_5spacy_7symbols_DEPRECATED266, + __pyx_e_5spacy_7symbols_DEPRECATED267, + __pyx_e_5spacy_7symbols_DEPRECATED268, + __pyx_e_5spacy_7symbols_DEPRECATED269, + __pyx_e_5spacy_7symbols_DEPRECATED270, + __pyx_e_5spacy_7symbols_DEPRECATED271, + __pyx_e_5spacy_7symbols_DEPRECATED272, + __pyx_e_5spacy_7symbols_DEPRECATED273, + __pyx_e_5spacy_7symbols_DEPRECATED274, + __pyx_e_5spacy_7symbols_DEPRECATED275, + __pyx_e_5spacy_7symbols_DEPRECATED276, + __pyx_e_5spacy_7symbols_PERSON, + __pyx_e_5spacy_7symbols_NORP, + __pyx_e_5spacy_7symbols_FACILITY, + __pyx_e_5spacy_7symbols_ORG, + __pyx_e_5spacy_7symbols_GPE, + __pyx_e_5spacy_7symbols_LOC, + __pyx_e_5spacy_7symbols_PRODUCT, + __pyx_e_5spacy_7symbols_EVENT, + __pyx_e_5spacy_7symbols_WORK_OF_ART, + __pyx_e_5spacy_7symbols_LANGUAGE, + __pyx_e_5spacy_7symbols_LAW, + __pyx_e_5spacy_7symbols_DATE, + __pyx_e_5spacy_7symbols_TIME, + __pyx_e_5spacy_7symbols_PERCENT, + __pyx_e_5spacy_7symbols_MONEY, + __pyx_e_5spacy_7symbols_QUANTITY, + __pyx_e_5spacy_7symbols_ORDINAL, + __pyx_e_5spacy_7symbols_CARDINAL, + __pyx_e_5spacy_7symbols_acomp, + __pyx_e_5spacy_7symbols_advcl, + __pyx_e_5spacy_7symbols_advmod, + __pyx_e_5spacy_7symbols_agent, + __pyx_e_5spacy_7symbols_amod, + __pyx_e_5spacy_7symbols_appos, + __pyx_e_5spacy_7symbols_attr, + __pyx_e_5spacy_7symbols_aux, + __pyx_e_5spacy_7symbols_auxpass, + __pyx_e_5spacy_7symbols_cc, + __pyx_e_5spacy_7symbols_ccomp, + __pyx_e_5spacy_7symbols_complm, + __pyx_e_5spacy_7symbols_conj, + __pyx_e_5spacy_7symbols_cop, + __pyx_e_5spacy_7symbols_csubj, + __pyx_e_5spacy_7symbols_csubjpass, + __pyx_e_5spacy_7symbols_dep, + __pyx_e_5spacy_7symbols_det, + __pyx_e_5spacy_7symbols_dobj, + __pyx_e_5spacy_7symbols_expl, + __pyx_e_5spacy_7symbols_hmod, + __pyx_e_5spacy_7symbols_hyph, + __pyx_e_5spacy_7symbols_infmod, + __pyx_e_5spacy_7symbols_intj, + __pyx_e_5spacy_7symbols_iobj, + __pyx_e_5spacy_7symbols_mark, + __pyx_e_5spacy_7symbols_meta, + __pyx_e_5spacy_7symbols_neg, + __pyx_e_5spacy_7symbols_nmod, + __pyx_e_5spacy_7symbols_nn, + __pyx_e_5spacy_7symbols_npadvmod, + __pyx_e_5spacy_7symbols_nsubj, + __pyx_e_5spacy_7symbols_nsubjpass, + __pyx_e_5spacy_7symbols_num, + __pyx_e_5spacy_7symbols_number, + __pyx_e_5spacy_7symbols_oprd, + __pyx_e_5spacy_7symbols_obj, + __pyx_e_5spacy_7symbols_obl, + __pyx_e_5spacy_7symbols_parataxis, + __pyx_e_5spacy_7symbols_partmod, + __pyx_e_5spacy_7symbols_pcomp, + __pyx_e_5spacy_7symbols_pobj, + __pyx_e_5spacy_7symbols_poss, + __pyx_e_5spacy_7symbols_possessive, + __pyx_e_5spacy_7symbols_preconj, + __pyx_e_5spacy_7symbols_prep, + __pyx_e_5spacy_7symbols_prt, + __pyx_e_5spacy_7symbols_punct, + __pyx_e_5spacy_7symbols_quantmod, + __pyx_e_5spacy_7symbols_relcl, + __pyx_e_5spacy_7symbols_rcmod, + __pyx_e_5spacy_7symbols_root, + __pyx_e_5spacy_7symbols_xcomp, + __pyx_e_5spacy_7symbols_acl, + __pyx_e_5spacy_7symbols_ENT_KB_ID, + __pyx_e_5spacy_7symbols_MORPH, + __pyx_e_5spacy_7symbols_ENT_ID, + __pyx_e_5spacy_7symbols_IDX, + __pyx_e_5spacy_7symbols__ +}; + +/* "attrs.pxd":5 + * + * + * cdef enum attr_id_t: # <<<<<<<<<<<<<< + * NULL_ATTR + * IS_ALPHA +*/ +enum __pyx_t_5spacy_5attrs_attr_id_t { + + /* "attrs.pxd":96 + * ENT_KB_ID = symbols.ENT_KB_ID + * MORPH + * ENT_ID = symbols.ENT_ID # <<<<<<<<<<<<<< + * + * IDX +*/ + __pyx_e_5spacy_5attrs_NULL_ATTR, + __pyx_e_5spacy_5attrs_IS_ALPHA, + __pyx_e_5spacy_5attrs_IS_ASCII, + __pyx_e_5spacy_5attrs_IS_DIGIT, + __pyx_e_5spacy_5attrs_IS_LOWER, + __pyx_e_5spacy_5attrs_IS_PUNCT, + __pyx_e_5spacy_5attrs_IS_SPACE, + __pyx_e_5spacy_5attrs_IS_TITLE, + __pyx_e_5spacy_5attrs_IS_UPPER, + __pyx_e_5spacy_5attrs_LIKE_URL, + __pyx_e_5spacy_5attrs_LIKE_NUM, + __pyx_e_5spacy_5attrs_LIKE_EMAIL, + __pyx_e_5spacy_5attrs_IS_STOP, + __pyx_e_5spacy_5attrs_IS_OOV_DEPRECATED, + __pyx_e_5spacy_5attrs_IS_BRACKET, + __pyx_e_5spacy_5attrs_IS_QUOTE, + __pyx_e_5spacy_5attrs_IS_LEFT_PUNCT, + __pyx_e_5spacy_5attrs_IS_RIGHT_PUNCT, + __pyx_e_5spacy_5attrs_IS_CURRENCY, + __pyx_e_5spacy_5attrs_FLAG19 = 19, + __pyx_e_5spacy_5attrs_FLAG20, + __pyx_e_5spacy_5attrs_FLAG21, + __pyx_e_5spacy_5attrs_FLAG22, + __pyx_e_5spacy_5attrs_FLAG23, + __pyx_e_5spacy_5attrs_FLAG24, + __pyx_e_5spacy_5attrs_FLAG25, + __pyx_e_5spacy_5attrs_FLAG26, + __pyx_e_5spacy_5attrs_FLAG27, + __pyx_e_5spacy_5attrs_FLAG28, + __pyx_e_5spacy_5attrs_FLAG29, + __pyx_e_5spacy_5attrs_FLAG30, + __pyx_e_5spacy_5attrs_FLAG31, + __pyx_e_5spacy_5attrs_FLAG32, + __pyx_e_5spacy_5attrs_FLAG33, + __pyx_e_5spacy_5attrs_FLAG34, + __pyx_e_5spacy_5attrs_FLAG35, + __pyx_e_5spacy_5attrs_FLAG36, + __pyx_e_5spacy_5attrs_FLAG37, + __pyx_e_5spacy_5attrs_FLAG38, + __pyx_e_5spacy_5attrs_FLAG39, + __pyx_e_5spacy_5attrs_FLAG40, + __pyx_e_5spacy_5attrs_FLAG41, + __pyx_e_5spacy_5attrs_FLAG42, + __pyx_e_5spacy_5attrs_FLAG43, + __pyx_e_5spacy_5attrs_FLAG44, + __pyx_e_5spacy_5attrs_FLAG45, + __pyx_e_5spacy_5attrs_FLAG46, + __pyx_e_5spacy_5attrs_FLAG47, + __pyx_e_5spacy_5attrs_FLAG48, + __pyx_e_5spacy_5attrs_FLAG49, + __pyx_e_5spacy_5attrs_FLAG50, + __pyx_e_5spacy_5attrs_FLAG51, + __pyx_e_5spacy_5attrs_FLAG52, + __pyx_e_5spacy_5attrs_FLAG53, + __pyx_e_5spacy_5attrs_FLAG54, + __pyx_e_5spacy_5attrs_FLAG55, + __pyx_e_5spacy_5attrs_FLAG56, + __pyx_e_5spacy_5attrs_FLAG57, + __pyx_e_5spacy_5attrs_FLAG58, + __pyx_e_5spacy_5attrs_FLAG59, + __pyx_e_5spacy_5attrs_FLAG60, + __pyx_e_5spacy_5attrs_FLAG61, + __pyx_e_5spacy_5attrs_FLAG62, + __pyx_e_5spacy_5attrs_FLAG63, + __pyx_e_5spacy_5attrs_ID, + __pyx_e_5spacy_5attrs_ORTH, + __pyx_e_5spacy_5attrs_LOWER, + __pyx_e_5spacy_5attrs_NORM, + __pyx_e_5spacy_5attrs_SHAPE, + __pyx_e_5spacy_5attrs_PREFIX, + __pyx_e_5spacy_5attrs_SUFFIX, + __pyx_e_5spacy_5attrs_LENGTH, + __pyx_e_5spacy_5attrs_CLUSTER, + __pyx_e_5spacy_5attrs_LEMMA, + __pyx_e_5spacy_5attrs_POS, + __pyx_e_5spacy_5attrs_TAG, + __pyx_e_5spacy_5attrs_DEP, + __pyx_e_5spacy_5attrs_ENT_IOB, + __pyx_e_5spacy_5attrs_ENT_TYPE, + __pyx_e_5spacy_5attrs_HEAD, + __pyx_e_5spacy_5attrs_SENT_START, + __pyx_e_5spacy_5attrs_SPACY, + __pyx_e_5spacy_5attrs_PROB, + __pyx_e_5spacy_5attrs_LANG, + __pyx_e_5spacy_5attrs_ENT_KB_ID = __pyx_e_5spacy_7symbols_ENT_KB_ID, + __pyx_e_5spacy_5attrs_MORPH, + __pyx_e_5spacy_5attrs_ENT_ID = __pyx_e_5spacy_7symbols_ENT_ID, + __pyx_e_5spacy_5attrs_IDX, + __pyx_e_5spacy_5attrs_SENT_END +}; + +/* "parts_of_speech.pxd":4 + * + * + * cpdef enum univ_pos_t: # <<<<<<<<<<<<<< + * NO_TAG = 0 + * ADJ = symbols.ADJ +*/ +enum __pyx_t_5spacy_15parts_of_speech_univ_pos_t { + + /* "parts_of_speech.pxd":6 + * cpdef enum univ_pos_t: + * NO_TAG = 0 + * ADJ = symbols.ADJ # <<<<<<<<<<<<<< + * ADP + * ADV +*/ + __pyx_e_5spacy_15parts_of_speech_NO_TAG = 0, + __pyx_e_5spacy_15parts_of_speech_ADJ = __pyx_e_5spacy_7symbols_ADJ, + __pyx_e_5spacy_15parts_of_speech_ADP, + __pyx_e_5spacy_15parts_of_speech_ADV, + __pyx_e_5spacy_15parts_of_speech_AUX, + __pyx_e_5spacy_15parts_of_speech_CONJ, + __pyx_e_5spacy_15parts_of_speech_CCONJ, + __pyx_e_5spacy_15parts_of_speech_DET, + __pyx_e_5spacy_15parts_of_speech_INTJ, + __pyx_e_5spacy_15parts_of_speech_NOUN, + __pyx_e_5spacy_15parts_of_speech_NUM, + __pyx_e_5spacy_15parts_of_speech_PART, + __pyx_e_5spacy_15parts_of_speech_PRON, + __pyx_e_5spacy_15parts_of_speech_PROPN, + __pyx_e_5spacy_15parts_of_speech_PUNCT, + __pyx_e_5spacy_15parts_of_speech_SCONJ, + __pyx_e_5spacy_15parts_of_speech_SYM, + __pyx_e_5spacy_15parts_of_speech_VERB, + __pyx_e_5spacy_15parts_of_speech_X, + __pyx_e_5spacy_15parts_of_speech_EOL, + __pyx_e_5spacy_15parts_of_speech_SPACE +}; +struct __pyx_t_5spacy_7structs_LexemeC; +struct __pyx_t_5spacy_7structs_SpanC; +struct __pyx_t_5spacy_7structs_TokenC; +struct __pyx_t_5spacy_7structs_MorphAnalysisC; +struct __pyx_t_5spacy_7structs_KBEntryC; +struct __pyx_t_5spacy_7structs_AliasC; +struct __pyx_t_5spacy_7structs_EdgeC; +struct __pyx_t_5spacy_7structs_GraphC; + +/* "structs.pxd":10 + * + * + * cdef struct LexemeC: # <<<<<<<<<<<<<< + * flags_t flags + * +*/ +struct __pyx_t_5spacy_7structs_LexemeC { + __pyx_t_5spacy_8typedefs_flags_t flags; + __pyx_t_5spacy_8typedefs_attr_t lang; + __pyx_t_5spacy_8typedefs_attr_t id; + __pyx_t_5spacy_8typedefs_attr_t length; + __pyx_t_5spacy_8typedefs_attr_t orth; + __pyx_t_5spacy_8typedefs_attr_t lower; + __pyx_t_5spacy_8typedefs_attr_t norm; + __pyx_t_5spacy_8typedefs_attr_t shape; + __pyx_t_5spacy_8typedefs_attr_t prefix; + __pyx_t_5spacy_8typedefs_attr_t suffix; +}; + +/* "structs.pxd":26 + * + * + * cdef struct SpanC: # <<<<<<<<<<<<<< + * hash_t id + * int start +*/ +struct __pyx_t_5spacy_7structs_SpanC { + __pyx_t_5spacy_8typedefs_hash_t id; + int start; + int end; + int start_char; + int end_char; + __pyx_t_5spacy_8typedefs_attr_t label; + __pyx_t_5spacy_8typedefs_attr_t kb_id; +}; + +/* "structs.pxd":36 + * + * + * cdef struct TokenC: # <<<<<<<<<<<<<< + * const LexemeC* lex + * uint64_t morph +*/ +struct __pyx_t_5spacy_7structs_TokenC { + struct __pyx_t_5spacy_7structs_LexemeC const *lex; + uint64_t morph; + enum __pyx_t_5spacy_15parts_of_speech_univ_pos_t pos; + int spacy; + __pyx_t_5spacy_8typedefs_attr_t tag; + int idx; + __pyx_t_5spacy_8typedefs_attr_t lemma; + __pyx_t_5spacy_8typedefs_attr_t norm; + int head; + __pyx_t_5spacy_8typedefs_attr_t dep; + uint32_t l_kids; + uint32_t r_kids; + uint32_t l_edge; + uint32_t r_edge; + int sent_start; + int ent_iob; + __pyx_t_5spacy_8typedefs_attr_t ent_type; + __pyx_t_5spacy_8typedefs_attr_t ent_kb_id; + __pyx_t_5spacy_8typedefs_hash_t ent_id; +}; + +/* "structs.pxd":60 + * + * + * cdef struct MorphAnalysisC: # <<<<<<<<<<<<<< + * hash_t key + * int length +*/ +struct __pyx_t_5spacy_7structs_MorphAnalysisC { + __pyx_t_5spacy_8typedefs_hash_t key; + int length; + __pyx_t_5spacy_8typedefs_attr_t *fields; + __pyx_t_5spacy_8typedefs_attr_t *features; +}; + +/* "structs.pxd":69 + * + * # Internal struct, for storage and disambiguation of entities. + * cdef struct KBEntryC: # <<<<<<<<<<<<<< + * + * # The hash of this entry's unique ID/name in the kB +*/ +struct __pyx_t_5spacy_7structs_KBEntryC { + __pyx_t_5spacy_8typedefs_hash_t entity_hash; + int32_t vector_index; + int32_t feats_row; + float freq; +}; + +/* "structs.pxd":88 + * # Each alias struct stores a list of Entry pointers with their prior probabilities + * # for this specific mention/alias. + * cdef struct AliasC: # <<<<<<<<<<<<<< + * + * # All entry candidates for this alias +*/ +struct __pyx_t_5spacy_7structs_AliasC { + std::vector entry_indices; + std::vector probs; +}; + +/* "structs.pxd":97 + * + * + * cdef struct EdgeC: # <<<<<<<<<<<<<< + * hash_t label + * int32_t head +*/ +struct __pyx_t_5spacy_7structs_EdgeC { + __pyx_t_5spacy_8typedefs_hash_t label; + int32_t head; + int32_t tail; +}; + +/* "structs.pxd":103 + * + * + * cdef struct GraphC: # <<<<<<<<<<<<<< + * vector[vector[int32_t]] nodes + * vector[EdgeC] edges +*/ +struct __pyx_t_5spacy_7structs_GraphC { + std::vector > nodes; + std::vector edges; + std::vector weights; + std::vector n_heads; + std::vector n_tails; + std::vector first_head; + std::vector first_tail; + std::unordered_set *roots; + std::unordered_map<__pyx_t_5spacy_8typedefs_hash_t,int> *node_map; + std::unordered_map<__pyx_t_5spacy_8typedefs_hash_t,int> *edge_map; +}; +struct __pyx_t_7preshed_4maps_Cell; +struct __pyx_t_7preshed_4maps_Result; +struct __pyx_t_7preshed_4maps_MapStruct; + +/* "preshed/maps.pxd":8 + * + * + * cdef struct Cell: # <<<<<<<<<<<<<< + * key_t key + * void* value +*/ +struct __pyx_t_7preshed_4maps_Cell { + __pyx_t_7preshed_4maps_key_t key; + void *value; +}; + +/* "preshed/maps.pxd":13 + * + * + * cdef struct Result: # <<<<<<<<<<<<<< + * int found + * void* value +*/ +struct __pyx_t_7preshed_4maps_Result { + int found; + void *value; +}; + +/* "preshed/maps.pxd":18 + * + * + * cdef struct MapStruct: # <<<<<<<<<<<<<< + * Cell* cells + * void* value_for_empty_key +*/ +struct __pyx_t_7preshed_4maps_MapStruct { + struct __pyx_t_7preshed_4maps_Cell *cells; + void *value_for_empty_key; + void *value_for_del_key; + __pyx_t_7preshed_4maps_key_t length; + __pyx_t_7preshed_4maps_key_t filled; + int is_empty_key_set; + int is_del_key_set; +}; +union __pyx_t_5spacy_7strings_Utf8Str; +typedef union __pyx_t_5spacy_7strings_Utf8Str __pyx_t_5spacy_7strings_Utf8Str; + +/* "strings.pxd":17 + * + * + * ctypedef union Utf8Str: # <<<<<<<<<<<<<< + * unsigned char[8] s + * unsigned char* p +*/ +union __pyx_t_5spacy_7strings_Utf8Str { + unsigned char s[8]; + unsigned char *p; +}; +union __pyx_t_5spacy_5vocab_LexemesOrTokens; +struct __pyx_t_5spacy_5vocab__Cached; + +/* "vocab.pxd":15 + * + * + * cdef union LexemesOrTokens: # <<<<<<<<<<<<<< + * const LexemeC* const* lexemes + * const TokenC* tokens +*/ +union __pyx_t_5spacy_5vocab_LexemesOrTokens { + struct __pyx_t_5spacy_7structs_LexemeC const *const *lexemes; + struct __pyx_t_5spacy_7structs_TokenC const *tokens; +}; + +/* "vocab.pxd":20 + * + * + * cdef struct _Cached: # <<<<<<<<<<<<<< + * LexemesOrTokens data + * bint is_lex +*/ +struct __pyx_t_5spacy_5vocab__Cached { + union __pyx_t_5spacy_5vocab_LexemesOrTokens data; + int is_lex; + int length; +}; + +/* "tokens/doc.pxd":14 + * + * + * ctypedef const LexemeC* const_Lexeme_ptr # <<<<<<<<<<<<<< + * ctypedef const TokenC* const_TokenC_ptr + * +*/ +typedef struct __pyx_t_5spacy_7structs_LexemeC const *__pyx_t_5spacy_6tokens_3doc_const_Lexeme_ptr; + +/* "tokens/doc.pxd":15 + * + * ctypedef const LexemeC* const_Lexeme_ptr + * ctypedef const TokenC* const_TokenC_ptr # <<<<<<<<<<<<<< + * + * ctypedef fused LexemeOrToken: +*/ +typedef struct __pyx_t_5spacy_7structs_TokenC const *__pyx_t_5spacy_6tokens_3doc_const_TokenC_ptr; + +/* "cymem/cymem.pxd":4 + * ctypedef void (*free_t)(void *p) + * + * cdef class PyMalloc: # <<<<<<<<<<<<<< + * cdef malloc_t malloc + * cdef void _set(self, malloc_t malloc) +*/ +struct __pyx_obj_5cymem_5cymem_PyMalloc { + PyObject_HEAD + struct __pyx_vtabstruct_5cymem_5cymem_PyMalloc *__pyx_vtab; + __pyx_t_5cymem_5cymem_malloc_t malloc; +}; + + +/* "cymem/cymem.pxd":10 + * cdef PyMalloc WrapMalloc(malloc_t malloc) + * + * cdef class PyFree: # <<<<<<<<<<<<<< + * cdef free_t free + * cdef void _set(self, free_t free) +*/ +struct __pyx_obj_5cymem_5cymem_PyFree { + PyObject_HEAD + struct __pyx_vtabstruct_5cymem_5cymem_PyFree *__pyx_vtab; + __pyx_t_5cymem_5cymem_free_t free; +}; + + +/* "cymem/cymem.pxd":16 + * cdef PyFree WrapFree(free_t free) + * + * cdef class Pool: # <<<<<<<<<<<<<< + * cdef readonly size_t size + * cdef readonly dict addresses +*/ +struct __pyx_obj_5cymem_5cymem_Pool { + PyObject_HEAD + struct __pyx_vtabstruct_5cymem_5cymem_Pool *__pyx_vtab; + size_t size; + PyObject *addresses; + PyObject *refs; + struct __pyx_obj_5cymem_5cymem_PyMalloc *pymalloc; + struct __pyx_obj_5cymem_5cymem_PyFree *pyfree; +}; + + +/* "cymem/cymem.pxd":28 + * + * + * cdef class Address: # <<<<<<<<<<<<<< + * cdef void* ptr + * cdef readonly PyMalloc pymalloc +*/ +struct __pyx_obj_5cymem_5cymem_Address { + PyObject_HEAD + void *ptr; + struct __pyx_obj_5cymem_5cymem_PyMalloc *pymalloc; + struct __pyx_obj_5cymem_5cymem_PyFree *pyfree; +}; + + +/* "preshed/maps.pxd":45 + * + * + * cdef class PreshMap: # <<<<<<<<<<<<<< + * cdef MapStruct* c_map + * cdef Pool mem +*/ +struct __pyx_obj_7preshed_4maps_PreshMap { + PyObject_HEAD + struct __pyx_vtabstruct_7preshed_4maps_PreshMap *__pyx_vtab; + struct __pyx_t_7preshed_4maps_MapStruct *c_map; + struct __pyx_obj_5cymem_5cymem_Pool *mem; +}; + + +/* "preshed/maps.pxd":53 + * + * + * cdef class PreshMapArray: # <<<<<<<<<<<<<< + * cdef Pool mem + * cdef MapStruct* maps +*/ +struct __pyx_obj_7preshed_4maps_PreshMapArray { + PyObject_HEAD + struct __pyx_vtabstruct_7preshed_4maps_PreshMapArray *__pyx_vtab; + struct __pyx_obj_5cymem_5cymem_Pool *mem; + struct __pyx_t_7preshed_4maps_MapStruct *maps; + size_t length; +}; + + +/* "strings.pxd":22 + * + * + * cdef class StringStore: # <<<<<<<<<<<<<< + * cdef Pool mem + * +*/ +struct __pyx_obj_5spacy_7strings_StringStore { + PyObject_HEAD + struct __pyx_vtabstruct_5spacy_7strings_StringStore *__pyx_vtab; + struct __pyx_obj_5cymem_5cymem_Pool *mem; + std::vector<__pyx_t_5spacy_8typedefs_hash_t> keys; + struct __pyx_obj_7preshed_4maps_PreshMap *_map; + std::vector<__pyx_t_5spacy_8typedefs_hash_t> _transient_keys; + struct __pyx_obj_5cymem_5cymem_Pool *_non_temp_mem; +}; + + +/* "morphology.pxd":11 + * + * + * cdef class Morphology: # <<<<<<<<<<<<<< + * cdef readonly Pool mem + * cdef readonly StringStore strings +*/ +struct __pyx_obj_5spacy_10morphology_Morphology { + PyObject_HEAD + struct __pyx_vtabstruct_5spacy_10morphology_Morphology *__pyx_vtab; + struct __pyx_obj_5cymem_5cymem_Pool *mem; + struct __pyx_obj_5spacy_7strings_StringStore *strings; + struct __pyx_obj_7preshed_4maps_PreshMap *tags; +}; + + +/* "vocab.pxd":26 + * + * + * cdef class Vocab: # <<<<<<<<<<<<<< + * cdef Pool mem + * cdef readonly StringStore strings +*/ +struct __pyx_obj_5spacy_5vocab_Vocab { + PyObject_HEAD + struct __pyx_vtabstruct_5spacy_5vocab_Vocab *__pyx_vtab; + struct __pyx_obj_5cymem_5cymem_Pool *mem; + struct __pyx_obj_5spacy_7strings_StringStore *strings; + struct __pyx_obj_5spacy_10morphology_Morphology *morphology; + PyObject *_vectors; + PyObject *_lookups; + PyObject *writing_system; + PyObject *get_noun_chunks; + int length; + PyObject *_unused_object; + PyObject *lex_attr_getters; + PyObject *cfg; + struct __pyx_obj_7preshed_4maps_PreshMap *_by_orth; + struct __pyx_obj_5cymem_5cymem_Pool *_non_temp_mem; + std::vector<__pyx_t_5spacy_8typedefs_attr_t> _transient_orths; +}; + + +/* "tokens/doc.pxd":37 + * + * + * cdef class Doc: # <<<<<<<<<<<<<< + * cdef readonly Pool mem + * cdef readonly Vocab vocab +*/ +struct __pyx_obj_5spacy_6tokens_3doc_Doc { + PyObject_HEAD + struct __pyx_vtabstruct_5spacy_6tokens_3doc_Doc *__pyx_vtab; + struct __pyx_obj_5cymem_5cymem_Pool *mem; + struct __pyx_obj_5spacy_5vocab_Vocab *vocab; + PyObject *_vector; + PyObject *_vector_norm; + PyObject *tensor; + PyObject *cats; + PyObject *user_data; + PyObject *spans; + struct __pyx_t_5spacy_7structs_TokenC *c; + float sentiment; + PyObject *user_hooks; + PyObject *user_token_hooks; + PyObject *user_span_hooks; + int has_unknown_spaces; + PyObject *_context; + int length; + int max_length; + PyObject *noun_chunks_iterator; + PyObject *__weakref__; +}; + + +/* "spacy/pipeline/_parser_internals/nonproj.pyx":24 + * + * + * def ancestors(tokenid, heads): # <<<<<<<<<<<<<< + * # Returns all words going from the word up the path to the root. The path + * # to root cannot be longer than the number of words in the sentence. This +*/ +struct __pyx_obj_5spacy_8pipeline_17_parser_internals_7nonproj___pyx_scope_struct__ancestors { + PyObject_HEAD + long __pyx_v_cnt; + PyObject *__pyx_v_head; + PyObject *__pyx_v_heads; + PyObject *__pyx_v_tokenid; +}; + + +/* "spacy/pipeline/_parser_internals/nonproj.pyx":115 + * + * + * def is_nonproj_tree(heads): # <<<<<<<<<<<<<< + * cdef vector[int] c_heads = _heads_to_c(heads) + * # a tree is non-projective if at least one arc is non-projective +*/ +struct __pyx_obj_5spacy_8pipeline_17_parser_internals_7nonproj___pyx_scope_struct_1_is_nonproj_tree { + PyObject_HEAD + std::vector __pyx_v_c_heads; +}; + + +/* "spacy/pipeline/_parser_internals/nonproj.pyx":118 + * cdef vector[int] c_heads = _heads_to_c(heads) + * # a tree is non-projective if at least one arc is non-projective + * return any(_is_nonproj_arc(word, c_heads) for word in range(len(heads))) # <<<<<<<<<<<<<< + * + * +*/ +struct __pyx_obj_5spacy_8pipeline_17_parser_internals_7nonproj___pyx_scope_struct_2_genexpr { + PyObject_HEAD + struct __pyx_obj_5spacy_8pipeline_17_parser_internals_7nonproj___pyx_scope_struct_1_is_nonproj_tree *__pyx_outer_scope; + Py_ssize_t __pyx_genexpr_arg_0; + Py_ssize_t __pyx_v_word; +}; + + +/* "View.MemoryView":110 + * + * + * @cython.collection_type("sequence") # <<<<<<<<<<<<<< + * @cname("__pyx_array") + * cdef class array: +*/ +struct __pyx_array_obj { + PyObject_HEAD + struct __pyx_vtabstruct_array *__pyx_vtab; + char *data; + Py_ssize_t len; + char *format; + int ndim; + Py_ssize_t *_shape; + Py_ssize_t *_strides; + Py_ssize_t itemsize; + PyObject *mode; + PyObject *_format; + void (*callback_free_data)(void *); + int free_data; + int dtype_is_object; +}; + + +/* "View.MemoryView":299 + * + * + * @cname('__pyx_MemviewEnum') # <<<<<<<<<<<<<< + * cdef class Enum(object): + * cdef object name +*/ +struct __pyx_MemviewEnum_obj { + PyObject_HEAD + PyObject *name; +}; + + +/* "View.MemoryView":334 + * + * + * @cname('__pyx_memoryview') # <<<<<<<<<<<<<< + * cdef class memoryview: + * +*/ +struct __pyx_memoryview_obj { + PyObject_HEAD + struct __pyx_vtabstruct_memoryview *__pyx_vtab; + PyObject *obj; + PyObject *_size; + void *_unused; + PyThread_type_lock lock; + __pyx_atomic_int_type acquisition_count; + Py_buffer view; + int flags; + int dtype_is_object; + __Pyx_TypeInfo const *typeinfo; +}; + + +/* "View.MemoryView":951 + * + * + * @cython.collection_type("sequence") # <<<<<<<<<<<<<< + * @cname('__pyx_memoryviewslice') + * cdef class _memoryviewslice(memoryview): +*/ +struct __pyx_memoryviewslice_obj { + struct __pyx_memoryview_obj __pyx_base; + __Pyx_memviewslice from_slice; + PyObject *from_object; + PyObject *(*to_object_func)(char *); + int (*to_dtype_func)(char *, PyObject *); +}; + + + +/* "cymem/cymem.pxd":4 + * ctypedef void (*free_t)(void *p) + * + * cdef class PyMalloc: # <<<<<<<<<<<<<< + * cdef malloc_t malloc + * cdef void _set(self, malloc_t malloc) +*/ + +struct __pyx_vtabstruct_5cymem_5cymem_PyMalloc { + void (*_set)(struct __pyx_obj_5cymem_5cymem_PyMalloc *, __pyx_t_5cymem_5cymem_malloc_t); +}; +static struct __pyx_vtabstruct_5cymem_5cymem_PyMalloc *__pyx_vtabptr_5cymem_5cymem_PyMalloc; + + +/* "cymem/cymem.pxd":10 + * cdef PyMalloc WrapMalloc(malloc_t malloc) + * + * cdef class PyFree: # <<<<<<<<<<<<<< + * cdef free_t free + * cdef void _set(self, free_t free) +*/ + +struct __pyx_vtabstruct_5cymem_5cymem_PyFree { + void (*_set)(struct __pyx_obj_5cymem_5cymem_PyFree *, __pyx_t_5cymem_5cymem_free_t); +}; +static struct __pyx_vtabstruct_5cymem_5cymem_PyFree *__pyx_vtabptr_5cymem_5cymem_PyFree; + + +/* "cymem/cymem.pxd":16 + * cdef PyFree WrapFree(free_t free) + * + * cdef class Pool: # <<<<<<<<<<<<<< + * cdef readonly size_t size + * cdef readonly dict addresses +*/ + +struct __pyx_vtabstruct_5cymem_5cymem_Pool { + void *(*alloc)(struct __pyx_obj_5cymem_5cymem_Pool *, size_t, size_t); + void (*free)(struct __pyx_obj_5cymem_5cymem_Pool *, void *); + void *(*realloc)(struct __pyx_obj_5cymem_5cymem_Pool *, void *, size_t); +}; +static struct __pyx_vtabstruct_5cymem_5cymem_Pool *__pyx_vtabptr_5cymem_5cymem_Pool; + + +/* "preshed/maps.pxd":45 + * + * + * cdef class PreshMap: # <<<<<<<<<<<<<< + * cdef MapStruct* c_map + * cdef Pool mem +*/ + +struct __pyx_vtabstruct_7preshed_4maps_PreshMap { + void *(*get)(struct __pyx_obj_7preshed_4maps_PreshMap *, __pyx_t_7preshed_4maps_key_t); + void (*set)(struct __pyx_obj_7preshed_4maps_PreshMap *, __pyx_t_7preshed_4maps_key_t, void *); +}; +static struct __pyx_vtabstruct_7preshed_4maps_PreshMap *__pyx_vtabptr_7preshed_4maps_PreshMap; + + +/* "preshed/maps.pxd":53 + * + * + * cdef class PreshMapArray: # <<<<<<<<<<<<<< + * cdef Pool mem + * cdef MapStruct* maps +*/ + +struct __pyx_vtabstruct_7preshed_4maps_PreshMapArray { + void *(*get)(struct __pyx_obj_7preshed_4maps_PreshMapArray *, size_t, __pyx_t_7preshed_4maps_key_t); + void (*set)(struct __pyx_obj_7preshed_4maps_PreshMapArray *, size_t, __pyx_t_7preshed_4maps_key_t, void *); +}; +static struct __pyx_vtabstruct_7preshed_4maps_PreshMapArray *__pyx_vtabptr_7preshed_4maps_PreshMapArray; + + +/* "strings.pxd":22 + * + * + * cdef class StringStore: # <<<<<<<<<<<<<< + * cdef Pool mem + * +*/ + +struct __pyx_vtabstruct_5spacy_7strings_StringStore { + __pyx_t_5spacy_7strings_Utf8Str const *(*intern_unicode)(struct __pyx_obj_5spacy_7strings_StringStore *, PyObject *, int); + __pyx_t_5spacy_7strings_Utf8Str const *(*_intern_utf8)(struct __pyx_obj_5spacy_7strings_StringStore *, char *, int, __pyx_t_5spacy_8typedefs_hash_t *, int); +}; +static struct __pyx_vtabstruct_5spacy_7strings_StringStore *__pyx_vtabptr_5spacy_7strings_StringStore; + + +/* "morphology.pxd":11 + * + * + * cdef class Morphology: # <<<<<<<<<<<<<< + * cdef readonly Pool mem + * cdef readonly StringStore strings +*/ + +struct __pyx_vtabstruct_5spacy_10morphology_Morphology { + struct __pyx_t_5spacy_7structs_MorphAnalysisC (*create_morph_tag)(struct __pyx_obj_5spacy_10morphology_Morphology *, PyObject *); + int (*insert)(struct __pyx_obj_5spacy_10morphology_Morphology *, struct __pyx_t_5spacy_7structs_MorphAnalysisC); +}; +static struct __pyx_vtabstruct_5spacy_10morphology_Morphology *__pyx_vtabptr_5spacy_10morphology_Morphology; + + +/* "vocab.pxd":26 + * + * + * cdef class Vocab: # <<<<<<<<<<<<<< + * cdef Pool mem + * cdef readonly StringStore strings +*/ + +struct __pyx_vtabstruct_5spacy_5vocab_Vocab { + struct __pyx_t_5spacy_7structs_LexemeC const *(*get)(struct __pyx_obj_5spacy_5vocab_Vocab *, struct __pyx_obj_5cymem_5cymem_Pool *, PyObject *); + struct __pyx_t_5spacy_7structs_LexemeC const *(*get_by_orth)(struct __pyx_obj_5spacy_5vocab_Vocab *, struct __pyx_obj_5cymem_5cymem_Pool *, __pyx_t_5spacy_8typedefs_attr_t); + struct __pyx_t_5spacy_7structs_TokenC const *(*make_fused_token)(struct __pyx_obj_5spacy_5vocab_Vocab *, PyObject *); + struct __pyx_t_5spacy_7structs_LexemeC const *(*_new_lexeme)(struct __pyx_obj_5spacy_5vocab_Vocab *, struct __pyx_obj_5cymem_5cymem_Pool *, PyObject *); + int (*_add_lex_to_vocab)(struct __pyx_obj_5spacy_5vocab_Vocab *, __pyx_t_5spacy_8typedefs_hash_t, struct __pyx_t_5spacy_7structs_LexemeC const *, int); +}; +static struct __pyx_vtabstruct_5spacy_5vocab_Vocab *__pyx_vtabptr_5spacy_5vocab_Vocab; + + +/* "tokens/doc.pxd":37 + * + * + * cdef class Doc: # <<<<<<<<<<<<<< + * cdef readonly Pool mem + * cdef readonly Vocab vocab +*/ + +struct __pyx_vtabstruct_5spacy_6tokens_3doc_Doc { + PyArrayObject *(*to_array)(struct __pyx_obj_5spacy_6tokens_3doc_Doc *, PyObject *, int __pyx_skip_dispatch); + int (*__pyx_fuse_0push_back)(struct __pyx_obj_5spacy_6tokens_3doc_Doc *, __pyx_t_5spacy_6tokens_3doc_const_Lexeme_ptr, int); + int (*__pyx_fuse_1push_back)(struct __pyx_obj_5spacy_6tokens_3doc_Doc *, __pyx_t_5spacy_6tokens_3doc_const_TokenC_ptr, int); +}; +static struct __pyx_vtabstruct_5spacy_6tokens_3doc_Doc *__pyx_vtabptr_5spacy_6tokens_3doc_Doc; + + +/* "View.MemoryView":110 + * + * + * @cython.collection_type("sequence") # <<<<<<<<<<<<<< + * @cname("__pyx_array") + * cdef class array: +*/ + +struct __pyx_vtabstruct_array { + PyObject *(*get_memview)(struct __pyx_array_obj *); +}; +static struct __pyx_vtabstruct_array *__pyx_vtabptr_array; + + +/* "View.MemoryView":334 + * + * + * @cname('__pyx_memoryview') # <<<<<<<<<<<<<< + * cdef class memoryview: + * +*/ + +struct __pyx_vtabstruct_memoryview { + char *(*get_item_pointer)(struct __pyx_memoryview_obj *, PyObject *); + PyObject *(*is_slice)(struct __pyx_memoryview_obj *, PyObject *); + PyObject *(*setitem_slice_assignment)(struct __pyx_memoryview_obj *, PyObject *, PyObject *); + PyObject *(*setitem_slice_assign_scalar)(struct __pyx_memoryview_obj *, struct __pyx_memoryview_obj *, PyObject *); + PyObject *(*setitem_indexed)(struct __pyx_memoryview_obj *, PyObject *, PyObject *); + PyObject *(*convert_item_to_object)(struct __pyx_memoryview_obj *, char *); + PyObject *(*assign_item_from_object)(struct __pyx_memoryview_obj *, char *, PyObject *); + PyObject *(*_get_base)(struct __pyx_memoryview_obj *); +}; +static struct __pyx_vtabstruct_memoryview *__pyx_vtabptr_memoryview; + + +/* "View.MemoryView":951 + * + * + * @cython.collection_type("sequence") # <<<<<<<<<<<<<< + * @cname('__pyx_memoryviewslice') + * cdef class _memoryviewslice(memoryview): +*/ + +struct __pyx_vtabstruct__memoryviewslice { + struct __pyx_vtabstruct_memoryview __pyx_base; +}; +static struct __pyx_vtabstruct__memoryviewslice *__pyx_vtabptr__memoryviewslice; +/* #### 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); + +/* 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) + +/* RaiseException.export */ +static void __Pyx_Raise(PyObject *type, PyObject *value, PyObject *tb, PyObject *cause); + +/* 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 + +/* RaiseUnexpectedTypeError.proto */ +static int __Pyx_RaiseUnexpectedTypeError(const char *expected, PyObject *obj); + +/* PyMemoryError_Check.proto */ +#define __Pyx_PyExc_MemoryError_Check(obj) __Pyx_TypeCheck(obj, PyExc_MemoryError) + +/* 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); + +/* CIntToPyUnicode.proto */ +#define __Pyx_PyUnicode_From_Py_ssize_t(value, width, padding_char, format_char) (\ + ((format_char) == ('c')) ?\ + __Pyx_uchar___Pyx_PyUnicode_From_Py_ssize_t(value, width, padding_char) :\ + __Pyx____Pyx_PyUnicode_From_Py_ssize_t(value, width, padding_char, format_char)\ + ) +static CYTHON_INLINE PyObject* __Pyx_uchar___Pyx_PyUnicode_From_Py_ssize_t(Py_ssize_t value, Py_ssize_t width, char padding_char); +static CYTHON_INLINE PyObject* __Pyx____Pyx_PyUnicode_From_Py_ssize_t(Py_ssize_t 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); + +/* 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 + +CYTHON_UNUSED static int __pyx_array_getbuffer(PyObject *__pyx_v_self, Py_buffer *__pyx_v_info, int __pyx_v_flags); /*proto*/ +static PyObject *__pyx_array_get_memview(struct __pyx_array_obj *); /*proto*/ +/* GetAttr.proto */ +static CYTHON_INLINE PyObject *__Pyx_GetAttr(PyObject *, PyObject *); + +/* GetItemInt.proto */ +#define __Pyx_GetItemInt(o, i, type, is_signed, to_py_func, is_list, wraparound, boundscheck, has_gil, unsafe_shared)\ + (__Pyx_fits_Py_ssize_t(i, type, is_signed) ?\ + __Pyx_GetItemInt_Fast(o, (Py_ssize_t)i, is_list, wraparound, boundscheck, unsafe_shared) :\ + (is_list ? (PyErr_SetString(PyExc_IndexError, "list index out of range"), (PyObject*)NULL) :\ + __Pyx_GetItemInt_Generic(o, to_py_func(i)))) +#define __Pyx_GetItemInt_List(o, i, type, is_signed, to_py_func, is_list, wraparound, boundscheck, has_gil, unsafe_shared)\ + (__Pyx_fits_Py_ssize_t(i, type, is_signed) ?\ + __Pyx_GetItemInt_List_Fast(o, (Py_ssize_t)i, wraparound, boundscheck, unsafe_shared) :\ + (PyErr_SetString(PyExc_IndexError, "list index out of range"), (PyObject*)NULL)) +static CYTHON_INLINE PyObject *__Pyx_GetItemInt_List_Fast(PyObject *o, Py_ssize_t i, + int wraparound, int boundscheck, int unsafe_shared); +#define __Pyx_GetItemInt_Tuple(o, i, type, is_signed, to_py_func, is_list, wraparound, boundscheck, has_gil, unsafe_shared)\ + (__Pyx_fits_Py_ssize_t(i, type, is_signed) ?\ + __Pyx_GetItemInt_Tuple_Fast(o, (Py_ssize_t)i, wraparound, boundscheck, unsafe_shared) :\ + (PyErr_SetString(PyExc_IndexError, "tuple index out of range"), (PyObject*)NULL)) +static CYTHON_INLINE PyObject *__Pyx_GetItemInt_Tuple_Fast(PyObject *o, Py_ssize_t i, + int wraparound, int boundscheck, int unsafe_shared); +static PyObject *__Pyx_GetItemInt_Generic(PyObject *o, PyObject* j); +static CYTHON_INLINE PyObject *__Pyx_GetItemInt_Fast(PyObject *o, Py_ssize_t i, + int is_list, int wraparound, int boundscheck, int unsafe_shared); + +/* ObjectGetItem.proto */ +#if CYTHON_USE_TYPE_SLOTS +static CYTHON_INLINE PyObject *__Pyx_PyObject_GetItem(PyObject *obj, PyObject *key); +#else +#define __Pyx_PyObject_GetItem(obj, key) PyObject_GetItem(obj, key) +#endif + +/* RejectKeywords.export */ +static void __Pyx_RejectKeywords(const char* function_name, PyObject *kwds); + +/* PyTypeError_Check.proto */ +#define __Pyx_PyExc_TypeError_Check(obj) __Pyx_TypeCheck(obj, PyExc_TypeError) + +/* DivInt[Py_ssize_t].proto */ +static CYTHON_INLINE Py_ssize_t __Pyx_div_Py_ssize_t(Py_ssize_t, Py_ssize_t, int b_is_constant); + +/* UnaryNegOverflows.proto */ +#define __Pyx_UNARY_NEG_WOULD_OVERFLOW(x)\ + (((x) < 0) & ((unsigned long)(x) == 0-(unsigned long)(x))) + +/* GetAttr3.proto */ +static CYTHON_INLINE PyObject *__Pyx_GetAttr3(PyObject *, PyObject *, PyObject *); + +/* 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 + +/* AssertionsEnabled.proto */ +#if CYTHON_COMPILING_IN_LIMITED_API || PY_VERSION_HEX >= 0x030C0000 + static int __pyx_assertions_enabled_flag; + #define __pyx_assertions_enabled() (__pyx_assertions_enabled_flag) + static int __Pyx_init_assertions_enabled(void) { + PyObject *builtins, *debug, *debug_str; + int flag; + builtins = PyEval_GetBuiltins(); + if (!builtins) goto bad; + debug_str = PyUnicode_FromStringAndSize("__debug__", 9); + if (!debug_str) goto bad; + debug = PyObject_GetItem(builtins, debug_str); + Py_DECREF(debug_str); + if (!debug) goto bad; + flag = PyObject_IsTrue(debug); + Py_DECREF(debug); + if (flag == -1) goto bad; + __pyx_assertions_enabled_flag = flag; + return 0; + bad: + __pyx_assertions_enabled_flag = 1; + return -1; + } +#else + #define __Pyx_init_assertions_enabled() (0) + #define __pyx_assertions_enabled() (!Py_OptimizeFlag) +#endif + +/* PyAssertionError_Check.proto */ +#define __Pyx_PyExc_AssertionError_Check(obj) __Pyx_TypeCheck(obj, PyExc_AssertionError) + +/* RaiseTooManyValuesToUnpack.proto */ +static CYTHON_INLINE void __Pyx_RaiseTooManyValuesError(Py_ssize_t expected); + +/* RaiseNeedMoreValuesToUnpack.proto */ +static CYTHON_INLINE void __Pyx_RaiseNeedMoreValuesError(Py_ssize_t index); + +/* RaiseNoneIterError.proto */ +static CYTHON_INLINE void __Pyx_RaiseNoneNotIterableError(void); + +/* ExtTypeTest.proto */ +static CYTHON_INLINE int __Pyx_TypeTest(PyObject *obj, PyTypeObject *type); + +/* 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 + +/* 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); + +/* 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 + +CYTHON_UNUSED static int __pyx_memoryview_getbuffer(PyObject *__pyx_v_self, Py_buffer *__pyx_v_info, int __pyx_v_flags); /*proto*/ +/* 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 + +/* PySequenceMultiply.proto */ +#define __Pyx_PySequence_Multiply_Left(mul, seq) __Pyx_PySequence_Multiply(seq, mul) +static CYTHON_INLINE PyObject* __Pyx_PySequence_Multiply(PyObject *seq, Py_ssize_t mul); + +/* PyObjectFormatAndDecref.proto */ +static CYTHON_INLINE PyObject* __Pyx_PyObject_FormatSimpleAndDecref(PyObject* s, PyObject* f); +static CYTHON_INLINE PyObject* __Pyx_PyObject_FormatAndDecref(PyObject* s, PyObject* f); + +/* PyObjectFormat.proto */ +#if CYTHON_USE_UNICODE_WRITER +static PyObject* __Pyx_PyObject_Format(PyObject* s, PyObject* f); +#else +#define __Pyx_PyObject_Format(s, f) PyObject_Format(s, f) +#endif + +/* SetItemInt.proto */ +#define __Pyx_SetItemInt(o, i, v, type, is_signed, to_py_func, is_list, wraparound, boundscheck, has_gil, unsafe_shared)\ + (__Pyx_fits_Py_ssize_t(i, type, is_signed) ?\ + __Pyx_SetItemInt_Fast(o, (Py_ssize_t)i, v, is_list, wraparound, boundscheck, unsafe_shared) :\ + (is_list ? (PyErr_SetString(PyExc_IndexError, "list assignment index out of range"), -1) :\ + __Pyx_SetItemInt_Generic(o, to_py_func(i), v))) +static int __Pyx_SetItemInt_Generic(PyObject *o, PyObject *j, PyObject *v); +static CYTHON_INLINE int __Pyx_SetItemInt_Fast(PyObject *o, Py_ssize_t i, PyObject *v, + int is_list, int wraparound, int boundscheck, int unsafe_shared); + +/* RaiseUnboundLocalError.proto */ +static void __Pyx_RaiseUnboundLocalError(const char *varname); + +/* PyIndexError_Check.proto */ +#define __Pyx_PyExc_IndexError_Check(obj) __Pyx_TypeCheck(obj, PyExc_IndexError) + +/* DivInt[long].proto */ +static CYTHON_INLINE long __Pyx_div_long(long, long, int b_is_constant); + +/* PyImportError_Check.proto */ +#define __Pyx_PyExc_ImportError_Check(obj) __Pyx_TypeCheck(obj, PyExc_ImportError) + +/* PyObjectCallNoArg.proto (used by pyfrozenset_new) */ +static CYTHON_INLINE PyObject* __Pyx_PyObject_CallNoArg(PyObject *func); + +/* 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); + +/* MoveIfSupported.proto */ +#if CYTHON_USE_CPP_STD_MOVE + #include + #define __PYX_STD_MOVE_IF_SUPPORTED(x) std::move(x) +#else + #define __PYX_STD_MOVE_IF_SUPPORTED(x) x +#endif + +/* ErrOccurredWithGIL.proto */ +static CYTHON_INLINE int __Pyx_ErrOccurredWithGIL(void); + +/* WriteUnraisableException.proto */ +static void __Pyx_WriteUnraisable(const char *name, int clineno, + int lineno, const char *filename, + int full_traceback, int nogil); + +/* PySequenceContains.proto */ +static CYTHON_INLINE int __Pyx_PySequence_ContainsTF(PyObject* item, PyObject* seq, int eq) { + int result = PySequence_Contains(seq, item); + return unlikely(result < 0) ? result : (result == (eq == Py_EQ)); +} + +/* IterFinish.proto */ +static CYTHON_INLINE int __Pyx_IterFinish(void); + +/* UnpackItemEndCheck.proto */ +static int __Pyx_IternextUnpackEndCheck(PyObject *retval, Py_ssize_t expected); + +/* 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 + +/* dict_getitem_default.proto */ +static PyObject* __Pyx_PyDict_GetItemDefault(PyObject* d, PyObject* key, PyObject* default_value); + +/* PyObjectCall2Args.proto (used by CallUnboundCMethod1) */ +static CYTHON_INLINE PyObject* __Pyx_PyObject_Call2Args(PyObject* function, PyObject* arg1, PyObject* arg2); + +/* CallUnboundCMethod1.proto */ +CYTHON_UNUSED +static PyObject* __Pyx__CallUnboundCMethod1(__Pyx_CachedCFunction* cfunc, PyObject* self, PyObject* arg); +#if CYTHON_COMPILING_IN_CPYTHON +static CYTHON_INLINE PyObject* __Pyx_CallUnboundCMethod1(__Pyx_CachedCFunction* cfunc, PyObject* self, PyObject* arg); +#else +#define __Pyx_CallUnboundCMethod1(cfunc, self, arg) __Pyx__CallUnboundCMethod1(cfunc, self, arg) +#endif + +/* 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 + +/* CheckTypeForFreelists.proto */ +#if CYTHON_USE_FREELISTS +#if CYTHON_USE_TYPE_SPECS +#define __PYX_CHECK_FINAL_TYPE_FOR_FREELISTS(t, expected_tp, expected_size) ((int) ((t) == (expected_tp))) +#define __PYX_CHECK_TYPE_FOR_FREELIST_FLAGS Py_TPFLAGS_IS_ABSTRACT +#else +#define __PYX_CHECK_FINAL_TYPE_FOR_FREELISTS(t, expected_tp, expected_size) ((int) ((t)->tp_basicsize == (expected_size))) +#define __PYX_CHECK_TYPE_FOR_FREELIST_FLAGS (Py_TPFLAGS_IS_ABSTRACT | Py_TPFLAGS_HEAPTYPE) +#endif +#define __PYX_CHECK_TYPE_FOR_FREELISTS(t, expected_tp, expected_size)\ + (__PYX_CHECK_FINAL_TYPE_FOR_FREELISTS((t), (expected_tp), (expected_size)) &\ + (int) (!__Pyx_PyType_HasFeature((t), __PYX_CHECK_TYPE_FOR_FREELIST_FLAGS))) +#endif + +/* 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 + +/* DefaultPlacementNew.proto */ +#include +template +void __Pyx_default_placement_construct(T* x) { + new (static_cast(x)) T(); +} + +/* 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); + +/* 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); + +/* SetVTable.proto */ +static int __Pyx_SetVtable(PyTypeObject* typeptr , void* vtable); + +/* GetVTable.proto (used by MergeVTables) */ +static void* __Pyx_GetVtable(PyTypeObject *type); + +/* MergeVTables.proto */ +static int __Pyx_MergeVtables(PyTypeObject *type); + +/* 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_1 +#define __PYX_HAVE_RT_ImportType_proto_3_2_1 +#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_1(s) alignof(s) +#else +#define __PYX_GET_STRUCT_ALIGNMENT_3_2_1(s) sizeof(void*) +#endif +enum __Pyx_ImportType_CheckSize_3_2_1 { + __Pyx_ImportType_CheckSize_Error_3_2_1 = 0, + __Pyx_ImportType_CheckSize_Warn_3_2_1 = 1, + __Pyx_ImportType_CheckSize_Ignore_3_2_1 = 2 +}; +static PyTypeObject *__Pyx_ImportType_3_2_1(PyObject* module, const char *module_name, const char *class_name, size_t size, size_t alignment, enum __Pyx_ImportType_CheckSize_3_2_1 check_size); +#endif + +/* VoidPtrImport.proto */ +static int __Pyx_ImportVoidPtr_3_2_1(PyObject *module, const char *name, void **p, const char *sig); + +/* FunctionImport.proto */ +static int __Pyx_ImportFunction_3_2_1(PyObject *module, const char *funcname, void (**f)(void), const char *sig); + +/* 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 + +/* 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); + +/* CppExceptionConversion.proto */ +#ifndef __Pyx_CppExn2PyErr +#include +#include +#include +#include +static void __Pyx_CppExn2PyErr() { + try { + if (PyErr_Occurred()) + ; // let the latest Python exn pass through and ignore the current one + else + throw; + } catch (const std::bad_alloc& exn) { + PyErr_SetString(PyExc_MemoryError, exn.what()); + } catch (const std::bad_cast& exn) { + PyErr_SetString(PyExc_TypeError, exn.what()); + } catch (const std::bad_typeid& exn) { + PyErr_SetString(PyExc_TypeError, exn.what()); + } catch (const std::domain_error& exn) { + PyErr_SetString(PyExc_ValueError, exn.what()); + } catch (const std::invalid_argument& exn) { + PyErr_SetString(PyExc_ValueError, exn.what()); + } catch (const std::ios_base::failure& exn) { + PyErr_SetString(PyExc_IOError, exn.what()); + } catch (const std::out_of_range& exn) { + PyErr_SetString(PyExc_IndexError, exn.what()); + } catch (const std::overflow_error& exn) { + PyErr_SetString(PyExc_OverflowError, exn.what()); + } catch (const std::range_error& exn) { + PyErr_SetString(PyExc_ArithmeticError, exn.what()); + } catch (const std::underflow_error& exn) { + PyErr_SetString(PyExc_ArithmeticError, exn.what()); + } catch (const std::exception& exn) { + PyErr_SetString(PyExc_RuntimeError, exn.what()); + } + catch (...) + { + PyErr_SetString(PyExc_RuntimeError, "Unknown exception"); + } +} +#endif + +/* RealImag.proto */ +#if CYTHON_CCOMPLEX + #ifdef __cplusplus + #define __Pyx_CREAL(z) ((z).real()) + #define __Pyx_CIMAG(z) ((z).imag()) + #else + #define __Pyx_CREAL(z) (__real__(z)) + #define __Pyx_CIMAG(z) (__imag__(z)) + #endif +#else + #define __Pyx_CREAL(z) ((z).real) + #define __Pyx_CIMAG(z) ((z).imag) +#endif +#if defined(__cplusplus) && CYTHON_CCOMPLEX\ + && (defined(_WIN32) || defined(__clang__) || (defined(__GNUC__) && (__GNUC__ >= 5 || __GNUC__ == 4 && __GNUC_MINOR__ >= 4 )) || __cplusplus >= 201103) + #define __Pyx_SET_CREAL(z,x) ((z).real(x)) + #define __Pyx_SET_CIMAG(z,y) ((z).imag(y)) +#else + #define __Pyx_SET_CREAL(z,x) __Pyx_CREAL(z) = (x) + #define __Pyx_SET_CIMAG(z,y) __Pyx_CIMAG(z) = (y) +#endif + +/* Arithmetic.proto */ +#if CYTHON_CCOMPLEX && (1) && (!0 || __cplusplus) + #define __Pyx_c_eq_float(a, b) ((a)==(b)) + #define __Pyx_c_sum_float(a, b) ((a)+(b)) + #define __Pyx_c_diff_float(a, b) ((a)-(b)) + #define __Pyx_c_prod_float(a, b) ((a)*(b)) + #define __Pyx_c_quot_float(a, b) ((a)/(b)) + #define __Pyx_c_neg_float(a) (-(a)) + #ifdef __cplusplus + #define __Pyx_c_is_zero_float(z) ((z)==(float)0) + #define __Pyx_c_conj_float(z) (::std::conj(z)) + #if 1 + #define __Pyx_c_abs_float(z) (::std::abs(z)) + #define __Pyx_c_pow_float(a, b) (::std::pow(a, b)) + #endif + #else + #define __Pyx_c_is_zero_float(z) ((z)==0) + #define __Pyx_c_conj_float(z) (conjf(z)) + #if 1 + #define __Pyx_c_abs_float(z) (cabsf(z)) + #define __Pyx_c_pow_float(a, b) (cpowf(a, b)) + #endif + #endif +#else + static CYTHON_INLINE int __Pyx_c_eq_float(__pyx_t_float_complex, __pyx_t_float_complex); + static CYTHON_INLINE __pyx_t_float_complex __Pyx_c_sum_float(__pyx_t_float_complex, __pyx_t_float_complex); + static CYTHON_INLINE __pyx_t_float_complex __Pyx_c_diff_float(__pyx_t_float_complex, __pyx_t_float_complex); + static CYTHON_INLINE __pyx_t_float_complex __Pyx_c_prod_float(__pyx_t_float_complex, __pyx_t_float_complex); + static CYTHON_INLINE __pyx_t_float_complex __Pyx_c_quot_float(__pyx_t_float_complex, __pyx_t_float_complex); + static CYTHON_INLINE __pyx_t_float_complex __Pyx_c_neg_float(__pyx_t_float_complex); + static CYTHON_INLINE int __Pyx_c_is_zero_float(__pyx_t_float_complex); + static CYTHON_INLINE __pyx_t_float_complex __Pyx_c_conj_float(__pyx_t_float_complex); + #if 1 + static CYTHON_INLINE float __Pyx_c_abs_float(__pyx_t_float_complex); + static CYTHON_INLINE __pyx_t_float_complex __Pyx_c_pow_float(__pyx_t_float_complex, __pyx_t_float_complex); + #endif +#endif + +/* Arithmetic.proto */ +#if CYTHON_CCOMPLEX && (1) && (!0 || __cplusplus) + #define __Pyx_c_eq_double(a, b) ((a)==(b)) + #define __Pyx_c_sum_double(a, b) ((a)+(b)) + #define __Pyx_c_diff_double(a, b) ((a)-(b)) + #define __Pyx_c_prod_double(a, b) ((a)*(b)) + #define __Pyx_c_quot_double(a, b) ((a)/(b)) + #define __Pyx_c_neg_double(a) (-(a)) + #ifdef __cplusplus + #define __Pyx_c_is_zero_double(z) ((z)==(double)0) + #define __Pyx_c_conj_double(z) (::std::conj(z)) + #if 1 + #define __Pyx_c_abs_double(z) (::std::abs(z)) + #define __Pyx_c_pow_double(a, b) (::std::pow(a, b)) + #endif + #else + #define __Pyx_c_is_zero_double(z) ((z)==0) + #define __Pyx_c_conj_double(z) (conj(z)) + #if 1 + #define __Pyx_c_abs_double(z) (cabs(z)) + #define __Pyx_c_pow_double(a, b) (cpow(a, b)) + #endif + #endif +#else + static CYTHON_INLINE int __Pyx_c_eq_double(__pyx_t_double_complex, __pyx_t_double_complex); + static CYTHON_INLINE __pyx_t_double_complex __Pyx_c_sum_double(__pyx_t_double_complex, __pyx_t_double_complex); + static CYTHON_INLINE __pyx_t_double_complex __Pyx_c_diff_double(__pyx_t_double_complex, __pyx_t_double_complex); + static CYTHON_INLINE __pyx_t_double_complex __Pyx_c_prod_double(__pyx_t_double_complex, __pyx_t_double_complex); + static CYTHON_INLINE __pyx_t_double_complex __Pyx_c_quot_double(__pyx_t_double_complex, __pyx_t_double_complex); + static CYTHON_INLINE __pyx_t_double_complex __Pyx_c_neg_double(__pyx_t_double_complex); + static CYTHON_INLINE int __Pyx_c_is_zero_double(__pyx_t_double_complex); + static CYTHON_INLINE __pyx_t_double_complex __Pyx_c_conj_double(__pyx_t_double_complex); + #if 1 + static CYTHON_INLINE double __Pyx_c_abs_double(__pyx_t_double_complex); + static CYTHON_INLINE __pyx_t_double_complex __Pyx_c_pow_double(__pyx_t_double_complex, __pyx_t_double_complex); + #endif +#endif + +/* Arithmetic.proto */ +#if CYTHON_CCOMPLEX && (1) && (!0 || __cplusplus) + #define __Pyx_c_eq_long__double(a, b) ((a)==(b)) + #define __Pyx_c_sum_long__double(a, b) ((a)+(b)) + #define __Pyx_c_diff_long__double(a, b) ((a)-(b)) + #define __Pyx_c_prod_long__double(a, b) ((a)*(b)) + #define __Pyx_c_quot_long__double(a, b) ((a)/(b)) + #define __Pyx_c_neg_long__double(a) (-(a)) + #ifdef __cplusplus + #define __Pyx_c_is_zero_long__double(z) ((z)==(long double)0) + #define __Pyx_c_conj_long__double(z) (::std::conj(z)) + #if 1 + #define __Pyx_c_abs_long__double(z) (::std::abs(z)) + #define __Pyx_c_pow_long__double(a, b) (::std::pow(a, b)) + #endif + #else + #define __Pyx_c_is_zero_long__double(z) ((z)==0) + #define __Pyx_c_conj_long__double(z) (conjl(z)) + #if 1 + #define __Pyx_c_abs_long__double(z) (cabsl(z)) + #define __Pyx_c_pow_long__double(a, b) (cpowl(a, b)) + #endif + #endif +#else + static CYTHON_INLINE int __Pyx_c_eq_long__double(__pyx_t_long_double_complex, __pyx_t_long_double_complex); + static CYTHON_INLINE __pyx_t_long_double_complex __Pyx_c_sum_long__double(__pyx_t_long_double_complex, __pyx_t_long_double_complex); + static CYTHON_INLINE __pyx_t_long_double_complex __Pyx_c_diff_long__double(__pyx_t_long_double_complex, __pyx_t_long_double_complex); + static CYTHON_INLINE __pyx_t_long_double_complex __Pyx_c_prod_long__double(__pyx_t_long_double_complex, __pyx_t_long_double_complex); + static CYTHON_INLINE __pyx_t_long_double_complex __Pyx_c_quot_long__double(__pyx_t_long_double_complex, __pyx_t_long_double_complex); + static CYTHON_INLINE __pyx_t_long_double_complex __Pyx_c_neg_long__double(__pyx_t_long_double_complex); + static CYTHON_INLINE int __Pyx_c_is_zero_long__double(__pyx_t_long_double_complex); + static CYTHON_INLINE __pyx_t_long_double_complex __Pyx_c_conj_long__double(__pyx_t_long_double_complex); + #if 1 + static CYTHON_INLINE long double __Pyx_c_abs_long__double(__pyx_t_long_double_complex); + static CYTHON_INLINE __pyx_t_long_double_complex __Pyx_c_pow_long__double(__pyx_t_long_double_complex, __pyx_t_long_double_complex); + #endif +#endif + +/* BufferStructDeclare.proto */ +typedef struct { + Py_ssize_t shape, strides, suboffsets; +} __Pyx_Buf_DimInfo; +typedef struct { + size_t refcount; + Py_buffer pybuffer; +} __Pyx_Buffer; +typedef struct { + __Pyx_Buffer *rcbuffer; + char *data; + __Pyx_Buf_DimInfo diminfo[8]; +} __Pyx_LocalBuf_ND; + +/* MemviewRefcount.proto */ +static CYTHON_INLINE int __pyx_add_acquisition_count_locked( + __pyx_atomic_int_type *acquisition_count, PyThread_type_lock lock); +static CYTHON_INLINE int __pyx_sub_acquisition_count_locked( + __pyx_atomic_int_type *acquisition_count, PyThread_type_lock lock); +#define __pyx_get_slice_count_pointer(memview) (&memview->acquisition_count) +#define __PYX_INC_MEMVIEW(slice, have_gil) __Pyx_INC_MEMVIEW(slice, have_gil, __LINE__) +#define __PYX_XCLEAR_MEMVIEW(slice, have_gil) __Pyx_XCLEAR_MEMVIEW(slice, have_gil, __LINE__) +static CYTHON_INLINE void __Pyx_INC_MEMVIEW(__Pyx_memviewslice *, int, int); +static CYTHON_INLINE void __Pyx_XCLEAR_MEMVIEW(__Pyx_memviewslice *, int, int); + +/* MemviewSliceIsContig.proto */ +static int __pyx_memviewslice_is_contig(const __Pyx_memviewslice mvs, char order, int ndim); + +/* OverlappingSlices.proto */ +static int __pyx_slices_overlap(__Pyx_memviewslice *slice1, + __Pyx_memviewslice *slice2, + int ndim, size_t itemsize); + +/* MemviewSliceInit.proto */ +static int __Pyx_init_memviewslice( + struct __pyx_memoryview_obj *memview, + int ndim, + __Pyx_memviewslice *memviewslice, + int memview_is_new_reference); + +/* CIntFromPy.proto */ +static CYTHON_INLINE int __Pyx_PyLong_As_int(PyObject *); + +/* CIntToPy.proto */ +static CYTHON_INLINE PyObject* __Pyx_PyLong_From_int(int value); + +/* CIntToPy.proto */ +static CYTHON_INLINE PyObject* __Pyx_PyLong_From_uint64_t(uint64_t value); + +/* CIntFromPy.proto */ +static CYTHON_INLINE uint64_t __Pyx_PyLong_As_uint64_t(PyObject *); + +/* MemviewSliceCopy.proto */ +static __Pyx_memviewslice +__pyx_memoryview_copy_new_contig(const __Pyx_memviewslice *from_mvs, + const char *mode, int ndim, + size_t sizeof_dtype, int contig_flag, + int dtype_is_object); + +/* PyObjectCallMethod1.proto (used by UpdateUnpickledDict) */ +static PyObject* __Pyx_PyObject_CallMethod1(PyObject* obj, PyObject* method_name, PyObject* arg); + +/* UpdateUnpickledDict.proto */ +static int __Pyx_UpdateUnpickledDict(PyObject *obj, PyObject *state, Py_ssize_t index); + +/* CheckUnpickleChecksum.proto */ +static CYTHON_INLINE int __Pyx_CheckUnpickleChecksum(long checksum, long checksum1, long checksum2, long checksum3, const char *members); + +/* CIntFromPy.proto */ +static CYTHON_INLINE long __Pyx_PyLong_As_long(PyObject *); + +/* CIntToPy.proto */ +static CYTHON_INLINE PyObject* __Pyx_PyLong_From_long(long value); + +/* CIntFromPy.proto */ +static CYTHON_INLINE char __Pyx_PyLong_As_char(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 + +/* 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); + +/* IterNextPlain.proto (used by CoroutineBase) */ +static CYTHON_INLINE PyObject *__Pyx_PyIter_Next_Plain(PyObject *iterator); +#if CYTHON_COMPILING_IN_LIMITED_API && __PYX_LIMITED_VERSION_HEX < 0x030A0000 +static PyObject *__Pyx_GetBuiltinNext_LimitedAPI(void); +#endif + +/* ReturnWithStopIteration.proto (used by CoroutineBase) */ +static CYTHON_INLINE void __Pyx_ReturnWithStopIteration(PyObject* value, int async, int iternext); + +/* CoroutineBase.proto (used by Generator) */ +struct __pyx_CoroutineObject; +typedef PyObject *(*__pyx_coroutine_body_t)(struct __pyx_CoroutineObject *, PyThreadState *, PyObject *); +#if CYTHON_USE_EXC_INFO_STACK +#define __Pyx_ExcInfoStruct _PyErr_StackItem +#else +typedef struct { + PyObject *exc_type; + PyObject *exc_value; + PyObject *exc_traceback; +} __Pyx_ExcInfoStruct; +#endif +typedef struct __pyx_CoroutineObject { + PyObject_HEAD + __pyx_coroutine_body_t body; + PyObject *closure; + __Pyx_ExcInfoStruct gi_exc_state; +#if PY_VERSION_HEX < 0x030C0000 || CYTHON_COMPILING_IN_LIMITED_API + PyObject *gi_weakreflist; +#endif + PyObject *classobj; + PyObject *yieldfrom; + __Pyx_pyiter_sendfunc yieldfrom_am_send; + PyObject *gi_name; + PyObject *gi_qualname; + PyObject *gi_modulename; + PyObject *gi_code; + PyObject *gi_frame; +#if CYTHON_USE_SYS_MONITORING && (CYTHON_PROFILE || CYTHON_TRACE) + PyMonitoringState __pyx_pymonitoring_state[__Pyx_MonitoringEventTypes_CyGen_count]; + uint64_t __pyx_pymonitoring_version; +#endif + int resume_label; + char is_running; +} __pyx_CoroutineObject; +static __pyx_CoroutineObject *__Pyx__Coroutine_New( + PyTypeObject *type, __pyx_coroutine_body_t body, PyObject *code, PyObject *closure, + PyObject *name, PyObject *qualname, PyObject *module_name); +static __pyx_CoroutineObject *__Pyx__Coroutine_NewInit( + __pyx_CoroutineObject *gen, __pyx_coroutine_body_t body, PyObject *code, PyObject *closure, + PyObject *name, PyObject *qualname, PyObject *module_name); +static CYTHON_INLINE void __Pyx_Coroutine_ExceptionClear(__Pyx_ExcInfoStruct *self); +static int __Pyx_Coroutine_clear(PyObject *self); +static __Pyx_PySendResult __Pyx_Coroutine_AmSend(PyObject *self, PyObject *value, PyObject **retval); +static PyObject *__Pyx_Coroutine_Send(PyObject *self, PyObject *value); +static __Pyx_PySendResult __Pyx_Coroutine_Close(PyObject *self, PyObject **retval); +static PyObject *__Pyx_Coroutine_Throw(PyObject *gen, PyObject *args); +#if CYTHON_USE_EXC_INFO_STACK +#define __Pyx_Coroutine_SwapException(self) +#define __Pyx_Coroutine_ResetAndClearException(self) __Pyx_Coroutine_ExceptionClear(&(self)->gi_exc_state) +#else +#define __Pyx_Coroutine_SwapException(self) {\ + __Pyx_ExceptionSwap(&(self)->gi_exc_state.exc_type, &(self)->gi_exc_state.exc_value, &(self)->gi_exc_state.exc_traceback);\ + __Pyx_Coroutine_ResetFrameBackpointer(&(self)->gi_exc_state);\ + } +#define __Pyx_Coroutine_ResetAndClearException(self) {\ + __Pyx_ExceptionReset((self)->gi_exc_state.exc_type, (self)->gi_exc_state.exc_value, (self)->gi_exc_state.exc_traceback);\ + (self)->gi_exc_state.exc_type = (self)->gi_exc_state.exc_value = (self)->gi_exc_state.exc_traceback = NULL;\ + } +#endif +#if CYTHON_FAST_THREAD_STATE +#define __Pyx_PyGen_FetchStopIterationValue(pvalue)\ + __Pyx_PyGen__FetchStopIterationValue(__pyx_tstate, pvalue) +#else +#define __Pyx_PyGen_FetchStopIterationValue(pvalue)\ + __Pyx_PyGen__FetchStopIterationValue(__Pyx_PyThreadState_Current, pvalue) +#endif +static int __Pyx_PyGen__FetchStopIterationValue(PyThreadState *tstate, PyObject **pvalue); +static CYTHON_INLINE void __Pyx_Coroutine_ResetFrameBackpointer(__Pyx_ExcInfoStruct *exc_state); +static char __Pyx_Coroutine_test_and_set_is_running(__pyx_CoroutineObject *gen); +static void __Pyx_Coroutine_unset_is_running(__pyx_CoroutineObject *gen); +static char __Pyx_Coroutine_get_is_running(__pyx_CoroutineObject *gen); +static PyObject *__Pyx_Coroutine_get_is_running_getter(PyObject *gen, void *closure); +#if __PYX_HAS_PY_AM_SEND == 2 +static void __Pyx_SetBackportTypeAmSend(PyTypeObject *type, __Pyx_PyAsyncMethodsStruct *static_amsend_methods, __Pyx_pyiter_sendfunc am_send); +#endif +static PyObject *__Pyx_Coroutine_fail_reduce_ex(PyObject *self, PyObject *arg); + +/* Generator.proto */ +#define __Pyx_Generator_USED +#define __Pyx_Generator_CheckExact(obj) __Pyx_IS_TYPE(obj, __pyx_mstate_global->__pyx_GeneratorType) +#define __Pyx_Generator_New(body, code, closure, name, qualname, module_name)\ + __Pyx__Coroutine_New(__pyx_mstate_global->__pyx_GeneratorType, body, code, closure, name, qualname, module_name) +static PyObject *__Pyx_Generator_Next(PyObject *self); +static int __pyx_Generator_init(PyObject *module); +static CYTHON_INLINE PyObject *__Pyx_Generator_GetInlinedResult(PyObject *self); + +/* 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 "." + +static PyObject *__pyx_array_get_memview(struct __pyx_array_obj *__pyx_v_self); /* proto*/ +static char *__pyx_memoryview_get_item_pointer(struct __pyx_memoryview_obj *__pyx_v_self, PyObject *__pyx_v_index); /* proto*/ +static PyObject *__pyx_memoryview_is_slice(struct __pyx_memoryview_obj *__pyx_v_self, PyObject *__pyx_v_obj); /* proto*/ +static PyObject *__pyx_memoryview_setitem_slice_assignment(struct __pyx_memoryview_obj *__pyx_v_self, PyObject *__pyx_v_dst, PyObject *__pyx_v_src); /* proto*/ +static PyObject *__pyx_memoryview_setitem_slice_assign_scalar(struct __pyx_memoryview_obj *__pyx_v_self, struct __pyx_memoryview_obj *__pyx_v_dst, PyObject *__pyx_v_value); /* proto*/ +static PyObject *__pyx_memoryview_setitem_indexed(struct __pyx_memoryview_obj *__pyx_v_self, PyObject *__pyx_v_index, PyObject *__pyx_v_value); /* proto*/ +static PyObject *__pyx_memoryview_convert_item_to_object(struct __pyx_memoryview_obj *__pyx_v_self, char *__pyx_v_itemp); /* proto*/ +static PyObject *__pyx_memoryview_assign_item_from_object(struct __pyx_memoryview_obj *__pyx_v_self, char *__pyx_v_itemp, PyObject *__pyx_v_value); /* proto*/ +static PyObject *__pyx_memoryview__get_base(struct __pyx_memoryview_obj *__pyx_v_self); /* proto*/ +static PyObject *__pyx_memoryviewslice_convert_item_to_object(struct __pyx_memoryviewslice_obj *__pyx_v_self, char *__pyx_v_itemp); /* proto*/ +static PyObject *__pyx_memoryviewslice_assign_item_from_object(struct __pyx_memoryviewslice_obj *__pyx_v_self, char *__pyx_v_itemp, PyObject *__pyx_v_value); /* proto*/ +static PyObject *__pyx_memoryviewslice__get_base(struct __pyx_memoryviewslice_obj *__pyx_v_self); /* proto*/ +static CYTHON_INLINE npy_intp __pyx_f_5numpy_5dtype_8itemsize_itemsize(PyArray_Descr *__pyx_v_self); /* proto*/ +static CYTHON_INLINE npy_intp __pyx_f_5numpy_5dtype_9alignment_alignment(PyArray_Descr *__pyx_v_self); /* proto*/ +static CYTHON_INLINE PyObject *__pyx_f_5numpy_5dtype_6fields_fields(PyArray_Descr *__pyx_v_self); /* proto*/ +static CYTHON_INLINE PyObject *__pyx_f_5numpy_5dtype_5names_names(PyArray_Descr *__pyx_v_self); /* proto*/ +static CYTHON_INLINE PyArray_ArrayDescr *__pyx_f_5numpy_5dtype_8subarray_subarray(PyArray_Descr *__pyx_v_self); /* proto*/ +static CYTHON_INLINE npy_uint64 __pyx_f_5numpy_5dtype_5flags_flags(PyArray_Descr *__pyx_v_self); /* proto*/ +static CYTHON_INLINE int __pyx_f_5numpy_9broadcast_7numiter_numiter(PyArrayMultiIterObject *__pyx_v_self); /* proto*/ +static CYTHON_INLINE npy_intp __pyx_f_5numpy_9broadcast_4size_size(PyArrayMultiIterObject *__pyx_v_self); /* proto*/ +static CYTHON_INLINE npy_intp __pyx_f_5numpy_9broadcast_5index_index(PyArrayMultiIterObject *__pyx_v_self); /* proto*/ +static CYTHON_INLINE int __pyx_f_5numpy_9broadcast_2nd_nd(PyArrayMultiIterObject *__pyx_v_self); /* proto*/ +static CYTHON_INLINE npy_intp *__pyx_f_5numpy_9broadcast_10dimensions_dimensions(PyArrayMultiIterObject *__pyx_v_self); /* proto*/ +static CYTHON_INLINE void **__pyx_f_5numpy_9broadcast_5iters_iters(PyArrayMultiIterObject *__pyx_v_self); /* proto*/ +static CYTHON_INLINE PyObject *__pyx_f_5numpy_7ndarray_4base_base(PyArrayObject *__pyx_v_self); /* proto*/ +static CYTHON_INLINE PyArray_Descr *__pyx_f_5numpy_7ndarray_5descr_descr(PyArrayObject *__pyx_v_self); /* proto*/ +static CYTHON_INLINE int __pyx_f_5numpy_7ndarray_4ndim_ndim(PyArrayObject *__pyx_v_self); /* proto*/ +static CYTHON_INLINE npy_intp *__pyx_f_5numpy_7ndarray_5shape_shape(PyArrayObject *__pyx_v_self); /* proto*/ +static CYTHON_INLINE npy_intp *__pyx_f_5numpy_7ndarray_7strides_strides(PyArrayObject *__pyx_v_self); /* proto*/ +static CYTHON_INLINE npy_intp __pyx_f_5numpy_7ndarray_4size_size(PyArrayObject *__pyx_v_self); /* proto*/ +static CYTHON_INLINE char *__pyx_f_5numpy_7ndarray_4data_data(PyArrayObject *__pyx_v_self); /* proto*/ + +/* Module declarations from "libc.string" */ + +/* Module declarations from "libcpp.string_view" */ + +/* Module declarations from "libcpp.string" */ + +/* Module declarations from "libc.limits" */ + +/* Module declarations from "libc.stdlib" */ + +/* Module declarations from "libcpp" */ + +/* Module declarations from "libcpp.utility" */ + +/* Module declarations from "libcpp.unordered_set" */ + +/* Module declarations from "libcpp.vector" */ + +/* Module declarations from "libc.stdio" */ + +/* Module declarations from "__builtin__" */ + +/* Module declarations from "cpython.type" */ + +/* Module declarations from "cpython" */ + +/* Module declarations from "cpython.object" */ + +/* Module declarations from "cpython.ref" */ + +/* Module declarations from "numpy" */ + +/* Module declarations from "numpy" */ + +/* Module declarations from "cymem.cymem" */ + +/* Module declarations from "spacy" */ + +/* Module declarations from "spacy.symbols" */ + +/* Module declarations from "spacy.attrs" */ + +/* Module declarations from "libc.stdint" */ + +/* Module declarations from "libcpp.unordered_map" */ + +/* Module declarations from "spacy.parts_of_speech" */ + +/* Module declarations from "spacy.typedefs" */ + +/* Module declarations from "spacy.structs" */ + +/* Module declarations from "murmurhash.mrmr" */ +static uint64_t (*__pyx_f_10murmurhash_4mrmr_hash64)(void *, int, uint64_t); /*proto*/ + +/* Module declarations from "preshed.maps" */ + +/* Module declarations from "libcpp.set" */ + +/* Module declarations from "spacy.strings" */ + +/* Module declarations from "spacy.morphology" */ + +/* Module declarations from "spacy.vocab" */ +static struct __pyx_t_5spacy_7structs_LexemeC *__pyx_vp_5spacy_5vocab_EMPTY_LEXEME = 0; +#define __pyx_v_5spacy_5vocab_EMPTY_LEXEME (*__pyx_vp_5spacy_5vocab_EMPTY_LEXEME) + +/* Module declarations from "spacy.tokens.doc" */ +static int (*__pyx_f_5spacy_6tokens_3doc_set_children_from_heads)(struct __pyx_t_5spacy_7structs_TokenC *, int, int); /*proto*/ + +/* Module declarations from "spacy.pipeline._parser_internals.nonproj" */ +static PyObject *__pyx_collections_abc_Sequence = 0; +static PyObject *generic = 0; +static PyObject *strided = 0; +static PyObject *indirect = 0; +static PyObject *contiguous = 0; +static PyObject *indirect_contiguous = 0; +static int __pyx_memoryview_thread_locks_used; +static PyThread_type_lock __pyx_memoryview_thread_locks[8]; +static bool __pyx_f_5spacy_8pipeline_17_parser_internals_7nonproj__is_nonproj_arc(int, std::vector const &); /*proto*/ +static bool __pyx_f_5spacy_8pipeline_17_parser_internals_7nonproj__has_head_as_ancestor(int, int, std::vector const &); /*proto*/ +static std::string __pyx_f_5spacy_8pipeline_17_parser_internals_7nonproj_heads_to_string(std::vector const &); /*proto*/ +static std::vector __pyx_f_5spacy_8pipeline_17_parser_internals_7nonproj__heads_to_c(PyObject *); /*proto*/ +static PyObject *__pyx_f_5spacy_8pipeline_17_parser_internals_7nonproj_deprojectivize(struct __pyx_obj_5spacy_6tokens_3doc_Doc *, int __pyx_skip_dispatch); /*proto*/ +static int __pyx_f_5spacy_8pipeline_17_parser_internals_7nonproj__get_smallest_nonproj_arc(std::vector const &); /*proto*/ +static int __pyx_f_5spacy_8pipeline_17_parser_internals_7nonproj__lift(PyObject *, PyObject *, int __pyx_skip_dispatch); /*proto*/ +static int __pyx_array_allocate_buffer(struct __pyx_array_obj *); /*proto*/ +static struct __pyx_array_obj *__pyx_array_new(PyObject *, Py_ssize_t, char *, char const *, char *); /*proto*/ +static PyObject *__pyx_memoryview_new(PyObject *, int, int, __Pyx_TypeInfo const *); /*proto*/ +static CYTHON_INLINE int __pyx_memoryview_check(PyObject *); /*proto*/ +static PyObject *_unellipsify(PyObject *, int); /*proto*/ +static int assert_direct_dimensions(Py_ssize_t *, int); /*proto*/ +static struct __pyx_memoryview_obj *__pyx_memview_slice(struct __pyx_memoryview_obj *, PyObject *); /*proto*/ +static int __pyx_memoryview_slice_memviewslice(__Pyx_memviewslice *, Py_ssize_t, Py_ssize_t, Py_ssize_t, int, int, int *, Py_ssize_t, Py_ssize_t, Py_ssize_t, int, int, int, int); /*proto*/ +static char *__pyx_pybuffer_index(Py_buffer *, char *, Py_ssize_t, Py_ssize_t); /*proto*/ +static int __pyx_memslice_transpose(__Pyx_memviewslice *); /*proto*/ +static PyObject *__pyx_memoryview_fromslice(__Pyx_memviewslice, int, PyObject *(*)(char *), int (*)(char *, PyObject *), int); /*proto*/ +static __Pyx_memviewslice *__pyx_memoryview_get_slice_from_memoryview(struct __pyx_memoryview_obj *, __Pyx_memviewslice *); /*proto*/ +static void __pyx_memoryview_slice_copy(struct __pyx_memoryview_obj *, __Pyx_memviewslice *); /*proto*/ +static PyObject *__pyx_memoryview_copy_object(struct __pyx_memoryview_obj *); /*proto*/ +static PyObject *__pyx_memoryview_copy_object_from_slice(struct __pyx_memoryview_obj *, __Pyx_memviewslice *); /*proto*/ +static Py_ssize_t abs_py_ssize_t(Py_ssize_t); /*proto*/ +static char __pyx_get_best_slice_order(__Pyx_memviewslice *, int); /*proto*/ +static void _copy_strided_to_strided(char *, Py_ssize_t *, char *, Py_ssize_t *, Py_ssize_t *, Py_ssize_t *, int, size_t); /*proto*/ +static void copy_strided_to_strided(__Pyx_memviewslice *, __Pyx_memviewslice *, int, size_t); /*proto*/ +static Py_ssize_t __pyx_memoryview_slice_get_size(__Pyx_memviewslice *, int); /*proto*/ +static Py_ssize_t __pyx_fill_contig_strides_array(Py_ssize_t *, Py_ssize_t *, Py_ssize_t, int, char); /*proto*/ +static void *__pyx_memoryview_copy_data_to_temp(__Pyx_memviewslice *, __Pyx_memviewslice *, char, int); /*proto*/ +static int __pyx_memoryview_err_extents(int, Py_ssize_t, Py_ssize_t); /*proto*/ +static int __pyx_memoryview_err_dim(PyObject *, PyObject *, int); /*proto*/ +static int __pyx_memoryview_err(PyObject *, PyObject *); /*proto*/ +static int __pyx_memoryview_err_no_memory(void); /*proto*/ +static int __pyx_memoryview_copy_contents(__Pyx_memviewslice, __Pyx_memviewslice, int, int, int); /*proto*/ +static void __pyx_memoryview_broadcast_leading(__Pyx_memviewslice *, int, int); /*proto*/ +static void __pyx_memoryview_refcount_copying(__Pyx_memviewslice *, int, int, int); /*proto*/ +static void __pyx_memoryview_refcount_objects_in_slice_with_gil(char *, Py_ssize_t *, Py_ssize_t *, int, int); /*proto*/ +static void __pyx_memoryview_refcount_objects_in_slice(char *, Py_ssize_t *, Py_ssize_t *, int, int); /*proto*/ +static void __pyx_memoryview_slice_assign_scalar(__Pyx_memviewslice *, int, size_t, void *, int); /*proto*/ +static void __pyx_memoryview__slice_assign_scalar(char *, Py_ssize_t *, Py_ssize_t *, int, size_t, void *); /*proto*/ +static PyObject *__pyx_unpickle_Enum__set_state(struct __pyx_MemviewEnum_obj *, PyObject *); /*proto*/ +/* #### Code section: typeinfo ### */ +/* #### Code section: before_global_var ### */ +#define __Pyx_MODULE_NAME "spacy.pipeline._parser_internals.nonproj" +extern int __pyx_module_is_main_spacy__pipeline___parser_internals__nonproj; +int __pyx_module_is_main_spacy__pipeline___parser_internals__nonproj = 0; + +/* Implementation of "spacy.pipeline._parser_internals.nonproj" */ +/* #### Code section: global_var ### */ +static PyObject *__pyx_builtin_enumerate; +static PyObject *__pyx_builtin___import__; +static PyObject *__pyx_builtin_Ellipsis; +static PyObject *__pyx_builtin_id; +/* #### Code section: string_decls ### */ +static const char __pyx_k_Implements_the_projectivize_depr[] = "Implements the projectivize/deprojectivize mechanism in Nivre & Nilsson 2005\nfor doing pseudo-projective parsing implementation uses the HEAD decoration\nscheme.\n"; +/* #### Code section: decls ### */ +static int __pyx_array___pyx_pf_15View_dot_MemoryView_5array___cinit__(struct __pyx_array_obj *__pyx_v_self, PyObject *__pyx_v_shape, Py_ssize_t __pyx_v_itemsize, PyObject *__pyx_v_format, PyObject *__pyx_v_mode, int __pyx_v_allocate_buffer); /* proto */ +static int __pyx_array___pyx_pf_15View_dot_MemoryView_5array_2__getbuffer__(struct __pyx_array_obj *__pyx_v_self, Py_buffer *__pyx_v_info, int __pyx_v_flags); /* proto */ +static void __pyx_array___pyx_pf_15View_dot_MemoryView_5array_4__dealloc__(struct __pyx_array_obj *__pyx_v_self); /* proto */ +static PyObject *__pyx_pf_15View_dot_MemoryView_5array_7memview___get__(struct __pyx_array_obj *__pyx_v_self); /* proto */ +static Py_ssize_t __pyx_array___pyx_pf_15View_dot_MemoryView_5array_6__len__(struct __pyx_array_obj *__pyx_v_self); /* proto */ +static PyObject *__pyx_array___pyx_pf_15View_dot_MemoryView_5array_8__getattr__(struct __pyx_array_obj *__pyx_v_self, PyObject *__pyx_v_attr); /* proto */ +static PyObject *__pyx_array___pyx_pf_15View_dot_MemoryView_5array_10__getitem__(struct __pyx_array_obj *__pyx_v_self, PyObject *__pyx_v_item); /* proto */ +static int __pyx_array___pyx_pf_15View_dot_MemoryView_5array_12__setitem__(struct __pyx_array_obj *__pyx_v_self, PyObject *__pyx_v_item, PyObject *__pyx_v_value); /* proto */ +static PyObject *__pyx_pf___pyx_array___reduce_cython__(CYTHON_UNUSED struct __pyx_array_obj *__pyx_v_self); /* proto */ +static PyObject *__pyx_pf___pyx_array_2__setstate_cython__(CYTHON_UNUSED struct __pyx_array_obj *__pyx_v_self, CYTHON_UNUSED PyObject *__pyx_v___pyx_state); /* proto */ +static int __pyx_MemviewEnum___pyx_pf_15View_dot_MemoryView_4Enum___init__(struct __pyx_MemviewEnum_obj *__pyx_v_self, PyObject *__pyx_v_name); /* proto */ +static PyObject *__pyx_MemviewEnum___pyx_pf_15View_dot_MemoryView_4Enum_2__repr__(struct __pyx_MemviewEnum_obj *__pyx_v_self); /* proto */ +static PyObject *__pyx_pf___pyx_MemviewEnum___reduce_cython__(struct __pyx_MemviewEnum_obj *__pyx_v_self); /* proto */ +static PyObject *__pyx_pf___pyx_MemviewEnum_2__setstate_cython__(struct __pyx_MemviewEnum_obj *__pyx_v_self, PyObject *__pyx_v___pyx_state); /* proto */ +static int __pyx_memoryview___pyx_pf_15View_dot_MemoryView_10memoryview___cinit__(struct __pyx_memoryview_obj *__pyx_v_self, PyObject *__pyx_v_obj, int __pyx_v_flags, int __pyx_v_dtype_is_object); /* proto */ +static void __pyx_memoryview___pyx_pf_15View_dot_MemoryView_10memoryview_2__dealloc__(struct __pyx_memoryview_obj *__pyx_v_self); /* proto */ +static PyObject *__pyx_memoryview___pyx_pf_15View_dot_MemoryView_10memoryview_4__getitem__(struct __pyx_memoryview_obj *__pyx_v_self, PyObject *__pyx_v_index); /* proto */ +static int __pyx_memoryview___pyx_pf_15View_dot_MemoryView_10memoryview_6__setitem__(struct __pyx_memoryview_obj *__pyx_v_self, PyObject *__pyx_v_index, PyObject *__pyx_v_value); /* proto */ +static int __pyx_memoryview___pyx_pf_15View_dot_MemoryView_10memoryview_8__getbuffer__(struct __pyx_memoryview_obj *__pyx_v_self, Py_buffer *__pyx_v_info, int __pyx_v_flags); /* proto */ +static PyObject *__pyx_pf_15View_dot_MemoryView_10memoryview_1T___get__(struct __pyx_memoryview_obj *__pyx_v_self); /* proto */ +static PyObject *__pyx_pf_15View_dot_MemoryView_10memoryview_4base___get__(struct __pyx_memoryview_obj *__pyx_v_self); /* proto */ +static PyObject *__pyx_pf_15View_dot_MemoryView_10memoryview_5shape___get__(struct __pyx_memoryview_obj *__pyx_v_self); /* proto */ +static PyObject *__pyx_pf_15View_dot_MemoryView_10memoryview_7strides___get__(struct __pyx_memoryview_obj *__pyx_v_self); /* proto */ +static PyObject *__pyx_pf_15View_dot_MemoryView_10memoryview_10suboffsets___get__(struct __pyx_memoryview_obj *__pyx_v_self); /* proto */ +static PyObject *__pyx_pf_15View_dot_MemoryView_10memoryview_4ndim___get__(struct __pyx_memoryview_obj *__pyx_v_self); /* proto */ +static PyObject *__pyx_pf_15View_dot_MemoryView_10memoryview_8itemsize___get__(struct __pyx_memoryview_obj *__pyx_v_self); /* proto */ +static PyObject *__pyx_pf_15View_dot_MemoryView_10memoryview_6nbytes___get__(struct __pyx_memoryview_obj *__pyx_v_self); /* proto */ +static PyObject *__pyx_pf_15View_dot_MemoryView_10memoryview_4size___get__(struct __pyx_memoryview_obj *__pyx_v_self); /* proto */ +static Py_ssize_t __pyx_memoryview___pyx_pf_15View_dot_MemoryView_10memoryview_10__len__(struct __pyx_memoryview_obj *__pyx_v_self); /* proto */ +static PyObject *__pyx_memoryview___pyx_pf_15View_dot_MemoryView_10memoryview_12__repr__(struct __pyx_memoryview_obj *__pyx_v_self); /* proto */ +static PyObject *__pyx_memoryview___pyx_pf_15View_dot_MemoryView_10memoryview_14__str__(struct __pyx_memoryview_obj *__pyx_v_self); /* proto */ +static PyObject *__pyx_memoryview___pyx_pf_15View_dot_MemoryView_10memoryview_16is_c_contig(struct __pyx_memoryview_obj *__pyx_v_self); /* proto */ +static PyObject *__pyx_memoryview___pyx_pf_15View_dot_MemoryView_10memoryview_18is_f_contig(struct __pyx_memoryview_obj *__pyx_v_self); /* proto */ +static PyObject *__pyx_memoryview___pyx_pf_15View_dot_MemoryView_10memoryview_20copy(struct __pyx_memoryview_obj *__pyx_v_self); /* proto */ +static PyObject *__pyx_memoryview___pyx_pf_15View_dot_MemoryView_10memoryview_22copy_fortran(struct __pyx_memoryview_obj *__pyx_v_self); /* proto */ +static PyObject *__pyx_pf___pyx_memoryview___reduce_cython__(CYTHON_UNUSED struct __pyx_memoryview_obj *__pyx_v_self); /* proto */ +static PyObject *__pyx_pf___pyx_memoryview_2__setstate_cython__(CYTHON_UNUSED struct __pyx_memoryview_obj *__pyx_v_self, CYTHON_UNUSED PyObject *__pyx_v___pyx_state); /* proto */ +static void __pyx_memoryviewslice___pyx_pf_15View_dot_MemoryView_16_memoryviewslice___dealloc__(struct __pyx_memoryviewslice_obj *__pyx_v_self); /* proto */ +static PyObject *__pyx_pf___pyx_memoryviewslice___reduce_cython__(CYTHON_UNUSED struct __pyx_memoryviewslice_obj *__pyx_v_self); /* proto */ +static PyObject *__pyx_pf___pyx_memoryviewslice_2__setstate_cython__(CYTHON_UNUSED struct __pyx_memoryviewslice_obj *__pyx_v_self, CYTHON_UNUSED PyObject *__pyx_v___pyx_state); /* proto */ +static PyObject *__pyx_pf_15View_dot_MemoryView___pyx_unpickle_Enum(CYTHON_UNUSED PyObject *__pyx_self, PyObject *__pyx_v___pyx_type, long __pyx_v___pyx_checksum, PyObject *__pyx_v___pyx_state); /* proto */ +static PyObject *__pyx_pf_5spacy_8pipeline_17_parser_internals_7nonproj_ancestors(CYTHON_UNUSED PyObject *__pyx_self, PyObject *__pyx_v_tokenid, PyObject *__pyx_v_heads); /* proto */ +static PyObject *__pyx_pf_5spacy_8pipeline_17_parser_internals_7nonproj_3contains_cycle(CYTHON_UNUSED PyObject *__pyx_self, PyObject *__pyx_v_heads); /* proto */ +static PyObject *__pyx_pf_5spacy_8pipeline_17_parser_internals_7nonproj_5is_nonproj_arc(CYTHON_UNUSED PyObject *__pyx_self, PyObject *__pyx_v_tokenid, PyObject *__pyx_v_heads); /* proto */ +static PyObject *__pyx_pf_5spacy_8pipeline_17_parser_internals_7nonproj_15is_nonproj_tree_genexpr(PyObject *__pyx_self, Py_ssize_t __pyx_genexpr_arg_0); /* proto */ +static PyObject *__pyx_pf_5spacy_8pipeline_17_parser_internals_7nonproj_7is_nonproj_tree(CYTHON_UNUSED PyObject *__pyx_self, PyObject *__pyx_v_heads); /* proto */ +static PyObject *__pyx_pf_5spacy_8pipeline_17_parser_internals_7nonproj_9decompose(CYTHON_UNUSED PyObject *__pyx_self, PyObject *__pyx_v_label); /* proto */ +static PyObject *__pyx_pf_5spacy_8pipeline_17_parser_internals_7nonproj_11is_decorated(CYTHON_UNUSED PyObject *__pyx_self, PyObject *__pyx_v_label); /* proto */ +static PyObject *__pyx_pf_5spacy_8pipeline_17_parser_internals_7nonproj_13count_decorated_labels(CYTHON_UNUSED PyObject *__pyx_self, PyObject *__pyx_v_gold_data); /* proto */ +static PyObject *__pyx_pf_5spacy_8pipeline_17_parser_internals_7nonproj_15projectivize(CYTHON_UNUSED PyObject *__pyx_self, PyObject *__pyx_v_heads, PyObject *__pyx_v_labels); /* proto */ +static PyObject *__pyx_pf_5spacy_8pipeline_17_parser_internals_7nonproj_17deprojectivize(CYTHON_UNUSED PyObject *__pyx_self, struct __pyx_obj_5spacy_6tokens_3doc_Doc *__pyx_v_doc); /* proto */ +static PyObject *__pyx_pf_5spacy_8pipeline_17_parser_internals_7nonproj_19_decorate(CYTHON_UNUSED PyObject *__pyx_self, PyObject *__pyx_v_heads, PyObject *__pyx_v_proj_heads, PyObject *__pyx_v_labels); /* proto */ +static PyObject *__pyx_pf_5spacy_8pipeline_17_parser_internals_7nonproj_21get_smallest_nonproj_arc_slow(CYTHON_UNUSED PyObject *__pyx_self, PyObject *__pyx_v_heads); /* proto */ +static PyObject *__pyx_pf_5spacy_8pipeline_17_parser_internals_7nonproj_23_lift(CYTHON_UNUSED PyObject *__pyx_self, PyObject *__pyx_v_tokenid, PyObject *__pyx_v_heads); /* proto */ +static PyObject *__pyx_pf_5spacy_8pipeline_17_parser_internals_7nonproj_25_find_new_head(CYTHON_UNUSED PyObject *__pyx_self, PyObject *__pyx_v_token, PyObject *__pyx_v_headlabel); /* proto */ +static PyObject *__pyx_tp_new_5spacy_8pipeline_17_parser_internals_7nonproj___pyx_scope_struct__ancestors(PyTypeObject *t, PyObject *a, PyObject *k); /*proto*/ +static PyObject *__pyx_tp_new_5spacy_8pipeline_17_parser_internals_7nonproj___pyx_scope_struct_1_is_nonproj_tree(PyTypeObject *t, PyObject *a, PyObject *k); /*proto*/ +static PyObject *__pyx_tp_new_5spacy_8pipeline_17_parser_internals_7nonproj___pyx_scope_struct_2_genexpr(PyTypeObject *t, PyObject *a, PyObject *k); /*proto*/ +static PyObject *__pyx_tp_new_array(PyTypeObject *t, PyObject *a, PyObject *k); /*proto*/ +static PyObject *__pyx_tp_new_Enum(PyTypeObject *t, PyObject *a, PyObject *k); /*proto*/ +static PyObject *__pyx_tp_new_memoryview(PyTypeObject *t, PyObject *a, PyObject *k); /*proto*/ +static PyObject *__pyx_tp_new__memoryviewslice(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_7cpython_4type_type; + PyTypeObject *__pyx_ptype_5numpy_dtype; + PyTypeObject *__pyx_ptype_5numpy_flatiter; + PyTypeObject *__pyx_ptype_5numpy_broadcast; + PyTypeObject *__pyx_ptype_5numpy_ndarray; + PyTypeObject *__pyx_ptype_5numpy_generic; + PyTypeObject *__pyx_ptype_5numpy_number; + PyTypeObject *__pyx_ptype_5numpy_integer; + PyTypeObject *__pyx_ptype_5numpy_signedinteger; + PyTypeObject *__pyx_ptype_5numpy_unsignedinteger; + PyTypeObject *__pyx_ptype_5numpy_inexact; + PyTypeObject *__pyx_ptype_5numpy_floating; + PyTypeObject *__pyx_ptype_5numpy_complexfloating; + PyTypeObject *__pyx_ptype_5numpy_flexible; + PyTypeObject *__pyx_ptype_5numpy_character; + PyTypeObject *__pyx_ptype_5numpy_ufunc; + PyTypeObject *__pyx_ptype_5cymem_5cymem_PyMalloc; + PyTypeObject *__pyx_ptype_5cymem_5cymem_PyFree; + PyTypeObject *__pyx_ptype_5cymem_5cymem_Pool; + PyTypeObject *__pyx_ptype_5cymem_5cymem_Address; + PyTypeObject *__pyx_ptype_7preshed_4maps_PreshMap; + PyTypeObject *__pyx_ptype_7preshed_4maps_PreshMapArray; + PyTypeObject *__pyx_ptype_5spacy_7strings_StringStore; + PyTypeObject *__pyx_ptype_5spacy_10morphology_Morphology; + PyTypeObject *__pyx_ptype_5spacy_5vocab_Vocab; + PyTypeObject *__pyx_ptype_5spacy_6tokens_3doc_Doc; + PyObject *__pyx_type_5spacy_8pipeline_17_parser_internals_7nonproj___pyx_scope_struct__ancestors; + PyObject *__pyx_type_5spacy_8pipeline_17_parser_internals_7nonproj___pyx_scope_struct_1_is_nonproj_tree; + PyObject *__pyx_type_5spacy_8pipeline_17_parser_internals_7nonproj___pyx_scope_struct_2_genexpr; + PyObject *__pyx_type___pyx_array; + PyObject *__pyx_type___pyx_MemviewEnum; + PyObject *__pyx_type___pyx_memoryview; + PyObject *__pyx_type___pyx_memoryviewslice; + PyTypeObject *__pyx_ptype_5spacy_8pipeline_17_parser_internals_7nonproj___pyx_scope_struct__ancestors; + PyTypeObject *__pyx_ptype_5spacy_8pipeline_17_parser_internals_7nonproj___pyx_scope_struct_1_is_nonproj_tree; + PyTypeObject *__pyx_ptype_5spacy_8pipeline_17_parser_internals_7nonproj___pyx_scope_struct_2_genexpr; + PyTypeObject *__pyx_array_type; + PyTypeObject *__pyx_MemviewEnum_type; + PyTypeObject *__pyx_memoryview_type; + PyTypeObject *__pyx_memoryviewslice_type; + __Pyx_CachedCFunction __pyx_umethod_PyDict_Type_get; + __Pyx_CachedCFunction __pyx_umethod_PyDict_Type_items; + __Pyx_CachedCFunction __pyx_umethod_PyDict_Type_pop; + __Pyx_CachedCFunction __pyx_umethod_PyDict_Type_values; + PyObject *__pyx_slice[2]; + PyObject *__pyx_tuple[2]; + PyObject *__pyx_codeobj_tab[14]; + PyObject *__pyx_string_tab[203]; + PyObject *__pyx_number_tab[5]; +/* #### Code section: module_state_contents ### */ + +#if CYTHON_USE_FREELISTS +struct __pyx_obj_5spacy_8pipeline_17_parser_internals_7nonproj___pyx_scope_struct__ancestors *__pyx_freelist_5spacy_8pipeline_17_parser_internals_7nonproj___pyx_scope_struct__ancestors[8]; +int __pyx_freecount_5spacy_8pipeline_17_parser_internals_7nonproj___pyx_scope_struct__ancestors; +#endif + +#if CYTHON_USE_FREELISTS +struct __pyx_obj_5spacy_8pipeline_17_parser_internals_7nonproj___pyx_scope_struct_1_is_nonproj_tree *__pyx_freelist_5spacy_8pipeline_17_parser_internals_7nonproj___pyx_scope_struct_1_is_nonproj_tree[8]; +int __pyx_freecount_5spacy_8pipeline_17_parser_internals_7nonproj___pyx_scope_struct_1_is_nonproj_tree; +#endif + +#if CYTHON_USE_FREELISTS +struct __pyx_obj_5spacy_8pipeline_17_parser_internals_7nonproj___pyx_scope_struct_2_genexpr *__pyx_freelist_5spacy_8pipeline_17_parser_internals_7nonproj___pyx_scope_struct_2_genexpr[8]; +int __pyx_freecount_5spacy_8pipeline_17_parser_internals_7nonproj___pyx_scope_struct_2_genexpr; +#endif +/* 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; + +/* IterNextPlain.module_state_decls */ +#if CYTHON_COMPILING_IN_LIMITED_API && __PYX_LIMITED_VERSION_HEX < 0x030A0000 +PyObject *__Pyx_GetBuiltinNext_LimitedAPI_cache; +#endif + +/* Generator.module_state_decls */ +PyTypeObject *__pyx_GeneratorType; + +/* #### 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_All_dimensions_preceding_dimensi __pyx_string_tab[1] +#define __pyx_kp_u_Buffer_view_does_not_expose_stri __pyx_string_tab[2] +#define __pyx_kp_u_Can_only_create_a_buffer_that_is __pyx_string_tab[3] +#define __pyx_kp_u_Cannot_assign_to_read_only_memor __pyx_string_tab[4] +#define __pyx_kp_u_Cannot_create_writable_memory_vi __pyx_string_tab[5] +#define __pyx_kp_u_Cannot_index_with_type __pyx_string_tab[6] +#define __pyx_kp_u_Cannot_transpose_memoryview_with __pyx_string_tab[7] +#define __pyx_kp_u_Dimension_d_is_not_direct __pyx_string_tab[8] +#define __pyx_kp_u_Empty_shape_tuple_for_cython_arr __pyx_string_tab[9] +#define __pyx_kp_u_Index_out_of_bounds_axis_d __pyx_string_tab[10] +#define __pyx_kp_u_Indirect_dimensions_not_supporte __pyx_string_tab[11] +#define __pyx_kp_u_Invalid_mode_expected_c_or_fortr __pyx_string_tab[12] +#define __pyx_kp_u_Invalid_shape_in_axis __pyx_string_tab[13] +#define __pyx_kp_u_MemoryView_of __pyx_string_tab[14] +#define __pyx_kp_u_Note_that_Cython_is_deliberately __pyx_string_tab[15] +#define __pyx_kp_u_Out_of_bounds_on_buffer_access_a __pyx_string_tab[16] +#define __pyx_kp_u_Step_may_not_be_zero_axis_d __pyx_string_tab[17] +#define __pyx_kp_u_Unable_to_convert_item_to_object __pyx_string_tab[18] +#define __pyx_kp_u__2 __pyx_string_tab[19] +#define __pyx_kp_u__3 __pyx_string_tab[20] +#define __pyx_kp_u__4 __pyx_string_tab[21] +#define __pyx_kp_u__5 __pyx_string_tab[22] +#define __pyx_kp_u__6 __pyx_string_tab[23] +#define __pyx_kp_u__7 __pyx_string_tab[24] +#define __pyx_kp_u_add_note __pyx_string_tab[25] +#define __pyx_kp_u_and __pyx_string_tab[26] +#define __pyx_kp_u_at_0x __pyx_string_tab[27] +#define __pyx_kp_u_collections_abc __pyx_string_tab[28] +#define __pyx_kp_u_contiguous_and_direct __pyx_string_tab[29] +#define __pyx_kp_u_contiguous_and_indirect __pyx_string_tab[30] +#define __pyx_kp_u_disable __pyx_string_tab[31] +#define __pyx_kp_u_enable __pyx_string_tab[32] +#define __pyx_kp_u_gc __pyx_string_tab[33] +#define __pyx_kp_u_got __pyx_string_tab[34] +#define __pyx_kp_u_got_differing_extents_in_dimensi __pyx_string_tab[35] +#define __pyx_kp_u_isenabled __pyx_string_tab[36] +#define __pyx_kp_u_itemsize_0_for_cython_array __pyx_string_tab[37] +#define __pyx_kp_u_no_default___reduce___due_to_non __pyx_string_tab[38] +#define __pyx_kp_u_numpy__core_multiarray_failed_to __pyx_string_tab[39] +#define __pyx_kp_u_numpy__core_umath_failed_to_impo __pyx_string_tab[40] +#define __pyx_kp_u_object __pyx_string_tab[41] +#define __pyx_kp_u_self_name_is_not_None __pyx_string_tab[42] +#define __pyx_kp_u_spacy_errors __pyx_string_tab[43] +#define __pyx_kp_u_spacy_pipeline__parser_internals_2 __pyx_string_tab[44] +#define __pyx_kp_u_spacy_pipeline__parser_internals_3 __pyx_string_tab[45] +#define __pyx_kp_u_strided_and_direct __pyx_string_tab[46] +#define __pyx_kp_u_strided_and_direct_or_indirect __pyx_string_tab[47] +#define __pyx_kp_u_strided_and_indirect __pyx_string_tab[48] +#define __pyx_kp_u_unable_to_allocate_array_data __pyx_string_tab[49] +#define __pyx_kp_u_unable_to_allocate_shape_and_str __pyx_string_tab[50] +#define __pyx_n_u_ASCII __pyx_string_tab[51] +#define __pyx_n_u_DELIMITER __pyx_string_tab[52] +#define __pyx_n_u_DEP __pyx_string_tab[53] +#define __pyx_n_u_E082 __pyx_string_tab[54] +#define __pyx_n_u_Ellipsis __pyx_string_tab[55] +#define __pyx_n_u_Errors __pyx_string_tab[56] +#define __pyx_n_u_HEAD __pyx_string_tab[57] +#define __pyx_n_u_Pyx_PyDict_NextRef __pyx_string_tab[58] +#define __pyx_n_u_ROOT __pyx_string_tab[59] +#define __pyx_n_u_Sequence __pyx_string_tab[60] +#define __pyx_n_u_View_MemoryView __pyx_string_tab[61] +#define __pyx_n_u_abc __pyx_string_tab[62] +#define __pyx_n_u_add __pyx_string_tab[63] +#define __pyx_n_u_allocate_buffer __pyx_string_tab[64] +#define __pyx_n_u_allow_transient __pyx_string_tab[65] +#define __pyx_n_u_ancestor __pyx_string_tab[66] +#define __pyx_n_u_ancestors __pyx_string_tab[67] +#define __pyx_n_u_asyncio_coroutines __pyx_string_tab[68] +#define __pyx_n_u_base __pyx_string_tab[69] +#define __pyx_n_u_c __pyx_string_tab[70] +#define __pyx_n_u_c_heads __pyx_string_tab[71] +#define __pyx_n_u_c_proj_heads __pyx_string_tab[72] +#define __pyx_n_u_child __pyx_string_tab[73] +#define __pyx_n_u_children __pyx_string_tab[74] +#define __pyx_n_u_class __pyx_string_tab[75] +#define __pyx_n_u_class_getitem __pyx_string_tab[76] +#define __pyx_n_u_cline_in_traceback __pyx_string_tab[77] +#define __pyx_n_u_close __pyx_string_tab[78] +#define __pyx_n_u_cnt __pyx_string_tab[79] +#define __pyx_n_u_contains_cycle __pyx_string_tab[80] +#define __pyx_n_u_copy __pyx_string_tab[81] +#define __pyx_n_u_count __pyx_string_tab[82] +#define __pyx_n_u_count_decorated_labels __pyx_string_tab[83] +#define __pyx_n_u_deco_deps __pyx_string_tab[84] +#define __pyx_n_u_deco_labels __pyx_string_tab[85] +#define __pyx_n_u_decompose __pyx_string_tab[86] +#define __pyx_n_u_decorate __pyx_string_tab[87] +#define __pyx_n_u_dep __pyx_string_tab[88] +#define __pyx_n_u_deprojectivize __pyx_string_tab[89] +#define __pyx_n_u_dict __pyx_string_tab[90] +#define __pyx_n_u_doc __pyx_string_tab[91] +#define __pyx_n_u_dtype_is_object __pyx_string_tab[92] +#define __pyx_n_u_encode __pyx_string_tab[93] +#define __pyx_n_u_enumerate __pyx_string_tab[94] +#define __pyx_n_u_error __pyx_string_tab[95] +#define __pyx_n_u_errors __pyx_string_tab[96] +#define __pyx_n_u_example __pyx_string_tab[97] +#define __pyx_n_u_find_new_head __pyx_string_tab[98] +#define __pyx_n_u_flags __pyx_string_tab[99] +#define __pyx_n_u_format __pyx_string_tab[100] +#define __pyx_n_u_fortran __pyx_string_tab[101] +#define __pyx_n_u_freqs __pyx_string_tab[102] +#define __pyx_n_u_func __pyx_string_tab[103] +#define __pyx_n_u_genexpr __pyx_string_tab[104] +#define __pyx_n_u_get __pyx_string_tab[105] +#define __pyx_n_u_get_aligned __pyx_string_tab[106] +#define __pyx_n_u_get_smallest_nonproj_arc_slow __pyx_string_tab[107] +#define __pyx_n_u_getstate __pyx_string_tab[108] +#define __pyx_n_u_gold_data __pyx_string_tab[109] +#define __pyx_n_u_head __pyx_string_tab[110] +#define __pyx_n_u_headlabel __pyx_string_tab[111] +#define __pyx_n_u_heads __pyx_string_tab[112] +#define __pyx_n_u_i __pyx_string_tab[113] +#define __pyx_n_u_id __pyx_string_tab[114] +#define __pyx_n_u_import __pyx_string_tab[115] +#define __pyx_n_u_index __pyx_string_tab[116] +#define __pyx_n_u_is_coroutine __pyx_string_tab[117] +#define __pyx_n_u_is_decorated __pyx_string_tab[118] +#define __pyx_n_u_is_nonproj_arc __pyx_string_tab[119] +#define __pyx_n_u_is_nonproj_tree __pyx_string_tab[120] +#define __pyx_n_u_is_nonproj_tree_locals_genexpr __pyx_string_tab[121] +#define __pyx_n_u_is_space __pyx_string_tab[122] +#define __pyx_n_u_items __pyx_string_tab[123] +#define __pyx_n_u_itemsize __pyx_string_tab[124] +#define __pyx_n_u_label __pyx_string_tab[125] +#define __pyx_n_u_labels __pyx_string_tab[126] +#define __pyx_n_u_lift __pyx_string_tab[127] +#define __pyx_n_u_main __pyx_string_tab[128] +#define __pyx_n_u_memview __pyx_string_tab[129] +#define __pyx_n_u_mode __pyx_string_tab[130] +#define __pyx_n_u_module __pyx_string_tab[131] +#define __pyx_n_u_n_heads __pyx_string_tab[132] +#define __pyx_n_u_n_labels __pyx_string_tab[133] +#define __pyx_n_u_n_proj_heads __pyx_string_tab[134] +#define __pyx_n_u_name __pyx_string_tab[135] +#define __pyx_n_u_name_2 __pyx_string_tab[136] +#define __pyx_n_u_ndim __pyx_string_tab[137] +#define __pyx_n_u_new __pyx_string_tab[138] +#define __pyx_n_u_new_head __pyx_string_tab[139] +#define __pyx_n_u_next __pyx_string_tab[140] +#define __pyx_n_u_next_queue __pyx_string_tab[141] +#define __pyx_n_u_obj __pyx_string_tab[142] +#define __pyx_n_u_pack __pyx_string_tab[143] +#define __pyx_n_u_partition __pyx_string_tab[144] +#define __pyx_n_u_pop __pyx_string_tab[145] +#define __pyx_n_u_proj_heads __pyx_string_tab[146] +#define __pyx_n_u_projectivize __pyx_string_tab[147] +#define __pyx_n_u_pyx_checksum __pyx_string_tab[148] +#define __pyx_n_u_pyx_state __pyx_string_tab[149] +#define __pyx_n_u_pyx_type __pyx_string_tab[150] +#define __pyx_n_u_pyx_unpickle_Enum __pyx_string_tab[151] +#define __pyx_n_u_pyx_vtable __pyx_string_tab[152] +#define __pyx_n_u_qtoken __pyx_string_tab[153] +#define __pyx_n_u_qualname __pyx_string_tab[154] +#define __pyx_n_u_queue __pyx_string_tab[155] +#define __pyx_n_u_reduce __pyx_string_tab[156] +#define __pyx_n_u_reduce_cython __pyx_string_tab[157] +#define __pyx_n_u_reduce_ex __pyx_string_tab[158] +#define __pyx_n_u_register __pyx_string_tab[159] +#define __pyx_n_u_seen __pyx_string_tab[160] +#define __pyx_n_u_send __pyx_string_tab[161] +#define __pyx_n_u_set_name __pyx_string_tab[162] +#define __pyx_n_u_setdefault __pyx_string_tab[163] +#define __pyx_n_u_setstate __pyx_string_tab[164] +#define __pyx_n_u_setstate_cython __pyx_string_tab[165] +#define __pyx_n_u_shape __pyx_string_tab[166] +#define __pyx_n_u_size __pyx_string_tab[167] +#define __pyx_n_u_smallest_np_arc __pyx_string_tab[168] +#define __pyx_n_u_spacy_pipeline__parser_internals __pyx_string_tab[169] +#define __pyx_n_u_split __pyx_string_tab[170] +#define __pyx_n_u_start __pyx_string_tab[171] +#define __pyx_n_u_step __pyx_string_tab[172] +#define __pyx_n_u_stop __pyx_string_tab[173] +#define __pyx_n_u_struct __pyx_string_tab[174] +#define __pyx_n_u_test __pyx_string_tab[175] +#define __pyx_n_u_throw __pyx_string_tab[176] +#define __pyx_n_u_token __pyx_string_tab[177] +#define __pyx_n_u_tokenid __pyx_string_tab[178] +#define __pyx_n_u_unpack __pyx_string_tab[179] +#define __pyx_n_u_update __pyx_string_tab[180] +#define __pyx_n_u_value __pyx_string_tab[181] +#define __pyx_n_u_values __pyx_string_tab[182] +#define __pyx_n_u_word __pyx_string_tab[183] +#define __pyx_n_u_x __pyx_string_tab[184] +#define __pyx_kp_b_int_struct___pyx_t_5spacy_7struc __pyx_string_tab[185] +#define __pyx_kp_b_iso88591_1G3c_t3a_3c_j_uG1HCq_9_AQ_5S_1 __pyx_string_tab[186] +#define __pyx_kp_b_iso88591_1_9A __pyx_string_tab[187] +#define __pyx_kp_b_iso88591_1_AQ __pyx_string_tab[188] +#define __pyx_kp_b_iso88591_1_a __pyx_string_tab[189] +#define __pyx_kp_b_iso88591_5_AQ_s_1A_L_1_y_1_q_AQ_1 __pyx_string_tab[190] +#define __pyx_kp_b_iso88591_5_S __pyx_string_tab[191] +#define __pyx_kp_b_iso88591_AU_Q_Ja_q_5_6_A_5_c_1_5 __pyx_string_tab[192] +#define __pyx_kp_b_iso88591_A_1_L_AWL_4L_A_e3gYaq_89AQ_IQ_1 __pyx_string_tab[193] +#define __pyx_kp_b_iso88591_Qa_Kq_8_t1_4q_a_5_A_31A_1G_q_q __pyx_string_tab[194] +#define __pyx_kp_b_iso88591_S __pyx_string_tab[195] +#define __pyx_kp_b_iso88591_U_3a_6_Rq_S_E_q_Qc_a_r_HHCr_r_G __pyx_string_tab[196] +#define __pyx_kp_b_iso88591__8 __pyx_string_tab[197] +#define __pyx_kp_b_iso88591_a __pyx_string_tab[198] +#define __pyx_kp_b_iso88591_q_5_E_c_A_Q_1 __pyx_string_tab[199] +#define __pyx_kp_b_struct___pyx_t_5spacy_7structs_L __pyx_string_tab[200] +#define __pyx_kp_b_uint64_t_void_int_uint64_t_hash6 __pyx_string_tab[201] +#define __pyx_n_b_O __pyx_string_tab[202] +#define __pyx_int_0 __pyx_number_tab[0] +#define __pyx_int_neg_1 __pyx_number_tab[1] +#define __pyx_int_1 __pyx_number_tab[2] +#define __pyx_int_2 __pyx_number_tab[3] +#define __pyx_int_136983863 __pyx_number_tab[4] +/* #### 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_7cpython_4type_type); + Py_CLEAR(clear_module_state->__pyx_ptype_5numpy_dtype); + Py_CLEAR(clear_module_state->__pyx_ptype_5numpy_flatiter); + Py_CLEAR(clear_module_state->__pyx_ptype_5numpy_broadcast); + Py_CLEAR(clear_module_state->__pyx_ptype_5numpy_ndarray); + Py_CLEAR(clear_module_state->__pyx_ptype_5numpy_generic); + Py_CLEAR(clear_module_state->__pyx_ptype_5numpy_number); + Py_CLEAR(clear_module_state->__pyx_ptype_5numpy_integer); + Py_CLEAR(clear_module_state->__pyx_ptype_5numpy_signedinteger); + Py_CLEAR(clear_module_state->__pyx_ptype_5numpy_unsignedinteger); + Py_CLEAR(clear_module_state->__pyx_ptype_5numpy_inexact); + Py_CLEAR(clear_module_state->__pyx_ptype_5numpy_floating); + Py_CLEAR(clear_module_state->__pyx_ptype_5numpy_complexfloating); + Py_CLEAR(clear_module_state->__pyx_ptype_5numpy_flexible); + Py_CLEAR(clear_module_state->__pyx_ptype_5numpy_character); + Py_CLEAR(clear_module_state->__pyx_ptype_5numpy_ufunc); + Py_CLEAR(clear_module_state->__pyx_ptype_5cymem_5cymem_PyMalloc); + Py_CLEAR(clear_module_state->__pyx_ptype_5cymem_5cymem_PyFree); + Py_CLEAR(clear_module_state->__pyx_ptype_5cymem_5cymem_Pool); + Py_CLEAR(clear_module_state->__pyx_ptype_5cymem_5cymem_Address); + Py_CLEAR(clear_module_state->__pyx_ptype_7preshed_4maps_PreshMap); + Py_CLEAR(clear_module_state->__pyx_ptype_7preshed_4maps_PreshMapArray); + Py_CLEAR(clear_module_state->__pyx_ptype_5spacy_7strings_StringStore); + Py_CLEAR(clear_module_state->__pyx_ptype_5spacy_10morphology_Morphology); + Py_CLEAR(clear_module_state->__pyx_ptype_5spacy_5vocab_Vocab); + Py_CLEAR(clear_module_state->__pyx_ptype_5spacy_6tokens_3doc_Doc); + Py_CLEAR(clear_module_state->__pyx_ptype_5spacy_8pipeline_17_parser_internals_7nonproj___pyx_scope_struct__ancestors); + Py_CLEAR(clear_module_state->__pyx_type_5spacy_8pipeline_17_parser_internals_7nonproj___pyx_scope_struct__ancestors); + Py_CLEAR(clear_module_state->__pyx_ptype_5spacy_8pipeline_17_parser_internals_7nonproj___pyx_scope_struct_1_is_nonproj_tree); + Py_CLEAR(clear_module_state->__pyx_type_5spacy_8pipeline_17_parser_internals_7nonproj___pyx_scope_struct_1_is_nonproj_tree); + Py_CLEAR(clear_module_state->__pyx_ptype_5spacy_8pipeline_17_parser_internals_7nonproj___pyx_scope_struct_2_genexpr); + Py_CLEAR(clear_module_state->__pyx_type_5spacy_8pipeline_17_parser_internals_7nonproj___pyx_scope_struct_2_genexpr); + Py_CLEAR(clear_module_state->__pyx_array_type); + Py_CLEAR(clear_module_state->__pyx_type___pyx_array); + Py_CLEAR(clear_module_state->__pyx_MemviewEnum_type); + Py_CLEAR(clear_module_state->__pyx_type___pyx_MemviewEnum); + Py_CLEAR(clear_module_state->__pyx_memoryview_type); + Py_CLEAR(clear_module_state->__pyx_type___pyx_memoryview); + Py_CLEAR(clear_module_state->__pyx_memoryviewslice_type); + Py_CLEAR(clear_module_state->__pyx_type___pyx_memoryviewslice); + for (int i=0; i<2; ++i) { Py_CLEAR(clear_module_state->__pyx_slice[i]); } + for (int i=0; i<2; ++i) { Py_CLEAR(clear_module_state->__pyx_tuple[i]); } + for (int i=0; i<14; ++i) { Py_CLEAR(clear_module_state->__pyx_codeobj_tab[i]); } + for (int i=0; i<203; ++i) { Py_CLEAR(clear_module_state->__pyx_string_tab[i]); } + for (int i=0; i<5; ++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); + +/* Generator.module_state_clear */ +Py_CLEAR(clear_module_state->__pyx_GeneratorType); + +/* #### 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_7cpython_4type_type); + Py_VISIT(traverse_module_state->__pyx_ptype_5numpy_dtype); + Py_VISIT(traverse_module_state->__pyx_ptype_5numpy_flatiter); + Py_VISIT(traverse_module_state->__pyx_ptype_5numpy_broadcast); + Py_VISIT(traverse_module_state->__pyx_ptype_5numpy_ndarray); + Py_VISIT(traverse_module_state->__pyx_ptype_5numpy_generic); + Py_VISIT(traverse_module_state->__pyx_ptype_5numpy_number); + Py_VISIT(traverse_module_state->__pyx_ptype_5numpy_integer); + Py_VISIT(traverse_module_state->__pyx_ptype_5numpy_signedinteger); + Py_VISIT(traverse_module_state->__pyx_ptype_5numpy_unsignedinteger); + Py_VISIT(traverse_module_state->__pyx_ptype_5numpy_inexact); + Py_VISIT(traverse_module_state->__pyx_ptype_5numpy_floating); + Py_VISIT(traverse_module_state->__pyx_ptype_5numpy_complexfloating); + Py_VISIT(traverse_module_state->__pyx_ptype_5numpy_flexible); + Py_VISIT(traverse_module_state->__pyx_ptype_5numpy_character); + Py_VISIT(traverse_module_state->__pyx_ptype_5numpy_ufunc); + Py_VISIT(traverse_module_state->__pyx_ptype_5cymem_5cymem_PyMalloc); + Py_VISIT(traverse_module_state->__pyx_ptype_5cymem_5cymem_PyFree); + Py_VISIT(traverse_module_state->__pyx_ptype_5cymem_5cymem_Pool); + Py_VISIT(traverse_module_state->__pyx_ptype_5cymem_5cymem_Address); + Py_VISIT(traverse_module_state->__pyx_ptype_7preshed_4maps_PreshMap); + Py_VISIT(traverse_module_state->__pyx_ptype_7preshed_4maps_PreshMapArray); + Py_VISIT(traverse_module_state->__pyx_ptype_5spacy_7strings_StringStore); + Py_VISIT(traverse_module_state->__pyx_ptype_5spacy_10morphology_Morphology); + Py_VISIT(traverse_module_state->__pyx_ptype_5spacy_5vocab_Vocab); + Py_VISIT(traverse_module_state->__pyx_ptype_5spacy_6tokens_3doc_Doc); + Py_VISIT(traverse_module_state->__pyx_ptype_5spacy_8pipeline_17_parser_internals_7nonproj___pyx_scope_struct__ancestors); + Py_VISIT(traverse_module_state->__pyx_type_5spacy_8pipeline_17_parser_internals_7nonproj___pyx_scope_struct__ancestors); + Py_VISIT(traverse_module_state->__pyx_ptype_5spacy_8pipeline_17_parser_internals_7nonproj___pyx_scope_struct_1_is_nonproj_tree); + Py_VISIT(traverse_module_state->__pyx_type_5spacy_8pipeline_17_parser_internals_7nonproj___pyx_scope_struct_1_is_nonproj_tree); + Py_VISIT(traverse_module_state->__pyx_ptype_5spacy_8pipeline_17_parser_internals_7nonproj___pyx_scope_struct_2_genexpr); + Py_VISIT(traverse_module_state->__pyx_type_5spacy_8pipeline_17_parser_internals_7nonproj___pyx_scope_struct_2_genexpr); + Py_VISIT(traverse_module_state->__pyx_array_type); + Py_VISIT(traverse_module_state->__pyx_type___pyx_array); + Py_VISIT(traverse_module_state->__pyx_MemviewEnum_type); + Py_VISIT(traverse_module_state->__pyx_type___pyx_MemviewEnum); + Py_VISIT(traverse_module_state->__pyx_memoryview_type); + Py_VISIT(traverse_module_state->__pyx_type___pyx_memoryview); + Py_VISIT(traverse_module_state->__pyx_memoryviewslice_type); + Py_VISIT(traverse_module_state->__pyx_type___pyx_memoryviewslice); + for (int i=0; i<2; ++i) { __Pyx_VISIT_CONST(traverse_module_state->__pyx_slice[i]); } + for (int i=0; i<2; ++i) { __Pyx_VISIT_CONST(traverse_module_state->__pyx_tuple[i]); } + for (int i=0; i<14; ++i) { __Pyx_VISIT_CONST(traverse_module_state->__pyx_codeobj_tab[i]); } + for (int i=0; i<203; ++i) { __Pyx_VISIT_CONST(traverse_module_state->__pyx_string_tab[i]); } + for (int i=0; i<5; ++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); + +/* Generator.module_state_traverse */ +Py_VISIT(traverse_module_state->__pyx_GeneratorType); + +/* #### Code section: module_state_traverse_end ### */ +return 0; +} +#endif +/* #### Code section: module_code ### */ + +/* "View.MemoryView":129 + * cdef bint dtype_is_object + * + * def __cinit__(array self, tuple shape, Py_ssize_t itemsize, format not None, # <<<<<<<<<<<<<< + * mode="c", bint allocate_buffer=True): + * +*/ + +/* Python wrapper */ +static int __pyx_array___cinit__(PyObject *__pyx_v_self, PyObject *__pyx_args, PyObject *__pyx_kwds); /*proto*/ +static int __pyx_array___cinit__(PyObject *__pyx_v_self, PyObject *__pyx_args, PyObject *__pyx_kwds) { + PyObject *__pyx_v_shape = 0; + Py_ssize_t __pyx_v_itemsize; + PyObject *__pyx_v_format = 0; + PyObject *__pyx_v_mode = 0; + int __pyx_v_allocate_buffer; + CYTHON_UNUSED Py_ssize_t __pyx_nargs; + CYTHON_UNUSED PyObject *const *__pyx_kwvalues; + PyObject* values[5] = {0,0,0,0,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_shape,&__pyx_mstate_global->__pyx_n_u_itemsize,&__pyx_mstate_global->__pyx_n_u_format,&__pyx_mstate_global->__pyx_n_u_mode,&__pyx_mstate_global->__pyx_n_u_allocate_buffer,0}; + const Py_ssize_t __pyx_kwds_len = (__pyx_kwds) ? __Pyx_NumKwargs_VARARGS(__pyx_kwds) : 0; + if (unlikely(__pyx_kwds_len) < 0) __PYX_ERR(1, 129, __pyx_L3_error) + if (__pyx_kwds_len > 0) { + switch (__pyx_nargs) { + case 5: + values[4] = __Pyx_ArgRef_VARARGS(__pyx_args, 4); + if (!CYTHON_ASSUME_SAFE_MACROS && unlikely(!values[4])) __PYX_ERR(1, 129, __pyx_L3_error) + CYTHON_FALLTHROUGH; + case 4: + values[3] = __Pyx_ArgRef_VARARGS(__pyx_args, 3); + if (!CYTHON_ASSUME_SAFE_MACROS && unlikely(!values[3])) __PYX_ERR(1, 129, __pyx_L3_error) + CYTHON_FALLTHROUGH; + case 3: + values[2] = __Pyx_ArgRef_VARARGS(__pyx_args, 2); + if (!CYTHON_ASSUME_SAFE_MACROS && unlikely(!values[2])) __PYX_ERR(1, 129, __pyx_L3_error) + CYTHON_FALLTHROUGH; + case 2: + values[1] = __Pyx_ArgRef_VARARGS(__pyx_args, 1); + if (!CYTHON_ASSUME_SAFE_MACROS && unlikely(!values[1])) __PYX_ERR(1, 129, __pyx_L3_error) + CYTHON_FALLTHROUGH; + case 1: + values[0] = __Pyx_ArgRef_VARARGS(__pyx_args, 0); + if (!CYTHON_ASSUME_SAFE_MACROS && unlikely(!values[0])) __PYX_ERR(1, 129, __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(1, 129, __pyx_L3_error) + if (!values[3]) values[3] = __Pyx_NewRef(((PyObject *)__pyx_mstate_global->__pyx_n_u_c)); + for (Py_ssize_t i = __pyx_nargs; i < 3; i++) { + if (unlikely(!values[i])) { __Pyx_RaiseArgtupleInvalid("__cinit__", 0, 3, 5, i); __PYX_ERR(1, 129, __pyx_L3_error) } + } + } else { + switch (__pyx_nargs) { + case 5: + values[4] = __Pyx_ArgRef_VARARGS(__pyx_args, 4); + if (!CYTHON_ASSUME_SAFE_MACROS && unlikely(!values[4])) __PYX_ERR(1, 129, __pyx_L3_error) + CYTHON_FALLTHROUGH; + case 4: + values[3] = __Pyx_ArgRef_VARARGS(__pyx_args, 3); + if (!CYTHON_ASSUME_SAFE_MACROS && unlikely(!values[3])) __PYX_ERR(1, 129, __pyx_L3_error) + CYTHON_FALLTHROUGH; + case 3: + values[2] = __Pyx_ArgRef_VARARGS(__pyx_args, 2); + if (!CYTHON_ASSUME_SAFE_MACROS && unlikely(!values[2])) __PYX_ERR(1, 129, __pyx_L3_error) + values[1] = __Pyx_ArgRef_VARARGS(__pyx_args, 1); + if (!CYTHON_ASSUME_SAFE_MACROS && unlikely(!values[1])) __PYX_ERR(1, 129, __pyx_L3_error) + values[0] = __Pyx_ArgRef_VARARGS(__pyx_args, 0); + if (!CYTHON_ASSUME_SAFE_MACROS && unlikely(!values[0])) __PYX_ERR(1, 129, __pyx_L3_error) + break; + default: goto __pyx_L5_argtuple_error; + } + if (!values[3]) values[3] = __Pyx_NewRef(((PyObject *)__pyx_mstate_global->__pyx_n_u_c)); + } + __pyx_v_shape = ((PyObject*)values[0]); + __pyx_v_itemsize = __Pyx_PyIndex_AsSsize_t(values[1]); if (unlikely((__pyx_v_itemsize == (Py_ssize_t)-1) && PyErr_Occurred())) __PYX_ERR(1, 129, __pyx_L3_error) + __pyx_v_format = values[2]; + __pyx_v_mode = values[3]; + if (values[4]) { + __pyx_v_allocate_buffer = __Pyx_PyObject_IsTrue(values[4]); if (unlikely((__pyx_v_allocate_buffer == (int)-1) && PyErr_Occurred())) __PYX_ERR(1, 130, __pyx_L3_error) + } else { + + /* "View.MemoryView":130 + * + * def __cinit__(array self, tuple shape, Py_ssize_t itemsize, format not None, + * mode="c", bint allocate_buffer=True): # <<<<<<<<<<<<<< + * + * cdef int idx +*/ + __pyx_v_allocate_buffer = ((int)1); + } + } + goto __pyx_L6_skip; + __pyx_L5_argtuple_error:; + __Pyx_RaiseArgtupleInvalid("__cinit__", 0, 3, 5, __pyx_nargs); __PYX_ERR(1, 129, __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("View.MemoryView.array.__cinit__", __pyx_clineno, __pyx_lineno, __pyx_filename); + __Pyx_RefNannyFinishContext(); + return -1; + __pyx_L4_argument_unpacking_done:; + if (unlikely(!__Pyx_ArgTypeTest(((PyObject *)__pyx_v_shape), (&PyTuple_Type), 1, "shape", 1))) __PYX_ERR(1, 129, __pyx_L1_error) + if (unlikely(((PyObject *)__pyx_v_format) == Py_None)) { + PyErr_Format(PyExc_TypeError, "Argument '%.200s' must not be None", "format"); __PYX_ERR(1, 129, __pyx_L1_error) + } + __pyx_r = __pyx_array___pyx_pf_15View_dot_MemoryView_5array___cinit__(((struct __pyx_array_obj *)__pyx_v_self), __pyx_v_shape, __pyx_v_itemsize, __pyx_v_format, __pyx_v_mode, __pyx_v_allocate_buffer); + + /* "View.MemoryView":129 + * cdef bint dtype_is_object + * + * def __cinit__(array self, tuple shape, Py_ssize_t itemsize, format not None, # <<<<<<<<<<<<<< + * mode="c", bint allocate_buffer=True): + * +*/ + + /* 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_array___pyx_pf_15View_dot_MemoryView_5array___cinit__(struct __pyx_array_obj *__pyx_v_self, PyObject *__pyx_v_shape, Py_ssize_t __pyx_v_itemsize, PyObject *__pyx_v_format, PyObject *__pyx_v_mode, int __pyx_v_allocate_buffer) { + int __pyx_v_idx; + Py_ssize_t __pyx_v_dim; + char __pyx_v_order; + int __pyx_r; + __Pyx_RefNannyDeclarations + Py_ssize_t __pyx_t_1; + int __pyx_t_2; + int __pyx_t_3; + PyObject *__pyx_t_4 = NULL; + PyObject *__pyx_t_5 = NULL; + size_t __pyx_t_6; + char *__pyx_t_7; + int __pyx_t_8; + Py_ssize_t __pyx_t_9; + PyObject *__pyx_t_10 = NULL; + PyObject *__pyx_t_11[5]; + PyObject *__pyx_t_12 = NULL; + int __pyx_lineno = 0; + const char *__pyx_filename = NULL; + int __pyx_clineno = 0; + __Pyx_RefNannySetupContext("__cinit__", 0); + __Pyx_INCREF(__pyx_v_format); + + /* "View.MemoryView":135 + * cdef Py_ssize_t dim + * + * self.ndim = len(shape) # <<<<<<<<<<<<<< + * self.itemsize = itemsize + * +*/ + if (unlikely(__pyx_v_shape == Py_None)) { + PyErr_SetString(PyExc_TypeError, "object of type 'NoneType' has no len()"); + __PYX_ERR(1, 135, __pyx_L1_error) + } + __pyx_t_1 = __Pyx_PyTuple_GET_SIZE(__pyx_v_shape); if (unlikely(__pyx_t_1 == ((Py_ssize_t)-1))) __PYX_ERR(1, 135, __pyx_L1_error) + __pyx_v_self->ndim = ((int)__pyx_t_1); + + /* "View.MemoryView":136 + * + * self.ndim = len(shape) + * self.itemsize = itemsize # <<<<<<<<<<<<<< + * + * if not self.ndim: +*/ + __pyx_v_self->itemsize = __pyx_v_itemsize; + + /* "View.MemoryView":138 + * self.itemsize = itemsize + * + * if not self.ndim: # <<<<<<<<<<<<<< + * raise ValueError, "Empty shape tuple for cython.array" + * +*/ + __pyx_t_2 = (!(__pyx_v_self->ndim != 0)); + if (unlikely(__pyx_t_2)) { + + /* "View.MemoryView":139 + * + * if not self.ndim: + * raise ValueError, "Empty shape tuple for cython.array" # <<<<<<<<<<<<<< + * + * if itemsize <= 0: +*/ + __Pyx_Raise(((PyObject *)(((PyTypeObject*)PyExc_ValueError))), __pyx_mstate_global->__pyx_kp_u_Empty_shape_tuple_for_cython_arr, 0, 0); + __PYX_ERR(1, 139, __pyx_L1_error) + + /* "View.MemoryView":138 + * self.itemsize = itemsize + * + * if not self.ndim: # <<<<<<<<<<<<<< + * raise ValueError, "Empty shape tuple for cython.array" + * +*/ + } + + /* "View.MemoryView":141 + * raise ValueError, "Empty shape tuple for cython.array" + * + * if itemsize <= 0: # <<<<<<<<<<<<<< + * raise ValueError, "itemsize <= 0 for cython.array" + * +*/ + __pyx_t_2 = (__pyx_v_itemsize <= 0); + if (unlikely(__pyx_t_2)) { + + /* "View.MemoryView":142 + * + * if itemsize <= 0: + * raise ValueError, "itemsize <= 0 for cython.array" # <<<<<<<<<<<<<< + * + * if not isinstance(format, bytes): +*/ + __Pyx_Raise(((PyObject *)(((PyTypeObject*)PyExc_ValueError))), __pyx_mstate_global->__pyx_kp_u_itemsize_0_for_cython_array, 0, 0); + __PYX_ERR(1, 142, __pyx_L1_error) + + /* "View.MemoryView":141 + * raise ValueError, "Empty shape tuple for cython.array" + * + * if itemsize <= 0: # <<<<<<<<<<<<<< + * raise ValueError, "itemsize <= 0 for cython.array" + * +*/ + } + + /* "View.MemoryView":144 + * raise ValueError, "itemsize <= 0 for cython.array" + * + * if not isinstance(format, bytes): # <<<<<<<<<<<<<< + * format = format.encode('ASCII') + * self._format = format # keep a reference to the byte string +*/ + __pyx_t_2 = PyBytes_Check(__pyx_v_format); + __pyx_t_3 = (!__pyx_t_2); + if (__pyx_t_3) { + + /* "View.MemoryView":145 + * + * if not isinstance(format, bytes): + * format = format.encode('ASCII') # <<<<<<<<<<<<<< + * self._format = format # keep a reference to the byte string + * self.format = self._format +*/ + __pyx_t_5 = __pyx_v_format; + __Pyx_INCREF(__pyx_t_5); + __pyx_t_6 = 0; + { + PyObject *__pyx_callargs[2] = {__pyx_t_5, __pyx_mstate_global->__pyx_n_u_ASCII}; + __pyx_t_4 = __Pyx_PyObject_FastCallMethod((PyObject*)__pyx_mstate_global->__pyx_n_u_encode, __pyx_callargs+__pyx_t_6, (2-__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(1, 145, __pyx_L1_error) + __Pyx_GOTREF(__pyx_t_4); + } + __Pyx_DECREF_SET(__pyx_v_format, __pyx_t_4); + __pyx_t_4 = 0; + + /* "View.MemoryView":144 + * raise ValueError, "itemsize <= 0 for cython.array" + * + * if not isinstance(format, bytes): # <<<<<<<<<<<<<< + * format = format.encode('ASCII') + * self._format = format # keep a reference to the byte string +*/ + } + + /* "View.MemoryView":146 + * if not isinstance(format, bytes): + * format = format.encode('ASCII') + * self._format = format # keep a reference to the byte string # <<<<<<<<<<<<<< + * self.format = self._format + * +*/ + __pyx_t_4 = __pyx_v_format; + __Pyx_INCREF(__pyx_t_4); + if (!(likely(PyBytes_CheckExact(__pyx_t_4))||((__pyx_t_4) == Py_None) || __Pyx_RaiseUnexpectedTypeError("bytes", __pyx_t_4))) __PYX_ERR(1, 146, __pyx_L1_error) + __Pyx_GIVEREF(__pyx_t_4); + __Pyx_GOTREF(__pyx_v_self->_format); + __Pyx_DECREF(__pyx_v_self->_format); + __pyx_v_self->_format = ((PyObject*)__pyx_t_4); + __pyx_t_4 = 0; + + /* "View.MemoryView":147 + * format = format.encode('ASCII') + * self._format = format # keep a reference to the byte string + * self.format = self._format # <<<<<<<<<<<<<< + * + * +*/ + if (unlikely(__pyx_v_self->_format == Py_None)) { + PyErr_SetString(PyExc_TypeError, "expected bytes, NoneType found"); + __PYX_ERR(1, 147, __pyx_L1_error) + } + __pyx_t_7 = __Pyx_PyBytes_AsWritableString(__pyx_v_self->_format); if (unlikely((!__pyx_t_7) && PyErr_Occurred())) __PYX_ERR(1, 147, __pyx_L1_error) + __pyx_v_self->format = __pyx_t_7; + + /* "View.MemoryView":150 + * + * + * self._shape = PyObject_Malloc(sizeof(Py_ssize_t)*self.ndim*2) # <<<<<<<<<<<<<< + * self._strides = self._shape + self.ndim + * +*/ + __pyx_v_self->_shape = ((Py_ssize_t *)PyObject_Malloc((((sizeof(Py_ssize_t)) * __pyx_v_self->ndim) * 2))); + + /* "View.MemoryView":151 + * + * self._shape = PyObject_Malloc(sizeof(Py_ssize_t)*self.ndim*2) + * self._strides = self._shape + self.ndim # <<<<<<<<<<<<<< + * + * if not self._shape: +*/ + __pyx_v_self->_strides = (__pyx_v_self->_shape + __pyx_v_self->ndim); + + /* "View.MemoryView":153 + * self._strides = self._shape + self.ndim + * + * if not self._shape: # <<<<<<<<<<<<<< + * raise MemoryError, "unable to allocate shape and strides." + * +*/ + __pyx_t_3 = (!(__pyx_v_self->_shape != 0)); + if (unlikely(__pyx_t_3)) { + + /* "View.MemoryView":154 + * + * if not self._shape: + * raise MemoryError, "unable to allocate shape and strides." # <<<<<<<<<<<<<< + * + * +*/ + __Pyx_Raise(((PyObject *)(((PyTypeObject*)PyExc_MemoryError))), __pyx_mstate_global->__pyx_kp_u_unable_to_allocate_shape_and_str, 0, 0); + __PYX_ERR(1, 154, __pyx_L1_error) + + /* "View.MemoryView":153 + * self._strides = self._shape + self.ndim + * + * if not self._shape: # <<<<<<<<<<<<<< + * raise MemoryError, "unable to allocate shape and strides." + * +*/ + } + + /* "View.MemoryView":157 + * + * + * for idx, dim in enumerate(shape): # <<<<<<<<<<<<<< + * if dim <= 0: + * raise ValueError, f"Invalid shape in axis {idx}: {dim}." +*/ + __pyx_t_8 = 0; + __pyx_t_4 = __pyx_v_shape; __Pyx_INCREF(__pyx_t_4); + __pyx_t_1 = 0; + for (;;) { + { + Py_ssize_t __pyx_temp = __Pyx_PyTuple_GET_SIZE(__pyx_t_4); + #if !CYTHON_ASSUME_SAFE_SIZE + if (unlikely((__pyx_temp < 0))) __PYX_ERR(1, 157, __pyx_L1_error) + #endif + if (__pyx_t_1 >= __pyx_temp) break; + } + #if CYTHON_ASSUME_SAFE_MACROS && !CYTHON_AVOID_BORROWED_REFS + __pyx_t_5 = __Pyx_NewRef(PyTuple_GET_ITEM(__pyx_t_4, __pyx_t_1)); + #else + __pyx_t_5 = __Pyx_PySequence_ITEM(__pyx_t_4, __pyx_t_1); + #endif + ++__pyx_t_1; + if (unlikely(!__pyx_t_5)) __PYX_ERR(1, 157, __pyx_L1_error) + __Pyx_GOTREF(__pyx_t_5); + __pyx_t_9 = __Pyx_PyIndex_AsSsize_t(__pyx_t_5); if (unlikely((__pyx_t_9 == (Py_ssize_t)-1) && PyErr_Occurred())) __PYX_ERR(1, 157, __pyx_L1_error) + __Pyx_DECREF(__pyx_t_5); __pyx_t_5 = 0; + __pyx_v_dim = __pyx_t_9; + __pyx_v_idx = __pyx_t_8; + __pyx_t_8 = (__pyx_t_8 + 1); + + /* "View.MemoryView":158 + * + * for idx, dim in enumerate(shape): + * if dim <= 0: # <<<<<<<<<<<<<< + * raise ValueError, f"Invalid shape in axis {idx}: {dim}." + * self._shape[idx] = dim +*/ + __pyx_t_3 = (__pyx_v_dim <= 0); + if (unlikely(__pyx_t_3)) { + + /* "View.MemoryView":159 + * for idx, dim in enumerate(shape): + * if dim <= 0: + * raise ValueError, f"Invalid shape in axis {idx}: {dim}." # <<<<<<<<<<<<<< + * self._shape[idx] = dim + * +*/ + __pyx_t_5 = __Pyx_PyUnicode_From_int(__pyx_v_idx, 0, ' ', 'd'); if (unlikely(!__pyx_t_5)) __PYX_ERR(1, 159, __pyx_L1_error) + __Pyx_GOTREF(__pyx_t_5); + __pyx_t_10 = __Pyx_PyUnicode_From_Py_ssize_t(__pyx_v_dim, 0, ' ', 'd'); if (unlikely(!__pyx_t_10)) __PYX_ERR(1, 159, __pyx_L1_error) + __Pyx_GOTREF(__pyx_t_10); + __pyx_t_11[0] = __pyx_mstate_global->__pyx_kp_u_Invalid_shape_in_axis; + __pyx_t_11[1] = __pyx_t_5; + __pyx_t_11[2] = __pyx_mstate_global->__pyx_kp_u_; + __pyx_t_11[3] = __pyx_t_10; + __pyx_t_11[4] = __pyx_mstate_global->__pyx_kp_u__2; + __pyx_t_12 = __Pyx_PyUnicode_Join(__pyx_t_11, 5, 22 + __Pyx_PyUnicode_GET_LENGTH(__pyx_t_5) + 2 + __Pyx_PyUnicode_GET_LENGTH(__pyx_t_10) + 1, 127); + if (unlikely(!__pyx_t_12)) __PYX_ERR(1, 159, __pyx_L1_error) + __Pyx_GOTREF(__pyx_t_12); + __Pyx_DECREF(__pyx_t_5); __pyx_t_5 = 0; + __Pyx_DECREF(__pyx_t_10); __pyx_t_10 = 0; + __Pyx_Raise(((PyObject *)(((PyTypeObject*)PyExc_ValueError))), __pyx_t_12, 0, 0); + __Pyx_DECREF(__pyx_t_12); __pyx_t_12 = 0; + __PYX_ERR(1, 159, __pyx_L1_error) + + /* "View.MemoryView":158 + * + * for idx, dim in enumerate(shape): + * if dim <= 0: # <<<<<<<<<<<<<< + * raise ValueError, f"Invalid shape in axis {idx}: {dim}." + * self._shape[idx] = dim +*/ + } + + /* "View.MemoryView":160 + * if dim <= 0: + * raise ValueError, f"Invalid shape in axis {idx}: {dim}." + * self._shape[idx] = dim # <<<<<<<<<<<<<< + * + * cdef char order +*/ + (__pyx_v_self->_shape[__pyx_v_idx]) = __pyx_v_dim; + + /* "View.MemoryView":157 + * + * + * for idx, dim in enumerate(shape): # <<<<<<<<<<<<<< + * if dim <= 0: + * raise ValueError, f"Invalid shape in axis {idx}: {dim}." +*/ + } + __Pyx_DECREF(__pyx_t_4); __pyx_t_4 = 0; + + /* "View.MemoryView":163 + * + * cdef char order + * if mode == 'c': # <<<<<<<<<<<<<< + * order = b'C' + * self.mode = u'c' +*/ + __pyx_t_3 = (__Pyx_PyUnicode_Equals(__pyx_v_mode, __pyx_mstate_global->__pyx_n_u_c, Py_EQ)); if (unlikely((__pyx_t_3 < 0))) __PYX_ERR(1, 163, __pyx_L1_error) + if (__pyx_t_3) { + + /* "View.MemoryView":164 + * cdef char order + * if mode == 'c': + * order = b'C' # <<<<<<<<<<<<<< + * self.mode = u'c' + * elif mode == 'fortran': +*/ + __pyx_v_order = 'C'; + + /* "View.MemoryView":165 + * if mode == 'c': + * order = b'C' + * self.mode = u'c' # <<<<<<<<<<<<<< + * elif mode == 'fortran': + * order = b'F' +*/ + __Pyx_INCREF(__pyx_mstate_global->__pyx_n_u_c); + __Pyx_GIVEREF(__pyx_mstate_global->__pyx_n_u_c); + __Pyx_GOTREF(__pyx_v_self->mode); + __Pyx_DECREF(__pyx_v_self->mode); + __pyx_v_self->mode = __pyx_mstate_global->__pyx_n_u_c; + + /* "View.MemoryView":163 + * + * cdef char order + * if mode == 'c': # <<<<<<<<<<<<<< + * order = b'C' + * self.mode = u'c' +*/ + goto __pyx_L11; + } + + /* "View.MemoryView":166 + * order = b'C' + * self.mode = u'c' + * elif mode == 'fortran': # <<<<<<<<<<<<<< + * order = b'F' + * self.mode = u'fortran' +*/ + __pyx_t_3 = (__Pyx_PyUnicode_Equals(__pyx_v_mode, __pyx_mstate_global->__pyx_n_u_fortran, Py_EQ)); if (unlikely((__pyx_t_3 < 0))) __PYX_ERR(1, 166, __pyx_L1_error) + if (likely(__pyx_t_3)) { + + /* "View.MemoryView":167 + * self.mode = u'c' + * elif mode == 'fortran': + * order = b'F' # <<<<<<<<<<<<<< + * self.mode = u'fortran' + * else: +*/ + __pyx_v_order = 'F'; + + /* "View.MemoryView":168 + * elif mode == 'fortran': + * order = b'F' + * self.mode = u'fortran' # <<<<<<<<<<<<<< + * else: + * raise ValueError, f"Invalid mode, expected 'c' or 'fortran', got {mode}" +*/ + __Pyx_INCREF(__pyx_mstate_global->__pyx_n_u_fortran); + __Pyx_GIVEREF(__pyx_mstate_global->__pyx_n_u_fortran); + __Pyx_GOTREF(__pyx_v_self->mode); + __Pyx_DECREF(__pyx_v_self->mode); + __pyx_v_self->mode = __pyx_mstate_global->__pyx_n_u_fortran; + + /* "View.MemoryView":166 + * order = b'C' + * self.mode = u'c' + * elif mode == 'fortran': # <<<<<<<<<<<<<< + * order = b'F' + * self.mode = u'fortran' +*/ + goto __pyx_L11; + } + + /* "View.MemoryView":170 + * self.mode = u'fortran' + * else: + * raise ValueError, f"Invalid mode, expected 'c' or 'fortran', got {mode}" # <<<<<<<<<<<<<< + * + * self.len = fill_contig_strides_array(self._shape, self._strides, itemsize, self.ndim, order) +*/ + /*else*/ { + __pyx_t_4 = __Pyx_PyObject_FormatSimple(__pyx_v_mode, __pyx_mstate_global->__pyx_empty_unicode); if (unlikely(!__pyx_t_4)) __PYX_ERR(1, 170, __pyx_L1_error) + __Pyx_GOTREF(__pyx_t_4); + __pyx_t_12 = __Pyx_PyUnicode_Concat(__pyx_mstate_global->__pyx_kp_u_Invalid_mode_expected_c_or_fortr, __pyx_t_4); if (unlikely(!__pyx_t_12)) __PYX_ERR(1, 170, __pyx_L1_error) + __Pyx_GOTREF(__pyx_t_12); + __Pyx_DECREF(__pyx_t_4); __pyx_t_4 = 0; + __Pyx_Raise(((PyObject *)(((PyTypeObject*)PyExc_ValueError))), __pyx_t_12, 0, 0); + __Pyx_DECREF(__pyx_t_12); __pyx_t_12 = 0; + __PYX_ERR(1, 170, __pyx_L1_error) + } + __pyx_L11:; + + /* "View.MemoryView":172 + * raise ValueError, f"Invalid mode, expected 'c' or 'fortran', got {mode}" + * + * self.len = fill_contig_strides_array(self._shape, self._strides, itemsize, self.ndim, order) # <<<<<<<<<<<<<< + * + * self.free_data = allocate_buffer +*/ + __pyx_v_self->len = __pyx_fill_contig_strides_array(__pyx_v_self->_shape, __pyx_v_self->_strides, __pyx_v_itemsize, __pyx_v_self->ndim, __pyx_v_order); + + /* "View.MemoryView":174 + * self.len = fill_contig_strides_array(self._shape, self._strides, itemsize, self.ndim, order) + * + * self.free_data = allocate_buffer # <<<<<<<<<<<<<< + * self.dtype_is_object = format == b'O' + * +*/ + __pyx_v_self->free_data = __pyx_v_allocate_buffer; + + /* "View.MemoryView":175 + * + * self.free_data = allocate_buffer + * self.dtype_is_object = format == b'O' # <<<<<<<<<<<<<< + * + * if allocate_buffer: +*/ + __pyx_t_12 = PyObject_RichCompare(__pyx_v_format, __pyx_mstate_global->__pyx_n_b_O, Py_EQ); __Pyx_XGOTREF(__pyx_t_12); if (unlikely(!__pyx_t_12)) __PYX_ERR(1, 175, __pyx_L1_error) + __pyx_t_3 = __Pyx_PyObject_IsTrue(__pyx_t_12); if (unlikely((__pyx_t_3 == (int)-1) && PyErr_Occurred())) __PYX_ERR(1, 175, __pyx_L1_error) + __Pyx_DECREF(__pyx_t_12); __pyx_t_12 = 0; + __pyx_v_self->dtype_is_object = __pyx_t_3; + + /* "View.MemoryView":177 + * self.dtype_is_object = format == b'O' + * + * if allocate_buffer: # <<<<<<<<<<<<<< + * _allocate_buffer(self) + * +*/ + if (__pyx_v_allocate_buffer) { + + /* "View.MemoryView":178 + * + * if allocate_buffer: + * _allocate_buffer(self) # <<<<<<<<<<<<<< + * + * @cname('getbuffer') +*/ + __pyx_t_8 = __pyx_array_allocate_buffer(__pyx_v_self); if (unlikely(__pyx_t_8 == ((int)-1))) __PYX_ERR(1, 178, __pyx_L1_error) + + /* "View.MemoryView":177 + * self.dtype_is_object = format == b'O' + * + * if allocate_buffer: # <<<<<<<<<<<<<< + * _allocate_buffer(self) + * +*/ + } + + /* "View.MemoryView":129 + * cdef bint dtype_is_object + * + * def __cinit__(array self, tuple shape, Py_ssize_t itemsize, format not None, # <<<<<<<<<<<<<< + * mode="c", bint allocate_buffer=True): + * +*/ + + /* 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_10); + __Pyx_XDECREF(__pyx_t_12); + __Pyx_AddTraceback("View.MemoryView.array.__cinit__", __pyx_clineno, __pyx_lineno, __pyx_filename); + __pyx_r = -1; + __pyx_L0:; + __Pyx_XDECREF(__pyx_v_format); + __Pyx_RefNannyFinishContext(); + return __pyx_r; +} + +/* "View.MemoryView":180 + * _allocate_buffer(self) + * + * @cname('getbuffer') # <<<<<<<<<<<<<< + * def __getbuffer__(self, Py_buffer *info, int flags): + * cdef int bufmode = -1 +*/ + +/* Python wrapper */ +CYTHON_UNUSED static int __pyx_array_getbuffer(PyObject *__pyx_v_self, Py_buffer *__pyx_v_info, int __pyx_v_flags); /*proto*/ +CYTHON_UNUSED static int __pyx_array_getbuffer(PyObject *__pyx_v_self, Py_buffer *__pyx_v_info, int __pyx_v_flags) { + CYTHON_UNUSED PyObject *const *__pyx_kwvalues; + int __pyx_r; + __Pyx_RefNannyDeclarations + __Pyx_RefNannySetupContext("__getbuffer__ (wrapper)", 0); + __pyx_kwvalues = __Pyx_KwValues_VARARGS(__pyx_args, __pyx_nargs); + __pyx_r = __pyx_array___pyx_pf_15View_dot_MemoryView_5array_2__getbuffer__(((struct __pyx_array_obj *)__pyx_v_self), ((Py_buffer *)__pyx_v_info), ((int)__pyx_v_flags)); + + /* function exit code */ + __Pyx_RefNannyFinishContext(); + return __pyx_r; +} + +static int __pyx_array___pyx_pf_15View_dot_MemoryView_5array_2__getbuffer__(struct __pyx_array_obj *__pyx_v_self, Py_buffer *__pyx_v_info, int __pyx_v_flags) { + int __pyx_v_bufmode; + int __pyx_r; + __Pyx_RefNannyDeclarations + int __pyx_t_1; + char *__pyx_t_2; + Py_ssize_t __pyx_t_3; + int __pyx_t_4; + Py_ssize_t *__pyx_t_5; + int __pyx_lineno = 0; + const char *__pyx_filename = NULL; + int __pyx_clineno = 0; + if (unlikely(__pyx_v_info == NULL)) { + PyErr_SetString(PyExc_BufferError, "PyObject_GetBuffer: view==NULL argument is obsolete"); + return -1; + } + __Pyx_RefNannySetupContext("__getbuffer__", 0); + __pyx_v_info->obj = Py_None; __Pyx_INCREF(Py_None); + __Pyx_GIVEREF(__pyx_v_info->obj); + + /* "View.MemoryView":182 + * @cname('getbuffer') + * def __getbuffer__(self, Py_buffer *info, int flags): + * cdef int bufmode = -1 # <<<<<<<<<<<<<< + * if flags & (PyBUF_C_CONTIGUOUS | PyBUF_F_CONTIGUOUS | PyBUF_ANY_CONTIGUOUS): + * if self.mode == u"c": +*/ + __pyx_v_bufmode = -1; + + /* "View.MemoryView":183 + * def __getbuffer__(self, Py_buffer *info, int flags): + * cdef int bufmode = -1 + * if flags & (PyBUF_C_CONTIGUOUS | PyBUF_F_CONTIGUOUS | PyBUF_ANY_CONTIGUOUS): # <<<<<<<<<<<<<< + * if self.mode == u"c": + * bufmode = PyBUF_C_CONTIGUOUS | PyBUF_ANY_CONTIGUOUS +*/ + __pyx_t_1 = ((__pyx_v_flags & ((PyBUF_C_CONTIGUOUS | PyBUF_F_CONTIGUOUS) | PyBUF_ANY_CONTIGUOUS)) != 0); + if (__pyx_t_1) { + + /* "View.MemoryView":184 + * cdef int bufmode = -1 + * if flags & (PyBUF_C_CONTIGUOUS | PyBUF_F_CONTIGUOUS | PyBUF_ANY_CONTIGUOUS): + * if self.mode == u"c": # <<<<<<<<<<<<<< + * bufmode = PyBUF_C_CONTIGUOUS | PyBUF_ANY_CONTIGUOUS + * elif self.mode == u"fortran": +*/ + __pyx_t_1 = (__Pyx_PyUnicode_Equals(__pyx_v_self->mode, __pyx_mstate_global->__pyx_n_u_c, Py_EQ)); if (unlikely((__pyx_t_1 < 0))) __PYX_ERR(1, 184, __pyx_L1_error) + if (__pyx_t_1) { + + /* "View.MemoryView":185 + * if flags & (PyBUF_C_CONTIGUOUS | PyBUF_F_CONTIGUOUS | PyBUF_ANY_CONTIGUOUS): + * if self.mode == u"c": + * bufmode = PyBUF_C_CONTIGUOUS | PyBUF_ANY_CONTIGUOUS # <<<<<<<<<<<<<< + * elif self.mode == u"fortran": + * bufmode = PyBUF_F_CONTIGUOUS | PyBUF_ANY_CONTIGUOUS +*/ + __pyx_v_bufmode = (PyBUF_C_CONTIGUOUS | PyBUF_ANY_CONTIGUOUS); + + /* "View.MemoryView":184 + * cdef int bufmode = -1 + * if flags & (PyBUF_C_CONTIGUOUS | PyBUF_F_CONTIGUOUS | PyBUF_ANY_CONTIGUOUS): + * if self.mode == u"c": # <<<<<<<<<<<<<< + * bufmode = PyBUF_C_CONTIGUOUS | PyBUF_ANY_CONTIGUOUS + * elif self.mode == u"fortran": +*/ + goto __pyx_L4; + } + + /* "View.MemoryView":186 + * if self.mode == u"c": + * bufmode = PyBUF_C_CONTIGUOUS | PyBUF_ANY_CONTIGUOUS + * elif self.mode == u"fortran": # <<<<<<<<<<<<<< + * bufmode = PyBUF_F_CONTIGUOUS | PyBUF_ANY_CONTIGUOUS + * if not (flags & bufmode): +*/ + __pyx_t_1 = (__Pyx_PyUnicode_Equals(__pyx_v_self->mode, __pyx_mstate_global->__pyx_n_u_fortran, Py_EQ)); if (unlikely((__pyx_t_1 < 0))) __PYX_ERR(1, 186, __pyx_L1_error) + if (__pyx_t_1) { + + /* "View.MemoryView":187 + * bufmode = PyBUF_C_CONTIGUOUS | PyBUF_ANY_CONTIGUOUS + * elif self.mode == u"fortran": + * bufmode = PyBUF_F_CONTIGUOUS | PyBUF_ANY_CONTIGUOUS # <<<<<<<<<<<<<< + * if not (flags & bufmode): + * raise ValueError, "Can only create a buffer that is contiguous in memory." +*/ + __pyx_v_bufmode = (PyBUF_F_CONTIGUOUS | PyBUF_ANY_CONTIGUOUS); + + /* "View.MemoryView":186 + * if self.mode == u"c": + * bufmode = PyBUF_C_CONTIGUOUS | PyBUF_ANY_CONTIGUOUS + * elif self.mode == u"fortran": # <<<<<<<<<<<<<< + * bufmode = PyBUF_F_CONTIGUOUS | PyBUF_ANY_CONTIGUOUS + * if not (flags & bufmode): +*/ + } + __pyx_L4:; + + /* "View.MemoryView":188 + * elif self.mode == u"fortran": + * bufmode = PyBUF_F_CONTIGUOUS | PyBUF_ANY_CONTIGUOUS + * if not (flags & bufmode): # <<<<<<<<<<<<<< + * raise ValueError, "Can only create a buffer that is contiguous in memory." + * info.buf = self.data +*/ + __pyx_t_1 = (!((__pyx_v_flags & __pyx_v_bufmode) != 0)); + if (unlikely(__pyx_t_1)) { + + /* "View.MemoryView":189 + * bufmode = PyBUF_F_CONTIGUOUS | PyBUF_ANY_CONTIGUOUS + * if not (flags & bufmode): + * raise ValueError, "Can only create a buffer that is contiguous in memory." # <<<<<<<<<<<<<< + * info.buf = self.data + * info.len = self.len +*/ + __Pyx_Raise(((PyObject *)(((PyTypeObject*)PyExc_ValueError))), __pyx_mstate_global->__pyx_kp_u_Can_only_create_a_buffer_that_is, 0, 0); + __PYX_ERR(1, 189, __pyx_L1_error) + + /* "View.MemoryView":188 + * elif self.mode == u"fortran": + * bufmode = PyBUF_F_CONTIGUOUS | PyBUF_ANY_CONTIGUOUS + * if not (flags & bufmode): # <<<<<<<<<<<<<< + * raise ValueError, "Can only create a buffer that is contiguous in memory." + * info.buf = self.data +*/ + } + + /* "View.MemoryView":183 + * def __getbuffer__(self, Py_buffer *info, int flags): + * cdef int bufmode = -1 + * if flags & (PyBUF_C_CONTIGUOUS | PyBUF_F_CONTIGUOUS | PyBUF_ANY_CONTIGUOUS): # <<<<<<<<<<<<<< + * if self.mode == u"c": + * bufmode = PyBUF_C_CONTIGUOUS | PyBUF_ANY_CONTIGUOUS +*/ + } + + /* "View.MemoryView":190 + * if not (flags & bufmode): + * raise ValueError, "Can only create a buffer that is contiguous in memory." + * info.buf = self.data # <<<<<<<<<<<<<< + * info.len = self.len + * +*/ + __pyx_t_2 = __pyx_v_self->data; + __pyx_v_info->buf = __pyx_t_2; + + /* "View.MemoryView":191 + * raise ValueError, "Can only create a buffer that is contiguous in memory." + * info.buf = self.data + * info.len = self.len # <<<<<<<<<<<<<< + * + * if flags & PyBUF_STRIDES: +*/ + __pyx_t_3 = __pyx_v_self->len; + __pyx_v_info->len = __pyx_t_3; + + /* "View.MemoryView":193 + * info.len = self.len + * + * if flags & PyBUF_STRIDES: # <<<<<<<<<<<<<< + * info.ndim = self.ndim + * info.shape = self._shape +*/ + __pyx_t_1 = ((__pyx_v_flags & PyBUF_STRIDES) != 0); + if (__pyx_t_1) { + + /* "View.MemoryView":194 + * + * if flags & PyBUF_STRIDES: + * info.ndim = self.ndim # <<<<<<<<<<<<<< + * info.shape = self._shape + * info.strides = self._strides +*/ + __pyx_t_4 = __pyx_v_self->ndim; + __pyx_v_info->ndim = __pyx_t_4; + + /* "View.MemoryView":195 + * if flags & PyBUF_STRIDES: + * info.ndim = self.ndim + * info.shape = self._shape # <<<<<<<<<<<<<< + * info.strides = self._strides + * else: +*/ + __pyx_t_5 = __pyx_v_self->_shape; + __pyx_v_info->shape = __pyx_t_5; + + /* "View.MemoryView":196 + * info.ndim = self.ndim + * info.shape = self._shape + * info.strides = self._strides # <<<<<<<<<<<<<< + * else: + * info.ndim = 1 +*/ + __pyx_t_5 = __pyx_v_self->_strides; + __pyx_v_info->strides = __pyx_t_5; + + /* "View.MemoryView":193 + * info.len = self.len + * + * if flags & PyBUF_STRIDES: # <<<<<<<<<<<<<< + * info.ndim = self.ndim + * info.shape = self._shape +*/ + goto __pyx_L6; + } + + /* "View.MemoryView":198 + * info.strides = self._strides + * else: + * info.ndim = 1 # <<<<<<<<<<<<<< + * info.shape = &self.len if flags & PyBUF_ND else NULL + * info.strides = NULL +*/ + /*else*/ { + __pyx_v_info->ndim = 1; + + /* "View.MemoryView":199 + * else: + * info.ndim = 1 + * info.shape = &self.len if flags & PyBUF_ND else NULL # <<<<<<<<<<<<<< + * info.strides = NULL + * +*/ + __pyx_t_1 = ((__pyx_v_flags & PyBUF_ND) != 0); + if (__pyx_t_1) { + __pyx_t_5 = (&__pyx_v_self->len); + } else { + __pyx_t_5 = NULL; + } + __pyx_v_info->shape = __pyx_t_5; + + /* "View.MemoryView":200 + * info.ndim = 1 + * info.shape = &self.len if flags & PyBUF_ND else NULL + * info.strides = NULL # <<<<<<<<<<<<<< + * + * info.suboffsets = NULL +*/ + __pyx_v_info->strides = NULL; + } + __pyx_L6:; + + /* "View.MemoryView":202 + * info.strides = NULL + * + * info.suboffsets = NULL # <<<<<<<<<<<<<< + * info.itemsize = self.itemsize + * info.readonly = 0 +*/ + __pyx_v_info->suboffsets = NULL; + + /* "View.MemoryView":203 + * + * info.suboffsets = NULL + * info.itemsize = self.itemsize # <<<<<<<<<<<<<< + * info.readonly = 0 + * info.format = self.format if flags & PyBUF_FORMAT else NULL +*/ + __pyx_t_3 = __pyx_v_self->itemsize; + __pyx_v_info->itemsize = __pyx_t_3; + + /* "View.MemoryView":204 + * info.suboffsets = NULL + * info.itemsize = self.itemsize + * info.readonly = 0 # <<<<<<<<<<<<<< + * info.format = self.format if flags & PyBUF_FORMAT else NULL + * info.obj = self +*/ + __pyx_v_info->readonly = 0; + + /* "View.MemoryView":205 + * info.itemsize = self.itemsize + * info.readonly = 0 + * info.format = self.format if flags & PyBUF_FORMAT else NULL # <<<<<<<<<<<<<< + * info.obj = self + * +*/ + __pyx_t_1 = ((__pyx_v_flags & PyBUF_FORMAT) != 0); + if (__pyx_t_1) { + __pyx_t_2 = __pyx_v_self->format; + } else { + __pyx_t_2 = NULL; + } + __pyx_v_info->format = __pyx_t_2; + + /* "View.MemoryView":206 + * info.readonly = 0 + * info.format = self.format if flags & PyBUF_FORMAT else NULL + * info.obj = self # <<<<<<<<<<<<<< + * + * def __dealloc__(array self): +*/ + __Pyx_INCREF((PyObject *)__pyx_v_self); + __Pyx_GIVEREF((PyObject *)__pyx_v_self); + __Pyx_GOTREF(__pyx_v_info->obj); + __Pyx_DECREF(__pyx_v_info->obj); + __pyx_v_info->obj = ((PyObject *)__pyx_v_self); + + /* "View.MemoryView":180 + * _allocate_buffer(self) + * + * @cname('getbuffer') # <<<<<<<<<<<<<< + * def __getbuffer__(self, Py_buffer *info, int flags): + * cdef int bufmode = -1 +*/ + + /* function exit code */ + __pyx_r = 0; + goto __pyx_L0; + __pyx_L1_error:; + __Pyx_AddTraceback("View.MemoryView.array.__getbuffer__", __pyx_clineno, __pyx_lineno, __pyx_filename); + __pyx_r = -1; + if (__pyx_v_info->obj != NULL) { + __Pyx_GOTREF(__pyx_v_info->obj); + __Pyx_DECREF(__pyx_v_info->obj); __pyx_v_info->obj = 0; + } + goto __pyx_L2; + __pyx_L0:; + if (__pyx_v_info->obj == Py_None) { + __Pyx_GOTREF(__pyx_v_info->obj); + __Pyx_DECREF(__pyx_v_info->obj); __pyx_v_info->obj = 0; + } + __pyx_L2:; + __Pyx_RefNannyFinishContext(); + return __pyx_r; +} + +/* "View.MemoryView":208 + * info.obj = self + * + * def __dealloc__(array self): # <<<<<<<<<<<<<< + * if self.callback_free_data != NULL: + * self.callback_free_data(self.data) +*/ + +/* Python wrapper */ +static void __pyx_array___dealloc__(PyObject *__pyx_v_self); /*proto*/ +static void __pyx_array___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_array___pyx_pf_15View_dot_MemoryView_5array_4__dealloc__(((struct __pyx_array_obj *)__pyx_v_self)); + + /* function exit code */ + __Pyx_RefNannyFinishContext(); +} + +static void __pyx_array___pyx_pf_15View_dot_MemoryView_5array_4__dealloc__(struct __pyx_array_obj *__pyx_v_self) { + int __pyx_t_1; + int __pyx_t_2; + + /* "View.MemoryView":209 + * + * def __dealloc__(array self): + * if self.callback_free_data != NULL: # <<<<<<<<<<<<<< + * self.callback_free_data(self.data) + * elif self.free_data and self.data is not NULL: +*/ + __pyx_t_1 = (__pyx_v_self->callback_free_data != NULL); + if (__pyx_t_1) { + + /* "View.MemoryView":210 + * def __dealloc__(array self): + * if self.callback_free_data != NULL: + * self.callback_free_data(self.data) # <<<<<<<<<<<<<< + * elif self.free_data and self.data is not NULL: + * if self.dtype_is_object: +*/ + __pyx_v_self->callback_free_data(__pyx_v_self->data); + + /* "View.MemoryView":209 + * + * def __dealloc__(array self): + * if self.callback_free_data != NULL: # <<<<<<<<<<<<<< + * self.callback_free_data(self.data) + * elif self.free_data and self.data is not NULL: +*/ + goto __pyx_L3; + } + + /* "View.MemoryView":211 + * if self.callback_free_data != NULL: + * self.callback_free_data(self.data) + * elif self.free_data and self.data is not NULL: # <<<<<<<<<<<<<< + * if self.dtype_is_object: + * refcount_objects_in_slice(self.data, self._shape, self._strides, self.ndim, inc=False) +*/ + if (__pyx_v_self->free_data) { + } else { + __pyx_t_1 = __pyx_v_self->free_data; + goto __pyx_L4_bool_binop_done; + } + __pyx_t_2 = (__pyx_v_self->data != NULL); + __pyx_t_1 = __pyx_t_2; + __pyx_L4_bool_binop_done:; + if (__pyx_t_1) { + + /* "View.MemoryView":212 + * self.callback_free_data(self.data) + * elif self.free_data and self.data is not NULL: + * if self.dtype_is_object: # <<<<<<<<<<<<<< + * refcount_objects_in_slice(self.data, self._shape, self._strides, self.ndim, inc=False) + * free(self.data) +*/ + if (__pyx_v_self->dtype_is_object) { + + /* "View.MemoryView":213 + * elif self.free_data and self.data is not NULL: + * if self.dtype_is_object: + * refcount_objects_in_slice(self.data, self._shape, self._strides, self.ndim, inc=False) # <<<<<<<<<<<<<< + * free(self.data) + * PyObject_Free(self._shape) +*/ + __pyx_memoryview_refcount_objects_in_slice(__pyx_v_self->data, __pyx_v_self->_shape, __pyx_v_self->_strides, __pyx_v_self->ndim, 0); + + /* "View.MemoryView":212 + * self.callback_free_data(self.data) + * elif self.free_data and self.data is not NULL: + * if self.dtype_is_object: # <<<<<<<<<<<<<< + * refcount_objects_in_slice(self.data, self._shape, self._strides, self.ndim, inc=False) + * free(self.data) +*/ + } + + /* "View.MemoryView":214 + * if self.dtype_is_object: + * refcount_objects_in_slice(self.data, self._shape, self._strides, self.ndim, inc=False) + * free(self.data) # <<<<<<<<<<<<<< + * PyObject_Free(self._shape) + * +*/ + free(__pyx_v_self->data); + + /* "View.MemoryView":211 + * if self.callback_free_data != NULL: + * self.callback_free_data(self.data) + * elif self.free_data and self.data is not NULL: # <<<<<<<<<<<<<< + * if self.dtype_is_object: + * refcount_objects_in_slice(self.data, self._shape, self._strides, self.ndim, inc=False) +*/ + } + __pyx_L3:; + + /* "View.MemoryView":215 + * refcount_objects_in_slice(self.data, self._shape, self._strides, self.ndim, inc=False) + * free(self.data) + * PyObject_Free(self._shape) # <<<<<<<<<<<<<< + * + * @property +*/ + PyObject_Free(__pyx_v_self->_shape); + + /* "View.MemoryView":208 + * info.obj = self + * + * def __dealloc__(array self): # <<<<<<<<<<<<<< + * if self.callback_free_data != NULL: + * self.callback_free_data(self.data) +*/ + + /* function exit code */ +} + +/* "View.MemoryView":217 + * PyObject_Free(self._shape) + * + * @property # <<<<<<<<<<<<<< + * def memview(self): + * return self.get_memview() +*/ + +/* Python wrapper */ +static PyObject *__pyx_pw_15View_dot_MemoryView_5array_7memview_1__get__(PyObject *__pyx_v_self); /*proto*/ +static PyObject *__pyx_pw_15View_dot_MemoryView_5array_7memview_1__get__(PyObject *__pyx_v_self) { + CYTHON_UNUSED PyObject *const *__pyx_kwvalues; + PyObject *__pyx_r = 0; + __Pyx_RefNannyDeclarations + __Pyx_RefNannySetupContext("__get__ (wrapper)", 0); + __pyx_kwvalues = __Pyx_KwValues_VARARGS(__pyx_args, __pyx_nargs); + __pyx_r = __pyx_pf_15View_dot_MemoryView_5array_7memview___get__(((struct __pyx_array_obj *)__pyx_v_self)); + + /* function exit code */ + __Pyx_RefNannyFinishContext(); + return __pyx_r; +} + +static PyObject *__pyx_pf_15View_dot_MemoryView_5array_7memview___get__(struct __pyx_array_obj *__pyx_v_self) { + PyObject *__pyx_r = NULL; + __Pyx_RefNannyDeclarations + PyObject *__pyx_t_1 = NULL; + int __pyx_lineno = 0; + const char *__pyx_filename = NULL; + int __pyx_clineno = 0; + __Pyx_RefNannySetupContext("__get__", 0); + + /* "View.MemoryView":219 + * @property + * def memview(self): + * return self.get_memview() # <<<<<<<<<<<<<< + * + * @cname('get_memview') +*/ + __Pyx_XDECREF(__pyx_r); + __pyx_t_1 = ((struct __pyx_vtabstruct_array *)__pyx_v_self->__pyx_vtab)->get_memview(__pyx_v_self); if (unlikely(!__pyx_t_1)) __PYX_ERR(1, 219, __pyx_L1_error) + __Pyx_GOTREF(__pyx_t_1); + __pyx_r = __pyx_t_1; + __pyx_t_1 = 0; + goto __pyx_L0; + + /* "View.MemoryView":217 + * PyObject_Free(self._shape) + * + * @property # <<<<<<<<<<<<<< + * def memview(self): + * return self.get_memview() +*/ + + /* function exit code */ + __pyx_L1_error:; + __Pyx_XDECREF(__pyx_t_1); + __Pyx_AddTraceback("View.MemoryView.array.memview.__get__", __pyx_clineno, __pyx_lineno, __pyx_filename); + __pyx_r = NULL; + __pyx_L0:; + __Pyx_XGIVEREF(__pyx_r); + __Pyx_RefNannyFinishContext(); + return __pyx_r; +} + +/* "View.MemoryView":221 + * return self.get_memview() + * + * @cname('get_memview') # <<<<<<<<<<<<<< + * cdef get_memview(self): + * flags = PyBUF_ANY_CONTIGUOUS|PyBUF_FORMAT|PyBUF_WRITABLE +*/ + +static PyObject *__pyx_array_get_memview(struct __pyx_array_obj *__pyx_v_self) { + int __pyx_v_flags; + PyObject *__pyx_r = NULL; + __Pyx_RefNannyDeclarations + PyObject *__pyx_t_1 = NULL; + PyObject *__pyx_t_2 = NULL; + PyObject *__pyx_t_3 = NULL; + PyObject *__pyx_t_4 = NULL; + size_t __pyx_t_5; + int __pyx_lineno = 0; + const char *__pyx_filename = NULL; + int __pyx_clineno = 0; + __Pyx_RefNannySetupContext("get_memview", 0); + + /* "View.MemoryView":223 + * @cname('get_memview') + * cdef get_memview(self): + * flags = PyBUF_ANY_CONTIGUOUS|PyBUF_FORMAT|PyBUF_WRITABLE # <<<<<<<<<<<<<< + * return memoryview(self, flags, self.dtype_is_object) + * +*/ + __pyx_v_flags = ((PyBUF_ANY_CONTIGUOUS | PyBUF_FORMAT) | PyBUF_WRITABLE); + + /* "View.MemoryView":224 + * cdef get_memview(self): + * flags = PyBUF_ANY_CONTIGUOUS|PyBUF_FORMAT|PyBUF_WRITABLE + * return memoryview(self, flags, self.dtype_is_object) # <<<<<<<<<<<<<< + * + * def __len__(self): +*/ + __Pyx_XDECREF(__pyx_r); + __pyx_t_2 = NULL; + __pyx_t_3 = __Pyx_PyLong_From_int(__pyx_v_flags); if (unlikely(!__pyx_t_3)) __PYX_ERR(1, 224, __pyx_L1_error) + __Pyx_GOTREF(__pyx_t_3); + __pyx_t_4 = __Pyx_PyBool_FromLong(__pyx_v_self->dtype_is_object); if (unlikely(!__pyx_t_4)) __PYX_ERR(1, 224, __pyx_L1_error) + __Pyx_GOTREF(__pyx_t_4); + __pyx_t_5 = 1; + { + PyObject *__pyx_callargs[4] = {__pyx_t_2, ((PyObject *)__pyx_v_self), __pyx_t_3, __pyx_t_4}; + __pyx_t_1 = __Pyx_PyObject_FastCall((PyObject*)__pyx_mstate_global->__pyx_memoryview_type, __pyx_callargs+__pyx_t_5, (4-__pyx_t_5) | (__pyx_t_5*__Pyx_PY_VECTORCALL_ARGUMENTS_OFFSET)); + __Pyx_XDECREF(__pyx_t_2); __pyx_t_2 = 0; + __Pyx_DECREF(__pyx_t_3); __pyx_t_3 = 0; + __Pyx_DECREF(__pyx_t_4); __pyx_t_4 = 0; + if (unlikely(!__pyx_t_1)) __PYX_ERR(1, 224, __pyx_L1_error) + __Pyx_GOTREF((PyObject *)__pyx_t_1); + } + __pyx_r = ((PyObject *)__pyx_t_1); + __pyx_t_1 = 0; + goto __pyx_L0; + + /* "View.MemoryView":221 + * return self.get_memview() + * + * @cname('get_memview') # <<<<<<<<<<<<<< + * cdef get_memview(self): + * flags = PyBUF_ANY_CONTIGUOUS|PyBUF_FORMAT|PyBUF_WRITABLE +*/ + + /* function exit code */ + __pyx_L1_error:; + __Pyx_XDECREF(__pyx_t_1); + __Pyx_XDECREF(__pyx_t_2); + __Pyx_XDECREF(__pyx_t_3); + __Pyx_XDECREF(__pyx_t_4); + __Pyx_AddTraceback("View.MemoryView.array.get_memview", __pyx_clineno, __pyx_lineno, __pyx_filename); + __pyx_r = 0; + __pyx_L0:; + __Pyx_XGIVEREF(__pyx_r); + __Pyx_RefNannyFinishContext(); + return __pyx_r; +} + +/* "View.MemoryView":226 + * return memoryview(self, flags, self.dtype_is_object) + * + * def __len__(self): # <<<<<<<<<<<<<< + * return self._shape[0] + * +*/ + +/* Python wrapper */ +static Py_ssize_t __pyx_array___len__(PyObject *__pyx_v_self); /*proto*/ +static Py_ssize_t __pyx_array___len__(PyObject *__pyx_v_self) { + CYTHON_UNUSED PyObject *const *__pyx_kwvalues; + Py_ssize_t __pyx_r; + __Pyx_RefNannyDeclarations + __Pyx_RefNannySetupContext("__len__ (wrapper)", 0); + __pyx_kwvalues = __Pyx_KwValues_VARARGS(__pyx_args, __pyx_nargs); + __pyx_r = __pyx_array___pyx_pf_15View_dot_MemoryView_5array_6__len__(((struct __pyx_array_obj *)__pyx_v_self)); + + /* function exit code */ + __Pyx_RefNannyFinishContext(); + return __pyx_r; +} + +static Py_ssize_t __pyx_array___pyx_pf_15View_dot_MemoryView_5array_6__len__(struct __pyx_array_obj *__pyx_v_self) { + Py_ssize_t __pyx_r; + + /* "View.MemoryView":227 + * + * def __len__(self): + * return self._shape[0] # <<<<<<<<<<<<<< + * + * def __getattr__(self, attr): +*/ + __pyx_r = (__pyx_v_self->_shape[0]); + goto __pyx_L0; + + /* "View.MemoryView":226 + * return memoryview(self, flags, self.dtype_is_object) + * + * def __len__(self): # <<<<<<<<<<<<<< + * return self._shape[0] + * +*/ + + /* function exit code */ + __pyx_L0:; + return __pyx_r; +} + +/* "View.MemoryView":229 + * return self._shape[0] + * + * def __getattr__(self, attr): # <<<<<<<<<<<<<< + * return getattr(self.memview, attr) + * +*/ + +/* Python wrapper */ +static PyObject *__pyx_array___getattr__(PyObject *__pyx_v_self, PyObject *__pyx_v_attr); /*proto*/ +static PyObject *__pyx_array___getattr__(PyObject *__pyx_v_self, PyObject *__pyx_v_attr) { + CYTHON_UNUSED PyObject *const *__pyx_kwvalues; + PyObject *__pyx_r = 0; + __Pyx_RefNannyDeclarations + __Pyx_RefNannySetupContext("__getattr__ (wrapper)", 0); + __pyx_kwvalues = __Pyx_KwValues_VARARGS(__pyx_args, __pyx_nargs); + __pyx_r = __pyx_array___pyx_pf_15View_dot_MemoryView_5array_8__getattr__(((struct __pyx_array_obj *)__pyx_v_self), ((PyObject *)__pyx_v_attr)); + + /* function exit code */ + __Pyx_RefNannyFinishContext(); + return __pyx_r; +} + +static PyObject *__pyx_array___pyx_pf_15View_dot_MemoryView_5array_8__getattr__(struct __pyx_array_obj *__pyx_v_self, PyObject *__pyx_v_attr) { + PyObject *__pyx_r = NULL; + __Pyx_RefNannyDeclarations + PyObject *__pyx_t_1 = NULL; + PyObject *__pyx_t_2 = NULL; + int __pyx_lineno = 0; + const char *__pyx_filename = NULL; + int __pyx_clineno = 0; + __Pyx_RefNannySetupContext("__getattr__", 0); + + /* "View.MemoryView":230 + * + * def __getattr__(self, attr): + * return getattr(self.memview, attr) # <<<<<<<<<<<<<< + * + * def __getitem__(self, item): +*/ + __Pyx_XDECREF(__pyx_r); + __pyx_t_1 = __Pyx_PyObject_GetAttrStr(((PyObject *)__pyx_v_self), __pyx_mstate_global->__pyx_n_u_memview); if (unlikely(!__pyx_t_1)) __PYX_ERR(1, 230, __pyx_L1_error) + __Pyx_GOTREF(__pyx_t_1); + __pyx_t_2 = __Pyx_GetAttr(__pyx_t_1, __pyx_v_attr); if (unlikely(!__pyx_t_2)) __PYX_ERR(1, 230, __pyx_L1_error) + __Pyx_GOTREF(__pyx_t_2); + __Pyx_DECREF(__pyx_t_1); __pyx_t_1 = 0; + __pyx_r = __pyx_t_2; + __pyx_t_2 = 0; + goto __pyx_L0; + + /* "View.MemoryView":229 + * return self._shape[0] + * + * def __getattr__(self, attr): # <<<<<<<<<<<<<< + * return getattr(self.memview, attr) + * +*/ + + /* function exit code */ + __pyx_L1_error:; + __Pyx_XDECREF(__pyx_t_1); + __Pyx_XDECREF(__pyx_t_2); + __Pyx_AddTraceback("View.MemoryView.array.__getattr__", __pyx_clineno, __pyx_lineno, __pyx_filename); + __pyx_r = NULL; + __pyx_L0:; + __Pyx_XGIVEREF(__pyx_r); + __Pyx_RefNannyFinishContext(); + return __pyx_r; +} + +/* "View.MemoryView":232 + * return getattr(self.memview, attr) + * + * def __getitem__(self, item): # <<<<<<<<<<<<<< + * return self.memview[item] + * +*/ + +/* Python wrapper */ +static PyObject *__pyx_array___getitem__(PyObject *__pyx_v_self, PyObject *__pyx_v_item); /*proto*/ +static PyObject *__pyx_array___getitem__(PyObject *__pyx_v_self, PyObject *__pyx_v_item) { + CYTHON_UNUSED PyObject *const *__pyx_kwvalues; + PyObject *__pyx_r = 0; + __Pyx_RefNannyDeclarations + __Pyx_RefNannySetupContext("__getitem__ (wrapper)", 0); + __pyx_kwvalues = __Pyx_KwValues_VARARGS(__pyx_args, __pyx_nargs); + __pyx_r = __pyx_array___pyx_pf_15View_dot_MemoryView_5array_10__getitem__(((struct __pyx_array_obj *)__pyx_v_self), ((PyObject *)__pyx_v_item)); + + /* function exit code */ + __Pyx_RefNannyFinishContext(); + return __pyx_r; +} + +static PyObject *__pyx_array___pyx_pf_15View_dot_MemoryView_5array_10__getitem__(struct __pyx_array_obj *__pyx_v_self, PyObject *__pyx_v_item) { + PyObject *__pyx_r = NULL; + __Pyx_RefNannyDeclarations + PyObject *__pyx_t_1 = NULL; + PyObject *__pyx_t_2 = NULL; + int __pyx_lineno = 0; + const char *__pyx_filename = NULL; + int __pyx_clineno = 0; + __Pyx_RefNannySetupContext("__getitem__", 0); + + /* "View.MemoryView":233 + * + * def __getitem__(self, item): + * return self.memview[item] # <<<<<<<<<<<<<< + * + * def __setitem__(self, item, value): +*/ + __Pyx_XDECREF(__pyx_r); + __pyx_t_1 = __Pyx_PyObject_GetAttrStr(((PyObject *)__pyx_v_self), __pyx_mstate_global->__pyx_n_u_memview); if (unlikely(!__pyx_t_1)) __PYX_ERR(1, 233, __pyx_L1_error) + __Pyx_GOTREF(__pyx_t_1); + __pyx_t_2 = __Pyx_PyObject_GetItem(__pyx_t_1, __pyx_v_item); if (unlikely(!__pyx_t_2)) __PYX_ERR(1, 233, __pyx_L1_error) + __Pyx_GOTREF(__pyx_t_2); + __Pyx_DECREF(__pyx_t_1); __pyx_t_1 = 0; + __pyx_r = __pyx_t_2; + __pyx_t_2 = 0; + goto __pyx_L0; + + /* "View.MemoryView":232 + * return getattr(self.memview, attr) + * + * def __getitem__(self, item): # <<<<<<<<<<<<<< + * return self.memview[item] + * +*/ + + /* function exit code */ + __pyx_L1_error:; + __Pyx_XDECREF(__pyx_t_1); + __Pyx_XDECREF(__pyx_t_2); + __Pyx_AddTraceback("View.MemoryView.array.__getitem__", __pyx_clineno, __pyx_lineno, __pyx_filename); + __pyx_r = NULL; + __pyx_L0:; + __Pyx_XGIVEREF(__pyx_r); + __Pyx_RefNannyFinishContext(); + return __pyx_r; +} + +/* "View.MemoryView":235 + * return self.memview[item] + * + * def __setitem__(self, item, value): # <<<<<<<<<<<<<< + * self.memview[item] = value + * +*/ + +/* Python wrapper */ +static int __pyx_array___setitem__(PyObject *__pyx_v_self, PyObject *__pyx_v_item, PyObject *__pyx_v_value); /*proto*/ +static int __pyx_array___setitem__(PyObject *__pyx_v_self, PyObject *__pyx_v_item, PyObject *__pyx_v_value) { + CYTHON_UNUSED PyObject *const *__pyx_kwvalues; + int __pyx_r; + __Pyx_RefNannyDeclarations + __Pyx_RefNannySetupContext("__setitem__ (wrapper)", 0); + __pyx_kwvalues = __Pyx_KwValues_VARARGS(__pyx_args, __pyx_nargs); + __pyx_r = __pyx_array___pyx_pf_15View_dot_MemoryView_5array_12__setitem__(((struct __pyx_array_obj *)__pyx_v_self), ((PyObject *)__pyx_v_item), ((PyObject *)__pyx_v_value)); + + /* function exit code */ + __Pyx_RefNannyFinishContext(); + return __pyx_r; +} + +static int __pyx_array___pyx_pf_15View_dot_MemoryView_5array_12__setitem__(struct __pyx_array_obj *__pyx_v_self, PyObject *__pyx_v_item, PyObject *__pyx_v_value) { + int __pyx_r; + __Pyx_RefNannyDeclarations + PyObject *__pyx_t_1 = NULL; + int __pyx_lineno = 0; + const char *__pyx_filename = NULL; + int __pyx_clineno = 0; + __Pyx_RefNannySetupContext("__setitem__", 0); + + /* "View.MemoryView":236 + * + * def __setitem__(self, item, value): + * self.memview[item] = value # <<<<<<<<<<<<<< + * + * +*/ + __pyx_t_1 = __Pyx_PyObject_GetAttrStr(((PyObject *)__pyx_v_self), __pyx_mstate_global->__pyx_n_u_memview); if (unlikely(!__pyx_t_1)) __PYX_ERR(1, 236, __pyx_L1_error) + __Pyx_GOTREF(__pyx_t_1); + if (unlikely((PyObject_SetItem(__pyx_t_1, __pyx_v_item, __pyx_v_value) < 0))) __PYX_ERR(1, 236, __pyx_L1_error) + __Pyx_DECREF(__pyx_t_1); __pyx_t_1 = 0; + + /* "View.MemoryView":235 + * return self.memview[item] + * + * def __setitem__(self, item, value): # <<<<<<<<<<<<<< + * self.memview[item] = value + * +*/ + + /* function exit code */ + __pyx_r = 0; + goto __pyx_L0; + __pyx_L1_error:; + __Pyx_XDECREF(__pyx_t_1); + __Pyx_AddTraceback("View.MemoryView.array.__setitem__", __pyx_clineno, __pyx_lineno, __pyx_filename); + __pyx_r = -1; + __pyx_L0:; + __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___pyx_array_1__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*/ +static PyObject *__pyx_pw___pyx_array_1__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___pyx_array___reduce_cython__(((struct __pyx_array_obj *)__pyx_v_self)); + + /* function exit code */ + __Pyx_RefNannyFinishContext(); + return __pyx_r; +} + +static PyObject *__pyx_pf___pyx_array___reduce_cython__(CYTHON_UNUSED struct __pyx_array_obj *__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("View.MemoryView.array.__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___pyx_array_3__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*/ +static PyObject *__pyx_pw___pyx_array_3__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("View.MemoryView.array.__setstate_cython__", __pyx_clineno, __pyx_lineno, __pyx_filename); + __Pyx_RefNannyFinishContext(); + return NULL; + __pyx_L4_argument_unpacking_done:; + __pyx_r = __pyx_pf___pyx_array_2__setstate_cython__(((struct __pyx_array_obj *)__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___pyx_array_2__setstate_cython__(CYTHON_UNUSED struct __pyx_array_obj *__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("View.MemoryView.array.__setstate_cython__", __pyx_clineno, __pyx_lineno, __pyx_filename); + __pyx_r = NULL; + __Pyx_XGIVEREF(__pyx_r); + __Pyx_RefNannyFinishContext(); + return __pyx_r; +} + +/* "View.MemoryView":245 + * pass + * + * @cname("__pyx_array_allocate_buffer") # <<<<<<<<<<<<<< + * cdef int _allocate_buffer(array self) except -1: + * +*/ + +static int __pyx_array_allocate_buffer(struct __pyx_array_obj *__pyx_v_self) { + Py_ssize_t __pyx_v_i; + PyObject **__pyx_v_p; + int __pyx_r; + int __pyx_t_1; + Py_ssize_t __pyx_t_2; + Py_ssize_t __pyx_t_3; + Py_ssize_t __pyx_t_4; + int __pyx_lineno = 0; + const char *__pyx_filename = NULL; + int __pyx_clineno = 0; + + /* "View.MemoryView":252 + * cdef PyObject **p + * + * self.free_data = True # <<<<<<<<<<<<<< + * self.data = malloc(self.len) + * if not self.data: +*/ + __pyx_v_self->free_data = 1; + + /* "View.MemoryView":253 + * + * self.free_data = True + * self.data = malloc(self.len) # <<<<<<<<<<<<<< + * if not self.data: + * raise MemoryError, "unable to allocate array data." +*/ + __pyx_v_self->data = ((char *)malloc(__pyx_v_self->len)); + + /* "View.MemoryView":254 + * self.free_data = True + * self.data = malloc(self.len) + * if not self.data: # <<<<<<<<<<<<<< + * raise MemoryError, "unable to allocate array data." + * +*/ + __pyx_t_1 = (!(__pyx_v_self->data != 0)); + if (unlikely(__pyx_t_1)) { + + /* "View.MemoryView":255 + * self.data = malloc(self.len) + * if not self.data: + * raise MemoryError, "unable to allocate array data." # <<<<<<<<<<<<<< + * + * if self.dtype_is_object: +*/ + __Pyx_Raise(((PyObject *)(((PyTypeObject*)PyExc_MemoryError))), __pyx_mstate_global->__pyx_kp_u_unable_to_allocate_array_data, 0, 0); + __PYX_ERR(1, 255, __pyx_L1_error) + + /* "View.MemoryView":254 + * self.free_data = True + * self.data = malloc(self.len) + * if not self.data: # <<<<<<<<<<<<<< + * raise MemoryError, "unable to allocate array data." + * +*/ + } + + /* "View.MemoryView":257 + * raise MemoryError, "unable to allocate array data." + * + * if self.dtype_is_object: # <<<<<<<<<<<<<< + * p = self.data + * for i in range(self.len // self.itemsize): +*/ + if (__pyx_v_self->dtype_is_object) { + + /* "View.MemoryView":258 + * + * if self.dtype_is_object: + * p = self.data # <<<<<<<<<<<<<< + * for i in range(self.len // self.itemsize): + * p[i] = Py_None +*/ + __pyx_v_p = ((PyObject **)__pyx_v_self->data); + + /* "View.MemoryView":259 + * if self.dtype_is_object: + * p = self.data + * for i in range(self.len // self.itemsize): # <<<<<<<<<<<<<< + * p[i] = Py_None + * Py_INCREF(Py_None) +*/ + if (unlikely(__pyx_v_self->itemsize == 0)) { + PyErr_SetString(PyExc_ZeroDivisionError, "integer division or modulo by zero"); + __PYX_ERR(1, 259, __pyx_L1_error) + } + else if (sizeof(Py_ssize_t) == sizeof(long) && (!(((Py_ssize_t)-1) > 0)) && unlikely(__pyx_v_self->itemsize == (Py_ssize_t)-1) && unlikely(__Pyx_UNARY_NEG_WOULD_OVERFLOW(__pyx_v_self->len))) { + PyErr_SetString(PyExc_OverflowError, "value too large to perform division"); + __PYX_ERR(1, 259, __pyx_L1_error) + } + __pyx_t_2 = __Pyx_div_Py_ssize_t(__pyx_v_self->len, __pyx_v_self->itemsize, 0); + __pyx_t_3 = __pyx_t_2; + for (__pyx_t_4 = 0; __pyx_t_4 < __pyx_t_3; __pyx_t_4+=1) { + __pyx_v_i = __pyx_t_4; + + /* "View.MemoryView":260 + * p = self.data + * for i in range(self.len // self.itemsize): + * p[i] = Py_None # <<<<<<<<<<<<<< + * Py_INCREF(Py_None) + * return 0 +*/ + (__pyx_v_p[__pyx_v_i]) = Py_None; + + /* "View.MemoryView":261 + * for i in range(self.len // self.itemsize): + * p[i] = Py_None + * Py_INCREF(Py_None) # <<<<<<<<<<<<<< + * return 0 + * +*/ + Py_INCREF(Py_None); + } + + /* "View.MemoryView":257 + * raise MemoryError, "unable to allocate array data." + * + * if self.dtype_is_object: # <<<<<<<<<<<<<< + * p = self.data + * for i in range(self.len // self.itemsize): +*/ + } + + /* "View.MemoryView":262 + * p[i] = Py_None + * Py_INCREF(Py_None) + * return 0 # <<<<<<<<<<<<<< + * + * +*/ + __pyx_r = 0; + goto __pyx_L0; + + /* "View.MemoryView":245 + * pass + * + * @cname("__pyx_array_allocate_buffer") # <<<<<<<<<<<<<< + * cdef int _allocate_buffer(array self) except -1: + * +*/ + + /* function exit code */ + __pyx_L1_error:; + __Pyx_AddTraceback("View.MemoryView._allocate_buffer", __pyx_clineno, __pyx_lineno, __pyx_filename); + __pyx_r = -1; + __pyx_L0:; + return __pyx_r; +} + +/* "View.MemoryView":265 + * + * + * @cname("__pyx_array_new") # <<<<<<<<<<<<<< + * cdef array array_cwrapper(tuple shape, Py_ssize_t itemsize, char *format, const char *c_mode, char *buf): + * cdef array result +*/ + +static struct __pyx_array_obj *__pyx_array_new(PyObject *__pyx_v_shape, Py_ssize_t __pyx_v_itemsize, char *__pyx_v_format, char const *__pyx_v_c_mode, char *__pyx_v_buf) { + struct __pyx_array_obj *__pyx_v_result = 0; + PyObject *__pyx_v_mode = 0; + struct __pyx_array_obj *__pyx_r = NULL; + __Pyx_RefNannyDeclarations + PyObject *__pyx_t_1 = NULL; + int __pyx_t_2; + PyObject *__pyx_t_3 = NULL; + PyObject *__pyx_t_4 = NULL; + int __pyx_lineno = 0; + const char *__pyx_filename = NULL; + int __pyx_clineno = 0; + __Pyx_RefNannySetupContext("array_cwrapper", 0); + + /* "View.MemoryView":268 + * cdef array array_cwrapper(tuple shape, Py_ssize_t itemsize, char *format, const char *c_mode, char *buf): + * cdef array result + * cdef str mode = "fortran" if c_mode[0] == b'f' else "c" # this often comes from a constant C string. # <<<<<<<<<<<<<< + * + * if buf is NULL: +*/ + __pyx_t_2 = ((__pyx_v_c_mode[0]) == 'f'); + if (__pyx_t_2) { + __Pyx_INCREF(__pyx_mstate_global->__pyx_n_u_fortran); + __pyx_t_1 = __pyx_mstate_global->__pyx_n_u_fortran; + } else { + __Pyx_INCREF(__pyx_mstate_global->__pyx_n_u_c); + __pyx_t_1 = __pyx_mstate_global->__pyx_n_u_c; + } + __pyx_v_mode = ((PyObject*)__pyx_t_1); + __pyx_t_1 = 0; + + /* "View.MemoryView":270 + * cdef str mode = "fortran" if c_mode[0] == b'f' else "c" # this often comes from a constant C string. + * + * if buf is NULL: # <<<<<<<<<<<<<< + * result = array.__new__(array, shape, itemsize, format, mode) + * else: +*/ + __pyx_t_2 = (__pyx_v_buf == NULL); + if (__pyx_t_2) { + + /* "View.MemoryView":271 + * + * if buf is NULL: + * result = array.__new__(array, shape, itemsize, format, mode) # <<<<<<<<<<<<<< + * else: + * result = array.__new__(array, shape, itemsize, format, mode, allocate_buffer=False) +*/ + __pyx_t_1 = PyLong_FromSsize_t(__pyx_v_itemsize); if (unlikely(!__pyx_t_1)) __PYX_ERR(1, 271, __pyx_L1_error) + __Pyx_GOTREF(__pyx_t_1); + __pyx_t_3 = __Pyx_PyBytes_FromString(__pyx_v_format); if (unlikely(!__pyx_t_3)) __PYX_ERR(1, 271, __pyx_L1_error) + __Pyx_GOTREF(__pyx_t_3); + __pyx_t_4 = PyTuple_New(4); if (unlikely(!__pyx_t_4)) __PYX_ERR(1, 271, __pyx_L1_error) + __Pyx_GOTREF(__pyx_t_4); + __Pyx_INCREF(__pyx_v_shape); + __Pyx_GIVEREF(__pyx_v_shape); + if (__Pyx_PyTuple_SET_ITEM(__pyx_t_4, 0, __pyx_v_shape) != (0)) __PYX_ERR(1, 271, __pyx_L1_error); + __Pyx_GIVEREF(__pyx_t_1); + if (__Pyx_PyTuple_SET_ITEM(__pyx_t_4, 1, __pyx_t_1) != (0)) __PYX_ERR(1, 271, __pyx_L1_error); + __Pyx_GIVEREF(__pyx_t_3); + if (__Pyx_PyTuple_SET_ITEM(__pyx_t_4, 2, __pyx_t_3) != (0)) __PYX_ERR(1, 271, __pyx_L1_error); + __Pyx_INCREF(__pyx_v_mode); + __Pyx_GIVEREF(__pyx_v_mode); + if (__Pyx_PyTuple_SET_ITEM(__pyx_t_4, 3, __pyx_v_mode) != (0)) __PYX_ERR(1, 271, __pyx_L1_error); + __pyx_t_1 = 0; + __pyx_t_3 = 0; + __pyx_t_3 = ((PyObject *)__pyx_tp_new_array(((PyTypeObject *)__pyx_mstate_global->__pyx_array_type), __pyx_t_4, NULL)); if (unlikely(!__pyx_t_3)) __PYX_ERR(1, 271, __pyx_L1_error) + __Pyx_GOTREF((PyObject *)__pyx_t_3); + __Pyx_DECREF(__pyx_t_4); __pyx_t_4 = 0; + __pyx_v_result = ((struct __pyx_array_obj *)__pyx_t_3); + __pyx_t_3 = 0; + + /* "View.MemoryView":270 + * cdef str mode = "fortran" if c_mode[0] == b'f' else "c" # this often comes from a constant C string. + * + * if buf is NULL: # <<<<<<<<<<<<<< + * result = array.__new__(array, shape, itemsize, format, mode) + * else: +*/ + goto __pyx_L3; + } + + /* "View.MemoryView":273 + * result = array.__new__(array, shape, itemsize, format, mode) + * else: + * result = array.__new__(array, shape, itemsize, format, mode, allocate_buffer=False) # <<<<<<<<<<<<<< + * result.data = buf + * +*/ + /*else*/ { + __pyx_t_3 = PyLong_FromSsize_t(__pyx_v_itemsize); if (unlikely(!__pyx_t_3)) __PYX_ERR(1, 273, __pyx_L1_error) + __Pyx_GOTREF(__pyx_t_3); + __pyx_t_4 = __Pyx_PyBytes_FromString(__pyx_v_format); if (unlikely(!__pyx_t_4)) __PYX_ERR(1, 273, __pyx_L1_error) + __Pyx_GOTREF(__pyx_t_4); + __pyx_t_1 = PyTuple_New(4); if (unlikely(!__pyx_t_1)) __PYX_ERR(1, 273, __pyx_L1_error) + __Pyx_GOTREF(__pyx_t_1); + __Pyx_INCREF(__pyx_v_shape); + __Pyx_GIVEREF(__pyx_v_shape); + if (__Pyx_PyTuple_SET_ITEM(__pyx_t_1, 0, __pyx_v_shape) != (0)) __PYX_ERR(1, 273, __pyx_L1_error); + __Pyx_GIVEREF(__pyx_t_3); + if (__Pyx_PyTuple_SET_ITEM(__pyx_t_1, 1, __pyx_t_3) != (0)) __PYX_ERR(1, 273, __pyx_L1_error); + __Pyx_GIVEREF(__pyx_t_4); + if (__Pyx_PyTuple_SET_ITEM(__pyx_t_1, 2, __pyx_t_4) != (0)) __PYX_ERR(1, 273, __pyx_L1_error); + __Pyx_INCREF(__pyx_v_mode); + __Pyx_GIVEREF(__pyx_v_mode); + if (__Pyx_PyTuple_SET_ITEM(__pyx_t_1, 3, __pyx_v_mode) != (0)) __PYX_ERR(1, 273, __pyx_L1_error); + __pyx_t_3 = 0; + __pyx_t_4 = 0; + __pyx_t_4 = __Pyx_PyDict_NewPresized(1); if (unlikely(!__pyx_t_4)) __PYX_ERR(1, 273, __pyx_L1_error) + __Pyx_GOTREF(__pyx_t_4); + if (PyDict_SetItem(__pyx_t_4, __pyx_mstate_global->__pyx_n_u_allocate_buffer, Py_False) < (0)) __PYX_ERR(1, 273, __pyx_L1_error) + __pyx_t_3 = ((PyObject *)__pyx_tp_new_array(((PyTypeObject *)__pyx_mstate_global->__pyx_array_type), __pyx_t_1, __pyx_t_4)); if (unlikely(!__pyx_t_3)) __PYX_ERR(1, 273, __pyx_L1_error) + __Pyx_GOTREF((PyObject *)__pyx_t_3); + __Pyx_DECREF(__pyx_t_1); __pyx_t_1 = 0; + __Pyx_DECREF(__pyx_t_4); __pyx_t_4 = 0; + __pyx_v_result = ((struct __pyx_array_obj *)__pyx_t_3); + __pyx_t_3 = 0; + + /* "View.MemoryView":274 + * else: + * result = array.__new__(array, shape, itemsize, format, mode, allocate_buffer=False) + * result.data = buf # <<<<<<<<<<<<<< + * + * return result +*/ + __pyx_v_result->data = __pyx_v_buf; + } + __pyx_L3:; + + /* "View.MemoryView":276 + * result.data = buf + * + * return result # <<<<<<<<<<<<<< + * + * +*/ + __Pyx_XDECREF((PyObject *)__pyx_r); + __Pyx_INCREF((PyObject *)__pyx_v_result); + __pyx_r = __pyx_v_result; + goto __pyx_L0; + + /* "View.MemoryView":265 + * + * + * @cname("__pyx_array_new") # <<<<<<<<<<<<<< + * cdef array array_cwrapper(tuple shape, Py_ssize_t itemsize, char *format, const char *c_mode, char *buf): + * cdef array result +*/ + + /* function exit code */ + __pyx_L1_error:; + __Pyx_XDECREF(__pyx_t_1); + __Pyx_XDECREF(__pyx_t_3); + __Pyx_XDECREF(__pyx_t_4); + __Pyx_AddTraceback("View.MemoryView.array_cwrapper", __pyx_clineno, __pyx_lineno, __pyx_filename); + __pyx_r = 0; + __pyx_L0:; + __Pyx_XDECREF((PyObject *)__pyx_v_result); + __Pyx_XDECREF(__pyx_v_mode); + __Pyx_XGIVEREF((PyObject *)__pyx_r); + __Pyx_RefNannyFinishContext(); + return __pyx_r; +} + +/* "View.MemoryView":302 + * cdef class Enum(object): + * cdef object name + * def __init__(self, name): # <<<<<<<<<<<<<< + * self.name = name + * def __repr__(self): +*/ + +/* Python wrapper */ +static int __pyx_MemviewEnum___init__(PyObject *__pyx_v_self, PyObject *__pyx_args, PyObject *__pyx_kwds); /*proto*/ +static int __pyx_MemviewEnum___init__(PyObject *__pyx_v_self, PyObject *__pyx_args, PyObject *__pyx_kwds) { + PyObject *__pyx_v_name = 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_name,0}; + const Py_ssize_t __pyx_kwds_len = (__pyx_kwds) ? __Pyx_NumKwargs_VARARGS(__pyx_kwds) : 0; + if (unlikely(__pyx_kwds_len) < 0) __PYX_ERR(1, 302, __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(1, 302, __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(1, 302, __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(1, 302, __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(1, 302, __pyx_L3_error) + } + __pyx_v_name = values[0]; + } + goto __pyx_L6_skip; + __pyx_L5_argtuple_error:; + __Pyx_RaiseArgtupleInvalid("__init__", 1, 1, 1, __pyx_nargs); __PYX_ERR(1, 302, __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("View.MemoryView.Enum.__init__", __pyx_clineno, __pyx_lineno, __pyx_filename); + __Pyx_RefNannyFinishContext(); + return -1; + __pyx_L4_argument_unpacking_done:; + __pyx_r = __pyx_MemviewEnum___pyx_pf_15View_dot_MemoryView_4Enum___init__(((struct __pyx_MemviewEnum_obj *)__pyx_v_self), __pyx_v_name); + + /* 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_MemviewEnum___pyx_pf_15View_dot_MemoryView_4Enum___init__(struct __pyx_MemviewEnum_obj *__pyx_v_self, PyObject *__pyx_v_name) { + int __pyx_r; + __Pyx_RefNannyDeclarations + __Pyx_RefNannySetupContext("__init__", 0); + + /* "View.MemoryView":303 + * cdef object name + * def __init__(self, name): + * self.name = name # <<<<<<<<<<<<<< + * def __repr__(self): + * return self.name +*/ + __Pyx_INCREF(__pyx_v_name); + __Pyx_GIVEREF(__pyx_v_name); + __Pyx_GOTREF(__pyx_v_self->name); + __Pyx_DECREF(__pyx_v_self->name); + __pyx_v_self->name = __pyx_v_name; + + /* "View.MemoryView":302 + * cdef class Enum(object): + * cdef object name + * def __init__(self, name): # <<<<<<<<<<<<<< + * self.name = name + * def __repr__(self): +*/ + + /* function exit code */ + __pyx_r = 0; + __Pyx_RefNannyFinishContext(); + return __pyx_r; +} + +/* "View.MemoryView":304 + * def __init__(self, name): + * self.name = name + * def __repr__(self): # <<<<<<<<<<<<<< + * return self.name + * +*/ + +/* Python wrapper */ +static PyObject *__pyx_MemviewEnum___repr__(PyObject *__pyx_v_self); /*proto*/ +static PyObject *__pyx_MemviewEnum___repr__(PyObject *__pyx_v_self) { + CYTHON_UNUSED PyObject *const *__pyx_kwvalues; + PyObject *__pyx_r = 0; + __Pyx_RefNannyDeclarations + __Pyx_RefNannySetupContext("__repr__ (wrapper)", 0); + __pyx_kwvalues = __Pyx_KwValues_VARARGS(__pyx_args, __pyx_nargs); + __pyx_r = __pyx_MemviewEnum___pyx_pf_15View_dot_MemoryView_4Enum_2__repr__(((struct __pyx_MemviewEnum_obj *)__pyx_v_self)); + + /* function exit code */ + __Pyx_RefNannyFinishContext(); + return __pyx_r; +} + +static PyObject *__pyx_MemviewEnum___pyx_pf_15View_dot_MemoryView_4Enum_2__repr__(struct __pyx_MemviewEnum_obj *__pyx_v_self) { + PyObject *__pyx_r = NULL; + __Pyx_RefNannyDeclarations + __Pyx_RefNannySetupContext("__repr__", 0); + + /* "View.MemoryView":305 + * self.name = name + * def __repr__(self): + * return self.name # <<<<<<<<<<<<<< + * + * cdef generic = Enum("") +*/ + __Pyx_XDECREF(__pyx_r); + __Pyx_INCREF(__pyx_v_self->name); + __pyx_r = __pyx_v_self->name; + goto __pyx_L0; + + /* "View.MemoryView":304 + * def __init__(self, name): + * self.name = name + * def __repr__(self): # <<<<<<<<<<<<<< + * return self.name + * +*/ + + /* function exit code */ + __pyx_L0:; + __Pyx_XGIVEREF(__pyx_r); + __Pyx_RefNannyFinishContext(); + return __pyx_r; +} + +/* "(tree fragment)":1 + * def __reduce_cython__(self): # <<<<<<<<<<<<<< + * cdef tuple state + * cdef object _dict +*/ + +/* Python wrapper */ +static PyObject *__pyx_pw___pyx_MemviewEnum_1__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*/ +static PyObject *__pyx_pw___pyx_MemviewEnum_1__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___pyx_MemviewEnum___reduce_cython__(((struct __pyx_MemviewEnum_obj *)__pyx_v_self)); + + /* function exit code */ + __Pyx_RefNannyFinishContext(); + return __pyx_r; +} + +static PyObject *__pyx_pf___pyx_MemviewEnum___reduce_cython__(struct __pyx_MemviewEnum_obj *__pyx_v_self) { + PyObject *__pyx_v_state = 0; + PyObject *__pyx_v__dict = 0; + int __pyx_v_use_setstate; + PyObject *__pyx_r = NULL; + __Pyx_RefNannyDeclarations + PyObject *__pyx_t_1 = NULL; + int __pyx_t_2; + int __pyx_t_3; + PyObject *__pyx_t_4 = NULL; + PyObject *__pyx_t_5 = NULL; + int __pyx_lineno = 0; + const char *__pyx_filename = NULL; + int __pyx_clineno = 0; + __Pyx_RefNannySetupContext("__reduce_cython__", 0); + + /* "(tree fragment)":5 + * cdef object _dict + * cdef bint use_setstate + * state = (self.name,) # <<<<<<<<<<<<<< + * _dict = getattr(self, '__dict__', None) + * if _dict is not None and _dict: +*/ + __pyx_t_1 = PyTuple_New(1); if (unlikely(!__pyx_t_1)) __PYX_ERR(1, 5, __pyx_L1_error) + __Pyx_GOTREF(__pyx_t_1); + __Pyx_INCREF(__pyx_v_self->name); + __Pyx_GIVEREF(__pyx_v_self->name); + if (__Pyx_PyTuple_SET_ITEM(__pyx_t_1, 0, __pyx_v_self->name) != (0)) __PYX_ERR(1, 5, __pyx_L1_error); + __pyx_v_state = ((PyObject*)__pyx_t_1); + __pyx_t_1 = 0; + + /* "(tree fragment)":6 + * cdef bint use_setstate + * state = (self.name,) + * _dict = getattr(self, '__dict__', None) # <<<<<<<<<<<<<< + * if _dict is not None and _dict: + * state += (_dict,) +*/ + __pyx_t_1 = __Pyx_GetAttr3(((PyObject *)__pyx_v_self), __pyx_mstate_global->__pyx_n_u_dict, Py_None); if (unlikely(!__pyx_t_1)) __PYX_ERR(1, 6, __pyx_L1_error) + __Pyx_GOTREF(__pyx_t_1); + __pyx_v__dict = __pyx_t_1; + __pyx_t_1 = 0; + + /* "(tree fragment)":7 + * state = (self.name,) + * _dict = getattr(self, '__dict__', None) + * if _dict is not None and _dict: # <<<<<<<<<<<<<< + * state += (_dict,) + * use_setstate = True +*/ + __pyx_t_3 = (__pyx_v__dict != Py_None); + if (__pyx_t_3) { + } else { + __pyx_t_2 = __pyx_t_3; + goto __pyx_L4_bool_binop_done; + } + __pyx_t_3 = __Pyx_PyObject_IsTrue(__pyx_v__dict); if (unlikely((__pyx_t_3 < 0))) __PYX_ERR(1, 7, __pyx_L1_error) + __pyx_t_2 = __pyx_t_3; + __pyx_L4_bool_binop_done:; + if (__pyx_t_2) { + + /* "(tree fragment)":8 + * _dict = getattr(self, '__dict__', None) + * if _dict is not None and _dict: + * state += (_dict,) # <<<<<<<<<<<<<< + * use_setstate = True + * else: +*/ + __pyx_t_1 = PyTuple_New(1); if (unlikely(!__pyx_t_1)) __PYX_ERR(1, 8, __pyx_L1_error) + __Pyx_GOTREF(__pyx_t_1); + __Pyx_INCREF(__pyx_v__dict); + __Pyx_GIVEREF(__pyx_v__dict); + if (__Pyx_PyTuple_SET_ITEM(__pyx_t_1, 0, __pyx_v__dict) != (0)) __PYX_ERR(1, 8, __pyx_L1_error); + __pyx_t_4 = PyNumber_InPlaceAdd(__pyx_v_state, __pyx_t_1); if (unlikely(!__pyx_t_4)) __PYX_ERR(1, 8, __pyx_L1_error) + __Pyx_GOTREF(__pyx_t_4); + __Pyx_DECREF(__pyx_t_1); __pyx_t_1 = 0; + __Pyx_DECREF_SET(__pyx_v_state, ((PyObject*)__pyx_t_4)); + __pyx_t_4 = 0; + + /* "(tree fragment)":9 + * if _dict is not None and _dict: + * state += (_dict,) + * use_setstate = True # <<<<<<<<<<<<<< + * else: + * use_setstate = ('self.name is not None',) +*/ + __pyx_v_use_setstate = 1; + + /* "(tree fragment)":7 + * state = (self.name,) + * _dict = getattr(self, '__dict__', None) + * if _dict is not None and _dict: # <<<<<<<<<<<<<< + * state += (_dict,) + * use_setstate = True +*/ + goto __pyx_L3; + } + + /* "(tree fragment)":11 + * use_setstate = True + * else: + * use_setstate = ('self.name is not None',) # <<<<<<<<<<<<<< + * if use_setstate: + * return __pyx_unpickle_Enum, (type(self), 0x82a3537, None), state +*/ + /*else*/ { + __pyx_t_2 = __Pyx_PyObject_IsTrue(__pyx_mstate_global->__pyx_tuple[0]); if (unlikely((__pyx_t_2 == (int)-1) && PyErr_Occurred())) __PYX_ERR(1, 11, __pyx_L1_error) + __pyx_v_use_setstate = __pyx_t_2; + } + __pyx_L3:; + + /* "(tree fragment)":12 + * else: + * use_setstate = ('self.name is not None',) + * if use_setstate: # <<<<<<<<<<<<<< + * return __pyx_unpickle_Enum, (type(self), 0x82a3537, None), state + * else: +*/ + if (__pyx_v_use_setstate) { + + /* "(tree fragment)":13 + * use_setstate = ('self.name is not None',) + * if use_setstate: + * return __pyx_unpickle_Enum, (type(self), 0x82a3537, None), state # <<<<<<<<<<<<<< + * else: + * return __pyx_unpickle_Enum, (type(self), 0x82a3537, state) +*/ + __Pyx_XDECREF(__pyx_r); + __Pyx_GetModuleGlobalName(__pyx_t_4, __pyx_mstate_global->__pyx_n_u_pyx_unpickle_Enum); if (unlikely(!__pyx_t_4)) __PYX_ERR(1, 13, __pyx_L1_error) + __Pyx_GOTREF(__pyx_t_4); + __pyx_t_1 = PyTuple_New(3); if (unlikely(!__pyx_t_1)) __PYX_ERR(1, 13, __pyx_L1_error) + __Pyx_GOTREF(__pyx_t_1); + __Pyx_INCREF(((PyObject *)Py_TYPE(((PyObject *)__pyx_v_self)))); + __Pyx_GIVEREF(((PyObject *)Py_TYPE(((PyObject *)__pyx_v_self)))); + if (__Pyx_PyTuple_SET_ITEM(__pyx_t_1, 0, ((PyObject *)Py_TYPE(((PyObject *)__pyx_v_self)))) != (0)) __PYX_ERR(1, 13, __pyx_L1_error); + __Pyx_INCREF(__pyx_mstate_global->__pyx_int_136983863); + __Pyx_GIVEREF(__pyx_mstate_global->__pyx_int_136983863); + if (__Pyx_PyTuple_SET_ITEM(__pyx_t_1, 1, __pyx_mstate_global->__pyx_int_136983863) != (0)) __PYX_ERR(1, 13, __pyx_L1_error); + __Pyx_INCREF(Py_None); + __Pyx_GIVEREF(Py_None); + if (__Pyx_PyTuple_SET_ITEM(__pyx_t_1, 2, Py_None) != (0)) __PYX_ERR(1, 13, __pyx_L1_error); + __pyx_t_5 = PyTuple_New(3); if (unlikely(!__pyx_t_5)) __PYX_ERR(1, 13, __pyx_L1_error) + __Pyx_GOTREF(__pyx_t_5); + __Pyx_GIVEREF(__pyx_t_4); + if (__Pyx_PyTuple_SET_ITEM(__pyx_t_5, 0, __pyx_t_4) != (0)) __PYX_ERR(1, 13, __pyx_L1_error); + __Pyx_GIVEREF(__pyx_t_1); + if (__Pyx_PyTuple_SET_ITEM(__pyx_t_5, 1, __pyx_t_1) != (0)) __PYX_ERR(1, 13, __pyx_L1_error); + __Pyx_INCREF(__pyx_v_state); + __Pyx_GIVEREF(__pyx_v_state); + if (__Pyx_PyTuple_SET_ITEM(__pyx_t_5, 2, __pyx_v_state) != (0)) __PYX_ERR(1, 13, __pyx_L1_error); + __pyx_t_4 = 0; + __pyx_t_1 = 0; + __pyx_r = __pyx_t_5; + __pyx_t_5 = 0; + goto __pyx_L0; + + /* "(tree fragment)":12 + * else: + * use_setstate = ('self.name is not None',) + * if use_setstate: # <<<<<<<<<<<<<< + * return __pyx_unpickle_Enum, (type(self), 0x82a3537, None), state + * else: +*/ + } + + /* "(tree fragment)":15 + * return __pyx_unpickle_Enum, (type(self), 0x82a3537, None), state + * else: + * return __pyx_unpickle_Enum, (type(self), 0x82a3537, state) # <<<<<<<<<<<<<< + * def __setstate_cython__(self, __pyx_state): + * __pyx_unpickle_Enum__set_state(self, __pyx_state) +*/ + /*else*/ { + __Pyx_XDECREF(__pyx_r); + __Pyx_GetModuleGlobalName(__pyx_t_5, __pyx_mstate_global->__pyx_n_u_pyx_unpickle_Enum); if (unlikely(!__pyx_t_5)) __PYX_ERR(1, 15, __pyx_L1_error) + __Pyx_GOTREF(__pyx_t_5); + __pyx_t_1 = PyTuple_New(3); if (unlikely(!__pyx_t_1)) __PYX_ERR(1, 15, __pyx_L1_error) + __Pyx_GOTREF(__pyx_t_1); + __Pyx_INCREF(((PyObject *)Py_TYPE(((PyObject *)__pyx_v_self)))); + __Pyx_GIVEREF(((PyObject *)Py_TYPE(((PyObject *)__pyx_v_self)))); + if (__Pyx_PyTuple_SET_ITEM(__pyx_t_1, 0, ((PyObject *)Py_TYPE(((PyObject *)__pyx_v_self)))) != (0)) __PYX_ERR(1, 15, __pyx_L1_error); + __Pyx_INCREF(__pyx_mstate_global->__pyx_int_136983863); + __Pyx_GIVEREF(__pyx_mstate_global->__pyx_int_136983863); + if (__Pyx_PyTuple_SET_ITEM(__pyx_t_1, 1, __pyx_mstate_global->__pyx_int_136983863) != (0)) __PYX_ERR(1, 15, __pyx_L1_error); + __Pyx_INCREF(__pyx_v_state); + __Pyx_GIVEREF(__pyx_v_state); + if (__Pyx_PyTuple_SET_ITEM(__pyx_t_1, 2, __pyx_v_state) != (0)) __PYX_ERR(1, 15, __pyx_L1_error); + __pyx_t_4 = PyTuple_New(2); if (unlikely(!__pyx_t_4)) __PYX_ERR(1, 15, __pyx_L1_error) + __Pyx_GOTREF(__pyx_t_4); + __Pyx_GIVEREF(__pyx_t_5); + if (__Pyx_PyTuple_SET_ITEM(__pyx_t_4, 0, __pyx_t_5) != (0)) __PYX_ERR(1, 15, __pyx_L1_error); + __Pyx_GIVEREF(__pyx_t_1); + if (__Pyx_PyTuple_SET_ITEM(__pyx_t_4, 1, __pyx_t_1) != (0)) __PYX_ERR(1, 15, __pyx_L1_error); + __pyx_t_5 = 0; + __pyx_t_1 = 0; + __pyx_r = __pyx_t_4; + __pyx_t_4 = 0; + goto __pyx_L0; + } + + /* "(tree fragment)":1 + * def __reduce_cython__(self): # <<<<<<<<<<<<<< + * cdef tuple state + * cdef object _dict +*/ + + /* function exit code */ + __pyx_L1_error:; + __Pyx_XDECREF(__pyx_t_1); + __Pyx_XDECREF(__pyx_t_4); + __Pyx_XDECREF(__pyx_t_5); + __Pyx_AddTraceback("View.MemoryView.Enum.__reduce_cython__", __pyx_clineno, __pyx_lineno, __pyx_filename); + __pyx_r = NULL; + __pyx_L0:; + __Pyx_XDECREF(__pyx_v_state); + __Pyx_XDECREF(__pyx_v__dict); + __Pyx_XGIVEREF(__pyx_r); + __Pyx_RefNannyFinishContext(); + return __pyx_r; +} + +/* "(tree fragment)":16 + * else: + * return __pyx_unpickle_Enum, (type(self), 0x82a3537, state) + * def __setstate_cython__(self, __pyx_state): # <<<<<<<<<<<<<< + * __pyx_unpickle_Enum__set_state(self, __pyx_state) +*/ + +/* Python wrapper */ +static PyObject *__pyx_pw___pyx_MemviewEnum_3__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*/ +static PyObject *__pyx_pw___pyx_MemviewEnum_3__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 +) { + 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, 16, __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, 16, __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, 16, __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, 16, __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, 16, __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, 16, __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("View.MemoryView.Enum.__setstate_cython__", __pyx_clineno, __pyx_lineno, __pyx_filename); + __Pyx_RefNannyFinishContext(); + return NULL; + __pyx_L4_argument_unpacking_done:; + __pyx_r = __pyx_pf___pyx_MemviewEnum_2__setstate_cython__(((struct __pyx_MemviewEnum_obj *)__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___pyx_MemviewEnum_2__setstate_cython__(struct __pyx_MemviewEnum_obj *__pyx_v_self, PyObject *__pyx_v___pyx_state) { + PyObject *__pyx_r = NULL; + __Pyx_RefNannyDeclarations + PyObject *__pyx_t_1 = NULL; + PyObject *__pyx_t_2 = NULL; + int __pyx_lineno = 0; + const char *__pyx_filename = NULL; + int __pyx_clineno = 0; + __Pyx_RefNannySetupContext("__setstate_cython__", 0); + + /* "(tree fragment)":17 + * return __pyx_unpickle_Enum, (type(self), 0x82a3537, state) + * def __setstate_cython__(self, __pyx_state): + * __pyx_unpickle_Enum__set_state(self, __pyx_state) # <<<<<<<<<<<<<< +*/ + __pyx_t_1 = __pyx_v___pyx_state; + __Pyx_INCREF(__pyx_t_1); + if (!(likely(PyTuple_CheckExact(__pyx_t_1))||((__pyx_t_1) == Py_None) || __Pyx_RaiseUnexpectedTypeError("tuple", __pyx_t_1))) __PYX_ERR(1, 17, __pyx_L1_error) + if (unlikely(__pyx_t_1 == Py_None)) { + PyErr_SetString(PyExc_TypeError, "cannot pass None into a C function argument that is declared 'not None'"); + __PYX_ERR(1, 17, __pyx_L1_error) + } + __pyx_t_2 = __pyx_unpickle_Enum__set_state(__pyx_v_self, ((PyObject*)__pyx_t_1)); if (unlikely(!__pyx_t_2)) __PYX_ERR(1, 17, __pyx_L1_error) + __Pyx_GOTREF(__pyx_t_2); + __Pyx_DECREF(__pyx_t_1); __pyx_t_1 = 0; + __Pyx_DECREF(__pyx_t_2); __pyx_t_2 = 0; + + /* "(tree fragment)":16 + * else: + * return __pyx_unpickle_Enum, (type(self), 0x82a3537, state) + * def __setstate_cython__(self, __pyx_state): # <<<<<<<<<<<<<< + * __pyx_unpickle_Enum__set_state(self, __pyx_state) +*/ + + /* 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("View.MemoryView.Enum.__setstate_cython__", __pyx_clineno, __pyx_lineno, __pyx_filename); + __pyx_r = NULL; + __pyx_L0:; + __Pyx_XGIVEREF(__pyx_r); + __Pyx_RefNannyFinishContext(); + return __pyx_r; +} + +/* "View.MemoryView":348 + * cdef const __Pyx_TypeInfo *typeinfo + * + * def __cinit__(memoryview self, object obj, int flags, bint dtype_is_object=False): # <<<<<<<<<<<<<< + * self.obj = obj + * self.flags = flags +*/ + +/* Python wrapper */ +static int __pyx_memoryview___cinit__(PyObject *__pyx_v_self, PyObject *__pyx_args, PyObject *__pyx_kwds); /*proto*/ +static int __pyx_memoryview___cinit__(PyObject *__pyx_v_self, PyObject *__pyx_args, PyObject *__pyx_kwds) { + PyObject *__pyx_v_obj = 0; + int __pyx_v_flags; + int __pyx_v_dtype_is_object; + CYTHON_UNUSED Py_ssize_t __pyx_nargs; + 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; + 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_obj,&__pyx_mstate_global->__pyx_n_u_flags,&__pyx_mstate_global->__pyx_n_u_dtype_is_object,0}; + const Py_ssize_t __pyx_kwds_len = (__pyx_kwds) ? __Pyx_NumKwargs_VARARGS(__pyx_kwds) : 0; + if (unlikely(__pyx_kwds_len) < 0) __PYX_ERR(1, 348, __pyx_L3_error) + if (__pyx_kwds_len > 0) { + switch (__pyx_nargs) { + case 3: + values[2] = __Pyx_ArgRef_VARARGS(__pyx_args, 2); + if (!CYTHON_ASSUME_SAFE_MACROS && unlikely(!values[2])) __PYX_ERR(1, 348, __pyx_L3_error) + CYTHON_FALLTHROUGH; + case 2: + values[1] = __Pyx_ArgRef_VARARGS(__pyx_args, 1); + if (!CYTHON_ASSUME_SAFE_MACROS && unlikely(!values[1])) __PYX_ERR(1, 348, __pyx_L3_error) + CYTHON_FALLTHROUGH; + case 1: + values[0] = __Pyx_ArgRef_VARARGS(__pyx_args, 0); + if (!CYTHON_ASSUME_SAFE_MACROS && unlikely(!values[0])) __PYX_ERR(1, 348, __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(1, 348, __pyx_L3_error) + for (Py_ssize_t i = __pyx_nargs; i < 2; i++) { + if (unlikely(!values[i])) { __Pyx_RaiseArgtupleInvalid("__cinit__", 0, 2, 3, i); __PYX_ERR(1, 348, __pyx_L3_error) } + } + } else { + switch (__pyx_nargs) { + case 3: + values[2] = __Pyx_ArgRef_VARARGS(__pyx_args, 2); + if (!CYTHON_ASSUME_SAFE_MACROS && unlikely(!values[2])) __PYX_ERR(1, 348, __pyx_L3_error) + CYTHON_FALLTHROUGH; + case 2: + values[1] = __Pyx_ArgRef_VARARGS(__pyx_args, 1); + if (!CYTHON_ASSUME_SAFE_MACROS && unlikely(!values[1])) __PYX_ERR(1, 348, __pyx_L3_error) + values[0] = __Pyx_ArgRef_VARARGS(__pyx_args, 0); + if (!CYTHON_ASSUME_SAFE_MACROS && unlikely(!values[0])) __PYX_ERR(1, 348, __pyx_L3_error) + break; + default: goto __pyx_L5_argtuple_error; + } + } + __pyx_v_obj = values[0]; + __pyx_v_flags = __Pyx_PyLong_As_int(values[1]); if (unlikely((__pyx_v_flags == (int)-1) && PyErr_Occurred())) __PYX_ERR(1, 348, __pyx_L3_error) + if (values[2]) { + __pyx_v_dtype_is_object = __Pyx_PyObject_IsTrue(values[2]); if (unlikely((__pyx_v_dtype_is_object == (int)-1) && PyErr_Occurred())) __PYX_ERR(1, 348, __pyx_L3_error) + } else { + __pyx_v_dtype_is_object = ((int)0); + } + } + goto __pyx_L6_skip; + __pyx_L5_argtuple_error:; + __Pyx_RaiseArgtupleInvalid("__cinit__", 0, 2, 3, __pyx_nargs); __PYX_ERR(1, 348, __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("View.MemoryView.memoryview.__cinit__", __pyx_clineno, __pyx_lineno, __pyx_filename); + __Pyx_RefNannyFinishContext(); + return -1; + __pyx_L4_argument_unpacking_done:; + __pyx_r = __pyx_memoryview___pyx_pf_15View_dot_MemoryView_10memoryview___cinit__(((struct __pyx_memoryview_obj *)__pyx_v_self), __pyx_v_obj, __pyx_v_flags, __pyx_v_dtype_is_object); + + /* 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_memoryview___pyx_pf_15View_dot_MemoryView_10memoryview___cinit__(struct __pyx_memoryview_obj *__pyx_v_self, PyObject *__pyx_v_obj, int __pyx_v_flags, int __pyx_v_dtype_is_object) { + int __pyx_r; + __Pyx_RefNannyDeclarations + int __pyx_t_1; + int __pyx_t_2; + int __pyx_t_3; + Py_intptr_t __pyx_t_4; + size_t __pyx_t_5; + int __pyx_lineno = 0; + const char *__pyx_filename = NULL; + int __pyx_clineno = 0; + __Pyx_RefNannySetupContext("__cinit__", 0); + + /* "View.MemoryView":349 + * + * def __cinit__(memoryview self, object obj, int flags, bint dtype_is_object=False): + * self.obj = obj # <<<<<<<<<<<<<< + * self.flags = flags + * if type(self) is memoryview or obj is not None: +*/ + __Pyx_INCREF(__pyx_v_obj); + __Pyx_GIVEREF(__pyx_v_obj); + __Pyx_GOTREF(__pyx_v_self->obj); + __Pyx_DECREF(__pyx_v_self->obj); + __pyx_v_self->obj = __pyx_v_obj; + + /* "View.MemoryView":350 + * def __cinit__(memoryview self, object obj, int flags, bint dtype_is_object=False): + * self.obj = obj + * self.flags = flags # <<<<<<<<<<<<<< + * if type(self) is memoryview or obj is not None: + * PyObject_GetBuffer(obj, &self.view, flags) +*/ + __pyx_v_self->flags = __pyx_v_flags; + + /* "View.MemoryView":351 + * self.obj = obj + * self.flags = flags + * if type(self) is memoryview or obj is not None: # <<<<<<<<<<<<<< + * PyObject_GetBuffer(obj, &self.view, flags) + * if self.view.obj == NULL: +*/ + __pyx_t_2 = (((PyObject *)Py_TYPE(((PyObject *)__pyx_v_self))) == ((PyObject *)__pyx_mstate_global->__pyx_memoryview_type)); + if (!__pyx_t_2) { + } else { + __pyx_t_1 = __pyx_t_2; + goto __pyx_L4_bool_binop_done; + } + __pyx_t_2 = (__pyx_v_obj != Py_None); + __pyx_t_1 = __pyx_t_2; + __pyx_L4_bool_binop_done:; + if (__pyx_t_1) { + + /* "View.MemoryView":352 + * self.flags = flags + * if type(self) is memoryview or obj is not None: + * PyObject_GetBuffer(obj, &self.view, flags) # <<<<<<<<<<<<<< + * if self.view.obj == NULL: + * (<__pyx_buffer *> &self.view).obj = Py_None +*/ + __pyx_t_3 = PyObject_GetBuffer(__pyx_v_obj, (&__pyx_v_self->view), __pyx_v_flags); if (unlikely(__pyx_t_3 == ((int)-1))) __PYX_ERR(1, 352, __pyx_L1_error) + + /* "View.MemoryView":353 + * if type(self) is memoryview or obj is not None: + * PyObject_GetBuffer(obj, &self.view, flags) + * if self.view.obj == NULL: # <<<<<<<<<<<<<< + * (<__pyx_buffer *> &self.view).obj = Py_None + * Py_INCREF(Py_None) +*/ + __pyx_t_1 = (((PyObject *)__pyx_v_self->view.obj) == NULL); + if (__pyx_t_1) { + + /* "View.MemoryView":354 + * PyObject_GetBuffer(obj, &self.view, flags) + * if self.view.obj == NULL: + * (<__pyx_buffer *> &self.view).obj = Py_None # <<<<<<<<<<<<<< + * Py_INCREF(Py_None) + * +*/ + ((Py_buffer *)(&__pyx_v_self->view))->obj = Py_None; + + /* "View.MemoryView":355 + * if self.view.obj == NULL: + * (<__pyx_buffer *> &self.view).obj = Py_None + * Py_INCREF(Py_None) # <<<<<<<<<<<<<< + * + * if not __PYX_CYTHON_ATOMICS_ENABLED(): +*/ + Py_INCREF(Py_None); + + /* "View.MemoryView":353 + * if type(self) is memoryview or obj is not None: + * PyObject_GetBuffer(obj, &self.view, flags) + * if self.view.obj == NULL: # <<<<<<<<<<<<<< + * (<__pyx_buffer *> &self.view).obj = Py_None + * Py_INCREF(Py_None) +*/ + } + + /* "View.MemoryView":351 + * self.obj = obj + * self.flags = flags + * if type(self) is memoryview or obj is not None: # <<<<<<<<<<<<<< + * PyObject_GetBuffer(obj, &self.view, flags) + * if self.view.obj == NULL: +*/ + } + + /* "View.MemoryView":357 + * Py_INCREF(Py_None) + * + * if not __PYX_CYTHON_ATOMICS_ENABLED(): # <<<<<<<<<<<<<< + * global __pyx_memoryview_thread_locks_used + * if (__pyx_memoryview_thread_locks_used < 8 and +*/ + __pyx_t_1 = (!__PYX_CYTHON_ATOMICS_ENABLED()); + if (__pyx_t_1) { + + /* "View.MemoryView":359 + * if not __PYX_CYTHON_ATOMICS_ENABLED(): + * global __pyx_memoryview_thread_locks_used + * if (__pyx_memoryview_thread_locks_used < 8 and # <<<<<<<<<<<<<< + * + * not __PYX_GET_CYTHON_COMPILING_IN_CPYTHON_FREETHREADING()): +*/ + __pyx_t_2 = (__pyx_memoryview_thread_locks_used < 8); + if (__pyx_t_2) { + } else { + __pyx_t_1 = __pyx_t_2; + goto __pyx_L9_bool_binop_done; + } + + /* "View.MemoryView":361 + * if (__pyx_memoryview_thread_locks_used < 8 and + * + * not __PYX_GET_CYTHON_COMPILING_IN_CPYTHON_FREETHREADING()): # <<<<<<<<<<<<<< + * self.lock = __pyx_memoryview_thread_locks[__pyx_memoryview_thread_locks_used] + * __pyx_memoryview_thread_locks_used += 1 +*/ + __pyx_t_2 = (!__PYX_GET_CYTHON_COMPILING_IN_CPYTHON_FREETHREADING()); + __pyx_t_1 = __pyx_t_2; + __pyx_L9_bool_binop_done:; + + /* "View.MemoryView":359 + * if not __PYX_CYTHON_ATOMICS_ENABLED(): + * global __pyx_memoryview_thread_locks_used + * if (__pyx_memoryview_thread_locks_used < 8 and # <<<<<<<<<<<<<< + * + * not __PYX_GET_CYTHON_COMPILING_IN_CPYTHON_FREETHREADING()): +*/ + if (__pyx_t_1) { + + /* "View.MemoryView":362 + * + * not __PYX_GET_CYTHON_COMPILING_IN_CPYTHON_FREETHREADING()): + * self.lock = __pyx_memoryview_thread_locks[__pyx_memoryview_thread_locks_used] # <<<<<<<<<<<<<< + * __pyx_memoryview_thread_locks_used += 1 + * if self.lock is NULL: +*/ + __pyx_v_self->lock = (__pyx_memoryview_thread_locks[__pyx_memoryview_thread_locks_used]); + + /* "View.MemoryView":363 + * not __PYX_GET_CYTHON_COMPILING_IN_CPYTHON_FREETHREADING()): + * self.lock = __pyx_memoryview_thread_locks[__pyx_memoryview_thread_locks_used] + * __pyx_memoryview_thread_locks_used += 1 # <<<<<<<<<<<<<< + * if self.lock is NULL: + * self.lock = PyThread_allocate_lock() +*/ + __pyx_memoryview_thread_locks_used = (__pyx_memoryview_thread_locks_used + 1); + + /* "View.MemoryView":359 + * if not __PYX_CYTHON_ATOMICS_ENABLED(): + * global __pyx_memoryview_thread_locks_used + * if (__pyx_memoryview_thread_locks_used < 8 and # <<<<<<<<<<<<<< + * + * not __PYX_GET_CYTHON_COMPILING_IN_CPYTHON_FREETHREADING()): +*/ + } + + /* "View.MemoryView":364 + * self.lock = __pyx_memoryview_thread_locks[__pyx_memoryview_thread_locks_used] + * __pyx_memoryview_thread_locks_used += 1 + * if self.lock is NULL: # <<<<<<<<<<<<<< + * self.lock = PyThread_allocate_lock() + * if self.lock is NULL: +*/ + __pyx_t_1 = (__pyx_v_self->lock == NULL); + if (__pyx_t_1) { + + /* "View.MemoryView":365 + * __pyx_memoryview_thread_locks_used += 1 + * if self.lock is NULL: + * self.lock = PyThread_allocate_lock() # <<<<<<<<<<<<<< + * if self.lock is NULL: + * raise MemoryError +*/ + __pyx_v_self->lock = PyThread_allocate_lock(); + + /* "View.MemoryView":366 + * if self.lock is NULL: + * self.lock = PyThread_allocate_lock() + * if self.lock is NULL: # <<<<<<<<<<<<<< + * raise MemoryError + * +*/ + __pyx_t_1 = (__pyx_v_self->lock == NULL); + if (unlikely(__pyx_t_1)) { + + /* "View.MemoryView":367 + * self.lock = PyThread_allocate_lock() + * if self.lock is NULL: + * raise MemoryError # <<<<<<<<<<<<<< + * + * if flags & PyBUF_FORMAT: +*/ + PyErr_NoMemory(); __PYX_ERR(1, 367, __pyx_L1_error) + + /* "View.MemoryView":366 + * if self.lock is NULL: + * self.lock = PyThread_allocate_lock() + * if self.lock is NULL: # <<<<<<<<<<<<<< + * raise MemoryError + * +*/ + } + + /* "View.MemoryView":364 + * self.lock = __pyx_memoryview_thread_locks[__pyx_memoryview_thread_locks_used] + * __pyx_memoryview_thread_locks_used += 1 + * if self.lock is NULL: # <<<<<<<<<<<<<< + * self.lock = PyThread_allocate_lock() + * if self.lock is NULL: +*/ + } + + /* "View.MemoryView":357 + * Py_INCREF(Py_None) + * + * if not __PYX_CYTHON_ATOMICS_ENABLED(): # <<<<<<<<<<<<<< + * global __pyx_memoryview_thread_locks_used + * if (__pyx_memoryview_thread_locks_used < 8 and +*/ + } + + /* "View.MemoryView":369 + * raise MemoryError + * + * if flags & PyBUF_FORMAT: # <<<<<<<<<<<<<< + * self.dtype_is_object = (self.view.format[0] == b'O' and self.view.format[1] == b'\0') + * else: +*/ + __pyx_t_1 = ((__pyx_v_flags & PyBUF_FORMAT) != 0); + if (__pyx_t_1) { + + /* "View.MemoryView":370 + * + * if flags & PyBUF_FORMAT: + * self.dtype_is_object = (self.view.format[0] == b'O' and self.view.format[1] == b'\0') # <<<<<<<<<<<<<< + * else: + * self.dtype_is_object = dtype_is_object +*/ + __pyx_t_2 = ((__pyx_v_self->view.format[0]) == 'O'); + if (__pyx_t_2) { + } else { + __pyx_t_1 = __pyx_t_2; + goto __pyx_L14_bool_binop_done; + } + __pyx_t_2 = ((__pyx_v_self->view.format[1]) == '\x00'); + __pyx_t_1 = __pyx_t_2; + __pyx_L14_bool_binop_done:; + __pyx_v_self->dtype_is_object = __pyx_t_1; + + /* "View.MemoryView":369 + * raise MemoryError + * + * if flags & PyBUF_FORMAT: # <<<<<<<<<<<<<< + * self.dtype_is_object = (self.view.format[0] == b'O' and self.view.format[1] == b'\0') + * else: +*/ + goto __pyx_L13; + } + + /* "View.MemoryView":372 + * self.dtype_is_object = (self.view.format[0] == b'O' and self.view.format[1] == b'\0') + * else: + * self.dtype_is_object = dtype_is_object # <<<<<<<<<<<<<< + * + * assert (&self.acquisition_count) % sizeof(__pyx_atomic_int_type) == 0 +*/ + /*else*/ { + __pyx_v_self->dtype_is_object = __pyx_v_dtype_is_object; + } + __pyx_L13:; + + /* "View.MemoryView":374 + * self.dtype_is_object = dtype_is_object + * + * assert (&self.acquisition_count) % sizeof(__pyx_atomic_int_type) == 0 # <<<<<<<<<<<<<< + * self.typeinfo = NULL + * +*/ + #ifndef CYTHON_WITHOUT_ASSERTIONS + if (unlikely(__pyx_assertions_enabled())) { + __pyx_t_4 = ((Py_intptr_t)((void *)(&__pyx_v_self->acquisition_count))); + __pyx_t_5 = (sizeof(__pyx_atomic_int_type)); + if (unlikely(__pyx_t_5 == 0)) { + PyErr_SetString(PyExc_ZeroDivisionError, "integer division or modulo by zero"); + __PYX_ERR(1, 374, __pyx_L1_error) + } + __pyx_t_1 = ((__pyx_t_4 % __pyx_t_5) == 0); + if (unlikely(!__pyx_t_1)) { + __Pyx_Raise(((PyObject *)(((PyTypeObject*)PyExc_AssertionError))), 0, 0, 0); + __PYX_ERR(1, 374, __pyx_L1_error) + } + } + #else + if ((1)); else __PYX_ERR(1, 374, __pyx_L1_error) + #endif + + /* "View.MemoryView":375 + * + * assert (&self.acquisition_count) % sizeof(__pyx_atomic_int_type) == 0 + * self.typeinfo = NULL # <<<<<<<<<<<<<< + * + * def __dealloc__(memoryview self): +*/ + __pyx_v_self->typeinfo = NULL; + + /* "View.MemoryView":348 + * cdef const __Pyx_TypeInfo *typeinfo + * + * def __cinit__(memoryview self, object obj, int flags, bint dtype_is_object=False): # <<<<<<<<<<<<<< + * self.obj = obj + * self.flags = flags +*/ + + /* function exit code */ + __pyx_r = 0; + goto __pyx_L0; + __pyx_L1_error:; + __Pyx_AddTraceback("View.MemoryView.memoryview.__cinit__", __pyx_clineno, __pyx_lineno, __pyx_filename); + __pyx_r = -1; + __pyx_L0:; + __Pyx_RefNannyFinishContext(); + return __pyx_r; +} + +/* "View.MemoryView":377 + * self.typeinfo = NULL + * + * def __dealloc__(memoryview self): # <<<<<<<<<<<<<< + * if self.obj is not None: + * PyBuffer_Release(&self.view) +*/ + +/* Python wrapper */ +static void __pyx_memoryview___dealloc__(PyObject *__pyx_v_self); /*proto*/ +static void __pyx_memoryview___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_memoryview___pyx_pf_15View_dot_MemoryView_10memoryview_2__dealloc__(((struct __pyx_memoryview_obj *)__pyx_v_self)); + + /* function exit code */ + __Pyx_RefNannyFinishContext(); +} + +static void __pyx_memoryview___pyx_pf_15View_dot_MemoryView_10memoryview_2__dealloc__(struct __pyx_memoryview_obj *__pyx_v_self) { + int __pyx_v_i; + int __pyx_t_1; + Py_ssize_t __pyx_t_2; + Py_ssize_t __pyx_t_3; + int __pyx_t_4; + PyThread_type_lock __pyx_t_5; + PyThread_type_lock __pyx_t_6; + + /* "View.MemoryView":378 + * + * def __dealloc__(memoryview self): + * if self.obj is not None: # <<<<<<<<<<<<<< + * PyBuffer_Release(&self.view) + * elif (<__pyx_buffer *> &self.view).obj == Py_None: +*/ + __pyx_t_1 = (__pyx_v_self->obj != Py_None); + if (__pyx_t_1) { + + /* "View.MemoryView":379 + * def __dealloc__(memoryview self): + * if self.obj is not None: + * PyBuffer_Release(&self.view) # <<<<<<<<<<<<<< + * elif (<__pyx_buffer *> &self.view).obj == Py_None: + * +*/ + PyBuffer_Release((&__pyx_v_self->view)); + + /* "View.MemoryView":378 + * + * def __dealloc__(memoryview self): + * if self.obj is not None: # <<<<<<<<<<<<<< + * PyBuffer_Release(&self.view) + * elif (<__pyx_buffer *> &self.view).obj == Py_None: +*/ + goto __pyx_L3; + } + + /* "View.MemoryView":380 + * if self.obj is not None: + * PyBuffer_Release(&self.view) + * elif (<__pyx_buffer *> &self.view).obj == Py_None: # <<<<<<<<<<<<<< + * + * (<__pyx_buffer *> &self.view).obj = NULL +*/ + __pyx_t_1 = (((Py_buffer *)(&__pyx_v_self->view))->obj == Py_None); + if (__pyx_t_1) { + + /* "View.MemoryView":382 + * elif (<__pyx_buffer *> &self.view).obj == Py_None: + * + * (<__pyx_buffer *> &self.view).obj = NULL # <<<<<<<<<<<<<< + * Py_DECREF(Py_None) + * +*/ + ((Py_buffer *)(&__pyx_v_self->view))->obj = NULL; + + /* "View.MemoryView":383 + * + * (<__pyx_buffer *> &self.view).obj = NULL + * Py_DECREF(Py_None) # <<<<<<<<<<<<<< + * + * cdef int i +*/ + Py_DECREF(Py_None); + + /* "View.MemoryView":380 + * if self.obj is not None: + * PyBuffer_Release(&self.view) + * elif (<__pyx_buffer *> &self.view).obj == Py_None: # <<<<<<<<<<<<<< + * + * (<__pyx_buffer *> &self.view).obj = NULL +*/ + } + __pyx_L3:; + + /* "View.MemoryView":387 + * cdef int i + * global __pyx_memoryview_thread_locks_used + * if self.lock != NULL: # <<<<<<<<<<<<<< + * for i in range(0 if __PYX_GET_CYTHON_COMPILING_IN_CPYTHON_FREETHREADING() else __pyx_memoryview_thread_locks_used): + * if __pyx_memoryview_thread_locks[i] is self.lock: +*/ + __pyx_t_1 = (__pyx_v_self->lock != NULL); + if (__pyx_t_1) { + + /* "View.MemoryView":388 + * global __pyx_memoryview_thread_locks_used + * if self.lock != NULL: + * for i in range(0 if __PYX_GET_CYTHON_COMPILING_IN_CPYTHON_FREETHREADING() else __pyx_memoryview_thread_locks_used): # <<<<<<<<<<<<<< + * if __pyx_memoryview_thread_locks[i] is self.lock: + * __pyx_memoryview_thread_locks_used -= 1 +*/ + __pyx_t_1 = __PYX_GET_CYTHON_COMPILING_IN_CPYTHON_FREETHREADING(); + if (__pyx_t_1) { + __pyx_t_2 = 0; + } else { + __pyx_t_2 = __pyx_memoryview_thread_locks_used; + } + __pyx_t_3 = __pyx_t_2; + for (__pyx_t_4 = 0; __pyx_t_4 < __pyx_t_3; __pyx_t_4+=1) { + __pyx_v_i = __pyx_t_4; + + /* "View.MemoryView":389 + * if self.lock != NULL: + * for i in range(0 if __PYX_GET_CYTHON_COMPILING_IN_CPYTHON_FREETHREADING() else __pyx_memoryview_thread_locks_used): + * if __pyx_memoryview_thread_locks[i] is self.lock: # <<<<<<<<<<<<<< + * __pyx_memoryview_thread_locks_used -= 1 + * if i != __pyx_memoryview_thread_locks_used: +*/ + __pyx_t_1 = ((__pyx_memoryview_thread_locks[__pyx_v_i]) == __pyx_v_self->lock); + if (__pyx_t_1) { + + /* "View.MemoryView":390 + * for i in range(0 if __PYX_GET_CYTHON_COMPILING_IN_CPYTHON_FREETHREADING() else __pyx_memoryview_thread_locks_used): + * if __pyx_memoryview_thread_locks[i] is self.lock: + * __pyx_memoryview_thread_locks_used -= 1 # <<<<<<<<<<<<<< + * if i != __pyx_memoryview_thread_locks_used: + * __pyx_memoryview_thread_locks[i], __pyx_memoryview_thread_locks[__pyx_memoryview_thread_locks_used] = ( +*/ + __pyx_memoryview_thread_locks_used = (__pyx_memoryview_thread_locks_used - 1); + + /* "View.MemoryView":391 + * if __pyx_memoryview_thread_locks[i] is self.lock: + * __pyx_memoryview_thread_locks_used -= 1 + * if i != __pyx_memoryview_thread_locks_used: # <<<<<<<<<<<<<< + * __pyx_memoryview_thread_locks[i], __pyx_memoryview_thread_locks[__pyx_memoryview_thread_locks_used] = ( + * __pyx_memoryview_thread_locks[__pyx_memoryview_thread_locks_used], __pyx_memoryview_thread_locks[i]) +*/ + __pyx_t_1 = (__pyx_v_i != __pyx_memoryview_thread_locks_used); + if (__pyx_t_1) { + + /* "View.MemoryView":393 + * if i != __pyx_memoryview_thread_locks_used: + * __pyx_memoryview_thread_locks[i], __pyx_memoryview_thread_locks[__pyx_memoryview_thread_locks_used] = ( + * __pyx_memoryview_thread_locks[__pyx_memoryview_thread_locks_used], __pyx_memoryview_thread_locks[i]) # <<<<<<<<<<<<<< + * break + * else: +*/ + __pyx_t_5 = (__pyx_memoryview_thread_locks[__pyx_memoryview_thread_locks_used]); + __pyx_t_6 = (__pyx_memoryview_thread_locks[__pyx_v_i]); + + /* "View.MemoryView":392 + * __pyx_memoryview_thread_locks_used -= 1 + * if i != __pyx_memoryview_thread_locks_used: + * __pyx_memoryview_thread_locks[i], __pyx_memoryview_thread_locks[__pyx_memoryview_thread_locks_used] = ( # <<<<<<<<<<<<<< + * __pyx_memoryview_thread_locks[__pyx_memoryview_thread_locks_used], __pyx_memoryview_thread_locks[i]) + * break +*/ + (__pyx_memoryview_thread_locks[__pyx_v_i]) = __pyx_t_5; + (__pyx_memoryview_thread_locks[__pyx_memoryview_thread_locks_used]) = __pyx_t_6; + + /* "View.MemoryView":391 + * if __pyx_memoryview_thread_locks[i] is self.lock: + * __pyx_memoryview_thread_locks_used -= 1 + * if i != __pyx_memoryview_thread_locks_used: # <<<<<<<<<<<<<< + * __pyx_memoryview_thread_locks[i], __pyx_memoryview_thread_locks[__pyx_memoryview_thread_locks_used] = ( + * __pyx_memoryview_thread_locks[__pyx_memoryview_thread_locks_used], __pyx_memoryview_thread_locks[i]) +*/ + } + + /* "View.MemoryView":394 + * __pyx_memoryview_thread_locks[i], __pyx_memoryview_thread_locks[__pyx_memoryview_thread_locks_used] = ( + * __pyx_memoryview_thread_locks[__pyx_memoryview_thread_locks_used], __pyx_memoryview_thread_locks[i]) + * break # <<<<<<<<<<<<<< + * else: + * PyThread_free_lock(self.lock) +*/ + goto __pyx_L6_break; + + /* "View.MemoryView":389 + * if self.lock != NULL: + * for i in range(0 if __PYX_GET_CYTHON_COMPILING_IN_CPYTHON_FREETHREADING() else __pyx_memoryview_thread_locks_used): + * if __pyx_memoryview_thread_locks[i] is self.lock: # <<<<<<<<<<<<<< + * __pyx_memoryview_thread_locks_used -= 1 + * if i != __pyx_memoryview_thread_locks_used: +*/ + } + } + /*else*/ { + + /* "View.MemoryView":396 + * break + * else: + * PyThread_free_lock(self.lock) # <<<<<<<<<<<<<< + * + * cdef char *get_item_pointer(memoryview self, object index) except NULL: +*/ + PyThread_free_lock(__pyx_v_self->lock); + } + __pyx_L6_break:; + + /* "View.MemoryView":387 + * cdef int i + * global __pyx_memoryview_thread_locks_used + * if self.lock != NULL: # <<<<<<<<<<<<<< + * for i in range(0 if __PYX_GET_CYTHON_COMPILING_IN_CPYTHON_FREETHREADING() else __pyx_memoryview_thread_locks_used): + * if __pyx_memoryview_thread_locks[i] is self.lock: +*/ + } + + /* "View.MemoryView":377 + * self.typeinfo = NULL + * + * def __dealloc__(memoryview self): # <<<<<<<<<<<<<< + * if self.obj is not None: + * PyBuffer_Release(&self.view) +*/ + + /* function exit code */ +} + +/* "View.MemoryView":398 + * PyThread_free_lock(self.lock) + * + * cdef char *get_item_pointer(memoryview self, object index) except NULL: # <<<<<<<<<<<<<< + * cdef Py_ssize_t dim + * cdef char *itemp = self.view.buf +*/ + +static char *__pyx_memoryview_get_item_pointer(struct __pyx_memoryview_obj *__pyx_v_self, PyObject *__pyx_v_index) { + Py_ssize_t __pyx_v_dim; + char *__pyx_v_itemp; + PyObject *__pyx_v_idx = NULL; + char *__pyx_r; + __Pyx_RefNannyDeclarations + Py_ssize_t __pyx_t_1; + PyObject *__pyx_t_2 = NULL; + Py_ssize_t __pyx_t_3; + PyObject *(*__pyx_t_4)(PyObject *); + PyObject *__pyx_t_5 = NULL; + Py_ssize_t __pyx_t_6; + char *__pyx_t_7; + int __pyx_lineno = 0; + const char *__pyx_filename = NULL; + int __pyx_clineno = 0; + __Pyx_RefNannySetupContext("get_item_pointer", 0); + + /* "View.MemoryView":400 + * cdef char *get_item_pointer(memoryview self, object index) except NULL: + * cdef Py_ssize_t dim + * cdef char *itemp = self.view.buf # <<<<<<<<<<<<<< + * + * for dim, idx in enumerate(index): +*/ + __pyx_v_itemp = ((char *)__pyx_v_self->view.buf); + + /* "View.MemoryView":402 + * cdef char *itemp = self.view.buf + * + * for dim, idx in enumerate(index): # <<<<<<<<<<<<<< + * itemp = pybuffer_index(&self.view, itemp, idx, dim) + * +*/ + __pyx_t_1 = 0; + if (likely(PyList_CheckExact(__pyx_v_index)) || PyTuple_CheckExact(__pyx_v_index)) { + __pyx_t_2 = __pyx_v_index; __Pyx_INCREF(__pyx_t_2); + __pyx_t_3 = 0; + __pyx_t_4 = NULL; + } else { + __pyx_t_3 = -1; __pyx_t_2 = PyObject_GetIter(__pyx_v_index); if (unlikely(!__pyx_t_2)) __PYX_ERR(1, 402, __pyx_L1_error) + __Pyx_GOTREF(__pyx_t_2); + __pyx_t_4 = (CYTHON_COMPILING_IN_LIMITED_API) ? PyIter_Next : __Pyx_PyObject_GetIterNextFunc(__pyx_t_2); if (unlikely(!__pyx_t_4)) __PYX_ERR(1, 402, __pyx_L1_error) + } + for (;;) { + if (likely(!__pyx_t_4)) { + if (likely(PyList_CheckExact(__pyx_t_2))) { + { + Py_ssize_t __pyx_temp = __Pyx_PyList_GET_SIZE(__pyx_t_2); + #if !CYTHON_ASSUME_SAFE_SIZE + if (unlikely((__pyx_temp < 0))) __PYX_ERR(1, 402, __pyx_L1_error) + #endif + if (__pyx_t_3 >= __pyx_temp) break; + } + __pyx_t_5 = __Pyx_PyList_GetItemRefFast(__pyx_t_2, __pyx_t_3, __Pyx_ReferenceSharing_OwnStrongReference); + ++__pyx_t_3; + } else { + { + Py_ssize_t __pyx_temp = __Pyx_PyTuple_GET_SIZE(__pyx_t_2); + #if !CYTHON_ASSUME_SAFE_SIZE + if (unlikely((__pyx_temp < 0))) __PYX_ERR(1, 402, __pyx_L1_error) + #endif + if (__pyx_t_3 >= __pyx_temp) break; + } + #if CYTHON_ASSUME_SAFE_MACROS && !CYTHON_AVOID_BORROWED_REFS + __pyx_t_5 = __Pyx_NewRef(PyTuple_GET_ITEM(__pyx_t_2, __pyx_t_3)); + #else + __pyx_t_5 = __Pyx_PySequence_ITEM(__pyx_t_2, __pyx_t_3); + #endif + ++__pyx_t_3; + } + if (unlikely(!__pyx_t_5)) __PYX_ERR(1, 402, __pyx_L1_error) + } else { + __pyx_t_5 = __pyx_t_4(__pyx_t_2); + if (unlikely(!__pyx_t_5)) { + PyObject* exc_type = PyErr_Occurred(); + if (exc_type) { + if (unlikely(!__Pyx_PyErr_GivenExceptionMatches(exc_type, PyExc_StopIteration))) __PYX_ERR(1, 402, __pyx_L1_error) + PyErr_Clear(); + } + break; + } + } + __Pyx_GOTREF(__pyx_t_5); + __Pyx_XDECREF_SET(__pyx_v_idx, __pyx_t_5); + __pyx_t_5 = 0; + __pyx_v_dim = __pyx_t_1; + __pyx_t_1 = (__pyx_t_1 + 1); + + /* "View.MemoryView":403 + * + * for dim, idx in enumerate(index): + * itemp = pybuffer_index(&self.view, itemp, idx, dim) # <<<<<<<<<<<<<< + * + * return itemp +*/ + __pyx_t_6 = __Pyx_PyIndex_AsSsize_t(__pyx_v_idx); if (unlikely((__pyx_t_6 == (Py_ssize_t)-1) && PyErr_Occurred())) __PYX_ERR(1, 403, __pyx_L1_error) + __pyx_t_7 = __pyx_pybuffer_index((&__pyx_v_self->view), __pyx_v_itemp, __pyx_t_6, __pyx_v_dim); if (unlikely(__pyx_t_7 == ((void *)NULL))) __PYX_ERR(1, 403, __pyx_L1_error) + __pyx_v_itemp = __pyx_t_7; + + /* "View.MemoryView":402 + * cdef char *itemp = self.view.buf + * + * for dim, idx in enumerate(index): # <<<<<<<<<<<<<< + * itemp = pybuffer_index(&self.view, itemp, idx, dim) + * +*/ + } + __Pyx_DECREF(__pyx_t_2); __pyx_t_2 = 0; + + /* "View.MemoryView":405 + * itemp = pybuffer_index(&self.view, itemp, idx, dim) + * + * return itemp # <<<<<<<<<<<<<< + * + * +*/ + __pyx_r = __pyx_v_itemp; + goto __pyx_L0; + + /* "View.MemoryView":398 + * PyThread_free_lock(self.lock) + * + * cdef char *get_item_pointer(memoryview self, object index) except NULL: # <<<<<<<<<<<<<< + * cdef Py_ssize_t dim + * cdef char *itemp = self.view.buf +*/ + + /* function exit code */ + __pyx_L1_error:; + __Pyx_XDECREF(__pyx_t_2); + __Pyx_XDECREF(__pyx_t_5); + __Pyx_AddTraceback("View.MemoryView.memoryview.get_item_pointer", __pyx_clineno, __pyx_lineno, __pyx_filename); + __pyx_r = NULL; + __pyx_L0:; + __Pyx_XDECREF(__pyx_v_idx); + __Pyx_RefNannyFinishContext(); + return __pyx_r; +} + +/* "View.MemoryView":408 + * + * + * def __getitem__(memoryview self, object index): # <<<<<<<<<<<<<< + * if index is Ellipsis: + * return self +*/ + +/* Python wrapper */ +static PyObject *__pyx_memoryview___getitem__(PyObject *__pyx_v_self, PyObject *__pyx_v_index); /*proto*/ +static PyObject *__pyx_memoryview___getitem__(PyObject *__pyx_v_self, PyObject *__pyx_v_index) { + CYTHON_UNUSED PyObject *const *__pyx_kwvalues; + PyObject *__pyx_r = 0; + __Pyx_RefNannyDeclarations + __Pyx_RefNannySetupContext("__getitem__ (wrapper)", 0); + __pyx_kwvalues = __Pyx_KwValues_VARARGS(__pyx_args, __pyx_nargs); + __pyx_r = __pyx_memoryview___pyx_pf_15View_dot_MemoryView_10memoryview_4__getitem__(((struct __pyx_memoryview_obj *)__pyx_v_self), ((PyObject *)__pyx_v_index)); + + /* function exit code */ + __Pyx_RefNannyFinishContext(); + return __pyx_r; +} + +static PyObject *__pyx_memoryview___pyx_pf_15View_dot_MemoryView_10memoryview_4__getitem__(struct __pyx_memoryview_obj *__pyx_v_self, PyObject *__pyx_v_index) { + PyObject *__pyx_v_have_slices = NULL; + PyObject *__pyx_v_indices = NULL; + char *__pyx_v_itemp; + 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; + char *__pyx_t_5; + int __pyx_lineno = 0; + const char *__pyx_filename = NULL; + int __pyx_clineno = 0; + __Pyx_RefNannySetupContext("__getitem__", 0); + + /* "View.MemoryView":409 + * + * def __getitem__(memoryview self, object index): + * if index is Ellipsis: # <<<<<<<<<<<<<< + * return self + * +*/ + __pyx_t_1 = (__pyx_v_index == __pyx_builtin_Ellipsis); + if (__pyx_t_1) { + + /* "View.MemoryView":410 + * def __getitem__(memoryview self, object index): + * if index is Ellipsis: + * return self # <<<<<<<<<<<<<< + * + * have_slices, indices = _unellipsify(index, self.view.ndim) +*/ + __Pyx_XDECREF(__pyx_r); + __Pyx_INCREF((PyObject *)__pyx_v_self); + __pyx_r = ((PyObject *)__pyx_v_self); + goto __pyx_L0; + + /* "View.MemoryView":409 + * + * def __getitem__(memoryview self, object index): + * if index is Ellipsis: # <<<<<<<<<<<<<< + * return self + * +*/ + } + + /* "View.MemoryView":412 + * return self + * + * have_slices, indices = _unellipsify(index, self.view.ndim) # <<<<<<<<<<<<<< + * + * cdef char *itemp +*/ + __pyx_t_2 = _unellipsify(__pyx_v_index, __pyx_v_self->view.ndim); if (unlikely(!__pyx_t_2)) __PYX_ERR(1, 412, __pyx_L1_error) + __Pyx_GOTREF(__pyx_t_2); + if (likely(__pyx_t_2 != Py_None)) { + PyObject* sequence = __pyx_t_2; + Py_ssize_t size = __Pyx_PyTuple_GET_SIZE(sequence); + if (unlikely(size != 2)) { + if (size > 2) __Pyx_RaiseTooManyValuesError(2); + else if (size >= 0) __Pyx_RaiseNeedMoreValuesError(size); + __PYX_ERR(1, 412, __pyx_L1_error) + } + #if CYTHON_ASSUME_SAFE_MACROS && !CYTHON_AVOID_BORROWED_REFS + __pyx_t_3 = PyTuple_GET_ITEM(sequence, 0); + __Pyx_INCREF(__pyx_t_3); + __pyx_t_4 = PyTuple_GET_ITEM(sequence, 1); + __Pyx_INCREF(__pyx_t_4); + #else + __pyx_t_3 = __Pyx_PySequence_ITEM(sequence, 0); if (unlikely(!__pyx_t_3)) __PYX_ERR(1, 412, __pyx_L1_error) + __Pyx_GOTREF(__pyx_t_3); + __pyx_t_4 = __Pyx_PySequence_ITEM(sequence, 1); if (unlikely(!__pyx_t_4)) __PYX_ERR(1, 412, __pyx_L1_error) + __Pyx_GOTREF(__pyx_t_4); + #endif + __Pyx_DECREF(__pyx_t_2); __pyx_t_2 = 0; + } else { + __Pyx_RaiseNoneNotIterableError(); __PYX_ERR(1, 412, __pyx_L1_error) + } + __pyx_v_have_slices = __pyx_t_3; + __pyx_t_3 = 0; + __pyx_v_indices = __pyx_t_4; + __pyx_t_4 = 0; + + /* "View.MemoryView":415 + * + * cdef char *itemp + * if have_slices: # <<<<<<<<<<<<<< + * return memview_slice(self, indices) + * else: +*/ + __pyx_t_1 = __Pyx_PyObject_IsTrue(__pyx_v_have_slices); if (unlikely((__pyx_t_1 < 0))) __PYX_ERR(1, 415, __pyx_L1_error) + if (__pyx_t_1) { + + /* "View.MemoryView":416 + * cdef char *itemp + * if have_slices: + * return memview_slice(self, indices) # <<<<<<<<<<<<<< + * else: + * itemp = self.get_item_pointer(indices) +*/ + __Pyx_XDECREF(__pyx_r); + __pyx_t_2 = ((PyObject *)__pyx_memview_slice(__pyx_v_self, __pyx_v_indices)); if (unlikely(!__pyx_t_2)) __PYX_ERR(1, 416, __pyx_L1_error) + __Pyx_GOTREF(__pyx_t_2); + __pyx_r = __pyx_t_2; + __pyx_t_2 = 0; + goto __pyx_L0; + + /* "View.MemoryView":415 + * + * cdef char *itemp + * if have_slices: # <<<<<<<<<<<<<< + * return memview_slice(self, indices) + * else: +*/ + } + + /* "View.MemoryView":418 + * return memview_slice(self, indices) + * else: + * itemp = self.get_item_pointer(indices) # <<<<<<<<<<<<<< + * return self.convert_item_to_object(itemp) + * +*/ + /*else*/ { + __pyx_t_5 = ((struct __pyx_vtabstruct_memoryview *)__pyx_v_self->__pyx_vtab)->get_item_pointer(__pyx_v_self, __pyx_v_indices); if (unlikely(__pyx_t_5 == ((void *)NULL))) __PYX_ERR(1, 418, __pyx_L1_error) + __pyx_v_itemp = __pyx_t_5; + + /* "View.MemoryView":419 + * else: + * itemp = self.get_item_pointer(indices) + * return self.convert_item_to_object(itemp) # <<<<<<<<<<<<<< + * + * def __setitem__(memoryview self, object index, object value): +*/ + __Pyx_XDECREF(__pyx_r); + __pyx_t_2 = ((struct __pyx_vtabstruct_memoryview *)__pyx_v_self->__pyx_vtab)->convert_item_to_object(__pyx_v_self, __pyx_v_itemp); if (unlikely(!__pyx_t_2)) __PYX_ERR(1, 419, __pyx_L1_error) + __Pyx_GOTREF(__pyx_t_2); + __pyx_r = __pyx_t_2; + __pyx_t_2 = 0; + goto __pyx_L0; + } + + /* "View.MemoryView":408 + * + * + * def __getitem__(memoryview self, object index): # <<<<<<<<<<<<<< + * if index is Ellipsis: + * return self +*/ + + /* function exit code */ + __pyx_L1_error:; + __Pyx_XDECREF(__pyx_t_2); + __Pyx_XDECREF(__pyx_t_3); + __Pyx_XDECREF(__pyx_t_4); + __Pyx_AddTraceback("View.MemoryView.memoryview.__getitem__", __pyx_clineno, __pyx_lineno, __pyx_filename); + __pyx_r = NULL; + __pyx_L0:; + __Pyx_XDECREF(__pyx_v_have_slices); + __Pyx_XDECREF(__pyx_v_indices); + __Pyx_XGIVEREF(__pyx_r); + __Pyx_RefNannyFinishContext(); + return __pyx_r; +} + +/* "View.MemoryView":421 + * return self.convert_item_to_object(itemp) + * + * def __setitem__(memoryview self, object index, object value): # <<<<<<<<<<<<<< + * if self.view.readonly: + * raise TypeError, "Cannot assign to read-only memoryview" +*/ + +/* Python wrapper */ +static int __pyx_memoryview___setitem__(PyObject *__pyx_v_self, PyObject *__pyx_v_index, PyObject *__pyx_v_value); /*proto*/ +static int __pyx_memoryview___setitem__(PyObject *__pyx_v_self, PyObject *__pyx_v_index, PyObject *__pyx_v_value) { + CYTHON_UNUSED PyObject *const *__pyx_kwvalues; + int __pyx_r; + __Pyx_RefNannyDeclarations + __Pyx_RefNannySetupContext("__setitem__ (wrapper)", 0); + __pyx_kwvalues = __Pyx_KwValues_VARARGS(__pyx_args, __pyx_nargs); + __pyx_r = __pyx_memoryview___pyx_pf_15View_dot_MemoryView_10memoryview_6__setitem__(((struct __pyx_memoryview_obj *)__pyx_v_self), ((PyObject *)__pyx_v_index), ((PyObject *)__pyx_v_value)); + + /* function exit code */ + __Pyx_RefNannyFinishContext(); + return __pyx_r; +} + +static int __pyx_memoryview___pyx_pf_15View_dot_MemoryView_10memoryview_6__setitem__(struct __pyx_memoryview_obj *__pyx_v_self, PyObject *__pyx_v_index, PyObject *__pyx_v_value) { + PyObject *__pyx_v_have_slices = NULL; + PyObject *__pyx_v_obj = NULL; + int __pyx_r; + __Pyx_RefNannyDeclarations + PyObject *__pyx_t_1 = NULL; + PyObject *__pyx_t_2 = NULL; + PyObject *__pyx_t_3 = NULL; + int __pyx_t_4; + int __pyx_lineno = 0; + const char *__pyx_filename = NULL; + int __pyx_clineno = 0; + __Pyx_RefNannySetupContext("__setitem__", 0); + __Pyx_INCREF(__pyx_v_index); + + /* "View.MemoryView":422 + * + * def __setitem__(memoryview self, object index, object value): + * if self.view.readonly: # <<<<<<<<<<<<<< + * raise TypeError, "Cannot assign to read-only memoryview" + * +*/ + if (unlikely(__pyx_v_self->view.readonly)) { + + /* "View.MemoryView":423 + * def __setitem__(memoryview self, object index, object value): + * if self.view.readonly: + * raise TypeError, "Cannot assign to read-only memoryview" # <<<<<<<<<<<<<< + * + * have_slices, index = _unellipsify(index, self.view.ndim) +*/ + __Pyx_Raise(((PyObject *)(((PyTypeObject*)PyExc_TypeError))), __pyx_mstate_global->__pyx_kp_u_Cannot_assign_to_read_only_memor, 0, 0); + __PYX_ERR(1, 423, __pyx_L1_error) + + /* "View.MemoryView":422 + * + * def __setitem__(memoryview self, object index, object value): + * if self.view.readonly: # <<<<<<<<<<<<<< + * raise TypeError, "Cannot assign to read-only memoryview" + * +*/ + } + + /* "View.MemoryView":425 + * raise TypeError, "Cannot assign to read-only memoryview" + * + * have_slices, index = _unellipsify(index, self.view.ndim) # <<<<<<<<<<<<<< + * + * if have_slices: +*/ + __pyx_t_1 = _unellipsify(__pyx_v_index, __pyx_v_self->view.ndim); if (unlikely(!__pyx_t_1)) __PYX_ERR(1, 425, __pyx_L1_error) + __Pyx_GOTREF(__pyx_t_1); + if (likely(__pyx_t_1 != Py_None)) { + PyObject* sequence = __pyx_t_1; + Py_ssize_t size = __Pyx_PyTuple_GET_SIZE(sequence); + if (unlikely(size != 2)) { + if (size > 2) __Pyx_RaiseTooManyValuesError(2); + else if (size >= 0) __Pyx_RaiseNeedMoreValuesError(size); + __PYX_ERR(1, 425, __pyx_L1_error) + } + #if CYTHON_ASSUME_SAFE_MACROS && !CYTHON_AVOID_BORROWED_REFS + __pyx_t_2 = PyTuple_GET_ITEM(sequence, 0); + __Pyx_INCREF(__pyx_t_2); + __pyx_t_3 = PyTuple_GET_ITEM(sequence, 1); + __Pyx_INCREF(__pyx_t_3); + #else + __pyx_t_2 = __Pyx_PySequence_ITEM(sequence, 0); if (unlikely(!__pyx_t_2)) __PYX_ERR(1, 425, __pyx_L1_error) + __Pyx_GOTREF(__pyx_t_2); + __pyx_t_3 = __Pyx_PySequence_ITEM(sequence, 1); if (unlikely(!__pyx_t_3)) __PYX_ERR(1, 425, __pyx_L1_error) + __Pyx_GOTREF(__pyx_t_3); + #endif + __Pyx_DECREF(__pyx_t_1); __pyx_t_1 = 0; + } else { + __Pyx_RaiseNoneNotIterableError(); __PYX_ERR(1, 425, __pyx_L1_error) + } + __pyx_v_have_slices = __pyx_t_2; + __pyx_t_2 = 0; + __Pyx_DECREF_SET(__pyx_v_index, __pyx_t_3); + __pyx_t_3 = 0; + + /* "View.MemoryView":427 + * have_slices, index = _unellipsify(index, self.view.ndim) + * + * if have_slices: # <<<<<<<<<<<<<< + * obj = self.is_slice(value) + * if obj is not None: +*/ + __pyx_t_4 = __Pyx_PyObject_IsTrue(__pyx_v_have_slices); if (unlikely((__pyx_t_4 < 0))) __PYX_ERR(1, 427, __pyx_L1_error) + if (__pyx_t_4) { + + /* "View.MemoryView":428 + * + * if have_slices: + * obj = self.is_slice(value) # <<<<<<<<<<<<<< + * if obj is not None: + * self.setitem_slice_assignment(self[index], obj) +*/ + __pyx_t_1 = ((struct __pyx_vtabstruct_memoryview *)__pyx_v_self->__pyx_vtab)->is_slice(__pyx_v_self, __pyx_v_value); if (unlikely(!__pyx_t_1)) __PYX_ERR(1, 428, __pyx_L1_error) + __Pyx_GOTREF(__pyx_t_1); + __pyx_v_obj = __pyx_t_1; + __pyx_t_1 = 0; + + /* "View.MemoryView":429 + * if have_slices: + * obj = self.is_slice(value) + * if obj is not None: # <<<<<<<<<<<<<< + * self.setitem_slice_assignment(self[index], obj) + * else: +*/ + __pyx_t_4 = (__pyx_v_obj != Py_None); + if (__pyx_t_4) { + + /* "View.MemoryView":430 + * obj = self.is_slice(value) + * if obj is not None: + * self.setitem_slice_assignment(self[index], obj) # <<<<<<<<<<<<<< + * else: + * self.setitem_slice_assign_scalar(self[index], value) +*/ + __pyx_t_1 = __Pyx_PyObject_GetItem(((PyObject *)__pyx_v_self), __pyx_v_index); if (unlikely(!__pyx_t_1)) __PYX_ERR(1, 430, __pyx_L1_error) + __Pyx_GOTREF(__pyx_t_1); + __pyx_t_3 = ((struct __pyx_vtabstruct_memoryview *)__pyx_v_self->__pyx_vtab)->setitem_slice_assignment(__pyx_v_self, __pyx_t_1, __pyx_v_obj); if (unlikely(!__pyx_t_3)) __PYX_ERR(1, 430, __pyx_L1_error) + __Pyx_GOTREF(__pyx_t_3); + __Pyx_DECREF(__pyx_t_1); __pyx_t_1 = 0; + __Pyx_DECREF(__pyx_t_3); __pyx_t_3 = 0; + + /* "View.MemoryView":429 + * if have_slices: + * obj = self.is_slice(value) + * if obj is not None: # <<<<<<<<<<<<<< + * self.setitem_slice_assignment(self[index], obj) + * else: +*/ + goto __pyx_L5; + } + + /* "View.MemoryView":432 + * self.setitem_slice_assignment(self[index], obj) + * else: + * self.setitem_slice_assign_scalar(self[index], value) # <<<<<<<<<<<<<< + * else: + * self.setitem_indexed(index, value) +*/ + /*else*/ { + __pyx_t_3 = __Pyx_PyObject_GetItem(((PyObject *)__pyx_v_self), __pyx_v_index); if (unlikely(!__pyx_t_3)) __PYX_ERR(1, 432, __pyx_L1_error) + __Pyx_GOTREF(__pyx_t_3); + if (!(likely(((__pyx_t_3) == Py_None) || likely(__Pyx_TypeTest(__pyx_t_3, __pyx_mstate_global->__pyx_memoryview_type))))) __PYX_ERR(1, 432, __pyx_L1_error) + __pyx_t_1 = ((struct __pyx_vtabstruct_memoryview *)__pyx_v_self->__pyx_vtab)->setitem_slice_assign_scalar(__pyx_v_self, ((struct __pyx_memoryview_obj *)__pyx_t_3), __pyx_v_value); if (unlikely(!__pyx_t_1)) __PYX_ERR(1, 432, __pyx_L1_error) + __Pyx_GOTREF(__pyx_t_1); + __Pyx_DECREF(__pyx_t_3); __pyx_t_3 = 0; + __Pyx_DECREF(__pyx_t_1); __pyx_t_1 = 0; + } + __pyx_L5:; + + /* "View.MemoryView":427 + * have_slices, index = _unellipsify(index, self.view.ndim) + * + * if have_slices: # <<<<<<<<<<<<<< + * obj = self.is_slice(value) + * if obj is not None: +*/ + goto __pyx_L4; + } + + /* "View.MemoryView":434 + * self.setitem_slice_assign_scalar(self[index], value) + * else: + * self.setitem_indexed(index, value) # <<<<<<<<<<<<<< + * + * cdef is_slice(self, obj): +*/ + /*else*/ { + __pyx_t_1 = ((struct __pyx_vtabstruct_memoryview *)__pyx_v_self->__pyx_vtab)->setitem_indexed(__pyx_v_self, __pyx_v_index, __pyx_v_value); if (unlikely(!__pyx_t_1)) __PYX_ERR(1, 434, __pyx_L1_error) + __Pyx_GOTREF(__pyx_t_1); + __Pyx_DECREF(__pyx_t_1); __pyx_t_1 = 0; + } + __pyx_L4:; + + /* "View.MemoryView":421 + * return self.convert_item_to_object(itemp) + * + * def __setitem__(memoryview self, object index, object value): # <<<<<<<<<<<<<< + * if self.view.readonly: + * raise TypeError, "Cannot assign to read-only memoryview" +*/ + + /* function exit code */ + __pyx_r = 0; + goto __pyx_L0; + __pyx_L1_error:; + __Pyx_XDECREF(__pyx_t_1); + __Pyx_XDECREF(__pyx_t_2); + __Pyx_XDECREF(__pyx_t_3); + __Pyx_AddTraceback("View.MemoryView.memoryview.__setitem__", __pyx_clineno, __pyx_lineno, __pyx_filename); + __pyx_r = -1; + __pyx_L0:; + __Pyx_XDECREF(__pyx_v_have_slices); + __Pyx_XDECREF(__pyx_v_obj); + __Pyx_XDECREF(__pyx_v_index); + __Pyx_RefNannyFinishContext(); + return __pyx_r; +} + +/* "View.MemoryView":436 + * self.setitem_indexed(index, value) + * + * cdef is_slice(self, obj): # <<<<<<<<<<<<<< + * if not isinstance(obj, memoryview): + * try: +*/ + +static PyObject *__pyx_memoryview_is_slice(struct __pyx_memoryview_obj *__pyx_v_self, PyObject *__pyx_v_obj) { + PyObject *__pyx_r = NULL; + __Pyx_RefNannyDeclarations + int __pyx_t_1; + int __pyx_t_2; + PyObject *__pyx_t_3 = NULL; + PyObject *__pyx_t_4 = NULL; + PyObject *__pyx_t_5 = NULL; + PyObject *__pyx_t_6 = NULL; + PyObject *__pyx_t_7 = NULL; + PyObject *__pyx_t_8 = NULL; + PyObject *__pyx_t_9 = NULL; + size_t __pyx_t_10; + int __pyx_t_11; + int __pyx_lineno = 0; + const char *__pyx_filename = NULL; + int __pyx_clineno = 0; + __Pyx_RefNannySetupContext("is_slice", 0); + __Pyx_INCREF(__pyx_v_obj); + + /* "View.MemoryView":437 + * + * cdef is_slice(self, obj): + * if not isinstance(obj, memoryview): # <<<<<<<<<<<<<< + * try: + * obj = memoryview(obj, self.flags & ~PyBUF_WRITABLE | PyBUF_ANY_CONTIGUOUS, +*/ + __pyx_t_1 = __Pyx_TypeCheck(__pyx_v_obj, __pyx_mstate_global->__pyx_memoryview_type); + __pyx_t_2 = (!__pyx_t_1); + if (__pyx_t_2) { + + /* "View.MemoryView":438 + * cdef is_slice(self, obj): + * if not isinstance(obj, memoryview): + * try: # <<<<<<<<<<<<<< + * obj = memoryview(obj, self.flags & ~PyBUF_WRITABLE | PyBUF_ANY_CONTIGUOUS, + * self.dtype_is_object) +*/ + { + __Pyx_PyThreadState_declare + __Pyx_PyThreadState_assign + __Pyx_ExceptionSave(&__pyx_t_3, &__pyx_t_4, &__pyx_t_5); + __Pyx_XGOTREF(__pyx_t_3); + __Pyx_XGOTREF(__pyx_t_4); + __Pyx_XGOTREF(__pyx_t_5); + /*try:*/ { + + /* "View.MemoryView":439 + * if not isinstance(obj, memoryview): + * try: + * obj = memoryview(obj, self.flags & ~PyBUF_WRITABLE | PyBUF_ANY_CONTIGUOUS, # <<<<<<<<<<<<<< + * self.dtype_is_object) + * except TypeError: +*/ + __pyx_t_7 = NULL; + __pyx_t_8 = __Pyx_PyLong_From_int(((__pyx_v_self->flags & (~PyBUF_WRITABLE)) | PyBUF_ANY_CONTIGUOUS)); if (unlikely(!__pyx_t_8)) __PYX_ERR(1, 439, __pyx_L4_error) + __Pyx_GOTREF(__pyx_t_8); + + /* "View.MemoryView":440 + * try: + * obj = memoryview(obj, self.flags & ~PyBUF_WRITABLE | PyBUF_ANY_CONTIGUOUS, + * self.dtype_is_object) # <<<<<<<<<<<<<< + * except TypeError: + * return None +*/ + __pyx_t_9 = __Pyx_PyBool_FromLong(__pyx_v_self->dtype_is_object); if (unlikely(!__pyx_t_9)) __PYX_ERR(1, 440, __pyx_L4_error) + __Pyx_GOTREF(__pyx_t_9); + __pyx_t_10 = 1; + { + PyObject *__pyx_callargs[4] = {__pyx_t_7, __pyx_v_obj, __pyx_t_8, __pyx_t_9}; + __pyx_t_6 = __Pyx_PyObject_FastCall((PyObject*)__pyx_mstate_global->__pyx_memoryview_type, __pyx_callargs+__pyx_t_10, (4-__pyx_t_10) | (__pyx_t_10*__Pyx_PY_VECTORCALL_ARGUMENTS_OFFSET)); + __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; + if (unlikely(!__pyx_t_6)) __PYX_ERR(1, 439, __pyx_L4_error) + __Pyx_GOTREF((PyObject *)__pyx_t_6); + } + __Pyx_DECREF_SET(__pyx_v_obj, ((PyObject *)__pyx_t_6)); + __pyx_t_6 = 0; + + /* "View.MemoryView":438 + * cdef is_slice(self, obj): + * if not isinstance(obj, memoryview): + * try: # <<<<<<<<<<<<<< + * obj = memoryview(obj, self.flags & ~PyBUF_WRITABLE | PyBUF_ANY_CONTIGUOUS, + * self.dtype_is_object) +*/ + } + __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; + goto __pyx_L9_try_end; + __pyx_L4_error:; + __Pyx_XDECREF(__pyx_t_6); __pyx_t_6 = 0; + __Pyx_XDECREF(__pyx_t_7); __pyx_t_7 = 0; + __Pyx_XDECREF(__pyx_t_8); __pyx_t_8 = 0; + __Pyx_XDECREF(__pyx_t_9); __pyx_t_9 = 0; + + /* "View.MemoryView":441 + * obj = memoryview(obj, self.flags & ~PyBUF_WRITABLE | PyBUF_ANY_CONTIGUOUS, + * self.dtype_is_object) + * except TypeError: # <<<<<<<<<<<<<< + * return None + * +*/ + __pyx_t_11 = __Pyx_PyErr_ExceptionMatches(((PyObject *)(((PyTypeObject*)PyExc_TypeError)))); + if (__pyx_t_11) { + __Pyx_ErrRestore(0,0,0); + + /* "View.MemoryView":442 + * self.dtype_is_object) + * except TypeError: + * return None # <<<<<<<<<<<<<< + * + * return obj +*/ + __Pyx_XDECREF(__pyx_r); + __pyx_r = Py_None; __Pyx_INCREF(Py_None); + goto __pyx_L7_except_return; + } + goto __pyx_L6_except_error; + + /* "View.MemoryView":438 + * cdef is_slice(self, obj): + * if not isinstance(obj, memoryview): + * try: # <<<<<<<<<<<<<< + * obj = memoryview(obj, self.flags & ~PyBUF_WRITABLE | PyBUF_ANY_CONTIGUOUS, + * self.dtype_is_object) +*/ + __pyx_L6_except_error:; + __Pyx_XGIVEREF(__pyx_t_3); + __Pyx_XGIVEREF(__pyx_t_4); + __Pyx_XGIVEREF(__pyx_t_5); + __Pyx_ExceptionReset(__pyx_t_3, __pyx_t_4, __pyx_t_5); + goto __pyx_L1_error; + __pyx_L7_except_return:; + __Pyx_XGIVEREF(__pyx_t_3); + __Pyx_XGIVEREF(__pyx_t_4); + __Pyx_XGIVEREF(__pyx_t_5); + __Pyx_ExceptionReset(__pyx_t_3, __pyx_t_4, __pyx_t_5); + goto __pyx_L0; + __pyx_L9_try_end:; + } + + /* "View.MemoryView":437 + * + * cdef is_slice(self, obj): + * if not isinstance(obj, memoryview): # <<<<<<<<<<<<<< + * try: + * obj = memoryview(obj, self.flags & ~PyBUF_WRITABLE | PyBUF_ANY_CONTIGUOUS, +*/ + } + + /* "View.MemoryView":444 + * return None + * + * return obj # <<<<<<<<<<<<<< + * + * cdef setitem_slice_assignment(self, dst, src): +*/ + __Pyx_XDECREF(__pyx_r); + __Pyx_INCREF(__pyx_v_obj); + __pyx_r = __pyx_v_obj; + goto __pyx_L0; + + /* "View.MemoryView":436 + * self.setitem_indexed(index, value) + * + * cdef is_slice(self, obj): # <<<<<<<<<<<<<< + * if not isinstance(obj, memoryview): + * try: +*/ + + /* function exit code */ + __pyx_L1_error:; + __Pyx_XDECREF(__pyx_t_6); + __Pyx_XDECREF(__pyx_t_7); + __Pyx_XDECREF(__pyx_t_8); + __Pyx_XDECREF(__pyx_t_9); + __Pyx_AddTraceback("View.MemoryView.memoryview.is_slice", __pyx_clineno, __pyx_lineno, __pyx_filename); + __pyx_r = 0; + __pyx_L0:; + __Pyx_XDECREF(__pyx_v_obj); + __Pyx_XGIVEREF(__pyx_r); + __Pyx_RefNannyFinishContext(); + return __pyx_r; +} + +/* "View.MemoryView":446 + * return obj + * + * cdef setitem_slice_assignment(self, dst, src): # <<<<<<<<<<<<<< + * cdef __Pyx_memviewslice dst_slice + * cdef __Pyx_memviewslice src_slice +*/ + +static PyObject *__pyx_memoryview_setitem_slice_assignment(struct __pyx_memoryview_obj *__pyx_v_self, PyObject *__pyx_v_dst, PyObject *__pyx_v_src) { + __Pyx_memviewslice __pyx_v_dst_slice; + __Pyx_memviewslice __pyx_v_src_slice; + __Pyx_memviewslice __pyx_v_msrc; + __Pyx_memviewslice __pyx_v_mdst; + PyObject *__pyx_r = NULL; + __Pyx_RefNannyDeclarations + __Pyx_memviewslice *__pyx_t_1; + PyObject *__pyx_t_2 = NULL; + int __pyx_t_3; + int __pyx_t_4; + int __pyx_t_5; + int __pyx_lineno = 0; + const char *__pyx_filename = NULL; + int __pyx_clineno = 0; + __Pyx_RefNannySetupContext("setitem_slice_assignment", 0); + + /* "View.MemoryView":449 + * cdef __Pyx_memviewslice dst_slice + * cdef __Pyx_memviewslice src_slice + * cdef __Pyx_memviewslice msrc = get_slice_from_memview(src, &src_slice)[0] # <<<<<<<<<<<<<< + * cdef __Pyx_memviewslice mdst = get_slice_from_memview(dst, &dst_slice)[0] + * +*/ + if (!(likely(((__pyx_v_src) == Py_None) || likely(__Pyx_TypeTest(__pyx_v_src, __pyx_mstate_global->__pyx_memoryview_type))))) __PYX_ERR(1, 449, __pyx_L1_error) + __pyx_t_1 = __pyx_memoryview_get_slice_from_memoryview(((struct __pyx_memoryview_obj *)__pyx_v_src), (&__pyx_v_src_slice)); if (unlikely(__pyx_t_1 == ((void *)NULL))) __PYX_ERR(1, 449, __pyx_L1_error) + __pyx_v_msrc = (__pyx_t_1[0]); + + /* "View.MemoryView":450 + * cdef __Pyx_memviewslice src_slice + * cdef __Pyx_memviewslice msrc = get_slice_from_memview(src, &src_slice)[0] + * cdef __Pyx_memviewslice mdst = get_slice_from_memview(dst, &dst_slice)[0] # <<<<<<<<<<<<<< + * + * memoryview_copy_contents(msrc, mdst, src.ndim, dst.ndim, self.dtype_is_object) +*/ + if (!(likely(((__pyx_v_dst) == Py_None) || likely(__Pyx_TypeTest(__pyx_v_dst, __pyx_mstate_global->__pyx_memoryview_type))))) __PYX_ERR(1, 450, __pyx_L1_error) + __pyx_t_1 = __pyx_memoryview_get_slice_from_memoryview(((struct __pyx_memoryview_obj *)__pyx_v_dst), (&__pyx_v_dst_slice)); if (unlikely(__pyx_t_1 == ((void *)NULL))) __PYX_ERR(1, 450, __pyx_L1_error) + __pyx_v_mdst = (__pyx_t_1[0]); + + /* "View.MemoryView":452 + * cdef __Pyx_memviewslice mdst = get_slice_from_memview(dst, &dst_slice)[0] + * + * memoryview_copy_contents(msrc, mdst, src.ndim, dst.ndim, self.dtype_is_object) # <<<<<<<<<<<<<< + * + * cdef setitem_slice_assign_scalar(self, memoryview dst, value): +*/ + __pyx_t_2 = __Pyx_PyObject_GetAttrStr(__pyx_v_src, __pyx_mstate_global->__pyx_n_u_ndim); if (unlikely(!__pyx_t_2)) __PYX_ERR(1, 452, __pyx_L1_error) + __Pyx_GOTREF(__pyx_t_2); + __pyx_t_3 = __Pyx_PyLong_As_int(__pyx_t_2); if (unlikely((__pyx_t_3 == (int)-1) && PyErr_Occurred())) __PYX_ERR(1, 452, __pyx_L1_error) + __Pyx_DECREF(__pyx_t_2); __pyx_t_2 = 0; + __pyx_t_2 = __Pyx_PyObject_GetAttrStr(__pyx_v_dst, __pyx_mstate_global->__pyx_n_u_ndim); if (unlikely(!__pyx_t_2)) __PYX_ERR(1, 452, __pyx_L1_error) + __Pyx_GOTREF(__pyx_t_2); + __pyx_t_4 = __Pyx_PyLong_As_int(__pyx_t_2); if (unlikely((__pyx_t_4 == (int)-1) && PyErr_Occurred())) __PYX_ERR(1, 452, __pyx_L1_error) + __Pyx_DECREF(__pyx_t_2); __pyx_t_2 = 0; + __pyx_t_5 = __pyx_memoryview_copy_contents(__pyx_v_msrc, __pyx_v_mdst, __pyx_t_3, __pyx_t_4, __pyx_v_self->dtype_is_object); if (unlikely(__pyx_t_5 == ((int)-1))) __PYX_ERR(1, 452, __pyx_L1_error) + + /* "View.MemoryView":446 + * return obj + * + * cdef setitem_slice_assignment(self, dst, src): # <<<<<<<<<<<<<< + * cdef __Pyx_memviewslice dst_slice + * cdef __Pyx_memviewslice src_slice +*/ + + /* function exit code */ + __pyx_r = Py_None; __Pyx_INCREF(Py_None); + goto __pyx_L0; + __pyx_L1_error:; + __Pyx_XDECREF(__pyx_t_2); + __Pyx_AddTraceback("View.MemoryView.memoryview.setitem_slice_assignment", __pyx_clineno, __pyx_lineno, __pyx_filename); + __pyx_r = 0; + __pyx_L0:; + __Pyx_XGIVEREF(__pyx_r); + __Pyx_RefNannyFinishContext(); + return __pyx_r; +} + +/* "View.MemoryView":454 + * memoryview_copy_contents(msrc, mdst, src.ndim, dst.ndim, self.dtype_is_object) + * + * cdef setitem_slice_assign_scalar(self, memoryview dst, value): # <<<<<<<<<<<<<< + * cdef int array[128] + * cdef void *tmp = NULL +*/ + +static PyObject *__pyx_memoryview_setitem_slice_assign_scalar(struct __pyx_memoryview_obj *__pyx_v_self, struct __pyx_memoryview_obj *__pyx_v_dst, PyObject *__pyx_v_value) { + int __pyx_v_array[128]; + void *__pyx_v_tmp; + void *__pyx_v_item; + __Pyx_memviewslice *__pyx_v_dst_slice; + __Pyx_memviewslice __pyx_v_tmp_slice; + PyObject *__pyx_r = NULL; + __Pyx_RefNannyDeclarations + __Pyx_memviewslice *__pyx_t_1; + int __pyx_t_2; + PyObject *__pyx_t_3 = NULL; + int __pyx_t_4; + int __pyx_t_5; + char const *__pyx_t_6; + PyObject *__pyx_t_7 = NULL; + PyObject *__pyx_t_8 = NULL; + PyObject *__pyx_t_9 = NULL; + PyObject *__pyx_t_10 = NULL; + PyObject *__pyx_t_11 = NULL; + PyObject *__pyx_t_12 = NULL; + int __pyx_lineno = 0; + const char *__pyx_filename = NULL; + int __pyx_clineno = 0; + __Pyx_RefNannySetupContext("setitem_slice_assign_scalar", 0); + + /* "View.MemoryView":456 + * cdef setitem_slice_assign_scalar(self, memoryview dst, value): + * cdef int array[128] + * cdef void *tmp = NULL # <<<<<<<<<<<<<< + * cdef void *item + * +*/ + __pyx_v_tmp = NULL; + + /* "View.MemoryView":461 + * cdef __Pyx_memviewslice *dst_slice + * cdef __Pyx_memviewslice tmp_slice + * dst_slice = get_slice_from_memview(dst, &tmp_slice) # <<<<<<<<<<<<<< + * + * if self.view.itemsize > sizeof(array): +*/ + __pyx_t_1 = __pyx_memoryview_get_slice_from_memoryview(__pyx_v_dst, (&__pyx_v_tmp_slice)); if (unlikely(__pyx_t_1 == ((void *)NULL))) __PYX_ERR(1, 461, __pyx_L1_error) + __pyx_v_dst_slice = __pyx_t_1; + + /* "View.MemoryView":463 + * dst_slice = get_slice_from_memview(dst, &tmp_slice) + * + * if self.view.itemsize > sizeof(array): # <<<<<<<<<<<<<< + * tmp = PyMem_Malloc(self.view.itemsize) + * if tmp == NULL: +*/ + __pyx_t_2 = (((size_t)__pyx_v_self->view.itemsize) > (sizeof(__pyx_v_array))); + if (__pyx_t_2) { + + /* "View.MemoryView":464 + * + * if self.view.itemsize > sizeof(array): + * tmp = PyMem_Malloc(self.view.itemsize) # <<<<<<<<<<<<<< + * if tmp == NULL: + * raise MemoryError +*/ + __pyx_v_tmp = PyMem_Malloc(__pyx_v_self->view.itemsize); + + /* "View.MemoryView":465 + * if self.view.itemsize > sizeof(array): + * tmp = PyMem_Malloc(self.view.itemsize) + * if tmp == NULL: # <<<<<<<<<<<<<< + * raise MemoryError + * item = tmp +*/ + __pyx_t_2 = (__pyx_v_tmp == NULL); + if (unlikely(__pyx_t_2)) { + + /* "View.MemoryView":466 + * tmp = PyMem_Malloc(self.view.itemsize) + * if tmp == NULL: + * raise MemoryError # <<<<<<<<<<<<<< + * item = tmp + * else: +*/ + PyErr_NoMemory(); __PYX_ERR(1, 466, __pyx_L1_error) + + /* "View.MemoryView":465 + * if self.view.itemsize > sizeof(array): + * tmp = PyMem_Malloc(self.view.itemsize) + * if tmp == NULL: # <<<<<<<<<<<<<< + * raise MemoryError + * item = tmp +*/ + } + + /* "View.MemoryView":467 + * if tmp == NULL: + * raise MemoryError + * item = tmp # <<<<<<<<<<<<<< + * else: + * item = array +*/ + __pyx_v_item = __pyx_v_tmp; + + /* "View.MemoryView":463 + * dst_slice = get_slice_from_memview(dst, &tmp_slice) + * + * if self.view.itemsize > sizeof(array): # <<<<<<<<<<<<<< + * tmp = PyMem_Malloc(self.view.itemsize) + * if tmp == NULL: +*/ + goto __pyx_L3; + } + + /* "View.MemoryView":469 + * item = tmp + * else: + * item = array # <<<<<<<<<<<<<< + * + * try: +*/ + /*else*/ { + __pyx_v_item = ((void *)__pyx_v_array); + } + __pyx_L3:; + + /* "View.MemoryView":471 + * item = array + * + * try: # <<<<<<<<<<<<<< + * if self.dtype_is_object: + * ( item)[0] = value +*/ + /*try:*/ { + + /* "View.MemoryView":472 + * + * try: + * if self.dtype_is_object: # <<<<<<<<<<<<<< + * ( item)[0] = value + * else: +*/ + if (__pyx_v_self->dtype_is_object) { + + /* "View.MemoryView":473 + * try: + * if self.dtype_is_object: + * ( item)[0] = value # <<<<<<<<<<<<<< + * else: + * self.assign_item_from_object( item, value) +*/ + (((PyObject **)__pyx_v_item)[0]) = ((PyObject *)__pyx_v_value); + + /* "View.MemoryView":472 + * + * try: + * if self.dtype_is_object: # <<<<<<<<<<<<<< + * ( item)[0] = value + * else: +*/ + goto __pyx_L8; + } + + /* "View.MemoryView":475 + * ( item)[0] = value + * else: + * self.assign_item_from_object( item, value) # <<<<<<<<<<<<<< + * + * +*/ + /*else*/ { + __pyx_t_3 = ((struct __pyx_vtabstruct_memoryview *)__pyx_v_self->__pyx_vtab)->assign_item_from_object(__pyx_v_self, ((char *)__pyx_v_item), __pyx_v_value); if (unlikely(!__pyx_t_3)) __PYX_ERR(1, 475, __pyx_L6_error) + __Pyx_GOTREF(__pyx_t_3); + __Pyx_DECREF(__pyx_t_3); __pyx_t_3 = 0; + } + __pyx_L8:; + + /* "View.MemoryView":479 + * + * + * if self.view.suboffsets != NULL: # <<<<<<<<<<<<<< + * assert_direct_dimensions(self.view.suboffsets, self.view.ndim) + * slice_assign_scalar(dst_slice, dst.view.ndim, self.view.itemsize, +*/ + __pyx_t_2 = (__pyx_v_self->view.suboffsets != NULL); + if (__pyx_t_2) { + + /* "View.MemoryView":480 + * + * if self.view.suboffsets != NULL: + * assert_direct_dimensions(self.view.suboffsets, self.view.ndim) # <<<<<<<<<<<<<< + * slice_assign_scalar(dst_slice, dst.view.ndim, self.view.itemsize, + * item, self.dtype_is_object) +*/ + __pyx_t_4 = assert_direct_dimensions(__pyx_v_self->view.suboffsets, __pyx_v_self->view.ndim); if (unlikely(__pyx_t_4 == ((int)-1))) __PYX_ERR(1, 480, __pyx_L6_error) + + /* "View.MemoryView":479 + * + * + * if self.view.suboffsets != NULL: # <<<<<<<<<<<<<< + * assert_direct_dimensions(self.view.suboffsets, self.view.ndim) + * slice_assign_scalar(dst_slice, dst.view.ndim, self.view.itemsize, +*/ + } + + /* "View.MemoryView":481 + * if self.view.suboffsets != NULL: + * assert_direct_dimensions(self.view.suboffsets, self.view.ndim) + * slice_assign_scalar(dst_slice, dst.view.ndim, self.view.itemsize, # <<<<<<<<<<<<<< + * item, self.dtype_is_object) + * finally: +*/ + __pyx_memoryview_slice_assign_scalar(__pyx_v_dst_slice, __pyx_v_dst->view.ndim, __pyx_v_self->view.itemsize, __pyx_v_item, __pyx_v_self->dtype_is_object); + } + + /* "View.MemoryView":484 + * item, self.dtype_is_object) + * finally: + * PyMem_Free(tmp) # <<<<<<<<<<<<<< + * + * cdef setitem_indexed(self, index, value): +*/ + /*finally:*/ { + /*normal exit:*/{ + PyMem_Free(__pyx_v_tmp); + goto __pyx_L7; + } + __pyx_L6_error:; + /*exception exit:*/{ + __Pyx_PyThreadState_declare + __Pyx_PyThreadState_assign + __pyx_t_7 = 0; __pyx_t_8 = 0; __pyx_t_9 = 0; __pyx_t_10 = 0; __pyx_t_11 = 0; __pyx_t_12 = 0; + __Pyx_XDECREF(__pyx_t_3); __pyx_t_3 = 0; + __Pyx_ExceptionSwap(&__pyx_t_10, &__pyx_t_11, &__pyx_t_12); + if ( unlikely(__Pyx_GetException(&__pyx_t_7, &__pyx_t_8, &__pyx_t_9) < 0)) __Pyx_ErrFetch(&__pyx_t_7, &__pyx_t_8, &__pyx_t_9); + __Pyx_XGOTREF(__pyx_t_7); + __Pyx_XGOTREF(__pyx_t_8); + __Pyx_XGOTREF(__pyx_t_9); + __Pyx_XGOTREF(__pyx_t_10); + __Pyx_XGOTREF(__pyx_t_11); + __Pyx_XGOTREF(__pyx_t_12); + __pyx_t_4 = __pyx_lineno; __pyx_t_5 = __pyx_clineno; __pyx_t_6 = __pyx_filename; + { + PyMem_Free(__pyx_v_tmp); + } + __Pyx_XGIVEREF(__pyx_t_10); + __Pyx_XGIVEREF(__pyx_t_11); + __Pyx_XGIVEREF(__pyx_t_12); + __Pyx_ExceptionReset(__pyx_t_10, __pyx_t_11, __pyx_t_12); + __Pyx_XGIVEREF(__pyx_t_7); + __Pyx_XGIVEREF(__pyx_t_8); + __Pyx_XGIVEREF(__pyx_t_9); + __Pyx_ErrRestore(__pyx_t_7, __pyx_t_8, __pyx_t_9); + __pyx_t_7 = 0; __pyx_t_8 = 0; __pyx_t_9 = 0; __pyx_t_10 = 0; __pyx_t_11 = 0; __pyx_t_12 = 0; + __pyx_lineno = __pyx_t_4; __pyx_clineno = __pyx_t_5; __pyx_filename = __pyx_t_6; + goto __pyx_L1_error; + } + __pyx_L7:; + } + + /* "View.MemoryView":454 + * memoryview_copy_contents(msrc, mdst, src.ndim, dst.ndim, self.dtype_is_object) + * + * cdef setitem_slice_assign_scalar(self, memoryview dst, value): # <<<<<<<<<<<<<< + * cdef int array[128] + * cdef void *tmp = NULL +*/ + + /* function exit code */ + __pyx_r = Py_None; __Pyx_INCREF(Py_None); + goto __pyx_L0; + __pyx_L1_error:; + __Pyx_XDECREF(__pyx_t_3); + __Pyx_AddTraceback("View.MemoryView.memoryview.setitem_slice_assign_scalar", __pyx_clineno, __pyx_lineno, __pyx_filename); + __pyx_r = 0; + __pyx_L0:; + __Pyx_XGIVEREF(__pyx_r); + __Pyx_RefNannyFinishContext(); + return __pyx_r; +} + +/* "View.MemoryView":486 + * PyMem_Free(tmp) + * + * cdef setitem_indexed(self, index, value): # <<<<<<<<<<<<<< + * cdef char *itemp = self.get_item_pointer(index) + * self.assign_item_from_object(itemp, value) +*/ + +static PyObject *__pyx_memoryview_setitem_indexed(struct __pyx_memoryview_obj *__pyx_v_self, PyObject *__pyx_v_index, PyObject *__pyx_v_value) { + char *__pyx_v_itemp; + PyObject *__pyx_r = NULL; + __Pyx_RefNannyDeclarations + char *__pyx_t_1; + PyObject *__pyx_t_2 = NULL; + int __pyx_lineno = 0; + const char *__pyx_filename = NULL; + int __pyx_clineno = 0; + __Pyx_RefNannySetupContext("setitem_indexed", 0); + + /* "View.MemoryView":487 + * + * cdef setitem_indexed(self, index, value): + * cdef char *itemp = self.get_item_pointer(index) # <<<<<<<<<<<<<< + * self.assign_item_from_object(itemp, value) + * +*/ + __pyx_t_1 = ((struct __pyx_vtabstruct_memoryview *)__pyx_v_self->__pyx_vtab)->get_item_pointer(__pyx_v_self, __pyx_v_index); if (unlikely(__pyx_t_1 == ((void *)NULL))) __PYX_ERR(1, 487, __pyx_L1_error) + __pyx_v_itemp = __pyx_t_1; + + /* "View.MemoryView":488 + * cdef setitem_indexed(self, index, value): + * cdef char *itemp = self.get_item_pointer(index) + * self.assign_item_from_object(itemp, value) # <<<<<<<<<<<<<< + * + * cdef convert_item_to_object(self, char *itemp): +*/ + __pyx_t_2 = ((struct __pyx_vtabstruct_memoryview *)__pyx_v_self->__pyx_vtab)->assign_item_from_object(__pyx_v_self, __pyx_v_itemp, __pyx_v_value); if (unlikely(!__pyx_t_2)) __PYX_ERR(1, 488, __pyx_L1_error) + __Pyx_GOTREF(__pyx_t_2); + __Pyx_DECREF(__pyx_t_2); __pyx_t_2 = 0; + + /* "View.MemoryView":486 + * PyMem_Free(tmp) + * + * cdef setitem_indexed(self, index, value): # <<<<<<<<<<<<<< + * cdef char *itemp = self.get_item_pointer(index) + * self.assign_item_from_object(itemp, value) +*/ + + /* function exit code */ + __pyx_r = Py_None; __Pyx_INCREF(Py_None); + goto __pyx_L0; + __pyx_L1_error:; + __Pyx_XDECREF(__pyx_t_2); + __Pyx_AddTraceback("View.MemoryView.memoryview.setitem_indexed", __pyx_clineno, __pyx_lineno, __pyx_filename); + __pyx_r = 0; + __pyx_L0:; + __Pyx_XGIVEREF(__pyx_r); + __Pyx_RefNannyFinishContext(); + return __pyx_r; +} + +/* "View.MemoryView":490 + * self.assign_item_from_object(itemp, value) + * + * cdef convert_item_to_object(self, char *itemp): # <<<<<<<<<<<<<< + * """Only used if instantiated manually by the user, or if Cython doesn't + * know how to convert the type""" +*/ + +static PyObject *__pyx_memoryview_convert_item_to_object(struct __pyx_memoryview_obj *__pyx_v_self, char *__pyx_v_itemp) { + PyObject *__pyx_v_struct = NULL; + PyObject *__pyx_v_bytesitem = 0; + PyObject *__pyx_v_result = NULL; + PyObject *__pyx_r = NULL; + __Pyx_RefNannyDeclarations + PyObject *__pyx_t_1 = NULL; + PyObject *__pyx_t_2 = NULL; + PyObject *__pyx_t_3 = NULL; + PyObject *__pyx_t_4 = NULL; + PyObject *__pyx_t_5 = NULL; + PyObject *__pyx_t_6 = NULL; + size_t __pyx_t_7; + Py_ssize_t __pyx_t_8; + int __pyx_t_9; + PyObject *__pyx_t_10 = NULL; + int __pyx_t_11; + int __pyx_lineno = 0; + const char *__pyx_filename = NULL; + int __pyx_clineno = 0; + __Pyx_RefNannySetupContext("convert_item_to_object", 0); + + /* "View.MemoryView":493 + * """Only used if instantiated manually by the user, or if Cython doesn't + * know how to convert the type""" + * import struct # <<<<<<<<<<<<<< + * cdef bytes bytesitem + * +*/ + __pyx_t_2 = __Pyx_Import(__pyx_mstate_global->__pyx_n_u_struct, 0, 0, NULL, 0); if (unlikely(!__pyx_t_2)) __PYX_ERR(1, 493, __pyx_L1_error) + __pyx_t_1 = __pyx_t_2; + __Pyx_GOTREF(__pyx_t_1); + __pyx_v_struct = __pyx_t_1; + __pyx_t_1 = 0; + + /* "View.MemoryView":496 + * cdef bytes bytesitem + * + * bytesitem = itemp[:self.view.itemsize] # <<<<<<<<<<<<<< + * try: + * result = struct.unpack(self.view.format, bytesitem) +*/ + __pyx_t_1 = __Pyx_PyBytes_FromStringAndSize(__pyx_v_itemp + 0, __pyx_v_self->view.itemsize - 0); if (unlikely(!__pyx_t_1)) __PYX_ERR(1, 496, __pyx_L1_error) + __Pyx_GOTREF(__pyx_t_1); + __pyx_v_bytesitem = ((PyObject*)__pyx_t_1); + __pyx_t_1 = 0; + + /* "View.MemoryView":497 + * + * bytesitem = itemp[:self.view.itemsize] + * try: # <<<<<<<<<<<<<< + * result = struct.unpack(self.view.format, bytesitem) + * except struct.error: +*/ + { + __Pyx_PyThreadState_declare + __Pyx_PyThreadState_assign + __Pyx_ExceptionSave(&__pyx_t_2, &__pyx_t_3, &__pyx_t_4); + __Pyx_XGOTREF(__pyx_t_2); + __Pyx_XGOTREF(__pyx_t_3); + __Pyx_XGOTREF(__pyx_t_4); + /*try:*/ { + + /* "View.MemoryView":498 + * bytesitem = itemp[:self.view.itemsize] + * try: + * result = struct.unpack(self.view.format, bytesitem) # <<<<<<<<<<<<<< + * except struct.error: + * raise ValueError, "Unable to convert item to object" +*/ + __pyx_t_5 = __pyx_v_struct; + __Pyx_INCREF(__pyx_t_5); + __pyx_t_6 = __Pyx_PyBytes_FromString(__pyx_v_self->view.format); if (unlikely(!__pyx_t_6)) __PYX_ERR(1, 498, __pyx_L3_error) + __Pyx_GOTREF(__pyx_t_6); + __pyx_t_7 = 0; + { + PyObject *__pyx_callargs[3] = {__pyx_t_5, __pyx_t_6, __pyx_v_bytesitem}; + __pyx_t_1 = __Pyx_PyObject_FastCallMethod((PyObject*)__pyx_mstate_global->__pyx_n_u_unpack, __pyx_callargs+__pyx_t_7, (3-__pyx_t_7) | (1*__Pyx_PY_VECTORCALL_ARGUMENTS_OFFSET)); + __Pyx_XDECREF(__pyx_t_5); __pyx_t_5 = 0; + __Pyx_DECREF(__pyx_t_6); __pyx_t_6 = 0; + if (unlikely(!__pyx_t_1)) __PYX_ERR(1, 498, __pyx_L3_error) + __Pyx_GOTREF(__pyx_t_1); + } + __pyx_v_result = __pyx_t_1; + __pyx_t_1 = 0; + + /* "View.MemoryView":497 + * + * bytesitem = itemp[:self.view.itemsize] + * try: # <<<<<<<<<<<<<< + * result = struct.unpack(self.view.format, bytesitem) + * except struct.error: +*/ + } + + /* "View.MemoryView":502 + * raise ValueError, "Unable to convert item to object" + * else: + * if len(self.view.format) == 1: # <<<<<<<<<<<<<< + * return result[0] + * return result +*/ + /*else:*/ { + __pyx_t_8 = __Pyx_ssize_strlen(__pyx_v_self->view.format); if (unlikely(__pyx_t_8 == ((Py_ssize_t)-1))) __PYX_ERR(1, 502, __pyx_L5_except_error) + __pyx_t_9 = (__pyx_t_8 == 1); + if (__pyx_t_9) { + + /* "View.MemoryView":503 + * else: + * if len(self.view.format) == 1: + * return result[0] # <<<<<<<<<<<<<< + * return result + * +*/ + __Pyx_XDECREF(__pyx_r); + __pyx_t_1 = __Pyx_GetItemInt(__pyx_v_result, 0, long, 1, __Pyx_PyLong_From_long, 0, 0, 1, 1, __Pyx_ReferenceSharing_OwnStrongReference); if (unlikely(!__pyx_t_1)) __PYX_ERR(1, 503, __pyx_L5_except_error) + __Pyx_GOTREF(__pyx_t_1); + __pyx_r = __pyx_t_1; + __pyx_t_1 = 0; + goto __pyx_L6_except_return; + + /* "View.MemoryView":502 + * raise ValueError, "Unable to convert item to object" + * else: + * if len(self.view.format) == 1: # <<<<<<<<<<<<<< + * return result[0] + * return result +*/ + } + + /* "View.MemoryView":504 + * if len(self.view.format) == 1: + * return result[0] + * return result # <<<<<<<<<<<<<< + * + * cdef assign_item_from_object(self, char *itemp, object value): +*/ + __Pyx_XDECREF(__pyx_r); + __Pyx_INCREF(__pyx_v_result); + __pyx_r = __pyx_v_result; + goto __pyx_L6_except_return; + } + __pyx_L3_error:; + __Pyx_XDECREF(__pyx_t_1); __pyx_t_1 = 0; + __Pyx_XDECREF(__pyx_t_5); __pyx_t_5 = 0; + __Pyx_XDECREF(__pyx_t_6); __pyx_t_6 = 0; + + /* "View.MemoryView":499 + * try: + * result = struct.unpack(self.view.format, bytesitem) + * except struct.error: # <<<<<<<<<<<<<< + * raise ValueError, "Unable to convert item to object" + * else: +*/ + __Pyx_ErrFetch(&__pyx_t_1, &__pyx_t_6, &__pyx_t_5); + __pyx_t_10 = __Pyx_PyObject_GetAttrStr(__pyx_v_struct, __pyx_mstate_global->__pyx_n_u_error); if (unlikely(!__pyx_t_10)) __PYX_ERR(1, 499, __pyx_L5_except_error) + __Pyx_GOTREF(__pyx_t_10); + __pyx_t_11 = __Pyx_PyErr_GivenExceptionMatches(__pyx_t_1, __pyx_t_10); + __Pyx_DECREF(__pyx_t_10); __pyx_t_10 = 0; + __Pyx_ErrRestore(__pyx_t_1, __pyx_t_6, __pyx_t_5); + __pyx_t_1 = 0; __pyx_t_6 = 0; __pyx_t_5 = 0; + if (__pyx_t_11) { + __Pyx_AddTraceback("View.MemoryView.memoryview.convert_item_to_object", __pyx_clineno, __pyx_lineno, __pyx_filename); + if (__Pyx_GetException(&__pyx_t_5, &__pyx_t_6, &__pyx_t_1) < 0) __PYX_ERR(1, 499, __pyx_L5_except_error) + __Pyx_XGOTREF(__pyx_t_5); + __Pyx_XGOTREF(__pyx_t_6); + __Pyx_XGOTREF(__pyx_t_1); + + /* "View.MemoryView":500 + * result = struct.unpack(self.view.format, bytesitem) + * except struct.error: + * raise ValueError, "Unable to convert item to object" # <<<<<<<<<<<<<< + * else: + * if len(self.view.format) == 1: +*/ + __Pyx_Raise(((PyObject *)(((PyTypeObject*)PyExc_ValueError))), __pyx_mstate_global->__pyx_kp_u_Unable_to_convert_item_to_object, 0, 0); + __PYX_ERR(1, 500, __pyx_L5_except_error) + } + goto __pyx_L5_except_error; + + /* "View.MemoryView":497 + * + * bytesitem = itemp[:self.view.itemsize] + * try: # <<<<<<<<<<<<<< + * result = struct.unpack(self.view.format, bytesitem) + * except struct.error: +*/ + __pyx_L5_except_error:; + __Pyx_XGIVEREF(__pyx_t_2); + __Pyx_XGIVEREF(__pyx_t_3); + __Pyx_XGIVEREF(__pyx_t_4); + __Pyx_ExceptionReset(__pyx_t_2, __pyx_t_3, __pyx_t_4); + goto __pyx_L1_error; + __pyx_L6_except_return:; + __Pyx_XGIVEREF(__pyx_t_2); + __Pyx_XGIVEREF(__pyx_t_3); + __Pyx_XGIVEREF(__pyx_t_4); + __Pyx_ExceptionReset(__pyx_t_2, __pyx_t_3, __pyx_t_4); + goto __pyx_L0; + } + + /* "View.MemoryView":490 + * self.assign_item_from_object(itemp, value) + * + * cdef convert_item_to_object(self, char *itemp): # <<<<<<<<<<<<<< + * """Only used if instantiated manually by the user, or if Cython doesn't + * know how to convert the type""" +*/ + + /* function exit code */ + __pyx_L1_error:; + __Pyx_XDECREF(__pyx_t_1); + __Pyx_XDECREF(__pyx_t_5); + __Pyx_XDECREF(__pyx_t_6); + __Pyx_XDECREF(__pyx_t_10); + __Pyx_AddTraceback("View.MemoryView.memoryview.convert_item_to_object", __pyx_clineno, __pyx_lineno, __pyx_filename); + __pyx_r = 0; + __pyx_L0:; + __Pyx_XDECREF(__pyx_v_struct); + __Pyx_XDECREF(__pyx_v_bytesitem); + __Pyx_XDECREF(__pyx_v_result); + __Pyx_XGIVEREF(__pyx_r); + __Pyx_RefNannyFinishContext(); + return __pyx_r; +} + +/* "View.MemoryView":506 + * return result + * + * cdef assign_item_from_object(self, char *itemp, object value): # <<<<<<<<<<<<<< + * """Only used if instantiated manually by the user, or if Cython doesn't + * know how to convert the type""" +*/ + +static PyObject *__pyx_memoryview_assign_item_from_object(struct __pyx_memoryview_obj *__pyx_v_self, char *__pyx_v_itemp, PyObject *__pyx_v_value) { + PyObject *__pyx_v_struct = NULL; + char __pyx_v_c; + PyObject *__pyx_v_bytesvalue = 0; + Py_ssize_t __pyx_v_i; + PyObject *__pyx_r = NULL; + __Pyx_RefNannyDeclarations + PyObject *__pyx_t_1 = NULL; + PyObject *__pyx_t_2 = NULL; + int __pyx_t_3; + PyObject *__pyx_t_4 = NULL; + PyObject *__pyx_t_5 = NULL; + PyObject *__pyx_t_6 = NULL; + size_t __pyx_t_7; + Py_ssize_t __pyx_t_8; + PyObject *__pyx_t_9 = NULL; + char *__pyx_t_10; + char *__pyx_t_11; + Py_ssize_t __pyx_t_12; + char *__pyx_t_13; + char *__pyx_t_14; + int __pyx_lineno = 0; + const char *__pyx_filename = NULL; + int __pyx_clineno = 0; + __Pyx_RefNannySetupContext("assign_item_from_object", 0); + + /* "View.MemoryView":509 + * """Only used if instantiated manually by the user, or if Cython doesn't + * know how to convert the type""" + * import struct # <<<<<<<<<<<<<< + * cdef char c + * cdef bytes bytesvalue +*/ + __pyx_t_2 = __Pyx_Import(__pyx_mstate_global->__pyx_n_u_struct, 0, 0, NULL, 0); if (unlikely(!__pyx_t_2)) __PYX_ERR(1, 509, __pyx_L1_error) + __pyx_t_1 = __pyx_t_2; + __Pyx_GOTREF(__pyx_t_1); + __pyx_v_struct = __pyx_t_1; + __pyx_t_1 = 0; + + /* "View.MemoryView":514 + * cdef Py_ssize_t i + * + * if isinstance(value, tuple): # <<<<<<<<<<<<<< + * bytesvalue = struct.pack(self.view.format, *value) + * else: +*/ + __pyx_t_3 = PyTuple_Check(__pyx_v_value); + if (__pyx_t_3) { + + /* "View.MemoryView":515 + * + * if isinstance(value, tuple): + * bytesvalue = struct.pack(self.view.format, *value) # <<<<<<<<<<<<<< + * else: + * bytesvalue = struct.pack(self.view.format, value) +*/ + __pyx_t_1 = __Pyx_PyObject_GetAttrStr(__pyx_v_struct, __pyx_mstate_global->__pyx_n_u_pack); if (unlikely(!__pyx_t_1)) __PYX_ERR(1, 515, __pyx_L1_error) + __Pyx_GOTREF(__pyx_t_1); + __pyx_t_4 = __Pyx_PyBytes_FromString(__pyx_v_self->view.format); if (unlikely(!__pyx_t_4)) __PYX_ERR(1, 515, __pyx_L1_error) + __Pyx_GOTREF(__pyx_t_4); + __pyx_t_5 = PyTuple_New(1); if (unlikely(!__pyx_t_5)) __PYX_ERR(1, 515, __pyx_L1_error) + __Pyx_GOTREF(__pyx_t_5); + __Pyx_GIVEREF(__pyx_t_4); + if (__Pyx_PyTuple_SET_ITEM(__pyx_t_5, 0, __pyx_t_4) != (0)) __PYX_ERR(1, 515, __pyx_L1_error); + __pyx_t_4 = 0; + __pyx_t_4 = __Pyx_PySequence_Tuple(__pyx_v_value); if (unlikely(!__pyx_t_4)) __PYX_ERR(1, 515, __pyx_L1_error) + __Pyx_GOTREF(__pyx_t_4); + __pyx_t_6 = PyNumber_Add(__pyx_t_5, __pyx_t_4); if (unlikely(!__pyx_t_6)) __PYX_ERR(1, 515, __pyx_L1_error) + __Pyx_GOTREF(__pyx_t_6); + __Pyx_DECREF(__pyx_t_5); __pyx_t_5 = 0; + __Pyx_DECREF(__pyx_t_4); __pyx_t_4 = 0; + __pyx_t_4 = __Pyx_PyObject_Call(__pyx_t_1, __pyx_t_6, NULL); if (unlikely(!__pyx_t_4)) __PYX_ERR(1, 515, __pyx_L1_error) + __Pyx_GOTREF(__pyx_t_4); + __Pyx_DECREF(__pyx_t_1); __pyx_t_1 = 0; + __Pyx_DECREF(__pyx_t_6); __pyx_t_6 = 0; + if (!(likely(PyBytes_CheckExact(__pyx_t_4))||((__pyx_t_4) == Py_None) || __Pyx_RaiseUnexpectedTypeError("bytes", __pyx_t_4))) __PYX_ERR(1, 515, __pyx_L1_error) + __pyx_v_bytesvalue = ((PyObject*)__pyx_t_4); + __pyx_t_4 = 0; + + /* "View.MemoryView":514 + * cdef Py_ssize_t i + * + * if isinstance(value, tuple): # <<<<<<<<<<<<<< + * bytesvalue = struct.pack(self.view.format, *value) + * else: +*/ + goto __pyx_L3; + } + + /* "View.MemoryView":517 + * bytesvalue = struct.pack(self.view.format, *value) + * else: + * bytesvalue = struct.pack(self.view.format, value) # <<<<<<<<<<<<<< + * + * for i, c in enumerate(bytesvalue): +*/ + /*else*/ { + __pyx_t_6 = __pyx_v_struct; + __Pyx_INCREF(__pyx_t_6); + __pyx_t_1 = __Pyx_PyBytes_FromString(__pyx_v_self->view.format); if (unlikely(!__pyx_t_1)) __PYX_ERR(1, 517, __pyx_L1_error) + __Pyx_GOTREF(__pyx_t_1); + __pyx_t_7 = 0; + { + PyObject *__pyx_callargs[3] = {__pyx_t_6, __pyx_t_1, __pyx_v_value}; + __pyx_t_4 = __Pyx_PyObject_FastCallMethod((PyObject*)__pyx_mstate_global->__pyx_n_u_pack, __pyx_callargs+__pyx_t_7, (3-__pyx_t_7) | (1*__Pyx_PY_VECTORCALL_ARGUMENTS_OFFSET)); + __Pyx_XDECREF(__pyx_t_6); __pyx_t_6 = 0; + __Pyx_DECREF(__pyx_t_1); __pyx_t_1 = 0; + if (unlikely(!__pyx_t_4)) __PYX_ERR(1, 517, __pyx_L1_error) + __Pyx_GOTREF(__pyx_t_4); + } + if (!(likely(PyBytes_CheckExact(__pyx_t_4))||((__pyx_t_4) == Py_None) || __Pyx_RaiseUnexpectedTypeError("bytes", __pyx_t_4))) __PYX_ERR(1, 517, __pyx_L1_error) + __pyx_v_bytesvalue = ((PyObject*)__pyx_t_4); + __pyx_t_4 = 0; + } + __pyx_L3:; + + /* "View.MemoryView":519 + * bytesvalue = struct.pack(self.view.format, value) + * + * for i, c in enumerate(bytesvalue): # <<<<<<<<<<<<<< + * itemp[i] = c + * +*/ + __pyx_t_8 = 0; + if (unlikely(__pyx_v_bytesvalue == Py_None)) { + PyErr_SetString(PyExc_TypeError, "'NoneType' is not iterable"); + __PYX_ERR(1, 519, __pyx_L1_error) + } + __Pyx_INCREF(__pyx_v_bytesvalue); + __pyx_t_9 = __pyx_v_bytesvalue; + __pyx_t_11 = __Pyx_PyBytes_AsWritableString(__pyx_t_9); if (unlikely(__pyx_t_11 == ((char *)NULL))) __PYX_ERR(1, 519, __pyx_L1_error) + __pyx_t_12 = __Pyx_PyBytes_GET_SIZE(__pyx_t_9); if (unlikely(__pyx_t_12 == ((Py_ssize_t)-1))) __PYX_ERR(1, 519, __pyx_L1_error) + __pyx_t_13 = (__pyx_t_11 + __pyx_t_12); + for (__pyx_t_14 = __pyx_t_11; __pyx_t_14 < __pyx_t_13; __pyx_t_14++) { + __pyx_t_10 = __pyx_t_14; + __pyx_v_c = (__pyx_t_10[0]); + + /* "View.MemoryView":520 + * + * for i, c in enumerate(bytesvalue): + * itemp[i] = c # <<<<<<<<<<<<<< + * + * @cname('getbuffer') +*/ + __pyx_v_i = __pyx_t_8; + + /* "View.MemoryView":519 + * bytesvalue = struct.pack(self.view.format, value) + * + * for i, c in enumerate(bytesvalue): # <<<<<<<<<<<<<< + * itemp[i] = c + * +*/ + __pyx_t_8 = (__pyx_t_8 + 1); + + /* "View.MemoryView":520 + * + * for i, c in enumerate(bytesvalue): + * itemp[i] = c # <<<<<<<<<<<<<< + * + * @cname('getbuffer') +*/ + (__pyx_v_itemp[__pyx_v_i]) = __pyx_v_c; + } + __Pyx_DECREF(__pyx_t_9); __pyx_t_9 = 0; + + /* "View.MemoryView":506 + * return result + * + * cdef assign_item_from_object(self, char *itemp, object value): # <<<<<<<<<<<<<< + * """Only used if instantiated manually by the user, or if Cython doesn't + * know how to convert the 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_4); + __Pyx_XDECREF(__pyx_t_5); + __Pyx_XDECREF(__pyx_t_6); + __Pyx_XDECREF(__pyx_t_9); + __Pyx_AddTraceback("View.MemoryView.memoryview.assign_item_from_object", __pyx_clineno, __pyx_lineno, __pyx_filename); + __pyx_r = 0; + __pyx_L0:; + __Pyx_XDECREF(__pyx_v_struct); + __Pyx_XDECREF(__pyx_v_bytesvalue); + __Pyx_XGIVEREF(__pyx_r); + __Pyx_RefNannyFinishContext(); + return __pyx_r; +} + +/* "View.MemoryView":522 + * itemp[i] = c + * + * @cname('getbuffer') # <<<<<<<<<<<<<< + * def __getbuffer__(self, Py_buffer *info, int flags): + * if flags & PyBUF_WRITABLE and self.view.readonly: +*/ + +/* Python wrapper */ +CYTHON_UNUSED static int __pyx_memoryview_getbuffer(PyObject *__pyx_v_self, Py_buffer *__pyx_v_info, int __pyx_v_flags); /*proto*/ +CYTHON_UNUSED static int __pyx_memoryview_getbuffer(PyObject *__pyx_v_self, Py_buffer *__pyx_v_info, int __pyx_v_flags) { + CYTHON_UNUSED PyObject *const *__pyx_kwvalues; + int __pyx_r; + __Pyx_RefNannyDeclarations + __Pyx_RefNannySetupContext("__getbuffer__ (wrapper)", 0); + __pyx_kwvalues = __Pyx_KwValues_VARARGS(__pyx_args, __pyx_nargs); + __pyx_r = __pyx_memoryview___pyx_pf_15View_dot_MemoryView_10memoryview_8__getbuffer__(((struct __pyx_memoryview_obj *)__pyx_v_self), ((Py_buffer *)__pyx_v_info), ((int)__pyx_v_flags)); + + /* function exit code */ + __Pyx_RefNannyFinishContext(); + return __pyx_r; +} + +static int __pyx_memoryview___pyx_pf_15View_dot_MemoryView_10memoryview_8__getbuffer__(struct __pyx_memoryview_obj *__pyx_v_self, Py_buffer *__pyx_v_info, int __pyx_v_flags) { + int __pyx_r; + __Pyx_RefNannyDeclarations + int __pyx_t_1; + int __pyx_t_2; + Py_ssize_t *__pyx_t_3; + char *__pyx_t_4; + void *__pyx_t_5; + int __pyx_t_6; + Py_ssize_t __pyx_t_7; + int __pyx_lineno = 0; + const char *__pyx_filename = NULL; + int __pyx_clineno = 0; + if (unlikely(__pyx_v_info == NULL)) { + PyErr_SetString(PyExc_BufferError, "PyObject_GetBuffer: view==NULL argument is obsolete"); + return -1; + } + __Pyx_RefNannySetupContext("__getbuffer__", 0); + __pyx_v_info->obj = Py_None; __Pyx_INCREF(Py_None); + __Pyx_GIVEREF(__pyx_v_info->obj); + + /* "View.MemoryView":524 + * @cname('getbuffer') + * def __getbuffer__(self, Py_buffer *info, int flags): + * if flags & PyBUF_WRITABLE and self.view.readonly: # <<<<<<<<<<<<<< + * raise ValueError, "Cannot create writable memory view from read-only memoryview" + * +*/ + __pyx_t_2 = ((__pyx_v_flags & PyBUF_WRITABLE) != 0); + if (__pyx_t_2) { + } else { + __pyx_t_1 = __pyx_t_2; + goto __pyx_L4_bool_binop_done; + } + __pyx_t_1 = __pyx_v_self->view.readonly; + __pyx_L4_bool_binop_done:; + if (unlikely(__pyx_t_1)) { + + /* "View.MemoryView":525 + * def __getbuffer__(self, Py_buffer *info, int flags): + * if flags & PyBUF_WRITABLE and self.view.readonly: + * raise ValueError, "Cannot create writable memory view from read-only memoryview" # <<<<<<<<<<<<<< + * + * if flags & PyBUF_ND: +*/ + __Pyx_Raise(((PyObject *)(((PyTypeObject*)PyExc_ValueError))), __pyx_mstate_global->__pyx_kp_u_Cannot_create_writable_memory_vi, 0, 0); + __PYX_ERR(1, 525, __pyx_L1_error) + + /* "View.MemoryView":524 + * @cname('getbuffer') + * def __getbuffer__(self, Py_buffer *info, int flags): + * if flags & PyBUF_WRITABLE and self.view.readonly: # <<<<<<<<<<<<<< + * raise ValueError, "Cannot create writable memory view from read-only memoryview" + * +*/ + } + + /* "View.MemoryView":527 + * raise ValueError, "Cannot create writable memory view from read-only memoryview" + * + * if flags & PyBUF_ND: # <<<<<<<<<<<<<< + * info.shape = self.view.shape + * else: +*/ + __pyx_t_1 = ((__pyx_v_flags & PyBUF_ND) != 0); + if (__pyx_t_1) { + + /* "View.MemoryView":528 + * + * if flags & PyBUF_ND: + * info.shape = self.view.shape # <<<<<<<<<<<<<< + * else: + * info.shape = NULL +*/ + __pyx_t_3 = __pyx_v_self->view.shape; + __pyx_v_info->shape = __pyx_t_3; + + /* "View.MemoryView":527 + * raise ValueError, "Cannot create writable memory view from read-only memoryview" + * + * if flags & PyBUF_ND: # <<<<<<<<<<<<<< + * info.shape = self.view.shape + * else: +*/ + goto __pyx_L6; + } + + /* "View.MemoryView":530 + * info.shape = self.view.shape + * else: + * info.shape = NULL # <<<<<<<<<<<<<< + * + * if flags & PyBUF_STRIDES: +*/ + /*else*/ { + __pyx_v_info->shape = NULL; + } + __pyx_L6:; + + /* "View.MemoryView":532 + * info.shape = NULL + * + * if flags & PyBUF_STRIDES: # <<<<<<<<<<<<<< + * info.strides = self.view.strides + * else: +*/ + __pyx_t_1 = ((__pyx_v_flags & PyBUF_STRIDES) != 0); + if (__pyx_t_1) { + + /* "View.MemoryView":533 + * + * if flags & PyBUF_STRIDES: + * info.strides = self.view.strides # <<<<<<<<<<<<<< + * else: + * info.strides = NULL +*/ + __pyx_t_3 = __pyx_v_self->view.strides; + __pyx_v_info->strides = __pyx_t_3; + + /* "View.MemoryView":532 + * info.shape = NULL + * + * if flags & PyBUF_STRIDES: # <<<<<<<<<<<<<< + * info.strides = self.view.strides + * else: +*/ + goto __pyx_L7; + } + + /* "View.MemoryView":535 + * info.strides = self.view.strides + * else: + * info.strides = NULL # <<<<<<<<<<<<<< + * + * if flags & PyBUF_INDIRECT: +*/ + /*else*/ { + __pyx_v_info->strides = NULL; + } + __pyx_L7:; + + /* "View.MemoryView":537 + * info.strides = NULL + * + * if flags & PyBUF_INDIRECT: # <<<<<<<<<<<<<< + * info.suboffsets = self.view.suboffsets + * else: +*/ + __pyx_t_1 = ((__pyx_v_flags & PyBUF_INDIRECT) != 0); + if (__pyx_t_1) { + + /* "View.MemoryView":538 + * + * if flags & PyBUF_INDIRECT: + * info.suboffsets = self.view.suboffsets # <<<<<<<<<<<<<< + * else: + * info.suboffsets = NULL +*/ + __pyx_t_3 = __pyx_v_self->view.suboffsets; + __pyx_v_info->suboffsets = __pyx_t_3; + + /* "View.MemoryView":537 + * info.strides = NULL + * + * if flags & PyBUF_INDIRECT: # <<<<<<<<<<<<<< + * info.suboffsets = self.view.suboffsets + * else: +*/ + goto __pyx_L8; + } + + /* "View.MemoryView":540 + * info.suboffsets = self.view.suboffsets + * else: + * info.suboffsets = NULL # <<<<<<<<<<<<<< + * + * if flags & PyBUF_FORMAT: +*/ + /*else*/ { + __pyx_v_info->suboffsets = NULL; + } + __pyx_L8:; + + /* "View.MemoryView":542 + * info.suboffsets = NULL + * + * if flags & PyBUF_FORMAT: # <<<<<<<<<<<<<< + * info.format = self.view.format + * else: +*/ + __pyx_t_1 = ((__pyx_v_flags & PyBUF_FORMAT) != 0); + if (__pyx_t_1) { + + /* "View.MemoryView":543 + * + * if flags & PyBUF_FORMAT: + * info.format = self.view.format # <<<<<<<<<<<<<< + * else: + * info.format = NULL +*/ + __pyx_t_4 = __pyx_v_self->view.format; + __pyx_v_info->format = __pyx_t_4; + + /* "View.MemoryView":542 + * info.suboffsets = NULL + * + * if flags & PyBUF_FORMAT: # <<<<<<<<<<<<<< + * info.format = self.view.format + * else: +*/ + goto __pyx_L9; + } + + /* "View.MemoryView":545 + * info.format = self.view.format + * else: + * info.format = NULL # <<<<<<<<<<<<<< + * + * info.buf = self.view.buf +*/ + /*else*/ { + __pyx_v_info->format = NULL; + } + __pyx_L9:; + + /* "View.MemoryView":547 + * info.format = NULL + * + * info.buf = self.view.buf # <<<<<<<<<<<<<< + * info.ndim = self.view.ndim + * info.itemsize = self.view.itemsize +*/ + __pyx_t_5 = __pyx_v_self->view.buf; + __pyx_v_info->buf = __pyx_t_5; + + /* "View.MemoryView":548 + * + * info.buf = self.view.buf + * info.ndim = self.view.ndim # <<<<<<<<<<<<<< + * info.itemsize = self.view.itemsize + * info.len = self.view.len +*/ + __pyx_t_6 = __pyx_v_self->view.ndim; + __pyx_v_info->ndim = __pyx_t_6; + + /* "View.MemoryView":549 + * info.buf = self.view.buf + * info.ndim = self.view.ndim + * info.itemsize = self.view.itemsize # <<<<<<<<<<<<<< + * info.len = self.view.len + * info.readonly = self.view.readonly +*/ + __pyx_t_7 = __pyx_v_self->view.itemsize; + __pyx_v_info->itemsize = __pyx_t_7; + + /* "View.MemoryView":550 + * info.ndim = self.view.ndim + * info.itemsize = self.view.itemsize + * info.len = self.view.len # <<<<<<<<<<<<<< + * info.readonly = self.view.readonly + * info.obj = self +*/ + __pyx_t_7 = __pyx_v_self->view.len; + __pyx_v_info->len = __pyx_t_7; + + /* "View.MemoryView":551 + * info.itemsize = self.view.itemsize + * info.len = self.view.len + * info.readonly = self.view.readonly # <<<<<<<<<<<<<< + * info.obj = self + * +*/ + __pyx_t_1 = __pyx_v_self->view.readonly; + __pyx_v_info->readonly = __pyx_t_1; + + /* "View.MemoryView":552 + * info.len = self.view.len + * info.readonly = self.view.readonly + * info.obj = self # <<<<<<<<<<<<<< + * + * +*/ + __Pyx_INCREF((PyObject *)__pyx_v_self); + __Pyx_GIVEREF((PyObject *)__pyx_v_self); + __Pyx_GOTREF(__pyx_v_info->obj); + __Pyx_DECREF(__pyx_v_info->obj); + __pyx_v_info->obj = ((PyObject *)__pyx_v_self); + + /* "View.MemoryView":522 + * itemp[i] = c + * + * @cname('getbuffer') # <<<<<<<<<<<<<< + * def __getbuffer__(self, Py_buffer *info, int flags): + * if flags & PyBUF_WRITABLE and self.view.readonly: +*/ + + /* function exit code */ + __pyx_r = 0; + goto __pyx_L0; + __pyx_L1_error:; + __Pyx_AddTraceback("View.MemoryView.memoryview.__getbuffer__", __pyx_clineno, __pyx_lineno, __pyx_filename); + __pyx_r = -1; + if (__pyx_v_info->obj != NULL) { + __Pyx_GOTREF(__pyx_v_info->obj); + __Pyx_DECREF(__pyx_v_info->obj); __pyx_v_info->obj = 0; + } + goto __pyx_L2; + __pyx_L0:; + if (__pyx_v_info->obj == Py_None) { + __Pyx_GOTREF(__pyx_v_info->obj); + __Pyx_DECREF(__pyx_v_info->obj); __pyx_v_info->obj = 0; + } + __pyx_L2:; + __Pyx_RefNannyFinishContext(); + return __pyx_r; +} + +/* "View.MemoryView":555 + * + * + * @property # <<<<<<<<<<<<<< + * def T(self): + * cdef _memoryviewslice result = memoryview_copy(self) +*/ + +/* Python wrapper */ +static PyObject *__pyx_pw_15View_dot_MemoryView_10memoryview_1T_1__get__(PyObject *__pyx_v_self); /*proto*/ +static PyObject *__pyx_pw_15View_dot_MemoryView_10memoryview_1T_1__get__(PyObject *__pyx_v_self) { + CYTHON_UNUSED PyObject *const *__pyx_kwvalues; + PyObject *__pyx_r = 0; + __Pyx_RefNannyDeclarations + __Pyx_RefNannySetupContext("__get__ (wrapper)", 0); + __pyx_kwvalues = __Pyx_KwValues_VARARGS(__pyx_args, __pyx_nargs); + __pyx_r = __pyx_pf_15View_dot_MemoryView_10memoryview_1T___get__(((struct __pyx_memoryview_obj *)__pyx_v_self)); + + /* function exit code */ + __Pyx_RefNannyFinishContext(); + return __pyx_r; +} + +static PyObject *__pyx_pf_15View_dot_MemoryView_10memoryview_1T___get__(struct __pyx_memoryview_obj *__pyx_v_self) { + struct __pyx_memoryviewslice_obj *__pyx_v_result = 0; + PyObject *__pyx_r = NULL; + __Pyx_RefNannyDeclarations + PyObject *__pyx_t_1 = NULL; + int __pyx_t_2; + int __pyx_lineno = 0; + const char *__pyx_filename = NULL; + int __pyx_clineno = 0; + __Pyx_RefNannySetupContext("__get__", 0); + + /* "View.MemoryView":557 + * @property + * def T(self): + * cdef _memoryviewslice result = memoryview_copy(self) # <<<<<<<<<<<<<< + * transpose_memslice(&result.from_slice) + * return result +*/ + __pyx_t_1 = __pyx_memoryview_copy_object(__pyx_v_self); if (unlikely(!__pyx_t_1)) __PYX_ERR(1, 557, __pyx_L1_error) + __Pyx_GOTREF(__pyx_t_1); + if (!(likely(((__pyx_t_1) == Py_None) || likely(__Pyx_TypeTest(__pyx_t_1, __pyx_mstate_global->__pyx_memoryviewslice_type))))) __PYX_ERR(1, 557, __pyx_L1_error) + __pyx_v_result = ((struct __pyx_memoryviewslice_obj *)__pyx_t_1); + __pyx_t_1 = 0; + + /* "View.MemoryView":558 + * def T(self): + * cdef _memoryviewslice result = memoryview_copy(self) + * transpose_memslice(&result.from_slice) # <<<<<<<<<<<<<< + * return result + * +*/ + __pyx_t_2 = __pyx_memslice_transpose((&__pyx_v_result->from_slice)); if (unlikely(__pyx_t_2 == ((int)-1))) __PYX_ERR(1, 558, __pyx_L1_error) + + /* "View.MemoryView":559 + * cdef _memoryviewslice result = memoryview_copy(self) + * transpose_memslice(&result.from_slice) + * return result # <<<<<<<<<<<<<< + * + * @property +*/ + __Pyx_XDECREF(__pyx_r); + __Pyx_INCREF((PyObject *)__pyx_v_result); + __pyx_r = ((PyObject *)__pyx_v_result); + goto __pyx_L0; + + /* "View.MemoryView":555 + * + * + * @property # <<<<<<<<<<<<<< + * def T(self): + * cdef _memoryviewslice result = memoryview_copy(self) +*/ + + /* function exit code */ + __pyx_L1_error:; + __Pyx_XDECREF(__pyx_t_1); + __Pyx_AddTraceback("View.MemoryView.memoryview.T.__get__", __pyx_clineno, __pyx_lineno, __pyx_filename); + __pyx_r = NULL; + __pyx_L0:; + __Pyx_XDECREF((PyObject *)__pyx_v_result); + __Pyx_XGIVEREF(__pyx_r); + __Pyx_RefNannyFinishContext(); + return __pyx_r; +} + +/* "View.MemoryView":561 + * return result + * + * @property # <<<<<<<<<<<<<< + * def base(self): + * return self._get_base() +*/ + +/* Python wrapper */ +static PyObject *__pyx_pw_15View_dot_MemoryView_10memoryview_4base_1__get__(PyObject *__pyx_v_self); /*proto*/ +static PyObject *__pyx_pw_15View_dot_MemoryView_10memoryview_4base_1__get__(PyObject *__pyx_v_self) { + CYTHON_UNUSED PyObject *const *__pyx_kwvalues; + PyObject *__pyx_r = 0; + __Pyx_RefNannyDeclarations + __Pyx_RefNannySetupContext("__get__ (wrapper)", 0); + __pyx_kwvalues = __Pyx_KwValues_VARARGS(__pyx_args, __pyx_nargs); + __pyx_r = __pyx_pf_15View_dot_MemoryView_10memoryview_4base___get__(((struct __pyx_memoryview_obj *)__pyx_v_self)); + + /* function exit code */ + __Pyx_RefNannyFinishContext(); + return __pyx_r; +} + +static PyObject *__pyx_pf_15View_dot_MemoryView_10memoryview_4base___get__(struct __pyx_memoryview_obj *__pyx_v_self) { + PyObject *__pyx_r = NULL; + __Pyx_RefNannyDeclarations + PyObject *__pyx_t_1 = NULL; + int __pyx_lineno = 0; + const char *__pyx_filename = NULL; + int __pyx_clineno = 0; + __Pyx_RefNannySetupContext("__get__", 0); + + /* "View.MemoryView":563 + * @property + * def base(self): + * return self._get_base() # <<<<<<<<<<<<<< + * + * cdef _get_base(self): +*/ + __Pyx_XDECREF(__pyx_r); + __pyx_t_1 = ((struct __pyx_vtabstruct_memoryview *)__pyx_v_self->__pyx_vtab)->_get_base(__pyx_v_self); if (unlikely(!__pyx_t_1)) __PYX_ERR(1, 563, __pyx_L1_error) + __Pyx_GOTREF(__pyx_t_1); + __pyx_r = __pyx_t_1; + __pyx_t_1 = 0; + goto __pyx_L0; + + /* "View.MemoryView":561 + * return result + * + * @property # <<<<<<<<<<<<<< + * def base(self): + * return self._get_base() +*/ + + /* function exit code */ + __pyx_L1_error:; + __Pyx_XDECREF(__pyx_t_1); + __Pyx_AddTraceback("View.MemoryView.memoryview.base.__get__", __pyx_clineno, __pyx_lineno, __pyx_filename); + __pyx_r = NULL; + __pyx_L0:; + __Pyx_XGIVEREF(__pyx_r); + __Pyx_RefNannyFinishContext(); + return __pyx_r; +} + +/* "View.MemoryView":565 + * return self._get_base() + * + * cdef _get_base(self): # <<<<<<<<<<<<<< + * return self.obj + * +*/ + +static PyObject *__pyx_memoryview__get_base(struct __pyx_memoryview_obj *__pyx_v_self) { + PyObject *__pyx_r = NULL; + __Pyx_RefNannyDeclarations + __Pyx_RefNannySetupContext("_get_base", 0); + + /* "View.MemoryView":566 + * + * cdef _get_base(self): + * return self.obj # <<<<<<<<<<<<<< + * + * @property +*/ + __Pyx_XDECREF(__pyx_r); + __Pyx_INCREF(__pyx_v_self->obj); + __pyx_r = __pyx_v_self->obj; + goto __pyx_L0; + + /* "View.MemoryView":565 + * return self._get_base() + * + * cdef _get_base(self): # <<<<<<<<<<<<<< + * return self.obj + * +*/ + + /* function exit code */ + __pyx_L0:; + __Pyx_XGIVEREF(__pyx_r); + __Pyx_RefNannyFinishContext(); + return __pyx_r; +} + +/* "View.MemoryView":568 + * return self.obj + * + * @property # <<<<<<<<<<<<<< + * def shape(self): + * return tuple([length for length in self.view.shape[:self.view.ndim]]) +*/ + +/* Python wrapper */ +static PyObject *__pyx_pw_15View_dot_MemoryView_10memoryview_5shape_1__get__(PyObject *__pyx_v_self); /*proto*/ +static PyObject *__pyx_pw_15View_dot_MemoryView_10memoryview_5shape_1__get__(PyObject *__pyx_v_self) { + CYTHON_UNUSED PyObject *const *__pyx_kwvalues; + PyObject *__pyx_r = 0; + __Pyx_RefNannyDeclarations + __Pyx_RefNannySetupContext("__get__ (wrapper)", 0); + __pyx_kwvalues = __Pyx_KwValues_VARARGS(__pyx_args, __pyx_nargs); + __pyx_r = __pyx_pf_15View_dot_MemoryView_10memoryview_5shape___get__(((struct __pyx_memoryview_obj *)__pyx_v_self)); + + /* function exit code */ + __Pyx_RefNannyFinishContext(); + return __pyx_r; +} + +static PyObject *__pyx_pf_15View_dot_MemoryView_10memoryview_5shape___get__(struct __pyx_memoryview_obj *__pyx_v_self) { + Py_ssize_t __pyx_7genexpr__pyx_v_length; + PyObject *__pyx_r = NULL; + __Pyx_RefNannyDeclarations + PyObject *__pyx_t_1 = NULL; + Py_ssize_t *__pyx_t_2; + Py_ssize_t *__pyx_t_3; + Py_ssize_t *__pyx_t_4; + PyObject *__pyx_t_5 = NULL; + int __pyx_lineno = 0; + const char *__pyx_filename = NULL; + int __pyx_clineno = 0; + __Pyx_RefNannySetupContext("__get__", 0); + + /* "View.MemoryView":570 + * @property + * def shape(self): + * return tuple([length for length in self.view.shape[:self.view.ndim]]) # <<<<<<<<<<<<<< + * + * @property +*/ + __Pyx_XDECREF(__pyx_r); + { /* enter inner scope */ + __pyx_t_1 = PyList_New(0); if (unlikely(!__pyx_t_1)) __PYX_ERR(1, 570, __pyx_L1_error) + __Pyx_GOTREF(__pyx_t_1); + __pyx_t_3 = (__pyx_v_self->view.shape + __pyx_v_self->view.ndim); + for (__pyx_t_4 = __pyx_v_self->view.shape; __pyx_t_4 < __pyx_t_3; __pyx_t_4++) { + __pyx_t_2 = __pyx_t_4; + __pyx_7genexpr__pyx_v_length = (__pyx_t_2[0]); + __pyx_t_5 = PyLong_FromSsize_t(__pyx_7genexpr__pyx_v_length); if (unlikely(!__pyx_t_5)) __PYX_ERR(1, 570, __pyx_L1_error) + __Pyx_GOTREF(__pyx_t_5); + if (unlikely(__Pyx_ListComp_Append(__pyx_t_1, (PyObject*)__pyx_t_5))) __PYX_ERR(1, 570, __pyx_L1_error) + __Pyx_DECREF(__pyx_t_5); __pyx_t_5 = 0; + } + } /* exit inner scope */ + __pyx_t_5 = PyList_AsTuple(((PyObject*)__pyx_t_1)); if (unlikely(!__pyx_t_5)) __PYX_ERR(1, 570, __pyx_L1_error) + __Pyx_GOTREF(__pyx_t_5); + __Pyx_DECREF(__pyx_t_1); __pyx_t_1 = 0; + __pyx_r = __pyx_t_5; + __pyx_t_5 = 0; + goto __pyx_L0; + + /* "View.MemoryView":568 + * return self.obj + * + * @property # <<<<<<<<<<<<<< + * def shape(self): + * return tuple([length for length in self.view.shape[:self.view.ndim]]) +*/ + + /* function exit code */ + __pyx_L1_error:; + __Pyx_XDECREF(__pyx_t_1); + __Pyx_XDECREF(__pyx_t_5); + __Pyx_AddTraceback("View.MemoryView.memoryview.shape.__get__", __pyx_clineno, __pyx_lineno, __pyx_filename); + __pyx_r = NULL; + __pyx_L0:; + __Pyx_XGIVEREF(__pyx_r); + __Pyx_RefNannyFinishContext(); + return __pyx_r; +} + +/* "View.MemoryView":572 + * return tuple([length for length in self.view.shape[:self.view.ndim]]) + * + * @property # <<<<<<<<<<<<<< + * def strides(self): + * if self.view.strides == NULL: +*/ + +/* Python wrapper */ +static PyObject *__pyx_pw_15View_dot_MemoryView_10memoryview_7strides_1__get__(PyObject *__pyx_v_self); /*proto*/ +static PyObject *__pyx_pw_15View_dot_MemoryView_10memoryview_7strides_1__get__(PyObject *__pyx_v_self) { + CYTHON_UNUSED PyObject *const *__pyx_kwvalues; + PyObject *__pyx_r = 0; + __Pyx_RefNannyDeclarations + __Pyx_RefNannySetupContext("__get__ (wrapper)", 0); + __pyx_kwvalues = __Pyx_KwValues_VARARGS(__pyx_args, __pyx_nargs); + __pyx_r = __pyx_pf_15View_dot_MemoryView_10memoryview_7strides___get__(((struct __pyx_memoryview_obj *)__pyx_v_self)); + + /* function exit code */ + __Pyx_RefNannyFinishContext(); + return __pyx_r; +} + +static PyObject *__pyx_pf_15View_dot_MemoryView_10memoryview_7strides___get__(struct __pyx_memoryview_obj *__pyx_v_self) { + Py_ssize_t __pyx_8genexpr1__pyx_v_stride; + PyObject *__pyx_r = NULL; + __Pyx_RefNannyDeclarations + int __pyx_t_1; + PyObject *__pyx_t_2 = NULL; + Py_ssize_t *__pyx_t_3; + Py_ssize_t *__pyx_t_4; + Py_ssize_t *__pyx_t_5; + PyObject *__pyx_t_6 = NULL; + int __pyx_lineno = 0; + const char *__pyx_filename = NULL; + int __pyx_clineno = 0; + __Pyx_RefNannySetupContext("__get__", 0); + + /* "View.MemoryView":574 + * @property + * def strides(self): + * if self.view.strides == NULL: # <<<<<<<<<<<<<< + * + * raise ValueError, "Buffer view does not expose strides" +*/ + __pyx_t_1 = (__pyx_v_self->view.strides == NULL); + if (unlikely(__pyx_t_1)) { + + /* "View.MemoryView":576 + * if self.view.strides == NULL: + * + * raise ValueError, "Buffer view does not expose strides" # <<<<<<<<<<<<<< + * + * return tuple([stride for stride in self.view.strides[:self.view.ndim]]) +*/ + __Pyx_Raise(((PyObject *)(((PyTypeObject*)PyExc_ValueError))), __pyx_mstate_global->__pyx_kp_u_Buffer_view_does_not_expose_stri, 0, 0); + __PYX_ERR(1, 576, __pyx_L1_error) + + /* "View.MemoryView":574 + * @property + * def strides(self): + * if self.view.strides == NULL: # <<<<<<<<<<<<<< + * + * raise ValueError, "Buffer view does not expose strides" +*/ + } + + /* "View.MemoryView":578 + * raise ValueError, "Buffer view does not expose strides" + * + * return tuple([stride for stride in self.view.strides[:self.view.ndim]]) # <<<<<<<<<<<<<< + * + * @property +*/ + __Pyx_XDECREF(__pyx_r); + { /* enter inner scope */ + __pyx_t_2 = PyList_New(0); if (unlikely(!__pyx_t_2)) __PYX_ERR(1, 578, __pyx_L1_error) + __Pyx_GOTREF(__pyx_t_2); + __pyx_t_4 = (__pyx_v_self->view.strides + __pyx_v_self->view.ndim); + for (__pyx_t_5 = __pyx_v_self->view.strides; __pyx_t_5 < __pyx_t_4; __pyx_t_5++) { + __pyx_t_3 = __pyx_t_5; + __pyx_8genexpr1__pyx_v_stride = (__pyx_t_3[0]); + __pyx_t_6 = PyLong_FromSsize_t(__pyx_8genexpr1__pyx_v_stride); if (unlikely(!__pyx_t_6)) __PYX_ERR(1, 578, __pyx_L1_error) + __Pyx_GOTREF(__pyx_t_6); + if (unlikely(__Pyx_ListComp_Append(__pyx_t_2, (PyObject*)__pyx_t_6))) __PYX_ERR(1, 578, __pyx_L1_error) + __Pyx_DECREF(__pyx_t_6); __pyx_t_6 = 0; + } + } /* exit inner scope */ + __pyx_t_6 = PyList_AsTuple(((PyObject*)__pyx_t_2)); if (unlikely(!__pyx_t_6)) __PYX_ERR(1, 578, __pyx_L1_error) + __Pyx_GOTREF(__pyx_t_6); + __Pyx_DECREF(__pyx_t_2); __pyx_t_2 = 0; + __pyx_r = __pyx_t_6; + __pyx_t_6 = 0; + goto __pyx_L0; + + /* "View.MemoryView":572 + * return tuple([length for length in self.view.shape[:self.view.ndim]]) + * + * @property # <<<<<<<<<<<<<< + * def strides(self): + * if self.view.strides == NULL: +*/ + + /* function exit code */ + __pyx_L1_error:; + __Pyx_XDECREF(__pyx_t_2); + __Pyx_XDECREF(__pyx_t_6); + __Pyx_AddTraceback("View.MemoryView.memoryview.strides.__get__", __pyx_clineno, __pyx_lineno, __pyx_filename); + __pyx_r = NULL; + __pyx_L0:; + __Pyx_XGIVEREF(__pyx_r); + __Pyx_RefNannyFinishContext(); + return __pyx_r; +} + +/* "View.MemoryView":580 + * return tuple([stride for stride in self.view.strides[:self.view.ndim]]) + * + * @property # <<<<<<<<<<<<<< + * def suboffsets(self): + * if self.view.suboffsets == NULL: +*/ + +/* Python wrapper */ +static PyObject *__pyx_pw_15View_dot_MemoryView_10memoryview_10suboffsets_1__get__(PyObject *__pyx_v_self); /*proto*/ +static PyObject *__pyx_pw_15View_dot_MemoryView_10memoryview_10suboffsets_1__get__(PyObject *__pyx_v_self) { + CYTHON_UNUSED PyObject *const *__pyx_kwvalues; + PyObject *__pyx_r = 0; + __Pyx_RefNannyDeclarations + __Pyx_RefNannySetupContext("__get__ (wrapper)", 0); + __pyx_kwvalues = __Pyx_KwValues_VARARGS(__pyx_args, __pyx_nargs); + __pyx_r = __pyx_pf_15View_dot_MemoryView_10memoryview_10suboffsets___get__(((struct __pyx_memoryview_obj *)__pyx_v_self)); + + /* function exit code */ + __Pyx_RefNannyFinishContext(); + return __pyx_r; +} + +static PyObject *__pyx_pf_15View_dot_MemoryView_10memoryview_10suboffsets___get__(struct __pyx_memoryview_obj *__pyx_v_self) { + Py_ssize_t __pyx_8genexpr2__pyx_v_suboffset; + PyObject *__pyx_r = NULL; + __Pyx_RefNannyDeclarations + int __pyx_t_1; + PyObject *__pyx_t_2 = NULL; + Py_ssize_t *__pyx_t_3; + Py_ssize_t *__pyx_t_4; + Py_ssize_t *__pyx_t_5; + PyObject *__pyx_t_6 = NULL; + int __pyx_lineno = 0; + const char *__pyx_filename = NULL; + int __pyx_clineno = 0; + __Pyx_RefNannySetupContext("__get__", 0); + + /* "View.MemoryView":582 + * @property + * def suboffsets(self): + * if self.view.suboffsets == NULL: # <<<<<<<<<<<<<< + * return (-1,) * self.view.ndim + * +*/ + __pyx_t_1 = (__pyx_v_self->view.suboffsets == NULL); + if (__pyx_t_1) { + + /* "View.MemoryView":583 + * def suboffsets(self): + * if self.view.suboffsets == NULL: + * return (-1,) * self.view.ndim # <<<<<<<<<<<<<< + * + * return tuple([suboffset for suboffset in self.view.suboffsets[:self.view.ndim]]) +*/ + __Pyx_XDECREF(__pyx_r); + __pyx_t_2 = __Pyx_PySequence_Multiply(__pyx_mstate_global->__pyx_tuple[1], __pyx_v_self->view.ndim); if (unlikely(!__pyx_t_2)) __PYX_ERR(1, 583, __pyx_L1_error) + __Pyx_GOTREF(__pyx_t_2); + __pyx_r = __pyx_t_2; + __pyx_t_2 = 0; + goto __pyx_L0; + + /* "View.MemoryView":582 + * @property + * def suboffsets(self): + * if self.view.suboffsets == NULL: # <<<<<<<<<<<<<< + * return (-1,) * self.view.ndim + * +*/ + } + + /* "View.MemoryView":585 + * return (-1,) * self.view.ndim + * + * return tuple([suboffset for suboffset in self.view.suboffsets[:self.view.ndim]]) # <<<<<<<<<<<<<< + * + * @property +*/ + __Pyx_XDECREF(__pyx_r); + { /* enter inner scope */ + __pyx_t_2 = PyList_New(0); if (unlikely(!__pyx_t_2)) __PYX_ERR(1, 585, __pyx_L1_error) + __Pyx_GOTREF(__pyx_t_2); + __pyx_t_4 = (__pyx_v_self->view.suboffsets + __pyx_v_self->view.ndim); + for (__pyx_t_5 = __pyx_v_self->view.suboffsets; __pyx_t_5 < __pyx_t_4; __pyx_t_5++) { + __pyx_t_3 = __pyx_t_5; + __pyx_8genexpr2__pyx_v_suboffset = (__pyx_t_3[0]); + __pyx_t_6 = PyLong_FromSsize_t(__pyx_8genexpr2__pyx_v_suboffset); if (unlikely(!__pyx_t_6)) __PYX_ERR(1, 585, __pyx_L1_error) + __Pyx_GOTREF(__pyx_t_6); + if (unlikely(__Pyx_ListComp_Append(__pyx_t_2, (PyObject*)__pyx_t_6))) __PYX_ERR(1, 585, __pyx_L1_error) + __Pyx_DECREF(__pyx_t_6); __pyx_t_6 = 0; + } + } /* exit inner scope */ + __pyx_t_6 = PyList_AsTuple(((PyObject*)__pyx_t_2)); if (unlikely(!__pyx_t_6)) __PYX_ERR(1, 585, __pyx_L1_error) + __Pyx_GOTREF(__pyx_t_6); + __Pyx_DECREF(__pyx_t_2); __pyx_t_2 = 0; + __pyx_r = __pyx_t_6; + __pyx_t_6 = 0; + goto __pyx_L0; + + /* "View.MemoryView":580 + * return tuple([stride for stride in self.view.strides[:self.view.ndim]]) + * + * @property # <<<<<<<<<<<<<< + * def suboffsets(self): + * if self.view.suboffsets == NULL: +*/ + + /* function exit code */ + __pyx_L1_error:; + __Pyx_XDECREF(__pyx_t_2); + __Pyx_XDECREF(__pyx_t_6); + __Pyx_AddTraceback("View.MemoryView.memoryview.suboffsets.__get__", __pyx_clineno, __pyx_lineno, __pyx_filename); + __pyx_r = NULL; + __pyx_L0:; + __Pyx_XGIVEREF(__pyx_r); + __Pyx_RefNannyFinishContext(); + return __pyx_r; +} + +/* "View.MemoryView":587 + * return tuple([suboffset for suboffset in self.view.suboffsets[:self.view.ndim]]) + * + * @property # <<<<<<<<<<<<<< + * def ndim(self): + * return self.view.ndim +*/ + +/* Python wrapper */ +static PyObject *__pyx_pw_15View_dot_MemoryView_10memoryview_4ndim_1__get__(PyObject *__pyx_v_self); /*proto*/ +static PyObject *__pyx_pw_15View_dot_MemoryView_10memoryview_4ndim_1__get__(PyObject *__pyx_v_self) { + CYTHON_UNUSED PyObject *const *__pyx_kwvalues; + PyObject *__pyx_r = 0; + __Pyx_RefNannyDeclarations + __Pyx_RefNannySetupContext("__get__ (wrapper)", 0); + __pyx_kwvalues = __Pyx_KwValues_VARARGS(__pyx_args, __pyx_nargs); + __pyx_r = __pyx_pf_15View_dot_MemoryView_10memoryview_4ndim___get__(((struct __pyx_memoryview_obj *)__pyx_v_self)); + + /* function exit code */ + __Pyx_RefNannyFinishContext(); + return __pyx_r; +} + +static PyObject *__pyx_pf_15View_dot_MemoryView_10memoryview_4ndim___get__(struct __pyx_memoryview_obj *__pyx_v_self) { + PyObject *__pyx_r = NULL; + __Pyx_RefNannyDeclarations + PyObject *__pyx_t_1 = NULL; + int __pyx_lineno = 0; + const char *__pyx_filename = NULL; + int __pyx_clineno = 0; + __Pyx_RefNannySetupContext("__get__", 0); + + /* "View.MemoryView":589 + * @property + * def ndim(self): + * return self.view.ndim # <<<<<<<<<<<<<< + * + * @property +*/ + __Pyx_XDECREF(__pyx_r); + __pyx_t_1 = __Pyx_PyLong_From_int(__pyx_v_self->view.ndim); if (unlikely(!__pyx_t_1)) __PYX_ERR(1, 589, __pyx_L1_error) + __Pyx_GOTREF(__pyx_t_1); + __pyx_r = __pyx_t_1; + __pyx_t_1 = 0; + goto __pyx_L0; + + /* "View.MemoryView":587 + * return tuple([suboffset for suboffset in self.view.suboffsets[:self.view.ndim]]) + * + * @property # <<<<<<<<<<<<<< + * def ndim(self): + * return self.view.ndim +*/ + + /* function exit code */ + __pyx_L1_error:; + __Pyx_XDECREF(__pyx_t_1); + __Pyx_AddTraceback("View.MemoryView.memoryview.ndim.__get__", __pyx_clineno, __pyx_lineno, __pyx_filename); + __pyx_r = NULL; + __pyx_L0:; + __Pyx_XGIVEREF(__pyx_r); + __Pyx_RefNannyFinishContext(); + return __pyx_r; +} + +/* "View.MemoryView":591 + * return self.view.ndim + * + * @property # <<<<<<<<<<<<<< + * def itemsize(self): + * return self.view.itemsize +*/ + +/* Python wrapper */ +static PyObject *__pyx_pw_15View_dot_MemoryView_10memoryview_8itemsize_1__get__(PyObject *__pyx_v_self); /*proto*/ +static PyObject *__pyx_pw_15View_dot_MemoryView_10memoryview_8itemsize_1__get__(PyObject *__pyx_v_self) { + CYTHON_UNUSED PyObject *const *__pyx_kwvalues; + PyObject *__pyx_r = 0; + __Pyx_RefNannyDeclarations + __Pyx_RefNannySetupContext("__get__ (wrapper)", 0); + __pyx_kwvalues = __Pyx_KwValues_VARARGS(__pyx_args, __pyx_nargs); + __pyx_r = __pyx_pf_15View_dot_MemoryView_10memoryview_8itemsize___get__(((struct __pyx_memoryview_obj *)__pyx_v_self)); + + /* function exit code */ + __Pyx_RefNannyFinishContext(); + return __pyx_r; +} + +static PyObject *__pyx_pf_15View_dot_MemoryView_10memoryview_8itemsize___get__(struct __pyx_memoryview_obj *__pyx_v_self) { + PyObject *__pyx_r = NULL; + __Pyx_RefNannyDeclarations + PyObject *__pyx_t_1 = NULL; + int __pyx_lineno = 0; + const char *__pyx_filename = NULL; + int __pyx_clineno = 0; + __Pyx_RefNannySetupContext("__get__", 0); + + /* "View.MemoryView":593 + * @property + * def itemsize(self): + * return self.view.itemsize # <<<<<<<<<<<<<< + * + * @property +*/ + __Pyx_XDECREF(__pyx_r); + __pyx_t_1 = PyLong_FromSsize_t(__pyx_v_self->view.itemsize); if (unlikely(!__pyx_t_1)) __PYX_ERR(1, 593, __pyx_L1_error) + __Pyx_GOTREF(__pyx_t_1); + __pyx_r = __pyx_t_1; + __pyx_t_1 = 0; + goto __pyx_L0; + + /* "View.MemoryView":591 + * return self.view.ndim + * + * @property # <<<<<<<<<<<<<< + * def itemsize(self): + * return self.view.itemsize +*/ + + /* function exit code */ + __pyx_L1_error:; + __Pyx_XDECREF(__pyx_t_1); + __Pyx_AddTraceback("View.MemoryView.memoryview.itemsize.__get__", __pyx_clineno, __pyx_lineno, __pyx_filename); + __pyx_r = NULL; + __pyx_L0:; + __Pyx_XGIVEREF(__pyx_r); + __Pyx_RefNannyFinishContext(); + return __pyx_r; +} + +/* "View.MemoryView":595 + * return self.view.itemsize + * + * @property # <<<<<<<<<<<<<< + * def nbytes(self): + * return self.size * self.view.itemsize +*/ + +/* Python wrapper */ +static PyObject *__pyx_pw_15View_dot_MemoryView_10memoryview_6nbytes_1__get__(PyObject *__pyx_v_self); /*proto*/ +static PyObject *__pyx_pw_15View_dot_MemoryView_10memoryview_6nbytes_1__get__(PyObject *__pyx_v_self) { + CYTHON_UNUSED PyObject *const *__pyx_kwvalues; + PyObject *__pyx_r = 0; + __Pyx_RefNannyDeclarations + __Pyx_RefNannySetupContext("__get__ (wrapper)", 0); + __pyx_kwvalues = __Pyx_KwValues_VARARGS(__pyx_args, __pyx_nargs); + __pyx_r = __pyx_pf_15View_dot_MemoryView_10memoryview_6nbytes___get__(((struct __pyx_memoryview_obj *)__pyx_v_self)); + + /* function exit code */ + __Pyx_RefNannyFinishContext(); + return __pyx_r; +} + +static PyObject *__pyx_pf_15View_dot_MemoryView_10memoryview_6nbytes___get__(struct __pyx_memoryview_obj *__pyx_v_self) { + PyObject *__pyx_r = NULL; + __Pyx_RefNannyDeclarations + PyObject *__pyx_t_1 = NULL; + PyObject *__pyx_t_2 = NULL; + PyObject *__pyx_t_3 = NULL; + int __pyx_lineno = 0; + const char *__pyx_filename = NULL; + int __pyx_clineno = 0; + __Pyx_RefNannySetupContext("__get__", 0); + + /* "View.MemoryView":597 + * @property + * def nbytes(self): + * return self.size * self.view.itemsize # <<<<<<<<<<<<<< + * + * @property +*/ + __Pyx_XDECREF(__pyx_r); + __pyx_t_1 = __Pyx_PyObject_GetAttrStr(((PyObject *)__pyx_v_self), __pyx_mstate_global->__pyx_n_u_size); if (unlikely(!__pyx_t_1)) __PYX_ERR(1, 597, __pyx_L1_error) + __Pyx_GOTREF(__pyx_t_1); + __pyx_t_2 = PyLong_FromSsize_t(__pyx_v_self->view.itemsize); if (unlikely(!__pyx_t_2)) __PYX_ERR(1, 597, __pyx_L1_error) + __Pyx_GOTREF(__pyx_t_2); + __pyx_t_3 = PyNumber_Multiply(__pyx_t_1, __pyx_t_2); if (unlikely(!__pyx_t_3)) __PYX_ERR(1, 597, __pyx_L1_error) + __Pyx_GOTREF(__pyx_t_3); + __Pyx_DECREF(__pyx_t_1); __pyx_t_1 = 0; + __Pyx_DECREF(__pyx_t_2); __pyx_t_2 = 0; + __pyx_r = __pyx_t_3; + __pyx_t_3 = 0; + goto __pyx_L0; + + /* "View.MemoryView":595 + * return self.view.itemsize + * + * @property # <<<<<<<<<<<<<< + * def nbytes(self): + * return self.size * self.view.itemsize +*/ + + /* function exit code */ + __pyx_L1_error:; + __Pyx_XDECREF(__pyx_t_1); + __Pyx_XDECREF(__pyx_t_2); + __Pyx_XDECREF(__pyx_t_3); + __Pyx_AddTraceback("View.MemoryView.memoryview.nbytes.__get__", __pyx_clineno, __pyx_lineno, __pyx_filename); + __pyx_r = NULL; + __pyx_L0:; + __Pyx_XGIVEREF(__pyx_r); + __Pyx_RefNannyFinishContext(); + return __pyx_r; +} + +/* "View.MemoryView":599 + * return self.size * self.view.itemsize + * + * @property # <<<<<<<<<<<<<< + * def size(self): + * if self._size is None: +*/ + +/* Python wrapper */ +static PyObject *__pyx_pw_15View_dot_MemoryView_10memoryview_4size_1__get__(PyObject *__pyx_v_self); /*proto*/ +static PyObject *__pyx_pw_15View_dot_MemoryView_10memoryview_4size_1__get__(PyObject *__pyx_v_self) { + CYTHON_UNUSED PyObject *const *__pyx_kwvalues; + PyObject *__pyx_r = 0; + __Pyx_RefNannyDeclarations + __Pyx_RefNannySetupContext("__get__ (wrapper)", 0); + __pyx_kwvalues = __Pyx_KwValues_VARARGS(__pyx_args, __pyx_nargs); + __pyx_r = __pyx_pf_15View_dot_MemoryView_10memoryview_4size___get__(((struct __pyx_memoryview_obj *)__pyx_v_self)); + + /* function exit code */ + __Pyx_RefNannyFinishContext(); + return __pyx_r; +} + +static PyObject *__pyx_pf_15View_dot_MemoryView_10memoryview_4size___get__(struct __pyx_memoryview_obj *__pyx_v_self) { + PyObject *__pyx_v_result = NULL; + PyObject *__pyx_v_length = NULL; + PyObject *__pyx_r = NULL; + __Pyx_RefNannyDeclarations + int __pyx_t_1; + Py_ssize_t *__pyx_t_2; + Py_ssize_t *__pyx_t_3; + Py_ssize_t *__pyx_t_4; + PyObject *__pyx_t_5 = NULL; + int __pyx_lineno = 0; + const char *__pyx_filename = NULL; + int __pyx_clineno = 0; + __Pyx_RefNannySetupContext("__get__", 0); + + /* "View.MemoryView":601 + * @property + * def size(self): + * if self._size is None: # <<<<<<<<<<<<<< + * result = 1 + * +*/ + __pyx_t_1 = (__pyx_v_self->_size == Py_None); + if (__pyx_t_1) { + + /* "View.MemoryView":602 + * def size(self): + * if self._size is None: + * result = 1 # <<<<<<<<<<<<<< + * + * for length in self.view.shape[:self.view.ndim]: +*/ + __Pyx_INCREF(__pyx_mstate_global->__pyx_int_1); + __pyx_v_result = __pyx_mstate_global->__pyx_int_1; + + /* "View.MemoryView":604 + * result = 1 + * + * for length in self.view.shape[:self.view.ndim]: # <<<<<<<<<<<<<< + * result *= length + * +*/ + __pyx_t_3 = (__pyx_v_self->view.shape + __pyx_v_self->view.ndim); + for (__pyx_t_4 = __pyx_v_self->view.shape; __pyx_t_4 < __pyx_t_3; __pyx_t_4++) { + __pyx_t_2 = __pyx_t_4; + __pyx_t_5 = PyLong_FromSsize_t((__pyx_t_2[0])); if (unlikely(!__pyx_t_5)) __PYX_ERR(1, 604, __pyx_L1_error) + __Pyx_GOTREF(__pyx_t_5); + __Pyx_XDECREF_SET(__pyx_v_length, __pyx_t_5); + __pyx_t_5 = 0; + + /* "View.MemoryView":605 + * + * for length in self.view.shape[:self.view.ndim]: + * result *= length # <<<<<<<<<<<<<< + * + * self._size = result +*/ + __pyx_t_5 = PyNumber_InPlaceMultiply(__pyx_v_result, __pyx_v_length); if (unlikely(!__pyx_t_5)) __PYX_ERR(1, 605, __pyx_L1_error) + __Pyx_GOTREF(__pyx_t_5); + __Pyx_DECREF_SET(__pyx_v_result, __pyx_t_5); + __pyx_t_5 = 0; + } + + /* "View.MemoryView":607 + * result *= length + * + * self._size = result # <<<<<<<<<<<<<< + * + * return self._size +*/ + __Pyx_INCREF(__pyx_v_result); + __Pyx_GIVEREF(__pyx_v_result); + __Pyx_GOTREF(__pyx_v_self->_size); + __Pyx_DECREF(__pyx_v_self->_size); + __pyx_v_self->_size = __pyx_v_result; + + /* "View.MemoryView":601 + * @property + * def size(self): + * if self._size is None: # <<<<<<<<<<<<<< + * result = 1 + * +*/ + } + + /* "View.MemoryView":609 + * self._size = result + * + * return self._size # <<<<<<<<<<<<<< + * + * def __len__(self): +*/ + __Pyx_XDECREF(__pyx_r); + __Pyx_INCREF(__pyx_v_self->_size); + __pyx_r = __pyx_v_self->_size; + goto __pyx_L0; + + /* "View.MemoryView":599 + * return self.size * self.view.itemsize + * + * @property # <<<<<<<<<<<<<< + * def size(self): + * if self._size is None: +*/ + + /* function exit code */ + __pyx_L1_error:; + __Pyx_XDECREF(__pyx_t_5); + __Pyx_AddTraceback("View.MemoryView.memoryview.size.__get__", __pyx_clineno, __pyx_lineno, __pyx_filename); + __pyx_r = NULL; + __pyx_L0:; + __Pyx_XDECREF(__pyx_v_result); + __Pyx_XDECREF(__pyx_v_length); + __Pyx_XGIVEREF(__pyx_r); + __Pyx_RefNannyFinishContext(); + return __pyx_r; +} + +/* "View.MemoryView":611 + * return self._size + * + * def __len__(self): # <<<<<<<<<<<<<< + * if self.view.ndim >= 1: + * return self.view.shape[0] +*/ + +/* Python wrapper */ +static Py_ssize_t __pyx_memoryview___len__(PyObject *__pyx_v_self); /*proto*/ +static Py_ssize_t __pyx_memoryview___len__(PyObject *__pyx_v_self) { + CYTHON_UNUSED PyObject *const *__pyx_kwvalues; + Py_ssize_t __pyx_r; + __Pyx_RefNannyDeclarations + __Pyx_RefNannySetupContext("__len__ (wrapper)", 0); + __pyx_kwvalues = __Pyx_KwValues_VARARGS(__pyx_args, __pyx_nargs); + __pyx_r = __pyx_memoryview___pyx_pf_15View_dot_MemoryView_10memoryview_10__len__(((struct __pyx_memoryview_obj *)__pyx_v_self)); + + /* function exit code */ + __Pyx_RefNannyFinishContext(); + return __pyx_r; +} + +static Py_ssize_t __pyx_memoryview___pyx_pf_15View_dot_MemoryView_10memoryview_10__len__(struct __pyx_memoryview_obj *__pyx_v_self) { + Py_ssize_t __pyx_r; + int __pyx_t_1; + + /* "View.MemoryView":612 + * + * def __len__(self): + * if self.view.ndim >= 1: # <<<<<<<<<<<<<< + * return self.view.shape[0] + * +*/ + __pyx_t_1 = (__pyx_v_self->view.ndim >= 1); + if (__pyx_t_1) { + + /* "View.MemoryView":613 + * def __len__(self): + * if self.view.ndim >= 1: + * return self.view.shape[0] # <<<<<<<<<<<<<< + * + * return 0 +*/ + __pyx_r = (__pyx_v_self->view.shape[0]); + goto __pyx_L0; + + /* "View.MemoryView":612 + * + * def __len__(self): + * if self.view.ndim >= 1: # <<<<<<<<<<<<<< + * return self.view.shape[0] + * +*/ + } + + /* "View.MemoryView":615 + * return self.view.shape[0] + * + * return 0 # <<<<<<<<<<<<<< + * + * def __repr__(self): +*/ + __pyx_r = 0; + goto __pyx_L0; + + /* "View.MemoryView":611 + * return self._size + * + * def __len__(self): # <<<<<<<<<<<<<< + * if self.view.ndim >= 1: + * return self.view.shape[0] +*/ + + /* function exit code */ + __pyx_L0:; + return __pyx_r; +} + +/* "View.MemoryView":617 + * return 0 + * + * def __repr__(self): # <<<<<<<<<<<<<< + * return "" % (self.base.__class__.__name__, + * id(self)) +*/ + +/* Python wrapper */ +static PyObject *__pyx_memoryview___repr__(PyObject *__pyx_v_self); /*proto*/ +static PyObject *__pyx_memoryview___repr__(PyObject *__pyx_v_self) { + CYTHON_UNUSED PyObject *const *__pyx_kwvalues; + PyObject *__pyx_r = 0; + __Pyx_RefNannyDeclarations + __Pyx_RefNannySetupContext("__repr__ (wrapper)", 0); + __pyx_kwvalues = __Pyx_KwValues_VARARGS(__pyx_args, __pyx_nargs); + __pyx_r = __pyx_memoryview___pyx_pf_15View_dot_MemoryView_10memoryview_12__repr__(((struct __pyx_memoryview_obj *)__pyx_v_self)); + + /* function exit code */ + __Pyx_RefNannyFinishContext(); + return __pyx_r; +} + +static PyObject *__pyx_memoryview___pyx_pf_15View_dot_MemoryView_10memoryview_12__repr__(struct __pyx_memoryview_obj *__pyx_v_self) { + PyObject *__pyx_r = NULL; + __Pyx_RefNannyDeclarations + PyObject *__pyx_t_1 = NULL; + PyObject *__pyx_t_2 = NULL; + PyObject *__pyx_t_3 = NULL; + PyObject *__pyx_t_4[5]; + int __pyx_lineno = 0; + const char *__pyx_filename = NULL; + int __pyx_clineno = 0; + __Pyx_RefNannySetupContext("__repr__", 0); + + /* "View.MemoryView":618 + * + * def __repr__(self): + * return "" % (self.base.__class__.__name__, # <<<<<<<<<<<<<< + * id(self)) + * +*/ + __Pyx_XDECREF(__pyx_r); + __pyx_t_1 = __Pyx_PyObject_GetAttrStr(((PyObject *)__pyx_v_self), __pyx_mstate_global->__pyx_n_u_base); if (unlikely(!__pyx_t_1)) __PYX_ERR(1, 618, __pyx_L1_error) + __Pyx_GOTREF(__pyx_t_1); + __pyx_t_2 = __Pyx_PyObject_GetAttrStr(__pyx_t_1, __pyx_mstate_global->__pyx_n_u_class); if (unlikely(!__pyx_t_2)) __PYX_ERR(1, 618, __pyx_L1_error) + __Pyx_GOTREF(__pyx_t_2); + __Pyx_DECREF(__pyx_t_1); __pyx_t_1 = 0; + __pyx_t_1 = __Pyx_PyObject_GetAttrStr(__pyx_t_2, __pyx_mstate_global->__pyx_n_u_name_2); if (unlikely(!__pyx_t_1)) __PYX_ERR(1, 618, __pyx_L1_error) + __Pyx_GOTREF(__pyx_t_1); + __Pyx_DECREF(__pyx_t_2); __pyx_t_2 = 0; + __pyx_t_2 = __Pyx_PyObject_FormatSimpleAndDecref(PyObject_Repr(__pyx_t_1), __pyx_mstate_global->__pyx_empty_unicode); if (unlikely(!__pyx_t_2)) __PYX_ERR(1, 618, __pyx_L1_error) + __Pyx_GOTREF(__pyx_t_2); + __Pyx_DECREF(__pyx_t_1); __pyx_t_1 = 0; + + /* "View.MemoryView":619 + * def __repr__(self): + * return "" % (self.base.__class__.__name__, + * id(self)) # <<<<<<<<<<<<<< + * + * def __str__(self): +*/ + __pyx_t_1 = __Pyx_PyObject_CallOneArg(__pyx_builtin_id, ((PyObject *)__pyx_v_self)); if (unlikely(!__pyx_t_1)) __PYX_ERR(1, 619, __pyx_L1_error) + __Pyx_GOTREF(__pyx_t_1); + __pyx_t_3 = __Pyx_PyObject_Format(__pyx_t_1, __pyx_mstate_global->__pyx_n_u_x); if (unlikely(!__pyx_t_3)) __PYX_ERR(1, 619, __pyx_L1_error) + __Pyx_GOTREF(__pyx_t_3); + __Pyx_DECREF(__pyx_t_1); __pyx_t_1 = 0; + __pyx_t_4[0] = __pyx_mstate_global->__pyx_kp_u_MemoryView_of; + __pyx_t_4[1] = __pyx_t_2; + __pyx_t_4[2] = __pyx_mstate_global->__pyx_kp_u_at_0x; + __pyx_t_4[3] = __pyx_t_3; + __pyx_t_4[4] = __pyx_mstate_global->__pyx_kp_u__3; + + /* "View.MemoryView":618 + * + * def __repr__(self): + * return "" % (self.base.__class__.__name__, # <<<<<<<<<<<<<< + * id(self)) + * +*/ + __pyx_t_1 = __Pyx_PyUnicode_Join(__pyx_t_4, 5, 15 + __Pyx_PyUnicode_GET_LENGTH(__pyx_t_2) + 6 + __Pyx_PyUnicode_GET_LENGTH(__pyx_t_3) + 1, 127 | __Pyx_PyUnicode_MAX_CHAR_VALUE(__pyx_t_2) | __Pyx_PyUnicode_MAX_CHAR_VALUE(__pyx_t_3)); + if (unlikely(!__pyx_t_1)) __PYX_ERR(1, 618, __pyx_L1_error) + __Pyx_GOTREF(__pyx_t_1); + __Pyx_DECREF(__pyx_t_2); __pyx_t_2 = 0; + __Pyx_DECREF(__pyx_t_3); __pyx_t_3 = 0; + __pyx_r = __pyx_t_1; + __pyx_t_1 = 0; + goto __pyx_L0; + + /* "View.MemoryView":617 + * return 0 + * + * def __repr__(self): # <<<<<<<<<<<<<< + * return "" % (self.base.__class__.__name__, + * id(self)) +*/ + + /* function exit code */ + __pyx_L1_error:; + __Pyx_XDECREF(__pyx_t_1); + __Pyx_XDECREF(__pyx_t_2); + __Pyx_XDECREF(__pyx_t_3); + __Pyx_AddTraceback("View.MemoryView.memoryview.__repr__", __pyx_clineno, __pyx_lineno, __pyx_filename); + __pyx_r = NULL; + __pyx_L0:; + __Pyx_XGIVEREF(__pyx_r); + __Pyx_RefNannyFinishContext(); + return __pyx_r; +} + +/* "View.MemoryView":621 + * id(self)) + * + * def __str__(self): # <<<<<<<<<<<<<< + * return "" % (self.base.__class__.__name__,) + * +*/ + +/* Python wrapper */ +static PyObject *__pyx_memoryview___str__(PyObject *__pyx_v_self); /*proto*/ +static PyObject *__pyx_memoryview___str__(PyObject *__pyx_v_self) { + CYTHON_UNUSED PyObject *const *__pyx_kwvalues; + PyObject *__pyx_r = 0; + __Pyx_RefNannyDeclarations + __Pyx_RefNannySetupContext("__str__ (wrapper)", 0); + __pyx_kwvalues = __Pyx_KwValues_VARARGS(__pyx_args, __pyx_nargs); + __pyx_r = __pyx_memoryview___pyx_pf_15View_dot_MemoryView_10memoryview_14__str__(((struct __pyx_memoryview_obj *)__pyx_v_self)); + + /* function exit code */ + __Pyx_RefNannyFinishContext(); + return __pyx_r; +} + +static PyObject *__pyx_memoryview___pyx_pf_15View_dot_MemoryView_10memoryview_14__str__(struct __pyx_memoryview_obj *__pyx_v_self) { + PyObject *__pyx_r = NULL; + __Pyx_RefNannyDeclarations + PyObject *__pyx_t_1 = NULL; + PyObject *__pyx_t_2 = NULL; + PyObject *__pyx_t_3[3]; + int __pyx_lineno = 0; + const char *__pyx_filename = NULL; + int __pyx_clineno = 0; + __Pyx_RefNannySetupContext("__str__", 0); + + /* "View.MemoryView":622 + * + * def __str__(self): + * return "" % (self.base.__class__.__name__,) # <<<<<<<<<<<<<< + * + * +*/ + __Pyx_XDECREF(__pyx_r); + __pyx_t_1 = __Pyx_PyObject_GetAttrStr(((PyObject *)__pyx_v_self), __pyx_mstate_global->__pyx_n_u_base); if (unlikely(!__pyx_t_1)) __PYX_ERR(1, 622, __pyx_L1_error) + __Pyx_GOTREF(__pyx_t_1); + __pyx_t_2 = __Pyx_PyObject_GetAttrStr(__pyx_t_1, __pyx_mstate_global->__pyx_n_u_class); if (unlikely(!__pyx_t_2)) __PYX_ERR(1, 622, __pyx_L1_error) + __Pyx_GOTREF(__pyx_t_2); + __Pyx_DECREF(__pyx_t_1); __pyx_t_1 = 0; + __pyx_t_1 = __Pyx_PyObject_GetAttrStr(__pyx_t_2, __pyx_mstate_global->__pyx_n_u_name_2); if (unlikely(!__pyx_t_1)) __PYX_ERR(1, 622, __pyx_L1_error) + __Pyx_GOTREF(__pyx_t_1); + __Pyx_DECREF(__pyx_t_2); __pyx_t_2 = 0; + __pyx_t_2 = __Pyx_PyObject_FormatSimpleAndDecref(PyObject_Repr(__pyx_t_1), __pyx_mstate_global->__pyx_empty_unicode); if (unlikely(!__pyx_t_2)) __PYX_ERR(1, 622, __pyx_L1_error) + __Pyx_GOTREF(__pyx_t_2); + __Pyx_DECREF(__pyx_t_1); __pyx_t_1 = 0; + __pyx_t_3[0] = __pyx_mstate_global->__pyx_kp_u_MemoryView_of; + __pyx_t_3[1] = __pyx_t_2; + __pyx_t_3[2] = __pyx_mstate_global->__pyx_kp_u_object; + __pyx_t_1 = __Pyx_PyUnicode_Join(__pyx_t_3, 3, 15 + __Pyx_PyUnicode_GET_LENGTH(__pyx_t_2) + 8, 127 | __Pyx_PyUnicode_MAX_CHAR_VALUE(__pyx_t_2)); + if (unlikely(!__pyx_t_1)) __PYX_ERR(1, 622, __pyx_L1_error) + __Pyx_GOTREF(__pyx_t_1); + __Pyx_DECREF(__pyx_t_2); __pyx_t_2 = 0; + __pyx_r = __pyx_t_1; + __pyx_t_1 = 0; + goto __pyx_L0; + + /* "View.MemoryView":621 + * id(self)) + * + * def __str__(self): # <<<<<<<<<<<<<< + * return "" % (self.base.__class__.__name__,) + * +*/ + + /* function exit code */ + __pyx_L1_error:; + __Pyx_XDECREF(__pyx_t_1); + __Pyx_XDECREF(__pyx_t_2); + __Pyx_AddTraceback("View.MemoryView.memoryview.__str__", __pyx_clineno, __pyx_lineno, __pyx_filename); + __pyx_r = NULL; + __pyx_L0:; + __Pyx_XGIVEREF(__pyx_r); + __Pyx_RefNannyFinishContext(); + return __pyx_r; +} + +/* "View.MemoryView":625 + * + * + * def is_c_contig(self): # <<<<<<<<<<<<<< + * cdef __Pyx_memviewslice *mslice + * cdef __Pyx_memviewslice tmp +*/ + +/* Python wrapper */ +static PyObject *__pyx_memoryview_is_c_contig(PyObject *__pyx_v_self, +#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*/ +static PyObject *__pyx_memoryview_is_c_contig(PyObject *__pyx_v_self, +#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_c_contig (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_c_contig", 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_c_contig", __pyx_kwds); return NULL;} + __pyx_r = __pyx_memoryview___pyx_pf_15View_dot_MemoryView_10memoryview_16is_c_contig(((struct __pyx_memoryview_obj *)__pyx_v_self)); + + /* function exit code */ + __Pyx_RefNannyFinishContext(); + return __pyx_r; +} + +static PyObject *__pyx_memoryview___pyx_pf_15View_dot_MemoryView_10memoryview_16is_c_contig(struct __pyx_memoryview_obj *__pyx_v_self) { + __Pyx_memviewslice *__pyx_v_mslice; + __Pyx_memviewslice __pyx_v_tmp; + PyObject *__pyx_r = NULL; + __Pyx_RefNannyDeclarations + __Pyx_memviewslice *__pyx_t_1; + PyObject *__pyx_t_2 = NULL; + int __pyx_lineno = 0; + const char *__pyx_filename = NULL; + int __pyx_clineno = 0; + __Pyx_RefNannySetupContext("is_c_contig", 0); + + /* "View.MemoryView":628 + * cdef __Pyx_memviewslice *mslice + * cdef __Pyx_memviewslice tmp + * mslice = get_slice_from_memview(self, &tmp) # <<<<<<<<<<<<<< + * return slice_is_contig(mslice[0], 'C', self.view.ndim) + * +*/ + __pyx_t_1 = __pyx_memoryview_get_slice_from_memoryview(__pyx_v_self, (&__pyx_v_tmp)); if (unlikely(__pyx_t_1 == ((void *)NULL))) __PYX_ERR(1, 628, __pyx_L1_error) + __pyx_v_mslice = __pyx_t_1; + + /* "View.MemoryView":629 + * cdef __Pyx_memviewslice tmp + * mslice = get_slice_from_memview(self, &tmp) + * return slice_is_contig(mslice[0], 'C', self.view.ndim) # <<<<<<<<<<<<<< + * + * def is_f_contig(self): +*/ + __Pyx_XDECREF(__pyx_r); + __pyx_t_2 = __Pyx_PyBool_FromLong(__pyx_memviewslice_is_contig((__pyx_v_mslice[0]), 'C', __pyx_v_self->view.ndim)); if (unlikely(!__pyx_t_2)) __PYX_ERR(1, 629, __pyx_L1_error) + __Pyx_GOTREF(__pyx_t_2); + __pyx_r = __pyx_t_2; + __pyx_t_2 = 0; + goto __pyx_L0; + + /* "View.MemoryView":625 + * + * + * def is_c_contig(self): # <<<<<<<<<<<<<< + * cdef __Pyx_memviewslice *mslice + * cdef __Pyx_memviewslice tmp +*/ + + /* function exit code */ + __pyx_L1_error:; + __Pyx_XDECREF(__pyx_t_2); + __Pyx_AddTraceback("View.MemoryView.memoryview.is_c_contig", __pyx_clineno, __pyx_lineno, __pyx_filename); + __pyx_r = NULL; + __pyx_L0:; + __Pyx_XGIVEREF(__pyx_r); + __Pyx_RefNannyFinishContext(); + return __pyx_r; +} + +/* "View.MemoryView":631 + * return slice_is_contig(mslice[0], 'C', self.view.ndim) + * + * def is_f_contig(self): # <<<<<<<<<<<<<< + * cdef __Pyx_memviewslice *mslice + * cdef __Pyx_memviewslice tmp +*/ + +/* Python wrapper */ +static PyObject *__pyx_memoryview_is_f_contig(PyObject *__pyx_v_self, +#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*/ +static PyObject *__pyx_memoryview_is_f_contig(PyObject *__pyx_v_self, +#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_f_contig (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_f_contig", 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_f_contig", __pyx_kwds); return NULL;} + __pyx_r = __pyx_memoryview___pyx_pf_15View_dot_MemoryView_10memoryview_18is_f_contig(((struct __pyx_memoryview_obj *)__pyx_v_self)); + + /* function exit code */ + __Pyx_RefNannyFinishContext(); + return __pyx_r; +} + +static PyObject *__pyx_memoryview___pyx_pf_15View_dot_MemoryView_10memoryview_18is_f_contig(struct __pyx_memoryview_obj *__pyx_v_self) { + __Pyx_memviewslice *__pyx_v_mslice; + __Pyx_memviewslice __pyx_v_tmp; + PyObject *__pyx_r = NULL; + __Pyx_RefNannyDeclarations + __Pyx_memviewslice *__pyx_t_1; + PyObject *__pyx_t_2 = NULL; + int __pyx_lineno = 0; + const char *__pyx_filename = NULL; + int __pyx_clineno = 0; + __Pyx_RefNannySetupContext("is_f_contig", 0); + + /* "View.MemoryView":634 + * cdef __Pyx_memviewslice *mslice + * cdef __Pyx_memviewslice tmp + * mslice = get_slice_from_memview(self, &tmp) # <<<<<<<<<<<<<< + * return slice_is_contig(mslice[0], 'F', self.view.ndim) + * +*/ + __pyx_t_1 = __pyx_memoryview_get_slice_from_memoryview(__pyx_v_self, (&__pyx_v_tmp)); if (unlikely(__pyx_t_1 == ((void *)NULL))) __PYX_ERR(1, 634, __pyx_L1_error) + __pyx_v_mslice = __pyx_t_1; + + /* "View.MemoryView":635 + * cdef __Pyx_memviewslice tmp + * mslice = get_slice_from_memview(self, &tmp) + * return slice_is_contig(mslice[0], 'F', self.view.ndim) # <<<<<<<<<<<<<< + * + * def copy(self): +*/ + __Pyx_XDECREF(__pyx_r); + __pyx_t_2 = __Pyx_PyBool_FromLong(__pyx_memviewslice_is_contig((__pyx_v_mslice[0]), 'F', __pyx_v_self->view.ndim)); if (unlikely(!__pyx_t_2)) __PYX_ERR(1, 635, __pyx_L1_error) + __Pyx_GOTREF(__pyx_t_2); + __pyx_r = __pyx_t_2; + __pyx_t_2 = 0; + goto __pyx_L0; + + /* "View.MemoryView":631 + * return slice_is_contig(mslice[0], 'C', self.view.ndim) + * + * def is_f_contig(self): # <<<<<<<<<<<<<< + * cdef __Pyx_memviewslice *mslice + * cdef __Pyx_memviewslice tmp +*/ + + /* function exit code */ + __pyx_L1_error:; + __Pyx_XDECREF(__pyx_t_2); + __Pyx_AddTraceback("View.MemoryView.memoryview.is_f_contig", __pyx_clineno, __pyx_lineno, __pyx_filename); + __pyx_r = NULL; + __pyx_L0:; + __Pyx_XGIVEREF(__pyx_r); + __Pyx_RefNannyFinishContext(); + return __pyx_r; +} + +/* "View.MemoryView":637 + * return slice_is_contig(mslice[0], 'F', self.view.ndim) + * + * def copy(self): # <<<<<<<<<<<<<< + * cdef __Pyx_memviewslice mslice + * cdef int flags = self.flags & ~PyBUF_F_CONTIGUOUS +*/ + +/* Python wrapper */ +static PyObject *__pyx_memoryview_copy(PyObject *__pyx_v_self, +#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*/ +static PyObject *__pyx_memoryview_copy(PyObject *__pyx_v_self, +#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("copy (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("copy", 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("copy", __pyx_kwds); return NULL;} + __pyx_r = __pyx_memoryview___pyx_pf_15View_dot_MemoryView_10memoryview_20copy(((struct __pyx_memoryview_obj *)__pyx_v_self)); + + /* function exit code */ + __Pyx_RefNannyFinishContext(); + return __pyx_r; +} + +static PyObject *__pyx_memoryview___pyx_pf_15View_dot_MemoryView_10memoryview_20copy(struct __pyx_memoryview_obj *__pyx_v_self) { + __Pyx_memviewslice __pyx_v_mslice; + int __pyx_v_flags; + PyObject *__pyx_r = NULL; + __Pyx_RefNannyDeclarations + __Pyx_memviewslice __pyx_t_1; + PyObject *__pyx_t_2 = NULL; + int __pyx_lineno = 0; + const char *__pyx_filename = NULL; + int __pyx_clineno = 0; + __Pyx_RefNannySetupContext("copy", 0); + + /* "View.MemoryView":639 + * def copy(self): + * cdef __Pyx_memviewslice mslice + * cdef int flags = self.flags & ~PyBUF_F_CONTIGUOUS # <<<<<<<<<<<<<< + * + * slice_copy(self, &mslice) +*/ + __pyx_v_flags = (__pyx_v_self->flags & (~PyBUF_F_CONTIGUOUS)); + + /* "View.MemoryView":641 + * cdef int flags = self.flags & ~PyBUF_F_CONTIGUOUS + * + * slice_copy(self, &mslice) # <<<<<<<<<<<<<< + * mslice = slice_copy_contig(&mslice, "c", self.view.ndim, + * self.view.itemsize, +*/ + __pyx_memoryview_slice_copy(__pyx_v_self, (&__pyx_v_mslice)); + + /* "View.MemoryView":642 + * + * slice_copy(self, &mslice) + * mslice = slice_copy_contig(&mslice, "c", self.view.ndim, # <<<<<<<<<<<<<< + * self.view.itemsize, + * flags|PyBUF_C_CONTIGUOUS, +*/ + __pyx_t_1 = __pyx_memoryview_copy_new_contig((&__pyx_v_mslice), ((char const *)"c"), __pyx_v_self->view.ndim, __pyx_v_self->view.itemsize, (__pyx_v_flags | PyBUF_C_CONTIGUOUS), __pyx_v_self->dtype_is_object); if (unlikely(PyErr_Occurred())) __PYX_ERR(1, 642, __pyx_L1_error) + __pyx_v_mslice = __pyx_t_1; + + /* "View.MemoryView":647 + * self.dtype_is_object) + * + * return memoryview_copy_from_slice(self, &mslice) # <<<<<<<<<<<<<< + * + * def copy_fortran(self): +*/ + __Pyx_XDECREF(__pyx_r); + __pyx_t_2 = __pyx_memoryview_copy_object_from_slice(__pyx_v_self, (&__pyx_v_mslice)); if (unlikely(!__pyx_t_2)) __PYX_ERR(1, 647, __pyx_L1_error) + __Pyx_GOTREF(__pyx_t_2); + __pyx_r = __pyx_t_2; + __pyx_t_2 = 0; + goto __pyx_L0; + + /* "View.MemoryView":637 + * return slice_is_contig(mslice[0], 'F', self.view.ndim) + * + * def copy(self): # <<<<<<<<<<<<<< + * cdef __Pyx_memviewslice mslice + * cdef int flags = self.flags & ~PyBUF_F_CONTIGUOUS +*/ + + /* function exit code */ + __pyx_L1_error:; + __Pyx_XDECREF(__pyx_t_2); + __Pyx_AddTraceback("View.MemoryView.memoryview.copy", __pyx_clineno, __pyx_lineno, __pyx_filename); + __pyx_r = NULL; + __pyx_L0:; + __Pyx_XGIVEREF(__pyx_r); + __Pyx_RefNannyFinishContext(); + return __pyx_r; +} + +/* "View.MemoryView":649 + * return memoryview_copy_from_slice(self, &mslice) + * + * def copy_fortran(self): # <<<<<<<<<<<<<< + * cdef __Pyx_memviewslice src, dst + * cdef int flags = self.flags & ~PyBUF_C_CONTIGUOUS +*/ + +/* Python wrapper */ +static PyObject *__pyx_memoryview_copy_fortran(PyObject *__pyx_v_self, +#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*/ +static PyObject *__pyx_memoryview_copy_fortran(PyObject *__pyx_v_self, +#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("copy_fortran (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("copy_fortran", 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("copy_fortran", __pyx_kwds); return NULL;} + __pyx_r = __pyx_memoryview___pyx_pf_15View_dot_MemoryView_10memoryview_22copy_fortran(((struct __pyx_memoryview_obj *)__pyx_v_self)); + + /* function exit code */ + __Pyx_RefNannyFinishContext(); + return __pyx_r; +} + +static PyObject *__pyx_memoryview___pyx_pf_15View_dot_MemoryView_10memoryview_22copy_fortran(struct __pyx_memoryview_obj *__pyx_v_self) { + __Pyx_memviewslice __pyx_v_src; + __Pyx_memviewslice __pyx_v_dst; + int __pyx_v_flags; + PyObject *__pyx_r = NULL; + __Pyx_RefNannyDeclarations + __Pyx_memviewslice __pyx_t_1; + PyObject *__pyx_t_2 = NULL; + int __pyx_lineno = 0; + const char *__pyx_filename = NULL; + int __pyx_clineno = 0; + __Pyx_RefNannySetupContext("copy_fortran", 0); + + /* "View.MemoryView":651 + * def copy_fortran(self): + * cdef __Pyx_memviewslice src, dst + * cdef int flags = self.flags & ~PyBUF_C_CONTIGUOUS # <<<<<<<<<<<<<< + * + * slice_copy(self, &src) +*/ + __pyx_v_flags = (__pyx_v_self->flags & (~PyBUF_C_CONTIGUOUS)); + + /* "View.MemoryView":653 + * cdef int flags = self.flags & ~PyBUF_C_CONTIGUOUS + * + * slice_copy(self, &src) # <<<<<<<<<<<<<< + * dst = slice_copy_contig(&src, "fortran", self.view.ndim, + * self.view.itemsize, +*/ + __pyx_memoryview_slice_copy(__pyx_v_self, (&__pyx_v_src)); + + /* "View.MemoryView":654 + * + * slice_copy(self, &src) + * dst = slice_copy_contig(&src, "fortran", self.view.ndim, # <<<<<<<<<<<<<< + * self.view.itemsize, + * flags|PyBUF_F_CONTIGUOUS, +*/ + __pyx_t_1 = __pyx_memoryview_copy_new_contig((&__pyx_v_src), ((char const *)"fortran"), __pyx_v_self->view.ndim, __pyx_v_self->view.itemsize, (__pyx_v_flags | PyBUF_F_CONTIGUOUS), __pyx_v_self->dtype_is_object); if (unlikely(PyErr_Occurred())) __PYX_ERR(1, 654, __pyx_L1_error) + __pyx_v_dst = __pyx_t_1; + + /* "View.MemoryView":659 + * self.dtype_is_object) + * + * return memoryview_copy_from_slice(self, &dst) # <<<<<<<<<<<<<< + * + * +*/ + __Pyx_XDECREF(__pyx_r); + __pyx_t_2 = __pyx_memoryview_copy_object_from_slice(__pyx_v_self, (&__pyx_v_dst)); if (unlikely(!__pyx_t_2)) __PYX_ERR(1, 659, __pyx_L1_error) + __Pyx_GOTREF(__pyx_t_2); + __pyx_r = __pyx_t_2; + __pyx_t_2 = 0; + goto __pyx_L0; + + /* "View.MemoryView":649 + * return memoryview_copy_from_slice(self, &mslice) + * + * def copy_fortran(self): # <<<<<<<<<<<<<< + * cdef __Pyx_memviewslice src, dst + * cdef int flags = self.flags & ~PyBUF_C_CONTIGUOUS +*/ + + /* function exit code */ + __pyx_L1_error:; + __Pyx_XDECREF(__pyx_t_2); + __Pyx_AddTraceback("View.MemoryView.memoryview.copy_fortran", __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___pyx_memoryview_1__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*/ +static PyObject *__pyx_pw___pyx_memoryview_1__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___pyx_memoryview___reduce_cython__(((struct __pyx_memoryview_obj *)__pyx_v_self)); + + /* function exit code */ + __Pyx_RefNannyFinishContext(); + return __pyx_r; +} + +static PyObject *__pyx_pf___pyx_memoryview___reduce_cython__(CYTHON_UNUSED struct __pyx_memoryview_obj *__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("View.MemoryView.memoryview.__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___pyx_memoryview_3__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*/ +static PyObject *__pyx_pw___pyx_memoryview_3__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("View.MemoryView.memoryview.__setstate_cython__", __pyx_clineno, __pyx_lineno, __pyx_filename); + __Pyx_RefNannyFinishContext(); + return NULL; + __pyx_L4_argument_unpacking_done:; + __pyx_r = __pyx_pf___pyx_memoryview_2__setstate_cython__(((struct __pyx_memoryview_obj *)__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___pyx_memoryview_2__setstate_cython__(CYTHON_UNUSED struct __pyx_memoryview_obj *__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("View.MemoryView.memoryview.__setstate_cython__", __pyx_clineno, __pyx_lineno, __pyx_filename); + __pyx_r = NULL; + __Pyx_XGIVEREF(__pyx_r); + __Pyx_RefNannyFinishContext(); + return __pyx_r; +} + +/* "View.MemoryView":662 + * + * + * @cname('__pyx_memoryview_new') # <<<<<<<<<<<<<< + * cdef memoryview_cwrapper(object o, int flags, bint dtype_is_object, const __Pyx_TypeInfo *typeinfo): + * cdef memoryview result = memoryview(o, flags, dtype_is_object) +*/ + +static PyObject *__pyx_memoryview_new(PyObject *__pyx_v_o, int __pyx_v_flags, int __pyx_v_dtype_is_object, __Pyx_TypeInfo const *__pyx_v_typeinfo) { + struct __pyx_memoryview_obj *__pyx_v_result = 0; + PyObject *__pyx_r = NULL; + __Pyx_RefNannyDeclarations + PyObject *__pyx_t_1 = NULL; + PyObject *__pyx_t_2 = NULL; + PyObject *__pyx_t_3 = NULL; + PyObject *__pyx_t_4 = NULL; + size_t __pyx_t_5; + int __pyx_lineno = 0; + const char *__pyx_filename = NULL; + int __pyx_clineno = 0; + __Pyx_RefNannySetupContext("memoryview_cwrapper", 0); + + /* "View.MemoryView":664 + * @cname('__pyx_memoryview_new') + * cdef memoryview_cwrapper(object o, int flags, bint dtype_is_object, const __Pyx_TypeInfo *typeinfo): + * cdef memoryview result = memoryview(o, flags, dtype_is_object) # <<<<<<<<<<<<<< + * result.typeinfo = typeinfo + * return result +*/ + __pyx_t_2 = NULL; + __pyx_t_3 = __Pyx_PyLong_From_int(__pyx_v_flags); if (unlikely(!__pyx_t_3)) __PYX_ERR(1, 664, __pyx_L1_error) + __Pyx_GOTREF(__pyx_t_3); + __pyx_t_4 = __Pyx_PyBool_FromLong(__pyx_v_dtype_is_object); if (unlikely(!__pyx_t_4)) __PYX_ERR(1, 664, __pyx_L1_error) + __Pyx_GOTREF(__pyx_t_4); + __pyx_t_5 = 1; + { + PyObject *__pyx_callargs[4] = {__pyx_t_2, __pyx_v_o, __pyx_t_3, __pyx_t_4}; + __pyx_t_1 = __Pyx_PyObject_FastCall((PyObject*)__pyx_mstate_global->__pyx_memoryview_type, __pyx_callargs+__pyx_t_5, (4-__pyx_t_5) | (__pyx_t_5*__Pyx_PY_VECTORCALL_ARGUMENTS_OFFSET)); + __Pyx_XDECREF(__pyx_t_2); __pyx_t_2 = 0; + __Pyx_DECREF(__pyx_t_3); __pyx_t_3 = 0; + __Pyx_DECREF(__pyx_t_4); __pyx_t_4 = 0; + if (unlikely(!__pyx_t_1)) __PYX_ERR(1, 664, __pyx_L1_error) + __Pyx_GOTREF((PyObject *)__pyx_t_1); + } + __pyx_v_result = ((struct __pyx_memoryview_obj *)__pyx_t_1); + __pyx_t_1 = 0; + + /* "View.MemoryView":665 + * cdef memoryview_cwrapper(object o, int flags, bint dtype_is_object, const __Pyx_TypeInfo *typeinfo): + * cdef memoryview result = memoryview(o, flags, dtype_is_object) + * result.typeinfo = typeinfo # <<<<<<<<<<<<<< + * return result + * +*/ + __pyx_v_result->typeinfo = __pyx_v_typeinfo; + + /* "View.MemoryView":666 + * cdef memoryview result = memoryview(o, flags, dtype_is_object) + * result.typeinfo = typeinfo + * return result # <<<<<<<<<<<<<< + * + * @cname('__pyx_memoryview_check') +*/ + __Pyx_XDECREF(__pyx_r); + __Pyx_INCREF((PyObject *)__pyx_v_result); + __pyx_r = ((PyObject *)__pyx_v_result); + goto __pyx_L0; + + /* "View.MemoryView":662 + * + * + * @cname('__pyx_memoryview_new') # <<<<<<<<<<<<<< + * cdef memoryview_cwrapper(object o, int flags, bint dtype_is_object, const __Pyx_TypeInfo *typeinfo): + * cdef memoryview result = memoryview(o, flags, dtype_is_object) +*/ + + /* function exit code */ + __pyx_L1_error:; + __Pyx_XDECREF(__pyx_t_1); + __Pyx_XDECREF(__pyx_t_2); + __Pyx_XDECREF(__pyx_t_3); + __Pyx_XDECREF(__pyx_t_4); + __Pyx_AddTraceback("View.MemoryView.memoryview_cwrapper", __pyx_clineno, __pyx_lineno, __pyx_filename); + __pyx_r = 0; + __pyx_L0:; + __Pyx_XDECREF((PyObject *)__pyx_v_result); + __Pyx_XGIVEREF(__pyx_r); + __Pyx_RefNannyFinishContext(); + return __pyx_r; +} + +/* "View.MemoryView":668 + * return result + * + * @cname('__pyx_memoryview_check') # <<<<<<<<<<<<<< + * cdef inline bint memoryview_check(object o) noexcept: + * return isinstance(o, memoryview) +*/ + +static CYTHON_INLINE int __pyx_memoryview_check(PyObject *__pyx_v_o) { + int __pyx_r; + int __pyx_t_1; + + /* "View.MemoryView":670 + * @cname('__pyx_memoryview_check') + * cdef inline bint memoryview_check(object o) noexcept: + * return isinstance(o, memoryview) # <<<<<<<<<<<<<< + * + * cdef tuple _unellipsify(object index, int ndim): +*/ + __pyx_t_1 = __Pyx_TypeCheck(__pyx_v_o, __pyx_mstate_global->__pyx_memoryview_type); + __pyx_r = __pyx_t_1; + goto __pyx_L0; + + /* "View.MemoryView":668 + * return result + * + * @cname('__pyx_memoryview_check') # <<<<<<<<<<<<<< + * cdef inline bint memoryview_check(object o) noexcept: + * return isinstance(o, memoryview) +*/ + + /* function exit code */ + __pyx_L0:; + return __pyx_r; +} + +/* "View.MemoryView":672 + * return isinstance(o, memoryview) + * + * cdef tuple _unellipsify(object index, int ndim): # <<<<<<<<<<<<<< + * """ + * Replace all ellipses with full slices and fill incomplete indices with +*/ + +static PyObject *_unellipsify(PyObject *__pyx_v_index, int __pyx_v_ndim) { + Py_ssize_t __pyx_v_idx; + PyObject *__pyx_v_tup = NULL; + PyObject *__pyx_v_result = NULL; + int __pyx_v_have_slices; + int __pyx_v_seen_ellipsis; + PyObject *__pyx_v_item = NULL; + Py_ssize_t __pyx_v_nslices; + PyObject *__pyx_r = NULL; + __Pyx_RefNannyDeclarations + PyObject *__pyx_t_1 = NULL; + int __pyx_t_2; + PyObject *__pyx_t_3 = NULL; + Py_ssize_t __pyx_t_4; + Py_ssize_t __pyx_t_5; + PyObject *__pyx_t_6[3]; + PyObject *__pyx_t_7 = NULL; + int __pyx_lineno = 0; + const char *__pyx_filename = NULL; + int __pyx_clineno = 0; + __Pyx_RefNannySetupContext("_unellipsify", 0); + + /* "View.MemoryView":678 + * """ + * cdef Py_ssize_t idx + * tup = index if isinstance(index, tuple) else (index,) # <<<<<<<<<<<<<< + * + * result = [slice(None)] * ndim +*/ + __pyx_t_2 = PyTuple_Check(__pyx_v_index); + if (__pyx_t_2) { + __Pyx_INCREF(((PyObject*)__pyx_v_index)); + __pyx_t_1 = __pyx_v_index; + } else { + __pyx_t_3 = PyTuple_New(1); if (unlikely(!__pyx_t_3)) __PYX_ERR(1, 678, __pyx_L1_error) + __Pyx_GOTREF(__pyx_t_3); + __Pyx_INCREF(__pyx_v_index); + __Pyx_GIVEREF(__pyx_v_index); + if (__Pyx_PyTuple_SET_ITEM(__pyx_t_3, 0, __pyx_v_index) != (0)) __PYX_ERR(1, 678, __pyx_L1_error); + __pyx_t_1 = __pyx_t_3; + __pyx_t_3 = 0; + } + __pyx_v_tup = ((PyObject*)__pyx_t_1); + __pyx_t_1 = 0; + + /* "View.MemoryView":680 + * tup = index if isinstance(index, tuple) else (index,) + * + * result = [slice(None)] * ndim # <<<<<<<<<<<<<< + * have_slices = False + * seen_ellipsis = False +*/ + __pyx_t_1 = PyList_New(1 * ((__pyx_v_ndim<0) ? 0:__pyx_v_ndim)); if (unlikely(!__pyx_t_1)) __PYX_ERR(1, 680, __pyx_L1_error) + __Pyx_GOTREF(__pyx_t_1); + { Py_ssize_t __pyx_temp; + for (__pyx_temp=0; __pyx_temp < __pyx_v_ndim; __pyx_temp++) { + __Pyx_INCREF(__pyx_mstate_global->__pyx_slice[0]); + __Pyx_GIVEREF(__pyx_mstate_global->__pyx_slice[0]); + if (__Pyx_PyList_SET_ITEM(__pyx_t_1, __pyx_temp, __pyx_mstate_global->__pyx_slice[0]) != (0)) __PYX_ERR(1, 680, __pyx_L1_error); + } + } + __pyx_v_result = ((PyObject*)__pyx_t_1); + __pyx_t_1 = 0; + + /* "View.MemoryView":681 + * + * result = [slice(None)] * ndim + * have_slices = False # <<<<<<<<<<<<<< + * seen_ellipsis = False + * idx = 0 +*/ + __pyx_v_have_slices = 0; + + /* "View.MemoryView":682 + * result = [slice(None)] * ndim + * have_slices = False + * seen_ellipsis = False # <<<<<<<<<<<<<< + * idx = 0 + * for item in tup: +*/ + __pyx_v_seen_ellipsis = 0; + + /* "View.MemoryView":683 + * have_slices = False + * seen_ellipsis = False + * idx = 0 # <<<<<<<<<<<<<< + * for item in tup: + * if item is Ellipsis: +*/ + __pyx_v_idx = 0; + + /* "View.MemoryView":684 + * seen_ellipsis = False + * idx = 0 + * for item in tup: # <<<<<<<<<<<<<< + * if item is Ellipsis: + * if not seen_ellipsis: +*/ + if (unlikely(__pyx_v_tup == Py_None)) { + PyErr_SetString(PyExc_TypeError, "'NoneType' object is not iterable"); + __PYX_ERR(1, 684, __pyx_L1_error) + } + __pyx_t_1 = __pyx_v_tup; __Pyx_INCREF(__pyx_t_1); + __pyx_t_4 = 0; + for (;;) { + { + Py_ssize_t __pyx_temp = __Pyx_PyTuple_GET_SIZE(__pyx_t_1); + #if !CYTHON_ASSUME_SAFE_SIZE + if (unlikely((__pyx_temp < 0))) __PYX_ERR(1, 684, __pyx_L1_error) + #endif + if (__pyx_t_4 >= __pyx_temp) break; + } + #if CYTHON_ASSUME_SAFE_MACROS && !CYTHON_AVOID_BORROWED_REFS + __pyx_t_3 = __Pyx_NewRef(PyTuple_GET_ITEM(__pyx_t_1, __pyx_t_4)); + #else + __pyx_t_3 = __Pyx_PySequence_ITEM(__pyx_t_1, __pyx_t_4); + #endif + ++__pyx_t_4; + if (unlikely(!__pyx_t_3)) __PYX_ERR(1, 684, __pyx_L1_error) + __Pyx_GOTREF(__pyx_t_3); + __Pyx_XDECREF_SET(__pyx_v_item, __pyx_t_3); + __pyx_t_3 = 0; + + /* "View.MemoryView":685 + * idx = 0 + * for item in tup: + * if item is Ellipsis: # <<<<<<<<<<<<<< + * if not seen_ellipsis: + * idx += ndim - len(tup) +*/ + __pyx_t_2 = (__pyx_v_item == __pyx_builtin_Ellipsis); + if (__pyx_t_2) { + + /* "View.MemoryView":686 + * for item in tup: + * if item is Ellipsis: + * if not seen_ellipsis: # <<<<<<<<<<<<<< + * idx += ndim - len(tup) + * seen_ellipsis = True +*/ + __pyx_t_2 = (!__pyx_v_seen_ellipsis); + if (__pyx_t_2) { + + /* "View.MemoryView":687 + * if item is Ellipsis: + * if not seen_ellipsis: + * idx += ndim - len(tup) # <<<<<<<<<<<<<< + * seen_ellipsis = True + * have_slices = True +*/ + if (unlikely(__pyx_v_tup == Py_None)) { + PyErr_SetString(PyExc_TypeError, "object of type 'NoneType' has no len()"); + __PYX_ERR(1, 687, __pyx_L1_error) + } + __pyx_t_5 = __Pyx_PyTuple_GET_SIZE(__pyx_v_tup); if (unlikely(__pyx_t_5 == ((Py_ssize_t)-1))) __PYX_ERR(1, 687, __pyx_L1_error) + __pyx_v_idx = (__pyx_v_idx + (__pyx_v_ndim - __pyx_t_5)); + + /* "View.MemoryView":688 + * if not seen_ellipsis: + * idx += ndim - len(tup) + * seen_ellipsis = True # <<<<<<<<<<<<<< + * have_slices = True + * else: +*/ + __pyx_v_seen_ellipsis = 1; + + /* "View.MemoryView":686 + * for item in tup: + * if item is Ellipsis: + * if not seen_ellipsis: # <<<<<<<<<<<<<< + * idx += ndim - len(tup) + * seen_ellipsis = True +*/ + } + + /* "View.MemoryView":689 + * idx += ndim - len(tup) + * seen_ellipsis = True + * have_slices = True # <<<<<<<<<<<<<< + * else: + * if isinstance(item, slice): +*/ + __pyx_v_have_slices = 1; + + /* "View.MemoryView":685 + * idx = 0 + * for item in tup: + * if item is Ellipsis: # <<<<<<<<<<<<<< + * if not seen_ellipsis: + * idx += ndim - len(tup) +*/ + goto __pyx_L5; + } + + /* "View.MemoryView":691 + * have_slices = True + * else: + * if isinstance(item, slice): # <<<<<<<<<<<<<< + * have_slices = True + * elif not PyIndex_Check(item): +*/ + /*else*/ { + __pyx_t_2 = PySlice_Check(__pyx_v_item); + if (__pyx_t_2) { + + /* "View.MemoryView":692 + * else: + * if isinstance(item, slice): + * have_slices = True # <<<<<<<<<<<<<< + * elif not PyIndex_Check(item): + * raise TypeError, f"Cannot index with type '{type(item)}'" +*/ + __pyx_v_have_slices = 1; + + /* "View.MemoryView":691 + * have_slices = True + * else: + * if isinstance(item, slice): # <<<<<<<<<<<<<< + * have_slices = True + * elif not PyIndex_Check(item): +*/ + goto __pyx_L7; + } + + /* "View.MemoryView":693 + * if isinstance(item, slice): + * have_slices = True + * elif not PyIndex_Check(item): # <<<<<<<<<<<<<< + * raise TypeError, f"Cannot index with type '{type(item)}'" + * result[idx] = item +*/ + __pyx_t_2 = (!(PyIndex_Check(__pyx_v_item) != 0)); + if (unlikely(__pyx_t_2)) { + + /* "View.MemoryView":694 + * have_slices = True + * elif not PyIndex_Check(item): + * raise TypeError, f"Cannot index with type '{type(item)}'" # <<<<<<<<<<<<<< + * result[idx] = item + * idx += 1 +*/ + __pyx_t_3 = __Pyx_PyObject_FormatSimple(((PyObject *)Py_TYPE(__pyx_v_item)), __pyx_mstate_global->__pyx_empty_unicode); if (unlikely(!__pyx_t_3)) __PYX_ERR(1, 694, __pyx_L1_error) + __Pyx_GOTREF(__pyx_t_3); + __pyx_t_6[0] = __pyx_mstate_global->__pyx_kp_u_Cannot_index_with_type; + __pyx_t_6[1] = __pyx_t_3; + __pyx_t_6[2] = __pyx_mstate_global->__pyx_kp_u__4; + __pyx_t_7 = __Pyx_PyUnicode_Join(__pyx_t_6, 3, 24 + __Pyx_PyUnicode_GET_LENGTH(__pyx_t_3) + 1, 127 | __Pyx_PyUnicode_MAX_CHAR_VALUE(__pyx_t_3)); + if (unlikely(!__pyx_t_7)) __PYX_ERR(1, 694, __pyx_L1_error) + __Pyx_GOTREF(__pyx_t_7); + __Pyx_DECREF(__pyx_t_3); __pyx_t_3 = 0; + __Pyx_Raise(((PyObject *)(((PyTypeObject*)PyExc_TypeError))), __pyx_t_7, 0, 0); + __Pyx_DECREF(__pyx_t_7); __pyx_t_7 = 0; + __PYX_ERR(1, 694, __pyx_L1_error) + + /* "View.MemoryView":693 + * if isinstance(item, slice): + * have_slices = True + * elif not PyIndex_Check(item): # <<<<<<<<<<<<<< + * raise TypeError, f"Cannot index with type '{type(item)}'" + * result[idx] = item +*/ + } + __pyx_L7:; + + /* "View.MemoryView":695 + * elif not PyIndex_Check(item): + * raise TypeError, f"Cannot index with type '{type(item)}'" + * result[idx] = item # <<<<<<<<<<<<<< + * idx += 1 + * +*/ + if (unlikely((__Pyx_SetItemInt(__pyx_v_result, __pyx_v_idx, __pyx_v_item, Py_ssize_t, 1, PyLong_FromSsize_t, 1, 1, 1, 1, __Pyx_ReferenceSharing_OwnStrongReference) < 0))) __PYX_ERR(1, 695, __pyx_L1_error) + } + __pyx_L5:; + + /* "View.MemoryView":696 + * raise TypeError, f"Cannot index with type '{type(item)}'" + * result[idx] = item + * idx += 1 # <<<<<<<<<<<<<< + * + * nslices = ndim - idx +*/ + __pyx_v_idx = (__pyx_v_idx + 1); + + /* "View.MemoryView":684 + * seen_ellipsis = False + * idx = 0 + * for item in tup: # <<<<<<<<<<<<<< + * if item is Ellipsis: + * if not seen_ellipsis: +*/ + } + __Pyx_DECREF(__pyx_t_1); __pyx_t_1 = 0; + + /* "View.MemoryView":698 + * idx += 1 + * + * nslices = ndim - idx # <<<<<<<<<<<<<< + * return have_slices or nslices, tuple(result) + * +*/ + __pyx_v_nslices = (__pyx_v_ndim - __pyx_v_idx); + + /* "View.MemoryView":699 + * + * nslices = ndim - idx + * return have_slices or nslices, tuple(result) # <<<<<<<<<<<<<< + * + * cdef int assert_direct_dimensions(Py_ssize_t *suboffsets, int ndim) except -1: +*/ + __Pyx_XDECREF(__pyx_r); + if (!__pyx_v_have_slices) { + } else { + __pyx_t_7 = __Pyx_PyBool_FromLong(__pyx_v_have_slices); if (unlikely(!__pyx_t_7)) __PYX_ERR(1, 699, __pyx_L1_error) + __Pyx_GOTREF(__pyx_t_7); + __pyx_t_1 = __pyx_t_7; + __pyx_t_7 = 0; + goto __pyx_L9_bool_binop_done; + } + __pyx_t_7 = PyLong_FromSsize_t(__pyx_v_nslices); if (unlikely(!__pyx_t_7)) __PYX_ERR(1, 699, __pyx_L1_error) + __Pyx_GOTREF(__pyx_t_7); + __pyx_t_1 = __pyx_t_7; + __pyx_t_7 = 0; + __pyx_L9_bool_binop_done:; + __pyx_t_7 = PyList_AsTuple(__pyx_v_result); if (unlikely(!__pyx_t_7)) __PYX_ERR(1, 699, __pyx_L1_error) + __Pyx_GOTREF(__pyx_t_7); + __pyx_t_3 = PyTuple_New(2); if (unlikely(!__pyx_t_3)) __PYX_ERR(1, 699, __pyx_L1_error) + __Pyx_GOTREF(__pyx_t_3); + __Pyx_GIVEREF(__pyx_t_1); + if (__Pyx_PyTuple_SET_ITEM(__pyx_t_3, 0, __pyx_t_1) != (0)) __PYX_ERR(1, 699, __pyx_L1_error); + __Pyx_GIVEREF(__pyx_t_7); + if (__Pyx_PyTuple_SET_ITEM(__pyx_t_3, 1, __pyx_t_7) != (0)) __PYX_ERR(1, 699, __pyx_L1_error); + __pyx_t_1 = 0; + __pyx_t_7 = 0; + __pyx_r = ((PyObject*)__pyx_t_3); + __pyx_t_3 = 0; + goto __pyx_L0; + + /* "View.MemoryView":672 + * return isinstance(o, memoryview) + * + * cdef tuple _unellipsify(object index, int ndim): # <<<<<<<<<<<<<< + * """ + * Replace all ellipses with full slices and fill incomplete indices with +*/ + + /* function exit code */ + __pyx_L1_error:; + __Pyx_XDECREF(__pyx_t_1); + __Pyx_XDECREF(__pyx_t_3); + __Pyx_XDECREF(__pyx_t_7); + __Pyx_AddTraceback("View.MemoryView._unellipsify", __pyx_clineno, __pyx_lineno, __pyx_filename); + __pyx_r = 0; + __pyx_L0:; + __Pyx_XDECREF(__pyx_v_tup); + __Pyx_XDECREF(__pyx_v_result); + __Pyx_XDECREF(__pyx_v_item); + __Pyx_XGIVEREF(__pyx_r); + __Pyx_RefNannyFinishContext(); + return __pyx_r; +} + +/* "View.MemoryView":701 + * return have_slices or nslices, tuple(result) + * + * cdef int assert_direct_dimensions(Py_ssize_t *suboffsets, int ndim) except -1: # <<<<<<<<<<<<<< + * for suboffset in suboffsets[:ndim]: + * if suboffset >= 0: +*/ + +static int assert_direct_dimensions(Py_ssize_t *__pyx_v_suboffsets, int __pyx_v_ndim) { + Py_ssize_t __pyx_v_suboffset; + int __pyx_r; + Py_ssize_t *__pyx_t_1; + Py_ssize_t *__pyx_t_2; + Py_ssize_t *__pyx_t_3; + int __pyx_t_4; + int __pyx_lineno = 0; + const char *__pyx_filename = NULL; + int __pyx_clineno = 0; + + /* "View.MemoryView":702 + * + * cdef int assert_direct_dimensions(Py_ssize_t *suboffsets, int ndim) except -1: + * for suboffset in suboffsets[:ndim]: # <<<<<<<<<<<<<< + * if suboffset >= 0: + * raise ValueError, "Indirect dimensions not supported" +*/ + __pyx_t_2 = (__pyx_v_suboffsets + __pyx_v_ndim); + for (__pyx_t_3 = __pyx_v_suboffsets; __pyx_t_3 < __pyx_t_2; __pyx_t_3++) { + __pyx_t_1 = __pyx_t_3; + __pyx_v_suboffset = (__pyx_t_1[0]); + + /* "View.MemoryView":703 + * cdef int assert_direct_dimensions(Py_ssize_t *suboffsets, int ndim) except -1: + * for suboffset in suboffsets[:ndim]: + * if suboffset >= 0: # <<<<<<<<<<<<<< + * raise ValueError, "Indirect dimensions not supported" + * return 0 # return type just used as an error flag +*/ + __pyx_t_4 = (__pyx_v_suboffset >= 0); + if (unlikely(__pyx_t_4)) { + + /* "View.MemoryView":704 + * for suboffset in suboffsets[:ndim]: + * if suboffset >= 0: + * raise ValueError, "Indirect dimensions not supported" # <<<<<<<<<<<<<< + * return 0 # return type just used as an error flag + * +*/ + __Pyx_Raise(((PyObject *)(((PyTypeObject*)PyExc_ValueError))), __pyx_mstate_global->__pyx_kp_u_Indirect_dimensions_not_supporte, 0, 0); + __PYX_ERR(1, 704, __pyx_L1_error) + + /* "View.MemoryView":703 + * cdef int assert_direct_dimensions(Py_ssize_t *suboffsets, int ndim) except -1: + * for suboffset in suboffsets[:ndim]: + * if suboffset >= 0: # <<<<<<<<<<<<<< + * raise ValueError, "Indirect dimensions not supported" + * return 0 # return type just used as an error flag +*/ + } + } + + /* "View.MemoryView":705 + * if suboffset >= 0: + * raise ValueError, "Indirect dimensions not supported" + * return 0 # return type just used as an error flag # <<<<<<<<<<<<<< + * + * +*/ + __pyx_r = 0; + goto __pyx_L0; + + /* "View.MemoryView":701 + * return have_slices or nslices, tuple(result) + * + * cdef int assert_direct_dimensions(Py_ssize_t *suboffsets, int ndim) except -1: # <<<<<<<<<<<<<< + * for suboffset in suboffsets[:ndim]: + * if suboffset >= 0: +*/ + + /* function exit code */ + __pyx_L1_error:; + __Pyx_AddTraceback("View.MemoryView.assert_direct_dimensions", __pyx_clineno, __pyx_lineno, __pyx_filename); + __pyx_r = -1; + __pyx_L0:; + return __pyx_r; +} + +/* "View.MemoryView":711 + * + * + * @cname('__pyx_memview_slice') # <<<<<<<<<<<<<< + * cdef memoryview memview_slice(memoryview memview, object indices): + * cdef int new_ndim = 0, suboffset_dim = -1, dim +*/ + +static struct __pyx_memoryview_obj *__pyx_memview_slice(struct __pyx_memoryview_obj *__pyx_v_memview, PyObject *__pyx_v_indices) { + int __pyx_v_new_ndim; + int __pyx_v_suboffset_dim; + int __pyx_v_dim; + __Pyx_memviewslice __pyx_v_src; + __Pyx_memviewslice __pyx_v_dst; + __Pyx_memviewslice *__pyx_v_p_src; + struct __pyx_memoryviewslice_obj *__pyx_v_memviewsliceobj = 0; + __Pyx_memviewslice *__pyx_v_p_dst; + int *__pyx_v_p_suboffset_dim; + Py_ssize_t __pyx_v_start; + Py_ssize_t __pyx_v_stop; + Py_ssize_t __pyx_v_step; + Py_ssize_t __pyx_v_cindex; + int __pyx_v_have_start; + int __pyx_v_have_stop; + int __pyx_v_have_step; + PyObject *__pyx_v_index = NULL; + struct __pyx_memoryview_obj *__pyx_r = NULL; + __Pyx_RefNannyDeclarations + int __pyx_t_1; + PyObject *__pyx_t_2 = NULL; + struct __pyx_memoryview_obj *__pyx_t_3; + char *__pyx_t_4; + int __pyx_t_5; + Py_ssize_t __pyx_t_6; + PyObject *(*__pyx_t_7)(PyObject *); + PyObject *__pyx_t_8 = NULL; + Py_ssize_t __pyx_t_9; + int __pyx_t_10; + Py_ssize_t __pyx_t_11; + int __pyx_lineno = 0; + const char *__pyx_filename = NULL; + int __pyx_clineno = 0; + __Pyx_RefNannySetupContext("memview_slice", 0); + + /* "View.MemoryView":713 + * @cname('__pyx_memview_slice') + * cdef memoryview memview_slice(memoryview memview, object indices): + * cdef int new_ndim = 0, suboffset_dim = -1, dim # <<<<<<<<<<<<<< + * cdef bint negative_step + * cdef __Pyx_memviewslice src, dst +*/ + __pyx_v_new_ndim = 0; + __pyx_v_suboffset_dim = -1; + + /* "View.MemoryView":720 + * + * + * memset(&dst, 0, sizeof(dst)) # <<<<<<<<<<<<<< + * + * cdef _memoryviewslice memviewsliceobj +*/ + (void)(memset((&__pyx_v_dst), 0, (sizeof(__pyx_v_dst)))); + + /* "View.MemoryView":724 + * cdef _memoryviewslice memviewsliceobj + * + * assert memview.view.ndim > 0 # <<<<<<<<<<<<<< + * + * if isinstance(memview, _memoryviewslice): +*/ + #ifndef CYTHON_WITHOUT_ASSERTIONS + if (unlikely(__pyx_assertions_enabled())) { + __pyx_t_1 = (__pyx_v_memview->view.ndim > 0); + if (unlikely(!__pyx_t_1)) { + __Pyx_Raise(((PyObject *)(((PyTypeObject*)PyExc_AssertionError))), 0, 0, 0); + __PYX_ERR(1, 724, __pyx_L1_error) + } + } + #else + if ((1)); else __PYX_ERR(1, 724, __pyx_L1_error) + #endif + + /* "View.MemoryView":726 + * assert memview.view.ndim > 0 + * + * if isinstance(memview, _memoryviewslice): # <<<<<<<<<<<<<< + * memviewsliceobj = memview + * p_src = &memviewsliceobj.from_slice +*/ + __pyx_t_1 = __Pyx_TypeCheck(((PyObject *)__pyx_v_memview), __pyx_mstate_global->__pyx_memoryviewslice_type); + if (__pyx_t_1) { + + /* "View.MemoryView":727 + * + * if isinstance(memview, _memoryviewslice): + * memviewsliceobj = memview # <<<<<<<<<<<<<< + * p_src = &memviewsliceobj.from_slice + * else: +*/ + __pyx_t_2 = ((PyObject *)__pyx_v_memview); + __Pyx_INCREF(__pyx_t_2); + if (!(likely(((__pyx_t_2) == Py_None) || likely(__Pyx_TypeTest(__pyx_t_2, __pyx_mstate_global->__pyx_memoryviewslice_type))))) __PYX_ERR(1, 727, __pyx_L1_error) + __pyx_v_memviewsliceobj = ((struct __pyx_memoryviewslice_obj *)__pyx_t_2); + __pyx_t_2 = 0; + + /* "View.MemoryView":728 + * if isinstance(memview, _memoryviewslice): + * memviewsliceobj = memview + * p_src = &memviewsliceobj.from_slice # <<<<<<<<<<<<<< + * else: + * slice_copy(memview, &src) +*/ + __pyx_v_p_src = (&__pyx_v_memviewsliceobj->from_slice); + + /* "View.MemoryView":726 + * assert memview.view.ndim > 0 + * + * if isinstance(memview, _memoryviewslice): # <<<<<<<<<<<<<< + * memviewsliceobj = memview + * p_src = &memviewsliceobj.from_slice +*/ + goto __pyx_L3; + } + + /* "View.MemoryView":730 + * p_src = &memviewsliceobj.from_slice + * else: + * slice_copy(memview, &src) # <<<<<<<<<<<<<< + * p_src = &src + * +*/ + /*else*/ { + __pyx_memoryview_slice_copy(__pyx_v_memview, (&__pyx_v_src)); + + /* "View.MemoryView":731 + * else: + * slice_copy(memview, &src) + * p_src = &src # <<<<<<<<<<<<<< + * + * +*/ + __pyx_v_p_src = (&__pyx_v_src); + } + __pyx_L3:; + + /* "View.MemoryView":737 + * + * + * dst.memview = p_src.memview # <<<<<<<<<<<<<< + * dst.data = p_src.data + * +*/ + __pyx_t_3 = __pyx_v_p_src->memview; + __pyx_v_dst.memview = __pyx_t_3; + + /* "View.MemoryView":738 + * + * dst.memview = p_src.memview + * dst.data = p_src.data # <<<<<<<<<<<<<< + * + * +*/ + __pyx_t_4 = __pyx_v_p_src->data; + __pyx_v_dst.data = __pyx_t_4; + + /* "View.MemoryView":743 + * + * + * cdef __Pyx_memviewslice *p_dst = &dst # <<<<<<<<<<<<<< + * cdef int *p_suboffset_dim = &suboffset_dim + * cdef Py_ssize_t start, stop, step, cindex +*/ + __pyx_v_p_dst = (&__pyx_v_dst); + + /* "View.MemoryView":744 + * + * cdef __Pyx_memviewslice *p_dst = &dst + * cdef int *p_suboffset_dim = &suboffset_dim # <<<<<<<<<<<<<< + * cdef Py_ssize_t start, stop, step, cindex + * cdef bint have_start, have_stop, have_step +*/ + __pyx_v_p_suboffset_dim = (&__pyx_v_suboffset_dim); + + /* "View.MemoryView":748 + * cdef bint have_start, have_stop, have_step + * + * for dim, index in enumerate(indices): # <<<<<<<<<<<<<< + * if PyIndex_Check(index): + * cindex = index +*/ + __pyx_t_5 = 0; + if (likely(PyList_CheckExact(__pyx_v_indices)) || PyTuple_CheckExact(__pyx_v_indices)) { + __pyx_t_2 = __pyx_v_indices; __Pyx_INCREF(__pyx_t_2); + __pyx_t_6 = 0; + __pyx_t_7 = NULL; + } else { + __pyx_t_6 = -1; __pyx_t_2 = PyObject_GetIter(__pyx_v_indices); if (unlikely(!__pyx_t_2)) __PYX_ERR(1, 748, __pyx_L1_error) + __Pyx_GOTREF(__pyx_t_2); + __pyx_t_7 = (CYTHON_COMPILING_IN_LIMITED_API) ? PyIter_Next : __Pyx_PyObject_GetIterNextFunc(__pyx_t_2); if (unlikely(!__pyx_t_7)) __PYX_ERR(1, 748, __pyx_L1_error) + } + for (;;) { + if (likely(!__pyx_t_7)) { + if (likely(PyList_CheckExact(__pyx_t_2))) { + { + Py_ssize_t __pyx_temp = __Pyx_PyList_GET_SIZE(__pyx_t_2); + #if !CYTHON_ASSUME_SAFE_SIZE + if (unlikely((__pyx_temp < 0))) __PYX_ERR(1, 748, __pyx_L1_error) + #endif + if (__pyx_t_6 >= __pyx_temp) break; + } + __pyx_t_8 = __Pyx_PyList_GetItemRefFast(__pyx_t_2, __pyx_t_6, __Pyx_ReferenceSharing_OwnStrongReference); + ++__pyx_t_6; + } else { + { + Py_ssize_t __pyx_temp = __Pyx_PyTuple_GET_SIZE(__pyx_t_2); + #if !CYTHON_ASSUME_SAFE_SIZE + if (unlikely((__pyx_temp < 0))) __PYX_ERR(1, 748, __pyx_L1_error) + #endif + if (__pyx_t_6 >= __pyx_temp) break; + } + #if CYTHON_ASSUME_SAFE_MACROS && !CYTHON_AVOID_BORROWED_REFS + __pyx_t_8 = __Pyx_NewRef(PyTuple_GET_ITEM(__pyx_t_2, __pyx_t_6)); + #else + __pyx_t_8 = __Pyx_PySequence_ITEM(__pyx_t_2, __pyx_t_6); + #endif + ++__pyx_t_6; + } + if (unlikely(!__pyx_t_8)) __PYX_ERR(1, 748, __pyx_L1_error) + } else { + __pyx_t_8 = __pyx_t_7(__pyx_t_2); + if (unlikely(!__pyx_t_8)) { + PyObject* exc_type = PyErr_Occurred(); + if (exc_type) { + if (unlikely(!__Pyx_PyErr_GivenExceptionMatches(exc_type, PyExc_StopIteration))) __PYX_ERR(1, 748, __pyx_L1_error) + PyErr_Clear(); + } + break; + } + } + __Pyx_GOTREF(__pyx_t_8); + __Pyx_XDECREF_SET(__pyx_v_index, __pyx_t_8); + __pyx_t_8 = 0; + __pyx_v_dim = __pyx_t_5; + __pyx_t_5 = (__pyx_t_5 + 1); + + /* "View.MemoryView":749 + * + * for dim, index in enumerate(indices): + * if PyIndex_Check(index): # <<<<<<<<<<<<<< + * cindex = index + * slice_memviewslice( +*/ + __pyx_t_1 = (PyIndex_Check(__pyx_v_index) != 0); + if (__pyx_t_1) { + + /* "View.MemoryView":750 + * for dim, index in enumerate(indices): + * if PyIndex_Check(index): + * cindex = index # <<<<<<<<<<<<<< + * slice_memviewslice( + * p_dst, p_src.shape[dim], p_src.strides[dim], p_src.suboffsets[dim], +*/ + __pyx_t_9 = __Pyx_PyIndex_AsSsize_t(__pyx_v_index); if (unlikely((__pyx_t_9 == (Py_ssize_t)-1) && PyErr_Occurred())) __PYX_ERR(1, 750, __pyx_L1_error) + __pyx_v_cindex = __pyx_t_9; + + /* "View.MemoryView":751 + * if PyIndex_Check(index): + * cindex = index + * slice_memviewslice( # <<<<<<<<<<<<<< + * p_dst, p_src.shape[dim], p_src.strides[dim], p_src.suboffsets[dim], + * dim, new_ndim, p_suboffset_dim, +*/ + __pyx_t_10 = __pyx_memoryview_slice_memviewslice(__pyx_v_p_dst, (__pyx_v_p_src->shape[__pyx_v_dim]), (__pyx_v_p_src->strides[__pyx_v_dim]), (__pyx_v_p_src->suboffsets[__pyx_v_dim]), __pyx_v_dim, __pyx_v_new_ndim, __pyx_v_p_suboffset_dim, __pyx_v_cindex, 0, 0, 0, 0, 0, 0); if (unlikely(__pyx_t_10 == ((int)-1))) __PYX_ERR(1, 751, __pyx_L1_error) + + /* "View.MemoryView":749 + * + * for dim, index in enumerate(indices): + * if PyIndex_Check(index): # <<<<<<<<<<<<<< + * cindex = index + * slice_memviewslice( +*/ + goto __pyx_L6; + } + + /* "View.MemoryView":757 + * 0, 0, 0, # have_{start,stop,step} + * False) + * elif index is None: # <<<<<<<<<<<<<< + * p_dst.shape[new_ndim] = 1 + * p_dst.strides[new_ndim] = 0 +*/ + __pyx_t_1 = (__pyx_v_index == Py_None); + if (__pyx_t_1) { + + /* "View.MemoryView":758 + * False) + * elif index is None: + * p_dst.shape[new_ndim] = 1 # <<<<<<<<<<<<<< + * p_dst.strides[new_ndim] = 0 + * p_dst.suboffsets[new_ndim] = -1 +*/ + (__pyx_v_p_dst->shape[__pyx_v_new_ndim]) = 1; + + /* "View.MemoryView":759 + * elif index is None: + * p_dst.shape[new_ndim] = 1 + * p_dst.strides[new_ndim] = 0 # <<<<<<<<<<<<<< + * p_dst.suboffsets[new_ndim] = -1 + * new_ndim += 1 +*/ + (__pyx_v_p_dst->strides[__pyx_v_new_ndim]) = 0; + + /* "View.MemoryView":760 + * p_dst.shape[new_ndim] = 1 + * p_dst.strides[new_ndim] = 0 + * p_dst.suboffsets[new_ndim] = -1 # <<<<<<<<<<<<<< + * new_ndim += 1 + * else: +*/ + (__pyx_v_p_dst->suboffsets[__pyx_v_new_ndim]) = -1L; + + /* "View.MemoryView":761 + * p_dst.strides[new_ndim] = 0 + * p_dst.suboffsets[new_ndim] = -1 + * new_ndim += 1 # <<<<<<<<<<<<<< + * else: + * start = index.start or 0 +*/ + __pyx_v_new_ndim = (__pyx_v_new_ndim + 1); + + /* "View.MemoryView":757 + * 0, 0, 0, # have_{start,stop,step} + * False) + * elif index is None: # <<<<<<<<<<<<<< + * p_dst.shape[new_ndim] = 1 + * p_dst.strides[new_ndim] = 0 +*/ + goto __pyx_L6; + } + + /* "View.MemoryView":763 + * new_ndim += 1 + * else: + * start = index.start or 0 # <<<<<<<<<<<<<< + * stop = index.stop or 0 + * step = index.step or 0 +*/ + /*else*/ { + __pyx_t_8 = __Pyx_PyObject_GetAttrStr(__pyx_v_index, __pyx_mstate_global->__pyx_n_u_start); if (unlikely(!__pyx_t_8)) __PYX_ERR(1, 763, __pyx_L1_error) + __Pyx_GOTREF(__pyx_t_8); + __pyx_t_1 = __Pyx_PyObject_IsTrue(__pyx_t_8); if (unlikely((__pyx_t_1 < 0))) __PYX_ERR(1, 763, __pyx_L1_error) + if (!__pyx_t_1) { + __Pyx_DECREF(__pyx_t_8); __pyx_t_8 = 0; + } else { + __pyx_t_11 = __Pyx_PyIndex_AsSsize_t(__pyx_t_8); if (unlikely((__pyx_t_11 == (Py_ssize_t)-1) && PyErr_Occurred())) __PYX_ERR(1, 763, __pyx_L1_error) + __pyx_t_9 = __pyx_t_11; + __Pyx_DECREF(__pyx_t_8); __pyx_t_8 = 0; + goto __pyx_L7_bool_binop_done; + } + __pyx_t_9 = 0; + __pyx_L7_bool_binop_done:; + __pyx_v_start = __pyx_t_9; + + /* "View.MemoryView":764 + * else: + * start = index.start or 0 + * stop = index.stop or 0 # <<<<<<<<<<<<<< + * step = index.step or 0 + * +*/ + __pyx_t_8 = __Pyx_PyObject_GetAttrStr(__pyx_v_index, __pyx_mstate_global->__pyx_n_u_stop); if (unlikely(!__pyx_t_8)) __PYX_ERR(1, 764, __pyx_L1_error) + __Pyx_GOTREF(__pyx_t_8); + __pyx_t_1 = __Pyx_PyObject_IsTrue(__pyx_t_8); if (unlikely((__pyx_t_1 < 0))) __PYX_ERR(1, 764, __pyx_L1_error) + if (!__pyx_t_1) { + __Pyx_DECREF(__pyx_t_8); __pyx_t_8 = 0; + } else { + __pyx_t_11 = __Pyx_PyIndex_AsSsize_t(__pyx_t_8); if (unlikely((__pyx_t_11 == (Py_ssize_t)-1) && PyErr_Occurred())) __PYX_ERR(1, 764, __pyx_L1_error) + __pyx_t_9 = __pyx_t_11; + __Pyx_DECREF(__pyx_t_8); __pyx_t_8 = 0; + goto __pyx_L9_bool_binop_done; + } + __pyx_t_9 = 0; + __pyx_L9_bool_binop_done:; + __pyx_v_stop = __pyx_t_9; + + /* "View.MemoryView":765 + * start = index.start or 0 + * stop = index.stop or 0 + * step = index.step or 0 # <<<<<<<<<<<<<< + * + * have_start = index.start is not None +*/ + __pyx_t_8 = __Pyx_PyObject_GetAttrStr(__pyx_v_index, __pyx_mstate_global->__pyx_n_u_step); if (unlikely(!__pyx_t_8)) __PYX_ERR(1, 765, __pyx_L1_error) + __Pyx_GOTREF(__pyx_t_8); + __pyx_t_1 = __Pyx_PyObject_IsTrue(__pyx_t_8); if (unlikely((__pyx_t_1 < 0))) __PYX_ERR(1, 765, __pyx_L1_error) + if (!__pyx_t_1) { + __Pyx_DECREF(__pyx_t_8); __pyx_t_8 = 0; + } else { + __pyx_t_11 = __Pyx_PyIndex_AsSsize_t(__pyx_t_8); if (unlikely((__pyx_t_11 == (Py_ssize_t)-1) && PyErr_Occurred())) __PYX_ERR(1, 765, __pyx_L1_error) + __pyx_t_9 = __pyx_t_11; + __Pyx_DECREF(__pyx_t_8); __pyx_t_8 = 0; + goto __pyx_L11_bool_binop_done; + } + __pyx_t_9 = 0; + __pyx_L11_bool_binop_done:; + __pyx_v_step = __pyx_t_9; + + /* "View.MemoryView":767 + * step = index.step or 0 + * + * have_start = index.start is not None # <<<<<<<<<<<<<< + * have_stop = index.stop is not None + * have_step = index.step is not None +*/ + __pyx_t_8 = __Pyx_PyObject_GetAttrStr(__pyx_v_index, __pyx_mstate_global->__pyx_n_u_start); if (unlikely(!__pyx_t_8)) __PYX_ERR(1, 767, __pyx_L1_error) + __Pyx_GOTREF(__pyx_t_8); + __pyx_t_1 = (__pyx_t_8 != Py_None); + __Pyx_DECREF(__pyx_t_8); __pyx_t_8 = 0; + __pyx_v_have_start = __pyx_t_1; + + /* "View.MemoryView":768 + * + * have_start = index.start is not None + * have_stop = index.stop is not None # <<<<<<<<<<<<<< + * have_step = index.step is not None + * +*/ + __pyx_t_8 = __Pyx_PyObject_GetAttrStr(__pyx_v_index, __pyx_mstate_global->__pyx_n_u_stop); if (unlikely(!__pyx_t_8)) __PYX_ERR(1, 768, __pyx_L1_error) + __Pyx_GOTREF(__pyx_t_8); + __pyx_t_1 = (__pyx_t_8 != Py_None); + __Pyx_DECREF(__pyx_t_8); __pyx_t_8 = 0; + __pyx_v_have_stop = __pyx_t_1; + + /* "View.MemoryView":769 + * have_start = index.start is not None + * have_stop = index.stop is not None + * have_step = index.step is not None # <<<<<<<<<<<<<< + * + * slice_memviewslice( +*/ + __pyx_t_8 = __Pyx_PyObject_GetAttrStr(__pyx_v_index, __pyx_mstate_global->__pyx_n_u_step); if (unlikely(!__pyx_t_8)) __PYX_ERR(1, 769, __pyx_L1_error) + __Pyx_GOTREF(__pyx_t_8); + __pyx_t_1 = (__pyx_t_8 != Py_None); + __Pyx_DECREF(__pyx_t_8); __pyx_t_8 = 0; + __pyx_v_have_step = __pyx_t_1; + + /* "View.MemoryView":771 + * have_step = index.step is not None + * + * slice_memviewslice( # <<<<<<<<<<<<<< + * p_dst, p_src.shape[dim], p_src.strides[dim], p_src.suboffsets[dim], + * dim, new_ndim, p_suboffset_dim, +*/ + __pyx_t_10 = __pyx_memoryview_slice_memviewslice(__pyx_v_p_dst, (__pyx_v_p_src->shape[__pyx_v_dim]), (__pyx_v_p_src->strides[__pyx_v_dim]), (__pyx_v_p_src->suboffsets[__pyx_v_dim]), __pyx_v_dim, __pyx_v_new_ndim, __pyx_v_p_suboffset_dim, __pyx_v_start, __pyx_v_stop, __pyx_v_step, __pyx_v_have_start, __pyx_v_have_stop, __pyx_v_have_step, 1); if (unlikely(__pyx_t_10 == ((int)-1))) __PYX_ERR(1, 771, __pyx_L1_error) + + /* "View.MemoryView":777 + * have_start, have_stop, have_step, + * True) + * new_ndim += 1 # <<<<<<<<<<<<<< + * + * if isinstance(memview, _memoryviewslice): +*/ + __pyx_v_new_ndim = (__pyx_v_new_ndim + 1); + } + __pyx_L6:; + + /* "View.MemoryView":748 + * cdef bint have_start, have_stop, have_step + * + * for dim, index in enumerate(indices): # <<<<<<<<<<<<<< + * if PyIndex_Check(index): + * cindex = index +*/ + } + __Pyx_DECREF(__pyx_t_2); __pyx_t_2 = 0; + + /* "View.MemoryView":779 + * new_ndim += 1 + * + * if isinstance(memview, _memoryviewslice): # <<<<<<<<<<<<<< + * return memoryview_fromslice(dst, new_ndim, + * memviewsliceobj.to_object_func, +*/ + __pyx_t_1 = __Pyx_TypeCheck(((PyObject *)__pyx_v_memview), __pyx_mstate_global->__pyx_memoryviewslice_type); + if (__pyx_t_1) { + + /* "View.MemoryView":780 + * + * if isinstance(memview, _memoryviewslice): + * return memoryview_fromslice(dst, new_ndim, # <<<<<<<<<<<<<< + * memviewsliceobj.to_object_func, + * memviewsliceobj.to_dtype_func, +*/ + __Pyx_XDECREF((PyObject *)__pyx_r); + + /* "View.MemoryView":781 + * if isinstance(memview, _memoryviewslice): + * return memoryview_fromslice(dst, new_ndim, + * memviewsliceobj.to_object_func, # <<<<<<<<<<<<<< + * memviewsliceobj.to_dtype_func, + * memview.dtype_is_object) +*/ + if (unlikely(!__pyx_v_memviewsliceobj)) { __Pyx_RaiseUnboundLocalError("memviewsliceobj"); __PYX_ERR(1, 781, __pyx_L1_error) } + + /* "View.MemoryView":782 + * return memoryview_fromslice(dst, new_ndim, + * memviewsliceobj.to_object_func, + * memviewsliceobj.to_dtype_func, # <<<<<<<<<<<<<< + * memview.dtype_is_object) + * else: +*/ + if (unlikely(!__pyx_v_memviewsliceobj)) { __Pyx_RaiseUnboundLocalError("memviewsliceobj"); __PYX_ERR(1, 782, __pyx_L1_error) } + + /* "View.MemoryView":780 + * + * if isinstance(memview, _memoryviewslice): + * return memoryview_fromslice(dst, new_ndim, # <<<<<<<<<<<<<< + * memviewsliceobj.to_object_func, + * memviewsliceobj.to_dtype_func, +*/ + __pyx_t_2 = __pyx_memoryview_fromslice(__pyx_v_dst, __pyx_v_new_ndim, __pyx_v_memviewsliceobj->to_object_func, __pyx_v_memviewsliceobj->to_dtype_func, __pyx_v_memview->dtype_is_object); if (unlikely(!__pyx_t_2)) __PYX_ERR(1, 780, __pyx_L1_error) + __Pyx_GOTREF(__pyx_t_2); + if (!(likely(((__pyx_t_2) == Py_None) || likely(__Pyx_TypeTest(__pyx_t_2, __pyx_mstate_global->__pyx_memoryview_type))))) __PYX_ERR(1, 780, __pyx_L1_error) + __pyx_r = ((struct __pyx_memoryview_obj *)__pyx_t_2); + __pyx_t_2 = 0; + goto __pyx_L0; + + /* "View.MemoryView":779 + * new_ndim += 1 + * + * if isinstance(memview, _memoryviewslice): # <<<<<<<<<<<<<< + * return memoryview_fromslice(dst, new_ndim, + * memviewsliceobj.to_object_func, +*/ + } + + /* "View.MemoryView":785 + * memview.dtype_is_object) + * else: + * return memoryview_fromslice(dst, new_ndim, NULL, NULL, # <<<<<<<<<<<<<< + * memview.dtype_is_object) + * +*/ + /*else*/ { + __Pyx_XDECREF((PyObject *)__pyx_r); + + /* "View.MemoryView":786 + * else: + * return memoryview_fromslice(dst, new_ndim, NULL, NULL, + * memview.dtype_is_object) # <<<<<<<<<<<<<< + * + * +*/ + __pyx_t_2 = __pyx_memoryview_fromslice(__pyx_v_dst, __pyx_v_new_ndim, NULL, NULL, __pyx_v_memview->dtype_is_object); if (unlikely(!__pyx_t_2)) __PYX_ERR(1, 785, __pyx_L1_error) + __Pyx_GOTREF(__pyx_t_2); + + /* "View.MemoryView":785 + * memview.dtype_is_object) + * else: + * return memoryview_fromslice(dst, new_ndim, NULL, NULL, # <<<<<<<<<<<<<< + * memview.dtype_is_object) + * +*/ + if (!(likely(((__pyx_t_2) == Py_None) || likely(__Pyx_TypeTest(__pyx_t_2, __pyx_mstate_global->__pyx_memoryview_type))))) __PYX_ERR(1, 785, __pyx_L1_error) + __pyx_r = ((struct __pyx_memoryview_obj *)__pyx_t_2); + __pyx_t_2 = 0; + goto __pyx_L0; + } + + /* "View.MemoryView":711 + * + * + * @cname('__pyx_memview_slice') # <<<<<<<<<<<<<< + * cdef memoryview memview_slice(memoryview memview, object indices): + * cdef int new_ndim = 0, suboffset_dim = -1, dim +*/ + + /* function exit code */ + __pyx_L1_error:; + __Pyx_XDECREF(__pyx_t_2); + __Pyx_XDECREF(__pyx_t_8); + __Pyx_AddTraceback("View.MemoryView.memview_slice", __pyx_clineno, __pyx_lineno, __pyx_filename); + __pyx_r = 0; + __pyx_L0:; + __Pyx_XDECREF((PyObject *)__pyx_v_memviewsliceobj); + __Pyx_XDECREF(__pyx_v_index); + __Pyx_XGIVEREF((PyObject *)__pyx_r); + __Pyx_RefNannyFinishContext(); + return __pyx_r; +} + +/* "View.MemoryView":793 + * + * + * @cname('__pyx_memoryview_slice_memviewslice') # <<<<<<<<<<<<<< + * cdef int slice_memviewslice( + * __Pyx_memviewslice *dst, +*/ + +static int __pyx_memoryview_slice_memviewslice(__Pyx_memviewslice *__pyx_v_dst, Py_ssize_t __pyx_v_shape, Py_ssize_t __pyx_v_stride, Py_ssize_t __pyx_v_suboffset, int __pyx_v_dim, int __pyx_v_new_ndim, int *__pyx_v_suboffset_dim, Py_ssize_t __pyx_v_start, Py_ssize_t __pyx_v_stop, Py_ssize_t __pyx_v_step, int __pyx_v_have_start, int __pyx_v_have_stop, int __pyx_v_have_step, int __pyx_v_is_slice) { + Py_ssize_t __pyx_v_new_shape; + int __pyx_v_negative_step; + int __pyx_r; + int __pyx_t_1; + int __pyx_t_2; + int __pyx_t_3; + int __pyx_lineno = 0; + const char *__pyx_filename = NULL; + int __pyx_clineno = 0; + PyGILState_STATE __pyx_gilstate_save; + + /* "View.MemoryView":814 + * cdef bint negative_step + * + * if not is_slice: # <<<<<<<<<<<<<< + * + * if start < 0: +*/ + __pyx_t_1 = (!__pyx_v_is_slice); + if (__pyx_t_1) { + + /* "View.MemoryView":816 + * if not is_slice: + * + * if start < 0: # <<<<<<<<<<<<<< + * start += shape + * if not 0 <= start < shape: +*/ + __pyx_t_1 = (__pyx_v_start < 0); + if (__pyx_t_1) { + + /* "View.MemoryView":817 + * + * if start < 0: + * start += shape # <<<<<<<<<<<<<< + * if not 0 <= start < shape: + * _err_dim(PyExc_IndexError, "Index out of bounds (axis %d)", dim) +*/ + __pyx_v_start = (__pyx_v_start + __pyx_v_shape); + + /* "View.MemoryView":816 + * if not is_slice: + * + * if start < 0: # <<<<<<<<<<<<<< + * start += shape + * if not 0 <= start < shape: +*/ + } + + /* "View.MemoryView":818 + * if start < 0: + * start += shape + * if not 0 <= start < shape: # <<<<<<<<<<<<<< + * _err_dim(PyExc_IndexError, "Index out of bounds (axis %d)", dim) + * else: +*/ + __pyx_t_1 = (0 <= __pyx_v_start); + if (__pyx_t_1) { + __pyx_t_1 = (__pyx_v_start < __pyx_v_shape); + } + __pyx_t_2 = (!__pyx_t_1); + if (__pyx_t_2) { + + /* "View.MemoryView":819 + * start += shape + * if not 0 <= start < shape: + * _err_dim(PyExc_IndexError, "Index out of bounds (axis %d)", dim) # <<<<<<<<<<<<<< + * else: + * +*/ + __pyx_t_3 = __pyx_memoryview_err_dim(PyExc_IndexError, __pyx_mstate_global->__pyx_kp_u_Index_out_of_bounds_axis_d, __pyx_v_dim); if (unlikely(__pyx_t_3 == ((int)-1))) __PYX_ERR(1, 819, __pyx_L1_error) + + /* "View.MemoryView":818 + * if start < 0: + * start += shape + * if not 0 <= start < shape: # <<<<<<<<<<<<<< + * _err_dim(PyExc_IndexError, "Index out of bounds (axis %d)", dim) + * else: +*/ + } + + /* "View.MemoryView":814 + * cdef bint negative_step + * + * if not is_slice: # <<<<<<<<<<<<<< + * + * if start < 0: +*/ + goto __pyx_L3; + } + + /* "View.MemoryView":822 + * else: + * + * if have_step: # <<<<<<<<<<<<<< + * negative_step = step < 0 + * if step == 0: +*/ + /*else*/ { + __pyx_t_2 = (__pyx_v_have_step != 0); + if (__pyx_t_2) { + + /* "View.MemoryView":823 + * + * if have_step: + * negative_step = step < 0 # <<<<<<<<<<<<<< + * if step == 0: + * _err_dim(PyExc_ValueError, "Step may not be zero (axis %d)", dim) +*/ + __pyx_v_negative_step = (__pyx_v_step < 0); + + /* "View.MemoryView":824 + * if have_step: + * negative_step = step < 0 + * if step == 0: # <<<<<<<<<<<<<< + * _err_dim(PyExc_ValueError, "Step may not be zero (axis %d)", dim) + * else: +*/ + __pyx_t_2 = (__pyx_v_step == 0); + if (__pyx_t_2) { + + /* "View.MemoryView":825 + * negative_step = step < 0 + * if step == 0: + * _err_dim(PyExc_ValueError, "Step may not be zero (axis %d)", dim) # <<<<<<<<<<<<<< + * else: + * negative_step = False +*/ + __pyx_t_3 = __pyx_memoryview_err_dim(PyExc_ValueError, __pyx_mstate_global->__pyx_kp_u_Step_may_not_be_zero_axis_d, __pyx_v_dim); if (unlikely(__pyx_t_3 == ((int)-1))) __PYX_ERR(1, 825, __pyx_L1_error) + + /* "View.MemoryView":824 + * if have_step: + * negative_step = step < 0 + * if step == 0: # <<<<<<<<<<<<<< + * _err_dim(PyExc_ValueError, "Step may not be zero (axis %d)", dim) + * else: +*/ + } + + /* "View.MemoryView":822 + * else: + * + * if have_step: # <<<<<<<<<<<<<< + * negative_step = step < 0 + * if step == 0: +*/ + goto __pyx_L6; + } + + /* "View.MemoryView":827 + * _err_dim(PyExc_ValueError, "Step may not be zero (axis %d)", dim) + * else: + * negative_step = False # <<<<<<<<<<<<<< + * step = 1 + * +*/ + /*else*/ { + __pyx_v_negative_step = 0; + + /* "View.MemoryView":828 + * else: + * negative_step = False + * step = 1 # <<<<<<<<<<<<<< + * + * +*/ + __pyx_v_step = 1; + } + __pyx_L6:; + + /* "View.MemoryView":831 + * + * + * if have_start: # <<<<<<<<<<<<<< + * if start < 0: + * start += shape +*/ + __pyx_t_2 = (__pyx_v_have_start != 0); + if (__pyx_t_2) { + + /* "View.MemoryView":832 + * + * if have_start: + * if start < 0: # <<<<<<<<<<<<<< + * start += shape + * if start < 0: +*/ + __pyx_t_2 = (__pyx_v_start < 0); + if (__pyx_t_2) { + + /* "View.MemoryView":833 + * if have_start: + * if start < 0: + * start += shape # <<<<<<<<<<<<<< + * if start < 0: + * start = 0 +*/ + __pyx_v_start = (__pyx_v_start + __pyx_v_shape); + + /* "View.MemoryView":834 + * if start < 0: + * start += shape + * if start < 0: # <<<<<<<<<<<<<< + * start = 0 + * elif start >= shape: +*/ + __pyx_t_2 = (__pyx_v_start < 0); + if (__pyx_t_2) { + + /* "View.MemoryView":835 + * start += shape + * if start < 0: + * start = 0 # <<<<<<<<<<<<<< + * elif start >= shape: + * if negative_step: +*/ + __pyx_v_start = 0; + + /* "View.MemoryView":834 + * if start < 0: + * start += shape + * if start < 0: # <<<<<<<<<<<<<< + * start = 0 + * elif start >= shape: +*/ + } + + /* "View.MemoryView":832 + * + * if have_start: + * if start < 0: # <<<<<<<<<<<<<< + * start += shape + * if start < 0: +*/ + goto __pyx_L9; + } + + /* "View.MemoryView":836 + * if start < 0: + * start = 0 + * elif start >= shape: # <<<<<<<<<<<<<< + * if negative_step: + * start = shape - 1 +*/ + __pyx_t_2 = (__pyx_v_start >= __pyx_v_shape); + if (__pyx_t_2) { + + /* "View.MemoryView":837 + * start = 0 + * elif start >= shape: + * if negative_step: # <<<<<<<<<<<<<< + * start = shape - 1 + * else: +*/ + if (__pyx_v_negative_step) { + + /* "View.MemoryView":838 + * elif start >= shape: + * if negative_step: + * start = shape - 1 # <<<<<<<<<<<<<< + * else: + * start = shape +*/ + __pyx_v_start = (__pyx_v_shape - 1); + + /* "View.MemoryView":837 + * start = 0 + * elif start >= shape: + * if negative_step: # <<<<<<<<<<<<<< + * start = shape - 1 + * else: +*/ + goto __pyx_L11; + } + + /* "View.MemoryView":840 + * start = shape - 1 + * else: + * start = shape # <<<<<<<<<<<<<< + * else: + * if negative_step: +*/ + /*else*/ { + __pyx_v_start = __pyx_v_shape; + } + __pyx_L11:; + + /* "View.MemoryView":836 + * if start < 0: + * start = 0 + * elif start >= shape: # <<<<<<<<<<<<<< + * if negative_step: + * start = shape - 1 +*/ + } + __pyx_L9:; + + /* "View.MemoryView":831 + * + * + * if have_start: # <<<<<<<<<<<<<< + * if start < 0: + * start += shape +*/ + goto __pyx_L8; + } + + /* "View.MemoryView":842 + * start = shape + * else: + * if negative_step: # <<<<<<<<<<<<<< + * start = shape - 1 + * else: +*/ + /*else*/ { + if (__pyx_v_negative_step) { + + /* "View.MemoryView":843 + * else: + * if negative_step: + * start = shape - 1 # <<<<<<<<<<<<<< + * else: + * start = 0 +*/ + __pyx_v_start = (__pyx_v_shape - 1); + + /* "View.MemoryView":842 + * start = shape + * else: + * if negative_step: # <<<<<<<<<<<<<< + * start = shape - 1 + * else: +*/ + goto __pyx_L12; + } + + /* "View.MemoryView":845 + * start = shape - 1 + * else: + * start = 0 # <<<<<<<<<<<<<< + * + * if have_stop: +*/ + /*else*/ { + __pyx_v_start = 0; + } + __pyx_L12:; + } + __pyx_L8:; + + /* "View.MemoryView":847 + * start = 0 + * + * if have_stop: # <<<<<<<<<<<<<< + * if stop < 0: + * stop += shape +*/ + __pyx_t_2 = (__pyx_v_have_stop != 0); + if (__pyx_t_2) { + + /* "View.MemoryView":848 + * + * if have_stop: + * if stop < 0: # <<<<<<<<<<<<<< + * stop += shape + * if stop < 0: +*/ + __pyx_t_2 = (__pyx_v_stop < 0); + if (__pyx_t_2) { + + /* "View.MemoryView":849 + * if have_stop: + * if stop < 0: + * stop += shape # <<<<<<<<<<<<<< + * if stop < 0: + * stop = 0 +*/ + __pyx_v_stop = (__pyx_v_stop + __pyx_v_shape); + + /* "View.MemoryView":850 + * if stop < 0: + * stop += shape + * if stop < 0: # <<<<<<<<<<<<<< + * stop = 0 + * elif stop > shape: +*/ + __pyx_t_2 = (__pyx_v_stop < 0); + if (__pyx_t_2) { + + /* "View.MemoryView":851 + * stop += shape + * if stop < 0: + * stop = 0 # <<<<<<<<<<<<<< + * elif stop > shape: + * stop = shape +*/ + __pyx_v_stop = 0; + + /* "View.MemoryView":850 + * if stop < 0: + * stop += shape + * if stop < 0: # <<<<<<<<<<<<<< + * stop = 0 + * elif stop > shape: +*/ + } + + /* "View.MemoryView":848 + * + * if have_stop: + * if stop < 0: # <<<<<<<<<<<<<< + * stop += shape + * if stop < 0: +*/ + goto __pyx_L14; + } + + /* "View.MemoryView":852 + * if stop < 0: + * stop = 0 + * elif stop > shape: # <<<<<<<<<<<<<< + * stop = shape + * else: +*/ + __pyx_t_2 = (__pyx_v_stop > __pyx_v_shape); + if (__pyx_t_2) { + + /* "View.MemoryView":853 + * stop = 0 + * elif stop > shape: + * stop = shape # <<<<<<<<<<<<<< + * else: + * if negative_step: +*/ + __pyx_v_stop = __pyx_v_shape; + + /* "View.MemoryView":852 + * if stop < 0: + * stop = 0 + * elif stop > shape: # <<<<<<<<<<<<<< + * stop = shape + * else: +*/ + } + __pyx_L14:; + + /* "View.MemoryView":847 + * start = 0 + * + * if have_stop: # <<<<<<<<<<<<<< + * if stop < 0: + * stop += shape +*/ + goto __pyx_L13; + } + + /* "View.MemoryView":855 + * stop = shape + * else: + * if negative_step: # <<<<<<<<<<<<<< + * stop = -1 + * else: +*/ + /*else*/ { + if (__pyx_v_negative_step) { + + /* "View.MemoryView":856 + * else: + * if negative_step: + * stop = -1 # <<<<<<<<<<<<<< + * else: + * stop = shape +*/ + __pyx_v_stop = -1L; + + /* "View.MemoryView":855 + * stop = shape + * else: + * if negative_step: # <<<<<<<<<<<<<< + * stop = -1 + * else: +*/ + goto __pyx_L16; + } + + /* "View.MemoryView":858 + * stop = -1 + * else: + * stop = shape # <<<<<<<<<<<<<< + * + * +*/ + /*else*/ { + __pyx_v_stop = __pyx_v_shape; + } + __pyx_L16:; + } + __pyx_L13:; + + /* "View.MemoryView":862 + * + * with cython.cdivision(True): + * new_shape = (stop - start) // step # <<<<<<<<<<<<<< + * + * if (stop - start) - step * new_shape: +*/ + __pyx_v_new_shape = ((__pyx_v_stop - __pyx_v_start) / __pyx_v_step); + + /* "View.MemoryView":864 + * new_shape = (stop - start) // step + * + * if (stop - start) - step * new_shape: # <<<<<<<<<<<<<< + * new_shape += 1 + * +*/ + __pyx_t_2 = (((__pyx_v_stop - __pyx_v_start) - (__pyx_v_step * __pyx_v_new_shape)) != 0); + if (__pyx_t_2) { + + /* "View.MemoryView":865 + * + * if (stop - start) - step * new_shape: + * new_shape += 1 # <<<<<<<<<<<<<< + * + * if new_shape < 0: +*/ + __pyx_v_new_shape = (__pyx_v_new_shape + 1); + + /* "View.MemoryView":864 + * new_shape = (stop - start) // step + * + * if (stop - start) - step * new_shape: # <<<<<<<<<<<<<< + * new_shape += 1 + * +*/ + } + + /* "View.MemoryView":867 + * new_shape += 1 + * + * if new_shape < 0: # <<<<<<<<<<<<<< + * new_shape = 0 + * +*/ + __pyx_t_2 = (__pyx_v_new_shape < 0); + if (__pyx_t_2) { + + /* "View.MemoryView":868 + * + * if new_shape < 0: + * new_shape = 0 # <<<<<<<<<<<<<< + * + * +*/ + __pyx_v_new_shape = 0; + + /* "View.MemoryView":867 + * new_shape += 1 + * + * if new_shape < 0: # <<<<<<<<<<<<<< + * new_shape = 0 + * +*/ + } + + /* "View.MemoryView":871 + * + * + * dst.strides[new_ndim] = stride * step # <<<<<<<<<<<<<< + * dst.shape[new_ndim] = new_shape + * dst.suboffsets[new_ndim] = suboffset +*/ + (__pyx_v_dst->strides[__pyx_v_new_ndim]) = (__pyx_v_stride * __pyx_v_step); + + /* "View.MemoryView":872 + * + * dst.strides[new_ndim] = stride * step + * dst.shape[new_ndim] = new_shape # <<<<<<<<<<<<<< + * dst.suboffsets[new_ndim] = suboffset + * +*/ + (__pyx_v_dst->shape[__pyx_v_new_ndim]) = __pyx_v_new_shape; + + /* "View.MemoryView":873 + * dst.strides[new_ndim] = stride * step + * dst.shape[new_ndim] = new_shape + * dst.suboffsets[new_ndim] = suboffset # <<<<<<<<<<<<<< + * + * +*/ + (__pyx_v_dst->suboffsets[__pyx_v_new_ndim]) = __pyx_v_suboffset; + } + __pyx_L3:; + + /* "View.MemoryView":876 + * + * + * if suboffset_dim[0] < 0: # <<<<<<<<<<<<<< + * dst.data += start * stride + * else: +*/ + __pyx_t_2 = ((__pyx_v_suboffset_dim[0]) < 0); + if (__pyx_t_2) { + + /* "View.MemoryView":877 + * + * if suboffset_dim[0] < 0: + * dst.data += start * stride # <<<<<<<<<<<<<< + * else: + * dst.suboffsets[suboffset_dim[0]] += start * stride +*/ + __pyx_v_dst->data = (__pyx_v_dst->data + (__pyx_v_start * __pyx_v_stride)); + + /* "View.MemoryView":876 + * + * + * if suboffset_dim[0] < 0: # <<<<<<<<<<<<<< + * dst.data += start * stride + * else: +*/ + goto __pyx_L19; + } + + /* "View.MemoryView":879 + * dst.data += start * stride + * else: + * dst.suboffsets[suboffset_dim[0]] += start * stride # <<<<<<<<<<<<<< + * + * if suboffset >= 0: +*/ + /*else*/ { + __pyx_t_3 = (__pyx_v_suboffset_dim[0]); + (__pyx_v_dst->suboffsets[__pyx_t_3]) = ((__pyx_v_dst->suboffsets[__pyx_t_3]) + (__pyx_v_start * __pyx_v_stride)); + } + __pyx_L19:; + + /* "View.MemoryView":881 + * dst.suboffsets[suboffset_dim[0]] += start * stride + * + * if suboffset >= 0: # <<<<<<<<<<<<<< + * if not is_slice: + * if new_ndim == 0: +*/ + __pyx_t_2 = (__pyx_v_suboffset >= 0); + if (__pyx_t_2) { + + /* "View.MemoryView":882 + * + * if suboffset >= 0: + * if not is_slice: # <<<<<<<<<<<<<< + * if new_ndim == 0: + * dst.data = ( dst.data)[0] + suboffset +*/ + __pyx_t_2 = (!__pyx_v_is_slice); + if (__pyx_t_2) { + + /* "View.MemoryView":883 + * if suboffset >= 0: + * if not is_slice: + * if new_ndim == 0: # <<<<<<<<<<<<<< + * dst.data = ( dst.data)[0] + suboffset + * else: +*/ + __pyx_t_2 = (__pyx_v_new_ndim == 0); + if (__pyx_t_2) { + + /* "View.MemoryView":884 + * if not is_slice: + * if new_ndim == 0: + * dst.data = ( dst.data)[0] + suboffset # <<<<<<<<<<<<<< + * else: + * _err_dim(PyExc_IndexError, "All dimensions preceding dimension %d " +*/ + __pyx_v_dst->data = ((((char **)__pyx_v_dst->data)[0]) + __pyx_v_suboffset); + + /* "View.MemoryView":883 + * if suboffset >= 0: + * if not is_slice: + * if new_ndim == 0: # <<<<<<<<<<<<<< + * dst.data = ( dst.data)[0] + suboffset + * else: +*/ + goto __pyx_L22; + } + + /* "View.MemoryView":886 + * dst.data = ( dst.data)[0] + suboffset + * else: + * _err_dim(PyExc_IndexError, "All dimensions preceding dimension %d " # <<<<<<<<<<<<<< + * "must be indexed and not sliced", dim) + * else: +*/ + /*else*/ { + + /* "View.MemoryView":887 + * else: + * _err_dim(PyExc_IndexError, "All dimensions preceding dimension %d " + * "must be indexed and not sliced", dim) # <<<<<<<<<<<<<< + * else: + * suboffset_dim[0] = new_ndim +*/ + __pyx_t_3 = __pyx_memoryview_err_dim(PyExc_IndexError, __pyx_mstate_global->__pyx_kp_u_All_dimensions_preceding_dimensi, __pyx_v_dim); if (unlikely(__pyx_t_3 == ((int)-1))) __PYX_ERR(1, 886, __pyx_L1_error) + } + __pyx_L22:; + + /* "View.MemoryView":882 + * + * if suboffset >= 0: + * if not is_slice: # <<<<<<<<<<<<<< + * if new_ndim == 0: + * dst.data = ( dst.data)[0] + suboffset +*/ + goto __pyx_L21; + } + + /* "View.MemoryView":889 + * "must be indexed and not sliced", dim) + * else: + * suboffset_dim[0] = new_ndim # <<<<<<<<<<<<<< + * + * return 0 +*/ + /*else*/ { + (__pyx_v_suboffset_dim[0]) = __pyx_v_new_ndim; + } + __pyx_L21:; + + /* "View.MemoryView":881 + * dst.suboffsets[suboffset_dim[0]] += start * stride + * + * if suboffset >= 0: # <<<<<<<<<<<<<< + * if not is_slice: + * if new_ndim == 0: +*/ + } + + /* "View.MemoryView":891 + * suboffset_dim[0] = new_ndim + * + * return 0 # <<<<<<<<<<<<<< + * + * +*/ + __pyx_r = 0; + goto __pyx_L0; + + /* "View.MemoryView":793 + * + * + * @cname('__pyx_memoryview_slice_memviewslice') # <<<<<<<<<<<<<< + * cdef int slice_memviewslice( + * __Pyx_memviewslice *dst, +*/ + + /* function exit code */ + __pyx_L1_error:; + __pyx_gilstate_save = __Pyx_PyGILState_Ensure(); + __Pyx_AddTraceback("View.MemoryView.slice_memviewslice", __pyx_clineno, __pyx_lineno, __pyx_filename); + __pyx_r = -1; + __Pyx_PyGILState_Release(__pyx_gilstate_save); + __pyx_L0:; + return __pyx_r; +} + +/* "View.MemoryView":896 + * + * + * @cname('__pyx_pybuffer_index') # <<<<<<<<<<<<<< + * cdef char *pybuffer_index(Py_buffer *view, char *bufp, Py_ssize_t index, + * Py_ssize_t dim) except NULL: +*/ + +static char *__pyx_pybuffer_index(Py_buffer *__pyx_v_view, char *__pyx_v_bufp, Py_ssize_t __pyx_v_index, Py_ssize_t __pyx_v_dim) { + Py_ssize_t __pyx_v_shape; + Py_ssize_t __pyx_v_stride; + Py_ssize_t __pyx_v_suboffset; + Py_ssize_t __pyx_v_itemsize; + char *__pyx_v_resultp; + char *__pyx_r; + __Pyx_RefNannyDeclarations + Py_ssize_t __pyx_t_1; + int __pyx_t_2; + PyObject *__pyx_t_3 = NULL; + PyObject *__pyx_t_4[3]; + PyObject *__pyx_t_5 = NULL; + int __pyx_lineno = 0; + const char *__pyx_filename = NULL; + int __pyx_clineno = 0; + __Pyx_RefNannySetupContext("pybuffer_index", 0); + + /* "View.MemoryView":899 + * cdef char *pybuffer_index(Py_buffer *view, char *bufp, Py_ssize_t index, + * Py_ssize_t dim) except NULL: + * cdef Py_ssize_t shape, stride, suboffset = -1 # <<<<<<<<<<<<<< + * cdef Py_ssize_t itemsize = view.itemsize + * cdef char *resultp +*/ + __pyx_v_suboffset = -1L; + + /* "View.MemoryView":900 + * Py_ssize_t dim) except NULL: + * cdef Py_ssize_t shape, stride, suboffset = -1 + * cdef Py_ssize_t itemsize = view.itemsize # <<<<<<<<<<<<<< + * cdef char *resultp + * +*/ + __pyx_t_1 = __pyx_v_view->itemsize; + __pyx_v_itemsize = __pyx_t_1; + + /* "View.MemoryView":903 + * cdef char *resultp + * + * if view.ndim == 0: # <<<<<<<<<<<<<< + * shape = view.len // itemsize + * stride = itemsize +*/ + __pyx_t_2 = (__pyx_v_view->ndim == 0); + if (__pyx_t_2) { + + /* "View.MemoryView":904 + * + * if view.ndim == 0: + * shape = view.len // itemsize # <<<<<<<<<<<<<< + * stride = itemsize + * else: +*/ + if (unlikely(__pyx_v_itemsize == 0)) { + PyErr_SetString(PyExc_ZeroDivisionError, "integer division or modulo by zero"); + __PYX_ERR(1, 904, __pyx_L1_error) + } + else if (sizeof(Py_ssize_t) == sizeof(long) && (!(((Py_ssize_t)-1) > 0)) && unlikely(__pyx_v_itemsize == (Py_ssize_t)-1) && unlikely(__Pyx_UNARY_NEG_WOULD_OVERFLOW(__pyx_v_view->len))) { + PyErr_SetString(PyExc_OverflowError, "value too large to perform division"); + __PYX_ERR(1, 904, __pyx_L1_error) + } + __pyx_v_shape = __Pyx_div_Py_ssize_t(__pyx_v_view->len, __pyx_v_itemsize, 0); + + /* "View.MemoryView":905 + * if view.ndim == 0: + * shape = view.len // itemsize + * stride = itemsize # <<<<<<<<<<<<<< + * else: + * shape = view.shape[dim] +*/ + __pyx_v_stride = __pyx_v_itemsize; + + /* "View.MemoryView":903 + * cdef char *resultp + * + * if view.ndim == 0: # <<<<<<<<<<<<<< + * shape = view.len // itemsize + * stride = itemsize +*/ + goto __pyx_L3; + } + + /* "View.MemoryView":907 + * stride = itemsize + * else: + * shape = view.shape[dim] # <<<<<<<<<<<<<< + * stride = view.strides[dim] + * if view.suboffsets != NULL: +*/ + /*else*/ { + __pyx_v_shape = (__pyx_v_view->shape[__pyx_v_dim]); + + /* "View.MemoryView":908 + * else: + * shape = view.shape[dim] + * stride = view.strides[dim] # <<<<<<<<<<<<<< + * if view.suboffsets != NULL: + * suboffset = view.suboffsets[dim] +*/ + __pyx_v_stride = (__pyx_v_view->strides[__pyx_v_dim]); + + /* "View.MemoryView":909 + * shape = view.shape[dim] + * stride = view.strides[dim] + * if view.suboffsets != NULL: # <<<<<<<<<<<<<< + * suboffset = view.suboffsets[dim] + * +*/ + __pyx_t_2 = (__pyx_v_view->suboffsets != NULL); + if (__pyx_t_2) { + + /* "View.MemoryView":910 + * stride = view.strides[dim] + * if view.suboffsets != NULL: + * suboffset = view.suboffsets[dim] # <<<<<<<<<<<<<< + * + * if index < 0: +*/ + __pyx_v_suboffset = (__pyx_v_view->suboffsets[__pyx_v_dim]); + + /* "View.MemoryView":909 + * shape = view.shape[dim] + * stride = view.strides[dim] + * if view.suboffsets != NULL: # <<<<<<<<<<<<<< + * suboffset = view.suboffsets[dim] + * +*/ + } + } + __pyx_L3:; + + /* "View.MemoryView":912 + * suboffset = view.suboffsets[dim] + * + * if index < 0: # <<<<<<<<<<<<<< + * index += view.shape[dim] + * if index < 0: +*/ + __pyx_t_2 = (__pyx_v_index < 0); + if (__pyx_t_2) { + + /* "View.MemoryView":913 + * + * if index < 0: + * index += view.shape[dim] # <<<<<<<<<<<<<< + * if index < 0: + * raise IndexError, f"Out of bounds on buffer access (axis {dim})" +*/ + __pyx_v_index = (__pyx_v_index + (__pyx_v_view->shape[__pyx_v_dim])); + + /* "View.MemoryView":914 + * if index < 0: + * index += view.shape[dim] + * if index < 0: # <<<<<<<<<<<<<< + * raise IndexError, f"Out of bounds on buffer access (axis {dim})" + * +*/ + __pyx_t_2 = (__pyx_v_index < 0); + if (unlikely(__pyx_t_2)) { + + /* "View.MemoryView":915 + * index += view.shape[dim] + * if index < 0: + * raise IndexError, f"Out of bounds on buffer access (axis {dim})" # <<<<<<<<<<<<<< + * + * if index >= shape: +*/ + __pyx_t_3 = __Pyx_PyUnicode_From_Py_ssize_t(__pyx_v_dim, 0, ' ', 'd'); if (unlikely(!__pyx_t_3)) __PYX_ERR(1, 915, __pyx_L1_error) + __Pyx_GOTREF(__pyx_t_3); + __pyx_t_4[0] = __pyx_mstate_global->__pyx_kp_u_Out_of_bounds_on_buffer_access_a; + __pyx_t_4[1] = __pyx_t_3; + __pyx_t_4[2] = __pyx_mstate_global->__pyx_kp_u__5; + __pyx_t_5 = __Pyx_PyUnicode_Join(__pyx_t_4, 3, 37 + __Pyx_PyUnicode_GET_LENGTH(__pyx_t_3) + 1, 127); + if (unlikely(!__pyx_t_5)) __PYX_ERR(1, 915, __pyx_L1_error) + __Pyx_GOTREF(__pyx_t_5); + __Pyx_DECREF(__pyx_t_3); __pyx_t_3 = 0; + __Pyx_Raise(((PyObject *)(((PyTypeObject*)PyExc_IndexError))), __pyx_t_5, 0, 0); + __Pyx_DECREF(__pyx_t_5); __pyx_t_5 = 0; + __PYX_ERR(1, 915, __pyx_L1_error) + + /* "View.MemoryView":914 + * if index < 0: + * index += view.shape[dim] + * if index < 0: # <<<<<<<<<<<<<< + * raise IndexError, f"Out of bounds on buffer access (axis {dim})" + * +*/ + } + + /* "View.MemoryView":912 + * suboffset = view.suboffsets[dim] + * + * if index < 0: # <<<<<<<<<<<<<< + * index += view.shape[dim] + * if index < 0: +*/ + } + + /* "View.MemoryView":917 + * raise IndexError, f"Out of bounds on buffer access (axis {dim})" + * + * if index >= shape: # <<<<<<<<<<<<<< + * raise IndexError, f"Out of bounds on buffer access (axis {dim})" + * +*/ + __pyx_t_2 = (__pyx_v_index >= __pyx_v_shape); + if (unlikely(__pyx_t_2)) { + + /* "View.MemoryView":918 + * + * if index >= shape: + * raise IndexError, f"Out of bounds on buffer access (axis {dim})" # <<<<<<<<<<<<<< + * + * resultp = bufp + index * stride +*/ + __pyx_t_5 = __Pyx_PyUnicode_From_Py_ssize_t(__pyx_v_dim, 0, ' ', 'd'); if (unlikely(!__pyx_t_5)) __PYX_ERR(1, 918, __pyx_L1_error) + __Pyx_GOTREF(__pyx_t_5); + __pyx_t_4[0] = __pyx_mstate_global->__pyx_kp_u_Out_of_bounds_on_buffer_access_a; + __pyx_t_4[1] = __pyx_t_5; + __pyx_t_4[2] = __pyx_mstate_global->__pyx_kp_u__5; + __pyx_t_3 = __Pyx_PyUnicode_Join(__pyx_t_4, 3, 37 + __Pyx_PyUnicode_GET_LENGTH(__pyx_t_5) + 1, 127); + if (unlikely(!__pyx_t_3)) __PYX_ERR(1, 918, __pyx_L1_error) + __Pyx_GOTREF(__pyx_t_3); + __Pyx_DECREF(__pyx_t_5); __pyx_t_5 = 0; + __Pyx_Raise(((PyObject *)(((PyTypeObject*)PyExc_IndexError))), __pyx_t_3, 0, 0); + __Pyx_DECREF(__pyx_t_3); __pyx_t_3 = 0; + __PYX_ERR(1, 918, __pyx_L1_error) + + /* "View.MemoryView":917 + * raise IndexError, f"Out of bounds on buffer access (axis {dim})" + * + * if index >= shape: # <<<<<<<<<<<<<< + * raise IndexError, f"Out of bounds on buffer access (axis {dim})" + * +*/ + } + + /* "View.MemoryView":920 + * raise IndexError, f"Out of bounds on buffer access (axis {dim})" + * + * resultp = bufp + index * stride # <<<<<<<<<<<<<< + * if suboffset >= 0: + * resultp = ( resultp)[0] + suboffset +*/ + __pyx_v_resultp = (__pyx_v_bufp + (__pyx_v_index * __pyx_v_stride)); + + /* "View.MemoryView":921 + * + * resultp = bufp + index * stride + * if suboffset >= 0: # <<<<<<<<<<<<<< + * resultp = ( resultp)[0] + suboffset + * +*/ + __pyx_t_2 = (__pyx_v_suboffset >= 0); + if (__pyx_t_2) { + + /* "View.MemoryView":922 + * resultp = bufp + index * stride + * if suboffset >= 0: + * resultp = ( resultp)[0] + suboffset # <<<<<<<<<<<<<< + * + * return resultp +*/ + __pyx_v_resultp = ((((char **)__pyx_v_resultp)[0]) + __pyx_v_suboffset); + + /* "View.MemoryView":921 + * + * resultp = bufp + index * stride + * if suboffset >= 0: # <<<<<<<<<<<<<< + * resultp = ( resultp)[0] + suboffset + * +*/ + } + + /* "View.MemoryView":924 + * resultp = ( resultp)[0] + suboffset + * + * return resultp # <<<<<<<<<<<<<< + * + * +*/ + __pyx_r = __pyx_v_resultp; + goto __pyx_L0; + + /* "View.MemoryView":896 + * + * + * @cname('__pyx_pybuffer_index') # <<<<<<<<<<<<<< + * cdef char *pybuffer_index(Py_buffer *view, char *bufp, Py_ssize_t index, + * Py_ssize_t dim) except NULL: +*/ + + /* function exit code */ + __pyx_L1_error:; + __Pyx_XDECREF(__pyx_t_3); + __Pyx_XDECREF(__pyx_t_5); + __Pyx_AddTraceback("View.MemoryView.pybuffer_index", __pyx_clineno, __pyx_lineno, __pyx_filename); + __pyx_r = NULL; + __pyx_L0:; + __Pyx_RefNannyFinishContext(); + return __pyx_r; +} + +/* "View.MemoryView":929 + * + * + * @cname('__pyx_memslice_transpose') # <<<<<<<<<<<<<< + * cdef int transpose_memslice(__Pyx_memviewslice *memslice) except -1 nogil: + * cdef int ndim = memslice.memview.view.ndim +*/ + +static int __pyx_memslice_transpose(__Pyx_memviewslice *__pyx_v_memslice) { + int __pyx_v_ndim; + Py_ssize_t *__pyx_v_shape; + Py_ssize_t *__pyx_v_strides; + int __pyx_v_i; + int __pyx_v_j; + int __pyx_r; + int __pyx_t_1; + Py_ssize_t *__pyx_t_2; + long __pyx_t_3; + long __pyx_t_4; + Py_ssize_t __pyx_t_5; + Py_ssize_t __pyx_t_6; + int __pyx_t_7; + int __pyx_t_8; + int __pyx_t_9; + int __pyx_lineno = 0; + const char *__pyx_filename = NULL; + int __pyx_clineno = 0; + PyGILState_STATE __pyx_gilstate_save; + + /* "View.MemoryView":931 + * @cname('__pyx_memslice_transpose') + * cdef int transpose_memslice(__Pyx_memviewslice *memslice) except -1 nogil: + * cdef int ndim = memslice.memview.view.ndim # <<<<<<<<<<<<<< + * + * cdef Py_ssize_t *shape = memslice.shape +*/ + __pyx_t_1 = __pyx_v_memslice->memview->view.ndim; + __pyx_v_ndim = __pyx_t_1; + + /* "View.MemoryView":933 + * cdef int ndim = memslice.memview.view.ndim + * + * cdef Py_ssize_t *shape = memslice.shape # <<<<<<<<<<<<<< + * cdef Py_ssize_t *strides = memslice.strides + * +*/ + __pyx_t_2 = __pyx_v_memslice->shape; + __pyx_v_shape = __pyx_t_2; + + /* "View.MemoryView":934 + * + * cdef Py_ssize_t *shape = memslice.shape + * cdef Py_ssize_t *strides = memslice.strides # <<<<<<<<<<<<<< + * + * +*/ + __pyx_t_2 = __pyx_v_memslice->strides; + __pyx_v_strides = __pyx_t_2; + + /* "View.MemoryView":938 + * + * cdef int i, j + * for i in range(ndim // 2): # <<<<<<<<<<<<<< + * j = ndim - 1 - i + * strides[i], strides[j] = strides[j], strides[i] +*/ + __pyx_t_3 = __Pyx_div_long(__pyx_v_ndim, 2, 1); + __pyx_t_4 = __pyx_t_3; + for (__pyx_t_1 = 0; __pyx_t_1 < __pyx_t_4; __pyx_t_1+=1) { + __pyx_v_i = __pyx_t_1; + + /* "View.MemoryView":939 + * cdef int i, j + * for i in range(ndim // 2): + * j = ndim - 1 - i # <<<<<<<<<<<<<< + * strides[i], strides[j] = strides[j], strides[i] + * shape[i], shape[j] = shape[j], shape[i] +*/ + __pyx_v_j = ((__pyx_v_ndim - 1) - __pyx_v_i); + + /* "View.MemoryView":940 + * for i in range(ndim // 2): + * j = ndim - 1 - i + * strides[i], strides[j] = strides[j], strides[i] # <<<<<<<<<<<<<< + * shape[i], shape[j] = shape[j], shape[i] + * +*/ + __pyx_t_5 = (__pyx_v_strides[__pyx_v_j]); + __pyx_t_6 = (__pyx_v_strides[__pyx_v_i]); + (__pyx_v_strides[__pyx_v_i]) = __pyx_t_5; + (__pyx_v_strides[__pyx_v_j]) = __pyx_t_6; + + /* "View.MemoryView":941 + * j = ndim - 1 - i + * strides[i], strides[j] = strides[j], strides[i] + * shape[i], shape[j] = shape[j], shape[i] # <<<<<<<<<<<<<< + * + * if memslice.suboffsets[i] >= 0 or memslice.suboffsets[j] >= 0: +*/ + __pyx_t_6 = (__pyx_v_shape[__pyx_v_j]); + __pyx_t_5 = (__pyx_v_shape[__pyx_v_i]); + (__pyx_v_shape[__pyx_v_i]) = __pyx_t_6; + (__pyx_v_shape[__pyx_v_j]) = __pyx_t_5; + + /* "View.MemoryView":943 + * shape[i], shape[j] = shape[j], shape[i] + * + * if memslice.suboffsets[i] >= 0 or memslice.suboffsets[j] >= 0: # <<<<<<<<<<<<<< + * _err(PyExc_ValueError, "Cannot transpose memoryview with indirect dimensions") + * +*/ + __pyx_t_8 = ((__pyx_v_memslice->suboffsets[__pyx_v_i]) >= 0); + if (!__pyx_t_8) { + } else { + __pyx_t_7 = __pyx_t_8; + goto __pyx_L6_bool_binop_done; + } + __pyx_t_8 = ((__pyx_v_memslice->suboffsets[__pyx_v_j]) >= 0); + __pyx_t_7 = __pyx_t_8; + __pyx_L6_bool_binop_done:; + if (__pyx_t_7) { + + /* "View.MemoryView":944 + * + * if memslice.suboffsets[i] >= 0 or memslice.suboffsets[j] >= 0: + * _err(PyExc_ValueError, "Cannot transpose memoryview with indirect dimensions") # <<<<<<<<<<<<<< + * + * return 0 +*/ + __pyx_t_9 = __pyx_memoryview_err(PyExc_ValueError, __pyx_mstate_global->__pyx_kp_u_Cannot_transpose_memoryview_with); if (unlikely(__pyx_t_9 == ((int)-1))) __PYX_ERR(1, 944, __pyx_L1_error) + + /* "View.MemoryView":943 + * shape[i], shape[j] = shape[j], shape[i] + * + * if memslice.suboffsets[i] >= 0 or memslice.suboffsets[j] >= 0: # <<<<<<<<<<<<<< + * _err(PyExc_ValueError, "Cannot transpose memoryview with indirect dimensions") + * +*/ + } + } + + /* "View.MemoryView":946 + * _err(PyExc_ValueError, "Cannot transpose memoryview with indirect dimensions") + * + * return 0 # <<<<<<<<<<<<<< + * + * +*/ + __pyx_r = 0; + goto __pyx_L0; + + /* "View.MemoryView":929 + * + * + * @cname('__pyx_memslice_transpose') # <<<<<<<<<<<<<< + * cdef int transpose_memslice(__Pyx_memviewslice *memslice) except -1 nogil: + * cdef int ndim = memslice.memview.view.ndim +*/ + + /* function exit code */ + __pyx_L1_error:; + __pyx_gilstate_save = __Pyx_PyGILState_Ensure(); + __Pyx_AddTraceback("View.MemoryView.transpose_memslice", __pyx_clineno, __pyx_lineno, __pyx_filename); + __pyx_r = -1; + __Pyx_PyGILState_Release(__pyx_gilstate_save); + __pyx_L0:; + return __pyx_r; +} + +/* "View.MemoryView":964 + * cdef int (*to_dtype_func)(char *, object) except 0 + * + * def __dealloc__(self): # <<<<<<<<<<<<<< + * __PYX_XCLEAR_MEMVIEW(&self.from_slice, 1) + * +*/ + +/* Python wrapper */ +static void __pyx_memoryviewslice___dealloc__(PyObject *__pyx_v_self); /*proto*/ +static void __pyx_memoryviewslice___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_memoryviewslice___pyx_pf_15View_dot_MemoryView_16_memoryviewslice___dealloc__(((struct __pyx_memoryviewslice_obj *)__pyx_v_self)); + + /* function exit code */ + __Pyx_RefNannyFinishContext(); +} + +static void __pyx_memoryviewslice___pyx_pf_15View_dot_MemoryView_16_memoryviewslice___dealloc__(struct __pyx_memoryviewslice_obj *__pyx_v_self) { + + /* "View.MemoryView":965 + * + * def __dealloc__(self): + * __PYX_XCLEAR_MEMVIEW(&self.from_slice, 1) # <<<<<<<<<<<<<< + * + * cdef convert_item_to_object(self, char *itemp): +*/ + __PYX_XCLEAR_MEMVIEW((&__pyx_v_self->from_slice), 1); + + /* "View.MemoryView":964 + * cdef int (*to_dtype_func)(char *, object) except 0 + * + * def __dealloc__(self): # <<<<<<<<<<<<<< + * __PYX_XCLEAR_MEMVIEW(&self.from_slice, 1) + * +*/ + + /* function exit code */ +} + +/* "View.MemoryView":967 + * __PYX_XCLEAR_MEMVIEW(&self.from_slice, 1) + * + * cdef convert_item_to_object(self, char *itemp): # <<<<<<<<<<<<<< + * if self.to_object_func != NULL: + * return self.to_object_func(itemp) +*/ + +static PyObject *__pyx_memoryviewslice_convert_item_to_object(struct __pyx_memoryviewslice_obj *__pyx_v_self, char *__pyx_v_itemp) { + 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("convert_item_to_object", 0); + + /* "View.MemoryView":968 + * + * cdef convert_item_to_object(self, char *itemp): + * if self.to_object_func != NULL: # <<<<<<<<<<<<<< + * return self.to_object_func(itemp) + * else: +*/ + __pyx_t_1 = (__pyx_v_self->to_object_func != NULL); + if (__pyx_t_1) { + + /* "View.MemoryView":969 + * cdef convert_item_to_object(self, char *itemp): + * if self.to_object_func != NULL: + * return self.to_object_func(itemp) # <<<<<<<<<<<<<< + * else: + * return memoryview.convert_item_to_object(self, itemp) +*/ + __Pyx_XDECREF(__pyx_r); + __pyx_t_2 = __pyx_v_self->to_object_func(__pyx_v_itemp); if (unlikely(!__pyx_t_2)) __PYX_ERR(1, 969, __pyx_L1_error) + __Pyx_GOTREF(__pyx_t_2); + __pyx_r = __pyx_t_2; + __pyx_t_2 = 0; + goto __pyx_L0; + + /* "View.MemoryView":968 + * + * cdef convert_item_to_object(self, char *itemp): + * if self.to_object_func != NULL: # <<<<<<<<<<<<<< + * return self.to_object_func(itemp) + * else: +*/ + } + + /* "View.MemoryView":971 + * return self.to_object_func(itemp) + * else: + * return memoryview.convert_item_to_object(self, itemp) # <<<<<<<<<<<<<< + * + * cdef assign_item_from_object(self, char *itemp, object value): +*/ + /*else*/ { + __Pyx_XDECREF(__pyx_r); + __pyx_t_2 = __pyx_memoryview_convert_item_to_object(((struct __pyx_memoryview_obj *)__pyx_v_self), __pyx_v_itemp); if (unlikely(!__pyx_t_2)) __PYX_ERR(1, 971, __pyx_L1_error) + __Pyx_GOTREF(__pyx_t_2); + __pyx_r = __pyx_t_2; + __pyx_t_2 = 0; + goto __pyx_L0; + } + + /* "View.MemoryView":967 + * __PYX_XCLEAR_MEMVIEW(&self.from_slice, 1) + * + * cdef convert_item_to_object(self, char *itemp): # <<<<<<<<<<<<<< + * if self.to_object_func != NULL: + * return self.to_object_func(itemp) +*/ + + /* function exit code */ + __pyx_L1_error:; + __Pyx_XDECREF(__pyx_t_2); + __Pyx_AddTraceback("View.MemoryView._memoryviewslice.convert_item_to_object", __pyx_clineno, __pyx_lineno, __pyx_filename); + __pyx_r = 0; + __pyx_L0:; + __Pyx_XGIVEREF(__pyx_r); + __Pyx_RefNannyFinishContext(); + return __pyx_r; +} + +/* "View.MemoryView":973 + * return memoryview.convert_item_to_object(self, itemp) + * + * cdef assign_item_from_object(self, char *itemp, object value): # <<<<<<<<<<<<<< + * if self.to_dtype_func != NULL: + * self.to_dtype_func(itemp, value) +*/ + +static PyObject *__pyx_memoryviewslice_assign_item_from_object(struct __pyx_memoryviewslice_obj *__pyx_v_self, char *__pyx_v_itemp, PyObject *__pyx_v_value) { + PyObject *__pyx_r = NULL; + __Pyx_RefNannyDeclarations + int __pyx_t_1; + int __pyx_t_2; + PyObject *__pyx_t_3 = NULL; + int __pyx_lineno = 0; + const char *__pyx_filename = NULL; + int __pyx_clineno = 0; + __Pyx_RefNannySetupContext("assign_item_from_object", 0); + + /* "View.MemoryView":974 + * + * cdef assign_item_from_object(self, char *itemp, object value): + * if self.to_dtype_func != NULL: # <<<<<<<<<<<<<< + * self.to_dtype_func(itemp, value) + * else: +*/ + __pyx_t_1 = (__pyx_v_self->to_dtype_func != NULL); + if (__pyx_t_1) { + + /* "View.MemoryView":975 + * cdef assign_item_from_object(self, char *itemp, object value): + * if self.to_dtype_func != NULL: + * self.to_dtype_func(itemp, value) # <<<<<<<<<<<<<< + * else: + * memoryview.assign_item_from_object(self, itemp, value) +*/ + __pyx_t_2 = __pyx_v_self->to_dtype_func(__pyx_v_itemp, __pyx_v_value); if (unlikely(__pyx_t_2 == ((int)0))) __PYX_ERR(1, 975, __pyx_L1_error) + + /* "View.MemoryView":974 + * + * cdef assign_item_from_object(self, char *itemp, object value): + * if self.to_dtype_func != NULL: # <<<<<<<<<<<<<< + * self.to_dtype_func(itemp, value) + * else: +*/ + goto __pyx_L3; + } + + /* "View.MemoryView":977 + * self.to_dtype_func(itemp, value) + * else: + * memoryview.assign_item_from_object(self, itemp, value) # <<<<<<<<<<<<<< + * + * cdef _get_base(self): +*/ + /*else*/ { + __pyx_t_3 = __pyx_memoryview_assign_item_from_object(((struct __pyx_memoryview_obj *)__pyx_v_self), __pyx_v_itemp, __pyx_v_value); if (unlikely(!__pyx_t_3)) __PYX_ERR(1, 977, __pyx_L1_error) + __Pyx_GOTREF(__pyx_t_3); + __Pyx_DECREF(__pyx_t_3); __pyx_t_3 = 0; + } + __pyx_L3:; + + /* "View.MemoryView":973 + * return memoryview.convert_item_to_object(self, itemp) + * + * cdef assign_item_from_object(self, char *itemp, object value): # <<<<<<<<<<<<<< + * if self.to_dtype_func != NULL: + * self.to_dtype_func(itemp, value) +*/ + + /* function exit code */ + __pyx_r = Py_None; __Pyx_INCREF(Py_None); + goto __pyx_L0; + __pyx_L1_error:; + __Pyx_XDECREF(__pyx_t_3); + __Pyx_AddTraceback("View.MemoryView._memoryviewslice.assign_item_from_object", __pyx_clineno, __pyx_lineno, __pyx_filename); + __pyx_r = 0; + __pyx_L0:; + __Pyx_XGIVEREF(__pyx_r); + __Pyx_RefNannyFinishContext(); + return __pyx_r; +} + +/* "View.MemoryView":979 + * memoryview.assign_item_from_object(self, itemp, value) + * + * cdef _get_base(self): # <<<<<<<<<<<<<< + * return self.from_object + * +*/ + +static PyObject *__pyx_memoryviewslice__get_base(struct __pyx_memoryviewslice_obj *__pyx_v_self) { + PyObject *__pyx_r = NULL; + __Pyx_RefNannyDeclarations + __Pyx_RefNannySetupContext("_get_base", 0); + + /* "View.MemoryView":980 + * + * cdef _get_base(self): + * return self.from_object # <<<<<<<<<<<<<< + * + * +*/ + __Pyx_XDECREF(__pyx_r); + __Pyx_INCREF(__pyx_v_self->from_object); + __pyx_r = __pyx_v_self->from_object; + goto __pyx_L0; + + /* "View.MemoryView":979 + * memoryview.assign_item_from_object(self, itemp, value) + * + * cdef _get_base(self): # <<<<<<<<<<<<<< + * return self.from_object + * +*/ + + /* function exit code */ + __pyx_L0:; + __Pyx_XGIVEREF(__pyx_r); + __Pyx_RefNannyFinishContext(); + return __pyx_r; +} + +/* "(tree fragment)":1 + * def __reduce_cython__(self): # <<<<<<<<<<<<<< + * raise TypeError, "no default __reduce__ due to non-trivial __cinit__" + * def __setstate_cython__(self, __pyx_state): +*/ + +/* Python wrapper */ +static PyObject *__pyx_pw___pyx_memoryviewslice_1__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*/ +static PyObject *__pyx_pw___pyx_memoryviewslice_1__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___pyx_memoryviewslice___reduce_cython__(((struct __pyx_memoryviewslice_obj *)__pyx_v_self)); + + /* function exit code */ + __Pyx_RefNannyFinishContext(); + return __pyx_r; +} + +static PyObject *__pyx_pf___pyx_memoryviewslice___reduce_cython__(CYTHON_UNUSED struct __pyx_memoryviewslice_obj *__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("View.MemoryView._memoryviewslice.__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___pyx_memoryviewslice_3__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*/ +static PyObject *__pyx_pw___pyx_memoryviewslice_3__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("View.MemoryView._memoryviewslice.__setstate_cython__", __pyx_clineno, __pyx_lineno, __pyx_filename); + __Pyx_RefNannyFinishContext(); + return NULL; + __pyx_L4_argument_unpacking_done:; + __pyx_r = __pyx_pf___pyx_memoryviewslice_2__setstate_cython__(((struct __pyx_memoryviewslice_obj *)__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___pyx_memoryviewslice_2__setstate_cython__(CYTHON_UNUSED struct __pyx_memoryviewslice_obj *__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("View.MemoryView._memoryviewslice.__setstate_cython__", __pyx_clineno, __pyx_lineno, __pyx_filename); + __pyx_r = NULL; + __Pyx_XGIVEREF(__pyx_r); + __Pyx_RefNannyFinishContext(); + return __pyx_r; +} + +/* "View.MemoryView":999 + * pass # ignore failure, it's a minor issue + * + * @cname('__pyx_memoryview_fromslice') # <<<<<<<<<<<<<< + * cdef memoryview_fromslice(__Pyx_memviewslice memviewslice, + * int ndim, +*/ + +static PyObject *__pyx_memoryview_fromslice(__Pyx_memviewslice __pyx_v_memviewslice, int __pyx_v_ndim, PyObject *(*__pyx_v_to_object_func)(char *), int (*__pyx_v_to_dtype_func)(char *, PyObject *), int __pyx_v_dtype_is_object) { + struct __pyx_memoryviewslice_obj *__pyx_v_result = 0; + Py_ssize_t __pyx_v_suboffset; + PyObject *__pyx_v_length = NULL; + PyObject *__pyx_r = NULL; + __Pyx_RefNannyDeclarations + int __pyx_t_1; + PyObject *__pyx_t_2 = NULL; + PyObject *__pyx_t_3 = NULL; + __Pyx_TypeInfo const *__pyx_t_4; + Py_buffer __pyx_t_5; + Py_ssize_t *__pyx_t_6; + Py_ssize_t *__pyx_t_7; + Py_ssize_t *__pyx_t_8; + Py_ssize_t __pyx_t_9; + int __pyx_lineno = 0; + const char *__pyx_filename = NULL; + int __pyx_clineno = 0; + __Pyx_RefNannySetupContext("memoryview_fromslice", 0); + + /* "View.MemoryView":1008 + * cdef _memoryviewslice result + * + * if memviewslice.memview == Py_None: # <<<<<<<<<<<<<< + * return None + * +*/ + __pyx_t_1 = (((PyObject *)__pyx_v_memviewslice.memview) == Py_None); + if (__pyx_t_1) { + + /* "View.MemoryView":1009 + * + * if memviewslice.memview == Py_None: + * return None # <<<<<<<<<<<<<< + * + * +*/ + __Pyx_XDECREF(__pyx_r); + __pyx_r = Py_None; __Pyx_INCREF(Py_None); + goto __pyx_L0; + + /* "View.MemoryView":1008 + * cdef _memoryviewslice result + * + * if memviewslice.memview == Py_None: # <<<<<<<<<<<<<< + * return None + * +*/ + } + + /* "View.MemoryView":1014 + * + * + * result = _memoryviewslice.__new__(_memoryviewslice, None, 0, dtype_is_object) # <<<<<<<<<<<<<< + * + * result.from_slice = memviewslice +*/ + __pyx_t_2 = __Pyx_PyBool_FromLong(__pyx_v_dtype_is_object); if (unlikely(!__pyx_t_2)) __PYX_ERR(1, 1014, __pyx_L1_error) + __Pyx_GOTREF(__pyx_t_2); + __pyx_t_3 = PyTuple_New(3); if (unlikely(!__pyx_t_3)) __PYX_ERR(1, 1014, __pyx_L1_error) + __Pyx_GOTREF(__pyx_t_3); + __Pyx_INCREF(Py_None); + __Pyx_GIVEREF(Py_None); + if (__Pyx_PyTuple_SET_ITEM(__pyx_t_3, 0, Py_None) != (0)) __PYX_ERR(1, 1014, __pyx_L1_error); + __Pyx_INCREF(__pyx_mstate_global->__pyx_int_0); + __Pyx_GIVEREF(__pyx_mstate_global->__pyx_int_0); + if (__Pyx_PyTuple_SET_ITEM(__pyx_t_3, 1, __pyx_mstate_global->__pyx_int_0) != (0)) __PYX_ERR(1, 1014, __pyx_L1_error); + __Pyx_GIVEREF(__pyx_t_2); + if (__Pyx_PyTuple_SET_ITEM(__pyx_t_3, 2, __pyx_t_2) != (0)) __PYX_ERR(1, 1014, __pyx_L1_error); + __pyx_t_2 = 0; + __pyx_t_2 = ((PyObject *)__pyx_tp_new__memoryviewslice(((PyTypeObject *)__pyx_mstate_global->__pyx_memoryviewslice_type), __pyx_t_3, NULL)); if (unlikely(!__pyx_t_2)) __PYX_ERR(1, 1014, __pyx_L1_error) + __Pyx_GOTREF((PyObject *)__pyx_t_2); + __Pyx_DECREF(__pyx_t_3); __pyx_t_3 = 0; + __pyx_v_result = ((struct __pyx_memoryviewslice_obj *)__pyx_t_2); + __pyx_t_2 = 0; + + /* "View.MemoryView":1016 + * result = _memoryviewslice.__new__(_memoryviewslice, None, 0, dtype_is_object) + * + * result.from_slice = memviewslice # <<<<<<<<<<<<<< + * __PYX_INC_MEMVIEW(&memviewslice, 1) + * +*/ + __pyx_v_result->from_slice = __pyx_v_memviewslice; + + /* "View.MemoryView":1017 + * + * result.from_slice = memviewslice + * __PYX_INC_MEMVIEW(&memviewslice, 1) # <<<<<<<<<<<<<< + * + * result.from_object = ( memviewslice.memview)._get_base() +*/ + __PYX_INC_MEMVIEW((&__pyx_v_memviewslice), 1); + + /* "View.MemoryView":1019 + * __PYX_INC_MEMVIEW(&memviewslice, 1) + * + * result.from_object = ( memviewslice.memview)._get_base() # <<<<<<<<<<<<<< + * result.typeinfo = memviewslice.memview.typeinfo + * +*/ + __pyx_t_2 = ((struct __pyx_vtabstruct_memoryview *)((struct __pyx_memoryview_obj *)__pyx_v_memviewslice.memview)->__pyx_vtab)->_get_base(((struct __pyx_memoryview_obj *)__pyx_v_memviewslice.memview)); if (unlikely(!__pyx_t_2)) __PYX_ERR(1, 1019, __pyx_L1_error) + __Pyx_GOTREF(__pyx_t_2); + __Pyx_GIVEREF(__pyx_t_2); + __Pyx_GOTREF(__pyx_v_result->from_object); + __Pyx_DECREF(__pyx_v_result->from_object); + __pyx_v_result->from_object = __pyx_t_2; + __pyx_t_2 = 0; + + /* "View.MemoryView":1020 + * + * result.from_object = ( memviewslice.memview)._get_base() + * result.typeinfo = memviewslice.memview.typeinfo # <<<<<<<<<<<<<< + * + * result.view = memviewslice.memview.view +*/ + __pyx_t_4 = __pyx_v_memviewslice.memview->typeinfo; + __pyx_v_result->__pyx_base.typeinfo = __pyx_t_4; + + /* "View.MemoryView":1022 + * result.typeinfo = memviewslice.memview.typeinfo + * + * result.view = memviewslice.memview.view # <<<<<<<<<<<<<< + * result.view.buf = memviewslice.data + * result.view.ndim = ndim +*/ + __pyx_t_5 = __pyx_v_memviewslice.memview->view; + __pyx_v_result->__pyx_base.view = __pyx_t_5; + + /* "View.MemoryView":1023 + * + * result.view = memviewslice.memview.view + * result.view.buf = memviewslice.data # <<<<<<<<<<<<<< + * result.view.ndim = ndim + * (<__pyx_buffer *> &result.view).obj = Py_None +*/ + __pyx_v_result->__pyx_base.view.buf = ((void *)__pyx_v_memviewslice.data); + + /* "View.MemoryView":1024 + * result.view = memviewslice.memview.view + * result.view.buf = memviewslice.data + * result.view.ndim = ndim # <<<<<<<<<<<<<< + * (<__pyx_buffer *> &result.view).obj = Py_None + * Py_INCREF(Py_None) +*/ + __pyx_v_result->__pyx_base.view.ndim = __pyx_v_ndim; + + /* "View.MemoryView":1025 + * result.view.buf = memviewslice.data + * result.view.ndim = ndim + * (<__pyx_buffer *> &result.view).obj = Py_None # <<<<<<<<<<<<<< + * Py_INCREF(Py_None) + * +*/ + ((Py_buffer *)(&__pyx_v_result->__pyx_base.view))->obj = Py_None; + + /* "View.MemoryView":1026 + * result.view.ndim = ndim + * (<__pyx_buffer *> &result.view).obj = Py_None + * Py_INCREF(Py_None) # <<<<<<<<<<<<<< + * + * if (memviewslice.memview).flags & PyBUF_WRITABLE: +*/ + Py_INCREF(Py_None); + + /* "View.MemoryView":1028 + * Py_INCREF(Py_None) + * + * if (memviewslice.memview).flags & PyBUF_WRITABLE: # <<<<<<<<<<<<<< + * result.flags = PyBUF_RECORDS + * else: +*/ + __pyx_t_1 = ((((struct __pyx_memoryview_obj *)__pyx_v_memviewslice.memview)->flags & PyBUF_WRITABLE) != 0); + if (__pyx_t_1) { + + /* "View.MemoryView":1029 + * + * if (memviewslice.memview).flags & PyBUF_WRITABLE: + * result.flags = PyBUF_RECORDS # <<<<<<<<<<<<<< + * else: + * result.flags = PyBUF_RECORDS_RO +*/ + __pyx_v_result->__pyx_base.flags = PyBUF_RECORDS; + + /* "View.MemoryView":1028 + * Py_INCREF(Py_None) + * + * if (memviewslice.memview).flags & PyBUF_WRITABLE: # <<<<<<<<<<<<<< + * result.flags = PyBUF_RECORDS + * else: +*/ + goto __pyx_L4; + } + + /* "View.MemoryView":1031 + * result.flags = PyBUF_RECORDS + * else: + * result.flags = PyBUF_RECORDS_RO # <<<<<<<<<<<<<< + * + * result.view.shape = result.from_slice.shape +*/ + /*else*/ { + __pyx_v_result->__pyx_base.flags = PyBUF_RECORDS_RO; + } + __pyx_L4:; + + /* "View.MemoryView":1033 + * result.flags = PyBUF_RECORDS_RO + * + * result.view.shape = result.from_slice.shape # <<<<<<<<<<<<<< + * result.view.strides = result.from_slice.strides + * +*/ + __pyx_v_result->__pyx_base.view.shape = ((Py_ssize_t *)__pyx_v_result->from_slice.shape); + + /* "View.MemoryView":1034 + * + * result.view.shape = result.from_slice.shape + * result.view.strides = result.from_slice.strides # <<<<<<<<<<<<<< + * + * +*/ + __pyx_v_result->__pyx_base.view.strides = ((Py_ssize_t *)__pyx_v_result->from_slice.strides); + + /* "View.MemoryView":1037 + * + * + * result.view.suboffsets = NULL # <<<<<<<<<<<<<< + * for suboffset in result.from_slice.suboffsets[:ndim]: + * if suboffset >= 0: +*/ + __pyx_v_result->__pyx_base.view.suboffsets = NULL; + + /* "View.MemoryView":1038 + * + * result.view.suboffsets = NULL + * for suboffset in result.from_slice.suboffsets[:ndim]: # <<<<<<<<<<<<<< + * if suboffset >= 0: + * result.view.suboffsets = result.from_slice.suboffsets +*/ + __pyx_t_7 = (__pyx_v_result->from_slice.suboffsets + __pyx_v_ndim); + for (__pyx_t_8 = __pyx_v_result->from_slice.suboffsets; __pyx_t_8 < __pyx_t_7; __pyx_t_8++) { + __pyx_t_6 = __pyx_t_8; + __pyx_v_suboffset = (__pyx_t_6[0]); + + /* "View.MemoryView":1039 + * result.view.suboffsets = NULL + * for suboffset in result.from_slice.suboffsets[:ndim]: + * if suboffset >= 0: # <<<<<<<<<<<<<< + * result.view.suboffsets = result.from_slice.suboffsets + * break +*/ + __pyx_t_1 = (__pyx_v_suboffset >= 0); + if (__pyx_t_1) { + + /* "View.MemoryView":1040 + * for suboffset in result.from_slice.suboffsets[:ndim]: + * if suboffset >= 0: + * result.view.suboffsets = result.from_slice.suboffsets # <<<<<<<<<<<<<< + * break + * +*/ + __pyx_v_result->__pyx_base.view.suboffsets = ((Py_ssize_t *)__pyx_v_result->from_slice.suboffsets); + + /* "View.MemoryView":1041 + * if suboffset >= 0: + * result.view.suboffsets = result.from_slice.suboffsets + * break # <<<<<<<<<<<<<< + * + * result.view.len = result.view.itemsize +*/ + goto __pyx_L6_break; + + /* "View.MemoryView":1039 + * result.view.suboffsets = NULL + * for suboffset in result.from_slice.suboffsets[:ndim]: + * if suboffset >= 0: # <<<<<<<<<<<<<< + * result.view.suboffsets = result.from_slice.suboffsets + * break +*/ + } + } + __pyx_L6_break:; + + /* "View.MemoryView":1043 + * break + * + * result.view.len = result.view.itemsize # <<<<<<<<<<<<<< + * for length in result.view.shape[:ndim]: + * result.view.len *= length +*/ + __pyx_t_9 = __pyx_v_result->__pyx_base.view.itemsize; + __pyx_v_result->__pyx_base.view.len = __pyx_t_9; + + /* "View.MemoryView":1044 + * + * result.view.len = result.view.itemsize + * for length in result.view.shape[:ndim]: # <<<<<<<<<<<<<< + * result.view.len *= length + * +*/ + __pyx_t_7 = (__pyx_v_result->__pyx_base.view.shape + __pyx_v_ndim); + for (__pyx_t_8 = __pyx_v_result->__pyx_base.view.shape; __pyx_t_8 < __pyx_t_7; __pyx_t_8++) { + __pyx_t_6 = __pyx_t_8; + __pyx_t_2 = PyLong_FromSsize_t((__pyx_t_6[0])); if (unlikely(!__pyx_t_2)) __PYX_ERR(1, 1044, __pyx_L1_error) + __Pyx_GOTREF(__pyx_t_2); + __Pyx_XDECREF_SET(__pyx_v_length, __pyx_t_2); + __pyx_t_2 = 0; + + /* "View.MemoryView":1045 + * result.view.len = result.view.itemsize + * for length in result.view.shape[:ndim]: + * result.view.len *= length # <<<<<<<<<<<<<< + * + * result.to_object_func = to_object_func +*/ + __pyx_t_2 = PyLong_FromSsize_t(__pyx_v_result->__pyx_base.view.len); if (unlikely(!__pyx_t_2)) __PYX_ERR(1, 1045, __pyx_L1_error) + __Pyx_GOTREF(__pyx_t_2); + __pyx_t_3 = PyNumber_InPlaceMultiply(__pyx_t_2, __pyx_v_length); if (unlikely(!__pyx_t_3)) __PYX_ERR(1, 1045, __pyx_L1_error) + __Pyx_GOTREF(__pyx_t_3); + __Pyx_DECREF(__pyx_t_2); __pyx_t_2 = 0; + __pyx_t_9 = __Pyx_PyIndex_AsSsize_t(__pyx_t_3); if (unlikely((__pyx_t_9 == (Py_ssize_t)-1) && PyErr_Occurred())) __PYX_ERR(1, 1045, __pyx_L1_error) + __Pyx_DECREF(__pyx_t_3); __pyx_t_3 = 0; + __pyx_v_result->__pyx_base.view.len = __pyx_t_9; + } + + /* "View.MemoryView":1047 + * result.view.len *= length + * + * result.to_object_func = to_object_func # <<<<<<<<<<<<<< + * result.to_dtype_func = to_dtype_func + * +*/ + __pyx_v_result->to_object_func = __pyx_v_to_object_func; + + /* "View.MemoryView":1048 + * + * result.to_object_func = to_object_func + * result.to_dtype_func = to_dtype_func # <<<<<<<<<<<<<< + * + * return result +*/ + __pyx_v_result->to_dtype_func = __pyx_v_to_dtype_func; + + /* "View.MemoryView":1050 + * result.to_dtype_func = to_dtype_func + * + * return result # <<<<<<<<<<<<<< + * + * @cname('__pyx_memoryview_get_slice_from_memoryview') +*/ + __Pyx_XDECREF(__pyx_r); + __Pyx_INCREF((PyObject *)__pyx_v_result); + __pyx_r = ((PyObject *)__pyx_v_result); + goto __pyx_L0; + + /* "View.MemoryView":999 + * pass # ignore failure, it's a minor issue + * + * @cname('__pyx_memoryview_fromslice') # <<<<<<<<<<<<<< + * cdef memoryview_fromslice(__Pyx_memviewslice memviewslice, + * int ndim, +*/ + + /* function exit code */ + __pyx_L1_error:; + __Pyx_XDECREF(__pyx_t_2); + __Pyx_XDECREF(__pyx_t_3); + __Pyx_AddTraceback("View.MemoryView.memoryview_fromslice", __pyx_clineno, __pyx_lineno, __pyx_filename); + __pyx_r = 0; + __pyx_L0:; + __Pyx_XDECREF((PyObject *)__pyx_v_result); + __Pyx_XDECREF(__pyx_v_length); + __Pyx_XGIVEREF(__pyx_r); + __Pyx_RefNannyFinishContext(); + return __pyx_r; +} + +/* "View.MemoryView":1052 + * return result + * + * @cname('__pyx_memoryview_get_slice_from_memoryview') # <<<<<<<<<<<<<< + * cdef __Pyx_memviewslice *get_slice_from_memview(memoryview memview, + * __Pyx_memviewslice *mslice) except NULL: +*/ + +static __Pyx_memviewslice *__pyx_memoryview_get_slice_from_memoryview(struct __pyx_memoryview_obj *__pyx_v_memview, __Pyx_memviewslice *__pyx_v_mslice) { + struct __pyx_memoryviewslice_obj *__pyx_v_obj = 0; + __Pyx_memviewslice *__pyx_r; + __Pyx_RefNannyDeclarations + int __pyx_t_1; + PyObject *__pyx_t_2 = NULL; + int __pyx_lineno = 0; + const char *__pyx_filename = NULL; + int __pyx_clineno = 0; + __Pyx_RefNannySetupContext("get_slice_from_memview", 0); + + /* "View.MemoryView":1056 + * __Pyx_memviewslice *mslice) except NULL: + * cdef _memoryviewslice obj + * if isinstance(memview, _memoryviewslice): # <<<<<<<<<<<<<< + * obj = memview + * return &obj.from_slice +*/ + __pyx_t_1 = __Pyx_TypeCheck(((PyObject *)__pyx_v_memview), __pyx_mstate_global->__pyx_memoryviewslice_type); + if (__pyx_t_1) { + + /* "View.MemoryView":1057 + * cdef _memoryviewslice obj + * if isinstance(memview, _memoryviewslice): + * obj = memview # <<<<<<<<<<<<<< + * return &obj.from_slice + * else: +*/ + __pyx_t_2 = ((PyObject *)__pyx_v_memview); + __Pyx_INCREF(__pyx_t_2); + if (!(likely(((__pyx_t_2) == Py_None) || likely(__Pyx_TypeTest(__pyx_t_2, __pyx_mstate_global->__pyx_memoryviewslice_type))))) __PYX_ERR(1, 1057, __pyx_L1_error) + __pyx_v_obj = ((struct __pyx_memoryviewslice_obj *)__pyx_t_2); + __pyx_t_2 = 0; + + /* "View.MemoryView":1058 + * if isinstance(memview, _memoryviewslice): + * obj = memview + * return &obj.from_slice # <<<<<<<<<<<<<< + * else: + * slice_copy(memview, mslice) +*/ + __pyx_r = (&__pyx_v_obj->from_slice); + goto __pyx_L0; + + /* "View.MemoryView":1056 + * __Pyx_memviewslice *mslice) except NULL: + * cdef _memoryviewslice obj + * if isinstance(memview, _memoryviewslice): # <<<<<<<<<<<<<< + * obj = memview + * return &obj.from_slice +*/ + } + + /* "View.MemoryView":1060 + * return &obj.from_slice + * else: + * slice_copy(memview, mslice) # <<<<<<<<<<<<<< + * return mslice + * +*/ + /*else*/ { + __pyx_memoryview_slice_copy(__pyx_v_memview, __pyx_v_mslice); + + /* "View.MemoryView":1061 + * else: + * slice_copy(memview, mslice) + * return mslice # <<<<<<<<<<<<<< + * + * @cname('__pyx_memoryview_slice_copy') +*/ + __pyx_r = __pyx_v_mslice; + goto __pyx_L0; + } + + /* "View.MemoryView":1052 + * return result + * + * @cname('__pyx_memoryview_get_slice_from_memoryview') # <<<<<<<<<<<<<< + * cdef __Pyx_memviewslice *get_slice_from_memview(memoryview memview, + * __Pyx_memviewslice *mslice) except NULL: +*/ + + /* function exit code */ + __pyx_L1_error:; + __Pyx_XDECREF(__pyx_t_2); + __Pyx_AddTraceback("View.MemoryView.get_slice_from_memview", __pyx_clineno, __pyx_lineno, __pyx_filename); + __pyx_r = NULL; + __pyx_L0:; + __Pyx_XDECREF((PyObject *)__pyx_v_obj); + __Pyx_RefNannyFinishContext(); + return __pyx_r; +} + +/* "View.MemoryView":1063 + * return mslice + * + * @cname('__pyx_memoryview_slice_copy') # <<<<<<<<<<<<<< + * cdef void slice_copy(memoryview memview, __Pyx_memviewslice *dst) noexcept: + * cdef int dim +*/ + +static void __pyx_memoryview_slice_copy(struct __pyx_memoryview_obj *__pyx_v_memview, __Pyx_memviewslice *__pyx_v_dst) { + int __pyx_v_dim; + Py_ssize_t *__pyx_v_shape; + Py_ssize_t *__pyx_v_strides; + Py_ssize_t *__pyx_v_suboffsets; + Py_ssize_t *__pyx_t_1; + int __pyx_t_2; + int __pyx_t_3; + int __pyx_t_4; + Py_ssize_t __pyx_t_5; + int __pyx_t_6; + + /* "View.MemoryView":1068 + * cdef (Py_ssize_t*) shape, strides, suboffsets + * + * shape = memview.view.shape # <<<<<<<<<<<<<< + * strides = memview.view.strides + * suboffsets = memview.view.suboffsets +*/ + __pyx_t_1 = __pyx_v_memview->view.shape; + __pyx_v_shape = __pyx_t_1; + + /* "View.MemoryView":1069 + * + * shape = memview.view.shape + * strides = memview.view.strides # <<<<<<<<<<<<<< + * suboffsets = memview.view.suboffsets + * +*/ + __pyx_t_1 = __pyx_v_memview->view.strides; + __pyx_v_strides = __pyx_t_1; + + /* "View.MemoryView":1070 + * shape = memview.view.shape + * strides = memview.view.strides + * suboffsets = memview.view.suboffsets # <<<<<<<<<<<<<< + * + * dst.memview = <__pyx_memoryview *> memview +*/ + __pyx_t_1 = __pyx_v_memview->view.suboffsets; + __pyx_v_suboffsets = __pyx_t_1; + + /* "View.MemoryView":1072 + * suboffsets = memview.view.suboffsets + * + * dst.memview = <__pyx_memoryview *> memview # <<<<<<<<<<<<<< + * dst.data = memview.view.buf + * +*/ + __pyx_v_dst->memview = ((struct __pyx_memoryview_obj *)__pyx_v_memview); + + /* "View.MemoryView":1073 + * + * dst.memview = <__pyx_memoryview *> memview + * dst.data = memview.view.buf # <<<<<<<<<<<<<< + * + * for dim in range(memview.view.ndim): +*/ + __pyx_v_dst->data = ((char *)__pyx_v_memview->view.buf); + + /* "View.MemoryView":1075 + * dst.data = memview.view.buf + * + * for dim in range(memview.view.ndim): # <<<<<<<<<<<<<< + * dst.shape[dim] = shape[dim] + * dst.strides[dim] = strides[dim] +*/ + __pyx_t_2 = __pyx_v_memview->view.ndim; + __pyx_t_3 = __pyx_t_2; + for (__pyx_t_4 = 0; __pyx_t_4 < __pyx_t_3; __pyx_t_4+=1) { + __pyx_v_dim = __pyx_t_4; + + /* "View.MemoryView":1076 + * + * for dim in range(memview.view.ndim): + * dst.shape[dim] = shape[dim] # <<<<<<<<<<<<<< + * dst.strides[dim] = strides[dim] + * dst.suboffsets[dim] = suboffsets[dim] if suboffsets else -1 +*/ + (__pyx_v_dst->shape[__pyx_v_dim]) = (__pyx_v_shape[__pyx_v_dim]); + + /* "View.MemoryView":1077 + * for dim in range(memview.view.ndim): + * dst.shape[dim] = shape[dim] + * dst.strides[dim] = strides[dim] # <<<<<<<<<<<<<< + * dst.suboffsets[dim] = suboffsets[dim] if suboffsets else -1 + * +*/ + (__pyx_v_dst->strides[__pyx_v_dim]) = (__pyx_v_strides[__pyx_v_dim]); + + /* "View.MemoryView":1078 + * dst.shape[dim] = shape[dim] + * dst.strides[dim] = strides[dim] + * dst.suboffsets[dim] = suboffsets[dim] if suboffsets else -1 # <<<<<<<<<<<<<< + * + * @cname('__pyx_memoryview_copy_object') +*/ + __pyx_t_6 = (__pyx_v_suboffsets != 0); + if (__pyx_t_6) { + __pyx_t_5 = (__pyx_v_suboffsets[__pyx_v_dim]); + } else { + __pyx_t_5 = -1L; + } + (__pyx_v_dst->suboffsets[__pyx_v_dim]) = __pyx_t_5; + } + + /* "View.MemoryView":1063 + * return mslice + * + * @cname('__pyx_memoryview_slice_copy') # <<<<<<<<<<<<<< + * cdef void slice_copy(memoryview memview, __Pyx_memviewslice *dst) noexcept: + * cdef int dim +*/ + + /* function exit code */ +} + +/* "View.MemoryView":1080 + * dst.suboffsets[dim] = suboffsets[dim] if suboffsets else -1 + * + * @cname('__pyx_memoryview_copy_object') # <<<<<<<<<<<<<< + * cdef memoryview_copy(memoryview memview): + * "Create a new memoryview object" +*/ + +static PyObject *__pyx_memoryview_copy_object(struct __pyx_memoryview_obj *__pyx_v_memview) { + __Pyx_memviewslice __pyx_v_memviewslice; + 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("memoryview_copy", 0); + + /* "View.MemoryView":1084 + * "Create a new memoryview object" + * cdef __Pyx_memviewslice memviewslice + * slice_copy(memview, &memviewslice) # <<<<<<<<<<<<<< + * return memoryview_copy_from_slice(memview, &memviewslice) + * +*/ + __pyx_memoryview_slice_copy(__pyx_v_memview, (&__pyx_v_memviewslice)); + + /* "View.MemoryView":1085 + * cdef __Pyx_memviewslice memviewslice + * slice_copy(memview, &memviewslice) + * return memoryview_copy_from_slice(memview, &memviewslice) # <<<<<<<<<<<<<< + * + * @cname('__pyx_memoryview_copy_object_from_slice') +*/ + __Pyx_XDECREF(__pyx_r); + __pyx_t_1 = __pyx_memoryview_copy_object_from_slice(__pyx_v_memview, (&__pyx_v_memviewslice)); if (unlikely(!__pyx_t_1)) __PYX_ERR(1, 1085, __pyx_L1_error) + __Pyx_GOTREF(__pyx_t_1); + __pyx_r = __pyx_t_1; + __pyx_t_1 = 0; + goto __pyx_L0; + + /* "View.MemoryView":1080 + * dst.suboffsets[dim] = suboffsets[dim] if suboffsets else -1 + * + * @cname('__pyx_memoryview_copy_object') # <<<<<<<<<<<<<< + * cdef memoryview_copy(memoryview memview): + * "Create a new memoryview object" +*/ + + /* function exit code */ + __pyx_L1_error:; + __Pyx_XDECREF(__pyx_t_1); + __Pyx_AddTraceback("View.MemoryView.memoryview_copy", __pyx_clineno, __pyx_lineno, __pyx_filename); + __pyx_r = 0; + __pyx_L0:; + __Pyx_XGIVEREF(__pyx_r); + __Pyx_RefNannyFinishContext(); + return __pyx_r; +} + +/* "View.MemoryView":1087 + * return memoryview_copy_from_slice(memview, &memviewslice) + * + * @cname('__pyx_memoryview_copy_object_from_slice') # <<<<<<<<<<<<<< + * cdef memoryview_copy_from_slice(memoryview memview, __Pyx_memviewslice *memviewslice): + * """ +*/ + +static PyObject *__pyx_memoryview_copy_object_from_slice(struct __pyx_memoryview_obj *__pyx_v_memview, __Pyx_memviewslice *__pyx_v_memviewslice) { + PyObject *(*__pyx_v_to_object_func)(char *); + int (*__pyx_v_to_dtype_func)(char *, PyObject *); + PyObject *__pyx_r = NULL; + __Pyx_RefNannyDeclarations + int __pyx_t_1; + PyObject *(*__pyx_t_2)(char *); + int (*__pyx_t_3)(char *, PyObject *); + PyObject *__pyx_t_4 = NULL; + int __pyx_lineno = 0; + const char *__pyx_filename = NULL; + int __pyx_clineno = 0; + __Pyx_RefNannySetupContext("memoryview_copy_from_slice", 0); + + /* "View.MemoryView":1095 + * cdef int (*to_dtype_func)(char *, object) except 0 + * + * if isinstance(memview, _memoryviewslice): # <<<<<<<<<<<<<< + * to_object_func = (<_memoryviewslice> memview).to_object_func + * to_dtype_func = (<_memoryviewslice> memview).to_dtype_func +*/ + __pyx_t_1 = __Pyx_TypeCheck(((PyObject *)__pyx_v_memview), __pyx_mstate_global->__pyx_memoryviewslice_type); + if (__pyx_t_1) { + + /* "View.MemoryView":1096 + * + * if isinstance(memview, _memoryviewslice): + * to_object_func = (<_memoryviewslice> memview).to_object_func # <<<<<<<<<<<<<< + * to_dtype_func = (<_memoryviewslice> memview).to_dtype_func + * else: +*/ + __pyx_t_2 = ((struct __pyx_memoryviewslice_obj *)__pyx_v_memview)->to_object_func; + __pyx_v_to_object_func = __pyx_t_2; + + /* "View.MemoryView":1097 + * if isinstance(memview, _memoryviewslice): + * to_object_func = (<_memoryviewslice> memview).to_object_func + * to_dtype_func = (<_memoryviewslice> memview).to_dtype_func # <<<<<<<<<<<<<< + * else: + * to_object_func = NULL +*/ + __pyx_t_3 = ((struct __pyx_memoryviewslice_obj *)__pyx_v_memview)->to_dtype_func; + __pyx_v_to_dtype_func = __pyx_t_3; + + /* "View.MemoryView":1095 + * cdef int (*to_dtype_func)(char *, object) except 0 + * + * if isinstance(memview, _memoryviewslice): # <<<<<<<<<<<<<< + * to_object_func = (<_memoryviewslice> memview).to_object_func + * to_dtype_func = (<_memoryviewslice> memview).to_dtype_func +*/ + goto __pyx_L3; + } + + /* "View.MemoryView":1099 + * to_dtype_func = (<_memoryviewslice> memview).to_dtype_func + * else: + * to_object_func = NULL # <<<<<<<<<<<<<< + * to_dtype_func = NULL + * +*/ + /*else*/ { + __pyx_v_to_object_func = NULL; + + /* "View.MemoryView":1100 + * else: + * to_object_func = NULL + * to_dtype_func = NULL # <<<<<<<<<<<<<< + * + * return memoryview_fromslice(memviewslice[0], memview.view.ndim, +*/ + __pyx_v_to_dtype_func = NULL; + } + __pyx_L3:; + + /* "View.MemoryView":1102 + * to_dtype_func = NULL + * + * return memoryview_fromslice(memviewslice[0], memview.view.ndim, # <<<<<<<<<<<<<< + * to_object_func, to_dtype_func, + * memview.dtype_is_object) +*/ + __Pyx_XDECREF(__pyx_r); + + /* "View.MemoryView":1104 + * return memoryview_fromslice(memviewslice[0], memview.view.ndim, + * to_object_func, to_dtype_func, + * memview.dtype_is_object) # <<<<<<<<<<<<<< + * + * +*/ + __pyx_t_4 = __pyx_memoryview_fromslice((__pyx_v_memviewslice[0]), __pyx_v_memview->view.ndim, __pyx_v_to_object_func, __pyx_v_to_dtype_func, __pyx_v_memview->dtype_is_object); if (unlikely(!__pyx_t_4)) __PYX_ERR(1, 1102, __pyx_L1_error) + __Pyx_GOTREF(__pyx_t_4); + __pyx_r = __pyx_t_4; + __pyx_t_4 = 0; + goto __pyx_L0; + + /* "View.MemoryView":1087 + * return memoryview_copy_from_slice(memview, &memviewslice) + * + * @cname('__pyx_memoryview_copy_object_from_slice') # <<<<<<<<<<<<<< + * cdef memoryview_copy_from_slice(memoryview memview, __Pyx_memviewslice *memviewslice): + * """ +*/ + + /* function exit code */ + __pyx_L1_error:; + __Pyx_XDECREF(__pyx_t_4); + __Pyx_AddTraceback("View.MemoryView.memoryview_copy_from_slice", __pyx_clineno, __pyx_lineno, __pyx_filename); + __pyx_r = 0; + __pyx_L0:; + __Pyx_XGIVEREF(__pyx_r); + __Pyx_RefNannyFinishContext(); + return __pyx_r; +} + +/* "View.MemoryView":1110 + * + * + * cdef Py_ssize_t abs_py_ssize_t(Py_ssize_t arg) noexcept nogil: # <<<<<<<<<<<<<< + * return -arg if arg < 0 else arg + * +*/ + +static Py_ssize_t abs_py_ssize_t(Py_ssize_t __pyx_v_arg) { + Py_ssize_t __pyx_r; + Py_ssize_t __pyx_t_1; + int __pyx_t_2; + + /* "View.MemoryView":1111 + * + * cdef Py_ssize_t abs_py_ssize_t(Py_ssize_t arg) noexcept nogil: + * return -arg if arg < 0 else arg # <<<<<<<<<<<<<< + * + * @cname('__pyx_get_best_slice_order') +*/ + __pyx_t_2 = (__pyx_v_arg < 0); + if (__pyx_t_2) { + __pyx_t_1 = (-__pyx_v_arg); + } else { + __pyx_t_1 = __pyx_v_arg; + } + __pyx_r = __pyx_t_1; + goto __pyx_L0; + + /* "View.MemoryView":1110 + * + * + * cdef Py_ssize_t abs_py_ssize_t(Py_ssize_t arg) noexcept nogil: # <<<<<<<<<<<<<< + * return -arg if arg < 0 else arg + * +*/ + + /* function exit code */ + __pyx_L0:; + return __pyx_r; +} + +/* "View.MemoryView":1113 + * return -arg if arg < 0 else arg + * + * @cname('__pyx_get_best_slice_order') # <<<<<<<<<<<<<< + * cdef char get_best_order(__Pyx_memviewslice *mslice, int ndim) noexcept nogil: + * """ +*/ + +static char __pyx_get_best_slice_order(__Pyx_memviewslice *__pyx_v_mslice, int __pyx_v_ndim) { + int __pyx_v_i; + Py_ssize_t __pyx_v_c_stride; + Py_ssize_t __pyx_v_f_stride; + char __pyx_r; + int __pyx_t_1; + int __pyx_t_2; + int __pyx_t_3; + int __pyx_t_4; + + /* "View.MemoryView":1119 + * """ + * cdef int i + * cdef Py_ssize_t c_stride = 0 # <<<<<<<<<<<<<< + * cdef Py_ssize_t f_stride = 0 + * +*/ + __pyx_v_c_stride = 0; + + /* "View.MemoryView":1120 + * cdef int i + * cdef Py_ssize_t c_stride = 0 + * cdef Py_ssize_t f_stride = 0 # <<<<<<<<<<<<<< + * + * for i in range(ndim - 1, -1, -1): +*/ + __pyx_v_f_stride = 0; + + /* "View.MemoryView":1122 + * cdef Py_ssize_t f_stride = 0 + * + * for i in range(ndim - 1, -1, -1): # <<<<<<<<<<<<<< + * if mslice.shape[i] > 1: + * c_stride = mslice.strides[i] +*/ + for (__pyx_t_1 = (__pyx_v_ndim - 1); __pyx_t_1 > -1; __pyx_t_1-=1) { + __pyx_v_i = __pyx_t_1; + + /* "View.MemoryView":1123 + * + * for i in range(ndim - 1, -1, -1): + * if mslice.shape[i] > 1: # <<<<<<<<<<<<<< + * c_stride = mslice.strides[i] + * break +*/ + __pyx_t_2 = ((__pyx_v_mslice->shape[__pyx_v_i]) > 1); + if (__pyx_t_2) { + + /* "View.MemoryView":1124 + * for i in range(ndim - 1, -1, -1): + * if mslice.shape[i] > 1: + * c_stride = mslice.strides[i] # <<<<<<<<<<<<<< + * break + * +*/ + __pyx_v_c_stride = (__pyx_v_mslice->strides[__pyx_v_i]); + + /* "View.MemoryView":1125 + * if mslice.shape[i] > 1: + * c_stride = mslice.strides[i] + * break # <<<<<<<<<<<<<< + * + * for i in range(ndim): +*/ + goto __pyx_L4_break; + + /* "View.MemoryView":1123 + * + * for i in range(ndim - 1, -1, -1): + * if mslice.shape[i] > 1: # <<<<<<<<<<<<<< + * c_stride = mslice.strides[i] + * break +*/ + } + } + __pyx_L4_break:; + + /* "View.MemoryView":1127 + * break + * + * for i in range(ndim): # <<<<<<<<<<<<<< + * if mslice.shape[i] > 1: + * f_stride = mslice.strides[i] +*/ + __pyx_t_1 = __pyx_v_ndim; + __pyx_t_3 = __pyx_t_1; + for (__pyx_t_4 = 0; __pyx_t_4 < __pyx_t_3; __pyx_t_4+=1) { + __pyx_v_i = __pyx_t_4; + + /* "View.MemoryView":1128 + * + * for i in range(ndim): + * if mslice.shape[i] > 1: # <<<<<<<<<<<<<< + * f_stride = mslice.strides[i] + * break +*/ + __pyx_t_2 = ((__pyx_v_mslice->shape[__pyx_v_i]) > 1); + if (__pyx_t_2) { + + /* "View.MemoryView":1129 + * for i in range(ndim): + * if mslice.shape[i] > 1: + * f_stride = mslice.strides[i] # <<<<<<<<<<<<<< + * break + * +*/ + __pyx_v_f_stride = (__pyx_v_mslice->strides[__pyx_v_i]); + + /* "View.MemoryView":1130 + * if mslice.shape[i] > 1: + * f_stride = mslice.strides[i] + * break # <<<<<<<<<<<<<< + * + * if abs_py_ssize_t(c_stride) <= abs_py_ssize_t(f_stride): +*/ + goto __pyx_L7_break; + + /* "View.MemoryView":1128 + * + * for i in range(ndim): + * if mslice.shape[i] > 1: # <<<<<<<<<<<<<< + * f_stride = mslice.strides[i] + * break +*/ + } + } + __pyx_L7_break:; + + /* "View.MemoryView":1132 + * break + * + * if abs_py_ssize_t(c_stride) <= abs_py_ssize_t(f_stride): # <<<<<<<<<<<<<< + * return 'C' + * else: +*/ + __pyx_t_2 = (abs_py_ssize_t(__pyx_v_c_stride) <= abs_py_ssize_t(__pyx_v_f_stride)); + if (__pyx_t_2) { + + /* "View.MemoryView":1133 + * + * if abs_py_ssize_t(c_stride) <= abs_py_ssize_t(f_stride): + * return 'C' # <<<<<<<<<<<<<< + * else: + * return 'F' +*/ + __pyx_r = 'C'; + goto __pyx_L0; + + /* "View.MemoryView":1132 + * break + * + * if abs_py_ssize_t(c_stride) <= abs_py_ssize_t(f_stride): # <<<<<<<<<<<<<< + * return 'C' + * else: +*/ + } + + /* "View.MemoryView":1135 + * return 'C' + * else: + * return 'F' # <<<<<<<<<<<<<< + * + * @cython.cdivision(True) +*/ + /*else*/ { + __pyx_r = 'F'; + goto __pyx_L0; + } + + /* "View.MemoryView":1113 + * return -arg if arg < 0 else arg + * + * @cname('__pyx_get_best_slice_order') # <<<<<<<<<<<<<< + * cdef char get_best_order(__Pyx_memviewslice *mslice, int ndim) noexcept nogil: + * """ +*/ + + /* function exit code */ + __pyx_L0:; + return __pyx_r; +} + +/* "View.MemoryView":1137 + * return 'F' + * + * @cython.cdivision(True) # <<<<<<<<<<<<<< + * cdef void _copy_strided_to_strided(char *src_data, Py_ssize_t *src_strides, + * char *dst_data, Py_ssize_t *dst_strides, +*/ + +static void _copy_strided_to_strided(char *__pyx_v_src_data, Py_ssize_t *__pyx_v_src_strides, char *__pyx_v_dst_data, Py_ssize_t *__pyx_v_dst_strides, Py_ssize_t *__pyx_v_src_shape, Py_ssize_t *__pyx_v_dst_shape, int __pyx_v_ndim, size_t __pyx_v_itemsize) { + CYTHON_UNUSED Py_ssize_t __pyx_v_i; + CYTHON_UNUSED Py_ssize_t __pyx_v_src_extent; + Py_ssize_t __pyx_v_dst_extent; + Py_ssize_t __pyx_v_src_stride; + Py_ssize_t __pyx_v_dst_stride; + int __pyx_t_1; + int __pyx_t_2; + Py_ssize_t __pyx_t_3; + Py_ssize_t __pyx_t_4; + Py_ssize_t __pyx_t_5; + + /* "View.MemoryView":1145 + * + * cdef Py_ssize_t i + * cdef Py_ssize_t src_extent = src_shape[0] # <<<<<<<<<<<<<< + * cdef Py_ssize_t dst_extent = dst_shape[0] + * cdef Py_ssize_t src_stride = src_strides[0] +*/ + __pyx_v_src_extent = (__pyx_v_src_shape[0]); + + /* "View.MemoryView":1146 + * cdef Py_ssize_t i + * cdef Py_ssize_t src_extent = src_shape[0] + * cdef Py_ssize_t dst_extent = dst_shape[0] # <<<<<<<<<<<<<< + * cdef Py_ssize_t src_stride = src_strides[0] + * cdef Py_ssize_t dst_stride = dst_strides[0] +*/ + __pyx_v_dst_extent = (__pyx_v_dst_shape[0]); + + /* "View.MemoryView":1147 + * cdef Py_ssize_t src_extent = src_shape[0] + * cdef Py_ssize_t dst_extent = dst_shape[0] + * cdef Py_ssize_t src_stride = src_strides[0] # <<<<<<<<<<<<<< + * cdef Py_ssize_t dst_stride = dst_strides[0] + * +*/ + __pyx_v_src_stride = (__pyx_v_src_strides[0]); + + /* "View.MemoryView":1148 + * cdef Py_ssize_t dst_extent = dst_shape[0] + * cdef Py_ssize_t src_stride = src_strides[0] + * cdef Py_ssize_t dst_stride = dst_strides[0] # <<<<<<<<<<<<<< + * + * if ndim == 1: +*/ + __pyx_v_dst_stride = (__pyx_v_dst_strides[0]); + + /* "View.MemoryView":1150 + * cdef Py_ssize_t dst_stride = dst_strides[0] + * + * if ndim == 1: # <<<<<<<<<<<<<< + * if (src_stride > 0 and dst_stride > 0 and + * src_stride == itemsize == dst_stride): +*/ + __pyx_t_1 = (__pyx_v_ndim == 1); + if (__pyx_t_1) { + + /* "View.MemoryView":1151 + * + * if ndim == 1: + * if (src_stride > 0 and dst_stride > 0 and # <<<<<<<<<<<<<< + * src_stride == itemsize == dst_stride): + * memcpy(dst_data, src_data, itemsize * dst_extent) +*/ + __pyx_t_2 = (__pyx_v_src_stride > 0); + if (__pyx_t_2) { + } else { + __pyx_t_1 = __pyx_t_2; + goto __pyx_L5_bool_binop_done; + } + __pyx_t_2 = (__pyx_v_dst_stride > 0); + if (__pyx_t_2) { + } else { + __pyx_t_1 = __pyx_t_2; + goto __pyx_L5_bool_binop_done; + } + + /* "View.MemoryView":1152 + * if ndim == 1: + * if (src_stride > 0 and dst_stride > 0 and + * src_stride == itemsize == dst_stride): # <<<<<<<<<<<<<< + * memcpy(dst_data, src_data, itemsize * dst_extent) + * else: +*/ + __pyx_t_2 = (((size_t)__pyx_v_src_stride) == __pyx_v_itemsize); + if (__pyx_t_2) { + __pyx_t_2 = (__pyx_v_itemsize == ((size_t)__pyx_v_dst_stride)); + } + __pyx_t_1 = __pyx_t_2; + __pyx_L5_bool_binop_done:; + + /* "View.MemoryView":1151 + * + * if ndim == 1: + * if (src_stride > 0 and dst_stride > 0 and # <<<<<<<<<<<<<< + * src_stride == itemsize == dst_stride): + * memcpy(dst_data, src_data, itemsize * dst_extent) +*/ + if (__pyx_t_1) { + + /* "View.MemoryView":1153 + * if (src_stride > 0 and dst_stride > 0 and + * src_stride == itemsize == dst_stride): + * memcpy(dst_data, src_data, itemsize * dst_extent) # <<<<<<<<<<<<<< + * else: + * for i in range(dst_extent): +*/ + (void)(memcpy(__pyx_v_dst_data, __pyx_v_src_data, (__pyx_v_itemsize * __pyx_v_dst_extent))); + + /* "View.MemoryView":1151 + * + * if ndim == 1: + * if (src_stride > 0 and dst_stride > 0 and # <<<<<<<<<<<<<< + * src_stride == itemsize == dst_stride): + * memcpy(dst_data, src_data, itemsize * dst_extent) +*/ + goto __pyx_L4; + } + + /* "View.MemoryView":1155 + * memcpy(dst_data, src_data, itemsize * dst_extent) + * else: + * for i in range(dst_extent): # <<<<<<<<<<<<<< + * memcpy(dst_data, src_data, itemsize) + * src_data += src_stride +*/ + /*else*/ { + __pyx_t_3 = __pyx_v_dst_extent; + __pyx_t_4 = __pyx_t_3; + for (__pyx_t_5 = 0; __pyx_t_5 < __pyx_t_4; __pyx_t_5+=1) { + __pyx_v_i = __pyx_t_5; + + /* "View.MemoryView":1156 + * else: + * for i in range(dst_extent): + * memcpy(dst_data, src_data, itemsize) # <<<<<<<<<<<<<< + * src_data += src_stride + * dst_data += dst_stride +*/ + (void)(memcpy(__pyx_v_dst_data, __pyx_v_src_data, __pyx_v_itemsize)); + + /* "View.MemoryView":1157 + * for i in range(dst_extent): + * memcpy(dst_data, src_data, itemsize) + * src_data += src_stride # <<<<<<<<<<<<<< + * dst_data += dst_stride + * else: +*/ + __pyx_v_src_data = (__pyx_v_src_data + __pyx_v_src_stride); + + /* "View.MemoryView":1158 + * memcpy(dst_data, src_data, itemsize) + * src_data += src_stride + * dst_data += dst_stride # <<<<<<<<<<<<<< + * else: + * for i in range(dst_extent): +*/ + __pyx_v_dst_data = (__pyx_v_dst_data + __pyx_v_dst_stride); + } + } + __pyx_L4:; + + /* "View.MemoryView":1150 + * cdef Py_ssize_t dst_stride = dst_strides[0] + * + * if ndim == 1: # <<<<<<<<<<<<<< + * if (src_stride > 0 and dst_stride > 0 and + * src_stride == itemsize == dst_stride): +*/ + goto __pyx_L3; + } + + /* "View.MemoryView":1160 + * dst_data += dst_stride + * else: + * for i in range(dst_extent): # <<<<<<<<<<<<<< + * _copy_strided_to_strided(src_data, src_strides + 1, + * dst_data, dst_strides + 1, +*/ + /*else*/ { + __pyx_t_3 = __pyx_v_dst_extent; + __pyx_t_4 = __pyx_t_3; + for (__pyx_t_5 = 0; __pyx_t_5 < __pyx_t_4; __pyx_t_5+=1) { + __pyx_v_i = __pyx_t_5; + + /* "View.MemoryView":1161 + * else: + * for i in range(dst_extent): + * _copy_strided_to_strided(src_data, src_strides + 1, # <<<<<<<<<<<<<< + * dst_data, dst_strides + 1, + * src_shape + 1, dst_shape + 1, +*/ + _copy_strided_to_strided(__pyx_v_src_data, (__pyx_v_src_strides + 1), __pyx_v_dst_data, (__pyx_v_dst_strides + 1), (__pyx_v_src_shape + 1), (__pyx_v_dst_shape + 1), (__pyx_v_ndim - 1), __pyx_v_itemsize); + + /* "View.MemoryView":1165 + * src_shape + 1, dst_shape + 1, + * ndim - 1, itemsize) + * src_data += src_stride # <<<<<<<<<<<<<< + * dst_data += dst_stride + * +*/ + __pyx_v_src_data = (__pyx_v_src_data + __pyx_v_src_stride); + + /* "View.MemoryView":1166 + * ndim - 1, itemsize) + * src_data += src_stride + * dst_data += dst_stride # <<<<<<<<<<<<<< + * + * cdef void copy_strided_to_strided(__Pyx_memviewslice *src, +*/ + __pyx_v_dst_data = (__pyx_v_dst_data + __pyx_v_dst_stride); + } + } + __pyx_L3:; + + /* "View.MemoryView":1137 + * return 'F' + * + * @cython.cdivision(True) # <<<<<<<<<<<<<< + * cdef void _copy_strided_to_strided(char *src_data, Py_ssize_t *src_strides, + * char *dst_data, Py_ssize_t *dst_strides, +*/ + + /* function exit code */ +} + +/* "View.MemoryView":1168 + * dst_data += dst_stride + * + * cdef void copy_strided_to_strided(__Pyx_memviewslice *src, # <<<<<<<<<<<<<< + * __Pyx_memviewslice *dst, + * int ndim, size_t itemsize) noexcept nogil: +*/ + +static void copy_strided_to_strided(__Pyx_memviewslice *__pyx_v_src, __Pyx_memviewslice *__pyx_v_dst, int __pyx_v_ndim, size_t __pyx_v_itemsize) { + + /* "View.MemoryView":1171 + * __Pyx_memviewslice *dst, + * int ndim, size_t itemsize) noexcept nogil: + * _copy_strided_to_strided(src.data, src.strides, dst.data, dst.strides, # <<<<<<<<<<<<<< + * src.shape, dst.shape, ndim, itemsize) + * +*/ + _copy_strided_to_strided(__pyx_v_src->data, __pyx_v_src->strides, __pyx_v_dst->data, __pyx_v_dst->strides, __pyx_v_src->shape, __pyx_v_dst->shape, __pyx_v_ndim, __pyx_v_itemsize); + + /* "View.MemoryView":1168 + * dst_data += dst_stride + * + * cdef void copy_strided_to_strided(__Pyx_memviewslice *src, # <<<<<<<<<<<<<< + * __Pyx_memviewslice *dst, + * int ndim, size_t itemsize) noexcept nogil: +*/ + + /* function exit code */ +} + +/* "View.MemoryView":1174 + * src.shape, dst.shape, ndim, itemsize) + * + * @cname('__pyx_memoryview_slice_get_size') # <<<<<<<<<<<<<< + * cdef Py_ssize_t slice_get_size(__Pyx_memviewslice *src, int ndim) noexcept nogil: + * "Return the size of the memory occupied by the slice in number of bytes" +*/ + +static Py_ssize_t __pyx_memoryview_slice_get_size(__Pyx_memviewslice *__pyx_v_src, int __pyx_v_ndim) { + Py_ssize_t __pyx_v_shape; + Py_ssize_t __pyx_v_size; + Py_ssize_t __pyx_r; + Py_ssize_t __pyx_t_1; + Py_ssize_t *__pyx_t_2; + Py_ssize_t *__pyx_t_3; + Py_ssize_t *__pyx_t_4; + + /* "View.MemoryView":1177 + * cdef Py_ssize_t slice_get_size(__Pyx_memviewslice *src, int ndim) noexcept nogil: + * "Return the size of the memory occupied by the slice in number of bytes" + * cdef Py_ssize_t shape, size = src.memview.view.itemsize # <<<<<<<<<<<<<< + * + * for shape in src.shape[:ndim]: +*/ + __pyx_t_1 = __pyx_v_src->memview->view.itemsize; + __pyx_v_size = __pyx_t_1; + + /* "View.MemoryView":1179 + * cdef Py_ssize_t shape, size = src.memview.view.itemsize + * + * for shape in src.shape[:ndim]: # <<<<<<<<<<<<<< + * size *= shape + * +*/ + __pyx_t_3 = (__pyx_v_src->shape + __pyx_v_ndim); + for (__pyx_t_4 = __pyx_v_src->shape; __pyx_t_4 < __pyx_t_3; __pyx_t_4++) { + __pyx_t_2 = __pyx_t_4; + __pyx_v_shape = (__pyx_t_2[0]); + + /* "View.MemoryView":1180 + * + * for shape in src.shape[:ndim]: + * size *= shape # <<<<<<<<<<<<<< + * + * return size +*/ + __pyx_v_size = (__pyx_v_size * __pyx_v_shape); + } + + /* "View.MemoryView":1182 + * size *= shape + * + * return size # <<<<<<<<<<<<<< + * + * @cname('__pyx_fill_contig_strides_array') +*/ + __pyx_r = __pyx_v_size; + goto __pyx_L0; + + /* "View.MemoryView":1174 + * src.shape, dst.shape, ndim, itemsize) + * + * @cname('__pyx_memoryview_slice_get_size') # <<<<<<<<<<<<<< + * cdef Py_ssize_t slice_get_size(__Pyx_memviewslice *src, int ndim) noexcept nogil: + * "Return the size of the memory occupied by the slice in number of bytes" +*/ + + /* function exit code */ + __pyx_L0:; + return __pyx_r; +} + +/* "View.MemoryView":1184 + * return size + * + * @cname('__pyx_fill_contig_strides_array') # <<<<<<<<<<<<<< + * cdef Py_ssize_t fill_contig_strides_array( + * Py_ssize_t *shape, Py_ssize_t *strides, Py_ssize_t stride, +*/ + +static Py_ssize_t __pyx_fill_contig_strides_array(Py_ssize_t *__pyx_v_shape, Py_ssize_t *__pyx_v_strides, Py_ssize_t __pyx_v_stride, int __pyx_v_ndim, char __pyx_v_order) { + int __pyx_v_idx; + Py_ssize_t __pyx_r; + int __pyx_t_1; + int __pyx_t_2; + int __pyx_t_3; + int __pyx_t_4; + + /* "View.MemoryView":1194 + * cdef int idx + * + * if order == 'F': # <<<<<<<<<<<<<< + * for idx in range(ndim): + * strides[idx] = stride +*/ + __pyx_t_1 = (__pyx_v_order == 'F'); + if (__pyx_t_1) { + + /* "View.MemoryView":1195 + * + * if order == 'F': + * for idx in range(ndim): # <<<<<<<<<<<<<< + * strides[idx] = stride + * stride *= shape[idx] +*/ + __pyx_t_2 = __pyx_v_ndim; + __pyx_t_3 = __pyx_t_2; + for (__pyx_t_4 = 0; __pyx_t_4 < __pyx_t_3; __pyx_t_4+=1) { + __pyx_v_idx = __pyx_t_4; + + /* "View.MemoryView":1196 + * if order == 'F': + * for idx in range(ndim): + * strides[idx] = stride # <<<<<<<<<<<<<< + * stride *= shape[idx] + * else: +*/ + (__pyx_v_strides[__pyx_v_idx]) = __pyx_v_stride; + + /* "View.MemoryView":1197 + * for idx in range(ndim): + * strides[idx] = stride + * stride *= shape[idx] # <<<<<<<<<<<<<< + * else: + * for idx in range(ndim - 1, -1, -1): +*/ + __pyx_v_stride = (__pyx_v_stride * (__pyx_v_shape[__pyx_v_idx])); + } + + /* "View.MemoryView":1194 + * cdef int idx + * + * if order == 'F': # <<<<<<<<<<<<<< + * for idx in range(ndim): + * strides[idx] = stride +*/ + goto __pyx_L3; + } + + /* "View.MemoryView":1199 + * stride *= shape[idx] + * else: + * for idx in range(ndim - 1, -1, -1): # <<<<<<<<<<<<<< + * strides[idx] = stride + * stride *= shape[idx] +*/ + /*else*/ { + for (__pyx_t_2 = (__pyx_v_ndim - 1); __pyx_t_2 > -1; __pyx_t_2-=1) { + __pyx_v_idx = __pyx_t_2; + + /* "View.MemoryView":1200 + * else: + * for idx in range(ndim - 1, -1, -1): + * strides[idx] = stride # <<<<<<<<<<<<<< + * stride *= shape[idx] + * +*/ + (__pyx_v_strides[__pyx_v_idx]) = __pyx_v_stride; + + /* "View.MemoryView":1201 + * for idx in range(ndim - 1, -1, -1): + * strides[idx] = stride + * stride *= shape[idx] # <<<<<<<<<<<<<< + * + * return stride +*/ + __pyx_v_stride = (__pyx_v_stride * (__pyx_v_shape[__pyx_v_idx])); + } + } + __pyx_L3:; + + /* "View.MemoryView":1203 + * stride *= shape[idx] + * + * return stride # <<<<<<<<<<<<<< + * + * @cname('__pyx_memoryview_copy_data_to_temp') +*/ + __pyx_r = __pyx_v_stride; + goto __pyx_L0; + + /* "View.MemoryView":1184 + * return size + * + * @cname('__pyx_fill_contig_strides_array') # <<<<<<<<<<<<<< + * cdef Py_ssize_t fill_contig_strides_array( + * Py_ssize_t *shape, Py_ssize_t *strides, Py_ssize_t stride, +*/ + + /* function exit code */ + __pyx_L0:; + return __pyx_r; +} + +/* "View.MemoryView":1205 + * return stride + * + * @cname('__pyx_memoryview_copy_data_to_temp') # <<<<<<<<<<<<<< + * cdef void *copy_data_to_temp(__Pyx_memviewslice *src, + * __Pyx_memviewslice *tmpslice, +*/ + +static void *__pyx_memoryview_copy_data_to_temp(__Pyx_memviewslice *__pyx_v_src, __Pyx_memviewslice *__pyx_v_tmpslice, char __pyx_v_order, int __pyx_v_ndim) { + int __pyx_v_i; + void *__pyx_v_result; + size_t __pyx_v_itemsize; + size_t __pyx_v_size; + void *__pyx_r; + Py_ssize_t __pyx_t_1; + int __pyx_t_2; + int __pyx_t_3; + struct __pyx_memoryview_obj *__pyx_t_4; + int __pyx_t_5; + int __pyx_t_6; + int __pyx_lineno = 0; + const char *__pyx_filename = NULL; + int __pyx_clineno = 0; + PyGILState_STATE __pyx_gilstate_save; + + /* "View.MemoryView":1217 + * cdef void *result + * + * cdef size_t itemsize = src.memview.view.itemsize # <<<<<<<<<<<<<< + * cdef size_t size = slice_get_size(src, ndim) + * +*/ + __pyx_t_1 = __pyx_v_src->memview->view.itemsize; + __pyx_v_itemsize = __pyx_t_1; + + /* "View.MemoryView":1218 + * + * cdef size_t itemsize = src.memview.view.itemsize + * cdef size_t size = slice_get_size(src, ndim) # <<<<<<<<<<<<<< + * + * result = malloc(size) +*/ + __pyx_v_size = __pyx_memoryview_slice_get_size(__pyx_v_src, __pyx_v_ndim); + + /* "View.MemoryView":1220 + * cdef size_t size = slice_get_size(src, ndim) + * + * result = malloc(size) # <<<<<<<<<<<<<< + * if not result: + * _err_no_memory() +*/ + __pyx_v_result = malloc(__pyx_v_size); + + /* "View.MemoryView":1221 + * + * result = malloc(size) + * if not result: # <<<<<<<<<<<<<< + * _err_no_memory() + * +*/ + __pyx_t_2 = (!(__pyx_v_result != 0)); + if (__pyx_t_2) { + + /* "View.MemoryView":1222 + * result = malloc(size) + * if not result: + * _err_no_memory() # <<<<<<<<<<<<<< + * + * +*/ + __pyx_t_3 = __pyx_memoryview_err_no_memory(); if (unlikely(__pyx_t_3 == ((int)-1))) __PYX_ERR(1, 1222, __pyx_L1_error) + + /* "View.MemoryView":1221 + * + * result = malloc(size) + * if not result: # <<<<<<<<<<<<<< + * _err_no_memory() + * +*/ + } + + /* "View.MemoryView":1225 + * + * + * tmpslice.data = result # <<<<<<<<<<<<<< + * tmpslice.memview = src.memview + * for i in range(ndim): +*/ + __pyx_v_tmpslice->data = ((char *)__pyx_v_result); + + /* "View.MemoryView":1226 + * + * tmpslice.data = result + * tmpslice.memview = src.memview # <<<<<<<<<<<<<< + * for i in range(ndim): + * tmpslice.shape[i] = src.shape[i] +*/ + __pyx_t_4 = __pyx_v_src->memview; + __pyx_v_tmpslice->memview = __pyx_t_4; + + /* "View.MemoryView":1227 + * tmpslice.data = result + * tmpslice.memview = src.memview + * for i in range(ndim): # <<<<<<<<<<<<<< + * tmpslice.shape[i] = src.shape[i] + * tmpslice.suboffsets[i] = -1 +*/ + __pyx_t_3 = __pyx_v_ndim; + __pyx_t_5 = __pyx_t_3; + for (__pyx_t_6 = 0; __pyx_t_6 < __pyx_t_5; __pyx_t_6+=1) { + __pyx_v_i = __pyx_t_6; + + /* "View.MemoryView":1228 + * tmpslice.memview = src.memview + * for i in range(ndim): + * tmpslice.shape[i] = src.shape[i] # <<<<<<<<<<<<<< + * tmpslice.suboffsets[i] = -1 + * +*/ + (__pyx_v_tmpslice->shape[__pyx_v_i]) = (__pyx_v_src->shape[__pyx_v_i]); + + /* "View.MemoryView":1229 + * for i in range(ndim): + * tmpslice.shape[i] = src.shape[i] + * tmpslice.suboffsets[i] = -1 # <<<<<<<<<<<<<< + * + * fill_contig_strides_array(&tmpslice.shape[0], &tmpslice.strides[0], itemsize, ndim, order) +*/ + (__pyx_v_tmpslice->suboffsets[__pyx_v_i]) = -1L; + } + + /* "View.MemoryView":1231 + * tmpslice.suboffsets[i] = -1 + * + * fill_contig_strides_array(&tmpslice.shape[0], &tmpslice.strides[0], itemsize, ndim, order) # <<<<<<<<<<<<<< + * + * +*/ + (void)(__pyx_fill_contig_strides_array((&(__pyx_v_tmpslice->shape[0])), (&(__pyx_v_tmpslice->strides[0])), __pyx_v_itemsize, __pyx_v_ndim, __pyx_v_order)); + + /* "View.MemoryView":1234 + * + * + * for i in range(ndim): # <<<<<<<<<<<<<< + * if tmpslice.shape[i] == 1: + * tmpslice.strides[i] = 0 +*/ + __pyx_t_3 = __pyx_v_ndim; + __pyx_t_5 = __pyx_t_3; + for (__pyx_t_6 = 0; __pyx_t_6 < __pyx_t_5; __pyx_t_6+=1) { + __pyx_v_i = __pyx_t_6; + + /* "View.MemoryView":1235 + * + * for i in range(ndim): + * if tmpslice.shape[i] == 1: # <<<<<<<<<<<<<< + * tmpslice.strides[i] = 0 + * +*/ + __pyx_t_2 = ((__pyx_v_tmpslice->shape[__pyx_v_i]) == 1); + if (__pyx_t_2) { + + /* "View.MemoryView":1236 + * for i in range(ndim): + * if tmpslice.shape[i] == 1: + * tmpslice.strides[i] = 0 # <<<<<<<<<<<<<< + * + * if slice_is_contig(src[0], order, ndim): +*/ + (__pyx_v_tmpslice->strides[__pyx_v_i]) = 0; + + /* "View.MemoryView":1235 + * + * for i in range(ndim): + * if tmpslice.shape[i] == 1: # <<<<<<<<<<<<<< + * tmpslice.strides[i] = 0 + * +*/ + } + } + + /* "View.MemoryView":1238 + * tmpslice.strides[i] = 0 + * + * if slice_is_contig(src[0], order, ndim): # <<<<<<<<<<<<<< + * memcpy(result, src.data, size) + * else: +*/ + __pyx_t_2 = __pyx_memviewslice_is_contig((__pyx_v_src[0]), __pyx_v_order, __pyx_v_ndim); + if (__pyx_t_2) { + + /* "View.MemoryView":1239 + * + * if slice_is_contig(src[0], order, ndim): + * memcpy(result, src.data, size) # <<<<<<<<<<<<<< + * else: + * copy_strided_to_strided(src, tmpslice, ndim, itemsize) +*/ + (void)(memcpy(__pyx_v_result, __pyx_v_src->data, __pyx_v_size)); + + /* "View.MemoryView":1238 + * tmpslice.strides[i] = 0 + * + * if slice_is_contig(src[0], order, ndim): # <<<<<<<<<<<<<< + * memcpy(result, src.data, size) + * else: +*/ + goto __pyx_L9; + } + + /* "View.MemoryView":1241 + * memcpy(result, src.data, size) + * else: + * copy_strided_to_strided(src, tmpslice, ndim, itemsize) # <<<<<<<<<<<<<< + * + * return result +*/ + /*else*/ { + copy_strided_to_strided(__pyx_v_src, __pyx_v_tmpslice, __pyx_v_ndim, __pyx_v_itemsize); + } + __pyx_L9:; + + /* "View.MemoryView":1243 + * copy_strided_to_strided(src, tmpslice, ndim, itemsize) + * + * return result # <<<<<<<<<<<<<< + * + * +*/ + __pyx_r = __pyx_v_result; + goto __pyx_L0; + + /* "View.MemoryView":1205 + * return stride + * + * @cname('__pyx_memoryview_copy_data_to_temp') # <<<<<<<<<<<<<< + * cdef void *copy_data_to_temp(__Pyx_memviewslice *src, + * __Pyx_memviewslice *tmpslice, +*/ + + /* function exit code */ + __pyx_L1_error:; + __pyx_gilstate_save = __Pyx_PyGILState_Ensure(); + __Pyx_AddTraceback("View.MemoryView.copy_data_to_temp", __pyx_clineno, __pyx_lineno, __pyx_filename); + __pyx_r = NULL; + __Pyx_PyGILState_Release(__pyx_gilstate_save); + __pyx_L0:; + return __pyx_r; +} + +/* "View.MemoryView":1247 + * + * + * @cname('__pyx_memoryview_err_extents') # <<<<<<<<<<<<<< + * cdef int _err_extents(int i, Py_ssize_t extent1, + * Py_ssize_t extent2) except -1 with gil: +*/ + +static int __pyx_memoryview_err_extents(int __pyx_v_i, Py_ssize_t __pyx_v_extent1, Py_ssize_t __pyx_v_extent2) { + int __pyx_r; + __Pyx_RefNannyDeclarations + PyObject *__pyx_t_1 = NULL; + PyObject *__pyx_t_2 = NULL; + PyObject *__pyx_t_3 = NULL; + PyObject *__pyx_t_4[7]; + PyObject *__pyx_t_5 = NULL; + int __pyx_lineno = 0; + const char *__pyx_filename = NULL; + int __pyx_clineno = 0; + PyGILState_STATE __pyx_gilstate_save = __Pyx_PyGILState_Ensure(); + __Pyx_RefNannySetupContext("_err_extents", 0); + + /* "View.MemoryView":1250 + * cdef int _err_extents(int i, Py_ssize_t extent1, + * Py_ssize_t extent2) except -1 with gil: + * raise ValueError, f"got differing extents in dimension {i} (got {extent1} and {extent2})" # <<<<<<<<<<<<<< + * + * @cname('__pyx_memoryview_err_dim') +*/ + __pyx_t_1 = __Pyx_PyUnicode_From_int(__pyx_v_i, 0, ' ', 'd'); if (unlikely(!__pyx_t_1)) __PYX_ERR(1, 1250, __pyx_L1_error) + __Pyx_GOTREF(__pyx_t_1); + __pyx_t_2 = __Pyx_PyUnicode_From_Py_ssize_t(__pyx_v_extent1, 0, ' ', 'd'); if (unlikely(!__pyx_t_2)) __PYX_ERR(1, 1250, __pyx_L1_error) + __Pyx_GOTREF(__pyx_t_2); + __pyx_t_3 = __Pyx_PyUnicode_From_Py_ssize_t(__pyx_v_extent2, 0, ' ', 'd'); if (unlikely(!__pyx_t_3)) __PYX_ERR(1, 1250, __pyx_L1_error) + __Pyx_GOTREF(__pyx_t_3); + __pyx_t_4[0] = __pyx_mstate_global->__pyx_kp_u_got_differing_extents_in_dimensi; + __pyx_t_4[1] = __pyx_t_1; + __pyx_t_4[2] = __pyx_mstate_global->__pyx_kp_u_got; + __pyx_t_4[3] = __pyx_t_2; + __pyx_t_4[4] = __pyx_mstate_global->__pyx_kp_u_and; + __pyx_t_4[5] = __pyx_t_3; + __pyx_t_4[6] = __pyx_mstate_global->__pyx_kp_u__5; + __pyx_t_5 = __Pyx_PyUnicode_Join(__pyx_t_4, 7, 35 + __Pyx_PyUnicode_GET_LENGTH(__pyx_t_1) + 6 + __Pyx_PyUnicode_GET_LENGTH(__pyx_t_2) + 5 + __Pyx_PyUnicode_GET_LENGTH(__pyx_t_3) + 1, 127); + if (unlikely(!__pyx_t_5)) __PYX_ERR(1, 1250, __pyx_L1_error) + __Pyx_GOTREF(__pyx_t_5); + __Pyx_DECREF(__pyx_t_1); __pyx_t_1 = 0; + __Pyx_DECREF(__pyx_t_2); __pyx_t_2 = 0; + __Pyx_DECREF(__pyx_t_3); __pyx_t_3 = 0; + __Pyx_Raise(((PyObject *)(((PyTypeObject*)PyExc_ValueError))), __pyx_t_5, 0, 0); + __Pyx_DECREF(__pyx_t_5); __pyx_t_5 = 0; + __PYX_ERR(1, 1250, __pyx_L1_error) + + /* "View.MemoryView":1247 + * + * + * @cname('__pyx_memoryview_err_extents') # <<<<<<<<<<<<<< + * cdef int _err_extents(int i, Py_ssize_t extent1, + * Py_ssize_t extent2) except -1 with gil: +*/ + + /* function exit code */ + __pyx_L1_error:; + __Pyx_XDECREF(__pyx_t_1); + __Pyx_XDECREF(__pyx_t_2); + __Pyx_XDECREF(__pyx_t_3); + __Pyx_XDECREF(__pyx_t_5); + __Pyx_AddTraceback("View.MemoryView._err_extents", __pyx_clineno, __pyx_lineno, __pyx_filename); + __pyx_r = -1; + __Pyx_RefNannyFinishContext(); + __Pyx_PyGILState_Release(__pyx_gilstate_save); + return __pyx_r; +} + +/* "View.MemoryView":1252 + * raise ValueError, f"got differing extents in dimension {i} (got {extent1} and {extent2})" + * + * @cname('__pyx_memoryview_err_dim') # <<<<<<<<<<<<<< + * cdef int _err_dim(PyObject *error, str msg, int dim) except -1 with gil: + * raise error, msg % dim +*/ + +static int __pyx_memoryview_err_dim(PyObject *__pyx_v_error, PyObject *__pyx_v_msg, int __pyx_v_dim) { + int __pyx_r; + __Pyx_RefNannyDeclarations + PyObject *__pyx_t_1 = NULL; + PyObject *__pyx_t_2 = NULL; + int __pyx_lineno = 0; + const char *__pyx_filename = NULL; + int __pyx_clineno = 0; + PyGILState_STATE __pyx_gilstate_save = __Pyx_PyGILState_Ensure(); + __Pyx_RefNannySetupContext("_err_dim", 0); + __Pyx_INCREF(__pyx_v_msg); + + /* "View.MemoryView":1254 + * @cname('__pyx_memoryview_err_dim') + * cdef int _err_dim(PyObject *error, str msg, int dim) except -1 with gil: + * raise error, msg % dim # <<<<<<<<<<<<<< + * + * @cname('__pyx_memoryview_err') +*/ + __pyx_t_1 = __Pyx_PyLong_From_int(__pyx_v_dim); if (unlikely(!__pyx_t_1)) __PYX_ERR(1, 1254, __pyx_L1_error) + __Pyx_GOTREF(__pyx_t_1); + __pyx_t_2 = __Pyx_PyUnicode_FormatSafe(__pyx_v_msg, __pyx_t_1); if (unlikely(!__pyx_t_2)) __PYX_ERR(1, 1254, __pyx_L1_error) + __Pyx_GOTREF(__pyx_t_2); + __Pyx_DECREF(__pyx_t_1); __pyx_t_1 = 0; + __Pyx_Raise(((PyObject *)__pyx_v_error), __pyx_t_2, 0, 0); + __Pyx_DECREF(__pyx_t_2); __pyx_t_2 = 0; + __PYX_ERR(1, 1254, __pyx_L1_error) + + /* "View.MemoryView":1252 + * raise ValueError, f"got differing extents in dimension {i} (got {extent1} and {extent2})" + * + * @cname('__pyx_memoryview_err_dim') # <<<<<<<<<<<<<< + * cdef int _err_dim(PyObject *error, str msg, int dim) except -1 with gil: + * raise error, msg % dim +*/ + + /* function exit code */ + __pyx_L1_error:; + __Pyx_XDECREF(__pyx_t_1); + __Pyx_XDECREF(__pyx_t_2); + __Pyx_AddTraceback("View.MemoryView._err_dim", __pyx_clineno, __pyx_lineno, __pyx_filename); + __pyx_r = -1; + __Pyx_XDECREF(__pyx_v_msg); + __Pyx_RefNannyFinishContext(); + __Pyx_PyGILState_Release(__pyx_gilstate_save); + return __pyx_r; +} + +/* "View.MemoryView":1256 + * raise error, msg % dim + * + * @cname('__pyx_memoryview_err') # <<<<<<<<<<<<<< + * cdef int _err(PyObject *error, str msg) except -1 with gil: + * raise error, msg +*/ + +static int __pyx_memoryview_err(PyObject *__pyx_v_error, PyObject *__pyx_v_msg) { + int __pyx_r; + __Pyx_RefNannyDeclarations + int __pyx_lineno = 0; + const char *__pyx_filename = NULL; + int __pyx_clineno = 0; + PyGILState_STATE __pyx_gilstate_save = __Pyx_PyGILState_Ensure(); + __Pyx_RefNannySetupContext("_err", 0); + __Pyx_INCREF(__pyx_v_msg); + + /* "View.MemoryView":1258 + * @cname('__pyx_memoryview_err') + * cdef int _err(PyObject *error, str msg) except -1 with gil: + * raise error, msg # <<<<<<<<<<<<<< + * + * @cname('__pyx_memoryview_err_no_memory') +*/ + __Pyx_Raise(((PyObject *)__pyx_v_error), __pyx_v_msg, 0, 0); + __PYX_ERR(1, 1258, __pyx_L1_error) + + /* "View.MemoryView":1256 + * raise error, msg % dim + * + * @cname('__pyx_memoryview_err') # <<<<<<<<<<<<<< + * cdef int _err(PyObject *error, str msg) except -1 with gil: + * raise error, msg +*/ + + /* function exit code */ + __pyx_L1_error:; + __Pyx_AddTraceback("View.MemoryView._err", __pyx_clineno, __pyx_lineno, __pyx_filename); + __pyx_r = -1; + __Pyx_XDECREF(__pyx_v_msg); + __Pyx_RefNannyFinishContext(); + __Pyx_PyGILState_Release(__pyx_gilstate_save); + return __pyx_r; +} + +/* "View.MemoryView":1260 + * raise error, msg + * + * @cname('__pyx_memoryview_err_no_memory') # <<<<<<<<<<<<<< + * cdef int _err_no_memory() except -1 with gil: + * raise MemoryError +*/ + +static int __pyx_memoryview_err_no_memory(void) { + int __pyx_r; + int __pyx_lineno = 0; + const char *__pyx_filename = NULL; + int __pyx_clineno = 0; + PyGILState_STATE __pyx_gilstate_save = __Pyx_PyGILState_Ensure(); + + /* "View.MemoryView":1262 + * @cname('__pyx_memoryview_err_no_memory') + * cdef int _err_no_memory() except -1 with gil: + * raise MemoryError # <<<<<<<<<<<<<< + * + * +*/ + PyErr_NoMemory(); __PYX_ERR(1, 1262, __pyx_L1_error) + + /* "View.MemoryView":1260 + * raise error, msg + * + * @cname('__pyx_memoryview_err_no_memory') # <<<<<<<<<<<<<< + * cdef int _err_no_memory() except -1 with gil: + * raise MemoryError +*/ + + /* function exit code */ + __pyx_L1_error:; + __Pyx_AddTraceback("View.MemoryView._err_no_memory", __pyx_clineno, __pyx_lineno, __pyx_filename); + __pyx_r = -1; + __Pyx_PyGILState_Release(__pyx_gilstate_save); + return __pyx_r; +} + +/* "View.MemoryView":1265 + * + * + * @cname('__pyx_memoryview_copy_contents') # <<<<<<<<<<<<<< + * cdef int memoryview_copy_contents(__Pyx_memviewslice src, + * __Pyx_memviewslice dst, +*/ + +static int __pyx_memoryview_copy_contents(__Pyx_memviewslice __pyx_v_src, __Pyx_memviewslice __pyx_v_dst, int __pyx_v_src_ndim, int __pyx_v_dst_ndim, int __pyx_v_dtype_is_object) { + void *__pyx_v_tmpdata; + size_t __pyx_v_itemsize; + int __pyx_v_i; + char __pyx_v_order; + int __pyx_v_broadcasting; + int __pyx_v_direct_copy; + __Pyx_memviewslice __pyx_v_tmp; + int __pyx_v_ndim; + int __pyx_r; + Py_ssize_t __pyx_t_1; + int __pyx_t_2; + int __pyx_t_3; + int __pyx_t_4; + int __pyx_t_5; + int __pyx_t_6; + void *__pyx_t_7; + int __pyx_lineno = 0; + const char *__pyx_filename = NULL; + int __pyx_clineno = 0; + PyGILState_STATE __pyx_gilstate_save; + + /* "View.MemoryView":1274 + * Check for overlapping memory and verify the shapes. + * """ + * cdef void *tmpdata = NULL # <<<<<<<<<<<<<< + * cdef size_t itemsize = src.memview.view.itemsize + * cdef int i +*/ + __pyx_v_tmpdata = NULL; + + /* "View.MemoryView":1275 + * """ + * cdef void *tmpdata = NULL + * cdef size_t itemsize = src.memview.view.itemsize # <<<<<<<<<<<<<< + * cdef int i + * cdef char order = get_best_order(&src, src_ndim) +*/ + __pyx_t_1 = __pyx_v_src.memview->view.itemsize; + __pyx_v_itemsize = __pyx_t_1; + + /* "View.MemoryView":1277 + * cdef size_t itemsize = src.memview.view.itemsize + * cdef int i + * cdef char order = get_best_order(&src, src_ndim) # <<<<<<<<<<<<<< + * cdef bint broadcasting = False + * cdef bint direct_copy = False +*/ + __pyx_v_order = __pyx_get_best_slice_order((&__pyx_v_src), __pyx_v_src_ndim); + + /* "View.MemoryView":1278 + * cdef int i + * cdef char order = get_best_order(&src, src_ndim) + * cdef bint broadcasting = False # <<<<<<<<<<<<<< + * cdef bint direct_copy = False + * cdef __Pyx_memviewslice tmp +*/ + __pyx_v_broadcasting = 0; + + /* "View.MemoryView":1279 + * cdef char order = get_best_order(&src, src_ndim) + * cdef bint broadcasting = False + * cdef bint direct_copy = False # <<<<<<<<<<<<<< + * cdef __Pyx_memviewslice tmp + * +*/ + __pyx_v_direct_copy = 0; + + /* "View.MemoryView":1282 + * cdef __Pyx_memviewslice tmp + * + * if src_ndim < dst_ndim: # <<<<<<<<<<<<<< + * broadcast_leading(&src, src_ndim, dst_ndim) + * elif dst_ndim < src_ndim: +*/ + __pyx_t_2 = (__pyx_v_src_ndim < __pyx_v_dst_ndim); + if (__pyx_t_2) { + + /* "View.MemoryView":1283 + * + * if src_ndim < dst_ndim: + * broadcast_leading(&src, src_ndim, dst_ndim) # <<<<<<<<<<<<<< + * elif dst_ndim < src_ndim: + * broadcast_leading(&dst, dst_ndim, src_ndim) +*/ + __pyx_memoryview_broadcast_leading((&__pyx_v_src), __pyx_v_src_ndim, __pyx_v_dst_ndim); + + /* "View.MemoryView":1282 + * cdef __Pyx_memviewslice tmp + * + * if src_ndim < dst_ndim: # <<<<<<<<<<<<<< + * broadcast_leading(&src, src_ndim, dst_ndim) + * elif dst_ndim < src_ndim: +*/ + goto __pyx_L3; + } + + /* "View.MemoryView":1284 + * if src_ndim < dst_ndim: + * broadcast_leading(&src, src_ndim, dst_ndim) + * elif dst_ndim < src_ndim: # <<<<<<<<<<<<<< + * broadcast_leading(&dst, dst_ndim, src_ndim) + * +*/ + __pyx_t_2 = (__pyx_v_dst_ndim < __pyx_v_src_ndim); + if (__pyx_t_2) { + + /* "View.MemoryView":1285 + * broadcast_leading(&src, src_ndim, dst_ndim) + * elif dst_ndim < src_ndim: + * broadcast_leading(&dst, dst_ndim, src_ndim) # <<<<<<<<<<<<<< + * + * cdef int ndim = max(src_ndim, dst_ndim) +*/ + __pyx_memoryview_broadcast_leading((&__pyx_v_dst), __pyx_v_dst_ndim, __pyx_v_src_ndim); + + /* "View.MemoryView":1284 + * if src_ndim < dst_ndim: + * broadcast_leading(&src, src_ndim, dst_ndim) + * elif dst_ndim < src_ndim: # <<<<<<<<<<<<<< + * broadcast_leading(&dst, dst_ndim, src_ndim) + * +*/ + } + __pyx_L3:; + + /* "View.MemoryView":1287 + * broadcast_leading(&dst, dst_ndim, src_ndim) + * + * cdef int ndim = max(src_ndim, dst_ndim) # <<<<<<<<<<<<<< + * + * for i in range(ndim): +*/ + __pyx_t_3 = __pyx_v_dst_ndim; + __pyx_t_4 = __pyx_v_src_ndim; + __pyx_t_2 = (__pyx_t_3 > __pyx_t_4); + if (__pyx_t_2) { + __pyx_t_5 = __pyx_t_3; + } else { + __pyx_t_5 = __pyx_t_4; + } + __pyx_v_ndim = __pyx_t_5; + + /* "View.MemoryView":1289 + * cdef int ndim = max(src_ndim, dst_ndim) + * + * for i in range(ndim): # <<<<<<<<<<<<<< + * if src.shape[i] != dst.shape[i]: + * if src.shape[i] == 1: +*/ + __pyx_t_5 = __pyx_v_ndim; + __pyx_t_3 = __pyx_t_5; + for (__pyx_t_4 = 0; __pyx_t_4 < __pyx_t_3; __pyx_t_4+=1) { + __pyx_v_i = __pyx_t_4; + + /* "View.MemoryView":1290 + * + * for i in range(ndim): + * if src.shape[i] != dst.shape[i]: # <<<<<<<<<<<<<< + * if src.shape[i] == 1: + * broadcasting = True +*/ + __pyx_t_2 = ((__pyx_v_src.shape[__pyx_v_i]) != (__pyx_v_dst.shape[__pyx_v_i])); + if (__pyx_t_2) { + + /* "View.MemoryView":1291 + * for i in range(ndim): + * if src.shape[i] != dst.shape[i]: + * if src.shape[i] == 1: # <<<<<<<<<<<<<< + * broadcasting = True + * src.strides[i] = 0 +*/ + __pyx_t_2 = ((__pyx_v_src.shape[__pyx_v_i]) == 1); + if (__pyx_t_2) { + + /* "View.MemoryView":1292 + * if src.shape[i] != dst.shape[i]: + * if src.shape[i] == 1: + * broadcasting = True # <<<<<<<<<<<<<< + * src.strides[i] = 0 + * else: +*/ + __pyx_v_broadcasting = 1; + + /* "View.MemoryView":1293 + * if src.shape[i] == 1: + * broadcasting = True + * src.strides[i] = 0 # <<<<<<<<<<<<<< + * else: + * _err_extents(i, dst.shape[i], src.shape[i]) +*/ + (__pyx_v_src.strides[__pyx_v_i]) = 0; + + /* "View.MemoryView":1291 + * for i in range(ndim): + * if src.shape[i] != dst.shape[i]: + * if src.shape[i] == 1: # <<<<<<<<<<<<<< + * broadcasting = True + * src.strides[i] = 0 +*/ + goto __pyx_L7; + } + + /* "View.MemoryView":1295 + * src.strides[i] = 0 + * else: + * _err_extents(i, dst.shape[i], src.shape[i]) # <<<<<<<<<<<<<< + * + * if src.suboffsets[i] >= 0: +*/ + /*else*/ { + __pyx_t_6 = __pyx_memoryview_err_extents(__pyx_v_i, (__pyx_v_dst.shape[__pyx_v_i]), (__pyx_v_src.shape[__pyx_v_i])); if (unlikely(__pyx_t_6 == ((int)-1))) __PYX_ERR(1, 1295, __pyx_L1_error) + } + __pyx_L7:; + + /* "View.MemoryView":1290 + * + * for i in range(ndim): + * if src.shape[i] != dst.shape[i]: # <<<<<<<<<<<<<< + * if src.shape[i] == 1: + * broadcasting = True +*/ + } + + /* "View.MemoryView":1297 + * _err_extents(i, dst.shape[i], src.shape[i]) + * + * if src.suboffsets[i] >= 0: # <<<<<<<<<<<<<< + * _err_dim(PyExc_ValueError, "Dimension %d is not direct", i) + * +*/ + __pyx_t_2 = ((__pyx_v_src.suboffsets[__pyx_v_i]) >= 0); + if (__pyx_t_2) { + + /* "View.MemoryView":1298 + * + * if src.suboffsets[i] >= 0: + * _err_dim(PyExc_ValueError, "Dimension %d is not direct", i) # <<<<<<<<<<<<<< + * + * if slices_overlap(&src, &dst, ndim, itemsize): +*/ + __pyx_t_6 = __pyx_memoryview_err_dim(PyExc_ValueError, __pyx_mstate_global->__pyx_kp_u_Dimension_d_is_not_direct, __pyx_v_i); if (unlikely(__pyx_t_6 == ((int)-1))) __PYX_ERR(1, 1298, __pyx_L1_error) + + /* "View.MemoryView":1297 + * _err_extents(i, dst.shape[i], src.shape[i]) + * + * if src.suboffsets[i] >= 0: # <<<<<<<<<<<<<< + * _err_dim(PyExc_ValueError, "Dimension %d is not direct", i) + * +*/ + } + } + + /* "View.MemoryView":1300 + * _err_dim(PyExc_ValueError, "Dimension %d is not direct", i) + * + * if slices_overlap(&src, &dst, ndim, itemsize): # <<<<<<<<<<<<<< + * + * if not slice_is_contig(src, order, ndim): +*/ + __pyx_t_2 = __pyx_slices_overlap((&__pyx_v_src), (&__pyx_v_dst), __pyx_v_ndim, __pyx_v_itemsize); + if (__pyx_t_2) { + + /* "View.MemoryView":1302 + * if slices_overlap(&src, &dst, ndim, itemsize): + * + * if not slice_is_contig(src, order, ndim): # <<<<<<<<<<<<<< + * order = get_best_order(&dst, ndim) + * +*/ + __pyx_t_2 = (!__pyx_memviewslice_is_contig(__pyx_v_src, __pyx_v_order, __pyx_v_ndim)); + if (__pyx_t_2) { + + /* "View.MemoryView":1303 + * + * if not slice_is_contig(src, order, ndim): + * order = get_best_order(&dst, ndim) # <<<<<<<<<<<<<< + * + * tmpdata = copy_data_to_temp(&src, &tmp, order, ndim) +*/ + __pyx_v_order = __pyx_get_best_slice_order((&__pyx_v_dst), __pyx_v_ndim); + + /* "View.MemoryView":1302 + * if slices_overlap(&src, &dst, ndim, itemsize): + * + * if not slice_is_contig(src, order, ndim): # <<<<<<<<<<<<<< + * order = get_best_order(&dst, ndim) + * +*/ + } + + /* "View.MemoryView":1305 + * order = get_best_order(&dst, ndim) + * + * tmpdata = copy_data_to_temp(&src, &tmp, order, ndim) # <<<<<<<<<<<<<< + * src = tmp + * +*/ + __pyx_t_7 = __pyx_memoryview_copy_data_to_temp((&__pyx_v_src), (&__pyx_v_tmp), __pyx_v_order, __pyx_v_ndim); if (unlikely(__pyx_t_7 == ((void *)NULL))) __PYX_ERR(1, 1305, __pyx_L1_error) + __pyx_v_tmpdata = __pyx_t_7; + + /* "View.MemoryView":1306 + * + * tmpdata = copy_data_to_temp(&src, &tmp, order, ndim) + * src = tmp # <<<<<<<<<<<<<< + * + * if not broadcasting: +*/ + __pyx_v_src = __pyx_v_tmp; + + /* "View.MemoryView":1300 + * _err_dim(PyExc_ValueError, "Dimension %d is not direct", i) + * + * if slices_overlap(&src, &dst, ndim, itemsize): # <<<<<<<<<<<<<< + * + * if not slice_is_contig(src, order, ndim): +*/ + } + + /* "View.MemoryView":1308 + * src = tmp + * + * if not broadcasting: # <<<<<<<<<<<<<< + * + * +*/ + __pyx_t_2 = (!__pyx_v_broadcasting); + if (__pyx_t_2) { + + /* "View.MemoryView":1311 + * + * + * if slice_is_contig(src, 'C', ndim): # <<<<<<<<<<<<<< + * direct_copy = slice_is_contig(dst, 'C', ndim) + * elif slice_is_contig(src, 'F', ndim): +*/ + __pyx_t_2 = __pyx_memviewslice_is_contig(__pyx_v_src, 'C', __pyx_v_ndim); + if (__pyx_t_2) { + + /* "View.MemoryView":1312 + * + * if slice_is_contig(src, 'C', ndim): + * direct_copy = slice_is_contig(dst, 'C', ndim) # <<<<<<<<<<<<<< + * elif slice_is_contig(src, 'F', ndim): + * direct_copy = slice_is_contig(dst, 'F', ndim) +*/ + __pyx_v_direct_copy = __pyx_memviewslice_is_contig(__pyx_v_dst, 'C', __pyx_v_ndim); + + /* "View.MemoryView":1311 + * + * + * if slice_is_contig(src, 'C', ndim): # <<<<<<<<<<<<<< + * direct_copy = slice_is_contig(dst, 'C', ndim) + * elif slice_is_contig(src, 'F', ndim): +*/ + goto __pyx_L12; + } + + /* "View.MemoryView":1313 + * if slice_is_contig(src, 'C', ndim): + * direct_copy = slice_is_contig(dst, 'C', ndim) + * elif slice_is_contig(src, 'F', ndim): # <<<<<<<<<<<<<< + * direct_copy = slice_is_contig(dst, 'F', ndim) + * +*/ + __pyx_t_2 = __pyx_memviewslice_is_contig(__pyx_v_src, 'F', __pyx_v_ndim); + if (__pyx_t_2) { + + /* "View.MemoryView":1314 + * direct_copy = slice_is_contig(dst, 'C', ndim) + * elif slice_is_contig(src, 'F', ndim): + * direct_copy = slice_is_contig(dst, 'F', ndim) # <<<<<<<<<<<<<< + * + * if direct_copy: +*/ + __pyx_v_direct_copy = __pyx_memviewslice_is_contig(__pyx_v_dst, 'F', __pyx_v_ndim); + + /* "View.MemoryView":1313 + * if slice_is_contig(src, 'C', ndim): + * direct_copy = slice_is_contig(dst, 'C', ndim) + * elif slice_is_contig(src, 'F', ndim): # <<<<<<<<<<<<<< + * direct_copy = slice_is_contig(dst, 'F', ndim) + * +*/ + } + __pyx_L12:; + + /* "View.MemoryView":1316 + * direct_copy = slice_is_contig(dst, 'F', ndim) + * + * if direct_copy: # <<<<<<<<<<<<<< + * + * refcount_copying(&dst, dtype_is_object, ndim, inc=False) +*/ + if (__pyx_v_direct_copy) { + + /* "View.MemoryView":1318 + * if direct_copy: + * + * refcount_copying(&dst, dtype_is_object, ndim, inc=False) # <<<<<<<<<<<<<< + * memcpy(dst.data, src.data, slice_get_size(&src, ndim)) + * refcount_copying(&dst, dtype_is_object, ndim, inc=True) +*/ + __pyx_memoryview_refcount_copying((&__pyx_v_dst), __pyx_v_dtype_is_object, __pyx_v_ndim, 0); + + /* "View.MemoryView":1319 + * + * refcount_copying(&dst, dtype_is_object, ndim, inc=False) + * memcpy(dst.data, src.data, slice_get_size(&src, ndim)) # <<<<<<<<<<<<<< + * refcount_copying(&dst, dtype_is_object, ndim, inc=True) + * free(tmpdata) +*/ + (void)(memcpy(__pyx_v_dst.data, __pyx_v_src.data, __pyx_memoryview_slice_get_size((&__pyx_v_src), __pyx_v_ndim))); + + /* "View.MemoryView":1320 + * refcount_copying(&dst, dtype_is_object, ndim, inc=False) + * memcpy(dst.data, src.data, slice_get_size(&src, ndim)) + * refcount_copying(&dst, dtype_is_object, ndim, inc=True) # <<<<<<<<<<<<<< + * free(tmpdata) + * return 0 +*/ + __pyx_memoryview_refcount_copying((&__pyx_v_dst), __pyx_v_dtype_is_object, __pyx_v_ndim, 1); + + /* "View.MemoryView":1321 + * memcpy(dst.data, src.data, slice_get_size(&src, ndim)) + * refcount_copying(&dst, dtype_is_object, ndim, inc=True) + * free(tmpdata) # <<<<<<<<<<<<<< + * return 0 + * +*/ + free(__pyx_v_tmpdata); + + /* "View.MemoryView":1322 + * refcount_copying(&dst, dtype_is_object, ndim, inc=True) + * free(tmpdata) + * return 0 # <<<<<<<<<<<<<< + * + * if order == 'F' == get_best_order(&dst, ndim): +*/ + __pyx_r = 0; + goto __pyx_L0; + + /* "View.MemoryView":1316 + * direct_copy = slice_is_contig(dst, 'F', ndim) + * + * if direct_copy: # <<<<<<<<<<<<<< + * + * refcount_copying(&dst, dtype_is_object, ndim, inc=False) +*/ + } + + /* "View.MemoryView":1308 + * src = tmp + * + * if not broadcasting: # <<<<<<<<<<<<<< + * + * +*/ + } + + /* "View.MemoryView":1324 + * return 0 + * + * if order == 'F' == get_best_order(&dst, ndim): # <<<<<<<<<<<<<< + * + * +*/ + __pyx_t_2 = (__pyx_v_order == 'F'); + if (__pyx_t_2) { + __pyx_t_2 = ('F' == __pyx_get_best_slice_order((&__pyx_v_dst), __pyx_v_ndim)); + } + if (__pyx_t_2) { + + /* "View.MemoryView":1327 + * + * + * transpose_memslice(&src) # <<<<<<<<<<<<<< + * transpose_memslice(&dst) + * +*/ + __pyx_t_5 = __pyx_memslice_transpose((&__pyx_v_src)); if (unlikely(__pyx_t_5 == ((int)-1))) __PYX_ERR(1, 1327, __pyx_L1_error) + + /* "View.MemoryView":1328 + * + * transpose_memslice(&src) + * transpose_memslice(&dst) # <<<<<<<<<<<<<< + * + * refcount_copying(&dst, dtype_is_object, ndim, inc=False) +*/ + __pyx_t_5 = __pyx_memslice_transpose((&__pyx_v_dst)); if (unlikely(__pyx_t_5 == ((int)-1))) __PYX_ERR(1, 1328, __pyx_L1_error) + + /* "View.MemoryView":1324 + * return 0 + * + * if order == 'F' == get_best_order(&dst, ndim): # <<<<<<<<<<<<<< + * + * +*/ + } + + /* "View.MemoryView":1330 + * transpose_memslice(&dst) + * + * refcount_copying(&dst, dtype_is_object, ndim, inc=False) # <<<<<<<<<<<<<< + * copy_strided_to_strided(&src, &dst, ndim, itemsize) + * refcount_copying(&dst, dtype_is_object, ndim, inc=True) +*/ + __pyx_memoryview_refcount_copying((&__pyx_v_dst), __pyx_v_dtype_is_object, __pyx_v_ndim, 0); + + /* "View.MemoryView":1331 + * + * refcount_copying(&dst, dtype_is_object, ndim, inc=False) + * copy_strided_to_strided(&src, &dst, ndim, itemsize) # <<<<<<<<<<<<<< + * refcount_copying(&dst, dtype_is_object, ndim, inc=True) + * +*/ + copy_strided_to_strided((&__pyx_v_src), (&__pyx_v_dst), __pyx_v_ndim, __pyx_v_itemsize); + + /* "View.MemoryView":1332 + * refcount_copying(&dst, dtype_is_object, ndim, inc=False) + * copy_strided_to_strided(&src, &dst, ndim, itemsize) + * refcount_copying(&dst, dtype_is_object, ndim, inc=True) # <<<<<<<<<<<<<< + * + * free(tmpdata) +*/ + __pyx_memoryview_refcount_copying((&__pyx_v_dst), __pyx_v_dtype_is_object, __pyx_v_ndim, 1); + + /* "View.MemoryView":1334 + * refcount_copying(&dst, dtype_is_object, ndim, inc=True) + * + * free(tmpdata) # <<<<<<<<<<<<<< + * return 0 + * +*/ + free(__pyx_v_tmpdata); + + /* "View.MemoryView":1335 + * + * free(tmpdata) + * return 0 # <<<<<<<<<<<<<< + * + * @cname('__pyx_memoryview_broadcast_leading') +*/ + __pyx_r = 0; + goto __pyx_L0; + + /* "View.MemoryView":1265 + * + * + * @cname('__pyx_memoryview_copy_contents') # <<<<<<<<<<<<<< + * cdef int memoryview_copy_contents(__Pyx_memviewslice src, + * __Pyx_memviewslice dst, +*/ + + /* function exit code */ + __pyx_L1_error:; + __pyx_gilstate_save = __Pyx_PyGILState_Ensure(); + __Pyx_AddTraceback("View.MemoryView.memoryview_copy_contents", __pyx_clineno, __pyx_lineno, __pyx_filename); + __pyx_r = -1; + __Pyx_PyGILState_Release(__pyx_gilstate_save); + __pyx_L0:; + return __pyx_r; +} + +/* "View.MemoryView":1337 + * return 0 + * + * @cname('__pyx_memoryview_broadcast_leading') # <<<<<<<<<<<<<< + * cdef void broadcast_leading(__Pyx_memviewslice *mslice, + * int ndim, +*/ + +static void __pyx_memoryview_broadcast_leading(__Pyx_memviewslice *__pyx_v_mslice, int __pyx_v_ndim, int __pyx_v_ndim_other) { + int __pyx_v_i; + int __pyx_v_offset; + int __pyx_t_1; + int __pyx_t_2; + int __pyx_t_3; + + /* "View.MemoryView":1342 + * int ndim_other) noexcept nogil: + * cdef int i + * cdef int offset = ndim_other - ndim # <<<<<<<<<<<<<< + * + * for i in range(ndim - 1, -1, -1): +*/ + __pyx_v_offset = (__pyx_v_ndim_other - __pyx_v_ndim); + + /* "View.MemoryView":1344 + * cdef int offset = ndim_other - ndim + * + * for i in range(ndim - 1, -1, -1): # <<<<<<<<<<<<<< + * mslice.shape[i + offset] = mslice.shape[i] + * mslice.strides[i + offset] = mslice.strides[i] +*/ + for (__pyx_t_1 = (__pyx_v_ndim - 1); __pyx_t_1 > -1; __pyx_t_1-=1) { + __pyx_v_i = __pyx_t_1; + + /* "View.MemoryView":1345 + * + * for i in range(ndim - 1, -1, -1): + * mslice.shape[i + offset] = mslice.shape[i] # <<<<<<<<<<<<<< + * mslice.strides[i + offset] = mslice.strides[i] + * mslice.suboffsets[i + offset] = mslice.suboffsets[i] +*/ + (__pyx_v_mslice->shape[(__pyx_v_i + __pyx_v_offset)]) = (__pyx_v_mslice->shape[__pyx_v_i]); + + /* "View.MemoryView":1346 + * for i in range(ndim - 1, -1, -1): + * mslice.shape[i + offset] = mslice.shape[i] + * mslice.strides[i + offset] = mslice.strides[i] # <<<<<<<<<<<<<< + * mslice.suboffsets[i + offset] = mslice.suboffsets[i] + * +*/ + (__pyx_v_mslice->strides[(__pyx_v_i + __pyx_v_offset)]) = (__pyx_v_mslice->strides[__pyx_v_i]); + + /* "View.MemoryView":1347 + * mslice.shape[i + offset] = mslice.shape[i] + * mslice.strides[i + offset] = mslice.strides[i] + * mslice.suboffsets[i + offset] = mslice.suboffsets[i] # <<<<<<<<<<<<<< + * + * for i in range(offset): +*/ + (__pyx_v_mslice->suboffsets[(__pyx_v_i + __pyx_v_offset)]) = (__pyx_v_mslice->suboffsets[__pyx_v_i]); + } + + /* "View.MemoryView":1349 + * mslice.suboffsets[i + offset] = mslice.suboffsets[i] + * + * for i in range(offset): # <<<<<<<<<<<<<< + * mslice.shape[i] = 1 + * mslice.strides[i] = mslice.strides[0] +*/ + __pyx_t_1 = __pyx_v_offset; + __pyx_t_2 = __pyx_t_1; + for (__pyx_t_3 = 0; __pyx_t_3 < __pyx_t_2; __pyx_t_3+=1) { + __pyx_v_i = __pyx_t_3; + + /* "View.MemoryView":1350 + * + * for i in range(offset): + * mslice.shape[i] = 1 # <<<<<<<<<<<<<< + * mslice.strides[i] = mslice.strides[0] + * mslice.suboffsets[i] = -1 +*/ + (__pyx_v_mslice->shape[__pyx_v_i]) = 1; + + /* "View.MemoryView":1351 + * for i in range(offset): + * mslice.shape[i] = 1 + * mslice.strides[i] = mslice.strides[0] # <<<<<<<<<<<<<< + * mslice.suboffsets[i] = -1 + * +*/ + (__pyx_v_mslice->strides[__pyx_v_i]) = (__pyx_v_mslice->strides[0]); + + /* "View.MemoryView":1352 + * mslice.shape[i] = 1 + * mslice.strides[i] = mslice.strides[0] + * mslice.suboffsets[i] = -1 # <<<<<<<<<<<<<< + * + * +*/ + (__pyx_v_mslice->suboffsets[__pyx_v_i]) = -1L; + } + + /* "View.MemoryView":1337 + * return 0 + * + * @cname('__pyx_memoryview_broadcast_leading') # <<<<<<<<<<<<<< + * cdef void broadcast_leading(__Pyx_memviewslice *mslice, + * int ndim, +*/ + + /* function exit code */ +} + +/* "View.MemoryView":1359 + * + * + * @cname('__pyx_memoryview_refcount_copying') # <<<<<<<<<<<<<< + * cdef void refcount_copying(__Pyx_memviewslice *dst, bint dtype_is_object, int ndim, bint inc) noexcept nogil: + * +*/ + +static void __pyx_memoryview_refcount_copying(__Pyx_memviewslice *__pyx_v_dst, int __pyx_v_dtype_is_object, int __pyx_v_ndim, int __pyx_v_inc) { + + /* "View.MemoryView":1362 + * cdef void refcount_copying(__Pyx_memviewslice *dst, bint dtype_is_object, int ndim, bint inc) noexcept nogil: + * + * if dtype_is_object: # <<<<<<<<<<<<<< + * refcount_objects_in_slice_with_gil(dst.data, dst.shape, dst.strides, ndim, inc) + * +*/ + if (__pyx_v_dtype_is_object) { + + /* "View.MemoryView":1363 + * + * if dtype_is_object: + * refcount_objects_in_slice_with_gil(dst.data, dst.shape, dst.strides, ndim, inc) # <<<<<<<<<<<<<< + * + * @cname('__pyx_memoryview_refcount_objects_in_slice_with_gil') +*/ + __pyx_memoryview_refcount_objects_in_slice_with_gil(__pyx_v_dst->data, __pyx_v_dst->shape, __pyx_v_dst->strides, __pyx_v_ndim, __pyx_v_inc); + + /* "View.MemoryView":1362 + * cdef void refcount_copying(__Pyx_memviewslice *dst, bint dtype_is_object, int ndim, bint inc) noexcept nogil: + * + * if dtype_is_object: # <<<<<<<<<<<<<< + * refcount_objects_in_slice_with_gil(dst.data, dst.shape, dst.strides, ndim, inc) + * +*/ + } + + /* "View.MemoryView":1359 + * + * + * @cname('__pyx_memoryview_refcount_copying') # <<<<<<<<<<<<<< + * cdef void refcount_copying(__Pyx_memviewslice *dst, bint dtype_is_object, int ndim, bint inc) noexcept nogil: + * +*/ + + /* function exit code */ +} + +/* "View.MemoryView":1365 + * refcount_objects_in_slice_with_gil(dst.data, dst.shape, dst.strides, ndim, inc) + * + * @cname('__pyx_memoryview_refcount_objects_in_slice_with_gil') # <<<<<<<<<<<<<< + * cdef void refcount_objects_in_slice_with_gil(char *data, Py_ssize_t *shape, + * Py_ssize_t *strides, int ndim, +*/ + +static void __pyx_memoryview_refcount_objects_in_slice_with_gil(char *__pyx_v_data, Py_ssize_t *__pyx_v_shape, Py_ssize_t *__pyx_v_strides, int __pyx_v_ndim, int __pyx_v_inc) { + PyGILState_STATE __pyx_gilstate_save = __Pyx_PyGILState_Ensure(); + + /* "View.MemoryView":1369 + * Py_ssize_t *strides, int ndim, + * bint inc) noexcept with gil: + * refcount_objects_in_slice(data, shape, strides, ndim, inc) # <<<<<<<<<<<<<< + * + * @cname('__pyx_memoryview_refcount_objects_in_slice') +*/ + __pyx_memoryview_refcount_objects_in_slice(__pyx_v_data, __pyx_v_shape, __pyx_v_strides, __pyx_v_ndim, __pyx_v_inc); + + /* "View.MemoryView":1365 + * refcount_objects_in_slice_with_gil(dst.data, dst.shape, dst.strides, ndim, inc) + * + * @cname('__pyx_memoryview_refcount_objects_in_slice_with_gil') # <<<<<<<<<<<<<< + * cdef void refcount_objects_in_slice_with_gil(char *data, Py_ssize_t *shape, + * Py_ssize_t *strides, int ndim, +*/ + + /* function exit code */ + __Pyx_PyGILState_Release(__pyx_gilstate_save); +} + +/* "View.MemoryView":1371 + * refcount_objects_in_slice(data, shape, strides, ndim, inc) + * + * @cname('__pyx_memoryview_refcount_objects_in_slice') # <<<<<<<<<<<<<< + * cdef void refcount_objects_in_slice(char *data, Py_ssize_t *shape, + * Py_ssize_t *strides, int ndim, bint inc) noexcept: +*/ + +static void __pyx_memoryview_refcount_objects_in_slice(char *__pyx_v_data, Py_ssize_t *__pyx_v_shape, Py_ssize_t *__pyx_v_strides, int __pyx_v_ndim, int __pyx_v_inc) { + CYTHON_UNUSED Py_ssize_t __pyx_v_i; + Py_ssize_t __pyx_v_stride; + Py_ssize_t __pyx_t_1; + Py_ssize_t __pyx_t_2; + Py_ssize_t __pyx_t_3; + int __pyx_t_4; + + /* "View.MemoryView":1375 + * Py_ssize_t *strides, int ndim, bint inc) noexcept: + * cdef Py_ssize_t i + * cdef Py_ssize_t stride = strides[0] # <<<<<<<<<<<<<< + * + * for i in range(shape[0]): +*/ + __pyx_v_stride = (__pyx_v_strides[0]); + + /* "View.MemoryView":1377 + * cdef Py_ssize_t stride = strides[0] + * + * for i in range(shape[0]): # <<<<<<<<<<<<<< + * if ndim == 1: + * if inc: +*/ + __pyx_t_1 = (__pyx_v_shape[0]); + __pyx_t_2 = __pyx_t_1; + for (__pyx_t_3 = 0; __pyx_t_3 < __pyx_t_2; __pyx_t_3+=1) { + __pyx_v_i = __pyx_t_3; + + /* "View.MemoryView":1378 + * + * for i in range(shape[0]): + * if ndim == 1: # <<<<<<<<<<<<<< + * if inc: + * Py_INCREF(( data)[0]) +*/ + __pyx_t_4 = (__pyx_v_ndim == 1); + if (__pyx_t_4) { + + /* "View.MemoryView":1379 + * for i in range(shape[0]): + * if ndim == 1: + * if inc: # <<<<<<<<<<<<<< + * Py_INCREF(( data)[0]) + * else: +*/ + if (__pyx_v_inc) { + + /* "View.MemoryView":1380 + * if ndim == 1: + * if inc: + * Py_INCREF(( data)[0]) # <<<<<<<<<<<<<< + * else: + * Py_DECREF(( data)[0]) +*/ + Py_INCREF((((PyObject **)__pyx_v_data)[0])); + + /* "View.MemoryView":1379 + * for i in range(shape[0]): + * if ndim == 1: + * if inc: # <<<<<<<<<<<<<< + * Py_INCREF(( data)[0]) + * else: +*/ + goto __pyx_L6; + } + + /* "View.MemoryView":1382 + * Py_INCREF(( data)[0]) + * else: + * Py_DECREF(( data)[0]) # <<<<<<<<<<<<<< + * else: + * refcount_objects_in_slice(data, shape + 1, strides + 1, ndim - 1, inc) +*/ + /*else*/ { + Py_DECREF((((PyObject **)__pyx_v_data)[0])); + } + __pyx_L6:; + + /* "View.MemoryView":1378 + * + * for i in range(shape[0]): + * if ndim == 1: # <<<<<<<<<<<<<< + * if inc: + * Py_INCREF(( data)[0]) +*/ + goto __pyx_L5; + } + + /* "View.MemoryView":1384 + * Py_DECREF(( data)[0]) + * else: + * refcount_objects_in_slice(data, shape + 1, strides + 1, ndim - 1, inc) # <<<<<<<<<<<<<< + * + * data += stride +*/ + /*else*/ { + __pyx_memoryview_refcount_objects_in_slice(__pyx_v_data, (__pyx_v_shape + 1), (__pyx_v_strides + 1), (__pyx_v_ndim - 1), __pyx_v_inc); + } + __pyx_L5:; + + /* "View.MemoryView":1386 + * refcount_objects_in_slice(data, shape + 1, strides + 1, ndim - 1, inc) + * + * data += stride # <<<<<<<<<<<<<< + * + * +*/ + __pyx_v_data = (__pyx_v_data + __pyx_v_stride); + } + + /* "View.MemoryView":1371 + * refcount_objects_in_slice(data, shape, strides, ndim, inc) + * + * @cname('__pyx_memoryview_refcount_objects_in_slice') # <<<<<<<<<<<<<< + * cdef void refcount_objects_in_slice(char *data, Py_ssize_t *shape, + * Py_ssize_t *strides, int ndim, bint inc) noexcept: +*/ + + /* function exit code */ +} + +/* "View.MemoryView":1391 + * + * + * @cname('__pyx_memoryview_slice_assign_scalar') # <<<<<<<<<<<<<< + * cdef void slice_assign_scalar(__Pyx_memviewslice *dst, int ndim, + * size_t itemsize, void *item, +*/ + +static void __pyx_memoryview_slice_assign_scalar(__Pyx_memviewslice *__pyx_v_dst, int __pyx_v_ndim, size_t __pyx_v_itemsize, void *__pyx_v_item, int __pyx_v_dtype_is_object) { + + /* "View.MemoryView":1395 + * size_t itemsize, void *item, + * bint dtype_is_object) noexcept nogil: + * refcount_copying(dst, dtype_is_object, ndim, inc=False) # <<<<<<<<<<<<<< + * _slice_assign_scalar(dst.data, dst.shape, dst.strides, ndim, itemsize, item) + * refcount_copying(dst, dtype_is_object, ndim, inc=True) +*/ + __pyx_memoryview_refcount_copying(__pyx_v_dst, __pyx_v_dtype_is_object, __pyx_v_ndim, 0); + + /* "View.MemoryView":1396 + * bint dtype_is_object) noexcept nogil: + * refcount_copying(dst, dtype_is_object, ndim, inc=False) + * _slice_assign_scalar(dst.data, dst.shape, dst.strides, ndim, itemsize, item) # <<<<<<<<<<<<<< + * refcount_copying(dst, dtype_is_object, ndim, inc=True) + * +*/ + __pyx_memoryview__slice_assign_scalar(__pyx_v_dst->data, __pyx_v_dst->shape, __pyx_v_dst->strides, __pyx_v_ndim, __pyx_v_itemsize, __pyx_v_item); + + /* "View.MemoryView":1397 + * refcount_copying(dst, dtype_is_object, ndim, inc=False) + * _slice_assign_scalar(dst.data, dst.shape, dst.strides, ndim, itemsize, item) + * refcount_copying(dst, dtype_is_object, ndim, inc=True) # <<<<<<<<<<<<<< + * + * +*/ + __pyx_memoryview_refcount_copying(__pyx_v_dst, __pyx_v_dtype_is_object, __pyx_v_ndim, 1); + + /* "View.MemoryView":1391 + * + * + * @cname('__pyx_memoryview_slice_assign_scalar') # <<<<<<<<<<<<<< + * cdef void slice_assign_scalar(__Pyx_memviewslice *dst, int ndim, + * size_t itemsize, void *item, +*/ + + /* function exit code */ +} + +/* "View.MemoryView":1400 + * + * + * @cname('__pyx_memoryview__slice_assign_scalar') # <<<<<<<<<<<<<< + * cdef void _slice_assign_scalar(char *data, Py_ssize_t *shape, + * Py_ssize_t *strides, int ndim, +*/ + +static void __pyx_memoryview__slice_assign_scalar(char *__pyx_v_data, Py_ssize_t *__pyx_v_shape, Py_ssize_t *__pyx_v_strides, int __pyx_v_ndim, size_t __pyx_v_itemsize, void *__pyx_v_item) { + CYTHON_UNUSED Py_ssize_t __pyx_v_i; + Py_ssize_t __pyx_v_stride; + Py_ssize_t __pyx_v_extent; + int __pyx_t_1; + Py_ssize_t __pyx_t_2; + Py_ssize_t __pyx_t_3; + Py_ssize_t __pyx_t_4; + + /* "View.MemoryView":1405 + * size_t itemsize, void *item) noexcept nogil: + * cdef Py_ssize_t i + * cdef Py_ssize_t stride = strides[0] # <<<<<<<<<<<<<< + * cdef Py_ssize_t extent = shape[0] + * +*/ + __pyx_v_stride = (__pyx_v_strides[0]); + + /* "View.MemoryView":1406 + * cdef Py_ssize_t i + * cdef Py_ssize_t stride = strides[0] + * cdef Py_ssize_t extent = shape[0] # <<<<<<<<<<<<<< + * + * if ndim == 1: +*/ + __pyx_v_extent = (__pyx_v_shape[0]); + + /* "View.MemoryView":1408 + * cdef Py_ssize_t extent = shape[0] + * + * if ndim == 1: # <<<<<<<<<<<<<< + * for i in range(extent): + * memcpy(data, item, itemsize) +*/ + __pyx_t_1 = (__pyx_v_ndim == 1); + if (__pyx_t_1) { + + /* "View.MemoryView":1409 + * + * if ndim == 1: + * for i in range(extent): # <<<<<<<<<<<<<< + * memcpy(data, item, itemsize) + * data += stride +*/ + __pyx_t_2 = __pyx_v_extent; + __pyx_t_3 = __pyx_t_2; + for (__pyx_t_4 = 0; __pyx_t_4 < __pyx_t_3; __pyx_t_4+=1) { + __pyx_v_i = __pyx_t_4; + + /* "View.MemoryView":1410 + * if ndim == 1: + * for i in range(extent): + * memcpy(data, item, itemsize) # <<<<<<<<<<<<<< + * data += stride + * else: +*/ + (void)(memcpy(__pyx_v_data, __pyx_v_item, __pyx_v_itemsize)); + + /* "View.MemoryView":1411 + * for i in range(extent): + * memcpy(data, item, itemsize) + * data += stride # <<<<<<<<<<<<<< + * else: + * for i in range(extent): +*/ + __pyx_v_data = (__pyx_v_data + __pyx_v_stride); + } + + /* "View.MemoryView":1408 + * cdef Py_ssize_t extent = shape[0] + * + * if ndim == 1: # <<<<<<<<<<<<<< + * for i in range(extent): + * memcpy(data, item, itemsize) +*/ + goto __pyx_L3; + } + + /* "View.MemoryView":1413 + * data += stride + * else: + * for i in range(extent): # <<<<<<<<<<<<<< + * _slice_assign_scalar(data, shape + 1, strides + 1, ndim - 1, itemsize, item) + * data += stride +*/ + /*else*/ { + __pyx_t_2 = __pyx_v_extent; + __pyx_t_3 = __pyx_t_2; + for (__pyx_t_4 = 0; __pyx_t_4 < __pyx_t_3; __pyx_t_4+=1) { + __pyx_v_i = __pyx_t_4; + + /* "View.MemoryView":1414 + * else: + * for i in range(extent): + * _slice_assign_scalar(data, shape + 1, strides + 1, ndim - 1, itemsize, item) # <<<<<<<<<<<<<< + * data += stride + * +*/ + __pyx_memoryview__slice_assign_scalar(__pyx_v_data, (__pyx_v_shape + 1), (__pyx_v_strides + 1), (__pyx_v_ndim - 1), __pyx_v_itemsize, __pyx_v_item); + + /* "View.MemoryView":1415 + * for i in range(extent): + * _slice_assign_scalar(data, shape + 1, strides + 1, ndim - 1, itemsize, item) + * data += stride # <<<<<<<<<<<<<< + * +*/ + __pyx_v_data = (__pyx_v_data + __pyx_v_stride); + } + } + __pyx_L3:; + + /* "View.MemoryView":1400 + * + * + * @cname('__pyx_memoryview__slice_assign_scalar') # <<<<<<<<<<<<<< + * cdef void _slice_assign_scalar(char *data, Py_ssize_t *shape, + * Py_ssize_t *strides, int ndim, +*/ + + /* function exit code */ +} + +/* "(tree fragment)":4 + * int __Pyx_CheckUnpickleChecksum(long, long, long, long, const char*) except -1 + * int __Pyx_UpdateUnpickledDict(object, object, Py_ssize_t) except -1 + * def __pyx_unpickle_Enum(__pyx_type, long __pyx_checksum, tuple __pyx_state): # <<<<<<<<<<<<<< + * cdef object __pyx_result + * __Pyx_CheckUnpickleChecksum(__pyx_checksum, 0x82a3537, 0x6ae9995, 0xb068931, b'name') +*/ + +/* Python wrapper */ +static PyObject *__pyx_pw_15View_dot_MemoryView_1__pyx_unpickle_Enum(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*/ +static PyMethodDef __pyx_mdef_15View_dot_MemoryView_1__pyx_unpickle_Enum = {"__pyx_unpickle_Enum", (PyCFunction)(void(*)(void))(__Pyx_PyCFunction_FastCallWithKeywords)__pyx_pw_15View_dot_MemoryView_1__pyx_unpickle_Enum, __Pyx_METH_FASTCALL|METH_KEYWORDS, 0}; +static PyObject *__pyx_pw_15View_dot_MemoryView_1__pyx_unpickle_Enum(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 +) { + PyObject *__pyx_v___pyx_type = 0; + long __pyx_v___pyx_checksum; + 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[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("__pyx_unpickle_Enum (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_type,&__pyx_mstate_global->__pyx_n_u_pyx_checksum,&__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, 4, __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(1, 4, __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(1, 4, __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(1, 4, __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, "__pyx_unpickle_Enum", 0) < (0)) __PYX_ERR(1, 4, __pyx_L3_error) + for (Py_ssize_t i = __pyx_nargs; i < 3; i++) { + if (unlikely(!values[i])) { __Pyx_RaiseArgtupleInvalid("__pyx_unpickle_Enum", 1, 3, 3, i); __PYX_ERR(1, 4, __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(1, 4, __pyx_L3_error) + values[1] = __Pyx_ArgRef_FASTCALL(__pyx_args, 1); + if (!CYTHON_ASSUME_SAFE_MACROS && unlikely(!values[1])) __PYX_ERR(1, 4, __pyx_L3_error) + values[2] = __Pyx_ArgRef_FASTCALL(__pyx_args, 2); + if (!CYTHON_ASSUME_SAFE_MACROS && unlikely(!values[2])) __PYX_ERR(1, 4, __pyx_L3_error) + } + __pyx_v___pyx_type = values[0]; + __pyx_v___pyx_checksum = __Pyx_PyLong_As_long(values[1]); if (unlikely((__pyx_v___pyx_checksum == (long)-1) && PyErr_Occurred())) __PYX_ERR(1, 4, __pyx_L3_error) + __pyx_v___pyx_state = ((PyObject*)values[2]); + } + goto __pyx_L6_skip; + __pyx_L5_argtuple_error:; + __Pyx_RaiseArgtupleInvalid("__pyx_unpickle_Enum", 1, 3, 3, __pyx_nargs); __PYX_ERR(1, 4, __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("View.MemoryView.__pyx_unpickle_Enum", __pyx_clineno, __pyx_lineno, __pyx_filename); + __Pyx_RefNannyFinishContext(); + return NULL; + __pyx_L4_argument_unpacking_done:; + if (unlikely(!__Pyx_ArgTypeTest(((PyObject *)__pyx_v___pyx_state), (&PyTuple_Type), 1, "__pyx_state", 1))) __PYX_ERR(1, 4, __pyx_L1_error) + __pyx_r = __pyx_pf_15View_dot_MemoryView___pyx_unpickle_Enum(__pyx_self, __pyx_v___pyx_type, __pyx_v___pyx_checksum, __pyx_v___pyx_state); + + /* 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_15View_dot_MemoryView___pyx_unpickle_Enum(CYTHON_UNUSED PyObject *__pyx_self, PyObject *__pyx_v___pyx_type, long __pyx_v___pyx_checksum, PyObject *__pyx_v___pyx_state) { + PyObject *__pyx_v___pyx_result = 0; + 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_t_5; + int __pyx_lineno = 0; + const char *__pyx_filename = NULL; + int __pyx_clineno = 0; + __Pyx_RefNannySetupContext("__pyx_unpickle_Enum", 0); + + /* "(tree fragment)":6 + * def __pyx_unpickle_Enum(__pyx_type, long __pyx_checksum, tuple __pyx_state): + * cdef object __pyx_result + * __Pyx_CheckUnpickleChecksum(__pyx_checksum, 0x82a3537, 0x6ae9995, 0xb068931, b'name') # <<<<<<<<<<<<<< + * __pyx_result = Enum.__new__(__pyx_type) + * if __pyx_state is not None: +*/ + __pyx_t_1 = __Pyx_CheckUnpickleChecksum(__pyx_v___pyx_checksum, 0x82a3537, 0x6ae9995, 0xb068931, ((char const *)"name")); if (unlikely(__pyx_t_1 == ((int)-1))) __PYX_ERR(1, 6, __pyx_L1_error) + + /* "(tree fragment)":7 + * cdef object __pyx_result + * __Pyx_CheckUnpickleChecksum(__pyx_checksum, 0x82a3537, 0x6ae9995, 0xb068931, b'name') + * __pyx_result = Enum.__new__(__pyx_type) # <<<<<<<<<<<<<< + * if __pyx_state is not None: + * __pyx_unpickle_Enum__set_state( __pyx_result, __pyx_state) +*/ + __pyx_t_3 = ((PyObject *)__pyx_mstate_global->__pyx_MemviewEnum_type); + __Pyx_INCREF(__pyx_t_3); + __pyx_t_4 = 0; + { + PyObject *__pyx_callargs[2] = {__pyx_t_3, __pyx_v___pyx_type}; + __pyx_t_2 = __Pyx_PyObject_FastCallMethod((PyObject*)__pyx_mstate_global->__pyx_n_u_new, __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_2)) __PYX_ERR(1, 7, __pyx_L1_error) + __Pyx_GOTREF(__pyx_t_2); + } + __pyx_v___pyx_result = __pyx_t_2; + __pyx_t_2 = 0; + + /* "(tree fragment)":8 + * __Pyx_CheckUnpickleChecksum(__pyx_checksum, 0x82a3537, 0x6ae9995, 0xb068931, b'name') + * __pyx_result = Enum.__new__(__pyx_type) + * if __pyx_state is not None: # <<<<<<<<<<<<<< + * __pyx_unpickle_Enum__set_state( __pyx_result, __pyx_state) + * return __pyx_result +*/ + __pyx_t_5 = (__pyx_v___pyx_state != ((PyObject*)Py_None)); + if (__pyx_t_5) { + + /* "(tree fragment)":9 + * __pyx_result = Enum.__new__(__pyx_type) + * if __pyx_state is not None: + * __pyx_unpickle_Enum__set_state( __pyx_result, __pyx_state) # <<<<<<<<<<<<<< + * return __pyx_result + * cdef __pyx_unpickle_Enum__set_state(Enum __pyx_result, __pyx_state: tuple): +*/ + if (unlikely(__pyx_v___pyx_state == Py_None)) { + PyErr_SetString(PyExc_TypeError, "cannot pass None into a C function argument that is declared 'not None'"); + __PYX_ERR(1, 9, __pyx_L1_error) + } + __pyx_t_2 = __pyx_unpickle_Enum__set_state(((struct __pyx_MemviewEnum_obj *)__pyx_v___pyx_result), __pyx_v___pyx_state); if (unlikely(!__pyx_t_2)) __PYX_ERR(1, 9, __pyx_L1_error) + __Pyx_GOTREF(__pyx_t_2); + __Pyx_DECREF(__pyx_t_2); __pyx_t_2 = 0; + + /* "(tree fragment)":8 + * __Pyx_CheckUnpickleChecksum(__pyx_checksum, 0x82a3537, 0x6ae9995, 0xb068931, b'name') + * __pyx_result = Enum.__new__(__pyx_type) + * if __pyx_state is not None: # <<<<<<<<<<<<<< + * __pyx_unpickle_Enum__set_state( __pyx_result, __pyx_state) + * return __pyx_result +*/ + } + + /* "(tree fragment)":10 + * if __pyx_state is not None: + * __pyx_unpickle_Enum__set_state( __pyx_result, __pyx_state) + * return __pyx_result # <<<<<<<<<<<<<< + * cdef __pyx_unpickle_Enum__set_state(Enum __pyx_result, __pyx_state: tuple): + * __pyx_result.name = __pyx_state[0] +*/ + __Pyx_XDECREF(__pyx_r); + __Pyx_INCREF(__pyx_v___pyx_result); + __pyx_r = __pyx_v___pyx_result; + goto __pyx_L0; + + /* "(tree fragment)":4 + * int __Pyx_CheckUnpickleChecksum(long, long, long, long, const char*) except -1 + * int __Pyx_UpdateUnpickledDict(object, object, Py_ssize_t) except -1 + * def __pyx_unpickle_Enum(__pyx_type, long __pyx_checksum, tuple __pyx_state): # <<<<<<<<<<<<<< + * cdef object __pyx_result + * __Pyx_CheckUnpickleChecksum(__pyx_checksum, 0x82a3537, 0x6ae9995, 0xb068931, b'name') +*/ + + /* function exit code */ + __pyx_L1_error:; + __Pyx_XDECREF(__pyx_t_2); + __Pyx_XDECREF(__pyx_t_3); + __Pyx_AddTraceback("View.MemoryView.__pyx_unpickle_Enum", __pyx_clineno, __pyx_lineno, __pyx_filename); + __pyx_r = NULL; + __pyx_L0:; + __Pyx_XDECREF(__pyx_v___pyx_result); + __Pyx_XGIVEREF(__pyx_r); + __Pyx_RefNannyFinishContext(); + return __pyx_r; +} + +/* "(tree fragment)":11 + * __pyx_unpickle_Enum__set_state( __pyx_result, __pyx_state) + * return __pyx_result + * cdef __pyx_unpickle_Enum__set_state(Enum __pyx_result, __pyx_state: tuple): # <<<<<<<<<<<<<< + * __pyx_result.name = __pyx_state[0] + * __Pyx_UpdateUnpickledDict(__pyx_result, __pyx_state, 1) +*/ + +static PyObject *__pyx_unpickle_Enum__set_state(struct __pyx_MemviewEnum_obj *__pyx_v___pyx_result, PyObject *__pyx_v___pyx_state) { + PyObject *__pyx_r = NULL; + __Pyx_RefNannyDeclarations + PyObject *__pyx_t_1 = NULL; + int __pyx_t_2; + int __pyx_lineno = 0; + const char *__pyx_filename = NULL; + int __pyx_clineno = 0; + __Pyx_RefNannySetupContext("__pyx_unpickle_Enum__set_state", 0); + + /* "(tree fragment)":12 + * return __pyx_result + * cdef __pyx_unpickle_Enum__set_state(Enum __pyx_result, __pyx_state: tuple): + * __pyx_result.name = __pyx_state[0] # <<<<<<<<<<<<<< + * __Pyx_UpdateUnpickledDict(__pyx_result, __pyx_state, 1) +*/ + __pyx_t_1 = __Pyx_GetItemInt_Tuple(__pyx_v___pyx_state, 0, long, 1, __Pyx_PyLong_From_long, 0, 0, 1, 1, __Pyx_ReferenceSharing_FunctionArgument); if (unlikely(!__pyx_t_1)) __PYX_ERR(1, 12, __pyx_L1_error) + __Pyx_GOTREF(__pyx_t_1); + __Pyx_GIVEREF(__pyx_t_1); + __Pyx_GOTREF(__pyx_v___pyx_result->name); + __Pyx_DECREF(__pyx_v___pyx_result->name); + __pyx_v___pyx_result->name = __pyx_t_1; + __pyx_t_1 = 0; + + /* "(tree fragment)":13 + * cdef __pyx_unpickle_Enum__set_state(Enum __pyx_result, __pyx_state: tuple): + * __pyx_result.name = __pyx_state[0] + * __Pyx_UpdateUnpickledDict(__pyx_result, __pyx_state, 1) # <<<<<<<<<<<<<< +*/ + __pyx_t_2 = __Pyx_UpdateUnpickledDict(((PyObject *)__pyx_v___pyx_result), __pyx_v___pyx_state, 1); if (unlikely(__pyx_t_2 == ((int)-1))) __PYX_ERR(1, 13, __pyx_L1_error) + + /* "(tree fragment)":11 + * __pyx_unpickle_Enum__set_state( __pyx_result, __pyx_state) + * return __pyx_result + * cdef __pyx_unpickle_Enum__set_state(Enum __pyx_result, __pyx_state: tuple): # <<<<<<<<<<<<<< + * __pyx_result.name = __pyx_state[0] + * __Pyx_UpdateUnpickledDict(__pyx_result, __pyx_state, 1) +*/ + + /* function exit code */ + __pyx_r = Py_None; __Pyx_INCREF(Py_None); + goto __pyx_L0; + __pyx_L1_error:; + __Pyx_XDECREF(__pyx_t_1); + __Pyx_AddTraceback("View.MemoryView.__pyx_unpickle_Enum__set_state", __pyx_clineno, __pyx_lineno, __pyx_filename); + __pyx_r = 0; + __pyx_L0:; + __Pyx_XGIVEREF(__pyx_r); + __Pyx_RefNannyFinishContext(); + return __pyx_r; +} + +/* "C:/Users/runneradmin/AppData/Local/Temp/build-env-ej_q3m8u/Lib/site-packages/numpy/__init__.cython-30.pxd":242 + * cdef int type_num + * + * @property # <<<<<<<<<<<<<< + * cdef inline npy_intp itemsize(self) noexcept nogil: + * return PyDataType_ELSIZE(self) +*/ + +static CYTHON_INLINE npy_intp __pyx_f_5numpy_5dtype_8itemsize_itemsize(PyArray_Descr *__pyx_v_self) { + npy_intp __pyx_r; + + /* "C:/Users/runneradmin/AppData/Local/Temp/build-env-ej_q3m8u/Lib/site-packages/numpy/__init__.cython-30.pxd":244 + * @property + * cdef inline npy_intp itemsize(self) noexcept nogil: + * return PyDataType_ELSIZE(self) # <<<<<<<<<<<<<< + * + * @property +*/ + __pyx_r = PyDataType_ELSIZE(__pyx_v_self); + goto __pyx_L0; + + /* "C:/Users/runneradmin/AppData/Local/Temp/build-env-ej_q3m8u/Lib/site-packages/numpy/__init__.cython-30.pxd":242 + * cdef int type_num + * + * @property # <<<<<<<<<<<<<< + * cdef inline npy_intp itemsize(self) noexcept nogil: + * return PyDataType_ELSIZE(self) +*/ + + /* function exit code */ + __pyx_L0:; + return __pyx_r; +} + +/* "C:/Users/runneradmin/AppData/Local/Temp/build-env-ej_q3m8u/Lib/site-packages/numpy/__init__.cython-30.pxd":246 + * return PyDataType_ELSIZE(self) + * + * @property # <<<<<<<<<<<<<< + * cdef inline npy_intp alignment(self) noexcept nogil: + * return PyDataType_ALIGNMENT(self) +*/ + +static CYTHON_INLINE npy_intp __pyx_f_5numpy_5dtype_9alignment_alignment(PyArray_Descr *__pyx_v_self) { + npy_intp __pyx_r; + + /* "C:/Users/runneradmin/AppData/Local/Temp/build-env-ej_q3m8u/Lib/site-packages/numpy/__init__.cython-30.pxd":248 + * @property + * cdef inline npy_intp alignment(self) noexcept nogil: + * return PyDataType_ALIGNMENT(self) # <<<<<<<<<<<<<< + * + * # Use fields/names with care as they may be NULL. You must check +*/ + __pyx_r = PyDataType_ALIGNMENT(__pyx_v_self); + goto __pyx_L0; + + /* "C:/Users/runneradmin/AppData/Local/Temp/build-env-ej_q3m8u/Lib/site-packages/numpy/__init__.cython-30.pxd":246 + * return PyDataType_ELSIZE(self) + * + * @property # <<<<<<<<<<<<<< + * cdef inline npy_intp alignment(self) noexcept nogil: + * return PyDataType_ALIGNMENT(self) +*/ + + /* function exit code */ + __pyx_L0:; + return __pyx_r; +} + +/* "C:/Users/runneradmin/AppData/Local/Temp/build-env-ej_q3m8u/Lib/site-packages/numpy/__init__.cython-30.pxd":252 + * # Use fields/names with care as they may be NULL. You must check + * # for this using PyDataType_HASFIELDS. + * @property # <<<<<<<<<<<<<< + * cdef inline object fields(self): + * return PyDataType_FIELDS(self) +*/ + +static CYTHON_INLINE PyObject *__pyx_f_5numpy_5dtype_6fields_fields(PyArray_Descr *__pyx_v_self) { + PyObject *__pyx_r = NULL; + __Pyx_RefNannyDeclarations + PyObject *__pyx_t_1; + __Pyx_RefNannySetupContext("fields", 0); + + /* "C:/Users/runneradmin/AppData/Local/Temp/build-env-ej_q3m8u/Lib/site-packages/numpy/__init__.cython-30.pxd":254 + * @property + * cdef inline object fields(self): + * return PyDataType_FIELDS(self) # <<<<<<<<<<<<<< + * + * @property +*/ + __Pyx_XDECREF(__pyx_r); + __pyx_t_1 = PyDataType_FIELDS(__pyx_v_self); + __Pyx_INCREF(((PyObject *)__pyx_t_1)); + __pyx_r = ((PyObject *)__pyx_t_1); + goto __pyx_L0; + + /* "C:/Users/runneradmin/AppData/Local/Temp/build-env-ej_q3m8u/Lib/site-packages/numpy/__init__.cython-30.pxd":252 + * # Use fields/names with care as they may be NULL. You must check + * # for this using PyDataType_HASFIELDS. + * @property # <<<<<<<<<<<<<< + * cdef inline object fields(self): + * return PyDataType_FIELDS(self) +*/ + + /* function exit code */ + __pyx_L0:; + __Pyx_XGIVEREF(__pyx_r); + __Pyx_RefNannyFinishContext(); + return __pyx_r; +} + +/* "C:/Users/runneradmin/AppData/Local/Temp/build-env-ej_q3m8u/Lib/site-packages/numpy/__init__.cython-30.pxd":256 + * return PyDataType_FIELDS(self) + * + * @property # <<<<<<<<<<<<<< + * cdef inline tuple names(self): + * return PyDataType_NAMES(self) +*/ + +static CYTHON_INLINE PyObject *__pyx_f_5numpy_5dtype_5names_names(PyArray_Descr *__pyx_v_self) { + PyObject *__pyx_r = NULL; + __Pyx_RefNannyDeclarations + PyObject *__pyx_t_1; + __Pyx_RefNannySetupContext("names", 0); + + /* "C:/Users/runneradmin/AppData/Local/Temp/build-env-ej_q3m8u/Lib/site-packages/numpy/__init__.cython-30.pxd":258 + * @property + * cdef inline tuple names(self): + * return PyDataType_NAMES(self) # <<<<<<<<<<<<<< + * + * # Use PyDataType_HASSUBARRAY to test whether this field is +*/ + __Pyx_XDECREF(__pyx_r); + __pyx_t_1 = PyDataType_NAMES(__pyx_v_self); + __Pyx_INCREF(((PyObject*)__pyx_t_1)); + __pyx_r = ((PyObject*)__pyx_t_1); + goto __pyx_L0; + + /* "C:/Users/runneradmin/AppData/Local/Temp/build-env-ej_q3m8u/Lib/site-packages/numpy/__init__.cython-30.pxd":256 + * return PyDataType_FIELDS(self) + * + * @property # <<<<<<<<<<<<<< + * cdef inline tuple names(self): + * return PyDataType_NAMES(self) +*/ + + /* function exit code */ + __pyx_L0:; + __Pyx_XGIVEREF(__pyx_r); + __Pyx_RefNannyFinishContext(); + return __pyx_r; +} + +/* "C:/Users/runneradmin/AppData/Local/Temp/build-env-ej_q3m8u/Lib/site-packages/numpy/__init__.cython-30.pxd":263 + * # valid (the pointer can be NULL). Most users should access + * # this field via the inline helper method PyDataType_SHAPE. + * @property # <<<<<<<<<<<<<< + * cdef inline PyArray_ArrayDescr* subarray(self) noexcept nogil: + * return PyDataType_SUBARRAY(self) +*/ + +static CYTHON_INLINE PyArray_ArrayDescr *__pyx_f_5numpy_5dtype_8subarray_subarray(PyArray_Descr *__pyx_v_self) { + PyArray_ArrayDescr *__pyx_r; + + /* "C:/Users/runneradmin/AppData/Local/Temp/build-env-ej_q3m8u/Lib/site-packages/numpy/__init__.cython-30.pxd":265 + * @property + * cdef inline PyArray_ArrayDescr* subarray(self) noexcept nogil: + * return PyDataType_SUBARRAY(self) # <<<<<<<<<<<<<< + * + * @property +*/ + __pyx_r = PyDataType_SUBARRAY(__pyx_v_self); + goto __pyx_L0; + + /* "C:/Users/runneradmin/AppData/Local/Temp/build-env-ej_q3m8u/Lib/site-packages/numpy/__init__.cython-30.pxd":263 + * # valid (the pointer can be NULL). Most users should access + * # this field via the inline helper method PyDataType_SHAPE. + * @property # <<<<<<<<<<<<<< + * cdef inline PyArray_ArrayDescr* subarray(self) noexcept nogil: + * return PyDataType_SUBARRAY(self) +*/ + + /* function exit code */ + __pyx_L0:; + return __pyx_r; +} + +/* "C:/Users/runneradmin/AppData/Local/Temp/build-env-ej_q3m8u/Lib/site-packages/numpy/__init__.cython-30.pxd":267 + * return PyDataType_SUBARRAY(self) + * + * @property # <<<<<<<<<<<<<< + * cdef inline npy_uint64 flags(self) noexcept nogil: + * """The data types flags.""" +*/ + +static CYTHON_INLINE npy_uint64 __pyx_f_5numpy_5dtype_5flags_flags(PyArray_Descr *__pyx_v_self) { + npy_uint64 __pyx_r; + + /* "C:/Users/runneradmin/AppData/Local/Temp/build-env-ej_q3m8u/Lib/site-packages/numpy/__init__.cython-30.pxd":270 + * cdef inline npy_uint64 flags(self) noexcept nogil: + * """The data types flags.""" + * return PyDataType_FLAGS(self) # <<<<<<<<<<<<<< + * + * +*/ + __pyx_r = PyDataType_FLAGS(__pyx_v_self); + goto __pyx_L0; + + /* "C:/Users/runneradmin/AppData/Local/Temp/build-env-ej_q3m8u/Lib/site-packages/numpy/__init__.cython-30.pxd":267 + * return PyDataType_SUBARRAY(self) + * + * @property # <<<<<<<<<<<<<< + * cdef inline npy_uint64 flags(self) noexcept nogil: + * """The data types flags.""" +*/ + + /* function exit code */ + __pyx_L0:; + return __pyx_r; +} + +/* "C:/Users/runneradmin/AppData/Local/Temp/build-env-ej_q3m8u/Lib/site-packages/numpy/__init__.cython-30.pxd":279 + * ctypedef class numpy.broadcast [object PyArrayMultiIterObject, check_size ignore]: + * + * @property # <<<<<<<<<<<<<< + * cdef inline int numiter(self) noexcept nogil: + * """The number of arrays that need to be broadcast to the same shape.""" +*/ + +static CYTHON_INLINE int __pyx_f_5numpy_9broadcast_7numiter_numiter(PyArrayMultiIterObject *__pyx_v_self) { + int __pyx_r; + + /* "C:/Users/runneradmin/AppData/Local/Temp/build-env-ej_q3m8u/Lib/site-packages/numpy/__init__.cython-30.pxd":282 + * cdef inline int numiter(self) noexcept nogil: + * """The number of arrays that need to be broadcast to the same shape.""" + * return PyArray_MultiIter_NUMITER(self) # <<<<<<<<<<<<<< + * + * @property +*/ + __pyx_r = PyArray_MultiIter_NUMITER(__pyx_v_self); + goto __pyx_L0; + + /* "C:/Users/runneradmin/AppData/Local/Temp/build-env-ej_q3m8u/Lib/site-packages/numpy/__init__.cython-30.pxd":279 + * ctypedef class numpy.broadcast [object PyArrayMultiIterObject, check_size ignore]: + * + * @property # <<<<<<<<<<<<<< + * cdef inline int numiter(self) noexcept nogil: + * """The number of arrays that need to be broadcast to the same shape.""" +*/ + + /* function exit code */ + __pyx_L0:; + return __pyx_r; +} + +/* "C:/Users/runneradmin/AppData/Local/Temp/build-env-ej_q3m8u/Lib/site-packages/numpy/__init__.cython-30.pxd":284 + * return PyArray_MultiIter_NUMITER(self) + * + * @property # <<<<<<<<<<<<<< + * cdef inline npy_intp size(self) noexcept nogil: + * """The total broadcasted size.""" +*/ + +static CYTHON_INLINE npy_intp __pyx_f_5numpy_9broadcast_4size_size(PyArrayMultiIterObject *__pyx_v_self) { + npy_intp __pyx_r; + + /* "C:/Users/runneradmin/AppData/Local/Temp/build-env-ej_q3m8u/Lib/site-packages/numpy/__init__.cython-30.pxd":287 + * cdef inline npy_intp size(self) noexcept nogil: + * """The total broadcasted size.""" + * return PyArray_MultiIter_SIZE(self) # <<<<<<<<<<<<<< + * + * @property +*/ + __pyx_r = PyArray_MultiIter_SIZE(__pyx_v_self); + goto __pyx_L0; + + /* "C:/Users/runneradmin/AppData/Local/Temp/build-env-ej_q3m8u/Lib/site-packages/numpy/__init__.cython-30.pxd":284 + * return PyArray_MultiIter_NUMITER(self) + * + * @property # <<<<<<<<<<<<<< + * cdef inline npy_intp size(self) noexcept nogil: + * """The total broadcasted size.""" +*/ + + /* function exit code */ + __pyx_L0:; + return __pyx_r; +} + +/* "C:/Users/runneradmin/AppData/Local/Temp/build-env-ej_q3m8u/Lib/site-packages/numpy/__init__.cython-30.pxd":289 + * return PyArray_MultiIter_SIZE(self) + * + * @property # <<<<<<<<<<<<<< + * cdef inline npy_intp index(self) noexcept nogil: + * """The current (1-d) index into the broadcasted result.""" +*/ + +static CYTHON_INLINE npy_intp __pyx_f_5numpy_9broadcast_5index_index(PyArrayMultiIterObject *__pyx_v_self) { + npy_intp __pyx_r; + + /* "C:/Users/runneradmin/AppData/Local/Temp/build-env-ej_q3m8u/Lib/site-packages/numpy/__init__.cython-30.pxd":292 + * cdef inline npy_intp index(self) noexcept nogil: + * """The current (1-d) index into the broadcasted result.""" + * return PyArray_MultiIter_INDEX(self) # <<<<<<<<<<<<<< + * + * @property +*/ + __pyx_r = PyArray_MultiIter_INDEX(__pyx_v_self); + goto __pyx_L0; + + /* "C:/Users/runneradmin/AppData/Local/Temp/build-env-ej_q3m8u/Lib/site-packages/numpy/__init__.cython-30.pxd":289 + * return PyArray_MultiIter_SIZE(self) + * + * @property # <<<<<<<<<<<<<< + * cdef inline npy_intp index(self) noexcept nogil: + * """The current (1-d) index into the broadcasted result.""" +*/ + + /* function exit code */ + __pyx_L0:; + return __pyx_r; +} + +/* "C:/Users/runneradmin/AppData/Local/Temp/build-env-ej_q3m8u/Lib/site-packages/numpy/__init__.cython-30.pxd":294 + * return PyArray_MultiIter_INDEX(self) + * + * @property # <<<<<<<<<<<<<< + * cdef inline int nd(self) noexcept nogil: + * """The number of dimensions in the broadcasted result.""" +*/ + +static CYTHON_INLINE int __pyx_f_5numpy_9broadcast_2nd_nd(PyArrayMultiIterObject *__pyx_v_self) { + int __pyx_r; + + /* "C:/Users/runneradmin/AppData/Local/Temp/build-env-ej_q3m8u/Lib/site-packages/numpy/__init__.cython-30.pxd":297 + * cdef inline int nd(self) noexcept nogil: + * """The number of dimensions in the broadcasted result.""" + * return PyArray_MultiIter_NDIM(self) # <<<<<<<<<<<<<< + * + * @property +*/ + __pyx_r = PyArray_MultiIter_NDIM(__pyx_v_self); + goto __pyx_L0; + + /* "C:/Users/runneradmin/AppData/Local/Temp/build-env-ej_q3m8u/Lib/site-packages/numpy/__init__.cython-30.pxd":294 + * return PyArray_MultiIter_INDEX(self) + * + * @property # <<<<<<<<<<<<<< + * cdef inline int nd(self) noexcept nogil: + * """The number of dimensions in the broadcasted result.""" +*/ + + /* function exit code */ + __pyx_L0:; + return __pyx_r; +} + +/* "C:/Users/runneradmin/AppData/Local/Temp/build-env-ej_q3m8u/Lib/site-packages/numpy/__init__.cython-30.pxd":299 + * return PyArray_MultiIter_NDIM(self) + * + * @property # <<<<<<<<<<<<<< + * cdef inline npy_intp* dimensions(self) noexcept nogil: + * """The shape of the broadcasted result.""" +*/ + +static CYTHON_INLINE npy_intp *__pyx_f_5numpy_9broadcast_10dimensions_dimensions(PyArrayMultiIterObject *__pyx_v_self) { + npy_intp *__pyx_r; + + /* "C:/Users/runneradmin/AppData/Local/Temp/build-env-ej_q3m8u/Lib/site-packages/numpy/__init__.cython-30.pxd":302 + * cdef inline npy_intp* dimensions(self) noexcept nogil: + * """The shape of the broadcasted result.""" + * return PyArray_MultiIter_DIMS(self) # <<<<<<<<<<<<<< + * + * @property +*/ + __pyx_r = PyArray_MultiIter_DIMS(__pyx_v_self); + goto __pyx_L0; + + /* "C:/Users/runneradmin/AppData/Local/Temp/build-env-ej_q3m8u/Lib/site-packages/numpy/__init__.cython-30.pxd":299 + * return PyArray_MultiIter_NDIM(self) + * + * @property # <<<<<<<<<<<<<< + * cdef inline npy_intp* dimensions(self) noexcept nogil: + * """The shape of the broadcasted result.""" +*/ + + /* function exit code */ + __pyx_L0:; + return __pyx_r; +} + +/* "C:/Users/runneradmin/AppData/Local/Temp/build-env-ej_q3m8u/Lib/site-packages/numpy/__init__.cython-30.pxd":304 + * return PyArray_MultiIter_DIMS(self) + * + * @property # <<<<<<<<<<<<<< + * cdef inline void** iters(self) noexcept nogil: + * """An array of iterator objects that holds the iterators for the arrays to be broadcast together. +*/ + +static CYTHON_INLINE void **__pyx_f_5numpy_9broadcast_5iters_iters(PyArrayMultiIterObject *__pyx_v_self) { + void **__pyx_r; + + /* "C:/Users/runneradmin/AppData/Local/Temp/build-env-ej_q3m8u/Lib/site-packages/numpy/__init__.cython-30.pxd":308 + * """An array of iterator objects that holds the iterators for the arrays to be broadcast together. + * On return, the iterators are adjusted for broadcasting.""" + * return PyArray_MultiIter_ITERS(self) # <<<<<<<<<<<<<< + * + * +*/ + __pyx_r = PyArray_MultiIter_ITERS(__pyx_v_self); + goto __pyx_L0; + + /* "C:/Users/runneradmin/AppData/Local/Temp/build-env-ej_q3m8u/Lib/site-packages/numpy/__init__.cython-30.pxd":304 + * return PyArray_MultiIter_DIMS(self) + * + * @property # <<<<<<<<<<<<<< + * cdef inline void** iters(self) noexcept nogil: + * """An array of iterator objects that holds the iterators for the arrays to be broadcast together. +*/ + + /* function exit code */ + __pyx_L0:; + return __pyx_r; +} + +/* "C:/Users/runneradmin/AppData/Local/Temp/build-env-ej_q3m8u/Lib/site-packages/numpy/__init__.cython-30.pxd":322 + * # Instead, we use properties that map to the corresponding C-API functions. + * + * @property # <<<<<<<<<<<<<< + * cdef inline PyObject* base(self) noexcept nogil: + * """Returns a borrowed reference to the object owning the data/memory. +*/ + +static CYTHON_INLINE PyObject *__pyx_f_5numpy_7ndarray_4base_base(PyArrayObject *__pyx_v_self) { + PyObject *__pyx_r; + + /* "C:/Users/runneradmin/AppData/Local/Temp/build-env-ej_q3m8u/Lib/site-packages/numpy/__init__.cython-30.pxd":326 + * """Returns a borrowed reference to the object owning the data/memory. + * """ + * return PyArray_BASE(self) # <<<<<<<<<<<<<< + * + * @property +*/ + __pyx_r = PyArray_BASE(__pyx_v_self); + goto __pyx_L0; + + /* "C:/Users/runneradmin/AppData/Local/Temp/build-env-ej_q3m8u/Lib/site-packages/numpy/__init__.cython-30.pxd":322 + * # Instead, we use properties that map to the corresponding C-API functions. + * + * @property # <<<<<<<<<<<<<< + * cdef inline PyObject* base(self) noexcept nogil: + * """Returns a borrowed reference to the object owning the data/memory. +*/ + + /* function exit code */ + __pyx_L0:; + return __pyx_r; +} + +/* "C:/Users/runneradmin/AppData/Local/Temp/build-env-ej_q3m8u/Lib/site-packages/numpy/__init__.cython-30.pxd":328 + * return PyArray_BASE(self) + * + * @property # <<<<<<<<<<<<<< + * cdef inline dtype descr(self): + * """Returns an owned reference to the dtype of the array. +*/ + +static CYTHON_INLINE PyArray_Descr *__pyx_f_5numpy_7ndarray_5descr_descr(PyArrayObject *__pyx_v_self) { + PyArray_Descr *__pyx_r = NULL; + __Pyx_RefNannyDeclarations + PyArray_Descr *__pyx_t_1; + __Pyx_RefNannySetupContext("descr", 0); + + /* "C:/Users/runneradmin/AppData/Local/Temp/build-env-ej_q3m8u/Lib/site-packages/numpy/__init__.cython-30.pxd":332 + * """Returns an owned reference to the dtype of the array. + * """ + * return PyArray_DESCR(self) # <<<<<<<<<<<<<< + * + * @property +*/ + __Pyx_XDECREF((PyObject *)__pyx_r); + __pyx_t_1 = PyArray_DESCR(__pyx_v_self); + __Pyx_INCREF((PyObject *)((PyArray_Descr *)__pyx_t_1)); + __pyx_r = ((PyArray_Descr *)__pyx_t_1); + goto __pyx_L0; + + /* "C:/Users/runneradmin/AppData/Local/Temp/build-env-ej_q3m8u/Lib/site-packages/numpy/__init__.cython-30.pxd":328 + * return PyArray_BASE(self) + * + * @property # <<<<<<<<<<<<<< + * cdef inline dtype descr(self): + * """Returns an owned reference to the dtype of the array. +*/ + + /* function exit code */ + __pyx_L0:; + __Pyx_XGIVEREF((PyObject *)__pyx_r); + __Pyx_RefNannyFinishContext(); + return __pyx_r; +} + +/* "C:/Users/runneradmin/AppData/Local/Temp/build-env-ej_q3m8u/Lib/site-packages/numpy/__init__.cython-30.pxd":334 + * return PyArray_DESCR(self) + * + * @property # <<<<<<<<<<<<<< + * cdef inline int ndim(self) noexcept nogil: + * """Returns the number of dimensions in the array. +*/ + +static CYTHON_INLINE int __pyx_f_5numpy_7ndarray_4ndim_ndim(PyArrayObject *__pyx_v_self) { + int __pyx_r; + + /* "C:/Users/runneradmin/AppData/Local/Temp/build-env-ej_q3m8u/Lib/site-packages/numpy/__init__.cython-30.pxd":338 + * """Returns the number of dimensions in the array. + * """ + * return PyArray_NDIM(self) # <<<<<<<<<<<<<< + * + * @property +*/ + __pyx_r = PyArray_NDIM(__pyx_v_self); + goto __pyx_L0; + + /* "C:/Users/runneradmin/AppData/Local/Temp/build-env-ej_q3m8u/Lib/site-packages/numpy/__init__.cython-30.pxd":334 + * return PyArray_DESCR(self) + * + * @property # <<<<<<<<<<<<<< + * cdef inline int ndim(self) noexcept nogil: + * """Returns the number of dimensions in the array. +*/ + + /* function exit code */ + __pyx_L0:; + return __pyx_r; +} + +/* "C:/Users/runneradmin/AppData/Local/Temp/build-env-ej_q3m8u/Lib/site-packages/numpy/__init__.cython-30.pxd":340 + * return PyArray_NDIM(self) + * + * @property # <<<<<<<<<<<<<< + * cdef inline npy_intp *shape(self) noexcept nogil: + * """Returns a pointer to the dimensions/shape of the array. +*/ + +static CYTHON_INLINE npy_intp *__pyx_f_5numpy_7ndarray_5shape_shape(PyArrayObject *__pyx_v_self) { + npy_intp *__pyx_r; + + /* "C:/Users/runneradmin/AppData/Local/Temp/build-env-ej_q3m8u/Lib/site-packages/numpy/__init__.cython-30.pxd":346 + * Can return NULL for 0-dimensional arrays. + * """ + * return PyArray_DIMS(self) # <<<<<<<<<<<<<< + * + * @property +*/ + __pyx_r = PyArray_DIMS(__pyx_v_self); + goto __pyx_L0; + + /* "C:/Users/runneradmin/AppData/Local/Temp/build-env-ej_q3m8u/Lib/site-packages/numpy/__init__.cython-30.pxd":340 + * return PyArray_NDIM(self) + * + * @property # <<<<<<<<<<<<<< + * cdef inline npy_intp *shape(self) noexcept nogil: + * """Returns a pointer to the dimensions/shape of the array. +*/ + + /* function exit code */ + __pyx_L0:; + return __pyx_r; +} + +/* "C:/Users/runneradmin/AppData/Local/Temp/build-env-ej_q3m8u/Lib/site-packages/numpy/__init__.cython-30.pxd":348 + * return PyArray_DIMS(self) + * + * @property # <<<<<<<<<<<<<< + * cdef inline npy_intp *strides(self) noexcept nogil: + * """Returns a pointer to the strides of the array. +*/ + +static CYTHON_INLINE npy_intp *__pyx_f_5numpy_7ndarray_7strides_strides(PyArrayObject *__pyx_v_self) { + npy_intp *__pyx_r; + + /* "C:/Users/runneradmin/AppData/Local/Temp/build-env-ej_q3m8u/Lib/site-packages/numpy/__init__.cython-30.pxd":353 + * The number of elements matches the number of dimensions of the array (ndim). + * """ + * return PyArray_STRIDES(self) # <<<<<<<<<<<<<< + * + * @property +*/ + __pyx_r = PyArray_STRIDES(__pyx_v_self); + goto __pyx_L0; + + /* "C:/Users/runneradmin/AppData/Local/Temp/build-env-ej_q3m8u/Lib/site-packages/numpy/__init__.cython-30.pxd":348 + * return PyArray_DIMS(self) + * + * @property # <<<<<<<<<<<<<< + * cdef inline npy_intp *strides(self) noexcept nogil: + * """Returns a pointer to the strides of the array. +*/ + + /* function exit code */ + __pyx_L0:; + return __pyx_r; +} + +/* "C:/Users/runneradmin/AppData/Local/Temp/build-env-ej_q3m8u/Lib/site-packages/numpy/__init__.cython-30.pxd":355 + * return PyArray_STRIDES(self) + * + * @property # <<<<<<<<<<<<<< + * cdef inline npy_intp size(self) noexcept nogil: + * """Returns the total size (in number of elements) of the array. +*/ + +static CYTHON_INLINE npy_intp __pyx_f_5numpy_7ndarray_4size_size(PyArrayObject *__pyx_v_self) { + npy_intp __pyx_r; + + /* "C:/Users/runneradmin/AppData/Local/Temp/build-env-ej_q3m8u/Lib/site-packages/numpy/__init__.cython-30.pxd":359 + * """Returns the total size (in number of elements) of the array. + * """ + * return PyArray_SIZE(self) # <<<<<<<<<<<<<< + * + * @property +*/ + __pyx_r = PyArray_SIZE(__pyx_v_self); + goto __pyx_L0; + + /* "C:/Users/runneradmin/AppData/Local/Temp/build-env-ej_q3m8u/Lib/site-packages/numpy/__init__.cython-30.pxd":355 + * return PyArray_STRIDES(self) + * + * @property # <<<<<<<<<<<<<< + * cdef inline npy_intp size(self) noexcept nogil: + * """Returns the total size (in number of elements) of the array. +*/ + + /* function exit code */ + __pyx_L0:; + return __pyx_r; +} + +/* "C:/Users/runneradmin/AppData/Local/Temp/build-env-ej_q3m8u/Lib/site-packages/numpy/__init__.cython-30.pxd":361 + * return PyArray_SIZE(self) + * + * @property # <<<<<<<<<<<<<< + * cdef inline char* data(self) noexcept nogil: + * """The pointer to the data buffer as a char*. +*/ + +static CYTHON_INLINE char *__pyx_f_5numpy_7ndarray_4data_data(PyArrayObject *__pyx_v_self) { + char *__pyx_r; + + /* "C:/Users/runneradmin/AppData/Local/Temp/build-env-ej_q3m8u/Lib/site-packages/numpy/__init__.cython-30.pxd":368 + * of `PyArray_DATA()` instead, which returns a 'void*'. + * """ + * return PyArray_BYTES(self) # <<<<<<<<<<<<<< + * + * +*/ + __pyx_r = PyArray_BYTES(__pyx_v_self); + goto __pyx_L0; + + /* "C:/Users/runneradmin/AppData/Local/Temp/build-env-ej_q3m8u/Lib/site-packages/numpy/__init__.cython-30.pxd":361 + * return PyArray_SIZE(self) + * + * @property # <<<<<<<<<<<<<< + * cdef inline char* data(self) noexcept nogil: + * """The pointer to the data buffer as a char*. +*/ + + /* function exit code */ + __pyx_L0:; + return __pyx_r; +} + +/* "C:/Users/runneradmin/AppData/Local/Temp/build-env-ej_q3m8u/Lib/site-packages/numpy/__init__.cython-30.pxd":776 + * ctypedef long double complex clongdouble_t + * + * cdef inline object PyArray_MultiIterNew1(a): # <<<<<<<<<<<<<< + * return PyArray_MultiIterNew(1, a) + * +*/ + +static CYTHON_INLINE PyObject *__pyx_f_5numpy_PyArray_MultiIterNew1(PyObject *__pyx_v_a) { + PyObject *__pyx_r = NULL; + __Pyx_RefNannyDeclarations + PyObject *__pyx_t_1 = NULL; + int __pyx_lineno = 0; + const char *__pyx_filename = NULL; + int __pyx_clineno = 0; + __Pyx_RefNannySetupContext("PyArray_MultiIterNew1", 0); + + /* "C:/Users/runneradmin/AppData/Local/Temp/build-env-ej_q3m8u/Lib/site-packages/numpy/__init__.cython-30.pxd":777 + * + * cdef inline object PyArray_MultiIterNew1(a): + * return PyArray_MultiIterNew(1, a) # <<<<<<<<<<<<<< + * + * cdef inline object PyArray_MultiIterNew2(a, b): +*/ + __Pyx_XDECREF(__pyx_r); + __pyx_t_1 = PyArray_MultiIterNew(1, ((void *)__pyx_v_a)); if (unlikely(!__pyx_t_1)) __PYX_ERR(2, 777, __pyx_L1_error) + __Pyx_GOTREF(__pyx_t_1); + __pyx_r = __pyx_t_1; + __pyx_t_1 = 0; + goto __pyx_L0; + + /* "C:/Users/runneradmin/AppData/Local/Temp/build-env-ej_q3m8u/Lib/site-packages/numpy/__init__.cython-30.pxd":776 + * ctypedef long double complex clongdouble_t + * + * cdef inline object PyArray_MultiIterNew1(a): # <<<<<<<<<<<<<< + * return PyArray_MultiIterNew(1, a) + * +*/ + + /* function exit code */ + __pyx_L1_error:; + __Pyx_XDECREF(__pyx_t_1); + __Pyx_AddTraceback("numpy.PyArray_MultiIterNew1", __pyx_clineno, __pyx_lineno, __pyx_filename); + __pyx_r = 0; + __pyx_L0:; + __Pyx_XGIVEREF(__pyx_r); + __Pyx_RefNannyFinishContext(); + return __pyx_r; +} + +/* "C:/Users/runneradmin/AppData/Local/Temp/build-env-ej_q3m8u/Lib/site-packages/numpy/__init__.cython-30.pxd":779 + * return PyArray_MultiIterNew(1, a) + * + * cdef inline object PyArray_MultiIterNew2(a, b): # <<<<<<<<<<<<<< + * return PyArray_MultiIterNew(2, a, b) + * +*/ + +static CYTHON_INLINE PyObject *__pyx_f_5numpy_PyArray_MultiIterNew2(PyObject *__pyx_v_a, PyObject *__pyx_v_b) { + PyObject *__pyx_r = NULL; + __Pyx_RefNannyDeclarations + PyObject *__pyx_t_1 = NULL; + int __pyx_lineno = 0; + const char *__pyx_filename = NULL; + int __pyx_clineno = 0; + __Pyx_RefNannySetupContext("PyArray_MultiIterNew2", 0); + + /* "C:/Users/runneradmin/AppData/Local/Temp/build-env-ej_q3m8u/Lib/site-packages/numpy/__init__.cython-30.pxd":780 + * + * cdef inline object PyArray_MultiIterNew2(a, b): + * return PyArray_MultiIterNew(2, a, b) # <<<<<<<<<<<<<< + * + * cdef inline object PyArray_MultiIterNew3(a, b, c): +*/ + __Pyx_XDECREF(__pyx_r); + __pyx_t_1 = PyArray_MultiIterNew(2, ((void *)__pyx_v_a), ((void *)__pyx_v_b)); if (unlikely(!__pyx_t_1)) __PYX_ERR(2, 780, __pyx_L1_error) + __Pyx_GOTREF(__pyx_t_1); + __pyx_r = __pyx_t_1; + __pyx_t_1 = 0; + goto __pyx_L0; + + /* "C:/Users/runneradmin/AppData/Local/Temp/build-env-ej_q3m8u/Lib/site-packages/numpy/__init__.cython-30.pxd":779 + * return PyArray_MultiIterNew(1, a) + * + * cdef inline object PyArray_MultiIterNew2(a, b): # <<<<<<<<<<<<<< + * return PyArray_MultiIterNew(2, a, b) + * +*/ + + /* function exit code */ + __pyx_L1_error:; + __Pyx_XDECREF(__pyx_t_1); + __Pyx_AddTraceback("numpy.PyArray_MultiIterNew2", __pyx_clineno, __pyx_lineno, __pyx_filename); + __pyx_r = 0; + __pyx_L0:; + __Pyx_XGIVEREF(__pyx_r); + __Pyx_RefNannyFinishContext(); + return __pyx_r; +} + +/* "C:/Users/runneradmin/AppData/Local/Temp/build-env-ej_q3m8u/Lib/site-packages/numpy/__init__.cython-30.pxd":782 + * return PyArray_MultiIterNew(2, a, b) + * + * cdef inline object PyArray_MultiIterNew3(a, b, c): # <<<<<<<<<<<<<< + * return PyArray_MultiIterNew(3, a, b, c) + * +*/ + +static CYTHON_INLINE PyObject *__pyx_f_5numpy_PyArray_MultiIterNew3(PyObject *__pyx_v_a, PyObject *__pyx_v_b, PyObject *__pyx_v_c) { + PyObject *__pyx_r = NULL; + __Pyx_RefNannyDeclarations + PyObject *__pyx_t_1 = NULL; + int __pyx_lineno = 0; + const char *__pyx_filename = NULL; + int __pyx_clineno = 0; + __Pyx_RefNannySetupContext("PyArray_MultiIterNew3", 0); + + /* "C:/Users/runneradmin/AppData/Local/Temp/build-env-ej_q3m8u/Lib/site-packages/numpy/__init__.cython-30.pxd":783 + * + * cdef inline object PyArray_MultiIterNew3(a, b, c): + * return PyArray_MultiIterNew(3, a, b, c) # <<<<<<<<<<<<<< + * + * cdef inline object PyArray_MultiIterNew4(a, b, c, d): +*/ + __Pyx_XDECREF(__pyx_r); + __pyx_t_1 = PyArray_MultiIterNew(3, ((void *)__pyx_v_a), ((void *)__pyx_v_b), ((void *)__pyx_v_c)); if (unlikely(!__pyx_t_1)) __PYX_ERR(2, 783, __pyx_L1_error) + __Pyx_GOTREF(__pyx_t_1); + __pyx_r = __pyx_t_1; + __pyx_t_1 = 0; + goto __pyx_L0; + + /* "C:/Users/runneradmin/AppData/Local/Temp/build-env-ej_q3m8u/Lib/site-packages/numpy/__init__.cython-30.pxd":782 + * return PyArray_MultiIterNew(2, a, b) + * + * cdef inline object PyArray_MultiIterNew3(a, b, c): # <<<<<<<<<<<<<< + * return PyArray_MultiIterNew(3, a, b, c) + * +*/ + + /* function exit code */ + __pyx_L1_error:; + __Pyx_XDECREF(__pyx_t_1); + __Pyx_AddTraceback("numpy.PyArray_MultiIterNew3", __pyx_clineno, __pyx_lineno, __pyx_filename); + __pyx_r = 0; + __pyx_L0:; + __Pyx_XGIVEREF(__pyx_r); + __Pyx_RefNannyFinishContext(); + return __pyx_r; +} + +/* "C:/Users/runneradmin/AppData/Local/Temp/build-env-ej_q3m8u/Lib/site-packages/numpy/__init__.cython-30.pxd":785 + * return PyArray_MultiIterNew(3, a, b, c) + * + * cdef inline object PyArray_MultiIterNew4(a, b, c, d): # <<<<<<<<<<<<<< + * return PyArray_MultiIterNew(4, a, b, c, d) + * +*/ + +static CYTHON_INLINE PyObject *__pyx_f_5numpy_PyArray_MultiIterNew4(PyObject *__pyx_v_a, PyObject *__pyx_v_b, PyObject *__pyx_v_c, PyObject *__pyx_v_d) { + PyObject *__pyx_r = NULL; + __Pyx_RefNannyDeclarations + PyObject *__pyx_t_1 = NULL; + int __pyx_lineno = 0; + const char *__pyx_filename = NULL; + int __pyx_clineno = 0; + __Pyx_RefNannySetupContext("PyArray_MultiIterNew4", 0); + + /* "C:/Users/runneradmin/AppData/Local/Temp/build-env-ej_q3m8u/Lib/site-packages/numpy/__init__.cython-30.pxd":786 + * + * cdef inline object PyArray_MultiIterNew4(a, b, c, d): + * return PyArray_MultiIterNew(4, a, b, c, d) # <<<<<<<<<<<<<< + * + * cdef inline object PyArray_MultiIterNew5(a, b, c, d, e): +*/ + __Pyx_XDECREF(__pyx_r); + __pyx_t_1 = PyArray_MultiIterNew(4, ((void *)__pyx_v_a), ((void *)__pyx_v_b), ((void *)__pyx_v_c), ((void *)__pyx_v_d)); if (unlikely(!__pyx_t_1)) __PYX_ERR(2, 786, __pyx_L1_error) + __Pyx_GOTREF(__pyx_t_1); + __pyx_r = __pyx_t_1; + __pyx_t_1 = 0; + goto __pyx_L0; + + /* "C:/Users/runneradmin/AppData/Local/Temp/build-env-ej_q3m8u/Lib/site-packages/numpy/__init__.cython-30.pxd":785 + * return PyArray_MultiIterNew(3, a, b, c) + * + * cdef inline object PyArray_MultiIterNew4(a, b, c, d): # <<<<<<<<<<<<<< + * return PyArray_MultiIterNew(4, a, b, c, d) + * +*/ + + /* function exit code */ + __pyx_L1_error:; + __Pyx_XDECREF(__pyx_t_1); + __Pyx_AddTraceback("numpy.PyArray_MultiIterNew4", __pyx_clineno, __pyx_lineno, __pyx_filename); + __pyx_r = 0; + __pyx_L0:; + __Pyx_XGIVEREF(__pyx_r); + __Pyx_RefNannyFinishContext(); + return __pyx_r; +} + +/* "C:/Users/runneradmin/AppData/Local/Temp/build-env-ej_q3m8u/Lib/site-packages/numpy/__init__.cython-30.pxd":788 + * return PyArray_MultiIterNew(4, a, b, c, d) + * + * cdef inline object PyArray_MultiIterNew5(a, b, c, d, e): # <<<<<<<<<<<<<< + * return PyArray_MultiIterNew(5, a, b, c, d, e) + * +*/ + +static CYTHON_INLINE PyObject *__pyx_f_5numpy_PyArray_MultiIterNew5(PyObject *__pyx_v_a, PyObject *__pyx_v_b, PyObject *__pyx_v_c, PyObject *__pyx_v_d, PyObject *__pyx_v_e) { + PyObject *__pyx_r = NULL; + __Pyx_RefNannyDeclarations + PyObject *__pyx_t_1 = NULL; + int __pyx_lineno = 0; + const char *__pyx_filename = NULL; + int __pyx_clineno = 0; + __Pyx_RefNannySetupContext("PyArray_MultiIterNew5", 0); + + /* "C:/Users/runneradmin/AppData/Local/Temp/build-env-ej_q3m8u/Lib/site-packages/numpy/__init__.cython-30.pxd":789 + * + * cdef inline object PyArray_MultiIterNew5(a, b, c, d, e): + * return PyArray_MultiIterNew(5, a, b, c, d, e) # <<<<<<<<<<<<<< + * + * cdef inline tuple PyDataType_SHAPE(dtype d): +*/ + __Pyx_XDECREF(__pyx_r); + __pyx_t_1 = PyArray_MultiIterNew(5, ((void *)__pyx_v_a), ((void *)__pyx_v_b), ((void *)__pyx_v_c), ((void *)__pyx_v_d), ((void *)__pyx_v_e)); if (unlikely(!__pyx_t_1)) __PYX_ERR(2, 789, __pyx_L1_error) + __Pyx_GOTREF(__pyx_t_1); + __pyx_r = __pyx_t_1; + __pyx_t_1 = 0; + goto __pyx_L0; + + /* "C:/Users/runneradmin/AppData/Local/Temp/build-env-ej_q3m8u/Lib/site-packages/numpy/__init__.cython-30.pxd":788 + * return PyArray_MultiIterNew(4, a, b, c, d) + * + * cdef inline object PyArray_MultiIterNew5(a, b, c, d, e): # <<<<<<<<<<<<<< + * return PyArray_MultiIterNew(5, a, b, c, d, e) + * +*/ + + /* function exit code */ + __pyx_L1_error:; + __Pyx_XDECREF(__pyx_t_1); + __Pyx_AddTraceback("numpy.PyArray_MultiIterNew5", __pyx_clineno, __pyx_lineno, __pyx_filename); + __pyx_r = 0; + __pyx_L0:; + __Pyx_XGIVEREF(__pyx_r); + __Pyx_RefNannyFinishContext(); + return __pyx_r; +} + +/* "C:/Users/runneradmin/AppData/Local/Temp/build-env-ej_q3m8u/Lib/site-packages/numpy/__init__.cython-30.pxd":791 + * return PyArray_MultiIterNew(5, a, b, c, d, e) + * + * cdef inline tuple PyDataType_SHAPE(dtype d): # <<<<<<<<<<<<<< + * if PyDataType_HASSUBARRAY(d): + * return d.subarray.shape +*/ + +static CYTHON_INLINE PyObject *__pyx_f_5numpy_PyDataType_SHAPE(PyArray_Descr *__pyx_v_d) { + PyObject *__pyx_r = NULL; + __Pyx_RefNannyDeclarations + int __pyx_t_1; + PyObject *__pyx_t_2; + __Pyx_RefNannySetupContext("PyDataType_SHAPE", 0); + + /* "C:/Users/runneradmin/AppData/Local/Temp/build-env-ej_q3m8u/Lib/site-packages/numpy/__init__.cython-30.pxd":792 + * + * cdef inline tuple PyDataType_SHAPE(dtype d): + * if PyDataType_HASSUBARRAY(d): # <<<<<<<<<<<<<< + * return d.subarray.shape + * else: +*/ + __pyx_t_1 = PyDataType_HASSUBARRAY(__pyx_v_d); + if (__pyx_t_1) { + + /* "C:/Users/runneradmin/AppData/Local/Temp/build-env-ej_q3m8u/Lib/site-packages/numpy/__init__.cython-30.pxd":793 + * cdef inline tuple PyDataType_SHAPE(dtype d): + * if PyDataType_HASSUBARRAY(d): + * return d.subarray.shape # <<<<<<<<<<<<<< + * else: + * return () +*/ + __Pyx_XDECREF(__pyx_r); + __pyx_t_2 = __pyx_f_5numpy_5dtype_8subarray_subarray(__pyx_v_d)->shape; + __Pyx_INCREF(((PyObject*)__pyx_t_2)); + __pyx_r = ((PyObject*)__pyx_t_2); + goto __pyx_L0; + + /* "C:/Users/runneradmin/AppData/Local/Temp/build-env-ej_q3m8u/Lib/site-packages/numpy/__init__.cython-30.pxd":792 + * + * cdef inline tuple PyDataType_SHAPE(dtype d): + * if PyDataType_HASSUBARRAY(d): # <<<<<<<<<<<<<< + * return d.subarray.shape + * else: +*/ + } + + /* "C:/Users/runneradmin/AppData/Local/Temp/build-env-ej_q3m8u/Lib/site-packages/numpy/__init__.cython-30.pxd":795 + * return d.subarray.shape + * else: + * return () # <<<<<<<<<<<<<< + * + * +*/ + /*else*/ { + __Pyx_XDECREF(__pyx_r); + __Pyx_INCREF(__pyx_mstate_global->__pyx_empty_tuple); + __pyx_r = __pyx_mstate_global->__pyx_empty_tuple; + goto __pyx_L0; + } + + /* "C:/Users/runneradmin/AppData/Local/Temp/build-env-ej_q3m8u/Lib/site-packages/numpy/__init__.cython-30.pxd":791 + * return PyArray_MultiIterNew(5, a, b, c, d, e) + * + * cdef inline tuple PyDataType_SHAPE(dtype d): # <<<<<<<<<<<<<< + * if PyDataType_HASSUBARRAY(d): + * return d.subarray.shape +*/ + + /* function exit code */ + __pyx_L0:; + __Pyx_XGIVEREF(__pyx_r); + __Pyx_RefNannyFinishContext(); + return __pyx_r; +} + +/* "C:/Users/runneradmin/AppData/Local/Temp/build-env-ej_q3m8u/Lib/site-packages/numpy/__init__.cython-30.pxd":994 + * int _import_umath() except -1 + * + * cdef inline void set_array_base(ndarray arr, object base) except *: # <<<<<<<<<<<<<< + * Py_INCREF(base) # important to do this before stealing the reference below! + * PyArray_SetBaseObject(arr, base) +*/ + +static CYTHON_INLINE void __pyx_f_5numpy_set_array_base(PyArrayObject *__pyx_v_arr, PyObject *__pyx_v_base) { + int __pyx_t_1; + int __pyx_lineno = 0; + const char *__pyx_filename = NULL; + int __pyx_clineno = 0; + + /* "C:/Users/runneradmin/AppData/Local/Temp/build-env-ej_q3m8u/Lib/site-packages/numpy/__init__.cython-30.pxd":995 + * + * cdef inline void set_array_base(ndarray arr, object base) except *: + * Py_INCREF(base) # important to do this before stealing the reference below! # <<<<<<<<<<<<<< + * PyArray_SetBaseObject(arr, base) + * +*/ + Py_INCREF(__pyx_v_base); + + /* "C:/Users/runneradmin/AppData/Local/Temp/build-env-ej_q3m8u/Lib/site-packages/numpy/__init__.cython-30.pxd":996 + * cdef inline void set_array_base(ndarray arr, object base) except *: + * Py_INCREF(base) # important to do this before stealing the reference below! + * PyArray_SetBaseObject(arr, base) # <<<<<<<<<<<<<< + * + * cdef inline object get_array_base(ndarray arr): +*/ + __pyx_t_1 = PyArray_SetBaseObject(__pyx_v_arr, __pyx_v_base); if (unlikely(__pyx_t_1 == ((int)-1))) __PYX_ERR(2, 996, __pyx_L1_error) + + /* "C:/Users/runneradmin/AppData/Local/Temp/build-env-ej_q3m8u/Lib/site-packages/numpy/__init__.cython-30.pxd":994 + * int _import_umath() except -1 + * + * cdef inline void set_array_base(ndarray arr, object base) except *: # <<<<<<<<<<<<<< + * Py_INCREF(base) # important to do this before stealing the reference below! + * PyArray_SetBaseObject(arr, base) +*/ + + /* function exit code */ + goto __pyx_L0; + __pyx_L1_error:; + __Pyx_AddTraceback("numpy.set_array_base", __pyx_clineno, __pyx_lineno, __pyx_filename); + __pyx_L0:; +} + +/* "C:/Users/runneradmin/AppData/Local/Temp/build-env-ej_q3m8u/Lib/site-packages/numpy/__init__.cython-30.pxd":998 + * PyArray_SetBaseObject(arr, base) + * + * cdef inline object get_array_base(ndarray arr): # <<<<<<<<<<<<<< + * base = PyArray_BASE(arr) + * if base is NULL: +*/ + +static CYTHON_INLINE PyObject *__pyx_f_5numpy_get_array_base(PyArrayObject *__pyx_v_arr) { + PyObject *__pyx_v_base; + PyObject *__pyx_r = NULL; + __Pyx_RefNannyDeclarations + int __pyx_t_1; + __Pyx_RefNannySetupContext("get_array_base", 0); + + /* "C:/Users/runneradmin/AppData/Local/Temp/build-env-ej_q3m8u/Lib/site-packages/numpy/__init__.cython-30.pxd":999 + * + * cdef inline object get_array_base(ndarray arr): + * base = PyArray_BASE(arr) # <<<<<<<<<<<<<< + * if base is NULL: + * return None +*/ + __pyx_v_base = PyArray_BASE(__pyx_v_arr); + + /* "C:/Users/runneradmin/AppData/Local/Temp/build-env-ej_q3m8u/Lib/site-packages/numpy/__init__.cython-30.pxd":1000 + * cdef inline object get_array_base(ndarray arr): + * base = PyArray_BASE(arr) + * if base is NULL: # <<<<<<<<<<<<<< + * return None + * return base +*/ + __pyx_t_1 = (__pyx_v_base == NULL); + if (__pyx_t_1) { + + /* "C:/Users/runneradmin/AppData/Local/Temp/build-env-ej_q3m8u/Lib/site-packages/numpy/__init__.cython-30.pxd":1001 + * base = PyArray_BASE(arr) + * if base is NULL: + * return None # <<<<<<<<<<<<<< + * return base + * +*/ + __Pyx_XDECREF(__pyx_r); + __pyx_r = Py_None; __Pyx_INCREF(Py_None); + goto __pyx_L0; + + /* "C:/Users/runneradmin/AppData/Local/Temp/build-env-ej_q3m8u/Lib/site-packages/numpy/__init__.cython-30.pxd":1000 + * cdef inline object get_array_base(ndarray arr): + * base = PyArray_BASE(arr) + * if base is NULL: # <<<<<<<<<<<<<< + * return None + * return base +*/ + } + + /* "C:/Users/runneradmin/AppData/Local/Temp/build-env-ej_q3m8u/Lib/site-packages/numpy/__init__.cython-30.pxd":1002 + * if base is NULL: + * return None + * return base # <<<<<<<<<<<<<< + * + * # Versions of the import_* functions which are more suitable for +*/ + __Pyx_XDECREF(__pyx_r); + __Pyx_INCREF(((PyObject *)__pyx_v_base)); + __pyx_r = ((PyObject *)__pyx_v_base); + goto __pyx_L0; + + /* "C:/Users/runneradmin/AppData/Local/Temp/build-env-ej_q3m8u/Lib/site-packages/numpy/__init__.cython-30.pxd":998 + * PyArray_SetBaseObject(arr, base) + * + * cdef inline object get_array_base(ndarray arr): # <<<<<<<<<<<<<< + * base = PyArray_BASE(arr) + * if base is NULL: +*/ + + /* function exit code */ + __pyx_L0:; + __Pyx_XGIVEREF(__pyx_r); + __Pyx_RefNannyFinishContext(); + return __pyx_r; +} + +/* "C:/Users/runneradmin/AppData/Local/Temp/build-env-ej_q3m8u/Lib/site-packages/numpy/__init__.cython-30.pxd":1006 + * # Versions of the import_* functions which are more suitable for + * # Cython code. + * cdef inline int import_array() except -1: # <<<<<<<<<<<<<< + * try: + * __pyx_import_array() +*/ + +static CYTHON_INLINE int __pyx_f_5numpy_import_array(void) { + int __pyx_r; + __Pyx_RefNannyDeclarations + PyObject *__pyx_t_1 = NULL; + PyObject *__pyx_t_2 = NULL; + PyObject *__pyx_t_3 = NULL; + int __pyx_t_4; + PyObject *__pyx_t_5 = NULL; + PyObject *__pyx_t_6 = NULL; + PyObject *__pyx_t_7 = NULL; + PyObject *__pyx_t_8 = NULL; + PyObject *__pyx_t_9 = NULL; + size_t __pyx_t_10; + int __pyx_lineno = 0; + const char *__pyx_filename = NULL; + int __pyx_clineno = 0; + __Pyx_RefNannySetupContext("import_array", 0); + + /* "C:/Users/runneradmin/AppData/Local/Temp/build-env-ej_q3m8u/Lib/site-packages/numpy/__init__.cython-30.pxd":1007 + * # Cython code. + * cdef inline int import_array() except -1: + * try: # <<<<<<<<<<<<<< + * __pyx_import_array() + * except Exception: +*/ + { + __Pyx_PyThreadState_declare + __Pyx_PyThreadState_assign + __Pyx_ExceptionSave(&__pyx_t_1, &__pyx_t_2, &__pyx_t_3); + __Pyx_XGOTREF(__pyx_t_1); + __Pyx_XGOTREF(__pyx_t_2); + __Pyx_XGOTREF(__pyx_t_3); + /*try:*/ { + + /* "C:/Users/runneradmin/AppData/Local/Temp/build-env-ej_q3m8u/Lib/site-packages/numpy/__init__.cython-30.pxd":1008 + * cdef inline int import_array() except -1: + * try: + * __pyx_import_array() # <<<<<<<<<<<<<< + * except Exception: + * raise ImportError("numpy._core.multiarray failed to import") +*/ + __pyx_t_4 = _import_array(); if (unlikely(__pyx_t_4 == ((int)-1))) __PYX_ERR(2, 1008, __pyx_L3_error) + + /* "C:/Users/runneradmin/AppData/Local/Temp/build-env-ej_q3m8u/Lib/site-packages/numpy/__init__.cython-30.pxd":1007 + * # Cython code. + * cdef inline int import_array() except -1: + * try: # <<<<<<<<<<<<<< + * __pyx_import_array() + * except Exception: +*/ + } + __Pyx_XDECREF(__pyx_t_1); __pyx_t_1 = 0; + __Pyx_XDECREF(__pyx_t_2); __pyx_t_2 = 0; + __Pyx_XDECREF(__pyx_t_3); __pyx_t_3 = 0; + goto __pyx_L8_try_end; + __pyx_L3_error:; + + /* "C:/Users/runneradmin/AppData/Local/Temp/build-env-ej_q3m8u/Lib/site-packages/numpy/__init__.cython-30.pxd":1009 + * try: + * __pyx_import_array() + * except Exception: # <<<<<<<<<<<<<< + * raise ImportError("numpy._core.multiarray failed to import") + * +*/ + __pyx_t_4 = __Pyx_PyErr_ExceptionMatches(((PyObject *)(((PyTypeObject*)PyExc_Exception)))); + if (__pyx_t_4) { + __Pyx_AddTraceback("numpy.import_array", __pyx_clineno, __pyx_lineno, __pyx_filename); + if (__Pyx_GetException(&__pyx_t_5, &__pyx_t_6, &__pyx_t_7) < 0) __PYX_ERR(2, 1009, __pyx_L5_except_error) + __Pyx_XGOTREF(__pyx_t_5); + __Pyx_XGOTREF(__pyx_t_6); + __Pyx_XGOTREF(__pyx_t_7); + + /* "C:/Users/runneradmin/AppData/Local/Temp/build-env-ej_q3m8u/Lib/site-packages/numpy/__init__.cython-30.pxd":1010 + * __pyx_import_array() + * except Exception: + * raise ImportError("numpy._core.multiarray failed to import") # <<<<<<<<<<<<<< + * + * cdef inline int import_umath() except -1: +*/ + __pyx_t_9 = NULL; + __pyx_t_10 = 1; + { + PyObject *__pyx_callargs[2] = {__pyx_t_9, __pyx_mstate_global->__pyx_kp_u_numpy__core_multiarray_failed_to}; + __pyx_t_8 = __Pyx_PyObject_FastCall((PyObject*)(((PyTypeObject*)PyExc_ImportError)), __pyx_callargs+__pyx_t_10, (2-__pyx_t_10) | (__pyx_t_10*__Pyx_PY_VECTORCALL_ARGUMENTS_OFFSET)); + __Pyx_XDECREF(__pyx_t_9); __pyx_t_9 = 0; + if (unlikely(!__pyx_t_8)) __PYX_ERR(2, 1010, __pyx_L5_except_error) + __Pyx_GOTREF(__pyx_t_8); + } + __Pyx_Raise(__pyx_t_8, 0, 0, 0); + __Pyx_DECREF(__pyx_t_8); __pyx_t_8 = 0; + __PYX_ERR(2, 1010, __pyx_L5_except_error) + } + goto __pyx_L5_except_error; + + /* "C:/Users/runneradmin/AppData/Local/Temp/build-env-ej_q3m8u/Lib/site-packages/numpy/__init__.cython-30.pxd":1007 + * # Cython code. + * cdef inline int import_array() except -1: + * try: # <<<<<<<<<<<<<< + * __pyx_import_array() + * except Exception: +*/ + __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:; + } + + /* "C:/Users/runneradmin/AppData/Local/Temp/build-env-ej_q3m8u/Lib/site-packages/numpy/__init__.cython-30.pxd":1006 + * # Versions of the import_* functions which are more suitable for + * # Cython code. + * cdef inline int import_array() except -1: # <<<<<<<<<<<<<< + * try: + * __pyx_import_array() +*/ + + /* function exit code */ + __pyx_r = 0; + goto __pyx_L0; + __pyx_L1_error:; + __Pyx_XDECREF(__pyx_t_5); + __Pyx_XDECREF(__pyx_t_6); + __Pyx_XDECREF(__pyx_t_7); + __Pyx_XDECREF(__pyx_t_8); + __Pyx_XDECREF(__pyx_t_9); + __Pyx_AddTraceback("numpy.import_array", __pyx_clineno, __pyx_lineno, __pyx_filename); + __pyx_r = -1; + __pyx_L0:; + __Pyx_RefNannyFinishContext(); + return __pyx_r; +} + +/* "C:/Users/runneradmin/AppData/Local/Temp/build-env-ej_q3m8u/Lib/site-packages/numpy/__init__.cython-30.pxd":1012 + * raise ImportError("numpy._core.multiarray failed to import") + * + * cdef inline int import_umath() except -1: # <<<<<<<<<<<<<< + * try: + * _import_umath() +*/ + +static CYTHON_INLINE int __pyx_f_5numpy_import_umath(void) { + int __pyx_r; + __Pyx_RefNannyDeclarations + PyObject *__pyx_t_1 = NULL; + PyObject *__pyx_t_2 = NULL; + PyObject *__pyx_t_3 = NULL; + int __pyx_t_4; + PyObject *__pyx_t_5 = NULL; + PyObject *__pyx_t_6 = NULL; + PyObject *__pyx_t_7 = NULL; + PyObject *__pyx_t_8 = NULL; + PyObject *__pyx_t_9 = NULL; + size_t __pyx_t_10; + int __pyx_lineno = 0; + const char *__pyx_filename = NULL; + int __pyx_clineno = 0; + __Pyx_RefNannySetupContext("import_umath", 0); + + /* "C:/Users/runneradmin/AppData/Local/Temp/build-env-ej_q3m8u/Lib/site-packages/numpy/__init__.cython-30.pxd":1013 + * + * cdef inline int import_umath() except -1: + * try: # <<<<<<<<<<<<<< + * _import_umath() + * except Exception: +*/ + { + __Pyx_PyThreadState_declare + __Pyx_PyThreadState_assign + __Pyx_ExceptionSave(&__pyx_t_1, &__pyx_t_2, &__pyx_t_3); + __Pyx_XGOTREF(__pyx_t_1); + __Pyx_XGOTREF(__pyx_t_2); + __Pyx_XGOTREF(__pyx_t_3); + /*try:*/ { + + /* "C:/Users/runneradmin/AppData/Local/Temp/build-env-ej_q3m8u/Lib/site-packages/numpy/__init__.cython-30.pxd":1014 + * cdef inline int import_umath() except -1: + * try: + * _import_umath() # <<<<<<<<<<<<<< + * except Exception: + * raise ImportError("numpy._core.umath failed to import") +*/ + __pyx_t_4 = _import_umath(); if (unlikely(__pyx_t_4 == ((int)-1))) __PYX_ERR(2, 1014, __pyx_L3_error) + + /* "C:/Users/runneradmin/AppData/Local/Temp/build-env-ej_q3m8u/Lib/site-packages/numpy/__init__.cython-30.pxd":1013 + * + * cdef inline int import_umath() except -1: + * try: # <<<<<<<<<<<<<< + * _import_umath() + * except Exception: +*/ + } + __Pyx_XDECREF(__pyx_t_1); __pyx_t_1 = 0; + __Pyx_XDECREF(__pyx_t_2); __pyx_t_2 = 0; + __Pyx_XDECREF(__pyx_t_3); __pyx_t_3 = 0; + goto __pyx_L8_try_end; + __pyx_L3_error:; + + /* "C:/Users/runneradmin/AppData/Local/Temp/build-env-ej_q3m8u/Lib/site-packages/numpy/__init__.cython-30.pxd":1015 + * try: + * _import_umath() + * except Exception: # <<<<<<<<<<<<<< + * raise ImportError("numpy._core.umath failed to import") + * +*/ + __pyx_t_4 = __Pyx_PyErr_ExceptionMatches(((PyObject *)(((PyTypeObject*)PyExc_Exception)))); + if (__pyx_t_4) { + __Pyx_AddTraceback("numpy.import_umath", __pyx_clineno, __pyx_lineno, __pyx_filename); + if (__Pyx_GetException(&__pyx_t_5, &__pyx_t_6, &__pyx_t_7) < 0) __PYX_ERR(2, 1015, __pyx_L5_except_error) + __Pyx_XGOTREF(__pyx_t_5); + __Pyx_XGOTREF(__pyx_t_6); + __Pyx_XGOTREF(__pyx_t_7); + + /* "C:/Users/runneradmin/AppData/Local/Temp/build-env-ej_q3m8u/Lib/site-packages/numpy/__init__.cython-30.pxd":1016 + * _import_umath() + * except Exception: + * raise ImportError("numpy._core.umath failed to import") # <<<<<<<<<<<<<< + * + * cdef inline int import_ufunc() except -1: +*/ + __pyx_t_9 = NULL; + __pyx_t_10 = 1; + { + PyObject *__pyx_callargs[2] = {__pyx_t_9, __pyx_mstate_global->__pyx_kp_u_numpy__core_umath_failed_to_impo}; + __pyx_t_8 = __Pyx_PyObject_FastCall((PyObject*)(((PyTypeObject*)PyExc_ImportError)), __pyx_callargs+__pyx_t_10, (2-__pyx_t_10) | (__pyx_t_10*__Pyx_PY_VECTORCALL_ARGUMENTS_OFFSET)); + __Pyx_XDECREF(__pyx_t_9); __pyx_t_9 = 0; + if (unlikely(!__pyx_t_8)) __PYX_ERR(2, 1016, __pyx_L5_except_error) + __Pyx_GOTREF(__pyx_t_8); + } + __Pyx_Raise(__pyx_t_8, 0, 0, 0); + __Pyx_DECREF(__pyx_t_8); __pyx_t_8 = 0; + __PYX_ERR(2, 1016, __pyx_L5_except_error) + } + goto __pyx_L5_except_error; + + /* "C:/Users/runneradmin/AppData/Local/Temp/build-env-ej_q3m8u/Lib/site-packages/numpy/__init__.cython-30.pxd":1013 + * + * cdef inline int import_umath() except -1: + * try: # <<<<<<<<<<<<<< + * _import_umath() + * except Exception: +*/ + __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:; + } + + /* "C:/Users/runneradmin/AppData/Local/Temp/build-env-ej_q3m8u/Lib/site-packages/numpy/__init__.cython-30.pxd":1012 + * raise ImportError("numpy._core.multiarray failed to import") + * + * cdef inline int import_umath() except -1: # <<<<<<<<<<<<<< + * try: + * _import_umath() +*/ + + /* function exit code */ + __pyx_r = 0; + goto __pyx_L0; + __pyx_L1_error:; + __Pyx_XDECREF(__pyx_t_5); + __Pyx_XDECREF(__pyx_t_6); + __Pyx_XDECREF(__pyx_t_7); + __Pyx_XDECREF(__pyx_t_8); + __Pyx_XDECREF(__pyx_t_9); + __Pyx_AddTraceback("numpy.import_umath", __pyx_clineno, __pyx_lineno, __pyx_filename); + __pyx_r = -1; + __pyx_L0:; + __Pyx_RefNannyFinishContext(); + return __pyx_r; +} + +/* "C:/Users/runneradmin/AppData/Local/Temp/build-env-ej_q3m8u/Lib/site-packages/numpy/__init__.cython-30.pxd":1018 + * raise ImportError("numpy._core.umath failed to import") + * + * cdef inline int import_ufunc() except -1: # <<<<<<<<<<<<<< + * try: + * _import_umath() +*/ + +static CYTHON_INLINE int __pyx_f_5numpy_import_ufunc(void) { + int __pyx_r; + __Pyx_RefNannyDeclarations + PyObject *__pyx_t_1 = NULL; + PyObject *__pyx_t_2 = NULL; + PyObject *__pyx_t_3 = NULL; + int __pyx_t_4; + PyObject *__pyx_t_5 = NULL; + PyObject *__pyx_t_6 = NULL; + PyObject *__pyx_t_7 = NULL; + PyObject *__pyx_t_8 = NULL; + PyObject *__pyx_t_9 = NULL; + size_t __pyx_t_10; + int __pyx_lineno = 0; + const char *__pyx_filename = NULL; + int __pyx_clineno = 0; + __Pyx_RefNannySetupContext("import_ufunc", 0); + + /* "C:/Users/runneradmin/AppData/Local/Temp/build-env-ej_q3m8u/Lib/site-packages/numpy/__init__.cython-30.pxd":1019 + * + * cdef inline int import_ufunc() except -1: + * try: # <<<<<<<<<<<<<< + * _import_umath() + * except Exception: +*/ + { + __Pyx_PyThreadState_declare + __Pyx_PyThreadState_assign + __Pyx_ExceptionSave(&__pyx_t_1, &__pyx_t_2, &__pyx_t_3); + __Pyx_XGOTREF(__pyx_t_1); + __Pyx_XGOTREF(__pyx_t_2); + __Pyx_XGOTREF(__pyx_t_3); + /*try:*/ { + + /* "C:/Users/runneradmin/AppData/Local/Temp/build-env-ej_q3m8u/Lib/site-packages/numpy/__init__.cython-30.pxd":1020 + * cdef inline int import_ufunc() except -1: + * try: + * _import_umath() # <<<<<<<<<<<<<< + * except Exception: + * raise ImportError("numpy._core.umath failed to import") +*/ + __pyx_t_4 = _import_umath(); if (unlikely(__pyx_t_4 == ((int)-1))) __PYX_ERR(2, 1020, __pyx_L3_error) + + /* "C:/Users/runneradmin/AppData/Local/Temp/build-env-ej_q3m8u/Lib/site-packages/numpy/__init__.cython-30.pxd":1019 + * + * cdef inline int import_ufunc() except -1: + * try: # <<<<<<<<<<<<<< + * _import_umath() + * except Exception: +*/ + } + __Pyx_XDECREF(__pyx_t_1); __pyx_t_1 = 0; + __Pyx_XDECREF(__pyx_t_2); __pyx_t_2 = 0; + __Pyx_XDECREF(__pyx_t_3); __pyx_t_3 = 0; + goto __pyx_L8_try_end; + __pyx_L3_error:; + + /* "C:/Users/runneradmin/AppData/Local/Temp/build-env-ej_q3m8u/Lib/site-packages/numpy/__init__.cython-30.pxd":1021 + * try: + * _import_umath() + * except Exception: # <<<<<<<<<<<<<< + * raise ImportError("numpy._core.umath failed to import") + * +*/ + __pyx_t_4 = __Pyx_PyErr_ExceptionMatches(((PyObject *)(((PyTypeObject*)PyExc_Exception)))); + if (__pyx_t_4) { + __Pyx_AddTraceback("numpy.import_ufunc", __pyx_clineno, __pyx_lineno, __pyx_filename); + if (__Pyx_GetException(&__pyx_t_5, &__pyx_t_6, &__pyx_t_7) < 0) __PYX_ERR(2, 1021, __pyx_L5_except_error) + __Pyx_XGOTREF(__pyx_t_5); + __Pyx_XGOTREF(__pyx_t_6); + __Pyx_XGOTREF(__pyx_t_7); + + /* "C:/Users/runneradmin/AppData/Local/Temp/build-env-ej_q3m8u/Lib/site-packages/numpy/__init__.cython-30.pxd":1022 + * _import_umath() + * except Exception: + * raise ImportError("numpy._core.umath failed to import") # <<<<<<<<<<<<<< + * + * +*/ + __pyx_t_9 = NULL; + __pyx_t_10 = 1; + { + PyObject *__pyx_callargs[2] = {__pyx_t_9, __pyx_mstate_global->__pyx_kp_u_numpy__core_umath_failed_to_impo}; + __pyx_t_8 = __Pyx_PyObject_FastCall((PyObject*)(((PyTypeObject*)PyExc_ImportError)), __pyx_callargs+__pyx_t_10, (2-__pyx_t_10) | (__pyx_t_10*__Pyx_PY_VECTORCALL_ARGUMENTS_OFFSET)); + __Pyx_XDECREF(__pyx_t_9); __pyx_t_9 = 0; + if (unlikely(!__pyx_t_8)) __PYX_ERR(2, 1022, __pyx_L5_except_error) + __Pyx_GOTREF(__pyx_t_8); + } + __Pyx_Raise(__pyx_t_8, 0, 0, 0); + __Pyx_DECREF(__pyx_t_8); __pyx_t_8 = 0; + __PYX_ERR(2, 1022, __pyx_L5_except_error) + } + goto __pyx_L5_except_error; + + /* "C:/Users/runneradmin/AppData/Local/Temp/build-env-ej_q3m8u/Lib/site-packages/numpy/__init__.cython-30.pxd":1019 + * + * cdef inline int import_ufunc() except -1: + * try: # <<<<<<<<<<<<<< + * _import_umath() + * except Exception: +*/ + __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:; + } + + /* "C:/Users/runneradmin/AppData/Local/Temp/build-env-ej_q3m8u/Lib/site-packages/numpy/__init__.cython-30.pxd":1018 + * raise ImportError("numpy._core.umath failed to import") + * + * cdef inline int import_ufunc() except -1: # <<<<<<<<<<<<<< + * try: + * _import_umath() +*/ + + /* function exit code */ + __pyx_r = 0; + goto __pyx_L0; + __pyx_L1_error:; + __Pyx_XDECREF(__pyx_t_5); + __Pyx_XDECREF(__pyx_t_6); + __Pyx_XDECREF(__pyx_t_7); + __Pyx_XDECREF(__pyx_t_8); + __Pyx_XDECREF(__pyx_t_9); + __Pyx_AddTraceback("numpy.import_ufunc", __pyx_clineno, __pyx_lineno, __pyx_filename); + __pyx_r = -1; + __pyx_L0:; + __Pyx_RefNannyFinishContext(); + return __pyx_r; +} + +/* "C:/Users/runneradmin/AppData/Local/Temp/build-env-ej_q3m8u/Lib/site-packages/numpy/__init__.cython-30.pxd":1025 + * + * + * cdef inline bint is_timedelta64_object(object obj) noexcept: # <<<<<<<<<<<<<< + * """ + * Cython equivalent of `isinstance(obj, np.timedelta64)` +*/ + +static CYTHON_INLINE int __pyx_f_5numpy_is_timedelta64_object(PyObject *__pyx_v_obj) { + int __pyx_r; + + /* "C:/Users/runneradmin/AppData/Local/Temp/build-env-ej_q3m8u/Lib/site-packages/numpy/__init__.cython-30.pxd":1037 + * bool + * """ + * return PyObject_TypeCheck(obj, &PyTimedeltaArrType_Type) # <<<<<<<<<<<<<< + * + * +*/ + __pyx_r = PyObject_TypeCheck(__pyx_v_obj, (&PyTimedeltaArrType_Type)); + goto __pyx_L0; + + /* "C:/Users/runneradmin/AppData/Local/Temp/build-env-ej_q3m8u/Lib/site-packages/numpy/__init__.cython-30.pxd":1025 + * + * + * cdef inline bint is_timedelta64_object(object obj) noexcept: # <<<<<<<<<<<<<< + * """ + * Cython equivalent of `isinstance(obj, np.timedelta64)` +*/ + + /* function exit code */ + __pyx_L0:; + return __pyx_r; +} + +/* "C:/Users/runneradmin/AppData/Local/Temp/build-env-ej_q3m8u/Lib/site-packages/numpy/__init__.cython-30.pxd":1040 + * + * + * cdef inline bint is_datetime64_object(object obj) noexcept: # <<<<<<<<<<<<<< + * """ + * Cython equivalent of `isinstance(obj, np.datetime64)` +*/ + +static CYTHON_INLINE int __pyx_f_5numpy_is_datetime64_object(PyObject *__pyx_v_obj) { + int __pyx_r; + + /* "C:/Users/runneradmin/AppData/Local/Temp/build-env-ej_q3m8u/Lib/site-packages/numpy/__init__.cython-30.pxd":1052 + * bool + * """ + * return PyObject_TypeCheck(obj, &PyDatetimeArrType_Type) # <<<<<<<<<<<<<< + * + * +*/ + __pyx_r = PyObject_TypeCheck(__pyx_v_obj, (&PyDatetimeArrType_Type)); + goto __pyx_L0; + + /* "C:/Users/runneradmin/AppData/Local/Temp/build-env-ej_q3m8u/Lib/site-packages/numpy/__init__.cython-30.pxd":1040 + * + * + * cdef inline bint is_datetime64_object(object obj) noexcept: # <<<<<<<<<<<<<< + * """ + * Cython equivalent of `isinstance(obj, np.datetime64)` +*/ + + /* function exit code */ + __pyx_L0:; + return __pyx_r; +} + +/* "C:/Users/runneradmin/AppData/Local/Temp/build-env-ej_q3m8u/Lib/site-packages/numpy/__init__.cython-30.pxd":1055 + * + * + * cdef inline npy_datetime get_datetime64_value(object obj) noexcept nogil: # <<<<<<<<<<<<<< + * """ + * returns the int64 value underlying scalar numpy datetime64 object +*/ + +static CYTHON_INLINE npy_datetime __pyx_f_5numpy_get_datetime64_value(PyObject *__pyx_v_obj) { + npy_datetime __pyx_r; + + /* "C:/Users/runneradmin/AppData/Local/Temp/build-env-ej_q3m8u/Lib/site-packages/numpy/__init__.cython-30.pxd":1062 + * also needed. That can be found using `get_datetime64_unit`. + * """ + * return (obj).obval # <<<<<<<<<<<<<< + * + * +*/ + __pyx_r = ((PyDatetimeScalarObject *)__pyx_v_obj)->obval; + goto __pyx_L0; + + /* "C:/Users/runneradmin/AppData/Local/Temp/build-env-ej_q3m8u/Lib/site-packages/numpy/__init__.cython-30.pxd":1055 + * + * + * cdef inline npy_datetime get_datetime64_value(object obj) noexcept nogil: # <<<<<<<<<<<<<< + * """ + * returns the int64 value underlying scalar numpy datetime64 object +*/ + + /* function exit code */ + __pyx_L0:; + return __pyx_r; +} + +/* "C:/Users/runneradmin/AppData/Local/Temp/build-env-ej_q3m8u/Lib/site-packages/numpy/__init__.cython-30.pxd":1065 + * + * + * cdef inline npy_timedelta get_timedelta64_value(object obj) noexcept nogil: # <<<<<<<<<<<<<< + * """ + * returns the int64 value underlying scalar numpy timedelta64 object +*/ + +static CYTHON_INLINE npy_timedelta __pyx_f_5numpy_get_timedelta64_value(PyObject *__pyx_v_obj) { + npy_timedelta __pyx_r; + + /* "C:/Users/runneradmin/AppData/Local/Temp/build-env-ej_q3m8u/Lib/site-packages/numpy/__init__.cython-30.pxd":1069 + * returns the int64 value underlying scalar numpy timedelta64 object + * """ + * return (obj).obval # <<<<<<<<<<<<<< + * + * +*/ + __pyx_r = ((PyTimedeltaScalarObject *)__pyx_v_obj)->obval; + goto __pyx_L0; + + /* "C:/Users/runneradmin/AppData/Local/Temp/build-env-ej_q3m8u/Lib/site-packages/numpy/__init__.cython-30.pxd":1065 + * + * + * cdef inline npy_timedelta get_timedelta64_value(object obj) noexcept nogil: # <<<<<<<<<<<<<< + * """ + * returns the int64 value underlying scalar numpy timedelta64 object +*/ + + /* function exit code */ + __pyx_L0:; + return __pyx_r; +} + +/* "C:/Users/runneradmin/AppData/Local/Temp/build-env-ej_q3m8u/Lib/site-packages/numpy/__init__.cython-30.pxd":1072 + * + * + * cdef inline NPY_DATETIMEUNIT get_datetime64_unit(object obj) noexcept nogil: # <<<<<<<<<<<<<< + * """ + * returns the unit part of the dtype for a numpy datetime64 object. +*/ + +static CYTHON_INLINE NPY_DATETIMEUNIT __pyx_f_5numpy_get_datetime64_unit(PyObject *__pyx_v_obj) { + NPY_DATETIMEUNIT __pyx_r; + + /* "C:/Users/runneradmin/AppData/Local/Temp/build-env-ej_q3m8u/Lib/site-packages/numpy/__init__.cython-30.pxd":1076 + * returns the unit part of the dtype for a numpy datetime64 object. + * """ + * return (obj).obmeta.base # <<<<<<<<<<<<<< + * + * +*/ + __pyx_r = ((NPY_DATETIMEUNIT)((PyDatetimeScalarObject *)__pyx_v_obj)->obmeta.base); + goto __pyx_L0; + + /* "C:/Users/runneradmin/AppData/Local/Temp/build-env-ej_q3m8u/Lib/site-packages/numpy/__init__.cython-30.pxd":1072 + * + * + * cdef inline NPY_DATETIMEUNIT get_datetime64_unit(object obj) noexcept nogil: # <<<<<<<<<<<<<< + * """ + * returns the unit part of the dtype for a numpy datetime64 object. +*/ + + /* function exit code */ + __pyx_L0:; + return __pyx_r; +} +static PyObject *__pyx_gb_5spacy_8pipeline_17_parser_internals_7nonproj_2generator(__pyx_CoroutineObject *__pyx_generator, CYTHON_UNUSED PyThreadState *__pyx_tstate, PyObject *__pyx_sent_value); /* proto */ + +/* "spacy/pipeline/_parser_internals/nonproj.pyx":24 + * + * + * def ancestors(tokenid, heads): # <<<<<<<<<<<<<< + * # Returns all words going from the word up the path to the root. The path + * # to root cannot be longer than the number of words in the sentence. This +*/ + +/* Python wrapper */ +static PyObject *__pyx_pw_5spacy_8pipeline_17_parser_internals_7nonproj_1ancestors(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_5spacy_8pipeline_17_parser_internals_7nonproj_ancestors, "ancestors(tokenid, heads)"); +static PyMethodDef __pyx_mdef_5spacy_8pipeline_17_parser_internals_7nonproj_1ancestors = {"ancestors", (PyCFunction)(void(*)(void))(__Pyx_PyCFunction_FastCallWithKeywords)__pyx_pw_5spacy_8pipeline_17_parser_internals_7nonproj_1ancestors, __Pyx_METH_FASTCALL|METH_KEYWORDS, __pyx_doc_5spacy_8pipeline_17_parser_internals_7nonproj_ancestors}; +static PyObject *__pyx_pw_5spacy_8pipeline_17_parser_internals_7nonproj_1ancestors(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 +) { + PyObject *__pyx_v_tokenid = 0; + PyObject *__pyx_v_heads = 0; + #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("ancestors (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_tokenid,&__pyx_mstate_global->__pyx_n_u_heads,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, 24, __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, 24, __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, 24, __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, "ancestors", 0) < (0)) __PYX_ERR(0, 24, __pyx_L3_error) + for (Py_ssize_t i = __pyx_nargs; i < 2; i++) { + if (unlikely(!values[i])) { __Pyx_RaiseArgtupleInvalid("ancestors", 1, 2, 2, i); __PYX_ERR(0, 24, __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, 24, __pyx_L3_error) + values[1] = __Pyx_ArgRef_FASTCALL(__pyx_args, 1); + if (!CYTHON_ASSUME_SAFE_MACROS && unlikely(!values[1])) __PYX_ERR(0, 24, __pyx_L3_error) + } + __pyx_v_tokenid = values[0]; + __pyx_v_heads = values[1]; + } + goto __pyx_L6_skip; + __pyx_L5_argtuple_error:; + __Pyx_RaiseArgtupleInvalid("ancestors", 1, 2, 2, __pyx_nargs); __PYX_ERR(0, 24, __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("spacy.pipeline._parser_internals.nonproj.ancestors", __pyx_clineno, __pyx_lineno, __pyx_filename); + __Pyx_RefNannyFinishContext(); + return NULL; + __pyx_L4_argument_unpacking_done:; + __pyx_r = __pyx_pf_5spacy_8pipeline_17_parser_internals_7nonproj_ancestors(__pyx_self, __pyx_v_tokenid, __pyx_v_heads); + + /* 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_5spacy_8pipeline_17_parser_internals_7nonproj_ancestors(CYTHON_UNUSED PyObject *__pyx_self, PyObject *__pyx_v_tokenid, PyObject *__pyx_v_heads) { + struct __pyx_obj_5spacy_8pipeline_17_parser_internals_7nonproj___pyx_scope_struct__ancestors *__pyx_cur_scope; + PyObject *__pyx_r = NULL; + __Pyx_RefNannyDeclarations + int __pyx_lineno = 0; + const char *__pyx_filename = NULL; + int __pyx_clineno = 0; + __Pyx_RefNannySetupContext("ancestors", 0); + __pyx_cur_scope = (struct __pyx_obj_5spacy_8pipeline_17_parser_internals_7nonproj___pyx_scope_struct__ancestors *)__pyx_tp_new_5spacy_8pipeline_17_parser_internals_7nonproj___pyx_scope_struct__ancestors(__pyx_mstate_global->__pyx_ptype_5spacy_8pipeline_17_parser_internals_7nonproj___pyx_scope_struct__ancestors, __pyx_mstate_global->__pyx_empty_tuple, NULL); + if (unlikely(!__pyx_cur_scope)) { + __pyx_cur_scope = ((struct __pyx_obj_5spacy_8pipeline_17_parser_internals_7nonproj___pyx_scope_struct__ancestors *)Py_None); + __Pyx_INCREF(Py_None); + __PYX_ERR(0, 24, __pyx_L1_error) + } else { + __Pyx_GOTREF((PyObject *)__pyx_cur_scope); + } + __pyx_cur_scope->__pyx_v_tokenid = __pyx_v_tokenid; + __Pyx_INCREF(__pyx_cur_scope->__pyx_v_tokenid); + __Pyx_GIVEREF(__pyx_cur_scope->__pyx_v_tokenid); + __pyx_cur_scope->__pyx_v_heads = __pyx_v_heads; + __Pyx_INCREF(__pyx_cur_scope->__pyx_v_heads); + __Pyx_GIVEREF(__pyx_cur_scope->__pyx_v_heads); + { + __pyx_CoroutineObject *gen = __Pyx_Generator_New((__pyx_coroutine_body_t) __pyx_gb_5spacy_8pipeline_17_parser_internals_7nonproj_2generator, ((PyObject *)__pyx_mstate_global->__pyx_codeobj_tab[0]), (PyObject *) __pyx_cur_scope, __pyx_mstate_global->__pyx_n_u_ancestors, __pyx_mstate_global->__pyx_n_u_ancestors, __pyx_mstate_global->__pyx_n_u_spacy_pipeline__parser_internals); if (unlikely(!gen)) __PYX_ERR(0, 24, __pyx_L1_error) + __Pyx_DECREF(__pyx_cur_scope); + __Pyx_RefNannyFinishContext(); + return (PyObject *) gen; + } + + /* function exit code */ + __pyx_L1_error:; + __Pyx_AddTraceback("spacy.pipeline._parser_internals.nonproj.ancestors", __pyx_clineno, __pyx_lineno, __pyx_filename); + __pyx_r = NULL; + __Pyx_DECREF((PyObject *)__pyx_cur_scope); + __Pyx_XGIVEREF(__pyx_r); + __Pyx_RefNannyFinishContext(); + return __pyx_r; +} + +static PyObject *__pyx_gb_5spacy_8pipeline_17_parser_internals_7nonproj_2generator(__pyx_CoroutineObject *__pyx_generator, CYTHON_UNUSED PyThreadState *__pyx_tstate, PyObject *__pyx_sent_value) /* generator body */ +{ + struct __pyx_obj_5spacy_8pipeline_17_parser_internals_7nonproj___pyx_scope_struct__ancestors *__pyx_cur_scope = ((struct __pyx_obj_5spacy_8pipeline_17_parser_internals_7nonproj___pyx_scope_struct__ancestors *)__pyx_generator->closure); + PyObject *__pyx_r = NULL; + int __pyx_t_1; + PyObject *__pyx_t_2 = NULL; + PyObject *__pyx_t_3 = NULL; + int __pyx_t_4; + Py_ssize_t __pyx_t_5; + int __pyx_lineno = 0; + const char *__pyx_filename = NULL; + int __pyx_clineno = 0; + __Pyx_RefNannyDeclarations + __Pyx_RefNannySetupContext("ancestors", 0); + switch (__pyx_generator->resume_label) { + case 0: goto __pyx_L3_first_run; + case 1: goto __pyx_L8_resume_from_yield; + default: /* CPython raises the right error here */ + __Pyx_RefNannyFinishContext(); + return NULL; + } + __pyx_L3_first_run:; + if (unlikely(__pyx_sent_value != Py_None)) { + if (unlikely(__pyx_sent_value)) PyErr_SetString(PyExc_TypeError, "can't send non-None value to a just-started generator"); + __PYX_ERR(0, 24, __pyx_L1_error) + } + + /* "spacy/pipeline/_parser_internals/nonproj.pyx":29 + * # function ends after at most len(heads) steps, because it would otherwise + * # loop indefinitely on cycles. + * head = tokenid # <<<<<<<<<<<<<< + * cnt = 0 + * while heads[head] != head and cnt < len(heads): +*/ + __Pyx_INCREF(__pyx_cur_scope->__pyx_v_tokenid); + __Pyx_GIVEREF(__pyx_cur_scope->__pyx_v_tokenid); + __pyx_cur_scope->__pyx_v_head = __pyx_cur_scope->__pyx_v_tokenid; + + /* "spacy/pipeline/_parser_internals/nonproj.pyx":30 + * # loop indefinitely on cycles. + * head = tokenid + * cnt = 0 # <<<<<<<<<<<<<< + * while heads[head] != head and cnt < len(heads): + * head = heads[head] +*/ + __pyx_cur_scope->__pyx_v_cnt = 0; + + /* "spacy/pipeline/_parser_internals/nonproj.pyx":31 + * head = tokenid + * cnt = 0 + * while heads[head] != head and cnt < len(heads): # <<<<<<<<<<<<<< + * head = heads[head] + * cnt += 1 +*/ + while (1) { + __pyx_t_2 = __Pyx_PyObject_GetItem(__pyx_cur_scope->__pyx_v_heads, __pyx_cur_scope->__pyx_v_head); if (unlikely(!__pyx_t_2)) __PYX_ERR(0, 31, __pyx_L1_error) + __Pyx_GOTREF(__pyx_t_2); + __pyx_t_3 = PyObject_RichCompare(__pyx_t_2, __pyx_cur_scope->__pyx_v_head, Py_NE); __Pyx_XGOTREF(__pyx_t_3); if (unlikely(!__pyx_t_3)) __PYX_ERR(0, 31, __pyx_L1_error) + __Pyx_DECREF(__pyx_t_2); __pyx_t_2 = 0; + __pyx_t_4 = __Pyx_PyObject_IsTrue(__pyx_t_3); if (unlikely((__pyx_t_4 < 0))) __PYX_ERR(0, 31, __pyx_L1_error) + __Pyx_DECREF(__pyx_t_3); __pyx_t_3 = 0; + if (__pyx_t_4) { + } else { + __pyx_t_1 = __pyx_t_4; + goto __pyx_L6_bool_binop_done; + } + __pyx_t_5 = PyObject_Length(__pyx_cur_scope->__pyx_v_heads); if (unlikely(__pyx_t_5 == ((Py_ssize_t)-1))) __PYX_ERR(0, 31, __pyx_L1_error) + __pyx_t_4 = (__pyx_cur_scope->__pyx_v_cnt < __pyx_t_5); + __pyx_t_1 = __pyx_t_4; + __pyx_L6_bool_binop_done:; + if (!__pyx_t_1) break; + + /* "spacy/pipeline/_parser_internals/nonproj.pyx":32 + * cnt = 0 + * while heads[head] != head and cnt < len(heads): + * head = heads[head] # <<<<<<<<<<<<<< + * cnt += 1 + * yield head +*/ + __pyx_t_3 = __Pyx_PyObject_GetItem(__pyx_cur_scope->__pyx_v_heads, __pyx_cur_scope->__pyx_v_head); if (unlikely(!__pyx_t_3)) __PYX_ERR(0, 32, __pyx_L1_error) + __Pyx_GOTREF(__pyx_t_3); + __Pyx_GOTREF(__pyx_cur_scope->__pyx_v_head); + __Pyx_DECREF_SET(__pyx_cur_scope->__pyx_v_head, __pyx_t_3); + __Pyx_GIVEREF(__pyx_t_3); + __pyx_t_3 = 0; + + /* "spacy/pipeline/_parser_internals/nonproj.pyx":33 + * while heads[head] != head and cnt < len(heads): + * head = heads[head] + * cnt += 1 # <<<<<<<<<<<<<< + * yield head + * if head is None: +*/ + __pyx_cur_scope->__pyx_v_cnt = (__pyx_cur_scope->__pyx_v_cnt + 1); + + /* "spacy/pipeline/_parser_internals/nonproj.pyx":34 + * head = heads[head] + * cnt += 1 + * yield head # <<<<<<<<<<<<<< + * if head is None: + * break +*/ + __Pyx_INCREF(__pyx_cur_scope->__pyx_v_head); + __pyx_r = __pyx_cur_scope->__pyx_v_head; + __Pyx_XGIVEREF(__pyx_r); + __Pyx_RefNannyFinishContext(); + __Pyx_Coroutine_ResetAndClearException(__pyx_generator); + /* return from generator, yielding value */ + __pyx_generator->resume_label = 1; + return __pyx_r; + __pyx_L8_resume_from_yield:; + if (unlikely(!__pyx_sent_value)) __PYX_ERR(0, 34, __pyx_L1_error) + + /* "spacy/pipeline/_parser_internals/nonproj.pyx":35 + * cnt += 1 + * yield head + * if head is None: # <<<<<<<<<<<<<< + * break + * +*/ + __pyx_t_1 = (__pyx_cur_scope->__pyx_v_head == Py_None); + if (__pyx_t_1) { + + /* "spacy/pipeline/_parser_internals/nonproj.pyx":36 + * yield head + * if head is None: + * break # <<<<<<<<<<<<<< + * + * +*/ + goto __pyx_L5_break; + + /* "spacy/pipeline/_parser_internals/nonproj.pyx":35 + * cnt += 1 + * yield head + * if head is None: # <<<<<<<<<<<<<< + * break + * +*/ + } + } + __pyx_L5_break:; + CYTHON_MAYBE_UNUSED_VAR(__pyx_cur_scope); + + /* "spacy/pipeline/_parser_internals/nonproj.pyx":24 + * + * + * def ancestors(tokenid, heads): # <<<<<<<<<<<<<< + * # Returns all words going from the word up the path to the root. The path + * # to root cannot be longer than the number of words in the sentence. This +*/ + + /* 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); + if (__Pyx_PyErr_Occurred()) { + __Pyx_AddTraceback("ancestors", __pyx_clineno, __pyx_lineno, __pyx_filename); + } + __pyx_L0:; + __Pyx_XGIVEREF(__pyx_r); + #if !CYTHON_USE_EXC_INFO_STACK + __Pyx_Coroutine_ResetAndClearException(__pyx_generator); + #endif + __pyx_generator->resume_label = -1; + __Pyx_Coroutine_clear((PyObject*)__pyx_generator); + __Pyx_RefNannyFinishContext(); + return __pyx_r; +} + +/* "spacy/pipeline/_parser_internals/nonproj.pyx":39 + * + * + * def contains_cycle(heads): # <<<<<<<<<<<<<< + * # in an acyclic tree, the path from each word following the head relation + * # upwards always ends at the root node +*/ + +/* Python wrapper */ +static PyObject *__pyx_pw_5spacy_8pipeline_17_parser_internals_7nonproj_4contains_cycle(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_5spacy_8pipeline_17_parser_internals_7nonproj_3contains_cycle, "contains_cycle(heads)"); +static PyMethodDef __pyx_mdef_5spacy_8pipeline_17_parser_internals_7nonproj_4contains_cycle = {"contains_cycle", (PyCFunction)(void(*)(void))(__Pyx_PyCFunction_FastCallWithKeywords)__pyx_pw_5spacy_8pipeline_17_parser_internals_7nonproj_4contains_cycle, __Pyx_METH_FASTCALL|METH_KEYWORDS, __pyx_doc_5spacy_8pipeline_17_parser_internals_7nonproj_3contains_cycle}; +static PyObject *__pyx_pw_5spacy_8pipeline_17_parser_internals_7nonproj_4contains_cycle(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 +) { + PyObject *__pyx_v_heads = 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("contains_cycle (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_heads,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, 39, __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, 39, __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, "contains_cycle", 0) < (0)) __PYX_ERR(0, 39, __pyx_L3_error) + for (Py_ssize_t i = __pyx_nargs; i < 1; i++) { + if (unlikely(!values[i])) { __Pyx_RaiseArgtupleInvalid("contains_cycle", 1, 1, 1, i); __PYX_ERR(0, 39, __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, 39, __pyx_L3_error) + } + __pyx_v_heads = values[0]; + } + goto __pyx_L6_skip; + __pyx_L5_argtuple_error:; + __Pyx_RaiseArgtupleInvalid("contains_cycle", 1, 1, 1, __pyx_nargs); __PYX_ERR(0, 39, __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("spacy.pipeline._parser_internals.nonproj.contains_cycle", __pyx_clineno, __pyx_lineno, __pyx_filename); + __Pyx_RefNannyFinishContext(); + return NULL; + __pyx_L4_argument_unpacking_done:; + __pyx_r = __pyx_pf_5spacy_8pipeline_17_parser_internals_7nonproj_3contains_cycle(__pyx_self, __pyx_v_heads); + + /* 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_5spacy_8pipeline_17_parser_internals_7nonproj_3contains_cycle(CYTHON_UNUSED PyObject *__pyx_self, PyObject *__pyx_v_heads) { + Py_ssize_t __pyx_v_tokenid; + PyObject *__pyx_v_seen = NULL; + PyObject *__pyx_v_ancestor = NULL; + PyObject *__pyx_r = NULL; + __Pyx_RefNannyDeclarations + Py_ssize_t __pyx_t_1; + Py_ssize_t __pyx_t_2; + Py_ssize_t __pyx_t_3; + PyObject *__pyx_t_4 = NULL; + PyObject *__pyx_t_5 = NULL; + PyObject *__pyx_t_6 = NULL; + PyObject *__pyx_t_7 = NULL; + size_t __pyx_t_8; + Py_ssize_t __pyx_t_9; + PyObject *(*__pyx_t_10)(PyObject *); + int __pyx_t_11; + int __pyx_t_12; + int __pyx_lineno = 0; + const char *__pyx_filename = NULL; + int __pyx_clineno = 0; + __Pyx_RefNannySetupContext("contains_cycle", 0); + + /* "spacy/pipeline/_parser_internals/nonproj.pyx":42 + * # in an acyclic tree, the path from each word following the head relation + * # upwards always ends at the root node + * for tokenid in range(len(heads)): # <<<<<<<<<<<<<< + * seen = set([tokenid]) + * for ancestor in ancestors(tokenid, heads): +*/ + __pyx_t_1 = PyObject_Length(__pyx_v_heads); if (unlikely(__pyx_t_1 == ((Py_ssize_t)-1))) __PYX_ERR(0, 42, __pyx_L1_error) + __pyx_t_2 = __pyx_t_1; + for (__pyx_t_3 = 0; __pyx_t_3 < __pyx_t_2; __pyx_t_3+=1) { + __pyx_v_tokenid = __pyx_t_3; + + /* "spacy/pipeline/_parser_internals/nonproj.pyx":43 + * # upwards always ends at the root node + * for tokenid in range(len(heads)): + * seen = set([tokenid]) # <<<<<<<<<<<<<< + * for ancestor in ancestors(tokenid, heads): + * if ancestor in seen: +*/ + __pyx_t_4 = PyLong_FromSsize_t(__pyx_v_tokenid); if (unlikely(!__pyx_t_4)) __PYX_ERR(0, 43, __pyx_L1_error) + __Pyx_GOTREF(__pyx_t_4); + __pyx_t_5 = PySet_New(0); if (unlikely(!__pyx_t_5)) __PYX_ERR(0, 43, __pyx_L1_error) + __Pyx_GOTREF(__pyx_t_5); + if (PySet_Add(__pyx_t_5, __pyx_t_4) < (0)) __PYX_ERR(0, 43, __pyx_L1_error) + __Pyx_DECREF(__pyx_t_4); __pyx_t_4 = 0; + __Pyx_XDECREF_SET(__pyx_v_seen, ((PyObject*)__pyx_t_5)); + __pyx_t_5 = 0; + + /* "spacy/pipeline/_parser_internals/nonproj.pyx":44 + * for tokenid in range(len(heads)): + * seen = set([tokenid]) + * for ancestor in ancestors(tokenid, heads): # <<<<<<<<<<<<<< + * if ancestor in seen: + * return seen +*/ + __pyx_t_4 = NULL; + __Pyx_GetModuleGlobalName(__pyx_t_6, __pyx_mstate_global->__pyx_n_u_ancestors); if (unlikely(!__pyx_t_6)) __PYX_ERR(0, 44, __pyx_L1_error) + __Pyx_GOTREF(__pyx_t_6); + __pyx_t_7 = PyLong_FromSsize_t(__pyx_v_tokenid); if (unlikely(!__pyx_t_7)) __PYX_ERR(0, 44, __pyx_L1_error) + __Pyx_GOTREF(__pyx_t_7); + __pyx_t_8 = 1; + #if CYTHON_UNPACK_METHODS + if (unlikely(PyMethod_Check(__pyx_t_6))) { + __pyx_t_4 = PyMethod_GET_SELF(__pyx_t_6); + assert(__pyx_t_4); + PyObject* __pyx__function = PyMethod_GET_FUNCTION(__pyx_t_6); + __Pyx_INCREF(__pyx_t_4); + __Pyx_INCREF(__pyx__function); + __Pyx_DECREF_SET(__pyx_t_6, __pyx__function); + __pyx_t_8 = 0; + } + #endif + { + PyObject *__pyx_callargs[3] = {__pyx_t_4, __pyx_t_7, __pyx_v_heads}; + __pyx_t_5 = __Pyx_PyObject_FastCall((PyObject*)__pyx_t_6, __pyx_callargs+__pyx_t_8, (3-__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; + __Pyx_DECREF(__pyx_t_6); __pyx_t_6 = 0; + if (unlikely(!__pyx_t_5)) __PYX_ERR(0, 44, __pyx_L1_error) + __Pyx_GOTREF(__pyx_t_5); + } + if (likely(PyList_CheckExact(__pyx_t_5)) || PyTuple_CheckExact(__pyx_t_5)) { + __pyx_t_6 = __pyx_t_5; __Pyx_INCREF(__pyx_t_6); + __pyx_t_9 = 0; + __pyx_t_10 = NULL; + } else { + __pyx_t_9 = -1; __pyx_t_6 = PyObject_GetIter(__pyx_t_5); if (unlikely(!__pyx_t_6)) __PYX_ERR(0, 44, __pyx_L1_error) + __Pyx_GOTREF(__pyx_t_6); + __pyx_t_10 = (CYTHON_COMPILING_IN_LIMITED_API) ? PyIter_Next : __Pyx_PyObject_GetIterNextFunc(__pyx_t_6); if (unlikely(!__pyx_t_10)) __PYX_ERR(0, 44, __pyx_L1_error) + } + __Pyx_DECREF(__pyx_t_5); __pyx_t_5 = 0; + for (;;) { + if (likely(!__pyx_t_10)) { + if (likely(PyList_CheckExact(__pyx_t_6))) { + { + Py_ssize_t __pyx_temp = __Pyx_PyList_GET_SIZE(__pyx_t_6); + #if !CYTHON_ASSUME_SAFE_SIZE + if (unlikely((__pyx_temp < 0))) __PYX_ERR(0, 44, __pyx_L1_error) + #endif + if (__pyx_t_9 >= __pyx_temp) break; + } + __pyx_t_5 = __Pyx_PyList_GetItemRefFast(__pyx_t_6, __pyx_t_9, __Pyx_ReferenceSharing_OwnStrongReference); + ++__pyx_t_9; + } else { + { + Py_ssize_t __pyx_temp = __Pyx_PyTuple_GET_SIZE(__pyx_t_6); + #if !CYTHON_ASSUME_SAFE_SIZE + if (unlikely((__pyx_temp < 0))) __PYX_ERR(0, 44, __pyx_L1_error) + #endif + if (__pyx_t_9 >= __pyx_temp) break; + } + #if CYTHON_ASSUME_SAFE_MACROS && !CYTHON_AVOID_BORROWED_REFS + __pyx_t_5 = __Pyx_NewRef(PyTuple_GET_ITEM(__pyx_t_6, __pyx_t_9)); + #else + __pyx_t_5 = __Pyx_PySequence_ITEM(__pyx_t_6, __pyx_t_9); + #endif + ++__pyx_t_9; + } + if (unlikely(!__pyx_t_5)) __PYX_ERR(0, 44, __pyx_L1_error) + } else { + __pyx_t_5 = __pyx_t_10(__pyx_t_6); + if (unlikely(!__pyx_t_5)) { + PyObject* exc_type = PyErr_Occurred(); + if (exc_type) { + if (unlikely(!__Pyx_PyErr_GivenExceptionMatches(exc_type, PyExc_StopIteration))) __PYX_ERR(0, 44, __pyx_L1_error) + PyErr_Clear(); + } + break; + } + } + __Pyx_GOTREF(__pyx_t_5); + __Pyx_XDECREF_SET(__pyx_v_ancestor, __pyx_t_5); + __pyx_t_5 = 0; + + /* "spacy/pipeline/_parser_internals/nonproj.pyx":45 + * seen = set([tokenid]) + * for ancestor in ancestors(tokenid, heads): + * if ancestor in seen: # <<<<<<<<<<<<<< + * return seen + * seen.add(ancestor) +*/ + __pyx_t_11 = (__Pyx_PySet_ContainsTF(__pyx_v_ancestor, __pyx_v_seen, Py_EQ)); if (unlikely((__pyx_t_11 < 0))) __PYX_ERR(0, 45, __pyx_L1_error) + if (__pyx_t_11) { + + /* "spacy/pipeline/_parser_internals/nonproj.pyx":46 + * for ancestor in ancestors(tokenid, heads): + * if ancestor in seen: + * return seen # <<<<<<<<<<<<<< + * seen.add(ancestor) + * return None +*/ + __Pyx_XDECREF(__pyx_r); + __Pyx_INCREF(__pyx_v_seen); + __pyx_r = __pyx_v_seen; + __Pyx_DECREF(__pyx_t_6); __pyx_t_6 = 0; + goto __pyx_L0; + + /* "spacy/pipeline/_parser_internals/nonproj.pyx":45 + * seen = set([tokenid]) + * for ancestor in ancestors(tokenid, heads): + * if ancestor in seen: # <<<<<<<<<<<<<< + * return seen + * seen.add(ancestor) +*/ + } + + /* "spacy/pipeline/_parser_internals/nonproj.pyx":47 + * if ancestor in seen: + * return seen + * seen.add(ancestor) # <<<<<<<<<<<<<< + * return None + * +*/ + __pyx_t_12 = PySet_Add(__pyx_v_seen, __pyx_v_ancestor); if (unlikely(__pyx_t_12 == ((int)-1))) __PYX_ERR(0, 47, __pyx_L1_error) + + /* "spacy/pipeline/_parser_internals/nonproj.pyx":44 + * for tokenid in range(len(heads)): + * seen = set([tokenid]) + * for ancestor in ancestors(tokenid, heads): # <<<<<<<<<<<<<< + * if ancestor in seen: + * return seen +*/ + } + __Pyx_DECREF(__pyx_t_6); __pyx_t_6 = 0; + } + + /* "spacy/pipeline/_parser_internals/nonproj.pyx":48 + * return seen + * seen.add(ancestor) + * return None # <<<<<<<<<<<<<< + * + * +*/ + __Pyx_XDECREF(__pyx_r); + __pyx_r = Py_None; __Pyx_INCREF(Py_None); + goto __pyx_L0; + + /* "spacy/pipeline/_parser_internals/nonproj.pyx":39 + * + * + * def contains_cycle(heads): # <<<<<<<<<<<<<< + * # in an acyclic tree, the path from each word following the head relation + * # upwards always ends at the root node +*/ + + /* function exit code */ + __pyx_L1_error:; + __Pyx_XDECREF(__pyx_t_4); + __Pyx_XDECREF(__pyx_t_5); + __Pyx_XDECREF(__pyx_t_6); + __Pyx_XDECREF(__pyx_t_7); + __Pyx_AddTraceback("spacy.pipeline._parser_internals.nonproj.contains_cycle", __pyx_clineno, __pyx_lineno, __pyx_filename); + __pyx_r = NULL; + __pyx_L0:; + __Pyx_XDECREF(__pyx_v_seen); + __Pyx_XDECREF(__pyx_v_ancestor); + __Pyx_XGIVEREF(__pyx_r); + __Pyx_RefNannyFinishContext(); + return __pyx_r; +} + +/* "spacy/pipeline/_parser_internals/nonproj.pyx":51 + * + * + * def is_nonproj_arc(tokenid, heads): # <<<<<<<<<<<<<< + * cdef vector[int] c_heads = _heads_to_c(heads) + * return _is_nonproj_arc(tokenid, c_heads) +*/ + +/* Python wrapper */ +static PyObject *__pyx_pw_5spacy_8pipeline_17_parser_internals_7nonproj_6is_nonproj_arc(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_5spacy_8pipeline_17_parser_internals_7nonproj_5is_nonproj_arc, "is_nonproj_arc(tokenid, heads)"); +static PyMethodDef __pyx_mdef_5spacy_8pipeline_17_parser_internals_7nonproj_6is_nonproj_arc = {"is_nonproj_arc", (PyCFunction)(void(*)(void))(__Pyx_PyCFunction_FastCallWithKeywords)__pyx_pw_5spacy_8pipeline_17_parser_internals_7nonproj_6is_nonproj_arc, __Pyx_METH_FASTCALL|METH_KEYWORDS, __pyx_doc_5spacy_8pipeline_17_parser_internals_7nonproj_5is_nonproj_arc}; +static PyObject *__pyx_pw_5spacy_8pipeline_17_parser_internals_7nonproj_6is_nonproj_arc(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 +) { + PyObject *__pyx_v_tokenid = 0; + PyObject *__pyx_v_heads = 0; + #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("is_nonproj_arc (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_tokenid,&__pyx_mstate_global->__pyx_n_u_heads,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, 51, __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, 51, __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, 51, __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, "is_nonproj_arc", 0) < (0)) __PYX_ERR(0, 51, __pyx_L3_error) + for (Py_ssize_t i = __pyx_nargs; i < 2; i++) { + if (unlikely(!values[i])) { __Pyx_RaiseArgtupleInvalid("is_nonproj_arc", 1, 2, 2, i); __PYX_ERR(0, 51, __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, 51, __pyx_L3_error) + values[1] = __Pyx_ArgRef_FASTCALL(__pyx_args, 1); + if (!CYTHON_ASSUME_SAFE_MACROS && unlikely(!values[1])) __PYX_ERR(0, 51, __pyx_L3_error) + } + __pyx_v_tokenid = values[0]; + __pyx_v_heads = values[1]; + } + goto __pyx_L6_skip; + __pyx_L5_argtuple_error:; + __Pyx_RaiseArgtupleInvalid("is_nonproj_arc", 1, 2, 2, __pyx_nargs); __PYX_ERR(0, 51, __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("spacy.pipeline._parser_internals.nonproj.is_nonproj_arc", __pyx_clineno, __pyx_lineno, __pyx_filename); + __Pyx_RefNannyFinishContext(); + return NULL; + __pyx_L4_argument_unpacking_done:; + __pyx_r = __pyx_pf_5spacy_8pipeline_17_parser_internals_7nonproj_5is_nonproj_arc(__pyx_self, __pyx_v_tokenid, __pyx_v_heads); + + /* 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_5spacy_8pipeline_17_parser_internals_7nonproj_5is_nonproj_arc(CYTHON_UNUSED PyObject *__pyx_self, PyObject *__pyx_v_tokenid, PyObject *__pyx_v_heads) { + std::vector __pyx_v_c_heads; + PyObject *__pyx_r = NULL; + __Pyx_RefNannyDeclarations + std::vector __pyx_t_1; + int __pyx_t_2; + bool __pyx_t_3; + PyObject *__pyx_t_4 = NULL; + int __pyx_lineno = 0; + const char *__pyx_filename = NULL; + int __pyx_clineno = 0; + __Pyx_RefNannySetupContext("is_nonproj_arc", 0); + + /* "spacy/pipeline/_parser_internals/nonproj.pyx":52 + * + * def is_nonproj_arc(tokenid, heads): + * cdef vector[int] c_heads = _heads_to_c(heads) # <<<<<<<<<<<<<< + * return _is_nonproj_arc(tokenid, c_heads) + * +*/ + __pyx_t_1 = __pyx_f_5spacy_8pipeline_17_parser_internals_7nonproj__heads_to_c(__pyx_v_heads); if (unlikely(PyErr_Occurred())) __PYX_ERR(0, 52, __pyx_L1_error) + __pyx_v_c_heads = __PYX_STD_MOVE_IF_SUPPORTED(__pyx_t_1); + + /* "spacy/pipeline/_parser_internals/nonproj.pyx":53 + * def is_nonproj_arc(tokenid, heads): + * cdef vector[int] c_heads = _heads_to_c(heads) + * return _is_nonproj_arc(tokenid, c_heads) # <<<<<<<<<<<<<< + * + * +*/ + __Pyx_XDECREF(__pyx_r); + __pyx_t_2 = __Pyx_PyLong_As_int(__pyx_v_tokenid); if (unlikely((__pyx_t_2 == (int)-1) && PyErr_Occurred())) __PYX_ERR(0, 53, __pyx_L1_error) + __pyx_t_3 = __pyx_f_5spacy_8pipeline_17_parser_internals_7nonproj__is_nonproj_arc(__pyx_t_2, __pyx_v_c_heads); if (unlikely(__pyx_t_3 == ((bool)-1) && PyErr_Occurred())) __PYX_ERR(0, 53, __pyx_L1_error) + __pyx_t_4 = __Pyx_PyBool_FromLong(__pyx_t_3); if (unlikely(!__pyx_t_4)) __PYX_ERR(0, 53, __pyx_L1_error) + __Pyx_GOTREF(__pyx_t_4); + __pyx_r = __pyx_t_4; + __pyx_t_4 = 0; + goto __pyx_L0; + + /* "spacy/pipeline/_parser_internals/nonproj.pyx":51 + * + * + * def is_nonproj_arc(tokenid, heads): # <<<<<<<<<<<<<< + * cdef vector[int] c_heads = _heads_to_c(heads) + * return _is_nonproj_arc(tokenid, c_heads) +*/ + + /* function exit code */ + __pyx_L1_error:; + __Pyx_XDECREF(__pyx_t_4); + __Pyx_AddTraceback("spacy.pipeline._parser_internals.nonproj.is_nonproj_arc", __pyx_clineno, __pyx_lineno, __pyx_filename); + __pyx_r = NULL; + __pyx_L0:; + __Pyx_XGIVEREF(__pyx_r); + __Pyx_RefNannyFinishContext(); + return __pyx_r; +} + +/* "spacy/pipeline/_parser_internals/nonproj.pyx":56 + * + * + * cdef bool _is_nonproj_arc(int tokenid, const vector[int]& heads) nogil except *: # <<<<<<<<<<<<<< + * # definition (e.g. Havelka 2007): an arc h -> d, h < d is non-projective + * # if there is a token k, h < k < d such that h is not +*/ + +static bool __pyx_f_5spacy_8pipeline_17_parser_internals_7nonproj__is_nonproj_arc(int __pyx_v_tokenid, std::vector const &__pyx_v_heads) { + int __pyx_v_head; + int __pyx_v_start; + int __pyx_v_end; + int __pyx_v_k; + bool __pyx_r; + int __pyx_t_1; + long __pyx_t_2; + int __pyx_t_3; + int __pyx_t_4; + int __pyx_t_5; + bool __pyx_t_6; + int __pyx_lineno = 0; + const char *__pyx_filename = NULL; + int __pyx_clineno = 0; + PyGILState_STATE __pyx_gilstate_save; + + /* "spacy/pipeline/_parser_internals/nonproj.pyx":60 + * # if there is a token k, h < k < d such that h is not + * # an ancestor of k. Same for h -> d, h > d + * head = heads[tokenid] # <<<<<<<<<<<<<< + * if head == tokenid: # root arcs cannot be non-projective + * return False +*/ + __pyx_v_head = (__pyx_v_heads[__pyx_v_tokenid]); + + /* "spacy/pipeline/_parser_internals/nonproj.pyx":61 + * # an ancestor of k. Same for h -> d, h > d + * head = heads[tokenid] + * if head == tokenid: # root arcs cannot be non-projective # <<<<<<<<<<<<<< + * return False + * elif head < 0: # unattached tokens cannot be non-projective +*/ + __pyx_t_1 = (__pyx_v_head == __pyx_v_tokenid); + if (__pyx_t_1) { + + /* "spacy/pipeline/_parser_internals/nonproj.pyx":62 + * head = heads[tokenid] + * if head == tokenid: # root arcs cannot be non-projective + * return False # <<<<<<<<<<<<<< + * elif head < 0: # unattached tokens cannot be non-projective + * return False +*/ + __pyx_r = 0; + goto __pyx_L0; + + /* "spacy/pipeline/_parser_internals/nonproj.pyx":61 + * # an ancestor of k. Same for h -> d, h > d + * head = heads[tokenid] + * if head == tokenid: # root arcs cannot be non-projective # <<<<<<<<<<<<<< + * return False + * elif head < 0: # unattached tokens cannot be non-projective +*/ + } + + /* "spacy/pipeline/_parser_internals/nonproj.pyx":63 + * if head == tokenid: # root arcs cannot be non-projective + * return False + * elif head < 0: # unattached tokens cannot be non-projective # <<<<<<<<<<<<<< + * return False + * +*/ + __pyx_t_1 = (__pyx_v_head < 0); + if (__pyx_t_1) { + + /* "spacy/pipeline/_parser_internals/nonproj.pyx":64 + * return False + * elif head < 0: # unattached tokens cannot be non-projective + * return False # <<<<<<<<<<<<<< + * + * cdef int start, end +*/ + __pyx_r = 0; + goto __pyx_L0; + + /* "spacy/pipeline/_parser_internals/nonproj.pyx":63 + * if head == tokenid: # root arcs cannot be non-projective + * return False + * elif head < 0: # unattached tokens cannot be non-projective # <<<<<<<<<<<<<< + * return False + * +*/ + } + + /* "spacy/pipeline/_parser_internals/nonproj.pyx":67 + * + * cdef int start, end + * if head < tokenid: # <<<<<<<<<<<<<< + * start, end = (head+1, tokenid) + * else: +*/ + __pyx_t_1 = (__pyx_v_head < __pyx_v_tokenid); + if (__pyx_t_1) { + + /* "spacy/pipeline/_parser_internals/nonproj.pyx":68 + * cdef int start, end + * if head < tokenid: + * start, end = (head+1, tokenid) # <<<<<<<<<<<<<< + * else: + * start, end = (tokenid+1, head) +*/ + __pyx_t_2 = (__pyx_v_head + 1); + __pyx_t_3 = __pyx_v_tokenid; + __pyx_v_start = __pyx_t_2; + __pyx_v_end = __pyx_t_3; + + /* "spacy/pipeline/_parser_internals/nonproj.pyx":67 + * + * cdef int start, end + * if head < tokenid: # <<<<<<<<<<<<<< + * start, end = (head+1, tokenid) + * else: +*/ + goto __pyx_L4; + } + + /* "spacy/pipeline/_parser_internals/nonproj.pyx":70 + * start, end = (head+1, tokenid) + * else: + * start, end = (tokenid+1, head) # <<<<<<<<<<<<<< + * for k in range(start, end): + * if not _has_head_as_ancestor(k, head, heads): +*/ + /*else*/ { + __pyx_t_2 = (__pyx_v_tokenid + 1); + __pyx_t_3 = __pyx_v_head; + __pyx_v_start = __pyx_t_2; + __pyx_v_end = __pyx_t_3; + } + __pyx_L4:; + + /* "spacy/pipeline/_parser_internals/nonproj.pyx":71 + * else: + * start, end = (tokenid+1, head) + * for k in range(start, end): # <<<<<<<<<<<<<< + * if not _has_head_as_ancestor(k, head, heads): + * return True +*/ + __pyx_t_3 = __pyx_v_end; + __pyx_t_4 = __pyx_t_3; + for (__pyx_t_5 = __pyx_v_start; __pyx_t_5 < __pyx_t_4; __pyx_t_5+=1) { + __pyx_v_k = __pyx_t_5; + + /* "spacy/pipeline/_parser_internals/nonproj.pyx":72 + * start, end = (tokenid+1, head) + * for k in range(start, end): + * if not _has_head_as_ancestor(k, head, heads): # <<<<<<<<<<<<<< + * return True + * return False +*/ + __pyx_t_6 = __pyx_f_5spacy_8pipeline_17_parser_internals_7nonproj__has_head_as_ancestor(__pyx_v_k, __pyx_v_head, __pyx_v_heads); if (unlikely(__pyx_t_6 == ((bool)-1) && __Pyx_ErrOccurredWithGIL())) __PYX_ERR(0, 72, __pyx_L1_error) + __pyx_t_1 = (!(__pyx_t_6 != 0)); + if (__pyx_t_1) { + + /* "spacy/pipeline/_parser_internals/nonproj.pyx":73 + * for k in range(start, end): + * if not _has_head_as_ancestor(k, head, heads): + * return True # <<<<<<<<<<<<<< + * return False + * +*/ + __pyx_r = 1; + goto __pyx_L0; + + /* "spacy/pipeline/_parser_internals/nonproj.pyx":72 + * start, end = (tokenid+1, head) + * for k in range(start, end): + * if not _has_head_as_ancestor(k, head, heads): # <<<<<<<<<<<<<< + * return True + * return False +*/ + } + } + + /* "spacy/pipeline/_parser_internals/nonproj.pyx":74 + * if not _has_head_as_ancestor(k, head, heads): + * return True + * return False # <<<<<<<<<<<<<< + * + * +*/ + __pyx_r = 0; + goto __pyx_L0; + + /* "spacy/pipeline/_parser_internals/nonproj.pyx":56 + * + * + * cdef bool _is_nonproj_arc(int tokenid, const vector[int]& heads) nogil except *: # <<<<<<<<<<<<<< + * # definition (e.g. Havelka 2007): an arc h -> d, h < d is non-projective + * # if there is a token k, h < k < d such that h is not +*/ + + /* function exit code */ + __pyx_L1_error:; + __pyx_gilstate_save = __Pyx_PyGILState_Ensure(); + __Pyx_AddTraceback("spacy.pipeline._parser_internals.nonproj._is_nonproj_arc", __pyx_clineno, __pyx_lineno, __pyx_filename); + __pyx_r = -1; + __Pyx_PyGILState_Release(__pyx_gilstate_save); + __pyx_L0:; + return __pyx_r; +} + +/* "spacy/pipeline/_parser_internals/nonproj.pyx":77 + * + * + * cdef bool _has_head_as_ancestor(int tokenid, int head, const vector[int]& heads) nogil except *: # <<<<<<<<<<<<<< + * ancestor = tokenid + * cdef unordered_set[int] seen_tokens +*/ + +static bool __pyx_f_5spacy_8pipeline_17_parser_internals_7nonproj__has_head_as_ancestor(int __pyx_v_tokenid, int __pyx_v_head, std::vector const &__pyx_v_heads) { + int __pyx_v_ancestor; + std::unordered_set __pyx_v_seen_tokens; + std::pair ::iterator,int> __pyx_v_result; + bool __pyx_r; + int __pyx_t_1; + int __pyx_t_2; + std::pair ::iterator,int> __pyx_t_3; + int __pyx_lineno = 0; + const char *__pyx_filename = NULL; + int __pyx_clineno = 0; + PyGILState_STATE __pyx_gilstate_save; + + /* "spacy/pipeline/_parser_internals/nonproj.pyx":78 + * + * cdef bool _has_head_as_ancestor(int tokenid, int head, const vector[int]& heads) nogil except *: + * ancestor = tokenid # <<<<<<<<<<<<<< + * cdef unordered_set[int] seen_tokens + * seen_tokens.insert(ancestor) +*/ + __pyx_v_ancestor = __pyx_v_tokenid; + + /* "spacy/pipeline/_parser_internals/nonproj.pyx":80 + * ancestor = tokenid + * cdef unordered_set[int] seen_tokens + * seen_tokens.insert(ancestor) # <<<<<<<<<<<<<< + * while True: + * # Reached the head or a disconnected node +*/ + try { + __pyx_v_seen_tokens.insert(__pyx_v_ancestor); + } catch(...) { + PyGILState_STATE __pyx_gilstate_save = __Pyx_PyGILState_Ensure(); + __Pyx_CppExn2PyErr(); + __Pyx_PyGILState_Release(__pyx_gilstate_save); + __PYX_ERR(0, 80, __pyx_L1_error) + } + + /* "spacy/pipeline/_parser_internals/nonproj.pyx":81 + * cdef unordered_set[int] seen_tokens + * seen_tokens.insert(ancestor) + * while True: # <<<<<<<<<<<<<< + * # Reached the head or a disconnected node + * if heads[ancestor] == head or heads[ancestor] < 0: +*/ + while (1) { + + /* "spacy/pipeline/_parser_internals/nonproj.pyx":83 + * while True: + * # Reached the head or a disconnected node + * if heads[ancestor] == head or heads[ancestor] < 0: # <<<<<<<<<<<<<< + * return True + * # Reached the root +*/ + __pyx_t_2 = ((__pyx_v_heads[__pyx_v_ancestor]) == __pyx_v_head); + if (!__pyx_t_2) { + } else { + __pyx_t_1 = __pyx_t_2; + goto __pyx_L6_bool_binop_done; + } + __pyx_t_2 = ((__pyx_v_heads[__pyx_v_ancestor]) < 0); + __pyx_t_1 = __pyx_t_2; + __pyx_L6_bool_binop_done:; + if (__pyx_t_1) { + + /* "spacy/pipeline/_parser_internals/nonproj.pyx":84 + * # Reached the head or a disconnected node + * if heads[ancestor] == head or heads[ancestor] < 0: + * return True # <<<<<<<<<<<<<< + * # Reached the root + * if heads[ancestor] == ancestor: +*/ + __pyx_r = 1; + goto __pyx_L0; + + /* "spacy/pipeline/_parser_internals/nonproj.pyx":83 + * while True: + * # Reached the head or a disconnected node + * if heads[ancestor] == head or heads[ancestor] < 0: # <<<<<<<<<<<<<< + * return True + * # Reached the root +*/ + } + + /* "spacy/pipeline/_parser_internals/nonproj.pyx":86 + * return True + * # Reached the root + * if heads[ancestor] == ancestor: # <<<<<<<<<<<<<< + * return False + * ancestor = heads[ancestor] +*/ + __pyx_t_1 = ((__pyx_v_heads[__pyx_v_ancestor]) == __pyx_v_ancestor); + if (__pyx_t_1) { + + /* "spacy/pipeline/_parser_internals/nonproj.pyx":87 + * # Reached the root + * if heads[ancestor] == ancestor: + * return False # <<<<<<<<<<<<<< + * ancestor = heads[ancestor] + * result = seen_tokens.insert(ancestor) +*/ + __pyx_r = 0; + goto __pyx_L0; + + /* "spacy/pipeline/_parser_internals/nonproj.pyx":86 + * return True + * # Reached the root + * if heads[ancestor] == ancestor: # <<<<<<<<<<<<<< + * return False + * ancestor = heads[ancestor] +*/ + } + + /* "spacy/pipeline/_parser_internals/nonproj.pyx":88 + * if heads[ancestor] == ancestor: + * return False + * ancestor = heads[ancestor] # <<<<<<<<<<<<<< + * result = seen_tokens.insert(ancestor) + * # Found cycle +*/ + __pyx_v_ancestor = (__pyx_v_heads[__pyx_v_ancestor]); + + /* "spacy/pipeline/_parser_internals/nonproj.pyx":89 + * return False + * ancestor = heads[ancestor] + * result = seen_tokens.insert(ancestor) # <<<<<<<<<<<<<< + * # Found cycle + * if not result.second: +*/ + try { + __pyx_t_3 = __pyx_v_seen_tokens.insert(__pyx_v_ancestor); + } catch(...) { + PyGILState_STATE __pyx_gilstate_save = __Pyx_PyGILState_Ensure(); + __Pyx_CppExn2PyErr(); + __Pyx_PyGILState_Release(__pyx_gilstate_save); + __PYX_ERR(0, 89, __pyx_L1_error) + } + __pyx_v_result = __PYX_STD_MOVE_IF_SUPPORTED(__pyx_t_3); + + /* "spacy/pipeline/_parser_internals/nonproj.pyx":91 + * result = seen_tokens.insert(ancestor) + * # Found cycle + * if not result.second: # <<<<<<<<<<<<<< + * raise_domain_error(heads_to_string(heads)) + * +*/ + __pyx_t_1 = (!__pyx_v_result.second); + if (__pyx_t_1) { + + /* "spacy/pipeline/_parser_internals/nonproj.pyx":92 + * # Found cycle + * if not result.second: + * raise_domain_error(heads_to_string(heads)) # <<<<<<<<<<<<<< + * + * return False +*/ + try { + raise_domain_error(__pyx_f_5spacy_8pipeline_17_parser_internals_7nonproj_heads_to_string(__pyx_v_heads)); + } catch(...) { + PyGILState_STATE __pyx_gilstate_save = __Pyx_PyGILState_Ensure(); + __Pyx_CppExn2PyErr(); + __Pyx_PyGILState_Release(__pyx_gilstate_save); + __PYX_ERR(0, 92, __pyx_L1_error) + } + + /* "spacy/pipeline/_parser_internals/nonproj.pyx":91 + * result = seen_tokens.insert(ancestor) + * # Found cycle + * if not result.second: # <<<<<<<<<<<<<< + * raise_domain_error(heads_to_string(heads)) + * +*/ + } + } + + /* "spacy/pipeline/_parser_internals/nonproj.pyx":94 + * raise_domain_error(heads_to_string(heads)) + * + * return False # <<<<<<<<<<<<<< + * + * +*/ + __pyx_r = 0; + goto __pyx_L0; + + /* "spacy/pipeline/_parser_internals/nonproj.pyx":77 + * + * + * cdef bool _has_head_as_ancestor(int tokenid, int head, const vector[int]& heads) nogil except *: # <<<<<<<<<<<<<< + * ancestor = tokenid + * cdef unordered_set[int] seen_tokens +*/ + + /* function exit code */ + __pyx_L1_error:; + __pyx_gilstate_save = __Pyx_PyGILState_Ensure(); + __Pyx_AddTraceback("spacy.pipeline._parser_internals.nonproj._has_head_as_ancestor", __pyx_clineno, __pyx_lineno, __pyx_filename); + __pyx_r = -1; + __Pyx_PyGILState_Release(__pyx_gilstate_save); + __pyx_L0:; + return __pyx_r; +} + +/* "spacy/pipeline/_parser_internals/nonproj.pyx":97 + * + * + * cdef string heads_to_string(const vector[int]& heads) noexcept nogil: # <<<<<<<<<<<<<< + * cdef vector[int].const_iterator citer + * cdef string cycle_str +*/ + +static std::string __pyx_f_5spacy_8pipeline_17_parser_internals_7nonproj_heads_to_string(std::vector const &__pyx_v_heads) { + std::vector ::const_iterator __pyx_v_citer; + std::string __pyx_v_cycle_str; + std::string __pyx_r; + int __pyx_t_1; + std::string __pyx_t_2; + int __pyx_lineno = 0; + const char *__pyx_filename = NULL; + int __pyx_clineno = 0; + PyGILState_STATE __pyx_gilstate_save; + + /* "spacy/pipeline/_parser_internals/nonproj.pyx":101 + * cdef string cycle_str + * + * cycle_str.append("Found cycle in dependency graph: [") # <<<<<<<<<<<<<< + * + * # FIXME: Rewrite using ostringstream when available in Cython. +*/ + try { + __pyx_v_cycle_str.append(((char const *)"Found cycle in dependency graph: [")); + } catch(...) { + PyGILState_STATE __pyx_gilstate_save = __Pyx_PyGILState_Ensure(); + __Pyx_CppExn2PyErr(); + __Pyx_PyGILState_Release(__pyx_gilstate_save); + __PYX_ERR(0, 101, __pyx_L1_error) + } + + /* "spacy/pipeline/_parser_internals/nonproj.pyx":104 + * + * # FIXME: Rewrite using ostringstream when available in Cython. + * citer = heads.const_begin() # <<<<<<<<<<<<<< + * while citer != heads.const_end(): + * if citer != heads.const_begin(): +*/ + try { + __pyx_v_citer = __pyx_v_heads.begin(); + } catch(...) { + PyGILState_STATE __pyx_gilstate_save = __Pyx_PyGILState_Ensure(); + __Pyx_CppExn2PyErr(); + __Pyx_PyGILState_Release(__pyx_gilstate_save); + __PYX_ERR(0, 104, __pyx_L1_error) + } + + /* "spacy/pipeline/_parser_internals/nonproj.pyx":105 + * # FIXME: Rewrite using ostringstream when available in Cython. + * citer = heads.const_begin() + * while citer != heads.const_end(): # <<<<<<<<<<<<<< + * if citer != heads.const_begin(): + * cycle_str.append(", ") +*/ + while (1) { + __pyx_t_1 = (__pyx_v_citer != __pyx_v_heads.end()); + if (!__pyx_t_1) break; + + /* "spacy/pipeline/_parser_internals/nonproj.pyx":106 + * citer = heads.const_begin() + * while citer != heads.const_end(): + * if citer != heads.const_begin(): # <<<<<<<<<<<<<< + * cycle_str.append(", ") + * cycle_str.append(to_string(deref(citer))) +*/ + __pyx_t_1 = (__pyx_v_citer != __pyx_v_heads.begin()); + if (__pyx_t_1) { + + /* "spacy/pipeline/_parser_internals/nonproj.pyx":107 + * while citer != heads.const_end(): + * if citer != heads.const_begin(): + * cycle_str.append(", ") # <<<<<<<<<<<<<< + * cycle_str.append(to_string(deref(citer))) + * incr(citer) +*/ + try { + __pyx_v_cycle_str.append(((char const *)", ")); + } catch(...) { + PyGILState_STATE __pyx_gilstate_save = __Pyx_PyGILState_Ensure(); + __Pyx_CppExn2PyErr(); + __Pyx_PyGILState_Release(__pyx_gilstate_save); + __PYX_ERR(0, 107, __pyx_L1_error) + } + + /* "spacy/pipeline/_parser_internals/nonproj.pyx":106 + * citer = heads.const_begin() + * while citer != heads.const_end(): + * if citer != heads.const_begin(): # <<<<<<<<<<<<<< + * cycle_str.append(", ") + * cycle_str.append(to_string(deref(citer))) +*/ + } + + /* "spacy/pipeline/_parser_internals/nonproj.pyx":108 + * if citer != heads.const_begin(): + * cycle_str.append(", ") + * cycle_str.append(to_string(deref(citer))) # <<<<<<<<<<<<<< + * incr(citer) + * cycle_str.append("]") +*/ + try { + __pyx_t_2 = std::to_string((*__pyx_v_citer)); + } catch(...) { + PyGILState_STATE __pyx_gilstate_save = __Pyx_PyGILState_Ensure(); + __Pyx_CppExn2PyErr(); + __Pyx_PyGILState_Release(__pyx_gilstate_save); + __PYX_ERR(0, 108, __pyx_L1_error) + } + try { + __pyx_v_cycle_str.append(__pyx_t_2); + } catch(...) { + PyGILState_STATE __pyx_gilstate_save = __Pyx_PyGILState_Ensure(); + __Pyx_CppExn2PyErr(); + __Pyx_PyGILState_Release(__pyx_gilstate_save); + __PYX_ERR(0, 108, __pyx_L1_error) + } + + /* "spacy/pipeline/_parser_internals/nonproj.pyx":109 + * cycle_str.append(", ") + * cycle_str.append(to_string(deref(citer))) + * incr(citer) # <<<<<<<<<<<<<< + * cycle_str.append("]") + * +*/ + (void)((++__pyx_v_citer)); + } + + /* "spacy/pipeline/_parser_internals/nonproj.pyx":110 + * cycle_str.append(to_string(deref(citer))) + * incr(citer) + * cycle_str.append("]") # <<<<<<<<<<<<<< + * + * return cycle_str +*/ + try { + __pyx_v_cycle_str.append(((char const *)"]")); + } catch(...) { + PyGILState_STATE __pyx_gilstate_save = __Pyx_PyGILState_Ensure(); + __Pyx_CppExn2PyErr(); + __Pyx_PyGILState_Release(__pyx_gilstate_save); + __PYX_ERR(0, 110, __pyx_L1_error) + } + + /* "spacy/pipeline/_parser_internals/nonproj.pyx":112 + * cycle_str.append("]") + * + * return cycle_str # <<<<<<<<<<<<<< + * + * +*/ + __pyx_r = __pyx_v_cycle_str; + goto __pyx_L0; + + /* "spacy/pipeline/_parser_internals/nonproj.pyx":97 + * + * + * cdef string heads_to_string(const vector[int]& heads) noexcept nogil: # <<<<<<<<<<<<<< + * cdef vector[int].const_iterator citer + * cdef string cycle_str +*/ + + /* function exit code */ + __pyx_L1_error:; + __pyx_gilstate_save = __Pyx_PyGILState_Ensure(); + __Pyx_WriteUnraisable("spacy.pipeline._parser_internals.nonproj.heads_to_string", __pyx_clineno, __pyx_lineno, __pyx_filename, 1, 0); + __Pyx_pretend_to_initialize(&__pyx_r); + __Pyx_PyGILState_Release(__pyx_gilstate_save); + __pyx_L0:; + return __pyx_r; +} + +/* "spacy/pipeline/_parser_internals/nonproj.pyx":115 + * + * + * def is_nonproj_tree(heads): # <<<<<<<<<<<<<< + * cdef vector[int] c_heads = _heads_to_c(heads) + * # a tree is non-projective if at least one arc is non-projective +*/ + +/* Python wrapper */ +static PyObject *__pyx_pw_5spacy_8pipeline_17_parser_internals_7nonproj_8is_nonproj_tree(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_5spacy_8pipeline_17_parser_internals_7nonproj_7is_nonproj_tree, "is_nonproj_tree(heads)"); +static PyMethodDef __pyx_mdef_5spacy_8pipeline_17_parser_internals_7nonproj_8is_nonproj_tree = {"is_nonproj_tree", (PyCFunction)(void(*)(void))(__Pyx_PyCFunction_FastCallWithKeywords)__pyx_pw_5spacy_8pipeline_17_parser_internals_7nonproj_8is_nonproj_tree, __Pyx_METH_FASTCALL|METH_KEYWORDS, __pyx_doc_5spacy_8pipeline_17_parser_internals_7nonproj_7is_nonproj_tree}; +static PyObject *__pyx_pw_5spacy_8pipeline_17_parser_internals_7nonproj_8is_nonproj_tree(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 +) { + PyObject *__pyx_v_heads = 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("is_nonproj_tree (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_heads,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, 115, __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, 115, __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, "is_nonproj_tree", 0) < (0)) __PYX_ERR(0, 115, __pyx_L3_error) + for (Py_ssize_t i = __pyx_nargs; i < 1; i++) { + if (unlikely(!values[i])) { __Pyx_RaiseArgtupleInvalid("is_nonproj_tree", 1, 1, 1, i); __PYX_ERR(0, 115, __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, 115, __pyx_L3_error) + } + __pyx_v_heads = values[0]; + } + goto __pyx_L6_skip; + __pyx_L5_argtuple_error:; + __Pyx_RaiseArgtupleInvalid("is_nonproj_tree", 1, 1, 1, __pyx_nargs); __PYX_ERR(0, 115, __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("spacy.pipeline._parser_internals.nonproj.is_nonproj_tree", __pyx_clineno, __pyx_lineno, __pyx_filename); + __Pyx_RefNannyFinishContext(); + return NULL; + __pyx_L4_argument_unpacking_done:; + __pyx_r = __pyx_pf_5spacy_8pipeline_17_parser_internals_7nonproj_7is_nonproj_tree(__pyx_self, __pyx_v_heads); + + /* 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_gb_5spacy_8pipeline_17_parser_internals_7nonproj_15is_nonproj_tree_2generator1(__pyx_CoroutineObject *__pyx_generator, CYTHON_UNUSED PyThreadState *__pyx_tstate, PyObject *__pyx_sent_value); /* proto */ + +/* "spacy/pipeline/_parser_internals/nonproj.pyx":118 + * cdef vector[int] c_heads = _heads_to_c(heads) + * # a tree is non-projective if at least one arc is non-projective + * return any(_is_nonproj_arc(word, c_heads) for word in range(len(heads))) # <<<<<<<<<<<<<< + * + * +*/ + +static PyObject *__pyx_pf_5spacy_8pipeline_17_parser_internals_7nonproj_15is_nonproj_tree_genexpr(PyObject *__pyx_self, Py_ssize_t __pyx_genexpr_arg_0) { + struct __pyx_obj_5spacy_8pipeline_17_parser_internals_7nonproj___pyx_scope_struct_2_genexpr *__pyx_cur_scope; + PyObject *__pyx_r = NULL; + __Pyx_RefNannyDeclarations + int __pyx_lineno = 0; + const char *__pyx_filename = NULL; + int __pyx_clineno = 0; + __Pyx_RefNannySetupContext("genexpr", 0); + __pyx_cur_scope = (struct __pyx_obj_5spacy_8pipeline_17_parser_internals_7nonproj___pyx_scope_struct_2_genexpr *)__pyx_tp_new_5spacy_8pipeline_17_parser_internals_7nonproj___pyx_scope_struct_2_genexpr(__pyx_mstate_global->__pyx_ptype_5spacy_8pipeline_17_parser_internals_7nonproj___pyx_scope_struct_2_genexpr, __pyx_mstate_global->__pyx_empty_tuple, NULL); + if (unlikely(!__pyx_cur_scope)) { + __pyx_cur_scope = ((struct __pyx_obj_5spacy_8pipeline_17_parser_internals_7nonproj___pyx_scope_struct_2_genexpr *)Py_None); + __Pyx_INCREF(Py_None); + __PYX_ERR(0, 118, __pyx_L1_error) + } else { + __Pyx_GOTREF((PyObject *)__pyx_cur_scope); + } + __pyx_cur_scope->__pyx_outer_scope = (struct __pyx_obj_5spacy_8pipeline_17_parser_internals_7nonproj___pyx_scope_struct_1_is_nonproj_tree *) __pyx_self; + __Pyx_INCREF((PyObject *)__pyx_cur_scope->__pyx_outer_scope); + __Pyx_GIVEREF((PyObject *)__pyx_cur_scope->__pyx_outer_scope); + __pyx_cur_scope->__pyx_genexpr_arg_0 = __pyx_genexpr_arg_0; + { + __pyx_CoroutineObject *gen = __Pyx_Generator_New((__pyx_coroutine_body_t) __pyx_gb_5spacy_8pipeline_17_parser_internals_7nonproj_15is_nonproj_tree_2generator1, ((PyObject *)__pyx_mstate_global->__pyx_codeobj_tab[1]), (PyObject *) __pyx_cur_scope, __pyx_mstate_global->__pyx_n_u_genexpr, __pyx_mstate_global->__pyx_n_u_is_nonproj_tree_locals_genexpr, __pyx_mstate_global->__pyx_n_u_spacy_pipeline__parser_internals); if (unlikely(!gen)) __PYX_ERR(0, 118, __pyx_L1_error) + __Pyx_DECREF(__pyx_cur_scope); + __Pyx_RefNannyFinishContext(); + return (PyObject *) gen; + } + + /* function exit code */ + __pyx_L1_error:; + __Pyx_AddTraceback("spacy.pipeline._parser_internals.nonproj.is_nonproj_tree.genexpr", __pyx_clineno, __pyx_lineno, __pyx_filename); + __pyx_r = NULL; + __Pyx_DECREF((PyObject *)__pyx_cur_scope); + __Pyx_XGIVEREF(__pyx_r); + __Pyx_RefNannyFinishContext(); + return __pyx_r; +} + +static PyObject *__pyx_gb_5spacy_8pipeline_17_parser_internals_7nonproj_15is_nonproj_tree_2generator1(__pyx_CoroutineObject *__pyx_generator, CYTHON_UNUSED PyThreadState *__pyx_tstate, PyObject *__pyx_sent_value) /* generator body */ +{ + struct __pyx_obj_5spacy_8pipeline_17_parser_internals_7nonproj___pyx_scope_struct_2_genexpr *__pyx_cur_scope = ((struct __pyx_obj_5spacy_8pipeline_17_parser_internals_7nonproj___pyx_scope_struct_2_genexpr *)__pyx_generator->closure); + PyObject *__pyx_r = NULL; + Py_ssize_t __pyx_t_1; + Py_ssize_t __pyx_t_2; + Py_ssize_t __pyx_t_3; + bool __pyx_t_4; + int __pyx_t_5; + int __pyx_lineno = 0; + const char *__pyx_filename = NULL; + int __pyx_clineno = 0; + __Pyx_RefNannyDeclarations + __Pyx_RefNannySetupContext("genexpr", 0); + switch (__pyx_generator->resume_label) { + case 0: goto __pyx_L3_first_run; + default: /* CPython raises the right error here */ + __Pyx_RefNannyFinishContext(); + return NULL; + } + __pyx_L3_first_run:; + if (unlikely(!__pyx_sent_value)) __PYX_ERR(0, 118, __pyx_L1_error) + __pyx_t_1 = __pyx_cur_scope->__pyx_genexpr_arg_0; + __pyx_t_2 = __pyx_t_1; + for (__pyx_t_3 = 0; __pyx_t_3 < __pyx_t_2; __pyx_t_3+=1) { + __pyx_cur_scope->__pyx_v_word = __pyx_t_3; + __pyx_t_4 = __pyx_f_5spacy_8pipeline_17_parser_internals_7nonproj__is_nonproj_arc(__pyx_cur_scope->__pyx_v_word, __pyx_cur_scope->__pyx_outer_scope->__pyx_v_c_heads); if (unlikely(__pyx_t_4 == ((bool)-1) && PyErr_Occurred())) __PYX_ERR(0, 118, __pyx_L1_error) + __pyx_t_5 = (__pyx_t_4 != 0); + if (__pyx_t_5) { + __Pyx_XDECREF(__pyx_r); + __Pyx_INCREF(Py_True); + __pyx_r = Py_True; + goto __pyx_L0; + } + } + /*else*/ { + __Pyx_XDECREF(__pyx_r); + __Pyx_INCREF(Py_False); + __pyx_r = Py_False; + goto __pyx_L0; + } + CYTHON_MAYBE_UNUSED_VAR(__pyx_cur_scope); + + /* function exit code */ + goto __pyx_L0; + __pyx_L1_error:; + if (__Pyx_PyErr_Occurred()) { + __Pyx_AddTraceback("genexpr", __pyx_clineno, __pyx_lineno, __pyx_filename); + } + __pyx_L0:; + __Pyx_XGIVEREF(__pyx_r); + #if !CYTHON_USE_EXC_INFO_STACK + __Pyx_Coroutine_ResetAndClearException(__pyx_generator); + #endif + __pyx_generator->resume_label = -1; + __Pyx_Coroutine_clear((PyObject*)__pyx_generator); + __Pyx_RefNannyFinishContext(); + return __pyx_r; +} + +/* "spacy/pipeline/_parser_internals/nonproj.pyx":115 + * + * + * def is_nonproj_tree(heads): # <<<<<<<<<<<<<< + * cdef vector[int] c_heads = _heads_to_c(heads) + * # a tree is non-projective if at least one arc is non-projective +*/ + +static PyObject *__pyx_pf_5spacy_8pipeline_17_parser_internals_7nonproj_7is_nonproj_tree(CYTHON_UNUSED PyObject *__pyx_self, PyObject *__pyx_v_heads) { + struct __pyx_obj_5spacy_8pipeline_17_parser_internals_7nonproj___pyx_scope_struct_1_is_nonproj_tree *__pyx_cur_scope; + PyObject *__pyx_gb_5spacy_8pipeline_17_parser_internals_7nonproj_15is_nonproj_tree_2generator1 = 0; + PyObject *__pyx_r = NULL; + __Pyx_RefNannyDeclarations + std::vector __pyx_t_1; + Py_ssize_t __pyx_t_2; + PyObject *__pyx_t_3 = NULL; + PyObject *__pyx_t_4 = NULL; + int __pyx_lineno = 0; + const char *__pyx_filename = NULL; + int __pyx_clineno = 0; + __Pyx_RefNannySetupContext("is_nonproj_tree", 0); + __pyx_cur_scope = (struct __pyx_obj_5spacy_8pipeline_17_parser_internals_7nonproj___pyx_scope_struct_1_is_nonproj_tree *)__pyx_tp_new_5spacy_8pipeline_17_parser_internals_7nonproj___pyx_scope_struct_1_is_nonproj_tree(__pyx_mstate_global->__pyx_ptype_5spacy_8pipeline_17_parser_internals_7nonproj___pyx_scope_struct_1_is_nonproj_tree, __pyx_mstate_global->__pyx_empty_tuple, NULL); + if (unlikely(!__pyx_cur_scope)) { + __pyx_cur_scope = ((struct __pyx_obj_5spacy_8pipeline_17_parser_internals_7nonproj___pyx_scope_struct_1_is_nonproj_tree *)Py_None); + __Pyx_INCREF(Py_None); + __PYX_ERR(0, 115, __pyx_L1_error) + } else { + __Pyx_GOTREF((PyObject *)__pyx_cur_scope); + } + + /* "spacy/pipeline/_parser_internals/nonproj.pyx":116 + * + * def is_nonproj_tree(heads): + * cdef vector[int] c_heads = _heads_to_c(heads) # <<<<<<<<<<<<<< + * # a tree is non-projective if at least one arc is non-projective + * return any(_is_nonproj_arc(word, c_heads) for word in range(len(heads))) +*/ + __pyx_t_1 = __pyx_f_5spacy_8pipeline_17_parser_internals_7nonproj__heads_to_c(__pyx_v_heads); if (unlikely(PyErr_Occurred())) __PYX_ERR(0, 116, __pyx_L1_error) + __pyx_cur_scope->__pyx_v_c_heads = __PYX_STD_MOVE_IF_SUPPORTED(__pyx_t_1); + + /* "spacy/pipeline/_parser_internals/nonproj.pyx":118 + * cdef vector[int] c_heads = _heads_to_c(heads) + * # a tree is non-projective if at least one arc is non-projective + * return any(_is_nonproj_arc(word, c_heads) for word in range(len(heads))) # <<<<<<<<<<<<<< + * + * +*/ + __Pyx_XDECREF(__pyx_r); + __pyx_t_2 = PyObject_Length(__pyx_v_heads); if (unlikely(__pyx_t_2 == ((Py_ssize_t)-1))) __PYX_ERR(0, 118, __pyx_L1_error) + __pyx_t_3 = __pyx_pf_5spacy_8pipeline_17_parser_internals_7nonproj_15is_nonproj_tree_genexpr(((PyObject*)__pyx_cur_scope), __pyx_t_2); if (unlikely(!__pyx_t_3)) __PYX_ERR(0, 118, __pyx_L1_error) + __Pyx_GOTREF(__pyx_t_3); + __pyx_t_4 = __Pyx_Generator_GetInlinedResult(__pyx_t_3); if (unlikely(!__pyx_t_4)) __PYX_ERR(0, 118, __pyx_L1_error) + __Pyx_GOTREF(__pyx_t_4); + __Pyx_DECREF(__pyx_t_3); __pyx_t_3 = 0; + __pyx_r = __pyx_t_4; + __pyx_t_4 = 0; + goto __pyx_L0; + + /* "spacy/pipeline/_parser_internals/nonproj.pyx":115 + * + * + * def is_nonproj_tree(heads): # <<<<<<<<<<<<<< + * cdef vector[int] c_heads = _heads_to_c(heads) + * # a tree is non-projective if at least one arc is non-projective +*/ + + /* function exit code */ + __pyx_L1_error:; + __Pyx_XDECREF(__pyx_t_3); + __Pyx_XDECREF(__pyx_t_4); + __Pyx_AddTraceback("spacy.pipeline._parser_internals.nonproj.is_nonproj_tree", __pyx_clineno, __pyx_lineno, __pyx_filename); + __pyx_r = NULL; + __pyx_L0:; + __Pyx_XDECREF(__pyx_gb_5spacy_8pipeline_17_parser_internals_7nonproj_15is_nonproj_tree_2generator1); + __Pyx_DECREF((PyObject *)__pyx_cur_scope); + __Pyx_XGIVEREF(__pyx_r); + __Pyx_RefNannyFinishContext(); + return __pyx_r; +} + +/* "spacy/pipeline/_parser_internals/nonproj.pyx":121 + * + * + * def decompose(label): # <<<<<<<<<<<<<< + * return label.partition(DELIMITER)[::2] + * +*/ + +/* Python wrapper */ +static PyObject *__pyx_pw_5spacy_8pipeline_17_parser_internals_7nonproj_10decompose(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_5spacy_8pipeline_17_parser_internals_7nonproj_9decompose, "decompose(label)"); +static PyMethodDef __pyx_mdef_5spacy_8pipeline_17_parser_internals_7nonproj_10decompose = {"decompose", (PyCFunction)(void(*)(void))(__Pyx_PyCFunction_FastCallWithKeywords)__pyx_pw_5spacy_8pipeline_17_parser_internals_7nonproj_10decompose, __Pyx_METH_FASTCALL|METH_KEYWORDS, __pyx_doc_5spacy_8pipeline_17_parser_internals_7nonproj_9decompose}; +static PyObject *__pyx_pw_5spacy_8pipeline_17_parser_internals_7nonproj_10decompose(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 +) { + PyObject *__pyx_v_label = 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("decompose (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_label,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, 121, __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, 121, __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, "decompose", 0) < (0)) __PYX_ERR(0, 121, __pyx_L3_error) + for (Py_ssize_t i = __pyx_nargs; i < 1; i++) { + if (unlikely(!values[i])) { __Pyx_RaiseArgtupleInvalid("decompose", 1, 1, 1, i); __PYX_ERR(0, 121, __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, 121, __pyx_L3_error) + } + __pyx_v_label = values[0]; + } + goto __pyx_L6_skip; + __pyx_L5_argtuple_error:; + __Pyx_RaiseArgtupleInvalid("decompose", 1, 1, 1, __pyx_nargs); __PYX_ERR(0, 121, __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("spacy.pipeline._parser_internals.nonproj.decompose", __pyx_clineno, __pyx_lineno, __pyx_filename); + __Pyx_RefNannyFinishContext(); + return NULL; + __pyx_L4_argument_unpacking_done:; + __pyx_r = __pyx_pf_5spacy_8pipeline_17_parser_internals_7nonproj_9decompose(__pyx_self, __pyx_v_label); + + /* 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_5spacy_8pipeline_17_parser_internals_7nonproj_9decompose(CYTHON_UNUSED PyObject *__pyx_self, PyObject *__pyx_v_label) { + 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_lineno = 0; + const char *__pyx_filename = NULL; + int __pyx_clineno = 0; + __Pyx_RefNannySetupContext("decompose", 0); + + /* "spacy/pipeline/_parser_internals/nonproj.pyx":122 + * + * def decompose(label): + * return label.partition(DELIMITER)[::2] # <<<<<<<<<<<<<< + * + * +*/ + __Pyx_XDECREF(__pyx_r); + __pyx_t_2 = __pyx_v_label; + __Pyx_INCREF(__pyx_t_2); + __Pyx_GetModuleGlobalName(__pyx_t_3, __pyx_mstate_global->__pyx_n_u_DELIMITER); if (unlikely(!__pyx_t_3)) __PYX_ERR(0, 122, __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_partition, __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, 122, __pyx_L1_error) + __Pyx_GOTREF(__pyx_t_1); + } + __pyx_t_3 = __Pyx_PyObject_GetItem(__pyx_t_1, __pyx_mstate_global->__pyx_slice[1]); if (unlikely(!__pyx_t_3)) __PYX_ERR(0, 122, __pyx_L1_error) + __Pyx_GOTREF(__pyx_t_3); + __Pyx_DECREF(__pyx_t_1); __pyx_t_1 = 0; + __pyx_r = __pyx_t_3; + __pyx_t_3 = 0; + goto __pyx_L0; + + /* "spacy/pipeline/_parser_internals/nonproj.pyx":121 + * + * + * def decompose(label): # <<<<<<<<<<<<<< + * return label.partition(DELIMITER)[::2] + * +*/ + + /* function exit code */ + __pyx_L1_error:; + __Pyx_XDECREF(__pyx_t_1); + __Pyx_XDECREF(__pyx_t_2); + __Pyx_XDECREF(__pyx_t_3); + __Pyx_AddTraceback("spacy.pipeline._parser_internals.nonproj.decompose", __pyx_clineno, __pyx_lineno, __pyx_filename); + __pyx_r = NULL; + __pyx_L0:; + __Pyx_XGIVEREF(__pyx_r); + __Pyx_RefNannyFinishContext(); + return __pyx_r; +} + +/* "spacy/pipeline/_parser_internals/nonproj.pyx":125 + * + * + * def is_decorated(label): # <<<<<<<<<<<<<< + * return DELIMITER in label + * +*/ + +/* Python wrapper */ +static PyObject *__pyx_pw_5spacy_8pipeline_17_parser_internals_7nonproj_12is_decorated(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_5spacy_8pipeline_17_parser_internals_7nonproj_11is_decorated, "is_decorated(label)"); +static PyMethodDef __pyx_mdef_5spacy_8pipeline_17_parser_internals_7nonproj_12is_decorated = {"is_decorated", (PyCFunction)(void(*)(void))(__Pyx_PyCFunction_FastCallWithKeywords)__pyx_pw_5spacy_8pipeline_17_parser_internals_7nonproj_12is_decorated, __Pyx_METH_FASTCALL|METH_KEYWORDS, __pyx_doc_5spacy_8pipeline_17_parser_internals_7nonproj_11is_decorated}; +static PyObject *__pyx_pw_5spacy_8pipeline_17_parser_internals_7nonproj_12is_decorated(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 +) { + PyObject *__pyx_v_label = 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("is_decorated (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_label,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, 125, __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, 125, __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, "is_decorated", 0) < (0)) __PYX_ERR(0, 125, __pyx_L3_error) + for (Py_ssize_t i = __pyx_nargs; i < 1; i++) { + if (unlikely(!values[i])) { __Pyx_RaiseArgtupleInvalid("is_decorated", 1, 1, 1, i); __PYX_ERR(0, 125, __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, 125, __pyx_L3_error) + } + __pyx_v_label = values[0]; + } + goto __pyx_L6_skip; + __pyx_L5_argtuple_error:; + __Pyx_RaiseArgtupleInvalid("is_decorated", 1, 1, 1, __pyx_nargs); __PYX_ERR(0, 125, __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("spacy.pipeline._parser_internals.nonproj.is_decorated", __pyx_clineno, __pyx_lineno, __pyx_filename); + __Pyx_RefNannyFinishContext(); + return NULL; + __pyx_L4_argument_unpacking_done:; + __pyx_r = __pyx_pf_5spacy_8pipeline_17_parser_internals_7nonproj_11is_decorated(__pyx_self, __pyx_v_label); + + /* 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_5spacy_8pipeline_17_parser_internals_7nonproj_11is_decorated(CYTHON_UNUSED PyObject *__pyx_self, PyObject *__pyx_v_label) { + PyObject *__pyx_r = NULL; + __Pyx_RefNannyDeclarations + PyObject *__pyx_t_1 = NULL; + int __pyx_t_2; + int __pyx_lineno = 0; + const char *__pyx_filename = NULL; + int __pyx_clineno = 0; + __Pyx_RefNannySetupContext("is_decorated", 0); + + /* "spacy/pipeline/_parser_internals/nonproj.pyx":126 + * + * def is_decorated(label): + * return DELIMITER in label # <<<<<<<<<<<<<< + * + * +*/ + __Pyx_XDECREF(__pyx_r); + __Pyx_GetModuleGlobalName(__pyx_t_1, __pyx_mstate_global->__pyx_n_u_DELIMITER); if (unlikely(!__pyx_t_1)) __PYX_ERR(0, 126, __pyx_L1_error) + __Pyx_GOTREF(__pyx_t_1); + __pyx_t_2 = (__Pyx_PySequence_ContainsTF(__pyx_t_1, __pyx_v_label, Py_EQ)); if (unlikely((__pyx_t_2 < 0))) __PYX_ERR(0, 126, __pyx_L1_error) + __Pyx_DECREF(__pyx_t_1); __pyx_t_1 = 0; + __pyx_t_1 = __Pyx_PyBool_FromLong(__pyx_t_2); if (unlikely(!__pyx_t_1)) __PYX_ERR(0, 126, __pyx_L1_error) + __Pyx_GOTREF(__pyx_t_1); + __pyx_r = __pyx_t_1; + __pyx_t_1 = 0; + goto __pyx_L0; + + /* "spacy/pipeline/_parser_internals/nonproj.pyx":125 + * + * + * def is_decorated(label): # <<<<<<<<<<<<<< + * return DELIMITER in label + * +*/ + + /* function exit code */ + __pyx_L1_error:; + __Pyx_XDECREF(__pyx_t_1); + __Pyx_AddTraceback("spacy.pipeline._parser_internals.nonproj.is_decorated", __pyx_clineno, __pyx_lineno, __pyx_filename); + __pyx_r = NULL; + __pyx_L0:; + __Pyx_XGIVEREF(__pyx_r); + __Pyx_RefNannyFinishContext(); + return __pyx_r; +} + +/* "spacy/pipeline/_parser_internals/nonproj.pyx":129 + * + * + * def count_decorated_labels(gold_data): # <<<<<<<<<<<<<< + * freqs = {} + * for example in gold_data: +*/ + +/* Python wrapper */ +static PyObject *__pyx_pw_5spacy_8pipeline_17_parser_internals_7nonproj_14count_decorated_labels(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_5spacy_8pipeline_17_parser_internals_7nonproj_13count_decorated_labels, "count_decorated_labels(gold_data)"); +static PyMethodDef __pyx_mdef_5spacy_8pipeline_17_parser_internals_7nonproj_14count_decorated_labels = {"count_decorated_labels", (PyCFunction)(void(*)(void))(__Pyx_PyCFunction_FastCallWithKeywords)__pyx_pw_5spacy_8pipeline_17_parser_internals_7nonproj_14count_decorated_labels, __Pyx_METH_FASTCALL|METH_KEYWORDS, __pyx_doc_5spacy_8pipeline_17_parser_internals_7nonproj_13count_decorated_labels}; +static PyObject *__pyx_pw_5spacy_8pipeline_17_parser_internals_7nonproj_14count_decorated_labels(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 +) { + PyObject *__pyx_v_gold_data = 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("count_decorated_labels (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_gold_data,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, 129, __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, 129, __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, "count_decorated_labels", 0) < (0)) __PYX_ERR(0, 129, __pyx_L3_error) + for (Py_ssize_t i = __pyx_nargs; i < 1; i++) { + if (unlikely(!values[i])) { __Pyx_RaiseArgtupleInvalid("count_decorated_labels", 1, 1, 1, i); __PYX_ERR(0, 129, __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, 129, __pyx_L3_error) + } + __pyx_v_gold_data = values[0]; + } + goto __pyx_L6_skip; + __pyx_L5_argtuple_error:; + __Pyx_RaiseArgtupleInvalid("count_decorated_labels", 1, 1, 1, __pyx_nargs); __PYX_ERR(0, 129, __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("spacy.pipeline._parser_internals.nonproj.count_decorated_labels", __pyx_clineno, __pyx_lineno, __pyx_filename); + __Pyx_RefNannyFinishContext(); + return NULL; + __pyx_L4_argument_unpacking_done:; + __pyx_r = __pyx_pf_5spacy_8pipeline_17_parser_internals_7nonproj_13count_decorated_labels(__pyx_self, __pyx_v_gold_data); + + /* 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_5spacy_8pipeline_17_parser_internals_7nonproj_13count_decorated_labels(CYTHON_UNUSED PyObject *__pyx_self, PyObject *__pyx_v_gold_data) { + PyObject *__pyx_v_freqs = NULL; + PyObject *__pyx_v_example = NULL; + PyObject *__pyx_v_proj_heads = NULL; + PyObject *__pyx_v_deco_deps = NULL; + PyObject *__pyx_v_label = NULL; + PyObject *__pyx_v_i = NULL; + PyObject *__pyx_v_head = NULL; + PyObject *__pyx_r = NULL; + __Pyx_RefNannyDeclarations + PyObject *__pyx_t_1 = NULL; + Py_ssize_t __pyx_t_2; + PyObject *(*__pyx_t_3)(PyObject *); + PyObject *__pyx_t_4 = NULL; + PyObject *__pyx_t_5 = NULL; + PyObject *__pyx_t_6 = NULL; + PyObject *__pyx_t_7 = NULL; + PyObject *__pyx_t_8 = NULL; + size_t __pyx_t_9; + PyObject *__pyx_t_10 = NULL; + PyObject *(*__pyx_t_11)(PyObject *); + Py_ssize_t __pyx_t_12; + PyObject *(*__pyx_t_13)(PyObject *); + int __pyx_t_14; + int __pyx_lineno = 0; + const char *__pyx_filename = NULL; + int __pyx_clineno = 0; + __Pyx_RefNannySetupContext("count_decorated_labels", 0); + + /* "spacy/pipeline/_parser_internals/nonproj.pyx":130 + * + * def count_decorated_labels(gold_data): + * freqs = {} # <<<<<<<<<<<<<< + * for example in gold_data: + * proj_heads, deco_deps = projectivize(example.get_aligned("HEAD"), +*/ + __pyx_t_1 = __Pyx_PyDict_NewPresized(0); if (unlikely(!__pyx_t_1)) __PYX_ERR(0, 130, __pyx_L1_error) + __Pyx_GOTREF(__pyx_t_1); + __pyx_v_freqs = ((PyObject*)__pyx_t_1); + __pyx_t_1 = 0; + + /* "spacy/pipeline/_parser_internals/nonproj.pyx":131 + * def count_decorated_labels(gold_data): + * freqs = {} + * for example in gold_data: # <<<<<<<<<<<<<< + * proj_heads, deco_deps = projectivize(example.get_aligned("HEAD"), + * example.get_aligned("DEP")) +*/ + if (likely(PyList_CheckExact(__pyx_v_gold_data)) || PyTuple_CheckExact(__pyx_v_gold_data)) { + __pyx_t_1 = __pyx_v_gold_data; __Pyx_INCREF(__pyx_t_1); + __pyx_t_2 = 0; + __pyx_t_3 = NULL; + } else { + __pyx_t_2 = -1; __pyx_t_1 = PyObject_GetIter(__pyx_v_gold_data); if (unlikely(!__pyx_t_1)) __PYX_ERR(0, 131, __pyx_L1_error) + __Pyx_GOTREF(__pyx_t_1); + __pyx_t_3 = (CYTHON_COMPILING_IN_LIMITED_API) ? PyIter_Next : __Pyx_PyObject_GetIterNextFunc(__pyx_t_1); if (unlikely(!__pyx_t_3)) __PYX_ERR(0, 131, __pyx_L1_error) + } + for (;;) { + if (likely(!__pyx_t_3)) { + if (likely(PyList_CheckExact(__pyx_t_1))) { + { + Py_ssize_t __pyx_temp = __Pyx_PyList_GET_SIZE(__pyx_t_1); + #if !CYTHON_ASSUME_SAFE_SIZE + if (unlikely((__pyx_temp < 0))) __PYX_ERR(0, 131, __pyx_L1_error) + #endif + if (__pyx_t_2 >= __pyx_temp) break; + } + __pyx_t_4 = __Pyx_PyList_GetItemRefFast(__pyx_t_1, __pyx_t_2, __Pyx_ReferenceSharing_OwnStrongReference); + ++__pyx_t_2; + } else { + { + Py_ssize_t __pyx_temp = __Pyx_PyTuple_GET_SIZE(__pyx_t_1); + #if !CYTHON_ASSUME_SAFE_SIZE + if (unlikely((__pyx_temp < 0))) __PYX_ERR(0, 131, __pyx_L1_error) + #endif + if (__pyx_t_2 >= __pyx_temp) break; + } + #if CYTHON_ASSUME_SAFE_MACROS && !CYTHON_AVOID_BORROWED_REFS + __pyx_t_4 = __Pyx_NewRef(PyTuple_GET_ITEM(__pyx_t_1, __pyx_t_2)); + #else + __pyx_t_4 = __Pyx_PySequence_ITEM(__pyx_t_1, __pyx_t_2); + #endif + ++__pyx_t_2; + } + if (unlikely(!__pyx_t_4)) __PYX_ERR(0, 131, __pyx_L1_error) + } else { + __pyx_t_4 = __pyx_t_3(__pyx_t_1); + if (unlikely(!__pyx_t_4)) { + PyObject* exc_type = PyErr_Occurred(); + if (exc_type) { + if (unlikely(!__Pyx_PyErr_GivenExceptionMatches(exc_type, PyExc_StopIteration))) __PYX_ERR(0, 131, __pyx_L1_error) + PyErr_Clear(); + } + break; + } + } + __Pyx_GOTREF(__pyx_t_4); + __Pyx_XDECREF_SET(__pyx_v_example, __pyx_t_4); + __pyx_t_4 = 0; + + /* "spacy/pipeline/_parser_internals/nonproj.pyx":132 + * freqs = {} + * for example in gold_data: + * proj_heads, deco_deps = projectivize(example.get_aligned("HEAD"), # <<<<<<<<<<<<<< + * example.get_aligned("DEP")) + * # set the label to ROOT for each root dependent +*/ + __pyx_t_5 = NULL; + __Pyx_GetModuleGlobalName(__pyx_t_6, __pyx_mstate_global->__pyx_n_u_projectivize); if (unlikely(!__pyx_t_6)) __PYX_ERR(0, 132, __pyx_L1_error) + __Pyx_GOTREF(__pyx_t_6); + __pyx_t_8 = __pyx_v_example; + __Pyx_INCREF(__pyx_t_8); + __pyx_t_9 = 0; + { + PyObject *__pyx_callargs[2] = {__pyx_t_8, __pyx_mstate_global->__pyx_n_u_HEAD}; + __pyx_t_7 = __Pyx_PyObject_FastCallMethod((PyObject*)__pyx_mstate_global->__pyx_n_u_get_aligned, __pyx_callargs+__pyx_t_9, (2-__pyx_t_9) | (1*__Pyx_PY_VECTORCALL_ARGUMENTS_OFFSET)); + __Pyx_XDECREF(__pyx_t_8); __pyx_t_8 = 0; + if (unlikely(!__pyx_t_7)) __PYX_ERR(0, 132, __pyx_L1_error) + __Pyx_GOTREF(__pyx_t_7); + } + + /* "spacy/pipeline/_parser_internals/nonproj.pyx":133 + * for example in gold_data: + * proj_heads, deco_deps = projectivize(example.get_aligned("HEAD"), + * example.get_aligned("DEP")) # <<<<<<<<<<<<<< + * # set the label to ROOT for each root dependent + * deco_deps = [ +*/ + __pyx_t_10 = __pyx_v_example; + __Pyx_INCREF(__pyx_t_10); + __pyx_t_9 = 0; + { + PyObject *__pyx_callargs[2] = {__pyx_t_10, __pyx_mstate_global->__pyx_n_u_DEP}; + __pyx_t_8 = __Pyx_PyObject_FastCallMethod((PyObject*)__pyx_mstate_global->__pyx_n_u_get_aligned, __pyx_callargs+__pyx_t_9, (2-__pyx_t_9) | (1*__Pyx_PY_VECTORCALL_ARGUMENTS_OFFSET)); + __Pyx_XDECREF(__pyx_t_10); __pyx_t_10 = 0; + if (unlikely(!__pyx_t_8)) __PYX_ERR(0, 133, __pyx_L1_error) + __Pyx_GOTREF(__pyx_t_8); + } + __pyx_t_9 = 1; + #if CYTHON_UNPACK_METHODS + if (unlikely(PyMethod_Check(__pyx_t_6))) { + __pyx_t_5 = PyMethod_GET_SELF(__pyx_t_6); + assert(__pyx_t_5); + PyObject* __pyx__function = PyMethod_GET_FUNCTION(__pyx_t_6); + __Pyx_INCREF(__pyx_t_5); + __Pyx_INCREF(__pyx__function); + __Pyx_DECREF_SET(__pyx_t_6, __pyx__function); + __pyx_t_9 = 0; + } + #endif + { + PyObject *__pyx_callargs[3] = {__pyx_t_5, __pyx_t_7, __pyx_t_8}; + __pyx_t_4 = __Pyx_PyObject_FastCall((PyObject*)__pyx_t_6, __pyx_callargs+__pyx_t_9, (3-__pyx_t_9) | (__pyx_t_9*__Pyx_PY_VECTORCALL_ARGUMENTS_OFFSET)); + __Pyx_XDECREF(__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_6); __pyx_t_6 = 0; + if (unlikely(!__pyx_t_4)) __PYX_ERR(0, 132, __pyx_L1_error) + __Pyx_GOTREF(__pyx_t_4); + } + if ((likely(PyTuple_CheckExact(__pyx_t_4))) || (PyList_CheckExact(__pyx_t_4))) { + PyObject* sequence = __pyx_t_4; + 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, 132, __pyx_L1_error) + } + #if CYTHON_ASSUME_SAFE_MACROS && !CYTHON_AVOID_BORROWED_REFS + if (likely(PyTuple_CheckExact(sequence))) { + __pyx_t_6 = PyTuple_GET_ITEM(sequence, 0); + __Pyx_INCREF(__pyx_t_6); + __pyx_t_8 = PyTuple_GET_ITEM(sequence, 1); + __Pyx_INCREF(__pyx_t_8); + } else { + __pyx_t_6 = __Pyx_PyList_GetItemRefFast(sequence, 0, __Pyx_ReferenceSharing_SharedReference); + if (unlikely(!__pyx_t_6)) __PYX_ERR(0, 132, __pyx_L1_error) + __Pyx_XGOTREF(__pyx_t_6); + __pyx_t_8 = __Pyx_PyList_GetItemRefFast(sequence, 1, __Pyx_ReferenceSharing_SharedReference); + if (unlikely(!__pyx_t_8)) __PYX_ERR(0, 132, __pyx_L1_error) + __Pyx_XGOTREF(__pyx_t_8); + } + #else + __pyx_t_6 = __Pyx_PySequence_ITEM(sequence, 0); if (unlikely(!__pyx_t_6)) __PYX_ERR(0, 132, __pyx_L1_error) + __Pyx_GOTREF(__pyx_t_6); + __pyx_t_8 = __Pyx_PySequence_ITEM(sequence, 1); if (unlikely(!__pyx_t_8)) __PYX_ERR(0, 132, __pyx_L1_error) + __Pyx_GOTREF(__pyx_t_8); + #endif + __Pyx_DECREF(__pyx_t_4); __pyx_t_4 = 0; + } else { + Py_ssize_t index = -1; + __pyx_t_7 = PyObject_GetIter(__pyx_t_4); if (unlikely(!__pyx_t_7)) __PYX_ERR(0, 132, __pyx_L1_error) + __Pyx_GOTREF(__pyx_t_7); + __Pyx_DECREF(__pyx_t_4); __pyx_t_4 = 0; + __pyx_t_11 = (CYTHON_COMPILING_IN_LIMITED_API) ? PyIter_Next : __Pyx_PyObject_GetIterNextFunc(__pyx_t_7); + index = 0; __pyx_t_6 = __pyx_t_11(__pyx_t_7); if (unlikely(!__pyx_t_6)) goto __pyx_L5_unpacking_failed; + __Pyx_GOTREF(__pyx_t_6); + index = 1; __pyx_t_8 = __pyx_t_11(__pyx_t_7); if (unlikely(!__pyx_t_8)) goto __pyx_L5_unpacking_failed; + __Pyx_GOTREF(__pyx_t_8); + if (__Pyx_IternextUnpackEndCheck(__pyx_t_11(__pyx_t_7), 2) < (0)) __PYX_ERR(0, 132, __pyx_L1_error) + __pyx_t_11 = NULL; + __Pyx_DECREF(__pyx_t_7); __pyx_t_7 = 0; + goto __pyx_L6_unpacking_done; + __pyx_L5_unpacking_failed:; + __Pyx_DECREF(__pyx_t_7); __pyx_t_7 = 0; + __pyx_t_11 = NULL; + if (__Pyx_IterFinish() == 0) __Pyx_RaiseNeedMoreValuesError(index); + __PYX_ERR(0, 132, __pyx_L1_error) + __pyx_L6_unpacking_done:; + } + + /* "spacy/pipeline/_parser_internals/nonproj.pyx":132 + * freqs = {} + * for example in gold_data: + * proj_heads, deco_deps = projectivize(example.get_aligned("HEAD"), # <<<<<<<<<<<<<< + * example.get_aligned("DEP")) + * # set the label to ROOT for each root dependent +*/ + __Pyx_XDECREF_SET(__pyx_v_proj_heads, __pyx_t_6); + __pyx_t_6 = 0; + __Pyx_XDECREF_SET(__pyx_v_deco_deps, __pyx_t_8); + __pyx_t_8 = 0; + + /* "spacy/pipeline/_parser_internals/nonproj.pyx":135 + * example.get_aligned("DEP")) + * # set the label to ROOT for each root dependent + * deco_deps = [ # <<<<<<<<<<<<<< + * 'ROOT' if head == i else deco_deps[i] + * for i, head in enumerate(proj_heads) +*/ + __pyx_t_4 = PyList_New(0); if (unlikely(!__pyx_t_4)) __PYX_ERR(0, 135, __pyx_L1_error) + __Pyx_GOTREF(__pyx_t_4); + __Pyx_INCREF(__pyx_mstate_global->__pyx_int_0); + __pyx_t_8 = __pyx_mstate_global->__pyx_int_0; + + /* "spacy/pipeline/_parser_internals/nonproj.pyx":137 + * deco_deps = [ + * 'ROOT' if head == i else deco_deps[i] + * for i, head in enumerate(proj_heads) # <<<<<<<<<<<<<< + * ] + * # count label frequencies +*/ + if (likely(PyList_CheckExact(__pyx_v_proj_heads)) || PyTuple_CheckExact(__pyx_v_proj_heads)) { + __pyx_t_6 = __pyx_v_proj_heads; __Pyx_INCREF(__pyx_t_6); + __pyx_t_12 = 0; + __pyx_t_13 = NULL; + } else { + __pyx_t_12 = -1; __pyx_t_6 = PyObject_GetIter(__pyx_v_proj_heads); if (unlikely(!__pyx_t_6)) __PYX_ERR(0, 137, __pyx_L1_error) + __Pyx_GOTREF(__pyx_t_6); + __pyx_t_13 = (CYTHON_COMPILING_IN_LIMITED_API) ? PyIter_Next : __Pyx_PyObject_GetIterNextFunc(__pyx_t_6); if (unlikely(!__pyx_t_13)) __PYX_ERR(0, 137, __pyx_L1_error) + } + for (;;) { + if (likely(!__pyx_t_13)) { + if (likely(PyList_CheckExact(__pyx_t_6))) { + { + Py_ssize_t __pyx_temp = __Pyx_PyList_GET_SIZE(__pyx_t_6); + #if !CYTHON_ASSUME_SAFE_SIZE + if (unlikely((__pyx_temp < 0))) __PYX_ERR(0, 137, __pyx_L1_error) + #endif + if (__pyx_t_12 >= __pyx_temp) break; + } + __pyx_t_7 = __Pyx_PyList_GetItemRefFast(__pyx_t_6, __pyx_t_12, __Pyx_ReferenceSharing_OwnStrongReference); + ++__pyx_t_12; + } else { + { + Py_ssize_t __pyx_temp = __Pyx_PyTuple_GET_SIZE(__pyx_t_6); + #if !CYTHON_ASSUME_SAFE_SIZE + if (unlikely((__pyx_temp < 0))) __PYX_ERR(0, 137, __pyx_L1_error) + #endif + if (__pyx_t_12 >= __pyx_temp) break; + } + #if CYTHON_ASSUME_SAFE_MACROS && !CYTHON_AVOID_BORROWED_REFS + __pyx_t_7 = __Pyx_NewRef(PyTuple_GET_ITEM(__pyx_t_6, __pyx_t_12)); + #else + __pyx_t_7 = __Pyx_PySequence_ITEM(__pyx_t_6, __pyx_t_12); + #endif + ++__pyx_t_12; + } + if (unlikely(!__pyx_t_7)) __PYX_ERR(0, 137, __pyx_L1_error) + } else { + __pyx_t_7 = __pyx_t_13(__pyx_t_6); + if (unlikely(!__pyx_t_7)) { + PyObject* exc_type = PyErr_Occurred(); + if (exc_type) { + if (unlikely(!__Pyx_PyErr_GivenExceptionMatches(exc_type, PyExc_StopIteration))) __PYX_ERR(0, 137, __pyx_L1_error) + PyErr_Clear(); + } + break; + } + } + __Pyx_GOTREF(__pyx_t_7); + __Pyx_XDECREF_SET(__pyx_v_head, __pyx_t_7); + __pyx_t_7 = 0; + __Pyx_INCREF(__pyx_t_8); + __Pyx_XDECREF_SET(__pyx_v_i, __pyx_t_8); + __pyx_t_7 = __Pyx_PyLong_AddObjC(__pyx_t_8, __pyx_mstate_global->__pyx_int_1, 1, 0, 0); if (unlikely(!__pyx_t_7)) __PYX_ERR(0, 137, __pyx_L1_error) + __Pyx_GOTREF(__pyx_t_7); + __Pyx_DECREF(__pyx_t_8); + __pyx_t_8 = __pyx_t_7; + __pyx_t_7 = 0; + + /* "spacy/pipeline/_parser_internals/nonproj.pyx":136 + * # set the label to ROOT for each root dependent + * deco_deps = [ + * 'ROOT' if head == i else deco_deps[i] # <<<<<<<<<<<<<< + * for i, head in enumerate(proj_heads) + * ] +*/ + __pyx_t_5 = PyObject_RichCompare(__pyx_v_head, __pyx_v_i, Py_EQ); __Pyx_XGOTREF(__pyx_t_5); if (unlikely(!__pyx_t_5)) __PYX_ERR(0, 136, __pyx_L1_error) + __pyx_t_14 = __Pyx_PyObject_IsTrue(__pyx_t_5); if (unlikely((__pyx_t_14 < 0))) __PYX_ERR(0, 136, __pyx_L1_error) + __Pyx_DECREF(__pyx_t_5); __pyx_t_5 = 0; + if (__pyx_t_14) { + __Pyx_INCREF(__pyx_mstate_global->__pyx_n_u_ROOT); + __pyx_t_7 = __pyx_mstate_global->__pyx_n_u_ROOT; + } else { + __pyx_t_5 = __Pyx_PyObject_GetItem(__pyx_v_deco_deps, __pyx_v_i); if (unlikely(!__pyx_t_5)) __PYX_ERR(0, 136, __pyx_L1_error) + __Pyx_GOTREF(__pyx_t_5); + __pyx_t_7 = __pyx_t_5; + __pyx_t_5 = 0; + } + if (unlikely(__Pyx_ListComp_Append(__pyx_t_4, (PyObject*)__pyx_t_7))) __PYX_ERR(0, 135, __pyx_L1_error) + __Pyx_DECREF(__pyx_t_7); __pyx_t_7 = 0; + + /* "spacy/pipeline/_parser_internals/nonproj.pyx":137 + * deco_deps = [ + * 'ROOT' if head == i else deco_deps[i] + * for i, head in enumerate(proj_heads) # <<<<<<<<<<<<<< + * ] + * # count label frequencies +*/ + } + __Pyx_DECREF(__pyx_t_6); __pyx_t_6 = 0; + __Pyx_DECREF(__pyx_t_8); __pyx_t_8 = 0; + __Pyx_DECREF_SET(__pyx_v_deco_deps, __pyx_t_4); + __pyx_t_4 = 0; + + /* "spacy/pipeline/_parser_internals/nonproj.pyx":140 + * ] + * # count label frequencies + * for label in deco_deps: # <<<<<<<<<<<<<< + * if is_decorated(label): + * freqs[label] = freqs.get(label, 0) + 1 +*/ + __pyx_t_4 = __pyx_v_deco_deps; __Pyx_INCREF(__pyx_t_4); + __pyx_t_12 = 0; + for (;;) { + { + Py_ssize_t __pyx_temp = __Pyx_PyList_GET_SIZE(__pyx_t_4); + #if !CYTHON_ASSUME_SAFE_SIZE + if (unlikely((__pyx_temp < 0))) __PYX_ERR(0, 140, __pyx_L1_error) + #endif + if (__pyx_t_12 >= __pyx_temp) break; + } + __pyx_t_8 = __Pyx_PyList_GetItemRefFast(__pyx_t_4, __pyx_t_12, __Pyx_ReferenceSharing_OwnStrongReference); + ++__pyx_t_12; + if (unlikely(!__pyx_t_8)) __PYX_ERR(0, 140, __pyx_L1_error) + __Pyx_GOTREF(__pyx_t_8); + __Pyx_XDECREF_SET(__pyx_v_label, __pyx_t_8); + __pyx_t_8 = 0; + + /* "spacy/pipeline/_parser_internals/nonproj.pyx":141 + * # count label frequencies + * for label in deco_deps: + * if is_decorated(label): # <<<<<<<<<<<<<< + * freqs[label] = freqs.get(label, 0) + 1 + * return freqs +*/ + __pyx_t_6 = NULL; + __Pyx_GetModuleGlobalName(__pyx_t_7, __pyx_mstate_global->__pyx_n_u_is_decorated); if (unlikely(!__pyx_t_7)) __PYX_ERR(0, 141, __pyx_L1_error) + __Pyx_GOTREF(__pyx_t_7); + __pyx_t_9 = 1; + #if CYTHON_UNPACK_METHODS + if (unlikely(PyMethod_Check(__pyx_t_7))) { + __pyx_t_6 = PyMethod_GET_SELF(__pyx_t_7); + assert(__pyx_t_6); + PyObject* __pyx__function = PyMethod_GET_FUNCTION(__pyx_t_7); + __Pyx_INCREF(__pyx_t_6); + __Pyx_INCREF(__pyx__function); + __Pyx_DECREF_SET(__pyx_t_7, __pyx__function); + __pyx_t_9 = 0; + } + #endif + { + PyObject *__pyx_callargs[2] = {__pyx_t_6, __pyx_v_label}; + __pyx_t_8 = __Pyx_PyObject_FastCall((PyObject*)__pyx_t_7, __pyx_callargs+__pyx_t_9, (2-__pyx_t_9) | (__pyx_t_9*__Pyx_PY_VECTORCALL_ARGUMENTS_OFFSET)); + __Pyx_XDECREF(__pyx_t_6); __pyx_t_6 = 0; + __Pyx_DECREF(__pyx_t_7); __pyx_t_7 = 0; + if (unlikely(!__pyx_t_8)) __PYX_ERR(0, 141, __pyx_L1_error) + __Pyx_GOTREF(__pyx_t_8); + } + __pyx_t_14 = __Pyx_PyObject_IsTrue(__pyx_t_8); if (unlikely((__pyx_t_14 < 0))) __PYX_ERR(0, 141, __pyx_L1_error) + __Pyx_DECREF(__pyx_t_8); __pyx_t_8 = 0; + if (__pyx_t_14) { + + /* "spacy/pipeline/_parser_internals/nonproj.pyx":142 + * for label in deco_deps: + * if is_decorated(label): + * freqs[label] = freqs.get(label, 0) + 1 # <<<<<<<<<<<<<< + * return freqs + * +*/ + __pyx_t_8 = __Pyx_PyDict_GetItemDefault(__pyx_v_freqs, __pyx_v_label, __pyx_mstate_global->__pyx_int_0); if (unlikely(!__pyx_t_8)) __PYX_ERR(0, 142, __pyx_L1_error) + __Pyx_GOTREF(__pyx_t_8); + __pyx_t_7 = __Pyx_PyLong_AddObjC(__pyx_t_8, __pyx_mstate_global->__pyx_int_1, 1, 0, 0); if (unlikely(!__pyx_t_7)) __PYX_ERR(0, 142, __pyx_L1_error) + __Pyx_GOTREF(__pyx_t_7); + __Pyx_DECREF(__pyx_t_8); __pyx_t_8 = 0; + if (unlikely((PyDict_SetItem(__pyx_v_freqs, __pyx_v_label, __pyx_t_7) < 0))) __PYX_ERR(0, 142, __pyx_L1_error) + __Pyx_DECREF(__pyx_t_7); __pyx_t_7 = 0; + + /* "spacy/pipeline/_parser_internals/nonproj.pyx":141 + * # count label frequencies + * for label in deco_deps: + * if is_decorated(label): # <<<<<<<<<<<<<< + * freqs[label] = freqs.get(label, 0) + 1 + * return freqs +*/ + } + + /* "spacy/pipeline/_parser_internals/nonproj.pyx":140 + * ] + * # count label frequencies + * for label in deco_deps: # <<<<<<<<<<<<<< + * if is_decorated(label): + * freqs[label] = freqs.get(label, 0) + 1 +*/ + } + __Pyx_DECREF(__pyx_t_4); __pyx_t_4 = 0; + + /* "spacy/pipeline/_parser_internals/nonproj.pyx":131 + * def count_decorated_labels(gold_data): + * freqs = {} + * for example in gold_data: # <<<<<<<<<<<<<< + * proj_heads, deco_deps = projectivize(example.get_aligned("HEAD"), + * example.get_aligned("DEP")) +*/ + } + __Pyx_DECREF(__pyx_t_1); __pyx_t_1 = 0; + + /* "spacy/pipeline/_parser_internals/nonproj.pyx":143 + * if is_decorated(label): + * freqs[label] = freqs.get(label, 0) + 1 + * return freqs # <<<<<<<<<<<<<< + * + * +*/ + __Pyx_XDECREF(__pyx_r); + __Pyx_INCREF(__pyx_v_freqs); + __pyx_r = __pyx_v_freqs; + goto __pyx_L0; + + /* "spacy/pipeline/_parser_internals/nonproj.pyx":129 + * + * + * def count_decorated_labels(gold_data): # <<<<<<<<<<<<<< + * freqs = {} + * for example in gold_data: +*/ + + /* function exit code */ + __pyx_L1_error:; + __Pyx_XDECREF(__pyx_t_1); + __Pyx_XDECREF(__pyx_t_4); + __Pyx_XDECREF(__pyx_t_5); + __Pyx_XDECREF(__pyx_t_6); + __Pyx_XDECREF(__pyx_t_7); + __Pyx_XDECREF(__pyx_t_8); + __Pyx_XDECREF(__pyx_t_10); + __Pyx_AddTraceback("spacy.pipeline._parser_internals.nonproj.count_decorated_labels", __pyx_clineno, __pyx_lineno, __pyx_filename); + __pyx_r = NULL; + __pyx_L0:; + __Pyx_XDECREF(__pyx_v_freqs); + __Pyx_XDECREF(__pyx_v_example); + __Pyx_XDECREF(__pyx_v_proj_heads); + __Pyx_XDECREF(__pyx_v_deco_deps); + __Pyx_XDECREF(__pyx_v_label); + __Pyx_XDECREF(__pyx_v_i); + __Pyx_XDECREF(__pyx_v_head); + __Pyx_XGIVEREF(__pyx_r); + __Pyx_RefNannyFinishContext(); + return __pyx_r; +} + +/* "spacy/pipeline/_parser_internals/nonproj.pyx":146 + * + * + * def projectivize(heads, labels): # <<<<<<<<<<<<<< + * # Use the algorithm by Nivre & Nilsson 2005. Assumes heads to be a proper + * # tree, i.e. connected and cycle-free. Returns a new pair (heads, labels) +*/ + +/* Python wrapper */ +static PyObject *__pyx_pw_5spacy_8pipeline_17_parser_internals_7nonproj_16projectivize(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_5spacy_8pipeline_17_parser_internals_7nonproj_15projectivize, "projectivize(heads, labels)"); +static PyMethodDef __pyx_mdef_5spacy_8pipeline_17_parser_internals_7nonproj_16projectivize = {"projectivize", (PyCFunction)(void(*)(void))(__Pyx_PyCFunction_FastCallWithKeywords)__pyx_pw_5spacy_8pipeline_17_parser_internals_7nonproj_16projectivize, __Pyx_METH_FASTCALL|METH_KEYWORDS, __pyx_doc_5spacy_8pipeline_17_parser_internals_7nonproj_15projectivize}; +static PyObject *__pyx_pw_5spacy_8pipeline_17_parser_internals_7nonproj_16projectivize(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 +) { + PyObject *__pyx_v_heads = 0; + PyObject *__pyx_v_labels = 0; + #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("projectivize (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_heads,&__pyx_mstate_global->__pyx_n_u_labels,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, 146, __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, 146, __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, 146, __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, "projectivize", 0) < (0)) __PYX_ERR(0, 146, __pyx_L3_error) + for (Py_ssize_t i = __pyx_nargs; i < 2; i++) { + if (unlikely(!values[i])) { __Pyx_RaiseArgtupleInvalid("projectivize", 1, 2, 2, i); __PYX_ERR(0, 146, __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, 146, __pyx_L3_error) + values[1] = __Pyx_ArgRef_FASTCALL(__pyx_args, 1); + if (!CYTHON_ASSUME_SAFE_MACROS && unlikely(!values[1])) __PYX_ERR(0, 146, __pyx_L3_error) + } + __pyx_v_heads = values[0]; + __pyx_v_labels = values[1]; + } + goto __pyx_L6_skip; + __pyx_L5_argtuple_error:; + __Pyx_RaiseArgtupleInvalid("projectivize", 1, 2, 2, __pyx_nargs); __PYX_ERR(0, 146, __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("spacy.pipeline._parser_internals.nonproj.projectivize", __pyx_clineno, __pyx_lineno, __pyx_filename); + __Pyx_RefNannyFinishContext(); + return NULL; + __pyx_L4_argument_unpacking_done:; + __pyx_r = __pyx_pf_5spacy_8pipeline_17_parser_internals_7nonproj_15projectivize(__pyx_self, __pyx_v_heads, __pyx_v_labels); + + /* 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_5spacy_8pipeline_17_parser_internals_7nonproj_15projectivize(CYTHON_UNUSED PyObject *__pyx_self, PyObject *__pyx_v_heads, PyObject *__pyx_v_labels) { + PyObject *__pyx_v_proj_heads = NULL; + int __pyx_v_new_head; + std::vector __pyx_v_c_proj_heads; + int __pyx_v_smallest_np_arc; + PyObject *__pyx_v_deco_labels = 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; + std::vector __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("projectivize", 0); + + /* "spacy/pipeline/_parser_internals/nonproj.pyx":150 + * # tree, i.e. connected and cycle-free. Returns a new pair (heads, labels) + * # which encode a projective and decorated tree. + * proj_heads = copy(heads) # <<<<<<<<<<<<<< + * + * cdef int new_head +*/ + __pyx_t_2 = NULL; + __Pyx_GetModuleGlobalName(__pyx_t_3, __pyx_mstate_global->__pyx_n_u_copy); if (unlikely(!__pyx_t_3)) __PYX_ERR(0, 150, __pyx_L1_error) + __Pyx_GOTREF(__pyx_t_3); + __pyx_t_4 = 1; + #if CYTHON_UNPACK_METHODS + if (unlikely(PyMethod_Check(__pyx_t_3))) { + __pyx_t_2 = PyMethod_GET_SELF(__pyx_t_3); + assert(__pyx_t_2); + PyObject* __pyx__function = PyMethod_GET_FUNCTION(__pyx_t_3); + __Pyx_INCREF(__pyx_t_2); + __Pyx_INCREF(__pyx__function); + __Pyx_DECREF_SET(__pyx_t_3, __pyx__function); + __pyx_t_4 = 0; + } + #endif + { + PyObject *__pyx_callargs[2] = {__pyx_t_2, __pyx_v_heads}; + __pyx_t_1 = __Pyx_PyObject_FastCall((PyObject*)__pyx_t_3, __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, 150, __pyx_L1_error) + __Pyx_GOTREF(__pyx_t_1); + } + __pyx_v_proj_heads = __pyx_t_1; + __pyx_t_1 = 0; + + /* "spacy/pipeline/_parser_internals/nonproj.pyx":153 + * + * cdef int new_head + * cdef vector[int] c_proj_heads = _heads_to_c(proj_heads) # <<<<<<<<<<<<<< + * cdef int smallest_np_arc = _get_smallest_nonproj_arc(c_proj_heads) + * if smallest_np_arc == -1: # this sentence is already projective +*/ + __pyx_t_5 = __pyx_f_5spacy_8pipeline_17_parser_internals_7nonproj__heads_to_c(__pyx_v_proj_heads); if (unlikely(PyErr_Occurred())) __PYX_ERR(0, 153, __pyx_L1_error) + __pyx_v_c_proj_heads = __PYX_STD_MOVE_IF_SUPPORTED(__pyx_t_5); + + /* "spacy/pipeline/_parser_internals/nonproj.pyx":154 + * cdef int new_head + * cdef vector[int] c_proj_heads = _heads_to_c(proj_heads) + * cdef int smallest_np_arc = _get_smallest_nonproj_arc(c_proj_heads) # <<<<<<<<<<<<<< + * if smallest_np_arc == -1: # this sentence is already projective + * return proj_heads, copy(labels) +*/ + __pyx_t_6 = __pyx_f_5spacy_8pipeline_17_parser_internals_7nonproj__get_smallest_nonproj_arc(__pyx_v_c_proj_heads); if (unlikely(__pyx_t_6 == ((int)-2))) __PYX_ERR(0, 154, __pyx_L1_error) + __pyx_v_smallest_np_arc = __pyx_t_6; + + /* "spacy/pipeline/_parser_internals/nonproj.pyx":155 + * cdef vector[int] c_proj_heads = _heads_to_c(proj_heads) + * cdef int smallest_np_arc = _get_smallest_nonproj_arc(c_proj_heads) + * if smallest_np_arc == -1: # this sentence is already projective # <<<<<<<<<<<<<< + * return proj_heads, copy(labels) + * while smallest_np_arc != -1: +*/ + __pyx_t_7 = (__pyx_v_smallest_np_arc == -1L); + if (__pyx_t_7) { + + /* "spacy/pipeline/_parser_internals/nonproj.pyx":156 + * cdef int smallest_np_arc = _get_smallest_nonproj_arc(c_proj_heads) + * if smallest_np_arc == -1: # this sentence is already projective + * return proj_heads, copy(labels) # <<<<<<<<<<<<<< + * while smallest_np_arc != -1: + * new_head = _lift(smallest_np_arc, proj_heads) +*/ + __Pyx_XDECREF(__pyx_r); + __pyx_t_3 = NULL; + __Pyx_GetModuleGlobalName(__pyx_t_2, __pyx_mstate_global->__pyx_n_u_copy); if (unlikely(!__pyx_t_2)) __PYX_ERR(0, 156, __pyx_L1_error) + __Pyx_GOTREF(__pyx_t_2); + __pyx_t_4 = 1; + #if CYTHON_UNPACK_METHODS + if (unlikely(PyMethod_Check(__pyx_t_2))) { + __pyx_t_3 = PyMethod_GET_SELF(__pyx_t_2); + assert(__pyx_t_3); + PyObject* __pyx__function = PyMethod_GET_FUNCTION(__pyx_t_2); + __Pyx_INCREF(__pyx_t_3); + __Pyx_INCREF(__pyx__function); + __Pyx_DECREF_SET(__pyx_t_2, __pyx__function); + __pyx_t_4 = 0; + } + #endif + { + PyObject *__pyx_callargs[2] = {__pyx_t_3, __pyx_v_labels}; + __pyx_t_1 = __Pyx_PyObject_FastCall((PyObject*)__pyx_t_2, __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_2); __pyx_t_2 = 0; + if (unlikely(!__pyx_t_1)) __PYX_ERR(0, 156, __pyx_L1_error) + __Pyx_GOTREF(__pyx_t_1); + } + __pyx_t_2 = PyTuple_New(2); if (unlikely(!__pyx_t_2)) __PYX_ERR(0, 156, __pyx_L1_error) + __Pyx_GOTREF(__pyx_t_2); + __Pyx_INCREF(__pyx_v_proj_heads); + __Pyx_GIVEREF(__pyx_v_proj_heads); + if (__Pyx_PyTuple_SET_ITEM(__pyx_t_2, 0, __pyx_v_proj_heads) != (0)) __PYX_ERR(0, 156, __pyx_L1_error); + __Pyx_GIVEREF(__pyx_t_1); + if (__Pyx_PyTuple_SET_ITEM(__pyx_t_2, 1, __pyx_t_1) != (0)) __PYX_ERR(0, 156, __pyx_L1_error); + __pyx_t_1 = 0; + __pyx_r = __pyx_t_2; + __pyx_t_2 = 0; + goto __pyx_L0; + + /* "spacy/pipeline/_parser_internals/nonproj.pyx":155 + * cdef vector[int] c_proj_heads = _heads_to_c(proj_heads) + * cdef int smallest_np_arc = _get_smallest_nonproj_arc(c_proj_heads) + * if smallest_np_arc == -1: # this sentence is already projective # <<<<<<<<<<<<<< + * return proj_heads, copy(labels) + * while smallest_np_arc != -1: +*/ + } + + /* "spacy/pipeline/_parser_internals/nonproj.pyx":157 + * if smallest_np_arc == -1: # this sentence is already projective + * return proj_heads, copy(labels) + * while smallest_np_arc != -1: # <<<<<<<<<<<<<< + * new_head = _lift(smallest_np_arc, proj_heads) + * c_proj_heads[smallest_np_arc] = new_head +*/ + while (1) { + __pyx_t_7 = (__pyx_v_smallest_np_arc != -1L); + if (!__pyx_t_7) break; + + /* "spacy/pipeline/_parser_internals/nonproj.pyx":158 + * return proj_heads, copy(labels) + * while smallest_np_arc != -1: + * new_head = _lift(smallest_np_arc, proj_heads) # <<<<<<<<<<<<<< + * c_proj_heads[smallest_np_arc] = new_head + * smallest_np_arc = _get_smallest_nonproj_arc(c_proj_heads) +*/ + __pyx_t_2 = __Pyx_PyLong_From_int(__pyx_v_smallest_np_arc); if (unlikely(!__pyx_t_2)) __PYX_ERR(0, 158, __pyx_L1_error) + __Pyx_GOTREF(__pyx_t_2); + __pyx_t_6 = __pyx_f_5spacy_8pipeline_17_parser_internals_7nonproj__lift(__pyx_t_2, __pyx_v_proj_heads, 0); if (unlikely(__pyx_t_6 == ((int)-1) && PyErr_Occurred())) __PYX_ERR(0, 158, __pyx_L1_error) + __Pyx_DECREF(__pyx_t_2); __pyx_t_2 = 0; + __pyx_v_new_head = __pyx_t_6; + + /* "spacy/pipeline/_parser_internals/nonproj.pyx":159 + * while smallest_np_arc != -1: + * new_head = _lift(smallest_np_arc, proj_heads) + * c_proj_heads[smallest_np_arc] = new_head # <<<<<<<<<<<<<< + * smallest_np_arc = _get_smallest_nonproj_arc(c_proj_heads) + * deco_labels = _decorate(heads, proj_heads, labels) +*/ + (__pyx_v_c_proj_heads[__pyx_v_smallest_np_arc]) = __pyx_v_new_head; + + /* "spacy/pipeline/_parser_internals/nonproj.pyx":160 + * new_head = _lift(smallest_np_arc, proj_heads) + * c_proj_heads[smallest_np_arc] = new_head + * smallest_np_arc = _get_smallest_nonproj_arc(c_proj_heads) # <<<<<<<<<<<<<< + * deco_labels = _decorate(heads, proj_heads, labels) + * return proj_heads, deco_labels +*/ + __pyx_t_6 = __pyx_f_5spacy_8pipeline_17_parser_internals_7nonproj__get_smallest_nonproj_arc(__pyx_v_c_proj_heads); if (unlikely(__pyx_t_6 == ((int)-2))) __PYX_ERR(0, 160, __pyx_L1_error) + __pyx_v_smallest_np_arc = __pyx_t_6; + } + + /* "spacy/pipeline/_parser_internals/nonproj.pyx":161 + * c_proj_heads[smallest_np_arc] = new_head + * smallest_np_arc = _get_smallest_nonproj_arc(c_proj_heads) + * deco_labels = _decorate(heads, proj_heads, labels) # <<<<<<<<<<<<<< + * return proj_heads, deco_labels + * +*/ + __pyx_t_1 = NULL; + __Pyx_GetModuleGlobalName(__pyx_t_3, __pyx_mstate_global->__pyx_n_u_decorate); if (unlikely(!__pyx_t_3)) __PYX_ERR(0, 161, __pyx_L1_error) + __Pyx_GOTREF(__pyx_t_3); + __pyx_t_4 = 1; + #if CYTHON_UNPACK_METHODS + if (unlikely(PyMethod_Check(__pyx_t_3))) { + __pyx_t_1 = PyMethod_GET_SELF(__pyx_t_3); + assert(__pyx_t_1); + PyObject* __pyx__function = PyMethod_GET_FUNCTION(__pyx_t_3); + __Pyx_INCREF(__pyx_t_1); + __Pyx_INCREF(__pyx__function); + __Pyx_DECREF_SET(__pyx_t_3, __pyx__function); + __pyx_t_4 = 0; + } + #endif + { + PyObject *__pyx_callargs[4] = {__pyx_t_1, __pyx_v_heads, __pyx_v_proj_heads, __pyx_v_labels}; + __pyx_t_2 = __Pyx_PyObject_FastCall((PyObject*)__pyx_t_3, __pyx_callargs+__pyx_t_4, (4-__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_2)) __PYX_ERR(0, 161, __pyx_L1_error) + __Pyx_GOTREF(__pyx_t_2); + } + __pyx_v_deco_labels = __pyx_t_2; + __pyx_t_2 = 0; + + /* "spacy/pipeline/_parser_internals/nonproj.pyx":162 + * smallest_np_arc = _get_smallest_nonproj_arc(c_proj_heads) + * deco_labels = _decorate(heads, proj_heads, labels) + * return proj_heads, deco_labels # <<<<<<<<<<<<<< + * + * +*/ + __Pyx_XDECREF(__pyx_r); + __pyx_t_2 = PyTuple_New(2); if (unlikely(!__pyx_t_2)) __PYX_ERR(0, 162, __pyx_L1_error) + __Pyx_GOTREF(__pyx_t_2); + __Pyx_INCREF(__pyx_v_proj_heads); + __Pyx_GIVEREF(__pyx_v_proj_heads); + if (__Pyx_PyTuple_SET_ITEM(__pyx_t_2, 0, __pyx_v_proj_heads) != (0)) __PYX_ERR(0, 162, __pyx_L1_error); + __Pyx_INCREF(__pyx_v_deco_labels); + __Pyx_GIVEREF(__pyx_v_deco_labels); + if (__Pyx_PyTuple_SET_ITEM(__pyx_t_2, 1, __pyx_v_deco_labels) != (0)) __PYX_ERR(0, 162, __pyx_L1_error); + __pyx_r = __pyx_t_2; + __pyx_t_2 = 0; + goto __pyx_L0; + + /* "spacy/pipeline/_parser_internals/nonproj.pyx":146 + * + * + * def projectivize(heads, labels): # <<<<<<<<<<<<<< + * # Use the algorithm by Nivre & Nilsson 2005. Assumes heads to be a proper + * # tree, i.e. connected and cycle-free. Returns a new pair (heads, labels) +*/ + + /* function exit code */ + __pyx_L1_error:; + __Pyx_XDECREF(__pyx_t_1); + __Pyx_XDECREF(__pyx_t_2); + __Pyx_XDECREF(__pyx_t_3); + __Pyx_AddTraceback("spacy.pipeline._parser_internals.nonproj.projectivize", __pyx_clineno, __pyx_lineno, __pyx_filename); + __pyx_r = NULL; + __pyx_L0:; + __Pyx_XDECREF(__pyx_v_proj_heads); + __Pyx_XDECREF(__pyx_v_deco_labels); + __Pyx_XGIVEREF(__pyx_r); + __Pyx_RefNannyFinishContext(); + return __pyx_r; +} + +/* "spacy/pipeline/_parser_internals/nonproj.pyx":165 + * + * + * cdef vector[int] _heads_to_c(heads): # <<<<<<<<<<<<<< + * cdef vector[int] c_heads + * for head in heads: +*/ + +static std::vector __pyx_f_5spacy_8pipeline_17_parser_internals_7nonproj__heads_to_c(PyObject *__pyx_v_heads) { + std::vector __pyx_v_c_heads; + PyObject *__pyx_v_head = NULL; + std::vector __pyx_r; + __Pyx_RefNannyDeclarations + PyObject *__pyx_t_1 = NULL; + Py_ssize_t __pyx_t_2; + PyObject *(*__pyx_t_3)(PyObject *); + PyObject *__pyx_t_4 = NULL; + int __pyx_t_5; + Py_ssize_t __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("_heads_to_c", 0); + + /* "spacy/pipeline/_parser_internals/nonproj.pyx":167 + * cdef vector[int] _heads_to_c(heads): + * cdef vector[int] c_heads + * for head in heads: # <<<<<<<<<<<<<< + * if head is None: + * c_heads.push_back(-1) +*/ + if (likely(PyList_CheckExact(__pyx_v_heads)) || PyTuple_CheckExact(__pyx_v_heads)) { + __pyx_t_1 = __pyx_v_heads; __Pyx_INCREF(__pyx_t_1); + __pyx_t_2 = 0; + __pyx_t_3 = NULL; + } else { + __pyx_t_2 = -1; __pyx_t_1 = PyObject_GetIter(__pyx_v_heads); if (unlikely(!__pyx_t_1)) __PYX_ERR(0, 167, __pyx_L1_error) + __Pyx_GOTREF(__pyx_t_1); + __pyx_t_3 = (CYTHON_COMPILING_IN_LIMITED_API) ? PyIter_Next : __Pyx_PyObject_GetIterNextFunc(__pyx_t_1); if (unlikely(!__pyx_t_3)) __PYX_ERR(0, 167, __pyx_L1_error) + } + for (;;) { + if (likely(!__pyx_t_3)) { + if (likely(PyList_CheckExact(__pyx_t_1))) { + { + Py_ssize_t __pyx_temp = __Pyx_PyList_GET_SIZE(__pyx_t_1); + #if !CYTHON_ASSUME_SAFE_SIZE + if (unlikely((__pyx_temp < 0))) __PYX_ERR(0, 167, __pyx_L1_error) + #endif + if (__pyx_t_2 >= __pyx_temp) break; + } + __pyx_t_4 = __Pyx_PyList_GetItemRefFast(__pyx_t_1, __pyx_t_2, __Pyx_ReferenceSharing_OwnStrongReference); + ++__pyx_t_2; + } else { + { + Py_ssize_t __pyx_temp = __Pyx_PyTuple_GET_SIZE(__pyx_t_1); + #if !CYTHON_ASSUME_SAFE_SIZE + if (unlikely((__pyx_temp < 0))) __PYX_ERR(0, 167, __pyx_L1_error) + #endif + if (__pyx_t_2 >= __pyx_temp) break; + } + #if CYTHON_ASSUME_SAFE_MACROS && !CYTHON_AVOID_BORROWED_REFS + __pyx_t_4 = __Pyx_NewRef(PyTuple_GET_ITEM(__pyx_t_1, __pyx_t_2)); + #else + __pyx_t_4 = __Pyx_PySequence_ITEM(__pyx_t_1, __pyx_t_2); + #endif + ++__pyx_t_2; + } + if (unlikely(!__pyx_t_4)) __PYX_ERR(0, 167, __pyx_L1_error) + } else { + __pyx_t_4 = __pyx_t_3(__pyx_t_1); + if (unlikely(!__pyx_t_4)) { + PyObject* exc_type = PyErr_Occurred(); + if (exc_type) { + if (unlikely(!__Pyx_PyErr_GivenExceptionMatches(exc_type, PyExc_StopIteration))) __PYX_ERR(0, 167, __pyx_L1_error) + PyErr_Clear(); + } + break; + } + } + __Pyx_GOTREF(__pyx_t_4); + __Pyx_XDECREF_SET(__pyx_v_head, __pyx_t_4); + __pyx_t_4 = 0; + + /* "spacy/pipeline/_parser_internals/nonproj.pyx":168 + * cdef vector[int] c_heads + * for head in heads: + * if head is None: # <<<<<<<<<<<<<< + * c_heads.push_back(-1) + * else: +*/ + __pyx_t_5 = (__pyx_v_head == Py_None); + if (__pyx_t_5) { + + /* "spacy/pipeline/_parser_internals/nonproj.pyx":169 + * for head in heads: + * if head is None: + * c_heads.push_back(-1) # <<<<<<<<<<<<<< + * else: + * assert head < len(heads) +*/ + try { + __pyx_v_c_heads.push_back(-1); + } catch(...) { + __Pyx_CppExn2PyErr(); + __PYX_ERR(0, 169, __pyx_L1_error) + } + + /* "spacy/pipeline/_parser_internals/nonproj.pyx":168 + * cdef vector[int] c_heads + * for head in heads: + * if head is None: # <<<<<<<<<<<<<< + * c_heads.push_back(-1) + * else: +*/ + goto __pyx_L5; + } + + /* "spacy/pipeline/_parser_internals/nonproj.pyx":171 + * c_heads.push_back(-1) + * else: + * assert head < len(heads) # <<<<<<<<<<<<<< + * c_heads.push_back(head) + * return c_heads +*/ + /*else*/ { + #ifndef CYTHON_WITHOUT_ASSERTIONS + if (unlikely(__pyx_assertions_enabled())) { + __pyx_t_6 = PyObject_Length(__pyx_v_heads); if (unlikely(__pyx_t_6 == ((Py_ssize_t)-1))) __PYX_ERR(0, 171, __pyx_L1_error) + __pyx_t_4 = PyLong_FromSsize_t(__pyx_t_6); if (unlikely(!__pyx_t_4)) __PYX_ERR(0, 171, __pyx_L1_error) + __Pyx_GOTREF(__pyx_t_4); + __pyx_t_7 = PyObject_RichCompare(__pyx_v_head, __pyx_t_4, Py_LT); __Pyx_XGOTREF(__pyx_t_7); if (unlikely(!__pyx_t_7)) __PYX_ERR(0, 171, __pyx_L1_error) + __Pyx_DECREF(__pyx_t_4); __pyx_t_4 = 0; + __pyx_t_5 = __Pyx_PyObject_IsTrue(__pyx_t_7); if (unlikely((__pyx_t_5 < 0))) __PYX_ERR(0, 171, __pyx_L1_error) + __Pyx_DECREF(__pyx_t_7); __pyx_t_7 = 0; + if (unlikely(!__pyx_t_5)) { + __Pyx_Raise(((PyObject *)(((PyTypeObject*)PyExc_AssertionError))), 0, 0, 0); + __PYX_ERR(0, 171, __pyx_L1_error) + } + } + #else + if ((1)); else __PYX_ERR(0, 171, __pyx_L1_error) + #endif + + /* "spacy/pipeline/_parser_internals/nonproj.pyx":172 + * else: + * assert head < len(heads) + * c_heads.push_back(head) # <<<<<<<<<<<<<< + * return c_heads + * +*/ + __pyx_t_8 = __Pyx_PyLong_As_int(__pyx_v_head); if (unlikely((__pyx_t_8 == (int)-1) && PyErr_Occurred())) __PYX_ERR(0, 172, __pyx_L1_error) + try { + __pyx_v_c_heads.push_back(__pyx_t_8); + } catch(...) { + __Pyx_CppExn2PyErr(); + __PYX_ERR(0, 172, __pyx_L1_error) + } + } + __pyx_L5:; + + /* "spacy/pipeline/_parser_internals/nonproj.pyx":167 + * cdef vector[int] _heads_to_c(heads): + * cdef vector[int] c_heads + * for head in heads: # <<<<<<<<<<<<<< + * if head is None: + * c_heads.push_back(-1) +*/ + } + __Pyx_DECREF(__pyx_t_1); __pyx_t_1 = 0; + + /* "spacy/pipeline/_parser_internals/nonproj.pyx":173 + * assert head < len(heads) + * c_heads.push_back(head) + * return c_heads # <<<<<<<<<<<<<< + * + * +*/ + __pyx_r = __pyx_v_c_heads; + goto __pyx_L0; + + /* "spacy/pipeline/_parser_internals/nonproj.pyx":165 + * + * + * cdef vector[int] _heads_to_c(heads): # <<<<<<<<<<<<<< + * cdef vector[int] c_heads + * for head in heads: +*/ + + /* function exit code */ + __pyx_L1_error:; + __Pyx_XDECREF(__pyx_t_1); + __Pyx_XDECREF(__pyx_t_4); + __Pyx_XDECREF(__pyx_t_7); + __Pyx_AddTraceback("spacy.pipeline._parser_internals.nonproj._heads_to_c", __pyx_clineno, __pyx_lineno, __pyx_filename); + __Pyx_pretend_to_initialize(&__pyx_r); + __pyx_L0:; + __Pyx_XDECREF(__pyx_v_head); + __Pyx_RefNannyFinishContext(); + return __pyx_r; +} + +/* "spacy/pipeline/_parser_internals/nonproj.pyx":176 + * + * + * cpdef deprojectivize(Doc doc): # <<<<<<<<<<<<<< + * # Reattach arcs with decorated labels (following HEAD scheme). For each + * # decorated arc X||Y, search top-down, left-to-right, breadth-first until +*/ + +static PyObject *__pyx_pw_5spacy_8pipeline_17_parser_internals_7nonproj_18deprojectivize(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*/ +static PyObject *__pyx_f_5spacy_8pipeline_17_parser_internals_7nonproj_deprojectivize(struct __pyx_obj_5spacy_6tokens_3doc_Doc *__pyx_v_doc, CYTHON_UNUSED int __pyx_skip_dispatch) { + int __pyx_v_i; + PyObject *__pyx_v_label = NULL; + PyObject *__pyx_v_new_label = NULL; + PyObject *__pyx_v_head_label = NULL; + PyObject *__pyx_v_new_head = NULL; + PyObject *__pyx_r = NULL; + __Pyx_RefNannyDeclarations + int __pyx_t_1; + int __pyx_t_2; + int __pyx_t_3; + PyObject *__pyx_t_4 = NULL; + int __pyx_t_5; + PyObject *__pyx_t_6 = NULL; + PyObject *__pyx_t_7 = NULL; + size_t __pyx_t_8; + PyObject *__pyx_t_9 = NULL; + PyObject *(*__pyx_t_10)(PyObject *); + int __pyx_t_11; + __pyx_t_5spacy_8typedefs_attr_t __pyx_t_12; + int __pyx_lineno = 0; + const char *__pyx_filename = NULL; + int __pyx_clineno = 0; + __Pyx_RefNannySetupContext("deprojectivize", 0); + + /* "spacy/pipeline/_parser_internals/nonproj.pyx":180 + * # decorated arc X||Y, search top-down, left-to-right, breadth-first until + * # hitting a Y then make this the new head. + * for i in range(doc.length): # <<<<<<<<<<<<<< + * label = doc.vocab.strings[doc.c[i].dep] + * if DELIMITER in label: +*/ + __pyx_t_1 = __pyx_v_doc->length; + __pyx_t_2 = __pyx_t_1; + for (__pyx_t_3 = 0; __pyx_t_3 < __pyx_t_2; __pyx_t_3+=1) { + __pyx_v_i = __pyx_t_3; + + /* "spacy/pipeline/_parser_internals/nonproj.pyx":181 + * # hitting a Y then make this the new head. + * for i in range(doc.length): + * label = doc.vocab.strings[doc.c[i].dep] # <<<<<<<<<<<<<< + * if DELIMITER in label: + * new_label, head_label = label.split(DELIMITER) +*/ + __pyx_t_4 = __Pyx_GetItemInt(((PyObject *)__pyx_v_doc->vocab->strings), (__pyx_v_doc->c[__pyx_v_i]).dep, __pyx_t_5spacy_8typedefs_attr_t, 0, __Pyx_PyLong_From_uint64_t, 0, 0, 1, 1, __Pyx_ReferenceSharing_SharedReference); if (unlikely(!__pyx_t_4)) __PYX_ERR(0, 181, __pyx_L1_error) + __Pyx_GOTREF(__pyx_t_4); + __Pyx_XDECREF_SET(__pyx_v_label, __pyx_t_4); + __pyx_t_4 = 0; + + /* "spacy/pipeline/_parser_internals/nonproj.pyx":182 + * for i in range(doc.length): + * label = doc.vocab.strings[doc.c[i].dep] + * if DELIMITER in label: # <<<<<<<<<<<<<< + * new_label, head_label = label.split(DELIMITER) + * new_head = _find_new_head(doc[i], head_label) +*/ + __Pyx_GetModuleGlobalName(__pyx_t_4, __pyx_mstate_global->__pyx_n_u_DELIMITER); if (unlikely(!__pyx_t_4)) __PYX_ERR(0, 182, __pyx_L1_error) + __Pyx_GOTREF(__pyx_t_4); + __pyx_t_5 = (__Pyx_PySequence_ContainsTF(__pyx_t_4, __pyx_v_label, Py_EQ)); if (unlikely((__pyx_t_5 < 0))) __PYX_ERR(0, 182, __pyx_L1_error) + __Pyx_DECREF(__pyx_t_4); __pyx_t_4 = 0; + if (__pyx_t_5) { + + /* "spacy/pipeline/_parser_internals/nonproj.pyx":183 + * label = doc.vocab.strings[doc.c[i].dep] + * if DELIMITER in label: + * new_label, head_label = label.split(DELIMITER) # <<<<<<<<<<<<<< + * new_head = _find_new_head(doc[i], head_label) + * doc.c[i].head = new_head.i - i +*/ + __pyx_t_6 = __pyx_v_label; + __Pyx_INCREF(__pyx_t_6); + __Pyx_GetModuleGlobalName(__pyx_t_7, __pyx_mstate_global->__pyx_n_u_DELIMITER); if (unlikely(!__pyx_t_7)) __PYX_ERR(0, 183, __pyx_L1_error) + __Pyx_GOTREF(__pyx_t_7); + __pyx_t_8 = 0; + { + PyObject *__pyx_callargs[2] = {__pyx_t_6, __pyx_t_7}; + __pyx_t_4 = __Pyx_PyObject_FastCallMethod((PyObject*)__pyx_mstate_global->__pyx_n_u_split, __pyx_callargs+__pyx_t_8, (2-__pyx_t_8) | (1*__Pyx_PY_VECTORCALL_ARGUMENTS_OFFSET)); + __Pyx_XDECREF(__pyx_t_6); __pyx_t_6 = 0; + __Pyx_DECREF(__pyx_t_7); __pyx_t_7 = 0; + if (unlikely(!__pyx_t_4)) __PYX_ERR(0, 183, __pyx_L1_error) + __Pyx_GOTREF(__pyx_t_4); + } + if ((likely(PyTuple_CheckExact(__pyx_t_4))) || (PyList_CheckExact(__pyx_t_4))) { + PyObject* sequence = __pyx_t_4; + 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, 183, __pyx_L1_error) + } + #if CYTHON_ASSUME_SAFE_MACROS && !CYTHON_AVOID_BORROWED_REFS + if (likely(PyTuple_CheckExact(sequence))) { + __pyx_t_7 = PyTuple_GET_ITEM(sequence, 0); + __Pyx_INCREF(__pyx_t_7); + __pyx_t_6 = PyTuple_GET_ITEM(sequence, 1); + __Pyx_INCREF(__pyx_t_6); + } else { + __pyx_t_7 = __Pyx_PyList_GetItemRefFast(sequence, 0, __Pyx_ReferenceSharing_SharedReference); + if (unlikely(!__pyx_t_7)) __PYX_ERR(0, 183, __pyx_L1_error) + __Pyx_XGOTREF(__pyx_t_7); + __pyx_t_6 = __Pyx_PyList_GetItemRefFast(sequence, 1, __Pyx_ReferenceSharing_SharedReference); + if (unlikely(!__pyx_t_6)) __PYX_ERR(0, 183, __pyx_L1_error) + __Pyx_XGOTREF(__pyx_t_6); + } + #else + __pyx_t_7 = __Pyx_PySequence_ITEM(sequence, 0); if (unlikely(!__pyx_t_7)) __PYX_ERR(0, 183, __pyx_L1_error) + __Pyx_GOTREF(__pyx_t_7); + __pyx_t_6 = __Pyx_PySequence_ITEM(sequence, 1); if (unlikely(!__pyx_t_6)) __PYX_ERR(0, 183, __pyx_L1_error) + __Pyx_GOTREF(__pyx_t_6); + #endif + __Pyx_DECREF(__pyx_t_4); __pyx_t_4 = 0; + } else { + Py_ssize_t index = -1; + __pyx_t_9 = PyObject_GetIter(__pyx_t_4); if (unlikely(!__pyx_t_9)) __PYX_ERR(0, 183, __pyx_L1_error) + __Pyx_GOTREF(__pyx_t_9); + __Pyx_DECREF(__pyx_t_4); __pyx_t_4 = 0; + __pyx_t_10 = (CYTHON_COMPILING_IN_LIMITED_API) ? PyIter_Next : __Pyx_PyObject_GetIterNextFunc(__pyx_t_9); + index = 0; __pyx_t_7 = __pyx_t_10(__pyx_t_9); if (unlikely(!__pyx_t_7)) goto __pyx_L6_unpacking_failed; + __Pyx_GOTREF(__pyx_t_7); + index = 1; __pyx_t_6 = __pyx_t_10(__pyx_t_9); if (unlikely(!__pyx_t_6)) goto __pyx_L6_unpacking_failed; + __Pyx_GOTREF(__pyx_t_6); + if (__Pyx_IternextUnpackEndCheck(__pyx_t_10(__pyx_t_9), 2) < (0)) __PYX_ERR(0, 183, __pyx_L1_error) + __pyx_t_10 = NULL; + __Pyx_DECREF(__pyx_t_9); __pyx_t_9 = 0; + goto __pyx_L7_unpacking_done; + __pyx_L6_unpacking_failed:; + __Pyx_DECREF(__pyx_t_9); __pyx_t_9 = 0; + __pyx_t_10 = NULL; + if (__Pyx_IterFinish() == 0) __Pyx_RaiseNeedMoreValuesError(index); + __PYX_ERR(0, 183, __pyx_L1_error) + __pyx_L7_unpacking_done:; + } + __Pyx_XDECREF_SET(__pyx_v_new_label, __pyx_t_7); + __pyx_t_7 = 0; + __Pyx_XDECREF_SET(__pyx_v_head_label, __pyx_t_6); + __pyx_t_6 = 0; + + /* "spacy/pipeline/_parser_internals/nonproj.pyx":184 + * if DELIMITER in label: + * new_label, head_label = label.split(DELIMITER) + * new_head = _find_new_head(doc[i], head_label) # <<<<<<<<<<<<<< + * doc.c[i].head = new_head.i - i + * doc.c[i].dep = doc.vocab.strings.add(new_label, allow_transient=False) +*/ + __pyx_t_6 = NULL; + __Pyx_GetModuleGlobalName(__pyx_t_7, __pyx_mstate_global->__pyx_n_u_find_new_head); if (unlikely(!__pyx_t_7)) __PYX_ERR(0, 184, __pyx_L1_error) + __Pyx_GOTREF(__pyx_t_7); + __pyx_t_9 = __Pyx_GetItemInt(((PyObject *)__pyx_v_doc), __pyx_v_i, int, 1, __Pyx_PyLong_From_int, 0, 1, 1, 1, __Pyx_ReferenceSharing_FunctionArgument); if (unlikely(!__pyx_t_9)) __PYX_ERR(0, 184, __pyx_L1_error) + __Pyx_GOTREF(__pyx_t_9); + __pyx_t_8 = 1; + #if CYTHON_UNPACK_METHODS + if (unlikely(PyMethod_Check(__pyx_t_7))) { + __pyx_t_6 = PyMethod_GET_SELF(__pyx_t_7); + assert(__pyx_t_6); + PyObject* __pyx__function = PyMethod_GET_FUNCTION(__pyx_t_7); + __Pyx_INCREF(__pyx_t_6); + __Pyx_INCREF(__pyx__function); + __Pyx_DECREF_SET(__pyx_t_7, __pyx__function); + __pyx_t_8 = 0; + } + #endif + { + PyObject *__pyx_callargs[3] = {__pyx_t_6, __pyx_t_9, __pyx_v_head_label}; + __pyx_t_4 = __Pyx_PyObject_FastCall((PyObject*)__pyx_t_7, __pyx_callargs+__pyx_t_8, (3-__pyx_t_8) | (__pyx_t_8*__Pyx_PY_VECTORCALL_ARGUMENTS_OFFSET)); + __Pyx_XDECREF(__pyx_t_6); __pyx_t_6 = 0; + __Pyx_DECREF(__pyx_t_9); __pyx_t_9 = 0; + __Pyx_DECREF(__pyx_t_7); __pyx_t_7 = 0; + if (unlikely(!__pyx_t_4)) __PYX_ERR(0, 184, __pyx_L1_error) + __Pyx_GOTREF(__pyx_t_4); + } + __Pyx_XDECREF_SET(__pyx_v_new_head, __pyx_t_4); + __pyx_t_4 = 0; + + /* "spacy/pipeline/_parser_internals/nonproj.pyx":185 + * new_label, head_label = label.split(DELIMITER) + * new_head = _find_new_head(doc[i], head_label) + * doc.c[i].head = new_head.i - i # <<<<<<<<<<<<<< + * doc.c[i].dep = doc.vocab.strings.add(new_label, allow_transient=False) + * set_children_from_heads(doc.c, 0, doc.length) +*/ + __pyx_t_4 = __Pyx_PyObject_GetAttrStr(__pyx_v_new_head, __pyx_mstate_global->__pyx_n_u_i); if (unlikely(!__pyx_t_4)) __PYX_ERR(0, 185, __pyx_L1_error) + __Pyx_GOTREF(__pyx_t_4); + __pyx_t_7 = __Pyx_PyLong_From_int(__pyx_v_i); if (unlikely(!__pyx_t_7)) __PYX_ERR(0, 185, __pyx_L1_error) + __Pyx_GOTREF(__pyx_t_7); + __pyx_t_9 = PyNumber_Subtract(__pyx_t_4, __pyx_t_7); if (unlikely(!__pyx_t_9)) __PYX_ERR(0, 185, __pyx_L1_error) + __Pyx_GOTREF(__pyx_t_9); + __Pyx_DECREF(__pyx_t_4); __pyx_t_4 = 0; + __Pyx_DECREF(__pyx_t_7); __pyx_t_7 = 0; + __pyx_t_11 = __Pyx_PyLong_As_int(__pyx_t_9); if (unlikely((__pyx_t_11 == (int)-1) && PyErr_Occurred())) __PYX_ERR(0, 185, __pyx_L1_error) + __Pyx_DECREF(__pyx_t_9); __pyx_t_9 = 0; + (__pyx_v_doc->c[__pyx_v_i]).head = __pyx_t_11; + + /* "spacy/pipeline/_parser_internals/nonproj.pyx":186 + * new_head = _find_new_head(doc[i], head_label) + * doc.c[i].head = new_head.i - i + * doc.c[i].dep = doc.vocab.strings.add(new_label, allow_transient=False) # <<<<<<<<<<<<<< + * set_children_from_heads(doc.c, 0, doc.length) + * return doc +*/ + __pyx_t_7 = ((PyObject *)__pyx_v_doc->vocab->strings); + __Pyx_INCREF(__pyx_t_7); + __pyx_t_8 = 0; + { + PyObject *__pyx_callargs[2 + ((CYTHON_VECTORCALL) ? 1 : 0)] = {__pyx_t_7, __pyx_v_new_label}; + __pyx_t_4 = __Pyx_MakeVectorcallBuilderKwds(1); if (unlikely(!__pyx_t_4)) __PYX_ERR(0, 186, __pyx_L1_error) + __Pyx_GOTREF(__pyx_t_4); + if (__Pyx_VectorcallBuilder_AddArg(__pyx_mstate_global->__pyx_n_u_allow_transient, Py_False, __pyx_t_4, __pyx_callargs+2, 0) < (0)) __PYX_ERR(0, 186, __pyx_L1_error) + __pyx_t_9 = __Pyx_Object_VectorcallMethod_CallFromBuilder((PyObject*)__pyx_mstate_global->__pyx_n_u_add, __pyx_callargs+__pyx_t_8, (2-__pyx_t_8) | (1*__Pyx_PY_VECTORCALL_ARGUMENTS_OFFSET), __pyx_t_4); + __Pyx_XDECREF(__pyx_t_7); __pyx_t_7 = 0; + __Pyx_DECREF(__pyx_t_4); __pyx_t_4 = 0; + if (unlikely(!__pyx_t_9)) __PYX_ERR(0, 186, __pyx_L1_error) + __Pyx_GOTREF(__pyx_t_9); + } + __pyx_t_12 = __Pyx_PyLong_As_uint64_t(__pyx_t_9); if (unlikely((__pyx_t_12 == ((uint64_t)-1)) && PyErr_Occurred())) __PYX_ERR(0, 186, __pyx_L1_error) + __Pyx_DECREF(__pyx_t_9); __pyx_t_9 = 0; + (__pyx_v_doc->c[__pyx_v_i]).dep = __pyx_t_12; + + /* "spacy/pipeline/_parser_internals/nonproj.pyx":182 + * for i in range(doc.length): + * label = doc.vocab.strings[doc.c[i].dep] + * if DELIMITER in label: # <<<<<<<<<<<<<< + * new_label, head_label = label.split(DELIMITER) + * new_head = _find_new_head(doc[i], head_label) +*/ + } + } + + /* "spacy/pipeline/_parser_internals/nonproj.pyx":187 + * doc.c[i].head = new_head.i - i + * doc.c[i].dep = doc.vocab.strings.add(new_label, allow_transient=False) + * set_children_from_heads(doc.c, 0, doc.length) # <<<<<<<<<<<<<< + * return doc + * +*/ + __pyx_t_1 = __pyx_f_5spacy_6tokens_3doc_set_children_from_heads(__pyx_v_doc->c, 0, __pyx_v_doc->length); if (unlikely(__pyx_t_1 == ((int)-1))) __PYX_ERR(0, 187, __pyx_L1_error) + + /* "spacy/pipeline/_parser_internals/nonproj.pyx":188 + * doc.c[i].dep = doc.vocab.strings.add(new_label, allow_transient=False) + * set_children_from_heads(doc.c, 0, doc.length) + * return doc # <<<<<<<<<<<<<< + * + * +*/ + __Pyx_XDECREF(__pyx_r); + __Pyx_INCREF((PyObject *)__pyx_v_doc); + __pyx_r = ((PyObject *)__pyx_v_doc); + goto __pyx_L0; + + /* "spacy/pipeline/_parser_internals/nonproj.pyx":176 + * + * + * cpdef deprojectivize(Doc doc): # <<<<<<<<<<<<<< + * # Reattach arcs with decorated labels (following HEAD scheme). For each + * # decorated arc X||Y, search top-down, left-to-right, breadth-first until +*/ + + /* function exit code */ + __pyx_L1_error:; + __Pyx_XDECREF(__pyx_t_4); + __Pyx_XDECREF(__pyx_t_6); + __Pyx_XDECREF(__pyx_t_7); + __Pyx_XDECREF(__pyx_t_9); + __Pyx_AddTraceback("spacy.pipeline._parser_internals.nonproj.deprojectivize", __pyx_clineno, __pyx_lineno, __pyx_filename); + __pyx_r = 0; + __pyx_L0:; + __Pyx_XDECREF(__pyx_v_label); + __Pyx_XDECREF(__pyx_v_new_label); + __Pyx_XDECREF(__pyx_v_head_label); + __Pyx_XDECREF(__pyx_v_new_head); + __Pyx_XGIVEREF(__pyx_r); + __Pyx_RefNannyFinishContext(); + return __pyx_r; +} + +/* Python wrapper */ +static PyObject *__pyx_pw_5spacy_8pipeline_17_parser_internals_7nonproj_18deprojectivize(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_5spacy_8pipeline_17_parser_internals_7nonproj_17deprojectivize, "deprojectivize(Doc doc)"); +static PyMethodDef __pyx_mdef_5spacy_8pipeline_17_parser_internals_7nonproj_18deprojectivize = {"deprojectivize", (PyCFunction)(void(*)(void))(__Pyx_PyCFunction_FastCallWithKeywords)__pyx_pw_5spacy_8pipeline_17_parser_internals_7nonproj_18deprojectivize, __Pyx_METH_FASTCALL|METH_KEYWORDS, __pyx_doc_5spacy_8pipeline_17_parser_internals_7nonproj_17deprojectivize}; +static PyObject *__pyx_pw_5spacy_8pipeline_17_parser_internals_7nonproj_18deprojectivize(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 +) { + struct __pyx_obj_5spacy_6tokens_3doc_Doc *__pyx_v_doc = 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("deprojectivize (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_doc,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, "deprojectivize", 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("deprojectivize", 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_doc = ((struct __pyx_obj_5spacy_6tokens_3doc_Doc *)values[0]); + } + goto __pyx_L6_skip; + __pyx_L5_argtuple_error:; + __Pyx_RaiseArgtupleInvalid("deprojectivize", 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("spacy.pipeline._parser_internals.nonproj.deprojectivize", __pyx_clineno, __pyx_lineno, __pyx_filename); + __Pyx_RefNannyFinishContext(); + return NULL; + __pyx_L4_argument_unpacking_done:; + if (unlikely(!__Pyx_ArgTypeTest(((PyObject *)__pyx_v_doc), __pyx_mstate_global->__pyx_ptype_5spacy_6tokens_3doc_Doc, 1, "doc", 0))) __PYX_ERR(0, 176, __pyx_L1_error) + __pyx_r = __pyx_pf_5spacy_8pipeline_17_parser_internals_7nonproj_17deprojectivize(__pyx_self, __pyx_v_doc); + + /* 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_5spacy_8pipeline_17_parser_internals_7nonproj_17deprojectivize(CYTHON_UNUSED PyObject *__pyx_self, struct __pyx_obj_5spacy_6tokens_3doc_Doc *__pyx_v_doc) { + 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("deprojectivize", 0); + __Pyx_XDECREF(__pyx_r); + __pyx_t_1 = __pyx_f_5spacy_8pipeline_17_parser_internals_7nonproj_deprojectivize(__pyx_v_doc, 1); if (unlikely(!__pyx_t_1)) __PYX_ERR(0, 176, __pyx_L1_error) + __Pyx_GOTREF(__pyx_t_1); + __pyx_r = __pyx_t_1; + __pyx_t_1 = 0; + goto __pyx_L0; + + /* function exit code */ + __pyx_L1_error:; + __Pyx_XDECREF(__pyx_t_1); + __Pyx_AddTraceback("spacy.pipeline._parser_internals.nonproj.deprojectivize", __pyx_clineno, __pyx_lineno, __pyx_filename); + __pyx_r = NULL; + __pyx_L0:; + __Pyx_XGIVEREF(__pyx_r); + __Pyx_RefNannyFinishContext(); + return __pyx_r; +} + +/* "spacy/pipeline/_parser_internals/nonproj.pyx":191 + * + * + * def _decorate(heads, proj_heads, labels): # <<<<<<<<<<<<<< + * # uses decoration scheme HEAD from Nivre & Nilsson 2005 + * if (len(heads) != len(proj_heads)) or (len(proj_heads) != len(labels)): +*/ + +/* Python wrapper */ +static PyObject *__pyx_pw_5spacy_8pipeline_17_parser_internals_7nonproj_20_decorate(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_5spacy_8pipeline_17_parser_internals_7nonproj_19_decorate, "_decorate(heads, proj_heads, labels)"); +static PyMethodDef __pyx_mdef_5spacy_8pipeline_17_parser_internals_7nonproj_20_decorate = {"_decorate", (PyCFunction)(void(*)(void))(__Pyx_PyCFunction_FastCallWithKeywords)__pyx_pw_5spacy_8pipeline_17_parser_internals_7nonproj_20_decorate, __Pyx_METH_FASTCALL|METH_KEYWORDS, __pyx_doc_5spacy_8pipeline_17_parser_internals_7nonproj_19_decorate}; +static PyObject *__pyx_pw_5spacy_8pipeline_17_parser_internals_7nonproj_20_decorate(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 +) { + PyObject *__pyx_v_heads = 0; + PyObject *__pyx_v_proj_heads = 0; + PyObject *__pyx_v_labels = 0; + #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("_decorate (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_heads,&__pyx_mstate_global->__pyx_n_u_proj_heads,&__pyx_mstate_global->__pyx_n_u_labels,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, 191, __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, 191, __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, 191, __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, 191, __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, "_decorate", 0) < (0)) __PYX_ERR(0, 191, __pyx_L3_error) + for (Py_ssize_t i = __pyx_nargs; i < 3; i++) { + if (unlikely(!values[i])) { __Pyx_RaiseArgtupleInvalid("_decorate", 1, 3, 3, i); __PYX_ERR(0, 191, __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, 191, __pyx_L3_error) + values[1] = __Pyx_ArgRef_FASTCALL(__pyx_args, 1); + if (!CYTHON_ASSUME_SAFE_MACROS && unlikely(!values[1])) __PYX_ERR(0, 191, __pyx_L3_error) + values[2] = __Pyx_ArgRef_FASTCALL(__pyx_args, 2); + if (!CYTHON_ASSUME_SAFE_MACROS && unlikely(!values[2])) __PYX_ERR(0, 191, __pyx_L3_error) + } + __pyx_v_heads = values[0]; + __pyx_v_proj_heads = values[1]; + __pyx_v_labels = values[2]; + } + goto __pyx_L6_skip; + __pyx_L5_argtuple_error:; + __Pyx_RaiseArgtupleInvalid("_decorate", 1, 3, 3, __pyx_nargs); __PYX_ERR(0, 191, __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("spacy.pipeline._parser_internals.nonproj._decorate", __pyx_clineno, __pyx_lineno, __pyx_filename); + __Pyx_RefNannyFinishContext(); + return NULL; + __pyx_L4_argument_unpacking_done:; + __pyx_r = __pyx_pf_5spacy_8pipeline_17_parser_internals_7nonproj_19_decorate(__pyx_self, __pyx_v_heads, __pyx_v_proj_heads, __pyx_v_labels); + + /* 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_5spacy_8pipeline_17_parser_internals_7nonproj_19_decorate(CYTHON_UNUSED PyObject *__pyx_self, PyObject *__pyx_v_heads, PyObject *__pyx_v_proj_heads, PyObject *__pyx_v_labels) { + PyObject *__pyx_v_deco_labels = NULL; + PyObject *__pyx_v_tokenid = NULL; + PyObject *__pyx_v_head = NULL; + PyObject *__pyx_r = NULL; + __Pyx_RefNannyDeclarations + int __pyx_t_1; + Py_ssize_t __pyx_t_2; + Py_ssize_t __pyx_t_3; + int __pyx_t_4; + PyObject *__pyx_t_5 = NULL; + PyObject *__pyx_t_6 = NULL; + PyObject *__pyx_t_7 = NULL; + PyObject *__pyx_t_8 = NULL; + PyObject *__pyx_t_9 = NULL; + PyObject *__pyx_t_10 = NULL; + PyObject *__pyx_t_11 = NULL; + PyObject *__pyx_t_12 = NULL; + size_t __pyx_t_13; + PyObject *__pyx_t_14 = NULL; + PyObject *(*__pyx_t_15)(PyObject *); + PyObject *__pyx_t_16[3]; + int __pyx_t_17; + int __pyx_lineno = 0; + const char *__pyx_filename = NULL; + int __pyx_clineno = 0; + __Pyx_RefNannySetupContext("_decorate", 0); + + /* "spacy/pipeline/_parser_internals/nonproj.pyx":193 + * def _decorate(heads, proj_heads, labels): + * # uses decoration scheme HEAD from Nivre & Nilsson 2005 + * if (len(heads) != len(proj_heads)) or (len(proj_heads) != len(labels)): # <<<<<<<<<<<<<< + * raise ValueError(Errors.E082.format(n_heads=len(heads), + * n_proj_heads=len(proj_heads), +*/ + __pyx_t_2 = PyObject_Length(__pyx_v_heads); if (unlikely(__pyx_t_2 == ((Py_ssize_t)-1))) __PYX_ERR(0, 193, __pyx_L1_error) + __pyx_t_3 = PyObject_Length(__pyx_v_proj_heads); if (unlikely(__pyx_t_3 == ((Py_ssize_t)-1))) __PYX_ERR(0, 193, __pyx_L1_error) + __pyx_t_4 = (__pyx_t_2 != __pyx_t_3); + if (!__pyx_t_4) { + } else { + __pyx_t_1 = __pyx_t_4; + goto __pyx_L4_bool_binop_done; + } + __pyx_t_3 = PyObject_Length(__pyx_v_proj_heads); if (unlikely(__pyx_t_3 == ((Py_ssize_t)-1))) __PYX_ERR(0, 193, __pyx_L1_error) + __pyx_t_2 = PyObject_Length(__pyx_v_labels); if (unlikely(__pyx_t_2 == ((Py_ssize_t)-1))) __PYX_ERR(0, 193, __pyx_L1_error) + __pyx_t_4 = (__pyx_t_3 != __pyx_t_2); + __pyx_t_1 = __pyx_t_4; + __pyx_L4_bool_binop_done:; + if (unlikely(__pyx_t_1)) { + + /* "spacy/pipeline/_parser_internals/nonproj.pyx":194 + * # uses decoration scheme HEAD from Nivre & Nilsson 2005 + * if (len(heads) != len(proj_heads)) or (len(proj_heads) != len(labels)): + * raise ValueError(Errors.E082.format(n_heads=len(heads), # <<<<<<<<<<<<<< + * n_proj_heads=len(proj_heads), + * n_labels=len(labels))) +*/ + __pyx_t_6 = NULL; + __Pyx_GetModuleGlobalName(__pyx_t_9, __pyx_mstate_global->__pyx_n_u_Errors); if (unlikely(!__pyx_t_9)) __PYX_ERR(0, 194, __pyx_L1_error) + __Pyx_GOTREF(__pyx_t_9); + __pyx_t_10 = __Pyx_PyObject_GetAttrStr(__pyx_t_9, __pyx_mstate_global->__pyx_n_u_E082); if (unlikely(!__pyx_t_10)) __PYX_ERR(0, 194, __pyx_L1_error) + __Pyx_GOTREF(__pyx_t_10); + __Pyx_DECREF(__pyx_t_9); __pyx_t_9 = 0; + __pyx_t_8 = __pyx_t_10; + __Pyx_INCREF(__pyx_t_8); + __pyx_t_2 = PyObject_Length(__pyx_v_heads); if (unlikely(__pyx_t_2 == ((Py_ssize_t)-1))) __PYX_ERR(0, 194, __pyx_L1_error) + __pyx_t_9 = PyLong_FromSsize_t(__pyx_t_2); if (unlikely(!__pyx_t_9)) __PYX_ERR(0, 194, __pyx_L1_error) + __Pyx_GOTREF(__pyx_t_9); + + /* "spacy/pipeline/_parser_internals/nonproj.pyx":195 + * if (len(heads) != len(proj_heads)) or (len(proj_heads) != len(labels)): + * raise ValueError(Errors.E082.format(n_heads=len(heads), + * n_proj_heads=len(proj_heads), # <<<<<<<<<<<<<< + * n_labels=len(labels))) + * deco_labels = [] +*/ + __pyx_t_2 = PyObject_Length(__pyx_v_proj_heads); if (unlikely(__pyx_t_2 == ((Py_ssize_t)-1))) __PYX_ERR(0, 195, __pyx_L1_error) + __pyx_t_11 = PyLong_FromSsize_t(__pyx_t_2); if (unlikely(!__pyx_t_11)) __PYX_ERR(0, 195, __pyx_L1_error) + __Pyx_GOTREF(__pyx_t_11); + + /* "spacy/pipeline/_parser_internals/nonproj.pyx":196 + * raise ValueError(Errors.E082.format(n_heads=len(heads), + * n_proj_heads=len(proj_heads), + * n_labels=len(labels))) # <<<<<<<<<<<<<< + * deco_labels = [] + * for tokenid, head in enumerate(heads): +*/ + __pyx_t_2 = PyObject_Length(__pyx_v_labels); if (unlikely(__pyx_t_2 == ((Py_ssize_t)-1))) __PYX_ERR(0, 196, __pyx_L1_error) + __pyx_t_12 = PyLong_FromSsize_t(__pyx_t_2); if (unlikely(!__pyx_t_12)) __PYX_ERR(0, 196, __pyx_L1_error) + __Pyx_GOTREF(__pyx_t_12); + __pyx_t_13 = 0; + { + PyObject *__pyx_callargs[2 + ((CYTHON_VECTORCALL) ? 3 : 0)] = {__pyx_t_8, NULL}; + __pyx_t_14 = __Pyx_MakeVectorcallBuilderKwds(3); if (unlikely(!__pyx_t_14)) __PYX_ERR(0, 194, __pyx_L1_error) + __Pyx_GOTREF(__pyx_t_14); + if (__Pyx_VectorcallBuilder_AddArg(__pyx_mstate_global->__pyx_n_u_n_heads, __pyx_t_9, __pyx_t_14, __pyx_callargs+1, 0) < (0)) __PYX_ERR(0, 194, __pyx_L1_error) + if (__Pyx_VectorcallBuilder_AddArg(__pyx_mstate_global->__pyx_n_u_n_proj_heads, __pyx_t_11, __pyx_t_14, __pyx_callargs+1, 1) < (0)) __PYX_ERR(0, 194, __pyx_L1_error) + if (__Pyx_VectorcallBuilder_AddArg(__pyx_mstate_global->__pyx_n_u_n_labels, __pyx_t_12, __pyx_t_14, __pyx_callargs+1, 2) < (0)) __PYX_ERR(0, 194, __pyx_L1_error) + __pyx_t_7 = __Pyx_Object_VectorcallMethod_CallFromBuilder((PyObject*)__pyx_mstate_global->__pyx_n_u_format, __pyx_callargs+__pyx_t_13, (1-__pyx_t_13) | (1*__Pyx_PY_VECTORCALL_ARGUMENTS_OFFSET), __pyx_t_14); + __Pyx_XDECREF(__pyx_t_8); __pyx_t_8 = 0; + __Pyx_DECREF(__pyx_t_9); __pyx_t_9 = 0; + __Pyx_DECREF(__pyx_t_11); __pyx_t_11 = 0; + __Pyx_DECREF(__pyx_t_12); __pyx_t_12 = 0; + __Pyx_DECREF(__pyx_t_14); __pyx_t_14 = 0; + __Pyx_DECREF(__pyx_t_10); __pyx_t_10 = 0; + if (unlikely(!__pyx_t_7)) __PYX_ERR(0, 194, __pyx_L1_error) + __Pyx_GOTREF(__pyx_t_7); + } + __pyx_t_13 = 1; + { + PyObject *__pyx_callargs[2] = {__pyx_t_6, __pyx_t_7}; + __pyx_t_5 = __Pyx_PyObject_FastCall((PyObject*)(((PyTypeObject*)PyExc_ValueError)), __pyx_callargs+__pyx_t_13, (2-__pyx_t_13) | (__pyx_t_13*__Pyx_PY_VECTORCALL_ARGUMENTS_OFFSET)); + __Pyx_XDECREF(__pyx_t_6); __pyx_t_6 = 0; + __Pyx_DECREF(__pyx_t_7); __pyx_t_7 = 0; + if (unlikely(!__pyx_t_5)) __PYX_ERR(0, 194, __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, 194, __pyx_L1_error) + + /* "spacy/pipeline/_parser_internals/nonproj.pyx":193 + * def _decorate(heads, proj_heads, labels): + * # uses decoration scheme HEAD from Nivre & Nilsson 2005 + * if (len(heads) != len(proj_heads)) or (len(proj_heads) != len(labels)): # <<<<<<<<<<<<<< + * raise ValueError(Errors.E082.format(n_heads=len(heads), + * n_proj_heads=len(proj_heads), +*/ + } + + /* "spacy/pipeline/_parser_internals/nonproj.pyx":197 + * n_proj_heads=len(proj_heads), + * n_labels=len(labels))) + * deco_labels = [] # <<<<<<<<<<<<<< + * for tokenid, head in enumerate(heads): + * if head != proj_heads[tokenid]: +*/ + __pyx_t_5 = PyList_New(0); if (unlikely(!__pyx_t_5)) __PYX_ERR(0, 197, __pyx_L1_error) + __Pyx_GOTREF(__pyx_t_5); + __pyx_v_deco_labels = ((PyObject*)__pyx_t_5); + __pyx_t_5 = 0; + + /* "spacy/pipeline/_parser_internals/nonproj.pyx":198 + * n_labels=len(labels))) + * deco_labels = [] + * for tokenid, head in enumerate(heads): # <<<<<<<<<<<<<< + * if head != proj_heads[tokenid]: + * deco_labels.append(f"{labels[tokenid]}{DELIMITER}{labels[head]}") +*/ + __Pyx_INCREF(__pyx_mstate_global->__pyx_int_0); + __pyx_t_5 = __pyx_mstate_global->__pyx_int_0; + if (likely(PyList_CheckExact(__pyx_v_heads)) || PyTuple_CheckExact(__pyx_v_heads)) { + __pyx_t_7 = __pyx_v_heads; __Pyx_INCREF(__pyx_t_7); + __pyx_t_2 = 0; + __pyx_t_15 = NULL; + } else { + __pyx_t_2 = -1; __pyx_t_7 = PyObject_GetIter(__pyx_v_heads); if (unlikely(!__pyx_t_7)) __PYX_ERR(0, 198, __pyx_L1_error) + __Pyx_GOTREF(__pyx_t_7); + __pyx_t_15 = (CYTHON_COMPILING_IN_LIMITED_API) ? PyIter_Next : __Pyx_PyObject_GetIterNextFunc(__pyx_t_7); if (unlikely(!__pyx_t_15)) __PYX_ERR(0, 198, __pyx_L1_error) + } + for (;;) { + if (likely(!__pyx_t_15)) { + if (likely(PyList_CheckExact(__pyx_t_7))) { + { + Py_ssize_t __pyx_temp = __Pyx_PyList_GET_SIZE(__pyx_t_7); + #if !CYTHON_ASSUME_SAFE_SIZE + if (unlikely((__pyx_temp < 0))) __PYX_ERR(0, 198, __pyx_L1_error) + #endif + if (__pyx_t_2 >= __pyx_temp) break; + } + __pyx_t_6 = __Pyx_PyList_GetItemRefFast(__pyx_t_7, __pyx_t_2, __Pyx_ReferenceSharing_OwnStrongReference); + ++__pyx_t_2; + } else { + { + Py_ssize_t __pyx_temp = __Pyx_PyTuple_GET_SIZE(__pyx_t_7); + #if !CYTHON_ASSUME_SAFE_SIZE + if (unlikely((__pyx_temp < 0))) __PYX_ERR(0, 198, __pyx_L1_error) + #endif + if (__pyx_t_2 >= __pyx_temp) break; + } + #if CYTHON_ASSUME_SAFE_MACROS && !CYTHON_AVOID_BORROWED_REFS + __pyx_t_6 = __Pyx_NewRef(PyTuple_GET_ITEM(__pyx_t_7, __pyx_t_2)); + #else + __pyx_t_6 = __Pyx_PySequence_ITEM(__pyx_t_7, __pyx_t_2); + #endif + ++__pyx_t_2; + } + if (unlikely(!__pyx_t_6)) __PYX_ERR(0, 198, __pyx_L1_error) + } else { + __pyx_t_6 = __pyx_t_15(__pyx_t_7); + if (unlikely(!__pyx_t_6)) { + PyObject* exc_type = PyErr_Occurred(); + if (exc_type) { + if (unlikely(!__Pyx_PyErr_GivenExceptionMatches(exc_type, PyExc_StopIteration))) __PYX_ERR(0, 198, __pyx_L1_error) + PyErr_Clear(); + } + break; + } + } + __Pyx_GOTREF(__pyx_t_6); + __Pyx_XDECREF_SET(__pyx_v_head, __pyx_t_6); + __pyx_t_6 = 0; + __Pyx_INCREF(__pyx_t_5); + __Pyx_XDECREF_SET(__pyx_v_tokenid, __pyx_t_5); + __pyx_t_6 = __Pyx_PyLong_AddObjC(__pyx_t_5, __pyx_mstate_global->__pyx_int_1, 1, 0, 0); if (unlikely(!__pyx_t_6)) __PYX_ERR(0, 198, __pyx_L1_error) + __Pyx_GOTREF(__pyx_t_6); + __Pyx_DECREF(__pyx_t_5); + __pyx_t_5 = __pyx_t_6; + __pyx_t_6 = 0; + + /* "spacy/pipeline/_parser_internals/nonproj.pyx":199 + * deco_labels = [] + * for tokenid, head in enumerate(heads): + * if head != proj_heads[tokenid]: # <<<<<<<<<<<<<< + * deco_labels.append(f"{labels[tokenid]}{DELIMITER}{labels[head]}") + * else: +*/ + __pyx_t_6 = __Pyx_PyObject_GetItem(__pyx_v_proj_heads, __pyx_v_tokenid); if (unlikely(!__pyx_t_6)) __PYX_ERR(0, 199, __pyx_L1_error) + __Pyx_GOTREF(__pyx_t_6); + __pyx_t_10 = PyObject_RichCompare(__pyx_v_head, __pyx_t_6, Py_NE); __Pyx_XGOTREF(__pyx_t_10); if (unlikely(!__pyx_t_10)) __PYX_ERR(0, 199, __pyx_L1_error) + __Pyx_DECREF(__pyx_t_6); __pyx_t_6 = 0; + __pyx_t_1 = __Pyx_PyObject_IsTrue(__pyx_t_10); if (unlikely((__pyx_t_1 < 0))) __PYX_ERR(0, 199, __pyx_L1_error) + __Pyx_DECREF(__pyx_t_10); __pyx_t_10 = 0; + if (__pyx_t_1) { + + /* "spacy/pipeline/_parser_internals/nonproj.pyx":200 + * for tokenid, head in enumerate(heads): + * if head != proj_heads[tokenid]: + * deco_labels.append(f"{labels[tokenid]}{DELIMITER}{labels[head]}") # <<<<<<<<<<<<<< + * else: + * deco_labels.append(labels[tokenid]) +*/ + __pyx_t_10 = __Pyx_PyObject_GetItem(__pyx_v_labels, __pyx_v_tokenid); if (unlikely(!__pyx_t_10)) __PYX_ERR(0, 200, __pyx_L1_error) + __Pyx_GOTREF(__pyx_t_10); + __pyx_t_6 = __Pyx_PyObject_FormatSimple(__pyx_t_10, __pyx_mstate_global->__pyx_empty_unicode); if (unlikely(!__pyx_t_6)) __PYX_ERR(0, 200, __pyx_L1_error) + __Pyx_GOTREF(__pyx_t_6); + __Pyx_DECREF(__pyx_t_10); __pyx_t_10 = 0; + __Pyx_GetModuleGlobalName(__pyx_t_10, __pyx_mstate_global->__pyx_n_u_DELIMITER); if (unlikely(!__pyx_t_10)) __PYX_ERR(0, 200, __pyx_L1_error) + __Pyx_GOTREF(__pyx_t_10); + __pyx_t_14 = __Pyx_PyObject_FormatSimple(__pyx_t_10, __pyx_mstate_global->__pyx_empty_unicode); if (unlikely(!__pyx_t_14)) __PYX_ERR(0, 200, __pyx_L1_error) + __Pyx_GOTREF(__pyx_t_14); + __Pyx_DECREF(__pyx_t_10); __pyx_t_10 = 0; + __pyx_t_10 = __Pyx_PyObject_GetItem(__pyx_v_labels, __pyx_v_head); if (unlikely(!__pyx_t_10)) __PYX_ERR(0, 200, __pyx_L1_error) + __Pyx_GOTREF(__pyx_t_10); + __pyx_t_12 = __Pyx_PyObject_FormatSimple(__pyx_t_10, __pyx_mstate_global->__pyx_empty_unicode); if (unlikely(!__pyx_t_12)) __PYX_ERR(0, 200, __pyx_L1_error) + __Pyx_GOTREF(__pyx_t_12); + __Pyx_DECREF(__pyx_t_10); __pyx_t_10 = 0; + __pyx_t_16[0] = __pyx_t_6; + __pyx_t_16[1] = __pyx_t_14; + __pyx_t_16[2] = __pyx_t_12; + __pyx_t_10 = __Pyx_PyUnicode_Join(__pyx_t_16, 3, __Pyx_PyUnicode_GET_LENGTH(__pyx_t_6) + __Pyx_PyUnicode_GET_LENGTH(__pyx_t_14) + __Pyx_PyUnicode_GET_LENGTH(__pyx_t_12), 127 | __Pyx_PyUnicode_MAX_CHAR_VALUE(__pyx_t_6) | __Pyx_PyUnicode_MAX_CHAR_VALUE(__pyx_t_14) | __Pyx_PyUnicode_MAX_CHAR_VALUE(__pyx_t_12)); + if (unlikely(!__pyx_t_10)) __PYX_ERR(0, 200, __pyx_L1_error) + __Pyx_GOTREF(__pyx_t_10); + __Pyx_DECREF(__pyx_t_6); __pyx_t_6 = 0; + __Pyx_DECREF(__pyx_t_14); __pyx_t_14 = 0; + __Pyx_DECREF(__pyx_t_12); __pyx_t_12 = 0; + __pyx_t_17 = __Pyx_PyList_Append(__pyx_v_deco_labels, __pyx_t_10); if (unlikely(__pyx_t_17 == ((int)-1))) __PYX_ERR(0, 200, __pyx_L1_error) + __Pyx_DECREF(__pyx_t_10); __pyx_t_10 = 0; + + /* "spacy/pipeline/_parser_internals/nonproj.pyx":199 + * deco_labels = [] + * for tokenid, head in enumerate(heads): + * if head != proj_heads[tokenid]: # <<<<<<<<<<<<<< + * deco_labels.append(f"{labels[tokenid]}{DELIMITER}{labels[head]}") + * else: +*/ + goto __pyx_L8; + } + + /* "spacy/pipeline/_parser_internals/nonproj.pyx":202 + * deco_labels.append(f"{labels[tokenid]}{DELIMITER}{labels[head]}") + * else: + * deco_labels.append(labels[tokenid]) # <<<<<<<<<<<<<< + * return deco_labels + * +*/ + /*else*/ { + __pyx_t_10 = __Pyx_PyObject_GetItem(__pyx_v_labels, __pyx_v_tokenid); if (unlikely(!__pyx_t_10)) __PYX_ERR(0, 202, __pyx_L1_error) + __Pyx_GOTREF(__pyx_t_10); + __pyx_t_17 = __Pyx_PyList_Append(__pyx_v_deco_labels, __pyx_t_10); if (unlikely(__pyx_t_17 == ((int)-1))) __PYX_ERR(0, 202, __pyx_L1_error) + __Pyx_DECREF(__pyx_t_10); __pyx_t_10 = 0; + } + __pyx_L8:; + + /* "spacy/pipeline/_parser_internals/nonproj.pyx":198 + * n_labels=len(labels))) + * deco_labels = [] + * for tokenid, head in enumerate(heads): # <<<<<<<<<<<<<< + * if head != proj_heads[tokenid]: + * deco_labels.append(f"{labels[tokenid]}{DELIMITER}{labels[head]}") +*/ + } + __Pyx_DECREF(__pyx_t_7); __pyx_t_7 = 0; + __Pyx_DECREF(__pyx_t_5); __pyx_t_5 = 0; + + /* "spacy/pipeline/_parser_internals/nonproj.pyx":203 + * else: + * deco_labels.append(labels[tokenid]) + * return deco_labels # <<<<<<<<<<<<<< + * + * +*/ + __Pyx_XDECREF(__pyx_r); + __Pyx_INCREF(__pyx_v_deco_labels); + __pyx_r = __pyx_v_deco_labels; + goto __pyx_L0; + + /* "spacy/pipeline/_parser_internals/nonproj.pyx":191 + * + * + * def _decorate(heads, proj_heads, labels): # <<<<<<<<<<<<<< + * # uses decoration scheme HEAD from Nivre & Nilsson 2005 + * if (len(heads) != len(proj_heads)) or (len(proj_heads) != len(labels)): +*/ + + /* function exit code */ + __pyx_L1_error:; + __Pyx_XDECREF(__pyx_t_5); + __Pyx_XDECREF(__pyx_t_6); + __Pyx_XDECREF(__pyx_t_7); + __Pyx_XDECREF(__pyx_t_8); + __Pyx_XDECREF(__pyx_t_9); + __Pyx_XDECREF(__pyx_t_10); + __Pyx_XDECREF(__pyx_t_11); + __Pyx_XDECREF(__pyx_t_12); + __Pyx_XDECREF(__pyx_t_14); + __Pyx_AddTraceback("spacy.pipeline._parser_internals.nonproj._decorate", __pyx_clineno, __pyx_lineno, __pyx_filename); + __pyx_r = NULL; + __pyx_L0:; + __Pyx_XDECREF(__pyx_v_deco_labels); + __Pyx_XDECREF(__pyx_v_tokenid); + __Pyx_XDECREF(__pyx_v_head); + __Pyx_XGIVEREF(__pyx_r); + __Pyx_RefNannyFinishContext(); + return __pyx_r; +} + +/* "spacy/pipeline/_parser_internals/nonproj.pyx":206 + * + * + * def get_smallest_nonproj_arc_slow(heads): # <<<<<<<<<<<<<< + * cdef vector[int] c_heads = _heads_to_c(heads) + * return _get_smallest_nonproj_arc(c_heads) +*/ + +/* Python wrapper */ +static PyObject *__pyx_pw_5spacy_8pipeline_17_parser_internals_7nonproj_22get_smallest_nonproj_arc_slow(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_5spacy_8pipeline_17_parser_internals_7nonproj_21get_smallest_nonproj_arc_slow, "get_smallest_nonproj_arc_slow(heads)"); +static PyMethodDef __pyx_mdef_5spacy_8pipeline_17_parser_internals_7nonproj_22get_smallest_nonproj_arc_slow = {"get_smallest_nonproj_arc_slow", (PyCFunction)(void(*)(void))(__Pyx_PyCFunction_FastCallWithKeywords)__pyx_pw_5spacy_8pipeline_17_parser_internals_7nonproj_22get_smallest_nonproj_arc_slow, __Pyx_METH_FASTCALL|METH_KEYWORDS, __pyx_doc_5spacy_8pipeline_17_parser_internals_7nonproj_21get_smallest_nonproj_arc_slow}; +static PyObject *__pyx_pw_5spacy_8pipeline_17_parser_internals_7nonproj_22get_smallest_nonproj_arc_slow(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 +) { + PyObject *__pyx_v_heads = 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("get_smallest_nonproj_arc_slow (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_heads,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, 206, __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, 206, __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, "get_smallest_nonproj_arc_slow", 0) < (0)) __PYX_ERR(0, 206, __pyx_L3_error) + for (Py_ssize_t i = __pyx_nargs; i < 1; i++) { + if (unlikely(!values[i])) { __Pyx_RaiseArgtupleInvalid("get_smallest_nonproj_arc_slow", 1, 1, 1, i); __PYX_ERR(0, 206, __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, 206, __pyx_L3_error) + } + __pyx_v_heads = values[0]; + } + goto __pyx_L6_skip; + __pyx_L5_argtuple_error:; + __Pyx_RaiseArgtupleInvalid("get_smallest_nonproj_arc_slow", 1, 1, 1, __pyx_nargs); __PYX_ERR(0, 206, __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("spacy.pipeline._parser_internals.nonproj.get_smallest_nonproj_arc_slow", __pyx_clineno, __pyx_lineno, __pyx_filename); + __Pyx_RefNannyFinishContext(); + return NULL; + __pyx_L4_argument_unpacking_done:; + __pyx_r = __pyx_pf_5spacy_8pipeline_17_parser_internals_7nonproj_21get_smallest_nonproj_arc_slow(__pyx_self, __pyx_v_heads); + + /* 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_5spacy_8pipeline_17_parser_internals_7nonproj_21get_smallest_nonproj_arc_slow(CYTHON_UNUSED PyObject *__pyx_self, PyObject *__pyx_v_heads) { + std::vector __pyx_v_c_heads; + PyObject *__pyx_r = NULL; + __Pyx_RefNannyDeclarations + std::vector __pyx_t_1; + int __pyx_t_2; + PyObject *__pyx_t_3 = NULL; + int __pyx_lineno = 0; + const char *__pyx_filename = NULL; + int __pyx_clineno = 0; + __Pyx_RefNannySetupContext("get_smallest_nonproj_arc_slow", 0); + + /* "spacy/pipeline/_parser_internals/nonproj.pyx":207 + * + * def get_smallest_nonproj_arc_slow(heads): + * cdef vector[int] c_heads = _heads_to_c(heads) # <<<<<<<<<<<<<< + * return _get_smallest_nonproj_arc(c_heads) + * +*/ + __pyx_t_1 = __pyx_f_5spacy_8pipeline_17_parser_internals_7nonproj__heads_to_c(__pyx_v_heads); if (unlikely(PyErr_Occurred())) __PYX_ERR(0, 207, __pyx_L1_error) + __pyx_v_c_heads = __PYX_STD_MOVE_IF_SUPPORTED(__pyx_t_1); + + /* "spacy/pipeline/_parser_internals/nonproj.pyx":208 + * def get_smallest_nonproj_arc_slow(heads): + * cdef vector[int] c_heads = _heads_to_c(heads) + * return _get_smallest_nonproj_arc(c_heads) # <<<<<<<<<<<<<< + * + * +*/ + __Pyx_XDECREF(__pyx_r); + __pyx_t_2 = __pyx_f_5spacy_8pipeline_17_parser_internals_7nonproj__get_smallest_nonproj_arc(__pyx_v_c_heads); if (unlikely(__pyx_t_2 == ((int)-2))) __PYX_ERR(0, 208, __pyx_L1_error) + __pyx_t_3 = __Pyx_PyLong_From_int(__pyx_t_2); if (unlikely(!__pyx_t_3)) __PYX_ERR(0, 208, __pyx_L1_error) + __Pyx_GOTREF(__pyx_t_3); + __pyx_r = __pyx_t_3; + __pyx_t_3 = 0; + goto __pyx_L0; + + /* "spacy/pipeline/_parser_internals/nonproj.pyx":206 + * + * + * def get_smallest_nonproj_arc_slow(heads): # <<<<<<<<<<<<<< + * cdef vector[int] c_heads = _heads_to_c(heads) + * return _get_smallest_nonproj_arc(c_heads) +*/ + + /* function exit code */ + __pyx_L1_error:; + __Pyx_XDECREF(__pyx_t_3); + __Pyx_AddTraceback("spacy.pipeline._parser_internals.nonproj.get_smallest_nonproj_arc_slow", __pyx_clineno, __pyx_lineno, __pyx_filename); + __pyx_r = NULL; + __pyx_L0:; + __Pyx_XGIVEREF(__pyx_r); + __Pyx_RefNannyFinishContext(); + return __pyx_r; +} + +/* "spacy/pipeline/_parser_internals/nonproj.pyx":211 + * + * + * cdef int _get_smallest_nonproj_arc(const vector[int]& heads) nogil except -2: # <<<<<<<<<<<<<< + * # return the smallest non-proj arc or None + * # where size is defined as the distance between dep and head +*/ + +static int __pyx_f_5spacy_8pipeline_17_parser_internals_7nonproj__get_smallest_nonproj_arc(std::vector const &__pyx_v_heads) { + int __pyx_v_smallest_size; + int __pyx_v_smallest_np_arc; + int __pyx_v_size; + int __pyx_v_tokenid; + int __pyx_v_head; + int __pyx_r; + std::vector ::size_type __pyx_t_1; + std::vector ::size_type __pyx_t_2; + int __pyx_t_3; + int __pyx_t_4; + int __pyx_t_5; + bool __pyx_t_6; + int __pyx_lineno = 0; + const char *__pyx_filename = NULL; + int __pyx_clineno = 0; + PyGILState_STATE __pyx_gilstate_save; + + /* "spacy/pipeline/_parser_internals/nonproj.pyx":215 + * # where size is defined as the distance between dep and head + * # and ties are broken left to right + * cdef int smallest_size = INT_MAX # <<<<<<<<<<<<<< + * # -1 means its already projective. + * cdef int smallest_np_arc = -1 +*/ + __pyx_v_smallest_size = INT_MAX; + + /* "spacy/pipeline/_parser_internals/nonproj.pyx":217 + * cdef int smallest_size = INT_MAX + * # -1 means its already projective. + * cdef int smallest_np_arc = -1 # <<<<<<<<<<<<<< + * cdef int size + * cdef int tokenid +*/ + __pyx_v_smallest_np_arc = -1; + + /* "spacy/pipeline/_parser_internals/nonproj.pyx":222 + * cdef int head + * + * for tokenid in range(heads.size()): # <<<<<<<<<<<<<< + * head = heads[tokenid] + * size = abs(tokenid-head) +*/ + __pyx_t_1 = __pyx_v_heads.size(); + __pyx_t_2 = __pyx_t_1; + for (__pyx_t_3 = 0; __pyx_t_3 < __pyx_t_2; __pyx_t_3+=1) { + __pyx_v_tokenid = __pyx_t_3; + + /* "spacy/pipeline/_parser_internals/nonproj.pyx":223 + * + * for tokenid in range(heads.size()): + * head = heads[tokenid] # <<<<<<<<<<<<<< + * size = abs(tokenid-head) + * if size < smallest_size and _is_nonproj_arc(tokenid, heads): +*/ + __pyx_v_head = (__pyx_v_heads[__pyx_v_tokenid]); + + /* "spacy/pipeline/_parser_internals/nonproj.pyx":224 + * for tokenid in range(heads.size()): + * head = heads[tokenid] + * size = abs(tokenid-head) # <<<<<<<<<<<<<< + * if size < smallest_size and _is_nonproj_arc(tokenid, heads): + * smallest_size = size +*/ + __pyx_v_size = abs((__pyx_v_tokenid - __pyx_v_head)); + + /* "spacy/pipeline/_parser_internals/nonproj.pyx":225 + * head = heads[tokenid] + * size = abs(tokenid-head) + * if size < smallest_size and _is_nonproj_arc(tokenid, heads): # <<<<<<<<<<<<<< + * smallest_size = size + * smallest_np_arc = tokenid +*/ + __pyx_t_5 = (__pyx_v_size < __pyx_v_smallest_size); + if (__pyx_t_5) { + } else { + __pyx_t_4 = __pyx_t_5; + goto __pyx_L6_bool_binop_done; + } + __pyx_t_6 = __pyx_f_5spacy_8pipeline_17_parser_internals_7nonproj__is_nonproj_arc(__pyx_v_tokenid, __pyx_v_heads); if (unlikely(__pyx_t_6 == ((bool)-1) && __Pyx_ErrOccurredWithGIL())) __PYX_ERR(0, 225, __pyx_L1_error) + __pyx_t_5 = (__pyx_t_6 != 0); + __pyx_t_4 = __pyx_t_5; + __pyx_L6_bool_binop_done:; + if (__pyx_t_4) { + + /* "spacy/pipeline/_parser_internals/nonproj.pyx":226 + * size = abs(tokenid-head) + * if size < smallest_size and _is_nonproj_arc(tokenid, heads): + * smallest_size = size # <<<<<<<<<<<<<< + * smallest_np_arc = tokenid + * return smallest_np_arc +*/ + __pyx_v_smallest_size = __pyx_v_size; + + /* "spacy/pipeline/_parser_internals/nonproj.pyx":227 + * if size < smallest_size and _is_nonproj_arc(tokenid, heads): + * smallest_size = size + * smallest_np_arc = tokenid # <<<<<<<<<<<<<< + * return smallest_np_arc + * +*/ + __pyx_v_smallest_np_arc = __pyx_v_tokenid; + + /* "spacy/pipeline/_parser_internals/nonproj.pyx":225 + * head = heads[tokenid] + * size = abs(tokenid-head) + * if size < smallest_size and _is_nonproj_arc(tokenid, heads): # <<<<<<<<<<<<<< + * smallest_size = size + * smallest_np_arc = tokenid +*/ + } + } + + /* "spacy/pipeline/_parser_internals/nonproj.pyx":228 + * smallest_size = size + * smallest_np_arc = tokenid + * return smallest_np_arc # <<<<<<<<<<<<<< + * + * +*/ + __pyx_r = __pyx_v_smallest_np_arc; + goto __pyx_L0; + + /* "spacy/pipeline/_parser_internals/nonproj.pyx":211 + * + * + * cdef int _get_smallest_nonproj_arc(const vector[int]& heads) nogil except -2: # <<<<<<<<<<<<<< + * # return the smallest non-proj arc or None + * # where size is defined as the distance between dep and head +*/ + + /* function exit code */ + __pyx_L1_error:; + __pyx_gilstate_save = __Pyx_PyGILState_Ensure(); + __Pyx_AddTraceback("spacy.pipeline._parser_internals.nonproj._get_smallest_nonproj_arc", __pyx_clineno, __pyx_lineno, __pyx_filename); + __pyx_r = -2; + __Pyx_PyGILState_Release(__pyx_gilstate_save); + __pyx_L0:; + return __pyx_r; +} + +/* "spacy/pipeline/_parser_internals/nonproj.pyx":231 + * + * + * cpdef int _lift(tokenid, heads): # <<<<<<<<<<<<<< + * # reattaches a word to it's grandfather + * head = heads[tokenid] +*/ + +static PyObject *__pyx_pw_5spacy_8pipeline_17_parser_internals_7nonproj_24_lift(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*/ +static int __pyx_f_5spacy_8pipeline_17_parser_internals_7nonproj__lift(PyObject *__pyx_v_tokenid, PyObject *__pyx_v_heads, CYTHON_UNUSED int __pyx_skip_dispatch) { + PyObject *__pyx_v_head = NULL; + PyObject *__pyx_v_ghead = NULL; + int __pyx_v_new_head; + int __pyx_r; + __Pyx_RefNannyDeclarations + PyObject *__pyx_t_1 = NULL; + int __pyx_t_2; + int __pyx_t_3; + int __pyx_t_4; + int __pyx_lineno = 0; + const char *__pyx_filename = NULL; + int __pyx_clineno = 0; + __Pyx_RefNannySetupContext("_lift", 0); + + /* "spacy/pipeline/_parser_internals/nonproj.pyx":233 + * cpdef int _lift(tokenid, heads): + * # reattaches a word to it's grandfather + * head = heads[tokenid] # <<<<<<<<<<<<<< + * ghead = heads[head] + * cdef int new_head = ghead if head != ghead else tokenid +*/ + __pyx_t_1 = __Pyx_PyObject_GetItem(__pyx_v_heads, __pyx_v_tokenid); if (unlikely(!__pyx_t_1)) __PYX_ERR(0, 233, __pyx_L1_error) + __Pyx_GOTREF(__pyx_t_1); + __pyx_v_head = __pyx_t_1; + __pyx_t_1 = 0; + + /* "spacy/pipeline/_parser_internals/nonproj.pyx":234 + * # reattaches a word to it's grandfather + * head = heads[tokenid] + * ghead = heads[head] # <<<<<<<<<<<<<< + * cdef int new_head = ghead if head != ghead else tokenid + * # attach to ghead if head isn't attached to root else attach to root +*/ + __pyx_t_1 = __Pyx_PyObject_GetItem(__pyx_v_heads, __pyx_v_head); if (unlikely(!__pyx_t_1)) __PYX_ERR(0, 234, __pyx_L1_error) + __Pyx_GOTREF(__pyx_t_1); + __pyx_v_ghead = __pyx_t_1; + __pyx_t_1 = 0; + + /* "spacy/pipeline/_parser_internals/nonproj.pyx":235 + * head = heads[tokenid] + * ghead = heads[head] + * cdef int new_head = ghead if head != ghead else tokenid # <<<<<<<<<<<<<< + * # attach to ghead if head isn't attached to root else attach to root + * heads[tokenid] = new_head +*/ + __pyx_t_1 = PyObject_RichCompare(__pyx_v_head, __pyx_v_ghead, Py_NE); __Pyx_XGOTREF(__pyx_t_1); if (unlikely(!__pyx_t_1)) __PYX_ERR(0, 235, __pyx_L1_error) + __pyx_t_3 = __Pyx_PyObject_IsTrue(__pyx_t_1); if (unlikely((__pyx_t_3 < 0))) __PYX_ERR(0, 235, __pyx_L1_error) + __Pyx_DECREF(__pyx_t_1); __pyx_t_1 = 0; + if (__pyx_t_3) { + __pyx_t_4 = __Pyx_PyLong_As_int(__pyx_v_ghead); if (unlikely((__pyx_t_4 == (int)-1) && PyErr_Occurred())) __PYX_ERR(0, 235, __pyx_L1_error) + __pyx_t_2 = __pyx_t_4; + } else { + __pyx_t_4 = __Pyx_PyLong_As_int(__pyx_v_tokenid); if (unlikely((__pyx_t_4 == (int)-1) && PyErr_Occurred())) __PYX_ERR(0, 235, __pyx_L1_error) + __pyx_t_2 = __pyx_t_4; + } + __pyx_v_new_head = __pyx_t_2; + + /* "spacy/pipeline/_parser_internals/nonproj.pyx":237 + * cdef int new_head = ghead if head != ghead else tokenid + * # attach to ghead if head isn't attached to root else attach to root + * heads[tokenid] = new_head # <<<<<<<<<<<<<< + * return new_head + * +*/ + __pyx_t_1 = __Pyx_PyLong_From_int(__pyx_v_new_head); if (unlikely(!__pyx_t_1)) __PYX_ERR(0, 237, __pyx_L1_error) + __Pyx_GOTREF(__pyx_t_1); + if (unlikely((PyObject_SetItem(__pyx_v_heads, __pyx_v_tokenid, __pyx_t_1) < 0))) __PYX_ERR(0, 237, __pyx_L1_error) + __Pyx_DECREF(__pyx_t_1); __pyx_t_1 = 0; + + /* "spacy/pipeline/_parser_internals/nonproj.pyx":238 + * # attach to ghead if head isn't attached to root else attach to root + * heads[tokenid] = new_head + * return new_head # <<<<<<<<<<<<<< + * + * +*/ + __pyx_r = __pyx_v_new_head; + goto __pyx_L0; + + /* "spacy/pipeline/_parser_internals/nonproj.pyx":231 + * + * + * cpdef int _lift(tokenid, heads): # <<<<<<<<<<<<<< + * # reattaches a word to it's grandfather + * head = heads[tokenid] +*/ + + /* function exit code */ + __pyx_L1_error:; + __Pyx_XDECREF(__pyx_t_1); + __Pyx_AddTraceback("spacy.pipeline._parser_internals.nonproj._lift", __pyx_clineno, __pyx_lineno, __pyx_filename); + __pyx_r = -1; + __pyx_L0:; + __Pyx_XDECREF(__pyx_v_head); + __Pyx_XDECREF(__pyx_v_ghead); + __Pyx_RefNannyFinishContext(); + return __pyx_r; +} + +/* Python wrapper */ +static PyObject *__pyx_pw_5spacy_8pipeline_17_parser_internals_7nonproj_24_lift(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_5spacy_8pipeline_17_parser_internals_7nonproj_23_lift, "_lift(tokenid, heads) -> int"); +static PyMethodDef __pyx_mdef_5spacy_8pipeline_17_parser_internals_7nonproj_24_lift = {"_lift", (PyCFunction)(void(*)(void))(__Pyx_PyCFunction_FastCallWithKeywords)__pyx_pw_5spacy_8pipeline_17_parser_internals_7nonproj_24_lift, __Pyx_METH_FASTCALL|METH_KEYWORDS, __pyx_doc_5spacy_8pipeline_17_parser_internals_7nonproj_23_lift}; +static PyObject *__pyx_pw_5spacy_8pipeline_17_parser_internals_7nonproj_24_lift(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 +) { + PyObject *__pyx_v_tokenid = 0; + PyObject *__pyx_v_heads = 0; + #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("_lift (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_tokenid,&__pyx_mstate_global->__pyx_n_u_heads,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, 231, __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, 231, __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, 231, __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, "_lift", 0) < (0)) __PYX_ERR(0, 231, __pyx_L3_error) + for (Py_ssize_t i = __pyx_nargs; i < 2; i++) { + if (unlikely(!values[i])) { __Pyx_RaiseArgtupleInvalid("_lift", 1, 2, 2, i); __PYX_ERR(0, 231, __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, 231, __pyx_L3_error) + values[1] = __Pyx_ArgRef_FASTCALL(__pyx_args, 1); + if (!CYTHON_ASSUME_SAFE_MACROS && unlikely(!values[1])) __PYX_ERR(0, 231, __pyx_L3_error) + } + __pyx_v_tokenid = values[0]; + __pyx_v_heads = values[1]; + } + goto __pyx_L6_skip; + __pyx_L5_argtuple_error:; + __Pyx_RaiseArgtupleInvalid("_lift", 1, 2, 2, __pyx_nargs); __PYX_ERR(0, 231, __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("spacy.pipeline._parser_internals.nonproj._lift", __pyx_clineno, __pyx_lineno, __pyx_filename); + __Pyx_RefNannyFinishContext(); + return NULL; + __pyx_L4_argument_unpacking_done:; + __pyx_r = __pyx_pf_5spacy_8pipeline_17_parser_internals_7nonproj_23_lift(__pyx_self, __pyx_v_tokenid, __pyx_v_heads); + + /* 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_5spacy_8pipeline_17_parser_internals_7nonproj_23_lift(CYTHON_UNUSED PyObject *__pyx_self, PyObject *__pyx_v_tokenid, PyObject *__pyx_v_heads) { + 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("_lift", 0); + __Pyx_XDECREF(__pyx_r); + __pyx_t_1 = __pyx_f_5spacy_8pipeline_17_parser_internals_7nonproj__lift(__pyx_v_tokenid, __pyx_v_heads, 1); if (unlikely(__pyx_t_1 == ((int)-1) && PyErr_Occurred())) __PYX_ERR(0, 231, __pyx_L1_error) + __pyx_t_2 = __Pyx_PyLong_From_int(__pyx_t_1); if (unlikely(!__pyx_t_2)) __PYX_ERR(0, 231, __pyx_L1_error) + __Pyx_GOTREF(__pyx_t_2); + __pyx_r = __pyx_t_2; + __pyx_t_2 = 0; + goto __pyx_L0; + + /* function exit code */ + __pyx_L1_error:; + __Pyx_XDECREF(__pyx_t_2); + __Pyx_AddTraceback("spacy.pipeline._parser_internals.nonproj._lift", __pyx_clineno, __pyx_lineno, __pyx_filename); + __pyx_r = NULL; + __pyx_L0:; + __Pyx_XGIVEREF(__pyx_r); + __Pyx_RefNannyFinishContext(); + return __pyx_r; +} + +/* "spacy/pipeline/_parser_internals/nonproj.pyx":241 + * + * + * def _find_new_head(token, headlabel): # <<<<<<<<<<<<<< + * # search through the tree starting from the head of the given token + * # returns the id of the first descendant with the given label +*/ + +/* Python wrapper */ +static PyObject *__pyx_pw_5spacy_8pipeline_17_parser_internals_7nonproj_26_find_new_head(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_5spacy_8pipeline_17_parser_internals_7nonproj_25_find_new_head, "_find_new_head(token, headlabel)"); +static PyMethodDef __pyx_mdef_5spacy_8pipeline_17_parser_internals_7nonproj_26_find_new_head = {"_find_new_head", (PyCFunction)(void(*)(void))(__Pyx_PyCFunction_FastCallWithKeywords)__pyx_pw_5spacy_8pipeline_17_parser_internals_7nonproj_26_find_new_head, __Pyx_METH_FASTCALL|METH_KEYWORDS, __pyx_doc_5spacy_8pipeline_17_parser_internals_7nonproj_25_find_new_head}; +static PyObject *__pyx_pw_5spacy_8pipeline_17_parser_internals_7nonproj_26_find_new_head(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 +) { + PyObject *__pyx_v_token = 0; + PyObject *__pyx_v_headlabel = 0; + #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("_find_new_head (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_token,&__pyx_mstate_global->__pyx_n_u_headlabel,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, 241, __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, 241, __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, 241, __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, "_find_new_head", 0) < (0)) __PYX_ERR(0, 241, __pyx_L3_error) + for (Py_ssize_t i = __pyx_nargs; i < 2; i++) { + if (unlikely(!values[i])) { __Pyx_RaiseArgtupleInvalid("_find_new_head", 1, 2, 2, i); __PYX_ERR(0, 241, __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, 241, __pyx_L3_error) + values[1] = __Pyx_ArgRef_FASTCALL(__pyx_args, 1); + if (!CYTHON_ASSUME_SAFE_MACROS && unlikely(!values[1])) __PYX_ERR(0, 241, __pyx_L3_error) + } + __pyx_v_token = values[0]; + __pyx_v_headlabel = values[1]; + } + goto __pyx_L6_skip; + __pyx_L5_argtuple_error:; + __Pyx_RaiseArgtupleInvalid("_find_new_head", 1, 2, 2, __pyx_nargs); __PYX_ERR(0, 241, __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("spacy.pipeline._parser_internals.nonproj._find_new_head", __pyx_clineno, __pyx_lineno, __pyx_filename); + __Pyx_RefNannyFinishContext(); + return NULL; + __pyx_L4_argument_unpacking_done:; + __pyx_r = __pyx_pf_5spacy_8pipeline_17_parser_internals_7nonproj_25_find_new_head(__pyx_self, __pyx_v_token, __pyx_v_headlabel); + + /* 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_5spacy_8pipeline_17_parser_internals_7nonproj_25_find_new_head(CYTHON_UNUSED PyObject *__pyx_self, PyObject *__pyx_v_token, PyObject *__pyx_v_headlabel) { + PyObject *__pyx_v_queue = NULL; + PyObject *__pyx_v_next_queue = NULL; + PyObject *__pyx_v_qtoken = NULL; + PyObject *__pyx_v_child = NULL; + PyObject *__pyx_r = NULL; + __Pyx_RefNannyDeclarations + PyObject *__pyx_t_1 = NULL; + PyObject *__pyx_t_2 = NULL; + int __pyx_t_3; + Py_ssize_t __pyx_t_4; + PyObject *__pyx_t_5 = NULL; + Py_ssize_t __pyx_t_6; + PyObject *(*__pyx_t_7)(PyObject *); + PyObject *__pyx_t_8 = NULL; + int __pyx_t_9; + int __pyx_lineno = 0; + const char *__pyx_filename = NULL; + int __pyx_clineno = 0; + __Pyx_RefNannySetupContext("_find_new_head", 0); + + /* "spacy/pipeline/_parser_internals/nonproj.pyx":245 + * # returns the id of the first descendant with the given label + * # if there is none, return the current head (no change) + * queue = [token.head] # <<<<<<<<<<<<<< + * while queue: + * next_queue = [] +*/ + __pyx_t_1 = __Pyx_PyObject_GetAttrStr(__pyx_v_token, __pyx_mstate_global->__pyx_n_u_head); if (unlikely(!__pyx_t_1)) __PYX_ERR(0, 245, __pyx_L1_error) + __Pyx_GOTREF(__pyx_t_1); + __pyx_t_2 = PyList_New(1); if (unlikely(!__pyx_t_2)) __PYX_ERR(0, 245, __pyx_L1_error) + __Pyx_GOTREF(__pyx_t_2); + __Pyx_GIVEREF(__pyx_t_1); + if (__Pyx_PyList_SET_ITEM(__pyx_t_2, 0, __pyx_t_1) != (0)) __PYX_ERR(0, 245, __pyx_L1_error); + __pyx_t_1 = 0; + __pyx_v_queue = ((PyObject*)__pyx_t_2); + __pyx_t_2 = 0; + + /* "spacy/pipeline/_parser_internals/nonproj.pyx":246 + * # if there is none, return the current head (no change) + * queue = [token.head] + * while queue: # <<<<<<<<<<<<<< + * next_queue = [] + * for qtoken in queue: +*/ + while (1) { + { + Py_ssize_t __pyx_temp = __Pyx_PyList_GET_SIZE(__pyx_v_queue); + if (unlikely(((!CYTHON_ASSUME_SAFE_SIZE) && __pyx_temp < 0))) __PYX_ERR(0, 246, __pyx_L1_error) + __pyx_t_3 = (__pyx_temp != 0); + } + + if (!__pyx_t_3) break; + + /* "spacy/pipeline/_parser_internals/nonproj.pyx":247 + * queue = [token.head] + * while queue: + * next_queue = [] # <<<<<<<<<<<<<< + * for qtoken in queue: + * for child in qtoken.children: +*/ + __pyx_t_2 = PyList_New(0); if (unlikely(!__pyx_t_2)) __PYX_ERR(0, 247, __pyx_L1_error) + __Pyx_GOTREF(__pyx_t_2); + __Pyx_XDECREF_SET(__pyx_v_next_queue, ((PyObject*)__pyx_t_2)); + __pyx_t_2 = 0; + + /* "spacy/pipeline/_parser_internals/nonproj.pyx":248 + * while queue: + * next_queue = [] + * for qtoken in queue: # <<<<<<<<<<<<<< + * for child in qtoken.children: + * if child.is_space: +*/ + __pyx_t_2 = __pyx_v_queue; __Pyx_INCREF(__pyx_t_2); + __pyx_t_4 = 0; + for (;;) { + { + Py_ssize_t __pyx_temp = __Pyx_PyList_GET_SIZE(__pyx_t_2); + #if !CYTHON_ASSUME_SAFE_SIZE + if (unlikely((__pyx_temp < 0))) __PYX_ERR(0, 248, __pyx_L1_error) + #endif + if (__pyx_t_4 >= __pyx_temp) break; + } + __pyx_t_1 = __Pyx_PyList_GetItemRefFast(__pyx_t_2, __pyx_t_4, __Pyx_ReferenceSharing_OwnStrongReference); + ++__pyx_t_4; + if (unlikely(!__pyx_t_1)) __PYX_ERR(0, 248, __pyx_L1_error) + __Pyx_GOTREF(__pyx_t_1); + __Pyx_XDECREF_SET(__pyx_v_qtoken, __pyx_t_1); + __pyx_t_1 = 0; + + /* "spacy/pipeline/_parser_internals/nonproj.pyx":249 + * next_queue = [] + * for qtoken in queue: + * for child in qtoken.children: # <<<<<<<<<<<<<< + * if child.is_space: + * continue +*/ + __pyx_t_1 = __Pyx_PyObject_GetAttrStr(__pyx_v_qtoken, __pyx_mstate_global->__pyx_n_u_children); if (unlikely(!__pyx_t_1)) __PYX_ERR(0, 249, __pyx_L1_error) + __Pyx_GOTREF(__pyx_t_1); + if (likely(PyList_CheckExact(__pyx_t_1)) || PyTuple_CheckExact(__pyx_t_1)) { + __pyx_t_5 = __pyx_t_1; __Pyx_INCREF(__pyx_t_5); + __pyx_t_6 = 0; + __pyx_t_7 = NULL; + } else { + __pyx_t_6 = -1; __pyx_t_5 = PyObject_GetIter(__pyx_t_1); if (unlikely(!__pyx_t_5)) __PYX_ERR(0, 249, __pyx_L1_error) + __Pyx_GOTREF(__pyx_t_5); + __pyx_t_7 = (CYTHON_COMPILING_IN_LIMITED_API) ? PyIter_Next : __Pyx_PyObject_GetIterNextFunc(__pyx_t_5); if (unlikely(!__pyx_t_7)) __PYX_ERR(0, 249, __pyx_L1_error) + } + __Pyx_DECREF(__pyx_t_1); __pyx_t_1 = 0; + for (;;) { + if (likely(!__pyx_t_7)) { + if (likely(PyList_CheckExact(__pyx_t_5))) { + { + Py_ssize_t __pyx_temp = __Pyx_PyList_GET_SIZE(__pyx_t_5); + #if !CYTHON_ASSUME_SAFE_SIZE + if (unlikely((__pyx_temp < 0))) __PYX_ERR(0, 249, __pyx_L1_error) + #endif + if (__pyx_t_6 >= __pyx_temp) break; + } + __pyx_t_1 = __Pyx_PyList_GetItemRefFast(__pyx_t_5, __pyx_t_6, __Pyx_ReferenceSharing_OwnStrongReference); + ++__pyx_t_6; + } else { + { + Py_ssize_t __pyx_temp = __Pyx_PyTuple_GET_SIZE(__pyx_t_5); + #if !CYTHON_ASSUME_SAFE_SIZE + if (unlikely((__pyx_temp < 0))) __PYX_ERR(0, 249, __pyx_L1_error) + #endif + if (__pyx_t_6 >= __pyx_temp) break; + } + #if CYTHON_ASSUME_SAFE_MACROS && !CYTHON_AVOID_BORROWED_REFS + __pyx_t_1 = __Pyx_NewRef(PyTuple_GET_ITEM(__pyx_t_5, __pyx_t_6)); + #else + __pyx_t_1 = __Pyx_PySequence_ITEM(__pyx_t_5, __pyx_t_6); + #endif + ++__pyx_t_6; + } + if (unlikely(!__pyx_t_1)) __PYX_ERR(0, 249, __pyx_L1_error) + } else { + __pyx_t_1 = __pyx_t_7(__pyx_t_5); + if (unlikely(!__pyx_t_1)) { + PyObject* exc_type = PyErr_Occurred(); + if (exc_type) { + if (unlikely(!__Pyx_PyErr_GivenExceptionMatches(exc_type, PyExc_StopIteration))) __PYX_ERR(0, 249, __pyx_L1_error) + PyErr_Clear(); + } + break; + } + } + __Pyx_GOTREF(__pyx_t_1); + __Pyx_XDECREF_SET(__pyx_v_child, __pyx_t_1); + __pyx_t_1 = 0; + + /* "spacy/pipeline/_parser_internals/nonproj.pyx":250 + * for qtoken in queue: + * for child in qtoken.children: + * if child.is_space: # <<<<<<<<<<<<<< + * continue + * if child == token: +*/ + __pyx_t_1 = __Pyx_PyObject_GetAttrStr(__pyx_v_child, __pyx_mstate_global->__pyx_n_u_is_space); if (unlikely(!__pyx_t_1)) __PYX_ERR(0, 250, __pyx_L1_error) + __Pyx_GOTREF(__pyx_t_1); + __pyx_t_3 = __Pyx_PyObject_IsTrue(__pyx_t_1); if (unlikely((__pyx_t_3 < 0))) __PYX_ERR(0, 250, __pyx_L1_error) + __Pyx_DECREF(__pyx_t_1); __pyx_t_1 = 0; + if (__pyx_t_3) { + + /* "spacy/pipeline/_parser_internals/nonproj.pyx":251 + * for child in qtoken.children: + * if child.is_space: + * continue # <<<<<<<<<<<<<< + * if child == token: + * continue +*/ + goto __pyx_L7_continue; + + /* "spacy/pipeline/_parser_internals/nonproj.pyx":250 + * for qtoken in queue: + * for child in qtoken.children: + * if child.is_space: # <<<<<<<<<<<<<< + * continue + * if child == token: +*/ + } + + /* "spacy/pipeline/_parser_internals/nonproj.pyx":252 + * if child.is_space: + * continue + * if child == token: # <<<<<<<<<<<<<< + * continue + * if child.dep_ == headlabel: +*/ + __pyx_t_1 = PyObject_RichCompare(__pyx_v_child, __pyx_v_token, Py_EQ); __Pyx_XGOTREF(__pyx_t_1); if (unlikely(!__pyx_t_1)) __PYX_ERR(0, 252, __pyx_L1_error) + __pyx_t_3 = __Pyx_PyObject_IsTrue(__pyx_t_1); if (unlikely((__pyx_t_3 < 0))) __PYX_ERR(0, 252, __pyx_L1_error) + __Pyx_DECREF(__pyx_t_1); __pyx_t_1 = 0; + if (__pyx_t_3) { + + /* "spacy/pipeline/_parser_internals/nonproj.pyx":253 + * continue + * if child == token: + * continue # <<<<<<<<<<<<<< + * if child.dep_ == headlabel: + * return child +*/ + goto __pyx_L7_continue; + + /* "spacy/pipeline/_parser_internals/nonproj.pyx":252 + * if child.is_space: + * continue + * if child == token: # <<<<<<<<<<<<<< + * continue + * if child.dep_ == headlabel: +*/ + } + + /* "spacy/pipeline/_parser_internals/nonproj.pyx":254 + * if child == token: + * continue + * if child.dep_ == headlabel: # <<<<<<<<<<<<<< + * return child + * next_queue.append(child) +*/ + __pyx_t_1 = __Pyx_PyObject_GetAttrStr(__pyx_v_child, __pyx_mstate_global->__pyx_n_u_dep); if (unlikely(!__pyx_t_1)) __PYX_ERR(0, 254, __pyx_L1_error) + __Pyx_GOTREF(__pyx_t_1); + __pyx_t_8 = PyObject_RichCompare(__pyx_t_1, __pyx_v_headlabel, Py_EQ); __Pyx_XGOTREF(__pyx_t_8); if (unlikely(!__pyx_t_8)) __PYX_ERR(0, 254, __pyx_L1_error) + __Pyx_DECREF(__pyx_t_1); __pyx_t_1 = 0; + __pyx_t_3 = __Pyx_PyObject_IsTrue(__pyx_t_8); if (unlikely((__pyx_t_3 < 0))) __PYX_ERR(0, 254, __pyx_L1_error) + __Pyx_DECREF(__pyx_t_8); __pyx_t_8 = 0; + if (__pyx_t_3) { + + /* "spacy/pipeline/_parser_internals/nonproj.pyx":255 + * continue + * if child.dep_ == headlabel: + * return child # <<<<<<<<<<<<<< + * next_queue.append(child) + * queue = next_queue +*/ + __Pyx_XDECREF(__pyx_r); + __Pyx_INCREF(__pyx_v_child); + __pyx_r = __pyx_v_child; + __Pyx_DECREF(__pyx_t_2); __pyx_t_2 = 0; + __Pyx_DECREF(__pyx_t_5); __pyx_t_5 = 0; + goto __pyx_L0; + + /* "spacy/pipeline/_parser_internals/nonproj.pyx":254 + * if child == token: + * continue + * if child.dep_ == headlabel: # <<<<<<<<<<<<<< + * return child + * next_queue.append(child) +*/ + } + + /* "spacy/pipeline/_parser_internals/nonproj.pyx":256 + * if child.dep_ == headlabel: + * return child + * next_queue.append(child) # <<<<<<<<<<<<<< + * queue = next_queue + * return token.head +*/ + __pyx_t_9 = __Pyx_PyList_Append(__pyx_v_next_queue, __pyx_v_child); if (unlikely(__pyx_t_9 == ((int)-1))) __PYX_ERR(0, 256, __pyx_L1_error) + + /* "spacy/pipeline/_parser_internals/nonproj.pyx":249 + * next_queue = [] + * for qtoken in queue: + * for child in qtoken.children: # <<<<<<<<<<<<<< + * if child.is_space: + * continue +*/ + __pyx_L7_continue:; + } + __Pyx_DECREF(__pyx_t_5); __pyx_t_5 = 0; + + /* "spacy/pipeline/_parser_internals/nonproj.pyx":248 + * while queue: + * next_queue = [] + * for qtoken in queue: # <<<<<<<<<<<<<< + * for child in qtoken.children: + * if child.is_space: +*/ + } + __Pyx_DECREF(__pyx_t_2); __pyx_t_2 = 0; + + /* "spacy/pipeline/_parser_internals/nonproj.pyx":257 + * return child + * next_queue.append(child) + * queue = next_queue # <<<<<<<<<<<<<< + * return token.head +*/ + __Pyx_INCREF(__pyx_v_next_queue); + __Pyx_DECREF_SET(__pyx_v_queue, __pyx_v_next_queue); + } + + /* "spacy/pipeline/_parser_internals/nonproj.pyx":258 + * next_queue.append(child) + * queue = next_queue + * return token.head # <<<<<<<<<<<<<< +*/ + __Pyx_XDECREF(__pyx_r); + __pyx_t_2 = __Pyx_PyObject_GetAttrStr(__pyx_v_token, __pyx_mstate_global->__pyx_n_u_head); if (unlikely(!__pyx_t_2)) __PYX_ERR(0, 258, __pyx_L1_error) + __Pyx_GOTREF(__pyx_t_2); + __pyx_r = __pyx_t_2; + __pyx_t_2 = 0; + goto __pyx_L0; + + /* "spacy/pipeline/_parser_internals/nonproj.pyx":241 + * + * + * def _find_new_head(token, headlabel): # <<<<<<<<<<<<<< + * # search through the tree starting from the head of the given token + * # returns the id of the first descendant with the given label +*/ + + /* function exit code */ + __pyx_L1_error:; + __Pyx_XDECREF(__pyx_t_1); + __Pyx_XDECREF(__pyx_t_2); + __Pyx_XDECREF(__pyx_t_5); + __Pyx_XDECREF(__pyx_t_8); + __Pyx_AddTraceback("spacy.pipeline._parser_internals.nonproj._find_new_head", __pyx_clineno, __pyx_lineno, __pyx_filename); + __pyx_r = NULL; + __pyx_L0:; + __Pyx_XDECREF(__pyx_v_queue); + __Pyx_XDECREF(__pyx_v_next_queue); + __Pyx_XDECREF(__pyx_v_qtoken); + __Pyx_XDECREF(__pyx_v_child); + __Pyx_XGIVEREF(__pyx_r); + __Pyx_RefNannyFinishContext(); + return __pyx_r; +} +/* #### Code section: module_exttypes ### */ + +static PyObject *__pyx_tp_new_5spacy_8pipeline_17_parser_internals_7nonproj___pyx_scope_struct__ancestors(PyTypeObject *t, CYTHON_UNUSED PyObject *a, CYTHON_UNUSED PyObject *k) { + PyObject *o; + #if CYTHON_USE_FREELISTS + if (likely((int)(__pyx_mstate_global->__pyx_freecount_5spacy_8pipeline_17_parser_internals_7nonproj___pyx_scope_struct__ancestors > 0) & __PYX_CHECK_FINAL_TYPE_FOR_FREELISTS(t, __pyx_mstate_global->__pyx_ptype_5spacy_8pipeline_17_parser_internals_7nonproj___pyx_scope_struct__ancestors, sizeof(struct __pyx_obj_5spacy_8pipeline_17_parser_internals_7nonproj___pyx_scope_struct__ancestors)))) + { + o = (PyObject*)__pyx_mstate_global->__pyx_freelist_5spacy_8pipeline_17_parser_internals_7nonproj___pyx_scope_struct__ancestors[--__pyx_mstate_global->__pyx_freecount_5spacy_8pipeline_17_parser_internals_7nonproj___pyx_scope_struct__ancestors]; + #if CYTHON_USE_TYPE_SPECS + Py_DECREF(Py_TYPE(o)); + #endif + memset(o, 0, sizeof(struct __pyx_obj_5spacy_8pipeline_17_parser_internals_7nonproj___pyx_scope_struct__ancestors)); + #if CYTHON_COMPILING_IN_LIMITED_API + (void) PyObject_Init(o, t); + #else + (void) PyObject_INIT(o, t); + #endif + PyObject_GC_Track(o); + } else + #endif + { + o = __Pyx_AllocateExtensionType(t, 1); + if (unlikely(!o)) return 0; + } + return o; +} + +static void __pyx_tp_dealloc_5spacy_8pipeline_17_parser_internals_7nonproj___pyx_scope_struct__ancestors(PyObject *o) { + struct __pyx_obj_5spacy_8pipeline_17_parser_internals_7nonproj___pyx_scope_struct__ancestors *p = (struct __pyx_obj_5spacy_8pipeline_17_parser_internals_7nonproj___pyx_scope_struct__ancestors *)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_5spacy_8pipeline_17_parser_internals_7nonproj___pyx_scope_struct__ancestors) { + if (PyObject_CallFinalizerFromDealloc(o)) return; + } + } + #endif + PyObject_GC_UnTrack(o); + Py_CLEAR(p->__pyx_v_head); + Py_CLEAR(p->__pyx_v_heads); + Py_CLEAR(p->__pyx_v_tokenid); + #if CYTHON_USE_FREELISTS + if (likely((int)(__pyx_mstate_global->__pyx_freecount_5spacy_8pipeline_17_parser_internals_7nonproj___pyx_scope_struct__ancestors < 8) & __PYX_CHECK_FINAL_TYPE_FOR_FREELISTS(Py_TYPE(o), __pyx_mstate_global->__pyx_ptype_5spacy_8pipeline_17_parser_internals_7nonproj___pyx_scope_struct__ancestors, sizeof(struct __pyx_obj_5spacy_8pipeline_17_parser_internals_7nonproj___pyx_scope_struct__ancestors)))) + { + __pyx_mstate_global->__pyx_freelist_5spacy_8pipeline_17_parser_internals_7nonproj___pyx_scope_struct__ancestors[__pyx_mstate_global->__pyx_freecount_5spacy_8pipeline_17_parser_internals_7nonproj___pyx_scope_struct__ancestors++] = ((struct __pyx_obj_5spacy_8pipeline_17_parser_internals_7nonproj___pyx_scope_struct__ancestors *)o); + } else + #endif + { + 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_5spacy_8pipeline_17_parser_internals_7nonproj___pyx_scope_struct__ancestors(PyObject *o, visitproc v, void *a) { + int e; + struct __pyx_obj_5spacy_8pipeline_17_parser_internals_7nonproj___pyx_scope_struct__ancestors *p = (struct __pyx_obj_5spacy_8pipeline_17_parser_internals_7nonproj___pyx_scope_struct__ancestors *)o; + { + e = __Pyx_call_type_traverse(o, 1, v, a); + if (e) return e; + } + if (p->__pyx_v_head) { + e = (*v)(p->__pyx_v_head, a); if (e) return e; + } + if (p->__pyx_v_heads) { + e = (*v)(p->__pyx_v_heads, a); if (e) return e; + } + if (p->__pyx_v_tokenid) { + e = (*v)(p->__pyx_v_tokenid, a); if (e) return e; + } + return 0; +} +#if CYTHON_USE_TYPE_SPECS +static PyType_Slot __pyx_type_5spacy_8pipeline_17_parser_internals_7nonproj___pyx_scope_struct__ancestors_slots[] = { + {Py_tp_dealloc, (void *)__pyx_tp_dealloc_5spacy_8pipeline_17_parser_internals_7nonproj___pyx_scope_struct__ancestors}, + {Py_tp_traverse, (void *)__pyx_tp_traverse_5spacy_8pipeline_17_parser_internals_7nonproj___pyx_scope_struct__ancestors}, + {Py_tp_new, (void *)__pyx_tp_new_5spacy_8pipeline_17_parser_internals_7nonproj___pyx_scope_struct__ancestors}, + {0, 0}, +}; +static PyType_Spec __pyx_type_5spacy_8pipeline_17_parser_internals_7nonproj___pyx_scope_struct__ancestors_spec = { + "spacy.pipeline._parser_internals.nonproj.__pyx_scope_struct__ancestors", + sizeof(struct __pyx_obj_5spacy_8pipeline_17_parser_internals_7nonproj___pyx_scope_struct__ancestors), + 0, + Py_TPFLAGS_DEFAULT|Py_TPFLAGS_HAVE_VERSION_TAG|Py_TPFLAGS_CHECKTYPES|Py_TPFLAGS_HAVE_NEWBUFFER|Py_TPFLAGS_HAVE_GC, + __pyx_type_5spacy_8pipeline_17_parser_internals_7nonproj___pyx_scope_struct__ancestors_slots, +}; +#else + +static PyTypeObject __pyx_type_5spacy_8pipeline_17_parser_internals_7nonproj___pyx_scope_struct__ancestors = { + PyVarObject_HEAD_INIT(0, 0) + "spacy.pipeline._parser_internals.nonproj.""__pyx_scope_struct__ancestors", /*tp_name*/ + sizeof(struct __pyx_obj_5spacy_8pipeline_17_parser_internals_7nonproj___pyx_scope_struct__ancestors), /*tp_basicsize*/ + 0, /*tp_itemsize*/ + __pyx_tp_dealloc_5spacy_8pipeline_17_parser_internals_7nonproj___pyx_scope_struct__ancestors, /*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_HAVE_GC, /*tp_flags*/ + 0, /*tp_doc*/ + __pyx_tp_traverse_5spacy_8pipeline_17_parser_internals_7nonproj___pyx_scope_struct__ancestors, /*tp_traverse*/ + 0, /*tp_clear*/ + 0, /*tp_richcompare*/ + 0, /*tp_weaklistoffset*/ + 0, /*tp_iter*/ + 0, /*tp_iternext*/ + 0, /*tp_methods*/ + 0, /*tp_members*/ + 0, /*tp_getset*/ + 0, /*tp_base*/ + 0, /*tp_dict*/ + 0, /*tp_descr_get*/ + 0, /*tp_descr_set*/ + #if !CYTHON_USE_TYPE_SPECS + 0, /*tp_dictoffset*/ + #endif + 0, /*tp_init*/ + 0, /*tp_alloc*/ + __pyx_tp_new_5spacy_8pipeline_17_parser_internals_7nonproj___pyx_scope_struct__ancestors, /*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_5spacy_8pipeline_17_parser_internals_7nonproj___pyx_scope_struct_1_is_nonproj_tree(PyTypeObject *t, CYTHON_UNUSED PyObject *a, CYTHON_UNUSED PyObject *k) { + struct __pyx_obj_5spacy_8pipeline_17_parser_internals_7nonproj___pyx_scope_struct_1_is_nonproj_tree *p; + PyObject *o; + #if CYTHON_USE_FREELISTS + if (likely((int)(__pyx_mstate_global->__pyx_freecount_5spacy_8pipeline_17_parser_internals_7nonproj___pyx_scope_struct_1_is_nonproj_tree > 0) & __PYX_CHECK_FINAL_TYPE_FOR_FREELISTS(t, __pyx_mstate_global->__pyx_ptype_5spacy_8pipeline_17_parser_internals_7nonproj___pyx_scope_struct_1_is_nonproj_tree, sizeof(struct __pyx_obj_5spacy_8pipeline_17_parser_internals_7nonproj___pyx_scope_struct_1_is_nonproj_tree)))) + { + o = (PyObject*)__pyx_mstate_global->__pyx_freelist_5spacy_8pipeline_17_parser_internals_7nonproj___pyx_scope_struct_1_is_nonproj_tree[--__pyx_mstate_global->__pyx_freecount_5spacy_8pipeline_17_parser_internals_7nonproj___pyx_scope_struct_1_is_nonproj_tree]; + #if CYTHON_USE_TYPE_SPECS + Py_DECREF(Py_TYPE(o)); + #endif + memset(o, 0, sizeof(struct __pyx_obj_5spacy_8pipeline_17_parser_internals_7nonproj___pyx_scope_struct_1_is_nonproj_tree)); + #if CYTHON_COMPILING_IN_LIMITED_API + (void) PyObject_Init(o, t); + #else + (void) PyObject_INIT(o, t); + #endif + } else + #endif + { + o = __Pyx_AllocateExtensionType(t, 1); + if (unlikely(!o)) return 0; + } + p = ((struct __pyx_obj_5spacy_8pipeline_17_parser_internals_7nonproj___pyx_scope_struct_1_is_nonproj_tree *)o); + __Pyx_default_placement_construct(&(p->__pyx_v_c_heads)); + return o; +} + +static void __pyx_tp_dealloc_5spacy_8pipeline_17_parser_internals_7nonproj___pyx_scope_struct_1_is_nonproj_tree(PyObject *o) { + struct __pyx_obj_5spacy_8pipeline_17_parser_internals_7nonproj___pyx_scope_struct_1_is_nonproj_tree *p = (struct __pyx_obj_5spacy_8pipeline_17_parser_internals_7nonproj___pyx_scope_struct_1_is_nonproj_tree *)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_5spacy_8pipeline_17_parser_internals_7nonproj___pyx_scope_struct_1_is_nonproj_tree) { + if (PyObject_CallFinalizerFromDealloc(o)) return; + } + } + #endif + __Pyx_call_destructor(p->__pyx_v_c_heads); + #if CYTHON_USE_FREELISTS + if (likely((int)(__pyx_mstate_global->__pyx_freecount_5spacy_8pipeline_17_parser_internals_7nonproj___pyx_scope_struct_1_is_nonproj_tree < 8) & __PYX_CHECK_FINAL_TYPE_FOR_FREELISTS(Py_TYPE(o), __pyx_mstate_global->__pyx_ptype_5spacy_8pipeline_17_parser_internals_7nonproj___pyx_scope_struct_1_is_nonproj_tree, sizeof(struct __pyx_obj_5spacy_8pipeline_17_parser_internals_7nonproj___pyx_scope_struct_1_is_nonproj_tree)))) + { + __pyx_mstate_global->__pyx_freelist_5spacy_8pipeline_17_parser_internals_7nonproj___pyx_scope_struct_1_is_nonproj_tree[__pyx_mstate_global->__pyx_freecount_5spacy_8pipeline_17_parser_internals_7nonproj___pyx_scope_struct_1_is_nonproj_tree++] = ((struct __pyx_obj_5spacy_8pipeline_17_parser_internals_7nonproj___pyx_scope_struct_1_is_nonproj_tree *)o); + } else + #endif + { + 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 + } +} +#if CYTHON_USE_TYPE_SPECS +static PyType_Slot __pyx_type_5spacy_8pipeline_17_parser_internals_7nonproj___pyx_scope_struct_1_is_nonproj_tree_slots[] = { + {Py_tp_dealloc, (void *)__pyx_tp_dealloc_5spacy_8pipeline_17_parser_internals_7nonproj___pyx_scope_struct_1_is_nonproj_tree}, + {Py_tp_new, (void *)__pyx_tp_new_5spacy_8pipeline_17_parser_internals_7nonproj___pyx_scope_struct_1_is_nonproj_tree}, + {0, 0}, +}; +static PyType_Spec __pyx_type_5spacy_8pipeline_17_parser_internals_7nonproj___pyx_scope_struct_1_is_nonproj_tree_spec = { + "spacy.pipeline._parser_internals.nonproj.__pyx_scope_struct_1_is_nonproj_tree", + sizeof(struct __pyx_obj_5spacy_8pipeline_17_parser_internals_7nonproj___pyx_scope_struct_1_is_nonproj_tree), + 0, + Py_TPFLAGS_DEFAULT|Py_TPFLAGS_HAVE_VERSION_TAG|Py_TPFLAGS_CHECKTYPES|Py_TPFLAGS_HAVE_NEWBUFFER, + __pyx_type_5spacy_8pipeline_17_parser_internals_7nonproj___pyx_scope_struct_1_is_nonproj_tree_slots, +}; +#else + +static PyTypeObject __pyx_type_5spacy_8pipeline_17_parser_internals_7nonproj___pyx_scope_struct_1_is_nonproj_tree = { + PyVarObject_HEAD_INIT(0, 0) + "spacy.pipeline._parser_internals.nonproj.""__pyx_scope_struct_1_is_nonproj_tree", /*tp_name*/ + sizeof(struct __pyx_obj_5spacy_8pipeline_17_parser_internals_7nonproj___pyx_scope_struct_1_is_nonproj_tree), /*tp_basicsize*/ + 0, /*tp_itemsize*/ + __pyx_tp_dealloc_5spacy_8pipeline_17_parser_internals_7nonproj___pyx_scope_struct_1_is_nonproj_tree, /*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, /*tp_flags*/ + 0, /*tp_doc*/ + 0, /*tp_traverse*/ + 0, /*tp_clear*/ + 0, /*tp_richcompare*/ + 0, /*tp_weaklistoffset*/ + 0, /*tp_iter*/ + 0, /*tp_iternext*/ + 0, /*tp_methods*/ + 0, /*tp_members*/ + 0, /*tp_getset*/ + 0, /*tp_base*/ + 0, /*tp_dict*/ + 0, /*tp_descr_get*/ + 0, /*tp_descr_set*/ + #if !CYTHON_USE_TYPE_SPECS + 0, /*tp_dictoffset*/ + #endif + 0, /*tp_init*/ + 0, /*tp_alloc*/ + __pyx_tp_new_5spacy_8pipeline_17_parser_internals_7nonproj___pyx_scope_struct_1_is_nonproj_tree, /*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_5spacy_8pipeline_17_parser_internals_7nonproj___pyx_scope_struct_2_genexpr(PyTypeObject *t, CYTHON_UNUSED PyObject *a, CYTHON_UNUSED PyObject *k) { + PyObject *o; + #if CYTHON_USE_FREELISTS + if (likely((int)(__pyx_mstate_global->__pyx_freecount_5spacy_8pipeline_17_parser_internals_7nonproj___pyx_scope_struct_2_genexpr > 0) & __PYX_CHECK_FINAL_TYPE_FOR_FREELISTS(t, __pyx_mstate_global->__pyx_ptype_5spacy_8pipeline_17_parser_internals_7nonproj___pyx_scope_struct_2_genexpr, sizeof(struct __pyx_obj_5spacy_8pipeline_17_parser_internals_7nonproj___pyx_scope_struct_2_genexpr)))) + { + o = (PyObject*)__pyx_mstate_global->__pyx_freelist_5spacy_8pipeline_17_parser_internals_7nonproj___pyx_scope_struct_2_genexpr[--__pyx_mstate_global->__pyx_freecount_5spacy_8pipeline_17_parser_internals_7nonproj___pyx_scope_struct_2_genexpr]; + #if CYTHON_USE_TYPE_SPECS + Py_DECREF(Py_TYPE(o)); + #endif + memset(o, 0, sizeof(struct __pyx_obj_5spacy_8pipeline_17_parser_internals_7nonproj___pyx_scope_struct_2_genexpr)); + #if CYTHON_COMPILING_IN_LIMITED_API + (void) PyObject_Init(o, t); + #else + (void) PyObject_INIT(o, t); + #endif + PyObject_GC_Track(o); + } else + #endif + { + o = __Pyx_AllocateExtensionType(t, 1); + if (unlikely(!o)) return 0; + } + return o; +} + +static void __pyx_tp_dealloc_5spacy_8pipeline_17_parser_internals_7nonproj___pyx_scope_struct_2_genexpr(PyObject *o) { + struct __pyx_obj_5spacy_8pipeline_17_parser_internals_7nonproj___pyx_scope_struct_2_genexpr *p = (struct __pyx_obj_5spacy_8pipeline_17_parser_internals_7nonproj___pyx_scope_struct_2_genexpr *)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_5spacy_8pipeline_17_parser_internals_7nonproj___pyx_scope_struct_2_genexpr) { + if (PyObject_CallFinalizerFromDealloc(o)) return; + } + } + #endif + PyObject_GC_UnTrack(o); + Py_CLEAR(p->__pyx_outer_scope); + #if CYTHON_USE_FREELISTS + if (likely((int)(__pyx_mstate_global->__pyx_freecount_5spacy_8pipeline_17_parser_internals_7nonproj___pyx_scope_struct_2_genexpr < 8) & __PYX_CHECK_FINAL_TYPE_FOR_FREELISTS(Py_TYPE(o), __pyx_mstate_global->__pyx_ptype_5spacy_8pipeline_17_parser_internals_7nonproj___pyx_scope_struct_2_genexpr, sizeof(struct __pyx_obj_5spacy_8pipeline_17_parser_internals_7nonproj___pyx_scope_struct_2_genexpr)))) + { + __pyx_mstate_global->__pyx_freelist_5spacy_8pipeline_17_parser_internals_7nonproj___pyx_scope_struct_2_genexpr[__pyx_mstate_global->__pyx_freecount_5spacy_8pipeline_17_parser_internals_7nonproj___pyx_scope_struct_2_genexpr++] = ((struct __pyx_obj_5spacy_8pipeline_17_parser_internals_7nonproj___pyx_scope_struct_2_genexpr *)o); + } else + #endif + { + 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_5spacy_8pipeline_17_parser_internals_7nonproj___pyx_scope_struct_2_genexpr(PyObject *o, visitproc v, void *a) { + int e; + struct __pyx_obj_5spacy_8pipeline_17_parser_internals_7nonproj___pyx_scope_struct_2_genexpr *p = (struct __pyx_obj_5spacy_8pipeline_17_parser_internals_7nonproj___pyx_scope_struct_2_genexpr *)o; + { + e = __Pyx_call_type_traverse(o, 1, v, a); + if (e) return e; + } + if (p->__pyx_outer_scope) { + e = (*v)(((PyObject *)p->__pyx_outer_scope), a); if (e) return e; + } + return 0; +} +#if CYTHON_USE_TYPE_SPECS +static PyType_Slot __pyx_type_5spacy_8pipeline_17_parser_internals_7nonproj___pyx_scope_struct_2_genexpr_slots[] = { + {Py_tp_dealloc, (void *)__pyx_tp_dealloc_5spacy_8pipeline_17_parser_internals_7nonproj___pyx_scope_struct_2_genexpr}, + {Py_tp_traverse, (void *)__pyx_tp_traverse_5spacy_8pipeline_17_parser_internals_7nonproj___pyx_scope_struct_2_genexpr}, + {Py_tp_new, (void *)__pyx_tp_new_5spacy_8pipeline_17_parser_internals_7nonproj___pyx_scope_struct_2_genexpr}, + {0, 0}, +}; +static PyType_Spec __pyx_type_5spacy_8pipeline_17_parser_internals_7nonproj___pyx_scope_struct_2_genexpr_spec = { + "spacy.pipeline._parser_internals.nonproj.__pyx_scope_struct_2_genexpr", + sizeof(struct __pyx_obj_5spacy_8pipeline_17_parser_internals_7nonproj___pyx_scope_struct_2_genexpr), + 0, + Py_TPFLAGS_DEFAULT|Py_TPFLAGS_HAVE_VERSION_TAG|Py_TPFLAGS_CHECKTYPES|Py_TPFLAGS_HAVE_NEWBUFFER|Py_TPFLAGS_HAVE_GC, + __pyx_type_5spacy_8pipeline_17_parser_internals_7nonproj___pyx_scope_struct_2_genexpr_slots, +}; +#else + +static PyTypeObject __pyx_type_5spacy_8pipeline_17_parser_internals_7nonproj___pyx_scope_struct_2_genexpr = { + PyVarObject_HEAD_INIT(0, 0) + "spacy.pipeline._parser_internals.nonproj.""__pyx_scope_struct_2_genexpr", /*tp_name*/ + sizeof(struct __pyx_obj_5spacy_8pipeline_17_parser_internals_7nonproj___pyx_scope_struct_2_genexpr), /*tp_basicsize*/ + 0, /*tp_itemsize*/ + __pyx_tp_dealloc_5spacy_8pipeline_17_parser_internals_7nonproj___pyx_scope_struct_2_genexpr, /*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_HAVE_GC, /*tp_flags*/ + 0, /*tp_doc*/ + __pyx_tp_traverse_5spacy_8pipeline_17_parser_internals_7nonproj___pyx_scope_struct_2_genexpr, /*tp_traverse*/ + 0, /*tp_clear*/ + 0, /*tp_richcompare*/ + 0, /*tp_weaklistoffset*/ + 0, /*tp_iter*/ + 0, /*tp_iternext*/ + 0, /*tp_methods*/ + 0, /*tp_members*/ + 0, /*tp_getset*/ + 0, /*tp_base*/ + 0, /*tp_dict*/ + 0, /*tp_descr_get*/ + 0, /*tp_descr_set*/ + #if !CYTHON_USE_TYPE_SPECS + 0, /*tp_dictoffset*/ + #endif + 0, /*tp_init*/ + 0, /*tp_alloc*/ + __pyx_tp_new_5spacy_8pipeline_17_parser_internals_7nonproj___pyx_scope_struct_2_genexpr, /*tp_new*/ + 0, /*tp_free*/ + 0, /*tp_is_gc*/ + 0, /*tp_bases*/ + 0, /*tp_mro*/ + 0, /*tp_cache*/ + 0, /*tp_subclasses*/ + 0, /*tp_weaklist*/ + 0, /*tp_del*/ + 0, /*tp_version_tag*/ + #if 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 struct __pyx_vtabstruct_array __pyx_vtable_array; + +static PyObject *__pyx_tp_new_array(PyTypeObject *t, PyObject *a, PyObject *k) { + struct __pyx_array_obj *p; + PyObject *o; + o = __Pyx_AllocateExtensionType(t, 0); + if (unlikely(!o)) return 0; + p = ((struct __pyx_array_obj *)o); + p->__pyx_vtab = __pyx_vtabptr_array; + p->mode = ((PyObject*)Py_None); Py_INCREF(Py_None); + p->_format = ((PyObject*)Py_None); Py_INCREF(Py_None); + if (unlikely(__pyx_array___cinit__(o, a, k) < 0)) goto bad; + return o; + bad: + Py_DECREF(o); o = 0; + return NULL; +} + +static void __pyx_tp_dealloc_array(PyObject *o) { + struct __pyx_array_obj *p = (struct __pyx_array_obj *)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_array) { + if (PyObject_CallFinalizerFromDealloc(o)) return; + } + } + #endif + { + PyObject *etype, *eval, *etb; + PyErr_Fetch(&etype, &eval, &etb); + __Pyx_SET_REFCNT(o, Py_REFCNT(o) + 1); + __pyx_array___dealloc__(o); + __Pyx_SET_REFCNT(o, Py_REFCNT(o) - 1); + PyErr_Restore(etype, eval, etb); + } + Py_CLEAR(p->mode); + Py_CLEAR(p->_format); + 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 PyObject *__pyx_sq_item_array(PyObject *o, Py_ssize_t i) { + PyObject *r; + PyObject *x = PyLong_FromSsize_t(i); if(!x) return 0; + #if CYTHON_USE_TYPE_SLOTS || (!CYTHON_USE_TYPE_SPECS && __PYX_LIMITED_VERSION_HEX < 0x030A0000) + r = Py_TYPE(o)->tp_as_mapping->mp_subscript(o, x); + #else + r = ((binaryfunc)PyType_GetSlot(Py_TYPE(o), Py_mp_subscript))(o, x); + #endif + Py_DECREF(x); + return r; +} + +static int __pyx_mp_ass_subscript_array(PyObject *o, PyObject *i, PyObject *v) { + if (v) { + return __pyx_array___setitem__(o, i, v); + } + else { + __Pyx_TypeName o_type_name; + o_type_name = __Pyx_PyType_GetFullyQualifiedName(Py_TYPE(o)); + PyErr_Format(PyExc_NotImplementedError, + "Subscript deletion not supported by " __Pyx_FMT_TYPENAME, o_type_name); + __Pyx_DECREF_TypeName(o_type_name); + return -1; + } +} + +static PyObject *__pyx_tp_getattro_array(PyObject *o, PyObject *n) { + PyObject *v = PyObject_GenericGetAttr(o, n); + if (!v && PyErr_ExceptionMatches(PyExc_AttributeError)) { + PyErr_Clear(); + v = __pyx_array___getattr__(o, n); + } + return v; +} + +static PyObject *__pyx_getprop___pyx_array_memview(PyObject *o, CYTHON_UNUSED void *x) { + return __pyx_pw_15View_dot_MemoryView_5array_7memview_1__get__(o); +} + +static PyMethodDef __pyx_methods_array[] = { + {"__getattr__", (PyCFunction)__pyx_array___getattr__, METH_O|METH_COEXIST, 0}, + {"__reduce_cython__", (PyCFunction)(void(*)(void))(__Pyx_PyCFunction_FastCallWithKeywords)__pyx_pw___pyx_array_1__reduce_cython__, __Pyx_METH_FASTCALL|METH_KEYWORDS, 0}, + {"__setstate_cython__", (PyCFunction)(void(*)(void))(__Pyx_PyCFunction_FastCallWithKeywords)__pyx_pw___pyx_array_3__setstate_cython__, __Pyx_METH_FASTCALL|METH_KEYWORDS, 0}, + {0, 0, 0, 0} +}; + +static struct PyGetSetDef __pyx_getsets_array[] = { + {"memview", __pyx_getprop___pyx_array_memview, 0, 0, 0}, + {0, 0, 0, 0, 0} +}; +#if CYTHON_USE_TYPE_SPECS +#if !CYTHON_COMPILING_IN_LIMITED_API + +static PyBufferProcs __pyx_tp_as_buffer_array = { + __pyx_array_getbuffer, /*bf_getbuffer*/ + 0, /*bf_releasebuffer*/ +}; +#endif +static PyType_Slot __pyx_type___pyx_array_slots[] = { + {Py_tp_dealloc, (void *)__pyx_tp_dealloc_array}, + {Py_sq_length, (void *)__pyx_array___len__}, + {Py_sq_item, (void *)__pyx_sq_item_array}, + {Py_mp_length, (void *)__pyx_array___len__}, + {Py_mp_subscript, (void *)__pyx_array___getitem__}, + {Py_mp_ass_subscript, (void *)__pyx_mp_ass_subscript_array}, + {Py_tp_getattro, (void *)__pyx_tp_getattro_array}, + #if defined(Py_bf_getbuffer) + {Py_bf_getbuffer, (void *)__pyx_array_getbuffer}, + #endif + {Py_tp_methods, (void *)__pyx_methods_array}, + {Py_tp_getset, (void *)__pyx_getsets_array}, + {Py_tp_new, (void *)__pyx_tp_new_array}, + {0, 0}, +}; +static PyType_Spec __pyx_type___pyx_array_spec = { + "spacy.pipeline._parser_internals.nonproj.array", + sizeof(struct __pyx_array_obj), + 0, + Py_TPFLAGS_DEFAULT|Py_TPFLAGS_HAVE_VERSION_TAG|Py_TPFLAGS_CHECKTYPES|Py_TPFLAGS_HAVE_NEWBUFFER|Py_TPFLAGS_BASETYPE|Py_TPFLAGS_SEQUENCE, + __pyx_type___pyx_array_slots, +}; +#else + +static PySequenceMethods __pyx_tp_as_sequence_array = { + __pyx_array___len__, /*sq_length*/ + 0, /*sq_concat*/ + 0, /*sq_repeat*/ + __pyx_sq_item_array, /*sq_item*/ + 0, /*sq_slice*/ + 0, /*sq_ass_item*/ + 0, /*sq_ass_slice*/ + 0, /*sq_contains*/ + 0, /*sq_inplace_concat*/ + 0, /*sq_inplace_repeat*/ +}; + +static PyMappingMethods __pyx_tp_as_mapping_array = { + __pyx_array___len__, /*mp_length*/ + __pyx_array___getitem__, /*mp_subscript*/ + __pyx_mp_ass_subscript_array, /*mp_ass_subscript*/ +}; + +static PyBufferProcs __pyx_tp_as_buffer_array = { + __pyx_array_getbuffer, /*bf_getbuffer*/ + 0, /*bf_releasebuffer*/ +}; + +static PyTypeObject __pyx_type___pyx_array = { + PyVarObject_HEAD_INIT(0, 0) + "spacy.pipeline._parser_internals.nonproj.""array", /*tp_name*/ + sizeof(struct __pyx_array_obj), /*tp_basicsize*/ + 0, /*tp_itemsize*/ + __pyx_tp_dealloc_array, /*tp_dealloc*/ + 0, /*tp_vectorcall_offset*/ + 0, /*tp_getattr*/ + 0, /*tp_setattr*/ + 0, /*tp_as_async*/ + 0, /*tp_repr*/ + 0, /*tp_as_number*/ + &__pyx_tp_as_sequence_array, /*tp_as_sequence*/ + &__pyx_tp_as_mapping_array, /*tp_as_mapping*/ + 0, /*tp_hash*/ + 0, /*tp_call*/ + 0, /*tp_str*/ + __pyx_tp_getattro_array, /*tp_getattro*/ + 0, /*tp_setattro*/ + &__pyx_tp_as_buffer_array, /*tp_as_buffer*/ + Py_TPFLAGS_DEFAULT|Py_TPFLAGS_HAVE_VERSION_TAG|Py_TPFLAGS_CHECKTYPES|Py_TPFLAGS_HAVE_NEWBUFFER|Py_TPFLAGS_BASETYPE|Py_TPFLAGS_SEQUENCE, /*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_array, /*tp_methods*/ + 0, /*tp_members*/ + __pyx_getsets_array, /*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_array, /*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_Enum(PyTypeObject *t, CYTHON_UNUSED PyObject *a, CYTHON_UNUSED PyObject *k) { + struct __pyx_MemviewEnum_obj *p; + PyObject *o; + o = __Pyx_AllocateExtensionType(t, 0); + if (unlikely(!o)) return 0; + p = ((struct __pyx_MemviewEnum_obj *)o); + p->name = Py_None; Py_INCREF(Py_None); + return o; +} + +static void __pyx_tp_dealloc_Enum(PyObject *o) { + struct __pyx_MemviewEnum_obj *p = (struct __pyx_MemviewEnum_obj *)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_Enum) { + if (PyObject_CallFinalizerFromDealloc(o)) return; + } + } + #endif + PyObject_GC_UnTrack(o); + Py_CLEAR(p->name); + 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_Enum(PyObject *o, visitproc v, void *a) { + int e; + struct __pyx_MemviewEnum_obj *p = (struct __pyx_MemviewEnum_obj *)o; + { + e = __Pyx_call_type_traverse(o, 1, v, a); + if (e) return e; + } + if (p->name) { + e = (*v)(p->name, a); if (e) return e; + } + return 0; +} + +static int __pyx_tp_clear_Enum(PyObject *o) { + PyObject* tmp; + struct __pyx_MemviewEnum_obj *p = (struct __pyx_MemviewEnum_obj *)o; + tmp = ((PyObject*)p->name); + p->name = Py_None; Py_INCREF(Py_None); + Py_XDECREF(tmp); + return 0; +} + +static PyMethodDef __pyx_methods_Enum[] = { + {"__reduce_cython__", (PyCFunction)(void(*)(void))(__Pyx_PyCFunction_FastCallWithKeywords)__pyx_pw___pyx_MemviewEnum_1__reduce_cython__, __Pyx_METH_FASTCALL|METH_KEYWORDS, 0}, + {"__setstate_cython__", (PyCFunction)(void(*)(void))(__Pyx_PyCFunction_FastCallWithKeywords)__pyx_pw___pyx_MemviewEnum_3__setstate_cython__, __Pyx_METH_FASTCALL|METH_KEYWORDS, 0}, + {0, 0, 0, 0} +}; +#if CYTHON_USE_TYPE_SPECS +static PyType_Slot __pyx_type___pyx_MemviewEnum_slots[] = { + {Py_tp_dealloc, (void *)__pyx_tp_dealloc_Enum}, + {Py_tp_repr, (void *)__pyx_MemviewEnum___repr__}, + {Py_tp_traverse, (void *)__pyx_tp_traverse_Enum}, + {Py_tp_clear, (void *)__pyx_tp_clear_Enum}, + {Py_tp_methods, (void *)__pyx_methods_Enum}, + {Py_tp_init, (void *)__pyx_MemviewEnum___init__}, + {Py_tp_new, (void *)__pyx_tp_new_Enum}, + {0, 0}, +}; +static PyType_Spec __pyx_type___pyx_MemviewEnum_spec = { + "spacy.pipeline._parser_internals.nonproj.Enum", + sizeof(struct __pyx_MemviewEnum_obj), + 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___pyx_MemviewEnum_slots, +}; +#else + +static PyTypeObject __pyx_type___pyx_MemviewEnum = { + PyVarObject_HEAD_INIT(0, 0) + "spacy.pipeline._parser_internals.nonproj.""Enum", /*tp_name*/ + sizeof(struct __pyx_MemviewEnum_obj), /*tp_basicsize*/ + 0, /*tp_itemsize*/ + __pyx_tp_dealloc_Enum, /*tp_dealloc*/ + 0, /*tp_vectorcall_offset*/ + 0, /*tp_getattr*/ + 0, /*tp_setattr*/ + 0, /*tp_as_async*/ + __pyx_MemviewEnum___repr__, /*tp_repr*/ + 0, /*tp_as_number*/ + 0, /*tp_as_sequence*/ + 0, /*tp_as_mapping*/ + 0, /*tp_hash*/ + 0, /*tp_call*/ + 0, /*tp_str*/ + 0, /*tp_getattro*/ + 0, /*tp_setattro*/ + 0, /*tp_as_buffer*/ + Py_TPFLAGS_DEFAULT|Py_TPFLAGS_HAVE_VERSION_TAG|Py_TPFLAGS_CHECKTYPES|Py_TPFLAGS_HAVE_NEWBUFFER|Py_TPFLAGS_BASETYPE|Py_TPFLAGS_HAVE_GC, /*tp_flags*/ + 0, /*tp_doc*/ + __pyx_tp_traverse_Enum, /*tp_traverse*/ + __pyx_tp_clear_Enum, /*tp_clear*/ + 0, /*tp_richcompare*/ + 0, /*tp_weaklistoffset*/ + 0, /*tp_iter*/ + 0, /*tp_iternext*/ + __pyx_methods_Enum, /*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_MemviewEnum___init__, /*tp_init*/ + 0, /*tp_alloc*/ + __pyx_tp_new_Enum, /*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 struct __pyx_vtabstruct_memoryview __pyx_vtable_memoryview; + +static PyObject *__pyx_tp_new_memoryview(PyTypeObject *t, PyObject *a, PyObject *k) { + struct __pyx_memoryview_obj *p; + PyObject *o; + o = __Pyx_AllocateExtensionType(t, 0); + if (unlikely(!o)) return 0; + p = ((struct __pyx_memoryview_obj *)o); + p->__pyx_vtab = __pyx_vtabptr_memoryview; + p->obj = Py_None; Py_INCREF(Py_None); + p->_size = Py_None; Py_INCREF(Py_None); + p->view.obj = NULL; + if (unlikely(__pyx_memoryview___cinit__(o, a, k) < 0)) goto bad; + return o; + bad: + Py_DECREF(o); o = 0; + return NULL; +} + +static void __pyx_tp_dealloc_memoryview(PyObject *o) { + struct __pyx_memoryview_obj *p = (struct __pyx_memoryview_obj *)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_memoryview) { + 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_memoryview___dealloc__(o); + __Pyx_SET_REFCNT(o, Py_REFCNT(o) - 1); + PyErr_Restore(etype, eval, etb); + } + Py_CLEAR(p->obj); + Py_CLEAR(p->_size); + 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_memoryview(PyObject *o, visitproc v, void *a) { + int e; + struct __pyx_memoryview_obj *p = (struct __pyx_memoryview_obj *)o; + { + e = __Pyx_call_type_traverse(o, 1, v, a); + if (e) return e; + } + if (p->obj) { + e = (*v)(p->obj, a); if (e) return e; + } + if (p->_size) { + e = (*v)(p->_size, a); if (e) return e; + } + if (p->view.obj) { + e = (*v)(p->view.obj, a); if (e) return e; + } + return 0; +} + +static int __pyx_tp_clear_memoryview(PyObject *o) { + PyObject* tmp; + struct __pyx_memoryview_obj *p = (struct __pyx_memoryview_obj *)o; + tmp = ((PyObject*)p->obj); + p->obj = Py_None; Py_INCREF(Py_None); + Py_XDECREF(tmp); + tmp = ((PyObject*)p->_size); + p->_size = Py_None; Py_INCREF(Py_None); + Py_XDECREF(tmp); + Py_CLEAR(p->view.obj); + return 0; +} + +static PyObject *__pyx_sq_item_memoryview(PyObject *o, Py_ssize_t i) { + PyObject *r; + PyObject *x = PyLong_FromSsize_t(i); if(!x) return 0; + #if CYTHON_USE_TYPE_SLOTS || (!CYTHON_USE_TYPE_SPECS && __PYX_LIMITED_VERSION_HEX < 0x030A0000) + r = Py_TYPE(o)->tp_as_mapping->mp_subscript(o, x); + #else + r = ((binaryfunc)PyType_GetSlot(Py_TYPE(o), Py_mp_subscript))(o, x); + #endif + Py_DECREF(x); + return r; +} + +static int __pyx_mp_ass_subscript_memoryview(PyObject *o, PyObject *i, PyObject *v) { + if (v) { + return __pyx_memoryview___setitem__(o, i, v); + } + else { + __Pyx_TypeName o_type_name; + o_type_name = __Pyx_PyType_GetFullyQualifiedName(Py_TYPE(o)); + PyErr_Format(PyExc_NotImplementedError, + "Subscript deletion not supported by " __Pyx_FMT_TYPENAME, o_type_name); + __Pyx_DECREF_TypeName(o_type_name); + return -1; + } +} + +static PyObject *__pyx_getprop___pyx_memoryview_T(PyObject *o, CYTHON_UNUSED void *x) { + return __pyx_pw_15View_dot_MemoryView_10memoryview_1T_1__get__(o); +} + +static PyObject *__pyx_getprop___pyx_memoryview_base(PyObject *o, CYTHON_UNUSED void *x) { + return __pyx_pw_15View_dot_MemoryView_10memoryview_4base_1__get__(o); +} + +static PyObject *__pyx_getprop___pyx_memoryview_shape(PyObject *o, CYTHON_UNUSED void *x) { + return __pyx_pw_15View_dot_MemoryView_10memoryview_5shape_1__get__(o); +} + +static PyObject *__pyx_getprop___pyx_memoryview_strides(PyObject *o, CYTHON_UNUSED void *x) { + return __pyx_pw_15View_dot_MemoryView_10memoryview_7strides_1__get__(o); +} + +static PyObject *__pyx_getprop___pyx_memoryview_suboffsets(PyObject *o, CYTHON_UNUSED void *x) { + return __pyx_pw_15View_dot_MemoryView_10memoryview_10suboffsets_1__get__(o); +} + +static PyObject *__pyx_getprop___pyx_memoryview_ndim(PyObject *o, CYTHON_UNUSED void *x) { + return __pyx_pw_15View_dot_MemoryView_10memoryview_4ndim_1__get__(o); +} + +static PyObject *__pyx_getprop___pyx_memoryview_itemsize(PyObject *o, CYTHON_UNUSED void *x) { + return __pyx_pw_15View_dot_MemoryView_10memoryview_8itemsize_1__get__(o); +} + +static PyObject *__pyx_getprop___pyx_memoryview_nbytes(PyObject *o, CYTHON_UNUSED void *x) { + return __pyx_pw_15View_dot_MemoryView_10memoryview_6nbytes_1__get__(o); +} + +static PyObject *__pyx_getprop___pyx_memoryview_size(PyObject *o, CYTHON_UNUSED void *x) { + return __pyx_pw_15View_dot_MemoryView_10memoryview_4size_1__get__(o); +} + +static PyMethodDef __pyx_methods_memoryview[] = { + {"is_c_contig", (PyCFunction)(void(*)(void))(__Pyx_PyCFunction_FastCallWithKeywords)__pyx_memoryview_is_c_contig, __Pyx_METH_FASTCALL|METH_KEYWORDS, 0}, + {"is_f_contig", (PyCFunction)(void(*)(void))(__Pyx_PyCFunction_FastCallWithKeywords)__pyx_memoryview_is_f_contig, __Pyx_METH_FASTCALL|METH_KEYWORDS, 0}, + {"copy", (PyCFunction)(void(*)(void))(__Pyx_PyCFunction_FastCallWithKeywords)__pyx_memoryview_copy, __Pyx_METH_FASTCALL|METH_KEYWORDS, 0}, + {"copy_fortran", (PyCFunction)(void(*)(void))(__Pyx_PyCFunction_FastCallWithKeywords)__pyx_memoryview_copy_fortran, __Pyx_METH_FASTCALL|METH_KEYWORDS, 0}, + {"__reduce_cython__", (PyCFunction)(void(*)(void))(__Pyx_PyCFunction_FastCallWithKeywords)__pyx_pw___pyx_memoryview_1__reduce_cython__, __Pyx_METH_FASTCALL|METH_KEYWORDS, 0}, + {"__setstate_cython__", (PyCFunction)(void(*)(void))(__Pyx_PyCFunction_FastCallWithKeywords)__pyx_pw___pyx_memoryview_3__setstate_cython__, __Pyx_METH_FASTCALL|METH_KEYWORDS, 0}, + {0, 0, 0, 0} +}; + +static struct PyGetSetDef __pyx_getsets_memoryview[] = { + {"T", __pyx_getprop___pyx_memoryview_T, 0, 0, 0}, + {"base", __pyx_getprop___pyx_memoryview_base, 0, 0, 0}, + {"shape", __pyx_getprop___pyx_memoryview_shape, 0, 0, 0}, + {"strides", __pyx_getprop___pyx_memoryview_strides, 0, 0, 0}, + {"suboffsets", __pyx_getprop___pyx_memoryview_suboffsets, 0, 0, 0}, + {"ndim", __pyx_getprop___pyx_memoryview_ndim, 0, 0, 0}, + {"itemsize", __pyx_getprop___pyx_memoryview_itemsize, 0, 0, 0}, + {"nbytes", __pyx_getprop___pyx_memoryview_nbytes, 0, 0, 0}, + {"size", __pyx_getprop___pyx_memoryview_size, 0, 0, 0}, + {0, 0, 0, 0, 0} +}; +#if CYTHON_USE_TYPE_SPECS +#if !CYTHON_COMPILING_IN_LIMITED_API + +static PyBufferProcs __pyx_tp_as_buffer_memoryview = { + __pyx_memoryview_getbuffer, /*bf_getbuffer*/ + 0, /*bf_releasebuffer*/ +}; +#endif +static PyType_Slot __pyx_type___pyx_memoryview_slots[] = { + {Py_tp_dealloc, (void *)__pyx_tp_dealloc_memoryview}, + {Py_tp_repr, (void *)__pyx_memoryview___repr__}, + {Py_sq_length, (void *)__pyx_memoryview___len__}, + {Py_sq_item, (void *)__pyx_sq_item_memoryview}, + {Py_mp_length, (void *)__pyx_memoryview___len__}, + {Py_mp_subscript, (void *)__pyx_memoryview___getitem__}, + {Py_mp_ass_subscript, (void *)__pyx_mp_ass_subscript_memoryview}, + {Py_tp_str, (void *)__pyx_memoryview___str__}, + #if defined(Py_bf_getbuffer) + {Py_bf_getbuffer, (void *)__pyx_memoryview_getbuffer}, + #endif + {Py_tp_traverse, (void *)__pyx_tp_traverse_memoryview}, + {Py_tp_clear, (void *)__pyx_tp_clear_memoryview}, + {Py_tp_methods, (void *)__pyx_methods_memoryview}, + {Py_tp_getset, (void *)__pyx_getsets_memoryview}, + {Py_tp_new, (void *)__pyx_tp_new_memoryview}, + {0, 0}, +}; +static PyType_Spec __pyx_type___pyx_memoryview_spec = { + "spacy.pipeline._parser_internals.nonproj.memoryview", + sizeof(struct __pyx_memoryview_obj), + 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___pyx_memoryview_slots, +}; +#else + +static PySequenceMethods __pyx_tp_as_sequence_memoryview = { + __pyx_memoryview___len__, /*sq_length*/ + 0, /*sq_concat*/ + 0, /*sq_repeat*/ + __pyx_sq_item_memoryview, /*sq_item*/ + 0, /*sq_slice*/ + 0, /*sq_ass_item*/ + 0, /*sq_ass_slice*/ + 0, /*sq_contains*/ + 0, /*sq_inplace_concat*/ + 0, /*sq_inplace_repeat*/ +}; + +static PyMappingMethods __pyx_tp_as_mapping_memoryview = { + __pyx_memoryview___len__, /*mp_length*/ + __pyx_memoryview___getitem__, /*mp_subscript*/ + __pyx_mp_ass_subscript_memoryview, /*mp_ass_subscript*/ +}; + +static PyBufferProcs __pyx_tp_as_buffer_memoryview = { + __pyx_memoryview_getbuffer, /*bf_getbuffer*/ + 0, /*bf_releasebuffer*/ +}; + +static PyTypeObject __pyx_type___pyx_memoryview = { + PyVarObject_HEAD_INIT(0, 0) + "spacy.pipeline._parser_internals.nonproj.""memoryview", /*tp_name*/ + sizeof(struct __pyx_memoryview_obj), /*tp_basicsize*/ + 0, /*tp_itemsize*/ + __pyx_tp_dealloc_memoryview, /*tp_dealloc*/ + 0, /*tp_vectorcall_offset*/ + 0, /*tp_getattr*/ + 0, /*tp_setattr*/ + 0, /*tp_as_async*/ + __pyx_memoryview___repr__, /*tp_repr*/ + 0, /*tp_as_number*/ + &__pyx_tp_as_sequence_memoryview, /*tp_as_sequence*/ + &__pyx_tp_as_mapping_memoryview, /*tp_as_mapping*/ + 0, /*tp_hash*/ + 0, /*tp_call*/ + __pyx_memoryview___str__, /*tp_str*/ + 0, /*tp_getattro*/ + 0, /*tp_setattro*/ + &__pyx_tp_as_buffer_memoryview, /*tp_as_buffer*/ + Py_TPFLAGS_DEFAULT|Py_TPFLAGS_HAVE_VERSION_TAG|Py_TPFLAGS_CHECKTYPES|Py_TPFLAGS_HAVE_NEWBUFFER|Py_TPFLAGS_BASETYPE|Py_TPFLAGS_HAVE_GC, /*tp_flags*/ + 0, /*tp_doc*/ + __pyx_tp_traverse_memoryview, /*tp_traverse*/ + __pyx_tp_clear_memoryview, /*tp_clear*/ + 0, /*tp_richcompare*/ + 0, /*tp_weaklistoffset*/ + 0, /*tp_iter*/ + 0, /*tp_iternext*/ + __pyx_methods_memoryview, /*tp_methods*/ + 0, /*tp_members*/ + __pyx_getsets_memoryview, /*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_memoryview, /*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 struct __pyx_vtabstruct__memoryviewslice __pyx_vtable__memoryviewslice; + +static PyObject *__pyx_tp_new__memoryviewslice(PyTypeObject *t, PyObject *a, PyObject *k) { + struct __pyx_memoryviewslice_obj *p; + PyObject *o = __pyx_tp_new_memoryview(t, a, k); + if (unlikely(!o)) return 0; + p = ((struct __pyx_memoryviewslice_obj *)o); + p->__pyx_base.__pyx_vtab = (struct __pyx_vtabstruct_memoryview*)__pyx_vtabptr__memoryviewslice; + __Pyx_default_placement_construct(&(p->from_slice)); + p->from_object = Py_None; Py_INCREF(Py_None); + p->from_slice.memview = NULL; + return o; +} + +static void __pyx_tp_dealloc__memoryviewslice(PyObject *o) { + struct __pyx_memoryviewslice_obj *p = (struct __pyx_memoryviewslice_obj *)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__memoryviewslice) { + 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_memoryviewslice___dealloc__(o); + __Pyx_SET_REFCNT(o, Py_REFCNT(o) - 1); + PyErr_Restore(etype, eval, etb); + } + __Pyx_call_destructor(p->from_slice); + Py_CLEAR(p->from_object); + PyObject_GC_Track(o); + __pyx_tp_dealloc_memoryview(o); +} + +static int __pyx_tp_traverse__memoryviewslice(PyObject *o, visitproc v, void *a) { + int e; + struct __pyx_memoryviewslice_obj *p = (struct __pyx_memoryviewslice_obj *)o; + e = __pyx_tp_traverse_memoryview(o, v, a); if (e) return e; + if (p->from_object) { + e = (*v)(p->from_object, a); if (e) return e; + } + return 0; +} + +static int __pyx_tp_clear__memoryviewslice(PyObject *o) { + PyObject* tmp; + struct __pyx_memoryviewslice_obj *p = (struct __pyx_memoryviewslice_obj *)o; + __pyx_tp_clear_memoryview(o); + tmp = ((PyObject*)p->from_object); + p->from_object = Py_None; Py_INCREF(Py_None); + Py_XDECREF(tmp); + __PYX_XCLEAR_MEMVIEW(&p->from_slice, 1); + return 0; +} + +static PyMethodDef __pyx_methods__memoryviewslice[] = { + {"__reduce_cython__", (PyCFunction)(void(*)(void))(__Pyx_PyCFunction_FastCallWithKeywords)__pyx_pw___pyx_memoryviewslice_1__reduce_cython__, __Pyx_METH_FASTCALL|METH_KEYWORDS, 0}, + {"__setstate_cython__", (PyCFunction)(void(*)(void))(__Pyx_PyCFunction_FastCallWithKeywords)__pyx_pw___pyx_memoryviewslice_3__setstate_cython__, __Pyx_METH_FASTCALL|METH_KEYWORDS, 0}, + {0, 0, 0, 0} +}; +#if CYTHON_USE_TYPE_SPECS +static PyType_Slot __pyx_type___pyx_memoryviewslice_slots[] = { + {Py_tp_dealloc, (void *)__pyx_tp_dealloc__memoryviewslice}, + {Py_tp_doc, (void *)PyDoc_STR("Internal class for passing memoryview slices to Python")}, + {Py_tp_traverse, (void *)__pyx_tp_traverse__memoryviewslice}, + {Py_tp_clear, (void *)__pyx_tp_clear__memoryviewslice}, + {Py_tp_methods, (void *)__pyx_methods__memoryviewslice}, + {Py_tp_new, (void *)__pyx_tp_new__memoryviewslice}, + {0, 0}, +}; +static PyType_Spec __pyx_type___pyx_memoryviewslice_spec = { + "spacy.pipeline._parser_internals.nonproj._memoryviewslice", + sizeof(struct __pyx_memoryviewslice_obj), + 0, + Py_TPFLAGS_DEFAULT|Py_TPFLAGS_HAVE_VERSION_TAG|Py_TPFLAGS_CHECKTYPES|Py_TPFLAGS_HAVE_NEWBUFFER|Py_TPFLAGS_BASETYPE|Py_TPFLAGS_HAVE_GC|Py_TPFLAGS_SEQUENCE, + __pyx_type___pyx_memoryviewslice_slots, +}; +#else + +static PyTypeObject __pyx_type___pyx_memoryviewslice = { + PyVarObject_HEAD_INIT(0, 0) + "spacy.pipeline._parser_internals.nonproj.""_memoryviewslice", /*tp_name*/ + sizeof(struct __pyx_memoryviewslice_obj), /*tp_basicsize*/ + 0, /*tp_itemsize*/ + __pyx_tp_dealloc__memoryviewslice, /*tp_dealloc*/ + 0, /*tp_vectorcall_offset*/ + 0, /*tp_getattr*/ + 0, /*tp_setattr*/ + 0, /*tp_as_async*/ + #if CYTHON_COMPILING_IN_PYPY || 0 + __pyx_memoryview___repr__, /*tp_repr*/ + #else + 0, /*tp_repr*/ + #endif + 0, /*tp_as_number*/ + 0, /*tp_as_sequence*/ + 0, /*tp_as_mapping*/ + 0, /*tp_hash*/ + 0, /*tp_call*/ + #if CYTHON_COMPILING_IN_PYPY || 0 + __pyx_memoryview___str__, /*tp_str*/ + #else + 0, /*tp_str*/ + #endif + 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|Py_TPFLAGS_SEQUENCE, /*tp_flags*/ + PyDoc_STR("Internal class for passing memoryview slices to Python"), /*tp_doc*/ + __pyx_tp_traverse__memoryviewslice, /*tp_traverse*/ + __pyx_tp_clear__memoryviewslice, /*tp_clear*/ + 0, /*tp_richcompare*/ + 0, /*tp_weaklistoffset*/ + 0, /*tp_iter*/ + 0, /*tp_iternext*/ + __pyx_methods__memoryviewslice, /*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__memoryviewslice, /*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_collections_abc_Sequence = Py_None; Py_INCREF(Py_None); + generic = Py_None; Py_INCREF(Py_None); + strided = Py_None; Py_INCREF(Py_None); + indirect = Py_None; Py_INCREF(Py_None); + contiguous = Py_None; Py_INCREF(Py_None); + indirect_contiguous = Py_None; Py_INCREF(Py_None); + __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); + PyObject *__pyx_t_1 = NULL; + 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_5spacy_8pipeline_17_parser_internals_7nonproj___pyx_scope_struct__ancestors = (PyTypeObject *) __Pyx_PyType_FromModuleAndSpec(__pyx_m, &__pyx_type_5spacy_8pipeline_17_parser_internals_7nonproj___pyx_scope_struct__ancestors_spec, NULL); if (unlikely(!__pyx_mstate->__pyx_ptype_5spacy_8pipeline_17_parser_internals_7nonproj___pyx_scope_struct__ancestors)) __PYX_ERR(0, 24, __pyx_L1_error) + if (__Pyx_fix_up_extension_type_from_spec(&__pyx_type_5spacy_8pipeline_17_parser_internals_7nonproj___pyx_scope_struct__ancestors_spec, __pyx_mstate->__pyx_ptype_5spacy_8pipeline_17_parser_internals_7nonproj___pyx_scope_struct__ancestors) < (0)) __PYX_ERR(0, 24, __pyx_L1_error) + #else + __pyx_mstate->__pyx_ptype_5spacy_8pipeline_17_parser_internals_7nonproj___pyx_scope_struct__ancestors = &__pyx_type_5spacy_8pipeline_17_parser_internals_7nonproj___pyx_scope_struct__ancestors; + #endif + #if !CYTHON_COMPILING_IN_LIMITED_API + #endif + #if !CYTHON_USE_TYPE_SPECS + if (__Pyx_PyType_Ready(__pyx_mstate->__pyx_ptype_5spacy_8pipeline_17_parser_internals_7nonproj___pyx_scope_struct__ancestors) < (0)) __PYX_ERR(0, 24, __pyx_L1_error) + #endif + #if CYTHON_COMPILING_IN_CPYTHON && PY_VERSION_HEX >= 0x030E0000 + PyUnstable_Object_EnableDeferredRefcount((PyObject*)__pyx_mstate->__pyx_ptype_5spacy_8pipeline_17_parser_internals_7nonproj___pyx_scope_struct__ancestors); + #endif + #if !CYTHON_COMPILING_IN_LIMITED_API + if ((CYTHON_USE_TYPE_SLOTS && CYTHON_USE_PYTYPE_LOOKUP) && likely(!__pyx_mstate->__pyx_ptype_5spacy_8pipeline_17_parser_internals_7nonproj___pyx_scope_struct__ancestors->tp_dictoffset && __pyx_mstate->__pyx_ptype_5spacy_8pipeline_17_parser_internals_7nonproj___pyx_scope_struct__ancestors->tp_getattro == PyObject_GenericGetAttr)) { + __pyx_mstate->__pyx_ptype_5spacy_8pipeline_17_parser_internals_7nonproj___pyx_scope_struct__ancestors->tp_getattro = PyObject_GenericGetAttr; + } + #endif + #if CYTHON_USE_TYPE_SPECS + __pyx_mstate->__pyx_ptype_5spacy_8pipeline_17_parser_internals_7nonproj___pyx_scope_struct_1_is_nonproj_tree = (PyTypeObject *) __Pyx_PyType_FromModuleAndSpec(__pyx_m, &__pyx_type_5spacy_8pipeline_17_parser_internals_7nonproj___pyx_scope_struct_1_is_nonproj_tree_spec, NULL); if (unlikely(!__pyx_mstate->__pyx_ptype_5spacy_8pipeline_17_parser_internals_7nonproj___pyx_scope_struct_1_is_nonproj_tree)) __PYX_ERR(0, 115, __pyx_L1_error) + if (__Pyx_fix_up_extension_type_from_spec(&__pyx_type_5spacy_8pipeline_17_parser_internals_7nonproj___pyx_scope_struct_1_is_nonproj_tree_spec, __pyx_mstate->__pyx_ptype_5spacy_8pipeline_17_parser_internals_7nonproj___pyx_scope_struct_1_is_nonproj_tree) < (0)) __PYX_ERR(0, 115, __pyx_L1_error) + #else + __pyx_mstate->__pyx_ptype_5spacy_8pipeline_17_parser_internals_7nonproj___pyx_scope_struct_1_is_nonproj_tree = &__pyx_type_5spacy_8pipeline_17_parser_internals_7nonproj___pyx_scope_struct_1_is_nonproj_tree; + #endif + #if !CYTHON_COMPILING_IN_LIMITED_API + #endif + #if !CYTHON_USE_TYPE_SPECS + if (__Pyx_PyType_Ready(__pyx_mstate->__pyx_ptype_5spacy_8pipeline_17_parser_internals_7nonproj___pyx_scope_struct_1_is_nonproj_tree) < (0)) __PYX_ERR(0, 115, __pyx_L1_error) + #endif + #if CYTHON_COMPILING_IN_CPYTHON && PY_VERSION_HEX >= 0x030E0000 + PyUnstable_Object_EnableDeferredRefcount((PyObject*)__pyx_mstate->__pyx_ptype_5spacy_8pipeline_17_parser_internals_7nonproj___pyx_scope_struct_1_is_nonproj_tree); + #endif + #if !CYTHON_COMPILING_IN_LIMITED_API + if ((CYTHON_USE_TYPE_SLOTS && CYTHON_USE_PYTYPE_LOOKUP) && likely(!__pyx_mstate->__pyx_ptype_5spacy_8pipeline_17_parser_internals_7nonproj___pyx_scope_struct_1_is_nonproj_tree->tp_dictoffset && __pyx_mstate->__pyx_ptype_5spacy_8pipeline_17_parser_internals_7nonproj___pyx_scope_struct_1_is_nonproj_tree->tp_getattro == PyObject_GenericGetAttr)) { + __pyx_mstate->__pyx_ptype_5spacy_8pipeline_17_parser_internals_7nonproj___pyx_scope_struct_1_is_nonproj_tree->tp_getattro = PyObject_GenericGetAttr; + } + #endif + #if CYTHON_USE_TYPE_SPECS + __pyx_mstate->__pyx_ptype_5spacy_8pipeline_17_parser_internals_7nonproj___pyx_scope_struct_2_genexpr = (PyTypeObject *) __Pyx_PyType_FromModuleAndSpec(__pyx_m, &__pyx_type_5spacy_8pipeline_17_parser_internals_7nonproj___pyx_scope_struct_2_genexpr_spec, NULL); if (unlikely(!__pyx_mstate->__pyx_ptype_5spacy_8pipeline_17_parser_internals_7nonproj___pyx_scope_struct_2_genexpr)) __PYX_ERR(0, 118, __pyx_L1_error) + if (__Pyx_fix_up_extension_type_from_spec(&__pyx_type_5spacy_8pipeline_17_parser_internals_7nonproj___pyx_scope_struct_2_genexpr_spec, __pyx_mstate->__pyx_ptype_5spacy_8pipeline_17_parser_internals_7nonproj___pyx_scope_struct_2_genexpr) < (0)) __PYX_ERR(0, 118, __pyx_L1_error) + #else + __pyx_mstate->__pyx_ptype_5spacy_8pipeline_17_parser_internals_7nonproj___pyx_scope_struct_2_genexpr = &__pyx_type_5spacy_8pipeline_17_parser_internals_7nonproj___pyx_scope_struct_2_genexpr; + #endif + #if !CYTHON_COMPILING_IN_LIMITED_API + #endif + #if !CYTHON_USE_TYPE_SPECS + if (__Pyx_PyType_Ready(__pyx_mstate->__pyx_ptype_5spacy_8pipeline_17_parser_internals_7nonproj___pyx_scope_struct_2_genexpr) < (0)) __PYX_ERR(0, 118, __pyx_L1_error) + #endif + #if CYTHON_COMPILING_IN_CPYTHON && PY_VERSION_HEX >= 0x030E0000 + PyUnstable_Object_EnableDeferredRefcount((PyObject*)__pyx_mstate->__pyx_ptype_5spacy_8pipeline_17_parser_internals_7nonproj___pyx_scope_struct_2_genexpr); + #endif + #if !CYTHON_COMPILING_IN_LIMITED_API + if ((CYTHON_USE_TYPE_SLOTS && CYTHON_USE_PYTYPE_LOOKUP) && likely(!__pyx_mstate->__pyx_ptype_5spacy_8pipeline_17_parser_internals_7nonproj___pyx_scope_struct_2_genexpr->tp_dictoffset && __pyx_mstate->__pyx_ptype_5spacy_8pipeline_17_parser_internals_7nonproj___pyx_scope_struct_2_genexpr->tp_getattro == PyObject_GenericGetAttr)) { + __pyx_mstate->__pyx_ptype_5spacy_8pipeline_17_parser_internals_7nonproj___pyx_scope_struct_2_genexpr->tp_getattro = PyObject_GenericGetAttr; + } + #endif + __pyx_vtabptr_array = &__pyx_vtable_array; + __pyx_vtable_array.get_memview = (PyObject *(*)(struct __pyx_array_obj *))__pyx_array_get_memview; + #if CYTHON_USE_TYPE_SPECS + __pyx_mstate->__pyx_array_type = (PyTypeObject *) __Pyx_PyType_FromModuleAndSpec(__pyx_m, &__pyx_type___pyx_array_spec, NULL); if (unlikely(!__pyx_mstate->__pyx_array_type)) __PYX_ERR(1, 110, __pyx_L1_error) + #if !CYTHON_COMPILING_IN_LIMITED_API + __pyx_mstate->__pyx_array_type->tp_as_buffer = &__pyx_tp_as_buffer_array; + if (!__pyx_mstate->__pyx_array_type->tp_as_buffer->bf_releasebuffer && __pyx_mstate->__pyx_array_type->tp_base->tp_as_buffer && __pyx_mstate->__pyx_array_type->tp_base->tp_as_buffer->bf_releasebuffer) { + __pyx_mstate->__pyx_array_type->tp_as_buffer->bf_releasebuffer = __pyx_mstate->__pyx_array_type->tp_base->tp_as_buffer->bf_releasebuffer; + } + #elif defined(Py_bf_getbuffer) && defined(Py_bf_releasebuffer) + /* PY_VERSION_HEX >= 0x03090000 || Py_LIMITED_API >= 0x030B0000 */ + #elif defined(_MSC_VER) + #pragma message ("The buffer protocol is not supported in the Limited C-API < 3.11.") + #else + #warning "The buffer protocol is not supported in the Limited C-API < 3.11." + #endif + if (__Pyx_fix_up_extension_type_from_spec(&__pyx_type___pyx_array_spec, __pyx_mstate->__pyx_array_type) < (0)) __PYX_ERR(1, 110, __pyx_L1_error) + #else + __pyx_mstate->__pyx_array_type = &__pyx_type___pyx_array; + #endif + #if !CYTHON_COMPILING_IN_LIMITED_API + #endif + #if !CYTHON_USE_TYPE_SPECS + if (__Pyx_PyType_Ready(__pyx_mstate->__pyx_array_type) < (0)) __PYX_ERR(1, 110, __pyx_L1_error) + #endif + #if CYTHON_COMPILING_IN_CPYTHON && PY_VERSION_HEX >= 0x030E0000 + PyUnstable_Object_EnableDeferredRefcount((PyObject*)__pyx_mstate->__pyx_array_type); + #endif + if (__Pyx_SetVtable(__pyx_mstate->__pyx_array_type, __pyx_vtabptr_array) < (0)) __PYX_ERR(1, 110, __pyx_L1_error) + if (__Pyx_MergeVtables(__pyx_mstate->__pyx_array_type) < (0)) __PYX_ERR(1, 110, __pyx_L1_error) + if (__Pyx_setup_reduce((PyObject *) __pyx_mstate->__pyx_array_type) < (0)) __PYX_ERR(1, 110, __pyx_L1_error) + #if CYTHON_USE_TYPE_SPECS + __pyx_mstate->__pyx_MemviewEnum_type = (PyTypeObject *) __Pyx_PyType_FromModuleAndSpec(__pyx_m, &__pyx_type___pyx_MemviewEnum_spec, NULL); if (unlikely(!__pyx_mstate->__pyx_MemviewEnum_type)) __PYX_ERR(1, 299, __pyx_L1_error) + if (__Pyx_fix_up_extension_type_from_spec(&__pyx_type___pyx_MemviewEnum_spec, __pyx_mstate->__pyx_MemviewEnum_type) < (0)) __PYX_ERR(1, 299, __pyx_L1_error) + #else + __pyx_mstate->__pyx_MemviewEnum_type = &__pyx_type___pyx_MemviewEnum; + #endif + #if !CYTHON_COMPILING_IN_LIMITED_API + #endif + #if !CYTHON_USE_TYPE_SPECS + if (__Pyx_PyType_Ready(__pyx_mstate->__pyx_MemviewEnum_type) < (0)) __PYX_ERR(1, 299, __pyx_L1_error) + #endif + #if CYTHON_COMPILING_IN_CPYTHON && PY_VERSION_HEX >= 0x030E0000 + PyUnstable_Object_EnableDeferredRefcount((PyObject*)__pyx_mstate->__pyx_MemviewEnum_type); + #endif + #if !CYTHON_COMPILING_IN_LIMITED_API + if ((CYTHON_USE_TYPE_SLOTS && CYTHON_USE_PYTYPE_LOOKUP) && likely(!__pyx_mstate->__pyx_MemviewEnum_type->tp_dictoffset && __pyx_mstate->__pyx_MemviewEnum_type->tp_getattro == PyObject_GenericGetAttr)) { + __pyx_mstate->__pyx_MemviewEnum_type->tp_getattro = PyObject_GenericGetAttr; + } + #endif + if (__Pyx_setup_reduce((PyObject *) __pyx_mstate->__pyx_MemviewEnum_type) < (0)) __PYX_ERR(1, 299, __pyx_L1_error) + __pyx_vtabptr_memoryview = &__pyx_vtable_memoryview; + __pyx_vtable_memoryview.get_item_pointer = (char *(*)(struct __pyx_memoryview_obj *, PyObject *))__pyx_memoryview_get_item_pointer; + __pyx_vtable_memoryview.is_slice = (PyObject *(*)(struct __pyx_memoryview_obj *, PyObject *))__pyx_memoryview_is_slice; + __pyx_vtable_memoryview.setitem_slice_assignment = (PyObject *(*)(struct __pyx_memoryview_obj *, PyObject *, PyObject *))__pyx_memoryview_setitem_slice_assignment; + __pyx_vtable_memoryview.setitem_slice_assign_scalar = (PyObject *(*)(struct __pyx_memoryview_obj *, struct __pyx_memoryview_obj *, PyObject *))__pyx_memoryview_setitem_slice_assign_scalar; + __pyx_vtable_memoryview.setitem_indexed = (PyObject *(*)(struct __pyx_memoryview_obj *, PyObject *, PyObject *))__pyx_memoryview_setitem_indexed; + __pyx_vtable_memoryview.convert_item_to_object = (PyObject *(*)(struct __pyx_memoryview_obj *, char *))__pyx_memoryview_convert_item_to_object; + __pyx_vtable_memoryview.assign_item_from_object = (PyObject *(*)(struct __pyx_memoryview_obj *, char *, PyObject *))__pyx_memoryview_assign_item_from_object; + __pyx_vtable_memoryview._get_base = (PyObject *(*)(struct __pyx_memoryview_obj *))__pyx_memoryview__get_base; + #if CYTHON_USE_TYPE_SPECS + __pyx_mstate->__pyx_memoryview_type = (PyTypeObject *) __Pyx_PyType_FromModuleAndSpec(__pyx_m, &__pyx_type___pyx_memoryview_spec, NULL); if (unlikely(!__pyx_mstate->__pyx_memoryview_type)) __PYX_ERR(1, 334, __pyx_L1_error) + #if !CYTHON_COMPILING_IN_LIMITED_API + __pyx_mstate->__pyx_memoryview_type->tp_as_buffer = &__pyx_tp_as_buffer_memoryview; + if (!__pyx_mstate->__pyx_memoryview_type->tp_as_buffer->bf_releasebuffer && __pyx_mstate->__pyx_memoryview_type->tp_base->tp_as_buffer && __pyx_mstate->__pyx_memoryview_type->tp_base->tp_as_buffer->bf_releasebuffer) { + __pyx_mstate->__pyx_memoryview_type->tp_as_buffer->bf_releasebuffer = __pyx_mstate->__pyx_memoryview_type->tp_base->tp_as_buffer->bf_releasebuffer; + } + #elif defined(Py_bf_getbuffer) && defined(Py_bf_releasebuffer) + /* PY_VERSION_HEX >= 0x03090000 || Py_LIMITED_API >= 0x030B0000 */ + #elif defined(_MSC_VER) + #pragma message ("The buffer protocol is not supported in the Limited C-API < 3.11.") + #else + #warning "The buffer protocol is not supported in the Limited C-API < 3.11." + #endif + if (__Pyx_fix_up_extension_type_from_spec(&__pyx_type___pyx_memoryview_spec, __pyx_mstate->__pyx_memoryview_type) < (0)) __PYX_ERR(1, 334, __pyx_L1_error) + #else + __pyx_mstate->__pyx_memoryview_type = &__pyx_type___pyx_memoryview; + #endif + #if !CYTHON_COMPILING_IN_LIMITED_API + #endif + #if !CYTHON_USE_TYPE_SPECS + if (__Pyx_PyType_Ready(__pyx_mstate->__pyx_memoryview_type) < (0)) __PYX_ERR(1, 334, __pyx_L1_error) + #endif + #if CYTHON_COMPILING_IN_CPYTHON && PY_VERSION_HEX >= 0x030E0000 + PyUnstable_Object_EnableDeferredRefcount((PyObject*)__pyx_mstate->__pyx_memoryview_type); + #endif + #if !CYTHON_COMPILING_IN_LIMITED_API + if ((CYTHON_USE_TYPE_SLOTS && CYTHON_USE_PYTYPE_LOOKUP) && likely(!__pyx_mstate->__pyx_memoryview_type->tp_dictoffset && __pyx_mstate->__pyx_memoryview_type->tp_getattro == PyObject_GenericGetAttr)) { + __pyx_mstate->__pyx_memoryview_type->tp_getattro = PyObject_GenericGetAttr; + } + #endif + if (__Pyx_SetVtable(__pyx_mstate->__pyx_memoryview_type, __pyx_vtabptr_memoryview) < (0)) __PYX_ERR(1, 334, __pyx_L1_error) + if (__Pyx_MergeVtables(__pyx_mstate->__pyx_memoryview_type) < (0)) __PYX_ERR(1, 334, __pyx_L1_error) + if (__Pyx_setup_reduce((PyObject *) __pyx_mstate->__pyx_memoryview_type) < (0)) __PYX_ERR(1, 334, __pyx_L1_error) + __pyx_vtabptr__memoryviewslice = &__pyx_vtable__memoryviewslice; + __pyx_vtable__memoryviewslice.__pyx_base = *__pyx_vtabptr_memoryview; + __pyx_vtable__memoryviewslice.__pyx_base.convert_item_to_object = (PyObject *(*)(struct __pyx_memoryview_obj *, char *))__pyx_memoryviewslice_convert_item_to_object; + __pyx_vtable__memoryviewslice.__pyx_base.assign_item_from_object = (PyObject *(*)(struct __pyx_memoryview_obj *, char *, PyObject *))__pyx_memoryviewslice_assign_item_from_object; + __pyx_vtable__memoryviewslice.__pyx_base._get_base = (PyObject *(*)(struct __pyx_memoryview_obj *))__pyx_memoryviewslice__get_base; + #if CYTHON_USE_TYPE_SPECS + __pyx_t_1 = PyTuple_Pack(1, (PyObject *)__pyx_mstate_global->__pyx_memoryview_type); if (unlikely(!__pyx_t_1)) __PYX_ERR(1, 951, __pyx_L1_error) + __Pyx_GOTREF(__pyx_t_1); + __pyx_mstate->__pyx_memoryviewslice_type = (PyTypeObject *) __Pyx_PyType_FromModuleAndSpec(__pyx_m, &__pyx_type___pyx_memoryviewslice_spec, __pyx_t_1); + __Pyx_XDECREF(__pyx_t_1); __pyx_t_1 = 0; + if (unlikely(!__pyx_mstate->__pyx_memoryviewslice_type)) __PYX_ERR(1, 951, __pyx_L1_error) + if (__Pyx_fix_up_extension_type_from_spec(&__pyx_type___pyx_memoryviewslice_spec, __pyx_mstate->__pyx_memoryviewslice_type) < (0)) __PYX_ERR(1, 951, __pyx_L1_error) + #else + __pyx_mstate->__pyx_memoryviewslice_type = &__pyx_type___pyx_memoryviewslice; + #endif + #if !CYTHON_COMPILING_IN_LIMITED_API + __pyx_mstate_global->__pyx_memoryviewslice_type->tp_base = __pyx_mstate_global->__pyx_memoryview_type; + #endif + #if !CYTHON_USE_TYPE_SPECS + if (__Pyx_PyType_Ready(__pyx_mstate->__pyx_memoryviewslice_type) < (0)) __PYX_ERR(1, 951, __pyx_L1_error) + #endif + #if CYTHON_COMPILING_IN_CPYTHON && PY_VERSION_HEX >= 0x030E0000 + PyUnstable_Object_EnableDeferredRefcount((PyObject*)__pyx_mstate->__pyx_memoryviewslice_type); + #endif + #if !CYTHON_COMPILING_IN_LIMITED_API + if ((CYTHON_USE_TYPE_SLOTS && CYTHON_USE_PYTYPE_LOOKUP) && likely(!__pyx_mstate->__pyx_memoryviewslice_type->tp_dictoffset && __pyx_mstate->__pyx_memoryviewslice_type->tp_getattro == PyObject_GenericGetAttr)) { + __pyx_mstate->__pyx_memoryviewslice_type->tp_getattro = PyObject_GenericGetAttr; + } + #endif + if (__Pyx_SetVtable(__pyx_mstate->__pyx_memoryviewslice_type, __pyx_vtabptr__memoryviewslice) < (0)) __PYX_ERR(1, 951, __pyx_L1_error) + if (__Pyx_MergeVtables(__pyx_mstate->__pyx_memoryviewslice_type) < (0)) __PYX_ERR(1, 951, __pyx_L1_error) + if (__Pyx_setup_reduce((PyObject *) __pyx_mstate->__pyx_memoryviewslice_type) < (0)) __PYX_ERR(1, 951, __pyx_L1_error) + __Pyx_RefNannyFinishContext(); + return 0; + __pyx_L1_error:; + __Pyx_XDECREF(__pyx_t_1); + __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(__Pyx_BUILTIN_MODULE_NAME); if (unlikely(!__pyx_t_1)) __PYX_ERR(3, 9, __pyx_L1_error) + __Pyx_GOTREF(__pyx_t_1); + __pyx_mstate->__pyx_ptype_7cpython_4type_type = __Pyx_ImportType_3_2_1(__pyx_t_1, __Pyx_BUILTIN_MODULE_NAME, "type", + #if defined(PYPY_VERSION_NUM) && PYPY_VERSION_NUM < 0x050B0000 + sizeof(PyTypeObject), __PYX_GET_STRUCT_ALIGNMENT_3_2_1(PyTypeObject), + #elif CYTHON_COMPILING_IN_LIMITED_API + 0, 0, + #else + sizeof(PyHeapTypeObject), __PYX_GET_STRUCT_ALIGNMENT_3_2_1(PyHeapTypeObject), + #endif + __Pyx_ImportType_CheckSize_Warn_3_2_1); if (!__pyx_mstate->__pyx_ptype_7cpython_4type_type) __PYX_ERR(3, 9, __pyx_L1_error) + __Pyx_DECREF(__pyx_t_1); __pyx_t_1 = 0; + __pyx_t_1 = PyImport_ImportModule("numpy"); if (unlikely(!__pyx_t_1)) __PYX_ERR(2, 228, __pyx_L1_error) + __Pyx_GOTREF(__pyx_t_1); + __pyx_mstate->__pyx_ptype_5numpy_dtype = __Pyx_ImportType_3_2_1(__pyx_t_1, "numpy", "dtype", + #if defined(PYPY_VERSION_NUM) && PYPY_VERSION_NUM < 0x050B0000 + sizeof(PyArray_Descr), __PYX_GET_STRUCT_ALIGNMENT_3_2_1(PyArray_Descr), + #elif CYTHON_COMPILING_IN_LIMITED_API + sizeof(PyArray_Descr), __PYX_GET_STRUCT_ALIGNMENT_3_2_1(PyArray_Descr), + #else + sizeof(PyArray_Descr), __PYX_GET_STRUCT_ALIGNMENT_3_2_1(PyArray_Descr), + #endif + __Pyx_ImportType_CheckSize_Ignore_3_2_1); if (!__pyx_mstate->__pyx_ptype_5numpy_dtype) __PYX_ERR(2, 228, __pyx_L1_error) + __pyx_mstate->__pyx_ptype_5numpy_flatiter = __Pyx_ImportType_3_2_1(__pyx_t_1, "numpy", "flatiter", + #if defined(PYPY_VERSION_NUM) && PYPY_VERSION_NUM < 0x050B0000 + sizeof(PyArrayIterObject), __PYX_GET_STRUCT_ALIGNMENT_3_2_1(PyArrayIterObject), + #elif CYTHON_COMPILING_IN_LIMITED_API + sizeof(PyArrayIterObject), __PYX_GET_STRUCT_ALIGNMENT_3_2_1(PyArrayIterObject), + #else + sizeof(PyArrayIterObject), __PYX_GET_STRUCT_ALIGNMENT_3_2_1(PyArrayIterObject), + #endif + __Pyx_ImportType_CheckSize_Ignore_3_2_1); if (!__pyx_mstate->__pyx_ptype_5numpy_flatiter) __PYX_ERR(2, 273, __pyx_L1_error) + __pyx_mstate->__pyx_ptype_5numpy_broadcast = __Pyx_ImportType_3_2_1(__pyx_t_1, "numpy", "broadcast", + #if defined(PYPY_VERSION_NUM) && PYPY_VERSION_NUM < 0x050B0000 + sizeof(PyArrayMultiIterObject), __PYX_GET_STRUCT_ALIGNMENT_3_2_1(PyArrayMultiIterObject), + #elif CYTHON_COMPILING_IN_LIMITED_API + sizeof(PyArrayMultiIterObject), __PYX_GET_STRUCT_ALIGNMENT_3_2_1(PyArrayMultiIterObject), + #else + sizeof(PyArrayMultiIterObject), __PYX_GET_STRUCT_ALIGNMENT_3_2_1(PyArrayMultiIterObject), + #endif + __Pyx_ImportType_CheckSize_Ignore_3_2_1); if (!__pyx_mstate->__pyx_ptype_5numpy_broadcast) __PYX_ERR(2, 277, __pyx_L1_error) + __pyx_mstate->__pyx_ptype_5numpy_ndarray = __Pyx_ImportType_3_2_1(__pyx_t_1, "numpy", "ndarray", + #if defined(PYPY_VERSION_NUM) && PYPY_VERSION_NUM < 0x050B0000 + sizeof(PyArrayObject), __PYX_GET_STRUCT_ALIGNMENT_3_2_1(PyArrayObject), + #elif CYTHON_COMPILING_IN_LIMITED_API + sizeof(PyArrayObject), __PYX_GET_STRUCT_ALIGNMENT_3_2_1(PyArrayObject), + #else + sizeof(PyArrayObject), __PYX_GET_STRUCT_ALIGNMENT_3_2_1(PyArrayObject), + #endif + __Pyx_ImportType_CheckSize_Ignore_3_2_1); if (!__pyx_mstate->__pyx_ptype_5numpy_ndarray) __PYX_ERR(2, 316, __pyx_L1_error) + __pyx_mstate->__pyx_ptype_5numpy_generic = __Pyx_ImportType_3_2_1(__pyx_t_1, "numpy", "generic", + #if defined(PYPY_VERSION_NUM) && PYPY_VERSION_NUM < 0x050B0000 + sizeof(PyObject), __PYX_GET_STRUCT_ALIGNMENT_3_2_1(PyObject), + #elif CYTHON_COMPILING_IN_LIMITED_API + sizeof(PyObject), __PYX_GET_STRUCT_ALIGNMENT_3_2_1(PyObject), + #else + sizeof(PyObject), __PYX_GET_STRUCT_ALIGNMENT_3_2_1(PyObject), + #endif + __Pyx_ImportType_CheckSize_Warn_3_2_1); if (!__pyx_mstate->__pyx_ptype_5numpy_generic) __PYX_ERR(2, 825, __pyx_L1_error) + __pyx_mstate->__pyx_ptype_5numpy_number = __Pyx_ImportType_3_2_1(__pyx_t_1, "numpy", "number", + #if defined(PYPY_VERSION_NUM) && PYPY_VERSION_NUM < 0x050B0000 + sizeof(PyObject), __PYX_GET_STRUCT_ALIGNMENT_3_2_1(PyObject), + #elif CYTHON_COMPILING_IN_LIMITED_API + sizeof(PyObject), __PYX_GET_STRUCT_ALIGNMENT_3_2_1(PyObject), + #else + sizeof(PyObject), __PYX_GET_STRUCT_ALIGNMENT_3_2_1(PyObject), + #endif + __Pyx_ImportType_CheckSize_Warn_3_2_1); if (!__pyx_mstate->__pyx_ptype_5numpy_number) __PYX_ERR(2, 827, __pyx_L1_error) + __pyx_mstate->__pyx_ptype_5numpy_integer = __Pyx_ImportType_3_2_1(__pyx_t_1, "numpy", "integer", + #if defined(PYPY_VERSION_NUM) && PYPY_VERSION_NUM < 0x050B0000 + sizeof(PyObject), __PYX_GET_STRUCT_ALIGNMENT_3_2_1(PyObject), + #elif CYTHON_COMPILING_IN_LIMITED_API + sizeof(PyObject), __PYX_GET_STRUCT_ALIGNMENT_3_2_1(PyObject), + #else + sizeof(PyObject), __PYX_GET_STRUCT_ALIGNMENT_3_2_1(PyObject), + #endif + __Pyx_ImportType_CheckSize_Warn_3_2_1); if (!__pyx_mstate->__pyx_ptype_5numpy_integer) __PYX_ERR(2, 829, __pyx_L1_error) + __pyx_mstate->__pyx_ptype_5numpy_signedinteger = __Pyx_ImportType_3_2_1(__pyx_t_1, "numpy", "signedinteger", + #if defined(PYPY_VERSION_NUM) && PYPY_VERSION_NUM < 0x050B0000 + sizeof(PyObject), __PYX_GET_STRUCT_ALIGNMENT_3_2_1(PyObject), + #elif CYTHON_COMPILING_IN_LIMITED_API + sizeof(PyObject), __PYX_GET_STRUCT_ALIGNMENT_3_2_1(PyObject), + #else + sizeof(PyObject), __PYX_GET_STRUCT_ALIGNMENT_3_2_1(PyObject), + #endif + __Pyx_ImportType_CheckSize_Warn_3_2_1); if (!__pyx_mstate->__pyx_ptype_5numpy_signedinteger) __PYX_ERR(2, 831, __pyx_L1_error) + __pyx_mstate->__pyx_ptype_5numpy_unsignedinteger = __Pyx_ImportType_3_2_1(__pyx_t_1, "numpy", "unsignedinteger", + #if defined(PYPY_VERSION_NUM) && PYPY_VERSION_NUM < 0x050B0000 + sizeof(PyObject), __PYX_GET_STRUCT_ALIGNMENT_3_2_1(PyObject), + #elif CYTHON_COMPILING_IN_LIMITED_API + sizeof(PyObject), __PYX_GET_STRUCT_ALIGNMENT_3_2_1(PyObject), + #else + sizeof(PyObject), __PYX_GET_STRUCT_ALIGNMENT_3_2_1(PyObject), + #endif + __Pyx_ImportType_CheckSize_Warn_3_2_1); if (!__pyx_mstate->__pyx_ptype_5numpy_unsignedinteger) __PYX_ERR(2, 833, __pyx_L1_error) + __pyx_mstate->__pyx_ptype_5numpy_inexact = __Pyx_ImportType_3_2_1(__pyx_t_1, "numpy", "inexact", + #if defined(PYPY_VERSION_NUM) && PYPY_VERSION_NUM < 0x050B0000 + sizeof(PyObject), __PYX_GET_STRUCT_ALIGNMENT_3_2_1(PyObject), + #elif CYTHON_COMPILING_IN_LIMITED_API + sizeof(PyObject), __PYX_GET_STRUCT_ALIGNMENT_3_2_1(PyObject), + #else + sizeof(PyObject), __PYX_GET_STRUCT_ALIGNMENT_3_2_1(PyObject), + #endif + __Pyx_ImportType_CheckSize_Warn_3_2_1); if (!__pyx_mstate->__pyx_ptype_5numpy_inexact) __PYX_ERR(2, 835, __pyx_L1_error) + __pyx_mstate->__pyx_ptype_5numpy_floating = __Pyx_ImportType_3_2_1(__pyx_t_1, "numpy", "floating", + #if defined(PYPY_VERSION_NUM) && PYPY_VERSION_NUM < 0x050B0000 + sizeof(PyObject), __PYX_GET_STRUCT_ALIGNMENT_3_2_1(PyObject), + #elif CYTHON_COMPILING_IN_LIMITED_API + sizeof(PyObject), __PYX_GET_STRUCT_ALIGNMENT_3_2_1(PyObject), + #else + sizeof(PyObject), __PYX_GET_STRUCT_ALIGNMENT_3_2_1(PyObject), + #endif + __Pyx_ImportType_CheckSize_Warn_3_2_1); if (!__pyx_mstate->__pyx_ptype_5numpy_floating) __PYX_ERR(2, 837, __pyx_L1_error) + __pyx_mstate->__pyx_ptype_5numpy_complexfloating = __Pyx_ImportType_3_2_1(__pyx_t_1, "numpy", "complexfloating", + #if defined(PYPY_VERSION_NUM) && PYPY_VERSION_NUM < 0x050B0000 + sizeof(PyObject), __PYX_GET_STRUCT_ALIGNMENT_3_2_1(PyObject), + #elif CYTHON_COMPILING_IN_LIMITED_API + sizeof(PyObject), __PYX_GET_STRUCT_ALIGNMENT_3_2_1(PyObject), + #else + sizeof(PyObject), __PYX_GET_STRUCT_ALIGNMENT_3_2_1(PyObject), + #endif + __Pyx_ImportType_CheckSize_Warn_3_2_1); if (!__pyx_mstate->__pyx_ptype_5numpy_complexfloating) __PYX_ERR(2, 839, __pyx_L1_error) + __pyx_mstate->__pyx_ptype_5numpy_flexible = __Pyx_ImportType_3_2_1(__pyx_t_1, "numpy", "flexible", + #if defined(PYPY_VERSION_NUM) && PYPY_VERSION_NUM < 0x050B0000 + sizeof(PyObject), __PYX_GET_STRUCT_ALIGNMENT_3_2_1(PyObject), + #elif CYTHON_COMPILING_IN_LIMITED_API + sizeof(PyObject), __PYX_GET_STRUCT_ALIGNMENT_3_2_1(PyObject), + #else + sizeof(PyObject), __PYX_GET_STRUCT_ALIGNMENT_3_2_1(PyObject), + #endif + __Pyx_ImportType_CheckSize_Warn_3_2_1); if (!__pyx_mstate->__pyx_ptype_5numpy_flexible) __PYX_ERR(2, 841, __pyx_L1_error) + __pyx_mstate->__pyx_ptype_5numpy_character = __Pyx_ImportType_3_2_1(__pyx_t_1, "numpy", "character", + #if defined(PYPY_VERSION_NUM) && PYPY_VERSION_NUM < 0x050B0000 + sizeof(PyObject), __PYX_GET_STRUCT_ALIGNMENT_3_2_1(PyObject), + #elif CYTHON_COMPILING_IN_LIMITED_API + sizeof(PyObject), __PYX_GET_STRUCT_ALIGNMENT_3_2_1(PyObject), + #else + sizeof(PyObject), __PYX_GET_STRUCT_ALIGNMENT_3_2_1(PyObject), + #endif + __Pyx_ImportType_CheckSize_Warn_3_2_1); if (!__pyx_mstate->__pyx_ptype_5numpy_character) __PYX_ERR(2, 843, __pyx_L1_error) + __pyx_mstate->__pyx_ptype_5numpy_ufunc = __Pyx_ImportType_3_2_1(__pyx_t_1, "numpy", "ufunc", + #if defined(PYPY_VERSION_NUM) && PYPY_VERSION_NUM < 0x050B0000 + sizeof(PyUFuncObject), __PYX_GET_STRUCT_ALIGNMENT_3_2_1(PyUFuncObject), + #elif CYTHON_COMPILING_IN_LIMITED_API + sizeof(PyUFuncObject), __PYX_GET_STRUCT_ALIGNMENT_3_2_1(PyUFuncObject), + #else + sizeof(PyUFuncObject), __PYX_GET_STRUCT_ALIGNMENT_3_2_1(PyUFuncObject), + #endif + __Pyx_ImportType_CheckSize_Ignore_3_2_1); if (!__pyx_mstate->__pyx_ptype_5numpy_ufunc) __PYX_ERR(2, 907, __pyx_L1_error) + __Pyx_DECREF(__pyx_t_1); __pyx_t_1 = 0; + __pyx_t_1 = PyImport_ImportModule("cymem.cymem"); if (unlikely(!__pyx_t_1)) __PYX_ERR(4, 4, __pyx_L1_error) + __Pyx_GOTREF(__pyx_t_1); + __pyx_mstate->__pyx_ptype_5cymem_5cymem_PyMalloc = __Pyx_ImportType_3_2_1(__pyx_t_1, "cymem.cymem", "PyMalloc", + #if defined(PYPY_VERSION_NUM) && PYPY_VERSION_NUM < 0x050B0000 + sizeof(struct __pyx_obj_5cymem_5cymem_PyMalloc), __PYX_GET_STRUCT_ALIGNMENT_3_2_1(struct __pyx_obj_5cymem_5cymem_PyMalloc), + #elif CYTHON_COMPILING_IN_LIMITED_API + sizeof(struct __pyx_obj_5cymem_5cymem_PyMalloc), __PYX_GET_STRUCT_ALIGNMENT_3_2_1(struct __pyx_obj_5cymem_5cymem_PyMalloc), + #else + sizeof(struct __pyx_obj_5cymem_5cymem_PyMalloc), __PYX_GET_STRUCT_ALIGNMENT_3_2_1(struct __pyx_obj_5cymem_5cymem_PyMalloc), + #endif + __Pyx_ImportType_CheckSize_Warn_3_2_1); if (!__pyx_mstate->__pyx_ptype_5cymem_5cymem_PyMalloc) __PYX_ERR(4, 4, __pyx_L1_error) + __pyx_vtabptr_5cymem_5cymem_PyMalloc = (struct __pyx_vtabstruct_5cymem_5cymem_PyMalloc*)__Pyx_GetVtable(__pyx_mstate->__pyx_ptype_5cymem_5cymem_PyMalloc); if (unlikely(!__pyx_vtabptr_5cymem_5cymem_PyMalloc)) __PYX_ERR(4, 4, __pyx_L1_error) + __pyx_mstate->__pyx_ptype_5cymem_5cymem_PyFree = __Pyx_ImportType_3_2_1(__pyx_t_1, "cymem.cymem", "PyFree", + #if defined(PYPY_VERSION_NUM) && PYPY_VERSION_NUM < 0x050B0000 + sizeof(struct __pyx_obj_5cymem_5cymem_PyFree), __PYX_GET_STRUCT_ALIGNMENT_3_2_1(struct __pyx_obj_5cymem_5cymem_PyFree), + #elif CYTHON_COMPILING_IN_LIMITED_API + sizeof(struct __pyx_obj_5cymem_5cymem_PyFree), __PYX_GET_STRUCT_ALIGNMENT_3_2_1(struct __pyx_obj_5cymem_5cymem_PyFree), + #else + sizeof(struct __pyx_obj_5cymem_5cymem_PyFree), __PYX_GET_STRUCT_ALIGNMENT_3_2_1(struct __pyx_obj_5cymem_5cymem_PyFree), + #endif + __Pyx_ImportType_CheckSize_Warn_3_2_1); if (!__pyx_mstate->__pyx_ptype_5cymem_5cymem_PyFree) __PYX_ERR(4, 10, __pyx_L1_error) + __pyx_vtabptr_5cymem_5cymem_PyFree = (struct __pyx_vtabstruct_5cymem_5cymem_PyFree*)__Pyx_GetVtable(__pyx_mstate->__pyx_ptype_5cymem_5cymem_PyFree); if (unlikely(!__pyx_vtabptr_5cymem_5cymem_PyFree)) __PYX_ERR(4, 10, __pyx_L1_error) + __pyx_mstate->__pyx_ptype_5cymem_5cymem_Pool = __Pyx_ImportType_3_2_1(__pyx_t_1, "cymem.cymem", "Pool", + #if defined(PYPY_VERSION_NUM) && PYPY_VERSION_NUM < 0x050B0000 + sizeof(struct __pyx_obj_5cymem_5cymem_Pool), __PYX_GET_STRUCT_ALIGNMENT_3_2_1(struct __pyx_obj_5cymem_5cymem_Pool), + #elif CYTHON_COMPILING_IN_LIMITED_API + sizeof(struct __pyx_obj_5cymem_5cymem_Pool), __PYX_GET_STRUCT_ALIGNMENT_3_2_1(struct __pyx_obj_5cymem_5cymem_Pool), + #else + sizeof(struct __pyx_obj_5cymem_5cymem_Pool), __PYX_GET_STRUCT_ALIGNMENT_3_2_1(struct __pyx_obj_5cymem_5cymem_Pool), + #endif + __Pyx_ImportType_CheckSize_Warn_3_2_1); if (!__pyx_mstate->__pyx_ptype_5cymem_5cymem_Pool) __PYX_ERR(4, 16, __pyx_L1_error) + __pyx_vtabptr_5cymem_5cymem_Pool = (struct __pyx_vtabstruct_5cymem_5cymem_Pool*)__Pyx_GetVtable(__pyx_mstate->__pyx_ptype_5cymem_5cymem_Pool); if (unlikely(!__pyx_vtabptr_5cymem_5cymem_Pool)) __PYX_ERR(4, 16, __pyx_L1_error) + __pyx_mstate->__pyx_ptype_5cymem_5cymem_Address = __Pyx_ImportType_3_2_1(__pyx_t_1, "cymem.cymem", "Address", + #if defined(PYPY_VERSION_NUM) && PYPY_VERSION_NUM < 0x050B0000 + sizeof(struct __pyx_obj_5cymem_5cymem_Address), __PYX_GET_STRUCT_ALIGNMENT_3_2_1(struct __pyx_obj_5cymem_5cymem_Address), + #elif CYTHON_COMPILING_IN_LIMITED_API + sizeof(struct __pyx_obj_5cymem_5cymem_Address), __PYX_GET_STRUCT_ALIGNMENT_3_2_1(struct __pyx_obj_5cymem_5cymem_Address), + #else + sizeof(struct __pyx_obj_5cymem_5cymem_Address), __PYX_GET_STRUCT_ALIGNMENT_3_2_1(struct __pyx_obj_5cymem_5cymem_Address), + #endif + __Pyx_ImportType_CheckSize_Warn_3_2_1); if (!__pyx_mstate->__pyx_ptype_5cymem_5cymem_Address) __PYX_ERR(4, 28, __pyx_L1_error) + __Pyx_DECREF(__pyx_t_1); __pyx_t_1 = 0; + __pyx_t_1 = PyImport_ImportModule("preshed.maps"); if (unlikely(!__pyx_t_1)) __PYX_ERR(5, 45, __pyx_L1_error) + __Pyx_GOTREF(__pyx_t_1); + __pyx_mstate->__pyx_ptype_7preshed_4maps_PreshMap = __Pyx_ImportType_3_2_1(__pyx_t_1, "preshed.maps", "PreshMap", + #if defined(PYPY_VERSION_NUM) && PYPY_VERSION_NUM < 0x050B0000 + sizeof(struct __pyx_obj_7preshed_4maps_PreshMap), __PYX_GET_STRUCT_ALIGNMENT_3_2_1(struct __pyx_obj_7preshed_4maps_PreshMap), + #elif CYTHON_COMPILING_IN_LIMITED_API + sizeof(struct __pyx_obj_7preshed_4maps_PreshMap), __PYX_GET_STRUCT_ALIGNMENT_3_2_1(struct __pyx_obj_7preshed_4maps_PreshMap), + #else + sizeof(struct __pyx_obj_7preshed_4maps_PreshMap), __PYX_GET_STRUCT_ALIGNMENT_3_2_1(struct __pyx_obj_7preshed_4maps_PreshMap), + #endif + __Pyx_ImportType_CheckSize_Warn_3_2_1); if (!__pyx_mstate->__pyx_ptype_7preshed_4maps_PreshMap) __PYX_ERR(5, 45, __pyx_L1_error) + __pyx_vtabptr_7preshed_4maps_PreshMap = (struct __pyx_vtabstruct_7preshed_4maps_PreshMap*)__Pyx_GetVtable(__pyx_mstate->__pyx_ptype_7preshed_4maps_PreshMap); if (unlikely(!__pyx_vtabptr_7preshed_4maps_PreshMap)) __PYX_ERR(5, 45, __pyx_L1_error) + __pyx_mstate->__pyx_ptype_7preshed_4maps_PreshMapArray = __Pyx_ImportType_3_2_1(__pyx_t_1, "preshed.maps", "PreshMapArray", + #if defined(PYPY_VERSION_NUM) && PYPY_VERSION_NUM < 0x050B0000 + sizeof(struct __pyx_obj_7preshed_4maps_PreshMapArray), __PYX_GET_STRUCT_ALIGNMENT_3_2_1(struct __pyx_obj_7preshed_4maps_PreshMapArray), + #elif CYTHON_COMPILING_IN_LIMITED_API + sizeof(struct __pyx_obj_7preshed_4maps_PreshMapArray), __PYX_GET_STRUCT_ALIGNMENT_3_2_1(struct __pyx_obj_7preshed_4maps_PreshMapArray), + #else + sizeof(struct __pyx_obj_7preshed_4maps_PreshMapArray), __PYX_GET_STRUCT_ALIGNMENT_3_2_1(struct __pyx_obj_7preshed_4maps_PreshMapArray), + #endif + __Pyx_ImportType_CheckSize_Warn_3_2_1); if (!__pyx_mstate->__pyx_ptype_7preshed_4maps_PreshMapArray) __PYX_ERR(5, 53, __pyx_L1_error) + __pyx_vtabptr_7preshed_4maps_PreshMapArray = (struct __pyx_vtabstruct_7preshed_4maps_PreshMapArray*)__Pyx_GetVtable(__pyx_mstate->__pyx_ptype_7preshed_4maps_PreshMapArray); if (unlikely(!__pyx_vtabptr_7preshed_4maps_PreshMapArray)) __PYX_ERR(5, 53, __pyx_L1_error) + __Pyx_DECREF(__pyx_t_1); __pyx_t_1 = 0; + __pyx_t_1 = PyImport_ImportModule("spacy.strings"); if (unlikely(!__pyx_t_1)) __PYX_ERR(6, 22, __pyx_L1_error) + __Pyx_GOTREF(__pyx_t_1); + __pyx_mstate->__pyx_ptype_5spacy_7strings_StringStore = __Pyx_ImportType_3_2_1(__pyx_t_1, "spacy.strings", "StringStore", + #if defined(PYPY_VERSION_NUM) && PYPY_VERSION_NUM < 0x050B0000 + sizeof(struct __pyx_obj_5spacy_7strings_StringStore), __PYX_GET_STRUCT_ALIGNMENT_3_2_1(struct __pyx_obj_5spacy_7strings_StringStore), + #elif CYTHON_COMPILING_IN_LIMITED_API + sizeof(struct __pyx_obj_5spacy_7strings_StringStore), __PYX_GET_STRUCT_ALIGNMENT_3_2_1(struct __pyx_obj_5spacy_7strings_StringStore), + #else + sizeof(struct __pyx_obj_5spacy_7strings_StringStore), __PYX_GET_STRUCT_ALIGNMENT_3_2_1(struct __pyx_obj_5spacy_7strings_StringStore), + #endif + __Pyx_ImportType_CheckSize_Warn_3_2_1); if (!__pyx_mstate->__pyx_ptype_5spacy_7strings_StringStore) __PYX_ERR(6, 22, __pyx_L1_error) + __pyx_vtabptr_5spacy_7strings_StringStore = (struct __pyx_vtabstruct_5spacy_7strings_StringStore*)__Pyx_GetVtable(__pyx_mstate->__pyx_ptype_5spacy_7strings_StringStore); if (unlikely(!__pyx_vtabptr_5spacy_7strings_StringStore)) __PYX_ERR(6, 22, __pyx_L1_error) + __Pyx_DECREF(__pyx_t_1); __pyx_t_1 = 0; + __pyx_t_1 = PyImport_ImportModule("spacy.morphology"); if (unlikely(!__pyx_t_1)) __PYX_ERR(7, 11, __pyx_L1_error) + __Pyx_GOTREF(__pyx_t_1); + __pyx_mstate->__pyx_ptype_5spacy_10morphology_Morphology = __Pyx_ImportType_3_2_1(__pyx_t_1, "spacy.morphology", "Morphology", + #if defined(PYPY_VERSION_NUM) && PYPY_VERSION_NUM < 0x050B0000 + sizeof(struct __pyx_obj_5spacy_10morphology_Morphology), __PYX_GET_STRUCT_ALIGNMENT_3_2_1(struct __pyx_obj_5spacy_10morphology_Morphology), + #elif CYTHON_COMPILING_IN_LIMITED_API + sizeof(struct __pyx_obj_5spacy_10morphology_Morphology), __PYX_GET_STRUCT_ALIGNMENT_3_2_1(struct __pyx_obj_5spacy_10morphology_Morphology), + #else + sizeof(struct __pyx_obj_5spacy_10morphology_Morphology), __PYX_GET_STRUCT_ALIGNMENT_3_2_1(struct __pyx_obj_5spacy_10morphology_Morphology), + #endif + __Pyx_ImportType_CheckSize_Warn_3_2_1); if (!__pyx_mstate->__pyx_ptype_5spacy_10morphology_Morphology) __PYX_ERR(7, 11, __pyx_L1_error) + __pyx_vtabptr_5spacy_10morphology_Morphology = (struct __pyx_vtabstruct_5spacy_10morphology_Morphology*)__Pyx_GetVtable(__pyx_mstate->__pyx_ptype_5spacy_10morphology_Morphology); if (unlikely(!__pyx_vtabptr_5spacy_10morphology_Morphology)) __PYX_ERR(7, 11, __pyx_L1_error) + __Pyx_DECREF(__pyx_t_1); __pyx_t_1 = 0; + __pyx_t_1 = PyImport_ImportModule("spacy.vocab"); if (unlikely(!__pyx_t_1)) __PYX_ERR(8, 26, __pyx_L1_error) + __Pyx_GOTREF(__pyx_t_1); + __pyx_mstate->__pyx_ptype_5spacy_5vocab_Vocab = __Pyx_ImportType_3_2_1(__pyx_t_1, "spacy.vocab", "Vocab", + #if defined(PYPY_VERSION_NUM) && PYPY_VERSION_NUM < 0x050B0000 + sizeof(struct __pyx_obj_5spacy_5vocab_Vocab), __PYX_GET_STRUCT_ALIGNMENT_3_2_1(struct __pyx_obj_5spacy_5vocab_Vocab), + #elif CYTHON_COMPILING_IN_LIMITED_API + sizeof(struct __pyx_obj_5spacy_5vocab_Vocab), __PYX_GET_STRUCT_ALIGNMENT_3_2_1(struct __pyx_obj_5spacy_5vocab_Vocab), + #else + sizeof(struct __pyx_obj_5spacy_5vocab_Vocab), __PYX_GET_STRUCT_ALIGNMENT_3_2_1(struct __pyx_obj_5spacy_5vocab_Vocab), + #endif + __Pyx_ImportType_CheckSize_Warn_3_2_1); if (!__pyx_mstate->__pyx_ptype_5spacy_5vocab_Vocab) __PYX_ERR(8, 26, __pyx_L1_error) + __pyx_vtabptr_5spacy_5vocab_Vocab = (struct __pyx_vtabstruct_5spacy_5vocab_Vocab*)__Pyx_GetVtable(__pyx_mstate->__pyx_ptype_5spacy_5vocab_Vocab); if (unlikely(!__pyx_vtabptr_5spacy_5vocab_Vocab)) __PYX_ERR(8, 26, __pyx_L1_error) + __Pyx_DECREF(__pyx_t_1); __pyx_t_1 = 0; + __pyx_t_1 = PyImport_ImportModule("spacy.tokens.doc"); if (unlikely(!__pyx_t_1)) __PYX_ERR(9, 37, __pyx_L1_error) + __Pyx_GOTREF(__pyx_t_1); + __pyx_mstate->__pyx_ptype_5spacy_6tokens_3doc_Doc = __Pyx_ImportType_3_2_1(__pyx_t_1, "spacy.tokens.doc", "Doc", + #if defined(PYPY_VERSION_NUM) && PYPY_VERSION_NUM < 0x050B0000 + sizeof(struct __pyx_obj_5spacy_6tokens_3doc_Doc), __PYX_GET_STRUCT_ALIGNMENT_3_2_1(struct __pyx_obj_5spacy_6tokens_3doc_Doc), + #elif CYTHON_COMPILING_IN_LIMITED_API + sizeof(struct __pyx_obj_5spacy_6tokens_3doc_Doc), __PYX_GET_STRUCT_ALIGNMENT_3_2_1(struct __pyx_obj_5spacy_6tokens_3doc_Doc), + #else + sizeof(struct __pyx_obj_5spacy_6tokens_3doc_Doc), __PYX_GET_STRUCT_ALIGNMENT_3_2_1(struct __pyx_obj_5spacy_6tokens_3doc_Doc), + #endif + __Pyx_ImportType_CheckSize_Warn_3_2_1); if (!__pyx_mstate->__pyx_ptype_5spacy_6tokens_3doc_Doc) __PYX_ERR(9, 37, __pyx_L1_error) + __pyx_vtabptr_5spacy_6tokens_3doc_Doc = (struct __pyx_vtabstruct_5spacy_6tokens_3doc_Doc*)__Pyx_GetVtable(__pyx_mstate->__pyx_ptype_5spacy_6tokens_3doc_Doc); if (unlikely(!__pyx_vtabptr_5spacy_6tokens_3doc_Doc)) __PYX_ERR(9, 37, __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); + PyObject *__pyx_t_1 = NULL; + int __pyx_lineno = 0; + const char *__pyx_filename = NULL; + int __pyx_clineno = 0; + __Pyx_RefNannySetupContext("__Pyx_modinit_variable_import_code", 0); + /*--- Variable import code ---*/ + { + __pyx_t_1 = PyImport_ImportModule("spacy.vocab"); 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_struct___pyx_t_5spacy_7structs_L); + #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 + 39; + void **const __pyx_import_pointers[] = {(void **)&__pyx_vp_5spacy_5vocab_EMPTY_LEXEME, (void **) NULL}; + void **const *__pyx_import_pointer = __pyx_import_pointers; + const char *__pyx_import_current_signature = __pyx_import_signature; + while (*__pyx_import_pointer) { + if (__Pyx_ImportVoidPtr_3_2_1(__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; +} + +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("murmurhash.mrmr"); 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_uint64_t_void_int_uint64_t_hash6); + #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 + 33; + void (**const __pyx_import_pointers[])(void) = {(void (**)(void))&__pyx_f_10murmurhash_4mrmr_hash64, (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_1(__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_t_1 = PyImport_ImportModule("spacy.tokens.doc"); 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_struct___pyx_t_5spacy_7struc); + #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 + 56; + void (**const __pyx_import_pointers[])(void) = {(void (**)(void))&__pyx_f_5spacy_6tokens_3doc_set_children_from_heads, (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_1(__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_nonproj(PyObject* module); /*proto*/ +static PyModuleDef_Slot __pyx_moduledef_slots[] = { + {Py_mod_create, (void*)__pyx_pymod_create}, + {Py_mod_exec, (void*)__pyx_pymod_exec_nonproj}, + #if CYTHON_COMPILING_IN_CPYTHON_FREETHREADING + {Py_mod_gil, Py_MOD_GIL_USED}, + #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, + "nonproj", + __pyx_k_Implements_the_projectivize_depr, /* 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_nonproj(void) CYTHON_SMALL_CODE; /*proto*/ +__Pyx_PyMODINIT_FUNC PyInit_nonproj(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_nonproj(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; + PyObject *__pyx_t_4 = NULL; + PyObject *__pyx_t_5 = NULL; + size_t __pyx_t_6; + static PyThread_type_lock __pyx_t_7[8]; + int __pyx_t_8; + Py_ssize_t __pyx_t_9; + 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 'nonproj' 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 "nonproj" 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_nonproj", 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_spacy__pipeline___parser_internals__nonproj) { + if (PyObject_SetAttr(__pyx_m, __pyx_mstate_global->__pyx_n_u_name_2, __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, "spacy.pipeline._parser_internals.nonproj")) { + if (unlikely((PyDict_SetItemString(modules, "spacy.pipeline._parser_internals.nonproj", __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) + if (unlikely((__Pyx_modinit_variable_import_code(__pyx_mstate) < 0))) __PYX_ERR(0, 1, __pyx_L1_error) + if (unlikely((__Pyx_modinit_function_import_code(__pyx_mstate) < 0))) __PYX_ERR(0, 1, __pyx_L1_error) + /*--- Execution code ---*/ + + /* "View.MemoryView":100 + * + * cdef object __pyx_collections_abc_Sequence "__pyx_collections_abc_Sequence" + * try: # <<<<<<<<<<<<<< + * __pyx_collections_abc_Sequence = __import__("collections.abc").abc.Sequence + * except: +*/ + { + __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:*/ { + + /* "View.MemoryView":101 + * cdef object __pyx_collections_abc_Sequence "__pyx_collections_abc_Sequence" + * try: + * __pyx_collections_abc_Sequence = __import__("collections.abc").abc.Sequence # <<<<<<<<<<<<<< + * except: + * +*/ + __pyx_t_5 = NULL; + __pyx_t_6 = 1; + { + PyObject *__pyx_callargs[2] = {__pyx_t_5, __pyx_mstate_global->__pyx_kp_u_collections_abc}; + __pyx_t_4 = __Pyx_PyObject_FastCall((PyObject*)__pyx_builtin___import__, __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(1, 101, __pyx_L2_error) + __Pyx_GOTREF(__pyx_t_4); + } + __pyx_t_5 = __Pyx_PyObject_GetAttrStr(__pyx_t_4, __pyx_mstate_global->__pyx_n_u_abc); if (unlikely(!__pyx_t_5)) __PYX_ERR(1, 101, __pyx_L2_error) + __Pyx_GOTREF(__pyx_t_5); + __Pyx_DECREF(__pyx_t_4); __pyx_t_4 = 0; + __pyx_t_4 = __Pyx_PyObject_GetAttrStr(__pyx_t_5, __pyx_mstate_global->__pyx_n_u_Sequence); if (unlikely(!__pyx_t_4)) __PYX_ERR(1, 101, __pyx_L2_error) + __Pyx_GOTREF(__pyx_t_4); + __Pyx_DECREF(__pyx_t_5); __pyx_t_5 = 0; + __Pyx_XGOTREF(__pyx_collections_abc_Sequence); + __Pyx_DECREF_SET(__pyx_collections_abc_Sequence, __pyx_t_4); + __Pyx_GIVEREF(__pyx_t_4); + __pyx_t_4 = 0; + + /* "View.MemoryView":100 + * + * cdef object __pyx_collections_abc_Sequence "__pyx_collections_abc_Sequence" + * try: # <<<<<<<<<<<<<< + * __pyx_collections_abc_Sequence = __import__("collections.abc").abc.Sequence + * except: +*/ + } + __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_L7_try_end; + __pyx_L2_error:; + __Pyx_XDECREF(__pyx_t_4); __pyx_t_4 = 0; + __Pyx_XDECREF(__pyx_t_5); __pyx_t_5 = 0; + + /* "View.MemoryView":102 + * try: + * __pyx_collections_abc_Sequence = __import__("collections.abc").abc.Sequence + * except: # <<<<<<<<<<<<<< + * + * __pyx_collections_abc_Sequence = None +*/ + /*except:*/ { + __Pyx_ErrRestore(0,0,0); + + /* "View.MemoryView":104 + * except: + * + * __pyx_collections_abc_Sequence = None # <<<<<<<<<<<<<< + * + * +*/ + __Pyx_INCREF(Py_None); + __Pyx_XGOTREF(__pyx_collections_abc_Sequence); + __Pyx_DECREF_SET(__pyx_collections_abc_Sequence, Py_None); + __Pyx_GIVEREF(Py_None); + goto __pyx_L3_exception_handled; + } + __pyx_L3_exception_handled:; + __Pyx_XGIVEREF(__pyx_t_1); + __Pyx_XGIVEREF(__pyx_t_2); + __Pyx_XGIVEREF(__pyx_t_3); + __Pyx_ExceptionReset(__pyx_t_1, __pyx_t_2, __pyx_t_3); + __pyx_L7_try_end:; + } + + /* "View.MemoryView":239 + * + * + * try: # <<<<<<<<<<<<<< + * count = __pyx_collections_abc_Sequence.count + * index = __pyx_collections_abc_Sequence.index +*/ + { + __Pyx_PyThreadState_declare + __Pyx_PyThreadState_assign + __Pyx_ExceptionSave(&__pyx_t_3, &__pyx_t_2, &__pyx_t_1); + __Pyx_XGOTREF(__pyx_t_3); + __Pyx_XGOTREF(__pyx_t_2); + __Pyx_XGOTREF(__pyx_t_1); + /*try:*/ { + + /* "View.MemoryView":240 + * + * try: + * count = __pyx_collections_abc_Sequence.count # <<<<<<<<<<<<<< + * index = __pyx_collections_abc_Sequence.index + * except: +*/ + __pyx_t_4 = __Pyx_PyObject_GetAttrStr(__pyx_collections_abc_Sequence, __pyx_mstate_global->__pyx_n_u_count); if (unlikely(!__pyx_t_4)) __PYX_ERR(1, 240, __pyx_L10_error) + __Pyx_GOTREF(__pyx_t_4); + if (__Pyx_SetItemOnTypeDict(__pyx_mstate_global->__pyx_array_type, __pyx_mstate_global->__pyx_n_u_count, __pyx_t_4) < (0)) __PYX_ERR(1, 240, __pyx_L10_error) + __Pyx_DECREF(__pyx_t_4); __pyx_t_4 = 0; + + /* "View.MemoryView":241 + * try: + * count = __pyx_collections_abc_Sequence.count + * index = __pyx_collections_abc_Sequence.index # <<<<<<<<<<<<<< + * except: + * pass +*/ + __pyx_t_4 = __Pyx_PyObject_GetAttrStr(__pyx_collections_abc_Sequence, __pyx_mstate_global->__pyx_n_u_index); if (unlikely(!__pyx_t_4)) __PYX_ERR(1, 241, __pyx_L10_error) + __Pyx_GOTREF(__pyx_t_4); + if (__Pyx_SetItemOnTypeDict(__pyx_mstate_global->__pyx_array_type, __pyx_mstate_global->__pyx_n_u_index, __pyx_t_4) < (0)) __PYX_ERR(1, 241, __pyx_L10_error) + __Pyx_DECREF(__pyx_t_4); __pyx_t_4 = 0; + + /* "View.MemoryView":239 + * + * + * try: # <<<<<<<<<<<<<< + * count = __pyx_collections_abc_Sequence.count + * index = __pyx_collections_abc_Sequence.index +*/ + } + __Pyx_XDECREF(__pyx_t_3); __pyx_t_3 = 0; + __Pyx_XDECREF(__pyx_t_2); __pyx_t_2 = 0; + __Pyx_XDECREF(__pyx_t_1); __pyx_t_1 = 0; + goto __pyx_L15_try_end; + __pyx_L10_error:; + __Pyx_XDECREF(__pyx_t_4); __pyx_t_4 = 0; + __Pyx_XDECREF(__pyx_t_5); __pyx_t_5 = 0; + + /* "View.MemoryView":242 + * count = __pyx_collections_abc_Sequence.count + * index = __pyx_collections_abc_Sequence.index + * except: # <<<<<<<<<<<<<< + * pass + * +*/ + /*except:*/ { + __Pyx_ErrRestore(0,0,0); + goto __pyx_L11_exception_handled; + } + __pyx_L11_exception_handled:; + __Pyx_XGIVEREF(__pyx_t_3); + __Pyx_XGIVEREF(__pyx_t_2); + __Pyx_XGIVEREF(__pyx_t_1); + __Pyx_ExceptionReset(__pyx_t_3, __pyx_t_2, __pyx_t_1); + __pyx_L15_try_end:; + } + + /* "View.MemoryView":307 + * return self.name + * + * cdef generic = Enum("") # <<<<<<<<<<<<<< + * cdef strided = Enum("") # default + * cdef indirect = Enum("") +*/ + __pyx_t_5 = NULL; + __pyx_t_6 = 1; + { + PyObject *__pyx_callargs[2] = {__pyx_t_5, __pyx_mstate_global->__pyx_kp_u_strided_and_direct_or_indirect}; + __pyx_t_4 = __Pyx_PyObject_FastCall((PyObject*)__pyx_mstate_global->__pyx_MemviewEnum_type, __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(1, 307, __pyx_L1_error) + __Pyx_GOTREF((PyObject *)__pyx_t_4); + } + __Pyx_XGOTREF(generic); + __Pyx_DECREF_SET(generic, ((PyObject *)__pyx_t_4)); + __Pyx_GIVEREF((PyObject *)__pyx_t_4); + __pyx_t_4 = 0; + + /* "View.MemoryView":308 + * + * cdef generic = Enum("") + * cdef strided = Enum("") # default # <<<<<<<<<<<<<< + * cdef indirect = Enum("") + * +*/ + __pyx_t_5 = NULL; + __pyx_t_6 = 1; + { + PyObject *__pyx_callargs[2] = {__pyx_t_5, __pyx_mstate_global->__pyx_kp_u_strided_and_direct}; + __pyx_t_4 = __Pyx_PyObject_FastCall((PyObject*)__pyx_mstate_global->__pyx_MemviewEnum_type, __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(1, 308, __pyx_L1_error) + __Pyx_GOTREF((PyObject *)__pyx_t_4); + } + __Pyx_XGOTREF(strided); + __Pyx_DECREF_SET(strided, ((PyObject *)__pyx_t_4)); + __Pyx_GIVEREF((PyObject *)__pyx_t_4); + __pyx_t_4 = 0; + + /* "View.MemoryView":309 + * cdef generic = Enum("") + * cdef strided = Enum("") # default + * cdef indirect = Enum("") # <<<<<<<<<<<<<< + * + * +*/ + __pyx_t_5 = NULL; + __pyx_t_6 = 1; + { + PyObject *__pyx_callargs[2] = {__pyx_t_5, __pyx_mstate_global->__pyx_kp_u_strided_and_indirect}; + __pyx_t_4 = __Pyx_PyObject_FastCall((PyObject*)__pyx_mstate_global->__pyx_MemviewEnum_type, __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(1, 309, __pyx_L1_error) + __Pyx_GOTREF((PyObject *)__pyx_t_4); + } + __Pyx_XGOTREF(indirect); + __Pyx_DECREF_SET(indirect, ((PyObject *)__pyx_t_4)); + __Pyx_GIVEREF((PyObject *)__pyx_t_4); + __pyx_t_4 = 0; + + /* "View.MemoryView":312 + * + * + * cdef contiguous = Enum("") # <<<<<<<<<<<<<< + * cdef indirect_contiguous = Enum("") + * +*/ + __pyx_t_5 = NULL; + __pyx_t_6 = 1; + { + PyObject *__pyx_callargs[2] = {__pyx_t_5, __pyx_mstate_global->__pyx_kp_u_contiguous_and_direct}; + __pyx_t_4 = __Pyx_PyObject_FastCall((PyObject*)__pyx_mstate_global->__pyx_MemviewEnum_type, __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(1, 312, __pyx_L1_error) + __Pyx_GOTREF((PyObject *)__pyx_t_4); + } + __Pyx_XGOTREF(contiguous); + __Pyx_DECREF_SET(contiguous, ((PyObject *)__pyx_t_4)); + __Pyx_GIVEREF((PyObject *)__pyx_t_4); + __pyx_t_4 = 0; + + /* "View.MemoryView":313 + * + * cdef contiguous = Enum("") + * cdef indirect_contiguous = Enum("") # <<<<<<<<<<<<<< + * + * +*/ + __pyx_t_5 = NULL; + __pyx_t_6 = 1; + { + PyObject *__pyx_callargs[2] = {__pyx_t_5, __pyx_mstate_global->__pyx_kp_u_contiguous_and_indirect}; + __pyx_t_4 = __Pyx_PyObject_FastCall((PyObject*)__pyx_mstate_global->__pyx_MemviewEnum_type, __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(1, 313, __pyx_L1_error) + __Pyx_GOTREF((PyObject *)__pyx_t_4); + } + __Pyx_XGOTREF(indirect_contiguous); + __Pyx_DECREF_SET(indirect_contiguous, ((PyObject *)__pyx_t_4)); + __Pyx_GIVEREF((PyObject *)__pyx_t_4); + __pyx_t_4 = 0; + + /* "View.MemoryView":321 + * + * + * cdef int __pyx_memoryview_thread_locks_used = 0 # <<<<<<<<<<<<<< + * cdef PyThread_type_lock[8] __pyx_memoryview_thread_locks = [ + * PyThread_allocate_lock(), +*/ + __pyx_memoryview_thread_locks_used = 0; + + /* "View.MemoryView":322 + * + * cdef int __pyx_memoryview_thread_locks_used = 0 + * cdef PyThread_type_lock[8] __pyx_memoryview_thread_locks = [ # <<<<<<<<<<<<<< + * PyThread_allocate_lock(), + * PyThread_allocate_lock(), +*/ + __pyx_t_7[0] = PyThread_allocate_lock(); + __pyx_t_7[1] = PyThread_allocate_lock(); + __pyx_t_7[2] = PyThread_allocate_lock(); + __pyx_t_7[3] = PyThread_allocate_lock(); + __pyx_t_7[4] = PyThread_allocate_lock(); + __pyx_t_7[5] = PyThread_allocate_lock(); + __pyx_t_7[6] = PyThread_allocate_lock(); + __pyx_t_7[7] = PyThread_allocate_lock(); + memcpy(&(__pyx_memoryview_thread_locks[0]), __pyx_t_7, sizeof(__pyx_memoryview_thread_locks[0]) * (8)); + + /* "View.MemoryView":983 + * + * + * try: # <<<<<<<<<<<<<< + * count = __pyx_collections_abc_Sequence.count + * index = __pyx_collections_abc_Sequence.index +*/ + { + __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:*/ { + + /* "View.MemoryView":984 + * + * try: + * count = __pyx_collections_abc_Sequence.count # <<<<<<<<<<<<<< + * index = __pyx_collections_abc_Sequence.index + * except: +*/ + __pyx_t_4 = __Pyx_PyObject_GetAttrStr(__pyx_collections_abc_Sequence, __pyx_mstate_global->__pyx_n_u_count); if (unlikely(!__pyx_t_4)) __PYX_ERR(1, 984, __pyx_L18_error) + __Pyx_GOTREF(__pyx_t_4); + if (__Pyx_SetItemOnTypeDict(__pyx_mstate_global->__pyx_memoryviewslice_type, __pyx_mstate_global->__pyx_n_u_count, __pyx_t_4) < (0)) __PYX_ERR(1, 984, __pyx_L18_error) + __Pyx_DECREF(__pyx_t_4); __pyx_t_4 = 0; + + /* "View.MemoryView":985 + * try: + * count = __pyx_collections_abc_Sequence.count + * index = __pyx_collections_abc_Sequence.index # <<<<<<<<<<<<<< + * except: + * pass +*/ + __pyx_t_4 = __Pyx_PyObject_GetAttrStr(__pyx_collections_abc_Sequence, __pyx_mstate_global->__pyx_n_u_index); if (unlikely(!__pyx_t_4)) __PYX_ERR(1, 985, __pyx_L18_error) + __Pyx_GOTREF(__pyx_t_4); + if (__Pyx_SetItemOnTypeDict(__pyx_mstate_global->__pyx_memoryviewslice_type, __pyx_mstate_global->__pyx_n_u_index, __pyx_t_4) < (0)) __PYX_ERR(1, 985, __pyx_L18_error) + __Pyx_DECREF(__pyx_t_4); __pyx_t_4 = 0; + + /* "View.MemoryView":983 + * + * + * try: # <<<<<<<<<<<<<< + * count = __pyx_collections_abc_Sequence.count + * index = __pyx_collections_abc_Sequence.index +*/ + } + __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_L23_try_end; + __pyx_L18_error:; + __Pyx_XDECREF(__pyx_t_4); __pyx_t_4 = 0; + __Pyx_XDECREF(__pyx_t_5); __pyx_t_5 = 0; + + /* "View.MemoryView":986 + * count = __pyx_collections_abc_Sequence.count + * index = __pyx_collections_abc_Sequence.index + * except: # <<<<<<<<<<<<<< + * pass + * +*/ + /*except:*/ { + __Pyx_ErrRestore(0,0,0); + goto __pyx_L19_exception_handled; + } + __pyx_L19_exception_handled:; + __Pyx_XGIVEREF(__pyx_t_1); + __Pyx_XGIVEREF(__pyx_t_2); + __Pyx_XGIVEREF(__pyx_t_3); + __Pyx_ExceptionReset(__pyx_t_1, __pyx_t_2, __pyx_t_3); + __pyx_L23_try_end:; + } + + /* "View.MemoryView":989 + * pass + * + * try: # <<<<<<<<<<<<<< + * if __pyx_collections_abc_Sequence: + * +*/ + { + __Pyx_PyThreadState_declare + __Pyx_PyThreadState_assign + __Pyx_ExceptionSave(&__pyx_t_3, &__pyx_t_2, &__pyx_t_1); + __Pyx_XGOTREF(__pyx_t_3); + __Pyx_XGOTREF(__pyx_t_2); + __Pyx_XGOTREF(__pyx_t_1); + /*try:*/ { + + /* "View.MemoryView":990 + * + * try: + * if __pyx_collections_abc_Sequence: # <<<<<<<<<<<<<< + * + * +*/ + __pyx_t_8 = __Pyx_PyObject_IsTrue(__pyx_collections_abc_Sequence); if (unlikely((__pyx_t_8 < 0))) __PYX_ERR(1, 990, __pyx_L26_error) + if (__pyx_t_8) { + + /* "View.MemoryView":994 + * + * + * __pyx_collections_abc_Sequence.register(_memoryviewslice) # <<<<<<<<<<<<<< + * __pyx_collections_abc_Sequence.register(array) + * except: +*/ + __pyx_t_5 = __pyx_collections_abc_Sequence; + __Pyx_INCREF(__pyx_t_5); + __pyx_t_6 = 0; + { + PyObject *__pyx_callargs[2] = {__pyx_t_5, ((PyObject *)__pyx_mstate_global->__pyx_memoryviewslice_type)}; + __pyx_t_4 = __Pyx_PyObject_FastCallMethod((PyObject*)__pyx_mstate_global->__pyx_n_u_register, __pyx_callargs+__pyx_t_6, (2-__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(1, 994, __pyx_L26_error) + __Pyx_GOTREF(__pyx_t_4); + } + __Pyx_DECREF(__pyx_t_4); __pyx_t_4 = 0; + + /* "View.MemoryView":995 + * + * __pyx_collections_abc_Sequence.register(_memoryviewslice) + * __pyx_collections_abc_Sequence.register(array) # <<<<<<<<<<<<<< + * except: + * pass # ignore failure, it's a minor issue +*/ + __pyx_t_5 = __pyx_collections_abc_Sequence; + __Pyx_INCREF(__pyx_t_5); + __pyx_t_6 = 0; + { + PyObject *__pyx_callargs[2] = {__pyx_t_5, ((PyObject *)__pyx_mstate_global->__pyx_array_type)}; + __pyx_t_4 = __Pyx_PyObject_FastCallMethod((PyObject*)__pyx_mstate_global->__pyx_n_u_register, __pyx_callargs+__pyx_t_6, (2-__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(1, 995, __pyx_L26_error) + __Pyx_GOTREF(__pyx_t_4); + } + __Pyx_DECREF(__pyx_t_4); __pyx_t_4 = 0; + + /* "View.MemoryView":990 + * + * try: + * if __pyx_collections_abc_Sequence: # <<<<<<<<<<<<<< + * + * +*/ + } + + /* "View.MemoryView":989 + * pass + * + * try: # <<<<<<<<<<<<<< + * if __pyx_collections_abc_Sequence: + * +*/ + } + __Pyx_XDECREF(__pyx_t_3); __pyx_t_3 = 0; + __Pyx_XDECREF(__pyx_t_2); __pyx_t_2 = 0; + __Pyx_XDECREF(__pyx_t_1); __pyx_t_1 = 0; + goto __pyx_L31_try_end; + __pyx_L26_error:; + __Pyx_XDECREF(__pyx_t_4); __pyx_t_4 = 0; + __Pyx_XDECREF(__pyx_t_5); __pyx_t_5 = 0; + + /* "View.MemoryView":996 + * __pyx_collections_abc_Sequence.register(_memoryviewslice) + * __pyx_collections_abc_Sequence.register(array) + * except: # <<<<<<<<<<<<<< + * pass # ignore failure, it's a minor issue + * +*/ + /*except:*/ { + __Pyx_ErrRestore(0,0,0); + goto __pyx_L27_exception_handled; + } + __pyx_L27_exception_handled:; + __Pyx_XGIVEREF(__pyx_t_3); + __Pyx_XGIVEREF(__pyx_t_2); + __Pyx_XGIVEREF(__pyx_t_1); + __Pyx_ExceptionReset(__pyx_t_3, __pyx_t_2, __pyx_t_1); + __pyx_L31_try_end:; + } + + /* "(tree fragment)":4 + * int __Pyx_CheckUnpickleChecksum(long, long, long, long, const char*) except -1 + * int __Pyx_UpdateUnpickledDict(object, object, Py_ssize_t) except -1 + * def __pyx_unpickle_Enum(__pyx_type, long __pyx_checksum, tuple __pyx_state): # <<<<<<<<<<<<<< + * cdef object __pyx_result + * __Pyx_CheckUnpickleChecksum(__pyx_checksum, 0x82a3537, 0x6ae9995, 0xb068931, b'name') +*/ + __pyx_t_4 = PyCFunction_NewEx(&__pyx_mdef_15View_dot_MemoryView_1__pyx_unpickle_Enum, NULL, __pyx_mstate_global->__pyx_n_u_View_MemoryView); if (unlikely(!__pyx_t_4)) __PYX_ERR(1, 4, __pyx_L1_error) + __Pyx_GOTREF(__pyx_t_4); + if (PyDict_SetItem(__pyx_mstate_global->__pyx_d, __pyx_mstate_global->__pyx_n_u_pyx_unpickle_Enum, __pyx_t_4) < (0)) __PYX_ERR(1, 4, __pyx_L1_error) + __Pyx_DECREF(__pyx_t_4); __pyx_t_4 = 0; + + /* "spacy/pipeline/_parser_internals/nonproj.pyx":6 + * scheme. + * """ + * from copy import copy # <<<<<<<<<<<<<< + * + * from cython.operator cimport dereference as deref +*/ + { + PyObject* const __pyx_imported_names[] = {__pyx_mstate_global->__pyx_n_u_copy}; + __pyx_t_1 = __Pyx_Import(__pyx_mstate_global->__pyx_n_u_copy, __pyx_imported_names, 1, __pyx_mstate_global->__pyx_kp_u_spacy_pipeline__parser_internals_2, -1); if (unlikely(!__pyx_t_1)) __PYX_ERR(0, 6, __pyx_L1_error) + } + __pyx_t_4 = __pyx_t_1; + __Pyx_GOTREF(__pyx_t_4); + { + PyObject* const __pyx_imported_names[] = {__pyx_mstate_global->__pyx_n_u_copy}; + __pyx_t_9 = 0; { + __pyx_t_5 = __Pyx_ImportFrom(__pyx_t_4, __pyx_imported_names[__pyx_t_9]); if (unlikely(!__pyx_t_5)) __PYX_ERR(0, 6, __pyx_L1_error) + __Pyx_GOTREF(__pyx_t_5); + if (PyDict_SetItem(__pyx_mstate_global->__pyx_d, __pyx_imported_names[__pyx_t_9], __pyx_t_5) < (0)) __PYX_ERR(0, 6, __pyx_L1_error) + __Pyx_DECREF(__pyx_t_5); __pyx_t_5 = 0; + } + } + __Pyx_DECREF(__pyx_t_4); __pyx_t_4 = 0; + + /* "spacy/pipeline/_parser_internals/nonproj.pyx":19 + * from ...tokens.doc cimport Doc, set_children_from_heads + * + * from ...errors import Errors # <<<<<<<<<<<<<< + * + * DELIMITER = '||' +*/ + { + PyObject* const __pyx_imported_names[] = {__pyx_mstate_global->__pyx_n_u_Errors}; + __pyx_t_1 = __Pyx_Import(__pyx_mstate_global->__pyx_n_u_errors, __pyx_imported_names, 1, __pyx_mstate_global->__pyx_kp_u_spacy_errors, 3); if (unlikely(!__pyx_t_1)) __PYX_ERR(0, 19, __pyx_L1_error) + } + __pyx_t_4 = __pyx_t_1; + __Pyx_GOTREF(__pyx_t_4); + { + PyObject* const __pyx_imported_names[] = {__pyx_mstate_global->__pyx_n_u_Errors}; + __pyx_t_9 = 0; { + __pyx_t_5 = __Pyx_ImportFrom(__pyx_t_4, __pyx_imported_names[__pyx_t_9]); if (unlikely(!__pyx_t_5)) __PYX_ERR(0, 19, __pyx_L1_error) + __Pyx_GOTREF(__pyx_t_5); + if (PyDict_SetItem(__pyx_mstate_global->__pyx_d, __pyx_imported_names[__pyx_t_9], __pyx_t_5) < (0)) __PYX_ERR(0, 19, __pyx_L1_error) + __Pyx_DECREF(__pyx_t_5); __pyx_t_5 = 0; + } + } + __Pyx_DECREF(__pyx_t_4); __pyx_t_4 = 0; + + /* "spacy/pipeline/_parser_internals/nonproj.pyx":21 + * from ...errors import Errors + * + * DELIMITER = '||' # <<<<<<<<<<<<<< + * + * +*/ + if (PyDict_SetItem(__pyx_mstate_global->__pyx_d, __pyx_mstate_global->__pyx_n_u_DELIMITER, __pyx_mstate_global->__pyx_kp_u__6) < (0)) __PYX_ERR(0, 21, __pyx_L1_error) + + /* "spacy/pipeline/_parser_internals/nonproj.pyx":24 + * + * + * def ancestors(tokenid, heads): # <<<<<<<<<<<<<< + * # Returns all words going from the word up the path to the root. The path + * # to root cannot be longer than the number of words in the sentence. This +*/ + __pyx_t_4 = __Pyx_CyFunction_New(&__pyx_mdef_5spacy_8pipeline_17_parser_internals_7nonproj_1ancestors, 0, __pyx_mstate_global->__pyx_n_u_ancestors, NULL, __pyx_mstate_global->__pyx_n_u_spacy_pipeline__parser_internals, __pyx_mstate_global->__pyx_d, ((PyObject *)__pyx_mstate_global->__pyx_codeobj_tab[0])); if (unlikely(!__pyx_t_4)) __PYX_ERR(0, 24, __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_ancestors, __pyx_t_4) < (0)) __PYX_ERR(0, 24, __pyx_L1_error) + __Pyx_DECREF(__pyx_t_4); __pyx_t_4 = 0; + + /* "spacy/pipeline/_parser_internals/nonproj.pyx":39 + * + * + * def contains_cycle(heads): # <<<<<<<<<<<<<< + * # in an acyclic tree, the path from each word following the head relation + * # upwards always ends at the root node +*/ + __pyx_t_4 = __Pyx_CyFunction_New(&__pyx_mdef_5spacy_8pipeline_17_parser_internals_7nonproj_4contains_cycle, 0, __pyx_mstate_global->__pyx_n_u_contains_cycle, NULL, __pyx_mstate_global->__pyx_n_u_spacy_pipeline__parser_internals, __pyx_mstate_global->__pyx_d, ((PyObject *)__pyx_mstate_global->__pyx_codeobj_tab[2])); if (unlikely(!__pyx_t_4)) __PYX_ERR(0, 39, __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_contains_cycle, __pyx_t_4) < (0)) __PYX_ERR(0, 39, __pyx_L1_error) + __Pyx_DECREF(__pyx_t_4); __pyx_t_4 = 0; + + /* "spacy/pipeline/_parser_internals/nonproj.pyx":51 + * + * + * def is_nonproj_arc(tokenid, heads): # <<<<<<<<<<<<<< + * cdef vector[int] c_heads = _heads_to_c(heads) + * return _is_nonproj_arc(tokenid, c_heads) +*/ + __pyx_t_4 = __Pyx_CyFunction_New(&__pyx_mdef_5spacy_8pipeline_17_parser_internals_7nonproj_6is_nonproj_arc, 0, __pyx_mstate_global->__pyx_n_u_is_nonproj_arc, NULL, __pyx_mstate_global->__pyx_n_u_spacy_pipeline__parser_internals, __pyx_mstate_global->__pyx_d, ((PyObject *)__pyx_mstate_global->__pyx_codeobj_tab[3])); if (unlikely(!__pyx_t_4)) __PYX_ERR(0, 51, __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_is_nonproj_arc, __pyx_t_4) < (0)) __PYX_ERR(0, 51, __pyx_L1_error) + __Pyx_DECREF(__pyx_t_4); __pyx_t_4 = 0; + + /* "spacy/pipeline/_parser_internals/nonproj.pyx":115 + * + * + * def is_nonproj_tree(heads): # <<<<<<<<<<<<<< + * cdef vector[int] c_heads = _heads_to_c(heads) + * # a tree is non-projective if at least one arc is non-projective +*/ + __pyx_t_4 = __Pyx_CyFunction_New(&__pyx_mdef_5spacy_8pipeline_17_parser_internals_7nonproj_8is_nonproj_tree, 0, __pyx_mstate_global->__pyx_n_u_is_nonproj_tree, NULL, __pyx_mstate_global->__pyx_n_u_spacy_pipeline__parser_internals, __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 + if (PyDict_SetItem(__pyx_mstate_global->__pyx_d, __pyx_mstate_global->__pyx_n_u_is_nonproj_tree, __pyx_t_4) < (0)) __PYX_ERR(0, 115, __pyx_L1_error) + __Pyx_DECREF(__pyx_t_4); __pyx_t_4 = 0; + + /* "spacy/pipeline/_parser_internals/nonproj.pyx":121 + * + * + * def decompose(label): # <<<<<<<<<<<<<< + * return label.partition(DELIMITER)[::2] + * +*/ + __pyx_t_4 = __Pyx_CyFunction_New(&__pyx_mdef_5spacy_8pipeline_17_parser_internals_7nonproj_10decompose, 0, __pyx_mstate_global->__pyx_n_u_decompose, NULL, __pyx_mstate_global->__pyx_n_u_spacy_pipeline__parser_internals, __pyx_mstate_global->__pyx_d, ((PyObject *)__pyx_mstate_global->__pyx_codeobj_tab[5])); if (unlikely(!__pyx_t_4)) __PYX_ERR(0, 121, __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_decompose, __pyx_t_4) < (0)) __PYX_ERR(0, 121, __pyx_L1_error) + __Pyx_DECREF(__pyx_t_4); __pyx_t_4 = 0; + + /* "spacy/pipeline/_parser_internals/nonproj.pyx":125 + * + * + * def is_decorated(label): # <<<<<<<<<<<<<< + * return DELIMITER in label + * +*/ + __pyx_t_4 = __Pyx_CyFunction_New(&__pyx_mdef_5spacy_8pipeline_17_parser_internals_7nonproj_12is_decorated, 0, __pyx_mstate_global->__pyx_n_u_is_decorated, NULL, __pyx_mstate_global->__pyx_n_u_spacy_pipeline__parser_internals, __pyx_mstate_global->__pyx_d, ((PyObject *)__pyx_mstate_global->__pyx_codeobj_tab[6])); if (unlikely(!__pyx_t_4)) __PYX_ERR(0, 125, __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_is_decorated, __pyx_t_4) < (0)) __PYX_ERR(0, 125, __pyx_L1_error) + __Pyx_DECREF(__pyx_t_4); __pyx_t_4 = 0; + + /* "spacy/pipeline/_parser_internals/nonproj.pyx":129 + * + * + * def count_decorated_labels(gold_data): # <<<<<<<<<<<<<< + * freqs = {} + * for example in gold_data: +*/ + __pyx_t_4 = __Pyx_CyFunction_New(&__pyx_mdef_5spacy_8pipeline_17_parser_internals_7nonproj_14count_decorated_labels, 0, __pyx_mstate_global->__pyx_n_u_count_decorated_labels, NULL, __pyx_mstate_global->__pyx_n_u_spacy_pipeline__parser_internals, __pyx_mstate_global->__pyx_d, ((PyObject *)__pyx_mstate_global->__pyx_codeobj_tab[7])); if (unlikely(!__pyx_t_4)) __PYX_ERR(0, 129, __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_count_decorated_labels, __pyx_t_4) < (0)) __PYX_ERR(0, 129, __pyx_L1_error) + __Pyx_DECREF(__pyx_t_4); __pyx_t_4 = 0; + + /* "spacy/pipeline/_parser_internals/nonproj.pyx":146 + * + * + * def projectivize(heads, labels): # <<<<<<<<<<<<<< + * # Use the algorithm by Nivre & Nilsson 2005. Assumes heads to be a proper + * # tree, i.e. connected and cycle-free. Returns a new pair (heads, labels) +*/ + __pyx_t_4 = __Pyx_CyFunction_New(&__pyx_mdef_5spacy_8pipeline_17_parser_internals_7nonproj_16projectivize, 0, __pyx_mstate_global->__pyx_n_u_projectivize, NULL, __pyx_mstate_global->__pyx_n_u_spacy_pipeline__parser_internals, __pyx_mstate_global->__pyx_d, ((PyObject *)__pyx_mstate_global->__pyx_codeobj_tab[8])); if (unlikely(!__pyx_t_4)) __PYX_ERR(0, 146, __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_projectivize, __pyx_t_4) < (0)) __PYX_ERR(0, 146, __pyx_L1_error) + __Pyx_DECREF(__pyx_t_4); __pyx_t_4 = 0; + + /* "spacy/pipeline/_parser_internals/nonproj.pyx":176 + * + * + * cpdef deprojectivize(Doc doc): # <<<<<<<<<<<<<< + * # Reattach arcs with decorated labels (following HEAD scheme). For each + * # decorated arc X||Y, search top-down, left-to-right, breadth-first until +*/ + __pyx_t_4 = __Pyx_CyFunction_New(&__pyx_mdef_5spacy_8pipeline_17_parser_internals_7nonproj_18deprojectivize, 0, __pyx_mstate_global->__pyx_n_u_deprojectivize, NULL, __pyx_mstate_global->__pyx_n_u_spacy_pipeline__parser_internals, __pyx_mstate_global->__pyx_d, ((PyObject *)__pyx_mstate_global->__pyx_codeobj_tab[9])); if (unlikely(!__pyx_t_4)) __PYX_ERR(0, 176, __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_deprojectivize, __pyx_t_4) < (0)) __PYX_ERR(0, 176, __pyx_L1_error) + __Pyx_DECREF(__pyx_t_4); __pyx_t_4 = 0; + + /* "spacy/pipeline/_parser_internals/nonproj.pyx":191 + * + * + * def _decorate(heads, proj_heads, labels): # <<<<<<<<<<<<<< + * # uses decoration scheme HEAD from Nivre & Nilsson 2005 + * if (len(heads) != len(proj_heads)) or (len(proj_heads) != len(labels)): +*/ + __pyx_t_4 = __Pyx_CyFunction_New(&__pyx_mdef_5spacy_8pipeline_17_parser_internals_7nonproj_20_decorate, 0, __pyx_mstate_global->__pyx_n_u_decorate, NULL, __pyx_mstate_global->__pyx_n_u_spacy_pipeline__parser_internals, __pyx_mstate_global->__pyx_d, ((PyObject *)__pyx_mstate_global->__pyx_codeobj_tab[10])); if (unlikely(!__pyx_t_4)) __PYX_ERR(0, 191, __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_decorate, __pyx_t_4) < (0)) __PYX_ERR(0, 191, __pyx_L1_error) + __Pyx_DECREF(__pyx_t_4); __pyx_t_4 = 0; + + /* "spacy/pipeline/_parser_internals/nonproj.pyx":206 + * + * + * def get_smallest_nonproj_arc_slow(heads): # <<<<<<<<<<<<<< + * cdef vector[int] c_heads = _heads_to_c(heads) + * return _get_smallest_nonproj_arc(c_heads) +*/ + __pyx_t_4 = __Pyx_CyFunction_New(&__pyx_mdef_5spacy_8pipeline_17_parser_internals_7nonproj_22get_smallest_nonproj_arc_slow, 0, __pyx_mstate_global->__pyx_n_u_get_smallest_nonproj_arc_slow, NULL, __pyx_mstate_global->__pyx_n_u_spacy_pipeline__parser_internals, __pyx_mstate_global->__pyx_d, ((PyObject *)__pyx_mstate_global->__pyx_codeobj_tab[11])); if (unlikely(!__pyx_t_4)) __PYX_ERR(0, 206, __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_get_smallest_nonproj_arc_slow, __pyx_t_4) < (0)) __PYX_ERR(0, 206, __pyx_L1_error) + __Pyx_DECREF(__pyx_t_4); __pyx_t_4 = 0; + + /* "spacy/pipeline/_parser_internals/nonproj.pyx":231 + * + * + * cpdef int _lift(tokenid, heads): # <<<<<<<<<<<<<< + * # reattaches a word to it's grandfather + * head = heads[tokenid] +*/ + __pyx_t_4 = __Pyx_CyFunction_New(&__pyx_mdef_5spacy_8pipeline_17_parser_internals_7nonproj_24_lift, 0, __pyx_mstate_global->__pyx_n_u_lift, NULL, __pyx_mstate_global->__pyx_n_u_spacy_pipeline__parser_internals, __pyx_mstate_global->__pyx_d, ((PyObject *)__pyx_mstate_global->__pyx_codeobj_tab[12])); if (unlikely(!__pyx_t_4)) __PYX_ERR(0, 231, __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_lift, __pyx_t_4) < (0)) __PYX_ERR(0, 231, __pyx_L1_error) + __Pyx_DECREF(__pyx_t_4); __pyx_t_4 = 0; + + /* "spacy/pipeline/_parser_internals/nonproj.pyx":241 + * + * + * def _find_new_head(token, headlabel): # <<<<<<<<<<<<<< + * # search through the tree starting from the head of the given token + * # returns the id of the first descendant with the given label +*/ + __pyx_t_4 = __Pyx_CyFunction_New(&__pyx_mdef_5spacy_8pipeline_17_parser_internals_7nonproj_26_find_new_head, 0, __pyx_mstate_global->__pyx_n_u_find_new_head, NULL, __pyx_mstate_global->__pyx_n_u_spacy_pipeline__parser_internals, __pyx_mstate_global->__pyx_d, ((PyObject *)__pyx_mstate_global->__pyx_codeobj_tab[13])); if (unlikely(!__pyx_t_4)) __PYX_ERR(0, 241, __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_find_new_head, __pyx_t_4) < (0)) __PYX_ERR(0, 241, __pyx_L1_error) + __Pyx_DECREF(__pyx_t_4); __pyx_t_4 = 0; + + /* "spacy/pipeline/_parser_internals/nonproj.pyx":1 + * # cython: infer_types=True # <<<<<<<<<<<<<< + * """Implements the projectivize/deprojectivize mechanism in Nivre & Nilsson 2005 + * for doing pseudo-projective parsing implementation uses the HEAD decoration +*/ + __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_4); + __Pyx_XDECREF(__pyx_t_5); + if (__pyx_m) { + if (__pyx_mstate->__pyx_d && stringtab_initialized) { + __Pyx_AddTraceback("init spacy.pipeline._parser_internals.nonproj", __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 spacy.pipeline._parser_internals.nonproj"); + } + __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_enumerate = __Pyx_GetBuiltinName(__pyx_mstate->__pyx_n_u_enumerate); if (!__pyx_builtin_enumerate) __PYX_ERR(0, 137, __pyx_L1_error) + __pyx_builtin___import__ = __Pyx_GetBuiltinName(__pyx_mstate->__pyx_n_u_import); if (!__pyx_builtin___import__) __PYX_ERR(1, 101, __pyx_L1_error) + __pyx_builtin_Ellipsis = __Pyx_GetBuiltinName(__pyx_mstate->__pyx_n_u_Ellipsis); if (!__pyx_builtin_Ellipsis) __PYX_ERR(1, 409, __pyx_L1_error) + __pyx_builtin_id = __Pyx_GetBuiltinName(__pyx_mstate->__pyx_n_u_id); if (!__pyx_builtin_id) __PYX_ERR(1, 619, __pyx_L1_error) + + /* Cached unbound methods */ + __pyx_mstate->__pyx_umethod_PyDict_Type_get.type = (PyObject*)&PyDict_Type; + __pyx_mstate->__pyx_umethod_PyDict_Type_get.method_name = &__pyx_mstate->__pyx_n_u_get; + __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); + + /* "(tree fragment)":11 + * use_setstate = True + * else: + * use_setstate = ('self.name is not None',) # <<<<<<<<<<<<<< + * if use_setstate: + * return __pyx_unpickle_Enum, (type(self), 0x82a3537, None), state +*/ + __pyx_mstate_global->__pyx_tuple[0] = PyTuple_Pack(1, __pyx_mstate_global->__pyx_kp_u_self_name_is_not_None); if (unlikely(!__pyx_mstate_global->__pyx_tuple[0])) __PYX_ERR(1, 11, __pyx_L1_error) + __Pyx_GOTREF(__pyx_mstate_global->__pyx_tuple[0]); + __Pyx_GIVEREF(__pyx_mstate_global->__pyx_tuple[0]); + + /* "View.MemoryView":583 + * def suboffsets(self): + * if self.view.suboffsets == NULL: + * return (-1,) * self.view.ndim # <<<<<<<<<<<<<< + * + * return tuple([suboffset for suboffset in self.view.suboffsets[:self.view.ndim]]) +*/ + __pyx_mstate_global->__pyx_tuple[1] = PyTuple_New(1); if (unlikely(!__pyx_mstate_global->__pyx_tuple[1])) __PYX_ERR(1, 583, __pyx_L1_error) + __Pyx_GOTREF(__pyx_mstate_global->__pyx_tuple[1]); + __Pyx_INCREF(__pyx_mstate_global->__pyx_int_neg_1); + __Pyx_GIVEREF(__pyx_mstate_global->__pyx_int_neg_1); + if (__Pyx_PyTuple_SET_ITEM(__pyx_mstate_global->__pyx_tuple[1], 0, __pyx_mstate_global->__pyx_int_neg_1) != (0)) __PYX_ERR(1, 583, __pyx_L1_error); + __Pyx_GIVEREF(__pyx_mstate_global->__pyx_tuple[1]); + + /* "View.MemoryView":680 + * tup = index if isinstance(index, tuple) else (index,) + * + * result = [slice(None)] * ndim # <<<<<<<<<<<<<< + * have_slices = False + * seen_ellipsis = False +*/ + __pyx_mstate_global->__pyx_slice[0] = PySlice_New(Py_None, Py_None, Py_None); if (unlikely(!__pyx_mstate_global->__pyx_slice[0])) __PYX_ERR(1, 680, __pyx_L1_error) + __Pyx_GOTREF(__pyx_mstate_global->__pyx_slice[0]); + __Pyx_GIVEREF(__pyx_mstate_global->__pyx_slice[0]); + + /* "spacy/pipeline/_parser_internals/nonproj.pyx":122 + * + * def decompose(label): + * return label.partition(DELIMITER)[::2] # <<<<<<<<<<<<<< + * + * +*/ + __pyx_mstate_global->__pyx_slice[1] = PySlice_New(Py_None, Py_None, __pyx_mstate_global->__pyx_int_2); if (unlikely(!__pyx_mstate_global->__pyx_slice[1])) __PYX_ERR(0, 122, __pyx_L1_error) + __Pyx_GOTREF(__pyx_mstate_global->__pyx_slice[1]); + __Pyx_GIVEREF(__pyx_mstate_global->__pyx_slice[1]); + #if CYTHON_IMMORTAL_CONSTANTS + { + PyObject **table = __pyx_mstate->__pyx_tuple; + for (Py_ssize_t i=0; i<2; ++i) { + #if CYTHON_COMPILING_IN_CPYTHON_FREETHREADING + Py_SET_REFCNT(table[i], _Py_IMMORTAL_REFCNT_LOCAL); + #else + Py_SET_REFCNT(table[i], _Py_IMMORTAL_INITIAL_REFCNT); + #endif + } + } + #endif + #if CYTHON_IMMORTAL_CONSTANTS + { + PyObject **table = __pyx_mstate->__pyx_slice; + for (Py_ssize_t i=0; i<2; ++i) { + #if CYTHON_COMPILING_IN_CPYTHON_FREETHREADING + Py_SET_REFCNT(table[i], _Py_IMMORTAL_REFCNT_LOCAL); + #else + 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: 8; } index[] = {{2},{68},{35},{54},{37},{60},{24},{52},{26},{34},{29},{33},{45},{22},{15},{179},{37},{30},{32},{1},{1},{1},{1},{2},{1},{8},{5},{6},{15},{23},{25},{7},{6},{2},{6},{35},{9},{30},{50},{39},{34},{8},{21},{12},{37},{44},{20},{32},{22},{30},{37},{5},{9},{3},{4},{8},{6},{4},{20},{4},{8},{15},{3},{3},{15},{15},{8},{9},{18},{4},{1},{7},{12},{5},{8},{9},{17},{18},{5},{3},{14},{4},{5},{22},{9},{11},{9},{9},{4},{14},{8},{3},{15},{6},{9},{5},{6},{7},{14},{5},{6},{7},{5},{8},{7},{3},{11},{29},{12},{9},{4},{9},{5},{1},{2},{10},{5},{13},{12},{14},{15},{32},{8},{5},{8},{5},{6},{5},{8},{7},{4},{10},{7},{8},{12},{4},{8},{4},{7},{8},{4},{10},{3},{4},{9},{3},{10},{12},{14},{11},{10},{19},{14},{6},{12},{5},{10},{17},{13},{8},{4},{4},{12},{10},{12},{19},{5},{4},{15},{40},{5},{5},{4},{4},{6},{8},{5},{5},{7},{6},{6},{5},{6},{4},{1},{79},{154},{22},{21},{16},{71},{17},{98},{117},{117},{11},{142},{2},{2},{49},{51},{39},{1}}; + #if (CYTHON_COMPRESS_STRINGS) == 2 /* compression: bz2 (2136 bytes) */ +const char* const cstring = "BZh91AY&SY\222?\014\224\000\001-\377\377\377\377\377\371\377\377\377\367\277\377\377\340\277\377\377\377@@@@@@@@@@@@@\000@\000`\007\333\347a\324#q[KR\261\r\031\0318\034\032\247\242h\230\246\320\323AOOA\221\222G\220\217SOI\3513Q\247\242h\310d\000\323&\236\241\243`Pa2i\211\265\006\204\023\010\3215O\024\311\211\344Oj4\215\000\006\200\000\000\000\000\000\000\000=@\001\246\200\220\022\232\236M4\312=M\352\232=G\250h\000\320\321\240\000\000\000\000\0004h\323d\323(\004\030\0010\000\000\t\200\004\300\000\000&\000M\014\000\000\000\000\000A\200\023\000\000\000\230\000L\000\000\002`\004\320\300\000\000\000\000\001\"D4&B\236\t\251\223S\032\236\246\230A\243F\200\3204\032\000\000\000\000\032\000\000\002\324A\034\377wt\202w\267\370\025F\373\016\257\010\342\021\305T\022j\024\323\240~)H\237\363\375c`6\220\330O2+\377\225\237\366\271+\022(\324\225\233\010\245\266\226\316N\032ZX\331P\350\202\326A3-\273e\227x\206;\004\310V\336\262Z\031\270\225\243\021\026\261=\002\027\311\341\323\222\312\0255P\300$\361CrV\002\247\203`kL\247FhN\273Q\003\356\350\216\230\374Ct\333\244\177=\341\246}\206\264\372\355o1GC\031\351:[+\005\302I#\324a<\353\224^\027\240\266\273\206p\n\316\375\033.G$>oW\267\364\236\337\306:\236\265\252\263\021\230e\266\214\205$h\227V\337v8\210\034\030`\3449kbC\013q\233\206`\360Z\260[\354U\250>lU\230\007\006\226\241\3646\213]\2265\254w\006\340\335\345\247-\321y\216\275\303\203\251a\023\200\313C\217\355\266\240\013\020KFP\226\034e\205\006\234X\352B\363\002\2540\023\001\226g\254\251\266\266\235A\r \362\237V6\241\307Q\3732\357\253\365\235P\232\372\023kl\215\206vP~Xp\341\010\326\355\253\354\333ISU\014\000\270\024\362&\003\204\n\271G\330\\B\302\270BmG\256T\346\326,\222Z]\2649\034%\320\243\210b\022q\"\0349\217\226\205\032\304q\010\036\233\260o\265\023 U\214\274f/\357\357d0\244\214\254\027\270\365S?\017\353z\205Lm\371\314\3104\331)\250s\2364\215(k\256\336\304\363\303\013\263D\216\314\300\372\031#NUa\2236\242\025\010\212\250\207\214\0330\200\341\222L\217\002\026\257\324;\256CX&\304x\263\242J""\222%\300z\335L\361\262\0160\221]M\267\355\245\210\021\245@f\355\016\262\371\rh\346n\277a\002\230\n\207f\260P\246\013\034)f\nsG\224\362\370\246\221\220\201t+W\207A\305\352 \214\206x\301\031\305\037%3l\260\266\024\203\" \253#+6c\360\312\240 \222\210\3137\346\203\014\r\246\220\265\030\264\350\267\204\tM#8\033j\257\021\200+\036\332\220\210B\030\005\304\375\377\243D\314\rx\3653,?\013I#WK\237L]\350\034\203\267\202\240\305U\227p\324\026\353\262ZB\315\216f\203^\201\332\241\340\211\352%\254\352\226\272\312\231\331\007\t\301\316\224\242\036Lzf\361y\002\325\311\010\002A\261\3656\356ok\277<\356\014/\2130\taT[QD.\240TZ\343q\263k8\316W\345\244\373\311\246\332\013aW\214\234H\307\260J\2611\020\244$\020\321\006Q[X\315{6\256\206kna\010\352\311\301\016JE\304\023\237\036Q\2561\307L\330l\216JB^\215Z\247\010\0200\002\316^\034\240u\n\205\010^y\200\305\3004,\213!\2402\017\267Fg\356AG:d\345\252\323\014\354Qc\314\271\255\322\352\305\000\343\251\201\027dnx\016\370;\342^\215\353\027U\3434@DJ\262\340\224Q\323t\200H\245vT\272\023n\006w\302`\252\366@\345o\264xJ\036&\326m\027q\255\222*\010\224\364\215\020d\242:\262\342g\n+\231X\003X\340W\024\325\314\222#~\357\n\214D\216\024\244\326{\251\301=\315\267\032p5\305\321\256\233\0103\323K\033cn\025ZR\2612\343y\264\367\031!\243\021\241\340\250\r\032n4\030\272B\220%*\032%\237T\226\331\2176\306\024\353\306tv\314\252\322.9\275l\326KV-\2072\025+\276\027\021\206\332\232b\336s7\273K3nTc$h\306\343\371m\215\322\311\273\324p,\246\345x4i\316\302\225\313l\341\242\340`l\255V\373\034S\210\023$P\006\014\334Q\210 \360\036\003\035\245a\275S\255\267\264\213VJWo<\236Gc'\240f\376\3009)\227Dts@0\323~\026Fu\252\260\263jq\360\003s\220\2557HtQzh\310bY*-\316|dsJ\016\352\222\327\253\201HNI\223\r\204{\310x\r\225\206\273\354]b\002\240\233\004\206\330yD\231K\263\260\204\323r\300\252RAV\331ftrX\251\273\020\357p\342\221\222aV\320jo\035\332\252\007\177\\\325q\001X\303\014`\306\265a\306\342\335Z\233\255I\027\323\243he\226\226\330\330\311\030\024H\266\353\230\234\ns\236\251MML\322\354""\3071V\211\005\354T\270\310R\336 g\346\225\270\254:\313\322;\233\326\252Ly\0138#\030\010\346O\306%P\230V\215\373\240\257\2209Iq\231}PD\331XL\314\224,\370\336\r\215\205FE\361\021\216R\234<\035\307\236V\275H\013\030\263\034\371\362\210\305\227I\024\364\274/\315rv\240\324\345tU\277\222e\213\022\220f\266#\027K\2232Q)\261\263\207\227\320\355\216\223'>]\264i\213}\270i\2507\003Z\222\320qM\031\304e9\305\304W\302q\355\245b\311\034\211Na4\212\214\002g\006!_)\223\034\224\020\3244\350\210K1\237Vq\237%F\320\"\312\242\375\223+\022\350\334\240\025gD\211\376\336\013R\204\232\260~\260\346\t\320g\300\265\354\227\216?#\220\205\373+\341\"\253%\t\226\332h\252\013:\0135\266t\357\016\307\032Y\200\262\353\222\326\2623Fy\231\271\311\237\227>\257\320\231\327\2730\307\177637MF\310\330\324\206\023\322i'2\367KT\330\322\345H\202\316N\254\223\311qk\202\330\311ga\025\225\243$\025\316LlT\276\021DJ\336\215\262\265F\026\027:\031\321\272\212\261\242y\213&\203\350B\241\"\010_\205\222*\032\r\246\024\013Vd\032\362\214I\316\3067\335D\316\262\313\265H8\010\0208\254\355\240=\001\210\306\031MtY\033z\006Y\351\247\250:\332\014%\227\233\005\224O\302f\303\003Q\305\207\234\343\252H\341\306\224J\326\233\240\357\211n\223.\033lO\312f}A\000m\201\217\274|\355.n|\032\253\000?\016\002?\214\244\273\241w\205\247\300\222\357\312\333\004<\214A\322\202\263\300\020g\001\301\250\220\205\333\254\215[#\343\"\035`m\303\254>\263\005\376\225\nD\n\317}@i\251Y\263YR=\256\364TS\206\000\031\020\022\255\010b\371\323\354e\343\345\235\225\207+V\026\241|\203\360\006\3315\035\017\314A\016TS\254\274\010\301\010^Sc\033-\326\363c\246%\322\004\255\001\354&/D;R3##Z\260\005\313\205\210P7\307uhs\241\304U\355J\272\375'\341\031Y{\361\001xH\271\024\230p\034iFhnG2`\035\321\263\370A\317?\311\320\037\003\375\203\266\312\201K\250qW\206\020F$;\264\367\233TT\355\361\302\342\273w\337\013\327\345\232\000\242r\0310\272\267\357\370\236G\t\201\232\232h:\253\023j&\243\"\335\307\037\037\217D\364\330U\206\"K\033\277\355\260[DT\333\352\207j\240v\224\373\221\324\221m\216qg*S\\q)O\243~\222l\365\017\354\336'\352\322>\310k\211\330\213\030\347\241tcGr\316\334\330\226\252}}\007d\356*\341\341\255\243\264\2128\327q'\350\325\270\343\207\262\326\301=e\375\260\226P^\301\230\352\220\364&\315\342\216@_|lQ\"\367\330H\257U\323\242#G\235\361\334\327\322\004\302\351\325d\030\372\241)\326\201\n\2402-k<\020\241\221!W""\032\"\323 \270\346\370A\317\032\335\035\031\335\375\304\350.\212\tB\377M-\350\355\257\026\223\307\375\200\200O\317\250CNx\370\340\375\311i|\"\013\341y\276c\307\227\205\303\025\221\250\375\217\267Ek\221\217r\372\325\352\333k\033\033\353\215\315\215g\033\257\033\257\326\033/\033\367\036~\333\360<\025\030e\032\026\200\247\215\372:\347/{\373\370\254\243\267\370sP\376J\266^\275x\361z[vc\251\035I\355Y\033w*\224\006-\216\302\362B\360\264\335\343vr)(F\340\232\211\374p\364\327\010\323\323\216\362\201g\210y\003\030MS\030\3518|\007\363\3218\234\360+\327;\312s\355#\224\032\322\240\346\344|\264h\313\210TG[8\001\007\024\323\221M\341\274u<\214LGG$w\241\264\341N\317A{\200@\007\335\031\331\007wq@\303\304\345\236hJ\317\320\036\207A\261\030\237uh\376\216\255e@F\310\321\366?$\317\271Khq\327w\\\232.\\\031^\210\016\210a J\210\324N-\253\263Blr_t0\206y\013\034s-\367l\275-O\264\rZ\007:.'f+\224]T\334\212\265\303Q\257\306d\rQ6\376q\214\320\266\226.-M\007\220\003[^\212\217\213\320\341\206H \214LD\324\360\266\357\271\234\364B\221\350c\013\2640+\345r^t\013\376\322\027\001\225pB\017\326'\305c=\021db\027\205R~\264\255\255\222,<\363\270Vf\216\367\324?\262\230\025\345\300\260i\024`sO\265\220A\007\214\341);\364eG\337(\330\370n\014\264\270.t\241Kv\364\204V\250\265aP<1\240\270\205\365\004[$\020\321\207C\307\261\004=H\344-\272\027\022\302\034\013\374`\354\351Cn\321\310\334\331\221\316[\023w\212]\t(--\335v\025\353@9o\221cC\217\354v\355\317\000\316\273\221\377\226\344\333\215\205W\344gs\030\017\302\223U12'\016\300\004\226me0^\014\204\204i\013\252\360\275T\026\212U9W\355\272\314lb=\362h\007\002\301=\326J@\014\376\354\320+\t5\201\247\310e\210\007:$\362\361\tcR}D\316x\264\023\372{\266N\373P.\360\000\300q\000\305I|\335\307\305\303\354\371\241\273\017\357\354Vq\237\2258\362\3736\023\376\373\342\330\360\327\344f\215}s\033S0\262\217\305ST\367\3114\240_T\005_\357+\307\3233\375\251\376R\377I\262\2348i5\275\223E\371r.\362w\007\313\007\316a\365p~8\363\313\376\233\264\222^N\343\354I\276\224?\035\254\r\272\007\225""\341\355\357\016.\034\324\017\266\206\267\357\017\266\017*\007\325\341\364\227\311\374\020\356f\223\253\351\265l>[\032\316\234\355\337O\246\222G\351V*\206sW\222\275T\244aV\315~\233W\362k\203\371\301\243\203\255\203\326a\375p\353\270|\271\233meb8}\266\277\364\2762\234\376*\375G>\237/\321\376\373t>\375.\253\177xzt\366fV\317\266&\016\217\247\177\225\212\367\225\377|v\352\364l\377lr\037y_H\353\351\326p\346\\\337$\363\311RR\037\316\314\3657\323Yd\261\010's\347\372\275t*]\032\236\277\222t\207s\347\223\351\244\236l\235d@\371\237A\350G\331v^\201\337\231S\247\277\350\327\373?P\241g\372\300\346\022\214\341\360\317\211\240\313\263@\251;<\177\201\002\017/^\242\325\003J\240\\\337O?K\235\254:\274x\203\002^O\027\220\004|\234O\312H\025\n9\327\257\023\210g\023\300w1\331\314\346\362z\376\267\301\346a\345\260:\274\263R,\216\361\246>\234\273\234\310t9mg?\202/\233\374T\362\220P\312\266\000\300\354\027\375\r$\207\002\337\245KH\341\277\222D\310z\206\334\255\244\335\014\257\317\034\235\271\236\336\004\2633\266\340\243k\337\344\363\224s\375\350\322\255\2742\234\271~t}y\2604\250\2230\026\221\303\223l\025i\"\344j\322-\300}\224l\247%\254\263\375\323\004+T(\010\221)\000w\025\360\374&{\225u\363_\220\343\322\234t\364\317\254\221_\2669b\363/h\306\311\253\371\315\\P\265aRM~\235.genexpris_spaceitemsitemsizelabellabels_lift__main__memviewmode__module__n_headsn_labelsn_proj_headsname__name__ndim__new__new_headnextnext_queueobjpackpartitionpopproj_headsprojectivize__pyx_checksum__pyx_state__pyx_type__pyx_unpickle_Enum__pyx_vtable__qtoken__qualname__queue__reduce____reduce_cython____reduce_ex__registerseensend__set_name__setdefault__setstate____setstate_cython__shapesizesmallest_np_arcspacy.pipeline._parser_internals.nonprojsplitstartstepstopstruct__test__throwtokentokenidunpackupdatevaluevalueswordxint (struct __pyx_t_5spacy_7structs_TokenC *, int, int)\000set_children_from_heads\200\001\340\004\010\210\003\2101\210G\2203\220c\230\021\230-\240t\2503\250a\250|\2703\270c\300\021\300!\330\010\016\210j\230\001\230\026\230u\240G\2501\250H\260C\260q\270\001\330,9\270\023\270A\270Q\330,5\260S\270\001\270\021\330\004\022\220!\330\004\010\210\t\220\030\230\031\240!\2401\330\010\013\2105\220\003\220:\230Q\230a\330\014\027\220w\230a\230r\240\021\240&\250\001\250\031\260!\260:\270Q\270f\300A\300Q\340\014\027\220w\230a\230v\240Q\240a\330\004\013\2101\200\001\330\004\037\230{\250!\2501\330\004\013\210?\230!\2309\240A\200\001\330\004\037\230{\250!\2501\330\004\013\320\013$\240A\240Q\200\001\330\004\037\230{\250!\2501\340\004\036\230a\200\001\360\006\000\005\t\210\013\2205\230\001\230\023\230A\230Q\330\010\017\210s\220!\2201\220A\330\010\014\210L\230\t\240\021\240)\2501\330\014\017\210y\230\003\2301\330\020\027\220q\330\014\020\220\004\220A\220Q\330\004\013\2101\200\001\330\004\013\2105\220\n\230!\230:\240S\250\001\200\001\360\010\000\005\r\210A\210U\220!\330\004\n\210!\330\010\025\220Q\330\010\014\210J\220a\330\014\020\220\t\230\026\230q\330\020\023\2205\230\001\330\024\025\330\020\023\2206\230\023\230A\330\024\025\330\020\023\2205\230\006\230c\240\021\330\024\033\2301\330\020\032\230'\240\021\240!\330\010\020\220\001\330\004\013\2105\220\001\200\001\330\004\014\210A\330\004\010\210\013\2201\330\010\024\220L\240\014\250A\250W\260L\300""\001\300\021\330-4\260L\300\001\300\021\340\010\024\220A\330\014\026\220e\2303\230g\240Y\250a\250q\330\014\020\220\003\2208\2309\240A\240Q\360\006\000\t\r\210I\220Q\330\014\017\210|\2301\230A\330\020\025\220Q\220i\230u\240D\250\001\250\027\260\003\2602\260Q\330\004\013\2101\200\001\360\010\000\005\022\220\024\220Q\220a\360\006\000\005%\240K\250q\260\001\330\004\037\320\0378\270\001\270\021\330\004\007\320\007\027\220t\2301\330\010\017\210|\2304\230q\240\001\330\004\n\320\n\032\230$\230a\330\010\023\2205\230\001\320\031*\250!\330\010\024\220A\320\025(\250\001\330\010\032\320\0323\2601\260A\330\004\022\220)\2301\230G\240<\250q\330\004\013\210<\220q\200\001\330\004\013\210:\220S\230\001\200\001\360\010\000\005\t\210\005\210U\220!\2203\220a\330\010\020\220\003\2206\230\030\240\021\240#\240R\240q\250\002\250!\330\010\013\210:\220S\230\001\330\014\027\220}\240E\250\026\250q\260\001\330\014\027\220~\240Q\240c\250\021\250$\250a\330\014\017\210r\220\021\220\"\220H\230H\240C\240r\250\021\330\014\017\210r\220\021\220\"\220G\2303\230f\240H\250D\260\001\260\033\320__pyx_string_tab; + Py_ssize_t pos = 0; + for (int i = 0; i < 185; i++) { + Py_ssize_t bytes_length = index[i].length; + PyObject *string = PyUnicode_DecodeUTF8(bytes + pos, bytes_length, NULL); + if (likely(string) && i >= 51) 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 = 185; i < 203; 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 < 203; i++) { + if (unlikely(PyObject_Hash(stringtab[i]) == -1)) { + __PYX_ERR(0, 1, __pyx_L1_error) + } + } + #if CYTHON_IMMORTAL_CONSTANTS + { + PyObject **table = stringtab + 185; + for (Py_ssize_t i=0; i<18; ++i) { + #if CYTHON_COMPILING_IN_CPYTHON_FREETHREADING + Py_SET_REFCNT(table[i], _Py_IMMORTAL_REFCNT_LOCAL); + #else + 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,-1,1,2}; + int32_t const cint_constants_4[] = {136983863L}; + for (int i = 0; i < 5; i++) { + numbertab[i] = PyLong_FromLong((i < 4 ? cint_constants_1[i - 0] : cint_constants_4[i - 4])); + 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<5; ++i) { + #if CYTHON_COMPILING_IN_CPYTHON_FREETHREADING + Py_SET_REFCNT(table[i], _Py_IMMORTAL_REFCNT_LOCAL); + #else + 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 = {2, 0, 0, 4, (unsigned int)(CO_OPTIMIZED|CO_NEWLOCALS|CO_GENERATOR), 24}; + PyObject* const varnames[] = {__pyx_mstate->__pyx_n_u_tokenid, __pyx_mstate->__pyx_n_u_heads, __pyx_mstate->__pyx_n_u_head, __pyx_mstate->__pyx_n_u_cnt}; + __pyx_mstate_global->__pyx_codeobj_tab[0] = __Pyx_PyCode_New(descr, varnames, __pyx_mstate->__pyx_kp_u_spacy_pipeline__parser_internals_3, __pyx_mstate->__pyx_n_u_ancestors, __pyx_mstate->__pyx_kp_b_iso88591__8, tuple_dedup_map); if (unlikely(!__pyx_mstate_global->__pyx_codeobj_tab[0])) goto bad; + } + { + const __Pyx_PyCode_New_function_description descr = {0, 0, 0, 1, (unsigned int)(CO_OPTIMIZED|CO_NEWLOCALS|CO_GENERATOR), 118}; + PyObject* const varnames[] = {__pyx_mstate->__pyx_n_u_word}; + __pyx_mstate_global->__pyx_codeobj_tab[1] = __Pyx_PyCode_New(descr, varnames, __pyx_mstate->__pyx_kp_u_spacy_pipeline__parser_internals_3, __pyx_mstate->__pyx_n_u_genexpr, __pyx_mstate->__pyx_kp_b_iso88591_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, 4, (unsigned int)(CO_OPTIMIZED|CO_NEWLOCALS), 39}; + PyObject* const varnames[] = {__pyx_mstate->__pyx_n_u_heads, __pyx_mstate->__pyx_n_u_tokenid, __pyx_mstate->__pyx_n_u_seen, __pyx_mstate->__pyx_n_u_ancestor}; + __pyx_mstate_global->__pyx_codeobj_tab[2] = __Pyx_PyCode_New(descr, varnames, __pyx_mstate->__pyx_kp_u_spacy_pipeline__parser_internals_3, __pyx_mstate->__pyx_n_u_contains_cycle, __pyx_mstate->__pyx_kp_b_iso88591_5_AQ_s_1A_L_1_y_1_q_AQ_1, tuple_dedup_map); if (unlikely(!__pyx_mstate_global->__pyx_codeobj_tab[2])) goto bad; + } + { + const __Pyx_PyCode_New_function_description descr = {2, 0, 0, 3, (unsigned int)(CO_OPTIMIZED|CO_NEWLOCALS), 51}; + PyObject* const varnames[] = {__pyx_mstate->__pyx_n_u_tokenid, __pyx_mstate->__pyx_n_u_heads, __pyx_mstate->__pyx_n_u_c_heads}; + __pyx_mstate_global->__pyx_codeobj_tab[3] = __Pyx_PyCode_New(descr, varnames, __pyx_mstate->__pyx_kp_u_spacy_pipeline__parser_internals_3, __pyx_mstate->__pyx_n_u_is_nonproj_arc, __pyx_mstate->__pyx_kp_b_iso88591_1_9A, tuple_dedup_map); if (unlikely(!__pyx_mstate_global->__pyx_codeobj_tab[3])) goto bad; + } + { + const __Pyx_PyCode_New_function_description descr = {1, 0, 0, 4, (unsigned int)(CO_OPTIMIZED|CO_NEWLOCALS), 115}; + PyObject* const varnames[] = {__pyx_mstate->__pyx_n_u_heads, __pyx_mstate->__pyx_n_u_c_heads, __pyx_mstate->__pyx_n_u_genexpr, __pyx_mstate->__pyx_n_u_genexpr}; + __pyx_mstate_global->__pyx_codeobj_tab[4] = __Pyx_PyCode_New(descr, varnames, __pyx_mstate->__pyx_kp_u_spacy_pipeline__parser_internals_3, __pyx_mstate->__pyx_n_u_is_nonproj_tree, __pyx_mstate->__pyx_kp_b_iso88591_1_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), 121}; + PyObject* const varnames[] = {__pyx_mstate->__pyx_n_u_label}; + __pyx_mstate_global->__pyx_codeobj_tab[5] = __Pyx_PyCode_New(descr, varnames, __pyx_mstate->__pyx_kp_u_spacy_pipeline__parser_internals_3, __pyx_mstate->__pyx_n_u_decompose, __pyx_mstate->__pyx_kp_b_iso88591_5_S, 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), 125}; + PyObject* const varnames[] = {__pyx_mstate->__pyx_n_u_label}; + __pyx_mstate_global->__pyx_codeobj_tab[6] = __Pyx_PyCode_New(descr, varnames, __pyx_mstate->__pyx_kp_u_spacy_pipeline__parser_internals_3, __pyx_mstate->__pyx_n_u_is_decorated, __pyx_mstate->__pyx_kp_b_iso88591_S, tuple_dedup_map); if (unlikely(!__pyx_mstate_global->__pyx_codeobj_tab[6])) goto bad; + } + { + const __Pyx_PyCode_New_function_description descr = {1, 0, 0, 8, (unsigned int)(CO_OPTIMIZED|CO_NEWLOCALS), 129}; + PyObject* const varnames[] = {__pyx_mstate->__pyx_n_u_gold_data, __pyx_mstate->__pyx_n_u_freqs, __pyx_mstate->__pyx_n_u_example, __pyx_mstate->__pyx_n_u_proj_heads, __pyx_mstate->__pyx_n_u_deco_deps, __pyx_mstate->__pyx_n_u_label, __pyx_mstate->__pyx_n_u_i, __pyx_mstate->__pyx_n_u_head}; + __pyx_mstate_global->__pyx_codeobj_tab[7] = __Pyx_PyCode_New(descr, varnames, __pyx_mstate->__pyx_kp_u_spacy_pipeline__parser_internals_3, __pyx_mstate->__pyx_n_u_count_decorated_labels, __pyx_mstate->__pyx_kp_b_iso88591_A_1_L_AWL_4L_A_e3gYaq_89AQ_IQ_1, tuple_dedup_map); if (unlikely(!__pyx_mstate_global->__pyx_codeobj_tab[7])) goto bad; + } + { + const __Pyx_PyCode_New_function_description descr = {2, 0, 0, 7, (unsigned int)(CO_OPTIMIZED|CO_NEWLOCALS), 146}; + PyObject* const varnames[] = {__pyx_mstate->__pyx_n_u_heads, __pyx_mstate->__pyx_n_u_labels, __pyx_mstate->__pyx_n_u_proj_heads, __pyx_mstate->__pyx_n_u_new_head, __pyx_mstate->__pyx_n_u_c_proj_heads, __pyx_mstate->__pyx_n_u_smallest_np_arc, __pyx_mstate->__pyx_n_u_deco_labels}; + __pyx_mstate_global->__pyx_codeobj_tab[8] = __Pyx_PyCode_New(descr, varnames, __pyx_mstate->__pyx_kp_u_spacy_pipeline__parser_internals_3, __pyx_mstate->__pyx_n_u_projectivize, __pyx_mstate->__pyx_kp_b_iso88591_Qa_Kq_8_t1_4q_a_5_A_31A_1G_q_q, 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), 176}; + PyObject* const varnames[] = {__pyx_mstate->__pyx_n_u_doc}; + __pyx_mstate_global->__pyx_codeobj_tab[9] = __Pyx_PyCode_New(descr, varnames, __pyx_mstate->__pyx_kp_u_spacy_pipeline__parser_internals_3, __pyx_mstate->__pyx_n_u_deprojectivize, __pyx_mstate->__pyx_kp_b_iso88591_U_3a_6_Rq_S_E_q_Qc_a_r_HHCr_r_G, tuple_dedup_map); if (unlikely(!__pyx_mstate_global->__pyx_codeobj_tab[9])) goto bad; + } + { + const __Pyx_PyCode_New_function_description descr = {3, 0, 0, 6, (unsigned int)(CO_OPTIMIZED|CO_NEWLOCALS), 191}; + PyObject* const varnames[] = {__pyx_mstate->__pyx_n_u_heads, __pyx_mstate->__pyx_n_u_proj_heads, __pyx_mstate->__pyx_n_u_labels, __pyx_mstate->__pyx_n_u_deco_labels, __pyx_mstate->__pyx_n_u_tokenid, __pyx_mstate->__pyx_n_u_head}; + __pyx_mstate_global->__pyx_codeobj_tab[10] = __Pyx_PyCode_New(descr, varnames, __pyx_mstate->__pyx_kp_u_spacy_pipeline__parser_internals_3, __pyx_mstate->__pyx_n_u_decorate, __pyx_mstate->__pyx_kp_b_iso88591_1G3c_t3a_3c_j_uG1HCq_9_AQ_5S_1, tuple_dedup_map); if (unlikely(!__pyx_mstate_global->__pyx_codeobj_tab[10])) goto bad; + } + { + const __Pyx_PyCode_New_function_description descr = {1, 0, 0, 2, (unsigned int)(CO_OPTIMIZED|CO_NEWLOCALS), 206}; + PyObject* const varnames[] = {__pyx_mstate->__pyx_n_u_heads, __pyx_mstate->__pyx_n_u_c_heads}; + __pyx_mstate_global->__pyx_codeobj_tab[11] = __Pyx_PyCode_New(descr, varnames, __pyx_mstate->__pyx_kp_u_spacy_pipeline__parser_internals_3, __pyx_mstate->__pyx_n_u_get_smallest_nonproj_arc_slow, __pyx_mstate->__pyx_kp_b_iso88591_1_AQ, 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), 231}; + PyObject* const varnames[] = {__pyx_mstate->__pyx_n_u_tokenid, __pyx_mstate->__pyx_n_u_heads}; + __pyx_mstate_global->__pyx_codeobj_tab[12] = __Pyx_PyCode_New(descr, varnames, __pyx_mstate->__pyx_kp_u_spacy_pipeline__parser_internals_3, __pyx_mstate->__pyx_n_u_lift, __pyx_mstate->__pyx_kp_b_iso88591_q_5_E_c_A_Q_1, tuple_dedup_map); if (unlikely(!__pyx_mstate_global->__pyx_codeobj_tab[12])) goto bad; + } + { + const __Pyx_PyCode_New_function_description descr = {2, 0, 0, 6, (unsigned int)(CO_OPTIMIZED|CO_NEWLOCALS), 241}; + PyObject* const varnames[] = {__pyx_mstate->__pyx_n_u_token, __pyx_mstate->__pyx_n_u_headlabel, __pyx_mstate->__pyx_n_u_queue, __pyx_mstate->__pyx_n_u_next_queue, __pyx_mstate->__pyx_n_u_qtoken, __pyx_mstate->__pyx_n_u_child}; + __pyx_mstate_global->__pyx_codeobj_tab[13] = __Pyx_PyCode_New(descr, varnames, __pyx_mstate->__pyx_kp_u_spacy_pipeline__parser_internals_3, __pyx_mstate->__pyx_n_u_find_new_head, __pyx_mstate->__pyx_kp_b_iso88591_AU_Q_Ja_q_5_6_A_5_c_1_5, tuple_dedup_map); if (unlikely(!__pyx_mstate_global->__pyx_codeobj_tab[13])) 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) + + /* AssertionsEnabled.init */ + if (likely(__Pyx_init_assertions_enabled() == 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) + + /* Generator.init */ + if (likely(__pyx_Generator_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++) { + if (unlikely(__Pyx_PyTuple_SET_ITEM(res, i, src[i]) < (0))) { + Py_DECREF(res); + return NULL; + } + Py_INCREF(src[i]); + } + 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); +} + +/* 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; +} + +/* 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; +} + +/* 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 + +/* RaiseUnexpectedTypeError */ +static int +__Pyx_RaiseUnexpectedTypeError(const char *expected, PyObject *obj) +{ + __Pyx_TypeName obj_type_name = __Pyx_PyType_GetFullyQualifiedName(Py_TYPE(obj)); + PyErr_Format(PyExc_TypeError, "Expected %s, got " __Pyx_FMT_TYPENAME, + expected, obj_type_name); + __Pyx_DECREF_TypeName(obj_type_name); + return 0; +} + +/* 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); +} + +/* CIntToPyUnicode */ +static CYTHON_INLINE PyObject* __Pyx_uchar___Pyx_PyUnicode_From_Py_ssize_t(Py_ssize_t value, Py_ssize_t width, char padding_char) { +#ifdef __Pyx_HAS_GCC_DIAGNOSTIC +#pragma GCC diagnostic push +#pragma GCC diagnostic ignored "-Wconversion" +#endif + const Py_ssize_t neg_one = (Py_ssize_t) -1, const_zero = (Py_ssize_t) 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 & ~ (Py_ssize_t) 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_Py_ssize_t(Py_ssize_t value, Py_ssize_t width, char padding_char, char format_char) { + char digits[sizeof(Py_ssize_t)*3+2]; + char *dpos, *end = digits + sizeof(Py_ssize_t)*3+2; + const char *hex_digits = DIGITS_HEX; + Py_ssize_t length, ulength; + int prepend_sign, last_one_off; + Py_ssize_t remaining; +#ifdef __Pyx_HAS_GCC_DIAGNOSTIC +#pragma GCC diagnostic push +#pragma GCC diagnostic ignored "-Wconversion" +#endif + const Py_ssize_t neg_one = (Py_ssize_t) -1, const_zero = (Py_ssize_t) 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 = (Py_ssize_t) (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 = (Py_ssize_t) (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 = (Py_ssize_t) (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 +} + +/* GetAttr */ +static CYTHON_INLINE PyObject *__Pyx_GetAttr(PyObject *o, PyObject *n) { +#if CYTHON_USE_TYPE_SLOTS + if (likely(PyUnicode_Check(n))) + return __Pyx_PyObject_GetAttrStr(o, n); +#endif + return PyObject_GetAttr(o, n); +} + +/* GetItemInt */ +static PyObject *__Pyx_GetItemInt_Generic(PyObject *o, PyObject* j) { + PyObject *r; + if (unlikely(!j)) return NULL; + r = PyObject_GetItem(o, j); + Py_DECREF(j); + return r; +} +static CYTHON_INLINE PyObject *__Pyx_GetItemInt_List_Fast(PyObject *o, Py_ssize_t i, + int wraparound, int boundscheck, int unsafe_shared) { + CYTHON_MAYBE_UNUSED_VAR(unsafe_shared); +#if CYTHON_ASSUME_SAFE_SIZE + Py_ssize_t wrapped_i = i; + if (wraparound & unlikely(i < 0)) { + wrapped_i += PyList_GET_SIZE(o); + } + if ((CYTHON_AVOID_BORROWED_REFS || CYTHON_AVOID_THREAD_UNSAFE_BORROWED_REFS || !CYTHON_ASSUME_SAFE_MACROS)) { + return __Pyx_PyList_GetItemRefFast(o, wrapped_i, unsafe_shared); + } else + if ((!boundscheck) || likely(__Pyx_is_valid_index(wrapped_i, PyList_GET_SIZE(o)))) { + return __Pyx_NewRef(PyList_GET_ITEM(o, wrapped_i)); + } + return __Pyx_GetItemInt_Generic(o, PyLong_FromSsize_t(i)); +#else + (void)wraparound; + (void)boundscheck; + return PySequence_GetItem(o, i); +#endif +} +static CYTHON_INLINE PyObject *__Pyx_GetItemInt_Tuple_Fast(PyObject *o, Py_ssize_t i, + int wraparound, int boundscheck, int unsafe_shared) { + CYTHON_MAYBE_UNUSED_VAR(unsafe_shared); +#if CYTHON_ASSUME_SAFE_SIZE && CYTHON_ASSUME_SAFE_MACROS && !CYTHON_AVOID_BORROWED_REFS + Py_ssize_t wrapped_i = i; + if (wraparound & unlikely(i < 0)) { + wrapped_i += PyTuple_GET_SIZE(o); + } + if ((!boundscheck) || likely(__Pyx_is_valid_index(wrapped_i, PyTuple_GET_SIZE(o)))) { + return __Pyx_NewRef(PyTuple_GET_ITEM(o, wrapped_i)); + } + return __Pyx_GetItemInt_Generic(o, PyLong_FromSsize_t(i)); +#else + (void)wraparound; + (void)boundscheck; + return PySequence_GetItem(o, i); +#endif +} +static CYTHON_INLINE PyObject *__Pyx_GetItemInt_Fast(PyObject *o, Py_ssize_t i, int is_list, + int wraparound, int boundscheck, int unsafe_shared) { + CYTHON_MAYBE_UNUSED_VAR(unsafe_shared); +#if CYTHON_ASSUME_SAFE_MACROS && CYTHON_ASSUME_SAFE_SIZE + if (is_list || PyList_CheckExact(o)) { + Py_ssize_t n = ((!wraparound) | likely(i >= 0)) ? i : i + PyList_GET_SIZE(o); + if ((CYTHON_AVOID_BORROWED_REFS || CYTHON_AVOID_THREAD_UNSAFE_BORROWED_REFS)) { + return __Pyx_PyList_GetItemRefFast(o, n, unsafe_shared); + } else if ((!boundscheck) || (likely(__Pyx_is_valid_index(n, PyList_GET_SIZE(o))))) { + return __Pyx_NewRef(PyList_GET_ITEM(o, n)); + } + } else + #if !CYTHON_AVOID_BORROWED_REFS + if (PyTuple_CheckExact(o)) { + Py_ssize_t n = ((!wraparound) | likely(i >= 0)) ? i : i + PyTuple_GET_SIZE(o); + if ((!boundscheck) || likely(__Pyx_is_valid_index(n, PyTuple_GET_SIZE(o)))) { + return __Pyx_NewRef(PyTuple_GET_ITEM(o, n)); + } + } else + #endif +#endif +#if CYTHON_USE_TYPE_SLOTS && !CYTHON_COMPILING_IN_PYPY + { + PyMappingMethods *mm = Py_TYPE(o)->tp_as_mapping; + PySequenceMethods *sm = Py_TYPE(o)->tp_as_sequence; + if (!is_list && mm && mm->mp_subscript) { + PyObject *r, *key = PyLong_FromSsize_t(i); + if (unlikely(!key)) return NULL; + r = mm->mp_subscript(o, key); + Py_DECREF(key); + return r; + } + if (is_list || likely(sm && sm->sq_item)) { + if (wraparound && unlikely(i < 0) && likely(sm->sq_length)) { + Py_ssize_t l = sm->sq_length(o); + if (likely(l >= 0)) { + i += l; + } else { + if (!PyErr_ExceptionMatches(PyExc_OverflowError)) + return NULL; + PyErr_Clear(); + } + } + return sm->sq_item(o, i); + } + } +#else + if (is_list || !PyMapping_Check(o)) { + return PySequence_GetItem(o, i); + } +#endif + (void)wraparound; + (void)boundscheck; + return __Pyx_GetItemInt_Generic(o, PyLong_FromSsize_t(i)); +} + +/* ObjectGetItem */ +#if CYTHON_USE_TYPE_SLOTS +static PyObject *__Pyx_PyObject_GetIndex(PyObject *obj, PyObject *index) { + PyObject *runerr = NULL; + Py_ssize_t key_value; + key_value = __Pyx_PyIndex_AsSsize_t(index); + if (likely(key_value != -1 || !(runerr = PyErr_Occurred()))) { + return __Pyx_GetItemInt_Fast(obj, key_value, 0, 1, 1, 1); + } + if (PyErr_GivenExceptionMatches(runerr, PyExc_OverflowError)) { + __Pyx_TypeName index_type_name = __Pyx_PyType_GetFullyQualifiedName(Py_TYPE(index)); + PyErr_Clear(); + PyErr_Format(PyExc_IndexError, + "cannot fit '" __Pyx_FMT_TYPENAME "' into an index-sized integer", index_type_name); + __Pyx_DECREF_TypeName(index_type_name); + } + return NULL; +} +static PyObject *__Pyx_PyObject_GetItem_Slow(PyObject *obj, PyObject *key) { + __Pyx_TypeName obj_type_name; + if (likely(PyType_Check(obj))) { + PyObject *meth = __Pyx_PyObject_GetAttrStrNoError(obj, __pyx_mstate_global->__pyx_n_u_class_getitem); + if (!meth) { + PyErr_Clear(); + } else { + PyObject *result = __Pyx_PyObject_CallOneArg(meth, key); + Py_DECREF(meth); + return result; + } + } + obj_type_name = __Pyx_PyType_GetFullyQualifiedName(Py_TYPE(obj)); + PyErr_Format(PyExc_TypeError, + "'" __Pyx_FMT_TYPENAME "' object is not subscriptable", obj_type_name); + __Pyx_DECREF_TypeName(obj_type_name); + return NULL; +} +static PyObject *__Pyx_PyObject_GetItem(PyObject *obj, PyObject *key) { + PyTypeObject *tp = Py_TYPE(obj); + PyMappingMethods *mm = tp->tp_as_mapping; + PySequenceMethods *sm = tp->tp_as_sequence; + if (likely(mm && mm->mp_subscript)) { + return mm->mp_subscript(obj, key); + } + if (likely(sm && sm->sq_item)) { + return __Pyx_PyObject_GetIndex(obj, key); + } + return __Pyx_PyObject_GetItem_Slow(obj, key); +} +#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); + } +} + +/* DivInt[Py_ssize_t] */ +static CYTHON_INLINE Py_ssize_t __Pyx_div_Py_ssize_t(Py_ssize_t a, Py_ssize_t b, int b_is_constant) { + Py_ssize_t q = a / b; + Py_ssize_t r = a - q*b; + Py_ssize_t adapt_python = (b_is_constant ? + ((r != 0) & ((r < 0) ^ (b < 0))) : + ((r != 0) & ((r ^ b) < 0)) + ); + return q - adapt_python; +} + +/* GetAttr3 */ +#if __PYX_LIMITED_VERSION_HEX < 0x030d0000 +static PyObject *__Pyx_GetAttr3Default(PyObject *d) { + __Pyx_PyThreadState_declare + __Pyx_PyThreadState_assign + if (unlikely(!__Pyx_PyErr_ExceptionMatches(PyExc_AttributeError))) + return NULL; + __Pyx_PyErr_Clear(); + Py_INCREF(d); + return d; +} +#endif +static CYTHON_INLINE PyObject *__Pyx_GetAttr3(PyObject *o, PyObject *n, PyObject *d) { + PyObject *r; +#if __PYX_LIMITED_VERSION_HEX >= 0x030d0000 + int res = PyObject_GetOptionalAttr(o, n, &r); + return (res != 0) ? r : __Pyx_NewRef(d); +#else + #if CYTHON_USE_TYPE_SLOTS + if (likely(PyUnicode_Check(n))) { + r = __Pyx_PyObject_GetAttrStrNoError(o, n); + if (unlikely(!r) && likely(!PyErr_Occurred())) { + r = __Pyx_NewRef(d); + } + return r; + } + #endif + r = PyObject_GetAttr(o, n); + return (likely(r)) ? r : __Pyx_GetAttr3Default(d); +#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); +} + +/* RaiseTooManyValuesToUnpack */ +static CYTHON_INLINE void __Pyx_RaiseTooManyValuesError(Py_ssize_t expected) { + PyErr_Format(PyExc_ValueError, + "too many values to unpack (expected %" CYTHON_FORMAT_SSIZE_T "d)", expected); +} + +/* RaiseNeedMoreValuesToUnpack */ +static CYTHON_INLINE void __Pyx_RaiseNeedMoreValuesError(Py_ssize_t index) { + PyErr_Format(PyExc_ValueError, + "need more than %" CYTHON_FORMAT_SSIZE_T "d value%.1s to unpack", + index, (index == 1) ? "" : "s"); +} + +/* RaiseNoneIterError */ +static CYTHON_INLINE void __Pyx_RaiseNoneNotIterableError(void) { + PyErr_SetString(PyExc_TypeError, "'NoneType' object is not iterable"); +} + +/* ExtTypeTest */ +static CYTHON_INLINE int __Pyx_TypeTest(PyObject *obj, PyTypeObject *type) { + __Pyx_TypeName obj_type_name; + __Pyx_TypeName type_name; + if (unlikely(!type)) { + PyErr_SetString(PyExc_SystemError, "Missing type object"); + return 0; + } + if (likely(__Pyx_TypeCheck(obj, type))) + return 1; + obj_type_name = __Pyx_PyType_GetFullyQualifiedName(Py_TYPE(obj)); + type_name = __Pyx_PyType_GetFullyQualifiedName(type); + PyErr_Format(PyExc_TypeError, + "Cannot convert " __Pyx_FMT_TYPENAME " to " __Pyx_FMT_TYPENAME, + obj_type_name, type_name); + __Pyx_DECREF_TypeName(obj_type_name); + __Pyx_DECREF_TypeName(type_name); + return 0; +} + +/* 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 + +/* 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); +} + +/* 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; itp_as_sequence && type->tp_as_sequence->sq_repeat)) { + return type->tp_as_sequence->sq_repeat(seq, mul); + } else +#endif + { + return __Pyx_PySequence_Multiply_Generic(seq, mul); + } +} + +/* PyObjectFormatAndDecref */ +static CYTHON_INLINE PyObject* __Pyx_PyObject_FormatSimpleAndDecref(PyObject* s, PyObject* f) { + if (unlikely(!s)) return NULL; + if (likely(PyUnicode_CheckExact(s))) return s; + return __Pyx_PyObject_FormatAndDecref(s, f); +} +static CYTHON_INLINE PyObject* __Pyx_PyObject_FormatAndDecref(PyObject* s, PyObject* f) { + PyObject *result; + if (unlikely(!s)) return NULL; + result = PyObject_Format(s, f); + Py_DECREF(s); + return result; +} + +/* PyObjectFormat */ +#if CYTHON_USE_UNICODE_WRITER +static PyObject* __Pyx_PyObject_Format(PyObject* obj, PyObject* format_spec) { + int ret; + _PyUnicodeWriter writer; + if (likely(PyFloat_CheckExact(obj))) { + _PyUnicodeWriter_Init(&writer); + ret = _PyFloat_FormatAdvancedWriter( + &writer, + obj, + format_spec, 0, PyUnicode_GET_LENGTH(format_spec)); + } else if (likely(PyLong_CheckExact(obj))) { + _PyUnicodeWriter_Init(&writer); + ret = _PyLong_FormatAdvancedWriter( + &writer, + obj, + format_spec, 0, PyUnicode_GET_LENGTH(format_spec)); + } else { + return PyObject_Format(obj, format_spec); + } + if (unlikely(ret == -1)) { + _PyUnicodeWriter_Dealloc(&writer); + return NULL; + } + return _PyUnicodeWriter_Finish(&writer); +} +#endif + +/* SetItemInt */ +static int __Pyx_SetItemInt_Generic(PyObject *o, PyObject *j, PyObject *v) { + int r; + if (unlikely(!j)) return -1; + r = PyObject_SetItem(o, j, v); + Py_DECREF(j); + return r; +} +static CYTHON_INLINE int __Pyx_SetItemInt_Fast(PyObject *o, Py_ssize_t i, PyObject *v, int is_list, + int wraparound, int boundscheck, int unsafe_shared) { + CYTHON_MAYBE_UNUSED_VAR(unsafe_shared); +#if CYTHON_ASSUME_SAFE_MACROS && CYTHON_ASSUME_SAFE_SIZE && !CYTHON_AVOID_BORROWED_REFS + if (is_list || PyList_CheckExact(o)) { + Py_ssize_t n = (!wraparound) ? i : ((likely(i >= 0)) ? i : i + PyList_GET_SIZE(o)); + if ((CYTHON_AVOID_THREAD_UNSAFE_BORROWED_REFS && !__Pyx_IS_UNIQUELY_REFERENCED(o, unsafe_shared))) { + Py_INCREF(v); + return PyList_SetItem(o, n, v); + } else if ((!boundscheck) || likely(__Pyx_is_valid_index(n, PyList_GET_SIZE(o)))) { + PyObject* old; + Py_INCREF(v); + old = PyList_GET_ITEM(o, n); + PyList_SET_ITEM(o, n, v); + Py_DECREF(old); + return 0; + } + } else +#endif +#if CYTHON_USE_TYPE_SLOTS && !CYTHON_COMPILING_IN_PYPY + { + PyMappingMethods *mm = Py_TYPE(o)->tp_as_mapping; + PySequenceMethods *sm = Py_TYPE(o)->tp_as_sequence; + if (!is_list && mm && mm->mp_ass_subscript) { + int r; + PyObject *key = PyLong_FromSsize_t(i); + if (unlikely(!key)) return -1; + r = mm->mp_ass_subscript(o, key, v); + Py_DECREF(key); + return r; + } + if (is_list || likely(sm && sm->sq_ass_item)) { + if (wraparound && unlikely(i < 0) && likely(sm->sq_length)) { + Py_ssize_t l = sm->sq_length(o); + if (likely(l >= 0)) { + i += l; + } else { + if (!PyErr_ExceptionMatches(PyExc_OverflowError)) + return -1; + PyErr_Clear(); + } + } + return sm->sq_ass_item(o, i, v); + } + } +#else + if (is_list || !PyMapping_Check(o)) { + return PySequence_SetItem(o, i, v); + } +#endif + (void)wraparound; + (void)boundscheck; + return __Pyx_SetItemInt_Generic(o, PyLong_FromSsize_t(i), v); +} + +/* RaiseUnboundLocalError */ +static void __Pyx_RaiseUnboundLocalError(const char *varname) { + PyErr_Format(PyExc_UnboundLocalError, "local variable '%s' referenced before assignment", varname); +} + +/* DivInt[long] */ +static CYTHON_INLINE long __Pyx_div_long(long a, long b, int b_is_constant) { + long q = a / b; + long r = a - q*b; + long adapt_python = (b_is_constant ? + ((r != 0) & ((r < 0) ^ (b < 0))) : + ((r != 0) & ((r ^ b) < 0)) + ); + return q - adapt_python; +} + +/* PyObjectCallNoArg (used by pyfrozenset_new) */ +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); +} + +/* 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)); +} + +/* ErrOccurredWithGIL */ +static CYTHON_INLINE int __Pyx_ErrOccurredWithGIL(void) { + int err; + PyGILState_STATE _save = PyGILState_Ensure(); + err = !!PyErr_Occurred(); + PyGILState_Release(_save); + return err; +} + +/* 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); +} + +/* IterFinish */ +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; +} + +/* UnpackItemEndCheck */ +static int __Pyx_IternextUnpackEndCheck(PyObject *retval, Py_ssize_t expected) { + if (unlikely(retval)) { + Py_DECREF(retval); + __Pyx_RaiseTooManyValuesError(expected); + return -1; + } + return __Pyx_IterFinish(); +} + +/* 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 + +/* PyObjectCall2Args (used by CallUnboundCMethod1) */ +static CYTHON_INLINE PyObject* __Pyx_PyObject_Call2Args(PyObject* function, PyObject* arg1, PyObject* arg2) { + PyObject *args[3] = {NULL, arg1, arg2}; + return __Pyx_PyObject_FastCall(function, args+1, 2 | __Pyx_PY_VECTORCALL_ARGUMENTS_OFFSET); +} + +/* CallUnboundCMethod1 */ +#if CYTHON_COMPILING_IN_CPYTHON +static CYTHON_INLINE PyObject* __Pyx_CallUnboundCMethod1(__Pyx_CachedCFunction* cfunc, PyObject* self, PyObject* arg) { + int was_initialized = __Pyx_CachedCFunction_GetAndSetInitializing(cfunc); + if (likely(was_initialized == 2 && cfunc->func)) { + int flag = cfunc->flag; + if (flag == METH_O) { + return __Pyx_CallCFunction(cfunc, self, arg); + } else if (flag == METH_FASTCALL) { + return __Pyx_CallCFunctionFast(cfunc, self, &arg, 1); + } else if (flag == (METH_FASTCALL | METH_KEYWORDS)) { + return __Pyx_CallCFunctionFastWithKeywords(cfunc, self, &arg, 1, 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__CallUnboundCMethod1(&tmp_cfunc, self, arg); + } +#endif + PyObject* result = __Pyx__CallUnboundCMethod1(cfunc, self, arg); + __Pyx_CachedCFunction_SetFinishedInitializing(cfunc); + return result; +} +#endif +static PyObject* __Pyx__CallUnboundCMethod1(__Pyx_CachedCFunction* cfunc, PyObject* self, PyObject* arg){ + PyObject *result = NULL; + if (unlikely(!cfunc->func && !cfunc->method) && unlikely(__Pyx_TryUnpackUnboundCMethod(cfunc) < 0)) return NULL; +#if CYTHON_COMPILING_IN_CPYTHON + if (cfunc->func && (cfunc->flag & METH_VARARGS)) { + PyObject *args = PyTuple_New(1); + if (unlikely(!args)) return NULL; + Py_INCREF(arg); + PyTuple_SET_ITEM(args, 0, arg); + if (cfunc->flag & METH_KEYWORDS) + result = __Pyx_CallCFunctionWithKeywords(cfunc, self, args, NULL); + else + result = __Pyx_CallCFunction(cfunc, self, args); + Py_DECREF(args); + } else +#endif + { + result = __Pyx_PyObject_Call2Args(cfunc->method, self, arg); + } + return result; +} + +/* dict_getitem_default */ +static PyObject* __Pyx_PyDict_GetItemDefault(PyObject* d, PyObject* key, PyObject* default_value) { + PyObject* value; +#if !CYTHON_COMPILING_IN_PYPY || PYPY_VERSION_NUM >= 0x07020000 + value = PyDict_GetItemWithError(d, key); + if (unlikely(!value)) { + if (unlikely(PyErr_Occurred())) + return NULL; + value = default_value; + } + Py_INCREF(value); + if ((1)); +#else + if (PyBytes_CheckExact(key) || PyUnicode_CheckExact(key) || PyLong_CheckExact(key)) { + value = PyDict_GetItem(d, key); + if (unlikely(!value)) { + value = default_value; + } + Py_INCREF(value); + } +#endif + else { + if (default_value == Py_None) + value = __Pyx_CallUnboundCMethod1(&__pyx_mstate_global->__pyx_umethod_PyDict_Type_get, d, key); + else + value = __Pyx_CallUnboundCMethod2(&__pyx_mstate_global->__pyx_umethod_PyDict_Type_get, d, key, default_value); + } + return value; +} + +/* 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; + if (__Pyx_PyTuple_SET_ITEM(builder, n, key) != (0)) return -1; + Py_INCREF(key); + 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 + +/* 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; +} + +/* 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 +} + +/* SetVTable */ +static int __Pyx_SetVtable(PyTypeObject *type, void *vtable) { + PyObject *ob = PyCapsule_New(vtable, 0, 0); + if (unlikely(!ob)) + goto bad; +#if CYTHON_COMPILING_IN_LIMITED_API + if (unlikely(PyObject_SetAttr((PyObject *) type, __pyx_mstate_global->__pyx_n_u_pyx_vtable, ob) < 0)) +#else + if (unlikely(PyDict_SetItem(type->tp_dict, __pyx_mstate_global->__pyx_n_u_pyx_vtable, ob) < 0)) +#endif + goto bad; + Py_DECREF(ob); + return 0; +bad: + Py_XDECREF(ob); + return -1; +} + +/* GetVTable (used by MergeVTables) */ +static void* __Pyx_GetVtable(PyTypeObject *type) { + void* ptr; +#if CYTHON_COMPILING_IN_LIMITED_API + PyObject *ob = PyObject_GetAttr((PyObject *)type, __pyx_mstate_global->__pyx_n_u_pyx_vtable); +#else + PyObject *ob = PyObject_GetItem(type->tp_dict, __pyx_mstate_global->__pyx_n_u_pyx_vtable); +#endif + if (!ob) + goto bad; + ptr = PyCapsule_GetPointer(ob, 0); + if (!ptr && !PyErr_Occurred()) + PyErr_SetString(PyExc_RuntimeError, "invalid vtable found for imported type"); + Py_DECREF(ob); + return ptr; +bad: + Py_XDECREF(ob); + return NULL; +} + +/* MergeVTables */ +static int __Pyx_MergeVtables(PyTypeObject *type) { + int i=0; + Py_ssize_t size; + void** base_vtables; + __Pyx_TypeName tp_base_name = NULL; + __Pyx_TypeName base_name = NULL; + void* unknown = (void*)-1; + PyObject* bases = __Pyx_PyType_GetSlot(type, tp_bases, PyObject*); + int base_depth = 0; + { + PyTypeObject* base = __Pyx_PyType_GetSlot(type, tp_base, PyTypeObject*); + while (base) { + base_depth += 1; + base = __Pyx_PyType_GetSlot(base, tp_base, PyTypeObject*); + } + } + base_vtables = (void**) PyMem_Malloc(sizeof(void*) * (size_t)(base_depth + 1)); + base_vtables[0] = unknown; +#if CYTHON_COMPILING_IN_LIMITED_API + size = PyTuple_Size(bases); + if (size < 0) goto other_failure; +#else + size = PyTuple_GET_SIZE(bases); +#endif + for (i = 1; i < size; i++) { + PyObject *basei; + void* base_vtable; +#if CYTHON_AVOID_BORROWED_REFS + basei = PySequence_GetItem(bases, i); + if (unlikely(!basei)) goto other_failure; +#elif !CYTHON_ASSUME_SAFE_MACROS + basei = PyTuple_GetItem(bases, i); + if (unlikely(!basei)) goto other_failure; +#else + basei = PyTuple_GET_ITEM(bases, i); +#endif + base_vtable = __Pyx_GetVtable((PyTypeObject*)basei); +#if CYTHON_AVOID_BORROWED_REFS + Py_DECREF(basei); +#endif + if (base_vtable != NULL) { + int j; + PyTypeObject* base = __Pyx_PyType_GetSlot(type, tp_base, PyTypeObject*); + for (j = 0; j < base_depth; j++) { + if (base_vtables[j] == unknown) { + base_vtables[j] = __Pyx_GetVtable(base); + base_vtables[j + 1] = unknown; + } + if (base_vtables[j] == base_vtable) { + break; + } else if (base_vtables[j] == NULL) { + goto bad; + } + base = __Pyx_PyType_GetSlot(base, tp_base, PyTypeObject*); + } + } + } + PyErr_Clear(); + PyMem_Free(base_vtables); + return 0; +bad: + { + PyTypeObject* basei = NULL; + PyTypeObject* tp_base = __Pyx_PyType_GetSlot(type, tp_base, PyTypeObject*); + tp_base_name = __Pyx_PyType_GetFullyQualifiedName(tp_base); +#if CYTHON_AVOID_BORROWED_REFS + basei = (PyTypeObject*)PySequence_GetItem(bases, i); + if (unlikely(!basei)) goto really_bad; +#elif !CYTHON_ASSUME_SAFE_MACROS + basei = (PyTypeObject*)PyTuple_GetItem(bases, i); + if (unlikely(!basei)) goto really_bad; +#else + basei = (PyTypeObject*)PyTuple_GET_ITEM(bases, i); +#endif + base_name = __Pyx_PyType_GetFullyQualifiedName(basei); +#if CYTHON_AVOID_BORROWED_REFS + Py_DECREF(basei); +#endif + } + PyErr_Format(PyExc_TypeError, + "multiple bases have vtable conflict: '" __Pyx_FMT_TYPENAME "' and '" __Pyx_FMT_TYPENAME "'", tp_base_name, base_name); +#if CYTHON_AVOID_BORROWED_REFS || !CYTHON_ASSUME_SAFE_MACROS +really_bad: // bad has failed! +#endif + __Pyx_DECREF_TypeName(tp_base_name); + __Pyx_DECREF_TypeName(base_name); +#if CYTHON_COMPILING_IN_LIMITED_API || CYTHON_AVOID_BORROWED_REFS || !CYTHON_ASSUME_SAFE_MACROS +other_failure: +#endif + PyMem_Free(base_vtables); + return -1; +} + +/* 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_2); + if (likely(name_attr)) { + ret = PyObject_RichCompareBool(name_attr, name, Py_EQ); + } else { + ret = -1; + } + if (unlikely(ret < 0)) { + PyErr_Clear(); + ret = 0; + } + Py_XDECREF(name_attr); + return ret; +} +static int __Pyx_setup_reduce(PyObject* type_obj) { + int ret = 0; + PyObject *object_reduce = NULL; + PyObject *object_getstate = NULL; + PyObject *object_reduce_ex = NULL; + PyObject *reduce = NULL; + PyObject *reduce_ex = NULL; + PyObject *reduce_cython = NULL; + PyObject *setstate = NULL; + PyObject *setstate_cython = NULL; + PyObject *getstate = NULL; +#if CYTHON_USE_PYTYPE_LOOKUP + getstate = _PyType_Lookup((PyTypeObject*)type_obj, __pyx_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_1 +#define __PYX_HAVE_RT_ImportType_3_2_1 +static PyTypeObject *__Pyx_ImportType_3_2_1(PyObject *module, const char *module_name, const char *class_name, + size_t size, size_t alignment, enum __Pyx_ImportType_CheckSize_3_2_1 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_1 && + ((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_1 && (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 VoidPtrImport) */ +#ifndef __PYX_HAVE_RT_ImportFromPxd_3_2_1 +#define __PYX_HAVE_RT_ImportFromPxd_3_2_1 +static int __Pyx_ImportFromPxd_3_2_1(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 + +/* VoidPtrImport */ +#ifndef __PYX_HAVE_RT_ImportVoidPtr_3_2_1 +#define __PYX_HAVE_RT_ImportVoidPtr_3_2_1 +static int __Pyx_ImportVoidPtr_3_2_1(PyObject *module, const char *name, void **p, const char *sig) { + return __Pyx_ImportFromPxd_3_2_1(module, name, p, sig, "variable"); +} +#endif + +/* FunctionImport */ +#ifndef __PYX_HAVE_RT_ImportFunction_3_2_1 +#define __PYX_HAVE_RT_ImportFunction_3_2_1 +static int __Pyx_ImportFunction_3_2_1(PyObject *module, const char *funcname, void (**f)(void), const char *sig) { + union { + void (*fp)(void); + void *p; + } tmp; + int result = __Pyx_ImportFromPxd_3_2_1(module, funcname, &tmp.p, sig, "function"); + if (result == 0) { + *f = tmp.fp; + } + return result; +} +#endif + +/* 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__2); + 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 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); +#elif PY_VERSION_HEX >= 0x030d0000 + PyDict_SetDefaultRef(d, key, default_value, &value); +#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_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(marker); + 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}, + {"_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 !CYTHON_COMPILING_IN_LIMITED_API +#if PY_VERSION_HEX < 0x030900B1 + Py_CLEAR(__Pyx_CyFunction_GetClassObj(m)); +#else + { + PyObject *cls = (PyObject*) ((PyCMethodObject *) (m))->mm_class; + ((PyCMethodObject *) (m))->mm_class = NULL; + Py_XDECREF(cls); + } +#endif +#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); +#if !CYTHON_COMPILING_IN_LIMITED_API + Py_VISIT(__Pyx_CyFunction_GetClassObj(m)); +#endif + Py_VISIT(m->defaults_tuple); + Py_VISIT(m->defaults_kwdict); + 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;\ + } + +/* Declarations */ +#if CYTHON_CCOMPLEX && (1) && (!0 || __cplusplus) + #ifdef __cplusplus + static CYTHON_INLINE __pyx_t_float_complex __pyx_t_float_complex_from_parts(float x, float y) { + return ::std::complex< float >(x, y); + } + #else + static CYTHON_INLINE __pyx_t_float_complex __pyx_t_float_complex_from_parts(float x, float y) { + return x + y*(__pyx_t_float_complex)_Complex_I; + } + #endif +#else + static CYTHON_INLINE __pyx_t_float_complex __pyx_t_float_complex_from_parts(float x, float y) { + __pyx_t_float_complex z; + z.real = x; + z.imag = y; + return z; + } +#endif + +/* Arithmetic */ +#if CYTHON_CCOMPLEX && (1) && (!0 || __cplusplus) +#else + static CYTHON_INLINE int __Pyx_c_eq_float(__pyx_t_float_complex a, __pyx_t_float_complex b) { + return (a.real == b.real) && (a.imag == b.imag); + } + static CYTHON_INLINE __pyx_t_float_complex __Pyx_c_sum_float(__pyx_t_float_complex a, __pyx_t_float_complex b) { + __pyx_t_float_complex z; + z.real = a.real + b.real; + z.imag = a.imag + b.imag; + return z; + } + static CYTHON_INLINE __pyx_t_float_complex __Pyx_c_diff_float(__pyx_t_float_complex a, __pyx_t_float_complex b) { + __pyx_t_float_complex z; + z.real = a.real - b.real; + z.imag = a.imag - b.imag; + return z; + } + static CYTHON_INLINE __pyx_t_float_complex __Pyx_c_prod_float(__pyx_t_float_complex a, __pyx_t_float_complex b) { + __pyx_t_float_complex z; + z.real = a.real * b.real - a.imag * b.imag; + z.imag = a.real * b.imag + a.imag * b.real; + return z; + } + #if 1 + static CYTHON_INLINE __pyx_t_float_complex __Pyx_c_quot_float(__pyx_t_float_complex a, __pyx_t_float_complex b) { + if (b.imag == 0) { + return __pyx_t_float_complex_from_parts(a.real / b.real, a.imag / b.real); + } else if (fabsf(b.real) >= fabsf(b.imag)) { + if (b.real == 0 && b.imag == 0) { + return __pyx_t_float_complex_from_parts(a.real / b.real, a.imag / b.imag); + } else { + float r = b.imag / b.real; + float s = (float)(1.0) / (b.real + b.imag * r); + return __pyx_t_float_complex_from_parts( + (a.real + a.imag * r) * s, (a.imag - a.real * r) * s); + } + } else { + float r = b.real / b.imag; + float s = (float)(1.0) / (b.imag + b.real * r); + return __pyx_t_float_complex_from_parts( + (a.real * r + a.imag) * s, (a.imag * r - a.real) * s); + } + } + #else + static CYTHON_INLINE __pyx_t_float_complex __Pyx_c_quot_float(__pyx_t_float_complex a, __pyx_t_float_complex b) { + if (b.imag == 0) { + return __pyx_t_float_complex_from_parts(a.real / b.real, a.imag / b.real); + } else { + float denom = b.real * b.real + b.imag * b.imag; + return __pyx_t_float_complex_from_parts( + (a.real * b.real + a.imag * b.imag) / denom, + (a.imag * b.real - a.real * b.imag) / denom); + } + } + #endif + static CYTHON_INLINE __pyx_t_float_complex __Pyx_c_neg_float(__pyx_t_float_complex a) { + __pyx_t_float_complex z; + z.real = -a.real; + z.imag = -a.imag; + return z; + } + static CYTHON_INLINE int __Pyx_c_is_zero_float(__pyx_t_float_complex a) { + return (a.real == 0) && (a.imag == 0); + } + static CYTHON_INLINE __pyx_t_float_complex __Pyx_c_conj_float(__pyx_t_float_complex a) { + __pyx_t_float_complex z; + z.real = a.real; + z.imag = -a.imag; + return z; + } + #if 1 + static CYTHON_INLINE float __Pyx_c_abs_float(__pyx_t_float_complex z) { + #if !defined(HAVE_HYPOT) || defined(_MSC_VER) + return sqrtf(z.real*z.real + z.imag*z.imag); + #else + return hypotf(z.real, z.imag); + #endif + } + static CYTHON_INLINE __pyx_t_float_complex __Pyx_c_pow_float(__pyx_t_float_complex a, __pyx_t_float_complex b) { + __pyx_t_float_complex z; + float r, lnr, theta, z_r, z_theta; + if (b.imag == 0 && b.real == (int)b.real) { + if (b.real < 0) { + float denom = a.real * a.real + a.imag * a.imag; + a.real = a.real / denom; + a.imag = -a.imag / denom; + b.real = -b.real; + } + switch ((int)b.real) { + case 0: + z.real = 1; + z.imag = 0; + return z; + case 1: + return a; + case 2: + return __Pyx_c_prod_float(a, a); + case 3: + z = __Pyx_c_prod_float(a, a); + return __Pyx_c_prod_float(z, a); + case 4: + z = __Pyx_c_prod_float(a, a); + return __Pyx_c_prod_float(z, z); + } + } + if (a.imag == 0) { + if (a.real == 0) { + return a; + } else if ((b.imag == 0) && (a.real >= 0)) { + z.real = powf(a.real, b.real); + z.imag = 0; + return z; + } else if (a.real > 0) { + r = a.real; + theta = 0; + } else { + r = -a.real; + theta = atan2f(0.0, -1.0); + } + } else { + r = __Pyx_c_abs_float(a); + theta = atan2f(a.imag, a.real); + } + lnr = logf(r); + z_r = expf(lnr * b.real - theta * b.imag); + z_theta = theta * b.real + lnr * b.imag; + z.real = z_r * cosf(z_theta); + z.imag = z_r * sinf(z_theta); + return z; + } + #endif +#endif + +/* Declarations */ +#if CYTHON_CCOMPLEX && (1) && (!0 || __cplusplus) + #ifdef __cplusplus + static CYTHON_INLINE __pyx_t_double_complex __pyx_t_double_complex_from_parts(double x, double y) { + return ::std::complex< double >(x, y); + } + #else + static CYTHON_INLINE __pyx_t_double_complex __pyx_t_double_complex_from_parts(double x, double y) { + return x + y*(__pyx_t_double_complex)_Complex_I; + } + #endif +#else + static CYTHON_INLINE __pyx_t_double_complex __pyx_t_double_complex_from_parts(double x, double y) { + __pyx_t_double_complex z; + z.real = x; + z.imag = y; + return z; + } +#endif + +/* Arithmetic */ +#if CYTHON_CCOMPLEX && (1) && (!0 || __cplusplus) +#else + static CYTHON_INLINE int __Pyx_c_eq_double(__pyx_t_double_complex a, __pyx_t_double_complex b) { + return (a.real == b.real) && (a.imag == b.imag); + } + static CYTHON_INLINE __pyx_t_double_complex __Pyx_c_sum_double(__pyx_t_double_complex a, __pyx_t_double_complex b) { + __pyx_t_double_complex z; + z.real = a.real + b.real; + z.imag = a.imag + b.imag; + return z; + } + static CYTHON_INLINE __pyx_t_double_complex __Pyx_c_diff_double(__pyx_t_double_complex a, __pyx_t_double_complex b) { + __pyx_t_double_complex z; + z.real = a.real - b.real; + z.imag = a.imag - b.imag; + return z; + } + static CYTHON_INLINE __pyx_t_double_complex __Pyx_c_prod_double(__pyx_t_double_complex a, __pyx_t_double_complex b) { + __pyx_t_double_complex z; + z.real = a.real * b.real - a.imag * b.imag; + z.imag = a.real * b.imag + a.imag * b.real; + return z; + } + #if 1 + static CYTHON_INLINE __pyx_t_double_complex __Pyx_c_quot_double(__pyx_t_double_complex a, __pyx_t_double_complex b) { + if (b.imag == 0) { + return __pyx_t_double_complex_from_parts(a.real / b.real, a.imag / b.real); + } else if (fabs(b.real) >= fabs(b.imag)) { + if (b.real == 0 && b.imag == 0) { + return __pyx_t_double_complex_from_parts(a.real / b.real, a.imag / b.imag); + } else { + double r = b.imag / b.real; + double s = (double)(1.0) / (b.real + b.imag * r); + return __pyx_t_double_complex_from_parts( + (a.real + a.imag * r) * s, (a.imag - a.real * r) * s); + } + } else { + double r = b.real / b.imag; + double s = (double)(1.0) / (b.imag + b.real * r); + return __pyx_t_double_complex_from_parts( + (a.real * r + a.imag) * s, (a.imag * r - a.real) * s); + } + } + #else + static CYTHON_INLINE __pyx_t_double_complex __Pyx_c_quot_double(__pyx_t_double_complex a, __pyx_t_double_complex b) { + if (b.imag == 0) { + return __pyx_t_double_complex_from_parts(a.real / b.real, a.imag / b.real); + } else { + double denom = b.real * b.real + b.imag * b.imag; + return __pyx_t_double_complex_from_parts( + (a.real * b.real + a.imag * b.imag) / denom, + (a.imag * b.real - a.real * b.imag) / denom); + } + } + #endif + static CYTHON_INLINE __pyx_t_double_complex __Pyx_c_neg_double(__pyx_t_double_complex a) { + __pyx_t_double_complex z; + z.real = -a.real; + z.imag = -a.imag; + return z; + } + static CYTHON_INLINE int __Pyx_c_is_zero_double(__pyx_t_double_complex a) { + return (a.real == 0) && (a.imag == 0); + } + static CYTHON_INLINE __pyx_t_double_complex __Pyx_c_conj_double(__pyx_t_double_complex a) { + __pyx_t_double_complex z; + z.real = a.real; + z.imag = -a.imag; + return z; + } + #if 1 + static CYTHON_INLINE double __Pyx_c_abs_double(__pyx_t_double_complex z) { + #if !defined(HAVE_HYPOT) || defined(_MSC_VER) + return sqrt(z.real*z.real + z.imag*z.imag); + #else + return hypot(z.real, z.imag); + #endif + } + static CYTHON_INLINE __pyx_t_double_complex __Pyx_c_pow_double(__pyx_t_double_complex a, __pyx_t_double_complex b) { + __pyx_t_double_complex z; + double r, lnr, theta, z_r, z_theta; + if (b.imag == 0 && b.real == (int)b.real) { + if (b.real < 0) { + double denom = a.real * a.real + a.imag * a.imag; + a.real = a.real / denom; + a.imag = -a.imag / denom; + b.real = -b.real; + } + switch ((int)b.real) { + case 0: + z.real = 1; + z.imag = 0; + return z; + case 1: + return a; + case 2: + return __Pyx_c_prod_double(a, a); + case 3: + z = __Pyx_c_prod_double(a, a); + return __Pyx_c_prod_double(z, a); + case 4: + z = __Pyx_c_prod_double(a, a); + return __Pyx_c_prod_double(z, z); + } + } + if (a.imag == 0) { + if (a.real == 0) { + return a; + } else if ((b.imag == 0) && (a.real >= 0)) { + z.real = pow(a.real, b.real); + z.imag = 0; + return z; + } else if (a.real > 0) { + r = a.real; + theta = 0; + } else { + r = -a.real; + theta = atan2(0.0, -1.0); + } + } else { + r = __Pyx_c_abs_double(a); + theta = atan2(a.imag, a.real); + } + lnr = log(r); + z_r = exp(lnr * b.real - theta * b.imag); + z_theta = theta * b.real + lnr * b.imag; + z.real = z_r * cos(z_theta); + z.imag = z_r * sin(z_theta); + return z; + } + #endif +#endif + +/* Declarations */ +#if CYTHON_CCOMPLEX && (1) && (!0 || __cplusplus) + #ifdef __cplusplus + static CYTHON_INLINE __pyx_t_long_double_complex __pyx_t_long_double_complex_from_parts(long double x, long double y) { + return ::std::complex< long double >(x, y); + } + #else + static CYTHON_INLINE __pyx_t_long_double_complex __pyx_t_long_double_complex_from_parts(long double x, long double y) { + return x + y*(__pyx_t_long_double_complex)_Complex_I; + } + #endif +#else + static CYTHON_INLINE __pyx_t_long_double_complex __pyx_t_long_double_complex_from_parts(long double x, long double y) { + __pyx_t_long_double_complex z; + z.real = x; + z.imag = y; + return z; + } +#endif + +/* Arithmetic */ +#if CYTHON_CCOMPLEX && (1) && (!0 || __cplusplus) +#else + static CYTHON_INLINE int __Pyx_c_eq_long__double(__pyx_t_long_double_complex a, __pyx_t_long_double_complex b) { + return (a.real == b.real) && (a.imag == b.imag); + } + static CYTHON_INLINE __pyx_t_long_double_complex __Pyx_c_sum_long__double(__pyx_t_long_double_complex a, __pyx_t_long_double_complex b) { + __pyx_t_long_double_complex z; + z.real = a.real + b.real; + z.imag = a.imag + b.imag; + return z; + } + static CYTHON_INLINE __pyx_t_long_double_complex __Pyx_c_diff_long__double(__pyx_t_long_double_complex a, __pyx_t_long_double_complex b) { + __pyx_t_long_double_complex z; + z.real = a.real - b.real; + z.imag = a.imag - b.imag; + return z; + } + static CYTHON_INLINE __pyx_t_long_double_complex __Pyx_c_prod_long__double(__pyx_t_long_double_complex a, __pyx_t_long_double_complex b) { + __pyx_t_long_double_complex z; + z.real = a.real * b.real - a.imag * b.imag; + z.imag = a.real * b.imag + a.imag * b.real; + return z; + } + #if 1 + static CYTHON_INLINE __pyx_t_long_double_complex __Pyx_c_quot_long__double(__pyx_t_long_double_complex a, __pyx_t_long_double_complex b) { + if (b.imag == 0) { + return __pyx_t_long_double_complex_from_parts(a.real / b.real, a.imag / b.real); + } else if (fabsl(b.real) >= fabsl(b.imag)) { + if (b.real == 0 && b.imag == 0) { + return __pyx_t_long_double_complex_from_parts(a.real / b.real, a.imag / b.imag); + } else { + long double r = b.imag / b.real; + long double s = (long double)(1.0) / (b.real + b.imag * r); + return __pyx_t_long_double_complex_from_parts( + (a.real + a.imag * r) * s, (a.imag - a.real * r) * s); + } + } else { + long double r = b.real / b.imag; + long double s = (long double)(1.0) / (b.imag + b.real * r); + return __pyx_t_long_double_complex_from_parts( + (a.real * r + a.imag) * s, (a.imag * r - a.real) * s); + } + } + #else + static CYTHON_INLINE __pyx_t_long_double_complex __Pyx_c_quot_long__double(__pyx_t_long_double_complex a, __pyx_t_long_double_complex b) { + if (b.imag == 0) { + return __pyx_t_long_double_complex_from_parts(a.real / b.real, a.imag / b.real); + } else { + long double denom = b.real * b.real + b.imag * b.imag; + return __pyx_t_long_double_complex_from_parts( + (a.real * b.real + a.imag * b.imag) / denom, + (a.imag * b.real - a.real * b.imag) / denom); + } + } + #endif + static CYTHON_INLINE __pyx_t_long_double_complex __Pyx_c_neg_long__double(__pyx_t_long_double_complex a) { + __pyx_t_long_double_complex z; + z.real = -a.real; + z.imag = -a.imag; + return z; + } + static CYTHON_INLINE int __Pyx_c_is_zero_long__double(__pyx_t_long_double_complex a) { + return (a.real == 0) && (a.imag == 0); + } + static CYTHON_INLINE __pyx_t_long_double_complex __Pyx_c_conj_long__double(__pyx_t_long_double_complex a) { + __pyx_t_long_double_complex z; + z.real = a.real; + z.imag = -a.imag; + return z; + } + #if 1 + static CYTHON_INLINE long double __Pyx_c_abs_long__double(__pyx_t_long_double_complex z) { + #if !defined(HAVE_HYPOT) || defined(_MSC_VER) + return sqrtl(z.real*z.real + z.imag*z.imag); + #else + return hypotl(z.real, z.imag); + #endif + } + static CYTHON_INLINE __pyx_t_long_double_complex __Pyx_c_pow_long__double(__pyx_t_long_double_complex a, __pyx_t_long_double_complex b) { + __pyx_t_long_double_complex z; + long double r, lnr, theta, z_r, z_theta; + if (b.imag == 0 && b.real == (int)b.real) { + if (b.real < 0) { + long double denom = a.real * a.real + a.imag * a.imag; + a.real = a.real / denom; + a.imag = -a.imag / denom; + b.real = -b.real; + } + switch ((int)b.real) { + case 0: + z.real = 1; + z.imag = 0; + return z; + case 1: + return a; + case 2: + return __Pyx_c_prod_long__double(a, a); + case 3: + z = __Pyx_c_prod_long__double(a, a); + return __Pyx_c_prod_long__double(z, a); + case 4: + z = __Pyx_c_prod_long__double(a, a); + return __Pyx_c_prod_long__double(z, z); + } + } + if (a.imag == 0) { + if (a.real == 0) { + return a; + } else if ((b.imag == 0) && (a.real >= 0)) { + z.real = powl(a.real, b.real); + z.imag = 0; + return z; + } else if (a.real > 0) { + r = a.real; + theta = 0; + } else { + r = -a.real; + theta = atan2l(0.0, -1.0); + } + } else { + r = __Pyx_c_abs_long__double(a); + theta = atan2l(a.imag, a.real); + } + lnr = logl(r); + z_r = expl(lnr * b.real - theta * b.imag); + z_theta = theta * b.real + lnr * b.imag; + z.real = z_r * cosl(z_theta); + z.imag = z_r * sinl(z_theta); + return z; + } + #endif +#endif + +/* MemviewRefcount */ +#include +#ifndef _Py_NO_RETURN +#define _Py_NO_RETURN +#endif +_Py_NO_RETURN +static void __pyx_fatalerror(const char *fmt, ...) { + va_list vargs; + char msg[200]; +#if PY_VERSION_HEX >= 0x030A0000 || defined(HAVE_STDARG_PROTOTYPES) + va_start(vargs, fmt); +#else + va_start(vargs); +#endif + vsnprintf(msg, 200, fmt, vargs); + va_end(vargs); + Py_FatalError(msg); +} +static CYTHON_INLINE int +__pyx_add_acquisition_count_locked(__pyx_atomic_int_type *acquisition_count, + PyThread_type_lock lock) +{ + int result; + PyThread_acquire_lock(lock, 1); + result = (*acquisition_count)++; + PyThread_release_lock(lock); + return result; +} +static CYTHON_INLINE int +__pyx_sub_acquisition_count_locked(__pyx_atomic_int_type *acquisition_count, + PyThread_type_lock lock) +{ + int result; + PyThread_acquire_lock(lock, 1); + result = (*acquisition_count)--; + PyThread_release_lock(lock); + return result; +} +static CYTHON_INLINE void +__Pyx_INC_MEMVIEW(__Pyx_memviewslice *memslice, int have_gil, int lineno) +{ + __pyx_nonatomic_int_type old_acquisition_count; + struct __pyx_memoryview_obj *memview = memslice->memview; + if (unlikely(!memview || (PyObject *) memview == Py_None)) { + return; + } + old_acquisition_count = __pyx_add_acquisition_count(memview); + if (unlikely(old_acquisition_count <= 0)) { + if (likely(old_acquisition_count == 0)) { + if (have_gil) { + Py_INCREF((PyObject *) memview); + } else { + PyGILState_STATE _gilstate = PyGILState_Ensure(); + Py_INCREF((PyObject *) memview); + PyGILState_Release(_gilstate); + } + } else { + __pyx_fatalerror("Acquisition count is %d (line %d)", + old_acquisition_count+1, lineno); + } + } +} +static CYTHON_INLINE void __Pyx_XCLEAR_MEMVIEW(__Pyx_memviewslice *memslice, + int have_gil, int lineno) { + __pyx_nonatomic_int_type old_acquisition_count; + struct __pyx_memoryview_obj *memview = memslice->memview; + if (unlikely(!memview || (PyObject *) memview == Py_None)) { + memslice->memview = NULL; + return; + } + old_acquisition_count = __pyx_sub_acquisition_count(memview); + memslice->data = NULL; + if (likely(old_acquisition_count > 1)) { + memslice->memview = NULL; + } else if (likely(old_acquisition_count == 1)) { + if (have_gil) { + Py_CLEAR(memslice->memview); + } else { + PyGILState_STATE _gilstate = PyGILState_Ensure(); + Py_CLEAR(memslice->memview); + PyGILState_Release(_gilstate); + } + } else { + __pyx_fatalerror("Acquisition count is %d (line %d)", + old_acquisition_count-1, lineno); + } +} + +/* MemviewSliceIsContig */ +static int +__pyx_memviewslice_is_contig(const __Pyx_memviewslice mvs, char order, int ndim) +{ + int i, index, step, start; + Py_ssize_t itemsize = mvs.memview->view.itemsize; + if (order == 'F') { + step = 1; + start = 0; + } else { + step = -1; + start = ndim - 1; + } + for (i = 0; i < ndim; i++) { + index = start + step * i; + if (mvs.suboffsets[index] >= 0 || mvs.strides[index] != itemsize) + return 0; + itemsize *= mvs.shape[index]; + } + return 1; +} + +/* OverlappingSlices */ +static void +__pyx_get_array_memory_extents(__Pyx_memviewslice *slice, + void **out_start, void **out_end, + int ndim, size_t itemsize) +{ + char *start, *end; + int i; + start = end = slice->data; + for (i = 0; i < ndim; i++) { + Py_ssize_t stride = slice->strides[i]; + Py_ssize_t extent = slice->shape[i]; + if (extent == 0) { + *out_start = *out_end = start; + return; + } else { + if (stride > 0) + end += stride * (extent - 1); + else + start += stride * (extent - 1); + } + } + *out_start = start; + *out_end = end + itemsize; +} +static int +__pyx_slices_overlap(__Pyx_memviewslice *slice1, + __Pyx_memviewslice *slice2, + int ndim, size_t itemsize) +{ + void *start1, *end1, *start2, *end2; + __pyx_get_array_memory_extents(slice1, &start1, &end1, ndim, itemsize); + __pyx_get_array_memory_extents(slice2, &start2, &end2, ndim, itemsize); + return (start1 < end2) && (start2 < end1); +} + +/* MemviewSliceInit */ +static int +__Pyx_init_memviewslice(struct __pyx_memoryview_obj *memview, + int ndim, + __Pyx_memviewslice *memviewslice, + int memview_is_new_reference) +{ + __Pyx_RefNannyDeclarations + int i, retval=-1; + Py_buffer *buf = &memview->view; + __Pyx_RefNannySetupContext("init_memviewslice", 0); + if (unlikely(memviewslice->memview || memviewslice->data)) { + PyErr_SetString(PyExc_ValueError, + "memviewslice is already initialized!"); + goto fail; + } + if (buf->strides) { + for (i = 0; i < ndim; i++) { + memviewslice->strides[i] = buf->strides[i]; + } + } else { + Py_ssize_t stride = buf->itemsize; + for (i = ndim - 1; i >= 0; i--) { + memviewslice->strides[i] = stride; + stride *= buf->shape[i]; + } + } + for (i = 0; i < ndim; i++) { + memviewslice->shape[i] = buf->shape[i]; + if (buf->suboffsets) { + memviewslice->suboffsets[i] = buf->suboffsets[i]; + } else { + memviewslice->suboffsets[i] = -1; + } + } + memviewslice->memview = memview; + memviewslice->data = (char *)buf->buf; + if (__pyx_add_acquisition_count(memview) == 0 && !memview_is_new_reference) { + Py_INCREF((PyObject*)memview); + } + retval = 0; + goto no_fail; +fail: + memviewslice->memview = 0; + memviewslice->data = 0; + retval = -1; +no_fail: + __Pyx_RefNannyFinishContext(); + return retval; +} + +/* 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 + } +} + +/* CIntToPy */ +static CYTHON_INLINE PyObject* __Pyx_PyLong_From_uint64_t(uint64_t value) { +#ifdef __Pyx_HAS_GCC_DIAGNOSTIC +#pragma GCC diagnostic push +#pragma GCC diagnostic ignored "-Wconversion" +#endif + const uint64_t neg_one = (uint64_t) -1, const_zero = (uint64_t) 0; +#ifdef __Pyx_HAS_GCC_DIAGNOSTIC +#pragma GCC diagnostic pop +#endif + const int is_unsigned = neg_one > const_zero; + if (is_unsigned) { + if (sizeof(uint64_t) < sizeof(long)) { + return PyLong_FromLong((long) value); + } else if (sizeof(uint64_t) <= sizeof(unsigned long)) { + return PyLong_FromUnsignedLong((unsigned long) value); +#if !CYTHON_COMPILING_IN_PYPY + } else if (sizeof(uint64_t) <= sizeof(unsigned PY_LONG_LONG)) { + return PyLong_FromUnsignedLongLong((unsigned PY_LONG_LONG) value); +#endif + } + } else { + if (sizeof(uint64_t) <= sizeof(long)) { + return PyLong_FromLong((long) value); + } else if (sizeof(uint64_t) <= 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(uint64_t), + 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(uint64_t)); + 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 uint64_t __Pyx_PyLong_As_uint64_t(PyObject *x) { +#ifdef __Pyx_HAS_GCC_DIAGNOSTIC +#pragma GCC diagnostic push +#pragma GCC diagnostic ignored "-Wconversion" +#endif + const uint64_t neg_one = (uint64_t) -1, const_zero = (uint64_t) 0; +#ifdef __Pyx_HAS_GCC_DIAGNOSTIC +#pragma GCC diagnostic pop +#endif + const int is_unsigned = neg_one > const_zero; + if (unlikely(!PyLong_Check(x))) { + uint64_t val; + PyObject *tmp = __Pyx_PyNumber_Long(x); + if (!tmp) return (uint64_t) -1; + val = __Pyx_PyLong_As_uint64_t(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(uint64_t, __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(uint64_t) > 1 * PyLong_SHIFT)) { + if ((8 * sizeof(unsigned long) > 2 * PyLong_SHIFT)) { + __PYX_VERIFY_RETURN_INT(uint64_t, unsigned long, (((((unsigned long)digits[1]) << PyLong_SHIFT) | (unsigned long)digits[0]))) + } else if ((8 * sizeof(uint64_t) >= 2 * PyLong_SHIFT)) { + return (uint64_t) (((((uint64_t)digits[1]) << PyLong_SHIFT) | (uint64_t)digits[0])); + } + } + break; + case 3: + if ((8 * sizeof(uint64_t) > 2 * PyLong_SHIFT)) { + if ((8 * sizeof(unsigned long) > 3 * PyLong_SHIFT)) { + __PYX_VERIFY_RETURN_INT(uint64_t, unsigned long, (((((((unsigned long)digits[2]) << PyLong_SHIFT) | (unsigned long)digits[1]) << PyLong_SHIFT) | (unsigned long)digits[0]))) + } else if ((8 * sizeof(uint64_t) >= 3 * PyLong_SHIFT)) { + return (uint64_t) (((((((uint64_t)digits[2]) << PyLong_SHIFT) | (uint64_t)digits[1]) << PyLong_SHIFT) | (uint64_t)digits[0])); + } + } + break; + case 4: + if ((8 * sizeof(uint64_t) > 3 * PyLong_SHIFT)) { + if ((8 * sizeof(unsigned long) > 4 * PyLong_SHIFT)) { + __PYX_VERIFY_RETURN_INT(uint64_t, unsigned long, (((((((((unsigned long)digits[3]) << PyLong_SHIFT) | (unsigned long)digits[2]) << PyLong_SHIFT) | (unsigned long)digits[1]) << PyLong_SHIFT) | (unsigned long)digits[0]))) + } else if ((8 * sizeof(uint64_t) >= 4 * PyLong_SHIFT)) { + return (uint64_t) (((((((((uint64_t)digits[3]) << PyLong_SHIFT) | (uint64_t)digits[2]) << PyLong_SHIFT) | (uint64_t)digits[1]) << PyLong_SHIFT) | (uint64_t)digits[0])); + } + } + break; + } + } +#endif +#if CYTHON_COMPILING_IN_CPYTHON && 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 (uint64_t) -1; + if (unlikely(result == 1)) + goto raise_neg_overflow; + } +#endif + if ((sizeof(uint64_t) <= sizeof(unsigned long))) { + __PYX_VERIFY_RETURN_INT_EXC(uint64_t, unsigned long, PyLong_AsUnsignedLong(x)) + } else if ((sizeof(uint64_t) <= sizeof(unsigned PY_LONG_LONG))) { + __PYX_VERIFY_RETURN_INT_EXC(uint64_t, unsigned PY_LONG_LONG, PyLong_AsUnsignedLongLong(x)) + } + } else { +#if CYTHON_USE_PYLONG_INTERNALS + if (__Pyx_PyLong_IsCompact(x)) { + __PYX_VERIFY_RETURN_INT(uint64_t, __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(uint64_t) - 1 > 1 * PyLong_SHIFT)) { + if ((8 * sizeof(unsigned long) > 2 * PyLong_SHIFT)) { + __PYX_VERIFY_RETURN_INT(uint64_t, long, -(long) (((((unsigned long)digits[1]) << PyLong_SHIFT) | (unsigned long)digits[0]))) + } else if ((8 * sizeof(uint64_t) - 1 > 2 * PyLong_SHIFT)) { + return (uint64_t) (((uint64_t)-1)*(((((uint64_t)digits[1]) << PyLong_SHIFT) | (uint64_t)digits[0]))); + } + } + break; + case 2: + if ((8 * sizeof(uint64_t) > 1 * PyLong_SHIFT)) { + if ((8 * sizeof(unsigned long) > 2 * PyLong_SHIFT)) { + __PYX_VERIFY_RETURN_INT(uint64_t, unsigned long, (((((unsigned long)digits[1]) << PyLong_SHIFT) | (unsigned long)digits[0]))) + } else if ((8 * sizeof(uint64_t) - 1 > 2 * PyLong_SHIFT)) { + return (uint64_t) ((((((uint64_t)digits[1]) << PyLong_SHIFT) | (uint64_t)digits[0]))); + } + } + break; + case -3: + if ((8 * sizeof(uint64_t) - 1 > 2 * PyLong_SHIFT)) { + if ((8 * sizeof(unsigned long) > 3 * PyLong_SHIFT)) { + __PYX_VERIFY_RETURN_INT(uint64_t, long, -(long) (((((((unsigned long)digits[2]) << PyLong_SHIFT) | (unsigned long)digits[1]) << PyLong_SHIFT) | (unsigned long)digits[0]))) + } else if ((8 * sizeof(uint64_t) - 1 > 3 * PyLong_SHIFT)) { + return (uint64_t) (((uint64_t)-1)*(((((((uint64_t)digits[2]) << PyLong_SHIFT) | (uint64_t)digits[1]) << PyLong_SHIFT) | (uint64_t)digits[0]))); + } + } + break; + case 3: + if ((8 * sizeof(uint64_t) > 2 * PyLong_SHIFT)) { + if ((8 * sizeof(unsigned long) > 3 * PyLong_SHIFT)) { + __PYX_VERIFY_RETURN_INT(uint64_t, unsigned long, (((((((unsigned long)digits[2]) << PyLong_SHIFT) | (unsigned long)digits[1]) << PyLong_SHIFT) | (unsigned long)digits[0]))) + } else if ((8 * sizeof(uint64_t) - 1 > 3 * PyLong_SHIFT)) { + return (uint64_t) ((((((((uint64_t)digits[2]) << PyLong_SHIFT) | (uint64_t)digits[1]) << PyLong_SHIFT) | (uint64_t)digits[0]))); + } + } + break; + case -4: + if ((8 * sizeof(uint64_t) - 1 > 3 * PyLong_SHIFT)) { + if ((8 * sizeof(unsigned long) > 4 * PyLong_SHIFT)) { + __PYX_VERIFY_RETURN_INT(uint64_t, long, -(long) (((((((((unsigned long)digits[3]) << PyLong_SHIFT) | (unsigned long)digits[2]) << PyLong_SHIFT) | (unsigned long)digits[1]) << PyLong_SHIFT) | (unsigned long)digits[0]))) + } else if ((8 * sizeof(uint64_t) - 1 > 4 * PyLong_SHIFT)) { + return (uint64_t) (((uint64_t)-1)*(((((((((uint64_t)digits[3]) << PyLong_SHIFT) | (uint64_t)digits[2]) << PyLong_SHIFT) | (uint64_t)digits[1]) << PyLong_SHIFT) | (uint64_t)digits[0]))); + } + } + break; + case 4: + if ((8 * sizeof(uint64_t) > 3 * PyLong_SHIFT)) { + if ((8 * sizeof(unsigned long) > 4 * PyLong_SHIFT)) { + __PYX_VERIFY_RETURN_INT(uint64_t, unsigned long, (((((((((unsigned long)digits[3]) << PyLong_SHIFT) | (unsigned long)digits[2]) << PyLong_SHIFT) | (unsigned long)digits[1]) << PyLong_SHIFT) | (unsigned long)digits[0]))) + } else if ((8 * sizeof(uint64_t) - 1 > 4 * PyLong_SHIFT)) { + return (uint64_t) ((((((((((uint64_t)digits[3]) << PyLong_SHIFT) | (uint64_t)digits[2]) << PyLong_SHIFT) | (uint64_t)digits[1]) << PyLong_SHIFT) | (uint64_t)digits[0]))); + } + } + break; + } + } +#endif + if ((sizeof(uint64_t) <= sizeof(long))) { + __PYX_VERIFY_RETURN_INT_EXC(uint64_t, long, PyLong_AsLong(x)) + } else if ((sizeof(uint64_t) <= sizeof(PY_LONG_LONG))) { + __PYX_VERIFY_RETURN_INT_EXC(uint64_t, PY_LONG_LONG, PyLong_AsLongLong(x)) + } + } + { + uint64_t 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 (uint64_t) -1; + assert(PyLong_CheckExact(v)); + } + { + int result = PyObject_RichCompareBool(v, Py_False, Py_LT); + if (unlikely(result < 0)) { + Py_DECREF(v); + return (uint64_t) -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 (uint64_t) -1; + } else { + stepval = v; + } + v = NULL; + val = (uint64_t) 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(uint64_t) * 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 |= ((uint64_t) 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(uint64_t) * 8) - bits - (is_unsigned ? 0 : 1); + if (unlikely(idigit >= (1L << remaining_bits))) + goto raise_overflow; + val |= ((uint64_t) idigit) << bits; + } + if (!is_unsigned) { + if (unlikely(val & (((uint64_t) 1) << (sizeof(uint64_t) * 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 (uint64_t) -1; + return val; + } +raise_overflow: + PyErr_SetString(PyExc_OverflowError, + "value too large to convert to uint64_t"); + return (uint64_t) -1; +raise_neg_overflow: + PyErr_SetString(PyExc_OverflowError, + "can't convert negative value to uint64_t"); + return (uint64_t) -1; +} + +/* MemviewSliceCopy */ +static __Pyx_memviewslice +__pyx_memoryview_copy_new_contig(const __Pyx_memviewslice *from_mvs, + const char *mode, int ndim, + size_t sizeof_dtype, int contig_flag, + int dtype_is_object) +{ + __Pyx_RefNannyDeclarations + int i; + __Pyx_memviewslice new_mvs = __Pyx_MEMSLICE_INIT; + struct __pyx_memoryview_obj *from_memview = from_mvs->memview; + Py_buffer *buf = &from_memview->view; + PyObject *shape_tuple = NULL; + PyObject *temp_int = NULL; + struct __pyx_array_obj *array_obj = NULL; + struct __pyx_memoryview_obj *memview_obj = NULL; + __Pyx_RefNannySetupContext("__pyx_memoryview_copy_new_contig", 0); + for (i = 0; i < ndim; i++) { + if (unlikely(from_mvs->suboffsets[i] >= 0)) { + PyErr_Format(PyExc_ValueError, "Cannot copy memoryview slice with " + "indirect dimensions (axis %d)", i); + goto fail; + } + } + shape_tuple = PyTuple_New(ndim); + if (unlikely(!shape_tuple)) { + goto fail; + } + __Pyx_GOTREF(shape_tuple); + for(i = 0; i < ndim; i++) { + temp_int = PyLong_FromSsize_t(from_mvs->shape[i]); + if(unlikely(!temp_int)) { + goto fail; + } else { +#if CYTHON_ASSUME_SAFE_MACROS + PyTuple_SET_ITEM(shape_tuple, i, temp_int); +#else + if (PyTuple_SetItem(shape_tuple, i, temp_int) < 0) { + goto fail; + } +#endif + temp_int = NULL; + } + } + array_obj = __pyx_array_new(shape_tuple, sizeof_dtype, buf->format, mode, NULL); + if (unlikely(!array_obj)) { + goto fail; + } + __Pyx_GOTREF(array_obj); + memview_obj = (struct __pyx_memoryview_obj *) __pyx_memoryview_new( + (PyObject *) array_obj, contig_flag, + dtype_is_object, + from_mvs->memview->typeinfo); + if (unlikely(!memview_obj)) + goto fail; + if (unlikely(__Pyx_init_memviewslice(memview_obj, ndim, &new_mvs, 1) < 0)) + goto fail; + if (unlikely(__pyx_memoryview_copy_contents(*from_mvs, new_mvs, ndim, ndim, + dtype_is_object) < 0)) + goto fail; + goto no_fail; +fail: + __Pyx_XDECREF((PyObject *) new_mvs.memview); + new_mvs.memview = NULL; + new_mvs.data = NULL; +no_fail: + __Pyx_XDECREF(shape_tuple); + __Pyx_XDECREF(temp_int); + __Pyx_XDECREF((PyObject *) array_obj); + __Pyx_RefNannyFinishContext(); + return new_mvs; +} + +/* PyObjectCallMethod1 (used by UpdateUnpickledDict) */ +#if !(CYTHON_VECTORCALL && (__PYX_LIMITED_VERSION_HEX >= 0x030C0000 || (!CYTHON_COMPILING_IN_LIMITED_API && PY_VERSION_HEX >= 0x03090000))) +static PyObject* __Pyx__PyObject_CallMethod1(PyObject* method, PyObject* arg) { + PyObject *result = __Pyx_PyObject_CallOneArg(method, arg); + Py_DECREF(method); + return result; +} +#endif +static PyObject* __Pyx_PyObject_CallMethod1(PyObject* obj, PyObject* method_name, PyObject* arg) { +#if CYTHON_VECTORCALL && (__PYX_LIMITED_VERSION_HEX >= 0x030C0000 || (!CYTHON_COMPILING_IN_LIMITED_API && PY_VERSION_HEX >= 0x03090000)) + PyObject *args[2] = {obj, arg}; + (void) __Pyx_PyObject_CallOneArg; + (void) __Pyx_PyObject_Call2Args; + return PyObject_VectorcallMethod(method_name, args, 2 | PY_VECTORCALL_ARGUMENTS_OFFSET, NULL); +#else + PyObject *method = NULL, *result; + int is_method = __Pyx_PyObject_GetMethod(obj, method_name, &method); + if (likely(is_method)) { + result = __Pyx_PyObject_Call2Args(method, obj, arg); + Py_DECREF(method); + return result; + } + if (unlikely(!method)) return NULL; + return __Pyx__PyObject_CallMethod1(method, arg); +#endif +} + +/* UpdateUnpickledDict */ +static int __Pyx__UpdateUnpickledDict(PyObject *obj, PyObject *state, Py_ssize_t index) { + PyObject *state_dict = __Pyx_PySequence_ITEM(state, index); + if (unlikely(!state_dict)) { + return -1; + } + int non_empty = PyObject_IsTrue(state_dict); + if (non_empty == 0) { + Py_DECREF(state_dict); + return 0; + } else if (unlikely(non_empty == -1)) { + return -1; + } + PyObject *dict; + #if CYTHON_COMPILING_IN_LIMITED_API && __PYX_LIMITED_VERSION_HEX < 0x030A0000 + dict = PyObject_GetAttrString(obj, "__dict__"); + #else + dict = PyObject_GenericGetDict(obj, NULL); + #endif + if (unlikely(!dict)) { + Py_DECREF(state_dict); + return -1; + } + int result; + if (likely(PyDict_CheckExact(dict))) { + result = PyDict_Update(dict, state_dict); + } else { + PyObject *obj_result = __Pyx_PyObject_CallMethod1(dict, __pyx_mstate_global->__pyx_n_u_update, state_dict); + if (likely(obj_result)) { + Py_DECREF(obj_result); + result = 0; + } else { + result = -1; + } + } + Py_DECREF(state_dict); + Py_DECREF(dict); + return result; +} +static int __Pyx_UpdateUnpickledDict(PyObject *obj, PyObject *state, Py_ssize_t index) { + Py_ssize_t state_size = __Pyx_PyTuple_GET_SIZE(state); + #if !CYTHON_ASSUME_SAFE_SIZE + if (unlikely(state_size == -1)) return -1; + #endif + if (state_size <= index) { + return 0; + } + return __Pyx__UpdateUnpickledDict(obj, state, index); +} + +/* CheckUnpickleChecksum */ +static void __Pyx_RaiseUnpickleChecksumError(long checksum, long checksum1, long checksum2, long checksum3, const char *members) { + PyObject *pickle_module = PyImport_ImportModule("pickle"); + if (unlikely(!pickle_module)) return; + PyObject *pickle_error = PyObject_GetAttrString(pickle_module, "PickleError"); + Py_DECREF(pickle_module); + if (unlikely(!pickle_error)) return; + if (checksum2 == checksum1) { + PyErr_Format(pickle_error, "Incompatible checksums (0x%x vs (0x%x) = (%s))", + checksum, checksum1, members); + } else if (checksum3 == checksum2) { + PyErr_Format(pickle_error, "Incompatible checksums (0x%x vs (0x%x, 0x%x) = (%s))", + checksum, checksum1, checksum2, members); + } else { + PyErr_Format(pickle_error, "Incompatible checksums (0x%x vs (0x%x, 0x%x, 0x%x) = (%s))", + checksum, checksum1, checksum2, checksum3, members); + } + Py_DECREF(pickle_error); +} +static int __Pyx_CheckUnpickleChecksum(long checksum, long checksum1, long checksum2, long checksum3, const char *members) { + int found = 0; + found |= checksum1 == checksum; + found |= checksum2 == checksum; + found |= checksum3 == checksum; + if (likely(found)) + return 0; + __Pyx_RaiseUnpickleChecksumError(checksum, checksum1, checksum2, checksum3, members); + return -1; +} + +/* 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; +} + +/* 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 char __Pyx_PyLong_As_char(PyObject *x) { +#ifdef __Pyx_HAS_GCC_DIAGNOSTIC +#pragma GCC diagnostic push +#pragma GCC diagnostic ignored "-Wconversion" +#endif + const char neg_one = (char) -1, const_zero = (char) 0; +#ifdef __Pyx_HAS_GCC_DIAGNOSTIC +#pragma GCC diagnostic pop +#endif + const int is_unsigned = neg_one > const_zero; + if (unlikely(!PyLong_Check(x))) { + char val; + PyObject *tmp = __Pyx_PyNumber_Long(x); + if (!tmp) return (char) -1; + val = __Pyx_PyLong_As_char(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(char, __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(char) > 1 * PyLong_SHIFT)) { + if ((8 * sizeof(unsigned long) > 2 * PyLong_SHIFT)) { + __PYX_VERIFY_RETURN_INT(char, unsigned long, (((((unsigned long)digits[1]) << PyLong_SHIFT) | (unsigned long)digits[0]))) + } else if ((8 * sizeof(char) >= 2 * PyLong_SHIFT)) { + return (char) (((((char)digits[1]) << PyLong_SHIFT) | (char)digits[0])); + } + } + break; + case 3: + if ((8 * sizeof(char) > 2 * PyLong_SHIFT)) { + if ((8 * sizeof(unsigned long) > 3 * PyLong_SHIFT)) { + __PYX_VERIFY_RETURN_INT(char, unsigned long, (((((((unsigned long)digits[2]) << PyLong_SHIFT) | (unsigned long)digits[1]) << PyLong_SHIFT) | (unsigned long)digits[0]))) + } else if ((8 * sizeof(char) >= 3 * PyLong_SHIFT)) { + return (char) (((((((char)digits[2]) << PyLong_SHIFT) | (char)digits[1]) << PyLong_SHIFT) | (char)digits[0])); + } + } + break; + case 4: + if ((8 * sizeof(char) > 3 * PyLong_SHIFT)) { + if ((8 * sizeof(unsigned long) > 4 * PyLong_SHIFT)) { + __PYX_VERIFY_RETURN_INT(char, 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(char) >= 4 * PyLong_SHIFT)) { + return (char) (((((((((char)digits[3]) << PyLong_SHIFT) | (char)digits[2]) << PyLong_SHIFT) | (char)digits[1]) << PyLong_SHIFT) | (char)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 (char) -1; + if (unlikely(result == 1)) + goto raise_neg_overflow; + } +#endif + if ((sizeof(char) <= sizeof(unsigned long))) { + __PYX_VERIFY_RETURN_INT_EXC(char, unsigned long, PyLong_AsUnsignedLong(x)) + } else if ((sizeof(char) <= sizeof(unsigned PY_LONG_LONG))) { + __PYX_VERIFY_RETURN_INT_EXC(char, unsigned PY_LONG_LONG, PyLong_AsUnsignedLongLong(x)) + } + } else { +#if CYTHON_USE_PYLONG_INTERNALS + if (__Pyx_PyLong_IsCompact(x)) { + __PYX_VERIFY_RETURN_INT(char, __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(char) - 1 > 1 * PyLong_SHIFT)) { + if ((8 * sizeof(unsigned long) > 2 * PyLong_SHIFT)) { + __PYX_VERIFY_RETURN_INT(char, long, -(long) (((((unsigned long)digits[1]) << PyLong_SHIFT) | (unsigned long)digits[0]))) + } else if ((8 * sizeof(char) - 1 > 2 * PyLong_SHIFT)) { + return (char) (((char)-1)*(((((char)digits[1]) << PyLong_SHIFT) | (char)digits[0]))); + } + } + break; + case 2: + if ((8 * sizeof(char) > 1 * PyLong_SHIFT)) { + if ((8 * sizeof(unsigned long) > 2 * PyLong_SHIFT)) { + __PYX_VERIFY_RETURN_INT(char, unsigned long, (((((unsigned long)digits[1]) << PyLong_SHIFT) | (unsigned long)digits[0]))) + } else if ((8 * sizeof(char) - 1 > 2 * PyLong_SHIFT)) { + return (char) ((((((char)digits[1]) << PyLong_SHIFT) | (char)digits[0]))); + } + } + break; + case -3: + if ((8 * sizeof(char) - 1 > 2 * PyLong_SHIFT)) { + if ((8 * sizeof(unsigned long) > 3 * PyLong_SHIFT)) { + __PYX_VERIFY_RETURN_INT(char, long, -(long) (((((((unsigned long)digits[2]) << PyLong_SHIFT) | (unsigned long)digits[1]) << PyLong_SHIFT) | (unsigned long)digits[0]))) + } else if ((8 * sizeof(char) - 1 > 3 * PyLong_SHIFT)) { + return (char) (((char)-1)*(((((((char)digits[2]) << PyLong_SHIFT) | (char)digits[1]) << PyLong_SHIFT) | (char)digits[0]))); + } + } + break; + case 3: + if ((8 * sizeof(char) > 2 * PyLong_SHIFT)) { + if ((8 * sizeof(unsigned long) > 3 * PyLong_SHIFT)) { + __PYX_VERIFY_RETURN_INT(char, unsigned long, (((((((unsigned long)digits[2]) << PyLong_SHIFT) | (unsigned long)digits[1]) << PyLong_SHIFT) | (unsigned long)digits[0]))) + } else if ((8 * sizeof(char) - 1 > 3 * PyLong_SHIFT)) { + return (char) ((((((((char)digits[2]) << PyLong_SHIFT) | (char)digits[1]) << PyLong_SHIFT) | (char)digits[0]))); + } + } + break; + case -4: + if ((8 * sizeof(char) - 1 > 3 * PyLong_SHIFT)) { + if ((8 * sizeof(unsigned long) > 4 * PyLong_SHIFT)) { + __PYX_VERIFY_RETURN_INT(char, 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(char) - 1 > 4 * PyLong_SHIFT)) { + return (char) (((char)-1)*(((((((((char)digits[3]) << PyLong_SHIFT) | (char)digits[2]) << PyLong_SHIFT) | (char)digits[1]) << PyLong_SHIFT) | (char)digits[0]))); + } + } + break; + case 4: + if ((8 * sizeof(char) > 3 * PyLong_SHIFT)) { + if ((8 * sizeof(unsigned long) > 4 * PyLong_SHIFT)) { + __PYX_VERIFY_RETURN_INT(char, 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(char) - 1 > 4 * PyLong_SHIFT)) { + return (char) ((((((((((char)digits[3]) << PyLong_SHIFT) | (char)digits[2]) << PyLong_SHIFT) | (char)digits[1]) << PyLong_SHIFT) | (char)digits[0]))); + } + } + break; + } + } +#endif + if ((sizeof(char) <= sizeof(long))) { + __PYX_VERIFY_RETURN_INT_EXC(char, long, PyLong_AsLong(x)) + } else if ((sizeof(char) <= sizeof(PY_LONG_LONG))) { + __PYX_VERIFY_RETURN_INT_EXC(char, PY_LONG_LONG, PyLong_AsLongLong(x)) + } + } + { + char 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 (char) -1; + assert(PyLong_CheckExact(v)); + } + { + int result = PyObject_RichCompareBool(v, Py_False, Py_LT); + if (unlikely(result < 0)) { + Py_DECREF(v); + return (char) -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 (char) -1; + } else { + stepval = v; + } + v = NULL; + val = (char) 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(char) * 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 |= ((char) 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(char) * 8) - bits - (is_unsigned ? 0 : 1); + if (unlikely(idigit >= (1L << remaining_bits))) + goto raise_overflow; + val |= ((char) idigit) << bits; + } + if (!is_unsigned) { + if (unlikely(val & (((char) 1) << (sizeof(char) * 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 (char) -1; + return val; + } +raise_overflow: + PyErr_SetString(PyExc_OverflowError, + "value too large to convert to char"); + return (char) -1; +raise_neg_overflow: + PyErr_SetString(PyExc_OverflowError, + "can't convert negative value to char"); + return (char) -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__7); + } + goto done; +} +#endif + +/* GetRuntimeVersion */ +#if __PYX_LIMITED_VERSION_HEX < 0x030b0000 +void __Pyx_init_runtime_version(void) { + if (__Pyx_cached_runtime_version == 0) { + const char* rt_version = Py_GetVersion(); + unsigned long version = 0; + unsigned long factor = 0x01000000UL; + unsigned int digit = 0; + int i = 0; + while (factor) { + while ('0' <= rt_version[i] && rt_version[i] <= '9') { + digit = digit * 10 + (unsigned int) (rt_version[i] - '0'); + ++i; + } + version += factor * digit; + if (rt_version[i] != '.') + break; + digit = 0; + factor >>= 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 +} + +/* IterNextPlain (used by CoroutineBase) */ +#if CYTHON_COMPILING_IN_LIMITED_API && __PYX_LIMITED_VERSION_HEX < 0x030A0000 +static PyObject *__Pyx_GetBuiltinNext_LimitedAPI(void) { + if (unlikely(!__pyx_mstate_global->__Pyx_GetBuiltinNext_LimitedAPI_cache)) + __pyx_mstate_global->__Pyx_GetBuiltinNext_LimitedAPI_cache = __Pyx_GetBuiltinName(__pyx_mstate_global->__pyx_n_u_next); + return __pyx_mstate_global->__Pyx_GetBuiltinNext_LimitedAPI_cache; +} +#endif +static CYTHON_INLINE PyObject *__Pyx_PyIter_Next_Plain(PyObject *iterator) { +#if CYTHON_COMPILING_IN_LIMITED_API && __PYX_LIMITED_VERSION_HEX < 0x030A0000 + PyObject *result; + PyObject *next = __Pyx_GetBuiltinNext_LimitedAPI(); + if (unlikely(!next)) return NULL; + result = PyObject_CallFunctionObjArgs(next, iterator, NULL); + return result; +#else + (void)__Pyx_GetBuiltinName; // only for early limited API + iternextfunc iternext = __Pyx_PyObject_GetIterNextFunc(iterator); + assert(iternext); + return iternext(iterator); +#endif +} + +/* ReturnWithStopIteration (used by CoroutineBase) */ +static void __Pyx__ReturnWithStopIteration(PyObject* value, int async); +static CYTHON_INLINE void __Pyx_ReturnWithStopIteration(PyObject* value, int async, int iternext) { + if (value == Py_None) { + if (async || !iternext) + PyErr_SetNone(async ? PyExc_StopAsyncIteration : PyExc_StopIteration); + return; + } + __Pyx__ReturnWithStopIteration(value, async); +} +static void __Pyx__ReturnWithStopIteration(PyObject* value, int async) { +#if CYTHON_COMPILING_IN_CPYTHON + __Pyx_PyThreadState_declare +#endif + PyObject *exc; + PyObject *exc_type = async ? PyExc_StopAsyncIteration : PyExc_StopIteration; +#if CYTHON_COMPILING_IN_CPYTHON + if ((PY_VERSION_HEX >= (0x030C00A6)) || unlikely(PyTuple_Check(value) || PyExceptionInstance_Check(value))) { + if (PY_VERSION_HEX >= (0x030e00A1)) { + exc = __Pyx_PyObject_CallOneArg(exc_type, value); + } else { + PyObject *args_tuple = PyTuple_New(1); + if (unlikely(!args_tuple)) return; + Py_INCREF(value); + PyTuple_SET_ITEM(args_tuple, 0, value); + exc = PyObject_Call(exc_type, args_tuple, NULL); + Py_DECREF(args_tuple); + } + if (unlikely(!exc)) return; + } else { + Py_INCREF(value); + exc = value; + } + #if CYTHON_FAST_THREAD_STATE + __Pyx_PyThreadState_assign + #if CYTHON_USE_EXC_INFO_STACK + if (!__pyx_tstate->exc_info->exc_value) + #else + if (!__pyx_tstate->exc_type) + #endif + { + Py_INCREF(exc_type); + __Pyx_ErrRestore(exc_type, exc, NULL); + return; + } + #endif +#else + exc = __Pyx_PyObject_CallOneArg(exc_type, value); + if (unlikely(!exc)) return; +#endif + PyErr_SetObject(exc_type, exc); + Py_DECREF(exc); +} + +/* CoroutineBase (used by Generator) */ +#if !CYTHON_COMPILING_IN_LIMITED_API +#include +#if PY_VERSION_HEX >= 0x030b00a6 && !defined(PYPY_VERSION) + #ifndef Py_BUILD_CORE + #define Py_BUILD_CORE 1 + #endif + #include "internal/pycore_frame.h" +#endif +#endif // CYTHON_COMPILING_IN_LIMITED_API +static CYTHON_INLINE void +__Pyx_Coroutine_Undelegate(__pyx_CoroutineObject *gen) { +#if CYTHON_USE_AM_SEND + gen->yieldfrom_am_send = NULL; +#endif + Py_CLEAR(gen->yieldfrom); +} +static int __Pyx_PyGen__FetchStopIterationValue(PyThreadState *__pyx_tstate, PyObject **pvalue) { + PyObject *et, *ev, *tb; + PyObject *value = NULL; + CYTHON_UNUSED_VAR(__pyx_tstate); + __Pyx_ErrFetch(&et, &ev, &tb); + if (!et) { + Py_XDECREF(tb); + Py_XDECREF(ev); + Py_INCREF(Py_None); + *pvalue = Py_None; + return 0; + } + if (likely(et == PyExc_StopIteration)) { + if (!ev) { + Py_INCREF(Py_None); + value = Py_None; + } + else if (likely(__Pyx_IS_TYPE(ev, (PyTypeObject*)PyExc_StopIteration))) { + #if CYTHON_COMPILING_IN_LIMITED_API || CYTHON_COMPILING_IN_GRAAL + value = PyObject_GetAttr(ev, __pyx_mstate_global->__pyx_n_u_value); + if (unlikely(!value)) goto limited_api_failure; + #else + value = ((PyStopIterationObject *)ev)->value; + Py_INCREF(value); + #endif + Py_DECREF(ev); + } + else if (unlikely(PyTuple_Check(ev))) { + Py_ssize_t tuple_size = __Pyx_PyTuple_GET_SIZE(ev); + #if !CYTHON_ASSUME_SAFE_SIZE + if (unlikely(tuple_size < 0)) { + Py_XDECREF(tb); + Py_DECREF(ev); + Py_DECREF(et); + return -1; + } + #endif + if (tuple_size >= 1) { +#if CYTHON_ASSUME_SAFE_MACROS && !CYTHON_AVOID_BORROWED_REFS + value = PyTuple_GET_ITEM(ev, 0); + Py_INCREF(value); +#elif CYTHON_ASSUME_SAFE_MACROS + value = PySequence_ITEM(ev, 0); +#else + value = PySequence_GetItem(ev, 0); + if (!value) goto limited_api_failure; +#endif + } else { + Py_INCREF(Py_None); + value = Py_None; + } + Py_DECREF(ev); + } + else if (!__Pyx_TypeCheck(ev, (PyTypeObject*)PyExc_StopIteration)) { + value = ev; + } + if (likely(value)) { + Py_XDECREF(tb); + Py_DECREF(et); + *pvalue = value; + return 0; + } + } else if (!__Pyx_PyErr_GivenExceptionMatches(et, PyExc_StopIteration)) { + __Pyx_ErrRestore(et, ev, tb); + return -1; + } + PyErr_NormalizeException(&et, &ev, &tb); + if (unlikely(!PyObject_TypeCheck(ev, (PyTypeObject*)PyExc_StopIteration))) { + __Pyx_ErrRestore(et, ev, tb); + return -1; + } + Py_XDECREF(tb); + Py_DECREF(et); +#if CYTHON_COMPILING_IN_LIMITED_API + value = PyObject_GetAttr(ev, __pyx_mstate_global->__pyx_n_u_value); +#else + value = ((PyStopIterationObject *)ev)->value; + Py_INCREF(value); +#endif + Py_DECREF(ev); +#if CYTHON_COMPILING_IN_LIMITED_API + if (unlikely(!value)) return -1; +#endif + *pvalue = value; + return 0; +#if CYTHON_COMPILING_IN_LIMITED_API || CYTHON_COMPILING_IN_GRAAL || !CYTHON_ASSUME_SAFE_MACROS + limited_api_failure: + Py_XDECREF(et); + Py_XDECREF(tb); + Py_XDECREF(ev); + return -1; +#endif +} +static CYTHON_INLINE +__Pyx_PySendResult __Pyx_Coroutine_status_from_result(PyObject **retval) { + if (*retval) { + return PYGEN_NEXT; + } else if (likely(__Pyx_PyGen__FetchStopIterationValue(__Pyx_PyThreadState_Current, retval) == 0)) { + return PYGEN_RETURN; + } else { + return PYGEN_ERROR; + } +} +static CYTHON_INLINE +void __Pyx_Coroutine_ExceptionClear(__Pyx_ExcInfoStruct *exc_state) { +#if PY_VERSION_HEX >= 0x030B00a4 + Py_CLEAR(exc_state->exc_value); +#else + PyObject *t, *v, *tb; + t = exc_state->exc_type; + v = exc_state->exc_value; + tb = exc_state->exc_traceback; + exc_state->exc_type = NULL; + exc_state->exc_value = NULL; + exc_state->exc_traceback = NULL; + Py_XDECREF(t); + Py_XDECREF(v); + Py_XDECREF(tb); +#endif +} +#define __Pyx_Coroutine_AlreadyRunningError(gen) (__Pyx__Coroutine_AlreadyRunningError(gen), (PyObject*)NULL) +static void __Pyx__Coroutine_AlreadyRunningError(__pyx_CoroutineObject *gen) { + const char *msg; + CYTHON_MAYBE_UNUSED_VAR(gen); + if ((0)) { + #ifdef __Pyx_Coroutine_USED + } else if (__Pyx_Coroutine_Check((PyObject*)gen)) { + msg = "coroutine already executing"; + #endif + #ifdef __Pyx_AsyncGen_USED + } else if (__Pyx_AsyncGen_CheckExact((PyObject*)gen)) { + msg = "async generator already executing"; + #endif + } else { + msg = "generator already executing"; + } + PyErr_SetString(PyExc_ValueError, msg); +} +static void __Pyx_Coroutine_AlreadyTerminatedError(PyObject *gen, PyObject *value, int closing) { + CYTHON_MAYBE_UNUSED_VAR(gen); + CYTHON_MAYBE_UNUSED_VAR(closing); + #ifdef __Pyx_Coroutine_USED + if (!closing && __Pyx_Coroutine_Check(gen)) { + PyErr_SetString(PyExc_RuntimeError, "cannot reuse already awaited coroutine"); + } else + #endif + if (value) { + #ifdef __Pyx_AsyncGen_USED + if (__Pyx_AsyncGen_CheckExact(gen)) + PyErr_SetNone(PyExc_StopAsyncIteration); + else + #endif + PyErr_SetNone(PyExc_StopIteration); + } +} +static +__Pyx_PySendResult __Pyx_Coroutine_SendEx(__pyx_CoroutineObject *self, PyObject *value, PyObject **result, int closing) { + __Pyx_PyThreadState_declare + PyThreadState *tstate; + __Pyx_ExcInfoStruct *exc_state; + PyObject *retval; + assert(__Pyx_Coroutine_get_is_running(self)); // Callers should ensure is_running + if (unlikely(self->resume_label == -1)) { + __Pyx_Coroutine_AlreadyTerminatedError((PyObject*)self, value, closing); + return PYGEN_ERROR; + } +#if CYTHON_FAST_THREAD_STATE + __Pyx_PyThreadState_assign + tstate = __pyx_tstate; +#else + tstate = __Pyx_PyThreadState_Current; +#endif + exc_state = &self->gi_exc_state; + if (exc_state->exc_value) { + #if CYTHON_COMPILING_IN_LIMITED_API || CYTHON_COMPILING_IN_PYPY + #else + PyObject *exc_tb; + #if PY_VERSION_HEX >= 0x030B00a4 && !CYTHON_COMPILING_IN_CPYTHON + exc_tb = PyException_GetTraceback(exc_state->exc_value); + #elif PY_VERSION_HEX >= 0x030B00a4 + exc_tb = ((PyBaseExceptionObject*) exc_state->exc_value)->traceback; + #else + exc_tb = exc_state->exc_traceback; + #endif + if (exc_tb) { + PyTracebackObject *tb = (PyTracebackObject *) exc_tb; + PyFrameObject *f = tb->tb_frame; + assert(f->f_back == NULL); + #if PY_VERSION_HEX >= 0x030B00A1 + f->f_back = PyThreadState_GetFrame(tstate); + #else + Py_XINCREF(tstate->frame); + f->f_back = tstate->frame; + #endif + #if PY_VERSION_HEX >= 0x030B00a4 && !CYTHON_COMPILING_IN_CPYTHON + Py_DECREF(exc_tb); + #endif + } + #endif + } +#if CYTHON_USE_EXC_INFO_STACK + exc_state->previous_item = tstate->exc_info; + tstate->exc_info = exc_state; +#else + if (exc_state->exc_type) { + __Pyx_ExceptionSwap(&exc_state->exc_type, &exc_state->exc_value, &exc_state->exc_traceback); + } else { + __Pyx_Coroutine_ExceptionClear(exc_state); + __Pyx_ExceptionSave(&exc_state->exc_type, &exc_state->exc_value, &exc_state->exc_traceback); + } +#endif + retval = self->body(self, tstate, value); +#if CYTHON_USE_EXC_INFO_STACK + exc_state = &self->gi_exc_state; + tstate->exc_info = exc_state->previous_item; + exc_state->previous_item = NULL; + __Pyx_Coroutine_ResetFrameBackpointer(exc_state); +#endif + *result = retval; + if (self->resume_label == -1) { + return likely(retval) ? PYGEN_RETURN : PYGEN_ERROR; + } + return PYGEN_NEXT; +} +static CYTHON_INLINE void __Pyx_Coroutine_ResetFrameBackpointer(__Pyx_ExcInfoStruct *exc_state) { +#if CYTHON_COMPILING_IN_PYPY || CYTHON_COMPILING_IN_LIMITED_API + CYTHON_UNUSED_VAR(exc_state); +#else + PyObject *exc_tb; + #if PY_VERSION_HEX >= 0x030B00a4 + if (!exc_state->exc_value) return; + exc_tb = PyException_GetTraceback(exc_state->exc_value); + #else + exc_tb = exc_state->exc_traceback; + #endif + if (likely(exc_tb)) { + PyTracebackObject *tb = (PyTracebackObject *) exc_tb; + PyFrameObject *f = tb->tb_frame; + Py_CLEAR(f->f_back); + #if PY_VERSION_HEX >= 0x030B00a4 + Py_DECREF(exc_tb); + #endif + } +#endif +} +#define __Pyx_Coroutine_MethodReturnFromResult(gen, result, retval, iternext)\ + ((result) == PYGEN_NEXT ? (retval) : __Pyx__Coroutine_MethodReturnFromResult(gen, result, retval, iternext)) +static PyObject * +__Pyx__Coroutine_MethodReturnFromResult(PyObject* gen, __Pyx_PySendResult result, PyObject *retval, int iternext) { + CYTHON_MAYBE_UNUSED_VAR(gen); + if (likely(result == PYGEN_RETURN)) { + int is_async = 0; + #ifdef __Pyx_AsyncGen_USED + is_async = __Pyx_AsyncGen_CheckExact(gen); + #endif + __Pyx_ReturnWithStopIteration(retval, is_async, iternext); + Py_XDECREF(retval); + } + return NULL; +} +#if CYTHON_COMPILING_IN_CPYTHON +static CYTHON_INLINE +PyObject *__Pyx_PyGen_Send(PyGenObject *gen, PyObject *arg) { +#if PY_VERSION_HEX <= 0x030A00A1 + return _PyGen_Send(gen, arg); +#else + PyObject *result; + if (PyIter_Send((PyObject*)gen, arg ? arg : Py_None, &result) == PYGEN_RETURN) { + if (PyAsyncGen_CheckExact(gen)) { + assert(result == Py_None); + PyErr_SetNone(PyExc_StopAsyncIteration); + } + else if (result == Py_None) { + PyErr_SetNone(PyExc_StopIteration); + } + else { +#if PY_VERSION_HEX < 0x030d00A1 + _PyGen_SetStopIterationValue(result); +#else + if (!PyTuple_Check(result) && !PyExceptionInstance_Check(result)) { + PyErr_SetObject(PyExc_StopIteration, result); + } else { + PyObject *exc = __Pyx_PyObject_CallOneArg(PyExc_StopIteration, result); + if (likely(exc != NULL)) { + PyErr_SetObject(PyExc_StopIteration, exc); + Py_DECREF(exc); + } + } +#endif + } + Py_DECREF(result); + result = NULL; + } + return result; +#endif +} +#endif +static CYTHON_INLINE __Pyx_PySendResult +__Pyx_Coroutine_FinishDelegation(__pyx_CoroutineObject *gen, PyObject** retval) { + __Pyx_PySendResult result; + PyObject *val = NULL; + assert(__Pyx_Coroutine_get_is_running(gen)); + __Pyx_Coroutine_Undelegate(gen); + __Pyx_PyGen__FetchStopIterationValue(__Pyx_PyThreadState_Current, &val); + result = __Pyx_Coroutine_SendEx(gen, val, retval, 0); + Py_XDECREF(val); + return result; +} +#if CYTHON_USE_AM_SEND +static __Pyx_PySendResult +__Pyx_Coroutine_SendToDelegate(__pyx_CoroutineObject *gen, __Pyx_pyiter_sendfunc gen_am_send, PyObject *value, PyObject **retval) { + PyObject *ret = NULL; + __Pyx_PySendResult delegate_result, result; + assert(__Pyx_Coroutine_get_is_running(gen)); + delegate_result = gen_am_send(gen->yieldfrom, value, &ret); + if (delegate_result == PYGEN_NEXT) { + assert (ret != NULL); + *retval = ret; + return PYGEN_NEXT; + } + assert (delegate_result != PYGEN_ERROR || ret == NULL); + __Pyx_Coroutine_Undelegate(gen); + result = __Pyx_Coroutine_SendEx(gen, ret, retval, 0); + Py_XDECREF(ret); + return result; +} +#endif +static PyObject *__Pyx_Coroutine_Send(PyObject *self, PyObject *value) { + PyObject *retval = NULL; + __Pyx_PySendResult result = __Pyx_Coroutine_AmSend(self, value, &retval); + return __Pyx_Coroutine_MethodReturnFromResult(self, result, retval, 0); +} +static __Pyx_PySendResult +__Pyx_Coroutine_AmSend(PyObject *self, PyObject *value, PyObject **retval) { + __Pyx_PySendResult result; + __pyx_CoroutineObject *gen = (__pyx_CoroutineObject*) self; + if (unlikely(__Pyx_Coroutine_test_and_set_is_running(gen))) { + *retval = __Pyx_Coroutine_AlreadyRunningError(gen); + return PYGEN_ERROR; + } + #if CYTHON_USE_AM_SEND + if (gen->yieldfrom_am_send) { + result = __Pyx_Coroutine_SendToDelegate(gen, gen->yieldfrom_am_send, value, retval); + } else + #endif + if (gen->yieldfrom) { + PyObject *yf = gen->yieldfrom; + PyObject *ret; + #if !CYTHON_USE_AM_SEND + #ifdef __Pyx_Generator_USED + if (__Pyx_Generator_CheckExact(yf)) { + ret = __Pyx_Coroutine_Send(yf, value); + } else + #endif + #ifdef __Pyx_Coroutine_USED + if (__Pyx_Coroutine_Check(yf)) { + ret = __Pyx_Coroutine_Send(yf, value); + } else + #endif + #ifdef __Pyx_AsyncGen_USED + if (__pyx_PyAsyncGenASend_CheckExact(yf)) { + ret = __Pyx_async_gen_asend_send(yf, value); + } else + #endif + #if CYTHON_COMPILING_IN_CPYTHON + if (PyGen_CheckExact(yf)) { + ret = __Pyx_PyGen_Send((PyGenObject*)yf, value == Py_None ? NULL : value); + } else + if (PyCoro_CheckExact(yf)) { + ret = __Pyx_PyGen_Send((PyGenObject*)yf, value == Py_None ? NULL : value); + } else + #endif + #endif + { + #if !CYTHON_COMPILING_IN_LIMITED_API || __PYX_LIMITED_VERSION_HEX >= 0x03080000 + if (value == Py_None && PyIter_Check(yf)) + ret = __Pyx_PyIter_Next_Plain(yf); + else + #endif + ret = __Pyx_PyObject_CallMethod1(yf, __pyx_mstate_global->__pyx_n_u_send, value); + } + if (likely(ret)) { + __Pyx_Coroutine_unset_is_running(gen); + *retval = ret; + return PYGEN_NEXT; + } + result = __Pyx_Coroutine_FinishDelegation(gen, retval); + } else { + result = __Pyx_Coroutine_SendEx(gen, value, retval, 0); + } + __Pyx_Coroutine_unset_is_running(gen); + return result; +} +static int __Pyx_Coroutine_CloseIter(__pyx_CoroutineObject *gen, PyObject *yf) { + __Pyx_PySendResult result; + PyObject *retval = NULL; + CYTHON_UNUSED_VAR(gen); + assert(__Pyx_Coroutine_get_is_running(gen)); + #ifdef __Pyx_Generator_USED + if (__Pyx_Generator_CheckExact(yf)) { + result = __Pyx_Coroutine_Close(yf, &retval); + } else + #endif + #ifdef __Pyx_Coroutine_USED + if (__Pyx_Coroutine_Check(yf)) { + result = __Pyx_Coroutine_Close(yf, &retval); + } else + if (__Pyx_CoroutineAwait_CheckExact(yf)) { + result = __Pyx_CoroutineAwait_Close((__pyx_CoroutineAwaitObject*)yf); + } else + #endif + #ifdef __Pyx_AsyncGen_USED + if (__pyx_PyAsyncGenASend_CheckExact(yf)) { + retval = __Pyx_async_gen_asend_close(yf, NULL); + result = PYGEN_RETURN; + } else + if (__pyx_PyAsyncGenAThrow_CheckExact(yf)) { + retval = __Pyx_async_gen_athrow_close(yf, NULL); + result = PYGEN_RETURN; + } else + #endif + { + PyObject *meth; + result = PYGEN_RETURN; + meth = __Pyx_PyObject_GetAttrStrNoError(yf, __pyx_mstate_global->__pyx_n_u_close); + if (unlikely(!meth)) { + if (unlikely(PyErr_Occurred())) { + PyErr_WriteUnraisable(yf); + } + } else { + retval = __Pyx_PyObject_CallNoArg(meth); + Py_DECREF(meth); + if (unlikely(!retval)) { + result = PYGEN_ERROR; + } + } + } + Py_XDECREF(retval); + return result == PYGEN_ERROR ? -1 : 0; +} +static PyObject *__Pyx_Generator_Next(PyObject *self) { + __Pyx_PySendResult result; + PyObject *retval = NULL; + __pyx_CoroutineObject *gen = (__pyx_CoroutineObject*) self; + if (unlikely(__Pyx_Coroutine_test_and_set_is_running(gen))) { + return __Pyx_Coroutine_AlreadyRunningError(gen); + } + #if CYTHON_USE_AM_SEND + if (gen->yieldfrom_am_send) { + result = __Pyx_Coroutine_SendToDelegate(gen, gen->yieldfrom_am_send, Py_None, &retval); + } else + #endif + if (gen->yieldfrom) { + PyObject *yf = gen->yieldfrom; + PyObject *ret; + #ifdef __Pyx_Generator_USED + if (__Pyx_Generator_CheckExact(yf)) { + ret = __Pyx_Generator_Next(yf); + } else + #endif + #ifdef __Pyx_Coroutine_USED + if (__Pyx_Coroutine_CheckExact(yf)) { + ret = __Pyx_Coroutine_Send(yf, Py_None); + } else + #endif + #if CYTHON_COMPILING_IN_CPYTHON && (PY_VERSION_HEX < 0x030A00A3 || !CYTHON_USE_AM_SEND) + if (PyGen_CheckExact(yf)) { + ret = __Pyx_PyGen_Send((PyGenObject*)yf, NULL); + } else + #endif + ret = __Pyx_PyIter_Next_Plain(yf); + if (likely(ret)) { + __Pyx_Coroutine_unset_is_running(gen); + return ret; + } + result = __Pyx_Coroutine_FinishDelegation(gen, &retval); + } else { + result = __Pyx_Coroutine_SendEx(gen, Py_None, &retval, 0); + } + __Pyx_Coroutine_unset_is_running(gen); + return __Pyx_Coroutine_MethodReturnFromResult(self, result, retval, 1); +} +static PyObject *__Pyx_Coroutine_Close_Method(PyObject *self, PyObject *arg) { + PyObject *retval = NULL; + __Pyx_PySendResult result; + CYTHON_UNUSED_VAR(arg); + result = __Pyx_Coroutine_Close(self, &retval); + if (unlikely(result == PYGEN_ERROR)) + return NULL; + Py_XDECREF(retval); + Py_RETURN_NONE; +} +static __Pyx_PySendResult +__Pyx_Coroutine_Close(PyObject *self, PyObject **retval) { + __pyx_CoroutineObject *gen = (__pyx_CoroutineObject *) self; + __Pyx_PySendResult result; + PyObject *yf; + int err = 0; + if (unlikely(__Pyx_Coroutine_test_and_set_is_running(gen))) { + *retval = __Pyx_Coroutine_AlreadyRunningError(gen); + return PYGEN_ERROR; + } + yf = gen->yieldfrom; + if (yf) { + Py_INCREF(yf); + err = __Pyx_Coroutine_CloseIter(gen, yf); + __Pyx_Coroutine_Undelegate(gen); + Py_DECREF(yf); + } + if (err == 0) + PyErr_SetNone(PyExc_GeneratorExit); + result = __Pyx_Coroutine_SendEx(gen, NULL, retval, 1); + if (result == PYGEN_ERROR) { + __Pyx_PyThreadState_declare + __Pyx_PyThreadState_assign + __Pyx_Coroutine_unset_is_running(gen); + if (!__Pyx_PyErr_Occurred()) { + return PYGEN_RETURN; + } else if (likely(__Pyx_PyErr_ExceptionMatches2(PyExc_GeneratorExit, PyExc_StopIteration))) { + __Pyx_PyErr_Clear(); + return PYGEN_RETURN; + } + return PYGEN_ERROR; + } else if (likely(result == PYGEN_RETURN && *retval == Py_None)) { + __Pyx_Coroutine_unset_is_running(gen); + return PYGEN_RETURN; + } else { + const char *msg; + Py_DECREF(*retval); + *retval = NULL; + if ((0)) { + #ifdef __Pyx_Coroutine_USED + } else if (__Pyx_Coroutine_Check(self)) { + msg = "coroutine ignored GeneratorExit"; + #endif + #ifdef __Pyx_AsyncGen_USED + } else if (__Pyx_AsyncGen_CheckExact(self)) { + msg = "async generator ignored GeneratorExit"; + #endif + } else { + msg = "generator ignored GeneratorExit"; + } + PyErr_SetString(PyExc_RuntimeError, msg); + __Pyx_Coroutine_unset_is_running(gen); + return PYGEN_ERROR; + } +} +static PyObject *__Pyx__Coroutine_Throw(PyObject *self, PyObject *typ, PyObject *val, PyObject *tb, + PyObject *args, int close_on_genexit) { + __pyx_CoroutineObject *gen = (__pyx_CoroutineObject *) self; + PyObject *yf; + if (unlikely(__Pyx_Coroutine_test_and_set_is_running(gen))) + return __Pyx_Coroutine_AlreadyRunningError(gen); + yf = gen->yieldfrom; + if (yf) { + __Pyx_PySendResult result; + PyObject *ret; + Py_INCREF(yf); + if (__Pyx_PyErr_GivenExceptionMatches(typ, PyExc_GeneratorExit) && close_on_genexit) { + int err = __Pyx_Coroutine_CloseIter(gen, yf); + Py_DECREF(yf); + __Pyx_Coroutine_Undelegate(gen); + if (err < 0) + goto propagate_exception; + goto throw_here; + } + if (0 + #ifdef __Pyx_Generator_USED + || __Pyx_Generator_CheckExact(yf) + #endif + #ifdef __Pyx_Coroutine_USED + || __Pyx_Coroutine_Check(yf) + #endif + ) { + ret = __Pyx__Coroutine_Throw(yf, typ, val, tb, args, close_on_genexit); + #ifdef __Pyx_Coroutine_USED + } else if (__Pyx_CoroutineAwait_CheckExact(yf)) { + ret = __Pyx__Coroutine_Throw(((__pyx_CoroutineAwaitObject*)yf)->coroutine, typ, val, tb, args, close_on_genexit); + #endif + } else { + PyObject *meth = __Pyx_PyObject_GetAttrStrNoError(yf, __pyx_mstate_global->__pyx_n_u_throw); + if (unlikely(!meth)) { + Py_DECREF(yf); + if (unlikely(PyErr_Occurred())) { + __Pyx_Coroutine_unset_is_running(gen); + return NULL; + } + __Pyx_Coroutine_Undelegate(gen); + goto throw_here; + } + if (likely(args)) { + ret = __Pyx_PyObject_Call(meth, args, NULL); + } else { + PyObject *cargs[4] = {NULL, typ, val, tb}; + ret = __Pyx_PyObject_FastCall(meth, cargs+1, 3 | __Pyx_PY_VECTORCALL_ARGUMENTS_OFFSET); + } + Py_DECREF(meth); + } + Py_DECREF(yf); + if (ret) { + __Pyx_Coroutine_unset_is_running(gen); + return ret; + } + result = __Pyx_Coroutine_FinishDelegation(gen, &ret); + __Pyx_Coroutine_unset_is_running(gen); + return __Pyx_Coroutine_MethodReturnFromResult(self, result, ret, 0); + } +throw_here: + __Pyx_Raise(typ, val, tb, NULL); +propagate_exception: + { + PyObject *retval = NULL; + __Pyx_PySendResult result = __Pyx_Coroutine_SendEx(gen, NULL, &retval, 0); + __Pyx_Coroutine_unset_is_running(gen); + return __Pyx_Coroutine_MethodReturnFromResult(self, result, retval, 0); + } +} +static PyObject *__Pyx_Coroutine_Throw(PyObject *self, PyObject *args) { + PyObject *typ; + PyObject *val = NULL; + PyObject *tb = NULL; + if (unlikely(!PyArg_UnpackTuple(args, "throw", 1, 3, &typ, &val, &tb))) + return NULL; + return __Pyx__Coroutine_Throw(self, typ, val, tb, args, 1); +} +static CYTHON_INLINE int __Pyx_Coroutine_traverse_excstate(__Pyx_ExcInfoStruct *exc_state, visitproc visit, void *arg) { +#if PY_VERSION_HEX >= 0x030B00a4 + Py_VISIT(exc_state->exc_value); +#else + Py_VISIT(exc_state->exc_type); + Py_VISIT(exc_state->exc_value); + Py_VISIT(exc_state->exc_traceback); +#endif + return 0; +} +static int __Pyx_Coroutine_traverse(__pyx_CoroutineObject *gen, visitproc visit, void *arg) { + { + int e = __Pyx_call_type_traverse((PyObject*)gen, 1, visit, arg); + if (e) return e; + } + Py_VISIT(gen->closure); + Py_VISIT(gen->classobj); + Py_VISIT(gen->yieldfrom); + return __Pyx_Coroutine_traverse_excstate(&gen->gi_exc_state, visit, arg); +} +static int __Pyx_Coroutine_clear(PyObject *self) { + __pyx_CoroutineObject *gen = (__pyx_CoroutineObject *) self; + Py_CLEAR(gen->closure); + Py_CLEAR(gen->classobj); + __Pyx_Coroutine_Undelegate(gen); + __Pyx_Coroutine_ExceptionClear(&gen->gi_exc_state); +#ifdef __Pyx_AsyncGen_USED + if (__Pyx_AsyncGen_CheckExact(self)) { + Py_CLEAR(((__pyx_PyAsyncGenObject*)gen)->ag_finalizer); + } +#endif + Py_CLEAR(gen->gi_code); + Py_CLEAR(gen->gi_frame); + Py_CLEAR(gen->gi_name); + Py_CLEAR(gen->gi_qualname); + Py_CLEAR(gen->gi_modulename); + return 0; +} +static void __Pyx_Coroutine_dealloc(PyObject *self) { + __pyx_CoroutineObject *gen = (__pyx_CoroutineObject *) self; + PyObject_GC_UnTrack(gen); + #if PY_VERSION_HEX < 0x030C0000 || CYTHON_COMPILING_IN_LIMITED_API + if (gen->gi_weakreflist != NULL) + #endif + PyObject_ClearWeakRefs(self); + if (gen->resume_label >= 0) { + PyObject_GC_Track(self); +#if CYTHON_USE_TP_FINALIZE + if (unlikely(PyObject_CallFinalizerFromDealloc(self))) +#else + { + destructor del = __Pyx_PyObject_GetSlot(gen, tp_del, destructor); + if (del) del(self); + } + if (unlikely(Py_REFCNT(self) > 0)) +#endif + { + return; + } + PyObject_GC_UnTrack(self); + } +#ifdef __Pyx_AsyncGen_USED + if (__Pyx_AsyncGen_CheckExact(self)) { + /* We have to handle this case for asynchronous generators + right here, because this code has to be between UNTRACK + and GC_Del. */ + Py_CLEAR(((__pyx_PyAsyncGenObject*)self)->ag_finalizer); + } +#endif + __Pyx_Coroutine_clear(self); + __Pyx_PyHeapTypeObject_GC_Del(gen); +} +#if CYTHON_USE_TP_FINALIZE +static void __Pyx_Coroutine_del(PyObject *self) { + PyObject *error_type, *error_value, *error_traceback; + __pyx_CoroutineObject *gen = (__pyx_CoroutineObject *) self; + __Pyx_PyThreadState_declare + if (gen->resume_label < 0) { + return; + } + __Pyx_PyThreadState_assign + __Pyx_ErrFetch(&error_type, &error_value, &error_traceback); +#ifdef __Pyx_AsyncGen_USED + if (__Pyx_AsyncGen_CheckExact(self)) { + __pyx_PyAsyncGenObject *agen = (__pyx_PyAsyncGenObject*)self; + PyObject *finalizer = agen->ag_finalizer; + if (finalizer && !agen->ag_closed) { + PyObject *res = __Pyx_PyObject_CallOneArg(finalizer, self); + if (unlikely(!res)) { + PyErr_WriteUnraisable(self); + } else { + Py_DECREF(res); + } + __Pyx_ErrRestore(error_type, error_value, error_traceback); + return; + } + } +#endif + if (unlikely(gen->resume_label == 0 && !error_value)) { +#ifdef __Pyx_Coroutine_USED +#ifdef __Pyx_Generator_USED + if (!__Pyx_Generator_CheckExact(self)) +#endif + { + PyObject_GC_UnTrack(self); + if (unlikely(PyErr_WarnFormat(PyExc_RuntimeWarning, 1, "coroutine '%.50S' was never awaited", gen->gi_qualname) < 0)) + PyErr_WriteUnraisable(self); + PyObject_GC_Track(self); + } +#endif + } else { + PyObject *retval = NULL; + __Pyx_PySendResult result = __Pyx_Coroutine_Close(self, &retval); + if (result == PYGEN_ERROR) { + PyErr_WriteUnraisable(self); + } else { + Py_XDECREF(retval); + } + } + __Pyx_ErrRestore(error_type, error_value, error_traceback); +} +#endif +static PyObject * +__Pyx_Coroutine_get_name(__pyx_CoroutineObject *self, void *context) +{ + PyObject *name = self->gi_name; + CYTHON_UNUSED_VAR(context); + if (unlikely(!name)) name = Py_None; + Py_INCREF(name); + return name; +} +static int +__Pyx_Coroutine_set_name(__pyx_CoroutineObject *self, 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_Py_XDECREF_SET(self->gi_name, value); + return 0; +} +static PyObject * +__Pyx_Coroutine_get_qualname(__pyx_CoroutineObject *self, void *context) +{ + PyObject *name = self->gi_qualname; + CYTHON_UNUSED_VAR(context); + if (unlikely(!name)) name = Py_None; + Py_INCREF(name); + return name; +} +static int +__Pyx_Coroutine_set_qualname(__pyx_CoroutineObject *self, 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_Py_XDECREF_SET(self->gi_qualname, value); + return 0; +} +static PyObject * +__Pyx__Coroutine_get_frame(__pyx_CoroutineObject *self) +{ +#if !CYTHON_COMPILING_IN_LIMITED_API + PyObject *frame; + #if PY_VERSION_HEX >= 0x030d0000 + Py_BEGIN_CRITICAL_SECTION(self); + #endif + frame = self->gi_frame; + if (!frame) { + if (unlikely(!self->gi_code)) { + Py_RETURN_NONE; + } + PyObject *globals = PyDict_New(); + if (unlikely(!globals)) return NULL; + frame = (PyObject *) PyFrame_New( + PyThreadState_Get(), /*PyThreadState *tstate,*/ + (PyCodeObject*) self->gi_code, /*PyCodeObject *code,*/ + globals, /*PyObject *globals,*/ + 0 /*PyObject *locals*/ + ); + Py_DECREF(globals); + if (unlikely(!frame)) + return NULL; + if (unlikely(self->gi_frame)) { + Py_DECREF(frame); + frame = self->gi_frame; + } else { + self->gi_frame = frame; + } + } + Py_INCREF(frame); + #if PY_VERSION_HEX >= 0x030d0000 + Py_END_CRITICAL_SECTION(); + #endif + return frame; +#else + CYTHON_UNUSED_VAR(self); + Py_RETURN_NONE; +#endif +} +static PyObject * +__Pyx_Coroutine_get_frame(__pyx_CoroutineObject *self, void *context) { + CYTHON_UNUSED_VAR(context); + PyObject *frame = self->gi_frame; + if (frame) + return __Pyx_NewRef(frame); + return __Pyx__Coroutine_get_frame(self); +} +static __pyx_CoroutineObject *__Pyx__Coroutine_New( + PyTypeObject* type, __pyx_coroutine_body_t body, PyObject *code, PyObject *closure, + PyObject *name, PyObject *qualname, PyObject *module_name) { + __pyx_CoroutineObject *gen = PyObject_GC_New(__pyx_CoroutineObject, type); + if (unlikely(!gen)) + return NULL; + return __Pyx__Coroutine_NewInit(gen, body, code, closure, name, qualname, module_name); +} +static __pyx_CoroutineObject *__Pyx__Coroutine_NewInit( + __pyx_CoroutineObject *gen, __pyx_coroutine_body_t body, PyObject *code, PyObject *closure, + PyObject *name, PyObject *qualname, PyObject *module_name) { + gen->body = body; + gen->closure = closure; + Py_XINCREF(closure); + gen->is_running = 0; + gen->resume_label = 0; + gen->classobj = NULL; + gen->yieldfrom = NULL; + gen->yieldfrom_am_send = NULL; + #if PY_VERSION_HEX >= 0x030B00a4 && !CYTHON_COMPILING_IN_LIMITED_API + gen->gi_exc_state.exc_value = NULL; + #else + gen->gi_exc_state.exc_type = NULL; + gen->gi_exc_state.exc_value = NULL; + gen->gi_exc_state.exc_traceback = NULL; + #endif +#if CYTHON_USE_EXC_INFO_STACK + gen->gi_exc_state.previous_item = NULL; +#endif +#if PY_VERSION_HEX < 0x030C0000 || CYTHON_COMPILING_IN_LIMITED_API + gen->gi_weakreflist = NULL; +#endif + Py_XINCREF(qualname); + gen->gi_qualname = qualname; + Py_XINCREF(name); + gen->gi_name = name; + Py_XINCREF(module_name); + gen->gi_modulename = module_name; + Py_XINCREF(code); + gen->gi_code = code; + gen->gi_frame = NULL; + PyObject_GC_Track(gen); + return gen; +} +static char __Pyx_Coroutine_test_and_set_is_running(__pyx_CoroutineObject *gen) { + char result; + #if PY_VERSION_HEX >= 0x030d0000 && !CYTHON_COMPILING_IN_LIMITED_API + Py_BEGIN_CRITICAL_SECTION(gen); + #endif + result = gen->is_running; + gen->is_running = 1; + #if PY_VERSION_HEX >= 0x030d0000 && !CYTHON_COMPILING_IN_LIMITED_API + Py_END_CRITICAL_SECTION(); + #endif + return result; +} +static void __Pyx_Coroutine_unset_is_running(__pyx_CoroutineObject *gen) { + #if PY_VERSION_HEX >= 0x030d0000 && !CYTHON_COMPILING_IN_LIMITED_API + Py_BEGIN_CRITICAL_SECTION(gen); + #endif + assert(gen->is_running); + gen->is_running = 0; + #if PY_VERSION_HEX >= 0x030d0000 && !CYTHON_COMPILING_IN_LIMITED_API + Py_END_CRITICAL_SECTION(); + #endif +} +static char __Pyx_Coroutine_get_is_running(__pyx_CoroutineObject *gen) { + char result; + #if PY_VERSION_HEX >= 0x030d0000 && !CYTHON_COMPILING_IN_LIMITED_API + Py_BEGIN_CRITICAL_SECTION(gen); + #endif + result = gen->is_running; + #if PY_VERSION_HEX >= 0x030d0000 && !CYTHON_COMPILING_IN_LIMITED_API + Py_END_CRITICAL_SECTION(); + #endif + return result; +} +static PyObject *__Pyx_Coroutine_get_is_running_getter(PyObject *gen, void *closure) { + CYTHON_UNUSED_VAR(closure); + char result = __Pyx_Coroutine_get_is_running((__pyx_CoroutineObject*)gen); + if (result) Py_RETURN_TRUE; + else Py_RETURN_FALSE; +} +#if __PYX_HAS_PY_AM_SEND == 2 +static void __Pyx_SetBackportTypeAmSend(PyTypeObject *type, __Pyx_PyAsyncMethodsStruct *static_amsend_methods, __Pyx_pyiter_sendfunc am_send) { + Py_ssize_t ptr_offset = (char*)(type->tp_as_async) - (char*)type; + if (ptr_offset < 0 || ptr_offset > type->tp_basicsize) { + return; + } + memcpy((void*)static_amsend_methods, (void*)(type->tp_as_async), sizeof(*type->tp_as_async)); + static_amsend_methods->am_send = am_send; + type->tp_as_async = __Pyx_SlotTpAsAsync(static_amsend_methods); +} +#endif +static PyObject *__Pyx_Coroutine_fail_reduce_ex(PyObject *self, PyObject *arg) { + CYTHON_UNUSED_VAR(arg); + __Pyx_TypeName self_type_name = __Pyx_PyType_GetFullyQualifiedName(Py_TYPE((PyObject*)self)); + PyErr_Format(PyExc_TypeError, "cannot pickle '" __Pyx_FMT_TYPENAME "' object", + self_type_name); + __Pyx_DECREF_TypeName(self_type_name); + return NULL; +} + +/* Generator */ +static PyMethodDef __pyx_Generator_methods[] = { + {"send", (PyCFunction) __Pyx_Coroutine_Send, METH_O, + PyDoc_STR("send(arg) -> send 'arg' into generator,\nreturn next yielded value or raise StopIteration.")}, + {"throw", (PyCFunction) __Pyx_Coroutine_Throw, METH_VARARGS, + PyDoc_STR("throw(typ[,val[,tb]]) -> raise exception in generator,\nreturn next yielded value or raise StopIteration.")}, + {"close", (PyCFunction) __Pyx_Coroutine_Close_Method, METH_NOARGS, + PyDoc_STR("close() -> raise GeneratorExit inside generator.")}, + {"__reduce_ex__", (PyCFunction) __Pyx_Coroutine_fail_reduce_ex, METH_O, 0}, + {"__reduce__", (PyCFunction) __Pyx_Coroutine_fail_reduce_ex, METH_NOARGS, 0}, + {0, 0, 0, 0} +}; +static PyMemberDef __pyx_Generator_memberlist[] = { + {"gi_yieldfrom", T_OBJECT, offsetof(__pyx_CoroutineObject, yieldfrom), READONLY, + PyDoc_STR("object being iterated by 'yield from', or None")}, + {"gi_code", T_OBJECT, offsetof(__pyx_CoroutineObject, gi_code), READONLY, NULL}, + {"__module__", T_OBJECT, offsetof(__pyx_CoroutineObject, gi_modulename), 0, 0}, +#if PY_VERSION_HEX < 0x030C0000 || CYTHON_COMPILING_IN_LIMITED_API + {"__weaklistoffset__", T_PYSSIZET, offsetof(__pyx_CoroutineObject, gi_weakreflist), READONLY, 0}, +#endif + {0, 0, 0, 0, 0} +}; +static PyGetSetDef __pyx_Generator_getsets[] = { + {"__name__", (getter)__Pyx_Coroutine_get_name, (setter)__Pyx_Coroutine_set_name, + PyDoc_STR("name of the generator"), 0}, + {"__qualname__", (getter)__Pyx_Coroutine_get_qualname, (setter)__Pyx_Coroutine_set_qualname, + PyDoc_STR("qualified name of the generator"), 0}, + {"gi_frame", (getter)__Pyx_Coroutine_get_frame, NULL, + PyDoc_STR("Frame of the generator"), 0}, + {"gi_running", __Pyx_Coroutine_get_is_running_getter, NULL, NULL, NULL}, + {0, 0, 0, 0, 0} +}; +static PyType_Slot __pyx_GeneratorType_slots[] = { + {Py_tp_dealloc, (void *)__Pyx_Coroutine_dealloc}, + {Py_tp_traverse, (void *)__Pyx_Coroutine_traverse}, + {Py_tp_iter, (void *)PyObject_SelfIter}, + {Py_tp_iternext, (void *)__Pyx_Generator_Next}, + {Py_tp_methods, (void *)__pyx_Generator_methods}, + {Py_tp_members, (void *)__pyx_Generator_memberlist}, + {Py_tp_getset, (void *)__pyx_Generator_getsets}, + {Py_tp_getattro, (void *) PyObject_GenericGetAttr}, +#if CYTHON_USE_TP_FINALIZE + {Py_tp_finalize, (void *)__Pyx_Coroutine_del}, +#endif +#if __PYX_HAS_PY_AM_SEND == 1 + {Py_am_send, (void *)__Pyx_Coroutine_AmSend}, +#endif + {0, 0}, +}; +static PyType_Spec __pyx_GeneratorType_spec = { + __PYX_TYPE_MODULE_PREFIX "generator", + sizeof(__pyx_CoroutineObject), + 0, +#if PY_VERSION_HEX >= 0x030C0000 && !CYTHON_COMPILING_IN_LIMITED_API + Py_TPFLAGS_MANAGED_WEAKREF | +#endif + Py_TPFLAGS_IMMUTABLETYPE | Py_TPFLAGS_DISALLOW_INSTANTIATION | + Py_TPFLAGS_DEFAULT | Py_TPFLAGS_HAVE_GC | __Pyx_TPFLAGS_HAVE_AM_SEND, + __pyx_GeneratorType_slots +}; +#if __PYX_HAS_PY_AM_SEND == 2 +static __Pyx_PyAsyncMethodsStruct __pyx_Generator_as_async; +#endif +static int __pyx_Generator_init(PyObject *module) { + __pyx_mstatetype *mstate = __Pyx_PyModule_GetState(module); + mstate->__pyx_GeneratorType = __Pyx_FetchCommonTypeFromSpec( + mstate->__pyx_CommonTypesMetaclassType, module, &__pyx_GeneratorType_spec, NULL); + if (unlikely(!mstate->__pyx_GeneratorType)) { + return -1; + } +#if __PYX_HAS_PY_AM_SEND == 2 + __Pyx_SetBackportTypeAmSend(mstate->__pyx_GeneratorType, &__pyx_Generator_as_async, &__Pyx_Coroutine_AmSend); +#endif + return 0; +} +static PyObject *__Pyx_Generator_GetInlinedResult(PyObject *self) { + __pyx_CoroutineObject *gen = (__pyx_CoroutineObject*) self; + PyObject *retval = NULL; + if (unlikely(__Pyx_Coroutine_test_and_set_is_running(gen))) { + return __Pyx_Coroutine_AlreadyRunningError(gen); + } + __Pyx_PySendResult result = __Pyx_Coroutine_SendEx(gen, Py_None, &retval, 0); + __Pyx_Coroutine_unset_is_running(gen); + (void) result; + assert (result == PYGEN_RETURN || result == PYGEN_ERROR); + assert ((result == PYGEN_RETURN && retval != NULL) || (result == PYGEN_ERROR && retval == NULL)); + return retval; +} + +/* 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, *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)) return NULL; + 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 */ diff --git a/TTS/Kokoro/.venv/Lib/site-packages/spacy/pipeline/_parser_internals/nonproj.hh b/TTS/Kokoro/.venv/Lib/site-packages/spacy/pipeline/_parser_internals/nonproj.hh new file mode 100644 index 0000000000000000000000000000000000000000..4e5b22b4a96c673d381c908f5b174b0df3f7c855 --- /dev/null +++ b/TTS/Kokoro/.venv/Lib/site-packages/spacy/pipeline/_parser_internals/nonproj.hh @@ -0,0 +1,11 @@ +#ifndef NONPROJ_HH +#define NONPROJ_HH + +#include +#include + +void raise_domain_error(std::string const &msg) { + throw std::domain_error(msg); +} + +#endif // NONPROJ_HH diff --git a/TTS/Kokoro/.venv/Lib/site-packages/spacy/pipeline/_parser_internals/nonproj.pxd b/TTS/Kokoro/.venv/Lib/site-packages/spacy/pipeline/_parser_internals/nonproj.pxd new file mode 100644 index 0000000000000000000000000000000000000000..cc4645c51777cc1fd90c5e39efff73b59631bcc0 --- /dev/null +++ b/TTS/Kokoro/.venv/Lib/site-packages/spacy/pipeline/_parser_internals/nonproj.pxd @@ -0,0 +1,5 @@ +from libcpp.string cimport string + + +cdef extern from "nonproj.hh": + cdef void raise_domain_error(const string& msg) nogil except + diff --git a/TTS/Kokoro/.venv/Lib/site-packages/spacy/pipeline/_parser_internals/nonproj.pyx b/TTS/Kokoro/.venv/Lib/site-packages/spacy/pipeline/_parser_internals/nonproj.pyx new file mode 100644 index 0000000000000000000000000000000000000000..59baae3350339f5bb330d2cd9ec8a37bd2f4291f --- /dev/null +++ b/TTS/Kokoro/.venv/Lib/site-packages/spacy/pipeline/_parser_internals/nonproj.pyx @@ -0,0 +1,258 @@ +# cython: infer_types=True +"""Implements the projectivize/deprojectivize mechanism in Nivre & Nilsson 2005 +for doing pseudo-projective parsing implementation uses the HEAD decoration +scheme. +""" +from copy import copy + +from cython.operator cimport dereference as deref +from cython.operator cimport preincrement as incr +from libc.limits cimport INT_MAX +from libc.stdlib cimport abs +from libcpp cimport bool +from libcpp.string cimport string, to_string +from libcpp.unordered_set cimport unordered_set +from libcpp.vector cimport vector + +from ...tokens.doc cimport Doc, set_children_from_heads + +from ...errors import Errors + +DELIMITER = '||' + + +def ancestors(tokenid, heads): + # Returns all words going from the word up the path to the root. The path + # to root cannot be longer than the number of words in the sentence. This + # function ends after at most len(heads) steps, because it would otherwise + # loop indefinitely on cycles. + head = tokenid + cnt = 0 + while heads[head] != head and cnt < len(heads): + head = heads[head] + cnt += 1 + yield head + if head is None: + break + + +def contains_cycle(heads): + # in an acyclic tree, the path from each word following the head relation + # upwards always ends at the root node + for tokenid in range(len(heads)): + seen = set([tokenid]) + for ancestor in ancestors(tokenid, heads): + if ancestor in seen: + return seen + seen.add(ancestor) + return None + + +def is_nonproj_arc(tokenid, heads): + cdef vector[int] c_heads = _heads_to_c(heads) + return _is_nonproj_arc(tokenid, c_heads) + + +cdef bool _is_nonproj_arc(int tokenid, const vector[int]& heads) nogil except *: + # definition (e.g. Havelka 2007): an arc h -> d, h < d is non-projective + # if there is a token k, h < k < d such that h is not + # an ancestor of k. Same for h -> d, h > d + head = heads[tokenid] + if head == tokenid: # root arcs cannot be non-projective + return False + elif head < 0: # unattached tokens cannot be non-projective + return False + + cdef int start, end + if head < tokenid: + start, end = (head+1, tokenid) + else: + start, end = (tokenid+1, head) + for k in range(start, end): + if not _has_head_as_ancestor(k, head, heads): + return True + return False + + +cdef bool _has_head_as_ancestor(int tokenid, int head, const vector[int]& heads) nogil except *: + ancestor = tokenid + cdef unordered_set[int] seen_tokens + seen_tokens.insert(ancestor) + while True: + # Reached the head or a disconnected node + if heads[ancestor] == head or heads[ancestor] < 0: + return True + # Reached the root + if heads[ancestor] == ancestor: + return False + ancestor = heads[ancestor] + result = seen_tokens.insert(ancestor) + # Found cycle + if not result.second: + raise_domain_error(heads_to_string(heads)) + + return False + + +cdef string heads_to_string(const vector[int]& heads) noexcept nogil: + cdef vector[int].const_iterator citer + cdef string cycle_str + + cycle_str.append("Found cycle in dependency graph: [") + + # FIXME: Rewrite using ostringstream when available in Cython. + citer = heads.const_begin() + while citer != heads.const_end(): + if citer != heads.const_begin(): + cycle_str.append(", ") + cycle_str.append(to_string(deref(citer))) + incr(citer) + cycle_str.append("]") + + return cycle_str + + +def is_nonproj_tree(heads): + cdef vector[int] c_heads = _heads_to_c(heads) + # a tree is non-projective if at least one arc is non-projective + return any(_is_nonproj_arc(word, c_heads) for word in range(len(heads))) + + +def decompose(label): + return label.partition(DELIMITER)[::2] + + +def is_decorated(label): + return DELIMITER in label + + +def count_decorated_labels(gold_data): + freqs = {} + for example in gold_data: + proj_heads, deco_deps = projectivize(example.get_aligned("HEAD"), + example.get_aligned("DEP")) + # set the label to ROOT for each root dependent + deco_deps = [ + 'ROOT' if head == i else deco_deps[i] + for i, head in enumerate(proj_heads) + ] + # count label frequencies + for label in deco_deps: + if is_decorated(label): + freqs[label] = freqs.get(label, 0) + 1 + return freqs + + +def projectivize(heads, labels): + # Use the algorithm by Nivre & Nilsson 2005. Assumes heads to be a proper + # tree, i.e. connected and cycle-free. Returns a new pair (heads, labels) + # which encode a projective and decorated tree. + proj_heads = copy(heads) + + cdef int new_head + cdef vector[int] c_proj_heads = _heads_to_c(proj_heads) + cdef int smallest_np_arc = _get_smallest_nonproj_arc(c_proj_heads) + if smallest_np_arc == -1: # this sentence is already projective + return proj_heads, copy(labels) + while smallest_np_arc != -1: + new_head = _lift(smallest_np_arc, proj_heads) + c_proj_heads[smallest_np_arc] = new_head + smallest_np_arc = _get_smallest_nonproj_arc(c_proj_heads) + deco_labels = _decorate(heads, proj_heads, labels) + return proj_heads, deco_labels + + +cdef vector[int] _heads_to_c(heads): + cdef vector[int] c_heads + for head in heads: + if head is None: + c_heads.push_back(-1) + else: + assert head < len(heads) + c_heads.push_back(head) + return c_heads + + +cpdef deprojectivize(Doc doc): + # Reattach arcs with decorated labels (following HEAD scheme). For each + # decorated arc X||Y, search top-down, left-to-right, breadth-first until + # hitting a Y then make this the new head. + for i in range(doc.length): + label = doc.vocab.strings[doc.c[i].dep] + if DELIMITER in label: + new_label, head_label = label.split(DELIMITER) + new_head = _find_new_head(doc[i], head_label) + doc.c[i].head = new_head.i - i + doc.c[i].dep = doc.vocab.strings.add(new_label, allow_transient=False) + set_children_from_heads(doc.c, 0, doc.length) + return doc + + +def _decorate(heads, proj_heads, labels): + # uses decoration scheme HEAD from Nivre & Nilsson 2005 + if (len(heads) != len(proj_heads)) or (len(proj_heads) != len(labels)): + raise ValueError(Errors.E082.format(n_heads=len(heads), + n_proj_heads=len(proj_heads), + n_labels=len(labels))) + deco_labels = [] + for tokenid, head in enumerate(heads): + if head != proj_heads[tokenid]: + deco_labels.append(f"{labels[tokenid]}{DELIMITER}{labels[head]}") + else: + deco_labels.append(labels[tokenid]) + return deco_labels + + +def get_smallest_nonproj_arc_slow(heads): + cdef vector[int] c_heads = _heads_to_c(heads) + return _get_smallest_nonproj_arc(c_heads) + + +cdef int _get_smallest_nonproj_arc(const vector[int]& heads) nogil except -2: + # return the smallest non-proj arc or None + # where size is defined as the distance between dep and head + # and ties are broken left to right + cdef int smallest_size = INT_MAX + # -1 means its already projective. + cdef int smallest_np_arc = -1 + cdef int size + cdef int tokenid + cdef int head + + for tokenid in range(heads.size()): + head = heads[tokenid] + size = abs(tokenid-head) + if size < smallest_size and _is_nonproj_arc(tokenid, heads): + smallest_size = size + smallest_np_arc = tokenid + return smallest_np_arc + + +cpdef int _lift(tokenid, heads): + # reattaches a word to it's grandfather + head = heads[tokenid] + ghead = heads[head] + cdef int new_head = ghead if head != ghead else tokenid + # attach to ghead if head isn't attached to root else attach to root + heads[tokenid] = new_head + return new_head + + +def _find_new_head(token, headlabel): + # search through the tree starting from the head of the given token + # returns the id of the first descendant with the given label + # if there is none, return the current head (no change) + queue = [token.head] + while queue: + next_queue = [] + for qtoken in queue: + for child in qtoken.children: + if child.is_space: + continue + if child == token: + continue + if child.dep_ == headlabel: + return child + next_queue.append(child) + queue = next_queue + return token.head diff --git a/TTS/Kokoro/.venv/Lib/site-packages/spacy/pipeline/_parser_internals/stateclass.cpp b/TTS/Kokoro/.venv/Lib/site-packages/spacy/pipeline/_parser_internals/stateclass.cpp new file mode 100644 index 0000000000000000000000000000000000000000..3c498044d51a5b7b677b901effe85327249b24b5 --- /dev/null +++ b/TTS/Kokoro/.venv/Lib/site-packages/spacy/pipeline/_parser_internals/stateclass.cpp @@ -0,0 +1,44183 @@ +/* Generated by Cython 3.2.1 */ + +/* BEGIN: Cython Metadata +{ + "distutils": { + "depends": [ + "C:\\Users\\runneradmin\\AppData\\Local\\Temp\\build-env-ej_q3m8u\\Lib\\site-packages\\numpy\\_core\\include\\numpy\\arrayobject.h", + "C:\\Users\\runneradmin\\AppData\\Local\\Temp\\build-env-ej_q3m8u\\Lib\\site-packages\\numpy\\_core\\include\\numpy\\arrayscalars.h", + "C:\\Users\\runneradmin\\AppData\\Local\\Temp\\build-env-ej_q3m8u\\Lib\\site-packages\\numpy\\_core\\include\\numpy\\ndarrayobject.h", + "C:\\Users\\runneradmin\\AppData\\Local\\Temp\\build-env-ej_q3m8u\\Lib\\site-packages\\numpy\\_core\\include\\numpy\\ndarraytypes.h", + "C:\\Users\\runneradmin\\AppData\\Local\\Temp\\build-env-ej_q3m8u\\Lib\\site-packages\\numpy\\_core\\include\\numpy\\ufuncobject.h", + "C:\\Users\\runneradmin\\AppData\\Local\\pypa\\cibuildwheel\\Cache\\nuget-cpython\\python.3.12.10\\tools\\Include\\Python.h" + ], + "extra_compile_args": [ + "-std=c++11" + ], + "include_dirs": [ + "C:\\Users\\runneradmin\\AppData\\Local\\Temp\\build-env-ej_q3m8u\\Lib\\site-packages\\numpy\\_core\\include", + "C:\\Users\\runneradmin\\AppData\\Local\\pypa\\cibuildwheel\\Cache\\nuget-cpython\\python.3.12.10\\tools\\Include" + ], + "language": "c++", + "name": "spacy.pipeline._parser_internals.stateclass", + "sources": [ + "spacy/pipeline/_parser_internals/stateclass.pyx" + ] + }, + "module_name": "spacy.pipeline._parser_internals.stateclass" +} +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_1" +#define CYTHON_HEX_VERSION 0x030201F0 +#define CYTHON_FUTURE_DIVISION 0 +/* 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)) + +/* CppInitCode */ +#ifndef __cplusplus + #error "Cython files generated with the C++ option must be compiled with a C++ compiler." +#endif +#ifndef CYTHON_INLINE + #if defined(__clang__) + #define CYTHON_INLINE __inline__ __attribute__ ((__unused__)) + #else + #define CYTHON_INLINE inline + #endif +#endif +template +void __Pyx_call_destructor(T& x) { + x.~T(); +} +template +class __Pyx_FakeReference { + public: + __Pyx_FakeReference() : ptr(NULL) { } + __Pyx_FakeReference(const T& ref) : ptr(const_cast(&ref)) { } + T *operator->() { return ptr; } + T *operator&() { return ptr; } + operator T&() { return *ptr; } + template bool operator ==(const U& other) const { return *ptr == other; } + template bool operator !=(const U& other) const { return *ptr != other; } + template bool operator==(const __Pyx_FakeReference& other) const { return *ptr == *other.ptr; } + template bool operator!=(const __Pyx_FakeReference& other) const { return *ptr != *other.ptr; } + private: + T *ptr; +}; + +/* 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 + #define __PYX_EXTERN_C extern "C++" +#endif + +#define __PYX_HAVE__spacy__pipeline___parser_internals__stateclass +#define __PYX_HAVE_API__spacy__pipeline___parser_internals__stateclass +/* Early includes */ +#include +#include "ios" +#include "new" +#include "stdexcept" +#include "typeinfo" +#include + + #if __cplusplus >= 201103L || (defined(_MSC_VER) && _MSC_VER >= 1600) + // move should be defined for these versions of MSVC, but __cplusplus isn't set usefully + #include + + namespace cython_std { + template typename std::remove_reference::type&& move(T& t) noexcept { return std::move(t); } + template typename std::remove_reference::type&& move(T&& t) noexcept { return std::move(t); } + } + + #endif + +#include +#include +#include +#include +#include + + /* Using NumPy API declarations from "numpy/__init__.cython-30.pxd" */ + +#include "numpy/arrayobject.h" +#include "numpy/ndarrayobject.h" +#include "numpy/ndarraytypes.h" +#include "numpy/arrayscalars.h" +#include "numpy/ufuncobject.h" +#include +#include +#include "pythread.h" +#ifdef _OPENMP +#include +#endif /* _OPENMP */ + +#if defined(PYREX_WITHOUT_ASSERTIONS) && !defined(CYTHON_WITHOUT_ASSERTIONS) +#define CYTHON_WITHOUT_ASSERTIONS +#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; + +/* Header.proto */ +#if !defined(CYTHON_CCOMPLEX) + #if defined(__cplusplus) + #define CYTHON_CCOMPLEX 1 + #elif (defined(_Complex_I) && !defined(_MSC_VER)) || ((defined (__STDC_VERSION__) && __STDC_VERSION__ >= 201112L) && !defined(__STDC_NO_COMPLEX__) && !defined(_MSC_VER)) + #define CYTHON_CCOMPLEX 1 + #else + #define CYTHON_CCOMPLEX 0 + #endif +#endif +#if CYTHON_CCOMPLEX + #ifdef __cplusplus + #include + #else + #include + #endif +#endif +#if CYTHON_CCOMPLEX && !defined(__cplusplus) && defined(__sun__) && defined(__GNUC__) + #undef _Complex_I + #define _Complex_I 1.0fj +#endif + +/* #### Code section: filename_table ### */ + +static const char* const __pyx_f[] = { + "spacy/pipeline/_parser_internals/stateclass.pyx", + "", + "C:/Users/runneradmin/AppData/Local/Temp/build-env-ej_q3m8u/Lib/site-packages/numpy/__init__.cython-30.pxd", + "spacy/lexeme.pxd", + "spacy/pipeline/_parser_internals/_state.pxd", + "spacy/pipeline/_parser_internals/stateclass.pxd", + "cymem/cymem.pxd", + "cpython/type.pxd", + "preshed/maps.pxd", + "spacy/strings.pxd", + "spacy/morphology.pxd", + "spacy/vocab.pxd", + "spacy/tokens/doc.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 + +/* ForceInitThreads.proto */ +#ifndef __PYX_FORCE_INIT_THREADS + #define __PYX_FORCE_INIT_THREADS 0 +#endif + +/* NoFastGil.proto */ +#define __Pyx_PyGILState_Ensure PyGILState_Ensure +#define __Pyx_PyGILState_Release PyGILState_Release +#define __Pyx_FastGIL_Remember() +#define __Pyx_FastGIL_Forget() +#define __Pyx_FastGilFuncInit() + +/* IncludeStructmemberH.proto (used by FixUpExtensionType) */ +#include + +/* BufferFormatStructs.proto */ +struct __Pyx_StructField_; +#define __PYX_BUF_FLAGS_PACKED_STRUCT (1 << 0) +typedef struct { + const char* name; + const struct __Pyx_StructField_* fields; + size_t size; + size_t arraysize[8]; + int ndim; + char typegroup; + char is_unsigned; + int flags; +} __Pyx_TypeInfo; +typedef struct __Pyx_StructField_ { + const __Pyx_TypeInfo* type; + const char* name; + size_t offset; +} __Pyx_StructField; +typedef struct { + const __Pyx_StructField* field; + size_t parent_offset; +} __Pyx_BufFmt_StackElem; +typedef struct { + __Pyx_StructField root; + __Pyx_BufFmt_StackElem* head; + size_t fmt_offset; + size_t new_count, enc_count; + size_t struct_alignment; + int is_complex; + char enc_type; + char new_packmode; + char enc_packmode; + char is_valid_array; +} __Pyx_BufFmt_Context; + +/* MemviewSliceStruct.proto */ +struct __pyx_memoryview_obj; +typedef struct { + struct __pyx_memoryview_obj *memview; + char *data; + Py_ssize_t shape[8]; + Py_ssize_t strides[8]; + Py_ssize_t suboffsets[8]; +} __Pyx_memviewslice; +#define __Pyx_MemoryView_Len(m) (m.shape[0]) +#define __Pyx_MEMVIEW_DIRECT 1 +#define __Pyx_MEMVIEW_PTR 2 +#define __Pyx_MEMVIEW_FULL 4 +#define __Pyx_MEMVIEW_CONTIG 8 +#define __Pyx_MEMVIEW_STRIDED 16 +#define __Pyx_MEMVIEW_FOLLOW 32 +#define __Pyx_IS_C_CONTIG 1 +#define __Pyx_IS_F_CONTIG 2 +#define __Pyx_MEMSLICE_INIT { 0, 0, { 0 }, { 0 }, { 0 } } +#if CYTHON_ATOMICS + #define __pyx_add_acquisition_count(memview)\ + __pyx_atomic_incr_relaxed(__pyx_get_slice_count_pointer(memview)) + #define __pyx_sub_acquisition_count(memview)\ + __pyx_atomic_decr_acq_rel(__pyx_get_slice_count_pointer(memview)) +#else + #define __pyx_add_acquisition_count(memview)\ + __pyx_add_acquisition_count_locked(__pyx_get_slice_count_pointer(memview), memview->lock) + #define __pyx_sub_acquisition_count(memview)\ + __pyx_sub_acquisition_count_locked(__pyx_get_slice_count_pointer(memview), memview->lock) +#endif + +/* #### Code section: numeric_typedefs ### */ + +/* "typedefs.pxd":3 + * from libc.stdint cimport int32_t, uint8_t, uint16_t, uint32_t, uint64_t, uintptr_t + * + * ctypedef float weight_t # <<<<<<<<<<<<<< + * ctypedef uint64_t hash_t + * ctypedef uint64_t class_t +*/ +typedef float __pyx_t_5spacy_8typedefs_weight_t; + +/* "typedefs.pxd":4 + * + * ctypedef float weight_t + * ctypedef uint64_t hash_t # <<<<<<<<<<<<<< + * ctypedef uint64_t class_t + * ctypedef uint64_t attr_t +*/ +typedef uint64_t __pyx_t_5spacy_8typedefs_hash_t; + +/* "typedefs.pxd":5 + * ctypedef float weight_t + * ctypedef uint64_t hash_t + * ctypedef uint64_t class_t # <<<<<<<<<<<<<< + * ctypedef uint64_t attr_t + * ctypedef uint64_t flags_t +*/ +typedef uint64_t __pyx_t_5spacy_8typedefs_class_t; + +/* "typedefs.pxd":6 + * ctypedef uint64_t hash_t + * ctypedef uint64_t class_t + * ctypedef uint64_t attr_t # <<<<<<<<<<<<<< + * ctypedef uint64_t flags_t + * ctypedef uint16_t len_t +*/ +typedef uint64_t __pyx_t_5spacy_8typedefs_attr_t; + +/* "typedefs.pxd":7 + * ctypedef uint64_t class_t + * ctypedef uint64_t attr_t + * ctypedef uint64_t flags_t # <<<<<<<<<<<<<< + * ctypedef uint16_t len_t + * ctypedef uint16_t tag_t +*/ +typedef uint64_t __pyx_t_5spacy_8typedefs_flags_t; + +/* "typedefs.pxd":8 + * ctypedef uint64_t attr_t + * ctypedef uint64_t flags_t + * ctypedef uint16_t len_t # <<<<<<<<<<<<<< + * ctypedef uint16_t tag_t +*/ +typedef uint16_t __pyx_t_5spacy_8typedefs_len_t; + +/* "typedefs.pxd":9 + * ctypedef uint64_t flags_t + * ctypedef uint16_t len_t + * ctypedef uint16_t tag_t # <<<<<<<<<<<<<< +*/ +typedef uint16_t __pyx_t_5spacy_8typedefs_tag_t; + +/* "C:/Users/runneradmin/AppData/Local/Temp/build-env-ej_q3m8u/Lib/site-packages/numpy/__init__.cython-30.pxd":743 + * # in Cython to enable them only on the right systems. + * + * ctypedef npy_int8 int8_t # <<<<<<<<<<<<<< + * ctypedef npy_int16 int16_t + * ctypedef npy_int32 int32_t +*/ +typedef npy_int8 __pyx_t_5numpy_int8_t; + +/* "C:/Users/runneradmin/AppData/Local/Temp/build-env-ej_q3m8u/Lib/site-packages/numpy/__init__.cython-30.pxd":744 + * + * ctypedef npy_int8 int8_t + * ctypedef npy_int16 int16_t # <<<<<<<<<<<<<< + * ctypedef npy_int32 int32_t + * ctypedef npy_int64 int64_t +*/ +typedef npy_int16 __pyx_t_5numpy_int16_t; + +/* "C:/Users/runneradmin/AppData/Local/Temp/build-env-ej_q3m8u/Lib/site-packages/numpy/__init__.cython-30.pxd":745 + * ctypedef npy_int8 int8_t + * ctypedef npy_int16 int16_t + * ctypedef npy_int32 int32_t # <<<<<<<<<<<<<< + * ctypedef npy_int64 int64_t + * +*/ +typedef npy_int32 __pyx_t_5numpy_int32_t; + +/* "C:/Users/runneradmin/AppData/Local/Temp/build-env-ej_q3m8u/Lib/site-packages/numpy/__init__.cython-30.pxd":746 + * ctypedef npy_int16 int16_t + * ctypedef npy_int32 int32_t + * ctypedef npy_int64 int64_t # <<<<<<<<<<<<<< + * + * ctypedef npy_uint8 uint8_t +*/ +typedef npy_int64 __pyx_t_5numpy_int64_t; + +/* "C:/Users/runneradmin/AppData/Local/Temp/build-env-ej_q3m8u/Lib/site-packages/numpy/__init__.cython-30.pxd":748 + * ctypedef npy_int64 int64_t + * + * ctypedef npy_uint8 uint8_t # <<<<<<<<<<<<<< + * ctypedef npy_uint16 uint16_t + * ctypedef npy_uint32 uint32_t +*/ +typedef npy_uint8 __pyx_t_5numpy_uint8_t; + +/* "C:/Users/runneradmin/AppData/Local/Temp/build-env-ej_q3m8u/Lib/site-packages/numpy/__init__.cython-30.pxd":749 + * + * ctypedef npy_uint8 uint8_t + * ctypedef npy_uint16 uint16_t # <<<<<<<<<<<<<< + * ctypedef npy_uint32 uint32_t + * ctypedef npy_uint64 uint64_t +*/ +typedef npy_uint16 __pyx_t_5numpy_uint16_t; + +/* "C:/Users/runneradmin/AppData/Local/Temp/build-env-ej_q3m8u/Lib/site-packages/numpy/__init__.cython-30.pxd":750 + * ctypedef npy_uint8 uint8_t + * ctypedef npy_uint16 uint16_t + * ctypedef npy_uint32 uint32_t # <<<<<<<<<<<<<< + * ctypedef npy_uint64 uint64_t + * +*/ +typedef npy_uint32 __pyx_t_5numpy_uint32_t; + +/* "C:/Users/runneradmin/AppData/Local/Temp/build-env-ej_q3m8u/Lib/site-packages/numpy/__init__.cython-30.pxd":751 + * ctypedef npy_uint16 uint16_t + * ctypedef npy_uint32 uint32_t + * ctypedef npy_uint64 uint64_t # <<<<<<<<<<<<<< + * + * ctypedef npy_float32 float32_t +*/ +typedef npy_uint64 __pyx_t_5numpy_uint64_t; + +/* "C:/Users/runneradmin/AppData/Local/Temp/build-env-ej_q3m8u/Lib/site-packages/numpy/__init__.cython-30.pxd":753 + * ctypedef npy_uint64 uint64_t + * + * ctypedef npy_float32 float32_t # <<<<<<<<<<<<<< + * ctypedef npy_float64 float64_t + * #ctypedef npy_float80 float80_t +*/ +typedef npy_float32 __pyx_t_5numpy_float32_t; + +/* "C:/Users/runneradmin/AppData/Local/Temp/build-env-ej_q3m8u/Lib/site-packages/numpy/__init__.cython-30.pxd":754 + * + * ctypedef npy_float32 float32_t + * ctypedef npy_float64 float64_t # <<<<<<<<<<<<<< + * #ctypedef npy_float80 float80_t + * #ctypedef npy_float128 float128_t +*/ +typedef npy_float64 __pyx_t_5numpy_float64_t; + +/* "C:/Users/runneradmin/AppData/Local/Temp/build-env-ej_q3m8u/Lib/site-packages/numpy/__init__.cython-30.pxd":761 + * ctypedef double complex complex128_t + * + * ctypedef npy_longlong longlong_t # <<<<<<<<<<<<<< + * ctypedef npy_ulonglong ulonglong_t + * +*/ +typedef npy_longlong __pyx_t_5numpy_longlong_t; + +/* "C:/Users/runneradmin/AppData/Local/Temp/build-env-ej_q3m8u/Lib/site-packages/numpy/__init__.cython-30.pxd":762 + * + * ctypedef npy_longlong longlong_t + * ctypedef npy_ulonglong ulonglong_t # <<<<<<<<<<<<<< + * + * ctypedef npy_intp intp_t +*/ +typedef npy_ulonglong __pyx_t_5numpy_ulonglong_t; + +/* "C:/Users/runneradmin/AppData/Local/Temp/build-env-ej_q3m8u/Lib/site-packages/numpy/__init__.cython-30.pxd":764 + * ctypedef npy_ulonglong ulonglong_t + * + * ctypedef npy_intp intp_t # <<<<<<<<<<<<<< + * ctypedef npy_uintp uintp_t + * +*/ +typedef npy_intp __pyx_t_5numpy_intp_t; + +/* "C:/Users/runneradmin/AppData/Local/Temp/build-env-ej_q3m8u/Lib/site-packages/numpy/__init__.cython-30.pxd":765 + * + * ctypedef npy_intp intp_t + * ctypedef npy_uintp uintp_t # <<<<<<<<<<<<<< + * + * ctypedef npy_double float_t +*/ +typedef npy_uintp __pyx_t_5numpy_uintp_t; + +/* "C:/Users/runneradmin/AppData/Local/Temp/build-env-ej_q3m8u/Lib/site-packages/numpy/__init__.cython-30.pxd":767 + * ctypedef npy_uintp uintp_t + * + * ctypedef npy_double float_t # <<<<<<<<<<<<<< + * ctypedef npy_double double_t + * ctypedef npy_longdouble longdouble_t +*/ +typedef npy_double __pyx_t_5numpy_float_t; + +/* "C:/Users/runneradmin/AppData/Local/Temp/build-env-ej_q3m8u/Lib/site-packages/numpy/__init__.cython-30.pxd":768 + * + * ctypedef npy_double float_t + * ctypedef npy_double double_t # <<<<<<<<<<<<<< + * ctypedef npy_longdouble longdouble_t + * +*/ +typedef npy_double __pyx_t_5numpy_double_t; + +/* "C:/Users/runneradmin/AppData/Local/Temp/build-env-ej_q3m8u/Lib/site-packages/numpy/__init__.cython-30.pxd":769 + * ctypedef npy_double float_t + * ctypedef npy_double double_t + * ctypedef npy_longdouble longdouble_t # <<<<<<<<<<<<<< + * + * ctypedef float complex cfloat_t +*/ +typedef npy_longdouble __pyx_t_5numpy_longdouble_t; + +/* "preshed/maps.pxd":5 + * + * + * ctypedef uint64_t key_t # <<<<<<<<<<<<<< + * + * +*/ +typedef uint64_t __pyx_t_7preshed_4maps_key_t; +/* #### Code section: complex_type_declarations ### */ +/* Declarations.proto */ +#if CYTHON_CCOMPLEX && (1) && (!0 || __cplusplus) + #ifdef __cplusplus + typedef ::std::complex< float > __pyx_t_float_complex; + #else + typedef float _Complex __pyx_t_float_complex; + #endif +#else + typedef struct { float real, imag; } __pyx_t_float_complex; +#endif +static CYTHON_INLINE __pyx_t_float_complex __pyx_t_float_complex_from_parts(float, float); + +/* Declarations.proto */ +#if CYTHON_CCOMPLEX && (1) && (!0 || __cplusplus) + #ifdef __cplusplus + typedef ::std::complex< double > __pyx_t_double_complex; + #else + typedef double _Complex __pyx_t_double_complex; + #endif +#else + typedef struct { double real, imag; } __pyx_t_double_complex; +#endif +static CYTHON_INLINE __pyx_t_double_complex __pyx_t_double_complex_from_parts(double, double); + +/* Declarations.proto */ +#if CYTHON_CCOMPLEX && (1) && (!0 || __cplusplus) + #ifdef __cplusplus + typedef ::std::complex< long double > __pyx_t_long_double_complex; + #else + typedef long double _Complex __pyx_t_long_double_complex; + #endif +#else + typedef struct { long double real, imag; } __pyx_t_long_double_complex; +#endif +static CYTHON_INLINE __pyx_t_long_double_complex __pyx_t_long_double_complex_from_parts(long double, long double); + +/* #### Code section: type_declarations ### */ + +/*--- Type declarations ---*/ +struct __pyx_obj_5cymem_5cymem_PyMalloc; +struct __pyx_obj_5cymem_5cymem_PyFree; +struct __pyx_obj_5cymem_5cymem_Pool; +struct __pyx_obj_5cymem_5cymem_Address; +struct __pyx_obj_7preshed_4maps_PreshMap; +struct __pyx_obj_7preshed_4maps_PreshMapArray; +struct __pyx_obj_5spacy_7strings_StringStore; +struct __pyx_obj_5spacy_10morphology_Morphology; +struct __pyx_obj_5spacy_5vocab_Vocab; +struct __pyx_obj_5spacy_6tokens_3doc_Doc; +struct __pyx_obj_5spacy_6lexeme_Lexeme; +struct __pyx_obj_5spacy_8pipeline_17_parser_internals_10stateclass_StateClass; +struct __pyx_array_obj; +struct __pyx_MemviewEnum_obj; +struct __pyx_memoryview_obj; +struct __pyx_memoryviewslice_obj; + +/* "cymem/cymem.pxd":1 + * ctypedef void* (*malloc_t)(size_t n) # <<<<<<<<<<<<<< + * ctypedef void (*free_t)(void *p) + * +*/ +typedef void *(*__pyx_t_5cymem_5cymem_malloc_t)(size_t); + +/* "cymem/cymem.pxd":2 + * ctypedef void* (*malloc_t)(size_t n) + * ctypedef void (*free_t)(void *p) # <<<<<<<<<<<<<< + * + * cdef class PyMalloc: +*/ +typedef void (*__pyx_t_5cymem_5cymem_free_t)(void *); + +/* "symbols.pxd":1 + * cdef enum symbol_t: # <<<<<<<<<<<<<< + * NIL + * IS_ALPHA +*/ +enum __pyx_t_5spacy_7symbols_symbol_t { + __pyx_e_5spacy_7symbols_NIL, + __pyx_e_5spacy_7symbols_IS_ALPHA, + __pyx_e_5spacy_7symbols_IS_ASCII, + __pyx_e_5spacy_7symbols_IS_DIGIT, + __pyx_e_5spacy_7symbols_IS_LOWER, + __pyx_e_5spacy_7symbols_IS_PUNCT, + __pyx_e_5spacy_7symbols_IS_SPACE, + __pyx_e_5spacy_7symbols_IS_TITLE, + __pyx_e_5spacy_7symbols_IS_UPPER, + __pyx_e_5spacy_7symbols_LIKE_URL, + __pyx_e_5spacy_7symbols_LIKE_NUM, + __pyx_e_5spacy_7symbols_LIKE_EMAIL, + __pyx_e_5spacy_7symbols_IS_STOP, + __pyx_e_5spacy_7symbols_IS_OOV_DEPRECATED, + __pyx_e_5spacy_7symbols_IS_BRACKET, + __pyx_e_5spacy_7symbols_IS_QUOTE, + __pyx_e_5spacy_7symbols_IS_LEFT_PUNCT, + __pyx_e_5spacy_7symbols_IS_RIGHT_PUNCT, + __pyx_e_5spacy_7symbols_IS_CURRENCY, + __pyx_e_5spacy_7symbols_FLAG19 = 19, + __pyx_e_5spacy_7symbols_FLAG20, + __pyx_e_5spacy_7symbols_FLAG21, + __pyx_e_5spacy_7symbols_FLAG22, + __pyx_e_5spacy_7symbols_FLAG23, + __pyx_e_5spacy_7symbols_FLAG24, + __pyx_e_5spacy_7symbols_FLAG25, + __pyx_e_5spacy_7symbols_FLAG26, + __pyx_e_5spacy_7symbols_FLAG27, + __pyx_e_5spacy_7symbols_FLAG28, + __pyx_e_5spacy_7symbols_FLAG29, + __pyx_e_5spacy_7symbols_FLAG30, + __pyx_e_5spacy_7symbols_FLAG31, + __pyx_e_5spacy_7symbols_FLAG32, + __pyx_e_5spacy_7symbols_FLAG33, + __pyx_e_5spacy_7symbols_FLAG34, + __pyx_e_5spacy_7symbols_FLAG35, + __pyx_e_5spacy_7symbols_FLAG36, + __pyx_e_5spacy_7symbols_FLAG37, + __pyx_e_5spacy_7symbols_FLAG38, + __pyx_e_5spacy_7symbols_FLAG39, + __pyx_e_5spacy_7symbols_FLAG40, + __pyx_e_5spacy_7symbols_FLAG41, + __pyx_e_5spacy_7symbols_FLAG42, + __pyx_e_5spacy_7symbols_FLAG43, + __pyx_e_5spacy_7symbols_FLAG44, + __pyx_e_5spacy_7symbols_FLAG45, + __pyx_e_5spacy_7symbols_FLAG46, + __pyx_e_5spacy_7symbols_FLAG47, + __pyx_e_5spacy_7symbols_FLAG48, + __pyx_e_5spacy_7symbols_FLAG49, + __pyx_e_5spacy_7symbols_FLAG50, + __pyx_e_5spacy_7symbols_FLAG51, + __pyx_e_5spacy_7symbols_FLAG52, + __pyx_e_5spacy_7symbols_FLAG53, + __pyx_e_5spacy_7symbols_FLAG54, + __pyx_e_5spacy_7symbols_FLAG55, + __pyx_e_5spacy_7symbols_FLAG56, + __pyx_e_5spacy_7symbols_FLAG57, + __pyx_e_5spacy_7symbols_FLAG58, + __pyx_e_5spacy_7symbols_FLAG59, + __pyx_e_5spacy_7symbols_FLAG60, + __pyx_e_5spacy_7symbols_FLAG61, + __pyx_e_5spacy_7symbols_FLAG62, + __pyx_e_5spacy_7symbols_FLAG63, + __pyx_e_5spacy_7symbols_ID, + __pyx_e_5spacy_7symbols_ORTH, + __pyx_e_5spacy_7symbols_LOWER, + __pyx_e_5spacy_7symbols_NORM, + __pyx_e_5spacy_7symbols_SHAPE, + __pyx_e_5spacy_7symbols_PREFIX, + __pyx_e_5spacy_7symbols_SUFFIX, + __pyx_e_5spacy_7symbols_LENGTH, + __pyx_e_5spacy_7symbols_CLUSTER, + __pyx_e_5spacy_7symbols_LEMMA, + __pyx_e_5spacy_7symbols_POS, + __pyx_e_5spacy_7symbols_TAG, + __pyx_e_5spacy_7symbols_DEP, + __pyx_e_5spacy_7symbols_ENT_IOB, + __pyx_e_5spacy_7symbols_ENT_TYPE, + __pyx_e_5spacy_7symbols_HEAD, + __pyx_e_5spacy_7symbols_SENT_START, + __pyx_e_5spacy_7symbols_SPACY, + __pyx_e_5spacy_7symbols_PROB, + __pyx_e_5spacy_7symbols_LANG, + __pyx_e_5spacy_7symbols_ADJ, + __pyx_e_5spacy_7symbols_ADP, + __pyx_e_5spacy_7symbols_ADV, + __pyx_e_5spacy_7symbols_AUX, + __pyx_e_5spacy_7symbols_CONJ, + __pyx_e_5spacy_7symbols_CCONJ, + __pyx_e_5spacy_7symbols_DET, + __pyx_e_5spacy_7symbols_INTJ, + __pyx_e_5spacy_7symbols_NOUN, + __pyx_e_5spacy_7symbols_NUM, + __pyx_e_5spacy_7symbols_PART, + __pyx_e_5spacy_7symbols_PRON, + __pyx_e_5spacy_7symbols_PROPN, + __pyx_e_5spacy_7symbols_PUNCT, + __pyx_e_5spacy_7symbols_SCONJ, + __pyx_e_5spacy_7symbols_SYM, + __pyx_e_5spacy_7symbols_VERB, + __pyx_e_5spacy_7symbols_X, + __pyx_e_5spacy_7symbols_EOL, + __pyx_e_5spacy_7symbols_SPACE, + __pyx_e_5spacy_7symbols_DEPRECATED001, + __pyx_e_5spacy_7symbols_DEPRECATED002, + __pyx_e_5spacy_7symbols_DEPRECATED003, + __pyx_e_5spacy_7symbols_DEPRECATED004, + __pyx_e_5spacy_7symbols_DEPRECATED005, + __pyx_e_5spacy_7symbols_DEPRECATED006, + __pyx_e_5spacy_7symbols_DEPRECATED007, + __pyx_e_5spacy_7symbols_DEPRECATED008, + __pyx_e_5spacy_7symbols_DEPRECATED009, + __pyx_e_5spacy_7symbols_DEPRECATED010, + __pyx_e_5spacy_7symbols_DEPRECATED011, + __pyx_e_5spacy_7symbols_DEPRECATED012, + __pyx_e_5spacy_7symbols_DEPRECATED013, + __pyx_e_5spacy_7symbols_DEPRECATED014, + __pyx_e_5spacy_7symbols_DEPRECATED015, + __pyx_e_5spacy_7symbols_DEPRECATED016, + __pyx_e_5spacy_7symbols_DEPRECATED017, + __pyx_e_5spacy_7symbols_DEPRECATED018, + __pyx_e_5spacy_7symbols_DEPRECATED019, + __pyx_e_5spacy_7symbols_DEPRECATED020, + __pyx_e_5spacy_7symbols_DEPRECATED021, + __pyx_e_5spacy_7symbols_DEPRECATED022, + __pyx_e_5spacy_7symbols_DEPRECATED023, + __pyx_e_5spacy_7symbols_DEPRECATED024, + __pyx_e_5spacy_7symbols_DEPRECATED025, + __pyx_e_5spacy_7symbols_DEPRECATED026, + __pyx_e_5spacy_7symbols_DEPRECATED027, + __pyx_e_5spacy_7symbols_DEPRECATED028, + __pyx_e_5spacy_7symbols_DEPRECATED029, + __pyx_e_5spacy_7symbols_DEPRECATED030, + __pyx_e_5spacy_7symbols_DEPRECATED031, + __pyx_e_5spacy_7symbols_DEPRECATED032, + __pyx_e_5spacy_7symbols_DEPRECATED033, + __pyx_e_5spacy_7symbols_DEPRECATED034, + __pyx_e_5spacy_7symbols_DEPRECATED035, + __pyx_e_5spacy_7symbols_DEPRECATED036, + __pyx_e_5spacy_7symbols_DEPRECATED037, + __pyx_e_5spacy_7symbols_DEPRECATED038, + __pyx_e_5spacy_7symbols_DEPRECATED039, + __pyx_e_5spacy_7symbols_DEPRECATED040, + __pyx_e_5spacy_7symbols_DEPRECATED041, + __pyx_e_5spacy_7symbols_DEPRECATED042, + __pyx_e_5spacy_7symbols_DEPRECATED043, + __pyx_e_5spacy_7symbols_DEPRECATED044, + __pyx_e_5spacy_7symbols_DEPRECATED045, + __pyx_e_5spacy_7symbols_DEPRECATED046, + __pyx_e_5spacy_7symbols_DEPRECATED047, + __pyx_e_5spacy_7symbols_DEPRECATED048, + __pyx_e_5spacy_7symbols_DEPRECATED049, + __pyx_e_5spacy_7symbols_DEPRECATED050, + __pyx_e_5spacy_7symbols_DEPRECATED051, + __pyx_e_5spacy_7symbols_DEPRECATED052, + __pyx_e_5spacy_7symbols_DEPRECATED053, + __pyx_e_5spacy_7symbols_DEPRECATED054, + __pyx_e_5spacy_7symbols_DEPRECATED055, + __pyx_e_5spacy_7symbols_DEPRECATED056, + __pyx_e_5spacy_7symbols_DEPRECATED057, + __pyx_e_5spacy_7symbols_DEPRECATED058, + __pyx_e_5spacy_7symbols_DEPRECATED059, + __pyx_e_5spacy_7symbols_DEPRECATED060, + __pyx_e_5spacy_7symbols_DEPRECATED061, + __pyx_e_5spacy_7symbols_DEPRECATED062, + __pyx_e_5spacy_7symbols_DEPRECATED063, + __pyx_e_5spacy_7symbols_DEPRECATED064, + __pyx_e_5spacy_7symbols_DEPRECATED065, + __pyx_e_5spacy_7symbols_DEPRECATED066, + __pyx_e_5spacy_7symbols_DEPRECATED067, + __pyx_e_5spacy_7symbols_DEPRECATED068, + __pyx_e_5spacy_7symbols_DEPRECATED069, + __pyx_e_5spacy_7symbols_DEPRECATED070, + __pyx_e_5spacy_7symbols_DEPRECATED071, + __pyx_e_5spacy_7symbols_DEPRECATED072, + __pyx_e_5spacy_7symbols_DEPRECATED073, + __pyx_e_5spacy_7symbols_DEPRECATED074, + __pyx_e_5spacy_7symbols_DEPRECATED075, + __pyx_e_5spacy_7symbols_DEPRECATED076, + __pyx_e_5spacy_7symbols_DEPRECATED077, + __pyx_e_5spacy_7symbols_DEPRECATED078, + __pyx_e_5spacy_7symbols_DEPRECATED079, + __pyx_e_5spacy_7symbols_DEPRECATED080, + __pyx_e_5spacy_7symbols_DEPRECATED081, + __pyx_e_5spacy_7symbols_DEPRECATED082, + __pyx_e_5spacy_7symbols_DEPRECATED083, + __pyx_e_5spacy_7symbols_DEPRECATED084, + __pyx_e_5spacy_7symbols_DEPRECATED085, + __pyx_e_5spacy_7symbols_DEPRECATED086, + __pyx_e_5spacy_7symbols_DEPRECATED087, + __pyx_e_5spacy_7symbols_DEPRECATED088, + __pyx_e_5spacy_7symbols_DEPRECATED089, + __pyx_e_5spacy_7symbols_DEPRECATED090, + __pyx_e_5spacy_7symbols_DEPRECATED091, + __pyx_e_5spacy_7symbols_DEPRECATED092, + __pyx_e_5spacy_7symbols_DEPRECATED093, + __pyx_e_5spacy_7symbols_DEPRECATED094, + __pyx_e_5spacy_7symbols_DEPRECATED095, + __pyx_e_5spacy_7symbols_DEPRECATED096, + __pyx_e_5spacy_7symbols_DEPRECATED097, + __pyx_e_5spacy_7symbols_DEPRECATED098, + __pyx_e_5spacy_7symbols_DEPRECATED099, + __pyx_e_5spacy_7symbols_DEPRECATED100, + __pyx_e_5spacy_7symbols_DEPRECATED101, + __pyx_e_5spacy_7symbols_DEPRECATED102, + __pyx_e_5spacy_7symbols_DEPRECATED103, + __pyx_e_5spacy_7symbols_DEPRECATED104, + __pyx_e_5spacy_7symbols_DEPRECATED105, + __pyx_e_5spacy_7symbols_DEPRECATED106, + __pyx_e_5spacy_7symbols_DEPRECATED107, + __pyx_e_5spacy_7symbols_DEPRECATED108, + __pyx_e_5spacy_7symbols_DEPRECATED109, + __pyx_e_5spacy_7symbols_DEPRECATED110, + __pyx_e_5spacy_7symbols_DEPRECATED111, + __pyx_e_5spacy_7symbols_DEPRECATED112, + __pyx_e_5spacy_7symbols_DEPRECATED113, + __pyx_e_5spacy_7symbols_DEPRECATED114, + __pyx_e_5spacy_7symbols_DEPRECATED115, + __pyx_e_5spacy_7symbols_DEPRECATED116, + __pyx_e_5spacy_7symbols_DEPRECATED117, + __pyx_e_5spacy_7symbols_DEPRECATED118, + __pyx_e_5spacy_7symbols_DEPRECATED119, + __pyx_e_5spacy_7symbols_DEPRECATED120, + __pyx_e_5spacy_7symbols_DEPRECATED121, + __pyx_e_5spacy_7symbols_DEPRECATED122, + __pyx_e_5spacy_7symbols_DEPRECATED123, + __pyx_e_5spacy_7symbols_DEPRECATED124, + __pyx_e_5spacy_7symbols_DEPRECATED125, + __pyx_e_5spacy_7symbols_DEPRECATED126, + __pyx_e_5spacy_7symbols_DEPRECATED127, + __pyx_e_5spacy_7symbols_DEPRECATED128, + __pyx_e_5spacy_7symbols_DEPRECATED129, + __pyx_e_5spacy_7symbols_DEPRECATED130, + __pyx_e_5spacy_7symbols_DEPRECATED131, + __pyx_e_5spacy_7symbols_DEPRECATED132, + __pyx_e_5spacy_7symbols_DEPRECATED133, + __pyx_e_5spacy_7symbols_DEPRECATED134, + __pyx_e_5spacy_7symbols_DEPRECATED135, + __pyx_e_5spacy_7symbols_DEPRECATED136, + __pyx_e_5spacy_7symbols_DEPRECATED137, + __pyx_e_5spacy_7symbols_DEPRECATED138, + __pyx_e_5spacy_7symbols_DEPRECATED139, + __pyx_e_5spacy_7symbols_DEPRECATED140, + __pyx_e_5spacy_7symbols_DEPRECATED141, + __pyx_e_5spacy_7symbols_DEPRECATED142, + __pyx_e_5spacy_7symbols_DEPRECATED143, + __pyx_e_5spacy_7symbols_DEPRECATED144, + __pyx_e_5spacy_7symbols_DEPRECATED145, + __pyx_e_5spacy_7symbols_DEPRECATED146, + __pyx_e_5spacy_7symbols_DEPRECATED147, + __pyx_e_5spacy_7symbols_DEPRECATED148, + __pyx_e_5spacy_7symbols_DEPRECATED149, + __pyx_e_5spacy_7symbols_DEPRECATED150, + __pyx_e_5spacy_7symbols_DEPRECATED151, + __pyx_e_5spacy_7symbols_DEPRECATED152, + __pyx_e_5spacy_7symbols_DEPRECATED153, + __pyx_e_5spacy_7symbols_DEPRECATED154, + __pyx_e_5spacy_7symbols_DEPRECATED155, + __pyx_e_5spacy_7symbols_DEPRECATED156, + __pyx_e_5spacy_7symbols_DEPRECATED157, + __pyx_e_5spacy_7symbols_DEPRECATED158, + __pyx_e_5spacy_7symbols_DEPRECATED159, + __pyx_e_5spacy_7symbols_DEPRECATED160, + __pyx_e_5spacy_7symbols_DEPRECATED161, + __pyx_e_5spacy_7symbols_DEPRECATED162, + __pyx_e_5spacy_7symbols_DEPRECATED163, + __pyx_e_5spacy_7symbols_DEPRECATED164, + __pyx_e_5spacy_7symbols_DEPRECATED165, + __pyx_e_5spacy_7symbols_DEPRECATED166, + __pyx_e_5spacy_7symbols_DEPRECATED167, + __pyx_e_5spacy_7symbols_DEPRECATED168, + __pyx_e_5spacy_7symbols_DEPRECATED169, + __pyx_e_5spacy_7symbols_DEPRECATED170, + __pyx_e_5spacy_7symbols_DEPRECATED171, + __pyx_e_5spacy_7symbols_DEPRECATED172, + __pyx_e_5spacy_7symbols_DEPRECATED173, + __pyx_e_5spacy_7symbols_DEPRECATED174, + __pyx_e_5spacy_7symbols_DEPRECATED175, + __pyx_e_5spacy_7symbols_DEPRECATED176, + __pyx_e_5spacy_7symbols_DEPRECATED177, + __pyx_e_5spacy_7symbols_DEPRECATED178, + __pyx_e_5spacy_7symbols_DEPRECATED179, + __pyx_e_5spacy_7symbols_DEPRECATED180, + __pyx_e_5spacy_7symbols_DEPRECATED181, + __pyx_e_5spacy_7symbols_DEPRECATED182, + __pyx_e_5spacy_7symbols_DEPRECATED183, + __pyx_e_5spacy_7symbols_DEPRECATED184, + __pyx_e_5spacy_7symbols_DEPRECATED185, + __pyx_e_5spacy_7symbols_DEPRECATED186, + __pyx_e_5spacy_7symbols_DEPRECATED187, + __pyx_e_5spacy_7symbols_DEPRECATED188, + __pyx_e_5spacy_7symbols_DEPRECATED189, + __pyx_e_5spacy_7symbols_DEPRECATED190, + __pyx_e_5spacy_7symbols_DEPRECATED191, + __pyx_e_5spacy_7symbols_DEPRECATED192, + __pyx_e_5spacy_7symbols_DEPRECATED193, + __pyx_e_5spacy_7symbols_DEPRECATED194, + __pyx_e_5spacy_7symbols_DEPRECATED195, + __pyx_e_5spacy_7symbols_DEPRECATED196, + __pyx_e_5spacy_7symbols_DEPRECATED197, + __pyx_e_5spacy_7symbols_DEPRECATED198, + __pyx_e_5spacy_7symbols_DEPRECATED199, + __pyx_e_5spacy_7symbols_DEPRECATED200, + __pyx_e_5spacy_7symbols_DEPRECATED201, + __pyx_e_5spacy_7symbols_DEPRECATED202, + __pyx_e_5spacy_7symbols_DEPRECATED203, + __pyx_e_5spacy_7symbols_DEPRECATED204, + __pyx_e_5spacy_7symbols_DEPRECATED205, + __pyx_e_5spacy_7symbols_DEPRECATED206, + __pyx_e_5spacy_7symbols_DEPRECATED207, + __pyx_e_5spacy_7symbols_DEPRECATED208, + __pyx_e_5spacy_7symbols_DEPRECATED209, + __pyx_e_5spacy_7symbols_DEPRECATED210, + __pyx_e_5spacy_7symbols_DEPRECATED211, + __pyx_e_5spacy_7symbols_DEPRECATED212, + __pyx_e_5spacy_7symbols_DEPRECATED213, + __pyx_e_5spacy_7symbols_DEPRECATED214, + __pyx_e_5spacy_7symbols_DEPRECATED215, + __pyx_e_5spacy_7symbols_DEPRECATED216, + __pyx_e_5spacy_7symbols_DEPRECATED217, + __pyx_e_5spacy_7symbols_DEPRECATED218, + __pyx_e_5spacy_7symbols_DEPRECATED219, + __pyx_e_5spacy_7symbols_DEPRECATED220, + __pyx_e_5spacy_7symbols_DEPRECATED221, + __pyx_e_5spacy_7symbols_DEPRECATED222, + __pyx_e_5spacy_7symbols_DEPRECATED223, + __pyx_e_5spacy_7symbols_DEPRECATED224, + __pyx_e_5spacy_7symbols_DEPRECATED225, + __pyx_e_5spacy_7symbols_DEPRECATED226, + __pyx_e_5spacy_7symbols_DEPRECATED227, + __pyx_e_5spacy_7symbols_DEPRECATED228, + __pyx_e_5spacy_7symbols_DEPRECATED229, + __pyx_e_5spacy_7symbols_DEPRECATED230, + __pyx_e_5spacy_7symbols_DEPRECATED231, + __pyx_e_5spacy_7symbols_DEPRECATED232, + __pyx_e_5spacy_7symbols_DEPRECATED233, + __pyx_e_5spacy_7symbols_DEPRECATED234, + __pyx_e_5spacy_7symbols_DEPRECATED235, + __pyx_e_5spacy_7symbols_DEPRECATED236, + __pyx_e_5spacy_7symbols_DEPRECATED237, + __pyx_e_5spacy_7symbols_DEPRECATED238, + __pyx_e_5spacy_7symbols_DEPRECATED239, + __pyx_e_5spacy_7symbols_DEPRECATED240, + __pyx_e_5spacy_7symbols_DEPRECATED241, + __pyx_e_5spacy_7symbols_DEPRECATED242, + __pyx_e_5spacy_7symbols_DEPRECATED243, + __pyx_e_5spacy_7symbols_DEPRECATED244, + __pyx_e_5spacy_7symbols_DEPRECATED245, + __pyx_e_5spacy_7symbols_DEPRECATED246, + __pyx_e_5spacy_7symbols_DEPRECATED247, + __pyx_e_5spacy_7symbols_DEPRECATED248, + __pyx_e_5spacy_7symbols_DEPRECATED249, + __pyx_e_5spacy_7symbols_DEPRECATED250, + __pyx_e_5spacy_7symbols_DEPRECATED251, + __pyx_e_5spacy_7symbols_DEPRECATED252, + __pyx_e_5spacy_7symbols_DEPRECATED253, + __pyx_e_5spacy_7symbols_DEPRECATED254, + __pyx_e_5spacy_7symbols_DEPRECATED255, + __pyx_e_5spacy_7symbols_DEPRECATED256, + __pyx_e_5spacy_7symbols_DEPRECATED257, + __pyx_e_5spacy_7symbols_DEPRECATED258, + __pyx_e_5spacy_7symbols_DEPRECATED259, + __pyx_e_5spacy_7symbols_DEPRECATED260, + __pyx_e_5spacy_7symbols_DEPRECATED261, + __pyx_e_5spacy_7symbols_DEPRECATED262, + __pyx_e_5spacy_7symbols_DEPRECATED263, + __pyx_e_5spacy_7symbols_DEPRECATED264, + __pyx_e_5spacy_7symbols_DEPRECATED265, + __pyx_e_5spacy_7symbols_DEPRECATED266, + __pyx_e_5spacy_7symbols_DEPRECATED267, + __pyx_e_5spacy_7symbols_DEPRECATED268, + __pyx_e_5spacy_7symbols_DEPRECATED269, + __pyx_e_5spacy_7symbols_DEPRECATED270, + __pyx_e_5spacy_7symbols_DEPRECATED271, + __pyx_e_5spacy_7symbols_DEPRECATED272, + __pyx_e_5spacy_7symbols_DEPRECATED273, + __pyx_e_5spacy_7symbols_DEPRECATED274, + __pyx_e_5spacy_7symbols_DEPRECATED275, + __pyx_e_5spacy_7symbols_DEPRECATED276, + __pyx_e_5spacy_7symbols_PERSON, + __pyx_e_5spacy_7symbols_NORP, + __pyx_e_5spacy_7symbols_FACILITY, + __pyx_e_5spacy_7symbols_ORG, + __pyx_e_5spacy_7symbols_GPE, + __pyx_e_5spacy_7symbols_LOC, + __pyx_e_5spacy_7symbols_PRODUCT, + __pyx_e_5spacy_7symbols_EVENT, + __pyx_e_5spacy_7symbols_WORK_OF_ART, + __pyx_e_5spacy_7symbols_LANGUAGE, + __pyx_e_5spacy_7symbols_LAW, + __pyx_e_5spacy_7symbols_DATE, + __pyx_e_5spacy_7symbols_TIME, + __pyx_e_5spacy_7symbols_PERCENT, + __pyx_e_5spacy_7symbols_MONEY, + __pyx_e_5spacy_7symbols_QUANTITY, + __pyx_e_5spacy_7symbols_ORDINAL, + __pyx_e_5spacy_7symbols_CARDINAL, + __pyx_e_5spacy_7symbols_acomp, + __pyx_e_5spacy_7symbols_advcl, + __pyx_e_5spacy_7symbols_advmod, + __pyx_e_5spacy_7symbols_agent, + __pyx_e_5spacy_7symbols_amod, + __pyx_e_5spacy_7symbols_appos, + __pyx_e_5spacy_7symbols_attr, + __pyx_e_5spacy_7symbols_aux, + __pyx_e_5spacy_7symbols_auxpass, + __pyx_e_5spacy_7symbols_cc, + __pyx_e_5spacy_7symbols_ccomp, + __pyx_e_5spacy_7symbols_complm, + __pyx_e_5spacy_7symbols_conj, + __pyx_e_5spacy_7symbols_cop, + __pyx_e_5spacy_7symbols_csubj, + __pyx_e_5spacy_7symbols_csubjpass, + __pyx_e_5spacy_7symbols_dep, + __pyx_e_5spacy_7symbols_det, + __pyx_e_5spacy_7symbols_dobj, + __pyx_e_5spacy_7symbols_expl, + __pyx_e_5spacy_7symbols_hmod, + __pyx_e_5spacy_7symbols_hyph, + __pyx_e_5spacy_7symbols_infmod, + __pyx_e_5spacy_7symbols_intj, + __pyx_e_5spacy_7symbols_iobj, + __pyx_e_5spacy_7symbols_mark, + __pyx_e_5spacy_7symbols_meta, + __pyx_e_5spacy_7symbols_neg, + __pyx_e_5spacy_7symbols_nmod, + __pyx_e_5spacy_7symbols_nn, + __pyx_e_5spacy_7symbols_npadvmod, + __pyx_e_5spacy_7symbols_nsubj, + __pyx_e_5spacy_7symbols_nsubjpass, + __pyx_e_5spacy_7symbols_num, + __pyx_e_5spacy_7symbols_number, + __pyx_e_5spacy_7symbols_oprd, + __pyx_e_5spacy_7symbols_obj, + __pyx_e_5spacy_7symbols_obl, + __pyx_e_5spacy_7symbols_parataxis, + __pyx_e_5spacy_7symbols_partmod, + __pyx_e_5spacy_7symbols_pcomp, + __pyx_e_5spacy_7symbols_pobj, + __pyx_e_5spacy_7symbols_poss, + __pyx_e_5spacy_7symbols_possessive, + __pyx_e_5spacy_7symbols_preconj, + __pyx_e_5spacy_7symbols_prep, + __pyx_e_5spacy_7symbols_prt, + __pyx_e_5spacy_7symbols_punct, + __pyx_e_5spacy_7symbols_quantmod, + __pyx_e_5spacy_7symbols_relcl, + __pyx_e_5spacy_7symbols_rcmod, + __pyx_e_5spacy_7symbols_root, + __pyx_e_5spacy_7symbols_xcomp, + __pyx_e_5spacy_7symbols_acl, + __pyx_e_5spacy_7symbols_ENT_KB_ID, + __pyx_e_5spacy_7symbols_MORPH, + __pyx_e_5spacy_7symbols_ENT_ID, + __pyx_e_5spacy_7symbols_IDX, + __pyx_e_5spacy_7symbols__ +}; + +/* "parts_of_speech.pxd":4 + * + * + * cpdef enum univ_pos_t: # <<<<<<<<<<<<<< + * NO_TAG = 0 + * ADJ = symbols.ADJ +*/ +enum __pyx_t_5spacy_15parts_of_speech_univ_pos_t { + + /* "parts_of_speech.pxd":6 + * cpdef enum univ_pos_t: + * NO_TAG = 0 + * ADJ = symbols.ADJ # <<<<<<<<<<<<<< + * ADP + * ADV +*/ + __pyx_e_5spacy_15parts_of_speech_NO_TAG = 0, + __pyx_e_5spacy_15parts_of_speech_ADJ = __pyx_e_5spacy_7symbols_ADJ, + __pyx_e_5spacy_15parts_of_speech_ADP, + __pyx_e_5spacy_15parts_of_speech_ADV, + __pyx_e_5spacy_15parts_of_speech_AUX, + __pyx_e_5spacy_15parts_of_speech_CONJ, + __pyx_e_5spacy_15parts_of_speech_CCONJ, + __pyx_e_5spacy_15parts_of_speech_DET, + __pyx_e_5spacy_15parts_of_speech_INTJ, + __pyx_e_5spacy_15parts_of_speech_NOUN, + __pyx_e_5spacy_15parts_of_speech_NUM, + __pyx_e_5spacy_15parts_of_speech_PART, + __pyx_e_5spacy_15parts_of_speech_PRON, + __pyx_e_5spacy_15parts_of_speech_PROPN, + __pyx_e_5spacy_15parts_of_speech_PUNCT, + __pyx_e_5spacy_15parts_of_speech_SCONJ, + __pyx_e_5spacy_15parts_of_speech_SYM, + __pyx_e_5spacy_15parts_of_speech_VERB, + __pyx_e_5spacy_15parts_of_speech_X, + __pyx_e_5spacy_15parts_of_speech_EOL, + __pyx_e_5spacy_15parts_of_speech_SPACE +}; +struct __pyx_t_5spacy_7structs_LexemeC; +struct __pyx_t_5spacy_7structs_SpanC; +struct __pyx_t_5spacy_7structs_TokenC; +struct __pyx_t_5spacy_7structs_MorphAnalysisC; +struct __pyx_t_5spacy_7structs_KBEntryC; +struct __pyx_t_5spacy_7structs_AliasC; +struct __pyx_t_5spacy_7structs_EdgeC; +struct __pyx_t_5spacy_7structs_GraphC; + +/* "structs.pxd":10 + * + * + * cdef struct LexemeC: # <<<<<<<<<<<<<< + * flags_t flags + * +*/ +struct __pyx_t_5spacy_7structs_LexemeC { + __pyx_t_5spacy_8typedefs_flags_t flags; + __pyx_t_5spacy_8typedefs_attr_t lang; + __pyx_t_5spacy_8typedefs_attr_t id; + __pyx_t_5spacy_8typedefs_attr_t length; + __pyx_t_5spacy_8typedefs_attr_t orth; + __pyx_t_5spacy_8typedefs_attr_t lower; + __pyx_t_5spacy_8typedefs_attr_t norm; + __pyx_t_5spacy_8typedefs_attr_t shape; + __pyx_t_5spacy_8typedefs_attr_t prefix; + __pyx_t_5spacy_8typedefs_attr_t suffix; +}; + +/* "structs.pxd":26 + * + * + * cdef struct SpanC: # <<<<<<<<<<<<<< + * hash_t id + * int start +*/ +struct __pyx_t_5spacy_7structs_SpanC { + __pyx_t_5spacy_8typedefs_hash_t id; + int start; + int end; + int start_char; + int end_char; + __pyx_t_5spacy_8typedefs_attr_t label; + __pyx_t_5spacy_8typedefs_attr_t kb_id; +}; + +/* "structs.pxd":36 + * + * + * cdef struct TokenC: # <<<<<<<<<<<<<< + * const LexemeC* lex + * uint64_t morph +*/ +struct __pyx_t_5spacy_7structs_TokenC { + struct __pyx_t_5spacy_7structs_LexemeC const *lex; + uint64_t morph; + enum __pyx_t_5spacy_15parts_of_speech_univ_pos_t pos; + int spacy; + __pyx_t_5spacy_8typedefs_attr_t tag; + int idx; + __pyx_t_5spacy_8typedefs_attr_t lemma; + __pyx_t_5spacy_8typedefs_attr_t norm; + int head; + __pyx_t_5spacy_8typedefs_attr_t dep; + uint32_t l_kids; + uint32_t r_kids; + uint32_t l_edge; + uint32_t r_edge; + int sent_start; + int ent_iob; + __pyx_t_5spacy_8typedefs_attr_t ent_type; + __pyx_t_5spacy_8typedefs_attr_t ent_kb_id; + __pyx_t_5spacy_8typedefs_hash_t ent_id; +}; + +/* "structs.pxd":60 + * + * + * cdef struct MorphAnalysisC: # <<<<<<<<<<<<<< + * hash_t key + * int length +*/ +struct __pyx_t_5spacy_7structs_MorphAnalysisC { + __pyx_t_5spacy_8typedefs_hash_t key; + int length; + __pyx_t_5spacy_8typedefs_attr_t *fields; + __pyx_t_5spacy_8typedefs_attr_t *features; +}; + +/* "structs.pxd":69 + * + * # Internal struct, for storage and disambiguation of entities. + * cdef struct KBEntryC: # <<<<<<<<<<<<<< + * + * # The hash of this entry's unique ID/name in the kB +*/ +struct __pyx_t_5spacy_7structs_KBEntryC { + __pyx_t_5spacy_8typedefs_hash_t entity_hash; + int32_t vector_index; + int32_t feats_row; + float freq; +}; + +/* "structs.pxd":88 + * # Each alias struct stores a list of Entry pointers with their prior probabilities + * # for this specific mention/alias. + * cdef struct AliasC: # <<<<<<<<<<<<<< + * + * # All entry candidates for this alias +*/ +struct __pyx_t_5spacy_7structs_AliasC { + std::vector entry_indices; + std::vector probs; +}; + +/* "structs.pxd":97 + * + * + * cdef struct EdgeC: # <<<<<<<<<<<<<< + * hash_t label + * int32_t head +*/ +struct __pyx_t_5spacy_7structs_EdgeC { + __pyx_t_5spacy_8typedefs_hash_t label; + int32_t head; + int32_t tail; +}; + +/* "structs.pxd":103 + * + * + * cdef struct GraphC: # <<<<<<<<<<<<<< + * vector[vector[int32_t]] nodes + * vector[EdgeC] edges +*/ +struct __pyx_t_5spacy_7structs_GraphC { + std::vector > nodes; + std::vector edges; + std::vector weights; + std::vector n_heads; + std::vector n_tails; + std::vector first_head; + std::vector first_tail; + std::unordered_set *roots; + std::unordered_map<__pyx_t_5spacy_8typedefs_hash_t,int> *node_map; + std::unordered_map<__pyx_t_5spacy_8typedefs_hash_t,int> *edge_map; +}; + +/* "attrs.pxd":5 + * + * + * cdef enum attr_id_t: # <<<<<<<<<<<<<< + * NULL_ATTR + * IS_ALPHA +*/ +enum __pyx_t_5spacy_5attrs_attr_id_t { + + /* "attrs.pxd":96 + * ENT_KB_ID = symbols.ENT_KB_ID + * MORPH + * ENT_ID = symbols.ENT_ID # <<<<<<<<<<<<<< + * + * IDX +*/ + __pyx_e_5spacy_5attrs_NULL_ATTR, + __pyx_e_5spacy_5attrs_IS_ALPHA, + __pyx_e_5spacy_5attrs_IS_ASCII, + __pyx_e_5spacy_5attrs_IS_DIGIT, + __pyx_e_5spacy_5attrs_IS_LOWER, + __pyx_e_5spacy_5attrs_IS_PUNCT, + __pyx_e_5spacy_5attrs_IS_SPACE, + __pyx_e_5spacy_5attrs_IS_TITLE, + __pyx_e_5spacy_5attrs_IS_UPPER, + __pyx_e_5spacy_5attrs_LIKE_URL, + __pyx_e_5spacy_5attrs_LIKE_NUM, + __pyx_e_5spacy_5attrs_LIKE_EMAIL, + __pyx_e_5spacy_5attrs_IS_STOP, + __pyx_e_5spacy_5attrs_IS_OOV_DEPRECATED, + __pyx_e_5spacy_5attrs_IS_BRACKET, + __pyx_e_5spacy_5attrs_IS_QUOTE, + __pyx_e_5spacy_5attrs_IS_LEFT_PUNCT, + __pyx_e_5spacy_5attrs_IS_RIGHT_PUNCT, + __pyx_e_5spacy_5attrs_IS_CURRENCY, + __pyx_e_5spacy_5attrs_FLAG19 = 19, + __pyx_e_5spacy_5attrs_FLAG20, + __pyx_e_5spacy_5attrs_FLAG21, + __pyx_e_5spacy_5attrs_FLAG22, + __pyx_e_5spacy_5attrs_FLAG23, + __pyx_e_5spacy_5attrs_FLAG24, + __pyx_e_5spacy_5attrs_FLAG25, + __pyx_e_5spacy_5attrs_FLAG26, + __pyx_e_5spacy_5attrs_FLAG27, + __pyx_e_5spacy_5attrs_FLAG28, + __pyx_e_5spacy_5attrs_FLAG29, + __pyx_e_5spacy_5attrs_FLAG30, + __pyx_e_5spacy_5attrs_FLAG31, + __pyx_e_5spacy_5attrs_FLAG32, + __pyx_e_5spacy_5attrs_FLAG33, + __pyx_e_5spacy_5attrs_FLAG34, + __pyx_e_5spacy_5attrs_FLAG35, + __pyx_e_5spacy_5attrs_FLAG36, + __pyx_e_5spacy_5attrs_FLAG37, + __pyx_e_5spacy_5attrs_FLAG38, + __pyx_e_5spacy_5attrs_FLAG39, + __pyx_e_5spacy_5attrs_FLAG40, + __pyx_e_5spacy_5attrs_FLAG41, + __pyx_e_5spacy_5attrs_FLAG42, + __pyx_e_5spacy_5attrs_FLAG43, + __pyx_e_5spacy_5attrs_FLAG44, + __pyx_e_5spacy_5attrs_FLAG45, + __pyx_e_5spacy_5attrs_FLAG46, + __pyx_e_5spacy_5attrs_FLAG47, + __pyx_e_5spacy_5attrs_FLAG48, + __pyx_e_5spacy_5attrs_FLAG49, + __pyx_e_5spacy_5attrs_FLAG50, + __pyx_e_5spacy_5attrs_FLAG51, + __pyx_e_5spacy_5attrs_FLAG52, + __pyx_e_5spacy_5attrs_FLAG53, + __pyx_e_5spacy_5attrs_FLAG54, + __pyx_e_5spacy_5attrs_FLAG55, + __pyx_e_5spacy_5attrs_FLAG56, + __pyx_e_5spacy_5attrs_FLAG57, + __pyx_e_5spacy_5attrs_FLAG58, + __pyx_e_5spacy_5attrs_FLAG59, + __pyx_e_5spacy_5attrs_FLAG60, + __pyx_e_5spacy_5attrs_FLAG61, + __pyx_e_5spacy_5attrs_FLAG62, + __pyx_e_5spacy_5attrs_FLAG63, + __pyx_e_5spacy_5attrs_ID, + __pyx_e_5spacy_5attrs_ORTH, + __pyx_e_5spacy_5attrs_LOWER, + __pyx_e_5spacy_5attrs_NORM, + __pyx_e_5spacy_5attrs_SHAPE, + __pyx_e_5spacy_5attrs_PREFIX, + __pyx_e_5spacy_5attrs_SUFFIX, + __pyx_e_5spacy_5attrs_LENGTH, + __pyx_e_5spacy_5attrs_CLUSTER, + __pyx_e_5spacy_5attrs_LEMMA, + __pyx_e_5spacy_5attrs_POS, + __pyx_e_5spacy_5attrs_TAG, + __pyx_e_5spacy_5attrs_DEP, + __pyx_e_5spacy_5attrs_ENT_IOB, + __pyx_e_5spacy_5attrs_ENT_TYPE, + __pyx_e_5spacy_5attrs_HEAD, + __pyx_e_5spacy_5attrs_SENT_START, + __pyx_e_5spacy_5attrs_SPACY, + __pyx_e_5spacy_5attrs_PROB, + __pyx_e_5spacy_5attrs_LANG, + __pyx_e_5spacy_5attrs_ENT_KB_ID = __pyx_e_5spacy_7symbols_ENT_KB_ID, + __pyx_e_5spacy_5attrs_MORPH, + __pyx_e_5spacy_5attrs_ENT_ID = __pyx_e_5spacy_7symbols_ENT_ID, + __pyx_e_5spacy_5attrs_IDX, + __pyx_e_5spacy_5attrs_SENT_END +}; +struct __pyx_t_7preshed_4maps_Cell; +struct __pyx_t_7preshed_4maps_Result; +struct __pyx_t_7preshed_4maps_MapStruct; + +/* "preshed/maps.pxd":8 + * + * + * cdef struct Cell: # <<<<<<<<<<<<<< + * key_t key + * void* value +*/ +struct __pyx_t_7preshed_4maps_Cell { + __pyx_t_7preshed_4maps_key_t key; + void *value; +}; + +/* "preshed/maps.pxd":13 + * + * + * cdef struct Result: # <<<<<<<<<<<<<< + * int found + * void* value +*/ +struct __pyx_t_7preshed_4maps_Result { + int found; + void *value; +}; + +/* "preshed/maps.pxd":18 + * + * + * cdef struct MapStruct: # <<<<<<<<<<<<<< + * Cell* cells + * void* value_for_empty_key +*/ +struct __pyx_t_7preshed_4maps_MapStruct { + struct __pyx_t_7preshed_4maps_Cell *cells; + void *value_for_empty_key; + void *value_for_del_key; + __pyx_t_7preshed_4maps_key_t length; + __pyx_t_7preshed_4maps_key_t filled; + int is_empty_key_set; + int is_del_key_set; +}; +union __pyx_t_5spacy_7strings_Utf8Str; +typedef union __pyx_t_5spacy_7strings_Utf8Str __pyx_t_5spacy_7strings_Utf8Str; + +/* "strings.pxd":17 + * + * + * ctypedef union Utf8Str: # <<<<<<<<<<<<<< + * unsigned char[8] s + * unsigned char* p +*/ +union __pyx_t_5spacy_7strings_Utf8Str { + unsigned char s[8]; + unsigned char *p; +}; +union __pyx_t_5spacy_5vocab_LexemesOrTokens; +struct __pyx_t_5spacy_5vocab__Cached; + +/* "vocab.pxd":15 + * + * + * cdef union LexemesOrTokens: # <<<<<<<<<<<<<< + * const LexemeC* const* lexemes + * const TokenC* tokens +*/ +union __pyx_t_5spacy_5vocab_LexemesOrTokens { + struct __pyx_t_5spacy_7structs_LexemeC const *const *lexemes; + struct __pyx_t_5spacy_7structs_TokenC const *tokens; +}; + +/* "vocab.pxd":20 + * + * + * cdef struct _Cached: # <<<<<<<<<<<<<< + * LexemesOrTokens data + * bint is_lex +*/ +struct __pyx_t_5spacy_5vocab__Cached { + union __pyx_t_5spacy_5vocab_LexemesOrTokens data; + int is_lex; + int length; +}; + +/* "tokens/doc.pxd":14 + * + * + * ctypedef const LexemeC* const_Lexeme_ptr # <<<<<<<<<<<<<< + * ctypedef const TokenC* const_TokenC_ptr + * +*/ +typedef struct __pyx_t_5spacy_7structs_LexemeC const *__pyx_t_5spacy_6tokens_3doc_const_Lexeme_ptr; + +/* "tokens/doc.pxd":15 + * + * ctypedef const LexemeC* const_Lexeme_ptr + * ctypedef const TokenC* const_TokenC_ptr # <<<<<<<<<<<<<< + * + * ctypedef fused LexemeOrToken: +*/ +typedef struct __pyx_t_5spacy_7structs_TokenC const *__pyx_t_5spacy_6tokens_3doc_const_TokenC_ptr; +struct __pyx_t_5spacy_8pipeline_17_parser_internals_6_state_ArcC; +struct __pyx_t_5spacy_8pipeline_17_parser_internals_6_state_StateC; + +/* "_state.pxd":23 + * return Lexeme.c_check_flag(token.lex, IS_SPACE) + * + * cdef struct ArcC: # <<<<<<<<<<<<<< + * int head + * int child +*/ +struct __pyx_t_5spacy_8pipeline_17_parser_internals_6_state_ArcC { + int head; + int child; + __pyx_t_5spacy_8typedefs_attr_t label; +}; +struct __pyx_t_5spacy_8pipeline_17_parser_internals_6_state_StateC { + + /* "_state.pxd":29 + * + * + * cdef cppclass StateC: # <<<<<<<<<<<<<< + * int* _heads + * const TokenC* _sent +*/ + int *_heads; + struct __pyx_t_5spacy_7structs_TokenC const *_sent; + std::vector _stack; + std::vector _rebuffer; + std::vector _ents; + std::unordered_map > _left_arcs; + std::unordered_map > _right_arcs; + std::vector _unshiftable; + std::set _sent_starts; + struct __pyx_t_5spacy_7structs_TokenC _empty_token; + int length; + int offset; + int _b_i; + void __pyx_f___init__StateC(struct __pyx_t_5spacy_7structs_TokenC const *, int); + void __pyx_f___dealloc__StateC(void); + virtual void set_context_tokens(int *, int); + virtual int S(int) const; + virtual int B(int) const; + virtual struct __pyx_t_5spacy_7structs_TokenC const *B_(int) const; + virtual struct __pyx_t_5spacy_7structs_TokenC const *E_(int) const; + virtual struct __pyx_t_5spacy_7structs_TokenC const *safe_get(int) const; + virtual void map_get_arcs(std::unordered_map > const &, std::vector *) const; + virtual void get_arcs(std::vector *) const; + virtual int H(int) const; + virtual int E(int) const; + virtual int nth_child(std::unordered_map > const &, int, int) const; + virtual int L(int, int) const; + virtual int R(int, int) const; + virtual int empty(void) const; + virtual int eol(void) const; + virtual int is_final(void) const; + virtual int cannot_sent_start(int) const; + virtual int is_sent_start(int) const; + virtual void set_sent_start(int, int); + virtual int has_head(int) const; + virtual int l_edge(int) const; + virtual int r_edge(int) const; + virtual int n_arcs(std::unordered_map > const &, int) const; + virtual int n_L(int) const; + virtual int n_R(int) const; + virtual int stack_is_connected(void) const; + virtual int entity_is_open(void) const; + virtual int stack_depth(void) const; + virtual int buffer_length(void) const; + virtual void push(void); + virtual void pop(void); + virtual void force_final(void); + virtual void unshift(void); + virtual int is_unshiftable(int) const; + virtual void set_reshiftable(int); + virtual void add_arc(int, int, __pyx_t_5spacy_8typedefs_attr_t); + virtual void map_del_arc(std::unordered_map > *, int, int); + virtual void del_arc(int, int); + virtual struct __pyx_t_5spacy_7structs_SpanC get_ent(void) const; + virtual void open_ent(__pyx_t_5spacy_8typedefs_attr_t); + virtual void close_ent(void); + virtual void clone(__pyx_t_5spacy_8pipeline_17_parser_internals_6_state_StateC const *); + __pyx_t_5spacy_8pipeline_17_parser_internals_6_state_StateC(struct __pyx_t_5spacy_7structs_TokenC const *__pyx_v_sent, int __pyx_v_length) { + __pyx_f___init__StateC(__pyx_v_sent, __pyx_v_length); + } + virtual ~__pyx_t_5spacy_8pipeline_17_parser_internals_6_state_StateC() { + __pyx_f___dealloc__StateC(); + } +}; + +/* "cymem/cymem.pxd":4 + * ctypedef void (*free_t)(void *p) + * + * cdef class PyMalloc: # <<<<<<<<<<<<<< + * cdef malloc_t malloc + * cdef void _set(self, malloc_t malloc) +*/ +struct __pyx_obj_5cymem_5cymem_PyMalloc { + PyObject_HEAD + struct __pyx_vtabstruct_5cymem_5cymem_PyMalloc *__pyx_vtab; + __pyx_t_5cymem_5cymem_malloc_t malloc; +}; + + +/* "cymem/cymem.pxd":10 + * cdef PyMalloc WrapMalloc(malloc_t malloc) + * + * cdef class PyFree: # <<<<<<<<<<<<<< + * cdef free_t free + * cdef void _set(self, free_t free) +*/ +struct __pyx_obj_5cymem_5cymem_PyFree { + PyObject_HEAD + struct __pyx_vtabstruct_5cymem_5cymem_PyFree *__pyx_vtab; + __pyx_t_5cymem_5cymem_free_t free; +}; + + +/* "cymem/cymem.pxd":16 + * cdef PyFree WrapFree(free_t free) + * + * cdef class Pool: # <<<<<<<<<<<<<< + * cdef readonly size_t size + * cdef readonly dict addresses +*/ +struct __pyx_obj_5cymem_5cymem_Pool { + PyObject_HEAD + struct __pyx_vtabstruct_5cymem_5cymem_Pool *__pyx_vtab; + size_t size; + PyObject *addresses; + PyObject *refs; + struct __pyx_obj_5cymem_5cymem_PyMalloc *pymalloc; + struct __pyx_obj_5cymem_5cymem_PyFree *pyfree; +}; + + +/* "cymem/cymem.pxd":28 + * + * + * cdef class Address: # <<<<<<<<<<<<<< + * cdef void* ptr + * cdef readonly PyMalloc pymalloc +*/ +struct __pyx_obj_5cymem_5cymem_Address { + PyObject_HEAD + void *ptr; + struct __pyx_obj_5cymem_5cymem_PyMalloc *pymalloc; + struct __pyx_obj_5cymem_5cymem_PyFree *pyfree; +}; + + +/* "preshed/maps.pxd":45 + * + * + * cdef class PreshMap: # <<<<<<<<<<<<<< + * cdef MapStruct* c_map + * cdef Pool mem +*/ +struct __pyx_obj_7preshed_4maps_PreshMap { + PyObject_HEAD + struct __pyx_vtabstruct_7preshed_4maps_PreshMap *__pyx_vtab; + struct __pyx_t_7preshed_4maps_MapStruct *c_map; + struct __pyx_obj_5cymem_5cymem_Pool *mem; +}; + + +/* "preshed/maps.pxd":53 + * + * + * cdef class PreshMapArray: # <<<<<<<<<<<<<< + * cdef Pool mem + * cdef MapStruct* maps +*/ +struct __pyx_obj_7preshed_4maps_PreshMapArray { + PyObject_HEAD + struct __pyx_vtabstruct_7preshed_4maps_PreshMapArray *__pyx_vtab; + struct __pyx_obj_5cymem_5cymem_Pool *mem; + struct __pyx_t_7preshed_4maps_MapStruct *maps; + size_t length; +}; + + +/* "strings.pxd":22 + * + * + * cdef class StringStore: # <<<<<<<<<<<<<< + * cdef Pool mem + * +*/ +struct __pyx_obj_5spacy_7strings_StringStore { + PyObject_HEAD + struct __pyx_vtabstruct_5spacy_7strings_StringStore *__pyx_vtab; + struct __pyx_obj_5cymem_5cymem_Pool *mem; + std::vector<__pyx_t_5spacy_8typedefs_hash_t> keys; + struct __pyx_obj_7preshed_4maps_PreshMap *_map; + std::vector<__pyx_t_5spacy_8typedefs_hash_t> _transient_keys; + struct __pyx_obj_5cymem_5cymem_Pool *_non_temp_mem; +}; + + +/* "morphology.pxd":11 + * + * + * cdef class Morphology: # <<<<<<<<<<<<<< + * cdef readonly Pool mem + * cdef readonly StringStore strings +*/ +struct __pyx_obj_5spacy_10morphology_Morphology { + PyObject_HEAD + struct __pyx_vtabstruct_5spacy_10morphology_Morphology *__pyx_vtab; + struct __pyx_obj_5cymem_5cymem_Pool *mem; + struct __pyx_obj_5spacy_7strings_StringStore *strings; + struct __pyx_obj_7preshed_4maps_PreshMap *tags; +}; + + +/* "vocab.pxd":26 + * + * + * cdef class Vocab: # <<<<<<<<<<<<<< + * cdef Pool mem + * cdef readonly StringStore strings +*/ +struct __pyx_obj_5spacy_5vocab_Vocab { + PyObject_HEAD + struct __pyx_vtabstruct_5spacy_5vocab_Vocab *__pyx_vtab; + struct __pyx_obj_5cymem_5cymem_Pool *mem; + struct __pyx_obj_5spacy_7strings_StringStore *strings; + struct __pyx_obj_5spacy_10morphology_Morphology *morphology; + PyObject *_vectors; + PyObject *_lookups; + PyObject *writing_system; + PyObject *get_noun_chunks; + int length; + PyObject *_unused_object; + PyObject *lex_attr_getters; + PyObject *cfg; + struct __pyx_obj_7preshed_4maps_PreshMap *_by_orth; + struct __pyx_obj_5cymem_5cymem_Pool *_non_temp_mem; + std::vector<__pyx_t_5spacy_8typedefs_attr_t> _transient_orths; +}; + + +/* "tokens/doc.pxd":37 + * + * + * cdef class Doc: # <<<<<<<<<<<<<< + * cdef readonly Pool mem + * cdef readonly Vocab vocab +*/ +struct __pyx_obj_5spacy_6tokens_3doc_Doc { + PyObject_HEAD + struct __pyx_vtabstruct_5spacy_6tokens_3doc_Doc *__pyx_vtab; + struct __pyx_obj_5cymem_5cymem_Pool *mem; + struct __pyx_obj_5spacy_5vocab_Vocab *vocab; + PyObject *_vector; + PyObject *_vector_norm; + PyObject *tensor; + PyObject *cats; + PyObject *user_data; + PyObject *spans; + struct __pyx_t_5spacy_7structs_TokenC *c; + float sentiment; + PyObject *user_hooks; + PyObject *user_token_hooks; + PyObject *user_span_hooks; + int has_unknown_spaces; + PyObject *_context; + int length; + int max_length; + PyObject *noun_chunks_iterator; + PyObject *__weakref__; +}; + + +/* "lexeme.pxd":24 + * cdef attr_t OOV_RANK + * + * cdef class Lexeme: # <<<<<<<<<<<<<< + * cdef LexemeC* c + * cdef readonly Vocab vocab +*/ +struct __pyx_obj_5spacy_6lexeme_Lexeme { + PyObject_HEAD + struct __pyx_vtabstruct_5spacy_6lexeme_Lexeme *__pyx_vtab; + struct __pyx_t_5spacy_7structs_LexemeC *c; + struct __pyx_obj_5spacy_5vocab_Vocab *vocab; + __pyx_t_5spacy_8typedefs_attr_t orth; +}; + + +/* "spacy/pipeline/_parser_internals/stateclass.pxd":9 + * + * + * cdef class StateClass: # <<<<<<<<<<<<<< + * cdef StateC* c + * cdef readonly Doc doc +*/ +struct __pyx_obj_5spacy_8pipeline_17_parser_internals_10stateclass_StateClass { + PyObject_HEAD + struct __pyx_vtabstruct_5spacy_8pipeline_17_parser_internals_10stateclass_StateClass *__pyx_vtab; + __pyx_t_5spacy_8pipeline_17_parser_internals_6_state_StateC *c; + struct __pyx_obj_5spacy_6tokens_3doc_Doc *doc; + int _borrowed; +}; + + +/* "View.MemoryView":110 + * + * + * @cython.collection_type("sequence") # <<<<<<<<<<<<<< + * @cname("__pyx_array") + * cdef class array: +*/ +struct __pyx_array_obj { + PyObject_HEAD + struct __pyx_vtabstruct_array *__pyx_vtab; + char *data; + Py_ssize_t len; + char *format; + int ndim; + Py_ssize_t *_shape; + Py_ssize_t *_strides; + Py_ssize_t itemsize; + PyObject *mode; + PyObject *_format; + void (*callback_free_data)(void *); + int free_data; + int dtype_is_object; +}; + + +/* "View.MemoryView":299 + * + * + * @cname('__pyx_MemviewEnum') # <<<<<<<<<<<<<< + * cdef class Enum(object): + * cdef object name +*/ +struct __pyx_MemviewEnum_obj { + PyObject_HEAD + PyObject *name; +}; + + +/* "View.MemoryView":334 + * + * + * @cname('__pyx_memoryview') # <<<<<<<<<<<<<< + * cdef class memoryview: + * +*/ +struct __pyx_memoryview_obj { + PyObject_HEAD + struct __pyx_vtabstruct_memoryview *__pyx_vtab; + PyObject *obj; + PyObject *_size; + void *_unused; + PyThread_type_lock lock; + __pyx_atomic_int_type acquisition_count; + Py_buffer view; + int flags; + int dtype_is_object; + __Pyx_TypeInfo const *typeinfo; +}; + + +/* "View.MemoryView":951 + * + * + * @cython.collection_type("sequence") # <<<<<<<<<<<<<< + * @cname('__pyx_memoryviewslice') + * cdef class _memoryviewslice(memoryview): +*/ +struct __pyx_memoryviewslice_obj { + struct __pyx_memoryview_obj __pyx_base; + __Pyx_memviewslice from_slice; + PyObject *from_object; + PyObject *(*to_object_func)(char *); + int (*to_dtype_func)(char *, PyObject *); +}; + + + +/* "cymem/cymem.pxd":4 + * ctypedef void (*free_t)(void *p) + * + * cdef class PyMalloc: # <<<<<<<<<<<<<< + * cdef malloc_t malloc + * cdef void _set(self, malloc_t malloc) +*/ + +struct __pyx_vtabstruct_5cymem_5cymem_PyMalloc { + void (*_set)(struct __pyx_obj_5cymem_5cymem_PyMalloc *, __pyx_t_5cymem_5cymem_malloc_t); +}; +static struct __pyx_vtabstruct_5cymem_5cymem_PyMalloc *__pyx_vtabptr_5cymem_5cymem_PyMalloc; + + +/* "cymem/cymem.pxd":10 + * cdef PyMalloc WrapMalloc(malloc_t malloc) + * + * cdef class PyFree: # <<<<<<<<<<<<<< + * cdef free_t free + * cdef void _set(self, free_t free) +*/ + +struct __pyx_vtabstruct_5cymem_5cymem_PyFree { + void (*_set)(struct __pyx_obj_5cymem_5cymem_PyFree *, __pyx_t_5cymem_5cymem_free_t); +}; +static struct __pyx_vtabstruct_5cymem_5cymem_PyFree *__pyx_vtabptr_5cymem_5cymem_PyFree; + + +/* "cymem/cymem.pxd":16 + * cdef PyFree WrapFree(free_t free) + * + * cdef class Pool: # <<<<<<<<<<<<<< + * cdef readonly size_t size + * cdef readonly dict addresses +*/ + +struct __pyx_vtabstruct_5cymem_5cymem_Pool { + void *(*alloc)(struct __pyx_obj_5cymem_5cymem_Pool *, size_t, size_t); + void (*free)(struct __pyx_obj_5cymem_5cymem_Pool *, void *); + void *(*realloc)(struct __pyx_obj_5cymem_5cymem_Pool *, void *, size_t); +}; +static struct __pyx_vtabstruct_5cymem_5cymem_Pool *__pyx_vtabptr_5cymem_5cymem_Pool; + + +/* "preshed/maps.pxd":45 + * + * + * cdef class PreshMap: # <<<<<<<<<<<<<< + * cdef MapStruct* c_map + * cdef Pool mem +*/ + +struct __pyx_vtabstruct_7preshed_4maps_PreshMap { + void *(*get)(struct __pyx_obj_7preshed_4maps_PreshMap *, __pyx_t_7preshed_4maps_key_t); + void (*set)(struct __pyx_obj_7preshed_4maps_PreshMap *, __pyx_t_7preshed_4maps_key_t, void *); +}; +static struct __pyx_vtabstruct_7preshed_4maps_PreshMap *__pyx_vtabptr_7preshed_4maps_PreshMap; + + +/* "preshed/maps.pxd":53 + * + * + * cdef class PreshMapArray: # <<<<<<<<<<<<<< + * cdef Pool mem + * cdef MapStruct* maps +*/ + +struct __pyx_vtabstruct_7preshed_4maps_PreshMapArray { + void *(*get)(struct __pyx_obj_7preshed_4maps_PreshMapArray *, size_t, __pyx_t_7preshed_4maps_key_t); + void (*set)(struct __pyx_obj_7preshed_4maps_PreshMapArray *, size_t, __pyx_t_7preshed_4maps_key_t, void *); +}; +static struct __pyx_vtabstruct_7preshed_4maps_PreshMapArray *__pyx_vtabptr_7preshed_4maps_PreshMapArray; + + +/* "strings.pxd":22 + * + * + * cdef class StringStore: # <<<<<<<<<<<<<< + * cdef Pool mem + * +*/ + +struct __pyx_vtabstruct_5spacy_7strings_StringStore { + __pyx_t_5spacy_7strings_Utf8Str const *(*intern_unicode)(struct __pyx_obj_5spacy_7strings_StringStore *, PyObject *, int); + __pyx_t_5spacy_7strings_Utf8Str const *(*_intern_utf8)(struct __pyx_obj_5spacy_7strings_StringStore *, char *, int, __pyx_t_5spacy_8typedefs_hash_t *, int); +}; +static struct __pyx_vtabstruct_5spacy_7strings_StringStore *__pyx_vtabptr_5spacy_7strings_StringStore; + + +/* "morphology.pxd":11 + * + * + * cdef class Morphology: # <<<<<<<<<<<<<< + * cdef readonly Pool mem + * cdef readonly StringStore strings +*/ + +struct __pyx_vtabstruct_5spacy_10morphology_Morphology { + struct __pyx_t_5spacy_7structs_MorphAnalysisC (*create_morph_tag)(struct __pyx_obj_5spacy_10morphology_Morphology *, PyObject *); + int (*insert)(struct __pyx_obj_5spacy_10morphology_Morphology *, struct __pyx_t_5spacy_7structs_MorphAnalysisC); +}; +static struct __pyx_vtabstruct_5spacy_10morphology_Morphology *__pyx_vtabptr_5spacy_10morphology_Morphology; + + +/* "vocab.pxd":26 + * + * + * cdef class Vocab: # <<<<<<<<<<<<<< + * cdef Pool mem + * cdef readonly StringStore strings +*/ + +struct __pyx_vtabstruct_5spacy_5vocab_Vocab { + struct __pyx_t_5spacy_7structs_LexemeC const *(*get)(struct __pyx_obj_5spacy_5vocab_Vocab *, struct __pyx_obj_5cymem_5cymem_Pool *, PyObject *); + struct __pyx_t_5spacy_7structs_LexemeC const *(*get_by_orth)(struct __pyx_obj_5spacy_5vocab_Vocab *, struct __pyx_obj_5cymem_5cymem_Pool *, __pyx_t_5spacy_8typedefs_attr_t); + struct __pyx_t_5spacy_7structs_TokenC const *(*make_fused_token)(struct __pyx_obj_5spacy_5vocab_Vocab *, PyObject *); + struct __pyx_t_5spacy_7structs_LexemeC const *(*_new_lexeme)(struct __pyx_obj_5spacy_5vocab_Vocab *, struct __pyx_obj_5cymem_5cymem_Pool *, PyObject *); + int (*_add_lex_to_vocab)(struct __pyx_obj_5spacy_5vocab_Vocab *, __pyx_t_5spacy_8typedefs_hash_t, struct __pyx_t_5spacy_7structs_LexemeC const *, int); +}; +static struct __pyx_vtabstruct_5spacy_5vocab_Vocab *__pyx_vtabptr_5spacy_5vocab_Vocab; + + +/* "tokens/doc.pxd":37 + * + * + * cdef class Doc: # <<<<<<<<<<<<<< + * cdef readonly Pool mem + * cdef readonly Vocab vocab +*/ + +struct __pyx_vtabstruct_5spacy_6tokens_3doc_Doc { + PyArrayObject *(*to_array)(struct __pyx_obj_5spacy_6tokens_3doc_Doc *, PyObject *, int __pyx_skip_dispatch); + int (*__pyx_fuse_0push_back)(struct __pyx_obj_5spacy_6tokens_3doc_Doc *, __pyx_t_5spacy_6tokens_3doc_const_Lexeme_ptr, int); + int (*__pyx_fuse_1push_back)(struct __pyx_obj_5spacy_6tokens_3doc_Doc *, __pyx_t_5spacy_6tokens_3doc_const_TokenC_ptr, int); +}; +static struct __pyx_vtabstruct_5spacy_6tokens_3doc_Doc *__pyx_vtabptr_5spacy_6tokens_3doc_Doc; + + +/* "lexeme.pxd":24 + * cdef attr_t OOV_RANK + * + * cdef class Lexeme: # <<<<<<<<<<<<<< + * cdef LexemeC* c + * cdef readonly Vocab vocab +*/ + +struct __pyx_vtabstruct_5spacy_6lexeme_Lexeme { + struct __pyx_obj_5spacy_6lexeme_Lexeme *(*from_ptr)(struct __pyx_t_5spacy_7structs_LexemeC *, struct __pyx_obj_5spacy_5vocab_Vocab *); + void (*set_struct_attr)(struct __pyx_t_5spacy_7structs_LexemeC *, enum __pyx_t_5spacy_5attrs_attr_id_t, __pyx_t_5spacy_8typedefs_attr_t); + __pyx_t_5spacy_8typedefs_attr_t (*get_struct_attr)(struct __pyx_t_5spacy_7structs_LexemeC const *, enum __pyx_t_5spacy_5attrs_attr_id_t); + int (*c_check_flag)(struct __pyx_t_5spacy_7structs_LexemeC const *, enum __pyx_t_5spacy_5attrs_attr_id_t); + int (*c_set_flag)(struct __pyx_t_5spacy_7structs_LexemeC *, enum __pyx_t_5spacy_5attrs_attr_id_t, int); +}; +static struct __pyx_vtabstruct_5spacy_6lexeme_Lexeme *__pyx_vtabptr_5spacy_6lexeme_Lexeme; +static CYTHON_INLINE struct __pyx_obj_5spacy_6lexeme_Lexeme *__pyx_f_5spacy_6lexeme_6Lexeme_from_ptr(struct __pyx_t_5spacy_7structs_LexemeC *, struct __pyx_obj_5spacy_5vocab_Vocab *); +static CYTHON_INLINE void __pyx_f_5spacy_6lexeme_6Lexeme_set_struct_attr(struct __pyx_t_5spacy_7structs_LexemeC *, enum __pyx_t_5spacy_5attrs_attr_id_t, __pyx_t_5spacy_8typedefs_attr_t); +static CYTHON_INLINE __pyx_t_5spacy_8typedefs_attr_t __pyx_f_5spacy_6lexeme_6Lexeme_get_struct_attr(struct __pyx_t_5spacy_7structs_LexemeC const *, enum __pyx_t_5spacy_5attrs_attr_id_t); +static CYTHON_INLINE int __pyx_f_5spacy_6lexeme_6Lexeme_c_check_flag(struct __pyx_t_5spacy_7structs_LexemeC const *, enum __pyx_t_5spacy_5attrs_attr_id_t); +static CYTHON_INLINE int __pyx_f_5spacy_6lexeme_6Lexeme_c_set_flag(struct __pyx_t_5spacy_7structs_LexemeC *, enum __pyx_t_5spacy_5attrs_attr_id_t, int); + + +/* "spacy/pipeline/_parser_internals/stateclass.pyx":9 + * + * + * cdef class StateClass: # <<<<<<<<<<<<<< + * def __init__(self, Doc doc=None, int offset=0): + * self._borrowed = 0 +*/ + +struct __pyx_vtabstruct_5spacy_8pipeline_17_parser_internals_10stateclass_StateClass { + struct __pyx_obj_5spacy_8pipeline_17_parser_internals_10stateclass_StateClass *(*borrow)(__pyx_t_5spacy_8pipeline_17_parser_internals_6_state_StateC *, struct __pyx_obj_5spacy_6tokens_3doc_Doc *); + struct __pyx_obj_5spacy_8pipeline_17_parser_internals_10stateclass_StateClass *(*init_offset)(struct __pyx_t_5spacy_7structs_TokenC const *, int, int); +}; +static struct __pyx_vtabstruct_5spacy_8pipeline_17_parser_internals_10stateclass_StateClass *__pyx_vtabptr_5spacy_8pipeline_17_parser_internals_10stateclass_StateClass; +static CYTHON_INLINE struct __pyx_obj_5spacy_8pipeline_17_parser_internals_10stateclass_StateClass *__pyx_f_5spacy_8pipeline_17_parser_internals_10stateclass_10StateClass_borrow(__pyx_t_5spacy_8pipeline_17_parser_internals_6_state_StateC *, struct __pyx_obj_5spacy_6tokens_3doc_Doc *); +static CYTHON_INLINE struct __pyx_obj_5spacy_8pipeline_17_parser_internals_10stateclass_StateClass *__pyx_f_5spacy_8pipeline_17_parser_internals_10stateclass_10StateClass_init_offset(struct __pyx_t_5spacy_7structs_TokenC const *, int, int); + + +/* "View.MemoryView":110 + * + * + * @cython.collection_type("sequence") # <<<<<<<<<<<<<< + * @cname("__pyx_array") + * cdef class array: +*/ + +struct __pyx_vtabstruct_array { + PyObject *(*get_memview)(struct __pyx_array_obj *); +}; +static struct __pyx_vtabstruct_array *__pyx_vtabptr_array; + + +/* "View.MemoryView":334 + * + * + * @cname('__pyx_memoryview') # <<<<<<<<<<<<<< + * cdef class memoryview: + * +*/ + +struct __pyx_vtabstruct_memoryview { + char *(*get_item_pointer)(struct __pyx_memoryview_obj *, PyObject *); + PyObject *(*is_slice)(struct __pyx_memoryview_obj *, PyObject *); + PyObject *(*setitem_slice_assignment)(struct __pyx_memoryview_obj *, PyObject *, PyObject *); + PyObject *(*setitem_slice_assign_scalar)(struct __pyx_memoryview_obj *, struct __pyx_memoryview_obj *, PyObject *); + PyObject *(*setitem_indexed)(struct __pyx_memoryview_obj *, PyObject *, PyObject *); + PyObject *(*convert_item_to_object)(struct __pyx_memoryview_obj *, char *); + PyObject *(*assign_item_from_object)(struct __pyx_memoryview_obj *, char *, PyObject *); + PyObject *(*_get_base)(struct __pyx_memoryview_obj *); +}; +static struct __pyx_vtabstruct_memoryview *__pyx_vtabptr_memoryview; + + +/* "View.MemoryView":951 + * + * + * @cython.collection_type("sequence") # <<<<<<<<<<<<<< + * @cname('__pyx_memoryviewslice') + * cdef class _memoryviewslice(memoryview): +*/ + +struct __pyx_vtabstruct__memoryviewslice { + struct __pyx_vtabstruct_memoryview __pyx_base; +}; +static struct __pyx_vtabstruct__memoryviewslice *__pyx_vtabptr__memoryviewslice; +/* #### 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)) + +/* 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 GetBuiltinName) */ +static CYTHON_INLINE PyObject* __Pyx_PyObject_GetAttrStrNoError(PyObject* obj, PyObject* attr_name); + +/* GetBuiltinName.proto */ +static PyObject *__Pyx_GetBuiltinName(PyObject *name); + +/* PyValueError_Check.proto */ +#define __Pyx_PyExc_ValueError_Check(obj) __Pyx_TypeCheck(obj, PyExc_ValueError) + +/* RaiseException.export */ +static void __Pyx_Raise(PyObject *type, PyObject *value, PyObject *tb, PyObject *cause); + +/* 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 + +/* RaiseUnexpectedTypeError.proto */ +static int __Pyx_RaiseUnexpectedTypeError(const char *expected, PyObject *obj); + +/* PyMemoryError_Check.proto */ +#define __Pyx_PyExc_MemoryError_Check(obj) __Pyx_TypeCheck(obj, PyExc_MemoryError) + +/* 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); + +/* CIntToPyUnicode.proto */ +#define __Pyx_PyUnicode_From_Py_ssize_t(value, width, padding_char, format_char) (\ + ((format_char) == ('c')) ?\ + __Pyx_uchar___Pyx_PyUnicode_From_Py_ssize_t(value, width, padding_char) :\ + __Pyx____Pyx_PyUnicode_From_Py_ssize_t(value, width, padding_char, format_char)\ + ) +static CYTHON_INLINE PyObject* __Pyx_uchar___Pyx_PyUnicode_From_Py_ssize_t(Py_ssize_t value, Py_ssize_t width, char padding_char); +static CYTHON_INLINE PyObject* __Pyx____Pyx_PyUnicode_From_Py_ssize_t(Py_ssize_t 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); + +/* 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 + +CYTHON_UNUSED static int __pyx_array_getbuffer(PyObject *__pyx_v_self, Py_buffer *__pyx_v_info, int __pyx_v_flags); /*proto*/ +static PyObject *__pyx_array_get_memview(struct __pyx_array_obj *); /*proto*/ +/* GetAttr.proto */ +static CYTHON_INLINE PyObject *__Pyx_GetAttr(PyObject *, PyObject *); + +/* GetItemInt.proto */ +#define __Pyx_GetItemInt(o, i, type, is_signed, to_py_func, is_list, wraparound, boundscheck, has_gil, unsafe_shared)\ + (__Pyx_fits_Py_ssize_t(i, type, is_signed) ?\ + __Pyx_GetItemInt_Fast(o, (Py_ssize_t)i, is_list, wraparound, boundscheck, unsafe_shared) :\ + (is_list ? (PyErr_SetString(PyExc_IndexError, "list index out of range"), (PyObject*)NULL) :\ + __Pyx_GetItemInt_Generic(o, to_py_func(i)))) +#define __Pyx_GetItemInt_List(o, i, type, is_signed, to_py_func, is_list, wraparound, boundscheck, has_gil, unsafe_shared)\ + (__Pyx_fits_Py_ssize_t(i, type, is_signed) ?\ + __Pyx_GetItemInt_List_Fast(o, (Py_ssize_t)i, wraparound, boundscheck, unsafe_shared) :\ + (PyErr_SetString(PyExc_IndexError, "list index out of range"), (PyObject*)NULL)) +static CYTHON_INLINE PyObject *__Pyx_GetItemInt_List_Fast(PyObject *o, Py_ssize_t i, + int wraparound, int boundscheck, int unsafe_shared); +#define __Pyx_GetItemInt_Tuple(o, i, type, is_signed, to_py_func, is_list, wraparound, boundscheck, has_gil, unsafe_shared)\ + (__Pyx_fits_Py_ssize_t(i, type, is_signed) ?\ + __Pyx_GetItemInt_Tuple_Fast(o, (Py_ssize_t)i, wraparound, boundscheck, unsafe_shared) :\ + (PyErr_SetString(PyExc_IndexError, "tuple index out of range"), (PyObject*)NULL)) +static CYTHON_INLINE PyObject *__Pyx_GetItemInt_Tuple_Fast(PyObject *o, Py_ssize_t i, + int wraparound, int boundscheck, int unsafe_shared); +static PyObject *__Pyx_GetItemInt_Generic(PyObject *o, PyObject* j); +static CYTHON_INLINE PyObject *__Pyx_GetItemInt_Fast(PyObject *o, Py_ssize_t i, + int is_list, int wraparound, int boundscheck, int unsafe_shared); + +/* ObjectGetItem.proto */ +#if CYTHON_USE_TYPE_SLOTS +static CYTHON_INLINE PyObject *__Pyx_PyObject_GetItem(PyObject *obj, PyObject *key); +#else +#define __Pyx_PyObject_GetItem(obj, key) PyObject_GetItem(obj, key) +#endif + +/* RejectKeywords.export */ +static void __Pyx_RejectKeywords(const char* function_name, PyObject *kwds); + +/* PyTypeError_Check.proto */ +#define __Pyx_PyExc_TypeError_Check(obj) __Pyx_TypeCheck(obj, PyExc_TypeError) + +/* DivInt[Py_ssize_t].proto */ +static CYTHON_INLINE Py_ssize_t __Pyx_div_Py_ssize_t(Py_ssize_t, Py_ssize_t, int b_is_constant); + +/* UnaryNegOverflows.proto */ +#define __Pyx_UNARY_NEG_WOULD_OVERFLOW(x)\ + (((x) < 0) & ((unsigned long)(x) == 0-(unsigned long)(x))) + +/* GetAttr3.proto */ +static CYTHON_INLINE PyObject *__Pyx_GetAttr3(PyObject *, PyObject *, PyObject *); + +/* 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 + +/* AssertionsEnabled.proto */ +#if CYTHON_COMPILING_IN_LIMITED_API || PY_VERSION_HEX >= 0x030C0000 + static int __pyx_assertions_enabled_flag; + #define __pyx_assertions_enabled() (__pyx_assertions_enabled_flag) + static int __Pyx_init_assertions_enabled(void) { + PyObject *builtins, *debug, *debug_str; + int flag; + builtins = PyEval_GetBuiltins(); + if (!builtins) goto bad; + debug_str = PyUnicode_FromStringAndSize("__debug__", 9); + if (!debug_str) goto bad; + debug = PyObject_GetItem(builtins, debug_str); + Py_DECREF(debug_str); + if (!debug) goto bad; + flag = PyObject_IsTrue(debug); + Py_DECREF(debug); + if (flag == -1) goto bad; + __pyx_assertions_enabled_flag = flag; + return 0; + bad: + __pyx_assertions_enabled_flag = 1; + return -1; + } +#else + #define __Pyx_init_assertions_enabled() (0) + #define __pyx_assertions_enabled() (!Py_OptimizeFlag) +#endif + +/* PyAssertionError_Check.proto */ +#define __Pyx_PyExc_AssertionError_Check(obj) __Pyx_TypeCheck(obj, PyExc_AssertionError) + +/* RaiseTooManyValuesToUnpack.proto */ +static CYTHON_INLINE void __Pyx_RaiseTooManyValuesError(Py_ssize_t expected); + +/* RaiseNeedMoreValuesToUnpack.proto */ +static CYTHON_INLINE void __Pyx_RaiseNeedMoreValuesError(Py_ssize_t index); + +/* RaiseNoneIterError.proto */ +static CYTHON_INLINE void __Pyx_RaiseNoneNotIterableError(void); + +/* ExtTypeTest.proto */ +static CYTHON_INLINE int __Pyx_TypeTest(PyObject *obj, PyTypeObject *type); + +/* 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 + +/* 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); + +/* 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 + +CYTHON_UNUSED static int __pyx_memoryview_getbuffer(PyObject *__pyx_v_self, Py_buffer *__pyx_v_info, int __pyx_v_flags); /*proto*/ +/* 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 + +/* PySequenceMultiply.proto */ +#define __Pyx_PySequence_Multiply_Left(mul, seq) __Pyx_PySequence_Multiply(seq, mul) +static CYTHON_INLINE PyObject* __Pyx_PySequence_Multiply(PyObject *seq, Py_ssize_t mul); + +/* PyObjectFormatAndDecref.proto */ +static CYTHON_INLINE PyObject* __Pyx_PyObject_FormatSimpleAndDecref(PyObject* s, PyObject* f); +static CYTHON_INLINE PyObject* __Pyx_PyObject_FormatAndDecref(PyObject* s, PyObject* f); + +/* PyObjectFormat.proto */ +#if CYTHON_USE_UNICODE_WRITER +static PyObject* __Pyx_PyObject_Format(PyObject* s, PyObject* f); +#else +#define __Pyx_PyObject_Format(s, f) PyObject_Format(s, f) +#endif + +/* SetItemInt.proto */ +#define __Pyx_SetItemInt(o, i, v, type, is_signed, to_py_func, is_list, wraparound, boundscheck, has_gil, unsafe_shared)\ + (__Pyx_fits_Py_ssize_t(i, type, is_signed) ?\ + __Pyx_SetItemInt_Fast(o, (Py_ssize_t)i, v, is_list, wraparound, boundscheck, unsafe_shared) :\ + (is_list ? (PyErr_SetString(PyExc_IndexError, "list assignment index out of range"), -1) :\ + __Pyx_SetItemInt_Generic(o, to_py_func(i), v))) +static int __Pyx_SetItemInt_Generic(PyObject *o, PyObject *j, PyObject *v); +static CYTHON_INLINE int __Pyx_SetItemInt_Fast(PyObject *o, Py_ssize_t i, PyObject *v, + int is_list, int wraparound, int boundscheck, int unsafe_shared); + +/* RaiseUnboundLocalError.proto */ +static void __Pyx_RaiseUnboundLocalError(const char *varname); + +/* PyIndexError_Check.proto */ +#define __Pyx_PyExc_IndexError_Check(obj) __Pyx_TypeCheck(obj, PyExc_IndexError) + +/* DivInt[long].proto */ +static CYTHON_INLINE long __Pyx_div_long(long, long, int b_is_constant); + +/* PyImportError_Check.proto */ +#define __Pyx_PyExc_ImportError_Check(obj) __Pyx_TypeCheck(obj, PyExc_ImportError) + +/* tp_new.proto */ +#define __Pyx_tp_new(type_obj, args) __Pyx_tp_new_kwargs(type_obj, args, NULL) +static CYTHON_INLINE PyObject* __Pyx_tp_new_kwargs(PyObject* type_obj, PyObject* args, PyObject* kwargs); + +/* WriteUnraisableException.proto */ +static void __Pyx_WriteUnraisable(const char *name, int clineno, + int lineno, const char *filename, + int full_traceback, int nogil); + +/* MoveIfSupported.proto */ +#if CYTHON_USE_CPP_STD_MOVE + #include + #define __PYX_STD_MOVE_IF_SUPPORTED(x) std::move(x) +#else + #define __PYX_STD_MOVE_IF_SUPPORTED(x) x +#endif + +/* PyObjectVectorCallKwBuilder.proto */ +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 + +/* 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 + +/* PyObject_Unicode.proto */ +#define __Pyx_PyObject_Unicode(obj)\ + (likely(PyUnicode_CheckExact(obj)) ? __Pyx_NewRef(obj) : PyObject_Str(obj)) + +/* 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 + +/* DefaultPlacementNew.proto */ +#include +template +void __Pyx_default_placement_construct(T* x) { + new (static_cast(x)) T(); +} + +/* 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); + +/* SetVTable.proto */ +static int __Pyx_SetVtable(PyTypeObject* typeptr , void* vtable); + +/* GetVTable.proto (used by MergeVTables) */ +static void* __Pyx_GetVtable(PyTypeObject *type); + +/* MergeVTables.proto */ +static int __Pyx_MergeVtables(PyTypeObject *type); + +/* 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_1 +#define __PYX_HAVE_RT_ImportType_proto_3_2_1 +#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_1(s) alignof(s) +#else +#define __PYX_GET_STRUCT_ALIGNMENT_3_2_1(s) sizeof(void*) +#endif +enum __Pyx_ImportType_CheckSize_3_2_1 { + __Pyx_ImportType_CheckSize_Error_3_2_1 = 0, + __Pyx_ImportType_CheckSize_Warn_3_2_1 = 1, + __Pyx_ImportType_CheckSize_Ignore_3_2_1 = 2 +}; +static PyTypeObject *__Pyx_ImportType_3_2_1(PyObject* module, const char *module_name, const char *class_name, size_t size, size_t alignment, enum __Pyx_ImportType_CheckSize_3_2_1 check_size); +#endif + +/* VoidPtrImport.proto */ +static int __Pyx_ImportVoidPtr_3_2_1(PyObject *module, const char *name, void **p, const char *sig); + +/* FunctionImport.proto */ +static int __Pyx_ImportFunction_3_2_1(PyObject *module, const char *funcname, void (**f)(void), const char *sig); + +/* 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); + +struct __pyx_t_5spacy_8pipeline_17_parser_internals_6_state_ArcC; +static PyObject* __pyx_convert__to_py_struct____pyx_t_5spacy_8pipeline_17_parser_internals_6_state_ArcC(struct __pyx_t_5spacy_8pipeline_17_parser_internals_6_state_ArcC s); +/* RealImag.proto */ +#if CYTHON_CCOMPLEX + #ifdef __cplusplus + #define __Pyx_CREAL(z) ((z).real()) + #define __Pyx_CIMAG(z) ((z).imag()) + #else + #define __Pyx_CREAL(z) (__real__(z)) + #define __Pyx_CIMAG(z) (__imag__(z)) + #endif +#else + #define __Pyx_CREAL(z) ((z).real) + #define __Pyx_CIMAG(z) ((z).imag) +#endif +#if defined(__cplusplus) && CYTHON_CCOMPLEX\ + && (defined(_WIN32) || defined(__clang__) || (defined(__GNUC__) && (__GNUC__ >= 5 || __GNUC__ == 4 && __GNUC_MINOR__ >= 4 )) || __cplusplus >= 201103) + #define __Pyx_SET_CREAL(z,x) ((z).real(x)) + #define __Pyx_SET_CIMAG(z,y) ((z).imag(y)) +#else + #define __Pyx_SET_CREAL(z,x) __Pyx_CREAL(z) = (x) + #define __Pyx_SET_CIMAG(z,y) __Pyx_CIMAG(z) = (y) +#endif + +/* Arithmetic.proto */ +#if CYTHON_CCOMPLEX && (1) && (!0 || __cplusplus) + #define __Pyx_c_eq_float(a, b) ((a)==(b)) + #define __Pyx_c_sum_float(a, b) ((a)+(b)) + #define __Pyx_c_diff_float(a, b) ((a)-(b)) + #define __Pyx_c_prod_float(a, b) ((a)*(b)) + #define __Pyx_c_quot_float(a, b) ((a)/(b)) + #define __Pyx_c_neg_float(a) (-(a)) + #ifdef __cplusplus + #define __Pyx_c_is_zero_float(z) ((z)==(float)0) + #define __Pyx_c_conj_float(z) (::std::conj(z)) + #if 1 + #define __Pyx_c_abs_float(z) (::std::abs(z)) + #define __Pyx_c_pow_float(a, b) (::std::pow(a, b)) + #endif + #else + #define __Pyx_c_is_zero_float(z) ((z)==0) + #define __Pyx_c_conj_float(z) (conjf(z)) + #if 1 + #define __Pyx_c_abs_float(z) (cabsf(z)) + #define __Pyx_c_pow_float(a, b) (cpowf(a, b)) + #endif + #endif +#else + static CYTHON_INLINE int __Pyx_c_eq_float(__pyx_t_float_complex, __pyx_t_float_complex); + static CYTHON_INLINE __pyx_t_float_complex __Pyx_c_sum_float(__pyx_t_float_complex, __pyx_t_float_complex); + static CYTHON_INLINE __pyx_t_float_complex __Pyx_c_diff_float(__pyx_t_float_complex, __pyx_t_float_complex); + static CYTHON_INLINE __pyx_t_float_complex __Pyx_c_prod_float(__pyx_t_float_complex, __pyx_t_float_complex); + static CYTHON_INLINE __pyx_t_float_complex __Pyx_c_quot_float(__pyx_t_float_complex, __pyx_t_float_complex); + static CYTHON_INLINE __pyx_t_float_complex __Pyx_c_neg_float(__pyx_t_float_complex); + static CYTHON_INLINE int __Pyx_c_is_zero_float(__pyx_t_float_complex); + static CYTHON_INLINE __pyx_t_float_complex __Pyx_c_conj_float(__pyx_t_float_complex); + #if 1 + static CYTHON_INLINE float __Pyx_c_abs_float(__pyx_t_float_complex); + static CYTHON_INLINE __pyx_t_float_complex __Pyx_c_pow_float(__pyx_t_float_complex, __pyx_t_float_complex); + #endif +#endif + +/* Arithmetic.proto */ +#if CYTHON_CCOMPLEX && (1) && (!0 || __cplusplus) + #define __Pyx_c_eq_double(a, b) ((a)==(b)) + #define __Pyx_c_sum_double(a, b) ((a)+(b)) + #define __Pyx_c_diff_double(a, b) ((a)-(b)) + #define __Pyx_c_prod_double(a, b) ((a)*(b)) + #define __Pyx_c_quot_double(a, b) ((a)/(b)) + #define __Pyx_c_neg_double(a) (-(a)) + #ifdef __cplusplus + #define __Pyx_c_is_zero_double(z) ((z)==(double)0) + #define __Pyx_c_conj_double(z) (::std::conj(z)) + #if 1 + #define __Pyx_c_abs_double(z) (::std::abs(z)) + #define __Pyx_c_pow_double(a, b) (::std::pow(a, b)) + #endif + #else + #define __Pyx_c_is_zero_double(z) ((z)==0) + #define __Pyx_c_conj_double(z) (conj(z)) + #if 1 + #define __Pyx_c_abs_double(z) (cabs(z)) + #define __Pyx_c_pow_double(a, b) (cpow(a, b)) + #endif + #endif +#else + static CYTHON_INLINE int __Pyx_c_eq_double(__pyx_t_double_complex, __pyx_t_double_complex); + static CYTHON_INLINE __pyx_t_double_complex __Pyx_c_sum_double(__pyx_t_double_complex, __pyx_t_double_complex); + static CYTHON_INLINE __pyx_t_double_complex __Pyx_c_diff_double(__pyx_t_double_complex, __pyx_t_double_complex); + static CYTHON_INLINE __pyx_t_double_complex __Pyx_c_prod_double(__pyx_t_double_complex, __pyx_t_double_complex); + static CYTHON_INLINE __pyx_t_double_complex __Pyx_c_quot_double(__pyx_t_double_complex, __pyx_t_double_complex); + static CYTHON_INLINE __pyx_t_double_complex __Pyx_c_neg_double(__pyx_t_double_complex); + static CYTHON_INLINE int __Pyx_c_is_zero_double(__pyx_t_double_complex); + static CYTHON_INLINE __pyx_t_double_complex __Pyx_c_conj_double(__pyx_t_double_complex); + #if 1 + static CYTHON_INLINE double __Pyx_c_abs_double(__pyx_t_double_complex); + static CYTHON_INLINE __pyx_t_double_complex __Pyx_c_pow_double(__pyx_t_double_complex, __pyx_t_double_complex); + #endif +#endif + +/* Arithmetic.proto */ +#if CYTHON_CCOMPLEX && (1) && (!0 || __cplusplus) + #define __Pyx_c_eq_long__double(a, b) ((a)==(b)) + #define __Pyx_c_sum_long__double(a, b) ((a)+(b)) + #define __Pyx_c_diff_long__double(a, b) ((a)-(b)) + #define __Pyx_c_prod_long__double(a, b) ((a)*(b)) + #define __Pyx_c_quot_long__double(a, b) ((a)/(b)) + #define __Pyx_c_neg_long__double(a) (-(a)) + #ifdef __cplusplus + #define __Pyx_c_is_zero_long__double(z) ((z)==(long double)0) + #define __Pyx_c_conj_long__double(z) (::std::conj(z)) + #if 1 + #define __Pyx_c_abs_long__double(z) (::std::abs(z)) + #define __Pyx_c_pow_long__double(a, b) (::std::pow(a, b)) + #endif + #else + #define __Pyx_c_is_zero_long__double(z) ((z)==0) + #define __Pyx_c_conj_long__double(z) (conjl(z)) + #if 1 + #define __Pyx_c_abs_long__double(z) (cabsl(z)) + #define __Pyx_c_pow_long__double(a, b) (cpowl(a, b)) + #endif + #endif +#else + static CYTHON_INLINE int __Pyx_c_eq_long__double(__pyx_t_long_double_complex, __pyx_t_long_double_complex); + static CYTHON_INLINE __pyx_t_long_double_complex __Pyx_c_sum_long__double(__pyx_t_long_double_complex, __pyx_t_long_double_complex); + static CYTHON_INLINE __pyx_t_long_double_complex __Pyx_c_diff_long__double(__pyx_t_long_double_complex, __pyx_t_long_double_complex); + static CYTHON_INLINE __pyx_t_long_double_complex __Pyx_c_prod_long__double(__pyx_t_long_double_complex, __pyx_t_long_double_complex); + static CYTHON_INLINE __pyx_t_long_double_complex __Pyx_c_quot_long__double(__pyx_t_long_double_complex, __pyx_t_long_double_complex); + static CYTHON_INLINE __pyx_t_long_double_complex __Pyx_c_neg_long__double(__pyx_t_long_double_complex); + static CYTHON_INLINE int __Pyx_c_is_zero_long__double(__pyx_t_long_double_complex); + static CYTHON_INLINE __pyx_t_long_double_complex __Pyx_c_conj_long__double(__pyx_t_long_double_complex); + #if 1 + static CYTHON_INLINE long double __Pyx_c_abs_long__double(__pyx_t_long_double_complex); + static CYTHON_INLINE __pyx_t_long_double_complex __Pyx_c_pow_long__double(__pyx_t_long_double_complex, __pyx_t_long_double_complex); + #endif +#endif + +/* BufferStructDeclare.proto */ +typedef struct { + Py_ssize_t shape, strides, suboffsets; +} __Pyx_Buf_DimInfo; +typedef struct { + size_t refcount; + Py_buffer pybuffer; +} __Pyx_Buffer; +typedef struct { + __Pyx_Buffer *rcbuffer; + char *data; + __Pyx_Buf_DimInfo diminfo[8]; +} __Pyx_LocalBuf_ND; + +/* MemviewRefcount.proto */ +static CYTHON_INLINE int __pyx_add_acquisition_count_locked( + __pyx_atomic_int_type *acquisition_count, PyThread_type_lock lock); +static CYTHON_INLINE int __pyx_sub_acquisition_count_locked( + __pyx_atomic_int_type *acquisition_count, PyThread_type_lock lock); +#define __pyx_get_slice_count_pointer(memview) (&memview->acquisition_count) +#define __PYX_INC_MEMVIEW(slice, have_gil) __Pyx_INC_MEMVIEW(slice, have_gil, __LINE__) +#define __PYX_XCLEAR_MEMVIEW(slice, have_gil) __Pyx_XCLEAR_MEMVIEW(slice, have_gil, __LINE__) +static CYTHON_INLINE void __Pyx_INC_MEMVIEW(__Pyx_memviewslice *, int, int); +static CYTHON_INLINE void __Pyx_XCLEAR_MEMVIEW(__Pyx_memviewslice *, int, int); + +/* MemviewSliceIsContig.proto */ +static int __pyx_memviewslice_is_contig(const __Pyx_memviewslice mvs, char order, int ndim); + +/* OverlappingSlices.proto */ +static int __pyx_slices_overlap(__Pyx_memviewslice *slice1, + __Pyx_memviewslice *slice2, + int ndim, size_t itemsize); + +/* MemviewSliceInit.proto */ +static int __Pyx_init_memviewslice( + struct __pyx_memoryview_obj *memview, + int ndim, + __Pyx_memviewslice *memviewslice, + int memview_is_new_reference); + +/* CppExceptionConversion.proto */ +#ifndef __Pyx_CppExn2PyErr +#include +#include +#include +#include +static void __Pyx_CppExn2PyErr() { + try { + if (PyErr_Occurred()) + ; // let the latest Python exn pass through and ignore the current one + else + throw; + } catch (const std::bad_alloc& exn) { + PyErr_SetString(PyExc_MemoryError, exn.what()); + } catch (const std::bad_cast& exn) { + PyErr_SetString(PyExc_TypeError, exn.what()); + } catch (const std::bad_typeid& exn) { + PyErr_SetString(PyExc_TypeError, exn.what()); + } catch (const std::domain_error& exn) { + PyErr_SetString(PyExc_ValueError, exn.what()); + } catch (const std::invalid_argument& exn) { + PyErr_SetString(PyExc_ValueError, exn.what()); + } catch (const std::ios_base::failure& exn) { + PyErr_SetString(PyExc_IOError, exn.what()); + } catch (const std::out_of_range& exn) { + PyErr_SetString(PyExc_IndexError, exn.what()); + } catch (const std::overflow_error& exn) { + PyErr_SetString(PyExc_OverflowError, exn.what()); + } catch (const std::range_error& exn) { + PyErr_SetString(PyExc_ArithmeticError, exn.what()); + } catch (const std::underflow_error& exn) { + PyErr_SetString(PyExc_ArithmeticError, exn.what()); + } catch (const std::exception& exn) { + PyErr_SetString(PyExc_RuntimeError, exn.what()); + } + catch (...) + { + PyErr_SetString(PyExc_RuntimeError, "Unknown exception"); + } +} +#endif + +/* CIntFromPy.proto */ +static CYTHON_INLINE int __Pyx_PyLong_As_int(PyObject *); + +/* CIntFromPy.proto */ +static CYTHON_INLINE uint64_t __Pyx_PyLong_As_uint64_t(PyObject *); + +/* CIntToPy.proto */ +static CYTHON_INLINE PyObject* __Pyx_PyLong_From_int(int value); + +/* CIntToPy.proto */ +static CYTHON_INLINE PyObject* __Pyx_PyLong_From_long(long value); + +/* CIntToPy.proto */ +static CYTHON_INLINE PyObject* __Pyx_PyLong_From_uint64_t(uint64_t value); + +/* CIntFromPy.proto */ +static CYTHON_INLINE size_t __Pyx_PyLong_As_size_t(PyObject *); + +/* MemviewSliceCopy.proto */ +static __Pyx_memviewslice +__pyx_memoryview_copy_new_contig(const __Pyx_memviewslice *from_mvs, + const char *mode, int ndim, + size_t sizeof_dtype, int contig_flag, + int dtype_is_object); + +/* PyObjectCall2Args.proto (used by PyObjectCallMethod1) */ +static CYTHON_INLINE PyObject* __Pyx_PyObject_Call2Args(PyObject* function, PyObject* arg1, PyObject* arg2); + +/* PyObjectCallMethod1.proto (used by UpdateUnpickledDict) */ +static PyObject* __Pyx_PyObject_CallMethod1(PyObject* obj, PyObject* method_name, PyObject* arg); + +/* UpdateUnpickledDict.proto */ +static int __Pyx_UpdateUnpickledDict(PyObject *obj, PyObject *state, Py_ssize_t index); + +/* CheckUnpickleChecksum.proto */ +static CYTHON_INLINE int __Pyx_CheckUnpickleChecksum(long checksum, long checksum1, long checksum2, long checksum3, const char *members); + +/* CIntFromPy.proto */ +static CYTHON_INLINE long __Pyx_PyLong_As_long(PyObject *); + +/* CIntFromPy.proto */ +static CYTHON_INLINE char __Pyx_PyLong_As_char(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 + +/* 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 "." + +static PyObject *__pyx_array_get_memview(struct __pyx_array_obj *__pyx_v_self); /* proto*/ +static char *__pyx_memoryview_get_item_pointer(struct __pyx_memoryview_obj *__pyx_v_self, PyObject *__pyx_v_index); /* proto*/ +static PyObject *__pyx_memoryview_is_slice(struct __pyx_memoryview_obj *__pyx_v_self, PyObject *__pyx_v_obj); /* proto*/ +static PyObject *__pyx_memoryview_setitem_slice_assignment(struct __pyx_memoryview_obj *__pyx_v_self, PyObject *__pyx_v_dst, PyObject *__pyx_v_src); /* proto*/ +static PyObject *__pyx_memoryview_setitem_slice_assign_scalar(struct __pyx_memoryview_obj *__pyx_v_self, struct __pyx_memoryview_obj *__pyx_v_dst, PyObject *__pyx_v_value); /* proto*/ +static PyObject *__pyx_memoryview_setitem_indexed(struct __pyx_memoryview_obj *__pyx_v_self, PyObject *__pyx_v_index, PyObject *__pyx_v_value); /* proto*/ +static PyObject *__pyx_memoryview_convert_item_to_object(struct __pyx_memoryview_obj *__pyx_v_self, char *__pyx_v_itemp); /* proto*/ +static PyObject *__pyx_memoryview_assign_item_from_object(struct __pyx_memoryview_obj *__pyx_v_self, char *__pyx_v_itemp, PyObject *__pyx_v_value); /* proto*/ +static PyObject *__pyx_memoryview__get_base(struct __pyx_memoryview_obj *__pyx_v_self); /* proto*/ +static PyObject *__pyx_memoryviewslice_convert_item_to_object(struct __pyx_memoryviewslice_obj *__pyx_v_self, char *__pyx_v_itemp); /* proto*/ +static PyObject *__pyx_memoryviewslice_assign_item_from_object(struct __pyx_memoryviewslice_obj *__pyx_v_self, char *__pyx_v_itemp, PyObject *__pyx_v_value); /* proto*/ +static PyObject *__pyx_memoryviewslice__get_base(struct __pyx_memoryviewslice_obj *__pyx_v_self); /* proto*/ +static CYTHON_INLINE npy_intp __pyx_f_5numpy_5dtype_8itemsize_itemsize(PyArray_Descr *__pyx_v_self); /* proto*/ +static CYTHON_INLINE npy_intp __pyx_f_5numpy_5dtype_9alignment_alignment(PyArray_Descr *__pyx_v_self); /* proto*/ +static CYTHON_INLINE PyObject *__pyx_f_5numpy_5dtype_6fields_fields(PyArray_Descr *__pyx_v_self); /* proto*/ +static CYTHON_INLINE PyObject *__pyx_f_5numpy_5dtype_5names_names(PyArray_Descr *__pyx_v_self); /* proto*/ +static CYTHON_INLINE PyArray_ArrayDescr *__pyx_f_5numpy_5dtype_8subarray_subarray(PyArray_Descr *__pyx_v_self); /* proto*/ +static CYTHON_INLINE npy_uint64 __pyx_f_5numpy_5dtype_5flags_flags(PyArray_Descr *__pyx_v_self); /* proto*/ +static CYTHON_INLINE int __pyx_f_5numpy_9broadcast_7numiter_numiter(PyArrayMultiIterObject *__pyx_v_self); /* proto*/ +static CYTHON_INLINE npy_intp __pyx_f_5numpy_9broadcast_4size_size(PyArrayMultiIterObject *__pyx_v_self); /* proto*/ +static CYTHON_INLINE npy_intp __pyx_f_5numpy_9broadcast_5index_index(PyArrayMultiIterObject *__pyx_v_self); /* proto*/ +static CYTHON_INLINE int __pyx_f_5numpy_9broadcast_2nd_nd(PyArrayMultiIterObject *__pyx_v_self); /* proto*/ +static CYTHON_INLINE npy_intp *__pyx_f_5numpy_9broadcast_10dimensions_dimensions(PyArrayMultiIterObject *__pyx_v_self); /* proto*/ +static CYTHON_INLINE void **__pyx_f_5numpy_9broadcast_5iters_iters(PyArrayMultiIterObject *__pyx_v_self); /* proto*/ +static CYTHON_INLINE PyObject *__pyx_f_5numpy_7ndarray_4base_base(PyArrayObject *__pyx_v_self); /* proto*/ +static CYTHON_INLINE PyArray_Descr *__pyx_f_5numpy_7ndarray_5descr_descr(PyArrayObject *__pyx_v_self); /* proto*/ +static CYTHON_INLINE int __pyx_f_5numpy_7ndarray_4ndim_ndim(PyArrayObject *__pyx_v_self); /* proto*/ +static CYTHON_INLINE npy_intp *__pyx_f_5numpy_7ndarray_5shape_shape(PyArrayObject *__pyx_v_self); /* proto*/ +static CYTHON_INLINE npy_intp *__pyx_f_5numpy_7ndarray_7strides_strides(PyArrayObject *__pyx_v_self); /* proto*/ +static CYTHON_INLINE npy_intp __pyx_f_5numpy_7ndarray_4size_size(PyArrayObject *__pyx_v_self); /* proto*/ +static CYTHON_INLINE char *__pyx_f_5numpy_7ndarray_4data_data(PyArrayObject *__pyx_v_self); /* proto*/ +static CYTHON_INLINE struct __pyx_obj_5spacy_6lexeme_Lexeme *__pyx_f_5spacy_6lexeme_6Lexeme_from_ptr(struct __pyx_t_5spacy_7structs_LexemeC *__pyx_v_lex, struct __pyx_obj_5spacy_5vocab_Vocab *__pyx_v_vocab); /* proto*/ +static CYTHON_INLINE void __pyx_f_5spacy_6lexeme_6Lexeme_set_struct_attr(struct __pyx_t_5spacy_7structs_LexemeC *__pyx_v_lex, enum __pyx_t_5spacy_5attrs_attr_id_t __pyx_v_name, __pyx_t_5spacy_8typedefs_attr_t __pyx_v_value); /* proto*/ +static CYTHON_INLINE __pyx_t_5spacy_8typedefs_attr_t __pyx_f_5spacy_6lexeme_6Lexeme_get_struct_attr(struct __pyx_t_5spacy_7structs_LexemeC const *__pyx_v_lex, enum __pyx_t_5spacy_5attrs_attr_id_t __pyx_v_feat_name); /* proto*/ +static CYTHON_INLINE int __pyx_f_5spacy_6lexeme_6Lexeme_c_check_flag(struct __pyx_t_5spacy_7structs_LexemeC const *__pyx_v_lexeme, enum __pyx_t_5spacy_5attrs_attr_id_t __pyx_v_flag_id); /* proto*/ +static CYTHON_INLINE int __pyx_f_5spacy_6lexeme_6Lexeme_c_set_flag(struct __pyx_t_5spacy_7structs_LexemeC *__pyx_v_lex, enum __pyx_t_5spacy_5attrs_attr_id_t __pyx_v_flag_id, int __pyx_v_value); /* proto*/ +static CYTHON_INLINE struct __pyx_obj_5spacy_8pipeline_17_parser_internals_10stateclass_StateClass *__pyx_f_5spacy_8pipeline_17_parser_internals_10stateclass_10StateClass_borrow(__pyx_t_5spacy_8pipeline_17_parser_internals_6_state_StateC *__pyx_v_ptr, struct __pyx_obj_5spacy_6tokens_3doc_Doc *__pyx_v_doc); /* proto*/ +static CYTHON_INLINE struct __pyx_obj_5spacy_8pipeline_17_parser_internals_10stateclass_StateClass *__pyx_f_5spacy_8pipeline_17_parser_internals_10stateclass_10StateClass_init_offset(struct __pyx_t_5spacy_7structs_TokenC const *__pyx_v_sent, int __pyx_v_length, int __pyx_v_offset); /* proto*/ + +/* Module declarations from "cymem.cymem" */ + +/* Module declarations from "libc.stdint" */ + +/* Module declarations from "libcpp.utility" */ + +/* Module declarations from "libcpp.unordered_map" */ + +/* Module declarations from "libcpp.unordered_set" */ + +/* Module declarations from "libcpp.vector" */ + +/* Module declarations from "spacy" */ + +/* Module declarations from "spacy.symbols" */ + +/* Module declarations from "spacy.parts_of_speech" */ + +/* Module declarations from "spacy.typedefs" */ + +/* Module declarations from "spacy.structs" */ + +/* Module declarations from "libc.string" */ + +/* Module declarations from "libc.stdio" */ + +/* Module declarations from "__builtin__" */ + +/* Module declarations from "cpython.type" */ + +/* Module declarations from "cpython" */ + +/* Module declarations from "cpython.object" */ + +/* Module declarations from "cpython.ref" */ + +/* Module declarations from "numpy" */ + +/* Module declarations from "numpy" */ + +/* Module declarations from "spacy.attrs" */ + +/* Module declarations from "murmurhash.mrmr" */ +static uint64_t (*__pyx_f_10murmurhash_4mrmr_hash64)(void *, int, uint64_t); /*proto*/ + +/* Module declarations from "preshed.maps" */ + +/* Module declarations from "libcpp.set" */ + +/* Module declarations from "spacy.strings" */ + +/* Module declarations from "spacy.morphology" */ + +/* Module declarations from "spacy.vocab" */ +static struct __pyx_t_5spacy_7structs_LexemeC *__pyx_vp_5spacy_5vocab_EMPTY_LEXEME = 0; +#define __pyx_v_5spacy_5vocab_EMPTY_LEXEME (*__pyx_vp_5spacy_5vocab_EMPTY_LEXEME) + +/* Module declarations from "spacy.tokens.doc" */ + +/* Module declarations from "libcpp" */ + +/* Module declarations from "cpython.exc" */ + +/* Module declarations from "libc.stdlib" */ + +/* Module declarations from "spacy.lexeme" */ +static struct __pyx_t_5spacy_7structs_LexemeC *__pyx_vp_5spacy_6lexeme_EMPTY_LEXEME = 0; +#define __pyx_v_5spacy_6lexeme_EMPTY_LEXEME (*__pyx_vp_5spacy_6lexeme_EMPTY_LEXEME) +static __pyx_t_5spacy_8typedefs_attr_t *__pyx_vp_5spacy_6lexeme_OOV_RANK = 0; +#define __pyx_v_5spacy_6lexeme_OOV_RANK (*__pyx_vp_5spacy_6lexeme_OOV_RANK) + +/* Module declarations from "spacy.pipeline._parser_internals._state" */ + +/* Module declarations from "spacy.pipeline._parser_internals.stateclass" */ +static PyObject *__pyx_collections_abc_Sequence = 0; +static PyObject *generic = 0; +static PyObject *strided = 0; +static PyObject *indirect = 0; +static PyObject *contiguous = 0; +static PyObject *indirect_contiguous = 0; +static int __pyx_memoryview_thread_locks_used; +static PyThread_type_lock __pyx_memoryview_thread_locks[8]; +static PyObject *__pyx_convert_vector_to_py_struct____pyx_t_5spacy_8pipeline_17_parser_internals_6_state_ArcC(std::vector const &); /*proto*/ +static int __pyx_array_allocate_buffer(struct __pyx_array_obj *); /*proto*/ +static struct __pyx_array_obj *__pyx_array_new(PyObject *, Py_ssize_t, char *, char const *, char *); /*proto*/ +static PyObject *__pyx_memoryview_new(PyObject *, int, int, __Pyx_TypeInfo const *); /*proto*/ +static CYTHON_INLINE int __pyx_memoryview_check(PyObject *); /*proto*/ +static PyObject *_unellipsify(PyObject *, int); /*proto*/ +static int assert_direct_dimensions(Py_ssize_t *, int); /*proto*/ +static struct __pyx_memoryview_obj *__pyx_memview_slice(struct __pyx_memoryview_obj *, PyObject *); /*proto*/ +static int __pyx_memoryview_slice_memviewslice(__Pyx_memviewslice *, Py_ssize_t, Py_ssize_t, Py_ssize_t, int, int, int *, Py_ssize_t, Py_ssize_t, Py_ssize_t, int, int, int, int); /*proto*/ +static char *__pyx_pybuffer_index(Py_buffer *, char *, Py_ssize_t, Py_ssize_t); /*proto*/ +static int __pyx_memslice_transpose(__Pyx_memviewslice *); /*proto*/ +static PyObject *__pyx_memoryview_fromslice(__Pyx_memviewslice, int, PyObject *(*)(char *), int (*)(char *, PyObject *), int); /*proto*/ +static __Pyx_memviewslice *__pyx_memoryview_get_slice_from_memoryview(struct __pyx_memoryview_obj *, __Pyx_memviewslice *); /*proto*/ +static void __pyx_memoryview_slice_copy(struct __pyx_memoryview_obj *, __Pyx_memviewslice *); /*proto*/ +static PyObject *__pyx_memoryview_copy_object(struct __pyx_memoryview_obj *); /*proto*/ +static PyObject *__pyx_memoryview_copy_object_from_slice(struct __pyx_memoryview_obj *, __Pyx_memviewslice *); /*proto*/ +static Py_ssize_t abs_py_ssize_t(Py_ssize_t); /*proto*/ +static char __pyx_get_best_slice_order(__Pyx_memviewslice *, int); /*proto*/ +static void _copy_strided_to_strided(char *, Py_ssize_t *, char *, Py_ssize_t *, Py_ssize_t *, Py_ssize_t *, int, size_t); /*proto*/ +static void copy_strided_to_strided(__Pyx_memviewslice *, __Pyx_memviewslice *, int, size_t); /*proto*/ +static Py_ssize_t __pyx_memoryview_slice_get_size(__Pyx_memviewslice *, int); /*proto*/ +static Py_ssize_t __pyx_fill_contig_strides_array(Py_ssize_t *, Py_ssize_t *, Py_ssize_t, int, char); /*proto*/ +static void *__pyx_memoryview_copy_data_to_temp(__Pyx_memviewslice *, __Pyx_memviewslice *, char, int); /*proto*/ +static int __pyx_memoryview_err_extents(int, Py_ssize_t, Py_ssize_t); /*proto*/ +static int __pyx_memoryview_err_dim(PyObject *, PyObject *, int); /*proto*/ +static int __pyx_memoryview_err(PyObject *, PyObject *); /*proto*/ +static int __pyx_memoryview_err_no_memory(void); /*proto*/ +static int __pyx_memoryview_copy_contents(__Pyx_memviewslice, __Pyx_memviewslice, int, int, int); /*proto*/ +static void __pyx_memoryview_broadcast_leading(__Pyx_memviewslice *, int, int); /*proto*/ +static void __pyx_memoryview_refcount_copying(__Pyx_memviewslice *, int, int, int); /*proto*/ +static void __pyx_memoryview_refcount_objects_in_slice_with_gil(char *, Py_ssize_t *, Py_ssize_t *, int, int); /*proto*/ +static void __pyx_memoryview_refcount_objects_in_slice(char *, Py_ssize_t *, Py_ssize_t *, int, int); /*proto*/ +static void __pyx_memoryview_slice_assign_scalar(__Pyx_memviewslice *, int, size_t, void *, int); /*proto*/ +static void __pyx_memoryview__slice_assign_scalar(char *, Py_ssize_t *, Py_ssize_t *, int, size_t, void *); /*proto*/ +static PyObject *__pyx_unpickle_Enum__set_state(struct __pyx_MemviewEnum_obj *, PyObject *); /*proto*/ +/* #### Code section: typeinfo ### */ +/* #### Code section: before_global_var ### */ +#define __Pyx_MODULE_NAME "spacy.pipeline._parser_internals.stateclass" +extern int __pyx_module_is_main_spacy__pipeline___parser_internals__stateclass; +int __pyx_module_is_main_spacy__pipeline___parser_internals__stateclass = 0; + +/* Implementation of "spacy.pipeline._parser_internals.stateclass" */ +/* #### Code section: global_var ### */ +static PyObject *__pyx_builtin___import__; +static PyObject *__pyx_builtin_enumerate; +static PyObject *__pyx_builtin_Ellipsis; +static PyObject *__pyx_builtin_id; +/* #### Code section: string_decls ### */ +/* #### Code section: decls ### */ +static int __pyx_array___pyx_pf_15View_dot_MemoryView_5array___cinit__(struct __pyx_array_obj *__pyx_v_self, PyObject *__pyx_v_shape, Py_ssize_t __pyx_v_itemsize, PyObject *__pyx_v_format, PyObject *__pyx_v_mode, int __pyx_v_allocate_buffer); /* proto */ +static int __pyx_array___pyx_pf_15View_dot_MemoryView_5array_2__getbuffer__(struct __pyx_array_obj *__pyx_v_self, Py_buffer *__pyx_v_info, int __pyx_v_flags); /* proto */ +static void __pyx_array___pyx_pf_15View_dot_MemoryView_5array_4__dealloc__(struct __pyx_array_obj *__pyx_v_self); /* proto */ +static PyObject *__pyx_pf_15View_dot_MemoryView_5array_7memview___get__(struct __pyx_array_obj *__pyx_v_self); /* proto */ +static Py_ssize_t __pyx_array___pyx_pf_15View_dot_MemoryView_5array_6__len__(struct __pyx_array_obj *__pyx_v_self); /* proto */ +static PyObject *__pyx_array___pyx_pf_15View_dot_MemoryView_5array_8__getattr__(struct __pyx_array_obj *__pyx_v_self, PyObject *__pyx_v_attr); /* proto */ +static PyObject *__pyx_array___pyx_pf_15View_dot_MemoryView_5array_10__getitem__(struct __pyx_array_obj *__pyx_v_self, PyObject *__pyx_v_item); /* proto */ +static int __pyx_array___pyx_pf_15View_dot_MemoryView_5array_12__setitem__(struct __pyx_array_obj *__pyx_v_self, PyObject *__pyx_v_item, PyObject *__pyx_v_value); /* proto */ +static PyObject *__pyx_pf___pyx_array___reduce_cython__(CYTHON_UNUSED struct __pyx_array_obj *__pyx_v_self); /* proto */ +static PyObject *__pyx_pf___pyx_array_2__setstate_cython__(CYTHON_UNUSED struct __pyx_array_obj *__pyx_v_self, CYTHON_UNUSED PyObject *__pyx_v___pyx_state); /* proto */ +static int __pyx_MemviewEnum___pyx_pf_15View_dot_MemoryView_4Enum___init__(struct __pyx_MemviewEnum_obj *__pyx_v_self, PyObject *__pyx_v_name); /* proto */ +static PyObject *__pyx_MemviewEnum___pyx_pf_15View_dot_MemoryView_4Enum_2__repr__(struct __pyx_MemviewEnum_obj *__pyx_v_self); /* proto */ +static PyObject *__pyx_pf___pyx_MemviewEnum___reduce_cython__(struct __pyx_MemviewEnum_obj *__pyx_v_self); /* proto */ +static PyObject *__pyx_pf___pyx_MemviewEnum_2__setstate_cython__(struct __pyx_MemviewEnum_obj *__pyx_v_self, PyObject *__pyx_v___pyx_state); /* proto */ +static int __pyx_memoryview___pyx_pf_15View_dot_MemoryView_10memoryview___cinit__(struct __pyx_memoryview_obj *__pyx_v_self, PyObject *__pyx_v_obj, int __pyx_v_flags, int __pyx_v_dtype_is_object); /* proto */ +static void __pyx_memoryview___pyx_pf_15View_dot_MemoryView_10memoryview_2__dealloc__(struct __pyx_memoryview_obj *__pyx_v_self); /* proto */ +static PyObject *__pyx_memoryview___pyx_pf_15View_dot_MemoryView_10memoryview_4__getitem__(struct __pyx_memoryview_obj *__pyx_v_self, PyObject *__pyx_v_index); /* proto */ +static int __pyx_memoryview___pyx_pf_15View_dot_MemoryView_10memoryview_6__setitem__(struct __pyx_memoryview_obj *__pyx_v_self, PyObject *__pyx_v_index, PyObject *__pyx_v_value); /* proto */ +static int __pyx_memoryview___pyx_pf_15View_dot_MemoryView_10memoryview_8__getbuffer__(struct __pyx_memoryview_obj *__pyx_v_self, Py_buffer *__pyx_v_info, int __pyx_v_flags); /* proto */ +static PyObject *__pyx_pf_15View_dot_MemoryView_10memoryview_1T___get__(struct __pyx_memoryview_obj *__pyx_v_self); /* proto */ +static PyObject *__pyx_pf_15View_dot_MemoryView_10memoryview_4base___get__(struct __pyx_memoryview_obj *__pyx_v_self); /* proto */ +static PyObject *__pyx_pf_15View_dot_MemoryView_10memoryview_5shape___get__(struct __pyx_memoryview_obj *__pyx_v_self); /* proto */ +static PyObject *__pyx_pf_15View_dot_MemoryView_10memoryview_7strides___get__(struct __pyx_memoryview_obj *__pyx_v_self); /* proto */ +static PyObject *__pyx_pf_15View_dot_MemoryView_10memoryview_10suboffsets___get__(struct __pyx_memoryview_obj *__pyx_v_self); /* proto */ +static PyObject *__pyx_pf_15View_dot_MemoryView_10memoryview_4ndim___get__(struct __pyx_memoryview_obj *__pyx_v_self); /* proto */ +static PyObject *__pyx_pf_15View_dot_MemoryView_10memoryview_8itemsize___get__(struct __pyx_memoryview_obj *__pyx_v_self); /* proto */ +static PyObject *__pyx_pf_15View_dot_MemoryView_10memoryview_6nbytes___get__(struct __pyx_memoryview_obj *__pyx_v_self); /* proto */ +static PyObject *__pyx_pf_15View_dot_MemoryView_10memoryview_4size___get__(struct __pyx_memoryview_obj *__pyx_v_self); /* proto */ +static Py_ssize_t __pyx_memoryview___pyx_pf_15View_dot_MemoryView_10memoryview_10__len__(struct __pyx_memoryview_obj *__pyx_v_self); /* proto */ +static PyObject *__pyx_memoryview___pyx_pf_15View_dot_MemoryView_10memoryview_12__repr__(struct __pyx_memoryview_obj *__pyx_v_self); /* proto */ +static PyObject *__pyx_memoryview___pyx_pf_15View_dot_MemoryView_10memoryview_14__str__(struct __pyx_memoryview_obj *__pyx_v_self); /* proto */ +static PyObject *__pyx_memoryview___pyx_pf_15View_dot_MemoryView_10memoryview_16is_c_contig(struct __pyx_memoryview_obj *__pyx_v_self); /* proto */ +static PyObject *__pyx_memoryview___pyx_pf_15View_dot_MemoryView_10memoryview_18is_f_contig(struct __pyx_memoryview_obj *__pyx_v_self); /* proto */ +static PyObject *__pyx_memoryview___pyx_pf_15View_dot_MemoryView_10memoryview_20copy(struct __pyx_memoryview_obj *__pyx_v_self); /* proto */ +static PyObject *__pyx_memoryview___pyx_pf_15View_dot_MemoryView_10memoryview_22copy_fortran(struct __pyx_memoryview_obj *__pyx_v_self); /* proto */ +static PyObject *__pyx_pf___pyx_memoryview___reduce_cython__(CYTHON_UNUSED struct __pyx_memoryview_obj *__pyx_v_self); /* proto */ +static PyObject *__pyx_pf___pyx_memoryview_2__setstate_cython__(CYTHON_UNUSED struct __pyx_memoryview_obj *__pyx_v_self, CYTHON_UNUSED PyObject *__pyx_v___pyx_state); /* proto */ +static void __pyx_memoryviewslice___pyx_pf_15View_dot_MemoryView_16_memoryviewslice___dealloc__(struct __pyx_memoryviewslice_obj *__pyx_v_self); /* proto */ +static PyObject *__pyx_pf___pyx_memoryviewslice___reduce_cython__(CYTHON_UNUSED struct __pyx_memoryviewslice_obj *__pyx_v_self); /* proto */ +static PyObject *__pyx_pf___pyx_memoryviewslice_2__setstate_cython__(CYTHON_UNUSED struct __pyx_memoryviewslice_obj *__pyx_v_self, CYTHON_UNUSED PyObject *__pyx_v___pyx_state); /* proto */ +static PyObject *__pyx_pf_15View_dot_MemoryView___pyx_unpickle_Enum(CYTHON_UNUSED PyObject *__pyx_self, PyObject *__pyx_v___pyx_type, long __pyx_v___pyx_checksum, PyObject *__pyx_v___pyx_state); /* proto */ +static int __pyx_pf_5spacy_8pipeline_17_parser_internals_10stateclass_10StateClass___init__(struct __pyx_obj_5spacy_8pipeline_17_parser_internals_10stateclass_StateClass *__pyx_v_self, struct __pyx_obj_5spacy_6tokens_3doc_Doc *__pyx_v_doc, int __pyx_v_offset); /* proto */ +static void __pyx_pf_5spacy_8pipeline_17_parser_internals_10stateclass_10StateClass_2__dealloc__(struct __pyx_obj_5spacy_8pipeline_17_parser_internals_10stateclass_StateClass *__pyx_v_self); /* proto */ +static PyObject *__pyx_pf_5spacy_8pipeline_17_parser_internals_10stateclass_10StateClass_5stack___get__(struct __pyx_obj_5spacy_8pipeline_17_parser_internals_10stateclass_StateClass *__pyx_v_self); /* proto */ +static PyObject *__pyx_pf_5spacy_8pipeline_17_parser_internals_10stateclass_10StateClass_5queue___get__(struct __pyx_obj_5spacy_8pipeline_17_parser_internals_10stateclass_StateClass *__pyx_v_self); /* proto */ +static PyObject *__pyx_pf_5spacy_8pipeline_17_parser_internals_10stateclass_10StateClass_19token_vector_length___get__(struct __pyx_obj_5spacy_8pipeline_17_parser_internals_10stateclass_StateClass *__pyx_v_self); /* proto */ +static PyObject *__pyx_pf_5spacy_8pipeline_17_parser_internals_10stateclass_10StateClass_4arcs___get__(struct __pyx_obj_5spacy_8pipeline_17_parser_internals_10stateclass_StateClass *__pyx_v_self); /* proto */ +static PyObject *__pyx_pf_5spacy_8pipeline_17_parser_internals_10stateclass_10StateClass_4add_arc(struct __pyx_obj_5spacy_8pipeline_17_parser_internals_10stateclass_StateClass *__pyx_v_self, int __pyx_v_head, int __pyx_v_child, int __pyx_v_label); /* proto */ +static PyObject *__pyx_pf_5spacy_8pipeline_17_parser_internals_10stateclass_10StateClass_6del_arc(struct __pyx_obj_5spacy_8pipeline_17_parser_internals_10stateclass_StateClass *__pyx_v_self, int __pyx_v_head, int __pyx_v_child); /* proto */ +static PyObject *__pyx_pf_5spacy_8pipeline_17_parser_internals_10stateclass_10StateClass_8H(struct __pyx_obj_5spacy_8pipeline_17_parser_internals_10stateclass_StateClass *__pyx_v_self, int __pyx_v_child); /* proto */ +static PyObject *__pyx_pf_5spacy_8pipeline_17_parser_internals_10stateclass_10StateClass_10L(struct __pyx_obj_5spacy_8pipeline_17_parser_internals_10stateclass_StateClass *__pyx_v_self, int __pyx_v_head, int __pyx_v_idx); /* proto */ +static PyObject *__pyx_pf_5spacy_8pipeline_17_parser_internals_10stateclass_10StateClass_12R(struct __pyx_obj_5spacy_8pipeline_17_parser_internals_10stateclass_StateClass *__pyx_v_self, int __pyx_v_head, int __pyx_v_idx); /* proto */ +static PyObject *__pyx_pf_5spacy_8pipeline_17_parser_internals_10stateclass_10StateClass_4_b_i___get__(struct __pyx_obj_5spacy_8pipeline_17_parser_internals_10stateclass_StateClass *__pyx_v_self); /* proto */ +static PyObject *__pyx_pf_5spacy_8pipeline_17_parser_internals_10stateclass_10StateClass_6length___get__(struct __pyx_obj_5spacy_8pipeline_17_parser_internals_10stateclass_StateClass *__pyx_v_self); /* proto */ +static PyObject *__pyx_pf_5spacy_8pipeline_17_parser_internals_10stateclass_10StateClass_14is_final(struct __pyx_obj_5spacy_8pipeline_17_parser_internals_10stateclass_StateClass *__pyx_v_self); /* proto */ +static PyObject *__pyx_pf_5spacy_8pipeline_17_parser_internals_10stateclass_10StateClass_16copy(struct __pyx_obj_5spacy_8pipeline_17_parser_internals_10stateclass_StateClass *__pyx_v_self); /* proto */ +static PyObject *__pyx_pf_5spacy_8pipeline_17_parser_internals_10stateclass_10StateClass_18print_state(struct __pyx_obj_5spacy_8pipeline_17_parser_internals_10stateclass_StateClass *__pyx_v_self); /* proto */ +static PyObject *__pyx_pf_5spacy_8pipeline_17_parser_internals_10stateclass_10StateClass_20S(struct __pyx_obj_5spacy_8pipeline_17_parser_internals_10stateclass_StateClass *__pyx_v_self, int __pyx_v_i); /* proto */ +static PyObject *__pyx_pf_5spacy_8pipeline_17_parser_internals_10stateclass_10StateClass_22B(struct __pyx_obj_5spacy_8pipeline_17_parser_internals_10stateclass_StateClass *__pyx_v_self, int __pyx_v_i); /* proto */ +static PyObject *__pyx_pf_5spacy_8pipeline_17_parser_internals_10stateclass_10StateClass_24H(struct __pyx_obj_5spacy_8pipeline_17_parser_internals_10stateclass_StateClass *__pyx_v_self, int __pyx_v_i); /* proto */ +static PyObject *__pyx_pf_5spacy_8pipeline_17_parser_internals_10stateclass_10StateClass_26E(struct __pyx_obj_5spacy_8pipeline_17_parser_internals_10stateclass_StateClass *__pyx_v_self, int __pyx_v_i); /* proto */ +static PyObject *__pyx_pf_5spacy_8pipeline_17_parser_internals_10stateclass_10StateClass_28L(struct __pyx_obj_5spacy_8pipeline_17_parser_internals_10stateclass_StateClass *__pyx_v_self, int __pyx_v_i, int __pyx_v_idx); /* proto */ +static PyObject *__pyx_pf_5spacy_8pipeline_17_parser_internals_10stateclass_10StateClass_30R(struct __pyx_obj_5spacy_8pipeline_17_parser_internals_10stateclass_StateClass *__pyx_v_self, int __pyx_v_i, int __pyx_v_idx); /* proto */ +static PyObject *__pyx_pf_5spacy_8pipeline_17_parser_internals_10stateclass_10StateClass_32S_(struct __pyx_obj_5spacy_8pipeline_17_parser_internals_10stateclass_StateClass *__pyx_v_self, int __pyx_v_i); /* proto */ +static PyObject *__pyx_pf_5spacy_8pipeline_17_parser_internals_10stateclass_10StateClass_34B_(struct __pyx_obj_5spacy_8pipeline_17_parser_internals_10stateclass_StateClass *__pyx_v_self, int __pyx_v_i); /* proto */ +static PyObject *__pyx_pf_5spacy_8pipeline_17_parser_internals_10stateclass_10StateClass_36H_(struct __pyx_obj_5spacy_8pipeline_17_parser_internals_10stateclass_StateClass *__pyx_v_self, int __pyx_v_i); /* proto */ +static PyObject *__pyx_pf_5spacy_8pipeline_17_parser_internals_10stateclass_10StateClass_38E_(struct __pyx_obj_5spacy_8pipeline_17_parser_internals_10stateclass_StateClass *__pyx_v_self, int __pyx_v_i); /* proto */ +static PyObject *__pyx_pf_5spacy_8pipeline_17_parser_internals_10stateclass_10StateClass_40L_(struct __pyx_obj_5spacy_8pipeline_17_parser_internals_10stateclass_StateClass *__pyx_v_self, int __pyx_v_i, int __pyx_v_idx); /* proto */ +static PyObject *__pyx_pf_5spacy_8pipeline_17_parser_internals_10stateclass_10StateClass_42R_(struct __pyx_obj_5spacy_8pipeline_17_parser_internals_10stateclass_StateClass *__pyx_v_self, int __pyx_v_i, int __pyx_v_idx); /* proto */ +static PyObject *__pyx_pf_5spacy_8pipeline_17_parser_internals_10stateclass_10StateClass_44empty(struct __pyx_obj_5spacy_8pipeline_17_parser_internals_10stateclass_StateClass *__pyx_v_self); /* proto */ +static PyObject *__pyx_pf_5spacy_8pipeline_17_parser_internals_10stateclass_10StateClass_46eol(struct __pyx_obj_5spacy_8pipeline_17_parser_internals_10stateclass_StateClass *__pyx_v_self); /* proto */ +static PyObject *__pyx_pf_5spacy_8pipeline_17_parser_internals_10stateclass_10StateClass_48at_break(CYTHON_UNUSED struct __pyx_obj_5spacy_8pipeline_17_parser_internals_10stateclass_StateClass *__pyx_v_self); /* proto */ +static PyObject *__pyx_pf_5spacy_8pipeline_17_parser_internals_10stateclass_10StateClass_50has_head(struct __pyx_obj_5spacy_8pipeline_17_parser_internals_10stateclass_StateClass *__pyx_v_self, int __pyx_v_i); /* proto */ +static PyObject *__pyx_pf_5spacy_8pipeline_17_parser_internals_10stateclass_10StateClass_52n_L(struct __pyx_obj_5spacy_8pipeline_17_parser_internals_10stateclass_StateClass *__pyx_v_self, int __pyx_v_i); /* proto */ +static PyObject *__pyx_pf_5spacy_8pipeline_17_parser_internals_10stateclass_10StateClass_54n_R(struct __pyx_obj_5spacy_8pipeline_17_parser_internals_10stateclass_StateClass *__pyx_v_self, int __pyx_v_i); /* proto */ +static PyObject *__pyx_pf_5spacy_8pipeline_17_parser_internals_10stateclass_10StateClass_56entity_is_open(struct __pyx_obj_5spacy_8pipeline_17_parser_internals_10stateclass_StateClass *__pyx_v_self); /* proto */ +static PyObject *__pyx_pf_5spacy_8pipeline_17_parser_internals_10stateclass_10StateClass_58stack_depth(struct __pyx_obj_5spacy_8pipeline_17_parser_internals_10stateclass_StateClass *__pyx_v_self); /* proto */ +static PyObject *__pyx_pf_5spacy_8pipeline_17_parser_internals_10stateclass_10StateClass_60buffer_length(struct __pyx_obj_5spacy_8pipeline_17_parser_internals_10stateclass_StateClass *__pyx_v_self); /* proto */ +static PyObject *__pyx_pf_5spacy_8pipeline_17_parser_internals_10stateclass_10StateClass_62push(struct __pyx_obj_5spacy_8pipeline_17_parser_internals_10stateclass_StateClass *__pyx_v_self); /* proto */ +static PyObject *__pyx_pf_5spacy_8pipeline_17_parser_internals_10stateclass_10StateClass_64pop(struct __pyx_obj_5spacy_8pipeline_17_parser_internals_10stateclass_StateClass *__pyx_v_self); /* proto */ +static PyObject *__pyx_pf_5spacy_8pipeline_17_parser_internals_10stateclass_10StateClass_66unshift(struct __pyx_obj_5spacy_8pipeline_17_parser_internals_10stateclass_StateClass *__pyx_v_self); /* proto */ +static PyObject *__pyx_pf_5spacy_8pipeline_17_parser_internals_10stateclass_10StateClass_68add_arc(struct __pyx_obj_5spacy_8pipeline_17_parser_internals_10stateclass_StateClass *__pyx_v_self, int __pyx_v_head, int __pyx_v_child, __pyx_t_5spacy_8typedefs_attr_t __pyx_v_label); /* proto */ +static PyObject *__pyx_pf_5spacy_8pipeline_17_parser_internals_10stateclass_10StateClass_70del_arc(struct __pyx_obj_5spacy_8pipeline_17_parser_internals_10stateclass_StateClass *__pyx_v_self, int __pyx_v_head, int __pyx_v_child); /* proto */ +static PyObject *__pyx_pf_5spacy_8pipeline_17_parser_internals_10stateclass_10StateClass_72open_ent(struct __pyx_obj_5spacy_8pipeline_17_parser_internals_10stateclass_StateClass *__pyx_v_self, __pyx_t_5spacy_8typedefs_attr_t __pyx_v_label); /* proto */ +static PyObject *__pyx_pf_5spacy_8pipeline_17_parser_internals_10stateclass_10StateClass_74close_ent(struct __pyx_obj_5spacy_8pipeline_17_parser_internals_10stateclass_StateClass *__pyx_v_self); /* proto */ +static PyObject *__pyx_pf_5spacy_8pipeline_17_parser_internals_10stateclass_10StateClass_76clone(struct __pyx_obj_5spacy_8pipeline_17_parser_internals_10stateclass_StateClass *__pyx_v_self, struct __pyx_obj_5spacy_8pipeline_17_parser_internals_10stateclass_StateClass *__pyx_v_src); /* proto */ +static PyObject *__pyx_pf_5spacy_8pipeline_17_parser_internals_10stateclass_10StateClass_3doc___get__(struct __pyx_obj_5spacy_8pipeline_17_parser_internals_10stateclass_StateClass *__pyx_v_self); /* proto */ +static PyObject *__pyx_pf_5spacy_8pipeline_17_parser_internals_10stateclass_10StateClass_78__reduce_cython__(CYTHON_UNUSED struct __pyx_obj_5spacy_8pipeline_17_parser_internals_10stateclass_StateClass *__pyx_v_self); /* proto */ +static PyObject *__pyx_pf_5spacy_8pipeline_17_parser_internals_10stateclass_10StateClass_80__setstate_cython__(CYTHON_UNUSED struct __pyx_obj_5spacy_8pipeline_17_parser_internals_10stateclass_StateClass *__pyx_v_self, CYTHON_UNUSED PyObject *__pyx_v___pyx_state); /* proto */ +static PyObject *__pyx_tp_new_5spacy_8pipeline_17_parser_internals_10stateclass_StateClass(PyTypeObject *t, PyObject *a, PyObject *k); /*proto*/ +static PyObject *__pyx_tp_new_array(PyTypeObject *t, PyObject *a, PyObject *k); /*proto*/ +static PyObject *__pyx_tp_new_Enum(PyTypeObject *t, PyObject *a, PyObject *k); /*proto*/ +static PyObject *__pyx_tp_new_memoryview(PyTypeObject *t, PyObject *a, PyObject *k); /*proto*/ +static PyObject *__pyx_tp_new__memoryviewslice(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_5cymem_5cymem_PyMalloc; + PyTypeObject *__pyx_ptype_5cymem_5cymem_PyFree; + PyTypeObject *__pyx_ptype_5cymem_5cymem_Pool; + PyTypeObject *__pyx_ptype_5cymem_5cymem_Address; + PyTypeObject *__pyx_ptype_7cpython_4type_type; + PyTypeObject *__pyx_ptype_5numpy_dtype; + PyTypeObject *__pyx_ptype_5numpy_flatiter; + PyTypeObject *__pyx_ptype_5numpy_broadcast; + PyTypeObject *__pyx_ptype_5numpy_ndarray; + PyTypeObject *__pyx_ptype_5numpy_generic; + PyTypeObject *__pyx_ptype_5numpy_number; + PyTypeObject *__pyx_ptype_5numpy_integer; + PyTypeObject *__pyx_ptype_5numpy_signedinteger; + PyTypeObject *__pyx_ptype_5numpy_unsignedinteger; + PyTypeObject *__pyx_ptype_5numpy_inexact; + PyTypeObject *__pyx_ptype_5numpy_floating; + PyTypeObject *__pyx_ptype_5numpy_complexfloating; + PyTypeObject *__pyx_ptype_5numpy_flexible; + PyTypeObject *__pyx_ptype_5numpy_character; + PyTypeObject *__pyx_ptype_5numpy_ufunc; + PyTypeObject *__pyx_ptype_7preshed_4maps_PreshMap; + PyTypeObject *__pyx_ptype_7preshed_4maps_PreshMapArray; + PyTypeObject *__pyx_ptype_5spacy_7strings_StringStore; + PyTypeObject *__pyx_ptype_5spacy_10morphology_Morphology; + PyTypeObject *__pyx_ptype_5spacy_5vocab_Vocab; + PyTypeObject *__pyx_ptype_5spacy_6tokens_3doc_Doc; + PyTypeObject *__pyx_ptype_5spacy_6lexeme_Lexeme; + PyObject *__pyx_type_5spacy_8pipeline_17_parser_internals_10stateclass_StateClass; + PyObject *__pyx_type___pyx_array; + PyObject *__pyx_type___pyx_MemviewEnum; + PyObject *__pyx_type___pyx_memoryview; + PyObject *__pyx_type___pyx_memoryviewslice; + PyTypeObject *__pyx_ptype_5spacy_8pipeline_17_parser_internals_10stateclass_StateClass; + PyTypeObject *__pyx_array_type; + PyTypeObject *__pyx_MemviewEnum_type; + PyTypeObject *__pyx_memoryview_type; + PyTypeObject *__pyx_memoryviewslice_type; + __Pyx_CachedCFunction __pyx_umethod_PyDict_Type_items; + __Pyx_CachedCFunction __pyx_umethod_PyDict_Type_pop; + __Pyx_CachedCFunction __pyx_umethod_PyDict_Type_values; + PyObject *__pyx_slice[1]; + PyObject *__pyx_tuple[5]; + PyObject *__pyx_codeobj_tab[39]; + PyObject *__pyx_string_tab[239]; + PyObject *__pyx_number_tab[5]; +/* #### 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_All_dimensions_preceding_dimensi __pyx_string_tab[1] +#define __pyx_kp_u_Buffer_view_does_not_expose_stri __pyx_string_tab[2] +#define __pyx_kp_u_Can_only_create_a_buffer_that_is __pyx_string_tab[3] +#define __pyx_kp_u_Cannot_assign_to_read_only_memor __pyx_string_tab[4] +#define __pyx_kp_u_Cannot_create_writable_memory_vi __pyx_string_tab[5] +#define __pyx_kp_u_Cannot_index_with_type __pyx_string_tab[6] +#define __pyx_kp_u_Cannot_transpose_memoryview_with __pyx_string_tab[7] +#define __pyx_kp_u_Dimension_d_is_not_direct __pyx_string_tab[8] +#define __pyx_kp_u_Empty_shape_tuple_for_cython_arr __pyx_string_tab[9] +#define __pyx_kp_u_Index_out_of_bounds_axis_d __pyx_string_tab[10] +#define __pyx_kp_u_Indirect_dimensions_not_supporte __pyx_string_tab[11] +#define __pyx_kp_u_Invalid_mode_expected_c_or_fortr __pyx_string_tab[12] +#define __pyx_kp_u_Invalid_shape_in_axis __pyx_string_tab[13] +#define __pyx_kp_u_MemoryView_of __pyx_string_tab[14] +#define __pyx_kp_u_Note_that_Cython_is_deliberately __pyx_string_tab[15] +#define __pyx_kp_u_Out_of_bounds_on_buffer_access_a __pyx_string_tab[16] +#define __pyx_kp_u_Step_may_not_be_zero_axis_d __pyx_string_tab[17] +#define __pyx_kp_u_Unable_to_convert_item_to_object __pyx_string_tab[18] +#define __pyx_kp_u__10 __pyx_string_tab[19] +#define __pyx_kp_u__2 __pyx_string_tab[20] +#define __pyx_kp_u__3 __pyx_string_tab[21] +#define __pyx_kp_u__4 __pyx_string_tab[22] +#define __pyx_kp_u__5 __pyx_string_tab[23] +#define __pyx_kp_u__7 __pyx_string_tab[24] +#define __pyx_kp_u__8 __pyx_string_tab[25] +#define __pyx_kp_u__9 __pyx_string_tab[26] +#define __pyx_kp_u_add_note __pyx_string_tab[27] +#define __pyx_kp_u_and __pyx_string_tab[28] +#define __pyx_kp_u_at_0x __pyx_string_tab[29] +#define __pyx_kp_u_collections_abc __pyx_string_tab[30] +#define __pyx_kp_u_contiguous_and_direct __pyx_string_tab[31] +#define __pyx_kp_u_contiguous_and_indirect __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_gc __pyx_string_tab[35] +#define __pyx_kp_u_got __pyx_string_tab[36] +#define __pyx_kp_u_got_differing_extents_in_dimensi __pyx_string_tab[37] +#define __pyx_kp_u_isenabled __pyx_string_tab[38] +#define __pyx_kp_u_itemsize_0_for_cython_array __pyx_string_tab[39] +#define __pyx_kp_u_no_default___reduce___due_to_non __pyx_string_tab[40] +#define __pyx_kp_u_numpy__core_multiarray_failed_to __pyx_string_tab[41] +#define __pyx_kp_u_numpy__core_umath_failed_to_impo __pyx_string_tab[42] +#define __pyx_kp_u_object __pyx_string_tab[43] +#define __pyx_kp_u_self_c_cannot_be_converted_to_a __pyx_string_tab[44] +#define __pyx_kp_u_self_name_is_not_None __pyx_string_tab[45] +#define __pyx_kp_u_spacy_pipeline__parser_internals_2 __pyx_string_tab[46] +#define __pyx_kp_u_strided_and_direct __pyx_string_tab[47] +#define __pyx_kp_u_strided_and_direct_or_indirect __pyx_string_tab[48] +#define __pyx_kp_u_strided_and_indirect __pyx_string_tab[49] +#define __pyx_kp_u_stringsource __pyx_string_tab[50] +#define __pyx_kp_u_unable_to_allocate_array_data __pyx_string_tab[51] +#define __pyx_kp_u_unable_to_allocate_shape_and_str __pyx_string_tab[52] +#define __pyx_n_u_ASCII __pyx_string_tab[53] +#define __pyx_n_u_B __pyx_string_tab[54] +#define __pyx_n_u_B_2 __pyx_string_tab[55] +#define __pyx_n_u_E __pyx_string_tab[56] +#define __pyx_n_u_E_2 __pyx_string_tab[57] +#define __pyx_n_u_Ellipsis __pyx_string_tab[58] +#define __pyx_n_u_F __pyx_string_tab[59] +#define __pyx_n_u_H __pyx_string_tab[60] +#define __pyx_n_u_H_2 __pyx_string_tab[61] +#define __pyx_n_u_L __pyx_string_tab[62] +#define __pyx_n_u_L_2 __pyx_string_tab[63] +#define __pyx_n_u_Pyx_PyDict_NextRef __pyx_string_tab[64] +#define __pyx_n_u_R __pyx_string_tab[65] +#define __pyx_n_u_R_2 __pyx_string_tab[66] +#define __pyx_n_u_S __pyx_string_tab[67] +#define __pyx_n_u_S_2 __pyx_string_tab[68] +#define __pyx_n_u_Sequence __pyx_string_tab[69] +#define __pyx_n_u_StateClass __pyx_string_tab[70] +#define __pyx_n_u_StateClass_B __pyx_string_tab[71] +#define __pyx_n_u_StateClass_B_2 __pyx_string_tab[72] +#define __pyx_n_u_StateClass_E __pyx_string_tab[73] +#define __pyx_n_u_StateClass_E_2 __pyx_string_tab[74] +#define __pyx_n_u_StateClass_H __pyx_string_tab[75] +#define __pyx_n_u_StateClass_H_2 __pyx_string_tab[76] +#define __pyx_n_u_StateClass_L __pyx_string_tab[77] +#define __pyx_n_u_StateClass_L_2 __pyx_string_tab[78] +#define __pyx_n_u_StateClass_R __pyx_string_tab[79] +#define __pyx_n_u_StateClass_R_2 __pyx_string_tab[80] +#define __pyx_n_u_StateClass_S __pyx_string_tab[81] +#define __pyx_n_u_StateClass_S_2 __pyx_string_tab[82] +#define __pyx_n_u_StateClass___reduce_cython __pyx_string_tab[83] +#define __pyx_n_u_StateClass___setstate_cython __pyx_string_tab[84] +#define __pyx_n_u_StateClass_add_arc __pyx_string_tab[85] +#define __pyx_n_u_StateClass_at_break __pyx_string_tab[86] +#define __pyx_n_u_StateClass_buffer_length __pyx_string_tab[87] +#define __pyx_n_u_StateClass_clone __pyx_string_tab[88] +#define __pyx_n_u_StateClass_close_ent __pyx_string_tab[89] +#define __pyx_n_u_StateClass_copy __pyx_string_tab[90] +#define __pyx_n_u_StateClass_del_arc __pyx_string_tab[91] +#define __pyx_n_u_StateClass_empty __pyx_string_tab[92] +#define __pyx_n_u_StateClass_entity_is_open __pyx_string_tab[93] +#define __pyx_n_u_StateClass_eol __pyx_string_tab[94] +#define __pyx_n_u_StateClass_has_head __pyx_string_tab[95] +#define __pyx_n_u_StateClass_is_final __pyx_string_tab[96] +#define __pyx_n_u_StateClass_n_L __pyx_string_tab[97] +#define __pyx_n_u_StateClass_n_R __pyx_string_tab[98] +#define __pyx_n_u_StateClass_open_ent __pyx_string_tab[99] +#define __pyx_n_u_StateClass_pop __pyx_string_tab[100] +#define __pyx_n_u_StateClass_print_state __pyx_string_tab[101] +#define __pyx_n_u_StateClass_push __pyx_string_tab[102] +#define __pyx_n_u_StateClass_stack_depth __pyx_string_tab[103] +#define __pyx_n_u_StateClass_unshift __pyx_string_tab[104] +#define __pyx_n_u_T __pyx_string_tab[105] +#define __pyx_n_u_View_MemoryView __pyx_string_tab[106] +#define __pyx_n_u__6 __pyx_string_tab[107] +#define __pyx_n_u_abc __pyx_string_tab[108] +#define __pyx_n_u_add_arc __pyx_string_tab[109] +#define __pyx_n_u_allocate_buffer __pyx_string_tab[110] +#define __pyx_n_u_asyncio_coroutines __pyx_string_tab[111] +#define __pyx_n_u_at_break __pyx_string_tab[112] +#define __pyx_n_u_base __pyx_string_tab[113] +#define __pyx_n_u_bools __pyx_string_tab[114] +#define __pyx_n_u_buffer_length __pyx_string_tab[115] +#define __pyx_n_u_c __pyx_string_tab[116] +#define __pyx_n_u_child __pyx_string_tab[117] +#define __pyx_n_u_class __pyx_string_tab[118] +#define __pyx_n_u_class_getitem __pyx_string_tab[119] +#define __pyx_n_u_cline_in_traceback __pyx_string_tab[120] +#define __pyx_n_u_clone __pyx_string_tab[121] +#define __pyx_n_u_close_ent __pyx_string_tab[122] +#define __pyx_n_u_copy __pyx_string_tab[123] +#define __pyx_n_u_count __pyx_string_tab[124] +#define __pyx_n_u_del_arc __pyx_string_tab[125] +#define __pyx_n_u_dict __pyx_string_tab[126] +#define __pyx_n_u_doc __pyx_string_tab[127] +#define __pyx_n_u_dtype_is_object __pyx_string_tab[128] +#define __pyx_n_u_empty __pyx_string_tab[129] +#define __pyx_n_u_encode __pyx_string_tab[130] +#define __pyx_n_u_entity_is_open __pyx_string_tab[131] +#define __pyx_n_u_enumerate __pyx_string_tab[132] +#define __pyx_n_u_eol __pyx_string_tab[133] +#define __pyx_n_u_error __pyx_string_tab[134] +#define __pyx_n_u_flags __pyx_string_tab[135] +#define __pyx_n_u_format __pyx_string_tab[136] +#define __pyx_n_u_fortran __pyx_string_tab[137] +#define __pyx_n_u_func __pyx_string_tab[138] +#define __pyx_n_u_getstate __pyx_string_tab[139] +#define __pyx_n_u_has_head __pyx_string_tab[140] +#define __pyx_n_u_head __pyx_string_tab[141] +#define __pyx_n_u_i __pyx_string_tab[142] +#define __pyx_n_u_id __pyx_string_tab[143] +#define __pyx_n_u_idx __pyx_string_tab[144] +#define __pyx_n_u_import __pyx_string_tab[145] +#define __pyx_n_u_index __pyx_string_tab[146] +#define __pyx_n_u_is_coroutine __pyx_string_tab[147] +#define __pyx_n_u_is_final __pyx_string_tab[148] +#define __pyx_n_u_items __pyx_string_tab[149] +#define __pyx_n_u_itemsize __pyx_string_tab[150] +#define __pyx_n_u_label __pyx_string_tab[151] +#define __pyx_n_u_main __pyx_string_tab[152] +#define __pyx_n_u_memview __pyx_string_tab[153] +#define __pyx_n_u_mode __pyx_string_tab[154] +#define __pyx_n_u_module __pyx_string_tab[155] +#define __pyx_n_u_n0 __pyx_string_tab[156] +#define __pyx_n_u_n1 __pyx_string_tab[157] +#define __pyx_n_u_n_L __pyx_string_tab[158] +#define __pyx_n_u_n_R __pyx_string_tab[159] +#define __pyx_n_u_name __pyx_string_tab[160] +#define __pyx_n_u_name_2 __pyx_string_tab[161] +#define __pyx_n_u_ndim __pyx_string_tab[162] +#define __pyx_n_u_new __pyx_string_tab[163] +#define __pyx_n_u_new_state __pyx_string_tab[164] +#define __pyx_n_u_obj __pyx_string_tab[165] +#define __pyx_n_u_offset __pyx_string_tab[166] +#define __pyx_n_u_open_ent __pyx_string_tab[167] +#define __pyx_n_u_pack __pyx_string_tab[168] +#define __pyx_n_u_pop __pyx_string_tab[169] +#define __pyx_n_u_print_state __pyx_string_tab[170] +#define __pyx_n_u_push __pyx_string_tab[171] +#define __pyx_n_u_pyx_checksum __pyx_string_tab[172] +#define __pyx_n_u_pyx_state __pyx_string_tab[173] +#define __pyx_n_u_pyx_type __pyx_string_tab[174] +#define __pyx_n_u_pyx_unpickle_Enum __pyx_string_tab[175] +#define __pyx_n_u_pyx_vtable __pyx_string_tab[176] +#define __pyx_n_u_qualname __pyx_string_tab[177] +#define __pyx_n_u_reduce __pyx_string_tab[178] +#define __pyx_n_u_reduce_cython __pyx_string_tab[179] +#define __pyx_n_u_reduce_ex __pyx_string_tab[180] +#define __pyx_n_u_register __pyx_string_tab[181] +#define __pyx_n_u_second __pyx_string_tab[182] +#define __pyx_n_u_self __pyx_string_tab[183] +#define __pyx_n_u_sent_starts __pyx_string_tab[184] +#define __pyx_n_u_set_name __pyx_string_tab[185] +#define __pyx_n_u_setdefault __pyx_string_tab[186] +#define __pyx_n_u_setstate __pyx_string_tab[187] +#define __pyx_n_u_setstate_cython __pyx_string_tab[188] +#define __pyx_n_u_shape __pyx_string_tab[189] +#define __pyx_n_u_shifted __pyx_string_tab[190] +#define __pyx_n_u_size __pyx_string_tab[191] +#define __pyx_n_u_spacy_pipeline__parser_internals __pyx_string_tab[192] +#define __pyx_n_u_src __pyx_string_tab[193] +#define __pyx_n_u_stack_depth __pyx_string_tab[194] +#define __pyx_n_u_start __pyx_string_tab[195] +#define __pyx_n_u_step __pyx_string_tab[196] +#define __pyx_n_u_stop __pyx_string_tab[197] +#define __pyx_n_u_struct __pyx_string_tab[198] +#define __pyx_n_u_test __pyx_string_tab[199] +#define __pyx_n_u_text __pyx_string_tab[200] +#define __pyx_n_u_third __pyx_string_tab[201] +#define __pyx_n_u_token __pyx_string_tab[202] +#define __pyx_n_u_top __pyx_string_tab[203] +#define __pyx_n_u_unpack __pyx_string_tab[204] +#define __pyx_n_u_unshift __pyx_string_tab[205] +#define __pyx_n_u_update __pyx_string_tab[206] +#define __pyx_n_u_values __pyx_string_tab[207] +#define __pyx_n_u_words __pyx_string_tab[208] +#define __pyx_n_u_x __pyx_string_tab[209] +#define __pyx_kp_b_iso88591_A_Bd __pyx_string_tab[210] +#define __pyx_kp_b_iso88591_A_Be1 __pyx_string_tab[211] +#define __pyx_kp_b_iso88591_A_BfAS __pyx_string_tab[212] +#define __pyx_kp_b_iso88591_A_Bha __pyx_string_tab[213] +#define __pyx_kp_b_iso88591_A_BhavQ __pyx_string_tab[214] +#define __pyx_kp_b_iso88591_A_BhavWA __pyx_string_tab[215] +#define __pyx_kp_b_iso88591_A_Biq __pyx_string_tab[216] +#define __pyx_kp_b_iso88591_A_Bj __pyx_string_tab[217] +#define __pyx_kp_b_iso88591_A_Jat4vWD_6_a_q __pyx_string_tab[218] +#define __pyx_kp_b_iso88591_A_fD_Q_AWBaq_a_auAT_d_uAS_Q_5_Bo __pyx_string_tab[219] +#define __pyx_kp_b_iso88591_A_q __pyx_string_tab[220] +#define __pyx_kp_b_iso88591_A_t2 __pyx_string_tab[221] +#define __pyx_kp_b_iso88591_A_t2Rq __pyx_string_tab[222] +#define __pyx_kp_b_iso88591_A_t2Rq_1 __pyx_string_tab[223] +#define __pyx_kp_b_iso88591_A_t2Rq_a __pyx_string_tab[224] +#define __pyx_kp_b_iso88591_A_t2T __pyx_string_tab[225] +#define __pyx_kp_b_iso88591_A_t2T_2 __pyx_string_tab[226] +#define __pyx_kp_b_iso88591_A_t2V1 __pyx_string_tab[227] +#define __pyx_kp_b_iso88591_A_t2Ya __pyx_string_tab[228] +#define __pyx_kp_b_iso88591_A_t2Yaq __pyx_string_tab[229] +#define __pyx_kp_b_iso88591_A_t2_1 __pyx_string_tab[230] +#define __pyx_kp_b_iso88591_A_t2_A __pyx_string_tab[231] +#define __pyx_kp_b_iso88591_A_t4q_Bb __pyx_string_tab[232] +#define __pyx_kp_b_iso88591_A_t4q_Bb_A __pyx_string_tab[233] +#define __pyx_kp_b_iso88591_Q __pyx_string_tab[234] +#define __pyx_kp_b_pyx_t_5spacy_8typedefs_attr_t __pyx_string_tab[235] +#define __pyx_kp_b_struct___pyx_t_5spacy_7structs_L __pyx_string_tab[236] +#define __pyx_kp_b_uint64_t_void_int_uint64_t_hash6 __pyx_string_tab[237] +#define __pyx_n_b_O __pyx_string_tab[238] +#define __pyx_int_0 __pyx_number_tab[0] +#define __pyx_int_neg_1 __pyx_number_tab[1] +#define __pyx_int_1 __pyx_number_tab[2] +#define __pyx_int_2 __pyx_number_tab[3] +#define __pyx_int_136983863 __pyx_number_tab[4] +/* #### 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_5cymem_5cymem_PyMalloc); + Py_CLEAR(clear_module_state->__pyx_ptype_5cymem_5cymem_PyFree); + Py_CLEAR(clear_module_state->__pyx_ptype_5cymem_5cymem_Pool); + Py_CLEAR(clear_module_state->__pyx_ptype_5cymem_5cymem_Address); + Py_CLEAR(clear_module_state->__pyx_ptype_7cpython_4type_type); + Py_CLEAR(clear_module_state->__pyx_ptype_5numpy_dtype); + Py_CLEAR(clear_module_state->__pyx_ptype_5numpy_flatiter); + Py_CLEAR(clear_module_state->__pyx_ptype_5numpy_broadcast); + Py_CLEAR(clear_module_state->__pyx_ptype_5numpy_ndarray); + Py_CLEAR(clear_module_state->__pyx_ptype_5numpy_generic); + Py_CLEAR(clear_module_state->__pyx_ptype_5numpy_number); + Py_CLEAR(clear_module_state->__pyx_ptype_5numpy_integer); + Py_CLEAR(clear_module_state->__pyx_ptype_5numpy_signedinteger); + Py_CLEAR(clear_module_state->__pyx_ptype_5numpy_unsignedinteger); + Py_CLEAR(clear_module_state->__pyx_ptype_5numpy_inexact); + Py_CLEAR(clear_module_state->__pyx_ptype_5numpy_floating); + Py_CLEAR(clear_module_state->__pyx_ptype_5numpy_complexfloating); + Py_CLEAR(clear_module_state->__pyx_ptype_5numpy_flexible); + Py_CLEAR(clear_module_state->__pyx_ptype_5numpy_character); + Py_CLEAR(clear_module_state->__pyx_ptype_5numpy_ufunc); + Py_CLEAR(clear_module_state->__pyx_ptype_7preshed_4maps_PreshMap); + Py_CLEAR(clear_module_state->__pyx_ptype_7preshed_4maps_PreshMapArray); + Py_CLEAR(clear_module_state->__pyx_ptype_5spacy_7strings_StringStore); + Py_CLEAR(clear_module_state->__pyx_ptype_5spacy_10morphology_Morphology); + Py_CLEAR(clear_module_state->__pyx_ptype_5spacy_5vocab_Vocab); + Py_CLEAR(clear_module_state->__pyx_ptype_5spacy_6tokens_3doc_Doc); + Py_CLEAR(clear_module_state->__pyx_ptype_5spacy_6lexeme_Lexeme); + Py_CLEAR(clear_module_state->__pyx_ptype_5spacy_8pipeline_17_parser_internals_10stateclass_StateClass); + Py_CLEAR(clear_module_state->__pyx_type_5spacy_8pipeline_17_parser_internals_10stateclass_StateClass); + Py_CLEAR(clear_module_state->__pyx_array_type); + Py_CLEAR(clear_module_state->__pyx_type___pyx_array); + Py_CLEAR(clear_module_state->__pyx_MemviewEnum_type); + Py_CLEAR(clear_module_state->__pyx_type___pyx_MemviewEnum); + Py_CLEAR(clear_module_state->__pyx_memoryview_type); + Py_CLEAR(clear_module_state->__pyx_type___pyx_memoryview); + Py_CLEAR(clear_module_state->__pyx_memoryviewslice_type); + Py_CLEAR(clear_module_state->__pyx_type___pyx_memoryviewslice); + for (int i=0; i<1; ++i) { Py_CLEAR(clear_module_state->__pyx_slice[i]); } + for (int i=0; i<5; ++i) { Py_CLEAR(clear_module_state->__pyx_tuple[i]); } + for (int i=0; i<39; ++i) { Py_CLEAR(clear_module_state->__pyx_codeobj_tab[i]); } + for (int i=0; i<239; ++i) { Py_CLEAR(clear_module_state->__pyx_string_tab[i]); } + for (int i=0; i<5; ++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_5cymem_5cymem_PyMalloc); + Py_VISIT(traverse_module_state->__pyx_ptype_5cymem_5cymem_PyFree); + Py_VISIT(traverse_module_state->__pyx_ptype_5cymem_5cymem_Pool); + Py_VISIT(traverse_module_state->__pyx_ptype_5cymem_5cymem_Address); + Py_VISIT(traverse_module_state->__pyx_ptype_7cpython_4type_type); + Py_VISIT(traverse_module_state->__pyx_ptype_5numpy_dtype); + Py_VISIT(traverse_module_state->__pyx_ptype_5numpy_flatiter); + Py_VISIT(traverse_module_state->__pyx_ptype_5numpy_broadcast); + Py_VISIT(traverse_module_state->__pyx_ptype_5numpy_ndarray); + Py_VISIT(traverse_module_state->__pyx_ptype_5numpy_generic); + Py_VISIT(traverse_module_state->__pyx_ptype_5numpy_number); + Py_VISIT(traverse_module_state->__pyx_ptype_5numpy_integer); + Py_VISIT(traverse_module_state->__pyx_ptype_5numpy_signedinteger); + Py_VISIT(traverse_module_state->__pyx_ptype_5numpy_unsignedinteger); + Py_VISIT(traverse_module_state->__pyx_ptype_5numpy_inexact); + Py_VISIT(traverse_module_state->__pyx_ptype_5numpy_floating); + Py_VISIT(traverse_module_state->__pyx_ptype_5numpy_complexfloating); + Py_VISIT(traverse_module_state->__pyx_ptype_5numpy_flexible); + Py_VISIT(traverse_module_state->__pyx_ptype_5numpy_character); + Py_VISIT(traverse_module_state->__pyx_ptype_5numpy_ufunc); + Py_VISIT(traverse_module_state->__pyx_ptype_7preshed_4maps_PreshMap); + Py_VISIT(traverse_module_state->__pyx_ptype_7preshed_4maps_PreshMapArray); + Py_VISIT(traverse_module_state->__pyx_ptype_5spacy_7strings_StringStore); + Py_VISIT(traverse_module_state->__pyx_ptype_5spacy_10morphology_Morphology); + Py_VISIT(traverse_module_state->__pyx_ptype_5spacy_5vocab_Vocab); + Py_VISIT(traverse_module_state->__pyx_ptype_5spacy_6tokens_3doc_Doc); + Py_VISIT(traverse_module_state->__pyx_ptype_5spacy_6lexeme_Lexeme); + Py_VISIT(traverse_module_state->__pyx_ptype_5spacy_8pipeline_17_parser_internals_10stateclass_StateClass); + Py_VISIT(traverse_module_state->__pyx_type_5spacy_8pipeline_17_parser_internals_10stateclass_StateClass); + Py_VISIT(traverse_module_state->__pyx_array_type); + Py_VISIT(traverse_module_state->__pyx_type___pyx_array); + Py_VISIT(traverse_module_state->__pyx_MemviewEnum_type); + Py_VISIT(traverse_module_state->__pyx_type___pyx_MemviewEnum); + Py_VISIT(traverse_module_state->__pyx_memoryview_type); + Py_VISIT(traverse_module_state->__pyx_type___pyx_memoryview); + Py_VISIT(traverse_module_state->__pyx_memoryviewslice_type); + Py_VISIT(traverse_module_state->__pyx_type___pyx_memoryviewslice); + for (int i=0; i<1; ++i) { __Pyx_VISIT_CONST(traverse_module_state->__pyx_slice[i]); } + for (int i=0; i<5; ++i) { __Pyx_VISIT_CONST(traverse_module_state->__pyx_tuple[i]); } + for (int i=0; i<39; ++i) { __Pyx_VISIT_CONST(traverse_module_state->__pyx_codeobj_tab[i]); } + for (int i=0; i<239; ++i) { __Pyx_VISIT_CONST(traverse_module_state->__pyx_string_tab[i]); } + for (int i=0; i<5; ++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 ### */ + +/* "vector.to_py":79 + * const Py_ssize_t PY_SSIZE_T_MAX + * + * @cname("__pyx_convert_vector_to_py_struct____pyx_t_5spacy_8pipeline_17_parser_internals_6_state_ArcC") # <<<<<<<<<<<<<< + * cdef object __pyx_convert_vector_to_py_struct____pyx_t_5spacy_8pipeline_17_parser_internals_6_state_ArcC(const vector[X]& v): + * if v.size() > PY_SSIZE_T_MAX: +*/ + +static PyObject *__pyx_convert_vector_to_py_struct____pyx_t_5spacy_8pipeline_17_parser_internals_6_state_ArcC(std::vector const &__pyx_v_v) { + Py_ssize_t __pyx_v_v_size_signed; + PyObject *__pyx_v_o = NULL; + Py_ssize_t __pyx_v_i; + PyObject *__pyx_v_item = 0; + PyObject *__pyx_r = NULL; + __Pyx_RefNannyDeclarations + int __pyx_t_1; + PyObject *__pyx_t_2 = NULL; + Py_ssize_t __pyx_t_3; + Py_ssize_t __pyx_t_4; + Py_ssize_t __pyx_t_5; + int __pyx_t_6; + int __pyx_lineno = 0; + const char *__pyx_filename = NULL; + int __pyx_clineno = 0; + __Pyx_RefNannySetupContext("__pyx_convert_vector_to_py_struct____pyx_t_5spacy_8pipeline_17_parser_internals_6_state_ArcC", 0); + + /* "vector.to_py":81 + * @cname("__pyx_convert_vector_to_py_struct____pyx_t_5spacy_8pipeline_17_parser_internals_6_state_ArcC") + * cdef object __pyx_convert_vector_to_py_struct____pyx_t_5spacy_8pipeline_17_parser_internals_6_state_ArcC(const vector[X]& v): + * if v.size() > PY_SSIZE_T_MAX: # <<<<<<<<<<<<<< + * raise MemoryError() + * v_size_signed = v.size() +*/ + __pyx_t_1 = (__pyx_v_v.size() > ((size_t)PY_SSIZE_T_MAX)); + if (unlikely(__pyx_t_1)) { + + /* "vector.to_py":82 + * cdef object __pyx_convert_vector_to_py_struct____pyx_t_5spacy_8pipeline_17_parser_internals_6_state_ArcC(const vector[X]& v): + * if v.size() > PY_SSIZE_T_MAX: + * raise MemoryError() # <<<<<<<<<<<<<< + * v_size_signed = v.size() + * +*/ + PyErr_NoMemory(); __PYX_ERR(1, 82, __pyx_L1_error) + + /* "vector.to_py":81 + * @cname("__pyx_convert_vector_to_py_struct____pyx_t_5spacy_8pipeline_17_parser_internals_6_state_ArcC") + * cdef object __pyx_convert_vector_to_py_struct____pyx_t_5spacy_8pipeline_17_parser_internals_6_state_ArcC(const vector[X]& v): + * if v.size() > PY_SSIZE_T_MAX: # <<<<<<<<<<<<<< + * raise MemoryError() + * v_size_signed = v.size() +*/ + } + + /* "vector.to_py":83 + * if v.size() > PY_SSIZE_T_MAX: + * raise MemoryError() + * v_size_signed = v.size() # <<<<<<<<<<<<<< + * + * o = PyList_New(v_size_signed) +*/ + __pyx_v_v_size_signed = ((Py_ssize_t)__pyx_v_v.size()); + + /* "vector.to_py":85 + * v_size_signed = v.size() + * + * o = PyList_New(v_size_signed) # <<<<<<<<<<<<<< + * + * cdef Py_ssize_t i +*/ + __pyx_t_2 = PyList_New(__pyx_v_v_size_signed); if (unlikely(!__pyx_t_2)) __PYX_ERR(1, 85, __pyx_L1_error) + __Pyx_GOTREF(__pyx_t_2); + __pyx_v_o = ((PyObject*)__pyx_t_2); + __pyx_t_2 = 0; + + /* "vector.to_py":90 + * cdef object item + * + * for i in range(v_size_signed): # <<<<<<<<<<<<<< + * item = v[i] + * Py_INCREF(item) +*/ + __pyx_t_3 = __pyx_v_v_size_signed; + __pyx_t_4 = __pyx_t_3; + for (__pyx_t_5 = 0; __pyx_t_5 < __pyx_t_4; __pyx_t_5+=1) { + __pyx_v_i = __pyx_t_5; + + /* "vector.to_py":91 + * + * for i in range(v_size_signed): + * item = v[i] # <<<<<<<<<<<<<< + * Py_INCREF(item) + * __Pyx_PyList_SET_ITEM(o, i, item) +*/ + __pyx_t_2 = __pyx_convert__to_py_struct____pyx_t_5spacy_8pipeline_17_parser_internals_6_state_ArcC((__pyx_v_v[__pyx_v_i])); if (unlikely(!__pyx_t_2)) __PYX_ERR(1, 91, __pyx_L1_error) + __Pyx_GOTREF(__pyx_t_2); + __Pyx_XDECREF_SET(__pyx_v_item, __pyx_t_2); + __pyx_t_2 = 0; + + /* "vector.to_py":92 + * for i in range(v_size_signed): + * item = v[i] + * Py_INCREF(item) # <<<<<<<<<<<<<< + * __Pyx_PyList_SET_ITEM(o, i, item) + * +*/ + Py_INCREF(__pyx_v_item); + + /* "vector.to_py":93 + * item = v[i] + * Py_INCREF(item) + * __Pyx_PyList_SET_ITEM(o, i, item) # <<<<<<<<<<<<<< + * + * return o +*/ + __pyx_t_6 = __Pyx_PyList_SET_ITEM(__pyx_v_o, __pyx_v_i, __pyx_v_item); if (unlikely(__pyx_t_6 == ((int)-1))) __PYX_ERR(1, 93, __pyx_L1_error) + } + + /* "vector.to_py":95 + * __Pyx_PyList_SET_ITEM(o, i, item) + * + * return o # <<<<<<<<<<<<<< +*/ + __Pyx_XDECREF(__pyx_r); + __Pyx_INCREF(__pyx_v_o); + __pyx_r = __pyx_v_o; + goto __pyx_L0; + + /* "vector.to_py":79 + * const Py_ssize_t PY_SSIZE_T_MAX + * + * @cname("__pyx_convert_vector_to_py_struct____pyx_t_5spacy_8pipeline_17_parser_internals_6_state_ArcC") # <<<<<<<<<<<<<< + * cdef object __pyx_convert_vector_to_py_struct____pyx_t_5spacy_8pipeline_17_parser_internals_6_state_ArcC(const vector[X]& v): + * if v.size() > PY_SSIZE_T_MAX: +*/ + + /* function exit code */ + __pyx_L1_error:; + __Pyx_XDECREF(__pyx_t_2); + __Pyx_AddTraceback("vector.to_py.__pyx_convert_vector_to_py_struct____pyx_t_5spacy_8pipeline_17_parser_internals_6_state_ArcC", __pyx_clineno, __pyx_lineno, __pyx_filename); + __pyx_r = 0; + __pyx_L0:; + __Pyx_XDECREF(__pyx_v_o); + __Pyx_XDECREF(__pyx_v_item); + __Pyx_XGIVEREF(__pyx_r); + __Pyx_RefNannyFinishContext(); + return __pyx_r; +} + +/* "View.MemoryView":129 + * cdef bint dtype_is_object + * + * def __cinit__(array self, tuple shape, Py_ssize_t itemsize, format not None, # <<<<<<<<<<<<<< + * mode="c", bint allocate_buffer=True): + * +*/ + +/* Python wrapper */ +static int __pyx_array___cinit__(PyObject *__pyx_v_self, PyObject *__pyx_args, PyObject *__pyx_kwds); /*proto*/ +static int __pyx_array___cinit__(PyObject *__pyx_v_self, PyObject *__pyx_args, PyObject *__pyx_kwds) { + PyObject *__pyx_v_shape = 0; + Py_ssize_t __pyx_v_itemsize; + PyObject *__pyx_v_format = 0; + PyObject *__pyx_v_mode = 0; + int __pyx_v_allocate_buffer; + CYTHON_UNUSED Py_ssize_t __pyx_nargs; + CYTHON_UNUSED PyObject *const *__pyx_kwvalues; + PyObject* values[5] = {0,0,0,0,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_shape,&__pyx_mstate_global->__pyx_n_u_itemsize,&__pyx_mstate_global->__pyx_n_u_format,&__pyx_mstate_global->__pyx_n_u_mode,&__pyx_mstate_global->__pyx_n_u_allocate_buffer,0}; + const Py_ssize_t __pyx_kwds_len = (__pyx_kwds) ? __Pyx_NumKwargs_VARARGS(__pyx_kwds) : 0; + if (unlikely(__pyx_kwds_len) < 0) __PYX_ERR(1, 129, __pyx_L3_error) + if (__pyx_kwds_len > 0) { + switch (__pyx_nargs) { + case 5: + values[4] = __Pyx_ArgRef_VARARGS(__pyx_args, 4); + if (!CYTHON_ASSUME_SAFE_MACROS && unlikely(!values[4])) __PYX_ERR(1, 129, __pyx_L3_error) + CYTHON_FALLTHROUGH; + case 4: + values[3] = __Pyx_ArgRef_VARARGS(__pyx_args, 3); + if (!CYTHON_ASSUME_SAFE_MACROS && unlikely(!values[3])) __PYX_ERR(1, 129, __pyx_L3_error) + CYTHON_FALLTHROUGH; + case 3: + values[2] = __Pyx_ArgRef_VARARGS(__pyx_args, 2); + if (!CYTHON_ASSUME_SAFE_MACROS && unlikely(!values[2])) __PYX_ERR(1, 129, __pyx_L3_error) + CYTHON_FALLTHROUGH; + case 2: + values[1] = __Pyx_ArgRef_VARARGS(__pyx_args, 1); + if (!CYTHON_ASSUME_SAFE_MACROS && unlikely(!values[1])) __PYX_ERR(1, 129, __pyx_L3_error) + CYTHON_FALLTHROUGH; + case 1: + values[0] = __Pyx_ArgRef_VARARGS(__pyx_args, 0); + if (!CYTHON_ASSUME_SAFE_MACROS && unlikely(!values[0])) __PYX_ERR(1, 129, __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(1, 129, __pyx_L3_error) + if (!values[3]) values[3] = __Pyx_NewRef(((PyObject *)__pyx_mstate_global->__pyx_n_u_c)); + for (Py_ssize_t i = __pyx_nargs; i < 3; i++) { + if (unlikely(!values[i])) { __Pyx_RaiseArgtupleInvalid("__cinit__", 0, 3, 5, i); __PYX_ERR(1, 129, __pyx_L3_error) } + } + } else { + switch (__pyx_nargs) { + case 5: + values[4] = __Pyx_ArgRef_VARARGS(__pyx_args, 4); + if (!CYTHON_ASSUME_SAFE_MACROS && unlikely(!values[4])) __PYX_ERR(1, 129, __pyx_L3_error) + CYTHON_FALLTHROUGH; + case 4: + values[3] = __Pyx_ArgRef_VARARGS(__pyx_args, 3); + if (!CYTHON_ASSUME_SAFE_MACROS && unlikely(!values[3])) __PYX_ERR(1, 129, __pyx_L3_error) + CYTHON_FALLTHROUGH; + case 3: + values[2] = __Pyx_ArgRef_VARARGS(__pyx_args, 2); + if (!CYTHON_ASSUME_SAFE_MACROS && unlikely(!values[2])) __PYX_ERR(1, 129, __pyx_L3_error) + values[1] = __Pyx_ArgRef_VARARGS(__pyx_args, 1); + if (!CYTHON_ASSUME_SAFE_MACROS && unlikely(!values[1])) __PYX_ERR(1, 129, __pyx_L3_error) + values[0] = __Pyx_ArgRef_VARARGS(__pyx_args, 0); + if (!CYTHON_ASSUME_SAFE_MACROS && unlikely(!values[0])) __PYX_ERR(1, 129, __pyx_L3_error) + break; + default: goto __pyx_L5_argtuple_error; + } + if (!values[3]) values[3] = __Pyx_NewRef(((PyObject *)__pyx_mstate_global->__pyx_n_u_c)); + } + __pyx_v_shape = ((PyObject*)values[0]); + __pyx_v_itemsize = __Pyx_PyIndex_AsSsize_t(values[1]); if (unlikely((__pyx_v_itemsize == (Py_ssize_t)-1) && PyErr_Occurred())) __PYX_ERR(1, 129, __pyx_L3_error) + __pyx_v_format = values[2]; + __pyx_v_mode = values[3]; + if (values[4]) { + __pyx_v_allocate_buffer = __Pyx_PyObject_IsTrue(values[4]); if (unlikely((__pyx_v_allocate_buffer == (int)-1) && PyErr_Occurred())) __PYX_ERR(1, 130, __pyx_L3_error) + } else { + + /* "View.MemoryView":130 + * + * def __cinit__(array self, tuple shape, Py_ssize_t itemsize, format not None, + * mode="c", bint allocate_buffer=True): # <<<<<<<<<<<<<< + * + * cdef int idx +*/ + __pyx_v_allocate_buffer = ((int)1); + } + } + goto __pyx_L6_skip; + __pyx_L5_argtuple_error:; + __Pyx_RaiseArgtupleInvalid("__cinit__", 0, 3, 5, __pyx_nargs); __PYX_ERR(1, 129, __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("View.MemoryView.array.__cinit__", __pyx_clineno, __pyx_lineno, __pyx_filename); + __Pyx_RefNannyFinishContext(); + return -1; + __pyx_L4_argument_unpacking_done:; + if (unlikely(!__Pyx_ArgTypeTest(((PyObject *)__pyx_v_shape), (&PyTuple_Type), 1, "shape", 1))) __PYX_ERR(1, 129, __pyx_L1_error) + if (unlikely(((PyObject *)__pyx_v_format) == Py_None)) { + PyErr_Format(PyExc_TypeError, "Argument '%.200s' must not be None", "format"); __PYX_ERR(1, 129, __pyx_L1_error) + } + __pyx_r = __pyx_array___pyx_pf_15View_dot_MemoryView_5array___cinit__(((struct __pyx_array_obj *)__pyx_v_self), __pyx_v_shape, __pyx_v_itemsize, __pyx_v_format, __pyx_v_mode, __pyx_v_allocate_buffer); + + /* "View.MemoryView":129 + * cdef bint dtype_is_object + * + * def __cinit__(array self, tuple shape, Py_ssize_t itemsize, format not None, # <<<<<<<<<<<<<< + * mode="c", bint allocate_buffer=True): + * +*/ + + /* 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_array___pyx_pf_15View_dot_MemoryView_5array___cinit__(struct __pyx_array_obj *__pyx_v_self, PyObject *__pyx_v_shape, Py_ssize_t __pyx_v_itemsize, PyObject *__pyx_v_format, PyObject *__pyx_v_mode, int __pyx_v_allocate_buffer) { + int __pyx_v_idx; + Py_ssize_t __pyx_v_dim; + char __pyx_v_order; + int __pyx_r; + __Pyx_RefNannyDeclarations + Py_ssize_t __pyx_t_1; + int __pyx_t_2; + int __pyx_t_3; + PyObject *__pyx_t_4 = NULL; + PyObject *__pyx_t_5 = NULL; + size_t __pyx_t_6; + char *__pyx_t_7; + int __pyx_t_8; + Py_ssize_t __pyx_t_9; + PyObject *__pyx_t_10 = NULL; + PyObject *__pyx_t_11[5]; + PyObject *__pyx_t_12 = NULL; + int __pyx_lineno = 0; + const char *__pyx_filename = NULL; + int __pyx_clineno = 0; + __Pyx_RefNannySetupContext("__cinit__", 0); + __Pyx_INCREF(__pyx_v_format); + + /* "View.MemoryView":135 + * cdef Py_ssize_t dim + * + * self.ndim = len(shape) # <<<<<<<<<<<<<< + * self.itemsize = itemsize + * +*/ + if (unlikely(__pyx_v_shape == Py_None)) { + PyErr_SetString(PyExc_TypeError, "object of type 'NoneType' has no len()"); + __PYX_ERR(1, 135, __pyx_L1_error) + } + __pyx_t_1 = __Pyx_PyTuple_GET_SIZE(__pyx_v_shape); if (unlikely(__pyx_t_1 == ((Py_ssize_t)-1))) __PYX_ERR(1, 135, __pyx_L1_error) + __pyx_v_self->ndim = ((int)__pyx_t_1); + + /* "View.MemoryView":136 + * + * self.ndim = len(shape) + * self.itemsize = itemsize # <<<<<<<<<<<<<< + * + * if not self.ndim: +*/ + __pyx_v_self->itemsize = __pyx_v_itemsize; + + /* "View.MemoryView":138 + * self.itemsize = itemsize + * + * if not self.ndim: # <<<<<<<<<<<<<< + * raise ValueError, "Empty shape tuple for cython.array" + * +*/ + __pyx_t_2 = (!(__pyx_v_self->ndim != 0)); + if (unlikely(__pyx_t_2)) { + + /* "View.MemoryView":139 + * + * if not self.ndim: + * raise ValueError, "Empty shape tuple for cython.array" # <<<<<<<<<<<<<< + * + * if itemsize <= 0: +*/ + __Pyx_Raise(((PyObject *)(((PyTypeObject*)PyExc_ValueError))), __pyx_mstate_global->__pyx_kp_u_Empty_shape_tuple_for_cython_arr, 0, 0); + __PYX_ERR(1, 139, __pyx_L1_error) + + /* "View.MemoryView":138 + * self.itemsize = itemsize + * + * if not self.ndim: # <<<<<<<<<<<<<< + * raise ValueError, "Empty shape tuple for cython.array" + * +*/ + } + + /* "View.MemoryView":141 + * raise ValueError, "Empty shape tuple for cython.array" + * + * if itemsize <= 0: # <<<<<<<<<<<<<< + * raise ValueError, "itemsize <= 0 for cython.array" + * +*/ + __pyx_t_2 = (__pyx_v_itemsize <= 0); + if (unlikely(__pyx_t_2)) { + + /* "View.MemoryView":142 + * + * if itemsize <= 0: + * raise ValueError, "itemsize <= 0 for cython.array" # <<<<<<<<<<<<<< + * + * if not isinstance(format, bytes): +*/ + __Pyx_Raise(((PyObject *)(((PyTypeObject*)PyExc_ValueError))), __pyx_mstate_global->__pyx_kp_u_itemsize_0_for_cython_array, 0, 0); + __PYX_ERR(1, 142, __pyx_L1_error) + + /* "View.MemoryView":141 + * raise ValueError, "Empty shape tuple for cython.array" + * + * if itemsize <= 0: # <<<<<<<<<<<<<< + * raise ValueError, "itemsize <= 0 for cython.array" + * +*/ + } + + /* "View.MemoryView":144 + * raise ValueError, "itemsize <= 0 for cython.array" + * + * if not isinstance(format, bytes): # <<<<<<<<<<<<<< + * format = format.encode('ASCII') + * self._format = format # keep a reference to the byte string +*/ + __pyx_t_2 = PyBytes_Check(__pyx_v_format); + __pyx_t_3 = (!__pyx_t_2); + if (__pyx_t_3) { + + /* "View.MemoryView":145 + * + * if not isinstance(format, bytes): + * format = format.encode('ASCII') # <<<<<<<<<<<<<< + * self._format = format # keep a reference to the byte string + * self.format = self._format +*/ + __pyx_t_5 = __pyx_v_format; + __Pyx_INCREF(__pyx_t_5); + __pyx_t_6 = 0; + { + PyObject *__pyx_callargs[2] = {__pyx_t_5, __pyx_mstate_global->__pyx_n_u_ASCII}; + __pyx_t_4 = __Pyx_PyObject_FastCallMethod((PyObject*)__pyx_mstate_global->__pyx_n_u_encode, __pyx_callargs+__pyx_t_6, (2-__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(1, 145, __pyx_L1_error) + __Pyx_GOTREF(__pyx_t_4); + } + __Pyx_DECREF_SET(__pyx_v_format, __pyx_t_4); + __pyx_t_4 = 0; + + /* "View.MemoryView":144 + * raise ValueError, "itemsize <= 0 for cython.array" + * + * if not isinstance(format, bytes): # <<<<<<<<<<<<<< + * format = format.encode('ASCII') + * self._format = format # keep a reference to the byte string +*/ + } + + /* "View.MemoryView":146 + * if not isinstance(format, bytes): + * format = format.encode('ASCII') + * self._format = format # keep a reference to the byte string # <<<<<<<<<<<<<< + * self.format = self._format + * +*/ + __pyx_t_4 = __pyx_v_format; + __Pyx_INCREF(__pyx_t_4); + if (!(likely(PyBytes_CheckExact(__pyx_t_4))||((__pyx_t_4) == Py_None) || __Pyx_RaiseUnexpectedTypeError("bytes", __pyx_t_4))) __PYX_ERR(1, 146, __pyx_L1_error) + __Pyx_GIVEREF(__pyx_t_4); + __Pyx_GOTREF(__pyx_v_self->_format); + __Pyx_DECREF(__pyx_v_self->_format); + __pyx_v_self->_format = ((PyObject*)__pyx_t_4); + __pyx_t_4 = 0; + + /* "View.MemoryView":147 + * format = format.encode('ASCII') + * self._format = format # keep a reference to the byte string + * self.format = self._format # <<<<<<<<<<<<<< + * + * +*/ + if (unlikely(__pyx_v_self->_format == Py_None)) { + PyErr_SetString(PyExc_TypeError, "expected bytes, NoneType found"); + __PYX_ERR(1, 147, __pyx_L1_error) + } + __pyx_t_7 = __Pyx_PyBytes_AsWritableString(__pyx_v_self->_format); if (unlikely((!__pyx_t_7) && PyErr_Occurred())) __PYX_ERR(1, 147, __pyx_L1_error) + __pyx_v_self->format = __pyx_t_7; + + /* "View.MemoryView":150 + * + * + * self._shape = PyObject_Malloc(sizeof(Py_ssize_t)*self.ndim*2) # <<<<<<<<<<<<<< + * self._strides = self._shape + self.ndim + * +*/ + __pyx_v_self->_shape = ((Py_ssize_t *)PyObject_Malloc((((sizeof(Py_ssize_t)) * __pyx_v_self->ndim) * 2))); + + /* "View.MemoryView":151 + * + * self._shape = PyObject_Malloc(sizeof(Py_ssize_t)*self.ndim*2) + * self._strides = self._shape + self.ndim # <<<<<<<<<<<<<< + * + * if not self._shape: +*/ + __pyx_v_self->_strides = (__pyx_v_self->_shape + __pyx_v_self->ndim); + + /* "View.MemoryView":153 + * self._strides = self._shape + self.ndim + * + * if not self._shape: # <<<<<<<<<<<<<< + * raise MemoryError, "unable to allocate shape and strides." + * +*/ + __pyx_t_3 = (!(__pyx_v_self->_shape != 0)); + if (unlikely(__pyx_t_3)) { + + /* "View.MemoryView":154 + * + * if not self._shape: + * raise MemoryError, "unable to allocate shape and strides." # <<<<<<<<<<<<<< + * + * +*/ + __Pyx_Raise(((PyObject *)(((PyTypeObject*)PyExc_MemoryError))), __pyx_mstate_global->__pyx_kp_u_unable_to_allocate_shape_and_str, 0, 0); + __PYX_ERR(1, 154, __pyx_L1_error) + + /* "View.MemoryView":153 + * self._strides = self._shape + self.ndim + * + * if not self._shape: # <<<<<<<<<<<<<< + * raise MemoryError, "unable to allocate shape and strides." + * +*/ + } + + /* "View.MemoryView":157 + * + * + * for idx, dim in enumerate(shape): # <<<<<<<<<<<<<< + * if dim <= 0: + * raise ValueError, f"Invalid shape in axis {idx}: {dim}." +*/ + __pyx_t_8 = 0; + __pyx_t_4 = __pyx_v_shape; __Pyx_INCREF(__pyx_t_4); + __pyx_t_1 = 0; + for (;;) { + { + Py_ssize_t __pyx_temp = __Pyx_PyTuple_GET_SIZE(__pyx_t_4); + #if !CYTHON_ASSUME_SAFE_SIZE + if (unlikely((__pyx_temp < 0))) __PYX_ERR(1, 157, __pyx_L1_error) + #endif + if (__pyx_t_1 >= __pyx_temp) break; + } + #if CYTHON_ASSUME_SAFE_MACROS && !CYTHON_AVOID_BORROWED_REFS + __pyx_t_5 = __Pyx_NewRef(PyTuple_GET_ITEM(__pyx_t_4, __pyx_t_1)); + #else + __pyx_t_5 = __Pyx_PySequence_ITEM(__pyx_t_4, __pyx_t_1); + #endif + ++__pyx_t_1; + if (unlikely(!__pyx_t_5)) __PYX_ERR(1, 157, __pyx_L1_error) + __Pyx_GOTREF(__pyx_t_5); + __pyx_t_9 = __Pyx_PyIndex_AsSsize_t(__pyx_t_5); if (unlikely((__pyx_t_9 == (Py_ssize_t)-1) && PyErr_Occurred())) __PYX_ERR(1, 157, __pyx_L1_error) + __Pyx_DECREF(__pyx_t_5); __pyx_t_5 = 0; + __pyx_v_dim = __pyx_t_9; + __pyx_v_idx = __pyx_t_8; + __pyx_t_8 = (__pyx_t_8 + 1); + + /* "View.MemoryView":158 + * + * for idx, dim in enumerate(shape): + * if dim <= 0: # <<<<<<<<<<<<<< + * raise ValueError, f"Invalid shape in axis {idx}: {dim}." + * self._shape[idx] = dim +*/ + __pyx_t_3 = (__pyx_v_dim <= 0); + if (unlikely(__pyx_t_3)) { + + /* "View.MemoryView":159 + * for idx, dim in enumerate(shape): + * if dim <= 0: + * raise ValueError, f"Invalid shape in axis {idx}: {dim}." # <<<<<<<<<<<<<< + * self._shape[idx] = dim + * +*/ + __pyx_t_5 = __Pyx_PyUnicode_From_int(__pyx_v_idx, 0, ' ', 'd'); if (unlikely(!__pyx_t_5)) __PYX_ERR(1, 159, __pyx_L1_error) + __Pyx_GOTREF(__pyx_t_5); + __pyx_t_10 = __Pyx_PyUnicode_From_Py_ssize_t(__pyx_v_dim, 0, ' ', 'd'); if (unlikely(!__pyx_t_10)) __PYX_ERR(1, 159, __pyx_L1_error) + __Pyx_GOTREF(__pyx_t_10); + __pyx_t_11[0] = __pyx_mstate_global->__pyx_kp_u_Invalid_shape_in_axis; + __pyx_t_11[1] = __pyx_t_5; + __pyx_t_11[2] = __pyx_mstate_global->__pyx_kp_u_; + __pyx_t_11[3] = __pyx_t_10; + __pyx_t_11[4] = __pyx_mstate_global->__pyx_kp_u__2; + __pyx_t_12 = __Pyx_PyUnicode_Join(__pyx_t_11, 5, 22 + __Pyx_PyUnicode_GET_LENGTH(__pyx_t_5) + 2 + __Pyx_PyUnicode_GET_LENGTH(__pyx_t_10) + 1, 127); + if (unlikely(!__pyx_t_12)) __PYX_ERR(1, 159, __pyx_L1_error) + __Pyx_GOTREF(__pyx_t_12); + __Pyx_DECREF(__pyx_t_5); __pyx_t_5 = 0; + __Pyx_DECREF(__pyx_t_10); __pyx_t_10 = 0; + __Pyx_Raise(((PyObject *)(((PyTypeObject*)PyExc_ValueError))), __pyx_t_12, 0, 0); + __Pyx_DECREF(__pyx_t_12); __pyx_t_12 = 0; + __PYX_ERR(1, 159, __pyx_L1_error) + + /* "View.MemoryView":158 + * + * for idx, dim in enumerate(shape): + * if dim <= 0: # <<<<<<<<<<<<<< + * raise ValueError, f"Invalid shape in axis {idx}: {dim}." + * self._shape[idx] = dim +*/ + } + + /* "View.MemoryView":160 + * if dim <= 0: + * raise ValueError, f"Invalid shape in axis {idx}: {dim}." + * self._shape[idx] = dim # <<<<<<<<<<<<<< + * + * cdef char order +*/ + (__pyx_v_self->_shape[__pyx_v_idx]) = __pyx_v_dim; + + /* "View.MemoryView":157 + * + * + * for idx, dim in enumerate(shape): # <<<<<<<<<<<<<< + * if dim <= 0: + * raise ValueError, f"Invalid shape in axis {idx}: {dim}." +*/ + } + __Pyx_DECREF(__pyx_t_4); __pyx_t_4 = 0; + + /* "View.MemoryView":163 + * + * cdef char order + * if mode == 'c': # <<<<<<<<<<<<<< + * order = b'C' + * self.mode = u'c' +*/ + __pyx_t_3 = (__Pyx_PyUnicode_Equals(__pyx_v_mode, __pyx_mstate_global->__pyx_n_u_c, Py_EQ)); if (unlikely((__pyx_t_3 < 0))) __PYX_ERR(1, 163, __pyx_L1_error) + if (__pyx_t_3) { + + /* "View.MemoryView":164 + * cdef char order + * if mode == 'c': + * order = b'C' # <<<<<<<<<<<<<< + * self.mode = u'c' + * elif mode == 'fortran': +*/ + __pyx_v_order = 'C'; + + /* "View.MemoryView":165 + * if mode == 'c': + * order = b'C' + * self.mode = u'c' # <<<<<<<<<<<<<< + * elif mode == 'fortran': + * order = b'F' +*/ + __Pyx_INCREF(__pyx_mstate_global->__pyx_n_u_c); + __Pyx_GIVEREF(__pyx_mstate_global->__pyx_n_u_c); + __Pyx_GOTREF(__pyx_v_self->mode); + __Pyx_DECREF(__pyx_v_self->mode); + __pyx_v_self->mode = __pyx_mstate_global->__pyx_n_u_c; + + /* "View.MemoryView":163 + * + * cdef char order + * if mode == 'c': # <<<<<<<<<<<<<< + * order = b'C' + * self.mode = u'c' +*/ + goto __pyx_L11; + } + + /* "View.MemoryView":166 + * order = b'C' + * self.mode = u'c' + * elif mode == 'fortran': # <<<<<<<<<<<<<< + * order = b'F' + * self.mode = u'fortran' +*/ + __pyx_t_3 = (__Pyx_PyUnicode_Equals(__pyx_v_mode, __pyx_mstate_global->__pyx_n_u_fortran, Py_EQ)); if (unlikely((__pyx_t_3 < 0))) __PYX_ERR(1, 166, __pyx_L1_error) + if (likely(__pyx_t_3)) { + + /* "View.MemoryView":167 + * self.mode = u'c' + * elif mode == 'fortran': + * order = b'F' # <<<<<<<<<<<<<< + * self.mode = u'fortran' + * else: +*/ + __pyx_v_order = 'F'; + + /* "View.MemoryView":168 + * elif mode == 'fortran': + * order = b'F' + * self.mode = u'fortran' # <<<<<<<<<<<<<< + * else: + * raise ValueError, f"Invalid mode, expected 'c' or 'fortran', got {mode}" +*/ + __Pyx_INCREF(__pyx_mstate_global->__pyx_n_u_fortran); + __Pyx_GIVEREF(__pyx_mstate_global->__pyx_n_u_fortran); + __Pyx_GOTREF(__pyx_v_self->mode); + __Pyx_DECREF(__pyx_v_self->mode); + __pyx_v_self->mode = __pyx_mstate_global->__pyx_n_u_fortran; + + /* "View.MemoryView":166 + * order = b'C' + * self.mode = u'c' + * elif mode == 'fortran': # <<<<<<<<<<<<<< + * order = b'F' + * self.mode = u'fortran' +*/ + goto __pyx_L11; + } + + /* "View.MemoryView":170 + * self.mode = u'fortran' + * else: + * raise ValueError, f"Invalid mode, expected 'c' or 'fortran', got {mode}" # <<<<<<<<<<<<<< + * + * self.len = fill_contig_strides_array(self._shape, self._strides, itemsize, self.ndim, order) +*/ + /*else*/ { + __pyx_t_4 = __Pyx_PyObject_FormatSimple(__pyx_v_mode, __pyx_mstate_global->__pyx_empty_unicode); if (unlikely(!__pyx_t_4)) __PYX_ERR(1, 170, __pyx_L1_error) + __Pyx_GOTREF(__pyx_t_4); + __pyx_t_12 = __Pyx_PyUnicode_Concat(__pyx_mstate_global->__pyx_kp_u_Invalid_mode_expected_c_or_fortr, __pyx_t_4); if (unlikely(!__pyx_t_12)) __PYX_ERR(1, 170, __pyx_L1_error) + __Pyx_GOTREF(__pyx_t_12); + __Pyx_DECREF(__pyx_t_4); __pyx_t_4 = 0; + __Pyx_Raise(((PyObject *)(((PyTypeObject*)PyExc_ValueError))), __pyx_t_12, 0, 0); + __Pyx_DECREF(__pyx_t_12); __pyx_t_12 = 0; + __PYX_ERR(1, 170, __pyx_L1_error) + } + __pyx_L11:; + + /* "View.MemoryView":172 + * raise ValueError, f"Invalid mode, expected 'c' or 'fortran', got {mode}" + * + * self.len = fill_contig_strides_array(self._shape, self._strides, itemsize, self.ndim, order) # <<<<<<<<<<<<<< + * + * self.free_data = allocate_buffer +*/ + __pyx_v_self->len = __pyx_fill_contig_strides_array(__pyx_v_self->_shape, __pyx_v_self->_strides, __pyx_v_itemsize, __pyx_v_self->ndim, __pyx_v_order); + + /* "View.MemoryView":174 + * self.len = fill_contig_strides_array(self._shape, self._strides, itemsize, self.ndim, order) + * + * self.free_data = allocate_buffer # <<<<<<<<<<<<<< + * self.dtype_is_object = format == b'O' + * +*/ + __pyx_v_self->free_data = __pyx_v_allocate_buffer; + + /* "View.MemoryView":175 + * + * self.free_data = allocate_buffer + * self.dtype_is_object = format == b'O' # <<<<<<<<<<<<<< + * + * if allocate_buffer: +*/ + __pyx_t_12 = PyObject_RichCompare(__pyx_v_format, __pyx_mstate_global->__pyx_n_b_O, Py_EQ); __Pyx_XGOTREF(__pyx_t_12); if (unlikely(!__pyx_t_12)) __PYX_ERR(1, 175, __pyx_L1_error) + __pyx_t_3 = __Pyx_PyObject_IsTrue(__pyx_t_12); if (unlikely((__pyx_t_3 == (int)-1) && PyErr_Occurred())) __PYX_ERR(1, 175, __pyx_L1_error) + __Pyx_DECREF(__pyx_t_12); __pyx_t_12 = 0; + __pyx_v_self->dtype_is_object = __pyx_t_3; + + /* "View.MemoryView":177 + * self.dtype_is_object = format == b'O' + * + * if allocate_buffer: # <<<<<<<<<<<<<< + * _allocate_buffer(self) + * +*/ + if (__pyx_v_allocate_buffer) { + + /* "View.MemoryView":178 + * + * if allocate_buffer: + * _allocate_buffer(self) # <<<<<<<<<<<<<< + * + * @cname('getbuffer') +*/ + __pyx_t_8 = __pyx_array_allocate_buffer(__pyx_v_self); if (unlikely(__pyx_t_8 == ((int)-1))) __PYX_ERR(1, 178, __pyx_L1_error) + + /* "View.MemoryView":177 + * self.dtype_is_object = format == b'O' + * + * if allocate_buffer: # <<<<<<<<<<<<<< + * _allocate_buffer(self) + * +*/ + } + + /* "View.MemoryView":129 + * cdef bint dtype_is_object + * + * def __cinit__(array self, tuple shape, Py_ssize_t itemsize, format not None, # <<<<<<<<<<<<<< + * mode="c", bint allocate_buffer=True): + * +*/ + + /* 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_10); + __Pyx_XDECREF(__pyx_t_12); + __Pyx_AddTraceback("View.MemoryView.array.__cinit__", __pyx_clineno, __pyx_lineno, __pyx_filename); + __pyx_r = -1; + __pyx_L0:; + __Pyx_XDECREF(__pyx_v_format); + __Pyx_RefNannyFinishContext(); + return __pyx_r; +} + +/* "View.MemoryView":180 + * _allocate_buffer(self) + * + * @cname('getbuffer') # <<<<<<<<<<<<<< + * def __getbuffer__(self, Py_buffer *info, int flags): + * cdef int bufmode = -1 +*/ + +/* Python wrapper */ +CYTHON_UNUSED static int __pyx_array_getbuffer(PyObject *__pyx_v_self, Py_buffer *__pyx_v_info, int __pyx_v_flags); /*proto*/ +CYTHON_UNUSED static int __pyx_array_getbuffer(PyObject *__pyx_v_self, Py_buffer *__pyx_v_info, int __pyx_v_flags) { + CYTHON_UNUSED PyObject *const *__pyx_kwvalues; + int __pyx_r; + __Pyx_RefNannyDeclarations + __Pyx_RefNannySetupContext("__getbuffer__ (wrapper)", 0); + __pyx_kwvalues = __Pyx_KwValues_VARARGS(__pyx_args, __pyx_nargs); + __pyx_r = __pyx_array___pyx_pf_15View_dot_MemoryView_5array_2__getbuffer__(((struct __pyx_array_obj *)__pyx_v_self), ((Py_buffer *)__pyx_v_info), ((int)__pyx_v_flags)); + + /* function exit code */ + __Pyx_RefNannyFinishContext(); + return __pyx_r; +} + +static int __pyx_array___pyx_pf_15View_dot_MemoryView_5array_2__getbuffer__(struct __pyx_array_obj *__pyx_v_self, Py_buffer *__pyx_v_info, int __pyx_v_flags) { + int __pyx_v_bufmode; + int __pyx_r; + __Pyx_RefNannyDeclarations + int __pyx_t_1; + char *__pyx_t_2; + Py_ssize_t __pyx_t_3; + int __pyx_t_4; + Py_ssize_t *__pyx_t_5; + int __pyx_lineno = 0; + const char *__pyx_filename = NULL; + int __pyx_clineno = 0; + if (unlikely(__pyx_v_info == NULL)) { + PyErr_SetString(PyExc_BufferError, "PyObject_GetBuffer: view==NULL argument is obsolete"); + return -1; + } + __Pyx_RefNannySetupContext("__getbuffer__", 0); + __pyx_v_info->obj = Py_None; __Pyx_INCREF(Py_None); + __Pyx_GIVEREF(__pyx_v_info->obj); + + /* "View.MemoryView":182 + * @cname('getbuffer') + * def __getbuffer__(self, Py_buffer *info, int flags): + * cdef int bufmode = -1 # <<<<<<<<<<<<<< + * if flags & (PyBUF_C_CONTIGUOUS | PyBUF_F_CONTIGUOUS | PyBUF_ANY_CONTIGUOUS): + * if self.mode == u"c": +*/ + __pyx_v_bufmode = -1; + + /* "View.MemoryView":183 + * def __getbuffer__(self, Py_buffer *info, int flags): + * cdef int bufmode = -1 + * if flags & (PyBUF_C_CONTIGUOUS | PyBUF_F_CONTIGUOUS | PyBUF_ANY_CONTIGUOUS): # <<<<<<<<<<<<<< + * if self.mode == u"c": + * bufmode = PyBUF_C_CONTIGUOUS | PyBUF_ANY_CONTIGUOUS +*/ + __pyx_t_1 = ((__pyx_v_flags & ((PyBUF_C_CONTIGUOUS | PyBUF_F_CONTIGUOUS) | PyBUF_ANY_CONTIGUOUS)) != 0); + if (__pyx_t_1) { + + /* "View.MemoryView":184 + * cdef int bufmode = -1 + * if flags & (PyBUF_C_CONTIGUOUS | PyBUF_F_CONTIGUOUS | PyBUF_ANY_CONTIGUOUS): + * if self.mode == u"c": # <<<<<<<<<<<<<< + * bufmode = PyBUF_C_CONTIGUOUS | PyBUF_ANY_CONTIGUOUS + * elif self.mode == u"fortran": +*/ + __pyx_t_1 = (__Pyx_PyUnicode_Equals(__pyx_v_self->mode, __pyx_mstate_global->__pyx_n_u_c, Py_EQ)); if (unlikely((__pyx_t_1 < 0))) __PYX_ERR(1, 184, __pyx_L1_error) + if (__pyx_t_1) { + + /* "View.MemoryView":185 + * if flags & (PyBUF_C_CONTIGUOUS | PyBUF_F_CONTIGUOUS | PyBUF_ANY_CONTIGUOUS): + * if self.mode == u"c": + * bufmode = PyBUF_C_CONTIGUOUS | PyBUF_ANY_CONTIGUOUS # <<<<<<<<<<<<<< + * elif self.mode == u"fortran": + * bufmode = PyBUF_F_CONTIGUOUS | PyBUF_ANY_CONTIGUOUS +*/ + __pyx_v_bufmode = (PyBUF_C_CONTIGUOUS | PyBUF_ANY_CONTIGUOUS); + + /* "View.MemoryView":184 + * cdef int bufmode = -1 + * if flags & (PyBUF_C_CONTIGUOUS | PyBUF_F_CONTIGUOUS | PyBUF_ANY_CONTIGUOUS): + * if self.mode == u"c": # <<<<<<<<<<<<<< + * bufmode = PyBUF_C_CONTIGUOUS | PyBUF_ANY_CONTIGUOUS + * elif self.mode == u"fortran": +*/ + goto __pyx_L4; + } + + /* "View.MemoryView":186 + * if self.mode == u"c": + * bufmode = PyBUF_C_CONTIGUOUS | PyBUF_ANY_CONTIGUOUS + * elif self.mode == u"fortran": # <<<<<<<<<<<<<< + * bufmode = PyBUF_F_CONTIGUOUS | PyBUF_ANY_CONTIGUOUS + * if not (flags & bufmode): +*/ + __pyx_t_1 = (__Pyx_PyUnicode_Equals(__pyx_v_self->mode, __pyx_mstate_global->__pyx_n_u_fortran, Py_EQ)); if (unlikely((__pyx_t_1 < 0))) __PYX_ERR(1, 186, __pyx_L1_error) + if (__pyx_t_1) { + + /* "View.MemoryView":187 + * bufmode = PyBUF_C_CONTIGUOUS | PyBUF_ANY_CONTIGUOUS + * elif self.mode == u"fortran": + * bufmode = PyBUF_F_CONTIGUOUS | PyBUF_ANY_CONTIGUOUS # <<<<<<<<<<<<<< + * if not (flags & bufmode): + * raise ValueError, "Can only create a buffer that is contiguous in memory." +*/ + __pyx_v_bufmode = (PyBUF_F_CONTIGUOUS | PyBUF_ANY_CONTIGUOUS); + + /* "View.MemoryView":186 + * if self.mode == u"c": + * bufmode = PyBUF_C_CONTIGUOUS | PyBUF_ANY_CONTIGUOUS + * elif self.mode == u"fortran": # <<<<<<<<<<<<<< + * bufmode = PyBUF_F_CONTIGUOUS | PyBUF_ANY_CONTIGUOUS + * if not (flags & bufmode): +*/ + } + __pyx_L4:; + + /* "View.MemoryView":188 + * elif self.mode == u"fortran": + * bufmode = PyBUF_F_CONTIGUOUS | PyBUF_ANY_CONTIGUOUS + * if not (flags & bufmode): # <<<<<<<<<<<<<< + * raise ValueError, "Can only create a buffer that is contiguous in memory." + * info.buf = self.data +*/ + __pyx_t_1 = (!((__pyx_v_flags & __pyx_v_bufmode) != 0)); + if (unlikely(__pyx_t_1)) { + + /* "View.MemoryView":189 + * bufmode = PyBUF_F_CONTIGUOUS | PyBUF_ANY_CONTIGUOUS + * if not (flags & bufmode): + * raise ValueError, "Can only create a buffer that is contiguous in memory." # <<<<<<<<<<<<<< + * info.buf = self.data + * info.len = self.len +*/ + __Pyx_Raise(((PyObject *)(((PyTypeObject*)PyExc_ValueError))), __pyx_mstate_global->__pyx_kp_u_Can_only_create_a_buffer_that_is, 0, 0); + __PYX_ERR(1, 189, __pyx_L1_error) + + /* "View.MemoryView":188 + * elif self.mode == u"fortran": + * bufmode = PyBUF_F_CONTIGUOUS | PyBUF_ANY_CONTIGUOUS + * if not (flags & bufmode): # <<<<<<<<<<<<<< + * raise ValueError, "Can only create a buffer that is contiguous in memory." + * info.buf = self.data +*/ + } + + /* "View.MemoryView":183 + * def __getbuffer__(self, Py_buffer *info, int flags): + * cdef int bufmode = -1 + * if flags & (PyBUF_C_CONTIGUOUS | PyBUF_F_CONTIGUOUS | PyBUF_ANY_CONTIGUOUS): # <<<<<<<<<<<<<< + * if self.mode == u"c": + * bufmode = PyBUF_C_CONTIGUOUS | PyBUF_ANY_CONTIGUOUS +*/ + } + + /* "View.MemoryView":190 + * if not (flags & bufmode): + * raise ValueError, "Can only create a buffer that is contiguous in memory." + * info.buf = self.data # <<<<<<<<<<<<<< + * info.len = self.len + * +*/ + __pyx_t_2 = __pyx_v_self->data; + __pyx_v_info->buf = __pyx_t_2; + + /* "View.MemoryView":191 + * raise ValueError, "Can only create a buffer that is contiguous in memory." + * info.buf = self.data + * info.len = self.len # <<<<<<<<<<<<<< + * + * if flags & PyBUF_STRIDES: +*/ + __pyx_t_3 = __pyx_v_self->len; + __pyx_v_info->len = __pyx_t_3; + + /* "View.MemoryView":193 + * info.len = self.len + * + * if flags & PyBUF_STRIDES: # <<<<<<<<<<<<<< + * info.ndim = self.ndim + * info.shape = self._shape +*/ + __pyx_t_1 = ((__pyx_v_flags & PyBUF_STRIDES) != 0); + if (__pyx_t_1) { + + /* "View.MemoryView":194 + * + * if flags & PyBUF_STRIDES: + * info.ndim = self.ndim # <<<<<<<<<<<<<< + * info.shape = self._shape + * info.strides = self._strides +*/ + __pyx_t_4 = __pyx_v_self->ndim; + __pyx_v_info->ndim = __pyx_t_4; + + /* "View.MemoryView":195 + * if flags & PyBUF_STRIDES: + * info.ndim = self.ndim + * info.shape = self._shape # <<<<<<<<<<<<<< + * info.strides = self._strides + * else: +*/ + __pyx_t_5 = __pyx_v_self->_shape; + __pyx_v_info->shape = __pyx_t_5; + + /* "View.MemoryView":196 + * info.ndim = self.ndim + * info.shape = self._shape + * info.strides = self._strides # <<<<<<<<<<<<<< + * else: + * info.ndim = 1 +*/ + __pyx_t_5 = __pyx_v_self->_strides; + __pyx_v_info->strides = __pyx_t_5; + + /* "View.MemoryView":193 + * info.len = self.len + * + * if flags & PyBUF_STRIDES: # <<<<<<<<<<<<<< + * info.ndim = self.ndim + * info.shape = self._shape +*/ + goto __pyx_L6; + } + + /* "View.MemoryView":198 + * info.strides = self._strides + * else: + * info.ndim = 1 # <<<<<<<<<<<<<< + * info.shape = &self.len if flags & PyBUF_ND else NULL + * info.strides = NULL +*/ + /*else*/ { + __pyx_v_info->ndim = 1; + + /* "View.MemoryView":199 + * else: + * info.ndim = 1 + * info.shape = &self.len if flags & PyBUF_ND else NULL # <<<<<<<<<<<<<< + * info.strides = NULL + * +*/ + __pyx_t_1 = ((__pyx_v_flags & PyBUF_ND) != 0); + if (__pyx_t_1) { + __pyx_t_5 = (&__pyx_v_self->len); + } else { + __pyx_t_5 = NULL; + } + __pyx_v_info->shape = __pyx_t_5; + + /* "View.MemoryView":200 + * info.ndim = 1 + * info.shape = &self.len if flags & PyBUF_ND else NULL + * info.strides = NULL # <<<<<<<<<<<<<< + * + * info.suboffsets = NULL +*/ + __pyx_v_info->strides = NULL; + } + __pyx_L6:; + + /* "View.MemoryView":202 + * info.strides = NULL + * + * info.suboffsets = NULL # <<<<<<<<<<<<<< + * info.itemsize = self.itemsize + * info.readonly = 0 +*/ + __pyx_v_info->suboffsets = NULL; + + /* "View.MemoryView":203 + * + * info.suboffsets = NULL + * info.itemsize = self.itemsize # <<<<<<<<<<<<<< + * info.readonly = 0 + * info.format = self.format if flags & PyBUF_FORMAT else NULL +*/ + __pyx_t_3 = __pyx_v_self->itemsize; + __pyx_v_info->itemsize = __pyx_t_3; + + /* "View.MemoryView":204 + * info.suboffsets = NULL + * info.itemsize = self.itemsize + * info.readonly = 0 # <<<<<<<<<<<<<< + * info.format = self.format if flags & PyBUF_FORMAT else NULL + * info.obj = self +*/ + __pyx_v_info->readonly = 0; + + /* "View.MemoryView":205 + * info.itemsize = self.itemsize + * info.readonly = 0 + * info.format = self.format if flags & PyBUF_FORMAT else NULL # <<<<<<<<<<<<<< + * info.obj = self + * +*/ + __pyx_t_1 = ((__pyx_v_flags & PyBUF_FORMAT) != 0); + if (__pyx_t_1) { + __pyx_t_2 = __pyx_v_self->format; + } else { + __pyx_t_2 = NULL; + } + __pyx_v_info->format = __pyx_t_2; + + /* "View.MemoryView":206 + * info.readonly = 0 + * info.format = self.format if flags & PyBUF_FORMAT else NULL + * info.obj = self # <<<<<<<<<<<<<< + * + * def __dealloc__(array self): +*/ + __Pyx_INCREF((PyObject *)__pyx_v_self); + __Pyx_GIVEREF((PyObject *)__pyx_v_self); + __Pyx_GOTREF(__pyx_v_info->obj); + __Pyx_DECREF(__pyx_v_info->obj); + __pyx_v_info->obj = ((PyObject *)__pyx_v_self); + + /* "View.MemoryView":180 + * _allocate_buffer(self) + * + * @cname('getbuffer') # <<<<<<<<<<<<<< + * def __getbuffer__(self, Py_buffer *info, int flags): + * cdef int bufmode = -1 +*/ + + /* function exit code */ + __pyx_r = 0; + goto __pyx_L0; + __pyx_L1_error:; + __Pyx_AddTraceback("View.MemoryView.array.__getbuffer__", __pyx_clineno, __pyx_lineno, __pyx_filename); + __pyx_r = -1; + if (__pyx_v_info->obj != NULL) { + __Pyx_GOTREF(__pyx_v_info->obj); + __Pyx_DECREF(__pyx_v_info->obj); __pyx_v_info->obj = 0; + } + goto __pyx_L2; + __pyx_L0:; + if (__pyx_v_info->obj == Py_None) { + __Pyx_GOTREF(__pyx_v_info->obj); + __Pyx_DECREF(__pyx_v_info->obj); __pyx_v_info->obj = 0; + } + __pyx_L2:; + __Pyx_RefNannyFinishContext(); + return __pyx_r; +} + +/* "View.MemoryView":208 + * info.obj = self + * + * def __dealloc__(array self): # <<<<<<<<<<<<<< + * if self.callback_free_data != NULL: + * self.callback_free_data(self.data) +*/ + +/* Python wrapper */ +static void __pyx_array___dealloc__(PyObject *__pyx_v_self); /*proto*/ +static void __pyx_array___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_array___pyx_pf_15View_dot_MemoryView_5array_4__dealloc__(((struct __pyx_array_obj *)__pyx_v_self)); + + /* function exit code */ + __Pyx_RefNannyFinishContext(); +} + +static void __pyx_array___pyx_pf_15View_dot_MemoryView_5array_4__dealloc__(struct __pyx_array_obj *__pyx_v_self) { + int __pyx_t_1; + int __pyx_t_2; + + /* "View.MemoryView":209 + * + * def __dealloc__(array self): + * if self.callback_free_data != NULL: # <<<<<<<<<<<<<< + * self.callback_free_data(self.data) + * elif self.free_data and self.data is not NULL: +*/ + __pyx_t_1 = (__pyx_v_self->callback_free_data != NULL); + if (__pyx_t_1) { + + /* "View.MemoryView":210 + * def __dealloc__(array self): + * if self.callback_free_data != NULL: + * self.callback_free_data(self.data) # <<<<<<<<<<<<<< + * elif self.free_data and self.data is not NULL: + * if self.dtype_is_object: +*/ + __pyx_v_self->callback_free_data(__pyx_v_self->data); + + /* "View.MemoryView":209 + * + * def __dealloc__(array self): + * if self.callback_free_data != NULL: # <<<<<<<<<<<<<< + * self.callback_free_data(self.data) + * elif self.free_data and self.data is not NULL: +*/ + goto __pyx_L3; + } + + /* "View.MemoryView":211 + * if self.callback_free_data != NULL: + * self.callback_free_data(self.data) + * elif self.free_data and self.data is not NULL: # <<<<<<<<<<<<<< + * if self.dtype_is_object: + * refcount_objects_in_slice(self.data, self._shape, self._strides, self.ndim, inc=False) +*/ + if (__pyx_v_self->free_data) { + } else { + __pyx_t_1 = __pyx_v_self->free_data; + goto __pyx_L4_bool_binop_done; + } + __pyx_t_2 = (__pyx_v_self->data != NULL); + __pyx_t_1 = __pyx_t_2; + __pyx_L4_bool_binop_done:; + if (__pyx_t_1) { + + /* "View.MemoryView":212 + * self.callback_free_data(self.data) + * elif self.free_data and self.data is not NULL: + * if self.dtype_is_object: # <<<<<<<<<<<<<< + * refcount_objects_in_slice(self.data, self._shape, self._strides, self.ndim, inc=False) + * free(self.data) +*/ + if (__pyx_v_self->dtype_is_object) { + + /* "View.MemoryView":213 + * elif self.free_data and self.data is not NULL: + * if self.dtype_is_object: + * refcount_objects_in_slice(self.data, self._shape, self._strides, self.ndim, inc=False) # <<<<<<<<<<<<<< + * free(self.data) + * PyObject_Free(self._shape) +*/ + __pyx_memoryview_refcount_objects_in_slice(__pyx_v_self->data, __pyx_v_self->_shape, __pyx_v_self->_strides, __pyx_v_self->ndim, 0); + + /* "View.MemoryView":212 + * self.callback_free_data(self.data) + * elif self.free_data and self.data is not NULL: + * if self.dtype_is_object: # <<<<<<<<<<<<<< + * refcount_objects_in_slice(self.data, self._shape, self._strides, self.ndim, inc=False) + * free(self.data) +*/ + } + + /* "View.MemoryView":214 + * if self.dtype_is_object: + * refcount_objects_in_slice(self.data, self._shape, self._strides, self.ndim, inc=False) + * free(self.data) # <<<<<<<<<<<<<< + * PyObject_Free(self._shape) + * +*/ + free(__pyx_v_self->data); + + /* "View.MemoryView":211 + * if self.callback_free_data != NULL: + * self.callback_free_data(self.data) + * elif self.free_data and self.data is not NULL: # <<<<<<<<<<<<<< + * if self.dtype_is_object: + * refcount_objects_in_slice(self.data, self._shape, self._strides, self.ndim, inc=False) +*/ + } + __pyx_L3:; + + /* "View.MemoryView":215 + * refcount_objects_in_slice(self.data, self._shape, self._strides, self.ndim, inc=False) + * free(self.data) + * PyObject_Free(self._shape) # <<<<<<<<<<<<<< + * + * @property +*/ + PyObject_Free(__pyx_v_self->_shape); + + /* "View.MemoryView":208 + * info.obj = self + * + * def __dealloc__(array self): # <<<<<<<<<<<<<< + * if self.callback_free_data != NULL: + * self.callback_free_data(self.data) +*/ + + /* function exit code */ +} + +/* "View.MemoryView":217 + * PyObject_Free(self._shape) + * + * @property # <<<<<<<<<<<<<< + * def memview(self): + * return self.get_memview() +*/ + +/* Python wrapper */ +static PyObject *__pyx_pw_15View_dot_MemoryView_5array_7memview_1__get__(PyObject *__pyx_v_self); /*proto*/ +static PyObject *__pyx_pw_15View_dot_MemoryView_5array_7memview_1__get__(PyObject *__pyx_v_self) { + CYTHON_UNUSED PyObject *const *__pyx_kwvalues; + PyObject *__pyx_r = 0; + __Pyx_RefNannyDeclarations + __Pyx_RefNannySetupContext("__get__ (wrapper)", 0); + __pyx_kwvalues = __Pyx_KwValues_VARARGS(__pyx_args, __pyx_nargs); + __pyx_r = __pyx_pf_15View_dot_MemoryView_5array_7memview___get__(((struct __pyx_array_obj *)__pyx_v_self)); + + /* function exit code */ + __Pyx_RefNannyFinishContext(); + return __pyx_r; +} + +static PyObject *__pyx_pf_15View_dot_MemoryView_5array_7memview___get__(struct __pyx_array_obj *__pyx_v_self) { + PyObject *__pyx_r = NULL; + __Pyx_RefNannyDeclarations + PyObject *__pyx_t_1 = NULL; + int __pyx_lineno = 0; + const char *__pyx_filename = NULL; + int __pyx_clineno = 0; + __Pyx_RefNannySetupContext("__get__", 0); + + /* "View.MemoryView":219 + * @property + * def memview(self): + * return self.get_memview() # <<<<<<<<<<<<<< + * + * @cname('get_memview') +*/ + __Pyx_XDECREF(__pyx_r); + __pyx_t_1 = ((struct __pyx_vtabstruct_array *)__pyx_v_self->__pyx_vtab)->get_memview(__pyx_v_self); if (unlikely(!__pyx_t_1)) __PYX_ERR(1, 219, __pyx_L1_error) + __Pyx_GOTREF(__pyx_t_1); + __pyx_r = __pyx_t_1; + __pyx_t_1 = 0; + goto __pyx_L0; + + /* "View.MemoryView":217 + * PyObject_Free(self._shape) + * + * @property # <<<<<<<<<<<<<< + * def memview(self): + * return self.get_memview() +*/ + + /* function exit code */ + __pyx_L1_error:; + __Pyx_XDECREF(__pyx_t_1); + __Pyx_AddTraceback("View.MemoryView.array.memview.__get__", __pyx_clineno, __pyx_lineno, __pyx_filename); + __pyx_r = NULL; + __pyx_L0:; + __Pyx_XGIVEREF(__pyx_r); + __Pyx_RefNannyFinishContext(); + return __pyx_r; +} + +/* "View.MemoryView":221 + * return self.get_memview() + * + * @cname('get_memview') # <<<<<<<<<<<<<< + * cdef get_memview(self): + * flags = PyBUF_ANY_CONTIGUOUS|PyBUF_FORMAT|PyBUF_WRITABLE +*/ + +static PyObject *__pyx_array_get_memview(struct __pyx_array_obj *__pyx_v_self) { + int __pyx_v_flags; + PyObject *__pyx_r = NULL; + __Pyx_RefNannyDeclarations + PyObject *__pyx_t_1 = NULL; + PyObject *__pyx_t_2 = NULL; + PyObject *__pyx_t_3 = NULL; + PyObject *__pyx_t_4 = NULL; + size_t __pyx_t_5; + int __pyx_lineno = 0; + const char *__pyx_filename = NULL; + int __pyx_clineno = 0; + __Pyx_RefNannySetupContext("get_memview", 0); + + /* "View.MemoryView":223 + * @cname('get_memview') + * cdef get_memview(self): + * flags = PyBUF_ANY_CONTIGUOUS|PyBUF_FORMAT|PyBUF_WRITABLE # <<<<<<<<<<<<<< + * return memoryview(self, flags, self.dtype_is_object) + * +*/ + __pyx_v_flags = ((PyBUF_ANY_CONTIGUOUS | PyBUF_FORMAT) | PyBUF_WRITABLE); + + /* "View.MemoryView":224 + * cdef get_memview(self): + * flags = PyBUF_ANY_CONTIGUOUS|PyBUF_FORMAT|PyBUF_WRITABLE + * return memoryview(self, flags, self.dtype_is_object) # <<<<<<<<<<<<<< + * + * def __len__(self): +*/ + __Pyx_XDECREF(__pyx_r); + __pyx_t_2 = NULL; + __pyx_t_3 = __Pyx_PyLong_From_int(__pyx_v_flags); if (unlikely(!__pyx_t_3)) __PYX_ERR(1, 224, __pyx_L1_error) + __Pyx_GOTREF(__pyx_t_3); + __pyx_t_4 = __Pyx_PyBool_FromLong(__pyx_v_self->dtype_is_object); if (unlikely(!__pyx_t_4)) __PYX_ERR(1, 224, __pyx_L1_error) + __Pyx_GOTREF(__pyx_t_4); + __pyx_t_5 = 1; + { + PyObject *__pyx_callargs[4] = {__pyx_t_2, ((PyObject *)__pyx_v_self), __pyx_t_3, __pyx_t_4}; + __pyx_t_1 = __Pyx_PyObject_FastCall((PyObject*)__pyx_mstate_global->__pyx_memoryview_type, __pyx_callargs+__pyx_t_5, (4-__pyx_t_5) | (__pyx_t_5*__Pyx_PY_VECTORCALL_ARGUMENTS_OFFSET)); + __Pyx_XDECREF(__pyx_t_2); __pyx_t_2 = 0; + __Pyx_DECREF(__pyx_t_3); __pyx_t_3 = 0; + __Pyx_DECREF(__pyx_t_4); __pyx_t_4 = 0; + if (unlikely(!__pyx_t_1)) __PYX_ERR(1, 224, __pyx_L1_error) + __Pyx_GOTREF((PyObject *)__pyx_t_1); + } + __pyx_r = ((PyObject *)__pyx_t_1); + __pyx_t_1 = 0; + goto __pyx_L0; + + /* "View.MemoryView":221 + * return self.get_memview() + * + * @cname('get_memview') # <<<<<<<<<<<<<< + * cdef get_memview(self): + * flags = PyBUF_ANY_CONTIGUOUS|PyBUF_FORMAT|PyBUF_WRITABLE +*/ + + /* function exit code */ + __pyx_L1_error:; + __Pyx_XDECREF(__pyx_t_1); + __Pyx_XDECREF(__pyx_t_2); + __Pyx_XDECREF(__pyx_t_3); + __Pyx_XDECREF(__pyx_t_4); + __Pyx_AddTraceback("View.MemoryView.array.get_memview", __pyx_clineno, __pyx_lineno, __pyx_filename); + __pyx_r = 0; + __pyx_L0:; + __Pyx_XGIVEREF(__pyx_r); + __Pyx_RefNannyFinishContext(); + return __pyx_r; +} + +/* "View.MemoryView":226 + * return memoryview(self, flags, self.dtype_is_object) + * + * def __len__(self): # <<<<<<<<<<<<<< + * return self._shape[0] + * +*/ + +/* Python wrapper */ +static Py_ssize_t __pyx_array___len__(PyObject *__pyx_v_self); /*proto*/ +static Py_ssize_t __pyx_array___len__(PyObject *__pyx_v_self) { + CYTHON_UNUSED PyObject *const *__pyx_kwvalues; + Py_ssize_t __pyx_r; + __Pyx_RefNannyDeclarations + __Pyx_RefNannySetupContext("__len__ (wrapper)", 0); + __pyx_kwvalues = __Pyx_KwValues_VARARGS(__pyx_args, __pyx_nargs); + __pyx_r = __pyx_array___pyx_pf_15View_dot_MemoryView_5array_6__len__(((struct __pyx_array_obj *)__pyx_v_self)); + + /* function exit code */ + __Pyx_RefNannyFinishContext(); + return __pyx_r; +} + +static Py_ssize_t __pyx_array___pyx_pf_15View_dot_MemoryView_5array_6__len__(struct __pyx_array_obj *__pyx_v_self) { + Py_ssize_t __pyx_r; + + /* "View.MemoryView":227 + * + * def __len__(self): + * return self._shape[0] # <<<<<<<<<<<<<< + * + * def __getattr__(self, attr): +*/ + __pyx_r = (__pyx_v_self->_shape[0]); + goto __pyx_L0; + + /* "View.MemoryView":226 + * return memoryview(self, flags, self.dtype_is_object) + * + * def __len__(self): # <<<<<<<<<<<<<< + * return self._shape[0] + * +*/ + + /* function exit code */ + __pyx_L0:; + return __pyx_r; +} + +/* "View.MemoryView":229 + * return self._shape[0] + * + * def __getattr__(self, attr): # <<<<<<<<<<<<<< + * return getattr(self.memview, attr) + * +*/ + +/* Python wrapper */ +static PyObject *__pyx_array___getattr__(PyObject *__pyx_v_self, PyObject *__pyx_v_attr); /*proto*/ +static PyObject *__pyx_array___getattr__(PyObject *__pyx_v_self, PyObject *__pyx_v_attr) { + CYTHON_UNUSED PyObject *const *__pyx_kwvalues; + PyObject *__pyx_r = 0; + __Pyx_RefNannyDeclarations + __Pyx_RefNannySetupContext("__getattr__ (wrapper)", 0); + __pyx_kwvalues = __Pyx_KwValues_VARARGS(__pyx_args, __pyx_nargs); + __pyx_r = __pyx_array___pyx_pf_15View_dot_MemoryView_5array_8__getattr__(((struct __pyx_array_obj *)__pyx_v_self), ((PyObject *)__pyx_v_attr)); + + /* function exit code */ + __Pyx_RefNannyFinishContext(); + return __pyx_r; +} + +static PyObject *__pyx_array___pyx_pf_15View_dot_MemoryView_5array_8__getattr__(struct __pyx_array_obj *__pyx_v_self, PyObject *__pyx_v_attr) { + PyObject *__pyx_r = NULL; + __Pyx_RefNannyDeclarations + PyObject *__pyx_t_1 = NULL; + PyObject *__pyx_t_2 = NULL; + int __pyx_lineno = 0; + const char *__pyx_filename = NULL; + int __pyx_clineno = 0; + __Pyx_RefNannySetupContext("__getattr__", 0); + + /* "View.MemoryView":230 + * + * def __getattr__(self, attr): + * return getattr(self.memview, attr) # <<<<<<<<<<<<<< + * + * def __getitem__(self, item): +*/ + __Pyx_XDECREF(__pyx_r); + __pyx_t_1 = __Pyx_PyObject_GetAttrStr(((PyObject *)__pyx_v_self), __pyx_mstate_global->__pyx_n_u_memview); if (unlikely(!__pyx_t_1)) __PYX_ERR(1, 230, __pyx_L1_error) + __Pyx_GOTREF(__pyx_t_1); + __pyx_t_2 = __Pyx_GetAttr(__pyx_t_1, __pyx_v_attr); if (unlikely(!__pyx_t_2)) __PYX_ERR(1, 230, __pyx_L1_error) + __Pyx_GOTREF(__pyx_t_2); + __Pyx_DECREF(__pyx_t_1); __pyx_t_1 = 0; + __pyx_r = __pyx_t_2; + __pyx_t_2 = 0; + goto __pyx_L0; + + /* "View.MemoryView":229 + * return self._shape[0] + * + * def __getattr__(self, attr): # <<<<<<<<<<<<<< + * return getattr(self.memview, attr) + * +*/ + + /* function exit code */ + __pyx_L1_error:; + __Pyx_XDECREF(__pyx_t_1); + __Pyx_XDECREF(__pyx_t_2); + __Pyx_AddTraceback("View.MemoryView.array.__getattr__", __pyx_clineno, __pyx_lineno, __pyx_filename); + __pyx_r = NULL; + __pyx_L0:; + __Pyx_XGIVEREF(__pyx_r); + __Pyx_RefNannyFinishContext(); + return __pyx_r; +} + +/* "View.MemoryView":232 + * return getattr(self.memview, attr) + * + * def __getitem__(self, item): # <<<<<<<<<<<<<< + * return self.memview[item] + * +*/ + +/* Python wrapper */ +static PyObject *__pyx_array___getitem__(PyObject *__pyx_v_self, PyObject *__pyx_v_item); /*proto*/ +static PyObject *__pyx_array___getitem__(PyObject *__pyx_v_self, PyObject *__pyx_v_item) { + CYTHON_UNUSED PyObject *const *__pyx_kwvalues; + PyObject *__pyx_r = 0; + __Pyx_RefNannyDeclarations + __Pyx_RefNannySetupContext("__getitem__ (wrapper)", 0); + __pyx_kwvalues = __Pyx_KwValues_VARARGS(__pyx_args, __pyx_nargs); + __pyx_r = __pyx_array___pyx_pf_15View_dot_MemoryView_5array_10__getitem__(((struct __pyx_array_obj *)__pyx_v_self), ((PyObject *)__pyx_v_item)); + + /* function exit code */ + __Pyx_RefNannyFinishContext(); + return __pyx_r; +} + +static PyObject *__pyx_array___pyx_pf_15View_dot_MemoryView_5array_10__getitem__(struct __pyx_array_obj *__pyx_v_self, PyObject *__pyx_v_item) { + PyObject *__pyx_r = NULL; + __Pyx_RefNannyDeclarations + PyObject *__pyx_t_1 = NULL; + PyObject *__pyx_t_2 = NULL; + int __pyx_lineno = 0; + const char *__pyx_filename = NULL; + int __pyx_clineno = 0; + __Pyx_RefNannySetupContext("__getitem__", 0); + + /* "View.MemoryView":233 + * + * def __getitem__(self, item): + * return self.memview[item] # <<<<<<<<<<<<<< + * + * def __setitem__(self, item, value): +*/ + __Pyx_XDECREF(__pyx_r); + __pyx_t_1 = __Pyx_PyObject_GetAttrStr(((PyObject *)__pyx_v_self), __pyx_mstate_global->__pyx_n_u_memview); if (unlikely(!__pyx_t_1)) __PYX_ERR(1, 233, __pyx_L1_error) + __Pyx_GOTREF(__pyx_t_1); + __pyx_t_2 = __Pyx_PyObject_GetItem(__pyx_t_1, __pyx_v_item); if (unlikely(!__pyx_t_2)) __PYX_ERR(1, 233, __pyx_L1_error) + __Pyx_GOTREF(__pyx_t_2); + __Pyx_DECREF(__pyx_t_1); __pyx_t_1 = 0; + __pyx_r = __pyx_t_2; + __pyx_t_2 = 0; + goto __pyx_L0; + + /* "View.MemoryView":232 + * return getattr(self.memview, attr) + * + * def __getitem__(self, item): # <<<<<<<<<<<<<< + * return self.memview[item] + * +*/ + + /* function exit code */ + __pyx_L1_error:; + __Pyx_XDECREF(__pyx_t_1); + __Pyx_XDECREF(__pyx_t_2); + __Pyx_AddTraceback("View.MemoryView.array.__getitem__", __pyx_clineno, __pyx_lineno, __pyx_filename); + __pyx_r = NULL; + __pyx_L0:; + __Pyx_XGIVEREF(__pyx_r); + __Pyx_RefNannyFinishContext(); + return __pyx_r; +} + +/* "View.MemoryView":235 + * return self.memview[item] + * + * def __setitem__(self, item, value): # <<<<<<<<<<<<<< + * self.memview[item] = value + * +*/ + +/* Python wrapper */ +static int __pyx_array___setitem__(PyObject *__pyx_v_self, PyObject *__pyx_v_item, PyObject *__pyx_v_value); /*proto*/ +static int __pyx_array___setitem__(PyObject *__pyx_v_self, PyObject *__pyx_v_item, PyObject *__pyx_v_value) { + CYTHON_UNUSED PyObject *const *__pyx_kwvalues; + int __pyx_r; + __Pyx_RefNannyDeclarations + __Pyx_RefNannySetupContext("__setitem__ (wrapper)", 0); + __pyx_kwvalues = __Pyx_KwValues_VARARGS(__pyx_args, __pyx_nargs); + __pyx_r = __pyx_array___pyx_pf_15View_dot_MemoryView_5array_12__setitem__(((struct __pyx_array_obj *)__pyx_v_self), ((PyObject *)__pyx_v_item), ((PyObject *)__pyx_v_value)); + + /* function exit code */ + __Pyx_RefNannyFinishContext(); + return __pyx_r; +} + +static int __pyx_array___pyx_pf_15View_dot_MemoryView_5array_12__setitem__(struct __pyx_array_obj *__pyx_v_self, PyObject *__pyx_v_item, PyObject *__pyx_v_value) { + int __pyx_r; + __Pyx_RefNannyDeclarations + PyObject *__pyx_t_1 = NULL; + int __pyx_lineno = 0; + const char *__pyx_filename = NULL; + int __pyx_clineno = 0; + __Pyx_RefNannySetupContext("__setitem__", 0); + + /* "View.MemoryView":236 + * + * def __setitem__(self, item, value): + * self.memview[item] = value # <<<<<<<<<<<<<< + * + * +*/ + __pyx_t_1 = __Pyx_PyObject_GetAttrStr(((PyObject *)__pyx_v_self), __pyx_mstate_global->__pyx_n_u_memview); if (unlikely(!__pyx_t_1)) __PYX_ERR(1, 236, __pyx_L1_error) + __Pyx_GOTREF(__pyx_t_1); + if (unlikely((PyObject_SetItem(__pyx_t_1, __pyx_v_item, __pyx_v_value) < 0))) __PYX_ERR(1, 236, __pyx_L1_error) + __Pyx_DECREF(__pyx_t_1); __pyx_t_1 = 0; + + /* "View.MemoryView":235 + * return self.memview[item] + * + * def __setitem__(self, item, value): # <<<<<<<<<<<<<< + * self.memview[item] = value + * +*/ + + /* function exit code */ + __pyx_r = 0; + goto __pyx_L0; + __pyx_L1_error:; + __Pyx_XDECREF(__pyx_t_1); + __Pyx_AddTraceback("View.MemoryView.array.__setitem__", __pyx_clineno, __pyx_lineno, __pyx_filename); + __pyx_r = -1; + __pyx_L0:; + __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___pyx_array_1__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*/ +static PyObject *__pyx_pw___pyx_array_1__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___pyx_array___reduce_cython__(((struct __pyx_array_obj *)__pyx_v_self)); + + /* function exit code */ + __Pyx_RefNannyFinishContext(); + return __pyx_r; +} + +static PyObject *__pyx_pf___pyx_array___reduce_cython__(CYTHON_UNUSED struct __pyx_array_obj *__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("View.MemoryView.array.__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___pyx_array_3__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*/ +static PyObject *__pyx_pw___pyx_array_3__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("View.MemoryView.array.__setstate_cython__", __pyx_clineno, __pyx_lineno, __pyx_filename); + __Pyx_RefNannyFinishContext(); + return NULL; + __pyx_L4_argument_unpacking_done:; + __pyx_r = __pyx_pf___pyx_array_2__setstate_cython__(((struct __pyx_array_obj *)__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___pyx_array_2__setstate_cython__(CYTHON_UNUSED struct __pyx_array_obj *__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("View.MemoryView.array.__setstate_cython__", __pyx_clineno, __pyx_lineno, __pyx_filename); + __pyx_r = NULL; + __Pyx_XGIVEREF(__pyx_r); + __Pyx_RefNannyFinishContext(); + return __pyx_r; +} + +/* "View.MemoryView":245 + * pass + * + * @cname("__pyx_array_allocate_buffer") # <<<<<<<<<<<<<< + * cdef int _allocate_buffer(array self) except -1: + * +*/ + +static int __pyx_array_allocate_buffer(struct __pyx_array_obj *__pyx_v_self) { + Py_ssize_t __pyx_v_i; + PyObject **__pyx_v_p; + int __pyx_r; + int __pyx_t_1; + Py_ssize_t __pyx_t_2; + Py_ssize_t __pyx_t_3; + Py_ssize_t __pyx_t_4; + int __pyx_lineno = 0; + const char *__pyx_filename = NULL; + int __pyx_clineno = 0; + + /* "View.MemoryView":252 + * cdef PyObject **p + * + * self.free_data = True # <<<<<<<<<<<<<< + * self.data = malloc(self.len) + * if not self.data: +*/ + __pyx_v_self->free_data = 1; + + /* "View.MemoryView":253 + * + * self.free_data = True + * self.data = malloc(self.len) # <<<<<<<<<<<<<< + * if not self.data: + * raise MemoryError, "unable to allocate array data." +*/ + __pyx_v_self->data = ((char *)malloc(__pyx_v_self->len)); + + /* "View.MemoryView":254 + * self.free_data = True + * self.data = malloc(self.len) + * if not self.data: # <<<<<<<<<<<<<< + * raise MemoryError, "unable to allocate array data." + * +*/ + __pyx_t_1 = (!(__pyx_v_self->data != 0)); + if (unlikely(__pyx_t_1)) { + + /* "View.MemoryView":255 + * self.data = malloc(self.len) + * if not self.data: + * raise MemoryError, "unable to allocate array data." # <<<<<<<<<<<<<< + * + * if self.dtype_is_object: +*/ + __Pyx_Raise(((PyObject *)(((PyTypeObject*)PyExc_MemoryError))), __pyx_mstate_global->__pyx_kp_u_unable_to_allocate_array_data, 0, 0); + __PYX_ERR(1, 255, __pyx_L1_error) + + /* "View.MemoryView":254 + * self.free_data = True + * self.data = malloc(self.len) + * if not self.data: # <<<<<<<<<<<<<< + * raise MemoryError, "unable to allocate array data." + * +*/ + } + + /* "View.MemoryView":257 + * raise MemoryError, "unable to allocate array data." + * + * if self.dtype_is_object: # <<<<<<<<<<<<<< + * p = self.data + * for i in range(self.len // self.itemsize): +*/ + if (__pyx_v_self->dtype_is_object) { + + /* "View.MemoryView":258 + * + * if self.dtype_is_object: + * p = self.data # <<<<<<<<<<<<<< + * for i in range(self.len // self.itemsize): + * p[i] = Py_None +*/ + __pyx_v_p = ((PyObject **)__pyx_v_self->data); + + /* "View.MemoryView":259 + * if self.dtype_is_object: + * p = self.data + * for i in range(self.len // self.itemsize): # <<<<<<<<<<<<<< + * p[i] = Py_None + * Py_INCREF(Py_None) +*/ + if (unlikely(__pyx_v_self->itemsize == 0)) { + PyErr_SetString(PyExc_ZeroDivisionError, "integer division or modulo by zero"); + __PYX_ERR(1, 259, __pyx_L1_error) + } + else if (sizeof(Py_ssize_t) == sizeof(long) && (!(((Py_ssize_t)-1) > 0)) && unlikely(__pyx_v_self->itemsize == (Py_ssize_t)-1) && unlikely(__Pyx_UNARY_NEG_WOULD_OVERFLOW(__pyx_v_self->len))) { + PyErr_SetString(PyExc_OverflowError, "value too large to perform division"); + __PYX_ERR(1, 259, __pyx_L1_error) + } + __pyx_t_2 = __Pyx_div_Py_ssize_t(__pyx_v_self->len, __pyx_v_self->itemsize, 0); + __pyx_t_3 = __pyx_t_2; + for (__pyx_t_4 = 0; __pyx_t_4 < __pyx_t_3; __pyx_t_4+=1) { + __pyx_v_i = __pyx_t_4; + + /* "View.MemoryView":260 + * p = self.data + * for i in range(self.len // self.itemsize): + * p[i] = Py_None # <<<<<<<<<<<<<< + * Py_INCREF(Py_None) + * return 0 +*/ + (__pyx_v_p[__pyx_v_i]) = Py_None; + + /* "View.MemoryView":261 + * for i in range(self.len // self.itemsize): + * p[i] = Py_None + * Py_INCREF(Py_None) # <<<<<<<<<<<<<< + * return 0 + * +*/ + Py_INCREF(Py_None); + } + + /* "View.MemoryView":257 + * raise MemoryError, "unable to allocate array data." + * + * if self.dtype_is_object: # <<<<<<<<<<<<<< + * p = self.data + * for i in range(self.len // self.itemsize): +*/ + } + + /* "View.MemoryView":262 + * p[i] = Py_None + * Py_INCREF(Py_None) + * return 0 # <<<<<<<<<<<<<< + * + * +*/ + __pyx_r = 0; + goto __pyx_L0; + + /* "View.MemoryView":245 + * pass + * + * @cname("__pyx_array_allocate_buffer") # <<<<<<<<<<<<<< + * cdef int _allocate_buffer(array self) except -1: + * +*/ + + /* function exit code */ + __pyx_L1_error:; + __Pyx_AddTraceback("View.MemoryView._allocate_buffer", __pyx_clineno, __pyx_lineno, __pyx_filename); + __pyx_r = -1; + __pyx_L0:; + return __pyx_r; +} + +/* "View.MemoryView":265 + * + * + * @cname("__pyx_array_new") # <<<<<<<<<<<<<< + * cdef array array_cwrapper(tuple shape, Py_ssize_t itemsize, char *format, const char *c_mode, char *buf): + * cdef array result +*/ + +static struct __pyx_array_obj *__pyx_array_new(PyObject *__pyx_v_shape, Py_ssize_t __pyx_v_itemsize, char *__pyx_v_format, char const *__pyx_v_c_mode, char *__pyx_v_buf) { + struct __pyx_array_obj *__pyx_v_result = 0; + PyObject *__pyx_v_mode = 0; + struct __pyx_array_obj *__pyx_r = NULL; + __Pyx_RefNannyDeclarations + PyObject *__pyx_t_1 = NULL; + int __pyx_t_2; + PyObject *__pyx_t_3 = NULL; + PyObject *__pyx_t_4 = NULL; + int __pyx_lineno = 0; + const char *__pyx_filename = NULL; + int __pyx_clineno = 0; + __Pyx_RefNannySetupContext("array_cwrapper", 0); + + /* "View.MemoryView":268 + * cdef array array_cwrapper(tuple shape, Py_ssize_t itemsize, char *format, const char *c_mode, char *buf): + * cdef array result + * cdef str mode = "fortran" if c_mode[0] == b'f' else "c" # this often comes from a constant C string. # <<<<<<<<<<<<<< + * + * if buf is NULL: +*/ + __pyx_t_2 = ((__pyx_v_c_mode[0]) == 'f'); + if (__pyx_t_2) { + __Pyx_INCREF(__pyx_mstate_global->__pyx_n_u_fortran); + __pyx_t_1 = __pyx_mstate_global->__pyx_n_u_fortran; + } else { + __Pyx_INCREF(__pyx_mstate_global->__pyx_n_u_c); + __pyx_t_1 = __pyx_mstate_global->__pyx_n_u_c; + } + __pyx_v_mode = ((PyObject*)__pyx_t_1); + __pyx_t_1 = 0; + + /* "View.MemoryView":270 + * cdef str mode = "fortran" if c_mode[0] == b'f' else "c" # this often comes from a constant C string. + * + * if buf is NULL: # <<<<<<<<<<<<<< + * result = array.__new__(array, shape, itemsize, format, mode) + * else: +*/ + __pyx_t_2 = (__pyx_v_buf == NULL); + if (__pyx_t_2) { + + /* "View.MemoryView":271 + * + * if buf is NULL: + * result = array.__new__(array, shape, itemsize, format, mode) # <<<<<<<<<<<<<< + * else: + * result = array.__new__(array, shape, itemsize, format, mode, allocate_buffer=False) +*/ + __pyx_t_1 = PyLong_FromSsize_t(__pyx_v_itemsize); if (unlikely(!__pyx_t_1)) __PYX_ERR(1, 271, __pyx_L1_error) + __Pyx_GOTREF(__pyx_t_1); + __pyx_t_3 = __Pyx_PyBytes_FromString(__pyx_v_format); if (unlikely(!__pyx_t_3)) __PYX_ERR(1, 271, __pyx_L1_error) + __Pyx_GOTREF(__pyx_t_3); + __pyx_t_4 = PyTuple_New(4); if (unlikely(!__pyx_t_4)) __PYX_ERR(1, 271, __pyx_L1_error) + __Pyx_GOTREF(__pyx_t_4); + __Pyx_INCREF(__pyx_v_shape); + __Pyx_GIVEREF(__pyx_v_shape); + if (__Pyx_PyTuple_SET_ITEM(__pyx_t_4, 0, __pyx_v_shape) != (0)) __PYX_ERR(1, 271, __pyx_L1_error); + __Pyx_GIVEREF(__pyx_t_1); + if (__Pyx_PyTuple_SET_ITEM(__pyx_t_4, 1, __pyx_t_1) != (0)) __PYX_ERR(1, 271, __pyx_L1_error); + __Pyx_GIVEREF(__pyx_t_3); + if (__Pyx_PyTuple_SET_ITEM(__pyx_t_4, 2, __pyx_t_3) != (0)) __PYX_ERR(1, 271, __pyx_L1_error); + __Pyx_INCREF(__pyx_v_mode); + __Pyx_GIVEREF(__pyx_v_mode); + if (__Pyx_PyTuple_SET_ITEM(__pyx_t_4, 3, __pyx_v_mode) != (0)) __PYX_ERR(1, 271, __pyx_L1_error); + __pyx_t_1 = 0; + __pyx_t_3 = 0; + __pyx_t_3 = ((PyObject *)__pyx_tp_new_array(((PyTypeObject *)__pyx_mstate_global->__pyx_array_type), __pyx_t_4, NULL)); if (unlikely(!__pyx_t_3)) __PYX_ERR(1, 271, __pyx_L1_error) + __Pyx_GOTREF((PyObject *)__pyx_t_3); + __Pyx_DECREF(__pyx_t_4); __pyx_t_4 = 0; + __pyx_v_result = ((struct __pyx_array_obj *)__pyx_t_3); + __pyx_t_3 = 0; + + /* "View.MemoryView":270 + * cdef str mode = "fortran" if c_mode[0] == b'f' else "c" # this often comes from a constant C string. + * + * if buf is NULL: # <<<<<<<<<<<<<< + * result = array.__new__(array, shape, itemsize, format, mode) + * else: +*/ + goto __pyx_L3; + } + + /* "View.MemoryView":273 + * result = array.__new__(array, shape, itemsize, format, mode) + * else: + * result = array.__new__(array, shape, itemsize, format, mode, allocate_buffer=False) # <<<<<<<<<<<<<< + * result.data = buf + * +*/ + /*else*/ { + __pyx_t_3 = PyLong_FromSsize_t(__pyx_v_itemsize); if (unlikely(!__pyx_t_3)) __PYX_ERR(1, 273, __pyx_L1_error) + __Pyx_GOTREF(__pyx_t_3); + __pyx_t_4 = __Pyx_PyBytes_FromString(__pyx_v_format); if (unlikely(!__pyx_t_4)) __PYX_ERR(1, 273, __pyx_L1_error) + __Pyx_GOTREF(__pyx_t_4); + __pyx_t_1 = PyTuple_New(4); if (unlikely(!__pyx_t_1)) __PYX_ERR(1, 273, __pyx_L1_error) + __Pyx_GOTREF(__pyx_t_1); + __Pyx_INCREF(__pyx_v_shape); + __Pyx_GIVEREF(__pyx_v_shape); + if (__Pyx_PyTuple_SET_ITEM(__pyx_t_1, 0, __pyx_v_shape) != (0)) __PYX_ERR(1, 273, __pyx_L1_error); + __Pyx_GIVEREF(__pyx_t_3); + if (__Pyx_PyTuple_SET_ITEM(__pyx_t_1, 1, __pyx_t_3) != (0)) __PYX_ERR(1, 273, __pyx_L1_error); + __Pyx_GIVEREF(__pyx_t_4); + if (__Pyx_PyTuple_SET_ITEM(__pyx_t_1, 2, __pyx_t_4) != (0)) __PYX_ERR(1, 273, __pyx_L1_error); + __Pyx_INCREF(__pyx_v_mode); + __Pyx_GIVEREF(__pyx_v_mode); + if (__Pyx_PyTuple_SET_ITEM(__pyx_t_1, 3, __pyx_v_mode) != (0)) __PYX_ERR(1, 273, __pyx_L1_error); + __pyx_t_3 = 0; + __pyx_t_4 = 0; + __pyx_t_4 = __Pyx_PyDict_NewPresized(1); if (unlikely(!__pyx_t_4)) __PYX_ERR(1, 273, __pyx_L1_error) + __Pyx_GOTREF(__pyx_t_4); + if (PyDict_SetItem(__pyx_t_4, __pyx_mstate_global->__pyx_n_u_allocate_buffer, Py_False) < (0)) __PYX_ERR(1, 273, __pyx_L1_error) + __pyx_t_3 = ((PyObject *)__pyx_tp_new_array(((PyTypeObject *)__pyx_mstate_global->__pyx_array_type), __pyx_t_1, __pyx_t_4)); if (unlikely(!__pyx_t_3)) __PYX_ERR(1, 273, __pyx_L1_error) + __Pyx_GOTREF((PyObject *)__pyx_t_3); + __Pyx_DECREF(__pyx_t_1); __pyx_t_1 = 0; + __Pyx_DECREF(__pyx_t_4); __pyx_t_4 = 0; + __pyx_v_result = ((struct __pyx_array_obj *)__pyx_t_3); + __pyx_t_3 = 0; + + /* "View.MemoryView":274 + * else: + * result = array.__new__(array, shape, itemsize, format, mode, allocate_buffer=False) + * result.data = buf # <<<<<<<<<<<<<< + * + * return result +*/ + __pyx_v_result->data = __pyx_v_buf; + } + __pyx_L3:; + + /* "View.MemoryView":276 + * result.data = buf + * + * return result # <<<<<<<<<<<<<< + * + * +*/ + __Pyx_XDECREF((PyObject *)__pyx_r); + __Pyx_INCREF((PyObject *)__pyx_v_result); + __pyx_r = __pyx_v_result; + goto __pyx_L0; + + /* "View.MemoryView":265 + * + * + * @cname("__pyx_array_new") # <<<<<<<<<<<<<< + * cdef array array_cwrapper(tuple shape, Py_ssize_t itemsize, char *format, const char *c_mode, char *buf): + * cdef array result +*/ + + /* function exit code */ + __pyx_L1_error:; + __Pyx_XDECREF(__pyx_t_1); + __Pyx_XDECREF(__pyx_t_3); + __Pyx_XDECREF(__pyx_t_4); + __Pyx_AddTraceback("View.MemoryView.array_cwrapper", __pyx_clineno, __pyx_lineno, __pyx_filename); + __pyx_r = 0; + __pyx_L0:; + __Pyx_XDECREF((PyObject *)__pyx_v_result); + __Pyx_XDECREF(__pyx_v_mode); + __Pyx_XGIVEREF((PyObject *)__pyx_r); + __Pyx_RefNannyFinishContext(); + return __pyx_r; +} + +/* "View.MemoryView":302 + * cdef class Enum(object): + * cdef object name + * def __init__(self, name): # <<<<<<<<<<<<<< + * self.name = name + * def __repr__(self): +*/ + +/* Python wrapper */ +static int __pyx_MemviewEnum___init__(PyObject *__pyx_v_self, PyObject *__pyx_args, PyObject *__pyx_kwds); /*proto*/ +static int __pyx_MemviewEnum___init__(PyObject *__pyx_v_self, PyObject *__pyx_args, PyObject *__pyx_kwds) { + PyObject *__pyx_v_name = 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_name,0}; + const Py_ssize_t __pyx_kwds_len = (__pyx_kwds) ? __Pyx_NumKwargs_VARARGS(__pyx_kwds) : 0; + if (unlikely(__pyx_kwds_len) < 0) __PYX_ERR(1, 302, __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(1, 302, __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(1, 302, __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(1, 302, __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(1, 302, __pyx_L3_error) + } + __pyx_v_name = values[0]; + } + goto __pyx_L6_skip; + __pyx_L5_argtuple_error:; + __Pyx_RaiseArgtupleInvalid("__init__", 1, 1, 1, __pyx_nargs); __PYX_ERR(1, 302, __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("View.MemoryView.Enum.__init__", __pyx_clineno, __pyx_lineno, __pyx_filename); + __Pyx_RefNannyFinishContext(); + return -1; + __pyx_L4_argument_unpacking_done:; + __pyx_r = __pyx_MemviewEnum___pyx_pf_15View_dot_MemoryView_4Enum___init__(((struct __pyx_MemviewEnum_obj *)__pyx_v_self), __pyx_v_name); + + /* 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_MemviewEnum___pyx_pf_15View_dot_MemoryView_4Enum___init__(struct __pyx_MemviewEnum_obj *__pyx_v_self, PyObject *__pyx_v_name) { + int __pyx_r; + __Pyx_RefNannyDeclarations + __Pyx_RefNannySetupContext("__init__", 0); + + /* "View.MemoryView":303 + * cdef object name + * def __init__(self, name): + * self.name = name # <<<<<<<<<<<<<< + * def __repr__(self): + * return self.name +*/ + __Pyx_INCREF(__pyx_v_name); + __Pyx_GIVEREF(__pyx_v_name); + __Pyx_GOTREF(__pyx_v_self->name); + __Pyx_DECREF(__pyx_v_self->name); + __pyx_v_self->name = __pyx_v_name; + + /* "View.MemoryView":302 + * cdef class Enum(object): + * cdef object name + * def __init__(self, name): # <<<<<<<<<<<<<< + * self.name = name + * def __repr__(self): +*/ + + /* function exit code */ + __pyx_r = 0; + __Pyx_RefNannyFinishContext(); + return __pyx_r; +} + +/* "View.MemoryView":304 + * def __init__(self, name): + * self.name = name + * def __repr__(self): # <<<<<<<<<<<<<< + * return self.name + * +*/ + +/* Python wrapper */ +static PyObject *__pyx_MemviewEnum___repr__(PyObject *__pyx_v_self); /*proto*/ +static PyObject *__pyx_MemviewEnum___repr__(PyObject *__pyx_v_self) { + CYTHON_UNUSED PyObject *const *__pyx_kwvalues; + PyObject *__pyx_r = 0; + __Pyx_RefNannyDeclarations + __Pyx_RefNannySetupContext("__repr__ (wrapper)", 0); + __pyx_kwvalues = __Pyx_KwValues_VARARGS(__pyx_args, __pyx_nargs); + __pyx_r = __pyx_MemviewEnum___pyx_pf_15View_dot_MemoryView_4Enum_2__repr__(((struct __pyx_MemviewEnum_obj *)__pyx_v_self)); + + /* function exit code */ + __Pyx_RefNannyFinishContext(); + return __pyx_r; +} + +static PyObject *__pyx_MemviewEnum___pyx_pf_15View_dot_MemoryView_4Enum_2__repr__(struct __pyx_MemviewEnum_obj *__pyx_v_self) { + PyObject *__pyx_r = NULL; + __Pyx_RefNannyDeclarations + __Pyx_RefNannySetupContext("__repr__", 0); + + /* "View.MemoryView":305 + * self.name = name + * def __repr__(self): + * return self.name # <<<<<<<<<<<<<< + * + * cdef generic = Enum("") +*/ + __Pyx_XDECREF(__pyx_r); + __Pyx_INCREF(__pyx_v_self->name); + __pyx_r = __pyx_v_self->name; + goto __pyx_L0; + + /* "View.MemoryView":304 + * def __init__(self, name): + * self.name = name + * def __repr__(self): # <<<<<<<<<<<<<< + * return self.name + * +*/ + + /* function exit code */ + __pyx_L0:; + __Pyx_XGIVEREF(__pyx_r); + __Pyx_RefNannyFinishContext(); + return __pyx_r; +} + +/* "(tree fragment)":1 + * def __reduce_cython__(self): # <<<<<<<<<<<<<< + * cdef tuple state + * cdef object _dict +*/ + +/* Python wrapper */ +static PyObject *__pyx_pw___pyx_MemviewEnum_1__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*/ +static PyObject *__pyx_pw___pyx_MemviewEnum_1__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___pyx_MemviewEnum___reduce_cython__(((struct __pyx_MemviewEnum_obj *)__pyx_v_self)); + + /* function exit code */ + __Pyx_RefNannyFinishContext(); + return __pyx_r; +} + +static PyObject *__pyx_pf___pyx_MemviewEnum___reduce_cython__(struct __pyx_MemviewEnum_obj *__pyx_v_self) { + PyObject *__pyx_v_state = 0; + PyObject *__pyx_v__dict = 0; + int __pyx_v_use_setstate; + PyObject *__pyx_r = NULL; + __Pyx_RefNannyDeclarations + PyObject *__pyx_t_1 = NULL; + int __pyx_t_2; + int __pyx_t_3; + PyObject *__pyx_t_4 = NULL; + PyObject *__pyx_t_5 = NULL; + int __pyx_lineno = 0; + const char *__pyx_filename = NULL; + int __pyx_clineno = 0; + __Pyx_RefNannySetupContext("__reduce_cython__", 0); + + /* "(tree fragment)":5 + * cdef object _dict + * cdef bint use_setstate + * state = (self.name,) # <<<<<<<<<<<<<< + * _dict = getattr(self, '__dict__', None) + * if _dict is not None and _dict: +*/ + __pyx_t_1 = PyTuple_New(1); if (unlikely(!__pyx_t_1)) __PYX_ERR(1, 5, __pyx_L1_error) + __Pyx_GOTREF(__pyx_t_1); + __Pyx_INCREF(__pyx_v_self->name); + __Pyx_GIVEREF(__pyx_v_self->name); + if (__Pyx_PyTuple_SET_ITEM(__pyx_t_1, 0, __pyx_v_self->name) != (0)) __PYX_ERR(1, 5, __pyx_L1_error); + __pyx_v_state = ((PyObject*)__pyx_t_1); + __pyx_t_1 = 0; + + /* "(tree fragment)":6 + * cdef bint use_setstate + * state = (self.name,) + * _dict = getattr(self, '__dict__', None) # <<<<<<<<<<<<<< + * if _dict is not None and _dict: + * state += (_dict,) +*/ + __pyx_t_1 = __Pyx_GetAttr3(((PyObject *)__pyx_v_self), __pyx_mstate_global->__pyx_n_u_dict, Py_None); if (unlikely(!__pyx_t_1)) __PYX_ERR(1, 6, __pyx_L1_error) + __Pyx_GOTREF(__pyx_t_1); + __pyx_v__dict = __pyx_t_1; + __pyx_t_1 = 0; + + /* "(tree fragment)":7 + * state = (self.name,) + * _dict = getattr(self, '__dict__', None) + * if _dict is not None and _dict: # <<<<<<<<<<<<<< + * state += (_dict,) + * use_setstate = True +*/ + __pyx_t_3 = (__pyx_v__dict != Py_None); + if (__pyx_t_3) { + } else { + __pyx_t_2 = __pyx_t_3; + goto __pyx_L4_bool_binop_done; + } + __pyx_t_3 = __Pyx_PyObject_IsTrue(__pyx_v__dict); if (unlikely((__pyx_t_3 < 0))) __PYX_ERR(1, 7, __pyx_L1_error) + __pyx_t_2 = __pyx_t_3; + __pyx_L4_bool_binop_done:; + if (__pyx_t_2) { + + /* "(tree fragment)":8 + * _dict = getattr(self, '__dict__', None) + * if _dict is not None and _dict: + * state += (_dict,) # <<<<<<<<<<<<<< + * use_setstate = True + * else: +*/ + __pyx_t_1 = PyTuple_New(1); if (unlikely(!__pyx_t_1)) __PYX_ERR(1, 8, __pyx_L1_error) + __Pyx_GOTREF(__pyx_t_1); + __Pyx_INCREF(__pyx_v__dict); + __Pyx_GIVEREF(__pyx_v__dict); + if (__Pyx_PyTuple_SET_ITEM(__pyx_t_1, 0, __pyx_v__dict) != (0)) __PYX_ERR(1, 8, __pyx_L1_error); + __pyx_t_4 = PyNumber_InPlaceAdd(__pyx_v_state, __pyx_t_1); if (unlikely(!__pyx_t_4)) __PYX_ERR(1, 8, __pyx_L1_error) + __Pyx_GOTREF(__pyx_t_4); + __Pyx_DECREF(__pyx_t_1); __pyx_t_1 = 0; + __Pyx_DECREF_SET(__pyx_v_state, ((PyObject*)__pyx_t_4)); + __pyx_t_4 = 0; + + /* "(tree fragment)":9 + * if _dict is not None and _dict: + * state += (_dict,) + * use_setstate = True # <<<<<<<<<<<<<< + * else: + * use_setstate = ('self.name is not None',) +*/ + __pyx_v_use_setstate = 1; + + /* "(tree fragment)":7 + * state = (self.name,) + * _dict = getattr(self, '__dict__', None) + * if _dict is not None and _dict: # <<<<<<<<<<<<<< + * state += (_dict,) + * use_setstate = True +*/ + goto __pyx_L3; + } + + /* "(tree fragment)":11 + * use_setstate = True + * else: + * use_setstate = ('self.name is not None',) # <<<<<<<<<<<<<< + * if use_setstate: + * return __pyx_unpickle_Enum, (type(self), 0x82a3537, None), state +*/ + /*else*/ { + __pyx_t_2 = __Pyx_PyObject_IsTrue(__pyx_mstate_global->__pyx_tuple[0]); if (unlikely((__pyx_t_2 == (int)-1) && PyErr_Occurred())) __PYX_ERR(1, 11, __pyx_L1_error) + __pyx_v_use_setstate = __pyx_t_2; + } + __pyx_L3:; + + /* "(tree fragment)":12 + * else: + * use_setstate = ('self.name is not None',) + * if use_setstate: # <<<<<<<<<<<<<< + * return __pyx_unpickle_Enum, (type(self), 0x82a3537, None), state + * else: +*/ + if (__pyx_v_use_setstate) { + + /* "(tree fragment)":13 + * use_setstate = ('self.name is not None',) + * if use_setstate: + * return __pyx_unpickle_Enum, (type(self), 0x82a3537, None), state # <<<<<<<<<<<<<< + * else: + * return __pyx_unpickle_Enum, (type(self), 0x82a3537, state) +*/ + __Pyx_XDECREF(__pyx_r); + __Pyx_GetModuleGlobalName(__pyx_t_4, __pyx_mstate_global->__pyx_n_u_pyx_unpickle_Enum); if (unlikely(!__pyx_t_4)) __PYX_ERR(1, 13, __pyx_L1_error) + __Pyx_GOTREF(__pyx_t_4); + __pyx_t_1 = PyTuple_New(3); if (unlikely(!__pyx_t_1)) __PYX_ERR(1, 13, __pyx_L1_error) + __Pyx_GOTREF(__pyx_t_1); + __Pyx_INCREF(((PyObject *)Py_TYPE(((PyObject *)__pyx_v_self)))); + __Pyx_GIVEREF(((PyObject *)Py_TYPE(((PyObject *)__pyx_v_self)))); + if (__Pyx_PyTuple_SET_ITEM(__pyx_t_1, 0, ((PyObject *)Py_TYPE(((PyObject *)__pyx_v_self)))) != (0)) __PYX_ERR(1, 13, __pyx_L1_error); + __Pyx_INCREF(__pyx_mstate_global->__pyx_int_136983863); + __Pyx_GIVEREF(__pyx_mstate_global->__pyx_int_136983863); + if (__Pyx_PyTuple_SET_ITEM(__pyx_t_1, 1, __pyx_mstate_global->__pyx_int_136983863) != (0)) __PYX_ERR(1, 13, __pyx_L1_error); + __Pyx_INCREF(Py_None); + __Pyx_GIVEREF(Py_None); + if (__Pyx_PyTuple_SET_ITEM(__pyx_t_1, 2, Py_None) != (0)) __PYX_ERR(1, 13, __pyx_L1_error); + __pyx_t_5 = PyTuple_New(3); if (unlikely(!__pyx_t_5)) __PYX_ERR(1, 13, __pyx_L1_error) + __Pyx_GOTREF(__pyx_t_5); + __Pyx_GIVEREF(__pyx_t_4); + if (__Pyx_PyTuple_SET_ITEM(__pyx_t_5, 0, __pyx_t_4) != (0)) __PYX_ERR(1, 13, __pyx_L1_error); + __Pyx_GIVEREF(__pyx_t_1); + if (__Pyx_PyTuple_SET_ITEM(__pyx_t_5, 1, __pyx_t_1) != (0)) __PYX_ERR(1, 13, __pyx_L1_error); + __Pyx_INCREF(__pyx_v_state); + __Pyx_GIVEREF(__pyx_v_state); + if (__Pyx_PyTuple_SET_ITEM(__pyx_t_5, 2, __pyx_v_state) != (0)) __PYX_ERR(1, 13, __pyx_L1_error); + __pyx_t_4 = 0; + __pyx_t_1 = 0; + __pyx_r = __pyx_t_5; + __pyx_t_5 = 0; + goto __pyx_L0; + + /* "(tree fragment)":12 + * else: + * use_setstate = ('self.name is not None',) + * if use_setstate: # <<<<<<<<<<<<<< + * return __pyx_unpickle_Enum, (type(self), 0x82a3537, None), state + * else: +*/ + } + + /* "(tree fragment)":15 + * return __pyx_unpickle_Enum, (type(self), 0x82a3537, None), state + * else: + * return __pyx_unpickle_Enum, (type(self), 0x82a3537, state) # <<<<<<<<<<<<<< + * def __setstate_cython__(self, __pyx_state): + * __pyx_unpickle_Enum__set_state(self, __pyx_state) +*/ + /*else*/ { + __Pyx_XDECREF(__pyx_r); + __Pyx_GetModuleGlobalName(__pyx_t_5, __pyx_mstate_global->__pyx_n_u_pyx_unpickle_Enum); if (unlikely(!__pyx_t_5)) __PYX_ERR(1, 15, __pyx_L1_error) + __Pyx_GOTREF(__pyx_t_5); + __pyx_t_1 = PyTuple_New(3); if (unlikely(!__pyx_t_1)) __PYX_ERR(1, 15, __pyx_L1_error) + __Pyx_GOTREF(__pyx_t_1); + __Pyx_INCREF(((PyObject *)Py_TYPE(((PyObject *)__pyx_v_self)))); + __Pyx_GIVEREF(((PyObject *)Py_TYPE(((PyObject *)__pyx_v_self)))); + if (__Pyx_PyTuple_SET_ITEM(__pyx_t_1, 0, ((PyObject *)Py_TYPE(((PyObject *)__pyx_v_self)))) != (0)) __PYX_ERR(1, 15, __pyx_L1_error); + __Pyx_INCREF(__pyx_mstate_global->__pyx_int_136983863); + __Pyx_GIVEREF(__pyx_mstate_global->__pyx_int_136983863); + if (__Pyx_PyTuple_SET_ITEM(__pyx_t_1, 1, __pyx_mstate_global->__pyx_int_136983863) != (0)) __PYX_ERR(1, 15, __pyx_L1_error); + __Pyx_INCREF(__pyx_v_state); + __Pyx_GIVEREF(__pyx_v_state); + if (__Pyx_PyTuple_SET_ITEM(__pyx_t_1, 2, __pyx_v_state) != (0)) __PYX_ERR(1, 15, __pyx_L1_error); + __pyx_t_4 = PyTuple_New(2); if (unlikely(!__pyx_t_4)) __PYX_ERR(1, 15, __pyx_L1_error) + __Pyx_GOTREF(__pyx_t_4); + __Pyx_GIVEREF(__pyx_t_5); + if (__Pyx_PyTuple_SET_ITEM(__pyx_t_4, 0, __pyx_t_5) != (0)) __PYX_ERR(1, 15, __pyx_L1_error); + __Pyx_GIVEREF(__pyx_t_1); + if (__Pyx_PyTuple_SET_ITEM(__pyx_t_4, 1, __pyx_t_1) != (0)) __PYX_ERR(1, 15, __pyx_L1_error); + __pyx_t_5 = 0; + __pyx_t_1 = 0; + __pyx_r = __pyx_t_4; + __pyx_t_4 = 0; + goto __pyx_L0; + } + + /* "(tree fragment)":1 + * def __reduce_cython__(self): # <<<<<<<<<<<<<< + * cdef tuple state + * cdef object _dict +*/ + + /* function exit code */ + __pyx_L1_error:; + __Pyx_XDECREF(__pyx_t_1); + __Pyx_XDECREF(__pyx_t_4); + __Pyx_XDECREF(__pyx_t_5); + __Pyx_AddTraceback("View.MemoryView.Enum.__reduce_cython__", __pyx_clineno, __pyx_lineno, __pyx_filename); + __pyx_r = NULL; + __pyx_L0:; + __Pyx_XDECREF(__pyx_v_state); + __Pyx_XDECREF(__pyx_v__dict); + __Pyx_XGIVEREF(__pyx_r); + __Pyx_RefNannyFinishContext(); + return __pyx_r; +} + +/* "(tree fragment)":16 + * else: + * return __pyx_unpickle_Enum, (type(self), 0x82a3537, state) + * def __setstate_cython__(self, __pyx_state): # <<<<<<<<<<<<<< + * __pyx_unpickle_Enum__set_state(self, __pyx_state) +*/ + +/* Python wrapper */ +static PyObject *__pyx_pw___pyx_MemviewEnum_3__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*/ +static PyObject *__pyx_pw___pyx_MemviewEnum_3__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 +) { + 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, 16, __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, 16, __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, 16, __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, 16, __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, 16, __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, 16, __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("View.MemoryView.Enum.__setstate_cython__", __pyx_clineno, __pyx_lineno, __pyx_filename); + __Pyx_RefNannyFinishContext(); + return NULL; + __pyx_L4_argument_unpacking_done:; + __pyx_r = __pyx_pf___pyx_MemviewEnum_2__setstate_cython__(((struct __pyx_MemviewEnum_obj *)__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___pyx_MemviewEnum_2__setstate_cython__(struct __pyx_MemviewEnum_obj *__pyx_v_self, PyObject *__pyx_v___pyx_state) { + PyObject *__pyx_r = NULL; + __Pyx_RefNannyDeclarations + PyObject *__pyx_t_1 = NULL; + PyObject *__pyx_t_2 = NULL; + int __pyx_lineno = 0; + const char *__pyx_filename = NULL; + int __pyx_clineno = 0; + __Pyx_RefNannySetupContext("__setstate_cython__", 0); + + /* "(tree fragment)":17 + * return __pyx_unpickle_Enum, (type(self), 0x82a3537, state) + * def __setstate_cython__(self, __pyx_state): + * __pyx_unpickle_Enum__set_state(self, __pyx_state) # <<<<<<<<<<<<<< +*/ + __pyx_t_1 = __pyx_v___pyx_state; + __Pyx_INCREF(__pyx_t_1); + if (!(likely(PyTuple_CheckExact(__pyx_t_1))||((__pyx_t_1) == Py_None) || __Pyx_RaiseUnexpectedTypeError("tuple", __pyx_t_1))) __PYX_ERR(1, 17, __pyx_L1_error) + if (unlikely(__pyx_t_1 == Py_None)) { + PyErr_SetString(PyExc_TypeError, "cannot pass None into a C function argument that is declared 'not None'"); + __PYX_ERR(1, 17, __pyx_L1_error) + } + __pyx_t_2 = __pyx_unpickle_Enum__set_state(__pyx_v_self, ((PyObject*)__pyx_t_1)); if (unlikely(!__pyx_t_2)) __PYX_ERR(1, 17, __pyx_L1_error) + __Pyx_GOTREF(__pyx_t_2); + __Pyx_DECREF(__pyx_t_1); __pyx_t_1 = 0; + __Pyx_DECREF(__pyx_t_2); __pyx_t_2 = 0; + + /* "(tree fragment)":16 + * else: + * return __pyx_unpickle_Enum, (type(self), 0x82a3537, state) + * def __setstate_cython__(self, __pyx_state): # <<<<<<<<<<<<<< + * __pyx_unpickle_Enum__set_state(self, __pyx_state) +*/ + + /* 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("View.MemoryView.Enum.__setstate_cython__", __pyx_clineno, __pyx_lineno, __pyx_filename); + __pyx_r = NULL; + __pyx_L0:; + __Pyx_XGIVEREF(__pyx_r); + __Pyx_RefNannyFinishContext(); + return __pyx_r; +} + +/* "View.MemoryView":348 + * cdef const __Pyx_TypeInfo *typeinfo + * + * def __cinit__(memoryview self, object obj, int flags, bint dtype_is_object=False): # <<<<<<<<<<<<<< + * self.obj = obj + * self.flags = flags +*/ + +/* Python wrapper */ +static int __pyx_memoryview___cinit__(PyObject *__pyx_v_self, PyObject *__pyx_args, PyObject *__pyx_kwds); /*proto*/ +static int __pyx_memoryview___cinit__(PyObject *__pyx_v_self, PyObject *__pyx_args, PyObject *__pyx_kwds) { + PyObject *__pyx_v_obj = 0; + int __pyx_v_flags; + int __pyx_v_dtype_is_object; + CYTHON_UNUSED Py_ssize_t __pyx_nargs; + 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; + 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_obj,&__pyx_mstate_global->__pyx_n_u_flags,&__pyx_mstate_global->__pyx_n_u_dtype_is_object,0}; + const Py_ssize_t __pyx_kwds_len = (__pyx_kwds) ? __Pyx_NumKwargs_VARARGS(__pyx_kwds) : 0; + if (unlikely(__pyx_kwds_len) < 0) __PYX_ERR(1, 348, __pyx_L3_error) + if (__pyx_kwds_len > 0) { + switch (__pyx_nargs) { + case 3: + values[2] = __Pyx_ArgRef_VARARGS(__pyx_args, 2); + if (!CYTHON_ASSUME_SAFE_MACROS && unlikely(!values[2])) __PYX_ERR(1, 348, __pyx_L3_error) + CYTHON_FALLTHROUGH; + case 2: + values[1] = __Pyx_ArgRef_VARARGS(__pyx_args, 1); + if (!CYTHON_ASSUME_SAFE_MACROS && unlikely(!values[1])) __PYX_ERR(1, 348, __pyx_L3_error) + CYTHON_FALLTHROUGH; + case 1: + values[0] = __Pyx_ArgRef_VARARGS(__pyx_args, 0); + if (!CYTHON_ASSUME_SAFE_MACROS && unlikely(!values[0])) __PYX_ERR(1, 348, __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(1, 348, __pyx_L3_error) + for (Py_ssize_t i = __pyx_nargs; i < 2; i++) { + if (unlikely(!values[i])) { __Pyx_RaiseArgtupleInvalid("__cinit__", 0, 2, 3, i); __PYX_ERR(1, 348, __pyx_L3_error) } + } + } else { + switch (__pyx_nargs) { + case 3: + values[2] = __Pyx_ArgRef_VARARGS(__pyx_args, 2); + if (!CYTHON_ASSUME_SAFE_MACROS && unlikely(!values[2])) __PYX_ERR(1, 348, __pyx_L3_error) + CYTHON_FALLTHROUGH; + case 2: + values[1] = __Pyx_ArgRef_VARARGS(__pyx_args, 1); + if (!CYTHON_ASSUME_SAFE_MACROS && unlikely(!values[1])) __PYX_ERR(1, 348, __pyx_L3_error) + values[0] = __Pyx_ArgRef_VARARGS(__pyx_args, 0); + if (!CYTHON_ASSUME_SAFE_MACROS && unlikely(!values[0])) __PYX_ERR(1, 348, __pyx_L3_error) + break; + default: goto __pyx_L5_argtuple_error; + } + } + __pyx_v_obj = values[0]; + __pyx_v_flags = __Pyx_PyLong_As_int(values[1]); if (unlikely((__pyx_v_flags == (int)-1) && PyErr_Occurred())) __PYX_ERR(1, 348, __pyx_L3_error) + if (values[2]) { + __pyx_v_dtype_is_object = __Pyx_PyObject_IsTrue(values[2]); if (unlikely((__pyx_v_dtype_is_object == (int)-1) && PyErr_Occurred())) __PYX_ERR(1, 348, __pyx_L3_error) + } else { + __pyx_v_dtype_is_object = ((int)0); + } + } + goto __pyx_L6_skip; + __pyx_L5_argtuple_error:; + __Pyx_RaiseArgtupleInvalid("__cinit__", 0, 2, 3, __pyx_nargs); __PYX_ERR(1, 348, __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("View.MemoryView.memoryview.__cinit__", __pyx_clineno, __pyx_lineno, __pyx_filename); + __Pyx_RefNannyFinishContext(); + return -1; + __pyx_L4_argument_unpacking_done:; + __pyx_r = __pyx_memoryview___pyx_pf_15View_dot_MemoryView_10memoryview___cinit__(((struct __pyx_memoryview_obj *)__pyx_v_self), __pyx_v_obj, __pyx_v_flags, __pyx_v_dtype_is_object); + + /* 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_memoryview___pyx_pf_15View_dot_MemoryView_10memoryview___cinit__(struct __pyx_memoryview_obj *__pyx_v_self, PyObject *__pyx_v_obj, int __pyx_v_flags, int __pyx_v_dtype_is_object) { + int __pyx_r; + __Pyx_RefNannyDeclarations + int __pyx_t_1; + int __pyx_t_2; + int __pyx_t_3; + Py_intptr_t __pyx_t_4; + size_t __pyx_t_5; + int __pyx_lineno = 0; + const char *__pyx_filename = NULL; + int __pyx_clineno = 0; + __Pyx_RefNannySetupContext("__cinit__", 0); + + /* "View.MemoryView":349 + * + * def __cinit__(memoryview self, object obj, int flags, bint dtype_is_object=False): + * self.obj = obj # <<<<<<<<<<<<<< + * self.flags = flags + * if type(self) is memoryview or obj is not None: +*/ + __Pyx_INCREF(__pyx_v_obj); + __Pyx_GIVEREF(__pyx_v_obj); + __Pyx_GOTREF(__pyx_v_self->obj); + __Pyx_DECREF(__pyx_v_self->obj); + __pyx_v_self->obj = __pyx_v_obj; + + /* "View.MemoryView":350 + * def __cinit__(memoryview self, object obj, int flags, bint dtype_is_object=False): + * self.obj = obj + * self.flags = flags # <<<<<<<<<<<<<< + * if type(self) is memoryview or obj is not None: + * PyObject_GetBuffer(obj, &self.view, flags) +*/ + __pyx_v_self->flags = __pyx_v_flags; + + /* "View.MemoryView":351 + * self.obj = obj + * self.flags = flags + * if type(self) is memoryview or obj is not None: # <<<<<<<<<<<<<< + * PyObject_GetBuffer(obj, &self.view, flags) + * if self.view.obj == NULL: +*/ + __pyx_t_2 = (((PyObject *)Py_TYPE(((PyObject *)__pyx_v_self))) == ((PyObject *)__pyx_mstate_global->__pyx_memoryview_type)); + if (!__pyx_t_2) { + } else { + __pyx_t_1 = __pyx_t_2; + goto __pyx_L4_bool_binop_done; + } + __pyx_t_2 = (__pyx_v_obj != Py_None); + __pyx_t_1 = __pyx_t_2; + __pyx_L4_bool_binop_done:; + if (__pyx_t_1) { + + /* "View.MemoryView":352 + * self.flags = flags + * if type(self) is memoryview or obj is not None: + * PyObject_GetBuffer(obj, &self.view, flags) # <<<<<<<<<<<<<< + * if self.view.obj == NULL: + * (<__pyx_buffer *> &self.view).obj = Py_None +*/ + __pyx_t_3 = PyObject_GetBuffer(__pyx_v_obj, (&__pyx_v_self->view), __pyx_v_flags); if (unlikely(__pyx_t_3 == ((int)-1))) __PYX_ERR(1, 352, __pyx_L1_error) + + /* "View.MemoryView":353 + * if type(self) is memoryview or obj is not None: + * PyObject_GetBuffer(obj, &self.view, flags) + * if self.view.obj == NULL: # <<<<<<<<<<<<<< + * (<__pyx_buffer *> &self.view).obj = Py_None + * Py_INCREF(Py_None) +*/ + __pyx_t_1 = (((PyObject *)__pyx_v_self->view.obj) == NULL); + if (__pyx_t_1) { + + /* "View.MemoryView":354 + * PyObject_GetBuffer(obj, &self.view, flags) + * if self.view.obj == NULL: + * (<__pyx_buffer *> &self.view).obj = Py_None # <<<<<<<<<<<<<< + * Py_INCREF(Py_None) + * +*/ + ((Py_buffer *)(&__pyx_v_self->view))->obj = Py_None; + + /* "View.MemoryView":355 + * if self.view.obj == NULL: + * (<__pyx_buffer *> &self.view).obj = Py_None + * Py_INCREF(Py_None) # <<<<<<<<<<<<<< + * + * if not __PYX_CYTHON_ATOMICS_ENABLED(): +*/ + Py_INCREF(Py_None); + + /* "View.MemoryView":353 + * if type(self) is memoryview or obj is not None: + * PyObject_GetBuffer(obj, &self.view, flags) + * if self.view.obj == NULL: # <<<<<<<<<<<<<< + * (<__pyx_buffer *> &self.view).obj = Py_None + * Py_INCREF(Py_None) +*/ + } + + /* "View.MemoryView":351 + * self.obj = obj + * self.flags = flags + * if type(self) is memoryview or obj is not None: # <<<<<<<<<<<<<< + * PyObject_GetBuffer(obj, &self.view, flags) + * if self.view.obj == NULL: +*/ + } + + /* "View.MemoryView":357 + * Py_INCREF(Py_None) + * + * if not __PYX_CYTHON_ATOMICS_ENABLED(): # <<<<<<<<<<<<<< + * global __pyx_memoryview_thread_locks_used + * if (__pyx_memoryview_thread_locks_used < 8 and +*/ + __pyx_t_1 = (!__PYX_CYTHON_ATOMICS_ENABLED()); + if (__pyx_t_1) { + + /* "View.MemoryView":359 + * if not __PYX_CYTHON_ATOMICS_ENABLED(): + * global __pyx_memoryview_thread_locks_used + * if (__pyx_memoryview_thread_locks_used < 8 and # <<<<<<<<<<<<<< + * + * not __PYX_GET_CYTHON_COMPILING_IN_CPYTHON_FREETHREADING()): +*/ + __pyx_t_2 = (__pyx_memoryview_thread_locks_used < 8); + if (__pyx_t_2) { + } else { + __pyx_t_1 = __pyx_t_2; + goto __pyx_L9_bool_binop_done; + } + + /* "View.MemoryView":361 + * if (__pyx_memoryview_thread_locks_used < 8 and + * + * not __PYX_GET_CYTHON_COMPILING_IN_CPYTHON_FREETHREADING()): # <<<<<<<<<<<<<< + * self.lock = __pyx_memoryview_thread_locks[__pyx_memoryview_thread_locks_used] + * __pyx_memoryview_thread_locks_used += 1 +*/ + __pyx_t_2 = (!__PYX_GET_CYTHON_COMPILING_IN_CPYTHON_FREETHREADING()); + __pyx_t_1 = __pyx_t_2; + __pyx_L9_bool_binop_done:; + + /* "View.MemoryView":359 + * if not __PYX_CYTHON_ATOMICS_ENABLED(): + * global __pyx_memoryview_thread_locks_used + * if (__pyx_memoryview_thread_locks_used < 8 and # <<<<<<<<<<<<<< + * + * not __PYX_GET_CYTHON_COMPILING_IN_CPYTHON_FREETHREADING()): +*/ + if (__pyx_t_1) { + + /* "View.MemoryView":362 + * + * not __PYX_GET_CYTHON_COMPILING_IN_CPYTHON_FREETHREADING()): + * self.lock = __pyx_memoryview_thread_locks[__pyx_memoryview_thread_locks_used] # <<<<<<<<<<<<<< + * __pyx_memoryview_thread_locks_used += 1 + * if self.lock is NULL: +*/ + __pyx_v_self->lock = (__pyx_memoryview_thread_locks[__pyx_memoryview_thread_locks_used]); + + /* "View.MemoryView":363 + * not __PYX_GET_CYTHON_COMPILING_IN_CPYTHON_FREETHREADING()): + * self.lock = __pyx_memoryview_thread_locks[__pyx_memoryview_thread_locks_used] + * __pyx_memoryview_thread_locks_used += 1 # <<<<<<<<<<<<<< + * if self.lock is NULL: + * self.lock = PyThread_allocate_lock() +*/ + __pyx_memoryview_thread_locks_used = (__pyx_memoryview_thread_locks_used + 1); + + /* "View.MemoryView":359 + * if not __PYX_CYTHON_ATOMICS_ENABLED(): + * global __pyx_memoryview_thread_locks_used + * if (__pyx_memoryview_thread_locks_used < 8 and # <<<<<<<<<<<<<< + * + * not __PYX_GET_CYTHON_COMPILING_IN_CPYTHON_FREETHREADING()): +*/ + } + + /* "View.MemoryView":364 + * self.lock = __pyx_memoryview_thread_locks[__pyx_memoryview_thread_locks_used] + * __pyx_memoryview_thread_locks_used += 1 + * if self.lock is NULL: # <<<<<<<<<<<<<< + * self.lock = PyThread_allocate_lock() + * if self.lock is NULL: +*/ + __pyx_t_1 = (__pyx_v_self->lock == NULL); + if (__pyx_t_1) { + + /* "View.MemoryView":365 + * __pyx_memoryview_thread_locks_used += 1 + * if self.lock is NULL: + * self.lock = PyThread_allocate_lock() # <<<<<<<<<<<<<< + * if self.lock is NULL: + * raise MemoryError +*/ + __pyx_v_self->lock = PyThread_allocate_lock(); + + /* "View.MemoryView":366 + * if self.lock is NULL: + * self.lock = PyThread_allocate_lock() + * if self.lock is NULL: # <<<<<<<<<<<<<< + * raise MemoryError + * +*/ + __pyx_t_1 = (__pyx_v_self->lock == NULL); + if (unlikely(__pyx_t_1)) { + + /* "View.MemoryView":367 + * self.lock = PyThread_allocate_lock() + * if self.lock is NULL: + * raise MemoryError # <<<<<<<<<<<<<< + * + * if flags & PyBUF_FORMAT: +*/ + PyErr_NoMemory(); __PYX_ERR(1, 367, __pyx_L1_error) + + /* "View.MemoryView":366 + * if self.lock is NULL: + * self.lock = PyThread_allocate_lock() + * if self.lock is NULL: # <<<<<<<<<<<<<< + * raise MemoryError + * +*/ + } + + /* "View.MemoryView":364 + * self.lock = __pyx_memoryview_thread_locks[__pyx_memoryview_thread_locks_used] + * __pyx_memoryview_thread_locks_used += 1 + * if self.lock is NULL: # <<<<<<<<<<<<<< + * self.lock = PyThread_allocate_lock() + * if self.lock is NULL: +*/ + } + + /* "View.MemoryView":357 + * Py_INCREF(Py_None) + * + * if not __PYX_CYTHON_ATOMICS_ENABLED(): # <<<<<<<<<<<<<< + * global __pyx_memoryview_thread_locks_used + * if (__pyx_memoryview_thread_locks_used < 8 and +*/ + } + + /* "View.MemoryView":369 + * raise MemoryError + * + * if flags & PyBUF_FORMAT: # <<<<<<<<<<<<<< + * self.dtype_is_object = (self.view.format[0] == b'O' and self.view.format[1] == b'\0') + * else: +*/ + __pyx_t_1 = ((__pyx_v_flags & PyBUF_FORMAT) != 0); + if (__pyx_t_1) { + + /* "View.MemoryView":370 + * + * if flags & PyBUF_FORMAT: + * self.dtype_is_object = (self.view.format[0] == b'O' and self.view.format[1] == b'\0') # <<<<<<<<<<<<<< + * else: + * self.dtype_is_object = dtype_is_object +*/ + __pyx_t_2 = ((__pyx_v_self->view.format[0]) == 'O'); + if (__pyx_t_2) { + } else { + __pyx_t_1 = __pyx_t_2; + goto __pyx_L14_bool_binop_done; + } + __pyx_t_2 = ((__pyx_v_self->view.format[1]) == '\x00'); + __pyx_t_1 = __pyx_t_2; + __pyx_L14_bool_binop_done:; + __pyx_v_self->dtype_is_object = __pyx_t_1; + + /* "View.MemoryView":369 + * raise MemoryError + * + * if flags & PyBUF_FORMAT: # <<<<<<<<<<<<<< + * self.dtype_is_object = (self.view.format[0] == b'O' and self.view.format[1] == b'\0') + * else: +*/ + goto __pyx_L13; + } + + /* "View.MemoryView":372 + * self.dtype_is_object = (self.view.format[0] == b'O' and self.view.format[1] == b'\0') + * else: + * self.dtype_is_object = dtype_is_object # <<<<<<<<<<<<<< + * + * assert (&self.acquisition_count) % sizeof(__pyx_atomic_int_type) == 0 +*/ + /*else*/ { + __pyx_v_self->dtype_is_object = __pyx_v_dtype_is_object; + } + __pyx_L13:; + + /* "View.MemoryView":374 + * self.dtype_is_object = dtype_is_object + * + * assert (&self.acquisition_count) % sizeof(__pyx_atomic_int_type) == 0 # <<<<<<<<<<<<<< + * self.typeinfo = NULL + * +*/ + #ifndef CYTHON_WITHOUT_ASSERTIONS + if (unlikely(__pyx_assertions_enabled())) { + __pyx_t_4 = ((Py_intptr_t)((void *)(&__pyx_v_self->acquisition_count))); + __pyx_t_5 = (sizeof(__pyx_atomic_int_type)); + if (unlikely(__pyx_t_5 == 0)) { + PyErr_SetString(PyExc_ZeroDivisionError, "integer division or modulo by zero"); + __PYX_ERR(1, 374, __pyx_L1_error) + } + __pyx_t_1 = ((__pyx_t_4 % __pyx_t_5) == 0); + if (unlikely(!__pyx_t_1)) { + __Pyx_Raise(((PyObject *)(((PyTypeObject*)PyExc_AssertionError))), 0, 0, 0); + __PYX_ERR(1, 374, __pyx_L1_error) + } + } + #else + if ((1)); else __PYX_ERR(1, 374, __pyx_L1_error) + #endif + + /* "View.MemoryView":375 + * + * assert (&self.acquisition_count) % sizeof(__pyx_atomic_int_type) == 0 + * self.typeinfo = NULL # <<<<<<<<<<<<<< + * + * def __dealloc__(memoryview self): +*/ + __pyx_v_self->typeinfo = NULL; + + /* "View.MemoryView":348 + * cdef const __Pyx_TypeInfo *typeinfo + * + * def __cinit__(memoryview self, object obj, int flags, bint dtype_is_object=False): # <<<<<<<<<<<<<< + * self.obj = obj + * self.flags = flags +*/ + + /* function exit code */ + __pyx_r = 0; + goto __pyx_L0; + __pyx_L1_error:; + __Pyx_AddTraceback("View.MemoryView.memoryview.__cinit__", __pyx_clineno, __pyx_lineno, __pyx_filename); + __pyx_r = -1; + __pyx_L0:; + __Pyx_RefNannyFinishContext(); + return __pyx_r; +} + +/* "View.MemoryView":377 + * self.typeinfo = NULL + * + * def __dealloc__(memoryview self): # <<<<<<<<<<<<<< + * if self.obj is not None: + * PyBuffer_Release(&self.view) +*/ + +/* Python wrapper */ +static void __pyx_memoryview___dealloc__(PyObject *__pyx_v_self); /*proto*/ +static void __pyx_memoryview___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_memoryview___pyx_pf_15View_dot_MemoryView_10memoryview_2__dealloc__(((struct __pyx_memoryview_obj *)__pyx_v_self)); + + /* function exit code */ + __Pyx_RefNannyFinishContext(); +} + +static void __pyx_memoryview___pyx_pf_15View_dot_MemoryView_10memoryview_2__dealloc__(struct __pyx_memoryview_obj *__pyx_v_self) { + int __pyx_v_i; + int __pyx_t_1; + Py_ssize_t __pyx_t_2; + Py_ssize_t __pyx_t_3; + int __pyx_t_4; + PyThread_type_lock __pyx_t_5; + PyThread_type_lock __pyx_t_6; + + /* "View.MemoryView":378 + * + * def __dealloc__(memoryview self): + * if self.obj is not None: # <<<<<<<<<<<<<< + * PyBuffer_Release(&self.view) + * elif (<__pyx_buffer *> &self.view).obj == Py_None: +*/ + __pyx_t_1 = (__pyx_v_self->obj != Py_None); + if (__pyx_t_1) { + + /* "View.MemoryView":379 + * def __dealloc__(memoryview self): + * if self.obj is not None: + * PyBuffer_Release(&self.view) # <<<<<<<<<<<<<< + * elif (<__pyx_buffer *> &self.view).obj == Py_None: + * +*/ + PyBuffer_Release((&__pyx_v_self->view)); + + /* "View.MemoryView":378 + * + * def __dealloc__(memoryview self): + * if self.obj is not None: # <<<<<<<<<<<<<< + * PyBuffer_Release(&self.view) + * elif (<__pyx_buffer *> &self.view).obj == Py_None: +*/ + goto __pyx_L3; + } + + /* "View.MemoryView":380 + * if self.obj is not None: + * PyBuffer_Release(&self.view) + * elif (<__pyx_buffer *> &self.view).obj == Py_None: # <<<<<<<<<<<<<< + * + * (<__pyx_buffer *> &self.view).obj = NULL +*/ + __pyx_t_1 = (((Py_buffer *)(&__pyx_v_self->view))->obj == Py_None); + if (__pyx_t_1) { + + /* "View.MemoryView":382 + * elif (<__pyx_buffer *> &self.view).obj == Py_None: + * + * (<__pyx_buffer *> &self.view).obj = NULL # <<<<<<<<<<<<<< + * Py_DECREF(Py_None) + * +*/ + ((Py_buffer *)(&__pyx_v_self->view))->obj = NULL; + + /* "View.MemoryView":383 + * + * (<__pyx_buffer *> &self.view).obj = NULL + * Py_DECREF(Py_None) # <<<<<<<<<<<<<< + * + * cdef int i +*/ + Py_DECREF(Py_None); + + /* "View.MemoryView":380 + * if self.obj is not None: + * PyBuffer_Release(&self.view) + * elif (<__pyx_buffer *> &self.view).obj == Py_None: # <<<<<<<<<<<<<< + * + * (<__pyx_buffer *> &self.view).obj = NULL +*/ + } + __pyx_L3:; + + /* "View.MemoryView":387 + * cdef int i + * global __pyx_memoryview_thread_locks_used + * if self.lock != NULL: # <<<<<<<<<<<<<< + * for i in range(0 if __PYX_GET_CYTHON_COMPILING_IN_CPYTHON_FREETHREADING() else __pyx_memoryview_thread_locks_used): + * if __pyx_memoryview_thread_locks[i] is self.lock: +*/ + __pyx_t_1 = (__pyx_v_self->lock != NULL); + if (__pyx_t_1) { + + /* "View.MemoryView":388 + * global __pyx_memoryview_thread_locks_used + * if self.lock != NULL: + * for i in range(0 if __PYX_GET_CYTHON_COMPILING_IN_CPYTHON_FREETHREADING() else __pyx_memoryview_thread_locks_used): # <<<<<<<<<<<<<< + * if __pyx_memoryview_thread_locks[i] is self.lock: + * __pyx_memoryview_thread_locks_used -= 1 +*/ + __pyx_t_1 = __PYX_GET_CYTHON_COMPILING_IN_CPYTHON_FREETHREADING(); + if (__pyx_t_1) { + __pyx_t_2 = 0; + } else { + __pyx_t_2 = __pyx_memoryview_thread_locks_used; + } + __pyx_t_3 = __pyx_t_2; + for (__pyx_t_4 = 0; __pyx_t_4 < __pyx_t_3; __pyx_t_4+=1) { + __pyx_v_i = __pyx_t_4; + + /* "View.MemoryView":389 + * if self.lock != NULL: + * for i in range(0 if __PYX_GET_CYTHON_COMPILING_IN_CPYTHON_FREETHREADING() else __pyx_memoryview_thread_locks_used): + * if __pyx_memoryview_thread_locks[i] is self.lock: # <<<<<<<<<<<<<< + * __pyx_memoryview_thread_locks_used -= 1 + * if i != __pyx_memoryview_thread_locks_used: +*/ + __pyx_t_1 = ((__pyx_memoryview_thread_locks[__pyx_v_i]) == __pyx_v_self->lock); + if (__pyx_t_1) { + + /* "View.MemoryView":390 + * for i in range(0 if __PYX_GET_CYTHON_COMPILING_IN_CPYTHON_FREETHREADING() else __pyx_memoryview_thread_locks_used): + * if __pyx_memoryview_thread_locks[i] is self.lock: + * __pyx_memoryview_thread_locks_used -= 1 # <<<<<<<<<<<<<< + * if i != __pyx_memoryview_thread_locks_used: + * __pyx_memoryview_thread_locks[i], __pyx_memoryview_thread_locks[__pyx_memoryview_thread_locks_used] = ( +*/ + __pyx_memoryview_thread_locks_used = (__pyx_memoryview_thread_locks_used - 1); + + /* "View.MemoryView":391 + * if __pyx_memoryview_thread_locks[i] is self.lock: + * __pyx_memoryview_thread_locks_used -= 1 + * if i != __pyx_memoryview_thread_locks_used: # <<<<<<<<<<<<<< + * __pyx_memoryview_thread_locks[i], __pyx_memoryview_thread_locks[__pyx_memoryview_thread_locks_used] = ( + * __pyx_memoryview_thread_locks[__pyx_memoryview_thread_locks_used], __pyx_memoryview_thread_locks[i]) +*/ + __pyx_t_1 = (__pyx_v_i != __pyx_memoryview_thread_locks_used); + if (__pyx_t_1) { + + /* "View.MemoryView":393 + * if i != __pyx_memoryview_thread_locks_used: + * __pyx_memoryview_thread_locks[i], __pyx_memoryview_thread_locks[__pyx_memoryview_thread_locks_used] = ( + * __pyx_memoryview_thread_locks[__pyx_memoryview_thread_locks_used], __pyx_memoryview_thread_locks[i]) # <<<<<<<<<<<<<< + * break + * else: +*/ + __pyx_t_5 = (__pyx_memoryview_thread_locks[__pyx_memoryview_thread_locks_used]); + __pyx_t_6 = (__pyx_memoryview_thread_locks[__pyx_v_i]); + + /* "View.MemoryView":392 + * __pyx_memoryview_thread_locks_used -= 1 + * if i != __pyx_memoryview_thread_locks_used: + * __pyx_memoryview_thread_locks[i], __pyx_memoryview_thread_locks[__pyx_memoryview_thread_locks_used] = ( # <<<<<<<<<<<<<< + * __pyx_memoryview_thread_locks[__pyx_memoryview_thread_locks_used], __pyx_memoryview_thread_locks[i]) + * break +*/ + (__pyx_memoryview_thread_locks[__pyx_v_i]) = __pyx_t_5; + (__pyx_memoryview_thread_locks[__pyx_memoryview_thread_locks_used]) = __pyx_t_6; + + /* "View.MemoryView":391 + * if __pyx_memoryview_thread_locks[i] is self.lock: + * __pyx_memoryview_thread_locks_used -= 1 + * if i != __pyx_memoryview_thread_locks_used: # <<<<<<<<<<<<<< + * __pyx_memoryview_thread_locks[i], __pyx_memoryview_thread_locks[__pyx_memoryview_thread_locks_used] = ( + * __pyx_memoryview_thread_locks[__pyx_memoryview_thread_locks_used], __pyx_memoryview_thread_locks[i]) +*/ + } + + /* "View.MemoryView":394 + * __pyx_memoryview_thread_locks[i], __pyx_memoryview_thread_locks[__pyx_memoryview_thread_locks_used] = ( + * __pyx_memoryview_thread_locks[__pyx_memoryview_thread_locks_used], __pyx_memoryview_thread_locks[i]) + * break # <<<<<<<<<<<<<< + * else: + * PyThread_free_lock(self.lock) +*/ + goto __pyx_L6_break; + + /* "View.MemoryView":389 + * if self.lock != NULL: + * for i in range(0 if __PYX_GET_CYTHON_COMPILING_IN_CPYTHON_FREETHREADING() else __pyx_memoryview_thread_locks_used): + * if __pyx_memoryview_thread_locks[i] is self.lock: # <<<<<<<<<<<<<< + * __pyx_memoryview_thread_locks_used -= 1 + * if i != __pyx_memoryview_thread_locks_used: +*/ + } + } + /*else*/ { + + /* "View.MemoryView":396 + * break + * else: + * PyThread_free_lock(self.lock) # <<<<<<<<<<<<<< + * + * cdef char *get_item_pointer(memoryview self, object index) except NULL: +*/ + PyThread_free_lock(__pyx_v_self->lock); + } + __pyx_L6_break:; + + /* "View.MemoryView":387 + * cdef int i + * global __pyx_memoryview_thread_locks_used + * if self.lock != NULL: # <<<<<<<<<<<<<< + * for i in range(0 if __PYX_GET_CYTHON_COMPILING_IN_CPYTHON_FREETHREADING() else __pyx_memoryview_thread_locks_used): + * if __pyx_memoryview_thread_locks[i] is self.lock: +*/ + } + + /* "View.MemoryView":377 + * self.typeinfo = NULL + * + * def __dealloc__(memoryview self): # <<<<<<<<<<<<<< + * if self.obj is not None: + * PyBuffer_Release(&self.view) +*/ + + /* function exit code */ +} + +/* "View.MemoryView":398 + * PyThread_free_lock(self.lock) + * + * cdef char *get_item_pointer(memoryview self, object index) except NULL: # <<<<<<<<<<<<<< + * cdef Py_ssize_t dim + * cdef char *itemp = self.view.buf +*/ + +static char *__pyx_memoryview_get_item_pointer(struct __pyx_memoryview_obj *__pyx_v_self, PyObject *__pyx_v_index) { + Py_ssize_t __pyx_v_dim; + char *__pyx_v_itemp; + PyObject *__pyx_v_idx = NULL; + char *__pyx_r; + __Pyx_RefNannyDeclarations + Py_ssize_t __pyx_t_1; + PyObject *__pyx_t_2 = NULL; + Py_ssize_t __pyx_t_3; + PyObject *(*__pyx_t_4)(PyObject *); + PyObject *__pyx_t_5 = NULL; + Py_ssize_t __pyx_t_6; + char *__pyx_t_7; + int __pyx_lineno = 0; + const char *__pyx_filename = NULL; + int __pyx_clineno = 0; + __Pyx_RefNannySetupContext("get_item_pointer", 0); + + /* "View.MemoryView":400 + * cdef char *get_item_pointer(memoryview self, object index) except NULL: + * cdef Py_ssize_t dim + * cdef char *itemp = self.view.buf # <<<<<<<<<<<<<< + * + * for dim, idx in enumerate(index): +*/ + __pyx_v_itemp = ((char *)__pyx_v_self->view.buf); + + /* "View.MemoryView":402 + * cdef char *itemp = self.view.buf + * + * for dim, idx in enumerate(index): # <<<<<<<<<<<<<< + * itemp = pybuffer_index(&self.view, itemp, idx, dim) + * +*/ + __pyx_t_1 = 0; + if (likely(PyList_CheckExact(__pyx_v_index)) || PyTuple_CheckExact(__pyx_v_index)) { + __pyx_t_2 = __pyx_v_index; __Pyx_INCREF(__pyx_t_2); + __pyx_t_3 = 0; + __pyx_t_4 = NULL; + } else { + __pyx_t_3 = -1; __pyx_t_2 = PyObject_GetIter(__pyx_v_index); if (unlikely(!__pyx_t_2)) __PYX_ERR(1, 402, __pyx_L1_error) + __Pyx_GOTREF(__pyx_t_2); + __pyx_t_4 = (CYTHON_COMPILING_IN_LIMITED_API) ? PyIter_Next : __Pyx_PyObject_GetIterNextFunc(__pyx_t_2); if (unlikely(!__pyx_t_4)) __PYX_ERR(1, 402, __pyx_L1_error) + } + for (;;) { + if (likely(!__pyx_t_4)) { + if (likely(PyList_CheckExact(__pyx_t_2))) { + { + Py_ssize_t __pyx_temp = __Pyx_PyList_GET_SIZE(__pyx_t_2); + #if !CYTHON_ASSUME_SAFE_SIZE + if (unlikely((__pyx_temp < 0))) __PYX_ERR(1, 402, __pyx_L1_error) + #endif + if (__pyx_t_3 >= __pyx_temp) break; + } + __pyx_t_5 = __Pyx_PyList_GetItemRefFast(__pyx_t_2, __pyx_t_3, __Pyx_ReferenceSharing_OwnStrongReference); + ++__pyx_t_3; + } else { + { + Py_ssize_t __pyx_temp = __Pyx_PyTuple_GET_SIZE(__pyx_t_2); + #if !CYTHON_ASSUME_SAFE_SIZE + if (unlikely((__pyx_temp < 0))) __PYX_ERR(1, 402, __pyx_L1_error) + #endif + if (__pyx_t_3 >= __pyx_temp) break; + } + #if CYTHON_ASSUME_SAFE_MACROS && !CYTHON_AVOID_BORROWED_REFS + __pyx_t_5 = __Pyx_NewRef(PyTuple_GET_ITEM(__pyx_t_2, __pyx_t_3)); + #else + __pyx_t_5 = __Pyx_PySequence_ITEM(__pyx_t_2, __pyx_t_3); + #endif + ++__pyx_t_3; + } + if (unlikely(!__pyx_t_5)) __PYX_ERR(1, 402, __pyx_L1_error) + } else { + __pyx_t_5 = __pyx_t_4(__pyx_t_2); + if (unlikely(!__pyx_t_5)) { + PyObject* exc_type = PyErr_Occurred(); + if (exc_type) { + if (unlikely(!__Pyx_PyErr_GivenExceptionMatches(exc_type, PyExc_StopIteration))) __PYX_ERR(1, 402, __pyx_L1_error) + PyErr_Clear(); + } + break; + } + } + __Pyx_GOTREF(__pyx_t_5); + __Pyx_XDECREF_SET(__pyx_v_idx, __pyx_t_5); + __pyx_t_5 = 0; + __pyx_v_dim = __pyx_t_1; + __pyx_t_1 = (__pyx_t_1 + 1); + + /* "View.MemoryView":403 + * + * for dim, idx in enumerate(index): + * itemp = pybuffer_index(&self.view, itemp, idx, dim) # <<<<<<<<<<<<<< + * + * return itemp +*/ + __pyx_t_6 = __Pyx_PyIndex_AsSsize_t(__pyx_v_idx); if (unlikely((__pyx_t_6 == (Py_ssize_t)-1) && PyErr_Occurred())) __PYX_ERR(1, 403, __pyx_L1_error) + __pyx_t_7 = __pyx_pybuffer_index((&__pyx_v_self->view), __pyx_v_itemp, __pyx_t_6, __pyx_v_dim); if (unlikely(__pyx_t_7 == ((void *)NULL))) __PYX_ERR(1, 403, __pyx_L1_error) + __pyx_v_itemp = __pyx_t_7; + + /* "View.MemoryView":402 + * cdef char *itemp = self.view.buf + * + * for dim, idx in enumerate(index): # <<<<<<<<<<<<<< + * itemp = pybuffer_index(&self.view, itemp, idx, dim) + * +*/ + } + __Pyx_DECREF(__pyx_t_2); __pyx_t_2 = 0; + + /* "View.MemoryView":405 + * itemp = pybuffer_index(&self.view, itemp, idx, dim) + * + * return itemp # <<<<<<<<<<<<<< + * + * +*/ + __pyx_r = __pyx_v_itemp; + goto __pyx_L0; + + /* "View.MemoryView":398 + * PyThread_free_lock(self.lock) + * + * cdef char *get_item_pointer(memoryview self, object index) except NULL: # <<<<<<<<<<<<<< + * cdef Py_ssize_t dim + * cdef char *itemp = self.view.buf +*/ + + /* function exit code */ + __pyx_L1_error:; + __Pyx_XDECREF(__pyx_t_2); + __Pyx_XDECREF(__pyx_t_5); + __Pyx_AddTraceback("View.MemoryView.memoryview.get_item_pointer", __pyx_clineno, __pyx_lineno, __pyx_filename); + __pyx_r = NULL; + __pyx_L0:; + __Pyx_XDECREF(__pyx_v_idx); + __Pyx_RefNannyFinishContext(); + return __pyx_r; +} + +/* "View.MemoryView":408 + * + * + * def __getitem__(memoryview self, object index): # <<<<<<<<<<<<<< + * if index is Ellipsis: + * return self +*/ + +/* Python wrapper */ +static PyObject *__pyx_memoryview___getitem__(PyObject *__pyx_v_self, PyObject *__pyx_v_index); /*proto*/ +static PyObject *__pyx_memoryview___getitem__(PyObject *__pyx_v_self, PyObject *__pyx_v_index) { + CYTHON_UNUSED PyObject *const *__pyx_kwvalues; + PyObject *__pyx_r = 0; + __Pyx_RefNannyDeclarations + __Pyx_RefNannySetupContext("__getitem__ (wrapper)", 0); + __pyx_kwvalues = __Pyx_KwValues_VARARGS(__pyx_args, __pyx_nargs); + __pyx_r = __pyx_memoryview___pyx_pf_15View_dot_MemoryView_10memoryview_4__getitem__(((struct __pyx_memoryview_obj *)__pyx_v_self), ((PyObject *)__pyx_v_index)); + + /* function exit code */ + __Pyx_RefNannyFinishContext(); + return __pyx_r; +} + +static PyObject *__pyx_memoryview___pyx_pf_15View_dot_MemoryView_10memoryview_4__getitem__(struct __pyx_memoryview_obj *__pyx_v_self, PyObject *__pyx_v_index) { + PyObject *__pyx_v_have_slices = NULL; + PyObject *__pyx_v_indices = NULL; + char *__pyx_v_itemp; + 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; + char *__pyx_t_5; + int __pyx_lineno = 0; + const char *__pyx_filename = NULL; + int __pyx_clineno = 0; + __Pyx_RefNannySetupContext("__getitem__", 0); + + /* "View.MemoryView":409 + * + * def __getitem__(memoryview self, object index): + * if index is Ellipsis: # <<<<<<<<<<<<<< + * return self + * +*/ + __pyx_t_1 = (__pyx_v_index == __pyx_builtin_Ellipsis); + if (__pyx_t_1) { + + /* "View.MemoryView":410 + * def __getitem__(memoryview self, object index): + * if index is Ellipsis: + * return self # <<<<<<<<<<<<<< + * + * have_slices, indices = _unellipsify(index, self.view.ndim) +*/ + __Pyx_XDECREF(__pyx_r); + __Pyx_INCREF((PyObject *)__pyx_v_self); + __pyx_r = ((PyObject *)__pyx_v_self); + goto __pyx_L0; + + /* "View.MemoryView":409 + * + * def __getitem__(memoryview self, object index): + * if index is Ellipsis: # <<<<<<<<<<<<<< + * return self + * +*/ + } + + /* "View.MemoryView":412 + * return self + * + * have_slices, indices = _unellipsify(index, self.view.ndim) # <<<<<<<<<<<<<< + * + * cdef char *itemp +*/ + __pyx_t_2 = _unellipsify(__pyx_v_index, __pyx_v_self->view.ndim); if (unlikely(!__pyx_t_2)) __PYX_ERR(1, 412, __pyx_L1_error) + __Pyx_GOTREF(__pyx_t_2); + if (likely(__pyx_t_2 != Py_None)) { + PyObject* sequence = __pyx_t_2; + Py_ssize_t size = __Pyx_PyTuple_GET_SIZE(sequence); + if (unlikely(size != 2)) { + if (size > 2) __Pyx_RaiseTooManyValuesError(2); + else if (size >= 0) __Pyx_RaiseNeedMoreValuesError(size); + __PYX_ERR(1, 412, __pyx_L1_error) + } + #if CYTHON_ASSUME_SAFE_MACROS && !CYTHON_AVOID_BORROWED_REFS + __pyx_t_3 = PyTuple_GET_ITEM(sequence, 0); + __Pyx_INCREF(__pyx_t_3); + __pyx_t_4 = PyTuple_GET_ITEM(sequence, 1); + __Pyx_INCREF(__pyx_t_4); + #else + __pyx_t_3 = __Pyx_PySequence_ITEM(sequence, 0); if (unlikely(!__pyx_t_3)) __PYX_ERR(1, 412, __pyx_L1_error) + __Pyx_GOTREF(__pyx_t_3); + __pyx_t_4 = __Pyx_PySequence_ITEM(sequence, 1); if (unlikely(!__pyx_t_4)) __PYX_ERR(1, 412, __pyx_L1_error) + __Pyx_GOTREF(__pyx_t_4); + #endif + __Pyx_DECREF(__pyx_t_2); __pyx_t_2 = 0; + } else { + __Pyx_RaiseNoneNotIterableError(); __PYX_ERR(1, 412, __pyx_L1_error) + } + __pyx_v_have_slices = __pyx_t_3; + __pyx_t_3 = 0; + __pyx_v_indices = __pyx_t_4; + __pyx_t_4 = 0; + + /* "View.MemoryView":415 + * + * cdef char *itemp + * if have_slices: # <<<<<<<<<<<<<< + * return memview_slice(self, indices) + * else: +*/ + __pyx_t_1 = __Pyx_PyObject_IsTrue(__pyx_v_have_slices); if (unlikely((__pyx_t_1 < 0))) __PYX_ERR(1, 415, __pyx_L1_error) + if (__pyx_t_1) { + + /* "View.MemoryView":416 + * cdef char *itemp + * if have_slices: + * return memview_slice(self, indices) # <<<<<<<<<<<<<< + * else: + * itemp = self.get_item_pointer(indices) +*/ + __Pyx_XDECREF(__pyx_r); + __pyx_t_2 = ((PyObject *)__pyx_memview_slice(__pyx_v_self, __pyx_v_indices)); if (unlikely(!__pyx_t_2)) __PYX_ERR(1, 416, __pyx_L1_error) + __Pyx_GOTREF(__pyx_t_2); + __pyx_r = __pyx_t_2; + __pyx_t_2 = 0; + goto __pyx_L0; + + /* "View.MemoryView":415 + * + * cdef char *itemp + * if have_slices: # <<<<<<<<<<<<<< + * return memview_slice(self, indices) + * else: +*/ + } + + /* "View.MemoryView":418 + * return memview_slice(self, indices) + * else: + * itemp = self.get_item_pointer(indices) # <<<<<<<<<<<<<< + * return self.convert_item_to_object(itemp) + * +*/ + /*else*/ { + __pyx_t_5 = ((struct __pyx_vtabstruct_memoryview *)__pyx_v_self->__pyx_vtab)->get_item_pointer(__pyx_v_self, __pyx_v_indices); if (unlikely(__pyx_t_5 == ((void *)NULL))) __PYX_ERR(1, 418, __pyx_L1_error) + __pyx_v_itemp = __pyx_t_5; + + /* "View.MemoryView":419 + * else: + * itemp = self.get_item_pointer(indices) + * return self.convert_item_to_object(itemp) # <<<<<<<<<<<<<< + * + * def __setitem__(memoryview self, object index, object value): +*/ + __Pyx_XDECREF(__pyx_r); + __pyx_t_2 = ((struct __pyx_vtabstruct_memoryview *)__pyx_v_self->__pyx_vtab)->convert_item_to_object(__pyx_v_self, __pyx_v_itemp); if (unlikely(!__pyx_t_2)) __PYX_ERR(1, 419, __pyx_L1_error) + __Pyx_GOTREF(__pyx_t_2); + __pyx_r = __pyx_t_2; + __pyx_t_2 = 0; + goto __pyx_L0; + } + + /* "View.MemoryView":408 + * + * + * def __getitem__(memoryview self, object index): # <<<<<<<<<<<<<< + * if index is Ellipsis: + * return self +*/ + + /* function exit code */ + __pyx_L1_error:; + __Pyx_XDECREF(__pyx_t_2); + __Pyx_XDECREF(__pyx_t_3); + __Pyx_XDECREF(__pyx_t_4); + __Pyx_AddTraceback("View.MemoryView.memoryview.__getitem__", __pyx_clineno, __pyx_lineno, __pyx_filename); + __pyx_r = NULL; + __pyx_L0:; + __Pyx_XDECREF(__pyx_v_have_slices); + __Pyx_XDECREF(__pyx_v_indices); + __Pyx_XGIVEREF(__pyx_r); + __Pyx_RefNannyFinishContext(); + return __pyx_r; +} + +/* "View.MemoryView":421 + * return self.convert_item_to_object(itemp) + * + * def __setitem__(memoryview self, object index, object value): # <<<<<<<<<<<<<< + * if self.view.readonly: + * raise TypeError, "Cannot assign to read-only memoryview" +*/ + +/* Python wrapper */ +static int __pyx_memoryview___setitem__(PyObject *__pyx_v_self, PyObject *__pyx_v_index, PyObject *__pyx_v_value); /*proto*/ +static int __pyx_memoryview___setitem__(PyObject *__pyx_v_self, PyObject *__pyx_v_index, PyObject *__pyx_v_value) { + CYTHON_UNUSED PyObject *const *__pyx_kwvalues; + int __pyx_r; + __Pyx_RefNannyDeclarations + __Pyx_RefNannySetupContext("__setitem__ (wrapper)", 0); + __pyx_kwvalues = __Pyx_KwValues_VARARGS(__pyx_args, __pyx_nargs); + __pyx_r = __pyx_memoryview___pyx_pf_15View_dot_MemoryView_10memoryview_6__setitem__(((struct __pyx_memoryview_obj *)__pyx_v_self), ((PyObject *)__pyx_v_index), ((PyObject *)__pyx_v_value)); + + /* function exit code */ + __Pyx_RefNannyFinishContext(); + return __pyx_r; +} + +static int __pyx_memoryview___pyx_pf_15View_dot_MemoryView_10memoryview_6__setitem__(struct __pyx_memoryview_obj *__pyx_v_self, PyObject *__pyx_v_index, PyObject *__pyx_v_value) { + PyObject *__pyx_v_have_slices = NULL; + PyObject *__pyx_v_obj = NULL; + int __pyx_r; + __Pyx_RefNannyDeclarations + PyObject *__pyx_t_1 = NULL; + PyObject *__pyx_t_2 = NULL; + PyObject *__pyx_t_3 = NULL; + int __pyx_t_4; + int __pyx_lineno = 0; + const char *__pyx_filename = NULL; + int __pyx_clineno = 0; + __Pyx_RefNannySetupContext("__setitem__", 0); + __Pyx_INCREF(__pyx_v_index); + + /* "View.MemoryView":422 + * + * def __setitem__(memoryview self, object index, object value): + * if self.view.readonly: # <<<<<<<<<<<<<< + * raise TypeError, "Cannot assign to read-only memoryview" + * +*/ + if (unlikely(__pyx_v_self->view.readonly)) { + + /* "View.MemoryView":423 + * def __setitem__(memoryview self, object index, object value): + * if self.view.readonly: + * raise TypeError, "Cannot assign to read-only memoryview" # <<<<<<<<<<<<<< + * + * have_slices, index = _unellipsify(index, self.view.ndim) +*/ + __Pyx_Raise(((PyObject *)(((PyTypeObject*)PyExc_TypeError))), __pyx_mstate_global->__pyx_kp_u_Cannot_assign_to_read_only_memor, 0, 0); + __PYX_ERR(1, 423, __pyx_L1_error) + + /* "View.MemoryView":422 + * + * def __setitem__(memoryview self, object index, object value): + * if self.view.readonly: # <<<<<<<<<<<<<< + * raise TypeError, "Cannot assign to read-only memoryview" + * +*/ + } + + /* "View.MemoryView":425 + * raise TypeError, "Cannot assign to read-only memoryview" + * + * have_slices, index = _unellipsify(index, self.view.ndim) # <<<<<<<<<<<<<< + * + * if have_slices: +*/ + __pyx_t_1 = _unellipsify(__pyx_v_index, __pyx_v_self->view.ndim); if (unlikely(!__pyx_t_1)) __PYX_ERR(1, 425, __pyx_L1_error) + __Pyx_GOTREF(__pyx_t_1); + if (likely(__pyx_t_1 != Py_None)) { + PyObject* sequence = __pyx_t_1; + Py_ssize_t size = __Pyx_PyTuple_GET_SIZE(sequence); + if (unlikely(size != 2)) { + if (size > 2) __Pyx_RaiseTooManyValuesError(2); + else if (size >= 0) __Pyx_RaiseNeedMoreValuesError(size); + __PYX_ERR(1, 425, __pyx_L1_error) + } + #if CYTHON_ASSUME_SAFE_MACROS && !CYTHON_AVOID_BORROWED_REFS + __pyx_t_2 = PyTuple_GET_ITEM(sequence, 0); + __Pyx_INCREF(__pyx_t_2); + __pyx_t_3 = PyTuple_GET_ITEM(sequence, 1); + __Pyx_INCREF(__pyx_t_3); + #else + __pyx_t_2 = __Pyx_PySequence_ITEM(sequence, 0); if (unlikely(!__pyx_t_2)) __PYX_ERR(1, 425, __pyx_L1_error) + __Pyx_GOTREF(__pyx_t_2); + __pyx_t_3 = __Pyx_PySequence_ITEM(sequence, 1); if (unlikely(!__pyx_t_3)) __PYX_ERR(1, 425, __pyx_L1_error) + __Pyx_GOTREF(__pyx_t_3); + #endif + __Pyx_DECREF(__pyx_t_1); __pyx_t_1 = 0; + } else { + __Pyx_RaiseNoneNotIterableError(); __PYX_ERR(1, 425, __pyx_L1_error) + } + __pyx_v_have_slices = __pyx_t_2; + __pyx_t_2 = 0; + __Pyx_DECREF_SET(__pyx_v_index, __pyx_t_3); + __pyx_t_3 = 0; + + /* "View.MemoryView":427 + * have_slices, index = _unellipsify(index, self.view.ndim) + * + * if have_slices: # <<<<<<<<<<<<<< + * obj = self.is_slice(value) + * if obj is not None: +*/ + __pyx_t_4 = __Pyx_PyObject_IsTrue(__pyx_v_have_slices); if (unlikely((__pyx_t_4 < 0))) __PYX_ERR(1, 427, __pyx_L1_error) + if (__pyx_t_4) { + + /* "View.MemoryView":428 + * + * if have_slices: + * obj = self.is_slice(value) # <<<<<<<<<<<<<< + * if obj is not None: + * self.setitem_slice_assignment(self[index], obj) +*/ + __pyx_t_1 = ((struct __pyx_vtabstruct_memoryview *)__pyx_v_self->__pyx_vtab)->is_slice(__pyx_v_self, __pyx_v_value); if (unlikely(!__pyx_t_1)) __PYX_ERR(1, 428, __pyx_L1_error) + __Pyx_GOTREF(__pyx_t_1); + __pyx_v_obj = __pyx_t_1; + __pyx_t_1 = 0; + + /* "View.MemoryView":429 + * if have_slices: + * obj = self.is_slice(value) + * if obj is not None: # <<<<<<<<<<<<<< + * self.setitem_slice_assignment(self[index], obj) + * else: +*/ + __pyx_t_4 = (__pyx_v_obj != Py_None); + if (__pyx_t_4) { + + /* "View.MemoryView":430 + * obj = self.is_slice(value) + * if obj is not None: + * self.setitem_slice_assignment(self[index], obj) # <<<<<<<<<<<<<< + * else: + * self.setitem_slice_assign_scalar(self[index], value) +*/ + __pyx_t_1 = __Pyx_PyObject_GetItem(((PyObject *)__pyx_v_self), __pyx_v_index); if (unlikely(!__pyx_t_1)) __PYX_ERR(1, 430, __pyx_L1_error) + __Pyx_GOTREF(__pyx_t_1); + __pyx_t_3 = ((struct __pyx_vtabstruct_memoryview *)__pyx_v_self->__pyx_vtab)->setitem_slice_assignment(__pyx_v_self, __pyx_t_1, __pyx_v_obj); if (unlikely(!__pyx_t_3)) __PYX_ERR(1, 430, __pyx_L1_error) + __Pyx_GOTREF(__pyx_t_3); + __Pyx_DECREF(__pyx_t_1); __pyx_t_1 = 0; + __Pyx_DECREF(__pyx_t_3); __pyx_t_3 = 0; + + /* "View.MemoryView":429 + * if have_slices: + * obj = self.is_slice(value) + * if obj is not None: # <<<<<<<<<<<<<< + * self.setitem_slice_assignment(self[index], obj) + * else: +*/ + goto __pyx_L5; + } + + /* "View.MemoryView":432 + * self.setitem_slice_assignment(self[index], obj) + * else: + * self.setitem_slice_assign_scalar(self[index], value) # <<<<<<<<<<<<<< + * else: + * self.setitem_indexed(index, value) +*/ + /*else*/ { + __pyx_t_3 = __Pyx_PyObject_GetItem(((PyObject *)__pyx_v_self), __pyx_v_index); if (unlikely(!__pyx_t_3)) __PYX_ERR(1, 432, __pyx_L1_error) + __Pyx_GOTREF(__pyx_t_3); + if (!(likely(((__pyx_t_3) == Py_None) || likely(__Pyx_TypeTest(__pyx_t_3, __pyx_mstate_global->__pyx_memoryview_type))))) __PYX_ERR(1, 432, __pyx_L1_error) + __pyx_t_1 = ((struct __pyx_vtabstruct_memoryview *)__pyx_v_self->__pyx_vtab)->setitem_slice_assign_scalar(__pyx_v_self, ((struct __pyx_memoryview_obj *)__pyx_t_3), __pyx_v_value); if (unlikely(!__pyx_t_1)) __PYX_ERR(1, 432, __pyx_L1_error) + __Pyx_GOTREF(__pyx_t_1); + __Pyx_DECREF(__pyx_t_3); __pyx_t_3 = 0; + __Pyx_DECREF(__pyx_t_1); __pyx_t_1 = 0; + } + __pyx_L5:; + + /* "View.MemoryView":427 + * have_slices, index = _unellipsify(index, self.view.ndim) + * + * if have_slices: # <<<<<<<<<<<<<< + * obj = self.is_slice(value) + * if obj is not None: +*/ + goto __pyx_L4; + } + + /* "View.MemoryView":434 + * self.setitem_slice_assign_scalar(self[index], value) + * else: + * self.setitem_indexed(index, value) # <<<<<<<<<<<<<< + * + * cdef is_slice(self, obj): +*/ + /*else*/ { + __pyx_t_1 = ((struct __pyx_vtabstruct_memoryview *)__pyx_v_self->__pyx_vtab)->setitem_indexed(__pyx_v_self, __pyx_v_index, __pyx_v_value); if (unlikely(!__pyx_t_1)) __PYX_ERR(1, 434, __pyx_L1_error) + __Pyx_GOTREF(__pyx_t_1); + __Pyx_DECREF(__pyx_t_1); __pyx_t_1 = 0; + } + __pyx_L4:; + + /* "View.MemoryView":421 + * return self.convert_item_to_object(itemp) + * + * def __setitem__(memoryview self, object index, object value): # <<<<<<<<<<<<<< + * if self.view.readonly: + * raise TypeError, "Cannot assign to read-only memoryview" +*/ + + /* function exit code */ + __pyx_r = 0; + goto __pyx_L0; + __pyx_L1_error:; + __Pyx_XDECREF(__pyx_t_1); + __Pyx_XDECREF(__pyx_t_2); + __Pyx_XDECREF(__pyx_t_3); + __Pyx_AddTraceback("View.MemoryView.memoryview.__setitem__", __pyx_clineno, __pyx_lineno, __pyx_filename); + __pyx_r = -1; + __pyx_L0:; + __Pyx_XDECREF(__pyx_v_have_slices); + __Pyx_XDECREF(__pyx_v_obj); + __Pyx_XDECREF(__pyx_v_index); + __Pyx_RefNannyFinishContext(); + return __pyx_r; +} + +/* "View.MemoryView":436 + * self.setitem_indexed(index, value) + * + * cdef is_slice(self, obj): # <<<<<<<<<<<<<< + * if not isinstance(obj, memoryview): + * try: +*/ + +static PyObject *__pyx_memoryview_is_slice(struct __pyx_memoryview_obj *__pyx_v_self, PyObject *__pyx_v_obj) { + PyObject *__pyx_r = NULL; + __Pyx_RefNannyDeclarations + int __pyx_t_1; + int __pyx_t_2; + PyObject *__pyx_t_3 = NULL; + PyObject *__pyx_t_4 = NULL; + PyObject *__pyx_t_5 = NULL; + PyObject *__pyx_t_6 = NULL; + PyObject *__pyx_t_7 = NULL; + PyObject *__pyx_t_8 = NULL; + PyObject *__pyx_t_9 = NULL; + size_t __pyx_t_10; + int __pyx_t_11; + int __pyx_lineno = 0; + const char *__pyx_filename = NULL; + int __pyx_clineno = 0; + __Pyx_RefNannySetupContext("is_slice", 0); + __Pyx_INCREF(__pyx_v_obj); + + /* "View.MemoryView":437 + * + * cdef is_slice(self, obj): + * if not isinstance(obj, memoryview): # <<<<<<<<<<<<<< + * try: + * obj = memoryview(obj, self.flags & ~PyBUF_WRITABLE | PyBUF_ANY_CONTIGUOUS, +*/ + __pyx_t_1 = __Pyx_TypeCheck(__pyx_v_obj, __pyx_mstate_global->__pyx_memoryview_type); + __pyx_t_2 = (!__pyx_t_1); + if (__pyx_t_2) { + + /* "View.MemoryView":438 + * cdef is_slice(self, obj): + * if not isinstance(obj, memoryview): + * try: # <<<<<<<<<<<<<< + * obj = memoryview(obj, self.flags & ~PyBUF_WRITABLE | PyBUF_ANY_CONTIGUOUS, + * self.dtype_is_object) +*/ + { + __Pyx_PyThreadState_declare + __Pyx_PyThreadState_assign + __Pyx_ExceptionSave(&__pyx_t_3, &__pyx_t_4, &__pyx_t_5); + __Pyx_XGOTREF(__pyx_t_3); + __Pyx_XGOTREF(__pyx_t_4); + __Pyx_XGOTREF(__pyx_t_5); + /*try:*/ { + + /* "View.MemoryView":439 + * if not isinstance(obj, memoryview): + * try: + * obj = memoryview(obj, self.flags & ~PyBUF_WRITABLE | PyBUF_ANY_CONTIGUOUS, # <<<<<<<<<<<<<< + * self.dtype_is_object) + * except TypeError: +*/ + __pyx_t_7 = NULL; + __pyx_t_8 = __Pyx_PyLong_From_int(((__pyx_v_self->flags & (~PyBUF_WRITABLE)) | PyBUF_ANY_CONTIGUOUS)); if (unlikely(!__pyx_t_8)) __PYX_ERR(1, 439, __pyx_L4_error) + __Pyx_GOTREF(__pyx_t_8); + + /* "View.MemoryView":440 + * try: + * obj = memoryview(obj, self.flags & ~PyBUF_WRITABLE | PyBUF_ANY_CONTIGUOUS, + * self.dtype_is_object) # <<<<<<<<<<<<<< + * except TypeError: + * return None +*/ + __pyx_t_9 = __Pyx_PyBool_FromLong(__pyx_v_self->dtype_is_object); if (unlikely(!__pyx_t_9)) __PYX_ERR(1, 440, __pyx_L4_error) + __Pyx_GOTREF(__pyx_t_9); + __pyx_t_10 = 1; + { + PyObject *__pyx_callargs[4] = {__pyx_t_7, __pyx_v_obj, __pyx_t_8, __pyx_t_9}; + __pyx_t_6 = __Pyx_PyObject_FastCall((PyObject*)__pyx_mstate_global->__pyx_memoryview_type, __pyx_callargs+__pyx_t_10, (4-__pyx_t_10) | (__pyx_t_10*__Pyx_PY_VECTORCALL_ARGUMENTS_OFFSET)); + __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; + if (unlikely(!__pyx_t_6)) __PYX_ERR(1, 439, __pyx_L4_error) + __Pyx_GOTREF((PyObject *)__pyx_t_6); + } + __Pyx_DECREF_SET(__pyx_v_obj, ((PyObject *)__pyx_t_6)); + __pyx_t_6 = 0; + + /* "View.MemoryView":438 + * cdef is_slice(self, obj): + * if not isinstance(obj, memoryview): + * try: # <<<<<<<<<<<<<< + * obj = memoryview(obj, self.flags & ~PyBUF_WRITABLE | PyBUF_ANY_CONTIGUOUS, + * self.dtype_is_object) +*/ + } + __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; + goto __pyx_L9_try_end; + __pyx_L4_error:; + __Pyx_XDECREF(__pyx_t_6); __pyx_t_6 = 0; + __Pyx_XDECREF(__pyx_t_7); __pyx_t_7 = 0; + __Pyx_XDECREF(__pyx_t_8); __pyx_t_8 = 0; + __Pyx_XDECREF(__pyx_t_9); __pyx_t_9 = 0; + + /* "View.MemoryView":441 + * obj = memoryview(obj, self.flags & ~PyBUF_WRITABLE | PyBUF_ANY_CONTIGUOUS, + * self.dtype_is_object) + * except TypeError: # <<<<<<<<<<<<<< + * return None + * +*/ + __pyx_t_11 = __Pyx_PyErr_ExceptionMatches(((PyObject *)(((PyTypeObject*)PyExc_TypeError)))); + if (__pyx_t_11) { + __Pyx_ErrRestore(0,0,0); + + /* "View.MemoryView":442 + * self.dtype_is_object) + * except TypeError: + * return None # <<<<<<<<<<<<<< + * + * return obj +*/ + __Pyx_XDECREF(__pyx_r); + __pyx_r = Py_None; __Pyx_INCREF(Py_None); + goto __pyx_L7_except_return; + } + goto __pyx_L6_except_error; + + /* "View.MemoryView":438 + * cdef is_slice(self, obj): + * if not isinstance(obj, memoryview): + * try: # <<<<<<<<<<<<<< + * obj = memoryview(obj, self.flags & ~PyBUF_WRITABLE | PyBUF_ANY_CONTIGUOUS, + * self.dtype_is_object) +*/ + __pyx_L6_except_error:; + __Pyx_XGIVEREF(__pyx_t_3); + __Pyx_XGIVEREF(__pyx_t_4); + __Pyx_XGIVEREF(__pyx_t_5); + __Pyx_ExceptionReset(__pyx_t_3, __pyx_t_4, __pyx_t_5); + goto __pyx_L1_error; + __pyx_L7_except_return:; + __Pyx_XGIVEREF(__pyx_t_3); + __Pyx_XGIVEREF(__pyx_t_4); + __Pyx_XGIVEREF(__pyx_t_5); + __Pyx_ExceptionReset(__pyx_t_3, __pyx_t_4, __pyx_t_5); + goto __pyx_L0; + __pyx_L9_try_end:; + } + + /* "View.MemoryView":437 + * + * cdef is_slice(self, obj): + * if not isinstance(obj, memoryview): # <<<<<<<<<<<<<< + * try: + * obj = memoryview(obj, self.flags & ~PyBUF_WRITABLE | PyBUF_ANY_CONTIGUOUS, +*/ + } + + /* "View.MemoryView":444 + * return None + * + * return obj # <<<<<<<<<<<<<< + * + * cdef setitem_slice_assignment(self, dst, src): +*/ + __Pyx_XDECREF(__pyx_r); + __Pyx_INCREF(__pyx_v_obj); + __pyx_r = __pyx_v_obj; + goto __pyx_L0; + + /* "View.MemoryView":436 + * self.setitem_indexed(index, value) + * + * cdef is_slice(self, obj): # <<<<<<<<<<<<<< + * if not isinstance(obj, memoryview): + * try: +*/ + + /* function exit code */ + __pyx_L1_error:; + __Pyx_XDECREF(__pyx_t_6); + __Pyx_XDECREF(__pyx_t_7); + __Pyx_XDECREF(__pyx_t_8); + __Pyx_XDECREF(__pyx_t_9); + __Pyx_AddTraceback("View.MemoryView.memoryview.is_slice", __pyx_clineno, __pyx_lineno, __pyx_filename); + __pyx_r = 0; + __pyx_L0:; + __Pyx_XDECREF(__pyx_v_obj); + __Pyx_XGIVEREF(__pyx_r); + __Pyx_RefNannyFinishContext(); + return __pyx_r; +} + +/* "View.MemoryView":446 + * return obj + * + * cdef setitem_slice_assignment(self, dst, src): # <<<<<<<<<<<<<< + * cdef __Pyx_memviewslice dst_slice + * cdef __Pyx_memviewslice src_slice +*/ + +static PyObject *__pyx_memoryview_setitem_slice_assignment(struct __pyx_memoryview_obj *__pyx_v_self, PyObject *__pyx_v_dst, PyObject *__pyx_v_src) { + __Pyx_memviewslice __pyx_v_dst_slice; + __Pyx_memviewslice __pyx_v_src_slice; + __Pyx_memviewslice __pyx_v_msrc; + __Pyx_memviewslice __pyx_v_mdst; + PyObject *__pyx_r = NULL; + __Pyx_RefNannyDeclarations + __Pyx_memviewslice *__pyx_t_1; + PyObject *__pyx_t_2 = NULL; + int __pyx_t_3; + int __pyx_t_4; + int __pyx_t_5; + int __pyx_lineno = 0; + const char *__pyx_filename = NULL; + int __pyx_clineno = 0; + __Pyx_RefNannySetupContext("setitem_slice_assignment", 0); + + /* "View.MemoryView":449 + * cdef __Pyx_memviewslice dst_slice + * cdef __Pyx_memviewslice src_slice + * cdef __Pyx_memviewslice msrc = get_slice_from_memview(src, &src_slice)[0] # <<<<<<<<<<<<<< + * cdef __Pyx_memviewslice mdst = get_slice_from_memview(dst, &dst_slice)[0] + * +*/ + if (!(likely(((__pyx_v_src) == Py_None) || likely(__Pyx_TypeTest(__pyx_v_src, __pyx_mstate_global->__pyx_memoryview_type))))) __PYX_ERR(1, 449, __pyx_L1_error) + __pyx_t_1 = __pyx_memoryview_get_slice_from_memoryview(((struct __pyx_memoryview_obj *)__pyx_v_src), (&__pyx_v_src_slice)); if (unlikely(__pyx_t_1 == ((void *)NULL))) __PYX_ERR(1, 449, __pyx_L1_error) + __pyx_v_msrc = (__pyx_t_1[0]); + + /* "View.MemoryView":450 + * cdef __Pyx_memviewslice src_slice + * cdef __Pyx_memviewslice msrc = get_slice_from_memview(src, &src_slice)[0] + * cdef __Pyx_memviewslice mdst = get_slice_from_memview(dst, &dst_slice)[0] # <<<<<<<<<<<<<< + * + * memoryview_copy_contents(msrc, mdst, src.ndim, dst.ndim, self.dtype_is_object) +*/ + if (!(likely(((__pyx_v_dst) == Py_None) || likely(__Pyx_TypeTest(__pyx_v_dst, __pyx_mstate_global->__pyx_memoryview_type))))) __PYX_ERR(1, 450, __pyx_L1_error) + __pyx_t_1 = __pyx_memoryview_get_slice_from_memoryview(((struct __pyx_memoryview_obj *)__pyx_v_dst), (&__pyx_v_dst_slice)); if (unlikely(__pyx_t_1 == ((void *)NULL))) __PYX_ERR(1, 450, __pyx_L1_error) + __pyx_v_mdst = (__pyx_t_1[0]); + + /* "View.MemoryView":452 + * cdef __Pyx_memviewslice mdst = get_slice_from_memview(dst, &dst_slice)[0] + * + * memoryview_copy_contents(msrc, mdst, src.ndim, dst.ndim, self.dtype_is_object) # <<<<<<<<<<<<<< + * + * cdef setitem_slice_assign_scalar(self, memoryview dst, value): +*/ + __pyx_t_2 = __Pyx_PyObject_GetAttrStr(__pyx_v_src, __pyx_mstate_global->__pyx_n_u_ndim); if (unlikely(!__pyx_t_2)) __PYX_ERR(1, 452, __pyx_L1_error) + __Pyx_GOTREF(__pyx_t_2); + __pyx_t_3 = __Pyx_PyLong_As_int(__pyx_t_2); if (unlikely((__pyx_t_3 == (int)-1) && PyErr_Occurred())) __PYX_ERR(1, 452, __pyx_L1_error) + __Pyx_DECREF(__pyx_t_2); __pyx_t_2 = 0; + __pyx_t_2 = __Pyx_PyObject_GetAttrStr(__pyx_v_dst, __pyx_mstate_global->__pyx_n_u_ndim); if (unlikely(!__pyx_t_2)) __PYX_ERR(1, 452, __pyx_L1_error) + __Pyx_GOTREF(__pyx_t_2); + __pyx_t_4 = __Pyx_PyLong_As_int(__pyx_t_2); if (unlikely((__pyx_t_4 == (int)-1) && PyErr_Occurred())) __PYX_ERR(1, 452, __pyx_L1_error) + __Pyx_DECREF(__pyx_t_2); __pyx_t_2 = 0; + __pyx_t_5 = __pyx_memoryview_copy_contents(__pyx_v_msrc, __pyx_v_mdst, __pyx_t_3, __pyx_t_4, __pyx_v_self->dtype_is_object); if (unlikely(__pyx_t_5 == ((int)-1))) __PYX_ERR(1, 452, __pyx_L1_error) + + /* "View.MemoryView":446 + * return obj + * + * cdef setitem_slice_assignment(self, dst, src): # <<<<<<<<<<<<<< + * cdef __Pyx_memviewslice dst_slice + * cdef __Pyx_memviewslice src_slice +*/ + + /* function exit code */ + __pyx_r = Py_None; __Pyx_INCREF(Py_None); + goto __pyx_L0; + __pyx_L1_error:; + __Pyx_XDECREF(__pyx_t_2); + __Pyx_AddTraceback("View.MemoryView.memoryview.setitem_slice_assignment", __pyx_clineno, __pyx_lineno, __pyx_filename); + __pyx_r = 0; + __pyx_L0:; + __Pyx_XGIVEREF(__pyx_r); + __Pyx_RefNannyFinishContext(); + return __pyx_r; +} + +/* "View.MemoryView":454 + * memoryview_copy_contents(msrc, mdst, src.ndim, dst.ndim, self.dtype_is_object) + * + * cdef setitem_slice_assign_scalar(self, memoryview dst, value): # <<<<<<<<<<<<<< + * cdef int array[128] + * cdef void *tmp = NULL +*/ + +static PyObject *__pyx_memoryview_setitem_slice_assign_scalar(struct __pyx_memoryview_obj *__pyx_v_self, struct __pyx_memoryview_obj *__pyx_v_dst, PyObject *__pyx_v_value) { + int __pyx_v_array[128]; + void *__pyx_v_tmp; + void *__pyx_v_item; + __Pyx_memviewslice *__pyx_v_dst_slice; + __Pyx_memviewslice __pyx_v_tmp_slice; + PyObject *__pyx_r = NULL; + __Pyx_RefNannyDeclarations + __Pyx_memviewslice *__pyx_t_1; + int __pyx_t_2; + PyObject *__pyx_t_3 = NULL; + int __pyx_t_4; + int __pyx_t_5; + char const *__pyx_t_6; + PyObject *__pyx_t_7 = NULL; + PyObject *__pyx_t_8 = NULL; + PyObject *__pyx_t_9 = NULL; + PyObject *__pyx_t_10 = NULL; + PyObject *__pyx_t_11 = NULL; + PyObject *__pyx_t_12 = NULL; + int __pyx_lineno = 0; + const char *__pyx_filename = NULL; + int __pyx_clineno = 0; + __Pyx_RefNannySetupContext("setitem_slice_assign_scalar", 0); + + /* "View.MemoryView":456 + * cdef setitem_slice_assign_scalar(self, memoryview dst, value): + * cdef int array[128] + * cdef void *tmp = NULL # <<<<<<<<<<<<<< + * cdef void *item + * +*/ + __pyx_v_tmp = NULL; + + /* "View.MemoryView":461 + * cdef __Pyx_memviewslice *dst_slice + * cdef __Pyx_memviewslice tmp_slice + * dst_slice = get_slice_from_memview(dst, &tmp_slice) # <<<<<<<<<<<<<< + * + * if self.view.itemsize > sizeof(array): +*/ + __pyx_t_1 = __pyx_memoryview_get_slice_from_memoryview(__pyx_v_dst, (&__pyx_v_tmp_slice)); if (unlikely(__pyx_t_1 == ((void *)NULL))) __PYX_ERR(1, 461, __pyx_L1_error) + __pyx_v_dst_slice = __pyx_t_1; + + /* "View.MemoryView":463 + * dst_slice = get_slice_from_memview(dst, &tmp_slice) + * + * if self.view.itemsize > sizeof(array): # <<<<<<<<<<<<<< + * tmp = PyMem_Malloc(self.view.itemsize) + * if tmp == NULL: +*/ + __pyx_t_2 = (((size_t)__pyx_v_self->view.itemsize) > (sizeof(__pyx_v_array))); + if (__pyx_t_2) { + + /* "View.MemoryView":464 + * + * if self.view.itemsize > sizeof(array): + * tmp = PyMem_Malloc(self.view.itemsize) # <<<<<<<<<<<<<< + * if tmp == NULL: + * raise MemoryError +*/ + __pyx_v_tmp = PyMem_Malloc(__pyx_v_self->view.itemsize); + + /* "View.MemoryView":465 + * if self.view.itemsize > sizeof(array): + * tmp = PyMem_Malloc(self.view.itemsize) + * if tmp == NULL: # <<<<<<<<<<<<<< + * raise MemoryError + * item = tmp +*/ + __pyx_t_2 = (__pyx_v_tmp == NULL); + if (unlikely(__pyx_t_2)) { + + /* "View.MemoryView":466 + * tmp = PyMem_Malloc(self.view.itemsize) + * if tmp == NULL: + * raise MemoryError # <<<<<<<<<<<<<< + * item = tmp + * else: +*/ + PyErr_NoMemory(); __PYX_ERR(1, 466, __pyx_L1_error) + + /* "View.MemoryView":465 + * if self.view.itemsize > sizeof(array): + * tmp = PyMem_Malloc(self.view.itemsize) + * if tmp == NULL: # <<<<<<<<<<<<<< + * raise MemoryError + * item = tmp +*/ + } + + /* "View.MemoryView":467 + * if tmp == NULL: + * raise MemoryError + * item = tmp # <<<<<<<<<<<<<< + * else: + * item = array +*/ + __pyx_v_item = __pyx_v_tmp; + + /* "View.MemoryView":463 + * dst_slice = get_slice_from_memview(dst, &tmp_slice) + * + * if self.view.itemsize > sizeof(array): # <<<<<<<<<<<<<< + * tmp = PyMem_Malloc(self.view.itemsize) + * if tmp == NULL: +*/ + goto __pyx_L3; + } + + /* "View.MemoryView":469 + * item = tmp + * else: + * item = array # <<<<<<<<<<<<<< + * + * try: +*/ + /*else*/ { + __pyx_v_item = ((void *)__pyx_v_array); + } + __pyx_L3:; + + /* "View.MemoryView":471 + * item = array + * + * try: # <<<<<<<<<<<<<< + * if self.dtype_is_object: + * ( item)[0] = value +*/ + /*try:*/ { + + /* "View.MemoryView":472 + * + * try: + * if self.dtype_is_object: # <<<<<<<<<<<<<< + * ( item)[0] = value + * else: +*/ + if (__pyx_v_self->dtype_is_object) { + + /* "View.MemoryView":473 + * try: + * if self.dtype_is_object: + * ( item)[0] = value # <<<<<<<<<<<<<< + * else: + * self.assign_item_from_object( item, value) +*/ + (((PyObject **)__pyx_v_item)[0]) = ((PyObject *)__pyx_v_value); + + /* "View.MemoryView":472 + * + * try: + * if self.dtype_is_object: # <<<<<<<<<<<<<< + * ( item)[0] = value + * else: +*/ + goto __pyx_L8; + } + + /* "View.MemoryView":475 + * ( item)[0] = value + * else: + * self.assign_item_from_object( item, value) # <<<<<<<<<<<<<< + * + * +*/ + /*else*/ { + __pyx_t_3 = ((struct __pyx_vtabstruct_memoryview *)__pyx_v_self->__pyx_vtab)->assign_item_from_object(__pyx_v_self, ((char *)__pyx_v_item), __pyx_v_value); if (unlikely(!__pyx_t_3)) __PYX_ERR(1, 475, __pyx_L6_error) + __Pyx_GOTREF(__pyx_t_3); + __Pyx_DECREF(__pyx_t_3); __pyx_t_3 = 0; + } + __pyx_L8:; + + /* "View.MemoryView":479 + * + * + * if self.view.suboffsets != NULL: # <<<<<<<<<<<<<< + * assert_direct_dimensions(self.view.suboffsets, self.view.ndim) + * slice_assign_scalar(dst_slice, dst.view.ndim, self.view.itemsize, +*/ + __pyx_t_2 = (__pyx_v_self->view.suboffsets != NULL); + if (__pyx_t_2) { + + /* "View.MemoryView":480 + * + * if self.view.suboffsets != NULL: + * assert_direct_dimensions(self.view.suboffsets, self.view.ndim) # <<<<<<<<<<<<<< + * slice_assign_scalar(dst_slice, dst.view.ndim, self.view.itemsize, + * item, self.dtype_is_object) +*/ + __pyx_t_4 = assert_direct_dimensions(__pyx_v_self->view.suboffsets, __pyx_v_self->view.ndim); if (unlikely(__pyx_t_4 == ((int)-1))) __PYX_ERR(1, 480, __pyx_L6_error) + + /* "View.MemoryView":479 + * + * + * if self.view.suboffsets != NULL: # <<<<<<<<<<<<<< + * assert_direct_dimensions(self.view.suboffsets, self.view.ndim) + * slice_assign_scalar(dst_slice, dst.view.ndim, self.view.itemsize, +*/ + } + + /* "View.MemoryView":481 + * if self.view.suboffsets != NULL: + * assert_direct_dimensions(self.view.suboffsets, self.view.ndim) + * slice_assign_scalar(dst_slice, dst.view.ndim, self.view.itemsize, # <<<<<<<<<<<<<< + * item, self.dtype_is_object) + * finally: +*/ + __pyx_memoryview_slice_assign_scalar(__pyx_v_dst_slice, __pyx_v_dst->view.ndim, __pyx_v_self->view.itemsize, __pyx_v_item, __pyx_v_self->dtype_is_object); + } + + /* "View.MemoryView":484 + * item, self.dtype_is_object) + * finally: + * PyMem_Free(tmp) # <<<<<<<<<<<<<< + * + * cdef setitem_indexed(self, index, value): +*/ + /*finally:*/ { + /*normal exit:*/{ + PyMem_Free(__pyx_v_tmp); + goto __pyx_L7; + } + __pyx_L6_error:; + /*exception exit:*/{ + __Pyx_PyThreadState_declare + __Pyx_PyThreadState_assign + __pyx_t_7 = 0; __pyx_t_8 = 0; __pyx_t_9 = 0; __pyx_t_10 = 0; __pyx_t_11 = 0; __pyx_t_12 = 0; + __Pyx_XDECREF(__pyx_t_3); __pyx_t_3 = 0; + __Pyx_ExceptionSwap(&__pyx_t_10, &__pyx_t_11, &__pyx_t_12); + if ( unlikely(__Pyx_GetException(&__pyx_t_7, &__pyx_t_8, &__pyx_t_9) < 0)) __Pyx_ErrFetch(&__pyx_t_7, &__pyx_t_8, &__pyx_t_9); + __Pyx_XGOTREF(__pyx_t_7); + __Pyx_XGOTREF(__pyx_t_8); + __Pyx_XGOTREF(__pyx_t_9); + __Pyx_XGOTREF(__pyx_t_10); + __Pyx_XGOTREF(__pyx_t_11); + __Pyx_XGOTREF(__pyx_t_12); + __pyx_t_4 = __pyx_lineno; __pyx_t_5 = __pyx_clineno; __pyx_t_6 = __pyx_filename; + { + PyMem_Free(__pyx_v_tmp); + } + __Pyx_XGIVEREF(__pyx_t_10); + __Pyx_XGIVEREF(__pyx_t_11); + __Pyx_XGIVEREF(__pyx_t_12); + __Pyx_ExceptionReset(__pyx_t_10, __pyx_t_11, __pyx_t_12); + __Pyx_XGIVEREF(__pyx_t_7); + __Pyx_XGIVEREF(__pyx_t_8); + __Pyx_XGIVEREF(__pyx_t_9); + __Pyx_ErrRestore(__pyx_t_7, __pyx_t_8, __pyx_t_9); + __pyx_t_7 = 0; __pyx_t_8 = 0; __pyx_t_9 = 0; __pyx_t_10 = 0; __pyx_t_11 = 0; __pyx_t_12 = 0; + __pyx_lineno = __pyx_t_4; __pyx_clineno = __pyx_t_5; __pyx_filename = __pyx_t_6; + goto __pyx_L1_error; + } + __pyx_L7:; + } + + /* "View.MemoryView":454 + * memoryview_copy_contents(msrc, mdst, src.ndim, dst.ndim, self.dtype_is_object) + * + * cdef setitem_slice_assign_scalar(self, memoryview dst, value): # <<<<<<<<<<<<<< + * cdef int array[128] + * cdef void *tmp = NULL +*/ + + /* function exit code */ + __pyx_r = Py_None; __Pyx_INCREF(Py_None); + goto __pyx_L0; + __pyx_L1_error:; + __Pyx_XDECREF(__pyx_t_3); + __Pyx_AddTraceback("View.MemoryView.memoryview.setitem_slice_assign_scalar", __pyx_clineno, __pyx_lineno, __pyx_filename); + __pyx_r = 0; + __pyx_L0:; + __Pyx_XGIVEREF(__pyx_r); + __Pyx_RefNannyFinishContext(); + return __pyx_r; +} + +/* "View.MemoryView":486 + * PyMem_Free(tmp) + * + * cdef setitem_indexed(self, index, value): # <<<<<<<<<<<<<< + * cdef char *itemp = self.get_item_pointer(index) + * self.assign_item_from_object(itemp, value) +*/ + +static PyObject *__pyx_memoryview_setitem_indexed(struct __pyx_memoryview_obj *__pyx_v_self, PyObject *__pyx_v_index, PyObject *__pyx_v_value) { + char *__pyx_v_itemp; + PyObject *__pyx_r = NULL; + __Pyx_RefNannyDeclarations + char *__pyx_t_1; + PyObject *__pyx_t_2 = NULL; + int __pyx_lineno = 0; + const char *__pyx_filename = NULL; + int __pyx_clineno = 0; + __Pyx_RefNannySetupContext("setitem_indexed", 0); + + /* "View.MemoryView":487 + * + * cdef setitem_indexed(self, index, value): + * cdef char *itemp = self.get_item_pointer(index) # <<<<<<<<<<<<<< + * self.assign_item_from_object(itemp, value) + * +*/ + __pyx_t_1 = ((struct __pyx_vtabstruct_memoryview *)__pyx_v_self->__pyx_vtab)->get_item_pointer(__pyx_v_self, __pyx_v_index); if (unlikely(__pyx_t_1 == ((void *)NULL))) __PYX_ERR(1, 487, __pyx_L1_error) + __pyx_v_itemp = __pyx_t_1; + + /* "View.MemoryView":488 + * cdef setitem_indexed(self, index, value): + * cdef char *itemp = self.get_item_pointer(index) + * self.assign_item_from_object(itemp, value) # <<<<<<<<<<<<<< + * + * cdef convert_item_to_object(self, char *itemp): +*/ + __pyx_t_2 = ((struct __pyx_vtabstruct_memoryview *)__pyx_v_self->__pyx_vtab)->assign_item_from_object(__pyx_v_self, __pyx_v_itemp, __pyx_v_value); if (unlikely(!__pyx_t_2)) __PYX_ERR(1, 488, __pyx_L1_error) + __Pyx_GOTREF(__pyx_t_2); + __Pyx_DECREF(__pyx_t_2); __pyx_t_2 = 0; + + /* "View.MemoryView":486 + * PyMem_Free(tmp) + * + * cdef setitem_indexed(self, index, value): # <<<<<<<<<<<<<< + * cdef char *itemp = self.get_item_pointer(index) + * self.assign_item_from_object(itemp, value) +*/ + + /* function exit code */ + __pyx_r = Py_None; __Pyx_INCREF(Py_None); + goto __pyx_L0; + __pyx_L1_error:; + __Pyx_XDECREF(__pyx_t_2); + __Pyx_AddTraceback("View.MemoryView.memoryview.setitem_indexed", __pyx_clineno, __pyx_lineno, __pyx_filename); + __pyx_r = 0; + __pyx_L0:; + __Pyx_XGIVEREF(__pyx_r); + __Pyx_RefNannyFinishContext(); + return __pyx_r; +} + +/* "View.MemoryView":490 + * self.assign_item_from_object(itemp, value) + * + * cdef convert_item_to_object(self, char *itemp): # <<<<<<<<<<<<<< + * """Only used if instantiated manually by the user, or if Cython doesn't + * know how to convert the type""" +*/ + +static PyObject *__pyx_memoryview_convert_item_to_object(struct __pyx_memoryview_obj *__pyx_v_self, char *__pyx_v_itemp) { + PyObject *__pyx_v_struct = NULL; + PyObject *__pyx_v_bytesitem = 0; + PyObject *__pyx_v_result = NULL; + PyObject *__pyx_r = NULL; + __Pyx_RefNannyDeclarations + PyObject *__pyx_t_1 = NULL; + PyObject *__pyx_t_2 = NULL; + PyObject *__pyx_t_3 = NULL; + PyObject *__pyx_t_4 = NULL; + PyObject *__pyx_t_5 = NULL; + PyObject *__pyx_t_6 = NULL; + size_t __pyx_t_7; + Py_ssize_t __pyx_t_8; + int __pyx_t_9; + PyObject *__pyx_t_10 = NULL; + int __pyx_t_11; + int __pyx_lineno = 0; + const char *__pyx_filename = NULL; + int __pyx_clineno = 0; + __Pyx_RefNannySetupContext("convert_item_to_object", 0); + + /* "View.MemoryView":493 + * """Only used if instantiated manually by the user, or if Cython doesn't + * know how to convert the type""" + * import struct # <<<<<<<<<<<<<< + * cdef bytes bytesitem + * +*/ + __pyx_t_2 = __Pyx_Import(__pyx_mstate_global->__pyx_n_u_struct, 0, 0, NULL, 0); if (unlikely(!__pyx_t_2)) __PYX_ERR(1, 493, __pyx_L1_error) + __pyx_t_1 = __pyx_t_2; + __Pyx_GOTREF(__pyx_t_1); + __pyx_v_struct = __pyx_t_1; + __pyx_t_1 = 0; + + /* "View.MemoryView":496 + * cdef bytes bytesitem + * + * bytesitem = itemp[:self.view.itemsize] # <<<<<<<<<<<<<< + * try: + * result = struct.unpack(self.view.format, bytesitem) +*/ + __pyx_t_1 = __Pyx_PyBytes_FromStringAndSize(__pyx_v_itemp + 0, __pyx_v_self->view.itemsize - 0); if (unlikely(!__pyx_t_1)) __PYX_ERR(1, 496, __pyx_L1_error) + __Pyx_GOTREF(__pyx_t_1); + __pyx_v_bytesitem = ((PyObject*)__pyx_t_1); + __pyx_t_1 = 0; + + /* "View.MemoryView":497 + * + * bytesitem = itemp[:self.view.itemsize] + * try: # <<<<<<<<<<<<<< + * result = struct.unpack(self.view.format, bytesitem) + * except struct.error: +*/ + { + __Pyx_PyThreadState_declare + __Pyx_PyThreadState_assign + __Pyx_ExceptionSave(&__pyx_t_2, &__pyx_t_3, &__pyx_t_4); + __Pyx_XGOTREF(__pyx_t_2); + __Pyx_XGOTREF(__pyx_t_3); + __Pyx_XGOTREF(__pyx_t_4); + /*try:*/ { + + /* "View.MemoryView":498 + * bytesitem = itemp[:self.view.itemsize] + * try: + * result = struct.unpack(self.view.format, bytesitem) # <<<<<<<<<<<<<< + * except struct.error: + * raise ValueError, "Unable to convert item to object" +*/ + __pyx_t_5 = __pyx_v_struct; + __Pyx_INCREF(__pyx_t_5); + __pyx_t_6 = __Pyx_PyBytes_FromString(__pyx_v_self->view.format); if (unlikely(!__pyx_t_6)) __PYX_ERR(1, 498, __pyx_L3_error) + __Pyx_GOTREF(__pyx_t_6); + __pyx_t_7 = 0; + { + PyObject *__pyx_callargs[3] = {__pyx_t_5, __pyx_t_6, __pyx_v_bytesitem}; + __pyx_t_1 = __Pyx_PyObject_FastCallMethod((PyObject*)__pyx_mstate_global->__pyx_n_u_unpack, __pyx_callargs+__pyx_t_7, (3-__pyx_t_7) | (1*__Pyx_PY_VECTORCALL_ARGUMENTS_OFFSET)); + __Pyx_XDECREF(__pyx_t_5); __pyx_t_5 = 0; + __Pyx_DECREF(__pyx_t_6); __pyx_t_6 = 0; + if (unlikely(!__pyx_t_1)) __PYX_ERR(1, 498, __pyx_L3_error) + __Pyx_GOTREF(__pyx_t_1); + } + __pyx_v_result = __pyx_t_1; + __pyx_t_1 = 0; + + /* "View.MemoryView":497 + * + * bytesitem = itemp[:self.view.itemsize] + * try: # <<<<<<<<<<<<<< + * result = struct.unpack(self.view.format, bytesitem) + * except struct.error: +*/ + } + + /* "View.MemoryView":502 + * raise ValueError, "Unable to convert item to object" + * else: + * if len(self.view.format) == 1: # <<<<<<<<<<<<<< + * return result[0] + * return result +*/ + /*else:*/ { + __pyx_t_8 = __Pyx_ssize_strlen(__pyx_v_self->view.format); if (unlikely(__pyx_t_8 == ((Py_ssize_t)-1))) __PYX_ERR(1, 502, __pyx_L5_except_error) + __pyx_t_9 = (__pyx_t_8 == 1); + if (__pyx_t_9) { + + /* "View.MemoryView":503 + * else: + * if len(self.view.format) == 1: + * return result[0] # <<<<<<<<<<<<<< + * return result + * +*/ + __Pyx_XDECREF(__pyx_r); + __pyx_t_1 = __Pyx_GetItemInt(__pyx_v_result, 0, long, 1, __Pyx_PyLong_From_long, 0, 0, 1, 1, __Pyx_ReferenceSharing_OwnStrongReference); if (unlikely(!__pyx_t_1)) __PYX_ERR(1, 503, __pyx_L5_except_error) + __Pyx_GOTREF(__pyx_t_1); + __pyx_r = __pyx_t_1; + __pyx_t_1 = 0; + goto __pyx_L6_except_return; + + /* "View.MemoryView":502 + * raise ValueError, "Unable to convert item to object" + * else: + * if len(self.view.format) == 1: # <<<<<<<<<<<<<< + * return result[0] + * return result +*/ + } + + /* "View.MemoryView":504 + * if len(self.view.format) == 1: + * return result[0] + * return result # <<<<<<<<<<<<<< + * + * cdef assign_item_from_object(self, char *itemp, object value): +*/ + __Pyx_XDECREF(__pyx_r); + __Pyx_INCREF(__pyx_v_result); + __pyx_r = __pyx_v_result; + goto __pyx_L6_except_return; + } + __pyx_L3_error:; + __Pyx_XDECREF(__pyx_t_1); __pyx_t_1 = 0; + __Pyx_XDECREF(__pyx_t_5); __pyx_t_5 = 0; + __Pyx_XDECREF(__pyx_t_6); __pyx_t_6 = 0; + + /* "View.MemoryView":499 + * try: + * result = struct.unpack(self.view.format, bytesitem) + * except struct.error: # <<<<<<<<<<<<<< + * raise ValueError, "Unable to convert item to object" + * else: +*/ + __Pyx_ErrFetch(&__pyx_t_1, &__pyx_t_6, &__pyx_t_5); + __pyx_t_10 = __Pyx_PyObject_GetAttrStr(__pyx_v_struct, __pyx_mstate_global->__pyx_n_u_error); if (unlikely(!__pyx_t_10)) __PYX_ERR(1, 499, __pyx_L5_except_error) + __Pyx_GOTREF(__pyx_t_10); + __pyx_t_11 = __Pyx_PyErr_GivenExceptionMatches(__pyx_t_1, __pyx_t_10); + __Pyx_DECREF(__pyx_t_10); __pyx_t_10 = 0; + __Pyx_ErrRestore(__pyx_t_1, __pyx_t_6, __pyx_t_5); + __pyx_t_1 = 0; __pyx_t_6 = 0; __pyx_t_5 = 0; + if (__pyx_t_11) { + __Pyx_AddTraceback("View.MemoryView.memoryview.convert_item_to_object", __pyx_clineno, __pyx_lineno, __pyx_filename); + if (__Pyx_GetException(&__pyx_t_5, &__pyx_t_6, &__pyx_t_1) < 0) __PYX_ERR(1, 499, __pyx_L5_except_error) + __Pyx_XGOTREF(__pyx_t_5); + __Pyx_XGOTREF(__pyx_t_6); + __Pyx_XGOTREF(__pyx_t_1); + + /* "View.MemoryView":500 + * result = struct.unpack(self.view.format, bytesitem) + * except struct.error: + * raise ValueError, "Unable to convert item to object" # <<<<<<<<<<<<<< + * else: + * if len(self.view.format) == 1: +*/ + __Pyx_Raise(((PyObject *)(((PyTypeObject*)PyExc_ValueError))), __pyx_mstate_global->__pyx_kp_u_Unable_to_convert_item_to_object, 0, 0); + __PYX_ERR(1, 500, __pyx_L5_except_error) + } + goto __pyx_L5_except_error; + + /* "View.MemoryView":497 + * + * bytesitem = itemp[:self.view.itemsize] + * try: # <<<<<<<<<<<<<< + * result = struct.unpack(self.view.format, bytesitem) + * except struct.error: +*/ + __pyx_L5_except_error:; + __Pyx_XGIVEREF(__pyx_t_2); + __Pyx_XGIVEREF(__pyx_t_3); + __Pyx_XGIVEREF(__pyx_t_4); + __Pyx_ExceptionReset(__pyx_t_2, __pyx_t_3, __pyx_t_4); + goto __pyx_L1_error; + __pyx_L6_except_return:; + __Pyx_XGIVEREF(__pyx_t_2); + __Pyx_XGIVEREF(__pyx_t_3); + __Pyx_XGIVEREF(__pyx_t_4); + __Pyx_ExceptionReset(__pyx_t_2, __pyx_t_3, __pyx_t_4); + goto __pyx_L0; + } + + /* "View.MemoryView":490 + * self.assign_item_from_object(itemp, value) + * + * cdef convert_item_to_object(self, char *itemp): # <<<<<<<<<<<<<< + * """Only used if instantiated manually by the user, or if Cython doesn't + * know how to convert the type""" +*/ + + /* function exit code */ + __pyx_L1_error:; + __Pyx_XDECREF(__pyx_t_1); + __Pyx_XDECREF(__pyx_t_5); + __Pyx_XDECREF(__pyx_t_6); + __Pyx_XDECREF(__pyx_t_10); + __Pyx_AddTraceback("View.MemoryView.memoryview.convert_item_to_object", __pyx_clineno, __pyx_lineno, __pyx_filename); + __pyx_r = 0; + __pyx_L0:; + __Pyx_XDECREF(__pyx_v_struct); + __Pyx_XDECREF(__pyx_v_bytesitem); + __Pyx_XDECREF(__pyx_v_result); + __Pyx_XGIVEREF(__pyx_r); + __Pyx_RefNannyFinishContext(); + return __pyx_r; +} + +/* "View.MemoryView":506 + * return result + * + * cdef assign_item_from_object(self, char *itemp, object value): # <<<<<<<<<<<<<< + * """Only used if instantiated manually by the user, or if Cython doesn't + * know how to convert the type""" +*/ + +static PyObject *__pyx_memoryview_assign_item_from_object(struct __pyx_memoryview_obj *__pyx_v_self, char *__pyx_v_itemp, PyObject *__pyx_v_value) { + PyObject *__pyx_v_struct = NULL; + char __pyx_v_c; + PyObject *__pyx_v_bytesvalue = 0; + Py_ssize_t __pyx_v_i; + PyObject *__pyx_r = NULL; + __Pyx_RefNannyDeclarations + PyObject *__pyx_t_1 = NULL; + PyObject *__pyx_t_2 = NULL; + int __pyx_t_3; + PyObject *__pyx_t_4 = NULL; + PyObject *__pyx_t_5 = NULL; + PyObject *__pyx_t_6 = NULL; + size_t __pyx_t_7; + Py_ssize_t __pyx_t_8; + PyObject *__pyx_t_9 = NULL; + char *__pyx_t_10; + char *__pyx_t_11; + Py_ssize_t __pyx_t_12; + char *__pyx_t_13; + char *__pyx_t_14; + int __pyx_lineno = 0; + const char *__pyx_filename = NULL; + int __pyx_clineno = 0; + __Pyx_RefNannySetupContext("assign_item_from_object", 0); + + /* "View.MemoryView":509 + * """Only used if instantiated manually by the user, or if Cython doesn't + * know how to convert the type""" + * import struct # <<<<<<<<<<<<<< + * cdef char c + * cdef bytes bytesvalue +*/ + __pyx_t_2 = __Pyx_Import(__pyx_mstate_global->__pyx_n_u_struct, 0, 0, NULL, 0); if (unlikely(!__pyx_t_2)) __PYX_ERR(1, 509, __pyx_L1_error) + __pyx_t_1 = __pyx_t_2; + __Pyx_GOTREF(__pyx_t_1); + __pyx_v_struct = __pyx_t_1; + __pyx_t_1 = 0; + + /* "View.MemoryView":514 + * cdef Py_ssize_t i + * + * if isinstance(value, tuple): # <<<<<<<<<<<<<< + * bytesvalue = struct.pack(self.view.format, *value) + * else: +*/ + __pyx_t_3 = PyTuple_Check(__pyx_v_value); + if (__pyx_t_3) { + + /* "View.MemoryView":515 + * + * if isinstance(value, tuple): + * bytesvalue = struct.pack(self.view.format, *value) # <<<<<<<<<<<<<< + * else: + * bytesvalue = struct.pack(self.view.format, value) +*/ + __pyx_t_1 = __Pyx_PyObject_GetAttrStr(__pyx_v_struct, __pyx_mstate_global->__pyx_n_u_pack); if (unlikely(!__pyx_t_1)) __PYX_ERR(1, 515, __pyx_L1_error) + __Pyx_GOTREF(__pyx_t_1); + __pyx_t_4 = __Pyx_PyBytes_FromString(__pyx_v_self->view.format); if (unlikely(!__pyx_t_4)) __PYX_ERR(1, 515, __pyx_L1_error) + __Pyx_GOTREF(__pyx_t_4); + __pyx_t_5 = PyTuple_New(1); if (unlikely(!__pyx_t_5)) __PYX_ERR(1, 515, __pyx_L1_error) + __Pyx_GOTREF(__pyx_t_5); + __Pyx_GIVEREF(__pyx_t_4); + if (__Pyx_PyTuple_SET_ITEM(__pyx_t_5, 0, __pyx_t_4) != (0)) __PYX_ERR(1, 515, __pyx_L1_error); + __pyx_t_4 = 0; + __pyx_t_4 = __Pyx_PySequence_Tuple(__pyx_v_value); if (unlikely(!__pyx_t_4)) __PYX_ERR(1, 515, __pyx_L1_error) + __Pyx_GOTREF(__pyx_t_4); + __pyx_t_6 = PyNumber_Add(__pyx_t_5, __pyx_t_4); if (unlikely(!__pyx_t_6)) __PYX_ERR(1, 515, __pyx_L1_error) + __Pyx_GOTREF(__pyx_t_6); + __Pyx_DECREF(__pyx_t_5); __pyx_t_5 = 0; + __Pyx_DECREF(__pyx_t_4); __pyx_t_4 = 0; + __pyx_t_4 = __Pyx_PyObject_Call(__pyx_t_1, __pyx_t_6, NULL); if (unlikely(!__pyx_t_4)) __PYX_ERR(1, 515, __pyx_L1_error) + __Pyx_GOTREF(__pyx_t_4); + __Pyx_DECREF(__pyx_t_1); __pyx_t_1 = 0; + __Pyx_DECREF(__pyx_t_6); __pyx_t_6 = 0; + if (!(likely(PyBytes_CheckExact(__pyx_t_4))||((__pyx_t_4) == Py_None) || __Pyx_RaiseUnexpectedTypeError("bytes", __pyx_t_4))) __PYX_ERR(1, 515, __pyx_L1_error) + __pyx_v_bytesvalue = ((PyObject*)__pyx_t_4); + __pyx_t_4 = 0; + + /* "View.MemoryView":514 + * cdef Py_ssize_t i + * + * if isinstance(value, tuple): # <<<<<<<<<<<<<< + * bytesvalue = struct.pack(self.view.format, *value) + * else: +*/ + goto __pyx_L3; + } + + /* "View.MemoryView":517 + * bytesvalue = struct.pack(self.view.format, *value) + * else: + * bytesvalue = struct.pack(self.view.format, value) # <<<<<<<<<<<<<< + * + * for i, c in enumerate(bytesvalue): +*/ + /*else*/ { + __pyx_t_6 = __pyx_v_struct; + __Pyx_INCREF(__pyx_t_6); + __pyx_t_1 = __Pyx_PyBytes_FromString(__pyx_v_self->view.format); if (unlikely(!__pyx_t_1)) __PYX_ERR(1, 517, __pyx_L1_error) + __Pyx_GOTREF(__pyx_t_1); + __pyx_t_7 = 0; + { + PyObject *__pyx_callargs[3] = {__pyx_t_6, __pyx_t_1, __pyx_v_value}; + __pyx_t_4 = __Pyx_PyObject_FastCallMethod((PyObject*)__pyx_mstate_global->__pyx_n_u_pack, __pyx_callargs+__pyx_t_7, (3-__pyx_t_7) | (1*__Pyx_PY_VECTORCALL_ARGUMENTS_OFFSET)); + __Pyx_XDECREF(__pyx_t_6); __pyx_t_6 = 0; + __Pyx_DECREF(__pyx_t_1); __pyx_t_1 = 0; + if (unlikely(!__pyx_t_4)) __PYX_ERR(1, 517, __pyx_L1_error) + __Pyx_GOTREF(__pyx_t_4); + } + if (!(likely(PyBytes_CheckExact(__pyx_t_4))||((__pyx_t_4) == Py_None) || __Pyx_RaiseUnexpectedTypeError("bytes", __pyx_t_4))) __PYX_ERR(1, 517, __pyx_L1_error) + __pyx_v_bytesvalue = ((PyObject*)__pyx_t_4); + __pyx_t_4 = 0; + } + __pyx_L3:; + + /* "View.MemoryView":519 + * bytesvalue = struct.pack(self.view.format, value) + * + * for i, c in enumerate(bytesvalue): # <<<<<<<<<<<<<< + * itemp[i] = c + * +*/ + __pyx_t_8 = 0; + if (unlikely(__pyx_v_bytesvalue == Py_None)) { + PyErr_SetString(PyExc_TypeError, "'NoneType' is not iterable"); + __PYX_ERR(1, 519, __pyx_L1_error) + } + __Pyx_INCREF(__pyx_v_bytesvalue); + __pyx_t_9 = __pyx_v_bytesvalue; + __pyx_t_11 = __Pyx_PyBytes_AsWritableString(__pyx_t_9); if (unlikely(__pyx_t_11 == ((char *)NULL))) __PYX_ERR(1, 519, __pyx_L1_error) + __pyx_t_12 = __Pyx_PyBytes_GET_SIZE(__pyx_t_9); if (unlikely(__pyx_t_12 == ((Py_ssize_t)-1))) __PYX_ERR(1, 519, __pyx_L1_error) + __pyx_t_13 = (__pyx_t_11 + __pyx_t_12); + for (__pyx_t_14 = __pyx_t_11; __pyx_t_14 < __pyx_t_13; __pyx_t_14++) { + __pyx_t_10 = __pyx_t_14; + __pyx_v_c = (__pyx_t_10[0]); + + /* "View.MemoryView":520 + * + * for i, c in enumerate(bytesvalue): + * itemp[i] = c # <<<<<<<<<<<<<< + * + * @cname('getbuffer') +*/ + __pyx_v_i = __pyx_t_8; + + /* "View.MemoryView":519 + * bytesvalue = struct.pack(self.view.format, value) + * + * for i, c in enumerate(bytesvalue): # <<<<<<<<<<<<<< + * itemp[i] = c + * +*/ + __pyx_t_8 = (__pyx_t_8 + 1); + + /* "View.MemoryView":520 + * + * for i, c in enumerate(bytesvalue): + * itemp[i] = c # <<<<<<<<<<<<<< + * + * @cname('getbuffer') +*/ + (__pyx_v_itemp[__pyx_v_i]) = __pyx_v_c; + } + __Pyx_DECREF(__pyx_t_9); __pyx_t_9 = 0; + + /* "View.MemoryView":506 + * return result + * + * cdef assign_item_from_object(self, char *itemp, object value): # <<<<<<<<<<<<<< + * """Only used if instantiated manually by the user, or if Cython doesn't + * know how to convert the 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_4); + __Pyx_XDECREF(__pyx_t_5); + __Pyx_XDECREF(__pyx_t_6); + __Pyx_XDECREF(__pyx_t_9); + __Pyx_AddTraceback("View.MemoryView.memoryview.assign_item_from_object", __pyx_clineno, __pyx_lineno, __pyx_filename); + __pyx_r = 0; + __pyx_L0:; + __Pyx_XDECREF(__pyx_v_struct); + __Pyx_XDECREF(__pyx_v_bytesvalue); + __Pyx_XGIVEREF(__pyx_r); + __Pyx_RefNannyFinishContext(); + return __pyx_r; +} + +/* "View.MemoryView":522 + * itemp[i] = c + * + * @cname('getbuffer') # <<<<<<<<<<<<<< + * def __getbuffer__(self, Py_buffer *info, int flags): + * if flags & PyBUF_WRITABLE and self.view.readonly: +*/ + +/* Python wrapper */ +CYTHON_UNUSED static int __pyx_memoryview_getbuffer(PyObject *__pyx_v_self, Py_buffer *__pyx_v_info, int __pyx_v_flags); /*proto*/ +CYTHON_UNUSED static int __pyx_memoryview_getbuffer(PyObject *__pyx_v_self, Py_buffer *__pyx_v_info, int __pyx_v_flags) { + CYTHON_UNUSED PyObject *const *__pyx_kwvalues; + int __pyx_r; + __Pyx_RefNannyDeclarations + __Pyx_RefNannySetupContext("__getbuffer__ (wrapper)", 0); + __pyx_kwvalues = __Pyx_KwValues_VARARGS(__pyx_args, __pyx_nargs); + __pyx_r = __pyx_memoryview___pyx_pf_15View_dot_MemoryView_10memoryview_8__getbuffer__(((struct __pyx_memoryview_obj *)__pyx_v_self), ((Py_buffer *)__pyx_v_info), ((int)__pyx_v_flags)); + + /* function exit code */ + __Pyx_RefNannyFinishContext(); + return __pyx_r; +} + +static int __pyx_memoryview___pyx_pf_15View_dot_MemoryView_10memoryview_8__getbuffer__(struct __pyx_memoryview_obj *__pyx_v_self, Py_buffer *__pyx_v_info, int __pyx_v_flags) { + int __pyx_r; + __Pyx_RefNannyDeclarations + int __pyx_t_1; + int __pyx_t_2; + Py_ssize_t *__pyx_t_3; + char *__pyx_t_4; + void *__pyx_t_5; + int __pyx_t_6; + Py_ssize_t __pyx_t_7; + int __pyx_lineno = 0; + const char *__pyx_filename = NULL; + int __pyx_clineno = 0; + if (unlikely(__pyx_v_info == NULL)) { + PyErr_SetString(PyExc_BufferError, "PyObject_GetBuffer: view==NULL argument is obsolete"); + return -1; + } + __Pyx_RefNannySetupContext("__getbuffer__", 0); + __pyx_v_info->obj = Py_None; __Pyx_INCREF(Py_None); + __Pyx_GIVEREF(__pyx_v_info->obj); + + /* "View.MemoryView":524 + * @cname('getbuffer') + * def __getbuffer__(self, Py_buffer *info, int flags): + * if flags & PyBUF_WRITABLE and self.view.readonly: # <<<<<<<<<<<<<< + * raise ValueError, "Cannot create writable memory view from read-only memoryview" + * +*/ + __pyx_t_2 = ((__pyx_v_flags & PyBUF_WRITABLE) != 0); + if (__pyx_t_2) { + } else { + __pyx_t_1 = __pyx_t_2; + goto __pyx_L4_bool_binop_done; + } + __pyx_t_1 = __pyx_v_self->view.readonly; + __pyx_L4_bool_binop_done:; + if (unlikely(__pyx_t_1)) { + + /* "View.MemoryView":525 + * def __getbuffer__(self, Py_buffer *info, int flags): + * if flags & PyBUF_WRITABLE and self.view.readonly: + * raise ValueError, "Cannot create writable memory view from read-only memoryview" # <<<<<<<<<<<<<< + * + * if flags & PyBUF_ND: +*/ + __Pyx_Raise(((PyObject *)(((PyTypeObject*)PyExc_ValueError))), __pyx_mstate_global->__pyx_kp_u_Cannot_create_writable_memory_vi, 0, 0); + __PYX_ERR(1, 525, __pyx_L1_error) + + /* "View.MemoryView":524 + * @cname('getbuffer') + * def __getbuffer__(self, Py_buffer *info, int flags): + * if flags & PyBUF_WRITABLE and self.view.readonly: # <<<<<<<<<<<<<< + * raise ValueError, "Cannot create writable memory view from read-only memoryview" + * +*/ + } + + /* "View.MemoryView":527 + * raise ValueError, "Cannot create writable memory view from read-only memoryview" + * + * if flags & PyBUF_ND: # <<<<<<<<<<<<<< + * info.shape = self.view.shape + * else: +*/ + __pyx_t_1 = ((__pyx_v_flags & PyBUF_ND) != 0); + if (__pyx_t_1) { + + /* "View.MemoryView":528 + * + * if flags & PyBUF_ND: + * info.shape = self.view.shape # <<<<<<<<<<<<<< + * else: + * info.shape = NULL +*/ + __pyx_t_3 = __pyx_v_self->view.shape; + __pyx_v_info->shape = __pyx_t_3; + + /* "View.MemoryView":527 + * raise ValueError, "Cannot create writable memory view from read-only memoryview" + * + * if flags & PyBUF_ND: # <<<<<<<<<<<<<< + * info.shape = self.view.shape + * else: +*/ + goto __pyx_L6; + } + + /* "View.MemoryView":530 + * info.shape = self.view.shape + * else: + * info.shape = NULL # <<<<<<<<<<<<<< + * + * if flags & PyBUF_STRIDES: +*/ + /*else*/ { + __pyx_v_info->shape = NULL; + } + __pyx_L6:; + + /* "View.MemoryView":532 + * info.shape = NULL + * + * if flags & PyBUF_STRIDES: # <<<<<<<<<<<<<< + * info.strides = self.view.strides + * else: +*/ + __pyx_t_1 = ((__pyx_v_flags & PyBUF_STRIDES) != 0); + if (__pyx_t_1) { + + /* "View.MemoryView":533 + * + * if flags & PyBUF_STRIDES: + * info.strides = self.view.strides # <<<<<<<<<<<<<< + * else: + * info.strides = NULL +*/ + __pyx_t_3 = __pyx_v_self->view.strides; + __pyx_v_info->strides = __pyx_t_3; + + /* "View.MemoryView":532 + * info.shape = NULL + * + * if flags & PyBUF_STRIDES: # <<<<<<<<<<<<<< + * info.strides = self.view.strides + * else: +*/ + goto __pyx_L7; + } + + /* "View.MemoryView":535 + * info.strides = self.view.strides + * else: + * info.strides = NULL # <<<<<<<<<<<<<< + * + * if flags & PyBUF_INDIRECT: +*/ + /*else*/ { + __pyx_v_info->strides = NULL; + } + __pyx_L7:; + + /* "View.MemoryView":537 + * info.strides = NULL + * + * if flags & PyBUF_INDIRECT: # <<<<<<<<<<<<<< + * info.suboffsets = self.view.suboffsets + * else: +*/ + __pyx_t_1 = ((__pyx_v_flags & PyBUF_INDIRECT) != 0); + if (__pyx_t_1) { + + /* "View.MemoryView":538 + * + * if flags & PyBUF_INDIRECT: + * info.suboffsets = self.view.suboffsets # <<<<<<<<<<<<<< + * else: + * info.suboffsets = NULL +*/ + __pyx_t_3 = __pyx_v_self->view.suboffsets; + __pyx_v_info->suboffsets = __pyx_t_3; + + /* "View.MemoryView":537 + * info.strides = NULL + * + * if flags & PyBUF_INDIRECT: # <<<<<<<<<<<<<< + * info.suboffsets = self.view.suboffsets + * else: +*/ + goto __pyx_L8; + } + + /* "View.MemoryView":540 + * info.suboffsets = self.view.suboffsets + * else: + * info.suboffsets = NULL # <<<<<<<<<<<<<< + * + * if flags & PyBUF_FORMAT: +*/ + /*else*/ { + __pyx_v_info->suboffsets = NULL; + } + __pyx_L8:; + + /* "View.MemoryView":542 + * info.suboffsets = NULL + * + * if flags & PyBUF_FORMAT: # <<<<<<<<<<<<<< + * info.format = self.view.format + * else: +*/ + __pyx_t_1 = ((__pyx_v_flags & PyBUF_FORMAT) != 0); + if (__pyx_t_1) { + + /* "View.MemoryView":543 + * + * if flags & PyBUF_FORMAT: + * info.format = self.view.format # <<<<<<<<<<<<<< + * else: + * info.format = NULL +*/ + __pyx_t_4 = __pyx_v_self->view.format; + __pyx_v_info->format = __pyx_t_4; + + /* "View.MemoryView":542 + * info.suboffsets = NULL + * + * if flags & PyBUF_FORMAT: # <<<<<<<<<<<<<< + * info.format = self.view.format + * else: +*/ + goto __pyx_L9; + } + + /* "View.MemoryView":545 + * info.format = self.view.format + * else: + * info.format = NULL # <<<<<<<<<<<<<< + * + * info.buf = self.view.buf +*/ + /*else*/ { + __pyx_v_info->format = NULL; + } + __pyx_L9:; + + /* "View.MemoryView":547 + * info.format = NULL + * + * info.buf = self.view.buf # <<<<<<<<<<<<<< + * info.ndim = self.view.ndim + * info.itemsize = self.view.itemsize +*/ + __pyx_t_5 = __pyx_v_self->view.buf; + __pyx_v_info->buf = __pyx_t_5; + + /* "View.MemoryView":548 + * + * info.buf = self.view.buf + * info.ndim = self.view.ndim # <<<<<<<<<<<<<< + * info.itemsize = self.view.itemsize + * info.len = self.view.len +*/ + __pyx_t_6 = __pyx_v_self->view.ndim; + __pyx_v_info->ndim = __pyx_t_6; + + /* "View.MemoryView":549 + * info.buf = self.view.buf + * info.ndim = self.view.ndim + * info.itemsize = self.view.itemsize # <<<<<<<<<<<<<< + * info.len = self.view.len + * info.readonly = self.view.readonly +*/ + __pyx_t_7 = __pyx_v_self->view.itemsize; + __pyx_v_info->itemsize = __pyx_t_7; + + /* "View.MemoryView":550 + * info.ndim = self.view.ndim + * info.itemsize = self.view.itemsize + * info.len = self.view.len # <<<<<<<<<<<<<< + * info.readonly = self.view.readonly + * info.obj = self +*/ + __pyx_t_7 = __pyx_v_self->view.len; + __pyx_v_info->len = __pyx_t_7; + + /* "View.MemoryView":551 + * info.itemsize = self.view.itemsize + * info.len = self.view.len + * info.readonly = self.view.readonly # <<<<<<<<<<<<<< + * info.obj = self + * +*/ + __pyx_t_1 = __pyx_v_self->view.readonly; + __pyx_v_info->readonly = __pyx_t_1; + + /* "View.MemoryView":552 + * info.len = self.view.len + * info.readonly = self.view.readonly + * info.obj = self # <<<<<<<<<<<<<< + * + * +*/ + __Pyx_INCREF((PyObject *)__pyx_v_self); + __Pyx_GIVEREF((PyObject *)__pyx_v_self); + __Pyx_GOTREF(__pyx_v_info->obj); + __Pyx_DECREF(__pyx_v_info->obj); + __pyx_v_info->obj = ((PyObject *)__pyx_v_self); + + /* "View.MemoryView":522 + * itemp[i] = c + * + * @cname('getbuffer') # <<<<<<<<<<<<<< + * def __getbuffer__(self, Py_buffer *info, int flags): + * if flags & PyBUF_WRITABLE and self.view.readonly: +*/ + + /* function exit code */ + __pyx_r = 0; + goto __pyx_L0; + __pyx_L1_error:; + __Pyx_AddTraceback("View.MemoryView.memoryview.__getbuffer__", __pyx_clineno, __pyx_lineno, __pyx_filename); + __pyx_r = -1; + if (__pyx_v_info->obj != NULL) { + __Pyx_GOTREF(__pyx_v_info->obj); + __Pyx_DECREF(__pyx_v_info->obj); __pyx_v_info->obj = 0; + } + goto __pyx_L2; + __pyx_L0:; + if (__pyx_v_info->obj == Py_None) { + __Pyx_GOTREF(__pyx_v_info->obj); + __Pyx_DECREF(__pyx_v_info->obj); __pyx_v_info->obj = 0; + } + __pyx_L2:; + __Pyx_RefNannyFinishContext(); + return __pyx_r; +} + +/* "View.MemoryView":555 + * + * + * @property # <<<<<<<<<<<<<< + * def T(self): + * cdef _memoryviewslice result = memoryview_copy(self) +*/ + +/* Python wrapper */ +static PyObject *__pyx_pw_15View_dot_MemoryView_10memoryview_1T_1__get__(PyObject *__pyx_v_self); /*proto*/ +static PyObject *__pyx_pw_15View_dot_MemoryView_10memoryview_1T_1__get__(PyObject *__pyx_v_self) { + CYTHON_UNUSED PyObject *const *__pyx_kwvalues; + PyObject *__pyx_r = 0; + __Pyx_RefNannyDeclarations + __Pyx_RefNannySetupContext("__get__ (wrapper)", 0); + __pyx_kwvalues = __Pyx_KwValues_VARARGS(__pyx_args, __pyx_nargs); + __pyx_r = __pyx_pf_15View_dot_MemoryView_10memoryview_1T___get__(((struct __pyx_memoryview_obj *)__pyx_v_self)); + + /* function exit code */ + __Pyx_RefNannyFinishContext(); + return __pyx_r; +} + +static PyObject *__pyx_pf_15View_dot_MemoryView_10memoryview_1T___get__(struct __pyx_memoryview_obj *__pyx_v_self) { + struct __pyx_memoryviewslice_obj *__pyx_v_result = 0; + PyObject *__pyx_r = NULL; + __Pyx_RefNannyDeclarations + PyObject *__pyx_t_1 = NULL; + int __pyx_t_2; + int __pyx_lineno = 0; + const char *__pyx_filename = NULL; + int __pyx_clineno = 0; + __Pyx_RefNannySetupContext("__get__", 0); + + /* "View.MemoryView":557 + * @property + * def T(self): + * cdef _memoryviewslice result = memoryview_copy(self) # <<<<<<<<<<<<<< + * transpose_memslice(&result.from_slice) + * return result +*/ + __pyx_t_1 = __pyx_memoryview_copy_object(__pyx_v_self); if (unlikely(!__pyx_t_1)) __PYX_ERR(1, 557, __pyx_L1_error) + __Pyx_GOTREF(__pyx_t_1); + if (!(likely(((__pyx_t_1) == Py_None) || likely(__Pyx_TypeTest(__pyx_t_1, __pyx_mstate_global->__pyx_memoryviewslice_type))))) __PYX_ERR(1, 557, __pyx_L1_error) + __pyx_v_result = ((struct __pyx_memoryviewslice_obj *)__pyx_t_1); + __pyx_t_1 = 0; + + /* "View.MemoryView":558 + * def T(self): + * cdef _memoryviewslice result = memoryview_copy(self) + * transpose_memslice(&result.from_slice) # <<<<<<<<<<<<<< + * return result + * +*/ + __pyx_t_2 = __pyx_memslice_transpose((&__pyx_v_result->from_slice)); if (unlikely(__pyx_t_2 == ((int)-1))) __PYX_ERR(1, 558, __pyx_L1_error) + + /* "View.MemoryView":559 + * cdef _memoryviewslice result = memoryview_copy(self) + * transpose_memslice(&result.from_slice) + * return result # <<<<<<<<<<<<<< + * + * @property +*/ + __Pyx_XDECREF(__pyx_r); + __Pyx_INCREF((PyObject *)__pyx_v_result); + __pyx_r = ((PyObject *)__pyx_v_result); + goto __pyx_L0; + + /* "View.MemoryView":555 + * + * + * @property # <<<<<<<<<<<<<< + * def T(self): + * cdef _memoryviewslice result = memoryview_copy(self) +*/ + + /* function exit code */ + __pyx_L1_error:; + __Pyx_XDECREF(__pyx_t_1); + __Pyx_AddTraceback("View.MemoryView.memoryview.T.__get__", __pyx_clineno, __pyx_lineno, __pyx_filename); + __pyx_r = NULL; + __pyx_L0:; + __Pyx_XDECREF((PyObject *)__pyx_v_result); + __Pyx_XGIVEREF(__pyx_r); + __Pyx_RefNannyFinishContext(); + return __pyx_r; +} + +/* "View.MemoryView":561 + * return result + * + * @property # <<<<<<<<<<<<<< + * def base(self): + * return self._get_base() +*/ + +/* Python wrapper */ +static PyObject *__pyx_pw_15View_dot_MemoryView_10memoryview_4base_1__get__(PyObject *__pyx_v_self); /*proto*/ +static PyObject *__pyx_pw_15View_dot_MemoryView_10memoryview_4base_1__get__(PyObject *__pyx_v_self) { + CYTHON_UNUSED PyObject *const *__pyx_kwvalues; + PyObject *__pyx_r = 0; + __Pyx_RefNannyDeclarations + __Pyx_RefNannySetupContext("__get__ (wrapper)", 0); + __pyx_kwvalues = __Pyx_KwValues_VARARGS(__pyx_args, __pyx_nargs); + __pyx_r = __pyx_pf_15View_dot_MemoryView_10memoryview_4base___get__(((struct __pyx_memoryview_obj *)__pyx_v_self)); + + /* function exit code */ + __Pyx_RefNannyFinishContext(); + return __pyx_r; +} + +static PyObject *__pyx_pf_15View_dot_MemoryView_10memoryview_4base___get__(struct __pyx_memoryview_obj *__pyx_v_self) { + PyObject *__pyx_r = NULL; + __Pyx_RefNannyDeclarations + PyObject *__pyx_t_1 = NULL; + int __pyx_lineno = 0; + const char *__pyx_filename = NULL; + int __pyx_clineno = 0; + __Pyx_RefNannySetupContext("__get__", 0); + + /* "View.MemoryView":563 + * @property + * def base(self): + * return self._get_base() # <<<<<<<<<<<<<< + * + * cdef _get_base(self): +*/ + __Pyx_XDECREF(__pyx_r); + __pyx_t_1 = ((struct __pyx_vtabstruct_memoryview *)__pyx_v_self->__pyx_vtab)->_get_base(__pyx_v_self); if (unlikely(!__pyx_t_1)) __PYX_ERR(1, 563, __pyx_L1_error) + __Pyx_GOTREF(__pyx_t_1); + __pyx_r = __pyx_t_1; + __pyx_t_1 = 0; + goto __pyx_L0; + + /* "View.MemoryView":561 + * return result + * + * @property # <<<<<<<<<<<<<< + * def base(self): + * return self._get_base() +*/ + + /* function exit code */ + __pyx_L1_error:; + __Pyx_XDECREF(__pyx_t_1); + __Pyx_AddTraceback("View.MemoryView.memoryview.base.__get__", __pyx_clineno, __pyx_lineno, __pyx_filename); + __pyx_r = NULL; + __pyx_L0:; + __Pyx_XGIVEREF(__pyx_r); + __Pyx_RefNannyFinishContext(); + return __pyx_r; +} + +/* "View.MemoryView":565 + * return self._get_base() + * + * cdef _get_base(self): # <<<<<<<<<<<<<< + * return self.obj + * +*/ + +static PyObject *__pyx_memoryview__get_base(struct __pyx_memoryview_obj *__pyx_v_self) { + PyObject *__pyx_r = NULL; + __Pyx_RefNannyDeclarations + __Pyx_RefNannySetupContext("_get_base", 0); + + /* "View.MemoryView":566 + * + * cdef _get_base(self): + * return self.obj # <<<<<<<<<<<<<< + * + * @property +*/ + __Pyx_XDECREF(__pyx_r); + __Pyx_INCREF(__pyx_v_self->obj); + __pyx_r = __pyx_v_self->obj; + goto __pyx_L0; + + /* "View.MemoryView":565 + * return self._get_base() + * + * cdef _get_base(self): # <<<<<<<<<<<<<< + * return self.obj + * +*/ + + /* function exit code */ + __pyx_L0:; + __Pyx_XGIVEREF(__pyx_r); + __Pyx_RefNannyFinishContext(); + return __pyx_r; +} + +/* "View.MemoryView":568 + * return self.obj + * + * @property # <<<<<<<<<<<<<< + * def shape(self): + * return tuple([length for length in self.view.shape[:self.view.ndim]]) +*/ + +/* Python wrapper */ +static PyObject *__pyx_pw_15View_dot_MemoryView_10memoryview_5shape_1__get__(PyObject *__pyx_v_self); /*proto*/ +static PyObject *__pyx_pw_15View_dot_MemoryView_10memoryview_5shape_1__get__(PyObject *__pyx_v_self) { + CYTHON_UNUSED PyObject *const *__pyx_kwvalues; + PyObject *__pyx_r = 0; + __Pyx_RefNannyDeclarations + __Pyx_RefNannySetupContext("__get__ (wrapper)", 0); + __pyx_kwvalues = __Pyx_KwValues_VARARGS(__pyx_args, __pyx_nargs); + __pyx_r = __pyx_pf_15View_dot_MemoryView_10memoryview_5shape___get__(((struct __pyx_memoryview_obj *)__pyx_v_self)); + + /* function exit code */ + __Pyx_RefNannyFinishContext(); + return __pyx_r; +} + +static PyObject *__pyx_pf_15View_dot_MemoryView_10memoryview_5shape___get__(struct __pyx_memoryview_obj *__pyx_v_self) { + Py_ssize_t __pyx_7genexpr__pyx_v_length; + PyObject *__pyx_r = NULL; + __Pyx_RefNannyDeclarations + PyObject *__pyx_t_1 = NULL; + Py_ssize_t *__pyx_t_2; + Py_ssize_t *__pyx_t_3; + Py_ssize_t *__pyx_t_4; + PyObject *__pyx_t_5 = NULL; + int __pyx_lineno = 0; + const char *__pyx_filename = NULL; + int __pyx_clineno = 0; + __Pyx_RefNannySetupContext("__get__", 0); + + /* "View.MemoryView":570 + * @property + * def shape(self): + * return tuple([length for length in self.view.shape[:self.view.ndim]]) # <<<<<<<<<<<<<< + * + * @property +*/ + __Pyx_XDECREF(__pyx_r); + { /* enter inner scope */ + __pyx_t_1 = PyList_New(0); if (unlikely(!__pyx_t_1)) __PYX_ERR(1, 570, __pyx_L1_error) + __Pyx_GOTREF(__pyx_t_1); + __pyx_t_3 = (__pyx_v_self->view.shape + __pyx_v_self->view.ndim); + for (__pyx_t_4 = __pyx_v_self->view.shape; __pyx_t_4 < __pyx_t_3; __pyx_t_4++) { + __pyx_t_2 = __pyx_t_4; + __pyx_7genexpr__pyx_v_length = (__pyx_t_2[0]); + __pyx_t_5 = PyLong_FromSsize_t(__pyx_7genexpr__pyx_v_length); if (unlikely(!__pyx_t_5)) __PYX_ERR(1, 570, __pyx_L1_error) + __Pyx_GOTREF(__pyx_t_5); + if (unlikely(__Pyx_ListComp_Append(__pyx_t_1, (PyObject*)__pyx_t_5))) __PYX_ERR(1, 570, __pyx_L1_error) + __Pyx_DECREF(__pyx_t_5); __pyx_t_5 = 0; + } + } /* exit inner scope */ + __pyx_t_5 = PyList_AsTuple(((PyObject*)__pyx_t_1)); if (unlikely(!__pyx_t_5)) __PYX_ERR(1, 570, __pyx_L1_error) + __Pyx_GOTREF(__pyx_t_5); + __Pyx_DECREF(__pyx_t_1); __pyx_t_1 = 0; + __pyx_r = __pyx_t_5; + __pyx_t_5 = 0; + goto __pyx_L0; + + /* "View.MemoryView":568 + * return self.obj + * + * @property # <<<<<<<<<<<<<< + * def shape(self): + * return tuple([length for length in self.view.shape[:self.view.ndim]]) +*/ + + /* function exit code */ + __pyx_L1_error:; + __Pyx_XDECREF(__pyx_t_1); + __Pyx_XDECREF(__pyx_t_5); + __Pyx_AddTraceback("View.MemoryView.memoryview.shape.__get__", __pyx_clineno, __pyx_lineno, __pyx_filename); + __pyx_r = NULL; + __pyx_L0:; + __Pyx_XGIVEREF(__pyx_r); + __Pyx_RefNannyFinishContext(); + return __pyx_r; +} + +/* "View.MemoryView":572 + * return tuple([length for length in self.view.shape[:self.view.ndim]]) + * + * @property # <<<<<<<<<<<<<< + * def strides(self): + * if self.view.strides == NULL: +*/ + +/* Python wrapper */ +static PyObject *__pyx_pw_15View_dot_MemoryView_10memoryview_7strides_1__get__(PyObject *__pyx_v_self); /*proto*/ +static PyObject *__pyx_pw_15View_dot_MemoryView_10memoryview_7strides_1__get__(PyObject *__pyx_v_self) { + CYTHON_UNUSED PyObject *const *__pyx_kwvalues; + PyObject *__pyx_r = 0; + __Pyx_RefNannyDeclarations + __Pyx_RefNannySetupContext("__get__ (wrapper)", 0); + __pyx_kwvalues = __Pyx_KwValues_VARARGS(__pyx_args, __pyx_nargs); + __pyx_r = __pyx_pf_15View_dot_MemoryView_10memoryview_7strides___get__(((struct __pyx_memoryview_obj *)__pyx_v_self)); + + /* function exit code */ + __Pyx_RefNannyFinishContext(); + return __pyx_r; +} + +static PyObject *__pyx_pf_15View_dot_MemoryView_10memoryview_7strides___get__(struct __pyx_memoryview_obj *__pyx_v_self) { + Py_ssize_t __pyx_8genexpr1__pyx_v_stride; + PyObject *__pyx_r = NULL; + __Pyx_RefNannyDeclarations + int __pyx_t_1; + PyObject *__pyx_t_2 = NULL; + Py_ssize_t *__pyx_t_3; + Py_ssize_t *__pyx_t_4; + Py_ssize_t *__pyx_t_5; + PyObject *__pyx_t_6 = NULL; + int __pyx_lineno = 0; + const char *__pyx_filename = NULL; + int __pyx_clineno = 0; + __Pyx_RefNannySetupContext("__get__", 0); + + /* "View.MemoryView":574 + * @property + * def strides(self): + * if self.view.strides == NULL: # <<<<<<<<<<<<<< + * + * raise ValueError, "Buffer view does not expose strides" +*/ + __pyx_t_1 = (__pyx_v_self->view.strides == NULL); + if (unlikely(__pyx_t_1)) { + + /* "View.MemoryView":576 + * if self.view.strides == NULL: + * + * raise ValueError, "Buffer view does not expose strides" # <<<<<<<<<<<<<< + * + * return tuple([stride for stride in self.view.strides[:self.view.ndim]]) +*/ + __Pyx_Raise(((PyObject *)(((PyTypeObject*)PyExc_ValueError))), __pyx_mstate_global->__pyx_kp_u_Buffer_view_does_not_expose_stri, 0, 0); + __PYX_ERR(1, 576, __pyx_L1_error) + + /* "View.MemoryView":574 + * @property + * def strides(self): + * if self.view.strides == NULL: # <<<<<<<<<<<<<< + * + * raise ValueError, "Buffer view does not expose strides" +*/ + } + + /* "View.MemoryView":578 + * raise ValueError, "Buffer view does not expose strides" + * + * return tuple([stride for stride in self.view.strides[:self.view.ndim]]) # <<<<<<<<<<<<<< + * + * @property +*/ + __Pyx_XDECREF(__pyx_r); + { /* enter inner scope */ + __pyx_t_2 = PyList_New(0); if (unlikely(!__pyx_t_2)) __PYX_ERR(1, 578, __pyx_L1_error) + __Pyx_GOTREF(__pyx_t_2); + __pyx_t_4 = (__pyx_v_self->view.strides + __pyx_v_self->view.ndim); + for (__pyx_t_5 = __pyx_v_self->view.strides; __pyx_t_5 < __pyx_t_4; __pyx_t_5++) { + __pyx_t_3 = __pyx_t_5; + __pyx_8genexpr1__pyx_v_stride = (__pyx_t_3[0]); + __pyx_t_6 = PyLong_FromSsize_t(__pyx_8genexpr1__pyx_v_stride); if (unlikely(!__pyx_t_6)) __PYX_ERR(1, 578, __pyx_L1_error) + __Pyx_GOTREF(__pyx_t_6); + if (unlikely(__Pyx_ListComp_Append(__pyx_t_2, (PyObject*)__pyx_t_6))) __PYX_ERR(1, 578, __pyx_L1_error) + __Pyx_DECREF(__pyx_t_6); __pyx_t_6 = 0; + } + } /* exit inner scope */ + __pyx_t_6 = PyList_AsTuple(((PyObject*)__pyx_t_2)); if (unlikely(!__pyx_t_6)) __PYX_ERR(1, 578, __pyx_L1_error) + __Pyx_GOTREF(__pyx_t_6); + __Pyx_DECREF(__pyx_t_2); __pyx_t_2 = 0; + __pyx_r = __pyx_t_6; + __pyx_t_6 = 0; + goto __pyx_L0; + + /* "View.MemoryView":572 + * return tuple([length for length in self.view.shape[:self.view.ndim]]) + * + * @property # <<<<<<<<<<<<<< + * def strides(self): + * if self.view.strides == NULL: +*/ + + /* function exit code */ + __pyx_L1_error:; + __Pyx_XDECREF(__pyx_t_2); + __Pyx_XDECREF(__pyx_t_6); + __Pyx_AddTraceback("View.MemoryView.memoryview.strides.__get__", __pyx_clineno, __pyx_lineno, __pyx_filename); + __pyx_r = NULL; + __pyx_L0:; + __Pyx_XGIVEREF(__pyx_r); + __Pyx_RefNannyFinishContext(); + return __pyx_r; +} + +/* "View.MemoryView":580 + * return tuple([stride for stride in self.view.strides[:self.view.ndim]]) + * + * @property # <<<<<<<<<<<<<< + * def suboffsets(self): + * if self.view.suboffsets == NULL: +*/ + +/* Python wrapper */ +static PyObject *__pyx_pw_15View_dot_MemoryView_10memoryview_10suboffsets_1__get__(PyObject *__pyx_v_self); /*proto*/ +static PyObject *__pyx_pw_15View_dot_MemoryView_10memoryview_10suboffsets_1__get__(PyObject *__pyx_v_self) { + CYTHON_UNUSED PyObject *const *__pyx_kwvalues; + PyObject *__pyx_r = 0; + __Pyx_RefNannyDeclarations + __Pyx_RefNannySetupContext("__get__ (wrapper)", 0); + __pyx_kwvalues = __Pyx_KwValues_VARARGS(__pyx_args, __pyx_nargs); + __pyx_r = __pyx_pf_15View_dot_MemoryView_10memoryview_10suboffsets___get__(((struct __pyx_memoryview_obj *)__pyx_v_self)); + + /* function exit code */ + __Pyx_RefNannyFinishContext(); + return __pyx_r; +} + +static PyObject *__pyx_pf_15View_dot_MemoryView_10memoryview_10suboffsets___get__(struct __pyx_memoryview_obj *__pyx_v_self) { + Py_ssize_t __pyx_8genexpr2__pyx_v_suboffset; + PyObject *__pyx_r = NULL; + __Pyx_RefNannyDeclarations + int __pyx_t_1; + PyObject *__pyx_t_2 = NULL; + Py_ssize_t *__pyx_t_3; + Py_ssize_t *__pyx_t_4; + Py_ssize_t *__pyx_t_5; + PyObject *__pyx_t_6 = NULL; + int __pyx_lineno = 0; + const char *__pyx_filename = NULL; + int __pyx_clineno = 0; + __Pyx_RefNannySetupContext("__get__", 0); + + /* "View.MemoryView":582 + * @property + * def suboffsets(self): + * if self.view.suboffsets == NULL: # <<<<<<<<<<<<<< + * return (-1,) * self.view.ndim + * +*/ + __pyx_t_1 = (__pyx_v_self->view.suboffsets == NULL); + if (__pyx_t_1) { + + /* "View.MemoryView":583 + * def suboffsets(self): + * if self.view.suboffsets == NULL: + * return (-1,) * self.view.ndim # <<<<<<<<<<<<<< + * + * return tuple([suboffset for suboffset in self.view.suboffsets[:self.view.ndim]]) +*/ + __Pyx_XDECREF(__pyx_r); + __pyx_t_2 = __Pyx_PySequence_Multiply(__pyx_mstate_global->__pyx_tuple[1], __pyx_v_self->view.ndim); if (unlikely(!__pyx_t_2)) __PYX_ERR(1, 583, __pyx_L1_error) + __Pyx_GOTREF(__pyx_t_2); + __pyx_r = __pyx_t_2; + __pyx_t_2 = 0; + goto __pyx_L0; + + /* "View.MemoryView":582 + * @property + * def suboffsets(self): + * if self.view.suboffsets == NULL: # <<<<<<<<<<<<<< + * return (-1,) * self.view.ndim + * +*/ + } + + /* "View.MemoryView":585 + * return (-1,) * self.view.ndim + * + * return tuple([suboffset for suboffset in self.view.suboffsets[:self.view.ndim]]) # <<<<<<<<<<<<<< + * + * @property +*/ + __Pyx_XDECREF(__pyx_r); + { /* enter inner scope */ + __pyx_t_2 = PyList_New(0); if (unlikely(!__pyx_t_2)) __PYX_ERR(1, 585, __pyx_L1_error) + __Pyx_GOTREF(__pyx_t_2); + __pyx_t_4 = (__pyx_v_self->view.suboffsets + __pyx_v_self->view.ndim); + for (__pyx_t_5 = __pyx_v_self->view.suboffsets; __pyx_t_5 < __pyx_t_4; __pyx_t_5++) { + __pyx_t_3 = __pyx_t_5; + __pyx_8genexpr2__pyx_v_suboffset = (__pyx_t_3[0]); + __pyx_t_6 = PyLong_FromSsize_t(__pyx_8genexpr2__pyx_v_suboffset); if (unlikely(!__pyx_t_6)) __PYX_ERR(1, 585, __pyx_L1_error) + __Pyx_GOTREF(__pyx_t_6); + if (unlikely(__Pyx_ListComp_Append(__pyx_t_2, (PyObject*)__pyx_t_6))) __PYX_ERR(1, 585, __pyx_L1_error) + __Pyx_DECREF(__pyx_t_6); __pyx_t_6 = 0; + } + } /* exit inner scope */ + __pyx_t_6 = PyList_AsTuple(((PyObject*)__pyx_t_2)); if (unlikely(!__pyx_t_6)) __PYX_ERR(1, 585, __pyx_L1_error) + __Pyx_GOTREF(__pyx_t_6); + __Pyx_DECREF(__pyx_t_2); __pyx_t_2 = 0; + __pyx_r = __pyx_t_6; + __pyx_t_6 = 0; + goto __pyx_L0; + + /* "View.MemoryView":580 + * return tuple([stride for stride in self.view.strides[:self.view.ndim]]) + * + * @property # <<<<<<<<<<<<<< + * def suboffsets(self): + * if self.view.suboffsets == NULL: +*/ + + /* function exit code */ + __pyx_L1_error:; + __Pyx_XDECREF(__pyx_t_2); + __Pyx_XDECREF(__pyx_t_6); + __Pyx_AddTraceback("View.MemoryView.memoryview.suboffsets.__get__", __pyx_clineno, __pyx_lineno, __pyx_filename); + __pyx_r = NULL; + __pyx_L0:; + __Pyx_XGIVEREF(__pyx_r); + __Pyx_RefNannyFinishContext(); + return __pyx_r; +} + +/* "View.MemoryView":587 + * return tuple([suboffset for suboffset in self.view.suboffsets[:self.view.ndim]]) + * + * @property # <<<<<<<<<<<<<< + * def ndim(self): + * return self.view.ndim +*/ + +/* Python wrapper */ +static PyObject *__pyx_pw_15View_dot_MemoryView_10memoryview_4ndim_1__get__(PyObject *__pyx_v_self); /*proto*/ +static PyObject *__pyx_pw_15View_dot_MemoryView_10memoryview_4ndim_1__get__(PyObject *__pyx_v_self) { + CYTHON_UNUSED PyObject *const *__pyx_kwvalues; + PyObject *__pyx_r = 0; + __Pyx_RefNannyDeclarations + __Pyx_RefNannySetupContext("__get__ (wrapper)", 0); + __pyx_kwvalues = __Pyx_KwValues_VARARGS(__pyx_args, __pyx_nargs); + __pyx_r = __pyx_pf_15View_dot_MemoryView_10memoryview_4ndim___get__(((struct __pyx_memoryview_obj *)__pyx_v_self)); + + /* function exit code */ + __Pyx_RefNannyFinishContext(); + return __pyx_r; +} + +static PyObject *__pyx_pf_15View_dot_MemoryView_10memoryview_4ndim___get__(struct __pyx_memoryview_obj *__pyx_v_self) { + PyObject *__pyx_r = NULL; + __Pyx_RefNannyDeclarations + PyObject *__pyx_t_1 = NULL; + int __pyx_lineno = 0; + const char *__pyx_filename = NULL; + int __pyx_clineno = 0; + __Pyx_RefNannySetupContext("__get__", 0); + + /* "View.MemoryView":589 + * @property + * def ndim(self): + * return self.view.ndim # <<<<<<<<<<<<<< + * + * @property +*/ + __Pyx_XDECREF(__pyx_r); + __pyx_t_1 = __Pyx_PyLong_From_int(__pyx_v_self->view.ndim); if (unlikely(!__pyx_t_1)) __PYX_ERR(1, 589, __pyx_L1_error) + __Pyx_GOTREF(__pyx_t_1); + __pyx_r = __pyx_t_1; + __pyx_t_1 = 0; + goto __pyx_L0; + + /* "View.MemoryView":587 + * return tuple([suboffset for suboffset in self.view.suboffsets[:self.view.ndim]]) + * + * @property # <<<<<<<<<<<<<< + * def ndim(self): + * return self.view.ndim +*/ + + /* function exit code */ + __pyx_L1_error:; + __Pyx_XDECREF(__pyx_t_1); + __Pyx_AddTraceback("View.MemoryView.memoryview.ndim.__get__", __pyx_clineno, __pyx_lineno, __pyx_filename); + __pyx_r = NULL; + __pyx_L0:; + __Pyx_XGIVEREF(__pyx_r); + __Pyx_RefNannyFinishContext(); + return __pyx_r; +} + +/* "View.MemoryView":591 + * return self.view.ndim + * + * @property # <<<<<<<<<<<<<< + * def itemsize(self): + * return self.view.itemsize +*/ + +/* Python wrapper */ +static PyObject *__pyx_pw_15View_dot_MemoryView_10memoryview_8itemsize_1__get__(PyObject *__pyx_v_self); /*proto*/ +static PyObject *__pyx_pw_15View_dot_MemoryView_10memoryview_8itemsize_1__get__(PyObject *__pyx_v_self) { + CYTHON_UNUSED PyObject *const *__pyx_kwvalues; + PyObject *__pyx_r = 0; + __Pyx_RefNannyDeclarations + __Pyx_RefNannySetupContext("__get__ (wrapper)", 0); + __pyx_kwvalues = __Pyx_KwValues_VARARGS(__pyx_args, __pyx_nargs); + __pyx_r = __pyx_pf_15View_dot_MemoryView_10memoryview_8itemsize___get__(((struct __pyx_memoryview_obj *)__pyx_v_self)); + + /* function exit code */ + __Pyx_RefNannyFinishContext(); + return __pyx_r; +} + +static PyObject *__pyx_pf_15View_dot_MemoryView_10memoryview_8itemsize___get__(struct __pyx_memoryview_obj *__pyx_v_self) { + PyObject *__pyx_r = NULL; + __Pyx_RefNannyDeclarations + PyObject *__pyx_t_1 = NULL; + int __pyx_lineno = 0; + const char *__pyx_filename = NULL; + int __pyx_clineno = 0; + __Pyx_RefNannySetupContext("__get__", 0); + + /* "View.MemoryView":593 + * @property + * def itemsize(self): + * return self.view.itemsize # <<<<<<<<<<<<<< + * + * @property +*/ + __Pyx_XDECREF(__pyx_r); + __pyx_t_1 = PyLong_FromSsize_t(__pyx_v_self->view.itemsize); if (unlikely(!__pyx_t_1)) __PYX_ERR(1, 593, __pyx_L1_error) + __Pyx_GOTREF(__pyx_t_1); + __pyx_r = __pyx_t_1; + __pyx_t_1 = 0; + goto __pyx_L0; + + /* "View.MemoryView":591 + * return self.view.ndim + * + * @property # <<<<<<<<<<<<<< + * def itemsize(self): + * return self.view.itemsize +*/ + + /* function exit code */ + __pyx_L1_error:; + __Pyx_XDECREF(__pyx_t_1); + __Pyx_AddTraceback("View.MemoryView.memoryview.itemsize.__get__", __pyx_clineno, __pyx_lineno, __pyx_filename); + __pyx_r = NULL; + __pyx_L0:; + __Pyx_XGIVEREF(__pyx_r); + __Pyx_RefNannyFinishContext(); + return __pyx_r; +} + +/* "View.MemoryView":595 + * return self.view.itemsize + * + * @property # <<<<<<<<<<<<<< + * def nbytes(self): + * return self.size * self.view.itemsize +*/ + +/* Python wrapper */ +static PyObject *__pyx_pw_15View_dot_MemoryView_10memoryview_6nbytes_1__get__(PyObject *__pyx_v_self); /*proto*/ +static PyObject *__pyx_pw_15View_dot_MemoryView_10memoryview_6nbytes_1__get__(PyObject *__pyx_v_self) { + CYTHON_UNUSED PyObject *const *__pyx_kwvalues; + PyObject *__pyx_r = 0; + __Pyx_RefNannyDeclarations + __Pyx_RefNannySetupContext("__get__ (wrapper)", 0); + __pyx_kwvalues = __Pyx_KwValues_VARARGS(__pyx_args, __pyx_nargs); + __pyx_r = __pyx_pf_15View_dot_MemoryView_10memoryview_6nbytes___get__(((struct __pyx_memoryview_obj *)__pyx_v_self)); + + /* function exit code */ + __Pyx_RefNannyFinishContext(); + return __pyx_r; +} + +static PyObject *__pyx_pf_15View_dot_MemoryView_10memoryview_6nbytes___get__(struct __pyx_memoryview_obj *__pyx_v_self) { + PyObject *__pyx_r = NULL; + __Pyx_RefNannyDeclarations + PyObject *__pyx_t_1 = NULL; + PyObject *__pyx_t_2 = NULL; + PyObject *__pyx_t_3 = NULL; + int __pyx_lineno = 0; + const char *__pyx_filename = NULL; + int __pyx_clineno = 0; + __Pyx_RefNannySetupContext("__get__", 0); + + /* "View.MemoryView":597 + * @property + * def nbytes(self): + * return self.size * self.view.itemsize # <<<<<<<<<<<<<< + * + * @property +*/ + __Pyx_XDECREF(__pyx_r); + __pyx_t_1 = __Pyx_PyObject_GetAttrStr(((PyObject *)__pyx_v_self), __pyx_mstate_global->__pyx_n_u_size); if (unlikely(!__pyx_t_1)) __PYX_ERR(1, 597, __pyx_L1_error) + __Pyx_GOTREF(__pyx_t_1); + __pyx_t_2 = PyLong_FromSsize_t(__pyx_v_self->view.itemsize); if (unlikely(!__pyx_t_2)) __PYX_ERR(1, 597, __pyx_L1_error) + __Pyx_GOTREF(__pyx_t_2); + __pyx_t_3 = PyNumber_Multiply(__pyx_t_1, __pyx_t_2); if (unlikely(!__pyx_t_3)) __PYX_ERR(1, 597, __pyx_L1_error) + __Pyx_GOTREF(__pyx_t_3); + __Pyx_DECREF(__pyx_t_1); __pyx_t_1 = 0; + __Pyx_DECREF(__pyx_t_2); __pyx_t_2 = 0; + __pyx_r = __pyx_t_3; + __pyx_t_3 = 0; + goto __pyx_L0; + + /* "View.MemoryView":595 + * return self.view.itemsize + * + * @property # <<<<<<<<<<<<<< + * def nbytes(self): + * return self.size * self.view.itemsize +*/ + + /* function exit code */ + __pyx_L1_error:; + __Pyx_XDECREF(__pyx_t_1); + __Pyx_XDECREF(__pyx_t_2); + __Pyx_XDECREF(__pyx_t_3); + __Pyx_AddTraceback("View.MemoryView.memoryview.nbytes.__get__", __pyx_clineno, __pyx_lineno, __pyx_filename); + __pyx_r = NULL; + __pyx_L0:; + __Pyx_XGIVEREF(__pyx_r); + __Pyx_RefNannyFinishContext(); + return __pyx_r; +} + +/* "View.MemoryView":599 + * return self.size * self.view.itemsize + * + * @property # <<<<<<<<<<<<<< + * def size(self): + * if self._size is None: +*/ + +/* Python wrapper */ +static PyObject *__pyx_pw_15View_dot_MemoryView_10memoryview_4size_1__get__(PyObject *__pyx_v_self); /*proto*/ +static PyObject *__pyx_pw_15View_dot_MemoryView_10memoryview_4size_1__get__(PyObject *__pyx_v_self) { + CYTHON_UNUSED PyObject *const *__pyx_kwvalues; + PyObject *__pyx_r = 0; + __Pyx_RefNannyDeclarations + __Pyx_RefNannySetupContext("__get__ (wrapper)", 0); + __pyx_kwvalues = __Pyx_KwValues_VARARGS(__pyx_args, __pyx_nargs); + __pyx_r = __pyx_pf_15View_dot_MemoryView_10memoryview_4size___get__(((struct __pyx_memoryview_obj *)__pyx_v_self)); + + /* function exit code */ + __Pyx_RefNannyFinishContext(); + return __pyx_r; +} + +static PyObject *__pyx_pf_15View_dot_MemoryView_10memoryview_4size___get__(struct __pyx_memoryview_obj *__pyx_v_self) { + PyObject *__pyx_v_result = NULL; + PyObject *__pyx_v_length = NULL; + PyObject *__pyx_r = NULL; + __Pyx_RefNannyDeclarations + int __pyx_t_1; + Py_ssize_t *__pyx_t_2; + Py_ssize_t *__pyx_t_3; + Py_ssize_t *__pyx_t_4; + PyObject *__pyx_t_5 = NULL; + int __pyx_lineno = 0; + const char *__pyx_filename = NULL; + int __pyx_clineno = 0; + __Pyx_RefNannySetupContext("__get__", 0); + + /* "View.MemoryView":601 + * @property + * def size(self): + * if self._size is None: # <<<<<<<<<<<<<< + * result = 1 + * +*/ + __pyx_t_1 = (__pyx_v_self->_size == Py_None); + if (__pyx_t_1) { + + /* "View.MemoryView":602 + * def size(self): + * if self._size is None: + * result = 1 # <<<<<<<<<<<<<< + * + * for length in self.view.shape[:self.view.ndim]: +*/ + __Pyx_INCREF(__pyx_mstate_global->__pyx_int_1); + __pyx_v_result = __pyx_mstate_global->__pyx_int_1; + + /* "View.MemoryView":604 + * result = 1 + * + * for length in self.view.shape[:self.view.ndim]: # <<<<<<<<<<<<<< + * result *= length + * +*/ + __pyx_t_3 = (__pyx_v_self->view.shape + __pyx_v_self->view.ndim); + for (__pyx_t_4 = __pyx_v_self->view.shape; __pyx_t_4 < __pyx_t_3; __pyx_t_4++) { + __pyx_t_2 = __pyx_t_4; + __pyx_t_5 = PyLong_FromSsize_t((__pyx_t_2[0])); if (unlikely(!__pyx_t_5)) __PYX_ERR(1, 604, __pyx_L1_error) + __Pyx_GOTREF(__pyx_t_5); + __Pyx_XDECREF_SET(__pyx_v_length, __pyx_t_5); + __pyx_t_5 = 0; + + /* "View.MemoryView":605 + * + * for length in self.view.shape[:self.view.ndim]: + * result *= length # <<<<<<<<<<<<<< + * + * self._size = result +*/ + __pyx_t_5 = PyNumber_InPlaceMultiply(__pyx_v_result, __pyx_v_length); if (unlikely(!__pyx_t_5)) __PYX_ERR(1, 605, __pyx_L1_error) + __Pyx_GOTREF(__pyx_t_5); + __Pyx_DECREF_SET(__pyx_v_result, __pyx_t_5); + __pyx_t_5 = 0; + } + + /* "View.MemoryView":607 + * result *= length + * + * self._size = result # <<<<<<<<<<<<<< + * + * return self._size +*/ + __Pyx_INCREF(__pyx_v_result); + __Pyx_GIVEREF(__pyx_v_result); + __Pyx_GOTREF(__pyx_v_self->_size); + __Pyx_DECREF(__pyx_v_self->_size); + __pyx_v_self->_size = __pyx_v_result; + + /* "View.MemoryView":601 + * @property + * def size(self): + * if self._size is None: # <<<<<<<<<<<<<< + * result = 1 + * +*/ + } + + /* "View.MemoryView":609 + * self._size = result + * + * return self._size # <<<<<<<<<<<<<< + * + * def __len__(self): +*/ + __Pyx_XDECREF(__pyx_r); + __Pyx_INCREF(__pyx_v_self->_size); + __pyx_r = __pyx_v_self->_size; + goto __pyx_L0; + + /* "View.MemoryView":599 + * return self.size * self.view.itemsize + * + * @property # <<<<<<<<<<<<<< + * def size(self): + * if self._size is None: +*/ + + /* function exit code */ + __pyx_L1_error:; + __Pyx_XDECREF(__pyx_t_5); + __Pyx_AddTraceback("View.MemoryView.memoryview.size.__get__", __pyx_clineno, __pyx_lineno, __pyx_filename); + __pyx_r = NULL; + __pyx_L0:; + __Pyx_XDECREF(__pyx_v_result); + __Pyx_XDECREF(__pyx_v_length); + __Pyx_XGIVEREF(__pyx_r); + __Pyx_RefNannyFinishContext(); + return __pyx_r; +} + +/* "View.MemoryView":611 + * return self._size + * + * def __len__(self): # <<<<<<<<<<<<<< + * if self.view.ndim >= 1: + * return self.view.shape[0] +*/ + +/* Python wrapper */ +static Py_ssize_t __pyx_memoryview___len__(PyObject *__pyx_v_self); /*proto*/ +static Py_ssize_t __pyx_memoryview___len__(PyObject *__pyx_v_self) { + CYTHON_UNUSED PyObject *const *__pyx_kwvalues; + Py_ssize_t __pyx_r; + __Pyx_RefNannyDeclarations + __Pyx_RefNannySetupContext("__len__ (wrapper)", 0); + __pyx_kwvalues = __Pyx_KwValues_VARARGS(__pyx_args, __pyx_nargs); + __pyx_r = __pyx_memoryview___pyx_pf_15View_dot_MemoryView_10memoryview_10__len__(((struct __pyx_memoryview_obj *)__pyx_v_self)); + + /* function exit code */ + __Pyx_RefNannyFinishContext(); + return __pyx_r; +} + +static Py_ssize_t __pyx_memoryview___pyx_pf_15View_dot_MemoryView_10memoryview_10__len__(struct __pyx_memoryview_obj *__pyx_v_self) { + Py_ssize_t __pyx_r; + int __pyx_t_1; + + /* "View.MemoryView":612 + * + * def __len__(self): + * if self.view.ndim >= 1: # <<<<<<<<<<<<<< + * return self.view.shape[0] + * +*/ + __pyx_t_1 = (__pyx_v_self->view.ndim >= 1); + if (__pyx_t_1) { + + /* "View.MemoryView":613 + * def __len__(self): + * if self.view.ndim >= 1: + * return self.view.shape[0] # <<<<<<<<<<<<<< + * + * return 0 +*/ + __pyx_r = (__pyx_v_self->view.shape[0]); + goto __pyx_L0; + + /* "View.MemoryView":612 + * + * def __len__(self): + * if self.view.ndim >= 1: # <<<<<<<<<<<<<< + * return self.view.shape[0] + * +*/ + } + + /* "View.MemoryView":615 + * return self.view.shape[0] + * + * return 0 # <<<<<<<<<<<<<< + * + * def __repr__(self): +*/ + __pyx_r = 0; + goto __pyx_L0; + + /* "View.MemoryView":611 + * return self._size + * + * def __len__(self): # <<<<<<<<<<<<<< + * if self.view.ndim >= 1: + * return self.view.shape[0] +*/ + + /* function exit code */ + __pyx_L0:; + return __pyx_r; +} + +/* "View.MemoryView":617 + * return 0 + * + * def __repr__(self): # <<<<<<<<<<<<<< + * return "" % (self.base.__class__.__name__, + * id(self)) +*/ + +/* Python wrapper */ +static PyObject *__pyx_memoryview___repr__(PyObject *__pyx_v_self); /*proto*/ +static PyObject *__pyx_memoryview___repr__(PyObject *__pyx_v_self) { + CYTHON_UNUSED PyObject *const *__pyx_kwvalues; + PyObject *__pyx_r = 0; + __Pyx_RefNannyDeclarations + __Pyx_RefNannySetupContext("__repr__ (wrapper)", 0); + __pyx_kwvalues = __Pyx_KwValues_VARARGS(__pyx_args, __pyx_nargs); + __pyx_r = __pyx_memoryview___pyx_pf_15View_dot_MemoryView_10memoryview_12__repr__(((struct __pyx_memoryview_obj *)__pyx_v_self)); + + /* function exit code */ + __Pyx_RefNannyFinishContext(); + return __pyx_r; +} + +static PyObject *__pyx_memoryview___pyx_pf_15View_dot_MemoryView_10memoryview_12__repr__(struct __pyx_memoryview_obj *__pyx_v_self) { + PyObject *__pyx_r = NULL; + __Pyx_RefNannyDeclarations + PyObject *__pyx_t_1 = NULL; + PyObject *__pyx_t_2 = NULL; + PyObject *__pyx_t_3 = NULL; + PyObject *__pyx_t_4[5]; + int __pyx_lineno = 0; + const char *__pyx_filename = NULL; + int __pyx_clineno = 0; + __Pyx_RefNannySetupContext("__repr__", 0); + + /* "View.MemoryView":618 + * + * def __repr__(self): + * return "" % (self.base.__class__.__name__, # <<<<<<<<<<<<<< + * id(self)) + * +*/ + __Pyx_XDECREF(__pyx_r); + __pyx_t_1 = __Pyx_PyObject_GetAttrStr(((PyObject *)__pyx_v_self), __pyx_mstate_global->__pyx_n_u_base); if (unlikely(!__pyx_t_1)) __PYX_ERR(1, 618, __pyx_L1_error) + __Pyx_GOTREF(__pyx_t_1); + __pyx_t_2 = __Pyx_PyObject_GetAttrStr(__pyx_t_1, __pyx_mstate_global->__pyx_n_u_class); if (unlikely(!__pyx_t_2)) __PYX_ERR(1, 618, __pyx_L1_error) + __Pyx_GOTREF(__pyx_t_2); + __Pyx_DECREF(__pyx_t_1); __pyx_t_1 = 0; + __pyx_t_1 = __Pyx_PyObject_GetAttrStr(__pyx_t_2, __pyx_mstate_global->__pyx_n_u_name_2); if (unlikely(!__pyx_t_1)) __PYX_ERR(1, 618, __pyx_L1_error) + __Pyx_GOTREF(__pyx_t_1); + __Pyx_DECREF(__pyx_t_2); __pyx_t_2 = 0; + __pyx_t_2 = __Pyx_PyObject_FormatSimpleAndDecref(PyObject_Repr(__pyx_t_1), __pyx_mstate_global->__pyx_empty_unicode); if (unlikely(!__pyx_t_2)) __PYX_ERR(1, 618, __pyx_L1_error) + __Pyx_GOTREF(__pyx_t_2); + __Pyx_DECREF(__pyx_t_1); __pyx_t_1 = 0; + + /* "View.MemoryView":619 + * def __repr__(self): + * return "" % (self.base.__class__.__name__, + * id(self)) # <<<<<<<<<<<<<< + * + * def __str__(self): +*/ + __pyx_t_1 = __Pyx_PyObject_CallOneArg(__pyx_builtin_id, ((PyObject *)__pyx_v_self)); if (unlikely(!__pyx_t_1)) __PYX_ERR(1, 619, __pyx_L1_error) + __Pyx_GOTREF(__pyx_t_1); + __pyx_t_3 = __Pyx_PyObject_Format(__pyx_t_1, __pyx_mstate_global->__pyx_n_u_x); if (unlikely(!__pyx_t_3)) __PYX_ERR(1, 619, __pyx_L1_error) + __Pyx_GOTREF(__pyx_t_3); + __Pyx_DECREF(__pyx_t_1); __pyx_t_1 = 0; + __pyx_t_4[0] = __pyx_mstate_global->__pyx_kp_u_MemoryView_of; + __pyx_t_4[1] = __pyx_t_2; + __pyx_t_4[2] = __pyx_mstate_global->__pyx_kp_u_at_0x; + __pyx_t_4[3] = __pyx_t_3; + __pyx_t_4[4] = __pyx_mstate_global->__pyx_kp_u__3; + + /* "View.MemoryView":618 + * + * def __repr__(self): + * return "" % (self.base.__class__.__name__, # <<<<<<<<<<<<<< + * id(self)) + * +*/ + __pyx_t_1 = __Pyx_PyUnicode_Join(__pyx_t_4, 5, 15 + __Pyx_PyUnicode_GET_LENGTH(__pyx_t_2) + 6 + __Pyx_PyUnicode_GET_LENGTH(__pyx_t_3) + 1, 127 | __Pyx_PyUnicode_MAX_CHAR_VALUE(__pyx_t_2) | __Pyx_PyUnicode_MAX_CHAR_VALUE(__pyx_t_3)); + if (unlikely(!__pyx_t_1)) __PYX_ERR(1, 618, __pyx_L1_error) + __Pyx_GOTREF(__pyx_t_1); + __Pyx_DECREF(__pyx_t_2); __pyx_t_2 = 0; + __Pyx_DECREF(__pyx_t_3); __pyx_t_3 = 0; + __pyx_r = __pyx_t_1; + __pyx_t_1 = 0; + goto __pyx_L0; + + /* "View.MemoryView":617 + * return 0 + * + * def __repr__(self): # <<<<<<<<<<<<<< + * return "" % (self.base.__class__.__name__, + * id(self)) +*/ + + /* function exit code */ + __pyx_L1_error:; + __Pyx_XDECREF(__pyx_t_1); + __Pyx_XDECREF(__pyx_t_2); + __Pyx_XDECREF(__pyx_t_3); + __Pyx_AddTraceback("View.MemoryView.memoryview.__repr__", __pyx_clineno, __pyx_lineno, __pyx_filename); + __pyx_r = NULL; + __pyx_L0:; + __Pyx_XGIVEREF(__pyx_r); + __Pyx_RefNannyFinishContext(); + return __pyx_r; +} + +/* "View.MemoryView":621 + * id(self)) + * + * def __str__(self): # <<<<<<<<<<<<<< + * return "" % (self.base.__class__.__name__,) + * +*/ + +/* Python wrapper */ +static PyObject *__pyx_memoryview___str__(PyObject *__pyx_v_self); /*proto*/ +static PyObject *__pyx_memoryview___str__(PyObject *__pyx_v_self) { + CYTHON_UNUSED PyObject *const *__pyx_kwvalues; + PyObject *__pyx_r = 0; + __Pyx_RefNannyDeclarations + __Pyx_RefNannySetupContext("__str__ (wrapper)", 0); + __pyx_kwvalues = __Pyx_KwValues_VARARGS(__pyx_args, __pyx_nargs); + __pyx_r = __pyx_memoryview___pyx_pf_15View_dot_MemoryView_10memoryview_14__str__(((struct __pyx_memoryview_obj *)__pyx_v_self)); + + /* function exit code */ + __Pyx_RefNannyFinishContext(); + return __pyx_r; +} + +static PyObject *__pyx_memoryview___pyx_pf_15View_dot_MemoryView_10memoryview_14__str__(struct __pyx_memoryview_obj *__pyx_v_self) { + PyObject *__pyx_r = NULL; + __Pyx_RefNannyDeclarations + PyObject *__pyx_t_1 = NULL; + PyObject *__pyx_t_2 = NULL; + PyObject *__pyx_t_3[3]; + int __pyx_lineno = 0; + const char *__pyx_filename = NULL; + int __pyx_clineno = 0; + __Pyx_RefNannySetupContext("__str__", 0); + + /* "View.MemoryView":622 + * + * def __str__(self): + * return "" % (self.base.__class__.__name__,) # <<<<<<<<<<<<<< + * + * +*/ + __Pyx_XDECREF(__pyx_r); + __pyx_t_1 = __Pyx_PyObject_GetAttrStr(((PyObject *)__pyx_v_self), __pyx_mstate_global->__pyx_n_u_base); if (unlikely(!__pyx_t_1)) __PYX_ERR(1, 622, __pyx_L1_error) + __Pyx_GOTREF(__pyx_t_1); + __pyx_t_2 = __Pyx_PyObject_GetAttrStr(__pyx_t_1, __pyx_mstate_global->__pyx_n_u_class); if (unlikely(!__pyx_t_2)) __PYX_ERR(1, 622, __pyx_L1_error) + __Pyx_GOTREF(__pyx_t_2); + __Pyx_DECREF(__pyx_t_1); __pyx_t_1 = 0; + __pyx_t_1 = __Pyx_PyObject_GetAttrStr(__pyx_t_2, __pyx_mstate_global->__pyx_n_u_name_2); if (unlikely(!__pyx_t_1)) __PYX_ERR(1, 622, __pyx_L1_error) + __Pyx_GOTREF(__pyx_t_1); + __Pyx_DECREF(__pyx_t_2); __pyx_t_2 = 0; + __pyx_t_2 = __Pyx_PyObject_FormatSimpleAndDecref(PyObject_Repr(__pyx_t_1), __pyx_mstate_global->__pyx_empty_unicode); if (unlikely(!__pyx_t_2)) __PYX_ERR(1, 622, __pyx_L1_error) + __Pyx_GOTREF(__pyx_t_2); + __Pyx_DECREF(__pyx_t_1); __pyx_t_1 = 0; + __pyx_t_3[0] = __pyx_mstate_global->__pyx_kp_u_MemoryView_of; + __pyx_t_3[1] = __pyx_t_2; + __pyx_t_3[2] = __pyx_mstate_global->__pyx_kp_u_object; + __pyx_t_1 = __Pyx_PyUnicode_Join(__pyx_t_3, 3, 15 + __Pyx_PyUnicode_GET_LENGTH(__pyx_t_2) + 8, 127 | __Pyx_PyUnicode_MAX_CHAR_VALUE(__pyx_t_2)); + if (unlikely(!__pyx_t_1)) __PYX_ERR(1, 622, __pyx_L1_error) + __Pyx_GOTREF(__pyx_t_1); + __Pyx_DECREF(__pyx_t_2); __pyx_t_2 = 0; + __pyx_r = __pyx_t_1; + __pyx_t_1 = 0; + goto __pyx_L0; + + /* "View.MemoryView":621 + * id(self)) + * + * def __str__(self): # <<<<<<<<<<<<<< + * return "" % (self.base.__class__.__name__,) + * +*/ + + /* function exit code */ + __pyx_L1_error:; + __Pyx_XDECREF(__pyx_t_1); + __Pyx_XDECREF(__pyx_t_2); + __Pyx_AddTraceback("View.MemoryView.memoryview.__str__", __pyx_clineno, __pyx_lineno, __pyx_filename); + __pyx_r = NULL; + __pyx_L0:; + __Pyx_XGIVEREF(__pyx_r); + __Pyx_RefNannyFinishContext(); + return __pyx_r; +} + +/* "View.MemoryView":625 + * + * + * def is_c_contig(self): # <<<<<<<<<<<<<< + * cdef __Pyx_memviewslice *mslice + * cdef __Pyx_memviewslice tmp +*/ + +/* Python wrapper */ +static PyObject *__pyx_memoryview_is_c_contig(PyObject *__pyx_v_self, +#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*/ +static PyObject *__pyx_memoryview_is_c_contig(PyObject *__pyx_v_self, +#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_c_contig (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_c_contig", 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_c_contig", __pyx_kwds); return NULL;} + __pyx_r = __pyx_memoryview___pyx_pf_15View_dot_MemoryView_10memoryview_16is_c_contig(((struct __pyx_memoryview_obj *)__pyx_v_self)); + + /* function exit code */ + __Pyx_RefNannyFinishContext(); + return __pyx_r; +} + +static PyObject *__pyx_memoryview___pyx_pf_15View_dot_MemoryView_10memoryview_16is_c_contig(struct __pyx_memoryview_obj *__pyx_v_self) { + __Pyx_memviewslice *__pyx_v_mslice; + __Pyx_memviewslice __pyx_v_tmp; + PyObject *__pyx_r = NULL; + __Pyx_RefNannyDeclarations + __Pyx_memviewslice *__pyx_t_1; + PyObject *__pyx_t_2 = NULL; + int __pyx_lineno = 0; + const char *__pyx_filename = NULL; + int __pyx_clineno = 0; + __Pyx_RefNannySetupContext("is_c_contig", 0); + + /* "View.MemoryView":628 + * cdef __Pyx_memviewslice *mslice + * cdef __Pyx_memviewslice tmp + * mslice = get_slice_from_memview(self, &tmp) # <<<<<<<<<<<<<< + * return slice_is_contig(mslice[0], 'C', self.view.ndim) + * +*/ + __pyx_t_1 = __pyx_memoryview_get_slice_from_memoryview(__pyx_v_self, (&__pyx_v_tmp)); if (unlikely(__pyx_t_1 == ((void *)NULL))) __PYX_ERR(1, 628, __pyx_L1_error) + __pyx_v_mslice = __pyx_t_1; + + /* "View.MemoryView":629 + * cdef __Pyx_memviewslice tmp + * mslice = get_slice_from_memview(self, &tmp) + * return slice_is_contig(mslice[0], 'C', self.view.ndim) # <<<<<<<<<<<<<< + * + * def is_f_contig(self): +*/ + __Pyx_XDECREF(__pyx_r); + __pyx_t_2 = __Pyx_PyBool_FromLong(__pyx_memviewslice_is_contig((__pyx_v_mslice[0]), 'C', __pyx_v_self->view.ndim)); if (unlikely(!__pyx_t_2)) __PYX_ERR(1, 629, __pyx_L1_error) + __Pyx_GOTREF(__pyx_t_2); + __pyx_r = __pyx_t_2; + __pyx_t_2 = 0; + goto __pyx_L0; + + /* "View.MemoryView":625 + * + * + * def is_c_contig(self): # <<<<<<<<<<<<<< + * cdef __Pyx_memviewslice *mslice + * cdef __Pyx_memviewslice tmp +*/ + + /* function exit code */ + __pyx_L1_error:; + __Pyx_XDECREF(__pyx_t_2); + __Pyx_AddTraceback("View.MemoryView.memoryview.is_c_contig", __pyx_clineno, __pyx_lineno, __pyx_filename); + __pyx_r = NULL; + __pyx_L0:; + __Pyx_XGIVEREF(__pyx_r); + __Pyx_RefNannyFinishContext(); + return __pyx_r; +} + +/* "View.MemoryView":631 + * return slice_is_contig(mslice[0], 'C', self.view.ndim) + * + * def is_f_contig(self): # <<<<<<<<<<<<<< + * cdef __Pyx_memviewslice *mslice + * cdef __Pyx_memviewslice tmp +*/ + +/* Python wrapper */ +static PyObject *__pyx_memoryview_is_f_contig(PyObject *__pyx_v_self, +#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*/ +static PyObject *__pyx_memoryview_is_f_contig(PyObject *__pyx_v_self, +#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_f_contig (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_f_contig", 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_f_contig", __pyx_kwds); return NULL;} + __pyx_r = __pyx_memoryview___pyx_pf_15View_dot_MemoryView_10memoryview_18is_f_contig(((struct __pyx_memoryview_obj *)__pyx_v_self)); + + /* function exit code */ + __Pyx_RefNannyFinishContext(); + return __pyx_r; +} + +static PyObject *__pyx_memoryview___pyx_pf_15View_dot_MemoryView_10memoryview_18is_f_contig(struct __pyx_memoryview_obj *__pyx_v_self) { + __Pyx_memviewslice *__pyx_v_mslice; + __Pyx_memviewslice __pyx_v_tmp; + PyObject *__pyx_r = NULL; + __Pyx_RefNannyDeclarations + __Pyx_memviewslice *__pyx_t_1; + PyObject *__pyx_t_2 = NULL; + int __pyx_lineno = 0; + const char *__pyx_filename = NULL; + int __pyx_clineno = 0; + __Pyx_RefNannySetupContext("is_f_contig", 0); + + /* "View.MemoryView":634 + * cdef __Pyx_memviewslice *mslice + * cdef __Pyx_memviewslice tmp + * mslice = get_slice_from_memview(self, &tmp) # <<<<<<<<<<<<<< + * return slice_is_contig(mslice[0], 'F', self.view.ndim) + * +*/ + __pyx_t_1 = __pyx_memoryview_get_slice_from_memoryview(__pyx_v_self, (&__pyx_v_tmp)); if (unlikely(__pyx_t_1 == ((void *)NULL))) __PYX_ERR(1, 634, __pyx_L1_error) + __pyx_v_mslice = __pyx_t_1; + + /* "View.MemoryView":635 + * cdef __Pyx_memviewslice tmp + * mslice = get_slice_from_memview(self, &tmp) + * return slice_is_contig(mslice[0], 'F', self.view.ndim) # <<<<<<<<<<<<<< + * + * def copy(self): +*/ + __Pyx_XDECREF(__pyx_r); + __pyx_t_2 = __Pyx_PyBool_FromLong(__pyx_memviewslice_is_contig((__pyx_v_mslice[0]), 'F', __pyx_v_self->view.ndim)); if (unlikely(!__pyx_t_2)) __PYX_ERR(1, 635, __pyx_L1_error) + __Pyx_GOTREF(__pyx_t_2); + __pyx_r = __pyx_t_2; + __pyx_t_2 = 0; + goto __pyx_L0; + + /* "View.MemoryView":631 + * return slice_is_contig(mslice[0], 'C', self.view.ndim) + * + * def is_f_contig(self): # <<<<<<<<<<<<<< + * cdef __Pyx_memviewslice *mslice + * cdef __Pyx_memviewslice tmp +*/ + + /* function exit code */ + __pyx_L1_error:; + __Pyx_XDECREF(__pyx_t_2); + __Pyx_AddTraceback("View.MemoryView.memoryview.is_f_contig", __pyx_clineno, __pyx_lineno, __pyx_filename); + __pyx_r = NULL; + __pyx_L0:; + __Pyx_XGIVEREF(__pyx_r); + __Pyx_RefNannyFinishContext(); + return __pyx_r; +} + +/* "View.MemoryView":637 + * return slice_is_contig(mslice[0], 'F', self.view.ndim) + * + * def copy(self): # <<<<<<<<<<<<<< + * cdef __Pyx_memviewslice mslice + * cdef int flags = self.flags & ~PyBUF_F_CONTIGUOUS +*/ + +/* Python wrapper */ +static PyObject *__pyx_memoryview_copy(PyObject *__pyx_v_self, +#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*/ +static PyObject *__pyx_memoryview_copy(PyObject *__pyx_v_self, +#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("copy (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("copy", 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("copy", __pyx_kwds); return NULL;} + __pyx_r = __pyx_memoryview___pyx_pf_15View_dot_MemoryView_10memoryview_20copy(((struct __pyx_memoryview_obj *)__pyx_v_self)); + + /* function exit code */ + __Pyx_RefNannyFinishContext(); + return __pyx_r; +} + +static PyObject *__pyx_memoryview___pyx_pf_15View_dot_MemoryView_10memoryview_20copy(struct __pyx_memoryview_obj *__pyx_v_self) { + __Pyx_memviewslice __pyx_v_mslice; + int __pyx_v_flags; + PyObject *__pyx_r = NULL; + __Pyx_RefNannyDeclarations + __Pyx_memviewslice __pyx_t_1; + PyObject *__pyx_t_2 = NULL; + int __pyx_lineno = 0; + const char *__pyx_filename = NULL; + int __pyx_clineno = 0; + __Pyx_RefNannySetupContext("copy", 0); + + /* "View.MemoryView":639 + * def copy(self): + * cdef __Pyx_memviewslice mslice + * cdef int flags = self.flags & ~PyBUF_F_CONTIGUOUS # <<<<<<<<<<<<<< + * + * slice_copy(self, &mslice) +*/ + __pyx_v_flags = (__pyx_v_self->flags & (~PyBUF_F_CONTIGUOUS)); + + /* "View.MemoryView":641 + * cdef int flags = self.flags & ~PyBUF_F_CONTIGUOUS + * + * slice_copy(self, &mslice) # <<<<<<<<<<<<<< + * mslice = slice_copy_contig(&mslice, "c", self.view.ndim, + * self.view.itemsize, +*/ + __pyx_memoryview_slice_copy(__pyx_v_self, (&__pyx_v_mslice)); + + /* "View.MemoryView":642 + * + * slice_copy(self, &mslice) + * mslice = slice_copy_contig(&mslice, "c", self.view.ndim, # <<<<<<<<<<<<<< + * self.view.itemsize, + * flags|PyBUF_C_CONTIGUOUS, +*/ + __pyx_t_1 = __pyx_memoryview_copy_new_contig((&__pyx_v_mslice), ((char const *)"c"), __pyx_v_self->view.ndim, __pyx_v_self->view.itemsize, (__pyx_v_flags | PyBUF_C_CONTIGUOUS), __pyx_v_self->dtype_is_object); if (unlikely(PyErr_Occurred())) __PYX_ERR(1, 642, __pyx_L1_error) + __pyx_v_mslice = __pyx_t_1; + + /* "View.MemoryView":647 + * self.dtype_is_object) + * + * return memoryview_copy_from_slice(self, &mslice) # <<<<<<<<<<<<<< + * + * def copy_fortran(self): +*/ + __Pyx_XDECREF(__pyx_r); + __pyx_t_2 = __pyx_memoryview_copy_object_from_slice(__pyx_v_self, (&__pyx_v_mslice)); if (unlikely(!__pyx_t_2)) __PYX_ERR(1, 647, __pyx_L1_error) + __Pyx_GOTREF(__pyx_t_2); + __pyx_r = __pyx_t_2; + __pyx_t_2 = 0; + goto __pyx_L0; + + /* "View.MemoryView":637 + * return slice_is_contig(mslice[0], 'F', self.view.ndim) + * + * def copy(self): # <<<<<<<<<<<<<< + * cdef __Pyx_memviewslice mslice + * cdef int flags = self.flags & ~PyBUF_F_CONTIGUOUS +*/ + + /* function exit code */ + __pyx_L1_error:; + __Pyx_XDECREF(__pyx_t_2); + __Pyx_AddTraceback("View.MemoryView.memoryview.copy", __pyx_clineno, __pyx_lineno, __pyx_filename); + __pyx_r = NULL; + __pyx_L0:; + __Pyx_XGIVEREF(__pyx_r); + __Pyx_RefNannyFinishContext(); + return __pyx_r; +} + +/* "View.MemoryView":649 + * return memoryview_copy_from_slice(self, &mslice) + * + * def copy_fortran(self): # <<<<<<<<<<<<<< + * cdef __Pyx_memviewslice src, dst + * cdef int flags = self.flags & ~PyBUF_C_CONTIGUOUS +*/ + +/* Python wrapper */ +static PyObject *__pyx_memoryview_copy_fortran(PyObject *__pyx_v_self, +#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*/ +static PyObject *__pyx_memoryview_copy_fortran(PyObject *__pyx_v_self, +#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("copy_fortran (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("copy_fortran", 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("copy_fortran", __pyx_kwds); return NULL;} + __pyx_r = __pyx_memoryview___pyx_pf_15View_dot_MemoryView_10memoryview_22copy_fortran(((struct __pyx_memoryview_obj *)__pyx_v_self)); + + /* function exit code */ + __Pyx_RefNannyFinishContext(); + return __pyx_r; +} + +static PyObject *__pyx_memoryview___pyx_pf_15View_dot_MemoryView_10memoryview_22copy_fortran(struct __pyx_memoryview_obj *__pyx_v_self) { + __Pyx_memviewslice __pyx_v_src; + __Pyx_memviewslice __pyx_v_dst; + int __pyx_v_flags; + PyObject *__pyx_r = NULL; + __Pyx_RefNannyDeclarations + __Pyx_memviewslice __pyx_t_1; + PyObject *__pyx_t_2 = NULL; + int __pyx_lineno = 0; + const char *__pyx_filename = NULL; + int __pyx_clineno = 0; + __Pyx_RefNannySetupContext("copy_fortran", 0); + + /* "View.MemoryView":651 + * def copy_fortran(self): + * cdef __Pyx_memviewslice src, dst + * cdef int flags = self.flags & ~PyBUF_C_CONTIGUOUS # <<<<<<<<<<<<<< + * + * slice_copy(self, &src) +*/ + __pyx_v_flags = (__pyx_v_self->flags & (~PyBUF_C_CONTIGUOUS)); + + /* "View.MemoryView":653 + * cdef int flags = self.flags & ~PyBUF_C_CONTIGUOUS + * + * slice_copy(self, &src) # <<<<<<<<<<<<<< + * dst = slice_copy_contig(&src, "fortran", self.view.ndim, + * self.view.itemsize, +*/ + __pyx_memoryview_slice_copy(__pyx_v_self, (&__pyx_v_src)); + + /* "View.MemoryView":654 + * + * slice_copy(self, &src) + * dst = slice_copy_contig(&src, "fortran", self.view.ndim, # <<<<<<<<<<<<<< + * self.view.itemsize, + * flags|PyBUF_F_CONTIGUOUS, +*/ + __pyx_t_1 = __pyx_memoryview_copy_new_contig((&__pyx_v_src), ((char const *)"fortran"), __pyx_v_self->view.ndim, __pyx_v_self->view.itemsize, (__pyx_v_flags | PyBUF_F_CONTIGUOUS), __pyx_v_self->dtype_is_object); if (unlikely(PyErr_Occurred())) __PYX_ERR(1, 654, __pyx_L1_error) + __pyx_v_dst = __pyx_t_1; + + /* "View.MemoryView":659 + * self.dtype_is_object) + * + * return memoryview_copy_from_slice(self, &dst) # <<<<<<<<<<<<<< + * + * +*/ + __Pyx_XDECREF(__pyx_r); + __pyx_t_2 = __pyx_memoryview_copy_object_from_slice(__pyx_v_self, (&__pyx_v_dst)); if (unlikely(!__pyx_t_2)) __PYX_ERR(1, 659, __pyx_L1_error) + __Pyx_GOTREF(__pyx_t_2); + __pyx_r = __pyx_t_2; + __pyx_t_2 = 0; + goto __pyx_L0; + + /* "View.MemoryView":649 + * return memoryview_copy_from_slice(self, &mslice) + * + * def copy_fortran(self): # <<<<<<<<<<<<<< + * cdef __Pyx_memviewslice src, dst + * cdef int flags = self.flags & ~PyBUF_C_CONTIGUOUS +*/ + + /* function exit code */ + __pyx_L1_error:; + __Pyx_XDECREF(__pyx_t_2); + __Pyx_AddTraceback("View.MemoryView.memoryview.copy_fortran", __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___pyx_memoryview_1__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*/ +static PyObject *__pyx_pw___pyx_memoryview_1__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___pyx_memoryview___reduce_cython__(((struct __pyx_memoryview_obj *)__pyx_v_self)); + + /* function exit code */ + __Pyx_RefNannyFinishContext(); + return __pyx_r; +} + +static PyObject *__pyx_pf___pyx_memoryview___reduce_cython__(CYTHON_UNUSED struct __pyx_memoryview_obj *__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("View.MemoryView.memoryview.__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___pyx_memoryview_3__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*/ +static PyObject *__pyx_pw___pyx_memoryview_3__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("View.MemoryView.memoryview.__setstate_cython__", __pyx_clineno, __pyx_lineno, __pyx_filename); + __Pyx_RefNannyFinishContext(); + return NULL; + __pyx_L4_argument_unpacking_done:; + __pyx_r = __pyx_pf___pyx_memoryview_2__setstate_cython__(((struct __pyx_memoryview_obj *)__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___pyx_memoryview_2__setstate_cython__(CYTHON_UNUSED struct __pyx_memoryview_obj *__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("View.MemoryView.memoryview.__setstate_cython__", __pyx_clineno, __pyx_lineno, __pyx_filename); + __pyx_r = NULL; + __Pyx_XGIVEREF(__pyx_r); + __Pyx_RefNannyFinishContext(); + return __pyx_r; +} + +/* "View.MemoryView":662 + * + * + * @cname('__pyx_memoryview_new') # <<<<<<<<<<<<<< + * cdef memoryview_cwrapper(object o, int flags, bint dtype_is_object, const __Pyx_TypeInfo *typeinfo): + * cdef memoryview result = memoryview(o, flags, dtype_is_object) +*/ + +static PyObject *__pyx_memoryview_new(PyObject *__pyx_v_o, int __pyx_v_flags, int __pyx_v_dtype_is_object, __Pyx_TypeInfo const *__pyx_v_typeinfo) { + struct __pyx_memoryview_obj *__pyx_v_result = 0; + PyObject *__pyx_r = NULL; + __Pyx_RefNannyDeclarations + PyObject *__pyx_t_1 = NULL; + PyObject *__pyx_t_2 = NULL; + PyObject *__pyx_t_3 = NULL; + PyObject *__pyx_t_4 = NULL; + size_t __pyx_t_5; + int __pyx_lineno = 0; + const char *__pyx_filename = NULL; + int __pyx_clineno = 0; + __Pyx_RefNannySetupContext("memoryview_cwrapper", 0); + + /* "View.MemoryView":664 + * @cname('__pyx_memoryview_new') + * cdef memoryview_cwrapper(object o, int flags, bint dtype_is_object, const __Pyx_TypeInfo *typeinfo): + * cdef memoryview result = memoryview(o, flags, dtype_is_object) # <<<<<<<<<<<<<< + * result.typeinfo = typeinfo + * return result +*/ + __pyx_t_2 = NULL; + __pyx_t_3 = __Pyx_PyLong_From_int(__pyx_v_flags); if (unlikely(!__pyx_t_3)) __PYX_ERR(1, 664, __pyx_L1_error) + __Pyx_GOTREF(__pyx_t_3); + __pyx_t_4 = __Pyx_PyBool_FromLong(__pyx_v_dtype_is_object); if (unlikely(!__pyx_t_4)) __PYX_ERR(1, 664, __pyx_L1_error) + __Pyx_GOTREF(__pyx_t_4); + __pyx_t_5 = 1; + { + PyObject *__pyx_callargs[4] = {__pyx_t_2, __pyx_v_o, __pyx_t_3, __pyx_t_4}; + __pyx_t_1 = __Pyx_PyObject_FastCall((PyObject*)__pyx_mstate_global->__pyx_memoryview_type, __pyx_callargs+__pyx_t_5, (4-__pyx_t_5) | (__pyx_t_5*__Pyx_PY_VECTORCALL_ARGUMENTS_OFFSET)); + __Pyx_XDECREF(__pyx_t_2); __pyx_t_2 = 0; + __Pyx_DECREF(__pyx_t_3); __pyx_t_3 = 0; + __Pyx_DECREF(__pyx_t_4); __pyx_t_4 = 0; + if (unlikely(!__pyx_t_1)) __PYX_ERR(1, 664, __pyx_L1_error) + __Pyx_GOTREF((PyObject *)__pyx_t_1); + } + __pyx_v_result = ((struct __pyx_memoryview_obj *)__pyx_t_1); + __pyx_t_1 = 0; + + /* "View.MemoryView":665 + * cdef memoryview_cwrapper(object o, int flags, bint dtype_is_object, const __Pyx_TypeInfo *typeinfo): + * cdef memoryview result = memoryview(o, flags, dtype_is_object) + * result.typeinfo = typeinfo # <<<<<<<<<<<<<< + * return result + * +*/ + __pyx_v_result->typeinfo = __pyx_v_typeinfo; + + /* "View.MemoryView":666 + * cdef memoryview result = memoryview(o, flags, dtype_is_object) + * result.typeinfo = typeinfo + * return result # <<<<<<<<<<<<<< + * + * @cname('__pyx_memoryview_check') +*/ + __Pyx_XDECREF(__pyx_r); + __Pyx_INCREF((PyObject *)__pyx_v_result); + __pyx_r = ((PyObject *)__pyx_v_result); + goto __pyx_L0; + + /* "View.MemoryView":662 + * + * + * @cname('__pyx_memoryview_new') # <<<<<<<<<<<<<< + * cdef memoryview_cwrapper(object o, int flags, bint dtype_is_object, const __Pyx_TypeInfo *typeinfo): + * cdef memoryview result = memoryview(o, flags, dtype_is_object) +*/ + + /* function exit code */ + __pyx_L1_error:; + __Pyx_XDECREF(__pyx_t_1); + __Pyx_XDECREF(__pyx_t_2); + __Pyx_XDECREF(__pyx_t_3); + __Pyx_XDECREF(__pyx_t_4); + __Pyx_AddTraceback("View.MemoryView.memoryview_cwrapper", __pyx_clineno, __pyx_lineno, __pyx_filename); + __pyx_r = 0; + __pyx_L0:; + __Pyx_XDECREF((PyObject *)__pyx_v_result); + __Pyx_XGIVEREF(__pyx_r); + __Pyx_RefNannyFinishContext(); + return __pyx_r; +} + +/* "View.MemoryView":668 + * return result + * + * @cname('__pyx_memoryview_check') # <<<<<<<<<<<<<< + * cdef inline bint memoryview_check(object o) noexcept: + * return isinstance(o, memoryview) +*/ + +static CYTHON_INLINE int __pyx_memoryview_check(PyObject *__pyx_v_o) { + int __pyx_r; + int __pyx_t_1; + + /* "View.MemoryView":670 + * @cname('__pyx_memoryview_check') + * cdef inline bint memoryview_check(object o) noexcept: + * return isinstance(o, memoryview) # <<<<<<<<<<<<<< + * + * cdef tuple _unellipsify(object index, int ndim): +*/ + __pyx_t_1 = __Pyx_TypeCheck(__pyx_v_o, __pyx_mstate_global->__pyx_memoryview_type); + __pyx_r = __pyx_t_1; + goto __pyx_L0; + + /* "View.MemoryView":668 + * return result + * + * @cname('__pyx_memoryview_check') # <<<<<<<<<<<<<< + * cdef inline bint memoryview_check(object o) noexcept: + * return isinstance(o, memoryview) +*/ + + /* function exit code */ + __pyx_L0:; + return __pyx_r; +} + +/* "View.MemoryView":672 + * return isinstance(o, memoryview) + * + * cdef tuple _unellipsify(object index, int ndim): # <<<<<<<<<<<<<< + * """ + * Replace all ellipses with full slices and fill incomplete indices with +*/ + +static PyObject *_unellipsify(PyObject *__pyx_v_index, int __pyx_v_ndim) { + Py_ssize_t __pyx_v_idx; + PyObject *__pyx_v_tup = NULL; + PyObject *__pyx_v_result = NULL; + int __pyx_v_have_slices; + int __pyx_v_seen_ellipsis; + PyObject *__pyx_v_item = NULL; + Py_ssize_t __pyx_v_nslices; + PyObject *__pyx_r = NULL; + __Pyx_RefNannyDeclarations + PyObject *__pyx_t_1 = NULL; + int __pyx_t_2; + PyObject *__pyx_t_3 = NULL; + Py_ssize_t __pyx_t_4; + Py_ssize_t __pyx_t_5; + PyObject *__pyx_t_6[3]; + PyObject *__pyx_t_7 = NULL; + int __pyx_lineno = 0; + const char *__pyx_filename = NULL; + int __pyx_clineno = 0; + __Pyx_RefNannySetupContext("_unellipsify", 0); + + /* "View.MemoryView":678 + * """ + * cdef Py_ssize_t idx + * tup = index if isinstance(index, tuple) else (index,) # <<<<<<<<<<<<<< + * + * result = [slice(None)] * ndim +*/ + __pyx_t_2 = PyTuple_Check(__pyx_v_index); + if (__pyx_t_2) { + __Pyx_INCREF(((PyObject*)__pyx_v_index)); + __pyx_t_1 = __pyx_v_index; + } else { + __pyx_t_3 = PyTuple_New(1); if (unlikely(!__pyx_t_3)) __PYX_ERR(1, 678, __pyx_L1_error) + __Pyx_GOTREF(__pyx_t_3); + __Pyx_INCREF(__pyx_v_index); + __Pyx_GIVEREF(__pyx_v_index); + if (__Pyx_PyTuple_SET_ITEM(__pyx_t_3, 0, __pyx_v_index) != (0)) __PYX_ERR(1, 678, __pyx_L1_error); + __pyx_t_1 = __pyx_t_3; + __pyx_t_3 = 0; + } + __pyx_v_tup = ((PyObject*)__pyx_t_1); + __pyx_t_1 = 0; + + /* "View.MemoryView":680 + * tup = index if isinstance(index, tuple) else (index,) + * + * result = [slice(None)] * ndim # <<<<<<<<<<<<<< + * have_slices = False + * seen_ellipsis = False +*/ + __pyx_t_1 = PyList_New(1 * ((__pyx_v_ndim<0) ? 0:__pyx_v_ndim)); if (unlikely(!__pyx_t_1)) __PYX_ERR(1, 680, __pyx_L1_error) + __Pyx_GOTREF(__pyx_t_1); + { Py_ssize_t __pyx_temp; + for (__pyx_temp=0; __pyx_temp < __pyx_v_ndim; __pyx_temp++) { + __Pyx_INCREF(__pyx_mstate_global->__pyx_slice[0]); + __Pyx_GIVEREF(__pyx_mstate_global->__pyx_slice[0]); + if (__Pyx_PyList_SET_ITEM(__pyx_t_1, __pyx_temp, __pyx_mstate_global->__pyx_slice[0]) != (0)) __PYX_ERR(1, 680, __pyx_L1_error); + } + } + __pyx_v_result = ((PyObject*)__pyx_t_1); + __pyx_t_1 = 0; + + /* "View.MemoryView":681 + * + * result = [slice(None)] * ndim + * have_slices = False # <<<<<<<<<<<<<< + * seen_ellipsis = False + * idx = 0 +*/ + __pyx_v_have_slices = 0; + + /* "View.MemoryView":682 + * result = [slice(None)] * ndim + * have_slices = False + * seen_ellipsis = False # <<<<<<<<<<<<<< + * idx = 0 + * for item in tup: +*/ + __pyx_v_seen_ellipsis = 0; + + /* "View.MemoryView":683 + * have_slices = False + * seen_ellipsis = False + * idx = 0 # <<<<<<<<<<<<<< + * for item in tup: + * if item is Ellipsis: +*/ + __pyx_v_idx = 0; + + /* "View.MemoryView":684 + * seen_ellipsis = False + * idx = 0 + * for item in tup: # <<<<<<<<<<<<<< + * if item is Ellipsis: + * if not seen_ellipsis: +*/ + if (unlikely(__pyx_v_tup == Py_None)) { + PyErr_SetString(PyExc_TypeError, "'NoneType' object is not iterable"); + __PYX_ERR(1, 684, __pyx_L1_error) + } + __pyx_t_1 = __pyx_v_tup; __Pyx_INCREF(__pyx_t_1); + __pyx_t_4 = 0; + for (;;) { + { + Py_ssize_t __pyx_temp = __Pyx_PyTuple_GET_SIZE(__pyx_t_1); + #if !CYTHON_ASSUME_SAFE_SIZE + if (unlikely((__pyx_temp < 0))) __PYX_ERR(1, 684, __pyx_L1_error) + #endif + if (__pyx_t_4 >= __pyx_temp) break; + } + #if CYTHON_ASSUME_SAFE_MACROS && !CYTHON_AVOID_BORROWED_REFS + __pyx_t_3 = __Pyx_NewRef(PyTuple_GET_ITEM(__pyx_t_1, __pyx_t_4)); + #else + __pyx_t_3 = __Pyx_PySequence_ITEM(__pyx_t_1, __pyx_t_4); + #endif + ++__pyx_t_4; + if (unlikely(!__pyx_t_3)) __PYX_ERR(1, 684, __pyx_L1_error) + __Pyx_GOTREF(__pyx_t_3); + __Pyx_XDECREF_SET(__pyx_v_item, __pyx_t_3); + __pyx_t_3 = 0; + + /* "View.MemoryView":685 + * idx = 0 + * for item in tup: + * if item is Ellipsis: # <<<<<<<<<<<<<< + * if not seen_ellipsis: + * idx += ndim - len(tup) +*/ + __pyx_t_2 = (__pyx_v_item == __pyx_builtin_Ellipsis); + if (__pyx_t_2) { + + /* "View.MemoryView":686 + * for item in tup: + * if item is Ellipsis: + * if not seen_ellipsis: # <<<<<<<<<<<<<< + * idx += ndim - len(tup) + * seen_ellipsis = True +*/ + __pyx_t_2 = (!__pyx_v_seen_ellipsis); + if (__pyx_t_2) { + + /* "View.MemoryView":687 + * if item is Ellipsis: + * if not seen_ellipsis: + * idx += ndim - len(tup) # <<<<<<<<<<<<<< + * seen_ellipsis = True + * have_slices = True +*/ + if (unlikely(__pyx_v_tup == Py_None)) { + PyErr_SetString(PyExc_TypeError, "object of type 'NoneType' has no len()"); + __PYX_ERR(1, 687, __pyx_L1_error) + } + __pyx_t_5 = __Pyx_PyTuple_GET_SIZE(__pyx_v_tup); if (unlikely(__pyx_t_5 == ((Py_ssize_t)-1))) __PYX_ERR(1, 687, __pyx_L1_error) + __pyx_v_idx = (__pyx_v_idx + (__pyx_v_ndim - __pyx_t_5)); + + /* "View.MemoryView":688 + * if not seen_ellipsis: + * idx += ndim - len(tup) + * seen_ellipsis = True # <<<<<<<<<<<<<< + * have_slices = True + * else: +*/ + __pyx_v_seen_ellipsis = 1; + + /* "View.MemoryView":686 + * for item in tup: + * if item is Ellipsis: + * if not seen_ellipsis: # <<<<<<<<<<<<<< + * idx += ndim - len(tup) + * seen_ellipsis = True +*/ + } + + /* "View.MemoryView":689 + * idx += ndim - len(tup) + * seen_ellipsis = True + * have_slices = True # <<<<<<<<<<<<<< + * else: + * if isinstance(item, slice): +*/ + __pyx_v_have_slices = 1; + + /* "View.MemoryView":685 + * idx = 0 + * for item in tup: + * if item is Ellipsis: # <<<<<<<<<<<<<< + * if not seen_ellipsis: + * idx += ndim - len(tup) +*/ + goto __pyx_L5; + } + + /* "View.MemoryView":691 + * have_slices = True + * else: + * if isinstance(item, slice): # <<<<<<<<<<<<<< + * have_slices = True + * elif not PyIndex_Check(item): +*/ + /*else*/ { + __pyx_t_2 = PySlice_Check(__pyx_v_item); + if (__pyx_t_2) { + + /* "View.MemoryView":692 + * else: + * if isinstance(item, slice): + * have_slices = True # <<<<<<<<<<<<<< + * elif not PyIndex_Check(item): + * raise TypeError, f"Cannot index with type '{type(item)}'" +*/ + __pyx_v_have_slices = 1; + + /* "View.MemoryView":691 + * have_slices = True + * else: + * if isinstance(item, slice): # <<<<<<<<<<<<<< + * have_slices = True + * elif not PyIndex_Check(item): +*/ + goto __pyx_L7; + } + + /* "View.MemoryView":693 + * if isinstance(item, slice): + * have_slices = True + * elif not PyIndex_Check(item): # <<<<<<<<<<<<<< + * raise TypeError, f"Cannot index with type '{type(item)}'" + * result[idx] = item +*/ + __pyx_t_2 = (!(PyIndex_Check(__pyx_v_item) != 0)); + if (unlikely(__pyx_t_2)) { + + /* "View.MemoryView":694 + * have_slices = True + * elif not PyIndex_Check(item): + * raise TypeError, f"Cannot index with type '{type(item)}'" # <<<<<<<<<<<<<< + * result[idx] = item + * idx += 1 +*/ + __pyx_t_3 = __Pyx_PyObject_FormatSimple(((PyObject *)Py_TYPE(__pyx_v_item)), __pyx_mstate_global->__pyx_empty_unicode); if (unlikely(!__pyx_t_3)) __PYX_ERR(1, 694, __pyx_L1_error) + __Pyx_GOTREF(__pyx_t_3); + __pyx_t_6[0] = __pyx_mstate_global->__pyx_kp_u_Cannot_index_with_type; + __pyx_t_6[1] = __pyx_t_3; + __pyx_t_6[2] = __pyx_mstate_global->__pyx_kp_u__4; + __pyx_t_7 = __Pyx_PyUnicode_Join(__pyx_t_6, 3, 24 + __Pyx_PyUnicode_GET_LENGTH(__pyx_t_3) + 1, 127 | __Pyx_PyUnicode_MAX_CHAR_VALUE(__pyx_t_3)); + if (unlikely(!__pyx_t_7)) __PYX_ERR(1, 694, __pyx_L1_error) + __Pyx_GOTREF(__pyx_t_7); + __Pyx_DECREF(__pyx_t_3); __pyx_t_3 = 0; + __Pyx_Raise(((PyObject *)(((PyTypeObject*)PyExc_TypeError))), __pyx_t_7, 0, 0); + __Pyx_DECREF(__pyx_t_7); __pyx_t_7 = 0; + __PYX_ERR(1, 694, __pyx_L1_error) + + /* "View.MemoryView":693 + * if isinstance(item, slice): + * have_slices = True + * elif not PyIndex_Check(item): # <<<<<<<<<<<<<< + * raise TypeError, f"Cannot index with type '{type(item)}'" + * result[idx] = item +*/ + } + __pyx_L7:; + + /* "View.MemoryView":695 + * elif not PyIndex_Check(item): + * raise TypeError, f"Cannot index with type '{type(item)}'" + * result[idx] = item # <<<<<<<<<<<<<< + * idx += 1 + * +*/ + if (unlikely((__Pyx_SetItemInt(__pyx_v_result, __pyx_v_idx, __pyx_v_item, Py_ssize_t, 1, PyLong_FromSsize_t, 1, 1, 1, 1, __Pyx_ReferenceSharing_OwnStrongReference) < 0))) __PYX_ERR(1, 695, __pyx_L1_error) + } + __pyx_L5:; + + /* "View.MemoryView":696 + * raise TypeError, f"Cannot index with type '{type(item)}'" + * result[idx] = item + * idx += 1 # <<<<<<<<<<<<<< + * + * nslices = ndim - idx +*/ + __pyx_v_idx = (__pyx_v_idx + 1); + + /* "View.MemoryView":684 + * seen_ellipsis = False + * idx = 0 + * for item in tup: # <<<<<<<<<<<<<< + * if item is Ellipsis: + * if not seen_ellipsis: +*/ + } + __Pyx_DECREF(__pyx_t_1); __pyx_t_1 = 0; + + /* "View.MemoryView":698 + * idx += 1 + * + * nslices = ndim - idx # <<<<<<<<<<<<<< + * return have_slices or nslices, tuple(result) + * +*/ + __pyx_v_nslices = (__pyx_v_ndim - __pyx_v_idx); + + /* "View.MemoryView":699 + * + * nslices = ndim - idx + * return have_slices or nslices, tuple(result) # <<<<<<<<<<<<<< + * + * cdef int assert_direct_dimensions(Py_ssize_t *suboffsets, int ndim) except -1: +*/ + __Pyx_XDECREF(__pyx_r); + if (!__pyx_v_have_slices) { + } else { + __pyx_t_7 = __Pyx_PyBool_FromLong(__pyx_v_have_slices); if (unlikely(!__pyx_t_7)) __PYX_ERR(1, 699, __pyx_L1_error) + __Pyx_GOTREF(__pyx_t_7); + __pyx_t_1 = __pyx_t_7; + __pyx_t_7 = 0; + goto __pyx_L9_bool_binop_done; + } + __pyx_t_7 = PyLong_FromSsize_t(__pyx_v_nslices); if (unlikely(!__pyx_t_7)) __PYX_ERR(1, 699, __pyx_L1_error) + __Pyx_GOTREF(__pyx_t_7); + __pyx_t_1 = __pyx_t_7; + __pyx_t_7 = 0; + __pyx_L9_bool_binop_done:; + __pyx_t_7 = PyList_AsTuple(__pyx_v_result); if (unlikely(!__pyx_t_7)) __PYX_ERR(1, 699, __pyx_L1_error) + __Pyx_GOTREF(__pyx_t_7); + __pyx_t_3 = PyTuple_New(2); if (unlikely(!__pyx_t_3)) __PYX_ERR(1, 699, __pyx_L1_error) + __Pyx_GOTREF(__pyx_t_3); + __Pyx_GIVEREF(__pyx_t_1); + if (__Pyx_PyTuple_SET_ITEM(__pyx_t_3, 0, __pyx_t_1) != (0)) __PYX_ERR(1, 699, __pyx_L1_error); + __Pyx_GIVEREF(__pyx_t_7); + if (__Pyx_PyTuple_SET_ITEM(__pyx_t_3, 1, __pyx_t_7) != (0)) __PYX_ERR(1, 699, __pyx_L1_error); + __pyx_t_1 = 0; + __pyx_t_7 = 0; + __pyx_r = ((PyObject*)__pyx_t_3); + __pyx_t_3 = 0; + goto __pyx_L0; + + /* "View.MemoryView":672 + * return isinstance(o, memoryview) + * + * cdef tuple _unellipsify(object index, int ndim): # <<<<<<<<<<<<<< + * """ + * Replace all ellipses with full slices and fill incomplete indices with +*/ + + /* function exit code */ + __pyx_L1_error:; + __Pyx_XDECREF(__pyx_t_1); + __Pyx_XDECREF(__pyx_t_3); + __Pyx_XDECREF(__pyx_t_7); + __Pyx_AddTraceback("View.MemoryView._unellipsify", __pyx_clineno, __pyx_lineno, __pyx_filename); + __pyx_r = 0; + __pyx_L0:; + __Pyx_XDECREF(__pyx_v_tup); + __Pyx_XDECREF(__pyx_v_result); + __Pyx_XDECREF(__pyx_v_item); + __Pyx_XGIVEREF(__pyx_r); + __Pyx_RefNannyFinishContext(); + return __pyx_r; +} + +/* "View.MemoryView":701 + * return have_slices or nslices, tuple(result) + * + * cdef int assert_direct_dimensions(Py_ssize_t *suboffsets, int ndim) except -1: # <<<<<<<<<<<<<< + * for suboffset in suboffsets[:ndim]: + * if suboffset >= 0: +*/ + +static int assert_direct_dimensions(Py_ssize_t *__pyx_v_suboffsets, int __pyx_v_ndim) { + Py_ssize_t __pyx_v_suboffset; + int __pyx_r; + Py_ssize_t *__pyx_t_1; + Py_ssize_t *__pyx_t_2; + Py_ssize_t *__pyx_t_3; + int __pyx_t_4; + int __pyx_lineno = 0; + const char *__pyx_filename = NULL; + int __pyx_clineno = 0; + + /* "View.MemoryView":702 + * + * cdef int assert_direct_dimensions(Py_ssize_t *suboffsets, int ndim) except -1: + * for suboffset in suboffsets[:ndim]: # <<<<<<<<<<<<<< + * if suboffset >= 0: + * raise ValueError, "Indirect dimensions not supported" +*/ + __pyx_t_2 = (__pyx_v_suboffsets + __pyx_v_ndim); + for (__pyx_t_3 = __pyx_v_suboffsets; __pyx_t_3 < __pyx_t_2; __pyx_t_3++) { + __pyx_t_1 = __pyx_t_3; + __pyx_v_suboffset = (__pyx_t_1[0]); + + /* "View.MemoryView":703 + * cdef int assert_direct_dimensions(Py_ssize_t *suboffsets, int ndim) except -1: + * for suboffset in suboffsets[:ndim]: + * if suboffset >= 0: # <<<<<<<<<<<<<< + * raise ValueError, "Indirect dimensions not supported" + * return 0 # return type just used as an error flag +*/ + __pyx_t_4 = (__pyx_v_suboffset >= 0); + if (unlikely(__pyx_t_4)) { + + /* "View.MemoryView":704 + * for suboffset in suboffsets[:ndim]: + * if suboffset >= 0: + * raise ValueError, "Indirect dimensions not supported" # <<<<<<<<<<<<<< + * return 0 # return type just used as an error flag + * +*/ + __Pyx_Raise(((PyObject *)(((PyTypeObject*)PyExc_ValueError))), __pyx_mstate_global->__pyx_kp_u_Indirect_dimensions_not_supporte, 0, 0); + __PYX_ERR(1, 704, __pyx_L1_error) + + /* "View.MemoryView":703 + * cdef int assert_direct_dimensions(Py_ssize_t *suboffsets, int ndim) except -1: + * for suboffset in suboffsets[:ndim]: + * if suboffset >= 0: # <<<<<<<<<<<<<< + * raise ValueError, "Indirect dimensions not supported" + * return 0 # return type just used as an error flag +*/ + } + } + + /* "View.MemoryView":705 + * if suboffset >= 0: + * raise ValueError, "Indirect dimensions not supported" + * return 0 # return type just used as an error flag # <<<<<<<<<<<<<< + * + * +*/ + __pyx_r = 0; + goto __pyx_L0; + + /* "View.MemoryView":701 + * return have_slices or nslices, tuple(result) + * + * cdef int assert_direct_dimensions(Py_ssize_t *suboffsets, int ndim) except -1: # <<<<<<<<<<<<<< + * for suboffset in suboffsets[:ndim]: + * if suboffset >= 0: +*/ + + /* function exit code */ + __pyx_L1_error:; + __Pyx_AddTraceback("View.MemoryView.assert_direct_dimensions", __pyx_clineno, __pyx_lineno, __pyx_filename); + __pyx_r = -1; + __pyx_L0:; + return __pyx_r; +} + +/* "View.MemoryView":711 + * + * + * @cname('__pyx_memview_slice') # <<<<<<<<<<<<<< + * cdef memoryview memview_slice(memoryview memview, object indices): + * cdef int new_ndim = 0, suboffset_dim = -1, dim +*/ + +static struct __pyx_memoryview_obj *__pyx_memview_slice(struct __pyx_memoryview_obj *__pyx_v_memview, PyObject *__pyx_v_indices) { + int __pyx_v_new_ndim; + int __pyx_v_suboffset_dim; + int __pyx_v_dim; + __Pyx_memviewslice __pyx_v_src; + __Pyx_memviewslice __pyx_v_dst; + __Pyx_memviewslice *__pyx_v_p_src; + struct __pyx_memoryviewslice_obj *__pyx_v_memviewsliceobj = 0; + __Pyx_memviewslice *__pyx_v_p_dst; + int *__pyx_v_p_suboffset_dim; + Py_ssize_t __pyx_v_start; + Py_ssize_t __pyx_v_stop; + Py_ssize_t __pyx_v_step; + Py_ssize_t __pyx_v_cindex; + int __pyx_v_have_start; + int __pyx_v_have_stop; + int __pyx_v_have_step; + PyObject *__pyx_v_index = NULL; + struct __pyx_memoryview_obj *__pyx_r = NULL; + __Pyx_RefNannyDeclarations + int __pyx_t_1; + PyObject *__pyx_t_2 = NULL; + struct __pyx_memoryview_obj *__pyx_t_3; + char *__pyx_t_4; + int __pyx_t_5; + Py_ssize_t __pyx_t_6; + PyObject *(*__pyx_t_7)(PyObject *); + PyObject *__pyx_t_8 = NULL; + Py_ssize_t __pyx_t_9; + int __pyx_t_10; + Py_ssize_t __pyx_t_11; + int __pyx_lineno = 0; + const char *__pyx_filename = NULL; + int __pyx_clineno = 0; + __Pyx_RefNannySetupContext("memview_slice", 0); + + /* "View.MemoryView":713 + * @cname('__pyx_memview_slice') + * cdef memoryview memview_slice(memoryview memview, object indices): + * cdef int new_ndim = 0, suboffset_dim = -1, dim # <<<<<<<<<<<<<< + * cdef bint negative_step + * cdef __Pyx_memviewslice src, dst +*/ + __pyx_v_new_ndim = 0; + __pyx_v_suboffset_dim = -1; + + /* "View.MemoryView":720 + * + * + * memset(&dst, 0, sizeof(dst)) # <<<<<<<<<<<<<< + * + * cdef _memoryviewslice memviewsliceobj +*/ + (void)(memset((&__pyx_v_dst), 0, (sizeof(__pyx_v_dst)))); + + /* "View.MemoryView":724 + * cdef _memoryviewslice memviewsliceobj + * + * assert memview.view.ndim > 0 # <<<<<<<<<<<<<< + * + * if isinstance(memview, _memoryviewslice): +*/ + #ifndef CYTHON_WITHOUT_ASSERTIONS + if (unlikely(__pyx_assertions_enabled())) { + __pyx_t_1 = (__pyx_v_memview->view.ndim > 0); + if (unlikely(!__pyx_t_1)) { + __Pyx_Raise(((PyObject *)(((PyTypeObject*)PyExc_AssertionError))), 0, 0, 0); + __PYX_ERR(1, 724, __pyx_L1_error) + } + } + #else + if ((1)); else __PYX_ERR(1, 724, __pyx_L1_error) + #endif + + /* "View.MemoryView":726 + * assert memview.view.ndim > 0 + * + * if isinstance(memview, _memoryviewslice): # <<<<<<<<<<<<<< + * memviewsliceobj = memview + * p_src = &memviewsliceobj.from_slice +*/ + __pyx_t_1 = __Pyx_TypeCheck(((PyObject *)__pyx_v_memview), __pyx_mstate_global->__pyx_memoryviewslice_type); + if (__pyx_t_1) { + + /* "View.MemoryView":727 + * + * if isinstance(memview, _memoryviewslice): + * memviewsliceobj = memview # <<<<<<<<<<<<<< + * p_src = &memviewsliceobj.from_slice + * else: +*/ + __pyx_t_2 = ((PyObject *)__pyx_v_memview); + __Pyx_INCREF(__pyx_t_2); + if (!(likely(((__pyx_t_2) == Py_None) || likely(__Pyx_TypeTest(__pyx_t_2, __pyx_mstate_global->__pyx_memoryviewslice_type))))) __PYX_ERR(1, 727, __pyx_L1_error) + __pyx_v_memviewsliceobj = ((struct __pyx_memoryviewslice_obj *)__pyx_t_2); + __pyx_t_2 = 0; + + /* "View.MemoryView":728 + * if isinstance(memview, _memoryviewslice): + * memviewsliceobj = memview + * p_src = &memviewsliceobj.from_slice # <<<<<<<<<<<<<< + * else: + * slice_copy(memview, &src) +*/ + __pyx_v_p_src = (&__pyx_v_memviewsliceobj->from_slice); + + /* "View.MemoryView":726 + * assert memview.view.ndim > 0 + * + * if isinstance(memview, _memoryviewslice): # <<<<<<<<<<<<<< + * memviewsliceobj = memview + * p_src = &memviewsliceobj.from_slice +*/ + goto __pyx_L3; + } + + /* "View.MemoryView":730 + * p_src = &memviewsliceobj.from_slice + * else: + * slice_copy(memview, &src) # <<<<<<<<<<<<<< + * p_src = &src + * +*/ + /*else*/ { + __pyx_memoryview_slice_copy(__pyx_v_memview, (&__pyx_v_src)); + + /* "View.MemoryView":731 + * else: + * slice_copy(memview, &src) + * p_src = &src # <<<<<<<<<<<<<< + * + * +*/ + __pyx_v_p_src = (&__pyx_v_src); + } + __pyx_L3:; + + /* "View.MemoryView":737 + * + * + * dst.memview = p_src.memview # <<<<<<<<<<<<<< + * dst.data = p_src.data + * +*/ + __pyx_t_3 = __pyx_v_p_src->memview; + __pyx_v_dst.memview = __pyx_t_3; + + /* "View.MemoryView":738 + * + * dst.memview = p_src.memview + * dst.data = p_src.data # <<<<<<<<<<<<<< + * + * +*/ + __pyx_t_4 = __pyx_v_p_src->data; + __pyx_v_dst.data = __pyx_t_4; + + /* "View.MemoryView":743 + * + * + * cdef __Pyx_memviewslice *p_dst = &dst # <<<<<<<<<<<<<< + * cdef int *p_suboffset_dim = &suboffset_dim + * cdef Py_ssize_t start, stop, step, cindex +*/ + __pyx_v_p_dst = (&__pyx_v_dst); + + /* "View.MemoryView":744 + * + * cdef __Pyx_memviewslice *p_dst = &dst + * cdef int *p_suboffset_dim = &suboffset_dim # <<<<<<<<<<<<<< + * cdef Py_ssize_t start, stop, step, cindex + * cdef bint have_start, have_stop, have_step +*/ + __pyx_v_p_suboffset_dim = (&__pyx_v_suboffset_dim); + + /* "View.MemoryView":748 + * cdef bint have_start, have_stop, have_step + * + * for dim, index in enumerate(indices): # <<<<<<<<<<<<<< + * if PyIndex_Check(index): + * cindex = index +*/ + __pyx_t_5 = 0; + if (likely(PyList_CheckExact(__pyx_v_indices)) || PyTuple_CheckExact(__pyx_v_indices)) { + __pyx_t_2 = __pyx_v_indices; __Pyx_INCREF(__pyx_t_2); + __pyx_t_6 = 0; + __pyx_t_7 = NULL; + } else { + __pyx_t_6 = -1; __pyx_t_2 = PyObject_GetIter(__pyx_v_indices); if (unlikely(!__pyx_t_2)) __PYX_ERR(1, 748, __pyx_L1_error) + __Pyx_GOTREF(__pyx_t_2); + __pyx_t_7 = (CYTHON_COMPILING_IN_LIMITED_API) ? PyIter_Next : __Pyx_PyObject_GetIterNextFunc(__pyx_t_2); if (unlikely(!__pyx_t_7)) __PYX_ERR(1, 748, __pyx_L1_error) + } + for (;;) { + if (likely(!__pyx_t_7)) { + if (likely(PyList_CheckExact(__pyx_t_2))) { + { + Py_ssize_t __pyx_temp = __Pyx_PyList_GET_SIZE(__pyx_t_2); + #if !CYTHON_ASSUME_SAFE_SIZE + if (unlikely((__pyx_temp < 0))) __PYX_ERR(1, 748, __pyx_L1_error) + #endif + if (__pyx_t_6 >= __pyx_temp) break; + } + __pyx_t_8 = __Pyx_PyList_GetItemRefFast(__pyx_t_2, __pyx_t_6, __Pyx_ReferenceSharing_OwnStrongReference); + ++__pyx_t_6; + } else { + { + Py_ssize_t __pyx_temp = __Pyx_PyTuple_GET_SIZE(__pyx_t_2); + #if !CYTHON_ASSUME_SAFE_SIZE + if (unlikely((__pyx_temp < 0))) __PYX_ERR(1, 748, __pyx_L1_error) + #endif + if (__pyx_t_6 >= __pyx_temp) break; + } + #if CYTHON_ASSUME_SAFE_MACROS && !CYTHON_AVOID_BORROWED_REFS + __pyx_t_8 = __Pyx_NewRef(PyTuple_GET_ITEM(__pyx_t_2, __pyx_t_6)); + #else + __pyx_t_8 = __Pyx_PySequence_ITEM(__pyx_t_2, __pyx_t_6); + #endif + ++__pyx_t_6; + } + if (unlikely(!__pyx_t_8)) __PYX_ERR(1, 748, __pyx_L1_error) + } else { + __pyx_t_8 = __pyx_t_7(__pyx_t_2); + if (unlikely(!__pyx_t_8)) { + PyObject* exc_type = PyErr_Occurred(); + if (exc_type) { + if (unlikely(!__Pyx_PyErr_GivenExceptionMatches(exc_type, PyExc_StopIteration))) __PYX_ERR(1, 748, __pyx_L1_error) + PyErr_Clear(); + } + break; + } + } + __Pyx_GOTREF(__pyx_t_8); + __Pyx_XDECREF_SET(__pyx_v_index, __pyx_t_8); + __pyx_t_8 = 0; + __pyx_v_dim = __pyx_t_5; + __pyx_t_5 = (__pyx_t_5 + 1); + + /* "View.MemoryView":749 + * + * for dim, index in enumerate(indices): + * if PyIndex_Check(index): # <<<<<<<<<<<<<< + * cindex = index + * slice_memviewslice( +*/ + __pyx_t_1 = (PyIndex_Check(__pyx_v_index) != 0); + if (__pyx_t_1) { + + /* "View.MemoryView":750 + * for dim, index in enumerate(indices): + * if PyIndex_Check(index): + * cindex = index # <<<<<<<<<<<<<< + * slice_memviewslice( + * p_dst, p_src.shape[dim], p_src.strides[dim], p_src.suboffsets[dim], +*/ + __pyx_t_9 = __Pyx_PyIndex_AsSsize_t(__pyx_v_index); if (unlikely((__pyx_t_9 == (Py_ssize_t)-1) && PyErr_Occurred())) __PYX_ERR(1, 750, __pyx_L1_error) + __pyx_v_cindex = __pyx_t_9; + + /* "View.MemoryView":751 + * if PyIndex_Check(index): + * cindex = index + * slice_memviewslice( # <<<<<<<<<<<<<< + * p_dst, p_src.shape[dim], p_src.strides[dim], p_src.suboffsets[dim], + * dim, new_ndim, p_suboffset_dim, +*/ + __pyx_t_10 = __pyx_memoryview_slice_memviewslice(__pyx_v_p_dst, (__pyx_v_p_src->shape[__pyx_v_dim]), (__pyx_v_p_src->strides[__pyx_v_dim]), (__pyx_v_p_src->suboffsets[__pyx_v_dim]), __pyx_v_dim, __pyx_v_new_ndim, __pyx_v_p_suboffset_dim, __pyx_v_cindex, 0, 0, 0, 0, 0, 0); if (unlikely(__pyx_t_10 == ((int)-1))) __PYX_ERR(1, 751, __pyx_L1_error) + + /* "View.MemoryView":749 + * + * for dim, index in enumerate(indices): + * if PyIndex_Check(index): # <<<<<<<<<<<<<< + * cindex = index + * slice_memviewslice( +*/ + goto __pyx_L6; + } + + /* "View.MemoryView":757 + * 0, 0, 0, # have_{start,stop,step} + * False) + * elif index is None: # <<<<<<<<<<<<<< + * p_dst.shape[new_ndim] = 1 + * p_dst.strides[new_ndim] = 0 +*/ + __pyx_t_1 = (__pyx_v_index == Py_None); + if (__pyx_t_1) { + + /* "View.MemoryView":758 + * False) + * elif index is None: + * p_dst.shape[new_ndim] = 1 # <<<<<<<<<<<<<< + * p_dst.strides[new_ndim] = 0 + * p_dst.suboffsets[new_ndim] = -1 +*/ + (__pyx_v_p_dst->shape[__pyx_v_new_ndim]) = 1; + + /* "View.MemoryView":759 + * elif index is None: + * p_dst.shape[new_ndim] = 1 + * p_dst.strides[new_ndim] = 0 # <<<<<<<<<<<<<< + * p_dst.suboffsets[new_ndim] = -1 + * new_ndim += 1 +*/ + (__pyx_v_p_dst->strides[__pyx_v_new_ndim]) = 0; + + /* "View.MemoryView":760 + * p_dst.shape[new_ndim] = 1 + * p_dst.strides[new_ndim] = 0 + * p_dst.suboffsets[new_ndim] = -1 # <<<<<<<<<<<<<< + * new_ndim += 1 + * else: +*/ + (__pyx_v_p_dst->suboffsets[__pyx_v_new_ndim]) = -1L; + + /* "View.MemoryView":761 + * p_dst.strides[new_ndim] = 0 + * p_dst.suboffsets[new_ndim] = -1 + * new_ndim += 1 # <<<<<<<<<<<<<< + * else: + * start = index.start or 0 +*/ + __pyx_v_new_ndim = (__pyx_v_new_ndim + 1); + + /* "View.MemoryView":757 + * 0, 0, 0, # have_{start,stop,step} + * False) + * elif index is None: # <<<<<<<<<<<<<< + * p_dst.shape[new_ndim] = 1 + * p_dst.strides[new_ndim] = 0 +*/ + goto __pyx_L6; + } + + /* "View.MemoryView":763 + * new_ndim += 1 + * else: + * start = index.start or 0 # <<<<<<<<<<<<<< + * stop = index.stop or 0 + * step = index.step or 0 +*/ + /*else*/ { + __pyx_t_8 = __Pyx_PyObject_GetAttrStr(__pyx_v_index, __pyx_mstate_global->__pyx_n_u_start); if (unlikely(!__pyx_t_8)) __PYX_ERR(1, 763, __pyx_L1_error) + __Pyx_GOTREF(__pyx_t_8); + __pyx_t_1 = __Pyx_PyObject_IsTrue(__pyx_t_8); if (unlikely((__pyx_t_1 < 0))) __PYX_ERR(1, 763, __pyx_L1_error) + if (!__pyx_t_1) { + __Pyx_DECREF(__pyx_t_8); __pyx_t_8 = 0; + } else { + __pyx_t_11 = __Pyx_PyIndex_AsSsize_t(__pyx_t_8); if (unlikely((__pyx_t_11 == (Py_ssize_t)-1) && PyErr_Occurred())) __PYX_ERR(1, 763, __pyx_L1_error) + __pyx_t_9 = __pyx_t_11; + __Pyx_DECREF(__pyx_t_8); __pyx_t_8 = 0; + goto __pyx_L7_bool_binop_done; + } + __pyx_t_9 = 0; + __pyx_L7_bool_binop_done:; + __pyx_v_start = __pyx_t_9; + + /* "View.MemoryView":764 + * else: + * start = index.start or 0 + * stop = index.stop or 0 # <<<<<<<<<<<<<< + * step = index.step or 0 + * +*/ + __pyx_t_8 = __Pyx_PyObject_GetAttrStr(__pyx_v_index, __pyx_mstate_global->__pyx_n_u_stop); if (unlikely(!__pyx_t_8)) __PYX_ERR(1, 764, __pyx_L1_error) + __Pyx_GOTREF(__pyx_t_8); + __pyx_t_1 = __Pyx_PyObject_IsTrue(__pyx_t_8); if (unlikely((__pyx_t_1 < 0))) __PYX_ERR(1, 764, __pyx_L1_error) + if (!__pyx_t_1) { + __Pyx_DECREF(__pyx_t_8); __pyx_t_8 = 0; + } else { + __pyx_t_11 = __Pyx_PyIndex_AsSsize_t(__pyx_t_8); if (unlikely((__pyx_t_11 == (Py_ssize_t)-1) && PyErr_Occurred())) __PYX_ERR(1, 764, __pyx_L1_error) + __pyx_t_9 = __pyx_t_11; + __Pyx_DECREF(__pyx_t_8); __pyx_t_8 = 0; + goto __pyx_L9_bool_binop_done; + } + __pyx_t_9 = 0; + __pyx_L9_bool_binop_done:; + __pyx_v_stop = __pyx_t_9; + + /* "View.MemoryView":765 + * start = index.start or 0 + * stop = index.stop or 0 + * step = index.step or 0 # <<<<<<<<<<<<<< + * + * have_start = index.start is not None +*/ + __pyx_t_8 = __Pyx_PyObject_GetAttrStr(__pyx_v_index, __pyx_mstate_global->__pyx_n_u_step); if (unlikely(!__pyx_t_8)) __PYX_ERR(1, 765, __pyx_L1_error) + __Pyx_GOTREF(__pyx_t_8); + __pyx_t_1 = __Pyx_PyObject_IsTrue(__pyx_t_8); if (unlikely((__pyx_t_1 < 0))) __PYX_ERR(1, 765, __pyx_L1_error) + if (!__pyx_t_1) { + __Pyx_DECREF(__pyx_t_8); __pyx_t_8 = 0; + } else { + __pyx_t_11 = __Pyx_PyIndex_AsSsize_t(__pyx_t_8); if (unlikely((__pyx_t_11 == (Py_ssize_t)-1) && PyErr_Occurred())) __PYX_ERR(1, 765, __pyx_L1_error) + __pyx_t_9 = __pyx_t_11; + __Pyx_DECREF(__pyx_t_8); __pyx_t_8 = 0; + goto __pyx_L11_bool_binop_done; + } + __pyx_t_9 = 0; + __pyx_L11_bool_binop_done:; + __pyx_v_step = __pyx_t_9; + + /* "View.MemoryView":767 + * step = index.step or 0 + * + * have_start = index.start is not None # <<<<<<<<<<<<<< + * have_stop = index.stop is not None + * have_step = index.step is not None +*/ + __pyx_t_8 = __Pyx_PyObject_GetAttrStr(__pyx_v_index, __pyx_mstate_global->__pyx_n_u_start); if (unlikely(!__pyx_t_8)) __PYX_ERR(1, 767, __pyx_L1_error) + __Pyx_GOTREF(__pyx_t_8); + __pyx_t_1 = (__pyx_t_8 != Py_None); + __Pyx_DECREF(__pyx_t_8); __pyx_t_8 = 0; + __pyx_v_have_start = __pyx_t_1; + + /* "View.MemoryView":768 + * + * have_start = index.start is not None + * have_stop = index.stop is not None # <<<<<<<<<<<<<< + * have_step = index.step is not None + * +*/ + __pyx_t_8 = __Pyx_PyObject_GetAttrStr(__pyx_v_index, __pyx_mstate_global->__pyx_n_u_stop); if (unlikely(!__pyx_t_8)) __PYX_ERR(1, 768, __pyx_L1_error) + __Pyx_GOTREF(__pyx_t_8); + __pyx_t_1 = (__pyx_t_8 != Py_None); + __Pyx_DECREF(__pyx_t_8); __pyx_t_8 = 0; + __pyx_v_have_stop = __pyx_t_1; + + /* "View.MemoryView":769 + * have_start = index.start is not None + * have_stop = index.stop is not None + * have_step = index.step is not None # <<<<<<<<<<<<<< + * + * slice_memviewslice( +*/ + __pyx_t_8 = __Pyx_PyObject_GetAttrStr(__pyx_v_index, __pyx_mstate_global->__pyx_n_u_step); if (unlikely(!__pyx_t_8)) __PYX_ERR(1, 769, __pyx_L1_error) + __Pyx_GOTREF(__pyx_t_8); + __pyx_t_1 = (__pyx_t_8 != Py_None); + __Pyx_DECREF(__pyx_t_8); __pyx_t_8 = 0; + __pyx_v_have_step = __pyx_t_1; + + /* "View.MemoryView":771 + * have_step = index.step is not None + * + * slice_memviewslice( # <<<<<<<<<<<<<< + * p_dst, p_src.shape[dim], p_src.strides[dim], p_src.suboffsets[dim], + * dim, new_ndim, p_suboffset_dim, +*/ + __pyx_t_10 = __pyx_memoryview_slice_memviewslice(__pyx_v_p_dst, (__pyx_v_p_src->shape[__pyx_v_dim]), (__pyx_v_p_src->strides[__pyx_v_dim]), (__pyx_v_p_src->suboffsets[__pyx_v_dim]), __pyx_v_dim, __pyx_v_new_ndim, __pyx_v_p_suboffset_dim, __pyx_v_start, __pyx_v_stop, __pyx_v_step, __pyx_v_have_start, __pyx_v_have_stop, __pyx_v_have_step, 1); if (unlikely(__pyx_t_10 == ((int)-1))) __PYX_ERR(1, 771, __pyx_L1_error) + + /* "View.MemoryView":777 + * have_start, have_stop, have_step, + * True) + * new_ndim += 1 # <<<<<<<<<<<<<< + * + * if isinstance(memview, _memoryviewslice): +*/ + __pyx_v_new_ndim = (__pyx_v_new_ndim + 1); + } + __pyx_L6:; + + /* "View.MemoryView":748 + * cdef bint have_start, have_stop, have_step + * + * for dim, index in enumerate(indices): # <<<<<<<<<<<<<< + * if PyIndex_Check(index): + * cindex = index +*/ + } + __Pyx_DECREF(__pyx_t_2); __pyx_t_2 = 0; + + /* "View.MemoryView":779 + * new_ndim += 1 + * + * if isinstance(memview, _memoryviewslice): # <<<<<<<<<<<<<< + * return memoryview_fromslice(dst, new_ndim, + * memviewsliceobj.to_object_func, +*/ + __pyx_t_1 = __Pyx_TypeCheck(((PyObject *)__pyx_v_memview), __pyx_mstate_global->__pyx_memoryviewslice_type); + if (__pyx_t_1) { + + /* "View.MemoryView":780 + * + * if isinstance(memview, _memoryviewslice): + * return memoryview_fromslice(dst, new_ndim, # <<<<<<<<<<<<<< + * memviewsliceobj.to_object_func, + * memviewsliceobj.to_dtype_func, +*/ + __Pyx_XDECREF((PyObject *)__pyx_r); + + /* "View.MemoryView":781 + * if isinstance(memview, _memoryviewslice): + * return memoryview_fromslice(dst, new_ndim, + * memviewsliceobj.to_object_func, # <<<<<<<<<<<<<< + * memviewsliceobj.to_dtype_func, + * memview.dtype_is_object) +*/ + if (unlikely(!__pyx_v_memviewsliceobj)) { __Pyx_RaiseUnboundLocalError("memviewsliceobj"); __PYX_ERR(1, 781, __pyx_L1_error) } + + /* "View.MemoryView":782 + * return memoryview_fromslice(dst, new_ndim, + * memviewsliceobj.to_object_func, + * memviewsliceobj.to_dtype_func, # <<<<<<<<<<<<<< + * memview.dtype_is_object) + * else: +*/ + if (unlikely(!__pyx_v_memviewsliceobj)) { __Pyx_RaiseUnboundLocalError("memviewsliceobj"); __PYX_ERR(1, 782, __pyx_L1_error) } + + /* "View.MemoryView":780 + * + * if isinstance(memview, _memoryviewslice): + * return memoryview_fromslice(dst, new_ndim, # <<<<<<<<<<<<<< + * memviewsliceobj.to_object_func, + * memviewsliceobj.to_dtype_func, +*/ + __pyx_t_2 = __pyx_memoryview_fromslice(__pyx_v_dst, __pyx_v_new_ndim, __pyx_v_memviewsliceobj->to_object_func, __pyx_v_memviewsliceobj->to_dtype_func, __pyx_v_memview->dtype_is_object); if (unlikely(!__pyx_t_2)) __PYX_ERR(1, 780, __pyx_L1_error) + __Pyx_GOTREF(__pyx_t_2); + if (!(likely(((__pyx_t_2) == Py_None) || likely(__Pyx_TypeTest(__pyx_t_2, __pyx_mstate_global->__pyx_memoryview_type))))) __PYX_ERR(1, 780, __pyx_L1_error) + __pyx_r = ((struct __pyx_memoryview_obj *)__pyx_t_2); + __pyx_t_2 = 0; + goto __pyx_L0; + + /* "View.MemoryView":779 + * new_ndim += 1 + * + * if isinstance(memview, _memoryviewslice): # <<<<<<<<<<<<<< + * return memoryview_fromslice(dst, new_ndim, + * memviewsliceobj.to_object_func, +*/ + } + + /* "View.MemoryView":785 + * memview.dtype_is_object) + * else: + * return memoryview_fromslice(dst, new_ndim, NULL, NULL, # <<<<<<<<<<<<<< + * memview.dtype_is_object) + * +*/ + /*else*/ { + __Pyx_XDECREF((PyObject *)__pyx_r); + + /* "View.MemoryView":786 + * else: + * return memoryview_fromslice(dst, new_ndim, NULL, NULL, + * memview.dtype_is_object) # <<<<<<<<<<<<<< + * + * +*/ + __pyx_t_2 = __pyx_memoryview_fromslice(__pyx_v_dst, __pyx_v_new_ndim, NULL, NULL, __pyx_v_memview->dtype_is_object); if (unlikely(!__pyx_t_2)) __PYX_ERR(1, 785, __pyx_L1_error) + __Pyx_GOTREF(__pyx_t_2); + + /* "View.MemoryView":785 + * memview.dtype_is_object) + * else: + * return memoryview_fromslice(dst, new_ndim, NULL, NULL, # <<<<<<<<<<<<<< + * memview.dtype_is_object) + * +*/ + if (!(likely(((__pyx_t_2) == Py_None) || likely(__Pyx_TypeTest(__pyx_t_2, __pyx_mstate_global->__pyx_memoryview_type))))) __PYX_ERR(1, 785, __pyx_L1_error) + __pyx_r = ((struct __pyx_memoryview_obj *)__pyx_t_2); + __pyx_t_2 = 0; + goto __pyx_L0; + } + + /* "View.MemoryView":711 + * + * + * @cname('__pyx_memview_slice') # <<<<<<<<<<<<<< + * cdef memoryview memview_slice(memoryview memview, object indices): + * cdef int new_ndim = 0, suboffset_dim = -1, dim +*/ + + /* function exit code */ + __pyx_L1_error:; + __Pyx_XDECREF(__pyx_t_2); + __Pyx_XDECREF(__pyx_t_8); + __Pyx_AddTraceback("View.MemoryView.memview_slice", __pyx_clineno, __pyx_lineno, __pyx_filename); + __pyx_r = 0; + __pyx_L0:; + __Pyx_XDECREF((PyObject *)__pyx_v_memviewsliceobj); + __Pyx_XDECREF(__pyx_v_index); + __Pyx_XGIVEREF((PyObject *)__pyx_r); + __Pyx_RefNannyFinishContext(); + return __pyx_r; +} + +/* "View.MemoryView":793 + * + * + * @cname('__pyx_memoryview_slice_memviewslice') # <<<<<<<<<<<<<< + * cdef int slice_memviewslice( + * __Pyx_memviewslice *dst, +*/ + +static int __pyx_memoryview_slice_memviewslice(__Pyx_memviewslice *__pyx_v_dst, Py_ssize_t __pyx_v_shape, Py_ssize_t __pyx_v_stride, Py_ssize_t __pyx_v_suboffset, int __pyx_v_dim, int __pyx_v_new_ndim, int *__pyx_v_suboffset_dim, Py_ssize_t __pyx_v_start, Py_ssize_t __pyx_v_stop, Py_ssize_t __pyx_v_step, int __pyx_v_have_start, int __pyx_v_have_stop, int __pyx_v_have_step, int __pyx_v_is_slice) { + Py_ssize_t __pyx_v_new_shape; + int __pyx_v_negative_step; + int __pyx_r; + int __pyx_t_1; + int __pyx_t_2; + int __pyx_t_3; + int __pyx_lineno = 0; + const char *__pyx_filename = NULL; + int __pyx_clineno = 0; + PyGILState_STATE __pyx_gilstate_save; + + /* "View.MemoryView":814 + * cdef bint negative_step + * + * if not is_slice: # <<<<<<<<<<<<<< + * + * if start < 0: +*/ + __pyx_t_1 = (!__pyx_v_is_slice); + if (__pyx_t_1) { + + /* "View.MemoryView":816 + * if not is_slice: + * + * if start < 0: # <<<<<<<<<<<<<< + * start += shape + * if not 0 <= start < shape: +*/ + __pyx_t_1 = (__pyx_v_start < 0); + if (__pyx_t_1) { + + /* "View.MemoryView":817 + * + * if start < 0: + * start += shape # <<<<<<<<<<<<<< + * if not 0 <= start < shape: + * _err_dim(PyExc_IndexError, "Index out of bounds (axis %d)", dim) +*/ + __pyx_v_start = (__pyx_v_start + __pyx_v_shape); + + /* "View.MemoryView":816 + * if not is_slice: + * + * if start < 0: # <<<<<<<<<<<<<< + * start += shape + * if not 0 <= start < shape: +*/ + } + + /* "View.MemoryView":818 + * if start < 0: + * start += shape + * if not 0 <= start < shape: # <<<<<<<<<<<<<< + * _err_dim(PyExc_IndexError, "Index out of bounds (axis %d)", dim) + * else: +*/ + __pyx_t_1 = (0 <= __pyx_v_start); + if (__pyx_t_1) { + __pyx_t_1 = (__pyx_v_start < __pyx_v_shape); + } + __pyx_t_2 = (!__pyx_t_1); + if (__pyx_t_2) { + + /* "View.MemoryView":819 + * start += shape + * if not 0 <= start < shape: + * _err_dim(PyExc_IndexError, "Index out of bounds (axis %d)", dim) # <<<<<<<<<<<<<< + * else: + * +*/ + __pyx_t_3 = __pyx_memoryview_err_dim(PyExc_IndexError, __pyx_mstate_global->__pyx_kp_u_Index_out_of_bounds_axis_d, __pyx_v_dim); if (unlikely(__pyx_t_3 == ((int)-1))) __PYX_ERR(1, 819, __pyx_L1_error) + + /* "View.MemoryView":818 + * if start < 0: + * start += shape + * if not 0 <= start < shape: # <<<<<<<<<<<<<< + * _err_dim(PyExc_IndexError, "Index out of bounds (axis %d)", dim) + * else: +*/ + } + + /* "View.MemoryView":814 + * cdef bint negative_step + * + * if not is_slice: # <<<<<<<<<<<<<< + * + * if start < 0: +*/ + goto __pyx_L3; + } + + /* "View.MemoryView":822 + * else: + * + * if have_step: # <<<<<<<<<<<<<< + * negative_step = step < 0 + * if step == 0: +*/ + /*else*/ { + __pyx_t_2 = (__pyx_v_have_step != 0); + if (__pyx_t_2) { + + /* "View.MemoryView":823 + * + * if have_step: + * negative_step = step < 0 # <<<<<<<<<<<<<< + * if step == 0: + * _err_dim(PyExc_ValueError, "Step may not be zero (axis %d)", dim) +*/ + __pyx_v_negative_step = (__pyx_v_step < 0); + + /* "View.MemoryView":824 + * if have_step: + * negative_step = step < 0 + * if step == 0: # <<<<<<<<<<<<<< + * _err_dim(PyExc_ValueError, "Step may not be zero (axis %d)", dim) + * else: +*/ + __pyx_t_2 = (__pyx_v_step == 0); + if (__pyx_t_2) { + + /* "View.MemoryView":825 + * negative_step = step < 0 + * if step == 0: + * _err_dim(PyExc_ValueError, "Step may not be zero (axis %d)", dim) # <<<<<<<<<<<<<< + * else: + * negative_step = False +*/ + __pyx_t_3 = __pyx_memoryview_err_dim(PyExc_ValueError, __pyx_mstate_global->__pyx_kp_u_Step_may_not_be_zero_axis_d, __pyx_v_dim); if (unlikely(__pyx_t_3 == ((int)-1))) __PYX_ERR(1, 825, __pyx_L1_error) + + /* "View.MemoryView":824 + * if have_step: + * negative_step = step < 0 + * if step == 0: # <<<<<<<<<<<<<< + * _err_dim(PyExc_ValueError, "Step may not be zero (axis %d)", dim) + * else: +*/ + } + + /* "View.MemoryView":822 + * else: + * + * if have_step: # <<<<<<<<<<<<<< + * negative_step = step < 0 + * if step == 0: +*/ + goto __pyx_L6; + } + + /* "View.MemoryView":827 + * _err_dim(PyExc_ValueError, "Step may not be zero (axis %d)", dim) + * else: + * negative_step = False # <<<<<<<<<<<<<< + * step = 1 + * +*/ + /*else*/ { + __pyx_v_negative_step = 0; + + /* "View.MemoryView":828 + * else: + * negative_step = False + * step = 1 # <<<<<<<<<<<<<< + * + * +*/ + __pyx_v_step = 1; + } + __pyx_L6:; + + /* "View.MemoryView":831 + * + * + * if have_start: # <<<<<<<<<<<<<< + * if start < 0: + * start += shape +*/ + __pyx_t_2 = (__pyx_v_have_start != 0); + if (__pyx_t_2) { + + /* "View.MemoryView":832 + * + * if have_start: + * if start < 0: # <<<<<<<<<<<<<< + * start += shape + * if start < 0: +*/ + __pyx_t_2 = (__pyx_v_start < 0); + if (__pyx_t_2) { + + /* "View.MemoryView":833 + * if have_start: + * if start < 0: + * start += shape # <<<<<<<<<<<<<< + * if start < 0: + * start = 0 +*/ + __pyx_v_start = (__pyx_v_start + __pyx_v_shape); + + /* "View.MemoryView":834 + * if start < 0: + * start += shape + * if start < 0: # <<<<<<<<<<<<<< + * start = 0 + * elif start >= shape: +*/ + __pyx_t_2 = (__pyx_v_start < 0); + if (__pyx_t_2) { + + /* "View.MemoryView":835 + * start += shape + * if start < 0: + * start = 0 # <<<<<<<<<<<<<< + * elif start >= shape: + * if negative_step: +*/ + __pyx_v_start = 0; + + /* "View.MemoryView":834 + * if start < 0: + * start += shape + * if start < 0: # <<<<<<<<<<<<<< + * start = 0 + * elif start >= shape: +*/ + } + + /* "View.MemoryView":832 + * + * if have_start: + * if start < 0: # <<<<<<<<<<<<<< + * start += shape + * if start < 0: +*/ + goto __pyx_L9; + } + + /* "View.MemoryView":836 + * if start < 0: + * start = 0 + * elif start >= shape: # <<<<<<<<<<<<<< + * if negative_step: + * start = shape - 1 +*/ + __pyx_t_2 = (__pyx_v_start >= __pyx_v_shape); + if (__pyx_t_2) { + + /* "View.MemoryView":837 + * start = 0 + * elif start >= shape: + * if negative_step: # <<<<<<<<<<<<<< + * start = shape - 1 + * else: +*/ + if (__pyx_v_negative_step) { + + /* "View.MemoryView":838 + * elif start >= shape: + * if negative_step: + * start = shape - 1 # <<<<<<<<<<<<<< + * else: + * start = shape +*/ + __pyx_v_start = (__pyx_v_shape - 1); + + /* "View.MemoryView":837 + * start = 0 + * elif start >= shape: + * if negative_step: # <<<<<<<<<<<<<< + * start = shape - 1 + * else: +*/ + goto __pyx_L11; + } + + /* "View.MemoryView":840 + * start = shape - 1 + * else: + * start = shape # <<<<<<<<<<<<<< + * else: + * if negative_step: +*/ + /*else*/ { + __pyx_v_start = __pyx_v_shape; + } + __pyx_L11:; + + /* "View.MemoryView":836 + * if start < 0: + * start = 0 + * elif start >= shape: # <<<<<<<<<<<<<< + * if negative_step: + * start = shape - 1 +*/ + } + __pyx_L9:; + + /* "View.MemoryView":831 + * + * + * if have_start: # <<<<<<<<<<<<<< + * if start < 0: + * start += shape +*/ + goto __pyx_L8; + } + + /* "View.MemoryView":842 + * start = shape + * else: + * if negative_step: # <<<<<<<<<<<<<< + * start = shape - 1 + * else: +*/ + /*else*/ { + if (__pyx_v_negative_step) { + + /* "View.MemoryView":843 + * else: + * if negative_step: + * start = shape - 1 # <<<<<<<<<<<<<< + * else: + * start = 0 +*/ + __pyx_v_start = (__pyx_v_shape - 1); + + /* "View.MemoryView":842 + * start = shape + * else: + * if negative_step: # <<<<<<<<<<<<<< + * start = shape - 1 + * else: +*/ + goto __pyx_L12; + } + + /* "View.MemoryView":845 + * start = shape - 1 + * else: + * start = 0 # <<<<<<<<<<<<<< + * + * if have_stop: +*/ + /*else*/ { + __pyx_v_start = 0; + } + __pyx_L12:; + } + __pyx_L8:; + + /* "View.MemoryView":847 + * start = 0 + * + * if have_stop: # <<<<<<<<<<<<<< + * if stop < 0: + * stop += shape +*/ + __pyx_t_2 = (__pyx_v_have_stop != 0); + if (__pyx_t_2) { + + /* "View.MemoryView":848 + * + * if have_stop: + * if stop < 0: # <<<<<<<<<<<<<< + * stop += shape + * if stop < 0: +*/ + __pyx_t_2 = (__pyx_v_stop < 0); + if (__pyx_t_2) { + + /* "View.MemoryView":849 + * if have_stop: + * if stop < 0: + * stop += shape # <<<<<<<<<<<<<< + * if stop < 0: + * stop = 0 +*/ + __pyx_v_stop = (__pyx_v_stop + __pyx_v_shape); + + /* "View.MemoryView":850 + * if stop < 0: + * stop += shape + * if stop < 0: # <<<<<<<<<<<<<< + * stop = 0 + * elif stop > shape: +*/ + __pyx_t_2 = (__pyx_v_stop < 0); + if (__pyx_t_2) { + + /* "View.MemoryView":851 + * stop += shape + * if stop < 0: + * stop = 0 # <<<<<<<<<<<<<< + * elif stop > shape: + * stop = shape +*/ + __pyx_v_stop = 0; + + /* "View.MemoryView":850 + * if stop < 0: + * stop += shape + * if stop < 0: # <<<<<<<<<<<<<< + * stop = 0 + * elif stop > shape: +*/ + } + + /* "View.MemoryView":848 + * + * if have_stop: + * if stop < 0: # <<<<<<<<<<<<<< + * stop += shape + * if stop < 0: +*/ + goto __pyx_L14; + } + + /* "View.MemoryView":852 + * if stop < 0: + * stop = 0 + * elif stop > shape: # <<<<<<<<<<<<<< + * stop = shape + * else: +*/ + __pyx_t_2 = (__pyx_v_stop > __pyx_v_shape); + if (__pyx_t_2) { + + /* "View.MemoryView":853 + * stop = 0 + * elif stop > shape: + * stop = shape # <<<<<<<<<<<<<< + * else: + * if negative_step: +*/ + __pyx_v_stop = __pyx_v_shape; + + /* "View.MemoryView":852 + * if stop < 0: + * stop = 0 + * elif stop > shape: # <<<<<<<<<<<<<< + * stop = shape + * else: +*/ + } + __pyx_L14:; + + /* "View.MemoryView":847 + * start = 0 + * + * if have_stop: # <<<<<<<<<<<<<< + * if stop < 0: + * stop += shape +*/ + goto __pyx_L13; + } + + /* "View.MemoryView":855 + * stop = shape + * else: + * if negative_step: # <<<<<<<<<<<<<< + * stop = -1 + * else: +*/ + /*else*/ { + if (__pyx_v_negative_step) { + + /* "View.MemoryView":856 + * else: + * if negative_step: + * stop = -1 # <<<<<<<<<<<<<< + * else: + * stop = shape +*/ + __pyx_v_stop = -1L; + + /* "View.MemoryView":855 + * stop = shape + * else: + * if negative_step: # <<<<<<<<<<<<<< + * stop = -1 + * else: +*/ + goto __pyx_L16; + } + + /* "View.MemoryView":858 + * stop = -1 + * else: + * stop = shape # <<<<<<<<<<<<<< + * + * +*/ + /*else*/ { + __pyx_v_stop = __pyx_v_shape; + } + __pyx_L16:; + } + __pyx_L13:; + + /* "View.MemoryView":862 + * + * with cython.cdivision(True): + * new_shape = (stop - start) // step # <<<<<<<<<<<<<< + * + * if (stop - start) - step * new_shape: +*/ + __pyx_v_new_shape = ((__pyx_v_stop - __pyx_v_start) / __pyx_v_step); + + /* "View.MemoryView":864 + * new_shape = (stop - start) // step + * + * if (stop - start) - step * new_shape: # <<<<<<<<<<<<<< + * new_shape += 1 + * +*/ + __pyx_t_2 = (((__pyx_v_stop - __pyx_v_start) - (__pyx_v_step * __pyx_v_new_shape)) != 0); + if (__pyx_t_2) { + + /* "View.MemoryView":865 + * + * if (stop - start) - step * new_shape: + * new_shape += 1 # <<<<<<<<<<<<<< + * + * if new_shape < 0: +*/ + __pyx_v_new_shape = (__pyx_v_new_shape + 1); + + /* "View.MemoryView":864 + * new_shape = (stop - start) // step + * + * if (stop - start) - step * new_shape: # <<<<<<<<<<<<<< + * new_shape += 1 + * +*/ + } + + /* "View.MemoryView":867 + * new_shape += 1 + * + * if new_shape < 0: # <<<<<<<<<<<<<< + * new_shape = 0 + * +*/ + __pyx_t_2 = (__pyx_v_new_shape < 0); + if (__pyx_t_2) { + + /* "View.MemoryView":868 + * + * if new_shape < 0: + * new_shape = 0 # <<<<<<<<<<<<<< + * + * +*/ + __pyx_v_new_shape = 0; + + /* "View.MemoryView":867 + * new_shape += 1 + * + * if new_shape < 0: # <<<<<<<<<<<<<< + * new_shape = 0 + * +*/ + } + + /* "View.MemoryView":871 + * + * + * dst.strides[new_ndim] = stride * step # <<<<<<<<<<<<<< + * dst.shape[new_ndim] = new_shape + * dst.suboffsets[new_ndim] = suboffset +*/ + (__pyx_v_dst->strides[__pyx_v_new_ndim]) = (__pyx_v_stride * __pyx_v_step); + + /* "View.MemoryView":872 + * + * dst.strides[new_ndim] = stride * step + * dst.shape[new_ndim] = new_shape # <<<<<<<<<<<<<< + * dst.suboffsets[new_ndim] = suboffset + * +*/ + (__pyx_v_dst->shape[__pyx_v_new_ndim]) = __pyx_v_new_shape; + + /* "View.MemoryView":873 + * dst.strides[new_ndim] = stride * step + * dst.shape[new_ndim] = new_shape + * dst.suboffsets[new_ndim] = suboffset # <<<<<<<<<<<<<< + * + * +*/ + (__pyx_v_dst->suboffsets[__pyx_v_new_ndim]) = __pyx_v_suboffset; + } + __pyx_L3:; + + /* "View.MemoryView":876 + * + * + * if suboffset_dim[0] < 0: # <<<<<<<<<<<<<< + * dst.data += start * stride + * else: +*/ + __pyx_t_2 = ((__pyx_v_suboffset_dim[0]) < 0); + if (__pyx_t_2) { + + /* "View.MemoryView":877 + * + * if suboffset_dim[0] < 0: + * dst.data += start * stride # <<<<<<<<<<<<<< + * else: + * dst.suboffsets[suboffset_dim[0]] += start * stride +*/ + __pyx_v_dst->data = (__pyx_v_dst->data + (__pyx_v_start * __pyx_v_stride)); + + /* "View.MemoryView":876 + * + * + * if suboffset_dim[0] < 0: # <<<<<<<<<<<<<< + * dst.data += start * stride + * else: +*/ + goto __pyx_L19; + } + + /* "View.MemoryView":879 + * dst.data += start * stride + * else: + * dst.suboffsets[suboffset_dim[0]] += start * stride # <<<<<<<<<<<<<< + * + * if suboffset >= 0: +*/ + /*else*/ { + __pyx_t_3 = (__pyx_v_suboffset_dim[0]); + (__pyx_v_dst->suboffsets[__pyx_t_3]) = ((__pyx_v_dst->suboffsets[__pyx_t_3]) + (__pyx_v_start * __pyx_v_stride)); + } + __pyx_L19:; + + /* "View.MemoryView":881 + * dst.suboffsets[suboffset_dim[0]] += start * stride + * + * if suboffset >= 0: # <<<<<<<<<<<<<< + * if not is_slice: + * if new_ndim == 0: +*/ + __pyx_t_2 = (__pyx_v_suboffset >= 0); + if (__pyx_t_2) { + + /* "View.MemoryView":882 + * + * if suboffset >= 0: + * if not is_slice: # <<<<<<<<<<<<<< + * if new_ndim == 0: + * dst.data = ( dst.data)[0] + suboffset +*/ + __pyx_t_2 = (!__pyx_v_is_slice); + if (__pyx_t_2) { + + /* "View.MemoryView":883 + * if suboffset >= 0: + * if not is_slice: + * if new_ndim == 0: # <<<<<<<<<<<<<< + * dst.data = ( dst.data)[0] + suboffset + * else: +*/ + __pyx_t_2 = (__pyx_v_new_ndim == 0); + if (__pyx_t_2) { + + /* "View.MemoryView":884 + * if not is_slice: + * if new_ndim == 0: + * dst.data = ( dst.data)[0] + suboffset # <<<<<<<<<<<<<< + * else: + * _err_dim(PyExc_IndexError, "All dimensions preceding dimension %d " +*/ + __pyx_v_dst->data = ((((char **)__pyx_v_dst->data)[0]) + __pyx_v_suboffset); + + /* "View.MemoryView":883 + * if suboffset >= 0: + * if not is_slice: + * if new_ndim == 0: # <<<<<<<<<<<<<< + * dst.data = ( dst.data)[0] + suboffset + * else: +*/ + goto __pyx_L22; + } + + /* "View.MemoryView":886 + * dst.data = ( dst.data)[0] + suboffset + * else: + * _err_dim(PyExc_IndexError, "All dimensions preceding dimension %d " # <<<<<<<<<<<<<< + * "must be indexed and not sliced", dim) + * else: +*/ + /*else*/ { + + /* "View.MemoryView":887 + * else: + * _err_dim(PyExc_IndexError, "All dimensions preceding dimension %d " + * "must be indexed and not sliced", dim) # <<<<<<<<<<<<<< + * else: + * suboffset_dim[0] = new_ndim +*/ + __pyx_t_3 = __pyx_memoryview_err_dim(PyExc_IndexError, __pyx_mstate_global->__pyx_kp_u_All_dimensions_preceding_dimensi, __pyx_v_dim); if (unlikely(__pyx_t_3 == ((int)-1))) __PYX_ERR(1, 886, __pyx_L1_error) + } + __pyx_L22:; + + /* "View.MemoryView":882 + * + * if suboffset >= 0: + * if not is_slice: # <<<<<<<<<<<<<< + * if new_ndim == 0: + * dst.data = ( dst.data)[0] + suboffset +*/ + goto __pyx_L21; + } + + /* "View.MemoryView":889 + * "must be indexed and not sliced", dim) + * else: + * suboffset_dim[0] = new_ndim # <<<<<<<<<<<<<< + * + * return 0 +*/ + /*else*/ { + (__pyx_v_suboffset_dim[0]) = __pyx_v_new_ndim; + } + __pyx_L21:; + + /* "View.MemoryView":881 + * dst.suboffsets[suboffset_dim[0]] += start * stride + * + * if suboffset >= 0: # <<<<<<<<<<<<<< + * if not is_slice: + * if new_ndim == 0: +*/ + } + + /* "View.MemoryView":891 + * suboffset_dim[0] = new_ndim + * + * return 0 # <<<<<<<<<<<<<< + * + * +*/ + __pyx_r = 0; + goto __pyx_L0; + + /* "View.MemoryView":793 + * + * + * @cname('__pyx_memoryview_slice_memviewslice') # <<<<<<<<<<<<<< + * cdef int slice_memviewslice( + * __Pyx_memviewslice *dst, +*/ + + /* function exit code */ + __pyx_L1_error:; + __pyx_gilstate_save = __Pyx_PyGILState_Ensure(); + __Pyx_AddTraceback("View.MemoryView.slice_memviewslice", __pyx_clineno, __pyx_lineno, __pyx_filename); + __pyx_r = -1; + __Pyx_PyGILState_Release(__pyx_gilstate_save); + __pyx_L0:; + return __pyx_r; +} + +/* "View.MemoryView":896 + * + * + * @cname('__pyx_pybuffer_index') # <<<<<<<<<<<<<< + * cdef char *pybuffer_index(Py_buffer *view, char *bufp, Py_ssize_t index, + * Py_ssize_t dim) except NULL: +*/ + +static char *__pyx_pybuffer_index(Py_buffer *__pyx_v_view, char *__pyx_v_bufp, Py_ssize_t __pyx_v_index, Py_ssize_t __pyx_v_dim) { + Py_ssize_t __pyx_v_shape; + Py_ssize_t __pyx_v_stride; + Py_ssize_t __pyx_v_suboffset; + Py_ssize_t __pyx_v_itemsize; + char *__pyx_v_resultp; + char *__pyx_r; + __Pyx_RefNannyDeclarations + Py_ssize_t __pyx_t_1; + int __pyx_t_2; + PyObject *__pyx_t_3 = NULL; + PyObject *__pyx_t_4[3]; + PyObject *__pyx_t_5 = NULL; + int __pyx_lineno = 0; + const char *__pyx_filename = NULL; + int __pyx_clineno = 0; + __Pyx_RefNannySetupContext("pybuffer_index", 0); + + /* "View.MemoryView":899 + * cdef char *pybuffer_index(Py_buffer *view, char *bufp, Py_ssize_t index, + * Py_ssize_t dim) except NULL: + * cdef Py_ssize_t shape, stride, suboffset = -1 # <<<<<<<<<<<<<< + * cdef Py_ssize_t itemsize = view.itemsize + * cdef char *resultp +*/ + __pyx_v_suboffset = -1L; + + /* "View.MemoryView":900 + * Py_ssize_t dim) except NULL: + * cdef Py_ssize_t shape, stride, suboffset = -1 + * cdef Py_ssize_t itemsize = view.itemsize # <<<<<<<<<<<<<< + * cdef char *resultp + * +*/ + __pyx_t_1 = __pyx_v_view->itemsize; + __pyx_v_itemsize = __pyx_t_1; + + /* "View.MemoryView":903 + * cdef char *resultp + * + * if view.ndim == 0: # <<<<<<<<<<<<<< + * shape = view.len // itemsize + * stride = itemsize +*/ + __pyx_t_2 = (__pyx_v_view->ndim == 0); + if (__pyx_t_2) { + + /* "View.MemoryView":904 + * + * if view.ndim == 0: + * shape = view.len // itemsize # <<<<<<<<<<<<<< + * stride = itemsize + * else: +*/ + if (unlikely(__pyx_v_itemsize == 0)) { + PyErr_SetString(PyExc_ZeroDivisionError, "integer division or modulo by zero"); + __PYX_ERR(1, 904, __pyx_L1_error) + } + else if (sizeof(Py_ssize_t) == sizeof(long) && (!(((Py_ssize_t)-1) > 0)) && unlikely(__pyx_v_itemsize == (Py_ssize_t)-1) && unlikely(__Pyx_UNARY_NEG_WOULD_OVERFLOW(__pyx_v_view->len))) { + PyErr_SetString(PyExc_OverflowError, "value too large to perform division"); + __PYX_ERR(1, 904, __pyx_L1_error) + } + __pyx_v_shape = __Pyx_div_Py_ssize_t(__pyx_v_view->len, __pyx_v_itemsize, 0); + + /* "View.MemoryView":905 + * if view.ndim == 0: + * shape = view.len // itemsize + * stride = itemsize # <<<<<<<<<<<<<< + * else: + * shape = view.shape[dim] +*/ + __pyx_v_stride = __pyx_v_itemsize; + + /* "View.MemoryView":903 + * cdef char *resultp + * + * if view.ndim == 0: # <<<<<<<<<<<<<< + * shape = view.len // itemsize + * stride = itemsize +*/ + goto __pyx_L3; + } + + /* "View.MemoryView":907 + * stride = itemsize + * else: + * shape = view.shape[dim] # <<<<<<<<<<<<<< + * stride = view.strides[dim] + * if view.suboffsets != NULL: +*/ + /*else*/ { + __pyx_v_shape = (__pyx_v_view->shape[__pyx_v_dim]); + + /* "View.MemoryView":908 + * else: + * shape = view.shape[dim] + * stride = view.strides[dim] # <<<<<<<<<<<<<< + * if view.suboffsets != NULL: + * suboffset = view.suboffsets[dim] +*/ + __pyx_v_stride = (__pyx_v_view->strides[__pyx_v_dim]); + + /* "View.MemoryView":909 + * shape = view.shape[dim] + * stride = view.strides[dim] + * if view.suboffsets != NULL: # <<<<<<<<<<<<<< + * suboffset = view.suboffsets[dim] + * +*/ + __pyx_t_2 = (__pyx_v_view->suboffsets != NULL); + if (__pyx_t_2) { + + /* "View.MemoryView":910 + * stride = view.strides[dim] + * if view.suboffsets != NULL: + * suboffset = view.suboffsets[dim] # <<<<<<<<<<<<<< + * + * if index < 0: +*/ + __pyx_v_suboffset = (__pyx_v_view->suboffsets[__pyx_v_dim]); + + /* "View.MemoryView":909 + * shape = view.shape[dim] + * stride = view.strides[dim] + * if view.suboffsets != NULL: # <<<<<<<<<<<<<< + * suboffset = view.suboffsets[dim] + * +*/ + } + } + __pyx_L3:; + + /* "View.MemoryView":912 + * suboffset = view.suboffsets[dim] + * + * if index < 0: # <<<<<<<<<<<<<< + * index += view.shape[dim] + * if index < 0: +*/ + __pyx_t_2 = (__pyx_v_index < 0); + if (__pyx_t_2) { + + /* "View.MemoryView":913 + * + * if index < 0: + * index += view.shape[dim] # <<<<<<<<<<<<<< + * if index < 0: + * raise IndexError, f"Out of bounds on buffer access (axis {dim})" +*/ + __pyx_v_index = (__pyx_v_index + (__pyx_v_view->shape[__pyx_v_dim])); + + /* "View.MemoryView":914 + * if index < 0: + * index += view.shape[dim] + * if index < 0: # <<<<<<<<<<<<<< + * raise IndexError, f"Out of bounds on buffer access (axis {dim})" + * +*/ + __pyx_t_2 = (__pyx_v_index < 0); + if (unlikely(__pyx_t_2)) { + + /* "View.MemoryView":915 + * index += view.shape[dim] + * if index < 0: + * raise IndexError, f"Out of bounds on buffer access (axis {dim})" # <<<<<<<<<<<<<< + * + * if index >= shape: +*/ + __pyx_t_3 = __Pyx_PyUnicode_From_Py_ssize_t(__pyx_v_dim, 0, ' ', 'd'); if (unlikely(!__pyx_t_3)) __PYX_ERR(1, 915, __pyx_L1_error) + __Pyx_GOTREF(__pyx_t_3); + __pyx_t_4[0] = __pyx_mstate_global->__pyx_kp_u_Out_of_bounds_on_buffer_access_a; + __pyx_t_4[1] = __pyx_t_3; + __pyx_t_4[2] = __pyx_mstate_global->__pyx_kp_u__5; + __pyx_t_5 = __Pyx_PyUnicode_Join(__pyx_t_4, 3, 37 + __Pyx_PyUnicode_GET_LENGTH(__pyx_t_3) + 1, 127); + if (unlikely(!__pyx_t_5)) __PYX_ERR(1, 915, __pyx_L1_error) + __Pyx_GOTREF(__pyx_t_5); + __Pyx_DECREF(__pyx_t_3); __pyx_t_3 = 0; + __Pyx_Raise(((PyObject *)(((PyTypeObject*)PyExc_IndexError))), __pyx_t_5, 0, 0); + __Pyx_DECREF(__pyx_t_5); __pyx_t_5 = 0; + __PYX_ERR(1, 915, __pyx_L1_error) + + /* "View.MemoryView":914 + * if index < 0: + * index += view.shape[dim] + * if index < 0: # <<<<<<<<<<<<<< + * raise IndexError, f"Out of bounds on buffer access (axis {dim})" + * +*/ + } + + /* "View.MemoryView":912 + * suboffset = view.suboffsets[dim] + * + * if index < 0: # <<<<<<<<<<<<<< + * index += view.shape[dim] + * if index < 0: +*/ + } + + /* "View.MemoryView":917 + * raise IndexError, f"Out of bounds on buffer access (axis {dim})" + * + * if index >= shape: # <<<<<<<<<<<<<< + * raise IndexError, f"Out of bounds on buffer access (axis {dim})" + * +*/ + __pyx_t_2 = (__pyx_v_index >= __pyx_v_shape); + if (unlikely(__pyx_t_2)) { + + /* "View.MemoryView":918 + * + * if index >= shape: + * raise IndexError, f"Out of bounds on buffer access (axis {dim})" # <<<<<<<<<<<<<< + * + * resultp = bufp + index * stride +*/ + __pyx_t_5 = __Pyx_PyUnicode_From_Py_ssize_t(__pyx_v_dim, 0, ' ', 'd'); if (unlikely(!__pyx_t_5)) __PYX_ERR(1, 918, __pyx_L1_error) + __Pyx_GOTREF(__pyx_t_5); + __pyx_t_4[0] = __pyx_mstate_global->__pyx_kp_u_Out_of_bounds_on_buffer_access_a; + __pyx_t_4[1] = __pyx_t_5; + __pyx_t_4[2] = __pyx_mstate_global->__pyx_kp_u__5; + __pyx_t_3 = __Pyx_PyUnicode_Join(__pyx_t_4, 3, 37 + __Pyx_PyUnicode_GET_LENGTH(__pyx_t_5) + 1, 127); + if (unlikely(!__pyx_t_3)) __PYX_ERR(1, 918, __pyx_L1_error) + __Pyx_GOTREF(__pyx_t_3); + __Pyx_DECREF(__pyx_t_5); __pyx_t_5 = 0; + __Pyx_Raise(((PyObject *)(((PyTypeObject*)PyExc_IndexError))), __pyx_t_3, 0, 0); + __Pyx_DECREF(__pyx_t_3); __pyx_t_3 = 0; + __PYX_ERR(1, 918, __pyx_L1_error) + + /* "View.MemoryView":917 + * raise IndexError, f"Out of bounds on buffer access (axis {dim})" + * + * if index >= shape: # <<<<<<<<<<<<<< + * raise IndexError, f"Out of bounds on buffer access (axis {dim})" + * +*/ + } + + /* "View.MemoryView":920 + * raise IndexError, f"Out of bounds on buffer access (axis {dim})" + * + * resultp = bufp + index * stride # <<<<<<<<<<<<<< + * if suboffset >= 0: + * resultp = ( resultp)[0] + suboffset +*/ + __pyx_v_resultp = (__pyx_v_bufp + (__pyx_v_index * __pyx_v_stride)); + + /* "View.MemoryView":921 + * + * resultp = bufp + index * stride + * if suboffset >= 0: # <<<<<<<<<<<<<< + * resultp = ( resultp)[0] + suboffset + * +*/ + __pyx_t_2 = (__pyx_v_suboffset >= 0); + if (__pyx_t_2) { + + /* "View.MemoryView":922 + * resultp = bufp + index * stride + * if suboffset >= 0: + * resultp = ( resultp)[0] + suboffset # <<<<<<<<<<<<<< + * + * return resultp +*/ + __pyx_v_resultp = ((((char **)__pyx_v_resultp)[0]) + __pyx_v_suboffset); + + /* "View.MemoryView":921 + * + * resultp = bufp + index * stride + * if suboffset >= 0: # <<<<<<<<<<<<<< + * resultp = ( resultp)[0] + suboffset + * +*/ + } + + /* "View.MemoryView":924 + * resultp = ( resultp)[0] + suboffset + * + * return resultp # <<<<<<<<<<<<<< + * + * +*/ + __pyx_r = __pyx_v_resultp; + goto __pyx_L0; + + /* "View.MemoryView":896 + * + * + * @cname('__pyx_pybuffer_index') # <<<<<<<<<<<<<< + * cdef char *pybuffer_index(Py_buffer *view, char *bufp, Py_ssize_t index, + * Py_ssize_t dim) except NULL: +*/ + + /* function exit code */ + __pyx_L1_error:; + __Pyx_XDECREF(__pyx_t_3); + __Pyx_XDECREF(__pyx_t_5); + __Pyx_AddTraceback("View.MemoryView.pybuffer_index", __pyx_clineno, __pyx_lineno, __pyx_filename); + __pyx_r = NULL; + __pyx_L0:; + __Pyx_RefNannyFinishContext(); + return __pyx_r; +} + +/* "View.MemoryView":929 + * + * + * @cname('__pyx_memslice_transpose') # <<<<<<<<<<<<<< + * cdef int transpose_memslice(__Pyx_memviewslice *memslice) except -1 nogil: + * cdef int ndim = memslice.memview.view.ndim +*/ + +static int __pyx_memslice_transpose(__Pyx_memviewslice *__pyx_v_memslice) { + int __pyx_v_ndim; + Py_ssize_t *__pyx_v_shape; + Py_ssize_t *__pyx_v_strides; + int __pyx_v_i; + int __pyx_v_j; + int __pyx_r; + int __pyx_t_1; + Py_ssize_t *__pyx_t_2; + long __pyx_t_3; + long __pyx_t_4; + Py_ssize_t __pyx_t_5; + Py_ssize_t __pyx_t_6; + int __pyx_t_7; + int __pyx_t_8; + int __pyx_t_9; + int __pyx_lineno = 0; + const char *__pyx_filename = NULL; + int __pyx_clineno = 0; + PyGILState_STATE __pyx_gilstate_save; + + /* "View.MemoryView":931 + * @cname('__pyx_memslice_transpose') + * cdef int transpose_memslice(__Pyx_memviewslice *memslice) except -1 nogil: + * cdef int ndim = memslice.memview.view.ndim # <<<<<<<<<<<<<< + * + * cdef Py_ssize_t *shape = memslice.shape +*/ + __pyx_t_1 = __pyx_v_memslice->memview->view.ndim; + __pyx_v_ndim = __pyx_t_1; + + /* "View.MemoryView":933 + * cdef int ndim = memslice.memview.view.ndim + * + * cdef Py_ssize_t *shape = memslice.shape # <<<<<<<<<<<<<< + * cdef Py_ssize_t *strides = memslice.strides + * +*/ + __pyx_t_2 = __pyx_v_memslice->shape; + __pyx_v_shape = __pyx_t_2; + + /* "View.MemoryView":934 + * + * cdef Py_ssize_t *shape = memslice.shape + * cdef Py_ssize_t *strides = memslice.strides # <<<<<<<<<<<<<< + * + * +*/ + __pyx_t_2 = __pyx_v_memslice->strides; + __pyx_v_strides = __pyx_t_2; + + /* "View.MemoryView":938 + * + * cdef int i, j + * for i in range(ndim // 2): # <<<<<<<<<<<<<< + * j = ndim - 1 - i + * strides[i], strides[j] = strides[j], strides[i] +*/ + __pyx_t_3 = __Pyx_div_long(__pyx_v_ndim, 2, 1); + __pyx_t_4 = __pyx_t_3; + for (__pyx_t_1 = 0; __pyx_t_1 < __pyx_t_4; __pyx_t_1+=1) { + __pyx_v_i = __pyx_t_1; + + /* "View.MemoryView":939 + * cdef int i, j + * for i in range(ndim // 2): + * j = ndim - 1 - i # <<<<<<<<<<<<<< + * strides[i], strides[j] = strides[j], strides[i] + * shape[i], shape[j] = shape[j], shape[i] +*/ + __pyx_v_j = ((__pyx_v_ndim - 1) - __pyx_v_i); + + /* "View.MemoryView":940 + * for i in range(ndim // 2): + * j = ndim - 1 - i + * strides[i], strides[j] = strides[j], strides[i] # <<<<<<<<<<<<<< + * shape[i], shape[j] = shape[j], shape[i] + * +*/ + __pyx_t_5 = (__pyx_v_strides[__pyx_v_j]); + __pyx_t_6 = (__pyx_v_strides[__pyx_v_i]); + (__pyx_v_strides[__pyx_v_i]) = __pyx_t_5; + (__pyx_v_strides[__pyx_v_j]) = __pyx_t_6; + + /* "View.MemoryView":941 + * j = ndim - 1 - i + * strides[i], strides[j] = strides[j], strides[i] + * shape[i], shape[j] = shape[j], shape[i] # <<<<<<<<<<<<<< + * + * if memslice.suboffsets[i] >= 0 or memslice.suboffsets[j] >= 0: +*/ + __pyx_t_6 = (__pyx_v_shape[__pyx_v_j]); + __pyx_t_5 = (__pyx_v_shape[__pyx_v_i]); + (__pyx_v_shape[__pyx_v_i]) = __pyx_t_6; + (__pyx_v_shape[__pyx_v_j]) = __pyx_t_5; + + /* "View.MemoryView":943 + * shape[i], shape[j] = shape[j], shape[i] + * + * if memslice.suboffsets[i] >= 0 or memslice.suboffsets[j] >= 0: # <<<<<<<<<<<<<< + * _err(PyExc_ValueError, "Cannot transpose memoryview with indirect dimensions") + * +*/ + __pyx_t_8 = ((__pyx_v_memslice->suboffsets[__pyx_v_i]) >= 0); + if (!__pyx_t_8) { + } else { + __pyx_t_7 = __pyx_t_8; + goto __pyx_L6_bool_binop_done; + } + __pyx_t_8 = ((__pyx_v_memslice->suboffsets[__pyx_v_j]) >= 0); + __pyx_t_7 = __pyx_t_8; + __pyx_L6_bool_binop_done:; + if (__pyx_t_7) { + + /* "View.MemoryView":944 + * + * if memslice.suboffsets[i] >= 0 or memslice.suboffsets[j] >= 0: + * _err(PyExc_ValueError, "Cannot transpose memoryview with indirect dimensions") # <<<<<<<<<<<<<< + * + * return 0 +*/ + __pyx_t_9 = __pyx_memoryview_err(PyExc_ValueError, __pyx_mstate_global->__pyx_kp_u_Cannot_transpose_memoryview_with); if (unlikely(__pyx_t_9 == ((int)-1))) __PYX_ERR(1, 944, __pyx_L1_error) + + /* "View.MemoryView":943 + * shape[i], shape[j] = shape[j], shape[i] + * + * if memslice.suboffsets[i] >= 0 or memslice.suboffsets[j] >= 0: # <<<<<<<<<<<<<< + * _err(PyExc_ValueError, "Cannot transpose memoryview with indirect dimensions") + * +*/ + } + } + + /* "View.MemoryView":946 + * _err(PyExc_ValueError, "Cannot transpose memoryview with indirect dimensions") + * + * return 0 # <<<<<<<<<<<<<< + * + * +*/ + __pyx_r = 0; + goto __pyx_L0; + + /* "View.MemoryView":929 + * + * + * @cname('__pyx_memslice_transpose') # <<<<<<<<<<<<<< + * cdef int transpose_memslice(__Pyx_memviewslice *memslice) except -1 nogil: + * cdef int ndim = memslice.memview.view.ndim +*/ + + /* function exit code */ + __pyx_L1_error:; + __pyx_gilstate_save = __Pyx_PyGILState_Ensure(); + __Pyx_AddTraceback("View.MemoryView.transpose_memslice", __pyx_clineno, __pyx_lineno, __pyx_filename); + __pyx_r = -1; + __Pyx_PyGILState_Release(__pyx_gilstate_save); + __pyx_L0:; + return __pyx_r; +} + +/* "View.MemoryView":964 + * cdef int (*to_dtype_func)(char *, object) except 0 + * + * def __dealloc__(self): # <<<<<<<<<<<<<< + * __PYX_XCLEAR_MEMVIEW(&self.from_slice, 1) + * +*/ + +/* Python wrapper */ +static void __pyx_memoryviewslice___dealloc__(PyObject *__pyx_v_self); /*proto*/ +static void __pyx_memoryviewslice___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_memoryviewslice___pyx_pf_15View_dot_MemoryView_16_memoryviewslice___dealloc__(((struct __pyx_memoryviewslice_obj *)__pyx_v_self)); + + /* function exit code */ + __Pyx_RefNannyFinishContext(); +} + +static void __pyx_memoryviewslice___pyx_pf_15View_dot_MemoryView_16_memoryviewslice___dealloc__(struct __pyx_memoryviewslice_obj *__pyx_v_self) { + + /* "View.MemoryView":965 + * + * def __dealloc__(self): + * __PYX_XCLEAR_MEMVIEW(&self.from_slice, 1) # <<<<<<<<<<<<<< + * + * cdef convert_item_to_object(self, char *itemp): +*/ + __PYX_XCLEAR_MEMVIEW((&__pyx_v_self->from_slice), 1); + + /* "View.MemoryView":964 + * cdef int (*to_dtype_func)(char *, object) except 0 + * + * def __dealloc__(self): # <<<<<<<<<<<<<< + * __PYX_XCLEAR_MEMVIEW(&self.from_slice, 1) + * +*/ + + /* function exit code */ +} + +/* "View.MemoryView":967 + * __PYX_XCLEAR_MEMVIEW(&self.from_slice, 1) + * + * cdef convert_item_to_object(self, char *itemp): # <<<<<<<<<<<<<< + * if self.to_object_func != NULL: + * return self.to_object_func(itemp) +*/ + +static PyObject *__pyx_memoryviewslice_convert_item_to_object(struct __pyx_memoryviewslice_obj *__pyx_v_self, char *__pyx_v_itemp) { + 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("convert_item_to_object", 0); + + /* "View.MemoryView":968 + * + * cdef convert_item_to_object(self, char *itemp): + * if self.to_object_func != NULL: # <<<<<<<<<<<<<< + * return self.to_object_func(itemp) + * else: +*/ + __pyx_t_1 = (__pyx_v_self->to_object_func != NULL); + if (__pyx_t_1) { + + /* "View.MemoryView":969 + * cdef convert_item_to_object(self, char *itemp): + * if self.to_object_func != NULL: + * return self.to_object_func(itemp) # <<<<<<<<<<<<<< + * else: + * return memoryview.convert_item_to_object(self, itemp) +*/ + __Pyx_XDECREF(__pyx_r); + __pyx_t_2 = __pyx_v_self->to_object_func(__pyx_v_itemp); if (unlikely(!__pyx_t_2)) __PYX_ERR(1, 969, __pyx_L1_error) + __Pyx_GOTREF(__pyx_t_2); + __pyx_r = __pyx_t_2; + __pyx_t_2 = 0; + goto __pyx_L0; + + /* "View.MemoryView":968 + * + * cdef convert_item_to_object(self, char *itemp): + * if self.to_object_func != NULL: # <<<<<<<<<<<<<< + * return self.to_object_func(itemp) + * else: +*/ + } + + /* "View.MemoryView":971 + * return self.to_object_func(itemp) + * else: + * return memoryview.convert_item_to_object(self, itemp) # <<<<<<<<<<<<<< + * + * cdef assign_item_from_object(self, char *itemp, object value): +*/ + /*else*/ { + __Pyx_XDECREF(__pyx_r); + __pyx_t_2 = __pyx_memoryview_convert_item_to_object(((struct __pyx_memoryview_obj *)__pyx_v_self), __pyx_v_itemp); if (unlikely(!__pyx_t_2)) __PYX_ERR(1, 971, __pyx_L1_error) + __Pyx_GOTREF(__pyx_t_2); + __pyx_r = __pyx_t_2; + __pyx_t_2 = 0; + goto __pyx_L0; + } + + /* "View.MemoryView":967 + * __PYX_XCLEAR_MEMVIEW(&self.from_slice, 1) + * + * cdef convert_item_to_object(self, char *itemp): # <<<<<<<<<<<<<< + * if self.to_object_func != NULL: + * return self.to_object_func(itemp) +*/ + + /* function exit code */ + __pyx_L1_error:; + __Pyx_XDECREF(__pyx_t_2); + __Pyx_AddTraceback("View.MemoryView._memoryviewslice.convert_item_to_object", __pyx_clineno, __pyx_lineno, __pyx_filename); + __pyx_r = 0; + __pyx_L0:; + __Pyx_XGIVEREF(__pyx_r); + __Pyx_RefNannyFinishContext(); + return __pyx_r; +} + +/* "View.MemoryView":973 + * return memoryview.convert_item_to_object(self, itemp) + * + * cdef assign_item_from_object(self, char *itemp, object value): # <<<<<<<<<<<<<< + * if self.to_dtype_func != NULL: + * self.to_dtype_func(itemp, value) +*/ + +static PyObject *__pyx_memoryviewslice_assign_item_from_object(struct __pyx_memoryviewslice_obj *__pyx_v_self, char *__pyx_v_itemp, PyObject *__pyx_v_value) { + PyObject *__pyx_r = NULL; + __Pyx_RefNannyDeclarations + int __pyx_t_1; + int __pyx_t_2; + PyObject *__pyx_t_3 = NULL; + int __pyx_lineno = 0; + const char *__pyx_filename = NULL; + int __pyx_clineno = 0; + __Pyx_RefNannySetupContext("assign_item_from_object", 0); + + /* "View.MemoryView":974 + * + * cdef assign_item_from_object(self, char *itemp, object value): + * if self.to_dtype_func != NULL: # <<<<<<<<<<<<<< + * self.to_dtype_func(itemp, value) + * else: +*/ + __pyx_t_1 = (__pyx_v_self->to_dtype_func != NULL); + if (__pyx_t_1) { + + /* "View.MemoryView":975 + * cdef assign_item_from_object(self, char *itemp, object value): + * if self.to_dtype_func != NULL: + * self.to_dtype_func(itemp, value) # <<<<<<<<<<<<<< + * else: + * memoryview.assign_item_from_object(self, itemp, value) +*/ + __pyx_t_2 = __pyx_v_self->to_dtype_func(__pyx_v_itemp, __pyx_v_value); if (unlikely(__pyx_t_2 == ((int)0))) __PYX_ERR(1, 975, __pyx_L1_error) + + /* "View.MemoryView":974 + * + * cdef assign_item_from_object(self, char *itemp, object value): + * if self.to_dtype_func != NULL: # <<<<<<<<<<<<<< + * self.to_dtype_func(itemp, value) + * else: +*/ + goto __pyx_L3; + } + + /* "View.MemoryView":977 + * self.to_dtype_func(itemp, value) + * else: + * memoryview.assign_item_from_object(self, itemp, value) # <<<<<<<<<<<<<< + * + * cdef _get_base(self): +*/ + /*else*/ { + __pyx_t_3 = __pyx_memoryview_assign_item_from_object(((struct __pyx_memoryview_obj *)__pyx_v_self), __pyx_v_itemp, __pyx_v_value); if (unlikely(!__pyx_t_3)) __PYX_ERR(1, 977, __pyx_L1_error) + __Pyx_GOTREF(__pyx_t_3); + __Pyx_DECREF(__pyx_t_3); __pyx_t_3 = 0; + } + __pyx_L3:; + + /* "View.MemoryView":973 + * return memoryview.convert_item_to_object(self, itemp) + * + * cdef assign_item_from_object(self, char *itemp, object value): # <<<<<<<<<<<<<< + * if self.to_dtype_func != NULL: + * self.to_dtype_func(itemp, value) +*/ + + /* function exit code */ + __pyx_r = Py_None; __Pyx_INCREF(Py_None); + goto __pyx_L0; + __pyx_L1_error:; + __Pyx_XDECREF(__pyx_t_3); + __Pyx_AddTraceback("View.MemoryView._memoryviewslice.assign_item_from_object", __pyx_clineno, __pyx_lineno, __pyx_filename); + __pyx_r = 0; + __pyx_L0:; + __Pyx_XGIVEREF(__pyx_r); + __Pyx_RefNannyFinishContext(); + return __pyx_r; +} + +/* "View.MemoryView":979 + * memoryview.assign_item_from_object(self, itemp, value) + * + * cdef _get_base(self): # <<<<<<<<<<<<<< + * return self.from_object + * +*/ + +static PyObject *__pyx_memoryviewslice__get_base(struct __pyx_memoryviewslice_obj *__pyx_v_self) { + PyObject *__pyx_r = NULL; + __Pyx_RefNannyDeclarations + __Pyx_RefNannySetupContext("_get_base", 0); + + /* "View.MemoryView":980 + * + * cdef _get_base(self): + * return self.from_object # <<<<<<<<<<<<<< + * + * +*/ + __Pyx_XDECREF(__pyx_r); + __Pyx_INCREF(__pyx_v_self->from_object); + __pyx_r = __pyx_v_self->from_object; + goto __pyx_L0; + + /* "View.MemoryView":979 + * memoryview.assign_item_from_object(self, itemp, value) + * + * cdef _get_base(self): # <<<<<<<<<<<<<< + * return self.from_object + * +*/ + + /* function exit code */ + __pyx_L0:; + __Pyx_XGIVEREF(__pyx_r); + __Pyx_RefNannyFinishContext(); + return __pyx_r; +} + +/* "(tree fragment)":1 + * def __reduce_cython__(self): # <<<<<<<<<<<<<< + * raise TypeError, "no default __reduce__ due to non-trivial __cinit__" + * def __setstate_cython__(self, __pyx_state): +*/ + +/* Python wrapper */ +static PyObject *__pyx_pw___pyx_memoryviewslice_1__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*/ +static PyObject *__pyx_pw___pyx_memoryviewslice_1__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___pyx_memoryviewslice___reduce_cython__(((struct __pyx_memoryviewslice_obj *)__pyx_v_self)); + + /* function exit code */ + __Pyx_RefNannyFinishContext(); + return __pyx_r; +} + +static PyObject *__pyx_pf___pyx_memoryviewslice___reduce_cython__(CYTHON_UNUSED struct __pyx_memoryviewslice_obj *__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("View.MemoryView._memoryviewslice.__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___pyx_memoryviewslice_3__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*/ +static PyObject *__pyx_pw___pyx_memoryviewslice_3__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("View.MemoryView._memoryviewslice.__setstate_cython__", __pyx_clineno, __pyx_lineno, __pyx_filename); + __Pyx_RefNannyFinishContext(); + return NULL; + __pyx_L4_argument_unpacking_done:; + __pyx_r = __pyx_pf___pyx_memoryviewslice_2__setstate_cython__(((struct __pyx_memoryviewslice_obj *)__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___pyx_memoryviewslice_2__setstate_cython__(CYTHON_UNUSED struct __pyx_memoryviewslice_obj *__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("View.MemoryView._memoryviewslice.__setstate_cython__", __pyx_clineno, __pyx_lineno, __pyx_filename); + __pyx_r = NULL; + __Pyx_XGIVEREF(__pyx_r); + __Pyx_RefNannyFinishContext(); + return __pyx_r; +} + +/* "View.MemoryView":999 + * pass # ignore failure, it's a minor issue + * + * @cname('__pyx_memoryview_fromslice') # <<<<<<<<<<<<<< + * cdef memoryview_fromslice(__Pyx_memviewslice memviewslice, + * int ndim, +*/ + +static PyObject *__pyx_memoryview_fromslice(__Pyx_memviewslice __pyx_v_memviewslice, int __pyx_v_ndim, PyObject *(*__pyx_v_to_object_func)(char *), int (*__pyx_v_to_dtype_func)(char *, PyObject *), int __pyx_v_dtype_is_object) { + struct __pyx_memoryviewslice_obj *__pyx_v_result = 0; + Py_ssize_t __pyx_v_suboffset; + PyObject *__pyx_v_length = NULL; + PyObject *__pyx_r = NULL; + __Pyx_RefNannyDeclarations + int __pyx_t_1; + PyObject *__pyx_t_2 = NULL; + PyObject *__pyx_t_3 = NULL; + __Pyx_TypeInfo const *__pyx_t_4; + Py_buffer __pyx_t_5; + Py_ssize_t *__pyx_t_6; + Py_ssize_t *__pyx_t_7; + Py_ssize_t *__pyx_t_8; + Py_ssize_t __pyx_t_9; + int __pyx_lineno = 0; + const char *__pyx_filename = NULL; + int __pyx_clineno = 0; + __Pyx_RefNannySetupContext("memoryview_fromslice", 0); + + /* "View.MemoryView":1008 + * cdef _memoryviewslice result + * + * if memviewslice.memview == Py_None: # <<<<<<<<<<<<<< + * return None + * +*/ + __pyx_t_1 = (((PyObject *)__pyx_v_memviewslice.memview) == Py_None); + if (__pyx_t_1) { + + /* "View.MemoryView":1009 + * + * if memviewslice.memview == Py_None: + * return None # <<<<<<<<<<<<<< + * + * +*/ + __Pyx_XDECREF(__pyx_r); + __pyx_r = Py_None; __Pyx_INCREF(Py_None); + goto __pyx_L0; + + /* "View.MemoryView":1008 + * cdef _memoryviewslice result + * + * if memviewslice.memview == Py_None: # <<<<<<<<<<<<<< + * return None + * +*/ + } + + /* "View.MemoryView":1014 + * + * + * result = _memoryviewslice.__new__(_memoryviewslice, None, 0, dtype_is_object) # <<<<<<<<<<<<<< + * + * result.from_slice = memviewslice +*/ + __pyx_t_2 = __Pyx_PyBool_FromLong(__pyx_v_dtype_is_object); if (unlikely(!__pyx_t_2)) __PYX_ERR(1, 1014, __pyx_L1_error) + __Pyx_GOTREF(__pyx_t_2); + __pyx_t_3 = PyTuple_New(3); if (unlikely(!__pyx_t_3)) __PYX_ERR(1, 1014, __pyx_L1_error) + __Pyx_GOTREF(__pyx_t_3); + __Pyx_INCREF(Py_None); + __Pyx_GIVEREF(Py_None); + if (__Pyx_PyTuple_SET_ITEM(__pyx_t_3, 0, Py_None) != (0)) __PYX_ERR(1, 1014, __pyx_L1_error); + __Pyx_INCREF(__pyx_mstate_global->__pyx_int_0); + __Pyx_GIVEREF(__pyx_mstate_global->__pyx_int_0); + if (__Pyx_PyTuple_SET_ITEM(__pyx_t_3, 1, __pyx_mstate_global->__pyx_int_0) != (0)) __PYX_ERR(1, 1014, __pyx_L1_error); + __Pyx_GIVEREF(__pyx_t_2); + if (__Pyx_PyTuple_SET_ITEM(__pyx_t_3, 2, __pyx_t_2) != (0)) __PYX_ERR(1, 1014, __pyx_L1_error); + __pyx_t_2 = 0; + __pyx_t_2 = ((PyObject *)__pyx_tp_new__memoryviewslice(((PyTypeObject *)__pyx_mstate_global->__pyx_memoryviewslice_type), __pyx_t_3, NULL)); if (unlikely(!__pyx_t_2)) __PYX_ERR(1, 1014, __pyx_L1_error) + __Pyx_GOTREF((PyObject *)__pyx_t_2); + __Pyx_DECREF(__pyx_t_3); __pyx_t_3 = 0; + __pyx_v_result = ((struct __pyx_memoryviewslice_obj *)__pyx_t_2); + __pyx_t_2 = 0; + + /* "View.MemoryView":1016 + * result = _memoryviewslice.__new__(_memoryviewslice, None, 0, dtype_is_object) + * + * result.from_slice = memviewslice # <<<<<<<<<<<<<< + * __PYX_INC_MEMVIEW(&memviewslice, 1) + * +*/ + __pyx_v_result->from_slice = __pyx_v_memviewslice; + + /* "View.MemoryView":1017 + * + * result.from_slice = memviewslice + * __PYX_INC_MEMVIEW(&memviewslice, 1) # <<<<<<<<<<<<<< + * + * result.from_object = ( memviewslice.memview)._get_base() +*/ + __PYX_INC_MEMVIEW((&__pyx_v_memviewslice), 1); + + /* "View.MemoryView":1019 + * __PYX_INC_MEMVIEW(&memviewslice, 1) + * + * result.from_object = ( memviewslice.memview)._get_base() # <<<<<<<<<<<<<< + * result.typeinfo = memviewslice.memview.typeinfo + * +*/ + __pyx_t_2 = ((struct __pyx_vtabstruct_memoryview *)((struct __pyx_memoryview_obj *)__pyx_v_memviewslice.memview)->__pyx_vtab)->_get_base(((struct __pyx_memoryview_obj *)__pyx_v_memviewslice.memview)); if (unlikely(!__pyx_t_2)) __PYX_ERR(1, 1019, __pyx_L1_error) + __Pyx_GOTREF(__pyx_t_2); + __Pyx_GIVEREF(__pyx_t_2); + __Pyx_GOTREF(__pyx_v_result->from_object); + __Pyx_DECREF(__pyx_v_result->from_object); + __pyx_v_result->from_object = __pyx_t_2; + __pyx_t_2 = 0; + + /* "View.MemoryView":1020 + * + * result.from_object = ( memviewslice.memview)._get_base() + * result.typeinfo = memviewslice.memview.typeinfo # <<<<<<<<<<<<<< + * + * result.view = memviewslice.memview.view +*/ + __pyx_t_4 = __pyx_v_memviewslice.memview->typeinfo; + __pyx_v_result->__pyx_base.typeinfo = __pyx_t_4; + + /* "View.MemoryView":1022 + * result.typeinfo = memviewslice.memview.typeinfo + * + * result.view = memviewslice.memview.view # <<<<<<<<<<<<<< + * result.view.buf = memviewslice.data + * result.view.ndim = ndim +*/ + __pyx_t_5 = __pyx_v_memviewslice.memview->view; + __pyx_v_result->__pyx_base.view = __pyx_t_5; + + /* "View.MemoryView":1023 + * + * result.view = memviewslice.memview.view + * result.view.buf = memviewslice.data # <<<<<<<<<<<<<< + * result.view.ndim = ndim + * (<__pyx_buffer *> &result.view).obj = Py_None +*/ + __pyx_v_result->__pyx_base.view.buf = ((void *)__pyx_v_memviewslice.data); + + /* "View.MemoryView":1024 + * result.view = memviewslice.memview.view + * result.view.buf = memviewslice.data + * result.view.ndim = ndim # <<<<<<<<<<<<<< + * (<__pyx_buffer *> &result.view).obj = Py_None + * Py_INCREF(Py_None) +*/ + __pyx_v_result->__pyx_base.view.ndim = __pyx_v_ndim; + + /* "View.MemoryView":1025 + * result.view.buf = memviewslice.data + * result.view.ndim = ndim + * (<__pyx_buffer *> &result.view).obj = Py_None # <<<<<<<<<<<<<< + * Py_INCREF(Py_None) + * +*/ + ((Py_buffer *)(&__pyx_v_result->__pyx_base.view))->obj = Py_None; + + /* "View.MemoryView":1026 + * result.view.ndim = ndim + * (<__pyx_buffer *> &result.view).obj = Py_None + * Py_INCREF(Py_None) # <<<<<<<<<<<<<< + * + * if (memviewslice.memview).flags & PyBUF_WRITABLE: +*/ + Py_INCREF(Py_None); + + /* "View.MemoryView":1028 + * Py_INCREF(Py_None) + * + * if (memviewslice.memview).flags & PyBUF_WRITABLE: # <<<<<<<<<<<<<< + * result.flags = PyBUF_RECORDS + * else: +*/ + __pyx_t_1 = ((((struct __pyx_memoryview_obj *)__pyx_v_memviewslice.memview)->flags & PyBUF_WRITABLE) != 0); + if (__pyx_t_1) { + + /* "View.MemoryView":1029 + * + * if (memviewslice.memview).flags & PyBUF_WRITABLE: + * result.flags = PyBUF_RECORDS # <<<<<<<<<<<<<< + * else: + * result.flags = PyBUF_RECORDS_RO +*/ + __pyx_v_result->__pyx_base.flags = PyBUF_RECORDS; + + /* "View.MemoryView":1028 + * Py_INCREF(Py_None) + * + * if (memviewslice.memview).flags & PyBUF_WRITABLE: # <<<<<<<<<<<<<< + * result.flags = PyBUF_RECORDS + * else: +*/ + goto __pyx_L4; + } + + /* "View.MemoryView":1031 + * result.flags = PyBUF_RECORDS + * else: + * result.flags = PyBUF_RECORDS_RO # <<<<<<<<<<<<<< + * + * result.view.shape = result.from_slice.shape +*/ + /*else*/ { + __pyx_v_result->__pyx_base.flags = PyBUF_RECORDS_RO; + } + __pyx_L4:; + + /* "View.MemoryView":1033 + * result.flags = PyBUF_RECORDS_RO + * + * result.view.shape = result.from_slice.shape # <<<<<<<<<<<<<< + * result.view.strides = result.from_slice.strides + * +*/ + __pyx_v_result->__pyx_base.view.shape = ((Py_ssize_t *)__pyx_v_result->from_slice.shape); + + /* "View.MemoryView":1034 + * + * result.view.shape = result.from_slice.shape + * result.view.strides = result.from_slice.strides # <<<<<<<<<<<<<< + * + * +*/ + __pyx_v_result->__pyx_base.view.strides = ((Py_ssize_t *)__pyx_v_result->from_slice.strides); + + /* "View.MemoryView":1037 + * + * + * result.view.suboffsets = NULL # <<<<<<<<<<<<<< + * for suboffset in result.from_slice.suboffsets[:ndim]: + * if suboffset >= 0: +*/ + __pyx_v_result->__pyx_base.view.suboffsets = NULL; + + /* "View.MemoryView":1038 + * + * result.view.suboffsets = NULL + * for suboffset in result.from_slice.suboffsets[:ndim]: # <<<<<<<<<<<<<< + * if suboffset >= 0: + * result.view.suboffsets = result.from_slice.suboffsets +*/ + __pyx_t_7 = (__pyx_v_result->from_slice.suboffsets + __pyx_v_ndim); + for (__pyx_t_8 = __pyx_v_result->from_slice.suboffsets; __pyx_t_8 < __pyx_t_7; __pyx_t_8++) { + __pyx_t_6 = __pyx_t_8; + __pyx_v_suboffset = (__pyx_t_6[0]); + + /* "View.MemoryView":1039 + * result.view.suboffsets = NULL + * for suboffset in result.from_slice.suboffsets[:ndim]: + * if suboffset >= 0: # <<<<<<<<<<<<<< + * result.view.suboffsets = result.from_slice.suboffsets + * break +*/ + __pyx_t_1 = (__pyx_v_suboffset >= 0); + if (__pyx_t_1) { + + /* "View.MemoryView":1040 + * for suboffset in result.from_slice.suboffsets[:ndim]: + * if suboffset >= 0: + * result.view.suboffsets = result.from_slice.suboffsets # <<<<<<<<<<<<<< + * break + * +*/ + __pyx_v_result->__pyx_base.view.suboffsets = ((Py_ssize_t *)__pyx_v_result->from_slice.suboffsets); + + /* "View.MemoryView":1041 + * if suboffset >= 0: + * result.view.suboffsets = result.from_slice.suboffsets + * break # <<<<<<<<<<<<<< + * + * result.view.len = result.view.itemsize +*/ + goto __pyx_L6_break; + + /* "View.MemoryView":1039 + * result.view.suboffsets = NULL + * for suboffset in result.from_slice.suboffsets[:ndim]: + * if suboffset >= 0: # <<<<<<<<<<<<<< + * result.view.suboffsets = result.from_slice.suboffsets + * break +*/ + } + } + __pyx_L6_break:; + + /* "View.MemoryView":1043 + * break + * + * result.view.len = result.view.itemsize # <<<<<<<<<<<<<< + * for length in result.view.shape[:ndim]: + * result.view.len *= length +*/ + __pyx_t_9 = __pyx_v_result->__pyx_base.view.itemsize; + __pyx_v_result->__pyx_base.view.len = __pyx_t_9; + + /* "View.MemoryView":1044 + * + * result.view.len = result.view.itemsize + * for length in result.view.shape[:ndim]: # <<<<<<<<<<<<<< + * result.view.len *= length + * +*/ + __pyx_t_7 = (__pyx_v_result->__pyx_base.view.shape + __pyx_v_ndim); + for (__pyx_t_8 = __pyx_v_result->__pyx_base.view.shape; __pyx_t_8 < __pyx_t_7; __pyx_t_8++) { + __pyx_t_6 = __pyx_t_8; + __pyx_t_2 = PyLong_FromSsize_t((__pyx_t_6[0])); if (unlikely(!__pyx_t_2)) __PYX_ERR(1, 1044, __pyx_L1_error) + __Pyx_GOTREF(__pyx_t_2); + __Pyx_XDECREF_SET(__pyx_v_length, __pyx_t_2); + __pyx_t_2 = 0; + + /* "View.MemoryView":1045 + * result.view.len = result.view.itemsize + * for length in result.view.shape[:ndim]: + * result.view.len *= length # <<<<<<<<<<<<<< + * + * result.to_object_func = to_object_func +*/ + __pyx_t_2 = PyLong_FromSsize_t(__pyx_v_result->__pyx_base.view.len); if (unlikely(!__pyx_t_2)) __PYX_ERR(1, 1045, __pyx_L1_error) + __Pyx_GOTREF(__pyx_t_2); + __pyx_t_3 = PyNumber_InPlaceMultiply(__pyx_t_2, __pyx_v_length); if (unlikely(!__pyx_t_3)) __PYX_ERR(1, 1045, __pyx_L1_error) + __Pyx_GOTREF(__pyx_t_3); + __Pyx_DECREF(__pyx_t_2); __pyx_t_2 = 0; + __pyx_t_9 = __Pyx_PyIndex_AsSsize_t(__pyx_t_3); if (unlikely((__pyx_t_9 == (Py_ssize_t)-1) && PyErr_Occurred())) __PYX_ERR(1, 1045, __pyx_L1_error) + __Pyx_DECREF(__pyx_t_3); __pyx_t_3 = 0; + __pyx_v_result->__pyx_base.view.len = __pyx_t_9; + } + + /* "View.MemoryView":1047 + * result.view.len *= length + * + * result.to_object_func = to_object_func # <<<<<<<<<<<<<< + * result.to_dtype_func = to_dtype_func + * +*/ + __pyx_v_result->to_object_func = __pyx_v_to_object_func; + + /* "View.MemoryView":1048 + * + * result.to_object_func = to_object_func + * result.to_dtype_func = to_dtype_func # <<<<<<<<<<<<<< + * + * return result +*/ + __pyx_v_result->to_dtype_func = __pyx_v_to_dtype_func; + + /* "View.MemoryView":1050 + * result.to_dtype_func = to_dtype_func + * + * return result # <<<<<<<<<<<<<< + * + * @cname('__pyx_memoryview_get_slice_from_memoryview') +*/ + __Pyx_XDECREF(__pyx_r); + __Pyx_INCREF((PyObject *)__pyx_v_result); + __pyx_r = ((PyObject *)__pyx_v_result); + goto __pyx_L0; + + /* "View.MemoryView":999 + * pass # ignore failure, it's a minor issue + * + * @cname('__pyx_memoryview_fromslice') # <<<<<<<<<<<<<< + * cdef memoryview_fromslice(__Pyx_memviewslice memviewslice, + * int ndim, +*/ + + /* function exit code */ + __pyx_L1_error:; + __Pyx_XDECREF(__pyx_t_2); + __Pyx_XDECREF(__pyx_t_3); + __Pyx_AddTraceback("View.MemoryView.memoryview_fromslice", __pyx_clineno, __pyx_lineno, __pyx_filename); + __pyx_r = 0; + __pyx_L0:; + __Pyx_XDECREF((PyObject *)__pyx_v_result); + __Pyx_XDECREF(__pyx_v_length); + __Pyx_XGIVEREF(__pyx_r); + __Pyx_RefNannyFinishContext(); + return __pyx_r; +} + +/* "View.MemoryView":1052 + * return result + * + * @cname('__pyx_memoryview_get_slice_from_memoryview') # <<<<<<<<<<<<<< + * cdef __Pyx_memviewslice *get_slice_from_memview(memoryview memview, + * __Pyx_memviewslice *mslice) except NULL: +*/ + +static __Pyx_memviewslice *__pyx_memoryview_get_slice_from_memoryview(struct __pyx_memoryview_obj *__pyx_v_memview, __Pyx_memviewslice *__pyx_v_mslice) { + struct __pyx_memoryviewslice_obj *__pyx_v_obj = 0; + __Pyx_memviewslice *__pyx_r; + __Pyx_RefNannyDeclarations + int __pyx_t_1; + PyObject *__pyx_t_2 = NULL; + int __pyx_lineno = 0; + const char *__pyx_filename = NULL; + int __pyx_clineno = 0; + __Pyx_RefNannySetupContext("get_slice_from_memview", 0); + + /* "View.MemoryView":1056 + * __Pyx_memviewslice *mslice) except NULL: + * cdef _memoryviewslice obj + * if isinstance(memview, _memoryviewslice): # <<<<<<<<<<<<<< + * obj = memview + * return &obj.from_slice +*/ + __pyx_t_1 = __Pyx_TypeCheck(((PyObject *)__pyx_v_memview), __pyx_mstate_global->__pyx_memoryviewslice_type); + if (__pyx_t_1) { + + /* "View.MemoryView":1057 + * cdef _memoryviewslice obj + * if isinstance(memview, _memoryviewslice): + * obj = memview # <<<<<<<<<<<<<< + * return &obj.from_slice + * else: +*/ + __pyx_t_2 = ((PyObject *)__pyx_v_memview); + __Pyx_INCREF(__pyx_t_2); + if (!(likely(((__pyx_t_2) == Py_None) || likely(__Pyx_TypeTest(__pyx_t_2, __pyx_mstate_global->__pyx_memoryviewslice_type))))) __PYX_ERR(1, 1057, __pyx_L1_error) + __pyx_v_obj = ((struct __pyx_memoryviewslice_obj *)__pyx_t_2); + __pyx_t_2 = 0; + + /* "View.MemoryView":1058 + * if isinstance(memview, _memoryviewslice): + * obj = memview + * return &obj.from_slice # <<<<<<<<<<<<<< + * else: + * slice_copy(memview, mslice) +*/ + __pyx_r = (&__pyx_v_obj->from_slice); + goto __pyx_L0; + + /* "View.MemoryView":1056 + * __Pyx_memviewslice *mslice) except NULL: + * cdef _memoryviewslice obj + * if isinstance(memview, _memoryviewslice): # <<<<<<<<<<<<<< + * obj = memview + * return &obj.from_slice +*/ + } + + /* "View.MemoryView":1060 + * return &obj.from_slice + * else: + * slice_copy(memview, mslice) # <<<<<<<<<<<<<< + * return mslice + * +*/ + /*else*/ { + __pyx_memoryview_slice_copy(__pyx_v_memview, __pyx_v_mslice); + + /* "View.MemoryView":1061 + * else: + * slice_copy(memview, mslice) + * return mslice # <<<<<<<<<<<<<< + * + * @cname('__pyx_memoryview_slice_copy') +*/ + __pyx_r = __pyx_v_mslice; + goto __pyx_L0; + } + + /* "View.MemoryView":1052 + * return result + * + * @cname('__pyx_memoryview_get_slice_from_memoryview') # <<<<<<<<<<<<<< + * cdef __Pyx_memviewslice *get_slice_from_memview(memoryview memview, + * __Pyx_memviewslice *mslice) except NULL: +*/ + + /* function exit code */ + __pyx_L1_error:; + __Pyx_XDECREF(__pyx_t_2); + __Pyx_AddTraceback("View.MemoryView.get_slice_from_memview", __pyx_clineno, __pyx_lineno, __pyx_filename); + __pyx_r = NULL; + __pyx_L0:; + __Pyx_XDECREF((PyObject *)__pyx_v_obj); + __Pyx_RefNannyFinishContext(); + return __pyx_r; +} + +/* "View.MemoryView":1063 + * return mslice + * + * @cname('__pyx_memoryview_slice_copy') # <<<<<<<<<<<<<< + * cdef void slice_copy(memoryview memview, __Pyx_memviewslice *dst) noexcept: + * cdef int dim +*/ + +static void __pyx_memoryview_slice_copy(struct __pyx_memoryview_obj *__pyx_v_memview, __Pyx_memviewslice *__pyx_v_dst) { + int __pyx_v_dim; + Py_ssize_t *__pyx_v_shape; + Py_ssize_t *__pyx_v_strides; + Py_ssize_t *__pyx_v_suboffsets; + Py_ssize_t *__pyx_t_1; + int __pyx_t_2; + int __pyx_t_3; + int __pyx_t_4; + Py_ssize_t __pyx_t_5; + int __pyx_t_6; + + /* "View.MemoryView":1068 + * cdef (Py_ssize_t*) shape, strides, suboffsets + * + * shape = memview.view.shape # <<<<<<<<<<<<<< + * strides = memview.view.strides + * suboffsets = memview.view.suboffsets +*/ + __pyx_t_1 = __pyx_v_memview->view.shape; + __pyx_v_shape = __pyx_t_1; + + /* "View.MemoryView":1069 + * + * shape = memview.view.shape + * strides = memview.view.strides # <<<<<<<<<<<<<< + * suboffsets = memview.view.suboffsets + * +*/ + __pyx_t_1 = __pyx_v_memview->view.strides; + __pyx_v_strides = __pyx_t_1; + + /* "View.MemoryView":1070 + * shape = memview.view.shape + * strides = memview.view.strides + * suboffsets = memview.view.suboffsets # <<<<<<<<<<<<<< + * + * dst.memview = <__pyx_memoryview *> memview +*/ + __pyx_t_1 = __pyx_v_memview->view.suboffsets; + __pyx_v_suboffsets = __pyx_t_1; + + /* "View.MemoryView":1072 + * suboffsets = memview.view.suboffsets + * + * dst.memview = <__pyx_memoryview *> memview # <<<<<<<<<<<<<< + * dst.data = memview.view.buf + * +*/ + __pyx_v_dst->memview = ((struct __pyx_memoryview_obj *)__pyx_v_memview); + + /* "View.MemoryView":1073 + * + * dst.memview = <__pyx_memoryview *> memview + * dst.data = memview.view.buf # <<<<<<<<<<<<<< + * + * for dim in range(memview.view.ndim): +*/ + __pyx_v_dst->data = ((char *)__pyx_v_memview->view.buf); + + /* "View.MemoryView":1075 + * dst.data = memview.view.buf + * + * for dim in range(memview.view.ndim): # <<<<<<<<<<<<<< + * dst.shape[dim] = shape[dim] + * dst.strides[dim] = strides[dim] +*/ + __pyx_t_2 = __pyx_v_memview->view.ndim; + __pyx_t_3 = __pyx_t_2; + for (__pyx_t_4 = 0; __pyx_t_4 < __pyx_t_3; __pyx_t_4+=1) { + __pyx_v_dim = __pyx_t_4; + + /* "View.MemoryView":1076 + * + * for dim in range(memview.view.ndim): + * dst.shape[dim] = shape[dim] # <<<<<<<<<<<<<< + * dst.strides[dim] = strides[dim] + * dst.suboffsets[dim] = suboffsets[dim] if suboffsets else -1 +*/ + (__pyx_v_dst->shape[__pyx_v_dim]) = (__pyx_v_shape[__pyx_v_dim]); + + /* "View.MemoryView":1077 + * for dim in range(memview.view.ndim): + * dst.shape[dim] = shape[dim] + * dst.strides[dim] = strides[dim] # <<<<<<<<<<<<<< + * dst.suboffsets[dim] = suboffsets[dim] if suboffsets else -1 + * +*/ + (__pyx_v_dst->strides[__pyx_v_dim]) = (__pyx_v_strides[__pyx_v_dim]); + + /* "View.MemoryView":1078 + * dst.shape[dim] = shape[dim] + * dst.strides[dim] = strides[dim] + * dst.suboffsets[dim] = suboffsets[dim] if suboffsets else -1 # <<<<<<<<<<<<<< + * + * @cname('__pyx_memoryview_copy_object') +*/ + __pyx_t_6 = (__pyx_v_suboffsets != 0); + if (__pyx_t_6) { + __pyx_t_5 = (__pyx_v_suboffsets[__pyx_v_dim]); + } else { + __pyx_t_5 = -1L; + } + (__pyx_v_dst->suboffsets[__pyx_v_dim]) = __pyx_t_5; + } + + /* "View.MemoryView":1063 + * return mslice + * + * @cname('__pyx_memoryview_slice_copy') # <<<<<<<<<<<<<< + * cdef void slice_copy(memoryview memview, __Pyx_memviewslice *dst) noexcept: + * cdef int dim +*/ + + /* function exit code */ +} + +/* "View.MemoryView":1080 + * dst.suboffsets[dim] = suboffsets[dim] if suboffsets else -1 + * + * @cname('__pyx_memoryview_copy_object') # <<<<<<<<<<<<<< + * cdef memoryview_copy(memoryview memview): + * "Create a new memoryview object" +*/ + +static PyObject *__pyx_memoryview_copy_object(struct __pyx_memoryview_obj *__pyx_v_memview) { + __Pyx_memviewslice __pyx_v_memviewslice; + 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("memoryview_copy", 0); + + /* "View.MemoryView":1084 + * "Create a new memoryview object" + * cdef __Pyx_memviewslice memviewslice + * slice_copy(memview, &memviewslice) # <<<<<<<<<<<<<< + * return memoryview_copy_from_slice(memview, &memviewslice) + * +*/ + __pyx_memoryview_slice_copy(__pyx_v_memview, (&__pyx_v_memviewslice)); + + /* "View.MemoryView":1085 + * cdef __Pyx_memviewslice memviewslice + * slice_copy(memview, &memviewslice) + * return memoryview_copy_from_slice(memview, &memviewslice) # <<<<<<<<<<<<<< + * + * @cname('__pyx_memoryview_copy_object_from_slice') +*/ + __Pyx_XDECREF(__pyx_r); + __pyx_t_1 = __pyx_memoryview_copy_object_from_slice(__pyx_v_memview, (&__pyx_v_memviewslice)); if (unlikely(!__pyx_t_1)) __PYX_ERR(1, 1085, __pyx_L1_error) + __Pyx_GOTREF(__pyx_t_1); + __pyx_r = __pyx_t_1; + __pyx_t_1 = 0; + goto __pyx_L0; + + /* "View.MemoryView":1080 + * dst.suboffsets[dim] = suboffsets[dim] if suboffsets else -1 + * + * @cname('__pyx_memoryview_copy_object') # <<<<<<<<<<<<<< + * cdef memoryview_copy(memoryview memview): + * "Create a new memoryview object" +*/ + + /* function exit code */ + __pyx_L1_error:; + __Pyx_XDECREF(__pyx_t_1); + __Pyx_AddTraceback("View.MemoryView.memoryview_copy", __pyx_clineno, __pyx_lineno, __pyx_filename); + __pyx_r = 0; + __pyx_L0:; + __Pyx_XGIVEREF(__pyx_r); + __Pyx_RefNannyFinishContext(); + return __pyx_r; +} + +/* "View.MemoryView":1087 + * return memoryview_copy_from_slice(memview, &memviewslice) + * + * @cname('__pyx_memoryview_copy_object_from_slice') # <<<<<<<<<<<<<< + * cdef memoryview_copy_from_slice(memoryview memview, __Pyx_memviewslice *memviewslice): + * """ +*/ + +static PyObject *__pyx_memoryview_copy_object_from_slice(struct __pyx_memoryview_obj *__pyx_v_memview, __Pyx_memviewslice *__pyx_v_memviewslice) { + PyObject *(*__pyx_v_to_object_func)(char *); + int (*__pyx_v_to_dtype_func)(char *, PyObject *); + PyObject *__pyx_r = NULL; + __Pyx_RefNannyDeclarations + int __pyx_t_1; + PyObject *(*__pyx_t_2)(char *); + int (*__pyx_t_3)(char *, PyObject *); + PyObject *__pyx_t_4 = NULL; + int __pyx_lineno = 0; + const char *__pyx_filename = NULL; + int __pyx_clineno = 0; + __Pyx_RefNannySetupContext("memoryview_copy_from_slice", 0); + + /* "View.MemoryView":1095 + * cdef int (*to_dtype_func)(char *, object) except 0 + * + * if isinstance(memview, _memoryviewslice): # <<<<<<<<<<<<<< + * to_object_func = (<_memoryviewslice> memview).to_object_func + * to_dtype_func = (<_memoryviewslice> memview).to_dtype_func +*/ + __pyx_t_1 = __Pyx_TypeCheck(((PyObject *)__pyx_v_memview), __pyx_mstate_global->__pyx_memoryviewslice_type); + if (__pyx_t_1) { + + /* "View.MemoryView":1096 + * + * if isinstance(memview, _memoryviewslice): + * to_object_func = (<_memoryviewslice> memview).to_object_func # <<<<<<<<<<<<<< + * to_dtype_func = (<_memoryviewslice> memview).to_dtype_func + * else: +*/ + __pyx_t_2 = ((struct __pyx_memoryviewslice_obj *)__pyx_v_memview)->to_object_func; + __pyx_v_to_object_func = __pyx_t_2; + + /* "View.MemoryView":1097 + * if isinstance(memview, _memoryviewslice): + * to_object_func = (<_memoryviewslice> memview).to_object_func + * to_dtype_func = (<_memoryviewslice> memview).to_dtype_func # <<<<<<<<<<<<<< + * else: + * to_object_func = NULL +*/ + __pyx_t_3 = ((struct __pyx_memoryviewslice_obj *)__pyx_v_memview)->to_dtype_func; + __pyx_v_to_dtype_func = __pyx_t_3; + + /* "View.MemoryView":1095 + * cdef int (*to_dtype_func)(char *, object) except 0 + * + * if isinstance(memview, _memoryviewslice): # <<<<<<<<<<<<<< + * to_object_func = (<_memoryviewslice> memview).to_object_func + * to_dtype_func = (<_memoryviewslice> memview).to_dtype_func +*/ + goto __pyx_L3; + } + + /* "View.MemoryView":1099 + * to_dtype_func = (<_memoryviewslice> memview).to_dtype_func + * else: + * to_object_func = NULL # <<<<<<<<<<<<<< + * to_dtype_func = NULL + * +*/ + /*else*/ { + __pyx_v_to_object_func = NULL; + + /* "View.MemoryView":1100 + * else: + * to_object_func = NULL + * to_dtype_func = NULL # <<<<<<<<<<<<<< + * + * return memoryview_fromslice(memviewslice[0], memview.view.ndim, +*/ + __pyx_v_to_dtype_func = NULL; + } + __pyx_L3:; + + /* "View.MemoryView":1102 + * to_dtype_func = NULL + * + * return memoryview_fromslice(memviewslice[0], memview.view.ndim, # <<<<<<<<<<<<<< + * to_object_func, to_dtype_func, + * memview.dtype_is_object) +*/ + __Pyx_XDECREF(__pyx_r); + + /* "View.MemoryView":1104 + * return memoryview_fromslice(memviewslice[0], memview.view.ndim, + * to_object_func, to_dtype_func, + * memview.dtype_is_object) # <<<<<<<<<<<<<< + * + * +*/ + __pyx_t_4 = __pyx_memoryview_fromslice((__pyx_v_memviewslice[0]), __pyx_v_memview->view.ndim, __pyx_v_to_object_func, __pyx_v_to_dtype_func, __pyx_v_memview->dtype_is_object); if (unlikely(!__pyx_t_4)) __PYX_ERR(1, 1102, __pyx_L1_error) + __Pyx_GOTREF(__pyx_t_4); + __pyx_r = __pyx_t_4; + __pyx_t_4 = 0; + goto __pyx_L0; + + /* "View.MemoryView":1087 + * return memoryview_copy_from_slice(memview, &memviewslice) + * + * @cname('__pyx_memoryview_copy_object_from_slice') # <<<<<<<<<<<<<< + * cdef memoryview_copy_from_slice(memoryview memview, __Pyx_memviewslice *memviewslice): + * """ +*/ + + /* function exit code */ + __pyx_L1_error:; + __Pyx_XDECREF(__pyx_t_4); + __Pyx_AddTraceback("View.MemoryView.memoryview_copy_from_slice", __pyx_clineno, __pyx_lineno, __pyx_filename); + __pyx_r = 0; + __pyx_L0:; + __Pyx_XGIVEREF(__pyx_r); + __Pyx_RefNannyFinishContext(); + return __pyx_r; +} + +/* "View.MemoryView":1110 + * + * + * cdef Py_ssize_t abs_py_ssize_t(Py_ssize_t arg) noexcept nogil: # <<<<<<<<<<<<<< + * return -arg if arg < 0 else arg + * +*/ + +static Py_ssize_t abs_py_ssize_t(Py_ssize_t __pyx_v_arg) { + Py_ssize_t __pyx_r; + Py_ssize_t __pyx_t_1; + int __pyx_t_2; + + /* "View.MemoryView":1111 + * + * cdef Py_ssize_t abs_py_ssize_t(Py_ssize_t arg) noexcept nogil: + * return -arg if arg < 0 else arg # <<<<<<<<<<<<<< + * + * @cname('__pyx_get_best_slice_order') +*/ + __pyx_t_2 = (__pyx_v_arg < 0); + if (__pyx_t_2) { + __pyx_t_1 = (-__pyx_v_arg); + } else { + __pyx_t_1 = __pyx_v_arg; + } + __pyx_r = __pyx_t_1; + goto __pyx_L0; + + /* "View.MemoryView":1110 + * + * + * cdef Py_ssize_t abs_py_ssize_t(Py_ssize_t arg) noexcept nogil: # <<<<<<<<<<<<<< + * return -arg if arg < 0 else arg + * +*/ + + /* function exit code */ + __pyx_L0:; + return __pyx_r; +} + +/* "View.MemoryView":1113 + * return -arg if arg < 0 else arg + * + * @cname('__pyx_get_best_slice_order') # <<<<<<<<<<<<<< + * cdef char get_best_order(__Pyx_memviewslice *mslice, int ndim) noexcept nogil: + * """ +*/ + +static char __pyx_get_best_slice_order(__Pyx_memviewslice *__pyx_v_mslice, int __pyx_v_ndim) { + int __pyx_v_i; + Py_ssize_t __pyx_v_c_stride; + Py_ssize_t __pyx_v_f_stride; + char __pyx_r; + int __pyx_t_1; + int __pyx_t_2; + int __pyx_t_3; + int __pyx_t_4; + + /* "View.MemoryView":1119 + * """ + * cdef int i + * cdef Py_ssize_t c_stride = 0 # <<<<<<<<<<<<<< + * cdef Py_ssize_t f_stride = 0 + * +*/ + __pyx_v_c_stride = 0; + + /* "View.MemoryView":1120 + * cdef int i + * cdef Py_ssize_t c_stride = 0 + * cdef Py_ssize_t f_stride = 0 # <<<<<<<<<<<<<< + * + * for i in range(ndim - 1, -1, -1): +*/ + __pyx_v_f_stride = 0; + + /* "View.MemoryView":1122 + * cdef Py_ssize_t f_stride = 0 + * + * for i in range(ndim - 1, -1, -1): # <<<<<<<<<<<<<< + * if mslice.shape[i] > 1: + * c_stride = mslice.strides[i] +*/ + for (__pyx_t_1 = (__pyx_v_ndim - 1); __pyx_t_1 > -1; __pyx_t_1-=1) { + __pyx_v_i = __pyx_t_1; + + /* "View.MemoryView":1123 + * + * for i in range(ndim - 1, -1, -1): + * if mslice.shape[i] > 1: # <<<<<<<<<<<<<< + * c_stride = mslice.strides[i] + * break +*/ + __pyx_t_2 = ((__pyx_v_mslice->shape[__pyx_v_i]) > 1); + if (__pyx_t_2) { + + /* "View.MemoryView":1124 + * for i in range(ndim - 1, -1, -1): + * if mslice.shape[i] > 1: + * c_stride = mslice.strides[i] # <<<<<<<<<<<<<< + * break + * +*/ + __pyx_v_c_stride = (__pyx_v_mslice->strides[__pyx_v_i]); + + /* "View.MemoryView":1125 + * if mslice.shape[i] > 1: + * c_stride = mslice.strides[i] + * break # <<<<<<<<<<<<<< + * + * for i in range(ndim): +*/ + goto __pyx_L4_break; + + /* "View.MemoryView":1123 + * + * for i in range(ndim - 1, -1, -1): + * if mslice.shape[i] > 1: # <<<<<<<<<<<<<< + * c_stride = mslice.strides[i] + * break +*/ + } + } + __pyx_L4_break:; + + /* "View.MemoryView":1127 + * break + * + * for i in range(ndim): # <<<<<<<<<<<<<< + * if mslice.shape[i] > 1: + * f_stride = mslice.strides[i] +*/ + __pyx_t_1 = __pyx_v_ndim; + __pyx_t_3 = __pyx_t_1; + for (__pyx_t_4 = 0; __pyx_t_4 < __pyx_t_3; __pyx_t_4+=1) { + __pyx_v_i = __pyx_t_4; + + /* "View.MemoryView":1128 + * + * for i in range(ndim): + * if mslice.shape[i] > 1: # <<<<<<<<<<<<<< + * f_stride = mslice.strides[i] + * break +*/ + __pyx_t_2 = ((__pyx_v_mslice->shape[__pyx_v_i]) > 1); + if (__pyx_t_2) { + + /* "View.MemoryView":1129 + * for i in range(ndim): + * if mslice.shape[i] > 1: + * f_stride = mslice.strides[i] # <<<<<<<<<<<<<< + * break + * +*/ + __pyx_v_f_stride = (__pyx_v_mslice->strides[__pyx_v_i]); + + /* "View.MemoryView":1130 + * if mslice.shape[i] > 1: + * f_stride = mslice.strides[i] + * break # <<<<<<<<<<<<<< + * + * if abs_py_ssize_t(c_stride) <= abs_py_ssize_t(f_stride): +*/ + goto __pyx_L7_break; + + /* "View.MemoryView":1128 + * + * for i in range(ndim): + * if mslice.shape[i] > 1: # <<<<<<<<<<<<<< + * f_stride = mslice.strides[i] + * break +*/ + } + } + __pyx_L7_break:; + + /* "View.MemoryView":1132 + * break + * + * if abs_py_ssize_t(c_stride) <= abs_py_ssize_t(f_stride): # <<<<<<<<<<<<<< + * return 'C' + * else: +*/ + __pyx_t_2 = (abs_py_ssize_t(__pyx_v_c_stride) <= abs_py_ssize_t(__pyx_v_f_stride)); + if (__pyx_t_2) { + + /* "View.MemoryView":1133 + * + * if abs_py_ssize_t(c_stride) <= abs_py_ssize_t(f_stride): + * return 'C' # <<<<<<<<<<<<<< + * else: + * return 'F' +*/ + __pyx_r = 'C'; + goto __pyx_L0; + + /* "View.MemoryView":1132 + * break + * + * if abs_py_ssize_t(c_stride) <= abs_py_ssize_t(f_stride): # <<<<<<<<<<<<<< + * return 'C' + * else: +*/ + } + + /* "View.MemoryView":1135 + * return 'C' + * else: + * return 'F' # <<<<<<<<<<<<<< + * + * @cython.cdivision(True) +*/ + /*else*/ { + __pyx_r = 'F'; + goto __pyx_L0; + } + + /* "View.MemoryView":1113 + * return -arg if arg < 0 else arg + * + * @cname('__pyx_get_best_slice_order') # <<<<<<<<<<<<<< + * cdef char get_best_order(__Pyx_memviewslice *mslice, int ndim) noexcept nogil: + * """ +*/ + + /* function exit code */ + __pyx_L0:; + return __pyx_r; +} + +/* "View.MemoryView":1137 + * return 'F' + * + * @cython.cdivision(True) # <<<<<<<<<<<<<< + * cdef void _copy_strided_to_strided(char *src_data, Py_ssize_t *src_strides, + * char *dst_data, Py_ssize_t *dst_strides, +*/ + +static void _copy_strided_to_strided(char *__pyx_v_src_data, Py_ssize_t *__pyx_v_src_strides, char *__pyx_v_dst_data, Py_ssize_t *__pyx_v_dst_strides, Py_ssize_t *__pyx_v_src_shape, Py_ssize_t *__pyx_v_dst_shape, int __pyx_v_ndim, size_t __pyx_v_itemsize) { + CYTHON_UNUSED Py_ssize_t __pyx_v_i; + CYTHON_UNUSED Py_ssize_t __pyx_v_src_extent; + Py_ssize_t __pyx_v_dst_extent; + Py_ssize_t __pyx_v_src_stride; + Py_ssize_t __pyx_v_dst_stride; + int __pyx_t_1; + int __pyx_t_2; + Py_ssize_t __pyx_t_3; + Py_ssize_t __pyx_t_4; + Py_ssize_t __pyx_t_5; + + /* "View.MemoryView":1145 + * + * cdef Py_ssize_t i + * cdef Py_ssize_t src_extent = src_shape[0] # <<<<<<<<<<<<<< + * cdef Py_ssize_t dst_extent = dst_shape[0] + * cdef Py_ssize_t src_stride = src_strides[0] +*/ + __pyx_v_src_extent = (__pyx_v_src_shape[0]); + + /* "View.MemoryView":1146 + * cdef Py_ssize_t i + * cdef Py_ssize_t src_extent = src_shape[0] + * cdef Py_ssize_t dst_extent = dst_shape[0] # <<<<<<<<<<<<<< + * cdef Py_ssize_t src_stride = src_strides[0] + * cdef Py_ssize_t dst_stride = dst_strides[0] +*/ + __pyx_v_dst_extent = (__pyx_v_dst_shape[0]); + + /* "View.MemoryView":1147 + * cdef Py_ssize_t src_extent = src_shape[0] + * cdef Py_ssize_t dst_extent = dst_shape[0] + * cdef Py_ssize_t src_stride = src_strides[0] # <<<<<<<<<<<<<< + * cdef Py_ssize_t dst_stride = dst_strides[0] + * +*/ + __pyx_v_src_stride = (__pyx_v_src_strides[0]); + + /* "View.MemoryView":1148 + * cdef Py_ssize_t dst_extent = dst_shape[0] + * cdef Py_ssize_t src_stride = src_strides[0] + * cdef Py_ssize_t dst_stride = dst_strides[0] # <<<<<<<<<<<<<< + * + * if ndim == 1: +*/ + __pyx_v_dst_stride = (__pyx_v_dst_strides[0]); + + /* "View.MemoryView":1150 + * cdef Py_ssize_t dst_stride = dst_strides[0] + * + * if ndim == 1: # <<<<<<<<<<<<<< + * if (src_stride > 0 and dst_stride > 0 and + * src_stride == itemsize == dst_stride): +*/ + __pyx_t_1 = (__pyx_v_ndim == 1); + if (__pyx_t_1) { + + /* "View.MemoryView":1151 + * + * if ndim == 1: + * if (src_stride > 0 and dst_stride > 0 and # <<<<<<<<<<<<<< + * src_stride == itemsize == dst_stride): + * memcpy(dst_data, src_data, itemsize * dst_extent) +*/ + __pyx_t_2 = (__pyx_v_src_stride > 0); + if (__pyx_t_2) { + } else { + __pyx_t_1 = __pyx_t_2; + goto __pyx_L5_bool_binop_done; + } + __pyx_t_2 = (__pyx_v_dst_stride > 0); + if (__pyx_t_2) { + } else { + __pyx_t_1 = __pyx_t_2; + goto __pyx_L5_bool_binop_done; + } + + /* "View.MemoryView":1152 + * if ndim == 1: + * if (src_stride > 0 and dst_stride > 0 and + * src_stride == itemsize == dst_stride): # <<<<<<<<<<<<<< + * memcpy(dst_data, src_data, itemsize * dst_extent) + * else: +*/ + __pyx_t_2 = (((size_t)__pyx_v_src_stride) == __pyx_v_itemsize); + if (__pyx_t_2) { + __pyx_t_2 = (__pyx_v_itemsize == ((size_t)__pyx_v_dst_stride)); + } + __pyx_t_1 = __pyx_t_2; + __pyx_L5_bool_binop_done:; + + /* "View.MemoryView":1151 + * + * if ndim == 1: + * if (src_stride > 0 and dst_stride > 0 and # <<<<<<<<<<<<<< + * src_stride == itemsize == dst_stride): + * memcpy(dst_data, src_data, itemsize * dst_extent) +*/ + if (__pyx_t_1) { + + /* "View.MemoryView":1153 + * if (src_stride > 0 and dst_stride > 0 and + * src_stride == itemsize == dst_stride): + * memcpy(dst_data, src_data, itemsize * dst_extent) # <<<<<<<<<<<<<< + * else: + * for i in range(dst_extent): +*/ + (void)(memcpy(__pyx_v_dst_data, __pyx_v_src_data, (__pyx_v_itemsize * __pyx_v_dst_extent))); + + /* "View.MemoryView":1151 + * + * if ndim == 1: + * if (src_stride > 0 and dst_stride > 0 and # <<<<<<<<<<<<<< + * src_stride == itemsize == dst_stride): + * memcpy(dst_data, src_data, itemsize * dst_extent) +*/ + goto __pyx_L4; + } + + /* "View.MemoryView":1155 + * memcpy(dst_data, src_data, itemsize * dst_extent) + * else: + * for i in range(dst_extent): # <<<<<<<<<<<<<< + * memcpy(dst_data, src_data, itemsize) + * src_data += src_stride +*/ + /*else*/ { + __pyx_t_3 = __pyx_v_dst_extent; + __pyx_t_4 = __pyx_t_3; + for (__pyx_t_5 = 0; __pyx_t_5 < __pyx_t_4; __pyx_t_5+=1) { + __pyx_v_i = __pyx_t_5; + + /* "View.MemoryView":1156 + * else: + * for i in range(dst_extent): + * memcpy(dst_data, src_data, itemsize) # <<<<<<<<<<<<<< + * src_data += src_stride + * dst_data += dst_stride +*/ + (void)(memcpy(__pyx_v_dst_data, __pyx_v_src_data, __pyx_v_itemsize)); + + /* "View.MemoryView":1157 + * for i in range(dst_extent): + * memcpy(dst_data, src_data, itemsize) + * src_data += src_stride # <<<<<<<<<<<<<< + * dst_data += dst_stride + * else: +*/ + __pyx_v_src_data = (__pyx_v_src_data + __pyx_v_src_stride); + + /* "View.MemoryView":1158 + * memcpy(dst_data, src_data, itemsize) + * src_data += src_stride + * dst_data += dst_stride # <<<<<<<<<<<<<< + * else: + * for i in range(dst_extent): +*/ + __pyx_v_dst_data = (__pyx_v_dst_data + __pyx_v_dst_stride); + } + } + __pyx_L4:; + + /* "View.MemoryView":1150 + * cdef Py_ssize_t dst_stride = dst_strides[0] + * + * if ndim == 1: # <<<<<<<<<<<<<< + * if (src_stride > 0 and dst_stride > 0 and + * src_stride == itemsize == dst_stride): +*/ + goto __pyx_L3; + } + + /* "View.MemoryView":1160 + * dst_data += dst_stride + * else: + * for i in range(dst_extent): # <<<<<<<<<<<<<< + * _copy_strided_to_strided(src_data, src_strides + 1, + * dst_data, dst_strides + 1, +*/ + /*else*/ { + __pyx_t_3 = __pyx_v_dst_extent; + __pyx_t_4 = __pyx_t_3; + for (__pyx_t_5 = 0; __pyx_t_5 < __pyx_t_4; __pyx_t_5+=1) { + __pyx_v_i = __pyx_t_5; + + /* "View.MemoryView":1161 + * else: + * for i in range(dst_extent): + * _copy_strided_to_strided(src_data, src_strides + 1, # <<<<<<<<<<<<<< + * dst_data, dst_strides + 1, + * src_shape + 1, dst_shape + 1, +*/ + _copy_strided_to_strided(__pyx_v_src_data, (__pyx_v_src_strides + 1), __pyx_v_dst_data, (__pyx_v_dst_strides + 1), (__pyx_v_src_shape + 1), (__pyx_v_dst_shape + 1), (__pyx_v_ndim - 1), __pyx_v_itemsize); + + /* "View.MemoryView":1165 + * src_shape + 1, dst_shape + 1, + * ndim - 1, itemsize) + * src_data += src_stride # <<<<<<<<<<<<<< + * dst_data += dst_stride + * +*/ + __pyx_v_src_data = (__pyx_v_src_data + __pyx_v_src_stride); + + /* "View.MemoryView":1166 + * ndim - 1, itemsize) + * src_data += src_stride + * dst_data += dst_stride # <<<<<<<<<<<<<< + * + * cdef void copy_strided_to_strided(__Pyx_memviewslice *src, +*/ + __pyx_v_dst_data = (__pyx_v_dst_data + __pyx_v_dst_stride); + } + } + __pyx_L3:; + + /* "View.MemoryView":1137 + * return 'F' + * + * @cython.cdivision(True) # <<<<<<<<<<<<<< + * cdef void _copy_strided_to_strided(char *src_data, Py_ssize_t *src_strides, + * char *dst_data, Py_ssize_t *dst_strides, +*/ + + /* function exit code */ +} + +/* "View.MemoryView":1168 + * dst_data += dst_stride + * + * cdef void copy_strided_to_strided(__Pyx_memviewslice *src, # <<<<<<<<<<<<<< + * __Pyx_memviewslice *dst, + * int ndim, size_t itemsize) noexcept nogil: +*/ + +static void copy_strided_to_strided(__Pyx_memviewslice *__pyx_v_src, __Pyx_memviewslice *__pyx_v_dst, int __pyx_v_ndim, size_t __pyx_v_itemsize) { + + /* "View.MemoryView":1171 + * __Pyx_memviewslice *dst, + * int ndim, size_t itemsize) noexcept nogil: + * _copy_strided_to_strided(src.data, src.strides, dst.data, dst.strides, # <<<<<<<<<<<<<< + * src.shape, dst.shape, ndim, itemsize) + * +*/ + _copy_strided_to_strided(__pyx_v_src->data, __pyx_v_src->strides, __pyx_v_dst->data, __pyx_v_dst->strides, __pyx_v_src->shape, __pyx_v_dst->shape, __pyx_v_ndim, __pyx_v_itemsize); + + /* "View.MemoryView":1168 + * dst_data += dst_stride + * + * cdef void copy_strided_to_strided(__Pyx_memviewslice *src, # <<<<<<<<<<<<<< + * __Pyx_memviewslice *dst, + * int ndim, size_t itemsize) noexcept nogil: +*/ + + /* function exit code */ +} + +/* "View.MemoryView":1174 + * src.shape, dst.shape, ndim, itemsize) + * + * @cname('__pyx_memoryview_slice_get_size') # <<<<<<<<<<<<<< + * cdef Py_ssize_t slice_get_size(__Pyx_memviewslice *src, int ndim) noexcept nogil: + * "Return the size of the memory occupied by the slice in number of bytes" +*/ + +static Py_ssize_t __pyx_memoryview_slice_get_size(__Pyx_memviewslice *__pyx_v_src, int __pyx_v_ndim) { + Py_ssize_t __pyx_v_shape; + Py_ssize_t __pyx_v_size; + Py_ssize_t __pyx_r; + Py_ssize_t __pyx_t_1; + Py_ssize_t *__pyx_t_2; + Py_ssize_t *__pyx_t_3; + Py_ssize_t *__pyx_t_4; + + /* "View.MemoryView":1177 + * cdef Py_ssize_t slice_get_size(__Pyx_memviewslice *src, int ndim) noexcept nogil: + * "Return the size of the memory occupied by the slice in number of bytes" + * cdef Py_ssize_t shape, size = src.memview.view.itemsize # <<<<<<<<<<<<<< + * + * for shape in src.shape[:ndim]: +*/ + __pyx_t_1 = __pyx_v_src->memview->view.itemsize; + __pyx_v_size = __pyx_t_1; + + /* "View.MemoryView":1179 + * cdef Py_ssize_t shape, size = src.memview.view.itemsize + * + * for shape in src.shape[:ndim]: # <<<<<<<<<<<<<< + * size *= shape + * +*/ + __pyx_t_3 = (__pyx_v_src->shape + __pyx_v_ndim); + for (__pyx_t_4 = __pyx_v_src->shape; __pyx_t_4 < __pyx_t_3; __pyx_t_4++) { + __pyx_t_2 = __pyx_t_4; + __pyx_v_shape = (__pyx_t_2[0]); + + /* "View.MemoryView":1180 + * + * for shape in src.shape[:ndim]: + * size *= shape # <<<<<<<<<<<<<< + * + * return size +*/ + __pyx_v_size = (__pyx_v_size * __pyx_v_shape); + } + + /* "View.MemoryView":1182 + * size *= shape + * + * return size # <<<<<<<<<<<<<< + * + * @cname('__pyx_fill_contig_strides_array') +*/ + __pyx_r = __pyx_v_size; + goto __pyx_L0; + + /* "View.MemoryView":1174 + * src.shape, dst.shape, ndim, itemsize) + * + * @cname('__pyx_memoryview_slice_get_size') # <<<<<<<<<<<<<< + * cdef Py_ssize_t slice_get_size(__Pyx_memviewslice *src, int ndim) noexcept nogil: + * "Return the size of the memory occupied by the slice in number of bytes" +*/ + + /* function exit code */ + __pyx_L0:; + return __pyx_r; +} + +/* "View.MemoryView":1184 + * return size + * + * @cname('__pyx_fill_contig_strides_array') # <<<<<<<<<<<<<< + * cdef Py_ssize_t fill_contig_strides_array( + * Py_ssize_t *shape, Py_ssize_t *strides, Py_ssize_t stride, +*/ + +static Py_ssize_t __pyx_fill_contig_strides_array(Py_ssize_t *__pyx_v_shape, Py_ssize_t *__pyx_v_strides, Py_ssize_t __pyx_v_stride, int __pyx_v_ndim, char __pyx_v_order) { + int __pyx_v_idx; + Py_ssize_t __pyx_r; + int __pyx_t_1; + int __pyx_t_2; + int __pyx_t_3; + int __pyx_t_4; + + /* "View.MemoryView":1194 + * cdef int idx + * + * if order == 'F': # <<<<<<<<<<<<<< + * for idx in range(ndim): + * strides[idx] = stride +*/ + __pyx_t_1 = (__pyx_v_order == 'F'); + if (__pyx_t_1) { + + /* "View.MemoryView":1195 + * + * if order == 'F': + * for idx in range(ndim): # <<<<<<<<<<<<<< + * strides[idx] = stride + * stride *= shape[idx] +*/ + __pyx_t_2 = __pyx_v_ndim; + __pyx_t_3 = __pyx_t_2; + for (__pyx_t_4 = 0; __pyx_t_4 < __pyx_t_3; __pyx_t_4+=1) { + __pyx_v_idx = __pyx_t_4; + + /* "View.MemoryView":1196 + * if order == 'F': + * for idx in range(ndim): + * strides[idx] = stride # <<<<<<<<<<<<<< + * stride *= shape[idx] + * else: +*/ + (__pyx_v_strides[__pyx_v_idx]) = __pyx_v_stride; + + /* "View.MemoryView":1197 + * for idx in range(ndim): + * strides[idx] = stride + * stride *= shape[idx] # <<<<<<<<<<<<<< + * else: + * for idx in range(ndim - 1, -1, -1): +*/ + __pyx_v_stride = (__pyx_v_stride * (__pyx_v_shape[__pyx_v_idx])); + } + + /* "View.MemoryView":1194 + * cdef int idx + * + * if order == 'F': # <<<<<<<<<<<<<< + * for idx in range(ndim): + * strides[idx] = stride +*/ + goto __pyx_L3; + } + + /* "View.MemoryView":1199 + * stride *= shape[idx] + * else: + * for idx in range(ndim - 1, -1, -1): # <<<<<<<<<<<<<< + * strides[idx] = stride + * stride *= shape[idx] +*/ + /*else*/ { + for (__pyx_t_2 = (__pyx_v_ndim - 1); __pyx_t_2 > -1; __pyx_t_2-=1) { + __pyx_v_idx = __pyx_t_2; + + /* "View.MemoryView":1200 + * else: + * for idx in range(ndim - 1, -1, -1): + * strides[idx] = stride # <<<<<<<<<<<<<< + * stride *= shape[idx] + * +*/ + (__pyx_v_strides[__pyx_v_idx]) = __pyx_v_stride; + + /* "View.MemoryView":1201 + * for idx in range(ndim - 1, -1, -1): + * strides[idx] = stride + * stride *= shape[idx] # <<<<<<<<<<<<<< + * + * return stride +*/ + __pyx_v_stride = (__pyx_v_stride * (__pyx_v_shape[__pyx_v_idx])); + } + } + __pyx_L3:; + + /* "View.MemoryView":1203 + * stride *= shape[idx] + * + * return stride # <<<<<<<<<<<<<< + * + * @cname('__pyx_memoryview_copy_data_to_temp') +*/ + __pyx_r = __pyx_v_stride; + goto __pyx_L0; + + /* "View.MemoryView":1184 + * return size + * + * @cname('__pyx_fill_contig_strides_array') # <<<<<<<<<<<<<< + * cdef Py_ssize_t fill_contig_strides_array( + * Py_ssize_t *shape, Py_ssize_t *strides, Py_ssize_t stride, +*/ + + /* function exit code */ + __pyx_L0:; + return __pyx_r; +} + +/* "View.MemoryView":1205 + * return stride + * + * @cname('__pyx_memoryview_copy_data_to_temp') # <<<<<<<<<<<<<< + * cdef void *copy_data_to_temp(__Pyx_memviewslice *src, + * __Pyx_memviewslice *tmpslice, +*/ + +static void *__pyx_memoryview_copy_data_to_temp(__Pyx_memviewslice *__pyx_v_src, __Pyx_memviewslice *__pyx_v_tmpslice, char __pyx_v_order, int __pyx_v_ndim) { + int __pyx_v_i; + void *__pyx_v_result; + size_t __pyx_v_itemsize; + size_t __pyx_v_size; + void *__pyx_r; + Py_ssize_t __pyx_t_1; + int __pyx_t_2; + int __pyx_t_3; + struct __pyx_memoryview_obj *__pyx_t_4; + int __pyx_t_5; + int __pyx_t_6; + int __pyx_lineno = 0; + const char *__pyx_filename = NULL; + int __pyx_clineno = 0; + PyGILState_STATE __pyx_gilstate_save; + + /* "View.MemoryView":1217 + * cdef void *result + * + * cdef size_t itemsize = src.memview.view.itemsize # <<<<<<<<<<<<<< + * cdef size_t size = slice_get_size(src, ndim) + * +*/ + __pyx_t_1 = __pyx_v_src->memview->view.itemsize; + __pyx_v_itemsize = __pyx_t_1; + + /* "View.MemoryView":1218 + * + * cdef size_t itemsize = src.memview.view.itemsize + * cdef size_t size = slice_get_size(src, ndim) # <<<<<<<<<<<<<< + * + * result = malloc(size) +*/ + __pyx_v_size = __pyx_memoryview_slice_get_size(__pyx_v_src, __pyx_v_ndim); + + /* "View.MemoryView":1220 + * cdef size_t size = slice_get_size(src, ndim) + * + * result = malloc(size) # <<<<<<<<<<<<<< + * if not result: + * _err_no_memory() +*/ + __pyx_v_result = malloc(__pyx_v_size); + + /* "View.MemoryView":1221 + * + * result = malloc(size) + * if not result: # <<<<<<<<<<<<<< + * _err_no_memory() + * +*/ + __pyx_t_2 = (!(__pyx_v_result != 0)); + if (__pyx_t_2) { + + /* "View.MemoryView":1222 + * result = malloc(size) + * if not result: + * _err_no_memory() # <<<<<<<<<<<<<< + * + * +*/ + __pyx_t_3 = __pyx_memoryview_err_no_memory(); if (unlikely(__pyx_t_3 == ((int)-1))) __PYX_ERR(1, 1222, __pyx_L1_error) + + /* "View.MemoryView":1221 + * + * result = malloc(size) + * if not result: # <<<<<<<<<<<<<< + * _err_no_memory() + * +*/ + } + + /* "View.MemoryView":1225 + * + * + * tmpslice.data = result # <<<<<<<<<<<<<< + * tmpslice.memview = src.memview + * for i in range(ndim): +*/ + __pyx_v_tmpslice->data = ((char *)__pyx_v_result); + + /* "View.MemoryView":1226 + * + * tmpslice.data = result + * tmpslice.memview = src.memview # <<<<<<<<<<<<<< + * for i in range(ndim): + * tmpslice.shape[i] = src.shape[i] +*/ + __pyx_t_4 = __pyx_v_src->memview; + __pyx_v_tmpslice->memview = __pyx_t_4; + + /* "View.MemoryView":1227 + * tmpslice.data = result + * tmpslice.memview = src.memview + * for i in range(ndim): # <<<<<<<<<<<<<< + * tmpslice.shape[i] = src.shape[i] + * tmpslice.suboffsets[i] = -1 +*/ + __pyx_t_3 = __pyx_v_ndim; + __pyx_t_5 = __pyx_t_3; + for (__pyx_t_6 = 0; __pyx_t_6 < __pyx_t_5; __pyx_t_6+=1) { + __pyx_v_i = __pyx_t_6; + + /* "View.MemoryView":1228 + * tmpslice.memview = src.memview + * for i in range(ndim): + * tmpslice.shape[i] = src.shape[i] # <<<<<<<<<<<<<< + * tmpslice.suboffsets[i] = -1 + * +*/ + (__pyx_v_tmpslice->shape[__pyx_v_i]) = (__pyx_v_src->shape[__pyx_v_i]); + + /* "View.MemoryView":1229 + * for i in range(ndim): + * tmpslice.shape[i] = src.shape[i] + * tmpslice.suboffsets[i] = -1 # <<<<<<<<<<<<<< + * + * fill_contig_strides_array(&tmpslice.shape[0], &tmpslice.strides[0], itemsize, ndim, order) +*/ + (__pyx_v_tmpslice->suboffsets[__pyx_v_i]) = -1L; + } + + /* "View.MemoryView":1231 + * tmpslice.suboffsets[i] = -1 + * + * fill_contig_strides_array(&tmpslice.shape[0], &tmpslice.strides[0], itemsize, ndim, order) # <<<<<<<<<<<<<< + * + * +*/ + (void)(__pyx_fill_contig_strides_array((&(__pyx_v_tmpslice->shape[0])), (&(__pyx_v_tmpslice->strides[0])), __pyx_v_itemsize, __pyx_v_ndim, __pyx_v_order)); + + /* "View.MemoryView":1234 + * + * + * for i in range(ndim): # <<<<<<<<<<<<<< + * if tmpslice.shape[i] == 1: + * tmpslice.strides[i] = 0 +*/ + __pyx_t_3 = __pyx_v_ndim; + __pyx_t_5 = __pyx_t_3; + for (__pyx_t_6 = 0; __pyx_t_6 < __pyx_t_5; __pyx_t_6+=1) { + __pyx_v_i = __pyx_t_6; + + /* "View.MemoryView":1235 + * + * for i in range(ndim): + * if tmpslice.shape[i] == 1: # <<<<<<<<<<<<<< + * tmpslice.strides[i] = 0 + * +*/ + __pyx_t_2 = ((__pyx_v_tmpslice->shape[__pyx_v_i]) == 1); + if (__pyx_t_2) { + + /* "View.MemoryView":1236 + * for i in range(ndim): + * if tmpslice.shape[i] == 1: + * tmpslice.strides[i] = 0 # <<<<<<<<<<<<<< + * + * if slice_is_contig(src[0], order, ndim): +*/ + (__pyx_v_tmpslice->strides[__pyx_v_i]) = 0; + + /* "View.MemoryView":1235 + * + * for i in range(ndim): + * if tmpslice.shape[i] == 1: # <<<<<<<<<<<<<< + * tmpslice.strides[i] = 0 + * +*/ + } + } + + /* "View.MemoryView":1238 + * tmpslice.strides[i] = 0 + * + * if slice_is_contig(src[0], order, ndim): # <<<<<<<<<<<<<< + * memcpy(result, src.data, size) + * else: +*/ + __pyx_t_2 = __pyx_memviewslice_is_contig((__pyx_v_src[0]), __pyx_v_order, __pyx_v_ndim); + if (__pyx_t_2) { + + /* "View.MemoryView":1239 + * + * if slice_is_contig(src[0], order, ndim): + * memcpy(result, src.data, size) # <<<<<<<<<<<<<< + * else: + * copy_strided_to_strided(src, tmpslice, ndim, itemsize) +*/ + (void)(memcpy(__pyx_v_result, __pyx_v_src->data, __pyx_v_size)); + + /* "View.MemoryView":1238 + * tmpslice.strides[i] = 0 + * + * if slice_is_contig(src[0], order, ndim): # <<<<<<<<<<<<<< + * memcpy(result, src.data, size) + * else: +*/ + goto __pyx_L9; + } + + /* "View.MemoryView":1241 + * memcpy(result, src.data, size) + * else: + * copy_strided_to_strided(src, tmpslice, ndim, itemsize) # <<<<<<<<<<<<<< + * + * return result +*/ + /*else*/ { + copy_strided_to_strided(__pyx_v_src, __pyx_v_tmpslice, __pyx_v_ndim, __pyx_v_itemsize); + } + __pyx_L9:; + + /* "View.MemoryView":1243 + * copy_strided_to_strided(src, tmpslice, ndim, itemsize) + * + * return result # <<<<<<<<<<<<<< + * + * +*/ + __pyx_r = __pyx_v_result; + goto __pyx_L0; + + /* "View.MemoryView":1205 + * return stride + * + * @cname('__pyx_memoryview_copy_data_to_temp') # <<<<<<<<<<<<<< + * cdef void *copy_data_to_temp(__Pyx_memviewslice *src, + * __Pyx_memviewslice *tmpslice, +*/ + + /* function exit code */ + __pyx_L1_error:; + __pyx_gilstate_save = __Pyx_PyGILState_Ensure(); + __Pyx_AddTraceback("View.MemoryView.copy_data_to_temp", __pyx_clineno, __pyx_lineno, __pyx_filename); + __pyx_r = NULL; + __Pyx_PyGILState_Release(__pyx_gilstate_save); + __pyx_L0:; + return __pyx_r; +} + +/* "View.MemoryView":1247 + * + * + * @cname('__pyx_memoryview_err_extents') # <<<<<<<<<<<<<< + * cdef int _err_extents(int i, Py_ssize_t extent1, + * Py_ssize_t extent2) except -1 with gil: +*/ + +static int __pyx_memoryview_err_extents(int __pyx_v_i, Py_ssize_t __pyx_v_extent1, Py_ssize_t __pyx_v_extent2) { + int __pyx_r; + __Pyx_RefNannyDeclarations + PyObject *__pyx_t_1 = NULL; + PyObject *__pyx_t_2 = NULL; + PyObject *__pyx_t_3 = NULL; + PyObject *__pyx_t_4[7]; + PyObject *__pyx_t_5 = NULL; + int __pyx_lineno = 0; + const char *__pyx_filename = NULL; + int __pyx_clineno = 0; + PyGILState_STATE __pyx_gilstate_save = __Pyx_PyGILState_Ensure(); + __Pyx_RefNannySetupContext("_err_extents", 0); + + /* "View.MemoryView":1250 + * cdef int _err_extents(int i, Py_ssize_t extent1, + * Py_ssize_t extent2) except -1 with gil: + * raise ValueError, f"got differing extents in dimension {i} (got {extent1} and {extent2})" # <<<<<<<<<<<<<< + * + * @cname('__pyx_memoryview_err_dim') +*/ + __pyx_t_1 = __Pyx_PyUnicode_From_int(__pyx_v_i, 0, ' ', 'd'); if (unlikely(!__pyx_t_1)) __PYX_ERR(1, 1250, __pyx_L1_error) + __Pyx_GOTREF(__pyx_t_1); + __pyx_t_2 = __Pyx_PyUnicode_From_Py_ssize_t(__pyx_v_extent1, 0, ' ', 'd'); if (unlikely(!__pyx_t_2)) __PYX_ERR(1, 1250, __pyx_L1_error) + __Pyx_GOTREF(__pyx_t_2); + __pyx_t_3 = __Pyx_PyUnicode_From_Py_ssize_t(__pyx_v_extent2, 0, ' ', 'd'); if (unlikely(!__pyx_t_3)) __PYX_ERR(1, 1250, __pyx_L1_error) + __Pyx_GOTREF(__pyx_t_3); + __pyx_t_4[0] = __pyx_mstate_global->__pyx_kp_u_got_differing_extents_in_dimensi; + __pyx_t_4[1] = __pyx_t_1; + __pyx_t_4[2] = __pyx_mstate_global->__pyx_kp_u_got; + __pyx_t_4[3] = __pyx_t_2; + __pyx_t_4[4] = __pyx_mstate_global->__pyx_kp_u_and; + __pyx_t_4[5] = __pyx_t_3; + __pyx_t_4[6] = __pyx_mstate_global->__pyx_kp_u__5; + __pyx_t_5 = __Pyx_PyUnicode_Join(__pyx_t_4, 7, 35 + __Pyx_PyUnicode_GET_LENGTH(__pyx_t_1) + 6 + __Pyx_PyUnicode_GET_LENGTH(__pyx_t_2) + 5 + __Pyx_PyUnicode_GET_LENGTH(__pyx_t_3) + 1, 127); + if (unlikely(!__pyx_t_5)) __PYX_ERR(1, 1250, __pyx_L1_error) + __Pyx_GOTREF(__pyx_t_5); + __Pyx_DECREF(__pyx_t_1); __pyx_t_1 = 0; + __Pyx_DECREF(__pyx_t_2); __pyx_t_2 = 0; + __Pyx_DECREF(__pyx_t_3); __pyx_t_3 = 0; + __Pyx_Raise(((PyObject *)(((PyTypeObject*)PyExc_ValueError))), __pyx_t_5, 0, 0); + __Pyx_DECREF(__pyx_t_5); __pyx_t_5 = 0; + __PYX_ERR(1, 1250, __pyx_L1_error) + + /* "View.MemoryView":1247 + * + * + * @cname('__pyx_memoryview_err_extents') # <<<<<<<<<<<<<< + * cdef int _err_extents(int i, Py_ssize_t extent1, + * Py_ssize_t extent2) except -1 with gil: +*/ + + /* function exit code */ + __pyx_L1_error:; + __Pyx_XDECREF(__pyx_t_1); + __Pyx_XDECREF(__pyx_t_2); + __Pyx_XDECREF(__pyx_t_3); + __Pyx_XDECREF(__pyx_t_5); + __Pyx_AddTraceback("View.MemoryView._err_extents", __pyx_clineno, __pyx_lineno, __pyx_filename); + __pyx_r = -1; + __Pyx_RefNannyFinishContext(); + __Pyx_PyGILState_Release(__pyx_gilstate_save); + return __pyx_r; +} + +/* "View.MemoryView":1252 + * raise ValueError, f"got differing extents in dimension {i} (got {extent1} and {extent2})" + * + * @cname('__pyx_memoryview_err_dim') # <<<<<<<<<<<<<< + * cdef int _err_dim(PyObject *error, str msg, int dim) except -1 with gil: + * raise error, msg % dim +*/ + +static int __pyx_memoryview_err_dim(PyObject *__pyx_v_error, PyObject *__pyx_v_msg, int __pyx_v_dim) { + int __pyx_r; + __Pyx_RefNannyDeclarations + PyObject *__pyx_t_1 = NULL; + PyObject *__pyx_t_2 = NULL; + int __pyx_lineno = 0; + const char *__pyx_filename = NULL; + int __pyx_clineno = 0; + PyGILState_STATE __pyx_gilstate_save = __Pyx_PyGILState_Ensure(); + __Pyx_RefNannySetupContext("_err_dim", 0); + __Pyx_INCREF(__pyx_v_msg); + + /* "View.MemoryView":1254 + * @cname('__pyx_memoryview_err_dim') + * cdef int _err_dim(PyObject *error, str msg, int dim) except -1 with gil: + * raise error, msg % dim # <<<<<<<<<<<<<< + * + * @cname('__pyx_memoryview_err') +*/ + __pyx_t_1 = __Pyx_PyLong_From_int(__pyx_v_dim); if (unlikely(!__pyx_t_1)) __PYX_ERR(1, 1254, __pyx_L1_error) + __Pyx_GOTREF(__pyx_t_1); + __pyx_t_2 = __Pyx_PyUnicode_FormatSafe(__pyx_v_msg, __pyx_t_1); if (unlikely(!__pyx_t_2)) __PYX_ERR(1, 1254, __pyx_L1_error) + __Pyx_GOTREF(__pyx_t_2); + __Pyx_DECREF(__pyx_t_1); __pyx_t_1 = 0; + __Pyx_Raise(((PyObject *)__pyx_v_error), __pyx_t_2, 0, 0); + __Pyx_DECREF(__pyx_t_2); __pyx_t_2 = 0; + __PYX_ERR(1, 1254, __pyx_L1_error) + + /* "View.MemoryView":1252 + * raise ValueError, f"got differing extents in dimension {i} (got {extent1} and {extent2})" + * + * @cname('__pyx_memoryview_err_dim') # <<<<<<<<<<<<<< + * cdef int _err_dim(PyObject *error, str msg, int dim) except -1 with gil: + * raise error, msg % dim +*/ + + /* function exit code */ + __pyx_L1_error:; + __Pyx_XDECREF(__pyx_t_1); + __Pyx_XDECREF(__pyx_t_2); + __Pyx_AddTraceback("View.MemoryView._err_dim", __pyx_clineno, __pyx_lineno, __pyx_filename); + __pyx_r = -1; + __Pyx_XDECREF(__pyx_v_msg); + __Pyx_RefNannyFinishContext(); + __Pyx_PyGILState_Release(__pyx_gilstate_save); + return __pyx_r; +} + +/* "View.MemoryView":1256 + * raise error, msg % dim + * + * @cname('__pyx_memoryview_err') # <<<<<<<<<<<<<< + * cdef int _err(PyObject *error, str msg) except -1 with gil: + * raise error, msg +*/ + +static int __pyx_memoryview_err(PyObject *__pyx_v_error, PyObject *__pyx_v_msg) { + int __pyx_r; + __Pyx_RefNannyDeclarations + int __pyx_lineno = 0; + const char *__pyx_filename = NULL; + int __pyx_clineno = 0; + PyGILState_STATE __pyx_gilstate_save = __Pyx_PyGILState_Ensure(); + __Pyx_RefNannySetupContext("_err", 0); + __Pyx_INCREF(__pyx_v_msg); + + /* "View.MemoryView":1258 + * @cname('__pyx_memoryview_err') + * cdef int _err(PyObject *error, str msg) except -1 with gil: + * raise error, msg # <<<<<<<<<<<<<< + * + * @cname('__pyx_memoryview_err_no_memory') +*/ + __Pyx_Raise(((PyObject *)__pyx_v_error), __pyx_v_msg, 0, 0); + __PYX_ERR(1, 1258, __pyx_L1_error) + + /* "View.MemoryView":1256 + * raise error, msg % dim + * + * @cname('__pyx_memoryview_err') # <<<<<<<<<<<<<< + * cdef int _err(PyObject *error, str msg) except -1 with gil: + * raise error, msg +*/ + + /* function exit code */ + __pyx_L1_error:; + __Pyx_AddTraceback("View.MemoryView._err", __pyx_clineno, __pyx_lineno, __pyx_filename); + __pyx_r = -1; + __Pyx_XDECREF(__pyx_v_msg); + __Pyx_RefNannyFinishContext(); + __Pyx_PyGILState_Release(__pyx_gilstate_save); + return __pyx_r; +} + +/* "View.MemoryView":1260 + * raise error, msg + * + * @cname('__pyx_memoryview_err_no_memory') # <<<<<<<<<<<<<< + * cdef int _err_no_memory() except -1 with gil: + * raise MemoryError +*/ + +static int __pyx_memoryview_err_no_memory(void) { + int __pyx_r; + int __pyx_lineno = 0; + const char *__pyx_filename = NULL; + int __pyx_clineno = 0; + PyGILState_STATE __pyx_gilstate_save = __Pyx_PyGILState_Ensure(); + + /* "View.MemoryView":1262 + * @cname('__pyx_memoryview_err_no_memory') + * cdef int _err_no_memory() except -1 with gil: + * raise MemoryError # <<<<<<<<<<<<<< + * + * +*/ + PyErr_NoMemory(); __PYX_ERR(1, 1262, __pyx_L1_error) + + /* "View.MemoryView":1260 + * raise error, msg + * + * @cname('__pyx_memoryview_err_no_memory') # <<<<<<<<<<<<<< + * cdef int _err_no_memory() except -1 with gil: + * raise MemoryError +*/ + + /* function exit code */ + __pyx_L1_error:; + __Pyx_AddTraceback("View.MemoryView._err_no_memory", __pyx_clineno, __pyx_lineno, __pyx_filename); + __pyx_r = -1; + __Pyx_PyGILState_Release(__pyx_gilstate_save); + return __pyx_r; +} + +/* "View.MemoryView":1265 + * + * + * @cname('__pyx_memoryview_copy_contents') # <<<<<<<<<<<<<< + * cdef int memoryview_copy_contents(__Pyx_memviewslice src, + * __Pyx_memviewslice dst, +*/ + +static int __pyx_memoryview_copy_contents(__Pyx_memviewslice __pyx_v_src, __Pyx_memviewslice __pyx_v_dst, int __pyx_v_src_ndim, int __pyx_v_dst_ndim, int __pyx_v_dtype_is_object) { + void *__pyx_v_tmpdata; + size_t __pyx_v_itemsize; + int __pyx_v_i; + char __pyx_v_order; + int __pyx_v_broadcasting; + int __pyx_v_direct_copy; + __Pyx_memviewslice __pyx_v_tmp; + int __pyx_v_ndim; + int __pyx_r; + Py_ssize_t __pyx_t_1; + int __pyx_t_2; + int __pyx_t_3; + int __pyx_t_4; + int __pyx_t_5; + int __pyx_t_6; + void *__pyx_t_7; + int __pyx_lineno = 0; + const char *__pyx_filename = NULL; + int __pyx_clineno = 0; + PyGILState_STATE __pyx_gilstate_save; + + /* "View.MemoryView":1274 + * Check for overlapping memory and verify the shapes. + * """ + * cdef void *tmpdata = NULL # <<<<<<<<<<<<<< + * cdef size_t itemsize = src.memview.view.itemsize + * cdef int i +*/ + __pyx_v_tmpdata = NULL; + + /* "View.MemoryView":1275 + * """ + * cdef void *tmpdata = NULL + * cdef size_t itemsize = src.memview.view.itemsize # <<<<<<<<<<<<<< + * cdef int i + * cdef char order = get_best_order(&src, src_ndim) +*/ + __pyx_t_1 = __pyx_v_src.memview->view.itemsize; + __pyx_v_itemsize = __pyx_t_1; + + /* "View.MemoryView":1277 + * cdef size_t itemsize = src.memview.view.itemsize + * cdef int i + * cdef char order = get_best_order(&src, src_ndim) # <<<<<<<<<<<<<< + * cdef bint broadcasting = False + * cdef bint direct_copy = False +*/ + __pyx_v_order = __pyx_get_best_slice_order((&__pyx_v_src), __pyx_v_src_ndim); + + /* "View.MemoryView":1278 + * cdef int i + * cdef char order = get_best_order(&src, src_ndim) + * cdef bint broadcasting = False # <<<<<<<<<<<<<< + * cdef bint direct_copy = False + * cdef __Pyx_memviewslice tmp +*/ + __pyx_v_broadcasting = 0; + + /* "View.MemoryView":1279 + * cdef char order = get_best_order(&src, src_ndim) + * cdef bint broadcasting = False + * cdef bint direct_copy = False # <<<<<<<<<<<<<< + * cdef __Pyx_memviewslice tmp + * +*/ + __pyx_v_direct_copy = 0; + + /* "View.MemoryView":1282 + * cdef __Pyx_memviewslice tmp + * + * if src_ndim < dst_ndim: # <<<<<<<<<<<<<< + * broadcast_leading(&src, src_ndim, dst_ndim) + * elif dst_ndim < src_ndim: +*/ + __pyx_t_2 = (__pyx_v_src_ndim < __pyx_v_dst_ndim); + if (__pyx_t_2) { + + /* "View.MemoryView":1283 + * + * if src_ndim < dst_ndim: + * broadcast_leading(&src, src_ndim, dst_ndim) # <<<<<<<<<<<<<< + * elif dst_ndim < src_ndim: + * broadcast_leading(&dst, dst_ndim, src_ndim) +*/ + __pyx_memoryview_broadcast_leading((&__pyx_v_src), __pyx_v_src_ndim, __pyx_v_dst_ndim); + + /* "View.MemoryView":1282 + * cdef __Pyx_memviewslice tmp + * + * if src_ndim < dst_ndim: # <<<<<<<<<<<<<< + * broadcast_leading(&src, src_ndim, dst_ndim) + * elif dst_ndim < src_ndim: +*/ + goto __pyx_L3; + } + + /* "View.MemoryView":1284 + * if src_ndim < dst_ndim: + * broadcast_leading(&src, src_ndim, dst_ndim) + * elif dst_ndim < src_ndim: # <<<<<<<<<<<<<< + * broadcast_leading(&dst, dst_ndim, src_ndim) + * +*/ + __pyx_t_2 = (__pyx_v_dst_ndim < __pyx_v_src_ndim); + if (__pyx_t_2) { + + /* "View.MemoryView":1285 + * broadcast_leading(&src, src_ndim, dst_ndim) + * elif dst_ndim < src_ndim: + * broadcast_leading(&dst, dst_ndim, src_ndim) # <<<<<<<<<<<<<< + * + * cdef int ndim = max(src_ndim, dst_ndim) +*/ + __pyx_memoryview_broadcast_leading((&__pyx_v_dst), __pyx_v_dst_ndim, __pyx_v_src_ndim); + + /* "View.MemoryView":1284 + * if src_ndim < dst_ndim: + * broadcast_leading(&src, src_ndim, dst_ndim) + * elif dst_ndim < src_ndim: # <<<<<<<<<<<<<< + * broadcast_leading(&dst, dst_ndim, src_ndim) + * +*/ + } + __pyx_L3:; + + /* "View.MemoryView":1287 + * broadcast_leading(&dst, dst_ndim, src_ndim) + * + * cdef int ndim = max(src_ndim, dst_ndim) # <<<<<<<<<<<<<< + * + * for i in range(ndim): +*/ + __pyx_t_3 = __pyx_v_dst_ndim; + __pyx_t_4 = __pyx_v_src_ndim; + __pyx_t_2 = (__pyx_t_3 > __pyx_t_4); + if (__pyx_t_2) { + __pyx_t_5 = __pyx_t_3; + } else { + __pyx_t_5 = __pyx_t_4; + } + __pyx_v_ndim = __pyx_t_5; + + /* "View.MemoryView":1289 + * cdef int ndim = max(src_ndim, dst_ndim) + * + * for i in range(ndim): # <<<<<<<<<<<<<< + * if src.shape[i] != dst.shape[i]: + * if src.shape[i] == 1: +*/ + __pyx_t_5 = __pyx_v_ndim; + __pyx_t_3 = __pyx_t_5; + for (__pyx_t_4 = 0; __pyx_t_4 < __pyx_t_3; __pyx_t_4+=1) { + __pyx_v_i = __pyx_t_4; + + /* "View.MemoryView":1290 + * + * for i in range(ndim): + * if src.shape[i] != dst.shape[i]: # <<<<<<<<<<<<<< + * if src.shape[i] == 1: + * broadcasting = True +*/ + __pyx_t_2 = ((__pyx_v_src.shape[__pyx_v_i]) != (__pyx_v_dst.shape[__pyx_v_i])); + if (__pyx_t_2) { + + /* "View.MemoryView":1291 + * for i in range(ndim): + * if src.shape[i] != dst.shape[i]: + * if src.shape[i] == 1: # <<<<<<<<<<<<<< + * broadcasting = True + * src.strides[i] = 0 +*/ + __pyx_t_2 = ((__pyx_v_src.shape[__pyx_v_i]) == 1); + if (__pyx_t_2) { + + /* "View.MemoryView":1292 + * if src.shape[i] != dst.shape[i]: + * if src.shape[i] == 1: + * broadcasting = True # <<<<<<<<<<<<<< + * src.strides[i] = 0 + * else: +*/ + __pyx_v_broadcasting = 1; + + /* "View.MemoryView":1293 + * if src.shape[i] == 1: + * broadcasting = True + * src.strides[i] = 0 # <<<<<<<<<<<<<< + * else: + * _err_extents(i, dst.shape[i], src.shape[i]) +*/ + (__pyx_v_src.strides[__pyx_v_i]) = 0; + + /* "View.MemoryView":1291 + * for i in range(ndim): + * if src.shape[i] != dst.shape[i]: + * if src.shape[i] == 1: # <<<<<<<<<<<<<< + * broadcasting = True + * src.strides[i] = 0 +*/ + goto __pyx_L7; + } + + /* "View.MemoryView":1295 + * src.strides[i] = 0 + * else: + * _err_extents(i, dst.shape[i], src.shape[i]) # <<<<<<<<<<<<<< + * + * if src.suboffsets[i] >= 0: +*/ + /*else*/ { + __pyx_t_6 = __pyx_memoryview_err_extents(__pyx_v_i, (__pyx_v_dst.shape[__pyx_v_i]), (__pyx_v_src.shape[__pyx_v_i])); if (unlikely(__pyx_t_6 == ((int)-1))) __PYX_ERR(1, 1295, __pyx_L1_error) + } + __pyx_L7:; + + /* "View.MemoryView":1290 + * + * for i in range(ndim): + * if src.shape[i] != dst.shape[i]: # <<<<<<<<<<<<<< + * if src.shape[i] == 1: + * broadcasting = True +*/ + } + + /* "View.MemoryView":1297 + * _err_extents(i, dst.shape[i], src.shape[i]) + * + * if src.suboffsets[i] >= 0: # <<<<<<<<<<<<<< + * _err_dim(PyExc_ValueError, "Dimension %d is not direct", i) + * +*/ + __pyx_t_2 = ((__pyx_v_src.suboffsets[__pyx_v_i]) >= 0); + if (__pyx_t_2) { + + /* "View.MemoryView":1298 + * + * if src.suboffsets[i] >= 0: + * _err_dim(PyExc_ValueError, "Dimension %d is not direct", i) # <<<<<<<<<<<<<< + * + * if slices_overlap(&src, &dst, ndim, itemsize): +*/ + __pyx_t_6 = __pyx_memoryview_err_dim(PyExc_ValueError, __pyx_mstate_global->__pyx_kp_u_Dimension_d_is_not_direct, __pyx_v_i); if (unlikely(__pyx_t_6 == ((int)-1))) __PYX_ERR(1, 1298, __pyx_L1_error) + + /* "View.MemoryView":1297 + * _err_extents(i, dst.shape[i], src.shape[i]) + * + * if src.suboffsets[i] >= 0: # <<<<<<<<<<<<<< + * _err_dim(PyExc_ValueError, "Dimension %d is not direct", i) + * +*/ + } + } + + /* "View.MemoryView":1300 + * _err_dim(PyExc_ValueError, "Dimension %d is not direct", i) + * + * if slices_overlap(&src, &dst, ndim, itemsize): # <<<<<<<<<<<<<< + * + * if not slice_is_contig(src, order, ndim): +*/ + __pyx_t_2 = __pyx_slices_overlap((&__pyx_v_src), (&__pyx_v_dst), __pyx_v_ndim, __pyx_v_itemsize); + if (__pyx_t_2) { + + /* "View.MemoryView":1302 + * if slices_overlap(&src, &dst, ndim, itemsize): + * + * if not slice_is_contig(src, order, ndim): # <<<<<<<<<<<<<< + * order = get_best_order(&dst, ndim) + * +*/ + __pyx_t_2 = (!__pyx_memviewslice_is_contig(__pyx_v_src, __pyx_v_order, __pyx_v_ndim)); + if (__pyx_t_2) { + + /* "View.MemoryView":1303 + * + * if not slice_is_contig(src, order, ndim): + * order = get_best_order(&dst, ndim) # <<<<<<<<<<<<<< + * + * tmpdata = copy_data_to_temp(&src, &tmp, order, ndim) +*/ + __pyx_v_order = __pyx_get_best_slice_order((&__pyx_v_dst), __pyx_v_ndim); + + /* "View.MemoryView":1302 + * if slices_overlap(&src, &dst, ndim, itemsize): + * + * if not slice_is_contig(src, order, ndim): # <<<<<<<<<<<<<< + * order = get_best_order(&dst, ndim) + * +*/ + } + + /* "View.MemoryView":1305 + * order = get_best_order(&dst, ndim) + * + * tmpdata = copy_data_to_temp(&src, &tmp, order, ndim) # <<<<<<<<<<<<<< + * src = tmp + * +*/ + __pyx_t_7 = __pyx_memoryview_copy_data_to_temp((&__pyx_v_src), (&__pyx_v_tmp), __pyx_v_order, __pyx_v_ndim); if (unlikely(__pyx_t_7 == ((void *)NULL))) __PYX_ERR(1, 1305, __pyx_L1_error) + __pyx_v_tmpdata = __pyx_t_7; + + /* "View.MemoryView":1306 + * + * tmpdata = copy_data_to_temp(&src, &tmp, order, ndim) + * src = tmp # <<<<<<<<<<<<<< + * + * if not broadcasting: +*/ + __pyx_v_src = __pyx_v_tmp; + + /* "View.MemoryView":1300 + * _err_dim(PyExc_ValueError, "Dimension %d is not direct", i) + * + * if slices_overlap(&src, &dst, ndim, itemsize): # <<<<<<<<<<<<<< + * + * if not slice_is_contig(src, order, ndim): +*/ + } + + /* "View.MemoryView":1308 + * src = tmp + * + * if not broadcasting: # <<<<<<<<<<<<<< + * + * +*/ + __pyx_t_2 = (!__pyx_v_broadcasting); + if (__pyx_t_2) { + + /* "View.MemoryView":1311 + * + * + * if slice_is_contig(src, 'C', ndim): # <<<<<<<<<<<<<< + * direct_copy = slice_is_contig(dst, 'C', ndim) + * elif slice_is_contig(src, 'F', ndim): +*/ + __pyx_t_2 = __pyx_memviewslice_is_contig(__pyx_v_src, 'C', __pyx_v_ndim); + if (__pyx_t_2) { + + /* "View.MemoryView":1312 + * + * if slice_is_contig(src, 'C', ndim): + * direct_copy = slice_is_contig(dst, 'C', ndim) # <<<<<<<<<<<<<< + * elif slice_is_contig(src, 'F', ndim): + * direct_copy = slice_is_contig(dst, 'F', ndim) +*/ + __pyx_v_direct_copy = __pyx_memviewslice_is_contig(__pyx_v_dst, 'C', __pyx_v_ndim); + + /* "View.MemoryView":1311 + * + * + * if slice_is_contig(src, 'C', ndim): # <<<<<<<<<<<<<< + * direct_copy = slice_is_contig(dst, 'C', ndim) + * elif slice_is_contig(src, 'F', ndim): +*/ + goto __pyx_L12; + } + + /* "View.MemoryView":1313 + * if slice_is_contig(src, 'C', ndim): + * direct_copy = slice_is_contig(dst, 'C', ndim) + * elif slice_is_contig(src, 'F', ndim): # <<<<<<<<<<<<<< + * direct_copy = slice_is_contig(dst, 'F', ndim) + * +*/ + __pyx_t_2 = __pyx_memviewslice_is_contig(__pyx_v_src, 'F', __pyx_v_ndim); + if (__pyx_t_2) { + + /* "View.MemoryView":1314 + * direct_copy = slice_is_contig(dst, 'C', ndim) + * elif slice_is_contig(src, 'F', ndim): + * direct_copy = slice_is_contig(dst, 'F', ndim) # <<<<<<<<<<<<<< + * + * if direct_copy: +*/ + __pyx_v_direct_copy = __pyx_memviewslice_is_contig(__pyx_v_dst, 'F', __pyx_v_ndim); + + /* "View.MemoryView":1313 + * if slice_is_contig(src, 'C', ndim): + * direct_copy = slice_is_contig(dst, 'C', ndim) + * elif slice_is_contig(src, 'F', ndim): # <<<<<<<<<<<<<< + * direct_copy = slice_is_contig(dst, 'F', ndim) + * +*/ + } + __pyx_L12:; + + /* "View.MemoryView":1316 + * direct_copy = slice_is_contig(dst, 'F', ndim) + * + * if direct_copy: # <<<<<<<<<<<<<< + * + * refcount_copying(&dst, dtype_is_object, ndim, inc=False) +*/ + if (__pyx_v_direct_copy) { + + /* "View.MemoryView":1318 + * if direct_copy: + * + * refcount_copying(&dst, dtype_is_object, ndim, inc=False) # <<<<<<<<<<<<<< + * memcpy(dst.data, src.data, slice_get_size(&src, ndim)) + * refcount_copying(&dst, dtype_is_object, ndim, inc=True) +*/ + __pyx_memoryview_refcount_copying((&__pyx_v_dst), __pyx_v_dtype_is_object, __pyx_v_ndim, 0); + + /* "View.MemoryView":1319 + * + * refcount_copying(&dst, dtype_is_object, ndim, inc=False) + * memcpy(dst.data, src.data, slice_get_size(&src, ndim)) # <<<<<<<<<<<<<< + * refcount_copying(&dst, dtype_is_object, ndim, inc=True) + * free(tmpdata) +*/ + (void)(memcpy(__pyx_v_dst.data, __pyx_v_src.data, __pyx_memoryview_slice_get_size((&__pyx_v_src), __pyx_v_ndim))); + + /* "View.MemoryView":1320 + * refcount_copying(&dst, dtype_is_object, ndim, inc=False) + * memcpy(dst.data, src.data, slice_get_size(&src, ndim)) + * refcount_copying(&dst, dtype_is_object, ndim, inc=True) # <<<<<<<<<<<<<< + * free(tmpdata) + * return 0 +*/ + __pyx_memoryview_refcount_copying((&__pyx_v_dst), __pyx_v_dtype_is_object, __pyx_v_ndim, 1); + + /* "View.MemoryView":1321 + * memcpy(dst.data, src.data, slice_get_size(&src, ndim)) + * refcount_copying(&dst, dtype_is_object, ndim, inc=True) + * free(tmpdata) # <<<<<<<<<<<<<< + * return 0 + * +*/ + free(__pyx_v_tmpdata); + + /* "View.MemoryView":1322 + * refcount_copying(&dst, dtype_is_object, ndim, inc=True) + * free(tmpdata) + * return 0 # <<<<<<<<<<<<<< + * + * if order == 'F' == get_best_order(&dst, ndim): +*/ + __pyx_r = 0; + goto __pyx_L0; + + /* "View.MemoryView":1316 + * direct_copy = slice_is_contig(dst, 'F', ndim) + * + * if direct_copy: # <<<<<<<<<<<<<< + * + * refcount_copying(&dst, dtype_is_object, ndim, inc=False) +*/ + } + + /* "View.MemoryView":1308 + * src = tmp + * + * if not broadcasting: # <<<<<<<<<<<<<< + * + * +*/ + } + + /* "View.MemoryView":1324 + * return 0 + * + * if order == 'F' == get_best_order(&dst, ndim): # <<<<<<<<<<<<<< + * + * +*/ + __pyx_t_2 = (__pyx_v_order == 'F'); + if (__pyx_t_2) { + __pyx_t_2 = ('F' == __pyx_get_best_slice_order((&__pyx_v_dst), __pyx_v_ndim)); + } + if (__pyx_t_2) { + + /* "View.MemoryView":1327 + * + * + * transpose_memslice(&src) # <<<<<<<<<<<<<< + * transpose_memslice(&dst) + * +*/ + __pyx_t_5 = __pyx_memslice_transpose((&__pyx_v_src)); if (unlikely(__pyx_t_5 == ((int)-1))) __PYX_ERR(1, 1327, __pyx_L1_error) + + /* "View.MemoryView":1328 + * + * transpose_memslice(&src) + * transpose_memslice(&dst) # <<<<<<<<<<<<<< + * + * refcount_copying(&dst, dtype_is_object, ndim, inc=False) +*/ + __pyx_t_5 = __pyx_memslice_transpose((&__pyx_v_dst)); if (unlikely(__pyx_t_5 == ((int)-1))) __PYX_ERR(1, 1328, __pyx_L1_error) + + /* "View.MemoryView":1324 + * return 0 + * + * if order == 'F' == get_best_order(&dst, ndim): # <<<<<<<<<<<<<< + * + * +*/ + } + + /* "View.MemoryView":1330 + * transpose_memslice(&dst) + * + * refcount_copying(&dst, dtype_is_object, ndim, inc=False) # <<<<<<<<<<<<<< + * copy_strided_to_strided(&src, &dst, ndim, itemsize) + * refcount_copying(&dst, dtype_is_object, ndim, inc=True) +*/ + __pyx_memoryview_refcount_copying((&__pyx_v_dst), __pyx_v_dtype_is_object, __pyx_v_ndim, 0); + + /* "View.MemoryView":1331 + * + * refcount_copying(&dst, dtype_is_object, ndim, inc=False) + * copy_strided_to_strided(&src, &dst, ndim, itemsize) # <<<<<<<<<<<<<< + * refcount_copying(&dst, dtype_is_object, ndim, inc=True) + * +*/ + copy_strided_to_strided((&__pyx_v_src), (&__pyx_v_dst), __pyx_v_ndim, __pyx_v_itemsize); + + /* "View.MemoryView":1332 + * refcount_copying(&dst, dtype_is_object, ndim, inc=False) + * copy_strided_to_strided(&src, &dst, ndim, itemsize) + * refcount_copying(&dst, dtype_is_object, ndim, inc=True) # <<<<<<<<<<<<<< + * + * free(tmpdata) +*/ + __pyx_memoryview_refcount_copying((&__pyx_v_dst), __pyx_v_dtype_is_object, __pyx_v_ndim, 1); + + /* "View.MemoryView":1334 + * refcount_copying(&dst, dtype_is_object, ndim, inc=True) + * + * free(tmpdata) # <<<<<<<<<<<<<< + * return 0 + * +*/ + free(__pyx_v_tmpdata); + + /* "View.MemoryView":1335 + * + * free(tmpdata) + * return 0 # <<<<<<<<<<<<<< + * + * @cname('__pyx_memoryview_broadcast_leading') +*/ + __pyx_r = 0; + goto __pyx_L0; + + /* "View.MemoryView":1265 + * + * + * @cname('__pyx_memoryview_copy_contents') # <<<<<<<<<<<<<< + * cdef int memoryview_copy_contents(__Pyx_memviewslice src, + * __Pyx_memviewslice dst, +*/ + + /* function exit code */ + __pyx_L1_error:; + __pyx_gilstate_save = __Pyx_PyGILState_Ensure(); + __Pyx_AddTraceback("View.MemoryView.memoryview_copy_contents", __pyx_clineno, __pyx_lineno, __pyx_filename); + __pyx_r = -1; + __Pyx_PyGILState_Release(__pyx_gilstate_save); + __pyx_L0:; + return __pyx_r; +} + +/* "View.MemoryView":1337 + * return 0 + * + * @cname('__pyx_memoryview_broadcast_leading') # <<<<<<<<<<<<<< + * cdef void broadcast_leading(__Pyx_memviewslice *mslice, + * int ndim, +*/ + +static void __pyx_memoryview_broadcast_leading(__Pyx_memviewslice *__pyx_v_mslice, int __pyx_v_ndim, int __pyx_v_ndim_other) { + int __pyx_v_i; + int __pyx_v_offset; + int __pyx_t_1; + int __pyx_t_2; + int __pyx_t_3; + + /* "View.MemoryView":1342 + * int ndim_other) noexcept nogil: + * cdef int i + * cdef int offset = ndim_other - ndim # <<<<<<<<<<<<<< + * + * for i in range(ndim - 1, -1, -1): +*/ + __pyx_v_offset = (__pyx_v_ndim_other - __pyx_v_ndim); + + /* "View.MemoryView":1344 + * cdef int offset = ndim_other - ndim + * + * for i in range(ndim - 1, -1, -1): # <<<<<<<<<<<<<< + * mslice.shape[i + offset] = mslice.shape[i] + * mslice.strides[i + offset] = mslice.strides[i] +*/ + for (__pyx_t_1 = (__pyx_v_ndim - 1); __pyx_t_1 > -1; __pyx_t_1-=1) { + __pyx_v_i = __pyx_t_1; + + /* "View.MemoryView":1345 + * + * for i in range(ndim - 1, -1, -1): + * mslice.shape[i + offset] = mslice.shape[i] # <<<<<<<<<<<<<< + * mslice.strides[i + offset] = mslice.strides[i] + * mslice.suboffsets[i + offset] = mslice.suboffsets[i] +*/ + (__pyx_v_mslice->shape[(__pyx_v_i + __pyx_v_offset)]) = (__pyx_v_mslice->shape[__pyx_v_i]); + + /* "View.MemoryView":1346 + * for i in range(ndim - 1, -1, -1): + * mslice.shape[i + offset] = mslice.shape[i] + * mslice.strides[i + offset] = mslice.strides[i] # <<<<<<<<<<<<<< + * mslice.suboffsets[i + offset] = mslice.suboffsets[i] + * +*/ + (__pyx_v_mslice->strides[(__pyx_v_i + __pyx_v_offset)]) = (__pyx_v_mslice->strides[__pyx_v_i]); + + /* "View.MemoryView":1347 + * mslice.shape[i + offset] = mslice.shape[i] + * mslice.strides[i + offset] = mslice.strides[i] + * mslice.suboffsets[i + offset] = mslice.suboffsets[i] # <<<<<<<<<<<<<< + * + * for i in range(offset): +*/ + (__pyx_v_mslice->suboffsets[(__pyx_v_i + __pyx_v_offset)]) = (__pyx_v_mslice->suboffsets[__pyx_v_i]); + } + + /* "View.MemoryView":1349 + * mslice.suboffsets[i + offset] = mslice.suboffsets[i] + * + * for i in range(offset): # <<<<<<<<<<<<<< + * mslice.shape[i] = 1 + * mslice.strides[i] = mslice.strides[0] +*/ + __pyx_t_1 = __pyx_v_offset; + __pyx_t_2 = __pyx_t_1; + for (__pyx_t_3 = 0; __pyx_t_3 < __pyx_t_2; __pyx_t_3+=1) { + __pyx_v_i = __pyx_t_3; + + /* "View.MemoryView":1350 + * + * for i in range(offset): + * mslice.shape[i] = 1 # <<<<<<<<<<<<<< + * mslice.strides[i] = mslice.strides[0] + * mslice.suboffsets[i] = -1 +*/ + (__pyx_v_mslice->shape[__pyx_v_i]) = 1; + + /* "View.MemoryView":1351 + * for i in range(offset): + * mslice.shape[i] = 1 + * mslice.strides[i] = mslice.strides[0] # <<<<<<<<<<<<<< + * mslice.suboffsets[i] = -1 + * +*/ + (__pyx_v_mslice->strides[__pyx_v_i]) = (__pyx_v_mslice->strides[0]); + + /* "View.MemoryView":1352 + * mslice.shape[i] = 1 + * mslice.strides[i] = mslice.strides[0] + * mslice.suboffsets[i] = -1 # <<<<<<<<<<<<<< + * + * +*/ + (__pyx_v_mslice->suboffsets[__pyx_v_i]) = -1L; + } + + /* "View.MemoryView":1337 + * return 0 + * + * @cname('__pyx_memoryview_broadcast_leading') # <<<<<<<<<<<<<< + * cdef void broadcast_leading(__Pyx_memviewslice *mslice, + * int ndim, +*/ + + /* function exit code */ +} + +/* "View.MemoryView":1359 + * + * + * @cname('__pyx_memoryview_refcount_copying') # <<<<<<<<<<<<<< + * cdef void refcount_copying(__Pyx_memviewslice *dst, bint dtype_is_object, int ndim, bint inc) noexcept nogil: + * +*/ + +static void __pyx_memoryview_refcount_copying(__Pyx_memviewslice *__pyx_v_dst, int __pyx_v_dtype_is_object, int __pyx_v_ndim, int __pyx_v_inc) { + + /* "View.MemoryView":1362 + * cdef void refcount_copying(__Pyx_memviewslice *dst, bint dtype_is_object, int ndim, bint inc) noexcept nogil: + * + * if dtype_is_object: # <<<<<<<<<<<<<< + * refcount_objects_in_slice_with_gil(dst.data, dst.shape, dst.strides, ndim, inc) + * +*/ + if (__pyx_v_dtype_is_object) { + + /* "View.MemoryView":1363 + * + * if dtype_is_object: + * refcount_objects_in_slice_with_gil(dst.data, dst.shape, dst.strides, ndim, inc) # <<<<<<<<<<<<<< + * + * @cname('__pyx_memoryview_refcount_objects_in_slice_with_gil') +*/ + __pyx_memoryview_refcount_objects_in_slice_with_gil(__pyx_v_dst->data, __pyx_v_dst->shape, __pyx_v_dst->strides, __pyx_v_ndim, __pyx_v_inc); + + /* "View.MemoryView":1362 + * cdef void refcount_copying(__Pyx_memviewslice *dst, bint dtype_is_object, int ndim, bint inc) noexcept nogil: + * + * if dtype_is_object: # <<<<<<<<<<<<<< + * refcount_objects_in_slice_with_gil(dst.data, dst.shape, dst.strides, ndim, inc) + * +*/ + } + + /* "View.MemoryView":1359 + * + * + * @cname('__pyx_memoryview_refcount_copying') # <<<<<<<<<<<<<< + * cdef void refcount_copying(__Pyx_memviewslice *dst, bint dtype_is_object, int ndim, bint inc) noexcept nogil: + * +*/ + + /* function exit code */ +} + +/* "View.MemoryView":1365 + * refcount_objects_in_slice_with_gil(dst.data, dst.shape, dst.strides, ndim, inc) + * + * @cname('__pyx_memoryview_refcount_objects_in_slice_with_gil') # <<<<<<<<<<<<<< + * cdef void refcount_objects_in_slice_with_gil(char *data, Py_ssize_t *shape, + * Py_ssize_t *strides, int ndim, +*/ + +static void __pyx_memoryview_refcount_objects_in_slice_with_gil(char *__pyx_v_data, Py_ssize_t *__pyx_v_shape, Py_ssize_t *__pyx_v_strides, int __pyx_v_ndim, int __pyx_v_inc) { + PyGILState_STATE __pyx_gilstate_save = __Pyx_PyGILState_Ensure(); + + /* "View.MemoryView":1369 + * Py_ssize_t *strides, int ndim, + * bint inc) noexcept with gil: + * refcount_objects_in_slice(data, shape, strides, ndim, inc) # <<<<<<<<<<<<<< + * + * @cname('__pyx_memoryview_refcount_objects_in_slice') +*/ + __pyx_memoryview_refcount_objects_in_slice(__pyx_v_data, __pyx_v_shape, __pyx_v_strides, __pyx_v_ndim, __pyx_v_inc); + + /* "View.MemoryView":1365 + * refcount_objects_in_slice_with_gil(dst.data, dst.shape, dst.strides, ndim, inc) + * + * @cname('__pyx_memoryview_refcount_objects_in_slice_with_gil') # <<<<<<<<<<<<<< + * cdef void refcount_objects_in_slice_with_gil(char *data, Py_ssize_t *shape, + * Py_ssize_t *strides, int ndim, +*/ + + /* function exit code */ + __Pyx_PyGILState_Release(__pyx_gilstate_save); +} + +/* "View.MemoryView":1371 + * refcount_objects_in_slice(data, shape, strides, ndim, inc) + * + * @cname('__pyx_memoryview_refcount_objects_in_slice') # <<<<<<<<<<<<<< + * cdef void refcount_objects_in_slice(char *data, Py_ssize_t *shape, + * Py_ssize_t *strides, int ndim, bint inc) noexcept: +*/ + +static void __pyx_memoryview_refcount_objects_in_slice(char *__pyx_v_data, Py_ssize_t *__pyx_v_shape, Py_ssize_t *__pyx_v_strides, int __pyx_v_ndim, int __pyx_v_inc) { + CYTHON_UNUSED Py_ssize_t __pyx_v_i; + Py_ssize_t __pyx_v_stride; + Py_ssize_t __pyx_t_1; + Py_ssize_t __pyx_t_2; + Py_ssize_t __pyx_t_3; + int __pyx_t_4; + + /* "View.MemoryView":1375 + * Py_ssize_t *strides, int ndim, bint inc) noexcept: + * cdef Py_ssize_t i + * cdef Py_ssize_t stride = strides[0] # <<<<<<<<<<<<<< + * + * for i in range(shape[0]): +*/ + __pyx_v_stride = (__pyx_v_strides[0]); + + /* "View.MemoryView":1377 + * cdef Py_ssize_t stride = strides[0] + * + * for i in range(shape[0]): # <<<<<<<<<<<<<< + * if ndim == 1: + * if inc: +*/ + __pyx_t_1 = (__pyx_v_shape[0]); + __pyx_t_2 = __pyx_t_1; + for (__pyx_t_3 = 0; __pyx_t_3 < __pyx_t_2; __pyx_t_3+=1) { + __pyx_v_i = __pyx_t_3; + + /* "View.MemoryView":1378 + * + * for i in range(shape[0]): + * if ndim == 1: # <<<<<<<<<<<<<< + * if inc: + * Py_INCREF(( data)[0]) +*/ + __pyx_t_4 = (__pyx_v_ndim == 1); + if (__pyx_t_4) { + + /* "View.MemoryView":1379 + * for i in range(shape[0]): + * if ndim == 1: + * if inc: # <<<<<<<<<<<<<< + * Py_INCREF(( data)[0]) + * else: +*/ + if (__pyx_v_inc) { + + /* "View.MemoryView":1380 + * if ndim == 1: + * if inc: + * Py_INCREF(( data)[0]) # <<<<<<<<<<<<<< + * else: + * Py_DECREF(( data)[0]) +*/ + Py_INCREF((((PyObject **)__pyx_v_data)[0])); + + /* "View.MemoryView":1379 + * for i in range(shape[0]): + * if ndim == 1: + * if inc: # <<<<<<<<<<<<<< + * Py_INCREF(( data)[0]) + * else: +*/ + goto __pyx_L6; + } + + /* "View.MemoryView":1382 + * Py_INCREF(( data)[0]) + * else: + * Py_DECREF(( data)[0]) # <<<<<<<<<<<<<< + * else: + * refcount_objects_in_slice(data, shape + 1, strides + 1, ndim - 1, inc) +*/ + /*else*/ { + Py_DECREF((((PyObject **)__pyx_v_data)[0])); + } + __pyx_L6:; + + /* "View.MemoryView":1378 + * + * for i in range(shape[0]): + * if ndim == 1: # <<<<<<<<<<<<<< + * if inc: + * Py_INCREF(( data)[0]) +*/ + goto __pyx_L5; + } + + /* "View.MemoryView":1384 + * Py_DECREF(( data)[0]) + * else: + * refcount_objects_in_slice(data, shape + 1, strides + 1, ndim - 1, inc) # <<<<<<<<<<<<<< + * + * data += stride +*/ + /*else*/ { + __pyx_memoryview_refcount_objects_in_slice(__pyx_v_data, (__pyx_v_shape + 1), (__pyx_v_strides + 1), (__pyx_v_ndim - 1), __pyx_v_inc); + } + __pyx_L5:; + + /* "View.MemoryView":1386 + * refcount_objects_in_slice(data, shape + 1, strides + 1, ndim - 1, inc) + * + * data += stride # <<<<<<<<<<<<<< + * + * +*/ + __pyx_v_data = (__pyx_v_data + __pyx_v_stride); + } + + /* "View.MemoryView":1371 + * refcount_objects_in_slice(data, shape, strides, ndim, inc) + * + * @cname('__pyx_memoryview_refcount_objects_in_slice') # <<<<<<<<<<<<<< + * cdef void refcount_objects_in_slice(char *data, Py_ssize_t *shape, + * Py_ssize_t *strides, int ndim, bint inc) noexcept: +*/ + + /* function exit code */ +} + +/* "View.MemoryView":1391 + * + * + * @cname('__pyx_memoryview_slice_assign_scalar') # <<<<<<<<<<<<<< + * cdef void slice_assign_scalar(__Pyx_memviewslice *dst, int ndim, + * size_t itemsize, void *item, +*/ + +static void __pyx_memoryview_slice_assign_scalar(__Pyx_memviewslice *__pyx_v_dst, int __pyx_v_ndim, size_t __pyx_v_itemsize, void *__pyx_v_item, int __pyx_v_dtype_is_object) { + + /* "View.MemoryView":1395 + * size_t itemsize, void *item, + * bint dtype_is_object) noexcept nogil: + * refcount_copying(dst, dtype_is_object, ndim, inc=False) # <<<<<<<<<<<<<< + * _slice_assign_scalar(dst.data, dst.shape, dst.strides, ndim, itemsize, item) + * refcount_copying(dst, dtype_is_object, ndim, inc=True) +*/ + __pyx_memoryview_refcount_copying(__pyx_v_dst, __pyx_v_dtype_is_object, __pyx_v_ndim, 0); + + /* "View.MemoryView":1396 + * bint dtype_is_object) noexcept nogil: + * refcount_copying(dst, dtype_is_object, ndim, inc=False) + * _slice_assign_scalar(dst.data, dst.shape, dst.strides, ndim, itemsize, item) # <<<<<<<<<<<<<< + * refcount_copying(dst, dtype_is_object, ndim, inc=True) + * +*/ + __pyx_memoryview__slice_assign_scalar(__pyx_v_dst->data, __pyx_v_dst->shape, __pyx_v_dst->strides, __pyx_v_ndim, __pyx_v_itemsize, __pyx_v_item); + + /* "View.MemoryView":1397 + * refcount_copying(dst, dtype_is_object, ndim, inc=False) + * _slice_assign_scalar(dst.data, dst.shape, dst.strides, ndim, itemsize, item) + * refcount_copying(dst, dtype_is_object, ndim, inc=True) # <<<<<<<<<<<<<< + * + * +*/ + __pyx_memoryview_refcount_copying(__pyx_v_dst, __pyx_v_dtype_is_object, __pyx_v_ndim, 1); + + /* "View.MemoryView":1391 + * + * + * @cname('__pyx_memoryview_slice_assign_scalar') # <<<<<<<<<<<<<< + * cdef void slice_assign_scalar(__Pyx_memviewslice *dst, int ndim, + * size_t itemsize, void *item, +*/ + + /* function exit code */ +} + +/* "View.MemoryView":1400 + * + * + * @cname('__pyx_memoryview__slice_assign_scalar') # <<<<<<<<<<<<<< + * cdef void _slice_assign_scalar(char *data, Py_ssize_t *shape, + * Py_ssize_t *strides, int ndim, +*/ + +static void __pyx_memoryview__slice_assign_scalar(char *__pyx_v_data, Py_ssize_t *__pyx_v_shape, Py_ssize_t *__pyx_v_strides, int __pyx_v_ndim, size_t __pyx_v_itemsize, void *__pyx_v_item) { + CYTHON_UNUSED Py_ssize_t __pyx_v_i; + Py_ssize_t __pyx_v_stride; + Py_ssize_t __pyx_v_extent; + int __pyx_t_1; + Py_ssize_t __pyx_t_2; + Py_ssize_t __pyx_t_3; + Py_ssize_t __pyx_t_4; + + /* "View.MemoryView":1405 + * size_t itemsize, void *item) noexcept nogil: + * cdef Py_ssize_t i + * cdef Py_ssize_t stride = strides[0] # <<<<<<<<<<<<<< + * cdef Py_ssize_t extent = shape[0] + * +*/ + __pyx_v_stride = (__pyx_v_strides[0]); + + /* "View.MemoryView":1406 + * cdef Py_ssize_t i + * cdef Py_ssize_t stride = strides[0] + * cdef Py_ssize_t extent = shape[0] # <<<<<<<<<<<<<< + * + * if ndim == 1: +*/ + __pyx_v_extent = (__pyx_v_shape[0]); + + /* "View.MemoryView":1408 + * cdef Py_ssize_t extent = shape[0] + * + * if ndim == 1: # <<<<<<<<<<<<<< + * for i in range(extent): + * memcpy(data, item, itemsize) +*/ + __pyx_t_1 = (__pyx_v_ndim == 1); + if (__pyx_t_1) { + + /* "View.MemoryView":1409 + * + * if ndim == 1: + * for i in range(extent): # <<<<<<<<<<<<<< + * memcpy(data, item, itemsize) + * data += stride +*/ + __pyx_t_2 = __pyx_v_extent; + __pyx_t_3 = __pyx_t_2; + for (__pyx_t_4 = 0; __pyx_t_4 < __pyx_t_3; __pyx_t_4+=1) { + __pyx_v_i = __pyx_t_4; + + /* "View.MemoryView":1410 + * if ndim == 1: + * for i in range(extent): + * memcpy(data, item, itemsize) # <<<<<<<<<<<<<< + * data += stride + * else: +*/ + (void)(memcpy(__pyx_v_data, __pyx_v_item, __pyx_v_itemsize)); + + /* "View.MemoryView":1411 + * for i in range(extent): + * memcpy(data, item, itemsize) + * data += stride # <<<<<<<<<<<<<< + * else: + * for i in range(extent): +*/ + __pyx_v_data = (__pyx_v_data + __pyx_v_stride); + } + + /* "View.MemoryView":1408 + * cdef Py_ssize_t extent = shape[0] + * + * if ndim == 1: # <<<<<<<<<<<<<< + * for i in range(extent): + * memcpy(data, item, itemsize) +*/ + goto __pyx_L3; + } + + /* "View.MemoryView":1413 + * data += stride + * else: + * for i in range(extent): # <<<<<<<<<<<<<< + * _slice_assign_scalar(data, shape + 1, strides + 1, ndim - 1, itemsize, item) + * data += stride +*/ + /*else*/ { + __pyx_t_2 = __pyx_v_extent; + __pyx_t_3 = __pyx_t_2; + for (__pyx_t_4 = 0; __pyx_t_4 < __pyx_t_3; __pyx_t_4+=1) { + __pyx_v_i = __pyx_t_4; + + /* "View.MemoryView":1414 + * else: + * for i in range(extent): + * _slice_assign_scalar(data, shape + 1, strides + 1, ndim - 1, itemsize, item) # <<<<<<<<<<<<<< + * data += stride + * +*/ + __pyx_memoryview__slice_assign_scalar(__pyx_v_data, (__pyx_v_shape + 1), (__pyx_v_strides + 1), (__pyx_v_ndim - 1), __pyx_v_itemsize, __pyx_v_item); + + /* "View.MemoryView":1415 + * for i in range(extent): + * _slice_assign_scalar(data, shape + 1, strides + 1, ndim - 1, itemsize, item) + * data += stride # <<<<<<<<<<<<<< + * +*/ + __pyx_v_data = (__pyx_v_data + __pyx_v_stride); + } + } + __pyx_L3:; + + /* "View.MemoryView":1400 + * + * + * @cname('__pyx_memoryview__slice_assign_scalar') # <<<<<<<<<<<<<< + * cdef void _slice_assign_scalar(char *data, Py_ssize_t *shape, + * Py_ssize_t *strides, int ndim, +*/ + + /* function exit code */ +} + +/* "(tree fragment)":4 + * int __Pyx_CheckUnpickleChecksum(long, long, long, long, const char*) except -1 + * int __Pyx_UpdateUnpickledDict(object, object, Py_ssize_t) except -1 + * def __pyx_unpickle_Enum(__pyx_type, long __pyx_checksum, tuple __pyx_state): # <<<<<<<<<<<<<< + * cdef object __pyx_result + * __Pyx_CheckUnpickleChecksum(__pyx_checksum, 0x82a3537, 0x6ae9995, 0xb068931, b'name') +*/ + +/* Python wrapper */ +static PyObject *__pyx_pw_15View_dot_MemoryView_1__pyx_unpickle_Enum(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*/ +static PyMethodDef __pyx_mdef_15View_dot_MemoryView_1__pyx_unpickle_Enum = {"__pyx_unpickle_Enum", (PyCFunction)(void(*)(void))(__Pyx_PyCFunction_FastCallWithKeywords)__pyx_pw_15View_dot_MemoryView_1__pyx_unpickle_Enum, __Pyx_METH_FASTCALL|METH_KEYWORDS, 0}; +static PyObject *__pyx_pw_15View_dot_MemoryView_1__pyx_unpickle_Enum(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 +) { + PyObject *__pyx_v___pyx_type = 0; + long __pyx_v___pyx_checksum; + 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[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("__pyx_unpickle_Enum (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_type,&__pyx_mstate_global->__pyx_n_u_pyx_checksum,&__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, 4, __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(1, 4, __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(1, 4, __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(1, 4, __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, "__pyx_unpickle_Enum", 0) < (0)) __PYX_ERR(1, 4, __pyx_L3_error) + for (Py_ssize_t i = __pyx_nargs; i < 3; i++) { + if (unlikely(!values[i])) { __Pyx_RaiseArgtupleInvalid("__pyx_unpickle_Enum", 1, 3, 3, i); __PYX_ERR(1, 4, __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(1, 4, __pyx_L3_error) + values[1] = __Pyx_ArgRef_FASTCALL(__pyx_args, 1); + if (!CYTHON_ASSUME_SAFE_MACROS && unlikely(!values[1])) __PYX_ERR(1, 4, __pyx_L3_error) + values[2] = __Pyx_ArgRef_FASTCALL(__pyx_args, 2); + if (!CYTHON_ASSUME_SAFE_MACROS && unlikely(!values[2])) __PYX_ERR(1, 4, __pyx_L3_error) + } + __pyx_v___pyx_type = values[0]; + __pyx_v___pyx_checksum = __Pyx_PyLong_As_long(values[1]); if (unlikely((__pyx_v___pyx_checksum == (long)-1) && PyErr_Occurred())) __PYX_ERR(1, 4, __pyx_L3_error) + __pyx_v___pyx_state = ((PyObject*)values[2]); + } + goto __pyx_L6_skip; + __pyx_L5_argtuple_error:; + __Pyx_RaiseArgtupleInvalid("__pyx_unpickle_Enum", 1, 3, 3, __pyx_nargs); __PYX_ERR(1, 4, __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("View.MemoryView.__pyx_unpickle_Enum", __pyx_clineno, __pyx_lineno, __pyx_filename); + __Pyx_RefNannyFinishContext(); + return NULL; + __pyx_L4_argument_unpacking_done:; + if (unlikely(!__Pyx_ArgTypeTest(((PyObject *)__pyx_v___pyx_state), (&PyTuple_Type), 1, "__pyx_state", 1))) __PYX_ERR(1, 4, __pyx_L1_error) + __pyx_r = __pyx_pf_15View_dot_MemoryView___pyx_unpickle_Enum(__pyx_self, __pyx_v___pyx_type, __pyx_v___pyx_checksum, __pyx_v___pyx_state); + + /* 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_15View_dot_MemoryView___pyx_unpickle_Enum(CYTHON_UNUSED PyObject *__pyx_self, PyObject *__pyx_v___pyx_type, long __pyx_v___pyx_checksum, PyObject *__pyx_v___pyx_state) { + PyObject *__pyx_v___pyx_result = 0; + 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_t_5; + int __pyx_lineno = 0; + const char *__pyx_filename = NULL; + int __pyx_clineno = 0; + __Pyx_RefNannySetupContext("__pyx_unpickle_Enum", 0); + + /* "(tree fragment)":6 + * def __pyx_unpickle_Enum(__pyx_type, long __pyx_checksum, tuple __pyx_state): + * cdef object __pyx_result + * __Pyx_CheckUnpickleChecksum(__pyx_checksum, 0x82a3537, 0x6ae9995, 0xb068931, b'name') # <<<<<<<<<<<<<< + * __pyx_result = Enum.__new__(__pyx_type) + * if __pyx_state is not None: +*/ + __pyx_t_1 = __Pyx_CheckUnpickleChecksum(__pyx_v___pyx_checksum, 0x82a3537, 0x6ae9995, 0xb068931, ((char const *)"name")); if (unlikely(__pyx_t_1 == ((int)-1))) __PYX_ERR(1, 6, __pyx_L1_error) + + /* "(tree fragment)":7 + * cdef object __pyx_result + * __Pyx_CheckUnpickleChecksum(__pyx_checksum, 0x82a3537, 0x6ae9995, 0xb068931, b'name') + * __pyx_result = Enum.__new__(__pyx_type) # <<<<<<<<<<<<<< + * if __pyx_state is not None: + * __pyx_unpickle_Enum__set_state( __pyx_result, __pyx_state) +*/ + __pyx_t_3 = ((PyObject *)__pyx_mstate_global->__pyx_MemviewEnum_type); + __Pyx_INCREF(__pyx_t_3); + __pyx_t_4 = 0; + { + PyObject *__pyx_callargs[2] = {__pyx_t_3, __pyx_v___pyx_type}; + __pyx_t_2 = __Pyx_PyObject_FastCallMethod((PyObject*)__pyx_mstate_global->__pyx_n_u_new, __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_2)) __PYX_ERR(1, 7, __pyx_L1_error) + __Pyx_GOTREF(__pyx_t_2); + } + __pyx_v___pyx_result = __pyx_t_2; + __pyx_t_2 = 0; + + /* "(tree fragment)":8 + * __Pyx_CheckUnpickleChecksum(__pyx_checksum, 0x82a3537, 0x6ae9995, 0xb068931, b'name') + * __pyx_result = Enum.__new__(__pyx_type) + * if __pyx_state is not None: # <<<<<<<<<<<<<< + * __pyx_unpickle_Enum__set_state( __pyx_result, __pyx_state) + * return __pyx_result +*/ + __pyx_t_5 = (__pyx_v___pyx_state != ((PyObject*)Py_None)); + if (__pyx_t_5) { + + /* "(tree fragment)":9 + * __pyx_result = Enum.__new__(__pyx_type) + * if __pyx_state is not None: + * __pyx_unpickle_Enum__set_state( __pyx_result, __pyx_state) # <<<<<<<<<<<<<< + * return __pyx_result + * cdef __pyx_unpickle_Enum__set_state(Enum __pyx_result, __pyx_state: tuple): +*/ + if (unlikely(__pyx_v___pyx_state == Py_None)) { + PyErr_SetString(PyExc_TypeError, "cannot pass None into a C function argument that is declared 'not None'"); + __PYX_ERR(1, 9, __pyx_L1_error) + } + __pyx_t_2 = __pyx_unpickle_Enum__set_state(((struct __pyx_MemviewEnum_obj *)__pyx_v___pyx_result), __pyx_v___pyx_state); if (unlikely(!__pyx_t_2)) __PYX_ERR(1, 9, __pyx_L1_error) + __Pyx_GOTREF(__pyx_t_2); + __Pyx_DECREF(__pyx_t_2); __pyx_t_2 = 0; + + /* "(tree fragment)":8 + * __Pyx_CheckUnpickleChecksum(__pyx_checksum, 0x82a3537, 0x6ae9995, 0xb068931, b'name') + * __pyx_result = Enum.__new__(__pyx_type) + * if __pyx_state is not None: # <<<<<<<<<<<<<< + * __pyx_unpickle_Enum__set_state( __pyx_result, __pyx_state) + * return __pyx_result +*/ + } + + /* "(tree fragment)":10 + * if __pyx_state is not None: + * __pyx_unpickle_Enum__set_state( __pyx_result, __pyx_state) + * return __pyx_result # <<<<<<<<<<<<<< + * cdef __pyx_unpickle_Enum__set_state(Enum __pyx_result, __pyx_state: tuple): + * __pyx_result.name = __pyx_state[0] +*/ + __Pyx_XDECREF(__pyx_r); + __Pyx_INCREF(__pyx_v___pyx_result); + __pyx_r = __pyx_v___pyx_result; + goto __pyx_L0; + + /* "(tree fragment)":4 + * int __Pyx_CheckUnpickleChecksum(long, long, long, long, const char*) except -1 + * int __Pyx_UpdateUnpickledDict(object, object, Py_ssize_t) except -1 + * def __pyx_unpickle_Enum(__pyx_type, long __pyx_checksum, tuple __pyx_state): # <<<<<<<<<<<<<< + * cdef object __pyx_result + * __Pyx_CheckUnpickleChecksum(__pyx_checksum, 0x82a3537, 0x6ae9995, 0xb068931, b'name') +*/ + + /* function exit code */ + __pyx_L1_error:; + __Pyx_XDECREF(__pyx_t_2); + __Pyx_XDECREF(__pyx_t_3); + __Pyx_AddTraceback("View.MemoryView.__pyx_unpickle_Enum", __pyx_clineno, __pyx_lineno, __pyx_filename); + __pyx_r = NULL; + __pyx_L0:; + __Pyx_XDECREF(__pyx_v___pyx_result); + __Pyx_XGIVEREF(__pyx_r); + __Pyx_RefNannyFinishContext(); + return __pyx_r; +} + +/* "(tree fragment)":11 + * __pyx_unpickle_Enum__set_state( __pyx_result, __pyx_state) + * return __pyx_result + * cdef __pyx_unpickle_Enum__set_state(Enum __pyx_result, __pyx_state: tuple): # <<<<<<<<<<<<<< + * __pyx_result.name = __pyx_state[0] + * __Pyx_UpdateUnpickledDict(__pyx_result, __pyx_state, 1) +*/ + +static PyObject *__pyx_unpickle_Enum__set_state(struct __pyx_MemviewEnum_obj *__pyx_v___pyx_result, PyObject *__pyx_v___pyx_state) { + PyObject *__pyx_r = NULL; + __Pyx_RefNannyDeclarations + PyObject *__pyx_t_1 = NULL; + int __pyx_t_2; + int __pyx_lineno = 0; + const char *__pyx_filename = NULL; + int __pyx_clineno = 0; + __Pyx_RefNannySetupContext("__pyx_unpickle_Enum__set_state", 0); + + /* "(tree fragment)":12 + * return __pyx_result + * cdef __pyx_unpickle_Enum__set_state(Enum __pyx_result, __pyx_state: tuple): + * __pyx_result.name = __pyx_state[0] # <<<<<<<<<<<<<< + * __Pyx_UpdateUnpickledDict(__pyx_result, __pyx_state, 1) +*/ + __pyx_t_1 = __Pyx_GetItemInt_Tuple(__pyx_v___pyx_state, 0, long, 1, __Pyx_PyLong_From_long, 0, 0, 1, 1, __Pyx_ReferenceSharing_FunctionArgument); if (unlikely(!__pyx_t_1)) __PYX_ERR(1, 12, __pyx_L1_error) + __Pyx_GOTREF(__pyx_t_1); + __Pyx_GIVEREF(__pyx_t_1); + __Pyx_GOTREF(__pyx_v___pyx_result->name); + __Pyx_DECREF(__pyx_v___pyx_result->name); + __pyx_v___pyx_result->name = __pyx_t_1; + __pyx_t_1 = 0; + + /* "(tree fragment)":13 + * cdef __pyx_unpickle_Enum__set_state(Enum __pyx_result, __pyx_state: tuple): + * __pyx_result.name = __pyx_state[0] + * __Pyx_UpdateUnpickledDict(__pyx_result, __pyx_state, 1) # <<<<<<<<<<<<<< +*/ + __pyx_t_2 = __Pyx_UpdateUnpickledDict(((PyObject *)__pyx_v___pyx_result), __pyx_v___pyx_state, 1); if (unlikely(__pyx_t_2 == ((int)-1))) __PYX_ERR(1, 13, __pyx_L1_error) + + /* "(tree fragment)":11 + * __pyx_unpickle_Enum__set_state( __pyx_result, __pyx_state) + * return __pyx_result + * cdef __pyx_unpickle_Enum__set_state(Enum __pyx_result, __pyx_state: tuple): # <<<<<<<<<<<<<< + * __pyx_result.name = __pyx_state[0] + * __Pyx_UpdateUnpickledDict(__pyx_result, __pyx_state, 1) +*/ + + /* function exit code */ + __pyx_r = Py_None; __Pyx_INCREF(Py_None); + goto __pyx_L0; + __pyx_L1_error:; + __Pyx_XDECREF(__pyx_t_1); + __Pyx_AddTraceback("View.MemoryView.__pyx_unpickle_Enum__set_state", __pyx_clineno, __pyx_lineno, __pyx_filename); + __pyx_r = 0; + __pyx_L0:; + __Pyx_XGIVEREF(__pyx_r); + __Pyx_RefNannyFinishContext(); + return __pyx_r; +} + +/* "C:/Users/runneradmin/AppData/Local/Temp/build-env-ej_q3m8u/Lib/site-packages/numpy/__init__.cython-30.pxd":242 + * cdef int type_num + * + * @property # <<<<<<<<<<<<<< + * cdef inline npy_intp itemsize(self) noexcept nogil: + * return PyDataType_ELSIZE(self) +*/ + +static CYTHON_INLINE npy_intp __pyx_f_5numpy_5dtype_8itemsize_itemsize(PyArray_Descr *__pyx_v_self) { + npy_intp __pyx_r; + + /* "C:/Users/runneradmin/AppData/Local/Temp/build-env-ej_q3m8u/Lib/site-packages/numpy/__init__.cython-30.pxd":244 + * @property + * cdef inline npy_intp itemsize(self) noexcept nogil: + * return PyDataType_ELSIZE(self) # <<<<<<<<<<<<<< + * + * @property +*/ + __pyx_r = PyDataType_ELSIZE(__pyx_v_self); + goto __pyx_L0; + + /* "C:/Users/runneradmin/AppData/Local/Temp/build-env-ej_q3m8u/Lib/site-packages/numpy/__init__.cython-30.pxd":242 + * cdef int type_num + * + * @property # <<<<<<<<<<<<<< + * cdef inline npy_intp itemsize(self) noexcept nogil: + * return PyDataType_ELSIZE(self) +*/ + + /* function exit code */ + __pyx_L0:; + return __pyx_r; +} + +/* "C:/Users/runneradmin/AppData/Local/Temp/build-env-ej_q3m8u/Lib/site-packages/numpy/__init__.cython-30.pxd":246 + * return PyDataType_ELSIZE(self) + * + * @property # <<<<<<<<<<<<<< + * cdef inline npy_intp alignment(self) noexcept nogil: + * return PyDataType_ALIGNMENT(self) +*/ + +static CYTHON_INLINE npy_intp __pyx_f_5numpy_5dtype_9alignment_alignment(PyArray_Descr *__pyx_v_self) { + npy_intp __pyx_r; + + /* "C:/Users/runneradmin/AppData/Local/Temp/build-env-ej_q3m8u/Lib/site-packages/numpy/__init__.cython-30.pxd":248 + * @property + * cdef inline npy_intp alignment(self) noexcept nogil: + * return PyDataType_ALIGNMENT(self) # <<<<<<<<<<<<<< + * + * # Use fields/names with care as they may be NULL. You must check +*/ + __pyx_r = PyDataType_ALIGNMENT(__pyx_v_self); + goto __pyx_L0; + + /* "C:/Users/runneradmin/AppData/Local/Temp/build-env-ej_q3m8u/Lib/site-packages/numpy/__init__.cython-30.pxd":246 + * return PyDataType_ELSIZE(self) + * + * @property # <<<<<<<<<<<<<< + * cdef inline npy_intp alignment(self) noexcept nogil: + * return PyDataType_ALIGNMENT(self) +*/ + + /* function exit code */ + __pyx_L0:; + return __pyx_r; +} + +/* "C:/Users/runneradmin/AppData/Local/Temp/build-env-ej_q3m8u/Lib/site-packages/numpy/__init__.cython-30.pxd":252 + * # Use fields/names with care as they may be NULL. You must check + * # for this using PyDataType_HASFIELDS. + * @property # <<<<<<<<<<<<<< + * cdef inline object fields(self): + * return PyDataType_FIELDS(self) +*/ + +static CYTHON_INLINE PyObject *__pyx_f_5numpy_5dtype_6fields_fields(PyArray_Descr *__pyx_v_self) { + PyObject *__pyx_r = NULL; + __Pyx_RefNannyDeclarations + PyObject *__pyx_t_1; + __Pyx_RefNannySetupContext("fields", 0); + + /* "C:/Users/runneradmin/AppData/Local/Temp/build-env-ej_q3m8u/Lib/site-packages/numpy/__init__.cython-30.pxd":254 + * @property + * cdef inline object fields(self): + * return PyDataType_FIELDS(self) # <<<<<<<<<<<<<< + * + * @property +*/ + __Pyx_XDECREF(__pyx_r); + __pyx_t_1 = PyDataType_FIELDS(__pyx_v_self); + __Pyx_INCREF(((PyObject *)__pyx_t_1)); + __pyx_r = ((PyObject *)__pyx_t_1); + goto __pyx_L0; + + /* "C:/Users/runneradmin/AppData/Local/Temp/build-env-ej_q3m8u/Lib/site-packages/numpy/__init__.cython-30.pxd":252 + * # Use fields/names with care as they may be NULL. You must check + * # for this using PyDataType_HASFIELDS. + * @property # <<<<<<<<<<<<<< + * cdef inline object fields(self): + * return PyDataType_FIELDS(self) +*/ + + /* function exit code */ + __pyx_L0:; + __Pyx_XGIVEREF(__pyx_r); + __Pyx_RefNannyFinishContext(); + return __pyx_r; +} + +/* "C:/Users/runneradmin/AppData/Local/Temp/build-env-ej_q3m8u/Lib/site-packages/numpy/__init__.cython-30.pxd":256 + * return PyDataType_FIELDS(self) + * + * @property # <<<<<<<<<<<<<< + * cdef inline tuple names(self): + * return PyDataType_NAMES(self) +*/ + +static CYTHON_INLINE PyObject *__pyx_f_5numpy_5dtype_5names_names(PyArray_Descr *__pyx_v_self) { + PyObject *__pyx_r = NULL; + __Pyx_RefNannyDeclarations + PyObject *__pyx_t_1; + __Pyx_RefNannySetupContext("names", 0); + + /* "C:/Users/runneradmin/AppData/Local/Temp/build-env-ej_q3m8u/Lib/site-packages/numpy/__init__.cython-30.pxd":258 + * @property + * cdef inline tuple names(self): + * return PyDataType_NAMES(self) # <<<<<<<<<<<<<< + * + * # Use PyDataType_HASSUBARRAY to test whether this field is +*/ + __Pyx_XDECREF(__pyx_r); + __pyx_t_1 = PyDataType_NAMES(__pyx_v_self); + __Pyx_INCREF(((PyObject*)__pyx_t_1)); + __pyx_r = ((PyObject*)__pyx_t_1); + goto __pyx_L0; + + /* "C:/Users/runneradmin/AppData/Local/Temp/build-env-ej_q3m8u/Lib/site-packages/numpy/__init__.cython-30.pxd":256 + * return PyDataType_FIELDS(self) + * + * @property # <<<<<<<<<<<<<< + * cdef inline tuple names(self): + * return PyDataType_NAMES(self) +*/ + + /* function exit code */ + __pyx_L0:; + __Pyx_XGIVEREF(__pyx_r); + __Pyx_RefNannyFinishContext(); + return __pyx_r; +} + +/* "C:/Users/runneradmin/AppData/Local/Temp/build-env-ej_q3m8u/Lib/site-packages/numpy/__init__.cython-30.pxd":263 + * # valid (the pointer can be NULL). Most users should access + * # this field via the inline helper method PyDataType_SHAPE. + * @property # <<<<<<<<<<<<<< + * cdef inline PyArray_ArrayDescr* subarray(self) noexcept nogil: + * return PyDataType_SUBARRAY(self) +*/ + +static CYTHON_INLINE PyArray_ArrayDescr *__pyx_f_5numpy_5dtype_8subarray_subarray(PyArray_Descr *__pyx_v_self) { + PyArray_ArrayDescr *__pyx_r; + + /* "C:/Users/runneradmin/AppData/Local/Temp/build-env-ej_q3m8u/Lib/site-packages/numpy/__init__.cython-30.pxd":265 + * @property + * cdef inline PyArray_ArrayDescr* subarray(self) noexcept nogil: + * return PyDataType_SUBARRAY(self) # <<<<<<<<<<<<<< + * + * @property +*/ + __pyx_r = PyDataType_SUBARRAY(__pyx_v_self); + goto __pyx_L0; + + /* "C:/Users/runneradmin/AppData/Local/Temp/build-env-ej_q3m8u/Lib/site-packages/numpy/__init__.cython-30.pxd":263 + * # valid (the pointer can be NULL). Most users should access + * # this field via the inline helper method PyDataType_SHAPE. + * @property # <<<<<<<<<<<<<< + * cdef inline PyArray_ArrayDescr* subarray(self) noexcept nogil: + * return PyDataType_SUBARRAY(self) +*/ + + /* function exit code */ + __pyx_L0:; + return __pyx_r; +} + +/* "C:/Users/runneradmin/AppData/Local/Temp/build-env-ej_q3m8u/Lib/site-packages/numpy/__init__.cython-30.pxd":267 + * return PyDataType_SUBARRAY(self) + * + * @property # <<<<<<<<<<<<<< + * cdef inline npy_uint64 flags(self) noexcept nogil: + * """The data types flags.""" +*/ + +static CYTHON_INLINE npy_uint64 __pyx_f_5numpy_5dtype_5flags_flags(PyArray_Descr *__pyx_v_self) { + npy_uint64 __pyx_r; + + /* "C:/Users/runneradmin/AppData/Local/Temp/build-env-ej_q3m8u/Lib/site-packages/numpy/__init__.cython-30.pxd":270 + * cdef inline npy_uint64 flags(self) noexcept nogil: + * """The data types flags.""" + * return PyDataType_FLAGS(self) # <<<<<<<<<<<<<< + * + * +*/ + __pyx_r = PyDataType_FLAGS(__pyx_v_self); + goto __pyx_L0; + + /* "C:/Users/runneradmin/AppData/Local/Temp/build-env-ej_q3m8u/Lib/site-packages/numpy/__init__.cython-30.pxd":267 + * return PyDataType_SUBARRAY(self) + * + * @property # <<<<<<<<<<<<<< + * cdef inline npy_uint64 flags(self) noexcept nogil: + * """The data types flags.""" +*/ + + /* function exit code */ + __pyx_L0:; + return __pyx_r; +} + +/* "C:/Users/runneradmin/AppData/Local/Temp/build-env-ej_q3m8u/Lib/site-packages/numpy/__init__.cython-30.pxd":279 + * ctypedef class numpy.broadcast [object PyArrayMultiIterObject, check_size ignore]: + * + * @property # <<<<<<<<<<<<<< + * cdef inline int numiter(self) noexcept nogil: + * """The number of arrays that need to be broadcast to the same shape.""" +*/ + +static CYTHON_INLINE int __pyx_f_5numpy_9broadcast_7numiter_numiter(PyArrayMultiIterObject *__pyx_v_self) { + int __pyx_r; + + /* "C:/Users/runneradmin/AppData/Local/Temp/build-env-ej_q3m8u/Lib/site-packages/numpy/__init__.cython-30.pxd":282 + * cdef inline int numiter(self) noexcept nogil: + * """The number of arrays that need to be broadcast to the same shape.""" + * return PyArray_MultiIter_NUMITER(self) # <<<<<<<<<<<<<< + * + * @property +*/ + __pyx_r = PyArray_MultiIter_NUMITER(__pyx_v_self); + goto __pyx_L0; + + /* "C:/Users/runneradmin/AppData/Local/Temp/build-env-ej_q3m8u/Lib/site-packages/numpy/__init__.cython-30.pxd":279 + * ctypedef class numpy.broadcast [object PyArrayMultiIterObject, check_size ignore]: + * + * @property # <<<<<<<<<<<<<< + * cdef inline int numiter(self) noexcept nogil: + * """The number of arrays that need to be broadcast to the same shape.""" +*/ + + /* function exit code */ + __pyx_L0:; + return __pyx_r; +} + +/* "C:/Users/runneradmin/AppData/Local/Temp/build-env-ej_q3m8u/Lib/site-packages/numpy/__init__.cython-30.pxd":284 + * return PyArray_MultiIter_NUMITER(self) + * + * @property # <<<<<<<<<<<<<< + * cdef inline npy_intp size(self) noexcept nogil: + * """The total broadcasted size.""" +*/ + +static CYTHON_INLINE npy_intp __pyx_f_5numpy_9broadcast_4size_size(PyArrayMultiIterObject *__pyx_v_self) { + npy_intp __pyx_r; + + /* "C:/Users/runneradmin/AppData/Local/Temp/build-env-ej_q3m8u/Lib/site-packages/numpy/__init__.cython-30.pxd":287 + * cdef inline npy_intp size(self) noexcept nogil: + * """The total broadcasted size.""" + * return PyArray_MultiIter_SIZE(self) # <<<<<<<<<<<<<< + * + * @property +*/ + __pyx_r = PyArray_MultiIter_SIZE(__pyx_v_self); + goto __pyx_L0; + + /* "C:/Users/runneradmin/AppData/Local/Temp/build-env-ej_q3m8u/Lib/site-packages/numpy/__init__.cython-30.pxd":284 + * return PyArray_MultiIter_NUMITER(self) + * + * @property # <<<<<<<<<<<<<< + * cdef inline npy_intp size(self) noexcept nogil: + * """The total broadcasted size.""" +*/ + + /* function exit code */ + __pyx_L0:; + return __pyx_r; +} + +/* "C:/Users/runneradmin/AppData/Local/Temp/build-env-ej_q3m8u/Lib/site-packages/numpy/__init__.cython-30.pxd":289 + * return PyArray_MultiIter_SIZE(self) + * + * @property # <<<<<<<<<<<<<< + * cdef inline npy_intp index(self) noexcept nogil: + * """The current (1-d) index into the broadcasted result.""" +*/ + +static CYTHON_INLINE npy_intp __pyx_f_5numpy_9broadcast_5index_index(PyArrayMultiIterObject *__pyx_v_self) { + npy_intp __pyx_r; + + /* "C:/Users/runneradmin/AppData/Local/Temp/build-env-ej_q3m8u/Lib/site-packages/numpy/__init__.cython-30.pxd":292 + * cdef inline npy_intp index(self) noexcept nogil: + * """The current (1-d) index into the broadcasted result.""" + * return PyArray_MultiIter_INDEX(self) # <<<<<<<<<<<<<< + * + * @property +*/ + __pyx_r = PyArray_MultiIter_INDEX(__pyx_v_self); + goto __pyx_L0; + + /* "C:/Users/runneradmin/AppData/Local/Temp/build-env-ej_q3m8u/Lib/site-packages/numpy/__init__.cython-30.pxd":289 + * return PyArray_MultiIter_SIZE(self) + * + * @property # <<<<<<<<<<<<<< + * cdef inline npy_intp index(self) noexcept nogil: + * """The current (1-d) index into the broadcasted result.""" +*/ + + /* function exit code */ + __pyx_L0:; + return __pyx_r; +} + +/* "C:/Users/runneradmin/AppData/Local/Temp/build-env-ej_q3m8u/Lib/site-packages/numpy/__init__.cython-30.pxd":294 + * return PyArray_MultiIter_INDEX(self) + * + * @property # <<<<<<<<<<<<<< + * cdef inline int nd(self) noexcept nogil: + * """The number of dimensions in the broadcasted result.""" +*/ + +static CYTHON_INLINE int __pyx_f_5numpy_9broadcast_2nd_nd(PyArrayMultiIterObject *__pyx_v_self) { + int __pyx_r; + + /* "C:/Users/runneradmin/AppData/Local/Temp/build-env-ej_q3m8u/Lib/site-packages/numpy/__init__.cython-30.pxd":297 + * cdef inline int nd(self) noexcept nogil: + * """The number of dimensions in the broadcasted result.""" + * return PyArray_MultiIter_NDIM(self) # <<<<<<<<<<<<<< + * + * @property +*/ + __pyx_r = PyArray_MultiIter_NDIM(__pyx_v_self); + goto __pyx_L0; + + /* "C:/Users/runneradmin/AppData/Local/Temp/build-env-ej_q3m8u/Lib/site-packages/numpy/__init__.cython-30.pxd":294 + * return PyArray_MultiIter_INDEX(self) + * + * @property # <<<<<<<<<<<<<< + * cdef inline int nd(self) noexcept nogil: + * """The number of dimensions in the broadcasted result.""" +*/ + + /* function exit code */ + __pyx_L0:; + return __pyx_r; +} + +/* "C:/Users/runneradmin/AppData/Local/Temp/build-env-ej_q3m8u/Lib/site-packages/numpy/__init__.cython-30.pxd":299 + * return PyArray_MultiIter_NDIM(self) + * + * @property # <<<<<<<<<<<<<< + * cdef inline npy_intp* dimensions(self) noexcept nogil: + * """The shape of the broadcasted result.""" +*/ + +static CYTHON_INLINE npy_intp *__pyx_f_5numpy_9broadcast_10dimensions_dimensions(PyArrayMultiIterObject *__pyx_v_self) { + npy_intp *__pyx_r; + + /* "C:/Users/runneradmin/AppData/Local/Temp/build-env-ej_q3m8u/Lib/site-packages/numpy/__init__.cython-30.pxd":302 + * cdef inline npy_intp* dimensions(self) noexcept nogil: + * """The shape of the broadcasted result.""" + * return PyArray_MultiIter_DIMS(self) # <<<<<<<<<<<<<< + * + * @property +*/ + __pyx_r = PyArray_MultiIter_DIMS(__pyx_v_self); + goto __pyx_L0; + + /* "C:/Users/runneradmin/AppData/Local/Temp/build-env-ej_q3m8u/Lib/site-packages/numpy/__init__.cython-30.pxd":299 + * return PyArray_MultiIter_NDIM(self) + * + * @property # <<<<<<<<<<<<<< + * cdef inline npy_intp* dimensions(self) noexcept nogil: + * """The shape of the broadcasted result.""" +*/ + + /* function exit code */ + __pyx_L0:; + return __pyx_r; +} + +/* "C:/Users/runneradmin/AppData/Local/Temp/build-env-ej_q3m8u/Lib/site-packages/numpy/__init__.cython-30.pxd":304 + * return PyArray_MultiIter_DIMS(self) + * + * @property # <<<<<<<<<<<<<< + * cdef inline void** iters(self) noexcept nogil: + * """An array of iterator objects that holds the iterators for the arrays to be broadcast together. +*/ + +static CYTHON_INLINE void **__pyx_f_5numpy_9broadcast_5iters_iters(PyArrayMultiIterObject *__pyx_v_self) { + void **__pyx_r; + + /* "C:/Users/runneradmin/AppData/Local/Temp/build-env-ej_q3m8u/Lib/site-packages/numpy/__init__.cython-30.pxd":308 + * """An array of iterator objects that holds the iterators for the arrays to be broadcast together. + * On return, the iterators are adjusted for broadcasting.""" + * return PyArray_MultiIter_ITERS(self) # <<<<<<<<<<<<<< + * + * +*/ + __pyx_r = PyArray_MultiIter_ITERS(__pyx_v_self); + goto __pyx_L0; + + /* "C:/Users/runneradmin/AppData/Local/Temp/build-env-ej_q3m8u/Lib/site-packages/numpy/__init__.cython-30.pxd":304 + * return PyArray_MultiIter_DIMS(self) + * + * @property # <<<<<<<<<<<<<< + * cdef inline void** iters(self) noexcept nogil: + * """An array of iterator objects that holds the iterators for the arrays to be broadcast together. +*/ + + /* function exit code */ + __pyx_L0:; + return __pyx_r; +} + +/* "C:/Users/runneradmin/AppData/Local/Temp/build-env-ej_q3m8u/Lib/site-packages/numpy/__init__.cython-30.pxd":322 + * # Instead, we use properties that map to the corresponding C-API functions. + * + * @property # <<<<<<<<<<<<<< + * cdef inline PyObject* base(self) noexcept nogil: + * """Returns a borrowed reference to the object owning the data/memory. +*/ + +static CYTHON_INLINE PyObject *__pyx_f_5numpy_7ndarray_4base_base(PyArrayObject *__pyx_v_self) { + PyObject *__pyx_r; + + /* "C:/Users/runneradmin/AppData/Local/Temp/build-env-ej_q3m8u/Lib/site-packages/numpy/__init__.cython-30.pxd":326 + * """Returns a borrowed reference to the object owning the data/memory. + * """ + * return PyArray_BASE(self) # <<<<<<<<<<<<<< + * + * @property +*/ + __pyx_r = PyArray_BASE(__pyx_v_self); + goto __pyx_L0; + + /* "C:/Users/runneradmin/AppData/Local/Temp/build-env-ej_q3m8u/Lib/site-packages/numpy/__init__.cython-30.pxd":322 + * # Instead, we use properties that map to the corresponding C-API functions. + * + * @property # <<<<<<<<<<<<<< + * cdef inline PyObject* base(self) noexcept nogil: + * """Returns a borrowed reference to the object owning the data/memory. +*/ + + /* function exit code */ + __pyx_L0:; + return __pyx_r; +} + +/* "C:/Users/runneradmin/AppData/Local/Temp/build-env-ej_q3m8u/Lib/site-packages/numpy/__init__.cython-30.pxd":328 + * return PyArray_BASE(self) + * + * @property # <<<<<<<<<<<<<< + * cdef inline dtype descr(self): + * """Returns an owned reference to the dtype of the array. +*/ + +static CYTHON_INLINE PyArray_Descr *__pyx_f_5numpy_7ndarray_5descr_descr(PyArrayObject *__pyx_v_self) { + PyArray_Descr *__pyx_r = NULL; + __Pyx_RefNannyDeclarations + PyArray_Descr *__pyx_t_1; + __Pyx_RefNannySetupContext("descr", 0); + + /* "C:/Users/runneradmin/AppData/Local/Temp/build-env-ej_q3m8u/Lib/site-packages/numpy/__init__.cython-30.pxd":332 + * """Returns an owned reference to the dtype of the array. + * """ + * return PyArray_DESCR(self) # <<<<<<<<<<<<<< + * + * @property +*/ + __Pyx_XDECREF((PyObject *)__pyx_r); + __pyx_t_1 = PyArray_DESCR(__pyx_v_self); + __Pyx_INCREF((PyObject *)((PyArray_Descr *)__pyx_t_1)); + __pyx_r = ((PyArray_Descr *)__pyx_t_1); + goto __pyx_L0; + + /* "C:/Users/runneradmin/AppData/Local/Temp/build-env-ej_q3m8u/Lib/site-packages/numpy/__init__.cython-30.pxd":328 + * return PyArray_BASE(self) + * + * @property # <<<<<<<<<<<<<< + * cdef inline dtype descr(self): + * """Returns an owned reference to the dtype of the array. +*/ + + /* function exit code */ + __pyx_L0:; + __Pyx_XGIVEREF((PyObject *)__pyx_r); + __Pyx_RefNannyFinishContext(); + return __pyx_r; +} + +/* "C:/Users/runneradmin/AppData/Local/Temp/build-env-ej_q3m8u/Lib/site-packages/numpy/__init__.cython-30.pxd":334 + * return PyArray_DESCR(self) + * + * @property # <<<<<<<<<<<<<< + * cdef inline int ndim(self) noexcept nogil: + * """Returns the number of dimensions in the array. +*/ + +static CYTHON_INLINE int __pyx_f_5numpy_7ndarray_4ndim_ndim(PyArrayObject *__pyx_v_self) { + int __pyx_r; + + /* "C:/Users/runneradmin/AppData/Local/Temp/build-env-ej_q3m8u/Lib/site-packages/numpy/__init__.cython-30.pxd":338 + * """Returns the number of dimensions in the array. + * """ + * return PyArray_NDIM(self) # <<<<<<<<<<<<<< + * + * @property +*/ + __pyx_r = PyArray_NDIM(__pyx_v_self); + goto __pyx_L0; + + /* "C:/Users/runneradmin/AppData/Local/Temp/build-env-ej_q3m8u/Lib/site-packages/numpy/__init__.cython-30.pxd":334 + * return PyArray_DESCR(self) + * + * @property # <<<<<<<<<<<<<< + * cdef inline int ndim(self) noexcept nogil: + * """Returns the number of dimensions in the array. +*/ + + /* function exit code */ + __pyx_L0:; + return __pyx_r; +} + +/* "C:/Users/runneradmin/AppData/Local/Temp/build-env-ej_q3m8u/Lib/site-packages/numpy/__init__.cython-30.pxd":340 + * return PyArray_NDIM(self) + * + * @property # <<<<<<<<<<<<<< + * cdef inline npy_intp *shape(self) noexcept nogil: + * """Returns a pointer to the dimensions/shape of the array. +*/ + +static CYTHON_INLINE npy_intp *__pyx_f_5numpy_7ndarray_5shape_shape(PyArrayObject *__pyx_v_self) { + npy_intp *__pyx_r; + + /* "C:/Users/runneradmin/AppData/Local/Temp/build-env-ej_q3m8u/Lib/site-packages/numpy/__init__.cython-30.pxd":346 + * Can return NULL for 0-dimensional arrays. + * """ + * return PyArray_DIMS(self) # <<<<<<<<<<<<<< + * + * @property +*/ + __pyx_r = PyArray_DIMS(__pyx_v_self); + goto __pyx_L0; + + /* "C:/Users/runneradmin/AppData/Local/Temp/build-env-ej_q3m8u/Lib/site-packages/numpy/__init__.cython-30.pxd":340 + * return PyArray_NDIM(self) + * + * @property # <<<<<<<<<<<<<< + * cdef inline npy_intp *shape(self) noexcept nogil: + * """Returns a pointer to the dimensions/shape of the array. +*/ + + /* function exit code */ + __pyx_L0:; + return __pyx_r; +} + +/* "C:/Users/runneradmin/AppData/Local/Temp/build-env-ej_q3m8u/Lib/site-packages/numpy/__init__.cython-30.pxd":348 + * return PyArray_DIMS(self) + * + * @property # <<<<<<<<<<<<<< + * cdef inline npy_intp *strides(self) noexcept nogil: + * """Returns a pointer to the strides of the array. +*/ + +static CYTHON_INLINE npy_intp *__pyx_f_5numpy_7ndarray_7strides_strides(PyArrayObject *__pyx_v_self) { + npy_intp *__pyx_r; + + /* "C:/Users/runneradmin/AppData/Local/Temp/build-env-ej_q3m8u/Lib/site-packages/numpy/__init__.cython-30.pxd":353 + * The number of elements matches the number of dimensions of the array (ndim). + * """ + * return PyArray_STRIDES(self) # <<<<<<<<<<<<<< + * + * @property +*/ + __pyx_r = PyArray_STRIDES(__pyx_v_self); + goto __pyx_L0; + + /* "C:/Users/runneradmin/AppData/Local/Temp/build-env-ej_q3m8u/Lib/site-packages/numpy/__init__.cython-30.pxd":348 + * return PyArray_DIMS(self) + * + * @property # <<<<<<<<<<<<<< + * cdef inline npy_intp *strides(self) noexcept nogil: + * """Returns a pointer to the strides of the array. +*/ + + /* function exit code */ + __pyx_L0:; + return __pyx_r; +} + +/* "C:/Users/runneradmin/AppData/Local/Temp/build-env-ej_q3m8u/Lib/site-packages/numpy/__init__.cython-30.pxd":355 + * return PyArray_STRIDES(self) + * + * @property # <<<<<<<<<<<<<< + * cdef inline npy_intp size(self) noexcept nogil: + * """Returns the total size (in number of elements) of the array. +*/ + +static CYTHON_INLINE npy_intp __pyx_f_5numpy_7ndarray_4size_size(PyArrayObject *__pyx_v_self) { + npy_intp __pyx_r; + + /* "C:/Users/runneradmin/AppData/Local/Temp/build-env-ej_q3m8u/Lib/site-packages/numpy/__init__.cython-30.pxd":359 + * """Returns the total size (in number of elements) of the array. + * """ + * return PyArray_SIZE(self) # <<<<<<<<<<<<<< + * + * @property +*/ + __pyx_r = PyArray_SIZE(__pyx_v_self); + goto __pyx_L0; + + /* "C:/Users/runneradmin/AppData/Local/Temp/build-env-ej_q3m8u/Lib/site-packages/numpy/__init__.cython-30.pxd":355 + * return PyArray_STRIDES(self) + * + * @property # <<<<<<<<<<<<<< + * cdef inline npy_intp size(self) noexcept nogil: + * """Returns the total size (in number of elements) of the array. +*/ + + /* function exit code */ + __pyx_L0:; + return __pyx_r; +} + +/* "C:/Users/runneradmin/AppData/Local/Temp/build-env-ej_q3m8u/Lib/site-packages/numpy/__init__.cython-30.pxd":361 + * return PyArray_SIZE(self) + * + * @property # <<<<<<<<<<<<<< + * cdef inline char* data(self) noexcept nogil: + * """The pointer to the data buffer as a char*. +*/ + +static CYTHON_INLINE char *__pyx_f_5numpy_7ndarray_4data_data(PyArrayObject *__pyx_v_self) { + char *__pyx_r; + + /* "C:/Users/runneradmin/AppData/Local/Temp/build-env-ej_q3m8u/Lib/site-packages/numpy/__init__.cython-30.pxd":368 + * of `PyArray_DATA()` instead, which returns a 'void*'. + * """ + * return PyArray_BYTES(self) # <<<<<<<<<<<<<< + * + * +*/ + __pyx_r = PyArray_BYTES(__pyx_v_self); + goto __pyx_L0; + + /* "C:/Users/runneradmin/AppData/Local/Temp/build-env-ej_q3m8u/Lib/site-packages/numpy/__init__.cython-30.pxd":361 + * return PyArray_SIZE(self) + * + * @property # <<<<<<<<<<<<<< + * cdef inline char* data(self) noexcept nogil: + * """The pointer to the data buffer as a char*. +*/ + + /* function exit code */ + __pyx_L0:; + return __pyx_r; +} + +/* "C:/Users/runneradmin/AppData/Local/Temp/build-env-ej_q3m8u/Lib/site-packages/numpy/__init__.cython-30.pxd":776 + * ctypedef long double complex clongdouble_t + * + * cdef inline object PyArray_MultiIterNew1(a): # <<<<<<<<<<<<<< + * return PyArray_MultiIterNew(1, a) + * +*/ + +static CYTHON_INLINE PyObject *__pyx_f_5numpy_PyArray_MultiIterNew1(PyObject *__pyx_v_a) { + PyObject *__pyx_r = NULL; + __Pyx_RefNannyDeclarations + PyObject *__pyx_t_1 = NULL; + int __pyx_lineno = 0; + const char *__pyx_filename = NULL; + int __pyx_clineno = 0; + __Pyx_RefNannySetupContext("PyArray_MultiIterNew1", 0); + + /* "C:/Users/runneradmin/AppData/Local/Temp/build-env-ej_q3m8u/Lib/site-packages/numpy/__init__.cython-30.pxd":777 + * + * cdef inline object PyArray_MultiIterNew1(a): + * return PyArray_MultiIterNew(1, a) # <<<<<<<<<<<<<< + * + * cdef inline object PyArray_MultiIterNew2(a, b): +*/ + __Pyx_XDECREF(__pyx_r); + __pyx_t_1 = PyArray_MultiIterNew(1, ((void *)__pyx_v_a)); if (unlikely(!__pyx_t_1)) __PYX_ERR(2, 777, __pyx_L1_error) + __Pyx_GOTREF(__pyx_t_1); + __pyx_r = __pyx_t_1; + __pyx_t_1 = 0; + goto __pyx_L0; + + /* "C:/Users/runneradmin/AppData/Local/Temp/build-env-ej_q3m8u/Lib/site-packages/numpy/__init__.cython-30.pxd":776 + * ctypedef long double complex clongdouble_t + * + * cdef inline object PyArray_MultiIterNew1(a): # <<<<<<<<<<<<<< + * return PyArray_MultiIterNew(1, a) + * +*/ + + /* function exit code */ + __pyx_L1_error:; + __Pyx_XDECREF(__pyx_t_1); + __Pyx_AddTraceback("numpy.PyArray_MultiIterNew1", __pyx_clineno, __pyx_lineno, __pyx_filename); + __pyx_r = 0; + __pyx_L0:; + __Pyx_XGIVEREF(__pyx_r); + __Pyx_RefNannyFinishContext(); + return __pyx_r; +} + +/* "C:/Users/runneradmin/AppData/Local/Temp/build-env-ej_q3m8u/Lib/site-packages/numpy/__init__.cython-30.pxd":779 + * return PyArray_MultiIterNew(1, a) + * + * cdef inline object PyArray_MultiIterNew2(a, b): # <<<<<<<<<<<<<< + * return PyArray_MultiIterNew(2, a, b) + * +*/ + +static CYTHON_INLINE PyObject *__pyx_f_5numpy_PyArray_MultiIterNew2(PyObject *__pyx_v_a, PyObject *__pyx_v_b) { + PyObject *__pyx_r = NULL; + __Pyx_RefNannyDeclarations + PyObject *__pyx_t_1 = NULL; + int __pyx_lineno = 0; + const char *__pyx_filename = NULL; + int __pyx_clineno = 0; + __Pyx_RefNannySetupContext("PyArray_MultiIterNew2", 0); + + /* "C:/Users/runneradmin/AppData/Local/Temp/build-env-ej_q3m8u/Lib/site-packages/numpy/__init__.cython-30.pxd":780 + * + * cdef inline object PyArray_MultiIterNew2(a, b): + * return PyArray_MultiIterNew(2, a, b) # <<<<<<<<<<<<<< + * + * cdef inline object PyArray_MultiIterNew3(a, b, c): +*/ + __Pyx_XDECREF(__pyx_r); + __pyx_t_1 = PyArray_MultiIterNew(2, ((void *)__pyx_v_a), ((void *)__pyx_v_b)); if (unlikely(!__pyx_t_1)) __PYX_ERR(2, 780, __pyx_L1_error) + __Pyx_GOTREF(__pyx_t_1); + __pyx_r = __pyx_t_1; + __pyx_t_1 = 0; + goto __pyx_L0; + + /* "C:/Users/runneradmin/AppData/Local/Temp/build-env-ej_q3m8u/Lib/site-packages/numpy/__init__.cython-30.pxd":779 + * return PyArray_MultiIterNew(1, a) + * + * cdef inline object PyArray_MultiIterNew2(a, b): # <<<<<<<<<<<<<< + * return PyArray_MultiIterNew(2, a, b) + * +*/ + + /* function exit code */ + __pyx_L1_error:; + __Pyx_XDECREF(__pyx_t_1); + __Pyx_AddTraceback("numpy.PyArray_MultiIterNew2", __pyx_clineno, __pyx_lineno, __pyx_filename); + __pyx_r = 0; + __pyx_L0:; + __Pyx_XGIVEREF(__pyx_r); + __Pyx_RefNannyFinishContext(); + return __pyx_r; +} + +/* "C:/Users/runneradmin/AppData/Local/Temp/build-env-ej_q3m8u/Lib/site-packages/numpy/__init__.cython-30.pxd":782 + * return PyArray_MultiIterNew(2, a, b) + * + * cdef inline object PyArray_MultiIterNew3(a, b, c): # <<<<<<<<<<<<<< + * return PyArray_MultiIterNew(3, a, b, c) + * +*/ + +static CYTHON_INLINE PyObject *__pyx_f_5numpy_PyArray_MultiIterNew3(PyObject *__pyx_v_a, PyObject *__pyx_v_b, PyObject *__pyx_v_c) { + PyObject *__pyx_r = NULL; + __Pyx_RefNannyDeclarations + PyObject *__pyx_t_1 = NULL; + int __pyx_lineno = 0; + const char *__pyx_filename = NULL; + int __pyx_clineno = 0; + __Pyx_RefNannySetupContext("PyArray_MultiIterNew3", 0); + + /* "C:/Users/runneradmin/AppData/Local/Temp/build-env-ej_q3m8u/Lib/site-packages/numpy/__init__.cython-30.pxd":783 + * + * cdef inline object PyArray_MultiIterNew3(a, b, c): + * return PyArray_MultiIterNew(3, a, b, c) # <<<<<<<<<<<<<< + * + * cdef inline object PyArray_MultiIterNew4(a, b, c, d): +*/ + __Pyx_XDECREF(__pyx_r); + __pyx_t_1 = PyArray_MultiIterNew(3, ((void *)__pyx_v_a), ((void *)__pyx_v_b), ((void *)__pyx_v_c)); if (unlikely(!__pyx_t_1)) __PYX_ERR(2, 783, __pyx_L1_error) + __Pyx_GOTREF(__pyx_t_1); + __pyx_r = __pyx_t_1; + __pyx_t_1 = 0; + goto __pyx_L0; + + /* "C:/Users/runneradmin/AppData/Local/Temp/build-env-ej_q3m8u/Lib/site-packages/numpy/__init__.cython-30.pxd":782 + * return PyArray_MultiIterNew(2, a, b) + * + * cdef inline object PyArray_MultiIterNew3(a, b, c): # <<<<<<<<<<<<<< + * return PyArray_MultiIterNew(3, a, b, c) + * +*/ + + /* function exit code */ + __pyx_L1_error:; + __Pyx_XDECREF(__pyx_t_1); + __Pyx_AddTraceback("numpy.PyArray_MultiIterNew3", __pyx_clineno, __pyx_lineno, __pyx_filename); + __pyx_r = 0; + __pyx_L0:; + __Pyx_XGIVEREF(__pyx_r); + __Pyx_RefNannyFinishContext(); + return __pyx_r; +} + +/* "C:/Users/runneradmin/AppData/Local/Temp/build-env-ej_q3m8u/Lib/site-packages/numpy/__init__.cython-30.pxd":785 + * return PyArray_MultiIterNew(3, a, b, c) + * + * cdef inline object PyArray_MultiIterNew4(a, b, c, d): # <<<<<<<<<<<<<< + * return PyArray_MultiIterNew(4, a, b, c, d) + * +*/ + +static CYTHON_INLINE PyObject *__pyx_f_5numpy_PyArray_MultiIterNew4(PyObject *__pyx_v_a, PyObject *__pyx_v_b, PyObject *__pyx_v_c, PyObject *__pyx_v_d) { + PyObject *__pyx_r = NULL; + __Pyx_RefNannyDeclarations + PyObject *__pyx_t_1 = NULL; + int __pyx_lineno = 0; + const char *__pyx_filename = NULL; + int __pyx_clineno = 0; + __Pyx_RefNannySetupContext("PyArray_MultiIterNew4", 0); + + /* "C:/Users/runneradmin/AppData/Local/Temp/build-env-ej_q3m8u/Lib/site-packages/numpy/__init__.cython-30.pxd":786 + * + * cdef inline object PyArray_MultiIterNew4(a, b, c, d): + * return PyArray_MultiIterNew(4, a, b, c, d) # <<<<<<<<<<<<<< + * + * cdef inline object PyArray_MultiIterNew5(a, b, c, d, e): +*/ + __Pyx_XDECREF(__pyx_r); + __pyx_t_1 = PyArray_MultiIterNew(4, ((void *)__pyx_v_a), ((void *)__pyx_v_b), ((void *)__pyx_v_c), ((void *)__pyx_v_d)); if (unlikely(!__pyx_t_1)) __PYX_ERR(2, 786, __pyx_L1_error) + __Pyx_GOTREF(__pyx_t_1); + __pyx_r = __pyx_t_1; + __pyx_t_1 = 0; + goto __pyx_L0; + + /* "C:/Users/runneradmin/AppData/Local/Temp/build-env-ej_q3m8u/Lib/site-packages/numpy/__init__.cython-30.pxd":785 + * return PyArray_MultiIterNew(3, a, b, c) + * + * cdef inline object PyArray_MultiIterNew4(a, b, c, d): # <<<<<<<<<<<<<< + * return PyArray_MultiIterNew(4, a, b, c, d) + * +*/ + + /* function exit code */ + __pyx_L1_error:; + __Pyx_XDECREF(__pyx_t_1); + __Pyx_AddTraceback("numpy.PyArray_MultiIterNew4", __pyx_clineno, __pyx_lineno, __pyx_filename); + __pyx_r = 0; + __pyx_L0:; + __Pyx_XGIVEREF(__pyx_r); + __Pyx_RefNannyFinishContext(); + return __pyx_r; +} + +/* "C:/Users/runneradmin/AppData/Local/Temp/build-env-ej_q3m8u/Lib/site-packages/numpy/__init__.cython-30.pxd":788 + * return PyArray_MultiIterNew(4, a, b, c, d) + * + * cdef inline object PyArray_MultiIterNew5(a, b, c, d, e): # <<<<<<<<<<<<<< + * return PyArray_MultiIterNew(5, a, b, c, d, e) + * +*/ + +static CYTHON_INLINE PyObject *__pyx_f_5numpy_PyArray_MultiIterNew5(PyObject *__pyx_v_a, PyObject *__pyx_v_b, PyObject *__pyx_v_c, PyObject *__pyx_v_d, PyObject *__pyx_v_e) { + PyObject *__pyx_r = NULL; + __Pyx_RefNannyDeclarations + PyObject *__pyx_t_1 = NULL; + int __pyx_lineno = 0; + const char *__pyx_filename = NULL; + int __pyx_clineno = 0; + __Pyx_RefNannySetupContext("PyArray_MultiIterNew5", 0); + + /* "C:/Users/runneradmin/AppData/Local/Temp/build-env-ej_q3m8u/Lib/site-packages/numpy/__init__.cython-30.pxd":789 + * + * cdef inline object PyArray_MultiIterNew5(a, b, c, d, e): + * return PyArray_MultiIterNew(5, a, b, c, d, e) # <<<<<<<<<<<<<< + * + * cdef inline tuple PyDataType_SHAPE(dtype d): +*/ + __Pyx_XDECREF(__pyx_r); + __pyx_t_1 = PyArray_MultiIterNew(5, ((void *)__pyx_v_a), ((void *)__pyx_v_b), ((void *)__pyx_v_c), ((void *)__pyx_v_d), ((void *)__pyx_v_e)); if (unlikely(!__pyx_t_1)) __PYX_ERR(2, 789, __pyx_L1_error) + __Pyx_GOTREF(__pyx_t_1); + __pyx_r = __pyx_t_1; + __pyx_t_1 = 0; + goto __pyx_L0; + + /* "C:/Users/runneradmin/AppData/Local/Temp/build-env-ej_q3m8u/Lib/site-packages/numpy/__init__.cython-30.pxd":788 + * return PyArray_MultiIterNew(4, a, b, c, d) + * + * cdef inline object PyArray_MultiIterNew5(a, b, c, d, e): # <<<<<<<<<<<<<< + * return PyArray_MultiIterNew(5, a, b, c, d, e) + * +*/ + + /* function exit code */ + __pyx_L1_error:; + __Pyx_XDECREF(__pyx_t_1); + __Pyx_AddTraceback("numpy.PyArray_MultiIterNew5", __pyx_clineno, __pyx_lineno, __pyx_filename); + __pyx_r = 0; + __pyx_L0:; + __Pyx_XGIVEREF(__pyx_r); + __Pyx_RefNannyFinishContext(); + return __pyx_r; +} + +/* "C:/Users/runneradmin/AppData/Local/Temp/build-env-ej_q3m8u/Lib/site-packages/numpy/__init__.cython-30.pxd":791 + * return PyArray_MultiIterNew(5, a, b, c, d, e) + * + * cdef inline tuple PyDataType_SHAPE(dtype d): # <<<<<<<<<<<<<< + * if PyDataType_HASSUBARRAY(d): + * return d.subarray.shape +*/ + +static CYTHON_INLINE PyObject *__pyx_f_5numpy_PyDataType_SHAPE(PyArray_Descr *__pyx_v_d) { + PyObject *__pyx_r = NULL; + __Pyx_RefNannyDeclarations + int __pyx_t_1; + PyObject *__pyx_t_2; + __Pyx_RefNannySetupContext("PyDataType_SHAPE", 0); + + /* "C:/Users/runneradmin/AppData/Local/Temp/build-env-ej_q3m8u/Lib/site-packages/numpy/__init__.cython-30.pxd":792 + * + * cdef inline tuple PyDataType_SHAPE(dtype d): + * if PyDataType_HASSUBARRAY(d): # <<<<<<<<<<<<<< + * return d.subarray.shape + * else: +*/ + __pyx_t_1 = PyDataType_HASSUBARRAY(__pyx_v_d); + if (__pyx_t_1) { + + /* "C:/Users/runneradmin/AppData/Local/Temp/build-env-ej_q3m8u/Lib/site-packages/numpy/__init__.cython-30.pxd":793 + * cdef inline tuple PyDataType_SHAPE(dtype d): + * if PyDataType_HASSUBARRAY(d): + * return d.subarray.shape # <<<<<<<<<<<<<< + * else: + * return () +*/ + __Pyx_XDECREF(__pyx_r); + __pyx_t_2 = __pyx_f_5numpy_5dtype_8subarray_subarray(__pyx_v_d)->shape; + __Pyx_INCREF(((PyObject*)__pyx_t_2)); + __pyx_r = ((PyObject*)__pyx_t_2); + goto __pyx_L0; + + /* "C:/Users/runneradmin/AppData/Local/Temp/build-env-ej_q3m8u/Lib/site-packages/numpy/__init__.cython-30.pxd":792 + * + * cdef inline tuple PyDataType_SHAPE(dtype d): + * if PyDataType_HASSUBARRAY(d): # <<<<<<<<<<<<<< + * return d.subarray.shape + * else: +*/ + } + + /* "C:/Users/runneradmin/AppData/Local/Temp/build-env-ej_q3m8u/Lib/site-packages/numpy/__init__.cython-30.pxd":795 + * return d.subarray.shape + * else: + * return () # <<<<<<<<<<<<<< + * + * +*/ + /*else*/ { + __Pyx_XDECREF(__pyx_r); + __Pyx_INCREF(__pyx_mstate_global->__pyx_empty_tuple); + __pyx_r = __pyx_mstate_global->__pyx_empty_tuple; + goto __pyx_L0; + } + + /* "C:/Users/runneradmin/AppData/Local/Temp/build-env-ej_q3m8u/Lib/site-packages/numpy/__init__.cython-30.pxd":791 + * return PyArray_MultiIterNew(5, a, b, c, d, e) + * + * cdef inline tuple PyDataType_SHAPE(dtype d): # <<<<<<<<<<<<<< + * if PyDataType_HASSUBARRAY(d): + * return d.subarray.shape +*/ + + /* function exit code */ + __pyx_L0:; + __Pyx_XGIVEREF(__pyx_r); + __Pyx_RefNannyFinishContext(); + return __pyx_r; +} + +/* "C:/Users/runneradmin/AppData/Local/Temp/build-env-ej_q3m8u/Lib/site-packages/numpy/__init__.cython-30.pxd":994 + * int _import_umath() except -1 + * + * cdef inline void set_array_base(ndarray arr, object base) except *: # <<<<<<<<<<<<<< + * Py_INCREF(base) # important to do this before stealing the reference below! + * PyArray_SetBaseObject(arr, base) +*/ + +static CYTHON_INLINE void __pyx_f_5numpy_set_array_base(PyArrayObject *__pyx_v_arr, PyObject *__pyx_v_base) { + int __pyx_t_1; + int __pyx_lineno = 0; + const char *__pyx_filename = NULL; + int __pyx_clineno = 0; + + /* "C:/Users/runneradmin/AppData/Local/Temp/build-env-ej_q3m8u/Lib/site-packages/numpy/__init__.cython-30.pxd":995 + * + * cdef inline void set_array_base(ndarray arr, object base) except *: + * Py_INCREF(base) # important to do this before stealing the reference below! # <<<<<<<<<<<<<< + * PyArray_SetBaseObject(arr, base) + * +*/ + Py_INCREF(__pyx_v_base); + + /* "C:/Users/runneradmin/AppData/Local/Temp/build-env-ej_q3m8u/Lib/site-packages/numpy/__init__.cython-30.pxd":996 + * cdef inline void set_array_base(ndarray arr, object base) except *: + * Py_INCREF(base) # important to do this before stealing the reference below! + * PyArray_SetBaseObject(arr, base) # <<<<<<<<<<<<<< + * + * cdef inline object get_array_base(ndarray arr): +*/ + __pyx_t_1 = PyArray_SetBaseObject(__pyx_v_arr, __pyx_v_base); if (unlikely(__pyx_t_1 == ((int)-1))) __PYX_ERR(2, 996, __pyx_L1_error) + + /* "C:/Users/runneradmin/AppData/Local/Temp/build-env-ej_q3m8u/Lib/site-packages/numpy/__init__.cython-30.pxd":994 + * int _import_umath() except -1 + * + * cdef inline void set_array_base(ndarray arr, object base) except *: # <<<<<<<<<<<<<< + * Py_INCREF(base) # important to do this before stealing the reference below! + * PyArray_SetBaseObject(arr, base) +*/ + + /* function exit code */ + goto __pyx_L0; + __pyx_L1_error:; + __Pyx_AddTraceback("numpy.set_array_base", __pyx_clineno, __pyx_lineno, __pyx_filename); + __pyx_L0:; +} + +/* "C:/Users/runneradmin/AppData/Local/Temp/build-env-ej_q3m8u/Lib/site-packages/numpy/__init__.cython-30.pxd":998 + * PyArray_SetBaseObject(arr, base) + * + * cdef inline object get_array_base(ndarray arr): # <<<<<<<<<<<<<< + * base = PyArray_BASE(arr) + * if base is NULL: +*/ + +static CYTHON_INLINE PyObject *__pyx_f_5numpy_get_array_base(PyArrayObject *__pyx_v_arr) { + PyObject *__pyx_v_base; + PyObject *__pyx_r = NULL; + __Pyx_RefNannyDeclarations + int __pyx_t_1; + __Pyx_RefNannySetupContext("get_array_base", 0); + + /* "C:/Users/runneradmin/AppData/Local/Temp/build-env-ej_q3m8u/Lib/site-packages/numpy/__init__.cython-30.pxd":999 + * + * cdef inline object get_array_base(ndarray arr): + * base = PyArray_BASE(arr) # <<<<<<<<<<<<<< + * if base is NULL: + * return None +*/ + __pyx_v_base = PyArray_BASE(__pyx_v_arr); + + /* "C:/Users/runneradmin/AppData/Local/Temp/build-env-ej_q3m8u/Lib/site-packages/numpy/__init__.cython-30.pxd":1000 + * cdef inline object get_array_base(ndarray arr): + * base = PyArray_BASE(arr) + * if base is NULL: # <<<<<<<<<<<<<< + * return None + * return base +*/ + __pyx_t_1 = (__pyx_v_base == NULL); + if (__pyx_t_1) { + + /* "C:/Users/runneradmin/AppData/Local/Temp/build-env-ej_q3m8u/Lib/site-packages/numpy/__init__.cython-30.pxd":1001 + * base = PyArray_BASE(arr) + * if base is NULL: + * return None # <<<<<<<<<<<<<< + * return base + * +*/ + __Pyx_XDECREF(__pyx_r); + __pyx_r = Py_None; __Pyx_INCREF(Py_None); + goto __pyx_L0; + + /* "C:/Users/runneradmin/AppData/Local/Temp/build-env-ej_q3m8u/Lib/site-packages/numpy/__init__.cython-30.pxd":1000 + * cdef inline object get_array_base(ndarray arr): + * base = PyArray_BASE(arr) + * if base is NULL: # <<<<<<<<<<<<<< + * return None + * return base +*/ + } + + /* "C:/Users/runneradmin/AppData/Local/Temp/build-env-ej_q3m8u/Lib/site-packages/numpy/__init__.cython-30.pxd":1002 + * if base is NULL: + * return None + * return base # <<<<<<<<<<<<<< + * + * # Versions of the import_* functions which are more suitable for +*/ + __Pyx_XDECREF(__pyx_r); + __Pyx_INCREF(((PyObject *)__pyx_v_base)); + __pyx_r = ((PyObject *)__pyx_v_base); + goto __pyx_L0; + + /* "C:/Users/runneradmin/AppData/Local/Temp/build-env-ej_q3m8u/Lib/site-packages/numpy/__init__.cython-30.pxd":998 + * PyArray_SetBaseObject(arr, base) + * + * cdef inline object get_array_base(ndarray arr): # <<<<<<<<<<<<<< + * base = PyArray_BASE(arr) + * if base is NULL: +*/ + + /* function exit code */ + __pyx_L0:; + __Pyx_XGIVEREF(__pyx_r); + __Pyx_RefNannyFinishContext(); + return __pyx_r; +} + +/* "C:/Users/runneradmin/AppData/Local/Temp/build-env-ej_q3m8u/Lib/site-packages/numpy/__init__.cython-30.pxd":1006 + * # Versions of the import_* functions which are more suitable for + * # Cython code. + * cdef inline int import_array() except -1: # <<<<<<<<<<<<<< + * try: + * __pyx_import_array() +*/ + +static CYTHON_INLINE int __pyx_f_5numpy_import_array(void) { + int __pyx_r; + __Pyx_RefNannyDeclarations + PyObject *__pyx_t_1 = NULL; + PyObject *__pyx_t_2 = NULL; + PyObject *__pyx_t_3 = NULL; + int __pyx_t_4; + PyObject *__pyx_t_5 = NULL; + PyObject *__pyx_t_6 = NULL; + PyObject *__pyx_t_7 = NULL; + PyObject *__pyx_t_8 = NULL; + PyObject *__pyx_t_9 = NULL; + size_t __pyx_t_10; + int __pyx_lineno = 0; + const char *__pyx_filename = NULL; + int __pyx_clineno = 0; + __Pyx_RefNannySetupContext("import_array", 0); + + /* "C:/Users/runneradmin/AppData/Local/Temp/build-env-ej_q3m8u/Lib/site-packages/numpy/__init__.cython-30.pxd":1007 + * # Cython code. + * cdef inline int import_array() except -1: + * try: # <<<<<<<<<<<<<< + * __pyx_import_array() + * except Exception: +*/ + { + __Pyx_PyThreadState_declare + __Pyx_PyThreadState_assign + __Pyx_ExceptionSave(&__pyx_t_1, &__pyx_t_2, &__pyx_t_3); + __Pyx_XGOTREF(__pyx_t_1); + __Pyx_XGOTREF(__pyx_t_2); + __Pyx_XGOTREF(__pyx_t_3); + /*try:*/ { + + /* "C:/Users/runneradmin/AppData/Local/Temp/build-env-ej_q3m8u/Lib/site-packages/numpy/__init__.cython-30.pxd":1008 + * cdef inline int import_array() except -1: + * try: + * __pyx_import_array() # <<<<<<<<<<<<<< + * except Exception: + * raise ImportError("numpy._core.multiarray failed to import") +*/ + __pyx_t_4 = _import_array(); if (unlikely(__pyx_t_4 == ((int)-1))) __PYX_ERR(2, 1008, __pyx_L3_error) + + /* "C:/Users/runneradmin/AppData/Local/Temp/build-env-ej_q3m8u/Lib/site-packages/numpy/__init__.cython-30.pxd":1007 + * # Cython code. + * cdef inline int import_array() except -1: + * try: # <<<<<<<<<<<<<< + * __pyx_import_array() + * except Exception: +*/ + } + __Pyx_XDECREF(__pyx_t_1); __pyx_t_1 = 0; + __Pyx_XDECREF(__pyx_t_2); __pyx_t_2 = 0; + __Pyx_XDECREF(__pyx_t_3); __pyx_t_3 = 0; + goto __pyx_L8_try_end; + __pyx_L3_error:; + + /* "C:/Users/runneradmin/AppData/Local/Temp/build-env-ej_q3m8u/Lib/site-packages/numpy/__init__.cython-30.pxd":1009 + * try: + * __pyx_import_array() + * except Exception: # <<<<<<<<<<<<<< + * raise ImportError("numpy._core.multiarray failed to import") + * +*/ + __pyx_t_4 = __Pyx_PyErr_ExceptionMatches(((PyObject *)(((PyTypeObject*)PyExc_Exception)))); + if (__pyx_t_4) { + __Pyx_AddTraceback("numpy.import_array", __pyx_clineno, __pyx_lineno, __pyx_filename); + if (__Pyx_GetException(&__pyx_t_5, &__pyx_t_6, &__pyx_t_7) < 0) __PYX_ERR(2, 1009, __pyx_L5_except_error) + __Pyx_XGOTREF(__pyx_t_5); + __Pyx_XGOTREF(__pyx_t_6); + __Pyx_XGOTREF(__pyx_t_7); + + /* "C:/Users/runneradmin/AppData/Local/Temp/build-env-ej_q3m8u/Lib/site-packages/numpy/__init__.cython-30.pxd":1010 + * __pyx_import_array() + * except Exception: + * raise ImportError("numpy._core.multiarray failed to import") # <<<<<<<<<<<<<< + * + * cdef inline int import_umath() except -1: +*/ + __pyx_t_9 = NULL; + __pyx_t_10 = 1; + { + PyObject *__pyx_callargs[2] = {__pyx_t_9, __pyx_mstate_global->__pyx_kp_u_numpy__core_multiarray_failed_to}; + __pyx_t_8 = __Pyx_PyObject_FastCall((PyObject*)(((PyTypeObject*)PyExc_ImportError)), __pyx_callargs+__pyx_t_10, (2-__pyx_t_10) | (__pyx_t_10*__Pyx_PY_VECTORCALL_ARGUMENTS_OFFSET)); + __Pyx_XDECREF(__pyx_t_9); __pyx_t_9 = 0; + if (unlikely(!__pyx_t_8)) __PYX_ERR(2, 1010, __pyx_L5_except_error) + __Pyx_GOTREF(__pyx_t_8); + } + __Pyx_Raise(__pyx_t_8, 0, 0, 0); + __Pyx_DECREF(__pyx_t_8); __pyx_t_8 = 0; + __PYX_ERR(2, 1010, __pyx_L5_except_error) + } + goto __pyx_L5_except_error; + + /* "C:/Users/runneradmin/AppData/Local/Temp/build-env-ej_q3m8u/Lib/site-packages/numpy/__init__.cython-30.pxd":1007 + * # Cython code. + * cdef inline int import_array() except -1: + * try: # <<<<<<<<<<<<<< + * __pyx_import_array() + * except Exception: +*/ + __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:; + } + + /* "C:/Users/runneradmin/AppData/Local/Temp/build-env-ej_q3m8u/Lib/site-packages/numpy/__init__.cython-30.pxd":1006 + * # Versions of the import_* functions which are more suitable for + * # Cython code. + * cdef inline int import_array() except -1: # <<<<<<<<<<<<<< + * try: + * __pyx_import_array() +*/ + + /* function exit code */ + __pyx_r = 0; + goto __pyx_L0; + __pyx_L1_error:; + __Pyx_XDECREF(__pyx_t_5); + __Pyx_XDECREF(__pyx_t_6); + __Pyx_XDECREF(__pyx_t_7); + __Pyx_XDECREF(__pyx_t_8); + __Pyx_XDECREF(__pyx_t_9); + __Pyx_AddTraceback("numpy.import_array", __pyx_clineno, __pyx_lineno, __pyx_filename); + __pyx_r = -1; + __pyx_L0:; + __Pyx_RefNannyFinishContext(); + return __pyx_r; +} + +/* "C:/Users/runneradmin/AppData/Local/Temp/build-env-ej_q3m8u/Lib/site-packages/numpy/__init__.cython-30.pxd":1012 + * raise ImportError("numpy._core.multiarray failed to import") + * + * cdef inline int import_umath() except -1: # <<<<<<<<<<<<<< + * try: + * _import_umath() +*/ + +static CYTHON_INLINE int __pyx_f_5numpy_import_umath(void) { + int __pyx_r; + __Pyx_RefNannyDeclarations + PyObject *__pyx_t_1 = NULL; + PyObject *__pyx_t_2 = NULL; + PyObject *__pyx_t_3 = NULL; + int __pyx_t_4; + PyObject *__pyx_t_5 = NULL; + PyObject *__pyx_t_6 = NULL; + PyObject *__pyx_t_7 = NULL; + PyObject *__pyx_t_8 = NULL; + PyObject *__pyx_t_9 = NULL; + size_t __pyx_t_10; + int __pyx_lineno = 0; + const char *__pyx_filename = NULL; + int __pyx_clineno = 0; + __Pyx_RefNannySetupContext("import_umath", 0); + + /* "C:/Users/runneradmin/AppData/Local/Temp/build-env-ej_q3m8u/Lib/site-packages/numpy/__init__.cython-30.pxd":1013 + * + * cdef inline int import_umath() except -1: + * try: # <<<<<<<<<<<<<< + * _import_umath() + * except Exception: +*/ + { + __Pyx_PyThreadState_declare + __Pyx_PyThreadState_assign + __Pyx_ExceptionSave(&__pyx_t_1, &__pyx_t_2, &__pyx_t_3); + __Pyx_XGOTREF(__pyx_t_1); + __Pyx_XGOTREF(__pyx_t_2); + __Pyx_XGOTREF(__pyx_t_3); + /*try:*/ { + + /* "C:/Users/runneradmin/AppData/Local/Temp/build-env-ej_q3m8u/Lib/site-packages/numpy/__init__.cython-30.pxd":1014 + * cdef inline int import_umath() except -1: + * try: + * _import_umath() # <<<<<<<<<<<<<< + * except Exception: + * raise ImportError("numpy._core.umath failed to import") +*/ + __pyx_t_4 = _import_umath(); if (unlikely(__pyx_t_4 == ((int)-1))) __PYX_ERR(2, 1014, __pyx_L3_error) + + /* "C:/Users/runneradmin/AppData/Local/Temp/build-env-ej_q3m8u/Lib/site-packages/numpy/__init__.cython-30.pxd":1013 + * + * cdef inline int import_umath() except -1: + * try: # <<<<<<<<<<<<<< + * _import_umath() + * except Exception: +*/ + } + __Pyx_XDECREF(__pyx_t_1); __pyx_t_1 = 0; + __Pyx_XDECREF(__pyx_t_2); __pyx_t_2 = 0; + __Pyx_XDECREF(__pyx_t_3); __pyx_t_3 = 0; + goto __pyx_L8_try_end; + __pyx_L3_error:; + + /* "C:/Users/runneradmin/AppData/Local/Temp/build-env-ej_q3m8u/Lib/site-packages/numpy/__init__.cython-30.pxd":1015 + * try: + * _import_umath() + * except Exception: # <<<<<<<<<<<<<< + * raise ImportError("numpy._core.umath failed to import") + * +*/ + __pyx_t_4 = __Pyx_PyErr_ExceptionMatches(((PyObject *)(((PyTypeObject*)PyExc_Exception)))); + if (__pyx_t_4) { + __Pyx_AddTraceback("numpy.import_umath", __pyx_clineno, __pyx_lineno, __pyx_filename); + if (__Pyx_GetException(&__pyx_t_5, &__pyx_t_6, &__pyx_t_7) < 0) __PYX_ERR(2, 1015, __pyx_L5_except_error) + __Pyx_XGOTREF(__pyx_t_5); + __Pyx_XGOTREF(__pyx_t_6); + __Pyx_XGOTREF(__pyx_t_7); + + /* "C:/Users/runneradmin/AppData/Local/Temp/build-env-ej_q3m8u/Lib/site-packages/numpy/__init__.cython-30.pxd":1016 + * _import_umath() + * except Exception: + * raise ImportError("numpy._core.umath failed to import") # <<<<<<<<<<<<<< + * + * cdef inline int import_ufunc() except -1: +*/ + __pyx_t_9 = NULL; + __pyx_t_10 = 1; + { + PyObject *__pyx_callargs[2] = {__pyx_t_9, __pyx_mstate_global->__pyx_kp_u_numpy__core_umath_failed_to_impo}; + __pyx_t_8 = __Pyx_PyObject_FastCall((PyObject*)(((PyTypeObject*)PyExc_ImportError)), __pyx_callargs+__pyx_t_10, (2-__pyx_t_10) | (__pyx_t_10*__Pyx_PY_VECTORCALL_ARGUMENTS_OFFSET)); + __Pyx_XDECREF(__pyx_t_9); __pyx_t_9 = 0; + if (unlikely(!__pyx_t_8)) __PYX_ERR(2, 1016, __pyx_L5_except_error) + __Pyx_GOTREF(__pyx_t_8); + } + __Pyx_Raise(__pyx_t_8, 0, 0, 0); + __Pyx_DECREF(__pyx_t_8); __pyx_t_8 = 0; + __PYX_ERR(2, 1016, __pyx_L5_except_error) + } + goto __pyx_L5_except_error; + + /* "C:/Users/runneradmin/AppData/Local/Temp/build-env-ej_q3m8u/Lib/site-packages/numpy/__init__.cython-30.pxd":1013 + * + * cdef inline int import_umath() except -1: + * try: # <<<<<<<<<<<<<< + * _import_umath() + * except Exception: +*/ + __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:; + } + + /* "C:/Users/runneradmin/AppData/Local/Temp/build-env-ej_q3m8u/Lib/site-packages/numpy/__init__.cython-30.pxd":1012 + * raise ImportError("numpy._core.multiarray failed to import") + * + * cdef inline int import_umath() except -1: # <<<<<<<<<<<<<< + * try: + * _import_umath() +*/ + + /* function exit code */ + __pyx_r = 0; + goto __pyx_L0; + __pyx_L1_error:; + __Pyx_XDECREF(__pyx_t_5); + __Pyx_XDECREF(__pyx_t_6); + __Pyx_XDECREF(__pyx_t_7); + __Pyx_XDECREF(__pyx_t_8); + __Pyx_XDECREF(__pyx_t_9); + __Pyx_AddTraceback("numpy.import_umath", __pyx_clineno, __pyx_lineno, __pyx_filename); + __pyx_r = -1; + __pyx_L0:; + __Pyx_RefNannyFinishContext(); + return __pyx_r; +} + +/* "C:/Users/runneradmin/AppData/Local/Temp/build-env-ej_q3m8u/Lib/site-packages/numpy/__init__.cython-30.pxd":1018 + * raise ImportError("numpy._core.umath failed to import") + * + * cdef inline int import_ufunc() except -1: # <<<<<<<<<<<<<< + * try: + * _import_umath() +*/ + +static CYTHON_INLINE int __pyx_f_5numpy_import_ufunc(void) { + int __pyx_r; + __Pyx_RefNannyDeclarations + PyObject *__pyx_t_1 = NULL; + PyObject *__pyx_t_2 = NULL; + PyObject *__pyx_t_3 = NULL; + int __pyx_t_4; + PyObject *__pyx_t_5 = NULL; + PyObject *__pyx_t_6 = NULL; + PyObject *__pyx_t_7 = NULL; + PyObject *__pyx_t_8 = NULL; + PyObject *__pyx_t_9 = NULL; + size_t __pyx_t_10; + int __pyx_lineno = 0; + const char *__pyx_filename = NULL; + int __pyx_clineno = 0; + __Pyx_RefNannySetupContext("import_ufunc", 0); + + /* "C:/Users/runneradmin/AppData/Local/Temp/build-env-ej_q3m8u/Lib/site-packages/numpy/__init__.cython-30.pxd":1019 + * + * cdef inline int import_ufunc() except -1: + * try: # <<<<<<<<<<<<<< + * _import_umath() + * except Exception: +*/ + { + __Pyx_PyThreadState_declare + __Pyx_PyThreadState_assign + __Pyx_ExceptionSave(&__pyx_t_1, &__pyx_t_2, &__pyx_t_3); + __Pyx_XGOTREF(__pyx_t_1); + __Pyx_XGOTREF(__pyx_t_2); + __Pyx_XGOTREF(__pyx_t_3); + /*try:*/ { + + /* "C:/Users/runneradmin/AppData/Local/Temp/build-env-ej_q3m8u/Lib/site-packages/numpy/__init__.cython-30.pxd":1020 + * cdef inline int import_ufunc() except -1: + * try: + * _import_umath() # <<<<<<<<<<<<<< + * except Exception: + * raise ImportError("numpy._core.umath failed to import") +*/ + __pyx_t_4 = _import_umath(); if (unlikely(__pyx_t_4 == ((int)-1))) __PYX_ERR(2, 1020, __pyx_L3_error) + + /* "C:/Users/runneradmin/AppData/Local/Temp/build-env-ej_q3m8u/Lib/site-packages/numpy/__init__.cython-30.pxd":1019 + * + * cdef inline int import_ufunc() except -1: + * try: # <<<<<<<<<<<<<< + * _import_umath() + * except Exception: +*/ + } + __Pyx_XDECREF(__pyx_t_1); __pyx_t_1 = 0; + __Pyx_XDECREF(__pyx_t_2); __pyx_t_2 = 0; + __Pyx_XDECREF(__pyx_t_3); __pyx_t_3 = 0; + goto __pyx_L8_try_end; + __pyx_L3_error:; + + /* "C:/Users/runneradmin/AppData/Local/Temp/build-env-ej_q3m8u/Lib/site-packages/numpy/__init__.cython-30.pxd":1021 + * try: + * _import_umath() + * except Exception: # <<<<<<<<<<<<<< + * raise ImportError("numpy._core.umath failed to import") + * +*/ + __pyx_t_4 = __Pyx_PyErr_ExceptionMatches(((PyObject *)(((PyTypeObject*)PyExc_Exception)))); + if (__pyx_t_4) { + __Pyx_AddTraceback("numpy.import_ufunc", __pyx_clineno, __pyx_lineno, __pyx_filename); + if (__Pyx_GetException(&__pyx_t_5, &__pyx_t_6, &__pyx_t_7) < 0) __PYX_ERR(2, 1021, __pyx_L5_except_error) + __Pyx_XGOTREF(__pyx_t_5); + __Pyx_XGOTREF(__pyx_t_6); + __Pyx_XGOTREF(__pyx_t_7); + + /* "C:/Users/runneradmin/AppData/Local/Temp/build-env-ej_q3m8u/Lib/site-packages/numpy/__init__.cython-30.pxd":1022 + * _import_umath() + * except Exception: + * raise ImportError("numpy._core.umath failed to import") # <<<<<<<<<<<<<< + * + * +*/ + __pyx_t_9 = NULL; + __pyx_t_10 = 1; + { + PyObject *__pyx_callargs[2] = {__pyx_t_9, __pyx_mstate_global->__pyx_kp_u_numpy__core_umath_failed_to_impo}; + __pyx_t_8 = __Pyx_PyObject_FastCall((PyObject*)(((PyTypeObject*)PyExc_ImportError)), __pyx_callargs+__pyx_t_10, (2-__pyx_t_10) | (__pyx_t_10*__Pyx_PY_VECTORCALL_ARGUMENTS_OFFSET)); + __Pyx_XDECREF(__pyx_t_9); __pyx_t_9 = 0; + if (unlikely(!__pyx_t_8)) __PYX_ERR(2, 1022, __pyx_L5_except_error) + __Pyx_GOTREF(__pyx_t_8); + } + __Pyx_Raise(__pyx_t_8, 0, 0, 0); + __Pyx_DECREF(__pyx_t_8); __pyx_t_8 = 0; + __PYX_ERR(2, 1022, __pyx_L5_except_error) + } + goto __pyx_L5_except_error; + + /* "C:/Users/runneradmin/AppData/Local/Temp/build-env-ej_q3m8u/Lib/site-packages/numpy/__init__.cython-30.pxd":1019 + * + * cdef inline int import_ufunc() except -1: + * try: # <<<<<<<<<<<<<< + * _import_umath() + * except Exception: +*/ + __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:; + } + + /* "C:/Users/runneradmin/AppData/Local/Temp/build-env-ej_q3m8u/Lib/site-packages/numpy/__init__.cython-30.pxd":1018 + * raise ImportError("numpy._core.umath failed to import") + * + * cdef inline int import_ufunc() except -1: # <<<<<<<<<<<<<< + * try: + * _import_umath() +*/ + + /* function exit code */ + __pyx_r = 0; + goto __pyx_L0; + __pyx_L1_error:; + __Pyx_XDECREF(__pyx_t_5); + __Pyx_XDECREF(__pyx_t_6); + __Pyx_XDECREF(__pyx_t_7); + __Pyx_XDECREF(__pyx_t_8); + __Pyx_XDECREF(__pyx_t_9); + __Pyx_AddTraceback("numpy.import_ufunc", __pyx_clineno, __pyx_lineno, __pyx_filename); + __pyx_r = -1; + __pyx_L0:; + __Pyx_RefNannyFinishContext(); + return __pyx_r; +} + +/* "C:/Users/runneradmin/AppData/Local/Temp/build-env-ej_q3m8u/Lib/site-packages/numpy/__init__.cython-30.pxd":1025 + * + * + * cdef inline bint is_timedelta64_object(object obj) noexcept: # <<<<<<<<<<<<<< + * """ + * Cython equivalent of `isinstance(obj, np.timedelta64)` +*/ + +static CYTHON_INLINE int __pyx_f_5numpy_is_timedelta64_object(PyObject *__pyx_v_obj) { + int __pyx_r; + + /* "C:/Users/runneradmin/AppData/Local/Temp/build-env-ej_q3m8u/Lib/site-packages/numpy/__init__.cython-30.pxd":1037 + * bool + * """ + * return PyObject_TypeCheck(obj, &PyTimedeltaArrType_Type) # <<<<<<<<<<<<<< + * + * +*/ + __pyx_r = PyObject_TypeCheck(__pyx_v_obj, (&PyTimedeltaArrType_Type)); + goto __pyx_L0; + + /* "C:/Users/runneradmin/AppData/Local/Temp/build-env-ej_q3m8u/Lib/site-packages/numpy/__init__.cython-30.pxd":1025 + * + * + * cdef inline bint is_timedelta64_object(object obj) noexcept: # <<<<<<<<<<<<<< + * """ + * Cython equivalent of `isinstance(obj, np.timedelta64)` +*/ + + /* function exit code */ + __pyx_L0:; + return __pyx_r; +} + +/* "C:/Users/runneradmin/AppData/Local/Temp/build-env-ej_q3m8u/Lib/site-packages/numpy/__init__.cython-30.pxd":1040 + * + * + * cdef inline bint is_datetime64_object(object obj) noexcept: # <<<<<<<<<<<<<< + * """ + * Cython equivalent of `isinstance(obj, np.datetime64)` +*/ + +static CYTHON_INLINE int __pyx_f_5numpy_is_datetime64_object(PyObject *__pyx_v_obj) { + int __pyx_r; + + /* "C:/Users/runneradmin/AppData/Local/Temp/build-env-ej_q3m8u/Lib/site-packages/numpy/__init__.cython-30.pxd":1052 + * bool + * """ + * return PyObject_TypeCheck(obj, &PyDatetimeArrType_Type) # <<<<<<<<<<<<<< + * + * +*/ + __pyx_r = PyObject_TypeCheck(__pyx_v_obj, (&PyDatetimeArrType_Type)); + goto __pyx_L0; + + /* "C:/Users/runneradmin/AppData/Local/Temp/build-env-ej_q3m8u/Lib/site-packages/numpy/__init__.cython-30.pxd":1040 + * + * + * cdef inline bint is_datetime64_object(object obj) noexcept: # <<<<<<<<<<<<<< + * """ + * Cython equivalent of `isinstance(obj, np.datetime64)` +*/ + + /* function exit code */ + __pyx_L0:; + return __pyx_r; +} + +/* "C:/Users/runneradmin/AppData/Local/Temp/build-env-ej_q3m8u/Lib/site-packages/numpy/__init__.cython-30.pxd":1055 + * + * + * cdef inline npy_datetime get_datetime64_value(object obj) noexcept nogil: # <<<<<<<<<<<<<< + * """ + * returns the int64 value underlying scalar numpy datetime64 object +*/ + +static CYTHON_INLINE npy_datetime __pyx_f_5numpy_get_datetime64_value(PyObject *__pyx_v_obj) { + npy_datetime __pyx_r; + + /* "C:/Users/runneradmin/AppData/Local/Temp/build-env-ej_q3m8u/Lib/site-packages/numpy/__init__.cython-30.pxd":1062 + * also needed. That can be found using `get_datetime64_unit`. + * """ + * return (obj).obval # <<<<<<<<<<<<<< + * + * +*/ + __pyx_r = ((PyDatetimeScalarObject *)__pyx_v_obj)->obval; + goto __pyx_L0; + + /* "C:/Users/runneradmin/AppData/Local/Temp/build-env-ej_q3m8u/Lib/site-packages/numpy/__init__.cython-30.pxd":1055 + * + * + * cdef inline npy_datetime get_datetime64_value(object obj) noexcept nogil: # <<<<<<<<<<<<<< + * """ + * returns the int64 value underlying scalar numpy datetime64 object +*/ + + /* function exit code */ + __pyx_L0:; + return __pyx_r; +} + +/* "C:/Users/runneradmin/AppData/Local/Temp/build-env-ej_q3m8u/Lib/site-packages/numpy/__init__.cython-30.pxd":1065 + * + * + * cdef inline npy_timedelta get_timedelta64_value(object obj) noexcept nogil: # <<<<<<<<<<<<<< + * """ + * returns the int64 value underlying scalar numpy timedelta64 object +*/ + +static CYTHON_INLINE npy_timedelta __pyx_f_5numpy_get_timedelta64_value(PyObject *__pyx_v_obj) { + npy_timedelta __pyx_r; + + /* "C:/Users/runneradmin/AppData/Local/Temp/build-env-ej_q3m8u/Lib/site-packages/numpy/__init__.cython-30.pxd":1069 + * returns the int64 value underlying scalar numpy timedelta64 object + * """ + * return (obj).obval # <<<<<<<<<<<<<< + * + * +*/ + __pyx_r = ((PyTimedeltaScalarObject *)__pyx_v_obj)->obval; + goto __pyx_L0; + + /* "C:/Users/runneradmin/AppData/Local/Temp/build-env-ej_q3m8u/Lib/site-packages/numpy/__init__.cython-30.pxd":1065 + * + * + * cdef inline npy_timedelta get_timedelta64_value(object obj) noexcept nogil: # <<<<<<<<<<<<<< + * """ + * returns the int64 value underlying scalar numpy timedelta64 object +*/ + + /* function exit code */ + __pyx_L0:; + return __pyx_r; +} + +/* "C:/Users/runneradmin/AppData/Local/Temp/build-env-ej_q3m8u/Lib/site-packages/numpy/__init__.cython-30.pxd":1072 + * + * + * cdef inline NPY_DATETIMEUNIT get_datetime64_unit(object obj) noexcept nogil: # <<<<<<<<<<<<<< + * """ + * returns the unit part of the dtype for a numpy datetime64 object. +*/ + +static CYTHON_INLINE NPY_DATETIMEUNIT __pyx_f_5numpy_get_datetime64_unit(PyObject *__pyx_v_obj) { + NPY_DATETIMEUNIT __pyx_r; + + /* "C:/Users/runneradmin/AppData/Local/Temp/build-env-ej_q3m8u/Lib/site-packages/numpy/__init__.cython-30.pxd":1076 + * returns the unit part of the dtype for a numpy datetime64 object. + * """ + * return (obj).obmeta.base # <<<<<<<<<<<<<< + * + * +*/ + __pyx_r = ((NPY_DATETIMEUNIT)((PyDatetimeScalarObject *)__pyx_v_obj)->obmeta.base); + goto __pyx_L0; + + /* "C:/Users/runneradmin/AppData/Local/Temp/build-env-ej_q3m8u/Lib/site-packages/numpy/__init__.cython-30.pxd":1072 + * + * + * cdef inline NPY_DATETIMEUNIT get_datetime64_unit(object obj) noexcept nogil: # <<<<<<<<<<<<<< + * """ + * returns the unit part of the dtype for a numpy datetime64 object. +*/ + + /* function exit code */ + __pyx_L0:; + return __pyx_r; +} + +/* "lexeme.pxd":29 + * cdef readonly attr_t orth + * + * @staticmethod # <<<<<<<<<<<<<< + * cdef inline Lexeme from_ptr(LexemeC* lex, Vocab vocab): + * cdef Lexeme self = Lexeme.__new__(Lexeme, vocab, lex.orth) +*/ + +static CYTHON_INLINE struct __pyx_obj_5spacy_6lexeme_Lexeme *__pyx_f_5spacy_6lexeme_6Lexeme_from_ptr(struct __pyx_t_5spacy_7structs_LexemeC *__pyx_v_lex, struct __pyx_obj_5spacy_5vocab_Vocab *__pyx_v_vocab) { + struct __pyx_obj_5spacy_6lexeme_Lexeme *__pyx_v_self = 0; + struct __pyx_obj_5spacy_6lexeme_Lexeme *__pyx_r = NULL; + __Pyx_RefNannyDeclarations + PyObject *__pyx_t_1 = NULL; + PyObject *__pyx_t_2 = NULL; + __pyx_t_5spacy_8typedefs_attr_t __pyx_t_3; + int __pyx_lineno = 0; + const char *__pyx_filename = NULL; + int __pyx_clineno = 0; + __Pyx_RefNannySetupContext("from_ptr", 0); + + /* "lexeme.pxd":31 + * @staticmethod + * cdef inline Lexeme from_ptr(LexemeC* lex, Vocab vocab): + * cdef Lexeme self = Lexeme.__new__(Lexeme, vocab, lex.orth) # <<<<<<<<<<<<<< + * self.c = lex + * self.vocab = vocab +*/ + __pyx_t_1 = __Pyx_PyLong_From_uint64_t(__pyx_v_lex->orth); if (unlikely(!__pyx_t_1)) __PYX_ERR(3, 31, __pyx_L1_error) + __Pyx_GOTREF(__pyx_t_1); + __pyx_t_2 = PyTuple_New(2); if (unlikely(!__pyx_t_2)) __PYX_ERR(3, 31, __pyx_L1_error) + __Pyx_GOTREF(__pyx_t_2); + __Pyx_INCREF((PyObject *)__pyx_v_vocab); + __Pyx_GIVEREF((PyObject *)__pyx_v_vocab); + if (__Pyx_PyTuple_SET_ITEM(__pyx_t_2, 0, ((PyObject *)__pyx_v_vocab)) != (0)) __PYX_ERR(3, 31, __pyx_L1_error); + __Pyx_GIVEREF(__pyx_t_1); + if (__Pyx_PyTuple_SET_ITEM(__pyx_t_2, 1, __pyx_t_1) != (0)) __PYX_ERR(3, 31, __pyx_L1_error); + __pyx_t_1 = 0; + __pyx_t_1 = __Pyx_tp_new(((PyObject *)__pyx_mstate_global->__pyx_ptype_5spacy_6lexeme_Lexeme), ((PyObject*)__pyx_t_2)); if (unlikely(!__pyx_t_1)) __PYX_ERR(3, 31, __pyx_L1_error) + __Pyx_GOTREF(__pyx_t_1); + __Pyx_DECREF(__pyx_t_2); __pyx_t_2 = 0; + if (!(likely(__Pyx_TypeTest(__pyx_t_1, __pyx_mstate_global->__pyx_ptype_5spacy_6lexeme_Lexeme)))) __PYX_ERR(3, 31, __pyx_L1_error) + __pyx_v_self = ((struct __pyx_obj_5spacy_6lexeme_Lexeme *)__pyx_t_1); + __pyx_t_1 = 0; + + /* "lexeme.pxd":32 + * cdef inline Lexeme from_ptr(LexemeC* lex, Vocab vocab): + * cdef Lexeme self = Lexeme.__new__(Lexeme, vocab, lex.orth) + * self.c = lex # <<<<<<<<<<<<<< + * self.vocab = vocab + * self.orth = lex.orth +*/ + __pyx_v_self->c = __pyx_v_lex; + + /* "lexeme.pxd":33 + * cdef Lexeme self = Lexeme.__new__(Lexeme, vocab, lex.orth) + * self.c = lex + * self.vocab = vocab # <<<<<<<<<<<<<< + * self.orth = lex.orth + * return self +*/ + __Pyx_INCREF((PyObject *)__pyx_v_vocab); + __Pyx_GIVEREF((PyObject *)__pyx_v_vocab); + __Pyx_GOTREF((PyObject *)__pyx_v_self->vocab); + __Pyx_DECREF((PyObject *)__pyx_v_self->vocab); + __pyx_v_self->vocab = __pyx_v_vocab; + + /* "lexeme.pxd":34 + * self.c = lex + * self.vocab = vocab + * self.orth = lex.orth # <<<<<<<<<<<<<< + * return self + * +*/ + __pyx_t_3 = __pyx_v_lex->orth; + __pyx_v_self->orth = __pyx_t_3; + + /* "lexeme.pxd":35 + * self.vocab = vocab + * self.orth = lex.orth + * return self # <<<<<<<<<<<<<< + * + * @staticmethod +*/ + __Pyx_XDECREF((PyObject *)__pyx_r); + __Pyx_INCREF((PyObject *)__pyx_v_self); + __pyx_r = __pyx_v_self; + goto __pyx_L0; + + /* "lexeme.pxd":29 + * cdef readonly attr_t orth + * + * @staticmethod # <<<<<<<<<<<<<< + * cdef inline Lexeme from_ptr(LexemeC* lex, Vocab vocab): + * cdef Lexeme self = Lexeme.__new__(Lexeme, vocab, lex.orth) +*/ + + /* function exit code */ + __pyx_L1_error:; + __Pyx_XDECREF(__pyx_t_1); + __Pyx_XDECREF(__pyx_t_2); + __Pyx_AddTraceback("spacy.lexeme.Lexeme.from_ptr", __pyx_clineno, __pyx_lineno, __pyx_filename); + __pyx_r = 0; + __pyx_L0:; + __Pyx_XDECREF((PyObject *)__pyx_v_self); + __Pyx_XGIVEREF((PyObject *)__pyx_r); + __Pyx_RefNannyFinishContext(); + return __pyx_r; +} + +/* "lexeme.pxd":37 + * return self + * + * @staticmethod # <<<<<<<<<<<<<< + * cdef inline void set_struct_attr(LexemeC* lex, attr_id_t name, attr_t value) noexcept nogil: + * if name < (sizeof(flags_t) * 8): +*/ + +static CYTHON_INLINE void __pyx_f_5spacy_6lexeme_6Lexeme_set_struct_attr(struct __pyx_t_5spacy_7structs_LexemeC *__pyx_v_lex, enum __pyx_t_5spacy_5attrs_attr_id_t __pyx_v_name, __pyx_t_5spacy_8typedefs_attr_t __pyx_v_value) { + int __pyx_t_1; + + /* "lexeme.pxd":39 + * @staticmethod + * cdef inline void set_struct_attr(LexemeC* lex, attr_id_t name, attr_t value) noexcept nogil: + * if name < (sizeof(flags_t) * 8): # <<<<<<<<<<<<<< + * Lexeme.c_set_flag(lex, name, value) + * elif name == ID: +*/ + __pyx_t_1 = (__pyx_v_name < ((sizeof(__pyx_t_5spacy_8typedefs_flags_t)) * 8)); + if (__pyx_t_1) { + + /* "lexeme.pxd":40 + * cdef inline void set_struct_attr(LexemeC* lex, attr_id_t name, attr_t value) noexcept nogil: + * if name < (sizeof(flags_t) * 8): + * Lexeme.c_set_flag(lex, name, value) # <<<<<<<<<<<<<< + * elif name == ID: + * lex.id = value +*/ + (void)(__pyx_f_5spacy_6lexeme_6Lexeme_c_set_flag(__pyx_v_lex, __pyx_v_name, __pyx_v_value)); + + /* "lexeme.pxd":39 + * @staticmethod + * cdef inline void set_struct_attr(LexemeC* lex, attr_id_t name, attr_t value) noexcept nogil: + * if name < (sizeof(flags_t) * 8): # <<<<<<<<<<<<<< + * Lexeme.c_set_flag(lex, name, value) + * elif name == ID: +*/ + goto __pyx_L3; + } + + /* "lexeme.pxd":41 + * if name < (sizeof(flags_t) * 8): + * Lexeme.c_set_flag(lex, name, value) + * elif name == ID: # <<<<<<<<<<<<<< + * lex.id = value + * elif name == LOWER: +*/ + __pyx_t_1 = (__pyx_v_name == __pyx_e_5spacy_5attrs_ID); + if (__pyx_t_1) { + + /* "lexeme.pxd":42 + * Lexeme.c_set_flag(lex, name, value) + * elif name == ID: + * lex.id = value # <<<<<<<<<<<<<< + * elif name == LOWER: + * lex.lower = value +*/ + __pyx_v_lex->id = __pyx_v_value; + + /* "lexeme.pxd":41 + * if name < (sizeof(flags_t) * 8): + * Lexeme.c_set_flag(lex, name, value) + * elif name == ID: # <<<<<<<<<<<<<< + * lex.id = value + * elif name == LOWER: +*/ + goto __pyx_L3; + } + + /* "lexeme.pxd":43 + * elif name == ID: + * lex.id = value + * elif name == LOWER: # <<<<<<<<<<<<<< + * lex.lower = value + * elif name == NORM: +*/ + __pyx_t_1 = (__pyx_v_name == __pyx_e_5spacy_5attrs_LOWER); + if (__pyx_t_1) { + + /* "lexeme.pxd":44 + * lex.id = value + * elif name == LOWER: + * lex.lower = value # <<<<<<<<<<<<<< + * elif name == NORM: + * lex.norm = value +*/ + __pyx_v_lex->lower = __pyx_v_value; + + /* "lexeme.pxd":43 + * elif name == ID: + * lex.id = value + * elif name == LOWER: # <<<<<<<<<<<<<< + * lex.lower = value + * elif name == NORM: +*/ + goto __pyx_L3; + } + + /* "lexeme.pxd":45 + * elif name == LOWER: + * lex.lower = value + * elif name == NORM: # <<<<<<<<<<<<<< + * lex.norm = value + * elif name == SHAPE: +*/ + __pyx_t_1 = (__pyx_v_name == __pyx_e_5spacy_5attrs_NORM); + if (__pyx_t_1) { + + /* "lexeme.pxd":46 + * lex.lower = value + * elif name == NORM: + * lex.norm = value # <<<<<<<<<<<<<< + * elif name == SHAPE: + * lex.shape = value +*/ + __pyx_v_lex->norm = __pyx_v_value; + + /* "lexeme.pxd":45 + * elif name == LOWER: + * lex.lower = value + * elif name == NORM: # <<<<<<<<<<<<<< + * lex.norm = value + * elif name == SHAPE: +*/ + goto __pyx_L3; + } + + /* "lexeme.pxd":47 + * elif name == NORM: + * lex.norm = value + * elif name == SHAPE: # <<<<<<<<<<<<<< + * lex.shape = value + * elif name == PREFIX: +*/ + __pyx_t_1 = (__pyx_v_name == __pyx_e_5spacy_5attrs_SHAPE); + if (__pyx_t_1) { + + /* "lexeme.pxd":48 + * lex.norm = value + * elif name == SHAPE: + * lex.shape = value # <<<<<<<<<<<<<< + * elif name == PREFIX: + * lex.prefix = value +*/ + __pyx_v_lex->shape = __pyx_v_value; + + /* "lexeme.pxd":47 + * elif name == NORM: + * lex.norm = value + * elif name == SHAPE: # <<<<<<<<<<<<<< + * lex.shape = value + * elif name == PREFIX: +*/ + goto __pyx_L3; + } + + /* "lexeme.pxd":49 + * elif name == SHAPE: + * lex.shape = value + * elif name == PREFIX: # <<<<<<<<<<<<<< + * lex.prefix = value + * elif name == SUFFIX: +*/ + __pyx_t_1 = (__pyx_v_name == __pyx_e_5spacy_5attrs_PREFIX); + if (__pyx_t_1) { + + /* "lexeme.pxd":50 + * lex.shape = value + * elif name == PREFIX: + * lex.prefix = value # <<<<<<<<<<<<<< + * elif name == SUFFIX: + * lex.suffix = value +*/ + __pyx_v_lex->prefix = __pyx_v_value; + + /* "lexeme.pxd":49 + * elif name == SHAPE: + * lex.shape = value + * elif name == PREFIX: # <<<<<<<<<<<<<< + * lex.prefix = value + * elif name == SUFFIX: +*/ + goto __pyx_L3; + } + + /* "lexeme.pxd":51 + * elif name == PREFIX: + * lex.prefix = value + * elif name == SUFFIX: # <<<<<<<<<<<<<< + * lex.suffix = value + * elif name == LANG: +*/ + __pyx_t_1 = (__pyx_v_name == __pyx_e_5spacy_5attrs_SUFFIX); + if (__pyx_t_1) { + + /* "lexeme.pxd":52 + * lex.prefix = value + * elif name == SUFFIX: + * lex.suffix = value # <<<<<<<<<<<<<< + * elif name == LANG: + * lex.lang = value +*/ + __pyx_v_lex->suffix = __pyx_v_value; + + /* "lexeme.pxd":51 + * elif name == PREFIX: + * lex.prefix = value + * elif name == SUFFIX: # <<<<<<<<<<<<<< + * lex.suffix = value + * elif name == LANG: +*/ + goto __pyx_L3; + } + + /* "lexeme.pxd":53 + * elif name == SUFFIX: + * lex.suffix = value + * elif name == LANG: # <<<<<<<<<<<<<< + * lex.lang = value + * +*/ + __pyx_t_1 = (__pyx_v_name == __pyx_e_5spacy_5attrs_LANG); + if (__pyx_t_1) { + + /* "lexeme.pxd":54 + * lex.suffix = value + * elif name == LANG: + * lex.lang = value # <<<<<<<<<<<<<< + * + * @staticmethod +*/ + __pyx_v_lex->lang = __pyx_v_value; + + /* "lexeme.pxd":53 + * elif name == SUFFIX: + * lex.suffix = value + * elif name == LANG: # <<<<<<<<<<<<<< + * lex.lang = value + * +*/ + } + __pyx_L3:; + + /* "lexeme.pxd":37 + * return self + * + * @staticmethod # <<<<<<<<<<<<<< + * cdef inline void set_struct_attr(LexemeC* lex, attr_id_t name, attr_t value) noexcept nogil: + * if name < (sizeof(flags_t) * 8): +*/ + + /* function exit code */ +} + +/* "lexeme.pxd":56 + * lex.lang = value + * + * @staticmethod # <<<<<<<<<<<<<< + * cdef inline attr_t get_struct_attr(const LexemeC* lex, attr_id_t feat_name) noexcept nogil: + * if feat_name < (sizeof(flags_t) * 8): +*/ + +static CYTHON_INLINE __pyx_t_5spacy_8typedefs_attr_t __pyx_f_5spacy_6lexeme_6Lexeme_get_struct_attr(struct __pyx_t_5spacy_7structs_LexemeC const *__pyx_v_lex, enum __pyx_t_5spacy_5attrs_attr_id_t __pyx_v_feat_name) { + __pyx_t_5spacy_8typedefs_attr_t __pyx_r; + int __pyx_t_1; + + /* "lexeme.pxd":58 + * @staticmethod + * cdef inline attr_t get_struct_attr(const LexemeC* lex, attr_id_t feat_name) noexcept nogil: + * if feat_name < (sizeof(flags_t) * 8): # <<<<<<<<<<<<<< + * if Lexeme.c_check_flag(lex, feat_name): + * return 1 +*/ + __pyx_t_1 = (__pyx_v_feat_name < ((sizeof(__pyx_t_5spacy_8typedefs_flags_t)) * 8)); + if (__pyx_t_1) { + + /* "lexeme.pxd":59 + * cdef inline attr_t get_struct_attr(const LexemeC* lex, attr_id_t feat_name) noexcept nogil: + * if feat_name < (sizeof(flags_t) * 8): + * if Lexeme.c_check_flag(lex, feat_name): # <<<<<<<<<<<<<< + * return 1 + * else: +*/ + __pyx_t_1 = __pyx_f_5spacy_6lexeme_6Lexeme_c_check_flag(__pyx_v_lex, __pyx_v_feat_name); + if (__pyx_t_1) { + + /* "lexeme.pxd":60 + * if feat_name < (sizeof(flags_t) * 8): + * if Lexeme.c_check_flag(lex, feat_name): + * return 1 # <<<<<<<<<<<<<< + * else: + * return 0 +*/ + __pyx_r = 1; + goto __pyx_L0; + + /* "lexeme.pxd":59 + * cdef inline attr_t get_struct_attr(const LexemeC* lex, attr_id_t feat_name) noexcept nogil: + * if feat_name < (sizeof(flags_t) * 8): + * if Lexeme.c_check_flag(lex, feat_name): # <<<<<<<<<<<<<< + * return 1 + * else: +*/ + } + + /* "lexeme.pxd":62 + * return 1 + * else: + * return 0 # <<<<<<<<<<<<<< + * elif feat_name == ID: + * return lex.id +*/ + /*else*/ { + __pyx_r = 0; + goto __pyx_L0; + } + + /* "lexeme.pxd":58 + * @staticmethod + * cdef inline attr_t get_struct_attr(const LexemeC* lex, attr_id_t feat_name) noexcept nogil: + * if feat_name < (sizeof(flags_t) * 8): # <<<<<<<<<<<<<< + * if Lexeme.c_check_flag(lex, feat_name): + * return 1 +*/ + } + + /* "lexeme.pxd":63 + * else: + * return 0 + * elif feat_name == ID: # <<<<<<<<<<<<<< + * return lex.id + * elif feat_name == ORTH: +*/ + __pyx_t_1 = (__pyx_v_feat_name == __pyx_e_5spacy_5attrs_ID); + if (__pyx_t_1) { + + /* "lexeme.pxd":64 + * return 0 + * elif feat_name == ID: + * return lex.id # <<<<<<<<<<<<<< + * elif feat_name == ORTH: + * return lex.orth +*/ + __pyx_r = __pyx_v_lex->id; + goto __pyx_L0; + + /* "lexeme.pxd":63 + * else: + * return 0 + * elif feat_name == ID: # <<<<<<<<<<<<<< + * return lex.id + * elif feat_name == ORTH: +*/ + } + + /* "lexeme.pxd":65 + * elif feat_name == ID: + * return lex.id + * elif feat_name == ORTH: # <<<<<<<<<<<<<< + * return lex.orth + * elif feat_name == LOWER: +*/ + __pyx_t_1 = (__pyx_v_feat_name == __pyx_e_5spacy_5attrs_ORTH); + if (__pyx_t_1) { + + /* "lexeme.pxd":66 + * return lex.id + * elif feat_name == ORTH: + * return lex.orth # <<<<<<<<<<<<<< + * elif feat_name == LOWER: + * return lex.lower +*/ + __pyx_r = __pyx_v_lex->orth; + goto __pyx_L0; + + /* "lexeme.pxd":65 + * elif feat_name == ID: + * return lex.id + * elif feat_name == ORTH: # <<<<<<<<<<<<<< + * return lex.orth + * elif feat_name == LOWER: +*/ + } + + /* "lexeme.pxd":67 + * elif feat_name == ORTH: + * return lex.orth + * elif feat_name == LOWER: # <<<<<<<<<<<<<< + * return lex.lower + * elif feat_name == NORM: +*/ + __pyx_t_1 = (__pyx_v_feat_name == __pyx_e_5spacy_5attrs_LOWER); + if (__pyx_t_1) { + + /* "lexeme.pxd":68 + * return lex.orth + * elif feat_name == LOWER: + * return lex.lower # <<<<<<<<<<<<<< + * elif feat_name == NORM: + * return lex.norm +*/ + __pyx_r = __pyx_v_lex->lower; + goto __pyx_L0; + + /* "lexeme.pxd":67 + * elif feat_name == ORTH: + * return lex.orth + * elif feat_name == LOWER: # <<<<<<<<<<<<<< + * return lex.lower + * elif feat_name == NORM: +*/ + } + + /* "lexeme.pxd":69 + * elif feat_name == LOWER: + * return lex.lower + * elif feat_name == NORM: # <<<<<<<<<<<<<< + * return lex.norm + * elif feat_name == SHAPE: +*/ + __pyx_t_1 = (__pyx_v_feat_name == __pyx_e_5spacy_5attrs_NORM); + if (__pyx_t_1) { + + /* "lexeme.pxd":70 + * return lex.lower + * elif feat_name == NORM: + * return lex.norm # <<<<<<<<<<<<<< + * elif feat_name == SHAPE: + * return lex.shape +*/ + __pyx_r = __pyx_v_lex->norm; + goto __pyx_L0; + + /* "lexeme.pxd":69 + * elif feat_name == LOWER: + * return lex.lower + * elif feat_name == NORM: # <<<<<<<<<<<<<< + * return lex.norm + * elif feat_name == SHAPE: +*/ + } + + /* "lexeme.pxd":71 + * elif feat_name == NORM: + * return lex.norm + * elif feat_name == SHAPE: # <<<<<<<<<<<<<< + * return lex.shape + * elif feat_name == PREFIX: +*/ + __pyx_t_1 = (__pyx_v_feat_name == __pyx_e_5spacy_5attrs_SHAPE); + if (__pyx_t_1) { + + /* "lexeme.pxd":72 + * return lex.norm + * elif feat_name == SHAPE: + * return lex.shape # <<<<<<<<<<<<<< + * elif feat_name == PREFIX: + * return lex.prefix +*/ + __pyx_r = __pyx_v_lex->shape; + goto __pyx_L0; + + /* "lexeme.pxd":71 + * elif feat_name == NORM: + * return lex.norm + * elif feat_name == SHAPE: # <<<<<<<<<<<<<< + * return lex.shape + * elif feat_name == PREFIX: +*/ + } + + /* "lexeme.pxd":73 + * elif feat_name == SHAPE: + * return lex.shape + * elif feat_name == PREFIX: # <<<<<<<<<<<<<< + * return lex.prefix + * elif feat_name == SUFFIX: +*/ + __pyx_t_1 = (__pyx_v_feat_name == __pyx_e_5spacy_5attrs_PREFIX); + if (__pyx_t_1) { + + /* "lexeme.pxd":74 + * return lex.shape + * elif feat_name == PREFIX: + * return lex.prefix # <<<<<<<<<<<<<< + * elif feat_name == SUFFIX: + * return lex.suffix +*/ + __pyx_r = __pyx_v_lex->prefix; + goto __pyx_L0; + + /* "lexeme.pxd":73 + * elif feat_name == SHAPE: + * return lex.shape + * elif feat_name == PREFIX: # <<<<<<<<<<<<<< + * return lex.prefix + * elif feat_name == SUFFIX: +*/ + } + + /* "lexeme.pxd":75 + * elif feat_name == PREFIX: + * return lex.prefix + * elif feat_name == SUFFIX: # <<<<<<<<<<<<<< + * return lex.suffix + * elif feat_name == LENGTH: +*/ + __pyx_t_1 = (__pyx_v_feat_name == __pyx_e_5spacy_5attrs_SUFFIX); + if (__pyx_t_1) { + + /* "lexeme.pxd":76 + * return lex.prefix + * elif feat_name == SUFFIX: + * return lex.suffix # <<<<<<<<<<<<<< + * elif feat_name == LENGTH: + * return lex.length +*/ + __pyx_r = __pyx_v_lex->suffix; + goto __pyx_L0; + + /* "lexeme.pxd":75 + * elif feat_name == PREFIX: + * return lex.prefix + * elif feat_name == SUFFIX: # <<<<<<<<<<<<<< + * return lex.suffix + * elif feat_name == LENGTH: +*/ + } + + /* "lexeme.pxd":77 + * elif feat_name == SUFFIX: + * return lex.suffix + * elif feat_name == LENGTH: # <<<<<<<<<<<<<< + * return lex.length + * elif feat_name == LANG: +*/ + __pyx_t_1 = (__pyx_v_feat_name == __pyx_e_5spacy_5attrs_LENGTH); + if (__pyx_t_1) { + + /* "lexeme.pxd":78 + * return lex.suffix + * elif feat_name == LENGTH: + * return lex.length # <<<<<<<<<<<<<< + * elif feat_name == LANG: + * return lex.lang +*/ + __pyx_r = __pyx_v_lex->length; + goto __pyx_L0; + + /* "lexeme.pxd":77 + * elif feat_name == SUFFIX: + * return lex.suffix + * elif feat_name == LENGTH: # <<<<<<<<<<<<<< + * return lex.length + * elif feat_name == LANG: +*/ + } + + /* "lexeme.pxd":79 + * elif feat_name == LENGTH: + * return lex.length + * elif feat_name == LANG: # <<<<<<<<<<<<<< + * return lex.lang + * else: +*/ + __pyx_t_1 = (__pyx_v_feat_name == __pyx_e_5spacy_5attrs_LANG); + if (__pyx_t_1) { + + /* "lexeme.pxd":80 + * return lex.length + * elif feat_name == LANG: + * return lex.lang # <<<<<<<<<<<<<< + * else: + * return 0 +*/ + __pyx_r = __pyx_v_lex->lang; + goto __pyx_L0; + + /* "lexeme.pxd":79 + * elif feat_name == LENGTH: + * return lex.length + * elif feat_name == LANG: # <<<<<<<<<<<<<< + * return lex.lang + * else: +*/ + } + + /* "lexeme.pxd":82 + * return lex.lang + * else: + * return 0 # <<<<<<<<<<<<<< + * + * @staticmethod +*/ + /*else*/ { + __pyx_r = 0; + goto __pyx_L0; + } + + /* "lexeme.pxd":56 + * lex.lang = value + * + * @staticmethod # <<<<<<<<<<<<<< + * cdef inline attr_t get_struct_attr(const LexemeC* lex, attr_id_t feat_name) noexcept nogil: + * if feat_name < (sizeof(flags_t) * 8): +*/ + + /* function exit code */ + __pyx_L0:; + return __pyx_r; +} + +/* "lexeme.pxd":84 + * return 0 + * + * @staticmethod # <<<<<<<<<<<<<< + * cdef inline bint c_check_flag(const LexemeC* lexeme, attr_id_t flag_id) noexcept nogil: + * cdef flags_t one = 1 +*/ + +static CYTHON_INLINE int __pyx_f_5spacy_6lexeme_6Lexeme_c_check_flag(struct __pyx_t_5spacy_7structs_LexemeC const *__pyx_v_lexeme, enum __pyx_t_5spacy_5attrs_attr_id_t __pyx_v_flag_id) { + __pyx_t_5spacy_8typedefs_flags_t __pyx_v_one; + int __pyx_r; + int __pyx_t_1; + + /* "lexeme.pxd":86 + * @staticmethod + * cdef inline bint c_check_flag(const LexemeC* lexeme, attr_id_t flag_id) noexcept nogil: + * cdef flags_t one = 1 # <<<<<<<<<<<<<< + * if lexeme.flags & (one << flag_id): + * return True +*/ + __pyx_v_one = 1; + + /* "lexeme.pxd":87 + * cdef inline bint c_check_flag(const LexemeC* lexeme, attr_id_t flag_id) noexcept nogil: + * cdef flags_t one = 1 + * if lexeme.flags & (one << flag_id): # <<<<<<<<<<<<<< + * return True + * else: +*/ + __pyx_t_1 = ((__pyx_v_lexeme->flags & (__pyx_v_one << __pyx_v_flag_id)) != 0); + if (__pyx_t_1) { + + /* "lexeme.pxd":88 + * cdef flags_t one = 1 + * if lexeme.flags & (one << flag_id): + * return True # <<<<<<<<<<<<<< + * else: + * return False +*/ + __pyx_r = 1; + goto __pyx_L0; + + /* "lexeme.pxd":87 + * cdef inline bint c_check_flag(const LexemeC* lexeme, attr_id_t flag_id) noexcept nogil: + * cdef flags_t one = 1 + * if lexeme.flags & (one << flag_id): # <<<<<<<<<<<<<< + * return True + * else: +*/ + } + + /* "lexeme.pxd":90 + * return True + * else: + * return False # <<<<<<<<<<<<<< + * + * @staticmethod +*/ + /*else*/ { + __pyx_r = 0; + goto __pyx_L0; + } + + /* "lexeme.pxd":84 + * return 0 + * + * @staticmethod # <<<<<<<<<<<<<< + * cdef inline bint c_check_flag(const LexemeC* lexeme, attr_id_t flag_id) noexcept nogil: + * cdef flags_t one = 1 +*/ + + /* function exit code */ + __pyx_L0:; + return __pyx_r; +} + +/* "lexeme.pxd":92 + * return False + * + * @staticmethod # <<<<<<<<<<<<<< + * cdef inline bint c_set_flag(LexemeC* lex, attr_id_t flag_id, bint value) noexcept nogil: + * cdef flags_t one = 1 +*/ + +static CYTHON_INLINE int __pyx_f_5spacy_6lexeme_6Lexeme_c_set_flag(struct __pyx_t_5spacy_7structs_LexemeC *__pyx_v_lex, enum __pyx_t_5spacy_5attrs_attr_id_t __pyx_v_flag_id, int __pyx_v_value) { + __pyx_t_5spacy_8typedefs_flags_t __pyx_v_one; + int __pyx_r; + + /* "lexeme.pxd":94 + * @staticmethod + * cdef inline bint c_set_flag(LexemeC* lex, attr_id_t flag_id, bint value) noexcept nogil: + * cdef flags_t one = 1 # <<<<<<<<<<<<<< + * if value: + * lex.flags |= one << flag_id +*/ + __pyx_v_one = 1; + + /* "lexeme.pxd":95 + * cdef inline bint c_set_flag(LexemeC* lex, attr_id_t flag_id, bint value) noexcept nogil: + * cdef flags_t one = 1 + * if value: # <<<<<<<<<<<<<< + * lex.flags |= one << flag_id + * else: +*/ + if (__pyx_v_value) { + + /* "lexeme.pxd":96 + * cdef flags_t one = 1 + * if value: + * lex.flags |= one << flag_id # <<<<<<<<<<<<<< + * else: + * lex.flags &= ~(one << flag_id) +*/ + __pyx_v_lex->flags = (__pyx_v_lex->flags | (__pyx_v_one << __pyx_v_flag_id)); + + /* "lexeme.pxd":95 + * cdef inline bint c_set_flag(LexemeC* lex, attr_id_t flag_id, bint value) noexcept nogil: + * cdef flags_t one = 1 + * if value: # <<<<<<<<<<<<<< + * lex.flags |= one << flag_id + * else: +*/ + goto __pyx_L3; + } + + /* "lexeme.pxd":98 + * lex.flags |= one << flag_id + * else: + * lex.flags &= ~(one << flag_id) # <<<<<<<<<<<<<< +*/ + /*else*/ { + __pyx_v_lex->flags = (__pyx_v_lex->flags & (~(__pyx_v_one << __pyx_v_flag_id))); + } + __pyx_L3:; + + /* "lexeme.pxd":92 + * return False + * + * @staticmethod # <<<<<<<<<<<<<< + * cdef inline bint c_set_flag(LexemeC* lex, attr_id_t flag_id, bint value) noexcept nogil: + * cdef flags_t one = 1 +*/ + + /* function exit code */ + __pyx_r = 0; + return __pyx_r; +} + +/* "_state.pxd":20 + * + * + * cdef inline bint is_space_token(const TokenC* token) noexcept nogil: # <<<<<<<<<<<<<< + * return Lexeme.c_check_flag(token.lex, IS_SPACE) + * +*/ + +static CYTHON_INLINE int __pyx_f_5spacy_8pipeline_17_parser_internals_6_state_is_space_token(struct __pyx_t_5spacy_7structs_TokenC const *__pyx_v_token) { + int __pyx_r; + + /* "_state.pxd":21 + * + * cdef inline bint is_space_token(const TokenC* token) noexcept nogil: + * return Lexeme.c_check_flag(token.lex, IS_SPACE) # <<<<<<<<<<<<<< + * + * cdef struct ArcC: +*/ + __pyx_r = __pyx_f_5spacy_6lexeme_6Lexeme_c_check_flag(__pyx_v_token->lex, __pyx_e_5spacy_5attrs_IS_SPACE); + goto __pyx_L0; + + /* "_state.pxd":20 + * + * + * cdef inline bint is_space_token(const TokenC* token) noexcept nogil: # <<<<<<<<<<<<<< + * return Lexeme.c_check_flag(token.lex, IS_SPACE) + * +*/ + + /* function exit code */ + __pyx_L0:; + return __pyx_r; +} + +/* "_state.pxd":44 + * int _b_i + * + * inline __init__(const TokenC* sent, int length) noexcept nogil: # <<<<<<<<<<<<<< + * this._sent = sent + * this._heads = calloc(length, sizeof(int)) +*/ + +void __pyx_t_5spacy_8pipeline_17_parser_internals_6_state_StateC::__pyx_f___init__StateC(struct __pyx_t_5spacy_7structs_TokenC const *__pyx_v_sent, int __pyx_v_length) { + int __pyx_v_i; + int __pyx_t_1; + int __pyx_t_2; + PyObject *__pyx_t_3; + int __pyx_t_4; + int __pyx_t_5; + int __pyx_t_6; + int __pyx_lineno = 0; + const char *__pyx_filename = NULL; + int __pyx_clineno = 0; + PyGILState_STATE __pyx_gilstate_save; + + /* "_state.pxd":45 + * + * inline __init__(const TokenC* sent, int length) noexcept nogil: + * this._sent = sent # <<<<<<<<<<<<<< + * this._heads = calloc(length, sizeof(int)) + * if not (this._sent and this._heads): +*/ + this->_sent = __pyx_v_sent; + + /* "_state.pxd":46 + * inline __init__(const TokenC* sent, int length) noexcept nogil: + * this._sent = sent + * this._heads = calloc(length, sizeof(int)) # <<<<<<<<<<<<<< + * if not (this._sent and this._heads): + * with gil: +*/ + this->_heads = ((int *)calloc(__pyx_v_length, (sizeof(int)))); + + /* "_state.pxd":47 + * this._sent = sent + * this._heads = calloc(length, sizeof(int)) + * if not (this._sent and this._heads): # <<<<<<<<<<<<<< + * with gil: + * PyErr_SetFromErrno(MemoryError) +*/ + __pyx_t_2 = (this->_sent != 0); + if (__pyx_t_2) { + } else { + __pyx_t_1 = __pyx_t_2; + goto __pyx_L4_bool_binop_done; + } + __pyx_t_2 = (this->_heads != 0); + __pyx_t_1 = __pyx_t_2; + __pyx_L4_bool_binop_done:; + __pyx_t_2 = (!__pyx_t_1); + if (__pyx_t_2) { + + /* "_state.pxd":48 + * this._heads = calloc(length, sizeof(int)) + * if not (this._sent and this._heads): + * with gil: # <<<<<<<<<<<<<< + * PyErr_SetFromErrno(MemoryError) + * PyErr_CheckSignals() +*/ + { + PyGILState_STATE __pyx_gilstate_save = __Pyx_PyGILState_Ensure(); + /*try:*/ { + + /* "_state.pxd":49 + * if not (this._sent and this._heads): + * with gil: + * PyErr_SetFromErrno(MemoryError) # <<<<<<<<<<<<<< + * PyErr_CheckSignals() + * this.offset = 0 +*/ + __pyx_t_3 = PyErr_SetFromErrno(((PyObject *)(((PyTypeObject*)PyExc_MemoryError)))); if (unlikely(__pyx_t_3 == ((void *)NULL))) __PYX_ERR(4, 49, __pyx_L7_error) + + /* "_state.pxd":50 + * with gil: + * PyErr_SetFromErrno(MemoryError) + * PyErr_CheckSignals() # <<<<<<<<<<<<<< + * this.offset = 0 + * this.length = length +*/ + __pyx_t_4 = PyErr_CheckSignals(); if (unlikely(__pyx_t_4 == ((int)-1))) __PYX_ERR(4, 50, __pyx_L7_error) + } + + /* "_state.pxd":48 + * this._heads = calloc(length, sizeof(int)) + * if not (this._sent and this._heads): + * with gil: # <<<<<<<<<<<<<< + * PyErr_SetFromErrno(MemoryError) + * PyErr_CheckSignals() +*/ + /*finally:*/ { + /*normal exit:*/{ + __Pyx_PyGILState_Release(__pyx_gilstate_save); + goto __pyx_L8; + } + __pyx_L7_error: { + __Pyx_PyGILState_Release(__pyx_gilstate_save); + goto __pyx_L1_error; + } + __pyx_L8:; + } + } + + /* "_state.pxd":47 + * this._sent = sent + * this._heads = calloc(length, sizeof(int)) + * if not (this._sent and this._heads): # <<<<<<<<<<<<<< + * with gil: + * PyErr_SetFromErrno(MemoryError) +*/ + } + + /* "_state.pxd":51 + * PyErr_SetFromErrno(MemoryError) + * PyErr_CheckSignals() + * this.offset = 0 # <<<<<<<<<<<<<< + * this.length = length + * this._b_i = 0 +*/ + this->offset = 0; + + /* "_state.pxd":52 + * PyErr_CheckSignals() + * this.offset = 0 + * this.length = length # <<<<<<<<<<<<<< + * this._b_i = 0 + * for i in range(length): +*/ + this->length = __pyx_v_length; + + /* "_state.pxd":53 + * this.offset = 0 + * this.length = length + * this._b_i = 0 # <<<<<<<<<<<<<< + * for i in range(length): + * this._heads[i] = -1 +*/ + this->_b_i = 0; + + /* "_state.pxd":54 + * this.length = length + * this._b_i = 0 + * for i in range(length): # <<<<<<<<<<<<<< + * this._heads[i] = -1 + * this._unshiftable.push_back(0) +*/ + __pyx_t_4 = __pyx_v_length; + __pyx_t_5 = __pyx_t_4; + for (__pyx_t_6 = 0; __pyx_t_6 < __pyx_t_5; __pyx_t_6+=1) { + __pyx_v_i = __pyx_t_6; + + /* "_state.pxd":55 + * this._b_i = 0 + * for i in range(length): + * this._heads[i] = -1 # <<<<<<<<<<<<<< + * this._unshiftable.push_back(0) + * memset(&this._empty_token, 0, sizeof(TokenC)) +*/ + (this->_heads[__pyx_v_i]) = -1; + + /* "_state.pxd":56 + * for i in range(length): + * this._heads[i] = -1 + * this._unshiftable.push_back(0) # <<<<<<<<<<<<<< + * memset(&this._empty_token, 0, sizeof(TokenC)) + * this._empty_token.lex = &EMPTY_LEXEME +*/ + try { + this->_unshiftable.push_back(0); + } catch(...) { + PyGILState_STATE __pyx_gilstate_save = __Pyx_PyGILState_Ensure(); + __Pyx_CppExn2PyErr(); + __Pyx_PyGILState_Release(__pyx_gilstate_save); + __PYX_ERR(4, 56, __pyx_L1_error) + } + } + + /* "_state.pxd":57 + * this._heads[i] = -1 + * this._unshiftable.push_back(0) + * memset(&this._empty_token, 0, sizeof(TokenC)) # <<<<<<<<<<<<<< + * this._empty_token.lex = &EMPTY_LEXEME + * +*/ + (void)(memset((&this->_empty_token), 0, (sizeof(struct __pyx_t_5spacy_7structs_TokenC)))); + + /* "_state.pxd":58 + * this._unshiftable.push_back(0) + * memset(&this._empty_token, 0, sizeof(TokenC)) + * this._empty_token.lex = &EMPTY_LEXEME # <<<<<<<<<<<<<< + * + * inline __dealloc__(): +*/ + this->_empty_token.lex = (&__pyx_v_5spacy_5vocab_EMPTY_LEXEME); + + /* "_state.pxd":44 + * int _b_i + * + * inline __init__(const TokenC* sent, int length) noexcept nogil: # <<<<<<<<<<<<<< + * this._sent = sent + * this._heads = calloc(length, sizeof(int)) +*/ + + /* function exit code */ + goto __pyx_L0; + __pyx_L1_error:; + __pyx_gilstate_save = __Pyx_PyGILState_Ensure(); + __Pyx_WriteUnraisable("StateC.", __pyx_clineno, __pyx_lineno, __pyx_filename, 1, 0); + __Pyx_PyGILState_Release(__pyx_gilstate_save); + __pyx_L0:; +} + +/* "_state.pxd":60 + * this._empty_token.lex = &EMPTY_LEXEME + * + * inline __dealloc__(): # <<<<<<<<<<<<<< + * free(this._heads) + * +*/ + +void __pyx_t_5spacy_8pipeline_17_parser_internals_6_state_StateC::__pyx_f___dealloc__StateC(void) { + + /* "_state.pxd":61 + * + * inline __dealloc__(): + * free(this._heads) # <<<<<<<<<<<<<< + * + * inline void set_context_tokens(int* ids, int n) noexcept nogil: +*/ + free(this->_heads); + + /* "_state.pxd":60 + * this._empty_token.lex = &EMPTY_LEXEME + * + * inline __dealloc__(): # <<<<<<<<<<<<<< + * free(this._heads) + * +*/ + + /* function exit code */ +} + +/* "_state.pxd":63 + * free(this._heads) + * + * inline void set_context_tokens(int* ids, int n) noexcept nogil: # <<<<<<<<<<<<<< + * cdef int i, j + * if n == 1: +*/ + +void __pyx_t_5spacy_8pipeline_17_parser_internals_6_state_StateC::set_context_tokens(int *__pyx_v_ids, int __pyx_v_n) { + int __pyx_v_i; + int __pyx_v_j; + struct __pyx_t_5spacy_7structs_SpanC __pyx_v_ent; + int __pyx_t_1; + int __pyx_t_2; + int __pyx_t_3; + int __pyx_t_4; + int __pyx_t_5; + int __pyx_t_6; + + /* "_state.pxd":65 + * inline void set_context_tokens(int* ids, int n) noexcept nogil: + * cdef int i, j + * if n == 1: # <<<<<<<<<<<<<< + * if this.B(0) >= 0: + * ids[0] = this.B(0) +*/ + switch (__pyx_v_n) { + case 1: + + /* "_state.pxd":66 + * cdef int i, j + * if n == 1: + * if this.B(0) >= 0: # <<<<<<<<<<<<<< + * ids[0] = this.B(0) + * else: +*/ + __pyx_t_1 = (this->B(0) >= 0); + if (__pyx_t_1) { + + /* "_state.pxd":67 + * if n == 1: + * if this.B(0) >= 0: + * ids[0] = this.B(0) # <<<<<<<<<<<<<< + * else: + * ids[0] = -1 +*/ + (__pyx_v_ids[0]) = this->B(0); + + /* "_state.pxd":66 + * cdef int i, j + * if n == 1: + * if this.B(0) >= 0: # <<<<<<<<<<<<<< + * ids[0] = this.B(0) + * else: +*/ + goto __pyx_L3; + } + + /* "_state.pxd":69 + * ids[0] = this.B(0) + * else: + * ids[0] = -1 # <<<<<<<<<<<<<< + * elif n == 2: + * ids[0] = this.B(0) +*/ + /*else*/ { + (__pyx_v_ids[0]) = -1; + } + __pyx_L3:; + + /* "_state.pxd":65 + * inline void set_context_tokens(int* ids, int n) noexcept nogil: + * cdef int i, j + * if n == 1: # <<<<<<<<<<<<<< + * if this.B(0) >= 0: + * ids[0] = this.B(0) +*/ + break; + case 2: + + /* "_state.pxd":71 + * ids[0] = -1 + * elif n == 2: + * ids[0] = this.B(0) # <<<<<<<<<<<<<< + * ids[1] = this.S(0) + * elif n == 3: +*/ + (__pyx_v_ids[0]) = this->B(0); + + /* "_state.pxd":72 + * elif n == 2: + * ids[0] = this.B(0) + * ids[1] = this.S(0) # <<<<<<<<<<<<<< + * elif n == 3: + * if this.B(0) >= 0: +*/ + (__pyx_v_ids[1]) = this->S(0); + + /* "_state.pxd":70 + * else: + * ids[0] = -1 + * elif n == 2: # <<<<<<<<<<<<<< + * ids[0] = this.B(0) + * ids[1] = this.S(0) +*/ + break; + case 3: + + /* "_state.pxd":74 + * ids[1] = this.S(0) + * elif n == 3: + * if this.B(0) >= 0: # <<<<<<<<<<<<<< + * ids[0] = this.B(0) + * else: +*/ + __pyx_t_1 = (this->B(0) >= 0); + if (__pyx_t_1) { + + /* "_state.pxd":75 + * elif n == 3: + * if this.B(0) >= 0: + * ids[0] = this.B(0) # <<<<<<<<<<<<<< + * else: + * ids[0] = -1 +*/ + (__pyx_v_ids[0]) = this->B(0); + + /* "_state.pxd":74 + * ids[1] = this.S(0) + * elif n == 3: + * if this.B(0) >= 0: # <<<<<<<<<<<<<< + * ids[0] = this.B(0) + * else: +*/ + goto __pyx_L4; + } + + /* "_state.pxd":77 + * ids[0] = this.B(0) + * else: + * ids[0] = -1 # <<<<<<<<<<<<<< + * # First word of entity, if any + * if this.entity_is_open(): +*/ + /*else*/ { + (__pyx_v_ids[0]) = -1; + } + __pyx_L4:; + + /* "_state.pxd":79 + * ids[0] = -1 + * # First word of entity, if any + * if this.entity_is_open(): # <<<<<<<<<<<<<< + * ids[1] = this.E(0) + * else: +*/ + __pyx_t_1 = this->entity_is_open(); + if (__pyx_t_1) { + + /* "_state.pxd":80 + * # First word of entity, if any + * if this.entity_is_open(): + * ids[1] = this.E(0) # <<<<<<<<<<<<<< + * else: + * ids[1] = -1 +*/ + (__pyx_v_ids[1]) = this->E(0); + + /* "_state.pxd":79 + * ids[0] = -1 + * # First word of entity, if any + * if this.entity_is_open(): # <<<<<<<<<<<<<< + * ids[1] = this.E(0) + * else: +*/ + goto __pyx_L5; + } + + /* "_state.pxd":82 + * ids[1] = this.E(0) + * else: + * ids[1] = -1 # <<<<<<<<<<<<<< + * # Last word of entity, if within entity + * if ids[0] == -1 or ids[1] == -1: +*/ + /*else*/ { + (__pyx_v_ids[1]) = -1; + } + __pyx_L5:; + + /* "_state.pxd":84 + * ids[1] = -1 + * # Last word of entity, if within entity + * if ids[0] == -1 or ids[1] == -1: # <<<<<<<<<<<<<< + * ids[2] = -1 + * else: +*/ + __pyx_t_2 = ((__pyx_v_ids[0]) == -1L); + if (!__pyx_t_2) { + } else { + __pyx_t_1 = __pyx_t_2; + goto __pyx_L7_bool_binop_done; + } + __pyx_t_2 = ((__pyx_v_ids[1]) == -1L); + __pyx_t_1 = __pyx_t_2; + __pyx_L7_bool_binop_done:; + if (__pyx_t_1) { + + /* "_state.pxd":85 + * # Last word of entity, if within entity + * if ids[0] == -1 or ids[1] == -1: + * ids[2] = -1 # <<<<<<<<<<<<<< + * else: + * ids[2] = ids[0] - 1 +*/ + (__pyx_v_ids[2]) = -1; + + /* "_state.pxd":84 + * ids[1] = -1 + * # Last word of entity, if within entity + * if ids[0] == -1 or ids[1] == -1: # <<<<<<<<<<<<<< + * ids[2] = -1 + * else: +*/ + goto __pyx_L6; + } + + /* "_state.pxd":87 + * ids[2] = -1 + * else: + * ids[2] = ids[0] - 1 # <<<<<<<<<<<<<< + * elif n == 8: + * ids[0] = this.B(0) +*/ + /*else*/ { + (__pyx_v_ids[2]) = ((__pyx_v_ids[0]) - 1); + } + __pyx_L6:; + + /* "_state.pxd":73 + * ids[0] = this.B(0) + * ids[1] = this.S(0) + * elif n == 3: # <<<<<<<<<<<<<< + * if this.B(0) >= 0: + * ids[0] = this.B(0) +*/ + break; + case 8: + + /* "_state.pxd":89 + * ids[2] = ids[0] - 1 + * elif n == 8: + * ids[0] = this.B(0) # <<<<<<<<<<<<<< + * ids[1] = this.B(1) + * ids[2] = this.S(0) +*/ + (__pyx_v_ids[0]) = this->B(0); + + /* "_state.pxd":90 + * elif n == 8: + * ids[0] = this.B(0) + * ids[1] = this.B(1) # <<<<<<<<<<<<<< + * ids[2] = this.S(0) + * ids[3] = this.S(1) +*/ + (__pyx_v_ids[1]) = this->B(1); + + /* "_state.pxd":91 + * ids[0] = this.B(0) + * ids[1] = this.B(1) + * ids[2] = this.S(0) # <<<<<<<<<<<<<< + * ids[3] = this.S(1) + * ids[4] = this.S(2) +*/ + (__pyx_v_ids[2]) = this->S(0); + + /* "_state.pxd":92 + * ids[1] = this.B(1) + * ids[2] = this.S(0) + * ids[3] = this.S(1) # <<<<<<<<<<<<<< + * ids[4] = this.S(2) + * ids[5] = this.L(this.B(0), 1) +*/ + (__pyx_v_ids[3]) = this->S(1); + + /* "_state.pxd":93 + * ids[2] = this.S(0) + * ids[3] = this.S(1) + * ids[4] = this.S(2) # <<<<<<<<<<<<<< + * ids[5] = this.L(this.B(0), 1) + * ids[6] = this.L(this.S(0), 1) +*/ + (__pyx_v_ids[4]) = this->S(2); + + /* "_state.pxd":94 + * ids[3] = this.S(1) + * ids[4] = this.S(2) + * ids[5] = this.L(this.B(0), 1) # <<<<<<<<<<<<<< + * ids[6] = this.L(this.S(0), 1) + * ids[7] = this.R(this.S(0), 1) +*/ + (__pyx_v_ids[5]) = this->L(this->B(0), 1); + + /* "_state.pxd":95 + * ids[4] = this.S(2) + * ids[5] = this.L(this.B(0), 1) + * ids[6] = this.L(this.S(0), 1) # <<<<<<<<<<<<<< + * ids[7] = this.R(this.S(0), 1) + * elif n == 13: +*/ + (__pyx_v_ids[6]) = this->L(this->S(0), 1); + + /* "_state.pxd":96 + * ids[5] = this.L(this.B(0), 1) + * ids[6] = this.L(this.S(0), 1) + * ids[7] = this.R(this.S(0), 1) # <<<<<<<<<<<<<< + * elif n == 13: + * ids[0] = this.B(0) +*/ + (__pyx_v_ids[7]) = this->R(this->S(0), 1); + + /* "_state.pxd":88 + * else: + * ids[2] = ids[0] - 1 + * elif n == 8: # <<<<<<<<<<<<<< + * ids[0] = this.B(0) + * ids[1] = this.B(1) +*/ + break; + case 13: + + /* "_state.pxd":98 + * ids[7] = this.R(this.S(0), 1) + * elif n == 13: + * ids[0] = this.B(0) # <<<<<<<<<<<<<< + * ids[1] = this.B(1) + * ids[2] = this.S(0) +*/ + (__pyx_v_ids[0]) = this->B(0); + + /* "_state.pxd":99 + * elif n == 13: + * ids[0] = this.B(0) + * ids[1] = this.B(1) # <<<<<<<<<<<<<< + * ids[2] = this.S(0) + * ids[3] = this.S(1) +*/ + (__pyx_v_ids[1]) = this->B(1); + + /* "_state.pxd":100 + * ids[0] = this.B(0) + * ids[1] = this.B(1) + * ids[2] = this.S(0) # <<<<<<<<<<<<<< + * ids[3] = this.S(1) + * ids[4] = this.S(2) +*/ + (__pyx_v_ids[2]) = this->S(0); + + /* "_state.pxd":101 + * ids[1] = this.B(1) + * ids[2] = this.S(0) + * ids[3] = this.S(1) # <<<<<<<<<<<<<< + * ids[4] = this.S(2) + * ids[5] = this.L(this.S(0), 1) +*/ + (__pyx_v_ids[3]) = this->S(1); + + /* "_state.pxd":102 + * ids[2] = this.S(0) + * ids[3] = this.S(1) + * ids[4] = this.S(2) # <<<<<<<<<<<<<< + * ids[5] = this.L(this.S(0), 1) + * ids[6] = this.L(this.S(0), 2) +*/ + (__pyx_v_ids[4]) = this->S(2); + + /* "_state.pxd":103 + * ids[3] = this.S(1) + * ids[4] = this.S(2) + * ids[5] = this.L(this.S(0), 1) # <<<<<<<<<<<<<< + * ids[6] = this.L(this.S(0), 2) + * ids[6] = this.R(this.S(0), 1) +*/ + (__pyx_v_ids[5]) = this->L(this->S(0), 1); + + /* "_state.pxd":104 + * ids[4] = this.S(2) + * ids[5] = this.L(this.S(0), 1) + * ids[6] = this.L(this.S(0), 2) # <<<<<<<<<<<<<< + * ids[6] = this.R(this.S(0), 1) + * ids[7] = this.L(this.B(0), 1) +*/ + (__pyx_v_ids[6]) = this->L(this->S(0), 2); + + /* "_state.pxd":105 + * ids[5] = this.L(this.S(0), 1) + * ids[6] = this.L(this.S(0), 2) + * ids[6] = this.R(this.S(0), 1) # <<<<<<<<<<<<<< + * ids[7] = this.L(this.B(0), 1) + * ids[8] = this.R(this.S(0), 2) +*/ + (__pyx_v_ids[6]) = this->R(this->S(0), 1); + + /* "_state.pxd":106 + * ids[6] = this.L(this.S(0), 2) + * ids[6] = this.R(this.S(0), 1) + * ids[7] = this.L(this.B(0), 1) # <<<<<<<<<<<<<< + * ids[8] = this.R(this.S(0), 2) + * ids[9] = this.L(this.S(1), 1) +*/ + (__pyx_v_ids[7]) = this->L(this->B(0), 1); + + /* "_state.pxd":107 + * ids[6] = this.R(this.S(0), 1) + * ids[7] = this.L(this.B(0), 1) + * ids[8] = this.R(this.S(0), 2) # <<<<<<<<<<<<<< + * ids[9] = this.L(this.S(1), 1) + * ids[10] = this.L(this.S(1), 2) +*/ + (__pyx_v_ids[8]) = this->R(this->S(0), 2); + + /* "_state.pxd":108 + * ids[7] = this.L(this.B(0), 1) + * ids[8] = this.R(this.S(0), 2) + * ids[9] = this.L(this.S(1), 1) # <<<<<<<<<<<<<< + * ids[10] = this.L(this.S(1), 2) + * ids[11] = this.R(this.S(1), 1) +*/ + (__pyx_v_ids[9]) = this->L(this->S(1), 1); + + /* "_state.pxd":109 + * ids[8] = this.R(this.S(0), 2) + * ids[9] = this.L(this.S(1), 1) + * ids[10] = this.L(this.S(1), 2) # <<<<<<<<<<<<<< + * ids[11] = this.R(this.S(1), 1) + * ids[12] = this.R(this.S(1), 2) +*/ + (__pyx_v_ids[10]) = this->L(this->S(1), 2); + + /* "_state.pxd":110 + * ids[9] = this.L(this.S(1), 1) + * ids[10] = this.L(this.S(1), 2) + * ids[11] = this.R(this.S(1), 1) # <<<<<<<<<<<<<< + * ids[12] = this.R(this.S(1), 2) + * elif n == 6: +*/ + (__pyx_v_ids[11]) = this->R(this->S(1), 1); + + /* "_state.pxd":111 + * ids[10] = this.L(this.S(1), 2) + * ids[11] = this.R(this.S(1), 1) + * ids[12] = this.R(this.S(1), 2) # <<<<<<<<<<<<<< + * elif n == 6: + * for i in range(6): +*/ + (__pyx_v_ids[12]) = this->R(this->S(1), 2); + + /* "_state.pxd":97 + * ids[6] = this.L(this.S(0), 1) + * ids[7] = this.R(this.S(0), 1) + * elif n == 13: # <<<<<<<<<<<<<< + * ids[0] = this.B(0) + * ids[1] = this.B(1) +*/ + break; + case 6: + + /* "_state.pxd":113 + * ids[12] = this.R(this.S(1), 2) + * elif n == 6: + * for i in range(6): # <<<<<<<<<<<<<< + * ids[i] = -1 + * if this.B(0) >= 0: +*/ + for (__pyx_t_3 = 0; __pyx_t_3 < 6; __pyx_t_3+=1) { + __pyx_v_i = __pyx_t_3; + + /* "_state.pxd":114 + * elif n == 6: + * for i in range(6): + * ids[i] = -1 # <<<<<<<<<<<<<< + * if this.B(0) >= 0: + * ids[0] = this.B(0) +*/ + (__pyx_v_ids[__pyx_v_i]) = -1; + } + + /* "_state.pxd":115 + * for i in range(6): + * ids[i] = -1 + * if this.B(0) >= 0: # <<<<<<<<<<<<<< + * ids[0] = this.B(0) + * if this.entity_is_open(): +*/ + __pyx_t_1 = (this->B(0) >= 0); + if (__pyx_t_1) { + + /* "_state.pxd":116 + * ids[i] = -1 + * if this.B(0) >= 0: + * ids[0] = this.B(0) # <<<<<<<<<<<<<< + * if this.entity_is_open(): + * ent = this.get_ent() +*/ + (__pyx_v_ids[0]) = this->B(0); + + /* "_state.pxd":115 + * for i in range(6): + * ids[i] = -1 + * if this.B(0) >= 0: # <<<<<<<<<<<<<< + * ids[0] = this.B(0) + * if this.entity_is_open(): +*/ + } + + /* "_state.pxd":117 + * if this.B(0) >= 0: + * ids[0] = this.B(0) + * if this.entity_is_open(): # <<<<<<<<<<<<<< + * ent = this.get_ent() + * j = 1 +*/ + __pyx_t_1 = this->entity_is_open(); + if (__pyx_t_1) { + + /* "_state.pxd":118 + * ids[0] = this.B(0) + * if this.entity_is_open(): + * ent = this.get_ent() # <<<<<<<<<<<<<< + * j = 1 + * for i in range(ent.start, this.B(0)): +*/ + __pyx_v_ent = this->get_ent(); + + /* "_state.pxd":119 + * if this.entity_is_open(): + * ent = this.get_ent() + * j = 1 # <<<<<<<<<<<<<< + * for i in range(ent.start, this.B(0)): + * ids[j] = i +*/ + __pyx_v_j = 1; + + /* "_state.pxd":120 + * ent = this.get_ent() + * j = 1 + * for i in range(ent.start, this.B(0)): # <<<<<<<<<<<<<< + * ids[j] = i + * j += 1 +*/ + __pyx_t_3 = this->B(0); + __pyx_t_4 = __pyx_t_3; + for (__pyx_t_5 = __pyx_v_ent.start; __pyx_t_5 < __pyx_t_4; __pyx_t_5+=1) { + __pyx_v_i = __pyx_t_5; + + /* "_state.pxd":121 + * j = 1 + * for i in range(ent.start, this.B(0)): + * ids[j] = i # <<<<<<<<<<<<<< + * j += 1 + * if j >= 6: +*/ + (__pyx_v_ids[__pyx_v_j]) = __pyx_v_i; + + /* "_state.pxd":122 + * for i in range(ent.start, this.B(0)): + * ids[j] = i + * j += 1 # <<<<<<<<<<<<<< + * if j >= 6: + * break +*/ + __pyx_v_j = (__pyx_v_j + 1); + + /* "_state.pxd":123 + * ids[j] = i + * j += 1 + * if j >= 6: # <<<<<<<<<<<<<< + * break + * else: +*/ + __pyx_t_1 = (__pyx_v_j >= 6); + if (__pyx_t_1) { + + /* "_state.pxd":124 + * j += 1 + * if j >= 6: + * break # <<<<<<<<<<<<<< + * else: + * # TODO error =/ +*/ + goto __pyx_L14_break; + + /* "_state.pxd":123 + * ids[j] = i + * j += 1 + * if j >= 6: # <<<<<<<<<<<<<< + * break + * else: +*/ + } + } + __pyx_L14_break:; + + /* "_state.pxd":117 + * if this.B(0) >= 0: + * ids[0] = this.B(0) + * if this.entity_is_open(): # <<<<<<<<<<<<<< + * ent = this.get_ent() + * j = 1 +*/ + } + + /* "_state.pxd":112 + * ids[11] = this.R(this.S(1), 1) + * ids[12] = this.R(this.S(1), 2) + * elif n == 6: # <<<<<<<<<<<<<< + * for i in range(6): + * ids[i] = -1 +*/ + break; + default: + break; + } + + /* "_state.pxd":128 + * # TODO error =/ + * pass + * for i in range(n): # <<<<<<<<<<<<<< + * if ids[i] >= 0: + * ids[i] += this.offset +*/ + __pyx_t_3 = __pyx_v_n; + __pyx_t_4 = __pyx_t_3; + for (__pyx_t_5 = 0; __pyx_t_5 < __pyx_t_4; __pyx_t_5+=1) { + __pyx_v_i = __pyx_t_5; + + /* "_state.pxd":129 + * pass + * for i in range(n): + * if ids[i] >= 0: # <<<<<<<<<<<<<< + * ids[i] += this.offset + * else: +*/ + __pyx_t_1 = ((__pyx_v_ids[__pyx_v_i]) >= 0); + if (__pyx_t_1) { + + /* "_state.pxd":130 + * for i in range(n): + * if ids[i] >= 0: + * ids[i] += this.offset # <<<<<<<<<<<<<< + * else: + * ids[i] = -1 +*/ + __pyx_t_6 = __pyx_v_i; + (__pyx_v_ids[__pyx_t_6]) = ((__pyx_v_ids[__pyx_t_6]) + this->offset); + + /* "_state.pxd":129 + * pass + * for i in range(n): + * if ids[i] >= 0: # <<<<<<<<<<<<<< + * ids[i] += this.offset + * else: +*/ + goto __pyx_L18; + } + + /* "_state.pxd":132 + * ids[i] += this.offset + * else: + * ids[i] = -1 # <<<<<<<<<<<<<< + * + * inline int S(int i) noexcept nogil const: +*/ + /*else*/ { + (__pyx_v_ids[__pyx_v_i]) = -1; + } + __pyx_L18:; + } + + /* "_state.pxd":63 + * free(this._heads) + * + * inline void set_context_tokens(int* ids, int n) noexcept nogil: # <<<<<<<<<<<<<< + * cdef int i, j + * if n == 1: +*/ + + /* function exit code */ +} + +/* "_state.pxd":134 + * ids[i] = -1 + * + * inline int S(int i) noexcept nogil const: # <<<<<<<<<<<<<< + * if i >= this._stack.size(): + * return -1 +*/ + +int __pyx_t_5spacy_8pipeline_17_parser_internals_6_state_StateC::S(int __pyx_v_i) const { + int __pyx_r; + int __pyx_t_1; + __Pyx_FakeReference __pyx_t_2; + int __pyx_lineno = 0; + const char *__pyx_filename = NULL; + int __pyx_clineno = 0; + PyGILState_STATE __pyx_gilstate_save; + + /* "_state.pxd":135 + * + * inline int S(int i) noexcept nogil const: + * if i >= this._stack.size(): # <<<<<<<<<<<<<< + * return -1 + * elif i < 0: +*/ + __pyx_t_1 = (__pyx_v_i >= this->_stack.size()); + if (__pyx_t_1) { + + /* "_state.pxd":136 + * inline int S(int i) noexcept nogil const: + * if i >= this._stack.size(): + * return -1 # <<<<<<<<<<<<<< + * elif i < 0: + * return -1 +*/ + __pyx_r = -1; + goto __pyx_L0; + + /* "_state.pxd":135 + * + * inline int S(int i) noexcept nogil const: + * if i >= this._stack.size(): # <<<<<<<<<<<<<< + * return -1 + * elif i < 0: +*/ + } + + /* "_state.pxd":137 + * if i >= this._stack.size(): + * return -1 + * elif i < 0: # <<<<<<<<<<<<<< + * return -1 + * return this._stack.at(this._stack.size() - (i+1)) +*/ + __pyx_t_1 = (__pyx_v_i < 0); + if (__pyx_t_1) { + + /* "_state.pxd":138 + * return -1 + * elif i < 0: + * return -1 # <<<<<<<<<<<<<< + * return this._stack.at(this._stack.size() - (i+1)) + * +*/ + __pyx_r = -1; + goto __pyx_L0; + + /* "_state.pxd":137 + * if i >= this._stack.size(): + * return -1 + * elif i < 0: # <<<<<<<<<<<<<< + * return -1 + * return this._stack.at(this._stack.size() - (i+1)) +*/ + } + + /* "_state.pxd":139 + * elif i < 0: + * return -1 + * return this._stack.at(this._stack.size() - (i+1)) # <<<<<<<<<<<<<< + * + * inline int B(int i) noexcept nogil const: +*/ + try { + __pyx_t_2 = this->_stack.at((this->_stack.size() - (__pyx_v_i + 1))); + } catch(...) { + PyGILState_STATE __pyx_gilstate_save = __Pyx_PyGILState_Ensure(); + __Pyx_CppExn2PyErr(); + __Pyx_PyGILState_Release(__pyx_gilstate_save); + __PYX_ERR(4, 139, __pyx_L1_error) + } + __pyx_r = __pyx_t_2; + goto __pyx_L0; + + /* "_state.pxd":134 + * ids[i] = -1 + * + * inline int S(int i) noexcept nogil const: # <<<<<<<<<<<<<< + * if i >= this._stack.size(): + * return -1 +*/ + + /* function exit code */ + __pyx_L1_error:; + __pyx_gilstate_save = __Pyx_PyGILState_Ensure(); + __Pyx_WriteUnraisable("StateC.S", __pyx_clineno, __pyx_lineno, __pyx_filename, 1, 0); + __pyx_r = 0; + __Pyx_PyGILState_Release(__pyx_gilstate_save); + __pyx_L0:; + return __pyx_r; +} + +/* "_state.pxd":141 + * return this._stack.at(this._stack.size() - (i+1)) + * + * inline int B(int i) noexcept nogil const: # <<<<<<<<<<<<<< + * if i < 0: + * return -1 +*/ + +int __pyx_t_5spacy_8pipeline_17_parser_internals_6_state_StateC::B(int __pyx_v_i) const { + std::vector ::size_type __pyx_v_b_i; + int __pyx_r; + int __pyx_t_1; + __Pyx_FakeReference __pyx_t_2; + int __pyx_lineno = 0; + const char *__pyx_filename = NULL; + int __pyx_clineno = 0; + PyGILState_STATE __pyx_gilstate_save; + + /* "_state.pxd":142 + * + * inline int B(int i) noexcept nogil const: + * if i < 0: # <<<<<<<<<<<<<< + * return -1 + * elif i < this._rebuffer.size(): +*/ + __pyx_t_1 = (__pyx_v_i < 0); + if (__pyx_t_1) { + + /* "_state.pxd":143 + * inline int B(int i) noexcept nogil const: + * if i < 0: + * return -1 # <<<<<<<<<<<<<< + * elif i < this._rebuffer.size(): + * return this._rebuffer.at(this._rebuffer.size() - (i+1)) +*/ + __pyx_r = -1; + goto __pyx_L0; + + /* "_state.pxd":142 + * + * inline int B(int i) noexcept nogil const: + * if i < 0: # <<<<<<<<<<<<<< + * return -1 + * elif i < this._rebuffer.size(): +*/ + } + + /* "_state.pxd":144 + * if i < 0: + * return -1 + * elif i < this._rebuffer.size(): # <<<<<<<<<<<<<< + * return this._rebuffer.at(this._rebuffer.size() - (i+1)) + * else: +*/ + __pyx_t_1 = (__pyx_v_i < this->_rebuffer.size()); + if (__pyx_t_1) { + + /* "_state.pxd":145 + * return -1 + * elif i < this._rebuffer.size(): + * return this._rebuffer.at(this._rebuffer.size() - (i+1)) # <<<<<<<<<<<<<< + * else: + * b_i = this._b_i + (i - this._rebuffer.size()) +*/ + try { + __pyx_t_2 = this->_rebuffer.at((this->_rebuffer.size() - (__pyx_v_i + 1))); + } catch(...) { + PyGILState_STATE __pyx_gilstate_save = __Pyx_PyGILState_Ensure(); + __Pyx_CppExn2PyErr(); + __Pyx_PyGILState_Release(__pyx_gilstate_save); + __PYX_ERR(4, 145, __pyx_L1_error) + } + __pyx_r = __pyx_t_2; + goto __pyx_L0; + + /* "_state.pxd":144 + * if i < 0: + * return -1 + * elif i < this._rebuffer.size(): # <<<<<<<<<<<<<< + * return this._rebuffer.at(this._rebuffer.size() - (i+1)) + * else: +*/ + } + + /* "_state.pxd":147 + * return this._rebuffer.at(this._rebuffer.size() - (i+1)) + * else: + * b_i = this._b_i + (i - this._rebuffer.size()) # <<<<<<<<<<<<<< + * if b_i >= this.length: + * return -1 +*/ + /*else*/ { + __pyx_v_b_i = (this->_b_i + (__pyx_v_i - this->_rebuffer.size())); + + /* "_state.pxd":148 + * else: + * b_i = this._b_i + (i - this._rebuffer.size()) + * if b_i >= this.length: # <<<<<<<<<<<<<< + * return -1 + * else: +*/ + __pyx_t_1 = (__pyx_v_b_i >= this->length); + if (__pyx_t_1) { + + /* "_state.pxd":149 + * b_i = this._b_i + (i - this._rebuffer.size()) + * if b_i >= this.length: + * return -1 # <<<<<<<<<<<<<< + * else: + * return b_i +*/ + __pyx_r = -1; + goto __pyx_L0; + + /* "_state.pxd":148 + * else: + * b_i = this._b_i + (i - this._rebuffer.size()) + * if b_i >= this.length: # <<<<<<<<<<<<<< + * return -1 + * else: +*/ + } + + /* "_state.pxd":151 + * return -1 + * else: + * return b_i # <<<<<<<<<<<<<< + * + * inline const TokenC* B_(int i) noexcept nogil const: +*/ + /*else*/ { + __pyx_r = __pyx_v_b_i; + goto __pyx_L0; + } + } + + /* "_state.pxd":141 + * return this._stack.at(this._stack.size() - (i+1)) + * + * inline int B(int i) noexcept nogil const: # <<<<<<<<<<<<<< + * if i < 0: + * return -1 +*/ + + /* function exit code */ + __pyx_L1_error:; + __pyx_gilstate_save = __Pyx_PyGILState_Ensure(); + __Pyx_WriteUnraisable("StateC.B", __pyx_clineno, __pyx_lineno, __pyx_filename, 1, 0); + __pyx_r = 0; + __Pyx_PyGILState_Release(__pyx_gilstate_save); + __pyx_L0:; + return __pyx_r; +} + +/* "_state.pxd":153 + * return b_i + * + * inline const TokenC* B_(int i) noexcept nogil const: # <<<<<<<<<<<<<< + * return this.safe_get(this.B(i)) + * +*/ + +struct __pyx_t_5spacy_7structs_TokenC const *__pyx_t_5spacy_8pipeline_17_parser_internals_6_state_StateC::B_(int __pyx_v_i) const { + struct __pyx_t_5spacy_7structs_TokenC const *__pyx_r; + + /* "_state.pxd":154 + * + * inline const TokenC* B_(int i) noexcept nogil const: + * return this.safe_get(this.B(i)) # <<<<<<<<<<<<<< + * + * inline const TokenC* E_(int i) noexcept nogil const: +*/ + __pyx_r = this->safe_get(this->B(__pyx_v_i)); + goto __pyx_L0; + + /* "_state.pxd":153 + * return b_i + * + * inline const TokenC* B_(int i) noexcept nogil const: # <<<<<<<<<<<<<< + * return this.safe_get(this.B(i)) + * +*/ + + /* function exit code */ + __pyx_L0:; + return __pyx_r; +} + +/* "_state.pxd":156 + * return this.safe_get(this.B(i)) + * + * inline const TokenC* E_(int i) noexcept nogil const: # <<<<<<<<<<<<<< + * return this.safe_get(this.E(i)) + * +*/ + +struct __pyx_t_5spacy_7structs_TokenC const *__pyx_t_5spacy_8pipeline_17_parser_internals_6_state_StateC::E_(int __pyx_v_i) const { + struct __pyx_t_5spacy_7structs_TokenC const *__pyx_r; + + /* "_state.pxd":157 + * + * inline const TokenC* E_(int i) noexcept nogil const: + * return this.safe_get(this.E(i)) # <<<<<<<<<<<<<< + * + * inline const TokenC* safe_get(int i) noexcept nogil const: +*/ + __pyx_r = this->safe_get(this->E(__pyx_v_i)); + goto __pyx_L0; + + /* "_state.pxd":156 + * return this.safe_get(this.B(i)) + * + * inline const TokenC* E_(int i) noexcept nogil const: # <<<<<<<<<<<<<< + * return this.safe_get(this.E(i)) + * +*/ + + /* function exit code */ + __pyx_L0:; + return __pyx_r; +} + +/* "_state.pxd":159 + * return this.safe_get(this.E(i)) + * + * inline const TokenC* safe_get(int i) noexcept nogil const: # <<<<<<<<<<<<<< + * if i < 0 or i >= this.length: + * return &this._empty_token +*/ + +struct __pyx_t_5spacy_7structs_TokenC const *__pyx_t_5spacy_8pipeline_17_parser_internals_6_state_StateC::safe_get(int __pyx_v_i) const { + struct __pyx_t_5spacy_7structs_TokenC const *__pyx_r; + int __pyx_t_1; + int __pyx_t_2; + + /* "_state.pxd":160 + * + * inline const TokenC* safe_get(int i) noexcept nogil const: + * if i < 0 or i >= this.length: # <<<<<<<<<<<<<< + * return &this._empty_token + * else: +*/ + __pyx_t_2 = (__pyx_v_i < 0); + if (!__pyx_t_2) { + } else { + __pyx_t_1 = __pyx_t_2; + goto __pyx_L4_bool_binop_done; + } + __pyx_t_2 = (__pyx_v_i >= this->length); + __pyx_t_1 = __pyx_t_2; + __pyx_L4_bool_binop_done:; + if (__pyx_t_1) { + + /* "_state.pxd":161 + * inline const TokenC* safe_get(int i) noexcept nogil const: + * if i < 0 or i >= this.length: + * return &this._empty_token # <<<<<<<<<<<<<< + * else: + * return &this._sent[i] +*/ + __pyx_r = (&this->_empty_token); + goto __pyx_L0; + + /* "_state.pxd":160 + * + * inline const TokenC* safe_get(int i) noexcept nogil const: + * if i < 0 or i >= this.length: # <<<<<<<<<<<<<< + * return &this._empty_token + * else: +*/ + } + + /* "_state.pxd":163 + * return &this._empty_token + * else: + * return &this._sent[i] # <<<<<<<<<<<<<< + * + * inline void map_get_arcs(const unordered_map[int, vector[ArcC]] &heads_arcs, vector[ArcC]* out) noexcept nogil const: +*/ + /*else*/ { + __pyx_r = (&(this->_sent[__pyx_v_i])); + goto __pyx_L0; + } + + /* "_state.pxd":159 + * return this.safe_get(this.E(i)) + * + * inline const TokenC* safe_get(int i) noexcept nogil const: # <<<<<<<<<<<<<< + * if i < 0 or i >= this.length: + * return &this._empty_token +*/ + + /* function exit code */ + __pyx_L0:; + return __pyx_r; +} + +/* "_state.pxd":165 + * return &this._sent[i] + * + * inline void map_get_arcs(const unordered_map[int, vector[ArcC]] &heads_arcs, vector[ArcC]* out) noexcept nogil const: # <<<<<<<<<<<<<< + * cdef const vector[ArcC]* arcs + * head_arcs_it = heads_arcs.const_begin() +*/ + +void __pyx_t_5spacy_8pipeline_17_parser_internals_6_state_StateC::map_get_arcs(std::unordered_map > const &__pyx_v_heads_arcs, std::vector *__pyx_v_out) const { + std::vector const *__pyx_v_arcs; + std::unordered_map > ::const_iterator __pyx_v_head_arcs_it; + std::vector ::const_iterator __pyx_v_arcs_it; + struct __pyx_t_5spacy_8pipeline_17_parser_internals_6_state_ArcC __pyx_v_arc; + int __pyx_t_1; + int __pyx_t_2; + int __pyx_lineno = 0; + const char *__pyx_filename = NULL; + int __pyx_clineno = 0; + PyGILState_STATE __pyx_gilstate_save; + + /* "_state.pxd":167 + * inline void map_get_arcs(const unordered_map[int, vector[ArcC]] &heads_arcs, vector[ArcC]* out) noexcept nogil const: + * cdef const vector[ArcC]* arcs + * head_arcs_it = heads_arcs.const_begin() # <<<<<<<<<<<<<< + * while head_arcs_it != heads_arcs.const_end(): + * arcs = &deref(head_arcs_it).second +*/ + try { + __pyx_v_head_arcs_it = __pyx_v_heads_arcs.begin(); + } catch(...) { + PyGILState_STATE __pyx_gilstate_save = __Pyx_PyGILState_Ensure(); + __Pyx_CppExn2PyErr(); + __Pyx_PyGILState_Release(__pyx_gilstate_save); + __PYX_ERR(4, 167, __pyx_L1_error) + } + + /* "_state.pxd":168 + * cdef const vector[ArcC]* arcs + * head_arcs_it = heads_arcs.const_begin() + * while head_arcs_it != heads_arcs.const_end(): # <<<<<<<<<<<<<< + * arcs = &deref(head_arcs_it).second + * arcs_it = arcs.const_begin() +*/ + while (1) { + __pyx_t_1 = (__pyx_v_head_arcs_it != __pyx_v_heads_arcs.end()); + if (!__pyx_t_1) break; + + /* "_state.pxd":169 + * head_arcs_it = heads_arcs.const_begin() + * while head_arcs_it != heads_arcs.const_end(): + * arcs = &deref(head_arcs_it).second # <<<<<<<<<<<<<< + * arcs_it = arcs.const_begin() + * while arcs_it != arcs.const_end(): +*/ + __pyx_v_arcs = (&(*__pyx_v_head_arcs_it).second); + + /* "_state.pxd":170 + * while head_arcs_it != heads_arcs.const_end(): + * arcs = &deref(head_arcs_it).second + * arcs_it = arcs.const_begin() # <<<<<<<<<<<<<< + * while arcs_it != arcs.const_end(): + * arc = deref(arcs_it) +*/ + try { + __pyx_v_arcs_it = __pyx_v_arcs->begin(); + } catch(...) { + PyGILState_STATE __pyx_gilstate_save = __Pyx_PyGILState_Ensure(); + __Pyx_CppExn2PyErr(); + __Pyx_PyGILState_Release(__pyx_gilstate_save); + __PYX_ERR(4, 170, __pyx_L1_error) + } + + /* "_state.pxd":171 + * arcs = &deref(head_arcs_it).second + * arcs_it = arcs.const_begin() + * while arcs_it != arcs.const_end(): # <<<<<<<<<<<<<< + * arc = deref(arcs_it) + * if arc.head != -1 and arc.child != -1: +*/ + while (1) { + __pyx_t_1 = (__pyx_v_arcs_it != __pyx_v_arcs->end()); + if (!__pyx_t_1) break; + + /* "_state.pxd":172 + * arcs_it = arcs.const_begin() + * while arcs_it != arcs.const_end(): + * arc = deref(arcs_it) # <<<<<<<<<<<<<< + * if arc.head != -1 and arc.child != -1: + * out.push_back(arc) +*/ + __pyx_v_arc = (*__pyx_v_arcs_it); + + /* "_state.pxd":173 + * while arcs_it != arcs.const_end(): + * arc = deref(arcs_it) + * if arc.head != -1 and arc.child != -1: # <<<<<<<<<<<<<< + * out.push_back(arc) + * incr(arcs_it) +*/ + __pyx_t_2 = (__pyx_v_arc.head != -1L); + if (__pyx_t_2) { + } else { + __pyx_t_1 = __pyx_t_2; + goto __pyx_L8_bool_binop_done; + } + __pyx_t_2 = (__pyx_v_arc.child != -1L); + __pyx_t_1 = __pyx_t_2; + __pyx_L8_bool_binop_done:; + if (__pyx_t_1) { + + /* "_state.pxd":174 + * arc = deref(arcs_it) + * if arc.head != -1 and arc.child != -1: + * out.push_back(arc) # <<<<<<<<<<<<<< + * incr(arcs_it) + * incr(head_arcs_it) +*/ + try { + __pyx_v_out->push_back(__pyx_v_arc); + } catch(...) { + PyGILState_STATE __pyx_gilstate_save = __Pyx_PyGILState_Ensure(); + __Pyx_CppExn2PyErr(); + __Pyx_PyGILState_Release(__pyx_gilstate_save); + __PYX_ERR(4, 174, __pyx_L1_error) + } + + /* "_state.pxd":173 + * while arcs_it != arcs.const_end(): + * arc = deref(arcs_it) + * if arc.head != -1 and arc.child != -1: # <<<<<<<<<<<<<< + * out.push_back(arc) + * incr(arcs_it) +*/ + } + + /* "_state.pxd":175 + * if arc.head != -1 and arc.child != -1: + * out.push_back(arc) + * incr(arcs_it) # <<<<<<<<<<<<<< + * incr(head_arcs_it) + * +*/ + (void)((++__pyx_v_arcs_it)); + } + + /* "_state.pxd":176 + * out.push_back(arc) + * incr(arcs_it) + * incr(head_arcs_it) # <<<<<<<<<<<<<< + * + * inline void get_arcs(vector[ArcC]* out) noexcept nogil const: +*/ + (void)((++__pyx_v_head_arcs_it)); + } + + /* "_state.pxd":165 + * return &this._sent[i] + * + * inline void map_get_arcs(const unordered_map[int, vector[ArcC]] &heads_arcs, vector[ArcC]* out) noexcept nogil const: # <<<<<<<<<<<<<< + * cdef const vector[ArcC]* arcs + * head_arcs_it = heads_arcs.const_begin() +*/ + + /* function exit code */ + goto __pyx_L0; + __pyx_L1_error:; + __pyx_gilstate_save = __Pyx_PyGILState_Ensure(); + __Pyx_WriteUnraisable("StateC.map_get_arcs", __pyx_clineno, __pyx_lineno, __pyx_filename, 1, 0); + __Pyx_PyGILState_Release(__pyx_gilstate_save); + __pyx_L0:; +} + +/* "_state.pxd":178 + * incr(head_arcs_it) + * + * inline void get_arcs(vector[ArcC]* out) noexcept nogil const: # <<<<<<<<<<<<<< + * this.map_get_arcs(this._left_arcs, out) + * this.map_get_arcs(this._right_arcs, out) +*/ + +void __pyx_t_5spacy_8pipeline_17_parser_internals_6_state_StateC::get_arcs(std::vector *__pyx_v_out) const { + + /* "_state.pxd":179 + * + * inline void get_arcs(vector[ArcC]* out) noexcept nogil const: + * this.map_get_arcs(this._left_arcs, out) # <<<<<<<<<<<<<< + * this.map_get_arcs(this._right_arcs, out) + * +*/ + this->map_get_arcs(this->_left_arcs, __pyx_v_out); + + /* "_state.pxd":180 + * inline void get_arcs(vector[ArcC]* out) noexcept nogil const: + * this.map_get_arcs(this._left_arcs, out) + * this.map_get_arcs(this._right_arcs, out) # <<<<<<<<<<<<<< + * + * inline int H(int child) noexcept nogil const: +*/ + this->map_get_arcs(this->_right_arcs, __pyx_v_out); + + /* "_state.pxd":178 + * incr(head_arcs_it) + * + * inline void get_arcs(vector[ArcC]* out) noexcept nogil const: # <<<<<<<<<<<<<< + * this.map_get_arcs(this._left_arcs, out) + * this.map_get_arcs(this._right_arcs, out) +*/ + + /* function exit code */ +} + +/* "_state.pxd":182 + * this.map_get_arcs(this._right_arcs, out) + * + * inline int H(int child) noexcept nogil const: # <<<<<<<<<<<<<< + * if child >= this.length or child < 0: + * return -1 +*/ + +int __pyx_t_5spacy_8pipeline_17_parser_internals_6_state_StateC::H(int __pyx_v_child) const { + int __pyx_r; + int __pyx_t_1; + int __pyx_t_2; + + /* "_state.pxd":183 + * + * inline int H(int child) noexcept nogil const: + * if child >= this.length or child < 0: # <<<<<<<<<<<<<< + * return -1 + * else: +*/ + __pyx_t_2 = (__pyx_v_child >= this->length); + if (!__pyx_t_2) { + } else { + __pyx_t_1 = __pyx_t_2; + goto __pyx_L4_bool_binop_done; + } + __pyx_t_2 = (__pyx_v_child < 0); + __pyx_t_1 = __pyx_t_2; + __pyx_L4_bool_binop_done:; + if (__pyx_t_1) { + + /* "_state.pxd":184 + * inline int H(int child) noexcept nogil const: + * if child >= this.length or child < 0: + * return -1 # <<<<<<<<<<<<<< + * else: + * return this._heads[child] +*/ + __pyx_r = -1; + goto __pyx_L0; + + /* "_state.pxd":183 + * + * inline int H(int child) noexcept nogil const: + * if child >= this.length or child < 0: # <<<<<<<<<<<<<< + * return -1 + * else: +*/ + } + + /* "_state.pxd":186 + * return -1 + * else: + * return this._heads[child] # <<<<<<<<<<<<<< + * + * inline int E(int i) noexcept nogil const: +*/ + /*else*/ { + __pyx_r = (this->_heads[__pyx_v_child]); + goto __pyx_L0; + } + + /* "_state.pxd":182 + * this.map_get_arcs(this._right_arcs, out) + * + * inline int H(int child) noexcept nogil const: # <<<<<<<<<<<<<< + * if child >= this.length or child < 0: + * return -1 +*/ + + /* function exit code */ + __pyx_L0:; + return __pyx_r; +} + +/* "_state.pxd":188 + * return this._heads[child] + * + * inline int E(int i) noexcept nogil const: # <<<<<<<<<<<<<< + * if this._ents.size() == 0: + * return -1 +*/ + +int __pyx_t_5spacy_8pipeline_17_parser_internals_6_state_StateC::E(CYTHON_UNUSED int __pyx_v_i) const { + int __pyx_r; + int __pyx_t_1; + + /* "_state.pxd":189 + * + * inline int E(int i) noexcept nogil const: + * if this._ents.size() == 0: # <<<<<<<<<<<<<< + * return -1 + * else: +*/ + __pyx_t_1 = (this->_ents.size() == 0); + if (__pyx_t_1) { + + /* "_state.pxd":190 + * inline int E(int i) noexcept nogil const: + * if this._ents.size() == 0: + * return -1 # <<<<<<<<<<<<<< + * else: + * return this._ents.back().start +*/ + __pyx_r = -1; + goto __pyx_L0; + + /* "_state.pxd":189 + * + * inline int E(int i) noexcept nogil const: + * if this._ents.size() == 0: # <<<<<<<<<<<<<< + * return -1 + * else: +*/ + } + + /* "_state.pxd":192 + * return -1 + * else: + * return this._ents.back().start # <<<<<<<<<<<<<< + * + * inline int nth_child(const unordered_map[int, vector[ArcC]]& heads_arcs, int head, int idx) noexcept nogil const: +*/ + /*else*/ { + __pyx_r = this->_ents.back().start; + goto __pyx_L0; + } + + /* "_state.pxd":188 + * return this._heads[child] + * + * inline int E(int i) noexcept nogil const: # <<<<<<<<<<<<<< + * if this._ents.size() == 0: + * return -1 +*/ + + /* function exit code */ + __pyx_L0:; + return __pyx_r; +} + +/* "_state.pxd":194 + * return this._ents.back().start + * + * inline int nth_child(const unordered_map[int, vector[ArcC]]& heads_arcs, int head, int idx) noexcept nogil const: # <<<<<<<<<<<<<< + * if idx < 1: + * return -1 +*/ + +int __pyx_t_5spacy_8pipeline_17_parser_internals_6_state_StateC::nth_child(std::unordered_map > const &__pyx_v_heads_arcs, int __pyx_v_head, int __pyx_v_idx) const { + std::unordered_map > ::const_iterator __pyx_v_head_arcs_it; + std::vector const *__pyx_v_arcs; + size_t __pyx_v_child_index; + std::vector ::const_reverse_iterator __pyx_v_arcs_it; + struct __pyx_t_5spacy_8pipeline_17_parser_internals_6_state_ArcC __pyx_v_arc; + int __pyx_r; + int __pyx_t_1; + int __pyx_t_2; + int __pyx_lineno = 0; + const char *__pyx_filename = NULL; + int __pyx_clineno = 0; + PyGILState_STATE __pyx_gilstate_save; + + /* "_state.pxd":195 + * + * inline int nth_child(const unordered_map[int, vector[ArcC]]& heads_arcs, int head, int idx) noexcept nogil const: + * if idx < 1: # <<<<<<<<<<<<<< + * return -1 + * +*/ + __pyx_t_1 = (__pyx_v_idx < 1); + if (__pyx_t_1) { + + /* "_state.pxd":196 + * inline int nth_child(const unordered_map[int, vector[ArcC]]& heads_arcs, int head, int idx) noexcept nogil const: + * if idx < 1: + * return -1 # <<<<<<<<<<<<<< + * + * head_arcs_it = heads_arcs.const_find(head) +*/ + __pyx_r = -1; + goto __pyx_L0; + + /* "_state.pxd":195 + * + * inline int nth_child(const unordered_map[int, vector[ArcC]]& heads_arcs, int head, int idx) noexcept nogil const: + * if idx < 1: # <<<<<<<<<<<<<< + * return -1 + * +*/ + } + + /* "_state.pxd":198 + * return -1 + * + * head_arcs_it = heads_arcs.const_find(head) # <<<<<<<<<<<<<< + * if head_arcs_it == heads_arcs.const_end(): + * return -1 +*/ + try { + __pyx_v_head_arcs_it = __pyx_v_heads_arcs.find(__pyx_v_head); + } catch(...) { + PyGILState_STATE __pyx_gilstate_save = __Pyx_PyGILState_Ensure(); + __Pyx_CppExn2PyErr(); + __Pyx_PyGILState_Release(__pyx_gilstate_save); + __PYX_ERR(4, 198, __pyx_L1_error) + } + + /* "_state.pxd":199 + * + * head_arcs_it = heads_arcs.const_find(head) + * if head_arcs_it == heads_arcs.const_end(): # <<<<<<<<<<<<<< + * return -1 + * +*/ + __pyx_t_1 = (__pyx_v_head_arcs_it == __pyx_v_heads_arcs.end()); + if (__pyx_t_1) { + + /* "_state.pxd":200 + * head_arcs_it = heads_arcs.const_find(head) + * if head_arcs_it == heads_arcs.const_end(): + * return -1 # <<<<<<<<<<<<<< + * + * cdef const vector[ArcC]* arcs = &deref(head_arcs_it).second +*/ + __pyx_r = -1; + goto __pyx_L0; + + /* "_state.pxd":199 + * + * head_arcs_it = heads_arcs.const_find(head) + * if head_arcs_it == heads_arcs.const_end(): # <<<<<<<<<<<<<< + * return -1 + * +*/ + } + + /* "_state.pxd":202 + * return -1 + * + * cdef const vector[ArcC]* arcs = &deref(head_arcs_it).second # <<<<<<<<<<<<<< + * + * # Work backwards through arcs to find the arc at the +*/ + __pyx_v_arcs = (&(*__pyx_v_head_arcs_it).second); + + /* "_state.pxd":206 + * # Work backwards through arcs to find the arc at the + * # requested index more quickly. + * cdef size_t child_index = 0 # <<<<<<<<<<<<<< + * arcs_it = arcs.const_rbegin() + * while arcs_it != arcs.const_rend() and child_index != idx: +*/ + __pyx_v_child_index = 0; + + /* "_state.pxd":207 + * # requested index more quickly. + * cdef size_t child_index = 0 + * arcs_it = arcs.const_rbegin() # <<<<<<<<<<<<<< + * while arcs_it != arcs.const_rend() and child_index != idx: + * arc = deref(arcs_it) +*/ + try { + __pyx_v_arcs_it = __pyx_v_arcs->rbegin(); + } catch(...) { + PyGILState_STATE __pyx_gilstate_save = __Pyx_PyGILState_Ensure(); + __Pyx_CppExn2PyErr(); + __Pyx_PyGILState_Release(__pyx_gilstate_save); + __PYX_ERR(4, 207, __pyx_L1_error) + } + + /* "_state.pxd":208 + * cdef size_t child_index = 0 + * arcs_it = arcs.const_rbegin() + * while arcs_it != arcs.const_rend() and child_index != idx: # <<<<<<<<<<<<<< + * arc = deref(arcs_it) + * if arc.child != -1: +*/ + while (1) { + __pyx_t_2 = (__pyx_v_arcs_it != __pyx_v_arcs->rend()); + if (__pyx_t_2) { + } else { + __pyx_t_1 = __pyx_t_2; + goto __pyx_L7_bool_binop_done; + } + __pyx_t_2 = (__pyx_v_child_index != __pyx_v_idx); + __pyx_t_1 = __pyx_t_2; + __pyx_L7_bool_binop_done:; + if (!__pyx_t_1) break; + + /* "_state.pxd":209 + * arcs_it = arcs.const_rbegin() + * while arcs_it != arcs.const_rend() and child_index != idx: + * arc = deref(arcs_it) # <<<<<<<<<<<<<< + * if arc.child != -1: + * child_index += 1 +*/ + __pyx_v_arc = (*__pyx_v_arcs_it); + + /* "_state.pxd":210 + * while arcs_it != arcs.const_rend() and child_index != idx: + * arc = deref(arcs_it) + * if arc.child != -1: # <<<<<<<<<<<<<< + * child_index += 1 + * if child_index == idx: +*/ + __pyx_t_1 = (__pyx_v_arc.child != -1L); + if (__pyx_t_1) { + + /* "_state.pxd":211 + * arc = deref(arcs_it) + * if arc.child != -1: + * child_index += 1 # <<<<<<<<<<<<<< + * if child_index == idx: + * return arc.child +*/ + __pyx_v_child_index = (__pyx_v_child_index + 1); + + /* "_state.pxd":212 + * if arc.child != -1: + * child_index += 1 + * if child_index == idx: # <<<<<<<<<<<<<< + * return arc.child + * incr(arcs_it) +*/ + __pyx_t_1 = (__pyx_v_child_index == __pyx_v_idx); + if (__pyx_t_1) { + + /* "_state.pxd":213 + * child_index += 1 + * if child_index == idx: + * return arc.child # <<<<<<<<<<<<<< + * incr(arcs_it) + * +*/ + __pyx_r = __pyx_v_arc.child; + goto __pyx_L0; + + /* "_state.pxd":212 + * if arc.child != -1: + * child_index += 1 + * if child_index == idx: # <<<<<<<<<<<<<< + * return arc.child + * incr(arcs_it) +*/ + } + + /* "_state.pxd":210 + * while arcs_it != arcs.const_rend() and child_index != idx: + * arc = deref(arcs_it) + * if arc.child != -1: # <<<<<<<<<<<<<< + * child_index += 1 + * if child_index == idx: +*/ + } + + /* "_state.pxd":214 + * if child_index == idx: + * return arc.child + * incr(arcs_it) # <<<<<<<<<<<<<< + * + * return -1 +*/ + (void)((++__pyx_v_arcs_it)); + } + + /* "_state.pxd":216 + * incr(arcs_it) + * + * return -1 # <<<<<<<<<<<<<< + * + * inline int L(int head, int idx) noexcept nogil const: +*/ + __pyx_r = -1; + goto __pyx_L0; + + /* "_state.pxd":194 + * return this._ents.back().start + * + * inline int nth_child(const unordered_map[int, vector[ArcC]]& heads_arcs, int head, int idx) noexcept nogil const: # <<<<<<<<<<<<<< + * if idx < 1: + * return -1 +*/ + + /* function exit code */ + __pyx_L1_error:; + __pyx_gilstate_save = __Pyx_PyGILState_Ensure(); + __Pyx_WriteUnraisable("StateC.nth_child", __pyx_clineno, __pyx_lineno, __pyx_filename, 1, 0); + __pyx_r = 0; + __Pyx_PyGILState_Release(__pyx_gilstate_save); + __pyx_L0:; + return __pyx_r; +} + +/* "_state.pxd":218 + * return -1 + * + * inline int L(int head, int idx) noexcept nogil const: # <<<<<<<<<<<<<< + * return this.nth_child(this._left_arcs, head, idx) + * +*/ + +int __pyx_t_5spacy_8pipeline_17_parser_internals_6_state_StateC::L(int __pyx_v_head, int __pyx_v_idx) const { + int __pyx_r; + + /* "_state.pxd":219 + * + * inline int L(int head, int idx) noexcept nogil const: + * return this.nth_child(this._left_arcs, head, idx) # <<<<<<<<<<<<<< + * + * inline int R(int head, int idx) noexcept nogil const: +*/ + __pyx_r = this->nth_child(this->_left_arcs, __pyx_v_head, __pyx_v_idx); + goto __pyx_L0; + + /* "_state.pxd":218 + * return -1 + * + * inline int L(int head, int idx) noexcept nogil const: # <<<<<<<<<<<<<< + * return this.nth_child(this._left_arcs, head, idx) + * +*/ + + /* function exit code */ + __pyx_L0:; + return __pyx_r; +} + +/* "_state.pxd":221 + * return this.nth_child(this._left_arcs, head, idx) + * + * inline int R(int head, int idx) noexcept nogil const: # <<<<<<<<<<<<<< + * return this.nth_child(this._right_arcs, head, idx) + * +*/ + +int __pyx_t_5spacy_8pipeline_17_parser_internals_6_state_StateC::R(int __pyx_v_head, int __pyx_v_idx) const { + int __pyx_r; + + /* "_state.pxd":222 + * + * inline int R(int head, int idx) noexcept nogil const: + * return this.nth_child(this._right_arcs, head, idx) # <<<<<<<<<<<<<< + * + * inline bint empty() noexcept nogil const: +*/ + __pyx_r = this->nth_child(this->_right_arcs, __pyx_v_head, __pyx_v_idx); + goto __pyx_L0; + + /* "_state.pxd":221 + * return this.nth_child(this._left_arcs, head, idx) + * + * inline int R(int head, int idx) noexcept nogil const: # <<<<<<<<<<<<<< + * return this.nth_child(this._right_arcs, head, idx) + * +*/ + + /* function exit code */ + __pyx_L0:; + return __pyx_r; +} + +/* "_state.pxd":224 + * return this.nth_child(this._right_arcs, head, idx) + * + * inline bint empty() noexcept nogil const: # <<<<<<<<<<<<<< + * return this._stack.size() == 0 + * +*/ + +int __pyx_t_5spacy_8pipeline_17_parser_internals_6_state_StateC::empty(void) const { + int __pyx_r; + + /* "_state.pxd":225 + * + * inline bint empty() noexcept nogil const: + * return this._stack.size() == 0 # <<<<<<<<<<<<<< + * + * inline bint eol() noexcept nogil const: +*/ + __pyx_r = (this->_stack.size() == 0); + goto __pyx_L0; + + /* "_state.pxd":224 + * return this.nth_child(this._right_arcs, head, idx) + * + * inline bint empty() noexcept nogil const: # <<<<<<<<<<<<<< + * return this._stack.size() == 0 + * +*/ + + /* function exit code */ + __pyx_L0:; + return __pyx_r; +} + +/* "_state.pxd":227 + * return this._stack.size() == 0 + * + * inline bint eol() noexcept nogil const: # <<<<<<<<<<<<<< + * return this.buffer_length() == 0 + * +*/ + +int __pyx_t_5spacy_8pipeline_17_parser_internals_6_state_StateC::eol(void) const { + int __pyx_r; + + /* "_state.pxd":228 + * + * inline bint eol() noexcept nogil const: + * return this.buffer_length() == 0 # <<<<<<<<<<<<<< + * + * inline bint is_final() noexcept nogil const: +*/ + __pyx_r = (this->buffer_length() == 0); + goto __pyx_L0; + + /* "_state.pxd":227 + * return this._stack.size() == 0 + * + * inline bint eol() noexcept nogil const: # <<<<<<<<<<<<<< + * return this.buffer_length() == 0 + * +*/ + + /* function exit code */ + __pyx_L0:; + return __pyx_r; +} + +/* "_state.pxd":230 + * return this.buffer_length() == 0 + * + * inline bint is_final() noexcept nogil const: # <<<<<<<<<<<<<< + * return this.stack_depth() <= 0 and this.eol() + * +*/ + +int __pyx_t_5spacy_8pipeline_17_parser_internals_6_state_StateC::is_final(void) const { + int __pyx_r; + int __pyx_t_1; + int __pyx_t_2; + + /* "_state.pxd":231 + * + * inline bint is_final() noexcept nogil const: + * return this.stack_depth() <= 0 and this.eol() # <<<<<<<<<<<<<< + * + * inline int cannot_sent_start(int word) noexcept nogil const: +*/ + __pyx_t_2 = (this->stack_depth() <= 0); + if (__pyx_t_2) { + } else { + __pyx_t_1 = __pyx_t_2; + goto __pyx_L3_bool_binop_done; + } + __pyx_t_2 = this->eol(); + __pyx_t_1 = __pyx_t_2; + __pyx_L3_bool_binop_done:; + __pyx_r = __pyx_t_1; + goto __pyx_L0; + + /* "_state.pxd":230 + * return this.buffer_length() == 0 + * + * inline bint is_final() noexcept nogil const: # <<<<<<<<<<<<<< + * return this.stack_depth() <= 0 and this.eol() + * +*/ + + /* function exit code */ + __pyx_L0:; + return __pyx_r; +} + +/* "_state.pxd":233 + * return this.stack_depth() <= 0 and this.eol() + * + * inline int cannot_sent_start(int word) noexcept nogil const: # <<<<<<<<<<<<<< + * if word < 0 or word >= this.length: + * return 0 +*/ + +int __pyx_t_5spacy_8pipeline_17_parser_internals_6_state_StateC::cannot_sent_start(int __pyx_v_word) const { + int __pyx_r; + int __pyx_t_1; + int __pyx_t_2; + + /* "_state.pxd":234 + * + * inline int cannot_sent_start(int word) noexcept nogil const: + * if word < 0 or word >= this.length: # <<<<<<<<<<<<<< + * return 0 + * elif this._sent[word].sent_start == -1: +*/ + __pyx_t_2 = (__pyx_v_word < 0); + if (!__pyx_t_2) { + } else { + __pyx_t_1 = __pyx_t_2; + goto __pyx_L4_bool_binop_done; + } + __pyx_t_2 = (__pyx_v_word >= this->length); + __pyx_t_1 = __pyx_t_2; + __pyx_L4_bool_binop_done:; + if (__pyx_t_1) { + + /* "_state.pxd":235 + * inline int cannot_sent_start(int word) noexcept nogil const: + * if word < 0 or word >= this.length: + * return 0 # <<<<<<<<<<<<<< + * elif this._sent[word].sent_start == -1: + * return 1 +*/ + __pyx_r = 0; + goto __pyx_L0; + + /* "_state.pxd":234 + * + * inline int cannot_sent_start(int word) noexcept nogil const: + * if word < 0 or word >= this.length: # <<<<<<<<<<<<<< + * return 0 + * elif this._sent[word].sent_start == -1: +*/ + } + + /* "_state.pxd":236 + * if word < 0 or word >= this.length: + * return 0 + * elif this._sent[word].sent_start == -1: # <<<<<<<<<<<<<< + * return 1 + * else: +*/ + __pyx_t_1 = ((this->_sent[__pyx_v_word]).sent_start == -1L); + if (__pyx_t_1) { + + /* "_state.pxd":237 + * return 0 + * elif this._sent[word].sent_start == -1: + * return 1 # <<<<<<<<<<<<<< + * else: + * return 0 +*/ + __pyx_r = 1; + goto __pyx_L0; + + /* "_state.pxd":236 + * if word < 0 or word >= this.length: + * return 0 + * elif this._sent[word].sent_start == -1: # <<<<<<<<<<<<<< + * return 1 + * else: +*/ + } + + /* "_state.pxd":239 + * return 1 + * else: + * return 0 # <<<<<<<<<<<<<< + * + * inline int is_sent_start(int word) noexcept nogil const: +*/ + /*else*/ { + __pyx_r = 0; + goto __pyx_L0; + } + + /* "_state.pxd":233 + * return this.stack_depth() <= 0 and this.eol() + * + * inline int cannot_sent_start(int word) noexcept nogil const: # <<<<<<<<<<<<<< + * if word < 0 or word >= this.length: + * return 0 +*/ + + /* function exit code */ + __pyx_L0:; + return __pyx_r; +} + +/* "_state.pxd":241 + * return 0 + * + * inline int is_sent_start(int word) noexcept nogil const: # <<<<<<<<<<<<<< + * if word < 0 or word >= this.length: + * return 0 +*/ + +int __pyx_t_5spacy_8pipeline_17_parser_internals_6_state_StateC::is_sent_start(int __pyx_v_word) const { + int __pyx_r; + int __pyx_t_1; + int __pyx_t_2; + + /* "_state.pxd":242 + * + * inline int is_sent_start(int word) noexcept nogil const: + * if word < 0 or word >= this.length: # <<<<<<<<<<<<<< + * return 0 + * elif this._sent[word].sent_start == 1: +*/ + __pyx_t_2 = (__pyx_v_word < 0); + if (!__pyx_t_2) { + } else { + __pyx_t_1 = __pyx_t_2; + goto __pyx_L4_bool_binop_done; + } + __pyx_t_2 = (__pyx_v_word >= this->length); + __pyx_t_1 = __pyx_t_2; + __pyx_L4_bool_binop_done:; + if (__pyx_t_1) { + + /* "_state.pxd":243 + * inline int is_sent_start(int word) noexcept nogil const: + * if word < 0 or word >= this.length: + * return 0 # <<<<<<<<<<<<<< + * elif this._sent[word].sent_start == 1: + * return 1 +*/ + __pyx_r = 0; + goto __pyx_L0; + + /* "_state.pxd":242 + * + * inline int is_sent_start(int word) noexcept nogil const: + * if word < 0 or word >= this.length: # <<<<<<<<<<<<<< + * return 0 + * elif this._sent[word].sent_start == 1: +*/ + } + + /* "_state.pxd":244 + * if word < 0 or word >= this.length: + * return 0 + * elif this._sent[word].sent_start == 1: # <<<<<<<<<<<<<< + * return 1 + * elif this._sent_starts.count(word) >= 1: +*/ + __pyx_t_1 = ((this->_sent[__pyx_v_word]).sent_start == 1); + if (__pyx_t_1) { + + /* "_state.pxd":245 + * return 0 + * elif this._sent[word].sent_start == 1: + * return 1 # <<<<<<<<<<<<<< + * elif this._sent_starts.count(word) >= 1: + * return 1 +*/ + __pyx_r = 1; + goto __pyx_L0; + + /* "_state.pxd":244 + * if word < 0 or word >= this.length: + * return 0 + * elif this._sent[word].sent_start == 1: # <<<<<<<<<<<<<< + * return 1 + * elif this._sent_starts.count(word) >= 1: +*/ + } + + /* "_state.pxd":246 + * elif this._sent[word].sent_start == 1: + * return 1 + * elif this._sent_starts.count(word) >= 1: # <<<<<<<<<<<<<< + * return 1 + * else: +*/ + __pyx_t_1 = (this->_sent_starts.count(__pyx_v_word) >= 1); + if (__pyx_t_1) { + + /* "_state.pxd":247 + * return 1 + * elif this._sent_starts.count(word) >= 1: + * return 1 # <<<<<<<<<<<<<< + * else: + * return 0 +*/ + __pyx_r = 1; + goto __pyx_L0; + + /* "_state.pxd":246 + * elif this._sent[word].sent_start == 1: + * return 1 + * elif this._sent_starts.count(word) >= 1: # <<<<<<<<<<<<<< + * return 1 + * else: +*/ + } + + /* "_state.pxd":249 + * return 1 + * else: + * return 0 # <<<<<<<<<<<<<< + * + * inline void set_sent_start(int word, int value) noexcept nogil: +*/ + /*else*/ { + __pyx_r = 0; + goto __pyx_L0; + } + + /* "_state.pxd":241 + * return 0 + * + * inline int is_sent_start(int word) noexcept nogil const: # <<<<<<<<<<<<<< + * if word < 0 or word >= this.length: + * return 0 +*/ + + /* function exit code */ + __pyx_L0:; + return __pyx_r; +} + +/* "_state.pxd":251 + * return 0 + * + * inline void set_sent_start(int word, int value) noexcept nogil: # <<<<<<<<<<<<<< + * if value >= 1: + * this._sent_starts.insert(word) +*/ + +void __pyx_t_5spacy_8pipeline_17_parser_internals_6_state_StateC::set_sent_start(int __pyx_v_word, int __pyx_v_value) { + int __pyx_t_1; + int __pyx_lineno = 0; + const char *__pyx_filename = NULL; + int __pyx_clineno = 0; + PyGILState_STATE __pyx_gilstate_save; + + /* "_state.pxd":252 + * + * inline void set_sent_start(int word, int value) noexcept nogil: + * if value >= 1: # <<<<<<<<<<<<<< + * this._sent_starts.insert(word) + * +*/ + __pyx_t_1 = (__pyx_v_value >= 1); + if (__pyx_t_1) { + + /* "_state.pxd":253 + * inline void set_sent_start(int word, int value) noexcept nogil: + * if value >= 1: + * this._sent_starts.insert(word) # <<<<<<<<<<<<<< + * + * inline bint has_head(int child) noexcept nogil const: +*/ + try { + this->_sent_starts.insert(__pyx_v_word); + } catch(...) { + PyGILState_STATE __pyx_gilstate_save = __Pyx_PyGILState_Ensure(); + __Pyx_CppExn2PyErr(); + __Pyx_PyGILState_Release(__pyx_gilstate_save); + __PYX_ERR(4, 253, __pyx_L1_error) + } + + /* "_state.pxd":252 + * + * inline void set_sent_start(int word, int value) noexcept nogil: + * if value >= 1: # <<<<<<<<<<<<<< + * this._sent_starts.insert(word) + * +*/ + } + + /* "_state.pxd":251 + * return 0 + * + * inline void set_sent_start(int word, int value) noexcept nogil: # <<<<<<<<<<<<<< + * if value >= 1: + * this._sent_starts.insert(word) +*/ + + /* function exit code */ + goto __pyx_L0; + __pyx_L1_error:; + __pyx_gilstate_save = __Pyx_PyGILState_Ensure(); + __Pyx_WriteUnraisable("StateC.set_sent_start", __pyx_clineno, __pyx_lineno, __pyx_filename, 1, 0); + __Pyx_PyGILState_Release(__pyx_gilstate_save); + __pyx_L0:; +} + +/* "_state.pxd":255 + * this._sent_starts.insert(word) + * + * inline bint has_head(int child) noexcept nogil const: # <<<<<<<<<<<<<< + * return this._heads[child] >= 0 + * +*/ + +int __pyx_t_5spacy_8pipeline_17_parser_internals_6_state_StateC::has_head(int __pyx_v_child) const { + int __pyx_r; + + /* "_state.pxd":256 + * + * inline bint has_head(int child) noexcept nogil const: + * return this._heads[child] >= 0 # <<<<<<<<<<<<<< + * + * inline int l_edge(int word) noexcept nogil const: +*/ + __pyx_r = ((this->_heads[__pyx_v_child]) >= 0); + goto __pyx_L0; + + /* "_state.pxd":255 + * this._sent_starts.insert(word) + * + * inline bint has_head(int child) noexcept nogil const: # <<<<<<<<<<<<<< + * return this._heads[child] >= 0 + * +*/ + + /* function exit code */ + __pyx_L0:; + return __pyx_r; +} + +/* "_state.pxd":258 + * return this._heads[child] >= 0 + * + * inline int l_edge(int word) noexcept nogil const: # <<<<<<<<<<<<<< + * return word + * +*/ + +int __pyx_t_5spacy_8pipeline_17_parser_internals_6_state_StateC::l_edge(int __pyx_v_word) const { + int __pyx_r; + + /* "_state.pxd":259 + * + * inline int l_edge(int word) noexcept nogil const: + * return word # <<<<<<<<<<<<<< + * + * inline int r_edge(int word) noexcept nogil const: +*/ + __pyx_r = __pyx_v_word; + goto __pyx_L0; + + /* "_state.pxd":258 + * return this._heads[child] >= 0 + * + * inline int l_edge(int word) noexcept nogil const: # <<<<<<<<<<<<<< + * return word + * +*/ + + /* function exit code */ + __pyx_L0:; + return __pyx_r; +} + +/* "_state.pxd":261 + * return word + * + * inline int r_edge(int word) noexcept nogil const: # <<<<<<<<<<<<<< + * return word + * +*/ + +int __pyx_t_5spacy_8pipeline_17_parser_internals_6_state_StateC::r_edge(int __pyx_v_word) const { + int __pyx_r; + + /* "_state.pxd":262 + * + * inline int r_edge(int word) noexcept nogil const: + * return word # <<<<<<<<<<<<<< + * + * inline int n_arcs(const unordered_map[int, vector[ArcC]] &heads_arcs, int head) noexcept nogil const: +*/ + __pyx_r = __pyx_v_word; + goto __pyx_L0; + + /* "_state.pxd":261 + * return word + * + * inline int r_edge(int word) noexcept nogil const: # <<<<<<<<<<<<<< + * return word + * +*/ + + /* function exit code */ + __pyx_L0:; + return __pyx_r; +} + +/* "_state.pxd":264 + * return word + * + * inline int n_arcs(const unordered_map[int, vector[ArcC]] &heads_arcs, int head) noexcept nogil const: # <<<<<<<<<<<<<< + * cdef int n = 0 + * head_arcs_it = heads_arcs.const_find(head) +*/ + +int __pyx_t_5spacy_8pipeline_17_parser_internals_6_state_StateC::n_arcs(std::unordered_map > const &__pyx_v_heads_arcs, int __pyx_v_head) const { + int __pyx_v_n; + std::unordered_map > ::const_iterator __pyx_v_head_arcs_it; + std::vector const *__pyx_v_arcs; + std::vector ::const_iterator __pyx_v_arcs_it; + struct __pyx_t_5spacy_8pipeline_17_parser_internals_6_state_ArcC __pyx_v_arc; + int __pyx_r; + int __pyx_t_1; + int __pyx_lineno = 0; + const char *__pyx_filename = NULL; + int __pyx_clineno = 0; + PyGILState_STATE __pyx_gilstate_save; + + /* "_state.pxd":265 + * + * inline int n_arcs(const unordered_map[int, vector[ArcC]] &heads_arcs, int head) noexcept nogil const: + * cdef int n = 0 # <<<<<<<<<<<<<< + * head_arcs_it = heads_arcs.const_find(head) + * if head_arcs_it == heads_arcs.const_end(): +*/ + __pyx_v_n = 0; + + /* "_state.pxd":266 + * inline int n_arcs(const unordered_map[int, vector[ArcC]] &heads_arcs, int head) noexcept nogil const: + * cdef int n = 0 + * head_arcs_it = heads_arcs.const_find(head) # <<<<<<<<<<<<<< + * if head_arcs_it == heads_arcs.const_end(): + * return n +*/ + try { + __pyx_v_head_arcs_it = __pyx_v_heads_arcs.find(__pyx_v_head); + } catch(...) { + PyGILState_STATE __pyx_gilstate_save = __Pyx_PyGILState_Ensure(); + __Pyx_CppExn2PyErr(); + __Pyx_PyGILState_Release(__pyx_gilstate_save); + __PYX_ERR(4, 266, __pyx_L1_error) + } + + /* "_state.pxd":267 + * cdef int n = 0 + * head_arcs_it = heads_arcs.const_find(head) + * if head_arcs_it == heads_arcs.const_end(): # <<<<<<<<<<<<<< + * return n + * +*/ + __pyx_t_1 = (__pyx_v_head_arcs_it == __pyx_v_heads_arcs.end()); + if (__pyx_t_1) { + + /* "_state.pxd":268 + * head_arcs_it = heads_arcs.const_find(head) + * if head_arcs_it == heads_arcs.const_end(): + * return n # <<<<<<<<<<<<<< + * + * cdef const vector[ArcC]* arcs = &deref(head_arcs_it).second +*/ + __pyx_r = __pyx_v_n; + goto __pyx_L0; + + /* "_state.pxd":267 + * cdef int n = 0 + * head_arcs_it = heads_arcs.const_find(head) + * if head_arcs_it == heads_arcs.const_end(): # <<<<<<<<<<<<<< + * return n + * +*/ + } + + /* "_state.pxd":270 + * return n + * + * cdef const vector[ArcC]* arcs = &deref(head_arcs_it).second # <<<<<<<<<<<<<< + * arcs_it = arcs.const_begin() + * while arcs_it != arcs.end(): +*/ + __pyx_v_arcs = (&(*__pyx_v_head_arcs_it).second); + + /* "_state.pxd":271 + * + * cdef const vector[ArcC]* arcs = &deref(head_arcs_it).second + * arcs_it = arcs.const_begin() # <<<<<<<<<<<<<< + * while arcs_it != arcs.end(): + * arc = deref(arcs_it) +*/ + try { + __pyx_v_arcs_it = __pyx_v_arcs->begin(); + } catch(...) { + PyGILState_STATE __pyx_gilstate_save = __Pyx_PyGILState_Ensure(); + __Pyx_CppExn2PyErr(); + __Pyx_PyGILState_Release(__pyx_gilstate_save); + __PYX_ERR(4, 271, __pyx_L1_error) + } + + /* "_state.pxd":272 + * cdef const vector[ArcC]* arcs = &deref(head_arcs_it).second + * arcs_it = arcs.const_begin() + * while arcs_it != arcs.end(): # <<<<<<<<<<<<<< + * arc = deref(arcs_it) + * if arc.child != -1: +*/ + while (1) { + __pyx_t_1 = (__pyx_v_arcs_it != __pyx_v_arcs->end()); + if (!__pyx_t_1) break; + + /* "_state.pxd":273 + * arcs_it = arcs.const_begin() + * while arcs_it != arcs.end(): + * arc = deref(arcs_it) # <<<<<<<<<<<<<< + * if arc.child != -1: + * n += 1 +*/ + __pyx_v_arc = (*__pyx_v_arcs_it); + + /* "_state.pxd":274 + * while arcs_it != arcs.end(): + * arc = deref(arcs_it) + * if arc.child != -1: # <<<<<<<<<<<<<< + * n += 1 + * incr(arcs_it) +*/ + __pyx_t_1 = (__pyx_v_arc.child != -1L); + if (__pyx_t_1) { + + /* "_state.pxd":275 + * arc = deref(arcs_it) + * if arc.child != -1: + * n += 1 # <<<<<<<<<<<<<< + * incr(arcs_it) + * +*/ + __pyx_v_n = (__pyx_v_n + 1); + + /* "_state.pxd":274 + * while arcs_it != arcs.end(): + * arc = deref(arcs_it) + * if arc.child != -1: # <<<<<<<<<<<<<< + * n += 1 + * incr(arcs_it) +*/ + } + + /* "_state.pxd":276 + * if arc.child != -1: + * n += 1 + * incr(arcs_it) # <<<<<<<<<<<<<< + * + * return n +*/ + (void)((++__pyx_v_arcs_it)); + } + + /* "_state.pxd":278 + * incr(arcs_it) + * + * return n # <<<<<<<<<<<<<< + * + * inline int n_L(int head) noexcept nogil const: +*/ + __pyx_r = __pyx_v_n; + goto __pyx_L0; + + /* "_state.pxd":264 + * return word + * + * inline int n_arcs(const unordered_map[int, vector[ArcC]] &heads_arcs, int head) noexcept nogil const: # <<<<<<<<<<<<<< + * cdef int n = 0 + * head_arcs_it = heads_arcs.const_find(head) +*/ + + /* function exit code */ + __pyx_L1_error:; + __pyx_gilstate_save = __Pyx_PyGILState_Ensure(); + __Pyx_WriteUnraisable("StateC.n_arcs", __pyx_clineno, __pyx_lineno, __pyx_filename, 1, 0); + __pyx_r = 0; + __Pyx_PyGILState_Release(__pyx_gilstate_save); + __pyx_L0:; + return __pyx_r; +} + +/* "_state.pxd":280 + * return n + * + * inline int n_L(int head) noexcept nogil const: # <<<<<<<<<<<<<< + * return n_arcs(this._left_arcs, head) + * +*/ + +int __pyx_t_5spacy_8pipeline_17_parser_internals_6_state_StateC::n_L(int __pyx_v_head) const { + int __pyx_r; + + /* "_state.pxd":281 + * + * inline int n_L(int head) noexcept nogil const: + * return n_arcs(this._left_arcs, head) # <<<<<<<<<<<<<< + * + * inline int n_R(int head) noexcept nogil const: +*/ + __pyx_r = n_arcs(this->_left_arcs, __pyx_v_head); + goto __pyx_L0; + + /* "_state.pxd":280 + * return n + * + * inline int n_L(int head) noexcept nogil const: # <<<<<<<<<<<<<< + * return n_arcs(this._left_arcs, head) + * +*/ + + /* function exit code */ + __pyx_L0:; + return __pyx_r; +} + +/* "_state.pxd":283 + * return n_arcs(this._left_arcs, head) + * + * inline int n_R(int head) noexcept nogil const: # <<<<<<<<<<<<<< + * return n_arcs(this._right_arcs, head) + * +*/ + +int __pyx_t_5spacy_8pipeline_17_parser_internals_6_state_StateC::n_R(int __pyx_v_head) const { + int __pyx_r; + + /* "_state.pxd":284 + * + * inline int n_R(int head) noexcept nogil const: + * return n_arcs(this._right_arcs, head) # <<<<<<<<<<<<<< + * + * inline bint stack_is_connected() noexcept nogil const: +*/ + __pyx_r = n_arcs(this->_right_arcs, __pyx_v_head); + goto __pyx_L0; + + /* "_state.pxd":283 + * return n_arcs(this._left_arcs, head) + * + * inline int n_R(int head) noexcept nogil const: # <<<<<<<<<<<<<< + * return n_arcs(this._right_arcs, head) + * +*/ + + /* function exit code */ + __pyx_L0:; + return __pyx_r; +} + +/* "_state.pxd":286 + * return n_arcs(this._right_arcs, head) + * + * inline bint stack_is_connected() noexcept nogil const: # <<<<<<<<<<<<<< + * return False + * +*/ + +int __pyx_t_5spacy_8pipeline_17_parser_internals_6_state_StateC::stack_is_connected(void) const { + int __pyx_r; + + /* "_state.pxd":287 + * + * inline bint stack_is_connected() noexcept nogil const: + * return False # <<<<<<<<<<<<<< + * + * inline bint entity_is_open() noexcept nogil const: +*/ + __pyx_r = 0; + goto __pyx_L0; + + /* "_state.pxd":286 + * return n_arcs(this._right_arcs, head) + * + * inline bint stack_is_connected() noexcept nogil const: # <<<<<<<<<<<<<< + * return False + * +*/ + + /* function exit code */ + __pyx_L0:; + return __pyx_r; +} + +/* "_state.pxd":289 + * return False + * + * inline bint entity_is_open() noexcept nogil const: # <<<<<<<<<<<<<< + * if this._ents.size() == 0: + * return False +*/ + +int __pyx_t_5spacy_8pipeline_17_parser_internals_6_state_StateC::entity_is_open(void) const { + int __pyx_r; + int __pyx_t_1; + + /* "_state.pxd":290 + * + * inline bint entity_is_open() noexcept nogil const: + * if this._ents.size() == 0: # <<<<<<<<<<<<<< + * return False + * else: +*/ + __pyx_t_1 = (this->_ents.size() == 0); + if (__pyx_t_1) { + + /* "_state.pxd":291 + * inline bint entity_is_open() noexcept nogil const: + * if this._ents.size() == 0: + * return False # <<<<<<<<<<<<<< + * else: + * return this._ents.back().end == -1 +*/ + __pyx_r = 0; + goto __pyx_L0; + + /* "_state.pxd":290 + * + * inline bint entity_is_open() noexcept nogil const: + * if this._ents.size() == 0: # <<<<<<<<<<<<<< + * return False + * else: +*/ + } + + /* "_state.pxd":293 + * return False + * else: + * return this._ents.back().end == -1 # <<<<<<<<<<<<<< + * + * inline int stack_depth() noexcept nogil const: +*/ + /*else*/ { + __pyx_r = (this->_ents.back().end == -1L); + goto __pyx_L0; + } + + /* "_state.pxd":289 + * return False + * + * inline bint entity_is_open() noexcept nogil const: # <<<<<<<<<<<<<< + * if this._ents.size() == 0: + * return False +*/ + + /* function exit code */ + __pyx_L0:; + return __pyx_r; +} + +/* "_state.pxd":295 + * return this._ents.back().end == -1 + * + * inline int stack_depth() noexcept nogil const: # <<<<<<<<<<<<<< + * return this._stack.size() + * +*/ + +int __pyx_t_5spacy_8pipeline_17_parser_internals_6_state_StateC::stack_depth(void) const { + int __pyx_r; + + /* "_state.pxd":296 + * + * inline int stack_depth() noexcept nogil const: + * return this._stack.size() # <<<<<<<<<<<<<< + * + * inline int buffer_length() noexcept nogil const: +*/ + __pyx_r = this->_stack.size(); + goto __pyx_L0; + + /* "_state.pxd":295 + * return this._ents.back().end == -1 + * + * inline int stack_depth() noexcept nogil const: # <<<<<<<<<<<<<< + * return this._stack.size() + * +*/ + + /* function exit code */ + __pyx_L0:; + return __pyx_r; +} + +/* "_state.pxd":298 + * return this._stack.size() + * + * inline int buffer_length() noexcept nogil const: # <<<<<<<<<<<<<< + * return (this.length - this._b_i) + this._rebuffer.size() + * +*/ + +int __pyx_t_5spacy_8pipeline_17_parser_internals_6_state_StateC::buffer_length(void) const { + int __pyx_r; + + /* "_state.pxd":299 + * + * inline int buffer_length() noexcept nogil const: + * return (this.length - this._b_i) + this._rebuffer.size() # <<<<<<<<<<<<<< + * + * inline void push() noexcept nogil: +*/ + __pyx_r = ((this->length - this->_b_i) + this->_rebuffer.size()); + goto __pyx_L0; + + /* "_state.pxd":298 + * return this._stack.size() + * + * inline int buffer_length() noexcept nogil const: # <<<<<<<<<<<<<< + * return (this.length - this._b_i) + this._rebuffer.size() + * +*/ + + /* function exit code */ + __pyx_L0:; + return __pyx_r; +} + +/* "_state.pxd":301 + * return (this.length - this._b_i) + this._rebuffer.size() + * + * inline void push() noexcept nogil: # <<<<<<<<<<<<<< + * b0 = this.B(0) + * if this._rebuffer.size(): +*/ + +void __pyx_t_5spacy_8pipeline_17_parser_internals_6_state_StateC::push(void) { + int __pyx_v_b0; + int __pyx_t_1; + int __pyx_t_2; + int __pyx_lineno = 0; + const char *__pyx_filename = NULL; + int __pyx_clineno = 0; + PyGILState_STATE __pyx_gilstate_save; + + /* "_state.pxd":302 + * + * inline void push() noexcept nogil: + * b0 = this.B(0) # <<<<<<<<<<<<<< + * if this._rebuffer.size(): + * b0 = this._rebuffer.back() +*/ + __pyx_v_b0 = this->B(0); + + /* "_state.pxd":303 + * inline void push() noexcept nogil: + * b0 = this.B(0) + * if this._rebuffer.size(): # <<<<<<<<<<<<<< + * b0 = this._rebuffer.back() + * this._rebuffer.pop_back() +*/ + __pyx_t_1 = (this->_rebuffer.size() != 0); + if (__pyx_t_1) { + + /* "_state.pxd":304 + * b0 = this.B(0) + * if this._rebuffer.size(): + * b0 = this._rebuffer.back() # <<<<<<<<<<<<<< + * this._rebuffer.pop_back() + * else: +*/ + __pyx_v_b0 = this->_rebuffer.back(); + + /* "_state.pxd":305 + * if this._rebuffer.size(): + * b0 = this._rebuffer.back() + * this._rebuffer.pop_back() # <<<<<<<<<<<<<< + * else: + * b0 = this._b_i +*/ + this->_rebuffer.pop_back(); + + /* "_state.pxd":303 + * inline void push() noexcept nogil: + * b0 = this.B(0) + * if this._rebuffer.size(): # <<<<<<<<<<<<<< + * b0 = this._rebuffer.back() + * this._rebuffer.pop_back() +*/ + goto __pyx_L3; + } + + /* "_state.pxd":307 + * this._rebuffer.pop_back() + * else: + * b0 = this._b_i # <<<<<<<<<<<<<< + * this._b_i += 1 + * this._stack.push_back(b0) +*/ + /*else*/ { + __pyx_t_2 = this->_b_i; + __pyx_v_b0 = __pyx_t_2; + + /* "_state.pxd":308 + * else: + * b0 = this._b_i + * this._b_i += 1 # <<<<<<<<<<<<<< + * this._stack.push_back(b0) + * +*/ + this->_b_i = (this->_b_i + 1); + } + __pyx_L3:; + + /* "_state.pxd":309 + * b0 = this._b_i + * this._b_i += 1 + * this._stack.push_back(b0) # <<<<<<<<<<<<<< + * + * inline void pop() noexcept nogil: +*/ + try { + this->_stack.push_back(__pyx_v_b0); + } catch(...) { + PyGILState_STATE __pyx_gilstate_save = __Pyx_PyGILState_Ensure(); + __Pyx_CppExn2PyErr(); + __Pyx_PyGILState_Release(__pyx_gilstate_save); + __PYX_ERR(4, 309, __pyx_L1_error) + } + + /* "_state.pxd":301 + * return (this.length - this._b_i) + this._rebuffer.size() + * + * inline void push() noexcept nogil: # <<<<<<<<<<<<<< + * b0 = this.B(0) + * if this._rebuffer.size(): +*/ + + /* function exit code */ + goto __pyx_L0; + __pyx_L1_error:; + __pyx_gilstate_save = __Pyx_PyGILState_Ensure(); + __Pyx_WriteUnraisable("StateC.push", __pyx_clineno, __pyx_lineno, __pyx_filename, 1, 0); + __Pyx_PyGILState_Release(__pyx_gilstate_save); + __pyx_L0:; +} + +/* "_state.pxd":311 + * this._stack.push_back(b0) + * + * inline void pop() noexcept nogil: # <<<<<<<<<<<<<< + * this._stack.pop_back() + * +*/ + +void __pyx_t_5spacy_8pipeline_17_parser_internals_6_state_StateC::pop(void) { + + /* "_state.pxd":312 + * + * inline void pop() noexcept nogil: + * this._stack.pop_back() # <<<<<<<<<<<<<< + * + * inline void force_final() noexcept nogil: +*/ + this->_stack.pop_back(); + + /* "_state.pxd":311 + * this._stack.push_back(b0) + * + * inline void pop() noexcept nogil: # <<<<<<<<<<<<<< + * this._stack.pop_back() + * +*/ + + /* function exit code */ +} + +/* "_state.pxd":314 + * this._stack.pop_back() + * + * inline void force_final() noexcept nogil: # <<<<<<<<<<<<<< + * # This should only be used in desperate situations, as it may leave + * # the analysis in an unexpected state. +*/ + +void __pyx_t_5spacy_8pipeline_17_parser_internals_6_state_StateC::force_final(void) { + int __pyx_t_1; + + /* "_state.pxd":317 + * # This should only be used in desperate situations, as it may leave + * # the analysis in an unexpected state. + * this._stack.clear() # <<<<<<<<<<<<<< + * this._b_i = this.length + * +*/ + this->_stack.clear(); + + /* "_state.pxd":318 + * # the analysis in an unexpected state. + * this._stack.clear() + * this._b_i = this.length # <<<<<<<<<<<<<< + * + * inline void unshift() noexcept nogil: +*/ + __pyx_t_1 = this->length; + this->_b_i = __pyx_t_1; + + /* "_state.pxd":314 + * this._stack.pop_back() + * + * inline void force_final() noexcept nogil: # <<<<<<<<<<<<<< + * # This should only be used in desperate situations, as it may leave + * # the analysis in an unexpected state. +*/ + + /* function exit code */ +} + +/* "_state.pxd":320 + * this._b_i = this.length + * + * inline void unshift() noexcept nogil: # <<<<<<<<<<<<<< + * s0 = this._stack.back() + * this._unshiftable[s0] = 1 +*/ + +void __pyx_t_5spacy_8pipeline_17_parser_internals_6_state_StateC::unshift(void) { + int __pyx_v_s0; + int __pyx_lineno = 0; + const char *__pyx_filename = NULL; + int __pyx_clineno = 0; + PyGILState_STATE __pyx_gilstate_save; + + /* "_state.pxd":321 + * + * inline void unshift() noexcept nogil: + * s0 = this._stack.back() # <<<<<<<<<<<<<< + * this._unshiftable[s0] = 1 + * this._rebuffer.push_back(s0) +*/ + __pyx_v_s0 = this->_stack.back(); + + /* "_state.pxd":322 + * inline void unshift() noexcept nogil: + * s0 = this._stack.back() + * this._unshiftable[s0] = 1 # <<<<<<<<<<<<<< + * this._rebuffer.push_back(s0) + * this._stack.pop_back() +*/ + (this->_unshiftable[__pyx_v_s0]) = 1; + + /* "_state.pxd":323 + * s0 = this._stack.back() + * this._unshiftable[s0] = 1 + * this._rebuffer.push_back(s0) # <<<<<<<<<<<<<< + * this._stack.pop_back() + * +*/ + try { + this->_rebuffer.push_back(__pyx_v_s0); + } catch(...) { + PyGILState_STATE __pyx_gilstate_save = __Pyx_PyGILState_Ensure(); + __Pyx_CppExn2PyErr(); + __Pyx_PyGILState_Release(__pyx_gilstate_save); + __PYX_ERR(4, 323, __pyx_L1_error) + } + + /* "_state.pxd":324 + * this._unshiftable[s0] = 1 + * this._rebuffer.push_back(s0) + * this._stack.pop_back() # <<<<<<<<<<<<<< + * + * inline int is_unshiftable(int item) noexcept nogil const: +*/ + this->_stack.pop_back(); + + /* "_state.pxd":320 + * this._b_i = this.length + * + * inline void unshift() noexcept nogil: # <<<<<<<<<<<<<< + * s0 = this._stack.back() + * this._unshiftable[s0] = 1 +*/ + + /* function exit code */ + goto __pyx_L0; + __pyx_L1_error:; + __pyx_gilstate_save = __Pyx_PyGILState_Ensure(); + __Pyx_WriteUnraisable("StateC.unshift", __pyx_clineno, __pyx_lineno, __pyx_filename, 1, 0); + __Pyx_PyGILState_Release(__pyx_gilstate_save); + __pyx_L0:; +} + +/* "_state.pxd":326 + * this._stack.pop_back() + * + * inline int is_unshiftable(int item) noexcept nogil const: # <<<<<<<<<<<<<< + * if item >= this._unshiftable.size(): + * return 0 +*/ + +int __pyx_t_5spacy_8pipeline_17_parser_internals_6_state_StateC::is_unshiftable(int __pyx_v_item) const { + int __pyx_r; + int __pyx_t_1; + bool __pyx_t_2; + int __pyx_lineno = 0; + const char *__pyx_filename = NULL; + int __pyx_clineno = 0; + PyGILState_STATE __pyx_gilstate_save; + + /* "_state.pxd":327 + * + * inline int is_unshiftable(int item) noexcept nogil const: + * if item >= this._unshiftable.size(): # <<<<<<<<<<<<<< + * return 0 + * else: +*/ + __pyx_t_1 = (__pyx_v_item >= this->_unshiftable.size()); + if (__pyx_t_1) { + + /* "_state.pxd":328 + * inline int is_unshiftable(int item) noexcept nogil const: + * if item >= this._unshiftable.size(): + * return 0 # <<<<<<<<<<<<<< + * else: + * return this._unshiftable.at(item) +*/ + __pyx_r = 0; + goto __pyx_L0; + + /* "_state.pxd":327 + * + * inline int is_unshiftable(int item) noexcept nogil const: + * if item >= this._unshiftable.size(): # <<<<<<<<<<<<<< + * return 0 + * else: +*/ + } + + /* "_state.pxd":330 + * return 0 + * else: + * return this._unshiftable.at(item) # <<<<<<<<<<<<<< + * + * inline void set_reshiftable(int item) noexcept nogil: +*/ + /*else*/ { + try { + __pyx_t_2 = this->_unshiftable.at(__pyx_v_item); + } catch(...) { + PyGILState_STATE __pyx_gilstate_save = __Pyx_PyGILState_Ensure(); + __Pyx_CppExn2PyErr(); + __Pyx_PyGILState_Release(__pyx_gilstate_save); + __PYX_ERR(4, 330, __pyx_L1_error) + } + __pyx_r = __pyx_t_2; + goto __pyx_L0; + } + + /* "_state.pxd":326 + * this._stack.pop_back() + * + * inline int is_unshiftable(int item) noexcept nogil const: # <<<<<<<<<<<<<< + * if item >= this._unshiftable.size(): + * return 0 +*/ + + /* function exit code */ + __pyx_L1_error:; + __pyx_gilstate_save = __Pyx_PyGILState_Ensure(); + __Pyx_WriteUnraisable("StateC.is_unshiftable", __pyx_clineno, __pyx_lineno, __pyx_filename, 1, 0); + __pyx_r = 0; + __Pyx_PyGILState_Release(__pyx_gilstate_save); + __pyx_L0:; + return __pyx_r; +} + +/* "_state.pxd":332 + * return this._unshiftable.at(item) + * + * inline void set_reshiftable(int item) noexcept nogil: # <<<<<<<<<<<<<< + * if item < this._unshiftable.size(): + * this._unshiftable[item] = 0 +*/ + +void __pyx_t_5spacy_8pipeline_17_parser_internals_6_state_StateC::set_reshiftable(int __pyx_v_item) { + int __pyx_t_1; + + /* "_state.pxd":333 + * + * inline void set_reshiftable(int item) noexcept nogil: + * if item < this._unshiftable.size(): # <<<<<<<<<<<<<< + * this._unshiftable[item] = 0 + * +*/ + __pyx_t_1 = (__pyx_v_item < this->_unshiftable.size()); + if (__pyx_t_1) { + + /* "_state.pxd":334 + * inline void set_reshiftable(int item) noexcept nogil: + * if item < this._unshiftable.size(): + * this._unshiftable[item] = 0 # <<<<<<<<<<<<<< + * + * inline void add_arc(int head, int child, attr_t label) noexcept nogil: +*/ + (this->_unshiftable[__pyx_v_item]) = 0; + + /* "_state.pxd":333 + * + * inline void set_reshiftable(int item) noexcept nogil: + * if item < this._unshiftable.size(): # <<<<<<<<<<<<<< + * this._unshiftable[item] = 0 + * +*/ + } + + /* "_state.pxd":332 + * return this._unshiftable.at(item) + * + * inline void set_reshiftable(int item) noexcept nogil: # <<<<<<<<<<<<<< + * if item < this._unshiftable.size(): + * this._unshiftable[item] = 0 +*/ + + /* function exit code */ +} + +/* "_state.pxd":336 + * this._unshiftable[item] = 0 + * + * inline void add_arc(int head, int child, attr_t label) noexcept nogil: # <<<<<<<<<<<<<< + * if this.has_head(child): + * this.del_arc(this.H(child), child) +*/ + +void __pyx_t_5spacy_8pipeline_17_parser_internals_6_state_StateC::add_arc(int __pyx_v_head, int __pyx_v_child, __pyx_t_5spacy_8typedefs_attr_t __pyx_v_label) { + struct __pyx_t_5spacy_8pipeline_17_parser_internals_6_state_ArcC __pyx_v_arc; + int __pyx_t_1; + int __pyx_lineno = 0; + const char *__pyx_filename = NULL; + int __pyx_clineno = 0; + PyGILState_STATE __pyx_gilstate_save; + + /* "_state.pxd":337 + * + * inline void add_arc(int head, int child, attr_t label) noexcept nogil: + * if this.has_head(child): # <<<<<<<<<<<<<< + * this.del_arc(this.H(child), child) + * cdef ArcC arc +*/ + __pyx_t_1 = this->has_head(__pyx_v_child); + if (__pyx_t_1) { + + /* "_state.pxd":338 + * inline void add_arc(int head, int child, attr_t label) noexcept nogil: + * if this.has_head(child): + * this.del_arc(this.H(child), child) # <<<<<<<<<<<<<< + * cdef ArcC arc + * arc.head = head +*/ + this->del_arc(this->H(__pyx_v_child), __pyx_v_child); + + /* "_state.pxd":337 + * + * inline void add_arc(int head, int child, attr_t label) noexcept nogil: + * if this.has_head(child): # <<<<<<<<<<<<<< + * this.del_arc(this.H(child), child) + * cdef ArcC arc +*/ + } + + /* "_state.pxd":340 + * this.del_arc(this.H(child), child) + * cdef ArcC arc + * arc.head = head # <<<<<<<<<<<<<< + * arc.child = child + * arc.label = label +*/ + __pyx_v_arc.head = __pyx_v_head; + + /* "_state.pxd":341 + * cdef ArcC arc + * arc.head = head + * arc.child = child # <<<<<<<<<<<<<< + * arc.label = label + * if head > child: +*/ + __pyx_v_arc.child = __pyx_v_child; + + /* "_state.pxd":342 + * arc.head = head + * arc.child = child + * arc.label = label # <<<<<<<<<<<<<< + * if head > child: + * this._left_arcs[arc.head].push_back(arc) +*/ + __pyx_v_arc.label = __pyx_v_label; + + /* "_state.pxd":343 + * arc.child = child + * arc.label = label + * if head > child: # <<<<<<<<<<<<<< + * this._left_arcs[arc.head].push_back(arc) + * else: +*/ + __pyx_t_1 = (__pyx_v_head > __pyx_v_child); + if (__pyx_t_1) { + + /* "_state.pxd":344 + * arc.label = label + * if head > child: + * this._left_arcs[arc.head].push_back(arc) # <<<<<<<<<<<<<< + * else: + * this._right_arcs[arc.head].push_back(arc) +*/ + try { + (this->_left_arcs[__pyx_v_arc.head]).push_back(__pyx_v_arc); + } catch(...) { + PyGILState_STATE __pyx_gilstate_save = __Pyx_PyGILState_Ensure(); + __Pyx_CppExn2PyErr(); + __Pyx_PyGILState_Release(__pyx_gilstate_save); + __PYX_ERR(4, 344, __pyx_L1_error) + } + + /* "_state.pxd":343 + * arc.child = child + * arc.label = label + * if head > child: # <<<<<<<<<<<<<< + * this._left_arcs[arc.head].push_back(arc) + * else: +*/ + goto __pyx_L4; + } + + /* "_state.pxd":346 + * this._left_arcs[arc.head].push_back(arc) + * else: + * this._right_arcs[arc.head].push_back(arc) # <<<<<<<<<<<<<< + * this._heads[child] = head + * +*/ + /*else*/ { + try { + (this->_right_arcs[__pyx_v_arc.head]).push_back(__pyx_v_arc); + } catch(...) { + PyGILState_STATE __pyx_gilstate_save = __Pyx_PyGILState_Ensure(); + __Pyx_CppExn2PyErr(); + __Pyx_PyGILState_Release(__pyx_gilstate_save); + __PYX_ERR(4, 346, __pyx_L1_error) + } + } + __pyx_L4:; + + /* "_state.pxd":347 + * else: + * this._right_arcs[arc.head].push_back(arc) + * this._heads[child] = head # <<<<<<<<<<<<<< + * + * inline void map_del_arc(unordered_map[int, vector[ArcC]]* heads_arcs, int h_i, int c_i) noexcept nogil: +*/ + (this->_heads[__pyx_v_child]) = __pyx_v_head; + + /* "_state.pxd":336 + * this._unshiftable[item] = 0 + * + * inline void add_arc(int head, int child, attr_t label) noexcept nogil: # <<<<<<<<<<<<<< + * if this.has_head(child): + * this.del_arc(this.H(child), child) +*/ + + /* function exit code */ + goto __pyx_L0; + __pyx_L1_error:; + __pyx_gilstate_save = __Pyx_PyGILState_Ensure(); + __Pyx_WriteUnraisable("StateC.add_arc", __pyx_clineno, __pyx_lineno, __pyx_filename, 1, 0); + __Pyx_PyGILState_Release(__pyx_gilstate_save); + __pyx_L0:; +} + +/* "_state.pxd":349 + * this._heads[child] = head + * + * inline void map_del_arc(unordered_map[int, vector[ArcC]]* heads_arcs, int h_i, int c_i) noexcept nogil: # <<<<<<<<<<<<<< + * arcs_it = heads_arcs.find(h_i) + * if arcs_it == heads_arcs.end(): +*/ + +void __pyx_t_5spacy_8pipeline_17_parser_internals_6_state_StateC::map_del_arc(std::unordered_map > *__pyx_v_heads_arcs, int __pyx_v_h_i, int __pyx_v_c_i) { + std::unordered_map > ::iterator __pyx_v_arcs_it; + std::vector *__pyx_v_arcs; + struct __pyx_t_5spacy_8pipeline_17_parser_internals_6_state_ArcC __pyx_v_arc; + std::vector ::size_type __pyx_v_i; + int __pyx_t_1; + int __pyx_t_2; + std::vector ::size_type __pyx_t_3; + std::vector ::size_type __pyx_t_4; + std::vector ::size_type __pyx_t_5; + __Pyx_FakeReference __pyx_t_6; + int __pyx_lineno = 0; + const char *__pyx_filename = NULL; + int __pyx_clineno = 0; + PyGILState_STATE __pyx_gilstate_save; + + /* "_state.pxd":350 + * + * inline void map_del_arc(unordered_map[int, vector[ArcC]]* heads_arcs, int h_i, int c_i) noexcept nogil: + * arcs_it = heads_arcs.find(h_i) # <<<<<<<<<<<<<< + * if arcs_it == heads_arcs.end(): + * return +*/ + __pyx_v_arcs_it = __pyx_v_heads_arcs->find(__pyx_v_h_i); + + /* "_state.pxd":351 + * inline void map_del_arc(unordered_map[int, vector[ArcC]]* heads_arcs, int h_i, int c_i) noexcept nogil: + * arcs_it = heads_arcs.find(h_i) + * if arcs_it == heads_arcs.end(): # <<<<<<<<<<<<<< + * return + * +*/ + __pyx_t_1 = (__pyx_v_arcs_it == __pyx_v_heads_arcs->end()); + if (__pyx_t_1) { + + /* "_state.pxd":352 + * arcs_it = heads_arcs.find(h_i) + * if arcs_it == heads_arcs.end(): + * return # <<<<<<<<<<<<<< + * + * arcs = &deref(arcs_it).second +*/ + goto __pyx_L0; + + /* "_state.pxd":351 + * inline void map_del_arc(unordered_map[int, vector[ArcC]]* heads_arcs, int h_i, int c_i) noexcept nogil: + * arcs_it = heads_arcs.find(h_i) + * if arcs_it == heads_arcs.end(): # <<<<<<<<<<<<<< + * return + * +*/ + } + + /* "_state.pxd":354 + * return + * + * arcs = &deref(arcs_it).second # <<<<<<<<<<<<<< + * if arcs.size() == 0: + * return +*/ + __pyx_v_arcs = (&(*__pyx_v_arcs_it).second); + + /* "_state.pxd":355 + * + * arcs = &deref(arcs_it).second + * if arcs.size() == 0: # <<<<<<<<<<<<<< + * return + * +*/ + __pyx_t_1 = (__pyx_v_arcs->size() == 0); + if (__pyx_t_1) { + + /* "_state.pxd":356 + * arcs = &deref(arcs_it).second + * if arcs.size() == 0: + * return # <<<<<<<<<<<<<< + * + * arc = arcs.back() +*/ + goto __pyx_L0; + + /* "_state.pxd":355 + * + * arcs = &deref(arcs_it).second + * if arcs.size() == 0: # <<<<<<<<<<<<<< + * return + * +*/ + } + + /* "_state.pxd":358 + * return + * + * arc = arcs.back() # <<<<<<<<<<<<<< + * if arc.head == h_i and arc.child == c_i: + * arcs.pop_back() +*/ + __pyx_v_arc = __pyx_v_arcs->back(); + + /* "_state.pxd":359 + * + * arc = arcs.back() + * if arc.head == h_i and arc.child == c_i: # <<<<<<<<<<<<<< + * arcs.pop_back() + * else: +*/ + __pyx_t_2 = (__pyx_v_arc.head == __pyx_v_h_i); + if (__pyx_t_2) { + } else { + __pyx_t_1 = __pyx_t_2; + goto __pyx_L6_bool_binop_done; + } + __pyx_t_2 = (__pyx_v_arc.child == __pyx_v_c_i); + __pyx_t_1 = __pyx_t_2; + __pyx_L6_bool_binop_done:; + if (__pyx_t_1) { + + /* "_state.pxd":360 + * arc = arcs.back() + * if arc.head == h_i and arc.child == c_i: + * arcs.pop_back() # <<<<<<<<<<<<<< + * else: + * for i in range(arcs.size()-1): +*/ + __pyx_v_arcs->pop_back(); + + /* "_state.pxd":359 + * + * arc = arcs.back() + * if arc.head == h_i and arc.child == c_i: # <<<<<<<<<<<<<< + * arcs.pop_back() + * else: +*/ + goto __pyx_L5; + } + + /* "_state.pxd":362 + * arcs.pop_back() + * else: + * for i in range(arcs.size()-1): # <<<<<<<<<<<<<< + * arc = arcs.at(i) + * if arc.head == h_i and arc.child == c_i: +*/ + /*else*/ { + __pyx_t_3 = (__pyx_v_arcs->size() - 1); + __pyx_t_4 = __pyx_t_3; + for (__pyx_t_5 = 0; __pyx_t_5 < __pyx_t_4; __pyx_t_5+=1) { + __pyx_v_i = __pyx_t_5; + + /* "_state.pxd":363 + * else: + * for i in range(arcs.size()-1): + * arc = arcs.at(i) # <<<<<<<<<<<<<< + * if arc.head == h_i and arc.child == c_i: + * arc.head = -1 +*/ + try { + __pyx_t_6 = __pyx_v_arcs->at(__pyx_v_i); + } catch(...) { + PyGILState_STATE __pyx_gilstate_save = __Pyx_PyGILState_Ensure(); + __Pyx_CppExn2PyErr(); + __Pyx_PyGILState_Release(__pyx_gilstate_save); + __PYX_ERR(4, 363, __pyx_L1_error) + } + __pyx_v_arc = __pyx_t_6; + + /* "_state.pxd":364 + * for i in range(arcs.size()-1): + * arc = arcs.at(i) + * if arc.head == h_i and arc.child == c_i: # <<<<<<<<<<<<<< + * arc.head = -1 + * arc.child = -1 +*/ + __pyx_t_2 = (__pyx_v_arc.head == __pyx_v_h_i); + if (__pyx_t_2) { + } else { + __pyx_t_1 = __pyx_t_2; + goto __pyx_L11_bool_binop_done; + } + __pyx_t_2 = (__pyx_v_arc.child == __pyx_v_c_i); + __pyx_t_1 = __pyx_t_2; + __pyx_L11_bool_binop_done:; + if (__pyx_t_1) { + + /* "_state.pxd":365 + * arc = arcs.at(i) + * if arc.head == h_i and arc.child == c_i: + * arc.head = -1 # <<<<<<<<<<<<<< + * arc.child = -1 + * arc.label = 0 +*/ + __pyx_v_arc.head = -1; + + /* "_state.pxd":366 + * if arc.head == h_i and arc.child == c_i: + * arc.head = -1 + * arc.child = -1 # <<<<<<<<<<<<<< + * arc.label = 0 + * break +*/ + __pyx_v_arc.child = -1; + + /* "_state.pxd":367 + * arc.head = -1 + * arc.child = -1 + * arc.label = 0 # <<<<<<<<<<<<<< + * break + * +*/ + __pyx_v_arc.label = 0; + + /* "_state.pxd":368 + * arc.child = -1 + * arc.label = 0 + * break # <<<<<<<<<<<<<< + * + * inline void del_arc(int h_i, int c_i) noexcept nogil: +*/ + goto __pyx_L9_break; + + /* "_state.pxd":364 + * for i in range(arcs.size()-1): + * arc = arcs.at(i) + * if arc.head == h_i and arc.child == c_i: # <<<<<<<<<<<<<< + * arc.head = -1 + * arc.child = -1 +*/ + } + } + __pyx_L9_break:; + } + __pyx_L5:; + + /* "_state.pxd":349 + * this._heads[child] = head + * + * inline void map_del_arc(unordered_map[int, vector[ArcC]]* heads_arcs, int h_i, int c_i) noexcept nogil: # <<<<<<<<<<<<<< + * arcs_it = heads_arcs.find(h_i) + * if arcs_it == heads_arcs.end(): +*/ + + /* function exit code */ + goto __pyx_L0; + __pyx_L1_error:; + __pyx_gilstate_save = __Pyx_PyGILState_Ensure(); + __Pyx_WriteUnraisable("StateC.map_del_arc", __pyx_clineno, __pyx_lineno, __pyx_filename, 1, 0); + __Pyx_PyGILState_Release(__pyx_gilstate_save); + __pyx_L0:; +} + +/* "_state.pxd":370 + * break + * + * inline void del_arc(int h_i, int c_i) noexcept nogil: # <<<<<<<<<<<<<< + * if h_i > c_i: + * this.map_del_arc(&this._left_arcs, h_i, c_i) +*/ + +void __pyx_t_5spacy_8pipeline_17_parser_internals_6_state_StateC::del_arc(int __pyx_v_h_i, int __pyx_v_c_i) { + int __pyx_t_1; + + /* "_state.pxd":371 + * + * inline void del_arc(int h_i, int c_i) noexcept nogil: + * if h_i > c_i: # <<<<<<<<<<<<<< + * this.map_del_arc(&this._left_arcs, h_i, c_i) + * else: +*/ + __pyx_t_1 = (__pyx_v_h_i > __pyx_v_c_i); + if (__pyx_t_1) { + + /* "_state.pxd":372 + * inline void del_arc(int h_i, int c_i) noexcept nogil: + * if h_i > c_i: + * this.map_del_arc(&this._left_arcs, h_i, c_i) # <<<<<<<<<<<<<< + * else: + * this.map_del_arc(&this._right_arcs, h_i, c_i) +*/ + this->map_del_arc((&this->_left_arcs), __pyx_v_h_i, __pyx_v_c_i); + + /* "_state.pxd":371 + * + * inline void del_arc(int h_i, int c_i) noexcept nogil: + * if h_i > c_i: # <<<<<<<<<<<<<< + * this.map_del_arc(&this._left_arcs, h_i, c_i) + * else: +*/ + goto __pyx_L3; + } + + /* "_state.pxd":374 + * this.map_del_arc(&this._left_arcs, h_i, c_i) + * else: + * this.map_del_arc(&this._right_arcs, h_i, c_i) # <<<<<<<<<<<<<< + * + * inline SpanC get_ent() noexcept nogil const: +*/ + /*else*/ { + this->map_del_arc((&this->_right_arcs), __pyx_v_h_i, __pyx_v_c_i); + } + __pyx_L3:; + + /* "_state.pxd":370 + * break + * + * inline void del_arc(int h_i, int c_i) noexcept nogil: # <<<<<<<<<<<<<< + * if h_i > c_i: + * this.map_del_arc(&this._left_arcs, h_i, c_i) +*/ + + /* function exit code */ +} + +/* "_state.pxd":376 + * this.map_del_arc(&this._right_arcs, h_i, c_i) + * + * inline SpanC get_ent() noexcept nogil const: # <<<<<<<<<<<<<< + * cdef SpanC ent + * if this._ents.size() == 0: +*/ + +struct __pyx_t_5spacy_7structs_SpanC __pyx_t_5spacy_8pipeline_17_parser_internals_6_state_StateC::get_ent(void) const { + struct __pyx_t_5spacy_7structs_SpanC __pyx_v_ent; + struct __pyx_t_5spacy_7structs_SpanC __pyx_r; + int __pyx_t_1; + + /* "_state.pxd":378 + * inline SpanC get_ent() noexcept nogil const: + * cdef SpanC ent + * if this._ents.size() == 0: # <<<<<<<<<<<<<< + * ent.start = 0 + * ent.end = 0 +*/ + __pyx_t_1 = (this->_ents.size() == 0); + if (__pyx_t_1) { + + /* "_state.pxd":379 + * cdef SpanC ent + * if this._ents.size() == 0: + * ent.start = 0 # <<<<<<<<<<<<<< + * ent.end = 0 + * ent.label = 0 +*/ + __pyx_v_ent.start = 0; + + /* "_state.pxd":380 + * if this._ents.size() == 0: + * ent.start = 0 + * ent.end = 0 # <<<<<<<<<<<<<< + * ent.label = 0 + * return ent +*/ + __pyx_v_ent.end = 0; + + /* "_state.pxd":381 + * ent.start = 0 + * ent.end = 0 + * ent.label = 0 # <<<<<<<<<<<<<< + * return ent + * else: +*/ + __pyx_v_ent.label = 0; + + /* "_state.pxd":382 + * ent.end = 0 + * ent.label = 0 + * return ent # <<<<<<<<<<<<<< + * else: + * return this._ents.back() +*/ + __pyx_r = __pyx_v_ent; + goto __pyx_L0; + + /* "_state.pxd":378 + * inline SpanC get_ent() noexcept nogil const: + * cdef SpanC ent + * if this._ents.size() == 0: # <<<<<<<<<<<<<< + * ent.start = 0 + * ent.end = 0 +*/ + } + + /* "_state.pxd":384 + * return ent + * else: + * return this._ents.back() # <<<<<<<<<<<<<< + * + * inline void open_ent(attr_t label) noexcept nogil: +*/ + /*else*/ { + __pyx_r = this->_ents.back(); + goto __pyx_L0; + } + + /* "_state.pxd":376 + * this.map_del_arc(&this._right_arcs, h_i, c_i) + * + * inline SpanC get_ent() noexcept nogil const: # <<<<<<<<<<<<<< + * cdef SpanC ent + * if this._ents.size() == 0: +*/ + + /* function exit code */ + __pyx_L0:; + return __pyx_r; +} + +/* "_state.pxd":386 + * return this._ents.back() + * + * inline void open_ent(attr_t label) noexcept nogil: # <<<<<<<<<<<<<< + * cdef SpanC ent + * ent.start = this.B(0) +*/ + +void __pyx_t_5spacy_8pipeline_17_parser_internals_6_state_StateC::open_ent(__pyx_t_5spacy_8typedefs_attr_t __pyx_v_label) { + struct __pyx_t_5spacy_7structs_SpanC __pyx_v_ent; + int __pyx_lineno = 0; + const char *__pyx_filename = NULL; + int __pyx_clineno = 0; + PyGILState_STATE __pyx_gilstate_save; + + /* "_state.pxd":388 + * inline void open_ent(attr_t label) noexcept nogil: + * cdef SpanC ent + * ent.start = this.B(0) # <<<<<<<<<<<<<< + * ent.label = label + * ent.end = -1 +*/ + __pyx_v_ent.start = this->B(0); + + /* "_state.pxd":389 + * cdef SpanC ent + * ent.start = this.B(0) + * ent.label = label # <<<<<<<<<<<<<< + * ent.end = -1 + * this._ents.push_back(ent) +*/ + __pyx_v_ent.label = __pyx_v_label; + + /* "_state.pxd":390 + * ent.start = this.B(0) + * ent.label = label + * ent.end = -1 # <<<<<<<<<<<<<< + * this._ents.push_back(ent) + * +*/ + __pyx_v_ent.end = -1; + + /* "_state.pxd":391 + * ent.label = label + * ent.end = -1 + * this._ents.push_back(ent) # <<<<<<<<<<<<<< + * + * inline void close_ent() noexcept nogil: +*/ + try { + this->_ents.push_back(__pyx_v_ent); + } catch(...) { + PyGILState_STATE __pyx_gilstate_save = __Pyx_PyGILState_Ensure(); + __Pyx_CppExn2PyErr(); + __Pyx_PyGILState_Release(__pyx_gilstate_save); + __PYX_ERR(4, 391, __pyx_L1_error) + } + + /* "_state.pxd":386 + * return this._ents.back() + * + * inline void open_ent(attr_t label) noexcept nogil: # <<<<<<<<<<<<<< + * cdef SpanC ent + * ent.start = this.B(0) +*/ + + /* function exit code */ + goto __pyx_L0; + __pyx_L1_error:; + __pyx_gilstate_save = __Pyx_PyGILState_Ensure(); + __Pyx_WriteUnraisable("StateC.open_ent", __pyx_clineno, __pyx_lineno, __pyx_filename, 1, 0); + __Pyx_PyGILState_Release(__pyx_gilstate_save); + __pyx_L0:; +} + +/* "_state.pxd":393 + * this._ents.push_back(ent) + * + * inline void close_ent() noexcept nogil: # <<<<<<<<<<<<<< + * this._ents.back().end = this.B(0)+1 + * +*/ + +void __pyx_t_5spacy_8pipeline_17_parser_internals_6_state_StateC::close_ent(void) { + + /* "_state.pxd":394 + * + * inline void close_ent() noexcept nogil: + * this._ents.back().end = this.B(0)+1 # <<<<<<<<<<<<<< + * + * inline void clone(const StateC* src) noexcept nogil: +*/ + this->_ents.back().end = (this->B(0) + 1); + + /* "_state.pxd":393 + * this._ents.push_back(ent) + * + * inline void close_ent() noexcept nogil: # <<<<<<<<<<<<<< + * this._ents.back().end = this.B(0)+1 + * +*/ + + /* function exit code */ +} + +/* "_state.pxd":396 + * this._ents.back().end = this.B(0)+1 + * + * inline void clone(const StateC* src) noexcept nogil: # <<<<<<<<<<<<<< + * this.length = src.length + * this._sent = src._sent +*/ + +void __pyx_t_5spacy_8pipeline_17_parser_internals_6_state_StateC::clone(__pyx_t_5spacy_8pipeline_17_parser_internals_6_state_StateC const *__pyx_v_src) { + int __pyx_t_1; + struct __pyx_t_5spacy_7structs_TokenC const *__pyx_t_2; + std::vector __pyx_t_3; + std::set __pyx_t_4; + std::vector __pyx_t_5; + std::vector __pyx_t_6; + std::unordered_map > __pyx_t_7; + struct __pyx_t_5spacy_7structs_TokenC __pyx_t_8; + + /* "_state.pxd":397 + * + * inline void clone(const StateC* src) noexcept nogil: + * this.length = src.length # <<<<<<<<<<<<<< + * this._sent = src._sent + * this._stack = src._stack +*/ + __pyx_t_1 = __pyx_v_src->length; + this->length = __pyx_t_1; + + /* "_state.pxd":398 + * inline void clone(const StateC* src) noexcept nogil: + * this.length = src.length + * this._sent = src._sent # <<<<<<<<<<<<<< + * this._stack = src._stack + * this._rebuffer = src._rebuffer +*/ + __pyx_t_2 = __pyx_v_src->_sent; + this->_sent = __pyx_t_2; + + /* "_state.pxd":399 + * this.length = src.length + * this._sent = src._sent + * this._stack = src._stack # <<<<<<<<<<<<<< + * this._rebuffer = src._rebuffer + * this._sent_starts = src._sent_starts +*/ + __pyx_t_3 = __pyx_v_src->_stack; + this->_stack = __PYX_STD_MOVE_IF_SUPPORTED(__pyx_t_3); + + /* "_state.pxd":400 + * this._sent = src._sent + * this._stack = src._stack + * this._rebuffer = src._rebuffer # <<<<<<<<<<<<<< + * this._sent_starts = src._sent_starts + * this._unshiftable = src._unshiftable +*/ + __pyx_t_3 = __pyx_v_src->_rebuffer; + this->_rebuffer = __PYX_STD_MOVE_IF_SUPPORTED(__pyx_t_3); + + /* "_state.pxd":401 + * this._stack = src._stack + * this._rebuffer = src._rebuffer + * this._sent_starts = src._sent_starts # <<<<<<<<<<<<<< + * this._unshiftable = src._unshiftable + * memcpy(this._heads, src._heads, this.length * sizeof(this._heads[0])) +*/ + __pyx_t_4 = __pyx_v_src->_sent_starts; + this->_sent_starts = __PYX_STD_MOVE_IF_SUPPORTED(__pyx_t_4); + + /* "_state.pxd":402 + * this._rebuffer = src._rebuffer + * this._sent_starts = src._sent_starts + * this._unshiftable = src._unshiftable # <<<<<<<<<<<<<< + * memcpy(this._heads, src._heads, this.length * sizeof(this._heads[0])) + * this._ents = src._ents +*/ + __pyx_t_5 = __pyx_v_src->_unshiftable; + this->_unshiftable = __PYX_STD_MOVE_IF_SUPPORTED(__pyx_t_5); + + /* "_state.pxd":403 + * this._sent_starts = src._sent_starts + * this._unshiftable = src._unshiftable + * memcpy(this._heads, src._heads, this.length * sizeof(this._heads[0])) # <<<<<<<<<<<<<< + * this._ents = src._ents + * this._left_arcs = src._left_arcs +*/ + (void)(memcpy(this->_heads, __pyx_v_src->_heads, (this->length * (sizeof((this->_heads[0])))))); + + /* "_state.pxd":404 + * this._unshiftable = src._unshiftable + * memcpy(this._heads, src._heads, this.length * sizeof(this._heads[0])) + * this._ents = src._ents # <<<<<<<<<<<<<< + * this._left_arcs = src._left_arcs + * this._right_arcs = src._right_arcs +*/ + __pyx_t_6 = __pyx_v_src->_ents; + this->_ents = __PYX_STD_MOVE_IF_SUPPORTED(__pyx_t_6); + + /* "_state.pxd":405 + * memcpy(this._heads, src._heads, this.length * sizeof(this._heads[0])) + * this._ents = src._ents + * this._left_arcs = src._left_arcs # <<<<<<<<<<<<<< + * this._right_arcs = src._right_arcs + * this._b_i = src._b_i +*/ + __pyx_t_7 = __pyx_v_src->_left_arcs; + this->_left_arcs = __PYX_STD_MOVE_IF_SUPPORTED(__pyx_t_7); + + /* "_state.pxd":406 + * this._ents = src._ents + * this._left_arcs = src._left_arcs + * this._right_arcs = src._right_arcs # <<<<<<<<<<<<<< + * this._b_i = src._b_i + * this.offset = src.offset +*/ + __pyx_t_7 = __pyx_v_src->_right_arcs; + this->_right_arcs = __PYX_STD_MOVE_IF_SUPPORTED(__pyx_t_7); + + /* "_state.pxd":407 + * this._left_arcs = src._left_arcs + * this._right_arcs = src._right_arcs + * this._b_i = src._b_i # <<<<<<<<<<<<<< + * this.offset = src.offset + * this._empty_token = src._empty_token +*/ + __pyx_t_1 = __pyx_v_src->_b_i; + this->_b_i = __pyx_t_1; + + /* "_state.pxd":408 + * this._right_arcs = src._right_arcs + * this._b_i = src._b_i + * this.offset = src.offset # <<<<<<<<<<<<<< + * this._empty_token = src._empty_token +*/ + __pyx_t_1 = __pyx_v_src->offset; + this->offset = __pyx_t_1; + + /* "_state.pxd":409 + * this._b_i = src._b_i + * this.offset = src.offset + * this._empty_token = src._empty_token # <<<<<<<<<<<<<< +*/ + __pyx_t_8 = __pyx_v_src->_empty_token; + this->_empty_token = __pyx_t_8; + + /* "_state.pxd":396 + * this._ents.back().end = this.B(0)+1 + * + * inline void clone(const StateC* src) noexcept nogil: # <<<<<<<<<<<<<< + * this.length = src.length + * this._sent = src._sent +*/ + + /* function exit code */ +} + +/* "spacy/pipeline/_parser_internals/stateclass.pxd":14 + * cdef int _borrowed + * + * @staticmethod # <<<<<<<<<<<<<< + * cdef inline StateClass borrow(StateC* ptr, Doc doc): + * cdef StateClass self = StateClass() +*/ + +static CYTHON_INLINE struct __pyx_obj_5spacy_8pipeline_17_parser_internals_10stateclass_StateClass *__pyx_f_5spacy_8pipeline_17_parser_internals_10stateclass_10StateClass_borrow(__pyx_t_5spacy_8pipeline_17_parser_internals_6_state_StateC *__pyx_v_ptr, struct __pyx_obj_5spacy_6tokens_3doc_Doc *__pyx_v_doc) { + struct __pyx_obj_5spacy_8pipeline_17_parser_internals_10stateclass_StateClass *__pyx_v_self = 0; + struct __pyx_obj_5spacy_8pipeline_17_parser_internals_10stateclass_StateClass *__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("borrow", 0); + + /* "spacy/pipeline/_parser_internals/stateclass.pxd":16 + * @staticmethod + * cdef inline StateClass borrow(StateC* ptr, Doc doc): + * cdef StateClass self = StateClass() # <<<<<<<<<<<<<< + * self.c = ptr + * self._borrowed = 1 +*/ + __pyx_t_2 = NULL; + __pyx_t_3 = 1; + { + PyObject *__pyx_callargs[2] = {__pyx_t_2, NULL}; + __pyx_t_1 = __Pyx_PyObject_FastCall((PyObject*)__pyx_mstate_global->__pyx_ptype_5spacy_8pipeline_17_parser_internals_10stateclass_StateClass, __pyx_callargs+__pyx_t_3, (1-__pyx_t_3) | (__pyx_t_3*__Pyx_PY_VECTORCALL_ARGUMENTS_OFFSET)); + __Pyx_XDECREF(__pyx_t_2); __pyx_t_2 = 0; + if (unlikely(!__pyx_t_1)) __PYX_ERR(5, 16, __pyx_L1_error) + __Pyx_GOTREF((PyObject *)__pyx_t_1); + } + __pyx_v_self = ((struct __pyx_obj_5spacy_8pipeline_17_parser_internals_10stateclass_StateClass *)__pyx_t_1); + __pyx_t_1 = 0; + + /* "spacy/pipeline/_parser_internals/stateclass.pxd":17 + * cdef inline StateClass borrow(StateC* ptr, Doc doc): + * cdef StateClass self = StateClass() + * self.c = ptr # <<<<<<<<<<<<<< + * self._borrowed = 1 + * self.doc = doc +*/ + __pyx_v_self->c = __pyx_v_ptr; + + /* "spacy/pipeline/_parser_internals/stateclass.pxd":18 + * cdef StateClass self = StateClass() + * self.c = ptr + * self._borrowed = 1 # <<<<<<<<<<<<<< + * self.doc = doc + * return self +*/ + __pyx_v_self->_borrowed = 1; + + /* "spacy/pipeline/_parser_internals/stateclass.pxd":19 + * self.c = ptr + * self._borrowed = 1 + * self.doc = doc # <<<<<<<<<<<<<< + * return self + * +*/ + __Pyx_INCREF((PyObject *)__pyx_v_doc); + __Pyx_GIVEREF((PyObject *)__pyx_v_doc); + __Pyx_GOTREF((PyObject *)__pyx_v_self->doc); + __Pyx_DECREF((PyObject *)__pyx_v_self->doc); + __pyx_v_self->doc = __pyx_v_doc; + + /* "spacy/pipeline/_parser_internals/stateclass.pxd":20 + * self._borrowed = 1 + * self.doc = doc + * return self # <<<<<<<<<<<<<< + * + * @staticmethod +*/ + __Pyx_XDECREF((PyObject *)__pyx_r); + __Pyx_INCREF((PyObject *)__pyx_v_self); + __pyx_r = __pyx_v_self; + goto __pyx_L0; + + /* "spacy/pipeline/_parser_internals/stateclass.pxd":14 + * cdef int _borrowed + * + * @staticmethod # <<<<<<<<<<<<<< + * cdef inline StateClass borrow(StateC* ptr, Doc doc): + * cdef StateClass self = StateClass() +*/ + + /* function exit code */ + __pyx_L1_error:; + __Pyx_XDECREF(__pyx_t_1); + __Pyx_XDECREF(__pyx_t_2); + __Pyx_AddTraceback("spacy.pipeline._parser_internals.stateclass.StateClass.borrow", __pyx_clineno, __pyx_lineno, __pyx_filename); + __pyx_r = 0; + __pyx_L0:; + __Pyx_XDECREF((PyObject *)__pyx_v_self); + __Pyx_XGIVEREF((PyObject *)__pyx_r); + __Pyx_RefNannyFinishContext(); + return __pyx_r; +} + +/* "spacy/pipeline/_parser_internals/stateclass.pxd":22 + * return self + * + * @staticmethod # <<<<<<<<<<<<<< + * cdef inline StateClass init_offset(const TokenC* sent, int length, int + * offset): +*/ + +static CYTHON_INLINE struct __pyx_obj_5spacy_8pipeline_17_parser_internals_10stateclass_StateClass *__pyx_f_5spacy_8pipeline_17_parser_internals_10stateclass_10StateClass_init_offset(struct __pyx_t_5spacy_7structs_TokenC const *__pyx_v_sent, int __pyx_v_length, int __pyx_v_offset) { + struct __pyx_obj_5spacy_8pipeline_17_parser_internals_10stateclass_StateClass *__pyx_v_self = 0; + struct __pyx_obj_5spacy_8pipeline_17_parser_internals_10stateclass_StateClass *__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("init_offset", 0); + + /* "spacy/pipeline/_parser_internals/stateclass.pxd":25 + * cdef inline StateClass init_offset(const TokenC* sent, int length, int + * offset): + * cdef StateClass self = StateClass() # <<<<<<<<<<<<<< + * self.c = new StateC(sent, length) + * self.c.offset = offset +*/ + __pyx_t_2 = NULL; + __pyx_t_3 = 1; + { + PyObject *__pyx_callargs[2] = {__pyx_t_2, NULL}; + __pyx_t_1 = __Pyx_PyObject_FastCall((PyObject*)__pyx_mstate_global->__pyx_ptype_5spacy_8pipeline_17_parser_internals_10stateclass_StateClass, __pyx_callargs+__pyx_t_3, (1-__pyx_t_3) | (__pyx_t_3*__Pyx_PY_VECTORCALL_ARGUMENTS_OFFSET)); + __Pyx_XDECREF(__pyx_t_2); __pyx_t_2 = 0; + if (unlikely(!__pyx_t_1)) __PYX_ERR(5, 25, __pyx_L1_error) + __Pyx_GOTREF((PyObject *)__pyx_t_1); + } + __pyx_v_self = ((struct __pyx_obj_5spacy_8pipeline_17_parser_internals_10stateclass_StateClass *)__pyx_t_1); + __pyx_t_1 = 0; + + /* "spacy/pipeline/_parser_internals/stateclass.pxd":26 + * offset): + * cdef StateClass self = StateClass() + * self.c = new StateC(sent, length) # <<<<<<<<<<<<<< + * self.c.offset = offset + * return self +*/ + __pyx_v_self->c = new __pyx_t_5spacy_8pipeline_17_parser_internals_6_state_StateC(__pyx_v_sent, __pyx_v_length); + + /* "spacy/pipeline/_parser_internals/stateclass.pxd":27 + * cdef StateClass self = StateClass() + * self.c = new StateC(sent, length) + * self.c.offset = offset # <<<<<<<<<<<<<< + * return self +*/ + __pyx_v_self->c->offset = __pyx_v_offset; + + /* "spacy/pipeline/_parser_internals/stateclass.pxd":28 + * self.c = new StateC(sent, length) + * self.c.offset = offset + * return self # <<<<<<<<<<<<<< +*/ + __Pyx_XDECREF((PyObject *)__pyx_r); + __Pyx_INCREF((PyObject *)__pyx_v_self); + __pyx_r = __pyx_v_self; + goto __pyx_L0; + + /* "spacy/pipeline/_parser_internals/stateclass.pxd":22 + * return self + * + * @staticmethod # <<<<<<<<<<<<<< + * cdef inline StateClass init_offset(const TokenC* sent, int length, int + * offset): +*/ + + /* function exit code */ + __pyx_L1_error:; + __Pyx_XDECREF(__pyx_t_1); + __Pyx_XDECREF(__pyx_t_2); + __Pyx_AddTraceback("spacy.pipeline._parser_internals.stateclass.StateClass.init_offset", __pyx_clineno, __pyx_lineno, __pyx_filename); + __pyx_r = 0; + __pyx_L0:; + __Pyx_XDECREF((PyObject *)__pyx_v_self); + __Pyx_XGIVEREF((PyObject *)__pyx_r); + __Pyx_RefNannyFinishContext(); + return __pyx_r; +} + +/* "spacy/pipeline/_parser_internals/stateclass.pyx":10 + * + * cdef class StateClass: + * def __init__(self, Doc doc=None, int offset=0): # <<<<<<<<<<<<<< + * self._borrowed = 0 + * if doc is not None: +*/ + +/* Python wrapper */ +static int __pyx_pw_5spacy_8pipeline_17_parser_internals_10stateclass_10StateClass_1__init__(PyObject *__pyx_v_self, PyObject *__pyx_args, PyObject *__pyx_kwds); /*proto*/ +static int __pyx_pw_5spacy_8pipeline_17_parser_internals_10stateclass_10StateClass_1__init__(PyObject *__pyx_v_self, PyObject *__pyx_args, PyObject *__pyx_kwds) { + struct __pyx_obj_5spacy_6tokens_3doc_Doc *__pyx_v_doc = 0; + int __pyx_v_offset; + CYTHON_UNUSED Py_ssize_t __pyx_nargs; + CYTHON_UNUSED PyObject *const *__pyx_kwvalues; + PyObject* values[2] = {0,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_doc,&__pyx_mstate_global->__pyx_n_u_offset,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, 10, __pyx_L3_error) + if (__pyx_kwds_len > 0) { + switch (__pyx_nargs) { + case 2: + values[1] = __Pyx_ArgRef_VARARGS(__pyx_args, 1); + if (!CYTHON_ASSUME_SAFE_MACROS && unlikely(!values[1])) __PYX_ERR(0, 10, __pyx_L3_error) + CYTHON_FALLTHROUGH; + case 1: + values[0] = __Pyx_ArgRef_VARARGS(__pyx_args, 0); + if (!CYTHON_ASSUME_SAFE_MACROS && unlikely(!values[0])) __PYX_ERR(0, 10, __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, 10, __pyx_L3_error) + if (!values[0]) values[0] = __Pyx_NewRef((PyObject *)((struct __pyx_obj_5spacy_6tokens_3doc_Doc *)Py_None)); + } else { + switch (__pyx_nargs) { + case 2: + values[1] = __Pyx_ArgRef_VARARGS(__pyx_args, 1); + if (!CYTHON_ASSUME_SAFE_MACROS && unlikely(!values[1])) __PYX_ERR(0, 10, __pyx_L3_error) + CYTHON_FALLTHROUGH; + case 1: + values[0] = __Pyx_ArgRef_VARARGS(__pyx_args, 0); + if (!CYTHON_ASSUME_SAFE_MACROS && unlikely(!values[0])) __PYX_ERR(0, 10, __pyx_L3_error) + CYTHON_FALLTHROUGH; + case 0: break; + default: goto __pyx_L5_argtuple_error; + } + if (!values[0]) values[0] = __Pyx_NewRef((PyObject *)((struct __pyx_obj_5spacy_6tokens_3doc_Doc *)Py_None)); + } + __pyx_v_doc = ((struct __pyx_obj_5spacy_6tokens_3doc_Doc *)values[0]); + if (values[1]) { + __pyx_v_offset = __Pyx_PyLong_As_int(values[1]); if (unlikely((__pyx_v_offset == (int)-1) && PyErr_Occurred())) __PYX_ERR(0, 10, __pyx_L3_error) + } else { + __pyx_v_offset = ((int)0); + } + } + goto __pyx_L6_skip; + __pyx_L5_argtuple_error:; + __Pyx_RaiseArgtupleInvalid("__init__", 0, 0, 2, __pyx_nargs); __PYX_ERR(0, 10, __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("spacy.pipeline._parser_internals.stateclass.StateClass.__init__", __pyx_clineno, __pyx_lineno, __pyx_filename); + __Pyx_RefNannyFinishContext(); + return -1; + __pyx_L4_argument_unpacking_done:; + if (unlikely(!__Pyx_ArgTypeTest(((PyObject *)__pyx_v_doc), __pyx_mstate_global->__pyx_ptype_5spacy_6tokens_3doc_Doc, 1, "doc", 0))) __PYX_ERR(0, 10, __pyx_L1_error) + __pyx_r = __pyx_pf_5spacy_8pipeline_17_parser_internals_10stateclass_10StateClass___init__(((struct __pyx_obj_5spacy_8pipeline_17_parser_internals_10stateclass_StateClass *)__pyx_v_self), __pyx_v_doc, __pyx_v_offset); + + /* 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_5spacy_8pipeline_17_parser_internals_10stateclass_10StateClass___init__(struct __pyx_obj_5spacy_8pipeline_17_parser_internals_10stateclass_StateClass *__pyx_v_self, struct __pyx_obj_5spacy_6tokens_3doc_Doc *__pyx_v_doc, int __pyx_v_offset) { + int __pyx_r; + __Pyx_RefNannyDeclarations + int __pyx_t_1; + __Pyx_RefNannySetupContext("__init__", 0); + + /* "spacy/pipeline/_parser_internals/stateclass.pyx":11 + * cdef class StateClass: + * def __init__(self, Doc doc=None, int offset=0): + * self._borrowed = 0 # <<<<<<<<<<<<<< + * if doc is not None: + * self.c = new StateC(doc.c, doc.length) +*/ + __pyx_v_self->_borrowed = 0; + + /* "spacy/pipeline/_parser_internals/stateclass.pyx":12 + * def __init__(self, Doc doc=None, int offset=0): + * self._borrowed = 0 + * if doc is not None: # <<<<<<<<<<<<<< + * self.c = new StateC(doc.c, doc.length) + * self.c.offset = offset +*/ + __pyx_t_1 = (((PyObject *)__pyx_v_doc) != Py_None); + if (__pyx_t_1) { + + /* "spacy/pipeline/_parser_internals/stateclass.pyx":13 + * self._borrowed = 0 + * if doc is not None: + * self.c = new StateC(doc.c, doc.length) # <<<<<<<<<<<<<< + * self.c.offset = offset + * self.doc = doc +*/ + __pyx_v_self->c = new __pyx_t_5spacy_8pipeline_17_parser_internals_6_state_StateC(__pyx_v_doc->c, __pyx_v_doc->length); + + /* "spacy/pipeline/_parser_internals/stateclass.pyx":14 + * if doc is not None: + * self.c = new StateC(doc.c, doc.length) + * self.c.offset = offset # <<<<<<<<<<<<<< + * self.doc = doc + * else: +*/ + __pyx_v_self->c->offset = __pyx_v_offset; + + /* "spacy/pipeline/_parser_internals/stateclass.pyx":15 + * self.c = new StateC(doc.c, doc.length) + * self.c.offset = offset + * self.doc = doc # <<<<<<<<<<<<<< + * else: + * self.doc = None +*/ + __Pyx_INCREF((PyObject *)__pyx_v_doc); + __Pyx_GIVEREF((PyObject *)__pyx_v_doc); + __Pyx_GOTREF((PyObject *)__pyx_v_self->doc); + __Pyx_DECREF((PyObject *)__pyx_v_self->doc); + __pyx_v_self->doc = __pyx_v_doc; + + /* "spacy/pipeline/_parser_internals/stateclass.pyx":12 + * def __init__(self, Doc doc=None, int offset=0): + * self._borrowed = 0 + * if doc is not None: # <<<<<<<<<<<<<< + * self.c = new StateC(doc.c, doc.length) + * self.c.offset = offset +*/ + goto __pyx_L3; + } + + /* "spacy/pipeline/_parser_internals/stateclass.pyx":17 + * self.doc = doc + * else: + * self.doc = None # <<<<<<<<<<<<<< + * + * def __dealloc__(self): +*/ + /*else*/ { + __Pyx_INCREF(Py_None); + __Pyx_GIVEREF(Py_None); + __Pyx_GOTREF((PyObject *)__pyx_v_self->doc); + __Pyx_DECREF((PyObject *)__pyx_v_self->doc); + __pyx_v_self->doc = ((struct __pyx_obj_5spacy_6tokens_3doc_Doc *)Py_None); + } + __pyx_L3:; + + /* "spacy/pipeline/_parser_internals/stateclass.pyx":10 + * + * cdef class StateClass: + * def __init__(self, Doc doc=None, int offset=0): # <<<<<<<<<<<<<< + * self._borrowed = 0 + * if doc is not None: +*/ + + /* function exit code */ + __pyx_r = 0; + __Pyx_RefNannyFinishContext(); + return __pyx_r; +} + +/* "spacy/pipeline/_parser_internals/stateclass.pyx":19 + * self.doc = None + * + * def __dealloc__(self): # <<<<<<<<<<<<<< + * if self._borrowed != 1: + * del self.c +*/ + +/* Python wrapper */ +static void __pyx_pw_5spacy_8pipeline_17_parser_internals_10stateclass_10StateClass_3__dealloc__(PyObject *__pyx_v_self); /*proto*/ +static void __pyx_pw_5spacy_8pipeline_17_parser_internals_10stateclass_10StateClass_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_5spacy_8pipeline_17_parser_internals_10stateclass_10StateClass_2__dealloc__(((struct __pyx_obj_5spacy_8pipeline_17_parser_internals_10stateclass_StateClass *)__pyx_v_self)); + + /* function exit code */ + __Pyx_RefNannyFinishContext(); +} + +static void __pyx_pf_5spacy_8pipeline_17_parser_internals_10stateclass_10StateClass_2__dealloc__(struct __pyx_obj_5spacy_8pipeline_17_parser_internals_10stateclass_StateClass *__pyx_v_self) { + int __pyx_t_1; + + /* "spacy/pipeline/_parser_internals/stateclass.pyx":20 + * + * def __dealloc__(self): + * if self._borrowed != 1: # <<<<<<<<<<<<<< + * del self.c + * +*/ + __pyx_t_1 = (__pyx_v_self->_borrowed != 1); + if (__pyx_t_1) { + + /* "spacy/pipeline/_parser_internals/stateclass.pyx":21 + * def __dealloc__(self): + * if self._borrowed != 1: + * del self.c # <<<<<<<<<<<<<< + * + * @property +*/ + delete __pyx_v_self->c; + + /* "spacy/pipeline/_parser_internals/stateclass.pyx":20 + * + * def __dealloc__(self): + * if self._borrowed != 1: # <<<<<<<<<<<<<< + * del self.c + * +*/ + } + + /* "spacy/pipeline/_parser_internals/stateclass.pyx":19 + * self.doc = None + * + * def __dealloc__(self): # <<<<<<<<<<<<<< + * if self._borrowed != 1: + * del self.c +*/ + + /* function exit code */ +} + +/* "spacy/pipeline/_parser_internals/stateclass.pyx":23 + * del self.c + * + * @property # <<<<<<<<<<<<<< + * def stack(self): + * return [self.S(i) for i in range(self.c.stack_depth())] +*/ + +/* Python wrapper */ +static PyObject *__pyx_pw_5spacy_8pipeline_17_parser_internals_10stateclass_10StateClass_5stack_1__get__(PyObject *__pyx_v_self); /*proto*/ +static PyObject *__pyx_pw_5spacy_8pipeline_17_parser_internals_10stateclass_10StateClass_5stack_1__get__(PyObject *__pyx_v_self) { + CYTHON_UNUSED PyObject *const *__pyx_kwvalues; + PyObject *__pyx_r = 0; + __Pyx_RefNannyDeclarations + __Pyx_RefNannySetupContext("__get__ (wrapper)", 0); + __pyx_kwvalues = __Pyx_KwValues_VARARGS(__pyx_args, __pyx_nargs); + __pyx_r = __pyx_pf_5spacy_8pipeline_17_parser_internals_10stateclass_10StateClass_5stack___get__(((struct __pyx_obj_5spacy_8pipeline_17_parser_internals_10stateclass_StateClass *)__pyx_v_self)); + + /* function exit code */ + __Pyx_RefNannyFinishContext(); + return __pyx_r; +} + +static PyObject *__pyx_pf_5spacy_8pipeline_17_parser_internals_10stateclass_10StateClass_5stack___get__(struct __pyx_obj_5spacy_8pipeline_17_parser_internals_10stateclass_StateClass *__pyx_v_self) { + int __pyx_v_i; + PyObject *__pyx_r = NULL; + __Pyx_RefNannyDeclarations + PyObject *__pyx_t_1 = NULL; + int __pyx_t_2; + int __pyx_t_3; + int __pyx_t_4; + PyObject *__pyx_t_5 = NULL; + PyObject *__pyx_t_6 = NULL; + 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("__get__", 0); + + /* "spacy/pipeline/_parser_internals/stateclass.pyx":25 + * @property + * def stack(self): + * return [self.S(i) for i in range(self.c.stack_depth())] # <<<<<<<<<<<<<< + * + * @property +*/ + __Pyx_XDECREF(__pyx_r); + __pyx_t_1 = PyList_New(0); if (unlikely(!__pyx_t_1)) __PYX_ERR(0, 25, __pyx_L1_error) + __Pyx_GOTREF(__pyx_t_1); + __pyx_t_2 = __pyx_v_self->c->stack_depth(); + __pyx_t_3 = __pyx_t_2; + for (__pyx_t_4 = 0; __pyx_t_4 < __pyx_t_3; __pyx_t_4+=1) { + __pyx_v_i = __pyx_t_4; + __pyx_t_6 = ((PyObject *)__pyx_v_self); + __Pyx_INCREF(__pyx_t_6); + __pyx_t_7 = __Pyx_PyLong_From_int(__pyx_v_i); if (unlikely(!__pyx_t_7)) __PYX_ERR(0, 25, __pyx_L1_error) + __Pyx_GOTREF(__pyx_t_7); + __pyx_t_8 = 0; + { + PyObject *__pyx_callargs[2] = {__pyx_t_6, __pyx_t_7}; + __pyx_t_5 = __Pyx_PyObject_FastCallMethod((PyObject*)__pyx_mstate_global->__pyx_n_u_S, __pyx_callargs+__pyx_t_8, (2-__pyx_t_8) | (1*__Pyx_PY_VECTORCALL_ARGUMENTS_OFFSET)); + __Pyx_XDECREF(__pyx_t_6); __pyx_t_6 = 0; + __Pyx_DECREF(__pyx_t_7); __pyx_t_7 = 0; + if (unlikely(!__pyx_t_5)) __PYX_ERR(0, 25, __pyx_L1_error) + __Pyx_GOTREF(__pyx_t_5); + } + if (unlikely(__Pyx_ListComp_Append(__pyx_t_1, (PyObject*)__pyx_t_5))) __PYX_ERR(0, 25, __pyx_L1_error) + __Pyx_DECREF(__pyx_t_5); __pyx_t_5 = 0; + } + __pyx_r = __pyx_t_1; + __pyx_t_1 = 0; + goto __pyx_L0; + + /* "spacy/pipeline/_parser_internals/stateclass.pyx":23 + * del self.c + * + * @property # <<<<<<<<<<<<<< + * def stack(self): + * return [self.S(i) for i in range(self.c.stack_depth())] +*/ + + /* function exit code */ + __pyx_L1_error:; + __Pyx_XDECREF(__pyx_t_1); + __Pyx_XDECREF(__pyx_t_5); + __Pyx_XDECREF(__pyx_t_6); + __Pyx_XDECREF(__pyx_t_7); + __Pyx_AddTraceback("spacy.pipeline._parser_internals.stateclass.StateClass.stack.__get__", __pyx_clineno, __pyx_lineno, __pyx_filename); + __pyx_r = NULL; + __pyx_L0:; + __Pyx_XGIVEREF(__pyx_r); + __Pyx_RefNannyFinishContext(); + return __pyx_r; +} + +/* "spacy/pipeline/_parser_internals/stateclass.pyx":27 + * return [self.S(i) for i in range(self.c.stack_depth())] + * + * @property # <<<<<<<<<<<<<< + * def queue(self): + * return [self.B(i) for i in range(self.c.buffer_length())] +*/ + +/* Python wrapper */ +static PyObject *__pyx_pw_5spacy_8pipeline_17_parser_internals_10stateclass_10StateClass_5queue_1__get__(PyObject *__pyx_v_self); /*proto*/ +static PyObject *__pyx_pw_5spacy_8pipeline_17_parser_internals_10stateclass_10StateClass_5queue_1__get__(PyObject *__pyx_v_self) { + CYTHON_UNUSED PyObject *const *__pyx_kwvalues; + PyObject *__pyx_r = 0; + __Pyx_RefNannyDeclarations + __Pyx_RefNannySetupContext("__get__ (wrapper)", 0); + __pyx_kwvalues = __Pyx_KwValues_VARARGS(__pyx_args, __pyx_nargs); + __pyx_r = __pyx_pf_5spacy_8pipeline_17_parser_internals_10stateclass_10StateClass_5queue___get__(((struct __pyx_obj_5spacy_8pipeline_17_parser_internals_10stateclass_StateClass *)__pyx_v_self)); + + /* function exit code */ + __Pyx_RefNannyFinishContext(); + return __pyx_r; +} + +static PyObject *__pyx_pf_5spacy_8pipeline_17_parser_internals_10stateclass_10StateClass_5queue___get__(struct __pyx_obj_5spacy_8pipeline_17_parser_internals_10stateclass_StateClass *__pyx_v_self) { + int __pyx_v_i; + PyObject *__pyx_r = NULL; + __Pyx_RefNannyDeclarations + PyObject *__pyx_t_1 = NULL; + int __pyx_t_2; + int __pyx_t_3; + int __pyx_t_4; + PyObject *__pyx_t_5 = NULL; + PyObject *__pyx_t_6 = NULL; + 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("__get__", 0); + + /* "spacy/pipeline/_parser_internals/stateclass.pyx":29 + * @property + * def queue(self): + * return [self.B(i) for i in range(self.c.buffer_length())] # <<<<<<<<<<<<<< + * + * @property +*/ + __Pyx_XDECREF(__pyx_r); + __pyx_t_1 = PyList_New(0); if (unlikely(!__pyx_t_1)) __PYX_ERR(0, 29, __pyx_L1_error) + __Pyx_GOTREF(__pyx_t_1); + __pyx_t_2 = __pyx_v_self->c->buffer_length(); + __pyx_t_3 = __pyx_t_2; + for (__pyx_t_4 = 0; __pyx_t_4 < __pyx_t_3; __pyx_t_4+=1) { + __pyx_v_i = __pyx_t_4; + __pyx_t_6 = ((PyObject *)__pyx_v_self); + __Pyx_INCREF(__pyx_t_6); + __pyx_t_7 = __Pyx_PyLong_From_int(__pyx_v_i); if (unlikely(!__pyx_t_7)) __PYX_ERR(0, 29, __pyx_L1_error) + __Pyx_GOTREF(__pyx_t_7); + __pyx_t_8 = 0; + { + PyObject *__pyx_callargs[2] = {__pyx_t_6, __pyx_t_7}; + __pyx_t_5 = __Pyx_PyObject_FastCallMethod((PyObject*)__pyx_mstate_global->__pyx_n_u_B, __pyx_callargs+__pyx_t_8, (2-__pyx_t_8) | (1*__Pyx_PY_VECTORCALL_ARGUMENTS_OFFSET)); + __Pyx_XDECREF(__pyx_t_6); __pyx_t_6 = 0; + __Pyx_DECREF(__pyx_t_7); __pyx_t_7 = 0; + if (unlikely(!__pyx_t_5)) __PYX_ERR(0, 29, __pyx_L1_error) + __Pyx_GOTREF(__pyx_t_5); + } + if (unlikely(__Pyx_ListComp_Append(__pyx_t_1, (PyObject*)__pyx_t_5))) __PYX_ERR(0, 29, __pyx_L1_error) + __Pyx_DECREF(__pyx_t_5); __pyx_t_5 = 0; + } + __pyx_r = __pyx_t_1; + __pyx_t_1 = 0; + goto __pyx_L0; + + /* "spacy/pipeline/_parser_internals/stateclass.pyx":27 + * return [self.S(i) for i in range(self.c.stack_depth())] + * + * @property # <<<<<<<<<<<<<< + * def queue(self): + * return [self.B(i) for i in range(self.c.buffer_length())] +*/ + + /* function exit code */ + __pyx_L1_error:; + __Pyx_XDECREF(__pyx_t_1); + __Pyx_XDECREF(__pyx_t_5); + __Pyx_XDECREF(__pyx_t_6); + __Pyx_XDECREF(__pyx_t_7); + __Pyx_AddTraceback("spacy.pipeline._parser_internals.stateclass.StateClass.queue.__get__", __pyx_clineno, __pyx_lineno, __pyx_filename); + __pyx_r = NULL; + __pyx_L0:; + __Pyx_XGIVEREF(__pyx_r); + __Pyx_RefNannyFinishContext(); + return __pyx_r; +} + +/* "spacy/pipeline/_parser_internals/stateclass.pyx":31 + * return [self.B(i) for i in range(self.c.buffer_length())] + * + * @property # <<<<<<<<<<<<<< + * def token_vector_length(self): + * return self.doc.tensor.shape[1] +*/ + +/* Python wrapper */ +static PyObject *__pyx_pw_5spacy_8pipeline_17_parser_internals_10stateclass_10StateClass_19token_vector_length_1__get__(PyObject *__pyx_v_self); /*proto*/ +static PyObject *__pyx_pw_5spacy_8pipeline_17_parser_internals_10stateclass_10StateClass_19token_vector_length_1__get__(PyObject *__pyx_v_self) { + CYTHON_UNUSED PyObject *const *__pyx_kwvalues; + PyObject *__pyx_r = 0; + __Pyx_RefNannyDeclarations + __Pyx_RefNannySetupContext("__get__ (wrapper)", 0); + __pyx_kwvalues = __Pyx_KwValues_VARARGS(__pyx_args, __pyx_nargs); + __pyx_r = __pyx_pf_5spacy_8pipeline_17_parser_internals_10stateclass_10StateClass_19token_vector_length___get__(((struct __pyx_obj_5spacy_8pipeline_17_parser_internals_10stateclass_StateClass *)__pyx_v_self)); + + /* function exit code */ + __Pyx_RefNannyFinishContext(); + return __pyx_r; +} + +static PyObject *__pyx_pf_5spacy_8pipeline_17_parser_internals_10stateclass_10StateClass_19token_vector_length___get__(struct __pyx_obj_5spacy_8pipeline_17_parser_internals_10stateclass_StateClass *__pyx_v_self) { + PyObject *__pyx_r = NULL; + __Pyx_RefNannyDeclarations + PyObject *__pyx_t_1 = NULL; + PyObject *__pyx_t_2 = NULL; + int __pyx_lineno = 0; + const char *__pyx_filename = NULL; + int __pyx_clineno = 0; + __Pyx_RefNannySetupContext("__get__", 0); + + /* "spacy/pipeline/_parser_internals/stateclass.pyx":33 + * @property + * def token_vector_length(self): + * return self.doc.tensor.shape[1] # <<<<<<<<<<<<<< + * + * @property +*/ + __Pyx_XDECREF(__pyx_r); + __pyx_t_1 = __Pyx_PyObject_GetAttrStr(__pyx_v_self->doc->tensor, __pyx_mstate_global->__pyx_n_u_shape); if (unlikely(!__pyx_t_1)) __PYX_ERR(0, 33, __pyx_L1_error) + __Pyx_GOTREF(__pyx_t_1); + __pyx_t_2 = __Pyx_GetItemInt(__pyx_t_1, 1, long, 1, __Pyx_PyLong_From_long, 0, 0, 1, 1, __Pyx_ReferenceSharing_OwnStrongReference); if (unlikely(!__pyx_t_2)) __PYX_ERR(0, 33, __pyx_L1_error) + __Pyx_GOTREF(__pyx_t_2); + __Pyx_DECREF(__pyx_t_1); __pyx_t_1 = 0; + __pyx_r = __pyx_t_2; + __pyx_t_2 = 0; + goto __pyx_L0; + + /* "spacy/pipeline/_parser_internals/stateclass.pyx":31 + * return [self.B(i) for i in range(self.c.buffer_length())] + * + * @property # <<<<<<<<<<<<<< + * def token_vector_length(self): + * return self.doc.tensor.shape[1] +*/ + + /* function exit code */ + __pyx_L1_error:; + __Pyx_XDECREF(__pyx_t_1); + __Pyx_XDECREF(__pyx_t_2); + __Pyx_AddTraceback("spacy.pipeline._parser_internals.stateclass.StateClass.token_vector_length.__get__", __pyx_clineno, __pyx_lineno, __pyx_filename); + __pyx_r = NULL; + __pyx_L0:; + __Pyx_XGIVEREF(__pyx_r); + __Pyx_RefNannyFinishContext(); + return __pyx_r; +} + +/* "spacy/pipeline/_parser_internals/stateclass.pyx":35 + * return self.doc.tensor.shape[1] + * + * @property # <<<<<<<<<<<<<< + * def arcs(self): + * cdef vector[ArcC] arcs +*/ + +/* Python wrapper */ +static PyObject *__pyx_pw_5spacy_8pipeline_17_parser_internals_10stateclass_10StateClass_4arcs_1__get__(PyObject *__pyx_v_self); /*proto*/ +static PyObject *__pyx_pw_5spacy_8pipeline_17_parser_internals_10stateclass_10StateClass_4arcs_1__get__(PyObject *__pyx_v_self) { + CYTHON_UNUSED PyObject *const *__pyx_kwvalues; + PyObject *__pyx_r = 0; + __Pyx_RefNannyDeclarations + __Pyx_RefNannySetupContext("__get__ (wrapper)", 0); + __pyx_kwvalues = __Pyx_KwValues_VARARGS(__pyx_args, __pyx_nargs); + __pyx_r = __pyx_pf_5spacy_8pipeline_17_parser_internals_10stateclass_10StateClass_4arcs___get__(((struct __pyx_obj_5spacy_8pipeline_17_parser_internals_10stateclass_StateClass *)__pyx_v_self)); + + /* function exit code */ + __Pyx_RefNannyFinishContext(); + return __pyx_r; +} + +static PyObject *__pyx_pf_5spacy_8pipeline_17_parser_internals_10stateclass_10StateClass_4arcs___get__(struct __pyx_obj_5spacy_8pipeline_17_parser_internals_10stateclass_StateClass *__pyx_v_self) { + std::vector __pyx_v_arcs; + PyObject *__pyx_r = NULL; + __Pyx_RefNannyDeclarations + PyObject *__pyx_t_1 = NULL; + PyObject *__pyx_t_2 = NULL; + int __pyx_lineno = 0; + const char *__pyx_filename = NULL; + int __pyx_clineno = 0; + __Pyx_RefNannySetupContext("__get__", 0); + + /* "spacy/pipeline/_parser_internals/stateclass.pyx":38 + * def arcs(self): + * cdef vector[ArcC] arcs + * self.c.get_arcs(&arcs) # <<<<<<<<<<<<<< + * return list(arcs) + * # py_arcs = [] +*/ + __pyx_v_self->c->get_arcs((&__pyx_v_arcs)); + + /* "spacy/pipeline/_parser_internals/stateclass.pyx":39 + * cdef vector[ArcC] arcs + * self.c.get_arcs(&arcs) + * return list(arcs) # <<<<<<<<<<<<<< + * # py_arcs = [] + * # for arc in arcs: +*/ + __Pyx_XDECREF(__pyx_r); + __pyx_t_1 = __pyx_convert_vector_to_py_struct____pyx_t_5spacy_8pipeline_17_parser_internals_6_state_ArcC(__pyx_v_arcs); if (unlikely(!__pyx_t_1)) __PYX_ERR(0, 39, __pyx_L1_error) + __Pyx_GOTREF(__pyx_t_1); + __pyx_t_2 = __Pyx_PySequence_ListKeepNew(__pyx_t_1); if (unlikely(!__pyx_t_2)) __PYX_ERR(0, 39, __pyx_L1_error) + __Pyx_GOTREF(__pyx_t_2); + __Pyx_DECREF(__pyx_t_1); __pyx_t_1 = 0; + __pyx_r = __pyx_t_2; + __pyx_t_2 = 0; + goto __pyx_L0; + + /* "spacy/pipeline/_parser_internals/stateclass.pyx":35 + * return self.doc.tensor.shape[1] + * + * @property # <<<<<<<<<<<<<< + * def arcs(self): + * cdef vector[ArcC] arcs +*/ + + /* function exit code */ + __pyx_L1_error:; + __Pyx_XDECREF(__pyx_t_1); + __Pyx_XDECREF(__pyx_t_2); + __Pyx_AddTraceback("spacy.pipeline._parser_internals.stateclass.StateClass.arcs.__get__", __pyx_clineno, __pyx_lineno, __pyx_filename); + __pyx_r = NULL; + __pyx_L0:; + __Pyx_XGIVEREF(__pyx_r); + __Pyx_RefNannyFinishContext(); + return __pyx_r; +} + +/* "spacy/pipeline/_parser_internals/stateclass.pyx":46 + * # return arcs + * + * def add_arc(self, int head, int child, int label): # <<<<<<<<<<<<<< + * self.c.add_arc(head, child, label) + * +*/ + +/* Python wrapper */ +static PyObject *__pyx_pw_5spacy_8pipeline_17_parser_internals_10stateclass_10StateClass_5add_arc(PyObject *__pyx_v_self, +#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_5spacy_8pipeline_17_parser_internals_10stateclass_10StateClass_4add_arc, "StateClass.add_arc(self, int head, int child, int label)"); +static PyMethodDef __pyx_mdef_5spacy_8pipeline_17_parser_internals_10stateclass_10StateClass_5add_arc = {"add_arc", (PyCFunction)(void(*)(void))(__Pyx_PyCFunction_FastCallWithKeywords)__pyx_pw_5spacy_8pipeline_17_parser_internals_10stateclass_10StateClass_5add_arc, __Pyx_METH_FASTCALL|METH_KEYWORDS, __pyx_doc_5spacy_8pipeline_17_parser_internals_10stateclass_10StateClass_4add_arc}; +static PyObject *__pyx_pw_5spacy_8pipeline_17_parser_internals_10stateclass_10StateClass_5add_arc(PyObject *__pyx_v_self, +#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_head; + int __pyx_v_child; + int __pyx_v_label; + #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("add_arc (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_head,&__pyx_mstate_global->__pyx_n_u_child,&__pyx_mstate_global->__pyx_n_u_label,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, 46, __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, 46, __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, 46, __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, 46, __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, "add_arc", 0) < (0)) __PYX_ERR(0, 46, __pyx_L3_error) + for (Py_ssize_t i = __pyx_nargs; i < 3; i++) { + if (unlikely(!values[i])) { __Pyx_RaiseArgtupleInvalid("add_arc", 1, 3, 3, i); __PYX_ERR(0, 46, __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, 46, __pyx_L3_error) + values[1] = __Pyx_ArgRef_FASTCALL(__pyx_args, 1); + if (!CYTHON_ASSUME_SAFE_MACROS && unlikely(!values[1])) __PYX_ERR(0, 46, __pyx_L3_error) + values[2] = __Pyx_ArgRef_FASTCALL(__pyx_args, 2); + if (!CYTHON_ASSUME_SAFE_MACROS && unlikely(!values[2])) __PYX_ERR(0, 46, __pyx_L3_error) + } + __pyx_v_head = __Pyx_PyLong_As_int(values[0]); if (unlikely((__pyx_v_head == (int)-1) && PyErr_Occurred())) __PYX_ERR(0, 46, __pyx_L3_error) + __pyx_v_child = __Pyx_PyLong_As_int(values[1]); if (unlikely((__pyx_v_child == (int)-1) && PyErr_Occurred())) __PYX_ERR(0, 46, __pyx_L3_error) + __pyx_v_label = __Pyx_PyLong_As_int(values[2]); if (unlikely((__pyx_v_label == (int)-1) && PyErr_Occurred())) __PYX_ERR(0, 46, __pyx_L3_error) + } + goto __pyx_L6_skip; + __pyx_L5_argtuple_error:; + __Pyx_RaiseArgtupleInvalid("add_arc", 1, 3, 3, __pyx_nargs); __PYX_ERR(0, 46, __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("spacy.pipeline._parser_internals.stateclass.StateClass.add_arc", __pyx_clineno, __pyx_lineno, __pyx_filename); + __Pyx_RefNannyFinishContext(); + return NULL; + __pyx_L4_argument_unpacking_done:; + __pyx_r = __pyx_pf_5spacy_8pipeline_17_parser_internals_10stateclass_10StateClass_4add_arc(((struct __pyx_obj_5spacy_8pipeline_17_parser_internals_10stateclass_StateClass *)__pyx_v_self), __pyx_v_head, __pyx_v_child, __pyx_v_label); + + /* 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_5spacy_8pipeline_17_parser_internals_10stateclass_10StateClass_4add_arc(struct __pyx_obj_5spacy_8pipeline_17_parser_internals_10stateclass_StateClass *__pyx_v_self, int __pyx_v_head, int __pyx_v_child, int __pyx_v_label) { + PyObject *__pyx_r = NULL; + __Pyx_RefNannyDeclarations + __Pyx_RefNannySetupContext("add_arc", 0); + + /* "spacy/pipeline/_parser_internals/stateclass.pyx":47 + * + * def add_arc(self, int head, int child, int label): + * self.c.add_arc(head, child, label) # <<<<<<<<<<<<<< + * + * def del_arc(self, int head, int child): +*/ + __pyx_v_self->c->add_arc(__pyx_v_head, __pyx_v_child, __pyx_v_label); + + /* "spacy/pipeline/_parser_internals/stateclass.pyx":46 + * # return arcs + * + * def add_arc(self, int head, int child, int label): # <<<<<<<<<<<<<< + * self.c.add_arc(head, child, label) + * +*/ + + /* function exit code */ + __pyx_r = Py_None; __Pyx_INCREF(Py_None); + __Pyx_XGIVEREF(__pyx_r); + __Pyx_RefNannyFinishContext(); + return __pyx_r; +} + +/* "spacy/pipeline/_parser_internals/stateclass.pyx":49 + * self.c.add_arc(head, child, label) + * + * def del_arc(self, int head, int child): # <<<<<<<<<<<<<< + * self.c.del_arc(head, child) + * +*/ + +/* Python wrapper */ +static PyObject *__pyx_pw_5spacy_8pipeline_17_parser_internals_10stateclass_10StateClass_7del_arc(PyObject *__pyx_v_self, +#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_5spacy_8pipeline_17_parser_internals_10stateclass_10StateClass_6del_arc, "StateClass.del_arc(self, int head, int child)"); +static PyMethodDef __pyx_mdef_5spacy_8pipeline_17_parser_internals_10stateclass_10StateClass_7del_arc = {"del_arc", (PyCFunction)(void(*)(void))(__Pyx_PyCFunction_FastCallWithKeywords)__pyx_pw_5spacy_8pipeline_17_parser_internals_10stateclass_10StateClass_7del_arc, __Pyx_METH_FASTCALL|METH_KEYWORDS, __pyx_doc_5spacy_8pipeline_17_parser_internals_10stateclass_10StateClass_6del_arc}; +static PyObject *__pyx_pw_5spacy_8pipeline_17_parser_internals_10stateclass_10StateClass_7del_arc(PyObject *__pyx_v_self, +#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_head; + int __pyx_v_child; + #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("del_arc (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_head,&__pyx_mstate_global->__pyx_n_u_child,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, 49, __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, 49, __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, 49, __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, "del_arc", 0) < (0)) __PYX_ERR(0, 49, __pyx_L3_error) + for (Py_ssize_t i = __pyx_nargs; i < 2; i++) { + if (unlikely(!values[i])) { __Pyx_RaiseArgtupleInvalid("del_arc", 1, 2, 2, i); __PYX_ERR(0, 49, __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, 49, __pyx_L3_error) + values[1] = __Pyx_ArgRef_FASTCALL(__pyx_args, 1); + if (!CYTHON_ASSUME_SAFE_MACROS && unlikely(!values[1])) __PYX_ERR(0, 49, __pyx_L3_error) + } + __pyx_v_head = __Pyx_PyLong_As_int(values[0]); if (unlikely((__pyx_v_head == (int)-1) && PyErr_Occurred())) __PYX_ERR(0, 49, __pyx_L3_error) + __pyx_v_child = __Pyx_PyLong_As_int(values[1]); if (unlikely((__pyx_v_child == (int)-1) && PyErr_Occurred())) __PYX_ERR(0, 49, __pyx_L3_error) + } + goto __pyx_L6_skip; + __pyx_L5_argtuple_error:; + __Pyx_RaiseArgtupleInvalid("del_arc", 1, 2, 2, __pyx_nargs); __PYX_ERR(0, 49, __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("spacy.pipeline._parser_internals.stateclass.StateClass.del_arc", __pyx_clineno, __pyx_lineno, __pyx_filename); + __Pyx_RefNannyFinishContext(); + return NULL; + __pyx_L4_argument_unpacking_done:; + __pyx_r = __pyx_pf_5spacy_8pipeline_17_parser_internals_10stateclass_10StateClass_6del_arc(((struct __pyx_obj_5spacy_8pipeline_17_parser_internals_10stateclass_StateClass *)__pyx_v_self), __pyx_v_head, __pyx_v_child); + + /* 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_5spacy_8pipeline_17_parser_internals_10stateclass_10StateClass_6del_arc(struct __pyx_obj_5spacy_8pipeline_17_parser_internals_10stateclass_StateClass *__pyx_v_self, int __pyx_v_head, int __pyx_v_child) { + PyObject *__pyx_r = NULL; + __Pyx_RefNannyDeclarations + __Pyx_RefNannySetupContext("del_arc", 0); + + /* "spacy/pipeline/_parser_internals/stateclass.pyx":50 + * + * def del_arc(self, int head, int child): + * self.c.del_arc(head, child) # <<<<<<<<<<<<<< + * + * def H(self, int child): +*/ + __pyx_v_self->c->del_arc(__pyx_v_head, __pyx_v_child); + + /* "spacy/pipeline/_parser_internals/stateclass.pyx":49 + * self.c.add_arc(head, child, label) + * + * def del_arc(self, int head, int child): # <<<<<<<<<<<<<< + * self.c.del_arc(head, child) + * +*/ + + /* function exit code */ + __pyx_r = Py_None; __Pyx_INCREF(Py_None); + __Pyx_XGIVEREF(__pyx_r); + __Pyx_RefNannyFinishContext(); + return __pyx_r; +} + +/* "spacy/pipeline/_parser_internals/stateclass.pyx":52 + * self.c.del_arc(head, child) + * + * def H(self, int child): # <<<<<<<<<<<<<< + * return self.c.H(child) + * +*/ + +/* Python wrapper */ +static PyObject *__pyx_pw_5spacy_8pipeline_17_parser_internals_10stateclass_10StateClass_9H(PyObject *__pyx_v_self, +#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_5spacy_8pipeline_17_parser_internals_10stateclass_10StateClass_8H, "StateClass.H(self, int child)"); +static PyMethodDef __pyx_mdef_5spacy_8pipeline_17_parser_internals_10stateclass_10StateClass_9H = {"H", (PyCFunction)(void(*)(void))(__Pyx_PyCFunction_FastCallWithKeywords)__pyx_pw_5spacy_8pipeline_17_parser_internals_10stateclass_10StateClass_9H, __Pyx_METH_FASTCALL|METH_KEYWORDS, __pyx_doc_5spacy_8pipeline_17_parser_internals_10stateclass_10StateClass_8H}; +static PyObject *__pyx_pw_5spacy_8pipeline_17_parser_internals_10stateclass_10StateClass_9H(PyObject *__pyx_v_self, +#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_child; + #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("H (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_child,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, 52, __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, 52, __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, "H", 0) < (0)) __PYX_ERR(0, 52, __pyx_L3_error) + for (Py_ssize_t i = __pyx_nargs; i < 1; i++) { + if (unlikely(!values[i])) { __Pyx_RaiseArgtupleInvalid("H", 1, 1, 1, i); __PYX_ERR(0, 52, __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, 52, __pyx_L3_error) + } + __pyx_v_child = __Pyx_PyLong_As_int(values[0]); if (unlikely((__pyx_v_child == (int)-1) && PyErr_Occurred())) __PYX_ERR(0, 52, __pyx_L3_error) + } + goto __pyx_L6_skip; + __pyx_L5_argtuple_error:; + __Pyx_RaiseArgtupleInvalid("H", 1, 1, 1, __pyx_nargs); __PYX_ERR(0, 52, __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("spacy.pipeline._parser_internals.stateclass.StateClass.H", __pyx_clineno, __pyx_lineno, __pyx_filename); + __Pyx_RefNannyFinishContext(); + return NULL; + __pyx_L4_argument_unpacking_done:; + __pyx_r = __pyx_pf_5spacy_8pipeline_17_parser_internals_10stateclass_10StateClass_8H(((struct __pyx_obj_5spacy_8pipeline_17_parser_internals_10stateclass_StateClass *)__pyx_v_self), __pyx_v_child); + + /* 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_5spacy_8pipeline_17_parser_internals_10stateclass_10StateClass_8H(struct __pyx_obj_5spacy_8pipeline_17_parser_internals_10stateclass_StateClass *__pyx_v_self, int __pyx_v_child) { + 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("H", 0); + + /* "spacy/pipeline/_parser_internals/stateclass.pyx":53 + * + * def H(self, int child): + * return self.c.H(child) # <<<<<<<<<<<<<< + * + * def L(self, int head, int idx): +*/ + __Pyx_XDECREF(__pyx_r); + __pyx_t_1 = __Pyx_PyLong_From_int(__pyx_v_self->c->H(__pyx_v_child)); if (unlikely(!__pyx_t_1)) __PYX_ERR(0, 53, __pyx_L1_error) + __Pyx_GOTREF(__pyx_t_1); + __pyx_r = __pyx_t_1; + __pyx_t_1 = 0; + goto __pyx_L0; + + /* "spacy/pipeline/_parser_internals/stateclass.pyx":52 + * self.c.del_arc(head, child) + * + * def H(self, int child): # <<<<<<<<<<<<<< + * return self.c.H(child) + * +*/ + + /* function exit code */ + __pyx_L1_error:; + __Pyx_XDECREF(__pyx_t_1); + __Pyx_AddTraceback("spacy.pipeline._parser_internals.stateclass.StateClass.H", __pyx_clineno, __pyx_lineno, __pyx_filename); + __pyx_r = NULL; + __pyx_L0:; + __Pyx_XGIVEREF(__pyx_r); + __Pyx_RefNannyFinishContext(); + return __pyx_r; +} + +/* "spacy/pipeline/_parser_internals/stateclass.pyx":55 + * return self.c.H(child) + * + * def L(self, int head, int idx): # <<<<<<<<<<<<<< + * return self.c.L(head, idx) + * +*/ + +/* Python wrapper */ +static PyObject *__pyx_pw_5spacy_8pipeline_17_parser_internals_10stateclass_10StateClass_11L(PyObject *__pyx_v_self, +#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_5spacy_8pipeline_17_parser_internals_10stateclass_10StateClass_10L, "StateClass.L(self, int head, int idx)"); +static PyMethodDef __pyx_mdef_5spacy_8pipeline_17_parser_internals_10stateclass_10StateClass_11L = {"L", (PyCFunction)(void(*)(void))(__Pyx_PyCFunction_FastCallWithKeywords)__pyx_pw_5spacy_8pipeline_17_parser_internals_10stateclass_10StateClass_11L, __Pyx_METH_FASTCALL|METH_KEYWORDS, __pyx_doc_5spacy_8pipeline_17_parser_internals_10stateclass_10StateClass_10L}; +static PyObject *__pyx_pw_5spacy_8pipeline_17_parser_internals_10stateclass_10StateClass_11L(PyObject *__pyx_v_self, +#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_head; + int __pyx_v_idx; + #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("L (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_head,&__pyx_mstate_global->__pyx_n_u_idx,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, 55, __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, 55, __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, 55, __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, "L", 0) < (0)) __PYX_ERR(0, 55, __pyx_L3_error) + for (Py_ssize_t i = __pyx_nargs; i < 2; i++) { + if (unlikely(!values[i])) { __Pyx_RaiseArgtupleInvalid("L", 1, 2, 2, i); __PYX_ERR(0, 55, __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, 55, __pyx_L3_error) + values[1] = __Pyx_ArgRef_FASTCALL(__pyx_args, 1); + if (!CYTHON_ASSUME_SAFE_MACROS && unlikely(!values[1])) __PYX_ERR(0, 55, __pyx_L3_error) + } + __pyx_v_head = __Pyx_PyLong_As_int(values[0]); if (unlikely((__pyx_v_head == (int)-1) && PyErr_Occurred())) __PYX_ERR(0, 55, __pyx_L3_error) + __pyx_v_idx = __Pyx_PyLong_As_int(values[1]); if (unlikely((__pyx_v_idx == (int)-1) && PyErr_Occurred())) __PYX_ERR(0, 55, __pyx_L3_error) + } + goto __pyx_L6_skip; + __pyx_L5_argtuple_error:; + __Pyx_RaiseArgtupleInvalid("L", 1, 2, 2, __pyx_nargs); __PYX_ERR(0, 55, __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("spacy.pipeline._parser_internals.stateclass.StateClass.L", __pyx_clineno, __pyx_lineno, __pyx_filename); + __Pyx_RefNannyFinishContext(); + return NULL; + __pyx_L4_argument_unpacking_done:; + __pyx_r = __pyx_pf_5spacy_8pipeline_17_parser_internals_10stateclass_10StateClass_10L(((struct __pyx_obj_5spacy_8pipeline_17_parser_internals_10stateclass_StateClass *)__pyx_v_self), __pyx_v_head, __pyx_v_idx); + + /* 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_5spacy_8pipeline_17_parser_internals_10stateclass_10StateClass_10L(struct __pyx_obj_5spacy_8pipeline_17_parser_internals_10stateclass_StateClass *__pyx_v_self, int __pyx_v_head, int __pyx_v_idx) { + 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("L", 0); + + /* "spacy/pipeline/_parser_internals/stateclass.pyx":56 + * + * def L(self, int head, int idx): + * return self.c.L(head, idx) # <<<<<<<<<<<<<< + * + * def R(self, int head, int idx): +*/ + __Pyx_XDECREF(__pyx_r); + __pyx_t_1 = __Pyx_PyLong_From_int(__pyx_v_self->c->L(__pyx_v_head, __pyx_v_idx)); if (unlikely(!__pyx_t_1)) __PYX_ERR(0, 56, __pyx_L1_error) + __Pyx_GOTREF(__pyx_t_1); + __pyx_r = __pyx_t_1; + __pyx_t_1 = 0; + goto __pyx_L0; + + /* "spacy/pipeline/_parser_internals/stateclass.pyx":55 + * return self.c.H(child) + * + * def L(self, int head, int idx): # <<<<<<<<<<<<<< + * return self.c.L(head, idx) + * +*/ + + /* function exit code */ + __pyx_L1_error:; + __Pyx_XDECREF(__pyx_t_1); + __Pyx_AddTraceback("spacy.pipeline._parser_internals.stateclass.StateClass.L", __pyx_clineno, __pyx_lineno, __pyx_filename); + __pyx_r = NULL; + __pyx_L0:; + __Pyx_XGIVEREF(__pyx_r); + __Pyx_RefNannyFinishContext(); + return __pyx_r; +} + +/* "spacy/pipeline/_parser_internals/stateclass.pyx":58 + * return self.c.L(head, idx) + * + * def R(self, int head, int idx): # <<<<<<<<<<<<<< + * return self.c.R(head, idx) + * +*/ + +/* Python wrapper */ +static PyObject *__pyx_pw_5spacy_8pipeline_17_parser_internals_10stateclass_10StateClass_13R(PyObject *__pyx_v_self, +#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_5spacy_8pipeline_17_parser_internals_10stateclass_10StateClass_12R, "StateClass.R(self, int head, int idx)"); +static PyMethodDef __pyx_mdef_5spacy_8pipeline_17_parser_internals_10stateclass_10StateClass_13R = {"R", (PyCFunction)(void(*)(void))(__Pyx_PyCFunction_FastCallWithKeywords)__pyx_pw_5spacy_8pipeline_17_parser_internals_10stateclass_10StateClass_13R, __Pyx_METH_FASTCALL|METH_KEYWORDS, __pyx_doc_5spacy_8pipeline_17_parser_internals_10stateclass_10StateClass_12R}; +static PyObject *__pyx_pw_5spacy_8pipeline_17_parser_internals_10stateclass_10StateClass_13R(PyObject *__pyx_v_self, +#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_head; + int __pyx_v_idx; + #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("R (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_head,&__pyx_mstate_global->__pyx_n_u_idx,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, 58, __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, 58, __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, 58, __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, "R", 0) < (0)) __PYX_ERR(0, 58, __pyx_L3_error) + for (Py_ssize_t i = __pyx_nargs; i < 2; i++) { + if (unlikely(!values[i])) { __Pyx_RaiseArgtupleInvalid("R", 1, 2, 2, i); __PYX_ERR(0, 58, __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, 58, __pyx_L3_error) + values[1] = __Pyx_ArgRef_FASTCALL(__pyx_args, 1); + if (!CYTHON_ASSUME_SAFE_MACROS && unlikely(!values[1])) __PYX_ERR(0, 58, __pyx_L3_error) + } + __pyx_v_head = __Pyx_PyLong_As_int(values[0]); if (unlikely((__pyx_v_head == (int)-1) && PyErr_Occurred())) __PYX_ERR(0, 58, __pyx_L3_error) + __pyx_v_idx = __Pyx_PyLong_As_int(values[1]); if (unlikely((__pyx_v_idx == (int)-1) && PyErr_Occurred())) __PYX_ERR(0, 58, __pyx_L3_error) + } + goto __pyx_L6_skip; + __pyx_L5_argtuple_error:; + __Pyx_RaiseArgtupleInvalid("R", 1, 2, 2, __pyx_nargs); __PYX_ERR(0, 58, __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("spacy.pipeline._parser_internals.stateclass.StateClass.R", __pyx_clineno, __pyx_lineno, __pyx_filename); + __Pyx_RefNannyFinishContext(); + return NULL; + __pyx_L4_argument_unpacking_done:; + __pyx_r = __pyx_pf_5spacy_8pipeline_17_parser_internals_10stateclass_10StateClass_12R(((struct __pyx_obj_5spacy_8pipeline_17_parser_internals_10stateclass_StateClass *)__pyx_v_self), __pyx_v_head, __pyx_v_idx); + + /* 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_5spacy_8pipeline_17_parser_internals_10stateclass_10StateClass_12R(struct __pyx_obj_5spacy_8pipeline_17_parser_internals_10stateclass_StateClass *__pyx_v_self, int __pyx_v_head, int __pyx_v_idx) { + 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("R", 0); + + /* "spacy/pipeline/_parser_internals/stateclass.pyx":59 + * + * def R(self, int head, int idx): + * return self.c.R(head, idx) # <<<<<<<<<<<<<< + * + * @property +*/ + __Pyx_XDECREF(__pyx_r); + __pyx_t_1 = __Pyx_PyLong_From_int(__pyx_v_self->c->R(__pyx_v_head, __pyx_v_idx)); if (unlikely(!__pyx_t_1)) __PYX_ERR(0, 59, __pyx_L1_error) + __Pyx_GOTREF(__pyx_t_1); + __pyx_r = __pyx_t_1; + __pyx_t_1 = 0; + goto __pyx_L0; + + /* "spacy/pipeline/_parser_internals/stateclass.pyx":58 + * return self.c.L(head, idx) + * + * def R(self, int head, int idx): # <<<<<<<<<<<<<< + * return self.c.R(head, idx) + * +*/ + + /* function exit code */ + __pyx_L1_error:; + __Pyx_XDECREF(__pyx_t_1); + __Pyx_AddTraceback("spacy.pipeline._parser_internals.stateclass.StateClass.R", __pyx_clineno, __pyx_lineno, __pyx_filename); + __pyx_r = NULL; + __pyx_L0:; + __Pyx_XGIVEREF(__pyx_r); + __Pyx_RefNannyFinishContext(); + return __pyx_r; +} + +/* "spacy/pipeline/_parser_internals/stateclass.pyx":61 + * return self.c.R(head, idx) + * + * @property # <<<<<<<<<<<<<< + * def _b_i(self): + * return self.c._b_i +*/ + +/* Python wrapper */ +static PyObject *__pyx_pw_5spacy_8pipeline_17_parser_internals_10stateclass_10StateClass_4_b_i_1__get__(PyObject *__pyx_v_self); /*proto*/ +static PyObject *__pyx_pw_5spacy_8pipeline_17_parser_internals_10stateclass_10StateClass_4_b_i_1__get__(PyObject *__pyx_v_self) { + CYTHON_UNUSED PyObject *const *__pyx_kwvalues; + PyObject *__pyx_r = 0; + __Pyx_RefNannyDeclarations + __Pyx_RefNannySetupContext("__get__ (wrapper)", 0); + __pyx_kwvalues = __Pyx_KwValues_VARARGS(__pyx_args, __pyx_nargs); + __pyx_r = __pyx_pf_5spacy_8pipeline_17_parser_internals_10stateclass_10StateClass_4_b_i___get__(((struct __pyx_obj_5spacy_8pipeline_17_parser_internals_10stateclass_StateClass *)__pyx_v_self)); + + /* function exit code */ + __Pyx_RefNannyFinishContext(); + return __pyx_r; +} + +static PyObject *__pyx_pf_5spacy_8pipeline_17_parser_internals_10stateclass_10StateClass_4_b_i___get__(struct __pyx_obj_5spacy_8pipeline_17_parser_internals_10stateclass_StateClass *__pyx_v_self) { + PyObject *__pyx_r = NULL; + __Pyx_RefNannyDeclarations + PyObject *__pyx_t_1 = NULL; + int __pyx_lineno = 0; + const char *__pyx_filename = NULL; + int __pyx_clineno = 0; + __Pyx_RefNannySetupContext("__get__", 0); + + /* "spacy/pipeline/_parser_internals/stateclass.pyx":63 + * @property + * def _b_i(self): + * return self.c._b_i # <<<<<<<<<<<<<< + * + * @property +*/ + __Pyx_XDECREF(__pyx_r); + __pyx_t_1 = __Pyx_PyLong_From_int(__pyx_v_self->c->_b_i); if (unlikely(!__pyx_t_1)) __PYX_ERR(0, 63, __pyx_L1_error) + __Pyx_GOTREF(__pyx_t_1); + __pyx_r = __pyx_t_1; + __pyx_t_1 = 0; + goto __pyx_L0; + + /* "spacy/pipeline/_parser_internals/stateclass.pyx":61 + * return self.c.R(head, idx) + * + * @property # <<<<<<<<<<<<<< + * def _b_i(self): + * return self.c._b_i +*/ + + /* function exit code */ + __pyx_L1_error:; + __Pyx_XDECREF(__pyx_t_1); + __Pyx_AddTraceback("spacy.pipeline._parser_internals.stateclass.StateClass._b_i.__get__", __pyx_clineno, __pyx_lineno, __pyx_filename); + __pyx_r = NULL; + __pyx_L0:; + __Pyx_XGIVEREF(__pyx_r); + __Pyx_RefNannyFinishContext(); + return __pyx_r; +} + +/* "spacy/pipeline/_parser_internals/stateclass.pyx":65 + * return self.c._b_i + * + * @property # <<<<<<<<<<<<<< + * def length(self): + * return self.c.length +*/ + +/* Python wrapper */ +static PyObject *__pyx_pw_5spacy_8pipeline_17_parser_internals_10stateclass_10StateClass_6length_1__get__(PyObject *__pyx_v_self); /*proto*/ +static PyObject *__pyx_pw_5spacy_8pipeline_17_parser_internals_10stateclass_10StateClass_6length_1__get__(PyObject *__pyx_v_self) { + CYTHON_UNUSED PyObject *const *__pyx_kwvalues; + PyObject *__pyx_r = 0; + __Pyx_RefNannyDeclarations + __Pyx_RefNannySetupContext("__get__ (wrapper)", 0); + __pyx_kwvalues = __Pyx_KwValues_VARARGS(__pyx_args, __pyx_nargs); + __pyx_r = __pyx_pf_5spacy_8pipeline_17_parser_internals_10stateclass_10StateClass_6length___get__(((struct __pyx_obj_5spacy_8pipeline_17_parser_internals_10stateclass_StateClass *)__pyx_v_self)); + + /* function exit code */ + __Pyx_RefNannyFinishContext(); + return __pyx_r; +} + +static PyObject *__pyx_pf_5spacy_8pipeline_17_parser_internals_10stateclass_10StateClass_6length___get__(struct __pyx_obj_5spacy_8pipeline_17_parser_internals_10stateclass_StateClass *__pyx_v_self) { + PyObject *__pyx_r = NULL; + __Pyx_RefNannyDeclarations + PyObject *__pyx_t_1 = NULL; + int __pyx_lineno = 0; + const char *__pyx_filename = NULL; + int __pyx_clineno = 0; + __Pyx_RefNannySetupContext("__get__", 0); + + /* "spacy/pipeline/_parser_internals/stateclass.pyx":67 + * @property + * def length(self): + * return self.c.length # <<<<<<<<<<<<<< + * + * def is_final(self): +*/ + __Pyx_XDECREF(__pyx_r); + __pyx_t_1 = __Pyx_PyLong_From_int(__pyx_v_self->c->length); if (unlikely(!__pyx_t_1)) __PYX_ERR(0, 67, __pyx_L1_error) + __Pyx_GOTREF(__pyx_t_1); + __pyx_r = __pyx_t_1; + __pyx_t_1 = 0; + goto __pyx_L0; + + /* "spacy/pipeline/_parser_internals/stateclass.pyx":65 + * return self.c._b_i + * + * @property # <<<<<<<<<<<<<< + * def length(self): + * return self.c.length +*/ + + /* function exit code */ + __pyx_L1_error:; + __Pyx_XDECREF(__pyx_t_1); + __Pyx_AddTraceback("spacy.pipeline._parser_internals.stateclass.StateClass.length.__get__", __pyx_clineno, __pyx_lineno, __pyx_filename); + __pyx_r = NULL; + __pyx_L0:; + __Pyx_XGIVEREF(__pyx_r); + __Pyx_RefNannyFinishContext(); + return __pyx_r; +} + +/* "spacy/pipeline/_parser_internals/stateclass.pyx":69 + * return self.c.length + * + * def is_final(self): # <<<<<<<<<<<<<< + * return self.c.is_final() + * +*/ + +/* Python wrapper */ +static PyObject *__pyx_pw_5spacy_8pipeline_17_parser_internals_10stateclass_10StateClass_15is_final(PyObject *__pyx_v_self, +#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_5spacy_8pipeline_17_parser_internals_10stateclass_10StateClass_14is_final, "StateClass.is_final(self)"); +static PyMethodDef __pyx_mdef_5spacy_8pipeline_17_parser_internals_10stateclass_10StateClass_15is_final = {"is_final", (PyCFunction)(void(*)(void))(__Pyx_PyCFunction_FastCallWithKeywords)__pyx_pw_5spacy_8pipeline_17_parser_internals_10stateclass_10StateClass_15is_final, __Pyx_METH_FASTCALL|METH_KEYWORDS, __pyx_doc_5spacy_8pipeline_17_parser_internals_10stateclass_10StateClass_14is_final}; +static PyObject *__pyx_pw_5spacy_8pipeline_17_parser_internals_10stateclass_10StateClass_15is_final(PyObject *__pyx_v_self, +#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_final (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_final", 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_final", __pyx_kwds); return NULL;} + __pyx_r = __pyx_pf_5spacy_8pipeline_17_parser_internals_10stateclass_10StateClass_14is_final(((struct __pyx_obj_5spacy_8pipeline_17_parser_internals_10stateclass_StateClass *)__pyx_v_self)); + + /* function exit code */ + __Pyx_RefNannyFinishContext(); + return __pyx_r; +} + +static PyObject *__pyx_pf_5spacy_8pipeline_17_parser_internals_10stateclass_10StateClass_14is_final(struct __pyx_obj_5spacy_8pipeline_17_parser_internals_10stateclass_StateClass *__pyx_v_self) { + PyObject *__pyx_r = NULL; + __Pyx_RefNannyDeclarations + PyObject *__pyx_t_1 = NULL; + int __pyx_lineno = 0; + const char *__pyx_filename = NULL; + int __pyx_clineno = 0; + __Pyx_RefNannySetupContext("is_final", 0); + + /* "spacy/pipeline/_parser_internals/stateclass.pyx":70 + * + * def is_final(self): + * return self.c.is_final() # <<<<<<<<<<<<<< + * + * def copy(self): +*/ + __Pyx_XDECREF(__pyx_r); + __pyx_t_1 = __Pyx_PyBool_FromLong(__pyx_v_self->c->is_final()); if (unlikely(!__pyx_t_1)) __PYX_ERR(0, 70, __pyx_L1_error) + __Pyx_GOTREF(__pyx_t_1); + __pyx_r = __pyx_t_1; + __pyx_t_1 = 0; + goto __pyx_L0; + + /* "spacy/pipeline/_parser_internals/stateclass.pyx":69 + * return self.c.length + * + * def is_final(self): # <<<<<<<<<<<<<< + * return self.c.is_final() + * +*/ + + /* function exit code */ + __pyx_L1_error:; + __Pyx_XDECREF(__pyx_t_1); + __Pyx_AddTraceback("spacy.pipeline._parser_internals.stateclass.StateClass.is_final", __pyx_clineno, __pyx_lineno, __pyx_filename); + __pyx_r = NULL; + __pyx_L0:; + __Pyx_XGIVEREF(__pyx_r); + __Pyx_RefNannyFinishContext(); + return __pyx_r; +} + +/* "spacy/pipeline/_parser_internals/stateclass.pyx":72 + * return self.c.is_final() + * + * def copy(self): # <<<<<<<<<<<<<< + * cdef StateClass new_state = StateClass(doc=self.doc, offset=self.c.offset) + * new_state.c.clone(self.c) +*/ + +/* Python wrapper */ +static PyObject *__pyx_pw_5spacy_8pipeline_17_parser_internals_10stateclass_10StateClass_17copy(PyObject *__pyx_v_self, +#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_5spacy_8pipeline_17_parser_internals_10stateclass_10StateClass_16copy, "StateClass.copy(self)"); +static PyMethodDef __pyx_mdef_5spacy_8pipeline_17_parser_internals_10stateclass_10StateClass_17copy = {"copy", (PyCFunction)(void(*)(void))(__Pyx_PyCFunction_FastCallWithKeywords)__pyx_pw_5spacy_8pipeline_17_parser_internals_10stateclass_10StateClass_17copy, __Pyx_METH_FASTCALL|METH_KEYWORDS, __pyx_doc_5spacy_8pipeline_17_parser_internals_10stateclass_10StateClass_16copy}; +static PyObject *__pyx_pw_5spacy_8pipeline_17_parser_internals_10stateclass_10StateClass_17copy(PyObject *__pyx_v_self, +#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("copy (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("copy", 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("copy", __pyx_kwds); return NULL;} + __pyx_r = __pyx_pf_5spacy_8pipeline_17_parser_internals_10stateclass_10StateClass_16copy(((struct __pyx_obj_5spacy_8pipeline_17_parser_internals_10stateclass_StateClass *)__pyx_v_self)); + + /* function exit code */ + __Pyx_RefNannyFinishContext(); + return __pyx_r; +} + +static PyObject *__pyx_pf_5spacy_8pipeline_17_parser_internals_10stateclass_10StateClass_16copy(struct __pyx_obj_5spacy_8pipeline_17_parser_internals_10stateclass_StateClass *__pyx_v_self) { + struct __pyx_obj_5spacy_8pipeline_17_parser_internals_10stateclass_StateClass *__pyx_v_new_state = 0; + 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; + PyObject *__pyx_t_5 = NULL; + int __pyx_lineno = 0; + const char *__pyx_filename = NULL; + int __pyx_clineno = 0; + __Pyx_RefNannySetupContext("copy", 0); + + /* "spacy/pipeline/_parser_internals/stateclass.pyx":73 + * + * def copy(self): + * cdef StateClass new_state = StateClass(doc=self.doc, offset=self.c.offset) # <<<<<<<<<<<<<< + * new_state.c.clone(self.c) + * return new_state +*/ + __pyx_t_2 = NULL; + __pyx_t_3 = __Pyx_PyLong_From_int(__pyx_v_self->c->offset); if (unlikely(!__pyx_t_3)) __PYX_ERR(0, 73, __pyx_L1_error) + __Pyx_GOTREF(__pyx_t_3); + __pyx_t_4 = 1; + { + PyObject *__pyx_callargs[2 + ((CYTHON_VECTORCALL) ? 2 : 0)] = {__pyx_t_2, NULL}; + __pyx_t_5 = __Pyx_MakeVectorcallBuilderKwds(2); if (unlikely(!__pyx_t_5)) __PYX_ERR(0, 73, __pyx_L1_error) + __Pyx_GOTREF(__pyx_t_5); + if (__Pyx_VectorcallBuilder_AddArg(__pyx_mstate_global->__pyx_n_u_doc, ((PyObject *)__pyx_v_self->doc), __pyx_t_5, __pyx_callargs+1, 0) < (0)) __PYX_ERR(0, 73, __pyx_L1_error) + if (__Pyx_VectorcallBuilder_AddArg(__pyx_mstate_global->__pyx_n_u_offset, __pyx_t_3, __pyx_t_5, __pyx_callargs+1, 1) < (0)) __PYX_ERR(0, 73, __pyx_L1_error) + __pyx_t_1 = __Pyx_Object_Vectorcall_CallFromBuilder((PyObject*)__pyx_mstate_global->__pyx_ptype_5spacy_8pipeline_17_parser_internals_10stateclass_StateClass, __pyx_callargs+__pyx_t_4, (1-__pyx_t_4) | (__pyx_t_4*__Pyx_PY_VECTORCALL_ARGUMENTS_OFFSET), __pyx_t_5); + __Pyx_XDECREF(__pyx_t_2); __pyx_t_2 = 0; + __Pyx_DECREF(__pyx_t_3); __pyx_t_3 = 0; + __Pyx_DECREF(__pyx_t_5); __pyx_t_5 = 0; + if (unlikely(!__pyx_t_1)) __PYX_ERR(0, 73, __pyx_L1_error) + __Pyx_GOTREF((PyObject *)__pyx_t_1); + } + __pyx_v_new_state = ((struct __pyx_obj_5spacy_8pipeline_17_parser_internals_10stateclass_StateClass *)__pyx_t_1); + __pyx_t_1 = 0; + + /* "spacy/pipeline/_parser_internals/stateclass.pyx":74 + * def copy(self): + * cdef StateClass new_state = StateClass(doc=self.doc, offset=self.c.offset) + * new_state.c.clone(self.c) # <<<<<<<<<<<<<< + * return new_state + * +*/ + __pyx_v_new_state->c->clone(__pyx_v_self->c); + + /* "spacy/pipeline/_parser_internals/stateclass.pyx":75 + * cdef StateClass new_state = StateClass(doc=self.doc, offset=self.c.offset) + * new_state.c.clone(self.c) + * return new_state # <<<<<<<<<<<<<< + * + * def print_state(self): +*/ + __Pyx_XDECREF(__pyx_r); + __Pyx_INCREF((PyObject *)__pyx_v_new_state); + __pyx_r = ((PyObject *)__pyx_v_new_state); + goto __pyx_L0; + + /* "spacy/pipeline/_parser_internals/stateclass.pyx":72 + * return self.c.is_final() + * + * def copy(self): # <<<<<<<<<<<<<< + * cdef StateClass new_state = StateClass(doc=self.doc, offset=self.c.offset) + * new_state.c.clone(self.c) +*/ + + /* function exit code */ + __pyx_L1_error:; + __Pyx_XDECREF(__pyx_t_1); + __Pyx_XDECREF(__pyx_t_2); + __Pyx_XDECREF(__pyx_t_3); + __Pyx_XDECREF(__pyx_t_5); + __Pyx_AddTraceback("spacy.pipeline._parser_internals.stateclass.StateClass.copy", __pyx_clineno, __pyx_lineno, __pyx_filename); + __pyx_r = NULL; + __pyx_L0:; + __Pyx_XDECREF((PyObject *)__pyx_v_new_state); + __Pyx_XGIVEREF(__pyx_r); + __Pyx_RefNannyFinishContext(); + return __pyx_r; +} + +/* "spacy/pipeline/_parser_internals/stateclass.pyx":77 + * return new_state + * + * def print_state(self): # <<<<<<<<<<<<<< + * words = [token.text for token in self.doc] + * words = list(words) + ['_'] +*/ + +/* Python wrapper */ +static PyObject *__pyx_pw_5spacy_8pipeline_17_parser_internals_10stateclass_10StateClass_19print_state(PyObject *__pyx_v_self, +#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_5spacy_8pipeline_17_parser_internals_10stateclass_10StateClass_18print_state, "StateClass.print_state(self)"); +static PyMethodDef __pyx_mdef_5spacy_8pipeline_17_parser_internals_10stateclass_10StateClass_19print_state = {"print_state", (PyCFunction)(void(*)(void))(__Pyx_PyCFunction_FastCallWithKeywords)__pyx_pw_5spacy_8pipeline_17_parser_internals_10stateclass_10StateClass_19print_state, __Pyx_METH_FASTCALL|METH_KEYWORDS, __pyx_doc_5spacy_8pipeline_17_parser_internals_10stateclass_10StateClass_18print_state}; +static PyObject *__pyx_pw_5spacy_8pipeline_17_parser_internals_10stateclass_10StateClass_19print_state(PyObject *__pyx_v_self, +#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("print_state (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("print_state", 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("print_state", __pyx_kwds); return NULL;} + __pyx_r = __pyx_pf_5spacy_8pipeline_17_parser_internals_10stateclass_10StateClass_18print_state(((struct __pyx_obj_5spacy_8pipeline_17_parser_internals_10stateclass_StateClass *)__pyx_v_self)); + + /* function exit code */ + __Pyx_RefNannyFinishContext(); + return __pyx_r; +} + +static PyObject *__pyx_pf_5spacy_8pipeline_17_parser_internals_10stateclass_10StateClass_18print_state(struct __pyx_obj_5spacy_8pipeline_17_parser_internals_10stateclass_StateClass *__pyx_v_self) { + PyObject *__pyx_v_words = NULL; + PyObject *__pyx_v_bools = NULL; + PyObject *__pyx_v_sent_starts = NULL; + PyObject *__pyx_v_shifted = NULL; + PyObject *__pyx_v_top = NULL; + PyObject *__pyx_v_second = NULL; + PyObject *__pyx_v_third = NULL; + PyObject *__pyx_v_n0 = NULL; + PyObject *__pyx_v_n1 = NULL; + PyObject *__pyx_v_token = NULL; + Py_ssize_t __pyx_v_i; + PyObject *__pyx_r = NULL; + __Pyx_RefNannyDeclarations + PyObject *__pyx_t_1 = NULL; + PyObject *__pyx_t_2 = NULL; + Py_ssize_t __pyx_t_3; + PyObject *(*__pyx_t_4)(PyObject *); + PyObject *__pyx_t_5 = NULL; + Py_ssize_t __pyx_t_6; + Py_ssize_t __pyx_t_7; + int __pyx_t_8; + int __pyx_t_9; + int __pyx_t_10; + int __pyx_t_11; + PyObject *__pyx_t_12 = NULL; + PyObject *__pyx_t_13 = NULL; + PyObject *__pyx_t_14[6]; + size_t __pyx_t_15; + int __pyx_lineno = 0; + const char *__pyx_filename = NULL; + int __pyx_clineno = 0; + __Pyx_RefNannySetupContext("print_state", 0); + + /* "spacy/pipeline/_parser_internals/stateclass.pyx":78 + * + * def print_state(self): + * words = [token.text for token in self.doc] # <<<<<<<<<<<<<< + * words = list(words) + ['_'] + * bools = ["F", "T"] +*/ + __pyx_t_1 = PyList_New(0); if (unlikely(!__pyx_t_1)) __PYX_ERR(0, 78, __pyx_L1_error) + __Pyx_GOTREF(__pyx_t_1); + if (likely(PyList_CheckExact(((PyObject *)__pyx_v_self->doc))) || PyTuple_CheckExact(((PyObject *)__pyx_v_self->doc))) { + __pyx_t_2 = ((PyObject *)__pyx_v_self->doc); __Pyx_INCREF(__pyx_t_2); + __pyx_t_3 = 0; + __pyx_t_4 = NULL; + } else { + __pyx_t_3 = -1; __pyx_t_2 = PyObject_GetIter(((PyObject *)__pyx_v_self->doc)); if (unlikely(!__pyx_t_2)) __PYX_ERR(0, 78, __pyx_L1_error) + __Pyx_GOTREF(__pyx_t_2); + __pyx_t_4 = (CYTHON_COMPILING_IN_LIMITED_API) ? PyIter_Next : __Pyx_PyObject_GetIterNextFunc(__pyx_t_2); if (unlikely(!__pyx_t_4)) __PYX_ERR(0, 78, __pyx_L1_error) + } + for (;;) { + if (likely(!__pyx_t_4)) { + if (likely(PyList_CheckExact(__pyx_t_2))) { + { + Py_ssize_t __pyx_temp = __Pyx_PyList_GET_SIZE(__pyx_t_2); + #if !CYTHON_ASSUME_SAFE_SIZE + if (unlikely((__pyx_temp < 0))) __PYX_ERR(0, 78, __pyx_L1_error) + #endif + if (__pyx_t_3 >= __pyx_temp) break; + } + __pyx_t_5 = __Pyx_PyList_GetItemRefFast(__pyx_t_2, __pyx_t_3, __Pyx_ReferenceSharing_OwnStrongReference); + ++__pyx_t_3; + } else { + { + Py_ssize_t __pyx_temp = __Pyx_PyTuple_GET_SIZE(__pyx_t_2); + #if !CYTHON_ASSUME_SAFE_SIZE + if (unlikely((__pyx_temp < 0))) __PYX_ERR(0, 78, __pyx_L1_error) + #endif + if (__pyx_t_3 >= __pyx_temp) break; + } + #if CYTHON_ASSUME_SAFE_MACROS && !CYTHON_AVOID_BORROWED_REFS + __pyx_t_5 = __Pyx_NewRef(PyTuple_GET_ITEM(__pyx_t_2, __pyx_t_3)); + #else + __pyx_t_5 = __Pyx_PySequence_ITEM(__pyx_t_2, __pyx_t_3); + #endif + ++__pyx_t_3; + } + if (unlikely(!__pyx_t_5)) __PYX_ERR(0, 78, __pyx_L1_error) + } else { + __pyx_t_5 = __pyx_t_4(__pyx_t_2); + if (unlikely(!__pyx_t_5)) { + PyObject* exc_type = PyErr_Occurred(); + if (exc_type) { + if (unlikely(!__Pyx_PyErr_GivenExceptionMatches(exc_type, PyExc_StopIteration))) __PYX_ERR(0, 78, __pyx_L1_error) + PyErr_Clear(); + } + break; + } + } + __Pyx_GOTREF(__pyx_t_5); + __Pyx_XDECREF_SET(__pyx_v_token, __pyx_t_5); + __pyx_t_5 = 0; + __pyx_t_5 = __Pyx_PyObject_GetAttrStr(__pyx_v_token, __pyx_mstate_global->__pyx_n_u_text); if (unlikely(!__pyx_t_5)) __PYX_ERR(0, 78, __pyx_L1_error) + __Pyx_GOTREF(__pyx_t_5); + if (unlikely(__Pyx_ListComp_Append(__pyx_t_1, (PyObject*)__pyx_t_5))) __PYX_ERR(0, 78, __pyx_L1_error) + __Pyx_DECREF(__pyx_t_5); __pyx_t_5 = 0; + } + __Pyx_DECREF(__pyx_t_2); __pyx_t_2 = 0; + __pyx_v_words = ((PyObject*)__pyx_t_1); + __pyx_t_1 = 0; + + /* "spacy/pipeline/_parser_internals/stateclass.pyx":79 + * def print_state(self): + * words = [token.text for token in self.doc] + * words = list(words) + ['_'] # <<<<<<<<<<<<<< + * bools = ["F", "T"] + * sent_starts = [bools[self.c.is_sent_start(i)] for i in range(len(self.doc))] +*/ + __pyx_t_1 = PySequence_List(__pyx_v_words); if (unlikely(!__pyx_t_1)) __PYX_ERR(0, 79, __pyx_L1_error) + __Pyx_GOTREF(__pyx_t_1); + __pyx_t_2 = PyList_New(1); if (unlikely(!__pyx_t_2)) __PYX_ERR(0, 79, __pyx_L1_error) + __Pyx_GOTREF(__pyx_t_2); + __Pyx_INCREF(__pyx_mstate_global->__pyx_n_u__6); + __Pyx_GIVEREF(__pyx_mstate_global->__pyx_n_u__6); + if (__Pyx_PyList_SET_ITEM(__pyx_t_2, 0, __pyx_mstate_global->__pyx_n_u__6) != (0)) __PYX_ERR(0, 79, __pyx_L1_error); + __pyx_t_5 = PyNumber_Add(__pyx_t_1, __pyx_t_2); if (unlikely(!__pyx_t_5)) __PYX_ERR(0, 79, __pyx_L1_error) + __Pyx_GOTREF(__pyx_t_5); + __Pyx_DECREF(__pyx_t_1); __pyx_t_1 = 0; + __Pyx_DECREF(__pyx_t_2); __pyx_t_2 = 0; + __Pyx_DECREF_SET(__pyx_v_words, ((PyObject*)__pyx_t_5)); + __pyx_t_5 = 0; + + /* "spacy/pipeline/_parser_internals/stateclass.pyx":80 + * words = [token.text for token in self.doc] + * words = list(words) + ['_'] + * bools = ["F", "T"] # <<<<<<<<<<<<<< + * sent_starts = [bools[self.c.is_sent_start(i)] for i in range(len(self.doc))] + * shifted = [1 if self.c.is_unshiftable(i) else 0 for i in range(self.c.length)] +*/ + __pyx_t_5 = PyList_New(2); if (unlikely(!__pyx_t_5)) __PYX_ERR(0, 80, __pyx_L1_error) + __Pyx_GOTREF(__pyx_t_5); + __Pyx_INCREF(__pyx_mstate_global->__pyx_n_u_F); + __Pyx_GIVEREF(__pyx_mstate_global->__pyx_n_u_F); + if (__Pyx_PyList_SET_ITEM(__pyx_t_5, 0, __pyx_mstate_global->__pyx_n_u_F) != (0)) __PYX_ERR(0, 80, __pyx_L1_error); + __Pyx_INCREF(__pyx_mstate_global->__pyx_n_u_T); + __Pyx_GIVEREF(__pyx_mstate_global->__pyx_n_u_T); + if (__Pyx_PyList_SET_ITEM(__pyx_t_5, 1, __pyx_mstate_global->__pyx_n_u_T) != (0)) __PYX_ERR(0, 80, __pyx_L1_error); + __pyx_v_bools = ((PyObject*)__pyx_t_5); + __pyx_t_5 = 0; + + /* "spacy/pipeline/_parser_internals/stateclass.pyx":81 + * words = list(words) + ['_'] + * bools = ["F", "T"] + * sent_starts = [bools[self.c.is_sent_start(i)] for i in range(len(self.doc))] # <<<<<<<<<<<<<< + * shifted = [1 if self.c.is_unshiftable(i) else 0 for i in range(self.c.length)] + * shifted.append("") +*/ + __pyx_t_5 = PyList_New(0); if (unlikely(!__pyx_t_5)) __PYX_ERR(0, 81, __pyx_L1_error) + __Pyx_GOTREF(__pyx_t_5); + __pyx_t_2 = ((PyObject *)__pyx_v_self->doc); + __Pyx_INCREF(__pyx_t_2); + __pyx_t_3 = PyObject_Length(__pyx_t_2); if (unlikely(__pyx_t_3 == ((Py_ssize_t)-1))) __PYX_ERR(0, 81, __pyx_L1_error) + __Pyx_DECREF(__pyx_t_2); __pyx_t_2 = 0; + __pyx_t_6 = __pyx_t_3; + for (__pyx_t_7 = 0; __pyx_t_7 < __pyx_t_6; __pyx_t_7+=1) { + __pyx_v_i = __pyx_t_7; + __pyx_t_8 = __pyx_v_self->c->is_sent_start(__pyx_v_i); + __pyx_t_2 = __Pyx_GetItemInt_List(__pyx_v_bools, __pyx_t_8, int, 1, __Pyx_PyLong_From_int, 1, 1, 1, 1, __Pyx_ReferenceSharing_OwnStrongReference); if (unlikely(!__pyx_t_2)) __PYX_ERR(0, 81, __pyx_L1_error) + __Pyx_GOTREF(__pyx_t_2); + if (unlikely(__Pyx_ListComp_Append(__pyx_t_5, (PyObject*)__pyx_t_2))) __PYX_ERR(0, 81, __pyx_L1_error) + __Pyx_DECREF(__pyx_t_2); __pyx_t_2 = 0; + } + __pyx_v_sent_starts = ((PyObject*)__pyx_t_5); + __pyx_t_5 = 0; + + /* "spacy/pipeline/_parser_internals/stateclass.pyx":82 + * bools = ["F", "T"] + * sent_starts = [bools[self.c.is_sent_start(i)] for i in range(len(self.doc))] + * shifted = [1 if self.c.is_unshiftable(i) else 0 for i in range(self.c.length)] # <<<<<<<<<<<<<< + * shifted.append("") + * sent_starts.append("") +*/ + __pyx_t_5 = PyList_New(0); if (unlikely(!__pyx_t_5)) __PYX_ERR(0, 82, __pyx_L1_error) + __Pyx_GOTREF(__pyx_t_5); + __pyx_t_8 = __pyx_v_self->c->length; + __pyx_t_9 = __pyx_t_8; + for (__pyx_t_3 = 0; __pyx_t_3 < __pyx_t_9; __pyx_t_3+=1) { + __pyx_v_i = __pyx_t_3; + __pyx_t_10 = (__pyx_v_self->c->is_unshiftable(__pyx_v_i) != 0); + if (__pyx_t_10) { + __Pyx_INCREF(__pyx_mstate_global->__pyx_int_1); + __pyx_t_2 = __pyx_mstate_global->__pyx_int_1; + } else { + __Pyx_INCREF(__pyx_mstate_global->__pyx_int_0); + __pyx_t_2 = __pyx_mstate_global->__pyx_int_0; + } + if (unlikely(__Pyx_ListComp_Append(__pyx_t_5, (PyObject*)__pyx_t_2))) __PYX_ERR(0, 82, __pyx_L1_error) + __Pyx_DECREF(__pyx_t_2); __pyx_t_2 = 0; + } + __pyx_v_shifted = ((PyObject*)__pyx_t_5); + __pyx_t_5 = 0; + + /* "spacy/pipeline/_parser_internals/stateclass.pyx":83 + * sent_starts = [bools[self.c.is_sent_start(i)] for i in range(len(self.doc))] + * shifted = [1 if self.c.is_unshiftable(i) else 0 for i in range(self.c.length)] + * shifted.append("") # <<<<<<<<<<<<<< + * sent_starts.append("") + * top = f"{self.S(0)}{words[self.S(0)]}_{words[self.H(self.S(0))]}_{shifted[self.S(0)]}" +*/ + __pyx_t_11 = __Pyx_PyList_Append(__pyx_v_shifted, __pyx_mstate_global->__pyx_kp_u__7); if (unlikely(__pyx_t_11 == ((int)-1))) __PYX_ERR(0, 83, __pyx_L1_error) + + /* "spacy/pipeline/_parser_internals/stateclass.pyx":84 + * shifted = [1 if self.c.is_unshiftable(i) else 0 for i in range(self.c.length)] + * shifted.append("") + * sent_starts.append("") # <<<<<<<<<<<<<< + * top = f"{self.S(0)}{words[self.S(0)]}_{words[self.H(self.S(0))]}_{shifted[self.S(0)]}" + * second = f"{self.S(1)}{words[self.S(1)]}_{words[self.H(self.S(1))]}_{shifted[self.S(1)]}" +*/ + __pyx_t_11 = __Pyx_PyList_Append(__pyx_v_sent_starts, __pyx_mstate_global->__pyx_kp_u__7); if (unlikely(__pyx_t_11 == ((int)-1))) __PYX_ERR(0, 84, __pyx_L1_error) + + /* "spacy/pipeline/_parser_internals/stateclass.pyx":85 + * shifted.append("") + * sent_starts.append("") + * top = f"{self.S(0)}{words[self.S(0)]}_{words[self.H(self.S(0))]}_{shifted[self.S(0)]}" # <<<<<<<<<<<<<< + * second = f"{self.S(1)}{words[self.S(1)]}_{words[self.H(self.S(1))]}_{shifted[self.S(1)]}" + * third = f"{self.S(2)}{words[self.S(2)]}_{words[self.H(self.S(2))]}_{shifted[self.S(2)]}" +*/ + __pyx_t_5 = __Pyx_PyObject_GetAttrStr(((PyObject *)__pyx_v_self), __pyx_mstate_global->__pyx_n_u_S); if (unlikely(!__pyx_t_5)) __PYX_ERR(0, 85, __pyx_L1_error) + __Pyx_GOTREF(__pyx_t_5); + __pyx_t_2 = __Pyx_PyObject_Call(__pyx_t_5, __pyx_mstate_global->__pyx_tuple[2], NULL); if (unlikely(!__pyx_t_2)) __PYX_ERR(0, 85, __pyx_L1_error) + __Pyx_GOTREF(__pyx_t_2); + __Pyx_DECREF(__pyx_t_5); __pyx_t_5 = 0; + __pyx_t_5 = __Pyx_PyObject_FormatSimple(__pyx_t_2, __pyx_mstate_global->__pyx_empty_unicode); if (unlikely(!__pyx_t_5)) __PYX_ERR(0, 85, __pyx_L1_error) + __Pyx_GOTREF(__pyx_t_5); + __Pyx_DECREF(__pyx_t_2); __pyx_t_2 = 0; + __pyx_t_2 = __Pyx_PyObject_GetAttrStr(((PyObject *)__pyx_v_self), __pyx_mstate_global->__pyx_n_u_S); if (unlikely(!__pyx_t_2)) __PYX_ERR(0, 85, __pyx_L1_error) + __Pyx_GOTREF(__pyx_t_2); + __pyx_t_1 = __Pyx_PyObject_Call(__pyx_t_2, __pyx_mstate_global->__pyx_tuple[2], NULL); if (unlikely(!__pyx_t_1)) __PYX_ERR(0, 85, __pyx_L1_error) + __Pyx_GOTREF(__pyx_t_1); + __Pyx_DECREF(__pyx_t_2); __pyx_t_2 = 0; + __pyx_t_2 = __Pyx_PyObject_GetItem(__pyx_v_words, __pyx_t_1); if (unlikely(!__pyx_t_2)) __PYX_ERR(0, 85, __pyx_L1_error) + __Pyx_GOTREF(__pyx_t_2); + __Pyx_DECREF(__pyx_t_1); __pyx_t_1 = 0; + __pyx_t_1 = __Pyx_PyObject_FormatSimple(__pyx_t_2, __pyx_mstate_global->__pyx_empty_unicode); if (unlikely(!__pyx_t_1)) __PYX_ERR(0, 85, __pyx_L1_error) + __Pyx_GOTREF(__pyx_t_1); + __Pyx_DECREF(__pyx_t_2); __pyx_t_2 = 0; + __pyx_t_2 = __Pyx_PyObject_GetAttrStr(((PyObject *)__pyx_v_self), __pyx_mstate_global->__pyx_n_u_H); if (unlikely(!__pyx_t_2)) __PYX_ERR(0, 85, __pyx_L1_error) + __Pyx_GOTREF(__pyx_t_2); + __pyx_t_12 = __Pyx_PyObject_GetAttrStr(((PyObject *)__pyx_v_self), __pyx_mstate_global->__pyx_n_u_S); if (unlikely(!__pyx_t_12)) __PYX_ERR(0, 85, __pyx_L1_error) + __Pyx_GOTREF(__pyx_t_12); + __pyx_t_13 = __Pyx_PyObject_Call(__pyx_t_12, __pyx_mstate_global->__pyx_tuple[2], NULL); if (unlikely(!__pyx_t_13)) __PYX_ERR(0, 85, __pyx_L1_error) + __Pyx_GOTREF(__pyx_t_13); + __Pyx_DECREF(__pyx_t_12); __pyx_t_12 = 0; + __pyx_t_12 = __Pyx_PyObject_CallOneArg(__pyx_t_2, __pyx_t_13); if (unlikely(!__pyx_t_12)) __PYX_ERR(0, 85, __pyx_L1_error) + __Pyx_GOTREF(__pyx_t_12); + __Pyx_DECREF(__pyx_t_2); __pyx_t_2 = 0; + __Pyx_DECREF(__pyx_t_13); __pyx_t_13 = 0; + __pyx_t_13 = __Pyx_PyObject_GetItem(__pyx_v_words, __pyx_t_12); if (unlikely(!__pyx_t_13)) __PYX_ERR(0, 85, __pyx_L1_error) + __Pyx_GOTREF(__pyx_t_13); + __Pyx_DECREF(__pyx_t_12); __pyx_t_12 = 0; + __pyx_t_12 = __Pyx_PyObject_FormatSimple(__pyx_t_13, __pyx_mstate_global->__pyx_empty_unicode); if (unlikely(!__pyx_t_12)) __PYX_ERR(0, 85, __pyx_L1_error) + __Pyx_GOTREF(__pyx_t_12); + __Pyx_DECREF(__pyx_t_13); __pyx_t_13 = 0; + __pyx_t_13 = __Pyx_PyObject_GetAttrStr(((PyObject *)__pyx_v_self), __pyx_mstate_global->__pyx_n_u_S); if (unlikely(!__pyx_t_13)) __PYX_ERR(0, 85, __pyx_L1_error) + __Pyx_GOTREF(__pyx_t_13); + __pyx_t_2 = __Pyx_PyObject_Call(__pyx_t_13, __pyx_mstate_global->__pyx_tuple[2], NULL); if (unlikely(!__pyx_t_2)) __PYX_ERR(0, 85, __pyx_L1_error) + __Pyx_GOTREF(__pyx_t_2); + __Pyx_DECREF(__pyx_t_13); __pyx_t_13 = 0; + __pyx_t_13 = __Pyx_PyObject_GetItem(__pyx_v_shifted, __pyx_t_2); if (unlikely(!__pyx_t_13)) __PYX_ERR(0, 85, __pyx_L1_error) + __Pyx_GOTREF(__pyx_t_13); + __Pyx_DECREF(__pyx_t_2); __pyx_t_2 = 0; + __pyx_t_2 = __Pyx_PyObject_FormatSimple(__pyx_t_13, __pyx_mstate_global->__pyx_empty_unicode); if (unlikely(!__pyx_t_2)) __PYX_ERR(0, 85, __pyx_L1_error) + __Pyx_GOTREF(__pyx_t_2); + __Pyx_DECREF(__pyx_t_13); __pyx_t_13 = 0; + __pyx_t_14[0] = __pyx_t_5; + __pyx_t_14[1] = __pyx_t_1; + __pyx_t_14[2] = __pyx_mstate_global->__pyx_n_u__6; + __pyx_t_14[3] = __pyx_t_12; + __pyx_t_14[4] = __pyx_mstate_global->__pyx_n_u__6; + __pyx_t_14[5] = __pyx_t_2; + __pyx_t_13 = __Pyx_PyUnicode_Join(__pyx_t_14, 6, __Pyx_PyUnicode_GET_LENGTH(__pyx_t_5) + __Pyx_PyUnicode_GET_LENGTH(__pyx_t_1) + 1 * 2 + __Pyx_PyUnicode_GET_LENGTH(__pyx_t_12) + __Pyx_PyUnicode_GET_LENGTH(__pyx_t_2), 127 | __Pyx_PyUnicode_MAX_CHAR_VALUE(__pyx_t_5) | __Pyx_PyUnicode_MAX_CHAR_VALUE(__pyx_t_1) | __Pyx_PyUnicode_MAX_CHAR_VALUE(__pyx_t_12) | __Pyx_PyUnicode_MAX_CHAR_VALUE(__pyx_t_2)); + if (unlikely(!__pyx_t_13)) __PYX_ERR(0, 85, __pyx_L1_error) + __Pyx_GOTREF(__pyx_t_13); + __Pyx_DECREF(__pyx_t_5); __pyx_t_5 = 0; + __Pyx_DECREF(__pyx_t_1); __pyx_t_1 = 0; + __Pyx_DECREF(__pyx_t_12); __pyx_t_12 = 0; + __Pyx_DECREF(__pyx_t_2); __pyx_t_2 = 0; + __pyx_v_top = ((PyObject*)__pyx_t_13); + __pyx_t_13 = 0; + + /* "spacy/pipeline/_parser_internals/stateclass.pyx":86 + * sent_starts.append("") + * top = f"{self.S(0)}{words[self.S(0)]}_{words[self.H(self.S(0))]}_{shifted[self.S(0)]}" + * second = f"{self.S(1)}{words[self.S(1)]}_{words[self.H(self.S(1))]}_{shifted[self.S(1)]}" # <<<<<<<<<<<<<< + * third = f"{self.S(2)}{words[self.S(2)]}_{words[self.H(self.S(2))]}_{shifted[self.S(2)]}" + * n0 = f"{self.B(0)}{words[self.B(0)]}_{sent_starts[self.B(0)]}_{shifted[self.B(0)]}" +*/ + __pyx_t_13 = __Pyx_PyObject_GetAttrStr(((PyObject *)__pyx_v_self), __pyx_mstate_global->__pyx_n_u_S); if (unlikely(!__pyx_t_13)) __PYX_ERR(0, 86, __pyx_L1_error) + __Pyx_GOTREF(__pyx_t_13); + __pyx_t_2 = __Pyx_PyObject_Call(__pyx_t_13, __pyx_mstate_global->__pyx_tuple[3], NULL); if (unlikely(!__pyx_t_2)) __PYX_ERR(0, 86, __pyx_L1_error) + __Pyx_GOTREF(__pyx_t_2); + __Pyx_DECREF(__pyx_t_13); __pyx_t_13 = 0; + __pyx_t_13 = __Pyx_PyObject_FormatSimple(__pyx_t_2, __pyx_mstate_global->__pyx_empty_unicode); if (unlikely(!__pyx_t_13)) __PYX_ERR(0, 86, __pyx_L1_error) + __Pyx_GOTREF(__pyx_t_13); + __Pyx_DECREF(__pyx_t_2); __pyx_t_2 = 0; + __pyx_t_2 = __Pyx_PyObject_GetAttrStr(((PyObject *)__pyx_v_self), __pyx_mstate_global->__pyx_n_u_S); if (unlikely(!__pyx_t_2)) __PYX_ERR(0, 86, __pyx_L1_error) + __Pyx_GOTREF(__pyx_t_2); + __pyx_t_12 = __Pyx_PyObject_Call(__pyx_t_2, __pyx_mstate_global->__pyx_tuple[3], NULL); if (unlikely(!__pyx_t_12)) __PYX_ERR(0, 86, __pyx_L1_error) + __Pyx_GOTREF(__pyx_t_12); + __Pyx_DECREF(__pyx_t_2); __pyx_t_2 = 0; + __pyx_t_2 = __Pyx_PyObject_GetItem(__pyx_v_words, __pyx_t_12); if (unlikely(!__pyx_t_2)) __PYX_ERR(0, 86, __pyx_L1_error) + __Pyx_GOTREF(__pyx_t_2); + __Pyx_DECREF(__pyx_t_12); __pyx_t_12 = 0; + __pyx_t_12 = __Pyx_PyObject_FormatSimple(__pyx_t_2, __pyx_mstate_global->__pyx_empty_unicode); if (unlikely(!__pyx_t_12)) __PYX_ERR(0, 86, __pyx_L1_error) + __Pyx_GOTREF(__pyx_t_12); + __Pyx_DECREF(__pyx_t_2); __pyx_t_2 = 0; + __pyx_t_2 = __Pyx_PyObject_GetAttrStr(((PyObject *)__pyx_v_self), __pyx_mstate_global->__pyx_n_u_H); if (unlikely(!__pyx_t_2)) __PYX_ERR(0, 86, __pyx_L1_error) + __Pyx_GOTREF(__pyx_t_2); + __pyx_t_1 = __Pyx_PyObject_GetAttrStr(((PyObject *)__pyx_v_self), __pyx_mstate_global->__pyx_n_u_S); if (unlikely(!__pyx_t_1)) __PYX_ERR(0, 86, __pyx_L1_error) + __Pyx_GOTREF(__pyx_t_1); + __pyx_t_5 = __Pyx_PyObject_Call(__pyx_t_1, __pyx_mstate_global->__pyx_tuple[3], NULL); if (unlikely(!__pyx_t_5)) __PYX_ERR(0, 86, __pyx_L1_error) + __Pyx_GOTREF(__pyx_t_5); + __Pyx_DECREF(__pyx_t_1); __pyx_t_1 = 0; + __pyx_t_1 = __Pyx_PyObject_CallOneArg(__pyx_t_2, __pyx_t_5); if (unlikely(!__pyx_t_1)) __PYX_ERR(0, 86, __pyx_L1_error) + __Pyx_GOTREF(__pyx_t_1); + __Pyx_DECREF(__pyx_t_2); __pyx_t_2 = 0; + __Pyx_DECREF(__pyx_t_5); __pyx_t_5 = 0; + __pyx_t_5 = __Pyx_PyObject_GetItem(__pyx_v_words, __pyx_t_1); if (unlikely(!__pyx_t_5)) __PYX_ERR(0, 86, __pyx_L1_error) + __Pyx_GOTREF(__pyx_t_5); + __Pyx_DECREF(__pyx_t_1); __pyx_t_1 = 0; + __pyx_t_1 = __Pyx_PyObject_FormatSimple(__pyx_t_5, __pyx_mstate_global->__pyx_empty_unicode); if (unlikely(!__pyx_t_1)) __PYX_ERR(0, 86, __pyx_L1_error) + __Pyx_GOTREF(__pyx_t_1); + __Pyx_DECREF(__pyx_t_5); __pyx_t_5 = 0; + __pyx_t_5 = __Pyx_PyObject_GetAttrStr(((PyObject *)__pyx_v_self), __pyx_mstate_global->__pyx_n_u_S); if (unlikely(!__pyx_t_5)) __PYX_ERR(0, 86, __pyx_L1_error) + __Pyx_GOTREF(__pyx_t_5); + __pyx_t_2 = __Pyx_PyObject_Call(__pyx_t_5, __pyx_mstate_global->__pyx_tuple[3], NULL); if (unlikely(!__pyx_t_2)) __PYX_ERR(0, 86, __pyx_L1_error) + __Pyx_GOTREF(__pyx_t_2); + __Pyx_DECREF(__pyx_t_5); __pyx_t_5 = 0; + __pyx_t_5 = __Pyx_PyObject_GetItem(__pyx_v_shifted, __pyx_t_2); if (unlikely(!__pyx_t_5)) __PYX_ERR(0, 86, __pyx_L1_error) + __Pyx_GOTREF(__pyx_t_5); + __Pyx_DECREF(__pyx_t_2); __pyx_t_2 = 0; + __pyx_t_2 = __Pyx_PyObject_FormatSimple(__pyx_t_5, __pyx_mstate_global->__pyx_empty_unicode); if (unlikely(!__pyx_t_2)) __PYX_ERR(0, 86, __pyx_L1_error) + __Pyx_GOTREF(__pyx_t_2); + __Pyx_DECREF(__pyx_t_5); __pyx_t_5 = 0; + __pyx_t_14[0] = __pyx_t_13; + __pyx_t_14[1] = __pyx_t_12; + __pyx_t_14[2] = __pyx_mstate_global->__pyx_n_u__6; + __pyx_t_14[3] = __pyx_t_1; + __pyx_t_14[4] = __pyx_mstate_global->__pyx_n_u__6; + __pyx_t_14[5] = __pyx_t_2; + __pyx_t_5 = __Pyx_PyUnicode_Join(__pyx_t_14, 6, __Pyx_PyUnicode_GET_LENGTH(__pyx_t_13) + __Pyx_PyUnicode_GET_LENGTH(__pyx_t_12) + 1 * 2 + __Pyx_PyUnicode_GET_LENGTH(__pyx_t_1) + __Pyx_PyUnicode_GET_LENGTH(__pyx_t_2), 127 | __Pyx_PyUnicode_MAX_CHAR_VALUE(__pyx_t_13) | __Pyx_PyUnicode_MAX_CHAR_VALUE(__pyx_t_12) | __Pyx_PyUnicode_MAX_CHAR_VALUE(__pyx_t_1) | __Pyx_PyUnicode_MAX_CHAR_VALUE(__pyx_t_2)); + if (unlikely(!__pyx_t_5)) __PYX_ERR(0, 86, __pyx_L1_error) + __Pyx_GOTREF(__pyx_t_5); + __Pyx_DECREF(__pyx_t_13); __pyx_t_13 = 0; + __Pyx_DECREF(__pyx_t_12); __pyx_t_12 = 0; + __Pyx_DECREF(__pyx_t_1); __pyx_t_1 = 0; + __Pyx_DECREF(__pyx_t_2); __pyx_t_2 = 0; + __pyx_v_second = ((PyObject*)__pyx_t_5); + __pyx_t_5 = 0; + + /* "spacy/pipeline/_parser_internals/stateclass.pyx":87 + * top = f"{self.S(0)}{words[self.S(0)]}_{words[self.H(self.S(0))]}_{shifted[self.S(0)]}" + * second = f"{self.S(1)}{words[self.S(1)]}_{words[self.H(self.S(1))]}_{shifted[self.S(1)]}" + * third = f"{self.S(2)}{words[self.S(2)]}_{words[self.H(self.S(2))]}_{shifted[self.S(2)]}" # <<<<<<<<<<<<<< + * n0 = f"{self.B(0)}{words[self.B(0)]}_{sent_starts[self.B(0)]}_{shifted[self.B(0)]}" + * n1 = f"{self.B(1)}{words[self.B(1)]}_{sent_starts[self.B(1)]}_{shifted[self.B(1)]}" +*/ + __pyx_t_5 = __Pyx_PyObject_GetAttrStr(((PyObject *)__pyx_v_self), __pyx_mstate_global->__pyx_n_u_S); if (unlikely(!__pyx_t_5)) __PYX_ERR(0, 87, __pyx_L1_error) + __Pyx_GOTREF(__pyx_t_5); + __pyx_t_2 = __Pyx_PyObject_Call(__pyx_t_5, __pyx_mstate_global->__pyx_tuple[4], NULL); if (unlikely(!__pyx_t_2)) __PYX_ERR(0, 87, __pyx_L1_error) + __Pyx_GOTREF(__pyx_t_2); + __Pyx_DECREF(__pyx_t_5); __pyx_t_5 = 0; + __pyx_t_5 = __Pyx_PyObject_FormatSimple(__pyx_t_2, __pyx_mstate_global->__pyx_empty_unicode); if (unlikely(!__pyx_t_5)) __PYX_ERR(0, 87, __pyx_L1_error) + __Pyx_GOTREF(__pyx_t_5); + __Pyx_DECREF(__pyx_t_2); __pyx_t_2 = 0; + __pyx_t_2 = __Pyx_PyObject_GetAttrStr(((PyObject *)__pyx_v_self), __pyx_mstate_global->__pyx_n_u_S); if (unlikely(!__pyx_t_2)) __PYX_ERR(0, 87, __pyx_L1_error) + __Pyx_GOTREF(__pyx_t_2); + __pyx_t_1 = __Pyx_PyObject_Call(__pyx_t_2, __pyx_mstate_global->__pyx_tuple[4], NULL); if (unlikely(!__pyx_t_1)) __PYX_ERR(0, 87, __pyx_L1_error) + __Pyx_GOTREF(__pyx_t_1); + __Pyx_DECREF(__pyx_t_2); __pyx_t_2 = 0; + __pyx_t_2 = __Pyx_PyObject_GetItem(__pyx_v_words, __pyx_t_1); if (unlikely(!__pyx_t_2)) __PYX_ERR(0, 87, __pyx_L1_error) + __Pyx_GOTREF(__pyx_t_2); + __Pyx_DECREF(__pyx_t_1); __pyx_t_1 = 0; + __pyx_t_1 = __Pyx_PyObject_FormatSimple(__pyx_t_2, __pyx_mstate_global->__pyx_empty_unicode); if (unlikely(!__pyx_t_1)) __PYX_ERR(0, 87, __pyx_L1_error) + __Pyx_GOTREF(__pyx_t_1); + __Pyx_DECREF(__pyx_t_2); __pyx_t_2 = 0; + __pyx_t_2 = __Pyx_PyObject_GetAttrStr(((PyObject *)__pyx_v_self), __pyx_mstate_global->__pyx_n_u_H); if (unlikely(!__pyx_t_2)) __PYX_ERR(0, 87, __pyx_L1_error) + __Pyx_GOTREF(__pyx_t_2); + __pyx_t_12 = __Pyx_PyObject_GetAttrStr(((PyObject *)__pyx_v_self), __pyx_mstate_global->__pyx_n_u_S); if (unlikely(!__pyx_t_12)) __PYX_ERR(0, 87, __pyx_L1_error) + __Pyx_GOTREF(__pyx_t_12); + __pyx_t_13 = __Pyx_PyObject_Call(__pyx_t_12, __pyx_mstate_global->__pyx_tuple[4], NULL); if (unlikely(!__pyx_t_13)) __PYX_ERR(0, 87, __pyx_L1_error) + __Pyx_GOTREF(__pyx_t_13); + __Pyx_DECREF(__pyx_t_12); __pyx_t_12 = 0; + __pyx_t_12 = __Pyx_PyObject_CallOneArg(__pyx_t_2, __pyx_t_13); if (unlikely(!__pyx_t_12)) __PYX_ERR(0, 87, __pyx_L1_error) + __Pyx_GOTREF(__pyx_t_12); + __Pyx_DECREF(__pyx_t_2); __pyx_t_2 = 0; + __Pyx_DECREF(__pyx_t_13); __pyx_t_13 = 0; + __pyx_t_13 = __Pyx_PyObject_GetItem(__pyx_v_words, __pyx_t_12); if (unlikely(!__pyx_t_13)) __PYX_ERR(0, 87, __pyx_L1_error) + __Pyx_GOTREF(__pyx_t_13); + __Pyx_DECREF(__pyx_t_12); __pyx_t_12 = 0; + __pyx_t_12 = __Pyx_PyObject_FormatSimple(__pyx_t_13, __pyx_mstate_global->__pyx_empty_unicode); if (unlikely(!__pyx_t_12)) __PYX_ERR(0, 87, __pyx_L1_error) + __Pyx_GOTREF(__pyx_t_12); + __Pyx_DECREF(__pyx_t_13); __pyx_t_13 = 0; + __pyx_t_13 = __Pyx_PyObject_GetAttrStr(((PyObject *)__pyx_v_self), __pyx_mstate_global->__pyx_n_u_S); if (unlikely(!__pyx_t_13)) __PYX_ERR(0, 87, __pyx_L1_error) + __Pyx_GOTREF(__pyx_t_13); + __pyx_t_2 = __Pyx_PyObject_Call(__pyx_t_13, __pyx_mstate_global->__pyx_tuple[4], NULL); if (unlikely(!__pyx_t_2)) __PYX_ERR(0, 87, __pyx_L1_error) + __Pyx_GOTREF(__pyx_t_2); + __Pyx_DECREF(__pyx_t_13); __pyx_t_13 = 0; + __pyx_t_13 = __Pyx_PyObject_GetItem(__pyx_v_shifted, __pyx_t_2); if (unlikely(!__pyx_t_13)) __PYX_ERR(0, 87, __pyx_L1_error) + __Pyx_GOTREF(__pyx_t_13); + __Pyx_DECREF(__pyx_t_2); __pyx_t_2 = 0; + __pyx_t_2 = __Pyx_PyObject_FormatSimple(__pyx_t_13, __pyx_mstate_global->__pyx_empty_unicode); if (unlikely(!__pyx_t_2)) __PYX_ERR(0, 87, __pyx_L1_error) + __Pyx_GOTREF(__pyx_t_2); + __Pyx_DECREF(__pyx_t_13); __pyx_t_13 = 0; + __pyx_t_14[0] = __pyx_t_5; + __pyx_t_14[1] = __pyx_t_1; + __pyx_t_14[2] = __pyx_mstate_global->__pyx_n_u__6; + __pyx_t_14[3] = __pyx_t_12; + __pyx_t_14[4] = __pyx_mstate_global->__pyx_n_u__6; + __pyx_t_14[5] = __pyx_t_2; + __pyx_t_13 = __Pyx_PyUnicode_Join(__pyx_t_14, 6, __Pyx_PyUnicode_GET_LENGTH(__pyx_t_5) + __Pyx_PyUnicode_GET_LENGTH(__pyx_t_1) + 1 * 2 + __Pyx_PyUnicode_GET_LENGTH(__pyx_t_12) + __Pyx_PyUnicode_GET_LENGTH(__pyx_t_2), 127 | __Pyx_PyUnicode_MAX_CHAR_VALUE(__pyx_t_5) | __Pyx_PyUnicode_MAX_CHAR_VALUE(__pyx_t_1) | __Pyx_PyUnicode_MAX_CHAR_VALUE(__pyx_t_12) | __Pyx_PyUnicode_MAX_CHAR_VALUE(__pyx_t_2)); + if (unlikely(!__pyx_t_13)) __PYX_ERR(0, 87, __pyx_L1_error) + __Pyx_GOTREF(__pyx_t_13); + __Pyx_DECREF(__pyx_t_5); __pyx_t_5 = 0; + __Pyx_DECREF(__pyx_t_1); __pyx_t_1 = 0; + __Pyx_DECREF(__pyx_t_12); __pyx_t_12 = 0; + __Pyx_DECREF(__pyx_t_2); __pyx_t_2 = 0; + __pyx_v_third = ((PyObject*)__pyx_t_13); + __pyx_t_13 = 0; + + /* "spacy/pipeline/_parser_internals/stateclass.pyx":88 + * second = f"{self.S(1)}{words[self.S(1)]}_{words[self.H(self.S(1))]}_{shifted[self.S(1)]}" + * third = f"{self.S(2)}{words[self.S(2)]}_{words[self.H(self.S(2))]}_{shifted[self.S(2)]}" + * n0 = f"{self.B(0)}{words[self.B(0)]}_{sent_starts[self.B(0)]}_{shifted[self.B(0)]}" # <<<<<<<<<<<<<< + * n1 = f"{self.B(1)}{words[self.B(1)]}_{sent_starts[self.B(1)]}_{shifted[self.B(1)]}" + * return ' '.join((str(self.stack_depth()), str(self.buffer_length()), third, second, top, '|', n0, n1)) +*/ + __pyx_t_13 = __Pyx_PyObject_GetAttrStr(((PyObject *)__pyx_v_self), __pyx_mstate_global->__pyx_n_u_B); if (unlikely(!__pyx_t_13)) __PYX_ERR(0, 88, __pyx_L1_error) + __Pyx_GOTREF(__pyx_t_13); + __pyx_t_2 = __Pyx_PyObject_Call(__pyx_t_13, __pyx_mstate_global->__pyx_tuple[2], NULL); if (unlikely(!__pyx_t_2)) __PYX_ERR(0, 88, __pyx_L1_error) + __Pyx_GOTREF(__pyx_t_2); + __Pyx_DECREF(__pyx_t_13); __pyx_t_13 = 0; + __pyx_t_13 = __Pyx_PyObject_FormatSimple(__pyx_t_2, __pyx_mstate_global->__pyx_empty_unicode); if (unlikely(!__pyx_t_13)) __PYX_ERR(0, 88, __pyx_L1_error) + __Pyx_GOTREF(__pyx_t_13); + __Pyx_DECREF(__pyx_t_2); __pyx_t_2 = 0; + __pyx_t_2 = __Pyx_PyObject_GetAttrStr(((PyObject *)__pyx_v_self), __pyx_mstate_global->__pyx_n_u_B); if (unlikely(!__pyx_t_2)) __PYX_ERR(0, 88, __pyx_L1_error) + __Pyx_GOTREF(__pyx_t_2); + __pyx_t_12 = __Pyx_PyObject_Call(__pyx_t_2, __pyx_mstate_global->__pyx_tuple[2], NULL); if (unlikely(!__pyx_t_12)) __PYX_ERR(0, 88, __pyx_L1_error) + __Pyx_GOTREF(__pyx_t_12); + __Pyx_DECREF(__pyx_t_2); __pyx_t_2 = 0; + __pyx_t_2 = __Pyx_PyObject_GetItem(__pyx_v_words, __pyx_t_12); if (unlikely(!__pyx_t_2)) __PYX_ERR(0, 88, __pyx_L1_error) + __Pyx_GOTREF(__pyx_t_2); + __Pyx_DECREF(__pyx_t_12); __pyx_t_12 = 0; + __pyx_t_12 = __Pyx_PyObject_FormatSimple(__pyx_t_2, __pyx_mstate_global->__pyx_empty_unicode); if (unlikely(!__pyx_t_12)) __PYX_ERR(0, 88, __pyx_L1_error) + __Pyx_GOTREF(__pyx_t_12); + __Pyx_DECREF(__pyx_t_2); __pyx_t_2 = 0; + __pyx_t_2 = __Pyx_PyObject_GetAttrStr(((PyObject *)__pyx_v_self), __pyx_mstate_global->__pyx_n_u_B); if (unlikely(!__pyx_t_2)) __PYX_ERR(0, 88, __pyx_L1_error) + __Pyx_GOTREF(__pyx_t_2); + __pyx_t_1 = __Pyx_PyObject_Call(__pyx_t_2, __pyx_mstate_global->__pyx_tuple[2], NULL); if (unlikely(!__pyx_t_1)) __PYX_ERR(0, 88, __pyx_L1_error) + __Pyx_GOTREF(__pyx_t_1); + __Pyx_DECREF(__pyx_t_2); __pyx_t_2 = 0; + __pyx_t_2 = __Pyx_PyObject_GetItem(__pyx_v_sent_starts, __pyx_t_1); if (unlikely(!__pyx_t_2)) __PYX_ERR(0, 88, __pyx_L1_error) + __Pyx_GOTREF(__pyx_t_2); + __Pyx_DECREF(__pyx_t_1); __pyx_t_1 = 0; + __pyx_t_1 = __Pyx_PyObject_FormatSimple(__pyx_t_2, __pyx_mstate_global->__pyx_empty_unicode); if (unlikely(!__pyx_t_1)) __PYX_ERR(0, 88, __pyx_L1_error) + __Pyx_GOTREF(__pyx_t_1); + __Pyx_DECREF(__pyx_t_2); __pyx_t_2 = 0; + __pyx_t_2 = __Pyx_PyObject_GetAttrStr(((PyObject *)__pyx_v_self), __pyx_mstate_global->__pyx_n_u_B); if (unlikely(!__pyx_t_2)) __PYX_ERR(0, 88, __pyx_L1_error) + __Pyx_GOTREF(__pyx_t_2); + __pyx_t_5 = __Pyx_PyObject_Call(__pyx_t_2, __pyx_mstate_global->__pyx_tuple[2], NULL); if (unlikely(!__pyx_t_5)) __PYX_ERR(0, 88, __pyx_L1_error) + __Pyx_GOTREF(__pyx_t_5); + __Pyx_DECREF(__pyx_t_2); __pyx_t_2 = 0; + __pyx_t_2 = __Pyx_PyObject_GetItem(__pyx_v_shifted, __pyx_t_5); if (unlikely(!__pyx_t_2)) __PYX_ERR(0, 88, __pyx_L1_error) + __Pyx_GOTREF(__pyx_t_2); + __Pyx_DECREF(__pyx_t_5); __pyx_t_5 = 0; + __pyx_t_5 = __Pyx_PyObject_FormatSimple(__pyx_t_2, __pyx_mstate_global->__pyx_empty_unicode); if (unlikely(!__pyx_t_5)) __PYX_ERR(0, 88, __pyx_L1_error) + __Pyx_GOTREF(__pyx_t_5); + __Pyx_DECREF(__pyx_t_2); __pyx_t_2 = 0; + __pyx_t_14[0] = __pyx_t_13; + __pyx_t_14[1] = __pyx_t_12; + __pyx_t_14[2] = __pyx_mstate_global->__pyx_n_u__6; + __pyx_t_14[3] = __pyx_t_1; + __pyx_t_14[4] = __pyx_mstate_global->__pyx_n_u__6; + __pyx_t_14[5] = __pyx_t_5; + __pyx_t_2 = __Pyx_PyUnicode_Join(__pyx_t_14, 6, __Pyx_PyUnicode_GET_LENGTH(__pyx_t_13) + __Pyx_PyUnicode_GET_LENGTH(__pyx_t_12) + 1 * 2 + __Pyx_PyUnicode_GET_LENGTH(__pyx_t_1) + __Pyx_PyUnicode_GET_LENGTH(__pyx_t_5), 127 | __Pyx_PyUnicode_MAX_CHAR_VALUE(__pyx_t_13) | __Pyx_PyUnicode_MAX_CHAR_VALUE(__pyx_t_12) | __Pyx_PyUnicode_MAX_CHAR_VALUE(__pyx_t_1) | __Pyx_PyUnicode_MAX_CHAR_VALUE(__pyx_t_5)); + if (unlikely(!__pyx_t_2)) __PYX_ERR(0, 88, __pyx_L1_error) + __Pyx_GOTREF(__pyx_t_2); + __Pyx_DECREF(__pyx_t_13); __pyx_t_13 = 0; + __Pyx_DECREF(__pyx_t_12); __pyx_t_12 = 0; + __Pyx_DECREF(__pyx_t_1); __pyx_t_1 = 0; + __Pyx_DECREF(__pyx_t_5); __pyx_t_5 = 0; + __pyx_v_n0 = ((PyObject*)__pyx_t_2); + __pyx_t_2 = 0; + + /* "spacy/pipeline/_parser_internals/stateclass.pyx":89 + * third = f"{self.S(2)}{words[self.S(2)]}_{words[self.H(self.S(2))]}_{shifted[self.S(2)]}" + * n0 = f"{self.B(0)}{words[self.B(0)]}_{sent_starts[self.B(0)]}_{shifted[self.B(0)]}" + * n1 = f"{self.B(1)}{words[self.B(1)]}_{sent_starts[self.B(1)]}_{shifted[self.B(1)]}" # <<<<<<<<<<<<<< + * return ' '.join((str(self.stack_depth()), str(self.buffer_length()), third, second, top, '|', n0, n1)) + * +*/ + __pyx_t_2 = __Pyx_PyObject_GetAttrStr(((PyObject *)__pyx_v_self), __pyx_mstate_global->__pyx_n_u_B); if (unlikely(!__pyx_t_2)) __PYX_ERR(0, 89, __pyx_L1_error) + __Pyx_GOTREF(__pyx_t_2); + __pyx_t_5 = __Pyx_PyObject_Call(__pyx_t_2, __pyx_mstate_global->__pyx_tuple[3], NULL); if (unlikely(!__pyx_t_5)) __PYX_ERR(0, 89, __pyx_L1_error) + __Pyx_GOTREF(__pyx_t_5); + __Pyx_DECREF(__pyx_t_2); __pyx_t_2 = 0; + __pyx_t_2 = __Pyx_PyObject_FormatSimple(__pyx_t_5, __pyx_mstate_global->__pyx_empty_unicode); if (unlikely(!__pyx_t_2)) __PYX_ERR(0, 89, __pyx_L1_error) + __Pyx_GOTREF(__pyx_t_2); + __Pyx_DECREF(__pyx_t_5); __pyx_t_5 = 0; + __pyx_t_5 = __Pyx_PyObject_GetAttrStr(((PyObject *)__pyx_v_self), __pyx_mstate_global->__pyx_n_u_B); if (unlikely(!__pyx_t_5)) __PYX_ERR(0, 89, __pyx_L1_error) + __Pyx_GOTREF(__pyx_t_5); + __pyx_t_1 = __Pyx_PyObject_Call(__pyx_t_5, __pyx_mstate_global->__pyx_tuple[3], NULL); if (unlikely(!__pyx_t_1)) __PYX_ERR(0, 89, __pyx_L1_error) + __Pyx_GOTREF(__pyx_t_1); + __Pyx_DECREF(__pyx_t_5); __pyx_t_5 = 0; + __pyx_t_5 = __Pyx_PyObject_GetItem(__pyx_v_words, __pyx_t_1); if (unlikely(!__pyx_t_5)) __PYX_ERR(0, 89, __pyx_L1_error) + __Pyx_GOTREF(__pyx_t_5); + __Pyx_DECREF(__pyx_t_1); __pyx_t_1 = 0; + __pyx_t_1 = __Pyx_PyObject_FormatSimple(__pyx_t_5, __pyx_mstate_global->__pyx_empty_unicode); if (unlikely(!__pyx_t_1)) __PYX_ERR(0, 89, __pyx_L1_error) + __Pyx_GOTREF(__pyx_t_1); + __Pyx_DECREF(__pyx_t_5); __pyx_t_5 = 0; + __pyx_t_5 = __Pyx_PyObject_GetAttrStr(((PyObject *)__pyx_v_self), __pyx_mstate_global->__pyx_n_u_B); if (unlikely(!__pyx_t_5)) __PYX_ERR(0, 89, __pyx_L1_error) + __Pyx_GOTREF(__pyx_t_5); + __pyx_t_12 = __Pyx_PyObject_Call(__pyx_t_5, __pyx_mstate_global->__pyx_tuple[3], NULL); if (unlikely(!__pyx_t_12)) __PYX_ERR(0, 89, __pyx_L1_error) + __Pyx_GOTREF(__pyx_t_12); + __Pyx_DECREF(__pyx_t_5); __pyx_t_5 = 0; + __pyx_t_5 = __Pyx_PyObject_GetItem(__pyx_v_sent_starts, __pyx_t_12); if (unlikely(!__pyx_t_5)) __PYX_ERR(0, 89, __pyx_L1_error) + __Pyx_GOTREF(__pyx_t_5); + __Pyx_DECREF(__pyx_t_12); __pyx_t_12 = 0; + __pyx_t_12 = __Pyx_PyObject_FormatSimple(__pyx_t_5, __pyx_mstate_global->__pyx_empty_unicode); if (unlikely(!__pyx_t_12)) __PYX_ERR(0, 89, __pyx_L1_error) + __Pyx_GOTREF(__pyx_t_12); + __Pyx_DECREF(__pyx_t_5); __pyx_t_5 = 0; + __pyx_t_5 = __Pyx_PyObject_GetAttrStr(((PyObject *)__pyx_v_self), __pyx_mstate_global->__pyx_n_u_B); if (unlikely(!__pyx_t_5)) __PYX_ERR(0, 89, __pyx_L1_error) + __Pyx_GOTREF(__pyx_t_5); + __pyx_t_13 = __Pyx_PyObject_Call(__pyx_t_5, __pyx_mstate_global->__pyx_tuple[3], NULL); if (unlikely(!__pyx_t_13)) __PYX_ERR(0, 89, __pyx_L1_error) + __Pyx_GOTREF(__pyx_t_13); + __Pyx_DECREF(__pyx_t_5); __pyx_t_5 = 0; + __pyx_t_5 = __Pyx_PyObject_GetItem(__pyx_v_shifted, __pyx_t_13); if (unlikely(!__pyx_t_5)) __PYX_ERR(0, 89, __pyx_L1_error) + __Pyx_GOTREF(__pyx_t_5); + __Pyx_DECREF(__pyx_t_13); __pyx_t_13 = 0; + __pyx_t_13 = __Pyx_PyObject_FormatSimple(__pyx_t_5, __pyx_mstate_global->__pyx_empty_unicode); if (unlikely(!__pyx_t_13)) __PYX_ERR(0, 89, __pyx_L1_error) + __Pyx_GOTREF(__pyx_t_13); + __Pyx_DECREF(__pyx_t_5); __pyx_t_5 = 0; + __pyx_t_14[0] = __pyx_t_2; + __pyx_t_14[1] = __pyx_t_1; + __pyx_t_14[2] = __pyx_mstate_global->__pyx_n_u__6; + __pyx_t_14[3] = __pyx_t_12; + __pyx_t_14[4] = __pyx_mstate_global->__pyx_n_u__6; + __pyx_t_14[5] = __pyx_t_13; + __pyx_t_5 = __Pyx_PyUnicode_Join(__pyx_t_14, 6, __Pyx_PyUnicode_GET_LENGTH(__pyx_t_2) + __Pyx_PyUnicode_GET_LENGTH(__pyx_t_1) + 1 * 2 + __Pyx_PyUnicode_GET_LENGTH(__pyx_t_12) + __Pyx_PyUnicode_GET_LENGTH(__pyx_t_13), 127 | __Pyx_PyUnicode_MAX_CHAR_VALUE(__pyx_t_2) | __Pyx_PyUnicode_MAX_CHAR_VALUE(__pyx_t_1) | __Pyx_PyUnicode_MAX_CHAR_VALUE(__pyx_t_12) | __Pyx_PyUnicode_MAX_CHAR_VALUE(__pyx_t_13)); + if (unlikely(!__pyx_t_5)) __PYX_ERR(0, 89, __pyx_L1_error) + __Pyx_GOTREF(__pyx_t_5); + __Pyx_DECREF(__pyx_t_2); __pyx_t_2 = 0; + __Pyx_DECREF(__pyx_t_1); __pyx_t_1 = 0; + __Pyx_DECREF(__pyx_t_12); __pyx_t_12 = 0; + __Pyx_DECREF(__pyx_t_13); __pyx_t_13 = 0; + __pyx_v_n1 = ((PyObject*)__pyx_t_5); + __pyx_t_5 = 0; + + /* "spacy/pipeline/_parser_internals/stateclass.pyx":90 + * n0 = f"{self.B(0)}{words[self.B(0)]}_{sent_starts[self.B(0)]}_{shifted[self.B(0)]}" + * n1 = f"{self.B(1)}{words[self.B(1)]}_{sent_starts[self.B(1)]}_{shifted[self.B(1)]}" + * return ' '.join((str(self.stack_depth()), str(self.buffer_length()), third, second, top, '|', n0, n1)) # <<<<<<<<<<<<<< + * + * def S(self, int i): +*/ + __Pyx_XDECREF(__pyx_r); + __pyx_t_13 = ((PyObject *)__pyx_v_self); + __Pyx_INCREF(__pyx_t_13); + __pyx_t_15 = 0; + { + PyObject *__pyx_callargs[2] = {__pyx_t_13, NULL}; + __pyx_t_5 = __Pyx_PyObject_FastCallMethod((PyObject*)__pyx_mstate_global->__pyx_n_u_stack_depth, __pyx_callargs+__pyx_t_15, (1-__pyx_t_15) | (1*__Pyx_PY_VECTORCALL_ARGUMENTS_OFFSET)); + __Pyx_XDECREF(__pyx_t_13); __pyx_t_13 = 0; + if (unlikely(!__pyx_t_5)) __PYX_ERR(0, 90, __pyx_L1_error) + __Pyx_GOTREF(__pyx_t_5); + } + __pyx_t_13 = __Pyx_PyObject_Unicode(__pyx_t_5); if (unlikely(!__pyx_t_13)) __PYX_ERR(0, 90, __pyx_L1_error) + __Pyx_GOTREF(__pyx_t_13); + __Pyx_DECREF(__pyx_t_5); __pyx_t_5 = 0; + __pyx_t_12 = ((PyObject *)__pyx_v_self); + __Pyx_INCREF(__pyx_t_12); + __pyx_t_15 = 0; + { + PyObject *__pyx_callargs[2] = {__pyx_t_12, NULL}; + __pyx_t_5 = __Pyx_PyObject_FastCallMethod((PyObject*)__pyx_mstate_global->__pyx_n_u_buffer_length, __pyx_callargs+__pyx_t_15, (1-__pyx_t_15) | (1*__Pyx_PY_VECTORCALL_ARGUMENTS_OFFSET)); + __Pyx_XDECREF(__pyx_t_12); __pyx_t_12 = 0; + if (unlikely(!__pyx_t_5)) __PYX_ERR(0, 90, __pyx_L1_error) + __Pyx_GOTREF(__pyx_t_5); + } + __pyx_t_12 = __Pyx_PyObject_Unicode(__pyx_t_5); if (unlikely(!__pyx_t_12)) __PYX_ERR(0, 90, __pyx_L1_error) + __Pyx_GOTREF(__pyx_t_12); + __Pyx_DECREF(__pyx_t_5); __pyx_t_5 = 0; + __pyx_t_5 = PyTuple_New(8); if (unlikely(!__pyx_t_5)) __PYX_ERR(0, 90, __pyx_L1_error) + __Pyx_GOTREF(__pyx_t_5); + __Pyx_GIVEREF(__pyx_t_13); + if (__Pyx_PyTuple_SET_ITEM(__pyx_t_5, 0, __pyx_t_13) != (0)) __PYX_ERR(0, 90, __pyx_L1_error); + __Pyx_GIVEREF(__pyx_t_12); + if (__Pyx_PyTuple_SET_ITEM(__pyx_t_5, 1, __pyx_t_12) != (0)) __PYX_ERR(0, 90, __pyx_L1_error); + __Pyx_INCREF(__pyx_v_third); + __Pyx_GIVEREF(__pyx_v_third); + if (__Pyx_PyTuple_SET_ITEM(__pyx_t_5, 2, __pyx_v_third) != (0)) __PYX_ERR(0, 90, __pyx_L1_error); + __Pyx_INCREF(__pyx_v_second); + __Pyx_GIVEREF(__pyx_v_second); + if (__Pyx_PyTuple_SET_ITEM(__pyx_t_5, 3, __pyx_v_second) != (0)) __PYX_ERR(0, 90, __pyx_L1_error); + __Pyx_INCREF(__pyx_v_top); + __Pyx_GIVEREF(__pyx_v_top); + if (__Pyx_PyTuple_SET_ITEM(__pyx_t_5, 4, __pyx_v_top) != (0)) __PYX_ERR(0, 90, __pyx_L1_error); + __Pyx_INCREF(__pyx_mstate_global->__pyx_kp_u__9); + __Pyx_GIVEREF(__pyx_mstate_global->__pyx_kp_u__9); + if (__Pyx_PyTuple_SET_ITEM(__pyx_t_5, 5, __pyx_mstate_global->__pyx_kp_u__9) != (0)) __PYX_ERR(0, 90, __pyx_L1_error); + __Pyx_INCREF(__pyx_v_n0); + __Pyx_GIVEREF(__pyx_v_n0); + if (__Pyx_PyTuple_SET_ITEM(__pyx_t_5, 6, __pyx_v_n0) != (0)) __PYX_ERR(0, 90, __pyx_L1_error); + __Pyx_INCREF(__pyx_v_n1); + __Pyx_GIVEREF(__pyx_v_n1); + if (__Pyx_PyTuple_SET_ITEM(__pyx_t_5, 7, __pyx_v_n1) != (0)) __PYX_ERR(0, 90, __pyx_L1_error); + __pyx_t_13 = 0; + __pyx_t_12 = 0; + __pyx_t_12 = PyUnicode_Join(__pyx_mstate_global->__pyx_kp_u__8, __pyx_t_5); if (unlikely(!__pyx_t_12)) __PYX_ERR(0, 90, __pyx_L1_error) + __Pyx_GOTREF(__pyx_t_12); + __Pyx_DECREF(__pyx_t_5); __pyx_t_5 = 0; + __pyx_r = __pyx_t_12; + __pyx_t_12 = 0; + goto __pyx_L0; + + /* "spacy/pipeline/_parser_internals/stateclass.pyx":77 + * return new_state + * + * def print_state(self): # <<<<<<<<<<<<<< + * words = [token.text for token in self.doc] + * words = list(words) + ['_'] +*/ + + /* function exit code */ + __pyx_L1_error:; + __Pyx_XDECREF(__pyx_t_1); + __Pyx_XDECREF(__pyx_t_2); + __Pyx_XDECREF(__pyx_t_5); + __Pyx_XDECREF(__pyx_t_12); + __Pyx_XDECREF(__pyx_t_13); + __Pyx_AddTraceback("spacy.pipeline._parser_internals.stateclass.StateClass.print_state", __pyx_clineno, __pyx_lineno, __pyx_filename); + __pyx_r = NULL; + __pyx_L0:; + __Pyx_XDECREF(__pyx_v_words); + __Pyx_XDECREF(__pyx_v_bools); + __Pyx_XDECREF(__pyx_v_sent_starts); + __Pyx_XDECREF(__pyx_v_shifted); + __Pyx_XDECREF(__pyx_v_top); + __Pyx_XDECREF(__pyx_v_second); + __Pyx_XDECREF(__pyx_v_third); + __Pyx_XDECREF(__pyx_v_n0); + __Pyx_XDECREF(__pyx_v_n1); + __Pyx_XDECREF(__pyx_v_token); + __Pyx_XGIVEREF(__pyx_r); + __Pyx_RefNannyFinishContext(); + return __pyx_r; +} + +/* "spacy/pipeline/_parser_internals/stateclass.pyx":92 + * return ' '.join((str(self.stack_depth()), str(self.buffer_length()), third, second, top, '|', n0, n1)) + * + * def S(self, int i): # <<<<<<<<<<<<<< + * return self.c.S(i) + * +*/ + +/* Python wrapper */ +static PyObject *__pyx_pw_5spacy_8pipeline_17_parser_internals_10stateclass_10StateClass_21S(PyObject *__pyx_v_self, +#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_5spacy_8pipeline_17_parser_internals_10stateclass_10StateClass_20S, "StateClass.S(self, int i)"); +static PyMethodDef __pyx_mdef_5spacy_8pipeline_17_parser_internals_10stateclass_10StateClass_21S = {"S", (PyCFunction)(void(*)(void))(__Pyx_PyCFunction_FastCallWithKeywords)__pyx_pw_5spacy_8pipeline_17_parser_internals_10stateclass_10StateClass_21S, __Pyx_METH_FASTCALL|METH_KEYWORDS, __pyx_doc_5spacy_8pipeline_17_parser_internals_10stateclass_10StateClass_20S}; +static PyObject *__pyx_pw_5spacy_8pipeline_17_parser_internals_10stateclass_10StateClass_21S(PyObject *__pyx_v_self, +#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_i; + #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("S (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_i,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, 92, __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, 92, __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, "S", 0) < (0)) __PYX_ERR(0, 92, __pyx_L3_error) + for (Py_ssize_t i = __pyx_nargs; i < 1; i++) { + if (unlikely(!values[i])) { __Pyx_RaiseArgtupleInvalid("S", 1, 1, 1, i); __PYX_ERR(0, 92, __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, 92, __pyx_L3_error) + } + __pyx_v_i = __Pyx_PyLong_As_int(values[0]); if (unlikely((__pyx_v_i == (int)-1) && PyErr_Occurred())) __PYX_ERR(0, 92, __pyx_L3_error) + } + goto __pyx_L6_skip; + __pyx_L5_argtuple_error:; + __Pyx_RaiseArgtupleInvalid("S", 1, 1, 1, __pyx_nargs); __PYX_ERR(0, 92, __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("spacy.pipeline._parser_internals.stateclass.StateClass.S", __pyx_clineno, __pyx_lineno, __pyx_filename); + __Pyx_RefNannyFinishContext(); + return NULL; + __pyx_L4_argument_unpacking_done:; + __pyx_r = __pyx_pf_5spacy_8pipeline_17_parser_internals_10stateclass_10StateClass_20S(((struct __pyx_obj_5spacy_8pipeline_17_parser_internals_10stateclass_StateClass *)__pyx_v_self), __pyx_v_i); + + /* 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_5spacy_8pipeline_17_parser_internals_10stateclass_10StateClass_20S(struct __pyx_obj_5spacy_8pipeline_17_parser_internals_10stateclass_StateClass *__pyx_v_self, int __pyx_v_i) { + 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("S", 0); + + /* "spacy/pipeline/_parser_internals/stateclass.pyx":93 + * + * def S(self, int i): + * return self.c.S(i) # <<<<<<<<<<<<<< + * + * def B(self, int i): +*/ + __Pyx_XDECREF(__pyx_r); + __pyx_t_1 = __Pyx_PyLong_From_int(__pyx_v_self->c->S(__pyx_v_i)); if (unlikely(!__pyx_t_1)) __PYX_ERR(0, 93, __pyx_L1_error) + __Pyx_GOTREF(__pyx_t_1); + __pyx_r = __pyx_t_1; + __pyx_t_1 = 0; + goto __pyx_L0; + + /* "spacy/pipeline/_parser_internals/stateclass.pyx":92 + * return ' '.join((str(self.stack_depth()), str(self.buffer_length()), third, second, top, '|', n0, n1)) + * + * def S(self, int i): # <<<<<<<<<<<<<< + * return self.c.S(i) + * +*/ + + /* function exit code */ + __pyx_L1_error:; + __Pyx_XDECREF(__pyx_t_1); + __Pyx_AddTraceback("spacy.pipeline._parser_internals.stateclass.StateClass.S", __pyx_clineno, __pyx_lineno, __pyx_filename); + __pyx_r = NULL; + __pyx_L0:; + __Pyx_XGIVEREF(__pyx_r); + __Pyx_RefNannyFinishContext(); + return __pyx_r; +} + +/* "spacy/pipeline/_parser_internals/stateclass.pyx":95 + * return self.c.S(i) + * + * def B(self, int i): # <<<<<<<<<<<<<< + * return self.c.B(i) + * +*/ + +/* Python wrapper */ +static PyObject *__pyx_pw_5spacy_8pipeline_17_parser_internals_10stateclass_10StateClass_23B(PyObject *__pyx_v_self, +#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_5spacy_8pipeline_17_parser_internals_10stateclass_10StateClass_22B, "StateClass.B(self, int i)"); +static PyMethodDef __pyx_mdef_5spacy_8pipeline_17_parser_internals_10stateclass_10StateClass_23B = {"B", (PyCFunction)(void(*)(void))(__Pyx_PyCFunction_FastCallWithKeywords)__pyx_pw_5spacy_8pipeline_17_parser_internals_10stateclass_10StateClass_23B, __Pyx_METH_FASTCALL|METH_KEYWORDS, __pyx_doc_5spacy_8pipeline_17_parser_internals_10stateclass_10StateClass_22B}; +static PyObject *__pyx_pw_5spacy_8pipeline_17_parser_internals_10stateclass_10StateClass_23B(PyObject *__pyx_v_self, +#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_i; + #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("B (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_i,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, 95, __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, 95, __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, "B", 0) < (0)) __PYX_ERR(0, 95, __pyx_L3_error) + for (Py_ssize_t i = __pyx_nargs; i < 1; i++) { + if (unlikely(!values[i])) { __Pyx_RaiseArgtupleInvalid("B", 1, 1, 1, i); __PYX_ERR(0, 95, __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, 95, __pyx_L3_error) + } + __pyx_v_i = __Pyx_PyLong_As_int(values[0]); if (unlikely((__pyx_v_i == (int)-1) && PyErr_Occurred())) __PYX_ERR(0, 95, __pyx_L3_error) + } + goto __pyx_L6_skip; + __pyx_L5_argtuple_error:; + __Pyx_RaiseArgtupleInvalid("B", 1, 1, 1, __pyx_nargs); __PYX_ERR(0, 95, __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("spacy.pipeline._parser_internals.stateclass.StateClass.B", __pyx_clineno, __pyx_lineno, __pyx_filename); + __Pyx_RefNannyFinishContext(); + return NULL; + __pyx_L4_argument_unpacking_done:; + __pyx_r = __pyx_pf_5spacy_8pipeline_17_parser_internals_10stateclass_10StateClass_22B(((struct __pyx_obj_5spacy_8pipeline_17_parser_internals_10stateclass_StateClass *)__pyx_v_self), __pyx_v_i); + + /* 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_5spacy_8pipeline_17_parser_internals_10stateclass_10StateClass_22B(struct __pyx_obj_5spacy_8pipeline_17_parser_internals_10stateclass_StateClass *__pyx_v_self, int __pyx_v_i) { + 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("B", 0); + + /* "spacy/pipeline/_parser_internals/stateclass.pyx":96 + * + * def B(self, int i): + * return self.c.B(i) # <<<<<<<<<<<<<< + * + * def H(self, int i): +*/ + __Pyx_XDECREF(__pyx_r); + __pyx_t_1 = __Pyx_PyLong_From_int(__pyx_v_self->c->B(__pyx_v_i)); if (unlikely(!__pyx_t_1)) __PYX_ERR(0, 96, __pyx_L1_error) + __Pyx_GOTREF(__pyx_t_1); + __pyx_r = __pyx_t_1; + __pyx_t_1 = 0; + goto __pyx_L0; + + /* "spacy/pipeline/_parser_internals/stateclass.pyx":95 + * return self.c.S(i) + * + * def B(self, int i): # <<<<<<<<<<<<<< + * return self.c.B(i) + * +*/ + + /* function exit code */ + __pyx_L1_error:; + __Pyx_XDECREF(__pyx_t_1); + __Pyx_AddTraceback("spacy.pipeline._parser_internals.stateclass.StateClass.B", __pyx_clineno, __pyx_lineno, __pyx_filename); + __pyx_r = NULL; + __pyx_L0:; + __Pyx_XGIVEREF(__pyx_r); + __Pyx_RefNannyFinishContext(); + return __pyx_r; +} + +/* "spacy/pipeline/_parser_internals/stateclass.pyx":98 + * return self.c.B(i) + * + * def H(self, int i): # <<<<<<<<<<<<<< + * return self.c.H(i) + * +*/ + +/* Python wrapper */ +static PyObject *__pyx_pw_5spacy_8pipeline_17_parser_internals_10stateclass_10StateClass_25H(PyObject *__pyx_v_self, +#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_5spacy_8pipeline_17_parser_internals_10stateclass_10StateClass_24H, "StateClass.H(self, int i)"); +static PyMethodDef __pyx_mdef_5spacy_8pipeline_17_parser_internals_10stateclass_10StateClass_25H = {"H", (PyCFunction)(void(*)(void))(__Pyx_PyCFunction_FastCallWithKeywords)__pyx_pw_5spacy_8pipeline_17_parser_internals_10stateclass_10StateClass_25H, __Pyx_METH_FASTCALL|METH_KEYWORDS, __pyx_doc_5spacy_8pipeline_17_parser_internals_10stateclass_10StateClass_24H}; +static PyObject *__pyx_pw_5spacy_8pipeline_17_parser_internals_10stateclass_10StateClass_25H(PyObject *__pyx_v_self, +#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_i; + #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("H (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_i,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, 98, __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, 98, __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, "H", 0) < (0)) __PYX_ERR(0, 98, __pyx_L3_error) + for (Py_ssize_t i = __pyx_nargs; i < 1; i++) { + if (unlikely(!values[i])) { __Pyx_RaiseArgtupleInvalid("H", 1, 1, 1, i); __PYX_ERR(0, 98, __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, 98, __pyx_L3_error) + } + __pyx_v_i = __Pyx_PyLong_As_int(values[0]); if (unlikely((__pyx_v_i == (int)-1) && PyErr_Occurred())) __PYX_ERR(0, 98, __pyx_L3_error) + } + goto __pyx_L6_skip; + __pyx_L5_argtuple_error:; + __Pyx_RaiseArgtupleInvalid("H", 1, 1, 1, __pyx_nargs); __PYX_ERR(0, 98, __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("spacy.pipeline._parser_internals.stateclass.StateClass.H", __pyx_clineno, __pyx_lineno, __pyx_filename); + __Pyx_RefNannyFinishContext(); + return NULL; + __pyx_L4_argument_unpacking_done:; + __pyx_r = __pyx_pf_5spacy_8pipeline_17_parser_internals_10stateclass_10StateClass_24H(((struct __pyx_obj_5spacy_8pipeline_17_parser_internals_10stateclass_StateClass *)__pyx_v_self), __pyx_v_i); + + /* 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_5spacy_8pipeline_17_parser_internals_10stateclass_10StateClass_24H(struct __pyx_obj_5spacy_8pipeline_17_parser_internals_10stateclass_StateClass *__pyx_v_self, int __pyx_v_i) { + 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("H", 0); + + /* "spacy/pipeline/_parser_internals/stateclass.pyx":99 + * + * def H(self, int i): + * return self.c.H(i) # <<<<<<<<<<<<<< + * + * def E(self, int i): +*/ + __Pyx_XDECREF(__pyx_r); + __pyx_t_1 = __Pyx_PyLong_From_int(__pyx_v_self->c->H(__pyx_v_i)); if (unlikely(!__pyx_t_1)) __PYX_ERR(0, 99, __pyx_L1_error) + __Pyx_GOTREF(__pyx_t_1); + __pyx_r = __pyx_t_1; + __pyx_t_1 = 0; + goto __pyx_L0; + + /* "spacy/pipeline/_parser_internals/stateclass.pyx":98 + * return self.c.B(i) + * + * def H(self, int i): # <<<<<<<<<<<<<< + * return self.c.H(i) + * +*/ + + /* function exit code */ + __pyx_L1_error:; + __Pyx_XDECREF(__pyx_t_1); + __Pyx_AddTraceback("spacy.pipeline._parser_internals.stateclass.StateClass.H", __pyx_clineno, __pyx_lineno, __pyx_filename); + __pyx_r = NULL; + __pyx_L0:; + __Pyx_XGIVEREF(__pyx_r); + __Pyx_RefNannyFinishContext(); + return __pyx_r; +} + +/* "spacy/pipeline/_parser_internals/stateclass.pyx":101 + * return self.c.H(i) + * + * def E(self, int i): # <<<<<<<<<<<<<< + * return self.c.E(i) + * +*/ + +/* Python wrapper */ +static PyObject *__pyx_pw_5spacy_8pipeline_17_parser_internals_10stateclass_10StateClass_27E(PyObject *__pyx_v_self, +#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_5spacy_8pipeline_17_parser_internals_10stateclass_10StateClass_26E, "StateClass.E(self, int i)"); +static PyMethodDef __pyx_mdef_5spacy_8pipeline_17_parser_internals_10stateclass_10StateClass_27E = {"E", (PyCFunction)(void(*)(void))(__Pyx_PyCFunction_FastCallWithKeywords)__pyx_pw_5spacy_8pipeline_17_parser_internals_10stateclass_10StateClass_27E, __Pyx_METH_FASTCALL|METH_KEYWORDS, __pyx_doc_5spacy_8pipeline_17_parser_internals_10stateclass_10StateClass_26E}; +static PyObject *__pyx_pw_5spacy_8pipeline_17_parser_internals_10stateclass_10StateClass_27E(PyObject *__pyx_v_self, +#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_i; + #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("E (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_i,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, 101, __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, 101, __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, "E", 0) < (0)) __PYX_ERR(0, 101, __pyx_L3_error) + for (Py_ssize_t i = __pyx_nargs; i < 1; i++) { + if (unlikely(!values[i])) { __Pyx_RaiseArgtupleInvalid("E", 1, 1, 1, i); __PYX_ERR(0, 101, __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, 101, __pyx_L3_error) + } + __pyx_v_i = __Pyx_PyLong_As_int(values[0]); if (unlikely((__pyx_v_i == (int)-1) && PyErr_Occurred())) __PYX_ERR(0, 101, __pyx_L3_error) + } + goto __pyx_L6_skip; + __pyx_L5_argtuple_error:; + __Pyx_RaiseArgtupleInvalid("E", 1, 1, 1, __pyx_nargs); __PYX_ERR(0, 101, __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("spacy.pipeline._parser_internals.stateclass.StateClass.E", __pyx_clineno, __pyx_lineno, __pyx_filename); + __Pyx_RefNannyFinishContext(); + return NULL; + __pyx_L4_argument_unpacking_done:; + __pyx_r = __pyx_pf_5spacy_8pipeline_17_parser_internals_10stateclass_10StateClass_26E(((struct __pyx_obj_5spacy_8pipeline_17_parser_internals_10stateclass_StateClass *)__pyx_v_self), __pyx_v_i); + + /* 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_5spacy_8pipeline_17_parser_internals_10stateclass_10StateClass_26E(struct __pyx_obj_5spacy_8pipeline_17_parser_internals_10stateclass_StateClass *__pyx_v_self, int __pyx_v_i) { + 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("E", 0); + + /* "spacy/pipeline/_parser_internals/stateclass.pyx":102 + * + * def E(self, int i): + * return self.c.E(i) # <<<<<<<<<<<<<< + * + * def L(self, int i, int idx): +*/ + __Pyx_XDECREF(__pyx_r); + __pyx_t_1 = __Pyx_PyLong_From_int(__pyx_v_self->c->E(__pyx_v_i)); if (unlikely(!__pyx_t_1)) __PYX_ERR(0, 102, __pyx_L1_error) + __Pyx_GOTREF(__pyx_t_1); + __pyx_r = __pyx_t_1; + __pyx_t_1 = 0; + goto __pyx_L0; + + /* "spacy/pipeline/_parser_internals/stateclass.pyx":101 + * return self.c.H(i) + * + * def E(self, int i): # <<<<<<<<<<<<<< + * return self.c.E(i) + * +*/ + + /* function exit code */ + __pyx_L1_error:; + __Pyx_XDECREF(__pyx_t_1); + __Pyx_AddTraceback("spacy.pipeline._parser_internals.stateclass.StateClass.E", __pyx_clineno, __pyx_lineno, __pyx_filename); + __pyx_r = NULL; + __pyx_L0:; + __Pyx_XGIVEREF(__pyx_r); + __Pyx_RefNannyFinishContext(); + return __pyx_r; +} + +/* "spacy/pipeline/_parser_internals/stateclass.pyx":104 + * return self.c.E(i) + * + * def L(self, int i, int idx): # <<<<<<<<<<<<<< + * return self.c.L(i, idx) + * +*/ + +/* Python wrapper */ +static PyObject *__pyx_pw_5spacy_8pipeline_17_parser_internals_10stateclass_10StateClass_29L(PyObject *__pyx_v_self, +#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_5spacy_8pipeline_17_parser_internals_10stateclass_10StateClass_28L, "StateClass.L(self, int i, int idx)"); +static PyMethodDef __pyx_mdef_5spacy_8pipeline_17_parser_internals_10stateclass_10StateClass_29L = {"L", (PyCFunction)(void(*)(void))(__Pyx_PyCFunction_FastCallWithKeywords)__pyx_pw_5spacy_8pipeline_17_parser_internals_10stateclass_10StateClass_29L, __Pyx_METH_FASTCALL|METH_KEYWORDS, __pyx_doc_5spacy_8pipeline_17_parser_internals_10stateclass_10StateClass_28L}; +static PyObject *__pyx_pw_5spacy_8pipeline_17_parser_internals_10stateclass_10StateClass_29L(PyObject *__pyx_v_self, +#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_i; + int __pyx_v_idx; + #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("L (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_i,&__pyx_mstate_global->__pyx_n_u_idx,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, 104, __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, 104, __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, 104, __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, "L", 0) < (0)) __PYX_ERR(0, 104, __pyx_L3_error) + for (Py_ssize_t i = __pyx_nargs; i < 2; i++) { + if (unlikely(!values[i])) { __Pyx_RaiseArgtupleInvalid("L", 1, 2, 2, i); __PYX_ERR(0, 104, __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, 104, __pyx_L3_error) + values[1] = __Pyx_ArgRef_FASTCALL(__pyx_args, 1); + if (!CYTHON_ASSUME_SAFE_MACROS && unlikely(!values[1])) __PYX_ERR(0, 104, __pyx_L3_error) + } + __pyx_v_i = __Pyx_PyLong_As_int(values[0]); if (unlikely((__pyx_v_i == (int)-1) && PyErr_Occurred())) __PYX_ERR(0, 104, __pyx_L3_error) + __pyx_v_idx = __Pyx_PyLong_As_int(values[1]); if (unlikely((__pyx_v_idx == (int)-1) && PyErr_Occurred())) __PYX_ERR(0, 104, __pyx_L3_error) + } + goto __pyx_L6_skip; + __pyx_L5_argtuple_error:; + __Pyx_RaiseArgtupleInvalid("L", 1, 2, 2, __pyx_nargs); __PYX_ERR(0, 104, __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("spacy.pipeline._parser_internals.stateclass.StateClass.L", __pyx_clineno, __pyx_lineno, __pyx_filename); + __Pyx_RefNannyFinishContext(); + return NULL; + __pyx_L4_argument_unpacking_done:; + __pyx_r = __pyx_pf_5spacy_8pipeline_17_parser_internals_10stateclass_10StateClass_28L(((struct __pyx_obj_5spacy_8pipeline_17_parser_internals_10stateclass_StateClass *)__pyx_v_self), __pyx_v_i, __pyx_v_idx); + + /* 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_5spacy_8pipeline_17_parser_internals_10stateclass_10StateClass_28L(struct __pyx_obj_5spacy_8pipeline_17_parser_internals_10stateclass_StateClass *__pyx_v_self, int __pyx_v_i, int __pyx_v_idx) { + 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("L", 0); + + /* "spacy/pipeline/_parser_internals/stateclass.pyx":105 + * + * def L(self, int i, int idx): + * return self.c.L(i, idx) # <<<<<<<<<<<<<< + * + * def R(self, int i, int idx): +*/ + __Pyx_XDECREF(__pyx_r); + __pyx_t_1 = __Pyx_PyLong_From_int(__pyx_v_self->c->L(__pyx_v_i, __pyx_v_idx)); if (unlikely(!__pyx_t_1)) __PYX_ERR(0, 105, __pyx_L1_error) + __Pyx_GOTREF(__pyx_t_1); + __pyx_r = __pyx_t_1; + __pyx_t_1 = 0; + goto __pyx_L0; + + /* "spacy/pipeline/_parser_internals/stateclass.pyx":104 + * return self.c.E(i) + * + * def L(self, int i, int idx): # <<<<<<<<<<<<<< + * return self.c.L(i, idx) + * +*/ + + /* function exit code */ + __pyx_L1_error:; + __Pyx_XDECREF(__pyx_t_1); + __Pyx_AddTraceback("spacy.pipeline._parser_internals.stateclass.StateClass.L", __pyx_clineno, __pyx_lineno, __pyx_filename); + __pyx_r = NULL; + __pyx_L0:; + __Pyx_XGIVEREF(__pyx_r); + __Pyx_RefNannyFinishContext(); + return __pyx_r; +} + +/* "spacy/pipeline/_parser_internals/stateclass.pyx":107 + * return self.c.L(i, idx) + * + * def R(self, int i, int idx): # <<<<<<<<<<<<<< + * return self.c.R(i, idx) + * +*/ + +/* Python wrapper */ +static PyObject *__pyx_pw_5spacy_8pipeline_17_parser_internals_10stateclass_10StateClass_31R(PyObject *__pyx_v_self, +#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_5spacy_8pipeline_17_parser_internals_10stateclass_10StateClass_30R, "StateClass.R(self, int i, int idx)"); +static PyMethodDef __pyx_mdef_5spacy_8pipeline_17_parser_internals_10stateclass_10StateClass_31R = {"R", (PyCFunction)(void(*)(void))(__Pyx_PyCFunction_FastCallWithKeywords)__pyx_pw_5spacy_8pipeline_17_parser_internals_10stateclass_10StateClass_31R, __Pyx_METH_FASTCALL|METH_KEYWORDS, __pyx_doc_5spacy_8pipeline_17_parser_internals_10stateclass_10StateClass_30R}; +static PyObject *__pyx_pw_5spacy_8pipeline_17_parser_internals_10stateclass_10StateClass_31R(PyObject *__pyx_v_self, +#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_i; + int __pyx_v_idx; + #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("R (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_i,&__pyx_mstate_global->__pyx_n_u_idx,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, 107, __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, 107, __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, 107, __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, "R", 0) < (0)) __PYX_ERR(0, 107, __pyx_L3_error) + for (Py_ssize_t i = __pyx_nargs; i < 2; i++) { + if (unlikely(!values[i])) { __Pyx_RaiseArgtupleInvalid("R", 1, 2, 2, i); __PYX_ERR(0, 107, __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, 107, __pyx_L3_error) + values[1] = __Pyx_ArgRef_FASTCALL(__pyx_args, 1); + if (!CYTHON_ASSUME_SAFE_MACROS && unlikely(!values[1])) __PYX_ERR(0, 107, __pyx_L3_error) + } + __pyx_v_i = __Pyx_PyLong_As_int(values[0]); if (unlikely((__pyx_v_i == (int)-1) && PyErr_Occurred())) __PYX_ERR(0, 107, __pyx_L3_error) + __pyx_v_idx = __Pyx_PyLong_As_int(values[1]); if (unlikely((__pyx_v_idx == (int)-1) && PyErr_Occurred())) __PYX_ERR(0, 107, __pyx_L3_error) + } + goto __pyx_L6_skip; + __pyx_L5_argtuple_error:; + __Pyx_RaiseArgtupleInvalid("R", 1, 2, 2, __pyx_nargs); __PYX_ERR(0, 107, __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("spacy.pipeline._parser_internals.stateclass.StateClass.R", __pyx_clineno, __pyx_lineno, __pyx_filename); + __Pyx_RefNannyFinishContext(); + return NULL; + __pyx_L4_argument_unpacking_done:; + __pyx_r = __pyx_pf_5spacy_8pipeline_17_parser_internals_10stateclass_10StateClass_30R(((struct __pyx_obj_5spacy_8pipeline_17_parser_internals_10stateclass_StateClass *)__pyx_v_self), __pyx_v_i, __pyx_v_idx); + + /* 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_5spacy_8pipeline_17_parser_internals_10stateclass_10StateClass_30R(struct __pyx_obj_5spacy_8pipeline_17_parser_internals_10stateclass_StateClass *__pyx_v_self, int __pyx_v_i, int __pyx_v_idx) { + 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("R", 0); + + /* "spacy/pipeline/_parser_internals/stateclass.pyx":108 + * + * def R(self, int i, int idx): + * return self.c.R(i, idx) # <<<<<<<<<<<<<< + * + * def S_(self, int i): +*/ + __Pyx_XDECREF(__pyx_r); + __pyx_t_1 = __Pyx_PyLong_From_int(__pyx_v_self->c->R(__pyx_v_i, __pyx_v_idx)); if (unlikely(!__pyx_t_1)) __PYX_ERR(0, 108, __pyx_L1_error) + __Pyx_GOTREF(__pyx_t_1); + __pyx_r = __pyx_t_1; + __pyx_t_1 = 0; + goto __pyx_L0; + + /* "spacy/pipeline/_parser_internals/stateclass.pyx":107 + * return self.c.L(i, idx) + * + * def R(self, int i, int idx): # <<<<<<<<<<<<<< + * return self.c.R(i, idx) + * +*/ + + /* function exit code */ + __pyx_L1_error:; + __Pyx_XDECREF(__pyx_t_1); + __Pyx_AddTraceback("spacy.pipeline._parser_internals.stateclass.StateClass.R", __pyx_clineno, __pyx_lineno, __pyx_filename); + __pyx_r = NULL; + __pyx_L0:; + __Pyx_XGIVEREF(__pyx_r); + __Pyx_RefNannyFinishContext(); + return __pyx_r; +} + +/* "spacy/pipeline/_parser_internals/stateclass.pyx":110 + * return self.c.R(i, idx) + * + * def S_(self, int i): # <<<<<<<<<<<<<< + * return self.doc[self.c.S(i)] + * +*/ + +/* Python wrapper */ +static PyObject *__pyx_pw_5spacy_8pipeline_17_parser_internals_10stateclass_10StateClass_33S_(PyObject *__pyx_v_self, +#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_5spacy_8pipeline_17_parser_internals_10stateclass_10StateClass_32S_, "StateClass.S_(self, int i)"); +static PyMethodDef __pyx_mdef_5spacy_8pipeline_17_parser_internals_10stateclass_10StateClass_33S_ = {"S_", (PyCFunction)(void(*)(void))(__Pyx_PyCFunction_FastCallWithKeywords)__pyx_pw_5spacy_8pipeline_17_parser_internals_10stateclass_10StateClass_33S_, __Pyx_METH_FASTCALL|METH_KEYWORDS, __pyx_doc_5spacy_8pipeline_17_parser_internals_10stateclass_10StateClass_32S_}; +static PyObject *__pyx_pw_5spacy_8pipeline_17_parser_internals_10stateclass_10StateClass_33S_(PyObject *__pyx_v_self, +#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_i; + #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("S_ (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_i,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, 110, __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, 110, __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, "S_", 0) < (0)) __PYX_ERR(0, 110, __pyx_L3_error) + for (Py_ssize_t i = __pyx_nargs; i < 1; i++) { + if (unlikely(!values[i])) { __Pyx_RaiseArgtupleInvalid("S_", 1, 1, 1, i); __PYX_ERR(0, 110, __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, 110, __pyx_L3_error) + } + __pyx_v_i = __Pyx_PyLong_As_int(values[0]); if (unlikely((__pyx_v_i == (int)-1) && PyErr_Occurred())) __PYX_ERR(0, 110, __pyx_L3_error) + } + goto __pyx_L6_skip; + __pyx_L5_argtuple_error:; + __Pyx_RaiseArgtupleInvalid("S_", 1, 1, 1, __pyx_nargs); __PYX_ERR(0, 110, __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("spacy.pipeline._parser_internals.stateclass.StateClass.S_", __pyx_clineno, __pyx_lineno, __pyx_filename); + __Pyx_RefNannyFinishContext(); + return NULL; + __pyx_L4_argument_unpacking_done:; + __pyx_r = __pyx_pf_5spacy_8pipeline_17_parser_internals_10stateclass_10StateClass_32S_(((struct __pyx_obj_5spacy_8pipeline_17_parser_internals_10stateclass_StateClass *)__pyx_v_self), __pyx_v_i); + + /* 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_5spacy_8pipeline_17_parser_internals_10stateclass_10StateClass_32S_(struct __pyx_obj_5spacy_8pipeline_17_parser_internals_10stateclass_StateClass *__pyx_v_self, int __pyx_v_i) { + 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("S_", 0); + + /* "spacy/pipeline/_parser_internals/stateclass.pyx":111 + * + * def S_(self, int i): + * return self.doc[self.c.S(i)] # <<<<<<<<<<<<<< + * + * def B_(self, int i): +*/ + __Pyx_XDECREF(__pyx_r); + __pyx_t_1 = __pyx_v_self->c->S(__pyx_v_i); + __pyx_t_2 = __Pyx_GetItemInt(((PyObject *)__pyx_v_self->doc), __pyx_t_1, int, 1, __Pyx_PyLong_From_int, 0, 1, 1, 1, __Pyx_ReferenceSharing_SharedReference); if (unlikely(!__pyx_t_2)) __PYX_ERR(0, 111, __pyx_L1_error) + __Pyx_GOTREF(__pyx_t_2); + __pyx_r = __pyx_t_2; + __pyx_t_2 = 0; + goto __pyx_L0; + + /* "spacy/pipeline/_parser_internals/stateclass.pyx":110 + * return self.c.R(i, idx) + * + * def S_(self, int i): # <<<<<<<<<<<<<< + * return self.doc[self.c.S(i)] + * +*/ + + /* function exit code */ + __pyx_L1_error:; + __Pyx_XDECREF(__pyx_t_2); + __Pyx_AddTraceback("spacy.pipeline._parser_internals.stateclass.StateClass.S_", __pyx_clineno, __pyx_lineno, __pyx_filename); + __pyx_r = NULL; + __pyx_L0:; + __Pyx_XGIVEREF(__pyx_r); + __Pyx_RefNannyFinishContext(); + return __pyx_r; +} + +/* "spacy/pipeline/_parser_internals/stateclass.pyx":113 + * return self.doc[self.c.S(i)] + * + * def B_(self, int i): # <<<<<<<<<<<<<< + * return self.doc[self.c.B(i)] + * +*/ + +/* Python wrapper */ +static PyObject *__pyx_pw_5spacy_8pipeline_17_parser_internals_10stateclass_10StateClass_35B_(PyObject *__pyx_v_self, +#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_5spacy_8pipeline_17_parser_internals_10stateclass_10StateClass_34B_, "StateClass.B_(self, int i)"); +static PyMethodDef __pyx_mdef_5spacy_8pipeline_17_parser_internals_10stateclass_10StateClass_35B_ = {"B_", (PyCFunction)(void(*)(void))(__Pyx_PyCFunction_FastCallWithKeywords)__pyx_pw_5spacy_8pipeline_17_parser_internals_10stateclass_10StateClass_35B_, __Pyx_METH_FASTCALL|METH_KEYWORDS, __pyx_doc_5spacy_8pipeline_17_parser_internals_10stateclass_10StateClass_34B_}; +static PyObject *__pyx_pw_5spacy_8pipeline_17_parser_internals_10stateclass_10StateClass_35B_(PyObject *__pyx_v_self, +#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_i; + #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("B_ (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_i,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, 113, __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, 113, __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, "B_", 0) < (0)) __PYX_ERR(0, 113, __pyx_L3_error) + for (Py_ssize_t i = __pyx_nargs; i < 1; i++) { + if (unlikely(!values[i])) { __Pyx_RaiseArgtupleInvalid("B_", 1, 1, 1, i); __PYX_ERR(0, 113, __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, 113, __pyx_L3_error) + } + __pyx_v_i = __Pyx_PyLong_As_int(values[0]); if (unlikely((__pyx_v_i == (int)-1) && PyErr_Occurred())) __PYX_ERR(0, 113, __pyx_L3_error) + } + goto __pyx_L6_skip; + __pyx_L5_argtuple_error:; + __Pyx_RaiseArgtupleInvalid("B_", 1, 1, 1, __pyx_nargs); __PYX_ERR(0, 113, __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("spacy.pipeline._parser_internals.stateclass.StateClass.B_", __pyx_clineno, __pyx_lineno, __pyx_filename); + __Pyx_RefNannyFinishContext(); + return NULL; + __pyx_L4_argument_unpacking_done:; + __pyx_r = __pyx_pf_5spacy_8pipeline_17_parser_internals_10stateclass_10StateClass_34B_(((struct __pyx_obj_5spacy_8pipeline_17_parser_internals_10stateclass_StateClass *)__pyx_v_self), __pyx_v_i); + + /* 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_5spacy_8pipeline_17_parser_internals_10stateclass_10StateClass_34B_(struct __pyx_obj_5spacy_8pipeline_17_parser_internals_10stateclass_StateClass *__pyx_v_self, int __pyx_v_i) { + 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("B_", 0); + + /* "spacy/pipeline/_parser_internals/stateclass.pyx":114 + * + * def B_(self, int i): + * return self.doc[self.c.B(i)] # <<<<<<<<<<<<<< + * + * def H_(self, int i): +*/ + __Pyx_XDECREF(__pyx_r); + __pyx_t_1 = __pyx_v_self->c->B(__pyx_v_i); + __pyx_t_2 = __Pyx_GetItemInt(((PyObject *)__pyx_v_self->doc), __pyx_t_1, int, 1, __Pyx_PyLong_From_int, 0, 1, 1, 1, __Pyx_ReferenceSharing_SharedReference); if (unlikely(!__pyx_t_2)) __PYX_ERR(0, 114, __pyx_L1_error) + __Pyx_GOTREF(__pyx_t_2); + __pyx_r = __pyx_t_2; + __pyx_t_2 = 0; + goto __pyx_L0; + + /* "spacy/pipeline/_parser_internals/stateclass.pyx":113 + * return self.doc[self.c.S(i)] + * + * def B_(self, int i): # <<<<<<<<<<<<<< + * return self.doc[self.c.B(i)] + * +*/ + + /* function exit code */ + __pyx_L1_error:; + __Pyx_XDECREF(__pyx_t_2); + __Pyx_AddTraceback("spacy.pipeline._parser_internals.stateclass.StateClass.B_", __pyx_clineno, __pyx_lineno, __pyx_filename); + __pyx_r = NULL; + __pyx_L0:; + __Pyx_XGIVEREF(__pyx_r); + __Pyx_RefNannyFinishContext(); + return __pyx_r; +} + +/* "spacy/pipeline/_parser_internals/stateclass.pyx":116 + * return self.doc[self.c.B(i)] + * + * def H_(self, int i): # <<<<<<<<<<<<<< + * return self.doc[self.c.H(i)] + * +*/ + +/* Python wrapper */ +static PyObject *__pyx_pw_5spacy_8pipeline_17_parser_internals_10stateclass_10StateClass_37H_(PyObject *__pyx_v_self, +#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_5spacy_8pipeline_17_parser_internals_10stateclass_10StateClass_36H_, "StateClass.H_(self, int i)"); +static PyMethodDef __pyx_mdef_5spacy_8pipeline_17_parser_internals_10stateclass_10StateClass_37H_ = {"H_", (PyCFunction)(void(*)(void))(__Pyx_PyCFunction_FastCallWithKeywords)__pyx_pw_5spacy_8pipeline_17_parser_internals_10stateclass_10StateClass_37H_, __Pyx_METH_FASTCALL|METH_KEYWORDS, __pyx_doc_5spacy_8pipeline_17_parser_internals_10stateclass_10StateClass_36H_}; +static PyObject *__pyx_pw_5spacy_8pipeline_17_parser_internals_10stateclass_10StateClass_37H_(PyObject *__pyx_v_self, +#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_i; + #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("H_ (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_i,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, 116, __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, 116, __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, "H_", 0) < (0)) __PYX_ERR(0, 116, __pyx_L3_error) + for (Py_ssize_t i = __pyx_nargs; i < 1; i++) { + if (unlikely(!values[i])) { __Pyx_RaiseArgtupleInvalid("H_", 1, 1, 1, i); __PYX_ERR(0, 116, __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, 116, __pyx_L3_error) + } + __pyx_v_i = __Pyx_PyLong_As_int(values[0]); if (unlikely((__pyx_v_i == (int)-1) && PyErr_Occurred())) __PYX_ERR(0, 116, __pyx_L3_error) + } + goto __pyx_L6_skip; + __pyx_L5_argtuple_error:; + __Pyx_RaiseArgtupleInvalid("H_", 1, 1, 1, __pyx_nargs); __PYX_ERR(0, 116, __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("spacy.pipeline._parser_internals.stateclass.StateClass.H_", __pyx_clineno, __pyx_lineno, __pyx_filename); + __Pyx_RefNannyFinishContext(); + return NULL; + __pyx_L4_argument_unpacking_done:; + __pyx_r = __pyx_pf_5spacy_8pipeline_17_parser_internals_10stateclass_10StateClass_36H_(((struct __pyx_obj_5spacy_8pipeline_17_parser_internals_10stateclass_StateClass *)__pyx_v_self), __pyx_v_i); + + /* 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_5spacy_8pipeline_17_parser_internals_10stateclass_10StateClass_36H_(struct __pyx_obj_5spacy_8pipeline_17_parser_internals_10stateclass_StateClass *__pyx_v_self, int __pyx_v_i) { + 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("H_", 0); + + /* "spacy/pipeline/_parser_internals/stateclass.pyx":117 + * + * def H_(self, int i): + * return self.doc[self.c.H(i)] # <<<<<<<<<<<<<< + * + * def E_(self, int i): +*/ + __Pyx_XDECREF(__pyx_r); + __pyx_t_1 = __pyx_v_self->c->H(__pyx_v_i); + __pyx_t_2 = __Pyx_GetItemInt(((PyObject *)__pyx_v_self->doc), __pyx_t_1, int, 1, __Pyx_PyLong_From_int, 0, 1, 1, 1, __Pyx_ReferenceSharing_SharedReference); if (unlikely(!__pyx_t_2)) __PYX_ERR(0, 117, __pyx_L1_error) + __Pyx_GOTREF(__pyx_t_2); + __pyx_r = __pyx_t_2; + __pyx_t_2 = 0; + goto __pyx_L0; + + /* "spacy/pipeline/_parser_internals/stateclass.pyx":116 + * return self.doc[self.c.B(i)] + * + * def H_(self, int i): # <<<<<<<<<<<<<< + * return self.doc[self.c.H(i)] + * +*/ + + /* function exit code */ + __pyx_L1_error:; + __Pyx_XDECREF(__pyx_t_2); + __Pyx_AddTraceback("spacy.pipeline._parser_internals.stateclass.StateClass.H_", __pyx_clineno, __pyx_lineno, __pyx_filename); + __pyx_r = NULL; + __pyx_L0:; + __Pyx_XGIVEREF(__pyx_r); + __Pyx_RefNannyFinishContext(); + return __pyx_r; +} + +/* "spacy/pipeline/_parser_internals/stateclass.pyx":119 + * return self.doc[self.c.H(i)] + * + * def E_(self, int i): # <<<<<<<<<<<<<< + * return self.doc[self.c.E(i)] + * +*/ + +/* Python wrapper */ +static PyObject *__pyx_pw_5spacy_8pipeline_17_parser_internals_10stateclass_10StateClass_39E_(PyObject *__pyx_v_self, +#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_5spacy_8pipeline_17_parser_internals_10stateclass_10StateClass_38E_, "StateClass.E_(self, int i)"); +static PyMethodDef __pyx_mdef_5spacy_8pipeline_17_parser_internals_10stateclass_10StateClass_39E_ = {"E_", (PyCFunction)(void(*)(void))(__Pyx_PyCFunction_FastCallWithKeywords)__pyx_pw_5spacy_8pipeline_17_parser_internals_10stateclass_10StateClass_39E_, __Pyx_METH_FASTCALL|METH_KEYWORDS, __pyx_doc_5spacy_8pipeline_17_parser_internals_10stateclass_10StateClass_38E_}; +static PyObject *__pyx_pw_5spacy_8pipeline_17_parser_internals_10stateclass_10StateClass_39E_(PyObject *__pyx_v_self, +#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_i; + #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("E_ (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_i,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, 119, __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, 119, __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, "E_", 0) < (0)) __PYX_ERR(0, 119, __pyx_L3_error) + for (Py_ssize_t i = __pyx_nargs; i < 1; i++) { + if (unlikely(!values[i])) { __Pyx_RaiseArgtupleInvalid("E_", 1, 1, 1, i); __PYX_ERR(0, 119, __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, 119, __pyx_L3_error) + } + __pyx_v_i = __Pyx_PyLong_As_int(values[0]); if (unlikely((__pyx_v_i == (int)-1) && PyErr_Occurred())) __PYX_ERR(0, 119, __pyx_L3_error) + } + goto __pyx_L6_skip; + __pyx_L5_argtuple_error:; + __Pyx_RaiseArgtupleInvalid("E_", 1, 1, 1, __pyx_nargs); __PYX_ERR(0, 119, __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("spacy.pipeline._parser_internals.stateclass.StateClass.E_", __pyx_clineno, __pyx_lineno, __pyx_filename); + __Pyx_RefNannyFinishContext(); + return NULL; + __pyx_L4_argument_unpacking_done:; + __pyx_r = __pyx_pf_5spacy_8pipeline_17_parser_internals_10stateclass_10StateClass_38E_(((struct __pyx_obj_5spacy_8pipeline_17_parser_internals_10stateclass_StateClass *)__pyx_v_self), __pyx_v_i); + + /* 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_5spacy_8pipeline_17_parser_internals_10stateclass_10StateClass_38E_(struct __pyx_obj_5spacy_8pipeline_17_parser_internals_10stateclass_StateClass *__pyx_v_self, int __pyx_v_i) { + 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("E_", 0); + + /* "spacy/pipeline/_parser_internals/stateclass.pyx":120 + * + * def E_(self, int i): + * return self.doc[self.c.E(i)] # <<<<<<<<<<<<<< + * + * def L_(self, int i, int idx): +*/ + __Pyx_XDECREF(__pyx_r); + __pyx_t_1 = __pyx_v_self->c->E(__pyx_v_i); + __pyx_t_2 = __Pyx_GetItemInt(((PyObject *)__pyx_v_self->doc), __pyx_t_1, int, 1, __Pyx_PyLong_From_int, 0, 1, 1, 1, __Pyx_ReferenceSharing_SharedReference); if (unlikely(!__pyx_t_2)) __PYX_ERR(0, 120, __pyx_L1_error) + __Pyx_GOTREF(__pyx_t_2); + __pyx_r = __pyx_t_2; + __pyx_t_2 = 0; + goto __pyx_L0; + + /* "spacy/pipeline/_parser_internals/stateclass.pyx":119 + * return self.doc[self.c.H(i)] + * + * def E_(self, int i): # <<<<<<<<<<<<<< + * return self.doc[self.c.E(i)] + * +*/ + + /* function exit code */ + __pyx_L1_error:; + __Pyx_XDECREF(__pyx_t_2); + __Pyx_AddTraceback("spacy.pipeline._parser_internals.stateclass.StateClass.E_", __pyx_clineno, __pyx_lineno, __pyx_filename); + __pyx_r = NULL; + __pyx_L0:; + __Pyx_XGIVEREF(__pyx_r); + __Pyx_RefNannyFinishContext(); + return __pyx_r; +} + +/* "spacy/pipeline/_parser_internals/stateclass.pyx":122 + * return self.doc[self.c.E(i)] + * + * def L_(self, int i, int idx): # <<<<<<<<<<<<<< + * return self.doc[self.c.L(i, idx)] + * +*/ + +/* Python wrapper */ +static PyObject *__pyx_pw_5spacy_8pipeline_17_parser_internals_10stateclass_10StateClass_41L_(PyObject *__pyx_v_self, +#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_5spacy_8pipeline_17_parser_internals_10stateclass_10StateClass_40L_, "StateClass.L_(self, int i, int idx)"); +static PyMethodDef __pyx_mdef_5spacy_8pipeline_17_parser_internals_10stateclass_10StateClass_41L_ = {"L_", (PyCFunction)(void(*)(void))(__Pyx_PyCFunction_FastCallWithKeywords)__pyx_pw_5spacy_8pipeline_17_parser_internals_10stateclass_10StateClass_41L_, __Pyx_METH_FASTCALL|METH_KEYWORDS, __pyx_doc_5spacy_8pipeline_17_parser_internals_10stateclass_10StateClass_40L_}; +static PyObject *__pyx_pw_5spacy_8pipeline_17_parser_internals_10stateclass_10StateClass_41L_(PyObject *__pyx_v_self, +#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_i; + int __pyx_v_idx; + #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("L_ (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_i,&__pyx_mstate_global->__pyx_n_u_idx,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, 122, __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, 122, __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, 122, __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, "L_", 0) < (0)) __PYX_ERR(0, 122, __pyx_L3_error) + for (Py_ssize_t i = __pyx_nargs; i < 2; i++) { + if (unlikely(!values[i])) { __Pyx_RaiseArgtupleInvalid("L_", 1, 2, 2, i); __PYX_ERR(0, 122, __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, 122, __pyx_L3_error) + values[1] = __Pyx_ArgRef_FASTCALL(__pyx_args, 1); + if (!CYTHON_ASSUME_SAFE_MACROS && unlikely(!values[1])) __PYX_ERR(0, 122, __pyx_L3_error) + } + __pyx_v_i = __Pyx_PyLong_As_int(values[0]); if (unlikely((__pyx_v_i == (int)-1) && PyErr_Occurred())) __PYX_ERR(0, 122, __pyx_L3_error) + __pyx_v_idx = __Pyx_PyLong_As_int(values[1]); if (unlikely((__pyx_v_idx == (int)-1) && PyErr_Occurred())) __PYX_ERR(0, 122, __pyx_L3_error) + } + goto __pyx_L6_skip; + __pyx_L5_argtuple_error:; + __Pyx_RaiseArgtupleInvalid("L_", 1, 2, 2, __pyx_nargs); __PYX_ERR(0, 122, __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("spacy.pipeline._parser_internals.stateclass.StateClass.L_", __pyx_clineno, __pyx_lineno, __pyx_filename); + __Pyx_RefNannyFinishContext(); + return NULL; + __pyx_L4_argument_unpacking_done:; + __pyx_r = __pyx_pf_5spacy_8pipeline_17_parser_internals_10stateclass_10StateClass_40L_(((struct __pyx_obj_5spacy_8pipeline_17_parser_internals_10stateclass_StateClass *)__pyx_v_self), __pyx_v_i, __pyx_v_idx); + + /* 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_5spacy_8pipeline_17_parser_internals_10stateclass_10StateClass_40L_(struct __pyx_obj_5spacy_8pipeline_17_parser_internals_10stateclass_StateClass *__pyx_v_self, int __pyx_v_i, int __pyx_v_idx) { + 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("L_", 0); + + /* "spacy/pipeline/_parser_internals/stateclass.pyx":123 + * + * def L_(self, int i, int idx): + * return self.doc[self.c.L(i, idx)] # <<<<<<<<<<<<<< + * + * def R_(self, int i, int idx): +*/ + __Pyx_XDECREF(__pyx_r); + __pyx_t_1 = __pyx_v_self->c->L(__pyx_v_i, __pyx_v_idx); + __pyx_t_2 = __Pyx_GetItemInt(((PyObject *)__pyx_v_self->doc), __pyx_t_1, int, 1, __Pyx_PyLong_From_int, 0, 1, 1, 1, __Pyx_ReferenceSharing_SharedReference); if (unlikely(!__pyx_t_2)) __PYX_ERR(0, 123, __pyx_L1_error) + __Pyx_GOTREF(__pyx_t_2); + __pyx_r = __pyx_t_2; + __pyx_t_2 = 0; + goto __pyx_L0; + + /* "spacy/pipeline/_parser_internals/stateclass.pyx":122 + * return self.doc[self.c.E(i)] + * + * def L_(self, int i, int idx): # <<<<<<<<<<<<<< + * return self.doc[self.c.L(i, idx)] + * +*/ + + /* function exit code */ + __pyx_L1_error:; + __Pyx_XDECREF(__pyx_t_2); + __Pyx_AddTraceback("spacy.pipeline._parser_internals.stateclass.StateClass.L_", __pyx_clineno, __pyx_lineno, __pyx_filename); + __pyx_r = NULL; + __pyx_L0:; + __Pyx_XGIVEREF(__pyx_r); + __Pyx_RefNannyFinishContext(); + return __pyx_r; +} + +/* "spacy/pipeline/_parser_internals/stateclass.pyx":125 + * return self.doc[self.c.L(i, idx)] + * + * def R_(self, int i, int idx): # <<<<<<<<<<<<<< + * return self.doc[self.c.R(i, idx)] + * +*/ + +/* Python wrapper */ +static PyObject *__pyx_pw_5spacy_8pipeline_17_parser_internals_10stateclass_10StateClass_43R_(PyObject *__pyx_v_self, +#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_5spacy_8pipeline_17_parser_internals_10stateclass_10StateClass_42R_, "StateClass.R_(self, int i, int idx)"); +static PyMethodDef __pyx_mdef_5spacy_8pipeline_17_parser_internals_10stateclass_10StateClass_43R_ = {"R_", (PyCFunction)(void(*)(void))(__Pyx_PyCFunction_FastCallWithKeywords)__pyx_pw_5spacy_8pipeline_17_parser_internals_10stateclass_10StateClass_43R_, __Pyx_METH_FASTCALL|METH_KEYWORDS, __pyx_doc_5spacy_8pipeline_17_parser_internals_10stateclass_10StateClass_42R_}; +static PyObject *__pyx_pw_5spacy_8pipeline_17_parser_internals_10stateclass_10StateClass_43R_(PyObject *__pyx_v_self, +#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_i; + int __pyx_v_idx; + #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("R_ (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_i,&__pyx_mstate_global->__pyx_n_u_idx,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, 125, __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, 125, __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, 125, __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, "R_", 0) < (0)) __PYX_ERR(0, 125, __pyx_L3_error) + for (Py_ssize_t i = __pyx_nargs; i < 2; i++) { + if (unlikely(!values[i])) { __Pyx_RaiseArgtupleInvalid("R_", 1, 2, 2, i); __PYX_ERR(0, 125, __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, 125, __pyx_L3_error) + values[1] = __Pyx_ArgRef_FASTCALL(__pyx_args, 1); + if (!CYTHON_ASSUME_SAFE_MACROS && unlikely(!values[1])) __PYX_ERR(0, 125, __pyx_L3_error) + } + __pyx_v_i = __Pyx_PyLong_As_int(values[0]); if (unlikely((__pyx_v_i == (int)-1) && PyErr_Occurred())) __PYX_ERR(0, 125, __pyx_L3_error) + __pyx_v_idx = __Pyx_PyLong_As_int(values[1]); if (unlikely((__pyx_v_idx == (int)-1) && PyErr_Occurred())) __PYX_ERR(0, 125, __pyx_L3_error) + } + goto __pyx_L6_skip; + __pyx_L5_argtuple_error:; + __Pyx_RaiseArgtupleInvalid("R_", 1, 2, 2, __pyx_nargs); __PYX_ERR(0, 125, __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("spacy.pipeline._parser_internals.stateclass.StateClass.R_", __pyx_clineno, __pyx_lineno, __pyx_filename); + __Pyx_RefNannyFinishContext(); + return NULL; + __pyx_L4_argument_unpacking_done:; + __pyx_r = __pyx_pf_5spacy_8pipeline_17_parser_internals_10stateclass_10StateClass_42R_(((struct __pyx_obj_5spacy_8pipeline_17_parser_internals_10stateclass_StateClass *)__pyx_v_self), __pyx_v_i, __pyx_v_idx); + + /* 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_5spacy_8pipeline_17_parser_internals_10stateclass_10StateClass_42R_(struct __pyx_obj_5spacy_8pipeline_17_parser_internals_10stateclass_StateClass *__pyx_v_self, int __pyx_v_i, int __pyx_v_idx) { + 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("R_", 0); + + /* "spacy/pipeline/_parser_internals/stateclass.pyx":126 + * + * def R_(self, int i, int idx): + * return self.doc[self.c.R(i, idx)] # <<<<<<<<<<<<<< + * + * def empty(self): +*/ + __Pyx_XDECREF(__pyx_r); + __pyx_t_1 = __pyx_v_self->c->R(__pyx_v_i, __pyx_v_idx); + __pyx_t_2 = __Pyx_GetItemInt(((PyObject *)__pyx_v_self->doc), __pyx_t_1, int, 1, __Pyx_PyLong_From_int, 0, 1, 1, 1, __Pyx_ReferenceSharing_SharedReference); if (unlikely(!__pyx_t_2)) __PYX_ERR(0, 126, __pyx_L1_error) + __Pyx_GOTREF(__pyx_t_2); + __pyx_r = __pyx_t_2; + __pyx_t_2 = 0; + goto __pyx_L0; + + /* "spacy/pipeline/_parser_internals/stateclass.pyx":125 + * return self.doc[self.c.L(i, idx)] + * + * def R_(self, int i, int idx): # <<<<<<<<<<<<<< + * return self.doc[self.c.R(i, idx)] + * +*/ + + /* function exit code */ + __pyx_L1_error:; + __Pyx_XDECREF(__pyx_t_2); + __Pyx_AddTraceback("spacy.pipeline._parser_internals.stateclass.StateClass.R_", __pyx_clineno, __pyx_lineno, __pyx_filename); + __pyx_r = NULL; + __pyx_L0:; + __Pyx_XGIVEREF(__pyx_r); + __Pyx_RefNannyFinishContext(); + return __pyx_r; +} + +/* "spacy/pipeline/_parser_internals/stateclass.pyx":128 + * return self.doc[self.c.R(i, idx)] + * + * def empty(self): # <<<<<<<<<<<<<< + * return self.c.empty() + * +*/ + +/* Python wrapper */ +static PyObject *__pyx_pw_5spacy_8pipeline_17_parser_internals_10stateclass_10StateClass_45empty(PyObject *__pyx_v_self, +#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_5spacy_8pipeline_17_parser_internals_10stateclass_10StateClass_44empty, "StateClass.empty(self)"); +static PyMethodDef __pyx_mdef_5spacy_8pipeline_17_parser_internals_10stateclass_10StateClass_45empty = {"empty", (PyCFunction)(void(*)(void))(__Pyx_PyCFunction_FastCallWithKeywords)__pyx_pw_5spacy_8pipeline_17_parser_internals_10stateclass_10StateClass_45empty, __Pyx_METH_FASTCALL|METH_KEYWORDS, __pyx_doc_5spacy_8pipeline_17_parser_internals_10stateclass_10StateClass_44empty}; +static PyObject *__pyx_pw_5spacy_8pipeline_17_parser_internals_10stateclass_10StateClass_45empty(PyObject *__pyx_v_self, +#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("empty (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("empty", 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("empty", __pyx_kwds); return NULL;} + __pyx_r = __pyx_pf_5spacy_8pipeline_17_parser_internals_10stateclass_10StateClass_44empty(((struct __pyx_obj_5spacy_8pipeline_17_parser_internals_10stateclass_StateClass *)__pyx_v_self)); + + /* function exit code */ + __Pyx_RefNannyFinishContext(); + return __pyx_r; +} + +static PyObject *__pyx_pf_5spacy_8pipeline_17_parser_internals_10stateclass_10StateClass_44empty(struct __pyx_obj_5spacy_8pipeline_17_parser_internals_10stateclass_StateClass *__pyx_v_self) { + PyObject *__pyx_r = NULL; + __Pyx_RefNannyDeclarations + PyObject *__pyx_t_1 = NULL; + int __pyx_lineno = 0; + const char *__pyx_filename = NULL; + int __pyx_clineno = 0; + __Pyx_RefNannySetupContext("empty", 0); + + /* "spacy/pipeline/_parser_internals/stateclass.pyx":129 + * + * def empty(self): + * return self.c.empty() # <<<<<<<<<<<<<< + * + * def eol(self): +*/ + __Pyx_XDECREF(__pyx_r); + __pyx_t_1 = __Pyx_PyBool_FromLong(__pyx_v_self->c->empty()); if (unlikely(!__pyx_t_1)) __PYX_ERR(0, 129, __pyx_L1_error) + __Pyx_GOTREF(__pyx_t_1); + __pyx_r = __pyx_t_1; + __pyx_t_1 = 0; + goto __pyx_L0; + + /* "spacy/pipeline/_parser_internals/stateclass.pyx":128 + * return self.doc[self.c.R(i, idx)] + * + * def empty(self): # <<<<<<<<<<<<<< + * return self.c.empty() + * +*/ + + /* function exit code */ + __pyx_L1_error:; + __Pyx_XDECREF(__pyx_t_1); + __Pyx_AddTraceback("spacy.pipeline._parser_internals.stateclass.StateClass.empty", __pyx_clineno, __pyx_lineno, __pyx_filename); + __pyx_r = NULL; + __pyx_L0:; + __Pyx_XGIVEREF(__pyx_r); + __Pyx_RefNannyFinishContext(); + return __pyx_r; +} + +/* "spacy/pipeline/_parser_internals/stateclass.pyx":131 + * return self.c.empty() + * + * def eol(self): # <<<<<<<<<<<<<< + * return self.c.eol() + * +*/ + +/* Python wrapper */ +static PyObject *__pyx_pw_5spacy_8pipeline_17_parser_internals_10stateclass_10StateClass_47eol(PyObject *__pyx_v_self, +#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_5spacy_8pipeline_17_parser_internals_10stateclass_10StateClass_46eol, "StateClass.eol(self)"); +static PyMethodDef __pyx_mdef_5spacy_8pipeline_17_parser_internals_10stateclass_10StateClass_47eol = {"eol", (PyCFunction)(void(*)(void))(__Pyx_PyCFunction_FastCallWithKeywords)__pyx_pw_5spacy_8pipeline_17_parser_internals_10stateclass_10StateClass_47eol, __Pyx_METH_FASTCALL|METH_KEYWORDS, __pyx_doc_5spacy_8pipeline_17_parser_internals_10stateclass_10StateClass_46eol}; +static PyObject *__pyx_pw_5spacy_8pipeline_17_parser_internals_10stateclass_10StateClass_47eol(PyObject *__pyx_v_self, +#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("eol (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("eol", 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("eol", __pyx_kwds); return NULL;} + __pyx_r = __pyx_pf_5spacy_8pipeline_17_parser_internals_10stateclass_10StateClass_46eol(((struct __pyx_obj_5spacy_8pipeline_17_parser_internals_10stateclass_StateClass *)__pyx_v_self)); + + /* function exit code */ + __Pyx_RefNannyFinishContext(); + return __pyx_r; +} + +static PyObject *__pyx_pf_5spacy_8pipeline_17_parser_internals_10stateclass_10StateClass_46eol(struct __pyx_obj_5spacy_8pipeline_17_parser_internals_10stateclass_StateClass *__pyx_v_self) { + PyObject *__pyx_r = NULL; + __Pyx_RefNannyDeclarations + PyObject *__pyx_t_1 = NULL; + int __pyx_lineno = 0; + const char *__pyx_filename = NULL; + int __pyx_clineno = 0; + __Pyx_RefNannySetupContext("eol", 0); + + /* "spacy/pipeline/_parser_internals/stateclass.pyx":132 + * + * def eol(self): + * return self.c.eol() # <<<<<<<<<<<<<< + * + * def at_break(self): +*/ + __Pyx_XDECREF(__pyx_r); + __pyx_t_1 = __Pyx_PyBool_FromLong(__pyx_v_self->c->eol()); if (unlikely(!__pyx_t_1)) __PYX_ERR(0, 132, __pyx_L1_error) + __Pyx_GOTREF(__pyx_t_1); + __pyx_r = __pyx_t_1; + __pyx_t_1 = 0; + goto __pyx_L0; + + /* "spacy/pipeline/_parser_internals/stateclass.pyx":131 + * return self.c.empty() + * + * def eol(self): # <<<<<<<<<<<<<< + * return self.c.eol() + * +*/ + + /* function exit code */ + __pyx_L1_error:; + __Pyx_XDECREF(__pyx_t_1); + __Pyx_AddTraceback("spacy.pipeline._parser_internals.stateclass.StateClass.eol", __pyx_clineno, __pyx_lineno, __pyx_filename); + __pyx_r = NULL; + __pyx_L0:; + __Pyx_XGIVEREF(__pyx_r); + __Pyx_RefNannyFinishContext(); + return __pyx_r; +} + +/* "spacy/pipeline/_parser_internals/stateclass.pyx":134 + * return self.c.eol() + * + * def at_break(self): # <<<<<<<<<<<<<< + * return False + * # return self.c.at_break() +*/ + +/* Python wrapper */ +static PyObject *__pyx_pw_5spacy_8pipeline_17_parser_internals_10stateclass_10StateClass_49at_break(PyObject *__pyx_v_self, +#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_5spacy_8pipeline_17_parser_internals_10stateclass_10StateClass_48at_break, "StateClass.at_break(self)"); +static PyMethodDef __pyx_mdef_5spacy_8pipeline_17_parser_internals_10stateclass_10StateClass_49at_break = {"at_break", (PyCFunction)(void(*)(void))(__Pyx_PyCFunction_FastCallWithKeywords)__pyx_pw_5spacy_8pipeline_17_parser_internals_10stateclass_10StateClass_49at_break, __Pyx_METH_FASTCALL|METH_KEYWORDS, __pyx_doc_5spacy_8pipeline_17_parser_internals_10stateclass_10StateClass_48at_break}; +static PyObject *__pyx_pw_5spacy_8pipeline_17_parser_internals_10stateclass_10StateClass_49at_break(PyObject *__pyx_v_self, +#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("at_break (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("at_break", 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("at_break", __pyx_kwds); return NULL;} + __pyx_r = __pyx_pf_5spacy_8pipeline_17_parser_internals_10stateclass_10StateClass_48at_break(((struct __pyx_obj_5spacy_8pipeline_17_parser_internals_10stateclass_StateClass *)__pyx_v_self)); + + /* function exit code */ + __Pyx_RefNannyFinishContext(); + return __pyx_r; +} + +static PyObject *__pyx_pf_5spacy_8pipeline_17_parser_internals_10stateclass_10StateClass_48at_break(CYTHON_UNUSED struct __pyx_obj_5spacy_8pipeline_17_parser_internals_10stateclass_StateClass *__pyx_v_self) { + PyObject *__pyx_r = NULL; + __Pyx_RefNannyDeclarations + __Pyx_RefNannySetupContext("at_break", 0); + + /* "spacy/pipeline/_parser_internals/stateclass.pyx":135 + * + * def at_break(self): + * return False # <<<<<<<<<<<<<< + * # return self.c.at_break() + * +*/ + __Pyx_XDECREF(__pyx_r); + __Pyx_INCREF(Py_False); + __pyx_r = Py_False; + goto __pyx_L0; + + /* "spacy/pipeline/_parser_internals/stateclass.pyx":134 + * return self.c.eol() + * + * def at_break(self): # <<<<<<<<<<<<<< + * return False + * # return self.c.at_break() +*/ + + /* function exit code */ + __pyx_L0:; + __Pyx_XGIVEREF(__pyx_r); + __Pyx_RefNannyFinishContext(); + return __pyx_r; +} + +/* "spacy/pipeline/_parser_internals/stateclass.pyx":138 + * # return self.c.at_break() + * + * def has_head(self, int i): # <<<<<<<<<<<<<< + * return self.c.has_head(i) + * +*/ + +/* Python wrapper */ +static PyObject *__pyx_pw_5spacy_8pipeline_17_parser_internals_10stateclass_10StateClass_51has_head(PyObject *__pyx_v_self, +#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_5spacy_8pipeline_17_parser_internals_10stateclass_10StateClass_50has_head, "StateClass.has_head(self, int i)"); +static PyMethodDef __pyx_mdef_5spacy_8pipeline_17_parser_internals_10stateclass_10StateClass_51has_head = {"has_head", (PyCFunction)(void(*)(void))(__Pyx_PyCFunction_FastCallWithKeywords)__pyx_pw_5spacy_8pipeline_17_parser_internals_10stateclass_10StateClass_51has_head, __Pyx_METH_FASTCALL|METH_KEYWORDS, __pyx_doc_5spacy_8pipeline_17_parser_internals_10stateclass_10StateClass_50has_head}; +static PyObject *__pyx_pw_5spacy_8pipeline_17_parser_internals_10stateclass_10StateClass_51has_head(PyObject *__pyx_v_self, +#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_i; + #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("has_head (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_i,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, 138, __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, 138, __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, "has_head", 0) < (0)) __PYX_ERR(0, 138, __pyx_L3_error) + for (Py_ssize_t i = __pyx_nargs; i < 1; i++) { + if (unlikely(!values[i])) { __Pyx_RaiseArgtupleInvalid("has_head", 1, 1, 1, i); __PYX_ERR(0, 138, __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, 138, __pyx_L3_error) + } + __pyx_v_i = __Pyx_PyLong_As_int(values[0]); if (unlikely((__pyx_v_i == (int)-1) && PyErr_Occurred())) __PYX_ERR(0, 138, __pyx_L3_error) + } + goto __pyx_L6_skip; + __pyx_L5_argtuple_error:; + __Pyx_RaiseArgtupleInvalid("has_head", 1, 1, 1, __pyx_nargs); __PYX_ERR(0, 138, __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("spacy.pipeline._parser_internals.stateclass.StateClass.has_head", __pyx_clineno, __pyx_lineno, __pyx_filename); + __Pyx_RefNannyFinishContext(); + return NULL; + __pyx_L4_argument_unpacking_done:; + __pyx_r = __pyx_pf_5spacy_8pipeline_17_parser_internals_10stateclass_10StateClass_50has_head(((struct __pyx_obj_5spacy_8pipeline_17_parser_internals_10stateclass_StateClass *)__pyx_v_self), __pyx_v_i); + + /* 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_5spacy_8pipeline_17_parser_internals_10stateclass_10StateClass_50has_head(struct __pyx_obj_5spacy_8pipeline_17_parser_internals_10stateclass_StateClass *__pyx_v_self, int __pyx_v_i) { + 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("has_head", 0); + + /* "spacy/pipeline/_parser_internals/stateclass.pyx":139 + * + * def has_head(self, int i): + * return self.c.has_head(i) # <<<<<<<<<<<<<< + * + * def n_L(self, int i): +*/ + __Pyx_XDECREF(__pyx_r); + __pyx_t_1 = __Pyx_PyBool_FromLong(__pyx_v_self->c->has_head(__pyx_v_i)); if (unlikely(!__pyx_t_1)) __PYX_ERR(0, 139, __pyx_L1_error) + __Pyx_GOTREF(__pyx_t_1); + __pyx_r = __pyx_t_1; + __pyx_t_1 = 0; + goto __pyx_L0; + + /* "spacy/pipeline/_parser_internals/stateclass.pyx":138 + * # return self.c.at_break() + * + * def has_head(self, int i): # <<<<<<<<<<<<<< + * return self.c.has_head(i) + * +*/ + + /* function exit code */ + __pyx_L1_error:; + __Pyx_XDECREF(__pyx_t_1); + __Pyx_AddTraceback("spacy.pipeline._parser_internals.stateclass.StateClass.has_head", __pyx_clineno, __pyx_lineno, __pyx_filename); + __pyx_r = NULL; + __pyx_L0:; + __Pyx_XGIVEREF(__pyx_r); + __Pyx_RefNannyFinishContext(); + return __pyx_r; +} + +/* "spacy/pipeline/_parser_internals/stateclass.pyx":141 + * return self.c.has_head(i) + * + * def n_L(self, int i): # <<<<<<<<<<<<<< + * return self.c.n_L(i) + * +*/ + +/* Python wrapper */ +static PyObject *__pyx_pw_5spacy_8pipeline_17_parser_internals_10stateclass_10StateClass_53n_L(PyObject *__pyx_v_self, +#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_5spacy_8pipeline_17_parser_internals_10stateclass_10StateClass_52n_L, "StateClass.n_L(self, int i)"); +static PyMethodDef __pyx_mdef_5spacy_8pipeline_17_parser_internals_10stateclass_10StateClass_53n_L = {"n_L", (PyCFunction)(void(*)(void))(__Pyx_PyCFunction_FastCallWithKeywords)__pyx_pw_5spacy_8pipeline_17_parser_internals_10stateclass_10StateClass_53n_L, __Pyx_METH_FASTCALL|METH_KEYWORDS, __pyx_doc_5spacy_8pipeline_17_parser_internals_10stateclass_10StateClass_52n_L}; +static PyObject *__pyx_pw_5spacy_8pipeline_17_parser_internals_10stateclass_10StateClass_53n_L(PyObject *__pyx_v_self, +#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_i; + #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("n_L (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_i,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, 141, __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, 141, __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, "n_L", 0) < (0)) __PYX_ERR(0, 141, __pyx_L3_error) + for (Py_ssize_t i = __pyx_nargs; i < 1; i++) { + if (unlikely(!values[i])) { __Pyx_RaiseArgtupleInvalid("n_L", 1, 1, 1, i); __PYX_ERR(0, 141, __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, 141, __pyx_L3_error) + } + __pyx_v_i = __Pyx_PyLong_As_int(values[0]); if (unlikely((__pyx_v_i == (int)-1) && PyErr_Occurred())) __PYX_ERR(0, 141, __pyx_L3_error) + } + goto __pyx_L6_skip; + __pyx_L5_argtuple_error:; + __Pyx_RaiseArgtupleInvalid("n_L", 1, 1, 1, __pyx_nargs); __PYX_ERR(0, 141, __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("spacy.pipeline._parser_internals.stateclass.StateClass.n_L", __pyx_clineno, __pyx_lineno, __pyx_filename); + __Pyx_RefNannyFinishContext(); + return NULL; + __pyx_L4_argument_unpacking_done:; + __pyx_r = __pyx_pf_5spacy_8pipeline_17_parser_internals_10stateclass_10StateClass_52n_L(((struct __pyx_obj_5spacy_8pipeline_17_parser_internals_10stateclass_StateClass *)__pyx_v_self), __pyx_v_i); + + /* 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_5spacy_8pipeline_17_parser_internals_10stateclass_10StateClass_52n_L(struct __pyx_obj_5spacy_8pipeline_17_parser_internals_10stateclass_StateClass *__pyx_v_self, int __pyx_v_i) { + 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("n_L", 0); + + /* "spacy/pipeline/_parser_internals/stateclass.pyx":142 + * + * def n_L(self, int i): + * return self.c.n_L(i) # <<<<<<<<<<<<<< + * + * def n_R(self, int i): +*/ + __Pyx_XDECREF(__pyx_r); + __pyx_t_1 = __Pyx_PyLong_From_int(__pyx_v_self->c->n_L(__pyx_v_i)); if (unlikely(!__pyx_t_1)) __PYX_ERR(0, 142, __pyx_L1_error) + __Pyx_GOTREF(__pyx_t_1); + __pyx_r = __pyx_t_1; + __pyx_t_1 = 0; + goto __pyx_L0; + + /* "spacy/pipeline/_parser_internals/stateclass.pyx":141 + * return self.c.has_head(i) + * + * def n_L(self, int i): # <<<<<<<<<<<<<< + * return self.c.n_L(i) + * +*/ + + /* function exit code */ + __pyx_L1_error:; + __Pyx_XDECREF(__pyx_t_1); + __Pyx_AddTraceback("spacy.pipeline._parser_internals.stateclass.StateClass.n_L", __pyx_clineno, __pyx_lineno, __pyx_filename); + __pyx_r = NULL; + __pyx_L0:; + __Pyx_XGIVEREF(__pyx_r); + __Pyx_RefNannyFinishContext(); + return __pyx_r; +} + +/* "spacy/pipeline/_parser_internals/stateclass.pyx":144 + * return self.c.n_L(i) + * + * def n_R(self, int i): # <<<<<<<<<<<<<< + * return self.c.n_R(i) + * +*/ + +/* Python wrapper */ +static PyObject *__pyx_pw_5spacy_8pipeline_17_parser_internals_10stateclass_10StateClass_55n_R(PyObject *__pyx_v_self, +#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_5spacy_8pipeline_17_parser_internals_10stateclass_10StateClass_54n_R, "StateClass.n_R(self, int i)"); +static PyMethodDef __pyx_mdef_5spacy_8pipeline_17_parser_internals_10stateclass_10StateClass_55n_R = {"n_R", (PyCFunction)(void(*)(void))(__Pyx_PyCFunction_FastCallWithKeywords)__pyx_pw_5spacy_8pipeline_17_parser_internals_10stateclass_10StateClass_55n_R, __Pyx_METH_FASTCALL|METH_KEYWORDS, __pyx_doc_5spacy_8pipeline_17_parser_internals_10stateclass_10StateClass_54n_R}; +static PyObject *__pyx_pw_5spacy_8pipeline_17_parser_internals_10stateclass_10StateClass_55n_R(PyObject *__pyx_v_self, +#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_i; + #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("n_R (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_i,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, 144, __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, 144, __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, "n_R", 0) < (0)) __PYX_ERR(0, 144, __pyx_L3_error) + for (Py_ssize_t i = __pyx_nargs; i < 1; i++) { + if (unlikely(!values[i])) { __Pyx_RaiseArgtupleInvalid("n_R", 1, 1, 1, i); __PYX_ERR(0, 144, __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, 144, __pyx_L3_error) + } + __pyx_v_i = __Pyx_PyLong_As_int(values[0]); if (unlikely((__pyx_v_i == (int)-1) && PyErr_Occurred())) __PYX_ERR(0, 144, __pyx_L3_error) + } + goto __pyx_L6_skip; + __pyx_L5_argtuple_error:; + __Pyx_RaiseArgtupleInvalid("n_R", 1, 1, 1, __pyx_nargs); __PYX_ERR(0, 144, __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("spacy.pipeline._parser_internals.stateclass.StateClass.n_R", __pyx_clineno, __pyx_lineno, __pyx_filename); + __Pyx_RefNannyFinishContext(); + return NULL; + __pyx_L4_argument_unpacking_done:; + __pyx_r = __pyx_pf_5spacy_8pipeline_17_parser_internals_10stateclass_10StateClass_54n_R(((struct __pyx_obj_5spacy_8pipeline_17_parser_internals_10stateclass_StateClass *)__pyx_v_self), __pyx_v_i); + + /* 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_5spacy_8pipeline_17_parser_internals_10stateclass_10StateClass_54n_R(struct __pyx_obj_5spacy_8pipeline_17_parser_internals_10stateclass_StateClass *__pyx_v_self, int __pyx_v_i) { + 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("n_R", 0); + + /* "spacy/pipeline/_parser_internals/stateclass.pyx":145 + * + * def n_R(self, int i): + * return self.c.n_R(i) # <<<<<<<<<<<<<< + * + * def entity_is_open(self): +*/ + __Pyx_XDECREF(__pyx_r); + __pyx_t_1 = __Pyx_PyLong_From_int(__pyx_v_self->c->n_R(__pyx_v_i)); if (unlikely(!__pyx_t_1)) __PYX_ERR(0, 145, __pyx_L1_error) + __Pyx_GOTREF(__pyx_t_1); + __pyx_r = __pyx_t_1; + __pyx_t_1 = 0; + goto __pyx_L0; + + /* "spacy/pipeline/_parser_internals/stateclass.pyx":144 + * return self.c.n_L(i) + * + * def n_R(self, int i): # <<<<<<<<<<<<<< + * return self.c.n_R(i) + * +*/ + + /* function exit code */ + __pyx_L1_error:; + __Pyx_XDECREF(__pyx_t_1); + __Pyx_AddTraceback("spacy.pipeline._parser_internals.stateclass.StateClass.n_R", __pyx_clineno, __pyx_lineno, __pyx_filename); + __pyx_r = NULL; + __pyx_L0:; + __Pyx_XGIVEREF(__pyx_r); + __Pyx_RefNannyFinishContext(); + return __pyx_r; +} + +/* "spacy/pipeline/_parser_internals/stateclass.pyx":147 + * return self.c.n_R(i) + * + * def entity_is_open(self): # <<<<<<<<<<<<<< + * return self.c.entity_is_open() + * +*/ + +/* Python wrapper */ +static PyObject *__pyx_pw_5spacy_8pipeline_17_parser_internals_10stateclass_10StateClass_57entity_is_open(PyObject *__pyx_v_self, +#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_5spacy_8pipeline_17_parser_internals_10stateclass_10StateClass_56entity_is_open, "StateClass.entity_is_open(self)"); +static PyMethodDef __pyx_mdef_5spacy_8pipeline_17_parser_internals_10stateclass_10StateClass_57entity_is_open = {"entity_is_open", (PyCFunction)(void(*)(void))(__Pyx_PyCFunction_FastCallWithKeywords)__pyx_pw_5spacy_8pipeline_17_parser_internals_10stateclass_10StateClass_57entity_is_open, __Pyx_METH_FASTCALL|METH_KEYWORDS, __pyx_doc_5spacy_8pipeline_17_parser_internals_10stateclass_10StateClass_56entity_is_open}; +static PyObject *__pyx_pw_5spacy_8pipeline_17_parser_internals_10stateclass_10StateClass_57entity_is_open(PyObject *__pyx_v_self, +#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("entity_is_open (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("entity_is_open", 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("entity_is_open", __pyx_kwds); return NULL;} + __pyx_r = __pyx_pf_5spacy_8pipeline_17_parser_internals_10stateclass_10StateClass_56entity_is_open(((struct __pyx_obj_5spacy_8pipeline_17_parser_internals_10stateclass_StateClass *)__pyx_v_self)); + + /* function exit code */ + __Pyx_RefNannyFinishContext(); + return __pyx_r; +} + +static PyObject *__pyx_pf_5spacy_8pipeline_17_parser_internals_10stateclass_10StateClass_56entity_is_open(struct __pyx_obj_5spacy_8pipeline_17_parser_internals_10stateclass_StateClass *__pyx_v_self) { + PyObject *__pyx_r = NULL; + __Pyx_RefNannyDeclarations + PyObject *__pyx_t_1 = NULL; + int __pyx_lineno = 0; + const char *__pyx_filename = NULL; + int __pyx_clineno = 0; + __Pyx_RefNannySetupContext("entity_is_open", 0); + + /* "spacy/pipeline/_parser_internals/stateclass.pyx":148 + * + * def entity_is_open(self): + * return self.c.entity_is_open() # <<<<<<<<<<<<<< + * + * def stack_depth(self): +*/ + __Pyx_XDECREF(__pyx_r); + __pyx_t_1 = __Pyx_PyBool_FromLong(__pyx_v_self->c->entity_is_open()); if (unlikely(!__pyx_t_1)) __PYX_ERR(0, 148, __pyx_L1_error) + __Pyx_GOTREF(__pyx_t_1); + __pyx_r = __pyx_t_1; + __pyx_t_1 = 0; + goto __pyx_L0; + + /* "spacy/pipeline/_parser_internals/stateclass.pyx":147 + * return self.c.n_R(i) + * + * def entity_is_open(self): # <<<<<<<<<<<<<< + * return self.c.entity_is_open() + * +*/ + + /* function exit code */ + __pyx_L1_error:; + __Pyx_XDECREF(__pyx_t_1); + __Pyx_AddTraceback("spacy.pipeline._parser_internals.stateclass.StateClass.entity_is_open", __pyx_clineno, __pyx_lineno, __pyx_filename); + __pyx_r = NULL; + __pyx_L0:; + __Pyx_XGIVEREF(__pyx_r); + __Pyx_RefNannyFinishContext(); + return __pyx_r; +} + +/* "spacy/pipeline/_parser_internals/stateclass.pyx":150 + * return self.c.entity_is_open() + * + * def stack_depth(self): # <<<<<<<<<<<<<< + * return self.c.stack_depth() + * +*/ + +/* Python wrapper */ +static PyObject *__pyx_pw_5spacy_8pipeline_17_parser_internals_10stateclass_10StateClass_59stack_depth(PyObject *__pyx_v_self, +#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_5spacy_8pipeline_17_parser_internals_10stateclass_10StateClass_58stack_depth, "StateClass.stack_depth(self)"); +static PyMethodDef __pyx_mdef_5spacy_8pipeline_17_parser_internals_10stateclass_10StateClass_59stack_depth = {"stack_depth", (PyCFunction)(void(*)(void))(__Pyx_PyCFunction_FastCallWithKeywords)__pyx_pw_5spacy_8pipeline_17_parser_internals_10stateclass_10StateClass_59stack_depth, __Pyx_METH_FASTCALL|METH_KEYWORDS, __pyx_doc_5spacy_8pipeline_17_parser_internals_10stateclass_10StateClass_58stack_depth}; +static PyObject *__pyx_pw_5spacy_8pipeline_17_parser_internals_10stateclass_10StateClass_59stack_depth(PyObject *__pyx_v_self, +#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("stack_depth (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("stack_depth", 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("stack_depth", __pyx_kwds); return NULL;} + __pyx_r = __pyx_pf_5spacy_8pipeline_17_parser_internals_10stateclass_10StateClass_58stack_depth(((struct __pyx_obj_5spacy_8pipeline_17_parser_internals_10stateclass_StateClass *)__pyx_v_self)); + + /* function exit code */ + __Pyx_RefNannyFinishContext(); + return __pyx_r; +} + +static PyObject *__pyx_pf_5spacy_8pipeline_17_parser_internals_10stateclass_10StateClass_58stack_depth(struct __pyx_obj_5spacy_8pipeline_17_parser_internals_10stateclass_StateClass *__pyx_v_self) { + PyObject *__pyx_r = NULL; + __Pyx_RefNannyDeclarations + PyObject *__pyx_t_1 = NULL; + int __pyx_lineno = 0; + const char *__pyx_filename = NULL; + int __pyx_clineno = 0; + __Pyx_RefNannySetupContext("stack_depth", 0); + + /* "spacy/pipeline/_parser_internals/stateclass.pyx":151 + * + * def stack_depth(self): + * return self.c.stack_depth() # <<<<<<<<<<<<<< + * + * def buffer_length(self): +*/ + __Pyx_XDECREF(__pyx_r); + __pyx_t_1 = __Pyx_PyLong_From_int(__pyx_v_self->c->stack_depth()); if (unlikely(!__pyx_t_1)) __PYX_ERR(0, 151, __pyx_L1_error) + __Pyx_GOTREF(__pyx_t_1); + __pyx_r = __pyx_t_1; + __pyx_t_1 = 0; + goto __pyx_L0; + + /* "spacy/pipeline/_parser_internals/stateclass.pyx":150 + * return self.c.entity_is_open() + * + * def stack_depth(self): # <<<<<<<<<<<<<< + * return self.c.stack_depth() + * +*/ + + /* function exit code */ + __pyx_L1_error:; + __Pyx_XDECREF(__pyx_t_1); + __Pyx_AddTraceback("spacy.pipeline._parser_internals.stateclass.StateClass.stack_depth", __pyx_clineno, __pyx_lineno, __pyx_filename); + __pyx_r = NULL; + __pyx_L0:; + __Pyx_XGIVEREF(__pyx_r); + __Pyx_RefNannyFinishContext(); + return __pyx_r; +} + +/* "spacy/pipeline/_parser_internals/stateclass.pyx":153 + * return self.c.stack_depth() + * + * def buffer_length(self): # <<<<<<<<<<<<<< + * return self.c.buffer_length() + * +*/ + +/* Python wrapper */ +static PyObject *__pyx_pw_5spacy_8pipeline_17_parser_internals_10stateclass_10StateClass_61buffer_length(PyObject *__pyx_v_self, +#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_5spacy_8pipeline_17_parser_internals_10stateclass_10StateClass_60buffer_length, "StateClass.buffer_length(self)"); +static PyMethodDef __pyx_mdef_5spacy_8pipeline_17_parser_internals_10stateclass_10StateClass_61buffer_length = {"buffer_length", (PyCFunction)(void(*)(void))(__Pyx_PyCFunction_FastCallWithKeywords)__pyx_pw_5spacy_8pipeline_17_parser_internals_10stateclass_10StateClass_61buffer_length, __Pyx_METH_FASTCALL|METH_KEYWORDS, __pyx_doc_5spacy_8pipeline_17_parser_internals_10stateclass_10StateClass_60buffer_length}; +static PyObject *__pyx_pw_5spacy_8pipeline_17_parser_internals_10stateclass_10StateClass_61buffer_length(PyObject *__pyx_v_self, +#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("buffer_length (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("buffer_length", 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("buffer_length", __pyx_kwds); return NULL;} + __pyx_r = __pyx_pf_5spacy_8pipeline_17_parser_internals_10stateclass_10StateClass_60buffer_length(((struct __pyx_obj_5spacy_8pipeline_17_parser_internals_10stateclass_StateClass *)__pyx_v_self)); + + /* function exit code */ + __Pyx_RefNannyFinishContext(); + return __pyx_r; +} + +static PyObject *__pyx_pf_5spacy_8pipeline_17_parser_internals_10stateclass_10StateClass_60buffer_length(struct __pyx_obj_5spacy_8pipeline_17_parser_internals_10stateclass_StateClass *__pyx_v_self) { + PyObject *__pyx_r = NULL; + __Pyx_RefNannyDeclarations + PyObject *__pyx_t_1 = NULL; + int __pyx_lineno = 0; + const char *__pyx_filename = NULL; + int __pyx_clineno = 0; + __Pyx_RefNannySetupContext("buffer_length", 0); + + /* "spacy/pipeline/_parser_internals/stateclass.pyx":154 + * + * def buffer_length(self): + * return self.c.buffer_length() # <<<<<<<<<<<<<< + * + * def push(self): +*/ + __Pyx_XDECREF(__pyx_r); + __pyx_t_1 = __Pyx_PyLong_From_int(__pyx_v_self->c->buffer_length()); if (unlikely(!__pyx_t_1)) __PYX_ERR(0, 154, __pyx_L1_error) + __Pyx_GOTREF(__pyx_t_1); + __pyx_r = __pyx_t_1; + __pyx_t_1 = 0; + goto __pyx_L0; + + /* "spacy/pipeline/_parser_internals/stateclass.pyx":153 + * return self.c.stack_depth() + * + * def buffer_length(self): # <<<<<<<<<<<<<< + * return self.c.buffer_length() + * +*/ + + /* function exit code */ + __pyx_L1_error:; + __Pyx_XDECREF(__pyx_t_1); + __Pyx_AddTraceback("spacy.pipeline._parser_internals.stateclass.StateClass.buffer_length", __pyx_clineno, __pyx_lineno, __pyx_filename); + __pyx_r = NULL; + __pyx_L0:; + __Pyx_XGIVEREF(__pyx_r); + __Pyx_RefNannyFinishContext(); + return __pyx_r; +} + +/* "spacy/pipeline/_parser_internals/stateclass.pyx":156 + * return self.c.buffer_length() + * + * def push(self): # <<<<<<<<<<<<<< + * self.c.push() + * +*/ + +/* Python wrapper */ +static PyObject *__pyx_pw_5spacy_8pipeline_17_parser_internals_10stateclass_10StateClass_63push(PyObject *__pyx_v_self, +#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_5spacy_8pipeline_17_parser_internals_10stateclass_10StateClass_62push, "StateClass.push(self)"); +static PyMethodDef __pyx_mdef_5spacy_8pipeline_17_parser_internals_10stateclass_10StateClass_63push = {"push", (PyCFunction)(void(*)(void))(__Pyx_PyCFunction_FastCallWithKeywords)__pyx_pw_5spacy_8pipeline_17_parser_internals_10stateclass_10StateClass_63push, __Pyx_METH_FASTCALL|METH_KEYWORDS, __pyx_doc_5spacy_8pipeline_17_parser_internals_10stateclass_10StateClass_62push}; +static PyObject *__pyx_pw_5spacy_8pipeline_17_parser_internals_10stateclass_10StateClass_63push(PyObject *__pyx_v_self, +#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("push (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("push", 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("push", __pyx_kwds); return NULL;} + __pyx_r = __pyx_pf_5spacy_8pipeline_17_parser_internals_10stateclass_10StateClass_62push(((struct __pyx_obj_5spacy_8pipeline_17_parser_internals_10stateclass_StateClass *)__pyx_v_self)); + + /* function exit code */ + __Pyx_RefNannyFinishContext(); + return __pyx_r; +} + +static PyObject *__pyx_pf_5spacy_8pipeline_17_parser_internals_10stateclass_10StateClass_62push(struct __pyx_obj_5spacy_8pipeline_17_parser_internals_10stateclass_StateClass *__pyx_v_self) { + PyObject *__pyx_r = NULL; + __Pyx_RefNannyDeclarations + __Pyx_RefNannySetupContext("push", 0); + + /* "spacy/pipeline/_parser_internals/stateclass.pyx":157 + * + * def push(self): + * self.c.push() # <<<<<<<<<<<<<< + * + * def pop(self): +*/ + __pyx_v_self->c->push(); + + /* "spacy/pipeline/_parser_internals/stateclass.pyx":156 + * return self.c.buffer_length() + * + * def push(self): # <<<<<<<<<<<<<< + * self.c.push() + * +*/ + + /* function exit code */ + __pyx_r = Py_None; __Pyx_INCREF(Py_None); + __Pyx_XGIVEREF(__pyx_r); + __Pyx_RefNannyFinishContext(); + return __pyx_r; +} + +/* "spacy/pipeline/_parser_internals/stateclass.pyx":159 + * self.c.push() + * + * def pop(self): # <<<<<<<<<<<<<< + * self.c.pop() + * +*/ + +/* Python wrapper */ +static PyObject *__pyx_pw_5spacy_8pipeline_17_parser_internals_10stateclass_10StateClass_65pop(PyObject *__pyx_v_self, +#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_5spacy_8pipeline_17_parser_internals_10stateclass_10StateClass_64pop, "StateClass.pop(self)"); +static PyMethodDef __pyx_mdef_5spacy_8pipeline_17_parser_internals_10stateclass_10StateClass_65pop = {"pop", (PyCFunction)(void(*)(void))(__Pyx_PyCFunction_FastCallWithKeywords)__pyx_pw_5spacy_8pipeline_17_parser_internals_10stateclass_10StateClass_65pop, __Pyx_METH_FASTCALL|METH_KEYWORDS, __pyx_doc_5spacy_8pipeline_17_parser_internals_10stateclass_10StateClass_64pop}; +static PyObject *__pyx_pw_5spacy_8pipeline_17_parser_internals_10stateclass_10StateClass_65pop(PyObject *__pyx_v_self, +#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("pop (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("pop", 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("pop", __pyx_kwds); return NULL;} + __pyx_r = __pyx_pf_5spacy_8pipeline_17_parser_internals_10stateclass_10StateClass_64pop(((struct __pyx_obj_5spacy_8pipeline_17_parser_internals_10stateclass_StateClass *)__pyx_v_self)); + + /* function exit code */ + __Pyx_RefNannyFinishContext(); + return __pyx_r; +} + +static PyObject *__pyx_pf_5spacy_8pipeline_17_parser_internals_10stateclass_10StateClass_64pop(struct __pyx_obj_5spacy_8pipeline_17_parser_internals_10stateclass_StateClass *__pyx_v_self) { + PyObject *__pyx_r = NULL; + __Pyx_RefNannyDeclarations + __Pyx_RefNannySetupContext("pop", 0); + + /* "spacy/pipeline/_parser_internals/stateclass.pyx":160 + * + * def pop(self): + * self.c.pop() # <<<<<<<<<<<<<< + * + * def unshift(self): +*/ + __pyx_v_self->c->pop(); + + /* "spacy/pipeline/_parser_internals/stateclass.pyx":159 + * self.c.push() + * + * def pop(self): # <<<<<<<<<<<<<< + * self.c.pop() + * +*/ + + /* function exit code */ + __pyx_r = Py_None; __Pyx_INCREF(Py_None); + __Pyx_XGIVEREF(__pyx_r); + __Pyx_RefNannyFinishContext(); + return __pyx_r; +} + +/* "spacy/pipeline/_parser_internals/stateclass.pyx":162 + * self.c.pop() + * + * def unshift(self): # <<<<<<<<<<<<<< + * self.c.unshift() + * +*/ + +/* Python wrapper */ +static PyObject *__pyx_pw_5spacy_8pipeline_17_parser_internals_10stateclass_10StateClass_67unshift(PyObject *__pyx_v_self, +#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_5spacy_8pipeline_17_parser_internals_10stateclass_10StateClass_66unshift, "StateClass.unshift(self)"); +static PyMethodDef __pyx_mdef_5spacy_8pipeline_17_parser_internals_10stateclass_10StateClass_67unshift = {"unshift", (PyCFunction)(void(*)(void))(__Pyx_PyCFunction_FastCallWithKeywords)__pyx_pw_5spacy_8pipeline_17_parser_internals_10stateclass_10StateClass_67unshift, __Pyx_METH_FASTCALL|METH_KEYWORDS, __pyx_doc_5spacy_8pipeline_17_parser_internals_10stateclass_10StateClass_66unshift}; +static PyObject *__pyx_pw_5spacy_8pipeline_17_parser_internals_10stateclass_10StateClass_67unshift(PyObject *__pyx_v_self, +#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("unshift (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("unshift", 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("unshift", __pyx_kwds); return NULL;} + __pyx_r = __pyx_pf_5spacy_8pipeline_17_parser_internals_10stateclass_10StateClass_66unshift(((struct __pyx_obj_5spacy_8pipeline_17_parser_internals_10stateclass_StateClass *)__pyx_v_self)); + + /* function exit code */ + __Pyx_RefNannyFinishContext(); + return __pyx_r; +} + +static PyObject *__pyx_pf_5spacy_8pipeline_17_parser_internals_10stateclass_10StateClass_66unshift(struct __pyx_obj_5spacy_8pipeline_17_parser_internals_10stateclass_StateClass *__pyx_v_self) { + PyObject *__pyx_r = NULL; + __Pyx_RefNannyDeclarations + __Pyx_RefNannySetupContext("unshift", 0); + + /* "spacy/pipeline/_parser_internals/stateclass.pyx":163 + * + * def unshift(self): + * self.c.unshift() # <<<<<<<<<<<<<< + * + * def add_arc(self, int head, int child, attr_t label): +*/ + __pyx_v_self->c->unshift(); + + /* "spacy/pipeline/_parser_internals/stateclass.pyx":162 + * self.c.pop() + * + * def unshift(self): # <<<<<<<<<<<<<< + * self.c.unshift() + * +*/ + + /* function exit code */ + __pyx_r = Py_None; __Pyx_INCREF(Py_None); + __Pyx_XGIVEREF(__pyx_r); + __Pyx_RefNannyFinishContext(); + return __pyx_r; +} + +/* "spacy/pipeline/_parser_internals/stateclass.pyx":165 + * self.c.unshift() + * + * def add_arc(self, int head, int child, attr_t label): # <<<<<<<<<<<<<< + * self.c.add_arc(head, child, label) + * +*/ + +/* Python wrapper */ +static PyObject *__pyx_pw_5spacy_8pipeline_17_parser_internals_10stateclass_10StateClass_69add_arc(PyObject *__pyx_v_self, +#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_5spacy_8pipeline_17_parser_internals_10stateclass_10StateClass_68add_arc, "StateClass.add_arc(self, int head, int child, attr_t label)"); +static PyMethodDef __pyx_mdef_5spacy_8pipeline_17_parser_internals_10stateclass_10StateClass_69add_arc = {"add_arc", (PyCFunction)(void(*)(void))(__Pyx_PyCFunction_FastCallWithKeywords)__pyx_pw_5spacy_8pipeline_17_parser_internals_10stateclass_10StateClass_69add_arc, __Pyx_METH_FASTCALL|METH_KEYWORDS, __pyx_doc_5spacy_8pipeline_17_parser_internals_10stateclass_10StateClass_68add_arc}; +static PyObject *__pyx_pw_5spacy_8pipeline_17_parser_internals_10stateclass_10StateClass_69add_arc(PyObject *__pyx_v_self, +#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_head; + int __pyx_v_child; + __pyx_t_5spacy_8typedefs_attr_t __pyx_v_label; + #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("add_arc (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_head,&__pyx_mstate_global->__pyx_n_u_child,&__pyx_mstate_global->__pyx_n_u_label,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, 165, __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, 165, __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, 165, __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, 165, __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, "add_arc", 0) < (0)) __PYX_ERR(0, 165, __pyx_L3_error) + for (Py_ssize_t i = __pyx_nargs; i < 3; i++) { + if (unlikely(!values[i])) { __Pyx_RaiseArgtupleInvalid("add_arc", 1, 3, 3, i); __PYX_ERR(0, 165, __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, 165, __pyx_L3_error) + values[1] = __Pyx_ArgRef_FASTCALL(__pyx_args, 1); + if (!CYTHON_ASSUME_SAFE_MACROS && unlikely(!values[1])) __PYX_ERR(0, 165, __pyx_L3_error) + values[2] = __Pyx_ArgRef_FASTCALL(__pyx_args, 2); + if (!CYTHON_ASSUME_SAFE_MACROS && unlikely(!values[2])) __PYX_ERR(0, 165, __pyx_L3_error) + } + __pyx_v_head = __Pyx_PyLong_As_int(values[0]); if (unlikely((__pyx_v_head == (int)-1) && PyErr_Occurred())) __PYX_ERR(0, 165, __pyx_L3_error) + __pyx_v_child = __Pyx_PyLong_As_int(values[1]); if (unlikely((__pyx_v_child == (int)-1) && PyErr_Occurred())) __PYX_ERR(0, 165, __pyx_L3_error) + __pyx_v_label = __Pyx_PyLong_As_uint64_t(values[2]); if (unlikely((__pyx_v_label == ((uint64_t)-1)) && PyErr_Occurred())) __PYX_ERR(0, 165, __pyx_L3_error) + } + goto __pyx_L6_skip; + __pyx_L5_argtuple_error:; + __Pyx_RaiseArgtupleInvalid("add_arc", 1, 3, 3, __pyx_nargs); __PYX_ERR(0, 165, __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("spacy.pipeline._parser_internals.stateclass.StateClass.add_arc", __pyx_clineno, __pyx_lineno, __pyx_filename); + __Pyx_RefNannyFinishContext(); + return NULL; + __pyx_L4_argument_unpacking_done:; + __pyx_r = __pyx_pf_5spacy_8pipeline_17_parser_internals_10stateclass_10StateClass_68add_arc(((struct __pyx_obj_5spacy_8pipeline_17_parser_internals_10stateclass_StateClass *)__pyx_v_self), __pyx_v_head, __pyx_v_child, __pyx_v_label); + + /* 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_5spacy_8pipeline_17_parser_internals_10stateclass_10StateClass_68add_arc(struct __pyx_obj_5spacy_8pipeline_17_parser_internals_10stateclass_StateClass *__pyx_v_self, int __pyx_v_head, int __pyx_v_child, __pyx_t_5spacy_8typedefs_attr_t __pyx_v_label) { + PyObject *__pyx_r = NULL; + __Pyx_RefNannyDeclarations + __Pyx_RefNannySetupContext("add_arc", 0); + + /* "spacy/pipeline/_parser_internals/stateclass.pyx":166 + * + * def add_arc(self, int head, int child, attr_t label): + * self.c.add_arc(head, child, label) # <<<<<<<<<<<<<< + * + * def del_arc(self, int head, int child): +*/ + __pyx_v_self->c->add_arc(__pyx_v_head, __pyx_v_child, __pyx_v_label); + + /* "spacy/pipeline/_parser_internals/stateclass.pyx":165 + * self.c.unshift() + * + * def add_arc(self, int head, int child, attr_t label): # <<<<<<<<<<<<<< + * self.c.add_arc(head, child, label) + * +*/ + + /* function exit code */ + __pyx_r = Py_None; __Pyx_INCREF(Py_None); + __Pyx_XGIVEREF(__pyx_r); + __Pyx_RefNannyFinishContext(); + return __pyx_r; +} + +/* "spacy/pipeline/_parser_internals/stateclass.pyx":168 + * self.c.add_arc(head, child, label) + * + * def del_arc(self, int head, int child): # <<<<<<<<<<<<<< + * self.c.del_arc(head, child) + * +*/ + +/* Python wrapper */ +static PyObject *__pyx_pw_5spacy_8pipeline_17_parser_internals_10stateclass_10StateClass_71del_arc(PyObject *__pyx_v_self, +#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_5spacy_8pipeline_17_parser_internals_10stateclass_10StateClass_70del_arc, "StateClass.del_arc(self, int head, int child)"); +static PyMethodDef __pyx_mdef_5spacy_8pipeline_17_parser_internals_10stateclass_10StateClass_71del_arc = {"del_arc", (PyCFunction)(void(*)(void))(__Pyx_PyCFunction_FastCallWithKeywords)__pyx_pw_5spacy_8pipeline_17_parser_internals_10stateclass_10StateClass_71del_arc, __Pyx_METH_FASTCALL|METH_KEYWORDS, __pyx_doc_5spacy_8pipeline_17_parser_internals_10stateclass_10StateClass_70del_arc}; +static PyObject *__pyx_pw_5spacy_8pipeline_17_parser_internals_10stateclass_10StateClass_71del_arc(PyObject *__pyx_v_self, +#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_head; + int __pyx_v_child; + #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("del_arc (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_head,&__pyx_mstate_global->__pyx_n_u_child,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, 168, __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, 168, __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, 168, __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, "del_arc", 0) < (0)) __PYX_ERR(0, 168, __pyx_L3_error) + for (Py_ssize_t i = __pyx_nargs; i < 2; i++) { + if (unlikely(!values[i])) { __Pyx_RaiseArgtupleInvalid("del_arc", 1, 2, 2, i); __PYX_ERR(0, 168, __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, 168, __pyx_L3_error) + values[1] = __Pyx_ArgRef_FASTCALL(__pyx_args, 1); + if (!CYTHON_ASSUME_SAFE_MACROS && unlikely(!values[1])) __PYX_ERR(0, 168, __pyx_L3_error) + } + __pyx_v_head = __Pyx_PyLong_As_int(values[0]); if (unlikely((__pyx_v_head == (int)-1) && PyErr_Occurred())) __PYX_ERR(0, 168, __pyx_L3_error) + __pyx_v_child = __Pyx_PyLong_As_int(values[1]); if (unlikely((__pyx_v_child == (int)-1) && PyErr_Occurred())) __PYX_ERR(0, 168, __pyx_L3_error) + } + goto __pyx_L6_skip; + __pyx_L5_argtuple_error:; + __Pyx_RaiseArgtupleInvalid("del_arc", 1, 2, 2, __pyx_nargs); __PYX_ERR(0, 168, __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("spacy.pipeline._parser_internals.stateclass.StateClass.del_arc", __pyx_clineno, __pyx_lineno, __pyx_filename); + __Pyx_RefNannyFinishContext(); + return NULL; + __pyx_L4_argument_unpacking_done:; + __pyx_r = __pyx_pf_5spacy_8pipeline_17_parser_internals_10stateclass_10StateClass_70del_arc(((struct __pyx_obj_5spacy_8pipeline_17_parser_internals_10stateclass_StateClass *)__pyx_v_self), __pyx_v_head, __pyx_v_child); + + /* 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_5spacy_8pipeline_17_parser_internals_10stateclass_10StateClass_70del_arc(struct __pyx_obj_5spacy_8pipeline_17_parser_internals_10stateclass_StateClass *__pyx_v_self, int __pyx_v_head, int __pyx_v_child) { + PyObject *__pyx_r = NULL; + __Pyx_RefNannyDeclarations + __Pyx_RefNannySetupContext("del_arc", 0); + + /* "spacy/pipeline/_parser_internals/stateclass.pyx":169 + * + * def del_arc(self, int head, int child): + * self.c.del_arc(head, child) # <<<<<<<<<<<<<< + * + * def open_ent(self, attr_t label): +*/ + __pyx_v_self->c->del_arc(__pyx_v_head, __pyx_v_child); + + /* "spacy/pipeline/_parser_internals/stateclass.pyx":168 + * self.c.add_arc(head, child, label) + * + * def del_arc(self, int head, int child): # <<<<<<<<<<<<<< + * self.c.del_arc(head, child) + * +*/ + + /* function exit code */ + __pyx_r = Py_None; __Pyx_INCREF(Py_None); + __Pyx_XGIVEREF(__pyx_r); + __Pyx_RefNannyFinishContext(); + return __pyx_r; +} + +/* "spacy/pipeline/_parser_internals/stateclass.pyx":171 + * self.c.del_arc(head, child) + * + * def open_ent(self, attr_t label): # <<<<<<<<<<<<<< + * self.c.open_ent(label) + * +*/ + +/* Python wrapper */ +static PyObject *__pyx_pw_5spacy_8pipeline_17_parser_internals_10stateclass_10StateClass_73open_ent(PyObject *__pyx_v_self, +#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_5spacy_8pipeline_17_parser_internals_10stateclass_10StateClass_72open_ent, "StateClass.open_ent(self, attr_t label)"); +static PyMethodDef __pyx_mdef_5spacy_8pipeline_17_parser_internals_10stateclass_10StateClass_73open_ent = {"open_ent", (PyCFunction)(void(*)(void))(__Pyx_PyCFunction_FastCallWithKeywords)__pyx_pw_5spacy_8pipeline_17_parser_internals_10stateclass_10StateClass_73open_ent, __Pyx_METH_FASTCALL|METH_KEYWORDS, __pyx_doc_5spacy_8pipeline_17_parser_internals_10stateclass_10StateClass_72open_ent}; +static PyObject *__pyx_pw_5spacy_8pipeline_17_parser_internals_10stateclass_10StateClass_73open_ent(PyObject *__pyx_v_self, +#if CYTHON_METH_FASTCALL +PyObject *const *__pyx_args, Py_ssize_t __pyx_nargs, PyObject *__pyx_kwds +#else +PyObject *__pyx_args, PyObject *__pyx_kwds +#endif +) { + __pyx_t_5spacy_8typedefs_attr_t __pyx_v_label; + #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("open_ent (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_label,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, 171, __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, 171, __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, "open_ent", 0) < (0)) __PYX_ERR(0, 171, __pyx_L3_error) + for (Py_ssize_t i = __pyx_nargs; i < 1; i++) { + if (unlikely(!values[i])) { __Pyx_RaiseArgtupleInvalid("open_ent", 1, 1, 1, i); __PYX_ERR(0, 171, __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, 171, __pyx_L3_error) + } + __pyx_v_label = __Pyx_PyLong_As_uint64_t(values[0]); if (unlikely((__pyx_v_label == ((uint64_t)-1)) && PyErr_Occurred())) __PYX_ERR(0, 171, __pyx_L3_error) + } + goto __pyx_L6_skip; + __pyx_L5_argtuple_error:; + __Pyx_RaiseArgtupleInvalid("open_ent", 1, 1, 1, __pyx_nargs); __PYX_ERR(0, 171, __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("spacy.pipeline._parser_internals.stateclass.StateClass.open_ent", __pyx_clineno, __pyx_lineno, __pyx_filename); + __Pyx_RefNannyFinishContext(); + return NULL; + __pyx_L4_argument_unpacking_done:; + __pyx_r = __pyx_pf_5spacy_8pipeline_17_parser_internals_10stateclass_10StateClass_72open_ent(((struct __pyx_obj_5spacy_8pipeline_17_parser_internals_10stateclass_StateClass *)__pyx_v_self), __pyx_v_label); + + /* 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_5spacy_8pipeline_17_parser_internals_10stateclass_10StateClass_72open_ent(struct __pyx_obj_5spacy_8pipeline_17_parser_internals_10stateclass_StateClass *__pyx_v_self, __pyx_t_5spacy_8typedefs_attr_t __pyx_v_label) { + PyObject *__pyx_r = NULL; + __Pyx_RefNannyDeclarations + __Pyx_RefNannySetupContext("open_ent", 0); + + /* "spacy/pipeline/_parser_internals/stateclass.pyx":172 + * + * def open_ent(self, attr_t label): + * self.c.open_ent(label) # <<<<<<<<<<<<<< + * + * def close_ent(self): +*/ + __pyx_v_self->c->open_ent(__pyx_v_label); + + /* "spacy/pipeline/_parser_internals/stateclass.pyx":171 + * self.c.del_arc(head, child) + * + * def open_ent(self, attr_t label): # <<<<<<<<<<<<<< + * self.c.open_ent(label) + * +*/ + + /* function exit code */ + __pyx_r = Py_None; __Pyx_INCREF(Py_None); + __Pyx_XGIVEREF(__pyx_r); + __Pyx_RefNannyFinishContext(); + return __pyx_r; +} + +/* "spacy/pipeline/_parser_internals/stateclass.pyx":174 + * self.c.open_ent(label) + * + * def close_ent(self): # <<<<<<<<<<<<<< + * self.c.close_ent() + * +*/ + +/* Python wrapper */ +static PyObject *__pyx_pw_5spacy_8pipeline_17_parser_internals_10stateclass_10StateClass_75close_ent(PyObject *__pyx_v_self, +#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_5spacy_8pipeline_17_parser_internals_10stateclass_10StateClass_74close_ent, "StateClass.close_ent(self)"); +static PyMethodDef __pyx_mdef_5spacy_8pipeline_17_parser_internals_10stateclass_10StateClass_75close_ent = {"close_ent", (PyCFunction)(void(*)(void))(__Pyx_PyCFunction_FastCallWithKeywords)__pyx_pw_5spacy_8pipeline_17_parser_internals_10stateclass_10StateClass_75close_ent, __Pyx_METH_FASTCALL|METH_KEYWORDS, __pyx_doc_5spacy_8pipeline_17_parser_internals_10stateclass_10StateClass_74close_ent}; +static PyObject *__pyx_pw_5spacy_8pipeline_17_parser_internals_10stateclass_10StateClass_75close_ent(PyObject *__pyx_v_self, +#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("close_ent (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("close_ent", 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("close_ent", __pyx_kwds); return NULL;} + __pyx_r = __pyx_pf_5spacy_8pipeline_17_parser_internals_10stateclass_10StateClass_74close_ent(((struct __pyx_obj_5spacy_8pipeline_17_parser_internals_10stateclass_StateClass *)__pyx_v_self)); + + /* function exit code */ + __Pyx_RefNannyFinishContext(); + return __pyx_r; +} + +static PyObject *__pyx_pf_5spacy_8pipeline_17_parser_internals_10stateclass_10StateClass_74close_ent(struct __pyx_obj_5spacy_8pipeline_17_parser_internals_10stateclass_StateClass *__pyx_v_self) { + PyObject *__pyx_r = NULL; + __Pyx_RefNannyDeclarations + __Pyx_RefNannySetupContext("close_ent", 0); + + /* "spacy/pipeline/_parser_internals/stateclass.pyx":175 + * + * def close_ent(self): + * self.c.close_ent() # <<<<<<<<<<<<<< + * + * def clone(self, StateClass src): +*/ + __pyx_v_self->c->close_ent(); + + /* "spacy/pipeline/_parser_internals/stateclass.pyx":174 + * self.c.open_ent(label) + * + * def close_ent(self): # <<<<<<<<<<<<<< + * self.c.close_ent() + * +*/ + + /* function exit code */ + __pyx_r = Py_None; __Pyx_INCREF(Py_None); + __Pyx_XGIVEREF(__pyx_r); + __Pyx_RefNannyFinishContext(); + return __pyx_r; +} + +/* "spacy/pipeline/_parser_internals/stateclass.pyx":177 + * self.c.close_ent() + * + * def clone(self, StateClass src): # <<<<<<<<<<<<<< + * self.c.clone(src.c) +*/ + +/* Python wrapper */ +static PyObject *__pyx_pw_5spacy_8pipeline_17_parser_internals_10stateclass_10StateClass_77clone(PyObject *__pyx_v_self, +#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_5spacy_8pipeline_17_parser_internals_10stateclass_10StateClass_76clone, "StateClass.clone(self, StateClass src)"); +static PyMethodDef __pyx_mdef_5spacy_8pipeline_17_parser_internals_10stateclass_10StateClass_77clone = {"clone", (PyCFunction)(void(*)(void))(__Pyx_PyCFunction_FastCallWithKeywords)__pyx_pw_5spacy_8pipeline_17_parser_internals_10stateclass_10StateClass_77clone, __Pyx_METH_FASTCALL|METH_KEYWORDS, __pyx_doc_5spacy_8pipeline_17_parser_internals_10stateclass_10StateClass_76clone}; +static PyObject *__pyx_pw_5spacy_8pipeline_17_parser_internals_10stateclass_10StateClass_77clone(PyObject *__pyx_v_self, +#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_5spacy_8pipeline_17_parser_internals_10stateclass_StateClass *__pyx_v_src = 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("clone (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_src,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, 177, __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, 177, __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, "clone", 0) < (0)) __PYX_ERR(0, 177, __pyx_L3_error) + for (Py_ssize_t i = __pyx_nargs; i < 1; i++) { + if (unlikely(!values[i])) { __Pyx_RaiseArgtupleInvalid("clone", 1, 1, 1, i); __PYX_ERR(0, 177, __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, 177, __pyx_L3_error) + } + __pyx_v_src = ((struct __pyx_obj_5spacy_8pipeline_17_parser_internals_10stateclass_StateClass *)values[0]); + } + goto __pyx_L6_skip; + __pyx_L5_argtuple_error:; + __Pyx_RaiseArgtupleInvalid("clone", 1, 1, 1, __pyx_nargs); __PYX_ERR(0, 177, __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("spacy.pipeline._parser_internals.stateclass.StateClass.clone", __pyx_clineno, __pyx_lineno, __pyx_filename); + __Pyx_RefNannyFinishContext(); + return NULL; + __pyx_L4_argument_unpacking_done:; + if (unlikely(!__Pyx_ArgTypeTest(((PyObject *)__pyx_v_src), __pyx_mstate_global->__pyx_ptype_5spacy_8pipeline_17_parser_internals_10stateclass_StateClass, 1, "src", 0))) __PYX_ERR(0, 177, __pyx_L1_error) + __pyx_r = __pyx_pf_5spacy_8pipeline_17_parser_internals_10stateclass_10StateClass_76clone(((struct __pyx_obj_5spacy_8pipeline_17_parser_internals_10stateclass_StateClass *)__pyx_v_self), __pyx_v_src); + + /* 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_5spacy_8pipeline_17_parser_internals_10stateclass_10StateClass_76clone(struct __pyx_obj_5spacy_8pipeline_17_parser_internals_10stateclass_StateClass *__pyx_v_self, struct __pyx_obj_5spacy_8pipeline_17_parser_internals_10stateclass_StateClass *__pyx_v_src) { + PyObject *__pyx_r = NULL; + __Pyx_RefNannyDeclarations + __Pyx_RefNannySetupContext("clone", 0); + + /* "spacy/pipeline/_parser_internals/stateclass.pyx":178 + * + * def clone(self, StateClass src): + * self.c.clone(src.c) # <<<<<<<<<<<<<< +*/ + __pyx_v_self->c->clone(__pyx_v_src->c); + + /* "spacy/pipeline/_parser_internals/stateclass.pyx":177 + * self.c.close_ent() + * + * def clone(self, StateClass src): # <<<<<<<<<<<<<< + * self.c.clone(src.c) +*/ + + /* function exit code */ + __pyx_r = Py_None; __Pyx_INCREF(Py_None); + __Pyx_XGIVEREF(__pyx_r); + __Pyx_RefNannyFinishContext(); + return __pyx_r; +} + +/* "spacy/pipeline/_parser_internals/stateclass.pxd":11 + * cdef class StateClass: + * cdef StateC* c + * cdef readonly Doc doc # <<<<<<<<<<<<<< + * cdef int _borrowed + * +*/ + +/* Python wrapper */ +static PyObject *__pyx_pw_5spacy_8pipeline_17_parser_internals_10stateclass_10StateClass_3doc_1__get__(PyObject *__pyx_v_self); /*proto*/ +static PyObject *__pyx_pw_5spacy_8pipeline_17_parser_internals_10stateclass_10StateClass_3doc_1__get__(PyObject *__pyx_v_self) { + CYTHON_UNUSED PyObject *const *__pyx_kwvalues; + PyObject *__pyx_r = 0; + __Pyx_RefNannyDeclarations + __Pyx_RefNannySetupContext("__get__ (wrapper)", 0); + __pyx_kwvalues = __Pyx_KwValues_VARARGS(__pyx_args, __pyx_nargs); + __pyx_r = __pyx_pf_5spacy_8pipeline_17_parser_internals_10stateclass_10StateClass_3doc___get__(((struct __pyx_obj_5spacy_8pipeline_17_parser_internals_10stateclass_StateClass *)__pyx_v_self)); + + /* function exit code */ + __Pyx_RefNannyFinishContext(); + return __pyx_r; +} + +static PyObject *__pyx_pf_5spacy_8pipeline_17_parser_internals_10stateclass_10StateClass_3doc___get__(struct __pyx_obj_5spacy_8pipeline_17_parser_internals_10stateclass_StateClass *__pyx_v_self) { + PyObject *__pyx_r = NULL; + __Pyx_RefNannyDeclarations + __Pyx_RefNannySetupContext("__get__", 0); + __Pyx_XDECREF(__pyx_r); + __Pyx_INCREF((PyObject *)__pyx_v_self->doc); + __pyx_r = ((PyObject *)__pyx_v_self->doc); + goto __pyx_L0; + + /* function exit code */ + __pyx_L0:; + __Pyx_XGIVEREF(__pyx_r); + __Pyx_RefNannyFinishContext(); + return __pyx_r; +} + +/* "(tree fragment)":1 + * def __reduce_cython__(self): # <<<<<<<<<<<<<< + * raise TypeError, "self.c cannot be converted to a Python object for pickling" + * def __setstate_cython__(self, __pyx_state): +*/ + +/* Python wrapper */ +static PyObject *__pyx_pw_5spacy_8pipeline_17_parser_internals_10stateclass_10StateClass_79__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_5spacy_8pipeline_17_parser_internals_10stateclass_10StateClass_78__reduce_cython__, "StateClass.__reduce_cython__(self)"); +static PyMethodDef __pyx_mdef_5spacy_8pipeline_17_parser_internals_10stateclass_10StateClass_79__reduce_cython__ = {"__reduce_cython__", (PyCFunction)(void(*)(void))(__Pyx_PyCFunction_FastCallWithKeywords)__pyx_pw_5spacy_8pipeline_17_parser_internals_10stateclass_10StateClass_79__reduce_cython__, __Pyx_METH_FASTCALL|METH_KEYWORDS, __pyx_doc_5spacy_8pipeline_17_parser_internals_10stateclass_10StateClass_78__reduce_cython__}; +static PyObject *__pyx_pw_5spacy_8pipeline_17_parser_internals_10stateclass_10StateClass_79__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_5spacy_8pipeline_17_parser_internals_10stateclass_10StateClass_78__reduce_cython__(((struct __pyx_obj_5spacy_8pipeline_17_parser_internals_10stateclass_StateClass *)__pyx_v_self)); + + /* function exit code */ + __Pyx_RefNannyFinishContext(); + return __pyx_r; +} + +static PyObject *__pyx_pf_5spacy_8pipeline_17_parser_internals_10stateclass_10StateClass_78__reduce_cython__(CYTHON_UNUSED struct __pyx_obj_5spacy_8pipeline_17_parser_internals_10stateclass_StateClass *__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.c cannot be converted to a Python object for pickling" # <<<<<<<<<<<<<< + * def __setstate_cython__(self, __pyx_state): + * raise TypeError, "self.c cannot be converted to a Python object for pickling" +*/ + __Pyx_Raise(((PyObject *)(((PyTypeObject*)PyExc_TypeError))), __pyx_mstate_global->__pyx_kp_u_self_c_cannot_be_converted_to_a, 0, 0); + __PYX_ERR(1, 2, __pyx_L1_error) + + /* "(tree fragment)":1 + * def __reduce_cython__(self): # <<<<<<<<<<<<<< + * raise TypeError, "self.c cannot be converted to a Python object for pickling" + * def __setstate_cython__(self, __pyx_state): +*/ + + /* function exit code */ + __pyx_L1_error:; + __Pyx_AddTraceback("spacy.pipeline._parser_internals.stateclass.StateClass.__reduce_cython__", __pyx_clineno, __pyx_lineno, __pyx_filename); + __pyx_r = NULL; + __Pyx_XGIVEREF(__pyx_r); + __Pyx_RefNannyFinishContext(); + return __pyx_r; +} + +/* "(tree fragment)":3 + * def __reduce_cython__(self): + * raise TypeError, "self.c cannot be converted to a Python object for pickling" + * def __setstate_cython__(self, __pyx_state): # <<<<<<<<<<<<<< + * raise TypeError, "self.c cannot be converted to a Python object for pickling" +*/ + +/* Python wrapper */ +static PyObject *__pyx_pw_5spacy_8pipeline_17_parser_internals_10stateclass_10StateClass_81__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_5spacy_8pipeline_17_parser_internals_10stateclass_10StateClass_80__setstate_cython__, "StateClass.__setstate_cython__(self, __pyx_state)"); +static PyMethodDef __pyx_mdef_5spacy_8pipeline_17_parser_internals_10stateclass_10StateClass_81__setstate_cython__ = {"__setstate_cython__", (PyCFunction)(void(*)(void))(__Pyx_PyCFunction_FastCallWithKeywords)__pyx_pw_5spacy_8pipeline_17_parser_internals_10stateclass_10StateClass_81__setstate_cython__, __Pyx_METH_FASTCALL|METH_KEYWORDS, __pyx_doc_5spacy_8pipeline_17_parser_internals_10stateclass_10StateClass_80__setstate_cython__}; +static PyObject *__pyx_pw_5spacy_8pipeline_17_parser_internals_10stateclass_10StateClass_81__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("spacy.pipeline._parser_internals.stateclass.StateClass.__setstate_cython__", __pyx_clineno, __pyx_lineno, __pyx_filename); + __Pyx_RefNannyFinishContext(); + return NULL; + __pyx_L4_argument_unpacking_done:; + __pyx_r = __pyx_pf_5spacy_8pipeline_17_parser_internals_10stateclass_10StateClass_80__setstate_cython__(((struct __pyx_obj_5spacy_8pipeline_17_parser_internals_10stateclass_StateClass *)__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_5spacy_8pipeline_17_parser_internals_10stateclass_10StateClass_80__setstate_cython__(CYTHON_UNUSED struct __pyx_obj_5spacy_8pipeline_17_parser_internals_10stateclass_StateClass *__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.c cannot be converted to a Python object for pickling" + * def __setstate_cython__(self, __pyx_state): + * raise TypeError, "self.c cannot be converted to a Python object for pickling" # <<<<<<<<<<<<<< +*/ + __Pyx_Raise(((PyObject *)(((PyTypeObject*)PyExc_TypeError))), __pyx_mstate_global->__pyx_kp_u_self_c_cannot_be_converted_to_a, 0, 0); + __PYX_ERR(1, 4, __pyx_L1_error) + + /* "(tree fragment)":3 + * def __reduce_cython__(self): + * raise TypeError, "self.c cannot be converted to a Python object for pickling" + * def __setstate_cython__(self, __pyx_state): # <<<<<<<<<<<<<< + * raise TypeError, "self.c cannot be converted to a Python object for pickling" +*/ + + /* function exit code */ + __pyx_L1_error:; + __Pyx_AddTraceback("spacy.pipeline._parser_internals.stateclass.StateClass.__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 struct __pyx_vtabstruct_5spacy_8pipeline_17_parser_internals_10stateclass_StateClass __pyx_vtable_5spacy_8pipeline_17_parser_internals_10stateclass_StateClass; + +static PyObject *__pyx_tp_new_5spacy_8pipeline_17_parser_internals_10stateclass_StateClass(PyTypeObject *t, CYTHON_UNUSED PyObject *a, CYTHON_UNUSED PyObject *k) { + struct __pyx_obj_5spacy_8pipeline_17_parser_internals_10stateclass_StateClass *p; + PyObject *o; + o = __Pyx_AllocateExtensionType(t, 0); + if (unlikely(!o)) return 0; + p = ((struct __pyx_obj_5spacy_8pipeline_17_parser_internals_10stateclass_StateClass *)o); + p->__pyx_vtab = __pyx_vtabptr_5spacy_8pipeline_17_parser_internals_10stateclass_StateClass; + p->doc = ((struct __pyx_obj_5spacy_6tokens_3doc_Doc *)Py_None); Py_INCREF(Py_None); + return o; +} + +static void __pyx_tp_dealloc_5spacy_8pipeline_17_parser_internals_10stateclass_StateClass(PyObject *o) { + struct __pyx_obj_5spacy_8pipeline_17_parser_internals_10stateclass_StateClass *p = (struct __pyx_obj_5spacy_8pipeline_17_parser_internals_10stateclass_StateClass *)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_5spacy_8pipeline_17_parser_internals_10stateclass_StateClass) { + 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_5spacy_8pipeline_17_parser_internals_10stateclass_10StateClass_3__dealloc__(o); + __Pyx_SET_REFCNT(o, Py_REFCNT(o) - 1); + PyErr_Restore(etype, eval, etb); + } + Py_CLEAR(p->doc); + 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_5spacy_8pipeline_17_parser_internals_10stateclass_StateClass(PyObject *o, visitproc v, void *a) { + int e; + struct __pyx_obj_5spacy_8pipeline_17_parser_internals_10stateclass_StateClass *p = (struct __pyx_obj_5spacy_8pipeline_17_parser_internals_10stateclass_StateClass *)o; + { + e = __Pyx_call_type_traverse(o, 1, v, a); + if (e) return e; + } + if (p->doc) { + e = (*v)(((PyObject *)p->doc), a); if (e) return e; + } + return 0; +} + +static int __pyx_tp_clear_5spacy_8pipeline_17_parser_internals_10stateclass_StateClass(PyObject *o) { + PyObject* tmp; + struct __pyx_obj_5spacy_8pipeline_17_parser_internals_10stateclass_StateClass *p = (struct __pyx_obj_5spacy_8pipeline_17_parser_internals_10stateclass_StateClass *)o; + tmp = ((PyObject*)p->doc); + p->doc = ((struct __pyx_obj_5spacy_6tokens_3doc_Doc *)Py_None); Py_INCREF(Py_None); + Py_XDECREF(tmp); + return 0; +} + +static PyObject *__pyx_getprop_5spacy_8pipeline_17_parser_internals_10stateclass_10StateClass_stack(PyObject *o, CYTHON_UNUSED void *x) { + return __pyx_pw_5spacy_8pipeline_17_parser_internals_10stateclass_10StateClass_5stack_1__get__(o); +} + +static PyObject *__pyx_getprop_5spacy_8pipeline_17_parser_internals_10stateclass_10StateClass_queue(PyObject *o, CYTHON_UNUSED void *x) { + return __pyx_pw_5spacy_8pipeline_17_parser_internals_10stateclass_10StateClass_5queue_1__get__(o); +} + +static PyObject *__pyx_getprop_5spacy_8pipeline_17_parser_internals_10stateclass_10StateClass_token_vector_length(PyObject *o, CYTHON_UNUSED void *x) { + return __pyx_pw_5spacy_8pipeline_17_parser_internals_10stateclass_10StateClass_19token_vector_length_1__get__(o); +} + +static PyObject *__pyx_getprop_5spacy_8pipeline_17_parser_internals_10stateclass_10StateClass_arcs(PyObject *o, CYTHON_UNUSED void *x) { + return __pyx_pw_5spacy_8pipeline_17_parser_internals_10stateclass_10StateClass_4arcs_1__get__(o); +} + +static PyObject *__pyx_getprop_5spacy_8pipeline_17_parser_internals_10stateclass_10StateClass__b_i(PyObject *o, CYTHON_UNUSED void *x) { + return __pyx_pw_5spacy_8pipeline_17_parser_internals_10stateclass_10StateClass_4_b_i_1__get__(o); +} + +static PyObject *__pyx_getprop_5spacy_8pipeline_17_parser_internals_10stateclass_10StateClass_length(PyObject *o, CYTHON_UNUSED void *x) { + return __pyx_pw_5spacy_8pipeline_17_parser_internals_10stateclass_10StateClass_6length_1__get__(o); +} + +static PyObject *__pyx_getprop_5spacy_8pipeline_17_parser_internals_10stateclass_10StateClass_doc(PyObject *o, CYTHON_UNUSED void *x) { + return __pyx_pw_5spacy_8pipeline_17_parser_internals_10stateclass_10StateClass_3doc_1__get__(o); +} + +static PyMethodDef __pyx_methods_5spacy_8pipeline_17_parser_internals_10stateclass_StateClass[] = { + {"add_arc", (PyCFunction)(void(*)(void))(__Pyx_PyCFunction_FastCallWithKeywords)__pyx_pw_5spacy_8pipeline_17_parser_internals_10stateclass_10StateClass_5add_arc, __Pyx_METH_FASTCALL|METH_KEYWORDS, __pyx_doc_5spacy_8pipeline_17_parser_internals_10stateclass_10StateClass_4add_arc}, + {"del_arc", (PyCFunction)(void(*)(void))(__Pyx_PyCFunction_FastCallWithKeywords)__pyx_pw_5spacy_8pipeline_17_parser_internals_10stateclass_10StateClass_7del_arc, __Pyx_METH_FASTCALL|METH_KEYWORDS, __pyx_doc_5spacy_8pipeline_17_parser_internals_10stateclass_10StateClass_6del_arc}, + {"H", (PyCFunction)(void(*)(void))(__Pyx_PyCFunction_FastCallWithKeywords)__pyx_pw_5spacy_8pipeline_17_parser_internals_10stateclass_10StateClass_9H, __Pyx_METH_FASTCALL|METH_KEYWORDS, __pyx_doc_5spacy_8pipeline_17_parser_internals_10stateclass_10StateClass_8H}, + {"L", (PyCFunction)(void(*)(void))(__Pyx_PyCFunction_FastCallWithKeywords)__pyx_pw_5spacy_8pipeline_17_parser_internals_10stateclass_10StateClass_11L, __Pyx_METH_FASTCALL|METH_KEYWORDS, __pyx_doc_5spacy_8pipeline_17_parser_internals_10stateclass_10StateClass_10L}, + {"R", (PyCFunction)(void(*)(void))(__Pyx_PyCFunction_FastCallWithKeywords)__pyx_pw_5spacy_8pipeline_17_parser_internals_10stateclass_10StateClass_13R, __Pyx_METH_FASTCALL|METH_KEYWORDS, __pyx_doc_5spacy_8pipeline_17_parser_internals_10stateclass_10StateClass_12R}, + {"is_final", (PyCFunction)(void(*)(void))(__Pyx_PyCFunction_FastCallWithKeywords)__pyx_pw_5spacy_8pipeline_17_parser_internals_10stateclass_10StateClass_15is_final, __Pyx_METH_FASTCALL|METH_KEYWORDS, __pyx_doc_5spacy_8pipeline_17_parser_internals_10stateclass_10StateClass_14is_final}, + {"copy", (PyCFunction)(void(*)(void))(__Pyx_PyCFunction_FastCallWithKeywords)__pyx_pw_5spacy_8pipeline_17_parser_internals_10stateclass_10StateClass_17copy, __Pyx_METH_FASTCALL|METH_KEYWORDS, __pyx_doc_5spacy_8pipeline_17_parser_internals_10stateclass_10StateClass_16copy}, + {"print_state", (PyCFunction)(void(*)(void))(__Pyx_PyCFunction_FastCallWithKeywords)__pyx_pw_5spacy_8pipeline_17_parser_internals_10stateclass_10StateClass_19print_state, __Pyx_METH_FASTCALL|METH_KEYWORDS, __pyx_doc_5spacy_8pipeline_17_parser_internals_10stateclass_10StateClass_18print_state}, + {"S", (PyCFunction)(void(*)(void))(__Pyx_PyCFunction_FastCallWithKeywords)__pyx_pw_5spacy_8pipeline_17_parser_internals_10stateclass_10StateClass_21S, __Pyx_METH_FASTCALL|METH_KEYWORDS, __pyx_doc_5spacy_8pipeline_17_parser_internals_10stateclass_10StateClass_20S}, + {"B", (PyCFunction)(void(*)(void))(__Pyx_PyCFunction_FastCallWithKeywords)__pyx_pw_5spacy_8pipeline_17_parser_internals_10stateclass_10StateClass_23B, __Pyx_METH_FASTCALL|METH_KEYWORDS, __pyx_doc_5spacy_8pipeline_17_parser_internals_10stateclass_10StateClass_22B}, + {"H", (PyCFunction)(void(*)(void))(__Pyx_PyCFunction_FastCallWithKeywords)__pyx_pw_5spacy_8pipeline_17_parser_internals_10stateclass_10StateClass_25H, __Pyx_METH_FASTCALL|METH_KEYWORDS, __pyx_doc_5spacy_8pipeline_17_parser_internals_10stateclass_10StateClass_24H}, + {"E", (PyCFunction)(void(*)(void))(__Pyx_PyCFunction_FastCallWithKeywords)__pyx_pw_5spacy_8pipeline_17_parser_internals_10stateclass_10StateClass_27E, __Pyx_METH_FASTCALL|METH_KEYWORDS, __pyx_doc_5spacy_8pipeline_17_parser_internals_10stateclass_10StateClass_26E}, + {"L", (PyCFunction)(void(*)(void))(__Pyx_PyCFunction_FastCallWithKeywords)__pyx_pw_5spacy_8pipeline_17_parser_internals_10stateclass_10StateClass_29L, __Pyx_METH_FASTCALL|METH_KEYWORDS, __pyx_doc_5spacy_8pipeline_17_parser_internals_10stateclass_10StateClass_28L}, + {"R", (PyCFunction)(void(*)(void))(__Pyx_PyCFunction_FastCallWithKeywords)__pyx_pw_5spacy_8pipeline_17_parser_internals_10stateclass_10StateClass_31R, __Pyx_METH_FASTCALL|METH_KEYWORDS, __pyx_doc_5spacy_8pipeline_17_parser_internals_10stateclass_10StateClass_30R}, + {"S_", (PyCFunction)(void(*)(void))(__Pyx_PyCFunction_FastCallWithKeywords)__pyx_pw_5spacy_8pipeline_17_parser_internals_10stateclass_10StateClass_33S_, __Pyx_METH_FASTCALL|METH_KEYWORDS, __pyx_doc_5spacy_8pipeline_17_parser_internals_10stateclass_10StateClass_32S_}, + {"B_", (PyCFunction)(void(*)(void))(__Pyx_PyCFunction_FastCallWithKeywords)__pyx_pw_5spacy_8pipeline_17_parser_internals_10stateclass_10StateClass_35B_, __Pyx_METH_FASTCALL|METH_KEYWORDS, __pyx_doc_5spacy_8pipeline_17_parser_internals_10stateclass_10StateClass_34B_}, + {"H_", (PyCFunction)(void(*)(void))(__Pyx_PyCFunction_FastCallWithKeywords)__pyx_pw_5spacy_8pipeline_17_parser_internals_10stateclass_10StateClass_37H_, __Pyx_METH_FASTCALL|METH_KEYWORDS, __pyx_doc_5spacy_8pipeline_17_parser_internals_10stateclass_10StateClass_36H_}, + {"E_", (PyCFunction)(void(*)(void))(__Pyx_PyCFunction_FastCallWithKeywords)__pyx_pw_5spacy_8pipeline_17_parser_internals_10stateclass_10StateClass_39E_, __Pyx_METH_FASTCALL|METH_KEYWORDS, __pyx_doc_5spacy_8pipeline_17_parser_internals_10stateclass_10StateClass_38E_}, + {"L_", (PyCFunction)(void(*)(void))(__Pyx_PyCFunction_FastCallWithKeywords)__pyx_pw_5spacy_8pipeline_17_parser_internals_10stateclass_10StateClass_41L_, __Pyx_METH_FASTCALL|METH_KEYWORDS, __pyx_doc_5spacy_8pipeline_17_parser_internals_10stateclass_10StateClass_40L_}, + {"R_", (PyCFunction)(void(*)(void))(__Pyx_PyCFunction_FastCallWithKeywords)__pyx_pw_5spacy_8pipeline_17_parser_internals_10stateclass_10StateClass_43R_, __Pyx_METH_FASTCALL|METH_KEYWORDS, __pyx_doc_5spacy_8pipeline_17_parser_internals_10stateclass_10StateClass_42R_}, + {"empty", (PyCFunction)(void(*)(void))(__Pyx_PyCFunction_FastCallWithKeywords)__pyx_pw_5spacy_8pipeline_17_parser_internals_10stateclass_10StateClass_45empty, __Pyx_METH_FASTCALL|METH_KEYWORDS, __pyx_doc_5spacy_8pipeline_17_parser_internals_10stateclass_10StateClass_44empty}, + {"eol", (PyCFunction)(void(*)(void))(__Pyx_PyCFunction_FastCallWithKeywords)__pyx_pw_5spacy_8pipeline_17_parser_internals_10stateclass_10StateClass_47eol, __Pyx_METH_FASTCALL|METH_KEYWORDS, __pyx_doc_5spacy_8pipeline_17_parser_internals_10stateclass_10StateClass_46eol}, + {"at_break", (PyCFunction)(void(*)(void))(__Pyx_PyCFunction_FastCallWithKeywords)__pyx_pw_5spacy_8pipeline_17_parser_internals_10stateclass_10StateClass_49at_break, __Pyx_METH_FASTCALL|METH_KEYWORDS, __pyx_doc_5spacy_8pipeline_17_parser_internals_10stateclass_10StateClass_48at_break}, + {"has_head", (PyCFunction)(void(*)(void))(__Pyx_PyCFunction_FastCallWithKeywords)__pyx_pw_5spacy_8pipeline_17_parser_internals_10stateclass_10StateClass_51has_head, __Pyx_METH_FASTCALL|METH_KEYWORDS, __pyx_doc_5spacy_8pipeline_17_parser_internals_10stateclass_10StateClass_50has_head}, + {"n_L", (PyCFunction)(void(*)(void))(__Pyx_PyCFunction_FastCallWithKeywords)__pyx_pw_5spacy_8pipeline_17_parser_internals_10stateclass_10StateClass_53n_L, __Pyx_METH_FASTCALL|METH_KEYWORDS, __pyx_doc_5spacy_8pipeline_17_parser_internals_10stateclass_10StateClass_52n_L}, + {"n_R", (PyCFunction)(void(*)(void))(__Pyx_PyCFunction_FastCallWithKeywords)__pyx_pw_5spacy_8pipeline_17_parser_internals_10stateclass_10StateClass_55n_R, __Pyx_METH_FASTCALL|METH_KEYWORDS, __pyx_doc_5spacy_8pipeline_17_parser_internals_10stateclass_10StateClass_54n_R}, + {"entity_is_open", (PyCFunction)(void(*)(void))(__Pyx_PyCFunction_FastCallWithKeywords)__pyx_pw_5spacy_8pipeline_17_parser_internals_10stateclass_10StateClass_57entity_is_open, __Pyx_METH_FASTCALL|METH_KEYWORDS, __pyx_doc_5spacy_8pipeline_17_parser_internals_10stateclass_10StateClass_56entity_is_open}, + {"stack_depth", (PyCFunction)(void(*)(void))(__Pyx_PyCFunction_FastCallWithKeywords)__pyx_pw_5spacy_8pipeline_17_parser_internals_10stateclass_10StateClass_59stack_depth, __Pyx_METH_FASTCALL|METH_KEYWORDS, __pyx_doc_5spacy_8pipeline_17_parser_internals_10stateclass_10StateClass_58stack_depth}, + {"buffer_length", (PyCFunction)(void(*)(void))(__Pyx_PyCFunction_FastCallWithKeywords)__pyx_pw_5spacy_8pipeline_17_parser_internals_10stateclass_10StateClass_61buffer_length, __Pyx_METH_FASTCALL|METH_KEYWORDS, __pyx_doc_5spacy_8pipeline_17_parser_internals_10stateclass_10StateClass_60buffer_length}, + {"push", (PyCFunction)(void(*)(void))(__Pyx_PyCFunction_FastCallWithKeywords)__pyx_pw_5spacy_8pipeline_17_parser_internals_10stateclass_10StateClass_63push, __Pyx_METH_FASTCALL|METH_KEYWORDS, __pyx_doc_5spacy_8pipeline_17_parser_internals_10stateclass_10StateClass_62push}, + {"pop", (PyCFunction)(void(*)(void))(__Pyx_PyCFunction_FastCallWithKeywords)__pyx_pw_5spacy_8pipeline_17_parser_internals_10stateclass_10StateClass_65pop, __Pyx_METH_FASTCALL|METH_KEYWORDS, __pyx_doc_5spacy_8pipeline_17_parser_internals_10stateclass_10StateClass_64pop}, + {"unshift", (PyCFunction)(void(*)(void))(__Pyx_PyCFunction_FastCallWithKeywords)__pyx_pw_5spacy_8pipeline_17_parser_internals_10stateclass_10StateClass_67unshift, __Pyx_METH_FASTCALL|METH_KEYWORDS, __pyx_doc_5spacy_8pipeline_17_parser_internals_10stateclass_10StateClass_66unshift}, + {"add_arc", (PyCFunction)(void(*)(void))(__Pyx_PyCFunction_FastCallWithKeywords)__pyx_pw_5spacy_8pipeline_17_parser_internals_10stateclass_10StateClass_69add_arc, __Pyx_METH_FASTCALL|METH_KEYWORDS, __pyx_doc_5spacy_8pipeline_17_parser_internals_10stateclass_10StateClass_68add_arc}, + {"del_arc", (PyCFunction)(void(*)(void))(__Pyx_PyCFunction_FastCallWithKeywords)__pyx_pw_5spacy_8pipeline_17_parser_internals_10stateclass_10StateClass_71del_arc, __Pyx_METH_FASTCALL|METH_KEYWORDS, __pyx_doc_5spacy_8pipeline_17_parser_internals_10stateclass_10StateClass_70del_arc}, + {"open_ent", (PyCFunction)(void(*)(void))(__Pyx_PyCFunction_FastCallWithKeywords)__pyx_pw_5spacy_8pipeline_17_parser_internals_10stateclass_10StateClass_73open_ent, __Pyx_METH_FASTCALL|METH_KEYWORDS, __pyx_doc_5spacy_8pipeline_17_parser_internals_10stateclass_10StateClass_72open_ent}, + {"close_ent", (PyCFunction)(void(*)(void))(__Pyx_PyCFunction_FastCallWithKeywords)__pyx_pw_5spacy_8pipeline_17_parser_internals_10stateclass_10StateClass_75close_ent, __Pyx_METH_FASTCALL|METH_KEYWORDS, __pyx_doc_5spacy_8pipeline_17_parser_internals_10stateclass_10StateClass_74close_ent}, + {"clone", (PyCFunction)(void(*)(void))(__Pyx_PyCFunction_FastCallWithKeywords)__pyx_pw_5spacy_8pipeline_17_parser_internals_10stateclass_10StateClass_77clone, __Pyx_METH_FASTCALL|METH_KEYWORDS, __pyx_doc_5spacy_8pipeline_17_parser_internals_10stateclass_10StateClass_76clone}, + {"__reduce_cython__", (PyCFunction)(void(*)(void))(__Pyx_PyCFunction_FastCallWithKeywords)__pyx_pw_5spacy_8pipeline_17_parser_internals_10stateclass_10StateClass_79__reduce_cython__, __Pyx_METH_FASTCALL|METH_KEYWORDS, __pyx_doc_5spacy_8pipeline_17_parser_internals_10stateclass_10StateClass_78__reduce_cython__}, + {"__setstate_cython__", (PyCFunction)(void(*)(void))(__Pyx_PyCFunction_FastCallWithKeywords)__pyx_pw_5spacy_8pipeline_17_parser_internals_10stateclass_10StateClass_81__setstate_cython__, __Pyx_METH_FASTCALL|METH_KEYWORDS, __pyx_doc_5spacy_8pipeline_17_parser_internals_10stateclass_10StateClass_80__setstate_cython__}, + {0, 0, 0, 0} +}; + +static struct PyGetSetDef __pyx_getsets_5spacy_8pipeline_17_parser_internals_10stateclass_StateClass[] = { + {"stack", __pyx_getprop_5spacy_8pipeline_17_parser_internals_10stateclass_10StateClass_stack, 0, 0, 0}, + {"queue", __pyx_getprop_5spacy_8pipeline_17_parser_internals_10stateclass_10StateClass_queue, 0, 0, 0}, + {"token_vector_length", __pyx_getprop_5spacy_8pipeline_17_parser_internals_10stateclass_10StateClass_token_vector_length, 0, 0, 0}, + {"arcs", __pyx_getprop_5spacy_8pipeline_17_parser_internals_10stateclass_10StateClass_arcs, 0, 0, 0}, + {"_b_i", __pyx_getprop_5spacy_8pipeline_17_parser_internals_10stateclass_10StateClass__b_i, 0, 0, 0}, + {"length", __pyx_getprop_5spacy_8pipeline_17_parser_internals_10stateclass_10StateClass_length, 0, 0, 0}, + {"doc", __pyx_getprop_5spacy_8pipeline_17_parser_internals_10stateclass_10StateClass_doc, 0, 0, 0}, + {0, 0, 0, 0, 0} +}; +#if CYTHON_USE_TYPE_SPECS +static PyType_Slot __pyx_type_5spacy_8pipeline_17_parser_internals_10stateclass_StateClass_slots[] = { + {Py_tp_dealloc, (void *)__pyx_tp_dealloc_5spacy_8pipeline_17_parser_internals_10stateclass_StateClass}, + {Py_tp_doc, (void *)PyDoc_STR("StateClass(Doc doc=None, int offset=0)")}, + {Py_tp_traverse, (void *)__pyx_tp_traverse_5spacy_8pipeline_17_parser_internals_10stateclass_StateClass}, + {Py_tp_clear, (void *)__pyx_tp_clear_5spacy_8pipeline_17_parser_internals_10stateclass_StateClass}, + {Py_tp_methods, (void *)__pyx_methods_5spacy_8pipeline_17_parser_internals_10stateclass_StateClass}, + {Py_tp_getset, (void *)__pyx_getsets_5spacy_8pipeline_17_parser_internals_10stateclass_StateClass}, + {Py_tp_init, (void *)__pyx_pw_5spacy_8pipeline_17_parser_internals_10stateclass_10StateClass_1__init__}, + {Py_tp_new, (void *)__pyx_tp_new_5spacy_8pipeline_17_parser_internals_10stateclass_StateClass}, + {0, 0}, +}; +static PyType_Spec __pyx_type_5spacy_8pipeline_17_parser_internals_10stateclass_StateClass_spec = { + "spacy.pipeline._parser_internals.stateclass.StateClass", + sizeof(struct __pyx_obj_5spacy_8pipeline_17_parser_internals_10stateclass_StateClass), + 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_5spacy_8pipeline_17_parser_internals_10stateclass_StateClass_slots, +}; +#else + +static PyTypeObject __pyx_type_5spacy_8pipeline_17_parser_internals_10stateclass_StateClass = { + PyVarObject_HEAD_INIT(0, 0) + "spacy.pipeline._parser_internals.stateclass.""StateClass", /*tp_name*/ + sizeof(struct __pyx_obj_5spacy_8pipeline_17_parser_internals_10stateclass_StateClass), /*tp_basicsize*/ + 0, /*tp_itemsize*/ + __pyx_tp_dealloc_5spacy_8pipeline_17_parser_internals_10stateclass_StateClass, /*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("StateClass(Doc doc=None, int offset=0)"), /*tp_doc*/ + __pyx_tp_traverse_5spacy_8pipeline_17_parser_internals_10stateclass_StateClass, /*tp_traverse*/ + __pyx_tp_clear_5spacy_8pipeline_17_parser_internals_10stateclass_StateClass, /*tp_clear*/ + 0, /*tp_richcompare*/ + 0, /*tp_weaklistoffset*/ + 0, /*tp_iter*/ + 0, /*tp_iternext*/ + __pyx_methods_5spacy_8pipeline_17_parser_internals_10stateclass_StateClass, /*tp_methods*/ + 0, /*tp_members*/ + __pyx_getsets_5spacy_8pipeline_17_parser_internals_10stateclass_StateClass, /*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_5spacy_8pipeline_17_parser_internals_10stateclass_10StateClass_1__init__, /*tp_init*/ + 0, /*tp_alloc*/ + __pyx_tp_new_5spacy_8pipeline_17_parser_internals_10stateclass_StateClass, /*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 struct __pyx_vtabstruct_array __pyx_vtable_array; + +static PyObject *__pyx_tp_new_array(PyTypeObject *t, PyObject *a, PyObject *k) { + struct __pyx_array_obj *p; + PyObject *o; + o = __Pyx_AllocateExtensionType(t, 0); + if (unlikely(!o)) return 0; + p = ((struct __pyx_array_obj *)o); + p->__pyx_vtab = __pyx_vtabptr_array; + p->mode = ((PyObject*)Py_None); Py_INCREF(Py_None); + p->_format = ((PyObject*)Py_None); Py_INCREF(Py_None); + if (unlikely(__pyx_array___cinit__(o, a, k) < 0)) goto bad; + return o; + bad: + Py_DECREF(o); o = 0; + return NULL; +} + +static void __pyx_tp_dealloc_array(PyObject *o) { + struct __pyx_array_obj *p = (struct __pyx_array_obj *)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_array) { + if (PyObject_CallFinalizerFromDealloc(o)) return; + } + } + #endif + { + PyObject *etype, *eval, *etb; + PyErr_Fetch(&etype, &eval, &etb); + __Pyx_SET_REFCNT(o, Py_REFCNT(o) + 1); + __pyx_array___dealloc__(o); + __Pyx_SET_REFCNT(o, Py_REFCNT(o) - 1); + PyErr_Restore(etype, eval, etb); + } + Py_CLEAR(p->mode); + Py_CLEAR(p->_format); + 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 PyObject *__pyx_sq_item_array(PyObject *o, Py_ssize_t i) { + PyObject *r; + PyObject *x = PyLong_FromSsize_t(i); if(!x) return 0; + #if CYTHON_USE_TYPE_SLOTS || (!CYTHON_USE_TYPE_SPECS && __PYX_LIMITED_VERSION_HEX < 0x030A0000) + r = Py_TYPE(o)->tp_as_mapping->mp_subscript(o, x); + #else + r = ((binaryfunc)PyType_GetSlot(Py_TYPE(o), Py_mp_subscript))(o, x); + #endif + Py_DECREF(x); + return r; +} + +static int __pyx_mp_ass_subscript_array(PyObject *o, PyObject *i, PyObject *v) { + if (v) { + return __pyx_array___setitem__(o, i, v); + } + else { + __Pyx_TypeName o_type_name; + o_type_name = __Pyx_PyType_GetFullyQualifiedName(Py_TYPE(o)); + PyErr_Format(PyExc_NotImplementedError, + "Subscript deletion not supported by " __Pyx_FMT_TYPENAME, o_type_name); + __Pyx_DECREF_TypeName(o_type_name); + return -1; + } +} + +static PyObject *__pyx_tp_getattro_array(PyObject *o, PyObject *n) { + PyObject *v = PyObject_GenericGetAttr(o, n); + if (!v && PyErr_ExceptionMatches(PyExc_AttributeError)) { + PyErr_Clear(); + v = __pyx_array___getattr__(o, n); + } + return v; +} + +static PyObject *__pyx_getprop___pyx_array_memview(PyObject *o, CYTHON_UNUSED void *x) { + return __pyx_pw_15View_dot_MemoryView_5array_7memview_1__get__(o); +} + +static PyMethodDef __pyx_methods_array[] = { + {"__getattr__", (PyCFunction)__pyx_array___getattr__, METH_O|METH_COEXIST, 0}, + {"__reduce_cython__", (PyCFunction)(void(*)(void))(__Pyx_PyCFunction_FastCallWithKeywords)__pyx_pw___pyx_array_1__reduce_cython__, __Pyx_METH_FASTCALL|METH_KEYWORDS, 0}, + {"__setstate_cython__", (PyCFunction)(void(*)(void))(__Pyx_PyCFunction_FastCallWithKeywords)__pyx_pw___pyx_array_3__setstate_cython__, __Pyx_METH_FASTCALL|METH_KEYWORDS, 0}, + {0, 0, 0, 0} +}; + +static struct PyGetSetDef __pyx_getsets_array[] = { + {"memview", __pyx_getprop___pyx_array_memview, 0, 0, 0}, + {0, 0, 0, 0, 0} +}; +#if CYTHON_USE_TYPE_SPECS +#if !CYTHON_COMPILING_IN_LIMITED_API + +static PyBufferProcs __pyx_tp_as_buffer_array = { + __pyx_array_getbuffer, /*bf_getbuffer*/ + 0, /*bf_releasebuffer*/ +}; +#endif +static PyType_Slot __pyx_type___pyx_array_slots[] = { + {Py_tp_dealloc, (void *)__pyx_tp_dealloc_array}, + {Py_sq_length, (void *)__pyx_array___len__}, + {Py_sq_item, (void *)__pyx_sq_item_array}, + {Py_mp_length, (void *)__pyx_array___len__}, + {Py_mp_subscript, (void *)__pyx_array___getitem__}, + {Py_mp_ass_subscript, (void *)__pyx_mp_ass_subscript_array}, + {Py_tp_getattro, (void *)__pyx_tp_getattro_array}, + #if defined(Py_bf_getbuffer) + {Py_bf_getbuffer, (void *)__pyx_array_getbuffer}, + #endif + {Py_tp_methods, (void *)__pyx_methods_array}, + {Py_tp_getset, (void *)__pyx_getsets_array}, + {Py_tp_new, (void *)__pyx_tp_new_array}, + {0, 0}, +}; +static PyType_Spec __pyx_type___pyx_array_spec = { + "spacy.pipeline._parser_internals.stateclass.array", + sizeof(struct __pyx_array_obj), + 0, + Py_TPFLAGS_DEFAULT|Py_TPFLAGS_HAVE_VERSION_TAG|Py_TPFLAGS_CHECKTYPES|Py_TPFLAGS_HAVE_NEWBUFFER|Py_TPFLAGS_BASETYPE|Py_TPFLAGS_SEQUENCE, + __pyx_type___pyx_array_slots, +}; +#else + +static PySequenceMethods __pyx_tp_as_sequence_array = { + __pyx_array___len__, /*sq_length*/ + 0, /*sq_concat*/ + 0, /*sq_repeat*/ + __pyx_sq_item_array, /*sq_item*/ + 0, /*sq_slice*/ + 0, /*sq_ass_item*/ + 0, /*sq_ass_slice*/ + 0, /*sq_contains*/ + 0, /*sq_inplace_concat*/ + 0, /*sq_inplace_repeat*/ +}; + +static PyMappingMethods __pyx_tp_as_mapping_array = { + __pyx_array___len__, /*mp_length*/ + __pyx_array___getitem__, /*mp_subscript*/ + __pyx_mp_ass_subscript_array, /*mp_ass_subscript*/ +}; + +static PyBufferProcs __pyx_tp_as_buffer_array = { + __pyx_array_getbuffer, /*bf_getbuffer*/ + 0, /*bf_releasebuffer*/ +}; + +static PyTypeObject __pyx_type___pyx_array = { + PyVarObject_HEAD_INIT(0, 0) + "spacy.pipeline._parser_internals.stateclass.""array", /*tp_name*/ + sizeof(struct __pyx_array_obj), /*tp_basicsize*/ + 0, /*tp_itemsize*/ + __pyx_tp_dealloc_array, /*tp_dealloc*/ + 0, /*tp_vectorcall_offset*/ + 0, /*tp_getattr*/ + 0, /*tp_setattr*/ + 0, /*tp_as_async*/ + 0, /*tp_repr*/ + 0, /*tp_as_number*/ + &__pyx_tp_as_sequence_array, /*tp_as_sequence*/ + &__pyx_tp_as_mapping_array, /*tp_as_mapping*/ + 0, /*tp_hash*/ + 0, /*tp_call*/ + 0, /*tp_str*/ + __pyx_tp_getattro_array, /*tp_getattro*/ + 0, /*tp_setattro*/ + &__pyx_tp_as_buffer_array, /*tp_as_buffer*/ + Py_TPFLAGS_DEFAULT|Py_TPFLAGS_HAVE_VERSION_TAG|Py_TPFLAGS_CHECKTYPES|Py_TPFLAGS_HAVE_NEWBUFFER|Py_TPFLAGS_BASETYPE|Py_TPFLAGS_SEQUENCE, /*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_array, /*tp_methods*/ + 0, /*tp_members*/ + __pyx_getsets_array, /*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_array, /*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_Enum(PyTypeObject *t, CYTHON_UNUSED PyObject *a, CYTHON_UNUSED PyObject *k) { + struct __pyx_MemviewEnum_obj *p; + PyObject *o; + o = __Pyx_AllocateExtensionType(t, 0); + if (unlikely(!o)) return 0; + p = ((struct __pyx_MemviewEnum_obj *)o); + p->name = Py_None; Py_INCREF(Py_None); + return o; +} + +static void __pyx_tp_dealloc_Enum(PyObject *o) { + struct __pyx_MemviewEnum_obj *p = (struct __pyx_MemviewEnum_obj *)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_Enum) { + if (PyObject_CallFinalizerFromDealloc(o)) return; + } + } + #endif + PyObject_GC_UnTrack(o); + Py_CLEAR(p->name); + 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_Enum(PyObject *o, visitproc v, void *a) { + int e; + struct __pyx_MemviewEnum_obj *p = (struct __pyx_MemviewEnum_obj *)o; + { + e = __Pyx_call_type_traverse(o, 1, v, a); + if (e) return e; + } + if (p->name) { + e = (*v)(p->name, a); if (e) return e; + } + return 0; +} + +static int __pyx_tp_clear_Enum(PyObject *o) { + PyObject* tmp; + struct __pyx_MemviewEnum_obj *p = (struct __pyx_MemviewEnum_obj *)o; + tmp = ((PyObject*)p->name); + p->name = Py_None; Py_INCREF(Py_None); + Py_XDECREF(tmp); + return 0; +} + +static PyMethodDef __pyx_methods_Enum[] = { + {"__reduce_cython__", (PyCFunction)(void(*)(void))(__Pyx_PyCFunction_FastCallWithKeywords)__pyx_pw___pyx_MemviewEnum_1__reduce_cython__, __Pyx_METH_FASTCALL|METH_KEYWORDS, 0}, + {"__setstate_cython__", (PyCFunction)(void(*)(void))(__Pyx_PyCFunction_FastCallWithKeywords)__pyx_pw___pyx_MemviewEnum_3__setstate_cython__, __Pyx_METH_FASTCALL|METH_KEYWORDS, 0}, + {0, 0, 0, 0} +}; +#if CYTHON_USE_TYPE_SPECS +static PyType_Slot __pyx_type___pyx_MemviewEnum_slots[] = { + {Py_tp_dealloc, (void *)__pyx_tp_dealloc_Enum}, + {Py_tp_repr, (void *)__pyx_MemviewEnum___repr__}, + {Py_tp_traverse, (void *)__pyx_tp_traverse_Enum}, + {Py_tp_clear, (void *)__pyx_tp_clear_Enum}, + {Py_tp_methods, (void *)__pyx_methods_Enum}, + {Py_tp_init, (void *)__pyx_MemviewEnum___init__}, + {Py_tp_new, (void *)__pyx_tp_new_Enum}, + {0, 0}, +}; +static PyType_Spec __pyx_type___pyx_MemviewEnum_spec = { + "spacy.pipeline._parser_internals.stateclass.Enum", + sizeof(struct __pyx_MemviewEnum_obj), + 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___pyx_MemviewEnum_slots, +}; +#else + +static PyTypeObject __pyx_type___pyx_MemviewEnum = { + PyVarObject_HEAD_INIT(0, 0) + "spacy.pipeline._parser_internals.stateclass.""Enum", /*tp_name*/ + sizeof(struct __pyx_MemviewEnum_obj), /*tp_basicsize*/ + 0, /*tp_itemsize*/ + __pyx_tp_dealloc_Enum, /*tp_dealloc*/ + 0, /*tp_vectorcall_offset*/ + 0, /*tp_getattr*/ + 0, /*tp_setattr*/ + 0, /*tp_as_async*/ + __pyx_MemviewEnum___repr__, /*tp_repr*/ + 0, /*tp_as_number*/ + 0, /*tp_as_sequence*/ + 0, /*tp_as_mapping*/ + 0, /*tp_hash*/ + 0, /*tp_call*/ + 0, /*tp_str*/ + 0, /*tp_getattro*/ + 0, /*tp_setattro*/ + 0, /*tp_as_buffer*/ + Py_TPFLAGS_DEFAULT|Py_TPFLAGS_HAVE_VERSION_TAG|Py_TPFLAGS_CHECKTYPES|Py_TPFLAGS_HAVE_NEWBUFFER|Py_TPFLAGS_BASETYPE|Py_TPFLAGS_HAVE_GC, /*tp_flags*/ + 0, /*tp_doc*/ + __pyx_tp_traverse_Enum, /*tp_traverse*/ + __pyx_tp_clear_Enum, /*tp_clear*/ + 0, /*tp_richcompare*/ + 0, /*tp_weaklistoffset*/ + 0, /*tp_iter*/ + 0, /*tp_iternext*/ + __pyx_methods_Enum, /*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_MemviewEnum___init__, /*tp_init*/ + 0, /*tp_alloc*/ + __pyx_tp_new_Enum, /*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 struct __pyx_vtabstruct_memoryview __pyx_vtable_memoryview; + +static PyObject *__pyx_tp_new_memoryview(PyTypeObject *t, PyObject *a, PyObject *k) { + struct __pyx_memoryview_obj *p; + PyObject *o; + o = __Pyx_AllocateExtensionType(t, 0); + if (unlikely(!o)) return 0; + p = ((struct __pyx_memoryview_obj *)o); + p->__pyx_vtab = __pyx_vtabptr_memoryview; + p->obj = Py_None; Py_INCREF(Py_None); + p->_size = Py_None; Py_INCREF(Py_None); + p->view.obj = NULL; + if (unlikely(__pyx_memoryview___cinit__(o, a, k) < 0)) goto bad; + return o; + bad: + Py_DECREF(o); o = 0; + return NULL; +} + +static void __pyx_tp_dealloc_memoryview(PyObject *o) { + struct __pyx_memoryview_obj *p = (struct __pyx_memoryview_obj *)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_memoryview) { + 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_memoryview___dealloc__(o); + __Pyx_SET_REFCNT(o, Py_REFCNT(o) - 1); + PyErr_Restore(etype, eval, etb); + } + Py_CLEAR(p->obj); + Py_CLEAR(p->_size); + 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_memoryview(PyObject *o, visitproc v, void *a) { + int e; + struct __pyx_memoryview_obj *p = (struct __pyx_memoryview_obj *)o; + { + e = __Pyx_call_type_traverse(o, 1, v, a); + if (e) return e; + } + if (p->obj) { + e = (*v)(p->obj, a); if (e) return e; + } + if (p->_size) { + e = (*v)(p->_size, a); if (e) return e; + } + if (p->view.obj) { + e = (*v)(p->view.obj, a); if (e) return e; + } + return 0; +} + +static int __pyx_tp_clear_memoryview(PyObject *o) { + PyObject* tmp; + struct __pyx_memoryview_obj *p = (struct __pyx_memoryview_obj *)o; + tmp = ((PyObject*)p->obj); + p->obj = Py_None; Py_INCREF(Py_None); + Py_XDECREF(tmp); + tmp = ((PyObject*)p->_size); + p->_size = Py_None; Py_INCREF(Py_None); + Py_XDECREF(tmp); + Py_CLEAR(p->view.obj); + return 0; +} + +static PyObject *__pyx_sq_item_memoryview(PyObject *o, Py_ssize_t i) { + PyObject *r; + PyObject *x = PyLong_FromSsize_t(i); if(!x) return 0; + #if CYTHON_USE_TYPE_SLOTS || (!CYTHON_USE_TYPE_SPECS && __PYX_LIMITED_VERSION_HEX < 0x030A0000) + r = Py_TYPE(o)->tp_as_mapping->mp_subscript(o, x); + #else + r = ((binaryfunc)PyType_GetSlot(Py_TYPE(o), Py_mp_subscript))(o, x); + #endif + Py_DECREF(x); + return r; +} + +static int __pyx_mp_ass_subscript_memoryview(PyObject *o, PyObject *i, PyObject *v) { + if (v) { + return __pyx_memoryview___setitem__(o, i, v); + } + else { + __Pyx_TypeName o_type_name; + o_type_name = __Pyx_PyType_GetFullyQualifiedName(Py_TYPE(o)); + PyErr_Format(PyExc_NotImplementedError, + "Subscript deletion not supported by " __Pyx_FMT_TYPENAME, o_type_name); + __Pyx_DECREF_TypeName(o_type_name); + return -1; + } +} + +static PyObject *__pyx_getprop___pyx_memoryview_T(PyObject *o, CYTHON_UNUSED void *x) { + return __pyx_pw_15View_dot_MemoryView_10memoryview_1T_1__get__(o); +} + +static PyObject *__pyx_getprop___pyx_memoryview_base(PyObject *o, CYTHON_UNUSED void *x) { + return __pyx_pw_15View_dot_MemoryView_10memoryview_4base_1__get__(o); +} + +static PyObject *__pyx_getprop___pyx_memoryview_shape(PyObject *o, CYTHON_UNUSED void *x) { + return __pyx_pw_15View_dot_MemoryView_10memoryview_5shape_1__get__(o); +} + +static PyObject *__pyx_getprop___pyx_memoryview_strides(PyObject *o, CYTHON_UNUSED void *x) { + return __pyx_pw_15View_dot_MemoryView_10memoryview_7strides_1__get__(o); +} + +static PyObject *__pyx_getprop___pyx_memoryview_suboffsets(PyObject *o, CYTHON_UNUSED void *x) { + return __pyx_pw_15View_dot_MemoryView_10memoryview_10suboffsets_1__get__(o); +} + +static PyObject *__pyx_getprop___pyx_memoryview_ndim(PyObject *o, CYTHON_UNUSED void *x) { + return __pyx_pw_15View_dot_MemoryView_10memoryview_4ndim_1__get__(o); +} + +static PyObject *__pyx_getprop___pyx_memoryview_itemsize(PyObject *o, CYTHON_UNUSED void *x) { + return __pyx_pw_15View_dot_MemoryView_10memoryview_8itemsize_1__get__(o); +} + +static PyObject *__pyx_getprop___pyx_memoryview_nbytes(PyObject *o, CYTHON_UNUSED void *x) { + return __pyx_pw_15View_dot_MemoryView_10memoryview_6nbytes_1__get__(o); +} + +static PyObject *__pyx_getprop___pyx_memoryview_size(PyObject *o, CYTHON_UNUSED void *x) { + return __pyx_pw_15View_dot_MemoryView_10memoryview_4size_1__get__(o); +} + +static PyMethodDef __pyx_methods_memoryview[] = { + {"is_c_contig", (PyCFunction)(void(*)(void))(__Pyx_PyCFunction_FastCallWithKeywords)__pyx_memoryview_is_c_contig, __Pyx_METH_FASTCALL|METH_KEYWORDS, 0}, + {"is_f_contig", (PyCFunction)(void(*)(void))(__Pyx_PyCFunction_FastCallWithKeywords)__pyx_memoryview_is_f_contig, __Pyx_METH_FASTCALL|METH_KEYWORDS, 0}, + {"copy", (PyCFunction)(void(*)(void))(__Pyx_PyCFunction_FastCallWithKeywords)__pyx_memoryview_copy, __Pyx_METH_FASTCALL|METH_KEYWORDS, 0}, + {"copy_fortran", (PyCFunction)(void(*)(void))(__Pyx_PyCFunction_FastCallWithKeywords)__pyx_memoryview_copy_fortran, __Pyx_METH_FASTCALL|METH_KEYWORDS, 0}, + {"__reduce_cython__", (PyCFunction)(void(*)(void))(__Pyx_PyCFunction_FastCallWithKeywords)__pyx_pw___pyx_memoryview_1__reduce_cython__, __Pyx_METH_FASTCALL|METH_KEYWORDS, 0}, + {"__setstate_cython__", (PyCFunction)(void(*)(void))(__Pyx_PyCFunction_FastCallWithKeywords)__pyx_pw___pyx_memoryview_3__setstate_cython__, __Pyx_METH_FASTCALL|METH_KEYWORDS, 0}, + {0, 0, 0, 0} +}; + +static struct PyGetSetDef __pyx_getsets_memoryview[] = { + {"T", __pyx_getprop___pyx_memoryview_T, 0, 0, 0}, + {"base", __pyx_getprop___pyx_memoryview_base, 0, 0, 0}, + {"shape", __pyx_getprop___pyx_memoryview_shape, 0, 0, 0}, + {"strides", __pyx_getprop___pyx_memoryview_strides, 0, 0, 0}, + {"suboffsets", __pyx_getprop___pyx_memoryview_suboffsets, 0, 0, 0}, + {"ndim", __pyx_getprop___pyx_memoryview_ndim, 0, 0, 0}, + {"itemsize", __pyx_getprop___pyx_memoryview_itemsize, 0, 0, 0}, + {"nbytes", __pyx_getprop___pyx_memoryview_nbytes, 0, 0, 0}, + {"size", __pyx_getprop___pyx_memoryview_size, 0, 0, 0}, + {0, 0, 0, 0, 0} +}; +#if CYTHON_USE_TYPE_SPECS +#if !CYTHON_COMPILING_IN_LIMITED_API + +static PyBufferProcs __pyx_tp_as_buffer_memoryview = { + __pyx_memoryview_getbuffer, /*bf_getbuffer*/ + 0, /*bf_releasebuffer*/ +}; +#endif +static PyType_Slot __pyx_type___pyx_memoryview_slots[] = { + {Py_tp_dealloc, (void *)__pyx_tp_dealloc_memoryview}, + {Py_tp_repr, (void *)__pyx_memoryview___repr__}, + {Py_sq_length, (void *)__pyx_memoryview___len__}, + {Py_sq_item, (void *)__pyx_sq_item_memoryview}, + {Py_mp_length, (void *)__pyx_memoryview___len__}, + {Py_mp_subscript, (void *)__pyx_memoryview___getitem__}, + {Py_mp_ass_subscript, (void *)__pyx_mp_ass_subscript_memoryview}, + {Py_tp_str, (void *)__pyx_memoryview___str__}, + #if defined(Py_bf_getbuffer) + {Py_bf_getbuffer, (void *)__pyx_memoryview_getbuffer}, + #endif + {Py_tp_traverse, (void *)__pyx_tp_traverse_memoryview}, + {Py_tp_clear, (void *)__pyx_tp_clear_memoryview}, + {Py_tp_methods, (void *)__pyx_methods_memoryview}, + {Py_tp_getset, (void *)__pyx_getsets_memoryview}, + {Py_tp_new, (void *)__pyx_tp_new_memoryview}, + {0, 0}, +}; +static PyType_Spec __pyx_type___pyx_memoryview_spec = { + "spacy.pipeline._parser_internals.stateclass.memoryview", + sizeof(struct __pyx_memoryview_obj), + 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___pyx_memoryview_slots, +}; +#else + +static PySequenceMethods __pyx_tp_as_sequence_memoryview = { + __pyx_memoryview___len__, /*sq_length*/ + 0, /*sq_concat*/ + 0, /*sq_repeat*/ + __pyx_sq_item_memoryview, /*sq_item*/ + 0, /*sq_slice*/ + 0, /*sq_ass_item*/ + 0, /*sq_ass_slice*/ + 0, /*sq_contains*/ + 0, /*sq_inplace_concat*/ + 0, /*sq_inplace_repeat*/ +}; + +static PyMappingMethods __pyx_tp_as_mapping_memoryview = { + __pyx_memoryview___len__, /*mp_length*/ + __pyx_memoryview___getitem__, /*mp_subscript*/ + __pyx_mp_ass_subscript_memoryview, /*mp_ass_subscript*/ +}; + +static PyBufferProcs __pyx_tp_as_buffer_memoryview = { + __pyx_memoryview_getbuffer, /*bf_getbuffer*/ + 0, /*bf_releasebuffer*/ +}; + +static PyTypeObject __pyx_type___pyx_memoryview = { + PyVarObject_HEAD_INIT(0, 0) + "spacy.pipeline._parser_internals.stateclass.""memoryview", /*tp_name*/ + sizeof(struct __pyx_memoryview_obj), /*tp_basicsize*/ + 0, /*tp_itemsize*/ + __pyx_tp_dealloc_memoryview, /*tp_dealloc*/ + 0, /*tp_vectorcall_offset*/ + 0, /*tp_getattr*/ + 0, /*tp_setattr*/ + 0, /*tp_as_async*/ + __pyx_memoryview___repr__, /*tp_repr*/ + 0, /*tp_as_number*/ + &__pyx_tp_as_sequence_memoryview, /*tp_as_sequence*/ + &__pyx_tp_as_mapping_memoryview, /*tp_as_mapping*/ + 0, /*tp_hash*/ + 0, /*tp_call*/ + __pyx_memoryview___str__, /*tp_str*/ + 0, /*tp_getattro*/ + 0, /*tp_setattro*/ + &__pyx_tp_as_buffer_memoryview, /*tp_as_buffer*/ + Py_TPFLAGS_DEFAULT|Py_TPFLAGS_HAVE_VERSION_TAG|Py_TPFLAGS_CHECKTYPES|Py_TPFLAGS_HAVE_NEWBUFFER|Py_TPFLAGS_BASETYPE|Py_TPFLAGS_HAVE_GC, /*tp_flags*/ + 0, /*tp_doc*/ + __pyx_tp_traverse_memoryview, /*tp_traverse*/ + __pyx_tp_clear_memoryview, /*tp_clear*/ + 0, /*tp_richcompare*/ + 0, /*tp_weaklistoffset*/ + 0, /*tp_iter*/ + 0, /*tp_iternext*/ + __pyx_methods_memoryview, /*tp_methods*/ + 0, /*tp_members*/ + __pyx_getsets_memoryview, /*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_memoryview, /*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 struct __pyx_vtabstruct__memoryviewslice __pyx_vtable__memoryviewslice; + +static PyObject *__pyx_tp_new__memoryviewslice(PyTypeObject *t, PyObject *a, PyObject *k) { + struct __pyx_memoryviewslice_obj *p; + PyObject *o = __pyx_tp_new_memoryview(t, a, k); + if (unlikely(!o)) return 0; + p = ((struct __pyx_memoryviewslice_obj *)o); + p->__pyx_base.__pyx_vtab = (struct __pyx_vtabstruct_memoryview*)__pyx_vtabptr__memoryviewslice; + __Pyx_default_placement_construct(&(p->from_slice)); + p->from_object = Py_None; Py_INCREF(Py_None); + p->from_slice.memview = NULL; + return o; +} + +static void __pyx_tp_dealloc__memoryviewslice(PyObject *o) { + struct __pyx_memoryviewslice_obj *p = (struct __pyx_memoryviewslice_obj *)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__memoryviewslice) { + 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_memoryviewslice___dealloc__(o); + __Pyx_SET_REFCNT(o, Py_REFCNT(o) - 1); + PyErr_Restore(etype, eval, etb); + } + __Pyx_call_destructor(p->from_slice); + Py_CLEAR(p->from_object); + PyObject_GC_Track(o); + __pyx_tp_dealloc_memoryview(o); +} + +static int __pyx_tp_traverse__memoryviewslice(PyObject *o, visitproc v, void *a) { + int e; + struct __pyx_memoryviewslice_obj *p = (struct __pyx_memoryviewslice_obj *)o; + e = __pyx_tp_traverse_memoryview(o, v, a); if (e) return e; + if (p->from_object) { + e = (*v)(p->from_object, a); if (e) return e; + } + return 0; +} + +static int __pyx_tp_clear__memoryviewslice(PyObject *o) { + PyObject* tmp; + struct __pyx_memoryviewslice_obj *p = (struct __pyx_memoryviewslice_obj *)o; + __pyx_tp_clear_memoryview(o); + tmp = ((PyObject*)p->from_object); + p->from_object = Py_None; Py_INCREF(Py_None); + Py_XDECREF(tmp); + __PYX_XCLEAR_MEMVIEW(&p->from_slice, 1); + return 0; +} + +static PyMethodDef __pyx_methods__memoryviewslice[] = { + {"__reduce_cython__", (PyCFunction)(void(*)(void))(__Pyx_PyCFunction_FastCallWithKeywords)__pyx_pw___pyx_memoryviewslice_1__reduce_cython__, __Pyx_METH_FASTCALL|METH_KEYWORDS, 0}, + {"__setstate_cython__", (PyCFunction)(void(*)(void))(__Pyx_PyCFunction_FastCallWithKeywords)__pyx_pw___pyx_memoryviewslice_3__setstate_cython__, __Pyx_METH_FASTCALL|METH_KEYWORDS, 0}, + {0, 0, 0, 0} +}; +#if CYTHON_USE_TYPE_SPECS +static PyType_Slot __pyx_type___pyx_memoryviewslice_slots[] = { + {Py_tp_dealloc, (void *)__pyx_tp_dealloc__memoryviewslice}, + {Py_tp_doc, (void *)PyDoc_STR("Internal class for passing memoryview slices to Python")}, + {Py_tp_traverse, (void *)__pyx_tp_traverse__memoryviewslice}, + {Py_tp_clear, (void *)__pyx_tp_clear__memoryviewslice}, + {Py_tp_methods, (void *)__pyx_methods__memoryviewslice}, + {Py_tp_new, (void *)__pyx_tp_new__memoryviewslice}, + {0, 0}, +}; +static PyType_Spec __pyx_type___pyx_memoryviewslice_spec = { + "spacy.pipeline._parser_internals.stateclass._memoryviewslice", + sizeof(struct __pyx_memoryviewslice_obj), + 0, + Py_TPFLAGS_DEFAULT|Py_TPFLAGS_HAVE_VERSION_TAG|Py_TPFLAGS_CHECKTYPES|Py_TPFLAGS_HAVE_NEWBUFFER|Py_TPFLAGS_BASETYPE|Py_TPFLAGS_HAVE_GC|Py_TPFLAGS_SEQUENCE, + __pyx_type___pyx_memoryviewslice_slots, +}; +#else + +static PyTypeObject __pyx_type___pyx_memoryviewslice = { + PyVarObject_HEAD_INIT(0, 0) + "spacy.pipeline._parser_internals.stateclass.""_memoryviewslice", /*tp_name*/ + sizeof(struct __pyx_memoryviewslice_obj), /*tp_basicsize*/ + 0, /*tp_itemsize*/ + __pyx_tp_dealloc__memoryviewslice, /*tp_dealloc*/ + 0, /*tp_vectorcall_offset*/ + 0, /*tp_getattr*/ + 0, /*tp_setattr*/ + 0, /*tp_as_async*/ + #if CYTHON_COMPILING_IN_PYPY || 0 + __pyx_memoryview___repr__, /*tp_repr*/ + #else + 0, /*tp_repr*/ + #endif + 0, /*tp_as_number*/ + 0, /*tp_as_sequence*/ + 0, /*tp_as_mapping*/ + 0, /*tp_hash*/ + 0, /*tp_call*/ + #if CYTHON_COMPILING_IN_PYPY || 0 + __pyx_memoryview___str__, /*tp_str*/ + #else + 0, /*tp_str*/ + #endif + 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|Py_TPFLAGS_SEQUENCE, /*tp_flags*/ + PyDoc_STR("Internal class for passing memoryview slices to Python"), /*tp_doc*/ + __pyx_tp_traverse__memoryviewslice, /*tp_traverse*/ + __pyx_tp_clear__memoryviewslice, /*tp_clear*/ + 0, /*tp_richcompare*/ + 0, /*tp_weaklistoffset*/ + 0, /*tp_iter*/ + 0, /*tp_iternext*/ + __pyx_methods__memoryviewslice, /*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__memoryviewslice, /*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_collections_abc_Sequence = Py_None; Py_INCREF(Py_None); + generic = Py_None; Py_INCREF(Py_None); + strided = Py_None; Py_INCREF(Py_None); + indirect = Py_None; Py_INCREF(Py_None); + contiguous = Py_None; Py_INCREF(Py_None); + indirect_contiguous = Py_None; Py_INCREF(Py_None); + __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); + PyObject *__pyx_t_1 = NULL; + int __pyx_lineno = 0; + const char *__pyx_filename = NULL; + int __pyx_clineno = 0; + __Pyx_RefNannySetupContext("__Pyx_modinit_type_init_code", 0); + /*--- Type init code ---*/ + __pyx_vtabptr_5spacy_8pipeline_17_parser_internals_10stateclass_StateClass = &__pyx_vtable_5spacy_8pipeline_17_parser_internals_10stateclass_StateClass; + __pyx_vtable_5spacy_8pipeline_17_parser_internals_10stateclass_StateClass.borrow = (struct __pyx_obj_5spacy_8pipeline_17_parser_internals_10stateclass_StateClass *(*)(__pyx_t_5spacy_8pipeline_17_parser_internals_6_state_StateC *, struct __pyx_obj_5spacy_6tokens_3doc_Doc *))__pyx_f_5spacy_8pipeline_17_parser_internals_10stateclass_10StateClass_borrow; + __pyx_vtable_5spacy_8pipeline_17_parser_internals_10stateclass_StateClass.init_offset = (struct __pyx_obj_5spacy_8pipeline_17_parser_internals_10stateclass_StateClass *(*)(struct __pyx_t_5spacy_7structs_TokenC const *, int, int))__pyx_f_5spacy_8pipeline_17_parser_internals_10stateclass_10StateClass_init_offset; + #if CYTHON_USE_TYPE_SPECS + __pyx_mstate->__pyx_ptype_5spacy_8pipeline_17_parser_internals_10stateclass_StateClass = (PyTypeObject *) __Pyx_PyType_FromModuleAndSpec(__pyx_m, &__pyx_type_5spacy_8pipeline_17_parser_internals_10stateclass_StateClass_spec, NULL); if (unlikely(!__pyx_mstate->__pyx_ptype_5spacy_8pipeline_17_parser_internals_10stateclass_StateClass)) __PYX_ERR(0, 9, __pyx_L1_error) + if (__Pyx_fix_up_extension_type_from_spec(&__pyx_type_5spacy_8pipeline_17_parser_internals_10stateclass_StateClass_spec, __pyx_mstate->__pyx_ptype_5spacy_8pipeline_17_parser_internals_10stateclass_StateClass) < (0)) __PYX_ERR(0, 9, __pyx_L1_error) + #else + __pyx_mstate->__pyx_ptype_5spacy_8pipeline_17_parser_internals_10stateclass_StateClass = &__pyx_type_5spacy_8pipeline_17_parser_internals_10stateclass_StateClass; + #endif + #if !CYTHON_COMPILING_IN_LIMITED_API + #endif + #if !CYTHON_USE_TYPE_SPECS + if (__Pyx_PyType_Ready(__pyx_mstate->__pyx_ptype_5spacy_8pipeline_17_parser_internals_10stateclass_StateClass) < (0)) __PYX_ERR(0, 9, __pyx_L1_error) + #endif + #if CYTHON_COMPILING_IN_CPYTHON && PY_VERSION_HEX >= 0x030E0000 + PyUnstable_Object_EnableDeferredRefcount((PyObject*)__pyx_mstate->__pyx_ptype_5spacy_8pipeline_17_parser_internals_10stateclass_StateClass); + #endif + #if !CYTHON_COMPILING_IN_LIMITED_API + if ((CYTHON_USE_TYPE_SLOTS && CYTHON_USE_PYTYPE_LOOKUP) && likely(!__pyx_mstate->__pyx_ptype_5spacy_8pipeline_17_parser_internals_10stateclass_StateClass->tp_dictoffset && __pyx_mstate->__pyx_ptype_5spacy_8pipeline_17_parser_internals_10stateclass_StateClass->tp_getattro == PyObject_GenericGetAttr)) { + __pyx_mstate->__pyx_ptype_5spacy_8pipeline_17_parser_internals_10stateclass_StateClass->tp_getattro = PyObject_GenericGetAttr; + } + #endif + if (__Pyx_SetVtable(__pyx_mstate->__pyx_ptype_5spacy_8pipeline_17_parser_internals_10stateclass_StateClass, __pyx_vtabptr_5spacy_8pipeline_17_parser_internals_10stateclass_StateClass) < (0)) __PYX_ERR(0, 9, __pyx_L1_error) + if (__Pyx_MergeVtables(__pyx_mstate->__pyx_ptype_5spacy_8pipeline_17_parser_internals_10stateclass_StateClass) < (0)) __PYX_ERR(0, 9, __pyx_L1_error) + if (PyObject_SetAttr(__pyx_m, __pyx_mstate_global->__pyx_n_u_StateClass, (PyObject *) __pyx_mstate->__pyx_ptype_5spacy_8pipeline_17_parser_internals_10stateclass_StateClass) < (0)) __PYX_ERR(0, 9, __pyx_L1_error) + if (__Pyx_setup_reduce((PyObject *) __pyx_mstate->__pyx_ptype_5spacy_8pipeline_17_parser_internals_10stateclass_StateClass) < (0)) __PYX_ERR(0, 9, __pyx_L1_error) + __pyx_vtabptr_array = &__pyx_vtable_array; + __pyx_vtable_array.get_memview = (PyObject *(*)(struct __pyx_array_obj *))__pyx_array_get_memview; + #if CYTHON_USE_TYPE_SPECS + __pyx_mstate->__pyx_array_type = (PyTypeObject *) __Pyx_PyType_FromModuleAndSpec(__pyx_m, &__pyx_type___pyx_array_spec, NULL); if (unlikely(!__pyx_mstate->__pyx_array_type)) __PYX_ERR(1, 110, __pyx_L1_error) + #if !CYTHON_COMPILING_IN_LIMITED_API + __pyx_mstate->__pyx_array_type->tp_as_buffer = &__pyx_tp_as_buffer_array; + if (!__pyx_mstate->__pyx_array_type->tp_as_buffer->bf_releasebuffer && __pyx_mstate->__pyx_array_type->tp_base->tp_as_buffer && __pyx_mstate->__pyx_array_type->tp_base->tp_as_buffer->bf_releasebuffer) { + __pyx_mstate->__pyx_array_type->tp_as_buffer->bf_releasebuffer = __pyx_mstate->__pyx_array_type->tp_base->tp_as_buffer->bf_releasebuffer; + } + #elif defined(Py_bf_getbuffer) && defined(Py_bf_releasebuffer) + /* PY_VERSION_HEX >= 0x03090000 || Py_LIMITED_API >= 0x030B0000 */ + #elif defined(_MSC_VER) + #pragma message ("The buffer protocol is not supported in the Limited C-API < 3.11.") + #else + #warning "The buffer protocol is not supported in the Limited C-API < 3.11." + #endif + if (__Pyx_fix_up_extension_type_from_spec(&__pyx_type___pyx_array_spec, __pyx_mstate->__pyx_array_type) < (0)) __PYX_ERR(1, 110, __pyx_L1_error) + #else + __pyx_mstate->__pyx_array_type = &__pyx_type___pyx_array; + #endif + #if !CYTHON_COMPILING_IN_LIMITED_API + #endif + #if !CYTHON_USE_TYPE_SPECS + if (__Pyx_PyType_Ready(__pyx_mstate->__pyx_array_type) < (0)) __PYX_ERR(1, 110, __pyx_L1_error) + #endif + #if CYTHON_COMPILING_IN_CPYTHON && PY_VERSION_HEX >= 0x030E0000 + PyUnstable_Object_EnableDeferredRefcount((PyObject*)__pyx_mstate->__pyx_array_type); + #endif + if (__Pyx_SetVtable(__pyx_mstate->__pyx_array_type, __pyx_vtabptr_array) < (0)) __PYX_ERR(1, 110, __pyx_L1_error) + if (__Pyx_MergeVtables(__pyx_mstate->__pyx_array_type) < (0)) __PYX_ERR(1, 110, __pyx_L1_error) + if (__Pyx_setup_reduce((PyObject *) __pyx_mstate->__pyx_array_type) < (0)) __PYX_ERR(1, 110, __pyx_L1_error) + #if CYTHON_USE_TYPE_SPECS + __pyx_mstate->__pyx_MemviewEnum_type = (PyTypeObject *) __Pyx_PyType_FromModuleAndSpec(__pyx_m, &__pyx_type___pyx_MemviewEnum_spec, NULL); if (unlikely(!__pyx_mstate->__pyx_MemviewEnum_type)) __PYX_ERR(1, 299, __pyx_L1_error) + if (__Pyx_fix_up_extension_type_from_spec(&__pyx_type___pyx_MemviewEnum_spec, __pyx_mstate->__pyx_MemviewEnum_type) < (0)) __PYX_ERR(1, 299, __pyx_L1_error) + #else + __pyx_mstate->__pyx_MemviewEnum_type = &__pyx_type___pyx_MemviewEnum; + #endif + #if !CYTHON_COMPILING_IN_LIMITED_API + #endif + #if !CYTHON_USE_TYPE_SPECS + if (__Pyx_PyType_Ready(__pyx_mstate->__pyx_MemviewEnum_type) < (0)) __PYX_ERR(1, 299, __pyx_L1_error) + #endif + #if CYTHON_COMPILING_IN_CPYTHON && PY_VERSION_HEX >= 0x030E0000 + PyUnstable_Object_EnableDeferredRefcount((PyObject*)__pyx_mstate->__pyx_MemviewEnum_type); + #endif + #if !CYTHON_COMPILING_IN_LIMITED_API + if ((CYTHON_USE_TYPE_SLOTS && CYTHON_USE_PYTYPE_LOOKUP) && likely(!__pyx_mstate->__pyx_MemviewEnum_type->tp_dictoffset && __pyx_mstate->__pyx_MemviewEnum_type->tp_getattro == PyObject_GenericGetAttr)) { + __pyx_mstate->__pyx_MemviewEnum_type->tp_getattro = PyObject_GenericGetAttr; + } + #endif + if (__Pyx_setup_reduce((PyObject *) __pyx_mstate->__pyx_MemviewEnum_type) < (0)) __PYX_ERR(1, 299, __pyx_L1_error) + __pyx_vtabptr_memoryview = &__pyx_vtable_memoryview; + __pyx_vtable_memoryview.get_item_pointer = (char *(*)(struct __pyx_memoryview_obj *, PyObject *))__pyx_memoryview_get_item_pointer; + __pyx_vtable_memoryview.is_slice = (PyObject *(*)(struct __pyx_memoryview_obj *, PyObject *))__pyx_memoryview_is_slice; + __pyx_vtable_memoryview.setitem_slice_assignment = (PyObject *(*)(struct __pyx_memoryview_obj *, PyObject *, PyObject *))__pyx_memoryview_setitem_slice_assignment; + __pyx_vtable_memoryview.setitem_slice_assign_scalar = (PyObject *(*)(struct __pyx_memoryview_obj *, struct __pyx_memoryview_obj *, PyObject *))__pyx_memoryview_setitem_slice_assign_scalar; + __pyx_vtable_memoryview.setitem_indexed = (PyObject *(*)(struct __pyx_memoryview_obj *, PyObject *, PyObject *))__pyx_memoryview_setitem_indexed; + __pyx_vtable_memoryview.convert_item_to_object = (PyObject *(*)(struct __pyx_memoryview_obj *, char *))__pyx_memoryview_convert_item_to_object; + __pyx_vtable_memoryview.assign_item_from_object = (PyObject *(*)(struct __pyx_memoryview_obj *, char *, PyObject *))__pyx_memoryview_assign_item_from_object; + __pyx_vtable_memoryview._get_base = (PyObject *(*)(struct __pyx_memoryview_obj *))__pyx_memoryview__get_base; + #if CYTHON_USE_TYPE_SPECS + __pyx_mstate->__pyx_memoryview_type = (PyTypeObject *) __Pyx_PyType_FromModuleAndSpec(__pyx_m, &__pyx_type___pyx_memoryview_spec, NULL); if (unlikely(!__pyx_mstate->__pyx_memoryview_type)) __PYX_ERR(1, 334, __pyx_L1_error) + #if !CYTHON_COMPILING_IN_LIMITED_API + __pyx_mstate->__pyx_memoryview_type->tp_as_buffer = &__pyx_tp_as_buffer_memoryview; + if (!__pyx_mstate->__pyx_memoryview_type->tp_as_buffer->bf_releasebuffer && __pyx_mstate->__pyx_memoryview_type->tp_base->tp_as_buffer && __pyx_mstate->__pyx_memoryview_type->tp_base->tp_as_buffer->bf_releasebuffer) { + __pyx_mstate->__pyx_memoryview_type->tp_as_buffer->bf_releasebuffer = __pyx_mstate->__pyx_memoryview_type->tp_base->tp_as_buffer->bf_releasebuffer; + } + #elif defined(Py_bf_getbuffer) && defined(Py_bf_releasebuffer) + /* PY_VERSION_HEX >= 0x03090000 || Py_LIMITED_API >= 0x030B0000 */ + #elif defined(_MSC_VER) + #pragma message ("The buffer protocol is not supported in the Limited C-API < 3.11.") + #else + #warning "The buffer protocol is not supported in the Limited C-API < 3.11." + #endif + if (__Pyx_fix_up_extension_type_from_spec(&__pyx_type___pyx_memoryview_spec, __pyx_mstate->__pyx_memoryview_type) < (0)) __PYX_ERR(1, 334, __pyx_L1_error) + #else + __pyx_mstate->__pyx_memoryview_type = &__pyx_type___pyx_memoryview; + #endif + #if !CYTHON_COMPILING_IN_LIMITED_API + #endif + #if !CYTHON_USE_TYPE_SPECS + if (__Pyx_PyType_Ready(__pyx_mstate->__pyx_memoryview_type) < (0)) __PYX_ERR(1, 334, __pyx_L1_error) + #endif + #if CYTHON_COMPILING_IN_CPYTHON && PY_VERSION_HEX >= 0x030E0000 + PyUnstable_Object_EnableDeferredRefcount((PyObject*)__pyx_mstate->__pyx_memoryview_type); + #endif + #if !CYTHON_COMPILING_IN_LIMITED_API + if ((CYTHON_USE_TYPE_SLOTS && CYTHON_USE_PYTYPE_LOOKUP) && likely(!__pyx_mstate->__pyx_memoryview_type->tp_dictoffset && __pyx_mstate->__pyx_memoryview_type->tp_getattro == PyObject_GenericGetAttr)) { + __pyx_mstate->__pyx_memoryview_type->tp_getattro = PyObject_GenericGetAttr; + } + #endif + if (__Pyx_SetVtable(__pyx_mstate->__pyx_memoryview_type, __pyx_vtabptr_memoryview) < (0)) __PYX_ERR(1, 334, __pyx_L1_error) + if (__Pyx_MergeVtables(__pyx_mstate->__pyx_memoryview_type) < (0)) __PYX_ERR(1, 334, __pyx_L1_error) + if (__Pyx_setup_reduce((PyObject *) __pyx_mstate->__pyx_memoryview_type) < (0)) __PYX_ERR(1, 334, __pyx_L1_error) + __pyx_vtabptr__memoryviewslice = &__pyx_vtable__memoryviewslice; + __pyx_vtable__memoryviewslice.__pyx_base = *__pyx_vtabptr_memoryview; + __pyx_vtable__memoryviewslice.__pyx_base.convert_item_to_object = (PyObject *(*)(struct __pyx_memoryview_obj *, char *))__pyx_memoryviewslice_convert_item_to_object; + __pyx_vtable__memoryviewslice.__pyx_base.assign_item_from_object = (PyObject *(*)(struct __pyx_memoryview_obj *, char *, PyObject *))__pyx_memoryviewslice_assign_item_from_object; + __pyx_vtable__memoryviewslice.__pyx_base._get_base = (PyObject *(*)(struct __pyx_memoryview_obj *))__pyx_memoryviewslice__get_base; + #if CYTHON_USE_TYPE_SPECS + __pyx_t_1 = PyTuple_Pack(1, (PyObject *)__pyx_mstate_global->__pyx_memoryview_type); if (unlikely(!__pyx_t_1)) __PYX_ERR(1, 951, __pyx_L1_error) + __Pyx_GOTREF(__pyx_t_1); + __pyx_mstate->__pyx_memoryviewslice_type = (PyTypeObject *) __Pyx_PyType_FromModuleAndSpec(__pyx_m, &__pyx_type___pyx_memoryviewslice_spec, __pyx_t_1); + __Pyx_XDECREF(__pyx_t_1); __pyx_t_1 = 0; + if (unlikely(!__pyx_mstate->__pyx_memoryviewslice_type)) __PYX_ERR(1, 951, __pyx_L1_error) + if (__Pyx_fix_up_extension_type_from_spec(&__pyx_type___pyx_memoryviewslice_spec, __pyx_mstate->__pyx_memoryviewslice_type) < (0)) __PYX_ERR(1, 951, __pyx_L1_error) + #else + __pyx_mstate->__pyx_memoryviewslice_type = &__pyx_type___pyx_memoryviewslice; + #endif + #if !CYTHON_COMPILING_IN_LIMITED_API + __pyx_mstate_global->__pyx_memoryviewslice_type->tp_base = __pyx_mstate_global->__pyx_memoryview_type; + #endif + #if !CYTHON_USE_TYPE_SPECS + if (__Pyx_PyType_Ready(__pyx_mstate->__pyx_memoryviewslice_type) < (0)) __PYX_ERR(1, 951, __pyx_L1_error) + #endif + #if CYTHON_COMPILING_IN_CPYTHON && PY_VERSION_HEX >= 0x030E0000 + PyUnstable_Object_EnableDeferredRefcount((PyObject*)__pyx_mstate->__pyx_memoryviewslice_type); + #endif + #if !CYTHON_COMPILING_IN_LIMITED_API + if ((CYTHON_USE_TYPE_SLOTS && CYTHON_USE_PYTYPE_LOOKUP) && likely(!__pyx_mstate->__pyx_memoryviewslice_type->tp_dictoffset && __pyx_mstate->__pyx_memoryviewslice_type->tp_getattro == PyObject_GenericGetAttr)) { + __pyx_mstate->__pyx_memoryviewslice_type->tp_getattro = PyObject_GenericGetAttr; + } + #endif + if (__Pyx_SetVtable(__pyx_mstate->__pyx_memoryviewslice_type, __pyx_vtabptr__memoryviewslice) < (0)) __PYX_ERR(1, 951, __pyx_L1_error) + if (__Pyx_MergeVtables(__pyx_mstate->__pyx_memoryviewslice_type) < (0)) __PYX_ERR(1, 951, __pyx_L1_error) + if (__Pyx_setup_reduce((PyObject *) __pyx_mstate->__pyx_memoryviewslice_type) < (0)) __PYX_ERR(1, 951, __pyx_L1_error) + __Pyx_RefNannyFinishContext(); + return 0; + __pyx_L1_error:; + __Pyx_XDECREF(__pyx_t_1); + __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("cymem.cymem"); if (unlikely(!__pyx_t_1)) __PYX_ERR(6, 4, __pyx_L1_error) + __Pyx_GOTREF(__pyx_t_1); + __pyx_mstate->__pyx_ptype_5cymem_5cymem_PyMalloc = __Pyx_ImportType_3_2_1(__pyx_t_1, "cymem.cymem", "PyMalloc", + #if defined(PYPY_VERSION_NUM) && PYPY_VERSION_NUM < 0x050B0000 + sizeof(struct __pyx_obj_5cymem_5cymem_PyMalloc), __PYX_GET_STRUCT_ALIGNMENT_3_2_1(struct __pyx_obj_5cymem_5cymem_PyMalloc), + #elif CYTHON_COMPILING_IN_LIMITED_API + sizeof(struct __pyx_obj_5cymem_5cymem_PyMalloc), __PYX_GET_STRUCT_ALIGNMENT_3_2_1(struct __pyx_obj_5cymem_5cymem_PyMalloc), + #else + sizeof(struct __pyx_obj_5cymem_5cymem_PyMalloc), __PYX_GET_STRUCT_ALIGNMENT_3_2_1(struct __pyx_obj_5cymem_5cymem_PyMalloc), + #endif + __Pyx_ImportType_CheckSize_Warn_3_2_1); if (!__pyx_mstate->__pyx_ptype_5cymem_5cymem_PyMalloc) __PYX_ERR(6, 4, __pyx_L1_error) + __pyx_vtabptr_5cymem_5cymem_PyMalloc = (struct __pyx_vtabstruct_5cymem_5cymem_PyMalloc*)__Pyx_GetVtable(__pyx_mstate->__pyx_ptype_5cymem_5cymem_PyMalloc); if (unlikely(!__pyx_vtabptr_5cymem_5cymem_PyMalloc)) __PYX_ERR(6, 4, __pyx_L1_error) + __pyx_mstate->__pyx_ptype_5cymem_5cymem_PyFree = __Pyx_ImportType_3_2_1(__pyx_t_1, "cymem.cymem", "PyFree", + #if defined(PYPY_VERSION_NUM) && PYPY_VERSION_NUM < 0x050B0000 + sizeof(struct __pyx_obj_5cymem_5cymem_PyFree), __PYX_GET_STRUCT_ALIGNMENT_3_2_1(struct __pyx_obj_5cymem_5cymem_PyFree), + #elif CYTHON_COMPILING_IN_LIMITED_API + sizeof(struct __pyx_obj_5cymem_5cymem_PyFree), __PYX_GET_STRUCT_ALIGNMENT_3_2_1(struct __pyx_obj_5cymem_5cymem_PyFree), + #else + sizeof(struct __pyx_obj_5cymem_5cymem_PyFree), __PYX_GET_STRUCT_ALIGNMENT_3_2_1(struct __pyx_obj_5cymem_5cymem_PyFree), + #endif + __Pyx_ImportType_CheckSize_Warn_3_2_1); if (!__pyx_mstate->__pyx_ptype_5cymem_5cymem_PyFree) __PYX_ERR(6, 10, __pyx_L1_error) + __pyx_vtabptr_5cymem_5cymem_PyFree = (struct __pyx_vtabstruct_5cymem_5cymem_PyFree*)__Pyx_GetVtable(__pyx_mstate->__pyx_ptype_5cymem_5cymem_PyFree); if (unlikely(!__pyx_vtabptr_5cymem_5cymem_PyFree)) __PYX_ERR(6, 10, __pyx_L1_error) + __pyx_mstate->__pyx_ptype_5cymem_5cymem_Pool = __Pyx_ImportType_3_2_1(__pyx_t_1, "cymem.cymem", "Pool", + #if defined(PYPY_VERSION_NUM) && PYPY_VERSION_NUM < 0x050B0000 + sizeof(struct __pyx_obj_5cymem_5cymem_Pool), __PYX_GET_STRUCT_ALIGNMENT_3_2_1(struct __pyx_obj_5cymem_5cymem_Pool), + #elif CYTHON_COMPILING_IN_LIMITED_API + sizeof(struct __pyx_obj_5cymem_5cymem_Pool), __PYX_GET_STRUCT_ALIGNMENT_3_2_1(struct __pyx_obj_5cymem_5cymem_Pool), + #else + sizeof(struct __pyx_obj_5cymem_5cymem_Pool), __PYX_GET_STRUCT_ALIGNMENT_3_2_1(struct __pyx_obj_5cymem_5cymem_Pool), + #endif + __Pyx_ImportType_CheckSize_Warn_3_2_1); if (!__pyx_mstate->__pyx_ptype_5cymem_5cymem_Pool) __PYX_ERR(6, 16, __pyx_L1_error) + __pyx_vtabptr_5cymem_5cymem_Pool = (struct __pyx_vtabstruct_5cymem_5cymem_Pool*)__Pyx_GetVtable(__pyx_mstate->__pyx_ptype_5cymem_5cymem_Pool); if (unlikely(!__pyx_vtabptr_5cymem_5cymem_Pool)) __PYX_ERR(6, 16, __pyx_L1_error) + __pyx_mstate->__pyx_ptype_5cymem_5cymem_Address = __Pyx_ImportType_3_2_1(__pyx_t_1, "cymem.cymem", "Address", + #if defined(PYPY_VERSION_NUM) && PYPY_VERSION_NUM < 0x050B0000 + sizeof(struct __pyx_obj_5cymem_5cymem_Address), __PYX_GET_STRUCT_ALIGNMENT_3_2_1(struct __pyx_obj_5cymem_5cymem_Address), + #elif CYTHON_COMPILING_IN_LIMITED_API + sizeof(struct __pyx_obj_5cymem_5cymem_Address), __PYX_GET_STRUCT_ALIGNMENT_3_2_1(struct __pyx_obj_5cymem_5cymem_Address), + #else + sizeof(struct __pyx_obj_5cymem_5cymem_Address), __PYX_GET_STRUCT_ALIGNMENT_3_2_1(struct __pyx_obj_5cymem_5cymem_Address), + #endif + __Pyx_ImportType_CheckSize_Warn_3_2_1); if (!__pyx_mstate->__pyx_ptype_5cymem_5cymem_Address) __PYX_ERR(6, 28, __pyx_L1_error) + __Pyx_DECREF(__pyx_t_1); __pyx_t_1 = 0; + __pyx_t_1 = PyImport_ImportModule(__Pyx_BUILTIN_MODULE_NAME); if (unlikely(!__pyx_t_1)) __PYX_ERR(7, 9, __pyx_L1_error) + __Pyx_GOTREF(__pyx_t_1); + __pyx_mstate->__pyx_ptype_7cpython_4type_type = __Pyx_ImportType_3_2_1(__pyx_t_1, __Pyx_BUILTIN_MODULE_NAME, "type", + #if defined(PYPY_VERSION_NUM) && PYPY_VERSION_NUM < 0x050B0000 + sizeof(PyTypeObject), __PYX_GET_STRUCT_ALIGNMENT_3_2_1(PyTypeObject), + #elif CYTHON_COMPILING_IN_LIMITED_API + 0, 0, + #else + sizeof(PyHeapTypeObject), __PYX_GET_STRUCT_ALIGNMENT_3_2_1(PyHeapTypeObject), + #endif + __Pyx_ImportType_CheckSize_Warn_3_2_1); if (!__pyx_mstate->__pyx_ptype_7cpython_4type_type) __PYX_ERR(7, 9, __pyx_L1_error) + __Pyx_DECREF(__pyx_t_1); __pyx_t_1 = 0; + __pyx_t_1 = PyImport_ImportModule("numpy"); if (unlikely(!__pyx_t_1)) __PYX_ERR(2, 228, __pyx_L1_error) + __Pyx_GOTREF(__pyx_t_1); + __pyx_mstate->__pyx_ptype_5numpy_dtype = __Pyx_ImportType_3_2_1(__pyx_t_1, "numpy", "dtype", + #if defined(PYPY_VERSION_NUM) && PYPY_VERSION_NUM < 0x050B0000 + sizeof(PyArray_Descr), __PYX_GET_STRUCT_ALIGNMENT_3_2_1(PyArray_Descr), + #elif CYTHON_COMPILING_IN_LIMITED_API + sizeof(PyArray_Descr), __PYX_GET_STRUCT_ALIGNMENT_3_2_1(PyArray_Descr), + #else + sizeof(PyArray_Descr), __PYX_GET_STRUCT_ALIGNMENT_3_2_1(PyArray_Descr), + #endif + __Pyx_ImportType_CheckSize_Ignore_3_2_1); if (!__pyx_mstate->__pyx_ptype_5numpy_dtype) __PYX_ERR(2, 228, __pyx_L1_error) + __pyx_mstate->__pyx_ptype_5numpy_flatiter = __Pyx_ImportType_3_2_1(__pyx_t_1, "numpy", "flatiter", + #if defined(PYPY_VERSION_NUM) && PYPY_VERSION_NUM < 0x050B0000 + sizeof(PyArrayIterObject), __PYX_GET_STRUCT_ALIGNMENT_3_2_1(PyArrayIterObject), + #elif CYTHON_COMPILING_IN_LIMITED_API + sizeof(PyArrayIterObject), __PYX_GET_STRUCT_ALIGNMENT_3_2_1(PyArrayIterObject), + #else + sizeof(PyArrayIterObject), __PYX_GET_STRUCT_ALIGNMENT_3_2_1(PyArrayIterObject), + #endif + __Pyx_ImportType_CheckSize_Ignore_3_2_1); if (!__pyx_mstate->__pyx_ptype_5numpy_flatiter) __PYX_ERR(2, 273, __pyx_L1_error) + __pyx_mstate->__pyx_ptype_5numpy_broadcast = __Pyx_ImportType_3_2_1(__pyx_t_1, "numpy", "broadcast", + #if defined(PYPY_VERSION_NUM) && PYPY_VERSION_NUM < 0x050B0000 + sizeof(PyArrayMultiIterObject), __PYX_GET_STRUCT_ALIGNMENT_3_2_1(PyArrayMultiIterObject), + #elif CYTHON_COMPILING_IN_LIMITED_API + sizeof(PyArrayMultiIterObject), __PYX_GET_STRUCT_ALIGNMENT_3_2_1(PyArrayMultiIterObject), + #else + sizeof(PyArrayMultiIterObject), __PYX_GET_STRUCT_ALIGNMENT_3_2_1(PyArrayMultiIterObject), + #endif + __Pyx_ImportType_CheckSize_Ignore_3_2_1); if (!__pyx_mstate->__pyx_ptype_5numpy_broadcast) __PYX_ERR(2, 277, __pyx_L1_error) + __pyx_mstate->__pyx_ptype_5numpy_ndarray = __Pyx_ImportType_3_2_1(__pyx_t_1, "numpy", "ndarray", + #if defined(PYPY_VERSION_NUM) && PYPY_VERSION_NUM < 0x050B0000 + sizeof(PyArrayObject), __PYX_GET_STRUCT_ALIGNMENT_3_2_1(PyArrayObject), + #elif CYTHON_COMPILING_IN_LIMITED_API + sizeof(PyArrayObject), __PYX_GET_STRUCT_ALIGNMENT_3_2_1(PyArrayObject), + #else + sizeof(PyArrayObject), __PYX_GET_STRUCT_ALIGNMENT_3_2_1(PyArrayObject), + #endif + __Pyx_ImportType_CheckSize_Ignore_3_2_1); if (!__pyx_mstate->__pyx_ptype_5numpy_ndarray) __PYX_ERR(2, 316, __pyx_L1_error) + __pyx_mstate->__pyx_ptype_5numpy_generic = __Pyx_ImportType_3_2_1(__pyx_t_1, "numpy", "generic", + #if defined(PYPY_VERSION_NUM) && PYPY_VERSION_NUM < 0x050B0000 + sizeof(PyObject), __PYX_GET_STRUCT_ALIGNMENT_3_2_1(PyObject), + #elif CYTHON_COMPILING_IN_LIMITED_API + sizeof(PyObject), __PYX_GET_STRUCT_ALIGNMENT_3_2_1(PyObject), + #else + sizeof(PyObject), __PYX_GET_STRUCT_ALIGNMENT_3_2_1(PyObject), + #endif + __Pyx_ImportType_CheckSize_Warn_3_2_1); if (!__pyx_mstate->__pyx_ptype_5numpy_generic) __PYX_ERR(2, 825, __pyx_L1_error) + __pyx_mstate->__pyx_ptype_5numpy_number = __Pyx_ImportType_3_2_1(__pyx_t_1, "numpy", "number", + #if defined(PYPY_VERSION_NUM) && PYPY_VERSION_NUM < 0x050B0000 + sizeof(PyObject), __PYX_GET_STRUCT_ALIGNMENT_3_2_1(PyObject), + #elif CYTHON_COMPILING_IN_LIMITED_API + sizeof(PyObject), __PYX_GET_STRUCT_ALIGNMENT_3_2_1(PyObject), + #else + sizeof(PyObject), __PYX_GET_STRUCT_ALIGNMENT_3_2_1(PyObject), + #endif + __Pyx_ImportType_CheckSize_Warn_3_2_1); if (!__pyx_mstate->__pyx_ptype_5numpy_number) __PYX_ERR(2, 827, __pyx_L1_error) + __pyx_mstate->__pyx_ptype_5numpy_integer = __Pyx_ImportType_3_2_1(__pyx_t_1, "numpy", "integer", + #if defined(PYPY_VERSION_NUM) && PYPY_VERSION_NUM < 0x050B0000 + sizeof(PyObject), __PYX_GET_STRUCT_ALIGNMENT_3_2_1(PyObject), + #elif CYTHON_COMPILING_IN_LIMITED_API + sizeof(PyObject), __PYX_GET_STRUCT_ALIGNMENT_3_2_1(PyObject), + #else + sizeof(PyObject), __PYX_GET_STRUCT_ALIGNMENT_3_2_1(PyObject), + #endif + __Pyx_ImportType_CheckSize_Warn_3_2_1); if (!__pyx_mstate->__pyx_ptype_5numpy_integer) __PYX_ERR(2, 829, __pyx_L1_error) + __pyx_mstate->__pyx_ptype_5numpy_signedinteger = __Pyx_ImportType_3_2_1(__pyx_t_1, "numpy", "signedinteger", + #if defined(PYPY_VERSION_NUM) && PYPY_VERSION_NUM < 0x050B0000 + sizeof(PyObject), __PYX_GET_STRUCT_ALIGNMENT_3_2_1(PyObject), + #elif CYTHON_COMPILING_IN_LIMITED_API + sizeof(PyObject), __PYX_GET_STRUCT_ALIGNMENT_3_2_1(PyObject), + #else + sizeof(PyObject), __PYX_GET_STRUCT_ALIGNMENT_3_2_1(PyObject), + #endif + __Pyx_ImportType_CheckSize_Warn_3_2_1); if (!__pyx_mstate->__pyx_ptype_5numpy_signedinteger) __PYX_ERR(2, 831, __pyx_L1_error) + __pyx_mstate->__pyx_ptype_5numpy_unsignedinteger = __Pyx_ImportType_3_2_1(__pyx_t_1, "numpy", "unsignedinteger", + #if defined(PYPY_VERSION_NUM) && PYPY_VERSION_NUM < 0x050B0000 + sizeof(PyObject), __PYX_GET_STRUCT_ALIGNMENT_3_2_1(PyObject), + #elif CYTHON_COMPILING_IN_LIMITED_API + sizeof(PyObject), __PYX_GET_STRUCT_ALIGNMENT_3_2_1(PyObject), + #else + sizeof(PyObject), __PYX_GET_STRUCT_ALIGNMENT_3_2_1(PyObject), + #endif + __Pyx_ImportType_CheckSize_Warn_3_2_1); if (!__pyx_mstate->__pyx_ptype_5numpy_unsignedinteger) __PYX_ERR(2, 833, __pyx_L1_error) + __pyx_mstate->__pyx_ptype_5numpy_inexact = __Pyx_ImportType_3_2_1(__pyx_t_1, "numpy", "inexact", + #if defined(PYPY_VERSION_NUM) && PYPY_VERSION_NUM < 0x050B0000 + sizeof(PyObject), __PYX_GET_STRUCT_ALIGNMENT_3_2_1(PyObject), + #elif CYTHON_COMPILING_IN_LIMITED_API + sizeof(PyObject), __PYX_GET_STRUCT_ALIGNMENT_3_2_1(PyObject), + #else + sizeof(PyObject), __PYX_GET_STRUCT_ALIGNMENT_3_2_1(PyObject), + #endif + __Pyx_ImportType_CheckSize_Warn_3_2_1); if (!__pyx_mstate->__pyx_ptype_5numpy_inexact) __PYX_ERR(2, 835, __pyx_L1_error) + __pyx_mstate->__pyx_ptype_5numpy_floating = __Pyx_ImportType_3_2_1(__pyx_t_1, "numpy", "floating", + #if defined(PYPY_VERSION_NUM) && PYPY_VERSION_NUM < 0x050B0000 + sizeof(PyObject), __PYX_GET_STRUCT_ALIGNMENT_3_2_1(PyObject), + #elif CYTHON_COMPILING_IN_LIMITED_API + sizeof(PyObject), __PYX_GET_STRUCT_ALIGNMENT_3_2_1(PyObject), + #else + sizeof(PyObject), __PYX_GET_STRUCT_ALIGNMENT_3_2_1(PyObject), + #endif + __Pyx_ImportType_CheckSize_Warn_3_2_1); if (!__pyx_mstate->__pyx_ptype_5numpy_floating) __PYX_ERR(2, 837, __pyx_L1_error) + __pyx_mstate->__pyx_ptype_5numpy_complexfloating = __Pyx_ImportType_3_2_1(__pyx_t_1, "numpy", "complexfloating", + #if defined(PYPY_VERSION_NUM) && PYPY_VERSION_NUM < 0x050B0000 + sizeof(PyObject), __PYX_GET_STRUCT_ALIGNMENT_3_2_1(PyObject), + #elif CYTHON_COMPILING_IN_LIMITED_API + sizeof(PyObject), __PYX_GET_STRUCT_ALIGNMENT_3_2_1(PyObject), + #else + sizeof(PyObject), __PYX_GET_STRUCT_ALIGNMENT_3_2_1(PyObject), + #endif + __Pyx_ImportType_CheckSize_Warn_3_2_1); if (!__pyx_mstate->__pyx_ptype_5numpy_complexfloating) __PYX_ERR(2, 839, __pyx_L1_error) + __pyx_mstate->__pyx_ptype_5numpy_flexible = __Pyx_ImportType_3_2_1(__pyx_t_1, "numpy", "flexible", + #if defined(PYPY_VERSION_NUM) && PYPY_VERSION_NUM < 0x050B0000 + sizeof(PyObject), __PYX_GET_STRUCT_ALIGNMENT_3_2_1(PyObject), + #elif CYTHON_COMPILING_IN_LIMITED_API + sizeof(PyObject), __PYX_GET_STRUCT_ALIGNMENT_3_2_1(PyObject), + #else + sizeof(PyObject), __PYX_GET_STRUCT_ALIGNMENT_3_2_1(PyObject), + #endif + __Pyx_ImportType_CheckSize_Warn_3_2_1); if (!__pyx_mstate->__pyx_ptype_5numpy_flexible) __PYX_ERR(2, 841, __pyx_L1_error) + __pyx_mstate->__pyx_ptype_5numpy_character = __Pyx_ImportType_3_2_1(__pyx_t_1, "numpy", "character", + #if defined(PYPY_VERSION_NUM) && PYPY_VERSION_NUM < 0x050B0000 + sizeof(PyObject), __PYX_GET_STRUCT_ALIGNMENT_3_2_1(PyObject), + #elif CYTHON_COMPILING_IN_LIMITED_API + sizeof(PyObject), __PYX_GET_STRUCT_ALIGNMENT_3_2_1(PyObject), + #else + sizeof(PyObject), __PYX_GET_STRUCT_ALIGNMENT_3_2_1(PyObject), + #endif + __Pyx_ImportType_CheckSize_Warn_3_2_1); if (!__pyx_mstate->__pyx_ptype_5numpy_character) __PYX_ERR(2, 843, __pyx_L1_error) + __pyx_mstate->__pyx_ptype_5numpy_ufunc = __Pyx_ImportType_3_2_1(__pyx_t_1, "numpy", "ufunc", + #if defined(PYPY_VERSION_NUM) && PYPY_VERSION_NUM < 0x050B0000 + sizeof(PyUFuncObject), __PYX_GET_STRUCT_ALIGNMENT_3_2_1(PyUFuncObject), + #elif CYTHON_COMPILING_IN_LIMITED_API + sizeof(PyUFuncObject), __PYX_GET_STRUCT_ALIGNMENT_3_2_1(PyUFuncObject), + #else + sizeof(PyUFuncObject), __PYX_GET_STRUCT_ALIGNMENT_3_2_1(PyUFuncObject), + #endif + __Pyx_ImportType_CheckSize_Ignore_3_2_1); if (!__pyx_mstate->__pyx_ptype_5numpy_ufunc) __PYX_ERR(2, 907, __pyx_L1_error) + __Pyx_DECREF(__pyx_t_1); __pyx_t_1 = 0; + __pyx_t_1 = PyImport_ImportModule("preshed.maps"); if (unlikely(!__pyx_t_1)) __PYX_ERR(8, 45, __pyx_L1_error) + __Pyx_GOTREF(__pyx_t_1); + __pyx_mstate->__pyx_ptype_7preshed_4maps_PreshMap = __Pyx_ImportType_3_2_1(__pyx_t_1, "preshed.maps", "PreshMap", + #if defined(PYPY_VERSION_NUM) && PYPY_VERSION_NUM < 0x050B0000 + sizeof(struct __pyx_obj_7preshed_4maps_PreshMap), __PYX_GET_STRUCT_ALIGNMENT_3_2_1(struct __pyx_obj_7preshed_4maps_PreshMap), + #elif CYTHON_COMPILING_IN_LIMITED_API + sizeof(struct __pyx_obj_7preshed_4maps_PreshMap), __PYX_GET_STRUCT_ALIGNMENT_3_2_1(struct __pyx_obj_7preshed_4maps_PreshMap), + #else + sizeof(struct __pyx_obj_7preshed_4maps_PreshMap), __PYX_GET_STRUCT_ALIGNMENT_3_2_1(struct __pyx_obj_7preshed_4maps_PreshMap), + #endif + __Pyx_ImportType_CheckSize_Warn_3_2_1); if (!__pyx_mstate->__pyx_ptype_7preshed_4maps_PreshMap) __PYX_ERR(8, 45, __pyx_L1_error) + __pyx_vtabptr_7preshed_4maps_PreshMap = (struct __pyx_vtabstruct_7preshed_4maps_PreshMap*)__Pyx_GetVtable(__pyx_mstate->__pyx_ptype_7preshed_4maps_PreshMap); if (unlikely(!__pyx_vtabptr_7preshed_4maps_PreshMap)) __PYX_ERR(8, 45, __pyx_L1_error) + __pyx_mstate->__pyx_ptype_7preshed_4maps_PreshMapArray = __Pyx_ImportType_3_2_1(__pyx_t_1, "preshed.maps", "PreshMapArray", + #if defined(PYPY_VERSION_NUM) && PYPY_VERSION_NUM < 0x050B0000 + sizeof(struct __pyx_obj_7preshed_4maps_PreshMapArray), __PYX_GET_STRUCT_ALIGNMENT_3_2_1(struct __pyx_obj_7preshed_4maps_PreshMapArray), + #elif CYTHON_COMPILING_IN_LIMITED_API + sizeof(struct __pyx_obj_7preshed_4maps_PreshMapArray), __PYX_GET_STRUCT_ALIGNMENT_3_2_1(struct __pyx_obj_7preshed_4maps_PreshMapArray), + #else + sizeof(struct __pyx_obj_7preshed_4maps_PreshMapArray), __PYX_GET_STRUCT_ALIGNMENT_3_2_1(struct __pyx_obj_7preshed_4maps_PreshMapArray), + #endif + __Pyx_ImportType_CheckSize_Warn_3_2_1); if (!__pyx_mstate->__pyx_ptype_7preshed_4maps_PreshMapArray) __PYX_ERR(8, 53, __pyx_L1_error) + __pyx_vtabptr_7preshed_4maps_PreshMapArray = (struct __pyx_vtabstruct_7preshed_4maps_PreshMapArray*)__Pyx_GetVtable(__pyx_mstate->__pyx_ptype_7preshed_4maps_PreshMapArray); if (unlikely(!__pyx_vtabptr_7preshed_4maps_PreshMapArray)) __PYX_ERR(8, 53, __pyx_L1_error) + __Pyx_DECREF(__pyx_t_1); __pyx_t_1 = 0; + __pyx_t_1 = PyImport_ImportModule("spacy.strings"); if (unlikely(!__pyx_t_1)) __PYX_ERR(9, 22, __pyx_L1_error) + __Pyx_GOTREF(__pyx_t_1); + __pyx_mstate->__pyx_ptype_5spacy_7strings_StringStore = __Pyx_ImportType_3_2_1(__pyx_t_1, "spacy.strings", "StringStore", + #if defined(PYPY_VERSION_NUM) && PYPY_VERSION_NUM < 0x050B0000 + sizeof(struct __pyx_obj_5spacy_7strings_StringStore), __PYX_GET_STRUCT_ALIGNMENT_3_2_1(struct __pyx_obj_5spacy_7strings_StringStore), + #elif CYTHON_COMPILING_IN_LIMITED_API + sizeof(struct __pyx_obj_5spacy_7strings_StringStore), __PYX_GET_STRUCT_ALIGNMENT_3_2_1(struct __pyx_obj_5spacy_7strings_StringStore), + #else + sizeof(struct __pyx_obj_5spacy_7strings_StringStore), __PYX_GET_STRUCT_ALIGNMENT_3_2_1(struct __pyx_obj_5spacy_7strings_StringStore), + #endif + __Pyx_ImportType_CheckSize_Warn_3_2_1); if (!__pyx_mstate->__pyx_ptype_5spacy_7strings_StringStore) __PYX_ERR(9, 22, __pyx_L1_error) + __pyx_vtabptr_5spacy_7strings_StringStore = (struct __pyx_vtabstruct_5spacy_7strings_StringStore*)__Pyx_GetVtable(__pyx_mstate->__pyx_ptype_5spacy_7strings_StringStore); if (unlikely(!__pyx_vtabptr_5spacy_7strings_StringStore)) __PYX_ERR(9, 22, __pyx_L1_error) + __Pyx_DECREF(__pyx_t_1); __pyx_t_1 = 0; + __pyx_t_1 = PyImport_ImportModule("spacy.morphology"); if (unlikely(!__pyx_t_1)) __PYX_ERR(10, 11, __pyx_L1_error) + __Pyx_GOTREF(__pyx_t_1); + __pyx_mstate->__pyx_ptype_5spacy_10morphology_Morphology = __Pyx_ImportType_3_2_1(__pyx_t_1, "spacy.morphology", "Morphology", + #if defined(PYPY_VERSION_NUM) && PYPY_VERSION_NUM < 0x050B0000 + sizeof(struct __pyx_obj_5spacy_10morphology_Morphology), __PYX_GET_STRUCT_ALIGNMENT_3_2_1(struct __pyx_obj_5spacy_10morphology_Morphology), + #elif CYTHON_COMPILING_IN_LIMITED_API + sizeof(struct __pyx_obj_5spacy_10morphology_Morphology), __PYX_GET_STRUCT_ALIGNMENT_3_2_1(struct __pyx_obj_5spacy_10morphology_Morphology), + #else + sizeof(struct __pyx_obj_5spacy_10morphology_Morphology), __PYX_GET_STRUCT_ALIGNMENT_3_2_1(struct __pyx_obj_5spacy_10morphology_Morphology), + #endif + __Pyx_ImportType_CheckSize_Warn_3_2_1); if (!__pyx_mstate->__pyx_ptype_5spacy_10morphology_Morphology) __PYX_ERR(10, 11, __pyx_L1_error) + __pyx_vtabptr_5spacy_10morphology_Morphology = (struct __pyx_vtabstruct_5spacy_10morphology_Morphology*)__Pyx_GetVtable(__pyx_mstate->__pyx_ptype_5spacy_10morphology_Morphology); if (unlikely(!__pyx_vtabptr_5spacy_10morphology_Morphology)) __PYX_ERR(10, 11, __pyx_L1_error) + __Pyx_DECREF(__pyx_t_1); __pyx_t_1 = 0; + __pyx_t_1 = PyImport_ImportModule("spacy.vocab"); if (unlikely(!__pyx_t_1)) __PYX_ERR(11, 26, __pyx_L1_error) + __Pyx_GOTREF(__pyx_t_1); + __pyx_mstate->__pyx_ptype_5spacy_5vocab_Vocab = __Pyx_ImportType_3_2_1(__pyx_t_1, "spacy.vocab", "Vocab", + #if defined(PYPY_VERSION_NUM) && PYPY_VERSION_NUM < 0x050B0000 + sizeof(struct __pyx_obj_5spacy_5vocab_Vocab), __PYX_GET_STRUCT_ALIGNMENT_3_2_1(struct __pyx_obj_5spacy_5vocab_Vocab), + #elif CYTHON_COMPILING_IN_LIMITED_API + sizeof(struct __pyx_obj_5spacy_5vocab_Vocab), __PYX_GET_STRUCT_ALIGNMENT_3_2_1(struct __pyx_obj_5spacy_5vocab_Vocab), + #else + sizeof(struct __pyx_obj_5spacy_5vocab_Vocab), __PYX_GET_STRUCT_ALIGNMENT_3_2_1(struct __pyx_obj_5spacy_5vocab_Vocab), + #endif + __Pyx_ImportType_CheckSize_Warn_3_2_1); if (!__pyx_mstate->__pyx_ptype_5spacy_5vocab_Vocab) __PYX_ERR(11, 26, __pyx_L1_error) + __pyx_vtabptr_5spacy_5vocab_Vocab = (struct __pyx_vtabstruct_5spacy_5vocab_Vocab*)__Pyx_GetVtable(__pyx_mstate->__pyx_ptype_5spacy_5vocab_Vocab); if (unlikely(!__pyx_vtabptr_5spacy_5vocab_Vocab)) __PYX_ERR(11, 26, __pyx_L1_error) + __Pyx_DECREF(__pyx_t_1); __pyx_t_1 = 0; + __pyx_t_1 = PyImport_ImportModule("spacy.tokens.doc"); if (unlikely(!__pyx_t_1)) __PYX_ERR(12, 37, __pyx_L1_error) + __Pyx_GOTREF(__pyx_t_1); + __pyx_mstate->__pyx_ptype_5spacy_6tokens_3doc_Doc = __Pyx_ImportType_3_2_1(__pyx_t_1, "spacy.tokens.doc", "Doc", + #if defined(PYPY_VERSION_NUM) && PYPY_VERSION_NUM < 0x050B0000 + sizeof(struct __pyx_obj_5spacy_6tokens_3doc_Doc), __PYX_GET_STRUCT_ALIGNMENT_3_2_1(struct __pyx_obj_5spacy_6tokens_3doc_Doc), + #elif CYTHON_COMPILING_IN_LIMITED_API + sizeof(struct __pyx_obj_5spacy_6tokens_3doc_Doc), __PYX_GET_STRUCT_ALIGNMENT_3_2_1(struct __pyx_obj_5spacy_6tokens_3doc_Doc), + #else + sizeof(struct __pyx_obj_5spacy_6tokens_3doc_Doc), __PYX_GET_STRUCT_ALIGNMENT_3_2_1(struct __pyx_obj_5spacy_6tokens_3doc_Doc), + #endif + __Pyx_ImportType_CheckSize_Warn_3_2_1); if (!__pyx_mstate->__pyx_ptype_5spacy_6tokens_3doc_Doc) __PYX_ERR(12, 37, __pyx_L1_error) + __pyx_vtabptr_5spacy_6tokens_3doc_Doc = (struct __pyx_vtabstruct_5spacy_6tokens_3doc_Doc*)__Pyx_GetVtable(__pyx_mstate->__pyx_ptype_5spacy_6tokens_3doc_Doc); if (unlikely(!__pyx_vtabptr_5spacy_6tokens_3doc_Doc)) __PYX_ERR(12, 37, __pyx_L1_error) + __Pyx_DECREF(__pyx_t_1); __pyx_t_1 = 0; + __pyx_t_1 = PyImport_ImportModule("spacy.lexeme"); if (unlikely(!__pyx_t_1)) __PYX_ERR(3, 24, __pyx_L1_error) + __Pyx_GOTREF(__pyx_t_1); + __pyx_mstate->__pyx_ptype_5spacy_6lexeme_Lexeme = __Pyx_ImportType_3_2_1(__pyx_t_1, "spacy.lexeme", "Lexeme", + #if defined(PYPY_VERSION_NUM) && PYPY_VERSION_NUM < 0x050B0000 + sizeof(struct __pyx_obj_5spacy_6lexeme_Lexeme), __PYX_GET_STRUCT_ALIGNMENT_3_2_1(struct __pyx_obj_5spacy_6lexeme_Lexeme), + #elif CYTHON_COMPILING_IN_LIMITED_API + sizeof(struct __pyx_obj_5spacy_6lexeme_Lexeme), __PYX_GET_STRUCT_ALIGNMENT_3_2_1(struct __pyx_obj_5spacy_6lexeme_Lexeme), + #else + sizeof(struct __pyx_obj_5spacy_6lexeme_Lexeme), __PYX_GET_STRUCT_ALIGNMENT_3_2_1(struct __pyx_obj_5spacy_6lexeme_Lexeme), + #endif + __Pyx_ImportType_CheckSize_Warn_3_2_1); if (!__pyx_mstate->__pyx_ptype_5spacy_6lexeme_Lexeme) __PYX_ERR(3, 24, __pyx_L1_error) + __pyx_vtabptr_5spacy_6lexeme_Lexeme = (struct __pyx_vtabstruct_5spacy_6lexeme_Lexeme*)__Pyx_GetVtable(__pyx_mstate->__pyx_ptype_5spacy_6lexeme_Lexeme); if (unlikely(!__pyx_vtabptr_5spacy_6lexeme_Lexeme)) __PYX_ERR(3, 24, __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); + PyObject *__pyx_t_1 = NULL; + int __pyx_lineno = 0; + const char *__pyx_filename = NULL; + int __pyx_clineno = 0; + __Pyx_RefNannySetupContext("__Pyx_modinit_variable_import_code", 0); + /*--- Variable import code ---*/ + { + __pyx_t_1 = PyImport_ImportModule("spacy.vocab"); 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_struct___pyx_t_5spacy_7structs_L); + #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 + 39; + void **const __pyx_import_pointers[] = {(void **)&__pyx_vp_5spacy_5vocab_EMPTY_LEXEME, (void **) NULL}; + void **const *__pyx_import_pointer = __pyx_import_pointers; + const char *__pyx_import_current_signature = __pyx_import_signature; + while (*__pyx_import_pointer) { + if (__Pyx_ImportVoidPtr_3_2_1(__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_t_1 = PyImport_ImportModule("spacy.lexeme"); 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_pyx_t_5spacy_8typedefs_attr_t); + #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 + 71; + void **const __pyx_import_pointers[] = {(void **)&__pyx_vp_5spacy_6lexeme_OOV_RANK, (void **)&__pyx_vp_5spacy_6lexeme_EMPTY_LEXEME, (void **) NULL}; + void **const *__pyx_import_pointer = __pyx_import_pointers; + const char *__pyx_import_current_signature = __pyx_import_signature; + while (*__pyx_import_pointer) { + if (__Pyx_ImportVoidPtr_3_2_1(__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; +} + +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("murmurhash.mrmr"); 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_uint64_t_void_int_uint64_t_hash6); + #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 + 33; + void (**const __pyx_import_pointers[])(void) = {(void (**)(void))&__pyx_f_10murmurhash_4mrmr_hash64, (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_1(__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_stateclass(PyObject* module); /*proto*/ +static PyModuleDef_Slot __pyx_moduledef_slots[] = { + {Py_mod_create, (void*)__pyx_pymod_create}, + {Py_mod_exec, (void*)__pyx_pymod_exec_stateclass}, + #if CYTHON_COMPILING_IN_CPYTHON_FREETHREADING + {Py_mod_gil, Py_MOD_GIL_USED}, + #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, + "stateclass", + 0, /* 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_stateclass(void) CYTHON_SMALL_CODE; /*proto*/ +__Pyx_PyMODINIT_FUNC PyInit_stateclass(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_stateclass(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; + PyObject *__pyx_t_4 = NULL; + PyObject *__pyx_t_5 = NULL; + size_t __pyx_t_6; + static PyThread_type_lock __pyx_t_7[8]; + int __pyx_t_8; + 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 'stateclass' 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 "stateclass" 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_stateclass", 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_spacy__pipeline___parser_internals__stateclass) { + if (PyObject_SetAttr(__pyx_m, __pyx_mstate_global->__pyx_n_u_name_2, __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, "spacy.pipeline._parser_internals.stateclass")) { + if (unlikely((PyDict_SetItemString(modules, "spacy.pipeline._parser_internals.stateclass", __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) + if (unlikely((__Pyx_modinit_variable_import_code(__pyx_mstate) < 0))) __PYX_ERR(0, 1, __pyx_L1_error) + if (unlikely((__Pyx_modinit_function_import_code(__pyx_mstate) < 0))) __PYX_ERR(0, 1, __pyx_L1_error) + /*--- Execution code ---*/ + + /* "View.MemoryView":100 + * + * cdef object __pyx_collections_abc_Sequence "__pyx_collections_abc_Sequence" + * try: # <<<<<<<<<<<<<< + * __pyx_collections_abc_Sequence = __import__("collections.abc").abc.Sequence + * except: +*/ + { + __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:*/ { + + /* "View.MemoryView":101 + * cdef object __pyx_collections_abc_Sequence "__pyx_collections_abc_Sequence" + * try: + * __pyx_collections_abc_Sequence = __import__("collections.abc").abc.Sequence # <<<<<<<<<<<<<< + * except: + * +*/ + __pyx_t_5 = NULL; + __pyx_t_6 = 1; + { + PyObject *__pyx_callargs[2] = {__pyx_t_5, __pyx_mstate_global->__pyx_kp_u_collections_abc}; + __pyx_t_4 = __Pyx_PyObject_FastCall((PyObject*)__pyx_builtin___import__, __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(1, 101, __pyx_L2_error) + __Pyx_GOTREF(__pyx_t_4); + } + __pyx_t_5 = __Pyx_PyObject_GetAttrStr(__pyx_t_4, __pyx_mstate_global->__pyx_n_u_abc); if (unlikely(!__pyx_t_5)) __PYX_ERR(1, 101, __pyx_L2_error) + __Pyx_GOTREF(__pyx_t_5); + __Pyx_DECREF(__pyx_t_4); __pyx_t_4 = 0; + __pyx_t_4 = __Pyx_PyObject_GetAttrStr(__pyx_t_5, __pyx_mstate_global->__pyx_n_u_Sequence); if (unlikely(!__pyx_t_4)) __PYX_ERR(1, 101, __pyx_L2_error) + __Pyx_GOTREF(__pyx_t_4); + __Pyx_DECREF(__pyx_t_5); __pyx_t_5 = 0; + __Pyx_XGOTREF(__pyx_collections_abc_Sequence); + __Pyx_DECREF_SET(__pyx_collections_abc_Sequence, __pyx_t_4); + __Pyx_GIVEREF(__pyx_t_4); + __pyx_t_4 = 0; + + /* "View.MemoryView":100 + * + * cdef object __pyx_collections_abc_Sequence "__pyx_collections_abc_Sequence" + * try: # <<<<<<<<<<<<<< + * __pyx_collections_abc_Sequence = __import__("collections.abc").abc.Sequence + * except: +*/ + } + __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_L7_try_end; + __pyx_L2_error:; + __Pyx_XDECREF(__pyx_t_4); __pyx_t_4 = 0; + __Pyx_XDECREF(__pyx_t_5); __pyx_t_5 = 0; + + /* "View.MemoryView":102 + * try: + * __pyx_collections_abc_Sequence = __import__("collections.abc").abc.Sequence + * except: # <<<<<<<<<<<<<< + * + * __pyx_collections_abc_Sequence = None +*/ + /*except:*/ { + __Pyx_ErrRestore(0,0,0); + + /* "View.MemoryView":104 + * except: + * + * __pyx_collections_abc_Sequence = None # <<<<<<<<<<<<<< + * + * +*/ + __Pyx_INCREF(Py_None); + __Pyx_XGOTREF(__pyx_collections_abc_Sequence); + __Pyx_DECREF_SET(__pyx_collections_abc_Sequence, Py_None); + __Pyx_GIVEREF(Py_None); + goto __pyx_L3_exception_handled; + } + __pyx_L3_exception_handled:; + __Pyx_XGIVEREF(__pyx_t_1); + __Pyx_XGIVEREF(__pyx_t_2); + __Pyx_XGIVEREF(__pyx_t_3); + __Pyx_ExceptionReset(__pyx_t_1, __pyx_t_2, __pyx_t_3); + __pyx_L7_try_end:; + } + + /* "View.MemoryView":239 + * + * + * try: # <<<<<<<<<<<<<< + * count = __pyx_collections_abc_Sequence.count + * index = __pyx_collections_abc_Sequence.index +*/ + { + __Pyx_PyThreadState_declare + __Pyx_PyThreadState_assign + __Pyx_ExceptionSave(&__pyx_t_3, &__pyx_t_2, &__pyx_t_1); + __Pyx_XGOTREF(__pyx_t_3); + __Pyx_XGOTREF(__pyx_t_2); + __Pyx_XGOTREF(__pyx_t_1); + /*try:*/ { + + /* "View.MemoryView":240 + * + * try: + * count = __pyx_collections_abc_Sequence.count # <<<<<<<<<<<<<< + * index = __pyx_collections_abc_Sequence.index + * except: +*/ + __pyx_t_4 = __Pyx_PyObject_GetAttrStr(__pyx_collections_abc_Sequence, __pyx_mstate_global->__pyx_n_u_count); if (unlikely(!__pyx_t_4)) __PYX_ERR(1, 240, __pyx_L10_error) + __Pyx_GOTREF(__pyx_t_4); + if (__Pyx_SetItemOnTypeDict(__pyx_mstate_global->__pyx_array_type, __pyx_mstate_global->__pyx_n_u_count, __pyx_t_4) < (0)) __PYX_ERR(1, 240, __pyx_L10_error) + __Pyx_DECREF(__pyx_t_4); __pyx_t_4 = 0; + + /* "View.MemoryView":241 + * try: + * count = __pyx_collections_abc_Sequence.count + * index = __pyx_collections_abc_Sequence.index # <<<<<<<<<<<<<< + * except: + * pass +*/ + __pyx_t_4 = __Pyx_PyObject_GetAttrStr(__pyx_collections_abc_Sequence, __pyx_mstate_global->__pyx_n_u_index); if (unlikely(!__pyx_t_4)) __PYX_ERR(1, 241, __pyx_L10_error) + __Pyx_GOTREF(__pyx_t_4); + if (__Pyx_SetItemOnTypeDict(__pyx_mstate_global->__pyx_array_type, __pyx_mstate_global->__pyx_n_u_index, __pyx_t_4) < (0)) __PYX_ERR(1, 241, __pyx_L10_error) + __Pyx_DECREF(__pyx_t_4); __pyx_t_4 = 0; + + /* "View.MemoryView":239 + * + * + * try: # <<<<<<<<<<<<<< + * count = __pyx_collections_abc_Sequence.count + * index = __pyx_collections_abc_Sequence.index +*/ + } + __Pyx_XDECREF(__pyx_t_3); __pyx_t_3 = 0; + __Pyx_XDECREF(__pyx_t_2); __pyx_t_2 = 0; + __Pyx_XDECREF(__pyx_t_1); __pyx_t_1 = 0; + goto __pyx_L15_try_end; + __pyx_L10_error:; + __Pyx_XDECREF(__pyx_t_4); __pyx_t_4 = 0; + __Pyx_XDECREF(__pyx_t_5); __pyx_t_5 = 0; + + /* "View.MemoryView":242 + * count = __pyx_collections_abc_Sequence.count + * index = __pyx_collections_abc_Sequence.index + * except: # <<<<<<<<<<<<<< + * pass + * +*/ + /*except:*/ { + __Pyx_ErrRestore(0,0,0); + goto __pyx_L11_exception_handled; + } + __pyx_L11_exception_handled:; + __Pyx_XGIVEREF(__pyx_t_3); + __Pyx_XGIVEREF(__pyx_t_2); + __Pyx_XGIVEREF(__pyx_t_1); + __Pyx_ExceptionReset(__pyx_t_3, __pyx_t_2, __pyx_t_1); + __pyx_L15_try_end:; + } + + /* "View.MemoryView":307 + * return self.name + * + * cdef generic = Enum("") # <<<<<<<<<<<<<< + * cdef strided = Enum("") # default + * cdef indirect = Enum("") +*/ + __pyx_t_5 = NULL; + __pyx_t_6 = 1; + { + PyObject *__pyx_callargs[2] = {__pyx_t_5, __pyx_mstate_global->__pyx_kp_u_strided_and_direct_or_indirect}; + __pyx_t_4 = __Pyx_PyObject_FastCall((PyObject*)__pyx_mstate_global->__pyx_MemviewEnum_type, __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(1, 307, __pyx_L1_error) + __Pyx_GOTREF((PyObject *)__pyx_t_4); + } + __Pyx_XGOTREF(generic); + __Pyx_DECREF_SET(generic, ((PyObject *)__pyx_t_4)); + __Pyx_GIVEREF((PyObject *)__pyx_t_4); + __pyx_t_4 = 0; + + /* "View.MemoryView":308 + * + * cdef generic = Enum("") + * cdef strided = Enum("") # default # <<<<<<<<<<<<<< + * cdef indirect = Enum("") + * +*/ + __pyx_t_5 = NULL; + __pyx_t_6 = 1; + { + PyObject *__pyx_callargs[2] = {__pyx_t_5, __pyx_mstate_global->__pyx_kp_u_strided_and_direct}; + __pyx_t_4 = __Pyx_PyObject_FastCall((PyObject*)__pyx_mstate_global->__pyx_MemviewEnum_type, __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(1, 308, __pyx_L1_error) + __Pyx_GOTREF((PyObject *)__pyx_t_4); + } + __Pyx_XGOTREF(strided); + __Pyx_DECREF_SET(strided, ((PyObject *)__pyx_t_4)); + __Pyx_GIVEREF((PyObject *)__pyx_t_4); + __pyx_t_4 = 0; + + /* "View.MemoryView":309 + * cdef generic = Enum("") + * cdef strided = Enum("") # default + * cdef indirect = Enum("") # <<<<<<<<<<<<<< + * + * +*/ + __pyx_t_5 = NULL; + __pyx_t_6 = 1; + { + PyObject *__pyx_callargs[2] = {__pyx_t_5, __pyx_mstate_global->__pyx_kp_u_strided_and_indirect}; + __pyx_t_4 = __Pyx_PyObject_FastCall((PyObject*)__pyx_mstate_global->__pyx_MemviewEnum_type, __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(1, 309, __pyx_L1_error) + __Pyx_GOTREF((PyObject *)__pyx_t_4); + } + __Pyx_XGOTREF(indirect); + __Pyx_DECREF_SET(indirect, ((PyObject *)__pyx_t_4)); + __Pyx_GIVEREF((PyObject *)__pyx_t_4); + __pyx_t_4 = 0; + + /* "View.MemoryView":312 + * + * + * cdef contiguous = Enum("") # <<<<<<<<<<<<<< + * cdef indirect_contiguous = Enum("") + * +*/ + __pyx_t_5 = NULL; + __pyx_t_6 = 1; + { + PyObject *__pyx_callargs[2] = {__pyx_t_5, __pyx_mstate_global->__pyx_kp_u_contiguous_and_direct}; + __pyx_t_4 = __Pyx_PyObject_FastCall((PyObject*)__pyx_mstate_global->__pyx_MemviewEnum_type, __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(1, 312, __pyx_L1_error) + __Pyx_GOTREF((PyObject *)__pyx_t_4); + } + __Pyx_XGOTREF(contiguous); + __Pyx_DECREF_SET(contiguous, ((PyObject *)__pyx_t_4)); + __Pyx_GIVEREF((PyObject *)__pyx_t_4); + __pyx_t_4 = 0; + + /* "View.MemoryView":313 + * + * cdef contiguous = Enum("") + * cdef indirect_contiguous = Enum("") # <<<<<<<<<<<<<< + * + * +*/ + __pyx_t_5 = NULL; + __pyx_t_6 = 1; + { + PyObject *__pyx_callargs[2] = {__pyx_t_5, __pyx_mstate_global->__pyx_kp_u_contiguous_and_indirect}; + __pyx_t_4 = __Pyx_PyObject_FastCall((PyObject*)__pyx_mstate_global->__pyx_MemviewEnum_type, __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(1, 313, __pyx_L1_error) + __Pyx_GOTREF((PyObject *)__pyx_t_4); + } + __Pyx_XGOTREF(indirect_contiguous); + __Pyx_DECREF_SET(indirect_contiguous, ((PyObject *)__pyx_t_4)); + __Pyx_GIVEREF((PyObject *)__pyx_t_4); + __pyx_t_4 = 0; + + /* "View.MemoryView":321 + * + * + * cdef int __pyx_memoryview_thread_locks_used = 0 # <<<<<<<<<<<<<< + * cdef PyThread_type_lock[8] __pyx_memoryview_thread_locks = [ + * PyThread_allocate_lock(), +*/ + __pyx_memoryview_thread_locks_used = 0; + + /* "View.MemoryView":322 + * + * cdef int __pyx_memoryview_thread_locks_used = 0 + * cdef PyThread_type_lock[8] __pyx_memoryview_thread_locks = [ # <<<<<<<<<<<<<< + * PyThread_allocate_lock(), + * PyThread_allocate_lock(), +*/ + __pyx_t_7[0] = PyThread_allocate_lock(); + __pyx_t_7[1] = PyThread_allocate_lock(); + __pyx_t_7[2] = PyThread_allocate_lock(); + __pyx_t_7[3] = PyThread_allocate_lock(); + __pyx_t_7[4] = PyThread_allocate_lock(); + __pyx_t_7[5] = PyThread_allocate_lock(); + __pyx_t_7[6] = PyThread_allocate_lock(); + __pyx_t_7[7] = PyThread_allocate_lock(); + memcpy(&(__pyx_memoryview_thread_locks[0]), __pyx_t_7, sizeof(__pyx_memoryview_thread_locks[0]) * (8)); + + /* "View.MemoryView":983 + * + * + * try: # <<<<<<<<<<<<<< + * count = __pyx_collections_abc_Sequence.count + * index = __pyx_collections_abc_Sequence.index +*/ + { + __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:*/ { + + /* "View.MemoryView":984 + * + * try: + * count = __pyx_collections_abc_Sequence.count # <<<<<<<<<<<<<< + * index = __pyx_collections_abc_Sequence.index + * except: +*/ + __pyx_t_4 = __Pyx_PyObject_GetAttrStr(__pyx_collections_abc_Sequence, __pyx_mstate_global->__pyx_n_u_count); if (unlikely(!__pyx_t_4)) __PYX_ERR(1, 984, __pyx_L18_error) + __Pyx_GOTREF(__pyx_t_4); + if (__Pyx_SetItemOnTypeDict(__pyx_mstate_global->__pyx_memoryviewslice_type, __pyx_mstate_global->__pyx_n_u_count, __pyx_t_4) < (0)) __PYX_ERR(1, 984, __pyx_L18_error) + __Pyx_DECREF(__pyx_t_4); __pyx_t_4 = 0; + + /* "View.MemoryView":985 + * try: + * count = __pyx_collections_abc_Sequence.count + * index = __pyx_collections_abc_Sequence.index # <<<<<<<<<<<<<< + * except: + * pass +*/ + __pyx_t_4 = __Pyx_PyObject_GetAttrStr(__pyx_collections_abc_Sequence, __pyx_mstate_global->__pyx_n_u_index); if (unlikely(!__pyx_t_4)) __PYX_ERR(1, 985, __pyx_L18_error) + __Pyx_GOTREF(__pyx_t_4); + if (__Pyx_SetItemOnTypeDict(__pyx_mstate_global->__pyx_memoryviewslice_type, __pyx_mstate_global->__pyx_n_u_index, __pyx_t_4) < (0)) __PYX_ERR(1, 985, __pyx_L18_error) + __Pyx_DECREF(__pyx_t_4); __pyx_t_4 = 0; + + /* "View.MemoryView":983 + * + * + * try: # <<<<<<<<<<<<<< + * count = __pyx_collections_abc_Sequence.count + * index = __pyx_collections_abc_Sequence.index +*/ + } + __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_L23_try_end; + __pyx_L18_error:; + __Pyx_XDECREF(__pyx_t_4); __pyx_t_4 = 0; + __Pyx_XDECREF(__pyx_t_5); __pyx_t_5 = 0; + + /* "View.MemoryView":986 + * count = __pyx_collections_abc_Sequence.count + * index = __pyx_collections_abc_Sequence.index + * except: # <<<<<<<<<<<<<< + * pass + * +*/ + /*except:*/ { + __Pyx_ErrRestore(0,0,0); + goto __pyx_L19_exception_handled; + } + __pyx_L19_exception_handled:; + __Pyx_XGIVEREF(__pyx_t_1); + __Pyx_XGIVEREF(__pyx_t_2); + __Pyx_XGIVEREF(__pyx_t_3); + __Pyx_ExceptionReset(__pyx_t_1, __pyx_t_2, __pyx_t_3); + __pyx_L23_try_end:; + } + + /* "View.MemoryView":989 + * pass + * + * try: # <<<<<<<<<<<<<< + * if __pyx_collections_abc_Sequence: + * +*/ + { + __Pyx_PyThreadState_declare + __Pyx_PyThreadState_assign + __Pyx_ExceptionSave(&__pyx_t_3, &__pyx_t_2, &__pyx_t_1); + __Pyx_XGOTREF(__pyx_t_3); + __Pyx_XGOTREF(__pyx_t_2); + __Pyx_XGOTREF(__pyx_t_1); + /*try:*/ { + + /* "View.MemoryView":990 + * + * try: + * if __pyx_collections_abc_Sequence: # <<<<<<<<<<<<<< + * + * +*/ + __pyx_t_8 = __Pyx_PyObject_IsTrue(__pyx_collections_abc_Sequence); if (unlikely((__pyx_t_8 < 0))) __PYX_ERR(1, 990, __pyx_L26_error) + if (__pyx_t_8) { + + /* "View.MemoryView":994 + * + * + * __pyx_collections_abc_Sequence.register(_memoryviewslice) # <<<<<<<<<<<<<< + * __pyx_collections_abc_Sequence.register(array) + * except: +*/ + __pyx_t_5 = __pyx_collections_abc_Sequence; + __Pyx_INCREF(__pyx_t_5); + __pyx_t_6 = 0; + { + PyObject *__pyx_callargs[2] = {__pyx_t_5, ((PyObject *)__pyx_mstate_global->__pyx_memoryviewslice_type)}; + __pyx_t_4 = __Pyx_PyObject_FastCallMethod((PyObject*)__pyx_mstate_global->__pyx_n_u_register, __pyx_callargs+__pyx_t_6, (2-__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(1, 994, __pyx_L26_error) + __Pyx_GOTREF(__pyx_t_4); + } + __Pyx_DECREF(__pyx_t_4); __pyx_t_4 = 0; + + /* "View.MemoryView":995 + * + * __pyx_collections_abc_Sequence.register(_memoryviewslice) + * __pyx_collections_abc_Sequence.register(array) # <<<<<<<<<<<<<< + * except: + * pass # ignore failure, it's a minor issue +*/ + __pyx_t_5 = __pyx_collections_abc_Sequence; + __Pyx_INCREF(__pyx_t_5); + __pyx_t_6 = 0; + { + PyObject *__pyx_callargs[2] = {__pyx_t_5, ((PyObject *)__pyx_mstate_global->__pyx_array_type)}; + __pyx_t_4 = __Pyx_PyObject_FastCallMethod((PyObject*)__pyx_mstate_global->__pyx_n_u_register, __pyx_callargs+__pyx_t_6, (2-__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(1, 995, __pyx_L26_error) + __Pyx_GOTREF(__pyx_t_4); + } + __Pyx_DECREF(__pyx_t_4); __pyx_t_4 = 0; + + /* "View.MemoryView":990 + * + * try: + * if __pyx_collections_abc_Sequence: # <<<<<<<<<<<<<< + * + * +*/ + } + + /* "View.MemoryView":989 + * pass + * + * try: # <<<<<<<<<<<<<< + * if __pyx_collections_abc_Sequence: + * +*/ + } + __Pyx_XDECREF(__pyx_t_3); __pyx_t_3 = 0; + __Pyx_XDECREF(__pyx_t_2); __pyx_t_2 = 0; + __Pyx_XDECREF(__pyx_t_1); __pyx_t_1 = 0; + goto __pyx_L31_try_end; + __pyx_L26_error:; + __Pyx_XDECREF(__pyx_t_4); __pyx_t_4 = 0; + __Pyx_XDECREF(__pyx_t_5); __pyx_t_5 = 0; + + /* "View.MemoryView":996 + * __pyx_collections_abc_Sequence.register(_memoryviewslice) + * __pyx_collections_abc_Sequence.register(array) + * except: # <<<<<<<<<<<<<< + * pass # ignore failure, it's a minor issue + * +*/ + /*except:*/ { + __Pyx_ErrRestore(0,0,0); + goto __pyx_L27_exception_handled; + } + __pyx_L27_exception_handled:; + __Pyx_XGIVEREF(__pyx_t_3); + __Pyx_XGIVEREF(__pyx_t_2); + __Pyx_XGIVEREF(__pyx_t_1); + __Pyx_ExceptionReset(__pyx_t_3, __pyx_t_2, __pyx_t_1); + __pyx_L31_try_end:; + } + + /* "(tree fragment)":4 + * int __Pyx_CheckUnpickleChecksum(long, long, long, long, const char*) except -1 + * int __Pyx_UpdateUnpickledDict(object, object, Py_ssize_t) except -1 + * def __pyx_unpickle_Enum(__pyx_type, long __pyx_checksum, tuple __pyx_state): # <<<<<<<<<<<<<< + * cdef object __pyx_result + * __Pyx_CheckUnpickleChecksum(__pyx_checksum, 0x82a3537, 0x6ae9995, 0xb068931, b'name') +*/ + __pyx_t_4 = PyCFunction_NewEx(&__pyx_mdef_15View_dot_MemoryView_1__pyx_unpickle_Enum, NULL, __pyx_mstate_global->__pyx_n_u_View_MemoryView); if (unlikely(!__pyx_t_4)) __PYX_ERR(1, 4, __pyx_L1_error) + __Pyx_GOTREF(__pyx_t_4); + if (PyDict_SetItem(__pyx_mstate_global->__pyx_d, __pyx_mstate_global->__pyx_n_u_pyx_unpickle_Enum, __pyx_t_4) < (0)) __PYX_ERR(1, 4, __pyx_L1_error) + __Pyx_DECREF(__pyx_t_4); __pyx_t_4 = 0; + + /* "spacy/pipeline/_parser_internals/stateclass.pyx":46 + * # return arcs + * + * def add_arc(self, int head, int child, int label): # <<<<<<<<<<<<<< + * self.c.add_arc(head, child, label) + * +*/ + __pyx_t_4 = __Pyx_CyFunction_New(&__pyx_mdef_5spacy_8pipeline_17_parser_internals_10stateclass_10StateClass_5add_arc, __Pyx_CYFUNCTION_CCLASS, __pyx_mstate_global->__pyx_n_u_StateClass_add_arc, NULL, __pyx_mstate_global->__pyx_n_u_spacy_pipeline__parser_internals, __pyx_mstate_global->__pyx_d, ((PyObject *)__pyx_mstate_global->__pyx_codeobj_tab[0])); if (unlikely(!__pyx_t_4)) __PYX_ERR(0, 46, __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 (__Pyx_SetItemOnTypeDict(__pyx_mstate_global->__pyx_ptype_5spacy_8pipeline_17_parser_internals_10stateclass_StateClass, __pyx_mstate_global->__pyx_n_u_add_arc, __pyx_t_4) < (0)) __PYX_ERR(0, 46, __pyx_L1_error) + __Pyx_DECREF(__pyx_t_4); __pyx_t_4 = 0; + + /* "spacy/pipeline/_parser_internals/stateclass.pyx":49 + * self.c.add_arc(head, child, label) + * + * def del_arc(self, int head, int child): # <<<<<<<<<<<<<< + * self.c.del_arc(head, child) + * +*/ + __pyx_t_4 = __Pyx_CyFunction_New(&__pyx_mdef_5spacy_8pipeline_17_parser_internals_10stateclass_10StateClass_7del_arc, __Pyx_CYFUNCTION_CCLASS, __pyx_mstate_global->__pyx_n_u_StateClass_del_arc, NULL, __pyx_mstate_global->__pyx_n_u_spacy_pipeline__parser_internals, __pyx_mstate_global->__pyx_d, ((PyObject *)__pyx_mstate_global->__pyx_codeobj_tab[1])); if (unlikely(!__pyx_t_4)) __PYX_ERR(0, 49, __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 (__Pyx_SetItemOnTypeDict(__pyx_mstate_global->__pyx_ptype_5spacy_8pipeline_17_parser_internals_10stateclass_StateClass, __pyx_mstate_global->__pyx_n_u_del_arc, __pyx_t_4) < (0)) __PYX_ERR(0, 49, __pyx_L1_error) + __Pyx_DECREF(__pyx_t_4); __pyx_t_4 = 0; + + /* "spacy/pipeline/_parser_internals/stateclass.pyx":52 + * self.c.del_arc(head, child) + * + * def H(self, int child): # <<<<<<<<<<<<<< + * return self.c.H(child) + * +*/ + __pyx_t_4 = __Pyx_CyFunction_New(&__pyx_mdef_5spacy_8pipeline_17_parser_internals_10stateclass_10StateClass_9H, __Pyx_CYFUNCTION_CCLASS, __pyx_mstate_global->__pyx_n_u_StateClass_H, NULL, __pyx_mstate_global->__pyx_n_u_spacy_pipeline__parser_internals, __pyx_mstate_global->__pyx_d, ((PyObject *)__pyx_mstate_global->__pyx_codeobj_tab[2])); if (unlikely(!__pyx_t_4)) __PYX_ERR(0, 52, __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 (__Pyx_SetItemOnTypeDict(__pyx_mstate_global->__pyx_ptype_5spacy_8pipeline_17_parser_internals_10stateclass_StateClass, __pyx_mstate_global->__pyx_n_u_H, __pyx_t_4) < (0)) __PYX_ERR(0, 52, __pyx_L1_error) + __Pyx_DECREF(__pyx_t_4); __pyx_t_4 = 0; + + /* "spacy/pipeline/_parser_internals/stateclass.pyx":55 + * return self.c.H(child) + * + * def L(self, int head, int idx): # <<<<<<<<<<<<<< + * return self.c.L(head, idx) + * +*/ + __pyx_t_4 = __Pyx_CyFunction_New(&__pyx_mdef_5spacy_8pipeline_17_parser_internals_10stateclass_10StateClass_11L, __Pyx_CYFUNCTION_CCLASS, __pyx_mstate_global->__pyx_n_u_StateClass_L, NULL, __pyx_mstate_global->__pyx_n_u_spacy_pipeline__parser_internals, __pyx_mstate_global->__pyx_d, ((PyObject *)__pyx_mstate_global->__pyx_codeobj_tab[3])); if (unlikely(!__pyx_t_4)) __PYX_ERR(0, 55, __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 (__Pyx_SetItemOnTypeDict(__pyx_mstate_global->__pyx_ptype_5spacy_8pipeline_17_parser_internals_10stateclass_StateClass, __pyx_mstate_global->__pyx_n_u_L, __pyx_t_4) < (0)) __PYX_ERR(0, 55, __pyx_L1_error) + __Pyx_DECREF(__pyx_t_4); __pyx_t_4 = 0; + + /* "spacy/pipeline/_parser_internals/stateclass.pyx":58 + * return self.c.L(head, idx) + * + * def R(self, int head, int idx): # <<<<<<<<<<<<<< + * return self.c.R(head, idx) + * +*/ + __pyx_t_4 = __Pyx_CyFunction_New(&__pyx_mdef_5spacy_8pipeline_17_parser_internals_10stateclass_10StateClass_13R, __Pyx_CYFUNCTION_CCLASS, __pyx_mstate_global->__pyx_n_u_StateClass_R, NULL, __pyx_mstate_global->__pyx_n_u_spacy_pipeline__parser_internals, __pyx_mstate_global->__pyx_d, ((PyObject *)__pyx_mstate_global->__pyx_codeobj_tab[4])); if (unlikely(!__pyx_t_4)) __PYX_ERR(0, 58, __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 (__Pyx_SetItemOnTypeDict(__pyx_mstate_global->__pyx_ptype_5spacy_8pipeline_17_parser_internals_10stateclass_StateClass, __pyx_mstate_global->__pyx_n_u_R, __pyx_t_4) < (0)) __PYX_ERR(0, 58, __pyx_L1_error) + __Pyx_DECREF(__pyx_t_4); __pyx_t_4 = 0; + + /* "spacy/pipeline/_parser_internals/stateclass.pyx":69 + * return self.c.length + * + * def is_final(self): # <<<<<<<<<<<<<< + * return self.c.is_final() + * +*/ + __pyx_t_4 = __Pyx_CyFunction_New(&__pyx_mdef_5spacy_8pipeline_17_parser_internals_10stateclass_10StateClass_15is_final, __Pyx_CYFUNCTION_CCLASS, __pyx_mstate_global->__pyx_n_u_StateClass_is_final, NULL, __pyx_mstate_global->__pyx_n_u_spacy_pipeline__parser_internals, __pyx_mstate_global->__pyx_d, ((PyObject *)__pyx_mstate_global->__pyx_codeobj_tab[5])); if (unlikely(!__pyx_t_4)) __PYX_ERR(0, 69, __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 (__Pyx_SetItemOnTypeDict(__pyx_mstate_global->__pyx_ptype_5spacy_8pipeline_17_parser_internals_10stateclass_StateClass, __pyx_mstate_global->__pyx_n_u_is_final, __pyx_t_4) < (0)) __PYX_ERR(0, 69, __pyx_L1_error) + __Pyx_DECREF(__pyx_t_4); __pyx_t_4 = 0; + + /* "spacy/pipeline/_parser_internals/stateclass.pyx":72 + * return self.c.is_final() + * + * def copy(self): # <<<<<<<<<<<<<< + * cdef StateClass new_state = StateClass(doc=self.doc, offset=self.c.offset) + * new_state.c.clone(self.c) +*/ + __pyx_t_4 = __Pyx_CyFunction_New(&__pyx_mdef_5spacy_8pipeline_17_parser_internals_10stateclass_10StateClass_17copy, __Pyx_CYFUNCTION_CCLASS, __pyx_mstate_global->__pyx_n_u_StateClass_copy, NULL, __pyx_mstate_global->__pyx_n_u_spacy_pipeline__parser_internals, __pyx_mstate_global->__pyx_d, ((PyObject *)__pyx_mstate_global->__pyx_codeobj_tab[6])); if (unlikely(!__pyx_t_4)) __PYX_ERR(0, 72, __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 (__Pyx_SetItemOnTypeDict(__pyx_mstate_global->__pyx_ptype_5spacy_8pipeline_17_parser_internals_10stateclass_StateClass, __pyx_mstate_global->__pyx_n_u_copy, __pyx_t_4) < (0)) __PYX_ERR(0, 72, __pyx_L1_error) + __Pyx_DECREF(__pyx_t_4); __pyx_t_4 = 0; + + /* "spacy/pipeline/_parser_internals/stateclass.pyx":77 + * return new_state + * + * def print_state(self): # <<<<<<<<<<<<<< + * words = [token.text for token in self.doc] + * words = list(words) + ['_'] +*/ + __pyx_t_4 = __Pyx_CyFunction_New(&__pyx_mdef_5spacy_8pipeline_17_parser_internals_10stateclass_10StateClass_19print_state, __Pyx_CYFUNCTION_CCLASS, __pyx_mstate_global->__pyx_n_u_StateClass_print_state, NULL, __pyx_mstate_global->__pyx_n_u_spacy_pipeline__parser_internals, __pyx_mstate_global->__pyx_d, ((PyObject *)__pyx_mstate_global->__pyx_codeobj_tab[7])); if (unlikely(!__pyx_t_4)) __PYX_ERR(0, 77, __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 (__Pyx_SetItemOnTypeDict(__pyx_mstate_global->__pyx_ptype_5spacy_8pipeline_17_parser_internals_10stateclass_StateClass, __pyx_mstate_global->__pyx_n_u_print_state, __pyx_t_4) < (0)) __PYX_ERR(0, 77, __pyx_L1_error) + __Pyx_DECREF(__pyx_t_4); __pyx_t_4 = 0; + + /* "spacy/pipeline/_parser_internals/stateclass.pyx":92 + * return ' '.join((str(self.stack_depth()), str(self.buffer_length()), third, second, top, '|', n0, n1)) + * + * def S(self, int i): # <<<<<<<<<<<<<< + * return self.c.S(i) + * +*/ + __pyx_t_4 = __Pyx_CyFunction_New(&__pyx_mdef_5spacy_8pipeline_17_parser_internals_10stateclass_10StateClass_21S, __Pyx_CYFUNCTION_CCLASS, __pyx_mstate_global->__pyx_n_u_StateClass_S, NULL, __pyx_mstate_global->__pyx_n_u_spacy_pipeline__parser_internals, __pyx_mstate_global->__pyx_d, ((PyObject *)__pyx_mstate_global->__pyx_codeobj_tab[8])); if (unlikely(!__pyx_t_4)) __PYX_ERR(0, 92, __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 (__Pyx_SetItemOnTypeDict(__pyx_mstate_global->__pyx_ptype_5spacy_8pipeline_17_parser_internals_10stateclass_StateClass, __pyx_mstate_global->__pyx_n_u_S, __pyx_t_4) < (0)) __PYX_ERR(0, 92, __pyx_L1_error) + __Pyx_DECREF(__pyx_t_4); __pyx_t_4 = 0; + + /* "spacy/pipeline/_parser_internals/stateclass.pyx":95 + * return self.c.S(i) + * + * def B(self, int i): # <<<<<<<<<<<<<< + * return self.c.B(i) + * +*/ + __pyx_t_4 = __Pyx_CyFunction_New(&__pyx_mdef_5spacy_8pipeline_17_parser_internals_10stateclass_10StateClass_23B, __Pyx_CYFUNCTION_CCLASS, __pyx_mstate_global->__pyx_n_u_StateClass_B, NULL, __pyx_mstate_global->__pyx_n_u_spacy_pipeline__parser_internals, __pyx_mstate_global->__pyx_d, ((PyObject *)__pyx_mstate_global->__pyx_codeobj_tab[9])); if (unlikely(!__pyx_t_4)) __PYX_ERR(0, 95, __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 (__Pyx_SetItemOnTypeDict(__pyx_mstate_global->__pyx_ptype_5spacy_8pipeline_17_parser_internals_10stateclass_StateClass, __pyx_mstate_global->__pyx_n_u_B, __pyx_t_4) < (0)) __PYX_ERR(0, 95, __pyx_L1_error) + __Pyx_DECREF(__pyx_t_4); __pyx_t_4 = 0; + + /* "spacy/pipeline/_parser_internals/stateclass.pyx":98 + * return self.c.B(i) + * + * def H(self, int i): # <<<<<<<<<<<<<< + * return self.c.H(i) + * +*/ + __pyx_t_4 = __Pyx_CyFunction_New(&__pyx_mdef_5spacy_8pipeline_17_parser_internals_10stateclass_10StateClass_25H, __Pyx_CYFUNCTION_CCLASS, __pyx_mstate_global->__pyx_n_u_StateClass_H, NULL, __pyx_mstate_global->__pyx_n_u_spacy_pipeline__parser_internals, __pyx_mstate_global->__pyx_d, ((PyObject *)__pyx_mstate_global->__pyx_codeobj_tab[10])); if (unlikely(!__pyx_t_4)) __PYX_ERR(0, 98, __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 (__Pyx_SetItemOnTypeDict(__pyx_mstate_global->__pyx_ptype_5spacy_8pipeline_17_parser_internals_10stateclass_StateClass, __pyx_mstate_global->__pyx_n_u_H, __pyx_t_4) < (0)) __PYX_ERR(0, 98, __pyx_L1_error) + __Pyx_DECREF(__pyx_t_4); __pyx_t_4 = 0; + + /* "spacy/pipeline/_parser_internals/stateclass.pyx":101 + * return self.c.H(i) + * + * def E(self, int i): # <<<<<<<<<<<<<< + * return self.c.E(i) + * +*/ + __pyx_t_4 = __Pyx_CyFunction_New(&__pyx_mdef_5spacy_8pipeline_17_parser_internals_10stateclass_10StateClass_27E, __Pyx_CYFUNCTION_CCLASS, __pyx_mstate_global->__pyx_n_u_StateClass_E, NULL, __pyx_mstate_global->__pyx_n_u_spacy_pipeline__parser_internals, __pyx_mstate_global->__pyx_d, ((PyObject *)__pyx_mstate_global->__pyx_codeobj_tab[11])); if (unlikely(!__pyx_t_4)) __PYX_ERR(0, 101, __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 (__Pyx_SetItemOnTypeDict(__pyx_mstate_global->__pyx_ptype_5spacy_8pipeline_17_parser_internals_10stateclass_StateClass, __pyx_mstate_global->__pyx_n_u_E, __pyx_t_4) < (0)) __PYX_ERR(0, 101, __pyx_L1_error) + __Pyx_DECREF(__pyx_t_4); __pyx_t_4 = 0; + + /* "spacy/pipeline/_parser_internals/stateclass.pyx":104 + * return self.c.E(i) + * + * def L(self, int i, int idx): # <<<<<<<<<<<<<< + * return self.c.L(i, idx) + * +*/ + __pyx_t_4 = __Pyx_CyFunction_New(&__pyx_mdef_5spacy_8pipeline_17_parser_internals_10stateclass_10StateClass_29L, __Pyx_CYFUNCTION_CCLASS, __pyx_mstate_global->__pyx_n_u_StateClass_L, NULL, __pyx_mstate_global->__pyx_n_u_spacy_pipeline__parser_internals, __pyx_mstate_global->__pyx_d, ((PyObject *)__pyx_mstate_global->__pyx_codeobj_tab[12])); if (unlikely(!__pyx_t_4)) __PYX_ERR(0, 104, __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 (__Pyx_SetItemOnTypeDict(__pyx_mstate_global->__pyx_ptype_5spacy_8pipeline_17_parser_internals_10stateclass_StateClass, __pyx_mstate_global->__pyx_n_u_L, __pyx_t_4) < (0)) __PYX_ERR(0, 104, __pyx_L1_error) + __Pyx_DECREF(__pyx_t_4); __pyx_t_4 = 0; + + /* "spacy/pipeline/_parser_internals/stateclass.pyx":107 + * return self.c.L(i, idx) + * + * def R(self, int i, int idx): # <<<<<<<<<<<<<< + * return self.c.R(i, idx) + * +*/ + __pyx_t_4 = __Pyx_CyFunction_New(&__pyx_mdef_5spacy_8pipeline_17_parser_internals_10stateclass_10StateClass_31R, __Pyx_CYFUNCTION_CCLASS, __pyx_mstate_global->__pyx_n_u_StateClass_R, NULL, __pyx_mstate_global->__pyx_n_u_spacy_pipeline__parser_internals, __pyx_mstate_global->__pyx_d, ((PyObject *)__pyx_mstate_global->__pyx_codeobj_tab[13])); if (unlikely(!__pyx_t_4)) __PYX_ERR(0, 107, __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 (__Pyx_SetItemOnTypeDict(__pyx_mstate_global->__pyx_ptype_5spacy_8pipeline_17_parser_internals_10stateclass_StateClass, __pyx_mstate_global->__pyx_n_u_R, __pyx_t_4) < (0)) __PYX_ERR(0, 107, __pyx_L1_error) + __Pyx_DECREF(__pyx_t_4); __pyx_t_4 = 0; + + /* "spacy/pipeline/_parser_internals/stateclass.pyx":110 + * return self.c.R(i, idx) + * + * def S_(self, int i): # <<<<<<<<<<<<<< + * return self.doc[self.c.S(i)] + * +*/ + __pyx_t_4 = __Pyx_CyFunction_New(&__pyx_mdef_5spacy_8pipeline_17_parser_internals_10stateclass_10StateClass_33S_, __Pyx_CYFUNCTION_CCLASS, __pyx_mstate_global->__pyx_n_u_StateClass_S_2, NULL, __pyx_mstate_global->__pyx_n_u_spacy_pipeline__parser_internals, __pyx_mstate_global->__pyx_d, ((PyObject *)__pyx_mstate_global->__pyx_codeobj_tab[14])); if (unlikely(!__pyx_t_4)) __PYX_ERR(0, 110, __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 (__Pyx_SetItemOnTypeDict(__pyx_mstate_global->__pyx_ptype_5spacy_8pipeline_17_parser_internals_10stateclass_StateClass, __pyx_mstate_global->__pyx_n_u_S_2, __pyx_t_4) < (0)) __PYX_ERR(0, 110, __pyx_L1_error) + __Pyx_DECREF(__pyx_t_4); __pyx_t_4 = 0; + + /* "spacy/pipeline/_parser_internals/stateclass.pyx":113 + * return self.doc[self.c.S(i)] + * + * def B_(self, int i): # <<<<<<<<<<<<<< + * return self.doc[self.c.B(i)] + * +*/ + __pyx_t_4 = __Pyx_CyFunction_New(&__pyx_mdef_5spacy_8pipeline_17_parser_internals_10stateclass_10StateClass_35B_, __Pyx_CYFUNCTION_CCLASS, __pyx_mstate_global->__pyx_n_u_StateClass_B_2, NULL, __pyx_mstate_global->__pyx_n_u_spacy_pipeline__parser_internals, __pyx_mstate_global->__pyx_d, ((PyObject *)__pyx_mstate_global->__pyx_codeobj_tab[15])); if (unlikely(!__pyx_t_4)) __PYX_ERR(0, 113, __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 (__Pyx_SetItemOnTypeDict(__pyx_mstate_global->__pyx_ptype_5spacy_8pipeline_17_parser_internals_10stateclass_StateClass, __pyx_mstate_global->__pyx_n_u_B_2, __pyx_t_4) < (0)) __PYX_ERR(0, 113, __pyx_L1_error) + __Pyx_DECREF(__pyx_t_4); __pyx_t_4 = 0; + + /* "spacy/pipeline/_parser_internals/stateclass.pyx":116 + * return self.doc[self.c.B(i)] + * + * def H_(self, int i): # <<<<<<<<<<<<<< + * return self.doc[self.c.H(i)] + * +*/ + __pyx_t_4 = __Pyx_CyFunction_New(&__pyx_mdef_5spacy_8pipeline_17_parser_internals_10stateclass_10StateClass_37H_, __Pyx_CYFUNCTION_CCLASS, __pyx_mstate_global->__pyx_n_u_StateClass_H_2, NULL, __pyx_mstate_global->__pyx_n_u_spacy_pipeline__parser_internals, __pyx_mstate_global->__pyx_d, ((PyObject *)__pyx_mstate_global->__pyx_codeobj_tab[16])); if (unlikely(!__pyx_t_4)) __PYX_ERR(0, 116, __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 (__Pyx_SetItemOnTypeDict(__pyx_mstate_global->__pyx_ptype_5spacy_8pipeline_17_parser_internals_10stateclass_StateClass, __pyx_mstate_global->__pyx_n_u_H_2, __pyx_t_4) < (0)) __PYX_ERR(0, 116, __pyx_L1_error) + __Pyx_DECREF(__pyx_t_4); __pyx_t_4 = 0; + + /* "spacy/pipeline/_parser_internals/stateclass.pyx":119 + * return self.doc[self.c.H(i)] + * + * def E_(self, int i): # <<<<<<<<<<<<<< + * return self.doc[self.c.E(i)] + * +*/ + __pyx_t_4 = __Pyx_CyFunction_New(&__pyx_mdef_5spacy_8pipeline_17_parser_internals_10stateclass_10StateClass_39E_, __Pyx_CYFUNCTION_CCLASS, __pyx_mstate_global->__pyx_n_u_StateClass_E_2, NULL, __pyx_mstate_global->__pyx_n_u_spacy_pipeline__parser_internals, __pyx_mstate_global->__pyx_d, ((PyObject *)__pyx_mstate_global->__pyx_codeobj_tab[17])); if (unlikely(!__pyx_t_4)) __PYX_ERR(0, 119, __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 (__Pyx_SetItemOnTypeDict(__pyx_mstate_global->__pyx_ptype_5spacy_8pipeline_17_parser_internals_10stateclass_StateClass, __pyx_mstate_global->__pyx_n_u_E_2, __pyx_t_4) < (0)) __PYX_ERR(0, 119, __pyx_L1_error) + __Pyx_DECREF(__pyx_t_4); __pyx_t_4 = 0; + + /* "spacy/pipeline/_parser_internals/stateclass.pyx":122 + * return self.doc[self.c.E(i)] + * + * def L_(self, int i, int idx): # <<<<<<<<<<<<<< + * return self.doc[self.c.L(i, idx)] + * +*/ + __pyx_t_4 = __Pyx_CyFunction_New(&__pyx_mdef_5spacy_8pipeline_17_parser_internals_10stateclass_10StateClass_41L_, __Pyx_CYFUNCTION_CCLASS, __pyx_mstate_global->__pyx_n_u_StateClass_L_2, NULL, __pyx_mstate_global->__pyx_n_u_spacy_pipeline__parser_internals, __pyx_mstate_global->__pyx_d, ((PyObject *)__pyx_mstate_global->__pyx_codeobj_tab[18])); if (unlikely(!__pyx_t_4)) __PYX_ERR(0, 122, __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 (__Pyx_SetItemOnTypeDict(__pyx_mstate_global->__pyx_ptype_5spacy_8pipeline_17_parser_internals_10stateclass_StateClass, __pyx_mstate_global->__pyx_n_u_L_2, __pyx_t_4) < (0)) __PYX_ERR(0, 122, __pyx_L1_error) + __Pyx_DECREF(__pyx_t_4); __pyx_t_4 = 0; + + /* "spacy/pipeline/_parser_internals/stateclass.pyx":125 + * return self.doc[self.c.L(i, idx)] + * + * def R_(self, int i, int idx): # <<<<<<<<<<<<<< + * return self.doc[self.c.R(i, idx)] + * +*/ + __pyx_t_4 = __Pyx_CyFunction_New(&__pyx_mdef_5spacy_8pipeline_17_parser_internals_10stateclass_10StateClass_43R_, __Pyx_CYFUNCTION_CCLASS, __pyx_mstate_global->__pyx_n_u_StateClass_R_2, NULL, __pyx_mstate_global->__pyx_n_u_spacy_pipeline__parser_internals, __pyx_mstate_global->__pyx_d, ((PyObject *)__pyx_mstate_global->__pyx_codeobj_tab[19])); if (unlikely(!__pyx_t_4)) __PYX_ERR(0, 125, __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 (__Pyx_SetItemOnTypeDict(__pyx_mstate_global->__pyx_ptype_5spacy_8pipeline_17_parser_internals_10stateclass_StateClass, __pyx_mstate_global->__pyx_n_u_R_2, __pyx_t_4) < (0)) __PYX_ERR(0, 125, __pyx_L1_error) + __Pyx_DECREF(__pyx_t_4); __pyx_t_4 = 0; + + /* "spacy/pipeline/_parser_internals/stateclass.pyx":128 + * return self.doc[self.c.R(i, idx)] + * + * def empty(self): # <<<<<<<<<<<<<< + * return self.c.empty() + * +*/ + __pyx_t_4 = __Pyx_CyFunction_New(&__pyx_mdef_5spacy_8pipeline_17_parser_internals_10stateclass_10StateClass_45empty, __Pyx_CYFUNCTION_CCLASS, __pyx_mstate_global->__pyx_n_u_StateClass_empty, NULL, __pyx_mstate_global->__pyx_n_u_spacy_pipeline__parser_internals, __pyx_mstate_global->__pyx_d, ((PyObject *)__pyx_mstate_global->__pyx_codeobj_tab[20])); if (unlikely(!__pyx_t_4)) __PYX_ERR(0, 128, __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 (__Pyx_SetItemOnTypeDict(__pyx_mstate_global->__pyx_ptype_5spacy_8pipeline_17_parser_internals_10stateclass_StateClass, __pyx_mstate_global->__pyx_n_u_empty, __pyx_t_4) < (0)) __PYX_ERR(0, 128, __pyx_L1_error) + __Pyx_DECREF(__pyx_t_4); __pyx_t_4 = 0; + + /* "spacy/pipeline/_parser_internals/stateclass.pyx":131 + * return self.c.empty() + * + * def eol(self): # <<<<<<<<<<<<<< + * return self.c.eol() + * +*/ + __pyx_t_4 = __Pyx_CyFunction_New(&__pyx_mdef_5spacy_8pipeline_17_parser_internals_10stateclass_10StateClass_47eol, __Pyx_CYFUNCTION_CCLASS, __pyx_mstate_global->__pyx_n_u_StateClass_eol, NULL, __pyx_mstate_global->__pyx_n_u_spacy_pipeline__parser_internals, __pyx_mstate_global->__pyx_d, ((PyObject *)__pyx_mstate_global->__pyx_codeobj_tab[21])); if (unlikely(!__pyx_t_4)) __PYX_ERR(0, 131, __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 (__Pyx_SetItemOnTypeDict(__pyx_mstate_global->__pyx_ptype_5spacy_8pipeline_17_parser_internals_10stateclass_StateClass, __pyx_mstate_global->__pyx_n_u_eol, __pyx_t_4) < (0)) __PYX_ERR(0, 131, __pyx_L1_error) + __Pyx_DECREF(__pyx_t_4); __pyx_t_4 = 0; + + /* "spacy/pipeline/_parser_internals/stateclass.pyx":134 + * return self.c.eol() + * + * def at_break(self): # <<<<<<<<<<<<<< + * return False + * # return self.c.at_break() +*/ + __pyx_t_4 = __Pyx_CyFunction_New(&__pyx_mdef_5spacy_8pipeline_17_parser_internals_10stateclass_10StateClass_49at_break, __Pyx_CYFUNCTION_CCLASS, __pyx_mstate_global->__pyx_n_u_StateClass_at_break, NULL, __pyx_mstate_global->__pyx_n_u_spacy_pipeline__parser_internals, __pyx_mstate_global->__pyx_d, ((PyObject *)__pyx_mstate_global->__pyx_codeobj_tab[22])); 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 + if (__Pyx_SetItemOnTypeDict(__pyx_mstate_global->__pyx_ptype_5spacy_8pipeline_17_parser_internals_10stateclass_StateClass, __pyx_mstate_global->__pyx_n_u_at_break, __pyx_t_4) < (0)) __PYX_ERR(0, 134, __pyx_L1_error) + __Pyx_DECREF(__pyx_t_4); __pyx_t_4 = 0; + + /* "spacy/pipeline/_parser_internals/stateclass.pyx":138 + * # return self.c.at_break() + * + * def has_head(self, int i): # <<<<<<<<<<<<<< + * return self.c.has_head(i) + * +*/ + __pyx_t_4 = __Pyx_CyFunction_New(&__pyx_mdef_5spacy_8pipeline_17_parser_internals_10stateclass_10StateClass_51has_head, __Pyx_CYFUNCTION_CCLASS, __pyx_mstate_global->__pyx_n_u_StateClass_has_head, NULL, __pyx_mstate_global->__pyx_n_u_spacy_pipeline__parser_internals, __pyx_mstate_global->__pyx_d, ((PyObject *)__pyx_mstate_global->__pyx_codeobj_tab[23])); if (unlikely(!__pyx_t_4)) __PYX_ERR(0, 138, __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 (__Pyx_SetItemOnTypeDict(__pyx_mstate_global->__pyx_ptype_5spacy_8pipeline_17_parser_internals_10stateclass_StateClass, __pyx_mstate_global->__pyx_n_u_has_head, __pyx_t_4) < (0)) __PYX_ERR(0, 138, __pyx_L1_error) + __Pyx_DECREF(__pyx_t_4); __pyx_t_4 = 0; + + /* "spacy/pipeline/_parser_internals/stateclass.pyx":141 + * return self.c.has_head(i) + * + * def n_L(self, int i): # <<<<<<<<<<<<<< + * return self.c.n_L(i) + * +*/ + __pyx_t_4 = __Pyx_CyFunction_New(&__pyx_mdef_5spacy_8pipeline_17_parser_internals_10stateclass_10StateClass_53n_L, __Pyx_CYFUNCTION_CCLASS, __pyx_mstate_global->__pyx_n_u_StateClass_n_L, NULL, __pyx_mstate_global->__pyx_n_u_spacy_pipeline__parser_internals, __pyx_mstate_global->__pyx_d, ((PyObject *)__pyx_mstate_global->__pyx_codeobj_tab[24])); if (unlikely(!__pyx_t_4)) __PYX_ERR(0, 141, __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 (__Pyx_SetItemOnTypeDict(__pyx_mstate_global->__pyx_ptype_5spacy_8pipeline_17_parser_internals_10stateclass_StateClass, __pyx_mstate_global->__pyx_n_u_n_L, __pyx_t_4) < (0)) __PYX_ERR(0, 141, __pyx_L1_error) + __Pyx_DECREF(__pyx_t_4); __pyx_t_4 = 0; + + /* "spacy/pipeline/_parser_internals/stateclass.pyx":144 + * return self.c.n_L(i) + * + * def n_R(self, int i): # <<<<<<<<<<<<<< + * return self.c.n_R(i) + * +*/ + __pyx_t_4 = __Pyx_CyFunction_New(&__pyx_mdef_5spacy_8pipeline_17_parser_internals_10stateclass_10StateClass_55n_R, __Pyx_CYFUNCTION_CCLASS, __pyx_mstate_global->__pyx_n_u_StateClass_n_R, NULL, __pyx_mstate_global->__pyx_n_u_spacy_pipeline__parser_internals, __pyx_mstate_global->__pyx_d, ((PyObject *)__pyx_mstate_global->__pyx_codeobj_tab[25])); if (unlikely(!__pyx_t_4)) __PYX_ERR(0, 144, __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 (__Pyx_SetItemOnTypeDict(__pyx_mstate_global->__pyx_ptype_5spacy_8pipeline_17_parser_internals_10stateclass_StateClass, __pyx_mstate_global->__pyx_n_u_n_R, __pyx_t_4) < (0)) __PYX_ERR(0, 144, __pyx_L1_error) + __Pyx_DECREF(__pyx_t_4); __pyx_t_4 = 0; + + /* "spacy/pipeline/_parser_internals/stateclass.pyx":147 + * return self.c.n_R(i) + * + * def entity_is_open(self): # <<<<<<<<<<<<<< + * return self.c.entity_is_open() + * +*/ + __pyx_t_4 = __Pyx_CyFunction_New(&__pyx_mdef_5spacy_8pipeline_17_parser_internals_10stateclass_10StateClass_57entity_is_open, __Pyx_CYFUNCTION_CCLASS, __pyx_mstate_global->__pyx_n_u_StateClass_entity_is_open, NULL, __pyx_mstate_global->__pyx_n_u_spacy_pipeline__parser_internals, __pyx_mstate_global->__pyx_d, ((PyObject *)__pyx_mstate_global->__pyx_codeobj_tab[26])); if (unlikely(!__pyx_t_4)) __PYX_ERR(0, 147, __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 (__Pyx_SetItemOnTypeDict(__pyx_mstate_global->__pyx_ptype_5spacy_8pipeline_17_parser_internals_10stateclass_StateClass, __pyx_mstate_global->__pyx_n_u_entity_is_open, __pyx_t_4) < (0)) __PYX_ERR(0, 147, __pyx_L1_error) + __Pyx_DECREF(__pyx_t_4); __pyx_t_4 = 0; + + /* "spacy/pipeline/_parser_internals/stateclass.pyx":150 + * return self.c.entity_is_open() + * + * def stack_depth(self): # <<<<<<<<<<<<<< + * return self.c.stack_depth() + * +*/ + __pyx_t_4 = __Pyx_CyFunction_New(&__pyx_mdef_5spacy_8pipeline_17_parser_internals_10stateclass_10StateClass_59stack_depth, __Pyx_CYFUNCTION_CCLASS, __pyx_mstate_global->__pyx_n_u_StateClass_stack_depth, NULL, __pyx_mstate_global->__pyx_n_u_spacy_pipeline__parser_internals, __pyx_mstate_global->__pyx_d, ((PyObject *)__pyx_mstate_global->__pyx_codeobj_tab[27])); if (unlikely(!__pyx_t_4)) __PYX_ERR(0, 150, __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 (__Pyx_SetItemOnTypeDict(__pyx_mstate_global->__pyx_ptype_5spacy_8pipeline_17_parser_internals_10stateclass_StateClass, __pyx_mstate_global->__pyx_n_u_stack_depth, __pyx_t_4) < (0)) __PYX_ERR(0, 150, __pyx_L1_error) + __Pyx_DECREF(__pyx_t_4); __pyx_t_4 = 0; + + /* "spacy/pipeline/_parser_internals/stateclass.pyx":153 + * return self.c.stack_depth() + * + * def buffer_length(self): # <<<<<<<<<<<<<< + * return self.c.buffer_length() + * +*/ + __pyx_t_4 = __Pyx_CyFunction_New(&__pyx_mdef_5spacy_8pipeline_17_parser_internals_10stateclass_10StateClass_61buffer_length, __Pyx_CYFUNCTION_CCLASS, __pyx_mstate_global->__pyx_n_u_StateClass_buffer_length, NULL, __pyx_mstate_global->__pyx_n_u_spacy_pipeline__parser_internals, __pyx_mstate_global->__pyx_d, ((PyObject *)__pyx_mstate_global->__pyx_codeobj_tab[28])); if (unlikely(!__pyx_t_4)) __PYX_ERR(0, 153, __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 (__Pyx_SetItemOnTypeDict(__pyx_mstate_global->__pyx_ptype_5spacy_8pipeline_17_parser_internals_10stateclass_StateClass, __pyx_mstate_global->__pyx_n_u_buffer_length, __pyx_t_4) < (0)) __PYX_ERR(0, 153, __pyx_L1_error) + __Pyx_DECREF(__pyx_t_4); __pyx_t_4 = 0; + + /* "spacy/pipeline/_parser_internals/stateclass.pyx":156 + * return self.c.buffer_length() + * + * def push(self): # <<<<<<<<<<<<<< + * self.c.push() + * +*/ + __pyx_t_4 = __Pyx_CyFunction_New(&__pyx_mdef_5spacy_8pipeline_17_parser_internals_10stateclass_10StateClass_63push, __Pyx_CYFUNCTION_CCLASS, __pyx_mstate_global->__pyx_n_u_StateClass_push, NULL, __pyx_mstate_global->__pyx_n_u_spacy_pipeline__parser_internals, __pyx_mstate_global->__pyx_d, ((PyObject *)__pyx_mstate_global->__pyx_codeobj_tab[29])); if (unlikely(!__pyx_t_4)) __PYX_ERR(0, 156, __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 (__Pyx_SetItemOnTypeDict(__pyx_mstate_global->__pyx_ptype_5spacy_8pipeline_17_parser_internals_10stateclass_StateClass, __pyx_mstate_global->__pyx_n_u_push, __pyx_t_4) < (0)) __PYX_ERR(0, 156, __pyx_L1_error) + __Pyx_DECREF(__pyx_t_4); __pyx_t_4 = 0; + + /* "spacy/pipeline/_parser_internals/stateclass.pyx":159 + * self.c.push() + * + * def pop(self): # <<<<<<<<<<<<<< + * self.c.pop() + * +*/ + __pyx_t_4 = __Pyx_CyFunction_New(&__pyx_mdef_5spacy_8pipeline_17_parser_internals_10stateclass_10StateClass_65pop, __Pyx_CYFUNCTION_CCLASS, __pyx_mstate_global->__pyx_n_u_StateClass_pop, NULL, __pyx_mstate_global->__pyx_n_u_spacy_pipeline__parser_internals, __pyx_mstate_global->__pyx_d, ((PyObject *)__pyx_mstate_global->__pyx_codeobj_tab[30])); if (unlikely(!__pyx_t_4)) __PYX_ERR(0, 159, __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 (__Pyx_SetItemOnTypeDict(__pyx_mstate_global->__pyx_ptype_5spacy_8pipeline_17_parser_internals_10stateclass_StateClass, __pyx_mstate_global->__pyx_n_u_pop, __pyx_t_4) < (0)) __PYX_ERR(0, 159, __pyx_L1_error) + __Pyx_DECREF(__pyx_t_4); __pyx_t_4 = 0; + + /* "spacy/pipeline/_parser_internals/stateclass.pyx":162 + * self.c.pop() + * + * def unshift(self): # <<<<<<<<<<<<<< + * self.c.unshift() + * +*/ + __pyx_t_4 = __Pyx_CyFunction_New(&__pyx_mdef_5spacy_8pipeline_17_parser_internals_10stateclass_10StateClass_67unshift, __Pyx_CYFUNCTION_CCLASS, __pyx_mstate_global->__pyx_n_u_StateClass_unshift, NULL, __pyx_mstate_global->__pyx_n_u_spacy_pipeline__parser_internals, __pyx_mstate_global->__pyx_d, ((PyObject *)__pyx_mstate_global->__pyx_codeobj_tab[31])); if (unlikely(!__pyx_t_4)) __PYX_ERR(0, 162, __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 (__Pyx_SetItemOnTypeDict(__pyx_mstate_global->__pyx_ptype_5spacy_8pipeline_17_parser_internals_10stateclass_StateClass, __pyx_mstate_global->__pyx_n_u_unshift, __pyx_t_4) < (0)) __PYX_ERR(0, 162, __pyx_L1_error) + __Pyx_DECREF(__pyx_t_4); __pyx_t_4 = 0; + + /* "spacy/pipeline/_parser_internals/stateclass.pyx":165 + * self.c.unshift() + * + * def add_arc(self, int head, int child, attr_t label): # <<<<<<<<<<<<<< + * self.c.add_arc(head, child, label) + * +*/ + __pyx_t_4 = __Pyx_CyFunction_New(&__pyx_mdef_5spacy_8pipeline_17_parser_internals_10stateclass_10StateClass_69add_arc, __Pyx_CYFUNCTION_CCLASS, __pyx_mstate_global->__pyx_n_u_StateClass_add_arc, NULL, __pyx_mstate_global->__pyx_n_u_spacy_pipeline__parser_internals, __pyx_mstate_global->__pyx_d, ((PyObject *)__pyx_mstate_global->__pyx_codeobj_tab[32])); if (unlikely(!__pyx_t_4)) __PYX_ERR(0, 165, __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 (__Pyx_SetItemOnTypeDict(__pyx_mstate_global->__pyx_ptype_5spacy_8pipeline_17_parser_internals_10stateclass_StateClass, __pyx_mstate_global->__pyx_n_u_add_arc, __pyx_t_4) < (0)) __PYX_ERR(0, 165, __pyx_L1_error) + __Pyx_DECREF(__pyx_t_4); __pyx_t_4 = 0; + + /* "spacy/pipeline/_parser_internals/stateclass.pyx":168 + * self.c.add_arc(head, child, label) + * + * def del_arc(self, int head, int child): # <<<<<<<<<<<<<< + * self.c.del_arc(head, child) + * +*/ + __pyx_t_4 = __Pyx_CyFunction_New(&__pyx_mdef_5spacy_8pipeline_17_parser_internals_10stateclass_10StateClass_71del_arc, __Pyx_CYFUNCTION_CCLASS, __pyx_mstate_global->__pyx_n_u_StateClass_del_arc, NULL, __pyx_mstate_global->__pyx_n_u_spacy_pipeline__parser_internals, __pyx_mstate_global->__pyx_d, ((PyObject *)__pyx_mstate_global->__pyx_codeobj_tab[33])); if (unlikely(!__pyx_t_4)) __PYX_ERR(0, 168, __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 (__Pyx_SetItemOnTypeDict(__pyx_mstate_global->__pyx_ptype_5spacy_8pipeline_17_parser_internals_10stateclass_StateClass, __pyx_mstate_global->__pyx_n_u_del_arc, __pyx_t_4) < (0)) __PYX_ERR(0, 168, __pyx_L1_error) + __Pyx_DECREF(__pyx_t_4); __pyx_t_4 = 0; + + /* "spacy/pipeline/_parser_internals/stateclass.pyx":171 + * self.c.del_arc(head, child) + * + * def open_ent(self, attr_t label): # <<<<<<<<<<<<<< + * self.c.open_ent(label) + * +*/ + __pyx_t_4 = __Pyx_CyFunction_New(&__pyx_mdef_5spacy_8pipeline_17_parser_internals_10stateclass_10StateClass_73open_ent, __Pyx_CYFUNCTION_CCLASS, __pyx_mstate_global->__pyx_n_u_StateClass_open_ent, NULL, __pyx_mstate_global->__pyx_n_u_spacy_pipeline__parser_internals, __pyx_mstate_global->__pyx_d, ((PyObject *)__pyx_mstate_global->__pyx_codeobj_tab[34])); if (unlikely(!__pyx_t_4)) __PYX_ERR(0, 171, __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 (__Pyx_SetItemOnTypeDict(__pyx_mstate_global->__pyx_ptype_5spacy_8pipeline_17_parser_internals_10stateclass_StateClass, __pyx_mstate_global->__pyx_n_u_open_ent, __pyx_t_4) < (0)) __PYX_ERR(0, 171, __pyx_L1_error) + __Pyx_DECREF(__pyx_t_4); __pyx_t_4 = 0; + + /* "spacy/pipeline/_parser_internals/stateclass.pyx":174 + * self.c.open_ent(label) + * + * def close_ent(self): # <<<<<<<<<<<<<< + * self.c.close_ent() + * +*/ + __pyx_t_4 = __Pyx_CyFunction_New(&__pyx_mdef_5spacy_8pipeline_17_parser_internals_10stateclass_10StateClass_75close_ent, __Pyx_CYFUNCTION_CCLASS, __pyx_mstate_global->__pyx_n_u_StateClass_close_ent, NULL, __pyx_mstate_global->__pyx_n_u_spacy_pipeline__parser_internals, __pyx_mstate_global->__pyx_d, ((PyObject *)__pyx_mstate_global->__pyx_codeobj_tab[35])); if (unlikely(!__pyx_t_4)) __PYX_ERR(0, 174, __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 (__Pyx_SetItemOnTypeDict(__pyx_mstate_global->__pyx_ptype_5spacy_8pipeline_17_parser_internals_10stateclass_StateClass, __pyx_mstate_global->__pyx_n_u_close_ent, __pyx_t_4) < (0)) __PYX_ERR(0, 174, __pyx_L1_error) + __Pyx_DECREF(__pyx_t_4); __pyx_t_4 = 0; + + /* "spacy/pipeline/_parser_internals/stateclass.pyx":177 + * self.c.close_ent() + * + * def clone(self, StateClass src): # <<<<<<<<<<<<<< + * self.c.clone(src.c) +*/ + __pyx_t_4 = __Pyx_CyFunction_New(&__pyx_mdef_5spacy_8pipeline_17_parser_internals_10stateclass_10StateClass_77clone, __Pyx_CYFUNCTION_CCLASS, __pyx_mstate_global->__pyx_n_u_StateClass_clone, NULL, __pyx_mstate_global->__pyx_n_u_spacy_pipeline__parser_internals, __pyx_mstate_global->__pyx_d, ((PyObject *)__pyx_mstate_global->__pyx_codeobj_tab[36])); if (unlikely(!__pyx_t_4)) __PYX_ERR(0, 177, __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 (__Pyx_SetItemOnTypeDict(__pyx_mstate_global->__pyx_ptype_5spacy_8pipeline_17_parser_internals_10stateclass_StateClass, __pyx_mstate_global->__pyx_n_u_clone, __pyx_t_4) < (0)) __PYX_ERR(0, 177, __pyx_L1_error) + __Pyx_DECREF(__pyx_t_4); __pyx_t_4 = 0; + + /* "(tree fragment)":1 + * def __reduce_cython__(self): # <<<<<<<<<<<<<< + * raise TypeError, "self.c cannot be converted to a Python object for pickling" + * def __setstate_cython__(self, __pyx_state): +*/ + __pyx_t_4 = __Pyx_CyFunction_New(&__pyx_mdef_5spacy_8pipeline_17_parser_internals_10stateclass_10StateClass_79__reduce_cython__, __Pyx_CYFUNCTION_CCLASS, __pyx_mstate_global->__pyx_n_u_StateClass___reduce_cython, NULL, __pyx_mstate_global->__pyx_n_u_spacy_pipeline__parser_internals, __pyx_mstate_global->__pyx_d, ((PyObject *)__pyx_mstate_global->__pyx_codeobj_tab[37])); 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, "self.c cannot be converted to a Python object for pickling" + * def __setstate_cython__(self, __pyx_state): # <<<<<<<<<<<<<< + * raise TypeError, "self.c cannot be converted to a Python object for pickling" +*/ + __pyx_t_4 = __Pyx_CyFunction_New(&__pyx_mdef_5spacy_8pipeline_17_parser_internals_10stateclass_10StateClass_81__setstate_cython__, __Pyx_CYFUNCTION_CCLASS, __pyx_mstate_global->__pyx_n_u_StateClass___setstate_cython, NULL, __pyx_mstate_global->__pyx_n_u_spacy_pipeline__parser_internals, __pyx_mstate_global->__pyx_d, ((PyObject *)__pyx_mstate_global->__pyx_codeobj_tab[38])); 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; + + /* "spacy/pipeline/_parser_internals/stateclass.pyx":1 + * # cython: infer_types=True # <<<<<<<<<<<<<< + * # cython: profile=False + * from libcpp.vector cimport vector +*/ + __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_4); + __Pyx_XDECREF(__pyx_t_5); + if (__pyx_m) { + if (__pyx_mstate->__pyx_d && stringtab_initialized) { + __Pyx_AddTraceback("init spacy.pipeline._parser_internals.stateclass", __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 spacy.pipeline._parser_internals.stateclass"); + } + __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___import__ = __Pyx_GetBuiltinName(__pyx_mstate->__pyx_n_u_import); if (!__pyx_builtin___import__) __PYX_ERR(1, 101, __pyx_L1_error) + __pyx_builtin_enumerate = __Pyx_GetBuiltinName(__pyx_mstate->__pyx_n_u_enumerate); if (!__pyx_builtin_enumerate) __PYX_ERR(1, 157, __pyx_L1_error) + __pyx_builtin_Ellipsis = __Pyx_GetBuiltinName(__pyx_mstate->__pyx_n_u_Ellipsis); if (!__pyx_builtin_Ellipsis) __PYX_ERR(1, 409, __pyx_L1_error) + __pyx_builtin_id = __Pyx_GetBuiltinName(__pyx_mstate->__pyx_n_u_id); if (!__pyx_builtin_id) __PYX_ERR(1, 619, __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); + + /* "(tree fragment)":11 + * use_setstate = True + * else: + * use_setstate = ('self.name is not None',) # <<<<<<<<<<<<<< + * if use_setstate: + * return __pyx_unpickle_Enum, (type(self), 0x82a3537, None), state +*/ + __pyx_mstate_global->__pyx_tuple[0] = PyTuple_Pack(1, __pyx_mstate_global->__pyx_kp_u_self_name_is_not_None); if (unlikely(!__pyx_mstate_global->__pyx_tuple[0])) __PYX_ERR(1, 11, __pyx_L1_error) + __Pyx_GOTREF(__pyx_mstate_global->__pyx_tuple[0]); + __Pyx_GIVEREF(__pyx_mstate_global->__pyx_tuple[0]); + + /* "View.MemoryView":583 + * def suboffsets(self): + * if self.view.suboffsets == NULL: + * return (-1,) * self.view.ndim # <<<<<<<<<<<<<< + * + * return tuple([suboffset for suboffset in self.view.suboffsets[:self.view.ndim]]) +*/ + __pyx_mstate_global->__pyx_tuple[1] = PyTuple_New(1); if (unlikely(!__pyx_mstate_global->__pyx_tuple[1])) __PYX_ERR(1, 583, __pyx_L1_error) + __Pyx_GOTREF(__pyx_mstate_global->__pyx_tuple[1]); + __Pyx_INCREF(__pyx_mstate_global->__pyx_int_neg_1); + __Pyx_GIVEREF(__pyx_mstate_global->__pyx_int_neg_1); + if (__Pyx_PyTuple_SET_ITEM(__pyx_mstate_global->__pyx_tuple[1], 0, __pyx_mstate_global->__pyx_int_neg_1) != (0)) __PYX_ERR(1, 583, __pyx_L1_error); + __Pyx_GIVEREF(__pyx_mstate_global->__pyx_tuple[1]); + + /* "View.MemoryView":680 + * tup = index if isinstance(index, tuple) else (index,) + * + * result = [slice(None)] * ndim # <<<<<<<<<<<<<< + * have_slices = False + * seen_ellipsis = False +*/ + __pyx_mstate_global->__pyx_slice[0] = PySlice_New(Py_None, Py_None, Py_None); if (unlikely(!__pyx_mstate_global->__pyx_slice[0])) __PYX_ERR(1, 680, __pyx_L1_error) + __Pyx_GOTREF(__pyx_mstate_global->__pyx_slice[0]); + __Pyx_GIVEREF(__pyx_mstate_global->__pyx_slice[0]); + + /* "spacy/pipeline/_parser_internals/stateclass.pyx":85 + * shifted.append("") + * sent_starts.append("") + * top = f"{self.S(0)}{words[self.S(0)]}_{words[self.H(self.S(0))]}_{shifted[self.S(0)]}" # <<<<<<<<<<<<<< + * second = f"{self.S(1)}{words[self.S(1)]}_{words[self.H(self.S(1))]}_{shifted[self.S(1)]}" + * third = f"{self.S(2)}{words[self.S(2)]}_{words[self.H(self.S(2))]}_{shifted[self.S(2)]}" +*/ + __pyx_mstate_global->__pyx_tuple[2] = PyTuple_Pack(1, __pyx_mstate_global->__pyx_int_0); if (unlikely(!__pyx_mstate_global->__pyx_tuple[2])) __PYX_ERR(0, 85, __pyx_L1_error) + __Pyx_GOTREF(__pyx_mstate_global->__pyx_tuple[2]); + __Pyx_GIVEREF(__pyx_mstate_global->__pyx_tuple[2]); + + /* "spacy/pipeline/_parser_internals/stateclass.pyx":86 + * sent_starts.append("") + * top = f"{self.S(0)}{words[self.S(0)]}_{words[self.H(self.S(0))]}_{shifted[self.S(0)]}" + * second = f"{self.S(1)}{words[self.S(1)]}_{words[self.H(self.S(1))]}_{shifted[self.S(1)]}" # <<<<<<<<<<<<<< + * third = f"{self.S(2)}{words[self.S(2)]}_{words[self.H(self.S(2))]}_{shifted[self.S(2)]}" + * n0 = f"{self.B(0)}{words[self.B(0)]}_{sent_starts[self.B(0)]}_{shifted[self.B(0)]}" +*/ + __pyx_mstate_global->__pyx_tuple[3] = PyTuple_Pack(1, __pyx_mstate_global->__pyx_int_1); if (unlikely(!__pyx_mstate_global->__pyx_tuple[3])) __PYX_ERR(0, 86, __pyx_L1_error) + __Pyx_GOTREF(__pyx_mstate_global->__pyx_tuple[3]); + __Pyx_GIVEREF(__pyx_mstate_global->__pyx_tuple[3]); + + /* "spacy/pipeline/_parser_internals/stateclass.pyx":87 + * top = f"{self.S(0)}{words[self.S(0)]}_{words[self.H(self.S(0))]}_{shifted[self.S(0)]}" + * second = f"{self.S(1)}{words[self.S(1)]}_{words[self.H(self.S(1))]}_{shifted[self.S(1)]}" + * third = f"{self.S(2)}{words[self.S(2)]}_{words[self.H(self.S(2))]}_{shifted[self.S(2)]}" # <<<<<<<<<<<<<< + * n0 = f"{self.B(0)}{words[self.B(0)]}_{sent_starts[self.B(0)]}_{shifted[self.B(0)]}" + * n1 = f"{self.B(1)}{words[self.B(1)]}_{sent_starts[self.B(1)]}_{shifted[self.B(1)]}" +*/ + __pyx_mstate_global->__pyx_tuple[4] = PyTuple_Pack(1, __pyx_mstate_global->__pyx_int_2); if (unlikely(!__pyx_mstate_global->__pyx_tuple[4])) __PYX_ERR(0, 87, __pyx_L1_error) + __Pyx_GOTREF(__pyx_mstate_global->__pyx_tuple[4]); + __Pyx_GIVEREF(__pyx_mstate_global->__pyx_tuple[4]); + #if CYTHON_IMMORTAL_CONSTANTS + { + PyObject **table = __pyx_mstate->__pyx_tuple; + for (Py_ssize_t i=0; i<5; ++i) { + #if CYTHON_COMPILING_IN_CPYTHON_FREETHREADING + Py_SET_REFCNT(table[i], _Py_IMMORTAL_REFCNT_LOCAL); + #else + Py_SET_REFCNT(table[i], _Py_IMMORTAL_INITIAL_REFCNT); + #endif + } + } + #endif + #if CYTHON_IMMORTAL_CONSTANTS + { + PyObject **table = __pyx_mstate->__pyx_slice; + for (Py_ssize_t i=0; i<1; ++i) { + #if CYTHON_COMPILING_IN_CPYTHON_FREETHREADING + Py_SET_REFCNT(table[i], _Py_IMMORTAL_REFCNT_LOCAL); + #else + 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[] = {{2},{68},{35},{54},{37},{60},{24},{52},{26},{34},{29},{33},{45},{22},{15},{179},{37},{30},{32},{1},{1},{1},{1},{1},{0},{1},{1},{8},{5},{6},{15},{23},{25},{7},{6},{2},{6},{35},{9},{30},{50},{39},{34},{8},{58},{21},{47},{20},{32},{22},{14},{30},{37},{5},{1},{2},{1},{2},{8},{1},{1},{2},{1},{2},{20},{1},{2},{1},{2},{8},{10},{12},{13},{12},{13},{12},{13},{12},{13},{12},{13},{12},{13},{28},{30},{18},{19},{24},{16},{20},{15},{18},{16},{25},{14},{19},{19},{14},{14},{19},{14},{22},{15},{22},{18},{1},{15},{1},{3},{7},{15},{18},{8},{4},{5},{13},{1},{5},{9},{17},{18},{5},{9},{4},{5},{7},{8},{3},{15},{5},{6},{14},{9},{3},{5},{5},{6},{7},{8},{12},{8},{4},{1},{2},{3},{10},{5},{13},{8},{5},{8},{5},{8},{7},{4},{10},{2},{2},{3},{3},{4},{8},{4},{7},{9},{3},{6},{8},{4},{3},{11},{4},{14},{11},{10},{19},{14},{12},{10},{17},{13},{8},{6},{4},{11},{12},{10},{12},{19},{5},{7},{4},{43},{3},{11},{5},{4},{4},{6},{8},{4},{5},{5},{3},{6},{7},{6},{6},{5},{1},{11},{11},{15},{11},{15},{17},{13},{11},{41},{499},{7},{13},{15},{17},{17},{13},{15},{13},{13},{15},{13},{13},{21},{23},{9},{92},{51},{39},{1}}; + #if (CYTHON_COMPRESS_STRINGS) == 2 /* compression: bz2 (2131 bytes) */ +const char* const cstring = "BZh91AY&SY\022\343\203w\000\001\001\177\376\177w\377\004~\377\377\327\277\377\377\377\277\377\377\364@@@@@@@@@@@@`\007\337p\361\270^\367\264\350\327v\243\263\271\256\265F\336\273\334\010h\221\003M)\376\21056\002\236MF\322i=O)\350\214M2\r4\r\000=F\203L\323SL\207\2443S5\006\211\242h\325?H\324\315M\251\265O\324\023\311\265M\003&\023\023F\201\200@2\000b4\0320\206\230M\006\246\t\221\004\2404\000\032\032\036\240\000\032\000\320h\000\000\001\247\250\006\232d\320\004\246\210\022hi'\352d'\222bb5\014\214\200\006\200\000\000\000\000\006\2004\000\340\000\000\006\200\000\000\032\000h\000\006\200\000\032\000\000\000\004\241\002\r)\350\322\231O\332\251\372\223\323\364\221\224y\006\223d\324\320\332\002d\030\000\001\000\320\311\246\010\030\335\334;\006uC\366\365\207\255=\201\375\377\237\361\377\377\261\224a\007\036\350#'\264\211\007@D\nrc\000\0005#\007#\260@v\240j2\272\261\006\232\003z\311\347\355\372\214\341\230\02393K\026\235\272f\355\224\217\3121\361\263\023\375\332OK\214\035\263 E\322A>\035NV\003\260\360R\261\243\026\203V_\245N\362\276E\223\372\331\363\326>\326\337\224\320\347xk\302\034`\270;`\232\232~U\n\320\303B\313\024\202\224\341\2550\241t\211\243;\246z\024\213N\312\021\243\205\204#H\222d*\275g,#\013]\233-t\256n\217\"\020q\364y\024r.NH\3458\202\350\215\376\037gMC*csf\361\037\3562\363\351\364\324\273\241\356&\326\206\327\221\306\201\334\230\216zn\0244\221\nhh\351>\334J4Y-[\306\353\273\353\273L\246\314F\271K\333\365=\246\253o\3633D\253\201x\372\3426\303~x\31408\nw8u\211~\223~\257\245\351a\214k\261\032[@&\365\r\323\261d\001DQ\001\346\006(g\310%\230D\000\247\034\325\226\251F\233\274\203XZN\021\274\211\256\237\010^E\322\313\273\353a7\266&\265}\365312T\014\352\240\252\201a^\005g\213M\332\233>eq9\007\226\007\003\205\236\354.\252s\357RB\322\251\n\271\342\220\025\307\023S'P+(R9P\321\306o\032Ny\226\216K\226\252I0\372\3739\306\272\363\266(,\0176\273\355N;`\325\021\007b\2550\245\211A\306\251g4\241\325g\230\310\3535uO\344\337\023\032\266\024\221\263S\333\372a}\014C\323%\365;~\005\351rj""\324\241\342\345\272A\303\230\352\353\023N\367\272\333\031\t\001\031\302\014\211\217\245\204\303\265N\203$\202\t\023!T\t\361\333!*7\223\010\230ksB\324\305n\264\023\250x\301*\006P0\205\007T\224\210I\t\327\226V7\210$\305\311\262*\266O\272\000&]\231\355\336\022i\217Q\230\242@\327A\"4\214\336p9c\373\212EvN\261\316\202\333\362\004\313\034\225?\300\352\207kA\330\233\261\277\342\342Y\201\354\233\306\224\303PR\376q\211\244\241\245F 1Us\310\256\255\230\340+\331\230\035\005\204Kl|\372N\311\225T\2427\272\342\0317zw\373[i\266l\306X\365\272\006\005\250\331\272(0\021y\220S.W;\2233\350\272\343\355\247\014>\003Q:\277Ch\340yS\026'\216<\030\245I\264\3054\245\343\345\"3\352Qng\362\r\r>+3\365dh\320X\033\001\334t\316`\304\313\006Y\321\003\261\331\204\343\250\010(8\271yZ\335)6\222\346R\302\330\004\364Z\372\"(2\020\210\220vW\305\022\t6\"*f\223TQ\314\210\021\032k\225\026T\356\316?\005\206rx9\203;\007QB\214\0024\334+\204?\004\254`\352dj;\205\014\256$\266\236\252(;\020(j\215j\033bHHElP\021a\253fvB\207$\320\306*\234W\2230\2062!\255{V""\331\323S\212eV\210g\370\352\240\225\226L\243Y\227ADh\330l\307\246@ \206}K\257\265\234\304\313r\tp\301\2049@sK3\231\316\035\246\022\022\033F\274\013\270\365\266|\307Zi\253>\022\025\3041>\370\214t\316`\340\024\270\232\223w\242U3\t\216\244p=\320\2669\030b&y\304\020F\000ug\333\342\233\254\315\341\236\004\242\352 L\332\230M\270\033\201\265\2154)qyy\274\200\205\327*\213\031X%\213#M\236\364\323\265\305\240\361EaT\034\233\016\315\240\312q\350shE\035\313lTy\322L\206h@\307\002Q\024|\005Y\271\035X\301\031V*\217\237#\t\321T\n\214w\017S%\025b\"\220\305j\322\206\307[g\256J\237\303V\321x\303\016\257\215\233\231\270\326\241#\206pF\336\326\036#!sm\313\264L\343Y\364\355tw\314\344\033\014M\3675&\201\t\022\330n\022\221z\266\353H\01677\344\322-\253,e\312_s=:s\017\t\230\0041\232\225U\204$\3030\205\301\350\034\026e\0329\312dA#Y\230h\277\261)(\304\364\200\027Y\304u\304O\255\001\261\324\210iB\330\223\266D\240\211\362*\021\245!@-\325\344\246\322\341Zz\035g;*\002\277.\276\256\310w-`\271\nd\rF\355\215\263\002F&\326\032\0139d\312\332\033H\257\230\256r\261\226\005N\t\025\267MMn&\3676#>\014.\211\252\225\356\344\254\302\221\t\013\211\263\347\036Ts\335\322f\360]\265\202b\334\020!n?\021\272r\236\265\"\223&\316B\254\363\300\336$8\224J\020\200\032\220\344Y;\234\336_\242\354\271\246?\310\3474tL \335\222~\374\300\007\300b\353\0008\207x\031\021^\373\200\260\242(\226o\017\034\031\250\204\201V\010\344\277\302Y\237\336a\3727\014\214\310mm\327\034\252\016Q#\245\272\016$`A\r\247\207\233\326\2007\017\350.a8\374\261D\024\037\234\007\020\033\221tDQ\307\347\346\214#\367\300#\311\221\003\260p\025\320\360\177~\357\252\024\021\271\226\365\326\333\360\272\335K\241\264h\n\224\363\303\034\364\344b*^\216p\234\2357\241(\004\030 N\374#U\333//\246\377R\372t\236\203\272 H\355\007\331\270\371\353\\\266\310e\206R$q\301a\204\330w\242V^\017\023\014\026\242~\032\2140\346\233:N\246V-k\206\006+\2354CV\016\321$\261\216\310\307\214j\nUvk\324\000L]\245'(\202\004\376\2122\250\2769\263\317\376.\344\212p\241 %\307\006\356"; + PyObject *data = __Pyx_DecompressString(cstring, 2131, 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 (1950 bytes) */ +const char* const cstring = "x\332\245W1s\033\271\025\266\024_F\227I\342H\266S]\001\345\244\221\235\330\264\345\310\276\233\033G\031J\342\305Jd[\"e\311\3629\301\200\013,\tk\t\254\026X\211\274I\221\222\345\226[\262d\311\222%K\226,\365s\362\200\335\025A\311ss3W\210\302{x\017x\357{\357} \277C\345 @\224\267\230P\\\n\205\302\210y\214r\321\230*\321*E\255XiTg\210\013\312\332\214\"\"(\022R#\025p0\337\212}\237E\350\234\263\013D%Sv\213\265C\251\030R:\342\224\251m\"\220\024A\007y\021#\232!\202\352\231\223n\022\215\270B\236\024\2327b\031+\270\004\265XKF\235\022x\231\243\210R\274!\220\226\010\234\351c{Nfa\256\314\215\362\203/\"\256I=`\271A\026\224\037\311\326O\371\332\264\320\005\327M\244;!Ck\271^GD(\233\306\324%3\003\017\016Pi\007\273\035\0270\236\201\220\031UZ\241\356 \325$p\264\216C\010\316\227\021\362:\272)E\211D\021\351\354\332\000d\254\221\364Q]\306\202*\364\200\264\341\224U\372p\367\346]\031\370q\030\312H3\272+\316I\300\241J\222\262G\006x0\206\"\255yk\010\356Y\203\313L\"k\217P\003\274\n\343,\034\300\332^\363\362\265M\360\310$\010!\274\221\000\245-\315\266\215\322\344CY\300\353,\002\220\001BSV\270\304\326O\240\375\312\376\343\215o7l[D\354\023\\\257 \272\272\027@\345\240\035LN1\0174\\f\340U%\264\353\243\216\214\221`\020&\2245\004;\327A7\231@\212i\263@k\266\026DC\336\030\334\2417\327r\\\37193\336\337\223@\261\322\333\031\360 \344\274\301\210\3471U\240Y\323,D-\322\261\370A?\377\310\"9\005\372\235\260\235\003GB7\236\263\010\032C\263\226\221e\335$\365\367\322\346\332C\364_B)\026\006 \223.\002\214\236\266=\031\004& (M\211\324\275\227N7\033\243,\334\315\353\352\242\2116)W\346ff\357ox\350\201)T\303\366\217\311\301\214#kk&\264\035\216\351dr\225\271P\023\247\342?2\364\362o\350\351\215\356\022\022\212\347\2238\320\010\343\210\321\330c\030#\032\333T\205\024\217\241\230\347\234\004\260\353q\3015\306\"n\205\235\022\366d\304J-\360\343\366\034\344\023\036d\025\343-\323z\256Y\334\"0\027\327-r\3446\025\013\374\222\207\274l\256\000\371\034\341\314\226\240\375\254\3152k\233@\310\275\323\0002\267\236\202\264X1So\244`*$^""\347I\310C\350I\301\236\340\220D\212E\230\013hI\001\355\360DA\3030\333N\245\260\323~\231\261\020\235)\306M\235\231\226\253\232\314\354\317j!(\031G\036\333\214\257\032\206\004\201\364,\261Y\240(\321\244\364\231\335l\350\314\2119/\226\312\265\355\335\335\255-\\\251\340J\020\360Pq\365\375\253Wxo\017c\274\337i\303\337\016\014\032~\003\365\2572\277Z\305\265\032\256\261\263\230\t\217\325L\222\333&\311\351\252\264\345\256\261#T\334\265\273\361\312]\273\033{\356\332\335\250\272kw\243\346\256\335\215\253\276\313\372\022\317\356\301\250\333\202}n\327L\033\211\236\034\276\233\274\003\357\037&?|\234|\374\267Is\036\202\337H\"\200\347\353\364 e\275\365\336N\177\276\277\334\177>\230\033\334\037\220\201\036>\033\036\014\351\350O\220\361\321x}\374\217I\355pr\010A|\230|0\307\\.\374\256[\355\236\001z[\220\243\202X\236\367\346z\367z\325\336Y\377\013\200\343t\2708\\\031\326Gs\026\220\2131\031\353I\r\242\200L\216\177\231\357\235\256JV!\362\273\266:_\365\337\r\276\036\034@uJ\343/L\246\220 \231\020\177\342\177\232|:5%\317+\177\247\253\223g\311\307\336\342T\250\026\2354\025\241(\263\212_\247d\2528L\027g\204ty*\036\271\236'\256\327\211i\255\251\370\237\236c\210\263\2766\302\006\334f\232\251\016X,~Ny\027l\347.o\377\246\373\227\344 g(\374\334N:\376\326p\025P\205\302D\353\010\353[\331\350\242kf\337dj\205\367\340'i\213m\337z\373\366\010W\313o\376u\253\362z\377\360\004\357U\336W^W~\246\257\353\022\003\263\274\330\300\032=8\227\360C\351\317\217\340\353\237~\204\n\365\303[\360@4_l\274\375?\323\363\370\211"; + PyObject *data = __Pyx_DecompressString(cstring, 1950, 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 (3901 bytes) */ +const char* const bytes = ": All dimensions preceding dimension %d must be indexed and not slicedBuffer view does not expose stridesCan only create a buffer that is contiguous in memory.Cannot assign to read-only memoryviewCannot create writable memory view from read-only memoryviewCannot index with type 'Cannot transpose memoryview with indirect dimensionsDimension %d is not directEmpty shape tuple for cython.arrayIndex out of bounds (axis %d)Indirect dimensions not supportedInvalid mode, expected 'c' or 'fortran', got Invalid shape in axis ') |add_note and at 0xcollections.abcdisableenablegc (got got differing extents in dimension isenableditemsize <= 0 for cython.arrayno default __reduce__ due to non-trivial __cinit__numpy._core.multiarray failed to importnumpy._core.umath failed to import object>self.c cannot be converted to a Python object for picklingself.name is not Nonespacy/pipeline/_parser_internals/stateclass.pyxunable to allocate array data.unable to allocate shape and strides.ASCIIBB_EE_EllipsisFHH_LL___Pyx_PyDict_NextRefRR_SS_SequenceStateClassStateClass.BStateClass.B_StateClass.EStateClass.E_StateClass.HStateClass.H_StateClass.LStateClass.L_StateClass.RStateClass.R_StateClass.SStateClass.S_StateClass.__reduce_cython__StateClass.__setstate_cython__StateClass.add_arcStateClass.at_breakStateClass.buffer_lengthStateClass.cloneStateClass.close_entStateClass.copyStateClass.del_arcStateClass.emptyStateClass.entity_is_openStateClass.eolStateClass.has_headStateClass.is_finalStateClass.n_LStateClass.n_RStateClass.open_entStateClass.popStateClass.print_stateStateC""lass.pushStateClass.stack_depthStateClass.unshiftTView.MemoryView_abcadd_arcallocate_bufferasyncio.coroutinesat_breakbaseboolsbuffer_lengthcchild__class____class_getitem__cline_in_tracebackcloneclose_entcopycountdel_arc__dict__docdtype_is_objectemptyencodeentity_is_openenumerateeolerrorflagsformatfortran__func____getstate__has_headheadiididx__import__index_is_coroutineis_finalitemsitemsizelabel__main__memviewmode__module__n0n1n_Ln_Rname__name__ndim__new__new_stateobjoffsetopen_entpackpopprint_statepush__pyx_checksum__pyx_state__pyx_type__pyx_unpickle_Enum__pyx_vtable____qualname____reduce____reduce_cython____reduce_ex__registersecondselfsent_starts__set_name__setdefault__setstate____setstate_cython__shapeshiftedsizespacy.pipeline._parser_internals.stateclasssrcstack_depthstartstepstopstruct__test__textthirdtokentopunpackunshiftupdatevalueswordsx\200A\330\010\014\210B\210d\220!\200A\330\010\014\210B\210e\2201\200A\330\010\014\210B\210f\220A\220S\230\001\200A\330\010\014\210B\210h\220a\200A\330\010\014\210B\210h\220a\220v\230Q\200A\330\010\014\210B\210h\220a\220v\230W\240A\200A\330\010\014\210B\210i\220q\230\001\200A\330\010\014\210B\210j\230\001\200A\330\010$\240J\250a\250t\2604\260v\270W\300D\310\002\310!\330\010\021\220\022\2206\230\021\230$\230a\330\010\017\210q\200A\330\010\020\220\001\220\025\220f\230D\240\t\250\024\250Q\330\010\020\220\004\220A\220W\230B\230a\230q\330\010\020\220\001\220\025\220a\330\010\026\220a\220u\230A\230T\240\022\240>\260\021\260$\260d\270%\270u\300A\300S\310\001\310\024\310Q\330\010\022\220!\2205\230\004\230B\230o\250Q\250h\260b\270\004\270E\300\025\300a\300t\3102\310Q\330\010\017\210w\220a\220q\330\010\023\2207\230!\2301\330\010\016\210b\220\001\220\024\220R\220q\230\003\2301\230E\240\021\240$\240b\250\001\250\025\250a\250u\260A\260T\270\022\2701\270D\300\002\300!\3006\310\021\310'\320QR\320RV\320VX\320XY\320YZ\330\010\021\220\022\2201\220D\230\002\230!\2303\230a\230u\240A\240T\250\022\2501\250E\260\021\260%\260q\270\004\270B\270a\270t""\3002\300Q\300f\310A\310W\320TU\320UY\320Y[\320[\\\320\\]\330\010\020\220\002\220!\2204\220r\230\021\230#\230Q\230e\2401\240D\250\002\250!\2505\260\001\260\025\260a\260t\2702\270Q\270d\300\"\300A\300V\3101\310G\320ST\320TX\320XZ\320Z[\320[\\\330\010\r\210R\210q\220\004\220B\220a\220s\230!\2305\240\001\240\024\240R\240q\250\005\250Q\250k\270\021\270$\270b\300\001\300\025\300a\300w\310a\310t\320SU\320UV\320VW\330\010\r\210R\210q\220\004\220B\220a\220s\230!\2305\240\001\240\024\240R\240q\250\005\250Q\250k\270\021\270$\270b\300\001\300\025\300a\300w\310a\310t\320SU\320UV\320VW\330\010\017\210s\220%\220r\230\023\230A\230T\240\034\250U\260#\260Q\260d\270.\310\005\310W\320T\\\320\\a\320af\320fj\320jk\200A\330\010\017\210q\200A\330\010\017\210t\2202\220\\\240\021\200A\330\010\017\210t\2202\220R\220q\230\001\200A\330\010\017\210t\2202\220R\220q\230\003\2301\200A\330\010\017\210t\2202\220R\220q\230\006\230a\200A\330\010\017\210t\2202\220T\230\021\200A\330\010\017\210t\2202\220T\230\021\230!\200A\330\010\017\210t\2202\220V\2301\200A\330\010\017\210t\2202\220Y\230a\200A\330\010\017\210t\2202\220Y\230a\230q\200A\330\010\017\210t\2202\220^\2401\200A\330\010\017\210t\2202\220_\240A\200A\330\010\017\210t\2204\220q\230\004\230B\230b\240\001\240\021\200A\330\010\017\210t\2204\220q\230\004\230B\230b\240\001\240\023\240A\200\001\330\004\n\210+\220Q__pyx_t_5spacy_8typedefs_attr_t\000struct __pyx_t_5spacy_7structs_LexemeC\000OOV_RANK\000EMPTY_LEXEMEstruct __pyx_t_5spacy_7structs_LexemeC\000EMPTY_LEXEMEuint64_t (void *, int, uint64_t)\000hash64O"; + 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 < 210; i++) { + Py_ssize_t bytes_length = index[i].length; + PyObject *string = PyUnicode_DecodeUTF8(bytes + pos, bytes_length, NULL); + if (likely(string) && i >= 53) 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 = 210; i < 239; 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 < 239; i++) { + if (unlikely(PyObject_Hash(stringtab[i]) == -1)) { + __PYX_ERR(0, 1, __pyx_L1_error) + } + } + #if CYTHON_IMMORTAL_CONSTANTS + { + PyObject **table = stringtab + 210; + for (Py_ssize_t i=0; i<29; ++i) { + #if CYTHON_COMPILING_IN_CPYTHON_FREETHREADING + Py_SET_REFCNT(table[i], _Py_IMMORTAL_REFCNT_LOCAL); + #else + 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,-1,1,2}; + int32_t const cint_constants_4[] = {136983863L}; + for (int i = 0; i < 5; i++) { + numbertab[i] = PyLong_FromLong((i < 4 ? cint_constants_1[i - 0] : cint_constants_4[i - 4])); + 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<5; ++i) { + #if CYTHON_COMPILING_IN_CPYTHON_FREETHREADING + Py_SET_REFCNT(table[i], _Py_IMMORTAL_REFCNT_LOCAL); + #else + 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 : 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 = {4, 0, 0, 4, (unsigned int)(CO_OPTIMIZED|CO_NEWLOCALS), 46}; + PyObject* const varnames[] = {__pyx_mstate->__pyx_n_u_self, __pyx_mstate->__pyx_n_u_head, __pyx_mstate->__pyx_n_u_child, __pyx_mstate->__pyx_n_u_label}; + __pyx_mstate_global->__pyx_codeobj_tab[0] = __Pyx_PyCode_New(descr, varnames, __pyx_mstate->__pyx_kp_u_spacy_pipeline__parser_internals_2, __pyx_mstate->__pyx_n_u_add_arc, __pyx_mstate->__pyx_kp_b_iso88591_A_BhavWA, tuple_dedup_map); if (unlikely(!__pyx_mstate_global->__pyx_codeobj_tab[0])) goto bad; + } + { + const __Pyx_PyCode_New_function_description descr = {3, 0, 0, 3, (unsigned int)(CO_OPTIMIZED|CO_NEWLOCALS), 49}; + PyObject* const varnames[] = {__pyx_mstate->__pyx_n_u_self, __pyx_mstate->__pyx_n_u_head, __pyx_mstate->__pyx_n_u_child}; + __pyx_mstate_global->__pyx_codeobj_tab[1] = __Pyx_PyCode_New(descr, varnames, __pyx_mstate->__pyx_kp_u_spacy_pipeline__parser_internals_2, __pyx_mstate->__pyx_n_u_del_arc, __pyx_mstate->__pyx_kp_b_iso88591_A_BhavQ, tuple_dedup_map); if (unlikely(!__pyx_mstate_global->__pyx_codeobj_tab[1])) goto bad; + } + { + const __Pyx_PyCode_New_function_description descr = {2, 0, 0, 2, (unsigned int)(CO_OPTIMIZED|CO_NEWLOCALS), 52}; + PyObject* const varnames[] = {__pyx_mstate->__pyx_n_u_self, __pyx_mstate->__pyx_n_u_child}; + __pyx_mstate_global->__pyx_codeobj_tab[2] = __Pyx_PyCode_New(descr, varnames, __pyx_mstate->__pyx_kp_u_spacy_pipeline__parser_internals_2, __pyx_mstate->__pyx_n_u_H, __pyx_mstate->__pyx_kp_b_iso88591_A_t2Rq, tuple_dedup_map); if (unlikely(!__pyx_mstate_global->__pyx_codeobj_tab[2])) goto bad; + } + { + const __Pyx_PyCode_New_function_description descr = {3, 0, 0, 3, (unsigned int)(CO_OPTIMIZED|CO_NEWLOCALS), 55}; + PyObject* const varnames[] = {__pyx_mstate->__pyx_n_u_self, __pyx_mstate->__pyx_n_u_head, __pyx_mstate->__pyx_n_u_idx}; + __pyx_mstate_global->__pyx_codeobj_tab[3] = __Pyx_PyCode_New(descr, varnames, __pyx_mstate->__pyx_kp_u_spacy_pipeline__parser_internals_2, __pyx_mstate->__pyx_n_u_L, __pyx_mstate->__pyx_kp_b_iso88591_A_t2Rq_a, tuple_dedup_map); if (unlikely(!__pyx_mstate_global->__pyx_codeobj_tab[3])) goto bad; + } + { + const __Pyx_PyCode_New_function_description descr = {3, 0, 0, 3, (unsigned int)(CO_OPTIMIZED|CO_NEWLOCALS), 58}; + PyObject* const varnames[] = {__pyx_mstate->__pyx_n_u_self, __pyx_mstate->__pyx_n_u_head, __pyx_mstate->__pyx_n_u_idx}; + __pyx_mstate_global->__pyx_codeobj_tab[4] = __Pyx_PyCode_New(descr, varnames, __pyx_mstate->__pyx_kp_u_spacy_pipeline__parser_internals_2, __pyx_mstate->__pyx_n_u_R, __pyx_mstate->__pyx_kp_b_iso88591_A_t2Rq_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), 69}; + 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_spacy_pipeline__parser_internals_2, __pyx_mstate->__pyx_n_u_is_final, __pyx_mstate->__pyx_kp_b_iso88591_A_t2Ya, tuple_dedup_map); if (unlikely(!__pyx_mstate_global->__pyx_codeobj_tab[5])) goto bad; + } + { + const __Pyx_PyCode_New_function_description descr = {1, 0, 0, 2, (unsigned int)(CO_OPTIMIZED|CO_NEWLOCALS), 72}; + PyObject* const varnames[] = {__pyx_mstate->__pyx_n_u_self, __pyx_mstate->__pyx_n_u_new_state}; + __pyx_mstate_global->__pyx_codeobj_tab[6] = __Pyx_PyCode_New(descr, varnames, __pyx_mstate->__pyx_kp_u_spacy_pipeline__parser_internals_2, __pyx_mstate->__pyx_n_u_copy, __pyx_mstate->__pyx_kp_b_iso88591_A_Jat4vWD_6_a_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, 12, (unsigned int)(CO_OPTIMIZED|CO_NEWLOCALS), 77}; + PyObject* const varnames[] = {__pyx_mstate->__pyx_n_u_self, __pyx_mstate->__pyx_n_u_words, __pyx_mstate->__pyx_n_u_bools, __pyx_mstate->__pyx_n_u_sent_starts, __pyx_mstate->__pyx_n_u_shifted, __pyx_mstate->__pyx_n_u_top, __pyx_mstate->__pyx_n_u_second, __pyx_mstate->__pyx_n_u_third, __pyx_mstate->__pyx_n_u_n0, __pyx_mstate->__pyx_n_u_n1, __pyx_mstate->__pyx_n_u_token, __pyx_mstate->__pyx_n_u_i}; + __pyx_mstate_global->__pyx_codeobj_tab[7] = __Pyx_PyCode_New(descr, varnames, __pyx_mstate->__pyx_kp_u_spacy_pipeline__parser_internals_2, __pyx_mstate->__pyx_n_u_print_state, __pyx_mstate->__pyx_kp_b_iso88591_A_fD_Q_AWBaq_a_auAT_d_uAS_Q_5_Bo, tuple_dedup_map); if (unlikely(!__pyx_mstate_global->__pyx_codeobj_tab[7])) goto bad; + } + { + const __Pyx_PyCode_New_function_description descr = {2, 0, 0, 2, (unsigned int)(CO_OPTIMIZED|CO_NEWLOCALS), 92}; + PyObject* const varnames[] = {__pyx_mstate->__pyx_n_u_self, __pyx_mstate->__pyx_n_u_i}; + __pyx_mstate_global->__pyx_codeobj_tab[8] = __Pyx_PyCode_New(descr, varnames, __pyx_mstate->__pyx_kp_u_spacy_pipeline__parser_internals_2, __pyx_mstate->__pyx_n_u_S, __pyx_mstate->__pyx_kp_b_iso88591_A_t2Rq, tuple_dedup_map); if (unlikely(!__pyx_mstate_global->__pyx_codeobj_tab[8])) goto bad; + } + { + const __Pyx_PyCode_New_function_description descr = {2, 0, 0, 2, (unsigned int)(CO_OPTIMIZED|CO_NEWLOCALS), 95}; + PyObject* const varnames[] = {__pyx_mstate->__pyx_n_u_self, __pyx_mstate->__pyx_n_u_i}; + __pyx_mstate_global->__pyx_codeobj_tab[9] = __Pyx_PyCode_New(descr, varnames, __pyx_mstate->__pyx_kp_u_spacy_pipeline__parser_internals_2, __pyx_mstate->__pyx_n_u_B, __pyx_mstate->__pyx_kp_b_iso88591_A_t2Rq, 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), 98}; + PyObject* const varnames[] = {__pyx_mstate->__pyx_n_u_self, __pyx_mstate->__pyx_n_u_i}; + __pyx_mstate_global->__pyx_codeobj_tab[10] = __Pyx_PyCode_New(descr, varnames, __pyx_mstate->__pyx_kp_u_spacy_pipeline__parser_internals_2, __pyx_mstate->__pyx_n_u_H, __pyx_mstate->__pyx_kp_b_iso88591_A_t2Rq, tuple_dedup_map); if (unlikely(!__pyx_mstate_global->__pyx_codeobj_tab[10])) goto bad; + } + { + const __Pyx_PyCode_New_function_description descr = {2, 0, 0, 2, (unsigned int)(CO_OPTIMIZED|CO_NEWLOCALS), 101}; + PyObject* const varnames[] = {__pyx_mstate->__pyx_n_u_self, __pyx_mstate->__pyx_n_u_i}; + __pyx_mstate_global->__pyx_codeobj_tab[11] = __Pyx_PyCode_New(descr, varnames, __pyx_mstate->__pyx_kp_u_spacy_pipeline__parser_internals_2, __pyx_mstate->__pyx_n_u_E, __pyx_mstate->__pyx_kp_b_iso88591_A_t2Rq, 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), 104}; + PyObject* const varnames[] = {__pyx_mstate->__pyx_n_u_self, __pyx_mstate->__pyx_n_u_i, __pyx_mstate->__pyx_n_u_idx}; + __pyx_mstate_global->__pyx_codeobj_tab[12] = __Pyx_PyCode_New(descr, varnames, __pyx_mstate->__pyx_kp_u_spacy_pipeline__parser_internals_2, __pyx_mstate->__pyx_n_u_L, __pyx_mstate->__pyx_kp_b_iso88591_A_t2Rq_1, 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), 107}; + PyObject* const varnames[] = {__pyx_mstate->__pyx_n_u_self, __pyx_mstate->__pyx_n_u_i, __pyx_mstate->__pyx_n_u_idx}; + __pyx_mstate_global->__pyx_codeobj_tab[13] = __Pyx_PyCode_New(descr, varnames, __pyx_mstate->__pyx_kp_u_spacy_pipeline__parser_internals_2, __pyx_mstate->__pyx_n_u_R, __pyx_mstate->__pyx_kp_b_iso88591_A_t2Rq_1, 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), 110}; + PyObject* const varnames[] = {__pyx_mstate->__pyx_n_u_self, __pyx_mstate->__pyx_n_u_i}; + __pyx_mstate_global->__pyx_codeobj_tab[14] = __Pyx_PyCode_New(descr, varnames, __pyx_mstate->__pyx_kp_u_spacy_pipeline__parser_internals_2, __pyx_mstate->__pyx_n_u_S_2, __pyx_mstate->__pyx_kp_b_iso88591_A_t4q_Bb, tuple_dedup_map); if (unlikely(!__pyx_mstate_global->__pyx_codeobj_tab[14])) goto bad; + } + { + const __Pyx_PyCode_New_function_description descr = {2, 0, 0, 2, (unsigned int)(CO_OPTIMIZED|CO_NEWLOCALS), 113}; + PyObject* const varnames[] = {__pyx_mstate->__pyx_n_u_self, __pyx_mstate->__pyx_n_u_i}; + __pyx_mstate_global->__pyx_codeobj_tab[15] = __Pyx_PyCode_New(descr, varnames, __pyx_mstate->__pyx_kp_u_spacy_pipeline__parser_internals_2, __pyx_mstate->__pyx_n_u_B_2, __pyx_mstate->__pyx_kp_b_iso88591_A_t4q_Bb, tuple_dedup_map); if (unlikely(!__pyx_mstate_global->__pyx_codeobj_tab[15])) goto bad; + } + { + const __Pyx_PyCode_New_function_description descr = {2, 0, 0, 2, (unsigned int)(CO_OPTIMIZED|CO_NEWLOCALS), 116}; + PyObject* const varnames[] = {__pyx_mstate->__pyx_n_u_self, __pyx_mstate->__pyx_n_u_i}; + __pyx_mstate_global->__pyx_codeobj_tab[16] = __Pyx_PyCode_New(descr, varnames, __pyx_mstate->__pyx_kp_u_spacy_pipeline__parser_internals_2, __pyx_mstate->__pyx_n_u_H_2, __pyx_mstate->__pyx_kp_b_iso88591_A_t4q_Bb, 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), 119}; + PyObject* const varnames[] = {__pyx_mstate->__pyx_n_u_self, __pyx_mstate->__pyx_n_u_i}; + __pyx_mstate_global->__pyx_codeobj_tab[17] = __Pyx_PyCode_New(descr, varnames, __pyx_mstate->__pyx_kp_u_spacy_pipeline__parser_internals_2, __pyx_mstate->__pyx_n_u_E_2, __pyx_mstate->__pyx_kp_b_iso88591_A_t4q_Bb, tuple_dedup_map); if (unlikely(!__pyx_mstate_global->__pyx_codeobj_tab[17])) goto bad; + } + { + const __Pyx_PyCode_New_function_description descr = {3, 0, 0, 3, (unsigned int)(CO_OPTIMIZED|CO_NEWLOCALS), 122}; + PyObject* const varnames[] = {__pyx_mstate->__pyx_n_u_self, __pyx_mstate->__pyx_n_u_i, __pyx_mstate->__pyx_n_u_idx}; + __pyx_mstate_global->__pyx_codeobj_tab[18] = __Pyx_PyCode_New(descr, varnames, __pyx_mstate->__pyx_kp_u_spacy_pipeline__parser_internals_2, __pyx_mstate->__pyx_n_u_L_2, __pyx_mstate->__pyx_kp_b_iso88591_A_t4q_Bb_A, tuple_dedup_map); if (unlikely(!__pyx_mstate_global->__pyx_codeobj_tab[18])) goto bad; + } + { + const __Pyx_PyCode_New_function_description descr = {3, 0, 0, 3, (unsigned int)(CO_OPTIMIZED|CO_NEWLOCALS), 125}; + PyObject* const varnames[] = {__pyx_mstate->__pyx_n_u_self, __pyx_mstate->__pyx_n_u_i, __pyx_mstate->__pyx_n_u_idx}; + __pyx_mstate_global->__pyx_codeobj_tab[19] = __Pyx_PyCode_New(descr, varnames, __pyx_mstate->__pyx_kp_u_spacy_pipeline__parser_internals_2, __pyx_mstate->__pyx_n_u_R_2, __pyx_mstate->__pyx_kp_b_iso88591_A_t4q_Bb_A, tuple_dedup_map); if (unlikely(!__pyx_mstate_global->__pyx_codeobj_tab[19])) goto bad; + } + { + const __Pyx_PyCode_New_function_description descr = {1, 0, 0, 1, (unsigned int)(CO_OPTIMIZED|CO_NEWLOCALS), 128}; + PyObject* const varnames[] = {__pyx_mstate->__pyx_n_u_self}; + __pyx_mstate_global->__pyx_codeobj_tab[20] = __Pyx_PyCode_New(descr, varnames, __pyx_mstate->__pyx_kp_u_spacy_pipeline__parser_internals_2, __pyx_mstate->__pyx_n_u_empty, __pyx_mstate->__pyx_kp_b_iso88591_A_t2V1, tuple_dedup_map); if (unlikely(!__pyx_mstate_global->__pyx_codeobj_tab[20])) goto bad; + } + { + const __Pyx_PyCode_New_function_description descr = {1, 0, 0, 1, (unsigned int)(CO_OPTIMIZED|CO_NEWLOCALS), 131}; + PyObject* const varnames[] = {__pyx_mstate->__pyx_n_u_self}; + __pyx_mstate_global->__pyx_codeobj_tab[21] = __Pyx_PyCode_New(descr, varnames, __pyx_mstate->__pyx_kp_u_spacy_pipeline__parser_internals_2, __pyx_mstate->__pyx_n_u_eol, __pyx_mstate->__pyx_kp_b_iso88591_A_t2T, tuple_dedup_map); if (unlikely(!__pyx_mstate_global->__pyx_codeobj_tab[21])) 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[22] = __Pyx_PyCode_New(descr, varnames, __pyx_mstate->__pyx_kp_u_spacy_pipeline__parser_internals_2, __pyx_mstate->__pyx_n_u_at_break, __pyx_mstate->__pyx_kp_b_iso88591_A_q, 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), 138}; + PyObject* const varnames[] = {__pyx_mstate->__pyx_n_u_self, __pyx_mstate->__pyx_n_u_i}; + __pyx_mstate_global->__pyx_codeobj_tab[23] = __Pyx_PyCode_New(descr, varnames, __pyx_mstate->__pyx_kp_u_spacy_pipeline__parser_internals_2, __pyx_mstate->__pyx_n_u_has_head, __pyx_mstate->__pyx_kp_b_iso88591_A_t2Yaq, 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), 141}; + PyObject* const varnames[] = {__pyx_mstate->__pyx_n_u_self, __pyx_mstate->__pyx_n_u_i}; + __pyx_mstate_global->__pyx_codeobj_tab[24] = __Pyx_PyCode_New(descr, varnames, __pyx_mstate->__pyx_kp_u_spacy_pipeline__parser_internals_2, __pyx_mstate->__pyx_n_u_n_L, __pyx_mstate->__pyx_kp_b_iso88591_A_t2T_2, tuple_dedup_map); if (unlikely(!__pyx_mstate_global->__pyx_codeobj_tab[24])) goto bad; + } + { + const __Pyx_PyCode_New_function_description descr = {2, 0, 0, 2, (unsigned int)(CO_OPTIMIZED|CO_NEWLOCALS), 144}; + PyObject* const varnames[] = {__pyx_mstate->__pyx_n_u_self, __pyx_mstate->__pyx_n_u_i}; + __pyx_mstate_global->__pyx_codeobj_tab[25] = __Pyx_PyCode_New(descr, varnames, __pyx_mstate->__pyx_kp_u_spacy_pipeline__parser_internals_2, __pyx_mstate->__pyx_n_u_n_R, __pyx_mstate->__pyx_kp_b_iso88591_A_t2T_2, tuple_dedup_map); if (unlikely(!__pyx_mstate_global->__pyx_codeobj_tab[25])) goto bad; + } + { + const __Pyx_PyCode_New_function_description descr = {1, 0, 0, 1, (unsigned int)(CO_OPTIMIZED|CO_NEWLOCALS), 147}; + PyObject* const varnames[] = {__pyx_mstate->__pyx_n_u_self}; + __pyx_mstate_global->__pyx_codeobj_tab[26] = __Pyx_PyCode_New(descr, varnames, __pyx_mstate->__pyx_kp_u_spacy_pipeline__parser_internals_2, __pyx_mstate->__pyx_n_u_entity_is_open, __pyx_mstate->__pyx_kp_b_iso88591_A_t2_A, tuple_dedup_map); if (unlikely(!__pyx_mstate_global->__pyx_codeobj_tab[26])) goto bad; + } + { + const __Pyx_PyCode_New_function_description descr = {1, 0, 0, 1, (unsigned int)(CO_OPTIMIZED|CO_NEWLOCALS), 150}; + PyObject* const varnames[] = {__pyx_mstate->__pyx_n_u_self}; + __pyx_mstate_global->__pyx_codeobj_tab[27] = __Pyx_PyCode_New(descr, varnames, __pyx_mstate->__pyx_kp_u_spacy_pipeline__parser_internals_2, __pyx_mstate->__pyx_n_u_stack_depth, __pyx_mstate->__pyx_kp_b_iso88591_A_t2, tuple_dedup_map); if (unlikely(!__pyx_mstate_global->__pyx_codeobj_tab[27])) goto bad; + } + { + const __Pyx_PyCode_New_function_description descr = {1, 0, 0, 1, (unsigned int)(CO_OPTIMIZED|CO_NEWLOCALS), 153}; + PyObject* const varnames[] = {__pyx_mstate->__pyx_n_u_self}; + __pyx_mstate_global->__pyx_codeobj_tab[28] = __Pyx_PyCode_New(descr, varnames, __pyx_mstate->__pyx_kp_u_spacy_pipeline__parser_internals_2, __pyx_mstate->__pyx_n_u_buffer_length, __pyx_mstate->__pyx_kp_b_iso88591_A_t2_1, tuple_dedup_map); if (unlikely(!__pyx_mstate_global->__pyx_codeobj_tab[28])) goto bad; + } + { + const __Pyx_PyCode_New_function_description descr = {1, 0, 0, 1, (unsigned int)(CO_OPTIMIZED|CO_NEWLOCALS), 156}; + PyObject* const varnames[] = {__pyx_mstate->__pyx_n_u_self}; + __pyx_mstate_global->__pyx_codeobj_tab[29] = __Pyx_PyCode_New(descr, varnames, __pyx_mstate->__pyx_kp_u_spacy_pipeline__parser_internals_2, __pyx_mstate->__pyx_n_u_push, __pyx_mstate->__pyx_kp_b_iso88591_A_Be1, 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), 159}; + 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_spacy_pipeline__parser_internals_2, __pyx_mstate->__pyx_n_u_pop, __pyx_mstate->__pyx_kp_b_iso88591_A_Bd, tuple_dedup_map); if (unlikely(!__pyx_mstate_global->__pyx_codeobj_tab[30])) goto bad; + } + { + const __Pyx_PyCode_New_function_description descr = {1, 0, 0, 1, (unsigned int)(CO_OPTIMIZED|CO_NEWLOCALS), 162}; + PyObject* const varnames[] = {__pyx_mstate->__pyx_n_u_self}; + __pyx_mstate_global->__pyx_codeobj_tab[31] = __Pyx_PyCode_New(descr, varnames, __pyx_mstate->__pyx_kp_u_spacy_pipeline__parser_internals_2, __pyx_mstate->__pyx_n_u_unshift, __pyx_mstate->__pyx_kp_b_iso88591_A_Bha, tuple_dedup_map); if (unlikely(!__pyx_mstate_global->__pyx_codeobj_tab[31])) goto bad; + } + { + const __Pyx_PyCode_New_function_description descr = {4, 0, 0, 4, (unsigned int)(CO_OPTIMIZED|CO_NEWLOCALS), 165}; + PyObject* const varnames[] = {__pyx_mstate->__pyx_n_u_self, __pyx_mstate->__pyx_n_u_head, __pyx_mstate->__pyx_n_u_child, __pyx_mstate->__pyx_n_u_label}; + __pyx_mstate_global->__pyx_codeobj_tab[32] = __Pyx_PyCode_New(descr, varnames, __pyx_mstate->__pyx_kp_u_spacy_pipeline__parser_internals_2, __pyx_mstate->__pyx_n_u_add_arc, __pyx_mstate->__pyx_kp_b_iso88591_A_BhavWA, 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), 168}; + PyObject* const varnames[] = {__pyx_mstate->__pyx_n_u_self, __pyx_mstate->__pyx_n_u_head, __pyx_mstate->__pyx_n_u_child}; + __pyx_mstate_global->__pyx_codeobj_tab[33] = __Pyx_PyCode_New(descr, varnames, __pyx_mstate->__pyx_kp_u_spacy_pipeline__parser_internals_2, __pyx_mstate->__pyx_n_u_del_arc, __pyx_mstate->__pyx_kp_b_iso88591_A_BhavQ, tuple_dedup_map); if (unlikely(!__pyx_mstate_global->__pyx_codeobj_tab[33])) goto bad; + } + { + const __Pyx_PyCode_New_function_description descr = {2, 0, 0, 2, (unsigned int)(CO_OPTIMIZED|CO_NEWLOCALS), 171}; + PyObject* const varnames[] = {__pyx_mstate->__pyx_n_u_self, __pyx_mstate->__pyx_n_u_label}; + __pyx_mstate_global->__pyx_codeobj_tab[34] = __Pyx_PyCode_New(descr, varnames, __pyx_mstate->__pyx_kp_u_spacy_pipeline__parser_internals_2, __pyx_mstate->__pyx_n_u_open_ent, __pyx_mstate->__pyx_kp_b_iso88591_A_Biq, tuple_dedup_map); if (unlikely(!__pyx_mstate_global->__pyx_codeobj_tab[34])) goto bad; + } + { + const __Pyx_PyCode_New_function_description descr = {1, 0, 0, 1, (unsigned int)(CO_OPTIMIZED|CO_NEWLOCALS), 174}; + PyObject* const varnames[] = {__pyx_mstate->__pyx_n_u_self}; + __pyx_mstate_global->__pyx_codeobj_tab[35] = __Pyx_PyCode_New(descr, varnames, __pyx_mstate->__pyx_kp_u_spacy_pipeline__parser_internals_2, __pyx_mstate->__pyx_n_u_close_ent, __pyx_mstate->__pyx_kp_b_iso88591_A_Bj, tuple_dedup_map); if (unlikely(!__pyx_mstate_global->__pyx_codeobj_tab[35])) goto bad; + } + { + const __Pyx_PyCode_New_function_description descr = {2, 0, 0, 2, (unsigned int)(CO_OPTIMIZED|CO_NEWLOCALS), 177}; + PyObject* const varnames[] = {__pyx_mstate->__pyx_n_u_self, __pyx_mstate->__pyx_n_u_src}; + __pyx_mstate_global->__pyx_codeobj_tab[36] = __Pyx_PyCode_New(descr, varnames, __pyx_mstate->__pyx_kp_u_spacy_pipeline__parser_internals_2, __pyx_mstate->__pyx_n_u_clone, __pyx_mstate->__pyx_kp_b_iso88591_A_BfAS, 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), 1}; + 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_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[37])) 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[38] = __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[38])) 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) + + /* AssertionsEnabled.init */ + if (likely(__Pyx_init_assertions_enabled() == 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++) { + if (unlikely(__Pyx_PyTuple_SET_ITEM(res, i, src[i]) < (0))) { + Py_DECREF(res); + return NULL; + } + Py_INCREF(src[i]); + } + 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; +} + +/* 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 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; +} + +/* 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; +} + +/* 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 + +/* RaiseUnexpectedTypeError */ +static int +__Pyx_RaiseUnexpectedTypeError(const char *expected, PyObject *obj) +{ + __Pyx_TypeName obj_type_name = __Pyx_PyType_GetFullyQualifiedName(Py_TYPE(obj)); + PyErr_Format(PyExc_TypeError, "Expected %s, got " __Pyx_FMT_TYPENAME, + expected, obj_type_name); + __Pyx_DECREF_TypeName(obj_type_name); + return 0; +} + +/* 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); +} + +/* CIntToPyUnicode */ +static CYTHON_INLINE PyObject* __Pyx_uchar___Pyx_PyUnicode_From_Py_ssize_t(Py_ssize_t value, Py_ssize_t width, char padding_char) { +#ifdef __Pyx_HAS_GCC_DIAGNOSTIC +#pragma GCC diagnostic push +#pragma GCC diagnostic ignored "-Wconversion" +#endif + const Py_ssize_t neg_one = (Py_ssize_t) -1, const_zero = (Py_ssize_t) 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 & ~ (Py_ssize_t) 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_Py_ssize_t(Py_ssize_t value, Py_ssize_t width, char padding_char, char format_char) { + char digits[sizeof(Py_ssize_t)*3+2]; + char *dpos, *end = digits + sizeof(Py_ssize_t)*3+2; + const char *hex_digits = DIGITS_HEX; + Py_ssize_t length, ulength; + int prepend_sign, last_one_off; + Py_ssize_t remaining; +#ifdef __Pyx_HAS_GCC_DIAGNOSTIC +#pragma GCC diagnostic push +#pragma GCC diagnostic ignored "-Wconversion" +#endif + const Py_ssize_t neg_one = (Py_ssize_t) -1, const_zero = (Py_ssize_t) 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 = (Py_ssize_t) (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 = (Py_ssize_t) (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 = (Py_ssize_t) (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 +} + +/* GetAttr */ +static CYTHON_INLINE PyObject *__Pyx_GetAttr(PyObject *o, PyObject *n) { +#if CYTHON_USE_TYPE_SLOTS + if (likely(PyUnicode_Check(n))) + return __Pyx_PyObject_GetAttrStr(o, n); +#endif + return PyObject_GetAttr(o, n); +} + +/* GetItemInt */ +static PyObject *__Pyx_GetItemInt_Generic(PyObject *o, PyObject* j) { + PyObject *r; + if (unlikely(!j)) return NULL; + r = PyObject_GetItem(o, j); + Py_DECREF(j); + return r; +} +static CYTHON_INLINE PyObject *__Pyx_GetItemInt_List_Fast(PyObject *o, Py_ssize_t i, + int wraparound, int boundscheck, int unsafe_shared) { + CYTHON_MAYBE_UNUSED_VAR(unsafe_shared); +#if CYTHON_ASSUME_SAFE_SIZE + Py_ssize_t wrapped_i = i; + if (wraparound & unlikely(i < 0)) { + wrapped_i += PyList_GET_SIZE(o); + } + if ((CYTHON_AVOID_BORROWED_REFS || CYTHON_AVOID_THREAD_UNSAFE_BORROWED_REFS || !CYTHON_ASSUME_SAFE_MACROS)) { + return __Pyx_PyList_GetItemRefFast(o, wrapped_i, unsafe_shared); + } else + if ((!boundscheck) || likely(__Pyx_is_valid_index(wrapped_i, PyList_GET_SIZE(o)))) { + return __Pyx_NewRef(PyList_GET_ITEM(o, wrapped_i)); + } + return __Pyx_GetItemInt_Generic(o, PyLong_FromSsize_t(i)); +#else + (void)wraparound; + (void)boundscheck; + return PySequence_GetItem(o, i); +#endif +} +static CYTHON_INLINE PyObject *__Pyx_GetItemInt_Tuple_Fast(PyObject *o, Py_ssize_t i, + int wraparound, int boundscheck, int unsafe_shared) { + CYTHON_MAYBE_UNUSED_VAR(unsafe_shared); +#if CYTHON_ASSUME_SAFE_SIZE && CYTHON_ASSUME_SAFE_MACROS && !CYTHON_AVOID_BORROWED_REFS + Py_ssize_t wrapped_i = i; + if (wraparound & unlikely(i < 0)) { + wrapped_i += PyTuple_GET_SIZE(o); + } + if ((!boundscheck) || likely(__Pyx_is_valid_index(wrapped_i, PyTuple_GET_SIZE(o)))) { + return __Pyx_NewRef(PyTuple_GET_ITEM(o, wrapped_i)); + } + return __Pyx_GetItemInt_Generic(o, PyLong_FromSsize_t(i)); +#else + (void)wraparound; + (void)boundscheck; + return PySequence_GetItem(o, i); +#endif +} +static CYTHON_INLINE PyObject *__Pyx_GetItemInt_Fast(PyObject *o, Py_ssize_t i, int is_list, + int wraparound, int boundscheck, int unsafe_shared) { + CYTHON_MAYBE_UNUSED_VAR(unsafe_shared); +#if CYTHON_ASSUME_SAFE_MACROS && CYTHON_ASSUME_SAFE_SIZE + if (is_list || PyList_CheckExact(o)) { + Py_ssize_t n = ((!wraparound) | likely(i >= 0)) ? i : i + PyList_GET_SIZE(o); + if ((CYTHON_AVOID_BORROWED_REFS || CYTHON_AVOID_THREAD_UNSAFE_BORROWED_REFS)) { + return __Pyx_PyList_GetItemRefFast(o, n, unsafe_shared); + } else if ((!boundscheck) || (likely(__Pyx_is_valid_index(n, PyList_GET_SIZE(o))))) { + return __Pyx_NewRef(PyList_GET_ITEM(o, n)); + } + } else + #if !CYTHON_AVOID_BORROWED_REFS + if (PyTuple_CheckExact(o)) { + Py_ssize_t n = ((!wraparound) | likely(i >= 0)) ? i : i + PyTuple_GET_SIZE(o); + if ((!boundscheck) || likely(__Pyx_is_valid_index(n, PyTuple_GET_SIZE(o)))) { + return __Pyx_NewRef(PyTuple_GET_ITEM(o, n)); + } + } else + #endif +#endif +#if CYTHON_USE_TYPE_SLOTS && !CYTHON_COMPILING_IN_PYPY + { + PyMappingMethods *mm = Py_TYPE(o)->tp_as_mapping; + PySequenceMethods *sm = Py_TYPE(o)->tp_as_sequence; + if (!is_list && mm && mm->mp_subscript) { + PyObject *r, *key = PyLong_FromSsize_t(i); + if (unlikely(!key)) return NULL; + r = mm->mp_subscript(o, key); + Py_DECREF(key); + return r; + } + if (is_list || likely(sm && sm->sq_item)) { + if (wraparound && unlikely(i < 0) && likely(sm->sq_length)) { + Py_ssize_t l = sm->sq_length(o); + if (likely(l >= 0)) { + i += l; + } else { + if (!PyErr_ExceptionMatches(PyExc_OverflowError)) + return NULL; + PyErr_Clear(); + } + } + return sm->sq_item(o, i); + } + } +#else + if (is_list || !PyMapping_Check(o)) { + return PySequence_GetItem(o, i); + } +#endif + (void)wraparound; + (void)boundscheck; + return __Pyx_GetItemInt_Generic(o, PyLong_FromSsize_t(i)); +} + +/* ObjectGetItem */ +#if CYTHON_USE_TYPE_SLOTS +static PyObject *__Pyx_PyObject_GetIndex(PyObject *obj, PyObject *index) { + PyObject *runerr = NULL; + Py_ssize_t key_value; + key_value = __Pyx_PyIndex_AsSsize_t(index); + if (likely(key_value != -1 || !(runerr = PyErr_Occurred()))) { + return __Pyx_GetItemInt_Fast(obj, key_value, 0, 1, 1, 1); + } + if (PyErr_GivenExceptionMatches(runerr, PyExc_OverflowError)) { + __Pyx_TypeName index_type_name = __Pyx_PyType_GetFullyQualifiedName(Py_TYPE(index)); + PyErr_Clear(); + PyErr_Format(PyExc_IndexError, + "cannot fit '" __Pyx_FMT_TYPENAME "' into an index-sized integer", index_type_name); + __Pyx_DECREF_TypeName(index_type_name); + } + return NULL; +} +static PyObject *__Pyx_PyObject_GetItem_Slow(PyObject *obj, PyObject *key) { + __Pyx_TypeName obj_type_name; + if (likely(PyType_Check(obj))) { + PyObject *meth = __Pyx_PyObject_GetAttrStrNoError(obj, __pyx_mstate_global->__pyx_n_u_class_getitem); + if (!meth) { + PyErr_Clear(); + } else { + PyObject *result = __Pyx_PyObject_CallOneArg(meth, key); + Py_DECREF(meth); + return result; + } + } + obj_type_name = __Pyx_PyType_GetFullyQualifiedName(Py_TYPE(obj)); + PyErr_Format(PyExc_TypeError, + "'" __Pyx_FMT_TYPENAME "' object is not subscriptable", obj_type_name); + __Pyx_DECREF_TypeName(obj_type_name); + return NULL; +} +static PyObject *__Pyx_PyObject_GetItem(PyObject *obj, PyObject *key) { + PyTypeObject *tp = Py_TYPE(obj); + PyMappingMethods *mm = tp->tp_as_mapping; + PySequenceMethods *sm = tp->tp_as_sequence; + if (likely(mm && mm->mp_subscript)) { + return mm->mp_subscript(obj, key); + } + if (likely(sm && sm->sq_item)) { + return __Pyx_PyObject_GetIndex(obj, key); + } + return __Pyx_PyObject_GetItem_Slow(obj, key); +} +#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); + } +} + +/* DivInt[Py_ssize_t] */ +static CYTHON_INLINE Py_ssize_t __Pyx_div_Py_ssize_t(Py_ssize_t a, Py_ssize_t b, int b_is_constant) { + Py_ssize_t q = a / b; + Py_ssize_t r = a - q*b; + Py_ssize_t adapt_python = (b_is_constant ? + ((r != 0) & ((r < 0) ^ (b < 0))) : + ((r != 0) & ((r ^ b) < 0)) + ); + return q - adapt_python; +} + +/* GetAttr3 */ +#if __PYX_LIMITED_VERSION_HEX < 0x030d0000 +static PyObject *__Pyx_GetAttr3Default(PyObject *d) { + __Pyx_PyThreadState_declare + __Pyx_PyThreadState_assign + if (unlikely(!__Pyx_PyErr_ExceptionMatches(PyExc_AttributeError))) + return NULL; + __Pyx_PyErr_Clear(); + Py_INCREF(d); + return d; +} +#endif +static CYTHON_INLINE PyObject *__Pyx_GetAttr3(PyObject *o, PyObject *n, PyObject *d) { + PyObject *r; +#if __PYX_LIMITED_VERSION_HEX >= 0x030d0000 + int res = PyObject_GetOptionalAttr(o, n, &r); + return (res != 0) ? r : __Pyx_NewRef(d); +#else + #if CYTHON_USE_TYPE_SLOTS + if (likely(PyUnicode_Check(n))) { + r = __Pyx_PyObject_GetAttrStrNoError(o, n); + if (unlikely(!r) && likely(!PyErr_Occurred())) { + r = __Pyx_NewRef(d); + } + return r; + } + #endif + r = PyObject_GetAttr(o, n); + return (likely(r)) ? r : __Pyx_GetAttr3Default(d); +#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); +} + +/* RaiseTooManyValuesToUnpack */ +static CYTHON_INLINE void __Pyx_RaiseTooManyValuesError(Py_ssize_t expected) { + PyErr_Format(PyExc_ValueError, + "too many values to unpack (expected %" CYTHON_FORMAT_SSIZE_T "d)", expected); +} + +/* RaiseNeedMoreValuesToUnpack */ +static CYTHON_INLINE void __Pyx_RaiseNeedMoreValuesError(Py_ssize_t index) { + PyErr_Format(PyExc_ValueError, + "need more than %" CYTHON_FORMAT_SSIZE_T "d value%.1s to unpack", + index, (index == 1) ? "" : "s"); +} + +/* RaiseNoneIterError */ +static CYTHON_INLINE void __Pyx_RaiseNoneNotIterableError(void) { + PyErr_SetString(PyExc_TypeError, "'NoneType' object is not iterable"); +} + +/* ExtTypeTest */ +static CYTHON_INLINE int __Pyx_TypeTest(PyObject *obj, PyTypeObject *type) { + __Pyx_TypeName obj_type_name; + __Pyx_TypeName type_name; + if (unlikely(!type)) { + PyErr_SetString(PyExc_SystemError, "Missing type object"); + return 0; + } + if (likely(__Pyx_TypeCheck(obj, type))) + return 1; + obj_type_name = __Pyx_PyType_GetFullyQualifiedName(Py_TYPE(obj)); + type_name = __Pyx_PyType_GetFullyQualifiedName(type); + PyErr_Format(PyExc_TypeError, + "Cannot convert " __Pyx_FMT_TYPENAME " to " __Pyx_FMT_TYPENAME, + obj_type_name, type_name); + __Pyx_DECREF_TypeName(obj_type_name); + __Pyx_DECREF_TypeName(type_name); + return 0; +} + +/* 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 + +/* 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); +} + +/* 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; itp_as_sequence && type->tp_as_sequence->sq_repeat)) { + return type->tp_as_sequence->sq_repeat(seq, mul); + } else +#endif + { + return __Pyx_PySequence_Multiply_Generic(seq, mul); + } +} + +/* PyObjectFormatAndDecref */ +static CYTHON_INLINE PyObject* __Pyx_PyObject_FormatSimpleAndDecref(PyObject* s, PyObject* f) { + if (unlikely(!s)) return NULL; + if (likely(PyUnicode_CheckExact(s))) return s; + return __Pyx_PyObject_FormatAndDecref(s, f); +} +static CYTHON_INLINE PyObject* __Pyx_PyObject_FormatAndDecref(PyObject* s, PyObject* f) { + PyObject *result; + if (unlikely(!s)) return NULL; + result = PyObject_Format(s, f); + Py_DECREF(s); + return result; +} + +/* PyObjectFormat */ +#if CYTHON_USE_UNICODE_WRITER +static PyObject* __Pyx_PyObject_Format(PyObject* obj, PyObject* format_spec) { + int ret; + _PyUnicodeWriter writer; + if (likely(PyFloat_CheckExact(obj))) { + _PyUnicodeWriter_Init(&writer); + ret = _PyFloat_FormatAdvancedWriter( + &writer, + obj, + format_spec, 0, PyUnicode_GET_LENGTH(format_spec)); + } else if (likely(PyLong_CheckExact(obj))) { + _PyUnicodeWriter_Init(&writer); + ret = _PyLong_FormatAdvancedWriter( + &writer, + obj, + format_spec, 0, PyUnicode_GET_LENGTH(format_spec)); + } else { + return PyObject_Format(obj, format_spec); + } + if (unlikely(ret == -1)) { + _PyUnicodeWriter_Dealloc(&writer); + return NULL; + } + return _PyUnicodeWriter_Finish(&writer); +} +#endif + +/* SetItemInt */ +static int __Pyx_SetItemInt_Generic(PyObject *o, PyObject *j, PyObject *v) { + int r; + if (unlikely(!j)) return -1; + r = PyObject_SetItem(o, j, v); + Py_DECREF(j); + return r; +} +static CYTHON_INLINE int __Pyx_SetItemInt_Fast(PyObject *o, Py_ssize_t i, PyObject *v, int is_list, + int wraparound, int boundscheck, int unsafe_shared) { + CYTHON_MAYBE_UNUSED_VAR(unsafe_shared); +#if CYTHON_ASSUME_SAFE_MACROS && CYTHON_ASSUME_SAFE_SIZE && !CYTHON_AVOID_BORROWED_REFS + if (is_list || PyList_CheckExact(o)) { + Py_ssize_t n = (!wraparound) ? i : ((likely(i >= 0)) ? i : i + PyList_GET_SIZE(o)); + if ((CYTHON_AVOID_THREAD_UNSAFE_BORROWED_REFS && !__Pyx_IS_UNIQUELY_REFERENCED(o, unsafe_shared))) { + Py_INCREF(v); + return PyList_SetItem(o, n, v); + } else if ((!boundscheck) || likely(__Pyx_is_valid_index(n, PyList_GET_SIZE(o)))) { + PyObject* old; + Py_INCREF(v); + old = PyList_GET_ITEM(o, n); + PyList_SET_ITEM(o, n, v); + Py_DECREF(old); + return 0; + } + } else +#endif +#if CYTHON_USE_TYPE_SLOTS && !CYTHON_COMPILING_IN_PYPY + { + PyMappingMethods *mm = Py_TYPE(o)->tp_as_mapping; + PySequenceMethods *sm = Py_TYPE(o)->tp_as_sequence; + if (!is_list && mm && mm->mp_ass_subscript) { + int r; + PyObject *key = PyLong_FromSsize_t(i); + if (unlikely(!key)) return -1; + r = mm->mp_ass_subscript(o, key, v); + Py_DECREF(key); + return r; + } + if (is_list || likely(sm && sm->sq_ass_item)) { + if (wraparound && unlikely(i < 0) && likely(sm->sq_length)) { + Py_ssize_t l = sm->sq_length(o); + if (likely(l >= 0)) { + i += l; + } else { + if (!PyErr_ExceptionMatches(PyExc_OverflowError)) + return -1; + PyErr_Clear(); + } + } + return sm->sq_ass_item(o, i, v); + } + } +#else + if (is_list || !PyMapping_Check(o)) { + return PySequence_SetItem(o, i, v); + } +#endif + (void)wraparound; + (void)boundscheck; + return __Pyx_SetItemInt_Generic(o, PyLong_FromSsize_t(i), v); +} + +/* RaiseUnboundLocalError */ +static void __Pyx_RaiseUnboundLocalError(const char *varname) { + PyErr_Format(PyExc_UnboundLocalError, "local variable '%s' referenced before assignment", varname); +} + +/* DivInt[long] */ +static CYTHON_INLINE long __Pyx_div_long(long a, long b, int b_is_constant) { + long q = a / b; + long r = a - q*b; + long adapt_python = (b_is_constant ? + ((r != 0) & ((r < 0) ^ (b < 0))) : + ((r != 0) & ((r ^ b) < 0)) + ); + return q - adapt_python; +} + +/* tp_new */ +#if CYTHON_COMPILING_IN_LIMITED_API && __PYX_LIMITED_VERSION_HEX < 0x030A0000 +static PyObject* __Pyx_tp_new_fallback(PyObject* type_obj, PyObject* args, PyObject* kwargs) { + PyObject *new_func = NULL, *new_args = NULL, *obj; + Py_ssize_t i, nargs = PyTuple_Size(args); + if (unlikely(nargs < 0)) goto bad; + new_args = PyTuple_New(nargs + 1); + if (unlikely(!new_args)) goto bad; + for (i = 0; i < nargs + 1; i++) { + PyObject *item = (i == 0) ? type_obj : PyTuple_GetItem(args, i - 1); + if (unlikely(!item)) goto bad; + Py_INCREF(item); + if (unlikely(PyTuple_SetItem(new_args, i, item)) < 0) goto bad; + } + new_func = PyObject_GetAttrString(type_obj, "__new__"); + if (unlikely(!new_func)) goto bad; + obj = PyObject_Call(new_func, new_args, kwargs); + Py_DECREF(new_func); + Py_DECREF(new_args); + return obj; + bad: + Py_XDECREF(new_func); + Py_XDECREF(new_args); + return NULL; +} +#endif +static PyObject* __Pyx_tp_new_kwargs(PyObject* type_obj, PyObject* args, PyObject* kwargs) { + newfunc tp_new = __Pyx_PyType_TryGetSlot((PyTypeObject*)type_obj, tp_new, newfunc); +#if CYTHON_COMPILING_IN_LIMITED_API && __PYX_LIMITED_VERSION_HEX < 0x030A0000 + if (!tp_new) return __Pyx_tp_new_fallback(type_obj, args, kwargs); +#else + assert(tp_new != NULL); +#endif + return tp_new((PyTypeObject*)type_obj, args, kwargs); +} + +/* 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); +} + +/* PyObjectVectorCallKwBuilder */ +#if CYTHON_VECTORCALL +static int __Pyx_VectorcallBuilder_AddArg(PyObject *key, PyObject *value, PyObject *builder, PyObject **args, int n) { + (void)__Pyx_PyObject_FastCallDict; + if (__Pyx_PyTuple_SET_ITEM(builder, n, key) != (0)) return -1; + Py_INCREF(key); + 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 + +/* 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; +} + +/* 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 +} + +/* SetVTable */ +static int __Pyx_SetVtable(PyTypeObject *type, void *vtable) { + PyObject *ob = PyCapsule_New(vtable, 0, 0); + if (unlikely(!ob)) + goto bad; +#if CYTHON_COMPILING_IN_LIMITED_API + if (unlikely(PyObject_SetAttr((PyObject *) type, __pyx_mstate_global->__pyx_n_u_pyx_vtable, ob) < 0)) +#else + if (unlikely(PyDict_SetItem(type->tp_dict, __pyx_mstate_global->__pyx_n_u_pyx_vtable, ob) < 0)) +#endif + goto bad; + Py_DECREF(ob); + return 0; +bad: + Py_XDECREF(ob); + return -1; +} + +/* GetVTable (used by MergeVTables) */ +static void* __Pyx_GetVtable(PyTypeObject *type) { + void* ptr; +#if CYTHON_COMPILING_IN_LIMITED_API + PyObject *ob = PyObject_GetAttr((PyObject *)type, __pyx_mstate_global->__pyx_n_u_pyx_vtable); +#else + PyObject *ob = PyObject_GetItem(type->tp_dict, __pyx_mstate_global->__pyx_n_u_pyx_vtable); +#endif + if (!ob) + goto bad; + ptr = PyCapsule_GetPointer(ob, 0); + if (!ptr && !PyErr_Occurred()) + PyErr_SetString(PyExc_RuntimeError, "invalid vtable found for imported type"); + Py_DECREF(ob); + return ptr; +bad: + Py_XDECREF(ob); + return NULL; +} + +/* MergeVTables */ +static int __Pyx_MergeVtables(PyTypeObject *type) { + int i=0; + Py_ssize_t size; + void** base_vtables; + __Pyx_TypeName tp_base_name = NULL; + __Pyx_TypeName base_name = NULL; + void* unknown = (void*)-1; + PyObject* bases = __Pyx_PyType_GetSlot(type, tp_bases, PyObject*); + int base_depth = 0; + { + PyTypeObject* base = __Pyx_PyType_GetSlot(type, tp_base, PyTypeObject*); + while (base) { + base_depth += 1; + base = __Pyx_PyType_GetSlot(base, tp_base, PyTypeObject*); + } + } + base_vtables = (void**) PyMem_Malloc(sizeof(void*) * (size_t)(base_depth + 1)); + base_vtables[0] = unknown; +#if CYTHON_COMPILING_IN_LIMITED_API + size = PyTuple_Size(bases); + if (size < 0) goto other_failure; +#else + size = PyTuple_GET_SIZE(bases); +#endif + for (i = 1; i < size; i++) { + PyObject *basei; + void* base_vtable; +#if CYTHON_AVOID_BORROWED_REFS + basei = PySequence_GetItem(bases, i); + if (unlikely(!basei)) goto other_failure; +#elif !CYTHON_ASSUME_SAFE_MACROS + basei = PyTuple_GetItem(bases, i); + if (unlikely(!basei)) goto other_failure; +#else + basei = PyTuple_GET_ITEM(bases, i); +#endif + base_vtable = __Pyx_GetVtable((PyTypeObject*)basei); +#if CYTHON_AVOID_BORROWED_REFS + Py_DECREF(basei); +#endif + if (base_vtable != NULL) { + int j; + PyTypeObject* base = __Pyx_PyType_GetSlot(type, tp_base, PyTypeObject*); + for (j = 0; j < base_depth; j++) { + if (base_vtables[j] == unknown) { + base_vtables[j] = __Pyx_GetVtable(base); + base_vtables[j + 1] = unknown; + } + if (base_vtables[j] == base_vtable) { + break; + } else if (base_vtables[j] == NULL) { + goto bad; + } + base = __Pyx_PyType_GetSlot(base, tp_base, PyTypeObject*); + } + } + } + PyErr_Clear(); + PyMem_Free(base_vtables); + return 0; +bad: + { + PyTypeObject* basei = NULL; + PyTypeObject* tp_base = __Pyx_PyType_GetSlot(type, tp_base, PyTypeObject*); + tp_base_name = __Pyx_PyType_GetFullyQualifiedName(tp_base); +#if CYTHON_AVOID_BORROWED_REFS + basei = (PyTypeObject*)PySequence_GetItem(bases, i); + if (unlikely(!basei)) goto really_bad; +#elif !CYTHON_ASSUME_SAFE_MACROS + basei = (PyTypeObject*)PyTuple_GetItem(bases, i); + if (unlikely(!basei)) goto really_bad; +#else + basei = (PyTypeObject*)PyTuple_GET_ITEM(bases, i); +#endif + base_name = __Pyx_PyType_GetFullyQualifiedName(basei); +#if CYTHON_AVOID_BORROWED_REFS + Py_DECREF(basei); +#endif + } + PyErr_Format(PyExc_TypeError, + "multiple bases have vtable conflict: '" __Pyx_FMT_TYPENAME "' and '" __Pyx_FMT_TYPENAME "'", tp_base_name, base_name); +#if CYTHON_AVOID_BORROWED_REFS || !CYTHON_ASSUME_SAFE_MACROS +really_bad: // bad has failed! +#endif + __Pyx_DECREF_TypeName(tp_base_name); + __Pyx_DECREF_TypeName(base_name); +#if CYTHON_COMPILING_IN_LIMITED_API || CYTHON_AVOID_BORROWED_REFS || !CYTHON_ASSUME_SAFE_MACROS +other_failure: +#endif + PyMem_Free(base_vtables); + return -1; +} + +/* 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_2); + if (likely(name_attr)) { + ret = PyObject_RichCompareBool(name_attr, name, Py_EQ); + } else { + ret = -1; + } + if (unlikely(ret < 0)) { + PyErr_Clear(); + ret = 0; + } + Py_XDECREF(name_attr); + return ret; +} +static int __Pyx_setup_reduce(PyObject* type_obj) { + int ret = 0; + PyObject *object_reduce = NULL; + PyObject *object_getstate = NULL; + PyObject *object_reduce_ex = NULL; + PyObject *reduce = NULL; + PyObject *reduce_ex = NULL; + PyObject *reduce_cython = NULL; + PyObject *setstate = NULL; + PyObject *setstate_cython = NULL; + PyObject *getstate = NULL; +#if CYTHON_USE_PYTYPE_LOOKUP + getstate = _PyType_Lookup((PyTypeObject*)type_obj, __pyx_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_1 +#define __PYX_HAVE_RT_ImportType_3_2_1 +static PyTypeObject *__Pyx_ImportType_3_2_1(PyObject *module, const char *module_name, const char *class_name, + size_t size, size_t alignment, enum __Pyx_ImportType_CheckSize_3_2_1 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_1 && + ((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_1 && (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 VoidPtrImport) */ +#ifndef __PYX_HAVE_RT_ImportFromPxd_3_2_1 +#define __PYX_HAVE_RT_ImportFromPxd_3_2_1 +static int __Pyx_ImportFromPxd_3_2_1(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 + +/* VoidPtrImport */ +#ifndef __PYX_HAVE_RT_ImportVoidPtr_3_2_1 +#define __PYX_HAVE_RT_ImportVoidPtr_3_2_1 +static int __Pyx_ImportVoidPtr_3_2_1(PyObject *module, const char *name, void **p, const char *sig) { + return __Pyx_ImportFromPxd_3_2_1(module, name, p, sig, "variable"); +} +#endif + +/* FunctionImport */ +#ifndef __PYX_HAVE_RT_ImportFunction_3_2_1 +#define __PYX_HAVE_RT_ImportFunction_3_2_1 +static int __Pyx_ImportFunction_3_2_1(PyObject *module, const char *funcname, void (**f)(void), const char *sig) { + union { + void (*fp)(void); + void *p; + } tmp; + int result = __Pyx_ImportFromPxd_3_2_1(module, funcname, &tmp.p, sig, "function"); + if (result == 0) { + *f = tmp.fp; + } + return result; +} +#endif + +/* dict_setdefault (used by FetchCommonType) */ +static CYTHON_INLINE PyObject *__Pyx_PyDict_SetDefault(PyObject *d, PyObject *key, PyObject *default_value) { + PyObject* value; +#if 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); +#elif PY_VERSION_HEX >= 0x030d0000 + PyDict_SetDefaultRef(d, key, default_value, &value); +#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_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(marker); + 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}, + {"_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 !CYTHON_COMPILING_IN_LIMITED_API +#if PY_VERSION_HEX < 0x030900B1 + Py_CLEAR(__Pyx_CyFunction_GetClassObj(m)); +#else + { + PyObject *cls = (PyObject*) ((PyCMethodObject *) (m))->mm_class; + ((PyCMethodObject *) (m))->mm_class = NULL; + Py_XDECREF(cls); + } +#endif +#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); +#if !CYTHON_COMPILING_IN_LIMITED_API + Py_VISIT(__Pyx_CyFunction_GetClassObj(m)); +#endif + Py_VISIT(m->defaults_tuple); + Py_VISIT(m->defaults_kwdict); + 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;\ + } + +static PyObject* __pyx_convert__to_py_struct____pyx_t_5spacy_8pipeline_17_parser_internals_6_state_ArcC(struct __pyx_t_5spacy_8pipeline_17_parser_internals_6_state_ArcC s) { + PyObject* res; + PyObject* member; + res = __Pyx_PyDict_NewPresized(3); if (unlikely(!res)) return NULL; + member = __Pyx_PyLong_From_int(s.head); if (unlikely(!member)) goto bad; + if (unlikely(PyDict_SetItem(res, __pyx_mstate_global->__pyx_n_u_head, member) < 0)) goto bad; + Py_DECREF(member); + member = __Pyx_PyLong_From_int(s.child); if (unlikely(!member)) goto bad; + if (unlikely(PyDict_SetItem(res, __pyx_mstate_global->__pyx_n_u_child, member) < 0)) goto bad; + Py_DECREF(member); + member = __Pyx_PyLong_From_uint64_t(s.label); if (unlikely(!member)) goto bad; + if (unlikely(PyDict_SetItem(res, __pyx_mstate_global->__pyx_n_u_label, member) < 0)) goto bad; + Py_DECREF(member); + return res; + bad: + Py_XDECREF(member); + Py_DECREF(res); + return NULL; +} +/* Declarations */ +#if CYTHON_CCOMPLEX && (1) && (!0 || __cplusplus) + #ifdef __cplusplus + static CYTHON_INLINE __pyx_t_float_complex __pyx_t_float_complex_from_parts(float x, float y) { + return ::std::complex< float >(x, y); + } + #else + static CYTHON_INLINE __pyx_t_float_complex __pyx_t_float_complex_from_parts(float x, float y) { + return x + y*(__pyx_t_float_complex)_Complex_I; + } + #endif +#else + static CYTHON_INLINE __pyx_t_float_complex __pyx_t_float_complex_from_parts(float x, float y) { + __pyx_t_float_complex z; + z.real = x; + z.imag = y; + return z; + } +#endif + +/* Arithmetic */ +#if CYTHON_CCOMPLEX && (1) && (!0 || __cplusplus) +#else + static CYTHON_INLINE int __Pyx_c_eq_float(__pyx_t_float_complex a, __pyx_t_float_complex b) { + return (a.real == b.real) && (a.imag == b.imag); + } + static CYTHON_INLINE __pyx_t_float_complex __Pyx_c_sum_float(__pyx_t_float_complex a, __pyx_t_float_complex b) { + __pyx_t_float_complex z; + z.real = a.real + b.real; + z.imag = a.imag + b.imag; + return z; + } + static CYTHON_INLINE __pyx_t_float_complex __Pyx_c_diff_float(__pyx_t_float_complex a, __pyx_t_float_complex b) { + __pyx_t_float_complex z; + z.real = a.real - b.real; + z.imag = a.imag - b.imag; + return z; + } + static CYTHON_INLINE __pyx_t_float_complex __Pyx_c_prod_float(__pyx_t_float_complex a, __pyx_t_float_complex b) { + __pyx_t_float_complex z; + z.real = a.real * b.real - a.imag * b.imag; + z.imag = a.real * b.imag + a.imag * b.real; + return z; + } + #if 1 + static CYTHON_INLINE __pyx_t_float_complex __Pyx_c_quot_float(__pyx_t_float_complex a, __pyx_t_float_complex b) { + if (b.imag == 0) { + return __pyx_t_float_complex_from_parts(a.real / b.real, a.imag / b.real); + } else if (fabsf(b.real) >= fabsf(b.imag)) { + if (b.real == 0 && b.imag == 0) { + return __pyx_t_float_complex_from_parts(a.real / b.real, a.imag / b.imag); + } else { + float r = b.imag / b.real; + float s = (float)(1.0) / (b.real + b.imag * r); + return __pyx_t_float_complex_from_parts( + (a.real + a.imag * r) * s, (a.imag - a.real * r) * s); + } + } else { + float r = b.real / b.imag; + float s = (float)(1.0) / (b.imag + b.real * r); + return __pyx_t_float_complex_from_parts( + (a.real * r + a.imag) * s, (a.imag * r - a.real) * s); + } + } + #else + static CYTHON_INLINE __pyx_t_float_complex __Pyx_c_quot_float(__pyx_t_float_complex a, __pyx_t_float_complex b) { + if (b.imag == 0) { + return __pyx_t_float_complex_from_parts(a.real / b.real, a.imag / b.real); + } else { + float denom = b.real * b.real + b.imag * b.imag; + return __pyx_t_float_complex_from_parts( + (a.real * b.real + a.imag * b.imag) / denom, + (a.imag * b.real - a.real * b.imag) / denom); + } + } + #endif + static CYTHON_INLINE __pyx_t_float_complex __Pyx_c_neg_float(__pyx_t_float_complex a) { + __pyx_t_float_complex z; + z.real = -a.real; + z.imag = -a.imag; + return z; + } + static CYTHON_INLINE int __Pyx_c_is_zero_float(__pyx_t_float_complex a) { + return (a.real == 0) && (a.imag == 0); + } + static CYTHON_INLINE __pyx_t_float_complex __Pyx_c_conj_float(__pyx_t_float_complex a) { + __pyx_t_float_complex z; + z.real = a.real; + z.imag = -a.imag; + return z; + } + #if 1 + static CYTHON_INLINE float __Pyx_c_abs_float(__pyx_t_float_complex z) { + #if !defined(HAVE_HYPOT) || defined(_MSC_VER) + return sqrtf(z.real*z.real + z.imag*z.imag); + #else + return hypotf(z.real, z.imag); + #endif + } + static CYTHON_INLINE __pyx_t_float_complex __Pyx_c_pow_float(__pyx_t_float_complex a, __pyx_t_float_complex b) { + __pyx_t_float_complex z; + float r, lnr, theta, z_r, z_theta; + if (b.imag == 0 && b.real == (int)b.real) { + if (b.real < 0) { + float denom = a.real * a.real + a.imag * a.imag; + a.real = a.real / denom; + a.imag = -a.imag / denom; + b.real = -b.real; + } + switch ((int)b.real) { + case 0: + z.real = 1; + z.imag = 0; + return z; + case 1: + return a; + case 2: + return __Pyx_c_prod_float(a, a); + case 3: + z = __Pyx_c_prod_float(a, a); + return __Pyx_c_prod_float(z, a); + case 4: + z = __Pyx_c_prod_float(a, a); + return __Pyx_c_prod_float(z, z); + } + } + if (a.imag == 0) { + if (a.real == 0) { + return a; + } else if ((b.imag == 0) && (a.real >= 0)) { + z.real = powf(a.real, b.real); + z.imag = 0; + return z; + } else if (a.real > 0) { + r = a.real; + theta = 0; + } else { + r = -a.real; + theta = atan2f(0.0, -1.0); + } + } else { + r = __Pyx_c_abs_float(a); + theta = atan2f(a.imag, a.real); + } + lnr = logf(r); + z_r = expf(lnr * b.real - theta * b.imag); + z_theta = theta * b.real + lnr * b.imag; + z.real = z_r * cosf(z_theta); + z.imag = z_r * sinf(z_theta); + return z; + } + #endif +#endif + +/* Declarations */ +#if CYTHON_CCOMPLEX && (1) && (!0 || __cplusplus) + #ifdef __cplusplus + static CYTHON_INLINE __pyx_t_double_complex __pyx_t_double_complex_from_parts(double x, double y) { + return ::std::complex< double >(x, y); + } + #else + static CYTHON_INLINE __pyx_t_double_complex __pyx_t_double_complex_from_parts(double x, double y) { + return x + y*(__pyx_t_double_complex)_Complex_I; + } + #endif +#else + static CYTHON_INLINE __pyx_t_double_complex __pyx_t_double_complex_from_parts(double x, double y) { + __pyx_t_double_complex z; + z.real = x; + z.imag = y; + return z; + } +#endif + +/* Arithmetic */ +#if CYTHON_CCOMPLEX && (1) && (!0 || __cplusplus) +#else + static CYTHON_INLINE int __Pyx_c_eq_double(__pyx_t_double_complex a, __pyx_t_double_complex b) { + return (a.real == b.real) && (a.imag == b.imag); + } + static CYTHON_INLINE __pyx_t_double_complex __Pyx_c_sum_double(__pyx_t_double_complex a, __pyx_t_double_complex b) { + __pyx_t_double_complex z; + z.real = a.real + b.real; + z.imag = a.imag + b.imag; + return z; + } + static CYTHON_INLINE __pyx_t_double_complex __Pyx_c_diff_double(__pyx_t_double_complex a, __pyx_t_double_complex b) { + __pyx_t_double_complex z; + z.real = a.real - b.real; + z.imag = a.imag - b.imag; + return z; + } + static CYTHON_INLINE __pyx_t_double_complex __Pyx_c_prod_double(__pyx_t_double_complex a, __pyx_t_double_complex b) { + __pyx_t_double_complex z; + z.real = a.real * b.real - a.imag * b.imag; + z.imag = a.real * b.imag + a.imag * b.real; + return z; + } + #if 1 + static CYTHON_INLINE __pyx_t_double_complex __Pyx_c_quot_double(__pyx_t_double_complex a, __pyx_t_double_complex b) { + if (b.imag == 0) { + return __pyx_t_double_complex_from_parts(a.real / b.real, a.imag / b.real); + } else if (fabs(b.real) >= fabs(b.imag)) { + if (b.real == 0 && b.imag == 0) { + return __pyx_t_double_complex_from_parts(a.real / b.real, a.imag / b.imag); + } else { + double r = b.imag / b.real; + double s = (double)(1.0) / (b.real + b.imag * r); + return __pyx_t_double_complex_from_parts( + (a.real + a.imag * r) * s, (a.imag - a.real * r) * s); + } + } else { + double r = b.real / b.imag; + double s = (double)(1.0) / (b.imag + b.real * r); + return __pyx_t_double_complex_from_parts( + (a.real * r + a.imag) * s, (a.imag * r - a.real) * s); + } + } + #else + static CYTHON_INLINE __pyx_t_double_complex __Pyx_c_quot_double(__pyx_t_double_complex a, __pyx_t_double_complex b) { + if (b.imag == 0) { + return __pyx_t_double_complex_from_parts(a.real / b.real, a.imag / b.real); + } else { + double denom = b.real * b.real + b.imag * b.imag; + return __pyx_t_double_complex_from_parts( + (a.real * b.real + a.imag * b.imag) / denom, + (a.imag * b.real - a.real * b.imag) / denom); + } + } + #endif + static CYTHON_INLINE __pyx_t_double_complex __Pyx_c_neg_double(__pyx_t_double_complex a) { + __pyx_t_double_complex z; + z.real = -a.real; + z.imag = -a.imag; + return z; + } + static CYTHON_INLINE int __Pyx_c_is_zero_double(__pyx_t_double_complex a) { + return (a.real == 0) && (a.imag == 0); + } + static CYTHON_INLINE __pyx_t_double_complex __Pyx_c_conj_double(__pyx_t_double_complex a) { + __pyx_t_double_complex z; + z.real = a.real; + z.imag = -a.imag; + return z; + } + #if 1 + static CYTHON_INLINE double __Pyx_c_abs_double(__pyx_t_double_complex z) { + #if !defined(HAVE_HYPOT) || defined(_MSC_VER) + return sqrt(z.real*z.real + z.imag*z.imag); + #else + return hypot(z.real, z.imag); + #endif + } + static CYTHON_INLINE __pyx_t_double_complex __Pyx_c_pow_double(__pyx_t_double_complex a, __pyx_t_double_complex b) { + __pyx_t_double_complex z; + double r, lnr, theta, z_r, z_theta; + if (b.imag == 0 && b.real == (int)b.real) { + if (b.real < 0) { + double denom = a.real * a.real + a.imag * a.imag; + a.real = a.real / denom; + a.imag = -a.imag / denom; + b.real = -b.real; + } + switch ((int)b.real) { + case 0: + z.real = 1; + z.imag = 0; + return z; + case 1: + return a; + case 2: + return __Pyx_c_prod_double(a, a); + case 3: + z = __Pyx_c_prod_double(a, a); + return __Pyx_c_prod_double(z, a); + case 4: + z = __Pyx_c_prod_double(a, a); + return __Pyx_c_prod_double(z, z); + } + } + if (a.imag == 0) { + if (a.real == 0) { + return a; + } else if ((b.imag == 0) && (a.real >= 0)) { + z.real = pow(a.real, b.real); + z.imag = 0; + return z; + } else if (a.real > 0) { + r = a.real; + theta = 0; + } else { + r = -a.real; + theta = atan2(0.0, -1.0); + } + } else { + r = __Pyx_c_abs_double(a); + theta = atan2(a.imag, a.real); + } + lnr = log(r); + z_r = exp(lnr * b.real - theta * b.imag); + z_theta = theta * b.real + lnr * b.imag; + z.real = z_r * cos(z_theta); + z.imag = z_r * sin(z_theta); + return z; + } + #endif +#endif + +/* Declarations */ +#if CYTHON_CCOMPLEX && (1) && (!0 || __cplusplus) + #ifdef __cplusplus + static CYTHON_INLINE __pyx_t_long_double_complex __pyx_t_long_double_complex_from_parts(long double x, long double y) { + return ::std::complex< long double >(x, y); + } + #else + static CYTHON_INLINE __pyx_t_long_double_complex __pyx_t_long_double_complex_from_parts(long double x, long double y) { + return x + y*(__pyx_t_long_double_complex)_Complex_I; + } + #endif +#else + static CYTHON_INLINE __pyx_t_long_double_complex __pyx_t_long_double_complex_from_parts(long double x, long double y) { + __pyx_t_long_double_complex z; + z.real = x; + z.imag = y; + return z; + } +#endif + +/* Arithmetic */ +#if CYTHON_CCOMPLEX && (1) && (!0 || __cplusplus) +#else + static CYTHON_INLINE int __Pyx_c_eq_long__double(__pyx_t_long_double_complex a, __pyx_t_long_double_complex b) { + return (a.real == b.real) && (a.imag == b.imag); + } + static CYTHON_INLINE __pyx_t_long_double_complex __Pyx_c_sum_long__double(__pyx_t_long_double_complex a, __pyx_t_long_double_complex b) { + __pyx_t_long_double_complex z; + z.real = a.real + b.real; + z.imag = a.imag + b.imag; + return z; + } + static CYTHON_INLINE __pyx_t_long_double_complex __Pyx_c_diff_long__double(__pyx_t_long_double_complex a, __pyx_t_long_double_complex b) { + __pyx_t_long_double_complex z; + z.real = a.real - b.real; + z.imag = a.imag - b.imag; + return z; + } + static CYTHON_INLINE __pyx_t_long_double_complex __Pyx_c_prod_long__double(__pyx_t_long_double_complex a, __pyx_t_long_double_complex b) { + __pyx_t_long_double_complex z; + z.real = a.real * b.real - a.imag * b.imag; + z.imag = a.real * b.imag + a.imag * b.real; + return z; + } + #if 1 + static CYTHON_INLINE __pyx_t_long_double_complex __Pyx_c_quot_long__double(__pyx_t_long_double_complex a, __pyx_t_long_double_complex b) { + if (b.imag == 0) { + return __pyx_t_long_double_complex_from_parts(a.real / b.real, a.imag / b.real); + } else if (fabsl(b.real) >= fabsl(b.imag)) { + if (b.real == 0 && b.imag == 0) { + return __pyx_t_long_double_complex_from_parts(a.real / b.real, a.imag / b.imag); + } else { + long double r = b.imag / b.real; + long double s = (long double)(1.0) / (b.real + b.imag * r); + return __pyx_t_long_double_complex_from_parts( + (a.real + a.imag * r) * s, (a.imag - a.real * r) * s); + } + } else { + long double r = b.real / b.imag; + long double s = (long double)(1.0) / (b.imag + b.real * r); + return __pyx_t_long_double_complex_from_parts( + (a.real * r + a.imag) * s, (a.imag * r - a.real) * s); + } + } + #else + static CYTHON_INLINE __pyx_t_long_double_complex __Pyx_c_quot_long__double(__pyx_t_long_double_complex a, __pyx_t_long_double_complex b) { + if (b.imag == 0) { + return __pyx_t_long_double_complex_from_parts(a.real / b.real, a.imag / b.real); + } else { + long double denom = b.real * b.real + b.imag * b.imag; + return __pyx_t_long_double_complex_from_parts( + (a.real * b.real + a.imag * b.imag) / denom, + (a.imag * b.real - a.real * b.imag) / denom); + } + } + #endif + static CYTHON_INLINE __pyx_t_long_double_complex __Pyx_c_neg_long__double(__pyx_t_long_double_complex a) { + __pyx_t_long_double_complex z; + z.real = -a.real; + z.imag = -a.imag; + return z; + } + static CYTHON_INLINE int __Pyx_c_is_zero_long__double(__pyx_t_long_double_complex a) { + return (a.real == 0) && (a.imag == 0); + } + static CYTHON_INLINE __pyx_t_long_double_complex __Pyx_c_conj_long__double(__pyx_t_long_double_complex a) { + __pyx_t_long_double_complex z; + z.real = a.real; + z.imag = -a.imag; + return z; + } + #if 1 + static CYTHON_INLINE long double __Pyx_c_abs_long__double(__pyx_t_long_double_complex z) { + #if !defined(HAVE_HYPOT) || defined(_MSC_VER) + return sqrtl(z.real*z.real + z.imag*z.imag); + #else + return hypotl(z.real, z.imag); + #endif + } + static CYTHON_INLINE __pyx_t_long_double_complex __Pyx_c_pow_long__double(__pyx_t_long_double_complex a, __pyx_t_long_double_complex b) { + __pyx_t_long_double_complex z; + long double r, lnr, theta, z_r, z_theta; + if (b.imag == 0 && b.real == (int)b.real) { + if (b.real < 0) { + long double denom = a.real * a.real + a.imag * a.imag; + a.real = a.real / denom; + a.imag = -a.imag / denom; + b.real = -b.real; + } + switch ((int)b.real) { + case 0: + z.real = 1; + z.imag = 0; + return z; + case 1: + return a; + case 2: + return __Pyx_c_prod_long__double(a, a); + case 3: + z = __Pyx_c_prod_long__double(a, a); + return __Pyx_c_prod_long__double(z, a); + case 4: + z = __Pyx_c_prod_long__double(a, a); + return __Pyx_c_prod_long__double(z, z); + } + } + if (a.imag == 0) { + if (a.real == 0) { + return a; + } else if ((b.imag == 0) && (a.real >= 0)) { + z.real = powl(a.real, b.real); + z.imag = 0; + return z; + } else if (a.real > 0) { + r = a.real; + theta = 0; + } else { + r = -a.real; + theta = atan2l(0.0, -1.0); + } + } else { + r = __Pyx_c_abs_long__double(a); + theta = atan2l(a.imag, a.real); + } + lnr = logl(r); + z_r = expl(lnr * b.real - theta * b.imag); + z_theta = theta * b.real + lnr * b.imag; + z.real = z_r * cosl(z_theta); + z.imag = z_r * sinl(z_theta); + return z; + } + #endif +#endif + +/* MemviewRefcount */ +#include +#ifndef _Py_NO_RETURN +#define _Py_NO_RETURN +#endif +_Py_NO_RETURN +static void __pyx_fatalerror(const char *fmt, ...) { + va_list vargs; + char msg[200]; +#if PY_VERSION_HEX >= 0x030A0000 || defined(HAVE_STDARG_PROTOTYPES) + va_start(vargs, fmt); +#else + va_start(vargs); +#endif + vsnprintf(msg, 200, fmt, vargs); + va_end(vargs); + Py_FatalError(msg); +} +static CYTHON_INLINE int +__pyx_add_acquisition_count_locked(__pyx_atomic_int_type *acquisition_count, + PyThread_type_lock lock) +{ + int result; + PyThread_acquire_lock(lock, 1); + result = (*acquisition_count)++; + PyThread_release_lock(lock); + return result; +} +static CYTHON_INLINE int +__pyx_sub_acquisition_count_locked(__pyx_atomic_int_type *acquisition_count, + PyThread_type_lock lock) +{ + int result; + PyThread_acquire_lock(lock, 1); + result = (*acquisition_count)--; + PyThread_release_lock(lock); + return result; +} +static CYTHON_INLINE void +__Pyx_INC_MEMVIEW(__Pyx_memviewslice *memslice, int have_gil, int lineno) +{ + __pyx_nonatomic_int_type old_acquisition_count; + struct __pyx_memoryview_obj *memview = memslice->memview; + if (unlikely(!memview || (PyObject *) memview == Py_None)) { + return; + } + old_acquisition_count = __pyx_add_acquisition_count(memview); + if (unlikely(old_acquisition_count <= 0)) { + if (likely(old_acquisition_count == 0)) { + if (have_gil) { + Py_INCREF((PyObject *) memview); + } else { + PyGILState_STATE _gilstate = PyGILState_Ensure(); + Py_INCREF((PyObject *) memview); + PyGILState_Release(_gilstate); + } + } else { + __pyx_fatalerror("Acquisition count is %d (line %d)", + old_acquisition_count+1, lineno); + } + } +} +static CYTHON_INLINE void __Pyx_XCLEAR_MEMVIEW(__Pyx_memviewslice *memslice, + int have_gil, int lineno) { + __pyx_nonatomic_int_type old_acquisition_count; + struct __pyx_memoryview_obj *memview = memslice->memview; + if (unlikely(!memview || (PyObject *) memview == Py_None)) { + memslice->memview = NULL; + return; + } + old_acquisition_count = __pyx_sub_acquisition_count(memview); + memslice->data = NULL; + if (likely(old_acquisition_count > 1)) { + memslice->memview = NULL; + } else if (likely(old_acquisition_count == 1)) { + if (have_gil) { + Py_CLEAR(memslice->memview); + } else { + PyGILState_STATE _gilstate = PyGILState_Ensure(); + Py_CLEAR(memslice->memview); + PyGILState_Release(_gilstate); + } + } else { + __pyx_fatalerror("Acquisition count is %d (line %d)", + old_acquisition_count-1, lineno); + } +} + +/* MemviewSliceIsContig */ +static int +__pyx_memviewslice_is_contig(const __Pyx_memviewslice mvs, char order, int ndim) +{ + int i, index, step, start; + Py_ssize_t itemsize = mvs.memview->view.itemsize; + if (order == 'F') { + step = 1; + start = 0; + } else { + step = -1; + start = ndim - 1; + } + for (i = 0; i < ndim; i++) { + index = start + step * i; + if (mvs.suboffsets[index] >= 0 || mvs.strides[index] != itemsize) + return 0; + itemsize *= mvs.shape[index]; + } + return 1; +} + +/* OverlappingSlices */ +static void +__pyx_get_array_memory_extents(__Pyx_memviewslice *slice, + void **out_start, void **out_end, + int ndim, size_t itemsize) +{ + char *start, *end; + int i; + start = end = slice->data; + for (i = 0; i < ndim; i++) { + Py_ssize_t stride = slice->strides[i]; + Py_ssize_t extent = slice->shape[i]; + if (extent == 0) { + *out_start = *out_end = start; + return; + } else { + if (stride > 0) + end += stride * (extent - 1); + else + start += stride * (extent - 1); + } + } + *out_start = start; + *out_end = end + itemsize; +} +static int +__pyx_slices_overlap(__Pyx_memviewslice *slice1, + __Pyx_memviewslice *slice2, + int ndim, size_t itemsize) +{ + void *start1, *end1, *start2, *end2; + __pyx_get_array_memory_extents(slice1, &start1, &end1, ndim, itemsize); + __pyx_get_array_memory_extents(slice2, &start2, &end2, ndim, itemsize); + return (start1 < end2) && (start2 < end1); +} + +/* MemviewSliceInit */ +static int +__Pyx_init_memviewslice(struct __pyx_memoryview_obj *memview, + int ndim, + __Pyx_memviewslice *memviewslice, + int memview_is_new_reference) +{ + __Pyx_RefNannyDeclarations + int i, retval=-1; + Py_buffer *buf = &memview->view; + __Pyx_RefNannySetupContext("init_memviewslice", 0); + if (unlikely(memviewslice->memview || memviewslice->data)) { + PyErr_SetString(PyExc_ValueError, + "memviewslice is already initialized!"); + goto fail; + } + if (buf->strides) { + for (i = 0; i < ndim; i++) { + memviewslice->strides[i] = buf->strides[i]; + } + } else { + Py_ssize_t stride = buf->itemsize; + for (i = ndim - 1; i >= 0; i--) { + memviewslice->strides[i] = stride; + stride *= buf->shape[i]; + } + } + for (i = 0; i < ndim; i++) { + memviewslice->shape[i] = buf->shape[i]; + if (buf->suboffsets) { + memviewslice->suboffsets[i] = buf->suboffsets[i]; + } else { + memviewslice->suboffsets[i] = -1; + } + } + memviewslice->memview = memview; + memviewslice->data = (char *)buf->buf; + if (__pyx_add_acquisition_count(memview) == 0 && !memview_is_new_reference) { + Py_INCREF((PyObject*)memview); + } + retval = 0; + goto no_fail; +fail: + memviewslice->memview = 0; + memviewslice->data = 0; + retval = -1; +no_fail: + __Pyx_RefNannyFinishContext(); + return retval; +} + +/* 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 uint64_t __Pyx_PyLong_As_uint64_t(PyObject *x) { +#ifdef __Pyx_HAS_GCC_DIAGNOSTIC +#pragma GCC diagnostic push +#pragma GCC diagnostic ignored "-Wconversion" +#endif + const uint64_t neg_one = (uint64_t) -1, const_zero = (uint64_t) 0; +#ifdef __Pyx_HAS_GCC_DIAGNOSTIC +#pragma GCC diagnostic pop +#endif + const int is_unsigned = neg_one > const_zero; + if (unlikely(!PyLong_Check(x))) { + uint64_t val; + PyObject *tmp = __Pyx_PyNumber_Long(x); + if (!tmp) return (uint64_t) -1; + val = __Pyx_PyLong_As_uint64_t(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(uint64_t, __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(uint64_t) > 1 * PyLong_SHIFT)) { + if ((8 * sizeof(unsigned long) > 2 * PyLong_SHIFT)) { + __PYX_VERIFY_RETURN_INT(uint64_t, unsigned long, (((((unsigned long)digits[1]) << PyLong_SHIFT) | (unsigned long)digits[0]))) + } else if ((8 * sizeof(uint64_t) >= 2 * PyLong_SHIFT)) { + return (uint64_t) (((((uint64_t)digits[1]) << PyLong_SHIFT) | (uint64_t)digits[0])); + } + } + break; + case 3: + if ((8 * sizeof(uint64_t) > 2 * PyLong_SHIFT)) { + if ((8 * sizeof(unsigned long) > 3 * PyLong_SHIFT)) { + __PYX_VERIFY_RETURN_INT(uint64_t, unsigned long, (((((((unsigned long)digits[2]) << PyLong_SHIFT) | (unsigned long)digits[1]) << PyLong_SHIFT) | (unsigned long)digits[0]))) + } else if ((8 * sizeof(uint64_t) >= 3 * PyLong_SHIFT)) { + return (uint64_t) (((((((uint64_t)digits[2]) << PyLong_SHIFT) | (uint64_t)digits[1]) << PyLong_SHIFT) | (uint64_t)digits[0])); + } + } + break; + case 4: + if ((8 * sizeof(uint64_t) > 3 * PyLong_SHIFT)) { + if ((8 * sizeof(unsigned long) > 4 * PyLong_SHIFT)) { + __PYX_VERIFY_RETURN_INT(uint64_t, unsigned long, (((((((((unsigned long)digits[3]) << PyLong_SHIFT) | (unsigned long)digits[2]) << PyLong_SHIFT) | (unsigned long)digits[1]) << PyLong_SHIFT) | (unsigned long)digits[0]))) + } else if ((8 * sizeof(uint64_t) >= 4 * PyLong_SHIFT)) { + return (uint64_t) (((((((((uint64_t)digits[3]) << PyLong_SHIFT) | (uint64_t)digits[2]) << PyLong_SHIFT) | (uint64_t)digits[1]) << PyLong_SHIFT) | (uint64_t)digits[0])); + } + } + break; + } + } +#endif +#if CYTHON_COMPILING_IN_CPYTHON && 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 (uint64_t) -1; + if (unlikely(result == 1)) + goto raise_neg_overflow; + } +#endif + if ((sizeof(uint64_t) <= sizeof(unsigned long))) { + __PYX_VERIFY_RETURN_INT_EXC(uint64_t, unsigned long, PyLong_AsUnsignedLong(x)) + } else if ((sizeof(uint64_t) <= sizeof(unsigned PY_LONG_LONG))) { + __PYX_VERIFY_RETURN_INT_EXC(uint64_t, unsigned PY_LONG_LONG, PyLong_AsUnsignedLongLong(x)) + } + } else { +#if CYTHON_USE_PYLONG_INTERNALS + if (__Pyx_PyLong_IsCompact(x)) { + __PYX_VERIFY_RETURN_INT(uint64_t, __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(uint64_t) - 1 > 1 * PyLong_SHIFT)) { + if ((8 * sizeof(unsigned long) > 2 * PyLong_SHIFT)) { + __PYX_VERIFY_RETURN_INT(uint64_t, long, -(long) (((((unsigned long)digits[1]) << PyLong_SHIFT) | (unsigned long)digits[0]))) + } else if ((8 * sizeof(uint64_t) - 1 > 2 * PyLong_SHIFT)) { + return (uint64_t) (((uint64_t)-1)*(((((uint64_t)digits[1]) << PyLong_SHIFT) | (uint64_t)digits[0]))); + } + } + break; + case 2: + if ((8 * sizeof(uint64_t) > 1 * PyLong_SHIFT)) { + if ((8 * sizeof(unsigned long) > 2 * PyLong_SHIFT)) { + __PYX_VERIFY_RETURN_INT(uint64_t, unsigned long, (((((unsigned long)digits[1]) << PyLong_SHIFT) | (unsigned long)digits[0]))) + } else if ((8 * sizeof(uint64_t) - 1 > 2 * PyLong_SHIFT)) { + return (uint64_t) ((((((uint64_t)digits[1]) << PyLong_SHIFT) | (uint64_t)digits[0]))); + } + } + break; + case -3: + if ((8 * sizeof(uint64_t) - 1 > 2 * PyLong_SHIFT)) { + if ((8 * sizeof(unsigned long) > 3 * PyLong_SHIFT)) { + __PYX_VERIFY_RETURN_INT(uint64_t, long, -(long) (((((((unsigned long)digits[2]) << PyLong_SHIFT) | (unsigned long)digits[1]) << PyLong_SHIFT) | (unsigned long)digits[0]))) + } else if ((8 * sizeof(uint64_t) - 1 > 3 * PyLong_SHIFT)) { + return (uint64_t) (((uint64_t)-1)*(((((((uint64_t)digits[2]) << PyLong_SHIFT) | (uint64_t)digits[1]) << PyLong_SHIFT) | (uint64_t)digits[0]))); + } + } + break; + case 3: + if ((8 * sizeof(uint64_t) > 2 * PyLong_SHIFT)) { + if ((8 * sizeof(unsigned long) > 3 * PyLong_SHIFT)) { + __PYX_VERIFY_RETURN_INT(uint64_t, unsigned long, (((((((unsigned long)digits[2]) << PyLong_SHIFT) | (unsigned long)digits[1]) << PyLong_SHIFT) | (unsigned long)digits[0]))) + } else if ((8 * sizeof(uint64_t) - 1 > 3 * PyLong_SHIFT)) { + return (uint64_t) ((((((((uint64_t)digits[2]) << PyLong_SHIFT) | (uint64_t)digits[1]) << PyLong_SHIFT) | (uint64_t)digits[0]))); + } + } + break; + case -4: + if ((8 * sizeof(uint64_t) - 1 > 3 * PyLong_SHIFT)) { + if ((8 * sizeof(unsigned long) > 4 * PyLong_SHIFT)) { + __PYX_VERIFY_RETURN_INT(uint64_t, long, -(long) (((((((((unsigned long)digits[3]) << PyLong_SHIFT) | (unsigned long)digits[2]) << PyLong_SHIFT) | (unsigned long)digits[1]) << PyLong_SHIFT) | (unsigned long)digits[0]))) + } else if ((8 * sizeof(uint64_t) - 1 > 4 * PyLong_SHIFT)) { + return (uint64_t) (((uint64_t)-1)*(((((((((uint64_t)digits[3]) << PyLong_SHIFT) | (uint64_t)digits[2]) << PyLong_SHIFT) | (uint64_t)digits[1]) << PyLong_SHIFT) | (uint64_t)digits[0]))); + } + } + break; + case 4: + if ((8 * sizeof(uint64_t) > 3 * PyLong_SHIFT)) { + if ((8 * sizeof(unsigned long) > 4 * PyLong_SHIFT)) { + __PYX_VERIFY_RETURN_INT(uint64_t, unsigned long, (((((((((unsigned long)digits[3]) << PyLong_SHIFT) | (unsigned long)digits[2]) << PyLong_SHIFT) | (unsigned long)digits[1]) << PyLong_SHIFT) | (unsigned long)digits[0]))) + } else if ((8 * sizeof(uint64_t) - 1 > 4 * PyLong_SHIFT)) { + return (uint64_t) ((((((((((uint64_t)digits[3]) << PyLong_SHIFT) | (uint64_t)digits[2]) << PyLong_SHIFT) | (uint64_t)digits[1]) << PyLong_SHIFT) | (uint64_t)digits[0]))); + } + } + break; + } + } +#endif + if ((sizeof(uint64_t) <= sizeof(long))) { + __PYX_VERIFY_RETURN_INT_EXC(uint64_t, long, PyLong_AsLong(x)) + } else if ((sizeof(uint64_t) <= sizeof(PY_LONG_LONG))) { + __PYX_VERIFY_RETURN_INT_EXC(uint64_t, PY_LONG_LONG, PyLong_AsLongLong(x)) + } + } + { + uint64_t 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 (uint64_t) -1; + assert(PyLong_CheckExact(v)); + } + { + int result = PyObject_RichCompareBool(v, Py_False, Py_LT); + if (unlikely(result < 0)) { + Py_DECREF(v); + return (uint64_t) -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 (uint64_t) -1; + } else { + stepval = v; + } + v = NULL; + val = (uint64_t) 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(uint64_t) * 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 |= ((uint64_t) 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(uint64_t) * 8) - bits - (is_unsigned ? 0 : 1); + if (unlikely(idigit >= (1L << remaining_bits))) + goto raise_overflow; + val |= ((uint64_t) idigit) << bits; + } + if (!is_unsigned) { + if (unlikely(val & (((uint64_t) 1) << (sizeof(uint64_t) * 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 (uint64_t) -1; + return val; + } +raise_overflow: + PyErr_SetString(PyExc_OverflowError, + "value too large to convert to uint64_t"); + return (uint64_t) -1; +raise_neg_overflow: + PyErr_SetString(PyExc_OverflowError, + "can't convert negative value to uint64_t"); + return (uint64_t) -1; +} + +/* 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 + } +} + +/* 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 + } +} + +/* CIntToPy */ +static CYTHON_INLINE PyObject* __Pyx_PyLong_From_uint64_t(uint64_t value) { +#ifdef __Pyx_HAS_GCC_DIAGNOSTIC +#pragma GCC diagnostic push +#pragma GCC diagnostic ignored "-Wconversion" +#endif + const uint64_t neg_one = (uint64_t) -1, const_zero = (uint64_t) 0; +#ifdef __Pyx_HAS_GCC_DIAGNOSTIC +#pragma GCC diagnostic pop +#endif + const int is_unsigned = neg_one > const_zero; + if (is_unsigned) { + if (sizeof(uint64_t) < sizeof(long)) { + return PyLong_FromLong((long) value); + } else if (sizeof(uint64_t) <= sizeof(unsigned long)) { + return PyLong_FromUnsignedLong((unsigned long) value); +#if !CYTHON_COMPILING_IN_PYPY + } else if (sizeof(uint64_t) <= sizeof(unsigned PY_LONG_LONG)) { + return PyLong_FromUnsignedLongLong((unsigned PY_LONG_LONG) value); +#endif + } + } else { + if (sizeof(uint64_t) <= sizeof(long)) { + return PyLong_FromLong((long) value); + } else if (sizeof(uint64_t) <= 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(uint64_t), + 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(uint64_t)); + 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 size_t __Pyx_PyLong_As_size_t(PyObject *x) { +#ifdef __Pyx_HAS_GCC_DIAGNOSTIC +#pragma GCC diagnostic push +#pragma GCC diagnostic ignored "-Wconversion" +#endif + const size_t neg_one = (size_t) -1, const_zero = (size_t) 0; +#ifdef __Pyx_HAS_GCC_DIAGNOSTIC +#pragma GCC diagnostic pop +#endif + const int is_unsigned = neg_one > const_zero; + if (unlikely(!PyLong_Check(x))) { + size_t val; + PyObject *tmp = __Pyx_PyNumber_Long(x); + if (!tmp) return (size_t) -1; + val = __Pyx_PyLong_As_size_t(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(size_t, __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(size_t) > 1 * PyLong_SHIFT)) { + if ((8 * sizeof(unsigned long) > 2 * PyLong_SHIFT)) { + __PYX_VERIFY_RETURN_INT(size_t, unsigned long, (((((unsigned long)digits[1]) << PyLong_SHIFT) | (unsigned long)digits[0]))) + } else if ((8 * sizeof(size_t) >= 2 * PyLong_SHIFT)) { + return (size_t) (((((size_t)digits[1]) << PyLong_SHIFT) | (size_t)digits[0])); + } + } + break; + case 3: + if ((8 * sizeof(size_t) > 2 * PyLong_SHIFT)) { + if ((8 * sizeof(unsigned long) > 3 * PyLong_SHIFT)) { + __PYX_VERIFY_RETURN_INT(size_t, unsigned long, (((((((unsigned long)digits[2]) << PyLong_SHIFT) | (unsigned long)digits[1]) << PyLong_SHIFT) | (unsigned long)digits[0]))) + } else if ((8 * sizeof(size_t) >= 3 * PyLong_SHIFT)) { + return (size_t) (((((((size_t)digits[2]) << PyLong_SHIFT) | (size_t)digits[1]) << PyLong_SHIFT) | (size_t)digits[0])); + } + } + break; + case 4: + if ((8 * sizeof(size_t) > 3 * PyLong_SHIFT)) { + if ((8 * sizeof(unsigned long) > 4 * PyLong_SHIFT)) { + __PYX_VERIFY_RETURN_INT(size_t, unsigned long, (((((((((unsigned long)digits[3]) << PyLong_SHIFT) | (unsigned long)digits[2]) << PyLong_SHIFT) | (unsigned long)digits[1]) << PyLong_SHIFT) | (unsigned long)digits[0]))) + } else if ((8 * sizeof(size_t) >= 4 * PyLong_SHIFT)) { + return (size_t) (((((((((size_t)digits[3]) << PyLong_SHIFT) | (size_t)digits[2]) << PyLong_SHIFT) | (size_t)digits[1]) << PyLong_SHIFT) | (size_t)digits[0])); + } + } + break; + } + } +#endif +#if CYTHON_COMPILING_IN_CPYTHON && 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 (size_t) -1; + if (unlikely(result == 1)) + goto raise_neg_overflow; + } +#endif + if ((sizeof(size_t) <= sizeof(unsigned long))) { + __PYX_VERIFY_RETURN_INT_EXC(size_t, unsigned long, PyLong_AsUnsignedLong(x)) + } else if ((sizeof(size_t) <= sizeof(unsigned PY_LONG_LONG))) { + __PYX_VERIFY_RETURN_INT_EXC(size_t, unsigned PY_LONG_LONG, PyLong_AsUnsignedLongLong(x)) + } + } else { +#if CYTHON_USE_PYLONG_INTERNALS + if (__Pyx_PyLong_IsCompact(x)) { + __PYX_VERIFY_RETURN_INT(size_t, __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(size_t) - 1 > 1 * PyLong_SHIFT)) { + if ((8 * sizeof(unsigned long) > 2 * PyLong_SHIFT)) { + __PYX_VERIFY_RETURN_INT(size_t, long, -(long) (((((unsigned long)digits[1]) << PyLong_SHIFT) | (unsigned long)digits[0]))) + } else if ((8 * sizeof(size_t) - 1 > 2 * PyLong_SHIFT)) { + return (size_t) (((size_t)-1)*(((((size_t)digits[1]) << PyLong_SHIFT) | (size_t)digits[0]))); + } + } + break; + case 2: + if ((8 * sizeof(size_t) > 1 * PyLong_SHIFT)) { + if ((8 * sizeof(unsigned long) > 2 * PyLong_SHIFT)) { + __PYX_VERIFY_RETURN_INT(size_t, unsigned long, (((((unsigned long)digits[1]) << PyLong_SHIFT) | (unsigned long)digits[0]))) + } else if ((8 * sizeof(size_t) - 1 > 2 * PyLong_SHIFT)) { + return (size_t) ((((((size_t)digits[1]) << PyLong_SHIFT) | (size_t)digits[0]))); + } + } + break; + case -3: + if ((8 * sizeof(size_t) - 1 > 2 * PyLong_SHIFT)) { + if ((8 * sizeof(unsigned long) > 3 * PyLong_SHIFT)) { + __PYX_VERIFY_RETURN_INT(size_t, long, -(long) (((((((unsigned long)digits[2]) << PyLong_SHIFT) | (unsigned long)digits[1]) << PyLong_SHIFT) | (unsigned long)digits[0]))) + } else if ((8 * sizeof(size_t) - 1 > 3 * PyLong_SHIFT)) { + return (size_t) (((size_t)-1)*(((((((size_t)digits[2]) << PyLong_SHIFT) | (size_t)digits[1]) << PyLong_SHIFT) | (size_t)digits[0]))); + } + } + break; + case 3: + if ((8 * sizeof(size_t) > 2 * PyLong_SHIFT)) { + if ((8 * sizeof(unsigned long) > 3 * PyLong_SHIFT)) { + __PYX_VERIFY_RETURN_INT(size_t, unsigned long, (((((((unsigned long)digits[2]) << PyLong_SHIFT) | (unsigned long)digits[1]) << PyLong_SHIFT) | (unsigned long)digits[0]))) + } else if ((8 * sizeof(size_t) - 1 > 3 * PyLong_SHIFT)) { + return (size_t) ((((((((size_t)digits[2]) << PyLong_SHIFT) | (size_t)digits[1]) << PyLong_SHIFT) | (size_t)digits[0]))); + } + } + break; + case -4: + if ((8 * sizeof(size_t) - 1 > 3 * PyLong_SHIFT)) { + if ((8 * sizeof(unsigned long) > 4 * PyLong_SHIFT)) { + __PYX_VERIFY_RETURN_INT(size_t, long, -(long) (((((((((unsigned long)digits[3]) << PyLong_SHIFT) | (unsigned long)digits[2]) << PyLong_SHIFT) | (unsigned long)digits[1]) << PyLong_SHIFT) | (unsigned long)digits[0]))) + } else if ((8 * sizeof(size_t) - 1 > 4 * PyLong_SHIFT)) { + return (size_t) (((size_t)-1)*(((((((((size_t)digits[3]) << PyLong_SHIFT) | (size_t)digits[2]) << PyLong_SHIFT) | (size_t)digits[1]) << PyLong_SHIFT) | (size_t)digits[0]))); + } + } + break; + case 4: + if ((8 * sizeof(size_t) > 3 * PyLong_SHIFT)) { + if ((8 * sizeof(unsigned long) > 4 * PyLong_SHIFT)) { + __PYX_VERIFY_RETURN_INT(size_t, unsigned long, (((((((((unsigned long)digits[3]) << PyLong_SHIFT) | (unsigned long)digits[2]) << PyLong_SHIFT) | (unsigned long)digits[1]) << PyLong_SHIFT) | (unsigned long)digits[0]))) + } else if ((8 * sizeof(size_t) - 1 > 4 * PyLong_SHIFT)) { + return (size_t) ((((((((((size_t)digits[3]) << PyLong_SHIFT) | (size_t)digits[2]) << PyLong_SHIFT) | (size_t)digits[1]) << PyLong_SHIFT) | (size_t)digits[0]))); + } + } + break; + } + } +#endif + if ((sizeof(size_t) <= sizeof(long))) { + __PYX_VERIFY_RETURN_INT_EXC(size_t, long, PyLong_AsLong(x)) + } else if ((sizeof(size_t) <= sizeof(PY_LONG_LONG))) { + __PYX_VERIFY_RETURN_INT_EXC(size_t, PY_LONG_LONG, PyLong_AsLongLong(x)) + } + } + { + size_t 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 (size_t) -1; + assert(PyLong_CheckExact(v)); + } + { + int result = PyObject_RichCompareBool(v, Py_False, Py_LT); + if (unlikely(result < 0)) { + Py_DECREF(v); + return (size_t) -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 (size_t) -1; + } else { + stepval = v; + } + v = NULL; + val = (size_t) 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(size_t) * 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 |= ((size_t) 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(size_t) * 8) - bits - (is_unsigned ? 0 : 1); + if (unlikely(idigit >= (1L << remaining_bits))) + goto raise_overflow; + val |= ((size_t) idigit) << bits; + } + if (!is_unsigned) { + if (unlikely(val & (((size_t) 1) << (sizeof(size_t) * 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 (size_t) -1; + return val; + } +raise_overflow: + PyErr_SetString(PyExc_OverflowError, + "value too large to convert to size_t"); + return (size_t) -1; +raise_neg_overflow: + PyErr_SetString(PyExc_OverflowError, + "can't convert negative value to size_t"); + return (size_t) -1; +} + +/* MemviewSliceCopy */ +static __Pyx_memviewslice +__pyx_memoryview_copy_new_contig(const __Pyx_memviewslice *from_mvs, + const char *mode, int ndim, + size_t sizeof_dtype, int contig_flag, + int dtype_is_object) +{ + __Pyx_RefNannyDeclarations + int i; + __Pyx_memviewslice new_mvs = __Pyx_MEMSLICE_INIT; + struct __pyx_memoryview_obj *from_memview = from_mvs->memview; + Py_buffer *buf = &from_memview->view; + PyObject *shape_tuple = NULL; + PyObject *temp_int = NULL; + struct __pyx_array_obj *array_obj = NULL; + struct __pyx_memoryview_obj *memview_obj = NULL; + __Pyx_RefNannySetupContext("__pyx_memoryview_copy_new_contig", 0); + for (i = 0; i < ndim; i++) { + if (unlikely(from_mvs->suboffsets[i] >= 0)) { + PyErr_Format(PyExc_ValueError, "Cannot copy memoryview slice with " + "indirect dimensions (axis %d)", i); + goto fail; + } + } + shape_tuple = PyTuple_New(ndim); + if (unlikely(!shape_tuple)) { + goto fail; + } + __Pyx_GOTREF(shape_tuple); + for(i = 0; i < ndim; i++) { + temp_int = PyLong_FromSsize_t(from_mvs->shape[i]); + if(unlikely(!temp_int)) { + goto fail; + } else { +#if CYTHON_ASSUME_SAFE_MACROS + PyTuple_SET_ITEM(shape_tuple, i, temp_int); +#else + if (PyTuple_SetItem(shape_tuple, i, temp_int) < 0) { + goto fail; + } +#endif + temp_int = NULL; + } + } + array_obj = __pyx_array_new(shape_tuple, sizeof_dtype, buf->format, mode, NULL); + if (unlikely(!array_obj)) { + goto fail; + } + __Pyx_GOTREF(array_obj); + memview_obj = (struct __pyx_memoryview_obj *) __pyx_memoryview_new( + (PyObject *) array_obj, contig_flag, + dtype_is_object, + from_mvs->memview->typeinfo); + if (unlikely(!memview_obj)) + goto fail; + if (unlikely(__Pyx_init_memviewslice(memview_obj, ndim, &new_mvs, 1) < 0)) + goto fail; + if (unlikely(__pyx_memoryview_copy_contents(*from_mvs, new_mvs, ndim, ndim, + dtype_is_object) < 0)) + goto fail; + goto no_fail; +fail: + __Pyx_XDECREF((PyObject *) new_mvs.memview); + new_mvs.memview = NULL; + new_mvs.data = NULL; +no_fail: + __Pyx_XDECREF(shape_tuple); + __Pyx_XDECREF(temp_int); + __Pyx_XDECREF((PyObject *) array_obj); + __Pyx_RefNannyFinishContext(); + return new_mvs; +} + +/* PyObjectCall2Args (used by PyObjectCallMethod1) */ +static CYTHON_INLINE PyObject* __Pyx_PyObject_Call2Args(PyObject* function, PyObject* arg1, PyObject* arg2) { + PyObject *args[3] = {NULL, arg1, arg2}; + return __Pyx_PyObject_FastCall(function, args+1, 2 | __Pyx_PY_VECTORCALL_ARGUMENTS_OFFSET); +} + +/* PyObjectCallMethod1 (used by UpdateUnpickledDict) */ +#if !(CYTHON_VECTORCALL && (__PYX_LIMITED_VERSION_HEX >= 0x030C0000 || (!CYTHON_COMPILING_IN_LIMITED_API && PY_VERSION_HEX >= 0x03090000))) +static PyObject* __Pyx__PyObject_CallMethod1(PyObject* method, PyObject* arg) { + PyObject *result = __Pyx_PyObject_CallOneArg(method, arg); + Py_DECREF(method); + return result; +} +#endif +static PyObject* __Pyx_PyObject_CallMethod1(PyObject* obj, PyObject* method_name, PyObject* arg) { +#if CYTHON_VECTORCALL && (__PYX_LIMITED_VERSION_HEX >= 0x030C0000 || (!CYTHON_COMPILING_IN_LIMITED_API && PY_VERSION_HEX >= 0x03090000)) + PyObject *args[2] = {obj, arg}; + (void) __Pyx_PyObject_CallOneArg; + (void) __Pyx_PyObject_Call2Args; + return PyObject_VectorcallMethod(method_name, args, 2 | PY_VECTORCALL_ARGUMENTS_OFFSET, NULL); +#else + PyObject *method = NULL, *result; + int is_method = __Pyx_PyObject_GetMethod(obj, method_name, &method); + if (likely(is_method)) { + result = __Pyx_PyObject_Call2Args(method, obj, arg); + Py_DECREF(method); + return result; + } + if (unlikely(!method)) return NULL; + return __Pyx__PyObject_CallMethod1(method, arg); +#endif +} + +/* UpdateUnpickledDict */ +static int __Pyx__UpdateUnpickledDict(PyObject *obj, PyObject *state, Py_ssize_t index) { + PyObject *state_dict = __Pyx_PySequence_ITEM(state, index); + if (unlikely(!state_dict)) { + return -1; + } + int non_empty = PyObject_IsTrue(state_dict); + if (non_empty == 0) { + Py_DECREF(state_dict); + return 0; + } else if (unlikely(non_empty == -1)) { + return -1; + } + PyObject *dict; + #if CYTHON_COMPILING_IN_LIMITED_API && __PYX_LIMITED_VERSION_HEX < 0x030A0000 + dict = PyObject_GetAttrString(obj, "__dict__"); + #else + dict = PyObject_GenericGetDict(obj, NULL); + #endif + if (unlikely(!dict)) { + Py_DECREF(state_dict); + return -1; + } + int result; + if (likely(PyDict_CheckExact(dict))) { + result = PyDict_Update(dict, state_dict); + } else { + PyObject *obj_result = __Pyx_PyObject_CallMethod1(dict, __pyx_mstate_global->__pyx_n_u_update, state_dict); + if (likely(obj_result)) { + Py_DECREF(obj_result); + result = 0; + } else { + result = -1; + } + } + Py_DECREF(state_dict); + Py_DECREF(dict); + return result; +} +static int __Pyx_UpdateUnpickledDict(PyObject *obj, PyObject *state, Py_ssize_t index) { + Py_ssize_t state_size = __Pyx_PyTuple_GET_SIZE(state); + #if !CYTHON_ASSUME_SAFE_SIZE + if (unlikely(state_size == -1)) return -1; + #endif + if (state_size <= index) { + return 0; + } + return __Pyx__UpdateUnpickledDict(obj, state, index); +} + +/* CheckUnpickleChecksum */ +static void __Pyx_RaiseUnpickleChecksumError(long checksum, long checksum1, long checksum2, long checksum3, const char *members) { + PyObject *pickle_module = PyImport_ImportModule("pickle"); + if (unlikely(!pickle_module)) return; + PyObject *pickle_error = PyObject_GetAttrString(pickle_module, "PickleError"); + Py_DECREF(pickle_module); + if (unlikely(!pickle_error)) return; + if (checksum2 == checksum1) { + PyErr_Format(pickle_error, "Incompatible checksums (0x%x vs (0x%x) = (%s))", + checksum, checksum1, members); + } else if (checksum3 == checksum2) { + PyErr_Format(pickle_error, "Incompatible checksums (0x%x vs (0x%x, 0x%x) = (%s))", + checksum, checksum1, checksum2, members); + } else { + PyErr_Format(pickle_error, "Incompatible checksums (0x%x vs (0x%x, 0x%x, 0x%x) = (%s))", + checksum, checksum1, checksum2, checksum3, members); + } + Py_DECREF(pickle_error); +} +static int __Pyx_CheckUnpickleChecksum(long checksum, long checksum1, long checksum2, long checksum3, const char *members) { + int found = 0; + found |= checksum1 == checksum; + found |= checksum2 == checksum; + found |= checksum3 == checksum; + if (likely(found)) + return 0; + __Pyx_RaiseUnpickleChecksumError(checksum, checksum1, checksum2, checksum3, members); + return -1; +} + +/* 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 char __Pyx_PyLong_As_char(PyObject *x) { +#ifdef __Pyx_HAS_GCC_DIAGNOSTIC +#pragma GCC diagnostic push +#pragma GCC diagnostic ignored "-Wconversion" +#endif + const char neg_one = (char) -1, const_zero = (char) 0; +#ifdef __Pyx_HAS_GCC_DIAGNOSTIC +#pragma GCC diagnostic pop +#endif + const int is_unsigned = neg_one > const_zero; + if (unlikely(!PyLong_Check(x))) { + char val; + PyObject *tmp = __Pyx_PyNumber_Long(x); + if (!tmp) return (char) -1; + val = __Pyx_PyLong_As_char(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(char, __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(char) > 1 * PyLong_SHIFT)) { + if ((8 * sizeof(unsigned long) > 2 * PyLong_SHIFT)) { + __PYX_VERIFY_RETURN_INT(char, unsigned long, (((((unsigned long)digits[1]) << PyLong_SHIFT) | (unsigned long)digits[0]))) + } else if ((8 * sizeof(char) >= 2 * PyLong_SHIFT)) { + return (char) (((((char)digits[1]) << PyLong_SHIFT) | (char)digits[0])); + } + } + break; + case 3: + if ((8 * sizeof(char) > 2 * PyLong_SHIFT)) { + if ((8 * sizeof(unsigned long) > 3 * PyLong_SHIFT)) { + __PYX_VERIFY_RETURN_INT(char, unsigned long, (((((((unsigned long)digits[2]) << PyLong_SHIFT) | (unsigned long)digits[1]) << PyLong_SHIFT) | (unsigned long)digits[0]))) + } else if ((8 * sizeof(char) >= 3 * PyLong_SHIFT)) { + return (char) (((((((char)digits[2]) << PyLong_SHIFT) | (char)digits[1]) << PyLong_SHIFT) | (char)digits[0])); + } + } + break; + case 4: + if ((8 * sizeof(char) > 3 * PyLong_SHIFT)) { + if ((8 * sizeof(unsigned long) > 4 * PyLong_SHIFT)) { + __PYX_VERIFY_RETURN_INT(char, 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(char) >= 4 * PyLong_SHIFT)) { + return (char) (((((((((char)digits[3]) << PyLong_SHIFT) | (char)digits[2]) << PyLong_SHIFT) | (char)digits[1]) << PyLong_SHIFT) | (char)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 (char) -1; + if (unlikely(result == 1)) + goto raise_neg_overflow; + } +#endif + if ((sizeof(char) <= sizeof(unsigned long))) { + __PYX_VERIFY_RETURN_INT_EXC(char, unsigned long, PyLong_AsUnsignedLong(x)) + } else if ((sizeof(char) <= sizeof(unsigned PY_LONG_LONG))) { + __PYX_VERIFY_RETURN_INT_EXC(char, unsigned PY_LONG_LONG, PyLong_AsUnsignedLongLong(x)) + } + } else { +#if CYTHON_USE_PYLONG_INTERNALS + if (__Pyx_PyLong_IsCompact(x)) { + __PYX_VERIFY_RETURN_INT(char, __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(char) - 1 > 1 * PyLong_SHIFT)) { + if ((8 * sizeof(unsigned long) > 2 * PyLong_SHIFT)) { + __PYX_VERIFY_RETURN_INT(char, long, -(long) (((((unsigned long)digits[1]) << PyLong_SHIFT) | (unsigned long)digits[0]))) + } else if ((8 * sizeof(char) - 1 > 2 * PyLong_SHIFT)) { + return (char) (((char)-1)*(((((char)digits[1]) << PyLong_SHIFT) | (char)digits[0]))); + } + } + break; + case 2: + if ((8 * sizeof(char) > 1 * PyLong_SHIFT)) { + if ((8 * sizeof(unsigned long) > 2 * PyLong_SHIFT)) { + __PYX_VERIFY_RETURN_INT(char, unsigned long, (((((unsigned long)digits[1]) << PyLong_SHIFT) | (unsigned long)digits[0]))) + } else if ((8 * sizeof(char) - 1 > 2 * PyLong_SHIFT)) { + return (char) ((((((char)digits[1]) << PyLong_SHIFT) | (char)digits[0]))); + } + } + break; + case -3: + if ((8 * sizeof(char) - 1 > 2 * PyLong_SHIFT)) { + if ((8 * sizeof(unsigned long) > 3 * PyLong_SHIFT)) { + __PYX_VERIFY_RETURN_INT(char, long, -(long) (((((((unsigned long)digits[2]) << PyLong_SHIFT) | (unsigned long)digits[1]) << PyLong_SHIFT) | (unsigned long)digits[0]))) + } else if ((8 * sizeof(char) - 1 > 3 * PyLong_SHIFT)) { + return (char) (((char)-1)*(((((((char)digits[2]) << PyLong_SHIFT) | (char)digits[1]) << PyLong_SHIFT) | (char)digits[0]))); + } + } + break; + case 3: + if ((8 * sizeof(char) > 2 * PyLong_SHIFT)) { + if ((8 * sizeof(unsigned long) > 3 * PyLong_SHIFT)) { + __PYX_VERIFY_RETURN_INT(char, unsigned long, (((((((unsigned long)digits[2]) << PyLong_SHIFT) | (unsigned long)digits[1]) << PyLong_SHIFT) | (unsigned long)digits[0]))) + } else if ((8 * sizeof(char) - 1 > 3 * PyLong_SHIFT)) { + return (char) ((((((((char)digits[2]) << PyLong_SHIFT) | (char)digits[1]) << PyLong_SHIFT) | (char)digits[0]))); + } + } + break; + case -4: + if ((8 * sizeof(char) - 1 > 3 * PyLong_SHIFT)) { + if ((8 * sizeof(unsigned long) > 4 * PyLong_SHIFT)) { + __PYX_VERIFY_RETURN_INT(char, 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(char) - 1 > 4 * PyLong_SHIFT)) { + return (char) (((char)-1)*(((((((((char)digits[3]) << PyLong_SHIFT) | (char)digits[2]) << PyLong_SHIFT) | (char)digits[1]) << PyLong_SHIFT) | (char)digits[0]))); + } + } + break; + case 4: + if ((8 * sizeof(char) > 3 * PyLong_SHIFT)) { + if ((8 * sizeof(unsigned long) > 4 * PyLong_SHIFT)) { + __PYX_VERIFY_RETURN_INT(char, 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(char) - 1 > 4 * PyLong_SHIFT)) { + return (char) ((((((((((char)digits[3]) << PyLong_SHIFT) | (char)digits[2]) << PyLong_SHIFT) | (char)digits[1]) << PyLong_SHIFT) | (char)digits[0]))); + } + } + break; + } + } +#endif + if ((sizeof(char) <= sizeof(long))) { + __PYX_VERIFY_RETURN_INT_EXC(char, long, PyLong_AsLong(x)) + } else if ((sizeof(char) <= sizeof(PY_LONG_LONG))) { + __PYX_VERIFY_RETURN_INT_EXC(char, PY_LONG_LONG, PyLong_AsLongLong(x)) + } + } + { + char 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 (char) -1; + assert(PyLong_CheckExact(v)); + } + { + int result = PyObject_RichCompareBool(v, Py_False, Py_LT); + if (unlikely(result < 0)) { + Py_DECREF(v); + return (char) -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 (char) -1; + } else { + stepval = v; + } + v = NULL; + val = (char) 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(char) * 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 |= ((char) 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(char) * 8) - bits - (is_unsigned ? 0 : 1); + if (unlikely(idigit >= (1L << remaining_bits))) + goto raise_overflow; + val |= ((char) idigit) << bits; + } + if (!is_unsigned) { + if (unlikely(val & (((char) 1) << (sizeof(char) * 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 (char) -1; + return val; + } +raise_overflow: + PyErr_SetString(PyExc_OverflowError, + "value too large to convert to char"); + return (char) -1; +raise_neg_overflow: + PyErr_SetString(PyExc_OverflowError, + "can't convert negative value to char"); + return (char) -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__10); + } + goto done; +} +#endif + +/* GetRuntimeVersion */ +#if __PYX_LIMITED_VERSION_HEX < 0x030b0000 +void __Pyx_init_runtime_version(void) { + if (__Pyx_cached_runtime_version == 0) { + const char* rt_version = Py_GetVersion(); + unsigned long version = 0; + unsigned long factor = 0x01000000UL; + unsigned int digit = 0; + int i = 0; + while (factor) { + while ('0' <= rt_version[i] && rt_version[i] <= '9') { + digit = digit * 10 + (unsigned int) (rt_version[i] - '0'); + ++i; + } + version += factor * digit; + if (rt_version[i] != '.') + break; + digit = 0; + factor >>= 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, *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)) return NULL; + 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 */ diff --git a/TTS/Kokoro/.venv/Lib/site-packages/spacy/pipeline/_parser_internals/stateclass.pxd b/TTS/Kokoro/.venv/Lib/site-packages/spacy/pipeline/_parser_internals/stateclass.pxd new file mode 100644 index 0000000000000000000000000000000000000000..d004139745e60be477b9cf6c7ad1adb36b5f23c2 --- /dev/null +++ b/TTS/Kokoro/.venv/Lib/site-packages/spacy/pipeline/_parser_internals/stateclass.pxd @@ -0,0 +1,28 @@ +from cymem.cymem cimport Pool + +from ...structs cimport SpanC, TokenC +from ...tokens.doc cimport Doc +from ...typedefs cimport attr_t +from ._state cimport StateC + + +cdef class StateClass: + cdef StateC* c + cdef readonly Doc doc + cdef int _borrowed + + @staticmethod + cdef inline StateClass borrow(StateC* ptr, Doc doc): + cdef StateClass self = StateClass() + self.c = ptr + self._borrowed = 1 + self.doc = doc + return self + + @staticmethod + cdef inline StateClass init_offset(const TokenC* sent, int length, int + offset): + cdef StateClass self = StateClass() + self.c = new StateC(sent, length) + self.c.offset = offset + return self diff --git a/TTS/Kokoro/.venv/Lib/site-packages/spacy/pipeline/_parser_internals/stateclass.pyx b/TTS/Kokoro/.venv/Lib/site-packages/spacy/pipeline/_parser_internals/stateclass.pyx new file mode 100644 index 0000000000000000000000000000000000000000..4d86c45fb573130798a36ed357707de2b8a768e7 --- /dev/null +++ b/TTS/Kokoro/.venv/Lib/site-packages/spacy/pipeline/_parser_internals/stateclass.pyx @@ -0,0 +1,178 @@ +# cython: infer_types=True +# cython: profile=False +from libcpp.vector cimport vector + +from ...tokens.doc cimport Doc +from ._state cimport ArcC + + +cdef class StateClass: + def __init__(self, Doc doc=None, int offset=0): + self._borrowed = 0 + if doc is not None: + self.c = new StateC(doc.c, doc.length) + self.c.offset = offset + self.doc = doc + else: + self.doc = None + + def __dealloc__(self): + if self._borrowed != 1: + del self.c + + @property + def stack(self): + return [self.S(i) for i in range(self.c.stack_depth())] + + @property + def queue(self): + return [self.B(i) for i in range(self.c.buffer_length())] + + @property + def token_vector_length(self): + return self.doc.tensor.shape[1] + + @property + def arcs(self): + cdef vector[ArcC] arcs + self.c.get_arcs(&arcs) + return list(arcs) + # py_arcs = [] + # for arc in arcs: + # if arc.head != -1 and arc.child != -1: + # py_arcs.append((arc.head, arc.child, arc.label)) + # return arcs + + def add_arc(self, int head, int child, int label): + self.c.add_arc(head, child, label) + + def del_arc(self, int head, int child): + self.c.del_arc(head, child) + + def H(self, int child): + return self.c.H(child) + + def L(self, int head, int idx): + return self.c.L(head, idx) + + def R(self, int head, int idx): + return self.c.R(head, idx) + + @property + def _b_i(self): + return self.c._b_i + + @property + def length(self): + return self.c.length + + def is_final(self): + return self.c.is_final() + + def copy(self): + cdef StateClass new_state = StateClass(doc=self.doc, offset=self.c.offset) + new_state.c.clone(self.c) + return new_state + + def print_state(self): + words = [token.text for token in self.doc] + words = list(words) + ['_'] + bools = ["F", "T"] + sent_starts = [bools[self.c.is_sent_start(i)] for i in range(len(self.doc))] + shifted = [1 if self.c.is_unshiftable(i) else 0 for i in range(self.c.length)] + shifted.append("") + sent_starts.append("") + top = f"{self.S(0)}{words[self.S(0)]}_{words[self.H(self.S(0))]}_{shifted[self.S(0)]}" + second = f"{self.S(1)}{words[self.S(1)]}_{words[self.H(self.S(1))]}_{shifted[self.S(1)]}" + third = f"{self.S(2)}{words[self.S(2)]}_{words[self.H(self.S(2))]}_{shifted[self.S(2)]}" + n0 = f"{self.B(0)}{words[self.B(0)]}_{sent_starts[self.B(0)]}_{shifted[self.B(0)]}" + n1 = f"{self.B(1)}{words[self.B(1)]}_{sent_starts[self.B(1)]}_{shifted[self.B(1)]}" + return ' '.join((str(self.stack_depth()), str(self.buffer_length()), third, second, top, '|', n0, n1)) + + def S(self, int i): + return self.c.S(i) + + def B(self, int i): + return self.c.B(i) + + def H(self, int i): + return self.c.H(i) + + def E(self, int i): + return self.c.E(i) + + def L(self, int i, int idx): + return self.c.L(i, idx) + + def R(self, int i, int idx): + return self.c.R(i, idx) + + def S_(self, int i): + return self.doc[self.c.S(i)] + + def B_(self, int i): + return self.doc[self.c.B(i)] + + def H_(self, int i): + return self.doc[self.c.H(i)] + + def E_(self, int i): + return self.doc[self.c.E(i)] + + def L_(self, int i, int idx): + return self.doc[self.c.L(i, idx)] + + def R_(self, int i, int idx): + return self.doc[self.c.R(i, idx)] + + def empty(self): + return self.c.empty() + + def eol(self): + return self.c.eol() + + def at_break(self): + return False + # return self.c.at_break() + + def has_head(self, int i): + return self.c.has_head(i) + + def n_L(self, int i): + return self.c.n_L(i) + + def n_R(self, int i): + return self.c.n_R(i) + + def entity_is_open(self): + return self.c.entity_is_open() + + def stack_depth(self): + return self.c.stack_depth() + + def buffer_length(self): + return self.c.buffer_length() + + def push(self): + self.c.push() + + def pop(self): + self.c.pop() + + def unshift(self): + self.c.unshift() + + def add_arc(self, int head, int child, attr_t label): + self.c.add_arc(head, child, label) + + def del_arc(self, int head, int child): + self.c.del_arc(head, child) + + def open_ent(self, attr_t label): + self.c.open_ent(label) + + def close_ent(self): + self.c.close_ent() + + def clone(self, StateClass src): + self.c.clone(src.c) diff --git a/TTS/Kokoro/.venv/Lib/site-packages/spacy/pipeline/_parser_internals/transition_system.cpp b/TTS/Kokoro/.venv/Lib/site-packages/spacy/pipeline/_parser_internals/transition_system.cpp new file mode 100644 index 0000000000000000000000000000000000000000..a1065f54f29694463423f7ae2c0e4f6152d84690 --- /dev/null +++ b/TTS/Kokoro/.venv/Lib/site-packages/spacy/pipeline/_parser_internals/transition_system.cpp @@ -0,0 +1,45118 @@ +/* Generated by Cython 3.2.1 */ + +/* BEGIN: Cython Metadata +{ + "distutils": { + "depends": [ + "C:\\Users\\runneradmin\\AppData\\Local\\Temp\\build-env-ej_q3m8u\\Lib\\site-packages\\numpy\\_core\\include\\numpy\\arrayobject.h", + "C:\\Users\\runneradmin\\AppData\\Local\\Temp\\build-env-ej_q3m8u\\Lib\\site-packages\\numpy\\_core\\include\\numpy\\arrayscalars.h", + "C:\\Users\\runneradmin\\AppData\\Local\\Temp\\build-env-ej_q3m8u\\Lib\\site-packages\\numpy\\_core\\include\\numpy\\ndarrayobject.h", + "C:\\Users\\runneradmin\\AppData\\Local\\Temp\\build-env-ej_q3m8u\\Lib\\site-packages\\numpy\\_core\\include\\numpy\\ndarraytypes.h", + "C:\\Users\\runneradmin\\AppData\\Local\\Temp\\build-env-ej_q3m8u\\Lib\\site-packages\\numpy\\_core\\include\\numpy\\ufuncobject.h", + "C:\\Users\\runneradmin\\AppData\\Local\\pypa\\cibuildwheel\\Cache\\nuget-cpython\\python.3.12.10\\tools\\Include\\Python.h" + ], + "extra_compile_args": [ + "-std=c++11" + ], + "include_dirs": [ + "C:\\Users\\runneradmin\\AppData\\Local\\Temp\\build-env-ej_q3m8u\\Lib\\site-packages\\numpy\\_core\\include", + "C:\\Users\\runneradmin\\AppData\\Local\\pypa\\cibuildwheel\\Cache\\nuget-cpython\\python.3.12.10\\tools\\Include" + ], + "language": "c++", + "name": "spacy.pipeline._parser_internals.transition_system", + "sources": [ + "spacy/pipeline/_parser_internals/transition_system.pyx" + ] + }, + "module_name": "spacy.pipeline._parser_internals.transition_system" +} +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_1" +#define CYTHON_HEX_VERSION 0x030201F0 +#define CYTHON_FUTURE_DIVISION 0 +/* 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)) + +/* CppInitCode */ +#ifndef __cplusplus + #error "Cython files generated with the C++ option must be compiled with a C++ compiler." +#endif +#ifndef CYTHON_INLINE + #if defined(__clang__) + #define CYTHON_INLINE __inline__ __attribute__ ((__unused__)) + #else + #define CYTHON_INLINE inline + #endif +#endif +template +void __Pyx_call_destructor(T& x) { + x.~T(); +} +template +class __Pyx_FakeReference { + public: + __Pyx_FakeReference() : ptr(NULL) { } + __Pyx_FakeReference(const T& ref) : ptr(const_cast(&ref)) { } + T *operator->() { return ptr; } + T *operator&() { return ptr; } + operator T&() { return *ptr; } + template bool operator ==(const U& other) const { return *ptr == other; } + template bool operator !=(const U& other) const { return *ptr != other; } + template bool operator==(const __Pyx_FakeReference& other) const { return *ptr == *other.ptr; } + template bool operator!=(const __Pyx_FakeReference& other) const { return *ptr != *other.ptr; } + private: + T *ptr; +}; + +/* 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 + #define __PYX_EXTERN_C extern "C++" +#endif + +#define __PYX_HAVE__spacy__pipeline___parser_internals__transition_system +#define __PYX_HAVE_API__spacy__pipeline___parser_internals__transition_system +/* Early includes */ +#include +#include "ios" +#include "new" +#include "stdexcept" +#include "typeinfo" +#include + + #if __cplusplus >= 201103L || (defined(_MSC_VER) && _MSC_VER >= 1600) + // move should be defined for these versions of MSVC, but __cplusplus isn't set usefully + #include + + namespace cython_std { + template typename std::remove_reference::type&& move(T& t) noexcept { return std::move(t); } + template typename std::remove_reference::type&& move(T&& t) noexcept { return std::move(t); } + } + + #endif + +#include +#include +#include +#include +#include +#include + + /* Using NumPy API declarations from "numpy/__init__.cython-30.pxd" */ + +#include "numpy/arrayobject.h" +#include "numpy/ndarrayobject.h" +#include "numpy/ndarraytypes.h" +#include "numpy/arrayscalars.h" +#include "numpy/ufuncobject.h" +#include +#include "pythread.h" +#ifdef _OPENMP +#include +#endif /* _OPENMP */ + +#if defined(PYREX_WITHOUT_ASSERTIONS) && !defined(CYTHON_WITHOUT_ASSERTIONS) +#define CYTHON_WITHOUT_ASSERTIONS +#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; + +/* Header.proto */ +#if !defined(CYTHON_CCOMPLEX) + #if defined(__cplusplus) + #define CYTHON_CCOMPLEX 1 + #elif (defined(_Complex_I) && !defined(_MSC_VER)) || ((defined (__STDC_VERSION__) && __STDC_VERSION__ >= 201112L) && !defined(__STDC_NO_COMPLEX__) && !defined(_MSC_VER)) + #define CYTHON_CCOMPLEX 1 + #else + #define CYTHON_CCOMPLEX 0 + #endif +#endif +#if CYTHON_CCOMPLEX + #ifdef __cplusplus + #include + #else + #include + #endif +#endif +#if CYTHON_CCOMPLEX && !defined(__cplusplus) && defined(__sun__) && defined(__GNUC__) + #undef _Complex_I + #define _Complex_I 1.0fj +#endif + +/* #### Code section: filename_table ### */ + +static const char* const __pyx_f[] = { + "spacy/pipeline/_parser_internals/transition_system.pyx", + "", + "C:/Users/runneradmin/AppData/Local/Temp/build-env-ej_q3m8u/Lib/site-packages/numpy/__init__.cython-30.pxd", + "spacy/lexeme.pxd", + "spacy/pipeline/_parser_internals/_state.pxd", + "spacy/pipeline/_parser_internals/stateclass.pxd", + "spacy/pipeline/_parser_internals/transition_system.pxd", + "cymem/cymem.pxd", + "preshed/maps.pxd", + "spacy/strings.pxd", + "cpython/type.pxd", + "spacy/morphology.pxd", + "spacy/vocab.pxd", + "spacy/tokens/doc.pxd", + "spacy/training/example.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 + +/* ForceInitThreads.proto */ +#ifndef __PYX_FORCE_INIT_THREADS + #define __PYX_FORCE_INIT_THREADS 0 +#endif + +/* NoFastGil.proto */ +#define __Pyx_PyGILState_Ensure PyGILState_Ensure +#define __Pyx_PyGILState_Release PyGILState_Release +#define __Pyx_FastGIL_Remember() +#define __Pyx_FastGIL_Forget() +#define __Pyx_FastGilFuncInit() + +/* IncludeStructmemberH.proto (used by FixUpExtensionType) */ +#include + +/* BufferFormatStructs.proto */ +struct __Pyx_StructField_; +#define __PYX_BUF_FLAGS_PACKED_STRUCT (1 << 0) +typedef struct { + const char* name; + const struct __Pyx_StructField_* fields; + size_t size; + size_t arraysize[8]; + int ndim; + char typegroup; + char is_unsigned; + int flags; +} __Pyx_TypeInfo; +typedef struct __Pyx_StructField_ { + const __Pyx_TypeInfo* type; + const char* name; + size_t offset; +} __Pyx_StructField; +typedef struct { + const __Pyx_StructField* field; + size_t parent_offset; +} __Pyx_BufFmt_StackElem; +typedef struct { + __Pyx_StructField root; + __Pyx_BufFmt_StackElem* head; + size_t fmt_offset; + size_t new_count, enc_count; + size_t struct_alignment; + int is_complex; + char enc_type; + char new_packmode; + char enc_packmode; + char is_valid_array; +} __Pyx_BufFmt_Context; + +/* MemviewSliceStruct.proto */ +struct __pyx_memoryview_obj; +typedef struct { + struct __pyx_memoryview_obj *memview; + char *data; + Py_ssize_t shape[8]; + Py_ssize_t strides[8]; + Py_ssize_t suboffsets[8]; +} __Pyx_memviewslice; +#define __Pyx_MemoryView_Len(m) (m.shape[0]) +#define __Pyx_MEMVIEW_DIRECT 1 +#define __Pyx_MEMVIEW_PTR 2 +#define __Pyx_MEMVIEW_FULL 4 +#define __Pyx_MEMVIEW_CONTIG 8 +#define __Pyx_MEMVIEW_STRIDED 16 +#define __Pyx_MEMVIEW_FOLLOW 32 +#define __Pyx_IS_C_CONTIG 1 +#define __Pyx_IS_F_CONTIG 2 +#define __Pyx_MEMSLICE_INIT { 0, 0, { 0 }, { 0 }, { 0 } } +#if CYTHON_ATOMICS + #define __pyx_add_acquisition_count(memview)\ + __pyx_atomic_incr_relaxed(__pyx_get_slice_count_pointer(memview)) + #define __pyx_sub_acquisition_count(memview)\ + __pyx_atomic_decr_acq_rel(__pyx_get_slice_count_pointer(memview)) +#else + #define __pyx_add_acquisition_count(memview)\ + __pyx_add_acquisition_count_locked(__pyx_get_slice_count_pointer(memview), memview->lock) + #define __pyx_sub_acquisition_count(memview)\ + __pyx_sub_acquisition_count_locked(__pyx_get_slice_count_pointer(memview), memview->lock) +#endif + +/* #### Code section: numeric_typedefs ### */ + +/* "preshed/maps.pxd":5 + * + * + * ctypedef uint64_t key_t # <<<<<<<<<<<<<< + * + * +*/ +typedef uint64_t __pyx_t_7preshed_4maps_key_t; + +/* "typedefs.pxd":3 + * from libc.stdint cimport int32_t, uint8_t, uint16_t, uint32_t, uint64_t, uintptr_t + * + * ctypedef float weight_t # <<<<<<<<<<<<<< + * ctypedef uint64_t hash_t + * ctypedef uint64_t class_t +*/ +typedef float __pyx_t_5spacy_8typedefs_weight_t; + +/* "typedefs.pxd":4 + * + * ctypedef float weight_t + * ctypedef uint64_t hash_t # <<<<<<<<<<<<<< + * ctypedef uint64_t class_t + * ctypedef uint64_t attr_t +*/ +typedef uint64_t __pyx_t_5spacy_8typedefs_hash_t; + +/* "typedefs.pxd":5 + * ctypedef float weight_t + * ctypedef uint64_t hash_t + * ctypedef uint64_t class_t # <<<<<<<<<<<<<< + * ctypedef uint64_t attr_t + * ctypedef uint64_t flags_t +*/ +typedef uint64_t __pyx_t_5spacy_8typedefs_class_t; + +/* "typedefs.pxd":6 + * ctypedef uint64_t hash_t + * ctypedef uint64_t class_t + * ctypedef uint64_t attr_t # <<<<<<<<<<<<<< + * ctypedef uint64_t flags_t + * ctypedef uint16_t len_t +*/ +typedef uint64_t __pyx_t_5spacy_8typedefs_attr_t; + +/* "typedefs.pxd":7 + * ctypedef uint64_t class_t + * ctypedef uint64_t attr_t + * ctypedef uint64_t flags_t # <<<<<<<<<<<<<< + * ctypedef uint16_t len_t + * ctypedef uint16_t tag_t +*/ +typedef uint64_t __pyx_t_5spacy_8typedefs_flags_t; + +/* "typedefs.pxd":8 + * ctypedef uint64_t attr_t + * ctypedef uint64_t flags_t + * ctypedef uint16_t len_t # <<<<<<<<<<<<<< + * ctypedef uint16_t tag_t +*/ +typedef uint16_t __pyx_t_5spacy_8typedefs_len_t; + +/* "typedefs.pxd":9 + * ctypedef uint64_t flags_t + * ctypedef uint16_t len_t + * ctypedef uint16_t tag_t # <<<<<<<<<<<<<< +*/ +typedef uint16_t __pyx_t_5spacy_8typedefs_tag_t; + +/* "C:/Users/runneradmin/AppData/Local/Temp/build-env-ej_q3m8u/Lib/site-packages/numpy/__init__.cython-30.pxd":743 + * # in Cython to enable them only on the right systems. + * + * ctypedef npy_int8 int8_t # <<<<<<<<<<<<<< + * ctypedef npy_int16 int16_t + * ctypedef npy_int32 int32_t +*/ +typedef npy_int8 __pyx_t_5numpy_int8_t; + +/* "C:/Users/runneradmin/AppData/Local/Temp/build-env-ej_q3m8u/Lib/site-packages/numpy/__init__.cython-30.pxd":744 + * + * ctypedef npy_int8 int8_t + * ctypedef npy_int16 int16_t # <<<<<<<<<<<<<< + * ctypedef npy_int32 int32_t + * ctypedef npy_int64 int64_t +*/ +typedef npy_int16 __pyx_t_5numpy_int16_t; + +/* "C:/Users/runneradmin/AppData/Local/Temp/build-env-ej_q3m8u/Lib/site-packages/numpy/__init__.cython-30.pxd":745 + * ctypedef npy_int8 int8_t + * ctypedef npy_int16 int16_t + * ctypedef npy_int32 int32_t # <<<<<<<<<<<<<< + * ctypedef npy_int64 int64_t + * +*/ +typedef npy_int32 __pyx_t_5numpy_int32_t; + +/* "C:/Users/runneradmin/AppData/Local/Temp/build-env-ej_q3m8u/Lib/site-packages/numpy/__init__.cython-30.pxd":746 + * ctypedef npy_int16 int16_t + * ctypedef npy_int32 int32_t + * ctypedef npy_int64 int64_t # <<<<<<<<<<<<<< + * + * ctypedef npy_uint8 uint8_t +*/ +typedef npy_int64 __pyx_t_5numpy_int64_t; + +/* "C:/Users/runneradmin/AppData/Local/Temp/build-env-ej_q3m8u/Lib/site-packages/numpy/__init__.cython-30.pxd":748 + * ctypedef npy_int64 int64_t + * + * ctypedef npy_uint8 uint8_t # <<<<<<<<<<<<<< + * ctypedef npy_uint16 uint16_t + * ctypedef npy_uint32 uint32_t +*/ +typedef npy_uint8 __pyx_t_5numpy_uint8_t; + +/* "C:/Users/runneradmin/AppData/Local/Temp/build-env-ej_q3m8u/Lib/site-packages/numpy/__init__.cython-30.pxd":749 + * + * ctypedef npy_uint8 uint8_t + * ctypedef npy_uint16 uint16_t # <<<<<<<<<<<<<< + * ctypedef npy_uint32 uint32_t + * ctypedef npy_uint64 uint64_t +*/ +typedef npy_uint16 __pyx_t_5numpy_uint16_t; + +/* "C:/Users/runneradmin/AppData/Local/Temp/build-env-ej_q3m8u/Lib/site-packages/numpy/__init__.cython-30.pxd":750 + * ctypedef npy_uint8 uint8_t + * ctypedef npy_uint16 uint16_t + * ctypedef npy_uint32 uint32_t # <<<<<<<<<<<<<< + * ctypedef npy_uint64 uint64_t + * +*/ +typedef npy_uint32 __pyx_t_5numpy_uint32_t; + +/* "C:/Users/runneradmin/AppData/Local/Temp/build-env-ej_q3m8u/Lib/site-packages/numpy/__init__.cython-30.pxd":751 + * ctypedef npy_uint16 uint16_t + * ctypedef npy_uint32 uint32_t + * ctypedef npy_uint64 uint64_t # <<<<<<<<<<<<<< + * + * ctypedef npy_float32 float32_t +*/ +typedef npy_uint64 __pyx_t_5numpy_uint64_t; + +/* "C:/Users/runneradmin/AppData/Local/Temp/build-env-ej_q3m8u/Lib/site-packages/numpy/__init__.cython-30.pxd":753 + * ctypedef npy_uint64 uint64_t + * + * ctypedef npy_float32 float32_t # <<<<<<<<<<<<<< + * ctypedef npy_float64 float64_t + * #ctypedef npy_float80 float80_t +*/ +typedef npy_float32 __pyx_t_5numpy_float32_t; + +/* "C:/Users/runneradmin/AppData/Local/Temp/build-env-ej_q3m8u/Lib/site-packages/numpy/__init__.cython-30.pxd":754 + * + * ctypedef npy_float32 float32_t + * ctypedef npy_float64 float64_t # <<<<<<<<<<<<<< + * #ctypedef npy_float80 float80_t + * #ctypedef npy_float128 float128_t +*/ +typedef npy_float64 __pyx_t_5numpy_float64_t; + +/* "C:/Users/runneradmin/AppData/Local/Temp/build-env-ej_q3m8u/Lib/site-packages/numpy/__init__.cython-30.pxd":761 + * ctypedef double complex complex128_t + * + * ctypedef npy_longlong longlong_t # <<<<<<<<<<<<<< + * ctypedef npy_ulonglong ulonglong_t + * +*/ +typedef npy_longlong __pyx_t_5numpy_longlong_t; + +/* "C:/Users/runneradmin/AppData/Local/Temp/build-env-ej_q3m8u/Lib/site-packages/numpy/__init__.cython-30.pxd":762 + * + * ctypedef npy_longlong longlong_t + * ctypedef npy_ulonglong ulonglong_t # <<<<<<<<<<<<<< + * + * ctypedef npy_intp intp_t +*/ +typedef npy_ulonglong __pyx_t_5numpy_ulonglong_t; + +/* "C:/Users/runneradmin/AppData/Local/Temp/build-env-ej_q3m8u/Lib/site-packages/numpy/__init__.cython-30.pxd":764 + * ctypedef npy_ulonglong ulonglong_t + * + * ctypedef npy_intp intp_t # <<<<<<<<<<<<<< + * ctypedef npy_uintp uintp_t + * +*/ +typedef npy_intp __pyx_t_5numpy_intp_t; + +/* "C:/Users/runneradmin/AppData/Local/Temp/build-env-ej_q3m8u/Lib/site-packages/numpy/__init__.cython-30.pxd":765 + * + * ctypedef npy_intp intp_t + * ctypedef npy_uintp uintp_t # <<<<<<<<<<<<<< + * + * ctypedef npy_double float_t +*/ +typedef npy_uintp __pyx_t_5numpy_uintp_t; + +/* "C:/Users/runneradmin/AppData/Local/Temp/build-env-ej_q3m8u/Lib/site-packages/numpy/__init__.cython-30.pxd":767 + * ctypedef npy_uintp uintp_t + * + * ctypedef npy_double float_t # <<<<<<<<<<<<<< + * ctypedef npy_double double_t + * ctypedef npy_longdouble longdouble_t +*/ +typedef npy_double __pyx_t_5numpy_float_t; + +/* "C:/Users/runneradmin/AppData/Local/Temp/build-env-ej_q3m8u/Lib/site-packages/numpy/__init__.cython-30.pxd":768 + * + * ctypedef npy_double float_t + * ctypedef npy_double double_t # <<<<<<<<<<<<<< + * ctypedef npy_longdouble longdouble_t + * +*/ +typedef npy_double __pyx_t_5numpy_double_t; + +/* "C:/Users/runneradmin/AppData/Local/Temp/build-env-ej_q3m8u/Lib/site-packages/numpy/__init__.cython-30.pxd":769 + * ctypedef npy_double float_t + * ctypedef npy_double double_t + * ctypedef npy_longdouble longdouble_t # <<<<<<<<<<<<<< + * + * ctypedef float complex cfloat_t +*/ +typedef npy_longdouble __pyx_t_5numpy_longdouble_t; +/* #### Code section: complex_type_declarations ### */ +/* Declarations.proto */ +#if CYTHON_CCOMPLEX && (1) && (!0 || __cplusplus) + #ifdef __cplusplus + typedef ::std::complex< float > __pyx_t_float_complex; + #else + typedef float _Complex __pyx_t_float_complex; + #endif +#else + typedef struct { float real, imag; } __pyx_t_float_complex; +#endif +static CYTHON_INLINE __pyx_t_float_complex __pyx_t_float_complex_from_parts(float, float); + +/* Declarations.proto */ +#if CYTHON_CCOMPLEX && (1) && (!0 || __cplusplus) + #ifdef __cplusplus + typedef ::std::complex< double > __pyx_t_double_complex; + #else + typedef double _Complex __pyx_t_double_complex; + #endif +#else + typedef struct { double real, imag; } __pyx_t_double_complex; +#endif +static CYTHON_INLINE __pyx_t_double_complex __pyx_t_double_complex_from_parts(double, double); + +/* Declarations.proto */ +#if CYTHON_CCOMPLEX && (1) && (!0 || __cplusplus) + #ifdef __cplusplus + typedef ::std::complex< long double > __pyx_t_long_double_complex; + #else + typedef long double _Complex __pyx_t_long_double_complex; + #endif +#else + typedef struct { long double real, imag; } __pyx_t_long_double_complex; +#endif +static CYTHON_INLINE __pyx_t_long_double_complex __pyx_t_long_double_complex_from_parts(long double, long double); + +/* #### Code section: type_declarations ### */ + +/*--- Type declarations ---*/ +struct __pyx_obj_5cymem_5cymem_PyMalloc; +struct __pyx_obj_5cymem_5cymem_PyFree; +struct __pyx_obj_5cymem_5cymem_Pool; +struct __pyx_obj_5cymem_5cymem_Address; +struct __pyx_obj_7preshed_4maps_PreshMap; +struct __pyx_obj_7preshed_4maps_PreshMapArray; +struct __pyx_obj_5spacy_7strings_StringStore; +struct __pyx_obj_5spacy_10morphology_Morphology; +struct __pyx_obj_5spacy_5vocab_Vocab; +struct __pyx_obj_5spacy_6tokens_3doc_Doc; +struct __pyx_obj_5spacy_8training_7example_Example; +struct __pyx_obj_5spacy_6lexeme_Lexeme; +struct __pyx_obj_5spacy_8pipeline_17_parser_internals_10stateclass_StateClass; +struct __pyx_obj_5spacy_8pipeline_17_parser_internals_17transition_system_TransitionSystem; +struct __pyx_obj_5spacy_8pipeline_17_parser_internals_17transition_system___pyx_scope_struct__to_bytes; +struct __pyx_array_obj; +struct __pyx_MemviewEnum_obj; +struct __pyx_memoryview_obj; +struct __pyx_memoryviewslice_obj; + +/* "cymem/cymem.pxd":1 + * ctypedef void* (*malloc_t)(size_t n) # <<<<<<<<<<<<<< + * ctypedef void (*free_t)(void *p) + * +*/ +typedef void *(*__pyx_t_5cymem_5cymem_malloc_t)(size_t); + +/* "cymem/cymem.pxd":2 + * ctypedef void* (*malloc_t)(size_t n) + * ctypedef void (*free_t)(void *p) # <<<<<<<<<<<<<< + * + * cdef class PyMalloc: +*/ +typedef void (*__pyx_t_5cymem_5cymem_free_t)(void *); +struct __pyx_t_7preshed_4maps_Cell; +struct __pyx_t_7preshed_4maps_Result; +struct __pyx_t_7preshed_4maps_MapStruct; + +/* "preshed/maps.pxd":8 + * + * + * cdef struct Cell: # <<<<<<<<<<<<<< + * key_t key + * void* value +*/ +struct __pyx_t_7preshed_4maps_Cell { + __pyx_t_7preshed_4maps_key_t key; + void *value; +}; + +/* "preshed/maps.pxd":13 + * + * + * cdef struct Result: # <<<<<<<<<<<<<< + * int found + * void* value +*/ +struct __pyx_t_7preshed_4maps_Result { + int found; + void *value; +}; + +/* "preshed/maps.pxd":18 + * + * + * cdef struct MapStruct: # <<<<<<<<<<<<<< + * Cell* cells + * void* value_for_empty_key +*/ +struct __pyx_t_7preshed_4maps_MapStruct { + struct __pyx_t_7preshed_4maps_Cell *cells; + void *value_for_empty_key; + void *value_for_del_key; + __pyx_t_7preshed_4maps_key_t length; + __pyx_t_7preshed_4maps_key_t filled; + int is_empty_key_set; + int is_del_key_set; +}; +union __pyx_t_5spacy_7strings_Utf8Str; +typedef union __pyx_t_5spacy_7strings_Utf8Str __pyx_t_5spacy_7strings_Utf8Str; + +/* "strings.pxd":17 + * + * + * ctypedef union Utf8Str: # <<<<<<<<<<<<<< + * unsigned char[8] s + * unsigned char* p +*/ +union __pyx_t_5spacy_7strings_Utf8Str { + unsigned char s[8]; + unsigned char *p; +}; + +/* "symbols.pxd":1 + * cdef enum symbol_t: # <<<<<<<<<<<<<< + * NIL + * IS_ALPHA +*/ +enum __pyx_t_5spacy_7symbols_symbol_t { + __pyx_e_5spacy_7symbols_NIL, + __pyx_e_5spacy_7symbols_IS_ALPHA, + __pyx_e_5spacy_7symbols_IS_ASCII, + __pyx_e_5spacy_7symbols_IS_DIGIT, + __pyx_e_5spacy_7symbols_IS_LOWER, + __pyx_e_5spacy_7symbols_IS_PUNCT, + __pyx_e_5spacy_7symbols_IS_SPACE, + __pyx_e_5spacy_7symbols_IS_TITLE, + __pyx_e_5spacy_7symbols_IS_UPPER, + __pyx_e_5spacy_7symbols_LIKE_URL, + __pyx_e_5spacy_7symbols_LIKE_NUM, + __pyx_e_5spacy_7symbols_LIKE_EMAIL, + __pyx_e_5spacy_7symbols_IS_STOP, + __pyx_e_5spacy_7symbols_IS_OOV_DEPRECATED, + __pyx_e_5spacy_7symbols_IS_BRACKET, + __pyx_e_5spacy_7symbols_IS_QUOTE, + __pyx_e_5spacy_7symbols_IS_LEFT_PUNCT, + __pyx_e_5spacy_7symbols_IS_RIGHT_PUNCT, + __pyx_e_5spacy_7symbols_IS_CURRENCY, + __pyx_e_5spacy_7symbols_FLAG19 = 19, + __pyx_e_5spacy_7symbols_FLAG20, + __pyx_e_5spacy_7symbols_FLAG21, + __pyx_e_5spacy_7symbols_FLAG22, + __pyx_e_5spacy_7symbols_FLAG23, + __pyx_e_5spacy_7symbols_FLAG24, + __pyx_e_5spacy_7symbols_FLAG25, + __pyx_e_5spacy_7symbols_FLAG26, + __pyx_e_5spacy_7symbols_FLAG27, + __pyx_e_5spacy_7symbols_FLAG28, + __pyx_e_5spacy_7symbols_FLAG29, + __pyx_e_5spacy_7symbols_FLAG30, + __pyx_e_5spacy_7symbols_FLAG31, + __pyx_e_5spacy_7symbols_FLAG32, + __pyx_e_5spacy_7symbols_FLAG33, + __pyx_e_5spacy_7symbols_FLAG34, + __pyx_e_5spacy_7symbols_FLAG35, + __pyx_e_5spacy_7symbols_FLAG36, + __pyx_e_5spacy_7symbols_FLAG37, + __pyx_e_5spacy_7symbols_FLAG38, + __pyx_e_5spacy_7symbols_FLAG39, + __pyx_e_5spacy_7symbols_FLAG40, + __pyx_e_5spacy_7symbols_FLAG41, + __pyx_e_5spacy_7symbols_FLAG42, + __pyx_e_5spacy_7symbols_FLAG43, + __pyx_e_5spacy_7symbols_FLAG44, + __pyx_e_5spacy_7symbols_FLAG45, + __pyx_e_5spacy_7symbols_FLAG46, + __pyx_e_5spacy_7symbols_FLAG47, + __pyx_e_5spacy_7symbols_FLAG48, + __pyx_e_5spacy_7symbols_FLAG49, + __pyx_e_5spacy_7symbols_FLAG50, + __pyx_e_5spacy_7symbols_FLAG51, + __pyx_e_5spacy_7symbols_FLAG52, + __pyx_e_5spacy_7symbols_FLAG53, + __pyx_e_5spacy_7symbols_FLAG54, + __pyx_e_5spacy_7symbols_FLAG55, + __pyx_e_5spacy_7symbols_FLAG56, + __pyx_e_5spacy_7symbols_FLAG57, + __pyx_e_5spacy_7symbols_FLAG58, + __pyx_e_5spacy_7symbols_FLAG59, + __pyx_e_5spacy_7symbols_FLAG60, + __pyx_e_5spacy_7symbols_FLAG61, + __pyx_e_5spacy_7symbols_FLAG62, + __pyx_e_5spacy_7symbols_FLAG63, + __pyx_e_5spacy_7symbols_ID, + __pyx_e_5spacy_7symbols_ORTH, + __pyx_e_5spacy_7symbols_LOWER, + __pyx_e_5spacy_7symbols_NORM, + __pyx_e_5spacy_7symbols_SHAPE, + __pyx_e_5spacy_7symbols_PREFIX, + __pyx_e_5spacy_7symbols_SUFFIX, + __pyx_e_5spacy_7symbols_LENGTH, + __pyx_e_5spacy_7symbols_CLUSTER, + __pyx_e_5spacy_7symbols_LEMMA, + __pyx_e_5spacy_7symbols_POS, + __pyx_e_5spacy_7symbols_TAG, + __pyx_e_5spacy_7symbols_DEP, + __pyx_e_5spacy_7symbols_ENT_IOB, + __pyx_e_5spacy_7symbols_ENT_TYPE, + __pyx_e_5spacy_7symbols_HEAD, + __pyx_e_5spacy_7symbols_SENT_START, + __pyx_e_5spacy_7symbols_SPACY, + __pyx_e_5spacy_7symbols_PROB, + __pyx_e_5spacy_7symbols_LANG, + __pyx_e_5spacy_7symbols_ADJ, + __pyx_e_5spacy_7symbols_ADP, + __pyx_e_5spacy_7symbols_ADV, + __pyx_e_5spacy_7symbols_AUX, + __pyx_e_5spacy_7symbols_CONJ, + __pyx_e_5spacy_7symbols_CCONJ, + __pyx_e_5spacy_7symbols_DET, + __pyx_e_5spacy_7symbols_INTJ, + __pyx_e_5spacy_7symbols_NOUN, + __pyx_e_5spacy_7symbols_NUM, + __pyx_e_5spacy_7symbols_PART, + __pyx_e_5spacy_7symbols_PRON, + __pyx_e_5spacy_7symbols_PROPN, + __pyx_e_5spacy_7symbols_PUNCT, + __pyx_e_5spacy_7symbols_SCONJ, + __pyx_e_5spacy_7symbols_SYM, + __pyx_e_5spacy_7symbols_VERB, + __pyx_e_5spacy_7symbols_X, + __pyx_e_5spacy_7symbols_EOL, + __pyx_e_5spacy_7symbols_SPACE, + __pyx_e_5spacy_7symbols_DEPRECATED001, + __pyx_e_5spacy_7symbols_DEPRECATED002, + __pyx_e_5spacy_7symbols_DEPRECATED003, + __pyx_e_5spacy_7symbols_DEPRECATED004, + __pyx_e_5spacy_7symbols_DEPRECATED005, + __pyx_e_5spacy_7symbols_DEPRECATED006, + __pyx_e_5spacy_7symbols_DEPRECATED007, + __pyx_e_5spacy_7symbols_DEPRECATED008, + __pyx_e_5spacy_7symbols_DEPRECATED009, + __pyx_e_5spacy_7symbols_DEPRECATED010, + __pyx_e_5spacy_7symbols_DEPRECATED011, + __pyx_e_5spacy_7symbols_DEPRECATED012, + __pyx_e_5spacy_7symbols_DEPRECATED013, + __pyx_e_5spacy_7symbols_DEPRECATED014, + __pyx_e_5spacy_7symbols_DEPRECATED015, + __pyx_e_5spacy_7symbols_DEPRECATED016, + __pyx_e_5spacy_7symbols_DEPRECATED017, + __pyx_e_5spacy_7symbols_DEPRECATED018, + __pyx_e_5spacy_7symbols_DEPRECATED019, + __pyx_e_5spacy_7symbols_DEPRECATED020, + __pyx_e_5spacy_7symbols_DEPRECATED021, + __pyx_e_5spacy_7symbols_DEPRECATED022, + __pyx_e_5spacy_7symbols_DEPRECATED023, + __pyx_e_5spacy_7symbols_DEPRECATED024, + __pyx_e_5spacy_7symbols_DEPRECATED025, + __pyx_e_5spacy_7symbols_DEPRECATED026, + __pyx_e_5spacy_7symbols_DEPRECATED027, + __pyx_e_5spacy_7symbols_DEPRECATED028, + __pyx_e_5spacy_7symbols_DEPRECATED029, + __pyx_e_5spacy_7symbols_DEPRECATED030, + __pyx_e_5spacy_7symbols_DEPRECATED031, + __pyx_e_5spacy_7symbols_DEPRECATED032, + __pyx_e_5spacy_7symbols_DEPRECATED033, + __pyx_e_5spacy_7symbols_DEPRECATED034, + __pyx_e_5spacy_7symbols_DEPRECATED035, + __pyx_e_5spacy_7symbols_DEPRECATED036, + __pyx_e_5spacy_7symbols_DEPRECATED037, + __pyx_e_5spacy_7symbols_DEPRECATED038, + __pyx_e_5spacy_7symbols_DEPRECATED039, + __pyx_e_5spacy_7symbols_DEPRECATED040, + __pyx_e_5spacy_7symbols_DEPRECATED041, + __pyx_e_5spacy_7symbols_DEPRECATED042, + __pyx_e_5spacy_7symbols_DEPRECATED043, + __pyx_e_5spacy_7symbols_DEPRECATED044, + __pyx_e_5spacy_7symbols_DEPRECATED045, + __pyx_e_5spacy_7symbols_DEPRECATED046, + __pyx_e_5spacy_7symbols_DEPRECATED047, + __pyx_e_5spacy_7symbols_DEPRECATED048, + __pyx_e_5spacy_7symbols_DEPRECATED049, + __pyx_e_5spacy_7symbols_DEPRECATED050, + __pyx_e_5spacy_7symbols_DEPRECATED051, + __pyx_e_5spacy_7symbols_DEPRECATED052, + __pyx_e_5spacy_7symbols_DEPRECATED053, + __pyx_e_5spacy_7symbols_DEPRECATED054, + __pyx_e_5spacy_7symbols_DEPRECATED055, + __pyx_e_5spacy_7symbols_DEPRECATED056, + __pyx_e_5spacy_7symbols_DEPRECATED057, + __pyx_e_5spacy_7symbols_DEPRECATED058, + __pyx_e_5spacy_7symbols_DEPRECATED059, + __pyx_e_5spacy_7symbols_DEPRECATED060, + __pyx_e_5spacy_7symbols_DEPRECATED061, + __pyx_e_5spacy_7symbols_DEPRECATED062, + __pyx_e_5spacy_7symbols_DEPRECATED063, + __pyx_e_5spacy_7symbols_DEPRECATED064, + __pyx_e_5spacy_7symbols_DEPRECATED065, + __pyx_e_5spacy_7symbols_DEPRECATED066, + __pyx_e_5spacy_7symbols_DEPRECATED067, + __pyx_e_5spacy_7symbols_DEPRECATED068, + __pyx_e_5spacy_7symbols_DEPRECATED069, + __pyx_e_5spacy_7symbols_DEPRECATED070, + __pyx_e_5spacy_7symbols_DEPRECATED071, + __pyx_e_5spacy_7symbols_DEPRECATED072, + __pyx_e_5spacy_7symbols_DEPRECATED073, + __pyx_e_5spacy_7symbols_DEPRECATED074, + __pyx_e_5spacy_7symbols_DEPRECATED075, + __pyx_e_5spacy_7symbols_DEPRECATED076, + __pyx_e_5spacy_7symbols_DEPRECATED077, + __pyx_e_5spacy_7symbols_DEPRECATED078, + __pyx_e_5spacy_7symbols_DEPRECATED079, + __pyx_e_5spacy_7symbols_DEPRECATED080, + __pyx_e_5spacy_7symbols_DEPRECATED081, + __pyx_e_5spacy_7symbols_DEPRECATED082, + __pyx_e_5spacy_7symbols_DEPRECATED083, + __pyx_e_5spacy_7symbols_DEPRECATED084, + __pyx_e_5spacy_7symbols_DEPRECATED085, + __pyx_e_5spacy_7symbols_DEPRECATED086, + __pyx_e_5spacy_7symbols_DEPRECATED087, + __pyx_e_5spacy_7symbols_DEPRECATED088, + __pyx_e_5spacy_7symbols_DEPRECATED089, + __pyx_e_5spacy_7symbols_DEPRECATED090, + __pyx_e_5spacy_7symbols_DEPRECATED091, + __pyx_e_5spacy_7symbols_DEPRECATED092, + __pyx_e_5spacy_7symbols_DEPRECATED093, + __pyx_e_5spacy_7symbols_DEPRECATED094, + __pyx_e_5spacy_7symbols_DEPRECATED095, + __pyx_e_5spacy_7symbols_DEPRECATED096, + __pyx_e_5spacy_7symbols_DEPRECATED097, + __pyx_e_5spacy_7symbols_DEPRECATED098, + __pyx_e_5spacy_7symbols_DEPRECATED099, + __pyx_e_5spacy_7symbols_DEPRECATED100, + __pyx_e_5spacy_7symbols_DEPRECATED101, + __pyx_e_5spacy_7symbols_DEPRECATED102, + __pyx_e_5spacy_7symbols_DEPRECATED103, + __pyx_e_5spacy_7symbols_DEPRECATED104, + __pyx_e_5spacy_7symbols_DEPRECATED105, + __pyx_e_5spacy_7symbols_DEPRECATED106, + __pyx_e_5spacy_7symbols_DEPRECATED107, + __pyx_e_5spacy_7symbols_DEPRECATED108, + __pyx_e_5spacy_7symbols_DEPRECATED109, + __pyx_e_5spacy_7symbols_DEPRECATED110, + __pyx_e_5spacy_7symbols_DEPRECATED111, + __pyx_e_5spacy_7symbols_DEPRECATED112, + __pyx_e_5spacy_7symbols_DEPRECATED113, + __pyx_e_5spacy_7symbols_DEPRECATED114, + __pyx_e_5spacy_7symbols_DEPRECATED115, + __pyx_e_5spacy_7symbols_DEPRECATED116, + __pyx_e_5spacy_7symbols_DEPRECATED117, + __pyx_e_5spacy_7symbols_DEPRECATED118, + __pyx_e_5spacy_7symbols_DEPRECATED119, + __pyx_e_5spacy_7symbols_DEPRECATED120, + __pyx_e_5spacy_7symbols_DEPRECATED121, + __pyx_e_5spacy_7symbols_DEPRECATED122, + __pyx_e_5spacy_7symbols_DEPRECATED123, + __pyx_e_5spacy_7symbols_DEPRECATED124, + __pyx_e_5spacy_7symbols_DEPRECATED125, + __pyx_e_5spacy_7symbols_DEPRECATED126, + __pyx_e_5spacy_7symbols_DEPRECATED127, + __pyx_e_5spacy_7symbols_DEPRECATED128, + __pyx_e_5spacy_7symbols_DEPRECATED129, + __pyx_e_5spacy_7symbols_DEPRECATED130, + __pyx_e_5spacy_7symbols_DEPRECATED131, + __pyx_e_5spacy_7symbols_DEPRECATED132, + __pyx_e_5spacy_7symbols_DEPRECATED133, + __pyx_e_5spacy_7symbols_DEPRECATED134, + __pyx_e_5spacy_7symbols_DEPRECATED135, + __pyx_e_5spacy_7symbols_DEPRECATED136, + __pyx_e_5spacy_7symbols_DEPRECATED137, + __pyx_e_5spacy_7symbols_DEPRECATED138, + __pyx_e_5spacy_7symbols_DEPRECATED139, + __pyx_e_5spacy_7symbols_DEPRECATED140, + __pyx_e_5spacy_7symbols_DEPRECATED141, + __pyx_e_5spacy_7symbols_DEPRECATED142, + __pyx_e_5spacy_7symbols_DEPRECATED143, + __pyx_e_5spacy_7symbols_DEPRECATED144, + __pyx_e_5spacy_7symbols_DEPRECATED145, + __pyx_e_5spacy_7symbols_DEPRECATED146, + __pyx_e_5spacy_7symbols_DEPRECATED147, + __pyx_e_5spacy_7symbols_DEPRECATED148, + __pyx_e_5spacy_7symbols_DEPRECATED149, + __pyx_e_5spacy_7symbols_DEPRECATED150, + __pyx_e_5spacy_7symbols_DEPRECATED151, + __pyx_e_5spacy_7symbols_DEPRECATED152, + __pyx_e_5spacy_7symbols_DEPRECATED153, + __pyx_e_5spacy_7symbols_DEPRECATED154, + __pyx_e_5spacy_7symbols_DEPRECATED155, + __pyx_e_5spacy_7symbols_DEPRECATED156, + __pyx_e_5spacy_7symbols_DEPRECATED157, + __pyx_e_5spacy_7symbols_DEPRECATED158, + __pyx_e_5spacy_7symbols_DEPRECATED159, + __pyx_e_5spacy_7symbols_DEPRECATED160, + __pyx_e_5spacy_7symbols_DEPRECATED161, + __pyx_e_5spacy_7symbols_DEPRECATED162, + __pyx_e_5spacy_7symbols_DEPRECATED163, + __pyx_e_5spacy_7symbols_DEPRECATED164, + __pyx_e_5spacy_7symbols_DEPRECATED165, + __pyx_e_5spacy_7symbols_DEPRECATED166, + __pyx_e_5spacy_7symbols_DEPRECATED167, + __pyx_e_5spacy_7symbols_DEPRECATED168, + __pyx_e_5spacy_7symbols_DEPRECATED169, + __pyx_e_5spacy_7symbols_DEPRECATED170, + __pyx_e_5spacy_7symbols_DEPRECATED171, + __pyx_e_5spacy_7symbols_DEPRECATED172, + __pyx_e_5spacy_7symbols_DEPRECATED173, + __pyx_e_5spacy_7symbols_DEPRECATED174, + __pyx_e_5spacy_7symbols_DEPRECATED175, + __pyx_e_5spacy_7symbols_DEPRECATED176, + __pyx_e_5spacy_7symbols_DEPRECATED177, + __pyx_e_5spacy_7symbols_DEPRECATED178, + __pyx_e_5spacy_7symbols_DEPRECATED179, + __pyx_e_5spacy_7symbols_DEPRECATED180, + __pyx_e_5spacy_7symbols_DEPRECATED181, + __pyx_e_5spacy_7symbols_DEPRECATED182, + __pyx_e_5spacy_7symbols_DEPRECATED183, + __pyx_e_5spacy_7symbols_DEPRECATED184, + __pyx_e_5spacy_7symbols_DEPRECATED185, + __pyx_e_5spacy_7symbols_DEPRECATED186, + __pyx_e_5spacy_7symbols_DEPRECATED187, + __pyx_e_5spacy_7symbols_DEPRECATED188, + __pyx_e_5spacy_7symbols_DEPRECATED189, + __pyx_e_5spacy_7symbols_DEPRECATED190, + __pyx_e_5spacy_7symbols_DEPRECATED191, + __pyx_e_5spacy_7symbols_DEPRECATED192, + __pyx_e_5spacy_7symbols_DEPRECATED193, + __pyx_e_5spacy_7symbols_DEPRECATED194, + __pyx_e_5spacy_7symbols_DEPRECATED195, + __pyx_e_5spacy_7symbols_DEPRECATED196, + __pyx_e_5spacy_7symbols_DEPRECATED197, + __pyx_e_5spacy_7symbols_DEPRECATED198, + __pyx_e_5spacy_7symbols_DEPRECATED199, + __pyx_e_5spacy_7symbols_DEPRECATED200, + __pyx_e_5spacy_7symbols_DEPRECATED201, + __pyx_e_5spacy_7symbols_DEPRECATED202, + __pyx_e_5spacy_7symbols_DEPRECATED203, + __pyx_e_5spacy_7symbols_DEPRECATED204, + __pyx_e_5spacy_7symbols_DEPRECATED205, + __pyx_e_5spacy_7symbols_DEPRECATED206, + __pyx_e_5spacy_7symbols_DEPRECATED207, + __pyx_e_5spacy_7symbols_DEPRECATED208, + __pyx_e_5spacy_7symbols_DEPRECATED209, + __pyx_e_5spacy_7symbols_DEPRECATED210, + __pyx_e_5spacy_7symbols_DEPRECATED211, + __pyx_e_5spacy_7symbols_DEPRECATED212, + __pyx_e_5spacy_7symbols_DEPRECATED213, + __pyx_e_5spacy_7symbols_DEPRECATED214, + __pyx_e_5spacy_7symbols_DEPRECATED215, + __pyx_e_5spacy_7symbols_DEPRECATED216, + __pyx_e_5spacy_7symbols_DEPRECATED217, + __pyx_e_5spacy_7symbols_DEPRECATED218, + __pyx_e_5spacy_7symbols_DEPRECATED219, + __pyx_e_5spacy_7symbols_DEPRECATED220, + __pyx_e_5spacy_7symbols_DEPRECATED221, + __pyx_e_5spacy_7symbols_DEPRECATED222, + __pyx_e_5spacy_7symbols_DEPRECATED223, + __pyx_e_5spacy_7symbols_DEPRECATED224, + __pyx_e_5spacy_7symbols_DEPRECATED225, + __pyx_e_5spacy_7symbols_DEPRECATED226, + __pyx_e_5spacy_7symbols_DEPRECATED227, + __pyx_e_5spacy_7symbols_DEPRECATED228, + __pyx_e_5spacy_7symbols_DEPRECATED229, + __pyx_e_5spacy_7symbols_DEPRECATED230, + __pyx_e_5spacy_7symbols_DEPRECATED231, + __pyx_e_5spacy_7symbols_DEPRECATED232, + __pyx_e_5spacy_7symbols_DEPRECATED233, + __pyx_e_5spacy_7symbols_DEPRECATED234, + __pyx_e_5spacy_7symbols_DEPRECATED235, + __pyx_e_5spacy_7symbols_DEPRECATED236, + __pyx_e_5spacy_7symbols_DEPRECATED237, + __pyx_e_5spacy_7symbols_DEPRECATED238, + __pyx_e_5spacy_7symbols_DEPRECATED239, + __pyx_e_5spacy_7symbols_DEPRECATED240, + __pyx_e_5spacy_7symbols_DEPRECATED241, + __pyx_e_5spacy_7symbols_DEPRECATED242, + __pyx_e_5spacy_7symbols_DEPRECATED243, + __pyx_e_5spacy_7symbols_DEPRECATED244, + __pyx_e_5spacy_7symbols_DEPRECATED245, + __pyx_e_5spacy_7symbols_DEPRECATED246, + __pyx_e_5spacy_7symbols_DEPRECATED247, + __pyx_e_5spacy_7symbols_DEPRECATED248, + __pyx_e_5spacy_7symbols_DEPRECATED249, + __pyx_e_5spacy_7symbols_DEPRECATED250, + __pyx_e_5spacy_7symbols_DEPRECATED251, + __pyx_e_5spacy_7symbols_DEPRECATED252, + __pyx_e_5spacy_7symbols_DEPRECATED253, + __pyx_e_5spacy_7symbols_DEPRECATED254, + __pyx_e_5spacy_7symbols_DEPRECATED255, + __pyx_e_5spacy_7symbols_DEPRECATED256, + __pyx_e_5spacy_7symbols_DEPRECATED257, + __pyx_e_5spacy_7symbols_DEPRECATED258, + __pyx_e_5spacy_7symbols_DEPRECATED259, + __pyx_e_5spacy_7symbols_DEPRECATED260, + __pyx_e_5spacy_7symbols_DEPRECATED261, + __pyx_e_5spacy_7symbols_DEPRECATED262, + __pyx_e_5spacy_7symbols_DEPRECATED263, + __pyx_e_5spacy_7symbols_DEPRECATED264, + __pyx_e_5spacy_7symbols_DEPRECATED265, + __pyx_e_5spacy_7symbols_DEPRECATED266, + __pyx_e_5spacy_7symbols_DEPRECATED267, + __pyx_e_5spacy_7symbols_DEPRECATED268, + __pyx_e_5spacy_7symbols_DEPRECATED269, + __pyx_e_5spacy_7symbols_DEPRECATED270, + __pyx_e_5spacy_7symbols_DEPRECATED271, + __pyx_e_5spacy_7symbols_DEPRECATED272, + __pyx_e_5spacy_7symbols_DEPRECATED273, + __pyx_e_5spacy_7symbols_DEPRECATED274, + __pyx_e_5spacy_7symbols_DEPRECATED275, + __pyx_e_5spacy_7symbols_DEPRECATED276, + __pyx_e_5spacy_7symbols_PERSON, + __pyx_e_5spacy_7symbols_NORP, + __pyx_e_5spacy_7symbols_FACILITY, + __pyx_e_5spacy_7symbols_ORG, + __pyx_e_5spacy_7symbols_GPE, + __pyx_e_5spacy_7symbols_LOC, + __pyx_e_5spacy_7symbols_PRODUCT, + __pyx_e_5spacy_7symbols_EVENT, + __pyx_e_5spacy_7symbols_WORK_OF_ART, + __pyx_e_5spacy_7symbols_LANGUAGE, + __pyx_e_5spacy_7symbols_LAW, + __pyx_e_5spacy_7symbols_DATE, + __pyx_e_5spacy_7symbols_TIME, + __pyx_e_5spacy_7symbols_PERCENT, + __pyx_e_5spacy_7symbols_MONEY, + __pyx_e_5spacy_7symbols_QUANTITY, + __pyx_e_5spacy_7symbols_ORDINAL, + __pyx_e_5spacy_7symbols_CARDINAL, + __pyx_e_5spacy_7symbols_acomp, + __pyx_e_5spacy_7symbols_advcl, + __pyx_e_5spacy_7symbols_advmod, + __pyx_e_5spacy_7symbols_agent, + __pyx_e_5spacy_7symbols_amod, + __pyx_e_5spacy_7symbols_appos, + __pyx_e_5spacy_7symbols_attr, + __pyx_e_5spacy_7symbols_aux, + __pyx_e_5spacy_7symbols_auxpass, + __pyx_e_5spacy_7symbols_cc, + __pyx_e_5spacy_7symbols_ccomp, + __pyx_e_5spacy_7symbols_complm, + __pyx_e_5spacy_7symbols_conj, + __pyx_e_5spacy_7symbols_cop, + __pyx_e_5spacy_7symbols_csubj, + __pyx_e_5spacy_7symbols_csubjpass, + __pyx_e_5spacy_7symbols_dep, + __pyx_e_5spacy_7symbols_det, + __pyx_e_5spacy_7symbols_dobj, + __pyx_e_5spacy_7symbols_expl, + __pyx_e_5spacy_7symbols_hmod, + __pyx_e_5spacy_7symbols_hyph, + __pyx_e_5spacy_7symbols_infmod, + __pyx_e_5spacy_7symbols_intj, + __pyx_e_5spacy_7symbols_iobj, + __pyx_e_5spacy_7symbols_mark, + __pyx_e_5spacy_7symbols_meta, + __pyx_e_5spacy_7symbols_neg, + __pyx_e_5spacy_7symbols_nmod, + __pyx_e_5spacy_7symbols_nn, + __pyx_e_5spacy_7symbols_npadvmod, + __pyx_e_5spacy_7symbols_nsubj, + __pyx_e_5spacy_7symbols_nsubjpass, + __pyx_e_5spacy_7symbols_num, + __pyx_e_5spacy_7symbols_number, + __pyx_e_5spacy_7symbols_oprd, + __pyx_e_5spacy_7symbols_obj, + __pyx_e_5spacy_7symbols_obl, + __pyx_e_5spacy_7symbols_parataxis, + __pyx_e_5spacy_7symbols_partmod, + __pyx_e_5spacy_7symbols_pcomp, + __pyx_e_5spacy_7symbols_pobj, + __pyx_e_5spacy_7symbols_poss, + __pyx_e_5spacy_7symbols_possessive, + __pyx_e_5spacy_7symbols_preconj, + __pyx_e_5spacy_7symbols_prep, + __pyx_e_5spacy_7symbols_prt, + __pyx_e_5spacy_7symbols_punct, + __pyx_e_5spacy_7symbols_quantmod, + __pyx_e_5spacy_7symbols_relcl, + __pyx_e_5spacy_7symbols_rcmod, + __pyx_e_5spacy_7symbols_root, + __pyx_e_5spacy_7symbols_xcomp, + __pyx_e_5spacy_7symbols_acl, + __pyx_e_5spacy_7symbols_ENT_KB_ID, + __pyx_e_5spacy_7symbols_MORPH, + __pyx_e_5spacy_7symbols_ENT_ID, + __pyx_e_5spacy_7symbols_IDX, + __pyx_e_5spacy_7symbols__ +}; + +/* "parts_of_speech.pxd":4 + * + * + * cpdef enum univ_pos_t: # <<<<<<<<<<<<<< + * NO_TAG = 0 + * ADJ = symbols.ADJ +*/ +enum __pyx_t_5spacy_15parts_of_speech_univ_pos_t { + + /* "parts_of_speech.pxd":6 + * cpdef enum univ_pos_t: + * NO_TAG = 0 + * ADJ = symbols.ADJ # <<<<<<<<<<<<<< + * ADP + * ADV +*/ + __pyx_e_5spacy_15parts_of_speech_NO_TAG = 0, + __pyx_e_5spacy_15parts_of_speech_ADJ = __pyx_e_5spacy_7symbols_ADJ, + __pyx_e_5spacy_15parts_of_speech_ADP, + __pyx_e_5spacy_15parts_of_speech_ADV, + __pyx_e_5spacy_15parts_of_speech_AUX, + __pyx_e_5spacy_15parts_of_speech_CONJ, + __pyx_e_5spacy_15parts_of_speech_CCONJ, + __pyx_e_5spacy_15parts_of_speech_DET, + __pyx_e_5spacy_15parts_of_speech_INTJ, + __pyx_e_5spacy_15parts_of_speech_NOUN, + __pyx_e_5spacy_15parts_of_speech_NUM, + __pyx_e_5spacy_15parts_of_speech_PART, + __pyx_e_5spacy_15parts_of_speech_PRON, + __pyx_e_5spacy_15parts_of_speech_PROPN, + __pyx_e_5spacy_15parts_of_speech_PUNCT, + __pyx_e_5spacy_15parts_of_speech_SCONJ, + __pyx_e_5spacy_15parts_of_speech_SYM, + __pyx_e_5spacy_15parts_of_speech_VERB, + __pyx_e_5spacy_15parts_of_speech_X, + __pyx_e_5spacy_15parts_of_speech_EOL, + __pyx_e_5spacy_15parts_of_speech_SPACE +}; +struct __pyx_t_5spacy_7structs_LexemeC; +struct __pyx_t_5spacy_7structs_SpanC; +struct __pyx_t_5spacy_7structs_TokenC; +struct __pyx_t_5spacy_7structs_MorphAnalysisC; +struct __pyx_t_5spacy_7structs_KBEntryC; +struct __pyx_t_5spacy_7structs_AliasC; +struct __pyx_t_5spacy_7structs_EdgeC; +struct __pyx_t_5spacy_7structs_GraphC; + +/* "structs.pxd":10 + * + * + * cdef struct LexemeC: # <<<<<<<<<<<<<< + * flags_t flags + * +*/ +struct __pyx_t_5spacy_7structs_LexemeC { + __pyx_t_5spacy_8typedefs_flags_t flags; + __pyx_t_5spacy_8typedefs_attr_t lang; + __pyx_t_5spacy_8typedefs_attr_t id; + __pyx_t_5spacy_8typedefs_attr_t length; + __pyx_t_5spacy_8typedefs_attr_t orth; + __pyx_t_5spacy_8typedefs_attr_t lower; + __pyx_t_5spacy_8typedefs_attr_t norm; + __pyx_t_5spacy_8typedefs_attr_t shape; + __pyx_t_5spacy_8typedefs_attr_t prefix; + __pyx_t_5spacy_8typedefs_attr_t suffix; +}; + +/* "structs.pxd":26 + * + * + * cdef struct SpanC: # <<<<<<<<<<<<<< + * hash_t id + * int start +*/ +struct __pyx_t_5spacy_7structs_SpanC { + __pyx_t_5spacy_8typedefs_hash_t id; + int start; + int end; + int start_char; + int end_char; + __pyx_t_5spacy_8typedefs_attr_t label; + __pyx_t_5spacy_8typedefs_attr_t kb_id; +}; + +/* "structs.pxd":36 + * + * + * cdef struct TokenC: # <<<<<<<<<<<<<< + * const LexemeC* lex + * uint64_t morph +*/ +struct __pyx_t_5spacy_7structs_TokenC { + struct __pyx_t_5spacy_7structs_LexemeC const *lex; + uint64_t morph; + enum __pyx_t_5spacy_15parts_of_speech_univ_pos_t pos; + int spacy; + __pyx_t_5spacy_8typedefs_attr_t tag; + int idx; + __pyx_t_5spacy_8typedefs_attr_t lemma; + __pyx_t_5spacy_8typedefs_attr_t norm; + int head; + __pyx_t_5spacy_8typedefs_attr_t dep; + uint32_t l_kids; + uint32_t r_kids; + uint32_t l_edge; + uint32_t r_edge; + int sent_start; + int ent_iob; + __pyx_t_5spacy_8typedefs_attr_t ent_type; + __pyx_t_5spacy_8typedefs_attr_t ent_kb_id; + __pyx_t_5spacy_8typedefs_hash_t ent_id; +}; + +/* "structs.pxd":60 + * + * + * cdef struct MorphAnalysisC: # <<<<<<<<<<<<<< + * hash_t key + * int length +*/ +struct __pyx_t_5spacy_7structs_MorphAnalysisC { + __pyx_t_5spacy_8typedefs_hash_t key; + int length; + __pyx_t_5spacy_8typedefs_attr_t *fields; + __pyx_t_5spacy_8typedefs_attr_t *features; +}; + +/* "structs.pxd":69 + * + * # Internal struct, for storage and disambiguation of entities. + * cdef struct KBEntryC: # <<<<<<<<<<<<<< + * + * # The hash of this entry's unique ID/name in the kB +*/ +struct __pyx_t_5spacy_7structs_KBEntryC { + __pyx_t_5spacy_8typedefs_hash_t entity_hash; + int32_t vector_index; + int32_t feats_row; + float freq; +}; + +/* "structs.pxd":88 + * # Each alias struct stores a list of Entry pointers with their prior probabilities + * # for this specific mention/alias. + * cdef struct AliasC: # <<<<<<<<<<<<<< + * + * # All entry candidates for this alias +*/ +struct __pyx_t_5spacy_7structs_AliasC { + std::vector entry_indices; + std::vector probs; +}; + +/* "structs.pxd":97 + * + * + * cdef struct EdgeC: # <<<<<<<<<<<<<< + * hash_t label + * int32_t head +*/ +struct __pyx_t_5spacy_7structs_EdgeC { + __pyx_t_5spacy_8typedefs_hash_t label; + int32_t head; + int32_t tail; +}; + +/* "structs.pxd":103 + * + * + * cdef struct GraphC: # <<<<<<<<<<<<<< + * vector[vector[int32_t]] nodes + * vector[EdgeC] edges +*/ +struct __pyx_t_5spacy_7structs_GraphC { + std::vector > nodes; + std::vector edges; + std::vector weights; + std::vector n_heads; + std::vector n_tails; + std::vector first_head; + std::vector first_tail; + std::unordered_set *roots; + std::unordered_map<__pyx_t_5spacy_8typedefs_hash_t,int> *node_map; + std::unordered_map<__pyx_t_5spacy_8typedefs_hash_t,int> *edge_map; +}; + +/* "attrs.pxd":5 + * + * + * cdef enum attr_id_t: # <<<<<<<<<<<<<< + * NULL_ATTR + * IS_ALPHA +*/ +enum __pyx_t_5spacy_5attrs_attr_id_t { + + /* "attrs.pxd":96 + * ENT_KB_ID = symbols.ENT_KB_ID + * MORPH + * ENT_ID = symbols.ENT_ID # <<<<<<<<<<<<<< + * + * IDX +*/ + __pyx_e_5spacy_5attrs_NULL_ATTR, + __pyx_e_5spacy_5attrs_IS_ALPHA, + __pyx_e_5spacy_5attrs_IS_ASCII, + __pyx_e_5spacy_5attrs_IS_DIGIT, + __pyx_e_5spacy_5attrs_IS_LOWER, + __pyx_e_5spacy_5attrs_IS_PUNCT, + __pyx_e_5spacy_5attrs_IS_SPACE, + __pyx_e_5spacy_5attrs_IS_TITLE, + __pyx_e_5spacy_5attrs_IS_UPPER, + __pyx_e_5spacy_5attrs_LIKE_URL, + __pyx_e_5spacy_5attrs_LIKE_NUM, + __pyx_e_5spacy_5attrs_LIKE_EMAIL, + __pyx_e_5spacy_5attrs_IS_STOP, + __pyx_e_5spacy_5attrs_IS_OOV_DEPRECATED, + __pyx_e_5spacy_5attrs_IS_BRACKET, + __pyx_e_5spacy_5attrs_IS_QUOTE, + __pyx_e_5spacy_5attrs_IS_LEFT_PUNCT, + __pyx_e_5spacy_5attrs_IS_RIGHT_PUNCT, + __pyx_e_5spacy_5attrs_IS_CURRENCY, + __pyx_e_5spacy_5attrs_FLAG19 = 19, + __pyx_e_5spacy_5attrs_FLAG20, + __pyx_e_5spacy_5attrs_FLAG21, + __pyx_e_5spacy_5attrs_FLAG22, + __pyx_e_5spacy_5attrs_FLAG23, + __pyx_e_5spacy_5attrs_FLAG24, + __pyx_e_5spacy_5attrs_FLAG25, + __pyx_e_5spacy_5attrs_FLAG26, + __pyx_e_5spacy_5attrs_FLAG27, + __pyx_e_5spacy_5attrs_FLAG28, + __pyx_e_5spacy_5attrs_FLAG29, + __pyx_e_5spacy_5attrs_FLAG30, + __pyx_e_5spacy_5attrs_FLAG31, + __pyx_e_5spacy_5attrs_FLAG32, + __pyx_e_5spacy_5attrs_FLAG33, + __pyx_e_5spacy_5attrs_FLAG34, + __pyx_e_5spacy_5attrs_FLAG35, + __pyx_e_5spacy_5attrs_FLAG36, + __pyx_e_5spacy_5attrs_FLAG37, + __pyx_e_5spacy_5attrs_FLAG38, + __pyx_e_5spacy_5attrs_FLAG39, + __pyx_e_5spacy_5attrs_FLAG40, + __pyx_e_5spacy_5attrs_FLAG41, + __pyx_e_5spacy_5attrs_FLAG42, + __pyx_e_5spacy_5attrs_FLAG43, + __pyx_e_5spacy_5attrs_FLAG44, + __pyx_e_5spacy_5attrs_FLAG45, + __pyx_e_5spacy_5attrs_FLAG46, + __pyx_e_5spacy_5attrs_FLAG47, + __pyx_e_5spacy_5attrs_FLAG48, + __pyx_e_5spacy_5attrs_FLAG49, + __pyx_e_5spacy_5attrs_FLAG50, + __pyx_e_5spacy_5attrs_FLAG51, + __pyx_e_5spacy_5attrs_FLAG52, + __pyx_e_5spacy_5attrs_FLAG53, + __pyx_e_5spacy_5attrs_FLAG54, + __pyx_e_5spacy_5attrs_FLAG55, + __pyx_e_5spacy_5attrs_FLAG56, + __pyx_e_5spacy_5attrs_FLAG57, + __pyx_e_5spacy_5attrs_FLAG58, + __pyx_e_5spacy_5attrs_FLAG59, + __pyx_e_5spacy_5attrs_FLAG60, + __pyx_e_5spacy_5attrs_FLAG61, + __pyx_e_5spacy_5attrs_FLAG62, + __pyx_e_5spacy_5attrs_FLAG63, + __pyx_e_5spacy_5attrs_ID, + __pyx_e_5spacy_5attrs_ORTH, + __pyx_e_5spacy_5attrs_LOWER, + __pyx_e_5spacy_5attrs_NORM, + __pyx_e_5spacy_5attrs_SHAPE, + __pyx_e_5spacy_5attrs_PREFIX, + __pyx_e_5spacy_5attrs_SUFFIX, + __pyx_e_5spacy_5attrs_LENGTH, + __pyx_e_5spacy_5attrs_CLUSTER, + __pyx_e_5spacy_5attrs_LEMMA, + __pyx_e_5spacy_5attrs_POS, + __pyx_e_5spacy_5attrs_TAG, + __pyx_e_5spacy_5attrs_DEP, + __pyx_e_5spacy_5attrs_ENT_IOB, + __pyx_e_5spacy_5attrs_ENT_TYPE, + __pyx_e_5spacy_5attrs_HEAD, + __pyx_e_5spacy_5attrs_SENT_START, + __pyx_e_5spacy_5attrs_SPACY, + __pyx_e_5spacy_5attrs_PROB, + __pyx_e_5spacy_5attrs_LANG, + __pyx_e_5spacy_5attrs_ENT_KB_ID = __pyx_e_5spacy_7symbols_ENT_KB_ID, + __pyx_e_5spacy_5attrs_MORPH, + __pyx_e_5spacy_5attrs_ENT_ID = __pyx_e_5spacy_7symbols_ENT_ID, + __pyx_e_5spacy_5attrs_IDX, + __pyx_e_5spacy_5attrs_SENT_END +}; +union __pyx_t_5spacy_5vocab_LexemesOrTokens; +struct __pyx_t_5spacy_5vocab__Cached; + +/* "vocab.pxd":15 + * + * + * cdef union LexemesOrTokens: # <<<<<<<<<<<<<< + * const LexemeC* const* lexemes + * const TokenC* tokens +*/ +union __pyx_t_5spacy_5vocab_LexemesOrTokens { + struct __pyx_t_5spacy_7structs_LexemeC const *const *lexemes; + struct __pyx_t_5spacy_7structs_TokenC const *tokens; +}; + +/* "vocab.pxd":20 + * + * + * cdef struct _Cached: # <<<<<<<<<<<<<< + * LexemesOrTokens data + * bint is_lex +*/ +struct __pyx_t_5spacy_5vocab__Cached { + union __pyx_t_5spacy_5vocab_LexemesOrTokens data; + int is_lex; + int length; +}; + +/* "tokens/doc.pxd":14 + * + * + * ctypedef const LexemeC* const_Lexeme_ptr # <<<<<<<<<<<<<< + * ctypedef const TokenC* const_TokenC_ptr + * +*/ +typedef struct __pyx_t_5spacy_7structs_LexemeC const *__pyx_t_5spacy_6tokens_3doc_const_Lexeme_ptr; + +/* "tokens/doc.pxd":15 + * + * ctypedef const LexemeC* const_Lexeme_ptr + * ctypedef const TokenC* const_TokenC_ptr # <<<<<<<<<<<<<< + * + * ctypedef fused LexemeOrToken: +*/ +typedef struct __pyx_t_5spacy_7structs_TokenC const *__pyx_t_5spacy_6tokens_3doc_const_TokenC_ptr; +struct __pyx_t_5spacy_8pipeline_17_parser_internals_6_state_ArcC; +struct __pyx_t_5spacy_8pipeline_17_parser_internals_6_state_StateC; + +/* "_state.pxd":23 + * return Lexeme.c_check_flag(token.lex, IS_SPACE) + * + * cdef struct ArcC: # <<<<<<<<<<<<<< + * int head + * int child +*/ +struct __pyx_t_5spacy_8pipeline_17_parser_internals_6_state_ArcC { + int head; + int child; + __pyx_t_5spacy_8typedefs_attr_t label; +}; +struct __pyx_t_5spacy_8pipeline_17_parser_internals_6_state_StateC { + + /* "_state.pxd":29 + * + * + * cdef cppclass StateC: # <<<<<<<<<<<<<< + * int* _heads + * const TokenC* _sent +*/ + int *_heads; + struct __pyx_t_5spacy_7structs_TokenC const *_sent; + std::vector _stack; + std::vector _rebuffer; + std::vector _ents; + std::unordered_map > _left_arcs; + std::unordered_map > _right_arcs; + std::vector _unshiftable; + std::set _sent_starts; + struct __pyx_t_5spacy_7structs_TokenC _empty_token; + int length; + int offset; + int _b_i; + void __pyx_f___init__StateC(struct __pyx_t_5spacy_7structs_TokenC const *, int); + void __pyx_f___dealloc__StateC(void); + virtual void set_context_tokens(int *, int); + virtual int S(int) const; + virtual int B(int) const; + virtual struct __pyx_t_5spacy_7structs_TokenC const *B_(int) const; + virtual struct __pyx_t_5spacy_7structs_TokenC const *E_(int) const; + virtual struct __pyx_t_5spacy_7structs_TokenC const *safe_get(int) const; + virtual void map_get_arcs(std::unordered_map > const &, std::vector *) const; + virtual void get_arcs(std::vector *) const; + virtual int H(int) const; + virtual int E(int) const; + virtual int nth_child(std::unordered_map > const &, int, int) const; + virtual int L(int, int) const; + virtual int R(int, int) const; + virtual int empty(void) const; + virtual int eol(void) const; + virtual int is_final(void) const; + virtual int cannot_sent_start(int) const; + virtual int is_sent_start(int) const; + virtual void set_sent_start(int, int); + virtual int has_head(int) const; + virtual int l_edge(int) const; + virtual int r_edge(int) const; + virtual int n_arcs(std::unordered_map > const &, int) const; + virtual int n_L(int) const; + virtual int n_R(int) const; + virtual int stack_is_connected(void) const; + virtual int entity_is_open(void) const; + virtual int stack_depth(void) const; + virtual int buffer_length(void) const; + virtual void push(void); + virtual void pop(void); + virtual void force_final(void); + virtual void unshift(void); + virtual int is_unshiftable(int) const; + virtual void set_reshiftable(int); + virtual void add_arc(int, int, __pyx_t_5spacy_8typedefs_attr_t); + virtual void map_del_arc(std::unordered_map > *, int, int); + virtual void del_arc(int, int); + virtual struct __pyx_t_5spacy_7structs_SpanC get_ent(void) const; + virtual void open_ent(__pyx_t_5spacy_8typedefs_attr_t); + virtual void close_ent(void); + virtual void clone(__pyx_t_5spacy_8pipeline_17_parser_internals_6_state_StateC const *); + __pyx_t_5spacy_8pipeline_17_parser_internals_6_state_StateC(struct __pyx_t_5spacy_7structs_TokenC const *__pyx_v_sent, int __pyx_v_length) { + __pyx_f___init__StateC(__pyx_v_sent, __pyx_v_length); + } + virtual ~__pyx_t_5spacy_8pipeline_17_parser_internals_6_state_StateC() { + __pyx_f___dealloc__StateC(); + } +}; +struct __pyx_t_5spacy_8pipeline_17_parser_internals_17transition_system_Transition; + +/* "spacy/pipeline/_parser_internals/transition_system.pxd":11 + * + * + * cdef struct Transition: # <<<<<<<<<<<<<< + * int clas + * int move +*/ +struct __pyx_t_5spacy_8pipeline_17_parser_internals_17transition_system_Transition { + int clas; + int move; + __pyx_t_5spacy_8typedefs_attr_t label; + __pyx_t_5spacy_8typedefs_weight_t score; + int (*is_valid)(__pyx_t_5spacy_8pipeline_17_parser_internals_6_state_StateC const *, __pyx_t_5spacy_8typedefs_attr_t); + __pyx_t_5spacy_8typedefs_weight_t (*get_cost)(__pyx_t_5spacy_8pipeline_17_parser_internals_6_state_StateC const *, void const *, __pyx_t_5spacy_8typedefs_attr_t); + int (*__pyx_do)(__pyx_t_5spacy_8pipeline_17_parser_internals_6_state_StateC *, __pyx_t_5spacy_8typedefs_attr_t); +}; + +/* "spacy/pipeline/_parser_internals/transition_system.pxd":23 + * + * + * ctypedef weight_t (*get_cost_func_t)( # <<<<<<<<<<<<<< + * const StateC* state, const void* gold, attr_tlabel + * ) noexcept nogil +*/ +typedef __pyx_t_5spacy_8typedefs_weight_t (*__pyx_t_5spacy_8pipeline_17_parser_internals_17transition_system_get_cost_func_t)(__pyx_t_5spacy_8pipeline_17_parser_internals_6_state_StateC const *, void const *, PyObject *); + +/* "spacy/pipeline/_parser_internals/transition_system.pxd":26 + * const StateC* state, const void* gold, attr_tlabel + * ) noexcept nogil + * ctypedef weight_t (*move_cost_func_t)( # <<<<<<<<<<<<<< + * const StateC* state, const void* gold + * ) noexcept nogil +*/ +typedef __pyx_t_5spacy_8typedefs_weight_t (*__pyx_t_5spacy_8pipeline_17_parser_internals_17transition_system_move_cost_func_t)(__pyx_t_5spacy_8pipeline_17_parser_internals_6_state_StateC const *, void const *); + +/* "spacy/pipeline/_parser_internals/transition_system.pxd":29 + * const StateC* state, const void* gold + * ) noexcept nogil + * ctypedef weight_t (*label_cost_func_t)( # <<<<<<<<<<<<<< + * const StateC* state, const void* gold, attr_t label + * ) noexcept nogil +*/ +typedef __pyx_t_5spacy_8typedefs_weight_t (*__pyx_t_5spacy_8pipeline_17_parser_internals_17transition_system_label_cost_func_t)(__pyx_t_5spacy_8pipeline_17_parser_internals_6_state_StateC const *, void const *, __pyx_t_5spacy_8typedefs_attr_t); + +/* "spacy/pipeline/_parser_internals/transition_system.pxd":33 + * ) noexcept nogil + * + * ctypedef int (*do_func_t)(StateC* state, attr_t label) noexcept nogil # <<<<<<<<<<<<<< + * + * ctypedef void* (*init_state_t)(Pool mem, int length, void* tokens) except NULL +*/ +typedef int (*__pyx_t_5spacy_8pipeline_17_parser_internals_17transition_system_do_func_t)(__pyx_t_5spacy_8pipeline_17_parser_internals_6_state_StateC *, __pyx_t_5spacy_8typedefs_attr_t); + +/* "spacy/pipeline/_parser_internals/transition_system.pxd":35 + * ctypedef int (*do_func_t)(StateC* state, attr_t label) noexcept nogil + * + * ctypedef void* (*init_state_t)(Pool mem, int length, void* tokens) except NULL # <<<<<<<<<<<<<< + * + * ctypedef int (*del_state_t)(Pool mem, void* state, void* extra_args) except -1 +*/ +typedef void *(*__pyx_t_5spacy_8pipeline_17_parser_internals_17transition_system_init_state_t)(struct __pyx_obj_5cymem_5cymem_Pool *, int, void *); + +/* "spacy/pipeline/_parser_internals/transition_system.pxd":37 + * ctypedef void* (*init_state_t)(Pool mem, int length, void* tokens) except NULL + * + * ctypedef int (*del_state_t)(Pool mem, void* state, void* extra_args) except -1 # <<<<<<<<<<<<<< + * + * cdef class TransitionSystem: +*/ +typedef int (*__pyx_t_5spacy_8pipeline_17_parser_internals_17transition_system_del_state_t)(struct __pyx_obj_5cymem_5cymem_Pool *, void *, void *); + +/* "cymem/cymem.pxd":4 + * ctypedef void (*free_t)(void *p) + * + * cdef class PyMalloc: # <<<<<<<<<<<<<< + * cdef malloc_t malloc + * cdef void _set(self, malloc_t malloc) +*/ +struct __pyx_obj_5cymem_5cymem_PyMalloc { + PyObject_HEAD + struct __pyx_vtabstruct_5cymem_5cymem_PyMalloc *__pyx_vtab; + __pyx_t_5cymem_5cymem_malloc_t malloc; +}; + + +/* "cymem/cymem.pxd":10 + * cdef PyMalloc WrapMalloc(malloc_t malloc) + * + * cdef class PyFree: # <<<<<<<<<<<<<< + * cdef free_t free + * cdef void _set(self, free_t free) +*/ +struct __pyx_obj_5cymem_5cymem_PyFree { + PyObject_HEAD + struct __pyx_vtabstruct_5cymem_5cymem_PyFree *__pyx_vtab; + __pyx_t_5cymem_5cymem_free_t free; +}; + + +/* "cymem/cymem.pxd":16 + * cdef PyFree WrapFree(free_t free) + * + * cdef class Pool: # <<<<<<<<<<<<<< + * cdef readonly size_t size + * cdef readonly dict addresses +*/ +struct __pyx_obj_5cymem_5cymem_Pool { + PyObject_HEAD + struct __pyx_vtabstruct_5cymem_5cymem_Pool *__pyx_vtab; + size_t size; + PyObject *addresses; + PyObject *refs; + struct __pyx_obj_5cymem_5cymem_PyMalloc *pymalloc; + struct __pyx_obj_5cymem_5cymem_PyFree *pyfree; +}; + + +/* "cymem/cymem.pxd":28 + * + * + * cdef class Address: # <<<<<<<<<<<<<< + * cdef void* ptr + * cdef readonly PyMalloc pymalloc +*/ +struct __pyx_obj_5cymem_5cymem_Address { + PyObject_HEAD + void *ptr; + struct __pyx_obj_5cymem_5cymem_PyMalloc *pymalloc; + struct __pyx_obj_5cymem_5cymem_PyFree *pyfree; +}; + + +/* "preshed/maps.pxd":45 + * + * + * cdef class PreshMap: # <<<<<<<<<<<<<< + * cdef MapStruct* c_map + * cdef Pool mem +*/ +struct __pyx_obj_7preshed_4maps_PreshMap { + PyObject_HEAD + struct __pyx_vtabstruct_7preshed_4maps_PreshMap *__pyx_vtab; + struct __pyx_t_7preshed_4maps_MapStruct *c_map; + struct __pyx_obj_5cymem_5cymem_Pool *mem; +}; + + +/* "preshed/maps.pxd":53 + * + * + * cdef class PreshMapArray: # <<<<<<<<<<<<<< + * cdef Pool mem + * cdef MapStruct* maps +*/ +struct __pyx_obj_7preshed_4maps_PreshMapArray { + PyObject_HEAD + struct __pyx_vtabstruct_7preshed_4maps_PreshMapArray *__pyx_vtab; + struct __pyx_obj_5cymem_5cymem_Pool *mem; + struct __pyx_t_7preshed_4maps_MapStruct *maps; + size_t length; +}; + + +/* "strings.pxd":22 + * + * + * cdef class StringStore: # <<<<<<<<<<<<<< + * cdef Pool mem + * +*/ +struct __pyx_obj_5spacy_7strings_StringStore { + PyObject_HEAD + struct __pyx_vtabstruct_5spacy_7strings_StringStore *__pyx_vtab; + struct __pyx_obj_5cymem_5cymem_Pool *mem; + std::vector<__pyx_t_5spacy_8typedefs_hash_t> keys; + struct __pyx_obj_7preshed_4maps_PreshMap *_map; + std::vector<__pyx_t_5spacy_8typedefs_hash_t> _transient_keys; + struct __pyx_obj_5cymem_5cymem_Pool *_non_temp_mem; +}; + + +/* "morphology.pxd":11 + * + * + * cdef class Morphology: # <<<<<<<<<<<<<< + * cdef readonly Pool mem + * cdef readonly StringStore strings +*/ +struct __pyx_obj_5spacy_10morphology_Morphology { + PyObject_HEAD + struct __pyx_vtabstruct_5spacy_10morphology_Morphology *__pyx_vtab; + struct __pyx_obj_5cymem_5cymem_Pool *mem; + struct __pyx_obj_5spacy_7strings_StringStore *strings; + struct __pyx_obj_7preshed_4maps_PreshMap *tags; +}; + + +/* "vocab.pxd":26 + * + * + * cdef class Vocab: # <<<<<<<<<<<<<< + * cdef Pool mem + * cdef readonly StringStore strings +*/ +struct __pyx_obj_5spacy_5vocab_Vocab { + PyObject_HEAD + struct __pyx_vtabstruct_5spacy_5vocab_Vocab *__pyx_vtab; + struct __pyx_obj_5cymem_5cymem_Pool *mem; + struct __pyx_obj_5spacy_7strings_StringStore *strings; + struct __pyx_obj_5spacy_10morphology_Morphology *morphology; + PyObject *_vectors; + PyObject *_lookups; + PyObject *writing_system; + PyObject *get_noun_chunks; + int length; + PyObject *_unused_object; + PyObject *lex_attr_getters; + PyObject *cfg; + struct __pyx_obj_7preshed_4maps_PreshMap *_by_orth; + struct __pyx_obj_5cymem_5cymem_Pool *_non_temp_mem; + std::vector<__pyx_t_5spacy_8typedefs_attr_t> _transient_orths; +}; + + +/* "tokens/doc.pxd":37 + * + * + * cdef class Doc: # <<<<<<<<<<<<<< + * cdef readonly Pool mem + * cdef readonly Vocab vocab +*/ +struct __pyx_obj_5spacy_6tokens_3doc_Doc { + PyObject_HEAD + struct __pyx_vtabstruct_5spacy_6tokens_3doc_Doc *__pyx_vtab; + struct __pyx_obj_5cymem_5cymem_Pool *mem; + struct __pyx_obj_5spacy_5vocab_Vocab *vocab; + PyObject *_vector; + PyObject *_vector_norm; + PyObject *tensor; + PyObject *cats; + PyObject *user_data; + PyObject *spans; + struct __pyx_t_5spacy_7structs_TokenC *c; + float sentiment; + PyObject *user_hooks; + PyObject *user_token_hooks; + PyObject *user_span_hooks; + int has_unknown_spaces; + PyObject *_context; + int length; + int max_length; + PyObject *noun_chunks_iterator; + PyObject *__weakref__; +}; + + +/* "training/example.pxd":6 + * + * + * cdef class Example: # <<<<<<<<<<<<<< + * cdef readonly Doc x + * cdef readonly Doc y +*/ +struct __pyx_obj_5spacy_8training_7example_Example { + PyObject_HEAD + struct __pyx_obj_5spacy_6tokens_3doc_Doc *x; + struct __pyx_obj_5spacy_6tokens_3doc_Doc *y; + PyObject *_cached_alignment; + PyObject *_cached_words_x; + PyObject *_cached_words_y; + uint64_t _x_sig; + uint64_t _y_sig; +}; + + +/* "lexeme.pxd":24 + * cdef attr_t OOV_RANK + * + * cdef class Lexeme: # <<<<<<<<<<<<<< + * cdef LexemeC* c + * cdef readonly Vocab vocab +*/ +struct __pyx_obj_5spacy_6lexeme_Lexeme { + PyObject_HEAD + struct __pyx_vtabstruct_5spacy_6lexeme_Lexeme *__pyx_vtab; + struct __pyx_t_5spacy_7structs_LexemeC *c; + struct __pyx_obj_5spacy_5vocab_Vocab *vocab; + __pyx_t_5spacy_8typedefs_attr_t orth; +}; + + +/* "stateclass.pxd":9 + * + * + * cdef class StateClass: # <<<<<<<<<<<<<< + * cdef StateC* c + * cdef readonly Doc doc +*/ +struct __pyx_obj_5spacy_8pipeline_17_parser_internals_10stateclass_StateClass { + PyObject_HEAD + struct __pyx_vtabstruct_5spacy_8pipeline_17_parser_internals_10stateclass_StateClass *__pyx_vtab; + __pyx_t_5spacy_8pipeline_17_parser_internals_6_state_StateC *c; + struct __pyx_obj_5spacy_6tokens_3doc_Doc *doc; + int _borrowed; +}; + + +/* "spacy/pipeline/_parser_internals/transition_system.pxd":39 + * ctypedef int (*del_state_t)(Pool mem, void* state, void* extra_args) except -1 + * + * cdef class TransitionSystem: # <<<<<<<<<<<<<< + * cdef Pool mem + * cdef StringStore strings +*/ +struct __pyx_obj_5spacy_8pipeline_17_parser_internals_17transition_system_TransitionSystem { + PyObject_HEAD + struct __pyx_vtabstruct_5spacy_8pipeline_17_parser_internals_17transition_system_TransitionSystem *__pyx_vtab; + struct __pyx_obj_5cymem_5cymem_Pool *mem; + struct __pyx_obj_5spacy_7strings_StringStore *strings; + struct __pyx_t_5spacy_8pipeline_17_parser_internals_17transition_system_Transition *c; + int n_moves; + int _size; + __pyx_t_5spacy_8typedefs_attr_t root_label; + PyObject *freqs; + PyObject *labels; + PyObject *cfg; + __pyx_t_5spacy_8pipeline_17_parser_internals_17transition_system_init_state_t init_beam_state; + __pyx_t_5spacy_8pipeline_17_parser_internals_17transition_system_del_state_t del_beam_state; +}; + + +/* "spacy/pipeline/_parser_internals/transition_system.pyx":231 + * return self + * + * def to_bytes(self, exclude=tuple()): # <<<<<<<<<<<<<< + * serializers = { + * 'moves': lambda: srsly.json_dumps(self.labels), +*/ +struct __pyx_obj_5spacy_8pipeline_17_parser_internals_17transition_system___pyx_scope_struct__to_bytes { + PyObject_HEAD + struct __pyx_obj_5spacy_8pipeline_17_parser_internals_17transition_system_TransitionSystem *__pyx_v_self; +}; + + +/* "View.MemoryView":110 + * + * + * @cython.collection_type("sequence") # <<<<<<<<<<<<<< + * @cname("__pyx_array") + * cdef class array: +*/ +struct __pyx_array_obj { + PyObject_HEAD + struct __pyx_vtabstruct_array *__pyx_vtab; + char *data; + Py_ssize_t len; + char *format; + int ndim; + Py_ssize_t *_shape; + Py_ssize_t *_strides; + Py_ssize_t itemsize; + PyObject *mode; + PyObject *_format; + void (*callback_free_data)(void *); + int free_data; + int dtype_is_object; +}; + + +/* "View.MemoryView":299 + * + * + * @cname('__pyx_MemviewEnum') # <<<<<<<<<<<<<< + * cdef class Enum(object): + * cdef object name +*/ +struct __pyx_MemviewEnum_obj { + PyObject_HEAD + PyObject *name; +}; + + +/* "View.MemoryView":334 + * + * + * @cname('__pyx_memoryview') # <<<<<<<<<<<<<< + * cdef class memoryview: + * +*/ +struct __pyx_memoryview_obj { + PyObject_HEAD + struct __pyx_vtabstruct_memoryview *__pyx_vtab; + PyObject *obj; + PyObject *_size; + void *_unused; + PyThread_type_lock lock; + __pyx_atomic_int_type acquisition_count; + Py_buffer view; + int flags; + int dtype_is_object; + __Pyx_TypeInfo const *typeinfo; +}; + + +/* "View.MemoryView":951 + * + * + * @cython.collection_type("sequence") # <<<<<<<<<<<<<< + * @cname('__pyx_memoryviewslice') + * cdef class _memoryviewslice(memoryview): +*/ +struct __pyx_memoryviewslice_obj { + struct __pyx_memoryview_obj __pyx_base; + __Pyx_memviewslice from_slice; + PyObject *from_object; + PyObject *(*to_object_func)(char *); + int (*to_dtype_func)(char *, PyObject *); +}; + + + +/* "cymem/cymem.pxd":4 + * ctypedef void (*free_t)(void *p) + * + * cdef class PyMalloc: # <<<<<<<<<<<<<< + * cdef malloc_t malloc + * cdef void _set(self, malloc_t malloc) +*/ + +struct __pyx_vtabstruct_5cymem_5cymem_PyMalloc { + void (*_set)(struct __pyx_obj_5cymem_5cymem_PyMalloc *, __pyx_t_5cymem_5cymem_malloc_t); +}; +static struct __pyx_vtabstruct_5cymem_5cymem_PyMalloc *__pyx_vtabptr_5cymem_5cymem_PyMalloc; + + +/* "cymem/cymem.pxd":10 + * cdef PyMalloc WrapMalloc(malloc_t malloc) + * + * cdef class PyFree: # <<<<<<<<<<<<<< + * cdef free_t free + * cdef void _set(self, free_t free) +*/ + +struct __pyx_vtabstruct_5cymem_5cymem_PyFree { + void (*_set)(struct __pyx_obj_5cymem_5cymem_PyFree *, __pyx_t_5cymem_5cymem_free_t); +}; +static struct __pyx_vtabstruct_5cymem_5cymem_PyFree *__pyx_vtabptr_5cymem_5cymem_PyFree; + + +/* "cymem/cymem.pxd":16 + * cdef PyFree WrapFree(free_t free) + * + * cdef class Pool: # <<<<<<<<<<<<<< + * cdef readonly size_t size + * cdef readonly dict addresses +*/ + +struct __pyx_vtabstruct_5cymem_5cymem_Pool { + void *(*alloc)(struct __pyx_obj_5cymem_5cymem_Pool *, size_t, size_t); + void (*free)(struct __pyx_obj_5cymem_5cymem_Pool *, void *); + void *(*realloc)(struct __pyx_obj_5cymem_5cymem_Pool *, void *, size_t); +}; +static struct __pyx_vtabstruct_5cymem_5cymem_Pool *__pyx_vtabptr_5cymem_5cymem_Pool; + + +/* "preshed/maps.pxd":45 + * + * + * cdef class PreshMap: # <<<<<<<<<<<<<< + * cdef MapStruct* c_map + * cdef Pool mem +*/ + +struct __pyx_vtabstruct_7preshed_4maps_PreshMap { + void *(*get)(struct __pyx_obj_7preshed_4maps_PreshMap *, __pyx_t_7preshed_4maps_key_t); + void (*set)(struct __pyx_obj_7preshed_4maps_PreshMap *, __pyx_t_7preshed_4maps_key_t, void *); +}; +static struct __pyx_vtabstruct_7preshed_4maps_PreshMap *__pyx_vtabptr_7preshed_4maps_PreshMap; + + +/* "preshed/maps.pxd":53 + * + * + * cdef class PreshMapArray: # <<<<<<<<<<<<<< + * cdef Pool mem + * cdef MapStruct* maps +*/ + +struct __pyx_vtabstruct_7preshed_4maps_PreshMapArray { + void *(*get)(struct __pyx_obj_7preshed_4maps_PreshMapArray *, size_t, __pyx_t_7preshed_4maps_key_t); + void (*set)(struct __pyx_obj_7preshed_4maps_PreshMapArray *, size_t, __pyx_t_7preshed_4maps_key_t, void *); +}; +static struct __pyx_vtabstruct_7preshed_4maps_PreshMapArray *__pyx_vtabptr_7preshed_4maps_PreshMapArray; + + +/* "strings.pxd":22 + * + * + * cdef class StringStore: # <<<<<<<<<<<<<< + * cdef Pool mem + * +*/ + +struct __pyx_vtabstruct_5spacy_7strings_StringStore { + __pyx_t_5spacy_7strings_Utf8Str const *(*intern_unicode)(struct __pyx_obj_5spacy_7strings_StringStore *, PyObject *, int); + __pyx_t_5spacy_7strings_Utf8Str const *(*_intern_utf8)(struct __pyx_obj_5spacy_7strings_StringStore *, char *, int, __pyx_t_5spacy_8typedefs_hash_t *, int); +}; +static struct __pyx_vtabstruct_5spacy_7strings_StringStore *__pyx_vtabptr_5spacy_7strings_StringStore; + + +/* "morphology.pxd":11 + * + * + * cdef class Morphology: # <<<<<<<<<<<<<< + * cdef readonly Pool mem + * cdef readonly StringStore strings +*/ + +struct __pyx_vtabstruct_5spacy_10morphology_Morphology { + struct __pyx_t_5spacy_7structs_MorphAnalysisC (*create_morph_tag)(struct __pyx_obj_5spacy_10morphology_Morphology *, PyObject *); + int (*insert)(struct __pyx_obj_5spacy_10morphology_Morphology *, struct __pyx_t_5spacy_7structs_MorphAnalysisC); +}; +static struct __pyx_vtabstruct_5spacy_10morphology_Morphology *__pyx_vtabptr_5spacy_10morphology_Morphology; + + +/* "vocab.pxd":26 + * + * + * cdef class Vocab: # <<<<<<<<<<<<<< + * cdef Pool mem + * cdef readonly StringStore strings +*/ + +struct __pyx_vtabstruct_5spacy_5vocab_Vocab { + struct __pyx_t_5spacy_7structs_LexemeC const *(*get)(struct __pyx_obj_5spacy_5vocab_Vocab *, struct __pyx_obj_5cymem_5cymem_Pool *, PyObject *); + struct __pyx_t_5spacy_7structs_LexemeC const *(*get_by_orth)(struct __pyx_obj_5spacy_5vocab_Vocab *, struct __pyx_obj_5cymem_5cymem_Pool *, __pyx_t_5spacy_8typedefs_attr_t); + struct __pyx_t_5spacy_7structs_TokenC const *(*make_fused_token)(struct __pyx_obj_5spacy_5vocab_Vocab *, PyObject *); + struct __pyx_t_5spacy_7structs_LexemeC const *(*_new_lexeme)(struct __pyx_obj_5spacy_5vocab_Vocab *, struct __pyx_obj_5cymem_5cymem_Pool *, PyObject *); + int (*_add_lex_to_vocab)(struct __pyx_obj_5spacy_5vocab_Vocab *, __pyx_t_5spacy_8typedefs_hash_t, struct __pyx_t_5spacy_7structs_LexemeC const *, int); +}; +static struct __pyx_vtabstruct_5spacy_5vocab_Vocab *__pyx_vtabptr_5spacy_5vocab_Vocab; + + +/* "tokens/doc.pxd":37 + * + * + * cdef class Doc: # <<<<<<<<<<<<<< + * cdef readonly Pool mem + * cdef readonly Vocab vocab +*/ + +struct __pyx_vtabstruct_5spacy_6tokens_3doc_Doc { + PyArrayObject *(*to_array)(struct __pyx_obj_5spacy_6tokens_3doc_Doc *, PyObject *, int __pyx_skip_dispatch); + int (*__pyx_fuse_0push_back)(struct __pyx_obj_5spacy_6tokens_3doc_Doc *, __pyx_t_5spacy_6tokens_3doc_const_Lexeme_ptr, int); + int (*__pyx_fuse_1push_back)(struct __pyx_obj_5spacy_6tokens_3doc_Doc *, __pyx_t_5spacy_6tokens_3doc_const_TokenC_ptr, int); +}; +static struct __pyx_vtabstruct_5spacy_6tokens_3doc_Doc *__pyx_vtabptr_5spacy_6tokens_3doc_Doc; + + +/* "lexeme.pxd":24 + * cdef attr_t OOV_RANK + * + * cdef class Lexeme: # <<<<<<<<<<<<<< + * cdef LexemeC* c + * cdef readonly Vocab vocab +*/ + +struct __pyx_vtabstruct_5spacy_6lexeme_Lexeme { + struct __pyx_obj_5spacy_6lexeme_Lexeme *(*from_ptr)(struct __pyx_t_5spacy_7structs_LexemeC *, struct __pyx_obj_5spacy_5vocab_Vocab *); + void (*set_struct_attr)(struct __pyx_t_5spacy_7structs_LexemeC *, enum __pyx_t_5spacy_5attrs_attr_id_t, __pyx_t_5spacy_8typedefs_attr_t); + __pyx_t_5spacy_8typedefs_attr_t (*get_struct_attr)(struct __pyx_t_5spacy_7structs_LexemeC const *, enum __pyx_t_5spacy_5attrs_attr_id_t); + int (*c_check_flag)(struct __pyx_t_5spacy_7structs_LexemeC const *, enum __pyx_t_5spacy_5attrs_attr_id_t); + int (*c_set_flag)(struct __pyx_t_5spacy_7structs_LexemeC *, enum __pyx_t_5spacy_5attrs_attr_id_t, int); +}; +static struct __pyx_vtabstruct_5spacy_6lexeme_Lexeme *__pyx_vtabptr_5spacy_6lexeme_Lexeme; +static CYTHON_INLINE struct __pyx_obj_5spacy_6lexeme_Lexeme *__pyx_f_5spacy_6lexeme_6Lexeme_from_ptr(struct __pyx_t_5spacy_7structs_LexemeC *, struct __pyx_obj_5spacy_5vocab_Vocab *); +static CYTHON_INLINE void __pyx_f_5spacy_6lexeme_6Lexeme_set_struct_attr(struct __pyx_t_5spacy_7structs_LexemeC *, enum __pyx_t_5spacy_5attrs_attr_id_t, __pyx_t_5spacy_8typedefs_attr_t); +static CYTHON_INLINE __pyx_t_5spacy_8typedefs_attr_t __pyx_f_5spacy_6lexeme_6Lexeme_get_struct_attr(struct __pyx_t_5spacy_7structs_LexemeC const *, enum __pyx_t_5spacy_5attrs_attr_id_t); +static CYTHON_INLINE int __pyx_f_5spacy_6lexeme_6Lexeme_c_check_flag(struct __pyx_t_5spacy_7structs_LexemeC const *, enum __pyx_t_5spacy_5attrs_attr_id_t); +static CYTHON_INLINE int __pyx_f_5spacy_6lexeme_6Lexeme_c_set_flag(struct __pyx_t_5spacy_7structs_LexemeC *, enum __pyx_t_5spacy_5attrs_attr_id_t, int); + + +/* "stateclass.pxd":9 + * + * + * cdef class StateClass: # <<<<<<<<<<<<<< + * cdef StateC* c + * cdef readonly Doc doc +*/ + +struct __pyx_vtabstruct_5spacy_8pipeline_17_parser_internals_10stateclass_StateClass { + struct __pyx_obj_5spacy_8pipeline_17_parser_internals_10stateclass_StateClass *(*borrow)(__pyx_t_5spacy_8pipeline_17_parser_internals_6_state_StateC *, struct __pyx_obj_5spacy_6tokens_3doc_Doc *); + struct __pyx_obj_5spacy_8pipeline_17_parser_internals_10stateclass_StateClass *(*init_offset)(struct __pyx_t_5spacy_7structs_TokenC const *, int, int); +}; +static struct __pyx_vtabstruct_5spacy_8pipeline_17_parser_internals_10stateclass_StateClass *__pyx_vtabptr_5spacy_8pipeline_17_parser_internals_10stateclass_StateClass; +static CYTHON_INLINE struct __pyx_obj_5spacy_8pipeline_17_parser_internals_10stateclass_StateClass *__pyx_f_5spacy_8pipeline_17_parser_internals_10stateclass_10StateClass_borrow(__pyx_t_5spacy_8pipeline_17_parser_internals_6_state_StateC *, struct __pyx_obj_5spacy_6tokens_3doc_Doc *); +static CYTHON_INLINE struct __pyx_obj_5spacy_8pipeline_17_parser_internals_10stateclass_StateClass *__pyx_f_5spacy_8pipeline_17_parser_internals_10stateclass_10StateClass_init_offset(struct __pyx_t_5spacy_7structs_TokenC const *, int, int); + + +/* "spacy/pipeline/_parser_internals/transition_system.pyx":36 + * + * + * cdef class TransitionSystem: # <<<<<<<<<<<<<< + * def __init__( + * self, +*/ + +struct __pyx_vtabstruct_5spacy_8pipeline_17_parser_internals_17transition_system_TransitionSystem { + struct __pyx_t_5spacy_8pipeline_17_parser_internals_17transition_system_Transition (*lookup_transition)(struct __pyx_obj_5spacy_8pipeline_17_parser_internals_17transition_system_TransitionSystem *, PyObject *); + struct __pyx_t_5spacy_8pipeline_17_parser_internals_17transition_system_Transition (*init_transition)(struct __pyx_obj_5spacy_8pipeline_17_parser_internals_17transition_system_TransitionSystem *, int, int, __pyx_t_5spacy_8typedefs_attr_t); + int (*set_valid)(struct __pyx_obj_5spacy_8pipeline_17_parser_internals_17transition_system_TransitionSystem *, int *, __pyx_t_5spacy_8pipeline_17_parser_internals_6_state_StateC const *); + int (*set_costs)(struct __pyx_obj_5spacy_8pipeline_17_parser_internals_17transition_system_TransitionSystem *, int *, __pyx_t_5spacy_8typedefs_weight_t *, __pyx_t_5spacy_8pipeline_17_parser_internals_6_state_StateC const *, PyObject *); +}; +static struct __pyx_vtabstruct_5spacy_8pipeline_17_parser_internals_17transition_system_TransitionSystem *__pyx_vtabptr_5spacy_8pipeline_17_parser_internals_17transition_system_TransitionSystem; + + +/* "View.MemoryView":110 + * + * + * @cython.collection_type("sequence") # <<<<<<<<<<<<<< + * @cname("__pyx_array") + * cdef class array: +*/ + +struct __pyx_vtabstruct_array { + PyObject *(*get_memview)(struct __pyx_array_obj *); +}; +static struct __pyx_vtabstruct_array *__pyx_vtabptr_array; + + +/* "View.MemoryView":334 + * + * + * @cname('__pyx_memoryview') # <<<<<<<<<<<<<< + * cdef class memoryview: + * +*/ + +struct __pyx_vtabstruct_memoryview { + char *(*get_item_pointer)(struct __pyx_memoryview_obj *, PyObject *); + PyObject *(*is_slice)(struct __pyx_memoryview_obj *, PyObject *); + PyObject *(*setitem_slice_assignment)(struct __pyx_memoryview_obj *, PyObject *, PyObject *); + PyObject *(*setitem_slice_assign_scalar)(struct __pyx_memoryview_obj *, struct __pyx_memoryview_obj *, PyObject *); + PyObject *(*setitem_indexed)(struct __pyx_memoryview_obj *, PyObject *, PyObject *); + PyObject *(*convert_item_to_object)(struct __pyx_memoryview_obj *, char *); + PyObject *(*assign_item_from_object)(struct __pyx_memoryview_obj *, char *, PyObject *); + PyObject *(*_get_base)(struct __pyx_memoryview_obj *); +}; +static struct __pyx_vtabstruct_memoryview *__pyx_vtabptr_memoryview; + + +/* "View.MemoryView":951 + * + * + * @cython.collection_type("sequence") # <<<<<<<<<<<<<< + * @cname('__pyx_memoryviewslice') + * cdef class _memoryviewslice(memoryview): +*/ + +struct __pyx_vtabstruct__memoryviewslice { + struct __pyx_vtabstruct_memoryview __pyx_base; +}; +static struct __pyx_vtabstruct__memoryviewslice *__pyx_vtabptr__memoryviewslice; +/* #### 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); + +/* 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) + +/* RaiseException.export */ +static void __Pyx_Raise(PyObject *type, PyObject *value, PyObject *tb, PyObject *cause); + +/* 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 + +/* RaiseUnexpectedTypeError.proto */ +static int __Pyx_RaiseUnexpectedTypeError(const char *expected, PyObject *obj); + +/* PyMemoryError_Check.proto */ +#define __Pyx_PyExc_MemoryError_Check(obj) __Pyx_TypeCheck(obj, PyExc_MemoryError) + +/* 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); + +/* CIntToPyUnicode.proto */ +#define __Pyx_PyUnicode_From_Py_ssize_t(value, width, padding_char, format_char) (\ + ((format_char) == ('c')) ?\ + __Pyx_uchar___Pyx_PyUnicode_From_Py_ssize_t(value, width, padding_char) :\ + __Pyx____Pyx_PyUnicode_From_Py_ssize_t(value, width, padding_char, format_char)\ + ) +static CYTHON_INLINE PyObject* __Pyx_uchar___Pyx_PyUnicode_From_Py_ssize_t(Py_ssize_t value, Py_ssize_t width, char padding_char); +static CYTHON_INLINE PyObject* __Pyx____Pyx_PyUnicode_From_Py_ssize_t(Py_ssize_t 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); + +/* 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 + +CYTHON_UNUSED static int __pyx_array_getbuffer(PyObject *__pyx_v_self, Py_buffer *__pyx_v_info, int __pyx_v_flags); /*proto*/ +static PyObject *__pyx_array_get_memview(struct __pyx_array_obj *); /*proto*/ +/* GetAttr.proto */ +static CYTHON_INLINE PyObject *__Pyx_GetAttr(PyObject *, PyObject *); + +/* GetItemInt.proto */ +#define __Pyx_GetItemInt(o, i, type, is_signed, to_py_func, is_list, wraparound, boundscheck, has_gil, unsafe_shared)\ + (__Pyx_fits_Py_ssize_t(i, type, is_signed) ?\ + __Pyx_GetItemInt_Fast(o, (Py_ssize_t)i, is_list, wraparound, boundscheck, unsafe_shared) :\ + (is_list ? (PyErr_SetString(PyExc_IndexError, "list index out of range"), (PyObject*)NULL) :\ + __Pyx_GetItemInt_Generic(o, to_py_func(i)))) +#define __Pyx_GetItemInt_List(o, i, type, is_signed, to_py_func, is_list, wraparound, boundscheck, has_gil, unsafe_shared)\ + (__Pyx_fits_Py_ssize_t(i, type, is_signed) ?\ + __Pyx_GetItemInt_List_Fast(o, (Py_ssize_t)i, wraparound, boundscheck, unsafe_shared) :\ + (PyErr_SetString(PyExc_IndexError, "list index out of range"), (PyObject*)NULL)) +static CYTHON_INLINE PyObject *__Pyx_GetItemInt_List_Fast(PyObject *o, Py_ssize_t i, + int wraparound, int boundscheck, int unsafe_shared); +#define __Pyx_GetItemInt_Tuple(o, i, type, is_signed, to_py_func, is_list, wraparound, boundscheck, has_gil, unsafe_shared)\ + (__Pyx_fits_Py_ssize_t(i, type, is_signed) ?\ + __Pyx_GetItemInt_Tuple_Fast(o, (Py_ssize_t)i, wraparound, boundscheck, unsafe_shared) :\ + (PyErr_SetString(PyExc_IndexError, "tuple index out of range"), (PyObject*)NULL)) +static CYTHON_INLINE PyObject *__Pyx_GetItemInt_Tuple_Fast(PyObject *o, Py_ssize_t i, + int wraparound, int boundscheck, int unsafe_shared); +static PyObject *__Pyx_GetItemInt_Generic(PyObject *o, PyObject* j); +static CYTHON_INLINE PyObject *__Pyx_GetItemInt_Fast(PyObject *o, Py_ssize_t i, + int is_list, int wraparound, int boundscheck, int unsafe_shared); + +/* ObjectGetItem.proto */ +#if CYTHON_USE_TYPE_SLOTS +static CYTHON_INLINE PyObject *__Pyx_PyObject_GetItem(PyObject *obj, PyObject *key); +#else +#define __Pyx_PyObject_GetItem(obj, key) PyObject_GetItem(obj, key) +#endif + +/* RejectKeywords.export */ +static void __Pyx_RejectKeywords(const char* function_name, PyObject *kwds); + +/* PyTypeError_Check.proto */ +#define __Pyx_PyExc_TypeError_Check(obj) __Pyx_TypeCheck(obj, PyExc_TypeError) + +/* DivInt[Py_ssize_t].proto */ +static CYTHON_INLINE Py_ssize_t __Pyx_div_Py_ssize_t(Py_ssize_t, Py_ssize_t, int b_is_constant); + +/* UnaryNegOverflows.proto */ +#define __Pyx_UNARY_NEG_WOULD_OVERFLOW(x)\ + (((x) < 0) & ((unsigned long)(x) == 0-(unsigned long)(x))) + +/* GetAttr3.proto */ +static CYTHON_INLINE PyObject *__Pyx_GetAttr3(PyObject *, PyObject *, PyObject *); + +/* 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 + +/* AssertionsEnabled.proto */ +#if CYTHON_COMPILING_IN_LIMITED_API || PY_VERSION_HEX >= 0x030C0000 + static int __pyx_assertions_enabled_flag; + #define __pyx_assertions_enabled() (__pyx_assertions_enabled_flag) + static int __Pyx_init_assertions_enabled(void) { + PyObject *builtins, *debug, *debug_str; + int flag; + builtins = PyEval_GetBuiltins(); + if (!builtins) goto bad; + debug_str = PyUnicode_FromStringAndSize("__debug__", 9); + if (!debug_str) goto bad; + debug = PyObject_GetItem(builtins, debug_str); + Py_DECREF(debug_str); + if (!debug) goto bad; + flag = PyObject_IsTrue(debug); + Py_DECREF(debug); + if (flag == -1) goto bad; + __pyx_assertions_enabled_flag = flag; + return 0; + bad: + __pyx_assertions_enabled_flag = 1; + return -1; + } +#else + #define __Pyx_init_assertions_enabled() (0) + #define __pyx_assertions_enabled() (!Py_OptimizeFlag) +#endif + +/* PyAssertionError_Check.proto */ +#define __Pyx_PyExc_AssertionError_Check(obj) __Pyx_TypeCheck(obj, PyExc_AssertionError) + +/* RaiseTooManyValuesToUnpack.proto */ +static CYTHON_INLINE void __Pyx_RaiseTooManyValuesError(Py_ssize_t expected); + +/* RaiseNeedMoreValuesToUnpack.proto */ +static CYTHON_INLINE void __Pyx_RaiseNeedMoreValuesError(Py_ssize_t index); + +/* RaiseNoneIterError.proto */ +static CYTHON_INLINE void __Pyx_RaiseNoneNotIterableError(void); + +/* ExtTypeTest.proto */ +static CYTHON_INLINE int __Pyx_TypeTest(PyObject *obj, PyTypeObject *type); + +/* 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 + +/* 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); + +/* 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 + +CYTHON_UNUSED static int __pyx_memoryview_getbuffer(PyObject *__pyx_v_self, Py_buffer *__pyx_v_info, int __pyx_v_flags); /*proto*/ +/* 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 + +/* PySequenceMultiply.proto */ +#define __Pyx_PySequence_Multiply_Left(mul, seq) __Pyx_PySequence_Multiply(seq, mul) +static CYTHON_INLINE PyObject* __Pyx_PySequence_Multiply(PyObject *seq, Py_ssize_t mul); + +/* PyObjectFormatAndDecref.proto */ +static CYTHON_INLINE PyObject* __Pyx_PyObject_FormatSimpleAndDecref(PyObject* s, PyObject* f); +static CYTHON_INLINE PyObject* __Pyx_PyObject_FormatAndDecref(PyObject* s, PyObject* f); + +/* PyObjectFormat.proto */ +#if CYTHON_USE_UNICODE_WRITER +static PyObject* __Pyx_PyObject_Format(PyObject* s, PyObject* f); +#else +#define __Pyx_PyObject_Format(s, f) PyObject_Format(s, f) +#endif + +/* SetItemInt.proto */ +#define __Pyx_SetItemInt(o, i, v, type, is_signed, to_py_func, is_list, wraparound, boundscheck, has_gil, unsafe_shared)\ + (__Pyx_fits_Py_ssize_t(i, type, is_signed) ?\ + __Pyx_SetItemInt_Fast(o, (Py_ssize_t)i, v, is_list, wraparound, boundscheck, unsafe_shared) :\ + (is_list ? (PyErr_SetString(PyExc_IndexError, "list assignment index out of range"), -1) :\ + __Pyx_SetItemInt_Generic(o, to_py_func(i), v))) +static int __Pyx_SetItemInt_Generic(PyObject *o, PyObject *j, PyObject *v); +static CYTHON_INLINE int __Pyx_SetItemInt_Fast(PyObject *o, Py_ssize_t i, PyObject *v, + int is_list, int wraparound, int boundscheck, int unsafe_shared); + +/* RaiseUnboundLocalError.proto */ +static void __Pyx_RaiseUnboundLocalError(const char *varname); + +/* PyIndexError_Check.proto */ +#define __Pyx_PyExc_IndexError_Check(obj) __Pyx_TypeCheck(obj, PyExc_IndexError) + +/* DivInt[long].proto */ +static CYTHON_INLINE long __Pyx_div_long(long, long, int b_is_constant); + +/* PyImportError_Check.proto */ +#define __Pyx_PyExc_ImportError_Check(obj) __Pyx_TypeCheck(obj, PyExc_ImportError) + +/* tp_new.proto */ +#define __Pyx_tp_new(type_obj, args) __Pyx_tp_new_kwargs(type_obj, args, NULL) +static CYTHON_INLINE PyObject* __Pyx_tp_new_kwargs(PyObject* type_obj, PyObject* args, PyObject* kwargs); + +/* WriteUnraisableException.proto */ +static void __Pyx_WriteUnraisable(const char *name, int clineno, + int lineno, const char *filename, + int full_traceback, int nogil); + +/* MoveIfSupported.proto */ +#if CYTHON_USE_CPP_STD_MOVE + #include + #define __PYX_STD_MOVE_IF_SUPPORTED(x) std::move(x) +#else + #define __PYX_STD_MOVE_IF_SUPPORTED(x) x +#endif + +/* 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 + +/* IterFinish.proto */ +static CYTHON_INLINE int __Pyx_IterFinish(void); + +/* UnpackItemEndCheck.proto */ +static int __Pyx_IternextUnpackEndCheck(PyObject *retval, Py_ssize_t expected); + +/* PyObject_Unicode.proto */ +#define __Pyx_PyObject_Unicode(obj)\ + (likely(PyUnicode_CheckExact(obj)) ? __Pyx_NewRef(obj) : PyObject_Str(obj)) + +/* PyNotImplementedError_Check.proto */ +#define __Pyx_PyExc_NotImplementedError_Check(obj) __Pyx_TypeCheck(obj, PyExc_NotImplementedError) + +/* PyObjectCall2Args.proto (used by PyObjectCallMethod1) */ +static CYTHON_INLINE PyObject* __Pyx_PyObject_Call2Args(PyObject* function, PyObject* arg1, PyObject* arg2); + +/* PyObjectGetMethod.proto (used by PyObjectCallMethod1) */ +#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 + +/* PyObjectCallMethod1.proto (used by append) */ +static PyObject* __Pyx_PyObject_CallMethod1(PyObject* obj, PyObject* method_name, PyObject* arg); + +/* append.proto */ +static CYTHON_INLINE int __Pyx_PyObject_Append(PyObject* L, PyObject* x); + +/* dict_setdefault.proto */ +static CYTHON_INLINE PyObject *__Pyx_PyDict_SetDefault(PyObject *d, PyObject *key, PyObject *default_value); + +/* 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 + +/* PyLongBinop.proto */ +#if !CYTHON_COMPILING_IN_PYPY +static CYTHON_INLINE PyObject* __Pyx_PyLong_SubtractObjC(PyObject *op1, PyObject *op2, long intval, int inplace, int zerodivision_check); +#else +#define __Pyx_PyLong_SubtractObjC(op1, op2, intval, inplace, zerodivision_check)\ + (inplace ? PyNumber_InPlaceSubtract(op1, op2) : PyNumber_Subtract(op1, op2)) +#endif + +/* PyObjectLookupSpecial.proto */ +#if CYTHON_USE_PYTYPE_LOOKUP && CYTHON_USE_TYPE_SLOTS +#define __Pyx_PyObject_LookupSpecialNoError(obj, attr_name) __Pyx__PyObject_LookupSpecial(obj, attr_name, 0) +#define __Pyx_PyObject_LookupSpecial(obj, attr_name) __Pyx__PyObject_LookupSpecial(obj, attr_name, 1) +static CYTHON_INLINE PyObject* __Pyx__PyObject_LookupSpecial(PyObject* obj, PyObject* attr_name, int with_error); +#else +#define __Pyx_PyObject_LookupSpecialNoError(o,n) __Pyx_PyObject_GetAttrStrNoError(o,n) +#define __Pyx_PyObject_LookupSpecial(o,n) __Pyx_PyObject_GetAttrStr(o,n) +#endif + +/* RaiseClosureNameError.proto */ +static void __Pyx_RaiseClosureNameError(const char *varname); + +/* 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); + +/* PySequenceContains.proto */ +static CYTHON_INLINE int __Pyx_PySequence_ContainsTF(PyObject* item, PyObject* seq, int eq) { + int result = PySequence_Contains(seq, item); + return unlikely(result < 0) ? result : (result == (eq == Py_EQ)); +} + +/* CallUnboundCMethod1.proto */ +CYTHON_UNUSED +static PyObject* __Pyx__CallUnboundCMethod1(__Pyx_CachedCFunction* cfunc, PyObject* self, PyObject* arg); +#if CYTHON_COMPILING_IN_CPYTHON +static CYTHON_INLINE PyObject* __Pyx_CallUnboundCMethod1(__Pyx_CachedCFunction* cfunc, PyObject* self, PyObject* arg); +#else +#define __Pyx_CallUnboundCMethod1(cfunc, self, arg) __Pyx__CallUnboundCMethod1(cfunc, self, arg) +#endif + +/* AllocateExtensionType.proto */ +static PyObject *__Pyx_AllocateExtensionType(PyTypeObject *t, int is_final); + +/* CheckTypeForFreelists.proto */ +#if CYTHON_USE_FREELISTS +#if CYTHON_USE_TYPE_SPECS +#define __PYX_CHECK_FINAL_TYPE_FOR_FREELISTS(t, expected_tp, expected_size) ((int) ((t) == (expected_tp))) +#define __PYX_CHECK_TYPE_FOR_FREELIST_FLAGS Py_TPFLAGS_IS_ABSTRACT +#else +#define __PYX_CHECK_FINAL_TYPE_FOR_FREELISTS(t, expected_tp, expected_size) ((int) ((t)->tp_basicsize == (expected_size))) +#define __PYX_CHECK_TYPE_FOR_FREELIST_FLAGS (Py_TPFLAGS_IS_ABSTRACT | Py_TPFLAGS_HEAPTYPE) +#endif +#define __PYX_CHECK_TYPE_FOR_FREELISTS(t, expected_tp, expected_size)\ + (__PYX_CHECK_FINAL_TYPE_FOR_FREELISTS((t), (expected_tp), (expected_size)) &\ + (int) (!__Pyx_PyType_HasFeature((t), __PYX_CHECK_TYPE_FOR_FREELIST_FLAGS))) +#endif + +/* DefaultPlacementNew.proto */ +#include +template +void __Pyx_default_placement_construct(T* x) { + new (static_cast(x)) T(); +} + +/* PyObjectCallNoArg.proto (used by PyObjectCallMethod0) */ +static CYTHON_INLINE PyObject* __Pyx_PyObject_CallNoArg(PyObject *func); + +/* 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); + +/* SetVTable.proto */ +static int __Pyx_SetVtable(PyTypeObject* typeptr , void* vtable); + +/* GetVTable.proto (used by MergeVTables) */ +static void* __Pyx_GetVtable(PyTypeObject *type); + +/* MergeVTables.proto */ +static int __Pyx_MergeVtables(PyTypeObject *type); + +/* 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_1 +#define __PYX_HAVE_RT_ImportType_proto_3_2_1 +#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_1(s) alignof(s) +#else +#define __PYX_GET_STRUCT_ALIGNMENT_3_2_1(s) sizeof(void*) +#endif +enum __Pyx_ImportType_CheckSize_3_2_1 { + __Pyx_ImportType_CheckSize_Error_3_2_1 = 0, + __Pyx_ImportType_CheckSize_Warn_3_2_1 = 1, + __Pyx_ImportType_CheckSize_Ignore_3_2_1 = 2 +}; +static PyTypeObject *__Pyx_ImportType_3_2_1(PyObject* module, const char *module_name, const char *class_name, size_t size, size_t alignment, enum __Pyx_ImportType_CheckSize_3_2_1 check_size); +#endif + +/* VoidPtrImport.proto */ +static int __Pyx_ImportVoidPtr_3_2_1(PyObject *module, const char *name, void **p, const char *sig); + +/* FunctionImport.proto */ +static int __Pyx_ImportFunction_3_2_1(PyObject *module, const char *funcname, void (**f)(void), const char *sig); + +/* ImportFrom.proto */ +static PyObject* __Pyx_ImportFrom(PyObject* module, PyObject* name); + +/* Py3UpdateBases.proto */ +static PyObject* __Pyx_PEP560_update_bases(PyObject *bases); + +/* CalculateMetaclass.proto */ +static PyObject *__Pyx_CalculateMetaclass(PyTypeObject *metaclass, PyObject *bases); + +/* Py3ClassCreate.proto */ +static PyObject *__Pyx_Py3MetaclassPrepare(PyObject *metaclass, PyObject *bases, PyObject *name, PyObject *qualname, + PyObject *mkw, PyObject *modname, PyObject *doc); +static PyObject *__Pyx_Py3ClassCreate(PyObject *metaclass, PyObject *name, PyObject *bases, PyObject *dict, + PyObject *mkw, int calculate_metaclass, int allow_py2_metaclass); + +/* 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); + +/* RealImag.proto */ +#if CYTHON_CCOMPLEX + #ifdef __cplusplus + #define __Pyx_CREAL(z) ((z).real()) + #define __Pyx_CIMAG(z) ((z).imag()) + #else + #define __Pyx_CREAL(z) (__real__(z)) + #define __Pyx_CIMAG(z) (__imag__(z)) + #endif +#else + #define __Pyx_CREAL(z) ((z).real) + #define __Pyx_CIMAG(z) ((z).imag) +#endif +#if defined(__cplusplus) && CYTHON_CCOMPLEX\ + && (defined(_WIN32) || defined(__clang__) || (defined(__GNUC__) && (__GNUC__ >= 5 || __GNUC__ == 4 && __GNUC_MINOR__ >= 4 )) || __cplusplus >= 201103) + #define __Pyx_SET_CREAL(z,x) ((z).real(x)) + #define __Pyx_SET_CIMAG(z,y) ((z).imag(y)) +#else + #define __Pyx_SET_CREAL(z,x) __Pyx_CREAL(z) = (x) + #define __Pyx_SET_CIMAG(z,y) __Pyx_CIMAG(z) = (y) +#endif + +/* Arithmetic.proto */ +#if CYTHON_CCOMPLEX && (1) && (!0 || __cplusplus) + #define __Pyx_c_eq_float(a, b) ((a)==(b)) + #define __Pyx_c_sum_float(a, b) ((a)+(b)) + #define __Pyx_c_diff_float(a, b) ((a)-(b)) + #define __Pyx_c_prod_float(a, b) ((a)*(b)) + #define __Pyx_c_quot_float(a, b) ((a)/(b)) + #define __Pyx_c_neg_float(a) (-(a)) + #ifdef __cplusplus + #define __Pyx_c_is_zero_float(z) ((z)==(float)0) + #define __Pyx_c_conj_float(z) (::std::conj(z)) + #if 1 + #define __Pyx_c_abs_float(z) (::std::abs(z)) + #define __Pyx_c_pow_float(a, b) (::std::pow(a, b)) + #endif + #else + #define __Pyx_c_is_zero_float(z) ((z)==0) + #define __Pyx_c_conj_float(z) (conjf(z)) + #if 1 + #define __Pyx_c_abs_float(z) (cabsf(z)) + #define __Pyx_c_pow_float(a, b) (cpowf(a, b)) + #endif + #endif +#else + static CYTHON_INLINE int __Pyx_c_eq_float(__pyx_t_float_complex, __pyx_t_float_complex); + static CYTHON_INLINE __pyx_t_float_complex __Pyx_c_sum_float(__pyx_t_float_complex, __pyx_t_float_complex); + static CYTHON_INLINE __pyx_t_float_complex __Pyx_c_diff_float(__pyx_t_float_complex, __pyx_t_float_complex); + static CYTHON_INLINE __pyx_t_float_complex __Pyx_c_prod_float(__pyx_t_float_complex, __pyx_t_float_complex); + static CYTHON_INLINE __pyx_t_float_complex __Pyx_c_quot_float(__pyx_t_float_complex, __pyx_t_float_complex); + static CYTHON_INLINE __pyx_t_float_complex __Pyx_c_neg_float(__pyx_t_float_complex); + static CYTHON_INLINE int __Pyx_c_is_zero_float(__pyx_t_float_complex); + static CYTHON_INLINE __pyx_t_float_complex __Pyx_c_conj_float(__pyx_t_float_complex); + #if 1 + static CYTHON_INLINE float __Pyx_c_abs_float(__pyx_t_float_complex); + static CYTHON_INLINE __pyx_t_float_complex __Pyx_c_pow_float(__pyx_t_float_complex, __pyx_t_float_complex); + #endif +#endif + +/* Arithmetic.proto */ +#if CYTHON_CCOMPLEX && (1) && (!0 || __cplusplus) + #define __Pyx_c_eq_double(a, b) ((a)==(b)) + #define __Pyx_c_sum_double(a, b) ((a)+(b)) + #define __Pyx_c_diff_double(a, b) ((a)-(b)) + #define __Pyx_c_prod_double(a, b) ((a)*(b)) + #define __Pyx_c_quot_double(a, b) ((a)/(b)) + #define __Pyx_c_neg_double(a) (-(a)) + #ifdef __cplusplus + #define __Pyx_c_is_zero_double(z) ((z)==(double)0) + #define __Pyx_c_conj_double(z) (::std::conj(z)) + #if 1 + #define __Pyx_c_abs_double(z) (::std::abs(z)) + #define __Pyx_c_pow_double(a, b) (::std::pow(a, b)) + #endif + #else + #define __Pyx_c_is_zero_double(z) ((z)==0) + #define __Pyx_c_conj_double(z) (conj(z)) + #if 1 + #define __Pyx_c_abs_double(z) (cabs(z)) + #define __Pyx_c_pow_double(a, b) (cpow(a, b)) + #endif + #endif +#else + static CYTHON_INLINE int __Pyx_c_eq_double(__pyx_t_double_complex, __pyx_t_double_complex); + static CYTHON_INLINE __pyx_t_double_complex __Pyx_c_sum_double(__pyx_t_double_complex, __pyx_t_double_complex); + static CYTHON_INLINE __pyx_t_double_complex __Pyx_c_diff_double(__pyx_t_double_complex, __pyx_t_double_complex); + static CYTHON_INLINE __pyx_t_double_complex __Pyx_c_prod_double(__pyx_t_double_complex, __pyx_t_double_complex); + static CYTHON_INLINE __pyx_t_double_complex __Pyx_c_quot_double(__pyx_t_double_complex, __pyx_t_double_complex); + static CYTHON_INLINE __pyx_t_double_complex __Pyx_c_neg_double(__pyx_t_double_complex); + static CYTHON_INLINE int __Pyx_c_is_zero_double(__pyx_t_double_complex); + static CYTHON_INLINE __pyx_t_double_complex __Pyx_c_conj_double(__pyx_t_double_complex); + #if 1 + static CYTHON_INLINE double __Pyx_c_abs_double(__pyx_t_double_complex); + static CYTHON_INLINE __pyx_t_double_complex __Pyx_c_pow_double(__pyx_t_double_complex, __pyx_t_double_complex); + #endif +#endif + +/* Arithmetic.proto */ +#if CYTHON_CCOMPLEX && (1) && (!0 || __cplusplus) + #define __Pyx_c_eq_long__double(a, b) ((a)==(b)) + #define __Pyx_c_sum_long__double(a, b) ((a)+(b)) + #define __Pyx_c_diff_long__double(a, b) ((a)-(b)) + #define __Pyx_c_prod_long__double(a, b) ((a)*(b)) + #define __Pyx_c_quot_long__double(a, b) ((a)/(b)) + #define __Pyx_c_neg_long__double(a) (-(a)) + #ifdef __cplusplus + #define __Pyx_c_is_zero_long__double(z) ((z)==(long double)0) + #define __Pyx_c_conj_long__double(z) (::std::conj(z)) + #if 1 + #define __Pyx_c_abs_long__double(z) (::std::abs(z)) + #define __Pyx_c_pow_long__double(a, b) (::std::pow(a, b)) + #endif + #else + #define __Pyx_c_is_zero_long__double(z) ((z)==0) + #define __Pyx_c_conj_long__double(z) (conjl(z)) + #if 1 + #define __Pyx_c_abs_long__double(z) (cabsl(z)) + #define __Pyx_c_pow_long__double(a, b) (cpowl(a, b)) + #endif + #endif +#else + static CYTHON_INLINE int __Pyx_c_eq_long__double(__pyx_t_long_double_complex, __pyx_t_long_double_complex); + static CYTHON_INLINE __pyx_t_long_double_complex __Pyx_c_sum_long__double(__pyx_t_long_double_complex, __pyx_t_long_double_complex); + static CYTHON_INLINE __pyx_t_long_double_complex __Pyx_c_diff_long__double(__pyx_t_long_double_complex, __pyx_t_long_double_complex); + static CYTHON_INLINE __pyx_t_long_double_complex __Pyx_c_prod_long__double(__pyx_t_long_double_complex, __pyx_t_long_double_complex); + static CYTHON_INLINE __pyx_t_long_double_complex __Pyx_c_quot_long__double(__pyx_t_long_double_complex, __pyx_t_long_double_complex); + static CYTHON_INLINE __pyx_t_long_double_complex __Pyx_c_neg_long__double(__pyx_t_long_double_complex); + static CYTHON_INLINE int __Pyx_c_is_zero_long__double(__pyx_t_long_double_complex); + static CYTHON_INLINE __pyx_t_long_double_complex __Pyx_c_conj_long__double(__pyx_t_long_double_complex); + #if 1 + static CYTHON_INLINE long double __Pyx_c_abs_long__double(__pyx_t_long_double_complex); + static CYTHON_INLINE __pyx_t_long_double_complex __Pyx_c_pow_long__double(__pyx_t_long_double_complex, __pyx_t_long_double_complex); + #endif +#endif + +/* BufferStructDeclare.proto */ +typedef struct { + Py_ssize_t shape, strides, suboffsets; +} __Pyx_Buf_DimInfo; +typedef struct { + size_t refcount; + Py_buffer pybuffer; +} __Pyx_Buffer; +typedef struct { + __Pyx_Buffer *rcbuffer; + char *data; + __Pyx_Buf_DimInfo diminfo[8]; +} __Pyx_LocalBuf_ND; + +/* MemviewRefcount.proto */ +static CYTHON_INLINE int __pyx_add_acquisition_count_locked( + __pyx_atomic_int_type *acquisition_count, PyThread_type_lock lock); +static CYTHON_INLINE int __pyx_sub_acquisition_count_locked( + __pyx_atomic_int_type *acquisition_count, PyThread_type_lock lock); +#define __pyx_get_slice_count_pointer(memview) (&memview->acquisition_count) +#define __PYX_INC_MEMVIEW(slice, have_gil) __Pyx_INC_MEMVIEW(slice, have_gil, __LINE__) +#define __PYX_XCLEAR_MEMVIEW(slice, have_gil) __Pyx_XCLEAR_MEMVIEW(slice, have_gil, __LINE__) +static CYTHON_INLINE void __Pyx_INC_MEMVIEW(__Pyx_memviewslice *, int, int); +static CYTHON_INLINE void __Pyx_XCLEAR_MEMVIEW(__Pyx_memviewslice *, int, int); + +/* MemviewSliceIsContig.proto */ +static int __pyx_memviewslice_is_contig(const __Pyx_memviewslice mvs, char order, int ndim); + +/* OverlappingSlices.proto */ +static int __pyx_slices_overlap(__Pyx_memviewslice *slice1, + __Pyx_memviewslice *slice2, + int ndim, size_t itemsize); + +/* MemviewSliceInit.proto */ +static int __Pyx_init_memviewslice( + struct __pyx_memoryview_obj *memview, + int ndim, + __Pyx_memviewslice *memviewslice, + int memview_is_new_reference); + +/* CppExceptionConversion.proto */ +#ifndef __Pyx_CppExn2PyErr +#include +#include +#include +#include +static void __Pyx_CppExn2PyErr() { + try { + if (PyErr_Occurred()) + ; // let the latest Python exn pass through and ignore the current one + else + throw; + } catch (const std::bad_alloc& exn) { + PyErr_SetString(PyExc_MemoryError, exn.what()); + } catch (const std::bad_cast& exn) { + PyErr_SetString(PyExc_TypeError, exn.what()); + } catch (const std::bad_typeid& exn) { + PyErr_SetString(PyExc_TypeError, exn.what()); + } catch (const std::domain_error& exn) { + PyErr_SetString(PyExc_ValueError, exn.what()); + } catch (const std::invalid_argument& exn) { + PyErr_SetString(PyExc_ValueError, exn.what()); + } catch (const std::ios_base::failure& exn) { + PyErr_SetString(PyExc_IOError, exn.what()); + } catch (const std::out_of_range& exn) { + PyErr_SetString(PyExc_IndexError, exn.what()); + } catch (const std::overflow_error& exn) { + PyErr_SetString(PyExc_OverflowError, exn.what()); + } catch (const std::range_error& exn) { + PyErr_SetString(PyExc_ArithmeticError, exn.what()); + } catch (const std::underflow_error& exn) { + PyErr_SetString(PyExc_ArithmeticError, exn.what()); + } catch (const std::exception& exn) { + PyErr_SetString(PyExc_RuntimeError, exn.what()); + } + catch (...) + { + PyErr_SetString(PyExc_RuntimeError, "Unknown exception"); + } +} +#endif + +/* CIntFromPy.proto */ +static CYTHON_INLINE int __Pyx_PyLong_As_int(PyObject *); + +/* CIntFromPy.proto */ +static CYTHON_INLINE uint64_t __Pyx_PyLong_As_uint64_t(PyObject *); + +/* CIntToPy.proto */ +static CYTHON_INLINE PyObject* __Pyx_PyLong_From_long(long value); + +/* CIntToPy.proto */ +static CYTHON_INLINE PyObject* __Pyx_PyLong_From_int(int value); + +/* CIntToPy.proto */ +static CYTHON_INLINE PyObject* __Pyx_PyLong_From_uint64_t(uint64_t value); + +/* CIntFromPy.proto */ +static CYTHON_INLINE size_t __Pyx_PyLong_As_size_t(PyObject *); + +/* MemviewSliceCopy.proto */ +static __Pyx_memviewslice +__pyx_memoryview_copy_new_contig(const __Pyx_memviewslice *from_mvs, + const char *mode, int ndim, + size_t sizeof_dtype, int contig_flag, + int dtype_is_object); + +/* UpdateUnpickledDict.proto */ +static int __Pyx_UpdateUnpickledDict(PyObject *obj, PyObject *state, Py_ssize_t index); + +/* CheckUnpickleChecksum.proto */ +static CYTHON_INLINE int __Pyx_CheckUnpickleChecksum(long checksum, long checksum1, long checksum2, long checksum3, const char *members); + +/* CIntFromPy.proto */ +static CYTHON_INLINE long __Pyx_PyLong_As_long(PyObject *); + +/* CIntFromPy.proto */ +static CYTHON_INLINE char __Pyx_PyLong_As_char(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 + +/* 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 "." + +static PyObject *__pyx_array_get_memview(struct __pyx_array_obj *__pyx_v_self); /* proto*/ +static char *__pyx_memoryview_get_item_pointer(struct __pyx_memoryview_obj *__pyx_v_self, PyObject *__pyx_v_index); /* proto*/ +static PyObject *__pyx_memoryview_is_slice(struct __pyx_memoryview_obj *__pyx_v_self, PyObject *__pyx_v_obj); /* proto*/ +static PyObject *__pyx_memoryview_setitem_slice_assignment(struct __pyx_memoryview_obj *__pyx_v_self, PyObject *__pyx_v_dst, PyObject *__pyx_v_src); /* proto*/ +static PyObject *__pyx_memoryview_setitem_slice_assign_scalar(struct __pyx_memoryview_obj *__pyx_v_self, struct __pyx_memoryview_obj *__pyx_v_dst, PyObject *__pyx_v_value); /* proto*/ +static PyObject *__pyx_memoryview_setitem_indexed(struct __pyx_memoryview_obj *__pyx_v_self, PyObject *__pyx_v_index, PyObject *__pyx_v_value); /* proto*/ +static PyObject *__pyx_memoryview_convert_item_to_object(struct __pyx_memoryview_obj *__pyx_v_self, char *__pyx_v_itemp); /* proto*/ +static PyObject *__pyx_memoryview_assign_item_from_object(struct __pyx_memoryview_obj *__pyx_v_self, char *__pyx_v_itemp, PyObject *__pyx_v_value); /* proto*/ +static PyObject *__pyx_memoryview__get_base(struct __pyx_memoryview_obj *__pyx_v_self); /* proto*/ +static PyObject *__pyx_memoryviewslice_convert_item_to_object(struct __pyx_memoryviewslice_obj *__pyx_v_self, char *__pyx_v_itemp); /* proto*/ +static PyObject *__pyx_memoryviewslice_assign_item_from_object(struct __pyx_memoryviewslice_obj *__pyx_v_self, char *__pyx_v_itemp, PyObject *__pyx_v_value); /* proto*/ +static PyObject *__pyx_memoryviewslice__get_base(struct __pyx_memoryviewslice_obj *__pyx_v_self); /* proto*/ +static CYTHON_INLINE npy_intp __pyx_f_5numpy_5dtype_8itemsize_itemsize(PyArray_Descr *__pyx_v_self); /* proto*/ +static CYTHON_INLINE npy_intp __pyx_f_5numpy_5dtype_9alignment_alignment(PyArray_Descr *__pyx_v_self); /* proto*/ +static CYTHON_INLINE PyObject *__pyx_f_5numpy_5dtype_6fields_fields(PyArray_Descr *__pyx_v_self); /* proto*/ +static CYTHON_INLINE PyObject *__pyx_f_5numpy_5dtype_5names_names(PyArray_Descr *__pyx_v_self); /* proto*/ +static CYTHON_INLINE PyArray_ArrayDescr *__pyx_f_5numpy_5dtype_8subarray_subarray(PyArray_Descr *__pyx_v_self); /* proto*/ +static CYTHON_INLINE npy_uint64 __pyx_f_5numpy_5dtype_5flags_flags(PyArray_Descr *__pyx_v_self); /* proto*/ +static CYTHON_INLINE int __pyx_f_5numpy_9broadcast_7numiter_numiter(PyArrayMultiIterObject *__pyx_v_self); /* proto*/ +static CYTHON_INLINE npy_intp __pyx_f_5numpy_9broadcast_4size_size(PyArrayMultiIterObject *__pyx_v_self); /* proto*/ +static CYTHON_INLINE npy_intp __pyx_f_5numpy_9broadcast_5index_index(PyArrayMultiIterObject *__pyx_v_self); /* proto*/ +static CYTHON_INLINE int __pyx_f_5numpy_9broadcast_2nd_nd(PyArrayMultiIterObject *__pyx_v_self); /* proto*/ +static CYTHON_INLINE npy_intp *__pyx_f_5numpy_9broadcast_10dimensions_dimensions(PyArrayMultiIterObject *__pyx_v_self); /* proto*/ +static CYTHON_INLINE void **__pyx_f_5numpy_9broadcast_5iters_iters(PyArrayMultiIterObject *__pyx_v_self); /* proto*/ +static CYTHON_INLINE PyObject *__pyx_f_5numpy_7ndarray_4base_base(PyArrayObject *__pyx_v_self); /* proto*/ +static CYTHON_INLINE PyArray_Descr *__pyx_f_5numpy_7ndarray_5descr_descr(PyArrayObject *__pyx_v_self); /* proto*/ +static CYTHON_INLINE int __pyx_f_5numpy_7ndarray_4ndim_ndim(PyArrayObject *__pyx_v_self); /* proto*/ +static CYTHON_INLINE npy_intp *__pyx_f_5numpy_7ndarray_5shape_shape(PyArrayObject *__pyx_v_self); /* proto*/ +static CYTHON_INLINE npy_intp *__pyx_f_5numpy_7ndarray_7strides_strides(PyArrayObject *__pyx_v_self); /* proto*/ +static CYTHON_INLINE npy_intp __pyx_f_5numpy_7ndarray_4size_size(PyArrayObject *__pyx_v_self); /* proto*/ +static CYTHON_INLINE char *__pyx_f_5numpy_7ndarray_4data_data(PyArrayObject *__pyx_v_self); /* proto*/ +static CYTHON_INLINE struct __pyx_obj_5spacy_6lexeme_Lexeme *__pyx_f_5spacy_6lexeme_6Lexeme_from_ptr(struct __pyx_t_5spacy_7structs_LexemeC *__pyx_v_lex, struct __pyx_obj_5spacy_5vocab_Vocab *__pyx_v_vocab); /* proto*/ +static CYTHON_INLINE void __pyx_f_5spacy_6lexeme_6Lexeme_set_struct_attr(struct __pyx_t_5spacy_7structs_LexemeC *__pyx_v_lex, enum __pyx_t_5spacy_5attrs_attr_id_t __pyx_v_name, __pyx_t_5spacy_8typedefs_attr_t __pyx_v_value); /* proto*/ +static CYTHON_INLINE __pyx_t_5spacy_8typedefs_attr_t __pyx_f_5spacy_6lexeme_6Lexeme_get_struct_attr(struct __pyx_t_5spacy_7structs_LexemeC const *__pyx_v_lex, enum __pyx_t_5spacy_5attrs_attr_id_t __pyx_v_feat_name); /* proto*/ +static CYTHON_INLINE int __pyx_f_5spacy_6lexeme_6Lexeme_c_check_flag(struct __pyx_t_5spacy_7structs_LexemeC const *__pyx_v_lexeme, enum __pyx_t_5spacy_5attrs_attr_id_t __pyx_v_flag_id); /* proto*/ +static CYTHON_INLINE int __pyx_f_5spacy_6lexeme_6Lexeme_c_set_flag(struct __pyx_t_5spacy_7structs_LexemeC *__pyx_v_lex, enum __pyx_t_5spacy_5attrs_attr_id_t __pyx_v_flag_id, int __pyx_v_value); /* proto*/ +static CYTHON_INLINE struct __pyx_obj_5spacy_8pipeline_17_parser_internals_10stateclass_StateClass *__pyx_f_5spacy_8pipeline_17_parser_internals_10stateclass_10StateClass_borrow(__pyx_t_5spacy_8pipeline_17_parser_internals_6_state_StateC *__pyx_v_ptr, struct __pyx_obj_5spacy_6tokens_3doc_Doc *__pyx_v_doc); /* proto*/ +static CYTHON_INLINE struct __pyx_obj_5spacy_8pipeline_17_parser_internals_10stateclass_StateClass *__pyx_f_5spacy_8pipeline_17_parser_internals_10stateclass_10StateClass_init_offset(struct __pyx_t_5spacy_7structs_TokenC const *__pyx_v_sent, int __pyx_v_length, int __pyx_v_offset); /* proto*/ +static struct __pyx_t_5spacy_8pipeline_17_parser_internals_17transition_system_Transition __pyx_f_5spacy_8pipeline_17_parser_internals_17transition_system_16TransitionSystem_lookup_transition(CYTHON_UNUSED struct __pyx_obj_5spacy_8pipeline_17_parser_internals_17transition_system_TransitionSystem *__pyx_v_self, CYTHON_UNUSED PyObject *__pyx_v_name); /* proto*/ +static struct __pyx_t_5spacy_8pipeline_17_parser_internals_17transition_system_Transition __pyx_f_5spacy_8pipeline_17_parser_internals_17transition_system_16TransitionSystem_init_transition(CYTHON_UNUSED struct __pyx_obj_5spacy_8pipeline_17_parser_internals_17transition_system_TransitionSystem *__pyx_v_self, CYTHON_UNUSED int __pyx_v_clas, CYTHON_UNUSED int __pyx_v_move, CYTHON_UNUSED __pyx_t_5spacy_8typedefs_attr_t __pyx_v_label); /* proto*/ +static int __pyx_f_5spacy_8pipeline_17_parser_internals_17transition_system_16TransitionSystem_set_valid(struct __pyx_obj_5spacy_8pipeline_17_parser_internals_17transition_system_TransitionSystem *__pyx_v_self, int *__pyx_v_is_valid, __pyx_t_5spacy_8pipeline_17_parser_internals_6_state_StateC const *__pyx_v_st); /* proto*/ +static int __pyx_f_5spacy_8pipeline_17_parser_internals_17transition_system_16TransitionSystem_set_costs(CYTHON_UNUSED struct __pyx_obj_5spacy_8pipeline_17_parser_internals_17transition_system_TransitionSystem *__pyx_v_self, CYTHON_UNUSED int *__pyx_v_is_valid, CYTHON_UNUSED __pyx_t_5spacy_8typedefs_weight_t *__pyx_v_costs, CYTHON_UNUSED __pyx_t_5spacy_8pipeline_17_parser_internals_6_state_StateC const *__pyx_v_state, CYTHON_UNUSED PyObject *__pyx_v_gold); /* proto*/ + +/* Module declarations from "cymem.cymem" */ + +/* Module declarations from "libc.stdint" */ + +/* Module declarations from "libcpp.utility" */ + +/* Module declarations from "libcpp.set" */ + +/* Module declarations from "libcpp.vector" */ + +/* Module declarations from "murmurhash.mrmr" */ +static uint64_t (*__pyx_f_10murmurhash_4mrmr_hash64)(void *, int, uint64_t); /*proto*/ + +/* Module declarations from "preshed.maps" */ + +/* Module declarations from "spacy.typedefs" */ + +/* Module declarations from "spacy.strings" */ + +/* Module declarations from "libcpp.unordered_map" */ + +/* Module declarations from "libcpp.unordered_set" */ + +/* Module declarations from "spacy" */ + +/* Module declarations from "spacy.symbols" */ + +/* Module declarations from "spacy.parts_of_speech" */ + +/* Module declarations from "spacy.structs" */ + +/* Module declarations from "libc.string" */ + +/* Module declarations from "libc.stdio" */ + +/* Module declarations from "__builtin__" */ + +/* Module declarations from "cpython.type" */ + +/* Module declarations from "cpython" */ + +/* Module declarations from "cpython.object" */ + +/* Module declarations from "cpython.ref" */ + +/* Module declarations from "numpy" */ + +/* Module declarations from "numpy" */ + +/* Module declarations from "spacy.attrs" */ + +/* Module declarations from "spacy.morphology" */ + +/* Module declarations from "spacy.vocab" */ +static struct __pyx_t_5spacy_7structs_LexemeC *__pyx_vp_5spacy_5vocab_EMPTY_LEXEME = 0; +#define __pyx_v_5spacy_5vocab_EMPTY_LEXEME (*__pyx_vp_5spacy_5vocab_EMPTY_LEXEME) + +/* Module declarations from "spacy.tokens.doc" */ + +/* Module declarations from "spacy.training.example" */ + +/* Module declarations from "libcpp" */ + +/* Module declarations from "cpython.exc" */ + +/* Module declarations from "libc.stdlib" */ + +/* Module declarations from "spacy.lexeme" */ +static struct __pyx_t_5spacy_7structs_LexemeC *__pyx_vp_5spacy_6lexeme_EMPTY_LEXEME = 0; +#define __pyx_v_5spacy_6lexeme_EMPTY_LEXEME (*__pyx_vp_5spacy_6lexeme_EMPTY_LEXEME) +static __pyx_t_5spacy_8typedefs_attr_t *__pyx_vp_5spacy_6lexeme_OOV_RANK = 0; +#define __pyx_v_5spacy_6lexeme_OOV_RANK (*__pyx_vp_5spacy_6lexeme_OOV_RANK) + +/* Module declarations from "spacy.pipeline._parser_internals._state" */ + +/* Module declarations from "spacy.pipeline._parser_internals.stateclass" */ + +/* Module declarations from "spacy.pipeline._parser_internals.transition_system" */ +static __pyx_t_5spacy_8typedefs_weight_t __pyx_v_5spacy_8pipeline_17_parser_internals_17transition_system_MIN_SCORE; +static PyObject *__pyx_collections_abc_Sequence = 0; +static PyObject *generic = 0; +static PyObject *strided = 0; +static PyObject *indirect = 0; +static PyObject *contiguous = 0; +static PyObject *indirect_contiguous = 0; +static int __pyx_memoryview_thread_locks_used; +static PyThread_type_lock __pyx_memoryview_thread_locks[8]; +static void *__pyx_f_5spacy_8pipeline_17_parser_internals_17transition_system__init_state(struct __pyx_obj_5cymem_5cymem_Pool *, int, void *); /*proto*/ +static int __pyx_f_5spacy_8pipeline_17_parser_internals_17transition_system__del_state(struct __pyx_obj_5cymem_5cymem_Pool *, void *, void *); /*proto*/ +static int __pyx_array_allocate_buffer(struct __pyx_array_obj *); /*proto*/ +static struct __pyx_array_obj *__pyx_array_new(PyObject *, Py_ssize_t, char *, char const *, char *); /*proto*/ +static PyObject *__pyx_memoryview_new(PyObject *, int, int, __Pyx_TypeInfo const *); /*proto*/ +static CYTHON_INLINE int __pyx_memoryview_check(PyObject *); /*proto*/ +static PyObject *_unellipsify(PyObject *, int); /*proto*/ +static int assert_direct_dimensions(Py_ssize_t *, int); /*proto*/ +static struct __pyx_memoryview_obj *__pyx_memview_slice(struct __pyx_memoryview_obj *, PyObject *); /*proto*/ +static int __pyx_memoryview_slice_memviewslice(__Pyx_memviewslice *, Py_ssize_t, Py_ssize_t, Py_ssize_t, int, int, int *, Py_ssize_t, Py_ssize_t, Py_ssize_t, int, int, int, int); /*proto*/ +static char *__pyx_pybuffer_index(Py_buffer *, char *, Py_ssize_t, Py_ssize_t); /*proto*/ +static int __pyx_memslice_transpose(__Pyx_memviewslice *); /*proto*/ +static PyObject *__pyx_memoryview_fromslice(__Pyx_memviewslice, int, PyObject *(*)(char *), int (*)(char *, PyObject *), int); /*proto*/ +static __Pyx_memviewslice *__pyx_memoryview_get_slice_from_memoryview(struct __pyx_memoryview_obj *, __Pyx_memviewslice *); /*proto*/ +static void __pyx_memoryview_slice_copy(struct __pyx_memoryview_obj *, __Pyx_memviewslice *); /*proto*/ +static PyObject *__pyx_memoryview_copy_object(struct __pyx_memoryview_obj *); /*proto*/ +static PyObject *__pyx_memoryview_copy_object_from_slice(struct __pyx_memoryview_obj *, __Pyx_memviewslice *); /*proto*/ +static Py_ssize_t abs_py_ssize_t(Py_ssize_t); /*proto*/ +static char __pyx_get_best_slice_order(__Pyx_memviewslice *, int); /*proto*/ +static void _copy_strided_to_strided(char *, Py_ssize_t *, char *, Py_ssize_t *, Py_ssize_t *, Py_ssize_t *, int, size_t); /*proto*/ +static void copy_strided_to_strided(__Pyx_memviewslice *, __Pyx_memviewslice *, int, size_t); /*proto*/ +static Py_ssize_t __pyx_memoryview_slice_get_size(__Pyx_memviewslice *, int); /*proto*/ +static Py_ssize_t __pyx_fill_contig_strides_array(Py_ssize_t *, Py_ssize_t *, Py_ssize_t, int, char); /*proto*/ +static void *__pyx_memoryview_copy_data_to_temp(__Pyx_memviewslice *, __Pyx_memviewslice *, char, int); /*proto*/ +static int __pyx_memoryview_err_extents(int, Py_ssize_t, Py_ssize_t); /*proto*/ +static int __pyx_memoryview_err_dim(PyObject *, PyObject *, int); /*proto*/ +static int __pyx_memoryview_err(PyObject *, PyObject *); /*proto*/ +static int __pyx_memoryview_err_no_memory(void); /*proto*/ +static int __pyx_memoryview_copy_contents(__Pyx_memviewslice, __Pyx_memviewslice, int, int, int); /*proto*/ +static void __pyx_memoryview_broadcast_leading(__Pyx_memviewslice *, int, int); /*proto*/ +static void __pyx_memoryview_refcount_copying(__Pyx_memviewslice *, int, int, int); /*proto*/ +static void __pyx_memoryview_refcount_objects_in_slice_with_gil(char *, Py_ssize_t *, Py_ssize_t *, int, int); /*proto*/ +static void __pyx_memoryview_refcount_objects_in_slice(char *, Py_ssize_t *, Py_ssize_t *, int, int); /*proto*/ +static void __pyx_memoryview_slice_assign_scalar(__Pyx_memviewslice *, int, size_t, void *, int); /*proto*/ +static void __pyx_memoryview__slice_assign_scalar(char *, Py_ssize_t *, Py_ssize_t *, int, size_t, void *); /*proto*/ +static PyObject *__pyx_unpickle_Enum__set_state(struct __pyx_MemviewEnum_obj *, PyObject *); /*proto*/ +/* #### Code section: typeinfo ### */ +/* #### Code section: before_global_var ### */ +#define __Pyx_MODULE_NAME "spacy.pipeline._parser_internals.transition_system" +extern int __pyx_module_is_main_spacy__pipeline___parser_internals__transition_system; +int __pyx_module_is_main_spacy__pipeline___parser_internals__transition_system = 0; + +/* Implementation of "spacy.pipeline._parser_internals.transition_system" */ +/* #### Code section: global_var ### */ +static PyObject *__pyx_builtin_print; +static PyObject *__pyx_builtin_min; +static PyObject *__pyx_builtin___import__; +static PyObject *__pyx_builtin_enumerate; +static PyObject *__pyx_builtin_Ellipsis; +static PyObject *__pyx_builtin_id; +/* #### Code section: string_decls ### */ +/* #### Code section: decls ### */ +static int __pyx_array___pyx_pf_15View_dot_MemoryView_5array___cinit__(struct __pyx_array_obj *__pyx_v_self, PyObject *__pyx_v_shape, Py_ssize_t __pyx_v_itemsize, PyObject *__pyx_v_format, PyObject *__pyx_v_mode, int __pyx_v_allocate_buffer); /* proto */ +static int __pyx_array___pyx_pf_15View_dot_MemoryView_5array_2__getbuffer__(struct __pyx_array_obj *__pyx_v_self, Py_buffer *__pyx_v_info, int __pyx_v_flags); /* proto */ +static void __pyx_array___pyx_pf_15View_dot_MemoryView_5array_4__dealloc__(struct __pyx_array_obj *__pyx_v_self); /* proto */ +static PyObject *__pyx_pf_15View_dot_MemoryView_5array_7memview___get__(struct __pyx_array_obj *__pyx_v_self); /* proto */ +static Py_ssize_t __pyx_array___pyx_pf_15View_dot_MemoryView_5array_6__len__(struct __pyx_array_obj *__pyx_v_self); /* proto */ +static PyObject *__pyx_array___pyx_pf_15View_dot_MemoryView_5array_8__getattr__(struct __pyx_array_obj *__pyx_v_self, PyObject *__pyx_v_attr); /* proto */ +static PyObject *__pyx_array___pyx_pf_15View_dot_MemoryView_5array_10__getitem__(struct __pyx_array_obj *__pyx_v_self, PyObject *__pyx_v_item); /* proto */ +static int __pyx_array___pyx_pf_15View_dot_MemoryView_5array_12__setitem__(struct __pyx_array_obj *__pyx_v_self, PyObject *__pyx_v_item, PyObject *__pyx_v_value); /* proto */ +static PyObject *__pyx_pf___pyx_array___reduce_cython__(CYTHON_UNUSED struct __pyx_array_obj *__pyx_v_self); /* proto */ +static PyObject *__pyx_pf___pyx_array_2__setstate_cython__(CYTHON_UNUSED struct __pyx_array_obj *__pyx_v_self, CYTHON_UNUSED PyObject *__pyx_v___pyx_state); /* proto */ +static int __pyx_MemviewEnum___pyx_pf_15View_dot_MemoryView_4Enum___init__(struct __pyx_MemviewEnum_obj *__pyx_v_self, PyObject *__pyx_v_name); /* proto */ +static PyObject *__pyx_MemviewEnum___pyx_pf_15View_dot_MemoryView_4Enum_2__repr__(struct __pyx_MemviewEnum_obj *__pyx_v_self); /* proto */ +static PyObject *__pyx_pf___pyx_MemviewEnum___reduce_cython__(struct __pyx_MemviewEnum_obj *__pyx_v_self); /* proto */ +static PyObject *__pyx_pf___pyx_MemviewEnum_2__setstate_cython__(struct __pyx_MemviewEnum_obj *__pyx_v_self, PyObject *__pyx_v___pyx_state); /* proto */ +static int __pyx_memoryview___pyx_pf_15View_dot_MemoryView_10memoryview___cinit__(struct __pyx_memoryview_obj *__pyx_v_self, PyObject *__pyx_v_obj, int __pyx_v_flags, int __pyx_v_dtype_is_object); /* proto */ +static void __pyx_memoryview___pyx_pf_15View_dot_MemoryView_10memoryview_2__dealloc__(struct __pyx_memoryview_obj *__pyx_v_self); /* proto */ +static PyObject *__pyx_memoryview___pyx_pf_15View_dot_MemoryView_10memoryview_4__getitem__(struct __pyx_memoryview_obj *__pyx_v_self, PyObject *__pyx_v_index); /* proto */ +static int __pyx_memoryview___pyx_pf_15View_dot_MemoryView_10memoryview_6__setitem__(struct __pyx_memoryview_obj *__pyx_v_self, PyObject *__pyx_v_index, PyObject *__pyx_v_value); /* proto */ +static int __pyx_memoryview___pyx_pf_15View_dot_MemoryView_10memoryview_8__getbuffer__(struct __pyx_memoryview_obj *__pyx_v_self, Py_buffer *__pyx_v_info, int __pyx_v_flags); /* proto */ +static PyObject *__pyx_pf_15View_dot_MemoryView_10memoryview_1T___get__(struct __pyx_memoryview_obj *__pyx_v_self); /* proto */ +static PyObject *__pyx_pf_15View_dot_MemoryView_10memoryview_4base___get__(struct __pyx_memoryview_obj *__pyx_v_self); /* proto */ +static PyObject *__pyx_pf_15View_dot_MemoryView_10memoryview_5shape___get__(struct __pyx_memoryview_obj *__pyx_v_self); /* proto */ +static PyObject *__pyx_pf_15View_dot_MemoryView_10memoryview_7strides___get__(struct __pyx_memoryview_obj *__pyx_v_self); /* proto */ +static PyObject *__pyx_pf_15View_dot_MemoryView_10memoryview_10suboffsets___get__(struct __pyx_memoryview_obj *__pyx_v_self); /* proto */ +static PyObject *__pyx_pf_15View_dot_MemoryView_10memoryview_4ndim___get__(struct __pyx_memoryview_obj *__pyx_v_self); /* proto */ +static PyObject *__pyx_pf_15View_dot_MemoryView_10memoryview_8itemsize___get__(struct __pyx_memoryview_obj *__pyx_v_self); /* proto */ +static PyObject *__pyx_pf_15View_dot_MemoryView_10memoryview_6nbytes___get__(struct __pyx_memoryview_obj *__pyx_v_self); /* proto */ +static PyObject *__pyx_pf_15View_dot_MemoryView_10memoryview_4size___get__(struct __pyx_memoryview_obj *__pyx_v_self); /* proto */ +static Py_ssize_t __pyx_memoryview___pyx_pf_15View_dot_MemoryView_10memoryview_10__len__(struct __pyx_memoryview_obj *__pyx_v_self); /* proto */ +static PyObject *__pyx_memoryview___pyx_pf_15View_dot_MemoryView_10memoryview_12__repr__(struct __pyx_memoryview_obj *__pyx_v_self); /* proto */ +static PyObject *__pyx_memoryview___pyx_pf_15View_dot_MemoryView_10memoryview_14__str__(struct __pyx_memoryview_obj *__pyx_v_self); /* proto */ +static PyObject *__pyx_memoryview___pyx_pf_15View_dot_MemoryView_10memoryview_16is_c_contig(struct __pyx_memoryview_obj *__pyx_v_self); /* proto */ +static PyObject *__pyx_memoryview___pyx_pf_15View_dot_MemoryView_10memoryview_18is_f_contig(struct __pyx_memoryview_obj *__pyx_v_self); /* proto */ +static PyObject *__pyx_memoryview___pyx_pf_15View_dot_MemoryView_10memoryview_20copy(struct __pyx_memoryview_obj *__pyx_v_self); /* proto */ +static PyObject *__pyx_memoryview___pyx_pf_15View_dot_MemoryView_10memoryview_22copy_fortran(struct __pyx_memoryview_obj *__pyx_v_self); /* proto */ +static PyObject *__pyx_pf___pyx_memoryview___reduce_cython__(CYTHON_UNUSED struct __pyx_memoryview_obj *__pyx_v_self); /* proto */ +static PyObject *__pyx_pf___pyx_memoryview_2__setstate_cython__(CYTHON_UNUSED struct __pyx_memoryview_obj *__pyx_v_self, CYTHON_UNUSED PyObject *__pyx_v___pyx_state); /* proto */ +static void __pyx_memoryviewslice___pyx_pf_15View_dot_MemoryView_16_memoryviewslice___dealloc__(struct __pyx_memoryviewslice_obj *__pyx_v_self); /* proto */ +static PyObject *__pyx_pf___pyx_memoryviewslice___reduce_cython__(CYTHON_UNUSED struct __pyx_memoryviewslice_obj *__pyx_v_self); /* proto */ +static PyObject *__pyx_pf___pyx_memoryviewslice_2__setstate_cython__(CYTHON_UNUSED struct __pyx_memoryviewslice_obj *__pyx_v_self, CYTHON_UNUSED PyObject *__pyx_v___pyx_state); /* proto */ +static PyObject *__pyx_pf_15View_dot_MemoryView___pyx_unpickle_Enum(CYTHON_UNUSED PyObject *__pyx_self, PyObject *__pyx_v___pyx_type, long __pyx_v___pyx_checksum, PyObject *__pyx_v___pyx_state); /* proto */ +static int __pyx_pf_5spacy_8pipeline_17_parser_internals_17transition_system_16TransitionSystem___init__(struct __pyx_obj_5spacy_8pipeline_17_parser_internals_17transition_system_TransitionSystem *__pyx_v_self, struct __pyx_obj_5spacy_7strings_StringStore *__pyx_v_string_table, PyObject *__pyx_v_labels_by_action, PyObject *__pyx_v_min_freq, PyObject *__pyx_v_incorrect_spans_key); /* proto */ +static PyObject *__pyx_pf_5spacy_8pipeline_17_parser_internals_17transition_system_16TransitionSystem_2__reduce__(struct __pyx_obj_5spacy_8pipeline_17_parser_internals_17transition_system_TransitionSystem *__pyx_v_self); /* proto */ +static PyObject *__pyx_pf_5spacy_8pipeline_17_parser_internals_17transition_system_16TransitionSystem_7neg_key___get__(struct __pyx_obj_5spacy_8pipeline_17_parser_internals_17transition_system_TransitionSystem *__pyx_v_self); /* proto */ +static PyObject *__pyx_pf_5spacy_8pipeline_17_parser_internals_17transition_system_16TransitionSystem_4init_batch(CYTHON_UNUSED struct __pyx_obj_5spacy_8pipeline_17_parser_internals_17transition_system_TransitionSystem *__pyx_v_self, PyObject *__pyx_v_docs); /* proto */ +static PyObject *__pyx_pf_5spacy_8pipeline_17_parser_internals_17transition_system_16TransitionSystem_6get_oracle_sequence(struct __pyx_obj_5spacy_8pipeline_17_parser_internals_17transition_system_TransitionSystem *__pyx_v_self, struct __pyx_obj_5spacy_8training_7example_Example *__pyx_v_example, PyObject *__pyx_v__debug); /* proto */ +static PyObject *__pyx_pf_5spacy_8pipeline_17_parser_internals_17transition_system_16TransitionSystem_8get_oracle_sequence_from_state(struct __pyx_obj_5spacy_8pipeline_17_parser_internals_17transition_system_TransitionSystem *__pyx_v_self, struct __pyx_obj_5spacy_8pipeline_17_parser_internals_10stateclass_StateClass *__pyx_v_state, PyObject *__pyx_v_gold, PyObject *__pyx_v__debug); /* proto */ +static PyObject *__pyx_pf_5spacy_8pipeline_17_parser_internals_17transition_system_16TransitionSystem_10apply_transition(struct __pyx_obj_5spacy_8pipeline_17_parser_internals_17transition_system_TransitionSystem *__pyx_v_self, struct __pyx_obj_5spacy_8pipeline_17_parser_internals_10stateclass_StateClass *__pyx_v_state, PyObject *__pyx_v_name); /* proto */ +static PyObject *__pyx_pf_5spacy_8pipeline_17_parser_internals_17transition_system_16TransitionSystem_12is_valid(struct __pyx_obj_5spacy_8pipeline_17_parser_internals_17transition_system_TransitionSystem *__pyx_v_self, struct __pyx_obj_5spacy_8pipeline_17_parser_internals_10stateclass_StateClass *__pyx_v_stcls, PyObject *__pyx_v_move_name); /* proto */ +static PyObject *__pyx_pf_5spacy_8pipeline_17_parser_internals_17transition_system_16TransitionSystem_14get_class_name(struct __pyx_obj_5spacy_8pipeline_17_parser_internals_17transition_system_TransitionSystem *__pyx_v_self, int __pyx_v_clas); /* proto */ +static PyObject *__pyx_pf_5spacy_8pipeline_17_parser_internals_17transition_system_16TransitionSystem_16initialize_actions(struct __pyx_obj_5spacy_8pipeline_17_parser_internals_17transition_system_TransitionSystem *__pyx_v_self, PyObject *__pyx_v_labels_by_action, CYTHON_UNUSED PyObject *__pyx_v_min_freq); /* proto */ +static PyObject *__pyx_pf_5spacy_8pipeline_17_parser_internals_17transition_system_16TransitionSystem_18add_action(struct __pyx_obj_5spacy_8pipeline_17_parser_internals_17transition_system_TransitionSystem *__pyx_v_self, int __pyx_v_action, PyObject *__pyx_v_label_name); /* proto */ +static PyObject *__pyx_pf_5spacy_8pipeline_17_parser_internals_17transition_system_16TransitionSystem_20to_disk(struct __pyx_obj_5spacy_8pipeline_17_parser_internals_17transition_system_TransitionSystem *__pyx_v_self, PyObject *__pyx_v_path, PyObject *__pyx_v_kwargs); /* proto */ +static PyObject *__pyx_pf_5spacy_8pipeline_17_parser_internals_17transition_system_16TransitionSystem_22from_disk(struct __pyx_obj_5spacy_8pipeline_17_parser_internals_17transition_system_TransitionSystem *__pyx_v_self, PyObject *__pyx_v_path, PyObject *__pyx_v_kwargs); /* proto */ +static PyObject *__pyx_lambda_funcdef_lambda(PyObject *__pyx_self); /* proto */ +static PyObject *__pyx_lambda_funcdef_lambda1(PyObject *__pyx_self); /* proto */ +static PyObject *__pyx_lambda_funcdef_lambda2(PyObject *__pyx_self); /* proto */ +static PyObject *__pyx_pf_5spacy_8pipeline_17_parser_internals_17transition_system_16TransitionSystem_24to_bytes(struct __pyx_obj_5spacy_8pipeline_17_parser_internals_17transition_system_TransitionSystem *__pyx_v_self, PyObject *__pyx_v_exclude); /* proto */ +static PyObject *__pyx_pf_5spacy_8pipeline_17_parser_internals_17transition_system_16TransitionSystem_26from_bytes(struct __pyx_obj_5spacy_8pipeline_17_parser_internals_17transition_system_TransitionSystem *__pyx_v_self, PyObject *__pyx_v_bytes_data, PyObject *__pyx_v_exclude); /* proto */ +static PyObject *__pyx_pf_5spacy_8pipeline_17_parser_internals_17transition_system_16TransitionSystem_7n_moves___get__(struct __pyx_obj_5spacy_8pipeline_17_parser_internals_17transition_system_TransitionSystem *__pyx_v_self); /* proto */ +static PyObject *__pyx_pf_5spacy_8pipeline_17_parser_internals_17transition_system_16TransitionSystem_10root_label___get__(struct __pyx_obj_5spacy_8pipeline_17_parser_internals_17transition_system_TransitionSystem *__pyx_v_self); /* proto */ +static int __pyx_pf_5spacy_8pipeline_17_parser_internals_17transition_system_16TransitionSystem_10root_label_2__set__(struct __pyx_obj_5spacy_8pipeline_17_parser_internals_17transition_system_TransitionSystem *__pyx_v_self, PyObject *__pyx_v_value); /* proto */ +static PyObject *__pyx_pf_5spacy_8pipeline_17_parser_internals_17transition_system_16TransitionSystem_5freqs___get__(struct __pyx_obj_5spacy_8pipeline_17_parser_internals_17transition_system_TransitionSystem *__pyx_v_self); /* proto */ +static int __pyx_pf_5spacy_8pipeline_17_parser_internals_17transition_system_16TransitionSystem_5freqs_2__set__(struct __pyx_obj_5spacy_8pipeline_17_parser_internals_17transition_system_TransitionSystem *__pyx_v_self, PyObject *__pyx_v_value); /* proto */ +static int __pyx_pf_5spacy_8pipeline_17_parser_internals_17transition_system_16TransitionSystem_5freqs_4__del__(struct __pyx_obj_5spacy_8pipeline_17_parser_internals_17transition_system_TransitionSystem *__pyx_v_self); /* proto */ +static PyObject *__pyx_pf_5spacy_8pipeline_17_parser_internals_17transition_system_16TransitionSystem_6labels___get__(struct __pyx_obj_5spacy_8pipeline_17_parser_internals_17transition_system_TransitionSystem *__pyx_v_self); /* proto */ +static int __pyx_pf_5spacy_8pipeline_17_parser_internals_17transition_system_16TransitionSystem_6labels_2__set__(struct __pyx_obj_5spacy_8pipeline_17_parser_internals_17transition_system_TransitionSystem *__pyx_v_self, PyObject *__pyx_v_value); /* proto */ +static int __pyx_pf_5spacy_8pipeline_17_parser_internals_17transition_system_16TransitionSystem_6labels_4__del__(struct __pyx_obj_5spacy_8pipeline_17_parser_internals_17transition_system_TransitionSystem *__pyx_v_self); /* proto */ +static PyObject *__pyx_pf_5spacy_8pipeline_17_parser_internals_17transition_system_16TransitionSystem_3cfg___get__(struct __pyx_obj_5spacy_8pipeline_17_parser_internals_17transition_system_TransitionSystem *__pyx_v_self); /* proto */ +static int __pyx_pf_5spacy_8pipeline_17_parser_internals_17transition_system_16TransitionSystem_3cfg_2__set__(struct __pyx_obj_5spacy_8pipeline_17_parser_internals_17transition_system_TransitionSystem *__pyx_v_self, PyObject *__pyx_v_value); /* proto */ +static int __pyx_pf_5spacy_8pipeline_17_parser_internals_17transition_system_16TransitionSystem_3cfg_4__del__(struct __pyx_obj_5spacy_8pipeline_17_parser_internals_17transition_system_TransitionSystem *__pyx_v_self); /* proto */ +static PyObject *__pyx_tp_new_5spacy_8pipeline_17_parser_internals_17transition_system_TransitionSystem(PyTypeObject *t, PyObject *a, PyObject *k); /*proto*/ +static PyObject *__pyx_tp_new_5spacy_8pipeline_17_parser_internals_17transition_system___pyx_scope_struct__to_bytes(PyTypeObject *t, PyObject *a, PyObject *k); /*proto*/ +static PyObject *__pyx_tp_new_array(PyTypeObject *t, PyObject *a, PyObject *k); /*proto*/ +static PyObject *__pyx_tp_new_Enum(PyTypeObject *t, PyObject *a, PyObject *k); /*proto*/ +static PyObject *__pyx_tp_new_memoryview(PyTypeObject *t, PyObject *a, PyObject *k); /*proto*/ +static PyObject *__pyx_tp_new__memoryviewslice(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_5cymem_5cymem_PyMalloc; + PyTypeObject *__pyx_ptype_5cymem_5cymem_PyFree; + PyTypeObject *__pyx_ptype_5cymem_5cymem_Pool; + PyTypeObject *__pyx_ptype_5cymem_5cymem_Address; + PyTypeObject *__pyx_ptype_7preshed_4maps_PreshMap; + PyTypeObject *__pyx_ptype_7preshed_4maps_PreshMapArray; + PyTypeObject *__pyx_ptype_5spacy_7strings_StringStore; + PyTypeObject *__pyx_ptype_7cpython_4type_type; + PyTypeObject *__pyx_ptype_5numpy_dtype; + PyTypeObject *__pyx_ptype_5numpy_flatiter; + PyTypeObject *__pyx_ptype_5numpy_broadcast; + PyTypeObject *__pyx_ptype_5numpy_ndarray; + PyTypeObject *__pyx_ptype_5numpy_generic; + PyTypeObject *__pyx_ptype_5numpy_number; + PyTypeObject *__pyx_ptype_5numpy_integer; + PyTypeObject *__pyx_ptype_5numpy_signedinteger; + PyTypeObject *__pyx_ptype_5numpy_unsignedinteger; + PyTypeObject *__pyx_ptype_5numpy_inexact; + PyTypeObject *__pyx_ptype_5numpy_floating; + PyTypeObject *__pyx_ptype_5numpy_complexfloating; + PyTypeObject *__pyx_ptype_5numpy_flexible; + PyTypeObject *__pyx_ptype_5numpy_character; + PyTypeObject *__pyx_ptype_5numpy_ufunc; + PyTypeObject *__pyx_ptype_5spacy_10morphology_Morphology; + PyTypeObject *__pyx_ptype_5spacy_5vocab_Vocab; + PyTypeObject *__pyx_ptype_5spacy_6tokens_3doc_Doc; + PyTypeObject *__pyx_ptype_5spacy_8training_7example_Example; + PyTypeObject *__pyx_ptype_5spacy_6lexeme_Lexeme; + PyTypeObject *__pyx_ptype_5spacy_8pipeline_17_parser_internals_10stateclass_StateClass; + PyObject *__pyx_type_5spacy_8pipeline_17_parser_internals_17transition_system_TransitionSystem; + PyObject *__pyx_type_5spacy_8pipeline_17_parser_internals_17transition_system___pyx_scope_struct__to_bytes; + PyObject *__pyx_type___pyx_array; + PyObject *__pyx_type___pyx_MemviewEnum; + PyObject *__pyx_type___pyx_memoryview; + PyObject *__pyx_type___pyx_memoryviewslice; + PyTypeObject *__pyx_ptype_5spacy_8pipeline_17_parser_internals_17transition_system_TransitionSystem; + PyTypeObject *__pyx_ptype_5spacy_8pipeline_17_parser_internals_17transition_system___pyx_scope_struct__to_bytes; + PyTypeObject *__pyx_array_type; + PyTypeObject *__pyx_MemviewEnum_type; + PyTypeObject *__pyx_memoryview_type; + PyTypeObject *__pyx_memoryviewslice_type; + __Pyx_CachedCFunction __pyx_umethod_PyDict_Type_items; + __Pyx_CachedCFunction __pyx_umethod_PyDict_Type_pop; + __Pyx_CachedCFunction __pyx_umethod_PyDict_Type_values; + __Pyx_CachedCFunction __pyx_umethod_PyDict_Type__update; + PyObject *__pyx_k__11; + PyObject *__pyx_k__12; + PyObject *__pyx_slice[1]; + PyObject *__pyx_tuple[5]; + PyObject *__pyx_codeobj_tab[16]; + PyObject *__pyx_string_tab[270]; + PyObject *__pyx_number_tab[4]; +/* #### 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; + + +#if CYTHON_USE_FREELISTS +struct __pyx_obj_5spacy_8pipeline_17_parser_internals_17transition_system___pyx_scope_struct__to_bytes *__pyx_freelist_5spacy_8pipeline_17_parser_internals_17transition_system___pyx_scope_struct__to_bytes[8]; +int __pyx_freecount_5spacy_8pipeline_17_parser_internals_17transition_system___pyx_scope_struct__to_bytes; +#endif +/* 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_All_dimensions_preceding_dimensi __pyx_string_tab[1] +#define __pyx_kp_u_B0 __pyx_string_tab[2] +#define __pyx_kp_u_Buffer_view_does_not_expose_stri __pyx_string_tab[3] +#define __pyx_kp_u_Can_only_create_a_buffer_that_is __pyx_string_tab[4] +#define __pyx_kp_u_Cannot_assign_to_read_only_memor __pyx_string_tab[5] +#define __pyx_kp_u_Cannot_create_writable_memory_vi __pyx_string_tab[6] +#define __pyx_kp_u_Cannot_index_with_type __pyx_string_tab[7] +#define __pyx_kp_u_Cannot_transpose_memoryview_with __pyx_string_tab[8] +#define __pyx_kp_u_Dimension_d_is_not_direct __pyx_string_tab[9] +#define __pyx_kp_u_Empty_shape_tuple_for_cython_arr __pyx_string_tab[10] +#define __pyx_kp_u_Index_out_of_bounds_axis_d __pyx_string_tab[11] +#define __pyx_kp_u_Indirect_dimensions_not_supporte __pyx_string_tab[12] +#define __pyx_kp_u_Invalid_mode_expected_c_or_fortr __pyx_string_tab[13] +#define __pyx_kp_u_Invalid_shape_in_axis __pyx_string_tab[14] +#define __pyx_kp_u_MemoryView_of __pyx_string_tab[15] +#define __pyx_kp_u_Note_that_Cython_is_deliberately __pyx_string_tab[16] +#define __pyx_kp_u_Out_of_bounds_on_buffer_access_a __pyx_string_tab[17] +#define __pyx_kp_u_S0 __pyx_string_tab[18] +#define __pyx_kp_u_S0_head __pyx_string_tab[19] +#define __pyx_kp_u_Step_may_not_be_zero_axis_d __pyx_string_tab[20] +#define __pyx_kp_u_Unable_to_convert_item_to_object __pyx_string_tab[21] +#define __pyx_kp_u__10 __pyx_string_tab[22] +#define __pyx_kp_u__2 __pyx_string_tab[23] +#define __pyx_kp_u__3 __pyx_string_tab[24] +#define __pyx_kp_u__4 __pyx_string_tab[25] +#define __pyx_kp_u__5 __pyx_string_tab[26] +#define __pyx_kp_u__6 __pyx_string_tab[27] +#define __pyx_kp_u__8 __pyx_string_tab[28] +#define __pyx_kp_u__9 __pyx_string_tab[29] +#define __pyx_kp_u_add_note __pyx_string_tab[30] +#define __pyx_kp_u_and __pyx_string_tab[31] +#define __pyx_kp_u_at_0x __pyx_string_tab[32] +#define __pyx_kp_u_collections_abc __pyx_string_tab[33] +#define __pyx_kp_u_contiguous_and_direct __pyx_string_tab[34] +#define __pyx_kp_u_contiguous_and_indirect __pyx_string_tab[35] +#define __pyx_kp_u_disable __pyx_string_tab[36] +#define __pyx_kp_u_enable __pyx_string_tab[37] +#define __pyx_kp_u_gc __pyx_string_tab[38] +#define __pyx_kp_u_got __pyx_string_tab[39] +#define __pyx_kp_u_got_differing_extents_in_dimensi __pyx_string_tab[40] +#define __pyx_kp_u_isenabled __pyx_string_tab[41] +#define __pyx_kp_u_itemsize_0_for_cython_array __pyx_string_tab[42] +#define __pyx_kp_u_no_default___reduce___due_to_non __pyx_string_tab[43] +#define __pyx_kp_u_numpy__core_multiarray_failed_to __pyx_string_tab[44] +#define __pyx_kp_u_numpy__core_umath_failed_to_impo __pyx_string_tab[45] +#define __pyx_kp_u_object __pyx_string_tab[46] +#define __pyx_kp_u_self_name_is_not_None __pyx_string_tab[47] +#define __pyx_kp_u_spacy __pyx_string_tab[48] +#define __pyx_kp_u_spacy_errors __pyx_string_tab[49] +#define __pyx_kp_u_spacy_pipeline__parser_internals_2 __pyx_string_tab[50] +#define __pyx_kp_u_spacy_pipeline__parser_internals_3 __pyx_string_tab[51] +#define __pyx_kp_u_spacy_pipeline__parser_internals_4 __pyx_string_tab[52] +#define __pyx_kp_u_strided_and_direct __pyx_string_tab[53] +#define __pyx_kp_u_strided_and_direct_or_indirect __pyx_string_tab[54] +#define __pyx_kp_u_strided_and_indirect __pyx_string_tab[55] +#define __pyx_kp_u_unable_to_allocate_array_data __pyx_string_tab[56] +#define __pyx_kp_u_unable_to_allocate_shape_and_str __pyx_string_tab[57] +#define __pyx_n_u_ASCII __pyx_string_tab[58] +#define __pyx_n_u_Actions __pyx_string_tab[59] +#define __pyx_n_u_B __pyx_string_tab[60] +#define __pyx_n_u_Counter __pyx_string_tab[61] +#define __pyx_n_u_E024 __pyx_string_tab[62] +#define __pyx_n_u_E170 __pyx_string_tab[63] +#define __pyx_n_u_Ellipsis __pyx_string_tab[64] +#define __pyx_n_u_Errors __pyx_string_tab[65] +#define __pyx_n_u_Gold __pyx_string_tab[66] +#define __pyx_n_u_L __pyx_string_tab[67] +#define __pyx_n_u_OracleError __pyx_string_tab[68] +#define __pyx_n_u_Pyx_PyDict_NextRef __pyx_string_tab[69] +#define __pyx_n_u_ROOT __pyx_string_tab[70] +#define __pyx_n_u_S __pyx_string_tab[71] +#define __pyx_n_u_Sequence __pyx_string_tab[72] +#define __pyx_n_u_TransitionSystem __pyx_string_tab[73] +#define __pyx_n_u_TransitionSystem___reduce __pyx_string_tab[74] +#define __pyx_n_u_TransitionSystem_add_action __pyx_string_tab[75] +#define __pyx_n_u_TransitionSystem_apply_transitio __pyx_string_tab[76] +#define __pyx_n_u_TransitionSystem_from_bytes __pyx_string_tab[77] +#define __pyx_n_u_TransitionSystem_from_disk __pyx_string_tab[78] +#define __pyx_n_u_TransitionSystem_get_class_name __pyx_string_tab[79] +#define __pyx_n_u_TransitionSystem_get_oracle_sequ __pyx_string_tab[80] +#define __pyx_n_u_TransitionSystem_get_oracle_sequ_2 __pyx_string_tab[81] +#define __pyx_n_u_TransitionSystem_init_batch __pyx_string_tab[82] +#define __pyx_n_u_TransitionSystem_initialize_acti __pyx_string_tab[83] +#define __pyx_n_u_TransitionSystem_is_valid __pyx_string_tab[84] +#define __pyx_n_u_TransitionSystem_to_bytes __pyx_string_tab[85] +#define __pyx_n_u_TransitionSystem_to_disk __pyx_string_tab[86] +#define __pyx_n_u_View_MemoryView __pyx_string_tab[87] +#define __pyx_n_u__13 __pyx_string_tab[88] +#define __pyx_n_u__14 __pyx_string_tab[89] +#define __pyx_n_u__7 __pyx_string_tab[90] +#define __pyx_n_u_abc __pyx_string_tab[91] +#define __pyx_n_u_act __pyx_string_tab[92] +#define __pyx_n_u_action __pyx_string_tab[93] +#define __pyx_n_u_add __pyx_string_tab[94] +#define __pyx_n_u_add_action __pyx_string_tab[95] +#define __pyx_n_u_added_actions __pyx_string_tab[96] +#define __pyx_n_u_added_labels __pyx_string_tab[97] +#define __pyx_n_u_allocate_buffer __pyx_string_tab[98] +#define __pyx_n_u_append __pyx_string_tab[99] +#define __pyx_n_u_apply_transition __pyx_string_tab[100] +#define __pyx_n_u_asyncio_coroutines __pyx_string_tab[101] +#define __pyx_n_u_b0 __pyx_string_tab[102] +#define __pyx_n_u_base __pyx_string_tab[103] +#define __pyx_n_u_byte_data __pyx_string_tab[104] +#define __pyx_n_u_bytes_data __pyx_string_tab[105] +#define __pyx_n_u_c __pyx_string_tab[106] +#define __pyx_n_u_cfg __pyx_string_tab[107] +#define __pyx_n_u_clas __pyx_string_tab[108] +#define __pyx_n_u_class __pyx_string_tab[109] +#define __pyx_n_u_class_getitem __pyx_string_tab[110] +#define __pyx_n_u_cline_in_traceback __pyx_string_tab[111] +#define __pyx_n_u_collections __pyx_string_tab[112] +#define __pyx_n_u_costs __pyx_string_tab[113] +#define __pyx_n_u_count __pyx_string_tab[114] +#define __pyx_n_u_debug __pyx_string_tab[115] +#define __pyx_n_u_debug_log __pyx_string_tab[116] +#define __pyx_n_u_dep __pyx_string_tab[117] +#define __pyx_n_u_dict __pyx_string_tab[118] +#define __pyx_n_u_doc __pyx_string_tab[119] +#define __pyx_n_u_doc_2 __pyx_string_tab[120] +#define __pyx_n_u_docs __pyx_string_tab[121] +#define __pyx_n_u_dtype_is_object __pyx_string_tab[122] +#define __pyx_n_u_encode __pyx_string_tab[123] +#define __pyx_n_u_enter __pyx_string_tab[124] +#define __pyx_n_u_enumerate __pyx_string_tab[125] +#define __pyx_n_u_error __pyx_string_tab[126] +#define __pyx_n_u_errors __pyx_string_tab[127] +#define __pyx_n_u_example __pyx_string_tab[128] +#define __pyx_n_u_exclude __pyx_string_tab[129] +#define __pyx_n_u_exit __pyx_string_tab[130] +#define __pyx_n_u_f __pyx_string_tab[131] +#define __pyx_n_u_file __pyx_string_tab[132] +#define __pyx_n_u_flags __pyx_string_tab[133] +#define __pyx_n_u_format __pyx_string_tab[134] +#define __pyx_n_u_fortran __pyx_string_tab[135] +#define __pyx_n_u_freq __pyx_string_tab[136] +#define __pyx_n_u_from_bytes __pyx_string_tab[137] +#define __pyx_n_u_from_disk __pyx_string_tab[138] +#define __pyx_n_u_func __pyx_string_tab[139] +#define __pyx_n_u_get __pyx_string_tab[140] +#define __pyx_n_u_get_class_name __pyx_string_tab[141] +#define __pyx_n_u_get_oracle_sequence __pyx_string_tab[142] +#define __pyx_n_u_get_oracle_sequence_from_state __pyx_string_tab[143] +#define __pyx_n_u_getstate __pyx_string_tab[144] +#define __pyx_n_u_gold __pyx_string_tab[145] +#define __pyx_n_u_golds __pyx_string_tab[146] +#define __pyx_n_u_has_head __pyx_string_tab[147] +#define __pyx_n_u_head __pyx_string_tab[148] +#define __pyx_n_u_history __pyx_string_tab[149] +#define __pyx_n_u_i __pyx_string_tab[150] +#define __pyx_n_u_id __pyx_string_tab[151] +#define __pyx_n_u_import __pyx_string_tab[152] +#define __pyx_n_u_incorrect_spans_key __pyx_string_tab[153] +#define __pyx_n_u_index __pyx_string_tab[154] +#define __pyx_n_u_init_batch __pyx_string_tab[155] +#define __pyx_n_u_init_gold_batch __pyx_string_tab[156] +#define __pyx_n_u_initialize_actions __pyx_string_tab[157] +#define __pyx_n_u_is_coroutine __pyx_string_tab[158] +#define __pyx_n_u_is_final __pyx_string_tab[159] +#define __pyx_n_u_is_valid __pyx_string_tab[160] +#define __pyx_n_u_items __pyx_string_tab[161] +#define __pyx_n_u_itemsize __pyx_string_tab[162] +#define __pyx_n_u_json_dumps __pyx_string_tab[163] +#define __pyx_n_u_json_loads __pyx_string_tab[164] +#define __pyx_n_u_kwargs __pyx_string_tab[165] +#define __pyx_n_u_label_freqs __pyx_string_tab[166] +#define __pyx_n_u_label_id __pyx_string_tab[167] +#define __pyx_n_u_label_name __pyx_string_tab[168] +#define __pyx_n_u_label_str __pyx_string_tab[169] +#define __pyx_n_u_labels __pyx_string_tab[170] +#define __pyx_n_u_labels_by_action __pyx_string_tab[171] +#define __pyx_n_u_lambda __pyx_string_tab[172] +#define __pyx_n_u_main __pyx_string_tab[173] +#define __pyx_n_u_mem __pyx_string_tab[174] +#define __pyx_n_u_memview __pyx_string_tab[175] +#define __pyx_n_u_metaclass __pyx_string_tab[176] +#define __pyx_n_u_min __pyx_string_tab[177] +#define __pyx_n_u_min_freq __pyx_string_tab[178] +#define __pyx_n_u_mode __pyx_string_tab[179] +#define __pyx_n_u_module __pyx_string_tab[180] +#define __pyx_n_u_move_name __pyx_string_tab[181] +#define __pyx_n_u_moves __pyx_string_tab[182] +#define __pyx_n_u_mro_entries __pyx_string_tab[183] +#define __pyx_n_u_msg __pyx_string_tab[184] +#define __pyx_n_u_msgpack_loads __pyx_string_tab[185] +#define __pyx_n_u_name __pyx_string_tab[186] +#define __pyx_n_u_name_2 __pyx_string_tab[187] +#define __pyx_n_u_ndim __pyx_string_tab[188] +#define __pyx_n_u_neg_key __pyx_string_tab[189] +#define __pyx_n_u_new __pyx_string_tab[190] +#define __pyx_n_u_new_freq __pyx_string_tab[191] +#define __pyx_n_u_obj __pyx_string_tab[192] +#define __pyx_n_u_offset __pyx_string_tab[193] +#define __pyx_n_u_open __pyx_string_tab[194] +#define __pyx_n_u_pack __pyx_string_tab[195] +#define __pyx_n_u_path __pyx_string_tab[196] +#define __pyx_n_u_pop __pyx_string_tab[197] +#define __pyx_n_u_prepare __pyx_string_tab[198] +#define __pyx_n_u_print __pyx_string_tab[199] +#define __pyx_n_u_pyx_checksum __pyx_string_tab[200] +#define __pyx_n_u_pyx_state __pyx_string_tab[201] +#define __pyx_n_u_pyx_type __pyx_string_tab[202] +#define __pyx_n_u_pyx_unpickle_Enum __pyx_string_tab[203] +#define __pyx_n_u_pyx_vtable __pyx_string_tab[204] +#define __pyx_n_u_qualname __pyx_string_tab[205] +#define __pyx_n_u_rb __pyx_string_tab[206] +#define __pyx_n_u_read __pyx_string_tab[207] +#define __pyx_n_u_reduce __pyx_string_tab[208] +#define __pyx_n_u_reduce_cython __pyx_string_tab[209] +#define __pyx_n_u_reduce_ex __pyx_string_tab[210] +#define __pyx_n_u_register __pyx_string_tab[211] +#define __pyx_n_u_reverse __pyx_string_tab[212] +#define __pyx_n_u_s0 __pyx_string_tab[213] +#define __pyx_n_u_self __pyx_string_tab[214] +#define __pyx_n_u_serializers __pyx_string_tab[215] +#define __pyx_n_u_set_name __pyx_string_tab[216] +#define __pyx_n_u_setdefault __pyx_string_tab[217] +#define __pyx_n_u_setstate __pyx_string_tab[218] +#define __pyx_n_u_setstate_cython __pyx_string_tab[219] +#define __pyx_n_u_shape __pyx_string_tab[220] +#define __pyx_n_u_size __pyx_string_tab[221] +#define __pyx_n_u_sort __pyx_string_tab[222] +#define __pyx_n_u_sorted_labels __pyx_string_tab[223] +#define __pyx_n_u_spacy_pipeline__parser_internals __pyx_string_tab[224] +#define __pyx_n_u_srsly __pyx_string_tab[225] +#define __pyx_n_u_start __pyx_string_tab[226] +#define __pyx_n_u_state __pyx_string_tab[227] +#define __pyx_n_u_states __pyx_string_tab[228] +#define __pyx_n_u_stcls __pyx_string_tab[229] +#define __pyx_n_u_step __pyx_string_tab[230] +#define __pyx_n_u_stop __pyx_string_tab[231] +#define __pyx_n_u_string_table __pyx_string_tab[232] +#define __pyx_n_u_strings __pyx_string_tab[233] +#define __pyx_n_u_struct __pyx_string_tab[234] +#define __pyx_n_u_test __pyx_string_tab[235] +#define __pyx_n_u_text __pyx_string_tab[236] +#define __pyx_n_u_to_bytes __pyx_string_tab[237] +#define __pyx_n_u_to_bytes_locals_lambda __pyx_string_tab[238] +#define __pyx_n_u_to_disk __pyx_string_tab[239] +#define __pyx_n_u_token __pyx_string_tab[240] +#define __pyx_n_u_trans __pyx_string_tab[241] +#define __pyx_n_u_unpack __pyx_string_tab[242] +#define __pyx_n_u_update __pyx_string_tab[243] +#define __pyx_n_u_util __pyx_string_tab[244] +#define __pyx_n_u_values __pyx_string_tab[245] +#define __pyx_n_u_wb __pyx_string_tab[246] +#define __pyx_n_u_write __pyx_string_tab[247] +#define __pyx_n_u_x __pyx_string_tab[248] +#define __pyx_n_u_y __pyx_string_tab[249] +#define __pyx_kp_b_iso88591_84q __pyx_string_tab[250] +#define __pyx_kp_b_iso88591_A_4t9AWA_AV5_q_Q_q_c_t6 __pyx_string_tab[251] +#define __pyx_kp_b_iso88591_A_4z_a_t84q_q_IT_2T_uF_WD_WCq_q __pyx_string_tab[252] +#define __pyx_kp_b_iso88591_A_G1_JauG1_c_q __pyx_string_tab[253] +#define __pyx_kp_b_iso88591_A_Ja_Kq_q_HO6_S_q_Bc_D_5_6_a_m1 __pyx_string_tab[254] +#define __pyx_kp_b_iso88591_A_M_Zt_V1 __pyx_string_tab[255] +#define __pyx_kp_b_iso88591_A_ay_U_Kq_Q_q __pyx_string_tab[256] +#define __pyx_kp_b_iso88591_A_ay_q_IS __pyx_string_tab[257] +#define __pyx_kp_b_iso88591_A_d_AQ_t_Qc_1 __pyx_string_tab[258] +#define __pyx_kp_b_iso88591_A_q_vYauD_a __pyx_string_tab[259] +#define __pyx_kp_b_iso88591_LA_A_t9Ba_6_j_6_F_4z_A_d_y_WE_Q __pyx_string_tab[260] +#define __pyx_kp_b_iso88591_U_e_87_3aq_WA_1Cq_6_F_Q_G1Cq_q __pyx_string_tab[261] +#define __pyx_kp_b_iso88591_XU_Qd __pyx_string_tab[262] +#define __pyx_kp_b_iso88591_t4_q_4q_1_aq_uAQ_1_4_6awfG1_4_6 __pyx_string_tab[263] +#define __pyx_kp_b_iso88591_uA_Q_q_1_t9A __pyx_string_tab[264] +#define __pyx_kp_b_iso88591_xt89A __pyx_string_tab[265] +#define __pyx_kp_b_pyx_t_5spacy_8typedefs_attr_t __pyx_string_tab[266] +#define __pyx_kp_b_struct___pyx_t_5spacy_7structs_L __pyx_string_tab[267] +#define __pyx_kp_b_uint64_t_void_int_uint64_t_hash6 __pyx_string_tab[268] +#define __pyx_n_b_O __pyx_string_tab[269] +#define __pyx_int_0 __pyx_number_tab[0] +#define __pyx_int_neg_1 __pyx_number_tab[1] +#define __pyx_int_1 __pyx_number_tab[2] +#define __pyx_int_136983863 __pyx_number_tab[3] +/* #### 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_5cymem_5cymem_PyMalloc); + Py_CLEAR(clear_module_state->__pyx_ptype_5cymem_5cymem_PyFree); + Py_CLEAR(clear_module_state->__pyx_ptype_5cymem_5cymem_Pool); + Py_CLEAR(clear_module_state->__pyx_ptype_5cymem_5cymem_Address); + Py_CLEAR(clear_module_state->__pyx_ptype_7preshed_4maps_PreshMap); + Py_CLEAR(clear_module_state->__pyx_ptype_7preshed_4maps_PreshMapArray); + Py_CLEAR(clear_module_state->__pyx_ptype_5spacy_7strings_StringStore); + Py_CLEAR(clear_module_state->__pyx_ptype_7cpython_4type_type); + Py_CLEAR(clear_module_state->__pyx_ptype_5numpy_dtype); + Py_CLEAR(clear_module_state->__pyx_ptype_5numpy_flatiter); + Py_CLEAR(clear_module_state->__pyx_ptype_5numpy_broadcast); + Py_CLEAR(clear_module_state->__pyx_ptype_5numpy_ndarray); + Py_CLEAR(clear_module_state->__pyx_ptype_5numpy_generic); + Py_CLEAR(clear_module_state->__pyx_ptype_5numpy_number); + Py_CLEAR(clear_module_state->__pyx_ptype_5numpy_integer); + Py_CLEAR(clear_module_state->__pyx_ptype_5numpy_signedinteger); + Py_CLEAR(clear_module_state->__pyx_ptype_5numpy_unsignedinteger); + Py_CLEAR(clear_module_state->__pyx_ptype_5numpy_inexact); + Py_CLEAR(clear_module_state->__pyx_ptype_5numpy_floating); + Py_CLEAR(clear_module_state->__pyx_ptype_5numpy_complexfloating); + Py_CLEAR(clear_module_state->__pyx_ptype_5numpy_flexible); + Py_CLEAR(clear_module_state->__pyx_ptype_5numpy_character); + Py_CLEAR(clear_module_state->__pyx_ptype_5numpy_ufunc); + Py_CLEAR(clear_module_state->__pyx_ptype_5spacy_10morphology_Morphology); + Py_CLEAR(clear_module_state->__pyx_ptype_5spacy_5vocab_Vocab); + Py_CLEAR(clear_module_state->__pyx_ptype_5spacy_6tokens_3doc_Doc); + Py_CLEAR(clear_module_state->__pyx_ptype_5spacy_8training_7example_Example); + Py_CLEAR(clear_module_state->__pyx_ptype_5spacy_6lexeme_Lexeme); + Py_CLEAR(clear_module_state->__pyx_ptype_5spacy_8pipeline_17_parser_internals_10stateclass_StateClass); + Py_CLEAR(clear_module_state->__pyx_ptype_5spacy_8pipeline_17_parser_internals_17transition_system_TransitionSystem); + Py_CLEAR(clear_module_state->__pyx_type_5spacy_8pipeline_17_parser_internals_17transition_system_TransitionSystem); + Py_CLEAR(clear_module_state->__pyx_ptype_5spacy_8pipeline_17_parser_internals_17transition_system___pyx_scope_struct__to_bytes); + Py_CLEAR(clear_module_state->__pyx_type_5spacy_8pipeline_17_parser_internals_17transition_system___pyx_scope_struct__to_bytes); + Py_CLEAR(clear_module_state->__pyx_array_type); + Py_CLEAR(clear_module_state->__pyx_type___pyx_array); + Py_CLEAR(clear_module_state->__pyx_MemviewEnum_type); + Py_CLEAR(clear_module_state->__pyx_type___pyx_MemviewEnum); + Py_CLEAR(clear_module_state->__pyx_memoryview_type); + Py_CLEAR(clear_module_state->__pyx_type___pyx_memoryview); + Py_CLEAR(clear_module_state->__pyx_memoryviewslice_type); + Py_CLEAR(clear_module_state->__pyx_type___pyx_memoryviewslice); + Py_CLEAR(clear_module_state->__pyx_k__11); + Py_CLEAR(clear_module_state->__pyx_k__12); + for (int i=0; i<1; ++i) { Py_CLEAR(clear_module_state->__pyx_slice[i]); } + for (int i=0; i<5; ++i) { Py_CLEAR(clear_module_state->__pyx_tuple[i]); } + for (int i=0; i<16; ++i) { Py_CLEAR(clear_module_state->__pyx_codeobj_tab[i]); } + for (int i=0; i<270; ++i) { Py_CLEAR(clear_module_state->__pyx_string_tab[i]); } + for (int i=0; i<4; ++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_5cymem_5cymem_PyMalloc); + Py_VISIT(traverse_module_state->__pyx_ptype_5cymem_5cymem_PyFree); + Py_VISIT(traverse_module_state->__pyx_ptype_5cymem_5cymem_Pool); + Py_VISIT(traverse_module_state->__pyx_ptype_5cymem_5cymem_Address); + Py_VISIT(traverse_module_state->__pyx_ptype_7preshed_4maps_PreshMap); + Py_VISIT(traverse_module_state->__pyx_ptype_7preshed_4maps_PreshMapArray); + Py_VISIT(traverse_module_state->__pyx_ptype_5spacy_7strings_StringStore); + Py_VISIT(traverse_module_state->__pyx_ptype_7cpython_4type_type); + Py_VISIT(traverse_module_state->__pyx_ptype_5numpy_dtype); + Py_VISIT(traverse_module_state->__pyx_ptype_5numpy_flatiter); + Py_VISIT(traverse_module_state->__pyx_ptype_5numpy_broadcast); + Py_VISIT(traverse_module_state->__pyx_ptype_5numpy_ndarray); + Py_VISIT(traverse_module_state->__pyx_ptype_5numpy_generic); + Py_VISIT(traverse_module_state->__pyx_ptype_5numpy_number); + Py_VISIT(traverse_module_state->__pyx_ptype_5numpy_integer); + Py_VISIT(traverse_module_state->__pyx_ptype_5numpy_signedinteger); + Py_VISIT(traverse_module_state->__pyx_ptype_5numpy_unsignedinteger); + Py_VISIT(traverse_module_state->__pyx_ptype_5numpy_inexact); + Py_VISIT(traverse_module_state->__pyx_ptype_5numpy_floating); + Py_VISIT(traverse_module_state->__pyx_ptype_5numpy_complexfloating); + Py_VISIT(traverse_module_state->__pyx_ptype_5numpy_flexible); + Py_VISIT(traverse_module_state->__pyx_ptype_5numpy_character); + Py_VISIT(traverse_module_state->__pyx_ptype_5numpy_ufunc); + Py_VISIT(traverse_module_state->__pyx_ptype_5spacy_10morphology_Morphology); + Py_VISIT(traverse_module_state->__pyx_ptype_5spacy_5vocab_Vocab); + Py_VISIT(traverse_module_state->__pyx_ptype_5spacy_6tokens_3doc_Doc); + Py_VISIT(traverse_module_state->__pyx_ptype_5spacy_8training_7example_Example); + Py_VISIT(traverse_module_state->__pyx_ptype_5spacy_6lexeme_Lexeme); + Py_VISIT(traverse_module_state->__pyx_ptype_5spacy_8pipeline_17_parser_internals_10stateclass_StateClass); + Py_VISIT(traverse_module_state->__pyx_ptype_5spacy_8pipeline_17_parser_internals_17transition_system_TransitionSystem); + Py_VISIT(traverse_module_state->__pyx_type_5spacy_8pipeline_17_parser_internals_17transition_system_TransitionSystem); + Py_VISIT(traverse_module_state->__pyx_ptype_5spacy_8pipeline_17_parser_internals_17transition_system___pyx_scope_struct__to_bytes); + Py_VISIT(traverse_module_state->__pyx_type_5spacy_8pipeline_17_parser_internals_17transition_system___pyx_scope_struct__to_bytes); + Py_VISIT(traverse_module_state->__pyx_array_type); + Py_VISIT(traverse_module_state->__pyx_type___pyx_array); + Py_VISIT(traverse_module_state->__pyx_MemviewEnum_type); + Py_VISIT(traverse_module_state->__pyx_type___pyx_MemviewEnum); + Py_VISIT(traverse_module_state->__pyx_memoryview_type); + Py_VISIT(traverse_module_state->__pyx_type___pyx_memoryview); + Py_VISIT(traverse_module_state->__pyx_memoryviewslice_type); + Py_VISIT(traverse_module_state->__pyx_type___pyx_memoryviewslice); + Py_VISIT(traverse_module_state->__pyx_k__11); + Py_VISIT(traverse_module_state->__pyx_k__12); + for (int i=0; i<1; ++i) { __Pyx_VISIT_CONST(traverse_module_state->__pyx_slice[i]); } + for (int i=0; i<5; ++i) { __Pyx_VISIT_CONST(traverse_module_state->__pyx_tuple[i]); } + for (int i=0; i<16; ++i) { __Pyx_VISIT_CONST(traverse_module_state->__pyx_codeobj_tab[i]); } + for (int i=0; i<270; ++i) { __Pyx_VISIT_CONST(traverse_module_state->__pyx_string_tab[i]); } + for (int i=0; i<4; ++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 ### */ + +/* "View.MemoryView":129 + * cdef bint dtype_is_object + * + * def __cinit__(array self, tuple shape, Py_ssize_t itemsize, format not None, # <<<<<<<<<<<<<< + * mode="c", bint allocate_buffer=True): + * +*/ + +/* Python wrapper */ +static int __pyx_array___cinit__(PyObject *__pyx_v_self, PyObject *__pyx_args, PyObject *__pyx_kwds); /*proto*/ +static int __pyx_array___cinit__(PyObject *__pyx_v_self, PyObject *__pyx_args, PyObject *__pyx_kwds) { + PyObject *__pyx_v_shape = 0; + Py_ssize_t __pyx_v_itemsize; + PyObject *__pyx_v_format = 0; + PyObject *__pyx_v_mode = 0; + int __pyx_v_allocate_buffer; + CYTHON_UNUSED Py_ssize_t __pyx_nargs; + CYTHON_UNUSED PyObject *const *__pyx_kwvalues; + PyObject* values[5] = {0,0,0,0,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_shape,&__pyx_mstate_global->__pyx_n_u_itemsize,&__pyx_mstate_global->__pyx_n_u_format,&__pyx_mstate_global->__pyx_n_u_mode,&__pyx_mstate_global->__pyx_n_u_allocate_buffer,0}; + const Py_ssize_t __pyx_kwds_len = (__pyx_kwds) ? __Pyx_NumKwargs_VARARGS(__pyx_kwds) : 0; + if (unlikely(__pyx_kwds_len) < 0) __PYX_ERR(1, 129, __pyx_L3_error) + if (__pyx_kwds_len > 0) { + switch (__pyx_nargs) { + case 5: + values[4] = __Pyx_ArgRef_VARARGS(__pyx_args, 4); + if (!CYTHON_ASSUME_SAFE_MACROS && unlikely(!values[4])) __PYX_ERR(1, 129, __pyx_L3_error) + CYTHON_FALLTHROUGH; + case 4: + values[3] = __Pyx_ArgRef_VARARGS(__pyx_args, 3); + if (!CYTHON_ASSUME_SAFE_MACROS && unlikely(!values[3])) __PYX_ERR(1, 129, __pyx_L3_error) + CYTHON_FALLTHROUGH; + case 3: + values[2] = __Pyx_ArgRef_VARARGS(__pyx_args, 2); + if (!CYTHON_ASSUME_SAFE_MACROS && unlikely(!values[2])) __PYX_ERR(1, 129, __pyx_L3_error) + CYTHON_FALLTHROUGH; + case 2: + values[1] = __Pyx_ArgRef_VARARGS(__pyx_args, 1); + if (!CYTHON_ASSUME_SAFE_MACROS && unlikely(!values[1])) __PYX_ERR(1, 129, __pyx_L3_error) + CYTHON_FALLTHROUGH; + case 1: + values[0] = __Pyx_ArgRef_VARARGS(__pyx_args, 0); + if (!CYTHON_ASSUME_SAFE_MACROS && unlikely(!values[0])) __PYX_ERR(1, 129, __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(1, 129, __pyx_L3_error) + if (!values[3]) values[3] = __Pyx_NewRef(((PyObject *)__pyx_mstate_global->__pyx_n_u_c)); + for (Py_ssize_t i = __pyx_nargs; i < 3; i++) { + if (unlikely(!values[i])) { __Pyx_RaiseArgtupleInvalid("__cinit__", 0, 3, 5, i); __PYX_ERR(1, 129, __pyx_L3_error) } + } + } else { + switch (__pyx_nargs) { + case 5: + values[4] = __Pyx_ArgRef_VARARGS(__pyx_args, 4); + if (!CYTHON_ASSUME_SAFE_MACROS && unlikely(!values[4])) __PYX_ERR(1, 129, __pyx_L3_error) + CYTHON_FALLTHROUGH; + case 4: + values[3] = __Pyx_ArgRef_VARARGS(__pyx_args, 3); + if (!CYTHON_ASSUME_SAFE_MACROS && unlikely(!values[3])) __PYX_ERR(1, 129, __pyx_L3_error) + CYTHON_FALLTHROUGH; + case 3: + values[2] = __Pyx_ArgRef_VARARGS(__pyx_args, 2); + if (!CYTHON_ASSUME_SAFE_MACROS && unlikely(!values[2])) __PYX_ERR(1, 129, __pyx_L3_error) + values[1] = __Pyx_ArgRef_VARARGS(__pyx_args, 1); + if (!CYTHON_ASSUME_SAFE_MACROS && unlikely(!values[1])) __PYX_ERR(1, 129, __pyx_L3_error) + values[0] = __Pyx_ArgRef_VARARGS(__pyx_args, 0); + if (!CYTHON_ASSUME_SAFE_MACROS && unlikely(!values[0])) __PYX_ERR(1, 129, __pyx_L3_error) + break; + default: goto __pyx_L5_argtuple_error; + } + if (!values[3]) values[3] = __Pyx_NewRef(((PyObject *)__pyx_mstate_global->__pyx_n_u_c)); + } + __pyx_v_shape = ((PyObject*)values[0]); + __pyx_v_itemsize = __Pyx_PyIndex_AsSsize_t(values[1]); if (unlikely((__pyx_v_itemsize == (Py_ssize_t)-1) && PyErr_Occurred())) __PYX_ERR(1, 129, __pyx_L3_error) + __pyx_v_format = values[2]; + __pyx_v_mode = values[3]; + if (values[4]) { + __pyx_v_allocate_buffer = __Pyx_PyObject_IsTrue(values[4]); if (unlikely((__pyx_v_allocate_buffer == (int)-1) && PyErr_Occurred())) __PYX_ERR(1, 130, __pyx_L3_error) + } else { + + /* "View.MemoryView":130 + * + * def __cinit__(array self, tuple shape, Py_ssize_t itemsize, format not None, + * mode="c", bint allocate_buffer=True): # <<<<<<<<<<<<<< + * + * cdef int idx +*/ + __pyx_v_allocate_buffer = ((int)1); + } + } + goto __pyx_L6_skip; + __pyx_L5_argtuple_error:; + __Pyx_RaiseArgtupleInvalid("__cinit__", 0, 3, 5, __pyx_nargs); __PYX_ERR(1, 129, __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("View.MemoryView.array.__cinit__", __pyx_clineno, __pyx_lineno, __pyx_filename); + __Pyx_RefNannyFinishContext(); + return -1; + __pyx_L4_argument_unpacking_done:; + if (unlikely(!__Pyx_ArgTypeTest(((PyObject *)__pyx_v_shape), (&PyTuple_Type), 1, "shape", 1))) __PYX_ERR(1, 129, __pyx_L1_error) + if (unlikely(((PyObject *)__pyx_v_format) == Py_None)) { + PyErr_Format(PyExc_TypeError, "Argument '%.200s' must not be None", "format"); __PYX_ERR(1, 129, __pyx_L1_error) + } + __pyx_r = __pyx_array___pyx_pf_15View_dot_MemoryView_5array___cinit__(((struct __pyx_array_obj *)__pyx_v_self), __pyx_v_shape, __pyx_v_itemsize, __pyx_v_format, __pyx_v_mode, __pyx_v_allocate_buffer); + + /* "View.MemoryView":129 + * cdef bint dtype_is_object + * + * def __cinit__(array self, tuple shape, Py_ssize_t itemsize, format not None, # <<<<<<<<<<<<<< + * mode="c", bint allocate_buffer=True): + * +*/ + + /* 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_array___pyx_pf_15View_dot_MemoryView_5array___cinit__(struct __pyx_array_obj *__pyx_v_self, PyObject *__pyx_v_shape, Py_ssize_t __pyx_v_itemsize, PyObject *__pyx_v_format, PyObject *__pyx_v_mode, int __pyx_v_allocate_buffer) { + int __pyx_v_idx; + Py_ssize_t __pyx_v_dim; + char __pyx_v_order; + int __pyx_r; + __Pyx_RefNannyDeclarations + Py_ssize_t __pyx_t_1; + int __pyx_t_2; + int __pyx_t_3; + PyObject *__pyx_t_4 = NULL; + PyObject *__pyx_t_5 = NULL; + size_t __pyx_t_6; + char *__pyx_t_7; + int __pyx_t_8; + Py_ssize_t __pyx_t_9; + PyObject *__pyx_t_10 = NULL; + PyObject *__pyx_t_11[5]; + PyObject *__pyx_t_12 = NULL; + int __pyx_lineno = 0; + const char *__pyx_filename = NULL; + int __pyx_clineno = 0; + __Pyx_RefNannySetupContext("__cinit__", 0); + __Pyx_INCREF(__pyx_v_format); + + /* "View.MemoryView":135 + * cdef Py_ssize_t dim + * + * self.ndim = len(shape) # <<<<<<<<<<<<<< + * self.itemsize = itemsize + * +*/ + if (unlikely(__pyx_v_shape == Py_None)) { + PyErr_SetString(PyExc_TypeError, "object of type 'NoneType' has no len()"); + __PYX_ERR(1, 135, __pyx_L1_error) + } + __pyx_t_1 = __Pyx_PyTuple_GET_SIZE(__pyx_v_shape); if (unlikely(__pyx_t_1 == ((Py_ssize_t)-1))) __PYX_ERR(1, 135, __pyx_L1_error) + __pyx_v_self->ndim = ((int)__pyx_t_1); + + /* "View.MemoryView":136 + * + * self.ndim = len(shape) + * self.itemsize = itemsize # <<<<<<<<<<<<<< + * + * if not self.ndim: +*/ + __pyx_v_self->itemsize = __pyx_v_itemsize; + + /* "View.MemoryView":138 + * self.itemsize = itemsize + * + * if not self.ndim: # <<<<<<<<<<<<<< + * raise ValueError, "Empty shape tuple for cython.array" + * +*/ + __pyx_t_2 = (!(__pyx_v_self->ndim != 0)); + if (unlikely(__pyx_t_2)) { + + /* "View.MemoryView":139 + * + * if not self.ndim: + * raise ValueError, "Empty shape tuple for cython.array" # <<<<<<<<<<<<<< + * + * if itemsize <= 0: +*/ + __Pyx_Raise(((PyObject *)(((PyTypeObject*)PyExc_ValueError))), __pyx_mstate_global->__pyx_kp_u_Empty_shape_tuple_for_cython_arr, 0, 0); + __PYX_ERR(1, 139, __pyx_L1_error) + + /* "View.MemoryView":138 + * self.itemsize = itemsize + * + * if not self.ndim: # <<<<<<<<<<<<<< + * raise ValueError, "Empty shape tuple for cython.array" + * +*/ + } + + /* "View.MemoryView":141 + * raise ValueError, "Empty shape tuple for cython.array" + * + * if itemsize <= 0: # <<<<<<<<<<<<<< + * raise ValueError, "itemsize <= 0 for cython.array" + * +*/ + __pyx_t_2 = (__pyx_v_itemsize <= 0); + if (unlikely(__pyx_t_2)) { + + /* "View.MemoryView":142 + * + * if itemsize <= 0: + * raise ValueError, "itemsize <= 0 for cython.array" # <<<<<<<<<<<<<< + * + * if not isinstance(format, bytes): +*/ + __Pyx_Raise(((PyObject *)(((PyTypeObject*)PyExc_ValueError))), __pyx_mstate_global->__pyx_kp_u_itemsize_0_for_cython_array, 0, 0); + __PYX_ERR(1, 142, __pyx_L1_error) + + /* "View.MemoryView":141 + * raise ValueError, "Empty shape tuple for cython.array" + * + * if itemsize <= 0: # <<<<<<<<<<<<<< + * raise ValueError, "itemsize <= 0 for cython.array" + * +*/ + } + + /* "View.MemoryView":144 + * raise ValueError, "itemsize <= 0 for cython.array" + * + * if not isinstance(format, bytes): # <<<<<<<<<<<<<< + * format = format.encode('ASCII') + * self._format = format # keep a reference to the byte string +*/ + __pyx_t_2 = PyBytes_Check(__pyx_v_format); + __pyx_t_3 = (!__pyx_t_2); + if (__pyx_t_3) { + + /* "View.MemoryView":145 + * + * if not isinstance(format, bytes): + * format = format.encode('ASCII') # <<<<<<<<<<<<<< + * self._format = format # keep a reference to the byte string + * self.format = self._format +*/ + __pyx_t_5 = __pyx_v_format; + __Pyx_INCREF(__pyx_t_5); + __pyx_t_6 = 0; + { + PyObject *__pyx_callargs[2] = {__pyx_t_5, __pyx_mstate_global->__pyx_n_u_ASCII}; + __pyx_t_4 = __Pyx_PyObject_FastCallMethod((PyObject*)__pyx_mstate_global->__pyx_n_u_encode, __pyx_callargs+__pyx_t_6, (2-__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(1, 145, __pyx_L1_error) + __Pyx_GOTREF(__pyx_t_4); + } + __Pyx_DECREF_SET(__pyx_v_format, __pyx_t_4); + __pyx_t_4 = 0; + + /* "View.MemoryView":144 + * raise ValueError, "itemsize <= 0 for cython.array" + * + * if not isinstance(format, bytes): # <<<<<<<<<<<<<< + * format = format.encode('ASCII') + * self._format = format # keep a reference to the byte string +*/ + } + + /* "View.MemoryView":146 + * if not isinstance(format, bytes): + * format = format.encode('ASCII') + * self._format = format # keep a reference to the byte string # <<<<<<<<<<<<<< + * self.format = self._format + * +*/ + __pyx_t_4 = __pyx_v_format; + __Pyx_INCREF(__pyx_t_4); + if (!(likely(PyBytes_CheckExact(__pyx_t_4))||((__pyx_t_4) == Py_None) || __Pyx_RaiseUnexpectedTypeError("bytes", __pyx_t_4))) __PYX_ERR(1, 146, __pyx_L1_error) + __Pyx_GIVEREF(__pyx_t_4); + __Pyx_GOTREF(__pyx_v_self->_format); + __Pyx_DECREF(__pyx_v_self->_format); + __pyx_v_self->_format = ((PyObject*)__pyx_t_4); + __pyx_t_4 = 0; + + /* "View.MemoryView":147 + * format = format.encode('ASCII') + * self._format = format # keep a reference to the byte string + * self.format = self._format # <<<<<<<<<<<<<< + * + * +*/ + if (unlikely(__pyx_v_self->_format == Py_None)) { + PyErr_SetString(PyExc_TypeError, "expected bytes, NoneType found"); + __PYX_ERR(1, 147, __pyx_L1_error) + } + __pyx_t_7 = __Pyx_PyBytes_AsWritableString(__pyx_v_self->_format); if (unlikely((!__pyx_t_7) && PyErr_Occurred())) __PYX_ERR(1, 147, __pyx_L1_error) + __pyx_v_self->format = __pyx_t_7; + + /* "View.MemoryView":150 + * + * + * self._shape = PyObject_Malloc(sizeof(Py_ssize_t)*self.ndim*2) # <<<<<<<<<<<<<< + * self._strides = self._shape + self.ndim + * +*/ + __pyx_v_self->_shape = ((Py_ssize_t *)PyObject_Malloc((((sizeof(Py_ssize_t)) * __pyx_v_self->ndim) * 2))); + + /* "View.MemoryView":151 + * + * self._shape = PyObject_Malloc(sizeof(Py_ssize_t)*self.ndim*2) + * self._strides = self._shape + self.ndim # <<<<<<<<<<<<<< + * + * if not self._shape: +*/ + __pyx_v_self->_strides = (__pyx_v_self->_shape + __pyx_v_self->ndim); + + /* "View.MemoryView":153 + * self._strides = self._shape + self.ndim + * + * if not self._shape: # <<<<<<<<<<<<<< + * raise MemoryError, "unable to allocate shape and strides." + * +*/ + __pyx_t_3 = (!(__pyx_v_self->_shape != 0)); + if (unlikely(__pyx_t_3)) { + + /* "View.MemoryView":154 + * + * if not self._shape: + * raise MemoryError, "unable to allocate shape and strides." # <<<<<<<<<<<<<< + * + * +*/ + __Pyx_Raise(((PyObject *)(((PyTypeObject*)PyExc_MemoryError))), __pyx_mstate_global->__pyx_kp_u_unable_to_allocate_shape_and_str, 0, 0); + __PYX_ERR(1, 154, __pyx_L1_error) + + /* "View.MemoryView":153 + * self._strides = self._shape + self.ndim + * + * if not self._shape: # <<<<<<<<<<<<<< + * raise MemoryError, "unable to allocate shape and strides." + * +*/ + } + + /* "View.MemoryView":157 + * + * + * for idx, dim in enumerate(shape): # <<<<<<<<<<<<<< + * if dim <= 0: + * raise ValueError, f"Invalid shape in axis {idx}: {dim}." +*/ + __pyx_t_8 = 0; + __pyx_t_4 = __pyx_v_shape; __Pyx_INCREF(__pyx_t_4); + __pyx_t_1 = 0; + for (;;) { + { + Py_ssize_t __pyx_temp = __Pyx_PyTuple_GET_SIZE(__pyx_t_4); + #if !CYTHON_ASSUME_SAFE_SIZE + if (unlikely((__pyx_temp < 0))) __PYX_ERR(1, 157, __pyx_L1_error) + #endif + if (__pyx_t_1 >= __pyx_temp) break; + } + #if CYTHON_ASSUME_SAFE_MACROS && !CYTHON_AVOID_BORROWED_REFS + __pyx_t_5 = __Pyx_NewRef(PyTuple_GET_ITEM(__pyx_t_4, __pyx_t_1)); + #else + __pyx_t_5 = __Pyx_PySequence_ITEM(__pyx_t_4, __pyx_t_1); + #endif + ++__pyx_t_1; + if (unlikely(!__pyx_t_5)) __PYX_ERR(1, 157, __pyx_L1_error) + __Pyx_GOTREF(__pyx_t_5); + __pyx_t_9 = __Pyx_PyIndex_AsSsize_t(__pyx_t_5); if (unlikely((__pyx_t_9 == (Py_ssize_t)-1) && PyErr_Occurred())) __PYX_ERR(1, 157, __pyx_L1_error) + __Pyx_DECREF(__pyx_t_5); __pyx_t_5 = 0; + __pyx_v_dim = __pyx_t_9; + __pyx_v_idx = __pyx_t_8; + __pyx_t_8 = (__pyx_t_8 + 1); + + /* "View.MemoryView":158 + * + * for idx, dim in enumerate(shape): + * if dim <= 0: # <<<<<<<<<<<<<< + * raise ValueError, f"Invalid shape in axis {idx}: {dim}." + * self._shape[idx] = dim +*/ + __pyx_t_3 = (__pyx_v_dim <= 0); + if (unlikely(__pyx_t_3)) { + + /* "View.MemoryView":159 + * for idx, dim in enumerate(shape): + * if dim <= 0: + * raise ValueError, f"Invalid shape in axis {idx}: {dim}." # <<<<<<<<<<<<<< + * self._shape[idx] = dim + * +*/ + __pyx_t_5 = __Pyx_PyUnicode_From_int(__pyx_v_idx, 0, ' ', 'd'); if (unlikely(!__pyx_t_5)) __PYX_ERR(1, 159, __pyx_L1_error) + __Pyx_GOTREF(__pyx_t_5); + __pyx_t_10 = __Pyx_PyUnicode_From_Py_ssize_t(__pyx_v_dim, 0, ' ', 'd'); if (unlikely(!__pyx_t_10)) __PYX_ERR(1, 159, __pyx_L1_error) + __Pyx_GOTREF(__pyx_t_10); + __pyx_t_11[0] = __pyx_mstate_global->__pyx_kp_u_Invalid_shape_in_axis; + __pyx_t_11[1] = __pyx_t_5; + __pyx_t_11[2] = __pyx_mstate_global->__pyx_kp_u_; + __pyx_t_11[3] = __pyx_t_10; + __pyx_t_11[4] = __pyx_mstate_global->__pyx_kp_u__2; + __pyx_t_12 = __Pyx_PyUnicode_Join(__pyx_t_11, 5, 22 + __Pyx_PyUnicode_GET_LENGTH(__pyx_t_5) + 2 + __Pyx_PyUnicode_GET_LENGTH(__pyx_t_10) + 1, 127); + if (unlikely(!__pyx_t_12)) __PYX_ERR(1, 159, __pyx_L1_error) + __Pyx_GOTREF(__pyx_t_12); + __Pyx_DECREF(__pyx_t_5); __pyx_t_5 = 0; + __Pyx_DECREF(__pyx_t_10); __pyx_t_10 = 0; + __Pyx_Raise(((PyObject *)(((PyTypeObject*)PyExc_ValueError))), __pyx_t_12, 0, 0); + __Pyx_DECREF(__pyx_t_12); __pyx_t_12 = 0; + __PYX_ERR(1, 159, __pyx_L1_error) + + /* "View.MemoryView":158 + * + * for idx, dim in enumerate(shape): + * if dim <= 0: # <<<<<<<<<<<<<< + * raise ValueError, f"Invalid shape in axis {idx}: {dim}." + * self._shape[idx] = dim +*/ + } + + /* "View.MemoryView":160 + * if dim <= 0: + * raise ValueError, f"Invalid shape in axis {idx}: {dim}." + * self._shape[idx] = dim # <<<<<<<<<<<<<< + * + * cdef char order +*/ + (__pyx_v_self->_shape[__pyx_v_idx]) = __pyx_v_dim; + + /* "View.MemoryView":157 + * + * + * for idx, dim in enumerate(shape): # <<<<<<<<<<<<<< + * if dim <= 0: + * raise ValueError, f"Invalid shape in axis {idx}: {dim}." +*/ + } + __Pyx_DECREF(__pyx_t_4); __pyx_t_4 = 0; + + /* "View.MemoryView":163 + * + * cdef char order + * if mode == 'c': # <<<<<<<<<<<<<< + * order = b'C' + * self.mode = u'c' +*/ + __pyx_t_3 = (__Pyx_PyUnicode_Equals(__pyx_v_mode, __pyx_mstate_global->__pyx_n_u_c, Py_EQ)); if (unlikely((__pyx_t_3 < 0))) __PYX_ERR(1, 163, __pyx_L1_error) + if (__pyx_t_3) { + + /* "View.MemoryView":164 + * cdef char order + * if mode == 'c': + * order = b'C' # <<<<<<<<<<<<<< + * self.mode = u'c' + * elif mode == 'fortran': +*/ + __pyx_v_order = 'C'; + + /* "View.MemoryView":165 + * if mode == 'c': + * order = b'C' + * self.mode = u'c' # <<<<<<<<<<<<<< + * elif mode == 'fortran': + * order = b'F' +*/ + __Pyx_INCREF(__pyx_mstate_global->__pyx_n_u_c); + __Pyx_GIVEREF(__pyx_mstate_global->__pyx_n_u_c); + __Pyx_GOTREF(__pyx_v_self->mode); + __Pyx_DECREF(__pyx_v_self->mode); + __pyx_v_self->mode = __pyx_mstate_global->__pyx_n_u_c; + + /* "View.MemoryView":163 + * + * cdef char order + * if mode == 'c': # <<<<<<<<<<<<<< + * order = b'C' + * self.mode = u'c' +*/ + goto __pyx_L11; + } + + /* "View.MemoryView":166 + * order = b'C' + * self.mode = u'c' + * elif mode == 'fortran': # <<<<<<<<<<<<<< + * order = b'F' + * self.mode = u'fortran' +*/ + __pyx_t_3 = (__Pyx_PyUnicode_Equals(__pyx_v_mode, __pyx_mstate_global->__pyx_n_u_fortran, Py_EQ)); if (unlikely((__pyx_t_3 < 0))) __PYX_ERR(1, 166, __pyx_L1_error) + if (likely(__pyx_t_3)) { + + /* "View.MemoryView":167 + * self.mode = u'c' + * elif mode == 'fortran': + * order = b'F' # <<<<<<<<<<<<<< + * self.mode = u'fortran' + * else: +*/ + __pyx_v_order = 'F'; + + /* "View.MemoryView":168 + * elif mode == 'fortran': + * order = b'F' + * self.mode = u'fortran' # <<<<<<<<<<<<<< + * else: + * raise ValueError, f"Invalid mode, expected 'c' or 'fortran', got {mode}" +*/ + __Pyx_INCREF(__pyx_mstate_global->__pyx_n_u_fortran); + __Pyx_GIVEREF(__pyx_mstate_global->__pyx_n_u_fortran); + __Pyx_GOTREF(__pyx_v_self->mode); + __Pyx_DECREF(__pyx_v_self->mode); + __pyx_v_self->mode = __pyx_mstate_global->__pyx_n_u_fortran; + + /* "View.MemoryView":166 + * order = b'C' + * self.mode = u'c' + * elif mode == 'fortran': # <<<<<<<<<<<<<< + * order = b'F' + * self.mode = u'fortran' +*/ + goto __pyx_L11; + } + + /* "View.MemoryView":170 + * self.mode = u'fortran' + * else: + * raise ValueError, f"Invalid mode, expected 'c' or 'fortran', got {mode}" # <<<<<<<<<<<<<< + * + * self.len = fill_contig_strides_array(self._shape, self._strides, itemsize, self.ndim, order) +*/ + /*else*/ { + __pyx_t_4 = __Pyx_PyObject_FormatSimple(__pyx_v_mode, __pyx_mstate_global->__pyx_empty_unicode); if (unlikely(!__pyx_t_4)) __PYX_ERR(1, 170, __pyx_L1_error) + __Pyx_GOTREF(__pyx_t_4); + __pyx_t_12 = __Pyx_PyUnicode_Concat(__pyx_mstate_global->__pyx_kp_u_Invalid_mode_expected_c_or_fortr, __pyx_t_4); if (unlikely(!__pyx_t_12)) __PYX_ERR(1, 170, __pyx_L1_error) + __Pyx_GOTREF(__pyx_t_12); + __Pyx_DECREF(__pyx_t_4); __pyx_t_4 = 0; + __Pyx_Raise(((PyObject *)(((PyTypeObject*)PyExc_ValueError))), __pyx_t_12, 0, 0); + __Pyx_DECREF(__pyx_t_12); __pyx_t_12 = 0; + __PYX_ERR(1, 170, __pyx_L1_error) + } + __pyx_L11:; + + /* "View.MemoryView":172 + * raise ValueError, f"Invalid mode, expected 'c' or 'fortran', got {mode}" + * + * self.len = fill_contig_strides_array(self._shape, self._strides, itemsize, self.ndim, order) # <<<<<<<<<<<<<< + * + * self.free_data = allocate_buffer +*/ + __pyx_v_self->len = __pyx_fill_contig_strides_array(__pyx_v_self->_shape, __pyx_v_self->_strides, __pyx_v_itemsize, __pyx_v_self->ndim, __pyx_v_order); + + /* "View.MemoryView":174 + * self.len = fill_contig_strides_array(self._shape, self._strides, itemsize, self.ndim, order) + * + * self.free_data = allocate_buffer # <<<<<<<<<<<<<< + * self.dtype_is_object = format == b'O' + * +*/ + __pyx_v_self->free_data = __pyx_v_allocate_buffer; + + /* "View.MemoryView":175 + * + * self.free_data = allocate_buffer + * self.dtype_is_object = format == b'O' # <<<<<<<<<<<<<< + * + * if allocate_buffer: +*/ + __pyx_t_12 = PyObject_RichCompare(__pyx_v_format, __pyx_mstate_global->__pyx_n_b_O, Py_EQ); __Pyx_XGOTREF(__pyx_t_12); if (unlikely(!__pyx_t_12)) __PYX_ERR(1, 175, __pyx_L1_error) + __pyx_t_3 = __Pyx_PyObject_IsTrue(__pyx_t_12); if (unlikely((__pyx_t_3 == (int)-1) && PyErr_Occurred())) __PYX_ERR(1, 175, __pyx_L1_error) + __Pyx_DECREF(__pyx_t_12); __pyx_t_12 = 0; + __pyx_v_self->dtype_is_object = __pyx_t_3; + + /* "View.MemoryView":177 + * self.dtype_is_object = format == b'O' + * + * if allocate_buffer: # <<<<<<<<<<<<<< + * _allocate_buffer(self) + * +*/ + if (__pyx_v_allocate_buffer) { + + /* "View.MemoryView":178 + * + * if allocate_buffer: + * _allocate_buffer(self) # <<<<<<<<<<<<<< + * + * @cname('getbuffer') +*/ + __pyx_t_8 = __pyx_array_allocate_buffer(__pyx_v_self); if (unlikely(__pyx_t_8 == ((int)-1))) __PYX_ERR(1, 178, __pyx_L1_error) + + /* "View.MemoryView":177 + * self.dtype_is_object = format == b'O' + * + * if allocate_buffer: # <<<<<<<<<<<<<< + * _allocate_buffer(self) + * +*/ + } + + /* "View.MemoryView":129 + * cdef bint dtype_is_object + * + * def __cinit__(array self, tuple shape, Py_ssize_t itemsize, format not None, # <<<<<<<<<<<<<< + * mode="c", bint allocate_buffer=True): + * +*/ + + /* 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_10); + __Pyx_XDECREF(__pyx_t_12); + __Pyx_AddTraceback("View.MemoryView.array.__cinit__", __pyx_clineno, __pyx_lineno, __pyx_filename); + __pyx_r = -1; + __pyx_L0:; + __Pyx_XDECREF(__pyx_v_format); + __Pyx_RefNannyFinishContext(); + return __pyx_r; +} + +/* "View.MemoryView":180 + * _allocate_buffer(self) + * + * @cname('getbuffer') # <<<<<<<<<<<<<< + * def __getbuffer__(self, Py_buffer *info, int flags): + * cdef int bufmode = -1 +*/ + +/* Python wrapper */ +CYTHON_UNUSED static int __pyx_array_getbuffer(PyObject *__pyx_v_self, Py_buffer *__pyx_v_info, int __pyx_v_flags); /*proto*/ +CYTHON_UNUSED static int __pyx_array_getbuffer(PyObject *__pyx_v_self, Py_buffer *__pyx_v_info, int __pyx_v_flags) { + CYTHON_UNUSED PyObject *const *__pyx_kwvalues; + int __pyx_r; + __Pyx_RefNannyDeclarations + __Pyx_RefNannySetupContext("__getbuffer__ (wrapper)", 0); + __pyx_kwvalues = __Pyx_KwValues_VARARGS(__pyx_args, __pyx_nargs); + __pyx_r = __pyx_array___pyx_pf_15View_dot_MemoryView_5array_2__getbuffer__(((struct __pyx_array_obj *)__pyx_v_self), ((Py_buffer *)__pyx_v_info), ((int)__pyx_v_flags)); + + /* function exit code */ + __Pyx_RefNannyFinishContext(); + return __pyx_r; +} + +static int __pyx_array___pyx_pf_15View_dot_MemoryView_5array_2__getbuffer__(struct __pyx_array_obj *__pyx_v_self, Py_buffer *__pyx_v_info, int __pyx_v_flags) { + int __pyx_v_bufmode; + int __pyx_r; + __Pyx_RefNannyDeclarations + int __pyx_t_1; + char *__pyx_t_2; + Py_ssize_t __pyx_t_3; + int __pyx_t_4; + Py_ssize_t *__pyx_t_5; + int __pyx_lineno = 0; + const char *__pyx_filename = NULL; + int __pyx_clineno = 0; + if (unlikely(__pyx_v_info == NULL)) { + PyErr_SetString(PyExc_BufferError, "PyObject_GetBuffer: view==NULL argument is obsolete"); + return -1; + } + __Pyx_RefNannySetupContext("__getbuffer__", 0); + __pyx_v_info->obj = Py_None; __Pyx_INCREF(Py_None); + __Pyx_GIVEREF(__pyx_v_info->obj); + + /* "View.MemoryView":182 + * @cname('getbuffer') + * def __getbuffer__(self, Py_buffer *info, int flags): + * cdef int bufmode = -1 # <<<<<<<<<<<<<< + * if flags & (PyBUF_C_CONTIGUOUS | PyBUF_F_CONTIGUOUS | PyBUF_ANY_CONTIGUOUS): + * if self.mode == u"c": +*/ + __pyx_v_bufmode = -1; + + /* "View.MemoryView":183 + * def __getbuffer__(self, Py_buffer *info, int flags): + * cdef int bufmode = -1 + * if flags & (PyBUF_C_CONTIGUOUS | PyBUF_F_CONTIGUOUS | PyBUF_ANY_CONTIGUOUS): # <<<<<<<<<<<<<< + * if self.mode == u"c": + * bufmode = PyBUF_C_CONTIGUOUS | PyBUF_ANY_CONTIGUOUS +*/ + __pyx_t_1 = ((__pyx_v_flags & ((PyBUF_C_CONTIGUOUS | PyBUF_F_CONTIGUOUS) | PyBUF_ANY_CONTIGUOUS)) != 0); + if (__pyx_t_1) { + + /* "View.MemoryView":184 + * cdef int bufmode = -1 + * if flags & (PyBUF_C_CONTIGUOUS | PyBUF_F_CONTIGUOUS | PyBUF_ANY_CONTIGUOUS): + * if self.mode == u"c": # <<<<<<<<<<<<<< + * bufmode = PyBUF_C_CONTIGUOUS | PyBUF_ANY_CONTIGUOUS + * elif self.mode == u"fortran": +*/ + __pyx_t_1 = (__Pyx_PyUnicode_Equals(__pyx_v_self->mode, __pyx_mstate_global->__pyx_n_u_c, Py_EQ)); if (unlikely((__pyx_t_1 < 0))) __PYX_ERR(1, 184, __pyx_L1_error) + if (__pyx_t_1) { + + /* "View.MemoryView":185 + * if flags & (PyBUF_C_CONTIGUOUS | PyBUF_F_CONTIGUOUS | PyBUF_ANY_CONTIGUOUS): + * if self.mode == u"c": + * bufmode = PyBUF_C_CONTIGUOUS | PyBUF_ANY_CONTIGUOUS # <<<<<<<<<<<<<< + * elif self.mode == u"fortran": + * bufmode = PyBUF_F_CONTIGUOUS | PyBUF_ANY_CONTIGUOUS +*/ + __pyx_v_bufmode = (PyBUF_C_CONTIGUOUS | PyBUF_ANY_CONTIGUOUS); + + /* "View.MemoryView":184 + * cdef int bufmode = -1 + * if flags & (PyBUF_C_CONTIGUOUS | PyBUF_F_CONTIGUOUS | PyBUF_ANY_CONTIGUOUS): + * if self.mode == u"c": # <<<<<<<<<<<<<< + * bufmode = PyBUF_C_CONTIGUOUS | PyBUF_ANY_CONTIGUOUS + * elif self.mode == u"fortran": +*/ + goto __pyx_L4; + } + + /* "View.MemoryView":186 + * if self.mode == u"c": + * bufmode = PyBUF_C_CONTIGUOUS | PyBUF_ANY_CONTIGUOUS + * elif self.mode == u"fortran": # <<<<<<<<<<<<<< + * bufmode = PyBUF_F_CONTIGUOUS | PyBUF_ANY_CONTIGUOUS + * if not (flags & bufmode): +*/ + __pyx_t_1 = (__Pyx_PyUnicode_Equals(__pyx_v_self->mode, __pyx_mstate_global->__pyx_n_u_fortran, Py_EQ)); if (unlikely((__pyx_t_1 < 0))) __PYX_ERR(1, 186, __pyx_L1_error) + if (__pyx_t_1) { + + /* "View.MemoryView":187 + * bufmode = PyBUF_C_CONTIGUOUS | PyBUF_ANY_CONTIGUOUS + * elif self.mode == u"fortran": + * bufmode = PyBUF_F_CONTIGUOUS | PyBUF_ANY_CONTIGUOUS # <<<<<<<<<<<<<< + * if not (flags & bufmode): + * raise ValueError, "Can only create a buffer that is contiguous in memory." +*/ + __pyx_v_bufmode = (PyBUF_F_CONTIGUOUS | PyBUF_ANY_CONTIGUOUS); + + /* "View.MemoryView":186 + * if self.mode == u"c": + * bufmode = PyBUF_C_CONTIGUOUS | PyBUF_ANY_CONTIGUOUS + * elif self.mode == u"fortran": # <<<<<<<<<<<<<< + * bufmode = PyBUF_F_CONTIGUOUS | PyBUF_ANY_CONTIGUOUS + * if not (flags & bufmode): +*/ + } + __pyx_L4:; + + /* "View.MemoryView":188 + * elif self.mode == u"fortran": + * bufmode = PyBUF_F_CONTIGUOUS | PyBUF_ANY_CONTIGUOUS + * if not (flags & bufmode): # <<<<<<<<<<<<<< + * raise ValueError, "Can only create a buffer that is contiguous in memory." + * info.buf = self.data +*/ + __pyx_t_1 = (!((__pyx_v_flags & __pyx_v_bufmode) != 0)); + if (unlikely(__pyx_t_1)) { + + /* "View.MemoryView":189 + * bufmode = PyBUF_F_CONTIGUOUS | PyBUF_ANY_CONTIGUOUS + * if not (flags & bufmode): + * raise ValueError, "Can only create a buffer that is contiguous in memory." # <<<<<<<<<<<<<< + * info.buf = self.data + * info.len = self.len +*/ + __Pyx_Raise(((PyObject *)(((PyTypeObject*)PyExc_ValueError))), __pyx_mstate_global->__pyx_kp_u_Can_only_create_a_buffer_that_is, 0, 0); + __PYX_ERR(1, 189, __pyx_L1_error) + + /* "View.MemoryView":188 + * elif self.mode == u"fortran": + * bufmode = PyBUF_F_CONTIGUOUS | PyBUF_ANY_CONTIGUOUS + * if not (flags & bufmode): # <<<<<<<<<<<<<< + * raise ValueError, "Can only create a buffer that is contiguous in memory." + * info.buf = self.data +*/ + } + + /* "View.MemoryView":183 + * def __getbuffer__(self, Py_buffer *info, int flags): + * cdef int bufmode = -1 + * if flags & (PyBUF_C_CONTIGUOUS | PyBUF_F_CONTIGUOUS | PyBUF_ANY_CONTIGUOUS): # <<<<<<<<<<<<<< + * if self.mode == u"c": + * bufmode = PyBUF_C_CONTIGUOUS | PyBUF_ANY_CONTIGUOUS +*/ + } + + /* "View.MemoryView":190 + * if not (flags & bufmode): + * raise ValueError, "Can only create a buffer that is contiguous in memory." + * info.buf = self.data # <<<<<<<<<<<<<< + * info.len = self.len + * +*/ + __pyx_t_2 = __pyx_v_self->data; + __pyx_v_info->buf = __pyx_t_2; + + /* "View.MemoryView":191 + * raise ValueError, "Can only create a buffer that is contiguous in memory." + * info.buf = self.data + * info.len = self.len # <<<<<<<<<<<<<< + * + * if flags & PyBUF_STRIDES: +*/ + __pyx_t_3 = __pyx_v_self->len; + __pyx_v_info->len = __pyx_t_3; + + /* "View.MemoryView":193 + * info.len = self.len + * + * if flags & PyBUF_STRIDES: # <<<<<<<<<<<<<< + * info.ndim = self.ndim + * info.shape = self._shape +*/ + __pyx_t_1 = ((__pyx_v_flags & PyBUF_STRIDES) != 0); + if (__pyx_t_1) { + + /* "View.MemoryView":194 + * + * if flags & PyBUF_STRIDES: + * info.ndim = self.ndim # <<<<<<<<<<<<<< + * info.shape = self._shape + * info.strides = self._strides +*/ + __pyx_t_4 = __pyx_v_self->ndim; + __pyx_v_info->ndim = __pyx_t_4; + + /* "View.MemoryView":195 + * if flags & PyBUF_STRIDES: + * info.ndim = self.ndim + * info.shape = self._shape # <<<<<<<<<<<<<< + * info.strides = self._strides + * else: +*/ + __pyx_t_5 = __pyx_v_self->_shape; + __pyx_v_info->shape = __pyx_t_5; + + /* "View.MemoryView":196 + * info.ndim = self.ndim + * info.shape = self._shape + * info.strides = self._strides # <<<<<<<<<<<<<< + * else: + * info.ndim = 1 +*/ + __pyx_t_5 = __pyx_v_self->_strides; + __pyx_v_info->strides = __pyx_t_5; + + /* "View.MemoryView":193 + * info.len = self.len + * + * if flags & PyBUF_STRIDES: # <<<<<<<<<<<<<< + * info.ndim = self.ndim + * info.shape = self._shape +*/ + goto __pyx_L6; + } + + /* "View.MemoryView":198 + * info.strides = self._strides + * else: + * info.ndim = 1 # <<<<<<<<<<<<<< + * info.shape = &self.len if flags & PyBUF_ND else NULL + * info.strides = NULL +*/ + /*else*/ { + __pyx_v_info->ndim = 1; + + /* "View.MemoryView":199 + * else: + * info.ndim = 1 + * info.shape = &self.len if flags & PyBUF_ND else NULL # <<<<<<<<<<<<<< + * info.strides = NULL + * +*/ + __pyx_t_1 = ((__pyx_v_flags & PyBUF_ND) != 0); + if (__pyx_t_1) { + __pyx_t_5 = (&__pyx_v_self->len); + } else { + __pyx_t_5 = NULL; + } + __pyx_v_info->shape = __pyx_t_5; + + /* "View.MemoryView":200 + * info.ndim = 1 + * info.shape = &self.len if flags & PyBUF_ND else NULL + * info.strides = NULL # <<<<<<<<<<<<<< + * + * info.suboffsets = NULL +*/ + __pyx_v_info->strides = NULL; + } + __pyx_L6:; + + /* "View.MemoryView":202 + * info.strides = NULL + * + * info.suboffsets = NULL # <<<<<<<<<<<<<< + * info.itemsize = self.itemsize + * info.readonly = 0 +*/ + __pyx_v_info->suboffsets = NULL; + + /* "View.MemoryView":203 + * + * info.suboffsets = NULL + * info.itemsize = self.itemsize # <<<<<<<<<<<<<< + * info.readonly = 0 + * info.format = self.format if flags & PyBUF_FORMAT else NULL +*/ + __pyx_t_3 = __pyx_v_self->itemsize; + __pyx_v_info->itemsize = __pyx_t_3; + + /* "View.MemoryView":204 + * info.suboffsets = NULL + * info.itemsize = self.itemsize + * info.readonly = 0 # <<<<<<<<<<<<<< + * info.format = self.format if flags & PyBUF_FORMAT else NULL + * info.obj = self +*/ + __pyx_v_info->readonly = 0; + + /* "View.MemoryView":205 + * info.itemsize = self.itemsize + * info.readonly = 0 + * info.format = self.format if flags & PyBUF_FORMAT else NULL # <<<<<<<<<<<<<< + * info.obj = self + * +*/ + __pyx_t_1 = ((__pyx_v_flags & PyBUF_FORMAT) != 0); + if (__pyx_t_1) { + __pyx_t_2 = __pyx_v_self->format; + } else { + __pyx_t_2 = NULL; + } + __pyx_v_info->format = __pyx_t_2; + + /* "View.MemoryView":206 + * info.readonly = 0 + * info.format = self.format if flags & PyBUF_FORMAT else NULL + * info.obj = self # <<<<<<<<<<<<<< + * + * def __dealloc__(array self): +*/ + __Pyx_INCREF((PyObject *)__pyx_v_self); + __Pyx_GIVEREF((PyObject *)__pyx_v_self); + __Pyx_GOTREF(__pyx_v_info->obj); + __Pyx_DECREF(__pyx_v_info->obj); + __pyx_v_info->obj = ((PyObject *)__pyx_v_self); + + /* "View.MemoryView":180 + * _allocate_buffer(self) + * + * @cname('getbuffer') # <<<<<<<<<<<<<< + * def __getbuffer__(self, Py_buffer *info, int flags): + * cdef int bufmode = -1 +*/ + + /* function exit code */ + __pyx_r = 0; + goto __pyx_L0; + __pyx_L1_error:; + __Pyx_AddTraceback("View.MemoryView.array.__getbuffer__", __pyx_clineno, __pyx_lineno, __pyx_filename); + __pyx_r = -1; + if (__pyx_v_info->obj != NULL) { + __Pyx_GOTREF(__pyx_v_info->obj); + __Pyx_DECREF(__pyx_v_info->obj); __pyx_v_info->obj = 0; + } + goto __pyx_L2; + __pyx_L0:; + if (__pyx_v_info->obj == Py_None) { + __Pyx_GOTREF(__pyx_v_info->obj); + __Pyx_DECREF(__pyx_v_info->obj); __pyx_v_info->obj = 0; + } + __pyx_L2:; + __Pyx_RefNannyFinishContext(); + return __pyx_r; +} + +/* "View.MemoryView":208 + * info.obj = self + * + * def __dealloc__(array self): # <<<<<<<<<<<<<< + * if self.callback_free_data != NULL: + * self.callback_free_data(self.data) +*/ + +/* Python wrapper */ +static void __pyx_array___dealloc__(PyObject *__pyx_v_self); /*proto*/ +static void __pyx_array___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_array___pyx_pf_15View_dot_MemoryView_5array_4__dealloc__(((struct __pyx_array_obj *)__pyx_v_self)); + + /* function exit code */ + __Pyx_RefNannyFinishContext(); +} + +static void __pyx_array___pyx_pf_15View_dot_MemoryView_5array_4__dealloc__(struct __pyx_array_obj *__pyx_v_self) { + int __pyx_t_1; + int __pyx_t_2; + + /* "View.MemoryView":209 + * + * def __dealloc__(array self): + * if self.callback_free_data != NULL: # <<<<<<<<<<<<<< + * self.callback_free_data(self.data) + * elif self.free_data and self.data is not NULL: +*/ + __pyx_t_1 = (__pyx_v_self->callback_free_data != NULL); + if (__pyx_t_1) { + + /* "View.MemoryView":210 + * def __dealloc__(array self): + * if self.callback_free_data != NULL: + * self.callback_free_data(self.data) # <<<<<<<<<<<<<< + * elif self.free_data and self.data is not NULL: + * if self.dtype_is_object: +*/ + __pyx_v_self->callback_free_data(__pyx_v_self->data); + + /* "View.MemoryView":209 + * + * def __dealloc__(array self): + * if self.callback_free_data != NULL: # <<<<<<<<<<<<<< + * self.callback_free_data(self.data) + * elif self.free_data and self.data is not NULL: +*/ + goto __pyx_L3; + } + + /* "View.MemoryView":211 + * if self.callback_free_data != NULL: + * self.callback_free_data(self.data) + * elif self.free_data and self.data is not NULL: # <<<<<<<<<<<<<< + * if self.dtype_is_object: + * refcount_objects_in_slice(self.data, self._shape, self._strides, self.ndim, inc=False) +*/ + if (__pyx_v_self->free_data) { + } else { + __pyx_t_1 = __pyx_v_self->free_data; + goto __pyx_L4_bool_binop_done; + } + __pyx_t_2 = (__pyx_v_self->data != NULL); + __pyx_t_1 = __pyx_t_2; + __pyx_L4_bool_binop_done:; + if (__pyx_t_1) { + + /* "View.MemoryView":212 + * self.callback_free_data(self.data) + * elif self.free_data and self.data is not NULL: + * if self.dtype_is_object: # <<<<<<<<<<<<<< + * refcount_objects_in_slice(self.data, self._shape, self._strides, self.ndim, inc=False) + * free(self.data) +*/ + if (__pyx_v_self->dtype_is_object) { + + /* "View.MemoryView":213 + * elif self.free_data and self.data is not NULL: + * if self.dtype_is_object: + * refcount_objects_in_slice(self.data, self._shape, self._strides, self.ndim, inc=False) # <<<<<<<<<<<<<< + * free(self.data) + * PyObject_Free(self._shape) +*/ + __pyx_memoryview_refcount_objects_in_slice(__pyx_v_self->data, __pyx_v_self->_shape, __pyx_v_self->_strides, __pyx_v_self->ndim, 0); + + /* "View.MemoryView":212 + * self.callback_free_data(self.data) + * elif self.free_data and self.data is not NULL: + * if self.dtype_is_object: # <<<<<<<<<<<<<< + * refcount_objects_in_slice(self.data, self._shape, self._strides, self.ndim, inc=False) + * free(self.data) +*/ + } + + /* "View.MemoryView":214 + * if self.dtype_is_object: + * refcount_objects_in_slice(self.data, self._shape, self._strides, self.ndim, inc=False) + * free(self.data) # <<<<<<<<<<<<<< + * PyObject_Free(self._shape) + * +*/ + free(__pyx_v_self->data); + + /* "View.MemoryView":211 + * if self.callback_free_data != NULL: + * self.callback_free_data(self.data) + * elif self.free_data and self.data is not NULL: # <<<<<<<<<<<<<< + * if self.dtype_is_object: + * refcount_objects_in_slice(self.data, self._shape, self._strides, self.ndim, inc=False) +*/ + } + __pyx_L3:; + + /* "View.MemoryView":215 + * refcount_objects_in_slice(self.data, self._shape, self._strides, self.ndim, inc=False) + * free(self.data) + * PyObject_Free(self._shape) # <<<<<<<<<<<<<< + * + * @property +*/ + PyObject_Free(__pyx_v_self->_shape); + + /* "View.MemoryView":208 + * info.obj = self + * + * def __dealloc__(array self): # <<<<<<<<<<<<<< + * if self.callback_free_data != NULL: + * self.callback_free_data(self.data) +*/ + + /* function exit code */ +} + +/* "View.MemoryView":217 + * PyObject_Free(self._shape) + * + * @property # <<<<<<<<<<<<<< + * def memview(self): + * return self.get_memview() +*/ + +/* Python wrapper */ +static PyObject *__pyx_pw_15View_dot_MemoryView_5array_7memview_1__get__(PyObject *__pyx_v_self); /*proto*/ +static PyObject *__pyx_pw_15View_dot_MemoryView_5array_7memview_1__get__(PyObject *__pyx_v_self) { + CYTHON_UNUSED PyObject *const *__pyx_kwvalues; + PyObject *__pyx_r = 0; + __Pyx_RefNannyDeclarations + __Pyx_RefNannySetupContext("__get__ (wrapper)", 0); + __pyx_kwvalues = __Pyx_KwValues_VARARGS(__pyx_args, __pyx_nargs); + __pyx_r = __pyx_pf_15View_dot_MemoryView_5array_7memview___get__(((struct __pyx_array_obj *)__pyx_v_self)); + + /* function exit code */ + __Pyx_RefNannyFinishContext(); + return __pyx_r; +} + +static PyObject *__pyx_pf_15View_dot_MemoryView_5array_7memview___get__(struct __pyx_array_obj *__pyx_v_self) { + PyObject *__pyx_r = NULL; + __Pyx_RefNannyDeclarations + PyObject *__pyx_t_1 = NULL; + int __pyx_lineno = 0; + const char *__pyx_filename = NULL; + int __pyx_clineno = 0; + __Pyx_RefNannySetupContext("__get__", 0); + + /* "View.MemoryView":219 + * @property + * def memview(self): + * return self.get_memview() # <<<<<<<<<<<<<< + * + * @cname('get_memview') +*/ + __Pyx_XDECREF(__pyx_r); + __pyx_t_1 = ((struct __pyx_vtabstruct_array *)__pyx_v_self->__pyx_vtab)->get_memview(__pyx_v_self); if (unlikely(!__pyx_t_1)) __PYX_ERR(1, 219, __pyx_L1_error) + __Pyx_GOTREF(__pyx_t_1); + __pyx_r = __pyx_t_1; + __pyx_t_1 = 0; + goto __pyx_L0; + + /* "View.MemoryView":217 + * PyObject_Free(self._shape) + * + * @property # <<<<<<<<<<<<<< + * def memview(self): + * return self.get_memview() +*/ + + /* function exit code */ + __pyx_L1_error:; + __Pyx_XDECREF(__pyx_t_1); + __Pyx_AddTraceback("View.MemoryView.array.memview.__get__", __pyx_clineno, __pyx_lineno, __pyx_filename); + __pyx_r = NULL; + __pyx_L0:; + __Pyx_XGIVEREF(__pyx_r); + __Pyx_RefNannyFinishContext(); + return __pyx_r; +} + +/* "View.MemoryView":221 + * return self.get_memview() + * + * @cname('get_memview') # <<<<<<<<<<<<<< + * cdef get_memview(self): + * flags = PyBUF_ANY_CONTIGUOUS|PyBUF_FORMAT|PyBUF_WRITABLE +*/ + +static PyObject *__pyx_array_get_memview(struct __pyx_array_obj *__pyx_v_self) { + int __pyx_v_flags; + PyObject *__pyx_r = NULL; + __Pyx_RefNannyDeclarations + PyObject *__pyx_t_1 = NULL; + PyObject *__pyx_t_2 = NULL; + PyObject *__pyx_t_3 = NULL; + PyObject *__pyx_t_4 = NULL; + size_t __pyx_t_5; + int __pyx_lineno = 0; + const char *__pyx_filename = NULL; + int __pyx_clineno = 0; + __Pyx_RefNannySetupContext("get_memview", 0); + + /* "View.MemoryView":223 + * @cname('get_memview') + * cdef get_memview(self): + * flags = PyBUF_ANY_CONTIGUOUS|PyBUF_FORMAT|PyBUF_WRITABLE # <<<<<<<<<<<<<< + * return memoryview(self, flags, self.dtype_is_object) + * +*/ + __pyx_v_flags = ((PyBUF_ANY_CONTIGUOUS | PyBUF_FORMAT) | PyBUF_WRITABLE); + + /* "View.MemoryView":224 + * cdef get_memview(self): + * flags = PyBUF_ANY_CONTIGUOUS|PyBUF_FORMAT|PyBUF_WRITABLE + * return memoryview(self, flags, self.dtype_is_object) # <<<<<<<<<<<<<< + * + * def __len__(self): +*/ + __Pyx_XDECREF(__pyx_r); + __pyx_t_2 = NULL; + __pyx_t_3 = __Pyx_PyLong_From_int(__pyx_v_flags); if (unlikely(!__pyx_t_3)) __PYX_ERR(1, 224, __pyx_L1_error) + __Pyx_GOTREF(__pyx_t_3); + __pyx_t_4 = __Pyx_PyBool_FromLong(__pyx_v_self->dtype_is_object); if (unlikely(!__pyx_t_4)) __PYX_ERR(1, 224, __pyx_L1_error) + __Pyx_GOTREF(__pyx_t_4); + __pyx_t_5 = 1; + { + PyObject *__pyx_callargs[4] = {__pyx_t_2, ((PyObject *)__pyx_v_self), __pyx_t_3, __pyx_t_4}; + __pyx_t_1 = __Pyx_PyObject_FastCall((PyObject*)__pyx_mstate_global->__pyx_memoryview_type, __pyx_callargs+__pyx_t_5, (4-__pyx_t_5) | (__pyx_t_5*__Pyx_PY_VECTORCALL_ARGUMENTS_OFFSET)); + __Pyx_XDECREF(__pyx_t_2); __pyx_t_2 = 0; + __Pyx_DECREF(__pyx_t_3); __pyx_t_3 = 0; + __Pyx_DECREF(__pyx_t_4); __pyx_t_4 = 0; + if (unlikely(!__pyx_t_1)) __PYX_ERR(1, 224, __pyx_L1_error) + __Pyx_GOTREF((PyObject *)__pyx_t_1); + } + __pyx_r = ((PyObject *)__pyx_t_1); + __pyx_t_1 = 0; + goto __pyx_L0; + + /* "View.MemoryView":221 + * return self.get_memview() + * + * @cname('get_memview') # <<<<<<<<<<<<<< + * cdef get_memview(self): + * flags = PyBUF_ANY_CONTIGUOUS|PyBUF_FORMAT|PyBUF_WRITABLE +*/ + + /* function exit code */ + __pyx_L1_error:; + __Pyx_XDECREF(__pyx_t_1); + __Pyx_XDECREF(__pyx_t_2); + __Pyx_XDECREF(__pyx_t_3); + __Pyx_XDECREF(__pyx_t_4); + __Pyx_AddTraceback("View.MemoryView.array.get_memview", __pyx_clineno, __pyx_lineno, __pyx_filename); + __pyx_r = 0; + __pyx_L0:; + __Pyx_XGIVEREF(__pyx_r); + __Pyx_RefNannyFinishContext(); + return __pyx_r; +} + +/* "View.MemoryView":226 + * return memoryview(self, flags, self.dtype_is_object) + * + * def __len__(self): # <<<<<<<<<<<<<< + * return self._shape[0] + * +*/ + +/* Python wrapper */ +static Py_ssize_t __pyx_array___len__(PyObject *__pyx_v_self); /*proto*/ +static Py_ssize_t __pyx_array___len__(PyObject *__pyx_v_self) { + CYTHON_UNUSED PyObject *const *__pyx_kwvalues; + Py_ssize_t __pyx_r; + __Pyx_RefNannyDeclarations + __Pyx_RefNannySetupContext("__len__ (wrapper)", 0); + __pyx_kwvalues = __Pyx_KwValues_VARARGS(__pyx_args, __pyx_nargs); + __pyx_r = __pyx_array___pyx_pf_15View_dot_MemoryView_5array_6__len__(((struct __pyx_array_obj *)__pyx_v_self)); + + /* function exit code */ + __Pyx_RefNannyFinishContext(); + return __pyx_r; +} + +static Py_ssize_t __pyx_array___pyx_pf_15View_dot_MemoryView_5array_6__len__(struct __pyx_array_obj *__pyx_v_self) { + Py_ssize_t __pyx_r; + + /* "View.MemoryView":227 + * + * def __len__(self): + * return self._shape[0] # <<<<<<<<<<<<<< + * + * def __getattr__(self, attr): +*/ + __pyx_r = (__pyx_v_self->_shape[0]); + goto __pyx_L0; + + /* "View.MemoryView":226 + * return memoryview(self, flags, self.dtype_is_object) + * + * def __len__(self): # <<<<<<<<<<<<<< + * return self._shape[0] + * +*/ + + /* function exit code */ + __pyx_L0:; + return __pyx_r; +} + +/* "View.MemoryView":229 + * return self._shape[0] + * + * def __getattr__(self, attr): # <<<<<<<<<<<<<< + * return getattr(self.memview, attr) + * +*/ + +/* Python wrapper */ +static PyObject *__pyx_array___getattr__(PyObject *__pyx_v_self, PyObject *__pyx_v_attr); /*proto*/ +static PyObject *__pyx_array___getattr__(PyObject *__pyx_v_self, PyObject *__pyx_v_attr) { + CYTHON_UNUSED PyObject *const *__pyx_kwvalues; + PyObject *__pyx_r = 0; + __Pyx_RefNannyDeclarations + __Pyx_RefNannySetupContext("__getattr__ (wrapper)", 0); + __pyx_kwvalues = __Pyx_KwValues_VARARGS(__pyx_args, __pyx_nargs); + __pyx_r = __pyx_array___pyx_pf_15View_dot_MemoryView_5array_8__getattr__(((struct __pyx_array_obj *)__pyx_v_self), ((PyObject *)__pyx_v_attr)); + + /* function exit code */ + __Pyx_RefNannyFinishContext(); + return __pyx_r; +} + +static PyObject *__pyx_array___pyx_pf_15View_dot_MemoryView_5array_8__getattr__(struct __pyx_array_obj *__pyx_v_self, PyObject *__pyx_v_attr) { + PyObject *__pyx_r = NULL; + __Pyx_RefNannyDeclarations + PyObject *__pyx_t_1 = NULL; + PyObject *__pyx_t_2 = NULL; + int __pyx_lineno = 0; + const char *__pyx_filename = NULL; + int __pyx_clineno = 0; + __Pyx_RefNannySetupContext("__getattr__", 0); + + /* "View.MemoryView":230 + * + * def __getattr__(self, attr): + * return getattr(self.memview, attr) # <<<<<<<<<<<<<< + * + * def __getitem__(self, item): +*/ + __Pyx_XDECREF(__pyx_r); + __pyx_t_1 = __Pyx_PyObject_GetAttrStr(((PyObject *)__pyx_v_self), __pyx_mstate_global->__pyx_n_u_memview); if (unlikely(!__pyx_t_1)) __PYX_ERR(1, 230, __pyx_L1_error) + __Pyx_GOTREF(__pyx_t_1); + __pyx_t_2 = __Pyx_GetAttr(__pyx_t_1, __pyx_v_attr); if (unlikely(!__pyx_t_2)) __PYX_ERR(1, 230, __pyx_L1_error) + __Pyx_GOTREF(__pyx_t_2); + __Pyx_DECREF(__pyx_t_1); __pyx_t_1 = 0; + __pyx_r = __pyx_t_2; + __pyx_t_2 = 0; + goto __pyx_L0; + + /* "View.MemoryView":229 + * return self._shape[0] + * + * def __getattr__(self, attr): # <<<<<<<<<<<<<< + * return getattr(self.memview, attr) + * +*/ + + /* function exit code */ + __pyx_L1_error:; + __Pyx_XDECREF(__pyx_t_1); + __Pyx_XDECREF(__pyx_t_2); + __Pyx_AddTraceback("View.MemoryView.array.__getattr__", __pyx_clineno, __pyx_lineno, __pyx_filename); + __pyx_r = NULL; + __pyx_L0:; + __Pyx_XGIVEREF(__pyx_r); + __Pyx_RefNannyFinishContext(); + return __pyx_r; +} + +/* "View.MemoryView":232 + * return getattr(self.memview, attr) + * + * def __getitem__(self, item): # <<<<<<<<<<<<<< + * return self.memview[item] + * +*/ + +/* Python wrapper */ +static PyObject *__pyx_array___getitem__(PyObject *__pyx_v_self, PyObject *__pyx_v_item); /*proto*/ +static PyObject *__pyx_array___getitem__(PyObject *__pyx_v_self, PyObject *__pyx_v_item) { + CYTHON_UNUSED PyObject *const *__pyx_kwvalues; + PyObject *__pyx_r = 0; + __Pyx_RefNannyDeclarations + __Pyx_RefNannySetupContext("__getitem__ (wrapper)", 0); + __pyx_kwvalues = __Pyx_KwValues_VARARGS(__pyx_args, __pyx_nargs); + __pyx_r = __pyx_array___pyx_pf_15View_dot_MemoryView_5array_10__getitem__(((struct __pyx_array_obj *)__pyx_v_self), ((PyObject *)__pyx_v_item)); + + /* function exit code */ + __Pyx_RefNannyFinishContext(); + return __pyx_r; +} + +static PyObject *__pyx_array___pyx_pf_15View_dot_MemoryView_5array_10__getitem__(struct __pyx_array_obj *__pyx_v_self, PyObject *__pyx_v_item) { + PyObject *__pyx_r = NULL; + __Pyx_RefNannyDeclarations + PyObject *__pyx_t_1 = NULL; + PyObject *__pyx_t_2 = NULL; + int __pyx_lineno = 0; + const char *__pyx_filename = NULL; + int __pyx_clineno = 0; + __Pyx_RefNannySetupContext("__getitem__", 0); + + /* "View.MemoryView":233 + * + * def __getitem__(self, item): + * return self.memview[item] # <<<<<<<<<<<<<< + * + * def __setitem__(self, item, value): +*/ + __Pyx_XDECREF(__pyx_r); + __pyx_t_1 = __Pyx_PyObject_GetAttrStr(((PyObject *)__pyx_v_self), __pyx_mstate_global->__pyx_n_u_memview); if (unlikely(!__pyx_t_1)) __PYX_ERR(1, 233, __pyx_L1_error) + __Pyx_GOTREF(__pyx_t_1); + __pyx_t_2 = __Pyx_PyObject_GetItem(__pyx_t_1, __pyx_v_item); if (unlikely(!__pyx_t_2)) __PYX_ERR(1, 233, __pyx_L1_error) + __Pyx_GOTREF(__pyx_t_2); + __Pyx_DECREF(__pyx_t_1); __pyx_t_1 = 0; + __pyx_r = __pyx_t_2; + __pyx_t_2 = 0; + goto __pyx_L0; + + /* "View.MemoryView":232 + * return getattr(self.memview, attr) + * + * def __getitem__(self, item): # <<<<<<<<<<<<<< + * return self.memview[item] + * +*/ + + /* function exit code */ + __pyx_L1_error:; + __Pyx_XDECREF(__pyx_t_1); + __Pyx_XDECREF(__pyx_t_2); + __Pyx_AddTraceback("View.MemoryView.array.__getitem__", __pyx_clineno, __pyx_lineno, __pyx_filename); + __pyx_r = NULL; + __pyx_L0:; + __Pyx_XGIVEREF(__pyx_r); + __Pyx_RefNannyFinishContext(); + return __pyx_r; +} + +/* "View.MemoryView":235 + * return self.memview[item] + * + * def __setitem__(self, item, value): # <<<<<<<<<<<<<< + * self.memview[item] = value + * +*/ + +/* Python wrapper */ +static int __pyx_array___setitem__(PyObject *__pyx_v_self, PyObject *__pyx_v_item, PyObject *__pyx_v_value); /*proto*/ +static int __pyx_array___setitem__(PyObject *__pyx_v_self, PyObject *__pyx_v_item, PyObject *__pyx_v_value) { + CYTHON_UNUSED PyObject *const *__pyx_kwvalues; + int __pyx_r; + __Pyx_RefNannyDeclarations + __Pyx_RefNannySetupContext("__setitem__ (wrapper)", 0); + __pyx_kwvalues = __Pyx_KwValues_VARARGS(__pyx_args, __pyx_nargs); + __pyx_r = __pyx_array___pyx_pf_15View_dot_MemoryView_5array_12__setitem__(((struct __pyx_array_obj *)__pyx_v_self), ((PyObject *)__pyx_v_item), ((PyObject *)__pyx_v_value)); + + /* function exit code */ + __Pyx_RefNannyFinishContext(); + return __pyx_r; +} + +static int __pyx_array___pyx_pf_15View_dot_MemoryView_5array_12__setitem__(struct __pyx_array_obj *__pyx_v_self, PyObject *__pyx_v_item, PyObject *__pyx_v_value) { + int __pyx_r; + __Pyx_RefNannyDeclarations + PyObject *__pyx_t_1 = NULL; + int __pyx_lineno = 0; + const char *__pyx_filename = NULL; + int __pyx_clineno = 0; + __Pyx_RefNannySetupContext("__setitem__", 0); + + /* "View.MemoryView":236 + * + * def __setitem__(self, item, value): + * self.memview[item] = value # <<<<<<<<<<<<<< + * + * +*/ + __pyx_t_1 = __Pyx_PyObject_GetAttrStr(((PyObject *)__pyx_v_self), __pyx_mstate_global->__pyx_n_u_memview); if (unlikely(!__pyx_t_1)) __PYX_ERR(1, 236, __pyx_L1_error) + __Pyx_GOTREF(__pyx_t_1); + if (unlikely((PyObject_SetItem(__pyx_t_1, __pyx_v_item, __pyx_v_value) < 0))) __PYX_ERR(1, 236, __pyx_L1_error) + __Pyx_DECREF(__pyx_t_1); __pyx_t_1 = 0; + + /* "View.MemoryView":235 + * return self.memview[item] + * + * def __setitem__(self, item, value): # <<<<<<<<<<<<<< + * self.memview[item] = value + * +*/ + + /* function exit code */ + __pyx_r = 0; + goto __pyx_L0; + __pyx_L1_error:; + __Pyx_XDECREF(__pyx_t_1); + __Pyx_AddTraceback("View.MemoryView.array.__setitem__", __pyx_clineno, __pyx_lineno, __pyx_filename); + __pyx_r = -1; + __pyx_L0:; + __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___pyx_array_1__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*/ +static PyObject *__pyx_pw___pyx_array_1__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___pyx_array___reduce_cython__(((struct __pyx_array_obj *)__pyx_v_self)); + + /* function exit code */ + __Pyx_RefNannyFinishContext(); + return __pyx_r; +} + +static PyObject *__pyx_pf___pyx_array___reduce_cython__(CYTHON_UNUSED struct __pyx_array_obj *__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("View.MemoryView.array.__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___pyx_array_3__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*/ +static PyObject *__pyx_pw___pyx_array_3__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("View.MemoryView.array.__setstate_cython__", __pyx_clineno, __pyx_lineno, __pyx_filename); + __Pyx_RefNannyFinishContext(); + return NULL; + __pyx_L4_argument_unpacking_done:; + __pyx_r = __pyx_pf___pyx_array_2__setstate_cython__(((struct __pyx_array_obj *)__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___pyx_array_2__setstate_cython__(CYTHON_UNUSED struct __pyx_array_obj *__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("View.MemoryView.array.__setstate_cython__", __pyx_clineno, __pyx_lineno, __pyx_filename); + __pyx_r = NULL; + __Pyx_XGIVEREF(__pyx_r); + __Pyx_RefNannyFinishContext(); + return __pyx_r; +} + +/* "View.MemoryView":245 + * pass + * + * @cname("__pyx_array_allocate_buffer") # <<<<<<<<<<<<<< + * cdef int _allocate_buffer(array self) except -1: + * +*/ + +static int __pyx_array_allocate_buffer(struct __pyx_array_obj *__pyx_v_self) { + Py_ssize_t __pyx_v_i; + PyObject **__pyx_v_p; + int __pyx_r; + int __pyx_t_1; + Py_ssize_t __pyx_t_2; + Py_ssize_t __pyx_t_3; + Py_ssize_t __pyx_t_4; + int __pyx_lineno = 0; + const char *__pyx_filename = NULL; + int __pyx_clineno = 0; + + /* "View.MemoryView":252 + * cdef PyObject **p + * + * self.free_data = True # <<<<<<<<<<<<<< + * self.data = malloc(self.len) + * if not self.data: +*/ + __pyx_v_self->free_data = 1; + + /* "View.MemoryView":253 + * + * self.free_data = True + * self.data = malloc(self.len) # <<<<<<<<<<<<<< + * if not self.data: + * raise MemoryError, "unable to allocate array data." +*/ + __pyx_v_self->data = ((char *)malloc(__pyx_v_self->len)); + + /* "View.MemoryView":254 + * self.free_data = True + * self.data = malloc(self.len) + * if not self.data: # <<<<<<<<<<<<<< + * raise MemoryError, "unable to allocate array data." + * +*/ + __pyx_t_1 = (!(__pyx_v_self->data != 0)); + if (unlikely(__pyx_t_1)) { + + /* "View.MemoryView":255 + * self.data = malloc(self.len) + * if not self.data: + * raise MemoryError, "unable to allocate array data." # <<<<<<<<<<<<<< + * + * if self.dtype_is_object: +*/ + __Pyx_Raise(((PyObject *)(((PyTypeObject*)PyExc_MemoryError))), __pyx_mstate_global->__pyx_kp_u_unable_to_allocate_array_data, 0, 0); + __PYX_ERR(1, 255, __pyx_L1_error) + + /* "View.MemoryView":254 + * self.free_data = True + * self.data = malloc(self.len) + * if not self.data: # <<<<<<<<<<<<<< + * raise MemoryError, "unable to allocate array data." + * +*/ + } + + /* "View.MemoryView":257 + * raise MemoryError, "unable to allocate array data." + * + * if self.dtype_is_object: # <<<<<<<<<<<<<< + * p = self.data + * for i in range(self.len // self.itemsize): +*/ + if (__pyx_v_self->dtype_is_object) { + + /* "View.MemoryView":258 + * + * if self.dtype_is_object: + * p = self.data # <<<<<<<<<<<<<< + * for i in range(self.len // self.itemsize): + * p[i] = Py_None +*/ + __pyx_v_p = ((PyObject **)__pyx_v_self->data); + + /* "View.MemoryView":259 + * if self.dtype_is_object: + * p = self.data + * for i in range(self.len // self.itemsize): # <<<<<<<<<<<<<< + * p[i] = Py_None + * Py_INCREF(Py_None) +*/ + if (unlikely(__pyx_v_self->itemsize == 0)) { + PyErr_SetString(PyExc_ZeroDivisionError, "integer division or modulo by zero"); + __PYX_ERR(1, 259, __pyx_L1_error) + } + else if (sizeof(Py_ssize_t) == sizeof(long) && (!(((Py_ssize_t)-1) > 0)) && unlikely(__pyx_v_self->itemsize == (Py_ssize_t)-1) && unlikely(__Pyx_UNARY_NEG_WOULD_OVERFLOW(__pyx_v_self->len))) { + PyErr_SetString(PyExc_OverflowError, "value too large to perform division"); + __PYX_ERR(1, 259, __pyx_L1_error) + } + __pyx_t_2 = __Pyx_div_Py_ssize_t(__pyx_v_self->len, __pyx_v_self->itemsize, 0); + __pyx_t_3 = __pyx_t_2; + for (__pyx_t_4 = 0; __pyx_t_4 < __pyx_t_3; __pyx_t_4+=1) { + __pyx_v_i = __pyx_t_4; + + /* "View.MemoryView":260 + * p = self.data + * for i in range(self.len // self.itemsize): + * p[i] = Py_None # <<<<<<<<<<<<<< + * Py_INCREF(Py_None) + * return 0 +*/ + (__pyx_v_p[__pyx_v_i]) = Py_None; + + /* "View.MemoryView":261 + * for i in range(self.len // self.itemsize): + * p[i] = Py_None + * Py_INCREF(Py_None) # <<<<<<<<<<<<<< + * return 0 + * +*/ + Py_INCREF(Py_None); + } + + /* "View.MemoryView":257 + * raise MemoryError, "unable to allocate array data." + * + * if self.dtype_is_object: # <<<<<<<<<<<<<< + * p = self.data + * for i in range(self.len // self.itemsize): +*/ + } + + /* "View.MemoryView":262 + * p[i] = Py_None + * Py_INCREF(Py_None) + * return 0 # <<<<<<<<<<<<<< + * + * +*/ + __pyx_r = 0; + goto __pyx_L0; + + /* "View.MemoryView":245 + * pass + * + * @cname("__pyx_array_allocate_buffer") # <<<<<<<<<<<<<< + * cdef int _allocate_buffer(array self) except -1: + * +*/ + + /* function exit code */ + __pyx_L1_error:; + __Pyx_AddTraceback("View.MemoryView._allocate_buffer", __pyx_clineno, __pyx_lineno, __pyx_filename); + __pyx_r = -1; + __pyx_L0:; + return __pyx_r; +} + +/* "View.MemoryView":265 + * + * + * @cname("__pyx_array_new") # <<<<<<<<<<<<<< + * cdef array array_cwrapper(tuple shape, Py_ssize_t itemsize, char *format, const char *c_mode, char *buf): + * cdef array result +*/ + +static struct __pyx_array_obj *__pyx_array_new(PyObject *__pyx_v_shape, Py_ssize_t __pyx_v_itemsize, char *__pyx_v_format, char const *__pyx_v_c_mode, char *__pyx_v_buf) { + struct __pyx_array_obj *__pyx_v_result = 0; + PyObject *__pyx_v_mode = 0; + struct __pyx_array_obj *__pyx_r = NULL; + __Pyx_RefNannyDeclarations + PyObject *__pyx_t_1 = NULL; + int __pyx_t_2; + PyObject *__pyx_t_3 = NULL; + PyObject *__pyx_t_4 = NULL; + int __pyx_lineno = 0; + const char *__pyx_filename = NULL; + int __pyx_clineno = 0; + __Pyx_RefNannySetupContext("array_cwrapper", 0); + + /* "View.MemoryView":268 + * cdef array array_cwrapper(tuple shape, Py_ssize_t itemsize, char *format, const char *c_mode, char *buf): + * cdef array result + * cdef str mode = "fortran" if c_mode[0] == b'f' else "c" # this often comes from a constant C string. # <<<<<<<<<<<<<< + * + * if buf is NULL: +*/ + __pyx_t_2 = ((__pyx_v_c_mode[0]) == 'f'); + if (__pyx_t_2) { + __Pyx_INCREF(__pyx_mstate_global->__pyx_n_u_fortran); + __pyx_t_1 = __pyx_mstate_global->__pyx_n_u_fortran; + } else { + __Pyx_INCREF(__pyx_mstate_global->__pyx_n_u_c); + __pyx_t_1 = __pyx_mstate_global->__pyx_n_u_c; + } + __pyx_v_mode = ((PyObject*)__pyx_t_1); + __pyx_t_1 = 0; + + /* "View.MemoryView":270 + * cdef str mode = "fortran" if c_mode[0] == b'f' else "c" # this often comes from a constant C string. + * + * if buf is NULL: # <<<<<<<<<<<<<< + * result = array.__new__(array, shape, itemsize, format, mode) + * else: +*/ + __pyx_t_2 = (__pyx_v_buf == NULL); + if (__pyx_t_2) { + + /* "View.MemoryView":271 + * + * if buf is NULL: + * result = array.__new__(array, shape, itemsize, format, mode) # <<<<<<<<<<<<<< + * else: + * result = array.__new__(array, shape, itemsize, format, mode, allocate_buffer=False) +*/ + __pyx_t_1 = PyLong_FromSsize_t(__pyx_v_itemsize); if (unlikely(!__pyx_t_1)) __PYX_ERR(1, 271, __pyx_L1_error) + __Pyx_GOTREF(__pyx_t_1); + __pyx_t_3 = __Pyx_PyBytes_FromString(__pyx_v_format); if (unlikely(!__pyx_t_3)) __PYX_ERR(1, 271, __pyx_L1_error) + __Pyx_GOTREF(__pyx_t_3); + __pyx_t_4 = PyTuple_New(4); if (unlikely(!__pyx_t_4)) __PYX_ERR(1, 271, __pyx_L1_error) + __Pyx_GOTREF(__pyx_t_4); + __Pyx_INCREF(__pyx_v_shape); + __Pyx_GIVEREF(__pyx_v_shape); + if (__Pyx_PyTuple_SET_ITEM(__pyx_t_4, 0, __pyx_v_shape) != (0)) __PYX_ERR(1, 271, __pyx_L1_error); + __Pyx_GIVEREF(__pyx_t_1); + if (__Pyx_PyTuple_SET_ITEM(__pyx_t_4, 1, __pyx_t_1) != (0)) __PYX_ERR(1, 271, __pyx_L1_error); + __Pyx_GIVEREF(__pyx_t_3); + if (__Pyx_PyTuple_SET_ITEM(__pyx_t_4, 2, __pyx_t_3) != (0)) __PYX_ERR(1, 271, __pyx_L1_error); + __Pyx_INCREF(__pyx_v_mode); + __Pyx_GIVEREF(__pyx_v_mode); + if (__Pyx_PyTuple_SET_ITEM(__pyx_t_4, 3, __pyx_v_mode) != (0)) __PYX_ERR(1, 271, __pyx_L1_error); + __pyx_t_1 = 0; + __pyx_t_3 = 0; + __pyx_t_3 = ((PyObject *)__pyx_tp_new_array(((PyTypeObject *)__pyx_mstate_global->__pyx_array_type), __pyx_t_4, NULL)); if (unlikely(!__pyx_t_3)) __PYX_ERR(1, 271, __pyx_L1_error) + __Pyx_GOTREF((PyObject *)__pyx_t_3); + __Pyx_DECREF(__pyx_t_4); __pyx_t_4 = 0; + __pyx_v_result = ((struct __pyx_array_obj *)__pyx_t_3); + __pyx_t_3 = 0; + + /* "View.MemoryView":270 + * cdef str mode = "fortran" if c_mode[0] == b'f' else "c" # this often comes from a constant C string. + * + * if buf is NULL: # <<<<<<<<<<<<<< + * result = array.__new__(array, shape, itemsize, format, mode) + * else: +*/ + goto __pyx_L3; + } + + /* "View.MemoryView":273 + * result = array.__new__(array, shape, itemsize, format, mode) + * else: + * result = array.__new__(array, shape, itemsize, format, mode, allocate_buffer=False) # <<<<<<<<<<<<<< + * result.data = buf + * +*/ + /*else*/ { + __pyx_t_3 = PyLong_FromSsize_t(__pyx_v_itemsize); if (unlikely(!__pyx_t_3)) __PYX_ERR(1, 273, __pyx_L1_error) + __Pyx_GOTREF(__pyx_t_3); + __pyx_t_4 = __Pyx_PyBytes_FromString(__pyx_v_format); if (unlikely(!__pyx_t_4)) __PYX_ERR(1, 273, __pyx_L1_error) + __Pyx_GOTREF(__pyx_t_4); + __pyx_t_1 = PyTuple_New(4); if (unlikely(!__pyx_t_1)) __PYX_ERR(1, 273, __pyx_L1_error) + __Pyx_GOTREF(__pyx_t_1); + __Pyx_INCREF(__pyx_v_shape); + __Pyx_GIVEREF(__pyx_v_shape); + if (__Pyx_PyTuple_SET_ITEM(__pyx_t_1, 0, __pyx_v_shape) != (0)) __PYX_ERR(1, 273, __pyx_L1_error); + __Pyx_GIVEREF(__pyx_t_3); + if (__Pyx_PyTuple_SET_ITEM(__pyx_t_1, 1, __pyx_t_3) != (0)) __PYX_ERR(1, 273, __pyx_L1_error); + __Pyx_GIVEREF(__pyx_t_4); + if (__Pyx_PyTuple_SET_ITEM(__pyx_t_1, 2, __pyx_t_4) != (0)) __PYX_ERR(1, 273, __pyx_L1_error); + __Pyx_INCREF(__pyx_v_mode); + __Pyx_GIVEREF(__pyx_v_mode); + if (__Pyx_PyTuple_SET_ITEM(__pyx_t_1, 3, __pyx_v_mode) != (0)) __PYX_ERR(1, 273, __pyx_L1_error); + __pyx_t_3 = 0; + __pyx_t_4 = 0; + __pyx_t_4 = __Pyx_PyDict_NewPresized(1); if (unlikely(!__pyx_t_4)) __PYX_ERR(1, 273, __pyx_L1_error) + __Pyx_GOTREF(__pyx_t_4); + if (PyDict_SetItem(__pyx_t_4, __pyx_mstate_global->__pyx_n_u_allocate_buffer, Py_False) < (0)) __PYX_ERR(1, 273, __pyx_L1_error) + __pyx_t_3 = ((PyObject *)__pyx_tp_new_array(((PyTypeObject *)__pyx_mstate_global->__pyx_array_type), __pyx_t_1, __pyx_t_4)); if (unlikely(!__pyx_t_3)) __PYX_ERR(1, 273, __pyx_L1_error) + __Pyx_GOTREF((PyObject *)__pyx_t_3); + __Pyx_DECREF(__pyx_t_1); __pyx_t_1 = 0; + __Pyx_DECREF(__pyx_t_4); __pyx_t_4 = 0; + __pyx_v_result = ((struct __pyx_array_obj *)__pyx_t_3); + __pyx_t_3 = 0; + + /* "View.MemoryView":274 + * else: + * result = array.__new__(array, shape, itemsize, format, mode, allocate_buffer=False) + * result.data = buf # <<<<<<<<<<<<<< + * + * return result +*/ + __pyx_v_result->data = __pyx_v_buf; + } + __pyx_L3:; + + /* "View.MemoryView":276 + * result.data = buf + * + * return result # <<<<<<<<<<<<<< + * + * +*/ + __Pyx_XDECREF((PyObject *)__pyx_r); + __Pyx_INCREF((PyObject *)__pyx_v_result); + __pyx_r = __pyx_v_result; + goto __pyx_L0; + + /* "View.MemoryView":265 + * + * + * @cname("__pyx_array_new") # <<<<<<<<<<<<<< + * cdef array array_cwrapper(tuple shape, Py_ssize_t itemsize, char *format, const char *c_mode, char *buf): + * cdef array result +*/ + + /* function exit code */ + __pyx_L1_error:; + __Pyx_XDECREF(__pyx_t_1); + __Pyx_XDECREF(__pyx_t_3); + __Pyx_XDECREF(__pyx_t_4); + __Pyx_AddTraceback("View.MemoryView.array_cwrapper", __pyx_clineno, __pyx_lineno, __pyx_filename); + __pyx_r = 0; + __pyx_L0:; + __Pyx_XDECREF((PyObject *)__pyx_v_result); + __Pyx_XDECREF(__pyx_v_mode); + __Pyx_XGIVEREF((PyObject *)__pyx_r); + __Pyx_RefNannyFinishContext(); + return __pyx_r; +} + +/* "View.MemoryView":302 + * cdef class Enum(object): + * cdef object name + * def __init__(self, name): # <<<<<<<<<<<<<< + * self.name = name + * def __repr__(self): +*/ + +/* Python wrapper */ +static int __pyx_MemviewEnum___init__(PyObject *__pyx_v_self, PyObject *__pyx_args, PyObject *__pyx_kwds); /*proto*/ +static int __pyx_MemviewEnum___init__(PyObject *__pyx_v_self, PyObject *__pyx_args, PyObject *__pyx_kwds) { + PyObject *__pyx_v_name = 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_name,0}; + const Py_ssize_t __pyx_kwds_len = (__pyx_kwds) ? __Pyx_NumKwargs_VARARGS(__pyx_kwds) : 0; + if (unlikely(__pyx_kwds_len) < 0) __PYX_ERR(1, 302, __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(1, 302, __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(1, 302, __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(1, 302, __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(1, 302, __pyx_L3_error) + } + __pyx_v_name = values[0]; + } + goto __pyx_L6_skip; + __pyx_L5_argtuple_error:; + __Pyx_RaiseArgtupleInvalid("__init__", 1, 1, 1, __pyx_nargs); __PYX_ERR(1, 302, __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("View.MemoryView.Enum.__init__", __pyx_clineno, __pyx_lineno, __pyx_filename); + __Pyx_RefNannyFinishContext(); + return -1; + __pyx_L4_argument_unpacking_done:; + __pyx_r = __pyx_MemviewEnum___pyx_pf_15View_dot_MemoryView_4Enum___init__(((struct __pyx_MemviewEnum_obj *)__pyx_v_self), __pyx_v_name); + + /* 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_MemviewEnum___pyx_pf_15View_dot_MemoryView_4Enum___init__(struct __pyx_MemviewEnum_obj *__pyx_v_self, PyObject *__pyx_v_name) { + int __pyx_r; + __Pyx_RefNannyDeclarations + __Pyx_RefNannySetupContext("__init__", 0); + + /* "View.MemoryView":303 + * cdef object name + * def __init__(self, name): + * self.name = name # <<<<<<<<<<<<<< + * def __repr__(self): + * return self.name +*/ + __Pyx_INCREF(__pyx_v_name); + __Pyx_GIVEREF(__pyx_v_name); + __Pyx_GOTREF(__pyx_v_self->name); + __Pyx_DECREF(__pyx_v_self->name); + __pyx_v_self->name = __pyx_v_name; + + /* "View.MemoryView":302 + * cdef class Enum(object): + * cdef object name + * def __init__(self, name): # <<<<<<<<<<<<<< + * self.name = name + * def __repr__(self): +*/ + + /* function exit code */ + __pyx_r = 0; + __Pyx_RefNannyFinishContext(); + return __pyx_r; +} + +/* "View.MemoryView":304 + * def __init__(self, name): + * self.name = name + * def __repr__(self): # <<<<<<<<<<<<<< + * return self.name + * +*/ + +/* Python wrapper */ +static PyObject *__pyx_MemviewEnum___repr__(PyObject *__pyx_v_self); /*proto*/ +static PyObject *__pyx_MemviewEnum___repr__(PyObject *__pyx_v_self) { + CYTHON_UNUSED PyObject *const *__pyx_kwvalues; + PyObject *__pyx_r = 0; + __Pyx_RefNannyDeclarations + __Pyx_RefNannySetupContext("__repr__ (wrapper)", 0); + __pyx_kwvalues = __Pyx_KwValues_VARARGS(__pyx_args, __pyx_nargs); + __pyx_r = __pyx_MemviewEnum___pyx_pf_15View_dot_MemoryView_4Enum_2__repr__(((struct __pyx_MemviewEnum_obj *)__pyx_v_self)); + + /* function exit code */ + __Pyx_RefNannyFinishContext(); + return __pyx_r; +} + +static PyObject *__pyx_MemviewEnum___pyx_pf_15View_dot_MemoryView_4Enum_2__repr__(struct __pyx_MemviewEnum_obj *__pyx_v_self) { + PyObject *__pyx_r = NULL; + __Pyx_RefNannyDeclarations + __Pyx_RefNannySetupContext("__repr__", 0); + + /* "View.MemoryView":305 + * self.name = name + * def __repr__(self): + * return self.name # <<<<<<<<<<<<<< + * + * cdef generic = Enum("") +*/ + __Pyx_XDECREF(__pyx_r); + __Pyx_INCREF(__pyx_v_self->name); + __pyx_r = __pyx_v_self->name; + goto __pyx_L0; + + /* "View.MemoryView":304 + * def __init__(self, name): + * self.name = name + * def __repr__(self): # <<<<<<<<<<<<<< + * return self.name + * +*/ + + /* function exit code */ + __pyx_L0:; + __Pyx_XGIVEREF(__pyx_r); + __Pyx_RefNannyFinishContext(); + return __pyx_r; +} + +/* "(tree fragment)":1 + * def __reduce_cython__(self): # <<<<<<<<<<<<<< + * cdef tuple state + * cdef object _dict +*/ + +/* Python wrapper */ +static PyObject *__pyx_pw___pyx_MemviewEnum_1__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*/ +static PyObject *__pyx_pw___pyx_MemviewEnum_1__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___pyx_MemviewEnum___reduce_cython__(((struct __pyx_MemviewEnum_obj *)__pyx_v_self)); + + /* function exit code */ + __Pyx_RefNannyFinishContext(); + return __pyx_r; +} + +static PyObject *__pyx_pf___pyx_MemviewEnum___reduce_cython__(struct __pyx_MemviewEnum_obj *__pyx_v_self) { + PyObject *__pyx_v_state = 0; + PyObject *__pyx_v__dict = 0; + int __pyx_v_use_setstate; + PyObject *__pyx_r = NULL; + __Pyx_RefNannyDeclarations + PyObject *__pyx_t_1 = NULL; + int __pyx_t_2; + int __pyx_t_3; + PyObject *__pyx_t_4 = NULL; + PyObject *__pyx_t_5 = NULL; + int __pyx_lineno = 0; + const char *__pyx_filename = NULL; + int __pyx_clineno = 0; + __Pyx_RefNannySetupContext("__reduce_cython__", 0); + + /* "(tree fragment)":5 + * cdef object _dict + * cdef bint use_setstate + * state = (self.name,) # <<<<<<<<<<<<<< + * _dict = getattr(self, '__dict__', None) + * if _dict is not None and _dict: +*/ + __pyx_t_1 = PyTuple_New(1); if (unlikely(!__pyx_t_1)) __PYX_ERR(1, 5, __pyx_L1_error) + __Pyx_GOTREF(__pyx_t_1); + __Pyx_INCREF(__pyx_v_self->name); + __Pyx_GIVEREF(__pyx_v_self->name); + if (__Pyx_PyTuple_SET_ITEM(__pyx_t_1, 0, __pyx_v_self->name) != (0)) __PYX_ERR(1, 5, __pyx_L1_error); + __pyx_v_state = ((PyObject*)__pyx_t_1); + __pyx_t_1 = 0; + + /* "(tree fragment)":6 + * cdef bint use_setstate + * state = (self.name,) + * _dict = getattr(self, '__dict__', None) # <<<<<<<<<<<<<< + * if _dict is not None and _dict: + * state += (_dict,) +*/ + __pyx_t_1 = __Pyx_GetAttr3(((PyObject *)__pyx_v_self), __pyx_mstate_global->__pyx_n_u_dict, Py_None); if (unlikely(!__pyx_t_1)) __PYX_ERR(1, 6, __pyx_L1_error) + __Pyx_GOTREF(__pyx_t_1); + __pyx_v__dict = __pyx_t_1; + __pyx_t_1 = 0; + + /* "(tree fragment)":7 + * state = (self.name,) + * _dict = getattr(self, '__dict__', None) + * if _dict is not None and _dict: # <<<<<<<<<<<<<< + * state += (_dict,) + * use_setstate = True +*/ + __pyx_t_3 = (__pyx_v__dict != Py_None); + if (__pyx_t_3) { + } else { + __pyx_t_2 = __pyx_t_3; + goto __pyx_L4_bool_binop_done; + } + __pyx_t_3 = __Pyx_PyObject_IsTrue(__pyx_v__dict); if (unlikely((__pyx_t_3 < 0))) __PYX_ERR(1, 7, __pyx_L1_error) + __pyx_t_2 = __pyx_t_3; + __pyx_L4_bool_binop_done:; + if (__pyx_t_2) { + + /* "(tree fragment)":8 + * _dict = getattr(self, '__dict__', None) + * if _dict is not None and _dict: + * state += (_dict,) # <<<<<<<<<<<<<< + * use_setstate = True + * else: +*/ + __pyx_t_1 = PyTuple_New(1); if (unlikely(!__pyx_t_1)) __PYX_ERR(1, 8, __pyx_L1_error) + __Pyx_GOTREF(__pyx_t_1); + __Pyx_INCREF(__pyx_v__dict); + __Pyx_GIVEREF(__pyx_v__dict); + if (__Pyx_PyTuple_SET_ITEM(__pyx_t_1, 0, __pyx_v__dict) != (0)) __PYX_ERR(1, 8, __pyx_L1_error); + __pyx_t_4 = PyNumber_InPlaceAdd(__pyx_v_state, __pyx_t_1); if (unlikely(!__pyx_t_4)) __PYX_ERR(1, 8, __pyx_L1_error) + __Pyx_GOTREF(__pyx_t_4); + __Pyx_DECREF(__pyx_t_1); __pyx_t_1 = 0; + __Pyx_DECREF_SET(__pyx_v_state, ((PyObject*)__pyx_t_4)); + __pyx_t_4 = 0; + + /* "(tree fragment)":9 + * if _dict is not None and _dict: + * state += (_dict,) + * use_setstate = True # <<<<<<<<<<<<<< + * else: + * use_setstate = ('self.name is not None',) +*/ + __pyx_v_use_setstate = 1; + + /* "(tree fragment)":7 + * state = (self.name,) + * _dict = getattr(self, '__dict__', None) + * if _dict is not None and _dict: # <<<<<<<<<<<<<< + * state += (_dict,) + * use_setstate = True +*/ + goto __pyx_L3; + } + + /* "(tree fragment)":11 + * use_setstate = True + * else: + * use_setstate = ('self.name is not None',) # <<<<<<<<<<<<<< + * if use_setstate: + * return __pyx_unpickle_Enum, (type(self), 0x82a3537, None), state +*/ + /*else*/ { + __pyx_t_2 = __Pyx_PyObject_IsTrue(__pyx_mstate_global->__pyx_tuple[0]); if (unlikely((__pyx_t_2 == (int)-1) && PyErr_Occurred())) __PYX_ERR(1, 11, __pyx_L1_error) + __pyx_v_use_setstate = __pyx_t_2; + } + __pyx_L3:; + + /* "(tree fragment)":12 + * else: + * use_setstate = ('self.name is not None',) + * if use_setstate: # <<<<<<<<<<<<<< + * return __pyx_unpickle_Enum, (type(self), 0x82a3537, None), state + * else: +*/ + if (__pyx_v_use_setstate) { + + /* "(tree fragment)":13 + * use_setstate = ('self.name is not None',) + * if use_setstate: + * return __pyx_unpickle_Enum, (type(self), 0x82a3537, None), state # <<<<<<<<<<<<<< + * else: + * return __pyx_unpickle_Enum, (type(self), 0x82a3537, state) +*/ + __Pyx_XDECREF(__pyx_r); + __Pyx_GetModuleGlobalName(__pyx_t_4, __pyx_mstate_global->__pyx_n_u_pyx_unpickle_Enum); if (unlikely(!__pyx_t_4)) __PYX_ERR(1, 13, __pyx_L1_error) + __Pyx_GOTREF(__pyx_t_4); + __pyx_t_1 = PyTuple_New(3); if (unlikely(!__pyx_t_1)) __PYX_ERR(1, 13, __pyx_L1_error) + __Pyx_GOTREF(__pyx_t_1); + __Pyx_INCREF(((PyObject *)Py_TYPE(((PyObject *)__pyx_v_self)))); + __Pyx_GIVEREF(((PyObject *)Py_TYPE(((PyObject *)__pyx_v_self)))); + if (__Pyx_PyTuple_SET_ITEM(__pyx_t_1, 0, ((PyObject *)Py_TYPE(((PyObject *)__pyx_v_self)))) != (0)) __PYX_ERR(1, 13, __pyx_L1_error); + __Pyx_INCREF(__pyx_mstate_global->__pyx_int_136983863); + __Pyx_GIVEREF(__pyx_mstate_global->__pyx_int_136983863); + if (__Pyx_PyTuple_SET_ITEM(__pyx_t_1, 1, __pyx_mstate_global->__pyx_int_136983863) != (0)) __PYX_ERR(1, 13, __pyx_L1_error); + __Pyx_INCREF(Py_None); + __Pyx_GIVEREF(Py_None); + if (__Pyx_PyTuple_SET_ITEM(__pyx_t_1, 2, Py_None) != (0)) __PYX_ERR(1, 13, __pyx_L1_error); + __pyx_t_5 = PyTuple_New(3); if (unlikely(!__pyx_t_5)) __PYX_ERR(1, 13, __pyx_L1_error) + __Pyx_GOTREF(__pyx_t_5); + __Pyx_GIVEREF(__pyx_t_4); + if (__Pyx_PyTuple_SET_ITEM(__pyx_t_5, 0, __pyx_t_4) != (0)) __PYX_ERR(1, 13, __pyx_L1_error); + __Pyx_GIVEREF(__pyx_t_1); + if (__Pyx_PyTuple_SET_ITEM(__pyx_t_5, 1, __pyx_t_1) != (0)) __PYX_ERR(1, 13, __pyx_L1_error); + __Pyx_INCREF(__pyx_v_state); + __Pyx_GIVEREF(__pyx_v_state); + if (__Pyx_PyTuple_SET_ITEM(__pyx_t_5, 2, __pyx_v_state) != (0)) __PYX_ERR(1, 13, __pyx_L1_error); + __pyx_t_4 = 0; + __pyx_t_1 = 0; + __pyx_r = __pyx_t_5; + __pyx_t_5 = 0; + goto __pyx_L0; + + /* "(tree fragment)":12 + * else: + * use_setstate = ('self.name is not None',) + * if use_setstate: # <<<<<<<<<<<<<< + * return __pyx_unpickle_Enum, (type(self), 0x82a3537, None), state + * else: +*/ + } + + /* "(tree fragment)":15 + * return __pyx_unpickle_Enum, (type(self), 0x82a3537, None), state + * else: + * return __pyx_unpickle_Enum, (type(self), 0x82a3537, state) # <<<<<<<<<<<<<< + * def __setstate_cython__(self, __pyx_state): + * __pyx_unpickle_Enum__set_state(self, __pyx_state) +*/ + /*else*/ { + __Pyx_XDECREF(__pyx_r); + __Pyx_GetModuleGlobalName(__pyx_t_5, __pyx_mstate_global->__pyx_n_u_pyx_unpickle_Enum); if (unlikely(!__pyx_t_5)) __PYX_ERR(1, 15, __pyx_L1_error) + __Pyx_GOTREF(__pyx_t_5); + __pyx_t_1 = PyTuple_New(3); if (unlikely(!__pyx_t_1)) __PYX_ERR(1, 15, __pyx_L1_error) + __Pyx_GOTREF(__pyx_t_1); + __Pyx_INCREF(((PyObject *)Py_TYPE(((PyObject *)__pyx_v_self)))); + __Pyx_GIVEREF(((PyObject *)Py_TYPE(((PyObject *)__pyx_v_self)))); + if (__Pyx_PyTuple_SET_ITEM(__pyx_t_1, 0, ((PyObject *)Py_TYPE(((PyObject *)__pyx_v_self)))) != (0)) __PYX_ERR(1, 15, __pyx_L1_error); + __Pyx_INCREF(__pyx_mstate_global->__pyx_int_136983863); + __Pyx_GIVEREF(__pyx_mstate_global->__pyx_int_136983863); + if (__Pyx_PyTuple_SET_ITEM(__pyx_t_1, 1, __pyx_mstate_global->__pyx_int_136983863) != (0)) __PYX_ERR(1, 15, __pyx_L1_error); + __Pyx_INCREF(__pyx_v_state); + __Pyx_GIVEREF(__pyx_v_state); + if (__Pyx_PyTuple_SET_ITEM(__pyx_t_1, 2, __pyx_v_state) != (0)) __PYX_ERR(1, 15, __pyx_L1_error); + __pyx_t_4 = PyTuple_New(2); if (unlikely(!__pyx_t_4)) __PYX_ERR(1, 15, __pyx_L1_error) + __Pyx_GOTREF(__pyx_t_4); + __Pyx_GIVEREF(__pyx_t_5); + if (__Pyx_PyTuple_SET_ITEM(__pyx_t_4, 0, __pyx_t_5) != (0)) __PYX_ERR(1, 15, __pyx_L1_error); + __Pyx_GIVEREF(__pyx_t_1); + if (__Pyx_PyTuple_SET_ITEM(__pyx_t_4, 1, __pyx_t_1) != (0)) __PYX_ERR(1, 15, __pyx_L1_error); + __pyx_t_5 = 0; + __pyx_t_1 = 0; + __pyx_r = __pyx_t_4; + __pyx_t_4 = 0; + goto __pyx_L0; + } + + /* "(tree fragment)":1 + * def __reduce_cython__(self): # <<<<<<<<<<<<<< + * cdef tuple state + * cdef object _dict +*/ + + /* function exit code */ + __pyx_L1_error:; + __Pyx_XDECREF(__pyx_t_1); + __Pyx_XDECREF(__pyx_t_4); + __Pyx_XDECREF(__pyx_t_5); + __Pyx_AddTraceback("View.MemoryView.Enum.__reduce_cython__", __pyx_clineno, __pyx_lineno, __pyx_filename); + __pyx_r = NULL; + __pyx_L0:; + __Pyx_XDECREF(__pyx_v_state); + __Pyx_XDECREF(__pyx_v__dict); + __Pyx_XGIVEREF(__pyx_r); + __Pyx_RefNannyFinishContext(); + return __pyx_r; +} + +/* "(tree fragment)":16 + * else: + * return __pyx_unpickle_Enum, (type(self), 0x82a3537, state) + * def __setstate_cython__(self, __pyx_state): # <<<<<<<<<<<<<< + * __pyx_unpickle_Enum__set_state(self, __pyx_state) +*/ + +/* Python wrapper */ +static PyObject *__pyx_pw___pyx_MemviewEnum_3__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*/ +static PyObject *__pyx_pw___pyx_MemviewEnum_3__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 +) { + 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, 16, __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, 16, __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, 16, __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, 16, __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, 16, __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, 16, __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("View.MemoryView.Enum.__setstate_cython__", __pyx_clineno, __pyx_lineno, __pyx_filename); + __Pyx_RefNannyFinishContext(); + return NULL; + __pyx_L4_argument_unpacking_done:; + __pyx_r = __pyx_pf___pyx_MemviewEnum_2__setstate_cython__(((struct __pyx_MemviewEnum_obj *)__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___pyx_MemviewEnum_2__setstate_cython__(struct __pyx_MemviewEnum_obj *__pyx_v_self, PyObject *__pyx_v___pyx_state) { + PyObject *__pyx_r = NULL; + __Pyx_RefNannyDeclarations + PyObject *__pyx_t_1 = NULL; + PyObject *__pyx_t_2 = NULL; + int __pyx_lineno = 0; + const char *__pyx_filename = NULL; + int __pyx_clineno = 0; + __Pyx_RefNannySetupContext("__setstate_cython__", 0); + + /* "(tree fragment)":17 + * return __pyx_unpickle_Enum, (type(self), 0x82a3537, state) + * def __setstate_cython__(self, __pyx_state): + * __pyx_unpickle_Enum__set_state(self, __pyx_state) # <<<<<<<<<<<<<< +*/ + __pyx_t_1 = __pyx_v___pyx_state; + __Pyx_INCREF(__pyx_t_1); + if (!(likely(PyTuple_CheckExact(__pyx_t_1))||((__pyx_t_1) == Py_None) || __Pyx_RaiseUnexpectedTypeError("tuple", __pyx_t_1))) __PYX_ERR(1, 17, __pyx_L1_error) + if (unlikely(__pyx_t_1 == Py_None)) { + PyErr_SetString(PyExc_TypeError, "cannot pass None into a C function argument that is declared 'not None'"); + __PYX_ERR(1, 17, __pyx_L1_error) + } + __pyx_t_2 = __pyx_unpickle_Enum__set_state(__pyx_v_self, ((PyObject*)__pyx_t_1)); if (unlikely(!__pyx_t_2)) __PYX_ERR(1, 17, __pyx_L1_error) + __Pyx_GOTREF(__pyx_t_2); + __Pyx_DECREF(__pyx_t_1); __pyx_t_1 = 0; + __Pyx_DECREF(__pyx_t_2); __pyx_t_2 = 0; + + /* "(tree fragment)":16 + * else: + * return __pyx_unpickle_Enum, (type(self), 0x82a3537, state) + * def __setstate_cython__(self, __pyx_state): # <<<<<<<<<<<<<< + * __pyx_unpickle_Enum__set_state(self, __pyx_state) +*/ + + /* 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("View.MemoryView.Enum.__setstate_cython__", __pyx_clineno, __pyx_lineno, __pyx_filename); + __pyx_r = NULL; + __pyx_L0:; + __Pyx_XGIVEREF(__pyx_r); + __Pyx_RefNannyFinishContext(); + return __pyx_r; +} + +/* "View.MemoryView":348 + * cdef const __Pyx_TypeInfo *typeinfo + * + * def __cinit__(memoryview self, object obj, int flags, bint dtype_is_object=False): # <<<<<<<<<<<<<< + * self.obj = obj + * self.flags = flags +*/ + +/* Python wrapper */ +static int __pyx_memoryview___cinit__(PyObject *__pyx_v_self, PyObject *__pyx_args, PyObject *__pyx_kwds); /*proto*/ +static int __pyx_memoryview___cinit__(PyObject *__pyx_v_self, PyObject *__pyx_args, PyObject *__pyx_kwds) { + PyObject *__pyx_v_obj = 0; + int __pyx_v_flags; + int __pyx_v_dtype_is_object; + CYTHON_UNUSED Py_ssize_t __pyx_nargs; + 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; + 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_obj,&__pyx_mstate_global->__pyx_n_u_flags,&__pyx_mstate_global->__pyx_n_u_dtype_is_object,0}; + const Py_ssize_t __pyx_kwds_len = (__pyx_kwds) ? __Pyx_NumKwargs_VARARGS(__pyx_kwds) : 0; + if (unlikely(__pyx_kwds_len) < 0) __PYX_ERR(1, 348, __pyx_L3_error) + if (__pyx_kwds_len > 0) { + switch (__pyx_nargs) { + case 3: + values[2] = __Pyx_ArgRef_VARARGS(__pyx_args, 2); + if (!CYTHON_ASSUME_SAFE_MACROS && unlikely(!values[2])) __PYX_ERR(1, 348, __pyx_L3_error) + CYTHON_FALLTHROUGH; + case 2: + values[1] = __Pyx_ArgRef_VARARGS(__pyx_args, 1); + if (!CYTHON_ASSUME_SAFE_MACROS && unlikely(!values[1])) __PYX_ERR(1, 348, __pyx_L3_error) + CYTHON_FALLTHROUGH; + case 1: + values[0] = __Pyx_ArgRef_VARARGS(__pyx_args, 0); + if (!CYTHON_ASSUME_SAFE_MACROS && unlikely(!values[0])) __PYX_ERR(1, 348, __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(1, 348, __pyx_L3_error) + for (Py_ssize_t i = __pyx_nargs; i < 2; i++) { + if (unlikely(!values[i])) { __Pyx_RaiseArgtupleInvalid("__cinit__", 0, 2, 3, i); __PYX_ERR(1, 348, __pyx_L3_error) } + } + } else { + switch (__pyx_nargs) { + case 3: + values[2] = __Pyx_ArgRef_VARARGS(__pyx_args, 2); + if (!CYTHON_ASSUME_SAFE_MACROS && unlikely(!values[2])) __PYX_ERR(1, 348, __pyx_L3_error) + CYTHON_FALLTHROUGH; + case 2: + values[1] = __Pyx_ArgRef_VARARGS(__pyx_args, 1); + if (!CYTHON_ASSUME_SAFE_MACROS && unlikely(!values[1])) __PYX_ERR(1, 348, __pyx_L3_error) + values[0] = __Pyx_ArgRef_VARARGS(__pyx_args, 0); + if (!CYTHON_ASSUME_SAFE_MACROS && unlikely(!values[0])) __PYX_ERR(1, 348, __pyx_L3_error) + break; + default: goto __pyx_L5_argtuple_error; + } + } + __pyx_v_obj = values[0]; + __pyx_v_flags = __Pyx_PyLong_As_int(values[1]); if (unlikely((__pyx_v_flags == (int)-1) && PyErr_Occurred())) __PYX_ERR(1, 348, __pyx_L3_error) + if (values[2]) { + __pyx_v_dtype_is_object = __Pyx_PyObject_IsTrue(values[2]); if (unlikely((__pyx_v_dtype_is_object == (int)-1) && PyErr_Occurred())) __PYX_ERR(1, 348, __pyx_L3_error) + } else { + __pyx_v_dtype_is_object = ((int)0); + } + } + goto __pyx_L6_skip; + __pyx_L5_argtuple_error:; + __Pyx_RaiseArgtupleInvalid("__cinit__", 0, 2, 3, __pyx_nargs); __PYX_ERR(1, 348, __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("View.MemoryView.memoryview.__cinit__", __pyx_clineno, __pyx_lineno, __pyx_filename); + __Pyx_RefNannyFinishContext(); + return -1; + __pyx_L4_argument_unpacking_done:; + __pyx_r = __pyx_memoryview___pyx_pf_15View_dot_MemoryView_10memoryview___cinit__(((struct __pyx_memoryview_obj *)__pyx_v_self), __pyx_v_obj, __pyx_v_flags, __pyx_v_dtype_is_object); + + /* 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_memoryview___pyx_pf_15View_dot_MemoryView_10memoryview___cinit__(struct __pyx_memoryview_obj *__pyx_v_self, PyObject *__pyx_v_obj, int __pyx_v_flags, int __pyx_v_dtype_is_object) { + int __pyx_r; + __Pyx_RefNannyDeclarations + int __pyx_t_1; + int __pyx_t_2; + int __pyx_t_3; + Py_intptr_t __pyx_t_4; + size_t __pyx_t_5; + int __pyx_lineno = 0; + const char *__pyx_filename = NULL; + int __pyx_clineno = 0; + __Pyx_RefNannySetupContext("__cinit__", 0); + + /* "View.MemoryView":349 + * + * def __cinit__(memoryview self, object obj, int flags, bint dtype_is_object=False): + * self.obj = obj # <<<<<<<<<<<<<< + * self.flags = flags + * if type(self) is memoryview or obj is not None: +*/ + __Pyx_INCREF(__pyx_v_obj); + __Pyx_GIVEREF(__pyx_v_obj); + __Pyx_GOTREF(__pyx_v_self->obj); + __Pyx_DECREF(__pyx_v_self->obj); + __pyx_v_self->obj = __pyx_v_obj; + + /* "View.MemoryView":350 + * def __cinit__(memoryview self, object obj, int flags, bint dtype_is_object=False): + * self.obj = obj + * self.flags = flags # <<<<<<<<<<<<<< + * if type(self) is memoryview or obj is not None: + * PyObject_GetBuffer(obj, &self.view, flags) +*/ + __pyx_v_self->flags = __pyx_v_flags; + + /* "View.MemoryView":351 + * self.obj = obj + * self.flags = flags + * if type(self) is memoryview or obj is not None: # <<<<<<<<<<<<<< + * PyObject_GetBuffer(obj, &self.view, flags) + * if self.view.obj == NULL: +*/ + __pyx_t_2 = (((PyObject *)Py_TYPE(((PyObject *)__pyx_v_self))) == ((PyObject *)__pyx_mstate_global->__pyx_memoryview_type)); + if (!__pyx_t_2) { + } else { + __pyx_t_1 = __pyx_t_2; + goto __pyx_L4_bool_binop_done; + } + __pyx_t_2 = (__pyx_v_obj != Py_None); + __pyx_t_1 = __pyx_t_2; + __pyx_L4_bool_binop_done:; + if (__pyx_t_1) { + + /* "View.MemoryView":352 + * self.flags = flags + * if type(self) is memoryview or obj is not None: + * PyObject_GetBuffer(obj, &self.view, flags) # <<<<<<<<<<<<<< + * if self.view.obj == NULL: + * (<__pyx_buffer *> &self.view).obj = Py_None +*/ + __pyx_t_3 = PyObject_GetBuffer(__pyx_v_obj, (&__pyx_v_self->view), __pyx_v_flags); if (unlikely(__pyx_t_3 == ((int)-1))) __PYX_ERR(1, 352, __pyx_L1_error) + + /* "View.MemoryView":353 + * if type(self) is memoryview or obj is not None: + * PyObject_GetBuffer(obj, &self.view, flags) + * if self.view.obj == NULL: # <<<<<<<<<<<<<< + * (<__pyx_buffer *> &self.view).obj = Py_None + * Py_INCREF(Py_None) +*/ + __pyx_t_1 = (((PyObject *)__pyx_v_self->view.obj) == NULL); + if (__pyx_t_1) { + + /* "View.MemoryView":354 + * PyObject_GetBuffer(obj, &self.view, flags) + * if self.view.obj == NULL: + * (<__pyx_buffer *> &self.view).obj = Py_None # <<<<<<<<<<<<<< + * Py_INCREF(Py_None) + * +*/ + ((Py_buffer *)(&__pyx_v_self->view))->obj = Py_None; + + /* "View.MemoryView":355 + * if self.view.obj == NULL: + * (<__pyx_buffer *> &self.view).obj = Py_None + * Py_INCREF(Py_None) # <<<<<<<<<<<<<< + * + * if not __PYX_CYTHON_ATOMICS_ENABLED(): +*/ + Py_INCREF(Py_None); + + /* "View.MemoryView":353 + * if type(self) is memoryview or obj is not None: + * PyObject_GetBuffer(obj, &self.view, flags) + * if self.view.obj == NULL: # <<<<<<<<<<<<<< + * (<__pyx_buffer *> &self.view).obj = Py_None + * Py_INCREF(Py_None) +*/ + } + + /* "View.MemoryView":351 + * self.obj = obj + * self.flags = flags + * if type(self) is memoryview or obj is not None: # <<<<<<<<<<<<<< + * PyObject_GetBuffer(obj, &self.view, flags) + * if self.view.obj == NULL: +*/ + } + + /* "View.MemoryView":357 + * Py_INCREF(Py_None) + * + * if not __PYX_CYTHON_ATOMICS_ENABLED(): # <<<<<<<<<<<<<< + * global __pyx_memoryview_thread_locks_used + * if (__pyx_memoryview_thread_locks_used < 8 and +*/ + __pyx_t_1 = (!__PYX_CYTHON_ATOMICS_ENABLED()); + if (__pyx_t_1) { + + /* "View.MemoryView":359 + * if not __PYX_CYTHON_ATOMICS_ENABLED(): + * global __pyx_memoryview_thread_locks_used + * if (__pyx_memoryview_thread_locks_used < 8 and # <<<<<<<<<<<<<< + * + * not __PYX_GET_CYTHON_COMPILING_IN_CPYTHON_FREETHREADING()): +*/ + __pyx_t_2 = (__pyx_memoryview_thread_locks_used < 8); + if (__pyx_t_2) { + } else { + __pyx_t_1 = __pyx_t_2; + goto __pyx_L9_bool_binop_done; + } + + /* "View.MemoryView":361 + * if (__pyx_memoryview_thread_locks_used < 8 and + * + * not __PYX_GET_CYTHON_COMPILING_IN_CPYTHON_FREETHREADING()): # <<<<<<<<<<<<<< + * self.lock = __pyx_memoryview_thread_locks[__pyx_memoryview_thread_locks_used] + * __pyx_memoryview_thread_locks_used += 1 +*/ + __pyx_t_2 = (!__PYX_GET_CYTHON_COMPILING_IN_CPYTHON_FREETHREADING()); + __pyx_t_1 = __pyx_t_2; + __pyx_L9_bool_binop_done:; + + /* "View.MemoryView":359 + * if not __PYX_CYTHON_ATOMICS_ENABLED(): + * global __pyx_memoryview_thread_locks_used + * if (__pyx_memoryview_thread_locks_used < 8 and # <<<<<<<<<<<<<< + * + * not __PYX_GET_CYTHON_COMPILING_IN_CPYTHON_FREETHREADING()): +*/ + if (__pyx_t_1) { + + /* "View.MemoryView":362 + * + * not __PYX_GET_CYTHON_COMPILING_IN_CPYTHON_FREETHREADING()): + * self.lock = __pyx_memoryview_thread_locks[__pyx_memoryview_thread_locks_used] # <<<<<<<<<<<<<< + * __pyx_memoryview_thread_locks_used += 1 + * if self.lock is NULL: +*/ + __pyx_v_self->lock = (__pyx_memoryview_thread_locks[__pyx_memoryview_thread_locks_used]); + + /* "View.MemoryView":363 + * not __PYX_GET_CYTHON_COMPILING_IN_CPYTHON_FREETHREADING()): + * self.lock = __pyx_memoryview_thread_locks[__pyx_memoryview_thread_locks_used] + * __pyx_memoryview_thread_locks_used += 1 # <<<<<<<<<<<<<< + * if self.lock is NULL: + * self.lock = PyThread_allocate_lock() +*/ + __pyx_memoryview_thread_locks_used = (__pyx_memoryview_thread_locks_used + 1); + + /* "View.MemoryView":359 + * if not __PYX_CYTHON_ATOMICS_ENABLED(): + * global __pyx_memoryview_thread_locks_used + * if (__pyx_memoryview_thread_locks_used < 8 and # <<<<<<<<<<<<<< + * + * not __PYX_GET_CYTHON_COMPILING_IN_CPYTHON_FREETHREADING()): +*/ + } + + /* "View.MemoryView":364 + * self.lock = __pyx_memoryview_thread_locks[__pyx_memoryview_thread_locks_used] + * __pyx_memoryview_thread_locks_used += 1 + * if self.lock is NULL: # <<<<<<<<<<<<<< + * self.lock = PyThread_allocate_lock() + * if self.lock is NULL: +*/ + __pyx_t_1 = (__pyx_v_self->lock == NULL); + if (__pyx_t_1) { + + /* "View.MemoryView":365 + * __pyx_memoryview_thread_locks_used += 1 + * if self.lock is NULL: + * self.lock = PyThread_allocate_lock() # <<<<<<<<<<<<<< + * if self.lock is NULL: + * raise MemoryError +*/ + __pyx_v_self->lock = PyThread_allocate_lock(); + + /* "View.MemoryView":366 + * if self.lock is NULL: + * self.lock = PyThread_allocate_lock() + * if self.lock is NULL: # <<<<<<<<<<<<<< + * raise MemoryError + * +*/ + __pyx_t_1 = (__pyx_v_self->lock == NULL); + if (unlikely(__pyx_t_1)) { + + /* "View.MemoryView":367 + * self.lock = PyThread_allocate_lock() + * if self.lock is NULL: + * raise MemoryError # <<<<<<<<<<<<<< + * + * if flags & PyBUF_FORMAT: +*/ + PyErr_NoMemory(); __PYX_ERR(1, 367, __pyx_L1_error) + + /* "View.MemoryView":366 + * if self.lock is NULL: + * self.lock = PyThread_allocate_lock() + * if self.lock is NULL: # <<<<<<<<<<<<<< + * raise MemoryError + * +*/ + } + + /* "View.MemoryView":364 + * self.lock = __pyx_memoryview_thread_locks[__pyx_memoryview_thread_locks_used] + * __pyx_memoryview_thread_locks_used += 1 + * if self.lock is NULL: # <<<<<<<<<<<<<< + * self.lock = PyThread_allocate_lock() + * if self.lock is NULL: +*/ + } + + /* "View.MemoryView":357 + * Py_INCREF(Py_None) + * + * if not __PYX_CYTHON_ATOMICS_ENABLED(): # <<<<<<<<<<<<<< + * global __pyx_memoryview_thread_locks_used + * if (__pyx_memoryview_thread_locks_used < 8 and +*/ + } + + /* "View.MemoryView":369 + * raise MemoryError + * + * if flags & PyBUF_FORMAT: # <<<<<<<<<<<<<< + * self.dtype_is_object = (self.view.format[0] == b'O' and self.view.format[1] == b'\0') + * else: +*/ + __pyx_t_1 = ((__pyx_v_flags & PyBUF_FORMAT) != 0); + if (__pyx_t_1) { + + /* "View.MemoryView":370 + * + * if flags & PyBUF_FORMAT: + * self.dtype_is_object = (self.view.format[0] == b'O' and self.view.format[1] == b'\0') # <<<<<<<<<<<<<< + * else: + * self.dtype_is_object = dtype_is_object +*/ + __pyx_t_2 = ((__pyx_v_self->view.format[0]) == 'O'); + if (__pyx_t_2) { + } else { + __pyx_t_1 = __pyx_t_2; + goto __pyx_L14_bool_binop_done; + } + __pyx_t_2 = ((__pyx_v_self->view.format[1]) == '\x00'); + __pyx_t_1 = __pyx_t_2; + __pyx_L14_bool_binop_done:; + __pyx_v_self->dtype_is_object = __pyx_t_1; + + /* "View.MemoryView":369 + * raise MemoryError + * + * if flags & PyBUF_FORMAT: # <<<<<<<<<<<<<< + * self.dtype_is_object = (self.view.format[0] == b'O' and self.view.format[1] == b'\0') + * else: +*/ + goto __pyx_L13; + } + + /* "View.MemoryView":372 + * self.dtype_is_object = (self.view.format[0] == b'O' and self.view.format[1] == b'\0') + * else: + * self.dtype_is_object = dtype_is_object # <<<<<<<<<<<<<< + * + * assert (&self.acquisition_count) % sizeof(__pyx_atomic_int_type) == 0 +*/ + /*else*/ { + __pyx_v_self->dtype_is_object = __pyx_v_dtype_is_object; + } + __pyx_L13:; + + /* "View.MemoryView":374 + * self.dtype_is_object = dtype_is_object + * + * assert (&self.acquisition_count) % sizeof(__pyx_atomic_int_type) == 0 # <<<<<<<<<<<<<< + * self.typeinfo = NULL + * +*/ + #ifndef CYTHON_WITHOUT_ASSERTIONS + if (unlikely(__pyx_assertions_enabled())) { + __pyx_t_4 = ((Py_intptr_t)((void *)(&__pyx_v_self->acquisition_count))); + __pyx_t_5 = (sizeof(__pyx_atomic_int_type)); + if (unlikely(__pyx_t_5 == 0)) { + PyErr_SetString(PyExc_ZeroDivisionError, "integer division or modulo by zero"); + __PYX_ERR(1, 374, __pyx_L1_error) + } + __pyx_t_1 = ((__pyx_t_4 % __pyx_t_5) == 0); + if (unlikely(!__pyx_t_1)) { + __Pyx_Raise(((PyObject *)(((PyTypeObject*)PyExc_AssertionError))), 0, 0, 0); + __PYX_ERR(1, 374, __pyx_L1_error) + } + } + #else + if ((1)); else __PYX_ERR(1, 374, __pyx_L1_error) + #endif + + /* "View.MemoryView":375 + * + * assert (&self.acquisition_count) % sizeof(__pyx_atomic_int_type) == 0 + * self.typeinfo = NULL # <<<<<<<<<<<<<< + * + * def __dealloc__(memoryview self): +*/ + __pyx_v_self->typeinfo = NULL; + + /* "View.MemoryView":348 + * cdef const __Pyx_TypeInfo *typeinfo + * + * def __cinit__(memoryview self, object obj, int flags, bint dtype_is_object=False): # <<<<<<<<<<<<<< + * self.obj = obj + * self.flags = flags +*/ + + /* function exit code */ + __pyx_r = 0; + goto __pyx_L0; + __pyx_L1_error:; + __Pyx_AddTraceback("View.MemoryView.memoryview.__cinit__", __pyx_clineno, __pyx_lineno, __pyx_filename); + __pyx_r = -1; + __pyx_L0:; + __Pyx_RefNannyFinishContext(); + return __pyx_r; +} + +/* "View.MemoryView":377 + * self.typeinfo = NULL + * + * def __dealloc__(memoryview self): # <<<<<<<<<<<<<< + * if self.obj is not None: + * PyBuffer_Release(&self.view) +*/ + +/* Python wrapper */ +static void __pyx_memoryview___dealloc__(PyObject *__pyx_v_self); /*proto*/ +static void __pyx_memoryview___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_memoryview___pyx_pf_15View_dot_MemoryView_10memoryview_2__dealloc__(((struct __pyx_memoryview_obj *)__pyx_v_self)); + + /* function exit code */ + __Pyx_RefNannyFinishContext(); +} + +static void __pyx_memoryview___pyx_pf_15View_dot_MemoryView_10memoryview_2__dealloc__(struct __pyx_memoryview_obj *__pyx_v_self) { + int __pyx_v_i; + int __pyx_t_1; + Py_ssize_t __pyx_t_2; + Py_ssize_t __pyx_t_3; + int __pyx_t_4; + PyThread_type_lock __pyx_t_5; + PyThread_type_lock __pyx_t_6; + + /* "View.MemoryView":378 + * + * def __dealloc__(memoryview self): + * if self.obj is not None: # <<<<<<<<<<<<<< + * PyBuffer_Release(&self.view) + * elif (<__pyx_buffer *> &self.view).obj == Py_None: +*/ + __pyx_t_1 = (__pyx_v_self->obj != Py_None); + if (__pyx_t_1) { + + /* "View.MemoryView":379 + * def __dealloc__(memoryview self): + * if self.obj is not None: + * PyBuffer_Release(&self.view) # <<<<<<<<<<<<<< + * elif (<__pyx_buffer *> &self.view).obj == Py_None: + * +*/ + PyBuffer_Release((&__pyx_v_self->view)); + + /* "View.MemoryView":378 + * + * def __dealloc__(memoryview self): + * if self.obj is not None: # <<<<<<<<<<<<<< + * PyBuffer_Release(&self.view) + * elif (<__pyx_buffer *> &self.view).obj == Py_None: +*/ + goto __pyx_L3; + } + + /* "View.MemoryView":380 + * if self.obj is not None: + * PyBuffer_Release(&self.view) + * elif (<__pyx_buffer *> &self.view).obj == Py_None: # <<<<<<<<<<<<<< + * + * (<__pyx_buffer *> &self.view).obj = NULL +*/ + __pyx_t_1 = (((Py_buffer *)(&__pyx_v_self->view))->obj == Py_None); + if (__pyx_t_1) { + + /* "View.MemoryView":382 + * elif (<__pyx_buffer *> &self.view).obj == Py_None: + * + * (<__pyx_buffer *> &self.view).obj = NULL # <<<<<<<<<<<<<< + * Py_DECREF(Py_None) + * +*/ + ((Py_buffer *)(&__pyx_v_self->view))->obj = NULL; + + /* "View.MemoryView":383 + * + * (<__pyx_buffer *> &self.view).obj = NULL + * Py_DECREF(Py_None) # <<<<<<<<<<<<<< + * + * cdef int i +*/ + Py_DECREF(Py_None); + + /* "View.MemoryView":380 + * if self.obj is not None: + * PyBuffer_Release(&self.view) + * elif (<__pyx_buffer *> &self.view).obj == Py_None: # <<<<<<<<<<<<<< + * + * (<__pyx_buffer *> &self.view).obj = NULL +*/ + } + __pyx_L3:; + + /* "View.MemoryView":387 + * cdef int i + * global __pyx_memoryview_thread_locks_used + * if self.lock != NULL: # <<<<<<<<<<<<<< + * for i in range(0 if __PYX_GET_CYTHON_COMPILING_IN_CPYTHON_FREETHREADING() else __pyx_memoryview_thread_locks_used): + * if __pyx_memoryview_thread_locks[i] is self.lock: +*/ + __pyx_t_1 = (__pyx_v_self->lock != NULL); + if (__pyx_t_1) { + + /* "View.MemoryView":388 + * global __pyx_memoryview_thread_locks_used + * if self.lock != NULL: + * for i in range(0 if __PYX_GET_CYTHON_COMPILING_IN_CPYTHON_FREETHREADING() else __pyx_memoryview_thread_locks_used): # <<<<<<<<<<<<<< + * if __pyx_memoryview_thread_locks[i] is self.lock: + * __pyx_memoryview_thread_locks_used -= 1 +*/ + __pyx_t_1 = __PYX_GET_CYTHON_COMPILING_IN_CPYTHON_FREETHREADING(); + if (__pyx_t_1) { + __pyx_t_2 = 0; + } else { + __pyx_t_2 = __pyx_memoryview_thread_locks_used; + } + __pyx_t_3 = __pyx_t_2; + for (__pyx_t_4 = 0; __pyx_t_4 < __pyx_t_3; __pyx_t_4+=1) { + __pyx_v_i = __pyx_t_4; + + /* "View.MemoryView":389 + * if self.lock != NULL: + * for i in range(0 if __PYX_GET_CYTHON_COMPILING_IN_CPYTHON_FREETHREADING() else __pyx_memoryview_thread_locks_used): + * if __pyx_memoryview_thread_locks[i] is self.lock: # <<<<<<<<<<<<<< + * __pyx_memoryview_thread_locks_used -= 1 + * if i != __pyx_memoryview_thread_locks_used: +*/ + __pyx_t_1 = ((__pyx_memoryview_thread_locks[__pyx_v_i]) == __pyx_v_self->lock); + if (__pyx_t_1) { + + /* "View.MemoryView":390 + * for i in range(0 if __PYX_GET_CYTHON_COMPILING_IN_CPYTHON_FREETHREADING() else __pyx_memoryview_thread_locks_used): + * if __pyx_memoryview_thread_locks[i] is self.lock: + * __pyx_memoryview_thread_locks_used -= 1 # <<<<<<<<<<<<<< + * if i != __pyx_memoryview_thread_locks_used: + * __pyx_memoryview_thread_locks[i], __pyx_memoryview_thread_locks[__pyx_memoryview_thread_locks_used] = ( +*/ + __pyx_memoryview_thread_locks_used = (__pyx_memoryview_thread_locks_used - 1); + + /* "View.MemoryView":391 + * if __pyx_memoryview_thread_locks[i] is self.lock: + * __pyx_memoryview_thread_locks_used -= 1 + * if i != __pyx_memoryview_thread_locks_used: # <<<<<<<<<<<<<< + * __pyx_memoryview_thread_locks[i], __pyx_memoryview_thread_locks[__pyx_memoryview_thread_locks_used] = ( + * __pyx_memoryview_thread_locks[__pyx_memoryview_thread_locks_used], __pyx_memoryview_thread_locks[i]) +*/ + __pyx_t_1 = (__pyx_v_i != __pyx_memoryview_thread_locks_used); + if (__pyx_t_1) { + + /* "View.MemoryView":393 + * if i != __pyx_memoryview_thread_locks_used: + * __pyx_memoryview_thread_locks[i], __pyx_memoryview_thread_locks[__pyx_memoryview_thread_locks_used] = ( + * __pyx_memoryview_thread_locks[__pyx_memoryview_thread_locks_used], __pyx_memoryview_thread_locks[i]) # <<<<<<<<<<<<<< + * break + * else: +*/ + __pyx_t_5 = (__pyx_memoryview_thread_locks[__pyx_memoryview_thread_locks_used]); + __pyx_t_6 = (__pyx_memoryview_thread_locks[__pyx_v_i]); + + /* "View.MemoryView":392 + * __pyx_memoryview_thread_locks_used -= 1 + * if i != __pyx_memoryview_thread_locks_used: + * __pyx_memoryview_thread_locks[i], __pyx_memoryview_thread_locks[__pyx_memoryview_thread_locks_used] = ( # <<<<<<<<<<<<<< + * __pyx_memoryview_thread_locks[__pyx_memoryview_thread_locks_used], __pyx_memoryview_thread_locks[i]) + * break +*/ + (__pyx_memoryview_thread_locks[__pyx_v_i]) = __pyx_t_5; + (__pyx_memoryview_thread_locks[__pyx_memoryview_thread_locks_used]) = __pyx_t_6; + + /* "View.MemoryView":391 + * if __pyx_memoryview_thread_locks[i] is self.lock: + * __pyx_memoryview_thread_locks_used -= 1 + * if i != __pyx_memoryview_thread_locks_used: # <<<<<<<<<<<<<< + * __pyx_memoryview_thread_locks[i], __pyx_memoryview_thread_locks[__pyx_memoryview_thread_locks_used] = ( + * __pyx_memoryview_thread_locks[__pyx_memoryview_thread_locks_used], __pyx_memoryview_thread_locks[i]) +*/ + } + + /* "View.MemoryView":394 + * __pyx_memoryview_thread_locks[i], __pyx_memoryview_thread_locks[__pyx_memoryview_thread_locks_used] = ( + * __pyx_memoryview_thread_locks[__pyx_memoryview_thread_locks_used], __pyx_memoryview_thread_locks[i]) + * break # <<<<<<<<<<<<<< + * else: + * PyThread_free_lock(self.lock) +*/ + goto __pyx_L6_break; + + /* "View.MemoryView":389 + * if self.lock != NULL: + * for i in range(0 if __PYX_GET_CYTHON_COMPILING_IN_CPYTHON_FREETHREADING() else __pyx_memoryview_thread_locks_used): + * if __pyx_memoryview_thread_locks[i] is self.lock: # <<<<<<<<<<<<<< + * __pyx_memoryview_thread_locks_used -= 1 + * if i != __pyx_memoryview_thread_locks_used: +*/ + } + } + /*else*/ { + + /* "View.MemoryView":396 + * break + * else: + * PyThread_free_lock(self.lock) # <<<<<<<<<<<<<< + * + * cdef char *get_item_pointer(memoryview self, object index) except NULL: +*/ + PyThread_free_lock(__pyx_v_self->lock); + } + __pyx_L6_break:; + + /* "View.MemoryView":387 + * cdef int i + * global __pyx_memoryview_thread_locks_used + * if self.lock != NULL: # <<<<<<<<<<<<<< + * for i in range(0 if __PYX_GET_CYTHON_COMPILING_IN_CPYTHON_FREETHREADING() else __pyx_memoryview_thread_locks_used): + * if __pyx_memoryview_thread_locks[i] is self.lock: +*/ + } + + /* "View.MemoryView":377 + * self.typeinfo = NULL + * + * def __dealloc__(memoryview self): # <<<<<<<<<<<<<< + * if self.obj is not None: + * PyBuffer_Release(&self.view) +*/ + + /* function exit code */ +} + +/* "View.MemoryView":398 + * PyThread_free_lock(self.lock) + * + * cdef char *get_item_pointer(memoryview self, object index) except NULL: # <<<<<<<<<<<<<< + * cdef Py_ssize_t dim + * cdef char *itemp = self.view.buf +*/ + +static char *__pyx_memoryview_get_item_pointer(struct __pyx_memoryview_obj *__pyx_v_self, PyObject *__pyx_v_index) { + Py_ssize_t __pyx_v_dim; + char *__pyx_v_itemp; + PyObject *__pyx_v_idx = NULL; + char *__pyx_r; + __Pyx_RefNannyDeclarations + Py_ssize_t __pyx_t_1; + PyObject *__pyx_t_2 = NULL; + Py_ssize_t __pyx_t_3; + PyObject *(*__pyx_t_4)(PyObject *); + PyObject *__pyx_t_5 = NULL; + Py_ssize_t __pyx_t_6; + char *__pyx_t_7; + int __pyx_lineno = 0; + const char *__pyx_filename = NULL; + int __pyx_clineno = 0; + __Pyx_RefNannySetupContext("get_item_pointer", 0); + + /* "View.MemoryView":400 + * cdef char *get_item_pointer(memoryview self, object index) except NULL: + * cdef Py_ssize_t dim + * cdef char *itemp = self.view.buf # <<<<<<<<<<<<<< + * + * for dim, idx in enumerate(index): +*/ + __pyx_v_itemp = ((char *)__pyx_v_self->view.buf); + + /* "View.MemoryView":402 + * cdef char *itemp = self.view.buf + * + * for dim, idx in enumerate(index): # <<<<<<<<<<<<<< + * itemp = pybuffer_index(&self.view, itemp, idx, dim) + * +*/ + __pyx_t_1 = 0; + if (likely(PyList_CheckExact(__pyx_v_index)) || PyTuple_CheckExact(__pyx_v_index)) { + __pyx_t_2 = __pyx_v_index; __Pyx_INCREF(__pyx_t_2); + __pyx_t_3 = 0; + __pyx_t_4 = NULL; + } else { + __pyx_t_3 = -1; __pyx_t_2 = PyObject_GetIter(__pyx_v_index); if (unlikely(!__pyx_t_2)) __PYX_ERR(1, 402, __pyx_L1_error) + __Pyx_GOTREF(__pyx_t_2); + __pyx_t_4 = (CYTHON_COMPILING_IN_LIMITED_API) ? PyIter_Next : __Pyx_PyObject_GetIterNextFunc(__pyx_t_2); if (unlikely(!__pyx_t_4)) __PYX_ERR(1, 402, __pyx_L1_error) + } + for (;;) { + if (likely(!__pyx_t_4)) { + if (likely(PyList_CheckExact(__pyx_t_2))) { + { + Py_ssize_t __pyx_temp = __Pyx_PyList_GET_SIZE(__pyx_t_2); + #if !CYTHON_ASSUME_SAFE_SIZE + if (unlikely((__pyx_temp < 0))) __PYX_ERR(1, 402, __pyx_L1_error) + #endif + if (__pyx_t_3 >= __pyx_temp) break; + } + __pyx_t_5 = __Pyx_PyList_GetItemRefFast(__pyx_t_2, __pyx_t_3, __Pyx_ReferenceSharing_OwnStrongReference); + ++__pyx_t_3; + } else { + { + Py_ssize_t __pyx_temp = __Pyx_PyTuple_GET_SIZE(__pyx_t_2); + #if !CYTHON_ASSUME_SAFE_SIZE + if (unlikely((__pyx_temp < 0))) __PYX_ERR(1, 402, __pyx_L1_error) + #endif + if (__pyx_t_3 >= __pyx_temp) break; + } + #if CYTHON_ASSUME_SAFE_MACROS && !CYTHON_AVOID_BORROWED_REFS + __pyx_t_5 = __Pyx_NewRef(PyTuple_GET_ITEM(__pyx_t_2, __pyx_t_3)); + #else + __pyx_t_5 = __Pyx_PySequence_ITEM(__pyx_t_2, __pyx_t_3); + #endif + ++__pyx_t_3; + } + if (unlikely(!__pyx_t_5)) __PYX_ERR(1, 402, __pyx_L1_error) + } else { + __pyx_t_5 = __pyx_t_4(__pyx_t_2); + if (unlikely(!__pyx_t_5)) { + PyObject* exc_type = PyErr_Occurred(); + if (exc_type) { + if (unlikely(!__Pyx_PyErr_GivenExceptionMatches(exc_type, PyExc_StopIteration))) __PYX_ERR(1, 402, __pyx_L1_error) + PyErr_Clear(); + } + break; + } + } + __Pyx_GOTREF(__pyx_t_5); + __Pyx_XDECREF_SET(__pyx_v_idx, __pyx_t_5); + __pyx_t_5 = 0; + __pyx_v_dim = __pyx_t_1; + __pyx_t_1 = (__pyx_t_1 + 1); + + /* "View.MemoryView":403 + * + * for dim, idx in enumerate(index): + * itemp = pybuffer_index(&self.view, itemp, idx, dim) # <<<<<<<<<<<<<< + * + * return itemp +*/ + __pyx_t_6 = __Pyx_PyIndex_AsSsize_t(__pyx_v_idx); if (unlikely((__pyx_t_6 == (Py_ssize_t)-1) && PyErr_Occurred())) __PYX_ERR(1, 403, __pyx_L1_error) + __pyx_t_7 = __pyx_pybuffer_index((&__pyx_v_self->view), __pyx_v_itemp, __pyx_t_6, __pyx_v_dim); if (unlikely(__pyx_t_7 == ((void *)NULL))) __PYX_ERR(1, 403, __pyx_L1_error) + __pyx_v_itemp = __pyx_t_7; + + /* "View.MemoryView":402 + * cdef char *itemp = self.view.buf + * + * for dim, idx in enumerate(index): # <<<<<<<<<<<<<< + * itemp = pybuffer_index(&self.view, itemp, idx, dim) + * +*/ + } + __Pyx_DECREF(__pyx_t_2); __pyx_t_2 = 0; + + /* "View.MemoryView":405 + * itemp = pybuffer_index(&self.view, itemp, idx, dim) + * + * return itemp # <<<<<<<<<<<<<< + * + * +*/ + __pyx_r = __pyx_v_itemp; + goto __pyx_L0; + + /* "View.MemoryView":398 + * PyThread_free_lock(self.lock) + * + * cdef char *get_item_pointer(memoryview self, object index) except NULL: # <<<<<<<<<<<<<< + * cdef Py_ssize_t dim + * cdef char *itemp = self.view.buf +*/ + + /* function exit code */ + __pyx_L1_error:; + __Pyx_XDECREF(__pyx_t_2); + __Pyx_XDECREF(__pyx_t_5); + __Pyx_AddTraceback("View.MemoryView.memoryview.get_item_pointer", __pyx_clineno, __pyx_lineno, __pyx_filename); + __pyx_r = NULL; + __pyx_L0:; + __Pyx_XDECREF(__pyx_v_idx); + __Pyx_RefNannyFinishContext(); + return __pyx_r; +} + +/* "View.MemoryView":408 + * + * + * def __getitem__(memoryview self, object index): # <<<<<<<<<<<<<< + * if index is Ellipsis: + * return self +*/ + +/* Python wrapper */ +static PyObject *__pyx_memoryview___getitem__(PyObject *__pyx_v_self, PyObject *__pyx_v_index); /*proto*/ +static PyObject *__pyx_memoryview___getitem__(PyObject *__pyx_v_self, PyObject *__pyx_v_index) { + CYTHON_UNUSED PyObject *const *__pyx_kwvalues; + PyObject *__pyx_r = 0; + __Pyx_RefNannyDeclarations + __Pyx_RefNannySetupContext("__getitem__ (wrapper)", 0); + __pyx_kwvalues = __Pyx_KwValues_VARARGS(__pyx_args, __pyx_nargs); + __pyx_r = __pyx_memoryview___pyx_pf_15View_dot_MemoryView_10memoryview_4__getitem__(((struct __pyx_memoryview_obj *)__pyx_v_self), ((PyObject *)__pyx_v_index)); + + /* function exit code */ + __Pyx_RefNannyFinishContext(); + return __pyx_r; +} + +static PyObject *__pyx_memoryview___pyx_pf_15View_dot_MemoryView_10memoryview_4__getitem__(struct __pyx_memoryview_obj *__pyx_v_self, PyObject *__pyx_v_index) { + PyObject *__pyx_v_have_slices = NULL; + PyObject *__pyx_v_indices = NULL; + char *__pyx_v_itemp; + 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; + char *__pyx_t_5; + int __pyx_lineno = 0; + const char *__pyx_filename = NULL; + int __pyx_clineno = 0; + __Pyx_RefNannySetupContext("__getitem__", 0); + + /* "View.MemoryView":409 + * + * def __getitem__(memoryview self, object index): + * if index is Ellipsis: # <<<<<<<<<<<<<< + * return self + * +*/ + __pyx_t_1 = (__pyx_v_index == __pyx_builtin_Ellipsis); + if (__pyx_t_1) { + + /* "View.MemoryView":410 + * def __getitem__(memoryview self, object index): + * if index is Ellipsis: + * return self # <<<<<<<<<<<<<< + * + * have_slices, indices = _unellipsify(index, self.view.ndim) +*/ + __Pyx_XDECREF(__pyx_r); + __Pyx_INCREF((PyObject *)__pyx_v_self); + __pyx_r = ((PyObject *)__pyx_v_self); + goto __pyx_L0; + + /* "View.MemoryView":409 + * + * def __getitem__(memoryview self, object index): + * if index is Ellipsis: # <<<<<<<<<<<<<< + * return self + * +*/ + } + + /* "View.MemoryView":412 + * return self + * + * have_slices, indices = _unellipsify(index, self.view.ndim) # <<<<<<<<<<<<<< + * + * cdef char *itemp +*/ + __pyx_t_2 = _unellipsify(__pyx_v_index, __pyx_v_self->view.ndim); if (unlikely(!__pyx_t_2)) __PYX_ERR(1, 412, __pyx_L1_error) + __Pyx_GOTREF(__pyx_t_2); + if (likely(__pyx_t_2 != Py_None)) { + PyObject* sequence = __pyx_t_2; + Py_ssize_t size = __Pyx_PyTuple_GET_SIZE(sequence); + if (unlikely(size != 2)) { + if (size > 2) __Pyx_RaiseTooManyValuesError(2); + else if (size >= 0) __Pyx_RaiseNeedMoreValuesError(size); + __PYX_ERR(1, 412, __pyx_L1_error) + } + #if CYTHON_ASSUME_SAFE_MACROS && !CYTHON_AVOID_BORROWED_REFS + __pyx_t_3 = PyTuple_GET_ITEM(sequence, 0); + __Pyx_INCREF(__pyx_t_3); + __pyx_t_4 = PyTuple_GET_ITEM(sequence, 1); + __Pyx_INCREF(__pyx_t_4); + #else + __pyx_t_3 = __Pyx_PySequence_ITEM(sequence, 0); if (unlikely(!__pyx_t_3)) __PYX_ERR(1, 412, __pyx_L1_error) + __Pyx_GOTREF(__pyx_t_3); + __pyx_t_4 = __Pyx_PySequence_ITEM(sequence, 1); if (unlikely(!__pyx_t_4)) __PYX_ERR(1, 412, __pyx_L1_error) + __Pyx_GOTREF(__pyx_t_4); + #endif + __Pyx_DECREF(__pyx_t_2); __pyx_t_2 = 0; + } else { + __Pyx_RaiseNoneNotIterableError(); __PYX_ERR(1, 412, __pyx_L1_error) + } + __pyx_v_have_slices = __pyx_t_3; + __pyx_t_3 = 0; + __pyx_v_indices = __pyx_t_4; + __pyx_t_4 = 0; + + /* "View.MemoryView":415 + * + * cdef char *itemp + * if have_slices: # <<<<<<<<<<<<<< + * return memview_slice(self, indices) + * else: +*/ + __pyx_t_1 = __Pyx_PyObject_IsTrue(__pyx_v_have_slices); if (unlikely((__pyx_t_1 < 0))) __PYX_ERR(1, 415, __pyx_L1_error) + if (__pyx_t_1) { + + /* "View.MemoryView":416 + * cdef char *itemp + * if have_slices: + * return memview_slice(self, indices) # <<<<<<<<<<<<<< + * else: + * itemp = self.get_item_pointer(indices) +*/ + __Pyx_XDECREF(__pyx_r); + __pyx_t_2 = ((PyObject *)__pyx_memview_slice(__pyx_v_self, __pyx_v_indices)); if (unlikely(!__pyx_t_2)) __PYX_ERR(1, 416, __pyx_L1_error) + __Pyx_GOTREF(__pyx_t_2); + __pyx_r = __pyx_t_2; + __pyx_t_2 = 0; + goto __pyx_L0; + + /* "View.MemoryView":415 + * + * cdef char *itemp + * if have_slices: # <<<<<<<<<<<<<< + * return memview_slice(self, indices) + * else: +*/ + } + + /* "View.MemoryView":418 + * return memview_slice(self, indices) + * else: + * itemp = self.get_item_pointer(indices) # <<<<<<<<<<<<<< + * return self.convert_item_to_object(itemp) + * +*/ + /*else*/ { + __pyx_t_5 = ((struct __pyx_vtabstruct_memoryview *)__pyx_v_self->__pyx_vtab)->get_item_pointer(__pyx_v_self, __pyx_v_indices); if (unlikely(__pyx_t_5 == ((void *)NULL))) __PYX_ERR(1, 418, __pyx_L1_error) + __pyx_v_itemp = __pyx_t_5; + + /* "View.MemoryView":419 + * else: + * itemp = self.get_item_pointer(indices) + * return self.convert_item_to_object(itemp) # <<<<<<<<<<<<<< + * + * def __setitem__(memoryview self, object index, object value): +*/ + __Pyx_XDECREF(__pyx_r); + __pyx_t_2 = ((struct __pyx_vtabstruct_memoryview *)__pyx_v_self->__pyx_vtab)->convert_item_to_object(__pyx_v_self, __pyx_v_itemp); if (unlikely(!__pyx_t_2)) __PYX_ERR(1, 419, __pyx_L1_error) + __Pyx_GOTREF(__pyx_t_2); + __pyx_r = __pyx_t_2; + __pyx_t_2 = 0; + goto __pyx_L0; + } + + /* "View.MemoryView":408 + * + * + * def __getitem__(memoryview self, object index): # <<<<<<<<<<<<<< + * if index is Ellipsis: + * return self +*/ + + /* function exit code */ + __pyx_L1_error:; + __Pyx_XDECREF(__pyx_t_2); + __Pyx_XDECREF(__pyx_t_3); + __Pyx_XDECREF(__pyx_t_4); + __Pyx_AddTraceback("View.MemoryView.memoryview.__getitem__", __pyx_clineno, __pyx_lineno, __pyx_filename); + __pyx_r = NULL; + __pyx_L0:; + __Pyx_XDECREF(__pyx_v_have_slices); + __Pyx_XDECREF(__pyx_v_indices); + __Pyx_XGIVEREF(__pyx_r); + __Pyx_RefNannyFinishContext(); + return __pyx_r; +} + +/* "View.MemoryView":421 + * return self.convert_item_to_object(itemp) + * + * def __setitem__(memoryview self, object index, object value): # <<<<<<<<<<<<<< + * if self.view.readonly: + * raise TypeError, "Cannot assign to read-only memoryview" +*/ + +/* Python wrapper */ +static int __pyx_memoryview___setitem__(PyObject *__pyx_v_self, PyObject *__pyx_v_index, PyObject *__pyx_v_value); /*proto*/ +static int __pyx_memoryview___setitem__(PyObject *__pyx_v_self, PyObject *__pyx_v_index, PyObject *__pyx_v_value) { + CYTHON_UNUSED PyObject *const *__pyx_kwvalues; + int __pyx_r; + __Pyx_RefNannyDeclarations + __Pyx_RefNannySetupContext("__setitem__ (wrapper)", 0); + __pyx_kwvalues = __Pyx_KwValues_VARARGS(__pyx_args, __pyx_nargs); + __pyx_r = __pyx_memoryview___pyx_pf_15View_dot_MemoryView_10memoryview_6__setitem__(((struct __pyx_memoryview_obj *)__pyx_v_self), ((PyObject *)__pyx_v_index), ((PyObject *)__pyx_v_value)); + + /* function exit code */ + __Pyx_RefNannyFinishContext(); + return __pyx_r; +} + +static int __pyx_memoryview___pyx_pf_15View_dot_MemoryView_10memoryview_6__setitem__(struct __pyx_memoryview_obj *__pyx_v_self, PyObject *__pyx_v_index, PyObject *__pyx_v_value) { + PyObject *__pyx_v_have_slices = NULL; + PyObject *__pyx_v_obj = NULL; + int __pyx_r; + __Pyx_RefNannyDeclarations + PyObject *__pyx_t_1 = NULL; + PyObject *__pyx_t_2 = NULL; + PyObject *__pyx_t_3 = NULL; + int __pyx_t_4; + int __pyx_lineno = 0; + const char *__pyx_filename = NULL; + int __pyx_clineno = 0; + __Pyx_RefNannySetupContext("__setitem__", 0); + __Pyx_INCREF(__pyx_v_index); + + /* "View.MemoryView":422 + * + * def __setitem__(memoryview self, object index, object value): + * if self.view.readonly: # <<<<<<<<<<<<<< + * raise TypeError, "Cannot assign to read-only memoryview" + * +*/ + if (unlikely(__pyx_v_self->view.readonly)) { + + /* "View.MemoryView":423 + * def __setitem__(memoryview self, object index, object value): + * if self.view.readonly: + * raise TypeError, "Cannot assign to read-only memoryview" # <<<<<<<<<<<<<< + * + * have_slices, index = _unellipsify(index, self.view.ndim) +*/ + __Pyx_Raise(((PyObject *)(((PyTypeObject*)PyExc_TypeError))), __pyx_mstate_global->__pyx_kp_u_Cannot_assign_to_read_only_memor, 0, 0); + __PYX_ERR(1, 423, __pyx_L1_error) + + /* "View.MemoryView":422 + * + * def __setitem__(memoryview self, object index, object value): + * if self.view.readonly: # <<<<<<<<<<<<<< + * raise TypeError, "Cannot assign to read-only memoryview" + * +*/ + } + + /* "View.MemoryView":425 + * raise TypeError, "Cannot assign to read-only memoryview" + * + * have_slices, index = _unellipsify(index, self.view.ndim) # <<<<<<<<<<<<<< + * + * if have_slices: +*/ + __pyx_t_1 = _unellipsify(__pyx_v_index, __pyx_v_self->view.ndim); if (unlikely(!__pyx_t_1)) __PYX_ERR(1, 425, __pyx_L1_error) + __Pyx_GOTREF(__pyx_t_1); + if (likely(__pyx_t_1 != Py_None)) { + PyObject* sequence = __pyx_t_1; + Py_ssize_t size = __Pyx_PyTuple_GET_SIZE(sequence); + if (unlikely(size != 2)) { + if (size > 2) __Pyx_RaiseTooManyValuesError(2); + else if (size >= 0) __Pyx_RaiseNeedMoreValuesError(size); + __PYX_ERR(1, 425, __pyx_L1_error) + } + #if CYTHON_ASSUME_SAFE_MACROS && !CYTHON_AVOID_BORROWED_REFS + __pyx_t_2 = PyTuple_GET_ITEM(sequence, 0); + __Pyx_INCREF(__pyx_t_2); + __pyx_t_3 = PyTuple_GET_ITEM(sequence, 1); + __Pyx_INCREF(__pyx_t_3); + #else + __pyx_t_2 = __Pyx_PySequence_ITEM(sequence, 0); if (unlikely(!__pyx_t_2)) __PYX_ERR(1, 425, __pyx_L1_error) + __Pyx_GOTREF(__pyx_t_2); + __pyx_t_3 = __Pyx_PySequence_ITEM(sequence, 1); if (unlikely(!__pyx_t_3)) __PYX_ERR(1, 425, __pyx_L1_error) + __Pyx_GOTREF(__pyx_t_3); + #endif + __Pyx_DECREF(__pyx_t_1); __pyx_t_1 = 0; + } else { + __Pyx_RaiseNoneNotIterableError(); __PYX_ERR(1, 425, __pyx_L1_error) + } + __pyx_v_have_slices = __pyx_t_2; + __pyx_t_2 = 0; + __Pyx_DECREF_SET(__pyx_v_index, __pyx_t_3); + __pyx_t_3 = 0; + + /* "View.MemoryView":427 + * have_slices, index = _unellipsify(index, self.view.ndim) + * + * if have_slices: # <<<<<<<<<<<<<< + * obj = self.is_slice(value) + * if obj is not None: +*/ + __pyx_t_4 = __Pyx_PyObject_IsTrue(__pyx_v_have_slices); if (unlikely((__pyx_t_4 < 0))) __PYX_ERR(1, 427, __pyx_L1_error) + if (__pyx_t_4) { + + /* "View.MemoryView":428 + * + * if have_slices: + * obj = self.is_slice(value) # <<<<<<<<<<<<<< + * if obj is not None: + * self.setitem_slice_assignment(self[index], obj) +*/ + __pyx_t_1 = ((struct __pyx_vtabstruct_memoryview *)__pyx_v_self->__pyx_vtab)->is_slice(__pyx_v_self, __pyx_v_value); if (unlikely(!__pyx_t_1)) __PYX_ERR(1, 428, __pyx_L1_error) + __Pyx_GOTREF(__pyx_t_1); + __pyx_v_obj = __pyx_t_1; + __pyx_t_1 = 0; + + /* "View.MemoryView":429 + * if have_slices: + * obj = self.is_slice(value) + * if obj is not None: # <<<<<<<<<<<<<< + * self.setitem_slice_assignment(self[index], obj) + * else: +*/ + __pyx_t_4 = (__pyx_v_obj != Py_None); + if (__pyx_t_4) { + + /* "View.MemoryView":430 + * obj = self.is_slice(value) + * if obj is not None: + * self.setitem_slice_assignment(self[index], obj) # <<<<<<<<<<<<<< + * else: + * self.setitem_slice_assign_scalar(self[index], value) +*/ + __pyx_t_1 = __Pyx_PyObject_GetItem(((PyObject *)__pyx_v_self), __pyx_v_index); if (unlikely(!__pyx_t_1)) __PYX_ERR(1, 430, __pyx_L1_error) + __Pyx_GOTREF(__pyx_t_1); + __pyx_t_3 = ((struct __pyx_vtabstruct_memoryview *)__pyx_v_self->__pyx_vtab)->setitem_slice_assignment(__pyx_v_self, __pyx_t_1, __pyx_v_obj); if (unlikely(!__pyx_t_3)) __PYX_ERR(1, 430, __pyx_L1_error) + __Pyx_GOTREF(__pyx_t_3); + __Pyx_DECREF(__pyx_t_1); __pyx_t_1 = 0; + __Pyx_DECREF(__pyx_t_3); __pyx_t_3 = 0; + + /* "View.MemoryView":429 + * if have_slices: + * obj = self.is_slice(value) + * if obj is not None: # <<<<<<<<<<<<<< + * self.setitem_slice_assignment(self[index], obj) + * else: +*/ + goto __pyx_L5; + } + + /* "View.MemoryView":432 + * self.setitem_slice_assignment(self[index], obj) + * else: + * self.setitem_slice_assign_scalar(self[index], value) # <<<<<<<<<<<<<< + * else: + * self.setitem_indexed(index, value) +*/ + /*else*/ { + __pyx_t_3 = __Pyx_PyObject_GetItem(((PyObject *)__pyx_v_self), __pyx_v_index); if (unlikely(!__pyx_t_3)) __PYX_ERR(1, 432, __pyx_L1_error) + __Pyx_GOTREF(__pyx_t_3); + if (!(likely(((__pyx_t_3) == Py_None) || likely(__Pyx_TypeTest(__pyx_t_3, __pyx_mstate_global->__pyx_memoryview_type))))) __PYX_ERR(1, 432, __pyx_L1_error) + __pyx_t_1 = ((struct __pyx_vtabstruct_memoryview *)__pyx_v_self->__pyx_vtab)->setitem_slice_assign_scalar(__pyx_v_self, ((struct __pyx_memoryview_obj *)__pyx_t_3), __pyx_v_value); if (unlikely(!__pyx_t_1)) __PYX_ERR(1, 432, __pyx_L1_error) + __Pyx_GOTREF(__pyx_t_1); + __Pyx_DECREF(__pyx_t_3); __pyx_t_3 = 0; + __Pyx_DECREF(__pyx_t_1); __pyx_t_1 = 0; + } + __pyx_L5:; + + /* "View.MemoryView":427 + * have_slices, index = _unellipsify(index, self.view.ndim) + * + * if have_slices: # <<<<<<<<<<<<<< + * obj = self.is_slice(value) + * if obj is not None: +*/ + goto __pyx_L4; + } + + /* "View.MemoryView":434 + * self.setitem_slice_assign_scalar(self[index], value) + * else: + * self.setitem_indexed(index, value) # <<<<<<<<<<<<<< + * + * cdef is_slice(self, obj): +*/ + /*else*/ { + __pyx_t_1 = ((struct __pyx_vtabstruct_memoryview *)__pyx_v_self->__pyx_vtab)->setitem_indexed(__pyx_v_self, __pyx_v_index, __pyx_v_value); if (unlikely(!__pyx_t_1)) __PYX_ERR(1, 434, __pyx_L1_error) + __Pyx_GOTREF(__pyx_t_1); + __Pyx_DECREF(__pyx_t_1); __pyx_t_1 = 0; + } + __pyx_L4:; + + /* "View.MemoryView":421 + * return self.convert_item_to_object(itemp) + * + * def __setitem__(memoryview self, object index, object value): # <<<<<<<<<<<<<< + * if self.view.readonly: + * raise TypeError, "Cannot assign to read-only memoryview" +*/ + + /* function exit code */ + __pyx_r = 0; + goto __pyx_L0; + __pyx_L1_error:; + __Pyx_XDECREF(__pyx_t_1); + __Pyx_XDECREF(__pyx_t_2); + __Pyx_XDECREF(__pyx_t_3); + __Pyx_AddTraceback("View.MemoryView.memoryview.__setitem__", __pyx_clineno, __pyx_lineno, __pyx_filename); + __pyx_r = -1; + __pyx_L0:; + __Pyx_XDECREF(__pyx_v_have_slices); + __Pyx_XDECREF(__pyx_v_obj); + __Pyx_XDECREF(__pyx_v_index); + __Pyx_RefNannyFinishContext(); + return __pyx_r; +} + +/* "View.MemoryView":436 + * self.setitem_indexed(index, value) + * + * cdef is_slice(self, obj): # <<<<<<<<<<<<<< + * if not isinstance(obj, memoryview): + * try: +*/ + +static PyObject *__pyx_memoryview_is_slice(struct __pyx_memoryview_obj *__pyx_v_self, PyObject *__pyx_v_obj) { + PyObject *__pyx_r = NULL; + __Pyx_RefNannyDeclarations + int __pyx_t_1; + int __pyx_t_2; + PyObject *__pyx_t_3 = NULL; + PyObject *__pyx_t_4 = NULL; + PyObject *__pyx_t_5 = NULL; + PyObject *__pyx_t_6 = NULL; + PyObject *__pyx_t_7 = NULL; + PyObject *__pyx_t_8 = NULL; + PyObject *__pyx_t_9 = NULL; + size_t __pyx_t_10; + int __pyx_t_11; + int __pyx_lineno = 0; + const char *__pyx_filename = NULL; + int __pyx_clineno = 0; + __Pyx_RefNannySetupContext("is_slice", 0); + __Pyx_INCREF(__pyx_v_obj); + + /* "View.MemoryView":437 + * + * cdef is_slice(self, obj): + * if not isinstance(obj, memoryview): # <<<<<<<<<<<<<< + * try: + * obj = memoryview(obj, self.flags & ~PyBUF_WRITABLE | PyBUF_ANY_CONTIGUOUS, +*/ + __pyx_t_1 = __Pyx_TypeCheck(__pyx_v_obj, __pyx_mstate_global->__pyx_memoryview_type); + __pyx_t_2 = (!__pyx_t_1); + if (__pyx_t_2) { + + /* "View.MemoryView":438 + * cdef is_slice(self, obj): + * if not isinstance(obj, memoryview): + * try: # <<<<<<<<<<<<<< + * obj = memoryview(obj, self.flags & ~PyBUF_WRITABLE | PyBUF_ANY_CONTIGUOUS, + * self.dtype_is_object) +*/ + { + __Pyx_PyThreadState_declare + __Pyx_PyThreadState_assign + __Pyx_ExceptionSave(&__pyx_t_3, &__pyx_t_4, &__pyx_t_5); + __Pyx_XGOTREF(__pyx_t_3); + __Pyx_XGOTREF(__pyx_t_4); + __Pyx_XGOTREF(__pyx_t_5); + /*try:*/ { + + /* "View.MemoryView":439 + * if not isinstance(obj, memoryview): + * try: + * obj = memoryview(obj, self.flags & ~PyBUF_WRITABLE | PyBUF_ANY_CONTIGUOUS, # <<<<<<<<<<<<<< + * self.dtype_is_object) + * except TypeError: +*/ + __pyx_t_7 = NULL; + __pyx_t_8 = __Pyx_PyLong_From_int(((__pyx_v_self->flags & (~PyBUF_WRITABLE)) | PyBUF_ANY_CONTIGUOUS)); if (unlikely(!__pyx_t_8)) __PYX_ERR(1, 439, __pyx_L4_error) + __Pyx_GOTREF(__pyx_t_8); + + /* "View.MemoryView":440 + * try: + * obj = memoryview(obj, self.flags & ~PyBUF_WRITABLE | PyBUF_ANY_CONTIGUOUS, + * self.dtype_is_object) # <<<<<<<<<<<<<< + * except TypeError: + * return None +*/ + __pyx_t_9 = __Pyx_PyBool_FromLong(__pyx_v_self->dtype_is_object); if (unlikely(!__pyx_t_9)) __PYX_ERR(1, 440, __pyx_L4_error) + __Pyx_GOTREF(__pyx_t_9); + __pyx_t_10 = 1; + { + PyObject *__pyx_callargs[4] = {__pyx_t_7, __pyx_v_obj, __pyx_t_8, __pyx_t_9}; + __pyx_t_6 = __Pyx_PyObject_FastCall((PyObject*)__pyx_mstate_global->__pyx_memoryview_type, __pyx_callargs+__pyx_t_10, (4-__pyx_t_10) | (__pyx_t_10*__Pyx_PY_VECTORCALL_ARGUMENTS_OFFSET)); + __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; + if (unlikely(!__pyx_t_6)) __PYX_ERR(1, 439, __pyx_L4_error) + __Pyx_GOTREF((PyObject *)__pyx_t_6); + } + __Pyx_DECREF_SET(__pyx_v_obj, ((PyObject *)__pyx_t_6)); + __pyx_t_6 = 0; + + /* "View.MemoryView":438 + * cdef is_slice(self, obj): + * if not isinstance(obj, memoryview): + * try: # <<<<<<<<<<<<<< + * obj = memoryview(obj, self.flags & ~PyBUF_WRITABLE | PyBUF_ANY_CONTIGUOUS, + * self.dtype_is_object) +*/ + } + __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; + goto __pyx_L9_try_end; + __pyx_L4_error:; + __Pyx_XDECREF(__pyx_t_6); __pyx_t_6 = 0; + __Pyx_XDECREF(__pyx_t_7); __pyx_t_7 = 0; + __Pyx_XDECREF(__pyx_t_8); __pyx_t_8 = 0; + __Pyx_XDECREF(__pyx_t_9); __pyx_t_9 = 0; + + /* "View.MemoryView":441 + * obj = memoryview(obj, self.flags & ~PyBUF_WRITABLE | PyBUF_ANY_CONTIGUOUS, + * self.dtype_is_object) + * except TypeError: # <<<<<<<<<<<<<< + * return None + * +*/ + __pyx_t_11 = __Pyx_PyErr_ExceptionMatches(((PyObject *)(((PyTypeObject*)PyExc_TypeError)))); + if (__pyx_t_11) { + __Pyx_ErrRestore(0,0,0); + + /* "View.MemoryView":442 + * self.dtype_is_object) + * except TypeError: + * return None # <<<<<<<<<<<<<< + * + * return obj +*/ + __Pyx_XDECREF(__pyx_r); + __pyx_r = Py_None; __Pyx_INCREF(Py_None); + goto __pyx_L7_except_return; + } + goto __pyx_L6_except_error; + + /* "View.MemoryView":438 + * cdef is_slice(self, obj): + * if not isinstance(obj, memoryview): + * try: # <<<<<<<<<<<<<< + * obj = memoryview(obj, self.flags & ~PyBUF_WRITABLE | PyBUF_ANY_CONTIGUOUS, + * self.dtype_is_object) +*/ + __pyx_L6_except_error:; + __Pyx_XGIVEREF(__pyx_t_3); + __Pyx_XGIVEREF(__pyx_t_4); + __Pyx_XGIVEREF(__pyx_t_5); + __Pyx_ExceptionReset(__pyx_t_3, __pyx_t_4, __pyx_t_5); + goto __pyx_L1_error; + __pyx_L7_except_return:; + __Pyx_XGIVEREF(__pyx_t_3); + __Pyx_XGIVEREF(__pyx_t_4); + __Pyx_XGIVEREF(__pyx_t_5); + __Pyx_ExceptionReset(__pyx_t_3, __pyx_t_4, __pyx_t_5); + goto __pyx_L0; + __pyx_L9_try_end:; + } + + /* "View.MemoryView":437 + * + * cdef is_slice(self, obj): + * if not isinstance(obj, memoryview): # <<<<<<<<<<<<<< + * try: + * obj = memoryview(obj, self.flags & ~PyBUF_WRITABLE | PyBUF_ANY_CONTIGUOUS, +*/ + } + + /* "View.MemoryView":444 + * return None + * + * return obj # <<<<<<<<<<<<<< + * + * cdef setitem_slice_assignment(self, dst, src): +*/ + __Pyx_XDECREF(__pyx_r); + __Pyx_INCREF(__pyx_v_obj); + __pyx_r = __pyx_v_obj; + goto __pyx_L0; + + /* "View.MemoryView":436 + * self.setitem_indexed(index, value) + * + * cdef is_slice(self, obj): # <<<<<<<<<<<<<< + * if not isinstance(obj, memoryview): + * try: +*/ + + /* function exit code */ + __pyx_L1_error:; + __Pyx_XDECREF(__pyx_t_6); + __Pyx_XDECREF(__pyx_t_7); + __Pyx_XDECREF(__pyx_t_8); + __Pyx_XDECREF(__pyx_t_9); + __Pyx_AddTraceback("View.MemoryView.memoryview.is_slice", __pyx_clineno, __pyx_lineno, __pyx_filename); + __pyx_r = 0; + __pyx_L0:; + __Pyx_XDECREF(__pyx_v_obj); + __Pyx_XGIVEREF(__pyx_r); + __Pyx_RefNannyFinishContext(); + return __pyx_r; +} + +/* "View.MemoryView":446 + * return obj + * + * cdef setitem_slice_assignment(self, dst, src): # <<<<<<<<<<<<<< + * cdef __Pyx_memviewslice dst_slice + * cdef __Pyx_memviewslice src_slice +*/ + +static PyObject *__pyx_memoryview_setitem_slice_assignment(struct __pyx_memoryview_obj *__pyx_v_self, PyObject *__pyx_v_dst, PyObject *__pyx_v_src) { + __Pyx_memviewslice __pyx_v_dst_slice; + __Pyx_memviewslice __pyx_v_src_slice; + __Pyx_memviewslice __pyx_v_msrc; + __Pyx_memviewslice __pyx_v_mdst; + PyObject *__pyx_r = NULL; + __Pyx_RefNannyDeclarations + __Pyx_memviewslice *__pyx_t_1; + PyObject *__pyx_t_2 = NULL; + int __pyx_t_3; + int __pyx_t_4; + int __pyx_t_5; + int __pyx_lineno = 0; + const char *__pyx_filename = NULL; + int __pyx_clineno = 0; + __Pyx_RefNannySetupContext("setitem_slice_assignment", 0); + + /* "View.MemoryView":449 + * cdef __Pyx_memviewslice dst_slice + * cdef __Pyx_memviewslice src_slice + * cdef __Pyx_memviewslice msrc = get_slice_from_memview(src, &src_slice)[0] # <<<<<<<<<<<<<< + * cdef __Pyx_memviewslice mdst = get_slice_from_memview(dst, &dst_slice)[0] + * +*/ + if (!(likely(((__pyx_v_src) == Py_None) || likely(__Pyx_TypeTest(__pyx_v_src, __pyx_mstate_global->__pyx_memoryview_type))))) __PYX_ERR(1, 449, __pyx_L1_error) + __pyx_t_1 = __pyx_memoryview_get_slice_from_memoryview(((struct __pyx_memoryview_obj *)__pyx_v_src), (&__pyx_v_src_slice)); if (unlikely(__pyx_t_1 == ((void *)NULL))) __PYX_ERR(1, 449, __pyx_L1_error) + __pyx_v_msrc = (__pyx_t_1[0]); + + /* "View.MemoryView":450 + * cdef __Pyx_memviewslice src_slice + * cdef __Pyx_memviewslice msrc = get_slice_from_memview(src, &src_slice)[0] + * cdef __Pyx_memviewslice mdst = get_slice_from_memview(dst, &dst_slice)[0] # <<<<<<<<<<<<<< + * + * memoryview_copy_contents(msrc, mdst, src.ndim, dst.ndim, self.dtype_is_object) +*/ + if (!(likely(((__pyx_v_dst) == Py_None) || likely(__Pyx_TypeTest(__pyx_v_dst, __pyx_mstate_global->__pyx_memoryview_type))))) __PYX_ERR(1, 450, __pyx_L1_error) + __pyx_t_1 = __pyx_memoryview_get_slice_from_memoryview(((struct __pyx_memoryview_obj *)__pyx_v_dst), (&__pyx_v_dst_slice)); if (unlikely(__pyx_t_1 == ((void *)NULL))) __PYX_ERR(1, 450, __pyx_L1_error) + __pyx_v_mdst = (__pyx_t_1[0]); + + /* "View.MemoryView":452 + * cdef __Pyx_memviewslice mdst = get_slice_from_memview(dst, &dst_slice)[0] + * + * memoryview_copy_contents(msrc, mdst, src.ndim, dst.ndim, self.dtype_is_object) # <<<<<<<<<<<<<< + * + * cdef setitem_slice_assign_scalar(self, memoryview dst, value): +*/ + __pyx_t_2 = __Pyx_PyObject_GetAttrStr(__pyx_v_src, __pyx_mstate_global->__pyx_n_u_ndim); if (unlikely(!__pyx_t_2)) __PYX_ERR(1, 452, __pyx_L1_error) + __Pyx_GOTREF(__pyx_t_2); + __pyx_t_3 = __Pyx_PyLong_As_int(__pyx_t_2); if (unlikely((__pyx_t_3 == (int)-1) && PyErr_Occurred())) __PYX_ERR(1, 452, __pyx_L1_error) + __Pyx_DECREF(__pyx_t_2); __pyx_t_2 = 0; + __pyx_t_2 = __Pyx_PyObject_GetAttrStr(__pyx_v_dst, __pyx_mstate_global->__pyx_n_u_ndim); if (unlikely(!__pyx_t_2)) __PYX_ERR(1, 452, __pyx_L1_error) + __Pyx_GOTREF(__pyx_t_2); + __pyx_t_4 = __Pyx_PyLong_As_int(__pyx_t_2); if (unlikely((__pyx_t_4 == (int)-1) && PyErr_Occurred())) __PYX_ERR(1, 452, __pyx_L1_error) + __Pyx_DECREF(__pyx_t_2); __pyx_t_2 = 0; + __pyx_t_5 = __pyx_memoryview_copy_contents(__pyx_v_msrc, __pyx_v_mdst, __pyx_t_3, __pyx_t_4, __pyx_v_self->dtype_is_object); if (unlikely(__pyx_t_5 == ((int)-1))) __PYX_ERR(1, 452, __pyx_L1_error) + + /* "View.MemoryView":446 + * return obj + * + * cdef setitem_slice_assignment(self, dst, src): # <<<<<<<<<<<<<< + * cdef __Pyx_memviewslice dst_slice + * cdef __Pyx_memviewslice src_slice +*/ + + /* function exit code */ + __pyx_r = Py_None; __Pyx_INCREF(Py_None); + goto __pyx_L0; + __pyx_L1_error:; + __Pyx_XDECREF(__pyx_t_2); + __Pyx_AddTraceback("View.MemoryView.memoryview.setitem_slice_assignment", __pyx_clineno, __pyx_lineno, __pyx_filename); + __pyx_r = 0; + __pyx_L0:; + __Pyx_XGIVEREF(__pyx_r); + __Pyx_RefNannyFinishContext(); + return __pyx_r; +} + +/* "View.MemoryView":454 + * memoryview_copy_contents(msrc, mdst, src.ndim, dst.ndim, self.dtype_is_object) + * + * cdef setitem_slice_assign_scalar(self, memoryview dst, value): # <<<<<<<<<<<<<< + * cdef int array[128] + * cdef void *tmp = NULL +*/ + +static PyObject *__pyx_memoryview_setitem_slice_assign_scalar(struct __pyx_memoryview_obj *__pyx_v_self, struct __pyx_memoryview_obj *__pyx_v_dst, PyObject *__pyx_v_value) { + int __pyx_v_array[128]; + void *__pyx_v_tmp; + void *__pyx_v_item; + __Pyx_memviewslice *__pyx_v_dst_slice; + __Pyx_memviewslice __pyx_v_tmp_slice; + PyObject *__pyx_r = NULL; + __Pyx_RefNannyDeclarations + __Pyx_memviewslice *__pyx_t_1; + int __pyx_t_2; + PyObject *__pyx_t_3 = NULL; + int __pyx_t_4; + int __pyx_t_5; + char const *__pyx_t_6; + PyObject *__pyx_t_7 = NULL; + PyObject *__pyx_t_8 = NULL; + PyObject *__pyx_t_9 = NULL; + PyObject *__pyx_t_10 = NULL; + PyObject *__pyx_t_11 = NULL; + PyObject *__pyx_t_12 = NULL; + int __pyx_lineno = 0; + const char *__pyx_filename = NULL; + int __pyx_clineno = 0; + __Pyx_RefNannySetupContext("setitem_slice_assign_scalar", 0); + + /* "View.MemoryView":456 + * cdef setitem_slice_assign_scalar(self, memoryview dst, value): + * cdef int array[128] + * cdef void *tmp = NULL # <<<<<<<<<<<<<< + * cdef void *item + * +*/ + __pyx_v_tmp = NULL; + + /* "View.MemoryView":461 + * cdef __Pyx_memviewslice *dst_slice + * cdef __Pyx_memviewslice tmp_slice + * dst_slice = get_slice_from_memview(dst, &tmp_slice) # <<<<<<<<<<<<<< + * + * if self.view.itemsize > sizeof(array): +*/ + __pyx_t_1 = __pyx_memoryview_get_slice_from_memoryview(__pyx_v_dst, (&__pyx_v_tmp_slice)); if (unlikely(__pyx_t_1 == ((void *)NULL))) __PYX_ERR(1, 461, __pyx_L1_error) + __pyx_v_dst_slice = __pyx_t_1; + + /* "View.MemoryView":463 + * dst_slice = get_slice_from_memview(dst, &tmp_slice) + * + * if self.view.itemsize > sizeof(array): # <<<<<<<<<<<<<< + * tmp = PyMem_Malloc(self.view.itemsize) + * if tmp == NULL: +*/ + __pyx_t_2 = (((size_t)__pyx_v_self->view.itemsize) > (sizeof(__pyx_v_array))); + if (__pyx_t_2) { + + /* "View.MemoryView":464 + * + * if self.view.itemsize > sizeof(array): + * tmp = PyMem_Malloc(self.view.itemsize) # <<<<<<<<<<<<<< + * if tmp == NULL: + * raise MemoryError +*/ + __pyx_v_tmp = PyMem_Malloc(__pyx_v_self->view.itemsize); + + /* "View.MemoryView":465 + * if self.view.itemsize > sizeof(array): + * tmp = PyMem_Malloc(self.view.itemsize) + * if tmp == NULL: # <<<<<<<<<<<<<< + * raise MemoryError + * item = tmp +*/ + __pyx_t_2 = (__pyx_v_tmp == NULL); + if (unlikely(__pyx_t_2)) { + + /* "View.MemoryView":466 + * tmp = PyMem_Malloc(self.view.itemsize) + * if tmp == NULL: + * raise MemoryError # <<<<<<<<<<<<<< + * item = tmp + * else: +*/ + PyErr_NoMemory(); __PYX_ERR(1, 466, __pyx_L1_error) + + /* "View.MemoryView":465 + * if self.view.itemsize > sizeof(array): + * tmp = PyMem_Malloc(self.view.itemsize) + * if tmp == NULL: # <<<<<<<<<<<<<< + * raise MemoryError + * item = tmp +*/ + } + + /* "View.MemoryView":467 + * if tmp == NULL: + * raise MemoryError + * item = tmp # <<<<<<<<<<<<<< + * else: + * item = array +*/ + __pyx_v_item = __pyx_v_tmp; + + /* "View.MemoryView":463 + * dst_slice = get_slice_from_memview(dst, &tmp_slice) + * + * if self.view.itemsize > sizeof(array): # <<<<<<<<<<<<<< + * tmp = PyMem_Malloc(self.view.itemsize) + * if tmp == NULL: +*/ + goto __pyx_L3; + } + + /* "View.MemoryView":469 + * item = tmp + * else: + * item = array # <<<<<<<<<<<<<< + * + * try: +*/ + /*else*/ { + __pyx_v_item = ((void *)__pyx_v_array); + } + __pyx_L3:; + + /* "View.MemoryView":471 + * item = array + * + * try: # <<<<<<<<<<<<<< + * if self.dtype_is_object: + * ( item)[0] = value +*/ + /*try:*/ { + + /* "View.MemoryView":472 + * + * try: + * if self.dtype_is_object: # <<<<<<<<<<<<<< + * ( item)[0] = value + * else: +*/ + if (__pyx_v_self->dtype_is_object) { + + /* "View.MemoryView":473 + * try: + * if self.dtype_is_object: + * ( item)[0] = value # <<<<<<<<<<<<<< + * else: + * self.assign_item_from_object( item, value) +*/ + (((PyObject **)__pyx_v_item)[0]) = ((PyObject *)__pyx_v_value); + + /* "View.MemoryView":472 + * + * try: + * if self.dtype_is_object: # <<<<<<<<<<<<<< + * ( item)[0] = value + * else: +*/ + goto __pyx_L8; + } + + /* "View.MemoryView":475 + * ( item)[0] = value + * else: + * self.assign_item_from_object( item, value) # <<<<<<<<<<<<<< + * + * +*/ + /*else*/ { + __pyx_t_3 = ((struct __pyx_vtabstruct_memoryview *)__pyx_v_self->__pyx_vtab)->assign_item_from_object(__pyx_v_self, ((char *)__pyx_v_item), __pyx_v_value); if (unlikely(!__pyx_t_3)) __PYX_ERR(1, 475, __pyx_L6_error) + __Pyx_GOTREF(__pyx_t_3); + __Pyx_DECREF(__pyx_t_3); __pyx_t_3 = 0; + } + __pyx_L8:; + + /* "View.MemoryView":479 + * + * + * if self.view.suboffsets != NULL: # <<<<<<<<<<<<<< + * assert_direct_dimensions(self.view.suboffsets, self.view.ndim) + * slice_assign_scalar(dst_slice, dst.view.ndim, self.view.itemsize, +*/ + __pyx_t_2 = (__pyx_v_self->view.suboffsets != NULL); + if (__pyx_t_2) { + + /* "View.MemoryView":480 + * + * if self.view.suboffsets != NULL: + * assert_direct_dimensions(self.view.suboffsets, self.view.ndim) # <<<<<<<<<<<<<< + * slice_assign_scalar(dst_slice, dst.view.ndim, self.view.itemsize, + * item, self.dtype_is_object) +*/ + __pyx_t_4 = assert_direct_dimensions(__pyx_v_self->view.suboffsets, __pyx_v_self->view.ndim); if (unlikely(__pyx_t_4 == ((int)-1))) __PYX_ERR(1, 480, __pyx_L6_error) + + /* "View.MemoryView":479 + * + * + * if self.view.suboffsets != NULL: # <<<<<<<<<<<<<< + * assert_direct_dimensions(self.view.suboffsets, self.view.ndim) + * slice_assign_scalar(dst_slice, dst.view.ndim, self.view.itemsize, +*/ + } + + /* "View.MemoryView":481 + * if self.view.suboffsets != NULL: + * assert_direct_dimensions(self.view.suboffsets, self.view.ndim) + * slice_assign_scalar(dst_slice, dst.view.ndim, self.view.itemsize, # <<<<<<<<<<<<<< + * item, self.dtype_is_object) + * finally: +*/ + __pyx_memoryview_slice_assign_scalar(__pyx_v_dst_slice, __pyx_v_dst->view.ndim, __pyx_v_self->view.itemsize, __pyx_v_item, __pyx_v_self->dtype_is_object); + } + + /* "View.MemoryView":484 + * item, self.dtype_is_object) + * finally: + * PyMem_Free(tmp) # <<<<<<<<<<<<<< + * + * cdef setitem_indexed(self, index, value): +*/ + /*finally:*/ { + /*normal exit:*/{ + PyMem_Free(__pyx_v_tmp); + goto __pyx_L7; + } + __pyx_L6_error:; + /*exception exit:*/{ + __Pyx_PyThreadState_declare + __Pyx_PyThreadState_assign + __pyx_t_7 = 0; __pyx_t_8 = 0; __pyx_t_9 = 0; __pyx_t_10 = 0; __pyx_t_11 = 0; __pyx_t_12 = 0; + __Pyx_XDECREF(__pyx_t_3); __pyx_t_3 = 0; + __Pyx_ExceptionSwap(&__pyx_t_10, &__pyx_t_11, &__pyx_t_12); + if ( unlikely(__Pyx_GetException(&__pyx_t_7, &__pyx_t_8, &__pyx_t_9) < 0)) __Pyx_ErrFetch(&__pyx_t_7, &__pyx_t_8, &__pyx_t_9); + __Pyx_XGOTREF(__pyx_t_7); + __Pyx_XGOTREF(__pyx_t_8); + __Pyx_XGOTREF(__pyx_t_9); + __Pyx_XGOTREF(__pyx_t_10); + __Pyx_XGOTREF(__pyx_t_11); + __Pyx_XGOTREF(__pyx_t_12); + __pyx_t_4 = __pyx_lineno; __pyx_t_5 = __pyx_clineno; __pyx_t_6 = __pyx_filename; + { + PyMem_Free(__pyx_v_tmp); + } + __Pyx_XGIVEREF(__pyx_t_10); + __Pyx_XGIVEREF(__pyx_t_11); + __Pyx_XGIVEREF(__pyx_t_12); + __Pyx_ExceptionReset(__pyx_t_10, __pyx_t_11, __pyx_t_12); + __Pyx_XGIVEREF(__pyx_t_7); + __Pyx_XGIVEREF(__pyx_t_8); + __Pyx_XGIVEREF(__pyx_t_9); + __Pyx_ErrRestore(__pyx_t_7, __pyx_t_8, __pyx_t_9); + __pyx_t_7 = 0; __pyx_t_8 = 0; __pyx_t_9 = 0; __pyx_t_10 = 0; __pyx_t_11 = 0; __pyx_t_12 = 0; + __pyx_lineno = __pyx_t_4; __pyx_clineno = __pyx_t_5; __pyx_filename = __pyx_t_6; + goto __pyx_L1_error; + } + __pyx_L7:; + } + + /* "View.MemoryView":454 + * memoryview_copy_contents(msrc, mdst, src.ndim, dst.ndim, self.dtype_is_object) + * + * cdef setitem_slice_assign_scalar(self, memoryview dst, value): # <<<<<<<<<<<<<< + * cdef int array[128] + * cdef void *tmp = NULL +*/ + + /* function exit code */ + __pyx_r = Py_None; __Pyx_INCREF(Py_None); + goto __pyx_L0; + __pyx_L1_error:; + __Pyx_XDECREF(__pyx_t_3); + __Pyx_AddTraceback("View.MemoryView.memoryview.setitem_slice_assign_scalar", __pyx_clineno, __pyx_lineno, __pyx_filename); + __pyx_r = 0; + __pyx_L0:; + __Pyx_XGIVEREF(__pyx_r); + __Pyx_RefNannyFinishContext(); + return __pyx_r; +} + +/* "View.MemoryView":486 + * PyMem_Free(tmp) + * + * cdef setitem_indexed(self, index, value): # <<<<<<<<<<<<<< + * cdef char *itemp = self.get_item_pointer(index) + * self.assign_item_from_object(itemp, value) +*/ + +static PyObject *__pyx_memoryview_setitem_indexed(struct __pyx_memoryview_obj *__pyx_v_self, PyObject *__pyx_v_index, PyObject *__pyx_v_value) { + char *__pyx_v_itemp; + PyObject *__pyx_r = NULL; + __Pyx_RefNannyDeclarations + char *__pyx_t_1; + PyObject *__pyx_t_2 = NULL; + int __pyx_lineno = 0; + const char *__pyx_filename = NULL; + int __pyx_clineno = 0; + __Pyx_RefNannySetupContext("setitem_indexed", 0); + + /* "View.MemoryView":487 + * + * cdef setitem_indexed(self, index, value): + * cdef char *itemp = self.get_item_pointer(index) # <<<<<<<<<<<<<< + * self.assign_item_from_object(itemp, value) + * +*/ + __pyx_t_1 = ((struct __pyx_vtabstruct_memoryview *)__pyx_v_self->__pyx_vtab)->get_item_pointer(__pyx_v_self, __pyx_v_index); if (unlikely(__pyx_t_1 == ((void *)NULL))) __PYX_ERR(1, 487, __pyx_L1_error) + __pyx_v_itemp = __pyx_t_1; + + /* "View.MemoryView":488 + * cdef setitem_indexed(self, index, value): + * cdef char *itemp = self.get_item_pointer(index) + * self.assign_item_from_object(itemp, value) # <<<<<<<<<<<<<< + * + * cdef convert_item_to_object(self, char *itemp): +*/ + __pyx_t_2 = ((struct __pyx_vtabstruct_memoryview *)__pyx_v_self->__pyx_vtab)->assign_item_from_object(__pyx_v_self, __pyx_v_itemp, __pyx_v_value); if (unlikely(!__pyx_t_2)) __PYX_ERR(1, 488, __pyx_L1_error) + __Pyx_GOTREF(__pyx_t_2); + __Pyx_DECREF(__pyx_t_2); __pyx_t_2 = 0; + + /* "View.MemoryView":486 + * PyMem_Free(tmp) + * + * cdef setitem_indexed(self, index, value): # <<<<<<<<<<<<<< + * cdef char *itemp = self.get_item_pointer(index) + * self.assign_item_from_object(itemp, value) +*/ + + /* function exit code */ + __pyx_r = Py_None; __Pyx_INCREF(Py_None); + goto __pyx_L0; + __pyx_L1_error:; + __Pyx_XDECREF(__pyx_t_2); + __Pyx_AddTraceback("View.MemoryView.memoryview.setitem_indexed", __pyx_clineno, __pyx_lineno, __pyx_filename); + __pyx_r = 0; + __pyx_L0:; + __Pyx_XGIVEREF(__pyx_r); + __Pyx_RefNannyFinishContext(); + return __pyx_r; +} + +/* "View.MemoryView":490 + * self.assign_item_from_object(itemp, value) + * + * cdef convert_item_to_object(self, char *itemp): # <<<<<<<<<<<<<< + * """Only used if instantiated manually by the user, or if Cython doesn't + * know how to convert the type""" +*/ + +static PyObject *__pyx_memoryview_convert_item_to_object(struct __pyx_memoryview_obj *__pyx_v_self, char *__pyx_v_itemp) { + PyObject *__pyx_v_struct = NULL; + PyObject *__pyx_v_bytesitem = 0; + PyObject *__pyx_v_result = NULL; + PyObject *__pyx_r = NULL; + __Pyx_RefNannyDeclarations + PyObject *__pyx_t_1 = NULL; + PyObject *__pyx_t_2 = NULL; + PyObject *__pyx_t_3 = NULL; + PyObject *__pyx_t_4 = NULL; + PyObject *__pyx_t_5 = NULL; + PyObject *__pyx_t_6 = NULL; + size_t __pyx_t_7; + Py_ssize_t __pyx_t_8; + int __pyx_t_9; + PyObject *__pyx_t_10 = NULL; + int __pyx_t_11; + int __pyx_lineno = 0; + const char *__pyx_filename = NULL; + int __pyx_clineno = 0; + __Pyx_RefNannySetupContext("convert_item_to_object", 0); + + /* "View.MemoryView":493 + * """Only used if instantiated manually by the user, or if Cython doesn't + * know how to convert the type""" + * import struct # <<<<<<<<<<<<<< + * cdef bytes bytesitem + * +*/ + __pyx_t_2 = __Pyx_Import(__pyx_mstate_global->__pyx_n_u_struct, 0, 0, NULL, 0); if (unlikely(!__pyx_t_2)) __PYX_ERR(1, 493, __pyx_L1_error) + __pyx_t_1 = __pyx_t_2; + __Pyx_GOTREF(__pyx_t_1); + __pyx_v_struct = __pyx_t_1; + __pyx_t_1 = 0; + + /* "View.MemoryView":496 + * cdef bytes bytesitem + * + * bytesitem = itemp[:self.view.itemsize] # <<<<<<<<<<<<<< + * try: + * result = struct.unpack(self.view.format, bytesitem) +*/ + __pyx_t_1 = __Pyx_PyBytes_FromStringAndSize(__pyx_v_itemp + 0, __pyx_v_self->view.itemsize - 0); if (unlikely(!__pyx_t_1)) __PYX_ERR(1, 496, __pyx_L1_error) + __Pyx_GOTREF(__pyx_t_1); + __pyx_v_bytesitem = ((PyObject*)__pyx_t_1); + __pyx_t_1 = 0; + + /* "View.MemoryView":497 + * + * bytesitem = itemp[:self.view.itemsize] + * try: # <<<<<<<<<<<<<< + * result = struct.unpack(self.view.format, bytesitem) + * except struct.error: +*/ + { + __Pyx_PyThreadState_declare + __Pyx_PyThreadState_assign + __Pyx_ExceptionSave(&__pyx_t_2, &__pyx_t_3, &__pyx_t_4); + __Pyx_XGOTREF(__pyx_t_2); + __Pyx_XGOTREF(__pyx_t_3); + __Pyx_XGOTREF(__pyx_t_4); + /*try:*/ { + + /* "View.MemoryView":498 + * bytesitem = itemp[:self.view.itemsize] + * try: + * result = struct.unpack(self.view.format, bytesitem) # <<<<<<<<<<<<<< + * except struct.error: + * raise ValueError, "Unable to convert item to object" +*/ + __pyx_t_5 = __pyx_v_struct; + __Pyx_INCREF(__pyx_t_5); + __pyx_t_6 = __Pyx_PyBytes_FromString(__pyx_v_self->view.format); if (unlikely(!__pyx_t_6)) __PYX_ERR(1, 498, __pyx_L3_error) + __Pyx_GOTREF(__pyx_t_6); + __pyx_t_7 = 0; + { + PyObject *__pyx_callargs[3] = {__pyx_t_5, __pyx_t_6, __pyx_v_bytesitem}; + __pyx_t_1 = __Pyx_PyObject_FastCallMethod((PyObject*)__pyx_mstate_global->__pyx_n_u_unpack, __pyx_callargs+__pyx_t_7, (3-__pyx_t_7) | (1*__Pyx_PY_VECTORCALL_ARGUMENTS_OFFSET)); + __Pyx_XDECREF(__pyx_t_5); __pyx_t_5 = 0; + __Pyx_DECREF(__pyx_t_6); __pyx_t_6 = 0; + if (unlikely(!__pyx_t_1)) __PYX_ERR(1, 498, __pyx_L3_error) + __Pyx_GOTREF(__pyx_t_1); + } + __pyx_v_result = __pyx_t_1; + __pyx_t_1 = 0; + + /* "View.MemoryView":497 + * + * bytesitem = itemp[:self.view.itemsize] + * try: # <<<<<<<<<<<<<< + * result = struct.unpack(self.view.format, bytesitem) + * except struct.error: +*/ + } + + /* "View.MemoryView":502 + * raise ValueError, "Unable to convert item to object" + * else: + * if len(self.view.format) == 1: # <<<<<<<<<<<<<< + * return result[0] + * return result +*/ + /*else:*/ { + __pyx_t_8 = __Pyx_ssize_strlen(__pyx_v_self->view.format); if (unlikely(__pyx_t_8 == ((Py_ssize_t)-1))) __PYX_ERR(1, 502, __pyx_L5_except_error) + __pyx_t_9 = (__pyx_t_8 == 1); + if (__pyx_t_9) { + + /* "View.MemoryView":503 + * else: + * if len(self.view.format) == 1: + * return result[0] # <<<<<<<<<<<<<< + * return result + * +*/ + __Pyx_XDECREF(__pyx_r); + __pyx_t_1 = __Pyx_GetItemInt(__pyx_v_result, 0, long, 1, __Pyx_PyLong_From_long, 0, 0, 1, 1, __Pyx_ReferenceSharing_OwnStrongReference); if (unlikely(!__pyx_t_1)) __PYX_ERR(1, 503, __pyx_L5_except_error) + __Pyx_GOTREF(__pyx_t_1); + __pyx_r = __pyx_t_1; + __pyx_t_1 = 0; + goto __pyx_L6_except_return; + + /* "View.MemoryView":502 + * raise ValueError, "Unable to convert item to object" + * else: + * if len(self.view.format) == 1: # <<<<<<<<<<<<<< + * return result[0] + * return result +*/ + } + + /* "View.MemoryView":504 + * if len(self.view.format) == 1: + * return result[0] + * return result # <<<<<<<<<<<<<< + * + * cdef assign_item_from_object(self, char *itemp, object value): +*/ + __Pyx_XDECREF(__pyx_r); + __Pyx_INCREF(__pyx_v_result); + __pyx_r = __pyx_v_result; + goto __pyx_L6_except_return; + } + __pyx_L3_error:; + __Pyx_XDECREF(__pyx_t_1); __pyx_t_1 = 0; + __Pyx_XDECREF(__pyx_t_5); __pyx_t_5 = 0; + __Pyx_XDECREF(__pyx_t_6); __pyx_t_6 = 0; + + /* "View.MemoryView":499 + * try: + * result = struct.unpack(self.view.format, bytesitem) + * except struct.error: # <<<<<<<<<<<<<< + * raise ValueError, "Unable to convert item to object" + * else: +*/ + __Pyx_ErrFetch(&__pyx_t_1, &__pyx_t_6, &__pyx_t_5); + __pyx_t_10 = __Pyx_PyObject_GetAttrStr(__pyx_v_struct, __pyx_mstate_global->__pyx_n_u_error); if (unlikely(!__pyx_t_10)) __PYX_ERR(1, 499, __pyx_L5_except_error) + __Pyx_GOTREF(__pyx_t_10); + __pyx_t_11 = __Pyx_PyErr_GivenExceptionMatches(__pyx_t_1, __pyx_t_10); + __Pyx_DECREF(__pyx_t_10); __pyx_t_10 = 0; + __Pyx_ErrRestore(__pyx_t_1, __pyx_t_6, __pyx_t_5); + __pyx_t_1 = 0; __pyx_t_6 = 0; __pyx_t_5 = 0; + if (__pyx_t_11) { + __Pyx_AddTraceback("View.MemoryView.memoryview.convert_item_to_object", __pyx_clineno, __pyx_lineno, __pyx_filename); + if (__Pyx_GetException(&__pyx_t_5, &__pyx_t_6, &__pyx_t_1) < 0) __PYX_ERR(1, 499, __pyx_L5_except_error) + __Pyx_XGOTREF(__pyx_t_5); + __Pyx_XGOTREF(__pyx_t_6); + __Pyx_XGOTREF(__pyx_t_1); + + /* "View.MemoryView":500 + * result = struct.unpack(self.view.format, bytesitem) + * except struct.error: + * raise ValueError, "Unable to convert item to object" # <<<<<<<<<<<<<< + * else: + * if len(self.view.format) == 1: +*/ + __Pyx_Raise(((PyObject *)(((PyTypeObject*)PyExc_ValueError))), __pyx_mstate_global->__pyx_kp_u_Unable_to_convert_item_to_object, 0, 0); + __PYX_ERR(1, 500, __pyx_L5_except_error) + } + goto __pyx_L5_except_error; + + /* "View.MemoryView":497 + * + * bytesitem = itemp[:self.view.itemsize] + * try: # <<<<<<<<<<<<<< + * result = struct.unpack(self.view.format, bytesitem) + * except struct.error: +*/ + __pyx_L5_except_error:; + __Pyx_XGIVEREF(__pyx_t_2); + __Pyx_XGIVEREF(__pyx_t_3); + __Pyx_XGIVEREF(__pyx_t_4); + __Pyx_ExceptionReset(__pyx_t_2, __pyx_t_3, __pyx_t_4); + goto __pyx_L1_error; + __pyx_L6_except_return:; + __Pyx_XGIVEREF(__pyx_t_2); + __Pyx_XGIVEREF(__pyx_t_3); + __Pyx_XGIVEREF(__pyx_t_4); + __Pyx_ExceptionReset(__pyx_t_2, __pyx_t_3, __pyx_t_4); + goto __pyx_L0; + } + + /* "View.MemoryView":490 + * self.assign_item_from_object(itemp, value) + * + * cdef convert_item_to_object(self, char *itemp): # <<<<<<<<<<<<<< + * """Only used if instantiated manually by the user, or if Cython doesn't + * know how to convert the type""" +*/ + + /* function exit code */ + __pyx_L1_error:; + __Pyx_XDECREF(__pyx_t_1); + __Pyx_XDECREF(__pyx_t_5); + __Pyx_XDECREF(__pyx_t_6); + __Pyx_XDECREF(__pyx_t_10); + __Pyx_AddTraceback("View.MemoryView.memoryview.convert_item_to_object", __pyx_clineno, __pyx_lineno, __pyx_filename); + __pyx_r = 0; + __pyx_L0:; + __Pyx_XDECREF(__pyx_v_struct); + __Pyx_XDECREF(__pyx_v_bytesitem); + __Pyx_XDECREF(__pyx_v_result); + __Pyx_XGIVEREF(__pyx_r); + __Pyx_RefNannyFinishContext(); + return __pyx_r; +} + +/* "View.MemoryView":506 + * return result + * + * cdef assign_item_from_object(self, char *itemp, object value): # <<<<<<<<<<<<<< + * """Only used if instantiated manually by the user, or if Cython doesn't + * know how to convert the type""" +*/ + +static PyObject *__pyx_memoryview_assign_item_from_object(struct __pyx_memoryview_obj *__pyx_v_self, char *__pyx_v_itemp, PyObject *__pyx_v_value) { + PyObject *__pyx_v_struct = NULL; + char __pyx_v_c; + PyObject *__pyx_v_bytesvalue = 0; + Py_ssize_t __pyx_v_i; + PyObject *__pyx_r = NULL; + __Pyx_RefNannyDeclarations + PyObject *__pyx_t_1 = NULL; + PyObject *__pyx_t_2 = NULL; + int __pyx_t_3; + PyObject *__pyx_t_4 = NULL; + PyObject *__pyx_t_5 = NULL; + PyObject *__pyx_t_6 = NULL; + size_t __pyx_t_7; + Py_ssize_t __pyx_t_8; + PyObject *__pyx_t_9 = NULL; + char *__pyx_t_10; + char *__pyx_t_11; + Py_ssize_t __pyx_t_12; + char *__pyx_t_13; + char *__pyx_t_14; + int __pyx_lineno = 0; + const char *__pyx_filename = NULL; + int __pyx_clineno = 0; + __Pyx_RefNannySetupContext("assign_item_from_object", 0); + + /* "View.MemoryView":509 + * """Only used if instantiated manually by the user, or if Cython doesn't + * know how to convert the type""" + * import struct # <<<<<<<<<<<<<< + * cdef char c + * cdef bytes bytesvalue +*/ + __pyx_t_2 = __Pyx_Import(__pyx_mstate_global->__pyx_n_u_struct, 0, 0, NULL, 0); if (unlikely(!__pyx_t_2)) __PYX_ERR(1, 509, __pyx_L1_error) + __pyx_t_1 = __pyx_t_2; + __Pyx_GOTREF(__pyx_t_1); + __pyx_v_struct = __pyx_t_1; + __pyx_t_1 = 0; + + /* "View.MemoryView":514 + * cdef Py_ssize_t i + * + * if isinstance(value, tuple): # <<<<<<<<<<<<<< + * bytesvalue = struct.pack(self.view.format, *value) + * else: +*/ + __pyx_t_3 = PyTuple_Check(__pyx_v_value); + if (__pyx_t_3) { + + /* "View.MemoryView":515 + * + * if isinstance(value, tuple): + * bytesvalue = struct.pack(self.view.format, *value) # <<<<<<<<<<<<<< + * else: + * bytesvalue = struct.pack(self.view.format, value) +*/ + __pyx_t_1 = __Pyx_PyObject_GetAttrStr(__pyx_v_struct, __pyx_mstate_global->__pyx_n_u_pack); if (unlikely(!__pyx_t_1)) __PYX_ERR(1, 515, __pyx_L1_error) + __Pyx_GOTREF(__pyx_t_1); + __pyx_t_4 = __Pyx_PyBytes_FromString(__pyx_v_self->view.format); if (unlikely(!__pyx_t_4)) __PYX_ERR(1, 515, __pyx_L1_error) + __Pyx_GOTREF(__pyx_t_4); + __pyx_t_5 = PyTuple_New(1); if (unlikely(!__pyx_t_5)) __PYX_ERR(1, 515, __pyx_L1_error) + __Pyx_GOTREF(__pyx_t_5); + __Pyx_GIVEREF(__pyx_t_4); + if (__Pyx_PyTuple_SET_ITEM(__pyx_t_5, 0, __pyx_t_4) != (0)) __PYX_ERR(1, 515, __pyx_L1_error); + __pyx_t_4 = 0; + __pyx_t_4 = __Pyx_PySequence_Tuple(__pyx_v_value); if (unlikely(!__pyx_t_4)) __PYX_ERR(1, 515, __pyx_L1_error) + __Pyx_GOTREF(__pyx_t_4); + __pyx_t_6 = PyNumber_Add(__pyx_t_5, __pyx_t_4); if (unlikely(!__pyx_t_6)) __PYX_ERR(1, 515, __pyx_L1_error) + __Pyx_GOTREF(__pyx_t_6); + __Pyx_DECREF(__pyx_t_5); __pyx_t_5 = 0; + __Pyx_DECREF(__pyx_t_4); __pyx_t_4 = 0; + __pyx_t_4 = __Pyx_PyObject_Call(__pyx_t_1, __pyx_t_6, NULL); if (unlikely(!__pyx_t_4)) __PYX_ERR(1, 515, __pyx_L1_error) + __Pyx_GOTREF(__pyx_t_4); + __Pyx_DECREF(__pyx_t_1); __pyx_t_1 = 0; + __Pyx_DECREF(__pyx_t_6); __pyx_t_6 = 0; + if (!(likely(PyBytes_CheckExact(__pyx_t_4))||((__pyx_t_4) == Py_None) || __Pyx_RaiseUnexpectedTypeError("bytes", __pyx_t_4))) __PYX_ERR(1, 515, __pyx_L1_error) + __pyx_v_bytesvalue = ((PyObject*)__pyx_t_4); + __pyx_t_4 = 0; + + /* "View.MemoryView":514 + * cdef Py_ssize_t i + * + * if isinstance(value, tuple): # <<<<<<<<<<<<<< + * bytesvalue = struct.pack(self.view.format, *value) + * else: +*/ + goto __pyx_L3; + } + + /* "View.MemoryView":517 + * bytesvalue = struct.pack(self.view.format, *value) + * else: + * bytesvalue = struct.pack(self.view.format, value) # <<<<<<<<<<<<<< + * + * for i, c in enumerate(bytesvalue): +*/ + /*else*/ { + __pyx_t_6 = __pyx_v_struct; + __Pyx_INCREF(__pyx_t_6); + __pyx_t_1 = __Pyx_PyBytes_FromString(__pyx_v_self->view.format); if (unlikely(!__pyx_t_1)) __PYX_ERR(1, 517, __pyx_L1_error) + __Pyx_GOTREF(__pyx_t_1); + __pyx_t_7 = 0; + { + PyObject *__pyx_callargs[3] = {__pyx_t_6, __pyx_t_1, __pyx_v_value}; + __pyx_t_4 = __Pyx_PyObject_FastCallMethod((PyObject*)__pyx_mstate_global->__pyx_n_u_pack, __pyx_callargs+__pyx_t_7, (3-__pyx_t_7) | (1*__Pyx_PY_VECTORCALL_ARGUMENTS_OFFSET)); + __Pyx_XDECREF(__pyx_t_6); __pyx_t_6 = 0; + __Pyx_DECREF(__pyx_t_1); __pyx_t_1 = 0; + if (unlikely(!__pyx_t_4)) __PYX_ERR(1, 517, __pyx_L1_error) + __Pyx_GOTREF(__pyx_t_4); + } + if (!(likely(PyBytes_CheckExact(__pyx_t_4))||((__pyx_t_4) == Py_None) || __Pyx_RaiseUnexpectedTypeError("bytes", __pyx_t_4))) __PYX_ERR(1, 517, __pyx_L1_error) + __pyx_v_bytesvalue = ((PyObject*)__pyx_t_4); + __pyx_t_4 = 0; + } + __pyx_L3:; + + /* "View.MemoryView":519 + * bytesvalue = struct.pack(self.view.format, value) + * + * for i, c in enumerate(bytesvalue): # <<<<<<<<<<<<<< + * itemp[i] = c + * +*/ + __pyx_t_8 = 0; + if (unlikely(__pyx_v_bytesvalue == Py_None)) { + PyErr_SetString(PyExc_TypeError, "'NoneType' is not iterable"); + __PYX_ERR(1, 519, __pyx_L1_error) + } + __Pyx_INCREF(__pyx_v_bytesvalue); + __pyx_t_9 = __pyx_v_bytesvalue; + __pyx_t_11 = __Pyx_PyBytes_AsWritableString(__pyx_t_9); if (unlikely(__pyx_t_11 == ((char *)NULL))) __PYX_ERR(1, 519, __pyx_L1_error) + __pyx_t_12 = __Pyx_PyBytes_GET_SIZE(__pyx_t_9); if (unlikely(__pyx_t_12 == ((Py_ssize_t)-1))) __PYX_ERR(1, 519, __pyx_L1_error) + __pyx_t_13 = (__pyx_t_11 + __pyx_t_12); + for (__pyx_t_14 = __pyx_t_11; __pyx_t_14 < __pyx_t_13; __pyx_t_14++) { + __pyx_t_10 = __pyx_t_14; + __pyx_v_c = (__pyx_t_10[0]); + + /* "View.MemoryView":520 + * + * for i, c in enumerate(bytesvalue): + * itemp[i] = c # <<<<<<<<<<<<<< + * + * @cname('getbuffer') +*/ + __pyx_v_i = __pyx_t_8; + + /* "View.MemoryView":519 + * bytesvalue = struct.pack(self.view.format, value) + * + * for i, c in enumerate(bytesvalue): # <<<<<<<<<<<<<< + * itemp[i] = c + * +*/ + __pyx_t_8 = (__pyx_t_8 + 1); + + /* "View.MemoryView":520 + * + * for i, c in enumerate(bytesvalue): + * itemp[i] = c # <<<<<<<<<<<<<< + * + * @cname('getbuffer') +*/ + (__pyx_v_itemp[__pyx_v_i]) = __pyx_v_c; + } + __Pyx_DECREF(__pyx_t_9); __pyx_t_9 = 0; + + /* "View.MemoryView":506 + * return result + * + * cdef assign_item_from_object(self, char *itemp, object value): # <<<<<<<<<<<<<< + * """Only used if instantiated manually by the user, or if Cython doesn't + * know how to convert the 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_4); + __Pyx_XDECREF(__pyx_t_5); + __Pyx_XDECREF(__pyx_t_6); + __Pyx_XDECREF(__pyx_t_9); + __Pyx_AddTraceback("View.MemoryView.memoryview.assign_item_from_object", __pyx_clineno, __pyx_lineno, __pyx_filename); + __pyx_r = 0; + __pyx_L0:; + __Pyx_XDECREF(__pyx_v_struct); + __Pyx_XDECREF(__pyx_v_bytesvalue); + __Pyx_XGIVEREF(__pyx_r); + __Pyx_RefNannyFinishContext(); + return __pyx_r; +} + +/* "View.MemoryView":522 + * itemp[i] = c + * + * @cname('getbuffer') # <<<<<<<<<<<<<< + * def __getbuffer__(self, Py_buffer *info, int flags): + * if flags & PyBUF_WRITABLE and self.view.readonly: +*/ + +/* Python wrapper */ +CYTHON_UNUSED static int __pyx_memoryview_getbuffer(PyObject *__pyx_v_self, Py_buffer *__pyx_v_info, int __pyx_v_flags); /*proto*/ +CYTHON_UNUSED static int __pyx_memoryview_getbuffer(PyObject *__pyx_v_self, Py_buffer *__pyx_v_info, int __pyx_v_flags) { + CYTHON_UNUSED PyObject *const *__pyx_kwvalues; + int __pyx_r; + __Pyx_RefNannyDeclarations + __Pyx_RefNannySetupContext("__getbuffer__ (wrapper)", 0); + __pyx_kwvalues = __Pyx_KwValues_VARARGS(__pyx_args, __pyx_nargs); + __pyx_r = __pyx_memoryview___pyx_pf_15View_dot_MemoryView_10memoryview_8__getbuffer__(((struct __pyx_memoryview_obj *)__pyx_v_self), ((Py_buffer *)__pyx_v_info), ((int)__pyx_v_flags)); + + /* function exit code */ + __Pyx_RefNannyFinishContext(); + return __pyx_r; +} + +static int __pyx_memoryview___pyx_pf_15View_dot_MemoryView_10memoryview_8__getbuffer__(struct __pyx_memoryview_obj *__pyx_v_self, Py_buffer *__pyx_v_info, int __pyx_v_flags) { + int __pyx_r; + __Pyx_RefNannyDeclarations + int __pyx_t_1; + int __pyx_t_2; + Py_ssize_t *__pyx_t_3; + char *__pyx_t_4; + void *__pyx_t_5; + int __pyx_t_6; + Py_ssize_t __pyx_t_7; + int __pyx_lineno = 0; + const char *__pyx_filename = NULL; + int __pyx_clineno = 0; + if (unlikely(__pyx_v_info == NULL)) { + PyErr_SetString(PyExc_BufferError, "PyObject_GetBuffer: view==NULL argument is obsolete"); + return -1; + } + __Pyx_RefNannySetupContext("__getbuffer__", 0); + __pyx_v_info->obj = Py_None; __Pyx_INCREF(Py_None); + __Pyx_GIVEREF(__pyx_v_info->obj); + + /* "View.MemoryView":524 + * @cname('getbuffer') + * def __getbuffer__(self, Py_buffer *info, int flags): + * if flags & PyBUF_WRITABLE and self.view.readonly: # <<<<<<<<<<<<<< + * raise ValueError, "Cannot create writable memory view from read-only memoryview" + * +*/ + __pyx_t_2 = ((__pyx_v_flags & PyBUF_WRITABLE) != 0); + if (__pyx_t_2) { + } else { + __pyx_t_1 = __pyx_t_2; + goto __pyx_L4_bool_binop_done; + } + __pyx_t_1 = __pyx_v_self->view.readonly; + __pyx_L4_bool_binop_done:; + if (unlikely(__pyx_t_1)) { + + /* "View.MemoryView":525 + * def __getbuffer__(self, Py_buffer *info, int flags): + * if flags & PyBUF_WRITABLE and self.view.readonly: + * raise ValueError, "Cannot create writable memory view from read-only memoryview" # <<<<<<<<<<<<<< + * + * if flags & PyBUF_ND: +*/ + __Pyx_Raise(((PyObject *)(((PyTypeObject*)PyExc_ValueError))), __pyx_mstate_global->__pyx_kp_u_Cannot_create_writable_memory_vi, 0, 0); + __PYX_ERR(1, 525, __pyx_L1_error) + + /* "View.MemoryView":524 + * @cname('getbuffer') + * def __getbuffer__(self, Py_buffer *info, int flags): + * if flags & PyBUF_WRITABLE and self.view.readonly: # <<<<<<<<<<<<<< + * raise ValueError, "Cannot create writable memory view from read-only memoryview" + * +*/ + } + + /* "View.MemoryView":527 + * raise ValueError, "Cannot create writable memory view from read-only memoryview" + * + * if flags & PyBUF_ND: # <<<<<<<<<<<<<< + * info.shape = self.view.shape + * else: +*/ + __pyx_t_1 = ((__pyx_v_flags & PyBUF_ND) != 0); + if (__pyx_t_1) { + + /* "View.MemoryView":528 + * + * if flags & PyBUF_ND: + * info.shape = self.view.shape # <<<<<<<<<<<<<< + * else: + * info.shape = NULL +*/ + __pyx_t_3 = __pyx_v_self->view.shape; + __pyx_v_info->shape = __pyx_t_3; + + /* "View.MemoryView":527 + * raise ValueError, "Cannot create writable memory view from read-only memoryview" + * + * if flags & PyBUF_ND: # <<<<<<<<<<<<<< + * info.shape = self.view.shape + * else: +*/ + goto __pyx_L6; + } + + /* "View.MemoryView":530 + * info.shape = self.view.shape + * else: + * info.shape = NULL # <<<<<<<<<<<<<< + * + * if flags & PyBUF_STRIDES: +*/ + /*else*/ { + __pyx_v_info->shape = NULL; + } + __pyx_L6:; + + /* "View.MemoryView":532 + * info.shape = NULL + * + * if flags & PyBUF_STRIDES: # <<<<<<<<<<<<<< + * info.strides = self.view.strides + * else: +*/ + __pyx_t_1 = ((__pyx_v_flags & PyBUF_STRIDES) != 0); + if (__pyx_t_1) { + + /* "View.MemoryView":533 + * + * if flags & PyBUF_STRIDES: + * info.strides = self.view.strides # <<<<<<<<<<<<<< + * else: + * info.strides = NULL +*/ + __pyx_t_3 = __pyx_v_self->view.strides; + __pyx_v_info->strides = __pyx_t_3; + + /* "View.MemoryView":532 + * info.shape = NULL + * + * if flags & PyBUF_STRIDES: # <<<<<<<<<<<<<< + * info.strides = self.view.strides + * else: +*/ + goto __pyx_L7; + } + + /* "View.MemoryView":535 + * info.strides = self.view.strides + * else: + * info.strides = NULL # <<<<<<<<<<<<<< + * + * if flags & PyBUF_INDIRECT: +*/ + /*else*/ { + __pyx_v_info->strides = NULL; + } + __pyx_L7:; + + /* "View.MemoryView":537 + * info.strides = NULL + * + * if flags & PyBUF_INDIRECT: # <<<<<<<<<<<<<< + * info.suboffsets = self.view.suboffsets + * else: +*/ + __pyx_t_1 = ((__pyx_v_flags & PyBUF_INDIRECT) != 0); + if (__pyx_t_1) { + + /* "View.MemoryView":538 + * + * if flags & PyBUF_INDIRECT: + * info.suboffsets = self.view.suboffsets # <<<<<<<<<<<<<< + * else: + * info.suboffsets = NULL +*/ + __pyx_t_3 = __pyx_v_self->view.suboffsets; + __pyx_v_info->suboffsets = __pyx_t_3; + + /* "View.MemoryView":537 + * info.strides = NULL + * + * if flags & PyBUF_INDIRECT: # <<<<<<<<<<<<<< + * info.suboffsets = self.view.suboffsets + * else: +*/ + goto __pyx_L8; + } + + /* "View.MemoryView":540 + * info.suboffsets = self.view.suboffsets + * else: + * info.suboffsets = NULL # <<<<<<<<<<<<<< + * + * if flags & PyBUF_FORMAT: +*/ + /*else*/ { + __pyx_v_info->suboffsets = NULL; + } + __pyx_L8:; + + /* "View.MemoryView":542 + * info.suboffsets = NULL + * + * if flags & PyBUF_FORMAT: # <<<<<<<<<<<<<< + * info.format = self.view.format + * else: +*/ + __pyx_t_1 = ((__pyx_v_flags & PyBUF_FORMAT) != 0); + if (__pyx_t_1) { + + /* "View.MemoryView":543 + * + * if flags & PyBUF_FORMAT: + * info.format = self.view.format # <<<<<<<<<<<<<< + * else: + * info.format = NULL +*/ + __pyx_t_4 = __pyx_v_self->view.format; + __pyx_v_info->format = __pyx_t_4; + + /* "View.MemoryView":542 + * info.suboffsets = NULL + * + * if flags & PyBUF_FORMAT: # <<<<<<<<<<<<<< + * info.format = self.view.format + * else: +*/ + goto __pyx_L9; + } + + /* "View.MemoryView":545 + * info.format = self.view.format + * else: + * info.format = NULL # <<<<<<<<<<<<<< + * + * info.buf = self.view.buf +*/ + /*else*/ { + __pyx_v_info->format = NULL; + } + __pyx_L9:; + + /* "View.MemoryView":547 + * info.format = NULL + * + * info.buf = self.view.buf # <<<<<<<<<<<<<< + * info.ndim = self.view.ndim + * info.itemsize = self.view.itemsize +*/ + __pyx_t_5 = __pyx_v_self->view.buf; + __pyx_v_info->buf = __pyx_t_5; + + /* "View.MemoryView":548 + * + * info.buf = self.view.buf + * info.ndim = self.view.ndim # <<<<<<<<<<<<<< + * info.itemsize = self.view.itemsize + * info.len = self.view.len +*/ + __pyx_t_6 = __pyx_v_self->view.ndim; + __pyx_v_info->ndim = __pyx_t_6; + + /* "View.MemoryView":549 + * info.buf = self.view.buf + * info.ndim = self.view.ndim + * info.itemsize = self.view.itemsize # <<<<<<<<<<<<<< + * info.len = self.view.len + * info.readonly = self.view.readonly +*/ + __pyx_t_7 = __pyx_v_self->view.itemsize; + __pyx_v_info->itemsize = __pyx_t_7; + + /* "View.MemoryView":550 + * info.ndim = self.view.ndim + * info.itemsize = self.view.itemsize + * info.len = self.view.len # <<<<<<<<<<<<<< + * info.readonly = self.view.readonly + * info.obj = self +*/ + __pyx_t_7 = __pyx_v_self->view.len; + __pyx_v_info->len = __pyx_t_7; + + /* "View.MemoryView":551 + * info.itemsize = self.view.itemsize + * info.len = self.view.len + * info.readonly = self.view.readonly # <<<<<<<<<<<<<< + * info.obj = self + * +*/ + __pyx_t_1 = __pyx_v_self->view.readonly; + __pyx_v_info->readonly = __pyx_t_1; + + /* "View.MemoryView":552 + * info.len = self.view.len + * info.readonly = self.view.readonly + * info.obj = self # <<<<<<<<<<<<<< + * + * +*/ + __Pyx_INCREF((PyObject *)__pyx_v_self); + __Pyx_GIVEREF((PyObject *)__pyx_v_self); + __Pyx_GOTREF(__pyx_v_info->obj); + __Pyx_DECREF(__pyx_v_info->obj); + __pyx_v_info->obj = ((PyObject *)__pyx_v_self); + + /* "View.MemoryView":522 + * itemp[i] = c + * + * @cname('getbuffer') # <<<<<<<<<<<<<< + * def __getbuffer__(self, Py_buffer *info, int flags): + * if flags & PyBUF_WRITABLE and self.view.readonly: +*/ + + /* function exit code */ + __pyx_r = 0; + goto __pyx_L0; + __pyx_L1_error:; + __Pyx_AddTraceback("View.MemoryView.memoryview.__getbuffer__", __pyx_clineno, __pyx_lineno, __pyx_filename); + __pyx_r = -1; + if (__pyx_v_info->obj != NULL) { + __Pyx_GOTREF(__pyx_v_info->obj); + __Pyx_DECREF(__pyx_v_info->obj); __pyx_v_info->obj = 0; + } + goto __pyx_L2; + __pyx_L0:; + if (__pyx_v_info->obj == Py_None) { + __Pyx_GOTREF(__pyx_v_info->obj); + __Pyx_DECREF(__pyx_v_info->obj); __pyx_v_info->obj = 0; + } + __pyx_L2:; + __Pyx_RefNannyFinishContext(); + return __pyx_r; +} + +/* "View.MemoryView":555 + * + * + * @property # <<<<<<<<<<<<<< + * def T(self): + * cdef _memoryviewslice result = memoryview_copy(self) +*/ + +/* Python wrapper */ +static PyObject *__pyx_pw_15View_dot_MemoryView_10memoryview_1T_1__get__(PyObject *__pyx_v_self); /*proto*/ +static PyObject *__pyx_pw_15View_dot_MemoryView_10memoryview_1T_1__get__(PyObject *__pyx_v_self) { + CYTHON_UNUSED PyObject *const *__pyx_kwvalues; + PyObject *__pyx_r = 0; + __Pyx_RefNannyDeclarations + __Pyx_RefNannySetupContext("__get__ (wrapper)", 0); + __pyx_kwvalues = __Pyx_KwValues_VARARGS(__pyx_args, __pyx_nargs); + __pyx_r = __pyx_pf_15View_dot_MemoryView_10memoryview_1T___get__(((struct __pyx_memoryview_obj *)__pyx_v_self)); + + /* function exit code */ + __Pyx_RefNannyFinishContext(); + return __pyx_r; +} + +static PyObject *__pyx_pf_15View_dot_MemoryView_10memoryview_1T___get__(struct __pyx_memoryview_obj *__pyx_v_self) { + struct __pyx_memoryviewslice_obj *__pyx_v_result = 0; + PyObject *__pyx_r = NULL; + __Pyx_RefNannyDeclarations + PyObject *__pyx_t_1 = NULL; + int __pyx_t_2; + int __pyx_lineno = 0; + const char *__pyx_filename = NULL; + int __pyx_clineno = 0; + __Pyx_RefNannySetupContext("__get__", 0); + + /* "View.MemoryView":557 + * @property + * def T(self): + * cdef _memoryviewslice result = memoryview_copy(self) # <<<<<<<<<<<<<< + * transpose_memslice(&result.from_slice) + * return result +*/ + __pyx_t_1 = __pyx_memoryview_copy_object(__pyx_v_self); if (unlikely(!__pyx_t_1)) __PYX_ERR(1, 557, __pyx_L1_error) + __Pyx_GOTREF(__pyx_t_1); + if (!(likely(((__pyx_t_1) == Py_None) || likely(__Pyx_TypeTest(__pyx_t_1, __pyx_mstate_global->__pyx_memoryviewslice_type))))) __PYX_ERR(1, 557, __pyx_L1_error) + __pyx_v_result = ((struct __pyx_memoryviewslice_obj *)__pyx_t_1); + __pyx_t_1 = 0; + + /* "View.MemoryView":558 + * def T(self): + * cdef _memoryviewslice result = memoryview_copy(self) + * transpose_memslice(&result.from_slice) # <<<<<<<<<<<<<< + * return result + * +*/ + __pyx_t_2 = __pyx_memslice_transpose((&__pyx_v_result->from_slice)); if (unlikely(__pyx_t_2 == ((int)-1))) __PYX_ERR(1, 558, __pyx_L1_error) + + /* "View.MemoryView":559 + * cdef _memoryviewslice result = memoryview_copy(self) + * transpose_memslice(&result.from_slice) + * return result # <<<<<<<<<<<<<< + * + * @property +*/ + __Pyx_XDECREF(__pyx_r); + __Pyx_INCREF((PyObject *)__pyx_v_result); + __pyx_r = ((PyObject *)__pyx_v_result); + goto __pyx_L0; + + /* "View.MemoryView":555 + * + * + * @property # <<<<<<<<<<<<<< + * def T(self): + * cdef _memoryviewslice result = memoryview_copy(self) +*/ + + /* function exit code */ + __pyx_L1_error:; + __Pyx_XDECREF(__pyx_t_1); + __Pyx_AddTraceback("View.MemoryView.memoryview.T.__get__", __pyx_clineno, __pyx_lineno, __pyx_filename); + __pyx_r = NULL; + __pyx_L0:; + __Pyx_XDECREF((PyObject *)__pyx_v_result); + __Pyx_XGIVEREF(__pyx_r); + __Pyx_RefNannyFinishContext(); + return __pyx_r; +} + +/* "View.MemoryView":561 + * return result + * + * @property # <<<<<<<<<<<<<< + * def base(self): + * return self._get_base() +*/ + +/* Python wrapper */ +static PyObject *__pyx_pw_15View_dot_MemoryView_10memoryview_4base_1__get__(PyObject *__pyx_v_self); /*proto*/ +static PyObject *__pyx_pw_15View_dot_MemoryView_10memoryview_4base_1__get__(PyObject *__pyx_v_self) { + CYTHON_UNUSED PyObject *const *__pyx_kwvalues; + PyObject *__pyx_r = 0; + __Pyx_RefNannyDeclarations + __Pyx_RefNannySetupContext("__get__ (wrapper)", 0); + __pyx_kwvalues = __Pyx_KwValues_VARARGS(__pyx_args, __pyx_nargs); + __pyx_r = __pyx_pf_15View_dot_MemoryView_10memoryview_4base___get__(((struct __pyx_memoryview_obj *)__pyx_v_self)); + + /* function exit code */ + __Pyx_RefNannyFinishContext(); + return __pyx_r; +} + +static PyObject *__pyx_pf_15View_dot_MemoryView_10memoryview_4base___get__(struct __pyx_memoryview_obj *__pyx_v_self) { + PyObject *__pyx_r = NULL; + __Pyx_RefNannyDeclarations + PyObject *__pyx_t_1 = NULL; + int __pyx_lineno = 0; + const char *__pyx_filename = NULL; + int __pyx_clineno = 0; + __Pyx_RefNannySetupContext("__get__", 0); + + /* "View.MemoryView":563 + * @property + * def base(self): + * return self._get_base() # <<<<<<<<<<<<<< + * + * cdef _get_base(self): +*/ + __Pyx_XDECREF(__pyx_r); + __pyx_t_1 = ((struct __pyx_vtabstruct_memoryview *)__pyx_v_self->__pyx_vtab)->_get_base(__pyx_v_self); if (unlikely(!__pyx_t_1)) __PYX_ERR(1, 563, __pyx_L1_error) + __Pyx_GOTREF(__pyx_t_1); + __pyx_r = __pyx_t_1; + __pyx_t_1 = 0; + goto __pyx_L0; + + /* "View.MemoryView":561 + * return result + * + * @property # <<<<<<<<<<<<<< + * def base(self): + * return self._get_base() +*/ + + /* function exit code */ + __pyx_L1_error:; + __Pyx_XDECREF(__pyx_t_1); + __Pyx_AddTraceback("View.MemoryView.memoryview.base.__get__", __pyx_clineno, __pyx_lineno, __pyx_filename); + __pyx_r = NULL; + __pyx_L0:; + __Pyx_XGIVEREF(__pyx_r); + __Pyx_RefNannyFinishContext(); + return __pyx_r; +} + +/* "View.MemoryView":565 + * return self._get_base() + * + * cdef _get_base(self): # <<<<<<<<<<<<<< + * return self.obj + * +*/ + +static PyObject *__pyx_memoryview__get_base(struct __pyx_memoryview_obj *__pyx_v_self) { + PyObject *__pyx_r = NULL; + __Pyx_RefNannyDeclarations + __Pyx_RefNannySetupContext("_get_base", 0); + + /* "View.MemoryView":566 + * + * cdef _get_base(self): + * return self.obj # <<<<<<<<<<<<<< + * + * @property +*/ + __Pyx_XDECREF(__pyx_r); + __Pyx_INCREF(__pyx_v_self->obj); + __pyx_r = __pyx_v_self->obj; + goto __pyx_L0; + + /* "View.MemoryView":565 + * return self._get_base() + * + * cdef _get_base(self): # <<<<<<<<<<<<<< + * return self.obj + * +*/ + + /* function exit code */ + __pyx_L0:; + __Pyx_XGIVEREF(__pyx_r); + __Pyx_RefNannyFinishContext(); + return __pyx_r; +} + +/* "View.MemoryView":568 + * return self.obj + * + * @property # <<<<<<<<<<<<<< + * def shape(self): + * return tuple([length for length in self.view.shape[:self.view.ndim]]) +*/ + +/* Python wrapper */ +static PyObject *__pyx_pw_15View_dot_MemoryView_10memoryview_5shape_1__get__(PyObject *__pyx_v_self); /*proto*/ +static PyObject *__pyx_pw_15View_dot_MemoryView_10memoryview_5shape_1__get__(PyObject *__pyx_v_self) { + CYTHON_UNUSED PyObject *const *__pyx_kwvalues; + PyObject *__pyx_r = 0; + __Pyx_RefNannyDeclarations + __Pyx_RefNannySetupContext("__get__ (wrapper)", 0); + __pyx_kwvalues = __Pyx_KwValues_VARARGS(__pyx_args, __pyx_nargs); + __pyx_r = __pyx_pf_15View_dot_MemoryView_10memoryview_5shape___get__(((struct __pyx_memoryview_obj *)__pyx_v_self)); + + /* function exit code */ + __Pyx_RefNannyFinishContext(); + return __pyx_r; +} + +static PyObject *__pyx_pf_15View_dot_MemoryView_10memoryview_5shape___get__(struct __pyx_memoryview_obj *__pyx_v_self) { + Py_ssize_t __pyx_7genexpr__pyx_v_length; + PyObject *__pyx_r = NULL; + __Pyx_RefNannyDeclarations + PyObject *__pyx_t_1 = NULL; + Py_ssize_t *__pyx_t_2; + Py_ssize_t *__pyx_t_3; + Py_ssize_t *__pyx_t_4; + PyObject *__pyx_t_5 = NULL; + int __pyx_lineno = 0; + const char *__pyx_filename = NULL; + int __pyx_clineno = 0; + __Pyx_RefNannySetupContext("__get__", 0); + + /* "View.MemoryView":570 + * @property + * def shape(self): + * return tuple([length for length in self.view.shape[:self.view.ndim]]) # <<<<<<<<<<<<<< + * + * @property +*/ + __Pyx_XDECREF(__pyx_r); + { /* enter inner scope */ + __pyx_t_1 = PyList_New(0); if (unlikely(!__pyx_t_1)) __PYX_ERR(1, 570, __pyx_L1_error) + __Pyx_GOTREF(__pyx_t_1); + __pyx_t_3 = (__pyx_v_self->view.shape + __pyx_v_self->view.ndim); + for (__pyx_t_4 = __pyx_v_self->view.shape; __pyx_t_4 < __pyx_t_3; __pyx_t_4++) { + __pyx_t_2 = __pyx_t_4; + __pyx_7genexpr__pyx_v_length = (__pyx_t_2[0]); + __pyx_t_5 = PyLong_FromSsize_t(__pyx_7genexpr__pyx_v_length); if (unlikely(!__pyx_t_5)) __PYX_ERR(1, 570, __pyx_L1_error) + __Pyx_GOTREF(__pyx_t_5); + if (unlikely(__Pyx_ListComp_Append(__pyx_t_1, (PyObject*)__pyx_t_5))) __PYX_ERR(1, 570, __pyx_L1_error) + __Pyx_DECREF(__pyx_t_5); __pyx_t_5 = 0; + } + } /* exit inner scope */ + __pyx_t_5 = PyList_AsTuple(((PyObject*)__pyx_t_1)); if (unlikely(!__pyx_t_5)) __PYX_ERR(1, 570, __pyx_L1_error) + __Pyx_GOTREF(__pyx_t_5); + __Pyx_DECREF(__pyx_t_1); __pyx_t_1 = 0; + __pyx_r = __pyx_t_5; + __pyx_t_5 = 0; + goto __pyx_L0; + + /* "View.MemoryView":568 + * return self.obj + * + * @property # <<<<<<<<<<<<<< + * def shape(self): + * return tuple([length for length in self.view.shape[:self.view.ndim]]) +*/ + + /* function exit code */ + __pyx_L1_error:; + __Pyx_XDECREF(__pyx_t_1); + __Pyx_XDECREF(__pyx_t_5); + __Pyx_AddTraceback("View.MemoryView.memoryview.shape.__get__", __pyx_clineno, __pyx_lineno, __pyx_filename); + __pyx_r = NULL; + __pyx_L0:; + __Pyx_XGIVEREF(__pyx_r); + __Pyx_RefNannyFinishContext(); + return __pyx_r; +} + +/* "View.MemoryView":572 + * return tuple([length for length in self.view.shape[:self.view.ndim]]) + * + * @property # <<<<<<<<<<<<<< + * def strides(self): + * if self.view.strides == NULL: +*/ + +/* Python wrapper */ +static PyObject *__pyx_pw_15View_dot_MemoryView_10memoryview_7strides_1__get__(PyObject *__pyx_v_self); /*proto*/ +static PyObject *__pyx_pw_15View_dot_MemoryView_10memoryview_7strides_1__get__(PyObject *__pyx_v_self) { + CYTHON_UNUSED PyObject *const *__pyx_kwvalues; + PyObject *__pyx_r = 0; + __Pyx_RefNannyDeclarations + __Pyx_RefNannySetupContext("__get__ (wrapper)", 0); + __pyx_kwvalues = __Pyx_KwValues_VARARGS(__pyx_args, __pyx_nargs); + __pyx_r = __pyx_pf_15View_dot_MemoryView_10memoryview_7strides___get__(((struct __pyx_memoryview_obj *)__pyx_v_self)); + + /* function exit code */ + __Pyx_RefNannyFinishContext(); + return __pyx_r; +} + +static PyObject *__pyx_pf_15View_dot_MemoryView_10memoryview_7strides___get__(struct __pyx_memoryview_obj *__pyx_v_self) { + Py_ssize_t __pyx_8genexpr1__pyx_v_stride; + PyObject *__pyx_r = NULL; + __Pyx_RefNannyDeclarations + int __pyx_t_1; + PyObject *__pyx_t_2 = NULL; + Py_ssize_t *__pyx_t_3; + Py_ssize_t *__pyx_t_4; + Py_ssize_t *__pyx_t_5; + PyObject *__pyx_t_6 = NULL; + int __pyx_lineno = 0; + const char *__pyx_filename = NULL; + int __pyx_clineno = 0; + __Pyx_RefNannySetupContext("__get__", 0); + + /* "View.MemoryView":574 + * @property + * def strides(self): + * if self.view.strides == NULL: # <<<<<<<<<<<<<< + * + * raise ValueError, "Buffer view does not expose strides" +*/ + __pyx_t_1 = (__pyx_v_self->view.strides == NULL); + if (unlikely(__pyx_t_1)) { + + /* "View.MemoryView":576 + * if self.view.strides == NULL: + * + * raise ValueError, "Buffer view does not expose strides" # <<<<<<<<<<<<<< + * + * return tuple([stride for stride in self.view.strides[:self.view.ndim]]) +*/ + __Pyx_Raise(((PyObject *)(((PyTypeObject*)PyExc_ValueError))), __pyx_mstate_global->__pyx_kp_u_Buffer_view_does_not_expose_stri, 0, 0); + __PYX_ERR(1, 576, __pyx_L1_error) + + /* "View.MemoryView":574 + * @property + * def strides(self): + * if self.view.strides == NULL: # <<<<<<<<<<<<<< + * + * raise ValueError, "Buffer view does not expose strides" +*/ + } + + /* "View.MemoryView":578 + * raise ValueError, "Buffer view does not expose strides" + * + * return tuple([stride for stride in self.view.strides[:self.view.ndim]]) # <<<<<<<<<<<<<< + * + * @property +*/ + __Pyx_XDECREF(__pyx_r); + { /* enter inner scope */ + __pyx_t_2 = PyList_New(0); if (unlikely(!__pyx_t_2)) __PYX_ERR(1, 578, __pyx_L1_error) + __Pyx_GOTREF(__pyx_t_2); + __pyx_t_4 = (__pyx_v_self->view.strides + __pyx_v_self->view.ndim); + for (__pyx_t_5 = __pyx_v_self->view.strides; __pyx_t_5 < __pyx_t_4; __pyx_t_5++) { + __pyx_t_3 = __pyx_t_5; + __pyx_8genexpr1__pyx_v_stride = (__pyx_t_3[0]); + __pyx_t_6 = PyLong_FromSsize_t(__pyx_8genexpr1__pyx_v_stride); if (unlikely(!__pyx_t_6)) __PYX_ERR(1, 578, __pyx_L1_error) + __Pyx_GOTREF(__pyx_t_6); + if (unlikely(__Pyx_ListComp_Append(__pyx_t_2, (PyObject*)__pyx_t_6))) __PYX_ERR(1, 578, __pyx_L1_error) + __Pyx_DECREF(__pyx_t_6); __pyx_t_6 = 0; + } + } /* exit inner scope */ + __pyx_t_6 = PyList_AsTuple(((PyObject*)__pyx_t_2)); if (unlikely(!__pyx_t_6)) __PYX_ERR(1, 578, __pyx_L1_error) + __Pyx_GOTREF(__pyx_t_6); + __Pyx_DECREF(__pyx_t_2); __pyx_t_2 = 0; + __pyx_r = __pyx_t_6; + __pyx_t_6 = 0; + goto __pyx_L0; + + /* "View.MemoryView":572 + * return tuple([length for length in self.view.shape[:self.view.ndim]]) + * + * @property # <<<<<<<<<<<<<< + * def strides(self): + * if self.view.strides == NULL: +*/ + + /* function exit code */ + __pyx_L1_error:; + __Pyx_XDECREF(__pyx_t_2); + __Pyx_XDECREF(__pyx_t_6); + __Pyx_AddTraceback("View.MemoryView.memoryview.strides.__get__", __pyx_clineno, __pyx_lineno, __pyx_filename); + __pyx_r = NULL; + __pyx_L0:; + __Pyx_XGIVEREF(__pyx_r); + __Pyx_RefNannyFinishContext(); + return __pyx_r; +} + +/* "View.MemoryView":580 + * return tuple([stride for stride in self.view.strides[:self.view.ndim]]) + * + * @property # <<<<<<<<<<<<<< + * def suboffsets(self): + * if self.view.suboffsets == NULL: +*/ + +/* Python wrapper */ +static PyObject *__pyx_pw_15View_dot_MemoryView_10memoryview_10suboffsets_1__get__(PyObject *__pyx_v_self); /*proto*/ +static PyObject *__pyx_pw_15View_dot_MemoryView_10memoryview_10suboffsets_1__get__(PyObject *__pyx_v_self) { + CYTHON_UNUSED PyObject *const *__pyx_kwvalues; + PyObject *__pyx_r = 0; + __Pyx_RefNannyDeclarations + __Pyx_RefNannySetupContext("__get__ (wrapper)", 0); + __pyx_kwvalues = __Pyx_KwValues_VARARGS(__pyx_args, __pyx_nargs); + __pyx_r = __pyx_pf_15View_dot_MemoryView_10memoryview_10suboffsets___get__(((struct __pyx_memoryview_obj *)__pyx_v_self)); + + /* function exit code */ + __Pyx_RefNannyFinishContext(); + return __pyx_r; +} + +static PyObject *__pyx_pf_15View_dot_MemoryView_10memoryview_10suboffsets___get__(struct __pyx_memoryview_obj *__pyx_v_self) { + Py_ssize_t __pyx_8genexpr2__pyx_v_suboffset; + PyObject *__pyx_r = NULL; + __Pyx_RefNannyDeclarations + int __pyx_t_1; + PyObject *__pyx_t_2 = NULL; + Py_ssize_t *__pyx_t_3; + Py_ssize_t *__pyx_t_4; + Py_ssize_t *__pyx_t_5; + PyObject *__pyx_t_6 = NULL; + int __pyx_lineno = 0; + const char *__pyx_filename = NULL; + int __pyx_clineno = 0; + __Pyx_RefNannySetupContext("__get__", 0); + + /* "View.MemoryView":582 + * @property + * def suboffsets(self): + * if self.view.suboffsets == NULL: # <<<<<<<<<<<<<< + * return (-1,) * self.view.ndim + * +*/ + __pyx_t_1 = (__pyx_v_self->view.suboffsets == NULL); + if (__pyx_t_1) { + + /* "View.MemoryView":583 + * def suboffsets(self): + * if self.view.suboffsets == NULL: + * return (-1,) * self.view.ndim # <<<<<<<<<<<<<< + * + * return tuple([suboffset for suboffset in self.view.suboffsets[:self.view.ndim]]) +*/ + __Pyx_XDECREF(__pyx_r); + __pyx_t_2 = __Pyx_PySequence_Multiply(__pyx_mstate_global->__pyx_tuple[1], __pyx_v_self->view.ndim); if (unlikely(!__pyx_t_2)) __PYX_ERR(1, 583, __pyx_L1_error) + __Pyx_GOTREF(__pyx_t_2); + __pyx_r = __pyx_t_2; + __pyx_t_2 = 0; + goto __pyx_L0; + + /* "View.MemoryView":582 + * @property + * def suboffsets(self): + * if self.view.suboffsets == NULL: # <<<<<<<<<<<<<< + * return (-1,) * self.view.ndim + * +*/ + } + + /* "View.MemoryView":585 + * return (-1,) * self.view.ndim + * + * return tuple([suboffset for suboffset in self.view.suboffsets[:self.view.ndim]]) # <<<<<<<<<<<<<< + * + * @property +*/ + __Pyx_XDECREF(__pyx_r); + { /* enter inner scope */ + __pyx_t_2 = PyList_New(0); if (unlikely(!__pyx_t_2)) __PYX_ERR(1, 585, __pyx_L1_error) + __Pyx_GOTREF(__pyx_t_2); + __pyx_t_4 = (__pyx_v_self->view.suboffsets + __pyx_v_self->view.ndim); + for (__pyx_t_5 = __pyx_v_self->view.suboffsets; __pyx_t_5 < __pyx_t_4; __pyx_t_5++) { + __pyx_t_3 = __pyx_t_5; + __pyx_8genexpr2__pyx_v_suboffset = (__pyx_t_3[0]); + __pyx_t_6 = PyLong_FromSsize_t(__pyx_8genexpr2__pyx_v_suboffset); if (unlikely(!__pyx_t_6)) __PYX_ERR(1, 585, __pyx_L1_error) + __Pyx_GOTREF(__pyx_t_6); + if (unlikely(__Pyx_ListComp_Append(__pyx_t_2, (PyObject*)__pyx_t_6))) __PYX_ERR(1, 585, __pyx_L1_error) + __Pyx_DECREF(__pyx_t_6); __pyx_t_6 = 0; + } + } /* exit inner scope */ + __pyx_t_6 = PyList_AsTuple(((PyObject*)__pyx_t_2)); if (unlikely(!__pyx_t_6)) __PYX_ERR(1, 585, __pyx_L1_error) + __Pyx_GOTREF(__pyx_t_6); + __Pyx_DECREF(__pyx_t_2); __pyx_t_2 = 0; + __pyx_r = __pyx_t_6; + __pyx_t_6 = 0; + goto __pyx_L0; + + /* "View.MemoryView":580 + * return tuple([stride for stride in self.view.strides[:self.view.ndim]]) + * + * @property # <<<<<<<<<<<<<< + * def suboffsets(self): + * if self.view.suboffsets == NULL: +*/ + + /* function exit code */ + __pyx_L1_error:; + __Pyx_XDECREF(__pyx_t_2); + __Pyx_XDECREF(__pyx_t_6); + __Pyx_AddTraceback("View.MemoryView.memoryview.suboffsets.__get__", __pyx_clineno, __pyx_lineno, __pyx_filename); + __pyx_r = NULL; + __pyx_L0:; + __Pyx_XGIVEREF(__pyx_r); + __Pyx_RefNannyFinishContext(); + return __pyx_r; +} + +/* "View.MemoryView":587 + * return tuple([suboffset for suboffset in self.view.suboffsets[:self.view.ndim]]) + * + * @property # <<<<<<<<<<<<<< + * def ndim(self): + * return self.view.ndim +*/ + +/* Python wrapper */ +static PyObject *__pyx_pw_15View_dot_MemoryView_10memoryview_4ndim_1__get__(PyObject *__pyx_v_self); /*proto*/ +static PyObject *__pyx_pw_15View_dot_MemoryView_10memoryview_4ndim_1__get__(PyObject *__pyx_v_self) { + CYTHON_UNUSED PyObject *const *__pyx_kwvalues; + PyObject *__pyx_r = 0; + __Pyx_RefNannyDeclarations + __Pyx_RefNannySetupContext("__get__ (wrapper)", 0); + __pyx_kwvalues = __Pyx_KwValues_VARARGS(__pyx_args, __pyx_nargs); + __pyx_r = __pyx_pf_15View_dot_MemoryView_10memoryview_4ndim___get__(((struct __pyx_memoryview_obj *)__pyx_v_self)); + + /* function exit code */ + __Pyx_RefNannyFinishContext(); + return __pyx_r; +} + +static PyObject *__pyx_pf_15View_dot_MemoryView_10memoryview_4ndim___get__(struct __pyx_memoryview_obj *__pyx_v_self) { + PyObject *__pyx_r = NULL; + __Pyx_RefNannyDeclarations + PyObject *__pyx_t_1 = NULL; + int __pyx_lineno = 0; + const char *__pyx_filename = NULL; + int __pyx_clineno = 0; + __Pyx_RefNannySetupContext("__get__", 0); + + /* "View.MemoryView":589 + * @property + * def ndim(self): + * return self.view.ndim # <<<<<<<<<<<<<< + * + * @property +*/ + __Pyx_XDECREF(__pyx_r); + __pyx_t_1 = __Pyx_PyLong_From_int(__pyx_v_self->view.ndim); if (unlikely(!__pyx_t_1)) __PYX_ERR(1, 589, __pyx_L1_error) + __Pyx_GOTREF(__pyx_t_1); + __pyx_r = __pyx_t_1; + __pyx_t_1 = 0; + goto __pyx_L0; + + /* "View.MemoryView":587 + * return tuple([suboffset for suboffset in self.view.suboffsets[:self.view.ndim]]) + * + * @property # <<<<<<<<<<<<<< + * def ndim(self): + * return self.view.ndim +*/ + + /* function exit code */ + __pyx_L1_error:; + __Pyx_XDECREF(__pyx_t_1); + __Pyx_AddTraceback("View.MemoryView.memoryview.ndim.__get__", __pyx_clineno, __pyx_lineno, __pyx_filename); + __pyx_r = NULL; + __pyx_L0:; + __Pyx_XGIVEREF(__pyx_r); + __Pyx_RefNannyFinishContext(); + return __pyx_r; +} + +/* "View.MemoryView":591 + * return self.view.ndim + * + * @property # <<<<<<<<<<<<<< + * def itemsize(self): + * return self.view.itemsize +*/ + +/* Python wrapper */ +static PyObject *__pyx_pw_15View_dot_MemoryView_10memoryview_8itemsize_1__get__(PyObject *__pyx_v_self); /*proto*/ +static PyObject *__pyx_pw_15View_dot_MemoryView_10memoryview_8itemsize_1__get__(PyObject *__pyx_v_self) { + CYTHON_UNUSED PyObject *const *__pyx_kwvalues; + PyObject *__pyx_r = 0; + __Pyx_RefNannyDeclarations + __Pyx_RefNannySetupContext("__get__ (wrapper)", 0); + __pyx_kwvalues = __Pyx_KwValues_VARARGS(__pyx_args, __pyx_nargs); + __pyx_r = __pyx_pf_15View_dot_MemoryView_10memoryview_8itemsize___get__(((struct __pyx_memoryview_obj *)__pyx_v_self)); + + /* function exit code */ + __Pyx_RefNannyFinishContext(); + return __pyx_r; +} + +static PyObject *__pyx_pf_15View_dot_MemoryView_10memoryview_8itemsize___get__(struct __pyx_memoryview_obj *__pyx_v_self) { + PyObject *__pyx_r = NULL; + __Pyx_RefNannyDeclarations + PyObject *__pyx_t_1 = NULL; + int __pyx_lineno = 0; + const char *__pyx_filename = NULL; + int __pyx_clineno = 0; + __Pyx_RefNannySetupContext("__get__", 0); + + /* "View.MemoryView":593 + * @property + * def itemsize(self): + * return self.view.itemsize # <<<<<<<<<<<<<< + * + * @property +*/ + __Pyx_XDECREF(__pyx_r); + __pyx_t_1 = PyLong_FromSsize_t(__pyx_v_self->view.itemsize); if (unlikely(!__pyx_t_1)) __PYX_ERR(1, 593, __pyx_L1_error) + __Pyx_GOTREF(__pyx_t_1); + __pyx_r = __pyx_t_1; + __pyx_t_1 = 0; + goto __pyx_L0; + + /* "View.MemoryView":591 + * return self.view.ndim + * + * @property # <<<<<<<<<<<<<< + * def itemsize(self): + * return self.view.itemsize +*/ + + /* function exit code */ + __pyx_L1_error:; + __Pyx_XDECREF(__pyx_t_1); + __Pyx_AddTraceback("View.MemoryView.memoryview.itemsize.__get__", __pyx_clineno, __pyx_lineno, __pyx_filename); + __pyx_r = NULL; + __pyx_L0:; + __Pyx_XGIVEREF(__pyx_r); + __Pyx_RefNannyFinishContext(); + return __pyx_r; +} + +/* "View.MemoryView":595 + * return self.view.itemsize + * + * @property # <<<<<<<<<<<<<< + * def nbytes(self): + * return self.size * self.view.itemsize +*/ + +/* Python wrapper */ +static PyObject *__pyx_pw_15View_dot_MemoryView_10memoryview_6nbytes_1__get__(PyObject *__pyx_v_self); /*proto*/ +static PyObject *__pyx_pw_15View_dot_MemoryView_10memoryview_6nbytes_1__get__(PyObject *__pyx_v_self) { + CYTHON_UNUSED PyObject *const *__pyx_kwvalues; + PyObject *__pyx_r = 0; + __Pyx_RefNannyDeclarations + __Pyx_RefNannySetupContext("__get__ (wrapper)", 0); + __pyx_kwvalues = __Pyx_KwValues_VARARGS(__pyx_args, __pyx_nargs); + __pyx_r = __pyx_pf_15View_dot_MemoryView_10memoryview_6nbytes___get__(((struct __pyx_memoryview_obj *)__pyx_v_self)); + + /* function exit code */ + __Pyx_RefNannyFinishContext(); + return __pyx_r; +} + +static PyObject *__pyx_pf_15View_dot_MemoryView_10memoryview_6nbytes___get__(struct __pyx_memoryview_obj *__pyx_v_self) { + PyObject *__pyx_r = NULL; + __Pyx_RefNannyDeclarations + PyObject *__pyx_t_1 = NULL; + PyObject *__pyx_t_2 = NULL; + PyObject *__pyx_t_3 = NULL; + int __pyx_lineno = 0; + const char *__pyx_filename = NULL; + int __pyx_clineno = 0; + __Pyx_RefNannySetupContext("__get__", 0); + + /* "View.MemoryView":597 + * @property + * def nbytes(self): + * return self.size * self.view.itemsize # <<<<<<<<<<<<<< + * + * @property +*/ + __Pyx_XDECREF(__pyx_r); + __pyx_t_1 = __Pyx_PyObject_GetAttrStr(((PyObject *)__pyx_v_self), __pyx_mstate_global->__pyx_n_u_size); if (unlikely(!__pyx_t_1)) __PYX_ERR(1, 597, __pyx_L1_error) + __Pyx_GOTREF(__pyx_t_1); + __pyx_t_2 = PyLong_FromSsize_t(__pyx_v_self->view.itemsize); if (unlikely(!__pyx_t_2)) __PYX_ERR(1, 597, __pyx_L1_error) + __Pyx_GOTREF(__pyx_t_2); + __pyx_t_3 = PyNumber_Multiply(__pyx_t_1, __pyx_t_2); if (unlikely(!__pyx_t_3)) __PYX_ERR(1, 597, __pyx_L1_error) + __Pyx_GOTREF(__pyx_t_3); + __Pyx_DECREF(__pyx_t_1); __pyx_t_1 = 0; + __Pyx_DECREF(__pyx_t_2); __pyx_t_2 = 0; + __pyx_r = __pyx_t_3; + __pyx_t_3 = 0; + goto __pyx_L0; + + /* "View.MemoryView":595 + * return self.view.itemsize + * + * @property # <<<<<<<<<<<<<< + * def nbytes(self): + * return self.size * self.view.itemsize +*/ + + /* function exit code */ + __pyx_L1_error:; + __Pyx_XDECREF(__pyx_t_1); + __Pyx_XDECREF(__pyx_t_2); + __Pyx_XDECREF(__pyx_t_3); + __Pyx_AddTraceback("View.MemoryView.memoryview.nbytes.__get__", __pyx_clineno, __pyx_lineno, __pyx_filename); + __pyx_r = NULL; + __pyx_L0:; + __Pyx_XGIVEREF(__pyx_r); + __Pyx_RefNannyFinishContext(); + return __pyx_r; +} + +/* "View.MemoryView":599 + * return self.size * self.view.itemsize + * + * @property # <<<<<<<<<<<<<< + * def size(self): + * if self._size is None: +*/ + +/* Python wrapper */ +static PyObject *__pyx_pw_15View_dot_MemoryView_10memoryview_4size_1__get__(PyObject *__pyx_v_self); /*proto*/ +static PyObject *__pyx_pw_15View_dot_MemoryView_10memoryview_4size_1__get__(PyObject *__pyx_v_self) { + CYTHON_UNUSED PyObject *const *__pyx_kwvalues; + PyObject *__pyx_r = 0; + __Pyx_RefNannyDeclarations + __Pyx_RefNannySetupContext("__get__ (wrapper)", 0); + __pyx_kwvalues = __Pyx_KwValues_VARARGS(__pyx_args, __pyx_nargs); + __pyx_r = __pyx_pf_15View_dot_MemoryView_10memoryview_4size___get__(((struct __pyx_memoryview_obj *)__pyx_v_self)); + + /* function exit code */ + __Pyx_RefNannyFinishContext(); + return __pyx_r; +} + +static PyObject *__pyx_pf_15View_dot_MemoryView_10memoryview_4size___get__(struct __pyx_memoryview_obj *__pyx_v_self) { + PyObject *__pyx_v_result = NULL; + PyObject *__pyx_v_length = NULL; + PyObject *__pyx_r = NULL; + __Pyx_RefNannyDeclarations + int __pyx_t_1; + Py_ssize_t *__pyx_t_2; + Py_ssize_t *__pyx_t_3; + Py_ssize_t *__pyx_t_4; + PyObject *__pyx_t_5 = NULL; + int __pyx_lineno = 0; + const char *__pyx_filename = NULL; + int __pyx_clineno = 0; + __Pyx_RefNannySetupContext("__get__", 0); + + /* "View.MemoryView":601 + * @property + * def size(self): + * if self._size is None: # <<<<<<<<<<<<<< + * result = 1 + * +*/ + __pyx_t_1 = (__pyx_v_self->_size == Py_None); + if (__pyx_t_1) { + + /* "View.MemoryView":602 + * def size(self): + * if self._size is None: + * result = 1 # <<<<<<<<<<<<<< + * + * for length in self.view.shape[:self.view.ndim]: +*/ + __Pyx_INCREF(__pyx_mstate_global->__pyx_int_1); + __pyx_v_result = __pyx_mstate_global->__pyx_int_1; + + /* "View.MemoryView":604 + * result = 1 + * + * for length in self.view.shape[:self.view.ndim]: # <<<<<<<<<<<<<< + * result *= length + * +*/ + __pyx_t_3 = (__pyx_v_self->view.shape + __pyx_v_self->view.ndim); + for (__pyx_t_4 = __pyx_v_self->view.shape; __pyx_t_4 < __pyx_t_3; __pyx_t_4++) { + __pyx_t_2 = __pyx_t_4; + __pyx_t_5 = PyLong_FromSsize_t((__pyx_t_2[0])); if (unlikely(!__pyx_t_5)) __PYX_ERR(1, 604, __pyx_L1_error) + __Pyx_GOTREF(__pyx_t_5); + __Pyx_XDECREF_SET(__pyx_v_length, __pyx_t_5); + __pyx_t_5 = 0; + + /* "View.MemoryView":605 + * + * for length in self.view.shape[:self.view.ndim]: + * result *= length # <<<<<<<<<<<<<< + * + * self._size = result +*/ + __pyx_t_5 = PyNumber_InPlaceMultiply(__pyx_v_result, __pyx_v_length); if (unlikely(!__pyx_t_5)) __PYX_ERR(1, 605, __pyx_L1_error) + __Pyx_GOTREF(__pyx_t_5); + __Pyx_DECREF_SET(__pyx_v_result, __pyx_t_5); + __pyx_t_5 = 0; + } + + /* "View.MemoryView":607 + * result *= length + * + * self._size = result # <<<<<<<<<<<<<< + * + * return self._size +*/ + __Pyx_INCREF(__pyx_v_result); + __Pyx_GIVEREF(__pyx_v_result); + __Pyx_GOTREF(__pyx_v_self->_size); + __Pyx_DECREF(__pyx_v_self->_size); + __pyx_v_self->_size = __pyx_v_result; + + /* "View.MemoryView":601 + * @property + * def size(self): + * if self._size is None: # <<<<<<<<<<<<<< + * result = 1 + * +*/ + } + + /* "View.MemoryView":609 + * self._size = result + * + * return self._size # <<<<<<<<<<<<<< + * + * def __len__(self): +*/ + __Pyx_XDECREF(__pyx_r); + __Pyx_INCREF(__pyx_v_self->_size); + __pyx_r = __pyx_v_self->_size; + goto __pyx_L0; + + /* "View.MemoryView":599 + * return self.size * self.view.itemsize + * + * @property # <<<<<<<<<<<<<< + * def size(self): + * if self._size is None: +*/ + + /* function exit code */ + __pyx_L1_error:; + __Pyx_XDECREF(__pyx_t_5); + __Pyx_AddTraceback("View.MemoryView.memoryview.size.__get__", __pyx_clineno, __pyx_lineno, __pyx_filename); + __pyx_r = NULL; + __pyx_L0:; + __Pyx_XDECREF(__pyx_v_result); + __Pyx_XDECREF(__pyx_v_length); + __Pyx_XGIVEREF(__pyx_r); + __Pyx_RefNannyFinishContext(); + return __pyx_r; +} + +/* "View.MemoryView":611 + * return self._size + * + * def __len__(self): # <<<<<<<<<<<<<< + * if self.view.ndim >= 1: + * return self.view.shape[0] +*/ + +/* Python wrapper */ +static Py_ssize_t __pyx_memoryview___len__(PyObject *__pyx_v_self); /*proto*/ +static Py_ssize_t __pyx_memoryview___len__(PyObject *__pyx_v_self) { + CYTHON_UNUSED PyObject *const *__pyx_kwvalues; + Py_ssize_t __pyx_r; + __Pyx_RefNannyDeclarations + __Pyx_RefNannySetupContext("__len__ (wrapper)", 0); + __pyx_kwvalues = __Pyx_KwValues_VARARGS(__pyx_args, __pyx_nargs); + __pyx_r = __pyx_memoryview___pyx_pf_15View_dot_MemoryView_10memoryview_10__len__(((struct __pyx_memoryview_obj *)__pyx_v_self)); + + /* function exit code */ + __Pyx_RefNannyFinishContext(); + return __pyx_r; +} + +static Py_ssize_t __pyx_memoryview___pyx_pf_15View_dot_MemoryView_10memoryview_10__len__(struct __pyx_memoryview_obj *__pyx_v_self) { + Py_ssize_t __pyx_r; + int __pyx_t_1; + + /* "View.MemoryView":612 + * + * def __len__(self): + * if self.view.ndim >= 1: # <<<<<<<<<<<<<< + * return self.view.shape[0] + * +*/ + __pyx_t_1 = (__pyx_v_self->view.ndim >= 1); + if (__pyx_t_1) { + + /* "View.MemoryView":613 + * def __len__(self): + * if self.view.ndim >= 1: + * return self.view.shape[0] # <<<<<<<<<<<<<< + * + * return 0 +*/ + __pyx_r = (__pyx_v_self->view.shape[0]); + goto __pyx_L0; + + /* "View.MemoryView":612 + * + * def __len__(self): + * if self.view.ndim >= 1: # <<<<<<<<<<<<<< + * return self.view.shape[0] + * +*/ + } + + /* "View.MemoryView":615 + * return self.view.shape[0] + * + * return 0 # <<<<<<<<<<<<<< + * + * def __repr__(self): +*/ + __pyx_r = 0; + goto __pyx_L0; + + /* "View.MemoryView":611 + * return self._size + * + * def __len__(self): # <<<<<<<<<<<<<< + * if self.view.ndim >= 1: + * return self.view.shape[0] +*/ + + /* function exit code */ + __pyx_L0:; + return __pyx_r; +} + +/* "View.MemoryView":617 + * return 0 + * + * def __repr__(self): # <<<<<<<<<<<<<< + * return "" % (self.base.__class__.__name__, + * id(self)) +*/ + +/* Python wrapper */ +static PyObject *__pyx_memoryview___repr__(PyObject *__pyx_v_self); /*proto*/ +static PyObject *__pyx_memoryview___repr__(PyObject *__pyx_v_self) { + CYTHON_UNUSED PyObject *const *__pyx_kwvalues; + PyObject *__pyx_r = 0; + __Pyx_RefNannyDeclarations + __Pyx_RefNannySetupContext("__repr__ (wrapper)", 0); + __pyx_kwvalues = __Pyx_KwValues_VARARGS(__pyx_args, __pyx_nargs); + __pyx_r = __pyx_memoryview___pyx_pf_15View_dot_MemoryView_10memoryview_12__repr__(((struct __pyx_memoryview_obj *)__pyx_v_self)); + + /* function exit code */ + __Pyx_RefNannyFinishContext(); + return __pyx_r; +} + +static PyObject *__pyx_memoryview___pyx_pf_15View_dot_MemoryView_10memoryview_12__repr__(struct __pyx_memoryview_obj *__pyx_v_self) { + PyObject *__pyx_r = NULL; + __Pyx_RefNannyDeclarations + PyObject *__pyx_t_1 = NULL; + PyObject *__pyx_t_2 = NULL; + PyObject *__pyx_t_3 = NULL; + PyObject *__pyx_t_4[5]; + int __pyx_lineno = 0; + const char *__pyx_filename = NULL; + int __pyx_clineno = 0; + __Pyx_RefNannySetupContext("__repr__", 0); + + /* "View.MemoryView":618 + * + * def __repr__(self): + * return "" % (self.base.__class__.__name__, # <<<<<<<<<<<<<< + * id(self)) + * +*/ + __Pyx_XDECREF(__pyx_r); + __pyx_t_1 = __Pyx_PyObject_GetAttrStr(((PyObject *)__pyx_v_self), __pyx_mstate_global->__pyx_n_u_base); if (unlikely(!__pyx_t_1)) __PYX_ERR(1, 618, __pyx_L1_error) + __Pyx_GOTREF(__pyx_t_1); + __pyx_t_2 = __Pyx_PyObject_GetAttrStr(__pyx_t_1, __pyx_mstate_global->__pyx_n_u_class); if (unlikely(!__pyx_t_2)) __PYX_ERR(1, 618, __pyx_L1_error) + __Pyx_GOTREF(__pyx_t_2); + __Pyx_DECREF(__pyx_t_1); __pyx_t_1 = 0; + __pyx_t_1 = __Pyx_PyObject_GetAttrStr(__pyx_t_2, __pyx_mstate_global->__pyx_n_u_name_2); if (unlikely(!__pyx_t_1)) __PYX_ERR(1, 618, __pyx_L1_error) + __Pyx_GOTREF(__pyx_t_1); + __Pyx_DECREF(__pyx_t_2); __pyx_t_2 = 0; + __pyx_t_2 = __Pyx_PyObject_FormatSimpleAndDecref(PyObject_Repr(__pyx_t_1), __pyx_mstate_global->__pyx_empty_unicode); if (unlikely(!__pyx_t_2)) __PYX_ERR(1, 618, __pyx_L1_error) + __Pyx_GOTREF(__pyx_t_2); + __Pyx_DECREF(__pyx_t_1); __pyx_t_1 = 0; + + /* "View.MemoryView":619 + * def __repr__(self): + * return "" % (self.base.__class__.__name__, + * id(self)) # <<<<<<<<<<<<<< + * + * def __str__(self): +*/ + __pyx_t_1 = __Pyx_PyObject_CallOneArg(__pyx_builtin_id, ((PyObject *)__pyx_v_self)); if (unlikely(!__pyx_t_1)) __PYX_ERR(1, 619, __pyx_L1_error) + __Pyx_GOTREF(__pyx_t_1); + __pyx_t_3 = __Pyx_PyObject_Format(__pyx_t_1, __pyx_mstate_global->__pyx_n_u_x); if (unlikely(!__pyx_t_3)) __PYX_ERR(1, 619, __pyx_L1_error) + __Pyx_GOTREF(__pyx_t_3); + __Pyx_DECREF(__pyx_t_1); __pyx_t_1 = 0; + __pyx_t_4[0] = __pyx_mstate_global->__pyx_kp_u_MemoryView_of; + __pyx_t_4[1] = __pyx_t_2; + __pyx_t_4[2] = __pyx_mstate_global->__pyx_kp_u_at_0x; + __pyx_t_4[3] = __pyx_t_3; + __pyx_t_4[4] = __pyx_mstate_global->__pyx_kp_u__3; + + /* "View.MemoryView":618 + * + * def __repr__(self): + * return "" % (self.base.__class__.__name__, # <<<<<<<<<<<<<< + * id(self)) + * +*/ + __pyx_t_1 = __Pyx_PyUnicode_Join(__pyx_t_4, 5, 15 + __Pyx_PyUnicode_GET_LENGTH(__pyx_t_2) + 6 + __Pyx_PyUnicode_GET_LENGTH(__pyx_t_3) + 1, 127 | __Pyx_PyUnicode_MAX_CHAR_VALUE(__pyx_t_2) | __Pyx_PyUnicode_MAX_CHAR_VALUE(__pyx_t_3)); + if (unlikely(!__pyx_t_1)) __PYX_ERR(1, 618, __pyx_L1_error) + __Pyx_GOTREF(__pyx_t_1); + __Pyx_DECREF(__pyx_t_2); __pyx_t_2 = 0; + __Pyx_DECREF(__pyx_t_3); __pyx_t_3 = 0; + __pyx_r = __pyx_t_1; + __pyx_t_1 = 0; + goto __pyx_L0; + + /* "View.MemoryView":617 + * return 0 + * + * def __repr__(self): # <<<<<<<<<<<<<< + * return "" % (self.base.__class__.__name__, + * id(self)) +*/ + + /* function exit code */ + __pyx_L1_error:; + __Pyx_XDECREF(__pyx_t_1); + __Pyx_XDECREF(__pyx_t_2); + __Pyx_XDECREF(__pyx_t_3); + __Pyx_AddTraceback("View.MemoryView.memoryview.__repr__", __pyx_clineno, __pyx_lineno, __pyx_filename); + __pyx_r = NULL; + __pyx_L0:; + __Pyx_XGIVEREF(__pyx_r); + __Pyx_RefNannyFinishContext(); + return __pyx_r; +} + +/* "View.MemoryView":621 + * id(self)) + * + * def __str__(self): # <<<<<<<<<<<<<< + * return "" % (self.base.__class__.__name__,) + * +*/ + +/* Python wrapper */ +static PyObject *__pyx_memoryview___str__(PyObject *__pyx_v_self); /*proto*/ +static PyObject *__pyx_memoryview___str__(PyObject *__pyx_v_self) { + CYTHON_UNUSED PyObject *const *__pyx_kwvalues; + PyObject *__pyx_r = 0; + __Pyx_RefNannyDeclarations + __Pyx_RefNannySetupContext("__str__ (wrapper)", 0); + __pyx_kwvalues = __Pyx_KwValues_VARARGS(__pyx_args, __pyx_nargs); + __pyx_r = __pyx_memoryview___pyx_pf_15View_dot_MemoryView_10memoryview_14__str__(((struct __pyx_memoryview_obj *)__pyx_v_self)); + + /* function exit code */ + __Pyx_RefNannyFinishContext(); + return __pyx_r; +} + +static PyObject *__pyx_memoryview___pyx_pf_15View_dot_MemoryView_10memoryview_14__str__(struct __pyx_memoryview_obj *__pyx_v_self) { + PyObject *__pyx_r = NULL; + __Pyx_RefNannyDeclarations + PyObject *__pyx_t_1 = NULL; + PyObject *__pyx_t_2 = NULL; + PyObject *__pyx_t_3[3]; + int __pyx_lineno = 0; + const char *__pyx_filename = NULL; + int __pyx_clineno = 0; + __Pyx_RefNannySetupContext("__str__", 0); + + /* "View.MemoryView":622 + * + * def __str__(self): + * return "" % (self.base.__class__.__name__,) # <<<<<<<<<<<<<< + * + * +*/ + __Pyx_XDECREF(__pyx_r); + __pyx_t_1 = __Pyx_PyObject_GetAttrStr(((PyObject *)__pyx_v_self), __pyx_mstate_global->__pyx_n_u_base); if (unlikely(!__pyx_t_1)) __PYX_ERR(1, 622, __pyx_L1_error) + __Pyx_GOTREF(__pyx_t_1); + __pyx_t_2 = __Pyx_PyObject_GetAttrStr(__pyx_t_1, __pyx_mstate_global->__pyx_n_u_class); if (unlikely(!__pyx_t_2)) __PYX_ERR(1, 622, __pyx_L1_error) + __Pyx_GOTREF(__pyx_t_2); + __Pyx_DECREF(__pyx_t_1); __pyx_t_1 = 0; + __pyx_t_1 = __Pyx_PyObject_GetAttrStr(__pyx_t_2, __pyx_mstate_global->__pyx_n_u_name_2); if (unlikely(!__pyx_t_1)) __PYX_ERR(1, 622, __pyx_L1_error) + __Pyx_GOTREF(__pyx_t_1); + __Pyx_DECREF(__pyx_t_2); __pyx_t_2 = 0; + __pyx_t_2 = __Pyx_PyObject_FormatSimpleAndDecref(PyObject_Repr(__pyx_t_1), __pyx_mstate_global->__pyx_empty_unicode); if (unlikely(!__pyx_t_2)) __PYX_ERR(1, 622, __pyx_L1_error) + __Pyx_GOTREF(__pyx_t_2); + __Pyx_DECREF(__pyx_t_1); __pyx_t_1 = 0; + __pyx_t_3[0] = __pyx_mstate_global->__pyx_kp_u_MemoryView_of; + __pyx_t_3[1] = __pyx_t_2; + __pyx_t_3[2] = __pyx_mstate_global->__pyx_kp_u_object; + __pyx_t_1 = __Pyx_PyUnicode_Join(__pyx_t_3, 3, 15 + __Pyx_PyUnicode_GET_LENGTH(__pyx_t_2) + 8, 127 | __Pyx_PyUnicode_MAX_CHAR_VALUE(__pyx_t_2)); + if (unlikely(!__pyx_t_1)) __PYX_ERR(1, 622, __pyx_L1_error) + __Pyx_GOTREF(__pyx_t_1); + __Pyx_DECREF(__pyx_t_2); __pyx_t_2 = 0; + __pyx_r = __pyx_t_1; + __pyx_t_1 = 0; + goto __pyx_L0; + + /* "View.MemoryView":621 + * id(self)) + * + * def __str__(self): # <<<<<<<<<<<<<< + * return "" % (self.base.__class__.__name__,) + * +*/ + + /* function exit code */ + __pyx_L1_error:; + __Pyx_XDECREF(__pyx_t_1); + __Pyx_XDECREF(__pyx_t_2); + __Pyx_AddTraceback("View.MemoryView.memoryview.__str__", __pyx_clineno, __pyx_lineno, __pyx_filename); + __pyx_r = NULL; + __pyx_L0:; + __Pyx_XGIVEREF(__pyx_r); + __Pyx_RefNannyFinishContext(); + return __pyx_r; +} + +/* "View.MemoryView":625 + * + * + * def is_c_contig(self): # <<<<<<<<<<<<<< + * cdef __Pyx_memviewslice *mslice + * cdef __Pyx_memviewslice tmp +*/ + +/* Python wrapper */ +static PyObject *__pyx_memoryview_is_c_contig(PyObject *__pyx_v_self, +#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*/ +static PyObject *__pyx_memoryview_is_c_contig(PyObject *__pyx_v_self, +#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_c_contig (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_c_contig", 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_c_contig", __pyx_kwds); return NULL;} + __pyx_r = __pyx_memoryview___pyx_pf_15View_dot_MemoryView_10memoryview_16is_c_contig(((struct __pyx_memoryview_obj *)__pyx_v_self)); + + /* function exit code */ + __Pyx_RefNannyFinishContext(); + return __pyx_r; +} + +static PyObject *__pyx_memoryview___pyx_pf_15View_dot_MemoryView_10memoryview_16is_c_contig(struct __pyx_memoryview_obj *__pyx_v_self) { + __Pyx_memviewslice *__pyx_v_mslice; + __Pyx_memviewslice __pyx_v_tmp; + PyObject *__pyx_r = NULL; + __Pyx_RefNannyDeclarations + __Pyx_memviewslice *__pyx_t_1; + PyObject *__pyx_t_2 = NULL; + int __pyx_lineno = 0; + const char *__pyx_filename = NULL; + int __pyx_clineno = 0; + __Pyx_RefNannySetupContext("is_c_contig", 0); + + /* "View.MemoryView":628 + * cdef __Pyx_memviewslice *mslice + * cdef __Pyx_memviewslice tmp + * mslice = get_slice_from_memview(self, &tmp) # <<<<<<<<<<<<<< + * return slice_is_contig(mslice[0], 'C', self.view.ndim) + * +*/ + __pyx_t_1 = __pyx_memoryview_get_slice_from_memoryview(__pyx_v_self, (&__pyx_v_tmp)); if (unlikely(__pyx_t_1 == ((void *)NULL))) __PYX_ERR(1, 628, __pyx_L1_error) + __pyx_v_mslice = __pyx_t_1; + + /* "View.MemoryView":629 + * cdef __Pyx_memviewslice tmp + * mslice = get_slice_from_memview(self, &tmp) + * return slice_is_contig(mslice[0], 'C', self.view.ndim) # <<<<<<<<<<<<<< + * + * def is_f_contig(self): +*/ + __Pyx_XDECREF(__pyx_r); + __pyx_t_2 = __Pyx_PyBool_FromLong(__pyx_memviewslice_is_contig((__pyx_v_mslice[0]), 'C', __pyx_v_self->view.ndim)); if (unlikely(!__pyx_t_2)) __PYX_ERR(1, 629, __pyx_L1_error) + __Pyx_GOTREF(__pyx_t_2); + __pyx_r = __pyx_t_2; + __pyx_t_2 = 0; + goto __pyx_L0; + + /* "View.MemoryView":625 + * + * + * def is_c_contig(self): # <<<<<<<<<<<<<< + * cdef __Pyx_memviewslice *mslice + * cdef __Pyx_memviewslice tmp +*/ + + /* function exit code */ + __pyx_L1_error:; + __Pyx_XDECREF(__pyx_t_2); + __Pyx_AddTraceback("View.MemoryView.memoryview.is_c_contig", __pyx_clineno, __pyx_lineno, __pyx_filename); + __pyx_r = NULL; + __pyx_L0:; + __Pyx_XGIVEREF(__pyx_r); + __Pyx_RefNannyFinishContext(); + return __pyx_r; +} + +/* "View.MemoryView":631 + * return slice_is_contig(mslice[0], 'C', self.view.ndim) + * + * def is_f_contig(self): # <<<<<<<<<<<<<< + * cdef __Pyx_memviewslice *mslice + * cdef __Pyx_memviewslice tmp +*/ + +/* Python wrapper */ +static PyObject *__pyx_memoryview_is_f_contig(PyObject *__pyx_v_self, +#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*/ +static PyObject *__pyx_memoryview_is_f_contig(PyObject *__pyx_v_self, +#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_f_contig (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_f_contig", 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_f_contig", __pyx_kwds); return NULL;} + __pyx_r = __pyx_memoryview___pyx_pf_15View_dot_MemoryView_10memoryview_18is_f_contig(((struct __pyx_memoryview_obj *)__pyx_v_self)); + + /* function exit code */ + __Pyx_RefNannyFinishContext(); + return __pyx_r; +} + +static PyObject *__pyx_memoryview___pyx_pf_15View_dot_MemoryView_10memoryview_18is_f_contig(struct __pyx_memoryview_obj *__pyx_v_self) { + __Pyx_memviewslice *__pyx_v_mslice; + __Pyx_memviewslice __pyx_v_tmp; + PyObject *__pyx_r = NULL; + __Pyx_RefNannyDeclarations + __Pyx_memviewslice *__pyx_t_1; + PyObject *__pyx_t_2 = NULL; + int __pyx_lineno = 0; + const char *__pyx_filename = NULL; + int __pyx_clineno = 0; + __Pyx_RefNannySetupContext("is_f_contig", 0); + + /* "View.MemoryView":634 + * cdef __Pyx_memviewslice *mslice + * cdef __Pyx_memviewslice tmp + * mslice = get_slice_from_memview(self, &tmp) # <<<<<<<<<<<<<< + * return slice_is_contig(mslice[0], 'F', self.view.ndim) + * +*/ + __pyx_t_1 = __pyx_memoryview_get_slice_from_memoryview(__pyx_v_self, (&__pyx_v_tmp)); if (unlikely(__pyx_t_1 == ((void *)NULL))) __PYX_ERR(1, 634, __pyx_L1_error) + __pyx_v_mslice = __pyx_t_1; + + /* "View.MemoryView":635 + * cdef __Pyx_memviewslice tmp + * mslice = get_slice_from_memview(self, &tmp) + * return slice_is_contig(mslice[0], 'F', self.view.ndim) # <<<<<<<<<<<<<< + * + * def copy(self): +*/ + __Pyx_XDECREF(__pyx_r); + __pyx_t_2 = __Pyx_PyBool_FromLong(__pyx_memviewslice_is_contig((__pyx_v_mslice[0]), 'F', __pyx_v_self->view.ndim)); if (unlikely(!__pyx_t_2)) __PYX_ERR(1, 635, __pyx_L1_error) + __Pyx_GOTREF(__pyx_t_2); + __pyx_r = __pyx_t_2; + __pyx_t_2 = 0; + goto __pyx_L0; + + /* "View.MemoryView":631 + * return slice_is_contig(mslice[0], 'C', self.view.ndim) + * + * def is_f_contig(self): # <<<<<<<<<<<<<< + * cdef __Pyx_memviewslice *mslice + * cdef __Pyx_memviewslice tmp +*/ + + /* function exit code */ + __pyx_L1_error:; + __Pyx_XDECREF(__pyx_t_2); + __Pyx_AddTraceback("View.MemoryView.memoryview.is_f_contig", __pyx_clineno, __pyx_lineno, __pyx_filename); + __pyx_r = NULL; + __pyx_L0:; + __Pyx_XGIVEREF(__pyx_r); + __Pyx_RefNannyFinishContext(); + return __pyx_r; +} + +/* "View.MemoryView":637 + * return slice_is_contig(mslice[0], 'F', self.view.ndim) + * + * def copy(self): # <<<<<<<<<<<<<< + * cdef __Pyx_memviewslice mslice + * cdef int flags = self.flags & ~PyBUF_F_CONTIGUOUS +*/ + +/* Python wrapper */ +static PyObject *__pyx_memoryview_copy(PyObject *__pyx_v_self, +#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*/ +static PyObject *__pyx_memoryview_copy(PyObject *__pyx_v_self, +#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("copy (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("copy", 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("copy", __pyx_kwds); return NULL;} + __pyx_r = __pyx_memoryview___pyx_pf_15View_dot_MemoryView_10memoryview_20copy(((struct __pyx_memoryview_obj *)__pyx_v_self)); + + /* function exit code */ + __Pyx_RefNannyFinishContext(); + return __pyx_r; +} + +static PyObject *__pyx_memoryview___pyx_pf_15View_dot_MemoryView_10memoryview_20copy(struct __pyx_memoryview_obj *__pyx_v_self) { + __Pyx_memviewslice __pyx_v_mslice; + int __pyx_v_flags; + PyObject *__pyx_r = NULL; + __Pyx_RefNannyDeclarations + __Pyx_memviewslice __pyx_t_1; + PyObject *__pyx_t_2 = NULL; + int __pyx_lineno = 0; + const char *__pyx_filename = NULL; + int __pyx_clineno = 0; + __Pyx_RefNannySetupContext("copy", 0); + + /* "View.MemoryView":639 + * def copy(self): + * cdef __Pyx_memviewslice mslice + * cdef int flags = self.flags & ~PyBUF_F_CONTIGUOUS # <<<<<<<<<<<<<< + * + * slice_copy(self, &mslice) +*/ + __pyx_v_flags = (__pyx_v_self->flags & (~PyBUF_F_CONTIGUOUS)); + + /* "View.MemoryView":641 + * cdef int flags = self.flags & ~PyBUF_F_CONTIGUOUS + * + * slice_copy(self, &mslice) # <<<<<<<<<<<<<< + * mslice = slice_copy_contig(&mslice, "c", self.view.ndim, + * self.view.itemsize, +*/ + __pyx_memoryview_slice_copy(__pyx_v_self, (&__pyx_v_mslice)); + + /* "View.MemoryView":642 + * + * slice_copy(self, &mslice) + * mslice = slice_copy_contig(&mslice, "c", self.view.ndim, # <<<<<<<<<<<<<< + * self.view.itemsize, + * flags|PyBUF_C_CONTIGUOUS, +*/ + __pyx_t_1 = __pyx_memoryview_copy_new_contig((&__pyx_v_mslice), ((char const *)"c"), __pyx_v_self->view.ndim, __pyx_v_self->view.itemsize, (__pyx_v_flags | PyBUF_C_CONTIGUOUS), __pyx_v_self->dtype_is_object); if (unlikely(PyErr_Occurred())) __PYX_ERR(1, 642, __pyx_L1_error) + __pyx_v_mslice = __pyx_t_1; + + /* "View.MemoryView":647 + * self.dtype_is_object) + * + * return memoryview_copy_from_slice(self, &mslice) # <<<<<<<<<<<<<< + * + * def copy_fortran(self): +*/ + __Pyx_XDECREF(__pyx_r); + __pyx_t_2 = __pyx_memoryview_copy_object_from_slice(__pyx_v_self, (&__pyx_v_mslice)); if (unlikely(!__pyx_t_2)) __PYX_ERR(1, 647, __pyx_L1_error) + __Pyx_GOTREF(__pyx_t_2); + __pyx_r = __pyx_t_2; + __pyx_t_2 = 0; + goto __pyx_L0; + + /* "View.MemoryView":637 + * return slice_is_contig(mslice[0], 'F', self.view.ndim) + * + * def copy(self): # <<<<<<<<<<<<<< + * cdef __Pyx_memviewslice mslice + * cdef int flags = self.flags & ~PyBUF_F_CONTIGUOUS +*/ + + /* function exit code */ + __pyx_L1_error:; + __Pyx_XDECREF(__pyx_t_2); + __Pyx_AddTraceback("View.MemoryView.memoryview.copy", __pyx_clineno, __pyx_lineno, __pyx_filename); + __pyx_r = NULL; + __pyx_L0:; + __Pyx_XGIVEREF(__pyx_r); + __Pyx_RefNannyFinishContext(); + return __pyx_r; +} + +/* "View.MemoryView":649 + * return memoryview_copy_from_slice(self, &mslice) + * + * def copy_fortran(self): # <<<<<<<<<<<<<< + * cdef __Pyx_memviewslice src, dst + * cdef int flags = self.flags & ~PyBUF_C_CONTIGUOUS +*/ + +/* Python wrapper */ +static PyObject *__pyx_memoryview_copy_fortran(PyObject *__pyx_v_self, +#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*/ +static PyObject *__pyx_memoryview_copy_fortran(PyObject *__pyx_v_self, +#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("copy_fortran (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("copy_fortran", 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("copy_fortran", __pyx_kwds); return NULL;} + __pyx_r = __pyx_memoryview___pyx_pf_15View_dot_MemoryView_10memoryview_22copy_fortran(((struct __pyx_memoryview_obj *)__pyx_v_self)); + + /* function exit code */ + __Pyx_RefNannyFinishContext(); + return __pyx_r; +} + +static PyObject *__pyx_memoryview___pyx_pf_15View_dot_MemoryView_10memoryview_22copy_fortran(struct __pyx_memoryview_obj *__pyx_v_self) { + __Pyx_memviewslice __pyx_v_src; + __Pyx_memviewslice __pyx_v_dst; + int __pyx_v_flags; + PyObject *__pyx_r = NULL; + __Pyx_RefNannyDeclarations + __Pyx_memviewslice __pyx_t_1; + PyObject *__pyx_t_2 = NULL; + int __pyx_lineno = 0; + const char *__pyx_filename = NULL; + int __pyx_clineno = 0; + __Pyx_RefNannySetupContext("copy_fortran", 0); + + /* "View.MemoryView":651 + * def copy_fortran(self): + * cdef __Pyx_memviewslice src, dst + * cdef int flags = self.flags & ~PyBUF_C_CONTIGUOUS # <<<<<<<<<<<<<< + * + * slice_copy(self, &src) +*/ + __pyx_v_flags = (__pyx_v_self->flags & (~PyBUF_C_CONTIGUOUS)); + + /* "View.MemoryView":653 + * cdef int flags = self.flags & ~PyBUF_C_CONTIGUOUS + * + * slice_copy(self, &src) # <<<<<<<<<<<<<< + * dst = slice_copy_contig(&src, "fortran", self.view.ndim, + * self.view.itemsize, +*/ + __pyx_memoryview_slice_copy(__pyx_v_self, (&__pyx_v_src)); + + /* "View.MemoryView":654 + * + * slice_copy(self, &src) + * dst = slice_copy_contig(&src, "fortran", self.view.ndim, # <<<<<<<<<<<<<< + * self.view.itemsize, + * flags|PyBUF_F_CONTIGUOUS, +*/ + __pyx_t_1 = __pyx_memoryview_copy_new_contig((&__pyx_v_src), ((char const *)"fortran"), __pyx_v_self->view.ndim, __pyx_v_self->view.itemsize, (__pyx_v_flags | PyBUF_F_CONTIGUOUS), __pyx_v_self->dtype_is_object); if (unlikely(PyErr_Occurred())) __PYX_ERR(1, 654, __pyx_L1_error) + __pyx_v_dst = __pyx_t_1; + + /* "View.MemoryView":659 + * self.dtype_is_object) + * + * return memoryview_copy_from_slice(self, &dst) # <<<<<<<<<<<<<< + * + * +*/ + __Pyx_XDECREF(__pyx_r); + __pyx_t_2 = __pyx_memoryview_copy_object_from_slice(__pyx_v_self, (&__pyx_v_dst)); if (unlikely(!__pyx_t_2)) __PYX_ERR(1, 659, __pyx_L1_error) + __Pyx_GOTREF(__pyx_t_2); + __pyx_r = __pyx_t_2; + __pyx_t_2 = 0; + goto __pyx_L0; + + /* "View.MemoryView":649 + * return memoryview_copy_from_slice(self, &mslice) + * + * def copy_fortran(self): # <<<<<<<<<<<<<< + * cdef __Pyx_memviewslice src, dst + * cdef int flags = self.flags & ~PyBUF_C_CONTIGUOUS +*/ + + /* function exit code */ + __pyx_L1_error:; + __Pyx_XDECREF(__pyx_t_2); + __Pyx_AddTraceback("View.MemoryView.memoryview.copy_fortran", __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___pyx_memoryview_1__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*/ +static PyObject *__pyx_pw___pyx_memoryview_1__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___pyx_memoryview___reduce_cython__(((struct __pyx_memoryview_obj *)__pyx_v_self)); + + /* function exit code */ + __Pyx_RefNannyFinishContext(); + return __pyx_r; +} + +static PyObject *__pyx_pf___pyx_memoryview___reduce_cython__(CYTHON_UNUSED struct __pyx_memoryview_obj *__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("View.MemoryView.memoryview.__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___pyx_memoryview_3__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*/ +static PyObject *__pyx_pw___pyx_memoryview_3__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("View.MemoryView.memoryview.__setstate_cython__", __pyx_clineno, __pyx_lineno, __pyx_filename); + __Pyx_RefNannyFinishContext(); + return NULL; + __pyx_L4_argument_unpacking_done:; + __pyx_r = __pyx_pf___pyx_memoryview_2__setstate_cython__(((struct __pyx_memoryview_obj *)__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___pyx_memoryview_2__setstate_cython__(CYTHON_UNUSED struct __pyx_memoryview_obj *__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("View.MemoryView.memoryview.__setstate_cython__", __pyx_clineno, __pyx_lineno, __pyx_filename); + __pyx_r = NULL; + __Pyx_XGIVEREF(__pyx_r); + __Pyx_RefNannyFinishContext(); + return __pyx_r; +} + +/* "View.MemoryView":662 + * + * + * @cname('__pyx_memoryview_new') # <<<<<<<<<<<<<< + * cdef memoryview_cwrapper(object o, int flags, bint dtype_is_object, const __Pyx_TypeInfo *typeinfo): + * cdef memoryview result = memoryview(o, flags, dtype_is_object) +*/ + +static PyObject *__pyx_memoryview_new(PyObject *__pyx_v_o, int __pyx_v_flags, int __pyx_v_dtype_is_object, __Pyx_TypeInfo const *__pyx_v_typeinfo) { + struct __pyx_memoryview_obj *__pyx_v_result = 0; + PyObject *__pyx_r = NULL; + __Pyx_RefNannyDeclarations + PyObject *__pyx_t_1 = NULL; + PyObject *__pyx_t_2 = NULL; + PyObject *__pyx_t_3 = NULL; + PyObject *__pyx_t_4 = NULL; + size_t __pyx_t_5; + int __pyx_lineno = 0; + const char *__pyx_filename = NULL; + int __pyx_clineno = 0; + __Pyx_RefNannySetupContext("memoryview_cwrapper", 0); + + /* "View.MemoryView":664 + * @cname('__pyx_memoryview_new') + * cdef memoryview_cwrapper(object o, int flags, bint dtype_is_object, const __Pyx_TypeInfo *typeinfo): + * cdef memoryview result = memoryview(o, flags, dtype_is_object) # <<<<<<<<<<<<<< + * result.typeinfo = typeinfo + * return result +*/ + __pyx_t_2 = NULL; + __pyx_t_3 = __Pyx_PyLong_From_int(__pyx_v_flags); if (unlikely(!__pyx_t_3)) __PYX_ERR(1, 664, __pyx_L1_error) + __Pyx_GOTREF(__pyx_t_3); + __pyx_t_4 = __Pyx_PyBool_FromLong(__pyx_v_dtype_is_object); if (unlikely(!__pyx_t_4)) __PYX_ERR(1, 664, __pyx_L1_error) + __Pyx_GOTREF(__pyx_t_4); + __pyx_t_5 = 1; + { + PyObject *__pyx_callargs[4] = {__pyx_t_2, __pyx_v_o, __pyx_t_3, __pyx_t_4}; + __pyx_t_1 = __Pyx_PyObject_FastCall((PyObject*)__pyx_mstate_global->__pyx_memoryview_type, __pyx_callargs+__pyx_t_5, (4-__pyx_t_5) | (__pyx_t_5*__Pyx_PY_VECTORCALL_ARGUMENTS_OFFSET)); + __Pyx_XDECREF(__pyx_t_2); __pyx_t_2 = 0; + __Pyx_DECREF(__pyx_t_3); __pyx_t_3 = 0; + __Pyx_DECREF(__pyx_t_4); __pyx_t_4 = 0; + if (unlikely(!__pyx_t_1)) __PYX_ERR(1, 664, __pyx_L1_error) + __Pyx_GOTREF((PyObject *)__pyx_t_1); + } + __pyx_v_result = ((struct __pyx_memoryview_obj *)__pyx_t_1); + __pyx_t_1 = 0; + + /* "View.MemoryView":665 + * cdef memoryview_cwrapper(object o, int flags, bint dtype_is_object, const __Pyx_TypeInfo *typeinfo): + * cdef memoryview result = memoryview(o, flags, dtype_is_object) + * result.typeinfo = typeinfo # <<<<<<<<<<<<<< + * return result + * +*/ + __pyx_v_result->typeinfo = __pyx_v_typeinfo; + + /* "View.MemoryView":666 + * cdef memoryview result = memoryview(o, flags, dtype_is_object) + * result.typeinfo = typeinfo + * return result # <<<<<<<<<<<<<< + * + * @cname('__pyx_memoryview_check') +*/ + __Pyx_XDECREF(__pyx_r); + __Pyx_INCREF((PyObject *)__pyx_v_result); + __pyx_r = ((PyObject *)__pyx_v_result); + goto __pyx_L0; + + /* "View.MemoryView":662 + * + * + * @cname('__pyx_memoryview_new') # <<<<<<<<<<<<<< + * cdef memoryview_cwrapper(object o, int flags, bint dtype_is_object, const __Pyx_TypeInfo *typeinfo): + * cdef memoryview result = memoryview(o, flags, dtype_is_object) +*/ + + /* function exit code */ + __pyx_L1_error:; + __Pyx_XDECREF(__pyx_t_1); + __Pyx_XDECREF(__pyx_t_2); + __Pyx_XDECREF(__pyx_t_3); + __Pyx_XDECREF(__pyx_t_4); + __Pyx_AddTraceback("View.MemoryView.memoryview_cwrapper", __pyx_clineno, __pyx_lineno, __pyx_filename); + __pyx_r = 0; + __pyx_L0:; + __Pyx_XDECREF((PyObject *)__pyx_v_result); + __Pyx_XGIVEREF(__pyx_r); + __Pyx_RefNannyFinishContext(); + return __pyx_r; +} + +/* "View.MemoryView":668 + * return result + * + * @cname('__pyx_memoryview_check') # <<<<<<<<<<<<<< + * cdef inline bint memoryview_check(object o) noexcept: + * return isinstance(o, memoryview) +*/ + +static CYTHON_INLINE int __pyx_memoryview_check(PyObject *__pyx_v_o) { + int __pyx_r; + int __pyx_t_1; + + /* "View.MemoryView":670 + * @cname('__pyx_memoryview_check') + * cdef inline bint memoryview_check(object o) noexcept: + * return isinstance(o, memoryview) # <<<<<<<<<<<<<< + * + * cdef tuple _unellipsify(object index, int ndim): +*/ + __pyx_t_1 = __Pyx_TypeCheck(__pyx_v_o, __pyx_mstate_global->__pyx_memoryview_type); + __pyx_r = __pyx_t_1; + goto __pyx_L0; + + /* "View.MemoryView":668 + * return result + * + * @cname('__pyx_memoryview_check') # <<<<<<<<<<<<<< + * cdef inline bint memoryview_check(object o) noexcept: + * return isinstance(o, memoryview) +*/ + + /* function exit code */ + __pyx_L0:; + return __pyx_r; +} + +/* "View.MemoryView":672 + * return isinstance(o, memoryview) + * + * cdef tuple _unellipsify(object index, int ndim): # <<<<<<<<<<<<<< + * """ + * Replace all ellipses with full slices and fill incomplete indices with +*/ + +static PyObject *_unellipsify(PyObject *__pyx_v_index, int __pyx_v_ndim) { + Py_ssize_t __pyx_v_idx; + PyObject *__pyx_v_tup = NULL; + PyObject *__pyx_v_result = NULL; + int __pyx_v_have_slices; + int __pyx_v_seen_ellipsis; + PyObject *__pyx_v_item = NULL; + Py_ssize_t __pyx_v_nslices; + PyObject *__pyx_r = NULL; + __Pyx_RefNannyDeclarations + PyObject *__pyx_t_1 = NULL; + int __pyx_t_2; + PyObject *__pyx_t_3 = NULL; + Py_ssize_t __pyx_t_4; + Py_ssize_t __pyx_t_5; + PyObject *__pyx_t_6[3]; + PyObject *__pyx_t_7 = NULL; + int __pyx_lineno = 0; + const char *__pyx_filename = NULL; + int __pyx_clineno = 0; + __Pyx_RefNannySetupContext("_unellipsify", 0); + + /* "View.MemoryView":678 + * """ + * cdef Py_ssize_t idx + * tup = index if isinstance(index, tuple) else (index,) # <<<<<<<<<<<<<< + * + * result = [slice(None)] * ndim +*/ + __pyx_t_2 = PyTuple_Check(__pyx_v_index); + if (__pyx_t_2) { + __Pyx_INCREF(((PyObject*)__pyx_v_index)); + __pyx_t_1 = __pyx_v_index; + } else { + __pyx_t_3 = PyTuple_New(1); if (unlikely(!__pyx_t_3)) __PYX_ERR(1, 678, __pyx_L1_error) + __Pyx_GOTREF(__pyx_t_3); + __Pyx_INCREF(__pyx_v_index); + __Pyx_GIVEREF(__pyx_v_index); + if (__Pyx_PyTuple_SET_ITEM(__pyx_t_3, 0, __pyx_v_index) != (0)) __PYX_ERR(1, 678, __pyx_L1_error); + __pyx_t_1 = __pyx_t_3; + __pyx_t_3 = 0; + } + __pyx_v_tup = ((PyObject*)__pyx_t_1); + __pyx_t_1 = 0; + + /* "View.MemoryView":680 + * tup = index if isinstance(index, tuple) else (index,) + * + * result = [slice(None)] * ndim # <<<<<<<<<<<<<< + * have_slices = False + * seen_ellipsis = False +*/ + __pyx_t_1 = PyList_New(1 * ((__pyx_v_ndim<0) ? 0:__pyx_v_ndim)); if (unlikely(!__pyx_t_1)) __PYX_ERR(1, 680, __pyx_L1_error) + __Pyx_GOTREF(__pyx_t_1); + { Py_ssize_t __pyx_temp; + for (__pyx_temp=0; __pyx_temp < __pyx_v_ndim; __pyx_temp++) { + __Pyx_INCREF(__pyx_mstate_global->__pyx_slice[0]); + __Pyx_GIVEREF(__pyx_mstate_global->__pyx_slice[0]); + if (__Pyx_PyList_SET_ITEM(__pyx_t_1, __pyx_temp, __pyx_mstate_global->__pyx_slice[0]) != (0)) __PYX_ERR(1, 680, __pyx_L1_error); + } + } + __pyx_v_result = ((PyObject*)__pyx_t_1); + __pyx_t_1 = 0; + + /* "View.MemoryView":681 + * + * result = [slice(None)] * ndim + * have_slices = False # <<<<<<<<<<<<<< + * seen_ellipsis = False + * idx = 0 +*/ + __pyx_v_have_slices = 0; + + /* "View.MemoryView":682 + * result = [slice(None)] * ndim + * have_slices = False + * seen_ellipsis = False # <<<<<<<<<<<<<< + * idx = 0 + * for item in tup: +*/ + __pyx_v_seen_ellipsis = 0; + + /* "View.MemoryView":683 + * have_slices = False + * seen_ellipsis = False + * idx = 0 # <<<<<<<<<<<<<< + * for item in tup: + * if item is Ellipsis: +*/ + __pyx_v_idx = 0; + + /* "View.MemoryView":684 + * seen_ellipsis = False + * idx = 0 + * for item in tup: # <<<<<<<<<<<<<< + * if item is Ellipsis: + * if not seen_ellipsis: +*/ + if (unlikely(__pyx_v_tup == Py_None)) { + PyErr_SetString(PyExc_TypeError, "'NoneType' object is not iterable"); + __PYX_ERR(1, 684, __pyx_L1_error) + } + __pyx_t_1 = __pyx_v_tup; __Pyx_INCREF(__pyx_t_1); + __pyx_t_4 = 0; + for (;;) { + { + Py_ssize_t __pyx_temp = __Pyx_PyTuple_GET_SIZE(__pyx_t_1); + #if !CYTHON_ASSUME_SAFE_SIZE + if (unlikely((__pyx_temp < 0))) __PYX_ERR(1, 684, __pyx_L1_error) + #endif + if (__pyx_t_4 >= __pyx_temp) break; + } + #if CYTHON_ASSUME_SAFE_MACROS && !CYTHON_AVOID_BORROWED_REFS + __pyx_t_3 = __Pyx_NewRef(PyTuple_GET_ITEM(__pyx_t_1, __pyx_t_4)); + #else + __pyx_t_3 = __Pyx_PySequence_ITEM(__pyx_t_1, __pyx_t_4); + #endif + ++__pyx_t_4; + if (unlikely(!__pyx_t_3)) __PYX_ERR(1, 684, __pyx_L1_error) + __Pyx_GOTREF(__pyx_t_3); + __Pyx_XDECREF_SET(__pyx_v_item, __pyx_t_3); + __pyx_t_3 = 0; + + /* "View.MemoryView":685 + * idx = 0 + * for item in tup: + * if item is Ellipsis: # <<<<<<<<<<<<<< + * if not seen_ellipsis: + * idx += ndim - len(tup) +*/ + __pyx_t_2 = (__pyx_v_item == __pyx_builtin_Ellipsis); + if (__pyx_t_2) { + + /* "View.MemoryView":686 + * for item in tup: + * if item is Ellipsis: + * if not seen_ellipsis: # <<<<<<<<<<<<<< + * idx += ndim - len(tup) + * seen_ellipsis = True +*/ + __pyx_t_2 = (!__pyx_v_seen_ellipsis); + if (__pyx_t_2) { + + /* "View.MemoryView":687 + * if item is Ellipsis: + * if not seen_ellipsis: + * idx += ndim - len(tup) # <<<<<<<<<<<<<< + * seen_ellipsis = True + * have_slices = True +*/ + if (unlikely(__pyx_v_tup == Py_None)) { + PyErr_SetString(PyExc_TypeError, "object of type 'NoneType' has no len()"); + __PYX_ERR(1, 687, __pyx_L1_error) + } + __pyx_t_5 = __Pyx_PyTuple_GET_SIZE(__pyx_v_tup); if (unlikely(__pyx_t_5 == ((Py_ssize_t)-1))) __PYX_ERR(1, 687, __pyx_L1_error) + __pyx_v_idx = (__pyx_v_idx + (__pyx_v_ndim - __pyx_t_5)); + + /* "View.MemoryView":688 + * if not seen_ellipsis: + * idx += ndim - len(tup) + * seen_ellipsis = True # <<<<<<<<<<<<<< + * have_slices = True + * else: +*/ + __pyx_v_seen_ellipsis = 1; + + /* "View.MemoryView":686 + * for item in tup: + * if item is Ellipsis: + * if not seen_ellipsis: # <<<<<<<<<<<<<< + * idx += ndim - len(tup) + * seen_ellipsis = True +*/ + } + + /* "View.MemoryView":689 + * idx += ndim - len(tup) + * seen_ellipsis = True + * have_slices = True # <<<<<<<<<<<<<< + * else: + * if isinstance(item, slice): +*/ + __pyx_v_have_slices = 1; + + /* "View.MemoryView":685 + * idx = 0 + * for item in tup: + * if item is Ellipsis: # <<<<<<<<<<<<<< + * if not seen_ellipsis: + * idx += ndim - len(tup) +*/ + goto __pyx_L5; + } + + /* "View.MemoryView":691 + * have_slices = True + * else: + * if isinstance(item, slice): # <<<<<<<<<<<<<< + * have_slices = True + * elif not PyIndex_Check(item): +*/ + /*else*/ { + __pyx_t_2 = PySlice_Check(__pyx_v_item); + if (__pyx_t_2) { + + /* "View.MemoryView":692 + * else: + * if isinstance(item, slice): + * have_slices = True # <<<<<<<<<<<<<< + * elif not PyIndex_Check(item): + * raise TypeError, f"Cannot index with type '{type(item)}'" +*/ + __pyx_v_have_slices = 1; + + /* "View.MemoryView":691 + * have_slices = True + * else: + * if isinstance(item, slice): # <<<<<<<<<<<<<< + * have_slices = True + * elif not PyIndex_Check(item): +*/ + goto __pyx_L7; + } + + /* "View.MemoryView":693 + * if isinstance(item, slice): + * have_slices = True + * elif not PyIndex_Check(item): # <<<<<<<<<<<<<< + * raise TypeError, f"Cannot index with type '{type(item)}'" + * result[idx] = item +*/ + __pyx_t_2 = (!(PyIndex_Check(__pyx_v_item) != 0)); + if (unlikely(__pyx_t_2)) { + + /* "View.MemoryView":694 + * have_slices = True + * elif not PyIndex_Check(item): + * raise TypeError, f"Cannot index with type '{type(item)}'" # <<<<<<<<<<<<<< + * result[idx] = item + * idx += 1 +*/ + __pyx_t_3 = __Pyx_PyObject_FormatSimple(((PyObject *)Py_TYPE(__pyx_v_item)), __pyx_mstate_global->__pyx_empty_unicode); if (unlikely(!__pyx_t_3)) __PYX_ERR(1, 694, __pyx_L1_error) + __Pyx_GOTREF(__pyx_t_3); + __pyx_t_6[0] = __pyx_mstate_global->__pyx_kp_u_Cannot_index_with_type; + __pyx_t_6[1] = __pyx_t_3; + __pyx_t_6[2] = __pyx_mstate_global->__pyx_kp_u__4; + __pyx_t_7 = __Pyx_PyUnicode_Join(__pyx_t_6, 3, 24 + __Pyx_PyUnicode_GET_LENGTH(__pyx_t_3) + 1, 127 | __Pyx_PyUnicode_MAX_CHAR_VALUE(__pyx_t_3)); + if (unlikely(!__pyx_t_7)) __PYX_ERR(1, 694, __pyx_L1_error) + __Pyx_GOTREF(__pyx_t_7); + __Pyx_DECREF(__pyx_t_3); __pyx_t_3 = 0; + __Pyx_Raise(((PyObject *)(((PyTypeObject*)PyExc_TypeError))), __pyx_t_7, 0, 0); + __Pyx_DECREF(__pyx_t_7); __pyx_t_7 = 0; + __PYX_ERR(1, 694, __pyx_L1_error) + + /* "View.MemoryView":693 + * if isinstance(item, slice): + * have_slices = True + * elif not PyIndex_Check(item): # <<<<<<<<<<<<<< + * raise TypeError, f"Cannot index with type '{type(item)}'" + * result[idx] = item +*/ + } + __pyx_L7:; + + /* "View.MemoryView":695 + * elif not PyIndex_Check(item): + * raise TypeError, f"Cannot index with type '{type(item)}'" + * result[idx] = item # <<<<<<<<<<<<<< + * idx += 1 + * +*/ + if (unlikely((__Pyx_SetItemInt(__pyx_v_result, __pyx_v_idx, __pyx_v_item, Py_ssize_t, 1, PyLong_FromSsize_t, 1, 1, 1, 1, __Pyx_ReferenceSharing_OwnStrongReference) < 0))) __PYX_ERR(1, 695, __pyx_L1_error) + } + __pyx_L5:; + + /* "View.MemoryView":696 + * raise TypeError, f"Cannot index with type '{type(item)}'" + * result[idx] = item + * idx += 1 # <<<<<<<<<<<<<< + * + * nslices = ndim - idx +*/ + __pyx_v_idx = (__pyx_v_idx + 1); + + /* "View.MemoryView":684 + * seen_ellipsis = False + * idx = 0 + * for item in tup: # <<<<<<<<<<<<<< + * if item is Ellipsis: + * if not seen_ellipsis: +*/ + } + __Pyx_DECREF(__pyx_t_1); __pyx_t_1 = 0; + + /* "View.MemoryView":698 + * idx += 1 + * + * nslices = ndim - idx # <<<<<<<<<<<<<< + * return have_slices or nslices, tuple(result) + * +*/ + __pyx_v_nslices = (__pyx_v_ndim - __pyx_v_idx); + + /* "View.MemoryView":699 + * + * nslices = ndim - idx + * return have_slices or nslices, tuple(result) # <<<<<<<<<<<<<< + * + * cdef int assert_direct_dimensions(Py_ssize_t *suboffsets, int ndim) except -1: +*/ + __Pyx_XDECREF(__pyx_r); + if (!__pyx_v_have_slices) { + } else { + __pyx_t_7 = __Pyx_PyBool_FromLong(__pyx_v_have_slices); if (unlikely(!__pyx_t_7)) __PYX_ERR(1, 699, __pyx_L1_error) + __Pyx_GOTREF(__pyx_t_7); + __pyx_t_1 = __pyx_t_7; + __pyx_t_7 = 0; + goto __pyx_L9_bool_binop_done; + } + __pyx_t_7 = PyLong_FromSsize_t(__pyx_v_nslices); if (unlikely(!__pyx_t_7)) __PYX_ERR(1, 699, __pyx_L1_error) + __Pyx_GOTREF(__pyx_t_7); + __pyx_t_1 = __pyx_t_7; + __pyx_t_7 = 0; + __pyx_L9_bool_binop_done:; + __pyx_t_7 = PyList_AsTuple(__pyx_v_result); if (unlikely(!__pyx_t_7)) __PYX_ERR(1, 699, __pyx_L1_error) + __Pyx_GOTREF(__pyx_t_7); + __pyx_t_3 = PyTuple_New(2); if (unlikely(!__pyx_t_3)) __PYX_ERR(1, 699, __pyx_L1_error) + __Pyx_GOTREF(__pyx_t_3); + __Pyx_GIVEREF(__pyx_t_1); + if (__Pyx_PyTuple_SET_ITEM(__pyx_t_3, 0, __pyx_t_1) != (0)) __PYX_ERR(1, 699, __pyx_L1_error); + __Pyx_GIVEREF(__pyx_t_7); + if (__Pyx_PyTuple_SET_ITEM(__pyx_t_3, 1, __pyx_t_7) != (0)) __PYX_ERR(1, 699, __pyx_L1_error); + __pyx_t_1 = 0; + __pyx_t_7 = 0; + __pyx_r = ((PyObject*)__pyx_t_3); + __pyx_t_3 = 0; + goto __pyx_L0; + + /* "View.MemoryView":672 + * return isinstance(o, memoryview) + * + * cdef tuple _unellipsify(object index, int ndim): # <<<<<<<<<<<<<< + * """ + * Replace all ellipses with full slices and fill incomplete indices with +*/ + + /* function exit code */ + __pyx_L1_error:; + __Pyx_XDECREF(__pyx_t_1); + __Pyx_XDECREF(__pyx_t_3); + __Pyx_XDECREF(__pyx_t_7); + __Pyx_AddTraceback("View.MemoryView._unellipsify", __pyx_clineno, __pyx_lineno, __pyx_filename); + __pyx_r = 0; + __pyx_L0:; + __Pyx_XDECREF(__pyx_v_tup); + __Pyx_XDECREF(__pyx_v_result); + __Pyx_XDECREF(__pyx_v_item); + __Pyx_XGIVEREF(__pyx_r); + __Pyx_RefNannyFinishContext(); + return __pyx_r; +} + +/* "View.MemoryView":701 + * return have_slices or nslices, tuple(result) + * + * cdef int assert_direct_dimensions(Py_ssize_t *suboffsets, int ndim) except -1: # <<<<<<<<<<<<<< + * for suboffset in suboffsets[:ndim]: + * if suboffset >= 0: +*/ + +static int assert_direct_dimensions(Py_ssize_t *__pyx_v_suboffsets, int __pyx_v_ndim) { + Py_ssize_t __pyx_v_suboffset; + int __pyx_r; + Py_ssize_t *__pyx_t_1; + Py_ssize_t *__pyx_t_2; + Py_ssize_t *__pyx_t_3; + int __pyx_t_4; + int __pyx_lineno = 0; + const char *__pyx_filename = NULL; + int __pyx_clineno = 0; + + /* "View.MemoryView":702 + * + * cdef int assert_direct_dimensions(Py_ssize_t *suboffsets, int ndim) except -1: + * for suboffset in suboffsets[:ndim]: # <<<<<<<<<<<<<< + * if suboffset >= 0: + * raise ValueError, "Indirect dimensions not supported" +*/ + __pyx_t_2 = (__pyx_v_suboffsets + __pyx_v_ndim); + for (__pyx_t_3 = __pyx_v_suboffsets; __pyx_t_3 < __pyx_t_2; __pyx_t_3++) { + __pyx_t_1 = __pyx_t_3; + __pyx_v_suboffset = (__pyx_t_1[0]); + + /* "View.MemoryView":703 + * cdef int assert_direct_dimensions(Py_ssize_t *suboffsets, int ndim) except -1: + * for suboffset in suboffsets[:ndim]: + * if suboffset >= 0: # <<<<<<<<<<<<<< + * raise ValueError, "Indirect dimensions not supported" + * return 0 # return type just used as an error flag +*/ + __pyx_t_4 = (__pyx_v_suboffset >= 0); + if (unlikely(__pyx_t_4)) { + + /* "View.MemoryView":704 + * for suboffset in suboffsets[:ndim]: + * if suboffset >= 0: + * raise ValueError, "Indirect dimensions not supported" # <<<<<<<<<<<<<< + * return 0 # return type just used as an error flag + * +*/ + __Pyx_Raise(((PyObject *)(((PyTypeObject*)PyExc_ValueError))), __pyx_mstate_global->__pyx_kp_u_Indirect_dimensions_not_supporte, 0, 0); + __PYX_ERR(1, 704, __pyx_L1_error) + + /* "View.MemoryView":703 + * cdef int assert_direct_dimensions(Py_ssize_t *suboffsets, int ndim) except -1: + * for suboffset in suboffsets[:ndim]: + * if suboffset >= 0: # <<<<<<<<<<<<<< + * raise ValueError, "Indirect dimensions not supported" + * return 0 # return type just used as an error flag +*/ + } + } + + /* "View.MemoryView":705 + * if suboffset >= 0: + * raise ValueError, "Indirect dimensions not supported" + * return 0 # return type just used as an error flag # <<<<<<<<<<<<<< + * + * +*/ + __pyx_r = 0; + goto __pyx_L0; + + /* "View.MemoryView":701 + * return have_slices or nslices, tuple(result) + * + * cdef int assert_direct_dimensions(Py_ssize_t *suboffsets, int ndim) except -1: # <<<<<<<<<<<<<< + * for suboffset in suboffsets[:ndim]: + * if suboffset >= 0: +*/ + + /* function exit code */ + __pyx_L1_error:; + __Pyx_AddTraceback("View.MemoryView.assert_direct_dimensions", __pyx_clineno, __pyx_lineno, __pyx_filename); + __pyx_r = -1; + __pyx_L0:; + return __pyx_r; +} + +/* "View.MemoryView":711 + * + * + * @cname('__pyx_memview_slice') # <<<<<<<<<<<<<< + * cdef memoryview memview_slice(memoryview memview, object indices): + * cdef int new_ndim = 0, suboffset_dim = -1, dim +*/ + +static struct __pyx_memoryview_obj *__pyx_memview_slice(struct __pyx_memoryview_obj *__pyx_v_memview, PyObject *__pyx_v_indices) { + int __pyx_v_new_ndim; + int __pyx_v_suboffset_dim; + int __pyx_v_dim; + __Pyx_memviewslice __pyx_v_src; + __Pyx_memviewslice __pyx_v_dst; + __Pyx_memviewslice *__pyx_v_p_src; + struct __pyx_memoryviewslice_obj *__pyx_v_memviewsliceobj = 0; + __Pyx_memviewslice *__pyx_v_p_dst; + int *__pyx_v_p_suboffset_dim; + Py_ssize_t __pyx_v_start; + Py_ssize_t __pyx_v_stop; + Py_ssize_t __pyx_v_step; + Py_ssize_t __pyx_v_cindex; + int __pyx_v_have_start; + int __pyx_v_have_stop; + int __pyx_v_have_step; + PyObject *__pyx_v_index = NULL; + struct __pyx_memoryview_obj *__pyx_r = NULL; + __Pyx_RefNannyDeclarations + int __pyx_t_1; + PyObject *__pyx_t_2 = NULL; + struct __pyx_memoryview_obj *__pyx_t_3; + char *__pyx_t_4; + int __pyx_t_5; + Py_ssize_t __pyx_t_6; + PyObject *(*__pyx_t_7)(PyObject *); + PyObject *__pyx_t_8 = NULL; + Py_ssize_t __pyx_t_9; + int __pyx_t_10; + Py_ssize_t __pyx_t_11; + int __pyx_lineno = 0; + const char *__pyx_filename = NULL; + int __pyx_clineno = 0; + __Pyx_RefNannySetupContext("memview_slice", 0); + + /* "View.MemoryView":713 + * @cname('__pyx_memview_slice') + * cdef memoryview memview_slice(memoryview memview, object indices): + * cdef int new_ndim = 0, suboffset_dim = -1, dim # <<<<<<<<<<<<<< + * cdef bint negative_step + * cdef __Pyx_memviewslice src, dst +*/ + __pyx_v_new_ndim = 0; + __pyx_v_suboffset_dim = -1; + + /* "View.MemoryView":720 + * + * + * memset(&dst, 0, sizeof(dst)) # <<<<<<<<<<<<<< + * + * cdef _memoryviewslice memviewsliceobj +*/ + (void)(memset((&__pyx_v_dst), 0, (sizeof(__pyx_v_dst)))); + + /* "View.MemoryView":724 + * cdef _memoryviewslice memviewsliceobj + * + * assert memview.view.ndim > 0 # <<<<<<<<<<<<<< + * + * if isinstance(memview, _memoryviewslice): +*/ + #ifndef CYTHON_WITHOUT_ASSERTIONS + if (unlikely(__pyx_assertions_enabled())) { + __pyx_t_1 = (__pyx_v_memview->view.ndim > 0); + if (unlikely(!__pyx_t_1)) { + __Pyx_Raise(((PyObject *)(((PyTypeObject*)PyExc_AssertionError))), 0, 0, 0); + __PYX_ERR(1, 724, __pyx_L1_error) + } + } + #else + if ((1)); else __PYX_ERR(1, 724, __pyx_L1_error) + #endif + + /* "View.MemoryView":726 + * assert memview.view.ndim > 0 + * + * if isinstance(memview, _memoryviewslice): # <<<<<<<<<<<<<< + * memviewsliceobj = memview + * p_src = &memviewsliceobj.from_slice +*/ + __pyx_t_1 = __Pyx_TypeCheck(((PyObject *)__pyx_v_memview), __pyx_mstate_global->__pyx_memoryviewslice_type); + if (__pyx_t_1) { + + /* "View.MemoryView":727 + * + * if isinstance(memview, _memoryviewslice): + * memviewsliceobj = memview # <<<<<<<<<<<<<< + * p_src = &memviewsliceobj.from_slice + * else: +*/ + __pyx_t_2 = ((PyObject *)__pyx_v_memview); + __Pyx_INCREF(__pyx_t_2); + if (!(likely(((__pyx_t_2) == Py_None) || likely(__Pyx_TypeTest(__pyx_t_2, __pyx_mstate_global->__pyx_memoryviewslice_type))))) __PYX_ERR(1, 727, __pyx_L1_error) + __pyx_v_memviewsliceobj = ((struct __pyx_memoryviewslice_obj *)__pyx_t_2); + __pyx_t_2 = 0; + + /* "View.MemoryView":728 + * if isinstance(memview, _memoryviewslice): + * memviewsliceobj = memview + * p_src = &memviewsliceobj.from_slice # <<<<<<<<<<<<<< + * else: + * slice_copy(memview, &src) +*/ + __pyx_v_p_src = (&__pyx_v_memviewsliceobj->from_slice); + + /* "View.MemoryView":726 + * assert memview.view.ndim > 0 + * + * if isinstance(memview, _memoryviewslice): # <<<<<<<<<<<<<< + * memviewsliceobj = memview + * p_src = &memviewsliceobj.from_slice +*/ + goto __pyx_L3; + } + + /* "View.MemoryView":730 + * p_src = &memviewsliceobj.from_slice + * else: + * slice_copy(memview, &src) # <<<<<<<<<<<<<< + * p_src = &src + * +*/ + /*else*/ { + __pyx_memoryview_slice_copy(__pyx_v_memview, (&__pyx_v_src)); + + /* "View.MemoryView":731 + * else: + * slice_copy(memview, &src) + * p_src = &src # <<<<<<<<<<<<<< + * + * +*/ + __pyx_v_p_src = (&__pyx_v_src); + } + __pyx_L3:; + + /* "View.MemoryView":737 + * + * + * dst.memview = p_src.memview # <<<<<<<<<<<<<< + * dst.data = p_src.data + * +*/ + __pyx_t_3 = __pyx_v_p_src->memview; + __pyx_v_dst.memview = __pyx_t_3; + + /* "View.MemoryView":738 + * + * dst.memview = p_src.memview + * dst.data = p_src.data # <<<<<<<<<<<<<< + * + * +*/ + __pyx_t_4 = __pyx_v_p_src->data; + __pyx_v_dst.data = __pyx_t_4; + + /* "View.MemoryView":743 + * + * + * cdef __Pyx_memviewslice *p_dst = &dst # <<<<<<<<<<<<<< + * cdef int *p_suboffset_dim = &suboffset_dim + * cdef Py_ssize_t start, stop, step, cindex +*/ + __pyx_v_p_dst = (&__pyx_v_dst); + + /* "View.MemoryView":744 + * + * cdef __Pyx_memviewslice *p_dst = &dst + * cdef int *p_suboffset_dim = &suboffset_dim # <<<<<<<<<<<<<< + * cdef Py_ssize_t start, stop, step, cindex + * cdef bint have_start, have_stop, have_step +*/ + __pyx_v_p_suboffset_dim = (&__pyx_v_suboffset_dim); + + /* "View.MemoryView":748 + * cdef bint have_start, have_stop, have_step + * + * for dim, index in enumerate(indices): # <<<<<<<<<<<<<< + * if PyIndex_Check(index): + * cindex = index +*/ + __pyx_t_5 = 0; + if (likely(PyList_CheckExact(__pyx_v_indices)) || PyTuple_CheckExact(__pyx_v_indices)) { + __pyx_t_2 = __pyx_v_indices; __Pyx_INCREF(__pyx_t_2); + __pyx_t_6 = 0; + __pyx_t_7 = NULL; + } else { + __pyx_t_6 = -1; __pyx_t_2 = PyObject_GetIter(__pyx_v_indices); if (unlikely(!__pyx_t_2)) __PYX_ERR(1, 748, __pyx_L1_error) + __Pyx_GOTREF(__pyx_t_2); + __pyx_t_7 = (CYTHON_COMPILING_IN_LIMITED_API) ? PyIter_Next : __Pyx_PyObject_GetIterNextFunc(__pyx_t_2); if (unlikely(!__pyx_t_7)) __PYX_ERR(1, 748, __pyx_L1_error) + } + for (;;) { + if (likely(!__pyx_t_7)) { + if (likely(PyList_CheckExact(__pyx_t_2))) { + { + Py_ssize_t __pyx_temp = __Pyx_PyList_GET_SIZE(__pyx_t_2); + #if !CYTHON_ASSUME_SAFE_SIZE + if (unlikely((__pyx_temp < 0))) __PYX_ERR(1, 748, __pyx_L1_error) + #endif + if (__pyx_t_6 >= __pyx_temp) break; + } + __pyx_t_8 = __Pyx_PyList_GetItemRefFast(__pyx_t_2, __pyx_t_6, __Pyx_ReferenceSharing_OwnStrongReference); + ++__pyx_t_6; + } else { + { + Py_ssize_t __pyx_temp = __Pyx_PyTuple_GET_SIZE(__pyx_t_2); + #if !CYTHON_ASSUME_SAFE_SIZE + if (unlikely((__pyx_temp < 0))) __PYX_ERR(1, 748, __pyx_L1_error) + #endif + if (__pyx_t_6 >= __pyx_temp) break; + } + #if CYTHON_ASSUME_SAFE_MACROS && !CYTHON_AVOID_BORROWED_REFS + __pyx_t_8 = __Pyx_NewRef(PyTuple_GET_ITEM(__pyx_t_2, __pyx_t_6)); + #else + __pyx_t_8 = __Pyx_PySequence_ITEM(__pyx_t_2, __pyx_t_6); + #endif + ++__pyx_t_6; + } + if (unlikely(!__pyx_t_8)) __PYX_ERR(1, 748, __pyx_L1_error) + } else { + __pyx_t_8 = __pyx_t_7(__pyx_t_2); + if (unlikely(!__pyx_t_8)) { + PyObject* exc_type = PyErr_Occurred(); + if (exc_type) { + if (unlikely(!__Pyx_PyErr_GivenExceptionMatches(exc_type, PyExc_StopIteration))) __PYX_ERR(1, 748, __pyx_L1_error) + PyErr_Clear(); + } + break; + } + } + __Pyx_GOTREF(__pyx_t_8); + __Pyx_XDECREF_SET(__pyx_v_index, __pyx_t_8); + __pyx_t_8 = 0; + __pyx_v_dim = __pyx_t_5; + __pyx_t_5 = (__pyx_t_5 + 1); + + /* "View.MemoryView":749 + * + * for dim, index in enumerate(indices): + * if PyIndex_Check(index): # <<<<<<<<<<<<<< + * cindex = index + * slice_memviewslice( +*/ + __pyx_t_1 = (PyIndex_Check(__pyx_v_index) != 0); + if (__pyx_t_1) { + + /* "View.MemoryView":750 + * for dim, index in enumerate(indices): + * if PyIndex_Check(index): + * cindex = index # <<<<<<<<<<<<<< + * slice_memviewslice( + * p_dst, p_src.shape[dim], p_src.strides[dim], p_src.suboffsets[dim], +*/ + __pyx_t_9 = __Pyx_PyIndex_AsSsize_t(__pyx_v_index); if (unlikely((__pyx_t_9 == (Py_ssize_t)-1) && PyErr_Occurred())) __PYX_ERR(1, 750, __pyx_L1_error) + __pyx_v_cindex = __pyx_t_9; + + /* "View.MemoryView":751 + * if PyIndex_Check(index): + * cindex = index + * slice_memviewslice( # <<<<<<<<<<<<<< + * p_dst, p_src.shape[dim], p_src.strides[dim], p_src.suboffsets[dim], + * dim, new_ndim, p_suboffset_dim, +*/ + __pyx_t_10 = __pyx_memoryview_slice_memviewslice(__pyx_v_p_dst, (__pyx_v_p_src->shape[__pyx_v_dim]), (__pyx_v_p_src->strides[__pyx_v_dim]), (__pyx_v_p_src->suboffsets[__pyx_v_dim]), __pyx_v_dim, __pyx_v_new_ndim, __pyx_v_p_suboffset_dim, __pyx_v_cindex, 0, 0, 0, 0, 0, 0); if (unlikely(__pyx_t_10 == ((int)-1))) __PYX_ERR(1, 751, __pyx_L1_error) + + /* "View.MemoryView":749 + * + * for dim, index in enumerate(indices): + * if PyIndex_Check(index): # <<<<<<<<<<<<<< + * cindex = index + * slice_memviewslice( +*/ + goto __pyx_L6; + } + + /* "View.MemoryView":757 + * 0, 0, 0, # have_{start,stop,step} + * False) + * elif index is None: # <<<<<<<<<<<<<< + * p_dst.shape[new_ndim] = 1 + * p_dst.strides[new_ndim] = 0 +*/ + __pyx_t_1 = (__pyx_v_index == Py_None); + if (__pyx_t_1) { + + /* "View.MemoryView":758 + * False) + * elif index is None: + * p_dst.shape[new_ndim] = 1 # <<<<<<<<<<<<<< + * p_dst.strides[new_ndim] = 0 + * p_dst.suboffsets[new_ndim] = -1 +*/ + (__pyx_v_p_dst->shape[__pyx_v_new_ndim]) = 1; + + /* "View.MemoryView":759 + * elif index is None: + * p_dst.shape[new_ndim] = 1 + * p_dst.strides[new_ndim] = 0 # <<<<<<<<<<<<<< + * p_dst.suboffsets[new_ndim] = -1 + * new_ndim += 1 +*/ + (__pyx_v_p_dst->strides[__pyx_v_new_ndim]) = 0; + + /* "View.MemoryView":760 + * p_dst.shape[new_ndim] = 1 + * p_dst.strides[new_ndim] = 0 + * p_dst.suboffsets[new_ndim] = -1 # <<<<<<<<<<<<<< + * new_ndim += 1 + * else: +*/ + (__pyx_v_p_dst->suboffsets[__pyx_v_new_ndim]) = -1L; + + /* "View.MemoryView":761 + * p_dst.strides[new_ndim] = 0 + * p_dst.suboffsets[new_ndim] = -1 + * new_ndim += 1 # <<<<<<<<<<<<<< + * else: + * start = index.start or 0 +*/ + __pyx_v_new_ndim = (__pyx_v_new_ndim + 1); + + /* "View.MemoryView":757 + * 0, 0, 0, # have_{start,stop,step} + * False) + * elif index is None: # <<<<<<<<<<<<<< + * p_dst.shape[new_ndim] = 1 + * p_dst.strides[new_ndim] = 0 +*/ + goto __pyx_L6; + } + + /* "View.MemoryView":763 + * new_ndim += 1 + * else: + * start = index.start or 0 # <<<<<<<<<<<<<< + * stop = index.stop or 0 + * step = index.step or 0 +*/ + /*else*/ { + __pyx_t_8 = __Pyx_PyObject_GetAttrStr(__pyx_v_index, __pyx_mstate_global->__pyx_n_u_start); if (unlikely(!__pyx_t_8)) __PYX_ERR(1, 763, __pyx_L1_error) + __Pyx_GOTREF(__pyx_t_8); + __pyx_t_1 = __Pyx_PyObject_IsTrue(__pyx_t_8); if (unlikely((__pyx_t_1 < 0))) __PYX_ERR(1, 763, __pyx_L1_error) + if (!__pyx_t_1) { + __Pyx_DECREF(__pyx_t_8); __pyx_t_8 = 0; + } else { + __pyx_t_11 = __Pyx_PyIndex_AsSsize_t(__pyx_t_8); if (unlikely((__pyx_t_11 == (Py_ssize_t)-1) && PyErr_Occurred())) __PYX_ERR(1, 763, __pyx_L1_error) + __pyx_t_9 = __pyx_t_11; + __Pyx_DECREF(__pyx_t_8); __pyx_t_8 = 0; + goto __pyx_L7_bool_binop_done; + } + __pyx_t_9 = 0; + __pyx_L7_bool_binop_done:; + __pyx_v_start = __pyx_t_9; + + /* "View.MemoryView":764 + * else: + * start = index.start or 0 + * stop = index.stop or 0 # <<<<<<<<<<<<<< + * step = index.step or 0 + * +*/ + __pyx_t_8 = __Pyx_PyObject_GetAttrStr(__pyx_v_index, __pyx_mstate_global->__pyx_n_u_stop); if (unlikely(!__pyx_t_8)) __PYX_ERR(1, 764, __pyx_L1_error) + __Pyx_GOTREF(__pyx_t_8); + __pyx_t_1 = __Pyx_PyObject_IsTrue(__pyx_t_8); if (unlikely((__pyx_t_1 < 0))) __PYX_ERR(1, 764, __pyx_L1_error) + if (!__pyx_t_1) { + __Pyx_DECREF(__pyx_t_8); __pyx_t_8 = 0; + } else { + __pyx_t_11 = __Pyx_PyIndex_AsSsize_t(__pyx_t_8); if (unlikely((__pyx_t_11 == (Py_ssize_t)-1) && PyErr_Occurred())) __PYX_ERR(1, 764, __pyx_L1_error) + __pyx_t_9 = __pyx_t_11; + __Pyx_DECREF(__pyx_t_8); __pyx_t_8 = 0; + goto __pyx_L9_bool_binop_done; + } + __pyx_t_9 = 0; + __pyx_L9_bool_binop_done:; + __pyx_v_stop = __pyx_t_9; + + /* "View.MemoryView":765 + * start = index.start or 0 + * stop = index.stop or 0 + * step = index.step or 0 # <<<<<<<<<<<<<< + * + * have_start = index.start is not None +*/ + __pyx_t_8 = __Pyx_PyObject_GetAttrStr(__pyx_v_index, __pyx_mstate_global->__pyx_n_u_step); if (unlikely(!__pyx_t_8)) __PYX_ERR(1, 765, __pyx_L1_error) + __Pyx_GOTREF(__pyx_t_8); + __pyx_t_1 = __Pyx_PyObject_IsTrue(__pyx_t_8); if (unlikely((__pyx_t_1 < 0))) __PYX_ERR(1, 765, __pyx_L1_error) + if (!__pyx_t_1) { + __Pyx_DECREF(__pyx_t_8); __pyx_t_8 = 0; + } else { + __pyx_t_11 = __Pyx_PyIndex_AsSsize_t(__pyx_t_8); if (unlikely((__pyx_t_11 == (Py_ssize_t)-1) && PyErr_Occurred())) __PYX_ERR(1, 765, __pyx_L1_error) + __pyx_t_9 = __pyx_t_11; + __Pyx_DECREF(__pyx_t_8); __pyx_t_8 = 0; + goto __pyx_L11_bool_binop_done; + } + __pyx_t_9 = 0; + __pyx_L11_bool_binop_done:; + __pyx_v_step = __pyx_t_9; + + /* "View.MemoryView":767 + * step = index.step or 0 + * + * have_start = index.start is not None # <<<<<<<<<<<<<< + * have_stop = index.stop is not None + * have_step = index.step is not None +*/ + __pyx_t_8 = __Pyx_PyObject_GetAttrStr(__pyx_v_index, __pyx_mstate_global->__pyx_n_u_start); if (unlikely(!__pyx_t_8)) __PYX_ERR(1, 767, __pyx_L1_error) + __Pyx_GOTREF(__pyx_t_8); + __pyx_t_1 = (__pyx_t_8 != Py_None); + __Pyx_DECREF(__pyx_t_8); __pyx_t_8 = 0; + __pyx_v_have_start = __pyx_t_1; + + /* "View.MemoryView":768 + * + * have_start = index.start is not None + * have_stop = index.stop is not None # <<<<<<<<<<<<<< + * have_step = index.step is not None + * +*/ + __pyx_t_8 = __Pyx_PyObject_GetAttrStr(__pyx_v_index, __pyx_mstate_global->__pyx_n_u_stop); if (unlikely(!__pyx_t_8)) __PYX_ERR(1, 768, __pyx_L1_error) + __Pyx_GOTREF(__pyx_t_8); + __pyx_t_1 = (__pyx_t_8 != Py_None); + __Pyx_DECREF(__pyx_t_8); __pyx_t_8 = 0; + __pyx_v_have_stop = __pyx_t_1; + + /* "View.MemoryView":769 + * have_start = index.start is not None + * have_stop = index.stop is not None + * have_step = index.step is not None # <<<<<<<<<<<<<< + * + * slice_memviewslice( +*/ + __pyx_t_8 = __Pyx_PyObject_GetAttrStr(__pyx_v_index, __pyx_mstate_global->__pyx_n_u_step); if (unlikely(!__pyx_t_8)) __PYX_ERR(1, 769, __pyx_L1_error) + __Pyx_GOTREF(__pyx_t_8); + __pyx_t_1 = (__pyx_t_8 != Py_None); + __Pyx_DECREF(__pyx_t_8); __pyx_t_8 = 0; + __pyx_v_have_step = __pyx_t_1; + + /* "View.MemoryView":771 + * have_step = index.step is not None + * + * slice_memviewslice( # <<<<<<<<<<<<<< + * p_dst, p_src.shape[dim], p_src.strides[dim], p_src.suboffsets[dim], + * dim, new_ndim, p_suboffset_dim, +*/ + __pyx_t_10 = __pyx_memoryview_slice_memviewslice(__pyx_v_p_dst, (__pyx_v_p_src->shape[__pyx_v_dim]), (__pyx_v_p_src->strides[__pyx_v_dim]), (__pyx_v_p_src->suboffsets[__pyx_v_dim]), __pyx_v_dim, __pyx_v_new_ndim, __pyx_v_p_suboffset_dim, __pyx_v_start, __pyx_v_stop, __pyx_v_step, __pyx_v_have_start, __pyx_v_have_stop, __pyx_v_have_step, 1); if (unlikely(__pyx_t_10 == ((int)-1))) __PYX_ERR(1, 771, __pyx_L1_error) + + /* "View.MemoryView":777 + * have_start, have_stop, have_step, + * True) + * new_ndim += 1 # <<<<<<<<<<<<<< + * + * if isinstance(memview, _memoryviewslice): +*/ + __pyx_v_new_ndim = (__pyx_v_new_ndim + 1); + } + __pyx_L6:; + + /* "View.MemoryView":748 + * cdef bint have_start, have_stop, have_step + * + * for dim, index in enumerate(indices): # <<<<<<<<<<<<<< + * if PyIndex_Check(index): + * cindex = index +*/ + } + __Pyx_DECREF(__pyx_t_2); __pyx_t_2 = 0; + + /* "View.MemoryView":779 + * new_ndim += 1 + * + * if isinstance(memview, _memoryviewslice): # <<<<<<<<<<<<<< + * return memoryview_fromslice(dst, new_ndim, + * memviewsliceobj.to_object_func, +*/ + __pyx_t_1 = __Pyx_TypeCheck(((PyObject *)__pyx_v_memview), __pyx_mstate_global->__pyx_memoryviewslice_type); + if (__pyx_t_1) { + + /* "View.MemoryView":780 + * + * if isinstance(memview, _memoryviewslice): + * return memoryview_fromslice(dst, new_ndim, # <<<<<<<<<<<<<< + * memviewsliceobj.to_object_func, + * memviewsliceobj.to_dtype_func, +*/ + __Pyx_XDECREF((PyObject *)__pyx_r); + + /* "View.MemoryView":781 + * if isinstance(memview, _memoryviewslice): + * return memoryview_fromslice(dst, new_ndim, + * memviewsliceobj.to_object_func, # <<<<<<<<<<<<<< + * memviewsliceobj.to_dtype_func, + * memview.dtype_is_object) +*/ + if (unlikely(!__pyx_v_memviewsliceobj)) { __Pyx_RaiseUnboundLocalError("memviewsliceobj"); __PYX_ERR(1, 781, __pyx_L1_error) } + + /* "View.MemoryView":782 + * return memoryview_fromslice(dst, new_ndim, + * memviewsliceobj.to_object_func, + * memviewsliceobj.to_dtype_func, # <<<<<<<<<<<<<< + * memview.dtype_is_object) + * else: +*/ + if (unlikely(!__pyx_v_memviewsliceobj)) { __Pyx_RaiseUnboundLocalError("memviewsliceobj"); __PYX_ERR(1, 782, __pyx_L1_error) } + + /* "View.MemoryView":780 + * + * if isinstance(memview, _memoryviewslice): + * return memoryview_fromslice(dst, new_ndim, # <<<<<<<<<<<<<< + * memviewsliceobj.to_object_func, + * memviewsliceobj.to_dtype_func, +*/ + __pyx_t_2 = __pyx_memoryview_fromslice(__pyx_v_dst, __pyx_v_new_ndim, __pyx_v_memviewsliceobj->to_object_func, __pyx_v_memviewsliceobj->to_dtype_func, __pyx_v_memview->dtype_is_object); if (unlikely(!__pyx_t_2)) __PYX_ERR(1, 780, __pyx_L1_error) + __Pyx_GOTREF(__pyx_t_2); + if (!(likely(((__pyx_t_2) == Py_None) || likely(__Pyx_TypeTest(__pyx_t_2, __pyx_mstate_global->__pyx_memoryview_type))))) __PYX_ERR(1, 780, __pyx_L1_error) + __pyx_r = ((struct __pyx_memoryview_obj *)__pyx_t_2); + __pyx_t_2 = 0; + goto __pyx_L0; + + /* "View.MemoryView":779 + * new_ndim += 1 + * + * if isinstance(memview, _memoryviewslice): # <<<<<<<<<<<<<< + * return memoryview_fromslice(dst, new_ndim, + * memviewsliceobj.to_object_func, +*/ + } + + /* "View.MemoryView":785 + * memview.dtype_is_object) + * else: + * return memoryview_fromslice(dst, new_ndim, NULL, NULL, # <<<<<<<<<<<<<< + * memview.dtype_is_object) + * +*/ + /*else*/ { + __Pyx_XDECREF((PyObject *)__pyx_r); + + /* "View.MemoryView":786 + * else: + * return memoryview_fromslice(dst, new_ndim, NULL, NULL, + * memview.dtype_is_object) # <<<<<<<<<<<<<< + * + * +*/ + __pyx_t_2 = __pyx_memoryview_fromslice(__pyx_v_dst, __pyx_v_new_ndim, NULL, NULL, __pyx_v_memview->dtype_is_object); if (unlikely(!__pyx_t_2)) __PYX_ERR(1, 785, __pyx_L1_error) + __Pyx_GOTREF(__pyx_t_2); + + /* "View.MemoryView":785 + * memview.dtype_is_object) + * else: + * return memoryview_fromslice(dst, new_ndim, NULL, NULL, # <<<<<<<<<<<<<< + * memview.dtype_is_object) + * +*/ + if (!(likely(((__pyx_t_2) == Py_None) || likely(__Pyx_TypeTest(__pyx_t_2, __pyx_mstate_global->__pyx_memoryview_type))))) __PYX_ERR(1, 785, __pyx_L1_error) + __pyx_r = ((struct __pyx_memoryview_obj *)__pyx_t_2); + __pyx_t_2 = 0; + goto __pyx_L0; + } + + /* "View.MemoryView":711 + * + * + * @cname('__pyx_memview_slice') # <<<<<<<<<<<<<< + * cdef memoryview memview_slice(memoryview memview, object indices): + * cdef int new_ndim = 0, suboffset_dim = -1, dim +*/ + + /* function exit code */ + __pyx_L1_error:; + __Pyx_XDECREF(__pyx_t_2); + __Pyx_XDECREF(__pyx_t_8); + __Pyx_AddTraceback("View.MemoryView.memview_slice", __pyx_clineno, __pyx_lineno, __pyx_filename); + __pyx_r = 0; + __pyx_L0:; + __Pyx_XDECREF((PyObject *)__pyx_v_memviewsliceobj); + __Pyx_XDECREF(__pyx_v_index); + __Pyx_XGIVEREF((PyObject *)__pyx_r); + __Pyx_RefNannyFinishContext(); + return __pyx_r; +} + +/* "View.MemoryView":793 + * + * + * @cname('__pyx_memoryview_slice_memviewslice') # <<<<<<<<<<<<<< + * cdef int slice_memviewslice( + * __Pyx_memviewslice *dst, +*/ + +static int __pyx_memoryview_slice_memviewslice(__Pyx_memviewslice *__pyx_v_dst, Py_ssize_t __pyx_v_shape, Py_ssize_t __pyx_v_stride, Py_ssize_t __pyx_v_suboffset, int __pyx_v_dim, int __pyx_v_new_ndim, int *__pyx_v_suboffset_dim, Py_ssize_t __pyx_v_start, Py_ssize_t __pyx_v_stop, Py_ssize_t __pyx_v_step, int __pyx_v_have_start, int __pyx_v_have_stop, int __pyx_v_have_step, int __pyx_v_is_slice) { + Py_ssize_t __pyx_v_new_shape; + int __pyx_v_negative_step; + int __pyx_r; + int __pyx_t_1; + int __pyx_t_2; + int __pyx_t_3; + int __pyx_lineno = 0; + const char *__pyx_filename = NULL; + int __pyx_clineno = 0; + PyGILState_STATE __pyx_gilstate_save; + + /* "View.MemoryView":814 + * cdef bint negative_step + * + * if not is_slice: # <<<<<<<<<<<<<< + * + * if start < 0: +*/ + __pyx_t_1 = (!__pyx_v_is_slice); + if (__pyx_t_1) { + + /* "View.MemoryView":816 + * if not is_slice: + * + * if start < 0: # <<<<<<<<<<<<<< + * start += shape + * if not 0 <= start < shape: +*/ + __pyx_t_1 = (__pyx_v_start < 0); + if (__pyx_t_1) { + + /* "View.MemoryView":817 + * + * if start < 0: + * start += shape # <<<<<<<<<<<<<< + * if not 0 <= start < shape: + * _err_dim(PyExc_IndexError, "Index out of bounds (axis %d)", dim) +*/ + __pyx_v_start = (__pyx_v_start + __pyx_v_shape); + + /* "View.MemoryView":816 + * if not is_slice: + * + * if start < 0: # <<<<<<<<<<<<<< + * start += shape + * if not 0 <= start < shape: +*/ + } + + /* "View.MemoryView":818 + * if start < 0: + * start += shape + * if not 0 <= start < shape: # <<<<<<<<<<<<<< + * _err_dim(PyExc_IndexError, "Index out of bounds (axis %d)", dim) + * else: +*/ + __pyx_t_1 = (0 <= __pyx_v_start); + if (__pyx_t_1) { + __pyx_t_1 = (__pyx_v_start < __pyx_v_shape); + } + __pyx_t_2 = (!__pyx_t_1); + if (__pyx_t_2) { + + /* "View.MemoryView":819 + * start += shape + * if not 0 <= start < shape: + * _err_dim(PyExc_IndexError, "Index out of bounds (axis %d)", dim) # <<<<<<<<<<<<<< + * else: + * +*/ + __pyx_t_3 = __pyx_memoryview_err_dim(PyExc_IndexError, __pyx_mstate_global->__pyx_kp_u_Index_out_of_bounds_axis_d, __pyx_v_dim); if (unlikely(__pyx_t_3 == ((int)-1))) __PYX_ERR(1, 819, __pyx_L1_error) + + /* "View.MemoryView":818 + * if start < 0: + * start += shape + * if not 0 <= start < shape: # <<<<<<<<<<<<<< + * _err_dim(PyExc_IndexError, "Index out of bounds (axis %d)", dim) + * else: +*/ + } + + /* "View.MemoryView":814 + * cdef bint negative_step + * + * if not is_slice: # <<<<<<<<<<<<<< + * + * if start < 0: +*/ + goto __pyx_L3; + } + + /* "View.MemoryView":822 + * else: + * + * if have_step: # <<<<<<<<<<<<<< + * negative_step = step < 0 + * if step == 0: +*/ + /*else*/ { + __pyx_t_2 = (__pyx_v_have_step != 0); + if (__pyx_t_2) { + + /* "View.MemoryView":823 + * + * if have_step: + * negative_step = step < 0 # <<<<<<<<<<<<<< + * if step == 0: + * _err_dim(PyExc_ValueError, "Step may not be zero (axis %d)", dim) +*/ + __pyx_v_negative_step = (__pyx_v_step < 0); + + /* "View.MemoryView":824 + * if have_step: + * negative_step = step < 0 + * if step == 0: # <<<<<<<<<<<<<< + * _err_dim(PyExc_ValueError, "Step may not be zero (axis %d)", dim) + * else: +*/ + __pyx_t_2 = (__pyx_v_step == 0); + if (__pyx_t_2) { + + /* "View.MemoryView":825 + * negative_step = step < 0 + * if step == 0: + * _err_dim(PyExc_ValueError, "Step may not be zero (axis %d)", dim) # <<<<<<<<<<<<<< + * else: + * negative_step = False +*/ + __pyx_t_3 = __pyx_memoryview_err_dim(PyExc_ValueError, __pyx_mstate_global->__pyx_kp_u_Step_may_not_be_zero_axis_d, __pyx_v_dim); if (unlikely(__pyx_t_3 == ((int)-1))) __PYX_ERR(1, 825, __pyx_L1_error) + + /* "View.MemoryView":824 + * if have_step: + * negative_step = step < 0 + * if step == 0: # <<<<<<<<<<<<<< + * _err_dim(PyExc_ValueError, "Step may not be zero (axis %d)", dim) + * else: +*/ + } + + /* "View.MemoryView":822 + * else: + * + * if have_step: # <<<<<<<<<<<<<< + * negative_step = step < 0 + * if step == 0: +*/ + goto __pyx_L6; + } + + /* "View.MemoryView":827 + * _err_dim(PyExc_ValueError, "Step may not be zero (axis %d)", dim) + * else: + * negative_step = False # <<<<<<<<<<<<<< + * step = 1 + * +*/ + /*else*/ { + __pyx_v_negative_step = 0; + + /* "View.MemoryView":828 + * else: + * negative_step = False + * step = 1 # <<<<<<<<<<<<<< + * + * +*/ + __pyx_v_step = 1; + } + __pyx_L6:; + + /* "View.MemoryView":831 + * + * + * if have_start: # <<<<<<<<<<<<<< + * if start < 0: + * start += shape +*/ + __pyx_t_2 = (__pyx_v_have_start != 0); + if (__pyx_t_2) { + + /* "View.MemoryView":832 + * + * if have_start: + * if start < 0: # <<<<<<<<<<<<<< + * start += shape + * if start < 0: +*/ + __pyx_t_2 = (__pyx_v_start < 0); + if (__pyx_t_2) { + + /* "View.MemoryView":833 + * if have_start: + * if start < 0: + * start += shape # <<<<<<<<<<<<<< + * if start < 0: + * start = 0 +*/ + __pyx_v_start = (__pyx_v_start + __pyx_v_shape); + + /* "View.MemoryView":834 + * if start < 0: + * start += shape + * if start < 0: # <<<<<<<<<<<<<< + * start = 0 + * elif start >= shape: +*/ + __pyx_t_2 = (__pyx_v_start < 0); + if (__pyx_t_2) { + + /* "View.MemoryView":835 + * start += shape + * if start < 0: + * start = 0 # <<<<<<<<<<<<<< + * elif start >= shape: + * if negative_step: +*/ + __pyx_v_start = 0; + + /* "View.MemoryView":834 + * if start < 0: + * start += shape + * if start < 0: # <<<<<<<<<<<<<< + * start = 0 + * elif start >= shape: +*/ + } + + /* "View.MemoryView":832 + * + * if have_start: + * if start < 0: # <<<<<<<<<<<<<< + * start += shape + * if start < 0: +*/ + goto __pyx_L9; + } + + /* "View.MemoryView":836 + * if start < 0: + * start = 0 + * elif start >= shape: # <<<<<<<<<<<<<< + * if negative_step: + * start = shape - 1 +*/ + __pyx_t_2 = (__pyx_v_start >= __pyx_v_shape); + if (__pyx_t_2) { + + /* "View.MemoryView":837 + * start = 0 + * elif start >= shape: + * if negative_step: # <<<<<<<<<<<<<< + * start = shape - 1 + * else: +*/ + if (__pyx_v_negative_step) { + + /* "View.MemoryView":838 + * elif start >= shape: + * if negative_step: + * start = shape - 1 # <<<<<<<<<<<<<< + * else: + * start = shape +*/ + __pyx_v_start = (__pyx_v_shape - 1); + + /* "View.MemoryView":837 + * start = 0 + * elif start >= shape: + * if negative_step: # <<<<<<<<<<<<<< + * start = shape - 1 + * else: +*/ + goto __pyx_L11; + } + + /* "View.MemoryView":840 + * start = shape - 1 + * else: + * start = shape # <<<<<<<<<<<<<< + * else: + * if negative_step: +*/ + /*else*/ { + __pyx_v_start = __pyx_v_shape; + } + __pyx_L11:; + + /* "View.MemoryView":836 + * if start < 0: + * start = 0 + * elif start >= shape: # <<<<<<<<<<<<<< + * if negative_step: + * start = shape - 1 +*/ + } + __pyx_L9:; + + /* "View.MemoryView":831 + * + * + * if have_start: # <<<<<<<<<<<<<< + * if start < 0: + * start += shape +*/ + goto __pyx_L8; + } + + /* "View.MemoryView":842 + * start = shape + * else: + * if negative_step: # <<<<<<<<<<<<<< + * start = shape - 1 + * else: +*/ + /*else*/ { + if (__pyx_v_negative_step) { + + /* "View.MemoryView":843 + * else: + * if negative_step: + * start = shape - 1 # <<<<<<<<<<<<<< + * else: + * start = 0 +*/ + __pyx_v_start = (__pyx_v_shape - 1); + + /* "View.MemoryView":842 + * start = shape + * else: + * if negative_step: # <<<<<<<<<<<<<< + * start = shape - 1 + * else: +*/ + goto __pyx_L12; + } + + /* "View.MemoryView":845 + * start = shape - 1 + * else: + * start = 0 # <<<<<<<<<<<<<< + * + * if have_stop: +*/ + /*else*/ { + __pyx_v_start = 0; + } + __pyx_L12:; + } + __pyx_L8:; + + /* "View.MemoryView":847 + * start = 0 + * + * if have_stop: # <<<<<<<<<<<<<< + * if stop < 0: + * stop += shape +*/ + __pyx_t_2 = (__pyx_v_have_stop != 0); + if (__pyx_t_2) { + + /* "View.MemoryView":848 + * + * if have_stop: + * if stop < 0: # <<<<<<<<<<<<<< + * stop += shape + * if stop < 0: +*/ + __pyx_t_2 = (__pyx_v_stop < 0); + if (__pyx_t_2) { + + /* "View.MemoryView":849 + * if have_stop: + * if stop < 0: + * stop += shape # <<<<<<<<<<<<<< + * if stop < 0: + * stop = 0 +*/ + __pyx_v_stop = (__pyx_v_stop + __pyx_v_shape); + + /* "View.MemoryView":850 + * if stop < 0: + * stop += shape + * if stop < 0: # <<<<<<<<<<<<<< + * stop = 0 + * elif stop > shape: +*/ + __pyx_t_2 = (__pyx_v_stop < 0); + if (__pyx_t_2) { + + /* "View.MemoryView":851 + * stop += shape + * if stop < 0: + * stop = 0 # <<<<<<<<<<<<<< + * elif stop > shape: + * stop = shape +*/ + __pyx_v_stop = 0; + + /* "View.MemoryView":850 + * if stop < 0: + * stop += shape + * if stop < 0: # <<<<<<<<<<<<<< + * stop = 0 + * elif stop > shape: +*/ + } + + /* "View.MemoryView":848 + * + * if have_stop: + * if stop < 0: # <<<<<<<<<<<<<< + * stop += shape + * if stop < 0: +*/ + goto __pyx_L14; + } + + /* "View.MemoryView":852 + * if stop < 0: + * stop = 0 + * elif stop > shape: # <<<<<<<<<<<<<< + * stop = shape + * else: +*/ + __pyx_t_2 = (__pyx_v_stop > __pyx_v_shape); + if (__pyx_t_2) { + + /* "View.MemoryView":853 + * stop = 0 + * elif stop > shape: + * stop = shape # <<<<<<<<<<<<<< + * else: + * if negative_step: +*/ + __pyx_v_stop = __pyx_v_shape; + + /* "View.MemoryView":852 + * if stop < 0: + * stop = 0 + * elif stop > shape: # <<<<<<<<<<<<<< + * stop = shape + * else: +*/ + } + __pyx_L14:; + + /* "View.MemoryView":847 + * start = 0 + * + * if have_stop: # <<<<<<<<<<<<<< + * if stop < 0: + * stop += shape +*/ + goto __pyx_L13; + } + + /* "View.MemoryView":855 + * stop = shape + * else: + * if negative_step: # <<<<<<<<<<<<<< + * stop = -1 + * else: +*/ + /*else*/ { + if (__pyx_v_negative_step) { + + /* "View.MemoryView":856 + * else: + * if negative_step: + * stop = -1 # <<<<<<<<<<<<<< + * else: + * stop = shape +*/ + __pyx_v_stop = -1L; + + /* "View.MemoryView":855 + * stop = shape + * else: + * if negative_step: # <<<<<<<<<<<<<< + * stop = -1 + * else: +*/ + goto __pyx_L16; + } + + /* "View.MemoryView":858 + * stop = -1 + * else: + * stop = shape # <<<<<<<<<<<<<< + * + * +*/ + /*else*/ { + __pyx_v_stop = __pyx_v_shape; + } + __pyx_L16:; + } + __pyx_L13:; + + /* "View.MemoryView":862 + * + * with cython.cdivision(True): + * new_shape = (stop - start) // step # <<<<<<<<<<<<<< + * + * if (stop - start) - step * new_shape: +*/ + __pyx_v_new_shape = ((__pyx_v_stop - __pyx_v_start) / __pyx_v_step); + + /* "View.MemoryView":864 + * new_shape = (stop - start) // step + * + * if (stop - start) - step * new_shape: # <<<<<<<<<<<<<< + * new_shape += 1 + * +*/ + __pyx_t_2 = (((__pyx_v_stop - __pyx_v_start) - (__pyx_v_step * __pyx_v_new_shape)) != 0); + if (__pyx_t_2) { + + /* "View.MemoryView":865 + * + * if (stop - start) - step * new_shape: + * new_shape += 1 # <<<<<<<<<<<<<< + * + * if new_shape < 0: +*/ + __pyx_v_new_shape = (__pyx_v_new_shape + 1); + + /* "View.MemoryView":864 + * new_shape = (stop - start) // step + * + * if (stop - start) - step * new_shape: # <<<<<<<<<<<<<< + * new_shape += 1 + * +*/ + } + + /* "View.MemoryView":867 + * new_shape += 1 + * + * if new_shape < 0: # <<<<<<<<<<<<<< + * new_shape = 0 + * +*/ + __pyx_t_2 = (__pyx_v_new_shape < 0); + if (__pyx_t_2) { + + /* "View.MemoryView":868 + * + * if new_shape < 0: + * new_shape = 0 # <<<<<<<<<<<<<< + * + * +*/ + __pyx_v_new_shape = 0; + + /* "View.MemoryView":867 + * new_shape += 1 + * + * if new_shape < 0: # <<<<<<<<<<<<<< + * new_shape = 0 + * +*/ + } + + /* "View.MemoryView":871 + * + * + * dst.strides[new_ndim] = stride * step # <<<<<<<<<<<<<< + * dst.shape[new_ndim] = new_shape + * dst.suboffsets[new_ndim] = suboffset +*/ + (__pyx_v_dst->strides[__pyx_v_new_ndim]) = (__pyx_v_stride * __pyx_v_step); + + /* "View.MemoryView":872 + * + * dst.strides[new_ndim] = stride * step + * dst.shape[new_ndim] = new_shape # <<<<<<<<<<<<<< + * dst.suboffsets[new_ndim] = suboffset + * +*/ + (__pyx_v_dst->shape[__pyx_v_new_ndim]) = __pyx_v_new_shape; + + /* "View.MemoryView":873 + * dst.strides[new_ndim] = stride * step + * dst.shape[new_ndim] = new_shape + * dst.suboffsets[new_ndim] = suboffset # <<<<<<<<<<<<<< + * + * +*/ + (__pyx_v_dst->suboffsets[__pyx_v_new_ndim]) = __pyx_v_suboffset; + } + __pyx_L3:; + + /* "View.MemoryView":876 + * + * + * if suboffset_dim[0] < 0: # <<<<<<<<<<<<<< + * dst.data += start * stride + * else: +*/ + __pyx_t_2 = ((__pyx_v_suboffset_dim[0]) < 0); + if (__pyx_t_2) { + + /* "View.MemoryView":877 + * + * if suboffset_dim[0] < 0: + * dst.data += start * stride # <<<<<<<<<<<<<< + * else: + * dst.suboffsets[suboffset_dim[0]] += start * stride +*/ + __pyx_v_dst->data = (__pyx_v_dst->data + (__pyx_v_start * __pyx_v_stride)); + + /* "View.MemoryView":876 + * + * + * if suboffset_dim[0] < 0: # <<<<<<<<<<<<<< + * dst.data += start * stride + * else: +*/ + goto __pyx_L19; + } + + /* "View.MemoryView":879 + * dst.data += start * stride + * else: + * dst.suboffsets[suboffset_dim[0]] += start * stride # <<<<<<<<<<<<<< + * + * if suboffset >= 0: +*/ + /*else*/ { + __pyx_t_3 = (__pyx_v_suboffset_dim[0]); + (__pyx_v_dst->suboffsets[__pyx_t_3]) = ((__pyx_v_dst->suboffsets[__pyx_t_3]) + (__pyx_v_start * __pyx_v_stride)); + } + __pyx_L19:; + + /* "View.MemoryView":881 + * dst.suboffsets[suboffset_dim[0]] += start * stride + * + * if suboffset >= 0: # <<<<<<<<<<<<<< + * if not is_slice: + * if new_ndim == 0: +*/ + __pyx_t_2 = (__pyx_v_suboffset >= 0); + if (__pyx_t_2) { + + /* "View.MemoryView":882 + * + * if suboffset >= 0: + * if not is_slice: # <<<<<<<<<<<<<< + * if new_ndim == 0: + * dst.data = ( dst.data)[0] + suboffset +*/ + __pyx_t_2 = (!__pyx_v_is_slice); + if (__pyx_t_2) { + + /* "View.MemoryView":883 + * if suboffset >= 0: + * if not is_slice: + * if new_ndim == 0: # <<<<<<<<<<<<<< + * dst.data = ( dst.data)[0] + suboffset + * else: +*/ + __pyx_t_2 = (__pyx_v_new_ndim == 0); + if (__pyx_t_2) { + + /* "View.MemoryView":884 + * if not is_slice: + * if new_ndim == 0: + * dst.data = ( dst.data)[0] + suboffset # <<<<<<<<<<<<<< + * else: + * _err_dim(PyExc_IndexError, "All dimensions preceding dimension %d " +*/ + __pyx_v_dst->data = ((((char **)__pyx_v_dst->data)[0]) + __pyx_v_suboffset); + + /* "View.MemoryView":883 + * if suboffset >= 0: + * if not is_slice: + * if new_ndim == 0: # <<<<<<<<<<<<<< + * dst.data = ( dst.data)[0] + suboffset + * else: +*/ + goto __pyx_L22; + } + + /* "View.MemoryView":886 + * dst.data = ( dst.data)[0] + suboffset + * else: + * _err_dim(PyExc_IndexError, "All dimensions preceding dimension %d " # <<<<<<<<<<<<<< + * "must be indexed and not sliced", dim) + * else: +*/ + /*else*/ { + + /* "View.MemoryView":887 + * else: + * _err_dim(PyExc_IndexError, "All dimensions preceding dimension %d " + * "must be indexed and not sliced", dim) # <<<<<<<<<<<<<< + * else: + * suboffset_dim[0] = new_ndim +*/ + __pyx_t_3 = __pyx_memoryview_err_dim(PyExc_IndexError, __pyx_mstate_global->__pyx_kp_u_All_dimensions_preceding_dimensi, __pyx_v_dim); if (unlikely(__pyx_t_3 == ((int)-1))) __PYX_ERR(1, 886, __pyx_L1_error) + } + __pyx_L22:; + + /* "View.MemoryView":882 + * + * if suboffset >= 0: + * if not is_slice: # <<<<<<<<<<<<<< + * if new_ndim == 0: + * dst.data = ( dst.data)[0] + suboffset +*/ + goto __pyx_L21; + } + + /* "View.MemoryView":889 + * "must be indexed and not sliced", dim) + * else: + * suboffset_dim[0] = new_ndim # <<<<<<<<<<<<<< + * + * return 0 +*/ + /*else*/ { + (__pyx_v_suboffset_dim[0]) = __pyx_v_new_ndim; + } + __pyx_L21:; + + /* "View.MemoryView":881 + * dst.suboffsets[suboffset_dim[0]] += start * stride + * + * if suboffset >= 0: # <<<<<<<<<<<<<< + * if not is_slice: + * if new_ndim == 0: +*/ + } + + /* "View.MemoryView":891 + * suboffset_dim[0] = new_ndim + * + * return 0 # <<<<<<<<<<<<<< + * + * +*/ + __pyx_r = 0; + goto __pyx_L0; + + /* "View.MemoryView":793 + * + * + * @cname('__pyx_memoryview_slice_memviewslice') # <<<<<<<<<<<<<< + * cdef int slice_memviewslice( + * __Pyx_memviewslice *dst, +*/ + + /* function exit code */ + __pyx_L1_error:; + __pyx_gilstate_save = __Pyx_PyGILState_Ensure(); + __Pyx_AddTraceback("View.MemoryView.slice_memviewslice", __pyx_clineno, __pyx_lineno, __pyx_filename); + __pyx_r = -1; + __Pyx_PyGILState_Release(__pyx_gilstate_save); + __pyx_L0:; + return __pyx_r; +} + +/* "View.MemoryView":896 + * + * + * @cname('__pyx_pybuffer_index') # <<<<<<<<<<<<<< + * cdef char *pybuffer_index(Py_buffer *view, char *bufp, Py_ssize_t index, + * Py_ssize_t dim) except NULL: +*/ + +static char *__pyx_pybuffer_index(Py_buffer *__pyx_v_view, char *__pyx_v_bufp, Py_ssize_t __pyx_v_index, Py_ssize_t __pyx_v_dim) { + Py_ssize_t __pyx_v_shape; + Py_ssize_t __pyx_v_stride; + Py_ssize_t __pyx_v_suboffset; + Py_ssize_t __pyx_v_itemsize; + char *__pyx_v_resultp; + char *__pyx_r; + __Pyx_RefNannyDeclarations + Py_ssize_t __pyx_t_1; + int __pyx_t_2; + PyObject *__pyx_t_3 = NULL; + PyObject *__pyx_t_4[3]; + PyObject *__pyx_t_5 = NULL; + int __pyx_lineno = 0; + const char *__pyx_filename = NULL; + int __pyx_clineno = 0; + __Pyx_RefNannySetupContext("pybuffer_index", 0); + + /* "View.MemoryView":899 + * cdef char *pybuffer_index(Py_buffer *view, char *bufp, Py_ssize_t index, + * Py_ssize_t dim) except NULL: + * cdef Py_ssize_t shape, stride, suboffset = -1 # <<<<<<<<<<<<<< + * cdef Py_ssize_t itemsize = view.itemsize + * cdef char *resultp +*/ + __pyx_v_suboffset = -1L; + + /* "View.MemoryView":900 + * Py_ssize_t dim) except NULL: + * cdef Py_ssize_t shape, stride, suboffset = -1 + * cdef Py_ssize_t itemsize = view.itemsize # <<<<<<<<<<<<<< + * cdef char *resultp + * +*/ + __pyx_t_1 = __pyx_v_view->itemsize; + __pyx_v_itemsize = __pyx_t_1; + + /* "View.MemoryView":903 + * cdef char *resultp + * + * if view.ndim == 0: # <<<<<<<<<<<<<< + * shape = view.len // itemsize + * stride = itemsize +*/ + __pyx_t_2 = (__pyx_v_view->ndim == 0); + if (__pyx_t_2) { + + /* "View.MemoryView":904 + * + * if view.ndim == 0: + * shape = view.len // itemsize # <<<<<<<<<<<<<< + * stride = itemsize + * else: +*/ + if (unlikely(__pyx_v_itemsize == 0)) { + PyErr_SetString(PyExc_ZeroDivisionError, "integer division or modulo by zero"); + __PYX_ERR(1, 904, __pyx_L1_error) + } + else if (sizeof(Py_ssize_t) == sizeof(long) && (!(((Py_ssize_t)-1) > 0)) && unlikely(__pyx_v_itemsize == (Py_ssize_t)-1) && unlikely(__Pyx_UNARY_NEG_WOULD_OVERFLOW(__pyx_v_view->len))) { + PyErr_SetString(PyExc_OverflowError, "value too large to perform division"); + __PYX_ERR(1, 904, __pyx_L1_error) + } + __pyx_v_shape = __Pyx_div_Py_ssize_t(__pyx_v_view->len, __pyx_v_itemsize, 0); + + /* "View.MemoryView":905 + * if view.ndim == 0: + * shape = view.len // itemsize + * stride = itemsize # <<<<<<<<<<<<<< + * else: + * shape = view.shape[dim] +*/ + __pyx_v_stride = __pyx_v_itemsize; + + /* "View.MemoryView":903 + * cdef char *resultp + * + * if view.ndim == 0: # <<<<<<<<<<<<<< + * shape = view.len // itemsize + * stride = itemsize +*/ + goto __pyx_L3; + } + + /* "View.MemoryView":907 + * stride = itemsize + * else: + * shape = view.shape[dim] # <<<<<<<<<<<<<< + * stride = view.strides[dim] + * if view.suboffsets != NULL: +*/ + /*else*/ { + __pyx_v_shape = (__pyx_v_view->shape[__pyx_v_dim]); + + /* "View.MemoryView":908 + * else: + * shape = view.shape[dim] + * stride = view.strides[dim] # <<<<<<<<<<<<<< + * if view.suboffsets != NULL: + * suboffset = view.suboffsets[dim] +*/ + __pyx_v_stride = (__pyx_v_view->strides[__pyx_v_dim]); + + /* "View.MemoryView":909 + * shape = view.shape[dim] + * stride = view.strides[dim] + * if view.suboffsets != NULL: # <<<<<<<<<<<<<< + * suboffset = view.suboffsets[dim] + * +*/ + __pyx_t_2 = (__pyx_v_view->suboffsets != NULL); + if (__pyx_t_2) { + + /* "View.MemoryView":910 + * stride = view.strides[dim] + * if view.suboffsets != NULL: + * suboffset = view.suboffsets[dim] # <<<<<<<<<<<<<< + * + * if index < 0: +*/ + __pyx_v_suboffset = (__pyx_v_view->suboffsets[__pyx_v_dim]); + + /* "View.MemoryView":909 + * shape = view.shape[dim] + * stride = view.strides[dim] + * if view.suboffsets != NULL: # <<<<<<<<<<<<<< + * suboffset = view.suboffsets[dim] + * +*/ + } + } + __pyx_L3:; + + /* "View.MemoryView":912 + * suboffset = view.suboffsets[dim] + * + * if index < 0: # <<<<<<<<<<<<<< + * index += view.shape[dim] + * if index < 0: +*/ + __pyx_t_2 = (__pyx_v_index < 0); + if (__pyx_t_2) { + + /* "View.MemoryView":913 + * + * if index < 0: + * index += view.shape[dim] # <<<<<<<<<<<<<< + * if index < 0: + * raise IndexError, f"Out of bounds on buffer access (axis {dim})" +*/ + __pyx_v_index = (__pyx_v_index + (__pyx_v_view->shape[__pyx_v_dim])); + + /* "View.MemoryView":914 + * if index < 0: + * index += view.shape[dim] + * if index < 0: # <<<<<<<<<<<<<< + * raise IndexError, f"Out of bounds on buffer access (axis {dim})" + * +*/ + __pyx_t_2 = (__pyx_v_index < 0); + if (unlikely(__pyx_t_2)) { + + /* "View.MemoryView":915 + * index += view.shape[dim] + * if index < 0: + * raise IndexError, f"Out of bounds on buffer access (axis {dim})" # <<<<<<<<<<<<<< + * + * if index >= shape: +*/ + __pyx_t_3 = __Pyx_PyUnicode_From_Py_ssize_t(__pyx_v_dim, 0, ' ', 'd'); if (unlikely(!__pyx_t_3)) __PYX_ERR(1, 915, __pyx_L1_error) + __Pyx_GOTREF(__pyx_t_3); + __pyx_t_4[0] = __pyx_mstate_global->__pyx_kp_u_Out_of_bounds_on_buffer_access_a; + __pyx_t_4[1] = __pyx_t_3; + __pyx_t_4[2] = __pyx_mstate_global->__pyx_kp_u__5; + __pyx_t_5 = __Pyx_PyUnicode_Join(__pyx_t_4, 3, 37 + __Pyx_PyUnicode_GET_LENGTH(__pyx_t_3) + 1, 127); + if (unlikely(!__pyx_t_5)) __PYX_ERR(1, 915, __pyx_L1_error) + __Pyx_GOTREF(__pyx_t_5); + __Pyx_DECREF(__pyx_t_3); __pyx_t_3 = 0; + __Pyx_Raise(((PyObject *)(((PyTypeObject*)PyExc_IndexError))), __pyx_t_5, 0, 0); + __Pyx_DECREF(__pyx_t_5); __pyx_t_5 = 0; + __PYX_ERR(1, 915, __pyx_L1_error) + + /* "View.MemoryView":914 + * if index < 0: + * index += view.shape[dim] + * if index < 0: # <<<<<<<<<<<<<< + * raise IndexError, f"Out of bounds on buffer access (axis {dim})" + * +*/ + } + + /* "View.MemoryView":912 + * suboffset = view.suboffsets[dim] + * + * if index < 0: # <<<<<<<<<<<<<< + * index += view.shape[dim] + * if index < 0: +*/ + } + + /* "View.MemoryView":917 + * raise IndexError, f"Out of bounds on buffer access (axis {dim})" + * + * if index >= shape: # <<<<<<<<<<<<<< + * raise IndexError, f"Out of bounds on buffer access (axis {dim})" + * +*/ + __pyx_t_2 = (__pyx_v_index >= __pyx_v_shape); + if (unlikely(__pyx_t_2)) { + + /* "View.MemoryView":918 + * + * if index >= shape: + * raise IndexError, f"Out of bounds on buffer access (axis {dim})" # <<<<<<<<<<<<<< + * + * resultp = bufp + index * stride +*/ + __pyx_t_5 = __Pyx_PyUnicode_From_Py_ssize_t(__pyx_v_dim, 0, ' ', 'd'); if (unlikely(!__pyx_t_5)) __PYX_ERR(1, 918, __pyx_L1_error) + __Pyx_GOTREF(__pyx_t_5); + __pyx_t_4[0] = __pyx_mstate_global->__pyx_kp_u_Out_of_bounds_on_buffer_access_a; + __pyx_t_4[1] = __pyx_t_5; + __pyx_t_4[2] = __pyx_mstate_global->__pyx_kp_u__5; + __pyx_t_3 = __Pyx_PyUnicode_Join(__pyx_t_4, 3, 37 + __Pyx_PyUnicode_GET_LENGTH(__pyx_t_5) + 1, 127); + if (unlikely(!__pyx_t_3)) __PYX_ERR(1, 918, __pyx_L1_error) + __Pyx_GOTREF(__pyx_t_3); + __Pyx_DECREF(__pyx_t_5); __pyx_t_5 = 0; + __Pyx_Raise(((PyObject *)(((PyTypeObject*)PyExc_IndexError))), __pyx_t_3, 0, 0); + __Pyx_DECREF(__pyx_t_3); __pyx_t_3 = 0; + __PYX_ERR(1, 918, __pyx_L1_error) + + /* "View.MemoryView":917 + * raise IndexError, f"Out of bounds on buffer access (axis {dim})" + * + * if index >= shape: # <<<<<<<<<<<<<< + * raise IndexError, f"Out of bounds on buffer access (axis {dim})" + * +*/ + } + + /* "View.MemoryView":920 + * raise IndexError, f"Out of bounds on buffer access (axis {dim})" + * + * resultp = bufp + index * stride # <<<<<<<<<<<<<< + * if suboffset >= 0: + * resultp = ( resultp)[0] + suboffset +*/ + __pyx_v_resultp = (__pyx_v_bufp + (__pyx_v_index * __pyx_v_stride)); + + /* "View.MemoryView":921 + * + * resultp = bufp + index * stride + * if suboffset >= 0: # <<<<<<<<<<<<<< + * resultp = ( resultp)[0] + suboffset + * +*/ + __pyx_t_2 = (__pyx_v_suboffset >= 0); + if (__pyx_t_2) { + + /* "View.MemoryView":922 + * resultp = bufp + index * stride + * if suboffset >= 0: + * resultp = ( resultp)[0] + suboffset # <<<<<<<<<<<<<< + * + * return resultp +*/ + __pyx_v_resultp = ((((char **)__pyx_v_resultp)[0]) + __pyx_v_suboffset); + + /* "View.MemoryView":921 + * + * resultp = bufp + index * stride + * if suboffset >= 0: # <<<<<<<<<<<<<< + * resultp = ( resultp)[0] + suboffset + * +*/ + } + + /* "View.MemoryView":924 + * resultp = ( resultp)[0] + suboffset + * + * return resultp # <<<<<<<<<<<<<< + * + * +*/ + __pyx_r = __pyx_v_resultp; + goto __pyx_L0; + + /* "View.MemoryView":896 + * + * + * @cname('__pyx_pybuffer_index') # <<<<<<<<<<<<<< + * cdef char *pybuffer_index(Py_buffer *view, char *bufp, Py_ssize_t index, + * Py_ssize_t dim) except NULL: +*/ + + /* function exit code */ + __pyx_L1_error:; + __Pyx_XDECREF(__pyx_t_3); + __Pyx_XDECREF(__pyx_t_5); + __Pyx_AddTraceback("View.MemoryView.pybuffer_index", __pyx_clineno, __pyx_lineno, __pyx_filename); + __pyx_r = NULL; + __pyx_L0:; + __Pyx_RefNannyFinishContext(); + return __pyx_r; +} + +/* "View.MemoryView":929 + * + * + * @cname('__pyx_memslice_transpose') # <<<<<<<<<<<<<< + * cdef int transpose_memslice(__Pyx_memviewslice *memslice) except -1 nogil: + * cdef int ndim = memslice.memview.view.ndim +*/ + +static int __pyx_memslice_transpose(__Pyx_memviewslice *__pyx_v_memslice) { + int __pyx_v_ndim; + Py_ssize_t *__pyx_v_shape; + Py_ssize_t *__pyx_v_strides; + int __pyx_v_i; + int __pyx_v_j; + int __pyx_r; + int __pyx_t_1; + Py_ssize_t *__pyx_t_2; + long __pyx_t_3; + long __pyx_t_4; + Py_ssize_t __pyx_t_5; + Py_ssize_t __pyx_t_6; + int __pyx_t_7; + int __pyx_t_8; + int __pyx_t_9; + int __pyx_lineno = 0; + const char *__pyx_filename = NULL; + int __pyx_clineno = 0; + PyGILState_STATE __pyx_gilstate_save; + + /* "View.MemoryView":931 + * @cname('__pyx_memslice_transpose') + * cdef int transpose_memslice(__Pyx_memviewslice *memslice) except -1 nogil: + * cdef int ndim = memslice.memview.view.ndim # <<<<<<<<<<<<<< + * + * cdef Py_ssize_t *shape = memslice.shape +*/ + __pyx_t_1 = __pyx_v_memslice->memview->view.ndim; + __pyx_v_ndim = __pyx_t_1; + + /* "View.MemoryView":933 + * cdef int ndim = memslice.memview.view.ndim + * + * cdef Py_ssize_t *shape = memslice.shape # <<<<<<<<<<<<<< + * cdef Py_ssize_t *strides = memslice.strides + * +*/ + __pyx_t_2 = __pyx_v_memslice->shape; + __pyx_v_shape = __pyx_t_2; + + /* "View.MemoryView":934 + * + * cdef Py_ssize_t *shape = memslice.shape + * cdef Py_ssize_t *strides = memslice.strides # <<<<<<<<<<<<<< + * + * +*/ + __pyx_t_2 = __pyx_v_memslice->strides; + __pyx_v_strides = __pyx_t_2; + + /* "View.MemoryView":938 + * + * cdef int i, j + * for i in range(ndim // 2): # <<<<<<<<<<<<<< + * j = ndim - 1 - i + * strides[i], strides[j] = strides[j], strides[i] +*/ + __pyx_t_3 = __Pyx_div_long(__pyx_v_ndim, 2, 1); + __pyx_t_4 = __pyx_t_3; + for (__pyx_t_1 = 0; __pyx_t_1 < __pyx_t_4; __pyx_t_1+=1) { + __pyx_v_i = __pyx_t_1; + + /* "View.MemoryView":939 + * cdef int i, j + * for i in range(ndim // 2): + * j = ndim - 1 - i # <<<<<<<<<<<<<< + * strides[i], strides[j] = strides[j], strides[i] + * shape[i], shape[j] = shape[j], shape[i] +*/ + __pyx_v_j = ((__pyx_v_ndim - 1) - __pyx_v_i); + + /* "View.MemoryView":940 + * for i in range(ndim // 2): + * j = ndim - 1 - i + * strides[i], strides[j] = strides[j], strides[i] # <<<<<<<<<<<<<< + * shape[i], shape[j] = shape[j], shape[i] + * +*/ + __pyx_t_5 = (__pyx_v_strides[__pyx_v_j]); + __pyx_t_6 = (__pyx_v_strides[__pyx_v_i]); + (__pyx_v_strides[__pyx_v_i]) = __pyx_t_5; + (__pyx_v_strides[__pyx_v_j]) = __pyx_t_6; + + /* "View.MemoryView":941 + * j = ndim - 1 - i + * strides[i], strides[j] = strides[j], strides[i] + * shape[i], shape[j] = shape[j], shape[i] # <<<<<<<<<<<<<< + * + * if memslice.suboffsets[i] >= 0 or memslice.suboffsets[j] >= 0: +*/ + __pyx_t_6 = (__pyx_v_shape[__pyx_v_j]); + __pyx_t_5 = (__pyx_v_shape[__pyx_v_i]); + (__pyx_v_shape[__pyx_v_i]) = __pyx_t_6; + (__pyx_v_shape[__pyx_v_j]) = __pyx_t_5; + + /* "View.MemoryView":943 + * shape[i], shape[j] = shape[j], shape[i] + * + * if memslice.suboffsets[i] >= 0 or memslice.suboffsets[j] >= 0: # <<<<<<<<<<<<<< + * _err(PyExc_ValueError, "Cannot transpose memoryview with indirect dimensions") + * +*/ + __pyx_t_8 = ((__pyx_v_memslice->suboffsets[__pyx_v_i]) >= 0); + if (!__pyx_t_8) { + } else { + __pyx_t_7 = __pyx_t_8; + goto __pyx_L6_bool_binop_done; + } + __pyx_t_8 = ((__pyx_v_memslice->suboffsets[__pyx_v_j]) >= 0); + __pyx_t_7 = __pyx_t_8; + __pyx_L6_bool_binop_done:; + if (__pyx_t_7) { + + /* "View.MemoryView":944 + * + * if memslice.suboffsets[i] >= 0 or memslice.suboffsets[j] >= 0: + * _err(PyExc_ValueError, "Cannot transpose memoryview with indirect dimensions") # <<<<<<<<<<<<<< + * + * return 0 +*/ + __pyx_t_9 = __pyx_memoryview_err(PyExc_ValueError, __pyx_mstate_global->__pyx_kp_u_Cannot_transpose_memoryview_with); if (unlikely(__pyx_t_9 == ((int)-1))) __PYX_ERR(1, 944, __pyx_L1_error) + + /* "View.MemoryView":943 + * shape[i], shape[j] = shape[j], shape[i] + * + * if memslice.suboffsets[i] >= 0 or memslice.suboffsets[j] >= 0: # <<<<<<<<<<<<<< + * _err(PyExc_ValueError, "Cannot transpose memoryview with indirect dimensions") + * +*/ + } + } + + /* "View.MemoryView":946 + * _err(PyExc_ValueError, "Cannot transpose memoryview with indirect dimensions") + * + * return 0 # <<<<<<<<<<<<<< + * + * +*/ + __pyx_r = 0; + goto __pyx_L0; + + /* "View.MemoryView":929 + * + * + * @cname('__pyx_memslice_transpose') # <<<<<<<<<<<<<< + * cdef int transpose_memslice(__Pyx_memviewslice *memslice) except -1 nogil: + * cdef int ndim = memslice.memview.view.ndim +*/ + + /* function exit code */ + __pyx_L1_error:; + __pyx_gilstate_save = __Pyx_PyGILState_Ensure(); + __Pyx_AddTraceback("View.MemoryView.transpose_memslice", __pyx_clineno, __pyx_lineno, __pyx_filename); + __pyx_r = -1; + __Pyx_PyGILState_Release(__pyx_gilstate_save); + __pyx_L0:; + return __pyx_r; +} + +/* "View.MemoryView":964 + * cdef int (*to_dtype_func)(char *, object) except 0 + * + * def __dealloc__(self): # <<<<<<<<<<<<<< + * __PYX_XCLEAR_MEMVIEW(&self.from_slice, 1) + * +*/ + +/* Python wrapper */ +static void __pyx_memoryviewslice___dealloc__(PyObject *__pyx_v_self); /*proto*/ +static void __pyx_memoryviewslice___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_memoryviewslice___pyx_pf_15View_dot_MemoryView_16_memoryviewslice___dealloc__(((struct __pyx_memoryviewslice_obj *)__pyx_v_self)); + + /* function exit code */ + __Pyx_RefNannyFinishContext(); +} + +static void __pyx_memoryviewslice___pyx_pf_15View_dot_MemoryView_16_memoryviewslice___dealloc__(struct __pyx_memoryviewslice_obj *__pyx_v_self) { + + /* "View.MemoryView":965 + * + * def __dealloc__(self): + * __PYX_XCLEAR_MEMVIEW(&self.from_slice, 1) # <<<<<<<<<<<<<< + * + * cdef convert_item_to_object(self, char *itemp): +*/ + __PYX_XCLEAR_MEMVIEW((&__pyx_v_self->from_slice), 1); + + /* "View.MemoryView":964 + * cdef int (*to_dtype_func)(char *, object) except 0 + * + * def __dealloc__(self): # <<<<<<<<<<<<<< + * __PYX_XCLEAR_MEMVIEW(&self.from_slice, 1) + * +*/ + + /* function exit code */ +} + +/* "View.MemoryView":967 + * __PYX_XCLEAR_MEMVIEW(&self.from_slice, 1) + * + * cdef convert_item_to_object(self, char *itemp): # <<<<<<<<<<<<<< + * if self.to_object_func != NULL: + * return self.to_object_func(itemp) +*/ + +static PyObject *__pyx_memoryviewslice_convert_item_to_object(struct __pyx_memoryviewslice_obj *__pyx_v_self, char *__pyx_v_itemp) { + 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("convert_item_to_object", 0); + + /* "View.MemoryView":968 + * + * cdef convert_item_to_object(self, char *itemp): + * if self.to_object_func != NULL: # <<<<<<<<<<<<<< + * return self.to_object_func(itemp) + * else: +*/ + __pyx_t_1 = (__pyx_v_self->to_object_func != NULL); + if (__pyx_t_1) { + + /* "View.MemoryView":969 + * cdef convert_item_to_object(self, char *itemp): + * if self.to_object_func != NULL: + * return self.to_object_func(itemp) # <<<<<<<<<<<<<< + * else: + * return memoryview.convert_item_to_object(self, itemp) +*/ + __Pyx_XDECREF(__pyx_r); + __pyx_t_2 = __pyx_v_self->to_object_func(__pyx_v_itemp); if (unlikely(!__pyx_t_2)) __PYX_ERR(1, 969, __pyx_L1_error) + __Pyx_GOTREF(__pyx_t_2); + __pyx_r = __pyx_t_2; + __pyx_t_2 = 0; + goto __pyx_L0; + + /* "View.MemoryView":968 + * + * cdef convert_item_to_object(self, char *itemp): + * if self.to_object_func != NULL: # <<<<<<<<<<<<<< + * return self.to_object_func(itemp) + * else: +*/ + } + + /* "View.MemoryView":971 + * return self.to_object_func(itemp) + * else: + * return memoryview.convert_item_to_object(self, itemp) # <<<<<<<<<<<<<< + * + * cdef assign_item_from_object(self, char *itemp, object value): +*/ + /*else*/ { + __Pyx_XDECREF(__pyx_r); + __pyx_t_2 = __pyx_memoryview_convert_item_to_object(((struct __pyx_memoryview_obj *)__pyx_v_self), __pyx_v_itemp); if (unlikely(!__pyx_t_2)) __PYX_ERR(1, 971, __pyx_L1_error) + __Pyx_GOTREF(__pyx_t_2); + __pyx_r = __pyx_t_2; + __pyx_t_2 = 0; + goto __pyx_L0; + } + + /* "View.MemoryView":967 + * __PYX_XCLEAR_MEMVIEW(&self.from_slice, 1) + * + * cdef convert_item_to_object(self, char *itemp): # <<<<<<<<<<<<<< + * if self.to_object_func != NULL: + * return self.to_object_func(itemp) +*/ + + /* function exit code */ + __pyx_L1_error:; + __Pyx_XDECREF(__pyx_t_2); + __Pyx_AddTraceback("View.MemoryView._memoryviewslice.convert_item_to_object", __pyx_clineno, __pyx_lineno, __pyx_filename); + __pyx_r = 0; + __pyx_L0:; + __Pyx_XGIVEREF(__pyx_r); + __Pyx_RefNannyFinishContext(); + return __pyx_r; +} + +/* "View.MemoryView":973 + * return memoryview.convert_item_to_object(self, itemp) + * + * cdef assign_item_from_object(self, char *itemp, object value): # <<<<<<<<<<<<<< + * if self.to_dtype_func != NULL: + * self.to_dtype_func(itemp, value) +*/ + +static PyObject *__pyx_memoryviewslice_assign_item_from_object(struct __pyx_memoryviewslice_obj *__pyx_v_self, char *__pyx_v_itemp, PyObject *__pyx_v_value) { + PyObject *__pyx_r = NULL; + __Pyx_RefNannyDeclarations + int __pyx_t_1; + int __pyx_t_2; + PyObject *__pyx_t_3 = NULL; + int __pyx_lineno = 0; + const char *__pyx_filename = NULL; + int __pyx_clineno = 0; + __Pyx_RefNannySetupContext("assign_item_from_object", 0); + + /* "View.MemoryView":974 + * + * cdef assign_item_from_object(self, char *itemp, object value): + * if self.to_dtype_func != NULL: # <<<<<<<<<<<<<< + * self.to_dtype_func(itemp, value) + * else: +*/ + __pyx_t_1 = (__pyx_v_self->to_dtype_func != NULL); + if (__pyx_t_1) { + + /* "View.MemoryView":975 + * cdef assign_item_from_object(self, char *itemp, object value): + * if self.to_dtype_func != NULL: + * self.to_dtype_func(itemp, value) # <<<<<<<<<<<<<< + * else: + * memoryview.assign_item_from_object(self, itemp, value) +*/ + __pyx_t_2 = __pyx_v_self->to_dtype_func(__pyx_v_itemp, __pyx_v_value); if (unlikely(__pyx_t_2 == ((int)0))) __PYX_ERR(1, 975, __pyx_L1_error) + + /* "View.MemoryView":974 + * + * cdef assign_item_from_object(self, char *itemp, object value): + * if self.to_dtype_func != NULL: # <<<<<<<<<<<<<< + * self.to_dtype_func(itemp, value) + * else: +*/ + goto __pyx_L3; + } + + /* "View.MemoryView":977 + * self.to_dtype_func(itemp, value) + * else: + * memoryview.assign_item_from_object(self, itemp, value) # <<<<<<<<<<<<<< + * + * cdef _get_base(self): +*/ + /*else*/ { + __pyx_t_3 = __pyx_memoryview_assign_item_from_object(((struct __pyx_memoryview_obj *)__pyx_v_self), __pyx_v_itemp, __pyx_v_value); if (unlikely(!__pyx_t_3)) __PYX_ERR(1, 977, __pyx_L1_error) + __Pyx_GOTREF(__pyx_t_3); + __Pyx_DECREF(__pyx_t_3); __pyx_t_3 = 0; + } + __pyx_L3:; + + /* "View.MemoryView":973 + * return memoryview.convert_item_to_object(self, itemp) + * + * cdef assign_item_from_object(self, char *itemp, object value): # <<<<<<<<<<<<<< + * if self.to_dtype_func != NULL: + * self.to_dtype_func(itemp, value) +*/ + + /* function exit code */ + __pyx_r = Py_None; __Pyx_INCREF(Py_None); + goto __pyx_L0; + __pyx_L1_error:; + __Pyx_XDECREF(__pyx_t_3); + __Pyx_AddTraceback("View.MemoryView._memoryviewslice.assign_item_from_object", __pyx_clineno, __pyx_lineno, __pyx_filename); + __pyx_r = 0; + __pyx_L0:; + __Pyx_XGIVEREF(__pyx_r); + __Pyx_RefNannyFinishContext(); + return __pyx_r; +} + +/* "View.MemoryView":979 + * memoryview.assign_item_from_object(self, itemp, value) + * + * cdef _get_base(self): # <<<<<<<<<<<<<< + * return self.from_object + * +*/ + +static PyObject *__pyx_memoryviewslice__get_base(struct __pyx_memoryviewslice_obj *__pyx_v_self) { + PyObject *__pyx_r = NULL; + __Pyx_RefNannyDeclarations + __Pyx_RefNannySetupContext("_get_base", 0); + + /* "View.MemoryView":980 + * + * cdef _get_base(self): + * return self.from_object # <<<<<<<<<<<<<< + * + * +*/ + __Pyx_XDECREF(__pyx_r); + __Pyx_INCREF(__pyx_v_self->from_object); + __pyx_r = __pyx_v_self->from_object; + goto __pyx_L0; + + /* "View.MemoryView":979 + * memoryview.assign_item_from_object(self, itemp, value) + * + * cdef _get_base(self): # <<<<<<<<<<<<<< + * return self.from_object + * +*/ + + /* function exit code */ + __pyx_L0:; + __Pyx_XGIVEREF(__pyx_r); + __Pyx_RefNannyFinishContext(); + return __pyx_r; +} + +/* "(tree fragment)":1 + * def __reduce_cython__(self): # <<<<<<<<<<<<<< + * raise TypeError, "no default __reduce__ due to non-trivial __cinit__" + * def __setstate_cython__(self, __pyx_state): +*/ + +/* Python wrapper */ +static PyObject *__pyx_pw___pyx_memoryviewslice_1__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*/ +static PyObject *__pyx_pw___pyx_memoryviewslice_1__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___pyx_memoryviewslice___reduce_cython__(((struct __pyx_memoryviewslice_obj *)__pyx_v_self)); + + /* function exit code */ + __Pyx_RefNannyFinishContext(); + return __pyx_r; +} + +static PyObject *__pyx_pf___pyx_memoryviewslice___reduce_cython__(CYTHON_UNUSED struct __pyx_memoryviewslice_obj *__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("View.MemoryView._memoryviewslice.__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___pyx_memoryviewslice_3__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*/ +static PyObject *__pyx_pw___pyx_memoryviewslice_3__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("View.MemoryView._memoryviewslice.__setstate_cython__", __pyx_clineno, __pyx_lineno, __pyx_filename); + __Pyx_RefNannyFinishContext(); + return NULL; + __pyx_L4_argument_unpacking_done:; + __pyx_r = __pyx_pf___pyx_memoryviewslice_2__setstate_cython__(((struct __pyx_memoryviewslice_obj *)__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___pyx_memoryviewslice_2__setstate_cython__(CYTHON_UNUSED struct __pyx_memoryviewslice_obj *__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("View.MemoryView._memoryviewslice.__setstate_cython__", __pyx_clineno, __pyx_lineno, __pyx_filename); + __pyx_r = NULL; + __Pyx_XGIVEREF(__pyx_r); + __Pyx_RefNannyFinishContext(); + return __pyx_r; +} + +/* "View.MemoryView":999 + * pass # ignore failure, it's a minor issue + * + * @cname('__pyx_memoryview_fromslice') # <<<<<<<<<<<<<< + * cdef memoryview_fromslice(__Pyx_memviewslice memviewslice, + * int ndim, +*/ + +static PyObject *__pyx_memoryview_fromslice(__Pyx_memviewslice __pyx_v_memviewslice, int __pyx_v_ndim, PyObject *(*__pyx_v_to_object_func)(char *), int (*__pyx_v_to_dtype_func)(char *, PyObject *), int __pyx_v_dtype_is_object) { + struct __pyx_memoryviewslice_obj *__pyx_v_result = 0; + Py_ssize_t __pyx_v_suboffset; + PyObject *__pyx_v_length = NULL; + PyObject *__pyx_r = NULL; + __Pyx_RefNannyDeclarations + int __pyx_t_1; + PyObject *__pyx_t_2 = NULL; + PyObject *__pyx_t_3 = NULL; + __Pyx_TypeInfo const *__pyx_t_4; + Py_buffer __pyx_t_5; + Py_ssize_t *__pyx_t_6; + Py_ssize_t *__pyx_t_7; + Py_ssize_t *__pyx_t_8; + Py_ssize_t __pyx_t_9; + int __pyx_lineno = 0; + const char *__pyx_filename = NULL; + int __pyx_clineno = 0; + __Pyx_RefNannySetupContext("memoryview_fromslice", 0); + + /* "View.MemoryView":1008 + * cdef _memoryviewslice result + * + * if memviewslice.memview == Py_None: # <<<<<<<<<<<<<< + * return None + * +*/ + __pyx_t_1 = (((PyObject *)__pyx_v_memviewslice.memview) == Py_None); + if (__pyx_t_1) { + + /* "View.MemoryView":1009 + * + * if memviewslice.memview == Py_None: + * return None # <<<<<<<<<<<<<< + * + * +*/ + __Pyx_XDECREF(__pyx_r); + __pyx_r = Py_None; __Pyx_INCREF(Py_None); + goto __pyx_L0; + + /* "View.MemoryView":1008 + * cdef _memoryviewslice result + * + * if memviewslice.memview == Py_None: # <<<<<<<<<<<<<< + * return None + * +*/ + } + + /* "View.MemoryView":1014 + * + * + * result = _memoryviewslice.__new__(_memoryviewslice, None, 0, dtype_is_object) # <<<<<<<<<<<<<< + * + * result.from_slice = memviewslice +*/ + __pyx_t_2 = __Pyx_PyBool_FromLong(__pyx_v_dtype_is_object); if (unlikely(!__pyx_t_2)) __PYX_ERR(1, 1014, __pyx_L1_error) + __Pyx_GOTREF(__pyx_t_2); + __pyx_t_3 = PyTuple_New(3); if (unlikely(!__pyx_t_3)) __PYX_ERR(1, 1014, __pyx_L1_error) + __Pyx_GOTREF(__pyx_t_3); + __Pyx_INCREF(Py_None); + __Pyx_GIVEREF(Py_None); + if (__Pyx_PyTuple_SET_ITEM(__pyx_t_3, 0, Py_None) != (0)) __PYX_ERR(1, 1014, __pyx_L1_error); + __Pyx_INCREF(__pyx_mstate_global->__pyx_int_0); + __Pyx_GIVEREF(__pyx_mstate_global->__pyx_int_0); + if (__Pyx_PyTuple_SET_ITEM(__pyx_t_3, 1, __pyx_mstate_global->__pyx_int_0) != (0)) __PYX_ERR(1, 1014, __pyx_L1_error); + __Pyx_GIVEREF(__pyx_t_2); + if (__Pyx_PyTuple_SET_ITEM(__pyx_t_3, 2, __pyx_t_2) != (0)) __PYX_ERR(1, 1014, __pyx_L1_error); + __pyx_t_2 = 0; + __pyx_t_2 = ((PyObject *)__pyx_tp_new__memoryviewslice(((PyTypeObject *)__pyx_mstate_global->__pyx_memoryviewslice_type), __pyx_t_3, NULL)); if (unlikely(!__pyx_t_2)) __PYX_ERR(1, 1014, __pyx_L1_error) + __Pyx_GOTREF((PyObject *)__pyx_t_2); + __Pyx_DECREF(__pyx_t_3); __pyx_t_3 = 0; + __pyx_v_result = ((struct __pyx_memoryviewslice_obj *)__pyx_t_2); + __pyx_t_2 = 0; + + /* "View.MemoryView":1016 + * result = _memoryviewslice.__new__(_memoryviewslice, None, 0, dtype_is_object) + * + * result.from_slice = memviewslice # <<<<<<<<<<<<<< + * __PYX_INC_MEMVIEW(&memviewslice, 1) + * +*/ + __pyx_v_result->from_slice = __pyx_v_memviewslice; + + /* "View.MemoryView":1017 + * + * result.from_slice = memviewslice + * __PYX_INC_MEMVIEW(&memviewslice, 1) # <<<<<<<<<<<<<< + * + * result.from_object = ( memviewslice.memview)._get_base() +*/ + __PYX_INC_MEMVIEW((&__pyx_v_memviewslice), 1); + + /* "View.MemoryView":1019 + * __PYX_INC_MEMVIEW(&memviewslice, 1) + * + * result.from_object = ( memviewslice.memview)._get_base() # <<<<<<<<<<<<<< + * result.typeinfo = memviewslice.memview.typeinfo + * +*/ + __pyx_t_2 = ((struct __pyx_vtabstruct_memoryview *)((struct __pyx_memoryview_obj *)__pyx_v_memviewslice.memview)->__pyx_vtab)->_get_base(((struct __pyx_memoryview_obj *)__pyx_v_memviewslice.memview)); if (unlikely(!__pyx_t_2)) __PYX_ERR(1, 1019, __pyx_L1_error) + __Pyx_GOTREF(__pyx_t_2); + __Pyx_GIVEREF(__pyx_t_2); + __Pyx_GOTREF(__pyx_v_result->from_object); + __Pyx_DECREF(__pyx_v_result->from_object); + __pyx_v_result->from_object = __pyx_t_2; + __pyx_t_2 = 0; + + /* "View.MemoryView":1020 + * + * result.from_object = ( memviewslice.memview)._get_base() + * result.typeinfo = memviewslice.memview.typeinfo # <<<<<<<<<<<<<< + * + * result.view = memviewslice.memview.view +*/ + __pyx_t_4 = __pyx_v_memviewslice.memview->typeinfo; + __pyx_v_result->__pyx_base.typeinfo = __pyx_t_4; + + /* "View.MemoryView":1022 + * result.typeinfo = memviewslice.memview.typeinfo + * + * result.view = memviewslice.memview.view # <<<<<<<<<<<<<< + * result.view.buf = memviewslice.data + * result.view.ndim = ndim +*/ + __pyx_t_5 = __pyx_v_memviewslice.memview->view; + __pyx_v_result->__pyx_base.view = __pyx_t_5; + + /* "View.MemoryView":1023 + * + * result.view = memviewslice.memview.view + * result.view.buf = memviewslice.data # <<<<<<<<<<<<<< + * result.view.ndim = ndim + * (<__pyx_buffer *> &result.view).obj = Py_None +*/ + __pyx_v_result->__pyx_base.view.buf = ((void *)__pyx_v_memviewslice.data); + + /* "View.MemoryView":1024 + * result.view = memviewslice.memview.view + * result.view.buf = memviewslice.data + * result.view.ndim = ndim # <<<<<<<<<<<<<< + * (<__pyx_buffer *> &result.view).obj = Py_None + * Py_INCREF(Py_None) +*/ + __pyx_v_result->__pyx_base.view.ndim = __pyx_v_ndim; + + /* "View.MemoryView":1025 + * result.view.buf = memviewslice.data + * result.view.ndim = ndim + * (<__pyx_buffer *> &result.view).obj = Py_None # <<<<<<<<<<<<<< + * Py_INCREF(Py_None) + * +*/ + ((Py_buffer *)(&__pyx_v_result->__pyx_base.view))->obj = Py_None; + + /* "View.MemoryView":1026 + * result.view.ndim = ndim + * (<__pyx_buffer *> &result.view).obj = Py_None + * Py_INCREF(Py_None) # <<<<<<<<<<<<<< + * + * if (memviewslice.memview).flags & PyBUF_WRITABLE: +*/ + Py_INCREF(Py_None); + + /* "View.MemoryView":1028 + * Py_INCREF(Py_None) + * + * if (memviewslice.memview).flags & PyBUF_WRITABLE: # <<<<<<<<<<<<<< + * result.flags = PyBUF_RECORDS + * else: +*/ + __pyx_t_1 = ((((struct __pyx_memoryview_obj *)__pyx_v_memviewslice.memview)->flags & PyBUF_WRITABLE) != 0); + if (__pyx_t_1) { + + /* "View.MemoryView":1029 + * + * if (memviewslice.memview).flags & PyBUF_WRITABLE: + * result.flags = PyBUF_RECORDS # <<<<<<<<<<<<<< + * else: + * result.flags = PyBUF_RECORDS_RO +*/ + __pyx_v_result->__pyx_base.flags = PyBUF_RECORDS; + + /* "View.MemoryView":1028 + * Py_INCREF(Py_None) + * + * if (memviewslice.memview).flags & PyBUF_WRITABLE: # <<<<<<<<<<<<<< + * result.flags = PyBUF_RECORDS + * else: +*/ + goto __pyx_L4; + } + + /* "View.MemoryView":1031 + * result.flags = PyBUF_RECORDS + * else: + * result.flags = PyBUF_RECORDS_RO # <<<<<<<<<<<<<< + * + * result.view.shape = result.from_slice.shape +*/ + /*else*/ { + __pyx_v_result->__pyx_base.flags = PyBUF_RECORDS_RO; + } + __pyx_L4:; + + /* "View.MemoryView":1033 + * result.flags = PyBUF_RECORDS_RO + * + * result.view.shape = result.from_slice.shape # <<<<<<<<<<<<<< + * result.view.strides = result.from_slice.strides + * +*/ + __pyx_v_result->__pyx_base.view.shape = ((Py_ssize_t *)__pyx_v_result->from_slice.shape); + + /* "View.MemoryView":1034 + * + * result.view.shape = result.from_slice.shape + * result.view.strides = result.from_slice.strides # <<<<<<<<<<<<<< + * + * +*/ + __pyx_v_result->__pyx_base.view.strides = ((Py_ssize_t *)__pyx_v_result->from_slice.strides); + + /* "View.MemoryView":1037 + * + * + * result.view.suboffsets = NULL # <<<<<<<<<<<<<< + * for suboffset in result.from_slice.suboffsets[:ndim]: + * if suboffset >= 0: +*/ + __pyx_v_result->__pyx_base.view.suboffsets = NULL; + + /* "View.MemoryView":1038 + * + * result.view.suboffsets = NULL + * for suboffset in result.from_slice.suboffsets[:ndim]: # <<<<<<<<<<<<<< + * if suboffset >= 0: + * result.view.suboffsets = result.from_slice.suboffsets +*/ + __pyx_t_7 = (__pyx_v_result->from_slice.suboffsets + __pyx_v_ndim); + for (__pyx_t_8 = __pyx_v_result->from_slice.suboffsets; __pyx_t_8 < __pyx_t_7; __pyx_t_8++) { + __pyx_t_6 = __pyx_t_8; + __pyx_v_suboffset = (__pyx_t_6[0]); + + /* "View.MemoryView":1039 + * result.view.suboffsets = NULL + * for suboffset in result.from_slice.suboffsets[:ndim]: + * if suboffset >= 0: # <<<<<<<<<<<<<< + * result.view.suboffsets = result.from_slice.suboffsets + * break +*/ + __pyx_t_1 = (__pyx_v_suboffset >= 0); + if (__pyx_t_1) { + + /* "View.MemoryView":1040 + * for suboffset in result.from_slice.suboffsets[:ndim]: + * if suboffset >= 0: + * result.view.suboffsets = result.from_slice.suboffsets # <<<<<<<<<<<<<< + * break + * +*/ + __pyx_v_result->__pyx_base.view.suboffsets = ((Py_ssize_t *)__pyx_v_result->from_slice.suboffsets); + + /* "View.MemoryView":1041 + * if suboffset >= 0: + * result.view.suboffsets = result.from_slice.suboffsets + * break # <<<<<<<<<<<<<< + * + * result.view.len = result.view.itemsize +*/ + goto __pyx_L6_break; + + /* "View.MemoryView":1039 + * result.view.suboffsets = NULL + * for suboffset in result.from_slice.suboffsets[:ndim]: + * if suboffset >= 0: # <<<<<<<<<<<<<< + * result.view.suboffsets = result.from_slice.suboffsets + * break +*/ + } + } + __pyx_L6_break:; + + /* "View.MemoryView":1043 + * break + * + * result.view.len = result.view.itemsize # <<<<<<<<<<<<<< + * for length in result.view.shape[:ndim]: + * result.view.len *= length +*/ + __pyx_t_9 = __pyx_v_result->__pyx_base.view.itemsize; + __pyx_v_result->__pyx_base.view.len = __pyx_t_9; + + /* "View.MemoryView":1044 + * + * result.view.len = result.view.itemsize + * for length in result.view.shape[:ndim]: # <<<<<<<<<<<<<< + * result.view.len *= length + * +*/ + __pyx_t_7 = (__pyx_v_result->__pyx_base.view.shape + __pyx_v_ndim); + for (__pyx_t_8 = __pyx_v_result->__pyx_base.view.shape; __pyx_t_8 < __pyx_t_7; __pyx_t_8++) { + __pyx_t_6 = __pyx_t_8; + __pyx_t_2 = PyLong_FromSsize_t((__pyx_t_6[0])); if (unlikely(!__pyx_t_2)) __PYX_ERR(1, 1044, __pyx_L1_error) + __Pyx_GOTREF(__pyx_t_2); + __Pyx_XDECREF_SET(__pyx_v_length, __pyx_t_2); + __pyx_t_2 = 0; + + /* "View.MemoryView":1045 + * result.view.len = result.view.itemsize + * for length in result.view.shape[:ndim]: + * result.view.len *= length # <<<<<<<<<<<<<< + * + * result.to_object_func = to_object_func +*/ + __pyx_t_2 = PyLong_FromSsize_t(__pyx_v_result->__pyx_base.view.len); if (unlikely(!__pyx_t_2)) __PYX_ERR(1, 1045, __pyx_L1_error) + __Pyx_GOTREF(__pyx_t_2); + __pyx_t_3 = PyNumber_InPlaceMultiply(__pyx_t_2, __pyx_v_length); if (unlikely(!__pyx_t_3)) __PYX_ERR(1, 1045, __pyx_L1_error) + __Pyx_GOTREF(__pyx_t_3); + __Pyx_DECREF(__pyx_t_2); __pyx_t_2 = 0; + __pyx_t_9 = __Pyx_PyIndex_AsSsize_t(__pyx_t_3); if (unlikely((__pyx_t_9 == (Py_ssize_t)-1) && PyErr_Occurred())) __PYX_ERR(1, 1045, __pyx_L1_error) + __Pyx_DECREF(__pyx_t_3); __pyx_t_3 = 0; + __pyx_v_result->__pyx_base.view.len = __pyx_t_9; + } + + /* "View.MemoryView":1047 + * result.view.len *= length + * + * result.to_object_func = to_object_func # <<<<<<<<<<<<<< + * result.to_dtype_func = to_dtype_func + * +*/ + __pyx_v_result->to_object_func = __pyx_v_to_object_func; + + /* "View.MemoryView":1048 + * + * result.to_object_func = to_object_func + * result.to_dtype_func = to_dtype_func # <<<<<<<<<<<<<< + * + * return result +*/ + __pyx_v_result->to_dtype_func = __pyx_v_to_dtype_func; + + /* "View.MemoryView":1050 + * result.to_dtype_func = to_dtype_func + * + * return result # <<<<<<<<<<<<<< + * + * @cname('__pyx_memoryview_get_slice_from_memoryview') +*/ + __Pyx_XDECREF(__pyx_r); + __Pyx_INCREF((PyObject *)__pyx_v_result); + __pyx_r = ((PyObject *)__pyx_v_result); + goto __pyx_L0; + + /* "View.MemoryView":999 + * pass # ignore failure, it's a minor issue + * + * @cname('__pyx_memoryview_fromslice') # <<<<<<<<<<<<<< + * cdef memoryview_fromslice(__Pyx_memviewslice memviewslice, + * int ndim, +*/ + + /* function exit code */ + __pyx_L1_error:; + __Pyx_XDECREF(__pyx_t_2); + __Pyx_XDECREF(__pyx_t_3); + __Pyx_AddTraceback("View.MemoryView.memoryview_fromslice", __pyx_clineno, __pyx_lineno, __pyx_filename); + __pyx_r = 0; + __pyx_L0:; + __Pyx_XDECREF((PyObject *)__pyx_v_result); + __Pyx_XDECREF(__pyx_v_length); + __Pyx_XGIVEREF(__pyx_r); + __Pyx_RefNannyFinishContext(); + return __pyx_r; +} + +/* "View.MemoryView":1052 + * return result + * + * @cname('__pyx_memoryview_get_slice_from_memoryview') # <<<<<<<<<<<<<< + * cdef __Pyx_memviewslice *get_slice_from_memview(memoryview memview, + * __Pyx_memviewslice *mslice) except NULL: +*/ + +static __Pyx_memviewslice *__pyx_memoryview_get_slice_from_memoryview(struct __pyx_memoryview_obj *__pyx_v_memview, __Pyx_memviewslice *__pyx_v_mslice) { + struct __pyx_memoryviewslice_obj *__pyx_v_obj = 0; + __Pyx_memviewslice *__pyx_r; + __Pyx_RefNannyDeclarations + int __pyx_t_1; + PyObject *__pyx_t_2 = NULL; + int __pyx_lineno = 0; + const char *__pyx_filename = NULL; + int __pyx_clineno = 0; + __Pyx_RefNannySetupContext("get_slice_from_memview", 0); + + /* "View.MemoryView":1056 + * __Pyx_memviewslice *mslice) except NULL: + * cdef _memoryviewslice obj + * if isinstance(memview, _memoryviewslice): # <<<<<<<<<<<<<< + * obj = memview + * return &obj.from_slice +*/ + __pyx_t_1 = __Pyx_TypeCheck(((PyObject *)__pyx_v_memview), __pyx_mstate_global->__pyx_memoryviewslice_type); + if (__pyx_t_1) { + + /* "View.MemoryView":1057 + * cdef _memoryviewslice obj + * if isinstance(memview, _memoryviewslice): + * obj = memview # <<<<<<<<<<<<<< + * return &obj.from_slice + * else: +*/ + __pyx_t_2 = ((PyObject *)__pyx_v_memview); + __Pyx_INCREF(__pyx_t_2); + if (!(likely(((__pyx_t_2) == Py_None) || likely(__Pyx_TypeTest(__pyx_t_2, __pyx_mstate_global->__pyx_memoryviewslice_type))))) __PYX_ERR(1, 1057, __pyx_L1_error) + __pyx_v_obj = ((struct __pyx_memoryviewslice_obj *)__pyx_t_2); + __pyx_t_2 = 0; + + /* "View.MemoryView":1058 + * if isinstance(memview, _memoryviewslice): + * obj = memview + * return &obj.from_slice # <<<<<<<<<<<<<< + * else: + * slice_copy(memview, mslice) +*/ + __pyx_r = (&__pyx_v_obj->from_slice); + goto __pyx_L0; + + /* "View.MemoryView":1056 + * __Pyx_memviewslice *mslice) except NULL: + * cdef _memoryviewslice obj + * if isinstance(memview, _memoryviewslice): # <<<<<<<<<<<<<< + * obj = memview + * return &obj.from_slice +*/ + } + + /* "View.MemoryView":1060 + * return &obj.from_slice + * else: + * slice_copy(memview, mslice) # <<<<<<<<<<<<<< + * return mslice + * +*/ + /*else*/ { + __pyx_memoryview_slice_copy(__pyx_v_memview, __pyx_v_mslice); + + /* "View.MemoryView":1061 + * else: + * slice_copy(memview, mslice) + * return mslice # <<<<<<<<<<<<<< + * + * @cname('__pyx_memoryview_slice_copy') +*/ + __pyx_r = __pyx_v_mslice; + goto __pyx_L0; + } + + /* "View.MemoryView":1052 + * return result + * + * @cname('__pyx_memoryview_get_slice_from_memoryview') # <<<<<<<<<<<<<< + * cdef __Pyx_memviewslice *get_slice_from_memview(memoryview memview, + * __Pyx_memviewslice *mslice) except NULL: +*/ + + /* function exit code */ + __pyx_L1_error:; + __Pyx_XDECREF(__pyx_t_2); + __Pyx_AddTraceback("View.MemoryView.get_slice_from_memview", __pyx_clineno, __pyx_lineno, __pyx_filename); + __pyx_r = NULL; + __pyx_L0:; + __Pyx_XDECREF((PyObject *)__pyx_v_obj); + __Pyx_RefNannyFinishContext(); + return __pyx_r; +} + +/* "View.MemoryView":1063 + * return mslice + * + * @cname('__pyx_memoryview_slice_copy') # <<<<<<<<<<<<<< + * cdef void slice_copy(memoryview memview, __Pyx_memviewslice *dst) noexcept: + * cdef int dim +*/ + +static void __pyx_memoryview_slice_copy(struct __pyx_memoryview_obj *__pyx_v_memview, __Pyx_memviewslice *__pyx_v_dst) { + int __pyx_v_dim; + Py_ssize_t *__pyx_v_shape; + Py_ssize_t *__pyx_v_strides; + Py_ssize_t *__pyx_v_suboffsets; + Py_ssize_t *__pyx_t_1; + int __pyx_t_2; + int __pyx_t_3; + int __pyx_t_4; + Py_ssize_t __pyx_t_5; + int __pyx_t_6; + + /* "View.MemoryView":1068 + * cdef (Py_ssize_t*) shape, strides, suboffsets + * + * shape = memview.view.shape # <<<<<<<<<<<<<< + * strides = memview.view.strides + * suboffsets = memview.view.suboffsets +*/ + __pyx_t_1 = __pyx_v_memview->view.shape; + __pyx_v_shape = __pyx_t_1; + + /* "View.MemoryView":1069 + * + * shape = memview.view.shape + * strides = memview.view.strides # <<<<<<<<<<<<<< + * suboffsets = memview.view.suboffsets + * +*/ + __pyx_t_1 = __pyx_v_memview->view.strides; + __pyx_v_strides = __pyx_t_1; + + /* "View.MemoryView":1070 + * shape = memview.view.shape + * strides = memview.view.strides + * suboffsets = memview.view.suboffsets # <<<<<<<<<<<<<< + * + * dst.memview = <__pyx_memoryview *> memview +*/ + __pyx_t_1 = __pyx_v_memview->view.suboffsets; + __pyx_v_suboffsets = __pyx_t_1; + + /* "View.MemoryView":1072 + * suboffsets = memview.view.suboffsets + * + * dst.memview = <__pyx_memoryview *> memview # <<<<<<<<<<<<<< + * dst.data = memview.view.buf + * +*/ + __pyx_v_dst->memview = ((struct __pyx_memoryview_obj *)__pyx_v_memview); + + /* "View.MemoryView":1073 + * + * dst.memview = <__pyx_memoryview *> memview + * dst.data = memview.view.buf # <<<<<<<<<<<<<< + * + * for dim in range(memview.view.ndim): +*/ + __pyx_v_dst->data = ((char *)__pyx_v_memview->view.buf); + + /* "View.MemoryView":1075 + * dst.data = memview.view.buf + * + * for dim in range(memview.view.ndim): # <<<<<<<<<<<<<< + * dst.shape[dim] = shape[dim] + * dst.strides[dim] = strides[dim] +*/ + __pyx_t_2 = __pyx_v_memview->view.ndim; + __pyx_t_3 = __pyx_t_2; + for (__pyx_t_4 = 0; __pyx_t_4 < __pyx_t_3; __pyx_t_4+=1) { + __pyx_v_dim = __pyx_t_4; + + /* "View.MemoryView":1076 + * + * for dim in range(memview.view.ndim): + * dst.shape[dim] = shape[dim] # <<<<<<<<<<<<<< + * dst.strides[dim] = strides[dim] + * dst.suboffsets[dim] = suboffsets[dim] if suboffsets else -1 +*/ + (__pyx_v_dst->shape[__pyx_v_dim]) = (__pyx_v_shape[__pyx_v_dim]); + + /* "View.MemoryView":1077 + * for dim in range(memview.view.ndim): + * dst.shape[dim] = shape[dim] + * dst.strides[dim] = strides[dim] # <<<<<<<<<<<<<< + * dst.suboffsets[dim] = suboffsets[dim] if suboffsets else -1 + * +*/ + (__pyx_v_dst->strides[__pyx_v_dim]) = (__pyx_v_strides[__pyx_v_dim]); + + /* "View.MemoryView":1078 + * dst.shape[dim] = shape[dim] + * dst.strides[dim] = strides[dim] + * dst.suboffsets[dim] = suboffsets[dim] if suboffsets else -1 # <<<<<<<<<<<<<< + * + * @cname('__pyx_memoryview_copy_object') +*/ + __pyx_t_6 = (__pyx_v_suboffsets != 0); + if (__pyx_t_6) { + __pyx_t_5 = (__pyx_v_suboffsets[__pyx_v_dim]); + } else { + __pyx_t_5 = -1L; + } + (__pyx_v_dst->suboffsets[__pyx_v_dim]) = __pyx_t_5; + } + + /* "View.MemoryView":1063 + * return mslice + * + * @cname('__pyx_memoryview_slice_copy') # <<<<<<<<<<<<<< + * cdef void slice_copy(memoryview memview, __Pyx_memviewslice *dst) noexcept: + * cdef int dim +*/ + + /* function exit code */ +} + +/* "View.MemoryView":1080 + * dst.suboffsets[dim] = suboffsets[dim] if suboffsets else -1 + * + * @cname('__pyx_memoryview_copy_object') # <<<<<<<<<<<<<< + * cdef memoryview_copy(memoryview memview): + * "Create a new memoryview object" +*/ + +static PyObject *__pyx_memoryview_copy_object(struct __pyx_memoryview_obj *__pyx_v_memview) { + __Pyx_memviewslice __pyx_v_memviewslice; + 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("memoryview_copy", 0); + + /* "View.MemoryView":1084 + * "Create a new memoryview object" + * cdef __Pyx_memviewslice memviewslice + * slice_copy(memview, &memviewslice) # <<<<<<<<<<<<<< + * return memoryview_copy_from_slice(memview, &memviewslice) + * +*/ + __pyx_memoryview_slice_copy(__pyx_v_memview, (&__pyx_v_memviewslice)); + + /* "View.MemoryView":1085 + * cdef __Pyx_memviewslice memviewslice + * slice_copy(memview, &memviewslice) + * return memoryview_copy_from_slice(memview, &memviewslice) # <<<<<<<<<<<<<< + * + * @cname('__pyx_memoryview_copy_object_from_slice') +*/ + __Pyx_XDECREF(__pyx_r); + __pyx_t_1 = __pyx_memoryview_copy_object_from_slice(__pyx_v_memview, (&__pyx_v_memviewslice)); if (unlikely(!__pyx_t_1)) __PYX_ERR(1, 1085, __pyx_L1_error) + __Pyx_GOTREF(__pyx_t_1); + __pyx_r = __pyx_t_1; + __pyx_t_1 = 0; + goto __pyx_L0; + + /* "View.MemoryView":1080 + * dst.suboffsets[dim] = suboffsets[dim] if suboffsets else -1 + * + * @cname('__pyx_memoryview_copy_object') # <<<<<<<<<<<<<< + * cdef memoryview_copy(memoryview memview): + * "Create a new memoryview object" +*/ + + /* function exit code */ + __pyx_L1_error:; + __Pyx_XDECREF(__pyx_t_1); + __Pyx_AddTraceback("View.MemoryView.memoryview_copy", __pyx_clineno, __pyx_lineno, __pyx_filename); + __pyx_r = 0; + __pyx_L0:; + __Pyx_XGIVEREF(__pyx_r); + __Pyx_RefNannyFinishContext(); + return __pyx_r; +} + +/* "View.MemoryView":1087 + * return memoryview_copy_from_slice(memview, &memviewslice) + * + * @cname('__pyx_memoryview_copy_object_from_slice') # <<<<<<<<<<<<<< + * cdef memoryview_copy_from_slice(memoryview memview, __Pyx_memviewslice *memviewslice): + * """ +*/ + +static PyObject *__pyx_memoryview_copy_object_from_slice(struct __pyx_memoryview_obj *__pyx_v_memview, __Pyx_memviewslice *__pyx_v_memviewslice) { + PyObject *(*__pyx_v_to_object_func)(char *); + int (*__pyx_v_to_dtype_func)(char *, PyObject *); + PyObject *__pyx_r = NULL; + __Pyx_RefNannyDeclarations + int __pyx_t_1; + PyObject *(*__pyx_t_2)(char *); + int (*__pyx_t_3)(char *, PyObject *); + PyObject *__pyx_t_4 = NULL; + int __pyx_lineno = 0; + const char *__pyx_filename = NULL; + int __pyx_clineno = 0; + __Pyx_RefNannySetupContext("memoryview_copy_from_slice", 0); + + /* "View.MemoryView":1095 + * cdef int (*to_dtype_func)(char *, object) except 0 + * + * if isinstance(memview, _memoryviewslice): # <<<<<<<<<<<<<< + * to_object_func = (<_memoryviewslice> memview).to_object_func + * to_dtype_func = (<_memoryviewslice> memview).to_dtype_func +*/ + __pyx_t_1 = __Pyx_TypeCheck(((PyObject *)__pyx_v_memview), __pyx_mstate_global->__pyx_memoryviewslice_type); + if (__pyx_t_1) { + + /* "View.MemoryView":1096 + * + * if isinstance(memview, _memoryviewslice): + * to_object_func = (<_memoryviewslice> memview).to_object_func # <<<<<<<<<<<<<< + * to_dtype_func = (<_memoryviewslice> memview).to_dtype_func + * else: +*/ + __pyx_t_2 = ((struct __pyx_memoryviewslice_obj *)__pyx_v_memview)->to_object_func; + __pyx_v_to_object_func = __pyx_t_2; + + /* "View.MemoryView":1097 + * if isinstance(memview, _memoryviewslice): + * to_object_func = (<_memoryviewslice> memview).to_object_func + * to_dtype_func = (<_memoryviewslice> memview).to_dtype_func # <<<<<<<<<<<<<< + * else: + * to_object_func = NULL +*/ + __pyx_t_3 = ((struct __pyx_memoryviewslice_obj *)__pyx_v_memview)->to_dtype_func; + __pyx_v_to_dtype_func = __pyx_t_3; + + /* "View.MemoryView":1095 + * cdef int (*to_dtype_func)(char *, object) except 0 + * + * if isinstance(memview, _memoryviewslice): # <<<<<<<<<<<<<< + * to_object_func = (<_memoryviewslice> memview).to_object_func + * to_dtype_func = (<_memoryviewslice> memview).to_dtype_func +*/ + goto __pyx_L3; + } + + /* "View.MemoryView":1099 + * to_dtype_func = (<_memoryviewslice> memview).to_dtype_func + * else: + * to_object_func = NULL # <<<<<<<<<<<<<< + * to_dtype_func = NULL + * +*/ + /*else*/ { + __pyx_v_to_object_func = NULL; + + /* "View.MemoryView":1100 + * else: + * to_object_func = NULL + * to_dtype_func = NULL # <<<<<<<<<<<<<< + * + * return memoryview_fromslice(memviewslice[0], memview.view.ndim, +*/ + __pyx_v_to_dtype_func = NULL; + } + __pyx_L3:; + + /* "View.MemoryView":1102 + * to_dtype_func = NULL + * + * return memoryview_fromslice(memviewslice[0], memview.view.ndim, # <<<<<<<<<<<<<< + * to_object_func, to_dtype_func, + * memview.dtype_is_object) +*/ + __Pyx_XDECREF(__pyx_r); + + /* "View.MemoryView":1104 + * return memoryview_fromslice(memviewslice[0], memview.view.ndim, + * to_object_func, to_dtype_func, + * memview.dtype_is_object) # <<<<<<<<<<<<<< + * + * +*/ + __pyx_t_4 = __pyx_memoryview_fromslice((__pyx_v_memviewslice[0]), __pyx_v_memview->view.ndim, __pyx_v_to_object_func, __pyx_v_to_dtype_func, __pyx_v_memview->dtype_is_object); if (unlikely(!__pyx_t_4)) __PYX_ERR(1, 1102, __pyx_L1_error) + __Pyx_GOTREF(__pyx_t_4); + __pyx_r = __pyx_t_4; + __pyx_t_4 = 0; + goto __pyx_L0; + + /* "View.MemoryView":1087 + * return memoryview_copy_from_slice(memview, &memviewslice) + * + * @cname('__pyx_memoryview_copy_object_from_slice') # <<<<<<<<<<<<<< + * cdef memoryview_copy_from_slice(memoryview memview, __Pyx_memviewslice *memviewslice): + * """ +*/ + + /* function exit code */ + __pyx_L1_error:; + __Pyx_XDECREF(__pyx_t_4); + __Pyx_AddTraceback("View.MemoryView.memoryview_copy_from_slice", __pyx_clineno, __pyx_lineno, __pyx_filename); + __pyx_r = 0; + __pyx_L0:; + __Pyx_XGIVEREF(__pyx_r); + __Pyx_RefNannyFinishContext(); + return __pyx_r; +} + +/* "View.MemoryView":1110 + * + * + * cdef Py_ssize_t abs_py_ssize_t(Py_ssize_t arg) noexcept nogil: # <<<<<<<<<<<<<< + * return -arg if arg < 0 else arg + * +*/ + +static Py_ssize_t abs_py_ssize_t(Py_ssize_t __pyx_v_arg) { + Py_ssize_t __pyx_r; + Py_ssize_t __pyx_t_1; + int __pyx_t_2; + + /* "View.MemoryView":1111 + * + * cdef Py_ssize_t abs_py_ssize_t(Py_ssize_t arg) noexcept nogil: + * return -arg if arg < 0 else arg # <<<<<<<<<<<<<< + * + * @cname('__pyx_get_best_slice_order') +*/ + __pyx_t_2 = (__pyx_v_arg < 0); + if (__pyx_t_2) { + __pyx_t_1 = (-__pyx_v_arg); + } else { + __pyx_t_1 = __pyx_v_arg; + } + __pyx_r = __pyx_t_1; + goto __pyx_L0; + + /* "View.MemoryView":1110 + * + * + * cdef Py_ssize_t abs_py_ssize_t(Py_ssize_t arg) noexcept nogil: # <<<<<<<<<<<<<< + * return -arg if arg < 0 else arg + * +*/ + + /* function exit code */ + __pyx_L0:; + return __pyx_r; +} + +/* "View.MemoryView":1113 + * return -arg if arg < 0 else arg + * + * @cname('__pyx_get_best_slice_order') # <<<<<<<<<<<<<< + * cdef char get_best_order(__Pyx_memviewslice *mslice, int ndim) noexcept nogil: + * """ +*/ + +static char __pyx_get_best_slice_order(__Pyx_memviewslice *__pyx_v_mslice, int __pyx_v_ndim) { + int __pyx_v_i; + Py_ssize_t __pyx_v_c_stride; + Py_ssize_t __pyx_v_f_stride; + char __pyx_r; + int __pyx_t_1; + int __pyx_t_2; + int __pyx_t_3; + int __pyx_t_4; + + /* "View.MemoryView":1119 + * """ + * cdef int i + * cdef Py_ssize_t c_stride = 0 # <<<<<<<<<<<<<< + * cdef Py_ssize_t f_stride = 0 + * +*/ + __pyx_v_c_stride = 0; + + /* "View.MemoryView":1120 + * cdef int i + * cdef Py_ssize_t c_stride = 0 + * cdef Py_ssize_t f_stride = 0 # <<<<<<<<<<<<<< + * + * for i in range(ndim - 1, -1, -1): +*/ + __pyx_v_f_stride = 0; + + /* "View.MemoryView":1122 + * cdef Py_ssize_t f_stride = 0 + * + * for i in range(ndim - 1, -1, -1): # <<<<<<<<<<<<<< + * if mslice.shape[i] > 1: + * c_stride = mslice.strides[i] +*/ + for (__pyx_t_1 = (__pyx_v_ndim - 1); __pyx_t_1 > -1; __pyx_t_1-=1) { + __pyx_v_i = __pyx_t_1; + + /* "View.MemoryView":1123 + * + * for i in range(ndim - 1, -1, -1): + * if mslice.shape[i] > 1: # <<<<<<<<<<<<<< + * c_stride = mslice.strides[i] + * break +*/ + __pyx_t_2 = ((__pyx_v_mslice->shape[__pyx_v_i]) > 1); + if (__pyx_t_2) { + + /* "View.MemoryView":1124 + * for i in range(ndim - 1, -1, -1): + * if mslice.shape[i] > 1: + * c_stride = mslice.strides[i] # <<<<<<<<<<<<<< + * break + * +*/ + __pyx_v_c_stride = (__pyx_v_mslice->strides[__pyx_v_i]); + + /* "View.MemoryView":1125 + * if mslice.shape[i] > 1: + * c_stride = mslice.strides[i] + * break # <<<<<<<<<<<<<< + * + * for i in range(ndim): +*/ + goto __pyx_L4_break; + + /* "View.MemoryView":1123 + * + * for i in range(ndim - 1, -1, -1): + * if mslice.shape[i] > 1: # <<<<<<<<<<<<<< + * c_stride = mslice.strides[i] + * break +*/ + } + } + __pyx_L4_break:; + + /* "View.MemoryView":1127 + * break + * + * for i in range(ndim): # <<<<<<<<<<<<<< + * if mslice.shape[i] > 1: + * f_stride = mslice.strides[i] +*/ + __pyx_t_1 = __pyx_v_ndim; + __pyx_t_3 = __pyx_t_1; + for (__pyx_t_4 = 0; __pyx_t_4 < __pyx_t_3; __pyx_t_4+=1) { + __pyx_v_i = __pyx_t_4; + + /* "View.MemoryView":1128 + * + * for i in range(ndim): + * if mslice.shape[i] > 1: # <<<<<<<<<<<<<< + * f_stride = mslice.strides[i] + * break +*/ + __pyx_t_2 = ((__pyx_v_mslice->shape[__pyx_v_i]) > 1); + if (__pyx_t_2) { + + /* "View.MemoryView":1129 + * for i in range(ndim): + * if mslice.shape[i] > 1: + * f_stride = mslice.strides[i] # <<<<<<<<<<<<<< + * break + * +*/ + __pyx_v_f_stride = (__pyx_v_mslice->strides[__pyx_v_i]); + + /* "View.MemoryView":1130 + * if mslice.shape[i] > 1: + * f_stride = mslice.strides[i] + * break # <<<<<<<<<<<<<< + * + * if abs_py_ssize_t(c_stride) <= abs_py_ssize_t(f_stride): +*/ + goto __pyx_L7_break; + + /* "View.MemoryView":1128 + * + * for i in range(ndim): + * if mslice.shape[i] > 1: # <<<<<<<<<<<<<< + * f_stride = mslice.strides[i] + * break +*/ + } + } + __pyx_L7_break:; + + /* "View.MemoryView":1132 + * break + * + * if abs_py_ssize_t(c_stride) <= abs_py_ssize_t(f_stride): # <<<<<<<<<<<<<< + * return 'C' + * else: +*/ + __pyx_t_2 = (abs_py_ssize_t(__pyx_v_c_stride) <= abs_py_ssize_t(__pyx_v_f_stride)); + if (__pyx_t_2) { + + /* "View.MemoryView":1133 + * + * if abs_py_ssize_t(c_stride) <= abs_py_ssize_t(f_stride): + * return 'C' # <<<<<<<<<<<<<< + * else: + * return 'F' +*/ + __pyx_r = 'C'; + goto __pyx_L0; + + /* "View.MemoryView":1132 + * break + * + * if abs_py_ssize_t(c_stride) <= abs_py_ssize_t(f_stride): # <<<<<<<<<<<<<< + * return 'C' + * else: +*/ + } + + /* "View.MemoryView":1135 + * return 'C' + * else: + * return 'F' # <<<<<<<<<<<<<< + * + * @cython.cdivision(True) +*/ + /*else*/ { + __pyx_r = 'F'; + goto __pyx_L0; + } + + /* "View.MemoryView":1113 + * return -arg if arg < 0 else arg + * + * @cname('__pyx_get_best_slice_order') # <<<<<<<<<<<<<< + * cdef char get_best_order(__Pyx_memviewslice *mslice, int ndim) noexcept nogil: + * """ +*/ + + /* function exit code */ + __pyx_L0:; + return __pyx_r; +} + +/* "View.MemoryView":1137 + * return 'F' + * + * @cython.cdivision(True) # <<<<<<<<<<<<<< + * cdef void _copy_strided_to_strided(char *src_data, Py_ssize_t *src_strides, + * char *dst_data, Py_ssize_t *dst_strides, +*/ + +static void _copy_strided_to_strided(char *__pyx_v_src_data, Py_ssize_t *__pyx_v_src_strides, char *__pyx_v_dst_data, Py_ssize_t *__pyx_v_dst_strides, Py_ssize_t *__pyx_v_src_shape, Py_ssize_t *__pyx_v_dst_shape, int __pyx_v_ndim, size_t __pyx_v_itemsize) { + CYTHON_UNUSED Py_ssize_t __pyx_v_i; + CYTHON_UNUSED Py_ssize_t __pyx_v_src_extent; + Py_ssize_t __pyx_v_dst_extent; + Py_ssize_t __pyx_v_src_stride; + Py_ssize_t __pyx_v_dst_stride; + int __pyx_t_1; + int __pyx_t_2; + Py_ssize_t __pyx_t_3; + Py_ssize_t __pyx_t_4; + Py_ssize_t __pyx_t_5; + + /* "View.MemoryView":1145 + * + * cdef Py_ssize_t i + * cdef Py_ssize_t src_extent = src_shape[0] # <<<<<<<<<<<<<< + * cdef Py_ssize_t dst_extent = dst_shape[0] + * cdef Py_ssize_t src_stride = src_strides[0] +*/ + __pyx_v_src_extent = (__pyx_v_src_shape[0]); + + /* "View.MemoryView":1146 + * cdef Py_ssize_t i + * cdef Py_ssize_t src_extent = src_shape[0] + * cdef Py_ssize_t dst_extent = dst_shape[0] # <<<<<<<<<<<<<< + * cdef Py_ssize_t src_stride = src_strides[0] + * cdef Py_ssize_t dst_stride = dst_strides[0] +*/ + __pyx_v_dst_extent = (__pyx_v_dst_shape[0]); + + /* "View.MemoryView":1147 + * cdef Py_ssize_t src_extent = src_shape[0] + * cdef Py_ssize_t dst_extent = dst_shape[0] + * cdef Py_ssize_t src_stride = src_strides[0] # <<<<<<<<<<<<<< + * cdef Py_ssize_t dst_stride = dst_strides[0] + * +*/ + __pyx_v_src_stride = (__pyx_v_src_strides[0]); + + /* "View.MemoryView":1148 + * cdef Py_ssize_t dst_extent = dst_shape[0] + * cdef Py_ssize_t src_stride = src_strides[0] + * cdef Py_ssize_t dst_stride = dst_strides[0] # <<<<<<<<<<<<<< + * + * if ndim == 1: +*/ + __pyx_v_dst_stride = (__pyx_v_dst_strides[0]); + + /* "View.MemoryView":1150 + * cdef Py_ssize_t dst_stride = dst_strides[0] + * + * if ndim == 1: # <<<<<<<<<<<<<< + * if (src_stride > 0 and dst_stride > 0 and + * src_stride == itemsize == dst_stride): +*/ + __pyx_t_1 = (__pyx_v_ndim == 1); + if (__pyx_t_1) { + + /* "View.MemoryView":1151 + * + * if ndim == 1: + * if (src_stride > 0 and dst_stride > 0 and # <<<<<<<<<<<<<< + * src_stride == itemsize == dst_stride): + * memcpy(dst_data, src_data, itemsize * dst_extent) +*/ + __pyx_t_2 = (__pyx_v_src_stride > 0); + if (__pyx_t_2) { + } else { + __pyx_t_1 = __pyx_t_2; + goto __pyx_L5_bool_binop_done; + } + __pyx_t_2 = (__pyx_v_dst_stride > 0); + if (__pyx_t_2) { + } else { + __pyx_t_1 = __pyx_t_2; + goto __pyx_L5_bool_binop_done; + } + + /* "View.MemoryView":1152 + * if ndim == 1: + * if (src_stride > 0 and dst_stride > 0 and + * src_stride == itemsize == dst_stride): # <<<<<<<<<<<<<< + * memcpy(dst_data, src_data, itemsize * dst_extent) + * else: +*/ + __pyx_t_2 = (((size_t)__pyx_v_src_stride) == __pyx_v_itemsize); + if (__pyx_t_2) { + __pyx_t_2 = (__pyx_v_itemsize == ((size_t)__pyx_v_dst_stride)); + } + __pyx_t_1 = __pyx_t_2; + __pyx_L5_bool_binop_done:; + + /* "View.MemoryView":1151 + * + * if ndim == 1: + * if (src_stride > 0 and dst_stride > 0 and # <<<<<<<<<<<<<< + * src_stride == itemsize == dst_stride): + * memcpy(dst_data, src_data, itemsize * dst_extent) +*/ + if (__pyx_t_1) { + + /* "View.MemoryView":1153 + * if (src_stride > 0 and dst_stride > 0 and + * src_stride == itemsize == dst_stride): + * memcpy(dst_data, src_data, itemsize * dst_extent) # <<<<<<<<<<<<<< + * else: + * for i in range(dst_extent): +*/ + (void)(memcpy(__pyx_v_dst_data, __pyx_v_src_data, (__pyx_v_itemsize * __pyx_v_dst_extent))); + + /* "View.MemoryView":1151 + * + * if ndim == 1: + * if (src_stride > 0 and dst_stride > 0 and # <<<<<<<<<<<<<< + * src_stride == itemsize == dst_stride): + * memcpy(dst_data, src_data, itemsize * dst_extent) +*/ + goto __pyx_L4; + } + + /* "View.MemoryView":1155 + * memcpy(dst_data, src_data, itemsize * dst_extent) + * else: + * for i in range(dst_extent): # <<<<<<<<<<<<<< + * memcpy(dst_data, src_data, itemsize) + * src_data += src_stride +*/ + /*else*/ { + __pyx_t_3 = __pyx_v_dst_extent; + __pyx_t_4 = __pyx_t_3; + for (__pyx_t_5 = 0; __pyx_t_5 < __pyx_t_4; __pyx_t_5+=1) { + __pyx_v_i = __pyx_t_5; + + /* "View.MemoryView":1156 + * else: + * for i in range(dst_extent): + * memcpy(dst_data, src_data, itemsize) # <<<<<<<<<<<<<< + * src_data += src_stride + * dst_data += dst_stride +*/ + (void)(memcpy(__pyx_v_dst_data, __pyx_v_src_data, __pyx_v_itemsize)); + + /* "View.MemoryView":1157 + * for i in range(dst_extent): + * memcpy(dst_data, src_data, itemsize) + * src_data += src_stride # <<<<<<<<<<<<<< + * dst_data += dst_stride + * else: +*/ + __pyx_v_src_data = (__pyx_v_src_data + __pyx_v_src_stride); + + /* "View.MemoryView":1158 + * memcpy(dst_data, src_data, itemsize) + * src_data += src_stride + * dst_data += dst_stride # <<<<<<<<<<<<<< + * else: + * for i in range(dst_extent): +*/ + __pyx_v_dst_data = (__pyx_v_dst_data + __pyx_v_dst_stride); + } + } + __pyx_L4:; + + /* "View.MemoryView":1150 + * cdef Py_ssize_t dst_stride = dst_strides[0] + * + * if ndim == 1: # <<<<<<<<<<<<<< + * if (src_stride > 0 and dst_stride > 0 and + * src_stride == itemsize == dst_stride): +*/ + goto __pyx_L3; + } + + /* "View.MemoryView":1160 + * dst_data += dst_stride + * else: + * for i in range(dst_extent): # <<<<<<<<<<<<<< + * _copy_strided_to_strided(src_data, src_strides + 1, + * dst_data, dst_strides + 1, +*/ + /*else*/ { + __pyx_t_3 = __pyx_v_dst_extent; + __pyx_t_4 = __pyx_t_3; + for (__pyx_t_5 = 0; __pyx_t_5 < __pyx_t_4; __pyx_t_5+=1) { + __pyx_v_i = __pyx_t_5; + + /* "View.MemoryView":1161 + * else: + * for i in range(dst_extent): + * _copy_strided_to_strided(src_data, src_strides + 1, # <<<<<<<<<<<<<< + * dst_data, dst_strides + 1, + * src_shape + 1, dst_shape + 1, +*/ + _copy_strided_to_strided(__pyx_v_src_data, (__pyx_v_src_strides + 1), __pyx_v_dst_data, (__pyx_v_dst_strides + 1), (__pyx_v_src_shape + 1), (__pyx_v_dst_shape + 1), (__pyx_v_ndim - 1), __pyx_v_itemsize); + + /* "View.MemoryView":1165 + * src_shape + 1, dst_shape + 1, + * ndim - 1, itemsize) + * src_data += src_stride # <<<<<<<<<<<<<< + * dst_data += dst_stride + * +*/ + __pyx_v_src_data = (__pyx_v_src_data + __pyx_v_src_stride); + + /* "View.MemoryView":1166 + * ndim - 1, itemsize) + * src_data += src_stride + * dst_data += dst_stride # <<<<<<<<<<<<<< + * + * cdef void copy_strided_to_strided(__Pyx_memviewslice *src, +*/ + __pyx_v_dst_data = (__pyx_v_dst_data + __pyx_v_dst_stride); + } + } + __pyx_L3:; + + /* "View.MemoryView":1137 + * return 'F' + * + * @cython.cdivision(True) # <<<<<<<<<<<<<< + * cdef void _copy_strided_to_strided(char *src_data, Py_ssize_t *src_strides, + * char *dst_data, Py_ssize_t *dst_strides, +*/ + + /* function exit code */ +} + +/* "View.MemoryView":1168 + * dst_data += dst_stride + * + * cdef void copy_strided_to_strided(__Pyx_memviewslice *src, # <<<<<<<<<<<<<< + * __Pyx_memviewslice *dst, + * int ndim, size_t itemsize) noexcept nogil: +*/ + +static void copy_strided_to_strided(__Pyx_memviewslice *__pyx_v_src, __Pyx_memviewslice *__pyx_v_dst, int __pyx_v_ndim, size_t __pyx_v_itemsize) { + + /* "View.MemoryView":1171 + * __Pyx_memviewslice *dst, + * int ndim, size_t itemsize) noexcept nogil: + * _copy_strided_to_strided(src.data, src.strides, dst.data, dst.strides, # <<<<<<<<<<<<<< + * src.shape, dst.shape, ndim, itemsize) + * +*/ + _copy_strided_to_strided(__pyx_v_src->data, __pyx_v_src->strides, __pyx_v_dst->data, __pyx_v_dst->strides, __pyx_v_src->shape, __pyx_v_dst->shape, __pyx_v_ndim, __pyx_v_itemsize); + + /* "View.MemoryView":1168 + * dst_data += dst_stride + * + * cdef void copy_strided_to_strided(__Pyx_memviewslice *src, # <<<<<<<<<<<<<< + * __Pyx_memviewslice *dst, + * int ndim, size_t itemsize) noexcept nogil: +*/ + + /* function exit code */ +} + +/* "View.MemoryView":1174 + * src.shape, dst.shape, ndim, itemsize) + * + * @cname('__pyx_memoryview_slice_get_size') # <<<<<<<<<<<<<< + * cdef Py_ssize_t slice_get_size(__Pyx_memviewslice *src, int ndim) noexcept nogil: + * "Return the size of the memory occupied by the slice in number of bytes" +*/ + +static Py_ssize_t __pyx_memoryview_slice_get_size(__Pyx_memviewslice *__pyx_v_src, int __pyx_v_ndim) { + Py_ssize_t __pyx_v_shape; + Py_ssize_t __pyx_v_size; + Py_ssize_t __pyx_r; + Py_ssize_t __pyx_t_1; + Py_ssize_t *__pyx_t_2; + Py_ssize_t *__pyx_t_3; + Py_ssize_t *__pyx_t_4; + + /* "View.MemoryView":1177 + * cdef Py_ssize_t slice_get_size(__Pyx_memviewslice *src, int ndim) noexcept nogil: + * "Return the size of the memory occupied by the slice in number of bytes" + * cdef Py_ssize_t shape, size = src.memview.view.itemsize # <<<<<<<<<<<<<< + * + * for shape in src.shape[:ndim]: +*/ + __pyx_t_1 = __pyx_v_src->memview->view.itemsize; + __pyx_v_size = __pyx_t_1; + + /* "View.MemoryView":1179 + * cdef Py_ssize_t shape, size = src.memview.view.itemsize + * + * for shape in src.shape[:ndim]: # <<<<<<<<<<<<<< + * size *= shape + * +*/ + __pyx_t_3 = (__pyx_v_src->shape + __pyx_v_ndim); + for (__pyx_t_4 = __pyx_v_src->shape; __pyx_t_4 < __pyx_t_3; __pyx_t_4++) { + __pyx_t_2 = __pyx_t_4; + __pyx_v_shape = (__pyx_t_2[0]); + + /* "View.MemoryView":1180 + * + * for shape in src.shape[:ndim]: + * size *= shape # <<<<<<<<<<<<<< + * + * return size +*/ + __pyx_v_size = (__pyx_v_size * __pyx_v_shape); + } + + /* "View.MemoryView":1182 + * size *= shape + * + * return size # <<<<<<<<<<<<<< + * + * @cname('__pyx_fill_contig_strides_array') +*/ + __pyx_r = __pyx_v_size; + goto __pyx_L0; + + /* "View.MemoryView":1174 + * src.shape, dst.shape, ndim, itemsize) + * + * @cname('__pyx_memoryview_slice_get_size') # <<<<<<<<<<<<<< + * cdef Py_ssize_t slice_get_size(__Pyx_memviewslice *src, int ndim) noexcept nogil: + * "Return the size of the memory occupied by the slice in number of bytes" +*/ + + /* function exit code */ + __pyx_L0:; + return __pyx_r; +} + +/* "View.MemoryView":1184 + * return size + * + * @cname('__pyx_fill_contig_strides_array') # <<<<<<<<<<<<<< + * cdef Py_ssize_t fill_contig_strides_array( + * Py_ssize_t *shape, Py_ssize_t *strides, Py_ssize_t stride, +*/ + +static Py_ssize_t __pyx_fill_contig_strides_array(Py_ssize_t *__pyx_v_shape, Py_ssize_t *__pyx_v_strides, Py_ssize_t __pyx_v_stride, int __pyx_v_ndim, char __pyx_v_order) { + int __pyx_v_idx; + Py_ssize_t __pyx_r; + int __pyx_t_1; + int __pyx_t_2; + int __pyx_t_3; + int __pyx_t_4; + + /* "View.MemoryView":1194 + * cdef int idx + * + * if order == 'F': # <<<<<<<<<<<<<< + * for idx in range(ndim): + * strides[idx] = stride +*/ + __pyx_t_1 = (__pyx_v_order == 'F'); + if (__pyx_t_1) { + + /* "View.MemoryView":1195 + * + * if order == 'F': + * for idx in range(ndim): # <<<<<<<<<<<<<< + * strides[idx] = stride + * stride *= shape[idx] +*/ + __pyx_t_2 = __pyx_v_ndim; + __pyx_t_3 = __pyx_t_2; + for (__pyx_t_4 = 0; __pyx_t_4 < __pyx_t_3; __pyx_t_4+=1) { + __pyx_v_idx = __pyx_t_4; + + /* "View.MemoryView":1196 + * if order == 'F': + * for idx in range(ndim): + * strides[idx] = stride # <<<<<<<<<<<<<< + * stride *= shape[idx] + * else: +*/ + (__pyx_v_strides[__pyx_v_idx]) = __pyx_v_stride; + + /* "View.MemoryView":1197 + * for idx in range(ndim): + * strides[idx] = stride + * stride *= shape[idx] # <<<<<<<<<<<<<< + * else: + * for idx in range(ndim - 1, -1, -1): +*/ + __pyx_v_stride = (__pyx_v_stride * (__pyx_v_shape[__pyx_v_idx])); + } + + /* "View.MemoryView":1194 + * cdef int idx + * + * if order == 'F': # <<<<<<<<<<<<<< + * for idx in range(ndim): + * strides[idx] = stride +*/ + goto __pyx_L3; + } + + /* "View.MemoryView":1199 + * stride *= shape[idx] + * else: + * for idx in range(ndim - 1, -1, -1): # <<<<<<<<<<<<<< + * strides[idx] = stride + * stride *= shape[idx] +*/ + /*else*/ { + for (__pyx_t_2 = (__pyx_v_ndim - 1); __pyx_t_2 > -1; __pyx_t_2-=1) { + __pyx_v_idx = __pyx_t_2; + + /* "View.MemoryView":1200 + * else: + * for idx in range(ndim - 1, -1, -1): + * strides[idx] = stride # <<<<<<<<<<<<<< + * stride *= shape[idx] + * +*/ + (__pyx_v_strides[__pyx_v_idx]) = __pyx_v_stride; + + /* "View.MemoryView":1201 + * for idx in range(ndim - 1, -1, -1): + * strides[idx] = stride + * stride *= shape[idx] # <<<<<<<<<<<<<< + * + * return stride +*/ + __pyx_v_stride = (__pyx_v_stride * (__pyx_v_shape[__pyx_v_idx])); + } + } + __pyx_L3:; + + /* "View.MemoryView":1203 + * stride *= shape[idx] + * + * return stride # <<<<<<<<<<<<<< + * + * @cname('__pyx_memoryview_copy_data_to_temp') +*/ + __pyx_r = __pyx_v_stride; + goto __pyx_L0; + + /* "View.MemoryView":1184 + * return size + * + * @cname('__pyx_fill_contig_strides_array') # <<<<<<<<<<<<<< + * cdef Py_ssize_t fill_contig_strides_array( + * Py_ssize_t *shape, Py_ssize_t *strides, Py_ssize_t stride, +*/ + + /* function exit code */ + __pyx_L0:; + return __pyx_r; +} + +/* "View.MemoryView":1205 + * return stride + * + * @cname('__pyx_memoryview_copy_data_to_temp') # <<<<<<<<<<<<<< + * cdef void *copy_data_to_temp(__Pyx_memviewslice *src, + * __Pyx_memviewslice *tmpslice, +*/ + +static void *__pyx_memoryview_copy_data_to_temp(__Pyx_memviewslice *__pyx_v_src, __Pyx_memviewslice *__pyx_v_tmpslice, char __pyx_v_order, int __pyx_v_ndim) { + int __pyx_v_i; + void *__pyx_v_result; + size_t __pyx_v_itemsize; + size_t __pyx_v_size; + void *__pyx_r; + Py_ssize_t __pyx_t_1; + int __pyx_t_2; + int __pyx_t_3; + struct __pyx_memoryview_obj *__pyx_t_4; + int __pyx_t_5; + int __pyx_t_6; + int __pyx_lineno = 0; + const char *__pyx_filename = NULL; + int __pyx_clineno = 0; + PyGILState_STATE __pyx_gilstate_save; + + /* "View.MemoryView":1217 + * cdef void *result + * + * cdef size_t itemsize = src.memview.view.itemsize # <<<<<<<<<<<<<< + * cdef size_t size = slice_get_size(src, ndim) + * +*/ + __pyx_t_1 = __pyx_v_src->memview->view.itemsize; + __pyx_v_itemsize = __pyx_t_1; + + /* "View.MemoryView":1218 + * + * cdef size_t itemsize = src.memview.view.itemsize + * cdef size_t size = slice_get_size(src, ndim) # <<<<<<<<<<<<<< + * + * result = malloc(size) +*/ + __pyx_v_size = __pyx_memoryview_slice_get_size(__pyx_v_src, __pyx_v_ndim); + + /* "View.MemoryView":1220 + * cdef size_t size = slice_get_size(src, ndim) + * + * result = malloc(size) # <<<<<<<<<<<<<< + * if not result: + * _err_no_memory() +*/ + __pyx_v_result = malloc(__pyx_v_size); + + /* "View.MemoryView":1221 + * + * result = malloc(size) + * if not result: # <<<<<<<<<<<<<< + * _err_no_memory() + * +*/ + __pyx_t_2 = (!(__pyx_v_result != 0)); + if (__pyx_t_2) { + + /* "View.MemoryView":1222 + * result = malloc(size) + * if not result: + * _err_no_memory() # <<<<<<<<<<<<<< + * + * +*/ + __pyx_t_3 = __pyx_memoryview_err_no_memory(); if (unlikely(__pyx_t_3 == ((int)-1))) __PYX_ERR(1, 1222, __pyx_L1_error) + + /* "View.MemoryView":1221 + * + * result = malloc(size) + * if not result: # <<<<<<<<<<<<<< + * _err_no_memory() + * +*/ + } + + /* "View.MemoryView":1225 + * + * + * tmpslice.data = result # <<<<<<<<<<<<<< + * tmpslice.memview = src.memview + * for i in range(ndim): +*/ + __pyx_v_tmpslice->data = ((char *)__pyx_v_result); + + /* "View.MemoryView":1226 + * + * tmpslice.data = result + * tmpslice.memview = src.memview # <<<<<<<<<<<<<< + * for i in range(ndim): + * tmpslice.shape[i] = src.shape[i] +*/ + __pyx_t_4 = __pyx_v_src->memview; + __pyx_v_tmpslice->memview = __pyx_t_4; + + /* "View.MemoryView":1227 + * tmpslice.data = result + * tmpslice.memview = src.memview + * for i in range(ndim): # <<<<<<<<<<<<<< + * tmpslice.shape[i] = src.shape[i] + * tmpslice.suboffsets[i] = -1 +*/ + __pyx_t_3 = __pyx_v_ndim; + __pyx_t_5 = __pyx_t_3; + for (__pyx_t_6 = 0; __pyx_t_6 < __pyx_t_5; __pyx_t_6+=1) { + __pyx_v_i = __pyx_t_6; + + /* "View.MemoryView":1228 + * tmpslice.memview = src.memview + * for i in range(ndim): + * tmpslice.shape[i] = src.shape[i] # <<<<<<<<<<<<<< + * tmpslice.suboffsets[i] = -1 + * +*/ + (__pyx_v_tmpslice->shape[__pyx_v_i]) = (__pyx_v_src->shape[__pyx_v_i]); + + /* "View.MemoryView":1229 + * for i in range(ndim): + * tmpslice.shape[i] = src.shape[i] + * tmpslice.suboffsets[i] = -1 # <<<<<<<<<<<<<< + * + * fill_contig_strides_array(&tmpslice.shape[0], &tmpslice.strides[0], itemsize, ndim, order) +*/ + (__pyx_v_tmpslice->suboffsets[__pyx_v_i]) = -1L; + } + + /* "View.MemoryView":1231 + * tmpslice.suboffsets[i] = -1 + * + * fill_contig_strides_array(&tmpslice.shape[0], &tmpslice.strides[0], itemsize, ndim, order) # <<<<<<<<<<<<<< + * + * +*/ + (void)(__pyx_fill_contig_strides_array((&(__pyx_v_tmpslice->shape[0])), (&(__pyx_v_tmpslice->strides[0])), __pyx_v_itemsize, __pyx_v_ndim, __pyx_v_order)); + + /* "View.MemoryView":1234 + * + * + * for i in range(ndim): # <<<<<<<<<<<<<< + * if tmpslice.shape[i] == 1: + * tmpslice.strides[i] = 0 +*/ + __pyx_t_3 = __pyx_v_ndim; + __pyx_t_5 = __pyx_t_3; + for (__pyx_t_6 = 0; __pyx_t_6 < __pyx_t_5; __pyx_t_6+=1) { + __pyx_v_i = __pyx_t_6; + + /* "View.MemoryView":1235 + * + * for i in range(ndim): + * if tmpslice.shape[i] == 1: # <<<<<<<<<<<<<< + * tmpslice.strides[i] = 0 + * +*/ + __pyx_t_2 = ((__pyx_v_tmpslice->shape[__pyx_v_i]) == 1); + if (__pyx_t_2) { + + /* "View.MemoryView":1236 + * for i in range(ndim): + * if tmpslice.shape[i] == 1: + * tmpslice.strides[i] = 0 # <<<<<<<<<<<<<< + * + * if slice_is_contig(src[0], order, ndim): +*/ + (__pyx_v_tmpslice->strides[__pyx_v_i]) = 0; + + /* "View.MemoryView":1235 + * + * for i in range(ndim): + * if tmpslice.shape[i] == 1: # <<<<<<<<<<<<<< + * tmpslice.strides[i] = 0 + * +*/ + } + } + + /* "View.MemoryView":1238 + * tmpslice.strides[i] = 0 + * + * if slice_is_contig(src[0], order, ndim): # <<<<<<<<<<<<<< + * memcpy(result, src.data, size) + * else: +*/ + __pyx_t_2 = __pyx_memviewslice_is_contig((__pyx_v_src[0]), __pyx_v_order, __pyx_v_ndim); + if (__pyx_t_2) { + + /* "View.MemoryView":1239 + * + * if slice_is_contig(src[0], order, ndim): + * memcpy(result, src.data, size) # <<<<<<<<<<<<<< + * else: + * copy_strided_to_strided(src, tmpslice, ndim, itemsize) +*/ + (void)(memcpy(__pyx_v_result, __pyx_v_src->data, __pyx_v_size)); + + /* "View.MemoryView":1238 + * tmpslice.strides[i] = 0 + * + * if slice_is_contig(src[0], order, ndim): # <<<<<<<<<<<<<< + * memcpy(result, src.data, size) + * else: +*/ + goto __pyx_L9; + } + + /* "View.MemoryView":1241 + * memcpy(result, src.data, size) + * else: + * copy_strided_to_strided(src, tmpslice, ndim, itemsize) # <<<<<<<<<<<<<< + * + * return result +*/ + /*else*/ { + copy_strided_to_strided(__pyx_v_src, __pyx_v_tmpslice, __pyx_v_ndim, __pyx_v_itemsize); + } + __pyx_L9:; + + /* "View.MemoryView":1243 + * copy_strided_to_strided(src, tmpslice, ndim, itemsize) + * + * return result # <<<<<<<<<<<<<< + * + * +*/ + __pyx_r = __pyx_v_result; + goto __pyx_L0; + + /* "View.MemoryView":1205 + * return stride + * + * @cname('__pyx_memoryview_copy_data_to_temp') # <<<<<<<<<<<<<< + * cdef void *copy_data_to_temp(__Pyx_memviewslice *src, + * __Pyx_memviewslice *tmpslice, +*/ + + /* function exit code */ + __pyx_L1_error:; + __pyx_gilstate_save = __Pyx_PyGILState_Ensure(); + __Pyx_AddTraceback("View.MemoryView.copy_data_to_temp", __pyx_clineno, __pyx_lineno, __pyx_filename); + __pyx_r = NULL; + __Pyx_PyGILState_Release(__pyx_gilstate_save); + __pyx_L0:; + return __pyx_r; +} + +/* "View.MemoryView":1247 + * + * + * @cname('__pyx_memoryview_err_extents') # <<<<<<<<<<<<<< + * cdef int _err_extents(int i, Py_ssize_t extent1, + * Py_ssize_t extent2) except -1 with gil: +*/ + +static int __pyx_memoryview_err_extents(int __pyx_v_i, Py_ssize_t __pyx_v_extent1, Py_ssize_t __pyx_v_extent2) { + int __pyx_r; + __Pyx_RefNannyDeclarations + PyObject *__pyx_t_1 = NULL; + PyObject *__pyx_t_2 = NULL; + PyObject *__pyx_t_3 = NULL; + PyObject *__pyx_t_4[7]; + PyObject *__pyx_t_5 = NULL; + int __pyx_lineno = 0; + const char *__pyx_filename = NULL; + int __pyx_clineno = 0; + PyGILState_STATE __pyx_gilstate_save = __Pyx_PyGILState_Ensure(); + __Pyx_RefNannySetupContext("_err_extents", 0); + + /* "View.MemoryView":1250 + * cdef int _err_extents(int i, Py_ssize_t extent1, + * Py_ssize_t extent2) except -1 with gil: + * raise ValueError, f"got differing extents in dimension {i} (got {extent1} and {extent2})" # <<<<<<<<<<<<<< + * + * @cname('__pyx_memoryview_err_dim') +*/ + __pyx_t_1 = __Pyx_PyUnicode_From_int(__pyx_v_i, 0, ' ', 'd'); if (unlikely(!__pyx_t_1)) __PYX_ERR(1, 1250, __pyx_L1_error) + __Pyx_GOTREF(__pyx_t_1); + __pyx_t_2 = __Pyx_PyUnicode_From_Py_ssize_t(__pyx_v_extent1, 0, ' ', 'd'); if (unlikely(!__pyx_t_2)) __PYX_ERR(1, 1250, __pyx_L1_error) + __Pyx_GOTREF(__pyx_t_2); + __pyx_t_3 = __Pyx_PyUnicode_From_Py_ssize_t(__pyx_v_extent2, 0, ' ', 'd'); if (unlikely(!__pyx_t_3)) __PYX_ERR(1, 1250, __pyx_L1_error) + __Pyx_GOTREF(__pyx_t_3); + __pyx_t_4[0] = __pyx_mstate_global->__pyx_kp_u_got_differing_extents_in_dimensi; + __pyx_t_4[1] = __pyx_t_1; + __pyx_t_4[2] = __pyx_mstate_global->__pyx_kp_u_got; + __pyx_t_4[3] = __pyx_t_2; + __pyx_t_4[4] = __pyx_mstate_global->__pyx_kp_u_and; + __pyx_t_4[5] = __pyx_t_3; + __pyx_t_4[6] = __pyx_mstate_global->__pyx_kp_u__5; + __pyx_t_5 = __Pyx_PyUnicode_Join(__pyx_t_4, 7, 35 + __Pyx_PyUnicode_GET_LENGTH(__pyx_t_1) + 6 + __Pyx_PyUnicode_GET_LENGTH(__pyx_t_2) + 5 + __Pyx_PyUnicode_GET_LENGTH(__pyx_t_3) + 1, 127); + if (unlikely(!__pyx_t_5)) __PYX_ERR(1, 1250, __pyx_L1_error) + __Pyx_GOTREF(__pyx_t_5); + __Pyx_DECREF(__pyx_t_1); __pyx_t_1 = 0; + __Pyx_DECREF(__pyx_t_2); __pyx_t_2 = 0; + __Pyx_DECREF(__pyx_t_3); __pyx_t_3 = 0; + __Pyx_Raise(((PyObject *)(((PyTypeObject*)PyExc_ValueError))), __pyx_t_5, 0, 0); + __Pyx_DECREF(__pyx_t_5); __pyx_t_5 = 0; + __PYX_ERR(1, 1250, __pyx_L1_error) + + /* "View.MemoryView":1247 + * + * + * @cname('__pyx_memoryview_err_extents') # <<<<<<<<<<<<<< + * cdef int _err_extents(int i, Py_ssize_t extent1, + * Py_ssize_t extent2) except -1 with gil: +*/ + + /* function exit code */ + __pyx_L1_error:; + __Pyx_XDECREF(__pyx_t_1); + __Pyx_XDECREF(__pyx_t_2); + __Pyx_XDECREF(__pyx_t_3); + __Pyx_XDECREF(__pyx_t_5); + __Pyx_AddTraceback("View.MemoryView._err_extents", __pyx_clineno, __pyx_lineno, __pyx_filename); + __pyx_r = -1; + __Pyx_RefNannyFinishContext(); + __Pyx_PyGILState_Release(__pyx_gilstate_save); + return __pyx_r; +} + +/* "View.MemoryView":1252 + * raise ValueError, f"got differing extents in dimension {i} (got {extent1} and {extent2})" + * + * @cname('__pyx_memoryview_err_dim') # <<<<<<<<<<<<<< + * cdef int _err_dim(PyObject *error, str msg, int dim) except -1 with gil: + * raise error, msg % dim +*/ + +static int __pyx_memoryview_err_dim(PyObject *__pyx_v_error, PyObject *__pyx_v_msg, int __pyx_v_dim) { + int __pyx_r; + __Pyx_RefNannyDeclarations + PyObject *__pyx_t_1 = NULL; + PyObject *__pyx_t_2 = NULL; + int __pyx_lineno = 0; + const char *__pyx_filename = NULL; + int __pyx_clineno = 0; + PyGILState_STATE __pyx_gilstate_save = __Pyx_PyGILState_Ensure(); + __Pyx_RefNannySetupContext("_err_dim", 0); + __Pyx_INCREF(__pyx_v_msg); + + /* "View.MemoryView":1254 + * @cname('__pyx_memoryview_err_dim') + * cdef int _err_dim(PyObject *error, str msg, int dim) except -1 with gil: + * raise error, msg % dim # <<<<<<<<<<<<<< + * + * @cname('__pyx_memoryview_err') +*/ + __pyx_t_1 = __Pyx_PyLong_From_int(__pyx_v_dim); if (unlikely(!__pyx_t_1)) __PYX_ERR(1, 1254, __pyx_L1_error) + __Pyx_GOTREF(__pyx_t_1); + __pyx_t_2 = __Pyx_PyUnicode_FormatSafe(__pyx_v_msg, __pyx_t_1); if (unlikely(!__pyx_t_2)) __PYX_ERR(1, 1254, __pyx_L1_error) + __Pyx_GOTREF(__pyx_t_2); + __Pyx_DECREF(__pyx_t_1); __pyx_t_1 = 0; + __Pyx_Raise(((PyObject *)__pyx_v_error), __pyx_t_2, 0, 0); + __Pyx_DECREF(__pyx_t_2); __pyx_t_2 = 0; + __PYX_ERR(1, 1254, __pyx_L1_error) + + /* "View.MemoryView":1252 + * raise ValueError, f"got differing extents in dimension {i} (got {extent1} and {extent2})" + * + * @cname('__pyx_memoryview_err_dim') # <<<<<<<<<<<<<< + * cdef int _err_dim(PyObject *error, str msg, int dim) except -1 with gil: + * raise error, msg % dim +*/ + + /* function exit code */ + __pyx_L1_error:; + __Pyx_XDECREF(__pyx_t_1); + __Pyx_XDECREF(__pyx_t_2); + __Pyx_AddTraceback("View.MemoryView._err_dim", __pyx_clineno, __pyx_lineno, __pyx_filename); + __pyx_r = -1; + __Pyx_XDECREF(__pyx_v_msg); + __Pyx_RefNannyFinishContext(); + __Pyx_PyGILState_Release(__pyx_gilstate_save); + return __pyx_r; +} + +/* "View.MemoryView":1256 + * raise error, msg % dim + * + * @cname('__pyx_memoryview_err') # <<<<<<<<<<<<<< + * cdef int _err(PyObject *error, str msg) except -1 with gil: + * raise error, msg +*/ + +static int __pyx_memoryview_err(PyObject *__pyx_v_error, PyObject *__pyx_v_msg) { + int __pyx_r; + __Pyx_RefNannyDeclarations + int __pyx_lineno = 0; + const char *__pyx_filename = NULL; + int __pyx_clineno = 0; + PyGILState_STATE __pyx_gilstate_save = __Pyx_PyGILState_Ensure(); + __Pyx_RefNannySetupContext("_err", 0); + __Pyx_INCREF(__pyx_v_msg); + + /* "View.MemoryView":1258 + * @cname('__pyx_memoryview_err') + * cdef int _err(PyObject *error, str msg) except -1 with gil: + * raise error, msg # <<<<<<<<<<<<<< + * + * @cname('__pyx_memoryview_err_no_memory') +*/ + __Pyx_Raise(((PyObject *)__pyx_v_error), __pyx_v_msg, 0, 0); + __PYX_ERR(1, 1258, __pyx_L1_error) + + /* "View.MemoryView":1256 + * raise error, msg % dim + * + * @cname('__pyx_memoryview_err') # <<<<<<<<<<<<<< + * cdef int _err(PyObject *error, str msg) except -1 with gil: + * raise error, msg +*/ + + /* function exit code */ + __pyx_L1_error:; + __Pyx_AddTraceback("View.MemoryView._err", __pyx_clineno, __pyx_lineno, __pyx_filename); + __pyx_r = -1; + __Pyx_XDECREF(__pyx_v_msg); + __Pyx_RefNannyFinishContext(); + __Pyx_PyGILState_Release(__pyx_gilstate_save); + return __pyx_r; +} + +/* "View.MemoryView":1260 + * raise error, msg + * + * @cname('__pyx_memoryview_err_no_memory') # <<<<<<<<<<<<<< + * cdef int _err_no_memory() except -1 with gil: + * raise MemoryError +*/ + +static int __pyx_memoryview_err_no_memory(void) { + int __pyx_r; + int __pyx_lineno = 0; + const char *__pyx_filename = NULL; + int __pyx_clineno = 0; + PyGILState_STATE __pyx_gilstate_save = __Pyx_PyGILState_Ensure(); + + /* "View.MemoryView":1262 + * @cname('__pyx_memoryview_err_no_memory') + * cdef int _err_no_memory() except -1 with gil: + * raise MemoryError # <<<<<<<<<<<<<< + * + * +*/ + PyErr_NoMemory(); __PYX_ERR(1, 1262, __pyx_L1_error) + + /* "View.MemoryView":1260 + * raise error, msg + * + * @cname('__pyx_memoryview_err_no_memory') # <<<<<<<<<<<<<< + * cdef int _err_no_memory() except -1 with gil: + * raise MemoryError +*/ + + /* function exit code */ + __pyx_L1_error:; + __Pyx_AddTraceback("View.MemoryView._err_no_memory", __pyx_clineno, __pyx_lineno, __pyx_filename); + __pyx_r = -1; + __Pyx_PyGILState_Release(__pyx_gilstate_save); + return __pyx_r; +} + +/* "View.MemoryView":1265 + * + * + * @cname('__pyx_memoryview_copy_contents') # <<<<<<<<<<<<<< + * cdef int memoryview_copy_contents(__Pyx_memviewslice src, + * __Pyx_memviewslice dst, +*/ + +static int __pyx_memoryview_copy_contents(__Pyx_memviewslice __pyx_v_src, __Pyx_memviewslice __pyx_v_dst, int __pyx_v_src_ndim, int __pyx_v_dst_ndim, int __pyx_v_dtype_is_object) { + void *__pyx_v_tmpdata; + size_t __pyx_v_itemsize; + int __pyx_v_i; + char __pyx_v_order; + int __pyx_v_broadcasting; + int __pyx_v_direct_copy; + __Pyx_memviewslice __pyx_v_tmp; + int __pyx_v_ndim; + int __pyx_r; + Py_ssize_t __pyx_t_1; + int __pyx_t_2; + int __pyx_t_3; + int __pyx_t_4; + int __pyx_t_5; + int __pyx_t_6; + void *__pyx_t_7; + int __pyx_lineno = 0; + const char *__pyx_filename = NULL; + int __pyx_clineno = 0; + PyGILState_STATE __pyx_gilstate_save; + + /* "View.MemoryView":1274 + * Check for overlapping memory and verify the shapes. + * """ + * cdef void *tmpdata = NULL # <<<<<<<<<<<<<< + * cdef size_t itemsize = src.memview.view.itemsize + * cdef int i +*/ + __pyx_v_tmpdata = NULL; + + /* "View.MemoryView":1275 + * """ + * cdef void *tmpdata = NULL + * cdef size_t itemsize = src.memview.view.itemsize # <<<<<<<<<<<<<< + * cdef int i + * cdef char order = get_best_order(&src, src_ndim) +*/ + __pyx_t_1 = __pyx_v_src.memview->view.itemsize; + __pyx_v_itemsize = __pyx_t_1; + + /* "View.MemoryView":1277 + * cdef size_t itemsize = src.memview.view.itemsize + * cdef int i + * cdef char order = get_best_order(&src, src_ndim) # <<<<<<<<<<<<<< + * cdef bint broadcasting = False + * cdef bint direct_copy = False +*/ + __pyx_v_order = __pyx_get_best_slice_order((&__pyx_v_src), __pyx_v_src_ndim); + + /* "View.MemoryView":1278 + * cdef int i + * cdef char order = get_best_order(&src, src_ndim) + * cdef bint broadcasting = False # <<<<<<<<<<<<<< + * cdef bint direct_copy = False + * cdef __Pyx_memviewslice tmp +*/ + __pyx_v_broadcasting = 0; + + /* "View.MemoryView":1279 + * cdef char order = get_best_order(&src, src_ndim) + * cdef bint broadcasting = False + * cdef bint direct_copy = False # <<<<<<<<<<<<<< + * cdef __Pyx_memviewslice tmp + * +*/ + __pyx_v_direct_copy = 0; + + /* "View.MemoryView":1282 + * cdef __Pyx_memviewslice tmp + * + * if src_ndim < dst_ndim: # <<<<<<<<<<<<<< + * broadcast_leading(&src, src_ndim, dst_ndim) + * elif dst_ndim < src_ndim: +*/ + __pyx_t_2 = (__pyx_v_src_ndim < __pyx_v_dst_ndim); + if (__pyx_t_2) { + + /* "View.MemoryView":1283 + * + * if src_ndim < dst_ndim: + * broadcast_leading(&src, src_ndim, dst_ndim) # <<<<<<<<<<<<<< + * elif dst_ndim < src_ndim: + * broadcast_leading(&dst, dst_ndim, src_ndim) +*/ + __pyx_memoryview_broadcast_leading((&__pyx_v_src), __pyx_v_src_ndim, __pyx_v_dst_ndim); + + /* "View.MemoryView":1282 + * cdef __Pyx_memviewslice tmp + * + * if src_ndim < dst_ndim: # <<<<<<<<<<<<<< + * broadcast_leading(&src, src_ndim, dst_ndim) + * elif dst_ndim < src_ndim: +*/ + goto __pyx_L3; + } + + /* "View.MemoryView":1284 + * if src_ndim < dst_ndim: + * broadcast_leading(&src, src_ndim, dst_ndim) + * elif dst_ndim < src_ndim: # <<<<<<<<<<<<<< + * broadcast_leading(&dst, dst_ndim, src_ndim) + * +*/ + __pyx_t_2 = (__pyx_v_dst_ndim < __pyx_v_src_ndim); + if (__pyx_t_2) { + + /* "View.MemoryView":1285 + * broadcast_leading(&src, src_ndim, dst_ndim) + * elif dst_ndim < src_ndim: + * broadcast_leading(&dst, dst_ndim, src_ndim) # <<<<<<<<<<<<<< + * + * cdef int ndim = max(src_ndim, dst_ndim) +*/ + __pyx_memoryview_broadcast_leading((&__pyx_v_dst), __pyx_v_dst_ndim, __pyx_v_src_ndim); + + /* "View.MemoryView":1284 + * if src_ndim < dst_ndim: + * broadcast_leading(&src, src_ndim, dst_ndim) + * elif dst_ndim < src_ndim: # <<<<<<<<<<<<<< + * broadcast_leading(&dst, dst_ndim, src_ndim) + * +*/ + } + __pyx_L3:; + + /* "View.MemoryView":1287 + * broadcast_leading(&dst, dst_ndim, src_ndim) + * + * cdef int ndim = max(src_ndim, dst_ndim) # <<<<<<<<<<<<<< + * + * for i in range(ndim): +*/ + __pyx_t_3 = __pyx_v_dst_ndim; + __pyx_t_4 = __pyx_v_src_ndim; + __pyx_t_2 = (__pyx_t_3 > __pyx_t_4); + if (__pyx_t_2) { + __pyx_t_5 = __pyx_t_3; + } else { + __pyx_t_5 = __pyx_t_4; + } + __pyx_v_ndim = __pyx_t_5; + + /* "View.MemoryView":1289 + * cdef int ndim = max(src_ndim, dst_ndim) + * + * for i in range(ndim): # <<<<<<<<<<<<<< + * if src.shape[i] != dst.shape[i]: + * if src.shape[i] == 1: +*/ + __pyx_t_5 = __pyx_v_ndim; + __pyx_t_3 = __pyx_t_5; + for (__pyx_t_4 = 0; __pyx_t_4 < __pyx_t_3; __pyx_t_4+=1) { + __pyx_v_i = __pyx_t_4; + + /* "View.MemoryView":1290 + * + * for i in range(ndim): + * if src.shape[i] != dst.shape[i]: # <<<<<<<<<<<<<< + * if src.shape[i] == 1: + * broadcasting = True +*/ + __pyx_t_2 = ((__pyx_v_src.shape[__pyx_v_i]) != (__pyx_v_dst.shape[__pyx_v_i])); + if (__pyx_t_2) { + + /* "View.MemoryView":1291 + * for i in range(ndim): + * if src.shape[i] != dst.shape[i]: + * if src.shape[i] == 1: # <<<<<<<<<<<<<< + * broadcasting = True + * src.strides[i] = 0 +*/ + __pyx_t_2 = ((__pyx_v_src.shape[__pyx_v_i]) == 1); + if (__pyx_t_2) { + + /* "View.MemoryView":1292 + * if src.shape[i] != dst.shape[i]: + * if src.shape[i] == 1: + * broadcasting = True # <<<<<<<<<<<<<< + * src.strides[i] = 0 + * else: +*/ + __pyx_v_broadcasting = 1; + + /* "View.MemoryView":1293 + * if src.shape[i] == 1: + * broadcasting = True + * src.strides[i] = 0 # <<<<<<<<<<<<<< + * else: + * _err_extents(i, dst.shape[i], src.shape[i]) +*/ + (__pyx_v_src.strides[__pyx_v_i]) = 0; + + /* "View.MemoryView":1291 + * for i in range(ndim): + * if src.shape[i] != dst.shape[i]: + * if src.shape[i] == 1: # <<<<<<<<<<<<<< + * broadcasting = True + * src.strides[i] = 0 +*/ + goto __pyx_L7; + } + + /* "View.MemoryView":1295 + * src.strides[i] = 0 + * else: + * _err_extents(i, dst.shape[i], src.shape[i]) # <<<<<<<<<<<<<< + * + * if src.suboffsets[i] >= 0: +*/ + /*else*/ { + __pyx_t_6 = __pyx_memoryview_err_extents(__pyx_v_i, (__pyx_v_dst.shape[__pyx_v_i]), (__pyx_v_src.shape[__pyx_v_i])); if (unlikely(__pyx_t_6 == ((int)-1))) __PYX_ERR(1, 1295, __pyx_L1_error) + } + __pyx_L7:; + + /* "View.MemoryView":1290 + * + * for i in range(ndim): + * if src.shape[i] != dst.shape[i]: # <<<<<<<<<<<<<< + * if src.shape[i] == 1: + * broadcasting = True +*/ + } + + /* "View.MemoryView":1297 + * _err_extents(i, dst.shape[i], src.shape[i]) + * + * if src.suboffsets[i] >= 0: # <<<<<<<<<<<<<< + * _err_dim(PyExc_ValueError, "Dimension %d is not direct", i) + * +*/ + __pyx_t_2 = ((__pyx_v_src.suboffsets[__pyx_v_i]) >= 0); + if (__pyx_t_2) { + + /* "View.MemoryView":1298 + * + * if src.suboffsets[i] >= 0: + * _err_dim(PyExc_ValueError, "Dimension %d is not direct", i) # <<<<<<<<<<<<<< + * + * if slices_overlap(&src, &dst, ndim, itemsize): +*/ + __pyx_t_6 = __pyx_memoryview_err_dim(PyExc_ValueError, __pyx_mstate_global->__pyx_kp_u_Dimension_d_is_not_direct, __pyx_v_i); if (unlikely(__pyx_t_6 == ((int)-1))) __PYX_ERR(1, 1298, __pyx_L1_error) + + /* "View.MemoryView":1297 + * _err_extents(i, dst.shape[i], src.shape[i]) + * + * if src.suboffsets[i] >= 0: # <<<<<<<<<<<<<< + * _err_dim(PyExc_ValueError, "Dimension %d is not direct", i) + * +*/ + } + } + + /* "View.MemoryView":1300 + * _err_dim(PyExc_ValueError, "Dimension %d is not direct", i) + * + * if slices_overlap(&src, &dst, ndim, itemsize): # <<<<<<<<<<<<<< + * + * if not slice_is_contig(src, order, ndim): +*/ + __pyx_t_2 = __pyx_slices_overlap((&__pyx_v_src), (&__pyx_v_dst), __pyx_v_ndim, __pyx_v_itemsize); + if (__pyx_t_2) { + + /* "View.MemoryView":1302 + * if slices_overlap(&src, &dst, ndim, itemsize): + * + * if not slice_is_contig(src, order, ndim): # <<<<<<<<<<<<<< + * order = get_best_order(&dst, ndim) + * +*/ + __pyx_t_2 = (!__pyx_memviewslice_is_contig(__pyx_v_src, __pyx_v_order, __pyx_v_ndim)); + if (__pyx_t_2) { + + /* "View.MemoryView":1303 + * + * if not slice_is_contig(src, order, ndim): + * order = get_best_order(&dst, ndim) # <<<<<<<<<<<<<< + * + * tmpdata = copy_data_to_temp(&src, &tmp, order, ndim) +*/ + __pyx_v_order = __pyx_get_best_slice_order((&__pyx_v_dst), __pyx_v_ndim); + + /* "View.MemoryView":1302 + * if slices_overlap(&src, &dst, ndim, itemsize): + * + * if not slice_is_contig(src, order, ndim): # <<<<<<<<<<<<<< + * order = get_best_order(&dst, ndim) + * +*/ + } + + /* "View.MemoryView":1305 + * order = get_best_order(&dst, ndim) + * + * tmpdata = copy_data_to_temp(&src, &tmp, order, ndim) # <<<<<<<<<<<<<< + * src = tmp + * +*/ + __pyx_t_7 = __pyx_memoryview_copy_data_to_temp((&__pyx_v_src), (&__pyx_v_tmp), __pyx_v_order, __pyx_v_ndim); if (unlikely(__pyx_t_7 == ((void *)NULL))) __PYX_ERR(1, 1305, __pyx_L1_error) + __pyx_v_tmpdata = __pyx_t_7; + + /* "View.MemoryView":1306 + * + * tmpdata = copy_data_to_temp(&src, &tmp, order, ndim) + * src = tmp # <<<<<<<<<<<<<< + * + * if not broadcasting: +*/ + __pyx_v_src = __pyx_v_tmp; + + /* "View.MemoryView":1300 + * _err_dim(PyExc_ValueError, "Dimension %d is not direct", i) + * + * if slices_overlap(&src, &dst, ndim, itemsize): # <<<<<<<<<<<<<< + * + * if not slice_is_contig(src, order, ndim): +*/ + } + + /* "View.MemoryView":1308 + * src = tmp + * + * if not broadcasting: # <<<<<<<<<<<<<< + * + * +*/ + __pyx_t_2 = (!__pyx_v_broadcasting); + if (__pyx_t_2) { + + /* "View.MemoryView":1311 + * + * + * if slice_is_contig(src, 'C', ndim): # <<<<<<<<<<<<<< + * direct_copy = slice_is_contig(dst, 'C', ndim) + * elif slice_is_contig(src, 'F', ndim): +*/ + __pyx_t_2 = __pyx_memviewslice_is_contig(__pyx_v_src, 'C', __pyx_v_ndim); + if (__pyx_t_2) { + + /* "View.MemoryView":1312 + * + * if slice_is_contig(src, 'C', ndim): + * direct_copy = slice_is_contig(dst, 'C', ndim) # <<<<<<<<<<<<<< + * elif slice_is_contig(src, 'F', ndim): + * direct_copy = slice_is_contig(dst, 'F', ndim) +*/ + __pyx_v_direct_copy = __pyx_memviewslice_is_contig(__pyx_v_dst, 'C', __pyx_v_ndim); + + /* "View.MemoryView":1311 + * + * + * if slice_is_contig(src, 'C', ndim): # <<<<<<<<<<<<<< + * direct_copy = slice_is_contig(dst, 'C', ndim) + * elif slice_is_contig(src, 'F', ndim): +*/ + goto __pyx_L12; + } + + /* "View.MemoryView":1313 + * if slice_is_contig(src, 'C', ndim): + * direct_copy = slice_is_contig(dst, 'C', ndim) + * elif slice_is_contig(src, 'F', ndim): # <<<<<<<<<<<<<< + * direct_copy = slice_is_contig(dst, 'F', ndim) + * +*/ + __pyx_t_2 = __pyx_memviewslice_is_contig(__pyx_v_src, 'F', __pyx_v_ndim); + if (__pyx_t_2) { + + /* "View.MemoryView":1314 + * direct_copy = slice_is_contig(dst, 'C', ndim) + * elif slice_is_contig(src, 'F', ndim): + * direct_copy = slice_is_contig(dst, 'F', ndim) # <<<<<<<<<<<<<< + * + * if direct_copy: +*/ + __pyx_v_direct_copy = __pyx_memviewslice_is_contig(__pyx_v_dst, 'F', __pyx_v_ndim); + + /* "View.MemoryView":1313 + * if slice_is_contig(src, 'C', ndim): + * direct_copy = slice_is_contig(dst, 'C', ndim) + * elif slice_is_contig(src, 'F', ndim): # <<<<<<<<<<<<<< + * direct_copy = slice_is_contig(dst, 'F', ndim) + * +*/ + } + __pyx_L12:; + + /* "View.MemoryView":1316 + * direct_copy = slice_is_contig(dst, 'F', ndim) + * + * if direct_copy: # <<<<<<<<<<<<<< + * + * refcount_copying(&dst, dtype_is_object, ndim, inc=False) +*/ + if (__pyx_v_direct_copy) { + + /* "View.MemoryView":1318 + * if direct_copy: + * + * refcount_copying(&dst, dtype_is_object, ndim, inc=False) # <<<<<<<<<<<<<< + * memcpy(dst.data, src.data, slice_get_size(&src, ndim)) + * refcount_copying(&dst, dtype_is_object, ndim, inc=True) +*/ + __pyx_memoryview_refcount_copying((&__pyx_v_dst), __pyx_v_dtype_is_object, __pyx_v_ndim, 0); + + /* "View.MemoryView":1319 + * + * refcount_copying(&dst, dtype_is_object, ndim, inc=False) + * memcpy(dst.data, src.data, slice_get_size(&src, ndim)) # <<<<<<<<<<<<<< + * refcount_copying(&dst, dtype_is_object, ndim, inc=True) + * free(tmpdata) +*/ + (void)(memcpy(__pyx_v_dst.data, __pyx_v_src.data, __pyx_memoryview_slice_get_size((&__pyx_v_src), __pyx_v_ndim))); + + /* "View.MemoryView":1320 + * refcount_copying(&dst, dtype_is_object, ndim, inc=False) + * memcpy(dst.data, src.data, slice_get_size(&src, ndim)) + * refcount_copying(&dst, dtype_is_object, ndim, inc=True) # <<<<<<<<<<<<<< + * free(tmpdata) + * return 0 +*/ + __pyx_memoryview_refcount_copying((&__pyx_v_dst), __pyx_v_dtype_is_object, __pyx_v_ndim, 1); + + /* "View.MemoryView":1321 + * memcpy(dst.data, src.data, slice_get_size(&src, ndim)) + * refcount_copying(&dst, dtype_is_object, ndim, inc=True) + * free(tmpdata) # <<<<<<<<<<<<<< + * return 0 + * +*/ + free(__pyx_v_tmpdata); + + /* "View.MemoryView":1322 + * refcount_copying(&dst, dtype_is_object, ndim, inc=True) + * free(tmpdata) + * return 0 # <<<<<<<<<<<<<< + * + * if order == 'F' == get_best_order(&dst, ndim): +*/ + __pyx_r = 0; + goto __pyx_L0; + + /* "View.MemoryView":1316 + * direct_copy = slice_is_contig(dst, 'F', ndim) + * + * if direct_copy: # <<<<<<<<<<<<<< + * + * refcount_copying(&dst, dtype_is_object, ndim, inc=False) +*/ + } + + /* "View.MemoryView":1308 + * src = tmp + * + * if not broadcasting: # <<<<<<<<<<<<<< + * + * +*/ + } + + /* "View.MemoryView":1324 + * return 0 + * + * if order == 'F' == get_best_order(&dst, ndim): # <<<<<<<<<<<<<< + * + * +*/ + __pyx_t_2 = (__pyx_v_order == 'F'); + if (__pyx_t_2) { + __pyx_t_2 = ('F' == __pyx_get_best_slice_order((&__pyx_v_dst), __pyx_v_ndim)); + } + if (__pyx_t_2) { + + /* "View.MemoryView":1327 + * + * + * transpose_memslice(&src) # <<<<<<<<<<<<<< + * transpose_memslice(&dst) + * +*/ + __pyx_t_5 = __pyx_memslice_transpose((&__pyx_v_src)); if (unlikely(__pyx_t_5 == ((int)-1))) __PYX_ERR(1, 1327, __pyx_L1_error) + + /* "View.MemoryView":1328 + * + * transpose_memslice(&src) + * transpose_memslice(&dst) # <<<<<<<<<<<<<< + * + * refcount_copying(&dst, dtype_is_object, ndim, inc=False) +*/ + __pyx_t_5 = __pyx_memslice_transpose((&__pyx_v_dst)); if (unlikely(__pyx_t_5 == ((int)-1))) __PYX_ERR(1, 1328, __pyx_L1_error) + + /* "View.MemoryView":1324 + * return 0 + * + * if order == 'F' == get_best_order(&dst, ndim): # <<<<<<<<<<<<<< + * + * +*/ + } + + /* "View.MemoryView":1330 + * transpose_memslice(&dst) + * + * refcount_copying(&dst, dtype_is_object, ndim, inc=False) # <<<<<<<<<<<<<< + * copy_strided_to_strided(&src, &dst, ndim, itemsize) + * refcount_copying(&dst, dtype_is_object, ndim, inc=True) +*/ + __pyx_memoryview_refcount_copying((&__pyx_v_dst), __pyx_v_dtype_is_object, __pyx_v_ndim, 0); + + /* "View.MemoryView":1331 + * + * refcount_copying(&dst, dtype_is_object, ndim, inc=False) + * copy_strided_to_strided(&src, &dst, ndim, itemsize) # <<<<<<<<<<<<<< + * refcount_copying(&dst, dtype_is_object, ndim, inc=True) + * +*/ + copy_strided_to_strided((&__pyx_v_src), (&__pyx_v_dst), __pyx_v_ndim, __pyx_v_itemsize); + + /* "View.MemoryView":1332 + * refcount_copying(&dst, dtype_is_object, ndim, inc=False) + * copy_strided_to_strided(&src, &dst, ndim, itemsize) + * refcount_copying(&dst, dtype_is_object, ndim, inc=True) # <<<<<<<<<<<<<< + * + * free(tmpdata) +*/ + __pyx_memoryview_refcount_copying((&__pyx_v_dst), __pyx_v_dtype_is_object, __pyx_v_ndim, 1); + + /* "View.MemoryView":1334 + * refcount_copying(&dst, dtype_is_object, ndim, inc=True) + * + * free(tmpdata) # <<<<<<<<<<<<<< + * return 0 + * +*/ + free(__pyx_v_tmpdata); + + /* "View.MemoryView":1335 + * + * free(tmpdata) + * return 0 # <<<<<<<<<<<<<< + * + * @cname('__pyx_memoryview_broadcast_leading') +*/ + __pyx_r = 0; + goto __pyx_L0; + + /* "View.MemoryView":1265 + * + * + * @cname('__pyx_memoryview_copy_contents') # <<<<<<<<<<<<<< + * cdef int memoryview_copy_contents(__Pyx_memviewslice src, + * __Pyx_memviewslice dst, +*/ + + /* function exit code */ + __pyx_L1_error:; + __pyx_gilstate_save = __Pyx_PyGILState_Ensure(); + __Pyx_AddTraceback("View.MemoryView.memoryview_copy_contents", __pyx_clineno, __pyx_lineno, __pyx_filename); + __pyx_r = -1; + __Pyx_PyGILState_Release(__pyx_gilstate_save); + __pyx_L0:; + return __pyx_r; +} + +/* "View.MemoryView":1337 + * return 0 + * + * @cname('__pyx_memoryview_broadcast_leading') # <<<<<<<<<<<<<< + * cdef void broadcast_leading(__Pyx_memviewslice *mslice, + * int ndim, +*/ + +static void __pyx_memoryview_broadcast_leading(__Pyx_memviewslice *__pyx_v_mslice, int __pyx_v_ndim, int __pyx_v_ndim_other) { + int __pyx_v_i; + int __pyx_v_offset; + int __pyx_t_1; + int __pyx_t_2; + int __pyx_t_3; + + /* "View.MemoryView":1342 + * int ndim_other) noexcept nogil: + * cdef int i + * cdef int offset = ndim_other - ndim # <<<<<<<<<<<<<< + * + * for i in range(ndim - 1, -1, -1): +*/ + __pyx_v_offset = (__pyx_v_ndim_other - __pyx_v_ndim); + + /* "View.MemoryView":1344 + * cdef int offset = ndim_other - ndim + * + * for i in range(ndim - 1, -1, -1): # <<<<<<<<<<<<<< + * mslice.shape[i + offset] = mslice.shape[i] + * mslice.strides[i + offset] = mslice.strides[i] +*/ + for (__pyx_t_1 = (__pyx_v_ndim - 1); __pyx_t_1 > -1; __pyx_t_1-=1) { + __pyx_v_i = __pyx_t_1; + + /* "View.MemoryView":1345 + * + * for i in range(ndim - 1, -1, -1): + * mslice.shape[i + offset] = mslice.shape[i] # <<<<<<<<<<<<<< + * mslice.strides[i + offset] = mslice.strides[i] + * mslice.suboffsets[i + offset] = mslice.suboffsets[i] +*/ + (__pyx_v_mslice->shape[(__pyx_v_i + __pyx_v_offset)]) = (__pyx_v_mslice->shape[__pyx_v_i]); + + /* "View.MemoryView":1346 + * for i in range(ndim - 1, -1, -1): + * mslice.shape[i + offset] = mslice.shape[i] + * mslice.strides[i + offset] = mslice.strides[i] # <<<<<<<<<<<<<< + * mslice.suboffsets[i + offset] = mslice.suboffsets[i] + * +*/ + (__pyx_v_mslice->strides[(__pyx_v_i + __pyx_v_offset)]) = (__pyx_v_mslice->strides[__pyx_v_i]); + + /* "View.MemoryView":1347 + * mslice.shape[i + offset] = mslice.shape[i] + * mslice.strides[i + offset] = mslice.strides[i] + * mslice.suboffsets[i + offset] = mslice.suboffsets[i] # <<<<<<<<<<<<<< + * + * for i in range(offset): +*/ + (__pyx_v_mslice->suboffsets[(__pyx_v_i + __pyx_v_offset)]) = (__pyx_v_mslice->suboffsets[__pyx_v_i]); + } + + /* "View.MemoryView":1349 + * mslice.suboffsets[i + offset] = mslice.suboffsets[i] + * + * for i in range(offset): # <<<<<<<<<<<<<< + * mslice.shape[i] = 1 + * mslice.strides[i] = mslice.strides[0] +*/ + __pyx_t_1 = __pyx_v_offset; + __pyx_t_2 = __pyx_t_1; + for (__pyx_t_3 = 0; __pyx_t_3 < __pyx_t_2; __pyx_t_3+=1) { + __pyx_v_i = __pyx_t_3; + + /* "View.MemoryView":1350 + * + * for i in range(offset): + * mslice.shape[i] = 1 # <<<<<<<<<<<<<< + * mslice.strides[i] = mslice.strides[0] + * mslice.suboffsets[i] = -1 +*/ + (__pyx_v_mslice->shape[__pyx_v_i]) = 1; + + /* "View.MemoryView":1351 + * for i in range(offset): + * mslice.shape[i] = 1 + * mslice.strides[i] = mslice.strides[0] # <<<<<<<<<<<<<< + * mslice.suboffsets[i] = -1 + * +*/ + (__pyx_v_mslice->strides[__pyx_v_i]) = (__pyx_v_mslice->strides[0]); + + /* "View.MemoryView":1352 + * mslice.shape[i] = 1 + * mslice.strides[i] = mslice.strides[0] + * mslice.suboffsets[i] = -1 # <<<<<<<<<<<<<< + * + * +*/ + (__pyx_v_mslice->suboffsets[__pyx_v_i]) = -1L; + } + + /* "View.MemoryView":1337 + * return 0 + * + * @cname('__pyx_memoryview_broadcast_leading') # <<<<<<<<<<<<<< + * cdef void broadcast_leading(__Pyx_memviewslice *mslice, + * int ndim, +*/ + + /* function exit code */ +} + +/* "View.MemoryView":1359 + * + * + * @cname('__pyx_memoryview_refcount_copying') # <<<<<<<<<<<<<< + * cdef void refcount_copying(__Pyx_memviewslice *dst, bint dtype_is_object, int ndim, bint inc) noexcept nogil: + * +*/ + +static void __pyx_memoryview_refcount_copying(__Pyx_memviewslice *__pyx_v_dst, int __pyx_v_dtype_is_object, int __pyx_v_ndim, int __pyx_v_inc) { + + /* "View.MemoryView":1362 + * cdef void refcount_copying(__Pyx_memviewslice *dst, bint dtype_is_object, int ndim, bint inc) noexcept nogil: + * + * if dtype_is_object: # <<<<<<<<<<<<<< + * refcount_objects_in_slice_with_gil(dst.data, dst.shape, dst.strides, ndim, inc) + * +*/ + if (__pyx_v_dtype_is_object) { + + /* "View.MemoryView":1363 + * + * if dtype_is_object: + * refcount_objects_in_slice_with_gil(dst.data, dst.shape, dst.strides, ndim, inc) # <<<<<<<<<<<<<< + * + * @cname('__pyx_memoryview_refcount_objects_in_slice_with_gil') +*/ + __pyx_memoryview_refcount_objects_in_slice_with_gil(__pyx_v_dst->data, __pyx_v_dst->shape, __pyx_v_dst->strides, __pyx_v_ndim, __pyx_v_inc); + + /* "View.MemoryView":1362 + * cdef void refcount_copying(__Pyx_memviewslice *dst, bint dtype_is_object, int ndim, bint inc) noexcept nogil: + * + * if dtype_is_object: # <<<<<<<<<<<<<< + * refcount_objects_in_slice_with_gil(dst.data, dst.shape, dst.strides, ndim, inc) + * +*/ + } + + /* "View.MemoryView":1359 + * + * + * @cname('__pyx_memoryview_refcount_copying') # <<<<<<<<<<<<<< + * cdef void refcount_copying(__Pyx_memviewslice *dst, bint dtype_is_object, int ndim, bint inc) noexcept nogil: + * +*/ + + /* function exit code */ +} + +/* "View.MemoryView":1365 + * refcount_objects_in_slice_with_gil(dst.data, dst.shape, dst.strides, ndim, inc) + * + * @cname('__pyx_memoryview_refcount_objects_in_slice_with_gil') # <<<<<<<<<<<<<< + * cdef void refcount_objects_in_slice_with_gil(char *data, Py_ssize_t *shape, + * Py_ssize_t *strides, int ndim, +*/ + +static void __pyx_memoryview_refcount_objects_in_slice_with_gil(char *__pyx_v_data, Py_ssize_t *__pyx_v_shape, Py_ssize_t *__pyx_v_strides, int __pyx_v_ndim, int __pyx_v_inc) { + PyGILState_STATE __pyx_gilstate_save = __Pyx_PyGILState_Ensure(); + + /* "View.MemoryView":1369 + * Py_ssize_t *strides, int ndim, + * bint inc) noexcept with gil: + * refcount_objects_in_slice(data, shape, strides, ndim, inc) # <<<<<<<<<<<<<< + * + * @cname('__pyx_memoryview_refcount_objects_in_slice') +*/ + __pyx_memoryview_refcount_objects_in_slice(__pyx_v_data, __pyx_v_shape, __pyx_v_strides, __pyx_v_ndim, __pyx_v_inc); + + /* "View.MemoryView":1365 + * refcount_objects_in_slice_with_gil(dst.data, dst.shape, dst.strides, ndim, inc) + * + * @cname('__pyx_memoryview_refcount_objects_in_slice_with_gil') # <<<<<<<<<<<<<< + * cdef void refcount_objects_in_slice_with_gil(char *data, Py_ssize_t *shape, + * Py_ssize_t *strides, int ndim, +*/ + + /* function exit code */ + __Pyx_PyGILState_Release(__pyx_gilstate_save); +} + +/* "View.MemoryView":1371 + * refcount_objects_in_slice(data, shape, strides, ndim, inc) + * + * @cname('__pyx_memoryview_refcount_objects_in_slice') # <<<<<<<<<<<<<< + * cdef void refcount_objects_in_slice(char *data, Py_ssize_t *shape, + * Py_ssize_t *strides, int ndim, bint inc) noexcept: +*/ + +static void __pyx_memoryview_refcount_objects_in_slice(char *__pyx_v_data, Py_ssize_t *__pyx_v_shape, Py_ssize_t *__pyx_v_strides, int __pyx_v_ndim, int __pyx_v_inc) { + CYTHON_UNUSED Py_ssize_t __pyx_v_i; + Py_ssize_t __pyx_v_stride; + Py_ssize_t __pyx_t_1; + Py_ssize_t __pyx_t_2; + Py_ssize_t __pyx_t_3; + int __pyx_t_4; + + /* "View.MemoryView":1375 + * Py_ssize_t *strides, int ndim, bint inc) noexcept: + * cdef Py_ssize_t i + * cdef Py_ssize_t stride = strides[0] # <<<<<<<<<<<<<< + * + * for i in range(shape[0]): +*/ + __pyx_v_stride = (__pyx_v_strides[0]); + + /* "View.MemoryView":1377 + * cdef Py_ssize_t stride = strides[0] + * + * for i in range(shape[0]): # <<<<<<<<<<<<<< + * if ndim == 1: + * if inc: +*/ + __pyx_t_1 = (__pyx_v_shape[0]); + __pyx_t_2 = __pyx_t_1; + for (__pyx_t_3 = 0; __pyx_t_3 < __pyx_t_2; __pyx_t_3+=1) { + __pyx_v_i = __pyx_t_3; + + /* "View.MemoryView":1378 + * + * for i in range(shape[0]): + * if ndim == 1: # <<<<<<<<<<<<<< + * if inc: + * Py_INCREF(( data)[0]) +*/ + __pyx_t_4 = (__pyx_v_ndim == 1); + if (__pyx_t_4) { + + /* "View.MemoryView":1379 + * for i in range(shape[0]): + * if ndim == 1: + * if inc: # <<<<<<<<<<<<<< + * Py_INCREF(( data)[0]) + * else: +*/ + if (__pyx_v_inc) { + + /* "View.MemoryView":1380 + * if ndim == 1: + * if inc: + * Py_INCREF(( data)[0]) # <<<<<<<<<<<<<< + * else: + * Py_DECREF(( data)[0]) +*/ + Py_INCREF((((PyObject **)__pyx_v_data)[0])); + + /* "View.MemoryView":1379 + * for i in range(shape[0]): + * if ndim == 1: + * if inc: # <<<<<<<<<<<<<< + * Py_INCREF(( data)[0]) + * else: +*/ + goto __pyx_L6; + } + + /* "View.MemoryView":1382 + * Py_INCREF(( data)[0]) + * else: + * Py_DECREF(( data)[0]) # <<<<<<<<<<<<<< + * else: + * refcount_objects_in_slice(data, shape + 1, strides + 1, ndim - 1, inc) +*/ + /*else*/ { + Py_DECREF((((PyObject **)__pyx_v_data)[0])); + } + __pyx_L6:; + + /* "View.MemoryView":1378 + * + * for i in range(shape[0]): + * if ndim == 1: # <<<<<<<<<<<<<< + * if inc: + * Py_INCREF(( data)[0]) +*/ + goto __pyx_L5; + } + + /* "View.MemoryView":1384 + * Py_DECREF(( data)[0]) + * else: + * refcount_objects_in_slice(data, shape + 1, strides + 1, ndim - 1, inc) # <<<<<<<<<<<<<< + * + * data += stride +*/ + /*else*/ { + __pyx_memoryview_refcount_objects_in_slice(__pyx_v_data, (__pyx_v_shape + 1), (__pyx_v_strides + 1), (__pyx_v_ndim - 1), __pyx_v_inc); + } + __pyx_L5:; + + /* "View.MemoryView":1386 + * refcount_objects_in_slice(data, shape + 1, strides + 1, ndim - 1, inc) + * + * data += stride # <<<<<<<<<<<<<< + * + * +*/ + __pyx_v_data = (__pyx_v_data + __pyx_v_stride); + } + + /* "View.MemoryView":1371 + * refcount_objects_in_slice(data, shape, strides, ndim, inc) + * + * @cname('__pyx_memoryview_refcount_objects_in_slice') # <<<<<<<<<<<<<< + * cdef void refcount_objects_in_slice(char *data, Py_ssize_t *shape, + * Py_ssize_t *strides, int ndim, bint inc) noexcept: +*/ + + /* function exit code */ +} + +/* "View.MemoryView":1391 + * + * + * @cname('__pyx_memoryview_slice_assign_scalar') # <<<<<<<<<<<<<< + * cdef void slice_assign_scalar(__Pyx_memviewslice *dst, int ndim, + * size_t itemsize, void *item, +*/ + +static void __pyx_memoryview_slice_assign_scalar(__Pyx_memviewslice *__pyx_v_dst, int __pyx_v_ndim, size_t __pyx_v_itemsize, void *__pyx_v_item, int __pyx_v_dtype_is_object) { + + /* "View.MemoryView":1395 + * size_t itemsize, void *item, + * bint dtype_is_object) noexcept nogil: + * refcount_copying(dst, dtype_is_object, ndim, inc=False) # <<<<<<<<<<<<<< + * _slice_assign_scalar(dst.data, dst.shape, dst.strides, ndim, itemsize, item) + * refcount_copying(dst, dtype_is_object, ndim, inc=True) +*/ + __pyx_memoryview_refcount_copying(__pyx_v_dst, __pyx_v_dtype_is_object, __pyx_v_ndim, 0); + + /* "View.MemoryView":1396 + * bint dtype_is_object) noexcept nogil: + * refcount_copying(dst, dtype_is_object, ndim, inc=False) + * _slice_assign_scalar(dst.data, dst.shape, dst.strides, ndim, itemsize, item) # <<<<<<<<<<<<<< + * refcount_copying(dst, dtype_is_object, ndim, inc=True) + * +*/ + __pyx_memoryview__slice_assign_scalar(__pyx_v_dst->data, __pyx_v_dst->shape, __pyx_v_dst->strides, __pyx_v_ndim, __pyx_v_itemsize, __pyx_v_item); + + /* "View.MemoryView":1397 + * refcount_copying(dst, dtype_is_object, ndim, inc=False) + * _slice_assign_scalar(dst.data, dst.shape, dst.strides, ndim, itemsize, item) + * refcount_copying(dst, dtype_is_object, ndim, inc=True) # <<<<<<<<<<<<<< + * + * +*/ + __pyx_memoryview_refcount_copying(__pyx_v_dst, __pyx_v_dtype_is_object, __pyx_v_ndim, 1); + + /* "View.MemoryView":1391 + * + * + * @cname('__pyx_memoryview_slice_assign_scalar') # <<<<<<<<<<<<<< + * cdef void slice_assign_scalar(__Pyx_memviewslice *dst, int ndim, + * size_t itemsize, void *item, +*/ + + /* function exit code */ +} + +/* "View.MemoryView":1400 + * + * + * @cname('__pyx_memoryview__slice_assign_scalar') # <<<<<<<<<<<<<< + * cdef void _slice_assign_scalar(char *data, Py_ssize_t *shape, + * Py_ssize_t *strides, int ndim, +*/ + +static void __pyx_memoryview__slice_assign_scalar(char *__pyx_v_data, Py_ssize_t *__pyx_v_shape, Py_ssize_t *__pyx_v_strides, int __pyx_v_ndim, size_t __pyx_v_itemsize, void *__pyx_v_item) { + CYTHON_UNUSED Py_ssize_t __pyx_v_i; + Py_ssize_t __pyx_v_stride; + Py_ssize_t __pyx_v_extent; + int __pyx_t_1; + Py_ssize_t __pyx_t_2; + Py_ssize_t __pyx_t_3; + Py_ssize_t __pyx_t_4; + + /* "View.MemoryView":1405 + * size_t itemsize, void *item) noexcept nogil: + * cdef Py_ssize_t i + * cdef Py_ssize_t stride = strides[0] # <<<<<<<<<<<<<< + * cdef Py_ssize_t extent = shape[0] + * +*/ + __pyx_v_stride = (__pyx_v_strides[0]); + + /* "View.MemoryView":1406 + * cdef Py_ssize_t i + * cdef Py_ssize_t stride = strides[0] + * cdef Py_ssize_t extent = shape[0] # <<<<<<<<<<<<<< + * + * if ndim == 1: +*/ + __pyx_v_extent = (__pyx_v_shape[0]); + + /* "View.MemoryView":1408 + * cdef Py_ssize_t extent = shape[0] + * + * if ndim == 1: # <<<<<<<<<<<<<< + * for i in range(extent): + * memcpy(data, item, itemsize) +*/ + __pyx_t_1 = (__pyx_v_ndim == 1); + if (__pyx_t_1) { + + /* "View.MemoryView":1409 + * + * if ndim == 1: + * for i in range(extent): # <<<<<<<<<<<<<< + * memcpy(data, item, itemsize) + * data += stride +*/ + __pyx_t_2 = __pyx_v_extent; + __pyx_t_3 = __pyx_t_2; + for (__pyx_t_4 = 0; __pyx_t_4 < __pyx_t_3; __pyx_t_4+=1) { + __pyx_v_i = __pyx_t_4; + + /* "View.MemoryView":1410 + * if ndim == 1: + * for i in range(extent): + * memcpy(data, item, itemsize) # <<<<<<<<<<<<<< + * data += stride + * else: +*/ + (void)(memcpy(__pyx_v_data, __pyx_v_item, __pyx_v_itemsize)); + + /* "View.MemoryView":1411 + * for i in range(extent): + * memcpy(data, item, itemsize) + * data += stride # <<<<<<<<<<<<<< + * else: + * for i in range(extent): +*/ + __pyx_v_data = (__pyx_v_data + __pyx_v_stride); + } + + /* "View.MemoryView":1408 + * cdef Py_ssize_t extent = shape[0] + * + * if ndim == 1: # <<<<<<<<<<<<<< + * for i in range(extent): + * memcpy(data, item, itemsize) +*/ + goto __pyx_L3; + } + + /* "View.MemoryView":1413 + * data += stride + * else: + * for i in range(extent): # <<<<<<<<<<<<<< + * _slice_assign_scalar(data, shape + 1, strides + 1, ndim - 1, itemsize, item) + * data += stride +*/ + /*else*/ { + __pyx_t_2 = __pyx_v_extent; + __pyx_t_3 = __pyx_t_2; + for (__pyx_t_4 = 0; __pyx_t_4 < __pyx_t_3; __pyx_t_4+=1) { + __pyx_v_i = __pyx_t_4; + + /* "View.MemoryView":1414 + * else: + * for i in range(extent): + * _slice_assign_scalar(data, shape + 1, strides + 1, ndim - 1, itemsize, item) # <<<<<<<<<<<<<< + * data += stride + * +*/ + __pyx_memoryview__slice_assign_scalar(__pyx_v_data, (__pyx_v_shape + 1), (__pyx_v_strides + 1), (__pyx_v_ndim - 1), __pyx_v_itemsize, __pyx_v_item); + + /* "View.MemoryView":1415 + * for i in range(extent): + * _slice_assign_scalar(data, shape + 1, strides + 1, ndim - 1, itemsize, item) + * data += stride # <<<<<<<<<<<<<< + * +*/ + __pyx_v_data = (__pyx_v_data + __pyx_v_stride); + } + } + __pyx_L3:; + + /* "View.MemoryView":1400 + * + * + * @cname('__pyx_memoryview__slice_assign_scalar') # <<<<<<<<<<<<<< + * cdef void _slice_assign_scalar(char *data, Py_ssize_t *shape, + * Py_ssize_t *strides, int ndim, +*/ + + /* function exit code */ +} + +/* "(tree fragment)":4 + * int __Pyx_CheckUnpickleChecksum(long, long, long, long, const char*) except -1 + * int __Pyx_UpdateUnpickledDict(object, object, Py_ssize_t) except -1 + * def __pyx_unpickle_Enum(__pyx_type, long __pyx_checksum, tuple __pyx_state): # <<<<<<<<<<<<<< + * cdef object __pyx_result + * __Pyx_CheckUnpickleChecksum(__pyx_checksum, 0x82a3537, 0x6ae9995, 0xb068931, b'name') +*/ + +/* Python wrapper */ +static PyObject *__pyx_pw_15View_dot_MemoryView_1__pyx_unpickle_Enum(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*/ +static PyMethodDef __pyx_mdef_15View_dot_MemoryView_1__pyx_unpickle_Enum = {"__pyx_unpickle_Enum", (PyCFunction)(void(*)(void))(__Pyx_PyCFunction_FastCallWithKeywords)__pyx_pw_15View_dot_MemoryView_1__pyx_unpickle_Enum, __Pyx_METH_FASTCALL|METH_KEYWORDS, 0}; +static PyObject *__pyx_pw_15View_dot_MemoryView_1__pyx_unpickle_Enum(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 +) { + PyObject *__pyx_v___pyx_type = 0; + long __pyx_v___pyx_checksum; + 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[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("__pyx_unpickle_Enum (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_type,&__pyx_mstate_global->__pyx_n_u_pyx_checksum,&__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, 4, __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(1, 4, __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(1, 4, __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(1, 4, __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, "__pyx_unpickle_Enum", 0) < (0)) __PYX_ERR(1, 4, __pyx_L3_error) + for (Py_ssize_t i = __pyx_nargs; i < 3; i++) { + if (unlikely(!values[i])) { __Pyx_RaiseArgtupleInvalid("__pyx_unpickle_Enum", 1, 3, 3, i); __PYX_ERR(1, 4, __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(1, 4, __pyx_L3_error) + values[1] = __Pyx_ArgRef_FASTCALL(__pyx_args, 1); + if (!CYTHON_ASSUME_SAFE_MACROS && unlikely(!values[1])) __PYX_ERR(1, 4, __pyx_L3_error) + values[2] = __Pyx_ArgRef_FASTCALL(__pyx_args, 2); + if (!CYTHON_ASSUME_SAFE_MACROS && unlikely(!values[2])) __PYX_ERR(1, 4, __pyx_L3_error) + } + __pyx_v___pyx_type = values[0]; + __pyx_v___pyx_checksum = __Pyx_PyLong_As_long(values[1]); if (unlikely((__pyx_v___pyx_checksum == (long)-1) && PyErr_Occurred())) __PYX_ERR(1, 4, __pyx_L3_error) + __pyx_v___pyx_state = ((PyObject*)values[2]); + } + goto __pyx_L6_skip; + __pyx_L5_argtuple_error:; + __Pyx_RaiseArgtupleInvalid("__pyx_unpickle_Enum", 1, 3, 3, __pyx_nargs); __PYX_ERR(1, 4, __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("View.MemoryView.__pyx_unpickle_Enum", __pyx_clineno, __pyx_lineno, __pyx_filename); + __Pyx_RefNannyFinishContext(); + return NULL; + __pyx_L4_argument_unpacking_done:; + if (unlikely(!__Pyx_ArgTypeTest(((PyObject *)__pyx_v___pyx_state), (&PyTuple_Type), 1, "__pyx_state", 1))) __PYX_ERR(1, 4, __pyx_L1_error) + __pyx_r = __pyx_pf_15View_dot_MemoryView___pyx_unpickle_Enum(__pyx_self, __pyx_v___pyx_type, __pyx_v___pyx_checksum, __pyx_v___pyx_state); + + /* 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_15View_dot_MemoryView___pyx_unpickle_Enum(CYTHON_UNUSED PyObject *__pyx_self, PyObject *__pyx_v___pyx_type, long __pyx_v___pyx_checksum, PyObject *__pyx_v___pyx_state) { + PyObject *__pyx_v___pyx_result = 0; + 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_t_5; + int __pyx_lineno = 0; + const char *__pyx_filename = NULL; + int __pyx_clineno = 0; + __Pyx_RefNannySetupContext("__pyx_unpickle_Enum", 0); + + /* "(tree fragment)":6 + * def __pyx_unpickle_Enum(__pyx_type, long __pyx_checksum, tuple __pyx_state): + * cdef object __pyx_result + * __Pyx_CheckUnpickleChecksum(__pyx_checksum, 0x82a3537, 0x6ae9995, 0xb068931, b'name') # <<<<<<<<<<<<<< + * __pyx_result = Enum.__new__(__pyx_type) + * if __pyx_state is not None: +*/ + __pyx_t_1 = __Pyx_CheckUnpickleChecksum(__pyx_v___pyx_checksum, 0x82a3537, 0x6ae9995, 0xb068931, ((char const *)"name")); if (unlikely(__pyx_t_1 == ((int)-1))) __PYX_ERR(1, 6, __pyx_L1_error) + + /* "(tree fragment)":7 + * cdef object __pyx_result + * __Pyx_CheckUnpickleChecksum(__pyx_checksum, 0x82a3537, 0x6ae9995, 0xb068931, b'name') + * __pyx_result = Enum.__new__(__pyx_type) # <<<<<<<<<<<<<< + * if __pyx_state is not None: + * __pyx_unpickle_Enum__set_state( __pyx_result, __pyx_state) +*/ + __pyx_t_3 = ((PyObject *)__pyx_mstate_global->__pyx_MemviewEnum_type); + __Pyx_INCREF(__pyx_t_3); + __pyx_t_4 = 0; + { + PyObject *__pyx_callargs[2] = {__pyx_t_3, __pyx_v___pyx_type}; + __pyx_t_2 = __Pyx_PyObject_FastCallMethod((PyObject*)__pyx_mstate_global->__pyx_n_u_new, __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_2)) __PYX_ERR(1, 7, __pyx_L1_error) + __Pyx_GOTREF(__pyx_t_2); + } + __pyx_v___pyx_result = __pyx_t_2; + __pyx_t_2 = 0; + + /* "(tree fragment)":8 + * __Pyx_CheckUnpickleChecksum(__pyx_checksum, 0x82a3537, 0x6ae9995, 0xb068931, b'name') + * __pyx_result = Enum.__new__(__pyx_type) + * if __pyx_state is not None: # <<<<<<<<<<<<<< + * __pyx_unpickle_Enum__set_state( __pyx_result, __pyx_state) + * return __pyx_result +*/ + __pyx_t_5 = (__pyx_v___pyx_state != ((PyObject*)Py_None)); + if (__pyx_t_5) { + + /* "(tree fragment)":9 + * __pyx_result = Enum.__new__(__pyx_type) + * if __pyx_state is not None: + * __pyx_unpickle_Enum__set_state( __pyx_result, __pyx_state) # <<<<<<<<<<<<<< + * return __pyx_result + * cdef __pyx_unpickle_Enum__set_state(Enum __pyx_result, __pyx_state: tuple): +*/ + if (unlikely(__pyx_v___pyx_state == Py_None)) { + PyErr_SetString(PyExc_TypeError, "cannot pass None into a C function argument that is declared 'not None'"); + __PYX_ERR(1, 9, __pyx_L1_error) + } + __pyx_t_2 = __pyx_unpickle_Enum__set_state(((struct __pyx_MemviewEnum_obj *)__pyx_v___pyx_result), __pyx_v___pyx_state); if (unlikely(!__pyx_t_2)) __PYX_ERR(1, 9, __pyx_L1_error) + __Pyx_GOTREF(__pyx_t_2); + __Pyx_DECREF(__pyx_t_2); __pyx_t_2 = 0; + + /* "(tree fragment)":8 + * __Pyx_CheckUnpickleChecksum(__pyx_checksum, 0x82a3537, 0x6ae9995, 0xb068931, b'name') + * __pyx_result = Enum.__new__(__pyx_type) + * if __pyx_state is not None: # <<<<<<<<<<<<<< + * __pyx_unpickle_Enum__set_state( __pyx_result, __pyx_state) + * return __pyx_result +*/ + } + + /* "(tree fragment)":10 + * if __pyx_state is not None: + * __pyx_unpickle_Enum__set_state( __pyx_result, __pyx_state) + * return __pyx_result # <<<<<<<<<<<<<< + * cdef __pyx_unpickle_Enum__set_state(Enum __pyx_result, __pyx_state: tuple): + * __pyx_result.name = __pyx_state[0] +*/ + __Pyx_XDECREF(__pyx_r); + __Pyx_INCREF(__pyx_v___pyx_result); + __pyx_r = __pyx_v___pyx_result; + goto __pyx_L0; + + /* "(tree fragment)":4 + * int __Pyx_CheckUnpickleChecksum(long, long, long, long, const char*) except -1 + * int __Pyx_UpdateUnpickledDict(object, object, Py_ssize_t) except -1 + * def __pyx_unpickle_Enum(__pyx_type, long __pyx_checksum, tuple __pyx_state): # <<<<<<<<<<<<<< + * cdef object __pyx_result + * __Pyx_CheckUnpickleChecksum(__pyx_checksum, 0x82a3537, 0x6ae9995, 0xb068931, b'name') +*/ + + /* function exit code */ + __pyx_L1_error:; + __Pyx_XDECREF(__pyx_t_2); + __Pyx_XDECREF(__pyx_t_3); + __Pyx_AddTraceback("View.MemoryView.__pyx_unpickle_Enum", __pyx_clineno, __pyx_lineno, __pyx_filename); + __pyx_r = NULL; + __pyx_L0:; + __Pyx_XDECREF(__pyx_v___pyx_result); + __Pyx_XGIVEREF(__pyx_r); + __Pyx_RefNannyFinishContext(); + return __pyx_r; +} + +/* "(tree fragment)":11 + * __pyx_unpickle_Enum__set_state( __pyx_result, __pyx_state) + * return __pyx_result + * cdef __pyx_unpickle_Enum__set_state(Enum __pyx_result, __pyx_state: tuple): # <<<<<<<<<<<<<< + * __pyx_result.name = __pyx_state[0] + * __Pyx_UpdateUnpickledDict(__pyx_result, __pyx_state, 1) +*/ + +static PyObject *__pyx_unpickle_Enum__set_state(struct __pyx_MemviewEnum_obj *__pyx_v___pyx_result, PyObject *__pyx_v___pyx_state) { + PyObject *__pyx_r = NULL; + __Pyx_RefNannyDeclarations + PyObject *__pyx_t_1 = NULL; + int __pyx_t_2; + int __pyx_lineno = 0; + const char *__pyx_filename = NULL; + int __pyx_clineno = 0; + __Pyx_RefNannySetupContext("__pyx_unpickle_Enum__set_state", 0); + + /* "(tree fragment)":12 + * return __pyx_result + * cdef __pyx_unpickle_Enum__set_state(Enum __pyx_result, __pyx_state: tuple): + * __pyx_result.name = __pyx_state[0] # <<<<<<<<<<<<<< + * __Pyx_UpdateUnpickledDict(__pyx_result, __pyx_state, 1) +*/ + __pyx_t_1 = __Pyx_GetItemInt_Tuple(__pyx_v___pyx_state, 0, long, 1, __Pyx_PyLong_From_long, 0, 0, 1, 1, __Pyx_ReferenceSharing_FunctionArgument); if (unlikely(!__pyx_t_1)) __PYX_ERR(1, 12, __pyx_L1_error) + __Pyx_GOTREF(__pyx_t_1); + __Pyx_GIVEREF(__pyx_t_1); + __Pyx_GOTREF(__pyx_v___pyx_result->name); + __Pyx_DECREF(__pyx_v___pyx_result->name); + __pyx_v___pyx_result->name = __pyx_t_1; + __pyx_t_1 = 0; + + /* "(tree fragment)":13 + * cdef __pyx_unpickle_Enum__set_state(Enum __pyx_result, __pyx_state: tuple): + * __pyx_result.name = __pyx_state[0] + * __Pyx_UpdateUnpickledDict(__pyx_result, __pyx_state, 1) # <<<<<<<<<<<<<< +*/ + __pyx_t_2 = __Pyx_UpdateUnpickledDict(((PyObject *)__pyx_v___pyx_result), __pyx_v___pyx_state, 1); if (unlikely(__pyx_t_2 == ((int)-1))) __PYX_ERR(1, 13, __pyx_L1_error) + + /* "(tree fragment)":11 + * __pyx_unpickle_Enum__set_state( __pyx_result, __pyx_state) + * return __pyx_result + * cdef __pyx_unpickle_Enum__set_state(Enum __pyx_result, __pyx_state: tuple): # <<<<<<<<<<<<<< + * __pyx_result.name = __pyx_state[0] + * __Pyx_UpdateUnpickledDict(__pyx_result, __pyx_state, 1) +*/ + + /* function exit code */ + __pyx_r = Py_None; __Pyx_INCREF(Py_None); + goto __pyx_L0; + __pyx_L1_error:; + __Pyx_XDECREF(__pyx_t_1); + __Pyx_AddTraceback("View.MemoryView.__pyx_unpickle_Enum__set_state", __pyx_clineno, __pyx_lineno, __pyx_filename); + __pyx_r = 0; + __pyx_L0:; + __Pyx_XGIVEREF(__pyx_r); + __Pyx_RefNannyFinishContext(); + return __pyx_r; +} + +/* "C:/Users/runneradmin/AppData/Local/Temp/build-env-ej_q3m8u/Lib/site-packages/numpy/__init__.cython-30.pxd":242 + * cdef int type_num + * + * @property # <<<<<<<<<<<<<< + * cdef inline npy_intp itemsize(self) noexcept nogil: + * return PyDataType_ELSIZE(self) +*/ + +static CYTHON_INLINE npy_intp __pyx_f_5numpy_5dtype_8itemsize_itemsize(PyArray_Descr *__pyx_v_self) { + npy_intp __pyx_r; + + /* "C:/Users/runneradmin/AppData/Local/Temp/build-env-ej_q3m8u/Lib/site-packages/numpy/__init__.cython-30.pxd":244 + * @property + * cdef inline npy_intp itemsize(self) noexcept nogil: + * return PyDataType_ELSIZE(self) # <<<<<<<<<<<<<< + * + * @property +*/ + __pyx_r = PyDataType_ELSIZE(__pyx_v_self); + goto __pyx_L0; + + /* "C:/Users/runneradmin/AppData/Local/Temp/build-env-ej_q3m8u/Lib/site-packages/numpy/__init__.cython-30.pxd":242 + * cdef int type_num + * + * @property # <<<<<<<<<<<<<< + * cdef inline npy_intp itemsize(self) noexcept nogil: + * return PyDataType_ELSIZE(self) +*/ + + /* function exit code */ + __pyx_L0:; + return __pyx_r; +} + +/* "C:/Users/runneradmin/AppData/Local/Temp/build-env-ej_q3m8u/Lib/site-packages/numpy/__init__.cython-30.pxd":246 + * return PyDataType_ELSIZE(self) + * + * @property # <<<<<<<<<<<<<< + * cdef inline npy_intp alignment(self) noexcept nogil: + * return PyDataType_ALIGNMENT(self) +*/ + +static CYTHON_INLINE npy_intp __pyx_f_5numpy_5dtype_9alignment_alignment(PyArray_Descr *__pyx_v_self) { + npy_intp __pyx_r; + + /* "C:/Users/runneradmin/AppData/Local/Temp/build-env-ej_q3m8u/Lib/site-packages/numpy/__init__.cython-30.pxd":248 + * @property + * cdef inline npy_intp alignment(self) noexcept nogil: + * return PyDataType_ALIGNMENT(self) # <<<<<<<<<<<<<< + * + * # Use fields/names with care as they may be NULL. You must check +*/ + __pyx_r = PyDataType_ALIGNMENT(__pyx_v_self); + goto __pyx_L0; + + /* "C:/Users/runneradmin/AppData/Local/Temp/build-env-ej_q3m8u/Lib/site-packages/numpy/__init__.cython-30.pxd":246 + * return PyDataType_ELSIZE(self) + * + * @property # <<<<<<<<<<<<<< + * cdef inline npy_intp alignment(self) noexcept nogil: + * return PyDataType_ALIGNMENT(self) +*/ + + /* function exit code */ + __pyx_L0:; + return __pyx_r; +} + +/* "C:/Users/runneradmin/AppData/Local/Temp/build-env-ej_q3m8u/Lib/site-packages/numpy/__init__.cython-30.pxd":252 + * # Use fields/names with care as they may be NULL. You must check + * # for this using PyDataType_HASFIELDS. + * @property # <<<<<<<<<<<<<< + * cdef inline object fields(self): + * return PyDataType_FIELDS(self) +*/ + +static CYTHON_INLINE PyObject *__pyx_f_5numpy_5dtype_6fields_fields(PyArray_Descr *__pyx_v_self) { + PyObject *__pyx_r = NULL; + __Pyx_RefNannyDeclarations + PyObject *__pyx_t_1; + __Pyx_RefNannySetupContext("fields", 0); + + /* "C:/Users/runneradmin/AppData/Local/Temp/build-env-ej_q3m8u/Lib/site-packages/numpy/__init__.cython-30.pxd":254 + * @property + * cdef inline object fields(self): + * return PyDataType_FIELDS(self) # <<<<<<<<<<<<<< + * + * @property +*/ + __Pyx_XDECREF(__pyx_r); + __pyx_t_1 = PyDataType_FIELDS(__pyx_v_self); + __Pyx_INCREF(((PyObject *)__pyx_t_1)); + __pyx_r = ((PyObject *)__pyx_t_1); + goto __pyx_L0; + + /* "C:/Users/runneradmin/AppData/Local/Temp/build-env-ej_q3m8u/Lib/site-packages/numpy/__init__.cython-30.pxd":252 + * # Use fields/names with care as they may be NULL. You must check + * # for this using PyDataType_HASFIELDS. + * @property # <<<<<<<<<<<<<< + * cdef inline object fields(self): + * return PyDataType_FIELDS(self) +*/ + + /* function exit code */ + __pyx_L0:; + __Pyx_XGIVEREF(__pyx_r); + __Pyx_RefNannyFinishContext(); + return __pyx_r; +} + +/* "C:/Users/runneradmin/AppData/Local/Temp/build-env-ej_q3m8u/Lib/site-packages/numpy/__init__.cython-30.pxd":256 + * return PyDataType_FIELDS(self) + * + * @property # <<<<<<<<<<<<<< + * cdef inline tuple names(self): + * return PyDataType_NAMES(self) +*/ + +static CYTHON_INLINE PyObject *__pyx_f_5numpy_5dtype_5names_names(PyArray_Descr *__pyx_v_self) { + PyObject *__pyx_r = NULL; + __Pyx_RefNannyDeclarations + PyObject *__pyx_t_1; + __Pyx_RefNannySetupContext("names", 0); + + /* "C:/Users/runneradmin/AppData/Local/Temp/build-env-ej_q3m8u/Lib/site-packages/numpy/__init__.cython-30.pxd":258 + * @property + * cdef inline tuple names(self): + * return PyDataType_NAMES(self) # <<<<<<<<<<<<<< + * + * # Use PyDataType_HASSUBARRAY to test whether this field is +*/ + __Pyx_XDECREF(__pyx_r); + __pyx_t_1 = PyDataType_NAMES(__pyx_v_self); + __Pyx_INCREF(((PyObject*)__pyx_t_1)); + __pyx_r = ((PyObject*)__pyx_t_1); + goto __pyx_L0; + + /* "C:/Users/runneradmin/AppData/Local/Temp/build-env-ej_q3m8u/Lib/site-packages/numpy/__init__.cython-30.pxd":256 + * return PyDataType_FIELDS(self) + * + * @property # <<<<<<<<<<<<<< + * cdef inline tuple names(self): + * return PyDataType_NAMES(self) +*/ + + /* function exit code */ + __pyx_L0:; + __Pyx_XGIVEREF(__pyx_r); + __Pyx_RefNannyFinishContext(); + return __pyx_r; +} + +/* "C:/Users/runneradmin/AppData/Local/Temp/build-env-ej_q3m8u/Lib/site-packages/numpy/__init__.cython-30.pxd":263 + * # valid (the pointer can be NULL). Most users should access + * # this field via the inline helper method PyDataType_SHAPE. + * @property # <<<<<<<<<<<<<< + * cdef inline PyArray_ArrayDescr* subarray(self) noexcept nogil: + * return PyDataType_SUBARRAY(self) +*/ + +static CYTHON_INLINE PyArray_ArrayDescr *__pyx_f_5numpy_5dtype_8subarray_subarray(PyArray_Descr *__pyx_v_self) { + PyArray_ArrayDescr *__pyx_r; + + /* "C:/Users/runneradmin/AppData/Local/Temp/build-env-ej_q3m8u/Lib/site-packages/numpy/__init__.cython-30.pxd":265 + * @property + * cdef inline PyArray_ArrayDescr* subarray(self) noexcept nogil: + * return PyDataType_SUBARRAY(self) # <<<<<<<<<<<<<< + * + * @property +*/ + __pyx_r = PyDataType_SUBARRAY(__pyx_v_self); + goto __pyx_L0; + + /* "C:/Users/runneradmin/AppData/Local/Temp/build-env-ej_q3m8u/Lib/site-packages/numpy/__init__.cython-30.pxd":263 + * # valid (the pointer can be NULL). Most users should access + * # this field via the inline helper method PyDataType_SHAPE. + * @property # <<<<<<<<<<<<<< + * cdef inline PyArray_ArrayDescr* subarray(self) noexcept nogil: + * return PyDataType_SUBARRAY(self) +*/ + + /* function exit code */ + __pyx_L0:; + return __pyx_r; +} + +/* "C:/Users/runneradmin/AppData/Local/Temp/build-env-ej_q3m8u/Lib/site-packages/numpy/__init__.cython-30.pxd":267 + * return PyDataType_SUBARRAY(self) + * + * @property # <<<<<<<<<<<<<< + * cdef inline npy_uint64 flags(self) noexcept nogil: + * """The data types flags.""" +*/ + +static CYTHON_INLINE npy_uint64 __pyx_f_5numpy_5dtype_5flags_flags(PyArray_Descr *__pyx_v_self) { + npy_uint64 __pyx_r; + + /* "C:/Users/runneradmin/AppData/Local/Temp/build-env-ej_q3m8u/Lib/site-packages/numpy/__init__.cython-30.pxd":270 + * cdef inline npy_uint64 flags(self) noexcept nogil: + * """The data types flags.""" + * return PyDataType_FLAGS(self) # <<<<<<<<<<<<<< + * + * +*/ + __pyx_r = PyDataType_FLAGS(__pyx_v_self); + goto __pyx_L0; + + /* "C:/Users/runneradmin/AppData/Local/Temp/build-env-ej_q3m8u/Lib/site-packages/numpy/__init__.cython-30.pxd":267 + * return PyDataType_SUBARRAY(self) + * + * @property # <<<<<<<<<<<<<< + * cdef inline npy_uint64 flags(self) noexcept nogil: + * """The data types flags.""" +*/ + + /* function exit code */ + __pyx_L0:; + return __pyx_r; +} + +/* "C:/Users/runneradmin/AppData/Local/Temp/build-env-ej_q3m8u/Lib/site-packages/numpy/__init__.cython-30.pxd":279 + * ctypedef class numpy.broadcast [object PyArrayMultiIterObject, check_size ignore]: + * + * @property # <<<<<<<<<<<<<< + * cdef inline int numiter(self) noexcept nogil: + * """The number of arrays that need to be broadcast to the same shape.""" +*/ + +static CYTHON_INLINE int __pyx_f_5numpy_9broadcast_7numiter_numiter(PyArrayMultiIterObject *__pyx_v_self) { + int __pyx_r; + + /* "C:/Users/runneradmin/AppData/Local/Temp/build-env-ej_q3m8u/Lib/site-packages/numpy/__init__.cython-30.pxd":282 + * cdef inline int numiter(self) noexcept nogil: + * """The number of arrays that need to be broadcast to the same shape.""" + * return PyArray_MultiIter_NUMITER(self) # <<<<<<<<<<<<<< + * + * @property +*/ + __pyx_r = PyArray_MultiIter_NUMITER(__pyx_v_self); + goto __pyx_L0; + + /* "C:/Users/runneradmin/AppData/Local/Temp/build-env-ej_q3m8u/Lib/site-packages/numpy/__init__.cython-30.pxd":279 + * ctypedef class numpy.broadcast [object PyArrayMultiIterObject, check_size ignore]: + * + * @property # <<<<<<<<<<<<<< + * cdef inline int numiter(self) noexcept nogil: + * """The number of arrays that need to be broadcast to the same shape.""" +*/ + + /* function exit code */ + __pyx_L0:; + return __pyx_r; +} + +/* "C:/Users/runneradmin/AppData/Local/Temp/build-env-ej_q3m8u/Lib/site-packages/numpy/__init__.cython-30.pxd":284 + * return PyArray_MultiIter_NUMITER(self) + * + * @property # <<<<<<<<<<<<<< + * cdef inline npy_intp size(self) noexcept nogil: + * """The total broadcasted size.""" +*/ + +static CYTHON_INLINE npy_intp __pyx_f_5numpy_9broadcast_4size_size(PyArrayMultiIterObject *__pyx_v_self) { + npy_intp __pyx_r; + + /* "C:/Users/runneradmin/AppData/Local/Temp/build-env-ej_q3m8u/Lib/site-packages/numpy/__init__.cython-30.pxd":287 + * cdef inline npy_intp size(self) noexcept nogil: + * """The total broadcasted size.""" + * return PyArray_MultiIter_SIZE(self) # <<<<<<<<<<<<<< + * + * @property +*/ + __pyx_r = PyArray_MultiIter_SIZE(__pyx_v_self); + goto __pyx_L0; + + /* "C:/Users/runneradmin/AppData/Local/Temp/build-env-ej_q3m8u/Lib/site-packages/numpy/__init__.cython-30.pxd":284 + * return PyArray_MultiIter_NUMITER(self) + * + * @property # <<<<<<<<<<<<<< + * cdef inline npy_intp size(self) noexcept nogil: + * """The total broadcasted size.""" +*/ + + /* function exit code */ + __pyx_L0:; + return __pyx_r; +} + +/* "C:/Users/runneradmin/AppData/Local/Temp/build-env-ej_q3m8u/Lib/site-packages/numpy/__init__.cython-30.pxd":289 + * return PyArray_MultiIter_SIZE(self) + * + * @property # <<<<<<<<<<<<<< + * cdef inline npy_intp index(self) noexcept nogil: + * """The current (1-d) index into the broadcasted result.""" +*/ + +static CYTHON_INLINE npy_intp __pyx_f_5numpy_9broadcast_5index_index(PyArrayMultiIterObject *__pyx_v_self) { + npy_intp __pyx_r; + + /* "C:/Users/runneradmin/AppData/Local/Temp/build-env-ej_q3m8u/Lib/site-packages/numpy/__init__.cython-30.pxd":292 + * cdef inline npy_intp index(self) noexcept nogil: + * """The current (1-d) index into the broadcasted result.""" + * return PyArray_MultiIter_INDEX(self) # <<<<<<<<<<<<<< + * + * @property +*/ + __pyx_r = PyArray_MultiIter_INDEX(__pyx_v_self); + goto __pyx_L0; + + /* "C:/Users/runneradmin/AppData/Local/Temp/build-env-ej_q3m8u/Lib/site-packages/numpy/__init__.cython-30.pxd":289 + * return PyArray_MultiIter_SIZE(self) + * + * @property # <<<<<<<<<<<<<< + * cdef inline npy_intp index(self) noexcept nogil: + * """The current (1-d) index into the broadcasted result.""" +*/ + + /* function exit code */ + __pyx_L0:; + return __pyx_r; +} + +/* "C:/Users/runneradmin/AppData/Local/Temp/build-env-ej_q3m8u/Lib/site-packages/numpy/__init__.cython-30.pxd":294 + * return PyArray_MultiIter_INDEX(self) + * + * @property # <<<<<<<<<<<<<< + * cdef inline int nd(self) noexcept nogil: + * """The number of dimensions in the broadcasted result.""" +*/ + +static CYTHON_INLINE int __pyx_f_5numpy_9broadcast_2nd_nd(PyArrayMultiIterObject *__pyx_v_self) { + int __pyx_r; + + /* "C:/Users/runneradmin/AppData/Local/Temp/build-env-ej_q3m8u/Lib/site-packages/numpy/__init__.cython-30.pxd":297 + * cdef inline int nd(self) noexcept nogil: + * """The number of dimensions in the broadcasted result.""" + * return PyArray_MultiIter_NDIM(self) # <<<<<<<<<<<<<< + * + * @property +*/ + __pyx_r = PyArray_MultiIter_NDIM(__pyx_v_self); + goto __pyx_L0; + + /* "C:/Users/runneradmin/AppData/Local/Temp/build-env-ej_q3m8u/Lib/site-packages/numpy/__init__.cython-30.pxd":294 + * return PyArray_MultiIter_INDEX(self) + * + * @property # <<<<<<<<<<<<<< + * cdef inline int nd(self) noexcept nogil: + * """The number of dimensions in the broadcasted result.""" +*/ + + /* function exit code */ + __pyx_L0:; + return __pyx_r; +} + +/* "C:/Users/runneradmin/AppData/Local/Temp/build-env-ej_q3m8u/Lib/site-packages/numpy/__init__.cython-30.pxd":299 + * return PyArray_MultiIter_NDIM(self) + * + * @property # <<<<<<<<<<<<<< + * cdef inline npy_intp* dimensions(self) noexcept nogil: + * """The shape of the broadcasted result.""" +*/ + +static CYTHON_INLINE npy_intp *__pyx_f_5numpy_9broadcast_10dimensions_dimensions(PyArrayMultiIterObject *__pyx_v_self) { + npy_intp *__pyx_r; + + /* "C:/Users/runneradmin/AppData/Local/Temp/build-env-ej_q3m8u/Lib/site-packages/numpy/__init__.cython-30.pxd":302 + * cdef inline npy_intp* dimensions(self) noexcept nogil: + * """The shape of the broadcasted result.""" + * return PyArray_MultiIter_DIMS(self) # <<<<<<<<<<<<<< + * + * @property +*/ + __pyx_r = PyArray_MultiIter_DIMS(__pyx_v_self); + goto __pyx_L0; + + /* "C:/Users/runneradmin/AppData/Local/Temp/build-env-ej_q3m8u/Lib/site-packages/numpy/__init__.cython-30.pxd":299 + * return PyArray_MultiIter_NDIM(self) + * + * @property # <<<<<<<<<<<<<< + * cdef inline npy_intp* dimensions(self) noexcept nogil: + * """The shape of the broadcasted result.""" +*/ + + /* function exit code */ + __pyx_L0:; + return __pyx_r; +} + +/* "C:/Users/runneradmin/AppData/Local/Temp/build-env-ej_q3m8u/Lib/site-packages/numpy/__init__.cython-30.pxd":304 + * return PyArray_MultiIter_DIMS(self) + * + * @property # <<<<<<<<<<<<<< + * cdef inline void** iters(self) noexcept nogil: + * """An array of iterator objects that holds the iterators for the arrays to be broadcast together. +*/ + +static CYTHON_INLINE void **__pyx_f_5numpy_9broadcast_5iters_iters(PyArrayMultiIterObject *__pyx_v_self) { + void **__pyx_r; + + /* "C:/Users/runneradmin/AppData/Local/Temp/build-env-ej_q3m8u/Lib/site-packages/numpy/__init__.cython-30.pxd":308 + * """An array of iterator objects that holds the iterators for the arrays to be broadcast together. + * On return, the iterators are adjusted for broadcasting.""" + * return PyArray_MultiIter_ITERS(self) # <<<<<<<<<<<<<< + * + * +*/ + __pyx_r = PyArray_MultiIter_ITERS(__pyx_v_self); + goto __pyx_L0; + + /* "C:/Users/runneradmin/AppData/Local/Temp/build-env-ej_q3m8u/Lib/site-packages/numpy/__init__.cython-30.pxd":304 + * return PyArray_MultiIter_DIMS(self) + * + * @property # <<<<<<<<<<<<<< + * cdef inline void** iters(self) noexcept nogil: + * """An array of iterator objects that holds the iterators for the arrays to be broadcast together. +*/ + + /* function exit code */ + __pyx_L0:; + return __pyx_r; +} + +/* "C:/Users/runneradmin/AppData/Local/Temp/build-env-ej_q3m8u/Lib/site-packages/numpy/__init__.cython-30.pxd":322 + * # Instead, we use properties that map to the corresponding C-API functions. + * + * @property # <<<<<<<<<<<<<< + * cdef inline PyObject* base(self) noexcept nogil: + * """Returns a borrowed reference to the object owning the data/memory. +*/ + +static CYTHON_INLINE PyObject *__pyx_f_5numpy_7ndarray_4base_base(PyArrayObject *__pyx_v_self) { + PyObject *__pyx_r; + + /* "C:/Users/runneradmin/AppData/Local/Temp/build-env-ej_q3m8u/Lib/site-packages/numpy/__init__.cython-30.pxd":326 + * """Returns a borrowed reference to the object owning the data/memory. + * """ + * return PyArray_BASE(self) # <<<<<<<<<<<<<< + * + * @property +*/ + __pyx_r = PyArray_BASE(__pyx_v_self); + goto __pyx_L0; + + /* "C:/Users/runneradmin/AppData/Local/Temp/build-env-ej_q3m8u/Lib/site-packages/numpy/__init__.cython-30.pxd":322 + * # Instead, we use properties that map to the corresponding C-API functions. + * + * @property # <<<<<<<<<<<<<< + * cdef inline PyObject* base(self) noexcept nogil: + * """Returns a borrowed reference to the object owning the data/memory. +*/ + + /* function exit code */ + __pyx_L0:; + return __pyx_r; +} + +/* "C:/Users/runneradmin/AppData/Local/Temp/build-env-ej_q3m8u/Lib/site-packages/numpy/__init__.cython-30.pxd":328 + * return PyArray_BASE(self) + * + * @property # <<<<<<<<<<<<<< + * cdef inline dtype descr(self): + * """Returns an owned reference to the dtype of the array. +*/ + +static CYTHON_INLINE PyArray_Descr *__pyx_f_5numpy_7ndarray_5descr_descr(PyArrayObject *__pyx_v_self) { + PyArray_Descr *__pyx_r = NULL; + __Pyx_RefNannyDeclarations + PyArray_Descr *__pyx_t_1; + __Pyx_RefNannySetupContext("descr", 0); + + /* "C:/Users/runneradmin/AppData/Local/Temp/build-env-ej_q3m8u/Lib/site-packages/numpy/__init__.cython-30.pxd":332 + * """Returns an owned reference to the dtype of the array. + * """ + * return PyArray_DESCR(self) # <<<<<<<<<<<<<< + * + * @property +*/ + __Pyx_XDECREF((PyObject *)__pyx_r); + __pyx_t_1 = PyArray_DESCR(__pyx_v_self); + __Pyx_INCREF((PyObject *)((PyArray_Descr *)__pyx_t_1)); + __pyx_r = ((PyArray_Descr *)__pyx_t_1); + goto __pyx_L0; + + /* "C:/Users/runneradmin/AppData/Local/Temp/build-env-ej_q3m8u/Lib/site-packages/numpy/__init__.cython-30.pxd":328 + * return PyArray_BASE(self) + * + * @property # <<<<<<<<<<<<<< + * cdef inline dtype descr(self): + * """Returns an owned reference to the dtype of the array. +*/ + + /* function exit code */ + __pyx_L0:; + __Pyx_XGIVEREF((PyObject *)__pyx_r); + __Pyx_RefNannyFinishContext(); + return __pyx_r; +} + +/* "C:/Users/runneradmin/AppData/Local/Temp/build-env-ej_q3m8u/Lib/site-packages/numpy/__init__.cython-30.pxd":334 + * return PyArray_DESCR(self) + * + * @property # <<<<<<<<<<<<<< + * cdef inline int ndim(self) noexcept nogil: + * """Returns the number of dimensions in the array. +*/ + +static CYTHON_INLINE int __pyx_f_5numpy_7ndarray_4ndim_ndim(PyArrayObject *__pyx_v_self) { + int __pyx_r; + + /* "C:/Users/runneradmin/AppData/Local/Temp/build-env-ej_q3m8u/Lib/site-packages/numpy/__init__.cython-30.pxd":338 + * """Returns the number of dimensions in the array. + * """ + * return PyArray_NDIM(self) # <<<<<<<<<<<<<< + * + * @property +*/ + __pyx_r = PyArray_NDIM(__pyx_v_self); + goto __pyx_L0; + + /* "C:/Users/runneradmin/AppData/Local/Temp/build-env-ej_q3m8u/Lib/site-packages/numpy/__init__.cython-30.pxd":334 + * return PyArray_DESCR(self) + * + * @property # <<<<<<<<<<<<<< + * cdef inline int ndim(self) noexcept nogil: + * """Returns the number of dimensions in the array. +*/ + + /* function exit code */ + __pyx_L0:; + return __pyx_r; +} + +/* "C:/Users/runneradmin/AppData/Local/Temp/build-env-ej_q3m8u/Lib/site-packages/numpy/__init__.cython-30.pxd":340 + * return PyArray_NDIM(self) + * + * @property # <<<<<<<<<<<<<< + * cdef inline npy_intp *shape(self) noexcept nogil: + * """Returns a pointer to the dimensions/shape of the array. +*/ + +static CYTHON_INLINE npy_intp *__pyx_f_5numpy_7ndarray_5shape_shape(PyArrayObject *__pyx_v_self) { + npy_intp *__pyx_r; + + /* "C:/Users/runneradmin/AppData/Local/Temp/build-env-ej_q3m8u/Lib/site-packages/numpy/__init__.cython-30.pxd":346 + * Can return NULL for 0-dimensional arrays. + * """ + * return PyArray_DIMS(self) # <<<<<<<<<<<<<< + * + * @property +*/ + __pyx_r = PyArray_DIMS(__pyx_v_self); + goto __pyx_L0; + + /* "C:/Users/runneradmin/AppData/Local/Temp/build-env-ej_q3m8u/Lib/site-packages/numpy/__init__.cython-30.pxd":340 + * return PyArray_NDIM(self) + * + * @property # <<<<<<<<<<<<<< + * cdef inline npy_intp *shape(self) noexcept nogil: + * """Returns a pointer to the dimensions/shape of the array. +*/ + + /* function exit code */ + __pyx_L0:; + return __pyx_r; +} + +/* "C:/Users/runneradmin/AppData/Local/Temp/build-env-ej_q3m8u/Lib/site-packages/numpy/__init__.cython-30.pxd":348 + * return PyArray_DIMS(self) + * + * @property # <<<<<<<<<<<<<< + * cdef inline npy_intp *strides(self) noexcept nogil: + * """Returns a pointer to the strides of the array. +*/ + +static CYTHON_INLINE npy_intp *__pyx_f_5numpy_7ndarray_7strides_strides(PyArrayObject *__pyx_v_self) { + npy_intp *__pyx_r; + + /* "C:/Users/runneradmin/AppData/Local/Temp/build-env-ej_q3m8u/Lib/site-packages/numpy/__init__.cython-30.pxd":353 + * The number of elements matches the number of dimensions of the array (ndim). + * """ + * return PyArray_STRIDES(self) # <<<<<<<<<<<<<< + * + * @property +*/ + __pyx_r = PyArray_STRIDES(__pyx_v_self); + goto __pyx_L0; + + /* "C:/Users/runneradmin/AppData/Local/Temp/build-env-ej_q3m8u/Lib/site-packages/numpy/__init__.cython-30.pxd":348 + * return PyArray_DIMS(self) + * + * @property # <<<<<<<<<<<<<< + * cdef inline npy_intp *strides(self) noexcept nogil: + * """Returns a pointer to the strides of the array. +*/ + + /* function exit code */ + __pyx_L0:; + return __pyx_r; +} + +/* "C:/Users/runneradmin/AppData/Local/Temp/build-env-ej_q3m8u/Lib/site-packages/numpy/__init__.cython-30.pxd":355 + * return PyArray_STRIDES(self) + * + * @property # <<<<<<<<<<<<<< + * cdef inline npy_intp size(self) noexcept nogil: + * """Returns the total size (in number of elements) of the array. +*/ + +static CYTHON_INLINE npy_intp __pyx_f_5numpy_7ndarray_4size_size(PyArrayObject *__pyx_v_self) { + npy_intp __pyx_r; + + /* "C:/Users/runneradmin/AppData/Local/Temp/build-env-ej_q3m8u/Lib/site-packages/numpy/__init__.cython-30.pxd":359 + * """Returns the total size (in number of elements) of the array. + * """ + * return PyArray_SIZE(self) # <<<<<<<<<<<<<< + * + * @property +*/ + __pyx_r = PyArray_SIZE(__pyx_v_self); + goto __pyx_L0; + + /* "C:/Users/runneradmin/AppData/Local/Temp/build-env-ej_q3m8u/Lib/site-packages/numpy/__init__.cython-30.pxd":355 + * return PyArray_STRIDES(self) + * + * @property # <<<<<<<<<<<<<< + * cdef inline npy_intp size(self) noexcept nogil: + * """Returns the total size (in number of elements) of the array. +*/ + + /* function exit code */ + __pyx_L0:; + return __pyx_r; +} + +/* "C:/Users/runneradmin/AppData/Local/Temp/build-env-ej_q3m8u/Lib/site-packages/numpy/__init__.cython-30.pxd":361 + * return PyArray_SIZE(self) + * + * @property # <<<<<<<<<<<<<< + * cdef inline char* data(self) noexcept nogil: + * """The pointer to the data buffer as a char*. +*/ + +static CYTHON_INLINE char *__pyx_f_5numpy_7ndarray_4data_data(PyArrayObject *__pyx_v_self) { + char *__pyx_r; + + /* "C:/Users/runneradmin/AppData/Local/Temp/build-env-ej_q3m8u/Lib/site-packages/numpy/__init__.cython-30.pxd":368 + * of `PyArray_DATA()` instead, which returns a 'void*'. + * """ + * return PyArray_BYTES(self) # <<<<<<<<<<<<<< + * + * +*/ + __pyx_r = PyArray_BYTES(__pyx_v_self); + goto __pyx_L0; + + /* "C:/Users/runneradmin/AppData/Local/Temp/build-env-ej_q3m8u/Lib/site-packages/numpy/__init__.cython-30.pxd":361 + * return PyArray_SIZE(self) + * + * @property # <<<<<<<<<<<<<< + * cdef inline char* data(self) noexcept nogil: + * """The pointer to the data buffer as a char*. +*/ + + /* function exit code */ + __pyx_L0:; + return __pyx_r; +} + +/* "C:/Users/runneradmin/AppData/Local/Temp/build-env-ej_q3m8u/Lib/site-packages/numpy/__init__.cython-30.pxd":776 + * ctypedef long double complex clongdouble_t + * + * cdef inline object PyArray_MultiIterNew1(a): # <<<<<<<<<<<<<< + * return PyArray_MultiIterNew(1, a) + * +*/ + +static CYTHON_INLINE PyObject *__pyx_f_5numpy_PyArray_MultiIterNew1(PyObject *__pyx_v_a) { + PyObject *__pyx_r = NULL; + __Pyx_RefNannyDeclarations + PyObject *__pyx_t_1 = NULL; + int __pyx_lineno = 0; + const char *__pyx_filename = NULL; + int __pyx_clineno = 0; + __Pyx_RefNannySetupContext("PyArray_MultiIterNew1", 0); + + /* "C:/Users/runneradmin/AppData/Local/Temp/build-env-ej_q3m8u/Lib/site-packages/numpy/__init__.cython-30.pxd":777 + * + * cdef inline object PyArray_MultiIterNew1(a): + * return PyArray_MultiIterNew(1, a) # <<<<<<<<<<<<<< + * + * cdef inline object PyArray_MultiIterNew2(a, b): +*/ + __Pyx_XDECREF(__pyx_r); + __pyx_t_1 = PyArray_MultiIterNew(1, ((void *)__pyx_v_a)); if (unlikely(!__pyx_t_1)) __PYX_ERR(2, 777, __pyx_L1_error) + __Pyx_GOTREF(__pyx_t_1); + __pyx_r = __pyx_t_1; + __pyx_t_1 = 0; + goto __pyx_L0; + + /* "C:/Users/runneradmin/AppData/Local/Temp/build-env-ej_q3m8u/Lib/site-packages/numpy/__init__.cython-30.pxd":776 + * ctypedef long double complex clongdouble_t + * + * cdef inline object PyArray_MultiIterNew1(a): # <<<<<<<<<<<<<< + * return PyArray_MultiIterNew(1, a) + * +*/ + + /* function exit code */ + __pyx_L1_error:; + __Pyx_XDECREF(__pyx_t_1); + __Pyx_AddTraceback("numpy.PyArray_MultiIterNew1", __pyx_clineno, __pyx_lineno, __pyx_filename); + __pyx_r = 0; + __pyx_L0:; + __Pyx_XGIVEREF(__pyx_r); + __Pyx_RefNannyFinishContext(); + return __pyx_r; +} + +/* "C:/Users/runneradmin/AppData/Local/Temp/build-env-ej_q3m8u/Lib/site-packages/numpy/__init__.cython-30.pxd":779 + * return PyArray_MultiIterNew(1, a) + * + * cdef inline object PyArray_MultiIterNew2(a, b): # <<<<<<<<<<<<<< + * return PyArray_MultiIterNew(2, a, b) + * +*/ + +static CYTHON_INLINE PyObject *__pyx_f_5numpy_PyArray_MultiIterNew2(PyObject *__pyx_v_a, PyObject *__pyx_v_b) { + PyObject *__pyx_r = NULL; + __Pyx_RefNannyDeclarations + PyObject *__pyx_t_1 = NULL; + int __pyx_lineno = 0; + const char *__pyx_filename = NULL; + int __pyx_clineno = 0; + __Pyx_RefNannySetupContext("PyArray_MultiIterNew2", 0); + + /* "C:/Users/runneradmin/AppData/Local/Temp/build-env-ej_q3m8u/Lib/site-packages/numpy/__init__.cython-30.pxd":780 + * + * cdef inline object PyArray_MultiIterNew2(a, b): + * return PyArray_MultiIterNew(2, a, b) # <<<<<<<<<<<<<< + * + * cdef inline object PyArray_MultiIterNew3(a, b, c): +*/ + __Pyx_XDECREF(__pyx_r); + __pyx_t_1 = PyArray_MultiIterNew(2, ((void *)__pyx_v_a), ((void *)__pyx_v_b)); if (unlikely(!__pyx_t_1)) __PYX_ERR(2, 780, __pyx_L1_error) + __Pyx_GOTREF(__pyx_t_1); + __pyx_r = __pyx_t_1; + __pyx_t_1 = 0; + goto __pyx_L0; + + /* "C:/Users/runneradmin/AppData/Local/Temp/build-env-ej_q3m8u/Lib/site-packages/numpy/__init__.cython-30.pxd":779 + * return PyArray_MultiIterNew(1, a) + * + * cdef inline object PyArray_MultiIterNew2(a, b): # <<<<<<<<<<<<<< + * return PyArray_MultiIterNew(2, a, b) + * +*/ + + /* function exit code */ + __pyx_L1_error:; + __Pyx_XDECREF(__pyx_t_1); + __Pyx_AddTraceback("numpy.PyArray_MultiIterNew2", __pyx_clineno, __pyx_lineno, __pyx_filename); + __pyx_r = 0; + __pyx_L0:; + __Pyx_XGIVEREF(__pyx_r); + __Pyx_RefNannyFinishContext(); + return __pyx_r; +} + +/* "C:/Users/runneradmin/AppData/Local/Temp/build-env-ej_q3m8u/Lib/site-packages/numpy/__init__.cython-30.pxd":782 + * return PyArray_MultiIterNew(2, a, b) + * + * cdef inline object PyArray_MultiIterNew3(a, b, c): # <<<<<<<<<<<<<< + * return PyArray_MultiIterNew(3, a, b, c) + * +*/ + +static CYTHON_INLINE PyObject *__pyx_f_5numpy_PyArray_MultiIterNew3(PyObject *__pyx_v_a, PyObject *__pyx_v_b, PyObject *__pyx_v_c) { + PyObject *__pyx_r = NULL; + __Pyx_RefNannyDeclarations + PyObject *__pyx_t_1 = NULL; + int __pyx_lineno = 0; + const char *__pyx_filename = NULL; + int __pyx_clineno = 0; + __Pyx_RefNannySetupContext("PyArray_MultiIterNew3", 0); + + /* "C:/Users/runneradmin/AppData/Local/Temp/build-env-ej_q3m8u/Lib/site-packages/numpy/__init__.cython-30.pxd":783 + * + * cdef inline object PyArray_MultiIterNew3(a, b, c): + * return PyArray_MultiIterNew(3, a, b, c) # <<<<<<<<<<<<<< + * + * cdef inline object PyArray_MultiIterNew4(a, b, c, d): +*/ + __Pyx_XDECREF(__pyx_r); + __pyx_t_1 = PyArray_MultiIterNew(3, ((void *)__pyx_v_a), ((void *)__pyx_v_b), ((void *)__pyx_v_c)); if (unlikely(!__pyx_t_1)) __PYX_ERR(2, 783, __pyx_L1_error) + __Pyx_GOTREF(__pyx_t_1); + __pyx_r = __pyx_t_1; + __pyx_t_1 = 0; + goto __pyx_L0; + + /* "C:/Users/runneradmin/AppData/Local/Temp/build-env-ej_q3m8u/Lib/site-packages/numpy/__init__.cython-30.pxd":782 + * return PyArray_MultiIterNew(2, a, b) + * + * cdef inline object PyArray_MultiIterNew3(a, b, c): # <<<<<<<<<<<<<< + * return PyArray_MultiIterNew(3, a, b, c) + * +*/ + + /* function exit code */ + __pyx_L1_error:; + __Pyx_XDECREF(__pyx_t_1); + __Pyx_AddTraceback("numpy.PyArray_MultiIterNew3", __pyx_clineno, __pyx_lineno, __pyx_filename); + __pyx_r = 0; + __pyx_L0:; + __Pyx_XGIVEREF(__pyx_r); + __Pyx_RefNannyFinishContext(); + return __pyx_r; +} + +/* "C:/Users/runneradmin/AppData/Local/Temp/build-env-ej_q3m8u/Lib/site-packages/numpy/__init__.cython-30.pxd":785 + * return PyArray_MultiIterNew(3, a, b, c) + * + * cdef inline object PyArray_MultiIterNew4(a, b, c, d): # <<<<<<<<<<<<<< + * return PyArray_MultiIterNew(4, a, b, c, d) + * +*/ + +static CYTHON_INLINE PyObject *__pyx_f_5numpy_PyArray_MultiIterNew4(PyObject *__pyx_v_a, PyObject *__pyx_v_b, PyObject *__pyx_v_c, PyObject *__pyx_v_d) { + PyObject *__pyx_r = NULL; + __Pyx_RefNannyDeclarations + PyObject *__pyx_t_1 = NULL; + int __pyx_lineno = 0; + const char *__pyx_filename = NULL; + int __pyx_clineno = 0; + __Pyx_RefNannySetupContext("PyArray_MultiIterNew4", 0); + + /* "C:/Users/runneradmin/AppData/Local/Temp/build-env-ej_q3m8u/Lib/site-packages/numpy/__init__.cython-30.pxd":786 + * + * cdef inline object PyArray_MultiIterNew4(a, b, c, d): + * return PyArray_MultiIterNew(4, a, b, c, d) # <<<<<<<<<<<<<< + * + * cdef inline object PyArray_MultiIterNew5(a, b, c, d, e): +*/ + __Pyx_XDECREF(__pyx_r); + __pyx_t_1 = PyArray_MultiIterNew(4, ((void *)__pyx_v_a), ((void *)__pyx_v_b), ((void *)__pyx_v_c), ((void *)__pyx_v_d)); if (unlikely(!__pyx_t_1)) __PYX_ERR(2, 786, __pyx_L1_error) + __Pyx_GOTREF(__pyx_t_1); + __pyx_r = __pyx_t_1; + __pyx_t_1 = 0; + goto __pyx_L0; + + /* "C:/Users/runneradmin/AppData/Local/Temp/build-env-ej_q3m8u/Lib/site-packages/numpy/__init__.cython-30.pxd":785 + * return PyArray_MultiIterNew(3, a, b, c) + * + * cdef inline object PyArray_MultiIterNew4(a, b, c, d): # <<<<<<<<<<<<<< + * return PyArray_MultiIterNew(4, a, b, c, d) + * +*/ + + /* function exit code */ + __pyx_L1_error:; + __Pyx_XDECREF(__pyx_t_1); + __Pyx_AddTraceback("numpy.PyArray_MultiIterNew4", __pyx_clineno, __pyx_lineno, __pyx_filename); + __pyx_r = 0; + __pyx_L0:; + __Pyx_XGIVEREF(__pyx_r); + __Pyx_RefNannyFinishContext(); + return __pyx_r; +} + +/* "C:/Users/runneradmin/AppData/Local/Temp/build-env-ej_q3m8u/Lib/site-packages/numpy/__init__.cython-30.pxd":788 + * return PyArray_MultiIterNew(4, a, b, c, d) + * + * cdef inline object PyArray_MultiIterNew5(a, b, c, d, e): # <<<<<<<<<<<<<< + * return PyArray_MultiIterNew(5, a, b, c, d, e) + * +*/ + +static CYTHON_INLINE PyObject *__pyx_f_5numpy_PyArray_MultiIterNew5(PyObject *__pyx_v_a, PyObject *__pyx_v_b, PyObject *__pyx_v_c, PyObject *__pyx_v_d, PyObject *__pyx_v_e) { + PyObject *__pyx_r = NULL; + __Pyx_RefNannyDeclarations + PyObject *__pyx_t_1 = NULL; + int __pyx_lineno = 0; + const char *__pyx_filename = NULL; + int __pyx_clineno = 0; + __Pyx_RefNannySetupContext("PyArray_MultiIterNew5", 0); + + /* "C:/Users/runneradmin/AppData/Local/Temp/build-env-ej_q3m8u/Lib/site-packages/numpy/__init__.cython-30.pxd":789 + * + * cdef inline object PyArray_MultiIterNew5(a, b, c, d, e): + * return PyArray_MultiIterNew(5, a, b, c, d, e) # <<<<<<<<<<<<<< + * + * cdef inline tuple PyDataType_SHAPE(dtype d): +*/ + __Pyx_XDECREF(__pyx_r); + __pyx_t_1 = PyArray_MultiIterNew(5, ((void *)__pyx_v_a), ((void *)__pyx_v_b), ((void *)__pyx_v_c), ((void *)__pyx_v_d), ((void *)__pyx_v_e)); if (unlikely(!__pyx_t_1)) __PYX_ERR(2, 789, __pyx_L1_error) + __Pyx_GOTREF(__pyx_t_1); + __pyx_r = __pyx_t_1; + __pyx_t_1 = 0; + goto __pyx_L0; + + /* "C:/Users/runneradmin/AppData/Local/Temp/build-env-ej_q3m8u/Lib/site-packages/numpy/__init__.cython-30.pxd":788 + * return PyArray_MultiIterNew(4, a, b, c, d) + * + * cdef inline object PyArray_MultiIterNew5(a, b, c, d, e): # <<<<<<<<<<<<<< + * return PyArray_MultiIterNew(5, a, b, c, d, e) + * +*/ + + /* function exit code */ + __pyx_L1_error:; + __Pyx_XDECREF(__pyx_t_1); + __Pyx_AddTraceback("numpy.PyArray_MultiIterNew5", __pyx_clineno, __pyx_lineno, __pyx_filename); + __pyx_r = 0; + __pyx_L0:; + __Pyx_XGIVEREF(__pyx_r); + __Pyx_RefNannyFinishContext(); + return __pyx_r; +} + +/* "C:/Users/runneradmin/AppData/Local/Temp/build-env-ej_q3m8u/Lib/site-packages/numpy/__init__.cython-30.pxd":791 + * return PyArray_MultiIterNew(5, a, b, c, d, e) + * + * cdef inline tuple PyDataType_SHAPE(dtype d): # <<<<<<<<<<<<<< + * if PyDataType_HASSUBARRAY(d): + * return d.subarray.shape +*/ + +static CYTHON_INLINE PyObject *__pyx_f_5numpy_PyDataType_SHAPE(PyArray_Descr *__pyx_v_d) { + PyObject *__pyx_r = NULL; + __Pyx_RefNannyDeclarations + int __pyx_t_1; + PyObject *__pyx_t_2; + __Pyx_RefNannySetupContext("PyDataType_SHAPE", 0); + + /* "C:/Users/runneradmin/AppData/Local/Temp/build-env-ej_q3m8u/Lib/site-packages/numpy/__init__.cython-30.pxd":792 + * + * cdef inline tuple PyDataType_SHAPE(dtype d): + * if PyDataType_HASSUBARRAY(d): # <<<<<<<<<<<<<< + * return d.subarray.shape + * else: +*/ + __pyx_t_1 = PyDataType_HASSUBARRAY(__pyx_v_d); + if (__pyx_t_1) { + + /* "C:/Users/runneradmin/AppData/Local/Temp/build-env-ej_q3m8u/Lib/site-packages/numpy/__init__.cython-30.pxd":793 + * cdef inline tuple PyDataType_SHAPE(dtype d): + * if PyDataType_HASSUBARRAY(d): + * return d.subarray.shape # <<<<<<<<<<<<<< + * else: + * return () +*/ + __Pyx_XDECREF(__pyx_r); + __pyx_t_2 = __pyx_f_5numpy_5dtype_8subarray_subarray(__pyx_v_d)->shape; + __Pyx_INCREF(((PyObject*)__pyx_t_2)); + __pyx_r = ((PyObject*)__pyx_t_2); + goto __pyx_L0; + + /* "C:/Users/runneradmin/AppData/Local/Temp/build-env-ej_q3m8u/Lib/site-packages/numpy/__init__.cython-30.pxd":792 + * + * cdef inline tuple PyDataType_SHAPE(dtype d): + * if PyDataType_HASSUBARRAY(d): # <<<<<<<<<<<<<< + * return d.subarray.shape + * else: +*/ + } + + /* "C:/Users/runneradmin/AppData/Local/Temp/build-env-ej_q3m8u/Lib/site-packages/numpy/__init__.cython-30.pxd":795 + * return d.subarray.shape + * else: + * return () # <<<<<<<<<<<<<< + * + * +*/ + /*else*/ { + __Pyx_XDECREF(__pyx_r); + __Pyx_INCREF(__pyx_mstate_global->__pyx_empty_tuple); + __pyx_r = __pyx_mstate_global->__pyx_empty_tuple; + goto __pyx_L0; + } + + /* "C:/Users/runneradmin/AppData/Local/Temp/build-env-ej_q3m8u/Lib/site-packages/numpy/__init__.cython-30.pxd":791 + * return PyArray_MultiIterNew(5, a, b, c, d, e) + * + * cdef inline tuple PyDataType_SHAPE(dtype d): # <<<<<<<<<<<<<< + * if PyDataType_HASSUBARRAY(d): + * return d.subarray.shape +*/ + + /* function exit code */ + __pyx_L0:; + __Pyx_XGIVEREF(__pyx_r); + __Pyx_RefNannyFinishContext(); + return __pyx_r; +} + +/* "C:/Users/runneradmin/AppData/Local/Temp/build-env-ej_q3m8u/Lib/site-packages/numpy/__init__.cython-30.pxd":994 + * int _import_umath() except -1 + * + * cdef inline void set_array_base(ndarray arr, object base) except *: # <<<<<<<<<<<<<< + * Py_INCREF(base) # important to do this before stealing the reference below! + * PyArray_SetBaseObject(arr, base) +*/ + +static CYTHON_INLINE void __pyx_f_5numpy_set_array_base(PyArrayObject *__pyx_v_arr, PyObject *__pyx_v_base) { + int __pyx_t_1; + int __pyx_lineno = 0; + const char *__pyx_filename = NULL; + int __pyx_clineno = 0; + + /* "C:/Users/runneradmin/AppData/Local/Temp/build-env-ej_q3m8u/Lib/site-packages/numpy/__init__.cython-30.pxd":995 + * + * cdef inline void set_array_base(ndarray arr, object base) except *: + * Py_INCREF(base) # important to do this before stealing the reference below! # <<<<<<<<<<<<<< + * PyArray_SetBaseObject(arr, base) + * +*/ + Py_INCREF(__pyx_v_base); + + /* "C:/Users/runneradmin/AppData/Local/Temp/build-env-ej_q3m8u/Lib/site-packages/numpy/__init__.cython-30.pxd":996 + * cdef inline void set_array_base(ndarray arr, object base) except *: + * Py_INCREF(base) # important to do this before stealing the reference below! + * PyArray_SetBaseObject(arr, base) # <<<<<<<<<<<<<< + * + * cdef inline object get_array_base(ndarray arr): +*/ + __pyx_t_1 = PyArray_SetBaseObject(__pyx_v_arr, __pyx_v_base); if (unlikely(__pyx_t_1 == ((int)-1))) __PYX_ERR(2, 996, __pyx_L1_error) + + /* "C:/Users/runneradmin/AppData/Local/Temp/build-env-ej_q3m8u/Lib/site-packages/numpy/__init__.cython-30.pxd":994 + * int _import_umath() except -1 + * + * cdef inline void set_array_base(ndarray arr, object base) except *: # <<<<<<<<<<<<<< + * Py_INCREF(base) # important to do this before stealing the reference below! + * PyArray_SetBaseObject(arr, base) +*/ + + /* function exit code */ + goto __pyx_L0; + __pyx_L1_error:; + __Pyx_AddTraceback("numpy.set_array_base", __pyx_clineno, __pyx_lineno, __pyx_filename); + __pyx_L0:; +} + +/* "C:/Users/runneradmin/AppData/Local/Temp/build-env-ej_q3m8u/Lib/site-packages/numpy/__init__.cython-30.pxd":998 + * PyArray_SetBaseObject(arr, base) + * + * cdef inline object get_array_base(ndarray arr): # <<<<<<<<<<<<<< + * base = PyArray_BASE(arr) + * if base is NULL: +*/ + +static CYTHON_INLINE PyObject *__pyx_f_5numpy_get_array_base(PyArrayObject *__pyx_v_arr) { + PyObject *__pyx_v_base; + PyObject *__pyx_r = NULL; + __Pyx_RefNannyDeclarations + int __pyx_t_1; + __Pyx_RefNannySetupContext("get_array_base", 0); + + /* "C:/Users/runneradmin/AppData/Local/Temp/build-env-ej_q3m8u/Lib/site-packages/numpy/__init__.cython-30.pxd":999 + * + * cdef inline object get_array_base(ndarray arr): + * base = PyArray_BASE(arr) # <<<<<<<<<<<<<< + * if base is NULL: + * return None +*/ + __pyx_v_base = PyArray_BASE(__pyx_v_arr); + + /* "C:/Users/runneradmin/AppData/Local/Temp/build-env-ej_q3m8u/Lib/site-packages/numpy/__init__.cython-30.pxd":1000 + * cdef inline object get_array_base(ndarray arr): + * base = PyArray_BASE(arr) + * if base is NULL: # <<<<<<<<<<<<<< + * return None + * return base +*/ + __pyx_t_1 = (__pyx_v_base == NULL); + if (__pyx_t_1) { + + /* "C:/Users/runneradmin/AppData/Local/Temp/build-env-ej_q3m8u/Lib/site-packages/numpy/__init__.cython-30.pxd":1001 + * base = PyArray_BASE(arr) + * if base is NULL: + * return None # <<<<<<<<<<<<<< + * return base + * +*/ + __Pyx_XDECREF(__pyx_r); + __pyx_r = Py_None; __Pyx_INCREF(Py_None); + goto __pyx_L0; + + /* "C:/Users/runneradmin/AppData/Local/Temp/build-env-ej_q3m8u/Lib/site-packages/numpy/__init__.cython-30.pxd":1000 + * cdef inline object get_array_base(ndarray arr): + * base = PyArray_BASE(arr) + * if base is NULL: # <<<<<<<<<<<<<< + * return None + * return base +*/ + } + + /* "C:/Users/runneradmin/AppData/Local/Temp/build-env-ej_q3m8u/Lib/site-packages/numpy/__init__.cython-30.pxd":1002 + * if base is NULL: + * return None + * return base # <<<<<<<<<<<<<< + * + * # Versions of the import_* functions which are more suitable for +*/ + __Pyx_XDECREF(__pyx_r); + __Pyx_INCREF(((PyObject *)__pyx_v_base)); + __pyx_r = ((PyObject *)__pyx_v_base); + goto __pyx_L0; + + /* "C:/Users/runneradmin/AppData/Local/Temp/build-env-ej_q3m8u/Lib/site-packages/numpy/__init__.cython-30.pxd":998 + * PyArray_SetBaseObject(arr, base) + * + * cdef inline object get_array_base(ndarray arr): # <<<<<<<<<<<<<< + * base = PyArray_BASE(arr) + * if base is NULL: +*/ + + /* function exit code */ + __pyx_L0:; + __Pyx_XGIVEREF(__pyx_r); + __Pyx_RefNannyFinishContext(); + return __pyx_r; +} + +/* "C:/Users/runneradmin/AppData/Local/Temp/build-env-ej_q3m8u/Lib/site-packages/numpy/__init__.cython-30.pxd":1006 + * # Versions of the import_* functions which are more suitable for + * # Cython code. + * cdef inline int import_array() except -1: # <<<<<<<<<<<<<< + * try: + * __pyx_import_array() +*/ + +static CYTHON_INLINE int __pyx_f_5numpy_import_array(void) { + int __pyx_r; + __Pyx_RefNannyDeclarations + PyObject *__pyx_t_1 = NULL; + PyObject *__pyx_t_2 = NULL; + PyObject *__pyx_t_3 = NULL; + int __pyx_t_4; + PyObject *__pyx_t_5 = NULL; + PyObject *__pyx_t_6 = NULL; + PyObject *__pyx_t_7 = NULL; + PyObject *__pyx_t_8 = NULL; + PyObject *__pyx_t_9 = NULL; + size_t __pyx_t_10; + int __pyx_lineno = 0; + const char *__pyx_filename = NULL; + int __pyx_clineno = 0; + __Pyx_RefNannySetupContext("import_array", 0); + + /* "C:/Users/runneradmin/AppData/Local/Temp/build-env-ej_q3m8u/Lib/site-packages/numpy/__init__.cython-30.pxd":1007 + * # Cython code. + * cdef inline int import_array() except -1: + * try: # <<<<<<<<<<<<<< + * __pyx_import_array() + * except Exception: +*/ + { + __Pyx_PyThreadState_declare + __Pyx_PyThreadState_assign + __Pyx_ExceptionSave(&__pyx_t_1, &__pyx_t_2, &__pyx_t_3); + __Pyx_XGOTREF(__pyx_t_1); + __Pyx_XGOTREF(__pyx_t_2); + __Pyx_XGOTREF(__pyx_t_3); + /*try:*/ { + + /* "C:/Users/runneradmin/AppData/Local/Temp/build-env-ej_q3m8u/Lib/site-packages/numpy/__init__.cython-30.pxd":1008 + * cdef inline int import_array() except -1: + * try: + * __pyx_import_array() # <<<<<<<<<<<<<< + * except Exception: + * raise ImportError("numpy._core.multiarray failed to import") +*/ + __pyx_t_4 = _import_array(); if (unlikely(__pyx_t_4 == ((int)-1))) __PYX_ERR(2, 1008, __pyx_L3_error) + + /* "C:/Users/runneradmin/AppData/Local/Temp/build-env-ej_q3m8u/Lib/site-packages/numpy/__init__.cython-30.pxd":1007 + * # Cython code. + * cdef inline int import_array() except -1: + * try: # <<<<<<<<<<<<<< + * __pyx_import_array() + * except Exception: +*/ + } + __Pyx_XDECREF(__pyx_t_1); __pyx_t_1 = 0; + __Pyx_XDECREF(__pyx_t_2); __pyx_t_2 = 0; + __Pyx_XDECREF(__pyx_t_3); __pyx_t_3 = 0; + goto __pyx_L8_try_end; + __pyx_L3_error:; + + /* "C:/Users/runneradmin/AppData/Local/Temp/build-env-ej_q3m8u/Lib/site-packages/numpy/__init__.cython-30.pxd":1009 + * try: + * __pyx_import_array() + * except Exception: # <<<<<<<<<<<<<< + * raise ImportError("numpy._core.multiarray failed to import") + * +*/ + __pyx_t_4 = __Pyx_PyErr_ExceptionMatches(((PyObject *)(((PyTypeObject*)PyExc_Exception)))); + if (__pyx_t_4) { + __Pyx_AddTraceback("numpy.import_array", __pyx_clineno, __pyx_lineno, __pyx_filename); + if (__Pyx_GetException(&__pyx_t_5, &__pyx_t_6, &__pyx_t_7) < 0) __PYX_ERR(2, 1009, __pyx_L5_except_error) + __Pyx_XGOTREF(__pyx_t_5); + __Pyx_XGOTREF(__pyx_t_6); + __Pyx_XGOTREF(__pyx_t_7); + + /* "C:/Users/runneradmin/AppData/Local/Temp/build-env-ej_q3m8u/Lib/site-packages/numpy/__init__.cython-30.pxd":1010 + * __pyx_import_array() + * except Exception: + * raise ImportError("numpy._core.multiarray failed to import") # <<<<<<<<<<<<<< + * + * cdef inline int import_umath() except -1: +*/ + __pyx_t_9 = NULL; + __pyx_t_10 = 1; + { + PyObject *__pyx_callargs[2] = {__pyx_t_9, __pyx_mstate_global->__pyx_kp_u_numpy__core_multiarray_failed_to}; + __pyx_t_8 = __Pyx_PyObject_FastCall((PyObject*)(((PyTypeObject*)PyExc_ImportError)), __pyx_callargs+__pyx_t_10, (2-__pyx_t_10) | (__pyx_t_10*__Pyx_PY_VECTORCALL_ARGUMENTS_OFFSET)); + __Pyx_XDECREF(__pyx_t_9); __pyx_t_9 = 0; + if (unlikely(!__pyx_t_8)) __PYX_ERR(2, 1010, __pyx_L5_except_error) + __Pyx_GOTREF(__pyx_t_8); + } + __Pyx_Raise(__pyx_t_8, 0, 0, 0); + __Pyx_DECREF(__pyx_t_8); __pyx_t_8 = 0; + __PYX_ERR(2, 1010, __pyx_L5_except_error) + } + goto __pyx_L5_except_error; + + /* "C:/Users/runneradmin/AppData/Local/Temp/build-env-ej_q3m8u/Lib/site-packages/numpy/__init__.cython-30.pxd":1007 + * # Cython code. + * cdef inline int import_array() except -1: + * try: # <<<<<<<<<<<<<< + * __pyx_import_array() + * except Exception: +*/ + __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:; + } + + /* "C:/Users/runneradmin/AppData/Local/Temp/build-env-ej_q3m8u/Lib/site-packages/numpy/__init__.cython-30.pxd":1006 + * # Versions of the import_* functions which are more suitable for + * # Cython code. + * cdef inline int import_array() except -1: # <<<<<<<<<<<<<< + * try: + * __pyx_import_array() +*/ + + /* function exit code */ + __pyx_r = 0; + goto __pyx_L0; + __pyx_L1_error:; + __Pyx_XDECREF(__pyx_t_5); + __Pyx_XDECREF(__pyx_t_6); + __Pyx_XDECREF(__pyx_t_7); + __Pyx_XDECREF(__pyx_t_8); + __Pyx_XDECREF(__pyx_t_9); + __Pyx_AddTraceback("numpy.import_array", __pyx_clineno, __pyx_lineno, __pyx_filename); + __pyx_r = -1; + __pyx_L0:; + __Pyx_RefNannyFinishContext(); + return __pyx_r; +} + +/* "C:/Users/runneradmin/AppData/Local/Temp/build-env-ej_q3m8u/Lib/site-packages/numpy/__init__.cython-30.pxd":1012 + * raise ImportError("numpy._core.multiarray failed to import") + * + * cdef inline int import_umath() except -1: # <<<<<<<<<<<<<< + * try: + * _import_umath() +*/ + +static CYTHON_INLINE int __pyx_f_5numpy_import_umath(void) { + int __pyx_r; + __Pyx_RefNannyDeclarations + PyObject *__pyx_t_1 = NULL; + PyObject *__pyx_t_2 = NULL; + PyObject *__pyx_t_3 = NULL; + int __pyx_t_4; + PyObject *__pyx_t_5 = NULL; + PyObject *__pyx_t_6 = NULL; + PyObject *__pyx_t_7 = NULL; + PyObject *__pyx_t_8 = NULL; + PyObject *__pyx_t_9 = NULL; + size_t __pyx_t_10; + int __pyx_lineno = 0; + const char *__pyx_filename = NULL; + int __pyx_clineno = 0; + __Pyx_RefNannySetupContext("import_umath", 0); + + /* "C:/Users/runneradmin/AppData/Local/Temp/build-env-ej_q3m8u/Lib/site-packages/numpy/__init__.cython-30.pxd":1013 + * + * cdef inline int import_umath() except -1: + * try: # <<<<<<<<<<<<<< + * _import_umath() + * except Exception: +*/ + { + __Pyx_PyThreadState_declare + __Pyx_PyThreadState_assign + __Pyx_ExceptionSave(&__pyx_t_1, &__pyx_t_2, &__pyx_t_3); + __Pyx_XGOTREF(__pyx_t_1); + __Pyx_XGOTREF(__pyx_t_2); + __Pyx_XGOTREF(__pyx_t_3); + /*try:*/ { + + /* "C:/Users/runneradmin/AppData/Local/Temp/build-env-ej_q3m8u/Lib/site-packages/numpy/__init__.cython-30.pxd":1014 + * cdef inline int import_umath() except -1: + * try: + * _import_umath() # <<<<<<<<<<<<<< + * except Exception: + * raise ImportError("numpy._core.umath failed to import") +*/ + __pyx_t_4 = _import_umath(); if (unlikely(__pyx_t_4 == ((int)-1))) __PYX_ERR(2, 1014, __pyx_L3_error) + + /* "C:/Users/runneradmin/AppData/Local/Temp/build-env-ej_q3m8u/Lib/site-packages/numpy/__init__.cython-30.pxd":1013 + * + * cdef inline int import_umath() except -1: + * try: # <<<<<<<<<<<<<< + * _import_umath() + * except Exception: +*/ + } + __Pyx_XDECREF(__pyx_t_1); __pyx_t_1 = 0; + __Pyx_XDECREF(__pyx_t_2); __pyx_t_2 = 0; + __Pyx_XDECREF(__pyx_t_3); __pyx_t_3 = 0; + goto __pyx_L8_try_end; + __pyx_L3_error:; + + /* "C:/Users/runneradmin/AppData/Local/Temp/build-env-ej_q3m8u/Lib/site-packages/numpy/__init__.cython-30.pxd":1015 + * try: + * _import_umath() + * except Exception: # <<<<<<<<<<<<<< + * raise ImportError("numpy._core.umath failed to import") + * +*/ + __pyx_t_4 = __Pyx_PyErr_ExceptionMatches(((PyObject *)(((PyTypeObject*)PyExc_Exception)))); + if (__pyx_t_4) { + __Pyx_AddTraceback("numpy.import_umath", __pyx_clineno, __pyx_lineno, __pyx_filename); + if (__Pyx_GetException(&__pyx_t_5, &__pyx_t_6, &__pyx_t_7) < 0) __PYX_ERR(2, 1015, __pyx_L5_except_error) + __Pyx_XGOTREF(__pyx_t_5); + __Pyx_XGOTREF(__pyx_t_6); + __Pyx_XGOTREF(__pyx_t_7); + + /* "C:/Users/runneradmin/AppData/Local/Temp/build-env-ej_q3m8u/Lib/site-packages/numpy/__init__.cython-30.pxd":1016 + * _import_umath() + * except Exception: + * raise ImportError("numpy._core.umath failed to import") # <<<<<<<<<<<<<< + * + * cdef inline int import_ufunc() except -1: +*/ + __pyx_t_9 = NULL; + __pyx_t_10 = 1; + { + PyObject *__pyx_callargs[2] = {__pyx_t_9, __pyx_mstate_global->__pyx_kp_u_numpy__core_umath_failed_to_impo}; + __pyx_t_8 = __Pyx_PyObject_FastCall((PyObject*)(((PyTypeObject*)PyExc_ImportError)), __pyx_callargs+__pyx_t_10, (2-__pyx_t_10) | (__pyx_t_10*__Pyx_PY_VECTORCALL_ARGUMENTS_OFFSET)); + __Pyx_XDECREF(__pyx_t_9); __pyx_t_9 = 0; + if (unlikely(!__pyx_t_8)) __PYX_ERR(2, 1016, __pyx_L5_except_error) + __Pyx_GOTREF(__pyx_t_8); + } + __Pyx_Raise(__pyx_t_8, 0, 0, 0); + __Pyx_DECREF(__pyx_t_8); __pyx_t_8 = 0; + __PYX_ERR(2, 1016, __pyx_L5_except_error) + } + goto __pyx_L5_except_error; + + /* "C:/Users/runneradmin/AppData/Local/Temp/build-env-ej_q3m8u/Lib/site-packages/numpy/__init__.cython-30.pxd":1013 + * + * cdef inline int import_umath() except -1: + * try: # <<<<<<<<<<<<<< + * _import_umath() + * except Exception: +*/ + __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:; + } + + /* "C:/Users/runneradmin/AppData/Local/Temp/build-env-ej_q3m8u/Lib/site-packages/numpy/__init__.cython-30.pxd":1012 + * raise ImportError("numpy._core.multiarray failed to import") + * + * cdef inline int import_umath() except -1: # <<<<<<<<<<<<<< + * try: + * _import_umath() +*/ + + /* function exit code */ + __pyx_r = 0; + goto __pyx_L0; + __pyx_L1_error:; + __Pyx_XDECREF(__pyx_t_5); + __Pyx_XDECREF(__pyx_t_6); + __Pyx_XDECREF(__pyx_t_7); + __Pyx_XDECREF(__pyx_t_8); + __Pyx_XDECREF(__pyx_t_9); + __Pyx_AddTraceback("numpy.import_umath", __pyx_clineno, __pyx_lineno, __pyx_filename); + __pyx_r = -1; + __pyx_L0:; + __Pyx_RefNannyFinishContext(); + return __pyx_r; +} + +/* "C:/Users/runneradmin/AppData/Local/Temp/build-env-ej_q3m8u/Lib/site-packages/numpy/__init__.cython-30.pxd":1018 + * raise ImportError("numpy._core.umath failed to import") + * + * cdef inline int import_ufunc() except -1: # <<<<<<<<<<<<<< + * try: + * _import_umath() +*/ + +static CYTHON_INLINE int __pyx_f_5numpy_import_ufunc(void) { + int __pyx_r; + __Pyx_RefNannyDeclarations + PyObject *__pyx_t_1 = NULL; + PyObject *__pyx_t_2 = NULL; + PyObject *__pyx_t_3 = NULL; + int __pyx_t_4; + PyObject *__pyx_t_5 = NULL; + PyObject *__pyx_t_6 = NULL; + PyObject *__pyx_t_7 = NULL; + PyObject *__pyx_t_8 = NULL; + PyObject *__pyx_t_9 = NULL; + size_t __pyx_t_10; + int __pyx_lineno = 0; + const char *__pyx_filename = NULL; + int __pyx_clineno = 0; + __Pyx_RefNannySetupContext("import_ufunc", 0); + + /* "C:/Users/runneradmin/AppData/Local/Temp/build-env-ej_q3m8u/Lib/site-packages/numpy/__init__.cython-30.pxd":1019 + * + * cdef inline int import_ufunc() except -1: + * try: # <<<<<<<<<<<<<< + * _import_umath() + * except Exception: +*/ + { + __Pyx_PyThreadState_declare + __Pyx_PyThreadState_assign + __Pyx_ExceptionSave(&__pyx_t_1, &__pyx_t_2, &__pyx_t_3); + __Pyx_XGOTREF(__pyx_t_1); + __Pyx_XGOTREF(__pyx_t_2); + __Pyx_XGOTREF(__pyx_t_3); + /*try:*/ { + + /* "C:/Users/runneradmin/AppData/Local/Temp/build-env-ej_q3m8u/Lib/site-packages/numpy/__init__.cython-30.pxd":1020 + * cdef inline int import_ufunc() except -1: + * try: + * _import_umath() # <<<<<<<<<<<<<< + * except Exception: + * raise ImportError("numpy._core.umath failed to import") +*/ + __pyx_t_4 = _import_umath(); if (unlikely(__pyx_t_4 == ((int)-1))) __PYX_ERR(2, 1020, __pyx_L3_error) + + /* "C:/Users/runneradmin/AppData/Local/Temp/build-env-ej_q3m8u/Lib/site-packages/numpy/__init__.cython-30.pxd":1019 + * + * cdef inline int import_ufunc() except -1: + * try: # <<<<<<<<<<<<<< + * _import_umath() + * except Exception: +*/ + } + __Pyx_XDECREF(__pyx_t_1); __pyx_t_1 = 0; + __Pyx_XDECREF(__pyx_t_2); __pyx_t_2 = 0; + __Pyx_XDECREF(__pyx_t_3); __pyx_t_3 = 0; + goto __pyx_L8_try_end; + __pyx_L3_error:; + + /* "C:/Users/runneradmin/AppData/Local/Temp/build-env-ej_q3m8u/Lib/site-packages/numpy/__init__.cython-30.pxd":1021 + * try: + * _import_umath() + * except Exception: # <<<<<<<<<<<<<< + * raise ImportError("numpy._core.umath failed to import") + * +*/ + __pyx_t_4 = __Pyx_PyErr_ExceptionMatches(((PyObject *)(((PyTypeObject*)PyExc_Exception)))); + if (__pyx_t_4) { + __Pyx_AddTraceback("numpy.import_ufunc", __pyx_clineno, __pyx_lineno, __pyx_filename); + if (__Pyx_GetException(&__pyx_t_5, &__pyx_t_6, &__pyx_t_7) < 0) __PYX_ERR(2, 1021, __pyx_L5_except_error) + __Pyx_XGOTREF(__pyx_t_5); + __Pyx_XGOTREF(__pyx_t_6); + __Pyx_XGOTREF(__pyx_t_7); + + /* "C:/Users/runneradmin/AppData/Local/Temp/build-env-ej_q3m8u/Lib/site-packages/numpy/__init__.cython-30.pxd":1022 + * _import_umath() + * except Exception: + * raise ImportError("numpy._core.umath failed to import") # <<<<<<<<<<<<<< + * + * +*/ + __pyx_t_9 = NULL; + __pyx_t_10 = 1; + { + PyObject *__pyx_callargs[2] = {__pyx_t_9, __pyx_mstate_global->__pyx_kp_u_numpy__core_umath_failed_to_impo}; + __pyx_t_8 = __Pyx_PyObject_FastCall((PyObject*)(((PyTypeObject*)PyExc_ImportError)), __pyx_callargs+__pyx_t_10, (2-__pyx_t_10) | (__pyx_t_10*__Pyx_PY_VECTORCALL_ARGUMENTS_OFFSET)); + __Pyx_XDECREF(__pyx_t_9); __pyx_t_9 = 0; + if (unlikely(!__pyx_t_8)) __PYX_ERR(2, 1022, __pyx_L5_except_error) + __Pyx_GOTREF(__pyx_t_8); + } + __Pyx_Raise(__pyx_t_8, 0, 0, 0); + __Pyx_DECREF(__pyx_t_8); __pyx_t_8 = 0; + __PYX_ERR(2, 1022, __pyx_L5_except_error) + } + goto __pyx_L5_except_error; + + /* "C:/Users/runneradmin/AppData/Local/Temp/build-env-ej_q3m8u/Lib/site-packages/numpy/__init__.cython-30.pxd":1019 + * + * cdef inline int import_ufunc() except -1: + * try: # <<<<<<<<<<<<<< + * _import_umath() + * except Exception: +*/ + __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:; + } + + /* "C:/Users/runneradmin/AppData/Local/Temp/build-env-ej_q3m8u/Lib/site-packages/numpy/__init__.cython-30.pxd":1018 + * raise ImportError("numpy._core.umath failed to import") + * + * cdef inline int import_ufunc() except -1: # <<<<<<<<<<<<<< + * try: + * _import_umath() +*/ + + /* function exit code */ + __pyx_r = 0; + goto __pyx_L0; + __pyx_L1_error:; + __Pyx_XDECREF(__pyx_t_5); + __Pyx_XDECREF(__pyx_t_6); + __Pyx_XDECREF(__pyx_t_7); + __Pyx_XDECREF(__pyx_t_8); + __Pyx_XDECREF(__pyx_t_9); + __Pyx_AddTraceback("numpy.import_ufunc", __pyx_clineno, __pyx_lineno, __pyx_filename); + __pyx_r = -1; + __pyx_L0:; + __Pyx_RefNannyFinishContext(); + return __pyx_r; +} + +/* "C:/Users/runneradmin/AppData/Local/Temp/build-env-ej_q3m8u/Lib/site-packages/numpy/__init__.cython-30.pxd":1025 + * + * + * cdef inline bint is_timedelta64_object(object obj) noexcept: # <<<<<<<<<<<<<< + * """ + * Cython equivalent of `isinstance(obj, np.timedelta64)` +*/ + +static CYTHON_INLINE int __pyx_f_5numpy_is_timedelta64_object(PyObject *__pyx_v_obj) { + int __pyx_r; + + /* "C:/Users/runneradmin/AppData/Local/Temp/build-env-ej_q3m8u/Lib/site-packages/numpy/__init__.cython-30.pxd":1037 + * bool + * """ + * return PyObject_TypeCheck(obj, &PyTimedeltaArrType_Type) # <<<<<<<<<<<<<< + * + * +*/ + __pyx_r = PyObject_TypeCheck(__pyx_v_obj, (&PyTimedeltaArrType_Type)); + goto __pyx_L0; + + /* "C:/Users/runneradmin/AppData/Local/Temp/build-env-ej_q3m8u/Lib/site-packages/numpy/__init__.cython-30.pxd":1025 + * + * + * cdef inline bint is_timedelta64_object(object obj) noexcept: # <<<<<<<<<<<<<< + * """ + * Cython equivalent of `isinstance(obj, np.timedelta64)` +*/ + + /* function exit code */ + __pyx_L0:; + return __pyx_r; +} + +/* "C:/Users/runneradmin/AppData/Local/Temp/build-env-ej_q3m8u/Lib/site-packages/numpy/__init__.cython-30.pxd":1040 + * + * + * cdef inline bint is_datetime64_object(object obj) noexcept: # <<<<<<<<<<<<<< + * """ + * Cython equivalent of `isinstance(obj, np.datetime64)` +*/ + +static CYTHON_INLINE int __pyx_f_5numpy_is_datetime64_object(PyObject *__pyx_v_obj) { + int __pyx_r; + + /* "C:/Users/runneradmin/AppData/Local/Temp/build-env-ej_q3m8u/Lib/site-packages/numpy/__init__.cython-30.pxd":1052 + * bool + * """ + * return PyObject_TypeCheck(obj, &PyDatetimeArrType_Type) # <<<<<<<<<<<<<< + * + * +*/ + __pyx_r = PyObject_TypeCheck(__pyx_v_obj, (&PyDatetimeArrType_Type)); + goto __pyx_L0; + + /* "C:/Users/runneradmin/AppData/Local/Temp/build-env-ej_q3m8u/Lib/site-packages/numpy/__init__.cython-30.pxd":1040 + * + * + * cdef inline bint is_datetime64_object(object obj) noexcept: # <<<<<<<<<<<<<< + * """ + * Cython equivalent of `isinstance(obj, np.datetime64)` +*/ + + /* function exit code */ + __pyx_L0:; + return __pyx_r; +} + +/* "C:/Users/runneradmin/AppData/Local/Temp/build-env-ej_q3m8u/Lib/site-packages/numpy/__init__.cython-30.pxd":1055 + * + * + * cdef inline npy_datetime get_datetime64_value(object obj) noexcept nogil: # <<<<<<<<<<<<<< + * """ + * returns the int64 value underlying scalar numpy datetime64 object +*/ + +static CYTHON_INLINE npy_datetime __pyx_f_5numpy_get_datetime64_value(PyObject *__pyx_v_obj) { + npy_datetime __pyx_r; + + /* "C:/Users/runneradmin/AppData/Local/Temp/build-env-ej_q3m8u/Lib/site-packages/numpy/__init__.cython-30.pxd":1062 + * also needed. That can be found using `get_datetime64_unit`. + * """ + * return (obj).obval # <<<<<<<<<<<<<< + * + * +*/ + __pyx_r = ((PyDatetimeScalarObject *)__pyx_v_obj)->obval; + goto __pyx_L0; + + /* "C:/Users/runneradmin/AppData/Local/Temp/build-env-ej_q3m8u/Lib/site-packages/numpy/__init__.cython-30.pxd":1055 + * + * + * cdef inline npy_datetime get_datetime64_value(object obj) noexcept nogil: # <<<<<<<<<<<<<< + * """ + * returns the int64 value underlying scalar numpy datetime64 object +*/ + + /* function exit code */ + __pyx_L0:; + return __pyx_r; +} + +/* "C:/Users/runneradmin/AppData/Local/Temp/build-env-ej_q3m8u/Lib/site-packages/numpy/__init__.cython-30.pxd":1065 + * + * + * cdef inline npy_timedelta get_timedelta64_value(object obj) noexcept nogil: # <<<<<<<<<<<<<< + * """ + * returns the int64 value underlying scalar numpy timedelta64 object +*/ + +static CYTHON_INLINE npy_timedelta __pyx_f_5numpy_get_timedelta64_value(PyObject *__pyx_v_obj) { + npy_timedelta __pyx_r; + + /* "C:/Users/runneradmin/AppData/Local/Temp/build-env-ej_q3m8u/Lib/site-packages/numpy/__init__.cython-30.pxd":1069 + * returns the int64 value underlying scalar numpy timedelta64 object + * """ + * return (obj).obval # <<<<<<<<<<<<<< + * + * +*/ + __pyx_r = ((PyTimedeltaScalarObject *)__pyx_v_obj)->obval; + goto __pyx_L0; + + /* "C:/Users/runneradmin/AppData/Local/Temp/build-env-ej_q3m8u/Lib/site-packages/numpy/__init__.cython-30.pxd":1065 + * + * + * cdef inline npy_timedelta get_timedelta64_value(object obj) noexcept nogil: # <<<<<<<<<<<<<< + * """ + * returns the int64 value underlying scalar numpy timedelta64 object +*/ + + /* function exit code */ + __pyx_L0:; + return __pyx_r; +} + +/* "C:/Users/runneradmin/AppData/Local/Temp/build-env-ej_q3m8u/Lib/site-packages/numpy/__init__.cython-30.pxd":1072 + * + * + * cdef inline NPY_DATETIMEUNIT get_datetime64_unit(object obj) noexcept nogil: # <<<<<<<<<<<<<< + * """ + * returns the unit part of the dtype for a numpy datetime64 object. +*/ + +static CYTHON_INLINE NPY_DATETIMEUNIT __pyx_f_5numpy_get_datetime64_unit(PyObject *__pyx_v_obj) { + NPY_DATETIMEUNIT __pyx_r; + + /* "C:/Users/runneradmin/AppData/Local/Temp/build-env-ej_q3m8u/Lib/site-packages/numpy/__init__.cython-30.pxd":1076 + * returns the unit part of the dtype for a numpy datetime64 object. + * """ + * return (obj).obmeta.base # <<<<<<<<<<<<<< + * + * +*/ + __pyx_r = ((NPY_DATETIMEUNIT)((PyDatetimeScalarObject *)__pyx_v_obj)->obmeta.base); + goto __pyx_L0; + + /* "C:/Users/runneradmin/AppData/Local/Temp/build-env-ej_q3m8u/Lib/site-packages/numpy/__init__.cython-30.pxd":1072 + * + * + * cdef inline NPY_DATETIMEUNIT get_datetime64_unit(object obj) noexcept nogil: # <<<<<<<<<<<<<< + * """ + * returns the unit part of the dtype for a numpy datetime64 object. +*/ + + /* function exit code */ + __pyx_L0:; + return __pyx_r; +} + +/* "lexeme.pxd":29 + * cdef readonly attr_t orth + * + * @staticmethod # <<<<<<<<<<<<<< + * cdef inline Lexeme from_ptr(LexemeC* lex, Vocab vocab): + * cdef Lexeme self = Lexeme.__new__(Lexeme, vocab, lex.orth) +*/ + +static CYTHON_INLINE struct __pyx_obj_5spacy_6lexeme_Lexeme *__pyx_f_5spacy_6lexeme_6Lexeme_from_ptr(struct __pyx_t_5spacy_7structs_LexemeC *__pyx_v_lex, struct __pyx_obj_5spacy_5vocab_Vocab *__pyx_v_vocab) { + struct __pyx_obj_5spacy_6lexeme_Lexeme *__pyx_v_self = 0; + struct __pyx_obj_5spacy_6lexeme_Lexeme *__pyx_r = NULL; + __Pyx_RefNannyDeclarations + PyObject *__pyx_t_1 = NULL; + PyObject *__pyx_t_2 = NULL; + __pyx_t_5spacy_8typedefs_attr_t __pyx_t_3; + int __pyx_lineno = 0; + const char *__pyx_filename = NULL; + int __pyx_clineno = 0; + __Pyx_RefNannySetupContext("from_ptr", 0); + + /* "lexeme.pxd":31 + * @staticmethod + * cdef inline Lexeme from_ptr(LexemeC* lex, Vocab vocab): + * cdef Lexeme self = Lexeme.__new__(Lexeme, vocab, lex.orth) # <<<<<<<<<<<<<< + * self.c = lex + * self.vocab = vocab +*/ + __pyx_t_1 = __Pyx_PyLong_From_uint64_t(__pyx_v_lex->orth); if (unlikely(!__pyx_t_1)) __PYX_ERR(3, 31, __pyx_L1_error) + __Pyx_GOTREF(__pyx_t_1); + __pyx_t_2 = PyTuple_New(2); if (unlikely(!__pyx_t_2)) __PYX_ERR(3, 31, __pyx_L1_error) + __Pyx_GOTREF(__pyx_t_2); + __Pyx_INCREF((PyObject *)__pyx_v_vocab); + __Pyx_GIVEREF((PyObject *)__pyx_v_vocab); + if (__Pyx_PyTuple_SET_ITEM(__pyx_t_2, 0, ((PyObject *)__pyx_v_vocab)) != (0)) __PYX_ERR(3, 31, __pyx_L1_error); + __Pyx_GIVEREF(__pyx_t_1); + if (__Pyx_PyTuple_SET_ITEM(__pyx_t_2, 1, __pyx_t_1) != (0)) __PYX_ERR(3, 31, __pyx_L1_error); + __pyx_t_1 = 0; + __pyx_t_1 = __Pyx_tp_new(((PyObject *)__pyx_mstate_global->__pyx_ptype_5spacy_6lexeme_Lexeme), ((PyObject*)__pyx_t_2)); if (unlikely(!__pyx_t_1)) __PYX_ERR(3, 31, __pyx_L1_error) + __Pyx_GOTREF(__pyx_t_1); + __Pyx_DECREF(__pyx_t_2); __pyx_t_2 = 0; + if (!(likely(__Pyx_TypeTest(__pyx_t_1, __pyx_mstate_global->__pyx_ptype_5spacy_6lexeme_Lexeme)))) __PYX_ERR(3, 31, __pyx_L1_error) + __pyx_v_self = ((struct __pyx_obj_5spacy_6lexeme_Lexeme *)__pyx_t_1); + __pyx_t_1 = 0; + + /* "lexeme.pxd":32 + * cdef inline Lexeme from_ptr(LexemeC* lex, Vocab vocab): + * cdef Lexeme self = Lexeme.__new__(Lexeme, vocab, lex.orth) + * self.c = lex # <<<<<<<<<<<<<< + * self.vocab = vocab + * self.orth = lex.orth +*/ + __pyx_v_self->c = __pyx_v_lex; + + /* "lexeme.pxd":33 + * cdef Lexeme self = Lexeme.__new__(Lexeme, vocab, lex.orth) + * self.c = lex + * self.vocab = vocab # <<<<<<<<<<<<<< + * self.orth = lex.orth + * return self +*/ + __Pyx_INCREF((PyObject *)__pyx_v_vocab); + __Pyx_GIVEREF((PyObject *)__pyx_v_vocab); + __Pyx_GOTREF((PyObject *)__pyx_v_self->vocab); + __Pyx_DECREF((PyObject *)__pyx_v_self->vocab); + __pyx_v_self->vocab = __pyx_v_vocab; + + /* "lexeme.pxd":34 + * self.c = lex + * self.vocab = vocab + * self.orth = lex.orth # <<<<<<<<<<<<<< + * return self + * +*/ + __pyx_t_3 = __pyx_v_lex->orth; + __pyx_v_self->orth = __pyx_t_3; + + /* "lexeme.pxd":35 + * self.vocab = vocab + * self.orth = lex.orth + * return self # <<<<<<<<<<<<<< + * + * @staticmethod +*/ + __Pyx_XDECREF((PyObject *)__pyx_r); + __Pyx_INCREF((PyObject *)__pyx_v_self); + __pyx_r = __pyx_v_self; + goto __pyx_L0; + + /* "lexeme.pxd":29 + * cdef readonly attr_t orth + * + * @staticmethod # <<<<<<<<<<<<<< + * cdef inline Lexeme from_ptr(LexemeC* lex, Vocab vocab): + * cdef Lexeme self = Lexeme.__new__(Lexeme, vocab, lex.orth) +*/ + + /* function exit code */ + __pyx_L1_error:; + __Pyx_XDECREF(__pyx_t_1); + __Pyx_XDECREF(__pyx_t_2); + __Pyx_AddTraceback("spacy.lexeme.Lexeme.from_ptr", __pyx_clineno, __pyx_lineno, __pyx_filename); + __pyx_r = 0; + __pyx_L0:; + __Pyx_XDECREF((PyObject *)__pyx_v_self); + __Pyx_XGIVEREF((PyObject *)__pyx_r); + __Pyx_RefNannyFinishContext(); + return __pyx_r; +} + +/* "lexeme.pxd":37 + * return self + * + * @staticmethod # <<<<<<<<<<<<<< + * cdef inline void set_struct_attr(LexemeC* lex, attr_id_t name, attr_t value) noexcept nogil: + * if name < (sizeof(flags_t) * 8): +*/ + +static CYTHON_INLINE void __pyx_f_5spacy_6lexeme_6Lexeme_set_struct_attr(struct __pyx_t_5spacy_7structs_LexemeC *__pyx_v_lex, enum __pyx_t_5spacy_5attrs_attr_id_t __pyx_v_name, __pyx_t_5spacy_8typedefs_attr_t __pyx_v_value) { + int __pyx_t_1; + + /* "lexeme.pxd":39 + * @staticmethod + * cdef inline void set_struct_attr(LexemeC* lex, attr_id_t name, attr_t value) noexcept nogil: + * if name < (sizeof(flags_t) * 8): # <<<<<<<<<<<<<< + * Lexeme.c_set_flag(lex, name, value) + * elif name == ID: +*/ + __pyx_t_1 = (__pyx_v_name < ((sizeof(__pyx_t_5spacy_8typedefs_flags_t)) * 8)); + if (__pyx_t_1) { + + /* "lexeme.pxd":40 + * cdef inline void set_struct_attr(LexemeC* lex, attr_id_t name, attr_t value) noexcept nogil: + * if name < (sizeof(flags_t) * 8): + * Lexeme.c_set_flag(lex, name, value) # <<<<<<<<<<<<<< + * elif name == ID: + * lex.id = value +*/ + (void)(__pyx_f_5spacy_6lexeme_6Lexeme_c_set_flag(__pyx_v_lex, __pyx_v_name, __pyx_v_value)); + + /* "lexeme.pxd":39 + * @staticmethod + * cdef inline void set_struct_attr(LexemeC* lex, attr_id_t name, attr_t value) noexcept nogil: + * if name < (sizeof(flags_t) * 8): # <<<<<<<<<<<<<< + * Lexeme.c_set_flag(lex, name, value) + * elif name == ID: +*/ + goto __pyx_L3; + } + + /* "lexeme.pxd":41 + * if name < (sizeof(flags_t) * 8): + * Lexeme.c_set_flag(lex, name, value) + * elif name == ID: # <<<<<<<<<<<<<< + * lex.id = value + * elif name == LOWER: +*/ + __pyx_t_1 = (__pyx_v_name == __pyx_e_5spacy_5attrs_ID); + if (__pyx_t_1) { + + /* "lexeme.pxd":42 + * Lexeme.c_set_flag(lex, name, value) + * elif name == ID: + * lex.id = value # <<<<<<<<<<<<<< + * elif name == LOWER: + * lex.lower = value +*/ + __pyx_v_lex->id = __pyx_v_value; + + /* "lexeme.pxd":41 + * if name < (sizeof(flags_t) * 8): + * Lexeme.c_set_flag(lex, name, value) + * elif name == ID: # <<<<<<<<<<<<<< + * lex.id = value + * elif name == LOWER: +*/ + goto __pyx_L3; + } + + /* "lexeme.pxd":43 + * elif name == ID: + * lex.id = value + * elif name == LOWER: # <<<<<<<<<<<<<< + * lex.lower = value + * elif name == NORM: +*/ + __pyx_t_1 = (__pyx_v_name == __pyx_e_5spacy_5attrs_LOWER); + if (__pyx_t_1) { + + /* "lexeme.pxd":44 + * lex.id = value + * elif name == LOWER: + * lex.lower = value # <<<<<<<<<<<<<< + * elif name == NORM: + * lex.norm = value +*/ + __pyx_v_lex->lower = __pyx_v_value; + + /* "lexeme.pxd":43 + * elif name == ID: + * lex.id = value + * elif name == LOWER: # <<<<<<<<<<<<<< + * lex.lower = value + * elif name == NORM: +*/ + goto __pyx_L3; + } + + /* "lexeme.pxd":45 + * elif name == LOWER: + * lex.lower = value + * elif name == NORM: # <<<<<<<<<<<<<< + * lex.norm = value + * elif name == SHAPE: +*/ + __pyx_t_1 = (__pyx_v_name == __pyx_e_5spacy_5attrs_NORM); + if (__pyx_t_1) { + + /* "lexeme.pxd":46 + * lex.lower = value + * elif name == NORM: + * lex.norm = value # <<<<<<<<<<<<<< + * elif name == SHAPE: + * lex.shape = value +*/ + __pyx_v_lex->norm = __pyx_v_value; + + /* "lexeme.pxd":45 + * elif name == LOWER: + * lex.lower = value + * elif name == NORM: # <<<<<<<<<<<<<< + * lex.norm = value + * elif name == SHAPE: +*/ + goto __pyx_L3; + } + + /* "lexeme.pxd":47 + * elif name == NORM: + * lex.norm = value + * elif name == SHAPE: # <<<<<<<<<<<<<< + * lex.shape = value + * elif name == PREFIX: +*/ + __pyx_t_1 = (__pyx_v_name == __pyx_e_5spacy_5attrs_SHAPE); + if (__pyx_t_1) { + + /* "lexeme.pxd":48 + * lex.norm = value + * elif name == SHAPE: + * lex.shape = value # <<<<<<<<<<<<<< + * elif name == PREFIX: + * lex.prefix = value +*/ + __pyx_v_lex->shape = __pyx_v_value; + + /* "lexeme.pxd":47 + * elif name == NORM: + * lex.norm = value + * elif name == SHAPE: # <<<<<<<<<<<<<< + * lex.shape = value + * elif name == PREFIX: +*/ + goto __pyx_L3; + } + + /* "lexeme.pxd":49 + * elif name == SHAPE: + * lex.shape = value + * elif name == PREFIX: # <<<<<<<<<<<<<< + * lex.prefix = value + * elif name == SUFFIX: +*/ + __pyx_t_1 = (__pyx_v_name == __pyx_e_5spacy_5attrs_PREFIX); + if (__pyx_t_1) { + + /* "lexeme.pxd":50 + * lex.shape = value + * elif name == PREFIX: + * lex.prefix = value # <<<<<<<<<<<<<< + * elif name == SUFFIX: + * lex.suffix = value +*/ + __pyx_v_lex->prefix = __pyx_v_value; + + /* "lexeme.pxd":49 + * elif name == SHAPE: + * lex.shape = value + * elif name == PREFIX: # <<<<<<<<<<<<<< + * lex.prefix = value + * elif name == SUFFIX: +*/ + goto __pyx_L3; + } + + /* "lexeme.pxd":51 + * elif name == PREFIX: + * lex.prefix = value + * elif name == SUFFIX: # <<<<<<<<<<<<<< + * lex.suffix = value + * elif name == LANG: +*/ + __pyx_t_1 = (__pyx_v_name == __pyx_e_5spacy_5attrs_SUFFIX); + if (__pyx_t_1) { + + /* "lexeme.pxd":52 + * lex.prefix = value + * elif name == SUFFIX: + * lex.suffix = value # <<<<<<<<<<<<<< + * elif name == LANG: + * lex.lang = value +*/ + __pyx_v_lex->suffix = __pyx_v_value; + + /* "lexeme.pxd":51 + * elif name == PREFIX: + * lex.prefix = value + * elif name == SUFFIX: # <<<<<<<<<<<<<< + * lex.suffix = value + * elif name == LANG: +*/ + goto __pyx_L3; + } + + /* "lexeme.pxd":53 + * elif name == SUFFIX: + * lex.suffix = value + * elif name == LANG: # <<<<<<<<<<<<<< + * lex.lang = value + * +*/ + __pyx_t_1 = (__pyx_v_name == __pyx_e_5spacy_5attrs_LANG); + if (__pyx_t_1) { + + /* "lexeme.pxd":54 + * lex.suffix = value + * elif name == LANG: + * lex.lang = value # <<<<<<<<<<<<<< + * + * @staticmethod +*/ + __pyx_v_lex->lang = __pyx_v_value; + + /* "lexeme.pxd":53 + * elif name == SUFFIX: + * lex.suffix = value + * elif name == LANG: # <<<<<<<<<<<<<< + * lex.lang = value + * +*/ + } + __pyx_L3:; + + /* "lexeme.pxd":37 + * return self + * + * @staticmethod # <<<<<<<<<<<<<< + * cdef inline void set_struct_attr(LexemeC* lex, attr_id_t name, attr_t value) noexcept nogil: + * if name < (sizeof(flags_t) * 8): +*/ + + /* function exit code */ +} + +/* "lexeme.pxd":56 + * lex.lang = value + * + * @staticmethod # <<<<<<<<<<<<<< + * cdef inline attr_t get_struct_attr(const LexemeC* lex, attr_id_t feat_name) noexcept nogil: + * if feat_name < (sizeof(flags_t) * 8): +*/ + +static CYTHON_INLINE __pyx_t_5spacy_8typedefs_attr_t __pyx_f_5spacy_6lexeme_6Lexeme_get_struct_attr(struct __pyx_t_5spacy_7structs_LexemeC const *__pyx_v_lex, enum __pyx_t_5spacy_5attrs_attr_id_t __pyx_v_feat_name) { + __pyx_t_5spacy_8typedefs_attr_t __pyx_r; + int __pyx_t_1; + + /* "lexeme.pxd":58 + * @staticmethod + * cdef inline attr_t get_struct_attr(const LexemeC* lex, attr_id_t feat_name) noexcept nogil: + * if feat_name < (sizeof(flags_t) * 8): # <<<<<<<<<<<<<< + * if Lexeme.c_check_flag(lex, feat_name): + * return 1 +*/ + __pyx_t_1 = (__pyx_v_feat_name < ((sizeof(__pyx_t_5spacy_8typedefs_flags_t)) * 8)); + if (__pyx_t_1) { + + /* "lexeme.pxd":59 + * cdef inline attr_t get_struct_attr(const LexemeC* lex, attr_id_t feat_name) noexcept nogil: + * if feat_name < (sizeof(flags_t) * 8): + * if Lexeme.c_check_flag(lex, feat_name): # <<<<<<<<<<<<<< + * return 1 + * else: +*/ + __pyx_t_1 = __pyx_f_5spacy_6lexeme_6Lexeme_c_check_flag(__pyx_v_lex, __pyx_v_feat_name); + if (__pyx_t_1) { + + /* "lexeme.pxd":60 + * if feat_name < (sizeof(flags_t) * 8): + * if Lexeme.c_check_flag(lex, feat_name): + * return 1 # <<<<<<<<<<<<<< + * else: + * return 0 +*/ + __pyx_r = 1; + goto __pyx_L0; + + /* "lexeme.pxd":59 + * cdef inline attr_t get_struct_attr(const LexemeC* lex, attr_id_t feat_name) noexcept nogil: + * if feat_name < (sizeof(flags_t) * 8): + * if Lexeme.c_check_flag(lex, feat_name): # <<<<<<<<<<<<<< + * return 1 + * else: +*/ + } + + /* "lexeme.pxd":62 + * return 1 + * else: + * return 0 # <<<<<<<<<<<<<< + * elif feat_name == ID: + * return lex.id +*/ + /*else*/ { + __pyx_r = 0; + goto __pyx_L0; + } + + /* "lexeme.pxd":58 + * @staticmethod + * cdef inline attr_t get_struct_attr(const LexemeC* lex, attr_id_t feat_name) noexcept nogil: + * if feat_name < (sizeof(flags_t) * 8): # <<<<<<<<<<<<<< + * if Lexeme.c_check_flag(lex, feat_name): + * return 1 +*/ + } + + /* "lexeme.pxd":63 + * else: + * return 0 + * elif feat_name == ID: # <<<<<<<<<<<<<< + * return lex.id + * elif feat_name == ORTH: +*/ + __pyx_t_1 = (__pyx_v_feat_name == __pyx_e_5spacy_5attrs_ID); + if (__pyx_t_1) { + + /* "lexeme.pxd":64 + * return 0 + * elif feat_name == ID: + * return lex.id # <<<<<<<<<<<<<< + * elif feat_name == ORTH: + * return lex.orth +*/ + __pyx_r = __pyx_v_lex->id; + goto __pyx_L0; + + /* "lexeme.pxd":63 + * else: + * return 0 + * elif feat_name == ID: # <<<<<<<<<<<<<< + * return lex.id + * elif feat_name == ORTH: +*/ + } + + /* "lexeme.pxd":65 + * elif feat_name == ID: + * return lex.id + * elif feat_name == ORTH: # <<<<<<<<<<<<<< + * return lex.orth + * elif feat_name == LOWER: +*/ + __pyx_t_1 = (__pyx_v_feat_name == __pyx_e_5spacy_5attrs_ORTH); + if (__pyx_t_1) { + + /* "lexeme.pxd":66 + * return lex.id + * elif feat_name == ORTH: + * return lex.orth # <<<<<<<<<<<<<< + * elif feat_name == LOWER: + * return lex.lower +*/ + __pyx_r = __pyx_v_lex->orth; + goto __pyx_L0; + + /* "lexeme.pxd":65 + * elif feat_name == ID: + * return lex.id + * elif feat_name == ORTH: # <<<<<<<<<<<<<< + * return lex.orth + * elif feat_name == LOWER: +*/ + } + + /* "lexeme.pxd":67 + * elif feat_name == ORTH: + * return lex.orth + * elif feat_name == LOWER: # <<<<<<<<<<<<<< + * return lex.lower + * elif feat_name == NORM: +*/ + __pyx_t_1 = (__pyx_v_feat_name == __pyx_e_5spacy_5attrs_LOWER); + if (__pyx_t_1) { + + /* "lexeme.pxd":68 + * return lex.orth + * elif feat_name == LOWER: + * return lex.lower # <<<<<<<<<<<<<< + * elif feat_name == NORM: + * return lex.norm +*/ + __pyx_r = __pyx_v_lex->lower; + goto __pyx_L0; + + /* "lexeme.pxd":67 + * elif feat_name == ORTH: + * return lex.orth + * elif feat_name == LOWER: # <<<<<<<<<<<<<< + * return lex.lower + * elif feat_name == NORM: +*/ + } + + /* "lexeme.pxd":69 + * elif feat_name == LOWER: + * return lex.lower + * elif feat_name == NORM: # <<<<<<<<<<<<<< + * return lex.norm + * elif feat_name == SHAPE: +*/ + __pyx_t_1 = (__pyx_v_feat_name == __pyx_e_5spacy_5attrs_NORM); + if (__pyx_t_1) { + + /* "lexeme.pxd":70 + * return lex.lower + * elif feat_name == NORM: + * return lex.norm # <<<<<<<<<<<<<< + * elif feat_name == SHAPE: + * return lex.shape +*/ + __pyx_r = __pyx_v_lex->norm; + goto __pyx_L0; + + /* "lexeme.pxd":69 + * elif feat_name == LOWER: + * return lex.lower + * elif feat_name == NORM: # <<<<<<<<<<<<<< + * return lex.norm + * elif feat_name == SHAPE: +*/ + } + + /* "lexeme.pxd":71 + * elif feat_name == NORM: + * return lex.norm + * elif feat_name == SHAPE: # <<<<<<<<<<<<<< + * return lex.shape + * elif feat_name == PREFIX: +*/ + __pyx_t_1 = (__pyx_v_feat_name == __pyx_e_5spacy_5attrs_SHAPE); + if (__pyx_t_1) { + + /* "lexeme.pxd":72 + * return lex.norm + * elif feat_name == SHAPE: + * return lex.shape # <<<<<<<<<<<<<< + * elif feat_name == PREFIX: + * return lex.prefix +*/ + __pyx_r = __pyx_v_lex->shape; + goto __pyx_L0; + + /* "lexeme.pxd":71 + * elif feat_name == NORM: + * return lex.norm + * elif feat_name == SHAPE: # <<<<<<<<<<<<<< + * return lex.shape + * elif feat_name == PREFIX: +*/ + } + + /* "lexeme.pxd":73 + * elif feat_name == SHAPE: + * return lex.shape + * elif feat_name == PREFIX: # <<<<<<<<<<<<<< + * return lex.prefix + * elif feat_name == SUFFIX: +*/ + __pyx_t_1 = (__pyx_v_feat_name == __pyx_e_5spacy_5attrs_PREFIX); + if (__pyx_t_1) { + + /* "lexeme.pxd":74 + * return lex.shape + * elif feat_name == PREFIX: + * return lex.prefix # <<<<<<<<<<<<<< + * elif feat_name == SUFFIX: + * return lex.suffix +*/ + __pyx_r = __pyx_v_lex->prefix; + goto __pyx_L0; + + /* "lexeme.pxd":73 + * elif feat_name == SHAPE: + * return lex.shape + * elif feat_name == PREFIX: # <<<<<<<<<<<<<< + * return lex.prefix + * elif feat_name == SUFFIX: +*/ + } + + /* "lexeme.pxd":75 + * elif feat_name == PREFIX: + * return lex.prefix + * elif feat_name == SUFFIX: # <<<<<<<<<<<<<< + * return lex.suffix + * elif feat_name == LENGTH: +*/ + __pyx_t_1 = (__pyx_v_feat_name == __pyx_e_5spacy_5attrs_SUFFIX); + if (__pyx_t_1) { + + /* "lexeme.pxd":76 + * return lex.prefix + * elif feat_name == SUFFIX: + * return lex.suffix # <<<<<<<<<<<<<< + * elif feat_name == LENGTH: + * return lex.length +*/ + __pyx_r = __pyx_v_lex->suffix; + goto __pyx_L0; + + /* "lexeme.pxd":75 + * elif feat_name == PREFIX: + * return lex.prefix + * elif feat_name == SUFFIX: # <<<<<<<<<<<<<< + * return lex.suffix + * elif feat_name == LENGTH: +*/ + } + + /* "lexeme.pxd":77 + * elif feat_name == SUFFIX: + * return lex.suffix + * elif feat_name == LENGTH: # <<<<<<<<<<<<<< + * return lex.length + * elif feat_name == LANG: +*/ + __pyx_t_1 = (__pyx_v_feat_name == __pyx_e_5spacy_5attrs_LENGTH); + if (__pyx_t_1) { + + /* "lexeme.pxd":78 + * return lex.suffix + * elif feat_name == LENGTH: + * return lex.length # <<<<<<<<<<<<<< + * elif feat_name == LANG: + * return lex.lang +*/ + __pyx_r = __pyx_v_lex->length; + goto __pyx_L0; + + /* "lexeme.pxd":77 + * elif feat_name == SUFFIX: + * return lex.suffix + * elif feat_name == LENGTH: # <<<<<<<<<<<<<< + * return lex.length + * elif feat_name == LANG: +*/ + } + + /* "lexeme.pxd":79 + * elif feat_name == LENGTH: + * return lex.length + * elif feat_name == LANG: # <<<<<<<<<<<<<< + * return lex.lang + * else: +*/ + __pyx_t_1 = (__pyx_v_feat_name == __pyx_e_5spacy_5attrs_LANG); + if (__pyx_t_1) { + + /* "lexeme.pxd":80 + * return lex.length + * elif feat_name == LANG: + * return lex.lang # <<<<<<<<<<<<<< + * else: + * return 0 +*/ + __pyx_r = __pyx_v_lex->lang; + goto __pyx_L0; + + /* "lexeme.pxd":79 + * elif feat_name == LENGTH: + * return lex.length + * elif feat_name == LANG: # <<<<<<<<<<<<<< + * return lex.lang + * else: +*/ + } + + /* "lexeme.pxd":82 + * return lex.lang + * else: + * return 0 # <<<<<<<<<<<<<< + * + * @staticmethod +*/ + /*else*/ { + __pyx_r = 0; + goto __pyx_L0; + } + + /* "lexeme.pxd":56 + * lex.lang = value + * + * @staticmethod # <<<<<<<<<<<<<< + * cdef inline attr_t get_struct_attr(const LexemeC* lex, attr_id_t feat_name) noexcept nogil: + * if feat_name < (sizeof(flags_t) * 8): +*/ + + /* function exit code */ + __pyx_L0:; + return __pyx_r; +} + +/* "lexeme.pxd":84 + * return 0 + * + * @staticmethod # <<<<<<<<<<<<<< + * cdef inline bint c_check_flag(const LexemeC* lexeme, attr_id_t flag_id) noexcept nogil: + * cdef flags_t one = 1 +*/ + +static CYTHON_INLINE int __pyx_f_5spacy_6lexeme_6Lexeme_c_check_flag(struct __pyx_t_5spacy_7structs_LexemeC const *__pyx_v_lexeme, enum __pyx_t_5spacy_5attrs_attr_id_t __pyx_v_flag_id) { + __pyx_t_5spacy_8typedefs_flags_t __pyx_v_one; + int __pyx_r; + int __pyx_t_1; + + /* "lexeme.pxd":86 + * @staticmethod + * cdef inline bint c_check_flag(const LexemeC* lexeme, attr_id_t flag_id) noexcept nogil: + * cdef flags_t one = 1 # <<<<<<<<<<<<<< + * if lexeme.flags & (one << flag_id): + * return True +*/ + __pyx_v_one = 1; + + /* "lexeme.pxd":87 + * cdef inline bint c_check_flag(const LexemeC* lexeme, attr_id_t flag_id) noexcept nogil: + * cdef flags_t one = 1 + * if lexeme.flags & (one << flag_id): # <<<<<<<<<<<<<< + * return True + * else: +*/ + __pyx_t_1 = ((__pyx_v_lexeme->flags & (__pyx_v_one << __pyx_v_flag_id)) != 0); + if (__pyx_t_1) { + + /* "lexeme.pxd":88 + * cdef flags_t one = 1 + * if lexeme.flags & (one << flag_id): + * return True # <<<<<<<<<<<<<< + * else: + * return False +*/ + __pyx_r = 1; + goto __pyx_L0; + + /* "lexeme.pxd":87 + * cdef inline bint c_check_flag(const LexemeC* lexeme, attr_id_t flag_id) noexcept nogil: + * cdef flags_t one = 1 + * if lexeme.flags & (one << flag_id): # <<<<<<<<<<<<<< + * return True + * else: +*/ + } + + /* "lexeme.pxd":90 + * return True + * else: + * return False # <<<<<<<<<<<<<< + * + * @staticmethod +*/ + /*else*/ { + __pyx_r = 0; + goto __pyx_L0; + } + + /* "lexeme.pxd":84 + * return 0 + * + * @staticmethod # <<<<<<<<<<<<<< + * cdef inline bint c_check_flag(const LexemeC* lexeme, attr_id_t flag_id) noexcept nogil: + * cdef flags_t one = 1 +*/ + + /* function exit code */ + __pyx_L0:; + return __pyx_r; +} + +/* "lexeme.pxd":92 + * return False + * + * @staticmethod # <<<<<<<<<<<<<< + * cdef inline bint c_set_flag(LexemeC* lex, attr_id_t flag_id, bint value) noexcept nogil: + * cdef flags_t one = 1 +*/ + +static CYTHON_INLINE int __pyx_f_5spacy_6lexeme_6Lexeme_c_set_flag(struct __pyx_t_5spacy_7structs_LexemeC *__pyx_v_lex, enum __pyx_t_5spacy_5attrs_attr_id_t __pyx_v_flag_id, int __pyx_v_value) { + __pyx_t_5spacy_8typedefs_flags_t __pyx_v_one; + int __pyx_r; + + /* "lexeme.pxd":94 + * @staticmethod + * cdef inline bint c_set_flag(LexemeC* lex, attr_id_t flag_id, bint value) noexcept nogil: + * cdef flags_t one = 1 # <<<<<<<<<<<<<< + * if value: + * lex.flags |= one << flag_id +*/ + __pyx_v_one = 1; + + /* "lexeme.pxd":95 + * cdef inline bint c_set_flag(LexemeC* lex, attr_id_t flag_id, bint value) noexcept nogil: + * cdef flags_t one = 1 + * if value: # <<<<<<<<<<<<<< + * lex.flags |= one << flag_id + * else: +*/ + if (__pyx_v_value) { + + /* "lexeme.pxd":96 + * cdef flags_t one = 1 + * if value: + * lex.flags |= one << flag_id # <<<<<<<<<<<<<< + * else: + * lex.flags &= ~(one << flag_id) +*/ + __pyx_v_lex->flags = (__pyx_v_lex->flags | (__pyx_v_one << __pyx_v_flag_id)); + + /* "lexeme.pxd":95 + * cdef inline bint c_set_flag(LexemeC* lex, attr_id_t flag_id, bint value) noexcept nogil: + * cdef flags_t one = 1 + * if value: # <<<<<<<<<<<<<< + * lex.flags |= one << flag_id + * else: +*/ + goto __pyx_L3; + } + + /* "lexeme.pxd":98 + * lex.flags |= one << flag_id + * else: + * lex.flags &= ~(one << flag_id) # <<<<<<<<<<<<<< +*/ + /*else*/ { + __pyx_v_lex->flags = (__pyx_v_lex->flags & (~(__pyx_v_one << __pyx_v_flag_id))); + } + __pyx_L3:; + + /* "lexeme.pxd":92 + * return False + * + * @staticmethod # <<<<<<<<<<<<<< + * cdef inline bint c_set_flag(LexemeC* lex, attr_id_t flag_id, bint value) noexcept nogil: + * cdef flags_t one = 1 +*/ + + /* function exit code */ + __pyx_r = 0; + return __pyx_r; +} + +/* "_state.pxd":20 + * + * + * cdef inline bint is_space_token(const TokenC* token) noexcept nogil: # <<<<<<<<<<<<<< + * return Lexeme.c_check_flag(token.lex, IS_SPACE) + * +*/ + +static CYTHON_INLINE int __pyx_f_5spacy_8pipeline_17_parser_internals_6_state_is_space_token(struct __pyx_t_5spacy_7structs_TokenC const *__pyx_v_token) { + int __pyx_r; + + /* "_state.pxd":21 + * + * cdef inline bint is_space_token(const TokenC* token) noexcept nogil: + * return Lexeme.c_check_flag(token.lex, IS_SPACE) # <<<<<<<<<<<<<< + * + * cdef struct ArcC: +*/ + __pyx_r = __pyx_f_5spacy_6lexeme_6Lexeme_c_check_flag(__pyx_v_token->lex, __pyx_e_5spacy_5attrs_IS_SPACE); + goto __pyx_L0; + + /* "_state.pxd":20 + * + * + * cdef inline bint is_space_token(const TokenC* token) noexcept nogil: # <<<<<<<<<<<<<< + * return Lexeme.c_check_flag(token.lex, IS_SPACE) + * +*/ + + /* function exit code */ + __pyx_L0:; + return __pyx_r; +} + +/* "_state.pxd":44 + * int _b_i + * + * inline __init__(const TokenC* sent, int length) noexcept nogil: # <<<<<<<<<<<<<< + * this._sent = sent + * this._heads = calloc(length, sizeof(int)) +*/ + +void __pyx_t_5spacy_8pipeline_17_parser_internals_6_state_StateC::__pyx_f___init__StateC(struct __pyx_t_5spacy_7structs_TokenC const *__pyx_v_sent, int __pyx_v_length) { + int __pyx_v_i; + int __pyx_t_1; + int __pyx_t_2; + PyObject *__pyx_t_3; + int __pyx_t_4; + int __pyx_t_5; + int __pyx_t_6; + int __pyx_lineno = 0; + const char *__pyx_filename = NULL; + int __pyx_clineno = 0; + PyGILState_STATE __pyx_gilstate_save; + + /* "_state.pxd":45 + * + * inline __init__(const TokenC* sent, int length) noexcept nogil: + * this._sent = sent # <<<<<<<<<<<<<< + * this._heads = calloc(length, sizeof(int)) + * if not (this._sent and this._heads): +*/ + this->_sent = __pyx_v_sent; + + /* "_state.pxd":46 + * inline __init__(const TokenC* sent, int length) noexcept nogil: + * this._sent = sent + * this._heads = calloc(length, sizeof(int)) # <<<<<<<<<<<<<< + * if not (this._sent and this._heads): + * with gil: +*/ + this->_heads = ((int *)calloc(__pyx_v_length, (sizeof(int)))); + + /* "_state.pxd":47 + * this._sent = sent + * this._heads = calloc(length, sizeof(int)) + * if not (this._sent and this._heads): # <<<<<<<<<<<<<< + * with gil: + * PyErr_SetFromErrno(MemoryError) +*/ + __pyx_t_2 = (this->_sent != 0); + if (__pyx_t_2) { + } else { + __pyx_t_1 = __pyx_t_2; + goto __pyx_L4_bool_binop_done; + } + __pyx_t_2 = (this->_heads != 0); + __pyx_t_1 = __pyx_t_2; + __pyx_L4_bool_binop_done:; + __pyx_t_2 = (!__pyx_t_1); + if (__pyx_t_2) { + + /* "_state.pxd":48 + * this._heads = calloc(length, sizeof(int)) + * if not (this._sent and this._heads): + * with gil: # <<<<<<<<<<<<<< + * PyErr_SetFromErrno(MemoryError) + * PyErr_CheckSignals() +*/ + { + PyGILState_STATE __pyx_gilstate_save = __Pyx_PyGILState_Ensure(); + /*try:*/ { + + /* "_state.pxd":49 + * if not (this._sent and this._heads): + * with gil: + * PyErr_SetFromErrno(MemoryError) # <<<<<<<<<<<<<< + * PyErr_CheckSignals() + * this.offset = 0 +*/ + __pyx_t_3 = PyErr_SetFromErrno(((PyObject *)(((PyTypeObject*)PyExc_MemoryError)))); if (unlikely(__pyx_t_3 == ((void *)NULL))) __PYX_ERR(4, 49, __pyx_L7_error) + + /* "_state.pxd":50 + * with gil: + * PyErr_SetFromErrno(MemoryError) + * PyErr_CheckSignals() # <<<<<<<<<<<<<< + * this.offset = 0 + * this.length = length +*/ + __pyx_t_4 = PyErr_CheckSignals(); if (unlikely(__pyx_t_4 == ((int)-1))) __PYX_ERR(4, 50, __pyx_L7_error) + } + + /* "_state.pxd":48 + * this._heads = calloc(length, sizeof(int)) + * if not (this._sent and this._heads): + * with gil: # <<<<<<<<<<<<<< + * PyErr_SetFromErrno(MemoryError) + * PyErr_CheckSignals() +*/ + /*finally:*/ { + /*normal exit:*/{ + __Pyx_PyGILState_Release(__pyx_gilstate_save); + goto __pyx_L8; + } + __pyx_L7_error: { + __Pyx_PyGILState_Release(__pyx_gilstate_save); + goto __pyx_L1_error; + } + __pyx_L8:; + } + } + + /* "_state.pxd":47 + * this._sent = sent + * this._heads = calloc(length, sizeof(int)) + * if not (this._sent and this._heads): # <<<<<<<<<<<<<< + * with gil: + * PyErr_SetFromErrno(MemoryError) +*/ + } + + /* "_state.pxd":51 + * PyErr_SetFromErrno(MemoryError) + * PyErr_CheckSignals() + * this.offset = 0 # <<<<<<<<<<<<<< + * this.length = length + * this._b_i = 0 +*/ + this->offset = 0; + + /* "_state.pxd":52 + * PyErr_CheckSignals() + * this.offset = 0 + * this.length = length # <<<<<<<<<<<<<< + * this._b_i = 0 + * for i in range(length): +*/ + this->length = __pyx_v_length; + + /* "_state.pxd":53 + * this.offset = 0 + * this.length = length + * this._b_i = 0 # <<<<<<<<<<<<<< + * for i in range(length): + * this._heads[i] = -1 +*/ + this->_b_i = 0; + + /* "_state.pxd":54 + * this.length = length + * this._b_i = 0 + * for i in range(length): # <<<<<<<<<<<<<< + * this._heads[i] = -1 + * this._unshiftable.push_back(0) +*/ + __pyx_t_4 = __pyx_v_length; + __pyx_t_5 = __pyx_t_4; + for (__pyx_t_6 = 0; __pyx_t_6 < __pyx_t_5; __pyx_t_6+=1) { + __pyx_v_i = __pyx_t_6; + + /* "_state.pxd":55 + * this._b_i = 0 + * for i in range(length): + * this._heads[i] = -1 # <<<<<<<<<<<<<< + * this._unshiftable.push_back(0) + * memset(&this._empty_token, 0, sizeof(TokenC)) +*/ + (this->_heads[__pyx_v_i]) = -1; + + /* "_state.pxd":56 + * for i in range(length): + * this._heads[i] = -1 + * this._unshiftable.push_back(0) # <<<<<<<<<<<<<< + * memset(&this._empty_token, 0, sizeof(TokenC)) + * this._empty_token.lex = &EMPTY_LEXEME +*/ + try { + this->_unshiftable.push_back(0); + } catch(...) { + PyGILState_STATE __pyx_gilstate_save = __Pyx_PyGILState_Ensure(); + __Pyx_CppExn2PyErr(); + __Pyx_PyGILState_Release(__pyx_gilstate_save); + __PYX_ERR(4, 56, __pyx_L1_error) + } + } + + /* "_state.pxd":57 + * this._heads[i] = -1 + * this._unshiftable.push_back(0) + * memset(&this._empty_token, 0, sizeof(TokenC)) # <<<<<<<<<<<<<< + * this._empty_token.lex = &EMPTY_LEXEME + * +*/ + (void)(memset((&this->_empty_token), 0, (sizeof(struct __pyx_t_5spacy_7structs_TokenC)))); + + /* "_state.pxd":58 + * this._unshiftable.push_back(0) + * memset(&this._empty_token, 0, sizeof(TokenC)) + * this._empty_token.lex = &EMPTY_LEXEME # <<<<<<<<<<<<<< + * + * inline __dealloc__(): +*/ + this->_empty_token.lex = (&__pyx_v_5spacy_5vocab_EMPTY_LEXEME); + + /* "_state.pxd":44 + * int _b_i + * + * inline __init__(const TokenC* sent, int length) noexcept nogil: # <<<<<<<<<<<<<< + * this._sent = sent + * this._heads = calloc(length, sizeof(int)) +*/ + + /* function exit code */ + goto __pyx_L0; + __pyx_L1_error:; + __pyx_gilstate_save = __Pyx_PyGILState_Ensure(); + __Pyx_WriteUnraisable("StateC.", __pyx_clineno, __pyx_lineno, __pyx_filename, 1, 0); + __Pyx_PyGILState_Release(__pyx_gilstate_save); + __pyx_L0:; +} + +/* "_state.pxd":60 + * this._empty_token.lex = &EMPTY_LEXEME + * + * inline __dealloc__(): # <<<<<<<<<<<<<< + * free(this._heads) + * +*/ + +void __pyx_t_5spacy_8pipeline_17_parser_internals_6_state_StateC::__pyx_f___dealloc__StateC(void) { + + /* "_state.pxd":61 + * + * inline __dealloc__(): + * free(this._heads) # <<<<<<<<<<<<<< + * + * inline void set_context_tokens(int* ids, int n) noexcept nogil: +*/ + free(this->_heads); + + /* "_state.pxd":60 + * this._empty_token.lex = &EMPTY_LEXEME + * + * inline __dealloc__(): # <<<<<<<<<<<<<< + * free(this._heads) + * +*/ + + /* function exit code */ +} + +/* "_state.pxd":63 + * free(this._heads) + * + * inline void set_context_tokens(int* ids, int n) noexcept nogil: # <<<<<<<<<<<<<< + * cdef int i, j + * if n == 1: +*/ + +void __pyx_t_5spacy_8pipeline_17_parser_internals_6_state_StateC::set_context_tokens(int *__pyx_v_ids, int __pyx_v_n) { + int __pyx_v_i; + int __pyx_v_j; + struct __pyx_t_5spacy_7structs_SpanC __pyx_v_ent; + int __pyx_t_1; + int __pyx_t_2; + int __pyx_t_3; + int __pyx_t_4; + int __pyx_t_5; + int __pyx_t_6; + + /* "_state.pxd":65 + * inline void set_context_tokens(int* ids, int n) noexcept nogil: + * cdef int i, j + * if n == 1: # <<<<<<<<<<<<<< + * if this.B(0) >= 0: + * ids[0] = this.B(0) +*/ + switch (__pyx_v_n) { + case 1: + + /* "_state.pxd":66 + * cdef int i, j + * if n == 1: + * if this.B(0) >= 0: # <<<<<<<<<<<<<< + * ids[0] = this.B(0) + * else: +*/ + __pyx_t_1 = (this->B(0) >= 0); + if (__pyx_t_1) { + + /* "_state.pxd":67 + * if n == 1: + * if this.B(0) >= 0: + * ids[0] = this.B(0) # <<<<<<<<<<<<<< + * else: + * ids[0] = -1 +*/ + (__pyx_v_ids[0]) = this->B(0); + + /* "_state.pxd":66 + * cdef int i, j + * if n == 1: + * if this.B(0) >= 0: # <<<<<<<<<<<<<< + * ids[0] = this.B(0) + * else: +*/ + goto __pyx_L3; + } + + /* "_state.pxd":69 + * ids[0] = this.B(0) + * else: + * ids[0] = -1 # <<<<<<<<<<<<<< + * elif n == 2: + * ids[0] = this.B(0) +*/ + /*else*/ { + (__pyx_v_ids[0]) = -1; + } + __pyx_L3:; + + /* "_state.pxd":65 + * inline void set_context_tokens(int* ids, int n) noexcept nogil: + * cdef int i, j + * if n == 1: # <<<<<<<<<<<<<< + * if this.B(0) >= 0: + * ids[0] = this.B(0) +*/ + break; + case 2: + + /* "_state.pxd":71 + * ids[0] = -1 + * elif n == 2: + * ids[0] = this.B(0) # <<<<<<<<<<<<<< + * ids[1] = this.S(0) + * elif n == 3: +*/ + (__pyx_v_ids[0]) = this->B(0); + + /* "_state.pxd":72 + * elif n == 2: + * ids[0] = this.B(0) + * ids[1] = this.S(0) # <<<<<<<<<<<<<< + * elif n == 3: + * if this.B(0) >= 0: +*/ + (__pyx_v_ids[1]) = this->S(0); + + /* "_state.pxd":70 + * else: + * ids[0] = -1 + * elif n == 2: # <<<<<<<<<<<<<< + * ids[0] = this.B(0) + * ids[1] = this.S(0) +*/ + break; + case 3: + + /* "_state.pxd":74 + * ids[1] = this.S(0) + * elif n == 3: + * if this.B(0) >= 0: # <<<<<<<<<<<<<< + * ids[0] = this.B(0) + * else: +*/ + __pyx_t_1 = (this->B(0) >= 0); + if (__pyx_t_1) { + + /* "_state.pxd":75 + * elif n == 3: + * if this.B(0) >= 0: + * ids[0] = this.B(0) # <<<<<<<<<<<<<< + * else: + * ids[0] = -1 +*/ + (__pyx_v_ids[0]) = this->B(0); + + /* "_state.pxd":74 + * ids[1] = this.S(0) + * elif n == 3: + * if this.B(0) >= 0: # <<<<<<<<<<<<<< + * ids[0] = this.B(0) + * else: +*/ + goto __pyx_L4; + } + + /* "_state.pxd":77 + * ids[0] = this.B(0) + * else: + * ids[0] = -1 # <<<<<<<<<<<<<< + * # First word of entity, if any + * if this.entity_is_open(): +*/ + /*else*/ { + (__pyx_v_ids[0]) = -1; + } + __pyx_L4:; + + /* "_state.pxd":79 + * ids[0] = -1 + * # First word of entity, if any + * if this.entity_is_open(): # <<<<<<<<<<<<<< + * ids[1] = this.E(0) + * else: +*/ + __pyx_t_1 = this->entity_is_open(); + if (__pyx_t_1) { + + /* "_state.pxd":80 + * # First word of entity, if any + * if this.entity_is_open(): + * ids[1] = this.E(0) # <<<<<<<<<<<<<< + * else: + * ids[1] = -1 +*/ + (__pyx_v_ids[1]) = this->E(0); + + /* "_state.pxd":79 + * ids[0] = -1 + * # First word of entity, if any + * if this.entity_is_open(): # <<<<<<<<<<<<<< + * ids[1] = this.E(0) + * else: +*/ + goto __pyx_L5; + } + + /* "_state.pxd":82 + * ids[1] = this.E(0) + * else: + * ids[1] = -1 # <<<<<<<<<<<<<< + * # Last word of entity, if within entity + * if ids[0] == -1 or ids[1] == -1: +*/ + /*else*/ { + (__pyx_v_ids[1]) = -1; + } + __pyx_L5:; + + /* "_state.pxd":84 + * ids[1] = -1 + * # Last word of entity, if within entity + * if ids[0] == -1 or ids[1] == -1: # <<<<<<<<<<<<<< + * ids[2] = -1 + * else: +*/ + __pyx_t_2 = ((__pyx_v_ids[0]) == -1L); + if (!__pyx_t_2) { + } else { + __pyx_t_1 = __pyx_t_2; + goto __pyx_L7_bool_binop_done; + } + __pyx_t_2 = ((__pyx_v_ids[1]) == -1L); + __pyx_t_1 = __pyx_t_2; + __pyx_L7_bool_binop_done:; + if (__pyx_t_1) { + + /* "_state.pxd":85 + * # Last word of entity, if within entity + * if ids[0] == -1 or ids[1] == -1: + * ids[2] = -1 # <<<<<<<<<<<<<< + * else: + * ids[2] = ids[0] - 1 +*/ + (__pyx_v_ids[2]) = -1; + + /* "_state.pxd":84 + * ids[1] = -1 + * # Last word of entity, if within entity + * if ids[0] == -1 or ids[1] == -1: # <<<<<<<<<<<<<< + * ids[2] = -1 + * else: +*/ + goto __pyx_L6; + } + + /* "_state.pxd":87 + * ids[2] = -1 + * else: + * ids[2] = ids[0] - 1 # <<<<<<<<<<<<<< + * elif n == 8: + * ids[0] = this.B(0) +*/ + /*else*/ { + (__pyx_v_ids[2]) = ((__pyx_v_ids[0]) - 1); + } + __pyx_L6:; + + /* "_state.pxd":73 + * ids[0] = this.B(0) + * ids[1] = this.S(0) + * elif n == 3: # <<<<<<<<<<<<<< + * if this.B(0) >= 0: + * ids[0] = this.B(0) +*/ + break; + case 8: + + /* "_state.pxd":89 + * ids[2] = ids[0] - 1 + * elif n == 8: + * ids[0] = this.B(0) # <<<<<<<<<<<<<< + * ids[1] = this.B(1) + * ids[2] = this.S(0) +*/ + (__pyx_v_ids[0]) = this->B(0); + + /* "_state.pxd":90 + * elif n == 8: + * ids[0] = this.B(0) + * ids[1] = this.B(1) # <<<<<<<<<<<<<< + * ids[2] = this.S(0) + * ids[3] = this.S(1) +*/ + (__pyx_v_ids[1]) = this->B(1); + + /* "_state.pxd":91 + * ids[0] = this.B(0) + * ids[1] = this.B(1) + * ids[2] = this.S(0) # <<<<<<<<<<<<<< + * ids[3] = this.S(1) + * ids[4] = this.S(2) +*/ + (__pyx_v_ids[2]) = this->S(0); + + /* "_state.pxd":92 + * ids[1] = this.B(1) + * ids[2] = this.S(0) + * ids[3] = this.S(1) # <<<<<<<<<<<<<< + * ids[4] = this.S(2) + * ids[5] = this.L(this.B(0), 1) +*/ + (__pyx_v_ids[3]) = this->S(1); + + /* "_state.pxd":93 + * ids[2] = this.S(0) + * ids[3] = this.S(1) + * ids[4] = this.S(2) # <<<<<<<<<<<<<< + * ids[5] = this.L(this.B(0), 1) + * ids[6] = this.L(this.S(0), 1) +*/ + (__pyx_v_ids[4]) = this->S(2); + + /* "_state.pxd":94 + * ids[3] = this.S(1) + * ids[4] = this.S(2) + * ids[5] = this.L(this.B(0), 1) # <<<<<<<<<<<<<< + * ids[6] = this.L(this.S(0), 1) + * ids[7] = this.R(this.S(0), 1) +*/ + (__pyx_v_ids[5]) = this->L(this->B(0), 1); + + /* "_state.pxd":95 + * ids[4] = this.S(2) + * ids[5] = this.L(this.B(0), 1) + * ids[6] = this.L(this.S(0), 1) # <<<<<<<<<<<<<< + * ids[7] = this.R(this.S(0), 1) + * elif n == 13: +*/ + (__pyx_v_ids[6]) = this->L(this->S(0), 1); + + /* "_state.pxd":96 + * ids[5] = this.L(this.B(0), 1) + * ids[6] = this.L(this.S(0), 1) + * ids[7] = this.R(this.S(0), 1) # <<<<<<<<<<<<<< + * elif n == 13: + * ids[0] = this.B(0) +*/ + (__pyx_v_ids[7]) = this->R(this->S(0), 1); + + /* "_state.pxd":88 + * else: + * ids[2] = ids[0] - 1 + * elif n == 8: # <<<<<<<<<<<<<< + * ids[0] = this.B(0) + * ids[1] = this.B(1) +*/ + break; + case 13: + + /* "_state.pxd":98 + * ids[7] = this.R(this.S(0), 1) + * elif n == 13: + * ids[0] = this.B(0) # <<<<<<<<<<<<<< + * ids[1] = this.B(1) + * ids[2] = this.S(0) +*/ + (__pyx_v_ids[0]) = this->B(0); + + /* "_state.pxd":99 + * elif n == 13: + * ids[0] = this.B(0) + * ids[1] = this.B(1) # <<<<<<<<<<<<<< + * ids[2] = this.S(0) + * ids[3] = this.S(1) +*/ + (__pyx_v_ids[1]) = this->B(1); + + /* "_state.pxd":100 + * ids[0] = this.B(0) + * ids[1] = this.B(1) + * ids[2] = this.S(0) # <<<<<<<<<<<<<< + * ids[3] = this.S(1) + * ids[4] = this.S(2) +*/ + (__pyx_v_ids[2]) = this->S(0); + + /* "_state.pxd":101 + * ids[1] = this.B(1) + * ids[2] = this.S(0) + * ids[3] = this.S(1) # <<<<<<<<<<<<<< + * ids[4] = this.S(2) + * ids[5] = this.L(this.S(0), 1) +*/ + (__pyx_v_ids[3]) = this->S(1); + + /* "_state.pxd":102 + * ids[2] = this.S(0) + * ids[3] = this.S(1) + * ids[4] = this.S(2) # <<<<<<<<<<<<<< + * ids[5] = this.L(this.S(0), 1) + * ids[6] = this.L(this.S(0), 2) +*/ + (__pyx_v_ids[4]) = this->S(2); + + /* "_state.pxd":103 + * ids[3] = this.S(1) + * ids[4] = this.S(2) + * ids[5] = this.L(this.S(0), 1) # <<<<<<<<<<<<<< + * ids[6] = this.L(this.S(0), 2) + * ids[6] = this.R(this.S(0), 1) +*/ + (__pyx_v_ids[5]) = this->L(this->S(0), 1); + + /* "_state.pxd":104 + * ids[4] = this.S(2) + * ids[5] = this.L(this.S(0), 1) + * ids[6] = this.L(this.S(0), 2) # <<<<<<<<<<<<<< + * ids[6] = this.R(this.S(0), 1) + * ids[7] = this.L(this.B(0), 1) +*/ + (__pyx_v_ids[6]) = this->L(this->S(0), 2); + + /* "_state.pxd":105 + * ids[5] = this.L(this.S(0), 1) + * ids[6] = this.L(this.S(0), 2) + * ids[6] = this.R(this.S(0), 1) # <<<<<<<<<<<<<< + * ids[7] = this.L(this.B(0), 1) + * ids[8] = this.R(this.S(0), 2) +*/ + (__pyx_v_ids[6]) = this->R(this->S(0), 1); + + /* "_state.pxd":106 + * ids[6] = this.L(this.S(0), 2) + * ids[6] = this.R(this.S(0), 1) + * ids[7] = this.L(this.B(0), 1) # <<<<<<<<<<<<<< + * ids[8] = this.R(this.S(0), 2) + * ids[9] = this.L(this.S(1), 1) +*/ + (__pyx_v_ids[7]) = this->L(this->B(0), 1); + + /* "_state.pxd":107 + * ids[6] = this.R(this.S(0), 1) + * ids[7] = this.L(this.B(0), 1) + * ids[8] = this.R(this.S(0), 2) # <<<<<<<<<<<<<< + * ids[9] = this.L(this.S(1), 1) + * ids[10] = this.L(this.S(1), 2) +*/ + (__pyx_v_ids[8]) = this->R(this->S(0), 2); + + /* "_state.pxd":108 + * ids[7] = this.L(this.B(0), 1) + * ids[8] = this.R(this.S(0), 2) + * ids[9] = this.L(this.S(1), 1) # <<<<<<<<<<<<<< + * ids[10] = this.L(this.S(1), 2) + * ids[11] = this.R(this.S(1), 1) +*/ + (__pyx_v_ids[9]) = this->L(this->S(1), 1); + + /* "_state.pxd":109 + * ids[8] = this.R(this.S(0), 2) + * ids[9] = this.L(this.S(1), 1) + * ids[10] = this.L(this.S(1), 2) # <<<<<<<<<<<<<< + * ids[11] = this.R(this.S(1), 1) + * ids[12] = this.R(this.S(1), 2) +*/ + (__pyx_v_ids[10]) = this->L(this->S(1), 2); + + /* "_state.pxd":110 + * ids[9] = this.L(this.S(1), 1) + * ids[10] = this.L(this.S(1), 2) + * ids[11] = this.R(this.S(1), 1) # <<<<<<<<<<<<<< + * ids[12] = this.R(this.S(1), 2) + * elif n == 6: +*/ + (__pyx_v_ids[11]) = this->R(this->S(1), 1); + + /* "_state.pxd":111 + * ids[10] = this.L(this.S(1), 2) + * ids[11] = this.R(this.S(1), 1) + * ids[12] = this.R(this.S(1), 2) # <<<<<<<<<<<<<< + * elif n == 6: + * for i in range(6): +*/ + (__pyx_v_ids[12]) = this->R(this->S(1), 2); + + /* "_state.pxd":97 + * ids[6] = this.L(this.S(0), 1) + * ids[7] = this.R(this.S(0), 1) + * elif n == 13: # <<<<<<<<<<<<<< + * ids[0] = this.B(0) + * ids[1] = this.B(1) +*/ + break; + case 6: + + /* "_state.pxd":113 + * ids[12] = this.R(this.S(1), 2) + * elif n == 6: + * for i in range(6): # <<<<<<<<<<<<<< + * ids[i] = -1 + * if this.B(0) >= 0: +*/ + for (__pyx_t_3 = 0; __pyx_t_3 < 6; __pyx_t_3+=1) { + __pyx_v_i = __pyx_t_3; + + /* "_state.pxd":114 + * elif n == 6: + * for i in range(6): + * ids[i] = -1 # <<<<<<<<<<<<<< + * if this.B(0) >= 0: + * ids[0] = this.B(0) +*/ + (__pyx_v_ids[__pyx_v_i]) = -1; + } + + /* "_state.pxd":115 + * for i in range(6): + * ids[i] = -1 + * if this.B(0) >= 0: # <<<<<<<<<<<<<< + * ids[0] = this.B(0) + * if this.entity_is_open(): +*/ + __pyx_t_1 = (this->B(0) >= 0); + if (__pyx_t_1) { + + /* "_state.pxd":116 + * ids[i] = -1 + * if this.B(0) >= 0: + * ids[0] = this.B(0) # <<<<<<<<<<<<<< + * if this.entity_is_open(): + * ent = this.get_ent() +*/ + (__pyx_v_ids[0]) = this->B(0); + + /* "_state.pxd":115 + * for i in range(6): + * ids[i] = -1 + * if this.B(0) >= 0: # <<<<<<<<<<<<<< + * ids[0] = this.B(0) + * if this.entity_is_open(): +*/ + } + + /* "_state.pxd":117 + * if this.B(0) >= 0: + * ids[0] = this.B(0) + * if this.entity_is_open(): # <<<<<<<<<<<<<< + * ent = this.get_ent() + * j = 1 +*/ + __pyx_t_1 = this->entity_is_open(); + if (__pyx_t_1) { + + /* "_state.pxd":118 + * ids[0] = this.B(0) + * if this.entity_is_open(): + * ent = this.get_ent() # <<<<<<<<<<<<<< + * j = 1 + * for i in range(ent.start, this.B(0)): +*/ + __pyx_v_ent = this->get_ent(); + + /* "_state.pxd":119 + * if this.entity_is_open(): + * ent = this.get_ent() + * j = 1 # <<<<<<<<<<<<<< + * for i in range(ent.start, this.B(0)): + * ids[j] = i +*/ + __pyx_v_j = 1; + + /* "_state.pxd":120 + * ent = this.get_ent() + * j = 1 + * for i in range(ent.start, this.B(0)): # <<<<<<<<<<<<<< + * ids[j] = i + * j += 1 +*/ + __pyx_t_3 = this->B(0); + __pyx_t_4 = __pyx_t_3; + for (__pyx_t_5 = __pyx_v_ent.start; __pyx_t_5 < __pyx_t_4; __pyx_t_5+=1) { + __pyx_v_i = __pyx_t_5; + + /* "_state.pxd":121 + * j = 1 + * for i in range(ent.start, this.B(0)): + * ids[j] = i # <<<<<<<<<<<<<< + * j += 1 + * if j >= 6: +*/ + (__pyx_v_ids[__pyx_v_j]) = __pyx_v_i; + + /* "_state.pxd":122 + * for i in range(ent.start, this.B(0)): + * ids[j] = i + * j += 1 # <<<<<<<<<<<<<< + * if j >= 6: + * break +*/ + __pyx_v_j = (__pyx_v_j + 1); + + /* "_state.pxd":123 + * ids[j] = i + * j += 1 + * if j >= 6: # <<<<<<<<<<<<<< + * break + * else: +*/ + __pyx_t_1 = (__pyx_v_j >= 6); + if (__pyx_t_1) { + + /* "_state.pxd":124 + * j += 1 + * if j >= 6: + * break # <<<<<<<<<<<<<< + * else: + * # TODO error =/ +*/ + goto __pyx_L14_break; + + /* "_state.pxd":123 + * ids[j] = i + * j += 1 + * if j >= 6: # <<<<<<<<<<<<<< + * break + * else: +*/ + } + } + __pyx_L14_break:; + + /* "_state.pxd":117 + * if this.B(0) >= 0: + * ids[0] = this.B(0) + * if this.entity_is_open(): # <<<<<<<<<<<<<< + * ent = this.get_ent() + * j = 1 +*/ + } + + /* "_state.pxd":112 + * ids[11] = this.R(this.S(1), 1) + * ids[12] = this.R(this.S(1), 2) + * elif n == 6: # <<<<<<<<<<<<<< + * for i in range(6): + * ids[i] = -1 +*/ + break; + default: + break; + } + + /* "_state.pxd":128 + * # TODO error =/ + * pass + * for i in range(n): # <<<<<<<<<<<<<< + * if ids[i] >= 0: + * ids[i] += this.offset +*/ + __pyx_t_3 = __pyx_v_n; + __pyx_t_4 = __pyx_t_3; + for (__pyx_t_5 = 0; __pyx_t_5 < __pyx_t_4; __pyx_t_5+=1) { + __pyx_v_i = __pyx_t_5; + + /* "_state.pxd":129 + * pass + * for i in range(n): + * if ids[i] >= 0: # <<<<<<<<<<<<<< + * ids[i] += this.offset + * else: +*/ + __pyx_t_1 = ((__pyx_v_ids[__pyx_v_i]) >= 0); + if (__pyx_t_1) { + + /* "_state.pxd":130 + * for i in range(n): + * if ids[i] >= 0: + * ids[i] += this.offset # <<<<<<<<<<<<<< + * else: + * ids[i] = -1 +*/ + __pyx_t_6 = __pyx_v_i; + (__pyx_v_ids[__pyx_t_6]) = ((__pyx_v_ids[__pyx_t_6]) + this->offset); + + /* "_state.pxd":129 + * pass + * for i in range(n): + * if ids[i] >= 0: # <<<<<<<<<<<<<< + * ids[i] += this.offset + * else: +*/ + goto __pyx_L18; + } + + /* "_state.pxd":132 + * ids[i] += this.offset + * else: + * ids[i] = -1 # <<<<<<<<<<<<<< + * + * inline int S(int i) noexcept nogil const: +*/ + /*else*/ { + (__pyx_v_ids[__pyx_v_i]) = -1; + } + __pyx_L18:; + } + + /* "_state.pxd":63 + * free(this._heads) + * + * inline void set_context_tokens(int* ids, int n) noexcept nogil: # <<<<<<<<<<<<<< + * cdef int i, j + * if n == 1: +*/ + + /* function exit code */ +} + +/* "_state.pxd":134 + * ids[i] = -1 + * + * inline int S(int i) noexcept nogil const: # <<<<<<<<<<<<<< + * if i >= this._stack.size(): + * return -1 +*/ + +int __pyx_t_5spacy_8pipeline_17_parser_internals_6_state_StateC::S(int __pyx_v_i) const { + int __pyx_r; + int __pyx_t_1; + __Pyx_FakeReference __pyx_t_2; + int __pyx_lineno = 0; + const char *__pyx_filename = NULL; + int __pyx_clineno = 0; + PyGILState_STATE __pyx_gilstate_save; + + /* "_state.pxd":135 + * + * inline int S(int i) noexcept nogil const: + * if i >= this._stack.size(): # <<<<<<<<<<<<<< + * return -1 + * elif i < 0: +*/ + __pyx_t_1 = (__pyx_v_i >= this->_stack.size()); + if (__pyx_t_1) { + + /* "_state.pxd":136 + * inline int S(int i) noexcept nogil const: + * if i >= this._stack.size(): + * return -1 # <<<<<<<<<<<<<< + * elif i < 0: + * return -1 +*/ + __pyx_r = -1; + goto __pyx_L0; + + /* "_state.pxd":135 + * + * inline int S(int i) noexcept nogil const: + * if i >= this._stack.size(): # <<<<<<<<<<<<<< + * return -1 + * elif i < 0: +*/ + } + + /* "_state.pxd":137 + * if i >= this._stack.size(): + * return -1 + * elif i < 0: # <<<<<<<<<<<<<< + * return -1 + * return this._stack.at(this._stack.size() - (i+1)) +*/ + __pyx_t_1 = (__pyx_v_i < 0); + if (__pyx_t_1) { + + /* "_state.pxd":138 + * return -1 + * elif i < 0: + * return -1 # <<<<<<<<<<<<<< + * return this._stack.at(this._stack.size() - (i+1)) + * +*/ + __pyx_r = -1; + goto __pyx_L0; + + /* "_state.pxd":137 + * if i >= this._stack.size(): + * return -1 + * elif i < 0: # <<<<<<<<<<<<<< + * return -1 + * return this._stack.at(this._stack.size() - (i+1)) +*/ + } + + /* "_state.pxd":139 + * elif i < 0: + * return -1 + * return this._stack.at(this._stack.size() - (i+1)) # <<<<<<<<<<<<<< + * + * inline int B(int i) noexcept nogil const: +*/ + try { + __pyx_t_2 = this->_stack.at((this->_stack.size() - (__pyx_v_i + 1))); + } catch(...) { + PyGILState_STATE __pyx_gilstate_save = __Pyx_PyGILState_Ensure(); + __Pyx_CppExn2PyErr(); + __Pyx_PyGILState_Release(__pyx_gilstate_save); + __PYX_ERR(4, 139, __pyx_L1_error) + } + __pyx_r = __pyx_t_2; + goto __pyx_L0; + + /* "_state.pxd":134 + * ids[i] = -1 + * + * inline int S(int i) noexcept nogil const: # <<<<<<<<<<<<<< + * if i >= this._stack.size(): + * return -1 +*/ + + /* function exit code */ + __pyx_L1_error:; + __pyx_gilstate_save = __Pyx_PyGILState_Ensure(); + __Pyx_WriteUnraisable("StateC.S", __pyx_clineno, __pyx_lineno, __pyx_filename, 1, 0); + __pyx_r = 0; + __Pyx_PyGILState_Release(__pyx_gilstate_save); + __pyx_L0:; + return __pyx_r; +} + +/* "_state.pxd":141 + * return this._stack.at(this._stack.size() - (i+1)) + * + * inline int B(int i) noexcept nogil const: # <<<<<<<<<<<<<< + * if i < 0: + * return -1 +*/ + +int __pyx_t_5spacy_8pipeline_17_parser_internals_6_state_StateC::B(int __pyx_v_i) const { + std::vector ::size_type __pyx_v_b_i; + int __pyx_r; + int __pyx_t_1; + __Pyx_FakeReference __pyx_t_2; + int __pyx_lineno = 0; + const char *__pyx_filename = NULL; + int __pyx_clineno = 0; + PyGILState_STATE __pyx_gilstate_save; + + /* "_state.pxd":142 + * + * inline int B(int i) noexcept nogil const: + * if i < 0: # <<<<<<<<<<<<<< + * return -1 + * elif i < this._rebuffer.size(): +*/ + __pyx_t_1 = (__pyx_v_i < 0); + if (__pyx_t_1) { + + /* "_state.pxd":143 + * inline int B(int i) noexcept nogil const: + * if i < 0: + * return -1 # <<<<<<<<<<<<<< + * elif i < this._rebuffer.size(): + * return this._rebuffer.at(this._rebuffer.size() - (i+1)) +*/ + __pyx_r = -1; + goto __pyx_L0; + + /* "_state.pxd":142 + * + * inline int B(int i) noexcept nogil const: + * if i < 0: # <<<<<<<<<<<<<< + * return -1 + * elif i < this._rebuffer.size(): +*/ + } + + /* "_state.pxd":144 + * if i < 0: + * return -1 + * elif i < this._rebuffer.size(): # <<<<<<<<<<<<<< + * return this._rebuffer.at(this._rebuffer.size() - (i+1)) + * else: +*/ + __pyx_t_1 = (__pyx_v_i < this->_rebuffer.size()); + if (__pyx_t_1) { + + /* "_state.pxd":145 + * return -1 + * elif i < this._rebuffer.size(): + * return this._rebuffer.at(this._rebuffer.size() - (i+1)) # <<<<<<<<<<<<<< + * else: + * b_i = this._b_i + (i - this._rebuffer.size()) +*/ + try { + __pyx_t_2 = this->_rebuffer.at((this->_rebuffer.size() - (__pyx_v_i + 1))); + } catch(...) { + PyGILState_STATE __pyx_gilstate_save = __Pyx_PyGILState_Ensure(); + __Pyx_CppExn2PyErr(); + __Pyx_PyGILState_Release(__pyx_gilstate_save); + __PYX_ERR(4, 145, __pyx_L1_error) + } + __pyx_r = __pyx_t_2; + goto __pyx_L0; + + /* "_state.pxd":144 + * if i < 0: + * return -1 + * elif i < this._rebuffer.size(): # <<<<<<<<<<<<<< + * return this._rebuffer.at(this._rebuffer.size() - (i+1)) + * else: +*/ + } + + /* "_state.pxd":147 + * return this._rebuffer.at(this._rebuffer.size() - (i+1)) + * else: + * b_i = this._b_i + (i - this._rebuffer.size()) # <<<<<<<<<<<<<< + * if b_i >= this.length: + * return -1 +*/ + /*else*/ { + __pyx_v_b_i = (this->_b_i + (__pyx_v_i - this->_rebuffer.size())); + + /* "_state.pxd":148 + * else: + * b_i = this._b_i + (i - this._rebuffer.size()) + * if b_i >= this.length: # <<<<<<<<<<<<<< + * return -1 + * else: +*/ + __pyx_t_1 = (__pyx_v_b_i >= this->length); + if (__pyx_t_1) { + + /* "_state.pxd":149 + * b_i = this._b_i + (i - this._rebuffer.size()) + * if b_i >= this.length: + * return -1 # <<<<<<<<<<<<<< + * else: + * return b_i +*/ + __pyx_r = -1; + goto __pyx_L0; + + /* "_state.pxd":148 + * else: + * b_i = this._b_i + (i - this._rebuffer.size()) + * if b_i >= this.length: # <<<<<<<<<<<<<< + * return -1 + * else: +*/ + } + + /* "_state.pxd":151 + * return -1 + * else: + * return b_i # <<<<<<<<<<<<<< + * + * inline const TokenC* B_(int i) noexcept nogil const: +*/ + /*else*/ { + __pyx_r = __pyx_v_b_i; + goto __pyx_L0; + } + } + + /* "_state.pxd":141 + * return this._stack.at(this._stack.size() - (i+1)) + * + * inline int B(int i) noexcept nogil const: # <<<<<<<<<<<<<< + * if i < 0: + * return -1 +*/ + + /* function exit code */ + __pyx_L1_error:; + __pyx_gilstate_save = __Pyx_PyGILState_Ensure(); + __Pyx_WriteUnraisable("StateC.B", __pyx_clineno, __pyx_lineno, __pyx_filename, 1, 0); + __pyx_r = 0; + __Pyx_PyGILState_Release(__pyx_gilstate_save); + __pyx_L0:; + return __pyx_r; +} + +/* "_state.pxd":153 + * return b_i + * + * inline const TokenC* B_(int i) noexcept nogil const: # <<<<<<<<<<<<<< + * return this.safe_get(this.B(i)) + * +*/ + +struct __pyx_t_5spacy_7structs_TokenC const *__pyx_t_5spacy_8pipeline_17_parser_internals_6_state_StateC::B_(int __pyx_v_i) const { + struct __pyx_t_5spacy_7structs_TokenC const *__pyx_r; + + /* "_state.pxd":154 + * + * inline const TokenC* B_(int i) noexcept nogil const: + * return this.safe_get(this.B(i)) # <<<<<<<<<<<<<< + * + * inline const TokenC* E_(int i) noexcept nogil const: +*/ + __pyx_r = this->safe_get(this->B(__pyx_v_i)); + goto __pyx_L0; + + /* "_state.pxd":153 + * return b_i + * + * inline const TokenC* B_(int i) noexcept nogil const: # <<<<<<<<<<<<<< + * return this.safe_get(this.B(i)) + * +*/ + + /* function exit code */ + __pyx_L0:; + return __pyx_r; +} + +/* "_state.pxd":156 + * return this.safe_get(this.B(i)) + * + * inline const TokenC* E_(int i) noexcept nogil const: # <<<<<<<<<<<<<< + * return this.safe_get(this.E(i)) + * +*/ + +struct __pyx_t_5spacy_7structs_TokenC const *__pyx_t_5spacy_8pipeline_17_parser_internals_6_state_StateC::E_(int __pyx_v_i) const { + struct __pyx_t_5spacy_7structs_TokenC const *__pyx_r; + + /* "_state.pxd":157 + * + * inline const TokenC* E_(int i) noexcept nogil const: + * return this.safe_get(this.E(i)) # <<<<<<<<<<<<<< + * + * inline const TokenC* safe_get(int i) noexcept nogil const: +*/ + __pyx_r = this->safe_get(this->E(__pyx_v_i)); + goto __pyx_L0; + + /* "_state.pxd":156 + * return this.safe_get(this.B(i)) + * + * inline const TokenC* E_(int i) noexcept nogil const: # <<<<<<<<<<<<<< + * return this.safe_get(this.E(i)) + * +*/ + + /* function exit code */ + __pyx_L0:; + return __pyx_r; +} + +/* "_state.pxd":159 + * return this.safe_get(this.E(i)) + * + * inline const TokenC* safe_get(int i) noexcept nogil const: # <<<<<<<<<<<<<< + * if i < 0 or i >= this.length: + * return &this._empty_token +*/ + +struct __pyx_t_5spacy_7structs_TokenC const *__pyx_t_5spacy_8pipeline_17_parser_internals_6_state_StateC::safe_get(int __pyx_v_i) const { + struct __pyx_t_5spacy_7structs_TokenC const *__pyx_r; + int __pyx_t_1; + int __pyx_t_2; + + /* "_state.pxd":160 + * + * inline const TokenC* safe_get(int i) noexcept nogil const: + * if i < 0 or i >= this.length: # <<<<<<<<<<<<<< + * return &this._empty_token + * else: +*/ + __pyx_t_2 = (__pyx_v_i < 0); + if (!__pyx_t_2) { + } else { + __pyx_t_1 = __pyx_t_2; + goto __pyx_L4_bool_binop_done; + } + __pyx_t_2 = (__pyx_v_i >= this->length); + __pyx_t_1 = __pyx_t_2; + __pyx_L4_bool_binop_done:; + if (__pyx_t_1) { + + /* "_state.pxd":161 + * inline const TokenC* safe_get(int i) noexcept nogil const: + * if i < 0 or i >= this.length: + * return &this._empty_token # <<<<<<<<<<<<<< + * else: + * return &this._sent[i] +*/ + __pyx_r = (&this->_empty_token); + goto __pyx_L0; + + /* "_state.pxd":160 + * + * inline const TokenC* safe_get(int i) noexcept nogil const: + * if i < 0 or i >= this.length: # <<<<<<<<<<<<<< + * return &this._empty_token + * else: +*/ + } + + /* "_state.pxd":163 + * return &this._empty_token + * else: + * return &this._sent[i] # <<<<<<<<<<<<<< + * + * inline void map_get_arcs(const unordered_map[int, vector[ArcC]] &heads_arcs, vector[ArcC]* out) noexcept nogil const: +*/ + /*else*/ { + __pyx_r = (&(this->_sent[__pyx_v_i])); + goto __pyx_L0; + } + + /* "_state.pxd":159 + * return this.safe_get(this.E(i)) + * + * inline const TokenC* safe_get(int i) noexcept nogil const: # <<<<<<<<<<<<<< + * if i < 0 or i >= this.length: + * return &this._empty_token +*/ + + /* function exit code */ + __pyx_L0:; + return __pyx_r; +} + +/* "_state.pxd":165 + * return &this._sent[i] + * + * inline void map_get_arcs(const unordered_map[int, vector[ArcC]] &heads_arcs, vector[ArcC]* out) noexcept nogil const: # <<<<<<<<<<<<<< + * cdef const vector[ArcC]* arcs + * head_arcs_it = heads_arcs.const_begin() +*/ + +void __pyx_t_5spacy_8pipeline_17_parser_internals_6_state_StateC::map_get_arcs(std::unordered_map > const &__pyx_v_heads_arcs, std::vector *__pyx_v_out) const { + std::vector const *__pyx_v_arcs; + std::unordered_map > ::const_iterator __pyx_v_head_arcs_it; + std::vector ::const_iterator __pyx_v_arcs_it; + struct __pyx_t_5spacy_8pipeline_17_parser_internals_6_state_ArcC __pyx_v_arc; + int __pyx_t_1; + int __pyx_t_2; + int __pyx_lineno = 0; + const char *__pyx_filename = NULL; + int __pyx_clineno = 0; + PyGILState_STATE __pyx_gilstate_save; + + /* "_state.pxd":167 + * inline void map_get_arcs(const unordered_map[int, vector[ArcC]] &heads_arcs, vector[ArcC]* out) noexcept nogil const: + * cdef const vector[ArcC]* arcs + * head_arcs_it = heads_arcs.const_begin() # <<<<<<<<<<<<<< + * while head_arcs_it != heads_arcs.const_end(): + * arcs = &deref(head_arcs_it).second +*/ + try { + __pyx_v_head_arcs_it = __pyx_v_heads_arcs.begin(); + } catch(...) { + PyGILState_STATE __pyx_gilstate_save = __Pyx_PyGILState_Ensure(); + __Pyx_CppExn2PyErr(); + __Pyx_PyGILState_Release(__pyx_gilstate_save); + __PYX_ERR(4, 167, __pyx_L1_error) + } + + /* "_state.pxd":168 + * cdef const vector[ArcC]* arcs + * head_arcs_it = heads_arcs.const_begin() + * while head_arcs_it != heads_arcs.const_end(): # <<<<<<<<<<<<<< + * arcs = &deref(head_arcs_it).second + * arcs_it = arcs.const_begin() +*/ + while (1) { + __pyx_t_1 = (__pyx_v_head_arcs_it != __pyx_v_heads_arcs.end()); + if (!__pyx_t_1) break; + + /* "_state.pxd":169 + * head_arcs_it = heads_arcs.const_begin() + * while head_arcs_it != heads_arcs.const_end(): + * arcs = &deref(head_arcs_it).second # <<<<<<<<<<<<<< + * arcs_it = arcs.const_begin() + * while arcs_it != arcs.const_end(): +*/ + __pyx_v_arcs = (&(*__pyx_v_head_arcs_it).second); + + /* "_state.pxd":170 + * while head_arcs_it != heads_arcs.const_end(): + * arcs = &deref(head_arcs_it).second + * arcs_it = arcs.const_begin() # <<<<<<<<<<<<<< + * while arcs_it != arcs.const_end(): + * arc = deref(arcs_it) +*/ + try { + __pyx_v_arcs_it = __pyx_v_arcs->begin(); + } catch(...) { + PyGILState_STATE __pyx_gilstate_save = __Pyx_PyGILState_Ensure(); + __Pyx_CppExn2PyErr(); + __Pyx_PyGILState_Release(__pyx_gilstate_save); + __PYX_ERR(4, 170, __pyx_L1_error) + } + + /* "_state.pxd":171 + * arcs = &deref(head_arcs_it).second + * arcs_it = arcs.const_begin() + * while arcs_it != arcs.const_end(): # <<<<<<<<<<<<<< + * arc = deref(arcs_it) + * if arc.head != -1 and arc.child != -1: +*/ + while (1) { + __pyx_t_1 = (__pyx_v_arcs_it != __pyx_v_arcs->end()); + if (!__pyx_t_1) break; + + /* "_state.pxd":172 + * arcs_it = arcs.const_begin() + * while arcs_it != arcs.const_end(): + * arc = deref(arcs_it) # <<<<<<<<<<<<<< + * if arc.head != -1 and arc.child != -1: + * out.push_back(arc) +*/ + __pyx_v_arc = (*__pyx_v_arcs_it); + + /* "_state.pxd":173 + * while arcs_it != arcs.const_end(): + * arc = deref(arcs_it) + * if arc.head != -1 and arc.child != -1: # <<<<<<<<<<<<<< + * out.push_back(arc) + * incr(arcs_it) +*/ + __pyx_t_2 = (__pyx_v_arc.head != -1L); + if (__pyx_t_2) { + } else { + __pyx_t_1 = __pyx_t_2; + goto __pyx_L8_bool_binop_done; + } + __pyx_t_2 = (__pyx_v_arc.child != -1L); + __pyx_t_1 = __pyx_t_2; + __pyx_L8_bool_binop_done:; + if (__pyx_t_1) { + + /* "_state.pxd":174 + * arc = deref(arcs_it) + * if arc.head != -1 and arc.child != -1: + * out.push_back(arc) # <<<<<<<<<<<<<< + * incr(arcs_it) + * incr(head_arcs_it) +*/ + try { + __pyx_v_out->push_back(__pyx_v_arc); + } catch(...) { + PyGILState_STATE __pyx_gilstate_save = __Pyx_PyGILState_Ensure(); + __Pyx_CppExn2PyErr(); + __Pyx_PyGILState_Release(__pyx_gilstate_save); + __PYX_ERR(4, 174, __pyx_L1_error) + } + + /* "_state.pxd":173 + * while arcs_it != arcs.const_end(): + * arc = deref(arcs_it) + * if arc.head != -1 and arc.child != -1: # <<<<<<<<<<<<<< + * out.push_back(arc) + * incr(arcs_it) +*/ + } + + /* "_state.pxd":175 + * if arc.head != -1 and arc.child != -1: + * out.push_back(arc) + * incr(arcs_it) # <<<<<<<<<<<<<< + * incr(head_arcs_it) + * +*/ + (void)((++__pyx_v_arcs_it)); + } + + /* "_state.pxd":176 + * out.push_back(arc) + * incr(arcs_it) + * incr(head_arcs_it) # <<<<<<<<<<<<<< + * + * inline void get_arcs(vector[ArcC]* out) noexcept nogil const: +*/ + (void)((++__pyx_v_head_arcs_it)); + } + + /* "_state.pxd":165 + * return &this._sent[i] + * + * inline void map_get_arcs(const unordered_map[int, vector[ArcC]] &heads_arcs, vector[ArcC]* out) noexcept nogil const: # <<<<<<<<<<<<<< + * cdef const vector[ArcC]* arcs + * head_arcs_it = heads_arcs.const_begin() +*/ + + /* function exit code */ + goto __pyx_L0; + __pyx_L1_error:; + __pyx_gilstate_save = __Pyx_PyGILState_Ensure(); + __Pyx_WriteUnraisable("StateC.map_get_arcs", __pyx_clineno, __pyx_lineno, __pyx_filename, 1, 0); + __Pyx_PyGILState_Release(__pyx_gilstate_save); + __pyx_L0:; +} + +/* "_state.pxd":178 + * incr(head_arcs_it) + * + * inline void get_arcs(vector[ArcC]* out) noexcept nogil const: # <<<<<<<<<<<<<< + * this.map_get_arcs(this._left_arcs, out) + * this.map_get_arcs(this._right_arcs, out) +*/ + +void __pyx_t_5spacy_8pipeline_17_parser_internals_6_state_StateC::get_arcs(std::vector *__pyx_v_out) const { + + /* "_state.pxd":179 + * + * inline void get_arcs(vector[ArcC]* out) noexcept nogil const: + * this.map_get_arcs(this._left_arcs, out) # <<<<<<<<<<<<<< + * this.map_get_arcs(this._right_arcs, out) + * +*/ + this->map_get_arcs(this->_left_arcs, __pyx_v_out); + + /* "_state.pxd":180 + * inline void get_arcs(vector[ArcC]* out) noexcept nogil const: + * this.map_get_arcs(this._left_arcs, out) + * this.map_get_arcs(this._right_arcs, out) # <<<<<<<<<<<<<< + * + * inline int H(int child) noexcept nogil const: +*/ + this->map_get_arcs(this->_right_arcs, __pyx_v_out); + + /* "_state.pxd":178 + * incr(head_arcs_it) + * + * inline void get_arcs(vector[ArcC]* out) noexcept nogil const: # <<<<<<<<<<<<<< + * this.map_get_arcs(this._left_arcs, out) + * this.map_get_arcs(this._right_arcs, out) +*/ + + /* function exit code */ +} + +/* "_state.pxd":182 + * this.map_get_arcs(this._right_arcs, out) + * + * inline int H(int child) noexcept nogil const: # <<<<<<<<<<<<<< + * if child >= this.length or child < 0: + * return -1 +*/ + +int __pyx_t_5spacy_8pipeline_17_parser_internals_6_state_StateC::H(int __pyx_v_child) const { + int __pyx_r; + int __pyx_t_1; + int __pyx_t_2; + + /* "_state.pxd":183 + * + * inline int H(int child) noexcept nogil const: + * if child >= this.length or child < 0: # <<<<<<<<<<<<<< + * return -1 + * else: +*/ + __pyx_t_2 = (__pyx_v_child >= this->length); + if (!__pyx_t_2) { + } else { + __pyx_t_1 = __pyx_t_2; + goto __pyx_L4_bool_binop_done; + } + __pyx_t_2 = (__pyx_v_child < 0); + __pyx_t_1 = __pyx_t_2; + __pyx_L4_bool_binop_done:; + if (__pyx_t_1) { + + /* "_state.pxd":184 + * inline int H(int child) noexcept nogil const: + * if child >= this.length or child < 0: + * return -1 # <<<<<<<<<<<<<< + * else: + * return this._heads[child] +*/ + __pyx_r = -1; + goto __pyx_L0; + + /* "_state.pxd":183 + * + * inline int H(int child) noexcept nogil const: + * if child >= this.length or child < 0: # <<<<<<<<<<<<<< + * return -1 + * else: +*/ + } + + /* "_state.pxd":186 + * return -1 + * else: + * return this._heads[child] # <<<<<<<<<<<<<< + * + * inline int E(int i) noexcept nogil const: +*/ + /*else*/ { + __pyx_r = (this->_heads[__pyx_v_child]); + goto __pyx_L0; + } + + /* "_state.pxd":182 + * this.map_get_arcs(this._right_arcs, out) + * + * inline int H(int child) noexcept nogil const: # <<<<<<<<<<<<<< + * if child >= this.length or child < 0: + * return -1 +*/ + + /* function exit code */ + __pyx_L0:; + return __pyx_r; +} + +/* "_state.pxd":188 + * return this._heads[child] + * + * inline int E(int i) noexcept nogil const: # <<<<<<<<<<<<<< + * if this._ents.size() == 0: + * return -1 +*/ + +int __pyx_t_5spacy_8pipeline_17_parser_internals_6_state_StateC::E(CYTHON_UNUSED int __pyx_v_i) const { + int __pyx_r; + int __pyx_t_1; + + /* "_state.pxd":189 + * + * inline int E(int i) noexcept nogil const: + * if this._ents.size() == 0: # <<<<<<<<<<<<<< + * return -1 + * else: +*/ + __pyx_t_1 = (this->_ents.size() == 0); + if (__pyx_t_1) { + + /* "_state.pxd":190 + * inline int E(int i) noexcept nogil const: + * if this._ents.size() == 0: + * return -1 # <<<<<<<<<<<<<< + * else: + * return this._ents.back().start +*/ + __pyx_r = -1; + goto __pyx_L0; + + /* "_state.pxd":189 + * + * inline int E(int i) noexcept nogil const: + * if this._ents.size() == 0: # <<<<<<<<<<<<<< + * return -1 + * else: +*/ + } + + /* "_state.pxd":192 + * return -1 + * else: + * return this._ents.back().start # <<<<<<<<<<<<<< + * + * inline int nth_child(const unordered_map[int, vector[ArcC]]& heads_arcs, int head, int idx) noexcept nogil const: +*/ + /*else*/ { + __pyx_r = this->_ents.back().start; + goto __pyx_L0; + } + + /* "_state.pxd":188 + * return this._heads[child] + * + * inline int E(int i) noexcept nogil const: # <<<<<<<<<<<<<< + * if this._ents.size() == 0: + * return -1 +*/ + + /* function exit code */ + __pyx_L0:; + return __pyx_r; +} + +/* "_state.pxd":194 + * return this._ents.back().start + * + * inline int nth_child(const unordered_map[int, vector[ArcC]]& heads_arcs, int head, int idx) noexcept nogil const: # <<<<<<<<<<<<<< + * if idx < 1: + * return -1 +*/ + +int __pyx_t_5spacy_8pipeline_17_parser_internals_6_state_StateC::nth_child(std::unordered_map > const &__pyx_v_heads_arcs, int __pyx_v_head, int __pyx_v_idx) const { + std::unordered_map > ::const_iterator __pyx_v_head_arcs_it; + std::vector const *__pyx_v_arcs; + size_t __pyx_v_child_index; + std::vector ::const_reverse_iterator __pyx_v_arcs_it; + struct __pyx_t_5spacy_8pipeline_17_parser_internals_6_state_ArcC __pyx_v_arc; + int __pyx_r; + int __pyx_t_1; + int __pyx_t_2; + int __pyx_lineno = 0; + const char *__pyx_filename = NULL; + int __pyx_clineno = 0; + PyGILState_STATE __pyx_gilstate_save; + + /* "_state.pxd":195 + * + * inline int nth_child(const unordered_map[int, vector[ArcC]]& heads_arcs, int head, int idx) noexcept nogil const: + * if idx < 1: # <<<<<<<<<<<<<< + * return -1 + * +*/ + __pyx_t_1 = (__pyx_v_idx < 1); + if (__pyx_t_1) { + + /* "_state.pxd":196 + * inline int nth_child(const unordered_map[int, vector[ArcC]]& heads_arcs, int head, int idx) noexcept nogil const: + * if idx < 1: + * return -1 # <<<<<<<<<<<<<< + * + * head_arcs_it = heads_arcs.const_find(head) +*/ + __pyx_r = -1; + goto __pyx_L0; + + /* "_state.pxd":195 + * + * inline int nth_child(const unordered_map[int, vector[ArcC]]& heads_arcs, int head, int idx) noexcept nogil const: + * if idx < 1: # <<<<<<<<<<<<<< + * return -1 + * +*/ + } + + /* "_state.pxd":198 + * return -1 + * + * head_arcs_it = heads_arcs.const_find(head) # <<<<<<<<<<<<<< + * if head_arcs_it == heads_arcs.const_end(): + * return -1 +*/ + try { + __pyx_v_head_arcs_it = __pyx_v_heads_arcs.find(__pyx_v_head); + } catch(...) { + PyGILState_STATE __pyx_gilstate_save = __Pyx_PyGILState_Ensure(); + __Pyx_CppExn2PyErr(); + __Pyx_PyGILState_Release(__pyx_gilstate_save); + __PYX_ERR(4, 198, __pyx_L1_error) + } + + /* "_state.pxd":199 + * + * head_arcs_it = heads_arcs.const_find(head) + * if head_arcs_it == heads_arcs.const_end(): # <<<<<<<<<<<<<< + * return -1 + * +*/ + __pyx_t_1 = (__pyx_v_head_arcs_it == __pyx_v_heads_arcs.end()); + if (__pyx_t_1) { + + /* "_state.pxd":200 + * head_arcs_it = heads_arcs.const_find(head) + * if head_arcs_it == heads_arcs.const_end(): + * return -1 # <<<<<<<<<<<<<< + * + * cdef const vector[ArcC]* arcs = &deref(head_arcs_it).second +*/ + __pyx_r = -1; + goto __pyx_L0; + + /* "_state.pxd":199 + * + * head_arcs_it = heads_arcs.const_find(head) + * if head_arcs_it == heads_arcs.const_end(): # <<<<<<<<<<<<<< + * return -1 + * +*/ + } + + /* "_state.pxd":202 + * return -1 + * + * cdef const vector[ArcC]* arcs = &deref(head_arcs_it).second # <<<<<<<<<<<<<< + * + * # Work backwards through arcs to find the arc at the +*/ + __pyx_v_arcs = (&(*__pyx_v_head_arcs_it).second); + + /* "_state.pxd":206 + * # Work backwards through arcs to find the arc at the + * # requested index more quickly. + * cdef size_t child_index = 0 # <<<<<<<<<<<<<< + * arcs_it = arcs.const_rbegin() + * while arcs_it != arcs.const_rend() and child_index != idx: +*/ + __pyx_v_child_index = 0; + + /* "_state.pxd":207 + * # requested index more quickly. + * cdef size_t child_index = 0 + * arcs_it = arcs.const_rbegin() # <<<<<<<<<<<<<< + * while arcs_it != arcs.const_rend() and child_index != idx: + * arc = deref(arcs_it) +*/ + try { + __pyx_v_arcs_it = __pyx_v_arcs->rbegin(); + } catch(...) { + PyGILState_STATE __pyx_gilstate_save = __Pyx_PyGILState_Ensure(); + __Pyx_CppExn2PyErr(); + __Pyx_PyGILState_Release(__pyx_gilstate_save); + __PYX_ERR(4, 207, __pyx_L1_error) + } + + /* "_state.pxd":208 + * cdef size_t child_index = 0 + * arcs_it = arcs.const_rbegin() + * while arcs_it != arcs.const_rend() and child_index != idx: # <<<<<<<<<<<<<< + * arc = deref(arcs_it) + * if arc.child != -1: +*/ + while (1) { + __pyx_t_2 = (__pyx_v_arcs_it != __pyx_v_arcs->rend()); + if (__pyx_t_2) { + } else { + __pyx_t_1 = __pyx_t_2; + goto __pyx_L7_bool_binop_done; + } + __pyx_t_2 = (__pyx_v_child_index != __pyx_v_idx); + __pyx_t_1 = __pyx_t_2; + __pyx_L7_bool_binop_done:; + if (!__pyx_t_1) break; + + /* "_state.pxd":209 + * arcs_it = arcs.const_rbegin() + * while arcs_it != arcs.const_rend() and child_index != idx: + * arc = deref(arcs_it) # <<<<<<<<<<<<<< + * if arc.child != -1: + * child_index += 1 +*/ + __pyx_v_arc = (*__pyx_v_arcs_it); + + /* "_state.pxd":210 + * while arcs_it != arcs.const_rend() and child_index != idx: + * arc = deref(arcs_it) + * if arc.child != -1: # <<<<<<<<<<<<<< + * child_index += 1 + * if child_index == idx: +*/ + __pyx_t_1 = (__pyx_v_arc.child != -1L); + if (__pyx_t_1) { + + /* "_state.pxd":211 + * arc = deref(arcs_it) + * if arc.child != -1: + * child_index += 1 # <<<<<<<<<<<<<< + * if child_index == idx: + * return arc.child +*/ + __pyx_v_child_index = (__pyx_v_child_index + 1); + + /* "_state.pxd":212 + * if arc.child != -1: + * child_index += 1 + * if child_index == idx: # <<<<<<<<<<<<<< + * return arc.child + * incr(arcs_it) +*/ + __pyx_t_1 = (__pyx_v_child_index == __pyx_v_idx); + if (__pyx_t_1) { + + /* "_state.pxd":213 + * child_index += 1 + * if child_index == idx: + * return arc.child # <<<<<<<<<<<<<< + * incr(arcs_it) + * +*/ + __pyx_r = __pyx_v_arc.child; + goto __pyx_L0; + + /* "_state.pxd":212 + * if arc.child != -1: + * child_index += 1 + * if child_index == idx: # <<<<<<<<<<<<<< + * return arc.child + * incr(arcs_it) +*/ + } + + /* "_state.pxd":210 + * while arcs_it != arcs.const_rend() and child_index != idx: + * arc = deref(arcs_it) + * if arc.child != -1: # <<<<<<<<<<<<<< + * child_index += 1 + * if child_index == idx: +*/ + } + + /* "_state.pxd":214 + * if child_index == idx: + * return arc.child + * incr(arcs_it) # <<<<<<<<<<<<<< + * + * return -1 +*/ + (void)((++__pyx_v_arcs_it)); + } + + /* "_state.pxd":216 + * incr(arcs_it) + * + * return -1 # <<<<<<<<<<<<<< + * + * inline int L(int head, int idx) noexcept nogil const: +*/ + __pyx_r = -1; + goto __pyx_L0; + + /* "_state.pxd":194 + * return this._ents.back().start + * + * inline int nth_child(const unordered_map[int, vector[ArcC]]& heads_arcs, int head, int idx) noexcept nogil const: # <<<<<<<<<<<<<< + * if idx < 1: + * return -1 +*/ + + /* function exit code */ + __pyx_L1_error:; + __pyx_gilstate_save = __Pyx_PyGILState_Ensure(); + __Pyx_WriteUnraisable("StateC.nth_child", __pyx_clineno, __pyx_lineno, __pyx_filename, 1, 0); + __pyx_r = 0; + __Pyx_PyGILState_Release(__pyx_gilstate_save); + __pyx_L0:; + return __pyx_r; +} + +/* "_state.pxd":218 + * return -1 + * + * inline int L(int head, int idx) noexcept nogil const: # <<<<<<<<<<<<<< + * return this.nth_child(this._left_arcs, head, idx) + * +*/ + +int __pyx_t_5spacy_8pipeline_17_parser_internals_6_state_StateC::L(int __pyx_v_head, int __pyx_v_idx) const { + int __pyx_r; + + /* "_state.pxd":219 + * + * inline int L(int head, int idx) noexcept nogil const: + * return this.nth_child(this._left_arcs, head, idx) # <<<<<<<<<<<<<< + * + * inline int R(int head, int idx) noexcept nogil const: +*/ + __pyx_r = this->nth_child(this->_left_arcs, __pyx_v_head, __pyx_v_idx); + goto __pyx_L0; + + /* "_state.pxd":218 + * return -1 + * + * inline int L(int head, int idx) noexcept nogil const: # <<<<<<<<<<<<<< + * return this.nth_child(this._left_arcs, head, idx) + * +*/ + + /* function exit code */ + __pyx_L0:; + return __pyx_r; +} + +/* "_state.pxd":221 + * return this.nth_child(this._left_arcs, head, idx) + * + * inline int R(int head, int idx) noexcept nogil const: # <<<<<<<<<<<<<< + * return this.nth_child(this._right_arcs, head, idx) + * +*/ + +int __pyx_t_5spacy_8pipeline_17_parser_internals_6_state_StateC::R(int __pyx_v_head, int __pyx_v_idx) const { + int __pyx_r; + + /* "_state.pxd":222 + * + * inline int R(int head, int idx) noexcept nogil const: + * return this.nth_child(this._right_arcs, head, idx) # <<<<<<<<<<<<<< + * + * inline bint empty() noexcept nogil const: +*/ + __pyx_r = this->nth_child(this->_right_arcs, __pyx_v_head, __pyx_v_idx); + goto __pyx_L0; + + /* "_state.pxd":221 + * return this.nth_child(this._left_arcs, head, idx) + * + * inline int R(int head, int idx) noexcept nogil const: # <<<<<<<<<<<<<< + * return this.nth_child(this._right_arcs, head, idx) + * +*/ + + /* function exit code */ + __pyx_L0:; + return __pyx_r; +} + +/* "_state.pxd":224 + * return this.nth_child(this._right_arcs, head, idx) + * + * inline bint empty() noexcept nogil const: # <<<<<<<<<<<<<< + * return this._stack.size() == 0 + * +*/ + +int __pyx_t_5spacy_8pipeline_17_parser_internals_6_state_StateC::empty(void) const { + int __pyx_r; + + /* "_state.pxd":225 + * + * inline bint empty() noexcept nogil const: + * return this._stack.size() == 0 # <<<<<<<<<<<<<< + * + * inline bint eol() noexcept nogil const: +*/ + __pyx_r = (this->_stack.size() == 0); + goto __pyx_L0; + + /* "_state.pxd":224 + * return this.nth_child(this._right_arcs, head, idx) + * + * inline bint empty() noexcept nogil const: # <<<<<<<<<<<<<< + * return this._stack.size() == 0 + * +*/ + + /* function exit code */ + __pyx_L0:; + return __pyx_r; +} + +/* "_state.pxd":227 + * return this._stack.size() == 0 + * + * inline bint eol() noexcept nogil const: # <<<<<<<<<<<<<< + * return this.buffer_length() == 0 + * +*/ + +int __pyx_t_5spacy_8pipeline_17_parser_internals_6_state_StateC::eol(void) const { + int __pyx_r; + + /* "_state.pxd":228 + * + * inline bint eol() noexcept nogil const: + * return this.buffer_length() == 0 # <<<<<<<<<<<<<< + * + * inline bint is_final() noexcept nogil const: +*/ + __pyx_r = (this->buffer_length() == 0); + goto __pyx_L0; + + /* "_state.pxd":227 + * return this._stack.size() == 0 + * + * inline bint eol() noexcept nogil const: # <<<<<<<<<<<<<< + * return this.buffer_length() == 0 + * +*/ + + /* function exit code */ + __pyx_L0:; + return __pyx_r; +} + +/* "_state.pxd":230 + * return this.buffer_length() == 0 + * + * inline bint is_final() noexcept nogil const: # <<<<<<<<<<<<<< + * return this.stack_depth() <= 0 and this.eol() + * +*/ + +int __pyx_t_5spacy_8pipeline_17_parser_internals_6_state_StateC::is_final(void) const { + int __pyx_r; + int __pyx_t_1; + int __pyx_t_2; + + /* "_state.pxd":231 + * + * inline bint is_final() noexcept nogil const: + * return this.stack_depth() <= 0 and this.eol() # <<<<<<<<<<<<<< + * + * inline int cannot_sent_start(int word) noexcept nogil const: +*/ + __pyx_t_2 = (this->stack_depth() <= 0); + if (__pyx_t_2) { + } else { + __pyx_t_1 = __pyx_t_2; + goto __pyx_L3_bool_binop_done; + } + __pyx_t_2 = this->eol(); + __pyx_t_1 = __pyx_t_2; + __pyx_L3_bool_binop_done:; + __pyx_r = __pyx_t_1; + goto __pyx_L0; + + /* "_state.pxd":230 + * return this.buffer_length() == 0 + * + * inline bint is_final() noexcept nogil const: # <<<<<<<<<<<<<< + * return this.stack_depth() <= 0 and this.eol() + * +*/ + + /* function exit code */ + __pyx_L0:; + return __pyx_r; +} + +/* "_state.pxd":233 + * return this.stack_depth() <= 0 and this.eol() + * + * inline int cannot_sent_start(int word) noexcept nogil const: # <<<<<<<<<<<<<< + * if word < 0 or word >= this.length: + * return 0 +*/ + +int __pyx_t_5spacy_8pipeline_17_parser_internals_6_state_StateC::cannot_sent_start(int __pyx_v_word) const { + int __pyx_r; + int __pyx_t_1; + int __pyx_t_2; + + /* "_state.pxd":234 + * + * inline int cannot_sent_start(int word) noexcept nogil const: + * if word < 0 or word >= this.length: # <<<<<<<<<<<<<< + * return 0 + * elif this._sent[word].sent_start == -1: +*/ + __pyx_t_2 = (__pyx_v_word < 0); + if (!__pyx_t_2) { + } else { + __pyx_t_1 = __pyx_t_2; + goto __pyx_L4_bool_binop_done; + } + __pyx_t_2 = (__pyx_v_word >= this->length); + __pyx_t_1 = __pyx_t_2; + __pyx_L4_bool_binop_done:; + if (__pyx_t_1) { + + /* "_state.pxd":235 + * inline int cannot_sent_start(int word) noexcept nogil const: + * if word < 0 or word >= this.length: + * return 0 # <<<<<<<<<<<<<< + * elif this._sent[word].sent_start == -1: + * return 1 +*/ + __pyx_r = 0; + goto __pyx_L0; + + /* "_state.pxd":234 + * + * inline int cannot_sent_start(int word) noexcept nogil const: + * if word < 0 or word >= this.length: # <<<<<<<<<<<<<< + * return 0 + * elif this._sent[word].sent_start == -1: +*/ + } + + /* "_state.pxd":236 + * if word < 0 or word >= this.length: + * return 0 + * elif this._sent[word].sent_start == -1: # <<<<<<<<<<<<<< + * return 1 + * else: +*/ + __pyx_t_1 = ((this->_sent[__pyx_v_word]).sent_start == -1L); + if (__pyx_t_1) { + + /* "_state.pxd":237 + * return 0 + * elif this._sent[word].sent_start == -1: + * return 1 # <<<<<<<<<<<<<< + * else: + * return 0 +*/ + __pyx_r = 1; + goto __pyx_L0; + + /* "_state.pxd":236 + * if word < 0 or word >= this.length: + * return 0 + * elif this._sent[word].sent_start == -1: # <<<<<<<<<<<<<< + * return 1 + * else: +*/ + } + + /* "_state.pxd":239 + * return 1 + * else: + * return 0 # <<<<<<<<<<<<<< + * + * inline int is_sent_start(int word) noexcept nogil const: +*/ + /*else*/ { + __pyx_r = 0; + goto __pyx_L0; + } + + /* "_state.pxd":233 + * return this.stack_depth() <= 0 and this.eol() + * + * inline int cannot_sent_start(int word) noexcept nogil const: # <<<<<<<<<<<<<< + * if word < 0 or word >= this.length: + * return 0 +*/ + + /* function exit code */ + __pyx_L0:; + return __pyx_r; +} + +/* "_state.pxd":241 + * return 0 + * + * inline int is_sent_start(int word) noexcept nogil const: # <<<<<<<<<<<<<< + * if word < 0 or word >= this.length: + * return 0 +*/ + +int __pyx_t_5spacy_8pipeline_17_parser_internals_6_state_StateC::is_sent_start(int __pyx_v_word) const { + int __pyx_r; + int __pyx_t_1; + int __pyx_t_2; + + /* "_state.pxd":242 + * + * inline int is_sent_start(int word) noexcept nogil const: + * if word < 0 or word >= this.length: # <<<<<<<<<<<<<< + * return 0 + * elif this._sent[word].sent_start == 1: +*/ + __pyx_t_2 = (__pyx_v_word < 0); + if (!__pyx_t_2) { + } else { + __pyx_t_1 = __pyx_t_2; + goto __pyx_L4_bool_binop_done; + } + __pyx_t_2 = (__pyx_v_word >= this->length); + __pyx_t_1 = __pyx_t_2; + __pyx_L4_bool_binop_done:; + if (__pyx_t_1) { + + /* "_state.pxd":243 + * inline int is_sent_start(int word) noexcept nogil const: + * if word < 0 or word >= this.length: + * return 0 # <<<<<<<<<<<<<< + * elif this._sent[word].sent_start == 1: + * return 1 +*/ + __pyx_r = 0; + goto __pyx_L0; + + /* "_state.pxd":242 + * + * inline int is_sent_start(int word) noexcept nogil const: + * if word < 0 or word >= this.length: # <<<<<<<<<<<<<< + * return 0 + * elif this._sent[word].sent_start == 1: +*/ + } + + /* "_state.pxd":244 + * if word < 0 or word >= this.length: + * return 0 + * elif this._sent[word].sent_start == 1: # <<<<<<<<<<<<<< + * return 1 + * elif this._sent_starts.count(word) >= 1: +*/ + __pyx_t_1 = ((this->_sent[__pyx_v_word]).sent_start == 1); + if (__pyx_t_1) { + + /* "_state.pxd":245 + * return 0 + * elif this._sent[word].sent_start == 1: + * return 1 # <<<<<<<<<<<<<< + * elif this._sent_starts.count(word) >= 1: + * return 1 +*/ + __pyx_r = 1; + goto __pyx_L0; + + /* "_state.pxd":244 + * if word < 0 or word >= this.length: + * return 0 + * elif this._sent[word].sent_start == 1: # <<<<<<<<<<<<<< + * return 1 + * elif this._sent_starts.count(word) >= 1: +*/ + } + + /* "_state.pxd":246 + * elif this._sent[word].sent_start == 1: + * return 1 + * elif this._sent_starts.count(word) >= 1: # <<<<<<<<<<<<<< + * return 1 + * else: +*/ + __pyx_t_1 = (this->_sent_starts.count(__pyx_v_word) >= 1); + if (__pyx_t_1) { + + /* "_state.pxd":247 + * return 1 + * elif this._sent_starts.count(word) >= 1: + * return 1 # <<<<<<<<<<<<<< + * else: + * return 0 +*/ + __pyx_r = 1; + goto __pyx_L0; + + /* "_state.pxd":246 + * elif this._sent[word].sent_start == 1: + * return 1 + * elif this._sent_starts.count(word) >= 1: # <<<<<<<<<<<<<< + * return 1 + * else: +*/ + } + + /* "_state.pxd":249 + * return 1 + * else: + * return 0 # <<<<<<<<<<<<<< + * + * inline void set_sent_start(int word, int value) noexcept nogil: +*/ + /*else*/ { + __pyx_r = 0; + goto __pyx_L0; + } + + /* "_state.pxd":241 + * return 0 + * + * inline int is_sent_start(int word) noexcept nogil const: # <<<<<<<<<<<<<< + * if word < 0 or word >= this.length: + * return 0 +*/ + + /* function exit code */ + __pyx_L0:; + return __pyx_r; +} + +/* "_state.pxd":251 + * return 0 + * + * inline void set_sent_start(int word, int value) noexcept nogil: # <<<<<<<<<<<<<< + * if value >= 1: + * this._sent_starts.insert(word) +*/ + +void __pyx_t_5spacy_8pipeline_17_parser_internals_6_state_StateC::set_sent_start(int __pyx_v_word, int __pyx_v_value) { + int __pyx_t_1; + int __pyx_lineno = 0; + const char *__pyx_filename = NULL; + int __pyx_clineno = 0; + PyGILState_STATE __pyx_gilstate_save; + + /* "_state.pxd":252 + * + * inline void set_sent_start(int word, int value) noexcept nogil: + * if value >= 1: # <<<<<<<<<<<<<< + * this._sent_starts.insert(word) + * +*/ + __pyx_t_1 = (__pyx_v_value >= 1); + if (__pyx_t_1) { + + /* "_state.pxd":253 + * inline void set_sent_start(int word, int value) noexcept nogil: + * if value >= 1: + * this._sent_starts.insert(word) # <<<<<<<<<<<<<< + * + * inline bint has_head(int child) noexcept nogil const: +*/ + try { + this->_sent_starts.insert(__pyx_v_word); + } catch(...) { + PyGILState_STATE __pyx_gilstate_save = __Pyx_PyGILState_Ensure(); + __Pyx_CppExn2PyErr(); + __Pyx_PyGILState_Release(__pyx_gilstate_save); + __PYX_ERR(4, 253, __pyx_L1_error) + } + + /* "_state.pxd":252 + * + * inline void set_sent_start(int word, int value) noexcept nogil: + * if value >= 1: # <<<<<<<<<<<<<< + * this._sent_starts.insert(word) + * +*/ + } + + /* "_state.pxd":251 + * return 0 + * + * inline void set_sent_start(int word, int value) noexcept nogil: # <<<<<<<<<<<<<< + * if value >= 1: + * this._sent_starts.insert(word) +*/ + + /* function exit code */ + goto __pyx_L0; + __pyx_L1_error:; + __pyx_gilstate_save = __Pyx_PyGILState_Ensure(); + __Pyx_WriteUnraisable("StateC.set_sent_start", __pyx_clineno, __pyx_lineno, __pyx_filename, 1, 0); + __Pyx_PyGILState_Release(__pyx_gilstate_save); + __pyx_L0:; +} + +/* "_state.pxd":255 + * this._sent_starts.insert(word) + * + * inline bint has_head(int child) noexcept nogil const: # <<<<<<<<<<<<<< + * return this._heads[child] >= 0 + * +*/ + +int __pyx_t_5spacy_8pipeline_17_parser_internals_6_state_StateC::has_head(int __pyx_v_child) const { + int __pyx_r; + + /* "_state.pxd":256 + * + * inline bint has_head(int child) noexcept nogil const: + * return this._heads[child] >= 0 # <<<<<<<<<<<<<< + * + * inline int l_edge(int word) noexcept nogil const: +*/ + __pyx_r = ((this->_heads[__pyx_v_child]) >= 0); + goto __pyx_L0; + + /* "_state.pxd":255 + * this._sent_starts.insert(word) + * + * inline bint has_head(int child) noexcept nogil const: # <<<<<<<<<<<<<< + * return this._heads[child] >= 0 + * +*/ + + /* function exit code */ + __pyx_L0:; + return __pyx_r; +} + +/* "_state.pxd":258 + * return this._heads[child] >= 0 + * + * inline int l_edge(int word) noexcept nogil const: # <<<<<<<<<<<<<< + * return word + * +*/ + +int __pyx_t_5spacy_8pipeline_17_parser_internals_6_state_StateC::l_edge(int __pyx_v_word) const { + int __pyx_r; + + /* "_state.pxd":259 + * + * inline int l_edge(int word) noexcept nogil const: + * return word # <<<<<<<<<<<<<< + * + * inline int r_edge(int word) noexcept nogil const: +*/ + __pyx_r = __pyx_v_word; + goto __pyx_L0; + + /* "_state.pxd":258 + * return this._heads[child] >= 0 + * + * inline int l_edge(int word) noexcept nogil const: # <<<<<<<<<<<<<< + * return word + * +*/ + + /* function exit code */ + __pyx_L0:; + return __pyx_r; +} + +/* "_state.pxd":261 + * return word + * + * inline int r_edge(int word) noexcept nogil const: # <<<<<<<<<<<<<< + * return word + * +*/ + +int __pyx_t_5spacy_8pipeline_17_parser_internals_6_state_StateC::r_edge(int __pyx_v_word) const { + int __pyx_r; + + /* "_state.pxd":262 + * + * inline int r_edge(int word) noexcept nogil const: + * return word # <<<<<<<<<<<<<< + * + * inline int n_arcs(const unordered_map[int, vector[ArcC]] &heads_arcs, int head) noexcept nogil const: +*/ + __pyx_r = __pyx_v_word; + goto __pyx_L0; + + /* "_state.pxd":261 + * return word + * + * inline int r_edge(int word) noexcept nogil const: # <<<<<<<<<<<<<< + * return word + * +*/ + + /* function exit code */ + __pyx_L0:; + return __pyx_r; +} + +/* "_state.pxd":264 + * return word + * + * inline int n_arcs(const unordered_map[int, vector[ArcC]] &heads_arcs, int head) noexcept nogil const: # <<<<<<<<<<<<<< + * cdef int n = 0 + * head_arcs_it = heads_arcs.const_find(head) +*/ + +int __pyx_t_5spacy_8pipeline_17_parser_internals_6_state_StateC::n_arcs(std::unordered_map > const &__pyx_v_heads_arcs, int __pyx_v_head) const { + int __pyx_v_n; + std::unordered_map > ::const_iterator __pyx_v_head_arcs_it; + std::vector const *__pyx_v_arcs; + std::vector ::const_iterator __pyx_v_arcs_it; + struct __pyx_t_5spacy_8pipeline_17_parser_internals_6_state_ArcC __pyx_v_arc; + int __pyx_r; + int __pyx_t_1; + int __pyx_lineno = 0; + const char *__pyx_filename = NULL; + int __pyx_clineno = 0; + PyGILState_STATE __pyx_gilstate_save; + + /* "_state.pxd":265 + * + * inline int n_arcs(const unordered_map[int, vector[ArcC]] &heads_arcs, int head) noexcept nogil const: + * cdef int n = 0 # <<<<<<<<<<<<<< + * head_arcs_it = heads_arcs.const_find(head) + * if head_arcs_it == heads_arcs.const_end(): +*/ + __pyx_v_n = 0; + + /* "_state.pxd":266 + * inline int n_arcs(const unordered_map[int, vector[ArcC]] &heads_arcs, int head) noexcept nogil const: + * cdef int n = 0 + * head_arcs_it = heads_arcs.const_find(head) # <<<<<<<<<<<<<< + * if head_arcs_it == heads_arcs.const_end(): + * return n +*/ + try { + __pyx_v_head_arcs_it = __pyx_v_heads_arcs.find(__pyx_v_head); + } catch(...) { + PyGILState_STATE __pyx_gilstate_save = __Pyx_PyGILState_Ensure(); + __Pyx_CppExn2PyErr(); + __Pyx_PyGILState_Release(__pyx_gilstate_save); + __PYX_ERR(4, 266, __pyx_L1_error) + } + + /* "_state.pxd":267 + * cdef int n = 0 + * head_arcs_it = heads_arcs.const_find(head) + * if head_arcs_it == heads_arcs.const_end(): # <<<<<<<<<<<<<< + * return n + * +*/ + __pyx_t_1 = (__pyx_v_head_arcs_it == __pyx_v_heads_arcs.end()); + if (__pyx_t_1) { + + /* "_state.pxd":268 + * head_arcs_it = heads_arcs.const_find(head) + * if head_arcs_it == heads_arcs.const_end(): + * return n # <<<<<<<<<<<<<< + * + * cdef const vector[ArcC]* arcs = &deref(head_arcs_it).second +*/ + __pyx_r = __pyx_v_n; + goto __pyx_L0; + + /* "_state.pxd":267 + * cdef int n = 0 + * head_arcs_it = heads_arcs.const_find(head) + * if head_arcs_it == heads_arcs.const_end(): # <<<<<<<<<<<<<< + * return n + * +*/ + } + + /* "_state.pxd":270 + * return n + * + * cdef const vector[ArcC]* arcs = &deref(head_arcs_it).second # <<<<<<<<<<<<<< + * arcs_it = arcs.const_begin() + * while arcs_it != arcs.end(): +*/ + __pyx_v_arcs = (&(*__pyx_v_head_arcs_it).second); + + /* "_state.pxd":271 + * + * cdef const vector[ArcC]* arcs = &deref(head_arcs_it).second + * arcs_it = arcs.const_begin() # <<<<<<<<<<<<<< + * while arcs_it != arcs.end(): + * arc = deref(arcs_it) +*/ + try { + __pyx_v_arcs_it = __pyx_v_arcs->begin(); + } catch(...) { + PyGILState_STATE __pyx_gilstate_save = __Pyx_PyGILState_Ensure(); + __Pyx_CppExn2PyErr(); + __Pyx_PyGILState_Release(__pyx_gilstate_save); + __PYX_ERR(4, 271, __pyx_L1_error) + } + + /* "_state.pxd":272 + * cdef const vector[ArcC]* arcs = &deref(head_arcs_it).second + * arcs_it = arcs.const_begin() + * while arcs_it != arcs.end(): # <<<<<<<<<<<<<< + * arc = deref(arcs_it) + * if arc.child != -1: +*/ + while (1) { + __pyx_t_1 = (__pyx_v_arcs_it != __pyx_v_arcs->end()); + if (!__pyx_t_1) break; + + /* "_state.pxd":273 + * arcs_it = arcs.const_begin() + * while arcs_it != arcs.end(): + * arc = deref(arcs_it) # <<<<<<<<<<<<<< + * if arc.child != -1: + * n += 1 +*/ + __pyx_v_arc = (*__pyx_v_arcs_it); + + /* "_state.pxd":274 + * while arcs_it != arcs.end(): + * arc = deref(arcs_it) + * if arc.child != -1: # <<<<<<<<<<<<<< + * n += 1 + * incr(arcs_it) +*/ + __pyx_t_1 = (__pyx_v_arc.child != -1L); + if (__pyx_t_1) { + + /* "_state.pxd":275 + * arc = deref(arcs_it) + * if arc.child != -1: + * n += 1 # <<<<<<<<<<<<<< + * incr(arcs_it) + * +*/ + __pyx_v_n = (__pyx_v_n + 1); + + /* "_state.pxd":274 + * while arcs_it != arcs.end(): + * arc = deref(arcs_it) + * if arc.child != -1: # <<<<<<<<<<<<<< + * n += 1 + * incr(arcs_it) +*/ + } + + /* "_state.pxd":276 + * if arc.child != -1: + * n += 1 + * incr(arcs_it) # <<<<<<<<<<<<<< + * + * return n +*/ + (void)((++__pyx_v_arcs_it)); + } + + /* "_state.pxd":278 + * incr(arcs_it) + * + * return n # <<<<<<<<<<<<<< + * + * inline int n_L(int head) noexcept nogil const: +*/ + __pyx_r = __pyx_v_n; + goto __pyx_L0; + + /* "_state.pxd":264 + * return word + * + * inline int n_arcs(const unordered_map[int, vector[ArcC]] &heads_arcs, int head) noexcept nogil const: # <<<<<<<<<<<<<< + * cdef int n = 0 + * head_arcs_it = heads_arcs.const_find(head) +*/ + + /* function exit code */ + __pyx_L1_error:; + __pyx_gilstate_save = __Pyx_PyGILState_Ensure(); + __Pyx_WriteUnraisable("StateC.n_arcs", __pyx_clineno, __pyx_lineno, __pyx_filename, 1, 0); + __pyx_r = 0; + __Pyx_PyGILState_Release(__pyx_gilstate_save); + __pyx_L0:; + return __pyx_r; +} + +/* "_state.pxd":280 + * return n + * + * inline int n_L(int head) noexcept nogil const: # <<<<<<<<<<<<<< + * return n_arcs(this._left_arcs, head) + * +*/ + +int __pyx_t_5spacy_8pipeline_17_parser_internals_6_state_StateC::n_L(int __pyx_v_head) const { + int __pyx_r; + + /* "_state.pxd":281 + * + * inline int n_L(int head) noexcept nogil const: + * return n_arcs(this._left_arcs, head) # <<<<<<<<<<<<<< + * + * inline int n_R(int head) noexcept nogil const: +*/ + __pyx_r = n_arcs(this->_left_arcs, __pyx_v_head); + goto __pyx_L0; + + /* "_state.pxd":280 + * return n + * + * inline int n_L(int head) noexcept nogil const: # <<<<<<<<<<<<<< + * return n_arcs(this._left_arcs, head) + * +*/ + + /* function exit code */ + __pyx_L0:; + return __pyx_r; +} + +/* "_state.pxd":283 + * return n_arcs(this._left_arcs, head) + * + * inline int n_R(int head) noexcept nogil const: # <<<<<<<<<<<<<< + * return n_arcs(this._right_arcs, head) + * +*/ + +int __pyx_t_5spacy_8pipeline_17_parser_internals_6_state_StateC::n_R(int __pyx_v_head) const { + int __pyx_r; + + /* "_state.pxd":284 + * + * inline int n_R(int head) noexcept nogil const: + * return n_arcs(this._right_arcs, head) # <<<<<<<<<<<<<< + * + * inline bint stack_is_connected() noexcept nogil const: +*/ + __pyx_r = n_arcs(this->_right_arcs, __pyx_v_head); + goto __pyx_L0; + + /* "_state.pxd":283 + * return n_arcs(this._left_arcs, head) + * + * inline int n_R(int head) noexcept nogil const: # <<<<<<<<<<<<<< + * return n_arcs(this._right_arcs, head) + * +*/ + + /* function exit code */ + __pyx_L0:; + return __pyx_r; +} + +/* "_state.pxd":286 + * return n_arcs(this._right_arcs, head) + * + * inline bint stack_is_connected() noexcept nogil const: # <<<<<<<<<<<<<< + * return False + * +*/ + +int __pyx_t_5spacy_8pipeline_17_parser_internals_6_state_StateC::stack_is_connected(void) const { + int __pyx_r; + + /* "_state.pxd":287 + * + * inline bint stack_is_connected() noexcept nogil const: + * return False # <<<<<<<<<<<<<< + * + * inline bint entity_is_open() noexcept nogil const: +*/ + __pyx_r = 0; + goto __pyx_L0; + + /* "_state.pxd":286 + * return n_arcs(this._right_arcs, head) + * + * inline bint stack_is_connected() noexcept nogil const: # <<<<<<<<<<<<<< + * return False + * +*/ + + /* function exit code */ + __pyx_L0:; + return __pyx_r; +} + +/* "_state.pxd":289 + * return False + * + * inline bint entity_is_open() noexcept nogil const: # <<<<<<<<<<<<<< + * if this._ents.size() == 0: + * return False +*/ + +int __pyx_t_5spacy_8pipeline_17_parser_internals_6_state_StateC::entity_is_open(void) const { + int __pyx_r; + int __pyx_t_1; + + /* "_state.pxd":290 + * + * inline bint entity_is_open() noexcept nogil const: + * if this._ents.size() == 0: # <<<<<<<<<<<<<< + * return False + * else: +*/ + __pyx_t_1 = (this->_ents.size() == 0); + if (__pyx_t_1) { + + /* "_state.pxd":291 + * inline bint entity_is_open() noexcept nogil const: + * if this._ents.size() == 0: + * return False # <<<<<<<<<<<<<< + * else: + * return this._ents.back().end == -1 +*/ + __pyx_r = 0; + goto __pyx_L0; + + /* "_state.pxd":290 + * + * inline bint entity_is_open() noexcept nogil const: + * if this._ents.size() == 0: # <<<<<<<<<<<<<< + * return False + * else: +*/ + } + + /* "_state.pxd":293 + * return False + * else: + * return this._ents.back().end == -1 # <<<<<<<<<<<<<< + * + * inline int stack_depth() noexcept nogil const: +*/ + /*else*/ { + __pyx_r = (this->_ents.back().end == -1L); + goto __pyx_L0; + } + + /* "_state.pxd":289 + * return False + * + * inline bint entity_is_open() noexcept nogil const: # <<<<<<<<<<<<<< + * if this._ents.size() == 0: + * return False +*/ + + /* function exit code */ + __pyx_L0:; + return __pyx_r; +} + +/* "_state.pxd":295 + * return this._ents.back().end == -1 + * + * inline int stack_depth() noexcept nogil const: # <<<<<<<<<<<<<< + * return this._stack.size() + * +*/ + +int __pyx_t_5spacy_8pipeline_17_parser_internals_6_state_StateC::stack_depth(void) const { + int __pyx_r; + + /* "_state.pxd":296 + * + * inline int stack_depth() noexcept nogil const: + * return this._stack.size() # <<<<<<<<<<<<<< + * + * inline int buffer_length() noexcept nogil const: +*/ + __pyx_r = this->_stack.size(); + goto __pyx_L0; + + /* "_state.pxd":295 + * return this._ents.back().end == -1 + * + * inline int stack_depth() noexcept nogil const: # <<<<<<<<<<<<<< + * return this._stack.size() + * +*/ + + /* function exit code */ + __pyx_L0:; + return __pyx_r; +} + +/* "_state.pxd":298 + * return this._stack.size() + * + * inline int buffer_length() noexcept nogil const: # <<<<<<<<<<<<<< + * return (this.length - this._b_i) + this._rebuffer.size() + * +*/ + +int __pyx_t_5spacy_8pipeline_17_parser_internals_6_state_StateC::buffer_length(void) const { + int __pyx_r; + + /* "_state.pxd":299 + * + * inline int buffer_length() noexcept nogil const: + * return (this.length - this._b_i) + this._rebuffer.size() # <<<<<<<<<<<<<< + * + * inline void push() noexcept nogil: +*/ + __pyx_r = ((this->length - this->_b_i) + this->_rebuffer.size()); + goto __pyx_L0; + + /* "_state.pxd":298 + * return this._stack.size() + * + * inline int buffer_length() noexcept nogil const: # <<<<<<<<<<<<<< + * return (this.length - this._b_i) + this._rebuffer.size() + * +*/ + + /* function exit code */ + __pyx_L0:; + return __pyx_r; +} + +/* "_state.pxd":301 + * return (this.length - this._b_i) + this._rebuffer.size() + * + * inline void push() noexcept nogil: # <<<<<<<<<<<<<< + * b0 = this.B(0) + * if this._rebuffer.size(): +*/ + +void __pyx_t_5spacy_8pipeline_17_parser_internals_6_state_StateC::push(void) { + int __pyx_v_b0; + int __pyx_t_1; + int __pyx_t_2; + int __pyx_lineno = 0; + const char *__pyx_filename = NULL; + int __pyx_clineno = 0; + PyGILState_STATE __pyx_gilstate_save; + + /* "_state.pxd":302 + * + * inline void push() noexcept nogil: + * b0 = this.B(0) # <<<<<<<<<<<<<< + * if this._rebuffer.size(): + * b0 = this._rebuffer.back() +*/ + __pyx_v_b0 = this->B(0); + + /* "_state.pxd":303 + * inline void push() noexcept nogil: + * b0 = this.B(0) + * if this._rebuffer.size(): # <<<<<<<<<<<<<< + * b0 = this._rebuffer.back() + * this._rebuffer.pop_back() +*/ + __pyx_t_1 = (this->_rebuffer.size() != 0); + if (__pyx_t_1) { + + /* "_state.pxd":304 + * b0 = this.B(0) + * if this._rebuffer.size(): + * b0 = this._rebuffer.back() # <<<<<<<<<<<<<< + * this._rebuffer.pop_back() + * else: +*/ + __pyx_v_b0 = this->_rebuffer.back(); + + /* "_state.pxd":305 + * if this._rebuffer.size(): + * b0 = this._rebuffer.back() + * this._rebuffer.pop_back() # <<<<<<<<<<<<<< + * else: + * b0 = this._b_i +*/ + this->_rebuffer.pop_back(); + + /* "_state.pxd":303 + * inline void push() noexcept nogil: + * b0 = this.B(0) + * if this._rebuffer.size(): # <<<<<<<<<<<<<< + * b0 = this._rebuffer.back() + * this._rebuffer.pop_back() +*/ + goto __pyx_L3; + } + + /* "_state.pxd":307 + * this._rebuffer.pop_back() + * else: + * b0 = this._b_i # <<<<<<<<<<<<<< + * this._b_i += 1 + * this._stack.push_back(b0) +*/ + /*else*/ { + __pyx_t_2 = this->_b_i; + __pyx_v_b0 = __pyx_t_2; + + /* "_state.pxd":308 + * else: + * b0 = this._b_i + * this._b_i += 1 # <<<<<<<<<<<<<< + * this._stack.push_back(b0) + * +*/ + this->_b_i = (this->_b_i + 1); + } + __pyx_L3:; + + /* "_state.pxd":309 + * b0 = this._b_i + * this._b_i += 1 + * this._stack.push_back(b0) # <<<<<<<<<<<<<< + * + * inline void pop() noexcept nogil: +*/ + try { + this->_stack.push_back(__pyx_v_b0); + } catch(...) { + PyGILState_STATE __pyx_gilstate_save = __Pyx_PyGILState_Ensure(); + __Pyx_CppExn2PyErr(); + __Pyx_PyGILState_Release(__pyx_gilstate_save); + __PYX_ERR(4, 309, __pyx_L1_error) + } + + /* "_state.pxd":301 + * return (this.length - this._b_i) + this._rebuffer.size() + * + * inline void push() noexcept nogil: # <<<<<<<<<<<<<< + * b0 = this.B(0) + * if this._rebuffer.size(): +*/ + + /* function exit code */ + goto __pyx_L0; + __pyx_L1_error:; + __pyx_gilstate_save = __Pyx_PyGILState_Ensure(); + __Pyx_WriteUnraisable("StateC.push", __pyx_clineno, __pyx_lineno, __pyx_filename, 1, 0); + __Pyx_PyGILState_Release(__pyx_gilstate_save); + __pyx_L0:; +} + +/* "_state.pxd":311 + * this._stack.push_back(b0) + * + * inline void pop() noexcept nogil: # <<<<<<<<<<<<<< + * this._stack.pop_back() + * +*/ + +void __pyx_t_5spacy_8pipeline_17_parser_internals_6_state_StateC::pop(void) { + + /* "_state.pxd":312 + * + * inline void pop() noexcept nogil: + * this._stack.pop_back() # <<<<<<<<<<<<<< + * + * inline void force_final() noexcept nogil: +*/ + this->_stack.pop_back(); + + /* "_state.pxd":311 + * this._stack.push_back(b0) + * + * inline void pop() noexcept nogil: # <<<<<<<<<<<<<< + * this._stack.pop_back() + * +*/ + + /* function exit code */ +} + +/* "_state.pxd":314 + * this._stack.pop_back() + * + * inline void force_final() noexcept nogil: # <<<<<<<<<<<<<< + * # This should only be used in desperate situations, as it may leave + * # the analysis in an unexpected state. +*/ + +void __pyx_t_5spacy_8pipeline_17_parser_internals_6_state_StateC::force_final(void) { + int __pyx_t_1; + + /* "_state.pxd":317 + * # This should only be used in desperate situations, as it may leave + * # the analysis in an unexpected state. + * this._stack.clear() # <<<<<<<<<<<<<< + * this._b_i = this.length + * +*/ + this->_stack.clear(); + + /* "_state.pxd":318 + * # the analysis in an unexpected state. + * this._stack.clear() + * this._b_i = this.length # <<<<<<<<<<<<<< + * + * inline void unshift() noexcept nogil: +*/ + __pyx_t_1 = this->length; + this->_b_i = __pyx_t_1; + + /* "_state.pxd":314 + * this._stack.pop_back() + * + * inline void force_final() noexcept nogil: # <<<<<<<<<<<<<< + * # This should only be used in desperate situations, as it may leave + * # the analysis in an unexpected state. +*/ + + /* function exit code */ +} + +/* "_state.pxd":320 + * this._b_i = this.length + * + * inline void unshift() noexcept nogil: # <<<<<<<<<<<<<< + * s0 = this._stack.back() + * this._unshiftable[s0] = 1 +*/ + +void __pyx_t_5spacy_8pipeline_17_parser_internals_6_state_StateC::unshift(void) { + int __pyx_v_s0; + int __pyx_lineno = 0; + const char *__pyx_filename = NULL; + int __pyx_clineno = 0; + PyGILState_STATE __pyx_gilstate_save; + + /* "_state.pxd":321 + * + * inline void unshift() noexcept nogil: + * s0 = this._stack.back() # <<<<<<<<<<<<<< + * this._unshiftable[s0] = 1 + * this._rebuffer.push_back(s0) +*/ + __pyx_v_s0 = this->_stack.back(); + + /* "_state.pxd":322 + * inline void unshift() noexcept nogil: + * s0 = this._stack.back() + * this._unshiftable[s0] = 1 # <<<<<<<<<<<<<< + * this._rebuffer.push_back(s0) + * this._stack.pop_back() +*/ + (this->_unshiftable[__pyx_v_s0]) = 1; + + /* "_state.pxd":323 + * s0 = this._stack.back() + * this._unshiftable[s0] = 1 + * this._rebuffer.push_back(s0) # <<<<<<<<<<<<<< + * this._stack.pop_back() + * +*/ + try { + this->_rebuffer.push_back(__pyx_v_s0); + } catch(...) { + PyGILState_STATE __pyx_gilstate_save = __Pyx_PyGILState_Ensure(); + __Pyx_CppExn2PyErr(); + __Pyx_PyGILState_Release(__pyx_gilstate_save); + __PYX_ERR(4, 323, __pyx_L1_error) + } + + /* "_state.pxd":324 + * this._unshiftable[s0] = 1 + * this._rebuffer.push_back(s0) + * this._stack.pop_back() # <<<<<<<<<<<<<< + * + * inline int is_unshiftable(int item) noexcept nogil const: +*/ + this->_stack.pop_back(); + + /* "_state.pxd":320 + * this._b_i = this.length + * + * inline void unshift() noexcept nogil: # <<<<<<<<<<<<<< + * s0 = this._stack.back() + * this._unshiftable[s0] = 1 +*/ + + /* function exit code */ + goto __pyx_L0; + __pyx_L1_error:; + __pyx_gilstate_save = __Pyx_PyGILState_Ensure(); + __Pyx_WriteUnraisable("StateC.unshift", __pyx_clineno, __pyx_lineno, __pyx_filename, 1, 0); + __Pyx_PyGILState_Release(__pyx_gilstate_save); + __pyx_L0:; +} + +/* "_state.pxd":326 + * this._stack.pop_back() + * + * inline int is_unshiftable(int item) noexcept nogil const: # <<<<<<<<<<<<<< + * if item >= this._unshiftable.size(): + * return 0 +*/ + +int __pyx_t_5spacy_8pipeline_17_parser_internals_6_state_StateC::is_unshiftable(int __pyx_v_item) const { + int __pyx_r; + int __pyx_t_1; + bool __pyx_t_2; + int __pyx_lineno = 0; + const char *__pyx_filename = NULL; + int __pyx_clineno = 0; + PyGILState_STATE __pyx_gilstate_save; + + /* "_state.pxd":327 + * + * inline int is_unshiftable(int item) noexcept nogil const: + * if item >= this._unshiftable.size(): # <<<<<<<<<<<<<< + * return 0 + * else: +*/ + __pyx_t_1 = (__pyx_v_item >= this->_unshiftable.size()); + if (__pyx_t_1) { + + /* "_state.pxd":328 + * inline int is_unshiftable(int item) noexcept nogil const: + * if item >= this._unshiftable.size(): + * return 0 # <<<<<<<<<<<<<< + * else: + * return this._unshiftable.at(item) +*/ + __pyx_r = 0; + goto __pyx_L0; + + /* "_state.pxd":327 + * + * inline int is_unshiftable(int item) noexcept nogil const: + * if item >= this._unshiftable.size(): # <<<<<<<<<<<<<< + * return 0 + * else: +*/ + } + + /* "_state.pxd":330 + * return 0 + * else: + * return this._unshiftable.at(item) # <<<<<<<<<<<<<< + * + * inline void set_reshiftable(int item) noexcept nogil: +*/ + /*else*/ { + try { + __pyx_t_2 = this->_unshiftable.at(__pyx_v_item); + } catch(...) { + PyGILState_STATE __pyx_gilstate_save = __Pyx_PyGILState_Ensure(); + __Pyx_CppExn2PyErr(); + __Pyx_PyGILState_Release(__pyx_gilstate_save); + __PYX_ERR(4, 330, __pyx_L1_error) + } + __pyx_r = __pyx_t_2; + goto __pyx_L0; + } + + /* "_state.pxd":326 + * this._stack.pop_back() + * + * inline int is_unshiftable(int item) noexcept nogil const: # <<<<<<<<<<<<<< + * if item >= this._unshiftable.size(): + * return 0 +*/ + + /* function exit code */ + __pyx_L1_error:; + __pyx_gilstate_save = __Pyx_PyGILState_Ensure(); + __Pyx_WriteUnraisable("StateC.is_unshiftable", __pyx_clineno, __pyx_lineno, __pyx_filename, 1, 0); + __pyx_r = 0; + __Pyx_PyGILState_Release(__pyx_gilstate_save); + __pyx_L0:; + return __pyx_r; +} + +/* "_state.pxd":332 + * return this._unshiftable.at(item) + * + * inline void set_reshiftable(int item) noexcept nogil: # <<<<<<<<<<<<<< + * if item < this._unshiftable.size(): + * this._unshiftable[item] = 0 +*/ + +void __pyx_t_5spacy_8pipeline_17_parser_internals_6_state_StateC::set_reshiftable(int __pyx_v_item) { + int __pyx_t_1; + + /* "_state.pxd":333 + * + * inline void set_reshiftable(int item) noexcept nogil: + * if item < this._unshiftable.size(): # <<<<<<<<<<<<<< + * this._unshiftable[item] = 0 + * +*/ + __pyx_t_1 = (__pyx_v_item < this->_unshiftable.size()); + if (__pyx_t_1) { + + /* "_state.pxd":334 + * inline void set_reshiftable(int item) noexcept nogil: + * if item < this._unshiftable.size(): + * this._unshiftable[item] = 0 # <<<<<<<<<<<<<< + * + * inline void add_arc(int head, int child, attr_t label) noexcept nogil: +*/ + (this->_unshiftable[__pyx_v_item]) = 0; + + /* "_state.pxd":333 + * + * inline void set_reshiftable(int item) noexcept nogil: + * if item < this._unshiftable.size(): # <<<<<<<<<<<<<< + * this._unshiftable[item] = 0 + * +*/ + } + + /* "_state.pxd":332 + * return this._unshiftable.at(item) + * + * inline void set_reshiftable(int item) noexcept nogil: # <<<<<<<<<<<<<< + * if item < this._unshiftable.size(): + * this._unshiftable[item] = 0 +*/ + + /* function exit code */ +} + +/* "_state.pxd":336 + * this._unshiftable[item] = 0 + * + * inline void add_arc(int head, int child, attr_t label) noexcept nogil: # <<<<<<<<<<<<<< + * if this.has_head(child): + * this.del_arc(this.H(child), child) +*/ + +void __pyx_t_5spacy_8pipeline_17_parser_internals_6_state_StateC::add_arc(int __pyx_v_head, int __pyx_v_child, __pyx_t_5spacy_8typedefs_attr_t __pyx_v_label) { + struct __pyx_t_5spacy_8pipeline_17_parser_internals_6_state_ArcC __pyx_v_arc; + int __pyx_t_1; + int __pyx_lineno = 0; + const char *__pyx_filename = NULL; + int __pyx_clineno = 0; + PyGILState_STATE __pyx_gilstate_save; + + /* "_state.pxd":337 + * + * inline void add_arc(int head, int child, attr_t label) noexcept nogil: + * if this.has_head(child): # <<<<<<<<<<<<<< + * this.del_arc(this.H(child), child) + * cdef ArcC arc +*/ + __pyx_t_1 = this->has_head(__pyx_v_child); + if (__pyx_t_1) { + + /* "_state.pxd":338 + * inline void add_arc(int head, int child, attr_t label) noexcept nogil: + * if this.has_head(child): + * this.del_arc(this.H(child), child) # <<<<<<<<<<<<<< + * cdef ArcC arc + * arc.head = head +*/ + this->del_arc(this->H(__pyx_v_child), __pyx_v_child); + + /* "_state.pxd":337 + * + * inline void add_arc(int head, int child, attr_t label) noexcept nogil: + * if this.has_head(child): # <<<<<<<<<<<<<< + * this.del_arc(this.H(child), child) + * cdef ArcC arc +*/ + } + + /* "_state.pxd":340 + * this.del_arc(this.H(child), child) + * cdef ArcC arc + * arc.head = head # <<<<<<<<<<<<<< + * arc.child = child + * arc.label = label +*/ + __pyx_v_arc.head = __pyx_v_head; + + /* "_state.pxd":341 + * cdef ArcC arc + * arc.head = head + * arc.child = child # <<<<<<<<<<<<<< + * arc.label = label + * if head > child: +*/ + __pyx_v_arc.child = __pyx_v_child; + + /* "_state.pxd":342 + * arc.head = head + * arc.child = child + * arc.label = label # <<<<<<<<<<<<<< + * if head > child: + * this._left_arcs[arc.head].push_back(arc) +*/ + __pyx_v_arc.label = __pyx_v_label; + + /* "_state.pxd":343 + * arc.child = child + * arc.label = label + * if head > child: # <<<<<<<<<<<<<< + * this._left_arcs[arc.head].push_back(arc) + * else: +*/ + __pyx_t_1 = (__pyx_v_head > __pyx_v_child); + if (__pyx_t_1) { + + /* "_state.pxd":344 + * arc.label = label + * if head > child: + * this._left_arcs[arc.head].push_back(arc) # <<<<<<<<<<<<<< + * else: + * this._right_arcs[arc.head].push_back(arc) +*/ + try { + (this->_left_arcs[__pyx_v_arc.head]).push_back(__pyx_v_arc); + } catch(...) { + PyGILState_STATE __pyx_gilstate_save = __Pyx_PyGILState_Ensure(); + __Pyx_CppExn2PyErr(); + __Pyx_PyGILState_Release(__pyx_gilstate_save); + __PYX_ERR(4, 344, __pyx_L1_error) + } + + /* "_state.pxd":343 + * arc.child = child + * arc.label = label + * if head > child: # <<<<<<<<<<<<<< + * this._left_arcs[arc.head].push_back(arc) + * else: +*/ + goto __pyx_L4; + } + + /* "_state.pxd":346 + * this._left_arcs[arc.head].push_back(arc) + * else: + * this._right_arcs[arc.head].push_back(arc) # <<<<<<<<<<<<<< + * this._heads[child] = head + * +*/ + /*else*/ { + try { + (this->_right_arcs[__pyx_v_arc.head]).push_back(__pyx_v_arc); + } catch(...) { + PyGILState_STATE __pyx_gilstate_save = __Pyx_PyGILState_Ensure(); + __Pyx_CppExn2PyErr(); + __Pyx_PyGILState_Release(__pyx_gilstate_save); + __PYX_ERR(4, 346, __pyx_L1_error) + } + } + __pyx_L4:; + + /* "_state.pxd":347 + * else: + * this._right_arcs[arc.head].push_back(arc) + * this._heads[child] = head # <<<<<<<<<<<<<< + * + * inline void map_del_arc(unordered_map[int, vector[ArcC]]* heads_arcs, int h_i, int c_i) noexcept nogil: +*/ + (this->_heads[__pyx_v_child]) = __pyx_v_head; + + /* "_state.pxd":336 + * this._unshiftable[item] = 0 + * + * inline void add_arc(int head, int child, attr_t label) noexcept nogil: # <<<<<<<<<<<<<< + * if this.has_head(child): + * this.del_arc(this.H(child), child) +*/ + + /* function exit code */ + goto __pyx_L0; + __pyx_L1_error:; + __pyx_gilstate_save = __Pyx_PyGILState_Ensure(); + __Pyx_WriteUnraisable("StateC.add_arc", __pyx_clineno, __pyx_lineno, __pyx_filename, 1, 0); + __Pyx_PyGILState_Release(__pyx_gilstate_save); + __pyx_L0:; +} + +/* "_state.pxd":349 + * this._heads[child] = head + * + * inline void map_del_arc(unordered_map[int, vector[ArcC]]* heads_arcs, int h_i, int c_i) noexcept nogil: # <<<<<<<<<<<<<< + * arcs_it = heads_arcs.find(h_i) + * if arcs_it == heads_arcs.end(): +*/ + +void __pyx_t_5spacy_8pipeline_17_parser_internals_6_state_StateC::map_del_arc(std::unordered_map > *__pyx_v_heads_arcs, int __pyx_v_h_i, int __pyx_v_c_i) { + std::unordered_map > ::iterator __pyx_v_arcs_it; + std::vector *__pyx_v_arcs; + struct __pyx_t_5spacy_8pipeline_17_parser_internals_6_state_ArcC __pyx_v_arc; + std::vector ::size_type __pyx_v_i; + int __pyx_t_1; + int __pyx_t_2; + std::vector ::size_type __pyx_t_3; + std::vector ::size_type __pyx_t_4; + std::vector ::size_type __pyx_t_5; + __Pyx_FakeReference __pyx_t_6; + int __pyx_lineno = 0; + const char *__pyx_filename = NULL; + int __pyx_clineno = 0; + PyGILState_STATE __pyx_gilstate_save; + + /* "_state.pxd":350 + * + * inline void map_del_arc(unordered_map[int, vector[ArcC]]* heads_arcs, int h_i, int c_i) noexcept nogil: + * arcs_it = heads_arcs.find(h_i) # <<<<<<<<<<<<<< + * if arcs_it == heads_arcs.end(): + * return +*/ + __pyx_v_arcs_it = __pyx_v_heads_arcs->find(__pyx_v_h_i); + + /* "_state.pxd":351 + * inline void map_del_arc(unordered_map[int, vector[ArcC]]* heads_arcs, int h_i, int c_i) noexcept nogil: + * arcs_it = heads_arcs.find(h_i) + * if arcs_it == heads_arcs.end(): # <<<<<<<<<<<<<< + * return + * +*/ + __pyx_t_1 = (__pyx_v_arcs_it == __pyx_v_heads_arcs->end()); + if (__pyx_t_1) { + + /* "_state.pxd":352 + * arcs_it = heads_arcs.find(h_i) + * if arcs_it == heads_arcs.end(): + * return # <<<<<<<<<<<<<< + * + * arcs = &deref(arcs_it).second +*/ + goto __pyx_L0; + + /* "_state.pxd":351 + * inline void map_del_arc(unordered_map[int, vector[ArcC]]* heads_arcs, int h_i, int c_i) noexcept nogil: + * arcs_it = heads_arcs.find(h_i) + * if arcs_it == heads_arcs.end(): # <<<<<<<<<<<<<< + * return + * +*/ + } + + /* "_state.pxd":354 + * return + * + * arcs = &deref(arcs_it).second # <<<<<<<<<<<<<< + * if arcs.size() == 0: + * return +*/ + __pyx_v_arcs = (&(*__pyx_v_arcs_it).second); + + /* "_state.pxd":355 + * + * arcs = &deref(arcs_it).second + * if arcs.size() == 0: # <<<<<<<<<<<<<< + * return + * +*/ + __pyx_t_1 = (__pyx_v_arcs->size() == 0); + if (__pyx_t_1) { + + /* "_state.pxd":356 + * arcs = &deref(arcs_it).second + * if arcs.size() == 0: + * return # <<<<<<<<<<<<<< + * + * arc = arcs.back() +*/ + goto __pyx_L0; + + /* "_state.pxd":355 + * + * arcs = &deref(arcs_it).second + * if arcs.size() == 0: # <<<<<<<<<<<<<< + * return + * +*/ + } + + /* "_state.pxd":358 + * return + * + * arc = arcs.back() # <<<<<<<<<<<<<< + * if arc.head == h_i and arc.child == c_i: + * arcs.pop_back() +*/ + __pyx_v_arc = __pyx_v_arcs->back(); + + /* "_state.pxd":359 + * + * arc = arcs.back() + * if arc.head == h_i and arc.child == c_i: # <<<<<<<<<<<<<< + * arcs.pop_back() + * else: +*/ + __pyx_t_2 = (__pyx_v_arc.head == __pyx_v_h_i); + if (__pyx_t_2) { + } else { + __pyx_t_1 = __pyx_t_2; + goto __pyx_L6_bool_binop_done; + } + __pyx_t_2 = (__pyx_v_arc.child == __pyx_v_c_i); + __pyx_t_1 = __pyx_t_2; + __pyx_L6_bool_binop_done:; + if (__pyx_t_1) { + + /* "_state.pxd":360 + * arc = arcs.back() + * if arc.head == h_i and arc.child == c_i: + * arcs.pop_back() # <<<<<<<<<<<<<< + * else: + * for i in range(arcs.size()-1): +*/ + __pyx_v_arcs->pop_back(); + + /* "_state.pxd":359 + * + * arc = arcs.back() + * if arc.head == h_i and arc.child == c_i: # <<<<<<<<<<<<<< + * arcs.pop_back() + * else: +*/ + goto __pyx_L5; + } + + /* "_state.pxd":362 + * arcs.pop_back() + * else: + * for i in range(arcs.size()-1): # <<<<<<<<<<<<<< + * arc = arcs.at(i) + * if arc.head == h_i and arc.child == c_i: +*/ + /*else*/ { + __pyx_t_3 = (__pyx_v_arcs->size() - 1); + __pyx_t_4 = __pyx_t_3; + for (__pyx_t_5 = 0; __pyx_t_5 < __pyx_t_4; __pyx_t_5+=1) { + __pyx_v_i = __pyx_t_5; + + /* "_state.pxd":363 + * else: + * for i in range(arcs.size()-1): + * arc = arcs.at(i) # <<<<<<<<<<<<<< + * if arc.head == h_i and arc.child == c_i: + * arc.head = -1 +*/ + try { + __pyx_t_6 = __pyx_v_arcs->at(__pyx_v_i); + } catch(...) { + PyGILState_STATE __pyx_gilstate_save = __Pyx_PyGILState_Ensure(); + __Pyx_CppExn2PyErr(); + __Pyx_PyGILState_Release(__pyx_gilstate_save); + __PYX_ERR(4, 363, __pyx_L1_error) + } + __pyx_v_arc = __pyx_t_6; + + /* "_state.pxd":364 + * for i in range(arcs.size()-1): + * arc = arcs.at(i) + * if arc.head == h_i and arc.child == c_i: # <<<<<<<<<<<<<< + * arc.head = -1 + * arc.child = -1 +*/ + __pyx_t_2 = (__pyx_v_arc.head == __pyx_v_h_i); + if (__pyx_t_2) { + } else { + __pyx_t_1 = __pyx_t_2; + goto __pyx_L11_bool_binop_done; + } + __pyx_t_2 = (__pyx_v_arc.child == __pyx_v_c_i); + __pyx_t_1 = __pyx_t_2; + __pyx_L11_bool_binop_done:; + if (__pyx_t_1) { + + /* "_state.pxd":365 + * arc = arcs.at(i) + * if arc.head == h_i and arc.child == c_i: + * arc.head = -1 # <<<<<<<<<<<<<< + * arc.child = -1 + * arc.label = 0 +*/ + __pyx_v_arc.head = -1; + + /* "_state.pxd":366 + * if arc.head == h_i and arc.child == c_i: + * arc.head = -1 + * arc.child = -1 # <<<<<<<<<<<<<< + * arc.label = 0 + * break +*/ + __pyx_v_arc.child = -1; + + /* "_state.pxd":367 + * arc.head = -1 + * arc.child = -1 + * arc.label = 0 # <<<<<<<<<<<<<< + * break + * +*/ + __pyx_v_arc.label = 0; + + /* "_state.pxd":368 + * arc.child = -1 + * arc.label = 0 + * break # <<<<<<<<<<<<<< + * + * inline void del_arc(int h_i, int c_i) noexcept nogil: +*/ + goto __pyx_L9_break; + + /* "_state.pxd":364 + * for i in range(arcs.size()-1): + * arc = arcs.at(i) + * if arc.head == h_i and arc.child == c_i: # <<<<<<<<<<<<<< + * arc.head = -1 + * arc.child = -1 +*/ + } + } + __pyx_L9_break:; + } + __pyx_L5:; + + /* "_state.pxd":349 + * this._heads[child] = head + * + * inline void map_del_arc(unordered_map[int, vector[ArcC]]* heads_arcs, int h_i, int c_i) noexcept nogil: # <<<<<<<<<<<<<< + * arcs_it = heads_arcs.find(h_i) + * if arcs_it == heads_arcs.end(): +*/ + + /* function exit code */ + goto __pyx_L0; + __pyx_L1_error:; + __pyx_gilstate_save = __Pyx_PyGILState_Ensure(); + __Pyx_WriteUnraisable("StateC.map_del_arc", __pyx_clineno, __pyx_lineno, __pyx_filename, 1, 0); + __Pyx_PyGILState_Release(__pyx_gilstate_save); + __pyx_L0:; +} + +/* "_state.pxd":370 + * break + * + * inline void del_arc(int h_i, int c_i) noexcept nogil: # <<<<<<<<<<<<<< + * if h_i > c_i: + * this.map_del_arc(&this._left_arcs, h_i, c_i) +*/ + +void __pyx_t_5spacy_8pipeline_17_parser_internals_6_state_StateC::del_arc(int __pyx_v_h_i, int __pyx_v_c_i) { + int __pyx_t_1; + + /* "_state.pxd":371 + * + * inline void del_arc(int h_i, int c_i) noexcept nogil: + * if h_i > c_i: # <<<<<<<<<<<<<< + * this.map_del_arc(&this._left_arcs, h_i, c_i) + * else: +*/ + __pyx_t_1 = (__pyx_v_h_i > __pyx_v_c_i); + if (__pyx_t_1) { + + /* "_state.pxd":372 + * inline void del_arc(int h_i, int c_i) noexcept nogil: + * if h_i > c_i: + * this.map_del_arc(&this._left_arcs, h_i, c_i) # <<<<<<<<<<<<<< + * else: + * this.map_del_arc(&this._right_arcs, h_i, c_i) +*/ + this->map_del_arc((&this->_left_arcs), __pyx_v_h_i, __pyx_v_c_i); + + /* "_state.pxd":371 + * + * inline void del_arc(int h_i, int c_i) noexcept nogil: + * if h_i > c_i: # <<<<<<<<<<<<<< + * this.map_del_arc(&this._left_arcs, h_i, c_i) + * else: +*/ + goto __pyx_L3; + } + + /* "_state.pxd":374 + * this.map_del_arc(&this._left_arcs, h_i, c_i) + * else: + * this.map_del_arc(&this._right_arcs, h_i, c_i) # <<<<<<<<<<<<<< + * + * inline SpanC get_ent() noexcept nogil const: +*/ + /*else*/ { + this->map_del_arc((&this->_right_arcs), __pyx_v_h_i, __pyx_v_c_i); + } + __pyx_L3:; + + /* "_state.pxd":370 + * break + * + * inline void del_arc(int h_i, int c_i) noexcept nogil: # <<<<<<<<<<<<<< + * if h_i > c_i: + * this.map_del_arc(&this._left_arcs, h_i, c_i) +*/ + + /* function exit code */ +} + +/* "_state.pxd":376 + * this.map_del_arc(&this._right_arcs, h_i, c_i) + * + * inline SpanC get_ent() noexcept nogil const: # <<<<<<<<<<<<<< + * cdef SpanC ent + * if this._ents.size() == 0: +*/ + +struct __pyx_t_5spacy_7structs_SpanC __pyx_t_5spacy_8pipeline_17_parser_internals_6_state_StateC::get_ent(void) const { + struct __pyx_t_5spacy_7structs_SpanC __pyx_v_ent; + struct __pyx_t_5spacy_7structs_SpanC __pyx_r; + int __pyx_t_1; + + /* "_state.pxd":378 + * inline SpanC get_ent() noexcept nogil const: + * cdef SpanC ent + * if this._ents.size() == 0: # <<<<<<<<<<<<<< + * ent.start = 0 + * ent.end = 0 +*/ + __pyx_t_1 = (this->_ents.size() == 0); + if (__pyx_t_1) { + + /* "_state.pxd":379 + * cdef SpanC ent + * if this._ents.size() == 0: + * ent.start = 0 # <<<<<<<<<<<<<< + * ent.end = 0 + * ent.label = 0 +*/ + __pyx_v_ent.start = 0; + + /* "_state.pxd":380 + * if this._ents.size() == 0: + * ent.start = 0 + * ent.end = 0 # <<<<<<<<<<<<<< + * ent.label = 0 + * return ent +*/ + __pyx_v_ent.end = 0; + + /* "_state.pxd":381 + * ent.start = 0 + * ent.end = 0 + * ent.label = 0 # <<<<<<<<<<<<<< + * return ent + * else: +*/ + __pyx_v_ent.label = 0; + + /* "_state.pxd":382 + * ent.end = 0 + * ent.label = 0 + * return ent # <<<<<<<<<<<<<< + * else: + * return this._ents.back() +*/ + __pyx_r = __pyx_v_ent; + goto __pyx_L0; + + /* "_state.pxd":378 + * inline SpanC get_ent() noexcept nogil const: + * cdef SpanC ent + * if this._ents.size() == 0: # <<<<<<<<<<<<<< + * ent.start = 0 + * ent.end = 0 +*/ + } + + /* "_state.pxd":384 + * return ent + * else: + * return this._ents.back() # <<<<<<<<<<<<<< + * + * inline void open_ent(attr_t label) noexcept nogil: +*/ + /*else*/ { + __pyx_r = this->_ents.back(); + goto __pyx_L0; + } + + /* "_state.pxd":376 + * this.map_del_arc(&this._right_arcs, h_i, c_i) + * + * inline SpanC get_ent() noexcept nogil const: # <<<<<<<<<<<<<< + * cdef SpanC ent + * if this._ents.size() == 0: +*/ + + /* function exit code */ + __pyx_L0:; + return __pyx_r; +} + +/* "_state.pxd":386 + * return this._ents.back() + * + * inline void open_ent(attr_t label) noexcept nogil: # <<<<<<<<<<<<<< + * cdef SpanC ent + * ent.start = this.B(0) +*/ + +void __pyx_t_5spacy_8pipeline_17_parser_internals_6_state_StateC::open_ent(__pyx_t_5spacy_8typedefs_attr_t __pyx_v_label) { + struct __pyx_t_5spacy_7structs_SpanC __pyx_v_ent; + int __pyx_lineno = 0; + const char *__pyx_filename = NULL; + int __pyx_clineno = 0; + PyGILState_STATE __pyx_gilstate_save; + + /* "_state.pxd":388 + * inline void open_ent(attr_t label) noexcept nogil: + * cdef SpanC ent + * ent.start = this.B(0) # <<<<<<<<<<<<<< + * ent.label = label + * ent.end = -1 +*/ + __pyx_v_ent.start = this->B(0); + + /* "_state.pxd":389 + * cdef SpanC ent + * ent.start = this.B(0) + * ent.label = label # <<<<<<<<<<<<<< + * ent.end = -1 + * this._ents.push_back(ent) +*/ + __pyx_v_ent.label = __pyx_v_label; + + /* "_state.pxd":390 + * ent.start = this.B(0) + * ent.label = label + * ent.end = -1 # <<<<<<<<<<<<<< + * this._ents.push_back(ent) + * +*/ + __pyx_v_ent.end = -1; + + /* "_state.pxd":391 + * ent.label = label + * ent.end = -1 + * this._ents.push_back(ent) # <<<<<<<<<<<<<< + * + * inline void close_ent() noexcept nogil: +*/ + try { + this->_ents.push_back(__pyx_v_ent); + } catch(...) { + PyGILState_STATE __pyx_gilstate_save = __Pyx_PyGILState_Ensure(); + __Pyx_CppExn2PyErr(); + __Pyx_PyGILState_Release(__pyx_gilstate_save); + __PYX_ERR(4, 391, __pyx_L1_error) + } + + /* "_state.pxd":386 + * return this._ents.back() + * + * inline void open_ent(attr_t label) noexcept nogil: # <<<<<<<<<<<<<< + * cdef SpanC ent + * ent.start = this.B(0) +*/ + + /* function exit code */ + goto __pyx_L0; + __pyx_L1_error:; + __pyx_gilstate_save = __Pyx_PyGILState_Ensure(); + __Pyx_WriteUnraisable("StateC.open_ent", __pyx_clineno, __pyx_lineno, __pyx_filename, 1, 0); + __Pyx_PyGILState_Release(__pyx_gilstate_save); + __pyx_L0:; +} + +/* "_state.pxd":393 + * this._ents.push_back(ent) + * + * inline void close_ent() noexcept nogil: # <<<<<<<<<<<<<< + * this._ents.back().end = this.B(0)+1 + * +*/ + +void __pyx_t_5spacy_8pipeline_17_parser_internals_6_state_StateC::close_ent(void) { + + /* "_state.pxd":394 + * + * inline void close_ent() noexcept nogil: + * this._ents.back().end = this.B(0)+1 # <<<<<<<<<<<<<< + * + * inline void clone(const StateC* src) noexcept nogil: +*/ + this->_ents.back().end = (this->B(0) + 1); + + /* "_state.pxd":393 + * this._ents.push_back(ent) + * + * inline void close_ent() noexcept nogil: # <<<<<<<<<<<<<< + * this._ents.back().end = this.B(0)+1 + * +*/ + + /* function exit code */ +} + +/* "_state.pxd":396 + * this._ents.back().end = this.B(0)+1 + * + * inline void clone(const StateC* src) noexcept nogil: # <<<<<<<<<<<<<< + * this.length = src.length + * this._sent = src._sent +*/ + +void __pyx_t_5spacy_8pipeline_17_parser_internals_6_state_StateC::clone(__pyx_t_5spacy_8pipeline_17_parser_internals_6_state_StateC const *__pyx_v_src) { + int __pyx_t_1; + struct __pyx_t_5spacy_7structs_TokenC const *__pyx_t_2; + std::vector __pyx_t_3; + std::set __pyx_t_4; + std::vector __pyx_t_5; + std::vector __pyx_t_6; + std::unordered_map > __pyx_t_7; + struct __pyx_t_5spacy_7structs_TokenC __pyx_t_8; + + /* "_state.pxd":397 + * + * inline void clone(const StateC* src) noexcept nogil: + * this.length = src.length # <<<<<<<<<<<<<< + * this._sent = src._sent + * this._stack = src._stack +*/ + __pyx_t_1 = __pyx_v_src->length; + this->length = __pyx_t_1; + + /* "_state.pxd":398 + * inline void clone(const StateC* src) noexcept nogil: + * this.length = src.length + * this._sent = src._sent # <<<<<<<<<<<<<< + * this._stack = src._stack + * this._rebuffer = src._rebuffer +*/ + __pyx_t_2 = __pyx_v_src->_sent; + this->_sent = __pyx_t_2; + + /* "_state.pxd":399 + * this.length = src.length + * this._sent = src._sent + * this._stack = src._stack # <<<<<<<<<<<<<< + * this._rebuffer = src._rebuffer + * this._sent_starts = src._sent_starts +*/ + __pyx_t_3 = __pyx_v_src->_stack; + this->_stack = __PYX_STD_MOVE_IF_SUPPORTED(__pyx_t_3); + + /* "_state.pxd":400 + * this._sent = src._sent + * this._stack = src._stack + * this._rebuffer = src._rebuffer # <<<<<<<<<<<<<< + * this._sent_starts = src._sent_starts + * this._unshiftable = src._unshiftable +*/ + __pyx_t_3 = __pyx_v_src->_rebuffer; + this->_rebuffer = __PYX_STD_MOVE_IF_SUPPORTED(__pyx_t_3); + + /* "_state.pxd":401 + * this._stack = src._stack + * this._rebuffer = src._rebuffer + * this._sent_starts = src._sent_starts # <<<<<<<<<<<<<< + * this._unshiftable = src._unshiftable + * memcpy(this._heads, src._heads, this.length * sizeof(this._heads[0])) +*/ + __pyx_t_4 = __pyx_v_src->_sent_starts; + this->_sent_starts = __PYX_STD_MOVE_IF_SUPPORTED(__pyx_t_4); + + /* "_state.pxd":402 + * this._rebuffer = src._rebuffer + * this._sent_starts = src._sent_starts + * this._unshiftable = src._unshiftable # <<<<<<<<<<<<<< + * memcpy(this._heads, src._heads, this.length * sizeof(this._heads[0])) + * this._ents = src._ents +*/ + __pyx_t_5 = __pyx_v_src->_unshiftable; + this->_unshiftable = __PYX_STD_MOVE_IF_SUPPORTED(__pyx_t_5); + + /* "_state.pxd":403 + * this._sent_starts = src._sent_starts + * this._unshiftable = src._unshiftable + * memcpy(this._heads, src._heads, this.length * sizeof(this._heads[0])) # <<<<<<<<<<<<<< + * this._ents = src._ents + * this._left_arcs = src._left_arcs +*/ + (void)(memcpy(this->_heads, __pyx_v_src->_heads, (this->length * (sizeof((this->_heads[0])))))); + + /* "_state.pxd":404 + * this._unshiftable = src._unshiftable + * memcpy(this._heads, src._heads, this.length * sizeof(this._heads[0])) + * this._ents = src._ents # <<<<<<<<<<<<<< + * this._left_arcs = src._left_arcs + * this._right_arcs = src._right_arcs +*/ + __pyx_t_6 = __pyx_v_src->_ents; + this->_ents = __PYX_STD_MOVE_IF_SUPPORTED(__pyx_t_6); + + /* "_state.pxd":405 + * memcpy(this._heads, src._heads, this.length * sizeof(this._heads[0])) + * this._ents = src._ents + * this._left_arcs = src._left_arcs # <<<<<<<<<<<<<< + * this._right_arcs = src._right_arcs + * this._b_i = src._b_i +*/ + __pyx_t_7 = __pyx_v_src->_left_arcs; + this->_left_arcs = __PYX_STD_MOVE_IF_SUPPORTED(__pyx_t_7); + + /* "_state.pxd":406 + * this._ents = src._ents + * this._left_arcs = src._left_arcs + * this._right_arcs = src._right_arcs # <<<<<<<<<<<<<< + * this._b_i = src._b_i + * this.offset = src.offset +*/ + __pyx_t_7 = __pyx_v_src->_right_arcs; + this->_right_arcs = __PYX_STD_MOVE_IF_SUPPORTED(__pyx_t_7); + + /* "_state.pxd":407 + * this._left_arcs = src._left_arcs + * this._right_arcs = src._right_arcs + * this._b_i = src._b_i # <<<<<<<<<<<<<< + * this.offset = src.offset + * this._empty_token = src._empty_token +*/ + __pyx_t_1 = __pyx_v_src->_b_i; + this->_b_i = __pyx_t_1; + + /* "_state.pxd":408 + * this._right_arcs = src._right_arcs + * this._b_i = src._b_i + * this.offset = src.offset # <<<<<<<<<<<<<< + * this._empty_token = src._empty_token +*/ + __pyx_t_1 = __pyx_v_src->offset; + this->offset = __pyx_t_1; + + /* "_state.pxd":409 + * this._b_i = src._b_i + * this.offset = src.offset + * this._empty_token = src._empty_token # <<<<<<<<<<<<<< +*/ + __pyx_t_8 = __pyx_v_src->_empty_token; + this->_empty_token = __pyx_t_8; + + /* "_state.pxd":396 + * this._ents.back().end = this.B(0)+1 + * + * inline void clone(const StateC* src) noexcept nogil: # <<<<<<<<<<<<<< + * this.length = src.length + * this._sent = src._sent +*/ + + /* function exit code */ +} + +/* "stateclass.pxd":14 + * cdef int _borrowed + * + * @staticmethod # <<<<<<<<<<<<<< + * cdef inline StateClass borrow(StateC* ptr, Doc doc): + * cdef StateClass self = StateClass() +*/ + +static CYTHON_INLINE struct __pyx_obj_5spacy_8pipeline_17_parser_internals_10stateclass_StateClass *__pyx_f_5spacy_8pipeline_17_parser_internals_10stateclass_10StateClass_borrow(__pyx_t_5spacy_8pipeline_17_parser_internals_6_state_StateC *__pyx_v_ptr, struct __pyx_obj_5spacy_6tokens_3doc_Doc *__pyx_v_doc) { + struct __pyx_obj_5spacy_8pipeline_17_parser_internals_10stateclass_StateClass *__pyx_v_self = 0; + struct __pyx_obj_5spacy_8pipeline_17_parser_internals_10stateclass_StateClass *__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("borrow", 0); + + /* "stateclass.pxd":16 + * @staticmethod + * cdef inline StateClass borrow(StateC* ptr, Doc doc): + * cdef StateClass self = StateClass() # <<<<<<<<<<<<<< + * self.c = ptr + * self._borrowed = 1 +*/ + __pyx_t_2 = NULL; + __pyx_t_3 = 1; + { + PyObject *__pyx_callargs[2] = {__pyx_t_2, NULL}; + __pyx_t_1 = __Pyx_PyObject_FastCall((PyObject*)__pyx_mstate_global->__pyx_ptype_5spacy_8pipeline_17_parser_internals_10stateclass_StateClass, __pyx_callargs+__pyx_t_3, (1-__pyx_t_3) | (__pyx_t_3*__Pyx_PY_VECTORCALL_ARGUMENTS_OFFSET)); + __Pyx_XDECREF(__pyx_t_2); __pyx_t_2 = 0; + if (unlikely(!__pyx_t_1)) __PYX_ERR(5, 16, __pyx_L1_error) + __Pyx_GOTREF((PyObject *)__pyx_t_1); + } + __pyx_v_self = ((struct __pyx_obj_5spacy_8pipeline_17_parser_internals_10stateclass_StateClass *)__pyx_t_1); + __pyx_t_1 = 0; + + /* "stateclass.pxd":17 + * cdef inline StateClass borrow(StateC* ptr, Doc doc): + * cdef StateClass self = StateClass() + * self.c = ptr # <<<<<<<<<<<<<< + * self._borrowed = 1 + * self.doc = doc +*/ + __pyx_v_self->c = __pyx_v_ptr; + + /* "stateclass.pxd":18 + * cdef StateClass self = StateClass() + * self.c = ptr + * self._borrowed = 1 # <<<<<<<<<<<<<< + * self.doc = doc + * return self +*/ + __pyx_v_self->_borrowed = 1; + + /* "stateclass.pxd":19 + * self.c = ptr + * self._borrowed = 1 + * self.doc = doc # <<<<<<<<<<<<<< + * return self + * +*/ + __Pyx_INCREF((PyObject *)__pyx_v_doc); + __Pyx_GIVEREF((PyObject *)__pyx_v_doc); + __Pyx_GOTREF((PyObject *)__pyx_v_self->doc); + __Pyx_DECREF((PyObject *)__pyx_v_self->doc); + __pyx_v_self->doc = __pyx_v_doc; + + /* "stateclass.pxd":20 + * self._borrowed = 1 + * self.doc = doc + * return self # <<<<<<<<<<<<<< + * + * @staticmethod +*/ + __Pyx_XDECREF((PyObject *)__pyx_r); + __Pyx_INCREF((PyObject *)__pyx_v_self); + __pyx_r = __pyx_v_self; + goto __pyx_L0; + + /* "stateclass.pxd":14 + * cdef int _borrowed + * + * @staticmethod # <<<<<<<<<<<<<< + * cdef inline StateClass borrow(StateC* ptr, Doc doc): + * cdef StateClass self = StateClass() +*/ + + /* function exit code */ + __pyx_L1_error:; + __Pyx_XDECREF(__pyx_t_1); + __Pyx_XDECREF(__pyx_t_2); + __Pyx_AddTraceback("spacy.pipeline._parser_internals.stateclass.StateClass.borrow", __pyx_clineno, __pyx_lineno, __pyx_filename); + __pyx_r = 0; + __pyx_L0:; + __Pyx_XDECREF((PyObject *)__pyx_v_self); + __Pyx_XGIVEREF((PyObject *)__pyx_r); + __Pyx_RefNannyFinishContext(); + return __pyx_r; +} + +/* "stateclass.pxd":22 + * return self + * + * @staticmethod # <<<<<<<<<<<<<< + * cdef inline StateClass init_offset(const TokenC* sent, int length, int + * offset): +*/ + +static CYTHON_INLINE struct __pyx_obj_5spacy_8pipeline_17_parser_internals_10stateclass_StateClass *__pyx_f_5spacy_8pipeline_17_parser_internals_10stateclass_10StateClass_init_offset(struct __pyx_t_5spacy_7structs_TokenC const *__pyx_v_sent, int __pyx_v_length, int __pyx_v_offset) { + struct __pyx_obj_5spacy_8pipeline_17_parser_internals_10stateclass_StateClass *__pyx_v_self = 0; + struct __pyx_obj_5spacy_8pipeline_17_parser_internals_10stateclass_StateClass *__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("init_offset", 0); + + /* "stateclass.pxd":25 + * cdef inline StateClass init_offset(const TokenC* sent, int length, int + * offset): + * cdef StateClass self = StateClass() # <<<<<<<<<<<<<< + * self.c = new StateC(sent, length) + * self.c.offset = offset +*/ + __pyx_t_2 = NULL; + __pyx_t_3 = 1; + { + PyObject *__pyx_callargs[2] = {__pyx_t_2, NULL}; + __pyx_t_1 = __Pyx_PyObject_FastCall((PyObject*)__pyx_mstate_global->__pyx_ptype_5spacy_8pipeline_17_parser_internals_10stateclass_StateClass, __pyx_callargs+__pyx_t_3, (1-__pyx_t_3) | (__pyx_t_3*__Pyx_PY_VECTORCALL_ARGUMENTS_OFFSET)); + __Pyx_XDECREF(__pyx_t_2); __pyx_t_2 = 0; + if (unlikely(!__pyx_t_1)) __PYX_ERR(5, 25, __pyx_L1_error) + __Pyx_GOTREF((PyObject *)__pyx_t_1); + } + __pyx_v_self = ((struct __pyx_obj_5spacy_8pipeline_17_parser_internals_10stateclass_StateClass *)__pyx_t_1); + __pyx_t_1 = 0; + + /* "stateclass.pxd":26 + * offset): + * cdef StateClass self = StateClass() + * self.c = new StateC(sent, length) # <<<<<<<<<<<<<< + * self.c.offset = offset + * return self +*/ + __pyx_v_self->c = new __pyx_t_5spacy_8pipeline_17_parser_internals_6_state_StateC(__pyx_v_sent, __pyx_v_length); + + /* "stateclass.pxd":27 + * cdef StateClass self = StateClass() + * self.c = new StateC(sent, length) + * self.c.offset = offset # <<<<<<<<<<<<<< + * return self +*/ + __pyx_v_self->c->offset = __pyx_v_offset; + + /* "stateclass.pxd":28 + * self.c = new StateC(sent, length) + * self.c.offset = offset + * return self # <<<<<<<<<<<<<< +*/ + __Pyx_XDECREF((PyObject *)__pyx_r); + __Pyx_INCREF((PyObject *)__pyx_v_self); + __pyx_r = __pyx_v_self; + goto __pyx_L0; + + /* "stateclass.pxd":22 + * return self + * + * @staticmethod # <<<<<<<<<<<<<< + * cdef inline StateClass init_offset(const TokenC* sent, int length, int + * offset): +*/ + + /* function exit code */ + __pyx_L1_error:; + __Pyx_XDECREF(__pyx_t_1); + __Pyx_XDECREF(__pyx_t_2); + __Pyx_AddTraceback("spacy.pipeline._parser_internals.stateclass.StateClass.init_offset", __pyx_clineno, __pyx_lineno, __pyx_filename); + __pyx_r = 0; + __pyx_L0:; + __Pyx_XDECREF((PyObject *)__pyx_v_self); + __Pyx_XGIVEREF((PyObject *)__pyx_r); + __Pyx_RefNannyFinishContext(); + return __pyx_r; +} + +/* "spacy/pipeline/_parser_internals/transition_system.pyx":26 + * + * + * cdef void* _init_state(Pool mem, int length, void* tokens) except NULL: # <<<<<<<<<<<<<< + * cdef StateC* st = new StateC(tokens, length) + * return st +*/ + +static void *__pyx_f_5spacy_8pipeline_17_parser_internals_17transition_system__init_state(CYTHON_UNUSED struct __pyx_obj_5cymem_5cymem_Pool *__pyx_v_mem, int __pyx_v_length, void *__pyx_v_tokens) { + __pyx_t_5spacy_8pipeline_17_parser_internals_6_state_StateC *__pyx_v_st; + void *__pyx_r; + + /* "spacy/pipeline/_parser_internals/transition_system.pyx":27 + * + * cdef void* _init_state(Pool mem, int length, void* tokens) except NULL: + * cdef StateC* st = new StateC(tokens, length) # <<<<<<<<<<<<<< + * return st + * +*/ + __pyx_v_st = new __pyx_t_5spacy_8pipeline_17_parser_internals_6_state_StateC(((struct __pyx_t_5spacy_7structs_TokenC const *)__pyx_v_tokens), __pyx_v_length); + + /* "spacy/pipeline/_parser_internals/transition_system.pyx":28 + * cdef void* _init_state(Pool mem, int length, void* tokens) except NULL: + * cdef StateC* st = new StateC(tokens, length) + * return st # <<<<<<<<<<<<<< + * + * +*/ + __pyx_r = ((void *)__pyx_v_st); + goto __pyx_L0; + + /* "spacy/pipeline/_parser_internals/transition_system.pyx":26 + * + * + * cdef void* _init_state(Pool mem, int length, void* tokens) except NULL: # <<<<<<<<<<<<<< + * cdef StateC* st = new StateC(tokens, length) + * return st +*/ + + /* function exit code */ + __pyx_L0:; + return __pyx_r; +} + +/* "spacy/pipeline/_parser_internals/transition_system.pyx":31 + * + * + * cdef int _del_state(Pool mem, void* state, void* x) except -1: # <<<<<<<<<<<<<< + * cdef StateC* st = state + * del st +*/ + +static int __pyx_f_5spacy_8pipeline_17_parser_internals_17transition_system__del_state(CYTHON_UNUSED struct __pyx_obj_5cymem_5cymem_Pool *__pyx_v_mem, void *__pyx_v_state, CYTHON_UNUSED void *__pyx_v_x) { + __pyx_t_5spacy_8pipeline_17_parser_internals_6_state_StateC *__pyx_v_st; + int __pyx_r; + + /* "spacy/pipeline/_parser_internals/transition_system.pyx":32 + * + * cdef int _del_state(Pool mem, void* state, void* x) except -1: + * cdef StateC* st = state # <<<<<<<<<<<<<< + * del st + * +*/ + __pyx_v_st = ((__pyx_t_5spacy_8pipeline_17_parser_internals_6_state_StateC *)__pyx_v_state); + + /* "spacy/pipeline/_parser_internals/transition_system.pyx":33 + * cdef int _del_state(Pool mem, void* state, void* x) except -1: + * cdef StateC* st = state + * del st # <<<<<<<<<<<<<< + * + * +*/ + delete __pyx_v_st; + + /* "spacy/pipeline/_parser_internals/transition_system.pyx":31 + * + * + * cdef int _del_state(Pool mem, void* state, void* x) except -1: # <<<<<<<<<<<<<< + * cdef StateC* st = state + * del st +*/ + + /* function exit code */ + __pyx_r = 0; + return __pyx_r; +} + +/* "spacy/pipeline/_parser_internals/transition_system.pyx":37 + * + * cdef class TransitionSystem: + * def __init__( # <<<<<<<<<<<<<< + * self, + * StringStore string_table, +*/ + +/* Python wrapper */ +static int __pyx_pw_5spacy_8pipeline_17_parser_internals_17transition_system_16TransitionSystem_1__init__(PyObject *__pyx_v_self, PyObject *__pyx_args, PyObject *__pyx_kwds); /*proto*/ +static int __pyx_pw_5spacy_8pipeline_17_parser_internals_17transition_system_16TransitionSystem_1__init__(PyObject *__pyx_v_self, PyObject *__pyx_args, PyObject *__pyx_kwds) { + struct __pyx_obj_5spacy_7strings_StringStore *__pyx_v_string_table = 0; + PyObject *__pyx_v_labels_by_action = 0; + PyObject *__pyx_v_min_freq = 0; + PyObject *__pyx_v_incorrect_spans_key = 0; + CYTHON_UNUSED Py_ssize_t __pyx_nargs; + 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; + 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_string_table,&__pyx_mstate_global->__pyx_n_u_labels_by_action,&__pyx_mstate_global->__pyx_n_u_min_freq,&__pyx_mstate_global->__pyx_n_u_incorrect_spans_key,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, 37, __pyx_L3_error) + if (__pyx_kwds_len > 0) { + switch (__pyx_nargs) { + case 4: + values[3] = __Pyx_ArgRef_VARARGS(__pyx_args, 3); + if (!CYTHON_ASSUME_SAFE_MACROS && unlikely(!values[3])) __PYX_ERR(0, 37, __pyx_L3_error) + CYTHON_FALLTHROUGH; + case 3: + values[2] = __Pyx_ArgRef_VARARGS(__pyx_args, 2); + if (!CYTHON_ASSUME_SAFE_MACROS && unlikely(!values[2])) __PYX_ERR(0, 37, __pyx_L3_error) + CYTHON_FALLTHROUGH; + case 2: + values[1] = __Pyx_ArgRef_VARARGS(__pyx_args, 1); + if (!CYTHON_ASSUME_SAFE_MACROS && unlikely(!values[1])) __PYX_ERR(0, 37, __pyx_L3_error) + CYTHON_FALLTHROUGH; + case 1: + values[0] = __Pyx_ArgRef_VARARGS(__pyx_args, 0); + if (!CYTHON_ASSUME_SAFE_MACROS && unlikely(!values[0])) __PYX_ERR(0, 37, __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, 37, __pyx_L3_error) + + /* "spacy/pipeline/_parser_internals/transition_system.pyx":40 + * self, + * StringStore string_table, + * labels_by_action=None, # <<<<<<<<<<<<<< + * min_freq=None, + * incorrect_spans_key=None +*/ + if (!values[1]) values[1] = __Pyx_NewRef(((PyObject *)Py_None)); + + /* "spacy/pipeline/_parser_internals/transition_system.pyx":41 + * StringStore string_table, + * labels_by_action=None, + * min_freq=None, # <<<<<<<<<<<<<< + * incorrect_spans_key=None + * ): +*/ + if (!values[2]) values[2] = __Pyx_NewRef(((PyObject *)Py_None)); + + /* "spacy/pipeline/_parser_internals/transition_system.pyx":42 + * labels_by_action=None, + * min_freq=None, + * incorrect_spans_key=None # <<<<<<<<<<<<<< + * ): + * self.cfg = {"neg_key": incorrect_spans_key} +*/ + if (!values[3]) values[3] = __Pyx_NewRef(((PyObject *)Py_None)); + for (Py_ssize_t i = __pyx_nargs; i < 1; i++) { + if (unlikely(!values[i])) { __Pyx_RaiseArgtupleInvalid("__init__", 0, 1, 4, i); __PYX_ERR(0, 37, __pyx_L3_error) } + } + } else { + switch (__pyx_nargs) { + case 4: + values[3] = __Pyx_ArgRef_VARARGS(__pyx_args, 3); + if (!CYTHON_ASSUME_SAFE_MACROS && unlikely(!values[3])) __PYX_ERR(0, 37, __pyx_L3_error) + CYTHON_FALLTHROUGH; + case 3: + values[2] = __Pyx_ArgRef_VARARGS(__pyx_args, 2); + if (!CYTHON_ASSUME_SAFE_MACROS && unlikely(!values[2])) __PYX_ERR(0, 37, __pyx_L3_error) + CYTHON_FALLTHROUGH; + case 2: + values[1] = __Pyx_ArgRef_VARARGS(__pyx_args, 1); + if (!CYTHON_ASSUME_SAFE_MACROS && unlikely(!values[1])) __PYX_ERR(0, 37, __pyx_L3_error) + CYTHON_FALLTHROUGH; + case 1: + values[0] = __Pyx_ArgRef_VARARGS(__pyx_args, 0); + if (!CYTHON_ASSUME_SAFE_MACROS && unlikely(!values[0])) __PYX_ERR(0, 37, __pyx_L3_error) + break; + default: goto __pyx_L5_argtuple_error; + } + + /* "spacy/pipeline/_parser_internals/transition_system.pyx":40 + * self, + * StringStore string_table, + * labels_by_action=None, # <<<<<<<<<<<<<< + * min_freq=None, + * incorrect_spans_key=None +*/ + if (!values[1]) values[1] = __Pyx_NewRef(((PyObject *)Py_None)); + + /* "spacy/pipeline/_parser_internals/transition_system.pyx":41 + * StringStore string_table, + * labels_by_action=None, + * min_freq=None, # <<<<<<<<<<<<<< + * incorrect_spans_key=None + * ): +*/ + if (!values[2]) values[2] = __Pyx_NewRef(((PyObject *)Py_None)); + + /* "spacy/pipeline/_parser_internals/transition_system.pyx":42 + * labels_by_action=None, + * min_freq=None, + * incorrect_spans_key=None # <<<<<<<<<<<<<< + * ): + * self.cfg = {"neg_key": incorrect_spans_key} +*/ + if (!values[3]) values[3] = __Pyx_NewRef(((PyObject *)Py_None)); + } + __pyx_v_string_table = ((struct __pyx_obj_5spacy_7strings_StringStore *)values[0]); + __pyx_v_labels_by_action = values[1]; + __pyx_v_min_freq = values[2]; + __pyx_v_incorrect_spans_key = values[3]; + } + goto __pyx_L6_skip; + __pyx_L5_argtuple_error:; + __Pyx_RaiseArgtupleInvalid("__init__", 0, 1, 4, __pyx_nargs); __PYX_ERR(0, 37, __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("spacy.pipeline._parser_internals.transition_system.TransitionSystem.__init__", __pyx_clineno, __pyx_lineno, __pyx_filename); + __Pyx_RefNannyFinishContext(); + return -1; + __pyx_L4_argument_unpacking_done:; + if (unlikely(!__Pyx_ArgTypeTest(((PyObject *)__pyx_v_string_table), __pyx_mstate_global->__pyx_ptype_5spacy_7strings_StringStore, 1, "string_table", 0))) __PYX_ERR(0, 39, __pyx_L1_error) + __pyx_r = __pyx_pf_5spacy_8pipeline_17_parser_internals_17transition_system_16TransitionSystem___init__(((struct __pyx_obj_5spacy_8pipeline_17_parser_internals_17transition_system_TransitionSystem *)__pyx_v_self), __pyx_v_string_table, __pyx_v_labels_by_action, __pyx_v_min_freq, __pyx_v_incorrect_spans_key); + + /* "spacy/pipeline/_parser_internals/transition_system.pyx":37 + * + * cdef class TransitionSystem: + * def __init__( # <<<<<<<<<<<<<< + * self, + * StringStore string_table, +*/ + + /* 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_5spacy_8pipeline_17_parser_internals_17transition_system_16TransitionSystem___init__(struct __pyx_obj_5spacy_8pipeline_17_parser_internals_17transition_system_TransitionSystem *__pyx_v_self, struct __pyx_obj_5spacy_7strings_StringStore *__pyx_v_string_table, PyObject *__pyx_v_labels_by_action, PyObject *__pyx_v_min_freq, PyObject *__pyx_v_incorrect_spans_key) { + int __pyx_r; + __Pyx_RefNannyDeclarations + PyObject *__pyx_t_1 = NULL; + PyObject *__pyx_t_2 = NULL; + size_t __pyx_t_3; + void *__pyx_t_4; + int __pyx_t_5; + PyObject *__pyx_t_6 = NULL; + __pyx_t_5spacy_8typedefs_attr_t __pyx_t_7; + int __pyx_lineno = 0; + const char *__pyx_filename = NULL; + int __pyx_clineno = 0; + __Pyx_RefNannySetupContext("__init__", 0); + + /* "spacy/pipeline/_parser_internals/transition_system.pyx":44 + * incorrect_spans_key=None + * ): + * self.cfg = {"neg_key": incorrect_spans_key} # <<<<<<<<<<<<<< + * self.mem = Pool() + * self.strings = string_table +*/ + __pyx_t_1 = __Pyx_PyDict_NewPresized(1); if (unlikely(!__pyx_t_1)) __PYX_ERR(0, 44, __pyx_L1_error) + __Pyx_GOTREF(__pyx_t_1); + if (PyDict_SetItem(__pyx_t_1, __pyx_mstate_global->__pyx_n_u_neg_key, __pyx_v_incorrect_spans_key) < (0)) __PYX_ERR(0, 44, __pyx_L1_error) + __Pyx_GIVEREF(__pyx_t_1); + __Pyx_GOTREF(__pyx_v_self->cfg); + __Pyx_DECREF(__pyx_v_self->cfg); + __pyx_v_self->cfg = __pyx_t_1; + __pyx_t_1 = 0; + + /* "spacy/pipeline/_parser_internals/transition_system.pyx":45 + * ): + * self.cfg = {"neg_key": incorrect_spans_key} + * self.mem = Pool() # <<<<<<<<<<<<<< + * self.strings = string_table + * self.n_moves = 0 +*/ + __pyx_t_2 = NULL; + __pyx_t_3 = 1; + { + PyObject *__pyx_callargs[2] = {__pyx_t_2, NULL}; + __pyx_t_1 = __Pyx_PyObject_FastCall((PyObject*)__pyx_mstate_global->__pyx_ptype_5cymem_5cymem_Pool, __pyx_callargs+__pyx_t_3, (1-__pyx_t_3) | (__pyx_t_3*__Pyx_PY_VECTORCALL_ARGUMENTS_OFFSET)); + __Pyx_XDECREF(__pyx_t_2); __pyx_t_2 = 0; + if (unlikely(!__pyx_t_1)) __PYX_ERR(0, 45, __pyx_L1_error) + __Pyx_GOTREF((PyObject *)__pyx_t_1); + } + __Pyx_GIVEREF((PyObject *)__pyx_t_1); + __Pyx_GOTREF((PyObject *)__pyx_v_self->mem); + __Pyx_DECREF((PyObject *)__pyx_v_self->mem); + __pyx_v_self->mem = ((struct __pyx_obj_5cymem_5cymem_Pool *)__pyx_t_1); + __pyx_t_1 = 0; + + /* "spacy/pipeline/_parser_internals/transition_system.pyx":46 + * self.cfg = {"neg_key": incorrect_spans_key} + * self.mem = Pool() + * self.strings = string_table # <<<<<<<<<<<<<< + * self.n_moves = 0 + * self._size = 100 +*/ + __Pyx_INCREF((PyObject *)__pyx_v_string_table); + __Pyx_GIVEREF((PyObject *)__pyx_v_string_table); + __Pyx_GOTREF((PyObject *)__pyx_v_self->strings); + __Pyx_DECREF((PyObject *)__pyx_v_self->strings); + __pyx_v_self->strings = __pyx_v_string_table; + + /* "spacy/pipeline/_parser_internals/transition_system.pyx":47 + * self.mem = Pool() + * self.strings = string_table + * self.n_moves = 0 # <<<<<<<<<<<<<< + * self._size = 100 + * +*/ + __pyx_v_self->n_moves = 0; + + /* "spacy/pipeline/_parser_internals/transition_system.pyx":48 + * self.strings = string_table + * self.n_moves = 0 + * self._size = 100 # <<<<<<<<<<<<<< + * + * self.c = self.mem.alloc(self._size, sizeof(Transition)) +*/ + __pyx_v_self->_size = 0x64; + + /* "spacy/pipeline/_parser_internals/transition_system.pyx":50 + * self._size = 100 + * + * self.c = self.mem.alloc(self._size, sizeof(Transition)) # <<<<<<<<<<<<<< + * + * self.labels = {} +*/ + __pyx_t_4 = ((struct __pyx_vtabstruct_5cymem_5cymem_Pool *)__pyx_v_self->mem->__pyx_vtab)->alloc(__pyx_v_self->mem, __pyx_v_self->_size, (sizeof(struct __pyx_t_5spacy_8pipeline_17_parser_internals_17transition_system_Transition))); if (unlikely(__pyx_t_4 == ((void *)NULL))) __PYX_ERR(0, 50, __pyx_L1_error) + __pyx_v_self->c = ((struct __pyx_t_5spacy_8pipeline_17_parser_internals_17transition_system_Transition *)__pyx_t_4); + + /* "spacy/pipeline/_parser_internals/transition_system.pyx":52 + * self.c = self.mem.alloc(self._size, sizeof(Transition)) + * + * self.labels = {} # <<<<<<<<<<<<<< + * if labels_by_action: + * self.initialize_actions(labels_by_action, min_freq=min_freq) +*/ + __pyx_t_1 = __Pyx_PyDict_NewPresized(0); if (unlikely(!__pyx_t_1)) __PYX_ERR(0, 52, __pyx_L1_error) + __Pyx_GOTREF(__pyx_t_1); + __Pyx_GIVEREF(__pyx_t_1); + __Pyx_GOTREF(__pyx_v_self->labels); + __Pyx_DECREF(__pyx_v_self->labels); + __pyx_v_self->labels = __pyx_t_1; + __pyx_t_1 = 0; + + /* "spacy/pipeline/_parser_internals/transition_system.pyx":53 + * + * self.labels = {} + * if labels_by_action: # <<<<<<<<<<<<<< + * self.initialize_actions(labels_by_action, min_freq=min_freq) + * self.root_label = self.strings.add('ROOT') +*/ + __pyx_t_5 = __Pyx_PyObject_IsTrue(__pyx_v_labels_by_action); if (unlikely((__pyx_t_5 < 0))) __PYX_ERR(0, 53, __pyx_L1_error) + if (__pyx_t_5) { + + /* "spacy/pipeline/_parser_internals/transition_system.pyx":54 + * self.labels = {} + * if labels_by_action: + * self.initialize_actions(labels_by_action, min_freq=min_freq) # <<<<<<<<<<<<<< + * self.root_label = self.strings.add('ROOT') + * self.init_beam_state = _init_state +*/ + __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, __pyx_v_labels_by_action}; + __pyx_t_6 = __Pyx_MakeVectorcallBuilderKwds(1); if (unlikely(!__pyx_t_6)) __PYX_ERR(0, 54, __pyx_L1_error) + __Pyx_GOTREF(__pyx_t_6); + if (__Pyx_VectorcallBuilder_AddArg(__pyx_mstate_global->__pyx_n_u_min_freq, __pyx_v_min_freq, __pyx_t_6, __pyx_callargs+2, 0) < (0)) __PYX_ERR(0, 54, __pyx_L1_error) + __pyx_t_1 = __Pyx_Object_VectorcallMethod_CallFromBuilder((PyObject*)__pyx_mstate_global->__pyx_n_u_initialize_actions, __pyx_callargs+__pyx_t_3, (2-__pyx_t_3) | (1*__Pyx_PY_VECTORCALL_ARGUMENTS_OFFSET), __pyx_t_6); + __Pyx_XDECREF(__pyx_t_2); __pyx_t_2 = 0; + __Pyx_DECREF(__pyx_t_6); __pyx_t_6 = 0; + if (unlikely(!__pyx_t_1)) __PYX_ERR(0, 54, __pyx_L1_error) + __Pyx_GOTREF(__pyx_t_1); + } + __Pyx_DECREF(__pyx_t_1); __pyx_t_1 = 0; + + /* "spacy/pipeline/_parser_internals/transition_system.pyx":53 + * + * self.labels = {} + * if labels_by_action: # <<<<<<<<<<<<<< + * self.initialize_actions(labels_by_action, min_freq=min_freq) + * self.root_label = self.strings.add('ROOT') +*/ + } + + /* "spacy/pipeline/_parser_internals/transition_system.pyx":55 + * if labels_by_action: + * self.initialize_actions(labels_by_action, min_freq=min_freq) + * self.root_label = self.strings.add('ROOT') # <<<<<<<<<<<<<< + * self.init_beam_state = _init_state + * self.del_beam_state = _del_state +*/ + __pyx_t_6 = ((PyObject *)__pyx_v_self->strings); + __Pyx_INCREF(__pyx_t_6); + __pyx_t_3 = 0; + { + PyObject *__pyx_callargs[2] = {__pyx_t_6, __pyx_mstate_global->__pyx_n_u_ROOT}; + __pyx_t_1 = __Pyx_PyObject_FastCallMethod((PyObject*)__pyx_mstate_global->__pyx_n_u_add, __pyx_callargs+__pyx_t_3, (2-__pyx_t_3) | (1*__Pyx_PY_VECTORCALL_ARGUMENTS_OFFSET)); + __Pyx_XDECREF(__pyx_t_6); __pyx_t_6 = 0; + if (unlikely(!__pyx_t_1)) __PYX_ERR(0, 55, __pyx_L1_error) + __Pyx_GOTREF(__pyx_t_1); + } + __pyx_t_7 = __Pyx_PyLong_As_uint64_t(__pyx_t_1); if (unlikely((__pyx_t_7 == ((uint64_t)-1)) && PyErr_Occurred())) __PYX_ERR(0, 55, __pyx_L1_error) + __Pyx_DECREF(__pyx_t_1); __pyx_t_1 = 0; + __pyx_v_self->root_label = __pyx_t_7; + + /* "spacy/pipeline/_parser_internals/transition_system.pyx":56 + * self.initialize_actions(labels_by_action, min_freq=min_freq) + * self.root_label = self.strings.add('ROOT') + * self.init_beam_state = _init_state # <<<<<<<<<<<<<< + * self.del_beam_state = _del_state + * +*/ + __pyx_v_self->init_beam_state = __pyx_f_5spacy_8pipeline_17_parser_internals_17transition_system__init_state; + + /* "spacy/pipeline/_parser_internals/transition_system.pyx":57 + * self.root_label = self.strings.add('ROOT') + * self.init_beam_state = _init_state + * self.del_beam_state = _del_state # <<<<<<<<<<<<<< + * + * def __reduce__(self): +*/ + __pyx_v_self->del_beam_state = __pyx_f_5spacy_8pipeline_17_parser_internals_17transition_system__del_state; + + /* "spacy/pipeline/_parser_internals/transition_system.pyx":37 + * + * cdef class TransitionSystem: + * def __init__( # <<<<<<<<<<<<<< + * self, + * StringStore string_table, +*/ + + /* function exit code */ + __pyx_r = 0; + goto __pyx_L0; + __pyx_L1_error:; + __Pyx_XDECREF(__pyx_t_1); + __Pyx_XDECREF(__pyx_t_2); + __Pyx_XDECREF(__pyx_t_6); + __Pyx_AddTraceback("spacy.pipeline._parser_internals.transition_system.TransitionSystem.__init__", __pyx_clineno, __pyx_lineno, __pyx_filename); + __pyx_r = -1; + __pyx_L0:; + __Pyx_RefNannyFinishContext(); + return __pyx_r; +} + +/* "spacy/pipeline/_parser_internals/transition_system.pyx":59 + * self.del_beam_state = _del_state + * + * def __reduce__(self): # <<<<<<<<<<<<<< + * # TODO: This loses the 'cfg' + * return (self.__class__, (self.strings, self.labels), None, None) +*/ + +/* Python wrapper */ +static PyObject *__pyx_pw_5spacy_8pipeline_17_parser_internals_17transition_system_16TransitionSystem_3__reduce__(PyObject *__pyx_v_self, +#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_5spacy_8pipeline_17_parser_internals_17transition_system_16TransitionSystem_2__reduce__, "TransitionSystem.__reduce__(self)"); +static PyMethodDef __pyx_mdef_5spacy_8pipeline_17_parser_internals_17transition_system_16TransitionSystem_3__reduce__ = {"__reduce__", (PyCFunction)(void(*)(void))(__Pyx_PyCFunction_FastCallWithKeywords)__pyx_pw_5spacy_8pipeline_17_parser_internals_17transition_system_16TransitionSystem_3__reduce__, __Pyx_METH_FASTCALL|METH_KEYWORDS, __pyx_doc_5spacy_8pipeline_17_parser_internals_17transition_system_16TransitionSystem_2__reduce__}; +static PyObject *__pyx_pw_5spacy_8pipeline_17_parser_internals_17transition_system_16TransitionSystem_3__reduce__(PyObject *__pyx_v_self, +#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__ (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__", 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__", __pyx_kwds); return NULL;} + __pyx_r = __pyx_pf_5spacy_8pipeline_17_parser_internals_17transition_system_16TransitionSystem_2__reduce__(((struct __pyx_obj_5spacy_8pipeline_17_parser_internals_17transition_system_TransitionSystem *)__pyx_v_self)); + + /* function exit code */ + __Pyx_RefNannyFinishContext(); + return __pyx_r; +} + +static PyObject *__pyx_pf_5spacy_8pipeline_17_parser_internals_17transition_system_16TransitionSystem_2__reduce__(struct __pyx_obj_5spacy_8pipeline_17_parser_internals_17transition_system_TransitionSystem *__pyx_v_self) { + PyObject *__pyx_r = NULL; + __Pyx_RefNannyDeclarations + PyObject *__pyx_t_1 = NULL; + PyObject *__pyx_t_2 = NULL; + PyObject *__pyx_t_3 = NULL; + int __pyx_lineno = 0; + const char *__pyx_filename = NULL; + int __pyx_clineno = 0; + __Pyx_RefNannySetupContext("__reduce__", 0); + + /* "spacy/pipeline/_parser_internals/transition_system.pyx":61 + * def __reduce__(self): + * # TODO: This loses the 'cfg' + * return (self.__class__, (self.strings, self.labels), None, None) # <<<<<<<<<<<<<< + * + * @property +*/ + __Pyx_XDECREF(__pyx_r); + __pyx_t_1 = __Pyx_PyObject_GetAttrStr(((PyObject *)__pyx_v_self), __pyx_mstate_global->__pyx_n_u_class); if (unlikely(!__pyx_t_1)) __PYX_ERR(0, 61, __pyx_L1_error) + __Pyx_GOTREF(__pyx_t_1); + __pyx_t_2 = PyTuple_New(2); if (unlikely(!__pyx_t_2)) __PYX_ERR(0, 61, __pyx_L1_error) + __Pyx_GOTREF(__pyx_t_2); + __Pyx_INCREF((PyObject *)__pyx_v_self->strings); + __Pyx_GIVEREF((PyObject *)__pyx_v_self->strings); + if (__Pyx_PyTuple_SET_ITEM(__pyx_t_2, 0, ((PyObject *)__pyx_v_self->strings)) != (0)) __PYX_ERR(0, 61, __pyx_L1_error); + __Pyx_INCREF(__pyx_v_self->labels); + __Pyx_GIVEREF(__pyx_v_self->labels); + if (__Pyx_PyTuple_SET_ITEM(__pyx_t_2, 1, __pyx_v_self->labels) != (0)) __PYX_ERR(0, 61, __pyx_L1_error); + __pyx_t_3 = PyTuple_New(4); if (unlikely(!__pyx_t_3)) __PYX_ERR(0, 61, __pyx_L1_error) + __Pyx_GOTREF(__pyx_t_3); + __Pyx_GIVEREF(__pyx_t_1); + if (__Pyx_PyTuple_SET_ITEM(__pyx_t_3, 0, __pyx_t_1) != (0)) __PYX_ERR(0, 61, __pyx_L1_error); + __Pyx_GIVEREF(__pyx_t_2); + if (__Pyx_PyTuple_SET_ITEM(__pyx_t_3, 1, __pyx_t_2) != (0)) __PYX_ERR(0, 61, __pyx_L1_error); + __Pyx_INCREF(Py_None); + __Pyx_GIVEREF(Py_None); + if (__Pyx_PyTuple_SET_ITEM(__pyx_t_3, 2, Py_None) != (0)) __PYX_ERR(0, 61, __pyx_L1_error); + __Pyx_INCREF(Py_None); + __Pyx_GIVEREF(Py_None); + if (__Pyx_PyTuple_SET_ITEM(__pyx_t_3, 3, Py_None) != (0)) __PYX_ERR(0, 61, __pyx_L1_error); + __pyx_t_1 = 0; + __pyx_t_2 = 0; + __pyx_r = __pyx_t_3; + __pyx_t_3 = 0; + goto __pyx_L0; + + /* "spacy/pipeline/_parser_internals/transition_system.pyx":59 + * self.del_beam_state = _del_state + * + * def __reduce__(self): # <<<<<<<<<<<<<< + * # TODO: This loses the 'cfg' + * return (self.__class__, (self.strings, self.labels), None, None) +*/ + + /* function exit code */ + __pyx_L1_error:; + __Pyx_XDECREF(__pyx_t_1); + __Pyx_XDECREF(__pyx_t_2); + __Pyx_XDECREF(__pyx_t_3); + __Pyx_AddTraceback("spacy.pipeline._parser_internals.transition_system.TransitionSystem.__reduce__", __pyx_clineno, __pyx_lineno, __pyx_filename); + __pyx_r = NULL; + __pyx_L0:; + __Pyx_XGIVEREF(__pyx_r); + __Pyx_RefNannyFinishContext(); + return __pyx_r; +} + +/* "spacy/pipeline/_parser_internals/transition_system.pyx":63 + * return (self.__class__, (self.strings, self.labels), None, None) + * + * @property # <<<<<<<<<<<<<< + * def neg_key(self): + * return self.cfg.get("neg_key") +*/ + +/* Python wrapper */ +static PyObject *__pyx_pw_5spacy_8pipeline_17_parser_internals_17transition_system_16TransitionSystem_7neg_key_1__get__(PyObject *__pyx_v_self); /*proto*/ +static PyObject *__pyx_pw_5spacy_8pipeline_17_parser_internals_17transition_system_16TransitionSystem_7neg_key_1__get__(PyObject *__pyx_v_self) { + CYTHON_UNUSED PyObject *const *__pyx_kwvalues; + PyObject *__pyx_r = 0; + __Pyx_RefNannyDeclarations + __Pyx_RefNannySetupContext("__get__ (wrapper)", 0); + __pyx_kwvalues = __Pyx_KwValues_VARARGS(__pyx_args, __pyx_nargs); + __pyx_r = __pyx_pf_5spacy_8pipeline_17_parser_internals_17transition_system_16TransitionSystem_7neg_key___get__(((struct __pyx_obj_5spacy_8pipeline_17_parser_internals_17transition_system_TransitionSystem *)__pyx_v_self)); + + /* function exit code */ + __Pyx_RefNannyFinishContext(); + return __pyx_r; +} + +static PyObject *__pyx_pf_5spacy_8pipeline_17_parser_internals_17transition_system_16TransitionSystem_7neg_key___get__(struct __pyx_obj_5spacy_8pipeline_17_parser_internals_17transition_system_TransitionSystem *__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_lineno = 0; + const char *__pyx_filename = NULL; + int __pyx_clineno = 0; + __Pyx_RefNannySetupContext("__get__", 0); + + /* "spacy/pipeline/_parser_internals/transition_system.pyx":65 + * @property + * def neg_key(self): + * return self.cfg.get("neg_key") # <<<<<<<<<<<<<< + * + * def init_batch(self, docs): +*/ + __Pyx_XDECREF(__pyx_r); + __pyx_t_2 = __pyx_v_self->cfg; + __Pyx_INCREF(__pyx_t_2); + __pyx_t_3 = 0; + { + PyObject *__pyx_callargs[2] = {__pyx_t_2, __pyx_mstate_global->__pyx_n_u_neg_key}; + __pyx_t_1 = __Pyx_PyObject_FastCallMethod((PyObject*)__pyx_mstate_global->__pyx_n_u_get, __pyx_callargs+__pyx_t_3, (2-__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, 65, __pyx_L1_error) + __Pyx_GOTREF(__pyx_t_1); + } + __pyx_r = __pyx_t_1; + __pyx_t_1 = 0; + goto __pyx_L0; + + /* "spacy/pipeline/_parser_internals/transition_system.pyx":63 + * return (self.__class__, (self.strings, self.labels), None, None) + * + * @property # <<<<<<<<<<<<<< + * def neg_key(self): + * return self.cfg.get("neg_key") +*/ + + /* function exit code */ + __pyx_L1_error:; + __Pyx_XDECREF(__pyx_t_1); + __Pyx_XDECREF(__pyx_t_2); + __Pyx_AddTraceback("spacy.pipeline._parser_internals.transition_system.TransitionSystem.neg_key.__get__", __pyx_clineno, __pyx_lineno, __pyx_filename); + __pyx_r = NULL; + __pyx_L0:; + __Pyx_XGIVEREF(__pyx_r); + __Pyx_RefNannyFinishContext(); + return __pyx_r; +} + +/* "spacy/pipeline/_parser_internals/transition_system.pyx":67 + * return self.cfg.get("neg_key") + * + * def init_batch(self, docs): # <<<<<<<<<<<<<< + * cdef StateClass state + * states = [] +*/ + +/* Python wrapper */ +static PyObject *__pyx_pw_5spacy_8pipeline_17_parser_internals_17transition_system_16TransitionSystem_5init_batch(PyObject *__pyx_v_self, +#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_5spacy_8pipeline_17_parser_internals_17transition_system_16TransitionSystem_4init_batch, "TransitionSystem.init_batch(self, docs)"); +static PyMethodDef __pyx_mdef_5spacy_8pipeline_17_parser_internals_17transition_system_16TransitionSystem_5init_batch = {"init_batch", (PyCFunction)(void(*)(void))(__Pyx_PyCFunction_FastCallWithKeywords)__pyx_pw_5spacy_8pipeline_17_parser_internals_17transition_system_16TransitionSystem_5init_batch, __Pyx_METH_FASTCALL|METH_KEYWORDS, __pyx_doc_5spacy_8pipeline_17_parser_internals_17transition_system_16TransitionSystem_4init_batch}; +static PyObject *__pyx_pw_5spacy_8pipeline_17_parser_internals_17transition_system_16TransitionSystem_5init_batch(PyObject *__pyx_v_self, +#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_docs = 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("init_batch (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_docs,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, 67, __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, 67, __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_batch", 0) < (0)) __PYX_ERR(0, 67, __pyx_L3_error) + for (Py_ssize_t i = __pyx_nargs; i < 1; i++) { + if (unlikely(!values[i])) { __Pyx_RaiseArgtupleInvalid("init_batch", 1, 1, 1, i); __PYX_ERR(0, 67, __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, 67, __pyx_L3_error) + } + __pyx_v_docs = values[0]; + } + goto __pyx_L6_skip; + __pyx_L5_argtuple_error:; + __Pyx_RaiseArgtupleInvalid("init_batch", 1, 1, 1, __pyx_nargs); __PYX_ERR(0, 67, __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("spacy.pipeline._parser_internals.transition_system.TransitionSystem.init_batch", __pyx_clineno, __pyx_lineno, __pyx_filename); + __Pyx_RefNannyFinishContext(); + return NULL; + __pyx_L4_argument_unpacking_done:; + __pyx_r = __pyx_pf_5spacy_8pipeline_17_parser_internals_17transition_system_16TransitionSystem_4init_batch(((struct __pyx_obj_5spacy_8pipeline_17_parser_internals_17transition_system_TransitionSystem *)__pyx_v_self), __pyx_v_docs); + + /* 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_5spacy_8pipeline_17_parser_internals_17transition_system_16TransitionSystem_4init_batch(CYTHON_UNUSED struct __pyx_obj_5spacy_8pipeline_17_parser_internals_17transition_system_TransitionSystem *__pyx_v_self, PyObject *__pyx_v_docs) { + struct __pyx_obj_5spacy_8pipeline_17_parser_internals_10stateclass_StateClass *__pyx_v_state = 0; + PyObject *__pyx_v_states = NULL; + Py_ssize_t __pyx_v_offset; + PyObject *__pyx_v_doc = NULL; + PyObject *__pyx_r = NULL; + __Pyx_RefNannyDeclarations + PyObject *__pyx_t_1 = NULL; + Py_ssize_t __pyx_t_2; + PyObject *(*__pyx_t_3)(PyObject *); + PyObject *__pyx_t_4 = NULL; + PyObject *__pyx_t_5 = NULL; + PyObject *__pyx_t_6 = NULL; + size_t __pyx_t_7; + PyObject *__pyx_t_8 = NULL; + int __pyx_t_9; + Py_ssize_t __pyx_t_10; + int __pyx_lineno = 0; + const char *__pyx_filename = NULL; + int __pyx_clineno = 0; + __Pyx_RefNannySetupContext("init_batch", 0); + + /* "spacy/pipeline/_parser_internals/transition_system.pyx":69 + * def init_batch(self, docs): + * cdef StateClass state + * states = [] # <<<<<<<<<<<<<< + * offset = 0 + * for doc in docs: +*/ + __pyx_t_1 = PyList_New(0); if (unlikely(!__pyx_t_1)) __PYX_ERR(0, 69, __pyx_L1_error) + __Pyx_GOTREF(__pyx_t_1); + __pyx_v_states = ((PyObject*)__pyx_t_1); + __pyx_t_1 = 0; + + /* "spacy/pipeline/_parser_internals/transition_system.pyx":70 + * cdef StateClass state + * states = [] + * offset = 0 # <<<<<<<<<<<<<< + * for doc in docs: + * state = StateClass(doc, offset=offset) +*/ + __pyx_v_offset = 0; + + /* "spacy/pipeline/_parser_internals/transition_system.pyx":71 + * states = [] + * offset = 0 + * for doc in docs: # <<<<<<<<<<<<<< + * state = StateClass(doc, offset=offset) + * states.append(state) +*/ + if (likely(PyList_CheckExact(__pyx_v_docs)) || PyTuple_CheckExact(__pyx_v_docs)) { + __pyx_t_1 = __pyx_v_docs; __Pyx_INCREF(__pyx_t_1); + __pyx_t_2 = 0; + __pyx_t_3 = NULL; + } else { + __pyx_t_2 = -1; __pyx_t_1 = PyObject_GetIter(__pyx_v_docs); if (unlikely(!__pyx_t_1)) __PYX_ERR(0, 71, __pyx_L1_error) + __Pyx_GOTREF(__pyx_t_1); + __pyx_t_3 = (CYTHON_COMPILING_IN_LIMITED_API) ? PyIter_Next : __Pyx_PyObject_GetIterNextFunc(__pyx_t_1); if (unlikely(!__pyx_t_3)) __PYX_ERR(0, 71, __pyx_L1_error) + } + for (;;) { + if (likely(!__pyx_t_3)) { + if (likely(PyList_CheckExact(__pyx_t_1))) { + { + Py_ssize_t __pyx_temp = __Pyx_PyList_GET_SIZE(__pyx_t_1); + #if !CYTHON_ASSUME_SAFE_SIZE + if (unlikely((__pyx_temp < 0))) __PYX_ERR(0, 71, __pyx_L1_error) + #endif + if (__pyx_t_2 >= __pyx_temp) break; + } + __pyx_t_4 = __Pyx_PyList_GetItemRefFast(__pyx_t_1, __pyx_t_2, __Pyx_ReferenceSharing_OwnStrongReference); + ++__pyx_t_2; + } else { + { + Py_ssize_t __pyx_temp = __Pyx_PyTuple_GET_SIZE(__pyx_t_1); + #if !CYTHON_ASSUME_SAFE_SIZE + if (unlikely((__pyx_temp < 0))) __PYX_ERR(0, 71, __pyx_L1_error) + #endif + if (__pyx_t_2 >= __pyx_temp) break; + } + #if CYTHON_ASSUME_SAFE_MACROS && !CYTHON_AVOID_BORROWED_REFS + __pyx_t_4 = __Pyx_NewRef(PyTuple_GET_ITEM(__pyx_t_1, __pyx_t_2)); + #else + __pyx_t_4 = __Pyx_PySequence_ITEM(__pyx_t_1, __pyx_t_2); + #endif + ++__pyx_t_2; + } + if (unlikely(!__pyx_t_4)) __PYX_ERR(0, 71, __pyx_L1_error) + } else { + __pyx_t_4 = __pyx_t_3(__pyx_t_1); + if (unlikely(!__pyx_t_4)) { + PyObject* exc_type = PyErr_Occurred(); + if (exc_type) { + if (unlikely(!__Pyx_PyErr_GivenExceptionMatches(exc_type, PyExc_StopIteration))) __PYX_ERR(0, 71, __pyx_L1_error) + PyErr_Clear(); + } + break; + } + } + __Pyx_GOTREF(__pyx_t_4); + __Pyx_XDECREF_SET(__pyx_v_doc, __pyx_t_4); + __pyx_t_4 = 0; + + /* "spacy/pipeline/_parser_internals/transition_system.pyx":72 + * offset = 0 + * for doc in docs: + * state = StateClass(doc, offset=offset) # <<<<<<<<<<<<<< + * states.append(state) + * offset += len(doc) +*/ + __pyx_t_5 = NULL; + __pyx_t_6 = PyLong_FromSsize_t(__pyx_v_offset); if (unlikely(!__pyx_t_6)) __PYX_ERR(0, 72, __pyx_L1_error) + __Pyx_GOTREF(__pyx_t_6); + __pyx_t_7 = 1; + { + PyObject *__pyx_callargs[2 + ((CYTHON_VECTORCALL) ? 1 : 0)] = {__pyx_t_5, __pyx_v_doc}; + __pyx_t_8 = __Pyx_MakeVectorcallBuilderKwds(1); if (unlikely(!__pyx_t_8)) __PYX_ERR(0, 72, __pyx_L1_error) + __Pyx_GOTREF(__pyx_t_8); + if (__Pyx_VectorcallBuilder_AddArg(__pyx_mstate_global->__pyx_n_u_offset, __pyx_t_6, __pyx_t_8, __pyx_callargs+2, 0) < (0)) __PYX_ERR(0, 72, __pyx_L1_error) + __pyx_t_4 = __Pyx_Object_Vectorcall_CallFromBuilder((PyObject*)__pyx_mstate_global->__pyx_ptype_5spacy_8pipeline_17_parser_internals_10stateclass_StateClass, __pyx_callargs+__pyx_t_7, (2-__pyx_t_7) | (__pyx_t_7*__Pyx_PY_VECTORCALL_ARGUMENTS_OFFSET), __pyx_t_8); + __Pyx_XDECREF(__pyx_t_5); __pyx_t_5 = 0; + __Pyx_DECREF(__pyx_t_6); __pyx_t_6 = 0; + __Pyx_DECREF(__pyx_t_8); __pyx_t_8 = 0; + if (unlikely(!__pyx_t_4)) __PYX_ERR(0, 72, __pyx_L1_error) + __Pyx_GOTREF((PyObject *)__pyx_t_4); + } + __Pyx_XDECREF_SET(__pyx_v_state, ((struct __pyx_obj_5spacy_8pipeline_17_parser_internals_10stateclass_StateClass *)__pyx_t_4)); + __pyx_t_4 = 0; + + /* "spacy/pipeline/_parser_internals/transition_system.pyx":73 + * for doc in docs: + * state = StateClass(doc, offset=offset) + * states.append(state) # <<<<<<<<<<<<<< + * offset += len(doc) + * return states +*/ + __pyx_t_9 = __Pyx_PyList_Append(__pyx_v_states, ((PyObject *)__pyx_v_state)); if (unlikely(__pyx_t_9 == ((int)-1))) __PYX_ERR(0, 73, __pyx_L1_error) + + /* "spacy/pipeline/_parser_internals/transition_system.pyx":74 + * state = StateClass(doc, offset=offset) + * states.append(state) + * offset += len(doc) # <<<<<<<<<<<<<< + * return states + * +*/ + __pyx_t_10 = PyObject_Length(__pyx_v_doc); if (unlikely(__pyx_t_10 == ((Py_ssize_t)-1))) __PYX_ERR(0, 74, __pyx_L1_error) + __pyx_v_offset = (__pyx_v_offset + __pyx_t_10); + + /* "spacy/pipeline/_parser_internals/transition_system.pyx":71 + * states = [] + * offset = 0 + * for doc in docs: # <<<<<<<<<<<<<< + * state = StateClass(doc, offset=offset) + * states.append(state) +*/ + } + __Pyx_DECREF(__pyx_t_1); __pyx_t_1 = 0; + + /* "spacy/pipeline/_parser_internals/transition_system.pyx":75 + * states.append(state) + * offset += len(doc) + * return states # <<<<<<<<<<<<<< + * + * def get_oracle_sequence(self, Example example, _debug=False): +*/ + __Pyx_XDECREF(__pyx_r); + __Pyx_INCREF(__pyx_v_states); + __pyx_r = __pyx_v_states; + goto __pyx_L0; + + /* "spacy/pipeline/_parser_internals/transition_system.pyx":67 + * return self.cfg.get("neg_key") + * + * def init_batch(self, docs): # <<<<<<<<<<<<<< + * cdef StateClass state + * states = [] +*/ + + /* function exit code */ + __pyx_L1_error:; + __Pyx_XDECREF(__pyx_t_1); + __Pyx_XDECREF(__pyx_t_4); + __Pyx_XDECREF(__pyx_t_5); + __Pyx_XDECREF(__pyx_t_6); + __Pyx_XDECREF(__pyx_t_8); + __Pyx_AddTraceback("spacy.pipeline._parser_internals.transition_system.TransitionSystem.init_batch", __pyx_clineno, __pyx_lineno, __pyx_filename); + __pyx_r = NULL; + __pyx_L0:; + __Pyx_XDECREF((PyObject *)__pyx_v_state); + __Pyx_XDECREF(__pyx_v_states); + __Pyx_XDECREF(__pyx_v_doc); + __Pyx_XGIVEREF(__pyx_r); + __Pyx_RefNannyFinishContext(); + return __pyx_r; +} + +/* "spacy/pipeline/_parser_internals/transition_system.pyx":77 + * return states + * + * def get_oracle_sequence(self, Example example, _debug=False): # <<<<<<<<<<<<<< + * states, golds, _ = self.init_gold_batch([example]) + * if not states: +*/ + +/* Python wrapper */ +static PyObject *__pyx_pw_5spacy_8pipeline_17_parser_internals_17transition_system_16TransitionSystem_7get_oracle_sequence(PyObject *__pyx_v_self, +#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_5spacy_8pipeline_17_parser_internals_17transition_system_16TransitionSystem_6get_oracle_sequence, "TransitionSystem.get_oracle_sequence(self, Example example, _debug=False)"); +static PyMethodDef __pyx_mdef_5spacy_8pipeline_17_parser_internals_17transition_system_16TransitionSystem_7get_oracle_sequence = {"get_oracle_sequence", (PyCFunction)(void(*)(void))(__Pyx_PyCFunction_FastCallWithKeywords)__pyx_pw_5spacy_8pipeline_17_parser_internals_17transition_system_16TransitionSystem_7get_oracle_sequence, __Pyx_METH_FASTCALL|METH_KEYWORDS, __pyx_doc_5spacy_8pipeline_17_parser_internals_17transition_system_16TransitionSystem_6get_oracle_sequence}; +static PyObject *__pyx_pw_5spacy_8pipeline_17_parser_internals_17transition_system_16TransitionSystem_7get_oracle_sequence(PyObject *__pyx_v_self, +#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_5spacy_8training_7example_Example *__pyx_v_example = 0; + PyObject *__pyx_v__debug = 0; + #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("get_oracle_sequence (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_example,&__pyx_mstate_global->__pyx_n_u_debug,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, 77, __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, 77, __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, 77, __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, "get_oracle_sequence", 0) < (0)) __PYX_ERR(0, 77, __pyx_L3_error) + if (!values[1]) values[1] = __Pyx_NewRef(((PyObject *)Py_False)); + for (Py_ssize_t i = __pyx_nargs; i < 1; i++) { + if (unlikely(!values[i])) { __Pyx_RaiseArgtupleInvalid("get_oracle_sequence", 0, 1, 2, i); __PYX_ERR(0, 77, __pyx_L3_error) } + } + } else { + switch (__pyx_nargs) { + case 2: + values[1] = __Pyx_ArgRef_FASTCALL(__pyx_args, 1); + if (!CYTHON_ASSUME_SAFE_MACROS && unlikely(!values[1])) __PYX_ERR(0, 77, __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, 77, __pyx_L3_error) + break; + default: goto __pyx_L5_argtuple_error; + } + if (!values[1]) values[1] = __Pyx_NewRef(((PyObject *)Py_False)); + } + __pyx_v_example = ((struct __pyx_obj_5spacy_8training_7example_Example *)values[0]); + __pyx_v__debug = values[1]; + } + goto __pyx_L6_skip; + __pyx_L5_argtuple_error:; + __Pyx_RaiseArgtupleInvalid("get_oracle_sequence", 0, 1, 2, __pyx_nargs); __PYX_ERR(0, 77, __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("spacy.pipeline._parser_internals.transition_system.TransitionSystem.get_oracle_sequence", __pyx_clineno, __pyx_lineno, __pyx_filename); + __Pyx_RefNannyFinishContext(); + return NULL; + __pyx_L4_argument_unpacking_done:; + if (unlikely(!__Pyx_ArgTypeTest(((PyObject *)__pyx_v_example), __pyx_mstate_global->__pyx_ptype_5spacy_8training_7example_Example, 1, "example", 0))) __PYX_ERR(0, 77, __pyx_L1_error) + __pyx_r = __pyx_pf_5spacy_8pipeline_17_parser_internals_17transition_system_16TransitionSystem_6get_oracle_sequence(((struct __pyx_obj_5spacy_8pipeline_17_parser_internals_17transition_system_TransitionSystem *)__pyx_v_self), __pyx_v_example, __pyx_v__debug); + + /* 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_5spacy_8pipeline_17_parser_internals_17transition_system_16TransitionSystem_6get_oracle_sequence(struct __pyx_obj_5spacy_8pipeline_17_parser_internals_17transition_system_TransitionSystem *__pyx_v_self, struct __pyx_obj_5spacy_8training_7example_Example *__pyx_v_example, PyObject *__pyx_v__debug) { + PyObject *__pyx_v_states = NULL; + PyObject *__pyx_v_golds = NULL; + CYTHON_UNUSED PyObject *__pyx_v__ = NULL; + PyObject *__pyx_v_state = NULL; + PyObject *__pyx_v_gold = 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; + PyObject *__pyx_t_5 = NULL; + PyObject *__pyx_t_6 = NULL; + PyObject *(*__pyx_t_7)(PyObject *); + int __pyx_t_8; + int __pyx_t_9; + int __pyx_lineno = 0; + const char *__pyx_filename = NULL; + int __pyx_clineno = 0; + __Pyx_RefNannySetupContext("get_oracle_sequence", 0); + + /* "spacy/pipeline/_parser_internals/transition_system.pyx":78 + * + * def get_oracle_sequence(self, Example example, _debug=False): + * states, golds, _ = self.init_gold_batch([example]) # <<<<<<<<<<<<<< + * if not states: + * return [] +*/ + __pyx_t_2 = ((PyObject *)__pyx_v_self); + __Pyx_INCREF(__pyx_t_2); + __pyx_t_3 = PyList_New(1); if (unlikely(!__pyx_t_3)) __PYX_ERR(0, 78, __pyx_L1_error) + __Pyx_GOTREF(__pyx_t_3); + __Pyx_INCREF((PyObject *)__pyx_v_example); + __Pyx_GIVEREF((PyObject *)__pyx_v_example); + if (__Pyx_PyList_SET_ITEM(__pyx_t_3, 0, ((PyObject *)__pyx_v_example)) != (0)) __PYX_ERR(0, 78, __pyx_L1_error); + __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_init_gold_batch, __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, 78, __pyx_L1_error) + __Pyx_GOTREF(__pyx_t_1); + } + if ((likely(PyTuple_CheckExact(__pyx_t_1))) || (PyList_CheckExact(__pyx_t_1))) { + PyObject* sequence = __pyx_t_1; + Py_ssize_t size = __Pyx_PySequence_SIZE(sequence); + if (unlikely(size != 3)) { + if (size > 3) __Pyx_RaiseTooManyValuesError(3); + else if (size >= 0) __Pyx_RaiseNeedMoreValuesError(size); + __PYX_ERR(0, 78, __pyx_L1_error) + } + #if CYTHON_ASSUME_SAFE_MACROS && !CYTHON_AVOID_BORROWED_REFS + if (likely(PyTuple_CheckExact(sequence))) { + __pyx_t_3 = PyTuple_GET_ITEM(sequence, 0); + __Pyx_INCREF(__pyx_t_3); + __pyx_t_2 = PyTuple_GET_ITEM(sequence, 1); + __Pyx_INCREF(__pyx_t_2); + __pyx_t_5 = PyTuple_GET_ITEM(sequence, 2); + __Pyx_INCREF(__pyx_t_5); + } else { + __pyx_t_3 = __Pyx_PyList_GetItemRefFast(sequence, 0, __Pyx_ReferenceSharing_SharedReference); + if (unlikely(!__pyx_t_3)) __PYX_ERR(0, 78, __pyx_L1_error) + __Pyx_XGOTREF(__pyx_t_3); + __pyx_t_2 = __Pyx_PyList_GetItemRefFast(sequence, 1, __Pyx_ReferenceSharing_SharedReference); + if (unlikely(!__pyx_t_2)) __PYX_ERR(0, 78, __pyx_L1_error) + __Pyx_XGOTREF(__pyx_t_2); + __pyx_t_5 = __Pyx_PyList_GetItemRefFast(sequence, 2, __Pyx_ReferenceSharing_SharedReference); + if (unlikely(!__pyx_t_5)) __PYX_ERR(0, 78, __pyx_L1_error) + __Pyx_XGOTREF(__pyx_t_5); + } + #else + __pyx_t_3 = __Pyx_PySequence_ITEM(sequence, 0); if (unlikely(!__pyx_t_3)) __PYX_ERR(0, 78, __pyx_L1_error) + __Pyx_GOTREF(__pyx_t_3); + __pyx_t_2 = __Pyx_PySequence_ITEM(sequence, 1); if (unlikely(!__pyx_t_2)) __PYX_ERR(0, 78, __pyx_L1_error) + __Pyx_GOTREF(__pyx_t_2); + __pyx_t_5 = __Pyx_PySequence_ITEM(sequence, 2); if (unlikely(!__pyx_t_5)) __PYX_ERR(0, 78, __pyx_L1_error) + __Pyx_GOTREF(__pyx_t_5); + #endif + __Pyx_DECREF(__pyx_t_1); __pyx_t_1 = 0; + } else { + Py_ssize_t index = -1; + __pyx_t_6 = PyObject_GetIter(__pyx_t_1); if (unlikely(!__pyx_t_6)) __PYX_ERR(0, 78, __pyx_L1_error) + __Pyx_GOTREF(__pyx_t_6); + __Pyx_DECREF(__pyx_t_1); __pyx_t_1 = 0; + __pyx_t_7 = (CYTHON_COMPILING_IN_LIMITED_API) ? PyIter_Next : __Pyx_PyObject_GetIterNextFunc(__pyx_t_6); + index = 0; __pyx_t_3 = __pyx_t_7(__pyx_t_6); if (unlikely(!__pyx_t_3)) goto __pyx_L3_unpacking_failed; + __Pyx_GOTREF(__pyx_t_3); + index = 1; __pyx_t_2 = __pyx_t_7(__pyx_t_6); if (unlikely(!__pyx_t_2)) goto __pyx_L3_unpacking_failed; + __Pyx_GOTREF(__pyx_t_2); + index = 2; __pyx_t_5 = __pyx_t_7(__pyx_t_6); if (unlikely(!__pyx_t_5)) goto __pyx_L3_unpacking_failed; + __Pyx_GOTREF(__pyx_t_5); + if (__Pyx_IternextUnpackEndCheck(__pyx_t_7(__pyx_t_6), 3) < (0)) __PYX_ERR(0, 78, __pyx_L1_error) + __pyx_t_7 = NULL; + __Pyx_DECREF(__pyx_t_6); __pyx_t_6 = 0; + goto __pyx_L4_unpacking_done; + __pyx_L3_unpacking_failed:; + __Pyx_DECREF(__pyx_t_6); __pyx_t_6 = 0; + __pyx_t_7 = NULL; + if (__Pyx_IterFinish() == 0) __Pyx_RaiseNeedMoreValuesError(index); + __PYX_ERR(0, 78, __pyx_L1_error) + __pyx_L4_unpacking_done:; + } + __pyx_v_states = __pyx_t_3; + __pyx_t_3 = 0; + __pyx_v_golds = __pyx_t_2; + __pyx_t_2 = 0; + __pyx_v__ = __pyx_t_5; + __pyx_t_5 = 0; + + /* "spacy/pipeline/_parser_internals/transition_system.pyx":79 + * def get_oracle_sequence(self, Example example, _debug=False): + * states, golds, _ = self.init_gold_batch([example]) + * if not states: # <<<<<<<<<<<<<< + * return [] + * state = states[0] +*/ + __pyx_t_8 = __Pyx_PyObject_IsTrue(__pyx_v_states); if (unlikely((__pyx_t_8 < 0))) __PYX_ERR(0, 79, __pyx_L1_error) + __pyx_t_9 = (!__pyx_t_8); + if (__pyx_t_9) { + + /* "spacy/pipeline/_parser_internals/transition_system.pyx":80 + * states, golds, _ = self.init_gold_batch([example]) + * if not states: + * return [] # <<<<<<<<<<<<<< + * state = states[0] + * gold = golds[0] +*/ + __Pyx_XDECREF(__pyx_r); + __pyx_t_1 = PyList_New(0); if (unlikely(!__pyx_t_1)) __PYX_ERR(0, 80, __pyx_L1_error) + __Pyx_GOTREF(__pyx_t_1); + __pyx_r = __pyx_t_1; + __pyx_t_1 = 0; + goto __pyx_L0; + + /* "spacy/pipeline/_parser_internals/transition_system.pyx":79 + * def get_oracle_sequence(self, Example example, _debug=False): + * states, golds, _ = self.init_gold_batch([example]) + * if not states: # <<<<<<<<<<<<<< + * return [] + * state = states[0] +*/ + } + + /* "spacy/pipeline/_parser_internals/transition_system.pyx":81 + * if not states: + * return [] + * state = states[0] # <<<<<<<<<<<<<< + * gold = golds[0] + * if _debug: +*/ + __pyx_t_1 = __Pyx_GetItemInt(__pyx_v_states, 0, long, 1, __Pyx_PyLong_From_long, 0, 0, 1, 1, __Pyx_ReferenceSharing_OwnStrongReference); if (unlikely(!__pyx_t_1)) __PYX_ERR(0, 81, __pyx_L1_error) + __Pyx_GOTREF(__pyx_t_1); + __pyx_v_state = __pyx_t_1; + __pyx_t_1 = 0; + + /* "spacy/pipeline/_parser_internals/transition_system.pyx":82 + * return [] + * state = states[0] + * gold = golds[0] # <<<<<<<<<<<<<< + * if _debug: + * return self.get_oracle_sequence_from_state(state, gold, _debug=example) +*/ + __pyx_t_1 = __Pyx_GetItemInt(__pyx_v_golds, 0, long, 1, __Pyx_PyLong_From_long, 0, 0, 1, 1, __Pyx_ReferenceSharing_OwnStrongReference); if (unlikely(!__pyx_t_1)) __PYX_ERR(0, 82, __pyx_L1_error) + __Pyx_GOTREF(__pyx_t_1); + __pyx_v_gold = __pyx_t_1; + __pyx_t_1 = 0; + + /* "spacy/pipeline/_parser_internals/transition_system.pyx":83 + * state = states[0] + * gold = golds[0] + * if _debug: # <<<<<<<<<<<<<< + * return self.get_oracle_sequence_from_state(state, gold, _debug=example) + * else: +*/ + __pyx_t_9 = __Pyx_PyObject_IsTrue(__pyx_v__debug); if (unlikely((__pyx_t_9 < 0))) __PYX_ERR(0, 83, __pyx_L1_error) + if (__pyx_t_9) { + + /* "spacy/pipeline/_parser_internals/transition_system.pyx":84 + * gold = golds[0] + * if _debug: + * return self.get_oracle_sequence_from_state(state, gold, _debug=example) # <<<<<<<<<<<<<< + * else: + * return self.get_oracle_sequence_from_state(state, gold) +*/ + __Pyx_XDECREF(__pyx_r); + __pyx_t_5 = ((PyObject *)__pyx_v_self); + __Pyx_INCREF(__pyx_t_5); + __pyx_t_4 = 0; + { + PyObject *__pyx_callargs[3 + ((CYTHON_VECTORCALL) ? 1 : 0)] = {__pyx_t_5, __pyx_v_state, __pyx_v_gold}; + __pyx_t_2 = __Pyx_MakeVectorcallBuilderKwds(1); if (unlikely(!__pyx_t_2)) __PYX_ERR(0, 84, __pyx_L1_error) + __Pyx_GOTREF(__pyx_t_2); + if (__Pyx_VectorcallBuilder_AddArg(__pyx_mstate_global->__pyx_n_u_debug, ((PyObject *)__pyx_v_example), __pyx_t_2, __pyx_callargs+3, 0) < (0)) __PYX_ERR(0, 84, __pyx_L1_error) + __pyx_t_1 = __Pyx_Object_VectorcallMethod_CallFromBuilder((PyObject*)__pyx_mstate_global->__pyx_n_u_get_oracle_sequence_from_state, __pyx_callargs+__pyx_t_4, (3-__pyx_t_4) | (1*__Pyx_PY_VECTORCALL_ARGUMENTS_OFFSET), __pyx_t_2); + __Pyx_XDECREF(__pyx_t_5); __pyx_t_5 = 0; + __Pyx_DECREF(__pyx_t_2); __pyx_t_2 = 0; + if (unlikely(!__pyx_t_1)) __PYX_ERR(0, 84, __pyx_L1_error) + __Pyx_GOTREF(__pyx_t_1); + } + __pyx_r = __pyx_t_1; + __pyx_t_1 = 0; + goto __pyx_L0; + + /* "spacy/pipeline/_parser_internals/transition_system.pyx":83 + * state = states[0] + * gold = golds[0] + * if _debug: # <<<<<<<<<<<<<< + * return self.get_oracle_sequence_from_state(state, gold, _debug=example) + * else: +*/ + } + + /* "spacy/pipeline/_parser_internals/transition_system.pyx":86 + * return self.get_oracle_sequence_from_state(state, gold, _debug=example) + * else: + * return self.get_oracle_sequence_from_state(state, gold) # <<<<<<<<<<<<<< + * + * def get_oracle_sequence_from_state(self, StateClass state, gold, _debug=None): +*/ + /*else*/ { + __Pyx_XDECREF(__pyx_r); + __pyx_t_2 = ((PyObject *)__pyx_v_self); + __Pyx_INCREF(__pyx_t_2); + __pyx_t_4 = 0; + { + PyObject *__pyx_callargs[3] = {__pyx_t_2, __pyx_v_state, __pyx_v_gold}; + __pyx_t_1 = __Pyx_PyObject_FastCallMethod((PyObject*)__pyx_mstate_global->__pyx_n_u_get_oracle_sequence_from_state, __pyx_callargs+__pyx_t_4, (3-__pyx_t_4) | (1*__Pyx_PY_VECTORCALL_ARGUMENTS_OFFSET)); + __Pyx_XDECREF(__pyx_t_2); __pyx_t_2 = 0; + if (unlikely(!__pyx_t_1)) __PYX_ERR(0, 86, __pyx_L1_error) + __Pyx_GOTREF(__pyx_t_1); + } + __pyx_r = __pyx_t_1; + __pyx_t_1 = 0; + goto __pyx_L0; + } + + /* "spacy/pipeline/_parser_internals/transition_system.pyx":77 + * return states + * + * def get_oracle_sequence(self, Example example, _debug=False): # <<<<<<<<<<<<<< + * states, golds, _ = self.init_gold_batch([example]) + * if not states: +*/ + + /* function exit code */ + __pyx_L1_error:; + __Pyx_XDECREF(__pyx_t_1); + __Pyx_XDECREF(__pyx_t_2); + __Pyx_XDECREF(__pyx_t_3); + __Pyx_XDECREF(__pyx_t_5); + __Pyx_XDECREF(__pyx_t_6); + __Pyx_AddTraceback("spacy.pipeline._parser_internals.transition_system.TransitionSystem.get_oracle_sequence", __pyx_clineno, __pyx_lineno, __pyx_filename); + __pyx_r = NULL; + __pyx_L0:; + __Pyx_XDECREF(__pyx_v_states); + __Pyx_XDECREF(__pyx_v_golds); + __Pyx_XDECREF(__pyx_v__); + __Pyx_XDECREF(__pyx_v_state); + __Pyx_XDECREF(__pyx_v_gold); + __Pyx_XGIVEREF(__pyx_r); + __Pyx_RefNannyFinishContext(); + return __pyx_r; +} + +/* "spacy/pipeline/_parser_internals/transition_system.pyx":88 + * return self.get_oracle_sequence_from_state(state, gold) + * + * def get_oracle_sequence_from_state(self, StateClass state, gold, _debug=None): # <<<<<<<<<<<<<< + * cdef Pool mem = Pool() + * # n_moves should not be zero at this point, but make sure to avoid zero-length mem alloc +*/ + +/* Python wrapper */ +static PyObject *__pyx_pw_5spacy_8pipeline_17_parser_internals_17transition_system_16TransitionSystem_9get_oracle_sequence_from_state(PyObject *__pyx_v_self, +#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_5spacy_8pipeline_17_parser_internals_17transition_system_16TransitionSystem_8get_oracle_sequence_from_state, "TransitionSystem.get_oracle_sequence_from_state(self, StateClass state, gold, _debug=None)"); +static PyMethodDef __pyx_mdef_5spacy_8pipeline_17_parser_internals_17transition_system_16TransitionSystem_9get_oracle_sequence_from_state = {"get_oracle_sequence_from_state", (PyCFunction)(void(*)(void))(__Pyx_PyCFunction_FastCallWithKeywords)__pyx_pw_5spacy_8pipeline_17_parser_internals_17transition_system_16TransitionSystem_9get_oracle_sequence_from_state, __Pyx_METH_FASTCALL|METH_KEYWORDS, __pyx_doc_5spacy_8pipeline_17_parser_internals_17transition_system_16TransitionSystem_8get_oracle_sequence_from_state}; +static PyObject *__pyx_pw_5spacy_8pipeline_17_parser_internals_17transition_system_16TransitionSystem_9get_oracle_sequence_from_state(PyObject *__pyx_v_self, +#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_5spacy_8pipeline_17_parser_internals_10stateclass_StateClass *__pyx_v_state = 0; + PyObject *__pyx_v_gold = 0; + PyObject *__pyx_v__debug = 0; + #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("get_oracle_sequence_from_state (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_state,&__pyx_mstate_global->__pyx_n_u_gold,&__pyx_mstate_global->__pyx_n_u_debug,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, 88, __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, 88, __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, 88, __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, 88, __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, "get_oracle_sequence_from_state", 0) < (0)) __PYX_ERR(0, 88, __pyx_L3_error) + if (!values[2]) values[2] = __Pyx_NewRef(((PyObject *)Py_None)); + for (Py_ssize_t i = __pyx_nargs; i < 2; i++) { + if (unlikely(!values[i])) { __Pyx_RaiseArgtupleInvalid("get_oracle_sequence_from_state", 0, 2, 3, i); __PYX_ERR(0, 88, __pyx_L3_error) } + } + } else { + switch (__pyx_nargs) { + case 3: + values[2] = __Pyx_ArgRef_FASTCALL(__pyx_args, 2); + if (!CYTHON_ASSUME_SAFE_MACROS && unlikely(!values[2])) __PYX_ERR(0, 88, __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, 88, __pyx_L3_error) + values[0] = __Pyx_ArgRef_FASTCALL(__pyx_args, 0); + if (!CYTHON_ASSUME_SAFE_MACROS && unlikely(!values[0])) __PYX_ERR(0, 88, __pyx_L3_error) + break; + default: goto __pyx_L5_argtuple_error; + } + if (!values[2]) values[2] = __Pyx_NewRef(((PyObject *)Py_None)); + } + __pyx_v_state = ((struct __pyx_obj_5spacy_8pipeline_17_parser_internals_10stateclass_StateClass *)values[0]); + __pyx_v_gold = values[1]; + __pyx_v__debug = values[2]; + } + goto __pyx_L6_skip; + __pyx_L5_argtuple_error:; + __Pyx_RaiseArgtupleInvalid("get_oracle_sequence_from_state", 0, 2, 3, __pyx_nargs); __PYX_ERR(0, 88, __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("spacy.pipeline._parser_internals.transition_system.TransitionSystem.get_oracle_sequence_from_state", __pyx_clineno, __pyx_lineno, __pyx_filename); + __Pyx_RefNannyFinishContext(); + return NULL; + __pyx_L4_argument_unpacking_done:; + if (unlikely(!__Pyx_ArgTypeTest(((PyObject *)__pyx_v_state), __pyx_mstate_global->__pyx_ptype_5spacy_8pipeline_17_parser_internals_10stateclass_StateClass, 1, "state", 0))) __PYX_ERR(0, 88, __pyx_L1_error) + __pyx_r = __pyx_pf_5spacy_8pipeline_17_parser_internals_17transition_system_16TransitionSystem_8get_oracle_sequence_from_state(((struct __pyx_obj_5spacy_8pipeline_17_parser_internals_17transition_system_TransitionSystem *)__pyx_v_self), __pyx_v_state, __pyx_v_gold, __pyx_v__debug); + + /* 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_5spacy_8pipeline_17_parser_internals_17transition_system_16TransitionSystem_8get_oracle_sequence_from_state(struct __pyx_obj_5spacy_8pipeline_17_parser_internals_17transition_system_TransitionSystem *__pyx_v_self, struct __pyx_obj_5spacy_8pipeline_17_parser_internals_10stateclass_StateClass *__pyx_v_state, PyObject *__pyx_v_gold, PyObject *__pyx_v__debug) { + struct __pyx_obj_5cymem_5cymem_Pool *__pyx_v_mem = 0; + float *__pyx_v_costs; + int *__pyx_v_is_valid; + PyObject *__pyx_v_history = NULL; + PyObject *__pyx_v_debug_log = NULL; + int __pyx_v_i; + struct __pyx_t_5spacy_8pipeline_17_parser_internals_17transition_system_Transition __pyx_v_action; + PyObject *__pyx_v_s0 = NULL; + PyObject *__pyx_v_b0 = NULL; + PyObject *__pyx_v_example = NULL; + PyObject *__pyx_v_token = NULL; + 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; + void *__pyx_t_5; + int __pyx_t_6; + int __pyx_t_7; + int __pyx_t_8; + int __pyx_t_9; + int __pyx_t_10; + PyObject *__pyx_t_11 = NULL; + PyObject *__pyx_t_12 = NULL; + PyObject *__pyx_t_13 = NULL; + PyObject *__pyx_t_14 = NULL; + PyObject *__pyx_t_15 = NULL; + int __pyx_t_16; + int __pyx_t_17; + Py_ssize_t __pyx_t_18; + PyObject *(*__pyx_t_19)(PyObject *); + int __pyx_lineno = 0; + const char *__pyx_filename = NULL; + int __pyx_clineno = 0; + __Pyx_RefNannySetupContext("get_oracle_sequence_from_state", 0); + + /* "spacy/pipeline/_parser_internals/transition_system.pyx":89 + * + * def get_oracle_sequence_from_state(self, StateClass state, gold, _debug=None): + * cdef Pool mem = Pool() # <<<<<<<<<<<<<< + * # n_moves should not be zero at this point, but make sure to avoid zero-length mem alloc + * assert self.n_moves > 0 +*/ + __pyx_t_2 = NULL; + __pyx_t_3 = 1; + { + PyObject *__pyx_callargs[2] = {__pyx_t_2, NULL}; + __pyx_t_1 = __Pyx_PyObject_FastCall((PyObject*)__pyx_mstate_global->__pyx_ptype_5cymem_5cymem_Pool, __pyx_callargs+__pyx_t_3, (1-__pyx_t_3) | (__pyx_t_3*__Pyx_PY_VECTORCALL_ARGUMENTS_OFFSET)); + __Pyx_XDECREF(__pyx_t_2); __pyx_t_2 = 0; + if (unlikely(!__pyx_t_1)) __PYX_ERR(0, 89, __pyx_L1_error) + __Pyx_GOTREF((PyObject *)__pyx_t_1); + } + __pyx_v_mem = ((struct __pyx_obj_5cymem_5cymem_Pool *)__pyx_t_1); + __pyx_t_1 = 0; + + /* "spacy/pipeline/_parser_internals/transition_system.pyx":91 + * cdef Pool mem = Pool() + * # n_moves should not be zero at this point, but make sure to avoid zero-length mem alloc + * assert self.n_moves > 0 # <<<<<<<<<<<<<< + * costs = mem.alloc(self.n_moves, sizeof(float)) + * is_valid = mem.alloc(self.n_moves, sizeof(int)) +*/ + #ifndef CYTHON_WITHOUT_ASSERTIONS + if (unlikely(__pyx_assertions_enabled())) { + __pyx_t_4 = (__pyx_v_self->n_moves > 0); + if (unlikely(!__pyx_t_4)) { + __Pyx_Raise(((PyObject *)(((PyTypeObject*)PyExc_AssertionError))), 0, 0, 0); + __PYX_ERR(0, 91, __pyx_L1_error) + } + } + #else + if ((1)); else __PYX_ERR(0, 91, __pyx_L1_error) + #endif + + /* "spacy/pipeline/_parser_internals/transition_system.pyx":92 + * # n_moves should not be zero at this point, but make sure to avoid zero-length mem alloc + * assert self.n_moves > 0 + * costs = mem.alloc(self.n_moves, sizeof(float)) # <<<<<<<<<<<<<< + * is_valid = mem.alloc(self.n_moves, sizeof(int)) + * +*/ + __pyx_t_5 = ((struct __pyx_vtabstruct_5cymem_5cymem_Pool *)__pyx_v_mem->__pyx_vtab)->alloc(__pyx_v_mem, __pyx_v_self->n_moves, (sizeof(float))); if (unlikely(__pyx_t_5 == ((void *)NULL))) __PYX_ERR(0, 92, __pyx_L1_error) + __pyx_v_costs = ((float *)__pyx_t_5); + + /* "spacy/pipeline/_parser_internals/transition_system.pyx":93 + * assert self.n_moves > 0 + * costs = mem.alloc(self.n_moves, sizeof(float)) + * is_valid = mem.alloc(self.n_moves, sizeof(int)) # <<<<<<<<<<<<<< + * + * history = [] +*/ + __pyx_t_5 = ((struct __pyx_vtabstruct_5cymem_5cymem_Pool *)__pyx_v_mem->__pyx_vtab)->alloc(__pyx_v_mem, __pyx_v_self->n_moves, (sizeof(int))); if (unlikely(__pyx_t_5 == ((void *)NULL))) __PYX_ERR(0, 93, __pyx_L1_error) + __pyx_v_is_valid = ((int *)__pyx_t_5); + + /* "spacy/pipeline/_parser_internals/transition_system.pyx":95 + * is_valid = mem.alloc(self.n_moves, sizeof(int)) + * + * history = [] # <<<<<<<<<<<<<< + * debug_log = [] + * while not state.is_final(): +*/ + __pyx_t_1 = PyList_New(0); if (unlikely(!__pyx_t_1)) __PYX_ERR(0, 95, __pyx_L1_error) + __Pyx_GOTREF(__pyx_t_1); + __pyx_v_history = ((PyObject*)__pyx_t_1); + __pyx_t_1 = 0; + + /* "spacy/pipeline/_parser_internals/transition_system.pyx":96 + * + * history = [] + * debug_log = [] # <<<<<<<<<<<<<< + * while not state.is_final(): + * self.set_costs(is_valid, costs, state.c, gold) +*/ + __pyx_t_1 = PyList_New(0); if (unlikely(!__pyx_t_1)) __PYX_ERR(0, 96, __pyx_L1_error) + __Pyx_GOTREF(__pyx_t_1); + __pyx_v_debug_log = ((PyObject*)__pyx_t_1); + __pyx_t_1 = 0; + + /* "spacy/pipeline/_parser_internals/transition_system.pyx":97 + * history = [] + * debug_log = [] + * while not state.is_final(): # <<<<<<<<<<<<<< + * self.set_costs(is_valid, costs, state.c, gold) + * for i in range(self.n_moves): +*/ + while (1) { + __pyx_t_2 = ((PyObject *)__pyx_v_state); + __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_final, __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, 97, __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, 97, __pyx_L1_error) + __Pyx_DECREF(__pyx_t_1); __pyx_t_1 = 0; + __pyx_t_6 = (!__pyx_t_4); + if (!__pyx_t_6) break; + + /* "spacy/pipeline/_parser_internals/transition_system.pyx":98 + * debug_log = [] + * while not state.is_final(): + * self.set_costs(is_valid, costs, state.c, gold) # <<<<<<<<<<<<<< + * for i in range(self.n_moves): + * if is_valid[i] and costs[i] <= 0: +*/ + __pyx_t_7 = ((struct __pyx_vtabstruct_5spacy_8pipeline_17_parser_internals_17transition_system_TransitionSystem *)__pyx_v_self->__pyx_vtab)->set_costs(__pyx_v_self, __pyx_v_is_valid, __pyx_v_costs, __pyx_v_state->c, __pyx_v_gold); if (unlikely(__pyx_t_7 == ((int)-1))) __PYX_ERR(0, 98, __pyx_L1_error) + + /* "spacy/pipeline/_parser_internals/transition_system.pyx":99 + * while not state.is_final(): + * self.set_costs(is_valid, costs, state.c, gold) + * for i in range(self.n_moves): # <<<<<<<<<<<<<< + * if is_valid[i] and costs[i] <= 0: + * action = self.c[i] +*/ + __pyx_t_7 = __pyx_v_self->n_moves; + __pyx_t_8 = __pyx_t_7; + for (__pyx_t_9 = 0; __pyx_t_9 < __pyx_t_8; __pyx_t_9+=1) { + __pyx_v_i = __pyx_t_9; + + /* "spacy/pipeline/_parser_internals/transition_system.pyx":100 + * self.set_costs(is_valid, costs, state.c, gold) + * for i in range(self.n_moves): + * if is_valid[i] and costs[i] <= 0: # <<<<<<<<<<<<<< + * action = self.c[i] + * history.append(i) +*/ + __pyx_t_4 = ((__pyx_v_is_valid[__pyx_v_i]) != 0); + if (__pyx_t_4) { + } else { + __pyx_t_6 = __pyx_t_4; + goto __pyx_L8_bool_binop_done; + } + __pyx_t_4 = ((__pyx_v_costs[__pyx_v_i]) <= 0.0); + __pyx_t_6 = __pyx_t_4; + __pyx_L8_bool_binop_done:; + if (__pyx_t_6) { + + /* "spacy/pipeline/_parser_internals/transition_system.pyx":101 + * for i in range(self.n_moves): + * if is_valid[i] and costs[i] <= 0: + * action = self.c[i] # <<<<<<<<<<<<<< + * history.append(i) + * if _debug: +*/ + __pyx_v_action = (__pyx_v_self->c[__pyx_v_i]); + + /* "spacy/pipeline/_parser_internals/transition_system.pyx":102 + * if is_valid[i] and costs[i] <= 0: + * action = self.c[i] + * history.append(i) # <<<<<<<<<<<<<< + * if _debug: + * s0 = state.S(0) +*/ + __pyx_t_1 = __Pyx_PyLong_From_int(__pyx_v_i); if (unlikely(!__pyx_t_1)) __PYX_ERR(0, 102, __pyx_L1_error) + __Pyx_GOTREF(__pyx_t_1); + __pyx_t_10 = __Pyx_PyList_Append(__pyx_v_history, __pyx_t_1); if (unlikely(__pyx_t_10 == ((int)-1))) __PYX_ERR(0, 102, __pyx_L1_error) + __Pyx_DECREF(__pyx_t_1); __pyx_t_1 = 0; + + /* "spacy/pipeline/_parser_internals/transition_system.pyx":103 + * action = self.c[i] + * history.append(i) + * if _debug: # <<<<<<<<<<<<<< + * s0 = state.S(0) + * b0 = state.B(0) +*/ + __pyx_t_6 = __Pyx_PyObject_IsTrue(__pyx_v__debug); if (unlikely((__pyx_t_6 < 0))) __PYX_ERR(0, 103, __pyx_L1_error) + if (__pyx_t_6) { + + /* "spacy/pipeline/_parser_internals/transition_system.pyx":104 + * history.append(i) + * if _debug: + * s0 = state.S(0) # <<<<<<<<<<<<<< + * b0 = state.B(0) + * example = _debug +*/ + __pyx_t_2 = ((PyObject *)__pyx_v_state); + __Pyx_INCREF(__pyx_t_2); + __pyx_t_3 = 0; + { + PyObject *__pyx_callargs[2] = {__pyx_t_2, __pyx_mstate_global->__pyx_int_0}; + __pyx_t_1 = __Pyx_PyObject_FastCallMethod((PyObject*)__pyx_mstate_global->__pyx_n_u_S, __pyx_callargs+__pyx_t_3, (2-__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, 104, __pyx_L1_error) + __Pyx_GOTREF(__pyx_t_1); + } + __Pyx_XDECREF_SET(__pyx_v_s0, __pyx_t_1); + __pyx_t_1 = 0; + + /* "spacy/pipeline/_parser_internals/transition_system.pyx":105 + * if _debug: + * s0 = state.S(0) + * b0 = state.B(0) # <<<<<<<<<<<<<< + * example = _debug + * debug_log.append(" ".join(( +*/ + __pyx_t_2 = ((PyObject *)__pyx_v_state); + __Pyx_INCREF(__pyx_t_2); + __pyx_t_3 = 0; + { + PyObject *__pyx_callargs[2] = {__pyx_t_2, __pyx_mstate_global->__pyx_int_0}; + __pyx_t_1 = __Pyx_PyObject_FastCallMethod((PyObject*)__pyx_mstate_global->__pyx_n_u_B, __pyx_callargs+__pyx_t_3, (2-__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, 105, __pyx_L1_error) + __Pyx_GOTREF(__pyx_t_1); + } + __Pyx_XDECREF_SET(__pyx_v_b0, __pyx_t_1); + __pyx_t_1 = 0; + + /* "spacy/pipeline/_parser_internals/transition_system.pyx":106 + * s0 = state.S(0) + * b0 = state.B(0) + * example = _debug # <<<<<<<<<<<<<< + * debug_log.append(" ".join(( + * self.get_class_name(i), +*/ + __Pyx_INCREF(__pyx_v__debug); + __Pyx_XDECREF_SET(__pyx_v_example, __pyx_v__debug); + + /* "spacy/pipeline/_parser_internals/transition_system.pyx":108 + * example = _debug + * debug_log.append(" ".join(( + * self.get_class_name(i), # <<<<<<<<<<<<<< + * "S0=", (example.x[s0].text if s0 >= 0 else "__"), + * "B0=", (example.x[b0].text if b0 >= 0 else "__"), +*/ + __pyx_t_2 = ((PyObject *)__pyx_v_self); + __Pyx_INCREF(__pyx_t_2); + __pyx_t_11 = __Pyx_PyLong_From_int(__pyx_v_i); if (unlikely(!__pyx_t_11)) __PYX_ERR(0, 108, __pyx_L1_error) + __Pyx_GOTREF(__pyx_t_11); + __pyx_t_3 = 0; + { + PyObject *__pyx_callargs[2] = {__pyx_t_2, __pyx_t_11}; + __pyx_t_1 = __Pyx_PyObject_FastCallMethod((PyObject*)__pyx_mstate_global->__pyx_n_u_get_class_name, __pyx_callargs+__pyx_t_3, (2-__pyx_t_3) | (1*__Pyx_PY_VECTORCALL_ARGUMENTS_OFFSET)); + __Pyx_XDECREF(__pyx_t_2); __pyx_t_2 = 0; + __Pyx_DECREF(__pyx_t_11); __pyx_t_11 = 0; + if (unlikely(!__pyx_t_1)) __PYX_ERR(0, 108, __pyx_L1_error) + __Pyx_GOTREF(__pyx_t_1); + } + + /* "spacy/pipeline/_parser_internals/transition_system.pyx":109 + * debug_log.append(" ".join(( + * self.get_class_name(i), + * "S0=", (example.x[s0].text if s0 >= 0 else "__"), # <<<<<<<<<<<<<< + * "B0=", (example.x[b0].text if b0 >= 0 else "__"), + * "S0 head?", str(state.has_head(state.S(0))), +*/ + __pyx_t_2 = PyObject_RichCompare(__pyx_v_s0, __pyx_mstate_global->__pyx_int_0, Py_GE); __Pyx_XGOTREF(__pyx_t_2); if (unlikely(!__pyx_t_2)) __PYX_ERR(0, 109, __pyx_L1_error) + __pyx_t_6 = __Pyx_PyObject_IsTrue(__pyx_t_2); if (unlikely((__pyx_t_6 < 0))) __PYX_ERR(0, 109, __pyx_L1_error) + __Pyx_DECREF(__pyx_t_2); __pyx_t_2 = 0; + if (__pyx_t_6) { + __pyx_t_2 = __Pyx_PyObject_GetAttrStr(__pyx_v_example, __pyx_mstate_global->__pyx_n_u_x); if (unlikely(!__pyx_t_2)) __PYX_ERR(0, 109, __pyx_L1_error) + __Pyx_GOTREF(__pyx_t_2); + __pyx_t_12 = __Pyx_PyObject_GetItem(__pyx_t_2, __pyx_v_s0); if (unlikely(!__pyx_t_12)) __PYX_ERR(0, 109, __pyx_L1_error) + __Pyx_GOTREF(__pyx_t_12); + __Pyx_DECREF(__pyx_t_2); __pyx_t_2 = 0; + __pyx_t_2 = __Pyx_PyObject_GetAttrStr(__pyx_t_12, __pyx_mstate_global->__pyx_n_u_text); if (unlikely(!__pyx_t_2)) __PYX_ERR(0, 109, __pyx_L1_error) + __Pyx_GOTREF(__pyx_t_2); + __Pyx_DECREF(__pyx_t_12); __pyx_t_12 = 0; + __pyx_t_11 = __pyx_t_2; + __pyx_t_2 = 0; + } else { + __Pyx_INCREF(__pyx_mstate_global->__pyx_n_u__7); + __pyx_t_11 = __pyx_mstate_global->__pyx_n_u__7; + } + + /* "spacy/pipeline/_parser_internals/transition_system.pyx":110 + * self.get_class_name(i), + * "S0=", (example.x[s0].text if s0 >= 0 else "__"), + * "B0=", (example.x[b0].text if b0 >= 0 else "__"), # <<<<<<<<<<<<<< + * "S0 head?", str(state.has_head(state.S(0))), + * ))) +*/ + __pyx_t_12 = PyObject_RichCompare(__pyx_v_b0, __pyx_mstate_global->__pyx_int_0, Py_GE); __Pyx_XGOTREF(__pyx_t_12); if (unlikely(!__pyx_t_12)) __PYX_ERR(0, 110, __pyx_L1_error) + __pyx_t_6 = __Pyx_PyObject_IsTrue(__pyx_t_12); if (unlikely((__pyx_t_6 < 0))) __PYX_ERR(0, 110, __pyx_L1_error) + __Pyx_DECREF(__pyx_t_12); __pyx_t_12 = 0; + if (__pyx_t_6) { + __pyx_t_12 = __Pyx_PyObject_GetAttrStr(__pyx_v_example, __pyx_mstate_global->__pyx_n_u_x); if (unlikely(!__pyx_t_12)) __PYX_ERR(0, 110, __pyx_L1_error) + __Pyx_GOTREF(__pyx_t_12); + __pyx_t_13 = __Pyx_PyObject_GetItem(__pyx_t_12, __pyx_v_b0); if (unlikely(!__pyx_t_13)) __PYX_ERR(0, 110, __pyx_L1_error) + __Pyx_GOTREF(__pyx_t_13); + __Pyx_DECREF(__pyx_t_12); __pyx_t_12 = 0; + __pyx_t_12 = __Pyx_PyObject_GetAttrStr(__pyx_t_13, __pyx_mstate_global->__pyx_n_u_text); if (unlikely(!__pyx_t_12)) __PYX_ERR(0, 110, __pyx_L1_error) + __Pyx_GOTREF(__pyx_t_12); + __Pyx_DECREF(__pyx_t_13); __pyx_t_13 = 0; + __pyx_t_2 = __pyx_t_12; + __pyx_t_12 = 0; + } else { + __Pyx_INCREF(__pyx_mstate_global->__pyx_n_u__7); + __pyx_t_2 = __pyx_mstate_global->__pyx_n_u__7; + } + + /* "spacy/pipeline/_parser_internals/transition_system.pyx":111 + * "S0=", (example.x[s0].text if s0 >= 0 else "__"), + * "B0=", (example.x[b0].text if b0 >= 0 else "__"), + * "S0 head?", str(state.has_head(state.S(0))), # <<<<<<<<<<<<<< + * ))) + * action.do(state.c, action.label) +*/ + __pyx_t_13 = ((PyObject *)__pyx_v_state); + __Pyx_INCREF(__pyx_t_13); + __pyx_t_15 = ((PyObject *)__pyx_v_state); + __Pyx_INCREF(__pyx_t_15); + __pyx_t_3 = 0; + { + PyObject *__pyx_callargs[2] = {__pyx_t_15, __pyx_mstate_global->__pyx_int_0}; + __pyx_t_14 = __Pyx_PyObject_FastCallMethod((PyObject*)__pyx_mstate_global->__pyx_n_u_S, __pyx_callargs+__pyx_t_3, (2-__pyx_t_3) | (1*__Pyx_PY_VECTORCALL_ARGUMENTS_OFFSET)); + __Pyx_XDECREF(__pyx_t_15); __pyx_t_15 = 0; + if (unlikely(!__pyx_t_14)) __PYX_ERR(0, 111, __pyx_L1_error) + __Pyx_GOTREF(__pyx_t_14); + } + __pyx_t_3 = 0; + { + PyObject *__pyx_callargs[2] = {__pyx_t_13, __pyx_t_14}; + __pyx_t_12 = __Pyx_PyObject_FastCallMethod((PyObject*)__pyx_mstate_global->__pyx_n_u_has_head, __pyx_callargs+__pyx_t_3, (2-__pyx_t_3) | (1*__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, 111, __pyx_L1_error) + __Pyx_GOTREF(__pyx_t_12); + } + __pyx_t_14 = __Pyx_PyObject_Unicode(__pyx_t_12); if (unlikely(!__pyx_t_14)) __PYX_ERR(0, 111, __pyx_L1_error) + __Pyx_GOTREF(__pyx_t_14); + __Pyx_DECREF(__pyx_t_12); __pyx_t_12 = 0; + + /* "spacy/pipeline/_parser_internals/transition_system.pyx":108 + * example = _debug + * debug_log.append(" ".join(( + * self.get_class_name(i), # <<<<<<<<<<<<<< + * "S0=", (example.x[s0].text if s0 >= 0 else "__"), + * "B0=", (example.x[b0].text if b0 >= 0 else "__"), +*/ + __pyx_t_12 = PyTuple_New(7); if (unlikely(!__pyx_t_12)) __PYX_ERR(0, 108, __pyx_L1_error) + __Pyx_GOTREF(__pyx_t_12); + __Pyx_GIVEREF(__pyx_t_1); + if (__Pyx_PyTuple_SET_ITEM(__pyx_t_12, 0, __pyx_t_1) != (0)) __PYX_ERR(0, 108, __pyx_L1_error); + __Pyx_INCREF(__pyx_mstate_global->__pyx_kp_u_S0); + __Pyx_GIVEREF(__pyx_mstate_global->__pyx_kp_u_S0); + if (__Pyx_PyTuple_SET_ITEM(__pyx_t_12, 1, __pyx_mstate_global->__pyx_kp_u_S0) != (0)) __PYX_ERR(0, 108, __pyx_L1_error); + __Pyx_GIVEREF(__pyx_t_11); + if (__Pyx_PyTuple_SET_ITEM(__pyx_t_12, 2, __pyx_t_11) != (0)) __PYX_ERR(0, 108, __pyx_L1_error); + __Pyx_INCREF(__pyx_mstate_global->__pyx_kp_u_B0); + __Pyx_GIVEREF(__pyx_mstate_global->__pyx_kp_u_B0); + if (__Pyx_PyTuple_SET_ITEM(__pyx_t_12, 3, __pyx_mstate_global->__pyx_kp_u_B0) != (0)) __PYX_ERR(0, 108, __pyx_L1_error); + __Pyx_GIVEREF(__pyx_t_2); + if (__Pyx_PyTuple_SET_ITEM(__pyx_t_12, 4, __pyx_t_2) != (0)) __PYX_ERR(0, 108, __pyx_L1_error); + __Pyx_INCREF(__pyx_mstate_global->__pyx_kp_u_S0_head); + __Pyx_GIVEREF(__pyx_mstate_global->__pyx_kp_u_S0_head); + if (__Pyx_PyTuple_SET_ITEM(__pyx_t_12, 5, __pyx_mstate_global->__pyx_kp_u_S0_head) != (0)) __PYX_ERR(0, 108, __pyx_L1_error); + __Pyx_GIVEREF(__pyx_t_14); + if (__Pyx_PyTuple_SET_ITEM(__pyx_t_12, 6, __pyx_t_14) != (0)) __PYX_ERR(0, 108, __pyx_L1_error); + __pyx_t_1 = 0; + __pyx_t_11 = 0; + __pyx_t_2 = 0; + __pyx_t_14 = 0; + + /* "spacy/pipeline/_parser_internals/transition_system.pyx":107 + * b0 = state.B(0) + * example = _debug + * debug_log.append(" ".join(( # <<<<<<<<<<<<<< + * self.get_class_name(i), + * "S0=", (example.x[s0].text if s0 >= 0 else "__"), +*/ + __pyx_t_14 = PyUnicode_Join(__pyx_mstate_global->__pyx_kp_u__6, __pyx_t_12); if (unlikely(!__pyx_t_14)) __PYX_ERR(0, 107, __pyx_L1_error) + __Pyx_GOTREF(__pyx_t_14); + __Pyx_DECREF(__pyx_t_12); __pyx_t_12 = 0; + __pyx_t_10 = __Pyx_PyList_Append(__pyx_v_debug_log, __pyx_t_14); if (unlikely(__pyx_t_10 == ((int)-1))) __PYX_ERR(0, 107, __pyx_L1_error) + __Pyx_DECREF(__pyx_t_14); __pyx_t_14 = 0; + + /* "spacy/pipeline/_parser_internals/transition_system.pyx":103 + * action = self.c[i] + * history.append(i) + * if _debug: # <<<<<<<<<<<<<< + * s0 = state.S(0) + * b0 = state.B(0) +*/ + } + + /* "spacy/pipeline/_parser_internals/transition_system.pyx":113 + * "S0 head?", str(state.has_head(state.S(0))), + * ))) + * action.do(state.c, action.label) # <<<<<<<<<<<<<< + * break + * else: +*/ + (void)(__pyx_v_action.__pyx_do(__pyx_v_state->c, __pyx_v_action.label)); + + /* "spacy/pipeline/_parser_internals/transition_system.pyx":114 + * ))) + * action.do(state.c, action.label) + * break # <<<<<<<<<<<<<< + * else: + * if _debug: +*/ + goto __pyx_L6_break; + + /* "spacy/pipeline/_parser_internals/transition_system.pyx":100 + * self.set_costs(is_valid, costs, state.c, gold) + * for i in range(self.n_moves): + * if is_valid[i] and costs[i] <= 0: # <<<<<<<<<<<<<< + * action = self.c[i] + * history.append(i) +*/ + } + } + /*else*/ { + + /* "spacy/pipeline/_parser_internals/transition_system.pyx":116 + * break + * else: + * if _debug: # <<<<<<<<<<<<<< + * example = _debug + * print("Actions") +*/ + __pyx_t_6 = __Pyx_PyObject_IsTrue(__pyx_v__debug); if (unlikely((__pyx_t_6 < 0))) __PYX_ERR(0, 116, __pyx_L1_error) + if (__pyx_t_6) { + + /* "spacy/pipeline/_parser_internals/transition_system.pyx":117 + * else: + * if _debug: + * example = _debug # <<<<<<<<<<<<<< + * print("Actions") + * for i in range(self.n_moves): +*/ + __Pyx_INCREF(__pyx_v__debug); + __Pyx_XDECREF_SET(__pyx_v_example, __pyx_v__debug); + + /* "spacy/pipeline/_parser_internals/transition_system.pyx":118 + * if _debug: + * example = _debug + * print("Actions") # <<<<<<<<<<<<<< + * for i in range(self.n_moves): + * print(self.get_class_name(i)) +*/ + __pyx_t_12 = NULL; + __pyx_t_3 = 1; + { + PyObject *__pyx_callargs[2] = {__pyx_t_12, __pyx_mstate_global->__pyx_n_u_Actions}; + __pyx_t_14 = __Pyx_PyObject_FastCall((PyObject*)__pyx_builtin_print, __pyx_callargs+__pyx_t_3, (2-__pyx_t_3) | (__pyx_t_3*__Pyx_PY_VECTORCALL_ARGUMENTS_OFFSET)); + __Pyx_XDECREF(__pyx_t_12); __pyx_t_12 = 0; + if (unlikely(!__pyx_t_14)) __PYX_ERR(0, 118, __pyx_L1_error) + __Pyx_GOTREF(__pyx_t_14); + } + __Pyx_DECREF(__pyx_t_14); __pyx_t_14 = 0; + + /* "spacy/pipeline/_parser_internals/transition_system.pyx":119 + * example = _debug + * print("Actions") + * for i in range(self.n_moves): # <<<<<<<<<<<<<< + * print(self.get_class_name(i)) + * print("Gold") +*/ + __pyx_t_9 = __pyx_v_self->n_moves; + __pyx_t_16 = __pyx_t_9; + for (__pyx_t_17 = 0; __pyx_t_17 < __pyx_t_16; __pyx_t_17+=1) { + __pyx_v_i = __pyx_t_17; + + /* "spacy/pipeline/_parser_internals/transition_system.pyx":120 + * print("Actions") + * for i in range(self.n_moves): + * print(self.get_class_name(i)) # <<<<<<<<<<<<<< + * print("Gold") + * for token in example.y: +*/ + __pyx_t_12 = NULL; + __pyx_t_11 = ((PyObject *)__pyx_v_self); + __Pyx_INCREF(__pyx_t_11); + __pyx_t_1 = __Pyx_PyLong_From_int(__pyx_v_i); if (unlikely(!__pyx_t_1)) __PYX_ERR(0, 120, __pyx_L1_error) + __Pyx_GOTREF(__pyx_t_1); + __pyx_t_3 = 0; + { + PyObject *__pyx_callargs[2] = {__pyx_t_11, __pyx_t_1}; + __pyx_t_2 = __Pyx_PyObject_FastCallMethod((PyObject*)__pyx_mstate_global->__pyx_n_u_get_class_name, __pyx_callargs+__pyx_t_3, (2-__pyx_t_3) | (1*__Pyx_PY_VECTORCALL_ARGUMENTS_OFFSET)); + __Pyx_XDECREF(__pyx_t_11); __pyx_t_11 = 0; + __Pyx_DECREF(__pyx_t_1); __pyx_t_1 = 0; + if (unlikely(!__pyx_t_2)) __PYX_ERR(0, 120, __pyx_L1_error) + __Pyx_GOTREF(__pyx_t_2); + } + __pyx_t_3 = 1; + { + PyObject *__pyx_callargs[2] = {__pyx_t_12, __pyx_t_2}; + __pyx_t_14 = __Pyx_PyObject_FastCall((PyObject*)__pyx_builtin_print, __pyx_callargs+__pyx_t_3, (2-__pyx_t_3) | (__pyx_t_3*__Pyx_PY_VECTORCALL_ARGUMENTS_OFFSET)); + __Pyx_XDECREF(__pyx_t_12); __pyx_t_12 = 0; + __Pyx_DECREF(__pyx_t_2); __pyx_t_2 = 0; + if (unlikely(!__pyx_t_14)) __PYX_ERR(0, 120, __pyx_L1_error) + __Pyx_GOTREF(__pyx_t_14); + } + __Pyx_DECREF(__pyx_t_14); __pyx_t_14 = 0; + } + + /* "spacy/pipeline/_parser_internals/transition_system.pyx":121 + * for i in range(self.n_moves): + * print(self.get_class_name(i)) + * print("Gold") # <<<<<<<<<<<<<< + * for token in example.y: + * print(token.text, token.dep_, token.head.text) +*/ + __pyx_t_2 = NULL; + __pyx_t_3 = 1; + { + PyObject *__pyx_callargs[2] = {__pyx_t_2, __pyx_mstate_global->__pyx_n_u_Gold}; + __pyx_t_14 = __Pyx_PyObject_FastCall((PyObject*)__pyx_builtin_print, __pyx_callargs+__pyx_t_3, (2-__pyx_t_3) | (__pyx_t_3*__Pyx_PY_VECTORCALL_ARGUMENTS_OFFSET)); + __Pyx_XDECREF(__pyx_t_2); __pyx_t_2 = 0; + if (unlikely(!__pyx_t_14)) __PYX_ERR(0, 121, __pyx_L1_error) + __Pyx_GOTREF(__pyx_t_14); + } + __Pyx_DECREF(__pyx_t_14); __pyx_t_14 = 0; + + /* "spacy/pipeline/_parser_internals/transition_system.pyx":122 + * print(self.get_class_name(i)) + * print("Gold") + * for token in example.y: # <<<<<<<<<<<<<< + * print(token.text, token.dep_, token.head.text) + * s0 = state.S(0) +*/ + __pyx_t_14 = __Pyx_PyObject_GetAttrStr(__pyx_v_example, __pyx_mstate_global->__pyx_n_u_y); if (unlikely(!__pyx_t_14)) __PYX_ERR(0, 122, __pyx_L1_error) + __Pyx_GOTREF(__pyx_t_14); + if (likely(PyList_CheckExact(__pyx_t_14)) || PyTuple_CheckExact(__pyx_t_14)) { + __pyx_t_2 = __pyx_t_14; __Pyx_INCREF(__pyx_t_2); + __pyx_t_18 = 0; + __pyx_t_19 = NULL; + } else { + __pyx_t_18 = -1; __pyx_t_2 = PyObject_GetIter(__pyx_t_14); if (unlikely(!__pyx_t_2)) __PYX_ERR(0, 122, __pyx_L1_error) + __Pyx_GOTREF(__pyx_t_2); + __pyx_t_19 = (CYTHON_COMPILING_IN_LIMITED_API) ? PyIter_Next : __Pyx_PyObject_GetIterNextFunc(__pyx_t_2); if (unlikely(!__pyx_t_19)) __PYX_ERR(0, 122, __pyx_L1_error) + } + __Pyx_DECREF(__pyx_t_14); __pyx_t_14 = 0; + for (;;) { + if (likely(!__pyx_t_19)) { + if (likely(PyList_CheckExact(__pyx_t_2))) { + { + Py_ssize_t __pyx_temp = __Pyx_PyList_GET_SIZE(__pyx_t_2); + #if !CYTHON_ASSUME_SAFE_SIZE + if (unlikely((__pyx_temp < 0))) __PYX_ERR(0, 122, __pyx_L1_error) + #endif + if (__pyx_t_18 >= __pyx_temp) break; + } + __pyx_t_14 = __Pyx_PyList_GetItemRefFast(__pyx_t_2, __pyx_t_18, __Pyx_ReferenceSharing_OwnStrongReference); + ++__pyx_t_18; + } else { + { + Py_ssize_t __pyx_temp = __Pyx_PyTuple_GET_SIZE(__pyx_t_2); + #if !CYTHON_ASSUME_SAFE_SIZE + if (unlikely((__pyx_temp < 0))) __PYX_ERR(0, 122, __pyx_L1_error) + #endif + if (__pyx_t_18 >= __pyx_temp) break; + } + #if CYTHON_ASSUME_SAFE_MACROS && !CYTHON_AVOID_BORROWED_REFS + __pyx_t_14 = __Pyx_NewRef(PyTuple_GET_ITEM(__pyx_t_2, __pyx_t_18)); + #else + __pyx_t_14 = __Pyx_PySequence_ITEM(__pyx_t_2, __pyx_t_18); + #endif + ++__pyx_t_18; + } + if (unlikely(!__pyx_t_14)) __PYX_ERR(0, 122, __pyx_L1_error) + } else { + __pyx_t_14 = __pyx_t_19(__pyx_t_2); + if (unlikely(!__pyx_t_14)) { + PyObject* exc_type = PyErr_Occurred(); + if (exc_type) { + if (unlikely(!__Pyx_PyErr_GivenExceptionMatches(exc_type, PyExc_StopIteration))) __PYX_ERR(0, 122, __pyx_L1_error) + PyErr_Clear(); + } + break; + } + } + __Pyx_GOTREF(__pyx_t_14); + __Pyx_XDECREF_SET(__pyx_v_token, __pyx_t_14); + __pyx_t_14 = 0; + + /* "spacy/pipeline/_parser_internals/transition_system.pyx":123 + * print("Gold") + * for token in example.y: + * print(token.text, token.dep_, token.head.text) # <<<<<<<<<<<<<< + * s0 = state.S(0) + * b0 = state.B(0) +*/ + __pyx_t_12 = NULL; + __pyx_t_1 = __Pyx_PyObject_GetAttrStr(__pyx_v_token, __pyx_mstate_global->__pyx_n_u_text); if (unlikely(!__pyx_t_1)) __PYX_ERR(0, 123, __pyx_L1_error) + __Pyx_GOTREF(__pyx_t_1); + __pyx_t_11 = __Pyx_PyObject_GetAttrStr(__pyx_v_token, __pyx_mstate_global->__pyx_n_u_dep); if (unlikely(!__pyx_t_11)) __PYX_ERR(0, 123, __pyx_L1_error) + __Pyx_GOTREF(__pyx_t_11); + __pyx_t_13 = __Pyx_PyObject_GetAttrStr(__pyx_v_token, __pyx_mstate_global->__pyx_n_u_head); if (unlikely(!__pyx_t_13)) __PYX_ERR(0, 123, __pyx_L1_error) + __Pyx_GOTREF(__pyx_t_13); + __pyx_t_15 = __Pyx_PyObject_GetAttrStr(__pyx_t_13, __pyx_mstate_global->__pyx_n_u_text); if (unlikely(!__pyx_t_15)) __PYX_ERR(0, 123, __pyx_L1_error) + __Pyx_GOTREF(__pyx_t_15); + __Pyx_DECREF(__pyx_t_13); __pyx_t_13 = 0; + __pyx_t_3 = 1; + { + PyObject *__pyx_callargs[4] = {__pyx_t_12, __pyx_t_1, __pyx_t_11, __pyx_t_15}; + __pyx_t_14 = __Pyx_PyObject_FastCall((PyObject*)__pyx_builtin_print, __pyx_callargs+__pyx_t_3, (4-__pyx_t_3) | (__pyx_t_3*__Pyx_PY_VECTORCALL_ARGUMENTS_OFFSET)); + __Pyx_XDECREF(__pyx_t_12); __pyx_t_12 = 0; + __Pyx_DECREF(__pyx_t_1); __pyx_t_1 = 0; + __Pyx_DECREF(__pyx_t_11); __pyx_t_11 = 0; + __Pyx_DECREF(__pyx_t_15); __pyx_t_15 = 0; + if (unlikely(!__pyx_t_14)) __PYX_ERR(0, 123, __pyx_L1_error) + __Pyx_GOTREF(__pyx_t_14); + } + __Pyx_DECREF(__pyx_t_14); __pyx_t_14 = 0; + + /* "spacy/pipeline/_parser_internals/transition_system.pyx":122 + * print(self.get_class_name(i)) + * print("Gold") + * for token in example.y: # <<<<<<<<<<<<<< + * print(token.text, token.dep_, token.head.text) + * s0 = state.S(0) +*/ + } + __Pyx_DECREF(__pyx_t_2); __pyx_t_2 = 0; + + /* "spacy/pipeline/_parser_internals/transition_system.pyx":124 + * for token in example.y: + * print(token.text, token.dep_, token.head.text) + * s0 = state.S(0) # <<<<<<<<<<<<<< + * b0 = state.B(0) + * debug_log.append(" ".join(( +*/ + __pyx_t_14 = ((PyObject *)__pyx_v_state); + __Pyx_INCREF(__pyx_t_14); + __pyx_t_3 = 0; + { + PyObject *__pyx_callargs[2] = {__pyx_t_14, __pyx_mstate_global->__pyx_int_0}; + __pyx_t_2 = __Pyx_PyObject_FastCallMethod((PyObject*)__pyx_mstate_global->__pyx_n_u_S, __pyx_callargs+__pyx_t_3, (2-__pyx_t_3) | (1*__Pyx_PY_VECTORCALL_ARGUMENTS_OFFSET)); + __Pyx_XDECREF(__pyx_t_14); __pyx_t_14 = 0; + if (unlikely(!__pyx_t_2)) __PYX_ERR(0, 124, __pyx_L1_error) + __Pyx_GOTREF(__pyx_t_2); + } + __Pyx_XDECREF_SET(__pyx_v_s0, __pyx_t_2); + __pyx_t_2 = 0; + + /* "spacy/pipeline/_parser_internals/transition_system.pyx":125 + * print(token.text, token.dep_, token.head.text) + * s0 = state.S(0) + * b0 = state.B(0) # <<<<<<<<<<<<<< + * debug_log.append(" ".join(( + * "?", +*/ + __pyx_t_14 = ((PyObject *)__pyx_v_state); + __Pyx_INCREF(__pyx_t_14); + __pyx_t_3 = 0; + { + PyObject *__pyx_callargs[2] = {__pyx_t_14, __pyx_mstate_global->__pyx_int_0}; + __pyx_t_2 = __Pyx_PyObject_FastCallMethod((PyObject*)__pyx_mstate_global->__pyx_n_u_B, __pyx_callargs+__pyx_t_3, (2-__pyx_t_3) | (1*__Pyx_PY_VECTORCALL_ARGUMENTS_OFFSET)); + __Pyx_XDECREF(__pyx_t_14); __pyx_t_14 = 0; + if (unlikely(!__pyx_t_2)) __PYX_ERR(0, 125, __pyx_L1_error) + __Pyx_GOTREF(__pyx_t_2); + } + __Pyx_XDECREF_SET(__pyx_v_b0, __pyx_t_2); + __pyx_t_2 = 0; + + /* "spacy/pipeline/_parser_internals/transition_system.pyx":128 + * debug_log.append(" ".join(( + * "?", + * "S0=", (example.x[s0].text if s0 >= 0 else "-"), # <<<<<<<<<<<<<< + * "B0=", (example.x[b0].text if b0 >= 0 else "-"), + * "S0 head?", str(state.has_head(state.S(0))), +*/ + __pyx_t_14 = PyObject_RichCompare(__pyx_v_s0, __pyx_mstate_global->__pyx_int_0, Py_GE); __Pyx_XGOTREF(__pyx_t_14); if (unlikely(!__pyx_t_14)) __PYX_ERR(0, 128, __pyx_L1_error) + __pyx_t_6 = __Pyx_PyObject_IsTrue(__pyx_t_14); if (unlikely((__pyx_t_6 < 0))) __PYX_ERR(0, 128, __pyx_L1_error) + __Pyx_DECREF(__pyx_t_14); __pyx_t_14 = 0; + if (__pyx_t_6) { + __pyx_t_14 = __Pyx_PyObject_GetAttrStr(__pyx_v_example, __pyx_mstate_global->__pyx_n_u_x); if (unlikely(!__pyx_t_14)) __PYX_ERR(0, 128, __pyx_L1_error) + __Pyx_GOTREF(__pyx_t_14); + __pyx_t_15 = __Pyx_PyObject_GetItem(__pyx_t_14, __pyx_v_s0); if (unlikely(!__pyx_t_15)) __PYX_ERR(0, 128, __pyx_L1_error) + __Pyx_GOTREF(__pyx_t_15); + __Pyx_DECREF(__pyx_t_14); __pyx_t_14 = 0; + __pyx_t_14 = __Pyx_PyObject_GetAttrStr(__pyx_t_15, __pyx_mstate_global->__pyx_n_u_text); if (unlikely(!__pyx_t_14)) __PYX_ERR(0, 128, __pyx_L1_error) + __Pyx_GOTREF(__pyx_t_14); + __Pyx_DECREF(__pyx_t_15); __pyx_t_15 = 0; + __pyx_t_2 = __pyx_t_14; + __pyx_t_14 = 0; + } else { + __Pyx_INCREF(__pyx_mstate_global->__pyx_kp_u__9); + __pyx_t_2 = __pyx_mstate_global->__pyx_kp_u__9; + } + + /* "spacy/pipeline/_parser_internals/transition_system.pyx":129 + * "?", + * "S0=", (example.x[s0].text if s0 >= 0 else "-"), + * "B0=", (example.x[b0].text if b0 >= 0 else "-"), # <<<<<<<<<<<<<< + * "S0 head?", str(state.has_head(state.S(0))), + * ))) +*/ + __pyx_t_15 = PyObject_RichCompare(__pyx_v_b0, __pyx_mstate_global->__pyx_int_0, Py_GE); __Pyx_XGOTREF(__pyx_t_15); if (unlikely(!__pyx_t_15)) __PYX_ERR(0, 129, __pyx_L1_error) + __pyx_t_6 = __Pyx_PyObject_IsTrue(__pyx_t_15); if (unlikely((__pyx_t_6 < 0))) __PYX_ERR(0, 129, __pyx_L1_error) + __Pyx_DECREF(__pyx_t_15); __pyx_t_15 = 0; + if (__pyx_t_6) { + __pyx_t_15 = __Pyx_PyObject_GetAttrStr(__pyx_v_example, __pyx_mstate_global->__pyx_n_u_x); if (unlikely(!__pyx_t_15)) __PYX_ERR(0, 129, __pyx_L1_error) + __Pyx_GOTREF(__pyx_t_15); + __pyx_t_11 = __Pyx_PyObject_GetItem(__pyx_t_15, __pyx_v_b0); if (unlikely(!__pyx_t_11)) __PYX_ERR(0, 129, __pyx_L1_error) + __Pyx_GOTREF(__pyx_t_11); + __Pyx_DECREF(__pyx_t_15); __pyx_t_15 = 0; + __pyx_t_15 = __Pyx_PyObject_GetAttrStr(__pyx_t_11, __pyx_mstate_global->__pyx_n_u_text); if (unlikely(!__pyx_t_15)) __PYX_ERR(0, 129, __pyx_L1_error) + __Pyx_GOTREF(__pyx_t_15); + __Pyx_DECREF(__pyx_t_11); __pyx_t_11 = 0; + __pyx_t_14 = __pyx_t_15; + __pyx_t_15 = 0; + } else { + __Pyx_INCREF(__pyx_mstate_global->__pyx_kp_u__9); + __pyx_t_14 = __pyx_mstate_global->__pyx_kp_u__9; + } + + /* "spacy/pipeline/_parser_internals/transition_system.pyx":130 + * "S0=", (example.x[s0].text if s0 >= 0 else "-"), + * "B0=", (example.x[b0].text if b0 >= 0 else "-"), + * "S0 head?", str(state.has_head(state.S(0))), # <<<<<<<<<<<<<< + * ))) + * print("\n".join(debug_log)) +*/ + __pyx_t_11 = ((PyObject *)__pyx_v_state); + __Pyx_INCREF(__pyx_t_11); + __pyx_t_12 = ((PyObject *)__pyx_v_state); + __Pyx_INCREF(__pyx_t_12); + __pyx_t_3 = 0; + { + PyObject *__pyx_callargs[2] = {__pyx_t_12, __pyx_mstate_global->__pyx_int_0}; + __pyx_t_1 = __Pyx_PyObject_FastCallMethod((PyObject*)__pyx_mstate_global->__pyx_n_u_S, __pyx_callargs+__pyx_t_3, (2-__pyx_t_3) | (1*__Pyx_PY_VECTORCALL_ARGUMENTS_OFFSET)); + __Pyx_XDECREF(__pyx_t_12); __pyx_t_12 = 0; + if (unlikely(!__pyx_t_1)) __PYX_ERR(0, 130, __pyx_L1_error) + __Pyx_GOTREF(__pyx_t_1); + } + __pyx_t_3 = 0; + { + PyObject *__pyx_callargs[2] = {__pyx_t_11, __pyx_t_1}; + __pyx_t_15 = __Pyx_PyObject_FastCallMethod((PyObject*)__pyx_mstate_global->__pyx_n_u_has_head, __pyx_callargs+__pyx_t_3, (2-__pyx_t_3) | (1*__Pyx_PY_VECTORCALL_ARGUMENTS_OFFSET)); + __Pyx_XDECREF(__pyx_t_11); __pyx_t_11 = 0; + __Pyx_DECREF(__pyx_t_1); __pyx_t_1 = 0; + if (unlikely(!__pyx_t_15)) __PYX_ERR(0, 130, __pyx_L1_error) + __Pyx_GOTREF(__pyx_t_15); + } + __pyx_t_1 = __Pyx_PyObject_Unicode(__pyx_t_15); if (unlikely(!__pyx_t_1)) __PYX_ERR(0, 130, __pyx_L1_error) + __Pyx_GOTREF(__pyx_t_1); + __Pyx_DECREF(__pyx_t_15); __pyx_t_15 = 0; + + /* "spacy/pipeline/_parser_internals/transition_system.pyx":127 + * b0 = state.B(0) + * debug_log.append(" ".join(( + * "?", # <<<<<<<<<<<<<< + * "S0=", (example.x[s0].text if s0 >= 0 else "-"), + * "B0=", (example.x[b0].text if b0 >= 0 else "-"), +*/ + __pyx_t_15 = PyTuple_New(7); if (unlikely(!__pyx_t_15)) __PYX_ERR(0, 127, __pyx_L1_error) + __Pyx_GOTREF(__pyx_t_15); + __Pyx_INCREF(__pyx_mstate_global->__pyx_kp_u__8); + __Pyx_GIVEREF(__pyx_mstate_global->__pyx_kp_u__8); + if (__Pyx_PyTuple_SET_ITEM(__pyx_t_15, 0, __pyx_mstate_global->__pyx_kp_u__8) != (0)) __PYX_ERR(0, 127, __pyx_L1_error); + __Pyx_INCREF(__pyx_mstate_global->__pyx_kp_u_S0); + __Pyx_GIVEREF(__pyx_mstate_global->__pyx_kp_u_S0); + if (__Pyx_PyTuple_SET_ITEM(__pyx_t_15, 1, __pyx_mstate_global->__pyx_kp_u_S0) != (0)) __PYX_ERR(0, 127, __pyx_L1_error); + __Pyx_GIVEREF(__pyx_t_2); + if (__Pyx_PyTuple_SET_ITEM(__pyx_t_15, 2, __pyx_t_2) != (0)) __PYX_ERR(0, 127, __pyx_L1_error); + __Pyx_INCREF(__pyx_mstate_global->__pyx_kp_u_B0); + __Pyx_GIVEREF(__pyx_mstate_global->__pyx_kp_u_B0); + if (__Pyx_PyTuple_SET_ITEM(__pyx_t_15, 3, __pyx_mstate_global->__pyx_kp_u_B0) != (0)) __PYX_ERR(0, 127, __pyx_L1_error); + __Pyx_GIVEREF(__pyx_t_14); + if (__Pyx_PyTuple_SET_ITEM(__pyx_t_15, 4, __pyx_t_14) != (0)) __PYX_ERR(0, 127, __pyx_L1_error); + __Pyx_INCREF(__pyx_mstate_global->__pyx_kp_u_S0_head); + __Pyx_GIVEREF(__pyx_mstate_global->__pyx_kp_u_S0_head); + if (__Pyx_PyTuple_SET_ITEM(__pyx_t_15, 5, __pyx_mstate_global->__pyx_kp_u_S0_head) != (0)) __PYX_ERR(0, 127, __pyx_L1_error); + __Pyx_GIVEREF(__pyx_t_1); + if (__Pyx_PyTuple_SET_ITEM(__pyx_t_15, 6, __pyx_t_1) != (0)) __PYX_ERR(0, 127, __pyx_L1_error); + __pyx_t_2 = 0; + __pyx_t_14 = 0; + __pyx_t_1 = 0; + + /* "spacy/pipeline/_parser_internals/transition_system.pyx":126 + * s0 = state.S(0) + * b0 = state.B(0) + * debug_log.append(" ".join(( # <<<<<<<<<<<<<< + * "?", + * "S0=", (example.x[s0].text if s0 >= 0 else "-"), +*/ + __pyx_t_1 = PyUnicode_Join(__pyx_mstate_global->__pyx_kp_u__6, __pyx_t_15); if (unlikely(!__pyx_t_1)) __PYX_ERR(0, 126, __pyx_L1_error) + __Pyx_GOTREF(__pyx_t_1); + __Pyx_DECREF(__pyx_t_15); __pyx_t_15 = 0; + __pyx_t_10 = __Pyx_PyList_Append(__pyx_v_debug_log, __pyx_t_1); if (unlikely(__pyx_t_10 == ((int)-1))) __PYX_ERR(0, 126, __pyx_L1_error) + __Pyx_DECREF(__pyx_t_1); __pyx_t_1 = 0; + + /* "spacy/pipeline/_parser_internals/transition_system.pyx":132 + * "S0 head?", str(state.has_head(state.S(0))), + * ))) + * print("\n".join(debug_log)) # <<<<<<<<<<<<<< + * raise ValueError(Errors.E024) + * return history +*/ + __pyx_t_15 = NULL; + __pyx_t_14 = PyUnicode_Join(__pyx_mstate_global->__pyx_kp_u__10, __pyx_v_debug_log); if (unlikely(!__pyx_t_14)) __PYX_ERR(0, 132, __pyx_L1_error) + __Pyx_GOTREF(__pyx_t_14); + __pyx_t_3 = 1; + { + PyObject *__pyx_callargs[2] = {__pyx_t_15, __pyx_t_14}; + __pyx_t_1 = __Pyx_PyObject_FastCall((PyObject*)__pyx_builtin_print, __pyx_callargs+__pyx_t_3, (2-__pyx_t_3) | (__pyx_t_3*__Pyx_PY_VECTORCALL_ARGUMENTS_OFFSET)); + __Pyx_XDECREF(__pyx_t_15); __pyx_t_15 = 0; + __Pyx_DECREF(__pyx_t_14); __pyx_t_14 = 0; + if (unlikely(!__pyx_t_1)) __PYX_ERR(0, 132, __pyx_L1_error) + __Pyx_GOTREF(__pyx_t_1); + } + __Pyx_DECREF(__pyx_t_1); __pyx_t_1 = 0; + + /* "spacy/pipeline/_parser_internals/transition_system.pyx":116 + * break + * else: + * if _debug: # <<<<<<<<<<<<<< + * example = _debug + * print("Actions") +*/ + } + + /* "spacy/pipeline/_parser_internals/transition_system.pyx":133 + * ))) + * print("\n".join(debug_log)) + * raise ValueError(Errors.E024) # <<<<<<<<<<<<<< + * return history + * +*/ + __pyx_t_14 = NULL; + __Pyx_GetModuleGlobalName(__pyx_t_15, __pyx_mstate_global->__pyx_n_u_Errors); if (unlikely(!__pyx_t_15)) __PYX_ERR(0, 133, __pyx_L1_error) + __Pyx_GOTREF(__pyx_t_15); + __pyx_t_2 = __Pyx_PyObject_GetAttrStr(__pyx_t_15, __pyx_mstate_global->__pyx_n_u_E024); if (unlikely(!__pyx_t_2)) __PYX_ERR(0, 133, __pyx_L1_error) + __Pyx_GOTREF(__pyx_t_2); + __Pyx_DECREF(__pyx_t_15); __pyx_t_15 = 0; + __pyx_t_3 = 1; + { + PyObject *__pyx_callargs[2] = {__pyx_t_14, __pyx_t_2}; + __pyx_t_1 = __Pyx_PyObject_FastCall((PyObject*)(((PyTypeObject*)PyExc_ValueError)), __pyx_callargs+__pyx_t_3, (2-__pyx_t_3) | (__pyx_t_3*__Pyx_PY_VECTORCALL_ARGUMENTS_OFFSET)); + __Pyx_XDECREF(__pyx_t_14); __pyx_t_14 = 0; + __Pyx_DECREF(__pyx_t_2); __pyx_t_2 = 0; + if (unlikely(!__pyx_t_1)) __PYX_ERR(0, 133, __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, 133, __pyx_L1_error) + } + __pyx_L6_break:; + } + + /* "spacy/pipeline/_parser_internals/transition_system.pyx":134 + * print("\n".join(debug_log)) + * raise ValueError(Errors.E024) + * return history # <<<<<<<<<<<<<< + * + * def apply_transition(self, StateClass state, name): +*/ + __Pyx_XDECREF(__pyx_r); + __Pyx_INCREF(__pyx_v_history); + __pyx_r = __pyx_v_history; + goto __pyx_L0; + + /* "spacy/pipeline/_parser_internals/transition_system.pyx":88 + * return self.get_oracle_sequence_from_state(state, gold) + * + * def get_oracle_sequence_from_state(self, StateClass state, gold, _debug=None): # <<<<<<<<<<<<<< + * cdef Pool mem = Pool() + * # n_moves should not be zero at this point, but make sure to avoid zero-length mem alloc +*/ + + /* function exit code */ + __pyx_L1_error:; + __Pyx_XDECREF(__pyx_t_1); + __Pyx_XDECREF(__pyx_t_2); + __Pyx_XDECREF(__pyx_t_11); + __Pyx_XDECREF(__pyx_t_12); + __Pyx_XDECREF(__pyx_t_13); + __Pyx_XDECREF(__pyx_t_14); + __Pyx_XDECREF(__pyx_t_15); + __Pyx_AddTraceback("spacy.pipeline._parser_internals.transition_system.TransitionSystem.get_oracle_sequence_from_state", __pyx_clineno, __pyx_lineno, __pyx_filename); + __pyx_r = NULL; + __pyx_L0:; + __Pyx_XDECREF((PyObject *)__pyx_v_mem); + __Pyx_XDECREF(__pyx_v_history); + __Pyx_XDECREF(__pyx_v_debug_log); + __Pyx_XDECREF(__pyx_v_s0); + __Pyx_XDECREF(__pyx_v_b0); + __Pyx_XDECREF(__pyx_v_example); + __Pyx_XDECREF(__pyx_v_token); + __Pyx_XGIVEREF(__pyx_r); + __Pyx_RefNannyFinishContext(); + return __pyx_r; +} + +/* "spacy/pipeline/_parser_internals/transition_system.pyx":136 + * return history + * + * def apply_transition(self, StateClass state, name): # <<<<<<<<<<<<<< + * if not self.is_valid(state, name): + * raise ValueError(Errors.E170.format(name=name)) +*/ + +/* Python wrapper */ +static PyObject *__pyx_pw_5spacy_8pipeline_17_parser_internals_17transition_system_16TransitionSystem_11apply_transition(PyObject *__pyx_v_self, +#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_5spacy_8pipeline_17_parser_internals_17transition_system_16TransitionSystem_10apply_transition, "TransitionSystem.apply_transition(self, StateClass state, name)"); +static PyMethodDef __pyx_mdef_5spacy_8pipeline_17_parser_internals_17transition_system_16TransitionSystem_11apply_transition = {"apply_transition", (PyCFunction)(void(*)(void))(__Pyx_PyCFunction_FastCallWithKeywords)__pyx_pw_5spacy_8pipeline_17_parser_internals_17transition_system_16TransitionSystem_11apply_transition, __Pyx_METH_FASTCALL|METH_KEYWORDS, __pyx_doc_5spacy_8pipeline_17_parser_internals_17transition_system_16TransitionSystem_10apply_transition}; +static PyObject *__pyx_pw_5spacy_8pipeline_17_parser_internals_17transition_system_16TransitionSystem_11apply_transition(PyObject *__pyx_v_self, +#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_5spacy_8pipeline_17_parser_internals_10stateclass_StateClass *__pyx_v_state = 0; + PyObject *__pyx_v_name = 0; + #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("apply_transition (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_state,&__pyx_mstate_global->__pyx_n_u_name,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, 136, __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, 136, __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, 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, "apply_transition", 0) < (0)) __PYX_ERR(0, 136, __pyx_L3_error) + for (Py_ssize_t i = __pyx_nargs; i < 2; i++) { + if (unlikely(!values[i])) { __Pyx_RaiseArgtupleInvalid("apply_transition", 1, 2, 2, i); __PYX_ERR(0, 136, __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, 136, __pyx_L3_error) + values[1] = __Pyx_ArgRef_FASTCALL(__pyx_args, 1); + if (!CYTHON_ASSUME_SAFE_MACROS && unlikely(!values[1])) __PYX_ERR(0, 136, __pyx_L3_error) + } + __pyx_v_state = ((struct __pyx_obj_5spacy_8pipeline_17_parser_internals_10stateclass_StateClass *)values[0]); + __pyx_v_name = values[1]; + } + goto __pyx_L6_skip; + __pyx_L5_argtuple_error:; + __Pyx_RaiseArgtupleInvalid("apply_transition", 1, 2, 2, __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("spacy.pipeline._parser_internals.transition_system.TransitionSystem.apply_transition", __pyx_clineno, __pyx_lineno, __pyx_filename); + __Pyx_RefNannyFinishContext(); + return NULL; + __pyx_L4_argument_unpacking_done:; + if (unlikely(!__Pyx_ArgTypeTest(((PyObject *)__pyx_v_state), __pyx_mstate_global->__pyx_ptype_5spacy_8pipeline_17_parser_internals_10stateclass_StateClass, 1, "state", 0))) __PYX_ERR(0, 136, __pyx_L1_error) + __pyx_r = __pyx_pf_5spacy_8pipeline_17_parser_internals_17transition_system_16TransitionSystem_10apply_transition(((struct __pyx_obj_5spacy_8pipeline_17_parser_internals_17transition_system_TransitionSystem *)__pyx_v_self), __pyx_v_state, __pyx_v_name); + + /* 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_5spacy_8pipeline_17_parser_internals_17transition_system_16TransitionSystem_10apply_transition(struct __pyx_obj_5spacy_8pipeline_17_parser_internals_17transition_system_TransitionSystem *__pyx_v_self, struct __pyx_obj_5spacy_8pipeline_17_parser_internals_10stateclass_StateClass *__pyx_v_state, PyObject *__pyx_v_name) { + struct __pyx_t_5spacy_8pipeline_17_parser_internals_17transition_system_Transition __pyx_v_action; + 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_t_5; + PyObject *__pyx_t_6 = NULL; + PyObject *__pyx_t_7 = NULL; + PyObject *__pyx_t_8 = NULL; + PyObject *__pyx_t_9 = NULL; + struct __pyx_t_5spacy_8pipeline_17_parser_internals_17transition_system_Transition __pyx_t_10; + int __pyx_lineno = 0; + const char *__pyx_filename = NULL; + int __pyx_clineno = 0; + __Pyx_RefNannySetupContext("apply_transition", 0); + + /* "spacy/pipeline/_parser_internals/transition_system.pyx":137 + * + * def apply_transition(self, StateClass state, name): + * if not self.is_valid(state, name): # <<<<<<<<<<<<<< + * raise ValueError(Errors.E170.format(name=name)) + * action = self.lookup_transition(name) +*/ + __pyx_t_2 = ((PyObject *)__pyx_v_self); + __Pyx_INCREF(__pyx_t_2); + __pyx_t_3 = 0; + { + PyObject *__pyx_callargs[3] = {__pyx_t_2, ((PyObject *)__pyx_v_state), __pyx_v_name}; + __pyx_t_1 = __Pyx_PyObject_FastCallMethod((PyObject*)__pyx_mstate_global->__pyx_n_u_is_valid, __pyx_callargs+__pyx_t_3, (3-__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, 137, __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, 137, __pyx_L1_error) + __Pyx_DECREF(__pyx_t_1); __pyx_t_1 = 0; + __pyx_t_5 = (!__pyx_t_4); + if (unlikely(__pyx_t_5)) { + + /* "spacy/pipeline/_parser_internals/transition_system.pyx":138 + * def apply_transition(self, StateClass state, name): + * if not self.is_valid(state, name): + * raise ValueError(Errors.E170.format(name=name)) # <<<<<<<<<<<<<< + * action = self.lookup_transition(name) + * action.do(state.c, action.label) +*/ + __pyx_t_2 = NULL; + __Pyx_GetModuleGlobalName(__pyx_t_8, __pyx_mstate_global->__pyx_n_u_Errors); if (unlikely(!__pyx_t_8)) __PYX_ERR(0, 138, __pyx_L1_error) + __Pyx_GOTREF(__pyx_t_8); + __pyx_t_9 = __Pyx_PyObject_GetAttrStr(__pyx_t_8, __pyx_mstate_global->__pyx_n_u_E170); if (unlikely(!__pyx_t_9)) __PYX_ERR(0, 138, __pyx_L1_error) + __Pyx_GOTREF(__pyx_t_9); + __Pyx_DECREF(__pyx_t_8); __pyx_t_8 = 0; + __pyx_t_7 = __pyx_t_9; + __Pyx_INCREF(__pyx_t_7); + __pyx_t_3 = 0; + { + PyObject *__pyx_callargs[2 + ((CYTHON_VECTORCALL) ? 1 : 0)] = {__pyx_t_7, NULL}; + __pyx_t_8 = __Pyx_MakeVectorcallBuilderKwds(1); if (unlikely(!__pyx_t_8)) __PYX_ERR(0, 138, __pyx_L1_error) + __Pyx_GOTREF(__pyx_t_8); + if (__Pyx_VectorcallBuilder_AddArg(__pyx_mstate_global->__pyx_n_u_name, __pyx_v_name, __pyx_t_8, __pyx_callargs+1, 0) < (0)) __PYX_ERR(0, 138, __pyx_L1_error) + __pyx_t_6 = __Pyx_Object_VectorcallMethod_CallFromBuilder((PyObject*)__pyx_mstate_global->__pyx_n_u_format, __pyx_callargs+__pyx_t_3, (1-__pyx_t_3) | (1*__Pyx_PY_VECTORCALL_ARGUMENTS_OFFSET), __pyx_t_8); + __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; + if (unlikely(!__pyx_t_6)) __PYX_ERR(0, 138, __pyx_L1_error) + __Pyx_GOTREF(__pyx_t_6); + } + __pyx_t_3 = 1; + { + PyObject *__pyx_callargs[2] = {__pyx_t_2, __pyx_t_6}; + __pyx_t_1 = __Pyx_PyObject_FastCall((PyObject*)(((PyTypeObject*)PyExc_ValueError)), __pyx_callargs+__pyx_t_3, (2-__pyx_t_3) | (__pyx_t_3*__Pyx_PY_VECTORCALL_ARGUMENTS_OFFSET)); + __Pyx_XDECREF(__pyx_t_2); __pyx_t_2 = 0; + __Pyx_DECREF(__pyx_t_6); __pyx_t_6 = 0; + if (unlikely(!__pyx_t_1)) __PYX_ERR(0, 138, __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, 138, __pyx_L1_error) + + /* "spacy/pipeline/_parser_internals/transition_system.pyx":137 + * + * def apply_transition(self, StateClass state, name): + * if not self.is_valid(state, name): # <<<<<<<<<<<<<< + * raise ValueError(Errors.E170.format(name=name)) + * action = self.lookup_transition(name) +*/ + } + + /* "spacy/pipeline/_parser_internals/transition_system.pyx":139 + * if not self.is_valid(state, name): + * raise ValueError(Errors.E170.format(name=name)) + * action = self.lookup_transition(name) # <<<<<<<<<<<<<< + * action.do(state.c, action.label) + * +*/ + __pyx_t_10 = ((struct __pyx_vtabstruct_5spacy_8pipeline_17_parser_internals_17transition_system_TransitionSystem *)__pyx_v_self->__pyx_vtab)->lookup_transition(__pyx_v_self, __pyx_v_name); if (unlikely(PyErr_Occurred())) __PYX_ERR(0, 139, __pyx_L1_error) + __pyx_v_action = __pyx_t_10; + + /* "spacy/pipeline/_parser_internals/transition_system.pyx":140 + * raise ValueError(Errors.E170.format(name=name)) + * action = self.lookup_transition(name) + * action.do(state.c, action.label) # <<<<<<<<<<<<<< + * + * cdef Transition lookup_transition(self, object name) except *: +*/ + (void)(__pyx_v_action.__pyx_do(__pyx_v_state->c, __pyx_v_action.label)); + + /* "spacy/pipeline/_parser_internals/transition_system.pyx":136 + * return history + * + * def apply_transition(self, StateClass state, name): # <<<<<<<<<<<<<< + * if not self.is_valid(state, name): + * raise ValueError(Errors.E170.format(name=name)) +*/ + + /* 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_6); + __Pyx_XDECREF(__pyx_t_7); + __Pyx_XDECREF(__pyx_t_8); + __Pyx_XDECREF(__pyx_t_9); + __Pyx_AddTraceback("spacy.pipeline._parser_internals.transition_system.TransitionSystem.apply_transition", __pyx_clineno, __pyx_lineno, __pyx_filename); + __pyx_r = NULL; + __pyx_L0:; + __Pyx_XGIVEREF(__pyx_r); + __Pyx_RefNannyFinishContext(); + return __pyx_r; +} + +/* "spacy/pipeline/_parser_internals/transition_system.pyx":142 + * action.do(state.c, action.label) + * + * cdef Transition lookup_transition(self, object name) except *: # <<<<<<<<<<<<<< + * raise NotImplementedError + * +*/ + +static struct __pyx_t_5spacy_8pipeline_17_parser_internals_17transition_system_Transition __pyx_f_5spacy_8pipeline_17_parser_internals_17transition_system_16TransitionSystem_lookup_transition(CYTHON_UNUSED struct __pyx_obj_5spacy_8pipeline_17_parser_internals_17transition_system_TransitionSystem *__pyx_v_self, CYTHON_UNUSED PyObject *__pyx_v_name) { + struct __pyx_t_5spacy_8pipeline_17_parser_internals_17transition_system_Transition __pyx_r; + int __pyx_lineno = 0; + const char *__pyx_filename = NULL; + int __pyx_clineno = 0; + + /* "spacy/pipeline/_parser_internals/transition_system.pyx":143 + * + * cdef Transition lookup_transition(self, object name) except *: + * raise NotImplementedError # <<<<<<<<<<<<<< + * + * cdef Transition init_transition(self, int clas, int move, attr_t label) except *: +*/ + __Pyx_Raise(((PyObject *)(((PyTypeObject*)PyExc_NotImplementedError))), 0, 0, 0); + __PYX_ERR(0, 143, __pyx_L1_error) + + /* "spacy/pipeline/_parser_internals/transition_system.pyx":142 + * action.do(state.c, action.label) + * + * cdef Transition lookup_transition(self, object name) except *: # <<<<<<<<<<<<<< + * raise NotImplementedError + * +*/ + + /* function exit code */ + __pyx_L1_error:; + __Pyx_AddTraceback("spacy.pipeline._parser_internals.transition_system.TransitionSystem.lookup_transition", __pyx_clineno, __pyx_lineno, __pyx_filename); + __Pyx_pretend_to_initialize(&__pyx_r); + return __pyx_r; +} + +/* "spacy/pipeline/_parser_internals/transition_system.pyx":145 + * raise NotImplementedError + * + * cdef Transition init_transition(self, int clas, int move, attr_t label) except *: # <<<<<<<<<<<<<< + * raise NotImplementedError + * +*/ + +static struct __pyx_t_5spacy_8pipeline_17_parser_internals_17transition_system_Transition __pyx_f_5spacy_8pipeline_17_parser_internals_17transition_system_16TransitionSystem_init_transition(CYTHON_UNUSED struct __pyx_obj_5spacy_8pipeline_17_parser_internals_17transition_system_TransitionSystem *__pyx_v_self, CYTHON_UNUSED int __pyx_v_clas, CYTHON_UNUSED int __pyx_v_move, CYTHON_UNUSED __pyx_t_5spacy_8typedefs_attr_t __pyx_v_label) { + struct __pyx_t_5spacy_8pipeline_17_parser_internals_17transition_system_Transition __pyx_r; + int __pyx_lineno = 0; + const char *__pyx_filename = NULL; + int __pyx_clineno = 0; + + /* "spacy/pipeline/_parser_internals/transition_system.pyx":146 + * + * cdef Transition init_transition(self, int clas, int move, attr_t label) except *: + * raise NotImplementedError # <<<<<<<<<<<<<< + * + * def is_valid(self, StateClass stcls, move_name): +*/ + __Pyx_Raise(((PyObject *)(((PyTypeObject*)PyExc_NotImplementedError))), 0, 0, 0); + __PYX_ERR(0, 146, __pyx_L1_error) + + /* "spacy/pipeline/_parser_internals/transition_system.pyx":145 + * raise NotImplementedError + * + * cdef Transition init_transition(self, int clas, int move, attr_t label) except *: # <<<<<<<<<<<<<< + * raise NotImplementedError + * +*/ + + /* function exit code */ + __pyx_L1_error:; + __Pyx_AddTraceback("spacy.pipeline._parser_internals.transition_system.TransitionSystem.init_transition", __pyx_clineno, __pyx_lineno, __pyx_filename); + __Pyx_pretend_to_initialize(&__pyx_r); + return __pyx_r; +} + +/* "spacy/pipeline/_parser_internals/transition_system.pyx":148 + * raise NotImplementedError + * + * def is_valid(self, StateClass stcls, move_name): # <<<<<<<<<<<<<< + * action = self.lookup_transition(move_name) + * return action.is_valid(stcls.c, action.label) +*/ + +/* Python wrapper */ +static PyObject *__pyx_pw_5spacy_8pipeline_17_parser_internals_17transition_system_16TransitionSystem_13is_valid(PyObject *__pyx_v_self, +#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_5spacy_8pipeline_17_parser_internals_17transition_system_16TransitionSystem_12is_valid, "TransitionSystem.is_valid(self, StateClass stcls, move_name)"); +static PyMethodDef __pyx_mdef_5spacy_8pipeline_17_parser_internals_17transition_system_16TransitionSystem_13is_valid = {"is_valid", (PyCFunction)(void(*)(void))(__Pyx_PyCFunction_FastCallWithKeywords)__pyx_pw_5spacy_8pipeline_17_parser_internals_17transition_system_16TransitionSystem_13is_valid, __Pyx_METH_FASTCALL|METH_KEYWORDS, __pyx_doc_5spacy_8pipeline_17_parser_internals_17transition_system_16TransitionSystem_12is_valid}; +static PyObject *__pyx_pw_5spacy_8pipeline_17_parser_internals_17transition_system_16TransitionSystem_13is_valid(PyObject *__pyx_v_self, +#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_5spacy_8pipeline_17_parser_internals_10stateclass_StateClass *__pyx_v_stcls = 0; + PyObject *__pyx_v_move_name = 0; + #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("is_valid (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_stcls,&__pyx_mstate_global->__pyx_n_u_move_name,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, 148, __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, 148, __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, 148, __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, "is_valid", 0) < (0)) __PYX_ERR(0, 148, __pyx_L3_error) + for (Py_ssize_t i = __pyx_nargs; i < 2; i++) { + if (unlikely(!values[i])) { __Pyx_RaiseArgtupleInvalid("is_valid", 1, 2, 2, i); __PYX_ERR(0, 148, __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, 148, __pyx_L3_error) + values[1] = __Pyx_ArgRef_FASTCALL(__pyx_args, 1); + if (!CYTHON_ASSUME_SAFE_MACROS && unlikely(!values[1])) __PYX_ERR(0, 148, __pyx_L3_error) + } + __pyx_v_stcls = ((struct __pyx_obj_5spacy_8pipeline_17_parser_internals_10stateclass_StateClass *)values[0]); + __pyx_v_move_name = values[1]; + } + goto __pyx_L6_skip; + __pyx_L5_argtuple_error:; + __Pyx_RaiseArgtupleInvalid("is_valid", 1, 2, 2, __pyx_nargs); __PYX_ERR(0, 148, __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("spacy.pipeline._parser_internals.transition_system.TransitionSystem.is_valid", __pyx_clineno, __pyx_lineno, __pyx_filename); + __Pyx_RefNannyFinishContext(); + return NULL; + __pyx_L4_argument_unpacking_done:; + if (unlikely(!__Pyx_ArgTypeTest(((PyObject *)__pyx_v_stcls), __pyx_mstate_global->__pyx_ptype_5spacy_8pipeline_17_parser_internals_10stateclass_StateClass, 1, "stcls", 0))) __PYX_ERR(0, 148, __pyx_L1_error) + __pyx_r = __pyx_pf_5spacy_8pipeline_17_parser_internals_17transition_system_16TransitionSystem_12is_valid(((struct __pyx_obj_5spacy_8pipeline_17_parser_internals_17transition_system_TransitionSystem *)__pyx_v_self), __pyx_v_stcls, __pyx_v_move_name); + + /* 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_5spacy_8pipeline_17_parser_internals_17transition_system_16TransitionSystem_12is_valid(struct __pyx_obj_5spacy_8pipeline_17_parser_internals_17transition_system_TransitionSystem *__pyx_v_self, struct __pyx_obj_5spacy_8pipeline_17_parser_internals_10stateclass_StateClass *__pyx_v_stcls, PyObject *__pyx_v_move_name) { + struct __pyx_t_5spacy_8pipeline_17_parser_internals_17transition_system_Transition __pyx_v_action; + PyObject *__pyx_r = NULL; + __Pyx_RefNannyDeclarations + struct __pyx_t_5spacy_8pipeline_17_parser_internals_17transition_system_Transition __pyx_t_1; + PyObject *__pyx_t_2 = NULL; + int __pyx_lineno = 0; + const char *__pyx_filename = NULL; + int __pyx_clineno = 0; + __Pyx_RefNannySetupContext("is_valid", 0); + + /* "spacy/pipeline/_parser_internals/transition_system.pyx":149 + * + * def is_valid(self, StateClass stcls, move_name): + * action = self.lookup_transition(move_name) # <<<<<<<<<<<<<< + * return action.is_valid(stcls.c, action.label) + * +*/ + __pyx_t_1 = ((struct __pyx_vtabstruct_5spacy_8pipeline_17_parser_internals_17transition_system_TransitionSystem *)__pyx_v_self->__pyx_vtab)->lookup_transition(__pyx_v_self, __pyx_v_move_name); if (unlikely(PyErr_Occurred())) __PYX_ERR(0, 149, __pyx_L1_error) + __pyx_v_action = __pyx_t_1; + + /* "spacy/pipeline/_parser_internals/transition_system.pyx":150 + * def is_valid(self, StateClass stcls, move_name): + * action = self.lookup_transition(move_name) + * return action.is_valid(stcls.c, action.label) # <<<<<<<<<<<<<< + * + * cdef int set_valid(self, int* is_valid, const StateC* st) noexcept nogil: +*/ + __Pyx_XDECREF(__pyx_r); + __pyx_t_2 = __Pyx_PyBool_FromLong(__pyx_v_action.is_valid(__pyx_v_stcls->c, __pyx_v_action.label)); if (unlikely(!__pyx_t_2)) __PYX_ERR(0, 150, __pyx_L1_error) + __Pyx_GOTREF(__pyx_t_2); + __pyx_r = __pyx_t_2; + __pyx_t_2 = 0; + goto __pyx_L0; + + /* "spacy/pipeline/_parser_internals/transition_system.pyx":148 + * raise NotImplementedError + * + * def is_valid(self, StateClass stcls, move_name): # <<<<<<<<<<<<<< + * action = self.lookup_transition(move_name) + * return action.is_valid(stcls.c, action.label) +*/ + + /* function exit code */ + __pyx_L1_error:; + __Pyx_XDECREF(__pyx_t_2); + __Pyx_AddTraceback("spacy.pipeline._parser_internals.transition_system.TransitionSystem.is_valid", __pyx_clineno, __pyx_lineno, __pyx_filename); + __pyx_r = NULL; + __pyx_L0:; + __Pyx_XGIVEREF(__pyx_r); + __Pyx_RefNannyFinishContext(); + return __pyx_r; +} + +/* "spacy/pipeline/_parser_internals/transition_system.pyx":152 + * return action.is_valid(stcls.c, action.label) + * + * cdef int set_valid(self, int* is_valid, const StateC* st) noexcept nogil: # <<<<<<<<<<<<<< + * cdef int i + * for i in range(self.n_moves): +*/ + +static int __pyx_f_5spacy_8pipeline_17_parser_internals_17transition_system_16TransitionSystem_set_valid(struct __pyx_obj_5spacy_8pipeline_17_parser_internals_17transition_system_TransitionSystem *__pyx_v_self, int *__pyx_v_is_valid, __pyx_t_5spacy_8pipeline_17_parser_internals_6_state_StateC const *__pyx_v_st) { + int __pyx_v_i; + int __pyx_r; + int __pyx_t_1; + int __pyx_t_2; + int __pyx_t_3; + + /* "spacy/pipeline/_parser_internals/transition_system.pyx":154 + * cdef int set_valid(self, int* is_valid, const StateC* st) noexcept nogil: + * cdef int i + * for i in range(self.n_moves): # <<<<<<<<<<<<<< + * is_valid[i] = self.c[i].is_valid(st, self.c[i].label) + * +*/ + __pyx_t_1 = __pyx_v_self->n_moves; + __pyx_t_2 = __pyx_t_1; + for (__pyx_t_3 = 0; __pyx_t_3 < __pyx_t_2; __pyx_t_3+=1) { + __pyx_v_i = __pyx_t_3; + + /* "spacy/pipeline/_parser_internals/transition_system.pyx":155 + * cdef int i + * for i in range(self.n_moves): + * is_valid[i] = self.c[i].is_valid(st, self.c[i].label) # <<<<<<<<<<<<<< + * + * cdef int set_costs(self, int* is_valid, weight_t* costs, +*/ + (__pyx_v_is_valid[__pyx_v_i]) = (__pyx_v_self->c[__pyx_v_i]).is_valid(__pyx_v_st, (__pyx_v_self->c[__pyx_v_i]).label); + } + + /* "spacy/pipeline/_parser_internals/transition_system.pyx":152 + * return action.is_valid(stcls.c, action.label) + * + * cdef int set_valid(self, int* is_valid, const StateC* st) noexcept nogil: # <<<<<<<<<<<<<< + * cdef int i + * for i in range(self.n_moves): +*/ + + /* function exit code */ + __pyx_r = 0; + return __pyx_r; +} + +/* "spacy/pipeline/_parser_internals/transition_system.pyx":157 + * is_valid[i] = self.c[i].is_valid(st, self.c[i].label) + * + * cdef int set_costs(self, int* is_valid, weight_t* costs, # <<<<<<<<<<<<<< + * const StateC* state, gold) except -1: + * raise NotImplementedError +*/ + +static int __pyx_f_5spacy_8pipeline_17_parser_internals_17transition_system_16TransitionSystem_set_costs(CYTHON_UNUSED struct __pyx_obj_5spacy_8pipeline_17_parser_internals_17transition_system_TransitionSystem *__pyx_v_self, CYTHON_UNUSED int *__pyx_v_is_valid, CYTHON_UNUSED __pyx_t_5spacy_8typedefs_weight_t *__pyx_v_costs, CYTHON_UNUSED __pyx_t_5spacy_8pipeline_17_parser_internals_6_state_StateC const *__pyx_v_state, CYTHON_UNUSED PyObject *__pyx_v_gold) { + int __pyx_r; + int __pyx_lineno = 0; + const char *__pyx_filename = NULL; + int __pyx_clineno = 0; + + /* "spacy/pipeline/_parser_internals/transition_system.pyx":159 + * cdef int set_costs(self, int* is_valid, weight_t* costs, + * const StateC* state, gold) except -1: + * raise NotImplementedError # <<<<<<<<<<<<<< + * + * def get_class_name(self, int clas): +*/ + __Pyx_Raise(((PyObject *)(((PyTypeObject*)PyExc_NotImplementedError))), 0, 0, 0); + __PYX_ERR(0, 159, __pyx_L1_error) + + /* "spacy/pipeline/_parser_internals/transition_system.pyx":157 + * is_valid[i] = self.c[i].is_valid(st, self.c[i].label) + * + * cdef int set_costs(self, int* is_valid, weight_t* costs, # <<<<<<<<<<<<<< + * const StateC* state, gold) except -1: + * raise NotImplementedError +*/ + + /* function exit code */ + __pyx_L1_error:; + __Pyx_AddTraceback("spacy.pipeline._parser_internals.transition_system.TransitionSystem.set_costs", __pyx_clineno, __pyx_lineno, __pyx_filename); + __pyx_r = -1; + return __pyx_r; +} + +/* "spacy/pipeline/_parser_internals/transition_system.pyx":161 + * raise NotImplementedError + * + * def get_class_name(self, int clas): # <<<<<<<<<<<<<< + * act = self.c[clas] + * return self.move_name(act.move, act.label) +*/ + +/* Python wrapper */ +static PyObject *__pyx_pw_5spacy_8pipeline_17_parser_internals_17transition_system_16TransitionSystem_15get_class_name(PyObject *__pyx_v_self, +#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_5spacy_8pipeline_17_parser_internals_17transition_system_16TransitionSystem_14get_class_name, "TransitionSystem.get_class_name(self, int clas)"); +static PyMethodDef __pyx_mdef_5spacy_8pipeline_17_parser_internals_17transition_system_16TransitionSystem_15get_class_name = {"get_class_name", (PyCFunction)(void(*)(void))(__Pyx_PyCFunction_FastCallWithKeywords)__pyx_pw_5spacy_8pipeline_17_parser_internals_17transition_system_16TransitionSystem_15get_class_name, __Pyx_METH_FASTCALL|METH_KEYWORDS, __pyx_doc_5spacy_8pipeline_17_parser_internals_17transition_system_16TransitionSystem_14get_class_name}; +static PyObject *__pyx_pw_5spacy_8pipeline_17_parser_internals_17transition_system_16TransitionSystem_15get_class_name(PyObject *__pyx_v_self, +#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_clas; + #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("get_class_name (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_clas,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, 161, __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, 161, __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, "get_class_name", 0) < (0)) __PYX_ERR(0, 161, __pyx_L3_error) + for (Py_ssize_t i = __pyx_nargs; i < 1; i++) { + if (unlikely(!values[i])) { __Pyx_RaiseArgtupleInvalid("get_class_name", 1, 1, 1, i); __PYX_ERR(0, 161, __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, 161, __pyx_L3_error) + } + __pyx_v_clas = __Pyx_PyLong_As_int(values[0]); if (unlikely((__pyx_v_clas == (int)-1) && PyErr_Occurred())) __PYX_ERR(0, 161, __pyx_L3_error) + } + goto __pyx_L6_skip; + __pyx_L5_argtuple_error:; + __Pyx_RaiseArgtupleInvalid("get_class_name", 1, 1, 1, __pyx_nargs); __PYX_ERR(0, 161, __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("spacy.pipeline._parser_internals.transition_system.TransitionSystem.get_class_name", __pyx_clineno, __pyx_lineno, __pyx_filename); + __Pyx_RefNannyFinishContext(); + return NULL; + __pyx_L4_argument_unpacking_done:; + __pyx_r = __pyx_pf_5spacy_8pipeline_17_parser_internals_17transition_system_16TransitionSystem_14get_class_name(((struct __pyx_obj_5spacy_8pipeline_17_parser_internals_17transition_system_TransitionSystem *)__pyx_v_self), __pyx_v_clas); + + /* 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_5spacy_8pipeline_17_parser_internals_17transition_system_16TransitionSystem_14get_class_name(struct __pyx_obj_5spacy_8pipeline_17_parser_internals_17transition_system_TransitionSystem *__pyx_v_self, int __pyx_v_clas) { + struct __pyx_t_5spacy_8pipeline_17_parser_internals_17transition_system_Transition __pyx_v_act; + PyObject *__pyx_r = NULL; + __Pyx_RefNannyDeclarations + PyObject *__pyx_t_1 = NULL; + PyObject *__pyx_t_2 = NULL; + PyObject *__pyx_t_3 = NULL; + PyObject *__pyx_t_4 = NULL; + size_t __pyx_t_5; + int __pyx_lineno = 0; + const char *__pyx_filename = NULL; + int __pyx_clineno = 0; + __Pyx_RefNannySetupContext("get_class_name", 0); + + /* "spacy/pipeline/_parser_internals/transition_system.pyx":162 + * + * def get_class_name(self, int clas): + * act = self.c[clas] # <<<<<<<<<<<<<< + * return self.move_name(act.move, act.label) + * +*/ + __pyx_v_act = (__pyx_v_self->c[__pyx_v_clas]); + + /* "spacy/pipeline/_parser_internals/transition_system.pyx":163 + * def get_class_name(self, int clas): + * act = self.c[clas] + * return self.move_name(act.move, act.label) # <<<<<<<<<<<<<< + * + * def initialize_actions(self, labels_by_action, min_freq=None): +*/ + __Pyx_XDECREF(__pyx_r); + __pyx_t_2 = ((PyObject *)__pyx_v_self); + __Pyx_INCREF(__pyx_t_2); + __pyx_t_3 = __Pyx_PyLong_From_int(__pyx_v_act.move); if (unlikely(!__pyx_t_3)) __PYX_ERR(0, 163, __pyx_L1_error) + __Pyx_GOTREF(__pyx_t_3); + __pyx_t_4 = __Pyx_PyLong_From_uint64_t(__pyx_v_act.label); if (unlikely(!__pyx_t_4)) __PYX_ERR(0, 163, __pyx_L1_error) + __Pyx_GOTREF(__pyx_t_4); + __pyx_t_5 = 0; + { + PyObject *__pyx_callargs[3] = {__pyx_t_2, __pyx_t_3, __pyx_t_4}; + __pyx_t_1 = __Pyx_PyObject_FastCallMethod((PyObject*)__pyx_mstate_global->__pyx_n_u_move_name, __pyx_callargs+__pyx_t_5, (3-__pyx_t_5) | (1*__Pyx_PY_VECTORCALL_ARGUMENTS_OFFSET)); + __Pyx_XDECREF(__pyx_t_2); __pyx_t_2 = 0; + __Pyx_DECREF(__pyx_t_3); __pyx_t_3 = 0; + __Pyx_DECREF(__pyx_t_4); __pyx_t_4 = 0; + if (unlikely(!__pyx_t_1)) __PYX_ERR(0, 163, __pyx_L1_error) + __Pyx_GOTREF(__pyx_t_1); + } + __pyx_r = __pyx_t_1; + __pyx_t_1 = 0; + goto __pyx_L0; + + /* "spacy/pipeline/_parser_internals/transition_system.pyx":161 + * raise NotImplementedError + * + * def get_class_name(self, int clas): # <<<<<<<<<<<<<< + * act = self.c[clas] + * return self.move_name(act.move, act.label) +*/ + + /* function exit code */ + __pyx_L1_error:; + __Pyx_XDECREF(__pyx_t_1); + __Pyx_XDECREF(__pyx_t_2); + __Pyx_XDECREF(__pyx_t_3); + __Pyx_XDECREF(__pyx_t_4); + __Pyx_AddTraceback("spacy.pipeline._parser_internals.transition_system.TransitionSystem.get_class_name", __pyx_clineno, __pyx_lineno, __pyx_filename); + __pyx_r = NULL; + __pyx_L0:; + __Pyx_XGIVEREF(__pyx_r); + __Pyx_RefNannyFinishContext(); + return __pyx_r; +} + +/* "spacy/pipeline/_parser_internals/transition_system.pyx":165 + * return self.move_name(act.move, act.label) + * + * def initialize_actions(self, labels_by_action, min_freq=None): # <<<<<<<<<<<<<< + * self.labels = {} + * self.n_moves = 0 +*/ + +/* Python wrapper */ +static PyObject *__pyx_pw_5spacy_8pipeline_17_parser_internals_17transition_system_16TransitionSystem_17initialize_actions(PyObject *__pyx_v_self, +#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_5spacy_8pipeline_17_parser_internals_17transition_system_16TransitionSystem_16initialize_actions, "TransitionSystem.initialize_actions(self, labels_by_action, min_freq=None)"); +static PyMethodDef __pyx_mdef_5spacy_8pipeline_17_parser_internals_17transition_system_16TransitionSystem_17initialize_actions = {"initialize_actions", (PyCFunction)(void(*)(void))(__Pyx_PyCFunction_FastCallWithKeywords)__pyx_pw_5spacy_8pipeline_17_parser_internals_17transition_system_16TransitionSystem_17initialize_actions, __Pyx_METH_FASTCALL|METH_KEYWORDS, __pyx_doc_5spacy_8pipeline_17_parser_internals_17transition_system_16TransitionSystem_16initialize_actions}; +static PyObject *__pyx_pw_5spacy_8pipeline_17_parser_internals_17transition_system_16TransitionSystem_17initialize_actions(PyObject *__pyx_v_self, +#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_labels_by_action = 0; + CYTHON_UNUSED PyObject *__pyx_v_min_freq = 0; + #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("initialize_actions (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_labels_by_action,&__pyx_mstate_global->__pyx_n_u_min_freq,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, 165, __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, 165, __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, 165, __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, "initialize_actions", 0) < (0)) __PYX_ERR(0, 165, __pyx_L3_error) + if (!values[1]) values[1] = __Pyx_NewRef(((PyObject *)Py_None)); + for (Py_ssize_t i = __pyx_nargs; i < 1; i++) { + if (unlikely(!values[i])) { __Pyx_RaiseArgtupleInvalid("initialize_actions", 0, 1, 2, i); __PYX_ERR(0, 165, __pyx_L3_error) } + } + } else { + switch (__pyx_nargs) { + case 2: + values[1] = __Pyx_ArgRef_FASTCALL(__pyx_args, 1); + if (!CYTHON_ASSUME_SAFE_MACROS && unlikely(!values[1])) __PYX_ERR(0, 165, __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, 165, __pyx_L3_error) + break; + default: goto __pyx_L5_argtuple_error; + } + if (!values[1]) values[1] = __Pyx_NewRef(((PyObject *)Py_None)); + } + __pyx_v_labels_by_action = values[0]; + __pyx_v_min_freq = values[1]; + } + goto __pyx_L6_skip; + __pyx_L5_argtuple_error:; + __Pyx_RaiseArgtupleInvalid("initialize_actions", 0, 1, 2, __pyx_nargs); __PYX_ERR(0, 165, __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("spacy.pipeline._parser_internals.transition_system.TransitionSystem.initialize_actions", __pyx_clineno, __pyx_lineno, __pyx_filename); + __Pyx_RefNannyFinishContext(); + return NULL; + __pyx_L4_argument_unpacking_done:; + __pyx_r = __pyx_pf_5spacy_8pipeline_17_parser_internals_17transition_system_16TransitionSystem_16initialize_actions(((struct __pyx_obj_5spacy_8pipeline_17_parser_internals_17transition_system_TransitionSystem *)__pyx_v_self), __pyx_v_labels_by_action, __pyx_v_min_freq); + + /* 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_5spacy_8pipeline_17_parser_internals_17transition_system_16TransitionSystem_16initialize_actions(struct __pyx_obj_5spacy_8pipeline_17_parser_internals_17transition_system_TransitionSystem *__pyx_v_self, PyObject *__pyx_v_labels_by_action, CYTHON_UNUSED PyObject *__pyx_v_min_freq) { + PyObject *__pyx_v_added_labels = NULL; + PyObject *__pyx_v_added_actions = NULL; + PyObject *__pyx_v_action = NULL; + PyObject *__pyx_v_label_freqs = NULL; + PyObject *__pyx_v_sorted_labels = NULL; + PyObject *__pyx_v_freq = NULL; + PyObject *__pyx_v_label_str = NULL; + PyObject *__pyx_v_L = NULL; + PyObject *__pyx_v_f = NULL; + PyObject *__pyx_r = NULL; + __Pyx_RefNannyDeclarations + PyObject *__pyx_t_1 = NULL; + PyObject *__pyx_t_2 = NULL; + size_t __pyx_t_3; + Py_ssize_t __pyx_t_4; + PyObject *__pyx_t_5 = NULL; + PyObject *__pyx_t_6 = NULL; + PyObject *__pyx_t_7 = NULL; + PyObject *(*__pyx_t_8)(PyObject *); + Py_ssize_t __pyx_t_9; + PyObject *(*__pyx_t_10)(PyObject *); + PyObject *__pyx_t_11 = NULL; + PyObject *__pyx_t_12 = NULL; + int __pyx_t_13; + int __pyx_t_14; + int __pyx_lineno = 0; + const char *__pyx_filename = NULL; + int __pyx_clineno = 0; + __Pyx_RefNannySetupContext("initialize_actions", 0); + + /* "spacy/pipeline/_parser_internals/transition_system.pyx":166 + * + * def initialize_actions(self, labels_by_action, min_freq=None): + * self.labels = {} # <<<<<<<<<<<<<< + * self.n_moves = 0 + * added_labels = [] +*/ + __pyx_t_1 = __Pyx_PyDict_NewPresized(0); if (unlikely(!__pyx_t_1)) __PYX_ERR(0, 166, __pyx_L1_error) + __Pyx_GOTREF(__pyx_t_1); + __Pyx_GIVEREF(__pyx_t_1); + __Pyx_GOTREF(__pyx_v_self->labels); + __Pyx_DECREF(__pyx_v_self->labels); + __pyx_v_self->labels = __pyx_t_1; + __pyx_t_1 = 0; + + /* "spacy/pipeline/_parser_internals/transition_system.pyx":167 + * def initialize_actions(self, labels_by_action, min_freq=None): + * self.labels = {} + * self.n_moves = 0 # <<<<<<<<<<<<<< + * added_labels = [] + * added_actions = {} +*/ + __pyx_v_self->n_moves = 0; + + /* "spacy/pipeline/_parser_internals/transition_system.pyx":168 + * self.labels = {} + * self.n_moves = 0 + * added_labels = [] # <<<<<<<<<<<<<< + * added_actions = {} + * for action, label_freqs in sorted(labels_by_action.items()): +*/ + __pyx_t_1 = PyList_New(0); if (unlikely(!__pyx_t_1)) __PYX_ERR(0, 168, __pyx_L1_error) + __Pyx_GOTREF(__pyx_t_1); + __pyx_v_added_labels = ((PyObject*)__pyx_t_1); + __pyx_t_1 = 0; + + /* "spacy/pipeline/_parser_internals/transition_system.pyx":169 + * self.n_moves = 0 + * added_labels = [] + * added_actions = {} # <<<<<<<<<<<<<< + * for action, label_freqs in sorted(labels_by_action.items()): + * action = int(action) +*/ + __pyx_t_1 = __Pyx_PyDict_NewPresized(0); if (unlikely(!__pyx_t_1)) __PYX_ERR(0, 169, __pyx_L1_error) + __Pyx_GOTREF(__pyx_t_1); + __pyx_v_added_actions = ((PyObject*)__pyx_t_1); + __pyx_t_1 = 0; + + /* "spacy/pipeline/_parser_internals/transition_system.pyx":170 + * added_labels = [] + * added_actions = {} + * for action, label_freqs in sorted(labels_by_action.items()): # <<<<<<<<<<<<<< + * action = int(action) + * # Make sure we take a copy here, and that we get a Counter +*/ + __pyx_t_2 = __pyx_v_labels_by_action; + __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_items, __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, 170, __pyx_L1_error) + __Pyx_GOTREF(__pyx_t_1); + } + __pyx_t_2 = PySequence_List(__pyx_t_1); if (unlikely(!__pyx_t_2)) __PYX_ERR(0, 170, __pyx_L1_error) + __Pyx_GOTREF(__pyx_t_2); + __Pyx_DECREF(__pyx_t_1); __pyx_t_1 = 0; + if (unlikely((PyList_Sort(__pyx_t_2) < 0))) __PYX_ERR(0, 170, __pyx_L1_error) + __pyx_t_1 = __pyx_t_2; __Pyx_INCREF(__pyx_t_1); + __pyx_t_4 = 0; + __Pyx_DECREF(__pyx_t_2); __pyx_t_2 = 0; + for (;;) { + { + Py_ssize_t __pyx_temp = __Pyx_PyList_GET_SIZE(__pyx_t_1); + #if !CYTHON_ASSUME_SAFE_SIZE + if (unlikely((__pyx_temp < 0))) __PYX_ERR(0, 170, __pyx_L1_error) + #endif + if (__pyx_t_4 >= __pyx_temp) break; + } + __pyx_t_2 = __Pyx_PyList_GetItemRefFast(__pyx_t_1, __pyx_t_4, __Pyx_ReferenceSharing_OwnStrongReference); + ++__pyx_t_4; + if (unlikely(!__pyx_t_2)) __PYX_ERR(0, 170, __pyx_L1_error) + __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, 170, __pyx_L1_error) + } + #if CYTHON_ASSUME_SAFE_MACROS && !CYTHON_AVOID_BORROWED_REFS + if (likely(PyTuple_CheckExact(sequence))) { + __pyx_t_5 = PyTuple_GET_ITEM(sequence, 0); + __Pyx_INCREF(__pyx_t_5); + __pyx_t_6 = PyTuple_GET_ITEM(sequence, 1); + __Pyx_INCREF(__pyx_t_6); + } else { + __pyx_t_5 = __Pyx_PyList_GetItemRefFast(sequence, 0, __Pyx_ReferenceSharing_SharedReference); + if (unlikely(!__pyx_t_5)) __PYX_ERR(0, 170, __pyx_L1_error) + __Pyx_XGOTREF(__pyx_t_5); + __pyx_t_6 = __Pyx_PyList_GetItemRefFast(sequence, 1, __Pyx_ReferenceSharing_SharedReference); + if (unlikely(!__pyx_t_6)) __PYX_ERR(0, 170, __pyx_L1_error) + __Pyx_XGOTREF(__pyx_t_6); + } + #else + __pyx_t_5 = __Pyx_PySequence_ITEM(sequence, 0); if (unlikely(!__pyx_t_5)) __PYX_ERR(0, 170, __pyx_L1_error) + __Pyx_GOTREF(__pyx_t_5); + __pyx_t_6 = __Pyx_PySequence_ITEM(sequence, 1); if (unlikely(!__pyx_t_6)) __PYX_ERR(0, 170, __pyx_L1_error) + __Pyx_GOTREF(__pyx_t_6); + #endif + __Pyx_DECREF(__pyx_t_2); __pyx_t_2 = 0; + } else { + Py_ssize_t index = -1; + __pyx_t_7 = PyObject_GetIter(__pyx_t_2); if (unlikely(!__pyx_t_7)) __PYX_ERR(0, 170, __pyx_L1_error) + __Pyx_GOTREF(__pyx_t_7); + __Pyx_DECREF(__pyx_t_2); __pyx_t_2 = 0; + __pyx_t_8 = (CYTHON_COMPILING_IN_LIMITED_API) ? PyIter_Next : __Pyx_PyObject_GetIterNextFunc(__pyx_t_7); + index = 0; __pyx_t_5 = __pyx_t_8(__pyx_t_7); if (unlikely(!__pyx_t_5)) goto __pyx_L5_unpacking_failed; + __Pyx_GOTREF(__pyx_t_5); + index = 1; __pyx_t_6 = __pyx_t_8(__pyx_t_7); if (unlikely(!__pyx_t_6)) goto __pyx_L5_unpacking_failed; + __Pyx_GOTREF(__pyx_t_6); + if (__Pyx_IternextUnpackEndCheck(__pyx_t_8(__pyx_t_7), 2) < (0)) __PYX_ERR(0, 170, __pyx_L1_error) + __pyx_t_8 = NULL; + __Pyx_DECREF(__pyx_t_7); __pyx_t_7 = 0; + goto __pyx_L6_unpacking_done; + __pyx_L5_unpacking_failed:; + __Pyx_DECREF(__pyx_t_7); __pyx_t_7 = 0; + __pyx_t_8 = NULL; + if (__Pyx_IterFinish() == 0) __Pyx_RaiseNeedMoreValuesError(index); + __PYX_ERR(0, 170, __pyx_L1_error) + __pyx_L6_unpacking_done:; + } + __Pyx_XDECREF_SET(__pyx_v_action, __pyx_t_5); + __pyx_t_5 = 0; + __Pyx_XDECREF_SET(__pyx_v_label_freqs, __pyx_t_6); + __pyx_t_6 = 0; + + /* "spacy/pipeline/_parser_internals/transition_system.pyx":171 + * added_actions = {} + * for action, label_freqs in sorted(labels_by_action.items()): + * action = int(action) # <<<<<<<<<<<<<< + * # Make sure we take a copy here, and that we get a Counter + * self.labels[action] = Counter() +*/ + __pyx_t_2 = __Pyx_PyNumber_Int(__pyx_v_action); if (unlikely(!__pyx_t_2)) __PYX_ERR(0, 171, __pyx_L1_error) + __Pyx_GOTREF(__pyx_t_2); + __Pyx_DECREF_SET(__pyx_v_action, __pyx_t_2); + __pyx_t_2 = 0; + + /* "spacy/pipeline/_parser_internals/transition_system.pyx":173 + * action = int(action) + * # Make sure we take a copy here, and that we get a Counter + * self.labels[action] = Counter() # <<<<<<<<<<<<<< + * # Have to be careful here: Sorting must be stable, or our model + * # won't be read back in correctly. +*/ + __pyx_t_6 = NULL; + __Pyx_GetModuleGlobalName(__pyx_t_5, __pyx_mstate_global->__pyx_n_u_Counter); if (unlikely(!__pyx_t_5)) __PYX_ERR(0, 173, __pyx_L1_error) + __Pyx_GOTREF(__pyx_t_5); + __pyx_t_3 = 1; + #if CYTHON_UNPACK_METHODS + if (unlikely(PyMethod_Check(__pyx_t_5))) { + __pyx_t_6 = PyMethod_GET_SELF(__pyx_t_5); + assert(__pyx_t_6); + PyObject* __pyx__function = PyMethod_GET_FUNCTION(__pyx_t_5); + __Pyx_INCREF(__pyx_t_6); + __Pyx_INCREF(__pyx__function); + __Pyx_DECREF_SET(__pyx_t_5, __pyx__function); + __pyx_t_3 = 0; + } + #endif + { + PyObject *__pyx_callargs[2] = {__pyx_t_6, NULL}; + __pyx_t_2 = __Pyx_PyObject_FastCall((PyObject*)__pyx_t_5, __pyx_callargs+__pyx_t_3, (1-__pyx_t_3) | (__pyx_t_3*__Pyx_PY_VECTORCALL_ARGUMENTS_OFFSET)); + __Pyx_XDECREF(__pyx_t_6); __pyx_t_6 = 0; + __Pyx_DECREF(__pyx_t_5); __pyx_t_5 = 0; + if (unlikely(!__pyx_t_2)) __PYX_ERR(0, 173, __pyx_L1_error) + __Pyx_GOTREF(__pyx_t_2); + } + if (unlikely((PyObject_SetItem(__pyx_v_self->labels, __pyx_v_action, __pyx_t_2) < 0))) __PYX_ERR(0, 173, __pyx_L1_error) + __Pyx_DECREF(__pyx_t_2); __pyx_t_2 = 0; + + /* "spacy/pipeline/_parser_internals/transition_system.pyx":176 + * # Have to be careful here: Sorting must be stable, or our model + * # won't be read back in correctly. + * sorted_labels = [(f, L) for L, f in label_freqs.items()] # <<<<<<<<<<<<<< + * sorted_labels.sort() + * sorted_labels.reverse() +*/ + __pyx_t_2 = PyList_New(0); if (unlikely(!__pyx_t_2)) __PYX_ERR(0, 176, __pyx_L1_error) + __Pyx_GOTREF(__pyx_t_2); + __pyx_t_6 = __pyx_v_label_freqs; + __Pyx_INCREF(__pyx_t_6); + __pyx_t_3 = 0; + { + PyObject *__pyx_callargs[2] = {__pyx_t_6, NULL}; + __pyx_t_5 = __Pyx_PyObject_FastCallMethod((PyObject*)__pyx_mstate_global->__pyx_n_u_items, __pyx_callargs+__pyx_t_3, (1-__pyx_t_3) | (1*__Pyx_PY_VECTORCALL_ARGUMENTS_OFFSET)); + __Pyx_XDECREF(__pyx_t_6); __pyx_t_6 = 0; + if (unlikely(!__pyx_t_5)) __PYX_ERR(0, 176, __pyx_L1_error) + __Pyx_GOTREF(__pyx_t_5); + } + if (likely(PyList_CheckExact(__pyx_t_5)) || PyTuple_CheckExact(__pyx_t_5)) { + __pyx_t_6 = __pyx_t_5; __Pyx_INCREF(__pyx_t_6); + __pyx_t_9 = 0; + __pyx_t_10 = NULL; + } else { + __pyx_t_9 = -1; __pyx_t_6 = PyObject_GetIter(__pyx_t_5); if (unlikely(!__pyx_t_6)) __PYX_ERR(0, 176, __pyx_L1_error) + __Pyx_GOTREF(__pyx_t_6); + __pyx_t_10 = (CYTHON_COMPILING_IN_LIMITED_API) ? PyIter_Next : __Pyx_PyObject_GetIterNextFunc(__pyx_t_6); if (unlikely(!__pyx_t_10)) __PYX_ERR(0, 176, __pyx_L1_error) + } + __Pyx_DECREF(__pyx_t_5); __pyx_t_5 = 0; + for (;;) { + if (likely(!__pyx_t_10)) { + if (likely(PyList_CheckExact(__pyx_t_6))) { + { + Py_ssize_t __pyx_temp = __Pyx_PyList_GET_SIZE(__pyx_t_6); + #if !CYTHON_ASSUME_SAFE_SIZE + if (unlikely((__pyx_temp < 0))) __PYX_ERR(0, 176, __pyx_L1_error) + #endif + if (__pyx_t_9 >= __pyx_temp) break; + } + __pyx_t_5 = __Pyx_PyList_GetItemRefFast(__pyx_t_6, __pyx_t_9, __Pyx_ReferenceSharing_OwnStrongReference); + ++__pyx_t_9; + } else { + { + Py_ssize_t __pyx_temp = __Pyx_PyTuple_GET_SIZE(__pyx_t_6); + #if !CYTHON_ASSUME_SAFE_SIZE + if (unlikely((__pyx_temp < 0))) __PYX_ERR(0, 176, __pyx_L1_error) + #endif + if (__pyx_t_9 >= __pyx_temp) break; + } + #if CYTHON_ASSUME_SAFE_MACROS && !CYTHON_AVOID_BORROWED_REFS + __pyx_t_5 = __Pyx_NewRef(PyTuple_GET_ITEM(__pyx_t_6, __pyx_t_9)); + #else + __pyx_t_5 = __Pyx_PySequence_ITEM(__pyx_t_6, __pyx_t_9); + #endif + ++__pyx_t_9; + } + if (unlikely(!__pyx_t_5)) __PYX_ERR(0, 176, __pyx_L1_error) + } else { + __pyx_t_5 = __pyx_t_10(__pyx_t_6); + if (unlikely(!__pyx_t_5)) { + PyObject* exc_type = PyErr_Occurred(); + if (exc_type) { + if (unlikely(!__Pyx_PyErr_GivenExceptionMatches(exc_type, PyExc_StopIteration))) __PYX_ERR(0, 176, __pyx_L1_error) + PyErr_Clear(); + } + break; + } + } + __Pyx_GOTREF(__pyx_t_5); + if ((likely(PyTuple_CheckExact(__pyx_t_5))) || (PyList_CheckExact(__pyx_t_5))) { + PyObject* sequence = __pyx_t_5; + 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, 176, __pyx_L1_error) + } + #if CYTHON_ASSUME_SAFE_MACROS && !CYTHON_AVOID_BORROWED_REFS + if (likely(PyTuple_CheckExact(sequence))) { + __pyx_t_7 = PyTuple_GET_ITEM(sequence, 0); + __Pyx_INCREF(__pyx_t_7); + __pyx_t_11 = PyTuple_GET_ITEM(sequence, 1); + __Pyx_INCREF(__pyx_t_11); + } else { + __pyx_t_7 = __Pyx_PyList_GetItemRefFast(sequence, 0, __Pyx_ReferenceSharing_SharedReference); + if (unlikely(!__pyx_t_7)) __PYX_ERR(0, 176, __pyx_L1_error) + __Pyx_XGOTREF(__pyx_t_7); + __pyx_t_11 = __Pyx_PyList_GetItemRefFast(sequence, 1, __Pyx_ReferenceSharing_SharedReference); + if (unlikely(!__pyx_t_11)) __PYX_ERR(0, 176, __pyx_L1_error) + __Pyx_XGOTREF(__pyx_t_11); + } + #else + __pyx_t_7 = __Pyx_PySequence_ITEM(sequence, 0); if (unlikely(!__pyx_t_7)) __PYX_ERR(0, 176, __pyx_L1_error) + __Pyx_GOTREF(__pyx_t_7); + __pyx_t_11 = __Pyx_PySequence_ITEM(sequence, 1); if (unlikely(!__pyx_t_11)) __PYX_ERR(0, 176, __pyx_L1_error) + __Pyx_GOTREF(__pyx_t_11); + #endif + __Pyx_DECREF(__pyx_t_5); __pyx_t_5 = 0; + } else { + Py_ssize_t index = -1; + __pyx_t_12 = PyObject_GetIter(__pyx_t_5); if (unlikely(!__pyx_t_12)) __PYX_ERR(0, 176, __pyx_L1_error) + __Pyx_GOTREF(__pyx_t_12); + __Pyx_DECREF(__pyx_t_5); __pyx_t_5 = 0; + __pyx_t_8 = (CYTHON_COMPILING_IN_LIMITED_API) ? PyIter_Next : __Pyx_PyObject_GetIterNextFunc(__pyx_t_12); + index = 0; __pyx_t_7 = __pyx_t_8(__pyx_t_12); if (unlikely(!__pyx_t_7)) goto __pyx_L9_unpacking_failed; + __Pyx_GOTREF(__pyx_t_7); + index = 1; __pyx_t_11 = __pyx_t_8(__pyx_t_12); if (unlikely(!__pyx_t_11)) goto __pyx_L9_unpacking_failed; + __Pyx_GOTREF(__pyx_t_11); + if (__Pyx_IternextUnpackEndCheck(__pyx_t_8(__pyx_t_12), 2) < (0)) __PYX_ERR(0, 176, __pyx_L1_error) + __pyx_t_8 = NULL; + __Pyx_DECREF(__pyx_t_12); __pyx_t_12 = 0; + goto __pyx_L10_unpacking_done; + __pyx_L9_unpacking_failed:; + __Pyx_DECREF(__pyx_t_12); __pyx_t_12 = 0; + __pyx_t_8 = NULL; + if (__Pyx_IterFinish() == 0) __Pyx_RaiseNeedMoreValuesError(index); + __PYX_ERR(0, 176, __pyx_L1_error) + __pyx_L10_unpacking_done:; + } + __Pyx_XDECREF_SET(__pyx_v_L, __pyx_t_7); + __pyx_t_7 = 0; + __Pyx_XDECREF_SET(__pyx_v_f, __pyx_t_11); + __pyx_t_11 = 0; + __pyx_t_5 = PyTuple_New(2); if (unlikely(!__pyx_t_5)) __PYX_ERR(0, 176, __pyx_L1_error) + __Pyx_GOTREF(__pyx_t_5); + __Pyx_INCREF(__pyx_v_f); + __Pyx_GIVEREF(__pyx_v_f); + if (__Pyx_PyTuple_SET_ITEM(__pyx_t_5, 0, __pyx_v_f) != (0)) __PYX_ERR(0, 176, __pyx_L1_error); + __Pyx_INCREF(__pyx_v_L); + __Pyx_GIVEREF(__pyx_v_L); + if (__Pyx_PyTuple_SET_ITEM(__pyx_t_5, 1, __pyx_v_L) != (0)) __PYX_ERR(0, 176, __pyx_L1_error); + if (unlikely(__Pyx_ListComp_Append(__pyx_t_2, (PyObject*)__pyx_t_5))) __PYX_ERR(0, 176, __pyx_L1_error) + __Pyx_DECREF(__pyx_t_5); __pyx_t_5 = 0; + } + __Pyx_DECREF(__pyx_t_6); __pyx_t_6 = 0; + __Pyx_XDECREF_SET(__pyx_v_sorted_labels, ((PyObject*)__pyx_t_2)); + __pyx_t_2 = 0; + + /* "spacy/pipeline/_parser_internals/transition_system.pyx":177 + * # won't be read back in correctly. + * sorted_labels = [(f, L) for L, f in label_freqs.items()] + * sorted_labels.sort() # <<<<<<<<<<<<<< + * sorted_labels.reverse() + * for freq, label_str in sorted_labels: +*/ + __pyx_t_13 = PyList_Sort(__pyx_v_sorted_labels); if (unlikely(__pyx_t_13 == ((int)-1))) __PYX_ERR(0, 177, __pyx_L1_error) + + /* "spacy/pipeline/_parser_internals/transition_system.pyx":178 + * sorted_labels = [(f, L) for L, f in label_freqs.items()] + * sorted_labels.sort() + * sorted_labels.reverse() # <<<<<<<<<<<<<< + * for freq, label_str in sorted_labels: + * if freq < 0: +*/ + __pyx_t_13 = PyList_Reverse(__pyx_v_sorted_labels); if (unlikely(__pyx_t_13 == ((int)-1))) __PYX_ERR(0, 178, __pyx_L1_error) + + /* "spacy/pipeline/_parser_internals/transition_system.pyx":179 + * sorted_labels.sort() + * sorted_labels.reverse() + * for freq, label_str in sorted_labels: # <<<<<<<<<<<<<< + * if freq < 0: + * added_labels.append((freq, label_str)) +*/ + __pyx_t_2 = __pyx_v_sorted_labels; __Pyx_INCREF(__pyx_t_2); + __pyx_t_9 = 0; + for (;;) { + { + Py_ssize_t __pyx_temp = __Pyx_PyList_GET_SIZE(__pyx_t_2); + #if !CYTHON_ASSUME_SAFE_SIZE + if (unlikely((__pyx_temp < 0))) __PYX_ERR(0, 179, __pyx_L1_error) + #endif + if (__pyx_t_9 >= __pyx_temp) break; + } + __pyx_t_6 = __Pyx_PyList_GetItemRefFast(__pyx_t_2, __pyx_t_9, __Pyx_ReferenceSharing_OwnStrongReference); + ++__pyx_t_9; + if (unlikely(!__pyx_t_6)) __PYX_ERR(0, 179, __pyx_L1_error) + __Pyx_GOTREF(__pyx_t_6); + if ((likely(PyTuple_CheckExact(__pyx_t_6))) || (PyList_CheckExact(__pyx_t_6))) { + PyObject* sequence = __pyx_t_6; + Py_ssize_t size = __Pyx_PySequence_SIZE(sequence); + if (unlikely(size != 2)) { + if (size > 2) __Pyx_RaiseTooManyValuesError(2); + else if (size >= 0) __Pyx_RaiseNeedMoreValuesError(size); + __PYX_ERR(0, 179, __pyx_L1_error) + } + #if CYTHON_ASSUME_SAFE_MACROS && !CYTHON_AVOID_BORROWED_REFS + if (likely(PyTuple_CheckExact(sequence))) { + __pyx_t_5 = PyTuple_GET_ITEM(sequence, 0); + __Pyx_INCREF(__pyx_t_5); + __pyx_t_11 = PyTuple_GET_ITEM(sequence, 1); + __Pyx_INCREF(__pyx_t_11); + } else { + __pyx_t_5 = __Pyx_PyList_GetItemRefFast(sequence, 0, __Pyx_ReferenceSharing_SharedReference); + if (unlikely(!__pyx_t_5)) __PYX_ERR(0, 179, __pyx_L1_error) + __Pyx_XGOTREF(__pyx_t_5); + __pyx_t_11 = __Pyx_PyList_GetItemRefFast(sequence, 1, __Pyx_ReferenceSharing_SharedReference); + if (unlikely(!__pyx_t_11)) __PYX_ERR(0, 179, __pyx_L1_error) + __Pyx_XGOTREF(__pyx_t_11); + } + #else + __pyx_t_5 = __Pyx_PySequence_ITEM(sequence, 0); if (unlikely(!__pyx_t_5)) __PYX_ERR(0, 179, __pyx_L1_error) + __Pyx_GOTREF(__pyx_t_5); + __pyx_t_11 = __Pyx_PySequence_ITEM(sequence, 1); if (unlikely(!__pyx_t_11)) __PYX_ERR(0, 179, __pyx_L1_error) + __Pyx_GOTREF(__pyx_t_11); + #endif + __Pyx_DECREF(__pyx_t_6); __pyx_t_6 = 0; + } else { + Py_ssize_t index = -1; + __pyx_t_7 = PyObject_GetIter(__pyx_t_6); if (unlikely(!__pyx_t_7)) __PYX_ERR(0, 179, __pyx_L1_error) + __Pyx_GOTREF(__pyx_t_7); + __Pyx_DECREF(__pyx_t_6); __pyx_t_6 = 0; + __pyx_t_8 = (CYTHON_COMPILING_IN_LIMITED_API) ? PyIter_Next : __Pyx_PyObject_GetIterNextFunc(__pyx_t_7); + index = 0; __pyx_t_5 = __pyx_t_8(__pyx_t_7); if (unlikely(!__pyx_t_5)) goto __pyx_L14_unpacking_failed; + __Pyx_GOTREF(__pyx_t_5); + index = 1; __pyx_t_11 = __pyx_t_8(__pyx_t_7); if (unlikely(!__pyx_t_11)) goto __pyx_L14_unpacking_failed; + __Pyx_GOTREF(__pyx_t_11); + if (__Pyx_IternextUnpackEndCheck(__pyx_t_8(__pyx_t_7), 2) < (0)) __PYX_ERR(0, 179, __pyx_L1_error) + __pyx_t_8 = NULL; + __Pyx_DECREF(__pyx_t_7); __pyx_t_7 = 0; + goto __pyx_L15_unpacking_done; + __pyx_L14_unpacking_failed:; + __Pyx_DECREF(__pyx_t_7); __pyx_t_7 = 0; + __pyx_t_8 = NULL; + if (__Pyx_IterFinish() == 0) __Pyx_RaiseNeedMoreValuesError(index); + __PYX_ERR(0, 179, __pyx_L1_error) + __pyx_L15_unpacking_done:; + } + __Pyx_XDECREF_SET(__pyx_v_freq, __pyx_t_5); + __pyx_t_5 = 0; + __Pyx_XDECREF_SET(__pyx_v_label_str, __pyx_t_11); + __pyx_t_11 = 0; + + /* "spacy/pipeline/_parser_internals/transition_system.pyx":180 + * sorted_labels.reverse() + * for freq, label_str in sorted_labels: + * if freq < 0: # <<<<<<<<<<<<<< + * added_labels.append((freq, label_str)) + * added_actions.setdefault(label_str, []).append(action) +*/ + __pyx_t_6 = PyObject_RichCompare(__pyx_v_freq, __pyx_mstate_global->__pyx_int_0, Py_LT); __Pyx_XGOTREF(__pyx_t_6); if (unlikely(!__pyx_t_6)) __PYX_ERR(0, 180, __pyx_L1_error) + __pyx_t_14 = __Pyx_PyObject_IsTrue(__pyx_t_6); if (unlikely((__pyx_t_14 < 0))) __PYX_ERR(0, 180, __pyx_L1_error) + __Pyx_DECREF(__pyx_t_6); __pyx_t_6 = 0; + if (__pyx_t_14) { + + /* "spacy/pipeline/_parser_internals/transition_system.pyx":181 + * for freq, label_str in sorted_labels: + * if freq < 0: + * added_labels.append((freq, label_str)) # <<<<<<<<<<<<<< + * added_actions.setdefault(label_str, []).append(action) + * else: +*/ + __pyx_t_6 = PyTuple_New(2); if (unlikely(!__pyx_t_6)) __PYX_ERR(0, 181, __pyx_L1_error) + __Pyx_GOTREF(__pyx_t_6); + __Pyx_INCREF(__pyx_v_freq); + __Pyx_GIVEREF(__pyx_v_freq); + if (__Pyx_PyTuple_SET_ITEM(__pyx_t_6, 0, __pyx_v_freq) != (0)) __PYX_ERR(0, 181, __pyx_L1_error); + __Pyx_INCREF(__pyx_v_label_str); + __Pyx_GIVEREF(__pyx_v_label_str); + if (__Pyx_PyTuple_SET_ITEM(__pyx_t_6, 1, __pyx_v_label_str) != (0)) __PYX_ERR(0, 181, __pyx_L1_error); + __pyx_t_13 = __Pyx_PyList_Append(__pyx_v_added_labels, __pyx_t_6); if (unlikely(__pyx_t_13 == ((int)-1))) __PYX_ERR(0, 181, __pyx_L1_error) + __Pyx_DECREF(__pyx_t_6); __pyx_t_6 = 0; + + /* "spacy/pipeline/_parser_internals/transition_system.pyx":182 + * if freq < 0: + * added_labels.append((freq, label_str)) + * added_actions.setdefault(label_str, []).append(action) # <<<<<<<<<<<<<< + * else: + * self.add_action(int(action), label_str) +*/ + __pyx_t_6 = PyList_New(0); if (unlikely(!__pyx_t_6)) __PYX_ERR(0, 182, __pyx_L1_error) + __Pyx_GOTREF(__pyx_t_6); + __pyx_t_11 = __Pyx_PyDict_SetDefault(__pyx_v_added_actions, __pyx_v_label_str, __pyx_t_6); if (unlikely(!__pyx_t_11)) __PYX_ERR(0, 182, __pyx_L1_error) + __Pyx_GOTREF(__pyx_t_11); + __Pyx_DECREF(__pyx_t_6); __pyx_t_6 = 0; + __pyx_t_13 = __Pyx_PyObject_Append(__pyx_t_11, __pyx_v_action); if (unlikely(__pyx_t_13 == ((int)-1))) __PYX_ERR(0, 182, __pyx_L1_error) + __Pyx_DECREF(__pyx_t_11); __pyx_t_11 = 0; + + /* "spacy/pipeline/_parser_internals/transition_system.pyx":180 + * sorted_labels.reverse() + * for freq, label_str in sorted_labels: + * if freq < 0: # <<<<<<<<<<<<<< + * added_labels.append((freq, label_str)) + * added_actions.setdefault(label_str, []).append(action) +*/ + goto __pyx_L16; + } + + /* "spacy/pipeline/_parser_internals/transition_system.pyx":184 + * added_actions.setdefault(label_str, []).append(action) + * else: + * self.add_action(int(action), label_str) # <<<<<<<<<<<<<< + * self.labels[action][label_str] = freq + * added_labels.sort(reverse=True) +*/ + /*else*/ { + __pyx_t_6 = ((PyObject *)__pyx_v_self); + __Pyx_INCREF(__pyx_t_6); + __pyx_t_5 = __Pyx_PyNumber_Int(__pyx_v_action); if (unlikely(!__pyx_t_5)) __PYX_ERR(0, 184, __pyx_L1_error) + __Pyx_GOTREF(__pyx_t_5); + __pyx_t_3 = 0; + { + PyObject *__pyx_callargs[3] = {__pyx_t_6, __pyx_t_5, __pyx_v_label_str}; + __pyx_t_11 = __Pyx_PyObject_FastCallMethod((PyObject*)__pyx_mstate_global->__pyx_n_u_add_action, __pyx_callargs+__pyx_t_3, (3-__pyx_t_3) | (1*__Pyx_PY_VECTORCALL_ARGUMENTS_OFFSET)); + __Pyx_XDECREF(__pyx_t_6); __pyx_t_6 = 0; + __Pyx_DECREF(__pyx_t_5); __pyx_t_5 = 0; + if (unlikely(!__pyx_t_11)) __PYX_ERR(0, 184, __pyx_L1_error) + __Pyx_GOTREF(__pyx_t_11); + } + __Pyx_DECREF(__pyx_t_11); __pyx_t_11 = 0; + + /* "spacy/pipeline/_parser_internals/transition_system.pyx":185 + * else: + * self.add_action(int(action), label_str) + * self.labels[action][label_str] = freq # <<<<<<<<<<<<<< + * added_labels.sort(reverse=True) + * for freq, label_str in added_labels: +*/ + __pyx_t_11 = __Pyx_PyObject_GetItem(__pyx_v_self->labels, __pyx_v_action); if (unlikely(!__pyx_t_11)) __PYX_ERR(0, 185, __pyx_L1_error) + __Pyx_GOTREF(__pyx_t_11); + if (unlikely((PyObject_SetItem(__pyx_t_11, __pyx_v_label_str, __pyx_v_freq) < 0))) __PYX_ERR(0, 185, __pyx_L1_error) + __Pyx_DECREF(__pyx_t_11); __pyx_t_11 = 0; + } + __pyx_L16:; + + /* "spacy/pipeline/_parser_internals/transition_system.pyx":179 + * sorted_labels.sort() + * sorted_labels.reverse() + * for freq, label_str in sorted_labels: # <<<<<<<<<<<<<< + * if freq < 0: + * added_labels.append((freq, label_str)) +*/ + } + __Pyx_DECREF(__pyx_t_2); __pyx_t_2 = 0; + + /* "spacy/pipeline/_parser_internals/transition_system.pyx":170 + * added_labels = [] + * added_actions = {} + * for action, label_freqs in sorted(labels_by_action.items()): # <<<<<<<<<<<<<< + * action = int(action) + * # Make sure we take a copy here, and that we get a Counter +*/ + } + __Pyx_DECREF(__pyx_t_1); __pyx_t_1 = 0; + + /* "spacy/pipeline/_parser_internals/transition_system.pyx":186 + * self.add_action(int(action), label_str) + * self.labels[action][label_str] = freq + * added_labels.sort(reverse=True) # <<<<<<<<<<<<<< + * for freq, label_str in added_labels: + * for action in added_actions[label_str]: +*/ + __pyx_t_2 = __pyx_v_added_labels; + __Pyx_INCREF(__pyx_t_2); + __pyx_t_3 = 0; + { + PyObject *__pyx_callargs[2 + ((CYTHON_VECTORCALL) ? 1 : 0)] = {__pyx_t_2, NULL}; + __pyx_t_11 = __Pyx_MakeVectorcallBuilderKwds(1); if (unlikely(!__pyx_t_11)) __PYX_ERR(0, 186, __pyx_L1_error) + __Pyx_GOTREF(__pyx_t_11); + if (__Pyx_VectorcallBuilder_AddArg(__pyx_mstate_global->__pyx_n_u_reverse, Py_True, __pyx_t_11, __pyx_callargs+1, 0) < (0)) __PYX_ERR(0, 186, __pyx_L1_error) + __pyx_t_1 = __Pyx_Object_VectorcallMethod_CallFromBuilder((PyObject*)__pyx_mstate_global->__pyx_n_u_sort, __pyx_callargs+__pyx_t_3, (1-__pyx_t_3) | (1*__Pyx_PY_VECTORCALL_ARGUMENTS_OFFSET), __pyx_t_11); + __Pyx_XDECREF(__pyx_t_2); __pyx_t_2 = 0; + __Pyx_DECREF(__pyx_t_11); __pyx_t_11 = 0; + if (unlikely(!__pyx_t_1)) __PYX_ERR(0, 186, __pyx_L1_error) + __Pyx_GOTREF(__pyx_t_1); + } + __Pyx_DECREF(__pyx_t_1); __pyx_t_1 = 0; + + /* "spacy/pipeline/_parser_internals/transition_system.pyx":187 + * self.labels[action][label_str] = freq + * added_labels.sort(reverse=True) + * for freq, label_str in added_labels: # <<<<<<<<<<<<<< + * for action in added_actions[label_str]: + * self.add_action(int(action), label_str) +*/ + __pyx_t_1 = __pyx_v_added_labels; __Pyx_INCREF(__pyx_t_1); + __pyx_t_4 = 0; + for (;;) { + { + Py_ssize_t __pyx_temp = __Pyx_PyList_GET_SIZE(__pyx_t_1); + #if !CYTHON_ASSUME_SAFE_SIZE + if (unlikely((__pyx_temp < 0))) __PYX_ERR(0, 187, __pyx_L1_error) + #endif + if (__pyx_t_4 >= __pyx_temp) break; + } + __pyx_t_11 = __Pyx_PyList_GetItemRefFast(__pyx_t_1, __pyx_t_4, __Pyx_ReferenceSharing_OwnStrongReference); + ++__pyx_t_4; + if (unlikely(!__pyx_t_11)) __PYX_ERR(0, 187, __pyx_L1_error) + __Pyx_GOTREF(__pyx_t_11); + if ((likely(PyTuple_CheckExact(__pyx_t_11))) || (PyList_CheckExact(__pyx_t_11))) { + PyObject* sequence = __pyx_t_11; + 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, 187, __pyx_L1_error) + } + #if CYTHON_ASSUME_SAFE_MACROS && !CYTHON_AVOID_BORROWED_REFS + if (likely(PyTuple_CheckExact(sequence))) { + __pyx_t_2 = PyTuple_GET_ITEM(sequence, 0); + __Pyx_INCREF(__pyx_t_2); + __pyx_t_5 = PyTuple_GET_ITEM(sequence, 1); + __Pyx_INCREF(__pyx_t_5); + } else { + __pyx_t_2 = __Pyx_PyList_GetItemRefFast(sequence, 0, __Pyx_ReferenceSharing_SharedReference); + if (unlikely(!__pyx_t_2)) __PYX_ERR(0, 187, __pyx_L1_error) + __Pyx_XGOTREF(__pyx_t_2); + __pyx_t_5 = __Pyx_PyList_GetItemRefFast(sequence, 1, __Pyx_ReferenceSharing_SharedReference); + if (unlikely(!__pyx_t_5)) __PYX_ERR(0, 187, __pyx_L1_error) + __Pyx_XGOTREF(__pyx_t_5); + } + #else + __pyx_t_2 = __Pyx_PySequence_ITEM(sequence, 0); if (unlikely(!__pyx_t_2)) __PYX_ERR(0, 187, __pyx_L1_error) + __Pyx_GOTREF(__pyx_t_2); + __pyx_t_5 = __Pyx_PySequence_ITEM(sequence, 1); if (unlikely(!__pyx_t_5)) __PYX_ERR(0, 187, __pyx_L1_error) + __Pyx_GOTREF(__pyx_t_5); + #endif + __Pyx_DECREF(__pyx_t_11); __pyx_t_11 = 0; + } else { + Py_ssize_t index = -1; + __pyx_t_6 = PyObject_GetIter(__pyx_t_11); if (unlikely(!__pyx_t_6)) __PYX_ERR(0, 187, __pyx_L1_error) + __Pyx_GOTREF(__pyx_t_6); + __Pyx_DECREF(__pyx_t_11); __pyx_t_11 = 0; + __pyx_t_8 = (CYTHON_COMPILING_IN_LIMITED_API) ? PyIter_Next : __Pyx_PyObject_GetIterNextFunc(__pyx_t_6); + index = 0; __pyx_t_2 = __pyx_t_8(__pyx_t_6); if (unlikely(!__pyx_t_2)) goto __pyx_L21_unpacking_failed; + __Pyx_GOTREF(__pyx_t_2); + index = 1; __pyx_t_5 = __pyx_t_8(__pyx_t_6); if (unlikely(!__pyx_t_5)) goto __pyx_L21_unpacking_failed; + __Pyx_GOTREF(__pyx_t_5); + if (__Pyx_IternextUnpackEndCheck(__pyx_t_8(__pyx_t_6), 2) < (0)) __PYX_ERR(0, 187, __pyx_L1_error) + __pyx_t_8 = NULL; + __Pyx_DECREF(__pyx_t_6); __pyx_t_6 = 0; + goto __pyx_L22_unpacking_done; + __pyx_L21_unpacking_failed:; + __Pyx_DECREF(__pyx_t_6); __pyx_t_6 = 0; + __pyx_t_8 = NULL; + if (__Pyx_IterFinish() == 0) __Pyx_RaiseNeedMoreValuesError(index); + __PYX_ERR(0, 187, __pyx_L1_error) + __pyx_L22_unpacking_done:; + } + __Pyx_XDECREF_SET(__pyx_v_freq, __pyx_t_2); + __pyx_t_2 = 0; + __Pyx_XDECREF_SET(__pyx_v_label_str, __pyx_t_5); + __pyx_t_5 = 0; + + /* "spacy/pipeline/_parser_internals/transition_system.pyx":188 + * added_labels.sort(reverse=True) + * for freq, label_str in added_labels: + * for action in added_actions[label_str]: # <<<<<<<<<<<<<< + * self.add_action(int(action), label_str) + * self.labels[action][label_str] = freq +*/ + __pyx_t_11 = __Pyx_PyDict_GetItem(__pyx_v_added_actions, __pyx_v_label_str); if (unlikely(!__pyx_t_11)) __PYX_ERR(0, 188, __pyx_L1_error) + __Pyx_GOTREF(__pyx_t_11); + if (likely(PyList_CheckExact(__pyx_t_11)) || PyTuple_CheckExact(__pyx_t_11)) { + __pyx_t_5 = __pyx_t_11; __Pyx_INCREF(__pyx_t_5); + __pyx_t_9 = 0; + __pyx_t_10 = NULL; + } else { + __pyx_t_9 = -1; __pyx_t_5 = PyObject_GetIter(__pyx_t_11); if (unlikely(!__pyx_t_5)) __PYX_ERR(0, 188, __pyx_L1_error) + __Pyx_GOTREF(__pyx_t_5); + __pyx_t_10 = (CYTHON_COMPILING_IN_LIMITED_API) ? PyIter_Next : __Pyx_PyObject_GetIterNextFunc(__pyx_t_5); if (unlikely(!__pyx_t_10)) __PYX_ERR(0, 188, __pyx_L1_error) + } + __Pyx_DECREF(__pyx_t_11); __pyx_t_11 = 0; + for (;;) { + if (likely(!__pyx_t_10)) { + if (likely(PyList_CheckExact(__pyx_t_5))) { + { + Py_ssize_t __pyx_temp = __Pyx_PyList_GET_SIZE(__pyx_t_5); + #if !CYTHON_ASSUME_SAFE_SIZE + if (unlikely((__pyx_temp < 0))) __PYX_ERR(0, 188, __pyx_L1_error) + #endif + if (__pyx_t_9 >= __pyx_temp) break; + } + __pyx_t_11 = __Pyx_PyList_GetItemRefFast(__pyx_t_5, __pyx_t_9, __Pyx_ReferenceSharing_OwnStrongReference); + ++__pyx_t_9; + } else { + { + Py_ssize_t __pyx_temp = __Pyx_PyTuple_GET_SIZE(__pyx_t_5); + #if !CYTHON_ASSUME_SAFE_SIZE + if (unlikely((__pyx_temp < 0))) __PYX_ERR(0, 188, __pyx_L1_error) + #endif + if (__pyx_t_9 >= __pyx_temp) break; + } + #if CYTHON_ASSUME_SAFE_MACROS && !CYTHON_AVOID_BORROWED_REFS + __pyx_t_11 = __Pyx_NewRef(PyTuple_GET_ITEM(__pyx_t_5, __pyx_t_9)); + #else + __pyx_t_11 = __Pyx_PySequence_ITEM(__pyx_t_5, __pyx_t_9); + #endif + ++__pyx_t_9; + } + if (unlikely(!__pyx_t_11)) __PYX_ERR(0, 188, __pyx_L1_error) + } else { + __pyx_t_11 = __pyx_t_10(__pyx_t_5); + if (unlikely(!__pyx_t_11)) { + PyObject* exc_type = PyErr_Occurred(); + if (exc_type) { + if (unlikely(!__Pyx_PyErr_GivenExceptionMatches(exc_type, PyExc_StopIteration))) __PYX_ERR(0, 188, __pyx_L1_error) + PyErr_Clear(); + } + break; + } + } + __Pyx_GOTREF(__pyx_t_11); + __Pyx_XDECREF_SET(__pyx_v_action, __pyx_t_11); + __pyx_t_11 = 0; + + /* "spacy/pipeline/_parser_internals/transition_system.pyx":189 + * for freq, label_str in added_labels: + * for action in added_actions[label_str]: + * self.add_action(int(action), label_str) # <<<<<<<<<<<<<< + * self.labels[action][label_str] = freq + * +*/ + __pyx_t_2 = ((PyObject *)__pyx_v_self); + __Pyx_INCREF(__pyx_t_2); + __pyx_t_6 = __Pyx_PyNumber_Int(__pyx_v_action); if (unlikely(!__pyx_t_6)) __PYX_ERR(0, 189, __pyx_L1_error) + __Pyx_GOTREF(__pyx_t_6); + __pyx_t_3 = 0; + { + PyObject *__pyx_callargs[3] = {__pyx_t_2, __pyx_t_6, __pyx_v_label_str}; + __pyx_t_11 = __Pyx_PyObject_FastCallMethod((PyObject*)__pyx_mstate_global->__pyx_n_u_add_action, __pyx_callargs+__pyx_t_3, (3-__pyx_t_3) | (1*__Pyx_PY_VECTORCALL_ARGUMENTS_OFFSET)); + __Pyx_XDECREF(__pyx_t_2); __pyx_t_2 = 0; + __Pyx_DECREF(__pyx_t_6); __pyx_t_6 = 0; + if (unlikely(!__pyx_t_11)) __PYX_ERR(0, 189, __pyx_L1_error) + __Pyx_GOTREF(__pyx_t_11); + } + __Pyx_DECREF(__pyx_t_11); __pyx_t_11 = 0; + + /* "spacy/pipeline/_parser_internals/transition_system.pyx":190 + * for action in added_actions[label_str]: + * self.add_action(int(action), label_str) + * self.labels[action][label_str] = freq # <<<<<<<<<<<<<< + * + * def add_action(self, int action, label_name): +*/ + __pyx_t_11 = __Pyx_PyObject_GetItem(__pyx_v_self->labels, __pyx_v_action); if (unlikely(!__pyx_t_11)) __PYX_ERR(0, 190, __pyx_L1_error) + __Pyx_GOTREF(__pyx_t_11); + if (unlikely((PyObject_SetItem(__pyx_t_11, __pyx_v_label_str, __pyx_v_freq) < 0))) __PYX_ERR(0, 190, __pyx_L1_error) + __Pyx_DECREF(__pyx_t_11); __pyx_t_11 = 0; + + /* "spacy/pipeline/_parser_internals/transition_system.pyx":188 + * added_labels.sort(reverse=True) + * for freq, label_str in added_labels: + * for action in added_actions[label_str]: # <<<<<<<<<<<<<< + * self.add_action(int(action), label_str) + * self.labels[action][label_str] = freq +*/ + } + __Pyx_DECREF(__pyx_t_5); __pyx_t_5 = 0; + + /* "spacy/pipeline/_parser_internals/transition_system.pyx":187 + * self.labels[action][label_str] = freq + * added_labels.sort(reverse=True) + * for freq, label_str in added_labels: # <<<<<<<<<<<<<< + * for action in added_actions[label_str]: + * self.add_action(int(action), label_str) +*/ + } + __Pyx_DECREF(__pyx_t_1); __pyx_t_1 = 0; + + /* "spacy/pipeline/_parser_internals/transition_system.pyx":165 + * return self.move_name(act.move, act.label) + * + * def initialize_actions(self, labels_by_action, min_freq=None): # <<<<<<<<<<<<<< + * self.labels = {} + * self.n_moves = 0 +*/ + + /* function exit code */ + __pyx_r = Py_None; __Pyx_INCREF(Py_None); + goto __pyx_L0; + __pyx_L1_error:; + __Pyx_XDECREF(__pyx_t_1); + __Pyx_XDECREF(__pyx_t_2); + __Pyx_XDECREF(__pyx_t_5); + __Pyx_XDECREF(__pyx_t_6); + __Pyx_XDECREF(__pyx_t_7); + __Pyx_XDECREF(__pyx_t_11); + __Pyx_XDECREF(__pyx_t_12); + __Pyx_AddTraceback("spacy.pipeline._parser_internals.transition_system.TransitionSystem.initialize_actions", __pyx_clineno, __pyx_lineno, __pyx_filename); + __pyx_r = NULL; + __pyx_L0:; + __Pyx_XDECREF(__pyx_v_added_labels); + __Pyx_XDECREF(__pyx_v_added_actions); + __Pyx_XDECREF(__pyx_v_action); + __Pyx_XDECREF(__pyx_v_label_freqs); + __Pyx_XDECREF(__pyx_v_sorted_labels); + __Pyx_XDECREF(__pyx_v_freq); + __Pyx_XDECREF(__pyx_v_label_str); + __Pyx_XDECREF(__pyx_v_L); + __Pyx_XDECREF(__pyx_v_f); + __Pyx_XGIVEREF(__pyx_r); + __Pyx_RefNannyFinishContext(); + return __pyx_r; +} + +/* "spacy/pipeline/_parser_internals/transition_system.pyx":192 + * self.labels[action][label_str] = freq + * + * def add_action(self, int action, label_name): # <<<<<<<<<<<<<< + * cdef attr_t label_id + * if not isinstance(label_name, int): +*/ + +/* Python wrapper */ +static PyObject *__pyx_pw_5spacy_8pipeline_17_parser_internals_17transition_system_16TransitionSystem_19add_action(PyObject *__pyx_v_self, +#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_5spacy_8pipeline_17_parser_internals_17transition_system_16TransitionSystem_18add_action, "TransitionSystem.add_action(self, int action, label_name)"); +static PyMethodDef __pyx_mdef_5spacy_8pipeline_17_parser_internals_17transition_system_16TransitionSystem_19add_action = {"add_action", (PyCFunction)(void(*)(void))(__Pyx_PyCFunction_FastCallWithKeywords)__pyx_pw_5spacy_8pipeline_17_parser_internals_17transition_system_16TransitionSystem_19add_action, __Pyx_METH_FASTCALL|METH_KEYWORDS, __pyx_doc_5spacy_8pipeline_17_parser_internals_17transition_system_16TransitionSystem_18add_action}; +static PyObject *__pyx_pw_5spacy_8pipeline_17_parser_internals_17transition_system_16TransitionSystem_19add_action(PyObject *__pyx_v_self, +#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_action; + PyObject *__pyx_v_label_name = 0; + #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("add_action (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_action,&__pyx_mstate_global->__pyx_n_u_label_name,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, 192, __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, 192, __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, 192, __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, "add_action", 0) < (0)) __PYX_ERR(0, 192, __pyx_L3_error) + for (Py_ssize_t i = __pyx_nargs; i < 2; i++) { + if (unlikely(!values[i])) { __Pyx_RaiseArgtupleInvalid("add_action", 1, 2, 2, i); __PYX_ERR(0, 192, __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, 192, __pyx_L3_error) + values[1] = __Pyx_ArgRef_FASTCALL(__pyx_args, 1); + if (!CYTHON_ASSUME_SAFE_MACROS && unlikely(!values[1])) __PYX_ERR(0, 192, __pyx_L3_error) + } + __pyx_v_action = __Pyx_PyLong_As_int(values[0]); if (unlikely((__pyx_v_action == (int)-1) && PyErr_Occurred())) __PYX_ERR(0, 192, __pyx_L3_error) + __pyx_v_label_name = values[1]; + } + goto __pyx_L6_skip; + __pyx_L5_argtuple_error:; + __Pyx_RaiseArgtupleInvalid("add_action", 1, 2, 2, __pyx_nargs); __PYX_ERR(0, 192, __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("spacy.pipeline._parser_internals.transition_system.TransitionSystem.add_action", __pyx_clineno, __pyx_lineno, __pyx_filename); + __Pyx_RefNannyFinishContext(); + return NULL; + __pyx_L4_argument_unpacking_done:; + __pyx_r = __pyx_pf_5spacy_8pipeline_17_parser_internals_17transition_system_16TransitionSystem_18add_action(((struct __pyx_obj_5spacy_8pipeline_17_parser_internals_17transition_system_TransitionSystem *)__pyx_v_self), __pyx_v_action, __pyx_v_label_name); + + /* 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_5spacy_8pipeline_17_parser_internals_17transition_system_16TransitionSystem_18add_action(struct __pyx_obj_5spacy_8pipeline_17_parser_internals_17transition_system_TransitionSystem *__pyx_v_self, int __pyx_v_action, PyObject *__pyx_v_label_name) { + __pyx_t_5spacy_8typedefs_attr_t __pyx_v_label_id; + struct __pyx_t_5spacy_8pipeline_17_parser_internals_17transition_system_Transition __pyx_v_trans; + PyObject *__pyx_v_new_freq = 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; + size_t __pyx_t_5; + __pyx_t_5spacy_8typedefs_attr_t __pyx_t_6; + struct __pyx_t_5spacy_8pipeline_17_parser_internals_17transition_system_Transition *__pyx_t_7; + struct __pyx_t_5spacy_8pipeline_17_parser_internals_17transition_system_Transition *__pyx_t_8; + struct __pyx_t_5spacy_8pipeline_17_parser_internals_17transition_system_Transition *__pyx_t_9; + void *__pyx_t_10; + struct __pyx_t_5spacy_8pipeline_17_parser_internals_17transition_system_Transition __pyx_t_11; + PyObject *__pyx_t_12 = NULL; + PyObject *__pyx_t_13 = NULL; + PyObject *__pyx_t_14 = NULL; + int __pyx_lineno = 0; + const char *__pyx_filename = NULL; + int __pyx_clineno = 0; + __Pyx_RefNannySetupContext("add_action", 0); + + /* "spacy/pipeline/_parser_internals/transition_system.pyx":194 + * def add_action(self, int action, label_name): + * cdef attr_t label_id + * if not isinstance(label_name, int): # <<<<<<<<<<<<<< + * label_id = self.strings.add(label_name) + * else: +*/ + __pyx_t_1 = PyLong_Check(__pyx_v_label_name); + __pyx_t_2 = (!__pyx_t_1); + if (__pyx_t_2) { + + /* "spacy/pipeline/_parser_internals/transition_system.pyx":195 + * cdef attr_t label_id + * if not isinstance(label_name, int): + * label_id = self.strings.add(label_name) # <<<<<<<<<<<<<< + * else: + * label_id = label_name +*/ + __pyx_t_4 = ((PyObject *)__pyx_v_self->strings); + __Pyx_INCREF(__pyx_t_4); + __pyx_t_5 = 0; + { + PyObject *__pyx_callargs[2] = {__pyx_t_4, __pyx_v_label_name}; + __pyx_t_3 = __Pyx_PyObject_FastCallMethod((PyObject*)__pyx_mstate_global->__pyx_n_u_add, __pyx_callargs+__pyx_t_5, (2-__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, 195, __pyx_L1_error) + __Pyx_GOTREF(__pyx_t_3); + } + __pyx_t_6 = __Pyx_PyLong_As_uint64_t(__pyx_t_3); if (unlikely((__pyx_t_6 == ((uint64_t)-1)) && PyErr_Occurred())) __PYX_ERR(0, 195, __pyx_L1_error) + __Pyx_DECREF(__pyx_t_3); __pyx_t_3 = 0; + __pyx_v_label_id = __pyx_t_6; + + /* "spacy/pipeline/_parser_internals/transition_system.pyx":194 + * def add_action(self, int action, label_name): + * cdef attr_t label_id + * if not isinstance(label_name, int): # <<<<<<<<<<<<<< + * label_id = self.strings.add(label_name) + * else: +*/ + goto __pyx_L3; + } + + /* "spacy/pipeline/_parser_internals/transition_system.pyx":197 + * label_id = self.strings.add(label_name) + * else: + * label_id = label_name # <<<<<<<<<<<<<< + * # Check we're not creating a move we already have, so that this is + * # idempotent +*/ + /*else*/ { + __pyx_t_6 = __Pyx_PyLong_As_uint64_t(__pyx_v_label_name); if (unlikely((__pyx_t_6 == ((uint64_t)-1)) && PyErr_Occurred())) __PYX_ERR(0, 197, __pyx_L1_error) + __pyx_v_label_id = __pyx_t_6; + } + __pyx_L3:; + + /* "spacy/pipeline/_parser_internals/transition_system.pyx":200 + * # Check we're not creating a move we already have, so that this is + * # idempotent + * for trans in self.c[:self.n_moves]: # <<<<<<<<<<<<<< + * if trans.move == action and trans.label == label_id: + * return 0 +*/ + __pyx_t_8 = (__pyx_v_self->c + __pyx_v_self->n_moves); + for (__pyx_t_9 = __pyx_v_self->c; __pyx_t_9 < __pyx_t_8; __pyx_t_9++) { + __pyx_t_7 = __pyx_t_9; + __pyx_v_trans = (__pyx_t_7[0]); + + /* "spacy/pipeline/_parser_internals/transition_system.pyx":201 + * # idempotent + * for trans in self.c[:self.n_moves]: + * if trans.move == action and trans.label == label_id: # <<<<<<<<<<<<<< + * return 0 + * if self.n_moves >= self._size: +*/ + __pyx_t_1 = (__pyx_v_trans.move == __pyx_v_action); + if (__pyx_t_1) { + } else { + __pyx_t_2 = __pyx_t_1; + goto __pyx_L7_bool_binop_done; + } + __pyx_t_1 = (__pyx_v_trans.label == __pyx_v_label_id); + __pyx_t_2 = __pyx_t_1; + __pyx_L7_bool_binop_done:; + if (__pyx_t_2) { + + /* "spacy/pipeline/_parser_internals/transition_system.pyx":202 + * for trans in self.c[:self.n_moves]: + * if trans.move == action and trans.label == label_id: + * return 0 # <<<<<<<<<<<<<< + * if self.n_moves >= self._size: + * self._size *= 2 +*/ + __Pyx_XDECREF(__pyx_r); + __Pyx_INCREF(__pyx_mstate_global->__pyx_int_0); + __pyx_r = __pyx_mstate_global->__pyx_int_0; + goto __pyx_L0; + + /* "spacy/pipeline/_parser_internals/transition_system.pyx":201 + * # idempotent + * for trans in self.c[:self.n_moves]: + * if trans.move == action and trans.label == label_id: # <<<<<<<<<<<<<< + * return 0 + * if self.n_moves >= self._size: +*/ + } + } + + /* "spacy/pipeline/_parser_internals/transition_system.pyx":203 + * if trans.move == action and trans.label == label_id: + * return 0 + * if self.n_moves >= self._size: # <<<<<<<<<<<<<< + * self._size *= 2 + * self.c = self.mem.realloc(self.c, self._size * sizeof(self.c[0])) +*/ + __pyx_t_2 = (__pyx_v_self->n_moves >= __pyx_v_self->_size); + if (__pyx_t_2) { + + /* "spacy/pipeline/_parser_internals/transition_system.pyx":204 + * return 0 + * if self.n_moves >= self._size: + * self._size *= 2 # <<<<<<<<<<<<<< + * self.c = self.mem.realloc(self.c, self._size * sizeof(self.c[0])) + * self.c[self.n_moves] = self.init_transition(self.n_moves, action, label_id) +*/ + __pyx_v_self->_size = (__pyx_v_self->_size * 2); + + /* "spacy/pipeline/_parser_internals/transition_system.pyx":205 + * if self.n_moves >= self._size: + * self._size *= 2 + * self.c = self.mem.realloc(self.c, self._size * sizeof(self.c[0])) # <<<<<<<<<<<<<< + * self.c[self.n_moves] = self.init_transition(self.n_moves, action, label_id) + * self.n_moves += 1 +*/ + __pyx_t_10 = ((struct __pyx_vtabstruct_5cymem_5cymem_Pool *)__pyx_v_self->mem->__pyx_vtab)->realloc(__pyx_v_self->mem, __pyx_v_self->c, (__pyx_v_self->_size * (sizeof((__pyx_v_self->c[0]))))); if (unlikely(__pyx_t_10 == ((void *)NULL))) __PYX_ERR(0, 205, __pyx_L1_error) + __pyx_v_self->c = ((struct __pyx_t_5spacy_8pipeline_17_parser_internals_17transition_system_Transition *)__pyx_t_10); + + /* "spacy/pipeline/_parser_internals/transition_system.pyx":203 + * if trans.move == action and trans.label == label_id: + * return 0 + * if self.n_moves >= self._size: # <<<<<<<<<<<<<< + * self._size *= 2 + * self.c = self.mem.realloc(self.c, self._size * sizeof(self.c[0])) +*/ + } + + /* "spacy/pipeline/_parser_internals/transition_system.pyx":206 + * self._size *= 2 + * self.c = self.mem.realloc(self.c, self._size * sizeof(self.c[0])) + * self.c[self.n_moves] = self.init_transition(self.n_moves, action, label_id) # <<<<<<<<<<<<<< + * self.n_moves += 1 + * # Add the new (action, label) pair, making up a frequency for it if +*/ + __pyx_t_11 = ((struct __pyx_vtabstruct_5spacy_8pipeline_17_parser_internals_17transition_system_TransitionSystem *)__pyx_v_self->__pyx_vtab)->init_transition(__pyx_v_self, __pyx_v_self->n_moves, __pyx_v_action, __pyx_v_label_id); if (unlikely(PyErr_Occurred())) __PYX_ERR(0, 206, __pyx_L1_error) + (__pyx_v_self->c[__pyx_v_self->n_moves]) = __pyx_t_11; + + /* "spacy/pipeline/_parser_internals/transition_system.pyx":207 + * self.c = self.mem.realloc(self.c, self._size * sizeof(self.c[0])) + * self.c[self.n_moves] = self.init_transition(self.n_moves, action, label_id) + * self.n_moves += 1 # <<<<<<<<<<<<<< + * # Add the new (action, label) pair, making up a frequency for it if + * # necessary. To preserve sort order, the frequency needs to be lower +*/ + __pyx_v_self->n_moves = (__pyx_v_self->n_moves + 1); + + /* "spacy/pipeline/_parser_internals/transition_system.pyx":211 + * # necessary. To preserve sort order, the frequency needs to be lower + * # than previous frequencies. + * if self.labels.get(action, []): # <<<<<<<<<<<<<< + * new_freq = min(self.labels[action].values()) + * else: +*/ + __pyx_t_4 = __pyx_v_self->labels; + __Pyx_INCREF(__pyx_t_4); + __pyx_t_12 = __Pyx_PyLong_From_int(__pyx_v_action); if (unlikely(!__pyx_t_12)) __PYX_ERR(0, 211, __pyx_L1_error) + __Pyx_GOTREF(__pyx_t_12); + __pyx_t_13 = PyList_New(0); if (unlikely(!__pyx_t_13)) __PYX_ERR(0, 211, __pyx_L1_error) + __Pyx_GOTREF(__pyx_t_13); + __pyx_t_5 = 0; + { + PyObject *__pyx_callargs[3] = {__pyx_t_4, __pyx_t_12, __pyx_t_13}; + __pyx_t_3 = __Pyx_PyObject_FastCallMethod((PyObject*)__pyx_mstate_global->__pyx_n_u_get, __pyx_callargs+__pyx_t_5, (3-__pyx_t_5) | (1*__Pyx_PY_VECTORCALL_ARGUMENTS_OFFSET)); + __Pyx_XDECREF(__pyx_t_4); __pyx_t_4 = 0; + __Pyx_DECREF(__pyx_t_12); __pyx_t_12 = 0; + __Pyx_DECREF(__pyx_t_13); __pyx_t_13 = 0; + if (unlikely(!__pyx_t_3)) __PYX_ERR(0, 211, __pyx_L1_error) + __Pyx_GOTREF(__pyx_t_3); + } + __pyx_t_2 = __Pyx_PyObject_IsTrue(__pyx_t_3); if (unlikely((__pyx_t_2 < 0))) __PYX_ERR(0, 211, __pyx_L1_error) + __Pyx_DECREF(__pyx_t_3); __pyx_t_3 = 0; + if (__pyx_t_2) { + + /* "spacy/pipeline/_parser_internals/transition_system.pyx":212 + * # than previous frequencies. + * if self.labels.get(action, []): + * new_freq = min(self.labels[action].values()) # <<<<<<<<<<<<<< + * else: + * self.labels[action] = Counter() +*/ + __pyx_t_13 = NULL; + __pyx_t_14 = __Pyx_GetItemInt(__pyx_v_self->labels, __pyx_v_action, int, 1, __Pyx_PyLong_From_int, 0, 1, 1, 1, __Pyx_ReferenceSharing_SharedReference); if (unlikely(!__pyx_t_14)) __PYX_ERR(0, 212, __pyx_L1_error) + __Pyx_GOTREF(__pyx_t_14); + __pyx_t_4 = __pyx_t_14; + __Pyx_INCREF(__pyx_t_4); + __pyx_t_5 = 0; + { + PyObject *__pyx_callargs[2] = {__pyx_t_4, NULL}; + __pyx_t_12 = __Pyx_PyObject_FastCallMethod((PyObject*)__pyx_mstate_global->__pyx_n_u_values, __pyx_callargs+__pyx_t_5, (1-__pyx_t_5) | (1*__Pyx_PY_VECTORCALL_ARGUMENTS_OFFSET)); + __Pyx_XDECREF(__pyx_t_4); __pyx_t_4 = 0; + __Pyx_DECREF(__pyx_t_14); __pyx_t_14 = 0; + if (unlikely(!__pyx_t_12)) __PYX_ERR(0, 212, __pyx_L1_error) + __Pyx_GOTREF(__pyx_t_12); + } + __pyx_t_5 = 1; + { + PyObject *__pyx_callargs[2] = {__pyx_t_13, __pyx_t_12}; + __pyx_t_3 = __Pyx_PyObject_FastCall((PyObject*)__pyx_builtin_min, __pyx_callargs+__pyx_t_5, (2-__pyx_t_5) | (__pyx_t_5*__Pyx_PY_VECTORCALL_ARGUMENTS_OFFSET)); + __Pyx_XDECREF(__pyx_t_13); __pyx_t_13 = 0; + __Pyx_DECREF(__pyx_t_12); __pyx_t_12 = 0; + if (unlikely(!__pyx_t_3)) __PYX_ERR(0, 212, __pyx_L1_error) + __Pyx_GOTREF(__pyx_t_3); + } + __pyx_v_new_freq = __pyx_t_3; + __pyx_t_3 = 0; + + /* "spacy/pipeline/_parser_internals/transition_system.pyx":211 + * # necessary. To preserve sort order, the frequency needs to be lower + * # than previous frequencies. + * if self.labels.get(action, []): # <<<<<<<<<<<<<< + * new_freq = min(self.labels[action].values()) + * else: +*/ + goto __pyx_L10; + } + + /* "spacy/pipeline/_parser_internals/transition_system.pyx":214 + * new_freq = min(self.labels[action].values()) + * else: + * self.labels[action] = Counter() # <<<<<<<<<<<<<< + * new_freq = -1 + * if new_freq > 0: +*/ + /*else*/ { + __pyx_t_12 = NULL; + __Pyx_GetModuleGlobalName(__pyx_t_13, __pyx_mstate_global->__pyx_n_u_Counter); if (unlikely(!__pyx_t_13)) __PYX_ERR(0, 214, __pyx_L1_error) + __Pyx_GOTREF(__pyx_t_13); + __pyx_t_5 = 1; + #if CYTHON_UNPACK_METHODS + if (unlikely(PyMethod_Check(__pyx_t_13))) { + __pyx_t_12 = PyMethod_GET_SELF(__pyx_t_13); + assert(__pyx_t_12); + PyObject* __pyx__function = PyMethod_GET_FUNCTION(__pyx_t_13); + __Pyx_INCREF(__pyx_t_12); + __Pyx_INCREF(__pyx__function); + __Pyx_DECREF_SET(__pyx_t_13, __pyx__function); + __pyx_t_5 = 0; + } + #endif + { + PyObject *__pyx_callargs[2] = {__pyx_t_12, NULL}; + __pyx_t_3 = __Pyx_PyObject_FastCall((PyObject*)__pyx_t_13, __pyx_callargs+__pyx_t_5, (1-__pyx_t_5) | (__pyx_t_5*__Pyx_PY_VECTORCALL_ARGUMENTS_OFFSET)); + __Pyx_XDECREF(__pyx_t_12); __pyx_t_12 = 0; + __Pyx_DECREF(__pyx_t_13); __pyx_t_13 = 0; + if (unlikely(!__pyx_t_3)) __PYX_ERR(0, 214, __pyx_L1_error) + __Pyx_GOTREF(__pyx_t_3); + } + if (unlikely((__Pyx_SetItemInt(__pyx_v_self->labels, __pyx_v_action, __pyx_t_3, int, 1, __Pyx_PyLong_From_int, 0, 1, 1, 1, __Pyx_ReferenceSharing_SharedReference) < 0))) __PYX_ERR(0, 214, __pyx_L1_error) + __Pyx_DECREF(__pyx_t_3); __pyx_t_3 = 0; + + /* "spacy/pipeline/_parser_internals/transition_system.pyx":215 + * else: + * self.labels[action] = Counter() + * new_freq = -1 # <<<<<<<<<<<<<< + * if new_freq > 0: + * new_freq = 0 +*/ + __Pyx_INCREF(__pyx_mstate_global->__pyx_int_neg_1); + __pyx_v_new_freq = __pyx_mstate_global->__pyx_int_neg_1; + } + __pyx_L10:; + + /* "spacy/pipeline/_parser_internals/transition_system.pyx":216 + * self.labels[action] = Counter() + * new_freq = -1 + * if new_freq > 0: # <<<<<<<<<<<<<< + * new_freq = 0 + * self.labels[action][label_name] = new_freq-1 +*/ + __pyx_t_3 = PyObject_RichCompare(__pyx_v_new_freq, __pyx_mstate_global->__pyx_int_0, Py_GT); __Pyx_XGOTREF(__pyx_t_3); if (unlikely(!__pyx_t_3)) __PYX_ERR(0, 216, __pyx_L1_error) + __pyx_t_2 = __Pyx_PyObject_IsTrue(__pyx_t_3); if (unlikely((__pyx_t_2 < 0))) __PYX_ERR(0, 216, __pyx_L1_error) + __Pyx_DECREF(__pyx_t_3); __pyx_t_3 = 0; + if (__pyx_t_2) { + + /* "spacy/pipeline/_parser_internals/transition_system.pyx":217 + * new_freq = -1 + * if new_freq > 0: + * new_freq = 0 # <<<<<<<<<<<<<< + * self.labels[action][label_name] = new_freq-1 + * return 1 +*/ + __Pyx_INCREF(__pyx_mstate_global->__pyx_int_0); + __Pyx_DECREF_SET(__pyx_v_new_freq, __pyx_mstate_global->__pyx_int_0); + + /* "spacy/pipeline/_parser_internals/transition_system.pyx":216 + * self.labels[action] = Counter() + * new_freq = -1 + * if new_freq > 0: # <<<<<<<<<<<<<< + * new_freq = 0 + * self.labels[action][label_name] = new_freq-1 +*/ + } + + /* "spacy/pipeline/_parser_internals/transition_system.pyx":218 + * if new_freq > 0: + * new_freq = 0 + * self.labels[action][label_name] = new_freq-1 # <<<<<<<<<<<<<< + * return 1 + * +*/ + __pyx_t_3 = __Pyx_PyLong_SubtractObjC(__pyx_v_new_freq, __pyx_mstate_global->__pyx_int_1, 1, 0, 0); if (unlikely(!__pyx_t_3)) __PYX_ERR(0, 218, __pyx_L1_error) + __Pyx_GOTREF(__pyx_t_3); + __pyx_t_13 = __Pyx_GetItemInt(__pyx_v_self->labels, __pyx_v_action, int, 1, __Pyx_PyLong_From_int, 0, 1, 1, 1, __Pyx_ReferenceSharing_SharedReference); if (unlikely(!__pyx_t_13)) __PYX_ERR(0, 218, __pyx_L1_error) + __Pyx_GOTREF(__pyx_t_13); + if (unlikely((PyObject_SetItem(__pyx_t_13, __pyx_v_label_name, __pyx_t_3) < 0))) __PYX_ERR(0, 218, __pyx_L1_error) + __Pyx_DECREF(__pyx_t_13); __pyx_t_13 = 0; + __Pyx_DECREF(__pyx_t_3); __pyx_t_3 = 0; + + /* "spacy/pipeline/_parser_internals/transition_system.pyx":219 + * new_freq = 0 + * self.labels[action][label_name] = new_freq-1 + * return 1 # <<<<<<<<<<<<<< + * + * def to_disk(self, path, **kwargs): +*/ + __Pyx_XDECREF(__pyx_r); + __Pyx_INCREF(__pyx_mstate_global->__pyx_int_1); + __pyx_r = __pyx_mstate_global->__pyx_int_1; + goto __pyx_L0; + + /* "spacy/pipeline/_parser_internals/transition_system.pyx":192 + * self.labels[action][label_str] = freq + * + * def add_action(self, int action, label_name): # <<<<<<<<<<<<<< + * cdef attr_t label_id + * if not isinstance(label_name, int): +*/ + + /* function exit code */ + __pyx_L1_error:; + __Pyx_XDECREF(__pyx_t_3); + __Pyx_XDECREF(__pyx_t_4); + __Pyx_XDECREF(__pyx_t_12); + __Pyx_XDECREF(__pyx_t_13); + __Pyx_XDECREF(__pyx_t_14); + __Pyx_AddTraceback("spacy.pipeline._parser_internals.transition_system.TransitionSystem.add_action", __pyx_clineno, __pyx_lineno, __pyx_filename); + __pyx_r = NULL; + __pyx_L0:; + __Pyx_XDECREF(__pyx_v_new_freq); + __Pyx_XGIVEREF(__pyx_r); + __Pyx_RefNannyFinishContext(); + return __pyx_r; +} + +/* "spacy/pipeline/_parser_internals/transition_system.pyx":221 + * return 1 + * + * def to_disk(self, path, **kwargs): # <<<<<<<<<<<<<< + * with path.open('wb') as file_: + * file_.write(self.to_bytes(**kwargs)) +*/ + +/* Python wrapper */ +static PyObject *__pyx_pw_5spacy_8pipeline_17_parser_internals_17transition_system_16TransitionSystem_21to_disk(PyObject *__pyx_v_self, +#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_5spacy_8pipeline_17_parser_internals_17transition_system_16TransitionSystem_20to_disk, "TransitionSystem.to_disk(self, path, **kwargs)"); +static PyMethodDef __pyx_mdef_5spacy_8pipeline_17_parser_internals_17transition_system_16TransitionSystem_21to_disk = {"to_disk", (PyCFunction)(void(*)(void))(__Pyx_PyCFunction_FastCallWithKeywords)__pyx_pw_5spacy_8pipeline_17_parser_internals_17transition_system_16TransitionSystem_21to_disk, __Pyx_METH_FASTCALL|METH_KEYWORDS, __pyx_doc_5spacy_8pipeline_17_parser_internals_17transition_system_16TransitionSystem_20to_disk}; +static PyObject *__pyx_pw_5spacy_8pipeline_17_parser_internals_17transition_system_16TransitionSystem_21to_disk(PyObject *__pyx_v_self, +#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; + PyObject *__pyx_v_kwargs = 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("to_disk (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); + __pyx_v_kwargs = PyDict_New(); if (unlikely(!__pyx_v_kwargs)) return NULL; + __Pyx_GOTREF(__pyx_v_kwargs); + { + 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, 221, __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, 221, __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, __pyx_v_kwargs, values, kwd_pos_args, __pyx_kwds_len, "to_disk", 1) < (0)) __PYX_ERR(0, 221, __pyx_L3_error) + for (Py_ssize_t i = __pyx_nargs; i < 1; i++) { + if (unlikely(!values[i])) { __Pyx_RaiseArgtupleInvalid("to_disk", 1, 1, 1, i); __PYX_ERR(0, 221, __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, 221, __pyx_L3_error) + } + __pyx_v_path = values[0]; + } + goto __pyx_L6_skip; + __pyx_L5_argtuple_error:; + __Pyx_RaiseArgtupleInvalid("to_disk", 1, 1, 1, __pyx_nargs); __PYX_ERR(0, 221, __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_DECREF(__pyx_v_kwargs); __pyx_v_kwargs = 0; + __Pyx_AddTraceback("spacy.pipeline._parser_internals.transition_system.TransitionSystem.to_disk", __pyx_clineno, __pyx_lineno, __pyx_filename); + __Pyx_RefNannyFinishContext(); + return NULL; + __pyx_L4_argument_unpacking_done:; + __pyx_r = __pyx_pf_5spacy_8pipeline_17_parser_internals_17transition_system_16TransitionSystem_20to_disk(((struct __pyx_obj_5spacy_8pipeline_17_parser_internals_17transition_system_TransitionSystem *)__pyx_v_self), __pyx_v_path, __pyx_v_kwargs); + + /* 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_DECREF(__pyx_v_kwargs); + __Pyx_RefNannyFinishContext(); + return __pyx_r; +} + +static PyObject *__pyx_pf_5spacy_8pipeline_17_parser_internals_17transition_system_16TransitionSystem_20to_disk(struct __pyx_obj_5spacy_8pipeline_17_parser_internals_17transition_system_TransitionSystem *__pyx_v_self, PyObject *__pyx_v_path, PyObject *__pyx_v_kwargs) { + PyObject *__pyx_v_file_ = NULL; + PyObject *__pyx_r = NULL; + __Pyx_RefNannyDeclarations + PyObject *__pyx_t_1 = NULL; + PyObject *__pyx_t_2 = NULL; + size_t __pyx_t_3; + PyObject *__pyx_t_4 = NULL; + PyObject *__pyx_t_5 = NULL; + PyObject *__pyx_t_6 = NULL; + PyObject *__pyx_t_7 = NULL; + PyObject *__pyx_t_8 = NULL; + PyObject *__pyx_t_9 = NULL; + PyObject *__pyx_t_10 = NULL; + PyObject *__pyx_t_11 = NULL; + int __pyx_t_12; + int __pyx_t_13; + int __pyx_lineno = 0; + const char *__pyx_filename = NULL; + int __pyx_clineno = 0; + __Pyx_RefNannySetupContext("to_disk", 0); + + /* "spacy/pipeline/_parser_internals/transition_system.pyx":222 + * + * def to_disk(self, path, **kwargs): + * with path.open('wb') as file_: # <<<<<<<<<<<<<< + * file_.write(self.to_bytes(**kwargs)) + * +*/ + /*with:*/ { + __pyx_t_2 = __pyx_v_path; + __Pyx_INCREF(__pyx_t_2); + __pyx_t_3 = 0; + { + PyObject *__pyx_callargs[2] = {__pyx_t_2, __pyx_mstate_global->__pyx_n_u_wb}; + __pyx_t_1 = __Pyx_PyObject_FastCallMethod((PyObject*)__pyx_mstate_global->__pyx_n_u_open, __pyx_callargs+__pyx_t_3, (2-__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, 222, __pyx_L1_error) + __Pyx_GOTREF(__pyx_t_1); + } + __pyx_t_4 = __Pyx_PyObject_LookupSpecial(__pyx_t_1, __pyx_mstate_global->__pyx_n_u_exit); if (unlikely(!__pyx_t_4)) __PYX_ERR(0, 222, __pyx_L1_error) + __Pyx_GOTREF(__pyx_t_4); + __pyx_t_5 = NULL; + __pyx_t_6 = __Pyx_PyObject_LookupSpecial(__pyx_t_1, __pyx_mstate_global->__pyx_n_u_enter); if (unlikely(!__pyx_t_6)) __PYX_ERR(0, 222, __pyx_L3_error) + __Pyx_GOTREF(__pyx_t_6); + __pyx_t_3 = 1; + #if CYTHON_UNPACK_METHODS + if (likely(PyMethod_Check(__pyx_t_6))) { + __pyx_t_5 = PyMethod_GET_SELF(__pyx_t_6); + assert(__pyx_t_5); + PyObject* __pyx__function = PyMethod_GET_FUNCTION(__pyx_t_6); + __Pyx_INCREF(__pyx_t_5); + __Pyx_INCREF(__pyx__function); + __Pyx_DECREF_SET(__pyx_t_6, __pyx__function); + __pyx_t_3 = 0; + } + #endif + { + PyObject *__pyx_callargs[2] = {__pyx_t_5, NULL}; + __pyx_t_2 = __Pyx_PyObject_FastCall((PyObject*)__pyx_t_6, __pyx_callargs+__pyx_t_3, (1-__pyx_t_3) | (__pyx_t_3*__Pyx_PY_VECTORCALL_ARGUMENTS_OFFSET)); + __Pyx_XDECREF(__pyx_t_5); __pyx_t_5 = 0; + __Pyx_DECREF(__pyx_t_6); __pyx_t_6 = 0; + if (unlikely(!__pyx_t_2)) __PYX_ERR(0, 222, __pyx_L3_error) + __Pyx_GOTREF(__pyx_t_2); + } + __pyx_t_6 = __pyx_t_2; + __pyx_t_2 = 0; + __Pyx_DECREF(__pyx_t_1); __pyx_t_1 = 0; + /*try:*/ { + { + __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:*/ { + __pyx_v_file_ = __pyx_t_6; + __pyx_t_6 = 0; + + /* "spacy/pipeline/_parser_internals/transition_system.pyx":223 + * def to_disk(self, path, **kwargs): + * with path.open('wb') as file_: + * file_.write(self.to_bytes(**kwargs)) # <<<<<<<<<<<<<< + * + * def from_disk(self, path, **kwargs): +*/ + __pyx_t_1 = __pyx_v_file_; + __Pyx_INCREF(__pyx_t_1); + __pyx_t_2 = __Pyx_PyObject_GetAttrStr(((PyObject *)__pyx_v_self), __pyx_mstate_global->__pyx_n_u_to_bytes); if (unlikely(!__pyx_t_2)) __PYX_ERR(0, 223, __pyx_L7_error) + __Pyx_GOTREF(__pyx_t_2); + __pyx_t_5 = PyDict_Copy(__pyx_v_kwargs); if (unlikely(!__pyx_t_5)) __PYX_ERR(0, 223, __pyx_L7_error) + __Pyx_GOTREF(__pyx_t_5); + __pyx_t_10 = __Pyx_PyObject_Call(__pyx_t_2, __pyx_mstate_global->__pyx_empty_tuple, __pyx_t_5); if (unlikely(!__pyx_t_10)) __PYX_ERR(0, 223, __pyx_L7_error) + __Pyx_GOTREF(__pyx_t_10); + __Pyx_DECREF(__pyx_t_2); __pyx_t_2 = 0; + __Pyx_DECREF(__pyx_t_5); __pyx_t_5 = 0; + __pyx_t_3 = 0; + { + PyObject *__pyx_callargs[2] = {__pyx_t_1, __pyx_t_10}; + __pyx_t_6 = __Pyx_PyObject_FastCallMethod((PyObject*)__pyx_mstate_global->__pyx_n_u_write, __pyx_callargs+__pyx_t_3, (2-__pyx_t_3) | (1*__Pyx_PY_VECTORCALL_ARGUMENTS_OFFSET)); + __Pyx_XDECREF(__pyx_t_1); __pyx_t_1 = 0; + __Pyx_DECREF(__pyx_t_10); __pyx_t_10 = 0; + if (unlikely(!__pyx_t_6)) __PYX_ERR(0, 223, __pyx_L7_error) + __Pyx_GOTREF(__pyx_t_6); + } + __Pyx_DECREF(__pyx_t_6); __pyx_t_6 = 0; + + /* "spacy/pipeline/_parser_internals/transition_system.pyx":222 + * + * def to_disk(self, path, **kwargs): + * with path.open('wb') as file_: # <<<<<<<<<<<<<< + * file_.write(self.to_bytes(**kwargs)) + * +*/ + } + __Pyx_XDECREF(__pyx_t_7); __pyx_t_7 = 0; + __Pyx_XDECREF(__pyx_t_8); __pyx_t_8 = 0; + __Pyx_XDECREF(__pyx_t_9); __pyx_t_9 = 0; + goto __pyx_L12_try_end; + __pyx_L7_error:; + __Pyx_XDECREF(__pyx_t_1); __pyx_t_1 = 0; + __Pyx_XDECREF(__pyx_t_10); __pyx_t_10 = 0; + __Pyx_XDECREF(__pyx_t_2); __pyx_t_2 = 0; + __Pyx_XDECREF(__pyx_t_5); __pyx_t_5 = 0; + __Pyx_XDECREF(__pyx_t_6); __pyx_t_6 = 0; + /*except:*/ { + __Pyx_AddTraceback("spacy.pipeline._parser_internals.transition_system.TransitionSystem.to_disk", __pyx_clineno, __pyx_lineno, __pyx_filename); + if (__Pyx_GetException(&__pyx_t_6, &__pyx_t_10, &__pyx_t_1) < 0) __PYX_ERR(0, 222, __pyx_L9_except_error) + __Pyx_XGOTREF(__pyx_t_6); + __Pyx_XGOTREF(__pyx_t_10); + __Pyx_XGOTREF(__pyx_t_1); + __pyx_t_5 = PyTuple_Pack(3, __pyx_t_6, __pyx_t_10, __pyx_t_1); if (unlikely(!__pyx_t_5)) __PYX_ERR(0, 222, __pyx_L9_except_error) + __Pyx_GOTREF(__pyx_t_5); + __pyx_t_11 = __Pyx_PyObject_Call(__pyx_t_4, __pyx_t_5, NULL); + __Pyx_DECREF(__pyx_t_4); __pyx_t_4 = 0; + __Pyx_DECREF(__pyx_t_5); __pyx_t_5 = 0; + if (unlikely(!__pyx_t_11)) __PYX_ERR(0, 222, __pyx_L9_except_error) + __Pyx_GOTREF(__pyx_t_11); + __pyx_t_12 = __Pyx_PyObject_IsTrue(__pyx_t_11); + __Pyx_DECREF(__pyx_t_11); __pyx_t_11 = 0; + if (__pyx_t_12 < (0)) __PYX_ERR(0, 222, __pyx_L9_except_error) + __pyx_t_13 = (!__pyx_t_12); + if (unlikely(__pyx_t_13)) { + __Pyx_GIVEREF(__pyx_t_6); + __Pyx_GIVEREF(__pyx_t_10); + __Pyx_XGIVEREF(__pyx_t_1); + __Pyx_ErrRestoreWithState(__pyx_t_6, __pyx_t_10, __pyx_t_1); + __pyx_t_6 = 0; __pyx_t_10 = 0; __pyx_t_1 = 0; + __PYX_ERR(0, 222, __pyx_L9_except_error) + } + __Pyx_XDECREF(__pyx_t_6); __pyx_t_6 = 0; + __Pyx_XDECREF(__pyx_t_10); __pyx_t_10 = 0; + __Pyx_XDECREF(__pyx_t_1); __pyx_t_1 = 0; + goto __pyx_L8_exception_handled; + } + __pyx_L9_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_exception_handled:; + __Pyx_XGIVEREF(__pyx_t_7); + __Pyx_XGIVEREF(__pyx_t_8); + __Pyx_XGIVEREF(__pyx_t_9); + __Pyx_ExceptionReset(__pyx_t_7, __pyx_t_8, __pyx_t_9); + __pyx_L12_try_end:; + } + } + /*finally:*/ { + /*normal exit:*/{ + if (__pyx_t_4) { + __pyx_t_9 = __Pyx_PyObject_Call(__pyx_t_4, __pyx_mstate_global->__pyx_tuple[2], NULL); + __Pyx_DECREF(__pyx_t_4); __pyx_t_4 = 0; + if (unlikely(!__pyx_t_9)) __PYX_ERR(0, 222, __pyx_L1_error) + __Pyx_GOTREF(__pyx_t_9); + __Pyx_DECREF(__pyx_t_9); __pyx_t_9 = 0; + } + goto __pyx_L6; + } + __pyx_L6:; + } + goto __pyx_L16; + __pyx_L3_error:; + __Pyx_DECREF(__pyx_t_4); __pyx_t_4 = 0; + goto __pyx_L1_error; + __pyx_L16:; + } + + /* "spacy/pipeline/_parser_internals/transition_system.pyx":221 + * return 1 + * + * def to_disk(self, path, **kwargs): # <<<<<<<<<<<<<< + * with path.open('wb') as file_: + * file_.write(self.to_bytes(**kwargs)) +*/ + + /* 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_5); + __Pyx_XDECREF(__pyx_t_6); + __Pyx_XDECREF(__pyx_t_10); + __Pyx_AddTraceback("spacy.pipeline._parser_internals.transition_system.TransitionSystem.to_disk", __pyx_clineno, __pyx_lineno, __pyx_filename); + __pyx_r = NULL; + __pyx_L0:; + __Pyx_XDECREF(__pyx_v_file_); + __Pyx_XGIVEREF(__pyx_r); + __Pyx_RefNannyFinishContext(); + return __pyx_r; +} + +/* "spacy/pipeline/_parser_internals/transition_system.pyx":225 + * file_.write(self.to_bytes(**kwargs)) + * + * def from_disk(self, path, **kwargs): # <<<<<<<<<<<<<< + * with path.open('rb') as file_: + * byte_data = file_.read() +*/ + +/* Python wrapper */ +static PyObject *__pyx_pw_5spacy_8pipeline_17_parser_internals_17transition_system_16TransitionSystem_23from_disk(PyObject *__pyx_v_self, +#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_5spacy_8pipeline_17_parser_internals_17transition_system_16TransitionSystem_22from_disk, "TransitionSystem.from_disk(self, path, **kwargs)"); +static PyMethodDef __pyx_mdef_5spacy_8pipeline_17_parser_internals_17transition_system_16TransitionSystem_23from_disk = {"from_disk", (PyCFunction)(void(*)(void))(__Pyx_PyCFunction_FastCallWithKeywords)__pyx_pw_5spacy_8pipeline_17_parser_internals_17transition_system_16TransitionSystem_23from_disk, __Pyx_METH_FASTCALL|METH_KEYWORDS, __pyx_doc_5spacy_8pipeline_17_parser_internals_17transition_system_16TransitionSystem_22from_disk}; +static PyObject *__pyx_pw_5spacy_8pipeline_17_parser_internals_17transition_system_16TransitionSystem_23from_disk(PyObject *__pyx_v_self, +#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; + PyObject *__pyx_v_kwargs = 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("from_disk (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); + __pyx_v_kwargs = PyDict_New(); if (unlikely(!__pyx_v_kwargs)) return NULL; + __Pyx_GOTREF(__pyx_v_kwargs); + { + 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, 225, __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, 225, __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, __pyx_v_kwargs, values, kwd_pos_args, __pyx_kwds_len, "from_disk", 1) < (0)) __PYX_ERR(0, 225, __pyx_L3_error) + for (Py_ssize_t i = __pyx_nargs; i < 1; i++) { + if (unlikely(!values[i])) { __Pyx_RaiseArgtupleInvalid("from_disk", 1, 1, 1, i); __PYX_ERR(0, 225, __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, 225, __pyx_L3_error) + } + __pyx_v_path = values[0]; + } + goto __pyx_L6_skip; + __pyx_L5_argtuple_error:; + __Pyx_RaiseArgtupleInvalid("from_disk", 1, 1, 1, __pyx_nargs); __PYX_ERR(0, 225, __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_DECREF(__pyx_v_kwargs); __pyx_v_kwargs = 0; + __Pyx_AddTraceback("spacy.pipeline._parser_internals.transition_system.TransitionSystem.from_disk", __pyx_clineno, __pyx_lineno, __pyx_filename); + __Pyx_RefNannyFinishContext(); + return NULL; + __pyx_L4_argument_unpacking_done:; + __pyx_r = __pyx_pf_5spacy_8pipeline_17_parser_internals_17transition_system_16TransitionSystem_22from_disk(((struct __pyx_obj_5spacy_8pipeline_17_parser_internals_17transition_system_TransitionSystem *)__pyx_v_self), __pyx_v_path, __pyx_v_kwargs); + + /* 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_DECREF(__pyx_v_kwargs); + __Pyx_RefNannyFinishContext(); + return __pyx_r; +} + +static PyObject *__pyx_pf_5spacy_8pipeline_17_parser_internals_17transition_system_16TransitionSystem_22from_disk(struct __pyx_obj_5spacy_8pipeline_17_parser_internals_17transition_system_TransitionSystem *__pyx_v_self, PyObject *__pyx_v_path, PyObject *__pyx_v_kwargs) { + PyObject *__pyx_v_file_ = NULL; + PyObject *__pyx_v_byte_data = NULL; + PyObject *__pyx_r = NULL; + __Pyx_RefNannyDeclarations + PyObject *__pyx_t_1 = NULL; + PyObject *__pyx_t_2 = NULL; + size_t __pyx_t_3; + PyObject *__pyx_t_4 = NULL; + PyObject *__pyx_t_5 = NULL; + PyObject *__pyx_t_6 = NULL; + PyObject *__pyx_t_7 = NULL; + PyObject *__pyx_t_8 = NULL; + PyObject *__pyx_t_9 = NULL; + PyObject *__pyx_t_10 = NULL; + int __pyx_t_11; + int __pyx_t_12; + int __pyx_lineno = 0; + const char *__pyx_filename = NULL; + int __pyx_clineno = 0; + __Pyx_RefNannySetupContext("from_disk", 0); + + /* "spacy/pipeline/_parser_internals/transition_system.pyx":226 + * + * def from_disk(self, path, **kwargs): + * with path.open('rb') as file_: # <<<<<<<<<<<<<< + * byte_data = file_.read() + * self.from_bytes(byte_data, **kwargs) +*/ + /*with:*/ { + __pyx_t_2 = __pyx_v_path; + __Pyx_INCREF(__pyx_t_2); + __pyx_t_3 = 0; + { + PyObject *__pyx_callargs[2] = {__pyx_t_2, __pyx_mstate_global->__pyx_n_u_rb}; + __pyx_t_1 = __Pyx_PyObject_FastCallMethod((PyObject*)__pyx_mstate_global->__pyx_n_u_open, __pyx_callargs+__pyx_t_3, (2-__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, 226, __pyx_L1_error) + __Pyx_GOTREF(__pyx_t_1); + } + __pyx_t_4 = __Pyx_PyObject_LookupSpecial(__pyx_t_1, __pyx_mstate_global->__pyx_n_u_exit); if (unlikely(!__pyx_t_4)) __PYX_ERR(0, 226, __pyx_L1_error) + __Pyx_GOTREF(__pyx_t_4); + __pyx_t_5 = NULL; + __pyx_t_6 = __Pyx_PyObject_LookupSpecial(__pyx_t_1, __pyx_mstate_global->__pyx_n_u_enter); if (unlikely(!__pyx_t_6)) __PYX_ERR(0, 226, __pyx_L3_error) + __Pyx_GOTREF(__pyx_t_6); + __pyx_t_3 = 1; + #if CYTHON_UNPACK_METHODS + if (likely(PyMethod_Check(__pyx_t_6))) { + __pyx_t_5 = PyMethod_GET_SELF(__pyx_t_6); + assert(__pyx_t_5); + PyObject* __pyx__function = PyMethod_GET_FUNCTION(__pyx_t_6); + __Pyx_INCREF(__pyx_t_5); + __Pyx_INCREF(__pyx__function); + __Pyx_DECREF_SET(__pyx_t_6, __pyx__function); + __pyx_t_3 = 0; + } + #endif + { + PyObject *__pyx_callargs[2] = {__pyx_t_5, NULL}; + __pyx_t_2 = __Pyx_PyObject_FastCall((PyObject*)__pyx_t_6, __pyx_callargs+__pyx_t_3, (1-__pyx_t_3) | (__pyx_t_3*__Pyx_PY_VECTORCALL_ARGUMENTS_OFFSET)); + __Pyx_XDECREF(__pyx_t_5); __pyx_t_5 = 0; + __Pyx_DECREF(__pyx_t_6); __pyx_t_6 = 0; + if (unlikely(!__pyx_t_2)) __PYX_ERR(0, 226, __pyx_L3_error) + __Pyx_GOTREF(__pyx_t_2); + } + __pyx_t_6 = __pyx_t_2; + __pyx_t_2 = 0; + __Pyx_DECREF(__pyx_t_1); __pyx_t_1 = 0; + /*try:*/ { + { + __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:*/ { + __pyx_v_file_ = __pyx_t_6; + __pyx_t_6 = 0; + + /* "spacy/pipeline/_parser_internals/transition_system.pyx":227 + * def from_disk(self, path, **kwargs): + * with path.open('rb') as file_: + * byte_data = file_.read() # <<<<<<<<<<<<<< + * self.from_bytes(byte_data, **kwargs) + * return self +*/ + __pyx_t_1 = __pyx_v_file_; + __Pyx_INCREF(__pyx_t_1); + __pyx_t_3 = 0; + { + PyObject *__pyx_callargs[2] = {__pyx_t_1, NULL}; + __pyx_t_6 = __Pyx_PyObject_FastCallMethod((PyObject*)__pyx_mstate_global->__pyx_n_u_read, __pyx_callargs+__pyx_t_3, (1-__pyx_t_3) | (1*__Pyx_PY_VECTORCALL_ARGUMENTS_OFFSET)); + __Pyx_XDECREF(__pyx_t_1); __pyx_t_1 = 0; + if (unlikely(!__pyx_t_6)) __PYX_ERR(0, 227, __pyx_L7_error) + __Pyx_GOTREF(__pyx_t_6); + } + __pyx_v_byte_data = __pyx_t_6; + __pyx_t_6 = 0; + + /* "spacy/pipeline/_parser_internals/transition_system.pyx":226 + * + * def from_disk(self, path, **kwargs): + * with path.open('rb') as file_: # <<<<<<<<<<<<<< + * byte_data = file_.read() + * self.from_bytes(byte_data, **kwargs) +*/ + } + __Pyx_XDECREF(__pyx_t_7); __pyx_t_7 = 0; + __Pyx_XDECREF(__pyx_t_8); __pyx_t_8 = 0; + __Pyx_XDECREF(__pyx_t_9); __pyx_t_9 = 0; + goto __pyx_L12_try_end; + __pyx_L7_error:; + __Pyx_XDECREF(__pyx_t_1); __pyx_t_1 = 0; + __Pyx_XDECREF(__pyx_t_2); __pyx_t_2 = 0; + __Pyx_XDECREF(__pyx_t_5); __pyx_t_5 = 0; + __Pyx_XDECREF(__pyx_t_6); __pyx_t_6 = 0; + /*except:*/ { + __Pyx_AddTraceback("spacy.pipeline._parser_internals.transition_system.TransitionSystem.from_disk", __pyx_clineno, __pyx_lineno, __pyx_filename); + if (__Pyx_GetException(&__pyx_t_6, &__pyx_t_1, &__pyx_t_2) < 0) __PYX_ERR(0, 226, __pyx_L9_except_error) + __Pyx_XGOTREF(__pyx_t_6); + __Pyx_XGOTREF(__pyx_t_1); + __Pyx_XGOTREF(__pyx_t_2); + __pyx_t_5 = PyTuple_Pack(3, __pyx_t_6, __pyx_t_1, __pyx_t_2); if (unlikely(!__pyx_t_5)) __PYX_ERR(0, 226, __pyx_L9_except_error) + __Pyx_GOTREF(__pyx_t_5); + __pyx_t_10 = __Pyx_PyObject_Call(__pyx_t_4, __pyx_t_5, NULL); + __Pyx_DECREF(__pyx_t_4); __pyx_t_4 = 0; + __Pyx_DECREF(__pyx_t_5); __pyx_t_5 = 0; + if (unlikely(!__pyx_t_10)) __PYX_ERR(0, 226, __pyx_L9_except_error) + __Pyx_GOTREF(__pyx_t_10); + __pyx_t_11 = __Pyx_PyObject_IsTrue(__pyx_t_10); + __Pyx_DECREF(__pyx_t_10); __pyx_t_10 = 0; + if (__pyx_t_11 < (0)) __PYX_ERR(0, 226, __pyx_L9_except_error) + __pyx_t_12 = (!__pyx_t_11); + if (unlikely(__pyx_t_12)) { + __Pyx_GIVEREF(__pyx_t_6); + __Pyx_GIVEREF(__pyx_t_1); + __Pyx_XGIVEREF(__pyx_t_2); + __Pyx_ErrRestoreWithState(__pyx_t_6, __pyx_t_1, __pyx_t_2); + __pyx_t_6 = 0; __pyx_t_1 = 0; __pyx_t_2 = 0; + __PYX_ERR(0, 226, __pyx_L9_except_error) + } + __Pyx_XDECREF(__pyx_t_6); __pyx_t_6 = 0; + __Pyx_XDECREF(__pyx_t_1); __pyx_t_1 = 0; + __Pyx_XDECREF(__pyx_t_2); __pyx_t_2 = 0; + goto __pyx_L8_exception_handled; + } + __pyx_L9_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_exception_handled:; + __Pyx_XGIVEREF(__pyx_t_7); + __Pyx_XGIVEREF(__pyx_t_8); + __Pyx_XGIVEREF(__pyx_t_9); + __Pyx_ExceptionReset(__pyx_t_7, __pyx_t_8, __pyx_t_9); + __pyx_L12_try_end:; + } + } + /*finally:*/ { + /*normal exit:*/{ + if (__pyx_t_4) { + __pyx_t_9 = __Pyx_PyObject_Call(__pyx_t_4, __pyx_mstate_global->__pyx_tuple[2], NULL); + __Pyx_DECREF(__pyx_t_4); __pyx_t_4 = 0; + if (unlikely(!__pyx_t_9)) __PYX_ERR(0, 226, __pyx_L1_error) + __Pyx_GOTREF(__pyx_t_9); + __Pyx_DECREF(__pyx_t_9); __pyx_t_9 = 0; + } + goto __pyx_L6; + } + __pyx_L6:; + } + goto __pyx_L16; + __pyx_L3_error:; + __Pyx_DECREF(__pyx_t_4); __pyx_t_4 = 0; + goto __pyx_L1_error; + __pyx_L16:; + } + + /* "spacy/pipeline/_parser_internals/transition_system.pyx":228 + * with path.open('rb') as file_: + * byte_data = file_.read() + * self.from_bytes(byte_data, **kwargs) # <<<<<<<<<<<<<< + * return self + * +*/ + __pyx_t_1 = NULL; + __pyx_t_6 = __Pyx_PyObject_GetAttrStr(((PyObject *)__pyx_v_self), __pyx_mstate_global->__pyx_n_u_from_bytes); if (unlikely(!__pyx_t_6)) __PYX_ERR(0, 228, __pyx_L1_error) + __Pyx_GOTREF(__pyx_t_6); + if (unlikely(!__pyx_v_byte_data)) { __Pyx_RaiseUnboundLocalError("byte_data"); __PYX_ERR(0, 228, __pyx_L1_error) } + __pyx_t_5 = PyDict_Copy(__pyx_v_kwargs); if (unlikely(!__pyx_t_5)) __PYX_ERR(0, 228, __pyx_L1_error) + __Pyx_GOTREF(__pyx_t_5); + __pyx_t_3 = 1; + #if CYTHON_UNPACK_METHODS + if (likely(PyMethod_Check(__pyx_t_6))) { + __pyx_t_1 = PyMethod_GET_SELF(__pyx_t_6); + assert(__pyx_t_1); + PyObject* __pyx__function = PyMethod_GET_FUNCTION(__pyx_t_6); + __Pyx_INCREF(__pyx_t_1); + __Pyx_INCREF(__pyx__function); + __Pyx_DECREF_SET(__pyx_t_6, __pyx__function); + __pyx_t_3 = 0; + } + #endif + { + PyObject *__pyx_callargs[2] = {__pyx_t_1, __pyx_v_byte_data}; + __pyx_t_2 = __Pyx_PyObject_FastCallDict((PyObject*)__pyx_t_6, __pyx_callargs+__pyx_t_3, (2-__pyx_t_3) | (__pyx_t_3*__Pyx_PY_VECTORCALL_ARGUMENTS_OFFSET), __pyx_t_5); + __Pyx_XDECREF(__pyx_t_1); __pyx_t_1 = 0; + __Pyx_DECREF(__pyx_t_5); __pyx_t_5 = 0; + __Pyx_DECREF(__pyx_t_6); __pyx_t_6 = 0; + if (unlikely(!__pyx_t_2)) __PYX_ERR(0, 228, __pyx_L1_error) + __Pyx_GOTREF(__pyx_t_2); + } + __Pyx_DECREF(__pyx_t_2); __pyx_t_2 = 0; + + /* "spacy/pipeline/_parser_internals/transition_system.pyx":229 + * byte_data = file_.read() + * self.from_bytes(byte_data, **kwargs) + * return self # <<<<<<<<<<<<<< + * + * def to_bytes(self, exclude=tuple()): +*/ + __Pyx_XDECREF(__pyx_r); + __Pyx_INCREF((PyObject *)__pyx_v_self); + __pyx_r = ((PyObject *)__pyx_v_self); + goto __pyx_L0; + + /* "spacy/pipeline/_parser_internals/transition_system.pyx":225 + * file_.write(self.to_bytes(**kwargs)) + * + * def from_disk(self, path, **kwargs): # <<<<<<<<<<<<<< + * with path.open('rb') as file_: + * byte_data = file_.read() +*/ + + /* function exit code */ + __pyx_L1_error:; + __Pyx_XDECREF(__pyx_t_1); + __Pyx_XDECREF(__pyx_t_2); + __Pyx_XDECREF(__pyx_t_5); + __Pyx_XDECREF(__pyx_t_6); + __Pyx_AddTraceback("spacy.pipeline._parser_internals.transition_system.TransitionSystem.from_disk", __pyx_clineno, __pyx_lineno, __pyx_filename); + __pyx_r = NULL; + __pyx_L0:; + __Pyx_XDECREF(__pyx_v_file_); + __Pyx_XDECREF(__pyx_v_byte_data); + __Pyx_XGIVEREF(__pyx_r); + __Pyx_RefNannyFinishContext(); + return __pyx_r; +} + +/* "spacy/pipeline/_parser_internals/transition_system.pyx":231 + * return self + * + * def to_bytes(self, exclude=tuple()): # <<<<<<<<<<<<<< + * serializers = { + * 'moves': lambda: srsly.json_dumps(self.labels), +*/ + +/* Python wrapper */ +static PyObject *__pyx_pw_5spacy_8pipeline_17_parser_internals_17transition_system_16TransitionSystem_25to_bytes(PyObject *__pyx_v_self, +#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_5spacy_8pipeline_17_parser_internals_17transition_system_16TransitionSystem_24to_bytes, "TransitionSystem.to_bytes(self, exclude=tuple())"); +static PyMethodDef __pyx_mdef_5spacy_8pipeline_17_parser_internals_17transition_system_16TransitionSystem_25to_bytes = {"to_bytes", (PyCFunction)(void(*)(void))(__Pyx_PyCFunction_FastCallWithKeywords)__pyx_pw_5spacy_8pipeline_17_parser_internals_17transition_system_16TransitionSystem_25to_bytes, __Pyx_METH_FASTCALL|METH_KEYWORDS, __pyx_doc_5spacy_8pipeline_17_parser_internals_17transition_system_16TransitionSystem_24to_bytes}; +static PyObject *__pyx_pw_5spacy_8pipeline_17_parser_internals_17transition_system_16TransitionSystem_25to_bytes(PyObject *__pyx_v_self, +#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_exclude = 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("to_bytes (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_exclude,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, 231, __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, 231, __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, "to_bytes", 0) < (0)) __PYX_ERR(0, 231, __pyx_L3_error) + if (!values[0]) values[0] = __Pyx_NewRef(__pyx_mstate_global->__pyx_k__11); + } 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, 231, __pyx_L3_error) + CYTHON_FALLTHROUGH; + case 0: break; + default: goto __pyx_L5_argtuple_error; + } + if (!values[0]) values[0] = __Pyx_NewRef(__pyx_mstate_global->__pyx_k__11); + } + __pyx_v_exclude = values[0]; + } + goto __pyx_L6_skip; + __pyx_L5_argtuple_error:; + __Pyx_RaiseArgtupleInvalid("to_bytes", 0, 0, 1, __pyx_nargs); __PYX_ERR(0, 231, __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("spacy.pipeline._parser_internals.transition_system.TransitionSystem.to_bytes", __pyx_clineno, __pyx_lineno, __pyx_filename); + __Pyx_RefNannyFinishContext(); + return NULL; + __pyx_L4_argument_unpacking_done:; + __pyx_r = __pyx_pf_5spacy_8pipeline_17_parser_internals_17transition_system_16TransitionSystem_24to_bytes(((struct __pyx_obj_5spacy_8pipeline_17_parser_internals_17transition_system_TransitionSystem *)__pyx_v_self), __pyx_v_exclude); + + /* 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; +} + +/* "spacy/pipeline/_parser_internals/transition_system.pyx":233 + * def to_bytes(self, exclude=tuple()): + * serializers = { + * 'moves': lambda: srsly.json_dumps(self.labels), # <<<<<<<<<<<<<< + * 'strings': lambda: self.strings.to_bytes(), + * 'cfg': lambda: self.cfg +*/ + +/* Python wrapper */ +static PyObject *__pyx_pw_5spacy_8pipeline_17_parser_internals_17transition_system_16TransitionSystem_8to_bytes_lambda(PyObject *__pyx_self, CYTHON_UNUSED PyObject *unused); /*proto*/ +static PyMethodDef __pyx_mdef_5spacy_8pipeline_17_parser_internals_17transition_system_16TransitionSystem_8to_bytes_lambda = {"lambda", (PyCFunction)__pyx_pw_5spacy_8pipeline_17_parser_internals_17transition_system_16TransitionSystem_8to_bytes_lambda, METH_NOARGS, 0}; +static PyObject *__pyx_pw_5spacy_8pipeline_17_parser_internals_17transition_system_16TransitionSystem_8to_bytes_lambda(PyObject *__pyx_self, CYTHON_UNUSED PyObject *unused) { + CYTHON_UNUSED PyObject *const *__pyx_kwvalues; + PyObject *__pyx_r = 0; + __Pyx_RefNannyDeclarations + __Pyx_RefNannySetupContext("lambda (wrapper)", 0); + __pyx_kwvalues = __Pyx_KwValues_VARARGS(__pyx_args, __pyx_nargs); + __pyx_r = __pyx_lambda_funcdef_lambda(__pyx_self); + + /* function exit code */ + __Pyx_RefNannyFinishContext(); + return __pyx_r; +} + +static PyObject *__pyx_lambda_funcdef_lambda(PyObject *__pyx_self) { + struct __pyx_obj_5spacy_8pipeline_17_parser_internals_17transition_system___pyx_scope_struct__to_bytes *__pyx_cur_scope; + struct __pyx_obj_5spacy_8pipeline_17_parser_internals_17transition_system___pyx_scope_struct__to_bytes *__pyx_outer_scope; + PyObject *__pyx_r = NULL; + __Pyx_RefNannyDeclarations + PyObject *__pyx_t_1 = NULL; + PyObject *__pyx_t_2 = NULL; + PyObject *__pyx_t_3 = NULL; + PyObject *__pyx_t_4 = NULL; + size_t __pyx_t_5; + int __pyx_lineno = 0; + const char *__pyx_filename = NULL; + int __pyx_clineno = 0; + __Pyx_RefNannySetupContext("lambda", 0); + __pyx_outer_scope = (struct __pyx_obj_5spacy_8pipeline_17_parser_internals_17transition_system___pyx_scope_struct__to_bytes *) __Pyx_CyFunction_GetClosure(__pyx_self); + __pyx_cur_scope = __pyx_outer_scope; + __Pyx_XDECREF(__pyx_r); + __pyx_t_2 = NULL; + __Pyx_GetModuleGlobalName(__pyx_t_3, __pyx_mstate_global->__pyx_n_u_srsly); if (unlikely(!__pyx_t_3)) __PYX_ERR(0, 233, __pyx_L1_error) + __Pyx_GOTREF(__pyx_t_3); + __pyx_t_4 = __Pyx_PyObject_GetAttrStr(__pyx_t_3, __pyx_mstate_global->__pyx_n_u_json_dumps); if (unlikely(!__pyx_t_4)) __PYX_ERR(0, 233, __pyx_L1_error) + __Pyx_GOTREF(__pyx_t_4); + __Pyx_DECREF(__pyx_t_3); __pyx_t_3 = 0; + if (unlikely(!__pyx_cur_scope->__pyx_v_self)) { __Pyx_RaiseClosureNameError("self"); __PYX_ERR(0, 233, __pyx_L1_error) } + __pyx_t_5 = 1; + #if CYTHON_UNPACK_METHODS + if (unlikely(PyMethod_Check(__pyx_t_4))) { + __pyx_t_2 = PyMethod_GET_SELF(__pyx_t_4); + assert(__pyx_t_2); + PyObject* __pyx__function = PyMethod_GET_FUNCTION(__pyx_t_4); + __Pyx_INCREF(__pyx_t_2); + __Pyx_INCREF(__pyx__function); + __Pyx_DECREF_SET(__pyx_t_4, __pyx__function); + __pyx_t_5 = 0; + } + #endif + { + PyObject *__pyx_callargs[2] = {__pyx_t_2, __pyx_cur_scope->__pyx_v_self->labels}; + __pyx_t_1 = __Pyx_PyObject_FastCall((PyObject*)__pyx_t_4, __pyx_callargs+__pyx_t_5, (2-__pyx_t_5) | (__pyx_t_5*__Pyx_PY_VECTORCALL_ARGUMENTS_OFFSET)); + __Pyx_XDECREF(__pyx_t_2); __pyx_t_2 = 0; + __Pyx_DECREF(__pyx_t_4); __pyx_t_4 = 0; + if (unlikely(!__pyx_t_1)) __PYX_ERR(0, 233, __pyx_L1_error) + __Pyx_GOTREF(__pyx_t_1); + } + __pyx_r = __pyx_t_1; + __pyx_t_1 = 0; + goto __pyx_L0; + + /* function exit code */ + __pyx_L1_error:; + __Pyx_XDECREF(__pyx_t_1); + __Pyx_XDECREF(__pyx_t_2); + __Pyx_XDECREF(__pyx_t_3); + __Pyx_XDECREF(__pyx_t_4); + __Pyx_AddTraceback("spacy.pipeline._parser_internals.transition_system.TransitionSystem.to_bytes.lambda", __pyx_clineno, __pyx_lineno, __pyx_filename); + __pyx_r = NULL; + __pyx_L0:; + __Pyx_XGIVEREF(__pyx_r); + __Pyx_RefNannyFinishContext(); + return __pyx_r; +} + +/* "spacy/pipeline/_parser_internals/transition_system.pyx":234 + * serializers = { + * 'moves': lambda: srsly.json_dumps(self.labels), + * 'strings': lambda: self.strings.to_bytes(), # <<<<<<<<<<<<<< + * 'cfg': lambda: self.cfg + * } +*/ + +/* Python wrapper */ +static PyObject *__pyx_pw_5spacy_8pipeline_17_parser_internals_17transition_system_16TransitionSystem_8to_bytes_1lambda1(PyObject *__pyx_self, CYTHON_UNUSED PyObject *unused); /*proto*/ +static PyMethodDef __pyx_mdef_5spacy_8pipeline_17_parser_internals_17transition_system_16TransitionSystem_8to_bytes_1lambda1 = {"lambda1", (PyCFunction)__pyx_pw_5spacy_8pipeline_17_parser_internals_17transition_system_16TransitionSystem_8to_bytes_1lambda1, METH_NOARGS, 0}; +static PyObject *__pyx_pw_5spacy_8pipeline_17_parser_internals_17transition_system_16TransitionSystem_8to_bytes_1lambda1(PyObject *__pyx_self, CYTHON_UNUSED PyObject *unused) { + CYTHON_UNUSED PyObject *const *__pyx_kwvalues; + PyObject *__pyx_r = 0; + __Pyx_RefNannyDeclarations + __Pyx_RefNannySetupContext("lambda1 (wrapper)", 0); + __pyx_kwvalues = __Pyx_KwValues_VARARGS(__pyx_args, __pyx_nargs); + __pyx_r = __pyx_lambda_funcdef_lambda1(__pyx_self); + + /* function exit code */ + __Pyx_RefNannyFinishContext(); + return __pyx_r; +} + +static PyObject *__pyx_lambda_funcdef_lambda1(PyObject *__pyx_self) { + struct __pyx_obj_5spacy_8pipeline_17_parser_internals_17transition_system___pyx_scope_struct__to_bytes *__pyx_cur_scope; + struct __pyx_obj_5spacy_8pipeline_17_parser_internals_17transition_system___pyx_scope_struct__to_bytes *__pyx_outer_scope; + 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("lambda1", 0); + __pyx_outer_scope = (struct __pyx_obj_5spacy_8pipeline_17_parser_internals_17transition_system___pyx_scope_struct__to_bytes *) __Pyx_CyFunction_GetClosure(__pyx_self); + __pyx_cur_scope = __pyx_outer_scope; + __Pyx_XDECREF(__pyx_r); + if (unlikely(!__pyx_cur_scope->__pyx_v_self)) { __Pyx_RaiseClosureNameError("self"); __PYX_ERR(0, 234, __pyx_L1_error) } + __pyx_t_2 = ((PyObject *)__pyx_cur_scope->__pyx_v_self->strings); + __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_to_bytes, __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, 234, __pyx_L1_error) + __Pyx_GOTREF(__pyx_t_1); + } + __pyx_r = __pyx_t_1; + __pyx_t_1 = 0; + goto __pyx_L0; + + /* function exit code */ + __pyx_L1_error:; + __Pyx_XDECREF(__pyx_t_1); + __Pyx_XDECREF(__pyx_t_2); + __Pyx_AddTraceback("spacy.pipeline._parser_internals.transition_system.TransitionSystem.to_bytes.lambda1", __pyx_clineno, __pyx_lineno, __pyx_filename); + __pyx_r = NULL; + __pyx_L0:; + __Pyx_XGIVEREF(__pyx_r); + __Pyx_RefNannyFinishContext(); + return __pyx_r; +} + +/* "spacy/pipeline/_parser_internals/transition_system.pyx":235 + * 'moves': lambda: srsly.json_dumps(self.labels), + * 'strings': lambda: self.strings.to_bytes(), + * 'cfg': lambda: self.cfg # <<<<<<<<<<<<<< + * } + * return util.to_bytes(serializers, exclude) +*/ + +/* Python wrapper */ +static PyObject *__pyx_pw_5spacy_8pipeline_17_parser_internals_17transition_system_16TransitionSystem_8to_bytes_2lambda2(PyObject *__pyx_self, CYTHON_UNUSED PyObject *unused); /*proto*/ +static PyMethodDef __pyx_mdef_5spacy_8pipeline_17_parser_internals_17transition_system_16TransitionSystem_8to_bytes_2lambda2 = {"lambda2", (PyCFunction)__pyx_pw_5spacy_8pipeline_17_parser_internals_17transition_system_16TransitionSystem_8to_bytes_2lambda2, METH_NOARGS, 0}; +static PyObject *__pyx_pw_5spacy_8pipeline_17_parser_internals_17transition_system_16TransitionSystem_8to_bytes_2lambda2(PyObject *__pyx_self, CYTHON_UNUSED PyObject *unused) { + CYTHON_UNUSED PyObject *const *__pyx_kwvalues; + PyObject *__pyx_r = 0; + __Pyx_RefNannyDeclarations + __Pyx_RefNannySetupContext("lambda2 (wrapper)", 0); + __pyx_kwvalues = __Pyx_KwValues_VARARGS(__pyx_args, __pyx_nargs); + __pyx_r = __pyx_lambda_funcdef_lambda2(__pyx_self); + + /* function exit code */ + __Pyx_RefNannyFinishContext(); + return __pyx_r; +} + +static PyObject *__pyx_lambda_funcdef_lambda2(PyObject *__pyx_self) { + struct __pyx_obj_5spacy_8pipeline_17_parser_internals_17transition_system___pyx_scope_struct__to_bytes *__pyx_cur_scope; + struct __pyx_obj_5spacy_8pipeline_17_parser_internals_17transition_system___pyx_scope_struct__to_bytes *__pyx_outer_scope; + PyObject *__pyx_r = NULL; + __Pyx_RefNannyDeclarations + int __pyx_lineno = 0; + const char *__pyx_filename = NULL; + int __pyx_clineno = 0; + __Pyx_RefNannySetupContext("lambda2", 0); + __pyx_outer_scope = (struct __pyx_obj_5spacy_8pipeline_17_parser_internals_17transition_system___pyx_scope_struct__to_bytes *) __Pyx_CyFunction_GetClosure(__pyx_self); + __pyx_cur_scope = __pyx_outer_scope; + __Pyx_XDECREF(__pyx_r); + if (unlikely(!__pyx_cur_scope->__pyx_v_self)) { __Pyx_RaiseClosureNameError("self"); __PYX_ERR(0, 235, __pyx_L1_error) } + __Pyx_INCREF(__pyx_cur_scope->__pyx_v_self->cfg); + __pyx_r = __pyx_cur_scope->__pyx_v_self->cfg; + goto __pyx_L0; + + /* function exit code */ + __pyx_L1_error:; + __Pyx_AddTraceback("spacy.pipeline._parser_internals.transition_system.TransitionSystem.to_bytes.lambda2", __pyx_clineno, __pyx_lineno, __pyx_filename); + __pyx_r = NULL; + __pyx_L0:; + __Pyx_XGIVEREF(__pyx_r); + __Pyx_RefNannyFinishContext(); + return __pyx_r; +} + +/* "spacy/pipeline/_parser_internals/transition_system.pyx":231 + * return self + * + * def to_bytes(self, exclude=tuple()): # <<<<<<<<<<<<<< + * serializers = { + * 'moves': lambda: srsly.json_dumps(self.labels), +*/ + +static PyObject *__pyx_pf_5spacy_8pipeline_17_parser_internals_17transition_system_16TransitionSystem_24to_bytes(struct __pyx_obj_5spacy_8pipeline_17_parser_internals_17transition_system_TransitionSystem *__pyx_v_self, PyObject *__pyx_v_exclude) { + struct __pyx_obj_5spacy_8pipeline_17_parser_internals_17transition_system___pyx_scope_struct__to_bytes *__pyx_cur_scope; + PyObject *__pyx_v_serializers = NULL; + PyObject *__pyx_r = NULL; + __Pyx_RefNannyDeclarations + PyObject *__pyx_t_1 = NULL; + PyObject *__pyx_t_2 = NULL; + PyObject *__pyx_t_3 = NULL; + PyObject *__pyx_t_4 = NULL; + size_t __pyx_t_5; + int __pyx_lineno = 0; + const char *__pyx_filename = NULL; + int __pyx_clineno = 0; + __Pyx_RefNannySetupContext("to_bytes", 0); + __pyx_cur_scope = (struct __pyx_obj_5spacy_8pipeline_17_parser_internals_17transition_system___pyx_scope_struct__to_bytes *)__pyx_tp_new_5spacy_8pipeline_17_parser_internals_17transition_system___pyx_scope_struct__to_bytes(__pyx_mstate_global->__pyx_ptype_5spacy_8pipeline_17_parser_internals_17transition_system___pyx_scope_struct__to_bytes, __pyx_mstate_global->__pyx_empty_tuple, NULL); + if (unlikely(!__pyx_cur_scope)) { + __pyx_cur_scope = ((struct __pyx_obj_5spacy_8pipeline_17_parser_internals_17transition_system___pyx_scope_struct__to_bytes *)Py_None); + __Pyx_INCREF(Py_None); + __PYX_ERR(0, 231, __pyx_L1_error) + } else { + __Pyx_GOTREF((PyObject *)__pyx_cur_scope); + } + __pyx_cur_scope->__pyx_v_self = __pyx_v_self; + __Pyx_INCREF((PyObject *)__pyx_cur_scope->__pyx_v_self); + __Pyx_GIVEREF((PyObject *)__pyx_cur_scope->__pyx_v_self); + + /* "spacy/pipeline/_parser_internals/transition_system.pyx":233 + * def to_bytes(self, exclude=tuple()): + * serializers = { + * 'moves': lambda: srsly.json_dumps(self.labels), # <<<<<<<<<<<<<< + * 'strings': lambda: self.strings.to_bytes(), + * 'cfg': lambda: self.cfg +*/ + __pyx_t_1 = __Pyx_PyDict_NewPresized(3); if (unlikely(!__pyx_t_1)) __PYX_ERR(0, 233, __pyx_L1_error) + __Pyx_GOTREF(__pyx_t_1); + __pyx_t_2 = __Pyx_CyFunction_New(&__pyx_mdef_5spacy_8pipeline_17_parser_internals_17transition_system_16TransitionSystem_8to_bytes_lambda, 0, __pyx_mstate_global->__pyx_n_u_to_bytes_locals_lambda, ((PyObject*)__pyx_cur_scope), __pyx_mstate_global->__pyx_n_u_spacy_pipeline__parser_internals, __pyx_mstate_global->__pyx_d, ((PyObject *)__pyx_mstate_global->__pyx_codeobj_tab[0])); if (unlikely(!__pyx_t_2)) __PYX_ERR(0, 233, __pyx_L1_error) + __Pyx_GOTREF(__pyx_t_2); + if (PyDict_SetItem(__pyx_t_1, __pyx_mstate_global->__pyx_n_u_moves, __pyx_t_2) < (0)) __PYX_ERR(0, 233, __pyx_L1_error) + __Pyx_DECREF(__pyx_t_2); __pyx_t_2 = 0; + + /* "spacy/pipeline/_parser_internals/transition_system.pyx":234 + * serializers = { + * 'moves': lambda: srsly.json_dumps(self.labels), + * 'strings': lambda: self.strings.to_bytes(), # <<<<<<<<<<<<<< + * 'cfg': lambda: self.cfg + * } +*/ + __pyx_t_2 = __Pyx_CyFunction_New(&__pyx_mdef_5spacy_8pipeline_17_parser_internals_17transition_system_16TransitionSystem_8to_bytes_1lambda1, 0, __pyx_mstate_global->__pyx_n_u_to_bytes_locals_lambda, ((PyObject*)__pyx_cur_scope), __pyx_mstate_global->__pyx_n_u_spacy_pipeline__parser_internals, __pyx_mstate_global->__pyx_d, ((PyObject *)__pyx_mstate_global->__pyx_codeobj_tab[1])); if (unlikely(!__pyx_t_2)) __PYX_ERR(0, 234, __pyx_L1_error) + __Pyx_GOTREF(__pyx_t_2); + if (PyDict_SetItem(__pyx_t_1, __pyx_mstate_global->__pyx_n_u_strings, __pyx_t_2) < (0)) __PYX_ERR(0, 233, __pyx_L1_error) + __Pyx_DECREF(__pyx_t_2); __pyx_t_2 = 0; + + /* "spacy/pipeline/_parser_internals/transition_system.pyx":235 + * 'moves': lambda: srsly.json_dumps(self.labels), + * 'strings': lambda: self.strings.to_bytes(), + * 'cfg': lambda: self.cfg # <<<<<<<<<<<<<< + * } + * return util.to_bytes(serializers, exclude) +*/ + __pyx_t_2 = __Pyx_CyFunction_New(&__pyx_mdef_5spacy_8pipeline_17_parser_internals_17transition_system_16TransitionSystem_8to_bytes_2lambda2, 0, __pyx_mstate_global->__pyx_n_u_to_bytes_locals_lambda, ((PyObject*)__pyx_cur_scope), __pyx_mstate_global->__pyx_n_u_spacy_pipeline__parser_internals, __pyx_mstate_global->__pyx_d, ((PyObject *)__pyx_mstate_global->__pyx_codeobj_tab[2])); if (unlikely(!__pyx_t_2)) __PYX_ERR(0, 235, __pyx_L1_error) + __Pyx_GOTREF(__pyx_t_2); + if (PyDict_SetItem(__pyx_t_1, __pyx_mstate_global->__pyx_n_u_cfg, __pyx_t_2) < (0)) __PYX_ERR(0, 233, __pyx_L1_error) + __Pyx_DECREF(__pyx_t_2); __pyx_t_2 = 0; + __pyx_v_serializers = ((PyObject*)__pyx_t_1); + __pyx_t_1 = 0; + + /* "spacy/pipeline/_parser_internals/transition_system.pyx":237 + * 'cfg': lambda: self.cfg + * } + * return util.to_bytes(serializers, exclude) # <<<<<<<<<<<<<< + * + * def from_bytes(self, bytes_data, exclude=tuple()): +*/ + __Pyx_XDECREF(__pyx_r); + __pyx_t_2 = NULL; + __Pyx_GetModuleGlobalName(__pyx_t_3, __pyx_mstate_global->__pyx_n_u_util); if (unlikely(!__pyx_t_3)) __PYX_ERR(0, 237, __pyx_L1_error) + __Pyx_GOTREF(__pyx_t_3); + __pyx_t_4 = __Pyx_PyObject_GetAttrStr(__pyx_t_3, __pyx_mstate_global->__pyx_n_u_to_bytes); if (unlikely(!__pyx_t_4)) __PYX_ERR(0, 237, __pyx_L1_error) + __Pyx_GOTREF(__pyx_t_4); + __Pyx_DECREF(__pyx_t_3); __pyx_t_3 = 0; + __pyx_t_5 = 1; + #if CYTHON_UNPACK_METHODS + if (unlikely(PyMethod_Check(__pyx_t_4))) { + __pyx_t_2 = PyMethod_GET_SELF(__pyx_t_4); + assert(__pyx_t_2); + PyObject* __pyx__function = PyMethod_GET_FUNCTION(__pyx_t_4); + __Pyx_INCREF(__pyx_t_2); + __Pyx_INCREF(__pyx__function); + __Pyx_DECREF_SET(__pyx_t_4, __pyx__function); + __pyx_t_5 = 0; + } + #endif + { + PyObject *__pyx_callargs[3] = {__pyx_t_2, __pyx_v_serializers, __pyx_v_exclude}; + __pyx_t_1 = __Pyx_PyObject_FastCall((PyObject*)__pyx_t_4, __pyx_callargs+__pyx_t_5, (3-__pyx_t_5) | (__pyx_t_5*__Pyx_PY_VECTORCALL_ARGUMENTS_OFFSET)); + __Pyx_XDECREF(__pyx_t_2); __pyx_t_2 = 0; + __Pyx_DECREF(__pyx_t_4); __pyx_t_4 = 0; + if (unlikely(!__pyx_t_1)) __PYX_ERR(0, 237, __pyx_L1_error) + __Pyx_GOTREF(__pyx_t_1); + } + __pyx_r = __pyx_t_1; + __pyx_t_1 = 0; + goto __pyx_L0; + + /* "spacy/pipeline/_parser_internals/transition_system.pyx":231 + * return self + * + * def to_bytes(self, exclude=tuple()): # <<<<<<<<<<<<<< + * serializers = { + * 'moves': lambda: srsly.json_dumps(self.labels), +*/ + + /* function exit code */ + __pyx_L1_error:; + __Pyx_XDECREF(__pyx_t_1); + __Pyx_XDECREF(__pyx_t_2); + __Pyx_XDECREF(__pyx_t_3); + __Pyx_XDECREF(__pyx_t_4); + __Pyx_AddTraceback("spacy.pipeline._parser_internals.transition_system.TransitionSystem.to_bytes", __pyx_clineno, __pyx_lineno, __pyx_filename); + __pyx_r = NULL; + __pyx_L0:; + __Pyx_XDECREF(__pyx_v_serializers); + __Pyx_DECREF((PyObject *)__pyx_cur_scope); + __Pyx_XGIVEREF(__pyx_r); + __Pyx_RefNannyFinishContext(); + return __pyx_r; +} + +/* "spacy/pipeline/_parser_internals/transition_system.pyx":239 + * return util.to_bytes(serializers, exclude) + * + * def from_bytes(self, bytes_data, exclude=tuple()): # <<<<<<<<<<<<<< + * # We're adding a new field, 'cfg', here and we don't want to break + * # previous models that don't have it. +*/ + +/* Python wrapper */ +static PyObject *__pyx_pw_5spacy_8pipeline_17_parser_internals_17transition_system_16TransitionSystem_27from_bytes(PyObject *__pyx_v_self, +#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_5spacy_8pipeline_17_parser_internals_17transition_system_16TransitionSystem_26from_bytes, "TransitionSystem.from_bytes(self, bytes_data, exclude=tuple())"); +static PyMethodDef __pyx_mdef_5spacy_8pipeline_17_parser_internals_17transition_system_16TransitionSystem_27from_bytes = {"from_bytes", (PyCFunction)(void(*)(void))(__Pyx_PyCFunction_FastCallWithKeywords)__pyx_pw_5spacy_8pipeline_17_parser_internals_17transition_system_16TransitionSystem_27from_bytes, __Pyx_METH_FASTCALL|METH_KEYWORDS, __pyx_doc_5spacy_8pipeline_17_parser_internals_17transition_system_16TransitionSystem_26from_bytes}; +static PyObject *__pyx_pw_5spacy_8pipeline_17_parser_internals_17transition_system_16TransitionSystem_27from_bytes(PyObject *__pyx_v_self, +#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_bytes_data = 0; + PyObject *__pyx_v_exclude = 0; + #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("from_bytes (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_bytes_data,&__pyx_mstate_global->__pyx_n_u_exclude,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, 239, __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, 239, __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, 239, __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, "from_bytes", 0) < (0)) __PYX_ERR(0, 239, __pyx_L3_error) + if (!values[1]) values[1] = __Pyx_NewRef(__pyx_mstate_global->__pyx_k__12); + for (Py_ssize_t i = __pyx_nargs; i < 1; i++) { + if (unlikely(!values[i])) { __Pyx_RaiseArgtupleInvalid("from_bytes", 0, 1, 2, i); __PYX_ERR(0, 239, __pyx_L3_error) } + } + } else { + switch (__pyx_nargs) { + case 2: + values[1] = __Pyx_ArgRef_FASTCALL(__pyx_args, 1); + if (!CYTHON_ASSUME_SAFE_MACROS && unlikely(!values[1])) __PYX_ERR(0, 239, __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, 239, __pyx_L3_error) + break; + default: goto __pyx_L5_argtuple_error; + } + if (!values[1]) values[1] = __Pyx_NewRef(__pyx_mstate_global->__pyx_k__12); + } + __pyx_v_bytes_data = values[0]; + __pyx_v_exclude = values[1]; + } + goto __pyx_L6_skip; + __pyx_L5_argtuple_error:; + __Pyx_RaiseArgtupleInvalid("from_bytes", 0, 1, 2, __pyx_nargs); __PYX_ERR(0, 239, __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("spacy.pipeline._parser_internals.transition_system.TransitionSystem.from_bytes", __pyx_clineno, __pyx_lineno, __pyx_filename); + __Pyx_RefNannyFinishContext(); + return NULL; + __pyx_L4_argument_unpacking_done:; + __pyx_r = __pyx_pf_5spacy_8pipeline_17_parser_internals_17transition_system_16TransitionSystem_26from_bytes(((struct __pyx_obj_5spacy_8pipeline_17_parser_internals_17transition_system_TransitionSystem *)__pyx_v_self), __pyx_v_bytes_data, __pyx_v_exclude); + + /* 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_5spacy_8pipeline_17_parser_internals_17transition_system_16TransitionSystem_26from_bytes(struct __pyx_obj_5spacy_8pipeline_17_parser_internals_17transition_system_TransitionSystem *__pyx_v_self, PyObject *__pyx_v_bytes_data, PyObject *__pyx_v_exclude) { + PyObject *__pyx_v_msg = NULL; + PyObject *__pyx_v_labels = NULL; + PyObject *__pyx_r = NULL; + __Pyx_RefNannyDeclarations + PyObject *__pyx_t_1 = NULL; + PyObject *__pyx_t_2 = NULL; + PyObject *__pyx_t_3 = NULL; + PyObject *__pyx_t_4 = NULL; + 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("from_bytes", 0); + + /* "spacy/pipeline/_parser_internals/transition_system.pyx":242 + * # We're adding a new field, 'cfg', here and we don't want to break + * # previous models that don't have it. + * msg = srsly.msgpack_loads(bytes_data) # <<<<<<<<<<<<<< + * labels = {} + * if 'moves' not in exclude: +*/ + __pyx_t_2 = NULL; + __Pyx_GetModuleGlobalName(__pyx_t_3, __pyx_mstate_global->__pyx_n_u_srsly); if (unlikely(!__pyx_t_3)) __PYX_ERR(0, 242, __pyx_L1_error) + __Pyx_GOTREF(__pyx_t_3); + __pyx_t_4 = __Pyx_PyObject_GetAttrStr(__pyx_t_3, __pyx_mstate_global->__pyx_n_u_msgpack_loads); if (unlikely(!__pyx_t_4)) __PYX_ERR(0, 242, __pyx_L1_error) + __Pyx_GOTREF(__pyx_t_4); + __Pyx_DECREF(__pyx_t_3); __pyx_t_3 = 0; + __pyx_t_5 = 1; + #if CYTHON_UNPACK_METHODS + if (unlikely(PyMethod_Check(__pyx_t_4))) { + __pyx_t_2 = PyMethod_GET_SELF(__pyx_t_4); + assert(__pyx_t_2); + PyObject* __pyx__function = PyMethod_GET_FUNCTION(__pyx_t_4); + __Pyx_INCREF(__pyx_t_2); + __Pyx_INCREF(__pyx__function); + __Pyx_DECREF_SET(__pyx_t_4, __pyx__function); + __pyx_t_5 = 0; + } + #endif + { + PyObject *__pyx_callargs[2] = {__pyx_t_2, __pyx_v_bytes_data}; + __pyx_t_1 = __Pyx_PyObject_FastCall((PyObject*)__pyx_t_4, __pyx_callargs+__pyx_t_5, (2-__pyx_t_5) | (__pyx_t_5*__Pyx_PY_VECTORCALL_ARGUMENTS_OFFSET)); + __Pyx_XDECREF(__pyx_t_2); __pyx_t_2 = 0; + __Pyx_DECREF(__pyx_t_4); __pyx_t_4 = 0; + if (unlikely(!__pyx_t_1)) __PYX_ERR(0, 242, __pyx_L1_error) + __Pyx_GOTREF(__pyx_t_1); + } + __pyx_v_msg = __pyx_t_1; + __pyx_t_1 = 0; + + /* "spacy/pipeline/_parser_internals/transition_system.pyx":243 + * # previous models that don't have it. + * msg = srsly.msgpack_loads(bytes_data) + * labels = {} # <<<<<<<<<<<<<< + * if 'moves' not in exclude: + * labels.update(srsly.json_loads(msg['moves'])) +*/ + __pyx_t_1 = __Pyx_PyDict_NewPresized(0); if (unlikely(!__pyx_t_1)) __PYX_ERR(0, 243, __pyx_L1_error) + __Pyx_GOTREF(__pyx_t_1); + __pyx_v_labels = ((PyObject*)__pyx_t_1); + __pyx_t_1 = 0; + + /* "spacy/pipeline/_parser_internals/transition_system.pyx":244 + * msg = srsly.msgpack_loads(bytes_data) + * labels = {} + * if 'moves' not in exclude: # <<<<<<<<<<<<<< + * labels.update(srsly.json_loads(msg['moves'])) + * if 'strings' not in exclude: +*/ + __pyx_t_6 = (__Pyx_PySequence_ContainsTF(__pyx_mstate_global->__pyx_n_u_moves, __pyx_v_exclude, Py_NE)); if (unlikely((__pyx_t_6 < 0))) __PYX_ERR(0, 244, __pyx_L1_error) + if (__pyx_t_6) { + + /* "spacy/pipeline/_parser_internals/transition_system.pyx":245 + * labels = {} + * if 'moves' not in exclude: + * labels.update(srsly.json_loads(msg['moves'])) # <<<<<<<<<<<<<< + * if 'strings' not in exclude: + * self.strings.from_bytes(msg['strings']) +*/ + __pyx_t_4 = NULL; + __Pyx_GetModuleGlobalName(__pyx_t_2, __pyx_mstate_global->__pyx_n_u_srsly); if (unlikely(!__pyx_t_2)) __PYX_ERR(0, 245, __pyx_L1_error) + __Pyx_GOTREF(__pyx_t_2); + __pyx_t_3 = __Pyx_PyObject_GetAttrStr(__pyx_t_2, __pyx_mstate_global->__pyx_n_u_json_loads); if (unlikely(!__pyx_t_3)) __PYX_ERR(0, 245, __pyx_L1_error) + __Pyx_GOTREF(__pyx_t_3); + __Pyx_DECREF(__pyx_t_2); __pyx_t_2 = 0; + __pyx_t_2 = __Pyx_PyObject_Dict_GetItem(__pyx_v_msg, __pyx_mstate_global->__pyx_n_u_moves); if (unlikely(!__pyx_t_2)) __PYX_ERR(0, 245, __pyx_L1_error) + __Pyx_GOTREF(__pyx_t_2); + __pyx_t_5 = 1; + #if CYTHON_UNPACK_METHODS + if (unlikely(PyMethod_Check(__pyx_t_3))) { + __pyx_t_4 = PyMethod_GET_SELF(__pyx_t_3); + assert(__pyx_t_4); + PyObject* __pyx__function = PyMethod_GET_FUNCTION(__pyx_t_3); + __Pyx_INCREF(__pyx_t_4); + __Pyx_INCREF(__pyx__function); + __Pyx_DECREF_SET(__pyx_t_3, __pyx__function); + __pyx_t_5 = 0; + } + #endif + { + PyObject *__pyx_callargs[2] = {__pyx_t_4, __pyx_t_2}; + __pyx_t_1 = __Pyx_PyObject_FastCall((PyObject*)__pyx_t_3, __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; + __Pyx_DECREF(__pyx_t_2); __pyx_t_2 = 0; + __Pyx_DECREF(__pyx_t_3); __pyx_t_3 = 0; + if (unlikely(!__pyx_t_1)) __PYX_ERR(0, 245, __pyx_L1_error) + __Pyx_GOTREF(__pyx_t_1); + } + __pyx_t_3 = __Pyx_CallUnboundCMethod1(&__pyx_mstate_global->__pyx_umethod_PyDict_Type__update, __pyx_v_labels, __pyx_t_1); if (unlikely(!__pyx_t_3)) __PYX_ERR(0, 245, __pyx_L1_error) + __Pyx_GOTREF(__pyx_t_3); + __Pyx_DECREF(__pyx_t_1); __pyx_t_1 = 0; + __Pyx_DECREF(__pyx_t_3); __pyx_t_3 = 0; + + /* "spacy/pipeline/_parser_internals/transition_system.pyx":244 + * msg = srsly.msgpack_loads(bytes_data) + * labels = {} + * if 'moves' not in exclude: # <<<<<<<<<<<<<< + * labels.update(srsly.json_loads(msg['moves'])) + * if 'strings' not in exclude: +*/ + } + + /* "spacy/pipeline/_parser_internals/transition_system.pyx":246 + * if 'moves' not in exclude: + * labels.update(srsly.json_loads(msg['moves'])) + * if 'strings' not in exclude: # <<<<<<<<<<<<<< + * self.strings.from_bytes(msg['strings']) + * if 'cfg' not in exclude and 'cfg' in msg: +*/ + __pyx_t_6 = (__Pyx_PySequence_ContainsTF(__pyx_mstate_global->__pyx_n_u_strings, __pyx_v_exclude, Py_NE)); if (unlikely((__pyx_t_6 < 0))) __PYX_ERR(0, 246, __pyx_L1_error) + if (__pyx_t_6) { + + /* "spacy/pipeline/_parser_internals/transition_system.pyx":247 + * labels.update(srsly.json_loads(msg['moves'])) + * if 'strings' not in exclude: + * self.strings.from_bytes(msg['strings']) # <<<<<<<<<<<<<< + * if 'cfg' not in exclude and 'cfg' in msg: + * self.cfg.update(msg['cfg']) +*/ + __pyx_t_1 = ((PyObject *)__pyx_v_self->strings); + __Pyx_INCREF(__pyx_t_1); + __pyx_t_2 = __Pyx_PyObject_Dict_GetItem(__pyx_v_msg, __pyx_mstate_global->__pyx_n_u_strings); if (unlikely(!__pyx_t_2)) __PYX_ERR(0, 247, __pyx_L1_error) + __Pyx_GOTREF(__pyx_t_2); + __pyx_t_5 = 0; + { + PyObject *__pyx_callargs[2] = {__pyx_t_1, __pyx_t_2}; + __pyx_t_3 = __Pyx_PyObject_FastCallMethod((PyObject*)__pyx_mstate_global->__pyx_n_u_from_bytes, __pyx_callargs+__pyx_t_5, (2-__pyx_t_5) | (1*__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, 247, __pyx_L1_error) + __Pyx_GOTREF(__pyx_t_3); + } + __Pyx_DECREF(__pyx_t_3); __pyx_t_3 = 0; + + /* "spacy/pipeline/_parser_internals/transition_system.pyx":246 + * if 'moves' not in exclude: + * labels.update(srsly.json_loads(msg['moves'])) + * if 'strings' not in exclude: # <<<<<<<<<<<<<< + * self.strings.from_bytes(msg['strings']) + * if 'cfg' not in exclude and 'cfg' in msg: +*/ + } + + /* "spacy/pipeline/_parser_internals/transition_system.pyx":248 + * if 'strings' not in exclude: + * self.strings.from_bytes(msg['strings']) + * if 'cfg' not in exclude and 'cfg' in msg: # <<<<<<<<<<<<<< + * self.cfg.update(msg['cfg']) + * self.initialize_actions(labels) +*/ + __pyx_t_7 = (__Pyx_PySequence_ContainsTF(__pyx_mstate_global->__pyx_n_u_cfg, __pyx_v_exclude, Py_NE)); if (unlikely((__pyx_t_7 < 0))) __PYX_ERR(0, 248, __pyx_L1_error) + if (__pyx_t_7) { + } else { + __pyx_t_6 = __pyx_t_7; + goto __pyx_L6_bool_binop_done; + } + __pyx_t_7 = (__Pyx_PySequence_ContainsTF(__pyx_mstate_global->__pyx_n_u_cfg, __pyx_v_msg, Py_EQ)); if (unlikely((__pyx_t_7 < 0))) __PYX_ERR(0, 248, __pyx_L1_error) + __pyx_t_6 = __pyx_t_7; + __pyx_L6_bool_binop_done:; + if (__pyx_t_6) { + + /* "spacy/pipeline/_parser_internals/transition_system.pyx":249 + * self.strings.from_bytes(msg['strings']) + * if 'cfg' not in exclude and 'cfg' in msg: + * self.cfg.update(msg['cfg']) # <<<<<<<<<<<<<< + * self.initialize_actions(labels) + * return self +*/ + __pyx_t_2 = __pyx_v_self->cfg; + __Pyx_INCREF(__pyx_t_2); + __pyx_t_1 = __Pyx_PyObject_Dict_GetItem(__pyx_v_msg, __pyx_mstate_global->__pyx_n_u_cfg); if (unlikely(!__pyx_t_1)) __PYX_ERR(0, 249, __pyx_L1_error) + __Pyx_GOTREF(__pyx_t_1); + __pyx_t_5 = 0; + { + PyObject *__pyx_callargs[2] = {__pyx_t_2, __pyx_t_1}; + __pyx_t_3 = __Pyx_PyObject_FastCallMethod((PyObject*)__pyx_mstate_global->__pyx_n_u_update, __pyx_callargs+__pyx_t_5, (2-__pyx_t_5) | (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_3)) __PYX_ERR(0, 249, __pyx_L1_error) + __Pyx_GOTREF(__pyx_t_3); + } + __Pyx_DECREF(__pyx_t_3); __pyx_t_3 = 0; + + /* "spacy/pipeline/_parser_internals/transition_system.pyx":248 + * if 'strings' not in exclude: + * self.strings.from_bytes(msg['strings']) + * if 'cfg' not in exclude and 'cfg' in msg: # <<<<<<<<<<<<<< + * self.cfg.update(msg['cfg']) + * self.initialize_actions(labels) +*/ + } + + /* "spacy/pipeline/_parser_internals/transition_system.pyx":250 + * if 'cfg' not in exclude and 'cfg' in msg: + * self.cfg.update(msg['cfg']) + * self.initialize_actions(labels) # <<<<<<<<<<<<<< + * return self +*/ + __pyx_t_1 = ((PyObject *)__pyx_v_self); + __Pyx_INCREF(__pyx_t_1); + __pyx_t_5 = 0; + { + PyObject *__pyx_callargs[2] = {__pyx_t_1, __pyx_v_labels}; + __pyx_t_3 = __Pyx_PyObject_FastCallMethod((PyObject*)__pyx_mstate_global->__pyx_n_u_initialize_actions, __pyx_callargs+__pyx_t_5, (2-__pyx_t_5) | (1*__Pyx_PY_VECTORCALL_ARGUMENTS_OFFSET)); + __Pyx_XDECREF(__pyx_t_1); __pyx_t_1 = 0; + if (unlikely(!__pyx_t_3)) __PYX_ERR(0, 250, __pyx_L1_error) + __Pyx_GOTREF(__pyx_t_3); + } + __Pyx_DECREF(__pyx_t_3); __pyx_t_3 = 0; + + /* "spacy/pipeline/_parser_internals/transition_system.pyx":251 + * self.cfg.update(msg['cfg']) + * self.initialize_actions(labels) + * return self # <<<<<<<<<<<<<< +*/ + __Pyx_XDECREF(__pyx_r); + __Pyx_INCREF((PyObject *)__pyx_v_self); + __pyx_r = ((PyObject *)__pyx_v_self); + goto __pyx_L0; + + /* "spacy/pipeline/_parser_internals/transition_system.pyx":239 + * return util.to_bytes(serializers, exclude) + * + * def from_bytes(self, bytes_data, exclude=tuple()): # <<<<<<<<<<<<<< + * # We're adding a new field, 'cfg', here and we don't want to break + * # previous models that don't have it. +*/ + + /* function exit code */ + __pyx_L1_error:; + __Pyx_XDECREF(__pyx_t_1); + __Pyx_XDECREF(__pyx_t_2); + __Pyx_XDECREF(__pyx_t_3); + __Pyx_XDECREF(__pyx_t_4); + __Pyx_AddTraceback("spacy.pipeline._parser_internals.transition_system.TransitionSystem.from_bytes", __pyx_clineno, __pyx_lineno, __pyx_filename); + __pyx_r = NULL; + __pyx_L0:; + __Pyx_XDECREF(__pyx_v_msg); + __Pyx_XDECREF(__pyx_v_labels); + __Pyx_XGIVEREF(__pyx_r); + __Pyx_RefNannyFinishContext(); + return __pyx_r; +} + +/* "spacy/pipeline/_parser_internals/transition_system.pxd":43 + * cdef StringStore strings + * cdef Transition* c + * cdef readonly int n_moves # <<<<<<<<<<<<<< + * cdef int _size + * cdef public attr_t root_label +*/ + +/* Python wrapper */ +static PyObject *__pyx_pw_5spacy_8pipeline_17_parser_internals_17transition_system_16TransitionSystem_7n_moves_1__get__(PyObject *__pyx_v_self); /*proto*/ +static PyObject *__pyx_pw_5spacy_8pipeline_17_parser_internals_17transition_system_16TransitionSystem_7n_moves_1__get__(PyObject *__pyx_v_self) { + CYTHON_UNUSED PyObject *const *__pyx_kwvalues; + PyObject *__pyx_r = 0; + __Pyx_RefNannyDeclarations + __Pyx_RefNannySetupContext("__get__ (wrapper)", 0); + __pyx_kwvalues = __Pyx_KwValues_VARARGS(__pyx_args, __pyx_nargs); + __pyx_r = __pyx_pf_5spacy_8pipeline_17_parser_internals_17transition_system_16TransitionSystem_7n_moves___get__(((struct __pyx_obj_5spacy_8pipeline_17_parser_internals_17transition_system_TransitionSystem *)__pyx_v_self)); + + /* function exit code */ + __Pyx_RefNannyFinishContext(); + return __pyx_r; +} + +static PyObject *__pyx_pf_5spacy_8pipeline_17_parser_internals_17transition_system_16TransitionSystem_7n_moves___get__(struct __pyx_obj_5spacy_8pipeline_17_parser_internals_17transition_system_TransitionSystem *__pyx_v_self) { + PyObject *__pyx_r = NULL; + __Pyx_RefNannyDeclarations + PyObject *__pyx_t_1 = NULL; + int __pyx_lineno = 0; + const char *__pyx_filename = NULL; + int __pyx_clineno = 0; + __Pyx_RefNannySetupContext("__get__", 0); + __Pyx_XDECREF(__pyx_r); + __pyx_t_1 = __Pyx_PyLong_From_int(__pyx_v_self->n_moves); if (unlikely(!__pyx_t_1)) __PYX_ERR(6, 43, __pyx_L1_error) + __Pyx_GOTREF(__pyx_t_1); + __pyx_r = __pyx_t_1; + __pyx_t_1 = 0; + goto __pyx_L0; + + /* function exit code */ + __pyx_L1_error:; + __Pyx_XDECREF(__pyx_t_1); + __Pyx_AddTraceback("spacy.pipeline._parser_internals.transition_system.TransitionSystem.n_moves.__get__", __pyx_clineno, __pyx_lineno, __pyx_filename); + __pyx_r = NULL; + __pyx_L0:; + __Pyx_XGIVEREF(__pyx_r); + __Pyx_RefNannyFinishContext(); + return __pyx_r; +} + +/* "spacy/pipeline/_parser_internals/transition_system.pxd":45 + * cdef readonly int n_moves + * cdef int _size + * cdef public attr_t root_label # <<<<<<<<<<<<<< + * cdef public freqs + * cdef public object labels +*/ + +/* Python wrapper */ +static PyObject *__pyx_pw_5spacy_8pipeline_17_parser_internals_17transition_system_16TransitionSystem_10root_label_1__get__(PyObject *__pyx_v_self); /*proto*/ +static PyObject *__pyx_pw_5spacy_8pipeline_17_parser_internals_17transition_system_16TransitionSystem_10root_label_1__get__(PyObject *__pyx_v_self) { + CYTHON_UNUSED PyObject *const *__pyx_kwvalues; + PyObject *__pyx_r = 0; + __Pyx_RefNannyDeclarations + __Pyx_RefNannySetupContext("__get__ (wrapper)", 0); + __pyx_kwvalues = __Pyx_KwValues_VARARGS(__pyx_args, __pyx_nargs); + __pyx_r = __pyx_pf_5spacy_8pipeline_17_parser_internals_17transition_system_16TransitionSystem_10root_label___get__(((struct __pyx_obj_5spacy_8pipeline_17_parser_internals_17transition_system_TransitionSystem *)__pyx_v_self)); + + /* function exit code */ + __Pyx_RefNannyFinishContext(); + return __pyx_r; +} + +static PyObject *__pyx_pf_5spacy_8pipeline_17_parser_internals_17transition_system_16TransitionSystem_10root_label___get__(struct __pyx_obj_5spacy_8pipeline_17_parser_internals_17transition_system_TransitionSystem *__pyx_v_self) { + PyObject *__pyx_r = NULL; + __Pyx_RefNannyDeclarations + PyObject *__pyx_t_1 = NULL; + int __pyx_lineno = 0; + const char *__pyx_filename = NULL; + int __pyx_clineno = 0; + __Pyx_RefNannySetupContext("__get__", 0); + __Pyx_XDECREF(__pyx_r); + __pyx_t_1 = __Pyx_PyLong_From_uint64_t(__pyx_v_self->root_label); if (unlikely(!__pyx_t_1)) __PYX_ERR(6, 45, __pyx_L1_error) + __Pyx_GOTREF(__pyx_t_1); + __pyx_r = __pyx_t_1; + __pyx_t_1 = 0; + goto __pyx_L0; + + /* function exit code */ + __pyx_L1_error:; + __Pyx_XDECREF(__pyx_t_1); + __Pyx_AddTraceback("spacy.pipeline._parser_internals.transition_system.TransitionSystem.root_label.__get__", __pyx_clineno, __pyx_lineno, __pyx_filename); + __pyx_r = NULL; + __pyx_L0:; + __Pyx_XGIVEREF(__pyx_r); + __Pyx_RefNannyFinishContext(); + return __pyx_r; +} + +/* Python wrapper */ +static int __pyx_pw_5spacy_8pipeline_17_parser_internals_17transition_system_16TransitionSystem_10root_label_3__set__(PyObject *__pyx_v_self, PyObject *__pyx_v_value); /*proto*/ +static int __pyx_pw_5spacy_8pipeline_17_parser_internals_17transition_system_16TransitionSystem_10root_label_3__set__(PyObject *__pyx_v_self, PyObject *__pyx_v_value) { + CYTHON_UNUSED PyObject *const *__pyx_kwvalues; + int __pyx_r; + __Pyx_RefNannyDeclarations + __Pyx_RefNannySetupContext("__set__ (wrapper)", 0); + __pyx_kwvalues = __Pyx_KwValues_VARARGS(__pyx_args, __pyx_nargs); + __pyx_r = __pyx_pf_5spacy_8pipeline_17_parser_internals_17transition_system_16TransitionSystem_10root_label_2__set__(((struct __pyx_obj_5spacy_8pipeline_17_parser_internals_17transition_system_TransitionSystem *)__pyx_v_self), ((PyObject *)__pyx_v_value)); + + /* function exit code */ + __Pyx_RefNannyFinishContext(); + return __pyx_r; +} + +static int __pyx_pf_5spacy_8pipeline_17_parser_internals_17transition_system_16TransitionSystem_10root_label_2__set__(struct __pyx_obj_5spacy_8pipeline_17_parser_internals_17transition_system_TransitionSystem *__pyx_v_self, PyObject *__pyx_v_value) { + int __pyx_r; + __pyx_t_5spacy_8typedefs_attr_t __pyx_t_1; + int __pyx_lineno = 0; + const char *__pyx_filename = NULL; + int __pyx_clineno = 0; + __pyx_t_1 = __Pyx_PyLong_As_uint64_t(__pyx_v_value); if (unlikely((__pyx_t_1 == ((uint64_t)-1)) && PyErr_Occurred())) __PYX_ERR(6, 45, __pyx_L1_error) + __pyx_v_self->root_label = __pyx_t_1; + + /* function exit code */ + __pyx_r = 0; + goto __pyx_L0; + __pyx_L1_error:; + __Pyx_AddTraceback("spacy.pipeline._parser_internals.transition_system.TransitionSystem.root_label.__set__", __pyx_clineno, __pyx_lineno, __pyx_filename); + __pyx_r = -1; + __pyx_L0:; + return __pyx_r; +} + +/* "spacy/pipeline/_parser_internals/transition_system.pxd":46 + * cdef int _size + * cdef public attr_t root_label + * cdef public freqs # <<<<<<<<<<<<<< + * cdef public object labels + * cdef public object cfg +*/ + +/* Python wrapper */ +static PyObject *__pyx_pw_5spacy_8pipeline_17_parser_internals_17transition_system_16TransitionSystem_5freqs_1__get__(PyObject *__pyx_v_self); /*proto*/ +static PyObject *__pyx_pw_5spacy_8pipeline_17_parser_internals_17transition_system_16TransitionSystem_5freqs_1__get__(PyObject *__pyx_v_self) { + CYTHON_UNUSED PyObject *const *__pyx_kwvalues; + PyObject *__pyx_r = 0; + __Pyx_RefNannyDeclarations + __Pyx_RefNannySetupContext("__get__ (wrapper)", 0); + __pyx_kwvalues = __Pyx_KwValues_VARARGS(__pyx_args, __pyx_nargs); + __pyx_r = __pyx_pf_5spacy_8pipeline_17_parser_internals_17transition_system_16TransitionSystem_5freqs___get__(((struct __pyx_obj_5spacy_8pipeline_17_parser_internals_17transition_system_TransitionSystem *)__pyx_v_self)); + + /* function exit code */ + __Pyx_RefNannyFinishContext(); + return __pyx_r; +} + +static PyObject *__pyx_pf_5spacy_8pipeline_17_parser_internals_17transition_system_16TransitionSystem_5freqs___get__(struct __pyx_obj_5spacy_8pipeline_17_parser_internals_17transition_system_TransitionSystem *__pyx_v_self) { + PyObject *__pyx_r = NULL; + __Pyx_RefNannyDeclarations + __Pyx_RefNannySetupContext("__get__", 0); + __Pyx_XDECREF(__pyx_r); + __Pyx_INCREF(__pyx_v_self->freqs); + __pyx_r = __pyx_v_self->freqs; + goto __pyx_L0; + + /* function exit code */ + __pyx_L0:; + __Pyx_XGIVEREF(__pyx_r); + __Pyx_RefNannyFinishContext(); + return __pyx_r; +} + +/* Python wrapper */ +static int __pyx_pw_5spacy_8pipeline_17_parser_internals_17transition_system_16TransitionSystem_5freqs_3__set__(PyObject *__pyx_v_self, PyObject *__pyx_v_value); /*proto*/ +static int __pyx_pw_5spacy_8pipeline_17_parser_internals_17transition_system_16TransitionSystem_5freqs_3__set__(PyObject *__pyx_v_self, PyObject *__pyx_v_value) { + CYTHON_UNUSED PyObject *const *__pyx_kwvalues; + int __pyx_r; + __Pyx_RefNannyDeclarations + __Pyx_RefNannySetupContext("__set__ (wrapper)", 0); + __pyx_kwvalues = __Pyx_KwValues_VARARGS(__pyx_args, __pyx_nargs); + __pyx_r = __pyx_pf_5spacy_8pipeline_17_parser_internals_17transition_system_16TransitionSystem_5freqs_2__set__(((struct __pyx_obj_5spacy_8pipeline_17_parser_internals_17transition_system_TransitionSystem *)__pyx_v_self), ((PyObject *)__pyx_v_value)); + + /* function exit code */ + __Pyx_RefNannyFinishContext(); + return __pyx_r; +} + +static int __pyx_pf_5spacy_8pipeline_17_parser_internals_17transition_system_16TransitionSystem_5freqs_2__set__(struct __pyx_obj_5spacy_8pipeline_17_parser_internals_17transition_system_TransitionSystem *__pyx_v_self, PyObject *__pyx_v_value) { + int __pyx_r; + __Pyx_RefNannyDeclarations + __Pyx_RefNannySetupContext("__set__", 0); + __Pyx_INCREF(__pyx_v_value); + __Pyx_GIVEREF(__pyx_v_value); + __Pyx_GOTREF(__pyx_v_self->freqs); + __Pyx_DECREF(__pyx_v_self->freqs); + __pyx_v_self->freqs = __pyx_v_value; + + /* function exit code */ + __pyx_r = 0; + __Pyx_RefNannyFinishContext(); + return __pyx_r; +} + +/* Python wrapper */ +static int __pyx_pw_5spacy_8pipeline_17_parser_internals_17transition_system_16TransitionSystem_5freqs_5__del__(PyObject *__pyx_v_self); /*proto*/ +static int __pyx_pw_5spacy_8pipeline_17_parser_internals_17transition_system_16TransitionSystem_5freqs_5__del__(PyObject *__pyx_v_self) { + CYTHON_UNUSED PyObject *const *__pyx_kwvalues; + int __pyx_r; + __Pyx_RefNannyDeclarations + __Pyx_RefNannySetupContext("__del__ (wrapper)", 0); + __pyx_kwvalues = __Pyx_KwValues_VARARGS(__pyx_args, __pyx_nargs); + __pyx_r = __pyx_pf_5spacy_8pipeline_17_parser_internals_17transition_system_16TransitionSystem_5freqs_4__del__(((struct __pyx_obj_5spacy_8pipeline_17_parser_internals_17transition_system_TransitionSystem *)__pyx_v_self)); + + /* function exit code */ + __Pyx_RefNannyFinishContext(); + return __pyx_r; +} + +static int __pyx_pf_5spacy_8pipeline_17_parser_internals_17transition_system_16TransitionSystem_5freqs_4__del__(struct __pyx_obj_5spacy_8pipeline_17_parser_internals_17transition_system_TransitionSystem *__pyx_v_self) { + int __pyx_r; + __Pyx_RefNannyDeclarations + __Pyx_RefNannySetupContext("__del__", 0); + __Pyx_INCREF(Py_None); + __Pyx_GIVEREF(Py_None); + __Pyx_GOTREF(__pyx_v_self->freqs); + __Pyx_DECREF(__pyx_v_self->freqs); + __pyx_v_self->freqs = Py_None; + + /* function exit code */ + __pyx_r = 0; + __Pyx_RefNannyFinishContext(); + return __pyx_r; +} + +/* "spacy/pipeline/_parser_internals/transition_system.pxd":47 + * cdef public attr_t root_label + * cdef public freqs + * cdef public object labels # <<<<<<<<<<<<<< + * cdef public object cfg + * cdef init_state_t init_beam_state +*/ + +/* Python wrapper */ +static PyObject *__pyx_pw_5spacy_8pipeline_17_parser_internals_17transition_system_16TransitionSystem_6labels_1__get__(PyObject *__pyx_v_self); /*proto*/ +static PyObject *__pyx_pw_5spacy_8pipeline_17_parser_internals_17transition_system_16TransitionSystem_6labels_1__get__(PyObject *__pyx_v_self) { + CYTHON_UNUSED PyObject *const *__pyx_kwvalues; + PyObject *__pyx_r = 0; + __Pyx_RefNannyDeclarations + __Pyx_RefNannySetupContext("__get__ (wrapper)", 0); + __pyx_kwvalues = __Pyx_KwValues_VARARGS(__pyx_args, __pyx_nargs); + __pyx_r = __pyx_pf_5spacy_8pipeline_17_parser_internals_17transition_system_16TransitionSystem_6labels___get__(((struct __pyx_obj_5spacy_8pipeline_17_parser_internals_17transition_system_TransitionSystem *)__pyx_v_self)); + + /* function exit code */ + __Pyx_RefNannyFinishContext(); + return __pyx_r; +} + +static PyObject *__pyx_pf_5spacy_8pipeline_17_parser_internals_17transition_system_16TransitionSystem_6labels___get__(struct __pyx_obj_5spacy_8pipeline_17_parser_internals_17transition_system_TransitionSystem *__pyx_v_self) { + PyObject *__pyx_r = NULL; + __Pyx_RefNannyDeclarations + __Pyx_RefNannySetupContext("__get__", 0); + __Pyx_XDECREF(__pyx_r); + __Pyx_INCREF(__pyx_v_self->labels); + __pyx_r = __pyx_v_self->labels; + goto __pyx_L0; + + /* function exit code */ + __pyx_L0:; + __Pyx_XGIVEREF(__pyx_r); + __Pyx_RefNannyFinishContext(); + return __pyx_r; +} + +/* Python wrapper */ +static int __pyx_pw_5spacy_8pipeline_17_parser_internals_17transition_system_16TransitionSystem_6labels_3__set__(PyObject *__pyx_v_self, PyObject *__pyx_v_value); /*proto*/ +static int __pyx_pw_5spacy_8pipeline_17_parser_internals_17transition_system_16TransitionSystem_6labels_3__set__(PyObject *__pyx_v_self, PyObject *__pyx_v_value) { + CYTHON_UNUSED PyObject *const *__pyx_kwvalues; + int __pyx_r; + __Pyx_RefNannyDeclarations + __Pyx_RefNannySetupContext("__set__ (wrapper)", 0); + __pyx_kwvalues = __Pyx_KwValues_VARARGS(__pyx_args, __pyx_nargs); + __pyx_r = __pyx_pf_5spacy_8pipeline_17_parser_internals_17transition_system_16TransitionSystem_6labels_2__set__(((struct __pyx_obj_5spacy_8pipeline_17_parser_internals_17transition_system_TransitionSystem *)__pyx_v_self), ((PyObject *)__pyx_v_value)); + + /* function exit code */ + __Pyx_RefNannyFinishContext(); + return __pyx_r; +} + +static int __pyx_pf_5spacy_8pipeline_17_parser_internals_17transition_system_16TransitionSystem_6labels_2__set__(struct __pyx_obj_5spacy_8pipeline_17_parser_internals_17transition_system_TransitionSystem *__pyx_v_self, PyObject *__pyx_v_value) { + int __pyx_r; + __Pyx_RefNannyDeclarations + __Pyx_RefNannySetupContext("__set__", 0); + __Pyx_INCREF(__pyx_v_value); + __Pyx_GIVEREF(__pyx_v_value); + __Pyx_GOTREF(__pyx_v_self->labels); + __Pyx_DECREF(__pyx_v_self->labels); + __pyx_v_self->labels = __pyx_v_value; + + /* function exit code */ + __pyx_r = 0; + __Pyx_RefNannyFinishContext(); + return __pyx_r; +} + +/* Python wrapper */ +static int __pyx_pw_5spacy_8pipeline_17_parser_internals_17transition_system_16TransitionSystem_6labels_5__del__(PyObject *__pyx_v_self); /*proto*/ +static int __pyx_pw_5spacy_8pipeline_17_parser_internals_17transition_system_16TransitionSystem_6labels_5__del__(PyObject *__pyx_v_self) { + CYTHON_UNUSED PyObject *const *__pyx_kwvalues; + int __pyx_r; + __Pyx_RefNannyDeclarations + __Pyx_RefNannySetupContext("__del__ (wrapper)", 0); + __pyx_kwvalues = __Pyx_KwValues_VARARGS(__pyx_args, __pyx_nargs); + __pyx_r = __pyx_pf_5spacy_8pipeline_17_parser_internals_17transition_system_16TransitionSystem_6labels_4__del__(((struct __pyx_obj_5spacy_8pipeline_17_parser_internals_17transition_system_TransitionSystem *)__pyx_v_self)); + + /* function exit code */ + __Pyx_RefNannyFinishContext(); + return __pyx_r; +} + +static int __pyx_pf_5spacy_8pipeline_17_parser_internals_17transition_system_16TransitionSystem_6labels_4__del__(struct __pyx_obj_5spacy_8pipeline_17_parser_internals_17transition_system_TransitionSystem *__pyx_v_self) { + int __pyx_r; + __Pyx_RefNannyDeclarations + __Pyx_RefNannySetupContext("__del__", 0); + __Pyx_INCREF(Py_None); + __Pyx_GIVEREF(Py_None); + __Pyx_GOTREF(__pyx_v_self->labels); + __Pyx_DECREF(__pyx_v_self->labels); + __pyx_v_self->labels = Py_None; + + /* function exit code */ + __pyx_r = 0; + __Pyx_RefNannyFinishContext(); + return __pyx_r; +} + +/* "spacy/pipeline/_parser_internals/transition_system.pxd":48 + * cdef public freqs + * cdef public object labels + * cdef public object cfg # <<<<<<<<<<<<<< + * cdef init_state_t init_beam_state + * cdef del_state_t del_beam_state +*/ + +/* Python wrapper */ +static PyObject *__pyx_pw_5spacy_8pipeline_17_parser_internals_17transition_system_16TransitionSystem_3cfg_1__get__(PyObject *__pyx_v_self); /*proto*/ +static PyObject *__pyx_pw_5spacy_8pipeline_17_parser_internals_17transition_system_16TransitionSystem_3cfg_1__get__(PyObject *__pyx_v_self) { + CYTHON_UNUSED PyObject *const *__pyx_kwvalues; + PyObject *__pyx_r = 0; + __Pyx_RefNannyDeclarations + __Pyx_RefNannySetupContext("__get__ (wrapper)", 0); + __pyx_kwvalues = __Pyx_KwValues_VARARGS(__pyx_args, __pyx_nargs); + __pyx_r = __pyx_pf_5spacy_8pipeline_17_parser_internals_17transition_system_16TransitionSystem_3cfg___get__(((struct __pyx_obj_5spacy_8pipeline_17_parser_internals_17transition_system_TransitionSystem *)__pyx_v_self)); + + /* function exit code */ + __Pyx_RefNannyFinishContext(); + return __pyx_r; +} + +static PyObject *__pyx_pf_5spacy_8pipeline_17_parser_internals_17transition_system_16TransitionSystem_3cfg___get__(struct __pyx_obj_5spacy_8pipeline_17_parser_internals_17transition_system_TransitionSystem *__pyx_v_self) { + PyObject *__pyx_r = NULL; + __Pyx_RefNannyDeclarations + __Pyx_RefNannySetupContext("__get__", 0); + __Pyx_XDECREF(__pyx_r); + __Pyx_INCREF(__pyx_v_self->cfg); + __pyx_r = __pyx_v_self->cfg; + goto __pyx_L0; + + /* function exit code */ + __pyx_L0:; + __Pyx_XGIVEREF(__pyx_r); + __Pyx_RefNannyFinishContext(); + return __pyx_r; +} + +/* Python wrapper */ +static int __pyx_pw_5spacy_8pipeline_17_parser_internals_17transition_system_16TransitionSystem_3cfg_3__set__(PyObject *__pyx_v_self, PyObject *__pyx_v_value); /*proto*/ +static int __pyx_pw_5spacy_8pipeline_17_parser_internals_17transition_system_16TransitionSystem_3cfg_3__set__(PyObject *__pyx_v_self, PyObject *__pyx_v_value) { + CYTHON_UNUSED PyObject *const *__pyx_kwvalues; + int __pyx_r; + __Pyx_RefNannyDeclarations + __Pyx_RefNannySetupContext("__set__ (wrapper)", 0); + __pyx_kwvalues = __Pyx_KwValues_VARARGS(__pyx_args, __pyx_nargs); + __pyx_r = __pyx_pf_5spacy_8pipeline_17_parser_internals_17transition_system_16TransitionSystem_3cfg_2__set__(((struct __pyx_obj_5spacy_8pipeline_17_parser_internals_17transition_system_TransitionSystem *)__pyx_v_self), ((PyObject *)__pyx_v_value)); + + /* function exit code */ + __Pyx_RefNannyFinishContext(); + return __pyx_r; +} + +static int __pyx_pf_5spacy_8pipeline_17_parser_internals_17transition_system_16TransitionSystem_3cfg_2__set__(struct __pyx_obj_5spacy_8pipeline_17_parser_internals_17transition_system_TransitionSystem *__pyx_v_self, PyObject *__pyx_v_value) { + int __pyx_r; + __Pyx_RefNannyDeclarations + __Pyx_RefNannySetupContext("__set__", 0); + __Pyx_INCREF(__pyx_v_value); + __Pyx_GIVEREF(__pyx_v_value); + __Pyx_GOTREF(__pyx_v_self->cfg); + __Pyx_DECREF(__pyx_v_self->cfg); + __pyx_v_self->cfg = __pyx_v_value; + + /* function exit code */ + __pyx_r = 0; + __Pyx_RefNannyFinishContext(); + return __pyx_r; +} + +/* Python wrapper */ +static int __pyx_pw_5spacy_8pipeline_17_parser_internals_17transition_system_16TransitionSystem_3cfg_5__del__(PyObject *__pyx_v_self); /*proto*/ +static int __pyx_pw_5spacy_8pipeline_17_parser_internals_17transition_system_16TransitionSystem_3cfg_5__del__(PyObject *__pyx_v_self) { + CYTHON_UNUSED PyObject *const *__pyx_kwvalues; + int __pyx_r; + __Pyx_RefNannyDeclarations + __Pyx_RefNannySetupContext("__del__ (wrapper)", 0); + __pyx_kwvalues = __Pyx_KwValues_VARARGS(__pyx_args, __pyx_nargs); + __pyx_r = __pyx_pf_5spacy_8pipeline_17_parser_internals_17transition_system_16TransitionSystem_3cfg_4__del__(((struct __pyx_obj_5spacy_8pipeline_17_parser_internals_17transition_system_TransitionSystem *)__pyx_v_self)); + + /* function exit code */ + __Pyx_RefNannyFinishContext(); + return __pyx_r; +} + +static int __pyx_pf_5spacy_8pipeline_17_parser_internals_17transition_system_16TransitionSystem_3cfg_4__del__(struct __pyx_obj_5spacy_8pipeline_17_parser_internals_17transition_system_TransitionSystem *__pyx_v_self) { + int __pyx_r; + __Pyx_RefNannyDeclarations + __Pyx_RefNannySetupContext("__del__", 0); + __Pyx_INCREF(Py_None); + __Pyx_GIVEREF(Py_None); + __Pyx_GOTREF(__pyx_v_self->cfg); + __Pyx_DECREF(__pyx_v_self->cfg); + __pyx_v_self->cfg = Py_None; + + /* function exit code */ + __pyx_r = 0; + __Pyx_RefNannyFinishContext(); + return __pyx_r; +} +/* #### Code section: module_exttypes ### */ +static struct __pyx_vtabstruct_5spacy_8pipeline_17_parser_internals_17transition_system_TransitionSystem __pyx_vtable_5spacy_8pipeline_17_parser_internals_17transition_system_TransitionSystem; + +static PyObject *__pyx_tp_new_5spacy_8pipeline_17_parser_internals_17transition_system_TransitionSystem(PyTypeObject *t, CYTHON_UNUSED PyObject *a, CYTHON_UNUSED PyObject *k) { + struct __pyx_obj_5spacy_8pipeline_17_parser_internals_17transition_system_TransitionSystem *p; + PyObject *o; + o = __Pyx_AllocateExtensionType(t, 0); + if (unlikely(!o)) return 0; + p = ((struct __pyx_obj_5spacy_8pipeline_17_parser_internals_17transition_system_TransitionSystem *)o); + p->__pyx_vtab = __pyx_vtabptr_5spacy_8pipeline_17_parser_internals_17transition_system_TransitionSystem; + p->mem = ((struct __pyx_obj_5cymem_5cymem_Pool *)Py_None); Py_INCREF(Py_None); + p->strings = ((struct __pyx_obj_5spacy_7strings_StringStore *)Py_None); Py_INCREF(Py_None); + p->freqs = Py_None; Py_INCREF(Py_None); + p->labels = Py_None; Py_INCREF(Py_None); + p->cfg = Py_None; Py_INCREF(Py_None); + return o; +} + +static void __pyx_tp_dealloc_5spacy_8pipeline_17_parser_internals_17transition_system_TransitionSystem(PyObject *o) { + struct __pyx_obj_5spacy_8pipeline_17_parser_internals_17transition_system_TransitionSystem *p = (struct __pyx_obj_5spacy_8pipeline_17_parser_internals_17transition_system_TransitionSystem *)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_5spacy_8pipeline_17_parser_internals_17transition_system_TransitionSystem) { + if (PyObject_CallFinalizerFromDealloc(o)) return; + } + } + #endif + PyObject_GC_UnTrack(o); + Py_CLEAR(p->mem); + Py_CLEAR(p->strings); + Py_CLEAR(p->freqs); + Py_CLEAR(p->labels); + Py_CLEAR(p->cfg); + 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_5spacy_8pipeline_17_parser_internals_17transition_system_TransitionSystem(PyObject *o, visitproc v, void *a) { + int e; + struct __pyx_obj_5spacy_8pipeline_17_parser_internals_17transition_system_TransitionSystem *p = (struct __pyx_obj_5spacy_8pipeline_17_parser_internals_17transition_system_TransitionSystem *)o; + { + e = __Pyx_call_type_traverse(o, 1, v, a); + if (e) return e; + } + if (p->mem) { + e = (*v)(((PyObject *)p->mem), a); if (e) return e; + } + if (p->strings) { + e = (*v)(((PyObject *)p->strings), a); if (e) return e; + } + if (p->freqs) { + e = (*v)(p->freqs, a); if (e) return e; + } + if (p->labels) { + e = (*v)(p->labels, a); if (e) return e; + } + if (p->cfg) { + e = (*v)(p->cfg, a); if (e) return e; + } + return 0; +} + +static int __pyx_tp_clear_5spacy_8pipeline_17_parser_internals_17transition_system_TransitionSystem(PyObject *o) { + PyObject* tmp; + struct __pyx_obj_5spacy_8pipeline_17_parser_internals_17transition_system_TransitionSystem *p = (struct __pyx_obj_5spacy_8pipeline_17_parser_internals_17transition_system_TransitionSystem *)o; + tmp = ((PyObject*)p->mem); + p->mem = ((struct __pyx_obj_5cymem_5cymem_Pool *)Py_None); Py_INCREF(Py_None); + Py_XDECREF(tmp); + tmp = ((PyObject*)p->strings); + p->strings = ((struct __pyx_obj_5spacy_7strings_StringStore *)Py_None); Py_INCREF(Py_None); + Py_XDECREF(tmp); + tmp = ((PyObject*)p->freqs); + p->freqs = Py_None; Py_INCREF(Py_None); + Py_XDECREF(tmp); + tmp = ((PyObject*)p->labels); + p->labels = Py_None; Py_INCREF(Py_None); + Py_XDECREF(tmp); + tmp = ((PyObject*)p->cfg); + p->cfg = Py_None; Py_INCREF(Py_None); + Py_XDECREF(tmp); + return 0; +} + +static PyObject *__pyx_getprop_5spacy_8pipeline_17_parser_internals_17transition_system_16TransitionSystem_neg_key(PyObject *o, CYTHON_UNUSED void *x) { + return __pyx_pw_5spacy_8pipeline_17_parser_internals_17transition_system_16TransitionSystem_7neg_key_1__get__(o); +} + +static PyObject *__pyx_getprop_5spacy_8pipeline_17_parser_internals_17transition_system_16TransitionSystem_n_moves(PyObject *o, CYTHON_UNUSED void *x) { + return __pyx_pw_5spacy_8pipeline_17_parser_internals_17transition_system_16TransitionSystem_7n_moves_1__get__(o); +} + +static PyObject *__pyx_getprop_5spacy_8pipeline_17_parser_internals_17transition_system_16TransitionSystem_root_label(PyObject *o, CYTHON_UNUSED void *x) { + return __pyx_pw_5spacy_8pipeline_17_parser_internals_17transition_system_16TransitionSystem_10root_label_1__get__(o); +} + +static int __pyx_setprop_5spacy_8pipeline_17_parser_internals_17transition_system_16TransitionSystem_root_label(PyObject *o, PyObject *v, CYTHON_UNUSED void *x) { + if (v) { + return __pyx_pw_5spacy_8pipeline_17_parser_internals_17transition_system_16TransitionSystem_10root_label_3__set__(o, v); + } + else { + PyErr_SetString(PyExc_NotImplementedError, "__del__"); + return -1; + } +} + +static PyObject *__pyx_getprop_5spacy_8pipeline_17_parser_internals_17transition_system_16TransitionSystem_freqs(PyObject *o, CYTHON_UNUSED void *x) { + return __pyx_pw_5spacy_8pipeline_17_parser_internals_17transition_system_16TransitionSystem_5freqs_1__get__(o); +} + +static int __pyx_setprop_5spacy_8pipeline_17_parser_internals_17transition_system_16TransitionSystem_freqs(PyObject *o, PyObject *v, CYTHON_UNUSED void *x) { + if (v) { + return __pyx_pw_5spacy_8pipeline_17_parser_internals_17transition_system_16TransitionSystem_5freqs_3__set__(o, v); + } + else { + return __pyx_pw_5spacy_8pipeline_17_parser_internals_17transition_system_16TransitionSystem_5freqs_5__del__(o); + } +} + +static PyObject *__pyx_getprop_5spacy_8pipeline_17_parser_internals_17transition_system_16TransitionSystem_labels(PyObject *o, CYTHON_UNUSED void *x) { + return __pyx_pw_5spacy_8pipeline_17_parser_internals_17transition_system_16TransitionSystem_6labels_1__get__(o); +} + +static int __pyx_setprop_5spacy_8pipeline_17_parser_internals_17transition_system_16TransitionSystem_labels(PyObject *o, PyObject *v, CYTHON_UNUSED void *x) { + if (v) { + return __pyx_pw_5spacy_8pipeline_17_parser_internals_17transition_system_16TransitionSystem_6labels_3__set__(o, v); + } + else { + return __pyx_pw_5spacy_8pipeline_17_parser_internals_17transition_system_16TransitionSystem_6labels_5__del__(o); + } +} + +static PyObject *__pyx_getprop_5spacy_8pipeline_17_parser_internals_17transition_system_16TransitionSystem_cfg(PyObject *o, CYTHON_UNUSED void *x) { + return __pyx_pw_5spacy_8pipeline_17_parser_internals_17transition_system_16TransitionSystem_3cfg_1__get__(o); +} + +static int __pyx_setprop_5spacy_8pipeline_17_parser_internals_17transition_system_16TransitionSystem_cfg(PyObject *o, PyObject *v, CYTHON_UNUSED void *x) { + if (v) { + return __pyx_pw_5spacy_8pipeline_17_parser_internals_17transition_system_16TransitionSystem_3cfg_3__set__(o, v); + } + else { + return __pyx_pw_5spacy_8pipeline_17_parser_internals_17transition_system_16TransitionSystem_3cfg_5__del__(o); + } +} + +static PyMethodDef __pyx_methods_5spacy_8pipeline_17_parser_internals_17transition_system_TransitionSystem[] = { + {"__reduce__", (PyCFunction)(void(*)(void))(__Pyx_PyCFunction_FastCallWithKeywords)__pyx_pw_5spacy_8pipeline_17_parser_internals_17transition_system_16TransitionSystem_3__reduce__, __Pyx_METH_FASTCALL|METH_KEYWORDS, __pyx_doc_5spacy_8pipeline_17_parser_internals_17transition_system_16TransitionSystem_2__reduce__}, + {"init_batch", (PyCFunction)(void(*)(void))(__Pyx_PyCFunction_FastCallWithKeywords)__pyx_pw_5spacy_8pipeline_17_parser_internals_17transition_system_16TransitionSystem_5init_batch, __Pyx_METH_FASTCALL|METH_KEYWORDS, __pyx_doc_5spacy_8pipeline_17_parser_internals_17transition_system_16TransitionSystem_4init_batch}, + {"get_oracle_sequence", (PyCFunction)(void(*)(void))(__Pyx_PyCFunction_FastCallWithKeywords)__pyx_pw_5spacy_8pipeline_17_parser_internals_17transition_system_16TransitionSystem_7get_oracle_sequence, __Pyx_METH_FASTCALL|METH_KEYWORDS, __pyx_doc_5spacy_8pipeline_17_parser_internals_17transition_system_16TransitionSystem_6get_oracle_sequence}, + {"get_oracle_sequence_from_state", (PyCFunction)(void(*)(void))(__Pyx_PyCFunction_FastCallWithKeywords)__pyx_pw_5spacy_8pipeline_17_parser_internals_17transition_system_16TransitionSystem_9get_oracle_sequence_from_state, __Pyx_METH_FASTCALL|METH_KEYWORDS, __pyx_doc_5spacy_8pipeline_17_parser_internals_17transition_system_16TransitionSystem_8get_oracle_sequence_from_state}, + {"apply_transition", (PyCFunction)(void(*)(void))(__Pyx_PyCFunction_FastCallWithKeywords)__pyx_pw_5spacy_8pipeline_17_parser_internals_17transition_system_16TransitionSystem_11apply_transition, __Pyx_METH_FASTCALL|METH_KEYWORDS, __pyx_doc_5spacy_8pipeline_17_parser_internals_17transition_system_16TransitionSystem_10apply_transition}, + {"is_valid", (PyCFunction)(void(*)(void))(__Pyx_PyCFunction_FastCallWithKeywords)__pyx_pw_5spacy_8pipeline_17_parser_internals_17transition_system_16TransitionSystem_13is_valid, __Pyx_METH_FASTCALL|METH_KEYWORDS, __pyx_doc_5spacy_8pipeline_17_parser_internals_17transition_system_16TransitionSystem_12is_valid}, + {"get_class_name", (PyCFunction)(void(*)(void))(__Pyx_PyCFunction_FastCallWithKeywords)__pyx_pw_5spacy_8pipeline_17_parser_internals_17transition_system_16TransitionSystem_15get_class_name, __Pyx_METH_FASTCALL|METH_KEYWORDS, __pyx_doc_5spacy_8pipeline_17_parser_internals_17transition_system_16TransitionSystem_14get_class_name}, + {"initialize_actions", (PyCFunction)(void(*)(void))(__Pyx_PyCFunction_FastCallWithKeywords)__pyx_pw_5spacy_8pipeline_17_parser_internals_17transition_system_16TransitionSystem_17initialize_actions, __Pyx_METH_FASTCALL|METH_KEYWORDS, __pyx_doc_5spacy_8pipeline_17_parser_internals_17transition_system_16TransitionSystem_16initialize_actions}, + {"add_action", (PyCFunction)(void(*)(void))(__Pyx_PyCFunction_FastCallWithKeywords)__pyx_pw_5spacy_8pipeline_17_parser_internals_17transition_system_16TransitionSystem_19add_action, __Pyx_METH_FASTCALL|METH_KEYWORDS, __pyx_doc_5spacy_8pipeline_17_parser_internals_17transition_system_16TransitionSystem_18add_action}, + {"to_disk", (PyCFunction)(void(*)(void))(__Pyx_PyCFunction_FastCallWithKeywords)__pyx_pw_5spacy_8pipeline_17_parser_internals_17transition_system_16TransitionSystem_21to_disk, __Pyx_METH_FASTCALL|METH_KEYWORDS, __pyx_doc_5spacy_8pipeline_17_parser_internals_17transition_system_16TransitionSystem_20to_disk}, + {"from_disk", (PyCFunction)(void(*)(void))(__Pyx_PyCFunction_FastCallWithKeywords)__pyx_pw_5spacy_8pipeline_17_parser_internals_17transition_system_16TransitionSystem_23from_disk, __Pyx_METH_FASTCALL|METH_KEYWORDS, __pyx_doc_5spacy_8pipeline_17_parser_internals_17transition_system_16TransitionSystem_22from_disk}, + {"to_bytes", (PyCFunction)(void(*)(void))(__Pyx_PyCFunction_FastCallWithKeywords)__pyx_pw_5spacy_8pipeline_17_parser_internals_17transition_system_16TransitionSystem_25to_bytes, __Pyx_METH_FASTCALL|METH_KEYWORDS, __pyx_doc_5spacy_8pipeline_17_parser_internals_17transition_system_16TransitionSystem_24to_bytes}, + {"from_bytes", (PyCFunction)(void(*)(void))(__Pyx_PyCFunction_FastCallWithKeywords)__pyx_pw_5spacy_8pipeline_17_parser_internals_17transition_system_16TransitionSystem_27from_bytes, __Pyx_METH_FASTCALL|METH_KEYWORDS, __pyx_doc_5spacy_8pipeline_17_parser_internals_17transition_system_16TransitionSystem_26from_bytes}, + {0, 0, 0, 0} +}; + +static struct PyGetSetDef __pyx_getsets_5spacy_8pipeline_17_parser_internals_17transition_system_TransitionSystem[] = { + {"neg_key", __pyx_getprop_5spacy_8pipeline_17_parser_internals_17transition_system_16TransitionSystem_neg_key, 0, 0, 0}, + {"n_moves", __pyx_getprop_5spacy_8pipeline_17_parser_internals_17transition_system_16TransitionSystem_n_moves, 0, 0, 0}, + {"root_label", __pyx_getprop_5spacy_8pipeline_17_parser_internals_17transition_system_16TransitionSystem_root_label, __pyx_setprop_5spacy_8pipeline_17_parser_internals_17transition_system_16TransitionSystem_root_label, PyDoc_STR("root_label: 'attr_t'"), 0}, + {"freqs", __pyx_getprop_5spacy_8pipeline_17_parser_internals_17transition_system_16TransitionSystem_freqs, __pyx_setprop_5spacy_8pipeline_17_parser_internals_17transition_system_16TransitionSystem_freqs, PyDoc_STR("freqs: object"), 0}, + {"labels", __pyx_getprop_5spacy_8pipeline_17_parser_internals_17transition_system_16TransitionSystem_labels, __pyx_setprop_5spacy_8pipeline_17_parser_internals_17transition_system_16TransitionSystem_labels, PyDoc_STR("labels: object"), 0}, + {"cfg", __pyx_getprop_5spacy_8pipeline_17_parser_internals_17transition_system_16TransitionSystem_cfg, __pyx_setprop_5spacy_8pipeline_17_parser_internals_17transition_system_16TransitionSystem_cfg, PyDoc_STR("cfg: object"), 0}, + {0, 0, 0, 0, 0} +}; +#if CYTHON_USE_TYPE_SPECS +static PyType_Slot __pyx_type_5spacy_8pipeline_17_parser_internals_17transition_system_TransitionSystem_slots[] = { + {Py_tp_dealloc, (void *)__pyx_tp_dealloc_5spacy_8pipeline_17_parser_internals_17transition_system_TransitionSystem}, + {Py_tp_doc, (void *)PyDoc_STR("TransitionSystem(StringStore string_table, labels_by_action=None, min_freq=None, incorrect_spans_key=None)")}, + {Py_tp_traverse, (void *)__pyx_tp_traverse_5spacy_8pipeline_17_parser_internals_17transition_system_TransitionSystem}, + {Py_tp_clear, (void *)__pyx_tp_clear_5spacy_8pipeline_17_parser_internals_17transition_system_TransitionSystem}, + {Py_tp_methods, (void *)__pyx_methods_5spacy_8pipeline_17_parser_internals_17transition_system_TransitionSystem}, + {Py_tp_getset, (void *)__pyx_getsets_5spacy_8pipeline_17_parser_internals_17transition_system_TransitionSystem}, + {Py_tp_init, (void *)__pyx_pw_5spacy_8pipeline_17_parser_internals_17transition_system_16TransitionSystem_1__init__}, + {Py_tp_new, (void *)__pyx_tp_new_5spacy_8pipeline_17_parser_internals_17transition_system_TransitionSystem}, + {0, 0}, +}; +static PyType_Spec __pyx_type_5spacy_8pipeline_17_parser_internals_17transition_system_TransitionSystem_spec = { + "spacy.pipeline._parser_internals.transition_system.TransitionSystem", + sizeof(struct __pyx_obj_5spacy_8pipeline_17_parser_internals_17transition_system_TransitionSystem), + 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_5spacy_8pipeline_17_parser_internals_17transition_system_TransitionSystem_slots, +}; +#else + +static PyTypeObject __pyx_type_5spacy_8pipeline_17_parser_internals_17transition_system_TransitionSystem = { + PyVarObject_HEAD_INIT(0, 0) + "spacy.pipeline._parser_internals.transition_system.""TransitionSystem", /*tp_name*/ + sizeof(struct __pyx_obj_5spacy_8pipeline_17_parser_internals_17transition_system_TransitionSystem), /*tp_basicsize*/ + 0, /*tp_itemsize*/ + __pyx_tp_dealloc_5spacy_8pipeline_17_parser_internals_17transition_system_TransitionSystem, /*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("TransitionSystem(StringStore string_table, labels_by_action=None, min_freq=None, incorrect_spans_key=None)"), /*tp_doc*/ + __pyx_tp_traverse_5spacy_8pipeline_17_parser_internals_17transition_system_TransitionSystem, /*tp_traverse*/ + __pyx_tp_clear_5spacy_8pipeline_17_parser_internals_17transition_system_TransitionSystem, /*tp_clear*/ + 0, /*tp_richcompare*/ + 0, /*tp_weaklistoffset*/ + 0, /*tp_iter*/ + 0, /*tp_iternext*/ + __pyx_methods_5spacy_8pipeline_17_parser_internals_17transition_system_TransitionSystem, /*tp_methods*/ + 0, /*tp_members*/ + __pyx_getsets_5spacy_8pipeline_17_parser_internals_17transition_system_TransitionSystem, /*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_5spacy_8pipeline_17_parser_internals_17transition_system_16TransitionSystem_1__init__, /*tp_init*/ + 0, /*tp_alloc*/ + __pyx_tp_new_5spacy_8pipeline_17_parser_internals_17transition_system_TransitionSystem, /*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_5spacy_8pipeline_17_parser_internals_17transition_system___pyx_scope_struct__to_bytes(PyTypeObject *t, CYTHON_UNUSED PyObject *a, CYTHON_UNUSED PyObject *k) { + PyObject *o; + #if CYTHON_USE_FREELISTS + if (likely((int)(__pyx_mstate_global->__pyx_freecount_5spacy_8pipeline_17_parser_internals_17transition_system___pyx_scope_struct__to_bytes > 0) & __PYX_CHECK_FINAL_TYPE_FOR_FREELISTS(t, __pyx_mstate_global->__pyx_ptype_5spacy_8pipeline_17_parser_internals_17transition_system___pyx_scope_struct__to_bytes, sizeof(struct __pyx_obj_5spacy_8pipeline_17_parser_internals_17transition_system___pyx_scope_struct__to_bytes)))) + { + o = (PyObject*)__pyx_mstate_global->__pyx_freelist_5spacy_8pipeline_17_parser_internals_17transition_system___pyx_scope_struct__to_bytes[--__pyx_mstate_global->__pyx_freecount_5spacy_8pipeline_17_parser_internals_17transition_system___pyx_scope_struct__to_bytes]; + #if CYTHON_USE_TYPE_SPECS + Py_DECREF(Py_TYPE(o)); + #endif + memset(o, 0, sizeof(struct __pyx_obj_5spacy_8pipeline_17_parser_internals_17transition_system___pyx_scope_struct__to_bytes)); + #if CYTHON_COMPILING_IN_LIMITED_API + (void) PyObject_Init(o, t); + #else + (void) PyObject_INIT(o, t); + #endif + PyObject_GC_Track(o); + } else + #endif + { + o = __Pyx_AllocateExtensionType(t, 1); + if (unlikely(!o)) return 0; + } + return o; +} + +static void __pyx_tp_dealloc_5spacy_8pipeline_17_parser_internals_17transition_system___pyx_scope_struct__to_bytes(PyObject *o) { + struct __pyx_obj_5spacy_8pipeline_17_parser_internals_17transition_system___pyx_scope_struct__to_bytes *p = (struct __pyx_obj_5spacy_8pipeline_17_parser_internals_17transition_system___pyx_scope_struct__to_bytes *)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_5spacy_8pipeline_17_parser_internals_17transition_system___pyx_scope_struct__to_bytes) { + if (PyObject_CallFinalizerFromDealloc(o)) return; + } + } + #endif + PyObject_GC_UnTrack(o); + Py_CLEAR(p->__pyx_v_self); + #if CYTHON_USE_FREELISTS + if (likely((int)(__pyx_mstate_global->__pyx_freecount_5spacy_8pipeline_17_parser_internals_17transition_system___pyx_scope_struct__to_bytes < 8) & __PYX_CHECK_FINAL_TYPE_FOR_FREELISTS(Py_TYPE(o), __pyx_mstate_global->__pyx_ptype_5spacy_8pipeline_17_parser_internals_17transition_system___pyx_scope_struct__to_bytes, sizeof(struct __pyx_obj_5spacy_8pipeline_17_parser_internals_17transition_system___pyx_scope_struct__to_bytes)))) + { + __pyx_mstate_global->__pyx_freelist_5spacy_8pipeline_17_parser_internals_17transition_system___pyx_scope_struct__to_bytes[__pyx_mstate_global->__pyx_freecount_5spacy_8pipeline_17_parser_internals_17transition_system___pyx_scope_struct__to_bytes++] = ((struct __pyx_obj_5spacy_8pipeline_17_parser_internals_17transition_system___pyx_scope_struct__to_bytes *)o); + } else + #endif + { + 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_5spacy_8pipeline_17_parser_internals_17transition_system___pyx_scope_struct__to_bytes(PyObject *o, visitproc v, void *a) { + int e; + struct __pyx_obj_5spacy_8pipeline_17_parser_internals_17transition_system___pyx_scope_struct__to_bytes *p = (struct __pyx_obj_5spacy_8pipeline_17_parser_internals_17transition_system___pyx_scope_struct__to_bytes *)o; + { + e = __Pyx_call_type_traverse(o, 1, v, a); + if (e) return e; + } + if (p->__pyx_v_self) { + e = (*v)(((PyObject *)p->__pyx_v_self), a); if (e) return e; + } + return 0; +} + +static int __pyx_tp_clear_5spacy_8pipeline_17_parser_internals_17transition_system___pyx_scope_struct__to_bytes(PyObject *o) { + PyObject* tmp; + struct __pyx_obj_5spacy_8pipeline_17_parser_internals_17transition_system___pyx_scope_struct__to_bytes *p = (struct __pyx_obj_5spacy_8pipeline_17_parser_internals_17transition_system___pyx_scope_struct__to_bytes *)o; + tmp = ((PyObject*)p->__pyx_v_self); + p->__pyx_v_self = ((struct __pyx_obj_5spacy_8pipeline_17_parser_internals_17transition_system_TransitionSystem *)Py_None); Py_INCREF(Py_None); + Py_XDECREF(tmp); + return 0; +} +#if CYTHON_USE_TYPE_SPECS +static PyType_Slot __pyx_type_5spacy_8pipeline_17_parser_internals_17transition_system___pyx_scope_struct__to_bytes_slots[] = { + {Py_tp_dealloc, (void *)__pyx_tp_dealloc_5spacy_8pipeline_17_parser_internals_17transition_system___pyx_scope_struct__to_bytes}, + {Py_tp_traverse, (void *)__pyx_tp_traverse_5spacy_8pipeline_17_parser_internals_17transition_system___pyx_scope_struct__to_bytes}, + {Py_tp_clear, (void *)__pyx_tp_clear_5spacy_8pipeline_17_parser_internals_17transition_system___pyx_scope_struct__to_bytes}, + {Py_tp_new, (void *)__pyx_tp_new_5spacy_8pipeline_17_parser_internals_17transition_system___pyx_scope_struct__to_bytes}, + {0, 0}, +}; +static PyType_Spec __pyx_type_5spacy_8pipeline_17_parser_internals_17transition_system___pyx_scope_struct__to_bytes_spec = { + "spacy.pipeline._parser_internals.transition_system.__pyx_scope_struct__to_bytes", + sizeof(struct __pyx_obj_5spacy_8pipeline_17_parser_internals_17transition_system___pyx_scope_struct__to_bytes), + 0, + Py_TPFLAGS_DEFAULT|Py_TPFLAGS_HAVE_VERSION_TAG|Py_TPFLAGS_CHECKTYPES|Py_TPFLAGS_HAVE_NEWBUFFER|Py_TPFLAGS_HAVE_GC, + __pyx_type_5spacy_8pipeline_17_parser_internals_17transition_system___pyx_scope_struct__to_bytes_slots, +}; +#else + +static PyTypeObject __pyx_type_5spacy_8pipeline_17_parser_internals_17transition_system___pyx_scope_struct__to_bytes = { + PyVarObject_HEAD_INIT(0, 0) + "spacy.pipeline._parser_internals.transition_system.""__pyx_scope_struct__to_bytes", /*tp_name*/ + sizeof(struct __pyx_obj_5spacy_8pipeline_17_parser_internals_17transition_system___pyx_scope_struct__to_bytes), /*tp_basicsize*/ + 0, /*tp_itemsize*/ + __pyx_tp_dealloc_5spacy_8pipeline_17_parser_internals_17transition_system___pyx_scope_struct__to_bytes, /*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_HAVE_GC, /*tp_flags*/ + 0, /*tp_doc*/ + __pyx_tp_traverse_5spacy_8pipeline_17_parser_internals_17transition_system___pyx_scope_struct__to_bytes, /*tp_traverse*/ + __pyx_tp_clear_5spacy_8pipeline_17_parser_internals_17transition_system___pyx_scope_struct__to_bytes, /*tp_clear*/ + 0, /*tp_richcompare*/ + 0, /*tp_weaklistoffset*/ + 0, /*tp_iter*/ + 0, /*tp_iternext*/ + 0, /*tp_methods*/ + 0, /*tp_members*/ + 0, /*tp_getset*/ + 0, /*tp_base*/ + 0, /*tp_dict*/ + 0, /*tp_descr_get*/ + 0, /*tp_descr_set*/ + #if !CYTHON_USE_TYPE_SPECS + 0, /*tp_dictoffset*/ + #endif + 0, /*tp_init*/ + 0, /*tp_alloc*/ + __pyx_tp_new_5spacy_8pipeline_17_parser_internals_17transition_system___pyx_scope_struct__to_bytes, /*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 struct __pyx_vtabstruct_array __pyx_vtable_array; + +static PyObject *__pyx_tp_new_array(PyTypeObject *t, PyObject *a, PyObject *k) { + struct __pyx_array_obj *p; + PyObject *o; + o = __Pyx_AllocateExtensionType(t, 0); + if (unlikely(!o)) return 0; + p = ((struct __pyx_array_obj *)o); + p->__pyx_vtab = __pyx_vtabptr_array; + p->mode = ((PyObject*)Py_None); Py_INCREF(Py_None); + p->_format = ((PyObject*)Py_None); Py_INCREF(Py_None); + if (unlikely(__pyx_array___cinit__(o, a, k) < 0)) goto bad; + return o; + bad: + Py_DECREF(o); o = 0; + return NULL; +} + +static void __pyx_tp_dealloc_array(PyObject *o) { + struct __pyx_array_obj *p = (struct __pyx_array_obj *)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_array) { + if (PyObject_CallFinalizerFromDealloc(o)) return; + } + } + #endif + { + PyObject *etype, *eval, *etb; + PyErr_Fetch(&etype, &eval, &etb); + __Pyx_SET_REFCNT(o, Py_REFCNT(o) + 1); + __pyx_array___dealloc__(o); + __Pyx_SET_REFCNT(o, Py_REFCNT(o) - 1); + PyErr_Restore(etype, eval, etb); + } + Py_CLEAR(p->mode); + Py_CLEAR(p->_format); + 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 PyObject *__pyx_sq_item_array(PyObject *o, Py_ssize_t i) { + PyObject *r; + PyObject *x = PyLong_FromSsize_t(i); if(!x) return 0; + #if CYTHON_USE_TYPE_SLOTS || (!CYTHON_USE_TYPE_SPECS && __PYX_LIMITED_VERSION_HEX < 0x030A0000) + r = Py_TYPE(o)->tp_as_mapping->mp_subscript(o, x); + #else + r = ((binaryfunc)PyType_GetSlot(Py_TYPE(o), Py_mp_subscript))(o, x); + #endif + Py_DECREF(x); + return r; +} + +static int __pyx_mp_ass_subscript_array(PyObject *o, PyObject *i, PyObject *v) { + if (v) { + return __pyx_array___setitem__(o, i, v); + } + else { + __Pyx_TypeName o_type_name; + o_type_name = __Pyx_PyType_GetFullyQualifiedName(Py_TYPE(o)); + PyErr_Format(PyExc_NotImplementedError, + "Subscript deletion not supported by " __Pyx_FMT_TYPENAME, o_type_name); + __Pyx_DECREF_TypeName(o_type_name); + return -1; + } +} + +static PyObject *__pyx_tp_getattro_array(PyObject *o, PyObject *n) { + PyObject *v = PyObject_GenericGetAttr(o, n); + if (!v && PyErr_ExceptionMatches(PyExc_AttributeError)) { + PyErr_Clear(); + v = __pyx_array___getattr__(o, n); + } + return v; +} + +static PyObject *__pyx_getprop___pyx_array_memview(PyObject *o, CYTHON_UNUSED void *x) { + return __pyx_pw_15View_dot_MemoryView_5array_7memview_1__get__(o); +} + +static PyMethodDef __pyx_methods_array[] = { + {"__getattr__", (PyCFunction)__pyx_array___getattr__, METH_O|METH_COEXIST, 0}, + {"__reduce_cython__", (PyCFunction)(void(*)(void))(__Pyx_PyCFunction_FastCallWithKeywords)__pyx_pw___pyx_array_1__reduce_cython__, __Pyx_METH_FASTCALL|METH_KEYWORDS, 0}, + {"__setstate_cython__", (PyCFunction)(void(*)(void))(__Pyx_PyCFunction_FastCallWithKeywords)__pyx_pw___pyx_array_3__setstate_cython__, __Pyx_METH_FASTCALL|METH_KEYWORDS, 0}, + {0, 0, 0, 0} +}; + +static struct PyGetSetDef __pyx_getsets_array[] = { + {"memview", __pyx_getprop___pyx_array_memview, 0, 0, 0}, + {0, 0, 0, 0, 0} +}; +#if CYTHON_USE_TYPE_SPECS +#if !CYTHON_COMPILING_IN_LIMITED_API + +static PyBufferProcs __pyx_tp_as_buffer_array = { + __pyx_array_getbuffer, /*bf_getbuffer*/ + 0, /*bf_releasebuffer*/ +}; +#endif +static PyType_Slot __pyx_type___pyx_array_slots[] = { + {Py_tp_dealloc, (void *)__pyx_tp_dealloc_array}, + {Py_sq_length, (void *)__pyx_array___len__}, + {Py_sq_item, (void *)__pyx_sq_item_array}, + {Py_mp_length, (void *)__pyx_array___len__}, + {Py_mp_subscript, (void *)__pyx_array___getitem__}, + {Py_mp_ass_subscript, (void *)__pyx_mp_ass_subscript_array}, + {Py_tp_getattro, (void *)__pyx_tp_getattro_array}, + #if defined(Py_bf_getbuffer) + {Py_bf_getbuffer, (void *)__pyx_array_getbuffer}, + #endif + {Py_tp_methods, (void *)__pyx_methods_array}, + {Py_tp_getset, (void *)__pyx_getsets_array}, + {Py_tp_new, (void *)__pyx_tp_new_array}, + {0, 0}, +}; +static PyType_Spec __pyx_type___pyx_array_spec = { + "spacy.pipeline._parser_internals.transition_system.array", + sizeof(struct __pyx_array_obj), + 0, + Py_TPFLAGS_DEFAULT|Py_TPFLAGS_HAVE_VERSION_TAG|Py_TPFLAGS_CHECKTYPES|Py_TPFLAGS_HAVE_NEWBUFFER|Py_TPFLAGS_BASETYPE|Py_TPFLAGS_SEQUENCE, + __pyx_type___pyx_array_slots, +}; +#else + +static PySequenceMethods __pyx_tp_as_sequence_array = { + __pyx_array___len__, /*sq_length*/ + 0, /*sq_concat*/ + 0, /*sq_repeat*/ + __pyx_sq_item_array, /*sq_item*/ + 0, /*sq_slice*/ + 0, /*sq_ass_item*/ + 0, /*sq_ass_slice*/ + 0, /*sq_contains*/ + 0, /*sq_inplace_concat*/ + 0, /*sq_inplace_repeat*/ +}; + +static PyMappingMethods __pyx_tp_as_mapping_array = { + __pyx_array___len__, /*mp_length*/ + __pyx_array___getitem__, /*mp_subscript*/ + __pyx_mp_ass_subscript_array, /*mp_ass_subscript*/ +}; + +static PyBufferProcs __pyx_tp_as_buffer_array = { + __pyx_array_getbuffer, /*bf_getbuffer*/ + 0, /*bf_releasebuffer*/ +}; + +static PyTypeObject __pyx_type___pyx_array = { + PyVarObject_HEAD_INIT(0, 0) + "spacy.pipeline._parser_internals.transition_system.""array", /*tp_name*/ + sizeof(struct __pyx_array_obj), /*tp_basicsize*/ + 0, /*tp_itemsize*/ + __pyx_tp_dealloc_array, /*tp_dealloc*/ + 0, /*tp_vectorcall_offset*/ + 0, /*tp_getattr*/ + 0, /*tp_setattr*/ + 0, /*tp_as_async*/ + 0, /*tp_repr*/ + 0, /*tp_as_number*/ + &__pyx_tp_as_sequence_array, /*tp_as_sequence*/ + &__pyx_tp_as_mapping_array, /*tp_as_mapping*/ + 0, /*tp_hash*/ + 0, /*tp_call*/ + 0, /*tp_str*/ + __pyx_tp_getattro_array, /*tp_getattro*/ + 0, /*tp_setattro*/ + &__pyx_tp_as_buffer_array, /*tp_as_buffer*/ + Py_TPFLAGS_DEFAULT|Py_TPFLAGS_HAVE_VERSION_TAG|Py_TPFLAGS_CHECKTYPES|Py_TPFLAGS_HAVE_NEWBUFFER|Py_TPFLAGS_BASETYPE|Py_TPFLAGS_SEQUENCE, /*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_array, /*tp_methods*/ + 0, /*tp_members*/ + __pyx_getsets_array, /*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_array, /*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_Enum(PyTypeObject *t, CYTHON_UNUSED PyObject *a, CYTHON_UNUSED PyObject *k) { + struct __pyx_MemviewEnum_obj *p; + PyObject *o; + o = __Pyx_AllocateExtensionType(t, 0); + if (unlikely(!o)) return 0; + p = ((struct __pyx_MemviewEnum_obj *)o); + p->name = Py_None; Py_INCREF(Py_None); + return o; +} + +static void __pyx_tp_dealloc_Enum(PyObject *o) { + struct __pyx_MemviewEnum_obj *p = (struct __pyx_MemviewEnum_obj *)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_Enum) { + if (PyObject_CallFinalizerFromDealloc(o)) return; + } + } + #endif + PyObject_GC_UnTrack(o); + Py_CLEAR(p->name); + 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_Enum(PyObject *o, visitproc v, void *a) { + int e; + struct __pyx_MemviewEnum_obj *p = (struct __pyx_MemviewEnum_obj *)o; + { + e = __Pyx_call_type_traverse(o, 1, v, a); + if (e) return e; + } + if (p->name) { + e = (*v)(p->name, a); if (e) return e; + } + return 0; +} + +static int __pyx_tp_clear_Enum(PyObject *o) { + PyObject* tmp; + struct __pyx_MemviewEnum_obj *p = (struct __pyx_MemviewEnum_obj *)o; + tmp = ((PyObject*)p->name); + p->name = Py_None; Py_INCREF(Py_None); + Py_XDECREF(tmp); + return 0; +} + +static PyMethodDef __pyx_methods_Enum[] = { + {"__reduce_cython__", (PyCFunction)(void(*)(void))(__Pyx_PyCFunction_FastCallWithKeywords)__pyx_pw___pyx_MemviewEnum_1__reduce_cython__, __Pyx_METH_FASTCALL|METH_KEYWORDS, 0}, + {"__setstate_cython__", (PyCFunction)(void(*)(void))(__Pyx_PyCFunction_FastCallWithKeywords)__pyx_pw___pyx_MemviewEnum_3__setstate_cython__, __Pyx_METH_FASTCALL|METH_KEYWORDS, 0}, + {0, 0, 0, 0} +}; +#if CYTHON_USE_TYPE_SPECS +static PyType_Slot __pyx_type___pyx_MemviewEnum_slots[] = { + {Py_tp_dealloc, (void *)__pyx_tp_dealloc_Enum}, + {Py_tp_repr, (void *)__pyx_MemviewEnum___repr__}, + {Py_tp_traverse, (void *)__pyx_tp_traverse_Enum}, + {Py_tp_clear, (void *)__pyx_tp_clear_Enum}, + {Py_tp_methods, (void *)__pyx_methods_Enum}, + {Py_tp_init, (void *)__pyx_MemviewEnum___init__}, + {Py_tp_new, (void *)__pyx_tp_new_Enum}, + {0, 0}, +}; +static PyType_Spec __pyx_type___pyx_MemviewEnum_spec = { + "spacy.pipeline._parser_internals.transition_system.Enum", + sizeof(struct __pyx_MemviewEnum_obj), + 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___pyx_MemviewEnum_slots, +}; +#else + +static PyTypeObject __pyx_type___pyx_MemviewEnum = { + PyVarObject_HEAD_INIT(0, 0) + "spacy.pipeline._parser_internals.transition_system.""Enum", /*tp_name*/ + sizeof(struct __pyx_MemviewEnum_obj), /*tp_basicsize*/ + 0, /*tp_itemsize*/ + __pyx_tp_dealloc_Enum, /*tp_dealloc*/ + 0, /*tp_vectorcall_offset*/ + 0, /*tp_getattr*/ + 0, /*tp_setattr*/ + 0, /*tp_as_async*/ + __pyx_MemviewEnum___repr__, /*tp_repr*/ + 0, /*tp_as_number*/ + 0, /*tp_as_sequence*/ + 0, /*tp_as_mapping*/ + 0, /*tp_hash*/ + 0, /*tp_call*/ + 0, /*tp_str*/ + 0, /*tp_getattro*/ + 0, /*tp_setattro*/ + 0, /*tp_as_buffer*/ + Py_TPFLAGS_DEFAULT|Py_TPFLAGS_HAVE_VERSION_TAG|Py_TPFLAGS_CHECKTYPES|Py_TPFLAGS_HAVE_NEWBUFFER|Py_TPFLAGS_BASETYPE|Py_TPFLAGS_HAVE_GC, /*tp_flags*/ + 0, /*tp_doc*/ + __pyx_tp_traverse_Enum, /*tp_traverse*/ + __pyx_tp_clear_Enum, /*tp_clear*/ + 0, /*tp_richcompare*/ + 0, /*tp_weaklistoffset*/ + 0, /*tp_iter*/ + 0, /*tp_iternext*/ + __pyx_methods_Enum, /*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_MemviewEnum___init__, /*tp_init*/ + 0, /*tp_alloc*/ + __pyx_tp_new_Enum, /*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 struct __pyx_vtabstruct_memoryview __pyx_vtable_memoryview; + +static PyObject *__pyx_tp_new_memoryview(PyTypeObject *t, PyObject *a, PyObject *k) { + struct __pyx_memoryview_obj *p; + PyObject *o; + o = __Pyx_AllocateExtensionType(t, 0); + if (unlikely(!o)) return 0; + p = ((struct __pyx_memoryview_obj *)o); + p->__pyx_vtab = __pyx_vtabptr_memoryview; + p->obj = Py_None; Py_INCREF(Py_None); + p->_size = Py_None; Py_INCREF(Py_None); + p->view.obj = NULL; + if (unlikely(__pyx_memoryview___cinit__(o, a, k) < 0)) goto bad; + return o; + bad: + Py_DECREF(o); o = 0; + return NULL; +} + +static void __pyx_tp_dealloc_memoryview(PyObject *o) { + struct __pyx_memoryview_obj *p = (struct __pyx_memoryview_obj *)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_memoryview) { + 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_memoryview___dealloc__(o); + __Pyx_SET_REFCNT(o, Py_REFCNT(o) - 1); + PyErr_Restore(etype, eval, etb); + } + Py_CLEAR(p->obj); + Py_CLEAR(p->_size); + 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_memoryview(PyObject *o, visitproc v, void *a) { + int e; + struct __pyx_memoryview_obj *p = (struct __pyx_memoryview_obj *)o; + { + e = __Pyx_call_type_traverse(o, 1, v, a); + if (e) return e; + } + if (p->obj) { + e = (*v)(p->obj, a); if (e) return e; + } + if (p->_size) { + e = (*v)(p->_size, a); if (e) return e; + } + if (p->view.obj) { + e = (*v)(p->view.obj, a); if (e) return e; + } + return 0; +} + +static int __pyx_tp_clear_memoryview(PyObject *o) { + PyObject* tmp; + struct __pyx_memoryview_obj *p = (struct __pyx_memoryview_obj *)o; + tmp = ((PyObject*)p->obj); + p->obj = Py_None; Py_INCREF(Py_None); + Py_XDECREF(tmp); + tmp = ((PyObject*)p->_size); + p->_size = Py_None; Py_INCREF(Py_None); + Py_XDECREF(tmp); + Py_CLEAR(p->view.obj); + return 0; +} + +static PyObject *__pyx_sq_item_memoryview(PyObject *o, Py_ssize_t i) { + PyObject *r; + PyObject *x = PyLong_FromSsize_t(i); if(!x) return 0; + #if CYTHON_USE_TYPE_SLOTS || (!CYTHON_USE_TYPE_SPECS && __PYX_LIMITED_VERSION_HEX < 0x030A0000) + r = Py_TYPE(o)->tp_as_mapping->mp_subscript(o, x); + #else + r = ((binaryfunc)PyType_GetSlot(Py_TYPE(o), Py_mp_subscript))(o, x); + #endif + Py_DECREF(x); + return r; +} + +static int __pyx_mp_ass_subscript_memoryview(PyObject *o, PyObject *i, PyObject *v) { + if (v) { + return __pyx_memoryview___setitem__(o, i, v); + } + else { + __Pyx_TypeName o_type_name; + o_type_name = __Pyx_PyType_GetFullyQualifiedName(Py_TYPE(o)); + PyErr_Format(PyExc_NotImplementedError, + "Subscript deletion not supported by " __Pyx_FMT_TYPENAME, o_type_name); + __Pyx_DECREF_TypeName(o_type_name); + return -1; + } +} + +static PyObject *__pyx_getprop___pyx_memoryview_T(PyObject *o, CYTHON_UNUSED void *x) { + return __pyx_pw_15View_dot_MemoryView_10memoryview_1T_1__get__(o); +} + +static PyObject *__pyx_getprop___pyx_memoryview_base(PyObject *o, CYTHON_UNUSED void *x) { + return __pyx_pw_15View_dot_MemoryView_10memoryview_4base_1__get__(o); +} + +static PyObject *__pyx_getprop___pyx_memoryview_shape(PyObject *o, CYTHON_UNUSED void *x) { + return __pyx_pw_15View_dot_MemoryView_10memoryview_5shape_1__get__(o); +} + +static PyObject *__pyx_getprop___pyx_memoryview_strides(PyObject *o, CYTHON_UNUSED void *x) { + return __pyx_pw_15View_dot_MemoryView_10memoryview_7strides_1__get__(o); +} + +static PyObject *__pyx_getprop___pyx_memoryview_suboffsets(PyObject *o, CYTHON_UNUSED void *x) { + return __pyx_pw_15View_dot_MemoryView_10memoryview_10suboffsets_1__get__(o); +} + +static PyObject *__pyx_getprop___pyx_memoryview_ndim(PyObject *o, CYTHON_UNUSED void *x) { + return __pyx_pw_15View_dot_MemoryView_10memoryview_4ndim_1__get__(o); +} + +static PyObject *__pyx_getprop___pyx_memoryview_itemsize(PyObject *o, CYTHON_UNUSED void *x) { + return __pyx_pw_15View_dot_MemoryView_10memoryview_8itemsize_1__get__(o); +} + +static PyObject *__pyx_getprop___pyx_memoryview_nbytes(PyObject *o, CYTHON_UNUSED void *x) { + return __pyx_pw_15View_dot_MemoryView_10memoryview_6nbytes_1__get__(o); +} + +static PyObject *__pyx_getprop___pyx_memoryview_size(PyObject *o, CYTHON_UNUSED void *x) { + return __pyx_pw_15View_dot_MemoryView_10memoryview_4size_1__get__(o); +} + +static PyMethodDef __pyx_methods_memoryview[] = { + {"is_c_contig", (PyCFunction)(void(*)(void))(__Pyx_PyCFunction_FastCallWithKeywords)__pyx_memoryview_is_c_contig, __Pyx_METH_FASTCALL|METH_KEYWORDS, 0}, + {"is_f_contig", (PyCFunction)(void(*)(void))(__Pyx_PyCFunction_FastCallWithKeywords)__pyx_memoryview_is_f_contig, __Pyx_METH_FASTCALL|METH_KEYWORDS, 0}, + {"copy", (PyCFunction)(void(*)(void))(__Pyx_PyCFunction_FastCallWithKeywords)__pyx_memoryview_copy, __Pyx_METH_FASTCALL|METH_KEYWORDS, 0}, + {"copy_fortran", (PyCFunction)(void(*)(void))(__Pyx_PyCFunction_FastCallWithKeywords)__pyx_memoryview_copy_fortran, __Pyx_METH_FASTCALL|METH_KEYWORDS, 0}, + {"__reduce_cython__", (PyCFunction)(void(*)(void))(__Pyx_PyCFunction_FastCallWithKeywords)__pyx_pw___pyx_memoryview_1__reduce_cython__, __Pyx_METH_FASTCALL|METH_KEYWORDS, 0}, + {"__setstate_cython__", (PyCFunction)(void(*)(void))(__Pyx_PyCFunction_FastCallWithKeywords)__pyx_pw___pyx_memoryview_3__setstate_cython__, __Pyx_METH_FASTCALL|METH_KEYWORDS, 0}, + {0, 0, 0, 0} +}; + +static struct PyGetSetDef __pyx_getsets_memoryview[] = { + {"T", __pyx_getprop___pyx_memoryview_T, 0, 0, 0}, + {"base", __pyx_getprop___pyx_memoryview_base, 0, 0, 0}, + {"shape", __pyx_getprop___pyx_memoryview_shape, 0, 0, 0}, + {"strides", __pyx_getprop___pyx_memoryview_strides, 0, 0, 0}, + {"suboffsets", __pyx_getprop___pyx_memoryview_suboffsets, 0, 0, 0}, + {"ndim", __pyx_getprop___pyx_memoryview_ndim, 0, 0, 0}, + {"itemsize", __pyx_getprop___pyx_memoryview_itemsize, 0, 0, 0}, + {"nbytes", __pyx_getprop___pyx_memoryview_nbytes, 0, 0, 0}, + {"size", __pyx_getprop___pyx_memoryview_size, 0, 0, 0}, + {0, 0, 0, 0, 0} +}; +#if CYTHON_USE_TYPE_SPECS +#if !CYTHON_COMPILING_IN_LIMITED_API + +static PyBufferProcs __pyx_tp_as_buffer_memoryview = { + __pyx_memoryview_getbuffer, /*bf_getbuffer*/ + 0, /*bf_releasebuffer*/ +}; +#endif +static PyType_Slot __pyx_type___pyx_memoryview_slots[] = { + {Py_tp_dealloc, (void *)__pyx_tp_dealloc_memoryview}, + {Py_tp_repr, (void *)__pyx_memoryview___repr__}, + {Py_sq_length, (void *)__pyx_memoryview___len__}, + {Py_sq_item, (void *)__pyx_sq_item_memoryview}, + {Py_mp_length, (void *)__pyx_memoryview___len__}, + {Py_mp_subscript, (void *)__pyx_memoryview___getitem__}, + {Py_mp_ass_subscript, (void *)__pyx_mp_ass_subscript_memoryview}, + {Py_tp_str, (void *)__pyx_memoryview___str__}, + #if defined(Py_bf_getbuffer) + {Py_bf_getbuffer, (void *)__pyx_memoryview_getbuffer}, + #endif + {Py_tp_traverse, (void *)__pyx_tp_traverse_memoryview}, + {Py_tp_clear, (void *)__pyx_tp_clear_memoryview}, + {Py_tp_methods, (void *)__pyx_methods_memoryview}, + {Py_tp_getset, (void *)__pyx_getsets_memoryview}, + {Py_tp_new, (void *)__pyx_tp_new_memoryview}, + {0, 0}, +}; +static PyType_Spec __pyx_type___pyx_memoryview_spec = { + "spacy.pipeline._parser_internals.transition_system.memoryview", + sizeof(struct __pyx_memoryview_obj), + 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___pyx_memoryview_slots, +}; +#else + +static PySequenceMethods __pyx_tp_as_sequence_memoryview = { + __pyx_memoryview___len__, /*sq_length*/ + 0, /*sq_concat*/ + 0, /*sq_repeat*/ + __pyx_sq_item_memoryview, /*sq_item*/ + 0, /*sq_slice*/ + 0, /*sq_ass_item*/ + 0, /*sq_ass_slice*/ + 0, /*sq_contains*/ + 0, /*sq_inplace_concat*/ + 0, /*sq_inplace_repeat*/ +}; + +static PyMappingMethods __pyx_tp_as_mapping_memoryview = { + __pyx_memoryview___len__, /*mp_length*/ + __pyx_memoryview___getitem__, /*mp_subscript*/ + __pyx_mp_ass_subscript_memoryview, /*mp_ass_subscript*/ +}; + +static PyBufferProcs __pyx_tp_as_buffer_memoryview = { + __pyx_memoryview_getbuffer, /*bf_getbuffer*/ + 0, /*bf_releasebuffer*/ +}; + +static PyTypeObject __pyx_type___pyx_memoryview = { + PyVarObject_HEAD_INIT(0, 0) + "spacy.pipeline._parser_internals.transition_system.""memoryview", /*tp_name*/ + sizeof(struct __pyx_memoryview_obj), /*tp_basicsize*/ + 0, /*tp_itemsize*/ + __pyx_tp_dealloc_memoryview, /*tp_dealloc*/ + 0, /*tp_vectorcall_offset*/ + 0, /*tp_getattr*/ + 0, /*tp_setattr*/ + 0, /*tp_as_async*/ + __pyx_memoryview___repr__, /*tp_repr*/ + 0, /*tp_as_number*/ + &__pyx_tp_as_sequence_memoryview, /*tp_as_sequence*/ + &__pyx_tp_as_mapping_memoryview, /*tp_as_mapping*/ + 0, /*tp_hash*/ + 0, /*tp_call*/ + __pyx_memoryview___str__, /*tp_str*/ + 0, /*tp_getattro*/ + 0, /*tp_setattro*/ + &__pyx_tp_as_buffer_memoryview, /*tp_as_buffer*/ + Py_TPFLAGS_DEFAULT|Py_TPFLAGS_HAVE_VERSION_TAG|Py_TPFLAGS_CHECKTYPES|Py_TPFLAGS_HAVE_NEWBUFFER|Py_TPFLAGS_BASETYPE|Py_TPFLAGS_HAVE_GC, /*tp_flags*/ + 0, /*tp_doc*/ + __pyx_tp_traverse_memoryview, /*tp_traverse*/ + __pyx_tp_clear_memoryview, /*tp_clear*/ + 0, /*tp_richcompare*/ + 0, /*tp_weaklistoffset*/ + 0, /*tp_iter*/ + 0, /*tp_iternext*/ + __pyx_methods_memoryview, /*tp_methods*/ + 0, /*tp_members*/ + __pyx_getsets_memoryview, /*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_memoryview, /*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 struct __pyx_vtabstruct__memoryviewslice __pyx_vtable__memoryviewslice; + +static PyObject *__pyx_tp_new__memoryviewslice(PyTypeObject *t, PyObject *a, PyObject *k) { + struct __pyx_memoryviewslice_obj *p; + PyObject *o = __pyx_tp_new_memoryview(t, a, k); + if (unlikely(!o)) return 0; + p = ((struct __pyx_memoryviewslice_obj *)o); + p->__pyx_base.__pyx_vtab = (struct __pyx_vtabstruct_memoryview*)__pyx_vtabptr__memoryviewslice; + __Pyx_default_placement_construct(&(p->from_slice)); + p->from_object = Py_None; Py_INCREF(Py_None); + p->from_slice.memview = NULL; + return o; +} + +static void __pyx_tp_dealloc__memoryviewslice(PyObject *o) { + struct __pyx_memoryviewslice_obj *p = (struct __pyx_memoryviewslice_obj *)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__memoryviewslice) { + 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_memoryviewslice___dealloc__(o); + __Pyx_SET_REFCNT(o, Py_REFCNT(o) - 1); + PyErr_Restore(etype, eval, etb); + } + __Pyx_call_destructor(p->from_slice); + Py_CLEAR(p->from_object); + PyObject_GC_Track(o); + __pyx_tp_dealloc_memoryview(o); +} + +static int __pyx_tp_traverse__memoryviewslice(PyObject *o, visitproc v, void *a) { + int e; + struct __pyx_memoryviewslice_obj *p = (struct __pyx_memoryviewslice_obj *)o; + e = __pyx_tp_traverse_memoryview(o, v, a); if (e) return e; + if (p->from_object) { + e = (*v)(p->from_object, a); if (e) return e; + } + return 0; +} + +static int __pyx_tp_clear__memoryviewslice(PyObject *o) { + PyObject* tmp; + struct __pyx_memoryviewslice_obj *p = (struct __pyx_memoryviewslice_obj *)o; + __pyx_tp_clear_memoryview(o); + tmp = ((PyObject*)p->from_object); + p->from_object = Py_None; Py_INCREF(Py_None); + Py_XDECREF(tmp); + __PYX_XCLEAR_MEMVIEW(&p->from_slice, 1); + return 0; +} + +static PyMethodDef __pyx_methods__memoryviewslice[] = { + {"__reduce_cython__", (PyCFunction)(void(*)(void))(__Pyx_PyCFunction_FastCallWithKeywords)__pyx_pw___pyx_memoryviewslice_1__reduce_cython__, __Pyx_METH_FASTCALL|METH_KEYWORDS, 0}, + {"__setstate_cython__", (PyCFunction)(void(*)(void))(__Pyx_PyCFunction_FastCallWithKeywords)__pyx_pw___pyx_memoryviewslice_3__setstate_cython__, __Pyx_METH_FASTCALL|METH_KEYWORDS, 0}, + {0, 0, 0, 0} +}; +#if CYTHON_USE_TYPE_SPECS +static PyType_Slot __pyx_type___pyx_memoryviewslice_slots[] = { + {Py_tp_dealloc, (void *)__pyx_tp_dealloc__memoryviewslice}, + {Py_tp_doc, (void *)PyDoc_STR("Internal class for passing memoryview slices to Python")}, + {Py_tp_traverse, (void *)__pyx_tp_traverse__memoryviewslice}, + {Py_tp_clear, (void *)__pyx_tp_clear__memoryviewslice}, + {Py_tp_methods, (void *)__pyx_methods__memoryviewslice}, + {Py_tp_new, (void *)__pyx_tp_new__memoryviewslice}, + {0, 0}, +}; +static PyType_Spec __pyx_type___pyx_memoryviewslice_spec = { + "spacy.pipeline._parser_internals.transition_system._memoryviewslice", + sizeof(struct __pyx_memoryviewslice_obj), + 0, + Py_TPFLAGS_DEFAULT|Py_TPFLAGS_HAVE_VERSION_TAG|Py_TPFLAGS_CHECKTYPES|Py_TPFLAGS_HAVE_NEWBUFFER|Py_TPFLAGS_BASETYPE|Py_TPFLAGS_HAVE_GC|Py_TPFLAGS_SEQUENCE, + __pyx_type___pyx_memoryviewslice_slots, +}; +#else + +static PyTypeObject __pyx_type___pyx_memoryviewslice = { + PyVarObject_HEAD_INIT(0, 0) + "spacy.pipeline._parser_internals.transition_system.""_memoryviewslice", /*tp_name*/ + sizeof(struct __pyx_memoryviewslice_obj), /*tp_basicsize*/ + 0, /*tp_itemsize*/ + __pyx_tp_dealloc__memoryviewslice, /*tp_dealloc*/ + 0, /*tp_vectorcall_offset*/ + 0, /*tp_getattr*/ + 0, /*tp_setattr*/ + 0, /*tp_as_async*/ + #if CYTHON_COMPILING_IN_PYPY || 0 + __pyx_memoryview___repr__, /*tp_repr*/ + #else + 0, /*tp_repr*/ + #endif + 0, /*tp_as_number*/ + 0, /*tp_as_sequence*/ + 0, /*tp_as_mapping*/ + 0, /*tp_hash*/ + 0, /*tp_call*/ + #if CYTHON_COMPILING_IN_PYPY || 0 + __pyx_memoryview___str__, /*tp_str*/ + #else + 0, /*tp_str*/ + #endif + 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|Py_TPFLAGS_SEQUENCE, /*tp_flags*/ + PyDoc_STR("Internal class for passing memoryview slices to Python"), /*tp_doc*/ + __pyx_tp_traverse__memoryviewslice, /*tp_traverse*/ + __pyx_tp_clear__memoryviewslice, /*tp_clear*/ + 0, /*tp_richcompare*/ + 0, /*tp_weaklistoffset*/ + 0, /*tp_iter*/ + 0, /*tp_iternext*/ + __pyx_methods__memoryviewslice, /*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__memoryviewslice, /*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_collections_abc_Sequence = Py_None; Py_INCREF(Py_None); + generic = Py_None; Py_INCREF(Py_None); + strided = Py_None; Py_INCREF(Py_None); + indirect = Py_None; Py_INCREF(Py_None); + contiguous = Py_None; Py_INCREF(Py_None); + indirect_contiguous = Py_None; Py_INCREF(Py_None); + __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); + PyObject *__pyx_t_1 = NULL; + int __pyx_lineno = 0; + const char *__pyx_filename = NULL; + int __pyx_clineno = 0; + __Pyx_RefNannySetupContext("__Pyx_modinit_type_init_code", 0); + /*--- Type init code ---*/ + __pyx_vtabptr_5spacy_8pipeline_17_parser_internals_17transition_system_TransitionSystem = &__pyx_vtable_5spacy_8pipeline_17_parser_internals_17transition_system_TransitionSystem; + __pyx_vtable_5spacy_8pipeline_17_parser_internals_17transition_system_TransitionSystem.lookup_transition = (struct __pyx_t_5spacy_8pipeline_17_parser_internals_17transition_system_Transition (*)(struct __pyx_obj_5spacy_8pipeline_17_parser_internals_17transition_system_TransitionSystem *, PyObject *))__pyx_f_5spacy_8pipeline_17_parser_internals_17transition_system_16TransitionSystem_lookup_transition; + __pyx_vtable_5spacy_8pipeline_17_parser_internals_17transition_system_TransitionSystem.init_transition = (struct __pyx_t_5spacy_8pipeline_17_parser_internals_17transition_system_Transition (*)(struct __pyx_obj_5spacy_8pipeline_17_parser_internals_17transition_system_TransitionSystem *, int, int, __pyx_t_5spacy_8typedefs_attr_t))__pyx_f_5spacy_8pipeline_17_parser_internals_17transition_system_16TransitionSystem_init_transition; + __pyx_vtable_5spacy_8pipeline_17_parser_internals_17transition_system_TransitionSystem.set_valid = (int (*)(struct __pyx_obj_5spacy_8pipeline_17_parser_internals_17transition_system_TransitionSystem *, int *, __pyx_t_5spacy_8pipeline_17_parser_internals_6_state_StateC const *))__pyx_f_5spacy_8pipeline_17_parser_internals_17transition_system_16TransitionSystem_set_valid; + __pyx_vtable_5spacy_8pipeline_17_parser_internals_17transition_system_TransitionSystem.set_costs = (int (*)(struct __pyx_obj_5spacy_8pipeline_17_parser_internals_17transition_system_TransitionSystem *, int *, __pyx_t_5spacy_8typedefs_weight_t *, __pyx_t_5spacy_8pipeline_17_parser_internals_6_state_StateC const *, PyObject *))__pyx_f_5spacy_8pipeline_17_parser_internals_17transition_system_16TransitionSystem_set_costs; + #if CYTHON_USE_TYPE_SPECS + __pyx_mstate->__pyx_ptype_5spacy_8pipeline_17_parser_internals_17transition_system_TransitionSystem = (PyTypeObject *) __Pyx_PyType_FromModuleAndSpec(__pyx_m, &__pyx_type_5spacy_8pipeline_17_parser_internals_17transition_system_TransitionSystem_spec, NULL); if (unlikely(!__pyx_mstate->__pyx_ptype_5spacy_8pipeline_17_parser_internals_17transition_system_TransitionSystem)) __PYX_ERR(0, 36, __pyx_L1_error) + if (__Pyx_fix_up_extension_type_from_spec(&__pyx_type_5spacy_8pipeline_17_parser_internals_17transition_system_TransitionSystem_spec, __pyx_mstate->__pyx_ptype_5spacy_8pipeline_17_parser_internals_17transition_system_TransitionSystem) < (0)) __PYX_ERR(0, 36, __pyx_L1_error) + #else + __pyx_mstate->__pyx_ptype_5spacy_8pipeline_17_parser_internals_17transition_system_TransitionSystem = &__pyx_type_5spacy_8pipeline_17_parser_internals_17transition_system_TransitionSystem; + #endif + #if !CYTHON_COMPILING_IN_LIMITED_API + #endif + #if !CYTHON_USE_TYPE_SPECS + if (__Pyx_PyType_Ready(__pyx_mstate->__pyx_ptype_5spacy_8pipeline_17_parser_internals_17transition_system_TransitionSystem) < (0)) __PYX_ERR(0, 36, __pyx_L1_error) + #endif + #if CYTHON_COMPILING_IN_CPYTHON && PY_VERSION_HEX >= 0x030E0000 + PyUnstable_Object_EnableDeferredRefcount((PyObject*)__pyx_mstate->__pyx_ptype_5spacy_8pipeline_17_parser_internals_17transition_system_TransitionSystem); + #endif + #if !CYTHON_COMPILING_IN_LIMITED_API + if ((CYTHON_USE_TYPE_SLOTS && CYTHON_USE_PYTYPE_LOOKUP) && likely(!__pyx_mstate->__pyx_ptype_5spacy_8pipeline_17_parser_internals_17transition_system_TransitionSystem->tp_dictoffset && __pyx_mstate->__pyx_ptype_5spacy_8pipeline_17_parser_internals_17transition_system_TransitionSystem->tp_getattro == PyObject_GenericGetAttr)) { + __pyx_mstate->__pyx_ptype_5spacy_8pipeline_17_parser_internals_17transition_system_TransitionSystem->tp_getattro = PyObject_GenericGetAttr; + } + #endif + if (__Pyx_SetVtable(__pyx_mstate->__pyx_ptype_5spacy_8pipeline_17_parser_internals_17transition_system_TransitionSystem, __pyx_vtabptr_5spacy_8pipeline_17_parser_internals_17transition_system_TransitionSystem) < (0)) __PYX_ERR(0, 36, __pyx_L1_error) + if (__Pyx_MergeVtables(__pyx_mstate->__pyx_ptype_5spacy_8pipeline_17_parser_internals_17transition_system_TransitionSystem) < (0)) __PYX_ERR(0, 36, __pyx_L1_error) + if (PyObject_SetAttr(__pyx_m, __pyx_mstate_global->__pyx_n_u_TransitionSystem, (PyObject *) __pyx_mstate->__pyx_ptype_5spacy_8pipeline_17_parser_internals_17transition_system_TransitionSystem) < (0)) __PYX_ERR(0, 36, __pyx_L1_error) + #if CYTHON_USE_TYPE_SPECS + __pyx_mstate->__pyx_ptype_5spacy_8pipeline_17_parser_internals_17transition_system___pyx_scope_struct__to_bytes = (PyTypeObject *) __Pyx_PyType_FromModuleAndSpec(__pyx_m, &__pyx_type_5spacy_8pipeline_17_parser_internals_17transition_system___pyx_scope_struct__to_bytes_spec, NULL); if (unlikely(!__pyx_mstate->__pyx_ptype_5spacy_8pipeline_17_parser_internals_17transition_system___pyx_scope_struct__to_bytes)) __PYX_ERR(0, 231, __pyx_L1_error) + if (__Pyx_fix_up_extension_type_from_spec(&__pyx_type_5spacy_8pipeline_17_parser_internals_17transition_system___pyx_scope_struct__to_bytes_spec, __pyx_mstate->__pyx_ptype_5spacy_8pipeline_17_parser_internals_17transition_system___pyx_scope_struct__to_bytes) < (0)) __PYX_ERR(0, 231, __pyx_L1_error) + #else + __pyx_mstate->__pyx_ptype_5spacy_8pipeline_17_parser_internals_17transition_system___pyx_scope_struct__to_bytes = &__pyx_type_5spacy_8pipeline_17_parser_internals_17transition_system___pyx_scope_struct__to_bytes; + #endif + #if !CYTHON_COMPILING_IN_LIMITED_API + #endif + #if !CYTHON_USE_TYPE_SPECS + if (__Pyx_PyType_Ready(__pyx_mstate->__pyx_ptype_5spacy_8pipeline_17_parser_internals_17transition_system___pyx_scope_struct__to_bytes) < (0)) __PYX_ERR(0, 231, __pyx_L1_error) + #endif + #if CYTHON_COMPILING_IN_CPYTHON && PY_VERSION_HEX >= 0x030E0000 + PyUnstable_Object_EnableDeferredRefcount((PyObject*)__pyx_mstate->__pyx_ptype_5spacy_8pipeline_17_parser_internals_17transition_system___pyx_scope_struct__to_bytes); + #endif + #if !CYTHON_COMPILING_IN_LIMITED_API + if ((CYTHON_USE_TYPE_SLOTS && CYTHON_USE_PYTYPE_LOOKUP) && likely(!__pyx_mstate->__pyx_ptype_5spacy_8pipeline_17_parser_internals_17transition_system___pyx_scope_struct__to_bytes->tp_dictoffset && __pyx_mstate->__pyx_ptype_5spacy_8pipeline_17_parser_internals_17transition_system___pyx_scope_struct__to_bytes->tp_getattro == PyObject_GenericGetAttr)) { + __pyx_mstate->__pyx_ptype_5spacy_8pipeline_17_parser_internals_17transition_system___pyx_scope_struct__to_bytes->tp_getattro = PyObject_GenericGetAttr; + } + #endif + __pyx_vtabptr_array = &__pyx_vtable_array; + __pyx_vtable_array.get_memview = (PyObject *(*)(struct __pyx_array_obj *))__pyx_array_get_memview; + #if CYTHON_USE_TYPE_SPECS + __pyx_mstate->__pyx_array_type = (PyTypeObject *) __Pyx_PyType_FromModuleAndSpec(__pyx_m, &__pyx_type___pyx_array_spec, NULL); if (unlikely(!__pyx_mstate->__pyx_array_type)) __PYX_ERR(1, 110, __pyx_L1_error) + #if !CYTHON_COMPILING_IN_LIMITED_API + __pyx_mstate->__pyx_array_type->tp_as_buffer = &__pyx_tp_as_buffer_array; + if (!__pyx_mstate->__pyx_array_type->tp_as_buffer->bf_releasebuffer && __pyx_mstate->__pyx_array_type->tp_base->tp_as_buffer && __pyx_mstate->__pyx_array_type->tp_base->tp_as_buffer->bf_releasebuffer) { + __pyx_mstate->__pyx_array_type->tp_as_buffer->bf_releasebuffer = __pyx_mstate->__pyx_array_type->tp_base->tp_as_buffer->bf_releasebuffer; + } + #elif defined(Py_bf_getbuffer) && defined(Py_bf_releasebuffer) + /* PY_VERSION_HEX >= 0x03090000 || Py_LIMITED_API >= 0x030B0000 */ + #elif defined(_MSC_VER) + #pragma message ("The buffer protocol is not supported in the Limited C-API < 3.11.") + #else + #warning "The buffer protocol is not supported in the Limited C-API < 3.11." + #endif + if (__Pyx_fix_up_extension_type_from_spec(&__pyx_type___pyx_array_spec, __pyx_mstate->__pyx_array_type) < (0)) __PYX_ERR(1, 110, __pyx_L1_error) + #else + __pyx_mstate->__pyx_array_type = &__pyx_type___pyx_array; + #endif + #if !CYTHON_COMPILING_IN_LIMITED_API + #endif + #if !CYTHON_USE_TYPE_SPECS + if (__Pyx_PyType_Ready(__pyx_mstate->__pyx_array_type) < (0)) __PYX_ERR(1, 110, __pyx_L1_error) + #endif + #if CYTHON_COMPILING_IN_CPYTHON && PY_VERSION_HEX >= 0x030E0000 + PyUnstable_Object_EnableDeferredRefcount((PyObject*)__pyx_mstate->__pyx_array_type); + #endif + if (__Pyx_SetVtable(__pyx_mstate->__pyx_array_type, __pyx_vtabptr_array) < (0)) __PYX_ERR(1, 110, __pyx_L1_error) + if (__Pyx_MergeVtables(__pyx_mstate->__pyx_array_type) < (0)) __PYX_ERR(1, 110, __pyx_L1_error) + if (__Pyx_setup_reduce((PyObject *) __pyx_mstate->__pyx_array_type) < (0)) __PYX_ERR(1, 110, __pyx_L1_error) + #if CYTHON_USE_TYPE_SPECS + __pyx_mstate->__pyx_MemviewEnum_type = (PyTypeObject *) __Pyx_PyType_FromModuleAndSpec(__pyx_m, &__pyx_type___pyx_MemviewEnum_spec, NULL); if (unlikely(!__pyx_mstate->__pyx_MemviewEnum_type)) __PYX_ERR(1, 299, __pyx_L1_error) + if (__Pyx_fix_up_extension_type_from_spec(&__pyx_type___pyx_MemviewEnum_spec, __pyx_mstate->__pyx_MemviewEnum_type) < (0)) __PYX_ERR(1, 299, __pyx_L1_error) + #else + __pyx_mstate->__pyx_MemviewEnum_type = &__pyx_type___pyx_MemviewEnum; + #endif + #if !CYTHON_COMPILING_IN_LIMITED_API + #endif + #if !CYTHON_USE_TYPE_SPECS + if (__Pyx_PyType_Ready(__pyx_mstate->__pyx_MemviewEnum_type) < (0)) __PYX_ERR(1, 299, __pyx_L1_error) + #endif + #if CYTHON_COMPILING_IN_CPYTHON && PY_VERSION_HEX >= 0x030E0000 + PyUnstable_Object_EnableDeferredRefcount((PyObject*)__pyx_mstate->__pyx_MemviewEnum_type); + #endif + #if !CYTHON_COMPILING_IN_LIMITED_API + if ((CYTHON_USE_TYPE_SLOTS && CYTHON_USE_PYTYPE_LOOKUP) && likely(!__pyx_mstate->__pyx_MemviewEnum_type->tp_dictoffset && __pyx_mstate->__pyx_MemviewEnum_type->tp_getattro == PyObject_GenericGetAttr)) { + __pyx_mstate->__pyx_MemviewEnum_type->tp_getattro = PyObject_GenericGetAttr; + } + #endif + if (__Pyx_setup_reduce((PyObject *) __pyx_mstate->__pyx_MemviewEnum_type) < (0)) __PYX_ERR(1, 299, __pyx_L1_error) + __pyx_vtabptr_memoryview = &__pyx_vtable_memoryview; + __pyx_vtable_memoryview.get_item_pointer = (char *(*)(struct __pyx_memoryview_obj *, PyObject *))__pyx_memoryview_get_item_pointer; + __pyx_vtable_memoryview.is_slice = (PyObject *(*)(struct __pyx_memoryview_obj *, PyObject *))__pyx_memoryview_is_slice; + __pyx_vtable_memoryview.setitem_slice_assignment = (PyObject *(*)(struct __pyx_memoryview_obj *, PyObject *, PyObject *))__pyx_memoryview_setitem_slice_assignment; + __pyx_vtable_memoryview.setitem_slice_assign_scalar = (PyObject *(*)(struct __pyx_memoryview_obj *, struct __pyx_memoryview_obj *, PyObject *))__pyx_memoryview_setitem_slice_assign_scalar; + __pyx_vtable_memoryview.setitem_indexed = (PyObject *(*)(struct __pyx_memoryview_obj *, PyObject *, PyObject *))__pyx_memoryview_setitem_indexed; + __pyx_vtable_memoryview.convert_item_to_object = (PyObject *(*)(struct __pyx_memoryview_obj *, char *))__pyx_memoryview_convert_item_to_object; + __pyx_vtable_memoryview.assign_item_from_object = (PyObject *(*)(struct __pyx_memoryview_obj *, char *, PyObject *))__pyx_memoryview_assign_item_from_object; + __pyx_vtable_memoryview._get_base = (PyObject *(*)(struct __pyx_memoryview_obj *))__pyx_memoryview__get_base; + #if CYTHON_USE_TYPE_SPECS + __pyx_mstate->__pyx_memoryview_type = (PyTypeObject *) __Pyx_PyType_FromModuleAndSpec(__pyx_m, &__pyx_type___pyx_memoryview_spec, NULL); if (unlikely(!__pyx_mstate->__pyx_memoryview_type)) __PYX_ERR(1, 334, __pyx_L1_error) + #if !CYTHON_COMPILING_IN_LIMITED_API + __pyx_mstate->__pyx_memoryview_type->tp_as_buffer = &__pyx_tp_as_buffer_memoryview; + if (!__pyx_mstate->__pyx_memoryview_type->tp_as_buffer->bf_releasebuffer && __pyx_mstate->__pyx_memoryview_type->tp_base->tp_as_buffer && __pyx_mstate->__pyx_memoryview_type->tp_base->tp_as_buffer->bf_releasebuffer) { + __pyx_mstate->__pyx_memoryview_type->tp_as_buffer->bf_releasebuffer = __pyx_mstate->__pyx_memoryview_type->tp_base->tp_as_buffer->bf_releasebuffer; + } + #elif defined(Py_bf_getbuffer) && defined(Py_bf_releasebuffer) + /* PY_VERSION_HEX >= 0x03090000 || Py_LIMITED_API >= 0x030B0000 */ + #elif defined(_MSC_VER) + #pragma message ("The buffer protocol is not supported in the Limited C-API < 3.11.") + #else + #warning "The buffer protocol is not supported in the Limited C-API < 3.11." + #endif + if (__Pyx_fix_up_extension_type_from_spec(&__pyx_type___pyx_memoryview_spec, __pyx_mstate->__pyx_memoryview_type) < (0)) __PYX_ERR(1, 334, __pyx_L1_error) + #else + __pyx_mstate->__pyx_memoryview_type = &__pyx_type___pyx_memoryview; + #endif + #if !CYTHON_COMPILING_IN_LIMITED_API + #endif + #if !CYTHON_USE_TYPE_SPECS + if (__Pyx_PyType_Ready(__pyx_mstate->__pyx_memoryview_type) < (0)) __PYX_ERR(1, 334, __pyx_L1_error) + #endif + #if CYTHON_COMPILING_IN_CPYTHON && PY_VERSION_HEX >= 0x030E0000 + PyUnstable_Object_EnableDeferredRefcount((PyObject*)__pyx_mstate->__pyx_memoryview_type); + #endif + #if !CYTHON_COMPILING_IN_LIMITED_API + if ((CYTHON_USE_TYPE_SLOTS && CYTHON_USE_PYTYPE_LOOKUP) && likely(!__pyx_mstate->__pyx_memoryview_type->tp_dictoffset && __pyx_mstate->__pyx_memoryview_type->tp_getattro == PyObject_GenericGetAttr)) { + __pyx_mstate->__pyx_memoryview_type->tp_getattro = PyObject_GenericGetAttr; + } + #endif + if (__Pyx_SetVtable(__pyx_mstate->__pyx_memoryview_type, __pyx_vtabptr_memoryview) < (0)) __PYX_ERR(1, 334, __pyx_L1_error) + if (__Pyx_MergeVtables(__pyx_mstate->__pyx_memoryview_type) < (0)) __PYX_ERR(1, 334, __pyx_L1_error) + if (__Pyx_setup_reduce((PyObject *) __pyx_mstate->__pyx_memoryview_type) < (0)) __PYX_ERR(1, 334, __pyx_L1_error) + __pyx_vtabptr__memoryviewslice = &__pyx_vtable__memoryviewslice; + __pyx_vtable__memoryviewslice.__pyx_base = *__pyx_vtabptr_memoryview; + __pyx_vtable__memoryviewslice.__pyx_base.convert_item_to_object = (PyObject *(*)(struct __pyx_memoryview_obj *, char *))__pyx_memoryviewslice_convert_item_to_object; + __pyx_vtable__memoryviewslice.__pyx_base.assign_item_from_object = (PyObject *(*)(struct __pyx_memoryview_obj *, char *, PyObject *))__pyx_memoryviewslice_assign_item_from_object; + __pyx_vtable__memoryviewslice.__pyx_base._get_base = (PyObject *(*)(struct __pyx_memoryview_obj *))__pyx_memoryviewslice__get_base; + #if CYTHON_USE_TYPE_SPECS + __pyx_t_1 = PyTuple_Pack(1, (PyObject *)__pyx_mstate_global->__pyx_memoryview_type); if (unlikely(!__pyx_t_1)) __PYX_ERR(1, 951, __pyx_L1_error) + __Pyx_GOTREF(__pyx_t_1); + __pyx_mstate->__pyx_memoryviewslice_type = (PyTypeObject *) __Pyx_PyType_FromModuleAndSpec(__pyx_m, &__pyx_type___pyx_memoryviewslice_spec, __pyx_t_1); + __Pyx_XDECREF(__pyx_t_1); __pyx_t_1 = 0; + if (unlikely(!__pyx_mstate->__pyx_memoryviewslice_type)) __PYX_ERR(1, 951, __pyx_L1_error) + if (__Pyx_fix_up_extension_type_from_spec(&__pyx_type___pyx_memoryviewslice_spec, __pyx_mstate->__pyx_memoryviewslice_type) < (0)) __PYX_ERR(1, 951, __pyx_L1_error) + #else + __pyx_mstate->__pyx_memoryviewslice_type = &__pyx_type___pyx_memoryviewslice; + #endif + #if !CYTHON_COMPILING_IN_LIMITED_API + __pyx_mstate_global->__pyx_memoryviewslice_type->tp_base = __pyx_mstate_global->__pyx_memoryview_type; + #endif + #if !CYTHON_USE_TYPE_SPECS + if (__Pyx_PyType_Ready(__pyx_mstate->__pyx_memoryviewslice_type) < (0)) __PYX_ERR(1, 951, __pyx_L1_error) + #endif + #if CYTHON_COMPILING_IN_CPYTHON && PY_VERSION_HEX >= 0x030E0000 + PyUnstable_Object_EnableDeferredRefcount((PyObject*)__pyx_mstate->__pyx_memoryviewslice_type); + #endif + #if !CYTHON_COMPILING_IN_LIMITED_API + if ((CYTHON_USE_TYPE_SLOTS && CYTHON_USE_PYTYPE_LOOKUP) && likely(!__pyx_mstate->__pyx_memoryviewslice_type->tp_dictoffset && __pyx_mstate->__pyx_memoryviewslice_type->tp_getattro == PyObject_GenericGetAttr)) { + __pyx_mstate->__pyx_memoryviewslice_type->tp_getattro = PyObject_GenericGetAttr; + } + #endif + if (__Pyx_SetVtable(__pyx_mstate->__pyx_memoryviewslice_type, __pyx_vtabptr__memoryviewslice) < (0)) __PYX_ERR(1, 951, __pyx_L1_error) + if (__Pyx_MergeVtables(__pyx_mstate->__pyx_memoryviewslice_type) < (0)) __PYX_ERR(1, 951, __pyx_L1_error) + if (__Pyx_setup_reduce((PyObject *) __pyx_mstate->__pyx_memoryviewslice_type) < (0)) __PYX_ERR(1, 951, __pyx_L1_error) + __Pyx_RefNannyFinishContext(); + return 0; + __pyx_L1_error:; + __Pyx_XDECREF(__pyx_t_1); + __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("cymem.cymem"); if (unlikely(!__pyx_t_1)) __PYX_ERR(7, 4, __pyx_L1_error) + __Pyx_GOTREF(__pyx_t_1); + __pyx_mstate->__pyx_ptype_5cymem_5cymem_PyMalloc = __Pyx_ImportType_3_2_1(__pyx_t_1, "cymem.cymem", "PyMalloc", + #if defined(PYPY_VERSION_NUM) && PYPY_VERSION_NUM < 0x050B0000 + sizeof(struct __pyx_obj_5cymem_5cymem_PyMalloc), __PYX_GET_STRUCT_ALIGNMENT_3_2_1(struct __pyx_obj_5cymem_5cymem_PyMalloc), + #elif CYTHON_COMPILING_IN_LIMITED_API + sizeof(struct __pyx_obj_5cymem_5cymem_PyMalloc), __PYX_GET_STRUCT_ALIGNMENT_3_2_1(struct __pyx_obj_5cymem_5cymem_PyMalloc), + #else + sizeof(struct __pyx_obj_5cymem_5cymem_PyMalloc), __PYX_GET_STRUCT_ALIGNMENT_3_2_1(struct __pyx_obj_5cymem_5cymem_PyMalloc), + #endif + __Pyx_ImportType_CheckSize_Warn_3_2_1); if (!__pyx_mstate->__pyx_ptype_5cymem_5cymem_PyMalloc) __PYX_ERR(7, 4, __pyx_L1_error) + __pyx_vtabptr_5cymem_5cymem_PyMalloc = (struct __pyx_vtabstruct_5cymem_5cymem_PyMalloc*)__Pyx_GetVtable(__pyx_mstate->__pyx_ptype_5cymem_5cymem_PyMalloc); if (unlikely(!__pyx_vtabptr_5cymem_5cymem_PyMalloc)) __PYX_ERR(7, 4, __pyx_L1_error) + __pyx_mstate->__pyx_ptype_5cymem_5cymem_PyFree = __Pyx_ImportType_3_2_1(__pyx_t_1, "cymem.cymem", "PyFree", + #if defined(PYPY_VERSION_NUM) && PYPY_VERSION_NUM < 0x050B0000 + sizeof(struct __pyx_obj_5cymem_5cymem_PyFree), __PYX_GET_STRUCT_ALIGNMENT_3_2_1(struct __pyx_obj_5cymem_5cymem_PyFree), + #elif CYTHON_COMPILING_IN_LIMITED_API + sizeof(struct __pyx_obj_5cymem_5cymem_PyFree), __PYX_GET_STRUCT_ALIGNMENT_3_2_1(struct __pyx_obj_5cymem_5cymem_PyFree), + #else + sizeof(struct __pyx_obj_5cymem_5cymem_PyFree), __PYX_GET_STRUCT_ALIGNMENT_3_2_1(struct __pyx_obj_5cymem_5cymem_PyFree), + #endif + __Pyx_ImportType_CheckSize_Warn_3_2_1); if (!__pyx_mstate->__pyx_ptype_5cymem_5cymem_PyFree) __PYX_ERR(7, 10, __pyx_L1_error) + __pyx_vtabptr_5cymem_5cymem_PyFree = (struct __pyx_vtabstruct_5cymem_5cymem_PyFree*)__Pyx_GetVtable(__pyx_mstate->__pyx_ptype_5cymem_5cymem_PyFree); if (unlikely(!__pyx_vtabptr_5cymem_5cymem_PyFree)) __PYX_ERR(7, 10, __pyx_L1_error) + __pyx_mstate->__pyx_ptype_5cymem_5cymem_Pool = __Pyx_ImportType_3_2_1(__pyx_t_1, "cymem.cymem", "Pool", + #if defined(PYPY_VERSION_NUM) && PYPY_VERSION_NUM < 0x050B0000 + sizeof(struct __pyx_obj_5cymem_5cymem_Pool), __PYX_GET_STRUCT_ALIGNMENT_3_2_1(struct __pyx_obj_5cymem_5cymem_Pool), + #elif CYTHON_COMPILING_IN_LIMITED_API + sizeof(struct __pyx_obj_5cymem_5cymem_Pool), __PYX_GET_STRUCT_ALIGNMENT_3_2_1(struct __pyx_obj_5cymem_5cymem_Pool), + #else + sizeof(struct __pyx_obj_5cymem_5cymem_Pool), __PYX_GET_STRUCT_ALIGNMENT_3_2_1(struct __pyx_obj_5cymem_5cymem_Pool), + #endif + __Pyx_ImportType_CheckSize_Warn_3_2_1); if (!__pyx_mstate->__pyx_ptype_5cymem_5cymem_Pool) __PYX_ERR(7, 16, __pyx_L1_error) + __pyx_vtabptr_5cymem_5cymem_Pool = (struct __pyx_vtabstruct_5cymem_5cymem_Pool*)__Pyx_GetVtable(__pyx_mstate->__pyx_ptype_5cymem_5cymem_Pool); if (unlikely(!__pyx_vtabptr_5cymem_5cymem_Pool)) __PYX_ERR(7, 16, __pyx_L1_error) + __pyx_mstate->__pyx_ptype_5cymem_5cymem_Address = __Pyx_ImportType_3_2_1(__pyx_t_1, "cymem.cymem", "Address", + #if defined(PYPY_VERSION_NUM) && PYPY_VERSION_NUM < 0x050B0000 + sizeof(struct __pyx_obj_5cymem_5cymem_Address), __PYX_GET_STRUCT_ALIGNMENT_3_2_1(struct __pyx_obj_5cymem_5cymem_Address), + #elif CYTHON_COMPILING_IN_LIMITED_API + sizeof(struct __pyx_obj_5cymem_5cymem_Address), __PYX_GET_STRUCT_ALIGNMENT_3_2_1(struct __pyx_obj_5cymem_5cymem_Address), + #else + sizeof(struct __pyx_obj_5cymem_5cymem_Address), __PYX_GET_STRUCT_ALIGNMENT_3_2_1(struct __pyx_obj_5cymem_5cymem_Address), + #endif + __Pyx_ImportType_CheckSize_Warn_3_2_1); if (!__pyx_mstate->__pyx_ptype_5cymem_5cymem_Address) __PYX_ERR(7, 28, __pyx_L1_error) + __Pyx_DECREF(__pyx_t_1); __pyx_t_1 = 0; + __pyx_t_1 = PyImport_ImportModule("preshed.maps"); if (unlikely(!__pyx_t_1)) __PYX_ERR(8, 45, __pyx_L1_error) + __Pyx_GOTREF(__pyx_t_1); + __pyx_mstate->__pyx_ptype_7preshed_4maps_PreshMap = __Pyx_ImportType_3_2_1(__pyx_t_1, "preshed.maps", "PreshMap", + #if defined(PYPY_VERSION_NUM) && PYPY_VERSION_NUM < 0x050B0000 + sizeof(struct __pyx_obj_7preshed_4maps_PreshMap), __PYX_GET_STRUCT_ALIGNMENT_3_2_1(struct __pyx_obj_7preshed_4maps_PreshMap), + #elif CYTHON_COMPILING_IN_LIMITED_API + sizeof(struct __pyx_obj_7preshed_4maps_PreshMap), __PYX_GET_STRUCT_ALIGNMENT_3_2_1(struct __pyx_obj_7preshed_4maps_PreshMap), + #else + sizeof(struct __pyx_obj_7preshed_4maps_PreshMap), __PYX_GET_STRUCT_ALIGNMENT_3_2_1(struct __pyx_obj_7preshed_4maps_PreshMap), + #endif + __Pyx_ImportType_CheckSize_Warn_3_2_1); if (!__pyx_mstate->__pyx_ptype_7preshed_4maps_PreshMap) __PYX_ERR(8, 45, __pyx_L1_error) + __pyx_vtabptr_7preshed_4maps_PreshMap = (struct __pyx_vtabstruct_7preshed_4maps_PreshMap*)__Pyx_GetVtable(__pyx_mstate->__pyx_ptype_7preshed_4maps_PreshMap); if (unlikely(!__pyx_vtabptr_7preshed_4maps_PreshMap)) __PYX_ERR(8, 45, __pyx_L1_error) + __pyx_mstate->__pyx_ptype_7preshed_4maps_PreshMapArray = __Pyx_ImportType_3_2_1(__pyx_t_1, "preshed.maps", "PreshMapArray", + #if defined(PYPY_VERSION_NUM) && PYPY_VERSION_NUM < 0x050B0000 + sizeof(struct __pyx_obj_7preshed_4maps_PreshMapArray), __PYX_GET_STRUCT_ALIGNMENT_3_2_1(struct __pyx_obj_7preshed_4maps_PreshMapArray), + #elif CYTHON_COMPILING_IN_LIMITED_API + sizeof(struct __pyx_obj_7preshed_4maps_PreshMapArray), __PYX_GET_STRUCT_ALIGNMENT_3_2_1(struct __pyx_obj_7preshed_4maps_PreshMapArray), + #else + sizeof(struct __pyx_obj_7preshed_4maps_PreshMapArray), __PYX_GET_STRUCT_ALIGNMENT_3_2_1(struct __pyx_obj_7preshed_4maps_PreshMapArray), + #endif + __Pyx_ImportType_CheckSize_Warn_3_2_1); if (!__pyx_mstate->__pyx_ptype_7preshed_4maps_PreshMapArray) __PYX_ERR(8, 53, __pyx_L1_error) + __pyx_vtabptr_7preshed_4maps_PreshMapArray = (struct __pyx_vtabstruct_7preshed_4maps_PreshMapArray*)__Pyx_GetVtable(__pyx_mstate->__pyx_ptype_7preshed_4maps_PreshMapArray); if (unlikely(!__pyx_vtabptr_7preshed_4maps_PreshMapArray)) __PYX_ERR(8, 53, __pyx_L1_error) + __Pyx_DECREF(__pyx_t_1); __pyx_t_1 = 0; + __pyx_t_1 = PyImport_ImportModule("spacy.strings"); if (unlikely(!__pyx_t_1)) __PYX_ERR(9, 22, __pyx_L1_error) + __Pyx_GOTREF(__pyx_t_1); + __pyx_mstate->__pyx_ptype_5spacy_7strings_StringStore = __Pyx_ImportType_3_2_1(__pyx_t_1, "spacy.strings", "StringStore", + #if defined(PYPY_VERSION_NUM) && PYPY_VERSION_NUM < 0x050B0000 + sizeof(struct __pyx_obj_5spacy_7strings_StringStore), __PYX_GET_STRUCT_ALIGNMENT_3_2_1(struct __pyx_obj_5spacy_7strings_StringStore), + #elif CYTHON_COMPILING_IN_LIMITED_API + sizeof(struct __pyx_obj_5spacy_7strings_StringStore), __PYX_GET_STRUCT_ALIGNMENT_3_2_1(struct __pyx_obj_5spacy_7strings_StringStore), + #else + sizeof(struct __pyx_obj_5spacy_7strings_StringStore), __PYX_GET_STRUCT_ALIGNMENT_3_2_1(struct __pyx_obj_5spacy_7strings_StringStore), + #endif + __Pyx_ImportType_CheckSize_Warn_3_2_1); if (!__pyx_mstate->__pyx_ptype_5spacy_7strings_StringStore) __PYX_ERR(9, 22, __pyx_L1_error) + __pyx_vtabptr_5spacy_7strings_StringStore = (struct __pyx_vtabstruct_5spacy_7strings_StringStore*)__Pyx_GetVtable(__pyx_mstate->__pyx_ptype_5spacy_7strings_StringStore); if (unlikely(!__pyx_vtabptr_5spacy_7strings_StringStore)) __PYX_ERR(9, 22, __pyx_L1_error) + __Pyx_DECREF(__pyx_t_1); __pyx_t_1 = 0; + __pyx_t_1 = PyImport_ImportModule(__Pyx_BUILTIN_MODULE_NAME); if (unlikely(!__pyx_t_1)) __PYX_ERR(10, 9, __pyx_L1_error) + __Pyx_GOTREF(__pyx_t_1); + __pyx_mstate->__pyx_ptype_7cpython_4type_type = __Pyx_ImportType_3_2_1(__pyx_t_1, __Pyx_BUILTIN_MODULE_NAME, "type", + #if defined(PYPY_VERSION_NUM) && PYPY_VERSION_NUM < 0x050B0000 + sizeof(PyTypeObject), __PYX_GET_STRUCT_ALIGNMENT_3_2_1(PyTypeObject), + #elif CYTHON_COMPILING_IN_LIMITED_API + 0, 0, + #else + sizeof(PyHeapTypeObject), __PYX_GET_STRUCT_ALIGNMENT_3_2_1(PyHeapTypeObject), + #endif + __Pyx_ImportType_CheckSize_Warn_3_2_1); if (!__pyx_mstate->__pyx_ptype_7cpython_4type_type) __PYX_ERR(10, 9, __pyx_L1_error) + __Pyx_DECREF(__pyx_t_1); __pyx_t_1 = 0; + __pyx_t_1 = PyImport_ImportModule("numpy"); if (unlikely(!__pyx_t_1)) __PYX_ERR(2, 228, __pyx_L1_error) + __Pyx_GOTREF(__pyx_t_1); + __pyx_mstate->__pyx_ptype_5numpy_dtype = __Pyx_ImportType_3_2_1(__pyx_t_1, "numpy", "dtype", + #if defined(PYPY_VERSION_NUM) && PYPY_VERSION_NUM < 0x050B0000 + sizeof(PyArray_Descr), __PYX_GET_STRUCT_ALIGNMENT_3_2_1(PyArray_Descr), + #elif CYTHON_COMPILING_IN_LIMITED_API + sizeof(PyArray_Descr), __PYX_GET_STRUCT_ALIGNMENT_3_2_1(PyArray_Descr), + #else + sizeof(PyArray_Descr), __PYX_GET_STRUCT_ALIGNMENT_3_2_1(PyArray_Descr), + #endif + __Pyx_ImportType_CheckSize_Ignore_3_2_1); if (!__pyx_mstate->__pyx_ptype_5numpy_dtype) __PYX_ERR(2, 228, __pyx_L1_error) + __pyx_mstate->__pyx_ptype_5numpy_flatiter = __Pyx_ImportType_3_2_1(__pyx_t_1, "numpy", "flatiter", + #if defined(PYPY_VERSION_NUM) && PYPY_VERSION_NUM < 0x050B0000 + sizeof(PyArrayIterObject), __PYX_GET_STRUCT_ALIGNMENT_3_2_1(PyArrayIterObject), + #elif CYTHON_COMPILING_IN_LIMITED_API + sizeof(PyArrayIterObject), __PYX_GET_STRUCT_ALIGNMENT_3_2_1(PyArrayIterObject), + #else + sizeof(PyArrayIterObject), __PYX_GET_STRUCT_ALIGNMENT_3_2_1(PyArrayIterObject), + #endif + __Pyx_ImportType_CheckSize_Ignore_3_2_1); if (!__pyx_mstate->__pyx_ptype_5numpy_flatiter) __PYX_ERR(2, 273, __pyx_L1_error) + __pyx_mstate->__pyx_ptype_5numpy_broadcast = __Pyx_ImportType_3_2_1(__pyx_t_1, "numpy", "broadcast", + #if defined(PYPY_VERSION_NUM) && PYPY_VERSION_NUM < 0x050B0000 + sizeof(PyArrayMultiIterObject), __PYX_GET_STRUCT_ALIGNMENT_3_2_1(PyArrayMultiIterObject), + #elif CYTHON_COMPILING_IN_LIMITED_API + sizeof(PyArrayMultiIterObject), __PYX_GET_STRUCT_ALIGNMENT_3_2_1(PyArrayMultiIterObject), + #else + sizeof(PyArrayMultiIterObject), __PYX_GET_STRUCT_ALIGNMENT_3_2_1(PyArrayMultiIterObject), + #endif + __Pyx_ImportType_CheckSize_Ignore_3_2_1); if (!__pyx_mstate->__pyx_ptype_5numpy_broadcast) __PYX_ERR(2, 277, __pyx_L1_error) + __pyx_mstate->__pyx_ptype_5numpy_ndarray = __Pyx_ImportType_3_2_1(__pyx_t_1, "numpy", "ndarray", + #if defined(PYPY_VERSION_NUM) && PYPY_VERSION_NUM < 0x050B0000 + sizeof(PyArrayObject), __PYX_GET_STRUCT_ALIGNMENT_3_2_1(PyArrayObject), + #elif CYTHON_COMPILING_IN_LIMITED_API + sizeof(PyArrayObject), __PYX_GET_STRUCT_ALIGNMENT_3_2_1(PyArrayObject), + #else + sizeof(PyArrayObject), __PYX_GET_STRUCT_ALIGNMENT_3_2_1(PyArrayObject), + #endif + __Pyx_ImportType_CheckSize_Ignore_3_2_1); if (!__pyx_mstate->__pyx_ptype_5numpy_ndarray) __PYX_ERR(2, 316, __pyx_L1_error) + __pyx_mstate->__pyx_ptype_5numpy_generic = __Pyx_ImportType_3_2_1(__pyx_t_1, "numpy", "generic", + #if defined(PYPY_VERSION_NUM) && PYPY_VERSION_NUM < 0x050B0000 + sizeof(PyObject), __PYX_GET_STRUCT_ALIGNMENT_3_2_1(PyObject), + #elif CYTHON_COMPILING_IN_LIMITED_API + sizeof(PyObject), __PYX_GET_STRUCT_ALIGNMENT_3_2_1(PyObject), + #else + sizeof(PyObject), __PYX_GET_STRUCT_ALIGNMENT_3_2_1(PyObject), + #endif + __Pyx_ImportType_CheckSize_Warn_3_2_1); if (!__pyx_mstate->__pyx_ptype_5numpy_generic) __PYX_ERR(2, 825, __pyx_L1_error) + __pyx_mstate->__pyx_ptype_5numpy_number = __Pyx_ImportType_3_2_1(__pyx_t_1, "numpy", "number", + #if defined(PYPY_VERSION_NUM) && PYPY_VERSION_NUM < 0x050B0000 + sizeof(PyObject), __PYX_GET_STRUCT_ALIGNMENT_3_2_1(PyObject), + #elif CYTHON_COMPILING_IN_LIMITED_API + sizeof(PyObject), __PYX_GET_STRUCT_ALIGNMENT_3_2_1(PyObject), + #else + sizeof(PyObject), __PYX_GET_STRUCT_ALIGNMENT_3_2_1(PyObject), + #endif + __Pyx_ImportType_CheckSize_Warn_3_2_1); if (!__pyx_mstate->__pyx_ptype_5numpy_number) __PYX_ERR(2, 827, __pyx_L1_error) + __pyx_mstate->__pyx_ptype_5numpy_integer = __Pyx_ImportType_3_2_1(__pyx_t_1, "numpy", "integer", + #if defined(PYPY_VERSION_NUM) && PYPY_VERSION_NUM < 0x050B0000 + sizeof(PyObject), __PYX_GET_STRUCT_ALIGNMENT_3_2_1(PyObject), + #elif CYTHON_COMPILING_IN_LIMITED_API + sizeof(PyObject), __PYX_GET_STRUCT_ALIGNMENT_3_2_1(PyObject), + #else + sizeof(PyObject), __PYX_GET_STRUCT_ALIGNMENT_3_2_1(PyObject), + #endif + __Pyx_ImportType_CheckSize_Warn_3_2_1); if (!__pyx_mstate->__pyx_ptype_5numpy_integer) __PYX_ERR(2, 829, __pyx_L1_error) + __pyx_mstate->__pyx_ptype_5numpy_signedinteger = __Pyx_ImportType_3_2_1(__pyx_t_1, "numpy", "signedinteger", + #if defined(PYPY_VERSION_NUM) && PYPY_VERSION_NUM < 0x050B0000 + sizeof(PyObject), __PYX_GET_STRUCT_ALIGNMENT_3_2_1(PyObject), + #elif CYTHON_COMPILING_IN_LIMITED_API + sizeof(PyObject), __PYX_GET_STRUCT_ALIGNMENT_3_2_1(PyObject), + #else + sizeof(PyObject), __PYX_GET_STRUCT_ALIGNMENT_3_2_1(PyObject), + #endif + __Pyx_ImportType_CheckSize_Warn_3_2_1); if (!__pyx_mstate->__pyx_ptype_5numpy_signedinteger) __PYX_ERR(2, 831, __pyx_L1_error) + __pyx_mstate->__pyx_ptype_5numpy_unsignedinteger = __Pyx_ImportType_3_2_1(__pyx_t_1, "numpy", "unsignedinteger", + #if defined(PYPY_VERSION_NUM) && PYPY_VERSION_NUM < 0x050B0000 + sizeof(PyObject), __PYX_GET_STRUCT_ALIGNMENT_3_2_1(PyObject), + #elif CYTHON_COMPILING_IN_LIMITED_API + sizeof(PyObject), __PYX_GET_STRUCT_ALIGNMENT_3_2_1(PyObject), + #else + sizeof(PyObject), __PYX_GET_STRUCT_ALIGNMENT_3_2_1(PyObject), + #endif + __Pyx_ImportType_CheckSize_Warn_3_2_1); if (!__pyx_mstate->__pyx_ptype_5numpy_unsignedinteger) __PYX_ERR(2, 833, __pyx_L1_error) + __pyx_mstate->__pyx_ptype_5numpy_inexact = __Pyx_ImportType_3_2_1(__pyx_t_1, "numpy", "inexact", + #if defined(PYPY_VERSION_NUM) && PYPY_VERSION_NUM < 0x050B0000 + sizeof(PyObject), __PYX_GET_STRUCT_ALIGNMENT_3_2_1(PyObject), + #elif CYTHON_COMPILING_IN_LIMITED_API + sizeof(PyObject), __PYX_GET_STRUCT_ALIGNMENT_3_2_1(PyObject), + #else + sizeof(PyObject), __PYX_GET_STRUCT_ALIGNMENT_3_2_1(PyObject), + #endif + __Pyx_ImportType_CheckSize_Warn_3_2_1); if (!__pyx_mstate->__pyx_ptype_5numpy_inexact) __PYX_ERR(2, 835, __pyx_L1_error) + __pyx_mstate->__pyx_ptype_5numpy_floating = __Pyx_ImportType_3_2_1(__pyx_t_1, "numpy", "floating", + #if defined(PYPY_VERSION_NUM) && PYPY_VERSION_NUM < 0x050B0000 + sizeof(PyObject), __PYX_GET_STRUCT_ALIGNMENT_3_2_1(PyObject), + #elif CYTHON_COMPILING_IN_LIMITED_API + sizeof(PyObject), __PYX_GET_STRUCT_ALIGNMENT_3_2_1(PyObject), + #else + sizeof(PyObject), __PYX_GET_STRUCT_ALIGNMENT_3_2_1(PyObject), + #endif + __Pyx_ImportType_CheckSize_Warn_3_2_1); if (!__pyx_mstate->__pyx_ptype_5numpy_floating) __PYX_ERR(2, 837, __pyx_L1_error) + __pyx_mstate->__pyx_ptype_5numpy_complexfloating = __Pyx_ImportType_3_2_1(__pyx_t_1, "numpy", "complexfloating", + #if defined(PYPY_VERSION_NUM) && PYPY_VERSION_NUM < 0x050B0000 + sizeof(PyObject), __PYX_GET_STRUCT_ALIGNMENT_3_2_1(PyObject), + #elif CYTHON_COMPILING_IN_LIMITED_API + sizeof(PyObject), __PYX_GET_STRUCT_ALIGNMENT_3_2_1(PyObject), + #else + sizeof(PyObject), __PYX_GET_STRUCT_ALIGNMENT_3_2_1(PyObject), + #endif + __Pyx_ImportType_CheckSize_Warn_3_2_1); if (!__pyx_mstate->__pyx_ptype_5numpy_complexfloating) __PYX_ERR(2, 839, __pyx_L1_error) + __pyx_mstate->__pyx_ptype_5numpy_flexible = __Pyx_ImportType_3_2_1(__pyx_t_1, "numpy", "flexible", + #if defined(PYPY_VERSION_NUM) && PYPY_VERSION_NUM < 0x050B0000 + sizeof(PyObject), __PYX_GET_STRUCT_ALIGNMENT_3_2_1(PyObject), + #elif CYTHON_COMPILING_IN_LIMITED_API + sizeof(PyObject), __PYX_GET_STRUCT_ALIGNMENT_3_2_1(PyObject), + #else + sizeof(PyObject), __PYX_GET_STRUCT_ALIGNMENT_3_2_1(PyObject), + #endif + __Pyx_ImportType_CheckSize_Warn_3_2_1); if (!__pyx_mstate->__pyx_ptype_5numpy_flexible) __PYX_ERR(2, 841, __pyx_L1_error) + __pyx_mstate->__pyx_ptype_5numpy_character = __Pyx_ImportType_3_2_1(__pyx_t_1, "numpy", "character", + #if defined(PYPY_VERSION_NUM) && PYPY_VERSION_NUM < 0x050B0000 + sizeof(PyObject), __PYX_GET_STRUCT_ALIGNMENT_3_2_1(PyObject), + #elif CYTHON_COMPILING_IN_LIMITED_API + sizeof(PyObject), __PYX_GET_STRUCT_ALIGNMENT_3_2_1(PyObject), + #else + sizeof(PyObject), __PYX_GET_STRUCT_ALIGNMENT_3_2_1(PyObject), + #endif + __Pyx_ImportType_CheckSize_Warn_3_2_1); if (!__pyx_mstate->__pyx_ptype_5numpy_character) __PYX_ERR(2, 843, __pyx_L1_error) + __pyx_mstate->__pyx_ptype_5numpy_ufunc = __Pyx_ImportType_3_2_1(__pyx_t_1, "numpy", "ufunc", + #if defined(PYPY_VERSION_NUM) && PYPY_VERSION_NUM < 0x050B0000 + sizeof(PyUFuncObject), __PYX_GET_STRUCT_ALIGNMENT_3_2_1(PyUFuncObject), + #elif CYTHON_COMPILING_IN_LIMITED_API + sizeof(PyUFuncObject), __PYX_GET_STRUCT_ALIGNMENT_3_2_1(PyUFuncObject), + #else + sizeof(PyUFuncObject), __PYX_GET_STRUCT_ALIGNMENT_3_2_1(PyUFuncObject), + #endif + __Pyx_ImportType_CheckSize_Ignore_3_2_1); if (!__pyx_mstate->__pyx_ptype_5numpy_ufunc) __PYX_ERR(2, 907, __pyx_L1_error) + __Pyx_DECREF(__pyx_t_1); __pyx_t_1 = 0; + __pyx_t_1 = PyImport_ImportModule("spacy.morphology"); if (unlikely(!__pyx_t_1)) __PYX_ERR(11, 11, __pyx_L1_error) + __Pyx_GOTREF(__pyx_t_1); + __pyx_mstate->__pyx_ptype_5spacy_10morphology_Morphology = __Pyx_ImportType_3_2_1(__pyx_t_1, "spacy.morphology", "Morphology", + #if defined(PYPY_VERSION_NUM) && PYPY_VERSION_NUM < 0x050B0000 + sizeof(struct __pyx_obj_5spacy_10morphology_Morphology), __PYX_GET_STRUCT_ALIGNMENT_3_2_1(struct __pyx_obj_5spacy_10morphology_Morphology), + #elif CYTHON_COMPILING_IN_LIMITED_API + sizeof(struct __pyx_obj_5spacy_10morphology_Morphology), __PYX_GET_STRUCT_ALIGNMENT_3_2_1(struct __pyx_obj_5spacy_10morphology_Morphology), + #else + sizeof(struct __pyx_obj_5spacy_10morphology_Morphology), __PYX_GET_STRUCT_ALIGNMENT_3_2_1(struct __pyx_obj_5spacy_10morphology_Morphology), + #endif + __Pyx_ImportType_CheckSize_Warn_3_2_1); if (!__pyx_mstate->__pyx_ptype_5spacy_10morphology_Morphology) __PYX_ERR(11, 11, __pyx_L1_error) + __pyx_vtabptr_5spacy_10morphology_Morphology = (struct __pyx_vtabstruct_5spacy_10morphology_Morphology*)__Pyx_GetVtable(__pyx_mstate->__pyx_ptype_5spacy_10morphology_Morphology); if (unlikely(!__pyx_vtabptr_5spacy_10morphology_Morphology)) __PYX_ERR(11, 11, __pyx_L1_error) + __Pyx_DECREF(__pyx_t_1); __pyx_t_1 = 0; + __pyx_t_1 = PyImport_ImportModule("spacy.vocab"); if (unlikely(!__pyx_t_1)) __PYX_ERR(12, 26, __pyx_L1_error) + __Pyx_GOTREF(__pyx_t_1); + __pyx_mstate->__pyx_ptype_5spacy_5vocab_Vocab = __Pyx_ImportType_3_2_1(__pyx_t_1, "spacy.vocab", "Vocab", + #if defined(PYPY_VERSION_NUM) && PYPY_VERSION_NUM < 0x050B0000 + sizeof(struct __pyx_obj_5spacy_5vocab_Vocab), __PYX_GET_STRUCT_ALIGNMENT_3_2_1(struct __pyx_obj_5spacy_5vocab_Vocab), + #elif CYTHON_COMPILING_IN_LIMITED_API + sizeof(struct __pyx_obj_5spacy_5vocab_Vocab), __PYX_GET_STRUCT_ALIGNMENT_3_2_1(struct __pyx_obj_5spacy_5vocab_Vocab), + #else + sizeof(struct __pyx_obj_5spacy_5vocab_Vocab), __PYX_GET_STRUCT_ALIGNMENT_3_2_1(struct __pyx_obj_5spacy_5vocab_Vocab), + #endif + __Pyx_ImportType_CheckSize_Warn_3_2_1); if (!__pyx_mstate->__pyx_ptype_5spacy_5vocab_Vocab) __PYX_ERR(12, 26, __pyx_L1_error) + __pyx_vtabptr_5spacy_5vocab_Vocab = (struct __pyx_vtabstruct_5spacy_5vocab_Vocab*)__Pyx_GetVtable(__pyx_mstate->__pyx_ptype_5spacy_5vocab_Vocab); if (unlikely(!__pyx_vtabptr_5spacy_5vocab_Vocab)) __PYX_ERR(12, 26, __pyx_L1_error) + __Pyx_DECREF(__pyx_t_1); __pyx_t_1 = 0; + __pyx_t_1 = PyImport_ImportModule("spacy.tokens.doc"); if (unlikely(!__pyx_t_1)) __PYX_ERR(13, 37, __pyx_L1_error) + __Pyx_GOTREF(__pyx_t_1); + __pyx_mstate->__pyx_ptype_5spacy_6tokens_3doc_Doc = __Pyx_ImportType_3_2_1(__pyx_t_1, "spacy.tokens.doc", "Doc", + #if defined(PYPY_VERSION_NUM) && PYPY_VERSION_NUM < 0x050B0000 + sizeof(struct __pyx_obj_5spacy_6tokens_3doc_Doc), __PYX_GET_STRUCT_ALIGNMENT_3_2_1(struct __pyx_obj_5spacy_6tokens_3doc_Doc), + #elif CYTHON_COMPILING_IN_LIMITED_API + sizeof(struct __pyx_obj_5spacy_6tokens_3doc_Doc), __PYX_GET_STRUCT_ALIGNMENT_3_2_1(struct __pyx_obj_5spacy_6tokens_3doc_Doc), + #else + sizeof(struct __pyx_obj_5spacy_6tokens_3doc_Doc), __PYX_GET_STRUCT_ALIGNMENT_3_2_1(struct __pyx_obj_5spacy_6tokens_3doc_Doc), + #endif + __Pyx_ImportType_CheckSize_Warn_3_2_1); if (!__pyx_mstate->__pyx_ptype_5spacy_6tokens_3doc_Doc) __PYX_ERR(13, 37, __pyx_L1_error) + __pyx_vtabptr_5spacy_6tokens_3doc_Doc = (struct __pyx_vtabstruct_5spacy_6tokens_3doc_Doc*)__Pyx_GetVtable(__pyx_mstate->__pyx_ptype_5spacy_6tokens_3doc_Doc); if (unlikely(!__pyx_vtabptr_5spacy_6tokens_3doc_Doc)) __PYX_ERR(13, 37, __pyx_L1_error) + __Pyx_DECREF(__pyx_t_1); __pyx_t_1 = 0; + __pyx_t_1 = PyImport_ImportModule("spacy.training.example"); if (unlikely(!__pyx_t_1)) __PYX_ERR(14, 6, __pyx_L1_error) + __Pyx_GOTREF(__pyx_t_1); + __pyx_mstate->__pyx_ptype_5spacy_8training_7example_Example = __Pyx_ImportType_3_2_1(__pyx_t_1, "spacy.training.example", "Example", + #if defined(PYPY_VERSION_NUM) && PYPY_VERSION_NUM < 0x050B0000 + sizeof(struct __pyx_obj_5spacy_8training_7example_Example), __PYX_GET_STRUCT_ALIGNMENT_3_2_1(struct __pyx_obj_5spacy_8training_7example_Example), + #elif CYTHON_COMPILING_IN_LIMITED_API + sizeof(struct __pyx_obj_5spacy_8training_7example_Example), __PYX_GET_STRUCT_ALIGNMENT_3_2_1(struct __pyx_obj_5spacy_8training_7example_Example), + #else + sizeof(struct __pyx_obj_5spacy_8training_7example_Example), __PYX_GET_STRUCT_ALIGNMENT_3_2_1(struct __pyx_obj_5spacy_8training_7example_Example), + #endif + __Pyx_ImportType_CheckSize_Warn_3_2_1); if (!__pyx_mstate->__pyx_ptype_5spacy_8training_7example_Example) __PYX_ERR(14, 6, __pyx_L1_error) + __Pyx_DECREF(__pyx_t_1); __pyx_t_1 = 0; + __pyx_t_1 = PyImport_ImportModule("spacy.lexeme"); if (unlikely(!__pyx_t_1)) __PYX_ERR(3, 24, __pyx_L1_error) + __Pyx_GOTREF(__pyx_t_1); + __pyx_mstate->__pyx_ptype_5spacy_6lexeme_Lexeme = __Pyx_ImportType_3_2_1(__pyx_t_1, "spacy.lexeme", "Lexeme", + #if defined(PYPY_VERSION_NUM) && PYPY_VERSION_NUM < 0x050B0000 + sizeof(struct __pyx_obj_5spacy_6lexeme_Lexeme), __PYX_GET_STRUCT_ALIGNMENT_3_2_1(struct __pyx_obj_5spacy_6lexeme_Lexeme), + #elif CYTHON_COMPILING_IN_LIMITED_API + sizeof(struct __pyx_obj_5spacy_6lexeme_Lexeme), __PYX_GET_STRUCT_ALIGNMENT_3_2_1(struct __pyx_obj_5spacy_6lexeme_Lexeme), + #else + sizeof(struct __pyx_obj_5spacy_6lexeme_Lexeme), __PYX_GET_STRUCT_ALIGNMENT_3_2_1(struct __pyx_obj_5spacy_6lexeme_Lexeme), + #endif + __Pyx_ImportType_CheckSize_Warn_3_2_1); if (!__pyx_mstate->__pyx_ptype_5spacy_6lexeme_Lexeme) __PYX_ERR(3, 24, __pyx_L1_error) + __pyx_vtabptr_5spacy_6lexeme_Lexeme = (struct __pyx_vtabstruct_5spacy_6lexeme_Lexeme*)__Pyx_GetVtable(__pyx_mstate->__pyx_ptype_5spacy_6lexeme_Lexeme); if (unlikely(!__pyx_vtabptr_5spacy_6lexeme_Lexeme)) __PYX_ERR(3, 24, __pyx_L1_error) + __Pyx_DECREF(__pyx_t_1); __pyx_t_1 = 0; + __pyx_t_1 = PyImport_ImportModule("spacy.pipeline._parser_internals.stateclass"); if (unlikely(!__pyx_t_1)) __PYX_ERR(5, 9, __pyx_L1_error) + __Pyx_GOTREF(__pyx_t_1); + __pyx_mstate->__pyx_ptype_5spacy_8pipeline_17_parser_internals_10stateclass_StateClass = __Pyx_ImportType_3_2_1(__pyx_t_1, "spacy.pipeline._parser_internals.stateclass", "StateClass", + #if defined(PYPY_VERSION_NUM) && PYPY_VERSION_NUM < 0x050B0000 + sizeof(struct __pyx_obj_5spacy_8pipeline_17_parser_internals_10stateclass_StateClass), __PYX_GET_STRUCT_ALIGNMENT_3_2_1(struct __pyx_obj_5spacy_8pipeline_17_parser_internals_10stateclass_StateClass), + #elif CYTHON_COMPILING_IN_LIMITED_API + sizeof(struct __pyx_obj_5spacy_8pipeline_17_parser_internals_10stateclass_StateClass), __PYX_GET_STRUCT_ALIGNMENT_3_2_1(struct __pyx_obj_5spacy_8pipeline_17_parser_internals_10stateclass_StateClass), + #else + sizeof(struct __pyx_obj_5spacy_8pipeline_17_parser_internals_10stateclass_StateClass), __PYX_GET_STRUCT_ALIGNMENT_3_2_1(struct __pyx_obj_5spacy_8pipeline_17_parser_internals_10stateclass_StateClass), + #endif + __Pyx_ImportType_CheckSize_Warn_3_2_1); if (!__pyx_mstate->__pyx_ptype_5spacy_8pipeline_17_parser_internals_10stateclass_StateClass) __PYX_ERR(5, 9, __pyx_L1_error) + __pyx_vtabptr_5spacy_8pipeline_17_parser_internals_10stateclass_StateClass = (struct __pyx_vtabstruct_5spacy_8pipeline_17_parser_internals_10stateclass_StateClass*)__Pyx_GetVtable(__pyx_mstate->__pyx_ptype_5spacy_8pipeline_17_parser_internals_10stateclass_StateClass); if (unlikely(!__pyx_vtabptr_5spacy_8pipeline_17_parser_internals_10stateclass_StateClass)) __PYX_ERR(5, 9, __pyx_L1_error) + __Pyx_DECREF(__pyx_t_1); __pyx_t_1 = 0; + __Pyx_RefNannyFinishContext(); + return 0; + __pyx_L1_error:; + __Pyx_XDECREF(__pyx_t_1); + __Pyx_RefNannyFinishContext(); + return -1; +} + +static int __Pyx_modinit_variable_import_code(__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_variable_import_code", 0); + /*--- Variable import code ---*/ + { + __pyx_t_1 = PyImport_ImportModule("spacy.vocab"); 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_struct___pyx_t_5spacy_7structs_L); + #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 + 39; + void **const __pyx_import_pointers[] = {(void **)&__pyx_vp_5spacy_5vocab_EMPTY_LEXEME, (void **) NULL}; + void **const *__pyx_import_pointer = __pyx_import_pointers; + const char *__pyx_import_current_signature = __pyx_import_signature; + while (*__pyx_import_pointer) { + if (__Pyx_ImportVoidPtr_3_2_1(__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_t_1 = PyImport_ImportModule("spacy.lexeme"); 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_pyx_t_5spacy_8typedefs_attr_t); + #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 + 71; + void **const __pyx_import_pointers[] = {(void **)&__pyx_vp_5spacy_6lexeme_OOV_RANK, (void **)&__pyx_vp_5spacy_6lexeme_EMPTY_LEXEME, (void **) NULL}; + void **const *__pyx_import_pointer = __pyx_import_pointers; + const char *__pyx_import_current_signature = __pyx_import_signature; + while (*__pyx_import_pointer) { + if (__Pyx_ImportVoidPtr_3_2_1(__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; +} + +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("murmurhash.mrmr"); 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_uint64_t_void_int_uint64_t_hash6); + #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 + 33; + void (**const __pyx_import_pointers[])(void) = {(void (**)(void))&__pyx_f_10murmurhash_4mrmr_hash64, (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_1(__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_transition_system(PyObject* module); /*proto*/ +static PyModuleDef_Slot __pyx_moduledef_slots[] = { + {Py_mod_create, (void*)__pyx_pymod_create}, + {Py_mod_exec, (void*)__pyx_pymod_exec_transition_system}, + #if CYTHON_COMPILING_IN_CPYTHON_FREETHREADING + {Py_mod_gil, Py_MOD_GIL_USED}, + #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, + "transition_system", + 0, /* 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_transition_system(void) CYTHON_SMALL_CODE; /*proto*/ +__Pyx_PyMODINIT_FUNC PyInit_transition_system(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_transition_system(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; + PyObject *__pyx_t_4 = NULL; + PyObject *__pyx_t_5 = NULL; + size_t __pyx_t_6; + static PyThread_type_lock __pyx_t_7[8]; + int __pyx_t_8; + Py_ssize_t __pyx_t_9; + PyObject *__pyx_t_10 = NULL; + PyObject *__pyx_t_11 = 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 'transition_system' 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 "transition_system" 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_transition_system", 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_spacy__pipeline___parser_internals__transition_system) { + if (PyObject_SetAttr(__pyx_m, __pyx_mstate_global->__pyx_n_u_name_2, __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, "spacy.pipeline._parser_internals.transition_system")) { + if (unlikely((PyDict_SetItemString(modules, "spacy.pipeline._parser_internals.transition_system", __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) + if (unlikely((__Pyx_modinit_variable_import_code(__pyx_mstate) < 0))) __PYX_ERR(0, 1, __pyx_L1_error) + if (unlikely((__Pyx_modinit_function_import_code(__pyx_mstate) < 0))) __PYX_ERR(0, 1, __pyx_L1_error) + /*--- Execution code ---*/ + + /* "View.MemoryView":100 + * + * cdef object __pyx_collections_abc_Sequence "__pyx_collections_abc_Sequence" + * try: # <<<<<<<<<<<<<< + * __pyx_collections_abc_Sequence = __import__("collections.abc").abc.Sequence + * except: +*/ + { + __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:*/ { + + /* "View.MemoryView":101 + * cdef object __pyx_collections_abc_Sequence "__pyx_collections_abc_Sequence" + * try: + * __pyx_collections_abc_Sequence = __import__("collections.abc").abc.Sequence # <<<<<<<<<<<<<< + * except: + * +*/ + __pyx_t_5 = NULL; + __pyx_t_6 = 1; + { + PyObject *__pyx_callargs[2] = {__pyx_t_5, __pyx_mstate_global->__pyx_kp_u_collections_abc}; + __pyx_t_4 = __Pyx_PyObject_FastCall((PyObject*)__pyx_builtin___import__, __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(1, 101, __pyx_L2_error) + __Pyx_GOTREF(__pyx_t_4); + } + __pyx_t_5 = __Pyx_PyObject_GetAttrStr(__pyx_t_4, __pyx_mstate_global->__pyx_n_u_abc); if (unlikely(!__pyx_t_5)) __PYX_ERR(1, 101, __pyx_L2_error) + __Pyx_GOTREF(__pyx_t_5); + __Pyx_DECREF(__pyx_t_4); __pyx_t_4 = 0; + __pyx_t_4 = __Pyx_PyObject_GetAttrStr(__pyx_t_5, __pyx_mstate_global->__pyx_n_u_Sequence); if (unlikely(!__pyx_t_4)) __PYX_ERR(1, 101, __pyx_L2_error) + __Pyx_GOTREF(__pyx_t_4); + __Pyx_DECREF(__pyx_t_5); __pyx_t_5 = 0; + __Pyx_XGOTREF(__pyx_collections_abc_Sequence); + __Pyx_DECREF_SET(__pyx_collections_abc_Sequence, __pyx_t_4); + __Pyx_GIVEREF(__pyx_t_4); + __pyx_t_4 = 0; + + /* "View.MemoryView":100 + * + * cdef object __pyx_collections_abc_Sequence "__pyx_collections_abc_Sequence" + * try: # <<<<<<<<<<<<<< + * __pyx_collections_abc_Sequence = __import__("collections.abc").abc.Sequence + * except: +*/ + } + __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_L7_try_end; + __pyx_L2_error:; + __Pyx_XDECREF(__pyx_t_4); __pyx_t_4 = 0; + __Pyx_XDECREF(__pyx_t_5); __pyx_t_5 = 0; + + /* "View.MemoryView":102 + * try: + * __pyx_collections_abc_Sequence = __import__("collections.abc").abc.Sequence + * except: # <<<<<<<<<<<<<< + * + * __pyx_collections_abc_Sequence = None +*/ + /*except:*/ { + __Pyx_ErrRestore(0,0,0); + + /* "View.MemoryView":104 + * except: + * + * __pyx_collections_abc_Sequence = None # <<<<<<<<<<<<<< + * + * +*/ + __Pyx_INCREF(Py_None); + __Pyx_XGOTREF(__pyx_collections_abc_Sequence); + __Pyx_DECREF_SET(__pyx_collections_abc_Sequence, Py_None); + __Pyx_GIVEREF(Py_None); + goto __pyx_L3_exception_handled; + } + __pyx_L3_exception_handled:; + __Pyx_XGIVEREF(__pyx_t_1); + __Pyx_XGIVEREF(__pyx_t_2); + __Pyx_XGIVEREF(__pyx_t_3); + __Pyx_ExceptionReset(__pyx_t_1, __pyx_t_2, __pyx_t_3); + __pyx_L7_try_end:; + } + + /* "View.MemoryView":239 + * + * + * try: # <<<<<<<<<<<<<< + * count = __pyx_collections_abc_Sequence.count + * index = __pyx_collections_abc_Sequence.index +*/ + { + __Pyx_PyThreadState_declare + __Pyx_PyThreadState_assign + __Pyx_ExceptionSave(&__pyx_t_3, &__pyx_t_2, &__pyx_t_1); + __Pyx_XGOTREF(__pyx_t_3); + __Pyx_XGOTREF(__pyx_t_2); + __Pyx_XGOTREF(__pyx_t_1); + /*try:*/ { + + /* "View.MemoryView":240 + * + * try: + * count = __pyx_collections_abc_Sequence.count # <<<<<<<<<<<<<< + * index = __pyx_collections_abc_Sequence.index + * except: +*/ + __pyx_t_4 = __Pyx_PyObject_GetAttrStr(__pyx_collections_abc_Sequence, __pyx_mstate_global->__pyx_n_u_count); if (unlikely(!__pyx_t_4)) __PYX_ERR(1, 240, __pyx_L10_error) + __Pyx_GOTREF(__pyx_t_4); + if (__Pyx_SetItemOnTypeDict(__pyx_mstate_global->__pyx_array_type, __pyx_mstate_global->__pyx_n_u_count, __pyx_t_4) < (0)) __PYX_ERR(1, 240, __pyx_L10_error) + __Pyx_DECREF(__pyx_t_4); __pyx_t_4 = 0; + + /* "View.MemoryView":241 + * try: + * count = __pyx_collections_abc_Sequence.count + * index = __pyx_collections_abc_Sequence.index # <<<<<<<<<<<<<< + * except: + * pass +*/ + __pyx_t_4 = __Pyx_PyObject_GetAttrStr(__pyx_collections_abc_Sequence, __pyx_mstate_global->__pyx_n_u_index); if (unlikely(!__pyx_t_4)) __PYX_ERR(1, 241, __pyx_L10_error) + __Pyx_GOTREF(__pyx_t_4); + if (__Pyx_SetItemOnTypeDict(__pyx_mstate_global->__pyx_array_type, __pyx_mstate_global->__pyx_n_u_index, __pyx_t_4) < (0)) __PYX_ERR(1, 241, __pyx_L10_error) + __Pyx_DECREF(__pyx_t_4); __pyx_t_4 = 0; + + /* "View.MemoryView":239 + * + * + * try: # <<<<<<<<<<<<<< + * count = __pyx_collections_abc_Sequence.count + * index = __pyx_collections_abc_Sequence.index +*/ + } + __Pyx_XDECREF(__pyx_t_3); __pyx_t_3 = 0; + __Pyx_XDECREF(__pyx_t_2); __pyx_t_2 = 0; + __Pyx_XDECREF(__pyx_t_1); __pyx_t_1 = 0; + goto __pyx_L15_try_end; + __pyx_L10_error:; + __Pyx_XDECREF(__pyx_t_4); __pyx_t_4 = 0; + __Pyx_XDECREF(__pyx_t_5); __pyx_t_5 = 0; + + /* "View.MemoryView":242 + * count = __pyx_collections_abc_Sequence.count + * index = __pyx_collections_abc_Sequence.index + * except: # <<<<<<<<<<<<<< + * pass + * +*/ + /*except:*/ { + __Pyx_ErrRestore(0,0,0); + goto __pyx_L11_exception_handled; + } + __pyx_L11_exception_handled:; + __Pyx_XGIVEREF(__pyx_t_3); + __Pyx_XGIVEREF(__pyx_t_2); + __Pyx_XGIVEREF(__pyx_t_1); + __Pyx_ExceptionReset(__pyx_t_3, __pyx_t_2, __pyx_t_1); + __pyx_L15_try_end:; + } + + /* "View.MemoryView":307 + * return self.name + * + * cdef generic = Enum("") # <<<<<<<<<<<<<< + * cdef strided = Enum("") # default + * cdef indirect = Enum("") +*/ + __pyx_t_5 = NULL; + __pyx_t_6 = 1; + { + PyObject *__pyx_callargs[2] = {__pyx_t_5, __pyx_mstate_global->__pyx_kp_u_strided_and_direct_or_indirect}; + __pyx_t_4 = __Pyx_PyObject_FastCall((PyObject*)__pyx_mstate_global->__pyx_MemviewEnum_type, __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(1, 307, __pyx_L1_error) + __Pyx_GOTREF((PyObject *)__pyx_t_4); + } + __Pyx_XGOTREF(generic); + __Pyx_DECREF_SET(generic, ((PyObject *)__pyx_t_4)); + __Pyx_GIVEREF((PyObject *)__pyx_t_4); + __pyx_t_4 = 0; + + /* "View.MemoryView":308 + * + * cdef generic = Enum("") + * cdef strided = Enum("") # default # <<<<<<<<<<<<<< + * cdef indirect = Enum("") + * +*/ + __pyx_t_5 = NULL; + __pyx_t_6 = 1; + { + PyObject *__pyx_callargs[2] = {__pyx_t_5, __pyx_mstate_global->__pyx_kp_u_strided_and_direct}; + __pyx_t_4 = __Pyx_PyObject_FastCall((PyObject*)__pyx_mstate_global->__pyx_MemviewEnum_type, __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(1, 308, __pyx_L1_error) + __Pyx_GOTREF((PyObject *)__pyx_t_4); + } + __Pyx_XGOTREF(strided); + __Pyx_DECREF_SET(strided, ((PyObject *)__pyx_t_4)); + __Pyx_GIVEREF((PyObject *)__pyx_t_4); + __pyx_t_4 = 0; + + /* "View.MemoryView":309 + * cdef generic = Enum("") + * cdef strided = Enum("") # default + * cdef indirect = Enum("") # <<<<<<<<<<<<<< + * + * +*/ + __pyx_t_5 = NULL; + __pyx_t_6 = 1; + { + PyObject *__pyx_callargs[2] = {__pyx_t_5, __pyx_mstate_global->__pyx_kp_u_strided_and_indirect}; + __pyx_t_4 = __Pyx_PyObject_FastCall((PyObject*)__pyx_mstate_global->__pyx_MemviewEnum_type, __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(1, 309, __pyx_L1_error) + __Pyx_GOTREF((PyObject *)__pyx_t_4); + } + __Pyx_XGOTREF(indirect); + __Pyx_DECREF_SET(indirect, ((PyObject *)__pyx_t_4)); + __Pyx_GIVEREF((PyObject *)__pyx_t_4); + __pyx_t_4 = 0; + + /* "View.MemoryView":312 + * + * + * cdef contiguous = Enum("") # <<<<<<<<<<<<<< + * cdef indirect_contiguous = Enum("") + * +*/ + __pyx_t_5 = NULL; + __pyx_t_6 = 1; + { + PyObject *__pyx_callargs[2] = {__pyx_t_5, __pyx_mstate_global->__pyx_kp_u_contiguous_and_direct}; + __pyx_t_4 = __Pyx_PyObject_FastCall((PyObject*)__pyx_mstate_global->__pyx_MemviewEnum_type, __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(1, 312, __pyx_L1_error) + __Pyx_GOTREF((PyObject *)__pyx_t_4); + } + __Pyx_XGOTREF(contiguous); + __Pyx_DECREF_SET(contiguous, ((PyObject *)__pyx_t_4)); + __Pyx_GIVEREF((PyObject *)__pyx_t_4); + __pyx_t_4 = 0; + + /* "View.MemoryView":313 + * + * cdef contiguous = Enum("") + * cdef indirect_contiguous = Enum("") # <<<<<<<<<<<<<< + * + * +*/ + __pyx_t_5 = NULL; + __pyx_t_6 = 1; + { + PyObject *__pyx_callargs[2] = {__pyx_t_5, __pyx_mstate_global->__pyx_kp_u_contiguous_and_indirect}; + __pyx_t_4 = __Pyx_PyObject_FastCall((PyObject*)__pyx_mstate_global->__pyx_MemviewEnum_type, __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(1, 313, __pyx_L1_error) + __Pyx_GOTREF((PyObject *)__pyx_t_4); + } + __Pyx_XGOTREF(indirect_contiguous); + __Pyx_DECREF_SET(indirect_contiguous, ((PyObject *)__pyx_t_4)); + __Pyx_GIVEREF((PyObject *)__pyx_t_4); + __pyx_t_4 = 0; + + /* "View.MemoryView":321 + * + * + * cdef int __pyx_memoryview_thread_locks_used = 0 # <<<<<<<<<<<<<< + * cdef PyThread_type_lock[8] __pyx_memoryview_thread_locks = [ + * PyThread_allocate_lock(), +*/ + __pyx_memoryview_thread_locks_used = 0; + + /* "View.MemoryView":322 + * + * cdef int __pyx_memoryview_thread_locks_used = 0 + * cdef PyThread_type_lock[8] __pyx_memoryview_thread_locks = [ # <<<<<<<<<<<<<< + * PyThread_allocate_lock(), + * PyThread_allocate_lock(), +*/ + __pyx_t_7[0] = PyThread_allocate_lock(); + __pyx_t_7[1] = PyThread_allocate_lock(); + __pyx_t_7[2] = PyThread_allocate_lock(); + __pyx_t_7[3] = PyThread_allocate_lock(); + __pyx_t_7[4] = PyThread_allocate_lock(); + __pyx_t_7[5] = PyThread_allocate_lock(); + __pyx_t_7[6] = PyThread_allocate_lock(); + __pyx_t_7[7] = PyThread_allocate_lock(); + memcpy(&(__pyx_memoryview_thread_locks[0]), __pyx_t_7, sizeof(__pyx_memoryview_thread_locks[0]) * (8)); + + /* "View.MemoryView":983 + * + * + * try: # <<<<<<<<<<<<<< + * count = __pyx_collections_abc_Sequence.count + * index = __pyx_collections_abc_Sequence.index +*/ + { + __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:*/ { + + /* "View.MemoryView":984 + * + * try: + * count = __pyx_collections_abc_Sequence.count # <<<<<<<<<<<<<< + * index = __pyx_collections_abc_Sequence.index + * except: +*/ + __pyx_t_4 = __Pyx_PyObject_GetAttrStr(__pyx_collections_abc_Sequence, __pyx_mstate_global->__pyx_n_u_count); if (unlikely(!__pyx_t_4)) __PYX_ERR(1, 984, __pyx_L18_error) + __Pyx_GOTREF(__pyx_t_4); + if (__Pyx_SetItemOnTypeDict(__pyx_mstate_global->__pyx_memoryviewslice_type, __pyx_mstate_global->__pyx_n_u_count, __pyx_t_4) < (0)) __PYX_ERR(1, 984, __pyx_L18_error) + __Pyx_DECREF(__pyx_t_4); __pyx_t_4 = 0; + + /* "View.MemoryView":985 + * try: + * count = __pyx_collections_abc_Sequence.count + * index = __pyx_collections_abc_Sequence.index # <<<<<<<<<<<<<< + * except: + * pass +*/ + __pyx_t_4 = __Pyx_PyObject_GetAttrStr(__pyx_collections_abc_Sequence, __pyx_mstate_global->__pyx_n_u_index); if (unlikely(!__pyx_t_4)) __PYX_ERR(1, 985, __pyx_L18_error) + __Pyx_GOTREF(__pyx_t_4); + if (__Pyx_SetItemOnTypeDict(__pyx_mstate_global->__pyx_memoryviewslice_type, __pyx_mstate_global->__pyx_n_u_index, __pyx_t_4) < (0)) __PYX_ERR(1, 985, __pyx_L18_error) + __Pyx_DECREF(__pyx_t_4); __pyx_t_4 = 0; + + /* "View.MemoryView":983 + * + * + * try: # <<<<<<<<<<<<<< + * count = __pyx_collections_abc_Sequence.count + * index = __pyx_collections_abc_Sequence.index +*/ + } + __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_L23_try_end; + __pyx_L18_error:; + __Pyx_XDECREF(__pyx_t_4); __pyx_t_4 = 0; + __Pyx_XDECREF(__pyx_t_5); __pyx_t_5 = 0; + + /* "View.MemoryView":986 + * count = __pyx_collections_abc_Sequence.count + * index = __pyx_collections_abc_Sequence.index + * except: # <<<<<<<<<<<<<< + * pass + * +*/ + /*except:*/ { + __Pyx_ErrRestore(0,0,0); + goto __pyx_L19_exception_handled; + } + __pyx_L19_exception_handled:; + __Pyx_XGIVEREF(__pyx_t_1); + __Pyx_XGIVEREF(__pyx_t_2); + __Pyx_XGIVEREF(__pyx_t_3); + __Pyx_ExceptionReset(__pyx_t_1, __pyx_t_2, __pyx_t_3); + __pyx_L23_try_end:; + } + + /* "View.MemoryView":989 + * pass + * + * try: # <<<<<<<<<<<<<< + * if __pyx_collections_abc_Sequence: + * +*/ + { + __Pyx_PyThreadState_declare + __Pyx_PyThreadState_assign + __Pyx_ExceptionSave(&__pyx_t_3, &__pyx_t_2, &__pyx_t_1); + __Pyx_XGOTREF(__pyx_t_3); + __Pyx_XGOTREF(__pyx_t_2); + __Pyx_XGOTREF(__pyx_t_1); + /*try:*/ { + + /* "View.MemoryView":990 + * + * try: + * if __pyx_collections_abc_Sequence: # <<<<<<<<<<<<<< + * + * +*/ + __pyx_t_8 = __Pyx_PyObject_IsTrue(__pyx_collections_abc_Sequence); if (unlikely((__pyx_t_8 < 0))) __PYX_ERR(1, 990, __pyx_L26_error) + if (__pyx_t_8) { + + /* "View.MemoryView":994 + * + * + * __pyx_collections_abc_Sequence.register(_memoryviewslice) # <<<<<<<<<<<<<< + * __pyx_collections_abc_Sequence.register(array) + * except: +*/ + __pyx_t_5 = __pyx_collections_abc_Sequence; + __Pyx_INCREF(__pyx_t_5); + __pyx_t_6 = 0; + { + PyObject *__pyx_callargs[2] = {__pyx_t_5, ((PyObject *)__pyx_mstate_global->__pyx_memoryviewslice_type)}; + __pyx_t_4 = __Pyx_PyObject_FastCallMethod((PyObject*)__pyx_mstate_global->__pyx_n_u_register, __pyx_callargs+__pyx_t_6, (2-__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(1, 994, __pyx_L26_error) + __Pyx_GOTREF(__pyx_t_4); + } + __Pyx_DECREF(__pyx_t_4); __pyx_t_4 = 0; + + /* "View.MemoryView":995 + * + * __pyx_collections_abc_Sequence.register(_memoryviewslice) + * __pyx_collections_abc_Sequence.register(array) # <<<<<<<<<<<<<< + * except: + * pass # ignore failure, it's a minor issue +*/ + __pyx_t_5 = __pyx_collections_abc_Sequence; + __Pyx_INCREF(__pyx_t_5); + __pyx_t_6 = 0; + { + PyObject *__pyx_callargs[2] = {__pyx_t_5, ((PyObject *)__pyx_mstate_global->__pyx_array_type)}; + __pyx_t_4 = __Pyx_PyObject_FastCallMethod((PyObject*)__pyx_mstate_global->__pyx_n_u_register, __pyx_callargs+__pyx_t_6, (2-__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(1, 995, __pyx_L26_error) + __Pyx_GOTREF(__pyx_t_4); + } + __Pyx_DECREF(__pyx_t_4); __pyx_t_4 = 0; + + /* "View.MemoryView":990 + * + * try: + * if __pyx_collections_abc_Sequence: # <<<<<<<<<<<<<< + * + * +*/ + } + + /* "View.MemoryView":989 + * pass + * + * try: # <<<<<<<<<<<<<< + * if __pyx_collections_abc_Sequence: + * +*/ + } + __Pyx_XDECREF(__pyx_t_3); __pyx_t_3 = 0; + __Pyx_XDECREF(__pyx_t_2); __pyx_t_2 = 0; + __Pyx_XDECREF(__pyx_t_1); __pyx_t_1 = 0; + goto __pyx_L31_try_end; + __pyx_L26_error:; + __Pyx_XDECREF(__pyx_t_4); __pyx_t_4 = 0; + __Pyx_XDECREF(__pyx_t_5); __pyx_t_5 = 0; + + /* "View.MemoryView":996 + * __pyx_collections_abc_Sequence.register(_memoryviewslice) + * __pyx_collections_abc_Sequence.register(array) + * except: # <<<<<<<<<<<<<< + * pass # ignore failure, it's a minor issue + * +*/ + /*except:*/ { + __Pyx_ErrRestore(0,0,0); + goto __pyx_L27_exception_handled; + } + __pyx_L27_exception_handled:; + __Pyx_XGIVEREF(__pyx_t_3); + __Pyx_XGIVEREF(__pyx_t_2); + __Pyx_XGIVEREF(__pyx_t_1); + __Pyx_ExceptionReset(__pyx_t_3, __pyx_t_2, __pyx_t_1); + __pyx_L31_try_end:; + } + + /* "(tree fragment)":4 + * int __Pyx_CheckUnpickleChecksum(long, long, long, long, const char*) except -1 + * int __Pyx_UpdateUnpickledDict(object, object, Py_ssize_t) except -1 + * def __pyx_unpickle_Enum(__pyx_type, long __pyx_checksum, tuple __pyx_state): # <<<<<<<<<<<<<< + * cdef object __pyx_result + * __Pyx_CheckUnpickleChecksum(__pyx_checksum, 0x82a3537, 0x6ae9995, 0xb068931, b'name') +*/ + __pyx_t_4 = PyCFunction_NewEx(&__pyx_mdef_15View_dot_MemoryView_1__pyx_unpickle_Enum, NULL, __pyx_mstate_global->__pyx_n_u_View_MemoryView); if (unlikely(!__pyx_t_4)) __PYX_ERR(1, 4, __pyx_L1_error) + __Pyx_GOTREF(__pyx_t_4); + if (PyDict_SetItem(__pyx_mstate_global->__pyx_d, __pyx_mstate_global->__pyx_n_u_pyx_unpickle_Enum, __pyx_t_4) < (0)) __PYX_ERR(1, 4, __pyx_L1_error) + __Pyx_DECREF(__pyx_t_4); __pyx_t_4 = 0; + + /* "spacy/pipeline/_parser_internals/transition_system.pyx":7 + * from cymem.cymem cimport Pool + * + * from collections import Counter # <<<<<<<<<<<<<< + * + * import srsly +*/ + { + PyObject* const __pyx_imported_names[] = {__pyx_mstate_global->__pyx_n_u_Counter}; + __pyx_t_1 = __Pyx_Import(__pyx_mstate_global->__pyx_n_u_collections, __pyx_imported_names, 1, __pyx_mstate_global->__pyx_kp_u_spacy_pipeline__parser_internals_2, -1); if (unlikely(!__pyx_t_1)) __PYX_ERR(0, 7, __pyx_L1_error) + } + __pyx_t_4 = __pyx_t_1; + __Pyx_GOTREF(__pyx_t_4); + { + PyObject* const __pyx_imported_names[] = {__pyx_mstate_global->__pyx_n_u_Counter}; + __pyx_t_9 = 0; { + __pyx_t_5 = __Pyx_ImportFrom(__pyx_t_4, __pyx_imported_names[__pyx_t_9]); if (unlikely(!__pyx_t_5)) __PYX_ERR(0, 7, __pyx_L1_error) + __Pyx_GOTREF(__pyx_t_5); + if (PyDict_SetItem(__pyx_mstate_global->__pyx_d, __pyx_imported_names[__pyx_t_9], __pyx_t_5) < (0)) __PYX_ERR(0, 7, __pyx_L1_error) + __Pyx_DECREF(__pyx_t_5); __pyx_t_5 = 0; + } + } + __Pyx_DECREF(__pyx_t_4); __pyx_t_4 = 0; + + /* "spacy/pipeline/_parser_internals/transition_system.pyx":9 + * from collections import Counter + * + * import srsly # <<<<<<<<<<<<<< + * + * from ...structs cimport TokenC +*/ + __pyx_t_1 = __Pyx_Import(__pyx_mstate_global->__pyx_n_u_srsly, 0, 0, __pyx_mstate_global->__pyx_kp_u_spacy_pipeline__parser_internals_3, -1); if (unlikely(!__pyx_t_1)) __PYX_ERR(0, 9, __pyx_L1_error) + __pyx_t_4 = __pyx_t_1; + __Pyx_GOTREF(__pyx_t_4); + if (PyDict_SetItem(__pyx_mstate_global->__pyx_d, __pyx_mstate_global->__pyx_n_u_srsly, __pyx_t_4) < (0)) __PYX_ERR(0, 9, __pyx_L1_error) + __Pyx_DECREF(__pyx_t_4); __pyx_t_4 = 0; + + /* "spacy/pipeline/_parser_internals/transition_system.pyx":15 + * from .stateclass cimport StateClass + * + * from ... import util # <<<<<<<<<<<<<< + * from ...errors import Errors + * +*/ + { + PyObject* const __pyx_imported_names[] = {__pyx_mstate_global->__pyx_n_u_util}; + __pyx_t_1 = __Pyx_Import(__pyx_mstate_global->__pyx_n_u__13, __pyx_imported_names, 1, __pyx_mstate_global->__pyx_kp_u_spacy, 3); if (unlikely(!__pyx_t_1)) __PYX_ERR(0, 15, __pyx_L1_error) + } + __pyx_t_4 = __pyx_t_1; + __Pyx_GOTREF(__pyx_t_4); + { + PyObject* const __pyx_imported_names[] = {__pyx_mstate_global->__pyx_n_u_util}; + __pyx_t_9 = 0; { + __pyx_t_5 = __Pyx_ImportFrom(__pyx_t_4, __pyx_imported_names[__pyx_t_9]); if (unlikely(!__pyx_t_5)) __PYX_ERR(0, 15, __pyx_L1_error) + __Pyx_GOTREF(__pyx_t_5); + if (PyDict_SetItem(__pyx_mstate_global->__pyx_d, __pyx_imported_names[__pyx_t_9], __pyx_t_5) < (0)) __PYX_ERR(0, 15, __pyx_L1_error) + __Pyx_DECREF(__pyx_t_5); __pyx_t_5 = 0; + } + } + __Pyx_DECREF(__pyx_t_4); __pyx_t_4 = 0; + + /* "spacy/pipeline/_parser_internals/transition_system.pyx":16 + * + * from ... import util + * from ...errors import Errors # <<<<<<<<<<<<<< + * + * +*/ + { + PyObject* const __pyx_imported_names[] = {__pyx_mstate_global->__pyx_n_u_Errors}; + __pyx_t_1 = __Pyx_Import(__pyx_mstate_global->__pyx_n_u_errors, __pyx_imported_names, 1, __pyx_mstate_global->__pyx_kp_u_spacy_errors, 3); if (unlikely(!__pyx_t_1)) __PYX_ERR(0, 16, __pyx_L1_error) + } + __pyx_t_4 = __pyx_t_1; + __Pyx_GOTREF(__pyx_t_4); + { + PyObject* const __pyx_imported_names[] = {__pyx_mstate_global->__pyx_n_u_Errors}; + __pyx_t_9 = 0; { + __pyx_t_5 = __Pyx_ImportFrom(__pyx_t_4, __pyx_imported_names[__pyx_t_9]); if (unlikely(!__pyx_t_5)) __PYX_ERR(0, 16, __pyx_L1_error) + __Pyx_GOTREF(__pyx_t_5); + if (PyDict_SetItem(__pyx_mstate_global->__pyx_d, __pyx_imported_names[__pyx_t_9], __pyx_t_5) < (0)) __PYX_ERR(0, 16, __pyx_L1_error) + __Pyx_DECREF(__pyx_t_5); __pyx_t_5 = 0; + } + } + __Pyx_DECREF(__pyx_t_4); __pyx_t_4 = 0; + + /* "spacy/pipeline/_parser_internals/transition_system.pyx":19 + * + * + * cdef weight_t MIN_SCORE = -90000 # <<<<<<<<<<<<<< + * + * +*/ + __pyx_v_5spacy_8pipeline_17_parser_internals_17transition_system_MIN_SCORE = -90000.0; + + /* "spacy/pipeline/_parser_internals/transition_system.pyx":22 + * + * + * class OracleError(Exception): # <<<<<<<<<<<<<< + * pass + * +*/ + __pyx_t_4 = PyTuple_Pack(1, ((PyObject *)(((PyTypeObject*)PyExc_Exception)))); if (unlikely(!__pyx_t_4)) __PYX_ERR(0, 22, __pyx_L1_error) + __Pyx_GOTREF(__pyx_t_4); + __pyx_t_5 = __Pyx_PEP560_update_bases(__pyx_t_4); if (unlikely(!__pyx_t_5)) __PYX_ERR(0, 22, __pyx_L1_error) + __Pyx_GOTREF(__pyx_t_5); + __pyx_t_10 = __Pyx_CalculateMetaclass(NULL, __pyx_t_5); if (unlikely(!__pyx_t_10)) __PYX_ERR(0, 22, __pyx_L1_error) + __Pyx_GOTREF(__pyx_t_10); + __pyx_t_11 = __Pyx_Py3MetaclassPrepare(__pyx_t_10, __pyx_t_5, __pyx_mstate_global->__pyx_n_u_OracleError, __pyx_mstate_global->__pyx_n_u_OracleError, (PyObject *) NULL, __pyx_mstate_global->__pyx_n_u_spacy_pipeline__parser_internals, (PyObject *) NULL); if (unlikely(!__pyx_t_11)) __PYX_ERR(0, 22, __pyx_L1_error) + __Pyx_GOTREF(__pyx_t_11); + if (__pyx_t_5 != __pyx_t_4) { + if (unlikely((PyDict_SetItemString(__pyx_t_11, "__orig_bases__", __pyx_t_4) < 0))) __PYX_ERR(0, 22, __pyx_L1_error) + } + __Pyx_DECREF(__pyx_t_4); __pyx_t_4 = 0; + __pyx_t_4 = __Pyx_Py3ClassCreate(__pyx_t_10, __pyx_mstate_global->__pyx_n_u_OracleError, __pyx_t_5, __pyx_t_11, NULL, 0, 1); if (unlikely(!__pyx_t_4)) __PYX_ERR(0, 22, __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_OracleError, __pyx_t_4) < (0)) __PYX_ERR(0, 22, __pyx_L1_error) + __Pyx_DECREF(__pyx_t_4); __pyx_t_4 = 0; + __Pyx_DECREF(__pyx_t_11); __pyx_t_11 = 0; + __Pyx_DECREF(__pyx_t_10); __pyx_t_10 = 0; + __Pyx_DECREF(__pyx_t_5); __pyx_t_5 = 0; + + /* "spacy/pipeline/_parser_internals/transition_system.pyx":59 + * self.del_beam_state = _del_state + * + * def __reduce__(self): # <<<<<<<<<<<<<< + * # TODO: This loses the 'cfg' + * return (self.__class__, (self.strings, self.labels), None, None) +*/ + __pyx_t_5 = __Pyx_CyFunction_New(&__pyx_mdef_5spacy_8pipeline_17_parser_internals_17transition_system_16TransitionSystem_3__reduce__, __Pyx_CYFUNCTION_CCLASS, __pyx_mstate_global->__pyx_n_u_TransitionSystem___reduce, NULL, __pyx_mstate_global->__pyx_n_u_spacy_pipeline__parser_internals, __pyx_mstate_global->__pyx_d, ((PyObject *)__pyx_mstate_global->__pyx_codeobj_tab[3])); if (unlikely(!__pyx_t_5)) __PYX_ERR(0, 59, __pyx_L1_error) + __Pyx_GOTREF(__pyx_t_5); + #if CYTHON_COMPILING_IN_CPYTHON && PY_VERSION_HEX >= 0x030E0000 + PyUnstable_Object_EnableDeferredRefcount(__pyx_t_5); + #endif + if (__Pyx_SetItemOnTypeDict(__pyx_mstate_global->__pyx_ptype_5spacy_8pipeline_17_parser_internals_17transition_system_TransitionSystem, __pyx_mstate_global->__pyx_n_u_reduce, __pyx_t_5) < (0)) __PYX_ERR(0, 59, __pyx_L1_error) + __Pyx_DECREF(__pyx_t_5); __pyx_t_5 = 0; + + /* "spacy/pipeline/_parser_internals/transition_system.pyx":67 + * return self.cfg.get("neg_key") + * + * def init_batch(self, docs): # <<<<<<<<<<<<<< + * cdef StateClass state + * states = [] +*/ + __pyx_t_5 = __Pyx_CyFunction_New(&__pyx_mdef_5spacy_8pipeline_17_parser_internals_17transition_system_16TransitionSystem_5init_batch, __Pyx_CYFUNCTION_CCLASS, __pyx_mstate_global->__pyx_n_u_TransitionSystem_init_batch, NULL, __pyx_mstate_global->__pyx_n_u_spacy_pipeline__parser_internals, __pyx_mstate_global->__pyx_d, ((PyObject *)__pyx_mstate_global->__pyx_codeobj_tab[4])); if (unlikely(!__pyx_t_5)) __PYX_ERR(0, 67, __pyx_L1_error) + __Pyx_GOTREF(__pyx_t_5); + #if CYTHON_COMPILING_IN_CPYTHON && PY_VERSION_HEX >= 0x030E0000 + PyUnstable_Object_EnableDeferredRefcount(__pyx_t_5); + #endif + if (__Pyx_SetItemOnTypeDict(__pyx_mstate_global->__pyx_ptype_5spacy_8pipeline_17_parser_internals_17transition_system_TransitionSystem, __pyx_mstate_global->__pyx_n_u_init_batch, __pyx_t_5) < (0)) __PYX_ERR(0, 67, __pyx_L1_error) + __Pyx_DECREF(__pyx_t_5); __pyx_t_5 = 0; + + /* "spacy/pipeline/_parser_internals/transition_system.pyx":77 + * return states + * + * def get_oracle_sequence(self, Example example, _debug=False): # <<<<<<<<<<<<<< + * states, golds, _ = self.init_gold_batch([example]) + * if not states: +*/ + __pyx_t_5 = __Pyx_CyFunction_New(&__pyx_mdef_5spacy_8pipeline_17_parser_internals_17transition_system_16TransitionSystem_7get_oracle_sequence, __Pyx_CYFUNCTION_CCLASS, __pyx_mstate_global->__pyx_n_u_TransitionSystem_get_oracle_sequ, NULL, __pyx_mstate_global->__pyx_n_u_spacy_pipeline__parser_internals, __pyx_mstate_global->__pyx_d, ((PyObject *)__pyx_mstate_global->__pyx_codeobj_tab[5])); if (unlikely(!__pyx_t_5)) __PYX_ERR(0, 77, __pyx_L1_error) + __Pyx_GOTREF(__pyx_t_5); + #if CYTHON_COMPILING_IN_CPYTHON && PY_VERSION_HEX >= 0x030E0000 + PyUnstable_Object_EnableDeferredRefcount(__pyx_t_5); + #endif + __Pyx_CyFunction_SetDefaultsTuple(__pyx_t_5, __pyx_mstate_global->__pyx_tuple[3]); + if (__Pyx_SetItemOnTypeDict(__pyx_mstate_global->__pyx_ptype_5spacy_8pipeline_17_parser_internals_17transition_system_TransitionSystem, __pyx_mstate_global->__pyx_n_u_get_oracle_sequence, __pyx_t_5) < (0)) __PYX_ERR(0, 77, __pyx_L1_error) + __Pyx_DECREF(__pyx_t_5); __pyx_t_5 = 0; + + /* "spacy/pipeline/_parser_internals/transition_system.pyx":88 + * return self.get_oracle_sequence_from_state(state, gold) + * + * def get_oracle_sequence_from_state(self, StateClass state, gold, _debug=None): # <<<<<<<<<<<<<< + * cdef Pool mem = Pool() + * # n_moves should not be zero at this point, but make sure to avoid zero-length mem alloc +*/ + __pyx_t_5 = __Pyx_CyFunction_New(&__pyx_mdef_5spacy_8pipeline_17_parser_internals_17transition_system_16TransitionSystem_9get_oracle_sequence_from_state, __Pyx_CYFUNCTION_CCLASS, __pyx_mstate_global->__pyx_n_u_TransitionSystem_get_oracle_sequ_2, NULL, __pyx_mstate_global->__pyx_n_u_spacy_pipeline__parser_internals, __pyx_mstate_global->__pyx_d, ((PyObject *)__pyx_mstate_global->__pyx_codeobj_tab[6])); if (unlikely(!__pyx_t_5)) __PYX_ERR(0, 88, __pyx_L1_error) + __Pyx_GOTREF(__pyx_t_5); + #if CYTHON_COMPILING_IN_CPYTHON && PY_VERSION_HEX >= 0x030E0000 + PyUnstable_Object_EnableDeferredRefcount(__pyx_t_5); + #endif + __Pyx_CyFunction_SetDefaultsTuple(__pyx_t_5, __pyx_mstate_global->__pyx_tuple[4]); + if (__Pyx_SetItemOnTypeDict(__pyx_mstate_global->__pyx_ptype_5spacy_8pipeline_17_parser_internals_17transition_system_TransitionSystem, __pyx_mstate_global->__pyx_n_u_get_oracle_sequence_from_state, __pyx_t_5) < (0)) __PYX_ERR(0, 88, __pyx_L1_error) + __Pyx_DECREF(__pyx_t_5); __pyx_t_5 = 0; + + /* "spacy/pipeline/_parser_internals/transition_system.pyx":136 + * return history + * + * def apply_transition(self, StateClass state, name): # <<<<<<<<<<<<<< + * if not self.is_valid(state, name): + * raise ValueError(Errors.E170.format(name=name)) +*/ + __pyx_t_5 = __Pyx_CyFunction_New(&__pyx_mdef_5spacy_8pipeline_17_parser_internals_17transition_system_16TransitionSystem_11apply_transition, __Pyx_CYFUNCTION_CCLASS, __pyx_mstate_global->__pyx_n_u_TransitionSystem_apply_transitio, NULL, __pyx_mstate_global->__pyx_n_u_spacy_pipeline__parser_internals, __pyx_mstate_global->__pyx_d, ((PyObject *)__pyx_mstate_global->__pyx_codeobj_tab[7])); if (unlikely(!__pyx_t_5)) __PYX_ERR(0, 136, __pyx_L1_error) + __Pyx_GOTREF(__pyx_t_5); + #if CYTHON_COMPILING_IN_CPYTHON && PY_VERSION_HEX >= 0x030E0000 + PyUnstable_Object_EnableDeferredRefcount(__pyx_t_5); + #endif + if (__Pyx_SetItemOnTypeDict(__pyx_mstate_global->__pyx_ptype_5spacy_8pipeline_17_parser_internals_17transition_system_TransitionSystem, __pyx_mstate_global->__pyx_n_u_apply_transition, __pyx_t_5) < (0)) __PYX_ERR(0, 136, __pyx_L1_error) + __Pyx_DECREF(__pyx_t_5); __pyx_t_5 = 0; + + /* "spacy/pipeline/_parser_internals/transition_system.pyx":148 + * raise NotImplementedError + * + * def is_valid(self, StateClass stcls, move_name): # <<<<<<<<<<<<<< + * action = self.lookup_transition(move_name) + * return action.is_valid(stcls.c, action.label) +*/ + __pyx_t_5 = __Pyx_CyFunction_New(&__pyx_mdef_5spacy_8pipeline_17_parser_internals_17transition_system_16TransitionSystem_13is_valid, __Pyx_CYFUNCTION_CCLASS, __pyx_mstate_global->__pyx_n_u_TransitionSystem_is_valid, NULL, __pyx_mstate_global->__pyx_n_u_spacy_pipeline__parser_internals, __pyx_mstate_global->__pyx_d, ((PyObject *)__pyx_mstate_global->__pyx_codeobj_tab[8])); if (unlikely(!__pyx_t_5)) __PYX_ERR(0, 148, __pyx_L1_error) + __Pyx_GOTREF(__pyx_t_5); + #if CYTHON_COMPILING_IN_CPYTHON && PY_VERSION_HEX >= 0x030E0000 + PyUnstable_Object_EnableDeferredRefcount(__pyx_t_5); + #endif + if (__Pyx_SetItemOnTypeDict(__pyx_mstate_global->__pyx_ptype_5spacy_8pipeline_17_parser_internals_17transition_system_TransitionSystem, __pyx_mstate_global->__pyx_n_u_is_valid, __pyx_t_5) < (0)) __PYX_ERR(0, 148, __pyx_L1_error) + __Pyx_DECREF(__pyx_t_5); __pyx_t_5 = 0; + + /* "spacy/pipeline/_parser_internals/transition_system.pyx":161 + * raise NotImplementedError + * + * def get_class_name(self, int clas): # <<<<<<<<<<<<<< + * act = self.c[clas] + * return self.move_name(act.move, act.label) +*/ + __pyx_t_5 = __Pyx_CyFunction_New(&__pyx_mdef_5spacy_8pipeline_17_parser_internals_17transition_system_16TransitionSystem_15get_class_name, __Pyx_CYFUNCTION_CCLASS, __pyx_mstate_global->__pyx_n_u_TransitionSystem_get_class_name, NULL, __pyx_mstate_global->__pyx_n_u_spacy_pipeline__parser_internals, __pyx_mstate_global->__pyx_d, ((PyObject *)__pyx_mstate_global->__pyx_codeobj_tab[9])); if (unlikely(!__pyx_t_5)) __PYX_ERR(0, 161, __pyx_L1_error) + __Pyx_GOTREF(__pyx_t_5); + #if CYTHON_COMPILING_IN_CPYTHON && PY_VERSION_HEX >= 0x030E0000 + PyUnstable_Object_EnableDeferredRefcount(__pyx_t_5); + #endif + if (__Pyx_SetItemOnTypeDict(__pyx_mstate_global->__pyx_ptype_5spacy_8pipeline_17_parser_internals_17transition_system_TransitionSystem, __pyx_mstate_global->__pyx_n_u_get_class_name, __pyx_t_5) < (0)) __PYX_ERR(0, 161, __pyx_L1_error) + __Pyx_DECREF(__pyx_t_5); __pyx_t_5 = 0; + + /* "spacy/pipeline/_parser_internals/transition_system.pyx":165 + * return self.move_name(act.move, act.label) + * + * def initialize_actions(self, labels_by_action, min_freq=None): # <<<<<<<<<<<<<< + * self.labels = {} + * self.n_moves = 0 +*/ + __pyx_t_5 = __Pyx_CyFunction_New(&__pyx_mdef_5spacy_8pipeline_17_parser_internals_17transition_system_16TransitionSystem_17initialize_actions, __Pyx_CYFUNCTION_CCLASS, __pyx_mstate_global->__pyx_n_u_TransitionSystem_initialize_acti, NULL, __pyx_mstate_global->__pyx_n_u_spacy_pipeline__parser_internals, __pyx_mstate_global->__pyx_d, ((PyObject *)__pyx_mstate_global->__pyx_codeobj_tab[10])); if (unlikely(!__pyx_t_5)) __PYX_ERR(0, 165, __pyx_L1_error) + __Pyx_GOTREF(__pyx_t_5); + #if CYTHON_COMPILING_IN_CPYTHON && PY_VERSION_HEX >= 0x030E0000 + PyUnstable_Object_EnableDeferredRefcount(__pyx_t_5); + #endif + __Pyx_CyFunction_SetDefaultsTuple(__pyx_t_5, __pyx_mstate_global->__pyx_tuple[4]); + if (__Pyx_SetItemOnTypeDict(__pyx_mstate_global->__pyx_ptype_5spacy_8pipeline_17_parser_internals_17transition_system_TransitionSystem, __pyx_mstate_global->__pyx_n_u_initialize_actions, __pyx_t_5) < (0)) __PYX_ERR(0, 165, __pyx_L1_error) + __Pyx_DECREF(__pyx_t_5); __pyx_t_5 = 0; + + /* "spacy/pipeline/_parser_internals/transition_system.pyx":192 + * self.labels[action][label_str] = freq + * + * def add_action(self, int action, label_name): # <<<<<<<<<<<<<< + * cdef attr_t label_id + * if not isinstance(label_name, int): +*/ + __pyx_t_5 = __Pyx_CyFunction_New(&__pyx_mdef_5spacy_8pipeline_17_parser_internals_17transition_system_16TransitionSystem_19add_action, __Pyx_CYFUNCTION_CCLASS, __pyx_mstate_global->__pyx_n_u_TransitionSystem_add_action, NULL, __pyx_mstate_global->__pyx_n_u_spacy_pipeline__parser_internals, __pyx_mstate_global->__pyx_d, ((PyObject *)__pyx_mstate_global->__pyx_codeobj_tab[11])); if (unlikely(!__pyx_t_5)) __PYX_ERR(0, 192, __pyx_L1_error) + __Pyx_GOTREF(__pyx_t_5); + #if CYTHON_COMPILING_IN_CPYTHON && PY_VERSION_HEX >= 0x030E0000 + PyUnstable_Object_EnableDeferredRefcount(__pyx_t_5); + #endif + if (__Pyx_SetItemOnTypeDict(__pyx_mstate_global->__pyx_ptype_5spacy_8pipeline_17_parser_internals_17transition_system_TransitionSystem, __pyx_mstate_global->__pyx_n_u_add_action, __pyx_t_5) < (0)) __PYX_ERR(0, 192, __pyx_L1_error) + __Pyx_DECREF(__pyx_t_5); __pyx_t_5 = 0; + + /* "spacy/pipeline/_parser_internals/transition_system.pyx":221 + * return 1 + * + * def to_disk(self, path, **kwargs): # <<<<<<<<<<<<<< + * with path.open('wb') as file_: + * file_.write(self.to_bytes(**kwargs)) +*/ + __pyx_t_5 = __Pyx_CyFunction_New(&__pyx_mdef_5spacy_8pipeline_17_parser_internals_17transition_system_16TransitionSystem_21to_disk, __Pyx_CYFUNCTION_CCLASS, __pyx_mstate_global->__pyx_n_u_TransitionSystem_to_disk, NULL, __pyx_mstate_global->__pyx_n_u_spacy_pipeline__parser_internals, __pyx_mstate_global->__pyx_d, ((PyObject *)__pyx_mstate_global->__pyx_codeobj_tab[12])); if (unlikely(!__pyx_t_5)) __PYX_ERR(0, 221, __pyx_L1_error) + __Pyx_GOTREF(__pyx_t_5); + #if CYTHON_COMPILING_IN_CPYTHON && PY_VERSION_HEX >= 0x030E0000 + PyUnstable_Object_EnableDeferredRefcount(__pyx_t_5); + #endif + if (__Pyx_SetItemOnTypeDict(__pyx_mstate_global->__pyx_ptype_5spacy_8pipeline_17_parser_internals_17transition_system_TransitionSystem, __pyx_mstate_global->__pyx_n_u_to_disk, __pyx_t_5) < (0)) __PYX_ERR(0, 221, __pyx_L1_error) + __Pyx_DECREF(__pyx_t_5); __pyx_t_5 = 0; + + /* "spacy/pipeline/_parser_internals/transition_system.pyx":225 + * file_.write(self.to_bytes(**kwargs)) + * + * def from_disk(self, path, **kwargs): # <<<<<<<<<<<<<< + * with path.open('rb') as file_: + * byte_data = file_.read() +*/ + __pyx_t_5 = __Pyx_CyFunction_New(&__pyx_mdef_5spacy_8pipeline_17_parser_internals_17transition_system_16TransitionSystem_23from_disk, __Pyx_CYFUNCTION_CCLASS, __pyx_mstate_global->__pyx_n_u_TransitionSystem_from_disk, NULL, __pyx_mstate_global->__pyx_n_u_spacy_pipeline__parser_internals, __pyx_mstate_global->__pyx_d, ((PyObject *)__pyx_mstate_global->__pyx_codeobj_tab[13])); if (unlikely(!__pyx_t_5)) __PYX_ERR(0, 225, __pyx_L1_error) + __Pyx_GOTREF(__pyx_t_5); + #if CYTHON_COMPILING_IN_CPYTHON && PY_VERSION_HEX >= 0x030E0000 + PyUnstable_Object_EnableDeferredRefcount(__pyx_t_5); + #endif + if (__Pyx_SetItemOnTypeDict(__pyx_mstate_global->__pyx_ptype_5spacy_8pipeline_17_parser_internals_17transition_system_TransitionSystem, __pyx_mstate_global->__pyx_n_u_from_disk, __pyx_t_5) < (0)) __PYX_ERR(0, 225, __pyx_L1_error) + __Pyx_DECREF(__pyx_t_5); __pyx_t_5 = 0; + + /* "spacy/pipeline/_parser_internals/transition_system.pyx":231 + * return self + * + * def to_bytes(self, exclude=tuple()): # <<<<<<<<<<<<<< + * serializers = { + * 'moves': lambda: srsly.json_dumps(self.labels), +*/ + __pyx_t_10 = NULL; + __pyx_t_6 = 1; + { + PyObject *__pyx_callargs[2] = {__pyx_t_10, NULL}; + __pyx_t_5 = __Pyx_PyObject_FastCall((PyObject*)(&PyTuple_Type), __pyx_callargs+__pyx_t_6, (1-__pyx_t_6) | (__pyx_t_6*__Pyx_PY_VECTORCALL_ARGUMENTS_OFFSET)); + __Pyx_XDECREF(__pyx_t_10); __pyx_t_10 = 0; + if (unlikely(!__pyx_t_5)) __PYX_ERR(0, 231, __pyx_L1_error) + __Pyx_GOTREF(__pyx_t_5); + } + __pyx_mstate_global->__pyx_k__11 = __pyx_t_5; + __Pyx_GIVEREF(__pyx_t_5); + __pyx_t_5 = 0; + __pyx_t_10 = NULL; + __pyx_t_6 = 1; + { + PyObject *__pyx_callargs[2] = {__pyx_t_10, NULL}; + __pyx_t_5 = __Pyx_PyObject_FastCall((PyObject*)(&PyTuple_Type), __pyx_callargs+__pyx_t_6, (1-__pyx_t_6) | (__pyx_t_6*__Pyx_PY_VECTORCALL_ARGUMENTS_OFFSET)); + __Pyx_XDECREF(__pyx_t_10); __pyx_t_10 = 0; + if (unlikely(!__pyx_t_5)) __PYX_ERR(0, 231, __pyx_L1_error) + __Pyx_GOTREF(__pyx_t_5); + } + __pyx_t_10 = PyTuple_Pack(1, __pyx_t_5); if (unlikely(!__pyx_t_10)) __PYX_ERR(0, 231, __pyx_L1_error) + __Pyx_GOTREF(__pyx_t_10); + __Pyx_DECREF(__pyx_t_5); __pyx_t_5 = 0; + __pyx_t_5 = __Pyx_CyFunction_New(&__pyx_mdef_5spacy_8pipeline_17_parser_internals_17transition_system_16TransitionSystem_25to_bytes, __Pyx_CYFUNCTION_CCLASS, __pyx_mstate_global->__pyx_n_u_TransitionSystem_to_bytes, NULL, __pyx_mstate_global->__pyx_n_u_spacy_pipeline__parser_internals, __pyx_mstate_global->__pyx_d, ((PyObject *)__pyx_mstate_global->__pyx_codeobj_tab[14])); if (unlikely(!__pyx_t_5)) __PYX_ERR(0, 231, __pyx_L1_error) + __Pyx_GOTREF(__pyx_t_5); + #if CYTHON_COMPILING_IN_CPYTHON && PY_VERSION_HEX >= 0x030E0000 + PyUnstable_Object_EnableDeferredRefcount(__pyx_t_5); + #endif + __Pyx_CyFunction_SetDefaultsTuple(__pyx_t_5, __pyx_t_10); + __Pyx_DECREF(__pyx_t_10); __pyx_t_10 = 0; + if (__Pyx_SetItemOnTypeDict(__pyx_mstate_global->__pyx_ptype_5spacy_8pipeline_17_parser_internals_17transition_system_TransitionSystem, __pyx_mstate_global->__pyx_n_u_to_bytes, __pyx_t_5) < (0)) __PYX_ERR(0, 231, __pyx_L1_error) + __Pyx_DECREF(__pyx_t_5); __pyx_t_5 = 0; + + /* "spacy/pipeline/_parser_internals/transition_system.pyx":239 + * return util.to_bytes(serializers, exclude) + * + * def from_bytes(self, bytes_data, exclude=tuple()): # <<<<<<<<<<<<<< + * # We're adding a new field, 'cfg', here and we don't want to break + * # previous models that don't have it. +*/ + __pyx_t_10 = NULL; + __pyx_t_6 = 1; + { + PyObject *__pyx_callargs[2] = {__pyx_t_10, NULL}; + __pyx_t_5 = __Pyx_PyObject_FastCall((PyObject*)(&PyTuple_Type), __pyx_callargs+__pyx_t_6, (1-__pyx_t_6) | (__pyx_t_6*__Pyx_PY_VECTORCALL_ARGUMENTS_OFFSET)); + __Pyx_XDECREF(__pyx_t_10); __pyx_t_10 = 0; + if (unlikely(!__pyx_t_5)) __PYX_ERR(0, 239, __pyx_L1_error) + __Pyx_GOTREF(__pyx_t_5); + } + __pyx_mstate_global->__pyx_k__12 = __pyx_t_5; + __Pyx_GIVEREF(__pyx_t_5); + __pyx_t_5 = 0; + __pyx_t_10 = NULL; + __pyx_t_6 = 1; + { + PyObject *__pyx_callargs[2] = {__pyx_t_10, NULL}; + __pyx_t_5 = __Pyx_PyObject_FastCall((PyObject*)(&PyTuple_Type), __pyx_callargs+__pyx_t_6, (1-__pyx_t_6) | (__pyx_t_6*__Pyx_PY_VECTORCALL_ARGUMENTS_OFFSET)); + __Pyx_XDECREF(__pyx_t_10); __pyx_t_10 = 0; + if (unlikely(!__pyx_t_5)) __PYX_ERR(0, 239, __pyx_L1_error) + __Pyx_GOTREF(__pyx_t_5); + } + __pyx_t_10 = PyTuple_Pack(1, __pyx_t_5); if (unlikely(!__pyx_t_10)) __PYX_ERR(0, 239, __pyx_L1_error) + __Pyx_GOTREF(__pyx_t_10); + __Pyx_DECREF(__pyx_t_5); __pyx_t_5 = 0; + __pyx_t_5 = __Pyx_CyFunction_New(&__pyx_mdef_5spacy_8pipeline_17_parser_internals_17transition_system_16TransitionSystem_27from_bytes, __Pyx_CYFUNCTION_CCLASS, __pyx_mstate_global->__pyx_n_u_TransitionSystem_from_bytes, NULL, __pyx_mstate_global->__pyx_n_u_spacy_pipeline__parser_internals, __pyx_mstate_global->__pyx_d, ((PyObject *)__pyx_mstate_global->__pyx_codeobj_tab[15])); if (unlikely(!__pyx_t_5)) __PYX_ERR(0, 239, __pyx_L1_error) + __Pyx_GOTREF(__pyx_t_5); + #if CYTHON_COMPILING_IN_CPYTHON && PY_VERSION_HEX >= 0x030E0000 + PyUnstable_Object_EnableDeferredRefcount(__pyx_t_5); + #endif + __Pyx_CyFunction_SetDefaultsTuple(__pyx_t_5, __pyx_t_10); + __Pyx_DECREF(__pyx_t_10); __pyx_t_10 = 0; + if (__Pyx_SetItemOnTypeDict(__pyx_mstate_global->__pyx_ptype_5spacy_8pipeline_17_parser_internals_17transition_system_TransitionSystem, __pyx_mstate_global->__pyx_n_u_from_bytes, __pyx_t_5) < (0)) __PYX_ERR(0, 239, __pyx_L1_error) + __Pyx_DECREF(__pyx_t_5); __pyx_t_5 = 0; + + /* "spacy/pipeline/_parser_internals/transition_system.pyx":1 + * # cython: infer_types=True # <<<<<<<<<<<<<< + * # cython: profile=False + * from __future__ import print_function +*/ + __pyx_t_5 = __Pyx_PyDict_NewPresized(0); if (unlikely(!__pyx_t_5)) __PYX_ERR(0, 1, __pyx_L1_error) + __Pyx_GOTREF(__pyx_t_5); + if (PyDict_SetItem(__pyx_mstate_global->__pyx_d, __pyx_mstate_global->__pyx_n_u_test, __pyx_t_5) < (0)) __PYX_ERR(0, 1, __pyx_L1_error) + __Pyx_DECREF(__pyx_t_5); __pyx_t_5 = 0; + + /*--- Wrapped vars code ---*/ + + goto __pyx_L0; + __pyx_L1_error:; + __Pyx_XDECREF(__pyx_t_4); + __Pyx_XDECREF(__pyx_t_5); + __Pyx_XDECREF(__pyx_t_10); + __Pyx_XDECREF(__pyx_t_11); + if (__pyx_m) { + if (__pyx_mstate->__pyx_d && stringtab_initialized) { + __Pyx_AddTraceback("init spacy.pipeline._parser_internals.transition_system", __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 spacy.pipeline._parser_internals.transition_system"); + } + __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_print = __Pyx_GetBuiltinName(__pyx_mstate->__pyx_n_u_print); if (!__pyx_builtin_print) __PYX_ERR(0, 118, __pyx_L1_error) + __pyx_builtin_min = __Pyx_GetBuiltinName(__pyx_mstate->__pyx_n_u_min); if (!__pyx_builtin_min) __PYX_ERR(0, 212, __pyx_L1_error) + __pyx_builtin___import__ = __Pyx_GetBuiltinName(__pyx_mstate->__pyx_n_u_import); if (!__pyx_builtin___import__) __PYX_ERR(1, 101, __pyx_L1_error) + __pyx_builtin_enumerate = __Pyx_GetBuiltinName(__pyx_mstate->__pyx_n_u_enumerate); if (!__pyx_builtin_enumerate) __PYX_ERR(1, 157, __pyx_L1_error) + __pyx_builtin_Ellipsis = __Pyx_GetBuiltinName(__pyx_mstate->__pyx_n_u_Ellipsis); if (!__pyx_builtin_Ellipsis) __PYX_ERR(1, 409, __pyx_L1_error) + __pyx_builtin_id = __Pyx_GetBuiltinName(__pyx_mstate->__pyx_n_u_id); if (!__pyx_builtin_id) __PYX_ERR(1, 619, __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; + __pyx_mstate->__pyx_umethod_PyDict_Type__update.type = (PyObject*)(&PyDict_Type); + __pyx_mstate->__pyx_umethod_PyDict_Type__update.method_name = &__pyx_mstate->__pyx_n_u_update; + 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); + + /* "(tree fragment)":11 + * use_setstate = True + * else: + * use_setstate = ('self.name is not None',) # <<<<<<<<<<<<<< + * if use_setstate: + * return __pyx_unpickle_Enum, (type(self), 0x82a3537, None), state +*/ + __pyx_mstate_global->__pyx_tuple[0] = PyTuple_Pack(1, __pyx_mstate_global->__pyx_kp_u_self_name_is_not_None); if (unlikely(!__pyx_mstate_global->__pyx_tuple[0])) __PYX_ERR(1, 11, __pyx_L1_error) + __Pyx_GOTREF(__pyx_mstate_global->__pyx_tuple[0]); + __Pyx_GIVEREF(__pyx_mstate_global->__pyx_tuple[0]); + + /* "View.MemoryView":583 + * def suboffsets(self): + * if self.view.suboffsets == NULL: + * return (-1,) * self.view.ndim # <<<<<<<<<<<<<< + * + * return tuple([suboffset for suboffset in self.view.suboffsets[:self.view.ndim]]) +*/ + __pyx_mstate_global->__pyx_tuple[1] = PyTuple_New(1); if (unlikely(!__pyx_mstate_global->__pyx_tuple[1])) __PYX_ERR(1, 583, __pyx_L1_error) + __Pyx_GOTREF(__pyx_mstate_global->__pyx_tuple[1]); + __Pyx_INCREF(__pyx_mstate_global->__pyx_int_neg_1); + __Pyx_GIVEREF(__pyx_mstate_global->__pyx_int_neg_1); + if (__Pyx_PyTuple_SET_ITEM(__pyx_mstate_global->__pyx_tuple[1], 0, __pyx_mstate_global->__pyx_int_neg_1) != (0)) __PYX_ERR(1, 583, __pyx_L1_error); + __Pyx_GIVEREF(__pyx_mstate_global->__pyx_tuple[1]); + + /* "View.MemoryView":680 + * tup = index if isinstance(index, tuple) else (index,) + * + * result = [slice(None)] * ndim # <<<<<<<<<<<<<< + * have_slices = False + * seen_ellipsis = False +*/ + __pyx_mstate_global->__pyx_slice[0] = PySlice_New(Py_None, Py_None, Py_None); if (unlikely(!__pyx_mstate_global->__pyx_slice[0])) __PYX_ERR(1, 680, __pyx_L1_error) + __Pyx_GOTREF(__pyx_mstate_global->__pyx_slice[0]); + __Pyx_GIVEREF(__pyx_mstate_global->__pyx_slice[0]); + + /* "spacy/pipeline/_parser_internals/transition_system.pyx":222 + * + * def to_disk(self, path, **kwargs): + * with path.open('wb') as file_: # <<<<<<<<<<<<<< + * file_.write(self.to_bytes(**kwargs)) + * +*/ + __pyx_mstate_global->__pyx_tuple[2] = PyTuple_Pack(3, Py_None, Py_None, Py_None); if (unlikely(!__pyx_mstate_global->__pyx_tuple[2])) __PYX_ERR(0, 222, __pyx_L1_error) + __Pyx_GOTREF(__pyx_mstate_global->__pyx_tuple[2]); + __Pyx_GIVEREF(__pyx_mstate_global->__pyx_tuple[2]); + + /* "spacy/pipeline/_parser_internals/transition_system.pyx":77 + * return states + * + * def get_oracle_sequence(self, Example example, _debug=False): # <<<<<<<<<<<<<< + * states, golds, _ = self.init_gold_batch([example]) + * if not states: +*/ + __pyx_mstate_global->__pyx_tuple[3] = PyTuple_Pack(1, Py_False); if (unlikely(!__pyx_mstate_global->__pyx_tuple[3])) __PYX_ERR(0, 77, __pyx_L1_error) + __Pyx_GOTREF(__pyx_mstate_global->__pyx_tuple[3]); + __Pyx_GIVEREF(__pyx_mstate_global->__pyx_tuple[3]); + + /* "spacy/pipeline/_parser_internals/transition_system.pyx":88 + * return self.get_oracle_sequence_from_state(state, gold) + * + * def get_oracle_sequence_from_state(self, StateClass state, gold, _debug=None): # <<<<<<<<<<<<<< + * cdef Pool mem = Pool() + * # n_moves should not be zero at this point, but make sure to avoid zero-length mem alloc +*/ + __pyx_mstate_global->__pyx_tuple[4] = PyTuple_Pack(1, Py_None); if (unlikely(!__pyx_mstate_global->__pyx_tuple[4])) __PYX_ERR(0, 88, __pyx_L1_error) + __Pyx_GOTREF(__pyx_mstate_global->__pyx_tuple[4]); + __Pyx_GIVEREF(__pyx_mstate_global->__pyx_tuple[4]); + #if CYTHON_IMMORTAL_CONSTANTS + { + PyObject **table = __pyx_mstate->__pyx_tuple; + for (Py_ssize_t i=0; i<5; ++i) { + #if CYTHON_COMPILING_IN_CPYTHON_FREETHREADING + Py_SET_REFCNT(table[i], _Py_IMMORTAL_REFCNT_LOCAL); + #else + Py_SET_REFCNT(table[i], _Py_IMMORTAL_INITIAL_REFCNT); + #endif + } + } + #endif + #if CYTHON_IMMORTAL_CONSTANTS + { + PyObject **table = __pyx_mstate->__pyx_slice; + for (Py_ssize_t i=0; i<1; ++i) { + #if CYTHON_COMPILING_IN_CPYTHON_FREETHREADING + Py_SET_REFCNT(table[i], _Py_IMMORTAL_REFCNT_LOCAL); + #else + 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[] = {{2},{68},{3},{35},{54},{37},{60},{24},{52},{26},{34},{29},{33},{45},{22},{15},{179},{37},{3},{8},{30},{32},{1},{1},{1},{1},{1},{1},{1},{1},{8},{5},{6},{15},{23},{25},{7},{6},{2},{6},{35},{9},{30},{50},{39},{34},{8},{21},{6},{12},{44},{38},{54},{20},{32},{22},{30},{37},{5},{7},{1},{7},{4},{4},{8},{6},{4},{1},{11},{20},{4},{1},{8},{16},{27},{27},{33},{27},{26},{31},{36},{47},{27},{35},{25},{25},{24},{15},{0},{1},{2},{3},{3},{6},{3},{10},{13},{12},{15},{6},{16},{18},{2},{4},{9},{10},{1},{3},{4},{9},{17},{18},{11},{5},{5},{6},{9},{4},{8},{7},{3},{4},{15},{6},{9},{9},{5},{6},{7},{7},{8},{1},{5},{5},{6},{7},{4},{10},{9},{8},{3},{14},{19},{30},{12},{4},{5},{8},{4},{7},{1},{2},{10},{19},{5},{10},{15},{18},{13},{8},{8},{5},{8},{10},{10},{6},{11},{8},{10},{9},{6},{16},{8},{8},{3},{7},{13},{3},{8},{4},{10},{9},{5},{15},{3},{13},{4},{8},{4},{7},{7},{8},{3},{6},{4},{4},{4},{3},{11},{5},{14},{11},{10},{19},{14},{12},{2},{4},{10},{17},{13},{8},{7},{2},{4},{11},{12},{10},{12},{19},{5},{4},{4},{13},{50},{5},{5},{5},{6},{5},{4},{4},{12},{7},{6},{8},{4},{8},{26},{7},{5},{5},{6},{6},{4},{6},{2},{5},{1},{1},{6},{63},{259},{55},{243},{21},{38},{28},{30},{31},{492},{124},{12},{90},{38},{10},{92},{51},{39},{1}}; + #if (CYTHON_COMPRESS_STRINGS) == 2 /* compression: bz2 (2756 bytes) */ +const char* const cstring = "BZh91AY&SY\305A\370\221\000\001\256\177\377\377\377\377\377\377\377\377\367\277\377\377\372\277\377\377\370@@@@@@@@@@@@@\000@\000`\n|\372yG\233e\331t\001\335\333\200\003@\252\353\273uO\000<\rOI\022M4\036\211\35244cP\360S\324\365<\214\320h\322G\212\003OS\324\336\246S\t\247\352\203\020h\331L\310\324a\0326\240\3214\021\241O\005O\324\364j'\222f\243&\215\224\320\032\000\000\032\000\000\r\000\006\203@\323@\000\324\3014MCQ\001\221\265=M\003\312h\332\215\032\003@\003@\000\000\000\0004\320\003@\000\224\320\202\tI\2235\0324\032\014&\231\030\206\206\206L\231\r\030\206M4\032\032i\3520CCL\201\246\322f\2104\304\304\304\300L\004\300\000\000\000&\000\000\230\000\004\300\000\000\000M\002SH&\201\244&\nz4OST\374#Sj2\200\362\236\233T4\000\000\000\000\000\000\001\240\005\354\334n\031\365\033\224\035n\327\373\332g?\345\004:P\346\242\207P\244\204L6\247\376\307p\241G\034\243[U\244\204\323@\213\235\332\367\230\325C0\204\3110\220\220\324)\304\312\234U\223D\254X\034\306\214Z!\204\231\222\032\273\2461\002\370Y\225\032\023\007\216\265\270\\i\224$\310A8\303\036A:1\002\246%\222\226\2025\323\002)7\263E\037\312L\245L\320\360\014\230\315\t\t\rb\327V\303\"\260\300\305!\253GW\260\341Zd\345\007xT \021\203\031Be\003 UCZ\201\334\n\324)\002\024{~\237\210\316\031\2013\223\350Y\272F\350\033\265\316z\313,\307\266\303\374\326\023\263 \371\325$|PW\201\203\230\217\373\275\360\356W!\342g\261w\320\2642\367\3657\034\211\277\363\236\273\344\275\235-\006\264\024\345]\221&\256*i\366T+\001\207\342\224R\nI+$\020K\001?Qb\374I\350uH\215\034-\244#D\001A9\273-i\\\247f\303\350\013\024b\345\353\257\000\253v\013xc\337\006\243e&Lt\200bCI\240\306a886\240\210\324\001 \316\367/w+\200\010\007\014\366\021++P\247\235\263\266\202\0026a,\346\266\221>C349\026\000\007B\351U\036VD#NMt\371\247\035\017S;\333\305q\316\271T\n\0204\275\351\240 \216\243I\030\223)R\013\010c$\014g\344ME\242\211\2063\200Z&D\3203<\000\242\300\324\320\204\200\322\246D\030Y\231\220)\317\330\210\314g\273\026\311:{\276I\315k\024b\020+F\311\321tFd\232N:f\242\306\321\213\367m""\\4\322D\262\240\273h\360\312\340Fc4\301*2T\017#\246X,7\343t\0210\020\260\260\013\370\025\213\256\230DBR\034o\026\037\260\370\2509\362\236\203\246\355\235\345$o\207\207\"z\234\352nniE\257]\273\334\334l+Y\363\t\005x\360B\305%B\361I\273\206K\357\"\024O\tX\331\335r\201\232\361\204\014\300\006=T\034\200\231\270j\200\205\265\370\034\347@\337\nq \324\317a\030qO\212\341\246x\231\211&Tf\366\367\005\315\206\010\016\275y7\030U\020\327\263\253\360|\247_\240\177\314\337e\014\230\373D\t\037um\205z\001W`\251\025\260\024\254|@\006\235\274\325\224U\212\327\t\n\234bBP\206\335\375~\"\275D\310!8\353\215\201_s\351\007\304\273\217\207\356\r\357Id\336\033\277!\t\021Ao'\0022\033\333\036\3339_\206 \025sJ\005\242F{}E\337{Z\262_\000\365iV\363N\242+z\374\305\200\314\311\2044\227\362\203A?+Y\270\320\344\226\234\023Ce\203-\213\246\351\230\010\335\236\205\223nl\331\334$' \343\"\256\215\366\333c\346Ywk\n\220e\315!\366\236)(\3216@k\352g9@#\233\213\217\304\302O\243;]'\327A\312\266\302\334\261F\320\242\343\233/\320\341\027.\3550\267\342\236\211\244\251F\232\330\246Y\014\215:\001\323\340\262\357\01705\\N\226\261=\325\242\214\322\356\206\204\300\t1\2572X,\240\370\211\235\001\230\027#\004\231\"V\364\231\002B\243\247z\304Q\026\035q\375\317\213\251c\270C\003\273\376\325\363\252=\347\243F\217\037\227\315\023\312Dj\230\221jkk\021Xf\010q\252\365b\0074\241B\313\242\335\337\\\320D\034\226\362\325\202\207P=\234A\306\253\003\310\323\265Z\022\206\035\254`\377\027\004QPc\270\365|\374\341\000o\363\332\026\243\276\3701\213/\014\246\314!\001Y22$`\356\262\230\351\222\204w\355\032\253-\242@\201\357\243\262\232*\304\236/\025G\n\310\024\321\230\023\262\250A\222\315)1\311\210\344\026Q\212\242+\2719:;\234Y\034\242Gu\231\0161\210u(+\0227`\342D\354\337\361w$S\205\t\014T\037\211\020"; + PyObject *data = __Pyx_DecompressString(cstring, 2756, 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 (2655 bytes) */ +const char* const cstring = "x\332\215W\317w\323V\026&%4\001B\211\301@\230\226\341\271\300$t\210\211\333\020\322\2344=N0\231\264@\010\341G;szt\236\245gGD\226l=)\261\231M\227^j\251\245\226Zj\351e\226,\263\3642\177B\377\204\371\356\223\2358\004\3329\307\221\256\364\356{\367\336\357~\367^e\201\025-\213\031fM\330\322tl\311\352\256\320\205a\332\325\243\227\354\216\301j\276\364XY0\3236DS\030\214\333\006\263\035\217I\313\204\372\362\314\017\313~\245\"\\\266c\212]f8B\252U\321\254;R0\351\271\246!\344\n\267\231c[-\246\273\202{\202qVN7y[\334c\246d\272c{f\325w|\t;\254&j\216\333\312c\027\035\305\2454\2536\363\034\206\315\306\264:'\325 \223=\245\336\301\273\256\351\361\262%z\n\251S\025\327\251\375\331^\025\031\3335\275-\346\265\352\202M\366\336{.\267\245\n\343hK\252\206\035&\320\362\006\340{4\210\231\231\202\220*\225ju\257\305\344\026\307\321\236_\207s\025\307ez\313\333r\354\311`g\022\306(\220\311{\254\212]}\345\324\035`\255\314,>U\001\276\246\000\341\3023\007P\252\324\254(/)\036CXfY\270\000\031\020RZaD\345\317f\317K\317\247g\347g\0253\\\361\026\346%\274+\353\0262\007:PL\276iy0F\360\312<[\253\260\226\3433[\300M\244\265\016\275\301\r\336\226\260\231\024\036\tlR\345\202{\210[\303v\320s\262\207\253\271#h\367cnI\221_?\006\036\\\356\021\214\353\272\220}47g~\330\234a[`\302\217\233\236\250\263\032o)(\301\356w\302u\2160\177e+\022\341t\020sG\270\340\210'j\364\354\224)\276s\371\245\311\273\354\307in\030\232M`Q\350\014x\3154u\307\262\3109\244)\317\313\372\342\000\263I)u}\351\303\327}B-\031\246$\323B9P\325\331\024%\255\252\270D\361Pu\212\246'lO\025\312Q\241\2322\335b\220\243\322|'\330\342\017l\346\004\323l\007\211\254p\337\362\230\246\271\302\360u\241i\314\360U\254\266cO#\261;&\267\260\252\233\266\351i\232\355\327\352\255\274\246;\256\310\327\260\317T\347\260\n7\2554{f\215h8\250\346\3278j\344C\215\036tKRX\225\274\315k\242_%\317\034[\310:\327[\371\364*\\\327qe*\327\315:xg\213\274V""\347\256\024\256f\332\240\235\215\224\347\007\200\376K]\351J\253\245\264\356\367\265\356\237\320\272\257\352\335TL\223-\t\034\363\365Vs1ma\306\261\354\235|G\245v\230\304c\353\207o\375CRq\313rt\325\007\025\226\006\367x\376#\253i\215\322\031\2756\232/n\256\254\255\025\323\240\227W\300u\270^\232\371v\266Tx8S\262,\263.MYR\360\255:\226\361d\335\345\272%\324\013M{\336j\342\357\021\352V{\006\n\275\020\225\027\353\353/77E\303\027\266.^\036\006\277\251b\377\3609\177\304\227\023KT\006\\yur\251^\267Z\332\021\262'\024\2509k\345\226'\344\307\227P\020\333'V\252\302\323T\267\320\210H\037]vT\354\232\374Dx\037\323\321\224A\211fsR]\025C\231{\372\326G\227P2\250\271\036\010'#1\245\246\332\356\211\005\317\371D\354X\240\310\251#\347\217\232\263\246i\350)\260\222\032\002\356G\320C\022}Y\246\017\026/\013K\366\371\244\245-\021\031\021\266\361a^\270l\331\272\351\240\252\\\314!\324\207,\317\224\271\024\344\235F\004Un*I\327+U\002_\353\245@\353\013\200\224\272\017=\342\000\024\026\235\257\2132\327\267\007\212Uw\244\207\013\270\253\031\242\354W\325E\263\034\010u\034e\020A\351\356\350\352\202\2374hnh\0001m!\310\025F\235\246\t\242?\335\374\232\032L\252q\244\335C4y\r\223V4u\313W\252M\352e\225\nZ\222V\261xU\2421\242K\365fc\305\025\215#\036\036\322\016\033|\033^ \256\343\204\373\010w\376\234N\352\214\276\204\312\244?T\267\324h\026\251?Sz\310\261i\032\232\226\266K\334\021\246K\235CC\347\262\245\266-Z\352K\345\210\212J\242\263\216\036\217\023\2210;\314(\344\212\211F\327'c:)z\343\342\255D\3273\320\304\245\222,\207\033r{\227\273U\251H\244\021D=\3214\322;!\221JhO)\325\322+`\3549\260h\361Z\331\340K\232V\343\240\203\206\357(\374v\024\223k\002TJ\tT3m\374\224\215\232\312,\256\276\245\356;B\331!\201\024]\207\262\356\232\352AV\361CS\337N\335%=M\353]1\031mQ%\314\360@\346\350B\006@!\247R\301\327\205\2032\240\315u\014\253\272\003\352\341\373\027#A\220\200\231\200\033\032\246\276%\364m\351\327\322\247^\006IT\214T\222o\327M}\033\336\226\354\276\336\216\372\006%\0267|n\245\036\271e\372\002=j\242\207R:\236\007^\210&""\211U0\002\\\026\370\372\3007\321\014MML\2534\275.\242G\004\275X!\365f\272\222{N\016\310}\013j\236P\262%\370%\325\267c\257E\374\345\000=1\032\323\211\352q7\265\221^\244\247\343,|Y\201\314u\232YvUSP\2442\226\\\237\252\233\364\351\332\364\372\375\257\177\317/R\257\262\344R\276O\235^#\364\234mJ<\274\360U\326\374:Z\221\000\257-p\331\027r\267L\237\376\242\331\n\346\303\331\260\361{\261;z\276=\333\366\202\357\303b\370&*v\307.\005\337@|\035=\210G\342Fr&\331\350\216f\202\354\376\225\311\250\021\017uG\277h\353A&\270\023x\341\\\224\371\275x\240\266\277\0133\341\275\210w\307\256\341\375|4K\252\007xh\374\361\371\251\263\027\332k\301\313\360R\370m\3702\312t\307.\266\375\340qx\013\306\036\305g\3427\311J\322\350\216C5u\244\025\236&\277\272c\343\301\2710G\2673\301o\321\355\310\210\247\222\\2\233x\235\331\316\356^\371\375\310{\177\377\345\253\375W\257\367_\277\351\216\216\265\227\333\034A,\206\336\376\255\357\222B\362\250sno\352}\216V\236\204C\177\214\236:;\206\303w\003#\314\301\277\0029*!\316\206\273\021\217v\343j\262q\000S#A#<\027M\306\360r\"\034\"\207\276\017\226\003\025V\203\216Z\r\n\301jX\010\237)g\n\335\321\213\355\006A\220\t2\335\364\242t\272c\331\340\247\220\207~\264\032\027\010\320I\300\203X\256\006\272\022h\333\376\360b\247H\372?\341|\334~&\013\312\214\262<\326\376W\260\036\315\305\231\375o\026:\377\330\033\352\216]\t6\303\2410s\314M\240{\341F\270\034\352\321e\200y:~\220\234\357\314\355\301\373\353\341\225\220\323m\202\020\037\017>\017j\010z\374r\360 \374\014\016dY4\022\271\361\325\270\321\315\346\242/\343b\374\237\316\351\316\303\275\334^\341 ;\021\236\217\n\321\nRx6\311t\3618\0226\240\336\210/\020\025\262A\t1LE\n\332\307\301t?U\323\212\035\343\331\340gh\237\306\001k\361\006=\022\\\253x|\232(\262\214\007\303\301\323(\033\375;\366\222\205\316\353\275\002\010x!\023\\\tx\320\212\206\010\3663\341\253\364p \022^\2106z \037\323\312\004W\2618\034\256E\233\361\020Q\370\213\266\021|\035\024\003\245\355\005\013\341\0060\271\006D\350\374c\364\275\330\336\t~U\271y\024\177\036\363""\375\341'\357\213\204\371p\010\357.\252:X\006tpt\024L\004\305\301\275\267\t6^\016\346\302\313\341\343(\007v\277K2\007\243\227\202\034\301\321\263~'\365L\2616\\\210\336\304\245$\013\274\024\177_)\2465\010\377y\300\261\022z(\256\241\370r\274B\t\270\201\262\270\004\204\212\335\354\227\341C\234_\350f\211\010\0237\200\304\327Q\021\020\014\212_\003\235\211\034\202\243\003J\310\320W,\272\210B\035\352~u\033|\3736\336\210\365\344z\347Vgsod\257\361\211\227S\004\rv_\357\344:\017\366>K\023\3777\024\345F(\020\337\016r\227\275r\000\177\341\313\337\001G\366\272\"n\266\227\036*prj#4\242\373I&\311\r(\234%\327\322E\021=\214\357\304\273\211\200\215!R\271\022\226\243!0rP\274A]\007y<\003\233\023\327\273\023)53\361\255\370\327D\357\\\356\254\356\025>\361\362\266\"\351\031\274\342\211\337Y\356\360N\343@\371q\033\226\t\317\361\253\301[\030\271\ng\323\222\233\216_%9jI\027\333\"XBns\275\262=\337\236\017\036R\211\246\265z'\374o\234\213\277\213y\254\272\322B\360&,R*G\017KC5\207\271\340Z8\032\rG\217\341\227J\365\260\242\373\n*\200Jx\177\354f*\301v\360\013p\373'\322`$\271\375\341\205N\216\0306\202f9\273\177\363>e/\311\244\375\017\345D\250\217R\315\362@9\356\247\304>\337.\320\332\354\376\2659\004\274\333\251\354\255\276/\034\014\276\001\233o\202\330`\344Y\352\027\033i\337\242\363\372\324.\206\277\305\271\240\t\002\316\307\337'\305\336\210\326\036\250\271\246\315\323\260\306\210\224\032\367__main__memmemview__metaclass__minmin_freqmode__module__move_namemoves__mro_entries__msgmsgpack_loadsname__name__ndimneg_key__new__new_freqobjoffsetopenpackpathpop__prepare__print__pyx_checksum__pyx_state__pyx_type__pyx_unpickle_Enum__pyx_vtable____qualname__rbread__reduce____reduce_cython____reduce_ex__registerreverses0selfserializers__set_name__setdefault__setstate____setstate_cython__shapesizesortsorted_labelsspacy.pipeline._parser_internals.transition_systemsrslystartstatestatesstclsstepstopstring_tablestringsstruct__test__textto_bytesto_bytes..to_disktokentransunpackupdateutilvalueswbwritexy\2208\2304\230q\200A\330\010\013\2104\210t\2209\230A\230W\240A\330\014\022\220*\230A\230V\2405\250\007\250q\260\005\260Q\330\010\021\220\024\320\025'\240q\250\001\330\010\016\210c\220\021\220%\220t\2306\240\021\200A\340\010\013\2104\210z\230\021\230,\240a\330\014\027\220t\2308\2404\240q\250\001\340\014\027\220q\360\006\000\t\r\210I\220T\230\022\2302\230T\240\021\330\014\017\210u\220F\230#\230W\240D\250\005\250W\260C\260q\330\020\027\220q\330\010\013\2104\210y\230\003\2304\230q\330\014\020\220\n\230!\330\014\020\220\005\220]\240$\240d\250(\260!\2604\260t\2704\270w\300b\310\007\310u\320TU\320UV\320VW\330\010\014\210B\210a\210t\220<\230t\320#3\2601\260D\270\n\300(\310!\330\010\014\210L\230\001\360\010\000""\t\014\2104\210w\220d\230!\2308\2401\330\014\027\220s\230!\2304\230w\240a\240w\250g\260Q\340\014\020\220\007\220q\230\n\240'\250\021\330\014\030\230\001\330\010\013\2109\220B\220a\330\014\027\220q\330\010\014\210G\2201\220G\2301\230N\250(\260!\2601\330\010\017\210q\200A\340\010\021\220\021\330\010\021\220\021\330\010\014\210G\2201\330\014\024\220J\230a\230u\240G\2501\330\014\022\220'\230\021\230!\330\014\026\220c\230\021\230!\330\010\017\210q\320\004<\270A\330\010\014\210J\220a\330\010\014\210K\220q\330\010\027\220q\330\010\030\230\001\330\010\014\210H\220O\2406\250\021\320*:\270&\300\001\330\014\025\220S\230\001\230\021\340\014\020\220\007\220q\230\n\240'\250\021\360\006\000\r\035\230B\230c\240\023\240D\250\003\2505\260\013\2706\300\021\330\014\031\230\025\230a\330\014\031\230\030\240\021\330\014\020\220\006\220m\2401\330\020\023\2205\230\002\230!\330\024 \240\007\240r\250\026\250q\330\024!\240\033\250A\250[\270\003\2707\300!\3001\340\024\030\230\013\2401\240C\240q\250\t\260\021\330\024\030\230\007\230q\240\007\240q\250\r\260Q\330\010\024\220E\230\021\230(\240!\330\010\014\210F\220-\230q\330\014\020\220\n\230-\240q\250\001\330\020\024\220K\230q\240\003\2401\240I\250Q\330\020\024\220G\2301\230G\2401\240M\260\021\200A\340\010\020\220\004\220M\240\024\240Z\250t\260:\270V\3001\200A\330\r\021\220\025\220a\220y\240\001\330\014\030\230\005\230U\240!\330\010\014\210K\220q\230\r\240Q\330\010\017\210q\200A\330\r\021\220\025\220a\220y\240\001\330\014\021\220\026\220q\230\004\230I\240S\250\001\200A\330\010\016\210d\220\"\220A\220Q\330\010\017\210t\220:\230Q\230c\240\027\250\003\2501\200A\330\010\021\220\024\320\025'\240q\250\001\330\010\017\210v\220Y\230a\230u\240D\250\006\250a\320\004L\310A\330\010\030\230\004\230A\340\010\017\210t\2209\230B\230a\330\010\020\220\010\230\003\2306\240\021\240$\240j\260\001\330\010\023\2206\230\023\230F\240!\2404\240z\260\021\340\010\022\220!\330\010\024\220A\330\010\016\210d\220%\220y\240\001\330\014\020\220\n\230!\230:\240W\250E\260\024\260Q""\330\014\020\220\005\220U\230!\2304\230q\330\020\023\2208\2301\230C\230t\2405\250\001\250\023\250C\250q\330\024\035\230T\240\022\2401\240A\330\024\033\2307\240!\2401\330\024\027\220q\330\030\035\230U\240\"\240A\240Q\330\030\035\230U\240\"\240A\240Q\330\030\"\240!\330\030!\240\027\250\001\250\023\250E\260\021\330\034 \240\017\250q\260\001\330\034$\240G\2502\250Q\250c\260\031\270#\270S\300\007\300q\330\034$\240G\2502\250Q\250c\260\031\270#\270S\300\007\300q\330\034(\250\003\2501\250E\260\031\270!\2705\300\002\300!\3001\340\024\032\230#\230Q\230e\2404\240v\250Q\330\024\025\340\020\023\2201\330\024\036\230a\330\024\031\230\021\230!\330\024\030\230\005\230U\240!\2404\240q\330\030\035\230Q\230d\240/\260\021\260!\330\024\031\230\021\230!\330\024\030\230\t\240\027\250\001\330\030\035\230Q\230e\2407\250%\250w\260e\2705\300\001\330\024\031\230\025\230b\240\001\240\021\330\024\031\230\025\230b\240\001\240\021\330\024\035\230W\240A\240S\250\005\250Q\330\030\031\330\030 \240\007\240r\250\021\250#\250Y\260c\270\023\270G\3001\330\030 \240\007\240r\250\021\250#\250Y\260c\270\023\270G\3001\330\030$\240C\240q\250\005\250Y\260a\260u\270B\270a\270q\340\024\031\230\021\230$\230e\2401\240A\330\020\026\220j\240\001\240\026\240q\330\010\017\210q\320\004-\250U\260!\360\006\000\t\017\210e\220>\240\021\240!\330\010\021\220\021\330\010\013\2108\2207\230!\330\014\022\220'\230\021\230%\230{\250!\2503\250a\250q\330\010\013\210:\220W\230A\330\014\020\220\010\230\013\2401\240C\240q\250\001\330\010\013\2106\220\027\230\010\240\004\240F\250#\250Q\330\014\020\220\004\220G\2301\230C\230q\240\001\330\010\014\320\014\037\230q\240\001\330\010\017\210q\220X\230U\240+\250Q\250d\260!\320\004:\270!\330\010\020\220\007\220t\2304\320\037/\250q\260\001\260\021\330\010\013\2104\210q\330\014\023\2201\330\010\020\220\006\220a\220q\330\010\017\210u\220A\220Q\330\010\013\2101\330\014\023\2204\320\0276\260a\260w\270f\300G\3101\340\014\023\2204\320\0276\260a\260w\270a\320\004\037\230u\240A\330\010\t\330\014\025\220Q""\330\014\027\220q\330\014\023\2201\340\010\017\210t\2209\230A\230]\250!\220x\230t\2408\2509\260A__pyx_t_5spacy_8typedefs_attr_t\000struct __pyx_t_5spacy_7structs_LexemeC\000OOV_RANK\000EMPTY_LEXEMEstruct __pyx_t_5spacy_7structs_LexemeC\000EMPTY_LEXEMEuint64_t (void *, int, uint64_t)\000hash64O"; + 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 < 250; i++) { + Py_ssize_t bytes_length = index[i].length; + PyObject *string = PyUnicode_DecodeUTF8(bytes + pos, bytes_length, NULL); + if (likely(string) && i >= 58) 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 = 250; i < 270; 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 < 270; i++) { + if (unlikely(PyObject_Hash(stringtab[i]) == -1)) { + __PYX_ERR(0, 1, __pyx_L1_error) + } + } + #if CYTHON_IMMORTAL_CONSTANTS + { + PyObject **table = stringtab + 250; + for (Py_ssize_t i=0; i<20; ++i) { + #if CYTHON_COMPILING_IN_CPYTHON_FREETHREADING + Py_SET_REFCNT(table[i], _Py_IMMORTAL_REFCNT_LOCAL); + #else + 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,-1,1}; + int32_t const cint_constants_4[] = {136983863L}; + for (int i = 0; i < 4; i++) { + numbertab[i] = PyLong_FromLong((i < 3 ? cint_constants_1[i - 0] : cint_constants_4[i - 3])); + 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<4; ++i) { + #if CYTHON_COMPILING_IN_CPYTHON_FREETHREADING + Py_SET_REFCNT(table[i], _Py_IMMORTAL_REFCNT_LOCAL); + #else + 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 : 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 = {0, 0, 0, 0, (unsigned int)(CO_OPTIMIZED|CO_NEWLOCALS), 233}; + PyObject* const varnames[] = {0}; + __pyx_mstate_global->__pyx_codeobj_tab[0] = __Pyx_PyCode_New(descr, varnames, __pyx_mstate->__pyx_kp_u_spacy_pipeline__parser_internals_4, __pyx_mstate->__pyx_n_u_lambda, __pyx_mstate->__pyx_kp_b_iso88591_XU_Qd, tuple_dedup_map); if (unlikely(!__pyx_mstate_global->__pyx_codeobj_tab[0])) goto bad; + } + { + const __Pyx_PyCode_New_function_description descr = {0, 0, 0, 0, (unsigned int)(CO_OPTIMIZED|CO_NEWLOCALS), 234}; + PyObject* const varnames[] = {0}; + __pyx_mstate_global->__pyx_codeobj_tab[1] = __Pyx_PyCode_New(descr, varnames, __pyx_mstate->__pyx_kp_u_spacy_pipeline__parser_internals_4, __pyx_mstate->__pyx_n_u_lambda, __pyx_mstate->__pyx_kp_b_iso88591_xt89A, tuple_dedup_map); if (unlikely(!__pyx_mstate_global->__pyx_codeobj_tab[1])) goto bad; + } + { + const __Pyx_PyCode_New_function_description descr = {0, 0, 0, 0, (unsigned int)(CO_OPTIMIZED|CO_NEWLOCALS), 235}; + PyObject* const varnames[] = {0}; + __pyx_mstate_global->__pyx_codeobj_tab[2] = __Pyx_PyCode_New(descr, varnames, __pyx_mstate->__pyx_kp_u_spacy_pipeline__parser_internals_4, __pyx_mstate->__pyx_n_u_lambda, __pyx_mstate->__pyx_kp_b_iso88591_84q, 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), 59}; + 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_spacy_pipeline__parser_internals_4, __pyx_mstate->__pyx_n_u_reduce, __pyx_mstate->__pyx_kp_b_iso88591_A_M_Zt_V1, tuple_dedup_map); if (unlikely(!__pyx_mstate_global->__pyx_codeobj_tab[3])) goto bad; + } + { + const __Pyx_PyCode_New_function_description descr = {2, 0, 0, 6, (unsigned int)(CO_OPTIMIZED|CO_NEWLOCALS), 67}; + PyObject* const varnames[] = {__pyx_mstate->__pyx_n_u_self, __pyx_mstate->__pyx_n_u_docs, __pyx_mstate->__pyx_n_u_state, __pyx_mstate->__pyx_n_u_states, __pyx_mstate->__pyx_n_u_offset, __pyx_mstate->__pyx_n_u_doc_2}; + __pyx_mstate_global->__pyx_codeobj_tab[4] = __Pyx_PyCode_New(descr, varnames, __pyx_mstate->__pyx_kp_u_spacy_pipeline__parser_internals_4, __pyx_mstate->__pyx_n_u_init_batch, __pyx_mstate->__pyx_kp_b_iso88591_A_G1_JauG1_c_q, tuple_dedup_map); if (unlikely(!__pyx_mstate_global->__pyx_codeobj_tab[4])) goto bad; + } + { + const __Pyx_PyCode_New_function_description descr = {3, 0, 0, 8, (unsigned int)(CO_OPTIMIZED|CO_NEWLOCALS), 77}; + PyObject* const varnames[] = {__pyx_mstate->__pyx_n_u_self, __pyx_mstate->__pyx_n_u_example, __pyx_mstate->__pyx_n_u_debug, __pyx_mstate->__pyx_n_u_states, __pyx_mstate->__pyx_n_u_golds, __pyx_mstate->__pyx_n_u__14, __pyx_mstate->__pyx_n_u_state, __pyx_mstate->__pyx_n_u_gold}; + __pyx_mstate_global->__pyx_codeobj_tab[5] = __Pyx_PyCode_New(descr, varnames, __pyx_mstate->__pyx_kp_u_spacy_pipeline__parser_internals_4, __pyx_mstate->__pyx_n_u_get_oracle_sequence, __pyx_mstate->__pyx_kp_b_iso88591_t4_q_4q_1_aq_uAQ_1_4_6awfG1_4_6, tuple_dedup_map); if (unlikely(!__pyx_mstate_global->__pyx_codeobj_tab[5])) goto bad; + } + { + const __Pyx_PyCode_New_function_description descr = {4, 0, 0, 15, (unsigned int)(CO_OPTIMIZED|CO_NEWLOCALS), 88}; + PyObject* const varnames[] = {__pyx_mstate->__pyx_n_u_self, __pyx_mstate->__pyx_n_u_state, __pyx_mstate->__pyx_n_u_gold, __pyx_mstate->__pyx_n_u_debug, __pyx_mstate->__pyx_n_u_mem, __pyx_mstate->__pyx_n_u_costs, __pyx_mstate->__pyx_n_u_is_valid, __pyx_mstate->__pyx_n_u_history, __pyx_mstate->__pyx_n_u_debug_log, __pyx_mstate->__pyx_n_u_i, __pyx_mstate->__pyx_n_u_action, __pyx_mstate->__pyx_n_u_s0, __pyx_mstate->__pyx_n_u_b0, __pyx_mstate->__pyx_n_u_example, __pyx_mstate->__pyx_n_u_token}; + __pyx_mstate_global->__pyx_codeobj_tab[6] = __Pyx_PyCode_New(descr, varnames, __pyx_mstate->__pyx_kp_u_spacy_pipeline__parser_internals_4, __pyx_mstate->__pyx_n_u_get_oracle_sequence_from_state, __pyx_mstate->__pyx_kp_b_iso88591_LA_A_t9Ba_6_j_6_F_4z_A_d_y_WE_Q, tuple_dedup_map); if (unlikely(!__pyx_mstate_global->__pyx_codeobj_tab[6])) goto bad; + } + { + const __Pyx_PyCode_New_function_description descr = {3, 0, 0, 4, (unsigned int)(CO_OPTIMIZED|CO_NEWLOCALS), 136}; + PyObject* const varnames[] = {__pyx_mstate->__pyx_n_u_self, __pyx_mstate->__pyx_n_u_state, __pyx_mstate->__pyx_n_u_name, __pyx_mstate->__pyx_n_u_action}; + __pyx_mstate_global->__pyx_codeobj_tab[7] = __Pyx_PyCode_New(descr, varnames, __pyx_mstate->__pyx_kp_u_spacy_pipeline__parser_internals_4, __pyx_mstate->__pyx_n_u_apply_transition, __pyx_mstate->__pyx_kp_b_iso88591_A_4t9AWA_AV5_q_Q_q_c_t6, tuple_dedup_map); if (unlikely(!__pyx_mstate_global->__pyx_codeobj_tab[7])) goto bad; + } + { + const __Pyx_PyCode_New_function_description descr = {3, 0, 0, 4, (unsigned int)(CO_OPTIMIZED|CO_NEWLOCALS), 148}; + PyObject* const varnames[] = {__pyx_mstate->__pyx_n_u_self, __pyx_mstate->__pyx_n_u_stcls, __pyx_mstate->__pyx_n_u_move_name, __pyx_mstate->__pyx_n_u_action}; + __pyx_mstate_global->__pyx_codeobj_tab[8] = __Pyx_PyCode_New(descr, varnames, __pyx_mstate->__pyx_kp_u_spacy_pipeline__parser_internals_4, __pyx_mstate->__pyx_n_u_is_valid, __pyx_mstate->__pyx_kp_b_iso88591_A_q_vYauD_a, 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), 161}; + PyObject* const varnames[] = {__pyx_mstate->__pyx_n_u_self, __pyx_mstate->__pyx_n_u_clas, __pyx_mstate->__pyx_n_u_act}; + __pyx_mstate_global->__pyx_codeobj_tab[9] = __Pyx_PyCode_New(descr, varnames, __pyx_mstate->__pyx_kp_u_spacy_pipeline__parser_internals_4, __pyx_mstate->__pyx_n_u_get_class_name, __pyx_mstate->__pyx_kp_b_iso88591_A_d_AQ_t_Qc_1, tuple_dedup_map); if (unlikely(!__pyx_mstate_global->__pyx_codeobj_tab[9])) goto bad; + } + { + const __Pyx_PyCode_New_function_description descr = {3, 0, 0, 12, (unsigned int)(CO_OPTIMIZED|CO_NEWLOCALS), 165}; + PyObject* const varnames[] = {__pyx_mstate->__pyx_n_u_self, __pyx_mstate->__pyx_n_u_labels_by_action, __pyx_mstate->__pyx_n_u_min_freq, __pyx_mstate->__pyx_n_u_added_labels, __pyx_mstate->__pyx_n_u_added_actions, __pyx_mstate->__pyx_n_u_action, __pyx_mstate->__pyx_n_u_label_freqs, __pyx_mstate->__pyx_n_u_sorted_labels, __pyx_mstate->__pyx_n_u_freq, __pyx_mstate->__pyx_n_u_label_str, __pyx_mstate->__pyx_n_u_L, __pyx_mstate->__pyx_n_u_f}; + __pyx_mstate_global->__pyx_codeobj_tab[10] = __Pyx_PyCode_New(descr, varnames, __pyx_mstate->__pyx_kp_u_spacy_pipeline__parser_internals_4, __pyx_mstate->__pyx_n_u_initialize_actions, __pyx_mstate->__pyx_kp_b_iso88591_A_Ja_Kq_q_HO6_S_q_Bc_D_5_6_a_m1, tuple_dedup_map); if (unlikely(!__pyx_mstate_global->__pyx_codeobj_tab[10])) goto bad; + } + { + const __Pyx_PyCode_New_function_description descr = {3, 0, 0, 6, (unsigned int)(CO_OPTIMIZED|CO_NEWLOCALS), 192}; + PyObject* const varnames[] = {__pyx_mstate->__pyx_n_u_self, __pyx_mstate->__pyx_n_u_action, __pyx_mstate->__pyx_n_u_label_name, __pyx_mstate->__pyx_n_u_label_id, __pyx_mstate->__pyx_n_u_trans, __pyx_mstate->__pyx_n_u_new_freq}; + __pyx_mstate_global->__pyx_codeobj_tab[11] = __Pyx_PyCode_New(descr, varnames, __pyx_mstate->__pyx_kp_u_spacy_pipeline__parser_internals_4, __pyx_mstate->__pyx_n_u_add_action, __pyx_mstate->__pyx_kp_b_iso88591_A_4z_a_t84q_q_IT_2T_uF_WD_WCq_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, 4, (unsigned int)(CO_OPTIMIZED|CO_NEWLOCALS|CO_VARKEYWORDS), 221}; + PyObject* const varnames[] = {__pyx_mstate->__pyx_n_u_self, __pyx_mstate->__pyx_n_u_path, __pyx_mstate->__pyx_n_u_kwargs, __pyx_mstate->__pyx_n_u_file}; + __pyx_mstate_global->__pyx_codeobj_tab[12] = __Pyx_PyCode_New(descr, varnames, __pyx_mstate->__pyx_kp_u_spacy_pipeline__parser_internals_4, __pyx_mstate->__pyx_n_u_to_disk, __pyx_mstate->__pyx_kp_b_iso88591_A_ay_q_IS, tuple_dedup_map); if (unlikely(!__pyx_mstate_global->__pyx_codeobj_tab[12])) goto bad; + } + { + const __Pyx_PyCode_New_function_description descr = {2, 0, 0, 5, (unsigned int)(CO_OPTIMIZED|CO_NEWLOCALS|CO_VARKEYWORDS), 225}; + PyObject* const varnames[] = {__pyx_mstate->__pyx_n_u_self, __pyx_mstate->__pyx_n_u_path, __pyx_mstate->__pyx_n_u_kwargs, __pyx_mstate->__pyx_n_u_file, __pyx_mstate->__pyx_n_u_byte_data}; + __pyx_mstate_global->__pyx_codeobj_tab[13] = __Pyx_PyCode_New(descr, varnames, __pyx_mstate->__pyx_kp_u_spacy_pipeline__parser_internals_4, __pyx_mstate->__pyx_n_u_from_disk, __pyx_mstate->__pyx_kp_b_iso88591_A_ay_U_Kq_Q_q, tuple_dedup_map); if (unlikely(!__pyx_mstate_global->__pyx_codeobj_tab[13])) goto bad; + } + { + const __Pyx_PyCode_New_function_description descr = {2, 0, 0, 3, (unsigned int)(CO_OPTIMIZED|CO_NEWLOCALS), 231}; + PyObject* const varnames[] = {__pyx_mstate->__pyx_n_u_self, __pyx_mstate->__pyx_n_u_exclude, __pyx_mstate->__pyx_n_u_serializers}; + __pyx_mstate_global->__pyx_codeobj_tab[14] = __Pyx_PyCode_New(descr, varnames, __pyx_mstate->__pyx_kp_u_spacy_pipeline__parser_internals_4, __pyx_mstate->__pyx_n_u_to_bytes, __pyx_mstate->__pyx_kp_b_iso88591_uA_Q_q_1_t9A, tuple_dedup_map); if (unlikely(!__pyx_mstate_global->__pyx_codeobj_tab[14])) goto bad; + } + { + const __Pyx_PyCode_New_function_description descr = {3, 0, 0, 5, (unsigned int)(CO_OPTIMIZED|CO_NEWLOCALS), 239}; + PyObject* const varnames[] = {__pyx_mstate->__pyx_n_u_self, __pyx_mstate->__pyx_n_u_bytes_data, __pyx_mstate->__pyx_n_u_exclude, __pyx_mstate->__pyx_n_u_msg, __pyx_mstate->__pyx_n_u_labels}; + __pyx_mstate_global->__pyx_codeobj_tab[15] = __Pyx_PyCode_New(descr, varnames, __pyx_mstate->__pyx_kp_u_spacy_pipeline__parser_internals_4, __pyx_mstate->__pyx_n_u_from_bytes, __pyx_mstate->__pyx_kp_b_iso88591_U_e_87_3aq_WA_1Cq_6_F_Q_G1Cq_q, tuple_dedup_map); if (unlikely(!__pyx_mstate_global->__pyx_codeobj_tab[15])) 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) + + /* AssertionsEnabled.init */ + if (likely(__Pyx_init_assertions_enabled() == 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++) { + if (unlikely(__Pyx_PyTuple_SET_ITEM(res, i, src[i]) < (0))) { + Py_DECREF(res); + return NULL; + } + Py_INCREF(src[i]); + } + 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); +} + +/* 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; +} + +/* 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; +} + +/* 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 + +/* RaiseUnexpectedTypeError */ +static int +__Pyx_RaiseUnexpectedTypeError(const char *expected, PyObject *obj) +{ + __Pyx_TypeName obj_type_name = __Pyx_PyType_GetFullyQualifiedName(Py_TYPE(obj)); + PyErr_Format(PyExc_TypeError, "Expected %s, got " __Pyx_FMT_TYPENAME, + expected, obj_type_name); + __Pyx_DECREF_TypeName(obj_type_name); + return 0; +} + +/* 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); +} + +/* CIntToPyUnicode */ +static CYTHON_INLINE PyObject* __Pyx_uchar___Pyx_PyUnicode_From_Py_ssize_t(Py_ssize_t value, Py_ssize_t width, char padding_char) { +#ifdef __Pyx_HAS_GCC_DIAGNOSTIC +#pragma GCC diagnostic push +#pragma GCC diagnostic ignored "-Wconversion" +#endif + const Py_ssize_t neg_one = (Py_ssize_t) -1, const_zero = (Py_ssize_t) 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 & ~ (Py_ssize_t) 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_Py_ssize_t(Py_ssize_t value, Py_ssize_t width, char padding_char, char format_char) { + char digits[sizeof(Py_ssize_t)*3+2]; + char *dpos, *end = digits + sizeof(Py_ssize_t)*3+2; + const char *hex_digits = DIGITS_HEX; + Py_ssize_t length, ulength; + int prepend_sign, last_one_off; + Py_ssize_t remaining; +#ifdef __Pyx_HAS_GCC_DIAGNOSTIC +#pragma GCC diagnostic push +#pragma GCC diagnostic ignored "-Wconversion" +#endif + const Py_ssize_t neg_one = (Py_ssize_t) -1, const_zero = (Py_ssize_t) 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 = (Py_ssize_t) (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 = (Py_ssize_t) (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 = (Py_ssize_t) (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 +} + +/* GetAttr */ +static CYTHON_INLINE PyObject *__Pyx_GetAttr(PyObject *o, PyObject *n) { +#if CYTHON_USE_TYPE_SLOTS + if (likely(PyUnicode_Check(n))) + return __Pyx_PyObject_GetAttrStr(o, n); +#endif + return PyObject_GetAttr(o, n); +} + +/* GetItemInt */ +static PyObject *__Pyx_GetItemInt_Generic(PyObject *o, PyObject* j) { + PyObject *r; + if (unlikely(!j)) return NULL; + r = PyObject_GetItem(o, j); + Py_DECREF(j); + return r; +} +static CYTHON_INLINE PyObject *__Pyx_GetItemInt_List_Fast(PyObject *o, Py_ssize_t i, + int wraparound, int boundscheck, int unsafe_shared) { + CYTHON_MAYBE_UNUSED_VAR(unsafe_shared); +#if CYTHON_ASSUME_SAFE_SIZE + Py_ssize_t wrapped_i = i; + if (wraparound & unlikely(i < 0)) { + wrapped_i += PyList_GET_SIZE(o); + } + if ((CYTHON_AVOID_BORROWED_REFS || CYTHON_AVOID_THREAD_UNSAFE_BORROWED_REFS || !CYTHON_ASSUME_SAFE_MACROS)) { + return __Pyx_PyList_GetItemRefFast(o, wrapped_i, unsafe_shared); + } else + if ((!boundscheck) || likely(__Pyx_is_valid_index(wrapped_i, PyList_GET_SIZE(o)))) { + return __Pyx_NewRef(PyList_GET_ITEM(o, wrapped_i)); + } + return __Pyx_GetItemInt_Generic(o, PyLong_FromSsize_t(i)); +#else + (void)wraparound; + (void)boundscheck; + return PySequence_GetItem(o, i); +#endif +} +static CYTHON_INLINE PyObject *__Pyx_GetItemInt_Tuple_Fast(PyObject *o, Py_ssize_t i, + int wraparound, int boundscheck, int unsafe_shared) { + CYTHON_MAYBE_UNUSED_VAR(unsafe_shared); +#if CYTHON_ASSUME_SAFE_SIZE && CYTHON_ASSUME_SAFE_MACROS && !CYTHON_AVOID_BORROWED_REFS + Py_ssize_t wrapped_i = i; + if (wraparound & unlikely(i < 0)) { + wrapped_i += PyTuple_GET_SIZE(o); + } + if ((!boundscheck) || likely(__Pyx_is_valid_index(wrapped_i, PyTuple_GET_SIZE(o)))) { + return __Pyx_NewRef(PyTuple_GET_ITEM(o, wrapped_i)); + } + return __Pyx_GetItemInt_Generic(o, PyLong_FromSsize_t(i)); +#else + (void)wraparound; + (void)boundscheck; + return PySequence_GetItem(o, i); +#endif +} +static CYTHON_INLINE PyObject *__Pyx_GetItemInt_Fast(PyObject *o, Py_ssize_t i, int is_list, + int wraparound, int boundscheck, int unsafe_shared) { + CYTHON_MAYBE_UNUSED_VAR(unsafe_shared); +#if CYTHON_ASSUME_SAFE_MACROS && CYTHON_ASSUME_SAFE_SIZE + if (is_list || PyList_CheckExact(o)) { + Py_ssize_t n = ((!wraparound) | likely(i >= 0)) ? i : i + PyList_GET_SIZE(o); + if ((CYTHON_AVOID_BORROWED_REFS || CYTHON_AVOID_THREAD_UNSAFE_BORROWED_REFS)) { + return __Pyx_PyList_GetItemRefFast(o, n, unsafe_shared); + } else if ((!boundscheck) || (likely(__Pyx_is_valid_index(n, PyList_GET_SIZE(o))))) { + return __Pyx_NewRef(PyList_GET_ITEM(o, n)); + } + } else + #if !CYTHON_AVOID_BORROWED_REFS + if (PyTuple_CheckExact(o)) { + Py_ssize_t n = ((!wraparound) | likely(i >= 0)) ? i : i + PyTuple_GET_SIZE(o); + if ((!boundscheck) || likely(__Pyx_is_valid_index(n, PyTuple_GET_SIZE(o)))) { + return __Pyx_NewRef(PyTuple_GET_ITEM(o, n)); + } + } else + #endif +#endif +#if CYTHON_USE_TYPE_SLOTS && !CYTHON_COMPILING_IN_PYPY + { + PyMappingMethods *mm = Py_TYPE(o)->tp_as_mapping; + PySequenceMethods *sm = Py_TYPE(o)->tp_as_sequence; + if (!is_list && mm && mm->mp_subscript) { + PyObject *r, *key = PyLong_FromSsize_t(i); + if (unlikely(!key)) return NULL; + r = mm->mp_subscript(o, key); + Py_DECREF(key); + return r; + } + if (is_list || likely(sm && sm->sq_item)) { + if (wraparound && unlikely(i < 0) && likely(sm->sq_length)) { + Py_ssize_t l = sm->sq_length(o); + if (likely(l >= 0)) { + i += l; + } else { + if (!PyErr_ExceptionMatches(PyExc_OverflowError)) + return NULL; + PyErr_Clear(); + } + } + return sm->sq_item(o, i); + } + } +#else + if (is_list || !PyMapping_Check(o)) { + return PySequence_GetItem(o, i); + } +#endif + (void)wraparound; + (void)boundscheck; + return __Pyx_GetItemInt_Generic(o, PyLong_FromSsize_t(i)); +} + +/* ObjectGetItem */ +#if CYTHON_USE_TYPE_SLOTS +static PyObject *__Pyx_PyObject_GetIndex(PyObject *obj, PyObject *index) { + PyObject *runerr = NULL; + Py_ssize_t key_value; + key_value = __Pyx_PyIndex_AsSsize_t(index); + if (likely(key_value != -1 || !(runerr = PyErr_Occurred()))) { + return __Pyx_GetItemInt_Fast(obj, key_value, 0, 1, 1, 1); + } + if (PyErr_GivenExceptionMatches(runerr, PyExc_OverflowError)) { + __Pyx_TypeName index_type_name = __Pyx_PyType_GetFullyQualifiedName(Py_TYPE(index)); + PyErr_Clear(); + PyErr_Format(PyExc_IndexError, + "cannot fit '" __Pyx_FMT_TYPENAME "' into an index-sized integer", index_type_name); + __Pyx_DECREF_TypeName(index_type_name); + } + return NULL; +} +static PyObject *__Pyx_PyObject_GetItem_Slow(PyObject *obj, PyObject *key) { + __Pyx_TypeName obj_type_name; + if (likely(PyType_Check(obj))) { + PyObject *meth = __Pyx_PyObject_GetAttrStrNoError(obj, __pyx_mstate_global->__pyx_n_u_class_getitem); + if (!meth) { + PyErr_Clear(); + } else { + PyObject *result = __Pyx_PyObject_CallOneArg(meth, key); + Py_DECREF(meth); + return result; + } + } + obj_type_name = __Pyx_PyType_GetFullyQualifiedName(Py_TYPE(obj)); + PyErr_Format(PyExc_TypeError, + "'" __Pyx_FMT_TYPENAME "' object is not subscriptable", obj_type_name); + __Pyx_DECREF_TypeName(obj_type_name); + return NULL; +} +static PyObject *__Pyx_PyObject_GetItem(PyObject *obj, PyObject *key) { + PyTypeObject *tp = Py_TYPE(obj); + PyMappingMethods *mm = tp->tp_as_mapping; + PySequenceMethods *sm = tp->tp_as_sequence; + if (likely(mm && mm->mp_subscript)) { + return mm->mp_subscript(obj, key); + } + if (likely(sm && sm->sq_item)) { + return __Pyx_PyObject_GetIndex(obj, key); + } + return __Pyx_PyObject_GetItem_Slow(obj, key); +} +#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); + } +} + +/* DivInt[Py_ssize_t] */ +static CYTHON_INLINE Py_ssize_t __Pyx_div_Py_ssize_t(Py_ssize_t a, Py_ssize_t b, int b_is_constant) { + Py_ssize_t q = a / b; + Py_ssize_t r = a - q*b; + Py_ssize_t adapt_python = (b_is_constant ? + ((r != 0) & ((r < 0) ^ (b < 0))) : + ((r != 0) & ((r ^ b) < 0)) + ); + return q - adapt_python; +} + +/* GetAttr3 */ +#if __PYX_LIMITED_VERSION_HEX < 0x030d0000 +static PyObject *__Pyx_GetAttr3Default(PyObject *d) { + __Pyx_PyThreadState_declare + __Pyx_PyThreadState_assign + if (unlikely(!__Pyx_PyErr_ExceptionMatches(PyExc_AttributeError))) + return NULL; + __Pyx_PyErr_Clear(); + Py_INCREF(d); + return d; +} +#endif +static CYTHON_INLINE PyObject *__Pyx_GetAttr3(PyObject *o, PyObject *n, PyObject *d) { + PyObject *r; +#if __PYX_LIMITED_VERSION_HEX >= 0x030d0000 + int res = PyObject_GetOptionalAttr(o, n, &r); + return (res != 0) ? r : __Pyx_NewRef(d); +#else + #if CYTHON_USE_TYPE_SLOTS + if (likely(PyUnicode_Check(n))) { + r = __Pyx_PyObject_GetAttrStrNoError(o, n); + if (unlikely(!r) && likely(!PyErr_Occurred())) { + r = __Pyx_NewRef(d); + } + return r; + } + #endif + r = PyObject_GetAttr(o, n); + return (likely(r)) ? r : __Pyx_GetAttr3Default(d); +#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); +} + +/* RaiseTooManyValuesToUnpack */ +static CYTHON_INLINE void __Pyx_RaiseTooManyValuesError(Py_ssize_t expected) { + PyErr_Format(PyExc_ValueError, + "too many values to unpack (expected %" CYTHON_FORMAT_SSIZE_T "d)", expected); +} + +/* RaiseNeedMoreValuesToUnpack */ +static CYTHON_INLINE void __Pyx_RaiseNeedMoreValuesError(Py_ssize_t index) { + PyErr_Format(PyExc_ValueError, + "need more than %" CYTHON_FORMAT_SSIZE_T "d value%.1s to unpack", + index, (index == 1) ? "" : "s"); +} + +/* RaiseNoneIterError */ +static CYTHON_INLINE void __Pyx_RaiseNoneNotIterableError(void) { + PyErr_SetString(PyExc_TypeError, "'NoneType' object is not iterable"); +} + +/* ExtTypeTest */ +static CYTHON_INLINE int __Pyx_TypeTest(PyObject *obj, PyTypeObject *type) { + __Pyx_TypeName obj_type_name; + __Pyx_TypeName type_name; + if (unlikely(!type)) { + PyErr_SetString(PyExc_SystemError, "Missing type object"); + return 0; + } + if (likely(__Pyx_TypeCheck(obj, type))) + return 1; + obj_type_name = __Pyx_PyType_GetFullyQualifiedName(Py_TYPE(obj)); + type_name = __Pyx_PyType_GetFullyQualifiedName(type); + PyErr_Format(PyExc_TypeError, + "Cannot convert " __Pyx_FMT_TYPENAME " to " __Pyx_FMT_TYPENAME, + obj_type_name, type_name); + __Pyx_DECREF_TypeName(obj_type_name); + __Pyx_DECREF_TypeName(type_name); + return 0; +} + +/* 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 + +/* 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); +} + +/* 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; itp_as_sequence && type->tp_as_sequence->sq_repeat)) { + return type->tp_as_sequence->sq_repeat(seq, mul); + } else +#endif + { + return __Pyx_PySequence_Multiply_Generic(seq, mul); + } +} + +/* PyObjectFormatAndDecref */ +static CYTHON_INLINE PyObject* __Pyx_PyObject_FormatSimpleAndDecref(PyObject* s, PyObject* f) { + if (unlikely(!s)) return NULL; + if (likely(PyUnicode_CheckExact(s))) return s; + return __Pyx_PyObject_FormatAndDecref(s, f); +} +static CYTHON_INLINE PyObject* __Pyx_PyObject_FormatAndDecref(PyObject* s, PyObject* f) { + PyObject *result; + if (unlikely(!s)) return NULL; + result = PyObject_Format(s, f); + Py_DECREF(s); + return result; +} + +/* PyObjectFormat */ +#if CYTHON_USE_UNICODE_WRITER +static PyObject* __Pyx_PyObject_Format(PyObject* obj, PyObject* format_spec) { + int ret; + _PyUnicodeWriter writer; + if (likely(PyFloat_CheckExact(obj))) { + _PyUnicodeWriter_Init(&writer); + ret = _PyFloat_FormatAdvancedWriter( + &writer, + obj, + format_spec, 0, PyUnicode_GET_LENGTH(format_spec)); + } else if (likely(PyLong_CheckExact(obj))) { + _PyUnicodeWriter_Init(&writer); + ret = _PyLong_FormatAdvancedWriter( + &writer, + obj, + format_spec, 0, PyUnicode_GET_LENGTH(format_spec)); + } else { + return PyObject_Format(obj, format_spec); + } + if (unlikely(ret == -1)) { + _PyUnicodeWriter_Dealloc(&writer); + return NULL; + } + return _PyUnicodeWriter_Finish(&writer); +} +#endif + +/* SetItemInt */ +static int __Pyx_SetItemInt_Generic(PyObject *o, PyObject *j, PyObject *v) { + int r; + if (unlikely(!j)) return -1; + r = PyObject_SetItem(o, j, v); + Py_DECREF(j); + return r; +} +static CYTHON_INLINE int __Pyx_SetItemInt_Fast(PyObject *o, Py_ssize_t i, PyObject *v, int is_list, + int wraparound, int boundscheck, int unsafe_shared) { + CYTHON_MAYBE_UNUSED_VAR(unsafe_shared); +#if CYTHON_ASSUME_SAFE_MACROS && CYTHON_ASSUME_SAFE_SIZE && !CYTHON_AVOID_BORROWED_REFS + if (is_list || PyList_CheckExact(o)) { + Py_ssize_t n = (!wraparound) ? i : ((likely(i >= 0)) ? i : i + PyList_GET_SIZE(o)); + if ((CYTHON_AVOID_THREAD_UNSAFE_BORROWED_REFS && !__Pyx_IS_UNIQUELY_REFERENCED(o, unsafe_shared))) { + Py_INCREF(v); + return PyList_SetItem(o, n, v); + } else if ((!boundscheck) || likely(__Pyx_is_valid_index(n, PyList_GET_SIZE(o)))) { + PyObject* old; + Py_INCREF(v); + old = PyList_GET_ITEM(o, n); + PyList_SET_ITEM(o, n, v); + Py_DECREF(old); + return 0; + } + } else +#endif +#if CYTHON_USE_TYPE_SLOTS && !CYTHON_COMPILING_IN_PYPY + { + PyMappingMethods *mm = Py_TYPE(o)->tp_as_mapping; + PySequenceMethods *sm = Py_TYPE(o)->tp_as_sequence; + if (!is_list && mm && mm->mp_ass_subscript) { + int r; + PyObject *key = PyLong_FromSsize_t(i); + if (unlikely(!key)) return -1; + r = mm->mp_ass_subscript(o, key, v); + Py_DECREF(key); + return r; + } + if (is_list || likely(sm && sm->sq_ass_item)) { + if (wraparound && unlikely(i < 0) && likely(sm->sq_length)) { + Py_ssize_t l = sm->sq_length(o); + if (likely(l >= 0)) { + i += l; + } else { + if (!PyErr_ExceptionMatches(PyExc_OverflowError)) + return -1; + PyErr_Clear(); + } + } + return sm->sq_ass_item(o, i, v); + } + } +#else + if (is_list || !PyMapping_Check(o)) { + return PySequence_SetItem(o, i, v); + } +#endif + (void)wraparound; + (void)boundscheck; + return __Pyx_SetItemInt_Generic(o, PyLong_FromSsize_t(i), v); +} + +/* RaiseUnboundLocalError */ +static void __Pyx_RaiseUnboundLocalError(const char *varname) { + PyErr_Format(PyExc_UnboundLocalError, "local variable '%s' referenced before assignment", varname); +} + +/* DivInt[long] */ +static CYTHON_INLINE long __Pyx_div_long(long a, long b, int b_is_constant) { + long q = a / b; + long r = a - q*b; + long adapt_python = (b_is_constant ? + ((r != 0) & ((r < 0) ^ (b < 0))) : + ((r != 0) & ((r ^ b) < 0)) + ); + return q - adapt_python; +} + +/* tp_new */ +#if CYTHON_COMPILING_IN_LIMITED_API && __PYX_LIMITED_VERSION_HEX < 0x030A0000 +static PyObject* __Pyx_tp_new_fallback(PyObject* type_obj, PyObject* args, PyObject* kwargs) { + PyObject *new_func = NULL, *new_args = NULL, *obj; + Py_ssize_t i, nargs = PyTuple_Size(args); + if (unlikely(nargs < 0)) goto bad; + new_args = PyTuple_New(nargs + 1); + if (unlikely(!new_args)) goto bad; + for (i = 0; i < nargs + 1; i++) { + PyObject *item = (i == 0) ? type_obj : PyTuple_GetItem(args, i - 1); + if (unlikely(!item)) goto bad; + Py_INCREF(item); + if (unlikely(PyTuple_SetItem(new_args, i, item)) < 0) goto bad; + } + new_func = PyObject_GetAttrString(type_obj, "__new__"); + if (unlikely(!new_func)) goto bad; + obj = PyObject_Call(new_func, new_args, kwargs); + Py_DECREF(new_func); + Py_DECREF(new_args); + return obj; + bad: + Py_XDECREF(new_func); + Py_XDECREF(new_args); + return NULL; +} +#endif +static PyObject* __Pyx_tp_new_kwargs(PyObject* type_obj, PyObject* args, PyObject* kwargs) { + newfunc tp_new = __Pyx_PyType_TryGetSlot((PyTypeObject*)type_obj, tp_new, newfunc); +#if CYTHON_COMPILING_IN_LIMITED_API && __PYX_LIMITED_VERSION_HEX < 0x030A0000 + if (!tp_new) return __Pyx_tp_new_fallback(type_obj, args, kwargs); +#else + assert(tp_new != NULL); +#endif + return tp_new((PyTypeObject*)type_obj, args, kwargs); +} + +/* 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); +} + +/* 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; + if (__Pyx_PyTuple_SET_ITEM(builder, n, key) != (0)) return -1; + Py_INCREF(key); + 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 + +/* IterFinish */ +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; +} + +/* UnpackItemEndCheck */ +static int __Pyx_IternextUnpackEndCheck(PyObject *retval, Py_ssize_t expected) { + if (unlikely(retval)) { + Py_DECREF(retval); + __Pyx_RaiseTooManyValuesError(expected); + return -1; + } + return __Pyx_IterFinish(); +} + +/* PyObjectCall2Args (used by PyObjectCallMethod1) */ +static CYTHON_INLINE PyObject* __Pyx_PyObject_Call2Args(PyObject* function, PyObject* arg1, PyObject* arg2) { + PyObject *args[3] = {NULL, arg1, arg2}; + return __Pyx_PyObject_FastCall(function, args+1, 2 | __Pyx_PY_VECTORCALL_ARGUMENTS_OFFSET); +} + +/* PyObjectGetMethod (used by PyObjectCallMethod1) */ +#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 + +/* PyObjectCallMethod1 (used by append) */ +#if !(CYTHON_VECTORCALL && (__PYX_LIMITED_VERSION_HEX >= 0x030C0000 || (!CYTHON_COMPILING_IN_LIMITED_API && PY_VERSION_HEX >= 0x03090000))) +static PyObject* __Pyx__PyObject_CallMethod1(PyObject* method, PyObject* arg) { + PyObject *result = __Pyx_PyObject_CallOneArg(method, arg); + Py_DECREF(method); + return result; +} +#endif +static PyObject* __Pyx_PyObject_CallMethod1(PyObject* obj, PyObject* method_name, PyObject* arg) { +#if CYTHON_VECTORCALL && (__PYX_LIMITED_VERSION_HEX >= 0x030C0000 || (!CYTHON_COMPILING_IN_LIMITED_API && PY_VERSION_HEX >= 0x03090000)) + PyObject *args[2] = {obj, arg}; + (void) __Pyx_PyObject_CallOneArg; + (void) __Pyx_PyObject_Call2Args; + return PyObject_VectorcallMethod(method_name, args, 2 | PY_VECTORCALL_ARGUMENTS_OFFSET, NULL); +#else + PyObject *method = NULL, *result; + int is_method = __Pyx_PyObject_GetMethod(obj, method_name, &method); + if (likely(is_method)) { + result = __Pyx_PyObject_Call2Args(method, obj, arg); + Py_DECREF(method); + return result; + } + if (unlikely(!method)) return NULL; + return __Pyx__PyObject_CallMethod1(method, arg); +#endif +} + +/* append */ +static CYTHON_INLINE int __Pyx_PyObject_Append(PyObject* L, PyObject* x) { + if (likely(PyList_CheckExact(L))) { + if (unlikely(__Pyx_PyList_Append(L, x) < 0)) return -1; + } else { + PyObject* retval = __Pyx_PyObject_CallMethod1(L, __pyx_mstate_global->__pyx_n_u_append, x); + if (unlikely(!retval)) + return -1; + Py_DECREF(retval); + } + return 0; +} + +/* dict_setdefault */ +static CYTHON_INLINE PyObject *__Pyx_PyDict_SetDefault(PyObject *d, PyObject *key, PyObject *default_value) { + PyObject* value; +#if 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); +#elif PY_VERSION_HEX >= 0x030d0000 + PyDict_SetDefaultRef(d, key, default_value, &value); +#else + value = PyDict_SetDefault(d, key, default_value); + if (unlikely(!value)) return NULL; + Py_INCREF(value); +#endif + return value; +} + +/* 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 + +/* PyLongBinop */ +#if !CYTHON_COMPILING_IN_PYPY +static PyObject* __Pyx_Fallback___Pyx_PyLong_SubtractObjC(PyObject *op1, PyObject *op2, int inplace) { + return (inplace ? PyNumber_InPlaceSubtract : PyNumber_Subtract)(op1, op2); +} +#if CYTHON_USE_PYLONG_INTERNALS +static PyObject* __Pyx_Unpacked___Pyx_PyLong_SubtractObjC(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 PyLong_FromLong(-intval); + } + 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_subtract(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_SubtractObjC(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_SubtractObjC(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_SubtractObjC(op1, op2, intval, inplace, zerodivision_check); + } + #endif + if (PyFloat_CheckExact(op1)) { + return __Pyx_Float___Pyx_PyLong_SubtractObjC(op1, intval, zerodivision_check); + } + return __Pyx_Fallback___Pyx_PyLong_SubtractObjC(op1, op2, inplace); +} +#endif + +/* PyObjectLookupSpecial */ +#if CYTHON_USE_PYTYPE_LOOKUP && CYTHON_USE_TYPE_SLOTS +static CYTHON_INLINE PyObject* __Pyx__PyObject_LookupSpecial(PyObject* obj, PyObject* attr_name, int with_error) { + PyObject *res; + PyTypeObject *tp = Py_TYPE(obj); + res = _PyType_Lookup(tp, attr_name); + if (likely(res)) { + descrgetfunc f = Py_TYPE(res)->tp_descr_get; + if (!f) { + Py_INCREF(res); + } else { + res = f(res, obj, (PyObject *)tp); + } + } else if (with_error) { + PyErr_SetObject(PyExc_AttributeError, attr_name); + } + return res; +} +#endif + +/* RaiseClosureNameError */ +static void __Pyx_RaiseClosureNameError(const char *varname) { + PyErr_Format(PyExc_NameError, "free variable '%s' referenced before assignment in enclosing scope", varname); +} + +/* 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_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(marker); + 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}, + {"_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 !CYTHON_COMPILING_IN_LIMITED_API +#if PY_VERSION_HEX < 0x030900B1 + Py_CLEAR(__Pyx_CyFunction_GetClassObj(m)); +#else + { + PyObject *cls = (PyObject*) ((PyCMethodObject *) (m))->mm_class; + ((PyCMethodObject *) (m))->mm_class = NULL; + Py_XDECREF(cls); + } +#endif +#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); +#if !CYTHON_COMPILING_IN_LIMITED_API + Py_VISIT(__Pyx_CyFunction_GetClassObj(m)); +#endif + Py_VISIT(m->defaults_tuple); + Py_VISIT(m->defaults_kwdict); + 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; +} + +/* CallUnboundCMethod1 */ +#if CYTHON_COMPILING_IN_CPYTHON +static CYTHON_INLINE PyObject* __Pyx_CallUnboundCMethod1(__Pyx_CachedCFunction* cfunc, PyObject* self, PyObject* arg) { + int was_initialized = __Pyx_CachedCFunction_GetAndSetInitializing(cfunc); + if (likely(was_initialized == 2 && cfunc->func)) { + int flag = cfunc->flag; + if (flag == METH_O) { + return __Pyx_CallCFunction(cfunc, self, arg); + } else if (flag == METH_FASTCALL) { + return __Pyx_CallCFunctionFast(cfunc, self, &arg, 1); + } else if (flag == (METH_FASTCALL | METH_KEYWORDS)) { + return __Pyx_CallCFunctionFastWithKeywords(cfunc, self, &arg, 1, 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__CallUnboundCMethod1(&tmp_cfunc, self, arg); + } +#endif + PyObject* result = __Pyx__CallUnboundCMethod1(cfunc, self, arg); + __Pyx_CachedCFunction_SetFinishedInitializing(cfunc); + return result; +} +#endif +static PyObject* __Pyx__CallUnboundCMethod1(__Pyx_CachedCFunction* cfunc, PyObject* self, PyObject* arg){ + PyObject *result = NULL; + if (unlikely(!cfunc->func && !cfunc->method) && unlikely(__Pyx_TryUnpackUnboundCMethod(cfunc) < 0)) return NULL; +#if CYTHON_COMPILING_IN_CPYTHON + if (cfunc->func && (cfunc->flag & METH_VARARGS)) { + PyObject *args = PyTuple_New(1); + if (unlikely(!args)) return NULL; + Py_INCREF(arg); + PyTuple_SET_ITEM(args, 0, arg); + if (cfunc->flag & METH_KEYWORDS) + result = __Pyx_CallCFunctionWithKeywords(cfunc, self, args, NULL); + else + result = __Pyx_CallCFunction(cfunc, self, args); + Py_DECREF(args); + } else +#endif + { + result = __Pyx_PyObject_Call2Args(cfunc->method, self, arg); + } + return result; +} + +/* 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); + } +} + +/* 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); +} + +/* 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 +} + +/* SetVTable */ +static int __Pyx_SetVtable(PyTypeObject *type, void *vtable) { + PyObject *ob = PyCapsule_New(vtable, 0, 0); + if (unlikely(!ob)) + goto bad; +#if CYTHON_COMPILING_IN_LIMITED_API + if (unlikely(PyObject_SetAttr((PyObject *) type, __pyx_mstate_global->__pyx_n_u_pyx_vtable, ob) < 0)) +#else + if (unlikely(PyDict_SetItem(type->tp_dict, __pyx_mstate_global->__pyx_n_u_pyx_vtable, ob) < 0)) +#endif + goto bad; + Py_DECREF(ob); + return 0; +bad: + Py_XDECREF(ob); + return -1; +} + +/* GetVTable (used by MergeVTables) */ +static void* __Pyx_GetVtable(PyTypeObject *type) { + void* ptr; +#if CYTHON_COMPILING_IN_LIMITED_API + PyObject *ob = PyObject_GetAttr((PyObject *)type, __pyx_mstate_global->__pyx_n_u_pyx_vtable); +#else + PyObject *ob = PyObject_GetItem(type->tp_dict, __pyx_mstate_global->__pyx_n_u_pyx_vtable); +#endif + if (!ob) + goto bad; + ptr = PyCapsule_GetPointer(ob, 0); + if (!ptr && !PyErr_Occurred()) + PyErr_SetString(PyExc_RuntimeError, "invalid vtable found for imported type"); + Py_DECREF(ob); + return ptr; +bad: + Py_XDECREF(ob); + return NULL; +} + +/* MergeVTables */ +static int __Pyx_MergeVtables(PyTypeObject *type) { + int i=0; + Py_ssize_t size; + void** base_vtables; + __Pyx_TypeName tp_base_name = NULL; + __Pyx_TypeName base_name = NULL; + void* unknown = (void*)-1; + PyObject* bases = __Pyx_PyType_GetSlot(type, tp_bases, PyObject*); + int base_depth = 0; + { + PyTypeObject* base = __Pyx_PyType_GetSlot(type, tp_base, PyTypeObject*); + while (base) { + base_depth += 1; + base = __Pyx_PyType_GetSlot(base, tp_base, PyTypeObject*); + } + } + base_vtables = (void**) PyMem_Malloc(sizeof(void*) * (size_t)(base_depth + 1)); + base_vtables[0] = unknown; +#if CYTHON_COMPILING_IN_LIMITED_API + size = PyTuple_Size(bases); + if (size < 0) goto other_failure; +#else + size = PyTuple_GET_SIZE(bases); +#endif + for (i = 1; i < size; i++) { + PyObject *basei; + void* base_vtable; +#if CYTHON_AVOID_BORROWED_REFS + basei = PySequence_GetItem(bases, i); + if (unlikely(!basei)) goto other_failure; +#elif !CYTHON_ASSUME_SAFE_MACROS + basei = PyTuple_GetItem(bases, i); + if (unlikely(!basei)) goto other_failure; +#else + basei = PyTuple_GET_ITEM(bases, i); +#endif + base_vtable = __Pyx_GetVtable((PyTypeObject*)basei); +#if CYTHON_AVOID_BORROWED_REFS + Py_DECREF(basei); +#endif + if (base_vtable != NULL) { + int j; + PyTypeObject* base = __Pyx_PyType_GetSlot(type, tp_base, PyTypeObject*); + for (j = 0; j < base_depth; j++) { + if (base_vtables[j] == unknown) { + base_vtables[j] = __Pyx_GetVtable(base); + base_vtables[j + 1] = unknown; + } + if (base_vtables[j] == base_vtable) { + break; + } else if (base_vtables[j] == NULL) { + goto bad; + } + base = __Pyx_PyType_GetSlot(base, tp_base, PyTypeObject*); + } + } + } + PyErr_Clear(); + PyMem_Free(base_vtables); + return 0; +bad: + { + PyTypeObject* basei = NULL; + PyTypeObject* tp_base = __Pyx_PyType_GetSlot(type, tp_base, PyTypeObject*); + tp_base_name = __Pyx_PyType_GetFullyQualifiedName(tp_base); +#if CYTHON_AVOID_BORROWED_REFS + basei = (PyTypeObject*)PySequence_GetItem(bases, i); + if (unlikely(!basei)) goto really_bad; +#elif !CYTHON_ASSUME_SAFE_MACROS + basei = (PyTypeObject*)PyTuple_GetItem(bases, i); + if (unlikely(!basei)) goto really_bad; +#else + basei = (PyTypeObject*)PyTuple_GET_ITEM(bases, i); +#endif + base_name = __Pyx_PyType_GetFullyQualifiedName(basei); +#if CYTHON_AVOID_BORROWED_REFS + Py_DECREF(basei); +#endif + } + PyErr_Format(PyExc_TypeError, + "multiple bases have vtable conflict: '" __Pyx_FMT_TYPENAME "' and '" __Pyx_FMT_TYPENAME "'", tp_base_name, base_name); +#if CYTHON_AVOID_BORROWED_REFS || !CYTHON_ASSUME_SAFE_MACROS +really_bad: // bad has failed! +#endif + __Pyx_DECREF_TypeName(tp_base_name); + __Pyx_DECREF_TypeName(base_name); +#if CYTHON_COMPILING_IN_LIMITED_API || CYTHON_AVOID_BORROWED_REFS || !CYTHON_ASSUME_SAFE_MACROS +other_failure: +#endif + PyMem_Free(base_vtables); + return -1; +} + +/* 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_2); + if (likely(name_attr)) { + ret = PyObject_RichCompareBool(name_attr, name, Py_EQ); + } else { + ret = -1; + } + if (unlikely(ret < 0)) { + PyErr_Clear(); + ret = 0; + } + Py_XDECREF(name_attr); + return ret; +} +static int __Pyx_setup_reduce(PyObject* type_obj) { + int ret = 0; + PyObject *object_reduce = NULL; + PyObject *object_getstate = NULL; + PyObject *object_reduce_ex = NULL; + PyObject *reduce = NULL; + PyObject *reduce_ex = NULL; + PyObject *reduce_cython = NULL; + PyObject *setstate = NULL; + PyObject *setstate_cython = NULL; + PyObject *getstate = NULL; +#if CYTHON_USE_PYTYPE_LOOKUP + getstate = _PyType_Lookup((PyTypeObject*)type_obj, __pyx_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_1 +#define __PYX_HAVE_RT_ImportType_3_2_1 +static PyTypeObject *__Pyx_ImportType_3_2_1(PyObject *module, const char *module_name, const char *class_name, + size_t size, size_t alignment, enum __Pyx_ImportType_CheckSize_3_2_1 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_1 && + ((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_1 && (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 VoidPtrImport) */ +#ifndef __PYX_HAVE_RT_ImportFromPxd_3_2_1 +#define __PYX_HAVE_RT_ImportFromPxd_3_2_1 +static int __Pyx_ImportFromPxd_3_2_1(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 + +/* VoidPtrImport */ +#ifndef __PYX_HAVE_RT_ImportVoidPtr_3_2_1 +#define __PYX_HAVE_RT_ImportVoidPtr_3_2_1 +static int __Pyx_ImportVoidPtr_3_2_1(PyObject *module, const char *name, void **p, const char *sig) { + return __Pyx_ImportFromPxd_3_2_1(module, name, p, sig, "variable"); +} +#endif + +/* FunctionImport */ +#ifndef __PYX_HAVE_RT_ImportFunction_3_2_1 +#define __PYX_HAVE_RT_ImportFunction_3_2_1 +static int __Pyx_ImportFunction_3_2_1(PyObject *module, const char *funcname, void (**f)(void), const char *sig) { + union { + void (*fp)(void); + void *p; + } tmp; + int result = __Pyx_ImportFromPxd_3_2_1(module, funcname, &tmp.p, sig, "function"); + if (result == 0) { + *f = tmp.fp; + } + return result; +} +#endif + +/* 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__2); + 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; +} + +/* Py3UpdateBases */ +static PyObject* +__Pyx_PEP560_update_bases(PyObject *bases) +{ + Py_ssize_t i, j, size_bases; + PyObject *base = NULL, *meth, *new_base, *result, *new_bases = NULL; +#if CYTHON_ASSUME_SAFE_SIZE + size_bases = PyTuple_GET_SIZE(bases); +#else + size_bases = PyTuple_Size(bases); + if (size_bases < 0) return NULL; +#endif + for (i = 0; i < size_bases; i++) { +#if CYTHON_AVOID_BORROWED_REFS + Py_CLEAR(base); +#endif +#if CYTHON_ASSUME_SAFE_MACROS + base = PyTuple_GET_ITEM(bases, i); +#else + base = PyTuple_GetItem(bases, i); + if (!base) goto error; +#endif +#if CYTHON_AVOID_BORROWED_REFS + Py_INCREF(base); +#endif + if (PyType_Check(base)) { + if (new_bases) { + if (PyList_Append(new_bases, base) < 0) { + goto error; + } + } + continue; + } + meth = __Pyx_PyObject_GetAttrStrNoError(base, __pyx_mstate_global->__pyx_n_u_mro_entries); + if (!meth && PyErr_Occurred()) { + goto error; + } + if (!meth) { + if (new_bases) { + if (PyList_Append(new_bases, base) < 0) { + goto error; + } + } + continue; + } + new_base = __Pyx_PyObject_CallOneArg(meth, bases); + Py_DECREF(meth); + if (!new_base) { + goto error; + } + if (!PyTuple_Check(new_base)) { + PyErr_SetString(PyExc_TypeError, + "__mro_entries__ must return a tuple"); + Py_DECREF(new_base); + goto error; + } + if (!new_bases) { + if (!(new_bases = PyList_New(i))) { + goto error; + } + for (j = 0; j < i; j++) { + PyObject *base_from_list; +#if CYTHON_ASSUME_SAFE_MACROS + base_from_list = PyTuple_GET_ITEM(bases, j); + PyList_SET_ITEM(new_bases, j, base_from_list); + Py_INCREF(base_from_list); +#else + base_from_list = PyTuple_GetItem(bases, j); + if (!base_from_list) goto error; + Py_INCREF(base_from_list); + if (PyList_SetItem(new_bases, j, base_from_list) < 0) goto error; +#endif + } + } +#if CYTHON_ASSUME_SAFE_SIZE + j = PyList_GET_SIZE(new_bases); +#else + j = PyList_Size(new_bases); + if (j < 0) goto error; +#endif + if (PyList_SetSlice(new_bases, j, j, new_base) < 0) { + goto error; + } + Py_DECREF(new_base); + } + if (!new_bases) { + Py_INCREF(bases); + return bases; + } + result = PyList_AsTuple(new_bases); + Py_DECREF(new_bases); +#if CYTHON_AVOID_BORROWED_REFS + Py_XDECREF(base); +#endif + return result; +error: + Py_XDECREF(new_bases); +#if CYTHON_AVOID_BORROWED_REFS + Py_XDECREF(base); +#endif + return NULL; +} + +/* CalculateMetaclass */ +static PyObject *__Pyx_CalculateMetaclass(PyTypeObject *metaclass, PyObject *bases) { + Py_ssize_t i, nbases; +#if CYTHON_ASSUME_SAFE_SIZE + nbases = PyTuple_GET_SIZE(bases); +#else + nbases = PyTuple_Size(bases); + if (nbases < 0) return NULL; +#endif + for (i=0; i < nbases; i++) { + PyTypeObject *tmptype; +#if CYTHON_ASSUME_SAFE_MACROS + PyObject *tmp = PyTuple_GET_ITEM(bases, i); +#else + PyObject *tmp = PyTuple_GetItem(bases, i); + if (!tmp) return NULL; +#endif + tmptype = Py_TYPE(tmp); + if (!metaclass) { + metaclass = tmptype; + continue; + } + if (PyType_IsSubtype(metaclass, tmptype)) + continue; + if (PyType_IsSubtype(tmptype, metaclass)) { + metaclass = tmptype; + continue; + } + PyErr_SetString(PyExc_TypeError, + "metaclass conflict: " + "the metaclass of a derived class " + "must be a (non-strict) subclass " + "of the metaclasses of all its bases"); + return NULL; + } + if (!metaclass) { + metaclass = &PyType_Type; + } + Py_INCREF((PyObject*) metaclass); + return (PyObject*) metaclass; +} + +/* Py3ClassCreate */ +static PyObject *__Pyx_Py3MetaclassPrepare(PyObject *metaclass, PyObject *bases, PyObject *name, + PyObject *qualname, PyObject *mkw, PyObject *modname, PyObject *doc) { + PyObject *ns; + if (metaclass) { + PyObject *prep = __Pyx_PyObject_GetAttrStrNoError(metaclass, __pyx_mstate_global->__pyx_n_u_prepare); + if (prep) { + PyObject *pargs[3] = {NULL, name, bases}; + ns = __Pyx_PyObject_FastCallDict(prep, pargs+1, 2 | __Pyx_PY_VECTORCALL_ARGUMENTS_OFFSET, mkw); + Py_DECREF(prep); + } else { + if (unlikely(PyErr_Occurred())) + return NULL; + ns = PyDict_New(); + } + } else { + ns = PyDict_New(); + } + if (unlikely(!ns)) + return NULL; + if (unlikely(PyObject_SetItem(ns, __pyx_mstate_global->__pyx_n_u_module, modname) < 0)) goto bad; + if (unlikely(PyObject_SetItem(ns, __pyx_mstate_global->__pyx_n_u_qualname, qualname) < 0)) goto bad; + if (unlikely(doc && PyObject_SetItem(ns, __pyx_mstate_global->__pyx_n_u_doc, doc) < 0)) goto bad; + return ns; +bad: + Py_DECREF(ns); + return NULL; +} +static PyObject *__Pyx_Py3ClassCreate(PyObject *metaclass, PyObject *name, PyObject *bases, + PyObject *dict, PyObject *mkw, + int calculate_metaclass, int allow_py2_metaclass) { + PyObject *result; + PyObject *owned_metaclass = NULL; + PyObject *margs[4] = {NULL, name, bases, dict}; + if (allow_py2_metaclass) { + owned_metaclass = PyObject_GetItem(dict, __pyx_mstate_global->__pyx_n_u_metaclass); + if (owned_metaclass) { + metaclass = owned_metaclass; + } else if (likely(PyErr_ExceptionMatches(PyExc_KeyError))) { + PyErr_Clear(); + } else { + return NULL; + } + } + if (calculate_metaclass && (!metaclass || PyType_Check(metaclass))) { + metaclass = __Pyx_CalculateMetaclass((PyTypeObject*) metaclass, bases); + Py_XDECREF(owned_metaclass); + if (unlikely(!metaclass)) + return NULL; + owned_metaclass = metaclass; + } + result = __Pyx_PyObject_FastCallDict(metaclass, margs+1, 3 | __Pyx_PY_VECTORCALL_ARGUMENTS_OFFSET, mkw); + Py_XDECREF(owned_metaclass); + return result; +} + +/* 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;\ + } + +/* Declarations */ +#if CYTHON_CCOMPLEX && (1) && (!0 || __cplusplus) + #ifdef __cplusplus + static CYTHON_INLINE __pyx_t_float_complex __pyx_t_float_complex_from_parts(float x, float y) { + return ::std::complex< float >(x, y); + } + #else + static CYTHON_INLINE __pyx_t_float_complex __pyx_t_float_complex_from_parts(float x, float y) { + return x + y*(__pyx_t_float_complex)_Complex_I; + } + #endif +#else + static CYTHON_INLINE __pyx_t_float_complex __pyx_t_float_complex_from_parts(float x, float y) { + __pyx_t_float_complex z; + z.real = x; + z.imag = y; + return z; + } +#endif + +/* Arithmetic */ +#if CYTHON_CCOMPLEX && (1) && (!0 || __cplusplus) +#else + static CYTHON_INLINE int __Pyx_c_eq_float(__pyx_t_float_complex a, __pyx_t_float_complex b) { + return (a.real == b.real) && (a.imag == b.imag); + } + static CYTHON_INLINE __pyx_t_float_complex __Pyx_c_sum_float(__pyx_t_float_complex a, __pyx_t_float_complex b) { + __pyx_t_float_complex z; + z.real = a.real + b.real; + z.imag = a.imag + b.imag; + return z; + } + static CYTHON_INLINE __pyx_t_float_complex __Pyx_c_diff_float(__pyx_t_float_complex a, __pyx_t_float_complex b) { + __pyx_t_float_complex z; + z.real = a.real - b.real; + z.imag = a.imag - b.imag; + return z; + } + static CYTHON_INLINE __pyx_t_float_complex __Pyx_c_prod_float(__pyx_t_float_complex a, __pyx_t_float_complex b) { + __pyx_t_float_complex z; + z.real = a.real * b.real - a.imag * b.imag; + z.imag = a.real * b.imag + a.imag * b.real; + return z; + } + #if 1 + static CYTHON_INLINE __pyx_t_float_complex __Pyx_c_quot_float(__pyx_t_float_complex a, __pyx_t_float_complex b) { + if (b.imag == 0) { + return __pyx_t_float_complex_from_parts(a.real / b.real, a.imag / b.real); + } else if (fabsf(b.real) >= fabsf(b.imag)) { + if (b.real == 0 && b.imag == 0) { + return __pyx_t_float_complex_from_parts(a.real / b.real, a.imag / b.imag); + } else { + float r = b.imag / b.real; + float s = (float)(1.0) / (b.real + b.imag * r); + return __pyx_t_float_complex_from_parts( + (a.real + a.imag * r) * s, (a.imag - a.real * r) * s); + } + } else { + float r = b.real / b.imag; + float s = (float)(1.0) / (b.imag + b.real * r); + return __pyx_t_float_complex_from_parts( + (a.real * r + a.imag) * s, (a.imag * r - a.real) * s); + } + } + #else + static CYTHON_INLINE __pyx_t_float_complex __Pyx_c_quot_float(__pyx_t_float_complex a, __pyx_t_float_complex b) { + if (b.imag == 0) { + return __pyx_t_float_complex_from_parts(a.real / b.real, a.imag / b.real); + } else { + float denom = b.real * b.real + b.imag * b.imag; + return __pyx_t_float_complex_from_parts( + (a.real * b.real + a.imag * b.imag) / denom, + (a.imag * b.real - a.real * b.imag) / denom); + } + } + #endif + static CYTHON_INLINE __pyx_t_float_complex __Pyx_c_neg_float(__pyx_t_float_complex a) { + __pyx_t_float_complex z; + z.real = -a.real; + z.imag = -a.imag; + return z; + } + static CYTHON_INLINE int __Pyx_c_is_zero_float(__pyx_t_float_complex a) { + return (a.real == 0) && (a.imag == 0); + } + static CYTHON_INLINE __pyx_t_float_complex __Pyx_c_conj_float(__pyx_t_float_complex a) { + __pyx_t_float_complex z; + z.real = a.real; + z.imag = -a.imag; + return z; + } + #if 1 + static CYTHON_INLINE float __Pyx_c_abs_float(__pyx_t_float_complex z) { + #if !defined(HAVE_HYPOT) || defined(_MSC_VER) + return sqrtf(z.real*z.real + z.imag*z.imag); + #else + return hypotf(z.real, z.imag); + #endif + } + static CYTHON_INLINE __pyx_t_float_complex __Pyx_c_pow_float(__pyx_t_float_complex a, __pyx_t_float_complex b) { + __pyx_t_float_complex z; + float r, lnr, theta, z_r, z_theta; + if (b.imag == 0 && b.real == (int)b.real) { + if (b.real < 0) { + float denom = a.real * a.real + a.imag * a.imag; + a.real = a.real / denom; + a.imag = -a.imag / denom; + b.real = -b.real; + } + switch ((int)b.real) { + case 0: + z.real = 1; + z.imag = 0; + return z; + case 1: + return a; + case 2: + return __Pyx_c_prod_float(a, a); + case 3: + z = __Pyx_c_prod_float(a, a); + return __Pyx_c_prod_float(z, a); + case 4: + z = __Pyx_c_prod_float(a, a); + return __Pyx_c_prod_float(z, z); + } + } + if (a.imag == 0) { + if (a.real == 0) { + return a; + } else if ((b.imag == 0) && (a.real >= 0)) { + z.real = powf(a.real, b.real); + z.imag = 0; + return z; + } else if (a.real > 0) { + r = a.real; + theta = 0; + } else { + r = -a.real; + theta = atan2f(0.0, -1.0); + } + } else { + r = __Pyx_c_abs_float(a); + theta = atan2f(a.imag, a.real); + } + lnr = logf(r); + z_r = expf(lnr * b.real - theta * b.imag); + z_theta = theta * b.real + lnr * b.imag; + z.real = z_r * cosf(z_theta); + z.imag = z_r * sinf(z_theta); + return z; + } + #endif +#endif + +/* Declarations */ +#if CYTHON_CCOMPLEX && (1) && (!0 || __cplusplus) + #ifdef __cplusplus + static CYTHON_INLINE __pyx_t_double_complex __pyx_t_double_complex_from_parts(double x, double y) { + return ::std::complex< double >(x, y); + } + #else + static CYTHON_INLINE __pyx_t_double_complex __pyx_t_double_complex_from_parts(double x, double y) { + return x + y*(__pyx_t_double_complex)_Complex_I; + } + #endif +#else + static CYTHON_INLINE __pyx_t_double_complex __pyx_t_double_complex_from_parts(double x, double y) { + __pyx_t_double_complex z; + z.real = x; + z.imag = y; + return z; + } +#endif + +/* Arithmetic */ +#if CYTHON_CCOMPLEX && (1) && (!0 || __cplusplus) +#else + static CYTHON_INLINE int __Pyx_c_eq_double(__pyx_t_double_complex a, __pyx_t_double_complex b) { + return (a.real == b.real) && (a.imag == b.imag); + } + static CYTHON_INLINE __pyx_t_double_complex __Pyx_c_sum_double(__pyx_t_double_complex a, __pyx_t_double_complex b) { + __pyx_t_double_complex z; + z.real = a.real + b.real; + z.imag = a.imag + b.imag; + return z; + } + static CYTHON_INLINE __pyx_t_double_complex __Pyx_c_diff_double(__pyx_t_double_complex a, __pyx_t_double_complex b) { + __pyx_t_double_complex z; + z.real = a.real - b.real; + z.imag = a.imag - b.imag; + return z; + } + static CYTHON_INLINE __pyx_t_double_complex __Pyx_c_prod_double(__pyx_t_double_complex a, __pyx_t_double_complex b) { + __pyx_t_double_complex z; + z.real = a.real * b.real - a.imag * b.imag; + z.imag = a.real * b.imag + a.imag * b.real; + return z; + } + #if 1 + static CYTHON_INLINE __pyx_t_double_complex __Pyx_c_quot_double(__pyx_t_double_complex a, __pyx_t_double_complex b) { + if (b.imag == 0) { + return __pyx_t_double_complex_from_parts(a.real / b.real, a.imag / b.real); + } else if (fabs(b.real) >= fabs(b.imag)) { + if (b.real == 0 && b.imag == 0) { + return __pyx_t_double_complex_from_parts(a.real / b.real, a.imag / b.imag); + } else { + double r = b.imag / b.real; + double s = (double)(1.0) / (b.real + b.imag * r); + return __pyx_t_double_complex_from_parts( + (a.real + a.imag * r) * s, (a.imag - a.real * r) * s); + } + } else { + double r = b.real / b.imag; + double s = (double)(1.0) / (b.imag + b.real * r); + return __pyx_t_double_complex_from_parts( + (a.real * r + a.imag) * s, (a.imag * r - a.real) * s); + } + } + #else + static CYTHON_INLINE __pyx_t_double_complex __Pyx_c_quot_double(__pyx_t_double_complex a, __pyx_t_double_complex b) { + if (b.imag == 0) { + return __pyx_t_double_complex_from_parts(a.real / b.real, a.imag / b.real); + } else { + double denom = b.real * b.real + b.imag * b.imag; + return __pyx_t_double_complex_from_parts( + (a.real * b.real + a.imag * b.imag) / denom, + (a.imag * b.real - a.real * b.imag) / denom); + } + } + #endif + static CYTHON_INLINE __pyx_t_double_complex __Pyx_c_neg_double(__pyx_t_double_complex a) { + __pyx_t_double_complex z; + z.real = -a.real; + z.imag = -a.imag; + return z; + } + static CYTHON_INLINE int __Pyx_c_is_zero_double(__pyx_t_double_complex a) { + return (a.real == 0) && (a.imag == 0); + } + static CYTHON_INLINE __pyx_t_double_complex __Pyx_c_conj_double(__pyx_t_double_complex a) { + __pyx_t_double_complex z; + z.real = a.real; + z.imag = -a.imag; + return z; + } + #if 1 + static CYTHON_INLINE double __Pyx_c_abs_double(__pyx_t_double_complex z) { + #if !defined(HAVE_HYPOT) || defined(_MSC_VER) + return sqrt(z.real*z.real + z.imag*z.imag); + #else + return hypot(z.real, z.imag); + #endif + } + static CYTHON_INLINE __pyx_t_double_complex __Pyx_c_pow_double(__pyx_t_double_complex a, __pyx_t_double_complex b) { + __pyx_t_double_complex z; + double r, lnr, theta, z_r, z_theta; + if (b.imag == 0 && b.real == (int)b.real) { + if (b.real < 0) { + double denom = a.real * a.real + a.imag * a.imag; + a.real = a.real / denom; + a.imag = -a.imag / denom; + b.real = -b.real; + } + switch ((int)b.real) { + case 0: + z.real = 1; + z.imag = 0; + return z; + case 1: + return a; + case 2: + return __Pyx_c_prod_double(a, a); + case 3: + z = __Pyx_c_prod_double(a, a); + return __Pyx_c_prod_double(z, a); + case 4: + z = __Pyx_c_prod_double(a, a); + return __Pyx_c_prod_double(z, z); + } + } + if (a.imag == 0) { + if (a.real == 0) { + return a; + } else if ((b.imag == 0) && (a.real >= 0)) { + z.real = pow(a.real, b.real); + z.imag = 0; + return z; + } else if (a.real > 0) { + r = a.real; + theta = 0; + } else { + r = -a.real; + theta = atan2(0.0, -1.0); + } + } else { + r = __Pyx_c_abs_double(a); + theta = atan2(a.imag, a.real); + } + lnr = log(r); + z_r = exp(lnr * b.real - theta * b.imag); + z_theta = theta * b.real + lnr * b.imag; + z.real = z_r * cos(z_theta); + z.imag = z_r * sin(z_theta); + return z; + } + #endif +#endif + +/* Declarations */ +#if CYTHON_CCOMPLEX && (1) && (!0 || __cplusplus) + #ifdef __cplusplus + static CYTHON_INLINE __pyx_t_long_double_complex __pyx_t_long_double_complex_from_parts(long double x, long double y) { + return ::std::complex< long double >(x, y); + } + #else + static CYTHON_INLINE __pyx_t_long_double_complex __pyx_t_long_double_complex_from_parts(long double x, long double y) { + return x + y*(__pyx_t_long_double_complex)_Complex_I; + } + #endif +#else + static CYTHON_INLINE __pyx_t_long_double_complex __pyx_t_long_double_complex_from_parts(long double x, long double y) { + __pyx_t_long_double_complex z; + z.real = x; + z.imag = y; + return z; + } +#endif + +/* Arithmetic */ +#if CYTHON_CCOMPLEX && (1) && (!0 || __cplusplus) +#else + static CYTHON_INLINE int __Pyx_c_eq_long__double(__pyx_t_long_double_complex a, __pyx_t_long_double_complex b) { + return (a.real == b.real) && (a.imag == b.imag); + } + static CYTHON_INLINE __pyx_t_long_double_complex __Pyx_c_sum_long__double(__pyx_t_long_double_complex a, __pyx_t_long_double_complex b) { + __pyx_t_long_double_complex z; + z.real = a.real + b.real; + z.imag = a.imag + b.imag; + return z; + } + static CYTHON_INLINE __pyx_t_long_double_complex __Pyx_c_diff_long__double(__pyx_t_long_double_complex a, __pyx_t_long_double_complex b) { + __pyx_t_long_double_complex z; + z.real = a.real - b.real; + z.imag = a.imag - b.imag; + return z; + } + static CYTHON_INLINE __pyx_t_long_double_complex __Pyx_c_prod_long__double(__pyx_t_long_double_complex a, __pyx_t_long_double_complex b) { + __pyx_t_long_double_complex z; + z.real = a.real * b.real - a.imag * b.imag; + z.imag = a.real * b.imag + a.imag * b.real; + return z; + } + #if 1 + static CYTHON_INLINE __pyx_t_long_double_complex __Pyx_c_quot_long__double(__pyx_t_long_double_complex a, __pyx_t_long_double_complex b) { + if (b.imag == 0) { + return __pyx_t_long_double_complex_from_parts(a.real / b.real, a.imag / b.real); + } else if (fabsl(b.real) >= fabsl(b.imag)) { + if (b.real == 0 && b.imag == 0) { + return __pyx_t_long_double_complex_from_parts(a.real / b.real, a.imag / b.imag); + } else { + long double r = b.imag / b.real; + long double s = (long double)(1.0) / (b.real + b.imag * r); + return __pyx_t_long_double_complex_from_parts( + (a.real + a.imag * r) * s, (a.imag - a.real * r) * s); + } + } else { + long double r = b.real / b.imag; + long double s = (long double)(1.0) / (b.imag + b.real * r); + return __pyx_t_long_double_complex_from_parts( + (a.real * r + a.imag) * s, (a.imag * r - a.real) * s); + } + } + #else + static CYTHON_INLINE __pyx_t_long_double_complex __Pyx_c_quot_long__double(__pyx_t_long_double_complex a, __pyx_t_long_double_complex b) { + if (b.imag == 0) { + return __pyx_t_long_double_complex_from_parts(a.real / b.real, a.imag / b.real); + } else { + long double denom = b.real * b.real + b.imag * b.imag; + return __pyx_t_long_double_complex_from_parts( + (a.real * b.real + a.imag * b.imag) / denom, + (a.imag * b.real - a.real * b.imag) / denom); + } + } + #endif + static CYTHON_INLINE __pyx_t_long_double_complex __Pyx_c_neg_long__double(__pyx_t_long_double_complex a) { + __pyx_t_long_double_complex z; + z.real = -a.real; + z.imag = -a.imag; + return z; + } + static CYTHON_INLINE int __Pyx_c_is_zero_long__double(__pyx_t_long_double_complex a) { + return (a.real == 0) && (a.imag == 0); + } + static CYTHON_INLINE __pyx_t_long_double_complex __Pyx_c_conj_long__double(__pyx_t_long_double_complex a) { + __pyx_t_long_double_complex z; + z.real = a.real; + z.imag = -a.imag; + return z; + } + #if 1 + static CYTHON_INLINE long double __Pyx_c_abs_long__double(__pyx_t_long_double_complex z) { + #if !defined(HAVE_HYPOT) || defined(_MSC_VER) + return sqrtl(z.real*z.real + z.imag*z.imag); + #else + return hypotl(z.real, z.imag); + #endif + } + static CYTHON_INLINE __pyx_t_long_double_complex __Pyx_c_pow_long__double(__pyx_t_long_double_complex a, __pyx_t_long_double_complex b) { + __pyx_t_long_double_complex z; + long double r, lnr, theta, z_r, z_theta; + if (b.imag == 0 && b.real == (int)b.real) { + if (b.real < 0) { + long double denom = a.real * a.real + a.imag * a.imag; + a.real = a.real / denom; + a.imag = -a.imag / denom; + b.real = -b.real; + } + switch ((int)b.real) { + case 0: + z.real = 1; + z.imag = 0; + return z; + case 1: + return a; + case 2: + return __Pyx_c_prod_long__double(a, a); + case 3: + z = __Pyx_c_prod_long__double(a, a); + return __Pyx_c_prod_long__double(z, a); + case 4: + z = __Pyx_c_prod_long__double(a, a); + return __Pyx_c_prod_long__double(z, z); + } + } + if (a.imag == 0) { + if (a.real == 0) { + return a; + } else if ((b.imag == 0) && (a.real >= 0)) { + z.real = powl(a.real, b.real); + z.imag = 0; + return z; + } else if (a.real > 0) { + r = a.real; + theta = 0; + } else { + r = -a.real; + theta = atan2l(0.0, -1.0); + } + } else { + r = __Pyx_c_abs_long__double(a); + theta = atan2l(a.imag, a.real); + } + lnr = logl(r); + z_r = expl(lnr * b.real - theta * b.imag); + z_theta = theta * b.real + lnr * b.imag; + z.real = z_r * cosl(z_theta); + z.imag = z_r * sinl(z_theta); + return z; + } + #endif +#endif + +/* MemviewRefcount */ +#include +#ifndef _Py_NO_RETURN +#define _Py_NO_RETURN +#endif +_Py_NO_RETURN +static void __pyx_fatalerror(const char *fmt, ...) { + va_list vargs; + char msg[200]; +#if PY_VERSION_HEX >= 0x030A0000 || defined(HAVE_STDARG_PROTOTYPES) + va_start(vargs, fmt); +#else + va_start(vargs); +#endif + vsnprintf(msg, 200, fmt, vargs); + va_end(vargs); + Py_FatalError(msg); +} +static CYTHON_INLINE int +__pyx_add_acquisition_count_locked(__pyx_atomic_int_type *acquisition_count, + PyThread_type_lock lock) +{ + int result; + PyThread_acquire_lock(lock, 1); + result = (*acquisition_count)++; + PyThread_release_lock(lock); + return result; +} +static CYTHON_INLINE int +__pyx_sub_acquisition_count_locked(__pyx_atomic_int_type *acquisition_count, + PyThread_type_lock lock) +{ + int result; + PyThread_acquire_lock(lock, 1); + result = (*acquisition_count)--; + PyThread_release_lock(lock); + return result; +} +static CYTHON_INLINE void +__Pyx_INC_MEMVIEW(__Pyx_memviewslice *memslice, int have_gil, int lineno) +{ + __pyx_nonatomic_int_type old_acquisition_count; + struct __pyx_memoryview_obj *memview = memslice->memview; + if (unlikely(!memview || (PyObject *) memview == Py_None)) { + return; + } + old_acquisition_count = __pyx_add_acquisition_count(memview); + if (unlikely(old_acquisition_count <= 0)) { + if (likely(old_acquisition_count == 0)) { + if (have_gil) { + Py_INCREF((PyObject *) memview); + } else { + PyGILState_STATE _gilstate = PyGILState_Ensure(); + Py_INCREF((PyObject *) memview); + PyGILState_Release(_gilstate); + } + } else { + __pyx_fatalerror("Acquisition count is %d (line %d)", + old_acquisition_count+1, lineno); + } + } +} +static CYTHON_INLINE void __Pyx_XCLEAR_MEMVIEW(__Pyx_memviewslice *memslice, + int have_gil, int lineno) { + __pyx_nonatomic_int_type old_acquisition_count; + struct __pyx_memoryview_obj *memview = memslice->memview; + if (unlikely(!memview || (PyObject *) memview == Py_None)) { + memslice->memview = NULL; + return; + } + old_acquisition_count = __pyx_sub_acquisition_count(memview); + memslice->data = NULL; + if (likely(old_acquisition_count > 1)) { + memslice->memview = NULL; + } else if (likely(old_acquisition_count == 1)) { + if (have_gil) { + Py_CLEAR(memslice->memview); + } else { + PyGILState_STATE _gilstate = PyGILState_Ensure(); + Py_CLEAR(memslice->memview); + PyGILState_Release(_gilstate); + } + } else { + __pyx_fatalerror("Acquisition count is %d (line %d)", + old_acquisition_count-1, lineno); + } +} + +/* MemviewSliceIsContig */ +static int +__pyx_memviewslice_is_contig(const __Pyx_memviewslice mvs, char order, int ndim) +{ + int i, index, step, start; + Py_ssize_t itemsize = mvs.memview->view.itemsize; + if (order == 'F') { + step = 1; + start = 0; + } else { + step = -1; + start = ndim - 1; + } + for (i = 0; i < ndim; i++) { + index = start + step * i; + if (mvs.suboffsets[index] >= 0 || mvs.strides[index] != itemsize) + return 0; + itemsize *= mvs.shape[index]; + } + return 1; +} + +/* OverlappingSlices */ +static void +__pyx_get_array_memory_extents(__Pyx_memviewslice *slice, + void **out_start, void **out_end, + int ndim, size_t itemsize) +{ + char *start, *end; + int i; + start = end = slice->data; + for (i = 0; i < ndim; i++) { + Py_ssize_t stride = slice->strides[i]; + Py_ssize_t extent = slice->shape[i]; + if (extent == 0) { + *out_start = *out_end = start; + return; + } else { + if (stride > 0) + end += stride * (extent - 1); + else + start += stride * (extent - 1); + } + } + *out_start = start; + *out_end = end + itemsize; +} +static int +__pyx_slices_overlap(__Pyx_memviewslice *slice1, + __Pyx_memviewslice *slice2, + int ndim, size_t itemsize) +{ + void *start1, *end1, *start2, *end2; + __pyx_get_array_memory_extents(slice1, &start1, &end1, ndim, itemsize); + __pyx_get_array_memory_extents(slice2, &start2, &end2, ndim, itemsize); + return (start1 < end2) && (start2 < end1); +} + +/* MemviewSliceInit */ +static int +__Pyx_init_memviewslice(struct __pyx_memoryview_obj *memview, + int ndim, + __Pyx_memviewslice *memviewslice, + int memview_is_new_reference) +{ + __Pyx_RefNannyDeclarations + int i, retval=-1; + Py_buffer *buf = &memview->view; + __Pyx_RefNannySetupContext("init_memviewslice", 0); + if (unlikely(memviewslice->memview || memviewslice->data)) { + PyErr_SetString(PyExc_ValueError, + "memviewslice is already initialized!"); + goto fail; + } + if (buf->strides) { + for (i = 0; i < ndim; i++) { + memviewslice->strides[i] = buf->strides[i]; + } + } else { + Py_ssize_t stride = buf->itemsize; + for (i = ndim - 1; i >= 0; i--) { + memviewslice->strides[i] = stride; + stride *= buf->shape[i]; + } + } + for (i = 0; i < ndim; i++) { + memviewslice->shape[i] = buf->shape[i]; + if (buf->suboffsets) { + memviewslice->suboffsets[i] = buf->suboffsets[i]; + } else { + memviewslice->suboffsets[i] = -1; + } + } + memviewslice->memview = memview; + memviewslice->data = (char *)buf->buf; + if (__pyx_add_acquisition_count(memview) == 0 && !memview_is_new_reference) { + Py_INCREF((PyObject*)memview); + } + retval = 0; + goto no_fail; +fail: + memviewslice->memview = 0; + memviewslice->data = 0; + retval = -1; +no_fail: + __Pyx_RefNannyFinishContext(); + return retval; +} + +/* 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 uint64_t __Pyx_PyLong_As_uint64_t(PyObject *x) { +#ifdef __Pyx_HAS_GCC_DIAGNOSTIC +#pragma GCC diagnostic push +#pragma GCC diagnostic ignored "-Wconversion" +#endif + const uint64_t neg_one = (uint64_t) -1, const_zero = (uint64_t) 0; +#ifdef __Pyx_HAS_GCC_DIAGNOSTIC +#pragma GCC diagnostic pop +#endif + const int is_unsigned = neg_one > const_zero; + if (unlikely(!PyLong_Check(x))) { + uint64_t val; + PyObject *tmp = __Pyx_PyNumber_Long(x); + if (!tmp) return (uint64_t) -1; + val = __Pyx_PyLong_As_uint64_t(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(uint64_t, __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(uint64_t) > 1 * PyLong_SHIFT)) { + if ((8 * sizeof(unsigned long) > 2 * PyLong_SHIFT)) { + __PYX_VERIFY_RETURN_INT(uint64_t, unsigned long, (((((unsigned long)digits[1]) << PyLong_SHIFT) | (unsigned long)digits[0]))) + } else if ((8 * sizeof(uint64_t) >= 2 * PyLong_SHIFT)) { + return (uint64_t) (((((uint64_t)digits[1]) << PyLong_SHIFT) | (uint64_t)digits[0])); + } + } + break; + case 3: + if ((8 * sizeof(uint64_t) > 2 * PyLong_SHIFT)) { + if ((8 * sizeof(unsigned long) > 3 * PyLong_SHIFT)) { + __PYX_VERIFY_RETURN_INT(uint64_t, unsigned long, (((((((unsigned long)digits[2]) << PyLong_SHIFT) | (unsigned long)digits[1]) << PyLong_SHIFT) | (unsigned long)digits[0]))) + } else if ((8 * sizeof(uint64_t) >= 3 * PyLong_SHIFT)) { + return (uint64_t) (((((((uint64_t)digits[2]) << PyLong_SHIFT) | (uint64_t)digits[1]) << PyLong_SHIFT) | (uint64_t)digits[0])); + } + } + break; + case 4: + if ((8 * sizeof(uint64_t) > 3 * PyLong_SHIFT)) { + if ((8 * sizeof(unsigned long) > 4 * PyLong_SHIFT)) { + __PYX_VERIFY_RETURN_INT(uint64_t, unsigned long, (((((((((unsigned long)digits[3]) << PyLong_SHIFT) | (unsigned long)digits[2]) << PyLong_SHIFT) | (unsigned long)digits[1]) << PyLong_SHIFT) | (unsigned long)digits[0]))) + } else if ((8 * sizeof(uint64_t) >= 4 * PyLong_SHIFT)) { + return (uint64_t) (((((((((uint64_t)digits[3]) << PyLong_SHIFT) | (uint64_t)digits[2]) << PyLong_SHIFT) | (uint64_t)digits[1]) << PyLong_SHIFT) | (uint64_t)digits[0])); + } + } + break; + } + } +#endif +#if CYTHON_COMPILING_IN_CPYTHON && 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 (uint64_t) -1; + if (unlikely(result == 1)) + goto raise_neg_overflow; + } +#endif + if ((sizeof(uint64_t) <= sizeof(unsigned long))) { + __PYX_VERIFY_RETURN_INT_EXC(uint64_t, unsigned long, PyLong_AsUnsignedLong(x)) + } else if ((sizeof(uint64_t) <= sizeof(unsigned PY_LONG_LONG))) { + __PYX_VERIFY_RETURN_INT_EXC(uint64_t, unsigned PY_LONG_LONG, PyLong_AsUnsignedLongLong(x)) + } + } else { +#if CYTHON_USE_PYLONG_INTERNALS + if (__Pyx_PyLong_IsCompact(x)) { + __PYX_VERIFY_RETURN_INT(uint64_t, __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(uint64_t) - 1 > 1 * PyLong_SHIFT)) { + if ((8 * sizeof(unsigned long) > 2 * PyLong_SHIFT)) { + __PYX_VERIFY_RETURN_INT(uint64_t, long, -(long) (((((unsigned long)digits[1]) << PyLong_SHIFT) | (unsigned long)digits[0]))) + } else if ((8 * sizeof(uint64_t) - 1 > 2 * PyLong_SHIFT)) { + return (uint64_t) (((uint64_t)-1)*(((((uint64_t)digits[1]) << PyLong_SHIFT) | (uint64_t)digits[0]))); + } + } + break; + case 2: + if ((8 * sizeof(uint64_t) > 1 * PyLong_SHIFT)) { + if ((8 * sizeof(unsigned long) > 2 * PyLong_SHIFT)) { + __PYX_VERIFY_RETURN_INT(uint64_t, unsigned long, (((((unsigned long)digits[1]) << PyLong_SHIFT) | (unsigned long)digits[0]))) + } else if ((8 * sizeof(uint64_t) - 1 > 2 * PyLong_SHIFT)) { + return (uint64_t) ((((((uint64_t)digits[1]) << PyLong_SHIFT) | (uint64_t)digits[0]))); + } + } + break; + case -3: + if ((8 * sizeof(uint64_t) - 1 > 2 * PyLong_SHIFT)) { + if ((8 * sizeof(unsigned long) > 3 * PyLong_SHIFT)) { + __PYX_VERIFY_RETURN_INT(uint64_t, long, -(long) (((((((unsigned long)digits[2]) << PyLong_SHIFT) | (unsigned long)digits[1]) << PyLong_SHIFT) | (unsigned long)digits[0]))) + } else if ((8 * sizeof(uint64_t) - 1 > 3 * PyLong_SHIFT)) { + return (uint64_t) (((uint64_t)-1)*(((((((uint64_t)digits[2]) << PyLong_SHIFT) | (uint64_t)digits[1]) << PyLong_SHIFT) | (uint64_t)digits[0]))); + } + } + break; + case 3: + if ((8 * sizeof(uint64_t) > 2 * PyLong_SHIFT)) { + if ((8 * sizeof(unsigned long) > 3 * PyLong_SHIFT)) { + __PYX_VERIFY_RETURN_INT(uint64_t, unsigned long, (((((((unsigned long)digits[2]) << PyLong_SHIFT) | (unsigned long)digits[1]) << PyLong_SHIFT) | (unsigned long)digits[0]))) + } else if ((8 * sizeof(uint64_t) - 1 > 3 * PyLong_SHIFT)) { + return (uint64_t) ((((((((uint64_t)digits[2]) << PyLong_SHIFT) | (uint64_t)digits[1]) << PyLong_SHIFT) | (uint64_t)digits[0]))); + } + } + break; + case -4: + if ((8 * sizeof(uint64_t) - 1 > 3 * PyLong_SHIFT)) { + if ((8 * sizeof(unsigned long) > 4 * PyLong_SHIFT)) { + __PYX_VERIFY_RETURN_INT(uint64_t, long, -(long) (((((((((unsigned long)digits[3]) << PyLong_SHIFT) | (unsigned long)digits[2]) << PyLong_SHIFT) | (unsigned long)digits[1]) << PyLong_SHIFT) | (unsigned long)digits[0]))) + } else if ((8 * sizeof(uint64_t) - 1 > 4 * PyLong_SHIFT)) { + return (uint64_t) (((uint64_t)-1)*(((((((((uint64_t)digits[3]) << PyLong_SHIFT) | (uint64_t)digits[2]) << PyLong_SHIFT) | (uint64_t)digits[1]) << PyLong_SHIFT) | (uint64_t)digits[0]))); + } + } + break; + case 4: + if ((8 * sizeof(uint64_t) > 3 * PyLong_SHIFT)) { + if ((8 * sizeof(unsigned long) > 4 * PyLong_SHIFT)) { + __PYX_VERIFY_RETURN_INT(uint64_t, unsigned long, (((((((((unsigned long)digits[3]) << PyLong_SHIFT) | (unsigned long)digits[2]) << PyLong_SHIFT) | (unsigned long)digits[1]) << PyLong_SHIFT) | (unsigned long)digits[0]))) + } else if ((8 * sizeof(uint64_t) - 1 > 4 * PyLong_SHIFT)) { + return (uint64_t) ((((((((((uint64_t)digits[3]) << PyLong_SHIFT) | (uint64_t)digits[2]) << PyLong_SHIFT) | (uint64_t)digits[1]) << PyLong_SHIFT) | (uint64_t)digits[0]))); + } + } + break; + } + } +#endif + if ((sizeof(uint64_t) <= sizeof(long))) { + __PYX_VERIFY_RETURN_INT_EXC(uint64_t, long, PyLong_AsLong(x)) + } else if ((sizeof(uint64_t) <= sizeof(PY_LONG_LONG))) { + __PYX_VERIFY_RETURN_INT_EXC(uint64_t, PY_LONG_LONG, PyLong_AsLongLong(x)) + } + } + { + uint64_t 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 (uint64_t) -1; + assert(PyLong_CheckExact(v)); + } + { + int result = PyObject_RichCompareBool(v, Py_False, Py_LT); + if (unlikely(result < 0)) { + Py_DECREF(v); + return (uint64_t) -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 (uint64_t) -1; + } else { + stepval = v; + } + v = NULL; + val = (uint64_t) 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(uint64_t) * 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 |= ((uint64_t) 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(uint64_t) * 8) - bits - (is_unsigned ? 0 : 1); + if (unlikely(idigit >= (1L << remaining_bits))) + goto raise_overflow; + val |= ((uint64_t) idigit) << bits; + } + if (!is_unsigned) { + if (unlikely(val & (((uint64_t) 1) << (sizeof(uint64_t) * 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 (uint64_t) -1; + return val; + } +raise_overflow: + PyErr_SetString(PyExc_OverflowError, + "value too large to convert to uint64_t"); + return (uint64_t) -1; +raise_neg_overflow: + PyErr_SetString(PyExc_OverflowError, + "can't convert negative value to uint64_t"); + return (uint64_t) -1; +} + +/* 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 + } +} + +/* 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 + } +} + +/* CIntToPy */ +static CYTHON_INLINE PyObject* __Pyx_PyLong_From_uint64_t(uint64_t value) { +#ifdef __Pyx_HAS_GCC_DIAGNOSTIC +#pragma GCC diagnostic push +#pragma GCC diagnostic ignored "-Wconversion" +#endif + const uint64_t neg_one = (uint64_t) -1, const_zero = (uint64_t) 0; +#ifdef __Pyx_HAS_GCC_DIAGNOSTIC +#pragma GCC diagnostic pop +#endif + const int is_unsigned = neg_one > const_zero; + if (is_unsigned) { + if (sizeof(uint64_t) < sizeof(long)) { + return PyLong_FromLong((long) value); + } else if (sizeof(uint64_t) <= sizeof(unsigned long)) { + return PyLong_FromUnsignedLong((unsigned long) value); +#if !CYTHON_COMPILING_IN_PYPY + } else if (sizeof(uint64_t) <= sizeof(unsigned PY_LONG_LONG)) { + return PyLong_FromUnsignedLongLong((unsigned PY_LONG_LONG) value); +#endif + } + } else { + if (sizeof(uint64_t) <= sizeof(long)) { + return PyLong_FromLong((long) value); + } else if (sizeof(uint64_t) <= 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(uint64_t), + 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(uint64_t)); + 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 size_t __Pyx_PyLong_As_size_t(PyObject *x) { +#ifdef __Pyx_HAS_GCC_DIAGNOSTIC +#pragma GCC diagnostic push +#pragma GCC diagnostic ignored "-Wconversion" +#endif + const size_t neg_one = (size_t) -1, const_zero = (size_t) 0; +#ifdef __Pyx_HAS_GCC_DIAGNOSTIC +#pragma GCC diagnostic pop +#endif + const int is_unsigned = neg_one > const_zero; + if (unlikely(!PyLong_Check(x))) { + size_t val; + PyObject *tmp = __Pyx_PyNumber_Long(x); + if (!tmp) return (size_t) -1; + val = __Pyx_PyLong_As_size_t(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(size_t, __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(size_t) > 1 * PyLong_SHIFT)) { + if ((8 * sizeof(unsigned long) > 2 * PyLong_SHIFT)) { + __PYX_VERIFY_RETURN_INT(size_t, unsigned long, (((((unsigned long)digits[1]) << PyLong_SHIFT) | (unsigned long)digits[0]))) + } else if ((8 * sizeof(size_t) >= 2 * PyLong_SHIFT)) { + return (size_t) (((((size_t)digits[1]) << PyLong_SHIFT) | (size_t)digits[0])); + } + } + break; + case 3: + if ((8 * sizeof(size_t) > 2 * PyLong_SHIFT)) { + if ((8 * sizeof(unsigned long) > 3 * PyLong_SHIFT)) { + __PYX_VERIFY_RETURN_INT(size_t, unsigned long, (((((((unsigned long)digits[2]) << PyLong_SHIFT) | (unsigned long)digits[1]) << PyLong_SHIFT) | (unsigned long)digits[0]))) + } else if ((8 * sizeof(size_t) >= 3 * PyLong_SHIFT)) { + return (size_t) (((((((size_t)digits[2]) << PyLong_SHIFT) | (size_t)digits[1]) << PyLong_SHIFT) | (size_t)digits[0])); + } + } + break; + case 4: + if ((8 * sizeof(size_t) > 3 * PyLong_SHIFT)) { + if ((8 * sizeof(unsigned long) > 4 * PyLong_SHIFT)) { + __PYX_VERIFY_RETURN_INT(size_t, unsigned long, (((((((((unsigned long)digits[3]) << PyLong_SHIFT) | (unsigned long)digits[2]) << PyLong_SHIFT) | (unsigned long)digits[1]) << PyLong_SHIFT) | (unsigned long)digits[0]))) + } else if ((8 * sizeof(size_t) >= 4 * PyLong_SHIFT)) { + return (size_t) (((((((((size_t)digits[3]) << PyLong_SHIFT) | (size_t)digits[2]) << PyLong_SHIFT) | (size_t)digits[1]) << PyLong_SHIFT) | (size_t)digits[0])); + } + } + break; + } + } +#endif +#if CYTHON_COMPILING_IN_CPYTHON && 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 (size_t) -1; + if (unlikely(result == 1)) + goto raise_neg_overflow; + } +#endif + if ((sizeof(size_t) <= sizeof(unsigned long))) { + __PYX_VERIFY_RETURN_INT_EXC(size_t, unsigned long, PyLong_AsUnsignedLong(x)) + } else if ((sizeof(size_t) <= sizeof(unsigned PY_LONG_LONG))) { + __PYX_VERIFY_RETURN_INT_EXC(size_t, unsigned PY_LONG_LONG, PyLong_AsUnsignedLongLong(x)) + } + } else { +#if CYTHON_USE_PYLONG_INTERNALS + if (__Pyx_PyLong_IsCompact(x)) { + __PYX_VERIFY_RETURN_INT(size_t, __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(size_t) - 1 > 1 * PyLong_SHIFT)) { + if ((8 * sizeof(unsigned long) > 2 * PyLong_SHIFT)) { + __PYX_VERIFY_RETURN_INT(size_t, long, -(long) (((((unsigned long)digits[1]) << PyLong_SHIFT) | (unsigned long)digits[0]))) + } else if ((8 * sizeof(size_t) - 1 > 2 * PyLong_SHIFT)) { + return (size_t) (((size_t)-1)*(((((size_t)digits[1]) << PyLong_SHIFT) | (size_t)digits[0]))); + } + } + break; + case 2: + if ((8 * sizeof(size_t) > 1 * PyLong_SHIFT)) { + if ((8 * sizeof(unsigned long) > 2 * PyLong_SHIFT)) { + __PYX_VERIFY_RETURN_INT(size_t, unsigned long, (((((unsigned long)digits[1]) << PyLong_SHIFT) | (unsigned long)digits[0]))) + } else if ((8 * sizeof(size_t) - 1 > 2 * PyLong_SHIFT)) { + return (size_t) ((((((size_t)digits[1]) << PyLong_SHIFT) | (size_t)digits[0]))); + } + } + break; + case -3: + if ((8 * sizeof(size_t) - 1 > 2 * PyLong_SHIFT)) { + if ((8 * sizeof(unsigned long) > 3 * PyLong_SHIFT)) { + __PYX_VERIFY_RETURN_INT(size_t, long, -(long) (((((((unsigned long)digits[2]) << PyLong_SHIFT) | (unsigned long)digits[1]) << PyLong_SHIFT) | (unsigned long)digits[0]))) + } else if ((8 * sizeof(size_t) - 1 > 3 * PyLong_SHIFT)) { + return (size_t) (((size_t)-1)*(((((((size_t)digits[2]) << PyLong_SHIFT) | (size_t)digits[1]) << PyLong_SHIFT) | (size_t)digits[0]))); + } + } + break; + case 3: + if ((8 * sizeof(size_t) > 2 * PyLong_SHIFT)) { + if ((8 * sizeof(unsigned long) > 3 * PyLong_SHIFT)) { + __PYX_VERIFY_RETURN_INT(size_t, unsigned long, (((((((unsigned long)digits[2]) << PyLong_SHIFT) | (unsigned long)digits[1]) << PyLong_SHIFT) | (unsigned long)digits[0]))) + } else if ((8 * sizeof(size_t) - 1 > 3 * PyLong_SHIFT)) { + return (size_t) ((((((((size_t)digits[2]) << PyLong_SHIFT) | (size_t)digits[1]) << PyLong_SHIFT) | (size_t)digits[0]))); + } + } + break; + case -4: + if ((8 * sizeof(size_t) - 1 > 3 * PyLong_SHIFT)) { + if ((8 * sizeof(unsigned long) > 4 * PyLong_SHIFT)) { + __PYX_VERIFY_RETURN_INT(size_t, long, -(long) (((((((((unsigned long)digits[3]) << PyLong_SHIFT) | (unsigned long)digits[2]) << PyLong_SHIFT) | (unsigned long)digits[1]) << PyLong_SHIFT) | (unsigned long)digits[0]))) + } else if ((8 * sizeof(size_t) - 1 > 4 * PyLong_SHIFT)) { + return (size_t) (((size_t)-1)*(((((((((size_t)digits[3]) << PyLong_SHIFT) | (size_t)digits[2]) << PyLong_SHIFT) | (size_t)digits[1]) << PyLong_SHIFT) | (size_t)digits[0]))); + } + } + break; + case 4: + if ((8 * sizeof(size_t) > 3 * PyLong_SHIFT)) { + if ((8 * sizeof(unsigned long) > 4 * PyLong_SHIFT)) { + __PYX_VERIFY_RETURN_INT(size_t, unsigned long, (((((((((unsigned long)digits[3]) << PyLong_SHIFT) | (unsigned long)digits[2]) << PyLong_SHIFT) | (unsigned long)digits[1]) << PyLong_SHIFT) | (unsigned long)digits[0]))) + } else if ((8 * sizeof(size_t) - 1 > 4 * PyLong_SHIFT)) { + return (size_t) ((((((((((size_t)digits[3]) << PyLong_SHIFT) | (size_t)digits[2]) << PyLong_SHIFT) | (size_t)digits[1]) << PyLong_SHIFT) | (size_t)digits[0]))); + } + } + break; + } + } +#endif + if ((sizeof(size_t) <= sizeof(long))) { + __PYX_VERIFY_RETURN_INT_EXC(size_t, long, PyLong_AsLong(x)) + } else if ((sizeof(size_t) <= sizeof(PY_LONG_LONG))) { + __PYX_VERIFY_RETURN_INT_EXC(size_t, PY_LONG_LONG, PyLong_AsLongLong(x)) + } + } + { + size_t 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 (size_t) -1; + assert(PyLong_CheckExact(v)); + } + { + int result = PyObject_RichCompareBool(v, Py_False, Py_LT); + if (unlikely(result < 0)) { + Py_DECREF(v); + return (size_t) -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 (size_t) -1; + } else { + stepval = v; + } + v = NULL; + val = (size_t) 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(size_t) * 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 |= ((size_t) 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(size_t) * 8) - bits - (is_unsigned ? 0 : 1); + if (unlikely(idigit >= (1L << remaining_bits))) + goto raise_overflow; + val |= ((size_t) idigit) << bits; + } + if (!is_unsigned) { + if (unlikely(val & (((size_t) 1) << (sizeof(size_t) * 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 (size_t) -1; + return val; + } +raise_overflow: + PyErr_SetString(PyExc_OverflowError, + "value too large to convert to size_t"); + return (size_t) -1; +raise_neg_overflow: + PyErr_SetString(PyExc_OverflowError, + "can't convert negative value to size_t"); + return (size_t) -1; +} + +/* MemviewSliceCopy */ +static __Pyx_memviewslice +__pyx_memoryview_copy_new_contig(const __Pyx_memviewslice *from_mvs, + const char *mode, int ndim, + size_t sizeof_dtype, int contig_flag, + int dtype_is_object) +{ + __Pyx_RefNannyDeclarations + int i; + __Pyx_memviewslice new_mvs = __Pyx_MEMSLICE_INIT; + struct __pyx_memoryview_obj *from_memview = from_mvs->memview; + Py_buffer *buf = &from_memview->view; + PyObject *shape_tuple = NULL; + PyObject *temp_int = NULL; + struct __pyx_array_obj *array_obj = NULL; + struct __pyx_memoryview_obj *memview_obj = NULL; + __Pyx_RefNannySetupContext("__pyx_memoryview_copy_new_contig", 0); + for (i = 0; i < ndim; i++) { + if (unlikely(from_mvs->suboffsets[i] >= 0)) { + PyErr_Format(PyExc_ValueError, "Cannot copy memoryview slice with " + "indirect dimensions (axis %d)", i); + goto fail; + } + } + shape_tuple = PyTuple_New(ndim); + if (unlikely(!shape_tuple)) { + goto fail; + } + __Pyx_GOTREF(shape_tuple); + for(i = 0; i < ndim; i++) { + temp_int = PyLong_FromSsize_t(from_mvs->shape[i]); + if(unlikely(!temp_int)) { + goto fail; + } else { +#if CYTHON_ASSUME_SAFE_MACROS + PyTuple_SET_ITEM(shape_tuple, i, temp_int); +#else + if (PyTuple_SetItem(shape_tuple, i, temp_int) < 0) { + goto fail; + } +#endif + temp_int = NULL; + } + } + array_obj = __pyx_array_new(shape_tuple, sizeof_dtype, buf->format, mode, NULL); + if (unlikely(!array_obj)) { + goto fail; + } + __Pyx_GOTREF(array_obj); + memview_obj = (struct __pyx_memoryview_obj *) __pyx_memoryview_new( + (PyObject *) array_obj, contig_flag, + dtype_is_object, + from_mvs->memview->typeinfo); + if (unlikely(!memview_obj)) + goto fail; + if (unlikely(__Pyx_init_memviewslice(memview_obj, ndim, &new_mvs, 1) < 0)) + goto fail; + if (unlikely(__pyx_memoryview_copy_contents(*from_mvs, new_mvs, ndim, ndim, + dtype_is_object) < 0)) + goto fail; + goto no_fail; +fail: + __Pyx_XDECREF((PyObject *) new_mvs.memview); + new_mvs.memview = NULL; + new_mvs.data = NULL; +no_fail: + __Pyx_XDECREF(shape_tuple); + __Pyx_XDECREF(temp_int); + __Pyx_XDECREF((PyObject *) array_obj); + __Pyx_RefNannyFinishContext(); + return new_mvs; +} + +/* UpdateUnpickledDict */ +static int __Pyx__UpdateUnpickledDict(PyObject *obj, PyObject *state, Py_ssize_t index) { + PyObject *state_dict = __Pyx_PySequence_ITEM(state, index); + if (unlikely(!state_dict)) { + return -1; + } + int non_empty = PyObject_IsTrue(state_dict); + if (non_empty == 0) { + Py_DECREF(state_dict); + return 0; + } else if (unlikely(non_empty == -1)) { + return -1; + } + PyObject *dict; + #if CYTHON_COMPILING_IN_LIMITED_API && __PYX_LIMITED_VERSION_HEX < 0x030A0000 + dict = PyObject_GetAttrString(obj, "__dict__"); + #else + dict = PyObject_GenericGetDict(obj, NULL); + #endif + if (unlikely(!dict)) { + Py_DECREF(state_dict); + return -1; + } + int result; + if (likely(PyDict_CheckExact(dict))) { + result = PyDict_Update(dict, state_dict); + } else { + PyObject *obj_result = __Pyx_PyObject_CallMethod1(dict, __pyx_mstate_global->__pyx_n_u_update, state_dict); + if (likely(obj_result)) { + Py_DECREF(obj_result); + result = 0; + } else { + result = -1; + } + } + Py_DECREF(state_dict); + Py_DECREF(dict); + return result; +} +static int __Pyx_UpdateUnpickledDict(PyObject *obj, PyObject *state, Py_ssize_t index) { + Py_ssize_t state_size = __Pyx_PyTuple_GET_SIZE(state); + #if !CYTHON_ASSUME_SAFE_SIZE + if (unlikely(state_size == -1)) return -1; + #endif + if (state_size <= index) { + return 0; + } + return __Pyx__UpdateUnpickledDict(obj, state, index); +} + +/* CheckUnpickleChecksum */ +static void __Pyx_RaiseUnpickleChecksumError(long checksum, long checksum1, long checksum2, long checksum3, const char *members) { + PyObject *pickle_module = PyImport_ImportModule("pickle"); + if (unlikely(!pickle_module)) return; + PyObject *pickle_error = PyObject_GetAttrString(pickle_module, "PickleError"); + Py_DECREF(pickle_module); + if (unlikely(!pickle_error)) return; + if (checksum2 == checksum1) { + PyErr_Format(pickle_error, "Incompatible checksums (0x%x vs (0x%x) = (%s))", + checksum, checksum1, members); + } else if (checksum3 == checksum2) { + PyErr_Format(pickle_error, "Incompatible checksums (0x%x vs (0x%x, 0x%x) = (%s))", + checksum, checksum1, checksum2, members); + } else { + PyErr_Format(pickle_error, "Incompatible checksums (0x%x vs (0x%x, 0x%x, 0x%x) = (%s))", + checksum, checksum1, checksum2, checksum3, members); + } + Py_DECREF(pickle_error); +} +static int __Pyx_CheckUnpickleChecksum(long checksum, long checksum1, long checksum2, long checksum3, const char *members) { + int found = 0; + found |= checksum1 == checksum; + found |= checksum2 == checksum; + found |= checksum3 == checksum; + if (likely(found)) + return 0; + __Pyx_RaiseUnpickleChecksumError(checksum, checksum1, checksum2, checksum3, members); + return -1; +} + +/* 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 char __Pyx_PyLong_As_char(PyObject *x) { +#ifdef __Pyx_HAS_GCC_DIAGNOSTIC +#pragma GCC diagnostic push +#pragma GCC diagnostic ignored "-Wconversion" +#endif + const char neg_one = (char) -1, const_zero = (char) 0; +#ifdef __Pyx_HAS_GCC_DIAGNOSTIC +#pragma GCC diagnostic pop +#endif + const int is_unsigned = neg_one > const_zero; + if (unlikely(!PyLong_Check(x))) { + char val; + PyObject *tmp = __Pyx_PyNumber_Long(x); + if (!tmp) return (char) -1; + val = __Pyx_PyLong_As_char(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(char, __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(char) > 1 * PyLong_SHIFT)) { + if ((8 * sizeof(unsigned long) > 2 * PyLong_SHIFT)) { + __PYX_VERIFY_RETURN_INT(char, unsigned long, (((((unsigned long)digits[1]) << PyLong_SHIFT) | (unsigned long)digits[0]))) + } else if ((8 * sizeof(char) >= 2 * PyLong_SHIFT)) { + return (char) (((((char)digits[1]) << PyLong_SHIFT) | (char)digits[0])); + } + } + break; + case 3: + if ((8 * sizeof(char) > 2 * PyLong_SHIFT)) { + if ((8 * sizeof(unsigned long) > 3 * PyLong_SHIFT)) { + __PYX_VERIFY_RETURN_INT(char, unsigned long, (((((((unsigned long)digits[2]) << PyLong_SHIFT) | (unsigned long)digits[1]) << PyLong_SHIFT) | (unsigned long)digits[0]))) + } else if ((8 * sizeof(char) >= 3 * PyLong_SHIFT)) { + return (char) (((((((char)digits[2]) << PyLong_SHIFT) | (char)digits[1]) << PyLong_SHIFT) | (char)digits[0])); + } + } + break; + case 4: + if ((8 * sizeof(char) > 3 * PyLong_SHIFT)) { + if ((8 * sizeof(unsigned long) > 4 * PyLong_SHIFT)) { + __PYX_VERIFY_RETURN_INT(char, 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(char) >= 4 * PyLong_SHIFT)) { + return (char) (((((((((char)digits[3]) << PyLong_SHIFT) | (char)digits[2]) << PyLong_SHIFT) | (char)digits[1]) << PyLong_SHIFT) | (char)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 (char) -1; + if (unlikely(result == 1)) + goto raise_neg_overflow; + } +#endif + if ((sizeof(char) <= sizeof(unsigned long))) { + __PYX_VERIFY_RETURN_INT_EXC(char, unsigned long, PyLong_AsUnsignedLong(x)) + } else if ((sizeof(char) <= sizeof(unsigned PY_LONG_LONG))) { + __PYX_VERIFY_RETURN_INT_EXC(char, unsigned PY_LONG_LONG, PyLong_AsUnsignedLongLong(x)) + } + } else { +#if CYTHON_USE_PYLONG_INTERNALS + if (__Pyx_PyLong_IsCompact(x)) { + __PYX_VERIFY_RETURN_INT(char, __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(char) - 1 > 1 * PyLong_SHIFT)) { + if ((8 * sizeof(unsigned long) > 2 * PyLong_SHIFT)) { + __PYX_VERIFY_RETURN_INT(char, long, -(long) (((((unsigned long)digits[1]) << PyLong_SHIFT) | (unsigned long)digits[0]))) + } else if ((8 * sizeof(char) - 1 > 2 * PyLong_SHIFT)) { + return (char) (((char)-1)*(((((char)digits[1]) << PyLong_SHIFT) | (char)digits[0]))); + } + } + break; + case 2: + if ((8 * sizeof(char) > 1 * PyLong_SHIFT)) { + if ((8 * sizeof(unsigned long) > 2 * PyLong_SHIFT)) { + __PYX_VERIFY_RETURN_INT(char, unsigned long, (((((unsigned long)digits[1]) << PyLong_SHIFT) | (unsigned long)digits[0]))) + } else if ((8 * sizeof(char) - 1 > 2 * PyLong_SHIFT)) { + return (char) ((((((char)digits[1]) << PyLong_SHIFT) | (char)digits[0]))); + } + } + break; + case -3: + if ((8 * sizeof(char) - 1 > 2 * PyLong_SHIFT)) { + if ((8 * sizeof(unsigned long) > 3 * PyLong_SHIFT)) { + __PYX_VERIFY_RETURN_INT(char, long, -(long) (((((((unsigned long)digits[2]) << PyLong_SHIFT) | (unsigned long)digits[1]) << PyLong_SHIFT) | (unsigned long)digits[0]))) + } else if ((8 * sizeof(char) - 1 > 3 * PyLong_SHIFT)) { + return (char) (((char)-1)*(((((((char)digits[2]) << PyLong_SHIFT) | (char)digits[1]) << PyLong_SHIFT) | (char)digits[0]))); + } + } + break; + case 3: + if ((8 * sizeof(char) > 2 * PyLong_SHIFT)) { + if ((8 * sizeof(unsigned long) > 3 * PyLong_SHIFT)) { + __PYX_VERIFY_RETURN_INT(char, unsigned long, (((((((unsigned long)digits[2]) << PyLong_SHIFT) | (unsigned long)digits[1]) << PyLong_SHIFT) | (unsigned long)digits[0]))) + } else if ((8 * sizeof(char) - 1 > 3 * PyLong_SHIFT)) { + return (char) ((((((((char)digits[2]) << PyLong_SHIFT) | (char)digits[1]) << PyLong_SHIFT) | (char)digits[0]))); + } + } + break; + case -4: + if ((8 * sizeof(char) - 1 > 3 * PyLong_SHIFT)) { + if ((8 * sizeof(unsigned long) > 4 * PyLong_SHIFT)) { + __PYX_VERIFY_RETURN_INT(char, 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(char) - 1 > 4 * PyLong_SHIFT)) { + return (char) (((char)-1)*(((((((((char)digits[3]) << PyLong_SHIFT) | (char)digits[2]) << PyLong_SHIFT) | (char)digits[1]) << PyLong_SHIFT) | (char)digits[0]))); + } + } + break; + case 4: + if ((8 * sizeof(char) > 3 * PyLong_SHIFT)) { + if ((8 * sizeof(unsigned long) > 4 * PyLong_SHIFT)) { + __PYX_VERIFY_RETURN_INT(char, 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(char) - 1 > 4 * PyLong_SHIFT)) { + return (char) ((((((((((char)digits[3]) << PyLong_SHIFT) | (char)digits[2]) << PyLong_SHIFT) | (char)digits[1]) << PyLong_SHIFT) | (char)digits[0]))); + } + } + break; + } + } +#endif + if ((sizeof(char) <= sizeof(long))) { + __PYX_VERIFY_RETURN_INT_EXC(char, long, PyLong_AsLong(x)) + } else if ((sizeof(char) <= sizeof(PY_LONG_LONG))) { + __PYX_VERIFY_RETURN_INT_EXC(char, PY_LONG_LONG, PyLong_AsLongLong(x)) + } + } + { + char 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 (char) -1; + assert(PyLong_CheckExact(v)); + } + { + int result = PyObject_RichCompareBool(v, Py_False, Py_LT); + if (unlikely(result < 0)) { + Py_DECREF(v); + return (char) -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 (char) -1; + } else { + stepval = v; + } + v = NULL; + val = (char) 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(char) * 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 |= ((char) 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(char) * 8) - bits - (is_unsigned ? 0 : 1); + if (unlikely(idigit >= (1L << remaining_bits))) + goto raise_overflow; + val |= ((char) idigit) << bits; + } + if (!is_unsigned) { + if (unlikely(val & (((char) 1) << (sizeof(char) * 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 (char) -1; + return val; + } +raise_overflow: + PyErr_SetString(PyExc_OverflowError, + "value too large to convert to char"); + return (char) -1; +raise_neg_overflow: + PyErr_SetString(PyExc_OverflowError, + "can't convert negative value to char"); + return (char) -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__8); + } + goto done; +} +#endif + +/* GetRuntimeVersion */ +#if __PYX_LIMITED_VERSION_HEX < 0x030b0000 +void __Pyx_init_runtime_version(void) { + if (__Pyx_cached_runtime_version == 0) { + const char* rt_version = Py_GetVersion(); + unsigned long version = 0; + unsigned long factor = 0x01000000UL; + unsigned int digit = 0; + int i = 0; + while (factor) { + while ('0' <= rt_version[i] && rt_version[i] <= '9') { + digit = digit * 10 + (unsigned int) (rt_version[i] - '0'); + ++i; + } + version += factor * digit; + if (rt_version[i] != '.') + break; + digit = 0; + factor >>= 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, *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)) return NULL; + 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 */ diff --git a/TTS/Kokoro/.venv/Lib/site-packages/spacy/pipeline/_parser_internals/transition_system.pxd b/TTS/Kokoro/.venv/Lib/site-packages/spacy/pipeline/_parser_internals/transition_system.pxd new file mode 100644 index 0000000000000000000000000000000000000000..7bfca12216e2d5f95c43cad8b74cd207b21c8776 --- /dev/null +++ b/TTS/Kokoro/.venv/Lib/site-packages/spacy/pipeline/_parser_internals/transition_system.pxd @@ -0,0 +1,59 @@ +from cymem.cymem cimport Pool + +from ...strings cimport StringStore +from ...structs cimport TokenC +from ...training.example cimport Example +from ...typedefs cimport attr_t, weight_t +from ._state cimport StateC +from .stateclass cimport StateClass + + +cdef struct Transition: + int clas + int move + attr_t label + + weight_t score + + bint (*is_valid)(const StateC* state, attr_t label) noexcept nogil + weight_t (*get_cost)(const StateC* state, const void* gold, attr_t label) noexcept nogil + int (*do)(StateC* state, attr_t label) noexcept nogil + + +ctypedef weight_t (*get_cost_func_t)( + const StateC* state, const void* gold, attr_tlabel +) noexcept nogil +ctypedef weight_t (*move_cost_func_t)( + const StateC* state, const void* gold +) noexcept nogil +ctypedef weight_t (*label_cost_func_t)( + const StateC* state, const void* gold, attr_t label +) noexcept nogil + +ctypedef int (*do_func_t)(StateC* state, attr_t label) noexcept nogil + +ctypedef void* (*init_state_t)(Pool mem, int length, void* tokens) except NULL + +ctypedef int (*del_state_t)(Pool mem, void* state, void* extra_args) except -1 + +cdef class TransitionSystem: + cdef Pool mem + cdef StringStore strings + cdef Transition* c + cdef readonly int n_moves + cdef int _size + cdef public attr_t root_label + cdef public freqs + cdef public object labels + cdef public object cfg + cdef init_state_t init_beam_state + cdef del_state_t del_beam_state + + cdef Transition lookup_transition(self, object name) except * + + cdef Transition init_transition(self, int clas, int move, attr_t label) except * + + cdef int set_valid(self, int* output, const StateC* st) noexcept nogil + + cdef int set_costs(self, int* is_valid, weight_t* costs, + const StateC* state, gold) except -1 diff --git a/TTS/Kokoro/.venv/Lib/site-packages/spacy/pipeline/_parser_internals/transition_system.pyx b/TTS/Kokoro/.venv/Lib/site-packages/spacy/pipeline/_parser_internals/transition_system.pyx new file mode 100644 index 0000000000000000000000000000000000000000..781cc40222a3320381f03fd90e679d4bb41983f9 --- /dev/null +++ b/TTS/Kokoro/.venv/Lib/site-packages/spacy/pipeline/_parser_internals/transition_system.pyx @@ -0,0 +1,251 @@ +# cython: infer_types=True +# cython: profile=False +from __future__ import print_function + +from cymem.cymem cimport Pool + +from collections import Counter + +import srsly + +from ...structs cimport TokenC +from ...typedefs cimport attr_t, weight_t +from .stateclass cimport StateClass + +from ... import util +from ...errors import Errors + + +cdef weight_t MIN_SCORE = -90000 + + +class OracleError(Exception): + pass + + +cdef void* _init_state(Pool mem, int length, void* tokens) except NULL: + cdef StateC* st = new StateC(tokens, length) + return st + + +cdef int _del_state(Pool mem, void* state, void* x) except -1: + cdef StateC* st = state + del st + + +cdef class TransitionSystem: + def __init__( + self, + StringStore string_table, + labels_by_action=None, + min_freq=None, + incorrect_spans_key=None + ): + self.cfg = {"neg_key": incorrect_spans_key} + self.mem = Pool() + self.strings = string_table + self.n_moves = 0 + self._size = 100 + + self.c = self.mem.alloc(self._size, sizeof(Transition)) + + self.labels = {} + if labels_by_action: + self.initialize_actions(labels_by_action, min_freq=min_freq) + self.root_label = self.strings.add('ROOT') + self.init_beam_state = _init_state + self.del_beam_state = _del_state + + def __reduce__(self): + # TODO: This loses the 'cfg' + return (self.__class__, (self.strings, self.labels), None, None) + + @property + def neg_key(self): + return self.cfg.get("neg_key") + + def init_batch(self, docs): + cdef StateClass state + states = [] + offset = 0 + for doc in docs: + state = StateClass(doc, offset=offset) + states.append(state) + offset += len(doc) + return states + + def get_oracle_sequence(self, Example example, _debug=False): + states, golds, _ = self.init_gold_batch([example]) + if not states: + return [] + state = states[0] + gold = golds[0] + if _debug: + return self.get_oracle_sequence_from_state(state, gold, _debug=example) + else: + return self.get_oracle_sequence_from_state(state, gold) + + def get_oracle_sequence_from_state(self, StateClass state, gold, _debug=None): + cdef Pool mem = Pool() + # n_moves should not be zero at this point, but make sure to avoid zero-length mem alloc + assert self.n_moves > 0 + costs = mem.alloc(self.n_moves, sizeof(float)) + is_valid = mem.alloc(self.n_moves, sizeof(int)) + + history = [] + debug_log = [] + while not state.is_final(): + self.set_costs(is_valid, costs, state.c, gold) + for i in range(self.n_moves): + if is_valid[i] and costs[i] <= 0: + action = self.c[i] + history.append(i) + if _debug: + s0 = state.S(0) + b0 = state.B(0) + example = _debug + debug_log.append(" ".join(( + self.get_class_name(i), + "S0=", (example.x[s0].text if s0 >= 0 else "__"), + "B0=", (example.x[b0].text if b0 >= 0 else "__"), + "S0 head?", str(state.has_head(state.S(0))), + ))) + action.do(state.c, action.label) + break + else: + if _debug: + example = _debug + print("Actions") + for i in range(self.n_moves): + print(self.get_class_name(i)) + print("Gold") + for token in example.y: + print(token.text, token.dep_, token.head.text) + s0 = state.S(0) + b0 = state.B(0) + debug_log.append(" ".join(( + "?", + "S0=", (example.x[s0].text if s0 >= 0 else "-"), + "B0=", (example.x[b0].text if b0 >= 0 else "-"), + "S0 head?", str(state.has_head(state.S(0))), + ))) + print("\n".join(debug_log)) + raise ValueError(Errors.E024) + return history + + def apply_transition(self, StateClass state, name): + if not self.is_valid(state, name): + raise ValueError(Errors.E170.format(name=name)) + action = self.lookup_transition(name) + action.do(state.c, action.label) + + cdef Transition lookup_transition(self, object name) except *: + raise NotImplementedError + + cdef Transition init_transition(self, int clas, int move, attr_t label) except *: + raise NotImplementedError + + def is_valid(self, StateClass stcls, move_name): + action = self.lookup_transition(move_name) + return action.is_valid(stcls.c, action.label) + + cdef int set_valid(self, int* is_valid, const StateC* st) noexcept nogil: + cdef int i + for i in range(self.n_moves): + is_valid[i] = self.c[i].is_valid(st, self.c[i].label) + + cdef int set_costs(self, int* is_valid, weight_t* costs, + const StateC* state, gold) except -1: + raise NotImplementedError + + def get_class_name(self, int clas): + act = self.c[clas] + return self.move_name(act.move, act.label) + + def initialize_actions(self, labels_by_action, min_freq=None): + self.labels = {} + self.n_moves = 0 + added_labels = [] + added_actions = {} + for action, label_freqs in sorted(labels_by_action.items()): + action = int(action) + # Make sure we take a copy here, and that we get a Counter + self.labels[action] = Counter() + # Have to be careful here: Sorting must be stable, or our model + # won't be read back in correctly. + sorted_labels = [(f, L) for L, f in label_freqs.items()] + sorted_labels.sort() + sorted_labels.reverse() + for freq, label_str in sorted_labels: + if freq < 0: + added_labels.append((freq, label_str)) + added_actions.setdefault(label_str, []).append(action) + else: + self.add_action(int(action), label_str) + self.labels[action][label_str] = freq + added_labels.sort(reverse=True) + for freq, label_str in added_labels: + for action in added_actions[label_str]: + self.add_action(int(action), label_str) + self.labels[action][label_str] = freq + + def add_action(self, int action, label_name): + cdef attr_t label_id + if not isinstance(label_name, int): + label_id = self.strings.add(label_name) + else: + label_id = label_name + # Check we're not creating a move we already have, so that this is + # idempotent + for trans in self.c[:self.n_moves]: + if trans.move == action and trans.label == label_id: + return 0 + if self.n_moves >= self._size: + self._size *= 2 + self.c = self.mem.realloc(self.c, self._size * sizeof(self.c[0])) + self.c[self.n_moves] = self.init_transition(self.n_moves, action, label_id) + self.n_moves += 1 + # Add the new (action, label) pair, making up a frequency for it if + # necessary. To preserve sort order, the frequency needs to be lower + # than previous frequencies. + if self.labels.get(action, []): + new_freq = min(self.labels[action].values()) + else: + self.labels[action] = Counter() + new_freq = -1 + if new_freq > 0: + new_freq = 0 + self.labels[action][label_name] = new_freq-1 + return 1 + + def to_disk(self, path, **kwargs): + with path.open('wb') as file_: + file_.write(self.to_bytes(**kwargs)) + + def from_disk(self, path, **kwargs): + with path.open('rb') as file_: + byte_data = file_.read() + self.from_bytes(byte_data, **kwargs) + return self + + def to_bytes(self, exclude=tuple()): + serializers = { + 'moves': lambda: srsly.json_dumps(self.labels), + 'strings': lambda: self.strings.to_bytes(), + 'cfg': lambda: self.cfg + } + return util.to_bytes(serializers, exclude) + + def from_bytes(self, bytes_data, exclude=tuple()): + # We're adding a new field, 'cfg', here and we don't want to break + # previous models that don't have it. + msg = srsly.msgpack_loads(bytes_data) + labels = {} + if 'moves' not in exclude: + labels.update(srsly.json_loads(msg['moves'])) + if 'strings' not in exclude: + self.strings.from_bytes(msg['strings']) + if 'cfg' not in exclude and 'cfg' in msg: + self.cfg.update(msg['cfg']) + self.initialize_actions(labels) + return self diff --git a/TTS/Kokoro/.venv/Lib/site-packages/spacy/pipeline/legacy/__init__.py b/TTS/Kokoro/.venv/Lib/site-packages/spacy/pipeline/legacy/__init__.py new file mode 100644 index 0000000000000000000000000000000000000000..127f51b62356415a692764ddd606009ba18f4a82 --- /dev/null +++ b/TTS/Kokoro/.venv/Lib/site-packages/spacy/pipeline/legacy/__init__.py @@ -0,0 +1,3 @@ +from .entity_linker import EntityLinker_v1 + +__all__ = ["EntityLinker_v1"] diff --git a/TTS/Kokoro/.venv/Lib/site-packages/spacy/pipeline/legacy/__pycache__/__init__.cpython-312.pyc b/TTS/Kokoro/.venv/Lib/site-packages/spacy/pipeline/legacy/__pycache__/__init__.cpython-312.pyc new file mode 100644 index 0000000000000000000000000000000000000000..ef0edf429d430183ecb573868f334a8af8c710aa Binary files /dev/null and b/TTS/Kokoro/.venv/Lib/site-packages/spacy/pipeline/legacy/__pycache__/__init__.cpython-312.pyc differ diff --git a/TTS/Kokoro/.venv/Lib/site-packages/spacy/pipeline/legacy/__pycache__/entity_linker.cpython-312.pyc b/TTS/Kokoro/.venv/Lib/site-packages/spacy/pipeline/legacy/__pycache__/entity_linker.cpython-312.pyc new file mode 100644 index 0000000000000000000000000000000000000000..0000fef072c45cc51d2792d99428dba162702961 Binary files /dev/null and b/TTS/Kokoro/.venv/Lib/site-packages/spacy/pipeline/legacy/__pycache__/entity_linker.cpython-312.pyc differ diff --git a/TTS/Kokoro/.venv/Lib/site-packages/spacy/pipeline/legacy/entity_linker.py b/TTS/Kokoro/.venv/Lib/site-packages/spacy/pipeline/legacy/entity_linker.py new file mode 100644 index 0000000000000000000000000000000000000000..7f23541f99a547eed99ea8e86802cede66ce3457 --- /dev/null +++ b/TTS/Kokoro/.venv/Lib/site-packages/spacy/pipeline/legacy/entity_linker.py @@ -0,0 +1,422 @@ +# This file is present to provide a prior version of the EntityLinker component +# for backwards compatability. For details see #9669. + +import random +import warnings +from itertools import islice +from pathlib import Path +from typing import Any, Callable, Dict, Iterable, List, Optional, Union + +import srsly +from thinc.api import CosineDistance, Model, Optimizer, set_dropout_rate +from thinc.types import Floats2d + +from ... import util +from ...errors import Errors, Warnings +from ...kb import Candidate, KnowledgeBase +from ...language import Language +from ...ml import empty_kb +from ...scorer import Scorer +from ...tokens import Doc, Span +from ...training import Example, validate_examples, validate_get_examples +from ...util import SimpleFrozenList +from ...vocab import Vocab +from ..pipe import deserialize_config +from ..trainable_pipe import TrainablePipe + +# See #9050 +BACKWARD_OVERWRITE = True + + +def entity_linker_score(examples, **kwargs): + return Scorer.score_links(examples, negative_labels=[EntityLinker_v1.NIL], **kwargs) + + +class EntityLinker_v1(TrainablePipe): + """Pipeline component for named entity linking. + + DOCS: https://spacy.io/api/entitylinker + """ + + NIL = "NIL" # string used to refer to a non-existing link + + def __init__( + self, + vocab: Vocab, + model: Model, + name: str = "entity_linker", + *, + labels_discard: Iterable[str], + n_sents: int, + incl_prior: bool, + incl_context: bool, + entity_vector_length: int, + get_candidates: Callable[[KnowledgeBase, Span], Iterable[Candidate]], + overwrite: bool = BACKWARD_OVERWRITE, + scorer: Optional[Callable] = entity_linker_score, + ) -> None: + """Initialize an entity linker. + + vocab (Vocab): The shared vocabulary. + model (thinc.api.Model): The Thinc Model powering the pipeline component. + name (str): The component instance name, used to add entries to the + losses during training. + labels_discard (Iterable[str]): NER labels that will automatically get a "NIL" prediction. + n_sents (int): The number of neighbouring sentences to take into account. + incl_prior (bool): Whether or not to include prior probabilities from the KB in the model. + incl_context (bool): Whether or not to include the local context in the model. + entity_vector_length (int): Size of encoding vectors in the KB. + get_candidates (Callable[[KnowledgeBase, Span], Iterable[Candidate]]): Function that + produces a list of candidates, given a certain knowledge base and a textual mention. + scorer (Optional[Callable]): The scoring method. Defaults to Scorer.score_links. + DOCS: https://spacy.io/api/entitylinker#init + """ + self.vocab = vocab + self.model = model + self.name = name + self.labels_discard = list(labels_discard) + self.n_sents = n_sents + self.incl_prior = incl_prior + self.incl_context = incl_context + self.get_candidates = get_candidates + self.cfg: Dict[str, Any] = {"overwrite": overwrite} + self.distance = CosineDistance(normalize=False) + # how many neighbour sentences to take into account + # create an empty KB by default. If you want to load a predefined one, specify it in 'initialize'. + self.kb = empty_kb(entity_vector_length)(self.vocab) + self.scorer = scorer + + def set_kb(self, kb_loader: Callable[[Vocab], KnowledgeBase]): + """Define the KB of this pipe by providing a function that will + create it using this object's vocab.""" + if not callable(kb_loader): + raise ValueError(Errors.E885.format(arg_type=type(kb_loader))) + + self.kb = kb_loader(self.vocab) + + def validate_kb(self) -> None: + # Raise an error if the knowledge base is not initialized. + if self.kb is None: + raise ValueError(Errors.E1018.format(name=self.name)) + if len(self.kb) == 0: + raise ValueError(Errors.E139.format(name=self.name)) + + def initialize( + self, + get_examples: Callable[[], Iterable[Example]], + *, + nlp: Optional[Language] = None, + kb_loader: Optional[Callable[[Vocab], KnowledgeBase]] = None, + ): + """Initialize the pipe for training, using a representative set + of data examples. + + get_examples (Callable[[], Iterable[Example]]): Function that + returns a representative sample of gold-standard Example objects. + nlp (Language): The current nlp object the component is part of. + kb_loader (Callable[[Vocab], KnowledgeBase]): A function that creates an InMemoryLookupKB from a Vocab instance. + Note that providing this argument, will overwrite all data accumulated in the current KB. + Use this only when loading a KB as-such from file. + + DOCS: https://spacy.io/api/entitylinker#initialize + """ + validate_get_examples(get_examples, "EntityLinker_v1.initialize") + if kb_loader is not None: + self.set_kb(kb_loader) + self.validate_kb() + nO = self.kb.entity_vector_length + doc_sample = [] + vector_sample = [] + for example in islice(get_examples(), 10): + doc_sample.append(example.x) + vector_sample.append(self.model.ops.alloc1f(nO)) + assert len(doc_sample) > 0, Errors.E923.format(name=self.name) + assert len(vector_sample) > 0, Errors.E923.format(name=self.name) + self.model.initialize( + X=doc_sample, Y=self.model.ops.asarray(vector_sample, dtype="float32") + ) + + def update( + self, + examples: Iterable[Example], + *, + drop: float = 0.0, + sgd: Optional[Optimizer] = None, + losses: Optional[Dict[str, float]] = None, + ) -> Dict[str, float]: + """Learn from a batch of documents and gold-standard information, + updating the pipe's model. Delegates to predict and get_loss. + + examples (Iterable[Example]): A batch of Example objects. + drop (float): The dropout rate. + sgd (thinc.api.Optimizer): The optimizer. + losses (Dict[str, float]): Optional record of the loss during training. + Updated using the component name as the key. + RETURNS (Dict[str, float]): The updated losses dictionary. + + DOCS: https://spacy.io/api/entitylinker#update + """ + self.validate_kb() + if losses is None: + losses = {} + losses.setdefault(self.name, 0.0) + if not examples: + return losses + validate_examples(examples, "EntityLinker_v1.update") + sentence_docs = [] + for eg in examples: + sentences = [s for s in eg.reference.sents] + kb_ids = eg.get_aligned("ENT_KB_ID", as_string=True) + for ent in eg.reference.ents: + # KB ID of the first token is the same as the whole span + kb_id = kb_ids[ent.start] + if kb_id: + try: + # find the sentence in the list of sentences. + sent_index = sentences.index(ent.sent) + except AttributeError: + # Catch the exception when ent.sent is None and provide a user-friendly warning + raise RuntimeError(Errors.E030) from None + # get n previous sentences, if there are any + start_sentence = max(0, sent_index - self.n_sents) + # get n posterior sentences, or as many < n as there are + end_sentence = min(len(sentences) - 1, sent_index + self.n_sents) + # get token positions + start_token = sentences[start_sentence].start + end_token = sentences[end_sentence].end + # append that span as a doc to training + sent_doc = eg.predicted[start_token:end_token].as_doc() + sentence_docs.append(sent_doc) + set_dropout_rate(self.model, drop) + if not sentence_docs: + warnings.warn(Warnings.W093.format(name="Entity Linker")) + return losses + sentence_encodings, bp_context = self.model.begin_update(sentence_docs) + loss, d_scores = self.get_loss( + sentence_encodings=sentence_encodings, examples=examples + ) + bp_context(d_scores) + if sgd is not None: + self.finish_update(sgd) + losses[self.name] += loss + return losses + + def get_loss(self, examples: Iterable[Example], sentence_encodings: Floats2d): + validate_examples(examples, "EntityLinker_v1.get_loss") + entity_encodings = [] + for eg in examples: + kb_ids = eg.get_aligned("ENT_KB_ID", as_string=True) + for ent in eg.reference.ents: + kb_id = kb_ids[ent.start] + if kb_id: + entity_encoding = self.kb.get_vector(kb_id) + entity_encodings.append(entity_encoding) + entity_encodings = self.model.ops.asarray2f(entity_encodings) + if sentence_encodings.shape != entity_encodings.shape: + err = Errors.E147.format( + method="get_loss", msg="gold entities do not match up" + ) + raise RuntimeError(err) + gradients = self.distance.get_grad(sentence_encodings, entity_encodings) + loss = self.distance.get_loss(sentence_encodings, entity_encodings) + loss = loss / len(entity_encodings) + return float(loss), gradients + + def predict(self, docs: Iterable[Doc]) -> List[str]: + """Apply the pipeline's model to a batch of docs, without modifying them. + Returns the KB IDs for each entity in each doc, including NIL if there is + no prediction. + + docs (Iterable[Doc]): The documents to predict. + RETURNS (List[str]): The models prediction for each document. + + DOCS: https://spacy.io/api/entitylinker#predict + """ + self.validate_kb() + entity_count = 0 + final_kb_ids: List[str] = [] + if not docs: + return final_kb_ids + if isinstance(docs, Doc): + docs = [docs] + for i, doc in enumerate(docs): + sentences = [s for s in doc.sents] + if len(doc) > 0: + # Looping through each entity (TODO: rewrite) + for ent in doc.ents: + sent = ent.sent + sent_index = sentences.index(sent) + assert sent_index >= 0 + # get n_neighbour sentences, clipped to the length of the document + start_sentence = max(0, sent_index - self.n_sents) + end_sentence = min(len(sentences) - 1, sent_index + self.n_sents) + start_token = sentences[start_sentence].start + end_token = sentences[end_sentence].end + sent_doc = doc[start_token:end_token].as_doc() + # currently, the context is the same for each entity in a sentence (should be refined) + xp = self.model.ops.xp + if self.incl_context: + sentence_encoding = self.model.predict([sent_doc])[0] + sentence_encoding_t = sentence_encoding.T + sentence_norm = xp.linalg.norm(sentence_encoding_t) + entity_count += 1 + if ent.label_ in self.labels_discard: + # ignoring this entity - setting to NIL + final_kb_ids.append(self.NIL) + else: + candidates = list(self.get_candidates(self.kb, ent)) + if not candidates: + # no prediction possible for this entity - setting to NIL + final_kb_ids.append(self.NIL) + elif len(candidates) == 1: + # shortcut for efficiency reasons: take the 1 candidate + final_kb_ids.append(candidates[0].entity_) + else: + random.shuffle(candidates) + # set all prior probabilities to 0 if incl_prior=False + prior_probs = xp.asarray([c.prior_prob for c in candidates]) + if not self.incl_prior: + prior_probs = xp.asarray([0.0 for _ in candidates]) + scores = prior_probs + # add in similarity from the context + if self.incl_context: + entity_encodings = xp.asarray( + [c.entity_vector for c in candidates] + ) + entity_norm = xp.linalg.norm(entity_encodings, axis=1) + if len(entity_encodings) != len(prior_probs): + raise RuntimeError( + Errors.E147.format( + method="predict", + msg="vectors not of equal length", + ) + ) + # cosine similarity + sims = xp.dot(entity_encodings, sentence_encoding_t) / ( + sentence_norm * entity_norm + ) + if sims.shape != prior_probs.shape: + raise ValueError(Errors.E161) + scores = prior_probs + sims - (prior_probs * sims) + best_index = scores.argmax().item() + best_candidate = candidates[best_index] + final_kb_ids.append(best_candidate.entity_) + if not (len(final_kb_ids) == entity_count): + err = Errors.E147.format( + method="predict", msg="result variables not of equal length" + ) + raise RuntimeError(err) + return final_kb_ids + + def set_annotations(self, docs: Iterable[Doc], kb_ids: List[str]) -> None: + """Modify a batch of documents, using pre-computed scores. + + docs (Iterable[Doc]): The documents to modify. + kb_ids (List[str]): The IDs to set, produced by EntityLinker.predict. + + DOCS: https://spacy.io/api/entitylinker#set_annotations + """ + count_ents = len([ent for doc in docs for ent in doc.ents]) + if count_ents != len(kb_ids): + raise ValueError(Errors.E148.format(ents=count_ents, ids=len(kb_ids))) + i = 0 + overwrite = self.cfg["overwrite"] + for doc in docs: + for ent in doc.ents: + kb_id = kb_ids[i] + i += 1 + for token in ent: + if token.ent_kb_id == 0 or overwrite: + token.ent_kb_id_ = kb_id + + def to_bytes(self, *, exclude=tuple()): + """Serialize the pipe to a bytestring. + + exclude (Iterable[str]): String names of serialization fields to exclude. + RETURNS (bytes): The serialized object. + + DOCS: https://spacy.io/api/entitylinker#to_bytes + """ + self._validate_serialization_attrs() + serialize = {} + if hasattr(self, "cfg") and self.cfg is not None: + serialize["cfg"] = lambda: srsly.json_dumps(self.cfg) + serialize["vocab"] = lambda: self.vocab.to_bytes(exclude=exclude) + serialize["kb"] = self.kb.to_bytes + serialize["model"] = self.model.to_bytes + return util.to_bytes(serialize, exclude) + + def from_bytes(self, bytes_data, *, exclude=tuple()): + """Load the pipe from a bytestring. + + exclude (Iterable[str]): String names of serialization fields to exclude. + RETURNS (TrainablePipe): The loaded object. + + DOCS: https://spacy.io/api/entitylinker#from_bytes + """ + self._validate_serialization_attrs() + + def load_model(b): + try: + self.model.from_bytes(b) + except AttributeError: + raise ValueError(Errors.E149) from None + + deserialize = {} + if hasattr(self, "cfg") and self.cfg is not None: + deserialize["cfg"] = lambda b: self.cfg.update(srsly.json_loads(b)) + deserialize["vocab"] = lambda b: self.vocab.from_bytes(b, exclude=exclude) + deserialize["kb"] = lambda b: self.kb.from_bytes(b) + deserialize["model"] = load_model + util.from_bytes(bytes_data, deserialize, exclude) + return self + + def to_disk( + self, path: Union[str, Path], *, exclude: Iterable[str] = SimpleFrozenList() + ) -> None: + """Serialize the pipe to disk. + + path (str / Path): Path to a directory. + exclude (Iterable[str]): String names of serialization fields to exclude. + + DOCS: https://spacy.io/api/entitylinker#to_disk + """ + serialize = {} + serialize["vocab"] = lambda p: self.vocab.to_disk(p, exclude=exclude) + serialize["cfg"] = lambda p: srsly.write_json(p, self.cfg) + serialize["kb"] = lambda p: self.kb.to_disk(p) + serialize["model"] = lambda p: self.model.to_disk(p) + util.to_disk(path, serialize, exclude) + + def from_disk( + self, path: Union[str, Path], *, exclude: Iterable[str] = SimpleFrozenList() + ) -> "EntityLinker_v1": + """Load the pipe from disk. Modifies the object in place and returns it. + + path (str / Path): Path to a directory. + exclude (Iterable[str]): String names of serialization fields to exclude. + RETURNS (EntityLinker): The modified EntityLinker object. + + DOCS: https://spacy.io/api/entitylinker#from_disk + """ + + def load_model(p): + try: + with p.open("rb") as infile: + self.model.from_bytes(infile.read()) + except AttributeError: + raise ValueError(Errors.E149) from None + + deserialize: Dict[str, Callable[[Any], Any]] = {} + deserialize["cfg"] = lambda p: self.cfg.update(deserialize_config(p)) + deserialize["vocab"] = lambda p: self.vocab.from_disk(p, exclude=exclude) + deserialize["kb"] = lambda p: self.kb.from_disk(p) + deserialize["model"] = load_model + util.from_disk(path, deserialize, exclude) + return self + + def rehearse(self, examples, *, sgd=None, losses=None, **config): + raise NotImplementedError + + def add_label(self, label): + raise NotImplementedError diff --git a/TTS/Kokoro/.venv/Lib/site-packages/spacy/tests/__pycache__/__init__.cpython-312.pyc b/TTS/Kokoro/.venv/Lib/site-packages/spacy/tests/__pycache__/__init__.cpython-312.pyc new file mode 100644 index 0000000000000000000000000000000000000000..fd84fd0a93457ce9700a22ffaf965afc4837f3de Binary files /dev/null and b/TTS/Kokoro/.venv/Lib/site-packages/spacy/tests/__pycache__/__init__.cpython-312.pyc differ diff --git a/TTS/Kokoro/.venv/Lib/site-packages/spacy/tests/__pycache__/conftest.cpython-312.pyc b/TTS/Kokoro/.venv/Lib/site-packages/spacy/tests/__pycache__/conftest.cpython-312.pyc new file mode 100644 index 0000000000000000000000000000000000000000..9377f7521af1fbeaa4193ded0b0e98d1b98f56fa Binary files /dev/null and b/TTS/Kokoro/.venv/Lib/site-packages/spacy/tests/__pycache__/conftest.cpython-312.pyc differ diff --git a/TTS/Kokoro/.venv/Lib/site-packages/spacy/tests/__pycache__/enable_gpu.cpython-312.pyc b/TTS/Kokoro/.venv/Lib/site-packages/spacy/tests/__pycache__/enable_gpu.cpython-312.pyc new file mode 100644 index 0000000000000000000000000000000000000000..b3f9f3fcf5eebbbc300b24e0e80334937fe94e3b Binary files /dev/null and b/TTS/Kokoro/.venv/Lib/site-packages/spacy/tests/__pycache__/enable_gpu.cpython-312.pyc differ diff --git a/TTS/Kokoro/.venv/Lib/site-packages/spacy/tests/__pycache__/test_architectures.cpython-312.pyc b/TTS/Kokoro/.venv/Lib/site-packages/spacy/tests/__pycache__/test_architectures.cpython-312.pyc new file mode 100644 index 0000000000000000000000000000000000000000..186db356bfb603d070b69419ca3242034e91f682 Binary files /dev/null and b/TTS/Kokoro/.venv/Lib/site-packages/spacy/tests/__pycache__/test_architectures.cpython-312.pyc differ diff --git a/TTS/Kokoro/.venv/Lib/site-packages/spacy/tests/__pycache__/test_cli.cpython-312.pyc b/TTS/Kokoro/.venv/Lib/site-packages/spacy/tests/__pycache__/test_cli.cpython-312.pyc new file mode 100644 index 0000000000000000000000000000000000000000..0ff7678de5f809147b674ed732fb1ee0934abd97 Binary files /dev/null and b/TTS/Kokoro/.venv/Lib/site-packages/spacy/tests/__pycache__/test_cli.cpython-312.pyc differ diff --git a/TTS/Kokoro/.venv/Lib/site-packages/spacy/tests/__pycache__/test_cli_app.cpython-312.pyc b/TTS/Kokoro/.venv/Lib/site-packages/spacy/tests/__pycache__/test_cli_app.cpython-312.pyc new file mode 100644 index 0000000000000000000000000000000000000000..ccbc96e34c8bf8d54c3308c4aa9eba0ebc5bb61d Binary files /dev/null and b/TTS/Kokoro/.venv/Lib/site-packages/spacy/tests/__pycache__/test_cli_app.cpython-312.pyc differ diff --git a/TTS/Kokoro/.venv/Lib/site-packages/spacy/tests/__pycache__/test_displacy.cpython-312.pyc b/TTS/Kokoro/.venv/Lib/site-packages/spacy/tests/__pycache__/test_displacy.cpython-312.pyc new file mode 100644 index 0000000000000000000000000000000000000000..2aceaa88c2178c6b6aeb92c3c6ee52a7e326c0ce Binary files /dev/null and b/TTS/Kokoro/.venv/Lib/site-packages/spacy/tests/__pycache__/test_displacy.cpython-312.pyc differ diff --git a/TTS/Kokoro/.venv/Lib/site-packages/spacy/tests/__pycache__/test_errors.cpython-312.pyc b/TTS/Kokoro/.venv/Lib/site-packages/spacy/tests/__pycache__/test_errors.cpython-312.pyc new file mode 100644 index 0000000000000000000000000000000000000000..41a730ed87354a9a2bbdba352c56e554c0871be4 Binary files /dev/null and b/TTS/Kokoro/.venv/Lib/site-packages/spacy/tests/__pycache__/test_errors.cpython-312.pyc differ diff --git a/TTS/Kokoro/.venv/Lib/site-packages/spacy/tests/__pycache__/test_factory_imports.cpython-312.pyc b/TTS/Kokoro/.venv/Lib/site-packages/spacy/tests/__pycache__/test_factory_imports.cpython-312.pyc new file mode 100644 index 0000000000000000000000000000000000000000..666a2c5a5d8f8c3f0da29e0e952a7f965cc2154c Binary files /dev/null and b/TTS/Kokoro/.venv/Lib/site-packages/spacy/tests/__pycache__/test_factory_imports.cpython-312.pyc differ diff --git a/TTS/Kokoro/.venv/Lib/site-packages/spacy/tests/__pycache__/test_factory_registrations.cpython-312.pyc b/TTS/Kokoro/.venv/Lib/site-packages/spacy/tests/__pycache__/test_factory_registrations.cpython-312.pyc new file mode 100644 index 0000000000000000000000000000000000000000..01833e0717ddada68966c9c8700606535872a3c4 Binary files /dev/null and b/TTS/Kokoro/.venv/Lib/site-packages/spacy/tests/__pycache__/test_factory_registrations.cpython-312.pyc differ diff --git a/TTS/Kokoro/.venv/Lib/site-packages/spacy/tests/__pycache__/test_language.cpython-312.pyc b/TTS/Kokoro/.venv/Lib/site-packages/spacy/tests/__pycache__/test_language.cpython-312.pyc new file mode 100644 index 0000000000000000000000000000000000000000..58f6bad3a8668899dc2de2420c64462f553119d9 Binary files /dev/null and b/TTS/Kokoro/.venv/Lib/site-packages/spacy/tests/__pycache__/test_language.cpython-312.pyc differ diff --git a/TTS/Kokoro/.venv/Lib/site-packages/spacy/tests/__pycache__/test_misc.cpython-312.pyc b/TTS/Kokoro/.venv/Lib/site-packages/spacy/tests/__pycache__/test_misc.cpython-312.pyc new file mode 100644 index 0000000000000000000000000000000000000000..ed85ab5036bb251b6922a646a74dc05e25d7e511 Binary files /dev/null and b/TTS/Kokoro/.venv/Lib/site-packages/spacy/tests/__pycache__/test_misc.cpython-312.pyc differ diff --git a/TTS/Kokoro/.venv/Lib/site-packages/spacy/tests/__pycache__/test_models.cpython-312.pyc b/TTS/Kokoro/.venv/Lib/site-packages/spacy/tests/__pycache__/test_models.cpython-312.pyc new file mode 100644 index 0000000000000000000000000000000000000000..a4ffc7ea0427b8620378278773400b64a56bb139 Binary files /dev/null and b/TTS/Kokoro/.venv/Lib/site-packages/spacy/tests/__pycache__/test_models.cpython-312.pyc differ diff --git a/TTS/Kokoro/.venv/Lib/site-packages/spacy/tests/__pycache__/test_pickles.cpython-312.pyc b/TTS/Kokoro/.venv/Lib/site-packages/spacy/tests/__pycache__/test_pickles.cpython-312.pyc new file mode 100644 index 0000000000000000000000000000000000000000..4053ad1fd777076ae516878168630c0fd5fb7994 Binary files /dev/null and b/TTS/Kokoro/.venv/Lib/site-packages/spacy/tests/__pycache__/test_pickles.cpython-312.pyc differ diff --git a/TTS/Kokoro/.venv/Lib/site-packages/spacy/tests/__pycache__/test_registry_population.cpython-312.pyc b/TTS/Kokoro/.venv/Lib/site-packages/spacy/tests/__pycache__/test_registry_population.cpython-312.pyc new file mode 100644 index 0000000000000000000000000000000000000000..aee35704470643db5fbcf87f6b135a32f11db2fe Binary files /dev/null and b/TTS/Kokoro/.venv/Lib/site-packages/spacy/tests/__pycache__/test_registry_population.cpython-312.pyc differ diff --git a/TTS/Kokoro/.venv/Lib/site-packages/spacy/tests/__pycache__/test_scorer.cpython-312.pyc b/TTS/Kokoro/.venv/Lib/site-packages/spacy/tests/__pycache__/test_scorer.cpython-312.pyc new file mode 100644 index 0000000000000000000000000000000000000000..39f421025eec28366ad919a4a5a53ced613a1d3a Binary files /dev/null and b/TTS/Kokoro/.venv/Lib/site-packages/spacy/tests/__pycache__/test_scorer.cpython-312.pyc differ diff --git a/TTS/Kokoro/.venv/Lib/site-packages/spacy/tests/__pycache__/test_ty.cpython-312.pyc b/TTS/Kokoro/.venv/Lib/site-packages/spacy/tests/__pycache__/test_ty.cpython-312.pyc new file mode 100644 index 0000000000000000000000000000000000000000..e26f6beef7494c1066fc4b71b9e082d9d242f9b2 Binary files /dev/null and b/TTS/Kokoro/.venv/Lib/site-packages/spacy/tests/__pycache__/test_ty.cpython-312.pyc differ diff --git a/TTS/Kokoro/.venv/Lib/site-packages/spacy/tests/__pycache__/tok2vec.cpython-312.pyc b/TTS/Kokoro/.venv/Lib/site-packages/spacy/tests/__pycache__/tok2vec.cpython-312.pyc new file mode 100644 index 0000000000000000000000000000000000000000..52d40edb45fefc091b97e768a2a76ae752fbeaf1 Binary files /dev/null and b/TTS/Kokoro/.venv/Lib/site-packages/spacy/tests/__pycache__/tok2vec.cpython-312.pyc differ diff --git a/TTS/Kokoro/.venv/Lib/site-packages/spacy/tests/__pycache__/util.cpython-312.pyc b/TTS/Kokoro/.venv/Lib/site-packages/spacy/tests/__pycache__/util.cpython-312.pyc new file mode 100644 index 0000000000000000000000000000000000000000..d63154a67ab9aceb4e2533158bc18d282a056b31 Binary files /dev/null and b/TTS/Kokoro/.venv/Lib/site-packages/spacy/tests/__pycache__/util.cpython-312.pyc differ diff --git a/TTS/Kokoro/.venv/Lib/site-packages/spacy/tests/doc/__init__.py b/TTS/Kokoro/.venv/Lib/site-packages/spacy/tests/doc/__init__.py new file mode 100644 index 0000000000000000000000000000000000000000..e69de29bb2d1d6434b8b29ae775ad8c2e48c5391 diff --git a/TTS/Kokoro/.venv/Lib/site-packages/spacy/tests/doc/__pycache__/__init__.cpython-312.pyc b/TTS/Kokoro/.venv/Lib/site-packages/spacy/tests/doc/__pycache__/__init__.cpython-312.pyc new file mode 100644 index 0000000000000000000000000000000000000000..854b0e04c086ac8b92c7e8084931f0b344af088b Binary files /dev/null and b/TTS/Kokoro/.venv/Lib/site-packages/spacy/tests/doc/__pycache__/__init__.cpython-312.pyc differ diff --git a/TTS/Kokoro/.venv/Lib/site-packages/spacy/tests/doc/__pycache__/test_add_entities.cpython-312.pyc b/TTS/Kokoro/.venv/Lib/site-packages/spacy/tests/doc/__pycache__/test_add_entities.cpython-312.pyc new file mode 100644 index 0000000000000000000000000000000000000000..d34445524f9d4913adfd1a5cba53604669f3b1bf Binary files /dev/null and b/TTS/Kokoro/.venv/Lib/site-packages/spacy/tests/doc/__pycache__/test_add_entities.cpython-312.pyc differ diff --git a/TTS/Kokoro/.venv/Lib/site-packages/spacy/tests/doc/__pycache__/test_array.cpython-312.pyc b/TTS/Kokoro/.venv/Lib/site-packages/spacy/tests/doc/__pycache__/test_array.cpython-312.pyc new file mode 100644 index 0000000000000000000000000000000000000000..ee392f2ff2e3e6ee56010236c7fb5e20d22f9d1f Binary files /dev/null and b/TTS/Kokoro/.venv/Lib/site-packages/spacy/tests/doc/__pycache__/test_array.cpython-312.pyc differ diff --git a/TTS/Kokoro/.venv/Lib/site-packages/spacy/tests/doc/__pycache__/test_creation.cpython-312.pyc b/TTS/Kokoro/.venv/Lib/site-packages/spacy/tests/doc/__pycache__/test_creation.cpython-312.pyc new file mode 100644 index 0000000000000000000000000000000000000000..7d236c8c135e8a9c7a404b9b760ac5f7e68a2889 Binary files /dev/null and b/TTS/Kokoro/.venv/Lib/site-packages/spacy/tests/doc/__pycache__/test_creation.cpython-312.pyc differ diff --git a/TTS/Kokoro/.venv/Lib/site-packages/spacy/tests/doc/__pycache__/test_doc_api.cpython-312.pyc b/TTS/Kokoro/.venv/Lib/site-packages/spacy/tests/doc/__pycache__/test_doc_api.cpython-312.pyc new file mode 100644 index 0000000000000000000000000000000000000000..da5c62ac2c3e12b2f34159285bee5917b602629f Binary files /dev/null and b/TTS/Kokoro/.venv/Lib/site-packages/spacy/tests/doc/__pycache__/test_doc_api.cpython-312.pyc differ diff --git a/TTS/Kokoro/.venv/Lib/site-packages/spacy/tests/doc/__pycache__/test_graph.cpython-312.pyc b/TTS/Kokoro/.venv/Lib/site-packages/spacy/tests/doc/__pycache__/test_graph.cpython-312.pyc new file mode 100644 index 0000000000000000000000000000000000000000..b3d6faa41631227deae164cd712045f3cbdaf733 Binary files /dev/null and b/TTS/Kokoro/.venv/Lib/site-packages/spacy/tests/doc/__pycache__/test_graph.cpython-312.pyc differ diff --git a/TTS/Kokoro/.venv/Lib/site-packages/spacy/tests/doc/__pycache__/test_json_doc_conversion.cpython-312.pyc b/TTS/Kokoro/.venv/Lib/site-packages/spacy/tests/doc/__pycache__/test_json_doc_conversion.cpython-312.pyc new file mode 100644 index 0000000000000000000000000000000000000000..38e3ffba5d7f87a752d63fc29230bce19f764303 Binary files /dev/null and b/TTS/Kokoro/.venv/Lib/site-packages/spacy/tests/doc/__pycache__/test_json_doc_conversion.cpython-312.pyc differ diff --git a/TTS/Kokoro/.venv/Lib/site-packages/spacy/tests/doc/__pycache__/test_morphanalysis.cpython-312.pyc b/TTS/Kokoro/.venv/Lib/site-packages/spacy/tests/doc/__pycache__/test_morphanalysis.cpython-312.pyc new file mode 100644 index 0000000000000000000000000000000000000000..410008b7b4165f4a04a6d26f9a02595664a177e4 Binary files /dev/null and b/TTS/Kokoro/.venv/Lib/site-packages/spacy/tests/doc/__pycache__/test_morphanalysis.cpython-312.pyc differ diff --git a/TTS/Kokoro/.venv/Lib/site-packages/spacy/tests/doc/__pycache__/test_pickle_doc.cpython-312.pyc b/TTS/Kokoro/.venv/Lib/site-packages/spacy/tests/doc/__pycache__/test_pickle_doc.cpython-312.pyc new file mode 100644 index 0000000000000000000000000000000000000000..30d907511309e86c8d64cab4566cf84dc7efee67 Binary files /dev/null and b/TTS/Kokoro/.venv/Lib/site-packages/spacy/tests/doc/__pycache__/test_pickle_doc.cpython-312.pyc differ diff --git a/TTS/Kokoro/.venv/Lib/site-packages/spacy/tests/doc/__pycache__/test_retokenize_merge.cpython-312.pyc b/TTS/Kokoro/.venv/Lib/site-packages/spacy/tests/doc/__pycache__/test_retokenize_merge.cpython-312.pyc new file mode 100644 index 0000000000000000000000000000000000000000..808efac98b4d34d5485c3566731969b7b9d2579c Binary files /dev/null and b/TTS/Kokoro/.venv/Lib/site-packages/spacy/tests/doc/__pycache__/test_retokenize_merge.cpython-312.pyc differ diff --git a/TTS/Kokoro/.venv/Lib/site-packages/spacy/tests/doc/__pycache__/test_retokenize_split.cpython-312.pyc b/TTS/Kokoro/.venv/Lib/site-packages/spacy/tests/doc/__pycache__/test_retokenize_split.cpython-312.pyc new file mode 100644 index 0000000000000000000000000000000000000000..c77f5a3ea571589154ed805e5a235f700df19355 Binary files /dev/null and b/TTS/Kokoro/.venv/Lib/site-packages/spacy/tests/doc/__pycache__/test_retokenize_split.cpython-312.pyc differ diff --git a/TTS/Kokoro/.venv/Lib/site-packages/spacy/tests/doc/__pycache__/test_span.cpython-312.pyc b/TTS/Kokoro/.venv/Lib/site-packages/spacy/tests/doc/__pycache__/test_span.cpython-312.pyc new file mode 100644 index 0000000000000000000000000000000000000000..8d7e592073c02061045e5c2455c8859c6bc9b407 Binary files /dev/null and b/TTS/Kokoro/.venv/Lib/site-packages/spacy/tests/doc/__pycache__/test_span.cpython-312.pyc differ diff --git a/TTS/Kokoro/.venv/Lib/site-packages/spacy/tests/doc/__pycache__/test_span_group.cpython-312.pyc b/TTS/Kokoro/.venv/Lib/site-packages/spacy/tests/doc/__pycache__/test_span_group.cpython-312.pyc new file mode 100644 index 0000000000000000000000000000000000000000..daca24f24327c52ae4cdfdd6c9c89e42666bf2ad Binary files /dev/null and b/TTS/Kokoro/.venv/Lib/site-packages/spacy/tests/doc/__pycache__/test_span_group.cpython-312.pyc differ diff --git a/TTS/Kokoro/.venv/Lib/site-packages/spacy/tests/doc/__pycache__/test_token_api.cpython-312.pyc b/TTS/Kokoro/.venv/Lib/site-packages/spacy/tests/doc/__pycache__/test_token_api.cpython-312.pyc new file mode 100644 index 0000000000000000000000000000000000000000..ba0271306a91675c31cdcbcb696d1b584cd60e74 Binary files /dev/null and b/TTS/Kokoro/.venv/Lib/site-packages/spacy/tests/doc/__pycache__/test_token_api.cpython-312.pyc differ diff --git a/TTS/Kokoro/.venv/Lib/site-packages/spacy/tests/doc/__pycache__/test_underscore.cpython-312.pyc b/TTS/Kokoro/.venv/Lib/site-packages/spacy/tests/doc/__pycache__/test_underscore.cpython-312.pyc new file mode 100644 index 0000000000000000000000000000000000000000..845ff48ce0c01c3eef807cee0a43258ec15d6fab Binary files /dev/null and b/TTS/Kokoro/.venv/Lib/site-packages/spacy/tests/doc/__pycache__/test_underscore.cpython-312.pyc differ diff --git a/TTS/Kokoro/.venv/Lib/site-packages/spacy/tests/doc/test_add_entities.py b/TTS/Kokoro/.venv/Lib/site-packages/spacy/tests/doc/test_add_entities.py new file mode 100644 index 0000000000000000000000000000000000000000..80f13e710e6972587d6d1491c36a01773d70620d --- /dev/null +++ b/TTS/Kokoro/.venv/Lib/site-packages/spacy/tests/doc/test_add_entities.py @@ -0,0 +1,57 @@ +import pytest + +from spacy import registry +from spacy.pipeline import EntityRecognizer +from spacy.pipeline.ner import DEFAULT_NER_MODEL +from spacy.tokens import Doc, Span +from spacy.training import Example + + +def _ner_example(ner): + doc = Doc( + ner.vocab, + words=["Joe", "loves", "visiting", "London", "during", "the", "weekend"], + ) + gold = {"entities": [(0, 3, "PERSON"), (19, 25, "LOC")]} + return Example.from_dict(doc, gold) + + +def test_doc_add_entities_set_ents_iob(en_vocab): + text = ["This", "is", "a", "lion"] + doc = Doc(en_vocab, words=text) + cfg = {"model": DEFAULT_NER_MODEL} + model = registry.resolve(cfg, validate=True)["model"] + ner = EntityRecognizer(en_vocab, model) + ner.initialize(lambda: [_ner_example(ner)]) + ner(doc) + + doc.ents = [("ANIMAL", 3, 4)] + assert [w.ent_iob_ for w in doc] == ["O", "O", "O", "B"] + + doc.ents = [("WORD", 0, 2)] + assert [w.ent_iob_ for w in doc] == ["B", "I", "O", "O"] + + +def test_ents_reset(en_vocab): + """Ensure that resetting doc.ents does not change anything""" + text = ["This", "is", "a", "lion"] + doc = Doc(en_vocab, words=text) + cfg = {"model": DEFAULT_NER_MODEL} + model = registry.resolve(cfg, validate=True)["model"] + ner = EntityRecognizer(en_vocab, model) + ner.initialize(lambda: [_ner_example(ner)]) + ner(doc) + orig_iobs = [t.ent_iob_ for t in doc] + doc.ents = list(doc.ents) + assert [t.ent_iob_ for t in doc] == orig_iobs + + +def test_add_overlapping_entities(en_vocab): + text = ["Louisiana", "Office", "of", "Conservation"] + doc = Doc(en_vocab, words=text) + entity = Span(doc, 0, 4, label=391) + doc.ents = [entity] + + new_entity = Span(doc, 0, 1, label=392) + with pytest.raises(ValueError): + doc.ents = list(doc.ents) + [new_entity] diff --git a/TTS/Kokoro/.venv/Lib/site-packages/spacy/tests/doc/test_array.py b/TTS/Kokoro/.venv/Lib/site-packages/spacy/tests/doc/test_array.py new file mode 100644 index 0000000000000000000000000000000000000000..4cf859fccc1d86a49904fbd1e33ebb5d9333d921 --- /dev/null +++ b/TTS/Kokoro/.venv/Lib/site-packages/spacy/tests/doc/test_array.py @@ -0,0 +1,136 @@ +import numpy +import pytest + +from spacy.attrs import DEP, MORPH, ORTH, POS, SHAPE +from spacy.tokens import Doc + + +@pytest.mark.issue(2203) +def test_issue2203(en_vocab): + """Test that lemmas are set correctly in doc.from_array.""" + words = ["I", "'ll", "survive"] + tags = ["PRP", "MD", "VB"] + lemmas = ["-PRON-", "will", "survive"] + tag_ids = [en_vocab.strings.add(tag) for tag in tags] + lemma_ids = [en_vocab.strings.add(lemma) for lemma in lemmas] + doc = Doc(en_vocab, words=words) + # Work around lemma corruption problem and set lemmas after tags + doc.from_array("TAG", numpy.array(tag_ids, dtype="uint64")) + doc.from_array("LEMMA", numpy.array(lemma_ids, dtype="uint64")) + assert [t.tag_ for t in doc] == tags + assert [t.lemma_ for t in doc] == lemmas + # We need to serialize both tag and lemma, since this is what causes the bug + doc_array = doc.to_array(["TAG", "LEMMA"]) + new_doc = Doc(doc.vocab, words=words).from_array(["TAG", "LEMMA"], doc_array) + assert [t.tag_ for t in new_doc] == tags + assert [t.lemma_ for t in new_doc] == lemmas + + +def test_doc_array_attr_of_token(en_vocab): + doc = Doc(en_vocab, words=["An", "example", "sentence"]) + example = doc.vocab["example"] + assert example.orth != example.shape + feats_array = doc.to_array((ORTH, SHAPE)) + assert feats_array[0][0] != feats_array[0][1] + assert feats_array[0][0] != feats_array[0][1] + + +def test_doc_stringy_array_attr_of_token(en_vocab): + doc = Doc(en_vocab, words=["An", "example", "sentence"]) + example = doc.vocab["example"] + assert example.orth != example.shape + feats_array = doc.to_array((ORTH, SHAPE)) + feats_array_stringy = doc.to_array(("ORTH", "SHAPE")) + assert feats_array_stringy[0][0] == feats_array[0][0] + assert feats_array_stringy[0][1] == feats_array[0][1] + + +def test_doc_scalar_attr_of_token(en_vocab): + doc = Doc(en_vocab, words=["An", "example", "sentence"]) + example = doc.vocab["example"] + assert example.orth != example.shape + feats_array = doc.to_array(ORTH) + assert feats_array.shape == (3,) + + +def test_doc_array_tag(en_vocab): + words = ["A", "nice", "sentence", "."] + pos = ["DET", "ADJ", "NOUN", "PUNCT"] + doc = Doc(en_vocab, words=words, pos=pos) + assert doc[0].pos != doc[1].pos != doc[2].pos != doc[3].pos + feats_array = doc.to_array((ORTH, POS)) + assert feats_array[0][1] == doc[0].pos + assert feats_array[1][1] == doc[1].pos + assert feats_array[2][1] == doc[2].pos + assert feats_array[3][1] == doc[3].pos + + +def test_doc_array_morph(en_vocab): + words = ["Eat", "blue", "ham"] + morph = ["Feat=V", "Feat=J", "Feat=N"] + doc = Doc(en_vocab, words=words, morphs=morph) + assert morph[0] == str(doc[0].morph) + assert morph[1] == str(doc[1].morph) + assert morph[2] == str(doc[2].morph) + + feats_array = doc.to_array((ORTH, MORPH)) + assert feats_array[0][1] == doc[0].morph.key + assert feats_array[1][1] == doc[1].morph.key + assert feats_array[2][1] == doc[2].morph.key + + +def test_doc_array_dep(en_vocab): + words = ["A", "nice", "sentence", "."] + deps = ["det", "amod", "ROOT", "punct"] + doc = Doc(en_vocab, words=words, deps=deps) + feats_array = doc.to_array((ORTH, DEP)) + assert feats_array[0][1] == doc[0].dep + assert feats_array[1][1] == doc[1].dep + assert feats_array[2][1] == doc[2].dep + assert feats_array[3][1] == doc[3].dep + + +@pytest.mark.parametrize("attrs", [["ORTH", "SHAPE"], "IS_ALPHA"]) +def test_doc_array_to_from_string_attrs(en_vocab, attrs): + """Test that both Doc.to_array and Doc.from_array accept string attrs, + as well as single attrs and sequences of attrs. + """ + words = ["An", "example", "sentence"] + doc = Doc(en_vocab, words=words) + Doc(en_vocab, words=words).from_array(attrs, doc.to_array(attrs)) + + +def test_doc_array_idx(en_vocab): + """Test that Doc.to_array can retrieve token start indices""" + words = ["An", "example", "sentence"] + offsets = Doc(en_vocab, words=words).to_array("IDX") + assert offsets[0] == 0 + assert offsets[1] == 3 + assert offsets[2] == 11 + + +def test_doc_from_array_heads_in_bounds(en_vocab): + """Test that Doc.from_array doesn't set heads that are out of bounds.""" + words = ["This", "is", "a", "sentence", "."] + doc = Doc(en_vocab, words=words) + for token in doc: + token.head = doc[0] + + # correct + arr = doc.to_array(["HEAD"]) + doc_from_array = Doc(en_vocab, words=words) + doc_from_array.from_array(["HEAD"], arr) + + # head before start + arr = doc.to_array(["HEAD"]) + arr[0] = numpy.int32(-1).astype(numpy.uint64) + doc_from_array = Doc(en_vocab, words=words) + with pytest.raises(ValueError): + doc_from_array.from_array(["HEAD"], arr) + + # head after end + arr = doc.to_array(["HEAD"]) + arr[0] = numpy.int32(5).astype(numpy.uint64) + doc_from_array = Doc(en_vocab, words=words) + with pytest.raises(ValueError): + doc_from_array.from_array(["HEAD"], arr) diff --git a/TTS/Kokoro/.venv/Lib/site-packages/spacy/tests/doc/test_creation.py b/TTS/Kokoro/.venv/Lib/site-packages/spacy/tests/doc/test_creation.py new file mode 100644 index 0000000000000000000000000000000000000000..dc78b4bfbb4b78705bbef236c53fa245f64f6b38 --- /dev/null +++ b/TTS/Kokoro/.venv/Lib/site-packages/spacy/tests/doc/test_creation.py @@ -0,0 +1,80 @@ +import pytest + +from spacy import util +from spacy.tokens import Doc +from spacy.vocab import Vocab + + +@pytest.fixture +def vocab(): + return Vocab() + + +def test_empty_doc(vocab): + doc = Doc(vocab) + assert len(doc) == 0 + + +def test_single_word(vocab): + doc = Doc(vocab, words=["a"]) + assert doc.text == "a " + doc = Doc(vocab, words=["a"], spaces=[False]) + assert doc.text == "a" + + +def test_create_from_words_and_text(vocab): + # no whitespace in words + words = ["'", "dogs", "'", "run"] + text = " 'dogs'\n\nrun " + (words, spaces) = util.get_words_and_spaces(words, text) + doc = Doc(vocab, words=words, spaces=spaces) + assert [t.text for t in doc] == [" ", "'", "dogs", "'", "\n\n", "run", " "] + assert [t.whitespace_ for t in doc] == ["", "", "", "", "", " ", ""] + assert doc.text == text + assert [t.text for t in doc if not t.text.isspace()] == [ + word for word in words if not word.isspace() + ] + + # partial whitespace in words + words = [" ", "'", "dogs", "'", "\n\n", "run", " "] + text = " 'dogs'\n\nrun " + (words, spaces) = util.get_words_and_spaces(words, text) + doc = Doc(vocab, words=words, spaces=spaces) + assert [t.text for t in doc] == [" ", "'", "dogs", "'", "\n\n", "run", " "] + assert [t.whitespace_ for t in doc] == ["", "", "", "", "", " ", ""] + assert doc.text == text + assert [t.text for t in doc if not t.text.isspace()] == [ + word for word in words if not word.isspace() + ] + + # non-standard whitespace tokens + words = [" ", " ", "'", "dogs", "'", "\n\n", "run"] + text = " 'dogs'\n\nrun " + (words, spaces) = util.get_words_and_spaces(words, text) + doc = Doc(vocab, words=words, spaces=spaces) + assert [t.text for t in doc] == [" ", "'", "dogs", "'", "\n\n", "run", " "] + assert [t.whitespace_ for t in doc] == ["", "", "", "", "", " ", ""] + assert doc.text == text + assert [t.text for t in doc if not t.text.isspace()] == [ + word for word in words if not word.isspace() + ] + + # mismatch between words and text + with pytest.raises(ValueError): + words = [" ", " ", "'", "dogs", "'", "\n\n", "run"] + text = " 'dogs'\n\nrun " + (words, spaces) = util.get_words_and_spaces(words + ["away"], text) + + +def test_create_with_heads_and_no_deps(vocab): + words = "I like ginger".split() + heads = list(range(len(words))) + with pytest.raises(ValueError): + Doc(vocab, words=words, heads=heads) + + +def test_create_invalid_pos(vocab): + words = "I like ginger".split() + pos = "QQ ZZ XX".split() + with pytest.raises(ValueError): + Doc(vocab, words=words, pos=pos) diff --git a/TTS/Kokoro/.venv/Lib/site-packages/spacy/tests/doc/test_doc_api.py b/TTS/Kokoro/.venv/Lib/site-packages/spacy/tests/doc/test_doc_api.py new file mode 100644 index 0000000000000000000000000000000000000000..e7091016f028a1054171f51daf09dcfbda0c964d --- /dev/null +++ b/TTS/Kokoro/.venv/Lib/site-packages/spacy/tests/doc/test_doc_api.py @@ -0,0 +1,1003 @@ +import warnings +import weakref + +import numpy +import pytest +from numpy.testing import assert_array_equal +from thinc.api import NumpyOps, get_current_ops + +from spacy.attrs import ( + DEP, + ENT_IOB, + ENT_TYPE, + HEAD, + IS_ALPHA, + MORPH, + POS, + SENT_START, + TAG, +) +from spacy.lang.en import English +from spacy.lang.xx import MultiLanguage +from spacy.language import Language +from spacy.lexeme import Lexeme +from spacy.tokens import Doc, Span, SpanGroup, Token +from spacy.vocab import Vocab + +from .test_underscore import clean_underscore # noqa: F401 + + +def test_doc_api_init(en_vocab): + words = ["a", "b", "c", "d"] + heads = [0, 0, 2, 2] + # set sent_start by sent_starts + doc = Doc(en_vocab, words=words, sent_starts=[True, False, True, False]) + assert [t.is_sent_start for t in doc] == [True, False, True, False] + + # set sent_start by heads + doc = Doc(en_vocab, words=words, heads=heads, deps=["dep"] * 4) + assert [t.is_sent_start for t in doc] == [True, False, True, False] + # heads override sent_starts + doc = Doc( + en_vocab, words=words, sent_starts=[True] * 4, heads=heads, deps=["dep"] * 4 + ) + assert [t.is_sent_start for t in doc] == [True, False, True, False] + + +@pytest.mark.issue(1547) +def test_issue1547(): + """Test that entity labels still match after merging tokens.""" + words = ["\n", "worda", ".", "\n", "wordb", "-", "Biosphere", "2", "-", " \n"] + doc = Doc(Vocab(), words=words) + doc.ents = [Span(doc, 6, 8, label=doc.vocab.strings["PRODUCT"])] + with doc.retokenize() as retokenizer: + retokenizer.merge(doc[5:7]) + assert [ent.text for ent in doc.ents] + + +@pytest.mark.issue(1757) +def test_issue1757(): + """Test comparison against None doesn't cause segfault.""" + doc = Doc(Vocab(), words=["a", "b", "c"]) + assert not doc[0] < None + assert not doc[0] is None + assert doc[0] >= None + assert not doc[:2] < None + assert not doc[:2] is None + assert doc[:2] >= None + assert not doc.vocab["a"] is None + assert not doc.vocab["a"] < None + + +@pytest.mark.issue(2396) +def test_issue2396(en_vocab): + words = ["She", "created", "a", "test", "for", "spacy"] + heads = [1, 1, 3, 1, 3, 4] + deps = ["dep"] * len(heads) + matrix = numpy.array( + [ + [0, 1, 1, 1, 1, 1], + [1, 1, 1, 1, 1, 1], + [1, 1, 2, 3, 3, 3], + [1, 1, 3, 3, 3, 3], + [1, 1, 3, 3, 4, 4], + [1, 1, 3, 3, 4, 5], + ], + dtype=numpy.int32, + ) + doc = Doc(en_vocab, words=words, heads=heads, deps=deps) + span = doc[:] + assert (doc.get_lca_matrix() == matrix).all() + assert (span.get_lca_matrix() == matrix).all() + + +@pytest.mark.issue(11499) +def test_init_args_unmodified(en_vocab): + words = ["A", "sentence"] + ents = ["B-TYPE1", ""] + sent_starts = [True, False] + Doc( + vocab=en_vocab, + words=words, + ents=ents, + sent_starts=sent_starts, + ) + assert ents == ["B-TYPE1", ""] + assert sent_starts == [True, False] + + +@pytest.mark.parametrize("text", ["-0.23", "+123,456", "±1"]) +@pytest.mark.parametrize("lang_cls", [English, MultiLanguage]) +@pytest.mark.issue(2782) +def test_issue2782(text, lang_cls): + """Check that like_num handles + and - before number.""" + nlp = lang_cls() + doc = nlp(text) + assert len(doc) == 1 + assert doc[0].like_num + + +@pytest.mark.parametrize( + "sentence", + [ + "The story was to the effect that a young American student recently called on Professor Christlieb with a letter of introduction.", + "The next month Barry Siddall joined Stoke City on a free transfer, after Chris Pearce had established himself as the Vale's #1.", + "The next month Barry Siddall joined Stoke City on a free transfer, after Chris Pearce had established himself as the Vale's number one", + "Indeed, making the one who remains do all the work has installed him into a position of such insolent tyranny, it will take a month at least to reduce him to his proper proportions.", + "It was a missed assignment, but it shouldn't have resulted in a turnover ...", + ], +) +@pytest.mark.issue(3869) +def test_issue3869(sentence): + """Test that the Doc's count_by function works consistently""" + nlp = English() + doc = nlp(sentence) + count = 0 + for token in doc: + count += token.is_alpha + assert count == doc.count_by(IS_ALPHA).get(1, 0) + + +@pytest.mark.issue(3962) +def test_issue3962(en_vocab): + """Ensure that as_doc does not result in out-of-bound access of tokens. + This is achieved by setting the head to itself if it would lie out of the span otherwise. + """ + # fmt: off + words = ["He", "jests", "at", "scars", ",", "that", "never", "felt", "a", "wound", "."] + heads = [1, 7, 1, 2, 7, 7, 7, 7, 9, 7, 7] + deps = ["nsubj", "ccomp", "prep", "pobj", "punct", "nsubj", "neg", "ROOT", "det", "dobj", "punct"] + # fmt: on + doc = Doc(en_vocab, words=words, heads=heads, deps=deps) + span2 = doc[1:5] # "jests at scars ," + doc2 = span2.as_doc() + doc2_json = doc2.to_json() + assert doc2_json + # head set to itself, being the new artificial root + assert doc2[0].head.text == "jests" + assert doc2[0].dep_ == "dep" + assert doc2[1].head.text == "jests" + assert doc2[1].dep_ == "prep" + assert doc2[2].head.text == "at" + assert doc2[2].dep_ == "pobj" + assert doc2[3].head.text == "jests" # head set to the new artificial root + assert doc2[3].dep_ == "dep" + # We should still have 1 sentence + assert len(list(doc2.sents)) == 1 + span3 = doc[6:9] # "never felt a" + doc3 = span3.as_doc() + doc3_json = doc3.to_json() + assert doc3_json + assert doc3[0].head.text == "felt" + assert doc3[0].dep_ == "neg" + assert doc3[1].head.text == "felt" + assert doc3[1].dep_ == "ROOT" + assert doc3[2].head.text == "felt" # head set to ancestor + assert doc3[2].dep_ == "dep" + # We should still have 1 sentence as "a" can be attached to "felt" instead of "wound" + assert len(list(doc3.sents)) == 1 + + +@pytest.mark.issue(3962) +def test_issue3962_long(en_vocab): + """Ensure that as_doc does not result in out-of-bound access of tokens. + This is achieved by setting the head to itself if it would lie out of the span otherwise. + """ + # fmt: off + words = ["He", "jests", "at", "scars", ".", "They", "never", "felt", "a", "wound", "."] + heads = [1, 1, 1, 2, 1, 7, 7, 7, 9, 7, 7] + deps = ["nsubj", "ROOT", "prep", "pobj", "punct", "nsubj", "neg", "ROOT", "det", "dobj", "punct"] + # fmt: on + two_sent_doc = Doc(en_vocab, words=words, heads=heads, deps=deps) + span2 = two_sent_doc[1:7] # "jests at scars. They never" + doc2 = span2.as_doc() + doc2_json = doc2.to_json() + assert doc2_json + # head set to itself, being the new artificial root (in sentence 1) + assert doc2[0].head.text == "jests" + assert doc2[0].dep_ == "ROOT" + assert doc2[1].head.text == "jests" + assert doc2[1].dep_ == "prep" + assert doc2[2].head.text == "at" + assert doc2[2].dep_ == "pobj" + assert doc2[3].head.text == "jests" + assert doc2[3].dep_ == "punct" + # head set to itself, being the new artificial root (in sentence 2) + assert doc2[4].head.text == "They" + assert doc2[4].dep_ == "dep" + # head set to the new artificial head (in sentence 2) + assert doc2[4].head.text == "They" + assert doc2[4].dep_ == "dep" + # We should still have 2 sentences + sents = list(doc2.sents) + assert len(sents) == 2 + assert sents[0].text == "jests at scars ." + assert sents[1].text == "They never" + + +@Language.factory("my_pipe") +class CustomPipe: + def __init__(self, nlp, name="my_pipe"): + self.name = name + Span.set_extension("my_ext", getter=self._get_my_ext) + Doc.set_extension("my_ext", default=None) + + def __call__(self, doc): + gathered_ext = [] + for sent in doc.sents: + sent_ext = self._get_my_ext(sent) + sent._.set("my_ext", sent_ext) + gathered_ext.append(sent_ext) + + doc._.set("my_ext", "\n".join(gathered_ext)) + return doc + + @staticmethod + def _get_my_ext(span): + return str(span.end) + + +@pytest.mark.issue(4903) +def test_issue4903(): + """Ensure that this runs correctly and doesn't hang or crash on Windows / + macOS.""" + nlp = English() + nlp.add_pipe("sentencizer") + nlp.add_pipe("my_pipe", after="sentencizer") + text = ["I like bananas.", "Do you like them?", "No, I prefer wasabi."] + if isinstance(get_current_ops(), NumpyOps): + docs = list(nlp.pipe(text, n_process=2)) + assert docs[0].text == "I like bananas." + assert docs[1].text == "Do you like them?" + assert docs[2].text == "No, I prefer wasabi." + + +@pytest.mark.issue(5048) +def test_issue5048(en_vocab): + words = ["This", "is", "a", "sentence"] + pos_s = ["DET", "VERB", "DET", "NOUN"] + spaces = [" ", " ", " ", ""] + deps_s = ["dep", "adj", "nn", "atm"] + tags_s = ["DT", "VBZ", "DT", "NN"] + strings = en_vocab.strings + for w in words: + strings.add(w) + deps = [strings.add(d) for d in deps_s] + pos = [strings.add(p) for p in pos_s] + tags = [strings.add(t) for t in tags_s] + attrs = [POS, DEP, TAG] + array = numpy.array(list(zip(pos, deps, tags)), dtype="uint64") + doc = Doc(en_vocab, words=words, spaces=spaces) + doc.from_array(attrs, array) + v1 = [(token.text, token.pos_, token.tag_) for token in doc] + doc2 = Doc(en_vocab, words=words, pos=pos_s, deps=deps_s, tags=tags_s) + v2 = [(token.text, token.pos_, token.tag_) for token in doc2] + assert v1 == v2 + + +@pytest.mark.parametrize("text", [["one", "two", "three"]]) +def test_doc_api_compare_by_string_position(en_vocab, text): + doc = Doc(en_vocab, words=text) + # Get the tokens in this order, so their ID ordering doesn't match the idx + token3 = doc[-1] + token2 = doc[-2] + token1 = doc[-1] + token1, token2, token3 = doc + assert token1 < token2 < token3 + assert not token1 > token2 + assert token2 > token1 + assert token2 <= token3 + assert token3 >= token1 + + +def test_doc_api_getitem(en_tokenizer): + text = "Give it back! He pleaded." + tokens = en_tokenizer(text) + assert tokens[0].text == "Give" + assert tokens[-1].text == "." + with pytest.raises(IndexError): + tokens[len(tokens)] + + def to_str(span): + return "/".join(token.text for token in span) + + span = tokens[1:1] + assert not to_str(span) + span = tokens[1:4] + assert to_str(span) == "it/back/!" + span = tokens[1:4:1] + assert to_str(span) == "it/back/!" + with pytest.raises(ValueError): + tokens[1:4:2] + with pytest.raises(ValueError): + tokens[1:4:-1] + + span = tokens[-3:6] + assert to_str(span) == "He/pleaded" + span = tokens[4:-1] + assert to_str(span) == "He/pleaded" + span = tokens[-5:-3] + assert to_str(span) == "back/!" + span = tokens[5:4] + assert span.start == span.end == 5 and not to_str(span) + span = tokens[4:-3] + assert span.start == span.end == 4 and not to_str(span) + + span = tokens[:] + assert to_str(span) == "Give/it/back/!/He/pleaded/." + span = tokens[4:] + assert to_str(span) == "He/pleaded/." + span = tokens[:4] + assert to_str(span) == "Give/it/back/!" + span = tokens[:-3] + assert to_str(span) == "Give/it/back/!" + span = tokens[-3:] + assert to_str(span) == "He/pleaded/." + + span = tokens[4:50] + assert to_str(span) == "He/pleaded/." + span = tokens[-50:4] + assert to_str(span) == "Give/it/back/!" + span = tokens[-50:-40] + assert span.start == span.end == 0 and not to_str(span) + span = tokens[40:50] + assert span.start == span.end == 7 and not to_str(span) + + span = tokens[1:4] + assert span[0].orth_ == "it" + subspan = span[:] + assert to_str(subspan) == "it/back/!" + subspan = span[:2] + assert to_str(subspan) == "it/back" + subspan = span[1:] + assert to_str(subspan) == "back/!" + subspan = span[:-1] + assert to_str(subspan) == "it/back" + subspan = span[-2:] + assert to_str(subspan) == "back/!" + subspan = span[1:2] + assert to_str(subspan) == "back" + subspan = span[-2:-1] + assert to_str(subspan) == "back" + subspan = span[-50:50] + assert to_str(subspan) == "it/back/!" + subspan = span[50:-50] + assert subspan.start == subspan.end == 4 and not to_str(subspan) + + +@pytest.mark.parametrize( + "text", ["Give it back! He pleaded.", " Give it back! He pleaded. "] +) +def test_doc_api_serialize(en_tokenizer, text): + tokens = en_tokenizer(text) + tokens[0].lemma_ = "lemma" + tokens[0].norm_ = "norm" + tokens.ents = [(tokens.vocab.strings["PRODUCT"], 0, 1)] + tokens[0].ent_kb_id_ = "ent_kb_id" + tokens[0].ent_id_ = "ent_id" + new_tokens = Doc(tokens.vocab).from_bytes(tokens.to_bytes()) + assert tokens.text == new_tokens.text + assert [t.text for t in tokens] == [t.text for t in new_tokens] + assert [t.orth for t in tokens] == [t.orth for t in new_tokens] + assert new_tokens[0].lemma_ == "lemma" + assert new_tokens[0].norm_ == "norm" + assert new_tokens[0].ent_kb_id_ == "ent_kb_id" + assert new_tokens[0].ent_id_ == "ent_id" + + new_tokens = Doc(tokens.vocab).from_bytes( + tokens.to_bytes(exclude=["tensor"]), exclude=["tensor"] + ) + assert tokens.text == new_tokens.text + assert [t.text for t in tokens] == [t.text for t in new_tokens] + assert [t.orth for t in tokens] == [t.orth for t in new_tokens] + + new_tokens = Doc(tokens.vocab).from_bytes( + tokens.to_bytes(exclude=["sentiment"]), exclude=["sentiment"] + ) + assert tokens.text == new_tokens.text + assert [t.text for t in tokens] == [t.text for t in new_tokens] + assert [t.orth for t in tokens] == [t.orth for t in new_tokens] + + def inner_func(d1, d2): + return "hello!" + + _ = tokens.to_bytes() # noqa: F841 + with pytest.warns(UserWarning): + tokens.user_hooks["similarity"] = inner_func + _ = tokens.to_bytes() # noqa: F841 + + +def test_doc_api_set_ents(en_tokenizer): + text = "I use goggle chrone to surf the web" + tokens = en_tokenizer(text) + assert len(tokens.ents) == 0 + tokens.ents = [(tokens.vocab.strings["PRODUCT"], 2, 4)] + assert len(list(tokens.ents)) == 1 + assert [t.ent_iob for t in tokens] == [2, 2, 3, 1, 2, 2, 2, 2] + assert tokens.ents[0].label_ == "PRODUCT" + assert tokens.ents[0].start == 2 + assert tokens.ents[0].end == 4 + + +def test_doc_api_sents_empty_string(en_tokenizer): + doc = en_tokenizer("") + sents = list(doc.sents) + assert len(sents) == 0 + + +def test_doc_api_runtime_error(en_tokenizer): + # Example that caused run-time error while parsing Reddit + # fmt: off + text = "67% of black households are single parent \n\n72% of all black babies born out of wedlock \n\n50% of all black kids don\u2019t finish high school" + deps = ["nummod", "nsubj", "prep", "amod", "pobj", "ROOT", "amod", "attr", "", "nummod", "appos", "prep", "det", + "amod", "pobj", "acl", "prep", "prep", "pobj", + "", "nummod", "nsubj", "prep", "det", "amod", "pobj", "aux", "neg", "ccomp", "amod", "dobj"] + # fmt: on + tokens = en_tokenizer(text) + doc = Doc(tokens.vocab, words=[t.text for t in tokens], deps=deps) + nps = [] + for np in doc.noun_chunks: + while len(np) > 1 and np[0].dep_ not in ("advmod", "amod", "compound"): + np = np[1:] + if len(np) > 1: + nps.append(np) + with doc.retokenize() as retokenizer: + for np in nps: + attrs = { + "tag": np.root.tag_, + "lemma": np.text, + "ent_type": np.root.ent_type_, + } + retokenizer.merge(np, attrs=attrs) + + +def test_doc_api_right_edge(en_vocab): + """Test for bug occurring from Unshift action, causing incorrect right edge""" + # fmt: off + words = [ + "I", "have", "proposed", "to", "myself", ",", "for", "the", "sake", + "of", "such", "as", "live", "under", "the", "government", "of", "the", + "Romans", ",", "to", "translate", "those", "books", "into", "the", + "Greek", "tongue", "." + ] + heads = [2, 2, 2, 2, 3, 2, 21, 8, 6, 8, 11, 8, 11, 12, 15, 13, 15, 18, 16, 12, 21, 2, 23, 21, 21, 27, 27, 24, 2] + deps = ["dep"] * len(heads) + # fmt: on + doc = Doc(en_vocab, words=words, heads=heads, deps=deps) + assert doc[6].text == "for" + subtree = [w.text for w in doc[6].subtree] + # fmt: off + assert subtree == ["for", "the", "sake", "of", "such", "as", "live", "under", "the", "government", "of", "the", "Romans", ","] + # fmt: on + assert doc[6].right_edge.text == "," + + +def test_doc_api_has_vector(): + vocab = Vocab() + vocab.reset_vectors(width=2) + vocab.set_vector("kitten", vector=numpy.asarray([0.0, 2.0], dtype="f")) + doc = Doc(vocab, words=["kitten"]) + assert doc.has_vector + + +def test_doc_api_similarity_match(): + doc = Doc(Vocab(), words=["a"]) + assert doc.similarity(doc[0]) == 1.0 + assert doc.similarity(doc.vocab["a"]) == 1.0 + doc2 = Doc(doc.vocab, words=["a", "b", "c"]) + with pytest.warns(UserWarning): + assert doc.similarity(doc2[:1]) == 1.0 + assert doc.similarity(doc2) == 0.0 + + +@pytest.mark.parametrize( + "words,heads,lca_matrix", + [ + ( + ["the", "lazy", "dog", "slept"], + [2, 2, 3, 3], + numpy.array([[0, 2, 2, 3], [2, 1, 2, 3], [2, 2, 2, 3], [3, 3, 3, 3]]), + ), + ( + ["The", "lazy", "dog", "slept", ".", "The", "quick", "fox", "jumped"], + [2, 2, 3, 3, 3, 7, 7, 8, 8], + numpy.array( + [ + [0, 2, 2, 3, 3, -1, -1, -1, -1], + [2, 1, 2, 3, 3, -1, -1, -1, -1], + [2, 2, 2, 3, 3, -1, -1, -1, -1], + [3, 3, 3, 3, 3, -1, -1, -1, -1], + [3, 3, 3, 3, 4, -1, -1, -1, -1], + [-1, -1, -1, -1, -1, 5, 7, 7, 8], + [-1, -1, -1, -1, -1, 7, 6, 7, 8], + [-1, -1, -1, -1, -1, 7, 7, 7, 8], + [-1, -1, -1, -1, -1, 8, 8, 8, 8], + ] + ), + ), + ], +) +def test_lowest_common_ancestor(en_vocab, words, heads, lca_matrix): + doc = Doc(en_vocab, words, heads=heads, deps=["dep"] * len(heads)) + lca = doc.get_lca_matrix() + assert (lca == lca_matrix).all() + assert lca[1, 1] == 1 + assert lca[0, 1] == 2 + assert lca[1, 2] == 2 + + +def test_doc_is_nered(en_vocab): + words = ["I", "live", "in", "New", "York"] + doc = Doc(en_vocab, words=words) + assert not doc.has_annotation("ENT_IOB") + doc.ents = [Span(doc, 3, 5, label="GPE")] + assert doc.has_annotation("ENT_IOB") + # Test creating doc from array with unknown values + arr = numpy.array([[0, 0], [0, 0], [0, 0], [384, 3], [384, 1]], dtype="uint64") + doc = Doc(en_vocab, words=words).from_array([ENT_TYPE, ENT_IOB], arr) + assert doc.has_annotation("ENT_IOB") + # Test serialization + new_doc = Doc(en_vocab).from_bytes(doc.to_bytes()) + assert new_doc.has_annotation("ENT_IOB") + + +def test_doc_from_array_sent_starts(en_vocab): + # fmt: off + words = ["I", "live", "in", "New", "York", ".", "I", "like", "cats", "."] + heads = [0, 0, 0, 0, 0, 0, 6, 6, 6, 6] + deps = ["ROOT", "dep", "dep", "dep", "dep", "dep", "ROOT", "dep", "dep", "dep"] + # fmt: on + doc = Doc(en_vocab, words=words, heads=heads, deps=deps) + # HEAD overrides SENT_START without warning + attrs = [SENT_START, HEAD] + arr = doc.to_array(attrs) + new_doc = Doc(en_vocab, words=words) + new_doc.from_array(attrs, arr) + # no warning using default attrs + attrs = doc._get_array_attrs() + arr = doc.to_array(attrs) + with warnings.catch_warnings(): + warnings.simplefilter("error") + new_doc.from_array(attrs, arr) + # only SENT_START uses SENT_START + attrs = [SENT_START] + arr = doc.to_array(attrs) + new_doc = Doc(en_vocab, words=words) + new_doc.from_array(attrs, arr) + assert [t.is_sent_start for t in doc] == [t.is_sent_start for t in new_doc] + assert not new_doc.has_annotation("DEP") + # only HEAD uses HEAD + attrs = [HEAD, DEP] + arr = doc.to_array(attrs) + new_doc = Doc(en_vocab, words=words) + new_doc.from_array(attrs, arr) + assert [t.is_sent_start for t in doc] == [t.is_sent_start for t in new_doc] + assert new_doc.has_annotation("DEP") + + +def test_doc_from_array_morph(en_vocab): + # fmt: off + words = ["I", "live", "in", "New", "York", "."] + morphs = ["Feat1=A", "Feat1=B", "Feat1=C", "Feat1=A|Feat2=D", "Feat2=E", "Feat3=F"] + # fmt: on + doc = Doc(en_vocab, words=words, morphs=morphs) + attrs = [MORPH] + arr = doc.to_array(attrs) + new_doc = Doc(en_vocab, words=words) + new_doc.from_array(attrs, arr) + assert [str(t.morph) for t in new_doc] == morphs + assert [str(t.morph) for t in doc] == [str(t.morph) for t in new_doc] + + +@pytest.mark.usefixtures("clean_underscore") +def test_doc_api_from_docs(en_tokenizer, de_tokenizer): + en_texts = [ + "Merging the docs is fun.", + "", + "They don't think alike. ", + "", + "Another doc.", + ] + en_texts_without_empty = [t for t in en_texts if len(t)] + de_text = "Wie war die Frage?" + en_docs = [en_tokenizer(text) for text in en_texts] + en_docs[0].spans["group"] = [en_docs[0][1:4]] + en_docs[2].spans["group"] = [en_docs[2][1:4]] + en_docs[4].spans["group"] = [en_docs[4][0:1]] + span_group_texts = sorted( + [en_docs[0][1:4].text, en_docs[2][1:4].text, en_docs[4][0:1].text] + ) + de_doc = de_tokenizer(de_text) + Token.set_extension("is_ambiguous", default=False) + en_docs[0][2]._.is_ambiguous = True # docs + en_docs[2][3]._.is_ambiguous = True # think + assert Doc.from_docs([]) is None + assert de_doc is not Doc.from_docs([de_doc]) + assert str(de_doc) == str(Doc.from_docs([de_doc])) + + with pytest.raises(ValueError): + Doc.from_docs(en_docs + [de_doc]) + + m_doc = Doc.from_docs(en_docs) + assert len(en_texts_without_empty) == len(list(m_doc.sents)) + assert len(m_doc.text) > len(en_texts[0]) + len(en_texts[1]) + assert m_doc.text == " ".join([t.strip() for t in en_texts_without_empty]) + p_token = m_doc[len(en_docs[0]) - 1] + assert p_token.text == "." and bool(p_token.whitespace_) + en_docs_tokens = [t for doc in en_docs for t in doc] + assert len(m_doc) == len(en_docs_tokens) + think_idx = len(en_texts[0]) + 1 + en_texts[2].index("think") + assert m_doc[2]._.is_ambiguous is True + assert m_doc[9].idx == think_idx + assert m_doc[9]._.is_ambiguous is True + assert not any([t._.is_ambiguous for t in m_doc[3:8]]) + assert "group" in m_doc.spans + assert span_group_texts == sorted([s.text for s in m_doc.spans["group"]]) + assert bool(m_doc[11].whitespace_) + + m_doc = Doc.from_docs(en_docs, ensure_whitespace=False) + assert len(en_texts_without_empty) == len(list(m_doc.sents)) + assert len(m_doc.text) == sum(len(t) for t in en_texts) + assert m_doc.text == "".join(en_texts_without_empty) + p_token = m_doc[len(en_docs[0]) - 1] + assert p_token.text == "." and not bool(p_token.whitespace_) + en_docs_tokens = [t for doc in en_docs for t in doc] + assert len(m_doc) == len(en_docs_tokens) + think_idx = len(en_texts[0]) + 0 + en_texts[2].index("think") + assert m_doc[9].idx == think_idx + assert "group" in m_doc.spans + assert span_group_texts == sorted([s.text for s in m_doc.spans["group"]]) + assert bool(m_doc[11].whitespace_) + + m_doc = Doc.from_docs(en_docs, attrs=["lemma", "length", "pos"]) + assert len(m_doc.text) > len(en_texts[0]) + len(en_texts[1]) + # space delimiter considered, although spacy attribute was missing + assert m_doc.text == " ".join([t.strip() for t in en_texts_without_empty]) + p_token = m_doc[len(en_docs[0]) - 1] + assert p_token.text == "." and bool(p_token.whitespace_) + en_docs_tokens = [t for doc in en_docs for t in doc] + assert len(m_doc) == len(en_docs_tokens) + think_idx = len(en_texts[0]) + 1 + en_texts[2].index("think") + assert m_doc[9].idx == think_idx + assert "group" in m_doc.spans + assert span_group_texts == sorted([s.text for s in m_doc.spans["group"]]) + + # can exclude spans + m_doc = Doc.from_docs(en_docs, exclude=["spans"]) + assert "group" not in m_doc.spans + + # can exclude user_data + m_doc = Doc.from_docs(en_docs, exclude=["user_data"]) + assert m_doc.user_data == {} + + # can merge empty docs + doc = Doc.from_docs([en_tokenizer("")] * 10) + + # empty but set spans keys are preserved + en_docs = [en_tokenizer(text) for text in en_texts] + m_doc = Doc.from_docs(en_docs) + assert "group" not in m_doc.spans + for doc in en_docs: + doc.spans["group"] = [] + m_doc = Doc.from_docs(en_docs) + assert "group" in m_doc.spans + assert len(m_doc.spans["group"]) == 0 + + # with tensor + ops = get_current_ops() + for doc in en_docs: + doc.tensor = ops.asarray([[len(t.text), 0.0] for t in doc]) + m_doc = Doc.from_docs(en_docs) + assert_array_equal( + ops.to_numpy(m_doc.tensor), + ops.to_numpy(ops.xp.vstack([doc.tensor for doc in en_docs if len(doc)])), + ) + + # can exclude tensor + m_doc = Doc.from_docs(en_docs, exclude=["tensor"]) + assert m_doc.tensor.shape == (0,) + + +def test_doc_api_from_docs_ents(en_tokenizer): + texts = ["Merging the docs is fun.", "They don't think alike."] + docs = [en_tokenizer(t) for t in texts] + docs[0].ents = () + docs[1].ents = (Span(docs[1], 0, 1, label="foo"),) + doc = Doc.from_docs(docs) + assert len(doc.ents) == 1 + + +def test_doc_lang(en_vocab): + doc = Doc(en_vocab, words=["Hello", "world"]) + assert doc.lang_ == "en" + assert doc.lang == en_vocab.strings["en"] + assert doc[0].lang_ == "en" + assert doc[0].lang == en_vocab.strings["en"] + nlp = English() + doc = nlp("Hello world") + assert doc.lang_ == "en" + assert doc.lang == en_vocab.strings["en"] + assert doc[0].lang_ == "en" + assert doc[0].lang == en_vocab.strings["en"] + + +def test_token_lexeme(en_vocab): + """Test that tokens expose their lexeme.""" + token = Doc(en_vocab, words=["Hello", "world"])[0] + assert isinstance(token.lex, Lexeme) + assert token.lex.text == token.text + assert en_vocab[token.orth] == token.lex + + +def test_has_annotation(en_vocab): + doc = Doc(en_vocab, words=["Hello", "world"]) + attrs = ("TAG", "POS", "MORPH", "LEMMA", "DEP", "HEAD", "ENT_IOB", "ENT_TYPE") + for attr in attrs: + assert not doc.has_annotation(attr) + assert not doc.has_annotation(attr, require_complete=True) + + doc[0].tag_ = "A" + doc[0].pos_ = "X" + doc[0].set_morph("Feat=Val") + doc[0].lemma_ = "a" + doc[0].dep_ = "dep" + doc[0].head = doc[1] + doc.set_ents([Span(doc, 0, 1, label="HELLO")], default="missing") + + for attr in attrs: + assert doc.has_annotation(attr) + assert not doc.has_annotation(attr, require_complete=True) + + doc[1].tag_ = "A" + doc[1].pos_ = "X" + doc[1].set_morph("") + doc[1].lemma_ = "a" + doc[1].dep_ = "dep" + doc.ents = [Span(doc, 0, 2, label="HELLO")] + + for attr in attrs: + assert doc.has_annotation(attr) + assert doc.has_annotation(attr, require_complete=True) + + +def test_has_annotation_sents(en_vocab): + doc = Doc(en_vocab, words=["Hello", "beautiful", "world"]) + attrs = ("SENT_START", "IS_SENT_START", "IS_SENT_END") + for attr in attrs: + assert not doc.has_annotation(attr) + assert not doc.has_annotation(attr, require_complete=True) + + # The first token (index 0) is always assumed to be a sentence start, + # and ignored by the check in doc.has_annotation + + doc[1].is_sent_start = False + for attr in attrs: + assert doc.has_annotation(attr) + assert not doc.has_annotation(attr, require_complete=True) + + doc[2].is_sent_start = False + for attr in attrs: + assert doc.has_annotation(attr) + assert doc.has_annotation(attr, require_complete=True) + + +def test_is_flags_deprecated(en_tokenizer): + doc = en_tokenizer("test") + with pytest.deprecated_call(): + doc.is_tagged + with pytest.deprecated_call(): + doc.is_parsed + with pytest.deprecated_call(): + doc.is_nered + with pytest.deprecated_call(): + doc.is_sentenced + + +def test_doc_set_ents(en_tokenizer): + # set ents + doc = en_tokenizer("a b c d e") + doc.set_ents([Span(doc, 0, 1, 10), Span(doc, 1, 3, 11)]) + assert [t.ent_iob for t in doc] == [3, 3, 1, 2, 2] + assert [t.ent_type for t in doc] == [10, 11, 11, 0, 0] + + # add ents, invalid IOB repaired + doc = en_tokenizer("a b c d e") + doc.set_ents([Span(doc, 0, 1, 10), Span(doc, 1, 3, 11)]) + doc.set_ents([Span(doc, 0, 2, 12)], default="unmodified") + assert [t.ent_iob for t in doc] == [3, 1, 3, 2, 2] + assert [t.ent_type for t in doc] == [12, 12, 11, 0, 0] + + # missing ents + doc = en_tokenizer("a b c d e") + doc.set_ents([Span(doc, 0, 1, 10), Span(doc, 1, 3, 11)], missing=[doc[4:5]]) + assert [t.ent_iob for t in doc] == [3, 3, 1, 2, 0] + assert [t.ent_type for t in doc] == [10, 11, 11, 0, 0] + + # outside ents + doc = en_tokenizer("a b c d e") + doc.set_ents( + [Span(doc, 0, 1, 10), Span(doc, 1, 3, 11)], + outside=[doc[4:5]], + default="missing", + ) + assert [t.ent_iob for t in doc] == [3, 3, 1, 0, 2] + assert [t.ent_type for t in doc] == [10, 11, 11, 0, 0] + + # blocked ents + doc = en_tokenizer("a b c d e") + doc.set_ents([], blocked=[doc[1:2], doc[3:5]], default="unmodified") + assert [t.ent_iob for t in doc] == [0, 3, 0, 3, 3] + assert [t.ent_type for t in doc] == [0, 0, 0, 0, 0] + assert doc.ents == tuple() + + # invalid IOB repaired after blocked + doc.ents = [Span(doc, 3, 5, "ENT")] + assert [t.ent_iob for t in doc] == [2, 2, 2, 3, 1] + doc.set_ents([], blocked=[doc[3:4]], default="unmodified") + assert [t.ent_iob for t in doc] == [2, 2, 2, 3, 3] + + # all types + doc = en_tokenizer("a b c d e") + doc.set_ents( + [Span(doc, 0, 1, 10)], + blocked=[doc[1:2]], + missing=[doc[2:3]], + outside=[doc[3:4]], + default="unmodified", + ) + assert [t.ent_iob for t in doc] == [3, 3, 0, 2, 0] + assert [t.ent_type for t in doc] == [10, 0, 0, 0, 0] + + doc = en_tokenizer("a b c d e") + # single span instead of a list + with pytest.raises(ValueError): + doc.set_ents([], missing=doc[1:2]) + # invalid default mode + with pytest.raises(ValueError): + doc.set_ents([], missing=[doc[1:2]], default="none") + # conflicting/overlapping specifications + with pytest.raises(ValueError): + doc.set_ents([], missing=[doc[1:2]], outside=[doc[1:2]]) + + +def test_doc_ents_setter(): + """Test that both strings and integers can be used to set entities in + tuple format via doc.ents.""" + words = ["a", "b", "c", "d", "e"] + doc = Doc(Vocab(), words=words) + doc.ents = [("HELLO", 0, 2), (doc.vocab.strings.add("WORLD"), 3, 5)] + assert [e.label_ for e in doc.ents] == ["HELLO", "WORLD"] + vocab = Vocab() + ents = [("HELLO", 0, 2), (vocab.strings.add("WORLD"), 3, 5)] + ents = ["B-HELLO", "I-HELLO", "O", "B-WORLD", "I-WORLD"] + doc = Doc(vocab, words=words, ents=ents) + assert [e.label_ for e in doc.ents] == ["HELLO", "WORLD"] + + +def test_doc_morph_setter(en_tokenizer, de_tokenizer): + doc1 = en_tokenizer("a b") + doc1b = en_tokenizer("c d") + doc2 = de_tokenizer("a b") + + # unset values can be copied + doc1[0].morph = doc1[1].morph + assert doc1[0].morph.key == 0 + assert doc1[1].morph.key == 0 + + # morph values from the same vocab can be copied + doc1[0].set_morph("Feat=Val") + doc1[1].morph = doc1[0].morph + assert doc1[0].morph == doc1[1].morph + + # ... also across docs + doc1b[0].morph = doc1[0].morph + assert doc1[0].morph == doc1b[0].morph + + doc2[0].set_morph("Feat2=Val2") + + # the morph value must come from the same vocab + with pytest.raises(ValueError): + doc1[0].morph = doc2[0].morph + + +def test_doc_init_iob(): + """Test ents validation/normalization in Doc.__init__""" + words = ["a", "b", "c", "d", "e"] + ents = ["O"] * len(words) + doc = Doc(Vocab(), words=words, ents=ents) + assert doc.ents == () + + ents = ["B-PERSON", "I-PERSON", "O", "I-PERSON", "I-PERSON"] + doc = Doc(Vocab(), words=words, ents=ents) + assert len(doc.ents) == 2 + + ents = ["B-PERSON", "I-PERSON", "O", "I-PERSON", "I-GPE"] + doc = Doc(Vocab(), words=words, ents=ents) + assert len(doc.ents) == 3 + + # None is missing + ents = ["B-PERSON", "I-PERSON", "O", None, "I-GPE"] + doc = Doc(Vocab(), words=words, ents=ents) + assert len(doc.ents) == 2 + + # empty tag is missing + ents = ["", "B-PERSON", "O", "B-PERSON", "I-PERSON"] + doc = Doc(Vocab(), words=words, ents=ents) + assert len(doc.ents) == 2 + + # invalid IOB + ents = ["Q-PERSON", "I-PERSON", "O", "I-PERSON", "I-GPE"] + with pytest.raises(ValueError): + doc = Doc(Vocab(), words=words, ents=ents) + + # no dash + ents = ["OPERSON", "I-PERSON", "O", "I-PERSON", "I-GPE"] + with pytest.raises(ValueError): + doc = Doc(Vocab(), words=words, ents=ents) + + # no ent type + ents = ["O", "B-", "O", "I-PERSON", "I-GPE"] + with pytest.raises(ValueError): + doc = Doc(Vocab(), words=words, ents=ents) + + # not strings or None + ents = [0, "B-", "O", "I-PERSON", "I-GPE"] + with pytest.raises(ValueError): + doc = Doc(Vocab(), words=words, ents=ents) + + +def test_doc_set_ents_invalid_spans(en_tokenizer): + doc = en_tokenizer("Some text about Colombia and the Czech Republic") + spans = [Span(doc, 3, 4, label="GPE"), Span(doc, 6, 8, label="GPE")] + with doc.retokenize() as retokenizer: + for span in spans: + retokenizer.merge(span) + with pytest.raises(IndexError): + doc.ents = spans + + +def test_doc_noun_chunks_not_implemented(): + """Test that a language without noun_chunk iterator, throws a NotImplementedError""" + text = "Může data vytvářet a spravovat, ale především je dokáže analyzovat, najít v nich nové vztahy a vše přehledně vizualizovat." + nlp = MultiLanguage() + doc = nlp(text) + with pytest.raises(NotImplementedError): + _ = list(doc.noun_chunks) # noqa: F841 + + +def test_span_groups(en_tokenizer): + doc = en_tokenizer("Some text about Colombia and the Czech Republic") + doc.spans["hi"] = [Span(doc, 3, 4, label="bye")] + assert "hi" in doc.spans + assert "bye" not in doc.spans + assert len(doc.spans["hi"]) == 1 + assert doc.spans["hi"][0].label_ == "bye" + doc.spans["hi"].append(doc[0:3]) + assert len(doc.spans["hi"]) == 2 + assert doc.spans["hi"][1].text == "Some text about" + assert [span.text for span in doc.spans["hi"]] == ["Colombia", "Some text about"] + assert not doc.spans["hi"].has_overlap + doc.ents = [Span(doc, 3, 4, label="GPE"), Span(doc, 6, 8, label="GPE")] + doc.spans["hi"].extend(doc.ents) + assert len(doc.spans["hi"]) == 4 + assert [span.label_ for span in doc.spans["hi"]] == ["bye", "", "GPE", "GPE"] + assert doc.spans["hi"].has_overlap + del doc.spans["hi"] + assert "hi" not in doc.spans + + +def test_doc_spans_copy(en_tokenizer): + doc1 = en_tokenizer("Some text about Colombia and the Czech Republic") + assert weakref.ref(doc1) == doc1.spans.doc_ref + doc2 = doc1.copy() + assert weakref.ref(doc2) == doc2.spans.doc_ref + + +def test_doc_spans_setdefault(en_tokenizer): + doc = en_tokenizer("Some text about Colombia and the Czech Republic") + doc.spans.setdefault("key1") + assert len(doc.spans["key1"]) == 0 + doc.spans.setdefault("key2", default=[doc[0:1]]) + assert len(doc.spans["key2"]) == 1 + doc.spans.setdefault("key3", default=SpanGroup(doc, spans=[doc[0:1], doc[1:2]])) + assert len(doc.spans["key3"]) == 2 diff --git a/TTS/Kokoro/.venv/Lib/site-packages/spacy/tests/doc/test_graph.py b/TTS/Kokoro/.venv/Lib/site-packages/spacy/tests/doc/test_graph.py new file mode 100644 index 0000000000000000000000000000000000000000..9a2081e749ac6a5222e79ded3f16977bccbcb525 --- /dev/null +++ b/TTS/Kokoro/.venv/Lib/site-packages/spacy/tests/doc/test_graph.py @@ -0,0 +1,48 @@ +from spacy.tokens.doc import Doc +from spacy.tokens.graph import Graph +from spacy.vocab import Vocab + + +def test_graph_init(): + doc = Doc(Vocab(), words=["a", "b", "c", "d"]) + graph = Graph(doc, name="hello") + assert graph.name == "hello" + assert graph.doc is doc + + +def test_graph_edges_and_nodes(): + doc = Doc(Vocab(), words=["a", "b", "c", "d"]) + graph = Graph(doc, name="hello") + node1 = graph.add_node((0,)) + assert graph.get_node((0,)) == node1 + node2 = graph.add_node((1, 3)) + assert list(node2) == [1, 3] + graph.add_edge(node1, node2, label="one", weight=-10.5) + assert graph.has_edge(node1, node2, label="one") + assert node1.heads() == [] + assert [tuple(h) for h in node2.heads()] == [(0,)] + assert [tuple(t) for t in node1.tails()] == [(1, 3)] + assert [tuple(t) for t in node2.tails()] == [] + + +def test_graph_walk(): + doc = Doc(Vocab(), words=["a", "b", "c", "d"]) + graph = Graph( + doc, + name="hello", + nodes=[(0,), (1,), (2,), (3,)], + edges=[(0, 1), (0, 2), (0, 3), (3, 0)], + labels=None, + weights=None, + ) + node0, node1, node2, node3 = list(graph.nodes) + assert [tuple(h) for h in node0.heads()] == [(3,)] + assert [tuple(h) for h in node1.heads()] == [(0,)] + assert [tuple(h) for h in node0.walk_heads()] == [(3,), (0,)] + assert [tuple(h) for h in node1.walk_heads()] == [(0,), (3,), (0,)] + assert [tuple(h) for h in node2.walk_heads()] == [(0,), (3,), (0,)] + assert [tuple(h) for h in node3.walk_heads()] == [(0,), (3,)] + assert [tuple(t) for t in node0.walk_tails()] == [(1,), (2,), (3,), (0,)] + assert [tuple(t) for t in node1.walk_tails()] == [] + assert [tuple(t) for t in node2.walk_tails()] == [] + assert [tuple(t) for t in node3.walk_tails()] == [(0,), (1,), (2,), (3,)] diff --git a/TTS/Kokoro/.venv/Lib/site-packages/spacy/tests/doc/test_json_doc_conversion.py b/TTS/Kokoro/.venv/Lib/site-packages/spacy/tests/doc/test_json_doc_conversion.py new file mode 100644 index 0000000000000000000000000000000000000000..37940c2b381e8813c84e03ba0101af6c8f7fdf2d --- /dev/null +++ b/TTS/Kokoro/.venv/Lib/site-packages/spacy/tests/doc/test_json_doc_conversion.py @@ -0,0 +1,383 @@ +import pytest +import srsly + +import spacy +from spacy import schemas +from spacy.tokens import Doc, Span, Token + +from .test_underscore import clean_underscore # noqa: F401 + + +@pytest.fixture() +def doc(en_vocab): + words = ["c", "d", "e"] + spaces = [True, True, True] + pos = ["VERB", "NOUN", "NOUN"] + tags = ["VBP", "NN", "NN"] + heads = [0, 0, 1] + deps = ["ROOT", "dobj", "dobj"] + ents = ["O", "B-ORG", "O"] + morphs = ["Feat1=A", "Feat1=B", "Feat1=A|Feat2=D"] + + return Doc( + en_vocab, + words=words, + spaces=spaces, + pos=pos, + tags=tags, + heads=heads, + deps=deps, + ents=ents, + morphs=morphs, + ) + + +@pytest.fixture() +def doc_without_deps(en_vocab): + words = ["c", "d", "e"] + pos = ["VERB", "NOUN", "NOUN"] + tags = ["VBP", "NN", "NN"] + ents = ["O", "B-ORG", "O"] + morphs = ["Feat1=A", "Feat1=B", "Feat1=A|Feat2=D"] + + return Doc( + en_vocab, + words=words, + pos=pos, + tags=tags, + ents=ents, + morphs=morphs, + sent_starts=[True, False, True], + ) + + +@pytest.fixture() +def doc_json(): + return { + "text": "c d e ", + "ents": [{"start": 2, "end": 3, "label": "ORG"}], + "sents": [{"start": 0, "end": 5}], + "tokens": [ + { + "id": 0, + "start": 0, + "end": 1, + "tag": "VBP", + "pos": "VERB", + "morph": "Feat1=A", + "dep": "ROOT", + "head": 0, + }, + { + "id": 1, + "start": 2, + "end": 3, + "tag": "NN", + "pos": "NOUN", + "morph": "Feat1=B", + "dep": "dobj", + "head": 0, + }, + { + "id": 2, + "start": 4, + "end": 5, + "tag": "NN", + "pos": "NOUN", + "morph": "Feat1=A|Feat2=D", + "dep": "dobj", + "head": 1, + }, + ], + } + + +def test_doc_to_json(doc): + json_doc = doc.to_json() + assert json_doc["text"] == "c d e " + assert len(json_doc["tokens"]) == 3 + assert json_doc["tokens"][0]["pos"] == "VERB" + assert json_doc["tokens"][0]["tag"] == "VBP" + assert json_doc["tokens"][0]["dep"] == "ROOT" + assert len(json_doc["ents"]) == 1 + assert json_doc["ents"][0]["start"] == 2 # character offset! + assert json_doc["ents"][0]["end"] == 3 # character offset! + assert json_doc["ents"][0]["label"] == "ORG" + assert len(schemas.validate(schemas.DocJSONSchema, json_doc)) == 0 + assert srsly.json_loads(srsly.json_dumps(json_doc)) == json_doc + + +def test_doc_to_json_underscore(doc): + Doc.set_extension("json_test1", default=False) + Doc.set_extension("json_test2", default=False) + doc._.json_test1 = "hello world" + doc._.json_test2 = [1, 2, 3] + + json_doc = doc.to_json(underscore=["json_test1", "json_test2"]) + assert "_" in json_doc + assert json_doc["_"]["json_test1"] == "hello world" + assert json_doc["_"]["json_test2"] == [1, 2, 3] + assert len(schemas.validate(schemas.DocJSONSchema, json_doc)) == 0 + assert srsly.json_loads(srsly.json_dumps(json_doc)) == json_doc + + +def test_doc_to_json_with_token_span_attributes(doc): + Doc.set_extension("json_test1", default=False) + Doc.set_extension("json_test2", default=False) + Token.set_extension("token_test", default=False) + Span.set_extension("span_test", default=False) + + doc._.json_test1 = "hello world" + doc._.json_test2 = [1, 2, 3] + doc[0:1]._.span_test = "span_attribute" + doc[0:2]._.span_test = "span_attribute_2" + doc[0]._.token_test = 117 + doc[1]._.token_test = 118 + doc.spans["span_group"] = [doc[0:1]] + json_doc = doc.to_json( + underscore=["json_test1", "json_test2", "token_test", "span_test"] + ) + + assert "_" in json_doc + assert json_doc["_"]["json_test1"] == "hello world" + assert json_doc["_"]["json_test2"] == [1, 2, 3] + assert "underscore_token" in json_doc + assert "underscore_span" in json_doc + assert json_doc["underscore_token"]["token_test"][0]["value"] == 117 + assert json_doc["underscore_token"]["token_test"][1]["value"] == 118 + assert json_doc["underscore_span"]["span_test"][0]["value"] == "span_attribute" + assert json_doc["underscore_span"]["span_test"][1]["value"] == "span_attribute_2" + assert len(schemas.validate(schemas.DocJSONSchema, json_doc)) == 0 + assert srsly.json_loads(srsly.json_dumps(json_doc)) == json_doc + + +def test_doc_to_json_with_custom_user_data(doc): + Doc.set_extension("json_test", default=False) + Token.set_extension("token_test", default=False) + Span.set_extension("span_test", default=False) + + doc._.json_test = "hello world" + doc[0:1]._.span_test = "span_attribute" + doc[0]._.token_test = 117 + json_doc = doc.to_json(underscore=["json_test", "token_test", "span_test"]) + doc.user_data["user_data_test"] = 10 + doc.user_data[("user_data_test2", True)] = 10 + + assert "_" in json_doc + assert json_doc["_"]["json_test"] == "hello world" + assert "underscore_token" in json_doc + assert "underscore_span" in json_doc + assert json_doc["underscore_token"]["token_test"][0]["value"] == 117 + assert json_doc["underscore_span"]["span_test"][0]["value"] == "span_attribute" + assert len(schemas.validate(schemas.DocJSONSchema, json_doc)) == 0 + assert srsly.json_loads(srsly.json_dumps(json_doc)) == json_doc + + +def test_doc_to_json_with_token_span_same_identifier(doc): + Doc.set_extension("my_ext", default=False) + Token.set_extension("my_ext", default=False) + Span.set_extension("my_ext", default=False) + + doc._.my_ext = "hello world" + doc[0:1]._.my_ext = "span_attribute" + doc[0]._.my_ext = 117 + json_doc = doc.to_json(underscore=["my_ext"]) + + assert "_" in json_doc + assert json_doc["_"]["my_ext"] == "hello world" + assert "underscore_token" in json_doc + assert "underscore_span" in json_doc + assert json_doc["underscore_token"]["my_ext"][0]["value"] == 117 + assert json_doc["underscore_span"]["my_ext"][0]["value"] == "span_attribute" + assert len(schemas.validate(schemas.DocJSONSchema, json_doc)) == 0 + assert srsly.json_loads(srsly.json_dumps(json_doc)) == json_doc + + +def test_doc_to_json_with_token_attributes_missing(doc): + Token.set_extension("token_test", default=False) + Span.set_extension("span_test", default=False) + + doc[0:1]._.span_test = "span_attribute" + doc[0]._.token_test = 117 + json_doc = doc.to_json(underscore=["span_test"]) + + assert "underscore_span" in json_doc + assert json_doc["underscore_span"]["span_test"][0]["value"] == "span_attribute" + assert "underscore_token" not in json_doc + assert len(schemas.validate(schemas.DocJSONSchema, json_doc)) == 0 + + +def test_doc_to_json_underscore_error_attr(doc): + """Test that Doc.to_json() raises an error if a custom attribute doesn't + exist in the ._ space.""" + with pytest.raises(ValueError): + doc.to_json(underscore=["json_test3"]) + + +def test_doc_to_json_underscore_error_serialize(doc): + """Test that Doc.to_json() raises an error if a custom attribute value + isn't JSON-serializable.""" + Doc.set_extension("json_test4", method=lambda doc: doc.text) + with pytest.raises(ValueError): + doc.to_json(underscore=["json_test4"]) + + +def test_doc_to_json_span(doc): + """Test that Doc.to_json() includes spans""" + doc.spans["test"] = [Span(doc, 0, 2, "test"), Span(doc, 0, 1, "test")] + json_doc = doc.to_json() + assert "spans" in json_doc + assert len(json_doc["spans"]) == 1 + assert len(json_doc["spans"]["test"]) == 2 + assert json_doc["spans"]["test"][0]["start"] == 0 + assert len(schemas.validate(schemas.DocJSONSchema, json_doc)) == 0 + + +def test_json_to_doc(doc): + json_doc = doc.to_json() + json_doc = srsly.json_loads(srsly.json_dumps(json_doc)) + new_doc = Doc(doc.vocab).from_json(json_doc, validate=True) + assert new_doc.text == doc.text == "c d e " + assert len(new_doc) == len(doc) == 3 + assert new_doc[0].pos == doc[0].pos + assert new_doc[0].tag == doc[0].tag + assert new_doc[0].dep == doc[0].dep + assert new_doc[0].head.idx == doc[0].head.idx + assert new_doc[0].lemma == doc[0].lemma + assert len(new_doc.ents) == 1 + assert new_doc.ents[0].start == 1 + assert new_doc.ents[0].end == 2 + assert new_doc.ents[0].label_ == "ORG" + assert doc.to_bytes() == new_doc.to_bytes() + + +def test_json_to_doc_compat(doc, doc_json): + new_doc = Doc(doc.vocab).from_json(doc_json, validate=True) + new_tokens = [token for token in new_doc] + assert new_doc.text == doc.text == "c d e " + assert len(new_tokens) == len([token for token in doc]) == 3 + assert new_tokens[0].pos == doc[0].pos + assert new_tokens[0].tag == doc[0].tag + assert new_tokens[0].dep == doc[0].dep + assert new_tokens[0].head.idx == doc[0].head.idx + assert new_tokens[0].lemma == doc[0].lemma + assert len(new_doc.ents) == 1 + assert new_doc.ents[0].start == 1 + assert new_doc.ents[0].end == 2 + assert new_doc.ents[0].label_ == "ORG" + + +def test_json_to_doc_underscore(doc): + Doc.set_extension("json_test1", default=False) + Doc.set_extension("json_test2", default=False) + doc._.json_test1 = "hello world" + doc._.json_test2 = [1, 2, 3] + json_doc = doc.to_json(underscore=["json_test1", "json_test2"]) + new_doc = Doc(doc.vocab).from_json(json_doc, validate=True) + assert all([new_doc.has_extension(f"json_test{i}") for i in range(1, 3)]) + assert new_doc._.json_test1 == "hello world" + assert new_doc._.json_test2 == [1, 2, 3] + assert doc.to_bytes() == new_doc.to_bytes() + + +def test_json_to_doc_with_token_span_attributes(doc): + Doc.set_extension("json_test1", default=False) + Doc.set_extension("json_test2", default=False) + Token.set_extension("token_test", default=False) + Span.set_extension("span_test", default=False) + doc._.json_test1 = "hello world" + doc._.json_test2 = [1, 2, 3] + doc[0:1]._.span_test = "span_attribute" + doc[0:2]._.span_test = "span_attribute_2" + doc[0]._.token_test = 117 + doc[1]._.token_test = 118 + + json_doc = doc.to_json( + underscore=["json_test1", "json_test2", "token_test", "span_test"] + ) + json_doc = srsly.json_loads(srsly.json_dumps(json_doc)) + new_doc = Doc(doc.vocab).from_json(json_doc, validate=True) + + assert all([new_doc.has_extension(f"json_test{i}") for i in range(1, 3)]) + assert new_doc._.json_test1 == "hello world" + assert new_doc._.json_test2 == [1, 2, 3] + assert new_doc[0]._.token_test == 117 + assert new_doc[1]._.token_test == 118 + assert new_doc[0:1]._.span_test == "span_attribute" + assert new_doc[0:2]._.span_test == "span_attribute_2" + assert new_doc.user_data == doc.user_data + assert new_doc.to_bytes(exclude=["user_data"]) == doc.to_bytes( + exclude=["user_data"] + ) + + +def test_json_to_doc_spans(doc): + """Test that Doc.from_json() includes correct.spans.""" + doc.spans["test"] = [ + Span(doc, 0, 2, label="test"), + Span(doc, 0, 1, label="test", kb_id=7), + ] + json_doc = doc.to_json() + new_doc = Doc(doc.vocab).from_json(json_doc, validate=True) + assert len(new_doc.spans) == 1 + assert len(new_doc.spans["test"]) == 2 + for i in range(2): + assert new_doc.spans["test"][i].start == doc.spans["test"][i].start + assert new_doc.spans["test"][i].end == doc.spans["test"][i].end + assert new_doc.spans["test"][i].label == doc.spans["test"][i].label + assert new_doc.spans["test"][i].kb_id == doc.spans["test"][i].kb_id + + +def test_json_to_doc_sents(doc, doc_without_deps): + """Test that Doc.from_json() includes correct.sents.""" + for test_doc in (doc, doc_without_deps): + json_doc = test_doc.to_json() + new_doc = Doc(doc.vocab).from_json(json_doc, validate=True) + assert [sent.text for sent in test_doc.sents] == [ + sent.text for sent in new_doc.sents + ] + assert [token.is_sent_start for token in test_doc] == [ + token.is_sent_start for token in new_doc + ] + + +def test_json_to_doc_cats(doc): + """Test that Doc.from_json() includes correct .cats.""" + cats = {"A": 0.3, "B": 0.7} + doc.cats = cats + json_doc = doc.to_json() + new_doc = Doc(doc.vocab).from_json(json_doc, validate=True) + assert new_doc.cats == cats + + +def test_json_to_doc_spaces(): + """Test that Doc.from_json() preserves spaces correctly.""" + doc = spacy.blank("en")("This is just brilliant.") + json_doc = doc.to_json() + new_doc = Doc(doc.vocab).from_json(json_doc, validate=True) + assert doc.text == new_doc.text + + +def test_json_to_doc_attribute_consistency(doc): + """Test that Doc.from_json() raises an exception if tokens don't all have the same set of properties.""" + doc_json = doc.to_json() + doc_json["tokens"][1].pop("morph") + with pytest.raises(ValueError): + Doc(doc.vocab).from_json(doc_json) + + +def test_json_to_doc_validation_error(doc): + """Test that Doc.from_json() raises an exception when validating invalid input.""" + doc_json = doc.to_json() + doc_json.pop("tokens") + with pytest.raises(ValueError): + Doc(doc.vocab).from_json(doc_json, validate=True) + + +def test_to_json_underscore_doc_getters(doc): + def get_text_length(doc): + return len(doc.text) + + Doc.set_extension("text_length", getter=get_text_length) + doc_json = doc.to_json(underscore=["text_length"]) + assert doc_json["_"]["text_length"] == get_text_length(doc) diff --git a/TTS/Kokoro/.venv/Lib/site-packages/spacy/tests/doc/test_morphanalysis.py b/TTS/Kokoro/.venv/Lib/site-packages/spacy/tests/doc/test_morphanalysis.py new file mode 100644 index 0000000000000000000000000000000000000000..90675ca6550b1d945b99602d3418a5ec273a5aa2 --- /dev/null +++ b/TTS/Kokoro/.venv/Lib/site-packages/spacy/tests/doc/test_morphanalysis.py @@ -0,0 +1,100 @@ +import pytest + + +@pytest.fixture +def i_has(en_tokenizer): + doc = en_tokenizer("I has") + doc[0].set_morph({"PronType": "prs"}) + doc[1].set_morph( + { + "VerbForm": "fin", + "Tense": "pres", + "Number": "sing", + "Person": "three", + } + ) + + return doc + + +def test_token_morph_eq(i_has): + assert i_has[0].morph is not i_has[0].morph + assert i_has[0].morph == i_has[0].morph + assert i_has[0].morph != i_has[1].morph + + +def test_token_morph_key(i_has): + assert i_has[0].morph.key != 0 + assert i_has[1].morph.key != 0 + assert i_has[0].morph.key == i_has[0].morph.key + assert i_has[0].morph.key != i_has[1].morph.key + + +def test_morph_props(i_has): + assert i_has[0].morph.get("PronType") == ["prs"] + assert i_has[1].morph.get("PronType") == [] + assert i_has[1].morph.get("AsdfType", ["asdf"]) == ["asdf"] + assert i_has[1].morph.get("AsdfType", default=["asdf", "qwer"]) == ["asdf", "qwer"] + + +def test_morph_iter(i_has): + assert set(i_has[0].morph) == set(["PronType=prs"]) + assert set(i_has[1].morph) == set( + ["Number=sing", "Person=three", "Tense=pres", "VerbForm=fin"] + ) + + +def test_morph_get(i_has): + assert i_has[0].morph.get("PronType") == ["prs"] + + +def test_morph_set(i_has): + assert i_has[0].morph.get("PronType") == ["prs"] + # set by string + i_has[0].set_morph("PronType=unk") + assert i_has[0].morph.get("PronType") == ["unk"] + # set by string, fields are alphabetized + i_has[0].set_morph("PronType=123|NounType=unk") + assert str(i_has[0].morph) == "NounType=unk|PronType=123" + # set by dict + i_has[0].set_morph({"AType": "123", "BType": "unk"}) + assert str(i_has[0].morph) == "AType=123|BType=unk" + # set by string with multiple values, fields and values are alphabetized + i_has[0].set_morph("BType=c|AType=b,a") + assert str(i_has[0].morph) == "AType=a,b|BType=c" + # set by dict with multiple values, fields and values are alphabetized + i_has[0].set_morph({"AType": "b,a", "BType": "c"}) + assert str(i_has[0].morph) == "AType=a,b|BType=c" + + +def test_morph_str(i_has): + assert str(i_has[0].morph) == "PronType=prs" + assert str(i_has[1].morph) == "Number=sing|Person=three|Tense=pres|VerbForm=fin" + + +def test_morph_property(tokenizer): + doc = tokenizer("a dog") + + # set through token.morph_ + doc[0].set_morph("PronType=prs") + assert str(doc[0].morph) == "PronType=prs" + assert doc.to_array(["MORPH"])[0] != 0 + + # unset with token.morph + doc[0].set_morph(None) + assert doc.to_array(["MORPH"])[0] == 0 + + # empty morph is equivalent to "_" + doc[0].set_morph("") + assert str(doc[0].morph) == "" + assert doc.to_array(["MORPH"])[0] == tokenizer.vocab.strings["_"] + + # "_" morph is also equivalent to empty morph + doc[0].set_morph("_") + assert str(doc[0].morph) == "" + assert doc.to_array(["MORPH"])[0] == tokenizer.vocab.strings["_"] + + # set through existing hash with token.morph + tokenizer.vocab.strings.add("Feat=Val") + doc[0].set_morph(tokenizer.vocab.strings.add("Feat=Val")) + assert str(doc[0].morph) == "Feat=Val" diff --git a/TTS/Kokoro/.venv/Lib/site-packages/spacy/tests/doc/test_pickle_doc.py b/TTS/Kokoro/.venv/Lib/site-packages/spacy/tests/doc/test_pickle_doc.py new file mode 100644 index 0000000000000000000000000000000000000000..b91ad250ad5317b41d0f843bfb88ae7e17974d47 --- /dev/null +++ b/TTS/Kokoro/.venv/Lib/site-packages/spacy/tests/doc/test_pickle_doc.py @@ -0,0 +1,54 @@ +from spacy.compat import pickle +from spacy.language import Language + + +def test_pickle_single_doc(): + nlp = Language() + doc = nlp("pickle roundtrip") + data = pickle.dumps(doc, 1) + doc2 = pickle.loads(data) + assert doc2.text == "pickle roundtrip" + + +def test_list_of_docs_pickles_efficiently(): + nlp = Language() + for i in range(10000): + _ = nlp.vocab[str(i)] # noqa: F841 + one_pickled = pickle.dumps(nlp("0"), -1) + docs = list(nlp.pipe(str(i) for i in range(100))) + many_pickled = pickle.dumps(docs, -1) + assert len(many_pickled) < (len(one_pickled) * 2) + many_unpickled = pickle.loads(many_pickled) + assert many_unpickled[0].text == "0" + assert many_unpickled[-1].text == "99" + assert len(many_unpickled) == 100 + + +def test_user_data_from_disk(): + nlp = Language() + doc = nlp("Hello") + doc.user_data[(0, 1)] = False + b = doc.to_bytes() + doc2 = doc.__class__(doc.vocab).from_bytes(b) + assert doc2.user_data[(0, 1)] is False + + +def test_user_data_unpickles(): + nlp = Language() + doc = nlp("Hello") + doc.user_data[(0, 1)] = False + b = pickle.dumps(doc) + doc2 = pickle.loads(b) + assert doc2.user_data[(0, 1)] is False + + +def test_hooks_unpickle(): + def inner_func(d1, d2): + return "hello!" + + nlp = Language() + doc = nlp("Hello") + doc.user_hooks["similarity"] = inner_func + b = pickle.dumps(doc) + doc2 = pickle.loads(b) + assert doc2.similarity(None) == "hello!" diff --git a/TTS/Kokoro/.venv/Lib/site-packages/spacy/tests/doc/test_retokenize_merge.py b/TTS/Kokoro/.venv/Lib/site-packages/spacy/tests/doc/test_retokenize_merge.py new file mode 100644 index 0000000000000000000000000000000000000000..490dbbba707072fc71293498123dba87aa026bca --- /dev/null +++ b/TTS/Kokoro/.venv/Lib/site-packages/spacy/tests/doc/test_retokenize_merge.py @@ -0,0 +1,495 @@ +import pytest + +from spacy.attrs import LEMMA +from spacy.tokens import Doc, Token +from spacy.vocab import Vocab + + +def test_doc_retokenize_merge(en_tokenizer): + text = "WKRO played songs by the beach boys all night" + attrs = { + "tag": "NAMED", + "lemma": "LEMMA", + "ent_type": "TYPE", + "morph": "Number=Plur", + } + doc = en_tokenizer(text) + assert len(doc) == 9 + with doc.retokenize() as retokenizer: + retokenizer.merge(doc[4:7], attrs=attrs) + retokenizer.merge(doc[7:9], attrs=attrs) + assert len(doc) == 6 + assert doc[4].text == "the beach boys" + assert doc[4].text_with_ws == "the beach boys " + assert doc[4].tag_ == "NAMED" + assert doc[4].lemma_ == "LEMMA" + assert str(doc[4].morph) == "Number=Plur" + assert doc[5].text == "all night" + assert doc[5].text_with_ws == "all night" + assert doc[5].tag_ == "NAMED" + assert str(doc[5].morph) == "Number=Plur" + assert doc[5].lemma_ == "LEMMA" + + +def test_doc_retokenize_merge_children(en_tokenizer): + """Test that attachments work correctly after merging.""" + text = "WKRO played songs by the beach boys all night" + attrs = {"tag": "NAMED", "lemma": "LEMMA", "ent_type": "TYPE"} + doc = en_tokenizer(text) + assert len(doc) == 9 + with doc.retokenize() as retokenizer: + retokenizer.merge(doc[4:7], attrs=attrs) + for word in doc: + if word.i < word.head.i: + assert word in list(word.head.lefts) + elif word.i > word.head.i: + assert word in list(word.head.rights) + + +def test_doc_retokenize_merge_hang(en_tokenizer): + text = "through North and South Carolina" + doc = en_tokenizer(text) + with doc.retokenize() as retokenizer: + retokenizer.merge(doc[3:5], attrs={"lemma": "", "ent_type": "ORG"}) + retokenizer.merge(doc[1:2], attrs={"lemma": "", "ent_type": "ORG"}) + + +def test_doc_retokenize_retokenizer(en_tokenizer): + doc = en_tokenizer("WKRO played songs by the beach boys all night") + with doc.retokenize() as retokenizer: + retokenizer.merge(doc[4:7]) + assert len(doc) == 7 + assert doc[4].text == "the beach boys" + + +def test_doc_retokenize_retokenizer_attrs(en_tokenizer): + doc = en_tokenizer("WKRO played songs by the beach boys all night") + # test both string and integer attributes and values + attrs = {LEMMA: "boys", "ENT_TYPE": doc.vocab.strings["ORG"]} + with doc.retokenize() as retokenizer: + retokenizer.merge(doc[4:7], attrs=attrs) + assert len(doc) == 7 + assert doc[4].text == "the beach boys" + assert doc[4].lemma_ == "boys" + assert doc[4].ent_type_ == "ORG" + + +def test_doc_retokenize_lex_attrs(en_tokenizer): + """Test that lexical attributes can be changed (see #2390).""" + doc = en_tokenizer("WKRO played beach boys songs") + assert not any(token.is_stop for token in doc) + with doc.retokenize() as retokenizer: + retokenizer.merge(doc[2:4], attrs={"LEMMA": "boys", "IS_STOP": True}) + assert doc[2].text == "beach boys" + assert doc[2].lemma_ == "boys" + assert doc[2].is_stop + new_doc = Doc(doc.vocab, words=["beach boys"]) + assert new_doc[0].is_stop + + +def test_doc_retokenize_spans_merge_tokens(en_tokenizer): + text = "Los Angeles start." + heads = [1, 2, 2, 2] + deps = ["dep"] * len(heads) + tokens = en_tokenizer(text) + doc = Doc(tokens.vocab, words=[t.text for t in tokens], heads=heads, deps=deps) + assert len(doc) == 4 + assert doc[0].head.text == "Angeles" + assert doc[1].head.text == "start" + with doc.retokenize() as retokenizer: + attrs = {"tag": "NNP", "lemma": "Los Angeles", "ent_type": "GPE"} + retokenizer.merge(doc[0:2], attrs=attrs) + assert len(doc) == 3 + assert doc[0].text == "Los Angeles" + assert doc[0].head.text == "start" + assert doc[0].ent_type_ == "GPE" + + +def test_doc_retokenize_spans_merge_tokens_default_attrs(en_vocab): + words = ["The", "players", "start", "."] + lemmas = [t.lower() for t in words] + heads = [1, 2, 2, 2] + deps = ["dep"] * len(heads) + tags = ["DT", "NN", "VBZ", "."] + pos = ["DET", "NOUN", "VERB", "PUNCT"] + doc = Doc( + en_vocab, words=words, tags=tags, pos=pos, heads=heads, deps=deps, lemmas=lemmas + ) + assert len(doc) == 4 + assert doc[0].text == "The" + assert doc[0].tag_ == "DT" + assert doc[0].pos_ == "DET" + assert doc[0].lemma_ == "the" + with doc.retokenize() as retokenizer: + retokenizer.merge(doc[0:2]) + assert len(doc) == 3 + assert doc[0].text == "The players" + assert doc[0].tag_ == "NN" + assert doc[0].pos_ == "NOUN" + assert doc[0].lemma_ == "the players" + doc = Doc( + en_vocab, words=words, tags=tags, pos=pos, heads=heads, deps=deps, lemmas=lemmas + ) + assert len(doc) == 4 + assert doc[0].text == "The" + assert doc[0].tag_ == "DT" + assert doc[0].pos_ == "DET" + assert doc[0].lemma_ == "the" + with doc.retokenize() as retokenizer: + retokenizer.merge(doc[0:2]) + retokenizer.merge(doc[2:4]) + assert len(doc) == 2 + assert doc[0].text == "The players" + assert doc[0].tag_ == "NN" + assert doc[0].pos_ == "NOUN" + assert doc[0].lemma_ == "the players" + assert doc[1].text == "start ." + assert doc[1].tag_ == "VBZ" + assert doc[1].pos_ == "VERB" + assert doc[1].lemma_ == "start ." + + +def test_doc_retokenize_spans_merge_heads(en_vocab): + words = ["I", "found", "a", "pilates", "class", "near", "work", "."] + heads = [1, 1, 4, 6, 1, 4, 5, 1] + deps = ["dep"] * len(heads) + doc = Doc(en_vocab, words=words, heads=heads, deps=deps) + assert len(doc) == 8 + with doc.retokenize() as retokenizer: + attrs = {"tag": doc[4].tag_, "lemma": "pilates class", "ent_type": "O"} + retokenizer.merge(doc[3:5], attrs=attrs) + assert len(doc) == 7 + assert doc[0].head.i == 1 + assert doc[1].head.i == 1 + assert doc[2].head.i == 3 + assert doc[3].head.i == 1 + assert doc[4].head.i in [1, 3] + assert doc[5].head.i == 4 + + +def test_doc_retokenize_spans_merge_non_disjoint(en_tokenizer): + text = "Los Angeles start." + doc = en_tokenizer(text) + with pytest.raises(ValueError): + with doc.retokenize() as retokenizer: + retokenizer.merge( + doc[0:2], + attrs={"tag": "NNP", "lemma": "Los Angeles", "ent_type": "GPE"}, + ) + retokenizer.merge( + doc[0:1], + attrs={"tag": "NNP", "lemma": "Los Angeles", "ent_type": "GPE"}, + ) + + +def test_doc_retokenize_span_np_merges(en_tokenizer): + text = "displaCy is a parse tool built with Javascript" + heads = [1, 1, 4, 4, 1, 4, 5, 6] + deps = ["dep"] * len(heads) + tokens = en_tokenizer(text) + doc = Doc(tokens.vocab, words=[t.text for t in tokens], heads=heads, deps=deps) + assert doc[4].head.i == 1 + with doc.retokenize() as retokenizer: + attrs = {"tag": "NP", "lemma": "tool", "ent_type": "O"} + retokenizer.merge(doc[2:5], attrs=attrs) + assert doc[2].head.i == 1 + + text = "displaCy is a lightweight and modern dependency parse tree visualization tool built with CSS3 and JavaScript." + heads = [1, 1, 10, 7, 3, 3, 7, 10, 9, 10, 1, 10, 11, 12, 13, 13, 1] + deps = ["dep"] * len(heads) + tokens = en_tokenizer(text) + doc = Doc(tokens.vocab, words=[t.text for t in tokens], heads=heads, deps=deps) + with doc.retokenize() as retokenizer: + for ent in doc.ents: + attrs = {"tag": ent.label_, "lemma": ent.lemma_, "ent_type": ent.label_} + retokenizer.merge(ent, attrs=attrs) + + text = "One test with entities like New York City so the ents list is not void" + heads = [1, 1, 1, 2, 3, 6, 7, 4, 12, 11, 11, 12, 1, 12, 12] + deps = ["dep"] * len(heads) + tokens = en_tokenizer(text) + doc = Doc(tokens.vocab, words=[t.text for t in tokens], heads=heads, deps=deps) + with doc.retokenize() as retokenizer: + for ent in doc.ents: + retokenizer.merge(ent) + + +def test_doc_retokenize_spans_entity_merge(en_tokenizer): + # fmt: off + text = "Stewart Lee is a stand up comedian who lives in England and loves Joe Pasquale.\n" + heads = [1, 2, 2, 4, 6, 4, 2, 8, 6, 8, 9, 8, 8, 14, 12, 2, 15] + deps = ["dep"] * len(heads) + tags = ["NNP", "NNP", "VBZ", "DT", "VB", "RP", "NN", "WP", "VBZ", "IN", "NNP", "CC", "VBZ", "NNP", "NNP", ".", "SP"] + ents = [("PERSON", 0, 2), ("GPE", 10, 11), ("PERSON", 13, 15)] + ents = ["O"] * len(heads) + ents[0] = "B-PERSON" + ents[1] = "I-PERSON" + ents[10] = "B-GPE" + ents[13] = "B-PERSON" + ents[14] = "I-PERSON" + # fmt: on + tokens = en_tokenizer(text) + doc = Doc( + tokens.vocab, + words=[t.text for t in tokens], + heads=heads, + deps=deps, + tags=tags, + ents=ents, + ) + assert len(doc) == 17 + with doc.retokenize() as retokenizer: + for ent in doc.ents: + ent_type = max(w.ent_type_ for w in ent) + attrs = {"lemma": ent.root.lemma_, "ent_type": ent_type} + retokenizer.merge(ent, attrs=attrs) + # check looping is ok + assert len(doc) == 15 + + +def test_doc_retokenize_spans_entity_merge_iob(en_vocab): + # Test entity IOB stays consistent after merging + words = ["a", "b", "c", "d", "e"] + doc = Doc(Vocab(), words=words) + doc.ents = [ + (doc.vocab.strings.add("ent-abc"), 0, 3), + (doc.vocab.strings.add("ent-d"), 3, 4), + ] + assert doc[0].ent_iob_ == "B" + assert doc[1].ent_iob_ == "I" + assert doc[2].ent_iob_ == "I" + assert doc[3].ent_iob_ == "B" + with doc.retokenize() as retokenizer: + retokenizer.merge(doc[0:2]) + assert len(doc) == len(words) - 1 + assert doc[0].ent_iob_ == "B" + assert doc[1].ent_iob_ == "I" + + # Test that IOB stays consistent with provided IOB + words = ["a", "b", "c", "d", "e"] + doc = Doc(Vocab(), words=words) + with doc.retokenize() as retokenizer: + attrs = {"ent_type": "ent-abc", "ent_iob": 1} + retokenizer.merge(doc[0:3], attrs=attrs) + retokenizer.merge(doc[3:5], attrs=attrs) + assert doc[0].ent_iob_ == "B" + assert doc[1].ent_iob_ == "I" + + # if no parse/heads, the first word in the span is the root and provides + # default values + words = ["a", "b", "c", "d", "e", "f", "g", "h", "i"] + doc = Doc(Vocab(), words=words) + doc.ents = [ + (doc.vocab.strings.add("ent-de"), 3, 5), + (doc.vocab.strings.add("ent-fg"), 5, 7), + ] + assert doc[3].ent_iob_ == "B" + assert doc[4].ent_iob_ == "I" + assert doc[5].ent_iob_ == "B" + assert doc[6].ent_iob_ == "I" + with doc.retokenize() as retokenizer: + retokenizer.merge(doc[2:4]) + retokenizer.merge(doc[4:6]) + retokenizer.merge(doc[7:9]) + assert len(doc) == 6 + assert doc[3].ent_iob_ == "B" + assert doc[3].ent_type_ == "ent-de" + assert doc[4].ent_iob_ == "B" + assert doc[4].ent_type_ == "ent-fg" + + # if there is a parse, span.root provides default values + words = ["a", "b", "c", "d", "e", "f", "g", "h", "i"] + heads = [0, 0, 3, 0, 0, 0, 5, 0, 0] + ents = ["O"] * len(words) + ents[3] = "B-ent-de" + ents[4] = "I-ent-de" + ents[5] = "B-ent-fg" + ents[6] = "I-ent-fg" + deps = ["dep"] * len(words) + en_vocab.strings.add("ent-de") + en_vocab.strings.add("ent-fg") + en_vocab.strings.add("dep") + doc = Doc(en_vocab, words=words, heads=heads, deps=deps, ents=ents) + assert doc[2:4].root == doc[3] # root of 'c d' is d + assert doc[4:6].root == doc[4] # root is 'e f' is e + with doc.retokenize() as retokenizer: + retokenizer.merge(doc[2:4]) + retokenizer.merge(doc[4:6]) + retokenizer.merge(doc[7:9]) + assert len(doc) == 6 + assert doc[2].ent_iob_ == "B" + assert doc[2].ent_type_ == "ent-de" + assert doc[3].ent_iob_ == "I" + assert doc[3].ent_type_ == "ent-de" + assert doc[4].ent_iob_ == "B" + assert doc[4].ent_type_ == "ent-fg" + + # check that B is preserved if span[start] is B + words = ["a", "b", "c", "d", "e", "f", "g", "h", "i"] + heads = [0, 0, 3, 4, 0, 0, 5, 0, 0] + ents = ["O"] * len(words) + ents[3] = "B-ent-de" + ents[4] = "I-ent-de" + ents[5] = "B-ent-de" + ents[6] = "I-ent-de" + deps = ["dep"] * len(words) + doc = Doc(en_vocab, words=words, heads=heads, deps=deps, ents=ents) + with doc.retokenize() as retokenizer: + retokenizer.merge(doc[3:5]) + retokenizer.merge(doc[5:7]) + assert len(doc) == 7 + assert doc[3].ent_iob_ == "B" + assert doc[3].ent_type_ == "ent-de" + assert doc[4].ent_iob_ == "B" + assert doc[4].ent_type_ == "ent-de" + + +def test_doc_retokenize_spans_sentence_update_after_merge(en_tokenizer): + # fmt: off + text = "Stewart Lee is a stand up comedian. He lives in England and loves Joe Pasquale." + heads = [1, 2, 2, 4, 2, 4, 4, 2, 9, 9, 9, 10, 9, 9, 15, 13, 9] + deps = ['compound', 'nsubj', 'ROOT', 'det', 'amod', 'prt', 'attr', + 'punct', 'nsubj', 'ROOT', 'prep', 'pobj', 'cc', 'conj', + 'compound', 'dobj', 'punct'] + # fmt: on + tokens = en_tokenizer(text) + doc = Doc(tokens.vocab, words=[t.text for t in tokens], heads=heads, deps=deps) + sent1, sent2 = list(doc.sents) + init_len = len(sent1) + init_len2 = len(sent2) + with doc.retokenize() as retokenizer: + attrs = {"lemma": "none", "ent_type": "none"} + retokenizer.merge(doc[0:2], attrs=attrs) + retokenizer.merge(doc[-2:], attrs=attrs) + sent1, sent2 = list(doc.sents) + assert len(sent1) == init_len - 1 + assert len(sent2) == init_len2 - 1 + + +def test_doc_retokenize_spans_subtree_size_check(en_tokenizer): + # fmt: off + text = "Stewart Lee is a stand up comedian who lives in England and loves Joe Pasquale" + heads = [1, 2, 2, 4, 6, 4, 2, 8, 6, 8, 9, 8, 8, 14, 12] + deps = ["compound", "nsubj", "ROOT", "det", "amod", "prt", "attr", + "nsubj", "relcl", "prep", "pobj", "cc", "conj", "compound", + "dobj"] + # fmt: on + tokens = en_tokenizer(text) + doc = Doc(tokens.vocab, words=[t.text for t in tokens], heads=heads, deps=deps) + sent1 = list(doc.sents)[0] + init_len = len(list(sent1.root.subtree)) + with doc.retokenize() as retokenizer: + attrs = {"lemma": "none", "ent_type": "none"} + retokenizer.merge(doc[0:2], attrs=attrs) + assert len(list(sent1.root.subtree)) == init_len - 1 + + +def test_doc_retokenize_merge_extension_attrs(en_vocab): + Token.set_extension("a", default=False, force=True) + Token.set_extension("b", default="nothing", force=True) + doc = Doc(en_vocab, words=["hello", "world", "!"]) + # Test regular merging + with doc.retokenize() as retokenizer: + attrs = {"lemma": "hello world", "_": {"a": True, "b": "1"}} + retokenizer.merge(doc[0:2], attrs=attrs) + assert doc[0].lemma_ == "hello world" + assert doc[0]._.a is True + assert doc[0]._.b == "1" + # Test bulk merging + doc = Doc(en_vocab, words=["hello", "world", "!", "!"]) + with doc.retokenize() as retokenizer: + retokenizer.merge(doc[0:2], attrs={"_": {"a": True, "b": "1"}}) + retokenizer.merge(doc[2:4], attrs={"_": {"a": None, "b": "2"}}) + assert doc[0]._.a is True + assert doc[0]._.b == "1" + assert doc[1]._.a is None + assert doc[1]._.b == "2" + + +@pytest.mark.parametrize("underscore_attrs", [{"a": "x"}, {"b": "x"}, {"c": "x"}, [1]]) +def test_doc_retokenize_merge_extension_attrs_invalid(en_vocab, underscore_attrs): + Token.set_extension("a", getter=lambda x: x, force=True) + Token.set_extension("b", method=lambda x: x, force=True) + doc = Doc(en_vocab, words=["hello", "world", "!"]) + attrs = {"_": underscore_attrs} + with pytest.raises(ValueError): + with doc.retokenize() as retokenizer: + retokenizer.merge(doc[0:2], attrs=attrs) + + +def test_doc_retokenizer_merge_lex_attrs(en_vocab): + """Test that retokenization also sets attributes on the lexeme if they're + lexical attributes. For example, if a user sets IS_STOP, it should mean that + "all tokens with that lexeme" are marked as a stop word, so the ambiguity + here is acceptable. Also see #2390. + """ + # Test regular merging + doc = Doc(en_vocab, words=["hello", "world", "!"]) + assert not any(t.is_stop for t in doc) + with doc.retokenize() as retokenizer: + retokenizer.merge(doc[0:2], attrs={"lemma": "hello world", "is_stop": True}) + assert doc[0].lemma_ == "hello world" + assert doc[0].is_stop + # Test bulk merging + doc = Doc(en_vocab, words=["eins", "zwei", "!", "!"]) + assert not any(t.like_num for t in doc) + assert not any(t.is_stop for t in doc) + with doc.retokenize() as retokenizer: + retokenizer.merge(doc[0:2], attrs={"like_num": True}) + retokenizer.merge(doc[2:4], attrs={"is_stop": True}) + assert doc[0].like_num + assert doc[1].is_stop + assert not doc[0].is_stop + assert not doc[1].like_num + # Test that norm is only set on tokens + doc = Doc(en_vocab, words=["eins", "zwei", "!", "!"]) + assert doc[0].norm_ == "eins" + with doc.retokenize() as retokenizer: + retokenizer.merge(doc[0:1], attrs={"norm": "1"}) + assert doc[0].norm_ == "1" + assert en_vocab["eins"].norm_ == "eins" + + +def test_retokenize_skip_duplicates(en_vocab): + """Test that the retokenizer automatically skips duplicate spans instead + of complaining about overlaps. See #3687.""" + doc = Doc(en_vocab, words=["hello", "world", "!"]) + with doc.retokenize() as retokenizer: + retokenizer.merge(doc[0:2]) + retokenizer.merge(doc[0:2]) + assert len(doc) == 2 + assert doc[0].text == "hello world" + + +def test_retokenize_disallow_zero_length(en_vocab): + doc = Doc(en_vocab, words=["hello", "world", "!"]) + with pytest.raises(ValueError): + with doc.retokenize() as retokenizer: + retokenizer.merge(doc[1:1]) + + +def test_doc_retokenize_merge_without_parse_keeps_sents(en_tokenizer): + text = "displaCy is a parse tool built with Javascript" + sent_starts = [1, 0, 0, 0, 1, 0, 0, 0] + tokens = en_tokenizer(text) + + # merging within a sentence keeps all sentence boundaries + doc = Doc(tokens.vocab, words=[t.text for t in tokens], sent_starts=sent_starts) + assert len(list(doc.sents)) == 2 + with doc.retokenize() as retokenizer: + retokenizer.merge(doc[1:3]) + assert len(list(doc.sents)) == 2 + + # merging over a sentence boundary unsets it by default + doc = Doc(tokens.vocab, words=[t.text for t in tokens], sent_starts=sent_starts) + assert len(list(doc.sents)) == 2 + with doc.retokenize() as retokenizer: + retokenizer.merge(doc[3:6]) + assert doc[3].is_sent_start is None + + # merging over a sentence boundary and setting sent_start + doc = Doc(tokens.vocab, words=[t.text for t in tokens], sent_starts=sent_starts) + assert len(list(doc.sents)) == 2 + with doc.retokenize() as retokenizer: + retokenizer.merge(doc[3:6], attrs={"sent_start": True}) + assert len(list(doc.sents)) == 2 diff --git a/TTS/Kokoro/.venv/Lib/site-packages/spacy/tests/doc/test_retokenize_split.py b/TTS/Kokoro/.venv/Lib/site-packages/spacy/tests/doc/test_retokenize_split.py new file mode 100644 index 0000000000000000000000000000000000000000..3a467bde3456bf22d0a141bae815f97fc939a96d --- /dev/null +++ b/TTS/Kokoro/.venv/Lib/site-packages/spacy/tests/doc/test_retokenize_split.py @@ -0,0 +1,296 @@ +import numpy +import pytest + +from spacy.tokens import Doc, Token +from spacy.vocab import Vocab + + +@pytest.mark.issue(3540) +def test_issue3540(en_vocab): + words = ["I", "live", "in", "NewYork", "right", "now"] + tensor = numpy.asarray( + [[1.0, 1.1], [2.0, 2.1], [3.0, 3.1], [4.0, 4.1], [5.0, 5.1], [6.0, 6.1]], + dtype="f", + ) + doc = Doc(en_vocab, words=words) + doc.tensor = tensor + gold_text = ["I", "live", "in", "NewYork", "right", "now"] + assert [token.text for token in doc] == gold_text + gold_lemma = ["I", "live", "in", "NewYork", "right", "now"] + for i, lemma in enumerate(gold_lemma): + doc[i].lemma_ = lemma + assert [token.lemma_ for token in doc] == gold_lemma + vectors_1 = [token.vector for token in doc] + assert len(vectors_1) == len(doc) + + with doc.retokenize() as retokenizer: + heads = [(doc[3], 1), doc[2]] + attrs = { + "POS": ["PROPN", "PROPN"], + "LEMMA": ["New", "York"], + "DEP": ["pobj", "compound"], + } + retokenizer.split(doc[3], ["New", "York"], heads=heads, attrs=attrs) + + gold_text = ["I", "live", "in", "New", "York", "right", "now"] + assert [token.text for token in doc] == gold_text + gold_lemma = ["I", "live", "in", "New", "York", "right", "now"] + assert [token.lemma_ for token in doc] == gold_lemma + vectors_2 = [token.vector for token in doc] + assert len(vectors_2) == len(doc) + assert vectors_1[0].tolist() == vectors_2[0].tolist() + assert vectors_1[1].tolist() == vectors_2[1].tolist() + assert vectors_1[2].tolist() == vectors_2[2].tolist() + assert vectors_1[4].tolist() == vectors_2[5].tolist() + assert vectors_1[5].tolist() == vectors_2[6].tolist() + + +def test_doc_retokenize_split(en_vocab): + words = ["LosAngeles", "start", "."] + heads = [1, 2, 2] + deps = ["dep"] * len(heads) + doc = Doc(en_vocab, words=words, heads=heads, deps=deps) + assert len(doc) == 3 + assert len(str(doc)) == 19 + assert doc[0].head.text == "start" + assert doc[1].head.text == "." + with doc.retokenize() as retokenizer: + retokenizer.split( + doc[0], + ["Los", "Angeles"], + [(doc[0], 1), doc[1]], + attrs={ + "tag": ["NNP"] * 2, + "lemma": ["Los", "Angeles"], + "ent_type": ["GPE"] * 2, + "morph": ["Number=Sing"] * 2, + }, + ) + assert len(doc) == 4 + assert doc[0].text == "Los" + assert doc[0].head.text == "Angeles" + assert doc[0].idx == 0 + assert str(doc[0].morph) == "Number=Sing" + assert doc[1].idx == 3 + assert doc[1].text == "Angeles" + assert doc[1].head.text == "start" + assert str(doc[1].morph) == "Number=Sing" + assert doc[2].text == "start" + assert doc[2].head.text == "." + assert doc[3].text == "." + assert doc[3].head.text == "." + assert len(str(doc)) == 19 + + +def test_doc_retokenize_split_lemmas(en_vocab): + # If lemmas are not set, leave unset + words = ["LosAngeles", "start", "."] + heads = [1, 2, 2] + deps = ["dep"] * len(heads) + doc = Doc(en_vocab, words=words, heads=heads, deps=deps) + with doc.retokenize() as retokenizer: + retokenizer.split( + doc[0], + ["Los", "Angeles"], + [(doc[0], 1), doc[1]], + ) + assert doc[0].lemma_ == "" + assert doc[1].lemma_ == "" + + # If lemmas are set, use split orth as default lemma + words = ["LosAngeles", "start", "."] + heads = [1, 2, 2] + deps = ["dep"] * len(heads) + doc = Doc(en_vocab, words=words, heads=heads, deps=deps) + for t in doc: + t.lemma_ = "a" + with doc.retokenize() as retokenizer: + retokenizer.split( + doc[0], + ["Los", "Angeles"], + [(doc[0], 1), doc[1]], + ) + assert doc[0].lemma_ == "Los" + assert doc[1].lemma_ == "Angeles" + + +def test_doc_retokenize_split_dependencies(en_vocab): + doc = Doc(en_vocab, words=["LosAngeles", "start", "."]) + dep1 = doc.vocab.strings.add("amod") + dep2 = doc.vocab.strings.add("subject") + with doc.retokenize() as retokenizer: + retokenizer.split( + doc[0], + ["Los", "Angeles"], + [(doc[0], 1), doc[1]], + attrs={"dep": [dep1, dep2]}, + ) + assert doc[0].dep == dep1 + assert doc[1].dep == dep2 + + +def test_doc_retokenize_split_heads_error(en_vocab): + doc = Doc(en_vocab, words=["LosAngeles", "start", "."]) + # Not enough heads + with pytest.raises(ValueError): + with doc.retokenize() as retokenizer: + retokenizer.split(doc[0], ["Los", "Angeles"], [doc[1]]) + + # Too many heads + with pytest.raises(ValueError): + with doc.retokenize() as retokenizer: + retokenizer.split(doc[0], ["Los", "Angeles"], [doc[1], doc[1], doc[1]]) + + +def test_doc_retokenize_spans_entity_split_iob(): + # Test entity IOB stays consistent after merging + words = ["abc", "d", "e"] + doc = Doc(Vocab(), words=words) + doc.ents = [(doc.vocab.strings.add("ent-abcd"), 0, 2)] + assert doc[0].ent_iob_ == "B" + assert doc[1].ent_iob_ == "I" + with doc.retokenize() as retokenizer: + retokenizer.split(doc[0], ["a", "b", "c"], [(doc[0], 1), (doc[0], 2), doc[1]]) + assert doc[0].ent_iob_ == "B" + assert doc[1].ent_iob_ == "I" + assert doc[2].ent_iob_ == "I" + assert doc[3].ent_iob_ == "I" + + +def test_doc_retokenize_spans_sentence_update_after_split(en_vocab): + # fmt: off + words = ["StewartLee", "is", "a", "stand", "up", "comedian", ".", "He", + "lives", "in", "England", "and", "loves", "JoePasquale", "."] + heads = [1, 1, 3, 5, 3, 1, 1, 8, 8, 8, 9, 8, 8, 14, 12] + deps = ["nsubj", "ROOT", "det", "amod", "prt", "attr", "punct", "nsubj", + "ROOT", "prep", "pobj", "cc", "conj", "compound", "punct"] + # fmt: on + doc = Doc(en_vocab, words=words, heads=heads, deps=deps) + sent1, sent2 = list(doc.sents) + init_len = len(sent1) + init_len2 = len(sent2) + with doc.retokenize() as retokenizer: + retokenizer.split( + doc[0], + ["Stewart", "Lee"], + [(doc[0], 1), doc[1]], + attrs={"dep": ["compound", "nsubj"]}, + ) + retokenizer.split( + doc[13], + ["Joe", "Pasquale"], + [(doc[13], 1), doc[12]], + attrs={"dep": ["compound", "dobj"]}, + ) + sent1, sent2 = list(doc.sents) + assert len(sent1) == init_len + 1 + assert len(sent2) == init_len2 + 1 + + +def test_doc_retokenize_split_orths_mismatch(en_vocab): + """Test that the regular retokenizer.split raises an error if the orths + don't match the original token text. There might still be a method that + allows this, but for the default use cases, merging and splitting should + always conform with spaCy's non-destructive tokenization policy. Otherwise, + it can lead to very confusing and unexpected results. + """ + doc = Doc(en_vocab, words=["LosAngeles", "start", "."]) + with pytest.raises(ValueError): + with doc.retokenize() as retokenizer: + retokenizer.split(doc[0], ["L", "A"], [(doc[0], 0), (doc[0], 0)]) + + +def test_doc_retokenize_split_extension_attrs(en_vocab): + Token.set_extension("a", default=False, force=True) + Token.set_extension("b", default="nothing", force=True) + doc = Doc(en_vocab, words=["LosAngeles", "start"]) + with doc.retokenize() as retokenizer: + heads = [(doc[0], 1), doc[1]] + underscore = [{"a": True, "b": "1"}, {"b": "2"}] + attrs = {"lemma": ["los", "angeles"], "_": underscore} + retokenizer.split(doc[0], ["Los", "Angeles"], heads, attrs=attrs) + assert doc[0].lemma_ == "los" + assert doc[0]._.a is True + assert doc[0]._.b == "1" + assert doc[1].lemma_ == "angeles" + assert doc[1]._.a is False + assert doc[1]._.b == "2" + + +@pytest.mark.parametrize( + "underscore_attrs", + [ + [{"a": "x"}, {}], # Overwriting getter without setter + [{"b": "x"}, {}], # Overwriting method + [{"c": "x"}, {}], # Overwriting nonexistent attribute + [{"a": "x"}, {"x": "x"}], # Combination + [{"a": "x", "x": "x"}, {"x": "x"}], # Combination + {"x": "x"}, # Not a list of dicts + ], +) +def test_doc_retokenize_split_extension_attrs_invalid(en_vocab, underscore_attrs): + Token.set_extension("x", default=False, force=True) + Token.set_extension("a", getter=lambda x: x, force=True) + Token.set_extension("b", method=lambda x: x, force=True) + doc = Doc(en_vocab, words=["LosAngeles", "start"]) + attrs = {"_": underscore_attrs} + with pytest.raises(ValueError): + with doc.retokenize() as retokenizer: + heads = [(doc[0], 1), doc[1]] + retokenizer.split(doc[0], ["Los", "Angeles"], heads, attrs=attrs) + + +def test_doc_retokenizer_split_lex_attrs(en_vocab): + """Test that retokenization also sets attributes on the lexeme if they're + lexical attributes. For example, if a user sets IS_STOP, it should mean that + "all tokens with that lexeme" are marked as a stop word, so the ambiguity + here is acceptable. Also see #2390. + """ + assert not Doc(en_vocab, words=["Los"])[0].is_stop + assert not Doc(en_vocab, words=["Angeles"])[0].is_stop + doc = Doc(en_vocab, words=["LosAngeles", "start"]) + assert not doc[0].is_stop + with doc.retokenize() as retokenizer: + attrs = {"is_stop": [True, False]} + heads = [(doc[0], 1), doc[1]] + retokenizer.split(doc[0], ["Los", "Angeles"], heads, attrs=attrs) + assert doc[0].is_stop + assert not doc[1].is_stop + + +def test_doc_retokenizer_realloc(en_vocab): + """#4604: realloc correctly when new tokens outnumber original tokens""" + text = "Hyperglycemic adverse events following antipsychotic drug administration in the" + doc = Doc(en_vocab, words=text.split()[:-1]) + with doc.retokenize() as retokenizer: + token = doc[0] + heads = [(token, 0)] * len(token) + retokenizer.split(doc[token.i], list(token.text), heads=heads) + doc = Doc(en_vocab, words=text.split()) + with doc.retokenize() as retokenizer: + token = doc[0] + heads = [(token, 0)] * len(token) + retokenizer.split(doc[token.i], list(token.text), heads=heads) + + +def test_doc_retokenizer_split_norm(en_vocab): + """#6060: reset norm in split""" + text = "The quick brownfoxjumpsoverthe lazy dog w/ white spots" + doc = Doc(en_vocab, words=text.split()) + + # Set custom norm on the w/ token. + doc[5].norm_ = "with" + + # Retokenize to split out the words in the token at doc[2]. + token = doc[2] + with doc.retokenize() as retokenizer: + retokenizer.split( + token, + ["brown", "fox", "jumps", "over", "the"], + heads=[(token, idx) for idx in range(5)], + ) + + assert doc[9].text == "w/" + assert doc[9].norm_ == "with" + assert doc[5].text == "over" + assert doc[5].norm_ == "over" diff --git a/TTS/Kokoro/.venv/Lib/site-packages/spacy/tests/doc/test_span.py b/TTS/Kokoro/.venv/Lib/site-packages/spacy/tests/doc/test_span.py new file mode 100644 index 0000000000000000000000000000000000000000..e8d9dba124b8fa44202a53a6896348d1bd070146 --- /dev/null +++ b/TTS/Kokoro/.venv/Lib/site-packages/spacy/tests/doc/test_span.py @@ -0,0 +1,757 @@ +import numpy +import pytest +from numpy.testing import assert_array_equal +from thinc.api import get_current_ops + +from spacy.attrs import LENGTH, ORTH +from spacy.lang.en import English +from spacy.tokens import Doc, Span, Token +from spacy.util import filter_spans +from spacy.vocab import Vocab + +from ..util import add_vecs_to_vocab +from .test_underscore import clean_underscore # noqa: F401 + + +@pytest.fixture +def doc(en_tokenizer): + # fmt: off + text = "This is a sentence. This is another sentence. And a third." + heads = [1, 1, 3, 1, 1, 6, 6, 8, 6, 6, 12, 12, 12, 12] + deps = ["nsubj", "ROOT", "det", "attr", "punct", "nsubj", "ROOT", "det", + "attr", "punct", "ROOT", "det", "npadvmod", "punct"] + ents = ["O", "O", "B-ENT", "I-ENT", "I-ENT", "I-ENT", "I-ENT", "O", "O", + "O", "O", "O", "O", "O"] + # fmt: on + tokens = en_tokenizer(text) + lemmas = [t.text for t in tokens] # this is not correct, just a placeholder + spaces = [bool(t.whitespace_) for t in tokens] + return Doc( + tokens.vocab, + words=[t.text for t in tokens], + spaces=spaces, + heads=heads, + deps=deps, + ents=ents, + lemmas=lemmas, + ) + + +@pytest.fixture +def doc_not_parsed(en_tokenizer): + text = "This is a sentence. This is another sentence. And a third." + tokens = en_tokenizer(text) + doc = Doc(tokens.vocab, words=[t.text for t in tokens]) + return doc + + +@pytest.mark.issue(1537) +def test_issue1537(): + """Test that Span.as_doc() doesn't segfault.""" + string = "The sky is blue . The man is pink . The dog is purple ." + doc = Doc(Vocab(), words=list(string.split())) + doc[0].sent_start = True + for word in doc[1:]: + if word.nbor(-1).text == ".": + word.sent_start = True + else: + word.sent_start = False + sents = list(doc.sents) + sent0 = sents[0].as_doc() + sent1 = sents[1].as_doc() + assert isinstance(sent0, Doc) + assert isinstance(sent1, Doc) + + +@pytest.mark.issue(1612) +def test_issue1612(en_tokenizer): + """Test that span.orth_ is identical to span.text""" + doc = en_tokenizer("The black cat purrs.") + span = doc[1:3] + assert span.orth_ == span.text + + +@pytest.mark.issue(3199) +def test_issue3199(): + """Test that Span.noun_chunks works correctly if no noun chunks iterator + is available. To make this test future-proof, we're constructing a Doc + with a new Vocab here and a parse tree to make sure the noun chunks run. + """ + words = ["This", "is", "a", "sentence"] + doc = Doc(Vocab(), words=words, heads=[0] * len(words), deps=["dep"] * len(words)) + with pytest.raises(NotImplementedError): + list(doc[0:3].noun_chunks) + + +@pytest.mark.issue(5152) +def test_issue5152(): + # Test that the comparison between a Span and a Token, goes well + # There was a bug when the number of tokens in the span equaled the number of characters in the token (!) + nlp = English() + text = nlp("Talk about being boring!") + text_var = nlp("Talk of being boring!") + y = nlp("Let") + span = text[0:3] # Talk about being + span_2 = text[0:3] # Talk about being + span_3 = text_var[0:3] # Talk of being + token = y[0] # Let + with pytest.warns(UserWarning): + assert span.similarity(token) == 0.0 + assert span.similarity(span_2) == 1.0 + with pytest.warns(UserWarning): + assert span_2.similarity(span_3) < 1.0 + + +@pytest.mark.issue(6755) +def test_issue6755(en_tokenizer): + doc = en_tokenizer("This is a magnificent sentence.") + span = doc[:0] + assert span.text_with_ws == "" + assert span.text == "" + + +@pytest.mark.parametrize( + "sentence, start_idx,end_idx,label", + [("Welcome to Mumbai, my friend", 11, 17, "GPE")], +) +@pytest.mark.issue(6815) +def test_issue6815_1(sentence, start_idx, end_idx, label): + nlp = English() + doc = nlp(sentence) + span = doc[:].char_span(start_idx, end_idx, label=label) + assert span.label_ == label + + +@pytest.mark.parametrize( + "sentence, start_idx,end_idx,kb_id", [("Welcome to Mumbai, my friend", 11, 17, 5)] +) +@pytest.mark.issue(6815) +def test_issue6815_2(sentence, start_idx, end_idx, kb_id): + nlp = English() + doc = nlp(sentence) + span = doc[:].char_span(start_idx, end_idx, kb_id=kb_id) + assert span.kb_id == kb_id + + +@pytest.mark.parametrize( + "sentence, start_idx,end_idx,vector", + [("Welcome to Mumbai, my friend", 11, 17, numpy.array([0.1, 0.2, 0.3]))], +) +@pytest.mark.issue(6815) +def test_issue6815_3(sentence, start_idx, end_idx, vector): + nlp = English() + doc = nlp(sentence) + span = doc[:].char_span(start_idx, end_idx, vector=vector) + assert (span.vector == vector).all() + + +@pytest.mark.parametrize( + "i_sent,i,j,text", + [ + (0, 0, len("This is a"), "This is a"), + (1, 0, len("This is another"), "This is another"), + (2, len("And "), len("And ") + len("a third"), "a third"), + (0, 1, 2, None), + ], +) +def test_char_span(doc, i_sent, i, j, text): + sents = list(doc.sents) + span = sents[i_sent].char_span(i, j) + if not text: + assert not span + else: + assert span.text == text + + +def test_char_span_attributes(doc): + label = "LABEL" + kb_id = "KB_ID" + span_id = "SPAN_ID" + span1 = doc.char_span(20, 45, label=label, kb_id=kb_id, span_id=span_id) + span2 = doc[1:].char_span(15, 40, label=label, kb_id=kb_id, span_id=span_id) + assert span1.text == span2.text + assert span1.label_ == span2.label_ == label + assert span1.kb_id_ == span2.kb_id_ == kb_id + assert span1.id_ == span2.id_ == span_id + + +def test_spans_sent_spans(doc): + sents = list(doc.sents) + assert sents[0].start == 0 + assert sents[0].end == 5 + assert len(sents) == 3 + assert sum(len(sent) for sent in sents) == len(doc) + + +def test_spans_root(doc): + span = doc[2:4] + assert len(span) == 2 + assert span.text == "a sentence" + assert span.root.text == "sentence" + assert span.root.head.text == "is" + + +def test_spans_string_fn(doc): + span = doc[0:4] + assert len(span) == 4 + assert span.text == "This is a sentence" + + +def test_spans_root2(en_tokenizer): + text = "through North and South Carolina" + heads = [0, 4, 1, 1, 0] + deps = ["dep"] * len(heads) + tokens = en_tokenizer(text) + doc = Doc(tokens.vocab, words=[t.text for t in tokens], heads=heads, deps=deps) + assert doc[-2:].root.text == "Carolina" + + +def test_spans_span_sent(doc, doc_not_parsed): + """Test span.sent property""" + assert len(list(doc.sents)) + assert doc[:2].sent.root.text == "is" + assert doc[:2].sent.text == "This is a sentence." + assert doc[6:7].sent.root.left_edge.text == "This" + assert doc[0 : len(doc)].sent == list(doc.sents)[0] + assert list(doc[0 : len(doc)].sents) == list(doc.sents) + + with pytest.raises(ValueError): + doc_not_parsed[:2].sent + + # test on manual sbd + doc_not_parsed[0].is_sent_start = True + doc_not_parsed[5].is_sent_start = True + assert doc_not_parsed[1:3].sent == doc_not_parsed[0:5] + assert doc_not_parsed[10:14].sent == doc_not_parsed[5:] + + +def test_issue13769(): + # Test issue 13769: Incorrect output of span.sents when final token is a sentence outside of the span. + doc = Doc( + Vocab(), + words=list("This is a sentence . This is another sentence . Third".split()), + ) + doc[0].is_sent_start = True + doc[5].is_sent_start = True + doc[10].is_sent_start = True + doc.ents = [("ENTITY", 7, 9)] # "another sentence" phrase in the second sentence + entity = doc.ents[0] + ent_sents = list(entity.sents) + assert len(ent_sents) == 1 + + +@pytest.mark.parametrize( + "start,end,expected_sentence", + [ + (0, 14, "This is"), # Entire doc + (1, 4, "This is"), # Overlapping with 2 sentences + (0, 2, "This is"), # Beginning of the Doc. Full sentence + (0, 1, "This is"), # Beginning of the Doc. Part of a sentence + (10, 14, "And a"), # End of the Doc. Overlapping with 2 senteces + (12, 14, "third."), # End of the Doc. Full sentence + (1, 1, "This is"), # Empty Span + ], +) +def test_spans_span_sent_user_hooks(doc, start, end, expected_sentence): + + # Doc-level sents hook + def user_hook(doc): + return [doc[ii : ii + 2] for ii in range(0, len(doc), 2)] + + doc.user_hooks["sents"] = user_hook + + # Make sure doc-level sents hook works + assert doc[start:end].sent.text == expected_sentence + + # Span-level sent hook + doc.user_span_hooks["sent"] = lambda x: x + # Now, span=level sent hook overrides the doc-level sents hook + assert doc[start:end].sent == doc[start:end] + + +def test_spans_lca_matrix(en_tokenizer): + """Test span's lca matrix generation""" + tokens = en_tokenizer("the lazy dog slept") + doc = Doc( + tokens.vocab, + words=[t.text for t in tokens], + heads=[2, 2, 3, 3], + deps=["dep"] * 4, + ) + lca = doc[:2].get_lca_matrix() + assert lca.shape == (2, 2) + assert lca[0, 0] == 0 # the & the -> the + assert lca[0, 1] == -1 # the & lazy -> dog (out of span) + assert lca[1, 0] == -1 # lazy & the -> dog (out of span) + assert lca[1, 1] == 1 # lazy & lazy -> lazy + + lca = doc[1:].get_lca_matrix() + assert lca.shape == (3, 3) + assert lca[0, 0] == 0 # lazy & lazy -> lazy + assert lca[0, 1] == 1 # lazy & dog -> dog + assert lca[0, 2] == 2 # lazy & slept -> slept + + lca = doc[2:].get_lca_matrix() + assert lca.shape == (2, 2) + assert lca[0, 0] == 0 # dog & dog -> dog + assert lca[0, 1] == 1 # dog & slept -> slept + assert lca[1, 0] == 1 # slept & dog -> slept + assert lca[1, 1] == 1 # slept & slept -> slept + + # example from Span API docs + tokens = en_tokenizer("I like New York in Autumn") + doc = Doc( + tokens.vocab, + words=[t.text for t in tokens], + heads=[1, 1, 3, 1, 3, 4], + deps=["dep"] * len(tokens), + ) + lca = doc[1:4].get_lca_matrix() + assert_array_equal(lca, numpy.asarray([[0, 0, 0], [0, 1, 2], [0, 2, 2]])) + + +def test_span_similarity_match(): + doc = Doc(Vocab(), words=["a", "b", "a", "b"]) + span1 = doc[:2] + span2 = doc[2:] + with pytest.warns(UserWarning): + assert span1.similarity(span2) == 1.0 + assert span1.similarity(doc) == 0.0 + assert span1[:1].similarity(doc.vocab["a"]) == 1.0 + + +def test_spans_default_sentiment(en_tokenizer): + """Test span.sentiment property's default averaging behaviour""" + text = "good stuff bad stuff" + tokens = en_tokenizer(text) + tokens.vocab[tokens[0].text].sentiment = 3.0 + tokens.vocab[tokens[2].text].sentiment = -2.0 + doc = Doc(tokens.vocab, words=[t.text for t in tokens]) + assert doc[:2].sentiment == 3.0 / 2 + assert doc[-2:].sentiment == -2.0 / 2 + assert doc[:-1].sentiment == (3.0 + -2) / 3.0 + + +def test_spans_override_sentiment(en_tokenizer): + """Test span.sentiment property's default averaging behaviour""" + text = "good stuff bad stuff" + tokens = en_tokenizer(text) + tokens.vocab[tokens[0].text].sentiment = 3.0 + tokens.vocab[tokens[2].text].sentiment = -2.0 + doc = Doc(tokens.vocab, words=[t.text for t in tokens]) + doc.user_span_hooks["sentiment"] = lambda span: 10.0 + assert doc[:2].sentiment == 10.0 + assert doc[-2:].sentiment == 10.0 + assert doc[:-1].sentiment == 10.0 + + +def test_spans_are_hashable(en_tokenizer): + """Test spans can be hashed.""" + text = "good stuff bad stuff" + tokens = en_tokenizer(text) + span1 = tokens[:2] + span2 = tokens[2:4] + assert hash(span1) != hash(span2) + span3 = tokens[0:2] + assert hash(span3) == hash(span1) + + +def test_spans_by_character(doc): + span1 = doc[1:-2] + + # default and specified alignment mode "strict" + span2 = doc.char_span(span1.start_char, span1.end_char, label="GPE") + assert span1.start_char == span2.start_char + assert span1.end_char == span2.end_char + assert span2.label_ == "GPE" + + span2 = doc.char_span( + span1.start_char, span1.end_char, label="GPE", alignment_mode="strict" + ) + assert span1.start_char == span2.start_char + assert span1.end_char == span2.end_char + assert span2.label_ == "GPE" + + # alignment mode "contract" + span2 = doc.char_span( + span1.start_char - 3, span1.end_char, label="GPE", alignment_mode="contract" + ) + assert span1.start_char == span2.start_char + assert span1.end_char == span2.end_char + assert span2.label_ == "GPE" + + # alignment mode "expand" + span2 = doc.char_span( + span1.start_char + 1, span1.end_char, label="GPE", alignment_mode="expand" + ) + assert span1.start_char == span2.start_char + assert span1.end_char == span2.end_char + assert span2.label_ == "GPE" + + # unsupported alignment mode + with pytest.raises(ValueError): + span2 = doc.char_span( + span1.start_char + 1, span1.end_char, label="GPE", alignment_mode="unk" + ) + + # Span.char_span + alignment mode "contract" + span2 = doc[0:2].char_span( + span1.start_char - 3, span1.end_char, label="GPE", alignment_mode="contract" + ) + assert span1.start_char == span2.start_char + assert span1.end_char == span2.end_char + assert span2.label_ == "GPE" + + +def test_span_to_array(doc): + span = doc[1:-2] + arr = span.to_array([ORTH, LENGTH]) + assert arr.shape == (len(span), 2) + assert arr[0, 0] == span[0].orth + assert arr[0, 1] == len(span[0]) + + +def test_span_as_doc(doc): + span = doc[4:10] + span_doc = span.as_doc() + assert span.text == span_doc.text.strip() + assert isinstance(span_doc, doc.__class__) + assert span_doc is not doc + assert span_doc[0].idx == 0 + + # partial initial entity is removed + assert len(span_doc.ents) == 0 + + # full entity is preserved + span_doc = doc[2:10].as_doc() + assert len(span_doc.ents) == 1 + + # partial final entity is removed + span_doc = doc[0:5].as_doc() + assert len(span_doc.ents) == 0 + + +@pytest.mark.usefixtures("clean_underscore") +def test_span_as_doc_user_data(doc): + """Test that the user_data can be preserved (but not by default).""" + my_key = "my_info" + my_value = 342 + doc.user_data[my_key] = my_value + Token.set_extension("is_x", default=False) + doc[7]._.is_x = True + + span = doc[4:10] + span_doc_with = span.as_doc(copy_user_data=True) + span_doc_without = span.as_doc() + + assert doc.user_data.get(my_key, None) is my_value + assert span_doc_with.user_data.get(my_key, None) is my_value + assert span_doc_without.user_data.get(my_key, None) is None + for i in range(len(span_doc_with)): + if i != 3: + assert span_doc_with[i]._.is_x is False + else: + assert span_doc_with[i]._.is_x is True + assert not any([t._.is_x for t in span_doc_without]) + + +def test_span_string_label_kb_id(doc): + span = Span(doc, 0, 1, label="hello", kb_id="Q342") + assert span.label_ == "hello" + assert span.label == doc.vocab.strings["hello"] + assert span.kb_id_ == "Q342" + assert span.kb_id == doc.vocab.strings["Q342"] + + +def test_span_string_label_id(doc): + span = Span(doc, 0, 1, label="hello", span_id="Q342") + assert span.label_ == "hello" + assert span.label == doc.vocab.strings["hello"] + assert span.id_ == "Q342" + assert span.id == doc.vocab.strings["Q342"] + + +def test_span_attrs_writable(doc): + span = Span(doc, 0, 1) + span.label_ = "label" + span.kb_id_ = "kb_id" + span.id_ = "id" + + +def test_span_ents_property(doc): + doc.ents = [ + (doc.vocab.strings["PRODUCT"], 0, 1), + (doc.vocab.strings["PRODUCT"], 7, 8), + (doc.vocab.strings["PRODUCT"], 11, 14), + ] + assert len(list(doc.ents)) == 3 + sentences = list(doc.sents) + assert len(sentences) == 3 + assert len(sentences[0].ents) == 1 + # First sentence, also tests start of sentence + assert sentences[0].ents[0].text == "This" + assert sentences[0].ents[0].label_ == "PRODUCT" + assert sentences[0].ents[0].start == 0 + assert sentences[0].ents[0].end == 1 + # Second sentence + assert len(sentences[1].ents) == 1 + assert sentences[1].ents[0].text == "another" + assert sentences[1].ents[0].label_ == "PRODUCT" + assert sentences[1].ents[0].start == 7 + assert sentences[1].ents[0].end == 8 + # Third sentence ents, Also tests end of sentence + assert sentences[2].ents[0].text == "a third." + assert sentences[2].ents[0].label_ == "PRODUCT" + assert sentences[2].ents[0].start == 11 + assert sentences[2].ents[0].end == 14 + + +def test_filter_spans(doc): + # Test filtering duplicates + spans = [doc[1:4], doc[6:8], doc[1:4], doc[10:14]] + filtered = filter_spans(spans) + assert len(filtered) == 3 + assert filtered[0].start == 1 and filtered[0].end == 4 + assert filtered[1].start == 6 and filtered[1].end == 8 + assert filtered[2].start == 10 and filtered[2].end == 14 + # Test filtering overlaps with longest preference + spans = [doc[1:4], doc[1:3], doc[5:10], doc[7:9], doc[1:4]] + filtered = filter_spans(spans) + assert len(filtered) == 2 + assert len(filtered[0]) == 3 + assert len(filtered[1]) == 5 + assert filtered[0].start == 1 and filtered[0].end == 4 + assert filtered[1].start == 5 and filtered[1].end == 10 + # Test filtering overlaps with earlier preference for identical length + spans = [doc[1:4], doc[2:5], doc[5:10], doc[7:9], doc[1:4]] + filtered = filter_spans(spans) + assert len(filtered) == 2 + assert len(filtered[0]) == 3 + assert len(filtered[1]) == 5 + assert filtered[0].start == 1 and filtered[0].end == 4 + assert filtered[1].start == 5 and filtered[1].end == 10 + + +def test_span_eq_hash(doc, doc_not_parsed): + assert doc[0:2] == doc[0:2] + assert doc[0:2] != doc[1:3] + assert doc[0:2] != doc_not_parsed[0:2] + assert hash(doc[0:2]) == hash(doc[0:2]) + assert hash(doc[0:2]) != hash(doc[1:3]) + assert hash(doc[0:2]) != hash(doc_not_parsed[0:2]) + + # check that an out-of-bounds is not equivalent to the span of the full doc + assert doc[0 : len(doc)] != doc[len(doc) : len(doc) + 1] + + +def test_span_boundaries(doc): + start = 1 + end = 5 + span = doc[start:end] + for i in range(start, end): + assert span[i - start] == doc[i] + with pytest.raises(IndexError): + span[-5] + with pytest.raises(IndexError): + span[5] + + empty_span_0 = doc[0:0] + assert empty_span_0.text == "" + assert empty_span_0.start == 0 + assert empty_span_0.end == 0 + assert empty_span_0.start_char == 0 + assert empty_span_0.end_char == 0 + + empty_span_1 = doc[1:1] + assert empty_span_1.text == "" + assert empty_span_1.start == 1 + assert empty_span_1.end == 1 + assert empty_span_1.start_char == empty_span_1.end_char + + oob_span_start = doc[-len(doc) - 1 : -len(doc) - 10] + assert oob_span_start.text == "" + assert oob_span_start.start == 0 + assert oob_span_start.end == 0 + assert oob_span_start.start_char == 0 + assert oob_span_start.end_char == 0 + + oob_span_end = doc[len(doc) + 1 : len(doc) + 10] + assert oob_span_end.text == "" + assert oob_span_end.start == len(doc) + assert oob_span_end.end == len(doc) + assert oob_span_end.start_char == len(doc.text) + assert oob_span_end.end_char == len(doc.text) + + +def test_span_lemma(doc): + # span lemmas should have the same number of spaces as the span + sp = doc[1:5] + assert len(sp.text.split(" ")) == len(sp.lemma_.split(" ")) + + +def test_sent(en_tokenizer): + doc = en_tokenizer("Check span.sent raises error if doc is not sentencized.") + span = doc[1:3] + assert not span.doc.has_annotation("SENT_START") + with pytest.raises(ValueError): + span.sent + + +def test_span_with_vectors(doc): + ops = get_current_ops() + prev_vectors = doc.vocab.vectors + vectors = [ + ("apple", ops.asarray([1, 2, 3])), + ("orange", ops.asarray([-1, -2, -3])), + ("And", ops.asarray([-1, -1, -1])), + ("juice", ops.asarray([5, 5, 10])), + ("pie", ops.asarray([7, 6.3, 8.9])), + ] + add_vecs_to_vocab(doc.vocab, vectors) + # 0-length span + assert_array_equal(ops.to_numpy(doc[0:0].vector), numpy.zeros((3,))) + # longer span with no vector + assert_array_equal(ops.to_numpy(doc[0:4].vector), numpy.zeros((3,))) + # single-token span with vector + assert_array_equal(ops.to_numpy(doc[10:11].vector), [-1, -1, -1]) + doc.vocab.vectors = prev_vectors + + +# fmt: off +def test_span_comparison(doc): + + # Identical start, end, only differ in label and kb_id + assert Span(doc, 0, 3) == Span(doc, 0, 3) + assert Span(doc, 0, 3, "LABEL") == Span(doc, 0, 3, "LABEL") + assert Span(doc, 0, 3, "LABEL", kb_id="KB_ID") == Span(doc, 0, 3, "LABEL", kb_id="KB_ID") + + assert Span(doc, 0, 3) != Span(doc, 0, 3, "LABEL") + assert Span(doc, 0, 3) != Span(doc, 0, 3, "LABEL", kb_id="KB_ID") + assert Span(doc, 0, 3, "LABEL") != Span(doc, 0, 3, "LABEL", kb_id="KB_ID") + + assert Span(doc, 0, 3) <= Span(doc, 0, 3) and Span(doc, 0, 3) >= Span(doc, 0, 3) + assert Span(doc, 0, 3, "LABEL") <= Span(doc, 0, 3, "LABEL") and Span(doc, 0, 3, "LABEL") >= Span(doc, 0, 3, "LABEL") + assert Span(doc, 0, 3, "LABEL", kb_id="KB_ID") <= Span(doc, 0, 3, "LABEL", kb_id="KB_ID") + assert Span(doc, 0, 3, "LABEL", kb_id="KB_ID") >= Span(doc, 0, 3, "LABEL", kb_id="KB_ID") + + assert (Span(doc, 0, 3) < Span(doc, 0, 3, "", kb_id="KB_ID") < Span(doc, 0, 3, "LABEL") < Span(doc, 0, 3, "LABEL", kb_id="KB_ID")) + assert (Span(doc, 0, 3) <= Span(doc, 0, 3, "", kb_id="KB_ID") <= Span(doc, 0, 3, "LABEL") <= Span(doc, 0, 3, "LABEL", kb_id="KB_ID")) + + assert (Span(doc, 0, 3, "LABEL", kb_id="KB_ID") > Span(doc, 0, 3, "LABEL") > Span(doc, 0, 3, "", kb_id="KB_ID") > Span(doc, 0, 3)) + assert (Span(doc, 0, 3, "LABEL", kb_id="KB_ID") >= Span(doc, 0, 3, "LABEL") >= Span(doc, 0, 3, "", kb_id="KB_ID") >= Span(doc, 0, 3)) + + # Different end + assert Span(doc, 0, 3, "LABEL", kb_id="KB_ID") < Span(doc, 0, 4, "LABEL", kb_id="KB_ID") + + assert Span(doc, 0, 3, "LABEL", kb_id="KB_ID") < Span(doc, 0, 4) + assert Span(doc, 0, 3, "LABEL", kb_id="KB_ID") <= Span(doc, 0, 4) + assert Span(doc, 0, 4) > Span(doc, 0, 3, "LABEL", kb_id="KB_ID") + assert Span(doc, 0, 4) >= Span(doc, 0, 3, "LABEL", kb_id="KB_ID") + + # Different start + assert Span(doc, 0, 3, "LABEL", kb_id="KB_ID") != Span(doc, 1, 3, "LABEL", kb_id="KB_ID") + + assert Span(doc, 0, 3, "LABEL", kb_id="KB_ID") < Span(doc, 1, 3) + assert Span(doc, 0, 3, "LABEL", kb_id="KB_ID") <= Span(doc, 1, 3) + assert Span(doc, 1, 3) > Span(doc, 0, 3, "LABEL", kb_id="KB_ID") + assert Span(doc, 1, 3) >= Span(doc, 0, 3, "LABEL", kb_id="KB_ID") + + # Different start & different end + assert Span(doc, 0, 4, "LABEL", kb_id="KB_ID") != Span(doc, 1, 3, "LABEL", kb_id="KB_ID") + + assert Span(doc, 0, 4, "LABEL", kb_id="KB_ID") < Span(doc, 1, 3) + assert Span(doc, 0, 4, "LABEL", kb_id="KB_ID") <= Span(doc, 1, 3) + assert Span(doc, 1, 3) > Span(doc, 0, 4, "LABEL", kb_id="KB_ID") + assert Span(doc, 1, 3) >= Span(doc, 0, 4, "LABEL", kb_id="KB_ID") + + # Different id + assert Span(doc, 1, 3, span_id="AAA") < Span(doc, 1, 3, span_id="BBB") +# fmt: on + + +@pytest.mark.parametrize( + "start,end,expected_sentences,expected_sentences_with_hook", + [ + (0, 14, 3, 7), # Entire doc + (3, 6, 2, 2), # Overlapping with 2 sentences + (0, 4, 1, 2), # Beginning of the Doc. Full sentence + (0, 3, 1, 2), # Beginning of the Doc. Part of a sentence + (9, 14, 2, 3), # End of the Doc. Overlapping with 2 senteces + (10, 14, 1, 2), # End of the Doc. Full sentence + (11, 14, 1, 2), # End of the Doc. Partial sentence + (0, 0, 1, 1), # Empty Span + ], +) +def test_span_sents(doc, start, end, expected_sentences, expected_sentences_with_hook): + + assert len(list(doc[start:end].sents)) == expected_sentences + + def user_hook(doc): + return [doc[ii : ii + 2] for ii in range(0, len(doc), 2)] + + doc.user_hooks["sents"] = user_hook + + assert len(list(doc[start:end].sents)) == expected_sentences_with_hook + + doc.user_span_hooks["sents"] = lambda x: [x] + + assert list(doc[start:end].sents)[0] == doc[start:end] + assert len(list(doc[start:end].sents)) == 1 + + +def test_span_sents_not_parsed(doc_not_parsed): + with pytest.raises(ValueError): + list(Span(doc_not_parsed, 0, 3).sents) + + +def test_span_group_copy(doc): + doc.spans["test"] = [doc[0:1], doc[2:4]] + assert len(doc.spans["test"]) == 2 + doc_copy = doc.copy() + # check that the spans were indeed copied + assert len(doc_copy.spans["test"]) == 2 + # add a new span to the original doc + doc.spans["test"].append(doc[3:4]) + assert len(doc.spans["test"]) == 3 + # check that the copy spans were not modified and this is an isolated doc + assert len(doc_copy.spans["test"]) == 2 + + +def test_for_partial_ent_sents(): + """Spans may be associated with multiple sentences. These .sents should always be complete, not partial, sentences, + which this tests for. + """ + doc = Doc( + English().vocab, + words=["Mahler's", "Symphony", "No.", "8", "was", "beautiful."], + sent_starts=[1, 0, 0, 1, 0, 0], + ) + doc.set_ents([Span(doc, 1, 4, "WORK")]) + # The specified entity is associated with both sentences in this doc, so we expect all sentences in the doc to be + # equal to the sentences referenced in ent.sents. + for doc_sent, ent_sent in zip(doc.sents, doc.ents[0].sents): + assert doc_sent == ent_sent + + +def test_for_no_ent_sents(): + """Span.sents() should set .sents correctly, even if Span in question is trailing and doesn't form a full + sentence. + """ + doc = Doc( + English().vocab, + words=["This", "is", "a", "test.", "ENTITY"], + sent_starts=[1, 0, 0, 0, 1], + ) + doc.set_ents([Span(doc, 4, 5, "WORK")]) + sents = list(doc.ents[0].sents) + assert len(sents) == 1 + assert str(sents[0]) == str(doc.ents[0].sent) == "ENTITY" + + +def test_span_api_richcmp_other(en_tokenizer): + doc1 = en_tokenizer("a b") + doc2 = en_tokenizer("b c") + assert not doc1[1:2] == doc1[1] + assert not doc1[1:2] == doc2[0] + assert not doc1[1:2] == doc2[0:1] + assert not doc1[0:1] == doc2 diff --git a/TTS/Kokoro/.venv/Lib/site-packages/spacy/tests/doc/test_span_group.py b/TTS/Kokoro/.venv/Lib/site-packages/spacy/tests/doc/test_span_group.py new file mode 100644 index 0000000000000000000000000000000000000000..9c7cc05d325e625661c33bd966f4f6fbea0a459e --- /dev/null +++ b/TTS/Kokoro/.venv/Lib/site-packages/spacy/tests/doc/test_span_group.py @@ -0,0 +1,280 @@ +from random import Random +from typing import List + +import pytest + +from spacy.matcher import Matcher +from spacy.tokens import Doc, Span, SpanGroup +from spacy.util import filter_spans + + +@pytest.fixture +def doc(en_tokenizer): + doc = en_tokenizer("0 1 2 3 4 5 6") + matcher = Matcher(en_tokenizer.vocab, validate=True) + + # fmt: off + matcher.add("4", [[{}, {}, {}, {}]]) + matcher.add("2", [[{}, {}, ]]) + matcher.add("1", [[{}, ]]) + # fmt: on + matches = matcher(doc) + spans = [] + for match in matches: + spans.append( + Span(doc, match[1], match[2], en_tokenizer.vocab.strings[match[0]]) + ) + Random(42).shuffle(spans) + doc.spans["SPANS"] = SpanGroup( + doc, name="SPANS", attrs={"key": "value"}, spans=spans + ) + return doc + + +@pytest.fixture +def other_doc(en_tokenizer): + doc = en_tokenizer("0 1 2 3 4 5 6") + matcher = Matcher(en_tokenizer.vocab, validate=True) + + # fmt: off + matcher.add("4", [[{}, {}, {}, {}]]) + matcher.add("2", [[{}, {}, ]]) + matcher.add("1", [[{}, ]]) + # fmt: on + + matches = matcher(doc) + spans = [] + for match in matches: + spans.append( + Span(doc, match[1], match[2], en_tokenizer.vocab.strings[match[0]]) + ) + Random(42).shuffle(spans) + doc.spans["SPANS"] = SpanGroup( + doc, name="SPANS", attrs={"key": "value"}, spans=spans + ) + return doc + + +@pytest.fixture +def span_group(en_tokenizer): + doc = en_tokenizer("0 1 2 3 4 5 6") + matcher = Matcher(en_tokenizer.vocab, validate=True) + + # fmt: off + matcher.add("4", [[{}, {}, {}, {}]]) + matcher.add("2", [[{}, {}, ]]) + matcher.add("1", [[{}, ]]) + # fmt: on + + matches = matcher(doc) + spans = [] + for match in matches: + spans.append( + Span(doc, match[1], match[2], en_tokenizer.vocab.strings[match[0]]) + ) + Random(42).shuffle(spans) + doc.spans["SPANS"] = SpanGroup( + doc, name="SPANS", attrs={"key": "value"}, spans=spans + ) + + +def test_span_group_copy(doc): + span_group = doc.spans["SPANS"] + clone = span_group.copy() + assert clone != span_group + assert clone.name == span_group.name + assert clone.attrs == span_group.attrs + assert len(clone) == len(span_group) + assert list(span_group) == list(clone) + clone.name = "new_name" + clone.attrs["key"] = "new_value" + clone.append(Span(doc, 0, 6, "LABEL")) + assert clone.name != span_group.name + assert clone.attrs != span_group.attrs + assert span_group.attrs["key"] == "value" + assert list(span_group) != list(clone) + + # can't copy if the character offsets don't align to tokens + doc2 = Doc(doc.vocab, words=[t.text + "x" for t in doc]) + with pytest.raises(ValueError): + span_group.copy(doc=doc2) + + # can copy with valid character offsets despite different tokenization + doc3 = doc.copy() + with doc3.retokenize() as retokenizer: + retokenizer.merge(doc3[0:2]) + retokenizer.merge(doc3[3:6]) + span_group = SpanGroup(doc, spans=[doc[0:6], doc[3:6]]) + for span1, span2 in zip(span_group, span_group.copy(doc=doc3)): + assert span1.start_char == span2.start_char + assert span1.end_char == span2.end_char + + +def test_span_group_set_item(doc, other_doc): + span_group = doc.spans["SPANS"] + + index = 5 + span = span_group[index] + span.label_ = "NEW LABEL" + span.kb_id = doc.vocab.strings["KB_ID"] + + assert span_group[index].label != span.label + assert span_group[index].kb_id != span.kb_id + + span_group[index] = span + assert span_group[index].start == span.start + assert span_group[index].end == span.end + assert span_group[index].label == span.label + assert span_group[index].kb_id == span.kb_id + assert span_group[index] == span + + with pytest.raises(IndexError): + span_group[-100] = span + with pytest.raises(IndexError): + span_group[100] = span + + span = Span(other_doc, 0, 2) + with pytest.raises(ValueError): + span_group[index] = span + + +def test_span_group_has_overlap(doc): + span_group = doc.spans["SPANS"] + assert span_group.has_overlap + + +def test_span_group_concat(doc, other_doc): + span_group_1 = doc.spans["SPANS"] + spans = [doc[0:5], doc[0:6]] + span_group_2 = SpanGroup( + doc, + name="MORE_SPANS", + attrs={"key": "new_value", "new_key": "new_value"}, + spans=spans, + ) + span_group_3 = span_group_1._concat(span_group_2) + assert span_group_3.name == span_group_1.name + assert span_group_3.attrs == {"key": "value", "new_key": "new_value"} + span_list_expected = list(span_group_1) + list(span_group_2) + assert list(span_group_3) == list(span_list_expected) + + # Inplace + span_list_expected = list(span_group_1) + list(span_group_2) + span_group_3 = span_group_1._concat(span_group_2, inplace=True) + assert span_group_3 == span_group_1 + assert span_group_3.name == span_group_1.name + assert span_group_3.attrs == {"key": "value", "new_key": "new_value"} + assert list(span_group_3) == list(span_list_expected) + + span_group_2 = other_doc.spans["SPANS"] + with pytest.raises(ValueError): + span_group_1._concat(span_group_2) + + +def test_span_doc_delitem(doc): + span_group = doc.spans["SPANS"] + length = len(span_group) + index = 5 + span = span_group[index] + next_span = span_group[index + 1] + del span_group[index] + assert len(span_group) == length - 1 + assert span_group[index] != span + assert span_group[index] == next_span + + with pytest.raises(IndexError): + del span_group[-100] + with pytest.raises(IndexError): + del span_group[100] + + +def test_span_group_add(doc): + span_group_1 = doc.spans["SPANS"] + spans = [doc[0:5], doc[0:6]] + span_group_2 = SpanGroup( + doc, + name="MORE_SPANS", + attrs={"key": "new_value", "new_key": "new_value"}, + spans=spans, + ) + + span_group_3_expected = span_group_1._concat(span_group_2) + + span_group_3 = span_group_1 + span_group_2 + assert len(span_group_3) == len(span_group_3_expected) + assert span_group_3.attrs == {"key": "value", "new_key": "new_value"} + assert list(span_group_3) == list(span_group_3_expected) + + +def test_span_group_iadd(doc): + span_group_1 = doc.spans["SPANS"].copy() + spans = [doc[0:5], doc[0:6]] + span_group_2 = SpanGroup( + doc, + name="MORE_SPANS", + attrs={"key": "new_value", "new_key": "new_value"}, + spans=spans, + ) + + span_group_1_expected = span_group_1._concat(span_group_2) + + span_group_1 += span_group_2 + assert len(span_group_1) == len(span_group_1_expected) + assert span_group_1.attrs == {"key": "value", "new_key": "new_value"} + assert list(span_group_1) == list(span_group_1_expected) + + span_group_1 = doc.spans["SPANS"].copy() + span_group_1 += spans + assert len(span_group_1) == len(span_group_1_expected) + assert span_group_1.attrs == { + "key": "value", + } + assert list(span_group_1) == list(span_group_1_expected) + + +def test_span_group_extend(doc): + span_group_1 = doc.spans["SPANS"].copy() + spans = [doc[0:5], doc[0:6]] + span_group_2 = SpanGroup( + doc, + name="MORE_SPANS", + attrs={"key": "new_value", "new_key": "new_value"}, + spans=spans, + ) + + span_group_1_expected = span_group_1._concat(span_group_2) + + span_group_1.extend(span_group_2) + assert len(span_group_1) == len(span_group_1_expected) + assert span_group_1.attrs == {"key": "value", "new_key": "new_value"} + assert list(span_group_1) == list(span_group_1_expected) + + span_group_1 = doc.spans["SPANS"] + span_group_1.extend(spans) + assert len(span_group_1) == len(span_group_1_expected) + assert span_group_1.attrs == {"key": "value"} + assert list(span_group_1) == list(span_group_1_expected) + + +def test_span_group_dealloc(span_group): + with pytest.raises(AttributeError): + print(span_group.doc) + + +@pytest.mark.issue(11975) +def test_span_group_typing(doc: Doc): + """Tests whether typing of `SpanGroup` as `Iterable[Span]`-like object is accepted by mypy.""" + span_group: SpanGroup = doc.spans["SPANS"] + spans: List[Span] = list(span_group) + for i, span in enumerate(span_group): + assert span == span_group[i] == spans[i] + filter_spans(span_group) + + +def test_span_group_init_doc(en_tokenizer): + """Test that all spans must come from the specified doc.""" + doc1 = en_tokenizer("a b c") + doc2 = en_tokenizer("a b c") + span_group = SpanGroup(doc1, spans=[doc1[0:1], doc1[1:2]]) + with pytest.raises(ValueError): + span_group = SpanGroup(doc1, spans=[doc1[0:1], doc2[1:2]]) diff --git a/TTS/Kokoro/.venv/Lib/site-packages/spacy/tests/doc/test_token_api.py b/TTS/Kokoro/.venv/Lib/site-packages/spacy/tests/doc/test_token_api.py new file mode 100644 index 0000000000000000000000000000000000000000..51614f5209225a734a83749611516b7ef610ec00 --- /dev/null +++ b/TTS/Kokoro/.venv/Lib/site-packages/spacy/tests/doc/test_token_api.py @@ -0,0 +1,305 @@ +import numpy +import pytest + +from spacy.attrs import IS_ALPHA, IS_DIGIT, IS_LOWER, IS_PUNCT, IS_STOP, IS_TITLE +from spacy.symbols import VERB +from spacy.tokens import Doc +from spacy.training import Example +from spacy.vocab import Vocab + + +@pytest.fixture +def doc(en_vocab): + # fmt: off + words = ["This", "is", "a", "sentence", ".", "This", "is", "another", "sentence", ".", "And", "a", "third", "."] + heads = [1, 1, 3, 1, 1, 6, 6, 8, 6, 6, 10, 12, 10, 12] + deps = ["nsubj", "ROOT", "det", "attr", "punct", "nsubj", "ROOT", "det", + "attr", "punct", "ROOT", "det", "npadvmod", "punct"] + # fmt: on + return Doc(en_vocab, words=words, heads=heads, deps=deps) + + +def test_doc_token_api_strings(en_vocab): + words = ["Give", "it", "back", "!", "He", "pleaded", "."] + pos = ["VERB", "PRON", "PART", "PUNCT", "PRON", "VERB", "PUNCT"] + heads = [0, 0, 0, 0, 5, 5, 5] + deps = ["ROOT", "dobj", "prt", "punct", "nsubj", "ROOT", "punct"] + doc = Doc(en_vocab, words=words, pos=pos, heads=heads, deps=deps) + assert doc[0].orth_ == "Give" + assert doc[0].text == "Give" + assert doc[0].text_with_ws == "Give " + assert doc[0].lower_ == "give" + assert doc[0].shape_ == "Xxxx" + assert doc[0].prefix_ == "G" + assert doc[0].suffix_ == "ive" + assert doc[0].pos_ == "VERB" + assert doc[0].dep_ == "ROOT" + + +def test_doc_token_api_flags(en_tokenizer): + text = "Give it back! He pleaded." + tokens = en_tokenizer(text) + assert tokens[0].check_flag(IS_ALPHA) + assert not tokens[0].check_flag(IS_DIGIT) + assert tokens[0].check_flag(IS_TITLE) + assert tokens[1].check_flag(IS_LOWER) + assert tokens[3].check_flag(IS_PUNCT) + assert tokens[2].check_flag(IS_STOP) + assert not tokens[5].check_flag(IS_STOP) + # TODO: Test more of these, esp. if a bug is found + + +@pytest.mark.parametrize("text", ["Give it back! He pleaded."]) +def test_doc_token_api_prob_inherited_from_vocab(en_tokenizer, text): + word = text.split()[0] + en_tokenizer.vocab[word].prob = -1 + tokens = en_tokenizer(text) + assert tokens[0].prob != 0 + + +@pytest.mark.parametrize("text", ["one two"]) +def test_doc_token_api_str_builtin(en_tokenizer, text): + tokens = en_tokenizer(text) + assert str(tokens[0]) == text.split(" ")[0] + assert str(tokens[1]) == text.split(" ")[1] + + +def test_doc_token_api_is_properties(en_vocab): + doc = Doc(en_vocab, words=["Hi", ",", "my", "email", "is", "test@me.com"]) + assert doc[0].is_title + assert doc[0].is_alpha + assert not doc[0].is_digit + assert doc[1].is_punct + assert doc[3].is_ascii + assert not doc[3].like_url + assert doc[4].is_lower + assert doc[5].like_email + + +def test_doc_token_api_vectors(): + vocab = Vocab() + vocab.reset_vectors(width=2) + vocab.set_vector("apples", vector=numpy.asarray([0.0, 2.0], dtype="f")) + vocab.set_vector("oranges", vector=numpy.asarray([0.0, 1.0], dtype="f")) + doc = Doc(vocab, words=["apples", "oranges", "oov"]) + assert doc.has_vector + assert doc[0].has_vector + assert doc[1].has_vector + assert not doc[2].has_vector + apples_norm = (0 * 0 + 2 * 2) ** 0.5 + oranges_norm = (0 * 0 + 1 * 1) ** 0.5 + cosine = ((0 * 0) + (2 * 1)) / (apples_norm * oranges_norm) + assert doc[0].similarity(doc[1]) == cosine + + +def test_doc_token_api_ancestors(en_vocab): + # the structure of this sentence depends on the English annotation scheme + words = ["Yesterday", "I", "saw", "a", "dog", "that", "barked", "loudly", "."] + heads = [2, 2, 2, 4, 2, 6, 4, 6, 2] + deps = ["dep"] * len(heads) + doc = Doc(en_vocab, words=words, heads=heads, deps=deps) + assert [t.text for t in doc[6].ancestors] == ["dog", "saw"] + assert [t.text for t in doc[1].ancestors] == ["saw"] + assert [t.text for t in doc[2].ancestors] == [] + assert doc[2].is_ancestor(doc[7]) + assert not doc[6].is_ancestor(doc[2]) + + +def test_doc_token_api_head_setter(en_vocab): + words = ["Yesterday", "I", "saw", "a", "dog", "that", "barked", "loudly", "."] + heads = [2, 2, 2, 4, 2, 6, 4, 6, 2] + deps = ["dep"] * len(heads) + doc = Doc(en_vocab, words=words, heads=heads, deps=deps) + assert doc[6].n_lefts == 1 + assert doc[6].n_rights == 1 + assert doc[6].left_edge.i == 5 + assert doc[6].right_edge.i == 7 + assert doc[4].n_lefts == 1 + assert doc[4].n_rights == 1 + assert doc[4].left_edge.i == 3 + assert doc[4].right_edge.i == 7 + assert doc[3].n_lefts == 0 + assert doc[3].n_rights == 0 + assert doc[3].left_edge.i == 3 + assert doc[3].right_edge.i == 3 + assert doc[2].left_edge.i == 0 + assert doc[2].right_edge.i == 8 + + doc[6].head = doc[3] + assert doc[6].n_lefts == 1 + assert doc[6].n_rights == 1 + assert doc[6].left_edge.i == 5 + assert doc[6].right_edge.i == 7 + assert doc[3].n_lefts == 0 + assert doc[3].n_rights == 1 + assert doc[3].left_edge.i == 3 + assert doc[3].right_edge.i == 7 + assert doc[4].n_lefts == 1 + assert doc[4].n_rights == 0 + assert doc[4].left_edge.i == 3 + assert doc[4].right_edge.i == 7 + assert doc[2].left_edge.i == 0 + assert doc[2].right_edge.i == 8 + + doc[0].head = doc[5] + assert doc[5].left_edge.i == 0 + assert doc[6].left_edge.i == 0 + assert doc[3].left_edge.i == 0 + assert doc[4].left_edge.i == 0 + assert doc[2].left_edge.i == 0 + # head token must be from the same document + doc2 = Doc(en_vocab, words=words, heads=heads, deps=["dep"] * len(heads)) + with pytest.raises(ValueError): + doc[0].head = doc2[0] + # test sentence starts when two sentences are joined + # fmt: off + words = ["This", "is", "one", "sentence", ".", "This", "is", "another", "sentence", "."] + heads = [0, 0, 0, 0, 0, 5, 5, 5, 5, 5] + # fmt: on + doc = Doc(en_vocab, words=words, heads=heads, deps=["dep"] * len(heads)) + # initially two sentences + assert doc[0].is_sent_start + assert doc[5].is_sent_start + assert doc[0].left_edge == doc[0] + assert doc[0].right_edge == doc[4] + assert doc[5].left_edge == doc[5] + assert doc[5].right_edge == doc[9] + # modifying with a sentence doesn't change sent starts + doc[2].head = doc[3] + assert doc[0].is_sent_start + assert doc[5].is_sent_start + assert doc[0].left_edge == doc[0] + assert doc[0].right_edge == doc[4] + assert doc[5].left_edge == doc[5] + assert doc[5].right_edge == doc[9] + # attach the second sentence to the first, resulting in one sentence + doc[5].head = doc[0] + assert doc[0].is_sent_start + assert not doc[5].is_sent_start + assert doc[0].left_edge == doc[0] + assert doc[0].right_edge == doc[9] + + +def test_is_sent_start(en_tokenizer): + doc = en_tokenizer("This is a sentence. This is another.") + assert doc[5].is_sent_start is None + doc[5].is_sent_start = True + assert doc[5].is_sent_start is True + assert len(list(doc.sents)) == 2 + + +def test_is_sent_end(en_tokenizer): + doc = en_tokenizer("This is a sentence. This is another.") + assert doc[4].is_sent_end is None + doc[5].is_sent_start = True + assert doc[4].is_sent_end is True + assert len(list(doc.sents)) == 2 + + +def test_set_pos(): + doc = Doc(Vocab(), words=["hello", "world"]) + doc[0].pos_ = "NOUN" + assert doc[0].pos_ == "NOUN" + doc[1].pos = VERB + assert doc[1].pos_ == "VERB" + + +def test_set_invalid_pos(): + doc = Doc(Vocab(), words=["hello", "world"]) + with pytest.raises(ValueError): + doc[0].pos_ = "blah" + + +def test_tokens_sent(doc): + """Test token.sent property""" + assert len(list(doc.sents)) == 3 + assert doc[1].sent.text == "This is a sentence ." + assert doc[7].sent.text == "This is another sentence ." + assert doc[1].sent.root.left_edge.text == "This" + assert doc[7].sent.root.left_edge.text == "This" + + +def test_token0_has_sent_start_true(): + doc = Doc(Vocab(), words=["hello", "world"]) + assert doc[0].is_sent_start is True + assert doc[1].is_sent_start is None + assert not doc.has_annotation("SENT_START") + + +def test_tokenlast_has_sent_end_true(): + doc = Doc(Vocab(), words=["hello", "world"]) + assert doc[0].is_sent_end is None + assert doc[1].is_sent_end is True + assert not doc.has_annotation("SENT_START") + + +def test_token_api_conjuncts_chain(en_vocab): + words = ["The", "boy", "and", "the", "girl", "and", "the", "man", "went", "."] + heads = [1, 8, 1, 4, 1, 4, 7, 4, 8, 8] + deps = ["det", "nsubj", "cc", "det", "conj", "cc", "det", "conj", "ROOT", "punct"] + doc = Doc(en_vocab, words=words, heads=heads, deps=deps) + assert [w.text for w in doc[1].conjuncts] == ["girl", "man"] + assert [w.text for w in doc[4].conjuncts] == ["boy", "man"] + assert [w.text for w in doc[7].conjuncts] == ["boy", "girl"] + + +def test_token_api_conjuncts_simple(en_vocab): + words = ["They", "came", "and", "went", "."] + heads = [1, 1, 1, 1, 3] + deps = ["nsubj", "ROOT", "cc", "conj", "dep"] + doc = Doc(en_vocab, words=words, heads=heads, deps=deps) + assert [w.text for w in doc[1].conjuncts] == ["went"] + assert [w.text for w in doc[3].conjuncts] == ["came"] + + +def test_token_api_non_conjuncts(en_vocab): + words = ["They", "came", "."] + heads = [1, 1, 1] + deps = ["nsubj", "ROOT", "punct"] + doc = Doc(en_vocab, words=words, heads=heads, deps=deps) + assert [w.text for w in doc[0].conjuncts] == [] + assert [w.text for w in doc[1].conjuncts] == [] + + +def test_missing_head_dep(en_vocab): + """Check that the Doc constructor and Example.from_dict parse missing information the same""" + heads = [1, 1, 1, 1, 2, None] # element 5 is missing + deps = ["", "ROOT", "dobj", "cc", "conj", None] # element 0 and 5 are missing + words = ["I", "like", "London", "and", "Berlin", "."] + doc = Doc(en_vocab, words=words, heads=heads, deps=deps) + pred_has_heads = [t.has_head() for t in doc] + pred_has_deps = [t.has_dep() for t in doc] + pred_heads = [t.head.i for t in doc] + pred_deps = [t.dep_ for t in doc] + pred_sent_starts = [t.is_sent_start for t in doc] + assert pred_has_heads == [False, True, True, True, True, False] + assert pred_has_deps == [False, True, True, True, True, False] + assert pred_heads[1:5] == [1, 1, 1, 2] + assert pred_deps[1:5] == ["ROOT", "dobj", "cc", "conj"] + assert pred_sent_starts == [True, False, False, False, False, False] + example = Example.from_dict(doc, {"heads": heads, "deps": deps}) + ref_has_heads = [t.has_head() for t in example.reference] + ref_has_deps = [t.has_dep() for t in example.reference] + ref_heads = [t.head.i for t in example.reference] + ref_deps = [t.dep_ for t in example.reference] + ref_sent_starts = [t.is_sent_start for t in example.reference] + assert ref_has_heads == pred_has_heads + assert ref_has_deps == pred_has_heads + assert ref_heads == pred_heads + assert ref_deps == pred_deps + assert ref_sent_starts == pred_sent_starts + # check that the aligned parse preserves the missing information + aligned_heads, aligned_deps = example.get_aligned_parse(projectivize=True) + assert aligned_deps[0] == ref_deps[0] + assert aligned_heads[0] == ref_heads[0] + assert aligned_deps[5] == ref_deps[5] + assert aligned_heads[5] == ref_heads[5] + + +def test_token_api_richcmp_other(en_tokenizer): + doc1 = en_tokenizer("a b") + doc2 = en_tokenizer("b c") + assert not doc1[1] == doc1[0:1] + assert not doc1[1] == doc2[1:2] + assert not doc1[1] == doc2[0] + assert not doc1[0] == doc2 diff --git a/TTS/Kokoro/.venv/Lib/site-packages/spacy/tests/doc/test_underscore.py b/TTS/Kokoro/.venv/Lib/site-packages/spacy/tests/doc/test_underscore.py new file mode 100644 index 0000000000000000000000000000000000000000..2a150c83c3c6333796a2ac7c6822cd26245d3a01 --- /dev/null +++ b/TTS/Kokoro/.venv/Lib/site-packages/spacy/tests/doc/test_underscore.py @@ -0,0 +1,174 @@ +import pytest +from mock import Mock + +from spacy.tokens import Doc, Span, Token +from spacy.tokens.underscore import Underscore + + +@pytest.fixture(scope="function", autouse=True) +def clean_underscore(): + # reset the Underscore object after the test, to avoid having state copied across tests + yield + Underscore.doc_extensions = {} + Underscore.span_extensions = {} + Underscore.token_extensions = {} + + +def test_create_doc_underscore(): + doc = Mock() + doc.doc = doc + uscore = Underscore(Underscore.doc_extensions, doc) + assert uscore._doc is doc + assert uscore._start is None + assert uscore._end is None + + +def test_doc_underscore_getattr_setattr(): + doc = Mock() + doc.doc = doc + doc.user_data = {} + Underscore.doc_extensions["hello"] = (False, None, None, None) + doc._ = Underscore(Underscore.doc_extensions, doc) + assert doc._.hello is False + doc._.hello = True + assert doc._.hello is True + + +def test_create_span_underscore(): + span = Mock(doc=Mock(), start=0, end=2) + uscore = Underscore( + Underscore.span_extensions, span, start=span.start, end=span.end + ) + assert uscore._doc is span.doc + assert uscore._start is span.start + assert uscore._end is span.end + + +def test_span_underscore_getter_setter(): + span = Mock(doc=Mock(), start=0, end=2) + Underscore.span_extensions["hello"] = ( + None, + None, + lambda s: (s.start, "hi"), + lambda s, value: setattr(s, "start", value), + ) + span._ = Underscore( + Underscore.span_extensions, span, start=span.start, end=span.end + ) + + assert span._.hello == (0, "hi") + span._.hello = 1 + assert span._.hello == (1, "hi") + + +def test_token_underscore_method(): + token = Mock(doc=Mock(), idx=7, say_cheese=lambda token: "cheese") + Underscore.token_extensions["hello"] = (None, token.say_cheese, None, None) + token._ = Underscore(Underscore.token_extensions, token, start=token.idx) + assert token._.hello() == "cheese" + + +@pytest.mark.parametrize("obj", [Doc, Span, Token]) +def test_doc_underscore_remove_extension(obj): + ext_name = "to_be_removed" + obj.set_extension(ext_name, default=False) + assert obj.has_extension(ext_name) + obj.remove_extension(ext_name) + assert not obj.has_extension(ext_name) + + +@pytest.mark.parametrize("obj", [Doc, Span, Token]) +def test_underscore_raises_for_dup(obj): + obj.set_extension("test", default=None) + with pytest.raises(ValueError): + obj.set_extension("test", default=None) + + +@pytest.mark.parametrize( + "invalid_kwargs", + [ + {"getter": None, "setter": lambda: None}, + {"default": None, "method": lambda: None, "getter": lambda: None}, + {"setter": lambda: None}, + {"default": None, "method": lambda: None}, + {"getter": True}, + ], +) +def test_underscore_raises_for_invalid(invalid_kwargs): + invalid_kwargs["force"] = True + with pytest.raises(ValueError): + Doc.set_extension("test", **invalid_kwargs) + + +@pytest.mark.parametrize( + "valid_kwargs", + [ + {"getter": lambda: None}, + {"getter": lambda: None, "setter": lambda: None}, + {"default": "hello"}, + {"default": None}, + {"method": lambda: None}, + ], +) +def test_underscore_accepts_valid(valid_kwargs): + valid_kwargs["force"] = True + Doc.set_extension("test", **valid_kwargs) + + +def test_underscore_mutable_defaults_list(en_vocab): + """Test that mutable default arguments are handled correctly (see #2581).""" + Doc.set_extension("mutable", default=[]) + doc1 = Doc(en_vocab, words=["one"]) + doc2 = Doc(en_vocab, words=["two"]) + doc1._.mutable.append("foo") + assert len(doc1._.mutable) == 1 + assert doc1._.mutable[0] == "foo" + assert len(doc2._.mutable) == 0 + doc1._.mutable = ["bar", "baz"] + doc1._.mutable.append("foo") + assert len(doc1._.mutable) == 3 + assert len(doc2._.mutable) == 0 + + +def test_underscore_mutable_defaults_dict(en_vocab): + """Test that mutable default arguments are handled correctly (see #2581).""" + Token.set_extension("mutable", default={}) + token1 = Doc(en_vocab, words=["one"])[0] + token2 = Doc(en_vocab, words=["two"])[0] + token1._.mutable["foo"] = "bar" + assert len(token1._.mutable) == 1 + assert token1._.mutable["foo"] == "bar" + assert len(token2._.mutable) == 0 + token1._.mutable["foo"] = "baz" + assert len(token1._.mutable) == 1 + assert token1._.mutable["foo"] == "baz" + token1._.mutable["x"] = [] + token1._.mutable["x"].append("y") + assert len(token1._.mutable) == 2 + assert token1._.mutable["x"] == ["y"] + assert len(token2._.mutable) == 0 + + +def test_underscore_dir(en_vocab): + """Test that dir() correctly returns extension attributes. This enables + things like tab-completion for the attributes in doc._.""" + Doc.set_extension("test_dir", default=None) + doc = Doc(en_vocab, words=["hello", "world"]) + assert "_" in dir(doc) + assert "test_dir" in dir(doc._) + assert "test_dir" not in dir(doc[0]._) + assert "test_dir" not in dir(doc[0:2]._) + + +def test_underscore_docstring(en_vocab): + """Test that docstrings are available for extension methods, even though + they're partials.""" + + def test_method(doc, arg1=1, arg2=2): + """I am a docstring""" + return (arg1, arg2) + + Doc.set_extension("test_docstrings", method=test_method) + doc = Doc(en_vocab, words=["hello", "world"]) + assert test_method.__doc__ == "I am a docstring" + assert doc._.test_docstrings.__doc__.rsplit(". ")[-1] == "I am a docstring" diff --git a/TTS/Kokoro/.venv/Lib/site-packages/spacy/tests/lang/__init__.py b/TTS/Kokoro/.venv/Lib/site-packages/spacy/tests/lang/__init__.py new file mode 100644 index 0000000000000000000000000000000000000000..e69de29bb2d1d6434b8b29ae775ad8c2e48c5391 diff --git a/TTS/Kokoro/.venv/Lib/site-packages/spacy/tests/lang/__pycache__/__init__.cpython-312.pyc b/TTS/Kokoro/.venv/Lib/site-packages/spacy/tests/lang/__pycache__/__init__.cpython-312.pyc new file mode 100644 index 0000000000000000000000000000000000000000..2d695e25271cef950dd2bff126144a86f410c390 Binary files /dev/null and b/TTS/Kokoro/.venv/Lib/site-packages/spacy/tests/lang/__pycache__/__init__.cpython-312.pyc differ diff --git a/TTS/Kokoro/.venv/Lib/site-packages/spacy/tests/lang/__pycache__/test_attrs.cpython-312.pyc b/TTS/Kokoro/.venv/Lib/site-packages/spacy/tests/lang/__pycache__/test_attrs.cpython-312.pyc new file mode 100644 index 0000000000000000000000000000000000000000..5a3181a3ec2b8197ad94cba5c227f95d2feddbb7 Binary files /dev/null and b/TTS/Kokoro/.venv/Lib/site-packages/spacy/tests/lang/__pycache__/test_attrs.cpython-312.pyc differ diff --git a/TTS/Kokoro/.venv/Lib/site-packages/spacy/tests/lang/__pycache__/test_initialize.cpython-312.pyc b/TTS/Kokoro/.venv/Lib/site-packages/spacy/tests/lang/__pycache__/test_initialize.cpython-312.pyc new file mode 100644 index 0000000000000000000000000000000000000000..6b15331565f2f8a73912557d9f301453034cca47 Binary files /dev/null and b/TTS/Kokoro/.venv/Lib/site-packages/spacy/tests/lang/__pycache__/test_initialize.cpython-312.pyc differ diff --git a/TTS/Kokoro/.venv/Lib/site-packages/spacy/tests/lang/__pycache__/test_lemmatizers.cpython-312.pyc b/TTS/Kokoro/.venv/Lib/site-packages/spacy/tests/lang/__pycache__/test_lemmatizers.cpython-312.pyc new file mode 100644 index 0000000000000000000000000000000000000000..db76469bf769aa6e79f2b5cc6f152de615ad8ded Binary files /dev/null and b/TTS/Kokoro/.venv/Lib/site-packages/spacy/tests/lang/__pycache__/test_lemmatizers.cpython-312.pyc differ diff --git a/TTS/Kokoro/.venv/Lib/site-packages/spacy/tests/lang/af/__init__.py b/TTS/Kokoro/.venv/Lib/site-packages/spacy/tests/lang/af/__init__.py new file mode 100644 index 0000000000000000000000000000000000000000..e69de29bb2d1d6434b8b29ae775ad8c2e48c5391 diff --git a/TTS/Kokoro/.venv/Lib/site-packages/spacy/tests/lang/af/__pycache__/__init__.cpython-312.pyc b/TTS/Kokoro/.venv/Lib/site-packages/spacy/tests/lang/af/__pycache__/__init__.cpython-312.pyc new file mode 100644 index 0000000000000000000000000000000000000000..ff9a26399a20ac2ef0d83cf6a15ea03c38fe63ee Binary files /dev/null and b/TTS/Kokoro/.venv/Lib/site-packages/spacy/tests/lang/af/__pycache__/__init__.cpython-312.pyc differ diff --git a/TTS/Kokoro/.venv/Lib/site-packages/spacy/tests/lang/af/__pycache__/test_text.cpython-312.pyc b/TTS/Kokoro/.venv/Lib/site-packages/spacy/tests/lang/af/__pycache__/test_text.cpython-312.pyc new file mode 100644 index 0000000000000000000000000000000000000000..8875acc71b6181c4af98edd46db8efa43f8ae4ac Binary files /dev/null and b/TTS/Kokoro/.venv/Lib/site-packages/spacy/tests/lang/af/__pycache__/test_text.cpython-312.pyc differ diff --git a/TTS/Kokoro/.venv/Lib/site-packages/spacy/tests/lang/af/__pycache__/test_tokenizer.cpython-312.pyc b/TTS/Kokoro/.venv/Lib/site-packages/spacy/tests/lang/af/__pycache__/test_tokenizer.cpython-312.pyc new file mode 100644 index 0000000000000000000000000000000000000000..641a442a830bad9e0df55273113be238131a133b Binary files /dev/null and b/TTS/Kokoro/.venv/Lib/site-packages/spacy/tests/lang/af/__pycache__/test_tokenizer.cpython-312.pyc differ diff --git a/TTS/Kokoro/.venv/Lib/site-packages/spacy/tests/lang/af/test_text.py b/TTS/Kokoro/.venv/Lib/site-packages/spacy/tests/lang/af/test_text.py new file mode 100644 index 0000000000000000000000000000000000000000..48d8ab9df32d44101502be3393b8d23396e0842d --- /dev/null +++ b/TTS/Kokoro/.venv/Lib/site-packages/spacy/tests/lang/af/test_text.py @@ -0,0 +1,22 @@ +import pytest + + +def test_long_text(af_tokenizer): + # Excerpt: Universal Declaration of Human Rights; “'n” changed to “die” in first sentence + text = """ +Hierdie Universele Verklaring van Menseregte as die algemene standaard vir die verwesenliking deur alle mense en nasies, +om te verseker dat elke individu en elke deel van die gemeenskap hierdie Verklaring in ag sal neem en deur opvoeding, +respek vir hierdie regte en vryhede te bevorder, op nasionale en internasionale vlak, daarna sal strewe om die universele +en effektiewe erkenning en agting van hierdie regte te verseker, nie net vir die mense van die Lidstate nie, maar ook vir +die mense in die gebiede onder hul jurisdiksie. + +""" + tokens = af_tokenizer(text) + assert len(tokens) == 100 + + +@pytest.mark.xfail +def test_indefinite_article(af_tokenizer): + text = "as 'n algemene standaard" + tokens = af_tokenizer(text) + assert len(tokens) == 4 diff --git a/TTS/Kokoro/.venv/Lib/site-packages/spacy/tests/lang/af/test_tokenizer.py b/TTS/Kokoro/.venv/Lib/site-packages/spacy/tests/lang/af/test_tokenizer.py new file mode 100644 index 0000000000000000000000000000000000000000..81e3f9723d1511e0b3b1e7b7c5aa8dfb131c96eb --- /dev/null +++ b/TTS/Kokoro/.venv/Lib/site-packages/spacy/tests/lang/af/test_tokenizer.py @@ -0,0 +1,29 @@ +import pytest + +AF_BASIC_TOKENIZATION_TESTS = [ + ( + "Elkeen het die reg tot lewe, vryheid en sekuriteit van persoon.", + [ + "Elkeen", + "het", + "die", + "reg", + "tot", + "lewe", + ",", + "vryheid", + "en", + "sekuriteit", + "van", + "persoon", + ".", + ], + ), +] + + +@pytest.mark.parametrize("text,expected_tokens", AF_BASIC_TOKENIZATION_TESTS) +def test_af_tokenizer_basic(af_tokenizer, text, expected_tokens): + tokens = af_tokenizer(text) + token_list = [token.text for token in tokens if not token.is_space] + assert expected_tokens == token_list diff --git a/TTS/Kokoro/.venv/Lib/site-packages/spacy/tests/lang/am/__init__.py b/TTS/Kokoro/.venv/Lib/site-packages/spacy/tests/lang/am/__init__.py new file mode 100644 index 0000000000000000000000000000000000000000..e69de29bb2d1d6434b8b29ae775ad8c2e48c5391 diff --git a/TTS/Kokoro/.venv/Lib/site-packages/spacy/tests/lang/am/__pycache__/__init__.cpython-312.pyc b/TTS/Kokoro/.venv/Lib/site-packages/spacy/tests/lang/am/__pycache__/__init__.cpython-312.pyc new file mode 100644 index 0000000000000000000000000000000000000000..584e628fa3896de5ed9908ef19653ad20eda6518 Binary files /dev/null and b/TTS/Kokoro/.venv/Lib/site-packages/spacy/tests/lang/am/__pycache__/__init__.cpython-312.pyc differ diff --git a/TTS/Kokoro/.venv/Lib/site-packages/spacy/tests/lang/am/__pycache__/test_exception.cpython-312.pyc b/TTS/Kokoro/.venv/Lib/site-packages/spacy/tests/lang/am/__pycache__/test_exception.cpython-312.pyc new file mode 100644 index 0000000000000000000000000000000000000000..eb72b684be352f89e3a9e9165884a462328c3b0d Binary files /dev/null and b/TTS/Kokoro/.venv/Lib/site-packages/spacy/tests/lang/am/__pycache__/test_exception.cpython-312.pyc differ diff --git a/TTS/Kokoro/.venv/Lib/site-packages/spacy/tests/lang/am/__pycache__/test_text.cpython-312.pyc b/TTS/Kokoro/.venv/Lib/site-packages/spacy/tests/lang/am/__pycache__/test_text.cpython-312.pyc new file mode 100644 index 0000000000000000000000000000000000000000..5ce606b71c5e4cf639f53d483fb6b4283f68a414 Binary files /dev/null and b/TTS/Kokoro/.venv/Lib/site-packages/spacy/tests/lang/am/__pycache__/test_text.cpython-312.pyc differ diff --git a/TTS/Kokoro/.venv/Lib/site-packages/spacy/tests/lang/am/test_exception.py b/TTS/Kokoro/.venv/Lib/site-packages/spacy/tests/lang/am/test_exception.py new file mode 100644 index 0000000000000000000000000000000000000000..e69de29bb2d1d6434b8b29ae775ad8c2e48c5391 diff --git a/TTS/Kokoro/.venv/Lib/site-packages/spacy/tests/lang/am/test_text.py b/TTS/Kokoro/.venv/Lib/site-packages/spacy/tests/lang/am/test_text.py new file mode 100644 index 0000000000000000000000000000000000000000..f83716bb29c91d5b440a7300a0587f8fe4006dc0 --- /dev/null +++ b/TTS/Kokoro/.venv/Lib/site-packages/spacy/tests/lang/am/test_text.py @@ -0,0 +1,51 @@ +import pytest + + +def test_am_tokenizer_handles_long_text(am_tokenizer): + text = """ሆሴ ሙጂካ በበጋ ወቅት በኦክስፎርድ ንግግር አንድያቀርቡ ሲጋበዙ ጭንቅላታቸው "ፈነዳ"። + +“እጅግ ጥንታዊ” የእንግሊዝኛ ተናጋሪ ዩኒቨርስቲ፣ በአስር ሺዎች የሚቆጠሩ ዩሮዎችን ለተማሪዎች በማስተማር የሚያስከፍለው + +እና ከማርጋሬት ታቸር እስከ ስቲቨን ሆኪንግ በአዳራሾቻቸው ውስጥ ንግግር ያደረጉበት የትምህርት ማዕከል፣ በሞንቴቪዴኦ + +በሚገኘው የመንግስት ትምህርት ቤት የሰለጠኑትን የ81 ዓመቱ አዛውንት አገልግሎት ጠየቁ።""" + tokens = am_tokenizer(text) + + assert len(tokens) == 56 + + +@pytest.mark.parametrize( + "text,length", + [ + ("ሆሴ ሙጂካ ለምን ተመረጠ?", 5), + ("“በፍፁም?”", 4), + ("""አዎ! ሆዜ አርካዲዮ ቡንዲያ “እንሂድ” ሲል መለሰ።""", 11), + ("እነሱ በግምት 10ኪ.ሜ. ሮጡ።", 7), + ("እና ከዚያ ለምን...", 4), + ], +) +def test_am_tokenizer_handles_cnts(am_tokenizer, text, length): + tokens = am_tokenizer(text) + assert len(tokens) == length + + +@pytest.mark.parametrize( + "text,match", + [ + ("10", True), + ("1", True), + ("10.000", True), + ("1000", True), + ("999,0", True), + ("አንድ", True), + ("ሁለት", True), + ("ትሪሊዮን", True), + ("ውሻ", False), + (",", False), + ("1/2", True), + ], +) +def test_lex_attrs_like_number(am_tokenizer, text, match): + tokens = am_tokenizer(text) + assert len(tokens) == 1 + assert tokens[0].like_num == match diff --git a/TTS/Kokoro/.venv/Lib/site-packages/spacy/tests/lang/ar/__init__.py b/TTS/Kokoro/.venv/Lib/site-packages/spacy/tests/lang/ar/__init__.py new file mode 100644 index 0000000000000000000000000000000000000000..e69de29bb2d1d6434b8b29ae775ad8c2e48c5391 diff --git a/TTS/Kokoro/.venv/Lib/site-packages/spacy/tests/lang/ar/__pycache__/__init__.cpython-312.pyc b/TTS/Kokoro/.venv/Lib/site-packages/spacy/tests/lang/ar/__pycache__/__init__.cpython-312.pyc new file mode 100644 index 0000000000000000000000000000000000000000..c3d48cddcf5aed8a10d4c6c9d407609af9477a22 Binary files /dev/null and b/TTS/Kokoro/.venv/Lib/site-packages/spacy/tests/lang/ar/__pycache__/__init__.cpython-312.pyc differ diff --git a/TTS/Kokoro/.venv/Lib/site-packages/spacy/tests/lang/ar/__pycache__/test_exceptions.cpython-312.pyc b/TTS/Kokoro/.venv/Lib/site-packages/spacy/tests/lang/ar/__pycache__/test_exceptions.cpython-312.pyc new file mode 100644 index 0000000000000000000000000000000000000000..7f846a7eb373f4d019a65967146163f1173e8063 Binary files /dev/null and b/TTS/Kokoro/.venv/Lib/site-packages/spacy/tests/lang/ar/__pycache__/test_exceptions.cpython-312.pyc differ diff --git a/TTS/Kokoro/.venv/Lib/site-packages/spacy/tests/lang/ar/__pycache__/test_text.cpython-312.pyc b/TTS/Kokoro/.venv/Lib/site-packages/spacy/tests/lang/ar/__pycache__/test_text.cpython-312.pyc new file mode 100644 index 0000000000000000000000000000000000000000..0aebf5771cebdeaed3e564ad647d3cc3695e7254 Binary files /dev/null and b/TTS/Kokoro/.venv/Lib/site-packages/spacy/tests/lang/ar/__pycache__/test_text.cpython-312.pyc differ diff --git a/TTS/Kokoro/.venv/Lib/site-packages/spacy/tests/lang/ar/test_exceptions.py b/TTS/Kokoro/.venv/Lib/site-packages/spacy/tests/lang/ar/test_exceptions.py new file mode 100644 index 0000000000000000000000000000000000000000..adce92c4d468f4deb5f101584a217e8584faa3aa --- /dev/null +++ b/TTS/Kokoro/.venv/Lib/site-packages/spacy/tests/lang/ar/test_exceptions.py @@ -0,0 +1,20 @@ +import pytest + + +@pytest.mark.parametrize("text", ["ق.م", "إلخ", "ص.ب", "ت."]) +def test_ar_tokenizer_handles_abbr(ar_tokenizer, text): + tokens = ar_tokenizer(text) + assert len(tokens) == 1 + + +def test_ar_tokenizer_handles_exc_in_text(ar_tokenizer): + text = "تعود الكتابة الهيروغليفية إلى سنة 3200 ق.م" + tokens = ar_tokenizer(text) + assert len(tokens) == 7 + assert tokens[6].text == "ق.م" + + +def test_ar_tokenizer_handles_exc_in_text_2(ar_tokenizer): + text = "يبلغ طول مضيق طارق 14كم " + tokens = ar_tokenizer(text) + assert len(tokens) == 6 diff --git a/TTS/Kokoro/.venv/Lib/site-packages/spacy/tests/lang/ar/test_text.py b/TTS/Kokoro/.venv/Lib/site-packages/spacy/tests/lang/ar/test_text.py new file mode 100644 index 0000000000000000000000000000000000000000..f7f458a252a6aa8ed508314919cfc2fa90f1cde2 --- /dev/null +++ b/TTS/Kokoro/.venv/Lib/site-packages/spacy/tests/lang/ar/test_text.py @@ -0,0 +1,9 @@ +def test_ar_tokenizer_handles_long_text(ar_tokenizer): + text = """نجيب محفوظ مؤلف و كاتب روائي عربي، يعد من أهم الأدباء العرب خلال القرن العشرين. + ولد نجيب محفوظ في مدينة القاهرة، حيث ترعرع و تلقى تعليمه الجامعي في جامعتها، + فتمكن من نيل شهادة في الفلسفة. ألف محفوظ على مدار حياته الكثير من الأعمال الأدبية، و في مقدمتها ثلاثيته الشهيرة. + و قد نجح في الحصول على جائزة نوبل للآداب، ليكون بذلك العربي الوحيد الذي فاز بها.""" + + tokens = ar_tokenizer(text) + assert tokens[3].is_stop is True + assert len(tokens) == 77 diff --git a/TTS/Kokoro/.venv/Lib/site-packages/spacy/tests/lang/bn/__init__.py b/TTS/Kokoro/.venv/Lib/site-packages/spacy/tests/lang/bn/__init__.py new file mode 100644 index 0000000000000000000000000000000000000000..e69de29bb2d1d6434b8b29ae775ad8c2e48c5391 diff --git a/TTS/Kokoro/.venv/Lib/site-packages/spacy/tests/lang/bn/__pycache__/__init__.cpython-312.pyc b/TTS/Kokoro/.venv/Lib/site-packages/spacy/tests/lang/bn/__pycache__/__init__.cpython-312.pyc new file mode 100644 index 0000000000000000000000000000000000000000..b18829cc66075acb2de88cdcaca9b1f6967c6742 Binary files /dev/null and b/TTS/Kokoro/.venv/Lib/site-packages/spacy/tests/lang/bn/__pycache__/__init__.cpython-312.pyc differ diff --git a/TTS/Kokoro/.venv/Lib/site-packages/spacy/tests/lang/bn/__pycache__/test_tokenizer.cpython-312.pyc b/TTS/Kokoro/.venv/Lib/site-packages/spacy/tests/lang/bn/__pycache__/test_tokenizer.cpython-312.pyc new file mode 100644 index 0000000000000000000000000000000000000000..e3d928da94386b42fd76cca62848ed89da062d45 Binary files /dev/null and b/TTS/Kokoro/.venv/Lib/site-packages/spacy/tests/lang/bn/__pycache__/test_tokenizer.cpython-312.pyc differ diff --git a/TTS/Kokoro/.venv/Lib/site-packages/spacy/tests/lang/bn/test_tokenizer.py b/TTS/Kokoro/.venv/Lib/site-packages/spacy/tests/lang/bn/test_tokenizer.py new file mode 100644 index 0000000000000000000000000000000000000000..83ce0cfee8577d3d4c8205fe4df7111523274b61 --- /dev/null +++ b/TTS/Kokoro/.venv/Lib/site-packages/spacy/tests/lang/bn/test_tokenizer.py @@ -0,0 +1,36 @@ +import pytest + +# fmt: off +TESTCASES = [ + # Punctuation tests + ("আমি বাংলায় গান গাই!", ["আমি", "বাংলায়", "গান", "গাই", "!"]), + ("আমি বাংলায় কথা কই।", ["আমি", "বাংলায়", "কথা", "কই", "।"]), + ("বসুন্ধরা জনসম্মুখে দোষ স্বীকার করলো না?", ["বসুন্ধরা", "জনসম্মুখে", "দোষ", "স্বীকার", "করলো", "না", "?"]), + ("টাকা থাকলে কি না হয়!", ["টাকা", "থাকলে", "কি", "না", "হয়", "!"]), + ("সরকারি বিশ্ববিদ্যালয়-এর ছাত্র নই বলেই কি এমন আচরণ?", ["সরকারি", "বিশ্ববিদ্যালয়", "-", "এর", "ছাত্র", "নই", "বলেই", "কি", "এমন", "আচরণ", "?"]), + ('তারা বলে, "ওরা খামারের মুরগি।"', ["তারা", "বলে", ",", '"', "ওরা", "খামারের", "মুরগি", "।", '"']), + ("৩*৩=৬?", ["৩", "*", "৩", "=", "৬", "?"]), + ("কাঁঠাল-এর গন্ধই অন্যরকম", ["কাঁঠাল", "-", "এর", "গন্ধই", "অন্যরকম"]), + # Abbreviations + ("ডঃ খালেদ বললেন ঢাকায় ৩৫ ডিগ্রি সে.।", ["ডঃ", "খালেদ", "বললেন", "ঢাকায়", "৩৫", "ডিগ্রি", "সে.", "।"]), +] +# fmt: on + + +@pytest.mark.parametrize("text,expected_tokens", TESTCASES) +def test_bn_tokenizer_handles_testcases(bn_tokenizer, text, expected_tokens): + tokens = bn_tokenizer(text) + token_list = [token.text for token in tokens if not token.is_space] + assert expected_tokens == token_list + + +def test_bn_tokenizer_handles_long_text(bn_tokenizer): + text = """নর্থ সাউথ বিশ্ববিদ্যালয়ে সারাবছর কোন না কোন বিষয়ে গবেষণা চলতেই থাকে। \ +অভিজ্ঞ ফ্যাকাল্টি মেম্বারগণ প্রায়ই শিক্ষার্থীদের নিয়ে বিভিন্ন গবেষণা প্রকল্পে কাজ করেন, \ +যার মধ্যে রয়েছে রোবট থেকে মেশিন লার্নিং সিস্টেম ও আর্টিফিশিয়াল ইন্টেলিজেন্স। \ +এসকল প্রকল্পে কাজ করার মাধ্যমে সংশ্লিষ্ট ক্ষেত্রে যথেষ্ঠ পরিমাণ স্পেশালাইজড হওয়া সম্ভব। \ +আর গবেষণার কাজ তোমার ক্যারিয়ারকে ঠেলে নিয়ে যাবে অনেকখানি! \ +কন্টেস্ট প্রোগ্রামার হও, গবেষক কিংবা ডেভেলপার - নর্থ সাউথ ইউনিভার্সিটিতে তোমার প্রতিভা বিকাশের সুযোগ রয়েছেই। \ +নর্থ সাউথের অসাধারণ কমিউনিটিতে তোমাকে সাদর আমন্ত্রণ।""" + tokens = bn_tokenizer(text) + assert len(tokens) == 84 diff --git a/TTS/Kokoro/.venv/Lib/site-packages/spacy/tests/lang/bo/__init__.py b/TTS/Kokoro/.venv/Lib/site-packages/spacy/tests/lang/bo/__init__.py new file mode 100644 index 0000000000000000000000000000000000000000..e69de29bb2d1d6434b8b29ae775ad8c2e48c5391 diff --git a/TTS/Kokoro/.venv/Lib/site-packages/spacy/tests/lang/bo/__pycache__/__init__.cpython-312.pyc b/TTS/Kokoro/.venv/Lib/site-packages/spacy/tests/lang/bo/__pycache__/__init__.cpython-312.pyc new file mode 100644 index 0000000000000000000000000000000000000000..6cac4d9d808da93882d796d0267c6dd5176eef3e Binary files /dev/null and b/TTS/Kokoro/.venv/Lib/site-packages/spacy/tests/lang/bo/__pycache__/__init__.cpython-312.pyc differ diff --git a/TTS/Kokoro/.venv/Lib/site-packages/spacy/tests/lang/bo/__pycache__/test_text.cpython-312.pyc b/TTS/Kokoro/.venv/Lib/site-packages/spacy/tests/lang/bo/__pycache__/test_text.cpython-312.pyc new file mode 100644 index 0000000000000000000000000000000000000000..f345c4fb45295cd8b566238e439123e9bbaf5e84 Binary files /dev/null and b/TTS/Kokoro/.venv/Lib/site-packages/spacy/tests/lang/bo/__pycache__/test_text.cpython-312.pyc differ diff --git a/TTS/Kokoro/.venv/Lib/site-packages/spacy/tests/lang/bo/test_text.py b/TTS/Kokoro/.venv/Lib/site-packages/spacy/tests/lang/bo/test_text.py new file mode 100644 index 0000000000000000000000000000000000000000..ae69f02771b56bb53a3f14842fed4b48fa56227d --- /dev/null +++ b/TTS/Kokoro/.venv/Lib/site-packages/spacy/tests/lang/bo/test_text.py @@ -0,0 +1,21 @@ +import pytest + + +@pytest.mark.parametrize( + "text,match", + [ + ("10", True), + ("1", True), + ("999.0", True), + ("གཅིག་", True), + ("གཉིས་", True), + ("ཀླད་ཀོར་", True), + ("བཅུ་གཅིག་", True), + ("ཁྱི་", False), + (",", False), + ], +) +def test_lex_attrs_like_number(bo_tokenizer, text, match): + tokens = bo_tokenizer(text) + assert len(tokens) == 1 + assert tokens[0].like_num == match diff --git a/TTS/Kokoro/.venv/Lib/site-packages/spacy/tests/lang/ca/__init__.py b/TTS/Kokoro/.venv/Lib/site-packages/spacy/tests/lang/ca/__init__.py new file mode 100644 index 0000000000000000000000000000000000000000..e69de29bb2d1d6434b8b29ae775ad8c2e48c5391 diff --git a/TTS/Kokoro/.venv/Lib/site-packages/spacy/tests/lang/ca/__pycache__/__init__.cpython-312.pyc b/TTS/Kokoro/.venv/Lib/site-packages/spacy/tests/lang/ca/__pycache__/__init__.cpython-312.pyc new file mode 100644 index 0000000000000000000000000000000000000000..d0839e91c455d9d0cb04de04145aeb1abeab81f6 Binary files /dev/null and b/TTS/Kokoro/.venv/Lib/site-packages/spacy/tests/lang/ca/__pycache__/__init__.cpython-312.pyc differ diff --git a/TTS/Kokoro/.venv/Lib/site-packages/spacy/tests/lang/ca/__pycache__/test_exception.cpython-312.pyc b/TTS/Kokoro/.venv/Lib/site-packages/spacy/tests/lang/ca/__pycache__/test_exception.cpython-312.pyc new file mode 100644 index 0000000000000000000000000000000000000000..9127e8a66b5438117ad8f55336364b586026d901 Binary files /dev/null and b/TTS/Kokoro/.venv/Lib/site-packages/spacy/tests/lang/ca/__pycache__/test_exception.cpython-312.pyc differ diff --git a/TTS/Kokoro/.venv/Lib/site-packages/spacy/tests/lang/ca/__pycache__/test_prefix_suffix_infix.cpython-312.pyc b/TTS/Kokoro/.venv/Lib/site-packages/spacy/tests/lang/ca/__pycache__/test_prefix_suffix_infix.cpython-312.pyc new file mode 100644 index 0000000000000000000000000000000000000000..0d341433821d78babc7ea7bb94233fcf82b3dd6b Binary files /dev/null and b/TTS/Kokoro/.venv/Lib/site-packages/spacy/tests/lang/ca/__pycache__/test_prefix_suffix_infix.cpython-312.pyc differ diff --git a/TTS/Kokoro/.venv/Lib/site-packages/spacy/tests/lang/ca/__pycache__/test_text.cpython-312.pyc b/TTS/Kokoro/.venv/Lib/site-packages/spacy/tests/lang/ca/__pycache__/test_text.cpython-312.pyc new file mode 100644 index 0000000000000000000000000000000000000000..dccd6e83e6c3ad8f7020582750ba7769ccde2226 Binary files /dev/null and b/TTS/Kokoro/.venv/Lib/site-packages/spacy/tests/lang/ca/__pycache__/test_text.cpython-312.pyc differ diff --git a/TTS/Kokoro/.venv/Lib/site-packages/spacy/tests/lang/ca/test_exception.py b/TTS/Kokoro/.venv/Lib/site-packages/spacy/tests/lang/ca/test_exception.py new file mode 100644 index 0000000000000000000000000000000000000000..3b423655dd61323bcf0beb9ea427b66b0bf23259 --- /dev/null +++ b/TTS/Kokoro/.venv/Lib/site-packages/spacy/tests/lang/ca/test_exception.py @@ -0,0 +1,28 @@ +import pytest + + +@pytest.mark.parametrize( + "text,lemma", + [("aprox.", "aproximadament"), ("pàg.", "pàgina"), ("p.ex.", "per exemple")], +) +def test_ca_tokenizer_handles_abbr(ca_tokenizer, text, lemma): + tokens = ca_tokenizer(text) + assert len(tokens) == 1 + + +def test_ca_tokenizer_handles_exc_in_text(ca_tokenizer): + text = "La Dra. Puig viu a la pl. dels Til·lers." + doc = ca_tokenizer(text) + assert [t.text for t in doc] == [ + "La", + "Dra.", + "Puig", + "viu", + "a", + "la", + "pl.", + "d", + "els", + "Til·lers", + ".", + ] diff --git a/TTS/Kokoro/.venv/Lib/site-packages/spacy/tests/lang/ca/test_prefix_suffix_infix.py b/TTS/Kokoro/.venv/Lib/site-packages/spacy/tests/lang/ca/test_prefix_suffix_infix.py new file mode 100644 index 0000000000000000000000000000000000000000..c79f1482e106d28d6c6380ca0a60e16c7063733b --- /dev/null +++ b/TTS/Kokoro/.venv/Lib/site-packages/spacy/tests/lang/ca/test_prefix_suffix_infix.py @@ -0,0 +1,18 @@ +import pytest + + +@pytest.mark.parametrize( + "text,expected_tokens", + [ + ("d'un", ["d'", "un"]), + ("s'ha", ["s'", "ha"]), + ("del", ["d", "el"]), + ("cantar-te", ["cantar", "-te"]), + ("-hola", ["-", "hola"]), + ], +) +def test_contractions(ca_tokenizer, text, expected_tokens): + """Test that the contractions are split into two tokens""" + tokens = ca_tokenizer(text) + assert len(tokens) == 2 + assert [t.text for t in tokens] == expected_tokens diff --git a/TTS/Kokoro/.venv/Lib/site-packages/spacy/tests/lang/ca/test_text.py b/TTS/Kokoro/.venv/Lib/site-packages/spacy/tests/lang/ca/test_text.py new file mode 100644 index 0000000000000000000000000000000000000000..aaa043a83d1f402272500b231e67e984f852d600 --- /dev/null +++ b/TTS/Kokoro/.venv/Lib/site-packages/spacy/tests/lang/ca/test_text.py @@ -0,0 +1,56 @@ +"""Test that longer and mixed texts are tokenized correctly.""" + +import pytest + + +def test_ca_tokenizer_handles_long_text(ca_tokenizer): + text = """Una taula amb grans gerres de begudes i palles de coloraines com a reclam. Una carta + cridanera amb ofertes de tapes, paelles i sangria. Un cambrer amb un somriure que convida a + seure. La ubicació perfecta: el bell mig de la Rambla. Però és la una del migdia d’un dimecres + de tardor i no hi ha ningú assegut a la terrassa del local. El dia és rúfol, però no fa fred i + a la majoria de terrasses de la Rambla hi ha poca gent. La immensa majoria dels clients -tret + d’alguna excepció com al restaurant Núria- són turistes. I la immensa majoria tenen entre mans + una gerra de cervesa. Ens asseiem -fotògraf i periodista- en una terrassa buida.""" + + tokens = ca_tokenizer(text) + assert len(tokens) == 146 + + +@pytest.mark.parametrize( + "text,length", + [ + ("Perquè va anar-hi?", 5), + ("El cotxe dels veins.", 6), + ("“Ah no?”", 5), + ("""Sí! "Anem", va contestar el Joan Carles""", 11), + ("Van córrer aprox. 10km", 5), + ("Llavors perqué...", 3), + ("Vull parlar-te'n demà al matí", 8), + ("Vull explicar-t'ho demà al matí", 8), + ], +) +def test_ca_tokenizer_handles_cnts(ca_tokenizer, text, length): + tokens = ca_tokenizer(text) + assert len(tokens) == length + + +@pytest.mark.parametrize( + "text,match", + [ + ("10", True), + ("1", True), + ("10,000", True), + ("10,00", True), + ("999.0", True), + ("un", True), + ("dos", True), + ("bilió", True), + ("gos", False), + (",", False), + ("1/2", True), + ], +) +def test_ca_lex_attrs_like_number(ca_tokenizer, text, match): + tokens = ca_tokenizer(text) + assert len(tokens) == 1 + assert tokens[0].like_num == match diff --git a/TTS/Kokoro/.venv/Lib/site-packages/spacy/tests/lang/cs/__init__.py b/TTS/Kokoro/.venv/Lib/site-packages/spacy/tests/lang/cs/__init__.py new file mode 100644 index 0000000000000000000000000000000000000000..e69de29bb2d1d6434b8b29ae775ad8c2e48c5391 diff --git a/TTS/Kokoro/.venv/Lib/site-packages/spacy/tests/lang/cs/__pycache__/__init__.cpython-312.pyc b/TTS/Kokoro/.venv/Lib/site-packages/spacy/tests/lang/cs/__pycache__/__init__.cpython-312.pyc new file mode 100644 index 0000000000000000000000000000000000000000..727853f9e838ae5afaaba1b8cdbdbbe07ebd3a78 Binary files /dev/null and b/TTS/Kokoro/.venv/Lib/site-packages/spacy/tests/lang/cs/__pycache__/__init__.cpython-312.pyc differ diff --git a/TTS/Kokoro/.venv/Lib/site-packages/spacy/tests/lang/cs/__pycache__/test_text.cpython-312.pyc b/TTS/Kokoro/.venv/Lib/site-packages/spacy/tests/lang/cs/__pycache__/test_text.cpython-312.pyc new file mode 100644 index 0000000000000000000000000000000000000000..d00bc9aa33c08b705483bfbf438dff7ebeaf33f2 Binary files /dev/null and b/TTS/Kokoro/.venv/Lib/site-packages/spacy/tests/lang/cs/__pycache__/test_text.cpython-312.pyc differ diff --git a/TTS/Kokoro/.venv/Lib/site-packages/spacy/tests/lang/cs/test_text.py b/TTS/Kokoro/.venv/Lib/site-packages/spacy/tests/lang/cs/test_text.py new file mode 100644 index 0000000000000000000000000000000000000000..304904ca0e386597cc0d46ea4136f56a06845925 --- /dev/null +++ b/TTS/Kokoro/.venv/Lib/site-packages/spacy/tests/lang/cs/test_text.py @@ -0,0 +1,23 @@ +import pytest + + +@pytest.mark.parametrize( + "text,match", + [ + ("10", True), + ("1", True), + ("10.000", True), + ("1000", True), + ("999,0", True), + ("devatenáct", True), + ("osmdesát", True), + ("kvadrilion", True), + ("Pes", False), + (",", False), + ("1/2", True), + ], +) +def test_lex_attrs_like_number(cs_tokenizer, text, match): + tokens = cs_tokenizer(text) + assert len(tokens) == 1 + assert tokens[0].like_num == match diff --git a/TTS/Kokoro/.venv/Lib/site-packages/spacy/tests/lang/da/__init__.py b/TTS/Kokoro/.venv/Lib/site-packages/spacy/tests/lang/da/__init__.py new file mode 100644 index 0000000000000000000000000000000000000000..e69de29bb2d1d6434b8b29ae775ad8c2e48c5391 diff --git a/TTS/Kokoro/.venv/Lib/site-packages/spacy/tests/lang/da/__pycache__/__init__.cpython-312.pyc b/TTS/Kokoro/.venv/Lib/site-packages/spacy/tests/lang/da/__pycache__/__init__.cpython-312.pyc new file mode 100644 index 0000000000000000000000000000000000000000..9bcc4f8f3ac8700a86ad7e20eff34e7f9b9874b1 Binary files /dev/null and b/TTS/Kokoro/.venv/Lib/site-packages/spacy/tests/lang/da/__pycache__/__init__.cpython-312.pyc differ diff --git a/TTS/Kokoro/.venv/Lib/site-packages/spacy/tests/lang/da/__pycache__/test_exceptions.cpython-312.pyc b/TTS/Kokoro/.venv/Lib/site-packages/spacy/tests/lang/da/__pycache__/test_exceptions.cpython-312.pyc new file mode 100644 index 0000000000000000000000000000000000000000..74475f1f9852495d1b1e0868c71847c59d1328b5 Binary files /dev/null and b/TTS/Kokoro/.venv/Lib/site-packages/spacy/tests/lang/da/__pycache__/test_exceptions.cpython-312.pyc differ diff --git a/TTS/Kokoro/.venv/Lib/site-packages/spacy/tests/lang/da/__pycache__/test_noun_chunks.cpython-312.pyc b/TTS/Kokoro/.venv/Lib/site-packages/spacy/tests/lang/da/__pycache__/test_noun_chunks.cpython-312.pyc new file mode 100644 index 0000000000000000000000000000000000000000..f10331e539221f3e7d70eb5b954ec41f54f0af24 Binary files /dev/null and b/TTS/Kokoro/.venv/Lib/site-packages/spacy/tests/lang/da/__pycache__/test_noun_chunks.cpython-312.pyc differ diff --git a/TTS/Kokoro/.venv/Lib/site-packages/spacy/tests/lang/da/__pycache__/test_prefix_suffix_infix.cpython-312.pyc b/TTS/Kokoro/.venv/Lib/site-packages/spacy/tests/lang/da/__pycache__/test_prefix_suffix_infix.cpython-312.pyc new file mode 100644 index 0000000000000000000000000000000000000000..344885c4eaef5273c85d19ac0e0f3a43bcf7ac5d Binary files /dev/null and b/TTS/Kokoro/.venv/Lib/site-packages/spacy/tests/lang/da/__pycache__/test_prefix_suffix_infix.cpython-312.pyc differ diff --git a/TTS/Kokoro/.venv/Lib/site-packages/spacy/tests/lang/da/__pycache__/test_text.cpython-312.pyc b/TTS/Kokoro/.venv/Lib/site-packages/spacy/tests/lang/da/__pycache__/test_text.cpython-312.pyc new file mode 100644 index 0000000000000000000000000000000000000000..8921ab5dd98d165a6ac8f9f256e7c27ec1f1183f Binary files /dev/null and b/TTS/Kokoro/.venv/Lib/site-packages/spacy/tests/lang/da/__pycache__/test_text.cpython-312.pyc differ diff --git a/TTS/Kokoro/.venv/Lib/site-packages/spacy/tests/lang/da/test_exceptions.py b/TTS/Kokoro/.venv/Lib/site-packages/spacy/tests/lang/da/test_exceptions.py new file mode 100644 index 0000000000000000000000000000000000000000..c46c79454c840eed2c6fbeee5d703acf20c25140 --- /dev/null +++ b/TTS/Kokoro/.venv/Lib/site-packages/spacy/tests/lang/da/test_exceptions.py @@ -0,0 +1,59 @@ +import pytest + + +@pytest.mark.parametrize("text", ["ca.", "m.a.o.", "Jan.", "Dec.", "kr.", "jf."]) +def test_da_tokenizer_handles_abbr(da_tokenizer, text): + tokens = da_tokenizer(text) + assert len(tokens) == 1 + + +@pytest.mark.parametrize("text", ["Jul.", "jul.", "Tor.", "Tors."]) +def test_da_tokenizer_handles_ambiguous_abbr(da_tokenizer, text): + tokens = da_tokenizer(text) + assert len(tokens) == 2 + + +@pytest.mark.parametrize("text", ["1.", "10.", "31."]) +def test_da_tokenizer_handles_dates(da_tokenizer, text): + tokens = da_tokenizer(text) + assert len(tokens) == 1 + + +def test_da_tokenizer_handles_exc_in_text(da_tokenizer): + text = "Det er bl.a. ikke meningen" + tokens = da_tokenizer(text) + assert len(tokens) == 5 + assert tokens[2].text == "bl.a." + + +def test_da_tokenizer_handles_custom_base_exc(da_tokenizer): + text = "Her er noget du kan kigge i." + tokens = da_tokenizer(text) + assert len(tokens) == 8 + assert tokens[6].text == "i" + assert tokens[7].text == "." + + +@pytest.mark.parametrize( + "text,n_tokens", + [ + ("Godt og/eller skidt", 3), + ("Kør 4 km/t på vejen", 5), + ("Det blæser 12 m/s.", 5), + ("Det blæser 12 m/sek. på havnen", 6), + ("Windows 8/Windows 10", 5), + ("Billeten virker til bus/tog/metro", 8), + ("26/02/2019", 1), + ("Kristiansen c/o Madsen", 3), + ("Sprogteknologi a/s", 2), + ("De boede i A/B Bellevue", 5), + # note: skipping due to weirdness in UD_Danish-DDT + # ("Rotorhastigheden er 3400 o/m.", 5), + ("Jeg købte billet t/r.", 5), + ("Murerarbejdsmand m/k søges", 3), + ("Netværket kører over TCP/IP", 4), + ], +) +def test_da_tokenizer_slash(da_tokenizer, text, n_tokens): + tokens = da_tokenizer(text) + assert len(tokens) == n_tokens diff --git a/TTS/Kokoro/.venv/Lib/site-packages/spacy/tests/lang/da/test_noun_chunks.py b/TTS/Kokoro/.venv/Lib/site-packages/spacy/tests/lang/da/test_noun_chunks.py new file mode 100644 index 0000000000000000000000000000000000000000..fd9089e4c5ec251c52358319899ae78c990cbb7c --- /dev/null +++ b/TTS/Kokoro/.venv/Lib/site-packages/spacy/tests/lang/da/test_noun_chunks.py @@ -0,0 +1,71 @@ +import pytest + +from spacy.tokens import Doc + + +def test_noun_chunks_is_parsed(da_tokenizer): + """Test that noun_chunks raises Value Error for 'da' language if Doc is not parsed. + To check this test, we're constructing a Doc + with a new Vocab here and forcing is_parsed to 'False' + to make sure the noun chunks don't run. + """ + doc = da_tokenizer("Det er en sætning") + with pytest.raises(ValueError): + list(doc.noun_chunks) + + +DA_NP_TEST_EXAMPLES = [ + ( + "Hun elsker at plukker frugt.", + ["PRON", "VERB", "PART", "VERB", "NOUN", "PUNCT"], + ["nsubj", "ROOT", "mark", "obj", "obj", "punct"], + [1, 0, 1, -2, -1, -4], + ["Hun", "frugt"], + ), + ( + "Påfugle er de smukkeste fugle.", + ["NOUN", "AUX", "DET", "ADJ", "NOUN", "PUNCT"], + ["nsubj", "cop", "det", "amod", "ROOT", "punct"], + [4, 3, 2, 1, 0, -1], + ["Påfugle", "de smukkeste fugle"], + ), + ( + "Rikke og Jacob Jensen glæder sig til en hyggelig skovtur", + [ + "PROPN", + "CCONJ", + "PROPN", + "PROPN", + "VERB", + "PRON", + "ADP", + "DET", + "ADJ", + "NOUN", + ], + ["nsubj", "cc", "conj", "flat", "ROOT", "obj", "case", "det", "amod", "obl"], + [4, 1, -2, -1, 0, -1, 3, 2, 1, -5], + ["Rikke", "Jacob Jensen", "sig", "en hyggelig skovtur"], + ), +] + + +@pytest.mark.parametrize( + "text,pos,deps,heads,expected_noun_chunks", DA_NP_TEST_EXAMPLES +) +def test_da_noun_chunks(da_tokenizer, text, pos, deps, heads, expected_noun_chunks): + tokens = da_tokenizer(text) + + assert len(heads) == len(pos) + doc = Doc( + tokens.vocab, + words=[t.text for t in tokens], + heads=[head + i for i, head in enumerate(heads)], + deps=deps, + pos=pos, + ) + + noun_chunks = list(doc.noun_chunks) + assert len(noun_chunks) == len(expected_noun_chunks) + for i, np in enumerate(noun_chunks): + assert np.text == expected_noun_chunks[i] diff --git a/TTS/Kokoro/.venv/Lib/site-packages/spacy/tests/lang/da/test_prefix_suffix_infix.py b/TTS/Kokoro/.venv/Lib/site-packages/spacy/tests/lang/da/test_prefix_suffix_infix.py new file mode 100644 index 0000000000000000000000000000000000000000..da8fe58ce1f3d8d5f136c9d37c4c6ffab61045b8 --- /dev/null +++ b/TTS/Kokoro/.venv/Lib/site-packages/spacy/tests/lang/da/test_prefix_suffix_infix.py @@ -0,0 +1,168 @@ +import pytest + + +@pytest.mark.parametrize("text", ["(under)"]) +def test_da_tokenizer_splits_no_special(da_tokenizer, text): + tokens = da_tokenizer(text) + assert len(tokens) == 3 + + +@pytest.mark.parametrize("text", ["ta'r", "Søren's", "Lars'"]) +def test_da_tokenizer_handles_no_punct(da_tokenizer, text): + tokens = da_tokenizer(text) + assert len(tokens) == 1 + + +@pytest.mark.parametrize("text", ["(ta'r"]) +def test_da_tokenizer_splits_prefix_punct(da_tokenizer, text): + tokens = da_tokenizer(text) + assert len(tokens) == 2 + assert tokens[0].text == "(" + assert tokens[1].text == "ta'r" + + +@pytest.mark.parametrize("text", ["ta'r)"]) +def test_da_tokenizer_splits_suffix_punct(da_tokenizer, text): + tokens = da_tokenizer(text) + assert len(tokens) == 2 + assert tokens[0].text == "ta'r" + assert tokens[1].text == ")" + + +@pytest.mark.parametrize( + "text,expected", [("(ta'r)", ["(", "ta'r", ")"]), ("'ta'r'", ["'", "ta'r", "'"])] +) +def test_da_tokenizer_splits_even_wrap(da_tokenizer, text, expected): + tokens = da_tokenizer(text) + assert len(tokens) == len(expected) + assert [t.text for t in tokens] == expected + + +@pytest.mark.parametrize("text", ["(ta'r?)"]) +def test_da_tokenizer_splits_uneven_wrap(da_tokenizer, text): + tokens = da_tokenizer(text) + assert len(tokens) == 4 + assert tokens[0].text == "(" + assert tokens[1].text == "ta'r" + assert tokens[2].text == "?" + assert tokens[3].text == ")" + + +@pytest.mark.parametrize( + "text,expected", + [("f.eks.", ["f.eks."]), ("fe.", ["fe", "."]), ("(f.eks.", ["(", "f.eks."])], +) +def test_da_tokenizer_splits_prefix_interact(da_tokenizer, text, expected): + tokens = da_tokenizer(text) + assert len(tokens) == len(expected) + assert [t.text for t in tokens] == expected + + +@pytest.mark.parametrize("text", ["f.eks.)"]) +def test_da_tokenizer_splits_suffix_interact(da_tokenizer, text): + tokens = da_tokenizer(text) + assert len(tokens) == 2 + assert tokens[0].text == "f.eks." + assert tokens[1].text == ")" + + +@pytest.mark.parametrize("text", ["(f.eks.)"]) +def test_da_tokenizer_splits_even_wrap_interact(da_tokenizer, text): + tokens = da_tokenizer(text) + assert len(tokens) == 3 + assert tokens[0].text == "(" + assert tokens[1].text == "f.eks." + assert tokens[2].text == ")" + + +@pytest.mark.parametrize("text", ["(f.eks.?)"]) +def test_da_tokenizer_splits_uneven_wrap_interact(da_tokenizer, text): + tokens = da_tokenizer(text) + assert len(tokens) == 4 + assert tokens[0].text == "(" + assert tokens[1].text == "f.eks." + assert tokens[2].text == "?" + assert tokens[3].text == ")" + + +@pytest.mark.parametrize("text", ["0,1-13,5", "0,0-0,1", "103,27-300", "1/2-3/4"]) +def test_da_tokenizer_handles_numeric_range(da_tokenizer, text): + tokens = da_tokenizer(text) + assert len(tokens) == 1 + + +@pytest.mark.parametrize("text", ["sort.Gul", "Hej.Verden"]) +def test_da_tokenizer_splits_period_infix(da_tokenizer, text): + tokens = da_tokenizer(text) + assert len(tokens) == 3 + + +@pytest.mark.parametrize("text", ["Hej,Verden", "en,to"]) +def test_da_tokenizer_splits_comma_infix(da_tokenizer, text): + tokens = da_tokenizer(text) + assert len(tokens) == 3 + assert tokens[0].text == text.split(",")[0] + assert tokens[1].text == "," + assert tokens[2].text == text.split(",")[1] + + +@pytest.mark.parametrize("text", ["sort...Gul", "sort...gul"]) +def test_da_tokenizer_splits_ellipsis_infix(da_tokenizer, text): + tokens = da_tokenizer(text) + assert len(tokens) == 3 + + +@pytest.mark.parametrize( + "text", + ["gå-på-mod", "4-hjulstræk", "100-Pfennig-frimærke", "TV-2-spots", "trofæ-vaeggen"], +) +def test_da_tokenizer_keeps_hyphens(da_tokenizer, text): + tokens = da_tokenizer(text) + assert len(tokens) == 1 + + +def test_da_tokenizer_splits_double_hyphen_infix(da_tokenizer): + tokens = da_tokenizer( + "Mange regler--eksempelvis bindestregs-reglerne--er komplicerede." + ) + assert len(tokens) == 9 + assert tokens[0].text == "Mange" + assert tokens[1].text == "regler" + assert tokens[2].text == "--" + assert tokens[3].text == "eksempelvis" + assert tokens[4].text == "bindestregs-reglerne" + assert tokens[5].text == "--" + assert tokens[6].text == "er" + assert tokens[7].text == "komplicerede" + + +def test_da_tokenizer_handles_posessives_and_contractions(da_tokenizer): + tokens = da_tokenizer( + "'DBA's, Lars' og Liz' bil sku' sgu' ik' ha' en bule, det ka' han ik' li' mere', sagde hun." + ) + assert len(tokens) == 25 + assert tokens[0].text == "'" + assert tokens[1].text == "DBA's" + assert tokens[2].text == "," + assert tokens[3].text == "Lars'" + assert tokens[4].text == "og" + assert tokens[5].text == "Liz'" + assert tokens[6].text == "bil" + assert tokens[7].text == "sku'" + assert tokens[8].text == "sgu'" + assert tokens[9].text == "ik'" + assert tokens[10].text == "ha'" + assert tokens[11].text == "en" + assert tokens[12].text == "bule" + assert tokens[13].text == "," + assert tokens[14].text == "det" + assert tokens[15].text == "ka'" + assert tokens[16].text == "han" + assert tokens[17].text == "ik'" + assert tokens[18].text == "li'" + assert tokens[19].text == "mere" + assert tokens[20].text == "'" + assert tokens[21].text == "," + assert tokens[22].text == "sagde" + assert tokens[23].text == "hun" + assert tokens[24].text == "." diff --git a/TTS/Kokoro/.venv/Lib/site-packages/spacy/tests/lang/da/test_text.py b/TTS/Kokoro/.venv/Lib/site-packages/spacy/tests/lang/da/test_text.py new file mode 100644 index 0000000000000000000000000000000000000000..6126fcc5507c4529979c5cbcaef1ba26b2201133 --- /dev/null +++ b/TTS/Kokoro/.venv/Lib/site-packages/spacy/tests/lang/da/test_text.py @@ -0,0 +1,41 @@ +import pytest + +from spacy.lang.da.lex_attrs import like_num + + +def test_da_tokenizer_handles_long_text(da_tokenizer): + text = """Der var så dejligt ude på landet. Det var sommer, kornet stod gult, havren grøn, +høet var rejst i stakke nede i de grønne enge, og der gik storken på sine lange, +røde ben og snakkede ægyptisk, for det sprog havde han lært af sin moder. + +Rundt om ager og eng var der store skove, og midt i skovene dybe søer; jo, der var rigtignok dejligt derude på landet!""" + tokens = da_tokenizer(text) + assert len(tokens) == 84 + + +@pytest.mark.parametrize( + "text,match", + [ + ("10", True), + ("1", True), + ("10.000", True), + ("10.00", True), + ("999,0", True), + ("en", True), + ("treoghalvfemsindstyvende", True), + ("hundrede", True), + ("hund", False), + (",", False), + ("1/2", True), + ], +) +def test_lex_attrs_like_number(da_tokenizer, text, match): + tokens = da_tokenizer(text) + assert len(tokens) == 1 + assert tokens[0].like_num == match + + +@pytest.mark.parametrize("word", ["elleve", "første"]) +def test_da_lex_attrs_capitals(word): + assert like_num(word) + assert like_num(word.upper()) diff --git a/TTS/Kokoro/.venv/Lib/site-packages/spacy/tests/lang/de/__init__.py b/TTS/Kokoro/.venv/Lib/site-packages/spacy/tests/lang/de/__init__.py new file mode 100644 index 0000000000000000000000000000000000000000..e69de29bb2d1d6434b8b29ae775ad8c2e48c5391 diff --git a/TTS/Kokoro/.venv/Lib/site-packages/spacy/tests/lang/de/__pycache__/__init__.cpython-312.pyc b/TTS/Kokoro/.venv/Lib/site-packages/spacy/tests/lang/de/__pycache__/__init__.cpython-312.pyc new file mode 100644 index 0000000000000000000000000000000000000000..9f5cb1016452aaf95be9fcb6ee2fbd7dcc11f4be Binary files /dev/null and b/TTS/Kokoro/.venv/Lib/site-packages/spacy/tests/lang/de/__pycache__/__init__.cpython-312.pyc differ diff --git a/TTS/Kokoro/.venv/Lib/site-packages/spacy/tests/lang/de/__pycache__/test_exceptions.cpython-312.pyc b/TTS/Kokoro/.venv/Lib/site-packages/spacy/tests/lang/de/__pycache__/test_exceptions.cpython-312.pyc new file mode 100644 index 0000000000000000000000000000000000000000..da4748982400394c84d9447688dc16570d8b565c Binary files /dev/null and b/TTS/Kokoro/.venv/Lib/site-packages/spacy/tests/lang/de/__pycache__/test_exceptions.cpython-312.pyc differ diff --git a/TTS/Kokoro/.venv/Lib/site-packages/spacy/tests/lang/de/__pycache__/test_noun_chunks.cpython-312.pyc b/TTS/Kokoro/.venv/Lib/site-packages/spacy/tests/lang/de/__pycache__/test_noun_chunks.cpython-312.pyc new file mode 100644 index 0000000000000000000000000000000000000000..19ea201c91ceffca1ab763b0793b572a57f26ee9 Binary files /dev/null and b/TTS/Kokoro/.venv/Lib/site-packages/spacy/tests/lang/de/__pycache__/test_noun_chunks.cpython-312.pyc differ diff --git a/TTS/Kokoro/.venv/Lib/site-packages/spacy/tests/lang/de/__pycache__/test_parser.cpython-312.pyc b/TTS/Kokoro/.venv/Lib/site-packages/spacy/tests/lang/de/__pycache__/test_parser.cpython-312.pyc new file mode 100644 index 0000000000000000000000000000000000000000..0fb12f40442caf6ea84ec33efa431eb001aa866b Binary files /dev/null and b/TTS/Kokoro/.venv/Lib/site-packages/spacy/tests/lang/de/__pycache__/test_parser.cpython-312.pyc differ diff --git a/TTS/Kokoro/.venv/Lib/site-packages/spacy/tests/lang/de/__pycache__/test_prefix_suffix_infix.cpython-312.pyc b/TTS/Kokoro/.venv/Lib/site-packages/spacy/tests/lang/de/__pycache__/test_prefix_suffix_infix.cpython-312.pyc new file mode 100644 index 0000000000000000000000000000000000000000..8e8a17b8e67b644d6075e2b02fb2367968b6c67a Binary files /dev/null and b/TTS/Kokoro/.venv/Lib/site-packages/spacy/tests/lang/de/__pycache__/test_prefix_suffix_infix.cpython-312.pyc differ diff --git a/TTS/Kokoro/.venv/Lib/site-packages/spacy/tests/lang/de/__pycache__/test_text.cpython-312.pyc b/TTS/Kokoro/.venv/Lib/site-packages/spacy/tests/lang/de/__pycache__/test_text.cpython-312.pyc new file mode 100644 index 0000000000000000000000000000000000000000..4fdd4f57178af951f0967414ec9e6c96e8aca704 Binary files /dev/null and b/TTS/Kokoro/.venv/Lib/site-packages/spacy/tests/lang/de/__pycache__/test_text.cpython-312.pyc differ diff --git a/TTS/Kokoro/.venv/Lib/site-packages/spacy/tests/lang/de/test_exceptions.py b/TTS/Kokoro/.venv/Lib/site-packages/spacy/tests/lang/de/test_exceptions.py new file mode 100644 index 0000000000000000000000000000000000000000..26ea9a04834287bb0def1ca2ef00e9778064b70d --- /dev/null +++ b/TTS/Kokoro/.venv/Lib/site-packages/spacy/tests/lang/de/test_exceptions.py @@ -0,0 +1,20 @@ +import pytest + + +@pytest.mark.parametrize("text", ["auf'm", "du's", "über'm", "wir's"]) +def test_de_tokenizer_splits_contractions(de_tokenizer, text): + tokens = de_tokenizer(text) + assert len(tokens) == 2 + + +@pytest.mark.parametrize("text", ["z.B.", "d.h.", "Jan.", "Dez.", "Chr."]) +def test_de_tokenizer_handles_abbr(de_tokenizer, text): + tokens = de_tokenizer(text) + assert len(tokens) == 1 + + +def test_de_tokenizer_handles_exc_in_text(de_tokenizer): + text = "Ich bin z.Zt. im Urlaub." + tokens = de_tokenizer(text) + assert len(tokens) == 6 + assert tokens[2].text == "z.Zt." diff --git a/TTS/Kokoro/.venv/Lib/site-packages/spacy/tests/lang/de/test_noun_chunks.py b/TTS/Kokoro/.venv/Lib/site-packages/spacy/tests/lang/de/test_noun_chunks.py new file mode 100644 index 0000000000000000000000000000000000000000..d263c1a467aed1cc2fc4e6081741910901b67128 --- /dev/null +++ b/TTS/Kokoro/.venv/Lib/site-packages/spacy/tests/lang/de/test_noun_chunks.py @@ -0,0 +1,8 @@ +import pytest + + +def test_noun_chunks_is_parsed_de(de_tokenizer): + """Test that noun_chunks raises Value Error for 'de' language if Doc is not parsed.""" + doc = de_tokenizer("Er lag auf seinem") + with pytest.raises(ValueError): + list(doc.noun_chunks) diff --git a/TTS/Kokoro/.venv/Lib/site-packages/spacy/tests/lang/de/test_parser.py b/TTS/Kokoro/.venv/Lib/site-packages/spacy/tests/lang/de/test_parser.py new file mode 100644 index 0000000000000000000000000000000000000000..8add086b07efc95f100a65e860f16aa88d3698d2 --- /dev/null +++ b/TTS/Kokoro/.venv/Lib/site-packages/spacy/tests/lang/de/test_parser.py @@ -0,0 +1,28 @@ +from spacy.tokens import Doc + + +def test_de_parser_noun_chunks_standard_de(de_vocab): + words = ["Eine", "Tasse", "steht", "auf", "dem", "Tisch", "."] + heads = [1, 2, 2, 2, 5, 3, 2] + pos = ["DET", "NOUN", "VERB", "ADP", "DET", "NOUN", "PUNCT"] + deps = ["nk", "sb", "ROOT", "mo", "nk", "nk", "punct"] + doc = Doc(de_vocab, words=words, pos=pos, deps=deps, heads=heads) + chunks = list(doc.noun_chunks) + assert len(chunks) == 2 + assert chunks[0].text_with_ws == "Eine Tasse " + assert chunks[1].text_with_ws == "dem Tisch " + + +def test_de_extended_chunk(de_vocab): + # fmt: off + words = ["Die", "Sängerin", "singt", "mit", "einer", "Tasse", "Kaffee", "Arien", "."] + heads = [1, 2, 2, 2, 5, 3, 5, 2, 2] + pos = ["DET", "NOUN", "VERB", "ADP", "DET", "NOUN", "NOUN", "NOUN", "PUNCT"] + deps = ["nk", "sb", "ROOT", "mo", "nk", "nk", "nk", "oa", "punct"] + # fmt: on + doc = Doc(de_vocab, words=words, pos=pos, deps=deps, heads=heads) + chunks = list(doc.noun_chunks) + assert len(chunks) == 3 + assert chunks[0].text_with_ws == "Die Sängerin " + assert chunks[1].text_with_ws == "einer Tasse Kaffee " + assert chunks[2].text_with_ws == "Arien " diff --git a/TTS/Kokoro/.venv/Lib/site-packages/spacy/tests/lang/de/test_prefix_suffix_infix.py b/TTS/Kokoro/.venv/Lib/site-packages/spacy/tests/lang/de/test_prefix_suffix_infix.py new file mode 100644 index 0000000000000000000000000000000000000000..8a58088083b202ca9b338adb89b9fb7e854fa398 --- /dev/null +++ b/TTS/Kokoro/.venv/Lib/site-packages/spacy/tests/lang/de/test_prefix_suffix_infix.py @@ -0,0 +1,108 @@ +import pytest + + +@pytest.mark.parametrize("text", ["(unter)"]) +def test_de_tokenizer_splits_no_special(de_tokenizer, text): + tokens = de_tokenizer(text) + assert len(tokens) == 3 + + +@pytest.mark.parametrize("text", ["unter'm"]) +def test_de_tokenizer_splits_no_punct(de_tokenizer, text): + tokens = de_tokenizer(text) + assert len(tokens) == 2 + + +@pytest.mark.parametrize("text", ["(unter'm"]) +def test_de_tokenizer_splits_prefix_punct(de_tokenizer, text): + tokens = de_tokenizer(text) + assert len(tokens) == 3 + + +@pytest.mark.parametrize("text", ["unter'm)"]) +def test_de_tokenizer_splits_suffix_punct(de_tokenizer, text): + tokens = de_tokenizer(text) + assert len(tokens) == 3 + + +@pytest.mark.parametrize("text", ["(unter'm)"]) +def test_de_tokenizer_splits_even_wrap(de_tokenizer, text): + tokens = de_tokenizer(text) + assert len(tokens) == 4 + + +@pytest.mark.parametrize("text", ["(unter'm?)"]) +def test_de_tokenizer_splits_uneven_wrap(de_tokenizer, text): + tokens = de_tokenizer(text) + assert len(tokens) == 5 + + +@pytest.mark.parametrize("text,length", [("z.B.", 1), ("zb.", 2), ("(z.B.", 2)]) +def test_de_tokenizer_splits_prefix_interact(de_tokenizer, text, length): + tokens = de_tokenizer(text) + assert len(tokens) == length + + +@pytest.mark.parametrize("text", ["z.B.)"]) +def test_de_tokenizer_splits_suffix_interact(de_tokenizer, text): + tokens = de_tokenizer(text) + assert len(tokens) == 2 + + +@pytest.mark.parametrize("text", ["(z.B.)"]) +def test_de_tokenizer_splits_even_wrap_interact(de_tokenizer, text): + tokens = de_tokenizer(text) + assert len(tokens) == 3 + + +@pytest.mark.parametrize("text", ["(z.B.?)"]) +def test_de_tokenizer_splits_uneven_wrap_interact(de_tokenizer, text): + tokens = de_tokenizer(text) + assert len(tokens) == 4 + + +@pytest.mark.parametrize("text", ["0.1-13.5", "0.0-0.1", "103.27-300"]) +def test_de_tokenizer_splits_numeric_range(de_tokenizer, text): + tokens = de_tokenizer(text) + assert len(tokens) == 3 + + +@pytest.mark.parametrize("text", ["blau.Rot", "Hallo.Welt"]) +def test_de_tokenizer_splits_period_infix(de_tokenizer, text): + tokens = de_tokenizer(text) + assert len(tokens) == 3 + + +@pytest.mark.parametrize("text", ["Hallo,Welt", "eins,zwei"]) +def test_de_tokenizer_splits_comma_infix(de_tokenizer, text): + tokens = de_tokenizer(text) + assert len(tokens) == 3 + assert tokens[0].text == text.split(",")[0] + assert tokens[1].text == "," + assert tokens[2].text == text.split(",")[1] + + +@pytest.mark.parametrize("text", ["blau...Rot", "blau...rot"]) +def test_de_tokenizer_splits_ellipsis_infix(de_tokenizer, text): + tokens = de_tokenizer(text) + assert len(tokens) == 3 + + +@pytest.mark.parametrize("text", ["Islam-Konferenz", "Ost-West-Konflikt"]) +def test_de_tokenizer_keeps_hyphens(de_tokenizer, text): + tokens = de_tokenizer(text) + assert len(tokens) == 1 + + +def test_de_tokenizer_splits_double_hyphen_infix(de_tokenizer): + tokens = de_tokenizer("Viele Regeln--wie die Bindestrich-Regeln--sind kompliziert.") + assert len(tokens) == 10 + assert tokens[0].text == "Viele" + assert tokens[1].text == "Regeln" + assert tokens[2].text == "--" + assert tokens[3].text == "wie" + assert tokens[4].text == "die" + assert tokens[5].text == "Bindestrich-Regeln" + assert tokens[6].text == "--" + assert tokens[7].text == "sind" + assert tokens[8].text == "kompliziert" diff --git a/TTS/Kokoro/.venv/Lib/site-packages/spacy/tests/lang/de/test_text.py b/TTS/Kokoro/.venv/Lib/site-packages/spacy/tests/lang/de/test_text.py new file mode 100644 index 0000000000000000000000000000000000000000..51f697cf195c683006cb67382cbf8a8b8a8e7c36 --- /dev/null +++ b/TTS/Kokoro/.venv/Lib/site-packages/spacy/tests/lang/de/test_text.py @@ -0,0 +1,45 @@ +import pytest + + +def test_de_tokenizer_handles_long_text(de_tokenizer): + text = """Die Verwandlung + +Als Gregor Samsa eines Morgens aus unruhigen Träumen erwachte, fand er sich in +seinem Bett zu einem ungeheueren Ungeziefer verwandelt. + +Er lag auf seinem panzerartig harten Rücken und sah, wenn er den Kopf ein wenig +hob, seinen gewölbten, braunen, von bogenförmigen Versteifungen geteilten +Bauch, auf dessen Höhe sich die Bettdecke, zum gänzlichen Niedergleiten bereit, +kaum noch erhalten konnte. Seine vielen, im Vergleich zu seinem sonstigen +Umfang kläglich dünnen Beine flimmerten ihm hilflos vor den Augen. + +»Was ist mit mir geschehen?«, dachte er.""" + + tokens = de_tokenizer(text) + assert len(tokens) == 109 + + +@pytest.mark.parametrize( + "text", + [ + "Donaudampfschifffahrtsgesellschaftskapitänsanwärterposten", + "Rindfleischetikettierungsüberwachungsaufgabenübertragungsgesetz", + "Kraftfahrzeug-Haftpflichtversicherung", + "Vakuum-Mittelfrequenz-Induktionsofen", + ], +) +def test_de_tokenizer_handles_long_words(de_tokenizer, text): + tokens = de_tokenizer(text) + assert len(tokens) == 1 + + +@pytest.mark.parametrize( + "text,length", + [ + ("»Was ist mit mir geschehen?«, dachte er.", 12), + ("“Dies frühzeitige Aufstehen”, dachte er, “macht einen ganz blödsinnig. ", 15), + ], +) +def test_de_tokenizer_handles_examples(de_tokenizer, text, length): + tokens = de_tokenizer(text) + assert len(tokens) == length diff --git a/TTS/Kokoro/.venv/Lib/site-packages/spacy/tests/lang/dsb/__init__.py b/TTS/Kokoro/.venv/Lib/site-packages/spacy/tests/lang/dsb/__init__.py new file mode 100644 index 0000000000000000000000000000000000000000..e69de29bb2d1d6434b8b29ae775ad8c2e48c5391 diff --git a/TTS/Kokoro/.venv/Lib/site-packages/spacy/tests/lang/dsb/__pycache__/__init__.cpython-312.pyc b/TTS/Kokoro/.venv/Lib/site-packages/spacy/tests/lang/dsb/__pycache__/__init__.cpython-312.pyc new file mode 100644 index 0000000000000000000000000000000000000000..1a08b42273b1d88ea42d31a317977692303ce654 Binary files /dev/null and b/TTS/Kokoro/.venv/Lib/site-packages/spacy/tests/lang/dsb/__pycache__/__init__.cpython-312.pyc differ diff --git a/TTS/Kokoro/.venv/Lib/site-packages/spacy/tests/lang/dsb/__pycache__/test_text.cpython-312.pyc b/TTS/Kokoro/.venv/Lib/site-packages/spacy/tests/lang/dsb/__pycache__/test_text.cpython-312.pyc new file mode 100644 index 0000000000000000000000000000000000000000..98e765f5d4ca5ce886210382161030be603d45a9 Binary files /dev/null and b/TTS/Kokoro/.venv/Lib/site-packages/spacy/tests/lang/dsb/__pycache__/test_text.cpython-312.pyc differ diff --git a/TTS/Kokoro/.venv/Lib/site-packages/spacy/tests/lang/dsb/__pycache__/test_tokenizer.cpython-312.pyc b/TTS/Kokoro/.venv/Lib/site-packages/spacy/tests/lang/dsb/__pycache__/test_tokenizer.cpython-312.pyc new file mode 100644 index 0000000000000000000000000000000000000000..ec80edff6a63e057394ad7a900bbf9591810daac Binary files /dev/null and b/TTS/Kokoro/.venv/Lib/site-packages/spacy/tests/lang/dsb/__pycache__/test_tokenizer.cpython-312.pyc differ diff --git a/TTS/Kokoro/.venv/Lib/site-packages/spacy/tests/lang/dsb/test_text.py b/TTS/Kokoro/.venv/Lib/site-packages/spacy/tests/lang/dsb/test_text.py new file mode 100644 index 0000000000000000000000000000000000000000..3627a6059a3de5f46e43a69388426b5fe46c2569 --- /dev/null +++ b/TTS/Kokoro/.venv/Lib/site-packages/spacy/tests/lang/dsb/test_text.py @@ -0,0 +1,25 @@ +import pytest + + +@pytest.mark.parametrize( + "text,match", + [ + ("10", True), + ("1", True), + ("10,000", True), + ("10,00", True), + ("jadno", True), + ("dwanassćo", True), + ("milion", True), + ("sto", True), + ("ceła", False), + ("kopica", False), + ("narěcow", False), + (",", False), + ("1/2", True), + ], +) +def test_lex_attrs_like_number(dsb_tokenizer, text, match): + tokens = dsb_tokenizer(text) + assert len(tokens) == 1 + assert tokens[0].like_num == match diff --git a/TTS/Kokoro/.venv/Lib/site-packages/spacy/tests/lang/dsb/test_tokenizer.py b/TTS/Kokoro/.venv/Lib/site-packages/spacy/tests/lang/dsb/test_tokenizer.py new file mode 100644 index 0000000000000000000000000000000000000000..d759ad976384e41afe4ccb45ad9a6b047a55a128 --- /dev/null +++ b/TTS/Kokoro/.venv/Lib/site-packages/spacy/tests/lang/dsb/test_tokenizer.py @@ -0,0 +1,29 @@ +import pytest + +DSB_BASIC_TOKENIZATION_TESTS = [ + ( + "Ale eksistěrujo mimo togo ceła kopica narěcow, ako na pśikład slěpjańska.", + [ + "Ale", + "eksistěrujo", + "mimo", + "togo", + "ceła", + "kopica", + "narěcow", + ",", + "ako", + "na", + "pśikład", + "slěpjańska", + ".", + ], + ), +] + + +@pytest.mark.parametrize("text,expected_tokens", DSB_BASIC_TOKENIZATION_TESTS) +def test_dsb_tokenizer_basic(dsb_tokenizer, text, expected_tokens): + tokens = dsb_tokenizer(text) + token_list = [token.text for token in tokens if not token.is_space] + assert expected_tokens == token_list diff --git a/TTS/Kokoro/.venv/Lib/site-packages/spacy/tests/lang/el/__init__.py b/TTS/Kokoro/.venv/Lib/site-packages/spacy/tests/lang/el/__init__.py new file mode 100644 index 0000000000000000000000000000000000000000..e69de29bb2d1d6434b8b29ae775ad8c2e48c5391 diff --git a/TTS/Kokoro/.venv/Lib/site-packages/spacy/tests/lang/el/__pycache__/__init__.cpython-312.pyc b/TTS/Kokoro/.venv/Lib/site-packages/spacy/tests/lang/el/__pycache__/__init__.cpython-312.pyc new file mode 100644 index 0000000000000000000000000000000000000000..d0affa05bc921d440bccfab6f9b546bf3e278e31 Binary files /dev/null and b/TTS/Kokoro/.venv/Lib/site-packages/spacy/tests/lang/el/__pycache__/__init__.cpython-312.pyc differ diff --git a/TTS/Kokoro/.venv/Lib/site-packages/spacy/tests/lang/el/__pycache__/test_exception.cpython-312.pyc b/TTS/Kokoro/.venv/Lib/site-packages/spacy/tests/lang/el/__pycache__/test_exception.cpython-312.pyc new file mode 100644 index 0000000000000000000000000000000000000000..5f659d953323214dabc9fb9cd7387103cb499285 Binary files /dev/null and b/TTS/Kokoro/.venv/Lib/site-packages/spacy/tests/lang/el/__pycache__/test_exception.cpython-312.pyc differ diff --git a/TTS/Kokoro/.venv/Lib/site-packages/spacy/tests/lang/el/__pycache__/test_noun_chunks.cpython-312.pyc b/TTS/Kokoro/.venv/Lib/site-packages/spacy/tests/lang/el/__pycache__/test_noun_chunks.cpython-312.pyc new file mode 100644 index 0000000000000000000000000000000000000000..52d3e7e930c7575ce9cabfc8a4a7bd73384e53d1 Binary files /dev/null and b/TTS/Kokoro/.venv/Lib/site-packages/spacy/tests/lang/el/__pycache__/test_noun_chunks.cpython-312.pyc differ diff --git a/TTS/Kokoro/.venv/Lib/site-packages/spacy/tests/lang/el/__pycache__/test_text.cpython-312.pyc b/TTS/Kokoro/.venv/Lib/site-packages/spacy/tests/lang/el/__pycache__/test_text.cpython-312.pyc new file mode 100644 index 0000000000000000000000000000000000000000..f5e5013503c88bf6bcc169b44fa7ef2e08a3117e Binary files /dev/null and b/TTS/Kokoro/.venv/Lib/site-packages/spacy/tests/lang/el/__pycache__/test_text.cpython-312.pyc differ diff --git a/TTS/Kokoro/.venv/Lib/site-packages/spacy/tests/lang/el/test_exception.py b/TTS/Kokoro/.venv/Lib/site-packages/spacy/tests/lang/el/test_exception.py new file mode 100644 index 0000000000000000000000000000000000000000..ca25d37fdf7dc37866b29a1fcf3571fe03c57ed2 --- /dev/null +++ b/TTS/Kokoro/.venv/Lib/site-packages/spacy/tests/lang/el/test_exception.py @@ -0,0 +1,14 @@ +import pytest + + +@pytest.mark.parametrize("text", ["αριθ.", "τρισ.", "δισ.", "σελ."]) +def test_el_tokenizer_handles_abbr(el_tokenizer, text): + tokens = el_tokenizer(text) + assert len(tokens) == 1 + + +def test_el_tokenizer_handles_exc_in_text(el_tokenizer): + text = "Στα 14 τρισ. δολάρια το κόστος από την άνοδο της στάθμης της θάλασσας." + tokens = el_tokenizer(text) + assert len(tokens) == 14 + assert tokens[2].text == "τρισ." diff --git a/TTS/Kokoro/.venv/Lib/site-packages/spacy/tests/lang/el/test_noun_chunks.py b/TTS/Kokoro/.venv/Lib/site-packages/spacy/tests/lang/el/test_noun_chunks.py new file mode 100644 index 0000000000000000000000000000000000000000..5f95ca869332c55aaa30beefefb673ec696b4fd9 --- /dev/null +++ b/TTS/Kokoro/.venv/Lib/site-packages/spacy/tests/lang/el/test_noun_chunks.py @@ -0,0 +1,8 @@ +import pytest + + +def test_noun_chunks_is_parsed_el(el_tokenizer): + """Test that noun_chunks raises Value Error for 'el' language if Doc is not parsed.""" + doc = el_tokenizer("είναι χώρα της νοτιοανατολικής") + with pytest.raises(ValueError): + list(doc.noun_chunks) diff --git a/TTS/Kokoro/.venv/Lib/site-packages/spacy/tests/lang/el/test_text.py b/TTS/Kokoro/.venv/Lib/site-packages/spacy/tests/lang/el/test_text.py new file mode 100644 index 0000000000000000000000000000000000000000..2d0dcd3844d5c08161e16ccd25c155ea6acb1b67 --- /dev/null +++ b/TTS/Kokoro/.venv/Lib/site-packages/spacy/tests/lang/el/test_text.py @@ -0,0 +1,31 @@ +import pytest + + +def test_el_tokenizer_handles_long_text(el_tokenizer): + text = """Η Ελλάδα (παλαιότερα Ελλάς), επίσημα γνωστή ως Ελληνική Δημοκρατία,\ + είναι χώρα της νοτιοανατολικής Ευρώπης στο νοτιότερο άκρο της Βαλκανικής χερσονήσου.\ + Συνορεύει στα βορειοδυτικά με την Αλβανία, στα βόρεια με την πρώην\ + Γιουγκοσλαβική Δημοκρατία της Μακεδονίας και τη Βουλγαρία και στα βορειοανατολικά με την Τουρκία.""" + tokens = el_tokenizer(text) + assert len(tokens) == 54 + + +@pytest.mark.parametrize( + "text,length", + [ + ("Διοικητικά η Ελλάδα διαιρείται σε 13 Περιφέρειες.", 8), + ("Η εκπαίδευση στην Ελλάδα χωρίζεται κυρίως σε τρία επίπεδα.", 10), + ( + "Η Ελλάδα είναι μία από τις χώρες της Ευρωπαϊκής Ένωσης (ΕΕ) που διαθέτει σηµαντικό ορυκτό πλούτο.", + 19, + ), + ( + "Η ναυτιλία αποτέλεσε ένα σημαντικό στοιχείο της Ελληνικής οικονομικής δραστηριότητας από τα αρχαία χρόνια.", + 15, + ), + ("Η Ελλάδα είναι μέλος σε αρκετούς διεθνείς οργανισμούς.", 9), + ], +) +def test_el_tokenizer_handles_cnts(el_tokenizer, text, length): + tokens = el_tokenizer(text) + assert len(tokens) == length diff --git a/TTS/Kokoro/.venv/Lib/site-packages/spacy/tests/lang/en/__init__.py b/TTS/Kokoro/.venv/Lib/site-packages/spacy/tests/lang/en/__init__.py new file mode 100644 index 0000000000000000000000000000000000000000..e69de29bb2d1d6434b8b29ae775ad8c2e48c5391 diff --git a/TTS/Kokoro/.venv/Lib/site-packages/spacy/tests/lang/en/__pycache__/__init__.cpython-312.pyc b/TTS/Kokoro/.venv/Lib/site-packages/spacy/tests/lang/en/__pycache__/__init__.cpython-312.pyc new file mode 100644 index 0000000000000000000000000000000000000000..a52b87d868c5434597fe8c100ef3d46edce282e7 Binary files /dev/null and b/TTS/Kokoro/.venv/Lib/site-packages/spacy/tests/lang/en/__pycache__/__init__.cpython-312.pyc differ diff --git a/TTS/Kokoro/.venv/Lib/site-packages/spacy/tests/lang/en/__pycache__/test_customized_tokenizer.cpython-312.pyc b/TTS/Kokoro/.venv/Lib/site-packages/spacy/tests/lang/en/__pycache__/test_customized_tokenizer.cpython-312.pyc new file mode 100644 index 0000000000000000000000000000000000000000..09fa0e7fdf89c14d1ef2d3c30499d755a5f73ddb Binary files /dev/null and b/TTS/Kokoro/.venv/Lib/site-packages/spacy/tests/lang/en/__pycache__/test_customized_tokenizer.cpython-312.pyc differ diff --git a/TTS/Kokoro/.venv/Lib/site-packages/spacy/tests/lang/en/__pycache__/test_exceptions.cpython-312.pyc b/TTS/Kokoro/.venv/Lib/site-packages/spacy/tests/lang/en/__pycache__/test_exceptions.cpython-312.pyc new file mode 100644 index 0000000000000000000000000000000000000000..3429a874f992d77f16a4046d6a375fa6f8b79246 Binary files /dev/null and b/TTS/Kokoro/.venv/Lib/site-packages/spacy/tests/lang/en/__pycache__/test_exceptions.cpython-312.pyc differ diff --git a/TTS/Kokoro/.venv/Lib/site-packages/spacy/tests/lang/en/__pycache__/test_indices.cpython-312.pyc b/TTS/Kokoro/.venv/Lib/site-packages/spacy/tests/lang/en/__pycache__/test_indices.cpython-312.pyc new file mode 100644 index 0000000000000000000000000000000000000000..1a9786eecf72af669ae21f3dbfc5e83532febac8 Binary files /dev/null and b/TTS/Kokoro/.venv/Lib/site-packages/spacy/tests/lang/en/__pycache__/test_indices.cpython-312.pyc differ diff --git a/TTS/Kokoro/.venv/Lib/site-packages/spacy/tests/lang/en/__pycache__/test_noun_chunks.cpython-312.pyc b/TTS/Kokoro/.venv/Lib/site-packages/spacy/tests/lang/en/__pycache__/test_noun_chunks.cpython-312.pyc new file mode 100644 index 0000000000000000000000000000000000000000..781e88971462aea968fe3ef7332055c517727dd5 Binary files /dev/null and b/TTS/Kokoro/.venv/Lib/site-packages/spacy/tests/lang/en/__pycache__/test_noun_chunks.cpython-312.pyc differ diff --git a/TTS/Kokoro/.venv/Lib/site-packages/spacy/tests/lang/en/__pycache__/test_parser.cpython-312.pyc b/TTS/Kokoro/.venv/Lib/site-packages/spacy/tests/lang/en/__pycache__/test_parser.cpython-312.pyc new file mode 100644 index 0000000000000000000000000000000000000000..2663d746cefb58d3ba6ce74c81cc5fac4bae211e Binary files /dev/null and b/TTS/Kokoro/.venv/Lib/site-packages/spacy/tests/lang/en/__pycache__/test_parser.cpython-312.pyc differ diff --git a/TTS/Kokoro/.venv/Lib/site-packages/spacy/tests/lang/en/__pycache__/test_prefix_suffix_infix.cpython-312.pyc b/TTS/Kokoro/.venv/Lib/site-packages/spacy/tests/lang/en/__pycache__/test_prefix_suffix_infix.cpython-312.pyc new file mode 100644 index 0000000000000000000000000000000000000000..0af8f5c7f9fcbc99c8a39e5328e11a0a6b90ac94 Binary files /dev/null and b/TTS/Kokoro/.venv/Lib/site-packages/spacy/tests/lang/en/__pycache__/test_prefix_suffix_infix.cpython-312.pyc differ diff --git a/TTS/Kokoro/.venv/Lib/site-packages/spacy/tests/lang/en/__pycache__/test_punct.cpython-312.pyc b/TTS/Kokoro/.venv/Lib/site-packages/spacy/tests/lang/en/__pycache__/test_punct.cpython-312.pyc new file mode 100644 index 0000000000000000000000000000000000000000..80a216067c20a273a14a33a3896e6ee9bb15ce8d Binary files /dev/null and b/TTS/Kokoro/.venv/Lib/site-packages/spacy/tests/lang/en/__pycache__/test_punct.cpython-312.pyc differ diff --git a/TTS/Kokoro/.venv/Lib/site-packages/spacy/tests/lang/en/__pycache__/test_sbd.cpython-312.pyc b/TTS/Kokoro/.venv/Lib/site-packages/spacy/tests/lang/en/__pycache__/test_sbd.cpython-312.pyc new file mode 100644 index 0000000000000000000000000000000000000000..0d7cc49d7480266b3c8623b61f4001232a6ef8db Binary files /dev/null and b/TTS/Kokoro/.venv/Lib/site-packages/spacy/tests/lang/en/__pycache__/test_sbd.cpython-312.pyc differ diff --git a/TTS/Kokoro/.venv/Lib/site-packages/spacy/tests/lang/en/__pycache__/test_text.cpython-312.pyc b/TTS/Kokoro/.venv/Lib/site-packages/spacy/tests/lang/en/__pycache__/test_text.cpython-312.pyc new file mode 100644 index 0000000000000000000000000000000000000000..bc66bc28db4c15e9e6a31f79bd9df5e82fa5fbcc Binary files /dev/null and b/TTS/Kokoro/.venv/Lib/site-packages/spacy/tests/lang/en/__pycache__/test_text.cpython-312.pyc differ diff --git a/TTS/Kokoro/.venv/Lib/site-packages/spacy/tests/lang/en/__pycache__/test_tokenizer.cpython-312.pyc b/TTS/Kokoro/.venv/Lib/site-packages/spacy/tests/lang/en/__pycache__/test_tokenizer.cpython-312.pyc new file mode 100644 index 0000000000000000000000000000000000000000..4a1e7d11d8968cfaa49019fa582983d8c9b08a88 Binary files /dev/null and b/TTS/Kokoro/.venv/Lib/site-packages/spacy/tests/lang/en/__pycache__/test_tokenizer.cpython-312.pyc differ diff --git a/TTS/Kokoro/.venv/Lib/site-packages/spacy/tests/lang/en/test_customized_tokenizer.py b/TTS/Kokoro/.venv/Lib/site-packages/spacy/tests/lang/en/test_customized_tokenizer.py new file mode 100644 index 0000000000000000000000000000000000000000..02144372bfa031ec34b6eda843d592c8998d9633 --- /dev/null +++ b/TTS/Kokoro/.venv/Lib/site-packages/spacy/tests/lang/en/test_customized_tokenizer.py @@ -0,0 +1,154 @@ +import re + +import pytest + +from spacy.lang.en import English +from spacy.tokenizer import Tokenizer +from spacy.util import compile_infix_regex, compile_prefix_regex, compile_suffix_regex + + +@pytest.fixture +def custom_en_tokenizer(en_vocab): + prefix_re = compile_prefix_regex(English.Defaults.prefixes) + suffix_re = compile_suffix_regex(English.Defaults.suffixes) + custom_infixes = [ + r"\.\.\.+", + r"(?<=[0-9])-(?=[0-9])", + r"[0-9]+(,[0-9]+)+", + r"[\[\]!&:,()\*—–\/-]", + ] + infix_re = compile_infix_regex(custom_infixes) + token_match_re = re.compile("a-b") + return Tokenizer( + en_vocab, + English.Defaults.tokenizer_exceptions, + prefix_re.search, + suffix_re.search, + infix_re.finditer, + token_match=token_match_re.match, + ) + + +def test_en_customized_tokenizer_handles_infixes(custom_en_tokenizer): + sentence = "The 8 and 10-county definitions are not used for the greater Southern California Megaregion." + context = [word.text for word in custom_en_tokenizer(sentence)] + assert context == [ + "The", + "8", + "and", + "10", + "-", + "county", + "definitions", + "are", + "not", + "used", + "for", + "the", + "greater", + "Southern", + "California", + "Megaregion", + ".", + ] + # the trailing '-' may cause Assertion Error + sentence = "The 8- and 10-county definitions are not used for the greater Southern California Megaregion." + context = [word.text for word in custom_en_tokenizer(sentence)] + assert context == [ + "The", + "8", + "-", + "and", + "10", + "-", + "county", + "definitions", + "are", + "not", + "used", + "for", + "the", + "greater", + "Southern", + "California", + "Megaregion", + ".", + ] + + +def test_en_customized_tokenizer_handles_token_match(custom_en_tokenizer): + sentence = "The 8 and 10-county definitions a-b not used for the greater Southern California Megaregion." + context = [word.text for word in custom_en_tokenizer(sentence)] + assert context == [ + "The", + "8", + "and", + "10", + "-", + "county", + "definitions", + "a-b", + "not", + "used", + "for", + "the", + "greater", + "Southern", + "California", + "Megaregion", + ".", + ] + + +def test_en_customized_tokenizer_handles_rules(custom_en_tokenizer): + sentence = "The 8 and 10-county definitions are not used for the greater Southern California Megaregion. :)" + context = [word.text for word in custom_en_tokenizer(sentence)] + assert context == [ + "The", + "8", + "and", + "10", + "-", + "county", + "definitions", + "are", + "not", + "used", + "for", + "the", + "greater", + "Southern", + "California", + "Megaregion", + ".", + ":)", + ] + + +def test_en_customized_tokenizer_handles_rules_property(custom_en_tokenizer): + sentence = "The 8 and 10-county definitions are not used for the greater Southern California Megaregion. :)" + rules = custom_en_tokenizer.rules + del rules[":)"] + custom_en_tokenizer.rules = rules + context = [word.text for word in custom_en_tokenizer(sentence)] + assert context == [ + "The", + "8", + "and", + "10", + "-", + "county", + "definitions", + "are", + "not", + "used", + "for", + "the", + "greater", + "Southern", + "California", + "Megaregion", + ".", + ":", + ")", + ] diff --git a/TTS/Kokoro/.venv/Lib/site-packages/spacy/tests/lang/en/test_exceptions.py b/TTS/Kokoro/.venv/Lib/site-packages/spacy/tests/lang/en/test_exceptions.py new file mode 100644 index 0000000000000000000000000000000000000000..f67eae65ff47ce17a561dc2088742b54dafccbb5 --- /dev/null +++ b/TTS/Kokoro/.venv/Lib/site-packages/spacy/tests/lang/en/test_exceptions.py @@ -0,0 +1,127 @@ +import pytest + + +def test_en_tokenizer_handles_basic_contraction(en_tokenizer): + text = "don't giggle" + tokens = en_tokenizer(text) + assert len(tokens) == 3 + assert tokens[1].text == "n't" + text = "i said don't!" + tokens = en_tokenizer(text) + assert len(tokens) == 5 + assert tokens[4].text == "!" + + +@pytest.mark.parametrize("text", ["`ain't", """"isn't""", "can't!"]) +def test_en_tokenizer_handles_basic_contraction_punct(en_tokenizer, text): + tokens = en_tokenizer(text) + assert len(tokens) == 3 + + +@pytest.mark.parametrize( + "text_poss,text", [("Robin's", "Robin"), ("Alexis's", "Alexis")] +) +def test_en_tokenizer_handles_poss_contraction(en_tokenizer, text_poss, text): + tokens = en_tokenizer(text_poss) + assert len(tokens) == 2 + assert tokens[0].text == text + assert tokens[1].text == "'s" + + +@pytest.mark.parametrize("text", ["schools'", "Alexis'"]) +def test_en_tokenizer_splits_trailing_apos(en_tokenizer, text): + tokens = en_tokenizer(text) + assert len(tokens) == 2 + assert tokens[0].text == text.split("'")[0] + assert tokens[1].text == "'" + + +@pytest.mark.parametrize("text", ["'em", "nothin'", "ol'"]) +def test_en_tokenizer_doesnt_split_apos_exc(en_tokenizer, text): + tokens = en_tokenizer(text) + assert len(tokens) == 1 + assert tokens[0].text == text + + +@pytest.mark.parametrize("text", ["we'll", "You'll", "there'll", "this'll", "those'll"]) +def test_en_tokenizer_handles_ll_contraction(en_tokenizer, text): + tokens = en_tokenizer(text) + assert len(tokens) == 2 + assert tokens[0].text == text.split("'")[0] + assert tokens[1].text == "'ll" + + +@pytest.mark.parametrize( + "text_lower,text_title", [("can't", "Can't"), ("ain't", "Ain't")] +) +def test_en_tokenizer_handles_capitalization(en_tokenizer, text_lower, text_title): + tokens_lower = en_tokenizer(text_lower) + tokens_title = en_tokenizer(text_title) + assert tokens_title[0].text == tokens_lower[0].text.title() + assert tokens_lower[0].text == tokens_title[0].text.lower() + assert tokens_lower[1].text == tokens_title[1].text + + +@pytest.mark.parametrize("pron", ["I", "You", "He", "She", "It", "We", "They"]) +@pytest.mark.parametrize("contraction", ["'ll", "'d"]) +def test_en_tokenizer_keeps_title_case(en_tokenizer, pron, contraction): + tokens = en_tokenizer(pron + contraction) + assert tokens[0].text == pron + assert tokens[1].text == contraction + + +@pytest.mark.parametrize("exc", ["Ill", "ill", "Hell", "hell", "Well", "well"]) +def test_en_tokenizer_excludes_ambiguous(en_tokenizer, exc): + tokens = en_tokenizer(exc) + assert len(tokens) == 1 + + +@pytest.mark.parametrize( + "wo_punct,w_punct", [("We've", "`We've"), ("couldn't", "couldn't)")] +) +def test_en_tokenizer_splits_defined_punct(en_tokenizer, wo_punct, w_punct): + tokens = en_tokenizer(wo_punct) + assert len(tokens) == 2 + tokens = en_tokenizer(w_punct) + assert len(tokens) == 3 + + +@pytest.mark.parametrize("text", ["e.g.", "p.m.", "Jan.", "Dec.", "Inc."]) +def test_en_tokenizer_handles_abbr(en_tokenizer, text): + tokens = en_tokenizer(text) + assert len(tokens) == 1 + + +def test_en_tokenizer_handles_exc_in_text(en_tokenizer): + text = "It's mediocre i.e. bad." + tokens = en_tokenizer(text) + assert len(tokens) == 6 + assert tokens[3].text == "i.e." + + +@pytest.mark.parametrize("text", ["1am", "12a.m.", "11p.m.", "4pm"]) +def test_en_tokenizer_handles_times(en_tokenizer, text): + tokens = en_tokenizer(text) + assert len(tokens) == 2 + + +@pytest.mark.parametrize( + "text,norms", + [ + ("I'm", ["i", "am"]), + ("shan't", ["shall", "not"]), + ( + "Many factors cause cancer 'cause it is complex", + ["many", "factors", "cause", "cancer", "because", "it", "is", "complex"], + ), + ], +) +def test_en_tokenizer_norm_exceptions(en_tokenizer, text, norms): + tokens = en_tokenizer(text) + assert [token.norm_ for token in tokens] == norms + + +@pytest.mark.parametrize("text,norm", [("Jan.", "January"), ("'cuz", "because")]) +def test_en_lex_attrs_norm_exceptions(en_tokenizer, text, norm): + tokens = en_tokenizer(text) + assert tokens[0].norm_ == norm diff --git a/TTS/Kokoro/.venv/Lib/site-packages/spacy/tests/lang/en/test_indices.py b/TTS/Kokoro/.venv/Lib/site-packages/spacy/tests/lang/en/test_indices.py new file mode 100644 index 0000000000000000000000000000000000000000..98d3ea06732cf482ad2f7f9f2819108124db4120 --- /dev/null +++ b/TTS/Kokoro/.venv/Lib/site-packages/spacy/tests/lang/en/test_indices.py @@ -0,0 +1,25 @@ +def test_en_simple_punct(en_tokenizer): + text = "to walk, do foo" + tokens = en_tokenizer(text) + assert tokens[0].idx == 0 + assert tokens[1].idx == 3 + assert tokens[2].idx == 7 + assert tokens[3].idx == 9 + assert tokens[4].idx == 12 + + +def test_en_complex_punct(en_tokenizer): + text = "Tom (D., Ill.)!" + tokens = en_tokenizer(text) + assert tokens[0].idx == 0 + assert len(tokens[0]) == 3 + assert tokens[1].idx == 4 + assert len(tokens[1]) == 1 + assert tokens[2].idx == 5 + assert len(tokens[2]) == 2 + assert tokens[3].idx == 7 + assert len(tokens[3]) == 1 + assert tokens[4].idx == 9 + assert len(tokens[4]) == 4 + assert tokens[5].idx == 13 + assert tokens[6].idx == 14 diff --git a/TTS/Kokoro/.venv/Lib/site-packages/spacy/tests/lang/en/test_noun_chunks.py b/TTS/Kokoro/.venv/Lib/site-packages/spacy/tests/lang/en/test_noun_chunks.py new file mode 100644 index 0000000000000000000000000000000000000000..c25fcc5656114411c9479585ec2a28796fa3b857 --- /dev/null +++ b/TTS/Kokoro/.venv/Lib/site-packages/spacy/tests/lang/en/test_noun_chunks.py @@ -0,0 +1,45 @@ +import pytest + +from spacy.tokens import Doc + + +@pytest.fixture +def doc(en_vocab): + words = ["Peter", "has", "chronic", "command", "and", "control", "issues"] + heads = [1, 1, 6, 6, 3, 3, 1] + deps = ["nsubj", "ROOT", "amod", "nmod", "cc", "conj", "dobj"] + pos = ["PROPN", "VERB", "ADJ", "NOUN", "CCONJ", "NOUN", "NOUN"] + return Doc(en_vocab, words=words, heads=heads, deps=deps, pos=pos) + + +def test_noun_chunks_is_parsed(en_tokenizer): + """Test that noun_chunks raises Value Error for 'en' language if Doc is not parsed.""" + doc = en_tokenizer("This is a sentence") + with pytest.raises(ValueError): + list(doc.noun_chunks) + + +def test_en_noun_chunks_not_nested(doc, en_vocab): + """Test that each token only appears in one noun chunk at most""" + word_occurred = {} + chunks = list(doc.noun_chunks) + assert len(chunks) > 1 + for chunk in chunks: + for word in chunk: + word_occurred.setdefault(word.text, 0) + word_occurred[word.text] += 1 + assert len(word_occurred) > 0 + for word, freq in word_occurred.items(): + assert freq == 1, (word, [chunk.text for chunk in doc.noun_chunks]) + + +def test_noun_chunks_span(doc, en_tokenizer): + """Test that the span.noun_chunks property works correctly""" + doc_chunks = list(doc.noun_chunks) + span = doc[0:3] + span_chunks = list(span.noun_chunks) + assert 0 < len(span_chunks) < len(doc_chunks) + for chunk in span_chunks: + assert chunk in doc_chunks + assert chunk.start >= 0 + assert chunk.end <= 3 diff --git a/TTS/Kokoro/.venv/Lib/site-packages/spacy/tests/lang/en/test_parser.py b/TTS/Kokoro/.venv/Lib/site-packages/spacy/tests/lang/en/test_parser.py new file mode 100644 index 0000000000000000000000000000000000000000..ec71da203d6fc87f0664b2522287acd356d74b72 --- /dev/null +++ b/TTS/Kokoro/.venv/Lib/site-packages/spacy/tests/lang/en/test_parser.py @@ -0,0 +1,66 @@ +from spacy.tokens import Doc + + +def test_en_parser_noun_chunks_standard(en_vocab): + words = ["A", "base", "phrase", "should", "be", "recognized", "."] + heads = [2, 2, 5, 5, 5, 5, 5] + pos = ["DET", "ADJ", "NOUN", "AUX", "VERB", "VERB", "PUNCT"] + deps = ["det", "amod", "nsubjpass", "aux", "auxpass", "ROOT", "punct"] + doc = Doc(en_vocab, words=words, pos=pos, deps=deps, heads=heads) + chunks = list(doc.noun_chunks) + assert len(chunks) == 1 + assert chunks[0].text_with_ws == "A base phrase " + + +def test_en_parser_noun_chunks_coordinated(en_vocab): + # fmt: off + words = ["A", "base", "phrase", "and", "a", "good", "phrase", "are", "often", "the", "same", "."] + heads = [2, 2, 7, 2, 6, 6, 2, 7, 7, 10, 7, 7] + pos = ["DET", "NOUN", "NOUN", "CCONJ", "DET", "ADJ", "NOUN", "VERB", "ADV", "DET", "ADJ", "PUNCT"] + deps = ["det", "compound", "nsubj", "cc", "det", "amod", "conj", "ROOT", "advmod", "det", "attr", "punct"] + # fmt: on + doc = Doc(en_vocab, words=words, pos=pos, deps=deps, heads=heads) + chunks = list(doc.noun_chunks) + assert len(chunks) == 2 + assert chunks[0].text_with_ws == "A base phrase " + assert chunks[1].text_with_ws == "a good phrase " + + +def test_en_parser_noun_chunks_pp_chunks(en_vocab): + words = ["A", "phrase", "with", "another", "phrase", "occurs", "."] + heads = [1, 5, 1, 4, 2, 5, 5] + pos = ["DET", "NOUN", "ADP", "DET", "NOUN", "VERB", "PUNCT"] + deps = ["det", "nsubj", "prep", "det", "pobj", "ROOT", "punct"] + doc = Doc(en_vocab, words=words, pos=pos, deps=deps, heads=heads) + chunks = list(doc.noun_chunks) + assert len(chunks) == 2 + assert chunks[0].text_with_ws == "A phrase " + assert chunks[1].text_with_ws == "another phrase " + + +def test_en_parser_noun_chunks_appositional_modifiers(en_vocab): + # fmt: off + words = ["Sam", ",", "my", "brother", ",", "arrived", "to", "the", "house", "."] + heads = [5, 0, 3, 0, 0, 5, 5, 8, 6, 5] + pos = ["PROPN", "PUNCT", "DET", "NOUN", "PUNCT", "VERB", "ADP", "DET", "NOUN", "PUNCT"] + deps = ["nsubj", "punct", "poss", "appos", "punct", "ROOT", "prep", "det", "pobj", "punct"] + # fmt: on + doc = Doc(en_vocab, words=words, pos=pos, deps=deps, heads=heads) + chunks = list(doc.noun_chunks) + assert len(chunks) == 3 + assert chunks[0].text_with_ws == "Sam " + assert chunks[1].text_with_ws == "my brother " + assert chunks[2].text_with_ws == "the house " + + +def test_en_parser_noun_chunks_dative(en_vocab): + words = ["She", "gave", "Bob", "a", "raise", "."] + heads = [1, 1, 1, 4, 1, 1] + pos = ["PRON", "VERB", "PROPN", "DET", "NOUN", "PUNCT"] + deps = ["nsubj", "ROOT", "dative", "det", "dobj", "punct"] + doc = Doc(en_vocab, words=words, pos=pos, deps=deps, heads=heads) + chunks = list(doc.noun_chunks) + assert len(chunks) == 3 + assert chunks[0].text_with_ws == "She " + assert chunks[1].text_with_ws == "Bob " + assert chunks[2].text_with_ws == "a raise " diff --git a/TTS/Kokoro/.venv/Lib/site-packages/spacy/tests/lang/en/test_prefix_suffix_infix.py b/TTS/Kokoro/.venv/Lib/site-packages/spacy/tests/lang/en/test_prefix_suffix_infix.py new file mode 100644 index 0000000000000000000000000000000000000000..8cafbd4ee0becf26a81b04d621f3bc89cbae80ff --- /dev/null +++ b/TTS/Kokoro/.venv/Lib/site-packages/spacy/tests/lang/en/test_prefix_suffix_infix.py @@ -0,0 +1,137 @@ +import pytest + + +@pytest.mark.parametrize("text", ["(can)"]) +def test_en_tokenizer_splits_no_special(en_tokenizer, text): + tokens = en_tokenizer(text) + assert len(tokens) == 3 + + +@pytest.mark.parametrize("text", ["can't"]) +def test_en_tokenizer_splits_no_punct(en_tokenizer, text): + tokens = en_tokenizer(text) + assert len(tokens) == 2 + + +@pytest.mark.parametrize("text", ["(can't"]) +def test_en_tokenizer_splits_prefix_punct(en_tokenizer, text): + tokens = en_tokenizer(text) + assert len(tokens) == 3 + + +@pytest.mark.parametrize("text", ["can't)"]) +def test_en_tokenizer_splits_suffix_punct(en_tokenizer, text): + tokens = en_tokenizer(text) + assert len(tokens) == 3 + + +@pytest.mark.parametrize("text", ["(can't)"]) +def test_en_tokenizer_splits_even_wrap(en_tokenizer, text): + tokens = en_tokenizer(text) + assert len(tokens) == 4 + + +@pytest.mark.parametrize("text", ["(can't?)"]) +def test_en_tokenizer_splits_uneven_wrap(en_tokenizer, text): + tokens = en_tokenizer(text) + assert len(tokens) == 5 + + +@pytest.mark.parametrize("text,length", [("U.S.", 1), ("us.", 2), ("(U.S.", 2)]) +def test_en_tokenizer_splits_prefix_interact(en_tokenizer, text, length): + tokens = en_tokenizer(text) + assert len(tokens) == length + + +@pytest.mark.parametrize("text", ["U.S.)"]) +def test_en_tokenizer_splits_suffix_interact(en_tokenizer, text): + tokens = en_tokenizer(text) + assert len(tokens) == 2 + + +@pytest.mark.parametrize("text", ["(U.S.)"]) +def test_en_tokenizer_splits_even_wrap_interact(en_tokenizer, text): + tokens = en_tokenizer(text) + assert len(tokens) == 3 + + +@pytest.mark.parametrize("text", ["(U.S.?)"]) +def test_en_tokenizer_splits_uneven_wrap_interact(en_tokenizer, text): + tokens = en_tokenizer(text) + assert len(tokens) == 4 + + +@pytest.mark.parametrize("text", ["best-known"]) +def test_en_tokenizer_splits_hyphens(en_tokenizer, text): + tokens = en_tokenizer(text) + assert len(tokens) == 3 + + +@pytest.mark.parametrize("text", ["0.1-13.5", "0.0-0.1", "103.27-300"]) +def test_en_tokenizer_splits_numeric_range(en_tokenizer, text): + tokens = en_tokenizer(text) + assert len(tokens) == 3 + + +@pytest.mark.parametrize("text", ["best.Known", "Hello.World"]) +def test_en_tokenizer_splits_period_infix(en_tokenizer, text): + tokens = en_tokenizer(text) + assert len(tokens) == 3 + + +@pytest.mark.parametrize("text", ["Hello,world", "one,two"]) +def test_en_tokenizer_splits_comma_infix(en_tokenizer, text): + tokens = en_tokenizer(text) + assert len(tokens) == 3 + assert tokens[0].text == text.split(",")[0] + assert tokens[1].text == "," + assert tokens[2].text == text.split(",")[1] + + +@pytest.mark.parametrize("text", ["best...Known", "best...known"]) +def test_en_tokenizer_splits_ellipsis_infix(en_tokenizer, text): + tokens = en_tokenizer(text) + assert len(tokens) == 3 + + +def test_en_tokenizer_splits_double_hyphen_infix(en_tokenizer): + tokens = en_tokenizer("No decent--let alone well-bred--people.") + assert tokens[0].text == "No" + assert tokens[1].text == "decent" + assert tokens[2].text == "--" + assert tokens[3].text == "let" + assert tokens[4].text == "alone" + assert tokens[5].text == "well" + assert tokens[6].text == "-" + assert tokens[7].text == "bred" + assert tokens[8].text == "--" + assert tokens[9].text == "people" + + +def test_en_tokenizer_splits_period_abbr(en_tokenizer): + text = "Today is Tuesday.Mr." + tokens = en_tokenizer(text) + assert len(tokens) == 5 + assert tokens[0].text == "Today" + assert tokens[1].text == "is" + assert tokens[2].text == "Tuesday" + assert tokens[3].text == "." + assert tokens[4].text == "Mr." + + +@pytest.mark.issue(225) +@pytest.mark.xfail(reason="Issue #225 - not yet implemented") +def test_en_tokenizer_splits_em_dash_infix(en_tokenizer): + tokens = en_tokenizer( + """Will this road take me to Puddleton?\u2014No, """ + """you'll have to walk there.\u2014Ariel.""" + ) + assert tokens[6].text == "Puddleton" + assert tokens[7].text == "?" + assert tokens[8].text == "\u2014" + + +@pytest.mark.parametrize("text,length", [("_MATH_", 3), ("_MATH_.", 4)]) +def test_final_period(en_tokenizer, text, length): + tokens = en_tokenizer(text) + assert len(tokens) == length diff --git a/TTS/Kokoro/.venv/Lib/site-packages/spacy/tests/lang/en/test_punct.py b/TTS/Kokoro/.venv/Lib/site-packages/spacy/tests/lang/en/test_punct.py new file mode 100644 index 0000000000000000000000000000000000000000..d8b188d087f676a0e2bf50dc90f8b952ca7d8853 --- /dev/null +++ b/TTS/Kokoro/.venv/Lib/site-packages/spacy/tests/lang/en/test_punct.py @@ -0,0 +1,127 @@ +import pytest + +from spacy.lang.punctuation import TOKENIZER_PREFIXES +from spacy.util import compile_prefix_regex + +PUNCT_OPEN = ["(", "[", "{", "*"] +PUNCT_CLOSE = [")", "]", "}", "*"] +PUNCT_PAIRED = [("(", ")"), ("[", "]"), ("{", "}"), ("*", "*")] + + +@pytest.mark.parametrize("text", ["(", "((", "<"]) +def test_en_tokenizer_handles_only_punct(en_tokenizer, text): + tokens = en_tokenizer(text) + assert len(tokens) == len(text) + + +@pytest.mark.parametrize("punct", PUNCT_OPEN) +@pytest.mark.parametrize("text", ["Hello"]) +def test_en_tokenizer_splits_open_punct(en_tokenizer, punct, text): + tokens = en_tokenizer(punct + text) + assert len(tokens) == 2 + assert tokens[0].text == punct + assert tokens[1].text == text + + +@pytest.mark.parametrize("punct", PUNCT_CLOSE) +@pytest.mark.parametrize("text", ["Hello"]) +def test_en_tokenizer_splits_close_punct(en_tokenizer, punct, text): + tokens = en_tokenizer(text + punct) + assert len(tokens) == 2 + assert tokens[0].text == text + assert tokens[1].text == punct + + +@pytest.mark.parametrize("punct", PUNCT_OPEN) +@pytest.mark.parametrize("punct_add", ["`"]) +@pytest.mark.parametrize("text", ["Hello"]) +def test_en_tokenizer_splits_two_diff_open_punct(en_tokenizer, punct, punct_add, text): + tokens = en_tokenizer(punct + punct_add + text) + assert len(tokens) == 3 + assert tokens[0].text == punct + assert tokens[1].text == punct_add + assert tokens[2].text == text + + +@pytest.mark.parametrize("punct", PUNCT_CLOSE) +@pytest.mark.parametrize("punct_add", ["'"]) +@pytest.mark.parametrize("text", ["Hello"]) +def test_en_tokenizer_splits_two_diff_close_punct(en_tokenizer, punct, punct_add, text): + tokens = en_tokenizer(text + punct + punct_add) + assert len(tokens) == 3 + assert tokens[0].text == text + assert tokens[1].text == punct + assert tokens[2].text == punct_add + + +@pytest.mark.parametrize("punct", PUNCT_OPEN) +@pytest.mark.parametrize("text", ["Hello"]) +def test_en_tokenizer_splits_same_open_punct(en_tokenizer, punct, text): + tokens = en_tokenizer(punct + punct + punct + text) + assert len(tokens) == 4 + assert tokens[0].text == punct + assert tokens[3].text == text + + +@pytest.mark.parametrize("punct", PUNCT_CLOSE) +@pytest.mark.parametrize("text", ["Hello"]) +def test_en_tokenizer_splits_same_close_punct(en_tokenizer, punct, text): + tokens = en_tokenizer(text + punct + punct + punct) + assert len(tokens) == 4 + assert tokens[0].text == text + assert tokens[1].text == punct + + +@pytest.mark.parametrize("text", ["'The"]) +def test_en_tokenizer_splits_open_appostrophe(en_tokenizer, text): + tokens = en_tokenizer(text) + assert len(tokens) == 2 + assert tokens[0].text == "'" + + +@pytest.mark.parametrize("text", ["Hello''"]) +def test_en_tokenizer_splits_double_end_quote(en_tokenizer, text): + tokens = en_tokenizer(text) + assert len(tokens) == 2 + tokens_punct = en_tokenizer("''") + assert len(tokens_punct) == 1 + + +@pytest.mark.parametrize("punct_open,punct_close", PUNCT_PAIRED) +@pytest.mark.parametrize("text", ["Hello"]) +def test_en_tokenizer_splits_open_close_punct( + en_tokenizer, punct_open, punct_close, text +): + tokens = en_tokenizer(punct_open + text + punct_close) + assert len(tokens) == 3 + assert tokens[0].text == punct_open + assert tokens[1].text == text + assert tokens[2].text == punct_close + + +@pytest.mark.parametrize("punct_open,punct_close", PUNCT_PAIRED) +@pytest.mark.parametrize("punct_open2,punct_close2", [("`", "'")]) +@pytest.mark.parametrize("text", ["Hello"]) +def test_en_tokenizer_two_diff_punct( + en_tokenizer, punct_open, punct_close, punct_open2, punct_close2, text +): + tokens = en_tokenizer(punct_open2 + punct_open + text + punct_close + punct_close2) + assert len(tokens) == 5 + assert tokens[0].text == punct_open2 + assert tokens[1].text == punct_open + assert tokens[2].text == text + assert tokens[3].text == punct_close + assert tokens[4].text == punct_close2 + + +@pytest.mark.parametrize("text,punct", [("(can't", "(")]) +def test_en_tokenizer_splits_pre_punct_regex(text, punct): + en_search_prefixes = compile_prefix_regex(TOKENIZER_PREFIXES).search + match = en_search_prefixes(text) + assert match.group() == punct + + +def test_en_tokenizer_splits_bracket_period(en_tokenizer): + text = "(And a 6a.m. run through Washington Park)." + tokens = en_tokenizer(text) + assert tokens[len(tokens) - 1].text == "." diff --git a/TTS/Kokoro/.venv/Lib/site-packages/spacy/tests/lang/en/test_sbd.py b/TTS/Kokoro/.venv/Lib/site-packages/spacy/tests/lang/en/test_sbd.py new file mode 100644 index 0000000000000000000000000000000000000000..0e5048011b0bc264bf6bcdcd96d80d6109e1e41a --- /dev/null +++ b/TTS/Kokoro/.venv/Lib/site-packages/spacy/tests/lang/en/test_sbd.py @@ -0,0 +1,46 @@ +import pytest + +from spacy.tokens import Doc + +from ...util import apply_transition_sequence + + +@pytest.mark.issue(309) +def test_issue309(en_vocab): + """Test Issue #309: SBD fails on empty string""" + doc = Doc(en_vocab, words=[" "], heads=[0], deps=["ROOT"]) + assert len(doc) == 1 + sents = list(doc.sents) + assert len(sents) == 1 + + +@pytest.mark.parametrize("words", [["A", "test", "sentence"]]) +@pytest.mark.parametrize("punct", [".", "!", "?", ""]) +def test_en_sbd_single_punct(en_vocab, words, punct): + heads = [2, 2, 2, 2] if punct else [2, 2, 2] + deps = ["dep"] * len(heads) + words = [*words, punct] if punct else words + doc = Doc(en_vocab, words=words, heads=heads, deps=deps) + assert len(doc) == 4 if punct else 3 + assert len(list(doc.sents)) == 1 + assert sum(len(sent) for sent in doc.sents) == len(doc) + + +@pytest.mark.skip( + reason="The step_through API was removed (but should be brought back)" +) +def test_en_sentence_breaks(en_vocab, en_parser): + # fmt: off + words = ["This", "is", "a", "sentence", ".", "This", "is", "another", "one", "."] + heads = [1, 1, 3, 1, 1, 6, 6, 8, 6, 6] + deps = ["nsubj", "ROOT", "det", "attr", "punct", "nsubj", "ROOT", "det", + "attr", "punct"] + transition = ["L-nsubj", "S", "L-det", "R-attr", "D", "R-punct", "B-ROOT", + "L-nsubj", "S", "L-attr", "R-attr", "D", "R-punct"] + # fmt: on + doc = Doc(en_vocab, words=words, heads=heads, deps=deps) + apply_transition_sequence(en_parser, doc, transition) + assert len(list(doc.sents)) == 2 + for token in doc: + assert token.dep != 0 or token.is_space + assert [token.head.i for token in doc] == [1, 1, 3, 1, 1, 6, 6, 8, 6, 6] diff --git a/TTS/Kokoro/.venv/Lib/site-packages/spacy/tests/lang/en/test_text.py b/TTS/Kokoro/.venv/Lib/site-packages/spacy/tests/lang/en/test_text.py new file mode 100644 index 0000000000000000000000000000000000000000..a1b2275ab1072eefba501c857c594f81e8280713 --- /dev/null +++ b/TTS/Kokoro/.venv/Lib/site-packages/spacy/tests/lang/en/test_text.py @@ -0,0 +1,70 @@ +import pytest + +from spacy.lang.en.lex_attrs import like_num + + +def test_en_tokenizer_handles_long_text(en_tokenizer): + text = """Tributes pour in for late British Labour Party leader + +Tributes poured in from around the world Thursday +to the late Labour Party leader John Smith, who died earlier from a massive +heart attack aged 55. + +In Washington, the US State Department issued a statement regretting "the +untimely death" of the rapier-tongued Scottish barrister and parliamentarian. + +"Mr. Smith, throughout his distinguished""" + tokens = en_tokenizer(text) + assert len(tokens) == 76 + + +@pytest.mark.parametrize( + "text,length", + [ + ("The U.S. Army likes Shock and Awe.", 8), + ("U.N. regulations are not a part of their concern.", 10), + ("“Isn't it?”", 6), + ("""Yes! "I'd rather have a walk", Ms. Comble sighed. """, 15), + ("""'Me too!', Mr. P. Delaware cried. """, 11), + ("They ran about 10km.", 6), + ("But then the 6,000-year ice age came...", 10), + ], +) +def test_en_tokenizer_handles_cnts(en_tokenizer, text, length): + tokens = en_tokenizer(text) + assert len(tokens) == length + + +@pytest.mark.parametrize( + "text,match", + [ + ("10", True), + ("1", True), + ("10,000", True), + ("10,00", True), + ("999.0", True), + ("one", True), + ("two", True), + ("billion", True), + ("dog", False), + (",", False), + ("1/2", True), + ], +) +def test_lex_attrs_like_number(en_tokenizer, text, match): + tokens = en_tokenizer(text) + assert len(tokens) == 1 + assert tokens[0].like_num == match + + +@pytest.mark.parametrize( + "word", ["third", "Millionth", "100th", "Hundredth", "23rd", "52nd"] +) +def test_en_lex_attrs_like_number_for_ordinal(word): + assert like_num(word) + + +@pytest.mark.parametrize("word", ["eleven"]) +def test_en_lex_attrs_capitals(word): + assert like_num(word) + assert like_num(word.upper()) diff --git a/TTS/Kokoro/.venv/Lib/site-packages/spacy/tests/lang/en/test_tokenizer.py b/TTS/Kokoro/.venv/Lib/site-packages/spacy/tests/lang/en/test_tokenizer.py new file mode 100644 index 0000000000000000000000000000000000000000..cfd0e32836efa75d2c96b0b3af60233a2619504d --- /dev/null +++ b/TTS/Kokoro/.venv/Lib/site-packages/spacy/tests/lang/en/test_tokenizer.py @@ -0,0 +1,178 @@ +import pytest + + +@pytest.mark.issue(351) +def test_issue351(en_tokenizer): + doc = en_tokenizer(" This is a cat.") + assert doc[0].idx == 0 + assert len(doc[0]) == 3 + assert doc[1].idx == 3 + + +@pytest.mark.issue(360) +def test_issue360(en_tokenizer): + """Test tokenization of big ellipsis""" + tokens = en_tokenizer("$45...............Asking") + assert len(tokens) > 2 + + +@pytest.mark.issue(736) +@pytest.mark.parametrize("text,number", [("7am", "7"), ("11p.m.", "11")]) +def test_issue736(en_tokenizer, text, number): + """Test that times like "7am" are tokenized correctly and that numbers are + converted to string.""" + tokens = en_tokenizer(text) + assert len(tokens) == 2 + assert tokens[0].text == number + + +@pytest.mark.issue(740) +@pytest.mark.parametrize("text", ["3/4/2012", "01/12/1900"]) +def test_issue740(en_tokenizer, text): + """Test that dates are not split and kept as one token. This behaviour is + currently inconsistent, since dates separated by hyphens are still split. + This will be hard to prevent without causing clashes with numeric ranges.""" + tokens = en_tokenizer(text) + assert len(tokens) == 1 + + +@pytest.mark.issue(744) +@pytest.mark.parametrize("text", ["We were scared", "We Were Scared"]) +def test_issue744(en_tokenizer, text): + """Test that 'were' and 'Were' are excluded from the contractions + generated by the English tokenizer exceptions.""" + tokens = en_tokenizer(text) + assert len(tokens) == 3 + assert tokens[1].text.lower() == "were" + + +@pytest.mark.issue(759) +@pytest.mark.parametrize( + "text,is_num", [("one", True), ("ten", True), ("teneleven", False)] +) +def test_issue759(en_tokenizer, text, is_num): + tokens = en_tokenizer(text) + assert tokens[0].like_num == is_num + + +@pytest.mark.issue(775) +@pytest.mark.parametrize("text", ["Shell", "shell", "Shed", "shed"]) +def test_issue775(en_tokenizer, text): + """Test that 'Shell' and 'shell' are excluded from the contractions + generated by the English tokenizer exceptions.""" + tokens = en_tokenizer(text) + assert len(tokens) == 1 + assert tokens[0].text == text + + +@pytest.mark.issue(792) +@pytest.mark.parametrize("text", ["This is a string ", "This is a string\u0020"]) +def test_issue792(en_tokenizer, text): + """Test for Issue #792: Trailing whitespace is removed after tokenization.""" + doc = en_tokenizer(text) + assert "".join([token.text_with_ws for token in doc]) == text + + +@pytest.mark.issue(792) +@pytest.mark.parametrize("text", ["This is a string", "This is a string\n"]) +def test_control_issue792(en_tokenizer, text): + """Test base case for Issue #792: Non-trailing whitespace""" + doc = en_tokenizer(text) + assert "".join([token.text_with_ws for token in doc]) == text + + +@pytest.mark.issue(859) +@pytest.mark.parametrize( + "text", ["aaabbb@ccc.com\nThank you!", "aaabbb@ccc.com \nThank you!"] +) +def test_issue859(en_tokenizer, text): + """Test that no extra space is added in doc.text method.""" + doc = en_tokenizer(text) + assert doc.text == text + + +@pytest.mark.issue(886) +@pytest.mark.parametrize("text", ["Datum:2014-06-02\nDokument:76467"]) +def test_issue886(en_tokenizer, text): + """Test that token.idx matches the original text index for texts with newlines.""" + doc = en_tokenizer(text) + for token in doc: + assert len(token.text) == len(token.text_with_ws) + assert text[token.idx] == token.text[0] + + +@pytest.mark.issue(891) +@pytest.mark.parametrize("text", ["want/need"]) +def test_issue891(en_tokenizer, text): + """Test that / infixes are split correctly.""" + tokens = en_tokenizer(text) + assert len(tokens) == 3 + assert tokens[1].text == "/" + + +@pytest.mark.issue(957) +@pytest.mark.slow +def test_issue957(en_tokenizer): + """Test that spaCy doesn't hang on many punctuation characters. + If this test hangs, check (new) regular expressions for conflicting greedy operators + """ + # Skip test if pytest-timeout is not installed + pytest.importorskip("pytest_timeout") + for punct in [".", ",", "'", '"', ":", "?", "!", ";", "-"]: + string = "0" + for i in range(1, 100): + string += punct + str(i) + doc = en_tokenizer(string) + assert doc + + +@pytest.mark.parametrize("text", ["test@example.com", "john.doe@example.co.uk"]) +@pytest.mark.issue(1698) +def test_issue1698(en_tokenizer, text): + """Test that doc doesn't identify email-addresses as URLs""" + doc = en_tokenizer(text) + assert len(doc) == 1 + assert not doc[0].like_url + + +@pytest.mark.issue(1758) +def test_issue1758(en_tokenizer): + """Test that "would've" is handled by the English tokenizer exceptions.""" + tokens = en_tokenizer("would've") + assert len(tokens) == 2 + + +@pytest.mark.issue(1773) +def test_issue1773(en_tokenizer): + """Test that spaces don't receive a POS but no TAG. This is the root cause + of the serialization issue reported in #1773.""" + doc = en_tokenizer("\n") + if doc[0].pos_ == "SPACE": + assert doc[0].tag_ != "" + + +@pytest.mark.issue(3277) +def test_issue3277(es_tokenizer): + """Test that hyphens are split correctly as prefixes.""" + doc = es_tokenizer("—Yo me llamo... –murmuró el niño– Emilio Sánchez Pérez.") + assert len(doc) == 14 + assert doc[0].text == "\u2014" + assert doc[5].text == "\u2013" + assert doc[9].text == "\u2013" + + +@pytest.mark.parametrize("word", ["don't", "don’t", "I'd", "I’d"]) +@pytest.mark.issue(3521) +def test_issue3521(en_tokenizer, word): + tok = en_tokenizer(word)[1] + # 'not' and 'would' should be stopwords, also in their abbreviated forms + assert tok.is_stop + + +@pytest.mark.issue(10699) +@pytest.mark.parametrize("text", ["theses", "thisre"]) +def test_issue10699(en_tokenizer, text): + """Test that 'theses' and 'thisre' are excluded from the contractions + generated by the English tokenizer exceptions.""" + tokens = en_tokenizer(text) + assert len(tokens) == 1 diff --git a/TTS/Kokoro/.venv/Lib/site-packages/spacy/tests/lang/es/__init__.py b/TTS/Kokoro/.venv/Lib/site-packages/spacy/tests/lang/es/__init__.py new file mode 100644 index 0000000000000000000000000000000000000000..e69de29bb2d1d6434b8b29ae775ad8c2e48c5391 diff --git a/TTS/Kokoro/.venv/Lib/site-packages/spacy/tests/lang/es/__pycache__/__init__.cpython-312.pyc b/TTS/Kokoro/.venv/Lib/site-packages/spacy/tests/lang/es/__pycache__/__init__.cpython-312.pyc new file mode 100644 index 0000000000000000000000000000000000000000..af0ec9e660325d432d5256f776c4087ccd6123d5 Binary files /dev/null and b/TTS/Kokoro/.venv/Lib/site-packages/spacy/tests/lang/es/__pycache__/__init__.cpython-312.pyc differ diff --git a/TTS/Kokoro/.venv/Lib/site-packages/spacy/tests/lang/es/__pycache__/test_exception.cpython-312.pyc b/TTS/Kokoro/.venv/Lib/site-packages/spacy/tests/lang/es/__pycache__/test_exception.cpython-312.pyc new file mode 100644 index 0000000000000000000000000000000000000000..816d8aaaee087101051a49ecd572d4865d6da2a4 Binary files /dev/null and b/TTS/Kokoro/.venv/Lib/site-packages/spacy/tests/lang/es/__pycache__/test_exception.cpython-312.pyc differ diff --git a/TTS/Kokoro/.venv/Lib/site-packages/spacy/tests/lang/es/__pycache__/test_noun_chunks.cpython-312.pyc b/TTS/Kokoro/.venv/Lib/site-packages/spacy/tests/lang/es/__pycache__/test_noun_chunks.cpython-312.pyc new file mode 100644 index 0000000000000000000000000000000000000000..617ec4000d4f82a4367279406b93d99f73306bc9 Binary files /dev/null and b/TTS/Kokoro/.venv/Lib/site-packages/spacy/tests/lang/es/__pycache__/test_noun_chunks.cpython-312.pyc differ diff --git a/TTS/Kokoro/.venv/Lib/site-packages/spacy/tests/lang/es/__pycache__/test_text.cpython-312.pyc b/TTS/Kokoro/.venv/Lib/site-packages/spacy/tests/lang/es/__pycache__/test_text.cpython-312.pyc new file mode 100644 index 0000000000000000000000000000000000000000..2f74f9cfb0f570fb198e3f466a1e8767f800c43e Binary files /dev/null and b/TTS/Kokoro/.venv/Lib/site-packages/spacy/tests/lang/es/__pycache__/test_text.cpython-312.pyc differ diff --git a/TTS/Kokoro/.venv/Lib/site-packages/spacy/tests/lang/es/test_exception.py b/TTS/Kokoro/.venv/Lib/site-packages/spacy/tests/lang/es/test_exception.py new file mode 100644 index 0000000000000000000000000000000000000000..e7103386e60982083b18e349c1e812fa160d4718 --- /dev/null +++ b/TTS/Kokoro/.venv/Lib/site-packages/spacy/tests/lang/es/test_exception.py @@ -0,0 +1,22 @@ +import pytest + + +@pytest.mark.parametrize( + "text,lemma", + [ + ("aprox.", "aproximadamente"), + ("esq.", "esquina"), + ("pág.", "página"), + ("p.ej.", "por ejemplo"), + ], +) +def test_es_tokenizer_handles_abbr(es_tokenizer, text, lemma): + tokens = es_tokenizer(text) + assert len(tokens) == 1 + + +def test_es_tokenizer_handles_exc_in_text(es_tokenizer): + text = "Mariano Rajoy ha corrido aprox. medio kilómetro" + tokens = es_tokenizer(text) + assert len(tokens) == 7 + assert tokens[4].text == "aprox." diff --git a/TTS/Kokoro/.venv/Lib/site-packages/spacy/tests/lang/es/test_noun_chunks.py b/TTS/Kokoro/.venv/Lib/site-packages/spacy/tests/lang/es/test_noun_chunks.py new file mode 100644 index 0000000000000000000000000000000000000000..7a50a2a16ce893ceb909a4252f8c991ec6352e33 --- /dev/null +++ b/TTS/Kokoro/.venv/Lib/site-packages/spacy/tests/lang/es/test_noun_chunks.py @@ -0,0 +1,159 @@ +import pytest + +from spacy.tokens import Doc + + +# fmt: off +@pytest.mark.parametrize( + "words,heads,deps,pos,chunk_offsets", + [ + # un gato -> "un gato" + ( + ["un", "gato"], + [1, 1], + ["det", "ROOT"], + ["DET", "NOUN"], + [(0, 2)], + ), + # la camisa negra -> "la camisa negra" + ( + ["la", "camisa", "negra"], + [1, 1, 1], + ["det", "ROOT", "amod"], + ["DET", "NOUN", "ADJ"], + [(0, 3)], + ), + # un lindo gatito -> "un lindo gatito" + ( + ["Un", "lindo", "gatito"], + [2, 2, 2], + ["det", "amod", "ROOT"], + ["DET", "ADJ", "NOUN"], + [(0,3)] + ), + # una chica hermosa e inteligente -> una chica hermosa e inteligente + ( + ["Una", "chica", "hermosa", "e", "inteligente"], + [1, 1, 1, 4, 2], + ["det", "ROOT", "amod", "cc", "conj"], + ["DET", "NOUN", "ADJ", "CCONJ", "ADJ"], + [(0,5)] + ), + # el fabuloso gato pardo -> "el fabuloso gato pardo" + ( + ["el", "fabuloso", "gato", "pardo"], + [2, 2, 2, 2], + ["det", "amod", "ROOT", "amod"], + ["DET", "ADJ", "NOUN", "ADJ"], + [(0,4)] + ), + # Tengo un gato y un perro -> un gato, un perro + ( + ["Tengo", "un", "gato", "y", "un", "perro"], + [0, 2, 0, 5, 5, 0], + ["ROOT", "det", "obj", "cc", "det", "conj"], + ["VERB", "DET", "NOUN", "CCONJ", "DET", "NOUN"], + [(1,3), (4,6)] + + ), + # Dom Pedro II -> Dom Pedro II + ( + ["Dom", "Pedro", "II"], + [0, 0, 0], + ["ROOT", "flat", "flat"], + ["PROPN", "PROPN", "PROPN"], + [(0,3)] + ), + # los Estados Unidos -> los Estados Unidos + ( + ["los", "Estados", "Unidos"], + [1, 1, 1], + ["det", "ROOT", "flat"], + ["DET", "PROPN", "PROPN"], + [(0,3)] + ), + # Miguel de Cervantes -> Miguel de Cervantes + ( + ["Miguel", "de", "Cervantes"], + [0, 2, 0], + ["ROOT", "case", "flat"], + ["PROPN", "ADP", "PROPN"], + [(0,3)] + ), + ( + ["Rio", "de", "Janeiro"], + [0, 2, 0], + ["ROOT", "case", "flat"], + ["PROPN", "ADP", "PROPN"], + [(0,3)] + ), + # la destrucción de la ciudad -> la destrucción, la ciudad + ( + ["la", "destrucción", "de", "la", "ciudad"], + [1, 1, 4, 4, 1], + ['det', 'ROOT', 'case', 'det', 'nmod'], + ['DET', 'NOUN', 'ADP', 'DET', 'NOUN'], + [(0,2), (3,5)] + ), + # la traducción de Susana del informe -> la traducción, Susana, informe + ( + ['la', 'traducción', 'de', 'Susana', 'del', 'informe'], + [1, 1, 3, 1, 5, 1], + ['det', 'ROOT', 'case', 'nmod', 'case', 'nmod'], + ['DET', 'NOUN', 'ADP', 'PROPN', 'ADP', 'NOUN'], + [(0,2), (3,4), (5,6)] + + ), + # El gato regordete de Susana y su amigo -> el gato regordete, Susana, su amigo + ( + ['El', 'gato', 'regordete', 'de', 'Susana', 'y', 'su', 'amigo'], + [1, 1, 1, 4, 1, 7, 7, 1], + ['det', 'ROOT', 'amod', 'case', 'nmod', 'cc', 'det', 'conj'], + ['DET', 'NOUN', 'ADJ', 'ADP', 'PROPN', 'CCONJ', 'DET', 'NOUN'], + [(0,3), (4,5), (6,8)] + ), + # Afirmó que sigue el criterio europeo y que trata de incentivar el mercado donde no lo hay -> el criterio europeo, el mercado, donde, lo + ( + ['Afirmó', 'que', 'sigue', 'el', 'criterio', 'europeo', 'y', 'que', 'trata', 'de', 'incentivar', 'el', 'mercado', 'donde', 'no', 'lo', 'hay'], + [0, 2, 0, 4, 2, 4, 8, 8, 2, 10, 8, 12, 10, 16, 16, 16, 0], + ['ROOT', 'mark', 'ccomp', 'det', 'obj', 'amod', 'cc', 'mark', 'conj', 'mark', 'xcomp', 'det', 'obj', 'obl', 'advmod', 'obj', 'advcl'], + ['VERB', 'SCONJ', 'VERB', 'DET', 'NOUN', 'ADJ', 'CCONJ', 'SCONJ', 'VERB', 'ADP', 'VERB', 'DET', 'NOUN', 'PRON', 'ADV', 'PRON', 'AUX'], + [(3,6), (11,13), (13,14), (15,16)] + ), + # En este sentido se refirió a la reciente creación del Ministerio de Ciencia y Tecnología y a las primeras declaraciones de su titular, Anna Birulés, sobre el impulso de la investigación, desarrollo e innovación -> este sentido, se, la reciente creación, Ministerio de Ciencia y Tecnología, a las primeras declaraciones, su titular, , Anna Birulés,, el impulso, la investigación, , desarrollo, innovación + ( + ['En', 'este', 'sentido', 'se', 'refirió', 'a', 'la', 'reciente', 'creación', 'del', 'Ministerio', 'de', 'Ciencia', 'y', 'Tecnología', 'y', 'a', 'las', 'primeras', 'declaraciones', 'de', 'su', 'titular', ',', 'Anna', 'Birulés', ',', 'sobre', 'el', 'impulso', 'de', 'la', 'investigación', ',', 'desarrollo', 'e', 'innovación'], + [2, 2, 4, 4, 4, 8, 8, 8, 4, 10, 8, 12, 10, 14, 12, 19, 19, 19, 19, 8, 22, 22, 19, 24, 22, 24, 24, 29, 29, 19, 32, 32, 29, 34, 32, 36, 32], + ['case', 'det', 'obl', 'obj', 'ROOT', 'case', 'det', 'amod', 'obj', 'case', 'nmod', 'case', 'flat', 'cc', 'conj', 'cc', 'case', 'det', 'amod', 'conj', 'case', 'det', 'nmod', 'punct', 'appos', 'flat', 'punct', 'case', 'det', 'nmod', 'case', 'det', 'nmod', 'punct', 'conj', 'cc', 'conj'], + ['ADP', 'DET', 'NOUN', 'PRON', 'VERB', 'ADP', 'DET', 'ADJ', 'NOUN', 'ADP', 'PROPN', 'ADP', 'PROPN', 'CCONJ', 'PROPN', 'CCONJ', 'ADP', 'DET', 'ADJ', 'NOUN', 'ADP', 'DET', 'NOUN', 'PUNCT', 'PROPN', 'PROPN', 'PUNCT', 'ADP', 'DET', 'NOUN', 'ADP', 'DET', 'NOUN', 'PUNCT', 'NOUN', 'CCONJ', 'NOUN'], + [(1, 3), (3, 4), (6, 9), (10, 15), (16, 20), (21, 23), (23, 27), (28, 30), (31, 33), (33, 35), (36, 37)] + ), + # Asimismo defiende la financiación pública de la investigación básica y pone de manifiesto que las empresas se centran más en la investigación y desarrollo con objetivos de mercado. -> la financiación pública, la investigación básica, manifiesto, las empresas, se, la investigación, desarrollo, objetivos, mercado + ( + ['Asimismo', 'defiende', 'la', 'financiación', 'pública', 'de', 'la', 'investigación', 'básica', 'y', 'pone', 'de', 'manifiesto', 'que', 'las', 'empresas', 'se', 'centran', 'más', 'en', 'la', 'investigación', 'y', 'desarrollo', 'con', 'objetivos', 'de', 'mercado'], + [1, 1, 3, 1, 3, 7, 7, 3, 7, 10, 1, 12, 10, 17, 15, 17, 17, 10, 17, 21, 21, 17, 23, 21, 25, 17, 27, 25], + ['advmod', 'ROOT', 'det', 'obj', 'amod', 'case', 'det', 'nmod', 'amod', 'cc', 'conj', 'case', 'obl', 'mark', 'det', 'nsubj', 'obj', 'ccomp', 'obj', 'case', 'det', 'obl', 'cc', 'conj', 'case', 'obl', 'case', 'nmod'], + ['ADV', 'VERB', 'DET', 'NOUN', 'ADJ', 'ADP', 'DET', 'NOUN', 'ADJ', 'CCONJ', 'VERB', 'ADP', 'NOUN', 'SCONJ', 'DET', 'NOUN', 'PRON', 'VERB', 'ADV', 'ADP', 'DET', 'NOUN', 'CCONJ', 'NOUN', 'ADP', 'NOUN', 'ADP', 'NOUN'], + [(2, 5), (6, 9), (12, 13), (14, 16), (16, 17), (20, 22), (23, 24), (25, 26), (27, 28)] + ), + # Tras indicar que la inversión media en investigación en la Unión Europea se sitúa en el 1,8 por ciento del PIB, frente al 2,8 por ciento en Japón y EEUU, Couceiro dijo que España está en "el buen camino" y se está creando un entorno propicio para la innovación empresarial' -> la inversión media, investigación, la Unión Europea, se, PIB, Japón, EEUU, Couceiro, España, se, un entorno propicio para la innovación empresaria + ( + ['Tras', 'indicar', 'que', 'la', 'inversión', 'media', 'en', 'investigación', 'en', 'la', 'Unión', 'Europea', 'se', 'sitúa', 'en', 'el', '1,8', 'por', 'ciento', 'del', 'PIB', ',', 'frente', 'al', '2,8', 'por', 'ciento', 'en', 'Japón', 'y', 'EEUU', ',', 'Couceiro', 'dijo', 'que', 'España', 'está', 'en', '"', 'el', 'buen', 'camino', '"', 'y', 'se', 'está', 'creando', 'un', 'entorno', 'propicio', 'para', 'la', 'innovación', 'empresarial'], + [1, 33, 13, 4, 13, 4, 7, 4, 10, 10, 4, 10, 13, 1, 16, 16, 13, 18, 16, 20, 16, 24, 24, 22, 13, 26, 24, 28, 24, 30, 28, 1, 33, 33, 41, 41, 41, 41, 41, 41, 41, 33, 41, 46, 46, 46, 33, 48, 46, 48, 52, 52, 49, 52], + ['mark', 'advcl', 'mark', 'det', 'nsubj', 'amod', 'case', 'nmod', 'case', 'det', 'nmod', 'flat', 'obj', 'ccomp', 'case', 'det', 'obj', 'case', 'compound', 'case', 'nmod', 'punct', 'case', 'fixed', 'obl', 'case', 'compound', 'case', 'nmod', 'cc', 'conj', 'punct', 'nsubj', 'ROOT', 'mark', 'nsubj', 'cop', 'case', 'punct', 'det', 'amod', 'ccomp', 'punct', 'cc', 'obj', 'aux', 'conj', 'det', 'nsubj', 'amod', 'case', 'det', 'nmod', 'amod'], + ['ADP', 'VERB', 'SCONJ', 'DET', 'NOUN', 'ADJ', 'ADP', 'NOUN', 'ADP', 'DET', 'PROPN', 'PROPN', 'PRON', 'VERB', 'ADP', 'DET', 'NUM', 'ADP', 'NUM', 'ADP', 'PROPN', 'PUNCT', 'NOUN', 'ADP', 'NUM', 'ADP', 'NUM', 'ADP', 'PROPN', 'CCONJ', 'PROPN', 'PUNCT', 'PROPN', 'VERB', 'SCONJ', 'PROPN', 'AUX', 'ADP', 'PUNCT', 'DET', 'ADJ', 'NOUN', 'PUNCT', 'CCONJ', 'PRON', 'AUX', 'VERB', 'DET', 'NOUN', 'ADJ', 'ADP', 'DET', 'NOUN', 'ADJ'], + [(3, 6), (7, 8), (9, 12), (12, 13), (20, 21), (28, 29), (30, 31), (32, 33), (35, 36), (44, 45), (47, 54)] + ), + ], +) +# fmt: on +def test_es_noun_chunks(es_vocab, words, heads, deps, pos, chunk_offsets): + doc = Doc(es_vocab, words=words, heads=heads, deps=deps, pos=pos) + assert [(c.start, c.end) for c in doc.noun_chunks] == chunk_offsets + + +def test_noun_chunks_is_parsed_es(es_tokenizer): + """Test that noun_chunks raises Value Error for 'es' language if Doc is not parsed.""" + doc = es_tokenizer("en Oxford este verano") + with pytest.raises(ValueError): + list(doc.noun_chunks) diff --git a/TTS/Kokoro/.venv/Lib/site-packages/spacy/tests/lang/es/test_text.py b/TTS/Kokoro/.venv/Lib/site-packages/spacy/tests/lang/es/test_text.py new file mode 100644 index 0000000000000000000000000000000000000000..4a266b904d1507aadc91f22608fa0f30f573c688 --- /dev/null +++ b/TTS/Kokoro/.venv/Lib/site-packages/spacy/tests/lang/es/test_text.py @@ -0,0 +1,74 @@ +import pytest + +from spacy.lang.es import Spanish +from spacy.lang.es.lex_attrs import like_num + + +@pytest.mark.issue(3803) +def test_issue3803(): + """Test that spanish num-like tokens have True for like_num attribute.""" + nlp = Spanish() + text = "2 dos 1000 mil 12 doce" + doc = nlp(text) + + assert [t.like_num for t in doc] == [True, True, True, True, True, True] + + +def test_es_tokenizer_handles_long_text(es_tokenizer): + text = """Cuando a José Mujica lo invitaron a dar una conferencia + +en Oxford este verano, su cabeza hizo "crac". La "más antigua" universidad de habla + +inglesa, esa que cobra decenas de miles de euros de matrícula a sus alumnos + +y en cuyos salones han disertado desde Margaret Thatcher hasta Stephen Hawking, + +reclamaba los servicios de este viejo de 81 años, formado en un colegio público + +en Montevideo y que pregona las bondades de la vida austera.""" + tokens = es_tokenizer(text) + assert len(tokens) == 90 + + +@pytest.mark.parametrize( + "text,length", + [ + ("¿Por qué José Mujica?", 6), + ("“¿Oh no?”", 6), + ("""¡Sí! "Vámonos", contestó José Arcadio Buendía""", 11), + ("Corrieron aprox. 10km.", 5), + ("Y entonces por qué...", 5), + ], +) +def test_es_tokenizer_handles_cnts(es_tokenizer, text, length): + tokens = es_tokenizer(text) + assert len(tokens) == length + + +@pytest.mark.parametrize( + "text,match", + [ + ("10", True), + ("1", True), + ("10.000", True), + ("1000", True), + ("999,0", True), + ("uno", True), + ("dos", True), + ("billón", True), + ("veintiséis", True), + ("perro", False), + (",", False), + ("1/2", True), + ], +) +def test_lex_attrs_like_number(es_tokenizer, text, match): + tokens = es_tokenizer(text) + assert len(tokens) == 1 + assert tokens[0].like_num == match + + +@pytest.mark.parametrize("word", ["once"]) +def test_es_lex_attrs_capitals(word): + assert like_num(word) + assert like_num(word.upper()) diff --git a/TTS/Kokoro/.venv/Lib/site-packages/spacy/tests/lang/et/__init__.py b/TTS/Kokoro/.venv/Lib/site-packages/spacy/tests/lang/et/__init__.py new file mode 100644 index 0000000000000000000000000000000000000000..e69de29bb2d1d6434b8b29ae775ad8c2e48c5391 diff --git a/TTS/Kokoro/.venv/Lib/site-packages/spacy/tests/lang/et/__pycache__/__init__.cpython-312.pyc b/TTS/Kokoro/.venv/Lib/site-packages/spacy/tests/lang/et/__pycache__/__init__.cpython-312.pyc new file mode 100644 index 0000000000000000000000000000000000000000..0048cb8e8127c906a47b3e88e1513d29dd77d6af Binary files /dev/null and b/TTS/Kokoro/.venv/Lib/site-packages/spacy/tests/lang/et/__pycache__/__init__.cpython-312.pyc differ diff --git a/TTS/Kokoro/.venv/Lib/site-packages/spacy/tests/lang/et/__pycache__/test_text.cpython-312.pyc b/TTS/Kokoro/.venv/Lib/site-packages/spacy/tests/lang/et/__pycache__/test_text.cpython-312.pyc new file mode 100644 index 0000000000000000000000000000000000000000..df4bb3699526d8c4d2c511a5c5bea4e47eb29b9c Binary files /dev/null and b/TTS/Kokoro/.venv/Lib/site-packages/spacy/tests/lang/et/__pycache__/test_text.cpython-312.pyc differ diff --git a/TTS/Kokoro/.venv/Lib/site-packages/spacy/tests/lang/et/__pycache__/test_tokenizer.cpython-312.pyc b/TTS/Kokoro/.venv/Lib/site-packages/spacy/tests/lang/et/__pycache__/test_tokenizer.cpython-312.pyc new file mode 100644 index 0000000000000000000000000000000000000000..fce38723ffcb6e35d2d0bcef4eb5c7ab6f01dd42 Binary files /dev/null and b/TTS/Kokoro/.venv/Lib/site-packages/spacy/tests/lang/et/__pycache__/test_tokenizer.cpython-312.pyc differ diff --git a/TTS/Kokoro/.venv/Lib/site-packages/spacy/tests/lang/et/test_text.py b/TTS/Kokoro/.venv/Lib/site-packages/spacy/tests/lang/et/test_text.py new file mode 100644 index 0000000000000000000000000000000000000000..3c5da083dc2ce40fd4c209c73c22f376f3e7bc59 --- /dev/null +++ b/TTS/Kokoro/.venv/Lib/site-packages/spacy/tests/lang/et/test_text.py @@ -0,0 +1,26 @@ +import pytest + + +def test_long_text(et_tokenizer): + # Excerpt: European Convention on Human Rights + text = """ +arvestades, et nimetatud deklaratsiooni eesmärk on tagada selles +kuulutatud õiguste üldine ja tõhus tunnustamine ning järgimine; +arvestades, et Euroopa Nõukogu eesmärk on saavutada tema +liikmete suurem ühtsus ning et üheks selle eesmärgi saavutamise +vahendiks on inimõiguste ja põhivabaduste järgimine ning +elluviimine; +taaskinnitades oma sügavat usku neisse põhivabadustesse, mis +on õigluse ja rahu aluseks maailmas ning mida kõige paremini +tagab ühelt poolt tõhus poliitiline demokraatia ning teiselt poolt +inimõiguste, millest nad sõltuvad, üldine mõistmine ja järgimine; +""" + tokens = et_tokenizer(text) + assert len(tokens) == 94 + + +@pytest.mark.xfail +def test_ordinal_number(et_tokenizer): + text = "10. detsembril 1948" + tokens = et_tokenizer(text) + assert len(tokens) == 3 diff --git a/TTS/Kokoro/.venv/Lib/site-packages/spacy/tests/lang/et/test_tokenizer.py b/TTS/Kokoro/.venv/Lib/site-packages/spacy/tests/lang/et/test_tokenizer.py new file mode 100644 index 0000000000000000000000000000000000000000..1ce5ff5dafe35896364888397d25a3338a9dbc9e --- /dev/null +++ b/TTS/Kokoro/.venv/Lib/site-packages/spacy/tests/lang/et/test_tokenizer.py @@ -0,0 +1,29 @@ +import pytest + +ET_BASIC_TOKENIZATION_TESTS = [ + ( + "Kedagi ei või piinata ega ebainimlikult või alandavalt kohelda " + "ega karistada.", + [ + "Kedagi", + "ei", + "või", + "piinata", + "ega", + "ebainimlikult", + "või", + "alandavalt", + "kohelda", + "ega", + "karistada", + ".", + ], + ), +] + + +@pytest.mark.parametrize("text,expected_tokens", ET_BASIC_TOKENIZATION_TESTS) +def test_et_tokenizer_basic(et_tokenizer, text, expected_tokens): + tokens = et_tokenizer(text) + token_list = [token.text for token in tokens if not token.is_space] + assert expected_tokens == token_list diff --git a/TTS/Kokoro/.venv/Lib/site-packages/spacy/tests/lang/eu/__init__.py b/TTS/Kokoro/.venv/Lib/site-packages/spacy/tests/lang/eu/__init__.py new file mode 100644 index 0000000000000000000000000000000000000000..e69de29bb2d1d6434b8b29ae775ad8c2e48c5391 diff --git a/TTS/Kokoro/.venv/Lib/site-packages/spacy/tests/lang/eu/__pycache__/__init__.cpython-312.pyc b/TTS/Kokoro/.venv/Lib/site-packages/spacy/tests/lang/eu/__pycache__/__init__.cpython-312.pyc new file mode 100644 index 0000000000000000000000000000000000000000..b5bb2b6bbad174ca7f597c0efa190cd4687f8dfb Binary files /dev/null and b/TTS/Kokoro/.venv/Lib/site-packages/spacy/tests/lang/eu/__pycache__/__init__.cpython-312.pyc differ diff --git a/TTS/Kokoro/.venv/Lib/site-packages/spacy/tests/lang/eu/__pycache__/test_text.cpython-312.pyc b/TTS/Kokoro/.venv/Lib/site-packages/spacy/tests/lang/eu/__pycache__/test_text.cpython-312.pyc new file mode 100644 index 0000000000000000000000000000000000000000..b21173eb4dcb8fb287ea673d4824534c918c5bf7 Binary files /dev/null and b/TTS/Kokoro/.venv/Lib/site-packages/spacy/tests/lang/eu/__pycache__/test_text.cpython-312.pyc differ diff --git a/TTS/Kokoro/.venv/Lib/site-packages/spacy/tests/lang/eu/test_text.py b/TTS/Kokoro/.venv/Lib/site-packages/spacy/tests/lang/eu/test_text.py new file mode 100644 index 0000000000000000000000000000000000000000..b32dfbc62e55e442fb8b08fcf1c8416cdb22cecc --- /dev/null +++ b/TTS/Kokoro/.venv/Lib/site-packages/spacy/tests/lang/eu/test_text.py @@ -0,0 +1,19 @@ +import pytest + + +def test_eu_tokenizer_handles_long_text(eu_tokenizer): + text = """ta nere guitarra estrenatu ondoren""" + tokens = eu_tokenizer(text) + assert len(tokens) == 5 + + +@pytest.mark.parametrize( + "text,length", + [ + ("milesker ederra joan zen hitzaldia plazer hutsa", 7), + ("astelehen guztia sofan pasau biot", 5), + ], +) +def test_eu_tokenizer_handles_cnts(eu_tokenizer, text, length): + tokens = eu_tokenizer(text) + assert len(tokens) == length diff --git a/TTS/Kokoro/.venv/Lib/site-packages/spacy/tests/lang/fa/__init__.py b/TTS/Kokoro/.venv/Lib/site-packages/spacy/tests/lang/fa/__init__.py new file mode 100644 index 0000000000000000000000000000000000000000..e69de29bb2d1d6434b8b29ae775ad8c2e48c5391 diff --git a/TTS/Kokoro/.venv/Lib/site-packages/spacy/tests/lang/fa/__pycache__/__init__.cpython-312.pyc b/TTS/Kokoro/.venv/Lib/site-packages/spacy/tests/lang/fa/__pycache__/__init__.cpython-312.pyc new file mode 100644 index 0000000000000000000000000000000000000000..2d5594e8a17970108e91f61ee4000a35d9e57c78 Binary files /dev/null and b/TTS/Kokoro/.venv/Lib/site-packages/spacy/tests/lang/fa/__pycache__/__init__.cpython-312.pyc differ diff --git a/TTS/Kokoro/.venv/Lib/site-packages/spacy/tests/lang/fa/__pycache__/test_noun_chunks.cpython-312.pyc b/TTS/Kokoro/.venv/Lib/site-packages/spacy/tests/lang/fa/__pycache__/test_noun_chunks.cpython-312.pyc new file mode 100644 index 0000000000000000000000000000000000000000..566243e438e4f252399da6e423cf5a952986de3b Binary files /dev/null and b/TTS/Kokoro/.venv/Lib/site-packages/spacy/tests/lang/fa/__pycache__/test_noun_chunks.cpython-312.pyc differ diff --git a/TTS/Kokoro/.venv/Lib/site-packages/spacy/tests/lang/fa/test_noun_chunks.py b/TTS/Kokoro/.venv/Lib/site-packages/spacy/tests/lang/fa/test_noun_chunks.py new file mode 100644 index 0000000000000000000000000000000000000000..873c44193a85a89492d293edcaa5d84f222941f6 --- /dev/null +++ b/TTS/Kokoro/.venv/Lib/site-packages/spacy/tests/lang/fa/test_noun_chunks.py @@ -0,0 +1,9 @@ +import pytest + + +def test_noun_chunks_is_parsed_fa(fa_tokenizer): + """Test that noun_chunks raises Value Error for 'fa' language if Doc is not parsed.""" + + doc = fa_tokenizer("این یک جمله نمونه می باشد.") + with pytest.raises(ValueError): + list(doc.noun_chunks) diff --git a/TTS/Kokoro/.venv/Lib/site-packages/spacy/tests/lang/fi/__init__.py b/TTS/Kokoro/.venv/Lib/site-packages/spacy/tests/lang/fi/__init__.py new file mode 100644 index 0000000000000000000000000000000000000000..e69de29bb2d1d6434b8b29ae775ad8c2e48c5391 diff --git a/TTS/Kokoro/.venv/Lib/site-packages/spacy/tests/lang/fi/__pycache__/__init__.cpython-312.pyc b/TTS/Kokoro/.venv/Lib/site-packages/spacy/tests/lang/fi/__pycache__/__init__.cpython-312.pyc new file mode 100644 index 0000000000000000000000000000000000000000..748496d30624dcedef62d10c5545005a046fd4a0 Binary files /dev/null and b/TTS/Kokoro/.venv/Lib/site-packages/spacy/tests/lang/fi/__pycache__/__init__.cpython-312.pyc differ diff --git a/TTS/Kokoro/.venv/Lib/site-packages/spacy/tests/lang/fi/__pycache__/test_noun_chunks.cpython-312.pyc b/TTS/Kokoro/.venv/Lib/site-packages/spacy/tests/lang/fi/__pycache__/test_noun_chunks.cpython-312.pyc new file mode 100644 index 0000000000000000000000000000000000000000..9df51c9fbc7fd05147323fad61b4a0282d84cd73 Binary files /dev/null and b/TTS/Kokoro/.venv/Lib/site-packages/spacy/tests/lang/fi/__pycache__/test_noun_chunks.cpython-312.pyc differ diff --git a/TTS/Kokoro/.venv/Lib/site-packages/spacy/tests/lang/fi/__pycache__/test_text.cpython-312.pyc b/TTS/Kokoro/.venv/Lib/site-packages/spacy/tests/lang/fi/__pycache__/test_text.cpython-312.pyc new file mode 100644 index 0000000000000000000000000000000000000000..d037848e87c8bc1eced47d3a3f80ad9cabbef6a3 Binary files /dev/null and b/TTS/Kokoro/.venv/Lib/site-packages/spacy/tests/lang/fi/__pycache__/test_text.cpython-312.pyc differ diff --git a/TTS/Kokoro/.venv/Lib/site-packages/spacy/tests/lang/fi/__pycache__/test_tokenizer.cpython-312.pyc b/TTS/Kokoro/.venv/Lib/site-packages/spacy/tests/lang/fi/__pycache__/test_tokenizer.cpython-312.pyc new file mode 100644 index 0000000000000000000000000000000000000000..90df4c6e9029f2676103311b53d35817a44ad631 Binary files /dev/null and b/TTS/Kokoro/.venv/Lib/site-packages/spacy/tests/lang/fi/__pycache__/test_tokenizer.cpython-312.pyc differ diff --git a/TTS/Kokoro/.venv/Lib/site-packages/spacy/tests/lang/fi/test_noun_chunks.py b/TTS/Kokoro/.venv/Lib/site-packages/spacy/tests/lang/fi/test_noun_chunks.py new file mode 100644 index 0000000000000000000000000000000000000000..47964937fbf67445284e30a726305b986325476d --- /dev/null +++ b/TTS/Kokoro/.venv/Lib/site-packages/spacy/tests/lang/fi/test_noun_chunks.py @@ -0,0 +1,189 @@ +import pytest + +from spacy.tokens import Doc + +FI_NP_TEST_EXAMPLES = [ + ( + "Kaksi tyttöä potkii punaista palloa", + ["NUM", "NOUN", "VERB", "ADJ", "NOUN"], + ["nummod", "nsubj", "ROOT", "amod", "obj"], + [1, 1, 0, 1, -2], + ["Kaksi tyttöä", "punaista palloa"], + ), + ( + "Erittäin vaarallinen leijona karkasi kiertävän sirkuksen eläintenkesyttäjältä", + ["ADV", "ADJ", "NOUN", "VERB", "ADJ", "NOUN", "NOUN"], + ["advmod", "amod", "nsubj", "ROOT", "amod", "nmod:poss", "obl"], + [1, 1, 1, 0, 1, 1, -3], + ["Erittäin vaarallinen leijona", "kiertävän sirkuksen eläintenkesyttäjältä"], + ), + ( + "Leijona raidallisine tassuineen piileksii Porin kaupungin lähellä", + ["NOUN", "ADJ", "NOUN", "VERB", "PROPN", "NOUN", "ADP"], + ["nsubj", "amod", "nmod", "ROOT", "nmod:poss", "obl", "case"], + [3, 1, -2, 0, 1, -2, -1], + ["Leijona raidallisine tassuineen", "Porin kaupungin"], + ), + ( + "Lounaalla nautittiin salaattia, maukasta kanaa ja raikasta vettä", + ["NOUN", "VERB", "NOUN", "PUNCT", "ADJ", "NOUN", "CCONJ", "ADJ", "NOUN"], + ["obl", "ROOT", "obj", "punct", "amod", "conj", "cc", "amod", "conj"], + [1, 0, -1, 2, 1, -3, 2, 1, -6], + ["Lounaalla", "salaattia", "maukasta kanaa", "raikasta vettä"], + ), + ( + "Minua houkuttaa maalle muuttaminen talven jälkeen", + ["PRON", "VERB", "NOUN", "NOUN", "NOUN", "ADP"], + ["obj", "ROOT", "nmod", "nsubj", "obl", "case"], + [1, 0, 1, -2, -3, -1], + ["maalle muuttaminen", "talven"], + ), + ( + "Päivän kohokohta oli vierailu museossa kummilasten kanssa", + ["NOUN", "NOUN", "AUX", "NOUN", "NOUN", "NOUN", "ADP"], + ["nmod:poss", "nsubj:cop", "cop", "ROOT", "nmod", "obl", "case"], + [1, 2, 1, 0, -1, -2, -1], + ["Päivän kohokohta", "vierailu museossa", "kummilasten"], + ), + ( + "Yrittäjät maksoivat tuomioistuimen määräämät korvaukset", + ["NOUN", "VERB", "NOUN", "VERB", "NOUN"], + ["nsubj", "ROOT", "nsubj", "acl", "obj"], + [1, 0, 1, 1, -3], + ["Yrittäjät", "tuomioistuimen", "korvaukset"], + ), + ( + "Julkisoikeudelliset tai niihin rinnastettavat saatavat ovat suoraan ulosottokelpoisia", + ["ADJ", "CCONJ", "PRON", "VERB", "NOUN", "AUX", "ADV", "NOUN"], + ["amod", "cc", "obl", "acl", "nsubj:cop", "cop", "advmod", "ROOT"], + [4, 3, 1, 1, 3, 2, 1, 0], + ["Julkisoikeudelliset tai niihin rinnastettavat saatavat", "ulosottokelpoisia"], + ), + ( + "Se oli ala-arvoista käytöstä kaikilta oppilailta, myös valvojaoppilailta", + ["PRON", "AUX", "ADJ", "NOUN", "PRON", "NOUN", "PUNCT", "ADV", "NOUN"], + ["nsubj:cop", "cop", "amod", "ROOT", "det", "nmod", "punct", "advmod", "appos"], + [3, 2, 1, 0, 1, -2, 2, 1, -3], + ["ala-arvoista käytöstä kaikilta oppilailta", "valvojaoppilailta"], + ), + ( + "Isä souti veneellä, jonka hän oli vuokrannut", + ["NOUN", "VERB", "NOUN", "PUNCT", "PRON", "PRON", "AUX", "VERB"], + ["nsubj", "ROOT", "obl", "punct", "obj", "nsubj", "aux", "acl:relcl"], + [1, 0, -1, 4, 3, 2, 1, -5], + ["Isä", "veneellä"], + ), + ( + "Kirja, jonka poimin hyllystä, kertoo norsuista", + ["NOUN", "PUNCT", "PRON", "VERB", "NOUN", "PUNCT", "VERB", "NOUN"], + ["nsubj", "punct", "obj", "acl:relcl", "obl", "punct", "ROOT", "obl"], + [6, 2, 1, -3, -1, 1, 0, -1], + ["Kirja", "hyllystä", "norsuista"], + ), + ( + "Huomenna on päivä, jota olemme odottaneet", + ["NOUN", "AUX", "NOUN", "PUNCT", "PRON", "AUX", "VERB"], + ["ROOT", "cop", "nsubj:cop", "punct", "obj", "aux", "acl:relcl"], + [0, -1, -2, 3, 2, 1, -4], + ["Huomenna", "päivä"], + ), + ( + "Liikkuvuuden lisääminen on yksi korkeakoulutuksen keskeisistä kehittämiskohteista", + ["NOUN", "NOUN", "AUX", "PRON", "NOUN", "ADJ", "NOUN"], + ["nmod:gobj", "nsubj:cop", "cop", "ROOT", "nmod:poss", "amod", "nmod"], + [1, 2, 1, 0, 2, 1, -3], + [ + "Liikkuvuuden lisääminen", + "korkeakoulutuksen keskeisistä kehittämiskohteista", + ], + ), + ( + "Kaupalliset palvelut jätetään yksityisten palveluntarjoajien tarjottavaksi", + ["ADJ", "NOUN", "VERB", "ADJ", "NOUN", "NOUN"], + ["amod", "obj", "ROOT", "amod", "nmod:gsubj", "obl"], + [1, 1, 0, 1, 1, -3], + ["Kaupalliset palvelut", "yksityisten palveluntarjoajien tarjottavaksi"], + ), + ( + "New York tunnetaan kaupunkina, joka ei koskaan nuku", + ["PROPN", "PROPN", "VERB", "NOUN", "PUNCT", "PRON", "AUX", "ADV", "VERB"], + [ + "obj", + "flat:name", + "ROOT", + "obl", + "punct", + "nsubj", + "aux", + "advmod", + "acl:relcl", + ], + [2, -1, 0, -1, 4, 3, 2, 1, -5], + ["New York", "kaupunkina"], + ), + ( + "Loput vihjeet saat herra Möttöseltä", + ["NOUN", "NOUN", "VERB", "NOUN", "PROPN"], + ["compound:nn", "obj", "ROOT", "compound:nn", "obj"], + [1, 1, 0, 1, -2], + ["Loput vihjeet", "herra Möttöseltä"], + ), + ( + "mahdollisuus tukea muita päivystysyksiköitä", + ["NOUN", "VERB", "PRON", "NOUN"], + ["ROOT", "acl", "det", "obj"], + [0, -1, 1, -2], + ["mahdollisuus", "päivystysyksiköitä"], + ), + ( + "sairaanhoitopiirit harjoittavat leikkaustoimintaa alueellaan useammassa sairaalassa", + ["NOUN", "VERB", "NOUN", "NOUN", "ADJ", "NOUN"], + ["nsubj", "ROOT", "obj", "obl", "amod", "obl"], + [1, 0, -1, -1, 1, -3], + [ + "sairaanhoitopiirit", + "leikkaustoimintaa", + "alueellaan", + "useammassa sairaalassa", + ], + ), + ( + "Lain mukaan varhaiskasvatus on suunnitelmallista toimintaa", + ["NOUN", "ADP", "NOUN", "AUX", "ADJ", "NOUN"], + ["obl", "case", "nsubj:cop", "cop", "amod", "ROOT"], + [5, -1, 3, 2, 1, 0], + ["Lain", "varhaiskasvatus", "suunnitelmallista toimintaa"], + ), +] + + +def test_noun_chunks_is_parsed(fi_tokenizer): + """Test that noun_chunks raises Value Error for 'fi' language if Doc is not parsed. + To check this test, we're constructing a Doc + with a new Vocab here and forcing is_parsed to 'False' + to make sure the noun chunks don't run. + """ + doc = fi_tokenizer("Tämä on testi") + with pytest.raises(ValueError): + list(doc.noun_chunks) + + +@pytest.mark.parametrize( + "text,pos,deps,heads,expected_noun_chunks", FI_NP_TEST_EXAMPLES +) +def test_fi_noun_chunks(fi_tokenizer, text, pos, deps, heads, expected_noun_chunks): + tokens = fi_tokenizer(text) + + assert len(heads) == len(pos) + doc = Doc( + tokens.vocab, + words=[t.text for t in tokens], + heads=[head + i for i, head in enumerate(heads)], + deps=deps, + pos=pos, + ) + + noun_chunks = list(doc.noun_chunks) + assert len(noun_chunks) == len(expected_noun_chunks) + for i, np in enumerate(noun_chunks): + assert np.text == expected_noun_chunks[i] diff --git a/TTS/Kokoro/.venv/Lib/site-packages/spacy/tests/lang/fi/test_text.py b/TTS/Kokoro/.venv/Lib/site-packages/spacy/tests/lang/fi/test_text.py new file mode 100644 index 0000000000000000000000000000000000000000..cb7cbb08793345ec84ea5b867c9c0676c9e85c3d --- /dev/null +++ b/TTS/Kokoro/.venv/Lib/site-packages/spacy/tests/lang/fi/test_text.py @@ -0,0 +1,24 @@ +import pytest + + +@pytest.mark.parametrize( + "text,match", + [ + ("10", True), + ("1", True), + ("10000", True), + ("10,00", True), + ("-999,0", True), + ("yksi", True), + ("kolmetoista", True), + ("viisikymmentä", True), + ("tuhat", True), + ("1/2", True), + ("hevonen", False), + (",", False), + ], +) +def test_fi_lex_attrs_like_number(fi_tokenizer, text, match): + tokens = fi_tokenizer(text) + assert len(tokens) == 1 + assert tokens[0].like_num == match diff --git a/TTS/Kokoro/.venv/Lib/site-packages/spacy/tests/lang/fi/test_tokenizer.py b/TTS/Kokoro/.venv/Lib/site-packages/spacy/tests/lang/fi/test_tokenizer.py new file mode 100644 index 0000000000000000000000000000000000000000..4cb4b647657cce24fe2463a73911f1af1e21cb04 --- /dev/null +++ b/TTS/Kokoro/.venv/Lib/site-packages/spacy/tests/lang/fi/test_tokenizer.py @@ -0,0 +1,84 @@ +import pytest + +ABBREVIATION_TESTS = [ + ( + "Hyvää uutta vuotta t. siht. Niemelä!", + ["Hyvää", "uutta", "vuotta", "t.", "siht.", "Niemelä", "!"], + ), + ("Paino on n. 2.2 kg", ["Paino", "on", "n.", "2.2", "kg"]), + ( + "Vuonna 1 eaa. tapahtui kauheita.", + ["Vuonna", "1", "eaa.", "tapahtui", "kauheita", "."], + ), +] + +HYPHENATED_TESTS = [ + ( + "1700-luvulle sijoittuva taide-elokuva Wikimedia-säätiön Varsinais-Suomen", + [ + "1700-luvulle", + "sijoittuva", + "taide-elokuva", + "Wikimedia-säätiön", + "Varsinais-Suomen", + ], + ) +] + +ABBREVIATION_INFLECTION_TESTS = [ + ( + "VTT:ssa ennen v:ta 2010 suoritetut mittaukset", + ["VTT:ssa", "ennen", "v:ta", "2010", "suoritetut", "mittaukset"], + ), + ("ALV:n osuus on 24 %.", ["ALV:n", "osuus", "on", "24", "%", "."]), + ("Hiihtäjä oli kilpailun 14:s.", ["Hiihtäjä", "oli", "kilpailun", "14:s", "."]), + ("EU:n toimesta tehtiin jotain.", ["EU:n", "toimesta", "tehtiin", "jotain", "."]), +] + +CONTRACTION_TESTS = [ + ( + "Päätimme ettemme tule.", + ["Päätimme", "ett", "emme", "tule", "."], + ["päätimme", "että", "emme", "tule", "."], + ), + ( + "Miksei puhuttaisi?", + ["Miks", "ei", "puhuttaisi", "?"], + ["miksi", "ei", "puhuttaisi", "?"], + ), + ( + "He tottelivat vaikkeivat halunneet", + ["He", "tottelivat", "vaikk", "eivat", "halunneet"], + ["he", "tottelivat", "vaikka", "eivät", "halunneet"], + ), +] + + +@pytest.mark.parametrize("text,expected_tokens", ABBREVIATION_TESTS) +def test_fi_tokenizer_abbreviations(fi_tokenizer, text, expected_tokens): + tokens = fi_tokenizer(text) + token_list = [token.text for token in tokens if not token.is_space] + assert expected_tokens == token_list + + +@pytest.mark.parametrize("text,expected_tokens", HYPHENATED_TESTS) +def test_fi_tokenizer_hyphenated_words(fi_tokenizer, text, expected_tokens): + tokens = fi_tokenizer(text) + token_list = [token.text for token in tokens if not token.is_space] + assert expected_tokens == token_list + + +@pytest.mark.parametrize("text,expected_tokens", ABBREVIATION_INFLECTION_TESTS) +def test_fi_tokenizer_abbreviation_inflections(fi_tokenizer, text, expected_tokens): + tokens = fi_tokenizer(text) + token_list = [token.text for token in tokens if not token.is_space] + assert expected_tokens == token_list + + +@pytest.mark.parametrize("text,expected_tokens,expected_norms", CONTRACTION_TESTS) +def test_fi_tokenizer_contractions(fi_tokenizer, text, expected_tokens, expected_norms): + tokens = fi_tokenizer(text) + token_list = [token.text for token in tokens if not token.is_space] + norm_list = [token.norm_ for token in tokens if not token.is_space] + assert expected_tokens == token_list + assert expected_norms == norm_list diff --git a/TTS/Kokoro/.venv/Lib/site-packages/spacy/tests/lang/fo/__init__.py b/TTS/Kokoro/.venv/Lib/site-packages/spacy/tests/lang/fo/__init__.py new file mode 100644 index 0000000000000000000000000000000000000000..e69de29bb2d1d6434b8b29ae775ad8c2e48c5391 diff --git a/TTS/Kokoro/.venv/Lib/site-packages/spacy/tests/lang/fo/__pycache__/__init__.cpython-312.pyc b/TTS/Kokoro/.venv/Lib/site-packages/spacy/tests/lang/fo/__pycache__/__init__.cpython-312.pyc new file mode 100644 index 0000000000000000000000000000000000000000..423a315a192af687f852fdca265a15ecc710cc2e Binary files /dev/null and b/TTS/Kokoro/.venv/Lib/site-packages/spacy/tests/lang/fo/__pycache__/__init__.cpython-312.pyc differ diff --git a/TTS/Kokoro/.venv/Lib/site-packages/spacy/tests/lang/fo/__pycache__/test_tokenizer.cpython-312.pyc b/TTS/Kokoro/.venv/Lib/site-packages/spacy/tests/lang/fo/__pycache__/test_tokenizer.cpython-312.pyc new file mode 100644 index 0000000000000000000000000000000000000000..cf9459348a442f70dbfb26e9f6209c853c49d650 Binary files /dev/null and b/TTS/Kokoro/.venv/Lib/site-packages/spacy/tests/lang/fo/__pycache__/test_tokenizer.cpython-312.pyc differ diff --git a/TTS/Kokoro/.venv/Lib/site-packages/spacy/tests/lang/fo/test_tokenizer.py b/TTS/Kokoro/.venv/Lib/site-packages/spacy/tests/lang/fo/test_tokenizer.py new file mode 100644 index 0000000000000000000000000000000000000000..4705326aa5b63fac632a300c80d58672919f3283 --- /dev/null +++ b/TTS/Kokoro/.venv/Lib/site-packages/spacy/tests/lang/fo/test_tokenizer.py @@ -0,0 +1,26 @@ +import pytest + +# examples taken from Basic LAnguage Resource Kit 1.0 for Faroese (https://maltokni.fo/en/resources) licensed with CC BY 4.0 (https://creativecommons.org/licenses/by/4.0/) +# fmt: off +FO_TOKEN_EXCEPTION_TESTS = [ + ( + "Eftir løgtingslóg um samsýning og eftirløn landsstýrismanna v.m., skulu løgmaður og landsstýrismenn vanliga siga frá sær størv í almennari tænastu ella privatum virkjum, samtøkum ella stovnum. ", + [ + "Eftir", "løgtingslóg", "um", "samsýning", "og", "eftirløn", "landsstýrismanna", "v.m.", ",", "skulu", "løgmaður", "og", "landsstýrismenn", "vanliga", "siga", "frá", "sær", "størv", "í", "almennari", "tænastu", "ella", "privatum", "virkjum", ",", "samtøkum", "ella", "stovnum", ".", + ], + ), + ( + "Sambandsflokkurin gongur aftur við 2,7 prosentum í mun til valið í 1994, tá flokkurin fekk undirtøku frá 23,4 prosent av veljarunum.", + [ + "Sambandsflokkurin", "gongur", "aftur", "við", "2,7", "prosentum", "í", "mun", "til", "valið", "í", "1994", ",", "tá", "flokkurin", "fekk", "undirtøku", "frá", "23,4", "prosent", "av", "veljarunum", ".", + ], + ), +] +# fmt: on + + +@pytest.mark.parametrize("text,expected_tokens", FO_TOKEN_EXCEPTION_TESTS) +def test_fo_tokenizer_handles_exception_cases(fo_tokenizer, text, expected_tokens): + tokens = fo_tokenizer(text) + token_list = [token.text for token in tokens if not token.is_space] + assert expected_tokens == token_list diff --git a/TTS/Kokoro/.venv/Lib/site-packages/spacy/tests/lang/fr/__init__.py b/TTS/Kokoro/.venv/Lib/site-packages/spacy/tests/lang/fr/__init__.py new file mode 100644 index 0000000000000000000000000000000000000000..e69de29bb2d1d6434b8b29ae775ad8c2e48c5391 diff --git a/TTS/Kokoro/.venv/Lib/site-packages/spacy/tests/lang/fr/__pycache__/__init__.cpython-312.pyc b/TTS/Kokoro/.venv/Lib/site-packages/spacy/tests/lang/fr/__pycache__/__init__.cpython-312.pyc new file mode 100644 index 0000000000000000000000000000000000000000..1d6a9b64ada359cbc0bd3b5e32e8fd5b599b161d Binary files /dev/null and b/TTS/Kokoro/.venv/Lib/site-packages/spacy/tests/lang/fr/__pycache__/__init__.cpython-312.pyc differ diff --git a/TTS/Kokoro/.venv/Lib/site-packages/spacy/tests/lang/fr/__pycache__/test_exceptions.cpython-312.pyc b/TTS/Kokoro/.venv/Lib/site-packages/spacy/tests/lang/fr/__pycache__/test_exceptions.cpython-312.pyc new file mode 100644 index 0000000000000000000000000000000000000000..e4c2a58f7050f1b7bc61a70b5d5cae55412b6366 Binary files /dev/null and b/TTS/Kokoro/.venv/Lib/site-packages/spacy/tests/lang/fr/__pycache__/test_exceptions.cpython-312.pyc differ diff --git a/TTS/Kokoro/.venv/Lib/site-packages/spacy/tests/lang/fr/__pycache__/test_noun_chunks.cpython-312.pyc b/TTS/Kokoro/.venv/Lib/site-packages/spacy/tests/lang/fr/__pycache__/test_noun_chunks.cpython-312.pyc new file mode 100644 index 0000000000000000000000000000000000000000..447af30c86f8ec569b116976b3050ce32faa6ff1 Binary files /dev/null and b/TTS/Kokoro/.venv/Lib/site-packages/spacy/tests/lang/fr/__pycache__/test_noun_chunks.cpython-312.pyc differ diff --git a/TTS/Kokoro/.venv/Lib/site-packages/spacy/tests/lang/fr/__pycache__/test_prefix_suffix_infix.cpython-312.pyc b/TTS/Kokoro/.venv/Lib/site-packages/spacy/tests/lang/fr/__pycache__/test_prefix_suffix_infix.cpython-312.pyc new file mode 100644 index 0000000000000000000000000000000000000000..1c23df6bacbd889ddf7b361e3a6c544f62707357 Binary files /dev/null and b/TTS/Kokoro/.venv/Lib/site-packages/spacy/tests/lang/fr/__pycache__/test_prefix_suffix_infix.cpython-312.pyc differ diff --git a/TTS/Kokoro/.venv/Lib/site-packages/spacy/tests/lang/fr/__pycache__/test_text.cpython-312.pyc b/TTS/Kokoro/.venv/Lib/site-packages/spacy/tests/lang/fr/__pycache__/test_text.cpython-312.pyc new file mode 100644 index 0000000000000000000000000000000000000000..862ebb7a5c93551e868c350b79860cbc50838409 Binary files /dev/null and b/TTS/Kokoro/.venv/Lib/site-packages/spacy/tests/lang/fr/__pycache__/test_text.cpython-312.pyc differ diff --git a/TTS/Kokoro/.venv/Lib/site-packages/spacy/tests/lang/fr/test_exceptions.py b/TTS/Kokoro/.venv/Lib/site-packages/spacy/tests/lang/fr/test_exceptions.py new file mode 100644 index 0000000000000000000000000000000000000000..bf96eda989342239311f6a1d4342f1a1b8368e24 --- /dev/null +++ b/TTS/Kokoro/.venv/Lib/site-packages/spacy/tests/lang/fr/test_exceptions.py @@ -0,0 +1,82 @@ +import pytest + + +@pytest.mark.parametrize( + "text", + [ + "aujourd'hui", + "Aujourd'hui", + "prud'hommes", + "prud’hommal", + "audio-numérique", + "Audio-numérique", + "entr'amis", + "entr'abat", + "rentr'ouvertes", + "grand'hamien", + "Châteauneuf-la-Forêt", + "Château-Guibert", + "refox-trottâmes", + # u"K-POP", + # u"K-Pop", + # u"K-pop", + "z'yeutes", + "black-outeront", + "états-unienne", + "courtes-pattes", + "court-pattes", + "saut-de-ski", + "Écourt-Saint-Quentin", + "Bout-de-l'Îlien", + "pet-en-l'air", + ], +) +def test_fr_tokenizer_infix_exceptions(fr_tokenizer, text): + tokens = fr_tokenizer(text) + assert len(tokens) == 1 + + +@pytest.mark.parametrize("text", ["janv.", "juill.", "Dr.", "av.", "sept."]) +def test_fr_tokenizer_handles_abbr(fr_tokenizer, text): + tokens = fr_tokenizer(text) + assert len(tokens) == 1 + + +def test_fr_tokenizer_handles_exc_in_text(fr_tokenizer): + text = "Je suis allé au mois de janv. aux prud’hommes." + tokens = fr_tokenizer(text) + assert len(tokens) == 10 + assert tokens[6].text == "janv." + assert tokens[8].text == "prud’hommes" + + +def test_fr_tokenizer_handles_exc_in_text_2(fr_tokenizer): + text = "Cette après-midi, je suis allé dans un restaurant italo-mexicain." + tokens = fr_tokenizer(text) + assert len(tokens) == 11 + assert tokens[1].text == "après-midi" + assert tokens[9].text == "italo-mexicain" + + +def test_fr_tokenizer_handles_title(fr_tokenizer): + text = "N'est-ce pas génial?" + tokens = fr_tokenizer(text) + assert len(tokens) == 6 + assert tokens[0].text == "N'" + assert tokens[1].text == "est" + assert tokens[2].text == "-ce" + + +def test_fr_tokenizer_handles_title_2(fr_tokenizer): + text = "Est-ce pas génial?" + tokens = fr_tokenizer(text) + assert len(tokens) == 5 + assert tokens[0].text == "Est" + assert tokens[1].text == "-ce" + + +def test_fr_tokenizer_handles_title_3(fr_tokenizer): + text = "Qu'est-ce que tu fais?" + tokens = fr_tokenizer(text) + assert len(tokens) == 7 + assert tokens[0].text == "Qu'" diff --git a/TTS/Kokoro/.venv/Lib/site-packages/spacy/tests/lang/fr/test_noun_chunks.py b/TTS/Kokoro/.venv/Lib/site-packages/spacy/tests/lang/fr/test_noun_chunks.py new file mode 100644 index 0000000000000000000000000000000000000000..6c62a97935e7aa6a8437aab118c55b18b083e29b --- /dev/null +++ b/TTS/Kokoro/.venv/Lib/site-packages/spacy/tests/lang/fr/test_noun_chunks.py @@ -0,0 +1,231 @@ +import pytest + +from spacy.tokens import Doc + + +# fmt: off +@pytest.mark.parametrize( + "words,heads,deps,pos,chunk_offsets", + [ + # determiner + noun + # un nom -> un nom + ( + ["un", "nom"], + [1, 1], + ["det", "ROOT"], + ["DET", "NOUN"], + [(0, 2)], + ), + # determiner + noun starting with vowel + # l'heure -> l'heure + ( + ["l'", "heure"], + [1, 1], + ["det", "ROOT"], + ["DET", "NOUN"], + [(0, 2)], + ), + # determiner + plural noun + # les romans -> les romans + ( + ["les", "romans"], + [1, 1], + ["det", "ROOT"], + ["DET", "NOUN"], + [(0, 2)], + ), + # det + adj + noun + # Le vieux Londres -> Le vieux Londres + ( + ['Les', 'vieux', 'Londres'], + [2, 2, 2], + ["det", "amod", "ROOT"], + ["DET", "ADJ", "NOUN"], + [(0,3)] + ), + # det + noun + adj + # le nom propre -> le nom propre a proper noun + ( + ["le", "nom", "propre"], + [1, 1, 1], + ["det", "ROOT", "amod"], + ["DET", "NOUN", "ADJ"], + [(0, 3)], + ), + # det + noun + adj plural + # Les chiens bruns -> les chiens bruns + ( + ["Les", "chiens", "bruns"], + [1, 1, 1], + ["det", "ROOT", "amod"], + ["DET", "NOUN", "ADJ"], + [(0, 3)], + ), + # multiple adjectives: one adj before the noun, one adj after the noun + # un nouveau film intéressant -> un nouveau film intéressant + ( + ["un", "nouveau", "film", "intéressant"], + [2, 2, 2, 2], + ["det", "amod", "ROOT", "amod"], + ["DET", "ADJ", "NOUN", "ADJ"], + [(0,4)] + ), + # multiple adjectives, both adjs after the noun + # une personne intelligente et drôle -> une personne intelligente et drôle + ( + ["une", "personne", "intelligente", "et", "drôle"], + [1, 1, 1, 4, 2], + ["det", "ROOT", "amod", "cc", "conj"], + ["DET", "NOUN", "ADJ", "CCONJ", "ADJ"], + [(0,5)] + ), + # relative pronoun + # un bus qui va au ville -> un bus, qui, ville + ( + ['un', 'bus', 'qui', 'va', 'au', 'ville'], + [1, 1, 3, 1, 5, 3], + ['det', 'ROOT', 'nsubj', 'acl:relcl', 'case', 'obl:arg'], + ['DET', 'NOUN', 'PRON', 'VERB', 'ADP', 'NOUN'], + [(0,2), (2,3), (5,6)] + ), + # relative subclause + # Voilà la maison que nous voulons acheter -> la maison, nous That's the house that we want to buy. + ( + ['Voilà', 'la', 'maison', 'que', 'nous', 'voulons', 'acheter'], + [0, 2, 0, 5, 5, 2, 5], + ['ROOT', 'det', 'obj', 'mark', 'nsubj', 'acl:relcl', 'xcomp'], + ['VERB', 'DET', 'NOUN', 'SCONJ', 'PRON', 'VERB', 'VERB'], + [(1,3), (4,5)] + ), + # Person name and title by flat + # Louis XIV -> Louis XIV + ( + ["Louis", "XIV"], + [0, 0], + ["ROOT", "flat:name"], + ["PROPN", "PROPN"], + [(0,2)] + ), + # Organization name by flat + # Nations Unies -> Nations Unies + ( + ["Nations", "Unies"], + [0, 0], + ["ROOT", "flat:name"], + ["PROPN", "PROPN"], + [(0,2)] + ), + # Noun compound, person name created by two flats + # Louise de Bratagne -> Louise de Bratagne + ( + ["Louise", "de", "Bratagne"], + [0, 0, 0], + ["ROOT", "flat:name", "flat:name"], + ["PROPN", "PROPN", "PROPN"], + [(0,3)] + ), + # Noun compound, person name created by two flats + # Louis François Joseph -> Louis François Joseph + ( + ["Louis", "François", "Joseph"], + [0, 0, 0], + ["ROOT", "flat:name", "flat:name"], + ["PROPN", "PROPN", "PROPN"], + [(0,3)] + ), + # one determiner + one noun + one adjective qualified by an adverb + # quelques agriculteurs très riches -> quelques agriculteurs très riches + ( + ["quelques", "agriculteurs", "très", "riches"], + [1, 1, 3, 1], + ['det', 'ROOT', 'advmod', 'amod'], + ['DET', 'NOUN', 'ADV', 'ADJ'], + [(0,4)] + ), + # Two NPs conjuncted + # Il a un chien et un chat -> Il, un chien, un chat + ( + ['Il', 'a', 'un', 'chien', 'et', 'un', 'chat'], + [1, 1, 3, 1, 6, 6, 3], + ['nsubj', 'ROOT', 'det', 'obj', 'cc', 'det', 'conj'], + ['PRON', 'VERB', 'DET', 'NOUN', 'CCONJ', 'DET', 'NOUN'], + [(0,1), (2,4), (5,7)] + + ), + # Two NPs together + # l'écrivain brésilien Aníbal Machado -> l'écrivain brésilien, Aníbal Machado + ( + ["l'", 'écrivain', 'brésilien', 'Aníbal', 'Machado'], + [1, 1, 1, 1, 3], + ['det', 'ROOT', 'amod', 'appos', 'flat:name'], + ['DET', 'NOUN', 'ADJ', 'PROPN', 'PROPN'], + [(0, 3), (3, 5)] + ), + # nmod relation between NPs + # la destruction de la ville -> la destruction, la ville + ( + ['la', 'destruction', 'de', 'la', 'ville'], + [1, 1, 4, 4, 1], + ['det', 'ROOT', 'case', 'det', 'nmod'], + ['DET', 'NOUN', 'ADP', 'DET', 'NOUN'], + [(0,2), (3,5)] + ), + # nmod relation between NPs + # Archiduchesse d’Autriche -> Archiduchesse, Autriche + ( + ['Archiduchesse', 'd’', 'Autriche'], + [0, 2, 0], + ['ROOT', 'case', 'nmod'], + ['NOUN', 'ADP', 'PROPN'], + [(0,1), (2,3)] + ), + # Compounding by nmod, several NPs chained together + # la première usine de drogue du gouvernement -> la première usine, drogue, gouvernement + ( + ["la", "première", "usine", "de", "drogue", "du", "gouvernement"], + [2, 2, 2, 4, 2, 6, 2], + ['det', 'amod', 'ROOT', 'case', 'nmod', 'case', 'nmod'], + ['DET', 'ADJ', 'NOUN', 'ADP', 'NOUN', 'ADP', 'NOUN'], + [(0, 3), (4, 5), (6, 7)] + ), + # several NPs + # Traduction du rapport de Susana -> Traduction, rapport, Susana + ( + ['Traduction', 'du', 'raport', 'de', 'Susana'], + [0, 2, 0, 4, 2], + ['ROOT', 'case', 'nmod', 'case', 'nmod'], + ['NOUN', 'ADP', 'NOUN', 'ADP', 'PROPN'], + [(0,1), (2,3), (4,5)] + + ), + # Several NPs + # Le gros chat de Susana et son amie -> Le gros chat, Susana, son amie + ( + ['Le', 'gros', 'chat', 'de', 'Susana', 'et', 'son', 'amie'], + [2, 2, 2, 4, 2, 7, 7, 2], + ['det', 'amod', 'ROOT', 'case', 'nmod', 'cc', 'det', 'conj'], + ['DET', 'ADJ', 'NOUN', 'ADP', 'PROPN', 'CCONJ', 'DET', 'NOUN'], + [(0,3), (4,5), (6,8)] + ), + # Passive subject + # Les nouvelles dépenses sont alimentées par le grand compte bancaire de Clinton -> Les nouvelles dépenses, le grand compte bancaire, Clinton + ( + ['Les', 'nouvelles', 'dépenses', 'sont', 'alimentées', 'par', 'le', 'grand', 'compte', 'bancaire', 'de', 'Clinton'], + [2, 2, 4, 4, 4, 8, 8, 8, 4, 8, 11, 8], + ['det', 'amod', 'nsubj:pass', 'aux:pass', 'ROOT', 'case', 'det', 'amod', 'obl:agent', 'amod', 'case', 'nmod'], + ['DET', 'ADJ', 'NOUN', 'AUX', 'VERB', 'ADP', 'DET', 'ADJ', 'NOUN', 'ADJ', 'ADP', 'PROPN'], + [(0, 3), (6, 10), (11, 12)] + ) + ], +) +# fmt: on +def test_fr_noun_chunks(fr_vocab, words, heads, deps, pos, chunk_offsets): + doc = Doc(fr_vocab, words=words, heads=heads, deps=deps, pos=pos) + assert [(c.start, c.end) for c in doc.noun_chunks] == chunk_offsets + + +def test_noun_chunks_is_parsed_fr(fr_tokenizer): + """Test that noun_chunks raises Value Error for 'fr' language if Doc is not parsed.""" + doc = fr_tokenizer("Je suis allé à l'école") + with pytest.raises(ValueError): + list(doc.noun_chunks) diff --git a/TTS/Kokoro/.venv/Lib/site-packages/spacy/tests/lang/fr/test_prefix_suffix_infix.py b/TTS/Kokoro/.venv/Lib/site-packages/spacy/tests/lang/fr/test_prefix_suffix_infix.py new file mode 100644 index 0000000000000000000000000000000000000000..bf2e2f87dfd733731fb0caa851ee0cde1c77d34f --- /dev/null +++ b/TTS/Kokoro/.venv/Lib/site-packages/spacy/tests/lang/fr/test_prefix_suffix_infix.py @@ -0,0 +1,23 @@ +import pytest + +from spacy.lang.char_classes import ALPHA +from spacy.lang.punctuation import TOKENIZER_INFIXES +from spacy.language import BaseDefaults, Language + + +@pytest.mark.issue(768) +@pytest.mark.parametrize( + "text,expected_tokens", [("l'avion", ["l'", "avion"]), ("j'ai", ["j'", "ai"])] +) +def test_issue768(text, expected_tokens): + """Allow zero-width 'infix' token during the tokenization process.""" + SPLIT_INFIX = r"(?<=[{a}]\')(?=[{a}])".format(a=ALPHA) + + class FrenchTest(Language): + class Defaults(BaseDefaults): + infixes = TOKENIZER_INFIXES + [SPLIT_INFIX] + + fr_tokenizer_w_infix = FrenchTest().tokenizer + tokens = fr_tokenizer_w_infix(text) + assert len(tokens) == 2 + assert [t.text for t in tokens] == expected_tokens diff --git a/TTS/Kokoro/.venv/Lib/site-packages/spacy/tests/lang/fr/test_text.py b/TTS/Kokoro/.venv/Lib/site-packages/spacy/tests/lang/fr/test_text.py new file mode 100644 index 0000000000000000000000000000000000000000..82e03bc541b14a7b48988f8bc306823cfe41d165 --- /dev/null +++ b/TTS/Kokoro/.venv/Lib/site-packages/spacy/tests/lang/fr/test_text.py @@ -0,0 +1,23 @@ +import pytest + +from spacy.lang.fr.lex_attrs import like_num + + +def test_tokenizer_handles_long_text(fr_tokenizer): + text = """L'histoire du TAL commence dans les années 1950, bien que l'on puisse \ +trouver des travaux antérieurs. En 1950, Alan Turing éditait un article \ +célèbre sous le titre « Computing machinery and intelligence » qui propose ce \ +qu'on appelle à présent le test de Turing comme critère d'intelligence. \ +Ce critère dépend de la capacité d'un programme informatique de personnifier \ +un humain dans une conversation écrite en temps réel, de façon suffisamment \ +convaincante que l'interlocuteur humain ne peut distinguer sûrement — sur la \ +base du seul contenu de la conversation — s'il interagit avec un programme \ +ou avec un autre vrai humain.""" + tokens = fr_tokenizer(text) + assert len(tokens) == 113 + + +@pytest.mark.parametrize("word", ["onze", "onzième"]) +def test_fr_lex_attrs_capitals(word): + assert like_num(word) + assert like_num(word.upper()) diff --git a/TTS/Kokoro/.venv/Lib/site-packages/spacy/tests/lang/ga/__init__.py b/TTS/Kokoro/.venv/Lib/site-packages/spacy/tests/lang/ga/__init__.py new file mode 100644 index 0000000000000000000000000000000000000000..e69de29bb2d1d6434b8b29ae775ad8c2e48c5391 diff --git a/TTS/Kokoro/.venv/Lib/site-packages/spacy/tests/lang/ga/__pycache__/__init__.cpython-312.pyc b/TTS/Kokoro/.venv/Lib/site-packages/spacy/tests/lang/ga/__pycache__/__init__.cpython-312.pyc new file mode 100644 index 0000000000000000000000000000000000000000..e85888aee57c05a514ac08f679f83955ce09aa55 Binary files /dev/null and b/TTS/Kokoro/.venv/Lib/site-packages/spacy/tests/lang/ga/__pycache__/__init__.cpython-312.pyc differ diff --git a/TTS/Kokoro/.venv/Lib/site-packages/spacy/tests/lang/ga/__pycache__/test_tokenizer.cpython-312.pyc b/TTS/Kokoro/.venv/Lib/site-packages/spacy/tests/lang/ga/__pycache__/test_tokenizer.cpython-312.pyc new file mode 100644 index 0000000000000000000000000000000000000000..a23fda6c8f9cf441901bc68cc23a44f0f778d08c Binary files /dev/null and b/TTS/Kokoro/.venv/Lib/site-packages/spacy/tests/lang/ga/__pycache__/test_tokenizer.cpython-312.pyc differ diff --git a/TTS/Kokoro/.venv/Lib/site-packages/spacy/tests/lang/ga/test_tokenizer.py b/TTS/Kokoro/.venv/Lib/site-packages/spacy/tests/lang/ga/test_tokenizer.py new file mode 100644 index 0000000000000000000000000000000000000000..f217804161db94281fc2f456b67a16f8399bc93c --- /dev/null +++ b/TTS/Kokoro/.venv/Lib/site-packages/spacy/tests/lang/ga/test_tokenizer.py @@ -0,0 +1,15 @@ +import pytest + +# fmt: off +GA_TOKEN_EXCEPTION_TESTS = [ + ("Niall Ó Domhnaill, Rialtas na hÉireann 1977 (lch. 600).", ["Niall", "Ó", "Domhnaill", ",", "Rialtas", "na", "hÉireann", "1977", "(", "lch.", "600", ")", "."]), + ("Daoine a bhfuil Gaeilge acu, m.sh. tusa agus mise", ["Daoine", "a", "bhfuil", "Gaeilge", "acu", ",", "m.sh.", "tusa", "agus", "mise"]) +] +# fmt: on + + +@pytest.mark.parametrize("text,expected_tokens", GA_TOKEN_EXCEPTION_TESTS) +def test_ga_tokenizer_handles_exception_cases(ga_tokenizer, text, expected_tokens): + tokens = ga_tokenizer(text) + token_list = [token.text for token in tokens if not token.is_space] + assert expected_tokens == token_list diff --git a/TTS/Kokoro/.venv/Lib/site-packages/spacy/tests/lang/grc/__init__.py b/TTS/Kokoro/.venv/Lib/site-packages/spacy/tests/lang/grc/__init__.py new file mode 100644 index 0000000000000000000000000000000000000000..e69de29bb2d1d6434b8b29ae775ad8c2e48c5391 diff --git a/TTS/Kokoro/.venv/Lib/site-packages/spacy/tests/lang/grc/__pycache__/__init__.cpython-312.pyc b/TTS/Kokoro/.venv/Lib/site-packages/spacy/tests/lang/grc/__pycache__/__init__.cpython-312.pyc new file mode 100644 index 0000000000000000000000000000000000000000..2ebfe1048c1a02955eb1577d29c707e56aecc1f1 Binary files /dev/null and b/TTS/Kokoro/.venv/Lib/site-packages/spacy/tests/lang/grc/__pycache__/__init__.cpython-312.pyc differ diff --git a/TTS/Kokoro/.venv/Lib/site-packages/spacy/tests/lang/grc/__pycache__/test_text.cpython-312.pyc b/TTS/Kokoro/.venv/Lib/site-packages/spacy/tests/lang/grc/__pycache__/test_text.cpython-312.pyc new file mode 100644 index 0000000000000000000000000000000000000000..93a6b857b97ca41119c5610ee8d89ea9d3af3693 Binary files /dev/null and b/TTS/Kokoro/.venv/Lib/site-packages/spacy/tests/lang/grc/__pycache__/test_text.cpython-312.pyc differ diff --git a/TTS/Kokoro/.venv/Lib/site-packages/spacy/tests/lang/grc/__pycache__/test_tokenizer.cpython-312.pyc b/TTS/Kokoro/.venv/Lib/site-packages/spacy/tests/lang/grc/__pycache__/test_tokenizer.cpython-312.pyc new file mode 100644 index 0000000000000000000000000000000000000000..9010f4eec72e013e7e492367c66a27b42291ffad Binary files /dev/null and b/TTS/Kokoro/.venv/Lib/site-packages/spacy/tests/lang/grc/__pycache__/test_tokenizer.cpython-312.pyc differ diff --git a/TTS/Kokoro/.venv/Lib/site-packages/spacy/tests/lang/grc/test_text.py b/TTS/Kokoro/.venv/Lib/site-packages/spacy/tests/lang/grc/test_text.py new file mode 100644 index 0000000000000000000000000000000000000000..177f76cd2bb3ecb686804c4d1164cefb7512514d --- /dev/null +++ b/TTS/Kokoro/.venv/Lib/site-packages/spacy/tests/lang/grc/test_text.py @@ -0,0 +1,23 @@ +import pytest + + +@pytest.mark.parametrize( + "text,match", + [ + ("ι", True), + ("α", True), + ("ϟα", True), + ("ἑκατόν", True), + ("ἐνακόσια", True), + ("δισχίλια", True), + ("μύρια", True), + ("εἷς", True), + ("λόγος", False), + (",", False), + ("λβ", True), + ], +) +def test_lex_attrs_like_number(grc_tokenizer, text, match): + tokens = grc_tokenizer(text) + assert len(tokens) == 1 + assert tokens[0].like_num == match diff --git a/TTS/Kokoro/.venv/Lib/site-packages/spacy/tests/lang/grc/test_tokenizer.py b/TTS/Kokoro/.venv/Lib/site-packages/spacy/tests/lang/grc/test_tokenizer.py new file mode 100644 index 0000000000000000000000000000000000000000..fe1e636bb705e0a805a4054c27cbf5ddce3068f1 --- /dev/null +++ b/TTS/Kokoro/.venv/Lib/site-packages/spacy/tests/lang/grc/test_tokenizer.py @@ -0,0 +1,17 @@ +import pytest + +# fmt: off +GRC_TOKEN_EXCEPTION_TESTS = [ + ("τὸ 〈τῆς〉 φιλοσοφίας ἔργον ἔνιοί φασιν ἀπὸ ⟦βαρβάρων⟧ ἄρξαι.", ["τὸ", "〈", "τῆς", "〉", "φιλοσοφίας", "ἔργον", "ἔνιοί", "φασιν", "ἀπὸ", "⟦", "βαρβάρων", "⟧", "ἄρξαι", "."]), + ("τὴν δὲ τῶν Αἰγυπτίων φιλοσοφίαν εἶναι τοιαύτην περί τε †θεῶν† καὶ ὑπὲρ δικαιοσύνης.", ["τὴν", "δὲ", "τῶν", "Αἰγυπτίων", "φιλοσοφίαν", "εἶναι", "τοιαύτην", "περί", "τε", "†", "θεῶν", "†", "καὶ", "ὑπὲρ", "δικαιοσύνης", "."]), + ("⸏πόσις δ' Ἐρεχθεύς ἐστί μοι σεσωσμένος⸏", ["⸏", "πόσις", "δ'", "Ἐρεχθεύς", "ἐστί", "μοι", "σεσωσμένος", "⸏"]), + ("⸏ὔπνον ἴδωμεν⸎", ["⸏", "ὔπνον", "ἴδωμεν", "⸎"]), +] +# fmt: on + + +@pytest.mark.parametrize("text,expected_tokens", GRC_TOKEN_EXCEPTION_TESTS) +def test_grc_tokenizer(grc_tokenizer, text, expected_tokens): + tokens = grc_tokenizer(text) + token_list = [token.text for token in tokens if not token.is_space] + assert expected_tokens == token_list diff --git a/TTS/Kokoro/.venv/Lib/site-packages/spacy/tests/lang/gu/__init__.py b/TTS/Kokoro/.venv/Lib/site-packages/spacy/tests/lang/gu/__init__.py new file mode 100644 index 0000000000000000000000000000000000000000..e69de29bb2d1d6434b8b29ae775ad8c2e48c5391 diff --git a/TTS/Kokoro/.venv/Lib/site-packages/spacy/tests/lang/gu/__pycache__/__init__.cpython-312.pyc b/TTS/Kokoro/.venv/Lib/site-packages/spacy/tests/lang/gu/__pycache__/__init__.cpython-312.pyc new file mode 100644 index 0000000000000000000000000000000000000000..3aec7ca7d1370796ba3f450052c2350cb40a3bf2 Binary files /dev/null and b/TTS/Kokoro/.venv/Lib/site-packages/spacy/tests/lang/gu/__pycache__/__init__.cpython-312.pyc differ diff --git a/TTS/Kokoro/.venv/Lib/site-packages/spacy/tests/lang/gu/__pycache__/test_text.cpython-312.pyc b/TTS/Kokoro/.venv/Lib/site-packages/spacy/tests/lang/gu/__pycache__/test_text.cpython-312.pyc new file mode 100644 index 0000000000000000000000000000000000000000..a5d5ceb0bfb80a75e4693bf1de9a6428028f9b89 Binary files /dev/null and b/TTS/Kokoro/.venv/Lib/site-packages/spacy/tests/lang/gu/__pycache__/test_text.cpython-312.pyc differ diff --git a/TTS/Kokoro/.venv/Lib/site-packages/spacy/tests/lang/gu/test_text.py b/TTS/Kokoro/.venv/Lib/site-packages/spacy/tests/lang/gu/test_text.py new file mode 100644 index 0000000000000000000000000000000000000000..43950c523f3a699a3c17543b8af7237b87f46257 --- /dev/null +++ b/TTS/Kokoro/.venv/Lib/site-packages/spacy/tests/lang/gu/test_text.py @@ -0,0 +1,16 @@ +import pytest + + +def test_gu_tokenizer_handlers_long_text(gu_tokenizer): + text = """પશ્ચિમ ભારતમાં આવેલું ગુજરાત રાજ્ય જે વ્યક્તિઓની માતૃભૂમિ છે""" + tokens = gu_tokenizer(text) + assert len(tokens) == 9 + + +@pytest.mark.parametrize( + "text,length", + [("ગુજરાતીઓ ખાવાના શોખીન માનવામાં આવે છે", 6), ("ખેતરની ખેડ કરવામાં આવે છે.", 5)], +) +def test_gu_tokenizer_handles_cnts(gu_tokenizer, text, length): + tokens = gu_tokenizer(text) + assert len(tokens) == length diff --git a/TTS/Kokoro/.venv/Lib/site-packages/spacy/tests/lang/he/__init__.py b/TTS/Kokoro/.venv/Lib/site-packages/spacy/tests/lang/he/__init__.py new file mode 100644 index 0000000000000000000000000000000000000000..e69de29bb2d1d6434b8b29ae775ad8c2e48c5391 diff --git a/TTS/Kokoro/.venv/Lib/site-packages/spacy/tests/lang/he/__pycache__/__init__.cpython-312.pyc b/TTS/Kokoro/.venv/Lib/site-packages/spacy/tests/lang/he/__pycache__/__init__.cpython-312.pyc new file mode 100644 index 0000000000000000000000000000000000000000..23674fc22207a228296e0f803d571cef0ef69f0e Binary files /dev/null and b/TTS/Kokoro/.venv/Lib/site-packages/spacy/tests/lang/he/__pycache__/__init__.cpython-312.pyc differ diff --git a/TTS/Kokoro/.venv/Lib/site-packages/spacy/tests/lang/he/__pycache__/test_tokenizer.cpython-312.pyc b/TTS/Kokoro/.venv/Lib/site-packages/spacy/tests/lang/he/__pycache__/test_tokenizer.cpython-312.pyc new file mode 100644 index 0000000000000000000000000000000000000000..9dd47e936dd61597c8e1a75444b351af9ac4617b Binary files /dev/null and b/TTS/Kokoro/.venv/Lib/site-packages/spacy/tests/lang/he/__pycache__/test_tokenizer.cpython-312.pyc differ diff --git a/TTS/Kokoro/.venv/Lib/site-packages/spacy/tests/lang/he/test_tokenizer.py b/TTS/Kokoro/.venv/Lib/site-packages/spacy/tests/lang/he/test_tokenizer.py new file mode 100644 index 0000000000000000000000000000000000000000..ae0d2235b5752d48e0d86debbd5c77af84053fb4 --- /dev/null +++ b/TTS/Kokoro/.venv/Lib/site-packages/spacy/tests/lang/he/test_tokenizer.py @@ -0,0 +1,70 @@ +import pytest + +from spacy.lang.he.lex_attrs import like_num + + +@pytest.mark.parametrize( + "text,expected_tokens", + [("פייתון היא שפת תכנות דינמית", ["פייתון", "היא", "שפת", "תכנות", "דינמית"])], +) +def test_he_tokenizer_handles_abbreviation(he_tokenizer, text, expected_tokens): + tokens = he_tokenizer(text) + token_list = [token.text for token in tokens if not token.is_space] + assert expected_tokens == token_list + + +@pytest.mark.parametrize( + "text,expected_tokens", + [ + ( + "עקבת אחריו בכל רחבי המדינה.", + ["עקבת", "אחריו", "בכל", "רחבי", "המדינה", "."], + ), + ( + "עקבת אחריו בכל רחבי המדינה?", + ["עקבת", "אחריו", "בכל", "רחבי", "המדינה", "?"], + ), + ( + "עקבת אחריו בכל רחבי המדינה!", + ["עקבת", "אחריו", "בכל", "רחבי", "המדינה", "!"], + ), + ( + "עקבת אחריו בכל רחבי המדינה..", + ["עקבת", "אחריו", "בכל", "רחבי", "המדינה", ".."], + ), + ( + "עקבת אחריו בכל רחבי המדינה...", + ["עקבת", "אחריו", "בכל", "רחבי", "המדינה", "..."], + ), + ], +) +def test_he_tokenizer_handles_punct(he_tokenizer, text, expected_tokens): + tokens = he_tokenizer(text) + assert expected_tokens == [token.text for token in tokens] + + +@pytest.mark.parametrize( + "text,match", + [ + ("10", True), + ("1", True), + ("10,000", True), + ("10,00", True), + ("999.0", True), + ("אחד", True), + ("שתיים", True), + ("מליון", True), + ("כלב", False), + (",", False), + ("1/2", True), + ], +) +def test_lex_attrs_like_number(he_tokenizer, text, match): + tokens = he_tokenizer(text) + assert len(tokens) == 1 + assert tokens[0].like_num == match + + +@pytest.mark.parametrize("word", ["שלישי", "מליון", "עשירי", "מאה", "עשר", "אחד עשר"]) +def test_he_lex_attrs_like_number_for_ordinal(word): + assert like_num(word) diff --git a/TTS/Kokoro/.venv/Lib/site-packages/spacy/tests/lang/hi/__init__.py b/TTS/Kokoro/.venv/Lib/site-packages/spacy/tests/lang/hi/__init__.py new file mode 100644 index 0000000000000000000000000000000000000000..e69de29bb2d1d6434b8b29ae775ad8c2e48c5391 diff --git a/TTS/Kokoro/.venv/Lib/site-packages/spacy/tests/lang/hi/__pycache__/__init__.cpython-312.pyc b/TTS/Kokoro/.venv/Lib/site-packages/spacy/tests/lang/hi/__pycache__/__init__.cpython-312.pyc new file mode 100644 index 0000000000000000000000000000000000000000..e9cbdcaf3ee913e73de2969a5a0329bacc3aa3d5 Binary files /dev/null and b/TTS/Kokoro/.venv/Lib/site-packages/spacy/tests/lang/hi/__pycache__/__init__.cpython-312.pyc differ diff --git a/TTS/Kokoro/.venv/Lib/site-packages/spacy/tests/lang/hi/__pycache__/test_lex_attrs.cpython-312.pyc b/TTS/Kokoro/.venv/Lib/site-packages/spacy/tests/lang/hi/__pycache__/test_lex_attrs.cpython-312.pyc new file mode 100644 index 0000000000000000000000000000000000000000..085b9ebae493a6d1bdd9d57b3b98120f08f9bc9c Binary files /dev/null and b/TTS/Kokoro/.venv/Lib/site-packages/spacy/tests/lang/hi/__pycache__/test_lex_attrs.cpython-312.pyc differ diff --git a/TTS/Kokoro/.venv/Lib/site-packages/spacy/tests/lang/hi/__pycache__/test_text.cpython-312.pyc b/TTS/Kokoro/.venv/Lib/site-packages/spacy/tests/lang/hi/__pycache__/test_text.cpython-312.pyc new file mode 100644 index 0000000000000000000000000000000000000000..e56c99a7f090ef4fe52a0be872a1f6e0f0b53392 Binary files /dev/null and b/TTS/Kokoro/.venv/Lib/site-packages/spacy/tests/lang/hi/__pycache__/test_text.cpython-312.pyc differ diff --git a/TTS/Kokoro/.venv/Lib/site-packages/spacy/tests/lang/hi/test_lex_attrs.py b/TTS/Kokoro/.venv/Lib/site-packages/spacy/tests/lang/hi/test_lex_attrs.py new file mode 100644 index 0000000000000000000000000000000000000000..9868e9b6f17a5c6e17aa09d08eb9948911fa78d9 --- /dev/null +++ b/TTS/Kokoro/.venv/Lib/site-packages/spacy/tests/lang/hi/test_lex_attrs.py @@ -0,0 +1,44 @@ +import pytest + +from spacy.lang.hi.lex_attrs import like_num, norm + + +def test_hi_tokenizer_handles_long_text(hi_tokenizer): + text = """ +ये कहानी 1900 के दशक की है। कौशल्या (स्मिता जयकर) को पता चलता है कि उसका +छोटा बेटा, देवदास (शाहरुख खान) वापस घर आ रहा है। देवदास 10 साल पहले कानून की +पढ़ाई करने के लिए इंग्लैंड गया था। उसके लौटने की खुशी में ये बात कौशल्या अपनी पड़ोस +में रहने वाली सुमित्रा (किरण खेर) को भी बता देती है। इस खबर से वो भी खुश हो जाती है। +""" + tokens = hi_tokenizer(text) + assert len(tokens) == 86 + + +@pytest.mark.parametrize( + "word,word_norm", + [ + ("चलता", "चल"), + ("पढ़ाई", "पढ़"), + ("देती", "दे"), + ("जाती", "ज"), + ("मुस्कुराकर", "मुस्कुर"), + ], +) +def test_hi_norm(word, word_norm): + assert norm(word) == word_norm + + +@pytest.mark.parametrize( + "word", + ["१९८७", "1987", "१२,२६७", "उन्नीस", "पाँच", "नवासी", "५/१०"], +) +def test_hi_like_num(word): + assert like_num(word) + + +@pytest.mark.parametrize( + "word", + ["पहला", "तृतीय", "निन्यानवेवाँ", "उन्नीस", "तिहत्तरवाँ", "छत्तीसवाँ"], +) +def test_hi_like_num_ordinal_words(word): + assert like_num(word) diff --git a/TTS/Kokoro/.venv/Lib/site-packages/spacy/tests/lang/hi/test_text.py b/TTS/Kokoro/.venv/Lib/site-packages/spacy/tests/lang/hi/test_text.py new file mode 100644 index 0000000000000000000000000000000000000000..d3d77ffbeb609a8d3ad27c8c609964e5a988de6c --- /dev/null +++ b/TTS/Kokoro/.venv/Lib/site-packages/spacy/tests/lang/hi/test_text.py @@ -0,0 +1,12 @@ +import pytest + +from spacy.lang.hi import Hindi + + +@pytest.mark.issue(3625) +def test_issue3625(): + """Test that default punctuation rules applies to hindi unicode characters""" + nlp = Hindi() + doc = nlp("hi. how हुए. होटल, होटल") + expected = ["hi", ".", "how", "हुए", ".", "होटल", ",", "होटल"] + assert [token.text for token in doc] == expected diff --git a/TTS/Kokoro/.venv/Lib/site-packages/spacy/tests/lang/hr/__init__.py b/TTS/Kokoro/.venv/Lib/site-packages/spacy/tests/lang/hr/__init__.py new file mode 100644 index 0000000000000000000000000000000000000000..e69de29bb2d1d6434b8b29ae775ad8c2e48c5391 diff --git a/TTS/Kokoro/.venv/Lib/site-packages/spacy/tests/lang/hr/__pycache__/__init__.cpython-312.pyc b/TTS/Kokoro/.venv/Lib/site-packages/spacy/tests/lang/hr/__pycache__/__init__.cpython-312.pyc new file mode 100644 index 0000000000000000000000000000000000000000..925ae11cc6d6d2181485cb215aac6d9c0c7abf98 Binary files /dev/null and b/TTS/Kokoro/.venv/Lib/site-packages/spacy/tests/lang/hr/__pycache__/__init__.cpython-312.pyc differ diff --git a/TTS/Kokoro/.venv/Lib/site-packages/spacy/tests/lang/hr/__pycache__/test_text.cpython-312.pyc b/TTS/Kokoro/.venv/Lib/site-packages/spacy/tests/lang/hr/__pycache__/test_text.cpython-312.pyc new file mode 100644 index 0000000000000000000000000000000000000000..9ce79d3eb38861b1136f5a1dd1bef1055feaceed Binary files /dev/null and b/TTS/Kokoro/.venv/Lib/site-packages/spacy/tests/lang/hr/__pycache__/test_text.cpython-312.pyc differ diff --git a/TTS/Kokoro/.venv/Lib/site-packages/spacy/tests/lang/hr/__pycache__/test_tokenizer.cpython-312.pyc b/TTS/Kokoro/.venv/Lib/site-packages/spacy/tests/lang/hr/__pycache__/test_tokenizer.cpython-312.pyc new file mode 100644 index 0000000000000000000000000000000000000000..010a4b25406790968a204fa9cef55b79a0514f08 Binary files /dev/null and b/TTS/Kokoro/.venv/Lib/site-packages/spacy/tests/lang/hr/__pycache__/test_tokenizer.cpython-312.pyc differ diff --git a/TTS/Kokoro/.venv/Lib/site-packages/spacy/tests/lang/hr/test_text.py b/TTS/Kokoro/.venv/Lib/site-packages/spacy/tests/lang/hr/test_text.py new file mode 100644 index 0000000000000000000000000000000000000000..eeb6574d13c1e55b5e7872881ec7d34f31697ea6 --- /dev/null +++ b/TTS/Kokoro/.venv/Lib/site-packages/spacy/tests/lang/hr/test_text.py @@ -0,0 +1,26 @@ +import pytest + + +def test_long_text(hr_tokenizer): + # Excerpt: European Convention on Human Rights + text = """ +uzimajući u obzir da ta deklaracija nastoji osigurati opće i djelotvorno +priznanje i poštovanje u njoj proglašenih prava; +uzimajući u obzir da je cilj Vijeća Europe postizanje većeg jedinstva +njegovih članica, i da je jedan od načina postizanja toga cilja +očuvanje i daljnje ostvarivanje ljudskih prava i temeljnih sloboda; +potvrđujući svoju duboku privrženost tim temeljnim slobodama +koje su osnova pravde i mira u svijetu i koje su najbolje zaštićene +istinskom političkom demokracijom s jedne strane te zajedničkim +razumijevanjem i poštovanjem ljudskih prava o kojima te slobode +ovise s druge strane; +""" + tokens = hr_tokenizer(text) + assert len(tokens) == 105 + + +@pytest.mark.xfail +def test_ordinal_number(hr_tokenizer): + text = "10. prosinca 1948" + tokens = hr_tokenizer(text) + assert len(tokens) == 3 diff --git a/TTS/Kokoro/.venv/Lib/site-packages/spacy/tests/lang/hr/test_tokenizer.py b/TTS/Kokoro/.venv/Lib/site-packages/spacy/tests/lang/hr/test_tokenizer.py new file mode 100644 index 0000000000000000000000000000000000000000..d0b375f48595f54c2a5ed3011d449a9a191668c6 --- /dev/null +++ b/TTS/Kokoro/.venv/Lib/site-packages/spacy/tests/lang/hr/test_tokenizer.py @@ -0,0 +1,31 @@ +import pytest + +HR_BASIC_TOKENIZATION_TESTS = [ + ( + "Nitko se ne smije podvrgnuti mučenju ni nečovječnom ili " + "ponižavajućem postupanju ili kazni.", + [ + "Nitko", + "se", + "ne", + "smije", + "podvrgnuti", + "mučenju", + "ni", + "nečovječnom", + "ili", + "ponižavajućem", + "postupanju", + "ili", + "kazni", + ".", + ], + ), +] + + +@pytest.mark.parametrize("text,expected_tokens", HR_BASIC_TOKENIZATION_TESTS) +def test_hr_tokenizer_basic(hr_tokenizer, text, expected_tokens): + tokens = hr_tokenizer(text) + token_list = [token.text for token in tokens if not token.is_space] + assert expected_tokens == token_list diff --git a/TTS/Kokoro/.venv/Lib/site-packages/spacy/tests/lang/hsb/__init__.py b/TTS/Kokoro/.venv/Lib/site-packages/spacy/tests/lang/hsb/__init__.py new file mode 100644 index 0000000000000000000000000000000000000000..e69de29bb2d1d6434b8b29ae775ad8c2e48c5391 diff --git a/TTS/Kokoro/.venv/Lib/site-packages/spacy/tests/lang/hsb/__pycache__/__init__.cpython-312.pyc b/TTS/Kokoro/.venv/Lib/site-packages/spacy/tests/lang/hsb/__pycache__/__init__.cpython-312.pyc new file mode 100644 index 0000000000000000000000000000000000000000..ed0a38d8c1a316f15d01c915513b7ccb0bca0849 Binary files /dev/null and b/TTS/Kokoro/.venv/Lib/site-packages/spacy/tests/lang/hsb/__pycache__/__init__.cpython-312.pyc differ diff --git a/TTS/Kokoro/.venv/Lib/site-packages/spacy/tests/lang/hsb/__pycache__/test_text.cpython-312.pyc b/TTS/Kokoro/.venv/Lib/site-packages/spacy/tests/lang/hsb/__pycache__/test_text.cpython-312.pyc new file mode 100644 index 0000000000000000000000000000000000000000..c5727727c6f18f79fd9a2e32f9de4cf91514f59d Binary files /dev/null and b/TTS/Kokoro/.venv/Lib/site-packages/spacy/tests/lang/hsb/__pycache__/test_text.cpython-312.pyc differ diff --git a/TTS/Kokoro/.venv/Lib/site-packages/spacy/tests/lang/hsb/__pycache__/test_tokenizer.cpython-312.pyc b/TTS/Kokoro/.venv/Lib/site-packages/spacy/tests/lang/hsb/__pycache__/test_tokenizer.cpython-312.pyc new file mode 100644 index 0000000000000000000000000000000000000000..bde0d8aa920a966d643c84425546b3e5e0284240 Binary files /dev/null and b/TTS/Kokoro/.venv/Lib/site-packages/spacy/tests/lang/hsb/__pycache__/test_tokenizer.cpython-312.pyc differ diff --git a/TTS/Kokoro/.venv/Lib/site-packages/spacy/tests/lang/hsb/test_text.py b/TTS/Kokoro/.venv/Lib/site-packages/spacy/tests/lang/hsb/test_text.py new file mode 100644 index 0000000000000000000000000000000000000000..c7efabfd58c5bbe88981a0a8c9fa595d697e6cf4 --- /dev/null +++ b/TTS/Kokoro/.venv/Lib/site-packages/spacy/tests/lang/hsb/test_text.py @@ -0,0 +1,25 @@ +import pytest + + +@pytest.mark.parametrize( + "text,match", + [ + ("10", True), + ("1", True), + ("10,000", True), + ("10,00", True), + ("jedne", True), + ("dwanaće", True), + ("milion", True), + ("sto", True), + ("załožene", False), + ("wona", False), + ("powšitkownej", False), + (",", False), + ("1/2", True), + ], +) +def test_lex_attrs_like_number(hsb_tokenizer, text, match): + tokens = hsb_tokenizer(text) + assert len(tokens) == 1 + assert tokens[0].like_num == match diff --git a/TTS/Kokoro/.venv/Lib/site-packages/spacy/tests/lang/hsb/test_tokenizer.py b/TTS/Kokoro/.venv/Lib/site-packages/spacy/tests/lang/hsb/test_tokenizer.py new file mode 100644 index 0000000000000000000000000000000000000000..71cafcdc0c6f507f9bd77ccf4f42b52af81319d4 --- /dev/null +++ b/TTS/Kokoro/.venv/Lib/site-packages/spacy/tests/lang/hsb/test_tokenizer.py @@ -0,0 +1,32 @@ +import pytest + +HSB_BASIC_TOKENIZATION_TESTS = [ + ( + "Hornjoserbšćina wobsteji resp. wobsteješe z wjacorych dialektow, kotrež so zdźěla chětro wot so rozeznawachu.", + [ + "Hornjoserbšćina", + "wobsteji", + "resp.", + "wobsteješe", + "z", + "wjacorych", + "dialektow", + ",", + "kotrež", + "so", + "zdźěla", + "chětro", + "wot", + "so", + "rozeznawachu", + ".", + ], + ), +] + + +@pytest.mark.parametrize("text,expected_tokens", HSB_BASIC_TOKENIZATION_TESTS) +def test_hsb_tokenizer_basic(hsb_tokenizer, text, expected_tokens): + tokens = hsb_tokenizer(text) + token_list = [token.text for token in tokens if not token.is_space] + assert expected_tokens == token_list diff --git a/TTS/Kokoro/.venv/Lib/site-packages/spacy/tests/lang/ht/__init__.py b/TTS/Kokoro/.venv/Lib/site-packages/spacy/tests/lang/ht/__init__.py new file mode 100644 index 0000000000000000000000000000000000000000..e69de29bb2d1d6434b8b29ae775ad8c2e48c5391 diff --git a/TTS/Kokoro/.venv/Lib/site-packages/spacy/tests/lang/ht/__pycache__/__init__.cpython-312.pyc b/TTS/Kokoro/.venv/Lib/site-packages/spacy/tests/lang/ht/__pycache__/__init__.cpython-312.pyc new file mode 100644 index 0000000000000000000000000000000000000000..70bdecf9c9657fe98ba51e786e860240584b9fd0 Binary files /dev/null and b/TTS/Kokoro/.venv/Lib/site-packages/spacy/tests/lang/ht/__pycache__/__init__.cpython-312.pyc differ diff --git a/TTS/Kokoro/.venv/Lib/site-packages/spacy/tests/lang/ht/__pycache__/test_exceptions.cpython-312.pyc b/TTS/Kokoro/.venv/Lib/site-packages/spacy/tests/lang/ht/__pycache__/test_exceptions.cpython-312.pyc new file mode 100644 index 0000000000000000000000000000000000000000..41c0bedac3a77f65bc21e43ab6cca39425e06cf2 Binary files /dev/null and b/TTS/Kokoro/.venv/Lib/site-packages/spacy/tests/lang/ht/__pycache__/test_exceptions.cpython-312.pyc differ diff --git a/TTS/Kokoro/.venv/Lib/site-packages/spacy/tests/lang/ht/__pycache__/test_noun_chunks.cpython-312.pyc b/TTS/Kokoro/.venv/Lib/site-packages/spacy/tests/lang/ht/__pycache__/test_noun_chunks.cpython-312.pyc new file mode 100644 index 0000000000000000000000000000000000000000..f40fd8418353214684c644be96a8ee5334fa245f Binary files /dev/null and b/TTS/Kokoro/.venv/Lib/site-packages/spacy/tests/lang/ht/__pycache__/test_noun_chunks.cpython-312.pyc differ diff --git a/TTS/Kokoro/.venv/Lib/site-packages/spacy/tests/lang/ht/__pycache__/test_prefix_suffix_infix.cpython-312.pyc b/TTS/Kokoro/.venv/Lib/site-packages/spacy/tests/lang/ht/__pycache__/test_prefix_suffix_infix.cpython-312.pyc new file mode 100644 index 0000000000000000000000000000000000000000..07fa05c8b9ba8502f40331db6f4a5b862e98a576 Binary files /dev/null and b/TTS/Kokoro/.venv/Lib/site-packages/spacy/tests/lang/ht/__pycache__/test_prefix_suffix_infix.cpython-312.pyc differ diff --git a/TTS/Kokoro/.venv/Lib/site-packages/spacy/tests/lang/ht/__pycache__/test_text.cpython-312.pyc b/TTS/Kokoro/.venv/Lib/site-packages/spacy/tests/lang/ht/__pycache__/test_text.cpython-312.pyc new file mode 100644 index 0000000000000000000000000000000000000000..0594dd90ede9bdd57635aeb671e724f5405d6a4c Binary files /dev/null and b/TTS/Kokoro/.venv/Lib/site-packages/spacy/tests/lang/ht/__pycache__/test_text.cpython-312.pyc differ diff --git a/TTS/Kokoro/.venv/Lib/site-packages/spacy/tests/lang/ht/test_exceptions.py b/TTS/Kokoro/.venv/Lib/site-packages/spacy/tests/lang/ht/test_exceptions.py new file mode 100644 index 0000000000000000000000000000000000000000..6aaebf08dd62e233be4f4ae438f41f4bd47c9674 --- /dev/null +++ b/TTS/Kokoro/.venv/Lib/site-packages/spacy/tests/lang/ht/test_exceptions.py @@ -0,0 +1,44 @@ +import pytest + + +def test_ht_tokenizer_handles_basic_contraction(ht_tokenizer): + text = "m'ap ri" + tokens = ht_tokenizer(text) + assert len(tokens) == 3 + assert tokens[0].text == "m'" + assert tokens[1].text == "ap" + assert tokens[2].text == "ri" + + text = "mwen di'w non!" + tokens = ht_tokenizer(text) + assert len(tokens) == 5 + assert tokens[0].text == "mwen" + assert tokens[1].text == "di" + assert tokens[2].text == "'w" + assert tokens[3].text == "non" + assert tokens[4].text == "!" + + +@pytest.mark.parametrize("text", ["Dr."]) +def test_ht_tokenizer_handles_basic_abbreviation(ht_tokenizer, text): + tokens = ht_tokenizer(text) + assert len(tokens) == 1 + assert tokens[0].text == text + + +def test_ht_tokenizer_full_sentence(ht_tokenizer): + text = "Si'm ka vini, m'ap pale ak li." + tokens = [t.text for t in ht_tokenizer(text)] + assert tokens == [ + "Si", + "'m", + "ka", + "vini", + ",", + "m'", + "ap", + "pale", + "ak", + "li", + ".", + ] diff --git a/TTS/Kokoro/.venv/Lib/site-packages/spacy/tests/lang/ht/test_noun_chunks.py b/TTS/Kokoro/.venv/Lib/site-packages/spacy/tests/lang/ht/test_noun_chunks.py new file mode 100644 index 0000000000000000000000000000000000000000..bdb2878eaad97a9d6a979ea7607adf65b702ae7d --- /dev/null +++ b/TTS/Kokoro/.venv/Lib/site-packages/spacy/tests/lang/ht/test_noun_chunks.py @@ -0,0 +1,45 @@ +import pytest + +from spacy.tokens import Doc + + +@pytest.fixture +def doc(ht_vocab): + words = ["Pitit", "gen", "gwo", "pwoblèm", "ak", "kontwòl"] + heads = [1, 1, 5, 5, 3, 3] + deps = ["nsubj", "ROOT", "amod", "obj", "case", "nmod"] + pos = ["NOUN", "VERB", "ADJ", "NOUN", "ADP", "NOUN"] + return Doc(ht_vocab, words=words, heads=heads, deps=deps, pos=pos) + + +def test_noun_chunks_is_parsed(ht_tokenizer): + """Test that noun_chunks raises Value Error for 'ht' language if Doc is not parsed.""" + doc = ht_tokenizer("Sa a se yon fraz") + with pytest.raises(ValueError): + list(doc.noun_chunks) + + +def test_ht_noun_chunks_not_nested(doc, ht_vocab): + """Test that each token only appears in one noun chunk at most""" + word_occurred = {} + chunks = list(doc.noun_chunks) + assert len(chunks) > 1 + for chunk in chunks: + for word in chunk: + word_occurred.setdefault(word.text, 0) + word_occurred[word.text] += 1 + assert len(word_occurred) > 0 + for word, freq in word_occurred.items(): + assert freq == 1, (word, [chunk.text for chunk in doc.noun_chunks]) + + +def test_noun_chunks_span(doc, ht_tokenizer): + """Test that the span.noun_chunks property works correctly""" + doc_chunks = list(doc.noun_chunks) + span = doc[0:3] + span_chunks = list(span.noun_chunks) + assert 0 < len(span_chunks) < len(doc_chunks) + for chunk in span_chunks: + assert chunk in doc_chunks + assert chunk.start >= 0 + assert chunk.end <= 3 diff --git a/TTS/Kokoro/.venv/Lib/site-packages/spacy/tests/lang/ht/test_prefix_suffix_infix.py b/TTS/Kokoro/.venv/Lib/site-packages/spacy/tests/lang/ht/test_prefix_suffix_infix.py new file mode 100644 index 0000000000000000000000000000000000000000..7703a5cec16c0f122817f040c970cd81881af7ad --- /dev/null +++ b/TTS/Kokoro/.venv/Lib/site-packages/spacy/tests/lang/ht/test_prefix_suffix_infix.py @@ -0,0 +1,132 @@ +import pytest + + +@pytest.mark.parametrize("text", ["(ka)"]) +def test_ht_tokenizer_splits_no_special(ht_tokenizer, text): + tokens = ht_tokenizer(text) + assert len(tokens) == 3 + + +@pytest.mark.parametrize("text", ["m'ap"]) +def test_ht_tokenizer_splits_no_punct(ht_tokenizer, text): + tokens = ht_tokenizer(text) + assert len(tokens) == 2 + + +@pytest.mark.parametrize("text", ["(m'ap"]) +def test_ht_tokenizer_splits_prefix_punct(ht_tokenizer, text): + tokens = ht_tokenizer(text) + assert len(tokens) == 3 + + +@pytest.mark.parametrize("text", ["m'ap)"]) +def test_ht_tokenizer_splits_suffix_punct(ht_tokenizer, text): + tokens = ht_tokenizer(text) + assert len(tokens) == 3 + + +@pytest.mark.parametrize("text", ["(m'ap)"]) +def test_ht_tokenizer_splits_even_wrap(ht_tokenizer, text): + tokens = ht_tokenizer(text) + assert len(tokens) == 4 + + +@pytest.mark.parametrize("text", ["(m'ap?)"]) +def test_ht_tokenizer_splits_uneven_wrap(ht_tokenizer, text): + tokens = ht_tokenizer(text) + assert len(tokens) == 5 + + +@pytest.mark.parametrize( + "text,length", [("Ozetazini.", 2), ("Frans.", 2), ("(Ozetazini.", 3)] +) +def test_ht_tokenizer_splits_prefix_interact(ht_tokenizer, text, length): + tokens = ht_tokenizer(text) + assert len(tokens) == length + + +@pytest.mark.parametrize("text", ["Ozetazini.)"]) +def test_ht_tokenizer_splits_suffix_interact(ht_tokenizer, text): + tokens = ht_tokenizer(text) + assert len(tokens) == 3 + + +@pytest.mark.parametrize("text", ["(Ozetazini.)"]) +def test_ht_tokenizer_splits_even_wrap_interact(ht_tokenizer, text): + tokens = ht_tokenizer(text) + assert len(tokens) == 4 + + +@pytest.mark.parametrize("text", ["(Ozetazini?)"]) +def test_ht_tokenizer_splits_uneven_wrap_interact(ht_tokenizer, text): + tokens = ht_tokenizer(text) + assert len(tokens) == 4 + + +@pytest.mark.parametrize("text", ["pi-bon"]) +def test_ht_tokenizer_splits_hyphens(ht_tokenizer, text): + tokens = ht_tokenizer(text) + assert len(tokens) == 3 + + +@pytest.mark.parametrize("text", ["0.1-13.5", "0.0-0.1", "103.27-300"]) +def test_ht_tokenizer_splits_numeric_range(ht_tokenizer, text): + tokens = ht_tokenizer(text) + assert len(tokens) == 3 + + +@pytest.mark.parametrize("text", ["pi.Bon", "Bon.Jour"]) +def test_ht_tokenizer_splits_period_infix(ht_tokenizer, text): + tokens = ht_tokenizer(text) + assert len(tokens) == 3 + + +@pytest.mark.parametrize("text", ["Bonjou,moun", "youn,de"]) +def test_ht_tokenizer_splits_comma_infix(ht_tokenizer, text): + tokens = ht_tokenizer(text) + assert len(tokens) == 3 + assert tokens[0].text == text.split(",")[0] + assert tokens[1].text == "," + assert tokens[2].text == text.split(",")[1] + + +@pytest.mark.parametrize("text", ["pi...Bon", "pi...bon"]) +def test_ht_tokenizer_splits_ellipsis_infix(ht_tokenizer, text): + tokens = ht_tokenizer(text) + assert len(tokens) == 3 + + +def test_ht_tokenizer_splits_double_hyphen_infix(ht_tokenizer): + tokens = ht_tokenizer("Pa vrè--men ou konnen--mwen renmen w.") + assert tokens[0].text == "Pa" + assert tokens[1].text == "vrè" + assert tokens[2].text == "--" + assert tokens[3].text == "men" + assert tokens[4].text == "ou" + assert tokens[5].text == "konnen" + assert tokens[6].text == "--" + assert tokens[7].text == "mwen" + assert tokens[8].text == "renmen" + assert tokens[9].text == "w" + assert tokens[10].text == "." + + +def test_ht_tokenizer_splits_period_abbr(ht_tokenizer): + text = "Jodi a se Madi.Mr." + tokens = ht_tokenizer(text) + assert len(tokens) == 7 + assert tokens[0].text == "Jodi" + assert tokens[1].text == "a" + assert tokens[2].text == "se" + assert tokens[3].text == "Madi" + assert tokens[4].text == "." + assert tokens[5].text == "Mr" + assert tokens[6].text == "." + + +def test_ht_tokenizer_splits_paren_period(ht_tokenizer): + tokens = ht_tokenizer("M ap teste sa (pou kounye a).") + words = [t.text for t in tokens] + assert "a" in words + assert ")" in words + assert "." in words diff --git a/TTS/Kokoro/.venv/Lib/site-packages/spacy/tests/lang/ht/test_text.py b/TTS/Kokoro/.venv/Lib/site-packages/spacy/tests/lang/ht/test_text.py new file mode 100644 index 0000000000000000000000000000000000000000..68228e73180898c2f1d0ad60e9368a40dc226c9d --- /dev/null +++ b/TTS/Kokoro/.venv/Lib/site-packages/spacy/tests/lang/ht/test_text.py @@ -0,0 +1,78 @@ +import pytest + +from spacy.lang.ht.lex_attrs import like_num, norm_custom + + +def test_ht_tokenizer_handles_long_text(ht_tokenizer): + text = """Onè ap fèt pou ansyen lidè Pati Travayè Britanik + +Moun atravè lemond ap voye onè pou ansyen lidè +Pati Travayè a, John Smith, ki mouri pi bonè jodi a apre li te fè yon gwo kriz kadyak a laj 55 an. + +Nan Washington, Depatman Deta Etazini pibliye yon deklarasyon ki eksprime "regre lanmò twò bonè" avoka ak palmantè eskoze a. + +"Misye Smith, pandan tout karyè li ki te make ak distenksyon""" + tokens = ht_tokenizer(text) + assert len(tokens) == 84 + + +@pytest.mark.parametrize( + "text,length", + [ + ("Map manje gato a pandan map gade televizyon lem lakay mwen.", 15), + ("M'ap vini, eske wap la avek lajan'm? Si oui, di'l non pou fre'w.", 22), + ("M ap teste sa (pou kounye a).", 10), + ], +) +def test_ht_tokenizer_handles_cnts(ht_tokenizer, text, length): + tokens = ht_tokenizer(text) + assert len(tokens) == length + + +@pytest.mark.parametrize( + "text,match", + [ + ("10", True), + ("1", True), + ("10,000", True), + ("10,00", True), + ("999.0", True), + ("en", True), + ("de", True), + ("milya", True), + ("dog", False), + (",", False), + ("1/2", True), + ], +) +def test_lex_attrs_like_number(ht_tokenizer, text, match): + tokens = ht_tokenizer(text) + assert len(tokens) == 1 + assert tokens[0].like_num == match + + +@pytest.mark.parametrize( + "word", ["ventyèm", "Milyonnyèm", "3yèm", "Santyèm", "25yèm", "52yèm"] +) +def test_ht_lex_attrs_like_number_for_ordinal(word): + assert like_num(word) + + +@pytest.mark.parametrize("word", ["onz"]) +def test_ht_lex_attrs_capitals(word): + assert like_num(word) + assert like_num(word.upper()) + + +@pytest.mark.parametrize( + "word, expected", + [ + ("'m", "mwen"), + ("'n", "nou"), + ("'l", "li"), + ("'y", "yo"), + ("'w", "ou"), + ], +) +def test_ht_lex_attrs_norm_custom(word, expected): + assert norm_custom(word) == expected diff --git a/TTS/Kokoro/.venv/Lib/site-packages/spacy/tests/lang/hu/__init__.py b/TTS/Kokoro/.venv/Lib/site-packages/spacy/tests/lang/hu/__init__.py new file mode 100644 index 0000000000000000000000000000000000000000..e69de29bb2d1d6434b8b29ae775ad8c2e48c5391 diff --git a/TTS/Kokoro/.venv/Lib/site-packages/spacy/tests/lang/hu/__pycache__/__init__.cpython-312.pyc b/TTS/Kokoro/.venv/Lib/site-packages/spacy/tests/lang/hu/__pycache__/__init__.cpython-312.pyc new file mode 100644 index 0000000000000000000000000000000000000000..eb2d56a4b3fa6c3b1d286dac93faab8e9a0a8348 Binary files /dev/null and b/TTS/Kokoro/.venv/Lib/site-packages/spacy/tests/lang/hu/__pycache__/__init__.cpython-312.pyc differ diff --git a/TTS/Kokoro/.venv/Lib/site-packages/spacy/tests/lang/hu/__pycache__/test_tokenizer.cpython-312.pyc b/TTS/Kokoro/.venv/Lib/site-packages/spacy/tests/lang/hu/__pycache__/test_tokenizer.cpython-312.pyc new file mode 100644 index 0000000000000000000000000000000000000000..08e618864f685c023b05ba5ae255d57ba8bbdf6b Binary files /dev/null and b/TTS/Kokoro/.venv/Lib/site-packages/spacy/tests/lang/hu/__pycache__/test_tokenizer.cpython-312.pyc differ diff --git a/TTS/Kokoro/.venv/Lib/site-packages/spacy/tests/lang/hu/test_tokenizer.py b/TTS/Kokoro/.venv/Lib/site-packages/spacy/tests/lang/hu/test_tokenizer.py new file mode 100644 index 0000000000000000000000000000000000000000..3406c05385818c574a98fc4ce0742e955d3bc0cd --- /dev/null +++ b/TTS/Kokoro/.venv/Lib/site-packages/spacy/tests/lang/hu/test_tokenizer.py @@ -0,0 +1,321 @@ +import pytest + +DEFAULT_TESTS = [ + ("N. kormányzósági\nszékhely.", ["N.", "kormányzósági", "székhely", "."]), + pytest.param( + "A .hu egy tld.", ["A", ".hu", "egy", "tld", "."], marks=pytest.mark.xfail() + ), + ("Az egy.ketto pelda.", ["Az", "egy.ketto", "pelda", "."]), + ("A pl. rovidites.", ["A", "pl.", "rovidites", "."]), + ("A S.M.A.R.T. szo.", ["A", "S.M.A.R.T.", "szo", "."]), + pytest.param("A .hu.", ["A", ".hu", "."], marks=pytest.mark.xfail()), + ("Az egy.ketto.", ["Az", "egy.ketto", "."]), + ("A pl.", ["A", "pl."]), + ("A S.M.A.R.T.", ["A", "S.M.A.R.T."]), + ("Egy..ket.", ["Egy", "..", "ket", "."]), + ("Valami... van.", ["Valami", "...", "van", "."]), + ("Valami ...van...", ["Valami", "...", "van", "..."]), + ("Valami...", ["Valami", "..."]), + ("Valami ...", ["Valami", "..."]), + ("Valami ... más.", ["Valami", "...", "más", "."]), + ("Soha nem lesz!", ["Soha", "nem", "lesz", "!"]), + ("Soha nem lesz?", ["Soha", "nem", "lesz", "?"]), +] + +HYPHEN_TESTS = [ + ( + "Egy -nak, -jaiért, -magyar, bel- van.", + ["Egy", "-nak", ",", "-jaiért", ",", "-magyar", ",", "bel-", "van", "."], + ), + ("Szabolcs-Szatmár-Bereg megye", ["Szabolcs-Szatmár-Bereg", "megye"]), + ("Egy -nak.", ["Egy", "-nak", "."]), + ("Egy bel-.", ["Egy", "bel-", "."]), + ("Dinnye-domb-.", ["Dinnye-domb-", "."]), + ("Ezen -e elcsatangolt.", ["Ezen", "-e", "elcsatangolt", "."]), + ("Lakik-e", ["Lakik", "-e"]), + ("A--B", ["A", "--", "B"]), + ("Lakik-e?", ["Lakik", "-e", "?"]), + ("Lakik-e.", ["Lakik", "-e", "."]), + ("Lakik-e...", ["Lakik", "-e", "..."]), + ("Lakik-e... van.", ["Lakik", "-e", "...", "van", "."]), + ("Lakik-e van?", ["Lakik", "-e", "van", "?"]), + ("Lakik-elem van?", ["Lakik-elem", "van", "?"]), + ("Az életbiztosításáról- egy.", ["Az", "életbiztosításáról-", "egy", "."]), + ("Van lakik-elem.", ["Van", "lakik-elem", "."]), + ("A 7-es busz?", ["A", "7-es", "busz", "?"]), + ("A 7-es?", ["A", "7-es", "?"]), + ("A 7-es.", ["A", "7-es", "."]), + ("Ez (lakik)-e?", ["Ez", "(", "lakik", ")", "-e", "?"]), + ("A %-sal.", ["A", "%-sal", "."]), + ("A $-sal.", ["A", "$-sal", "."]), + ("A CD-ROM-okrol.", ["A", "CD-ROM-okrol", "."]), +] + +NUMBER_TESTS = [ + ("A 2b van.", ["A", "2b", "van", "."]), + ("A 2b-ben van.", ["A", "2b-ben", "van", "."]), + ("A 2b.", ["A", "2b", "."]), + ("A 2b-ben.", ["A", "2b-ben", "."]), + ("A 3.b van.", ["A", "3.b", "van", "."]), + ("A 3.b-ben van.", ["A", "3.b-ben", "van", "."]), + ("A 3.b.", ["A", "3.b", "."]), + ("A 3.b-ben.", ["A", "3.b-ben", "."]), + ("A 1:20:36.7 van.", ["A", "1:20:36.7", "van", "."]), + ("A 1:20:36.7-ben van.", ["A", "1:20:36.7-ben", "van", "."]), + ("A 1:20:36.7-ben.", ["A", "1:20:36.7-ben", "."]), + ("A 1:35 van.", ["A", "1:35", "van", "."]), + ("A 1:35-ben van.", ["A", "1:35-ben", "van", "."]), + ("A 1:35-ben.", ["A", "1:35-ben", "."]), + ("A 1.35 van.", ["A", "1.35", "van", "."]), + ("A 1.35-ben van.", ["A", "1.35-ben", "van", "."]), + ("A 1.35-ben.", ["A", "1.35-ben", "."]), + ("A 4:01,95 van.", ["A", "4:01,95", "van", "."]), + ("A 4:01,95-ben van.", ["A", "4:01,95-ben", "van", "."]), + ("A 4:01,95-ben.", ["A", "4:01,95-ben", "."]), + ("A 10--12 van.", ["A", "10--12", "van", "."]), + ("A 10--12-ben van.", ["A", "10--12-ben", "van", "."]), + ("A 10--12-ben.", ["A", "10--12-ben", "."]), + ("A 10‐12 van.", ["A", "10‐12", "van", "."]), + ("A 10‐12-ben van.", ["A", "10‐12-ben", "van", "."]), + ("A 10‐12-ben.", ["A", "10‐12-ben", "."]), + ("A 10‑12 van.", ["A", "10‑12", "van", "."]), + ("A 10‑12-ben van.", ["A", "10‑12-ben", "van", "."]), + ("A 10‑12-ben.", ["A", "10‑12-ben", "."]), + ("A 10‒12 van.", ["A", "10‒12", "van", "."]), + ("A 10‒12-ben van.", ["A", "10‒12-ben", "van", "."]), + ("A 10‒12-ben.", ["A", "10‒12-ben", "."]), + ("A 10–12 van.", ["A", "10–12", "van", "."]), + ("A 10–12-ben van.", ["A", "10–12-ben", "van", "."]), + ("A 10–12-ben.", ["A", "10–12-ben", "."]), + ("A 10—12 van.", ["A", "10—12", "van", "."]), + ("A 10—12-ben van.", ["A", "10—12-ben", "van", "."]), + ("A 10—12-ben.", ["A", "10—12-ben", "."]), + ("A 10―12 van.", ["A", "10―12", "van", "."]), + ("A 10―12-ben van.", ["A", "10―12-ben", "van", "."]), + ("A 10―12-ben.", ["A", "10―12-ben", "."]), + ("A -23,12 van.", ["A", "-23,12", "van", "."]), + ("A -23,12-ben van.", ["A", "-23,12-ben", "van", "."]), + ("A -23,12-ben.", ["A", "-23,12-ben", "."]), + ("A 2+3 van.", ["A", "2+3", "van", "."]), + ("A 2<3 van.", ["A", "2<3", "van", "."]), + ("A 2=3 van.", ["A", "2=3", "van", "."]), + ("A 2÷3 van.", ["A", "2÷3", "van", "."]), + ("A 1=(2÷3)-2/5 van.", ["A", "1=(2÷3)-2/5", "van", "."]), + ("A 2 +3 van.", ["A", "2", "+3", "van", "."]), + ("A 2+ 3 van.", ["A", "2", "+", "3", "van", "."]), + ("A 2 + 3 van.", ["A", "2", "+", "3", "van", "."]), + ("A 2*3 van.", ["A", "2*3", "van", "."]), + ("A 2 *3 van.", ["A", "2", "*", "3", "van", "."]), + ("A 2* 3 van.", ["A", "2", "*", "3", "van", "."]), + ("A 2 * 3 van.", ["A", "2", "*", "3", "van", "."]), + ("A C++ van.", ["A", "C++", "van", "."]), + ("A C++-ben van.", ["A", "C++-ben", "van", "."]), + ("A C++.", ["A", "C++", "."]), + ("A C++-ben.", ["A", "C++-ben", "."]), + ("A 2003. I. 06. van.", ["A", "2003.", "I.", "06.", "van", "."]), + ("A 2003. I. 06-ben van.", ["A", "2003.", "I.", "06-ben", "van", "."]), + ("A 2003. I. 06.", ["A", "2003.", "I.", "06."]), + ("A 2003. I. 06-ben.", ["A", "2003.", "I.", "06-ben", "."]), + ("A 2003. 01. 06. van.", ["A", "2003.", "01.", "06.", "van", "."]), + ("A 2003. 01. 06-ben van.", ["A", "2003.", "01.", "06-ben", "van", "."]), + ("A 2003. 01. 06.", ["A", "2003.", "01.", "06."]), + ("A 2003. 01. 06-ben.", ["A", "2003.", "01.", "06-ben", "."]), + ("A IV. 12. van.", ["A", "IV.", "12.", "van", "."]), + ("A IV. 12-ben van.", ["A", "IV.", "12-ben", "van", "."]), + ("A IV. 12.", ["A", "IV.", "12."]), + ("A IV. 12-ben.", ["A", "IV.", "12-ben", "."]), + ("A 2003.01.06. van.", ["A", "2003.01.06.", "van", "."]), + ("A 2003.01.06-ben van.", ["A", "2003.01.06-ben", "van", "."]), + ("A 2003.01.06.", ["A", "2003.01.06."]), + ("A 2003.01.06-ben.", ["A", "2003.01.06-ben", "."]), + ("A IV.12. van.", ["A", "IV.12.", "van", "."]), + ("A IV.12-ben van.", ["A", "IV.12-ben", "van", "."]), + ("A IV.12.", ["A", "IV.12."]), + ("A IV.12-ben.", ["A", "IV.12-ben", "."]), + ("A 1.1.2. van.", ["A", "1.1.2.", "van", "."]), + ("A 1.1.2-ben van.", ["A", "1.1.2-ben", "van", "."]), + ("A 1.1.2.", ["A", "1.1.2."]), + ("A 1.1.2-ben.", ["A", "1.1.2-ben", "."]), + ("A 1,5--2,5 van.", ["A", "1,5--2,5", "van", "."]), + ("A 1,5--2,5-ben van.", ["A", "1,5--2,5-ben", "van", "."]), + ("A 1,5--2,5-ben.", ["A", "1,5--2,5-ben", "."]), + ("A 3,14 van.", ["A", "3,14", "van", "."]), + ("A 3,14-ben van.", ["A", "3,14-ben", "van", "."]), + ("A 3,14-ben.", ["A", "3,14-ben", "."]), + ("A 3.14 van.", ["A", "3.14", "van", "."]), + ("A 3.14-ben van.", ["A", "3.14-ben", "van", "."]), + ("A 3.14-ben.", ["A", "3.14-ben", "."]), + ("A 15. van.", ["A", "15.", "van", "."]), + ("A 15-ben van.", ["A", "15-ben", "van", "."]), + ("A 15-ben.", ["A", "15-ben", "."]), + ("A 15.-ben van.", ["A", "15.-ben", "van", "."]), + ("A 15.-ben.", ["A", "15.-ben", "."]), + ("A 2002--2003. van.", ["A", "2002--2003.", "van", "."]), + ("A 2002--2003-ben van.", ["A", "2002--2003-ben", "van", "."]), + ("A 2002-2003-ben.", ["A", "2002-2003-ben", "."]), + ("A +0,99% van.", ["A", "+0,99%", "van", "."]), + ("A -0,99% van.", ["A", "-0,99%", "van", "."]), + ("A -0,99%-ben van.", ["A", "-0,99%-ben", "van", "."]), + ("A -0,99%.", ["A", "-0,99%", "."]), + ("A -0,99%-ben.", ["A", "-0,99%-ben", "."]), + ("A 10--20% van.", ["A", "10--20%", "van", "."]), + ("A 10--20%-ben van.", ["A", "10--20%-ben", "van", "."]), + ("A 10--20%.", ["A", "10--20%", "."]), + ("A 10--20%-ben.", ["A", "10--20%-ben", "."]), + ("A 99§ van.", ["A", "99§", "van", "."]), + ("A 99§-ben van.", ["A", "99§-ben", "van", "."]), + ("A 99§-ben.", ["A", "99§-ben", "."]), + ("A 10--20§ van.", ["A", "10--20§", "van", "."]), + ("A 10--20§-ben van.", ["A", "10--20§-ben", "van", "."]), + ("A 10--20§-ben.", ["A", "10--20§-ben", "."]), + ("A 99° van.", ["A", "99°", "van", "."]), + ("A 99°-ben van.", ["A", "99°-ben", "van", "."]), + ("A 99°-ben.", ["A", "99°-ben", "."]), + ("A 10--20° van.", ["A", "10--20°", "van", "."]), + ("A 10--20°-ben van.", ["A", "10--20°-ben", "van", "."]), + ("A 10--20°-ben.", ["A", "10--20°-ben", "."]), + ("A °C van.", ["A", "°C", "van", "."]), + ("A °C-ben van.", ["A", "°C-ben", "van", "."]), + ("A °C.", ["A", "°C", "."]), + ("A °C-ben.", ["A", "°C-ben", "."]), + ("A 100°C van.", ["A", "100°C", "van", "."]), + ("A 100°C-ben van.", ["A", "100°C-ben", "van", "."]), + ("A 100°C.", ["A", "100°C", "."]), + ("A 100°C-ben.", ["A", "100°C-ben", "."]), + ("A 800x600 van.", ["A", "800x600", "van", "."]), + ("A 800x600-ben van.", ["A", "800x600-ben", "van", "."]), + ("A 800x600-ben.", ["A", "800x600-ben", "."]), + ("A 1x2x3x4 van.", ["A", "1x2x3x4", "van", "."]), + ("A 1x2x3x4-ben van.", ["A", "1x2x3x4-ben", "van", "."]), + ("A 1x2x3x4-ben.", ["A", "1x2x3x4-ben", "."]), + ("A 5/J van.", ["A", "5/J", "van", "."]), + ("A 5/J-ben van.", ["A", "5/J-ben", "van", "."]), + ("A 5/J-ben.", ["A", "5/J-ben", "."]), + ("A 5/J. van.", ["A", "5/J.", "van", "."]), + ("A 5/J.-ben van.", ["A", "5/J.-ben", "van", "."]), + ("A 5/J.-ben.", ["A", "5/J.-ben", "."]), + ("A III/1 van.", ["A", "III/1", "van", "."]), + ("A III/1-ben van.", ["A", "III/1-ben", "van", "."]), + ("A III/1-ben.", ["A", "III/1-ben", "."]), + ("A III/1. van.", ["A", "III/1.", "van", "."]), + ("A III/1.-ben van.", ["A", "III/1.-ben", "van", "."]), + ("A III/1.-ben.", ["A", "III/1.-ben", "."]), + ("A III/c van.", ["A", "III/c", "van", "."]), + ("A III/c-ben van.", ["A", "III/c-ben", "van", "."]), + ("A III/c.", ["A", "III/c", "."]), + ("A III/c-ben.", ["A", "III/c-ben", "."]), + ("A TU–154 van.", ["A", "TU–154", "van", "."]), + ("A TU–154-ben van.", ["A", "TU–154-ben", "van", "."]), + ("A TU–154-ben.", ["A", "TU–154-ben", "."]), + ("A 5cm³", ["A", "5", "cm³"]), + ("A 5 $-ban", ["A", "5", "$-ban"]), + ("A 5$-ban", ["A", "5$-ban"]), + ("A 5$.", ["A", "5", "$", "."]), + ("A 5$", ["A", "5", "$"]), + ("A $5", ["A", "$5"]), + ("A 5km/h", ["A", "5", "km/h"]), + ("A 75%+1-100%-ig", ["A", "75%+1-100%-ig"]), + ("A 5km/h.", ["A", "5", "km/h", "."]), + ("3434/1992. évi elszámolás", ["3434/1992.", "évi", "elszámolás"]), +] + +QUOTE_TESTS = [ + ( + 'Az "Ime, hat"-ban irja.', + ["Az", '"', "Ime", ",", "hat", '"', "-ban", "irja", "."], + ), + ('"Ime, hat"-ban irja.', ['"', "Ime", ",", "hat", '"', "-ban", "irja", "."]), + ('Az "Ime, hat".', ["Az", '"', "Ime", ",", "hat", '"', "."]), + ('Egy 24"-os monitor.', ["Egy", '24"-os', "monitor", "."]), + ("A McDonald's van.", ["A", "McDonald's", "van", "."]), +] + +DOT_TESTS = [ + ("N. kormányzósági\nszékhely.", ["N.", "kormányzósági", "székhely", "."]), + pytest.param( + "A .hu egy tld.", ["A", ".hu", "egy", "tld", "."], marks=pytest.mark.xfail() + ), + ("Az egy.ketto pelda.", ["Az", "egy.ketto", "pelda", "."]), + ("A pl. rövidítés.", ["A", "pl.", "rövidítés", "."]), + ("A S.M.A.R.T. szó.", ["A", "S.M.A.R.T.", "szó", "."]), + pytest.param("A .hu.", ["A", ".hu", "."], marks=pytest.mark.xfail()), + ("Az egy.ketto.", ["Az", "egy.ketto", "."]), + ("A pl.", ["A", "pl."]), + ("A S.M.A.R.T.", ["A", "S.M.A.R.T."]), + ("Egy..ket.", ["Egy", "..", "ket", "."]), + ("Valami... van.", ["Valami", "...", "van", "."]), + ("Valami ...van...", ["Valami", "...", "van", "..."]), + ("Valami...", ["Valami", "..."]), + ("Valami ...", ["Valami", "..."]), + ("Valami ... más.", ["Valami", "...", "más", "."]), +] + +TYPO_TESTS = [ + ( + "Ez egy mondat vége.Ez egy másik eleje.", + ["Ez", "egy", "mondat", "vége", ".", "Ez", "egy", "másik", "eleje", "."], + ), + ( + "Ez egy mondat vége .Ez egy másik eleje.", + ["Ez", "egy", "mondat", "vége", ".", "Ez", "egy", "másik", "eleje", "."], + ), + ( + "Ez egy mondat vége!ez egy másik eleje.", + ["Ez", "egy", "mondat", "vége", "!", "ez", "egy", "másik", "eleje", "."], + ), + ( + "Ez egy mondat vége !ez egy másik eleje.", + ["Ez", "egy", "mondat", "vége", "!", "ez", "egy", "másik", "eleje", "."], + ), + ( + "Ez egy mondat vége?Ez egy másik eleje.", + ["Ez", "egy", "mondat", "vége", "?", "Ez", "egy", "másik", "eleje", "."], + ), + ( + "Ez egy mondat vége ?Ez egy másik eleje.", + ["Ez", "egy", "mondat", "vége", "?", "Ez", "egy", "másik", "eleje", "."], + ), + ("egy,kettő", ["egy", ",", "kettő"]), + ("egy ,kettő", ["egy", ",", "kettő"]), + ("egy :kettő", ["egy", ":", "kettő"]), +] + +WIKI_TESTS = [ + ('!"', ["!", '"']), + ('lány"a', ["lány", '"', "a"]), + ('lány"a', ["lány", '"', "a"]), + ('!"-lel', ["!", '"', "-lel"]), + ('""-sorozat ', ['"', '"', "-sorozat"]), + ('"(Köszönöm', ['"', "(", "Köszönöm"]), + ("(törvénykönyv)-ben ", ["(", "törvénykönyv", ")", "-ben"]), + ('"(...)"–sokkal ', ['"', "(", "...", ")", '"', "–sokkal"]), + ("cérium(IV)-oxid", ["cérium", "(", "IV", ")", "-oxid"]), +] + +EXTRA_TESTS = ( + DOT_TESTS + QUOTE_TESTS + NUMBER_TESTS + HYPHEN_TESTS + WIKI_TESTS + TYPO_TESTS # type: ignore[operator] +) + +# normal: default tests + 10% of extra tests +TESTS = DEFAULT_TESTS +TESTS.extend([x for i, x in enumerate(EXTRA_TESTS) if i % 10 == 0]) + +# slow: remaining 90% of extra tests +SLOW_TESTS = [x for i, x in enumerate(EXTRA_TESTS) if i % 10 != 0] +TESTS.extend( + [ + ( + pytest.param(x[0], x[1], marks=pytest.mark.slow()) + if not isinstance(x[0], tuple) + else x + ) + for x in SLOW_TESTS + ] +) + + +@pytest.mark.parametrize("text,expected_tokens", TESTS) +def test_hu_tokenizer_handles_testcases(hu_tokenizer, text, expected_tokens): + tokens = hu_tokenizer(text) + token_list = [token.text for token in tokens if not token.is_space] + assert expected_tokens == token_list diff --git a/TTS/Kokoro/.venv/Lib/site-packages/spacy/tests/lang/hy/__init__.py b/TTS/Kokoro/.venv/Lib/site-packages/spacy/tests/lang/hy/__init__.py new file mode 100644 index 0000000000000000000000000000000000000000..e69de29bb2d1d6434b8b29ae775ad8c2e48c5391 diff --git a/TTS/Kokoro/.venv/Lib/site-packages/spacy/tests/lang/hy/__pycache__/__init__.cpython-312.pyc b/TTS/Kokoro/.venv/Lib/site-packages/spacy/tests/lang/hy/__pycache__/__init__.cpython-312.pyc new file mode 100644 index 0000000000000000000000000000000000000000..a0ed2f4a695637e87754c3ab0499d1e7420bbbbc Binary files /dev/null and b/TTS/Kokoro/.venv/Lib/site-packages/spacy/tests/lang/hy/__pycache__/__init__.cpython-312.pyc differ diff --git a/TTS/Kokoro/.venv/Lib/site-packages/spacy/tests/lang/hy/__pycache__/test_text.cpython-312.pyc b/TTS/Kokoro/.venv/Lib/site-packages/spacy/tests/lang/hy/__pycache__/test_text.cpython-312.pyc new file mode 100644 index 0000000000000000000000000000000000000000..1d3392ece427302f47fbe5f573297797d0edb1cc Binary files /dev/null and b/TTS/Kokoro/.venv/Lib/site-packages/spacy/tests/lang/hy/__pycache__/test_text.cpython-312.pyc differ diff --git a/TTS/Kokoro/.venv/Lib/site-packages/spacy/tests/lang/hy/__pycache__/test_tokenizer.cpython-312.pyc b/TTS/Kokoro/.venv/Lib/site-packages/spacy/tests/lang/hy/__pycache__/test_tokenizer.cpython-312.pyc new file mode 100644 index 0000000000000000000000000000000000000000..cd24fb0c42de0b313b53452323ec1c4c24c77ebb Binary files /dev/null and b/TTS/Kokoro/.venv/Lib/site-packages/spacy/tests/lang/hy/__pycache__/test_tokenizer.cpython-312.pyc differ diff --git a/TTS/Kokoro/.venv/Lib/site-packages/spacy/tests/lang/hy/test_text.py b/TTS/Kokoro/.venv/Lib/site-packages/spacy/tests/lang/hy/test_text.py new file mode 100644 index 0000000000000000000000000000000000000000..8831afb1ba2b0177d123a3d0198bd9a9b8836f95 --- /dev/null +++ b/TTS/Kokoro/.venv/Lib/site-packages/spacy/tests/lang/hy/test_text.py @@ -0,0 +1,9 @@ +import pytest + +from spacy.lang.hy.lex_attrs import like_num + + +@pytest.mark.parametrize("word", ["հիսուն"]) +def test_hy_lex_attrs_capitals(word): + assert like_num(word) + assert like_num(word.upper()) diff --git a/TTS/Kokoro/.venv/Lib/site-packages/spacy/tests/lang/hy/test_tokenizer.py b/TTS/Kokoro/.venv/Lib/site-packages/spacy/tests/lang/hy/test_tokenizer.py new file mode 100644 index 0000000000000000000000000000000000000000..baeeedef5cb8f3737bb452e3ff21181ea85f7a3c --- /dev/null +++ b/TTS/Kokoro/.venv/Lib/site-packages/spacy/tests/lang/hy/test_tokenizer.py @@ -0,0 +1,44 @@ +import pytest + +# TODO add test cases with valid punctuation signs. + +hy_tokenize_text_test = [ + ( + "Մետաղագիտությունը պայմանականորեն բաժանվում է տեսականի և կիրառականի (տեխնիկական)", + [ + "Մետաղագիտությունը", + "պայմանականորեն", + "բաժանվում", + "է", + "տեսականի", + "և", + "կիրառականի", + "(", + "տեխնիկական", + ")", + ], + ), + ( + "Գետաբերանը գտնվում է Օմոլոնա գետի ձախ ափից 726 կմ հեռավորության վրա", + [ + "Գետաբերանը", + "գտնվում", + "է", + "Օմոլոնա", + "գետի", + "ձախ", + "ափից", + "726", + "կմ", + "հեռավորության", + "վրա", + ], + ), +] + + +@pytest.mark.parametrize("text,expected_tokens", hy_tokenize_text_test) +def test_ga_tokenizer_handles_exception_cases(hy_tokenizer, text, expected_tokens): + tokens = hy_tokenizer(text) + token_list = [token.text for token in tokens if not token.is_space] + assert expected_tokens == token_list diff --git a/TTS/Kokoro/.venv/Lib/site-packages/spacy/tests/lang/id/__init__.py b/TTS/Kokoro/.venv/Lib/site-packages/spacy/tests/lang/id/__init__.py new file mode 100644 index 0000000000000000000000000000000000000000..e69de29bb2d1d6434b8b29ae775ad8c2e48c5391 diff --git a/TTS/Kokoro/.venv/Lib/site-packages/spacy/tests/lang/id/__pycache__/__init__.cpython-312.pyc b/TTS/Kokoro/.venv/Lib/site-packages/spacy/tests/lang/id/__pycache__/__init__.cpython-312.pyc new file mode 100644 index 0000000000000000000000000000000000000000..d5f5a1103fd5ab0e4f4d803b5f1a35c83cfe88a8 Binary files /dev/null and b/TTS/Kokoro/.venv/Lib/site-packages/spacy/tests/lang/id/__pycache__/__init__.cpython-312.pyc differ diff --git a/TTS/Kokoro/.venv/Lib/site-packages/spacy/tests/lang/id/__pycache__/test_noun_chunks.cpython-312.pyc b/TTS/Kokoro/.venv/Lib/site-packages/spacy/tests/lang/id/__pycache__/test_noun_chunks.cpython-312.pyc new file mode 100644 index 0000000000000000000000000000000000000000..8ac73fdb8de5abb910903c223302a8e607c585b0 Binary files /dev/null and b/TTS/Kokoro/.venv/Lib/site-packages/spacy/tests/lang/id/__pycache__/test_noun_chunks.cpython-312.pyc differ diff --git a/TTS/Kokoro/.venv/Lib/site-packages/spacy/tests/lang/id/__pycache__/test_prefix_suffix_infix.cpython-312.pyc b/TTS/Kokoro/.venv/Lib/site-packages/spacy/tests/lang/id/__pycache__/test_prefix_suffix_infix.cpython-312.pyc new file mode 100644 index 0000000000000000000000000000000000000000..7dfa0e9828b60c387356fdc9b221eebfb8df1189 Binary files /dev/null and b/TTS/Kokoro/.venv/Lib/site-packages/spacy/tests/lang/id/__pycache__/test_prefix_suffix_infix.cpython-312.pyc differ diff --git a/TTS/Kokoro/.venv/Lib/site-packages/spacy/tests/lang/id/__pycache__/test_text.cpython-312.pyc b/TTS/Kokoro/.venv/Lib/site-packages/spacy/tests/lang/id/__pycache__/test_text.cpython-312.pyc new file mode 100644 index 0000000000000000000000000000000000000000..8e8f486cc074f807b92f348e3a38e79242e2c406 Binary files /dev/null and b/TTS/Kokoro/.venv/Lib/site-packages/spacy/tests/lang/id/__pycache__/test_text.cpython-312.pyc differ diff --git a/TTS/Kokoro/.venv/Lib/site-packages/spacy/tests/lang/id/test_noun_chunks.py b/TTS/Kokoro/.venv/Lib/site-packages/spacy/tests/lang/id/test_noun_chunks.py new file mode 100644 index 0000000000000000000000000000000000000000..d48fe8777a64b9e14b88ae9747665c2108c4fad5 --- /dev/null +++ b/TTS/Kokoro/.venv/Lib/site-packages/spacy/tests/lang/id/test_noun_chunks.py @@ -0,0 +1,8 @@ +import pytest + + +def test_noun_chunks_is_parsed_id(id_tokenizer): + """Test that noun_chunks raises Value Error for 'id' language if Doc is not parsed.""" + doc = id_tokenizer("sebelas") + with pytest.raises(ValueError): + list(doc.noun_chunks) diff --git a/TTS/Kokoro/.venv/Lib/site-packages/spacy/tests/lang/id/test_prefix_suffix_infix.py b/TTS/Kokoro/.venv/Lib/site-packages/spacy/tests/lang/id/test_prefix_suffix_infix.py new file mode 100644 index 0000000000000000000000000000000000000000..372f30f687567b3159d649282fd1f22b1e931da7 --- /dev/null +++ b/TTS/Kokoro/.venv/Lib/site-packages/spacy/tests/lang/id/test_prefix_suffix_infix.py @@ -0,0 +1,111 @@ +import pytest + + +@pytest.mark.parametrize("text", ["(Ma'arif)"]) +def test_id_tokenizer_splits_no_special(id_tokenizer, text): + tokens = id_tokenizer(text) + assert len(tokens) == 3 + + +@pytest.mark.parametrize("text", ["Ma'arif"]) +def test_id_tokenizer_splits_no_punct(id_tokenizer, text): + tokens = id_tokenizer(text) + assert len(tokens) == 1 + + +@pytest.mark.parametrize("text", ["(Ma'arif"]) +def test_id_tokenizer_splits_prefix_punct(id_tokenizer, text): + tokens = id_tokenizer(text) + assert len(tokens) == 2 + + +@pytest.mark.parametrize("text", ["Ma'arif)"]) +def test_id_tokenizer_splits_suffix_punct(id_tokenizer, text): + tokens = id_tokenizer(text) + assert len(tokens) == 2 + + +@pytest.mark.parametrize("text", ["(Ma'arif)"]) +def test_id_tokenizer_splits_even_wrap(id_tokenizer, text): + tokens = id_tokenizer(text) + assert len(tokens) == 3 + + +@pytest.mark.parametrize("text", ["(Ma'arif?)"]) +def test_tokenizer_splits_uneven_wrap(id_tokenizer, text): + tokens = id_tokenizer(text) + assert len(tokens) == 4 + + +@pytest.mark.parametrize("text,length", [("S.Kom.", 1), ("SKom.", 2), ("(S.Kom.", 2)]) +def test_id_tokenizer_splits_prefix_interact(id_tokenizer, text, length): + tokens = id_tokenizer(text) + assert len(tokens) == length + + +@pytest.mark.parametrize("text", ["S.Kom.)"]) +def test_id_tokenizer_splits_suffix_interact(id_tokenizer, text): + tokens = id_tokenizer(text) + assert len(tokens) == 2 + + +@pytest.mark.parametrize("text", ["(S.Kom.)"]) +def test_id_tokenizer_splits_even_wrap_interact(id_tokenizer, text): + tokens = id_tokenizer(text) + assert len(tokens) == 3 + + +@pytest.mark.parametrize("text", ["(S.Kom.?)"]) +def test_id_tokenizer_splits_uneven_wrap_interact(id_tokenizer, text): + tokens = id_tokenizer(text) + assert len(tokens) == 4 + + +@pytest.mark.parametrize( + "text,length", [("gara-gara", 1), ("Jokowi-Ahok", 3), ("Sukarno-Hatta", 3)] +) +def test_id_tokenizer_splits_hyphens(id_tokenizer, text, length): + tokens = id_tokenizer(text) + assert len(tokens) == length + + +@pytest.mark.parametrize("text", ["0.1-13.5", "0.0-0.1", "103.27-300"]) +def test_id_tokenizer_splits_numeric_range(id_tokenizer, text): + tokens = id_tokenizer(text) + assert len(tokens) == 3 + + +@pytest.mark.parametrize("text", ["ini.Budi", "Halo.Bandung"]) +def test_id_tokenizer_splits_period_infix(id_tokenizer, text): + tokens = id_tokenizer(text) + assert len(tokens) == 3 + + +@pytest.mark.parametrize("text", ["Halo,Bandung", "satu,dua"]) +def test_id_tokenizer_splits_comma_infix(id_tokenizer, text): + tokens = id_tokenizer(text) + assert len(tokens) == 3 + assert tokens[0].text == text.split(",")[0] + assert tokens[1].text == "," + assert tokens[2].text == text.split(",")[1] + + +@pytest.mark.parametrize("text", ["halo...Bandung", "dia...pergi"]) +def test_id_tokenizer_splits_ellipsis_infix(id_tokenizer, text): + tokens = id_tokenizer(text) + assert len(tokens) == 3 + + +def test_id_tokenizer_splits_double_hyphen_infix(id_tokenizer): + tokens = id_tokenizer("Arsene Wenger--manajer Arsenal--melakukan konferensi pers.") + assert len(tokens) == 10 + assert tokens[0].text == "Arsene" + assert tokens[1].text == "Wenger" + assert tokens[2].text == "--" + assert tokens[3].text == "manajer" + assert tokens[4].text == "Arsenal" + assert tokens[5].text == "--" + assert tokens[6].text == "melakukan" + assert tokens[7].text == "konferensi" + assert tokens[8].text == "pers" + assert tokens[9].text == "." diff --git a/TTS/Kokoro/.venv/Lib/site-packages/spacy/tests/lang/id/test_text.py b/TTS/Kokoro/.venv/Lib/site-packages/spacy/tests/lang/id/test_text.py new file mode 100644 index 0000000000000000000000000000000000000000..cdc3adce21267bd7769b29b8de156d654c4a7a5a --- /dev/null +++ b/TTS/Kokoro/.venv/Lib/site-packages/spacy/tests/lang/id/test_text.py @@ -0,0 +1,9 @@ +import pytest + +from spacy.lang.id.lex_attrs import like_num + + +@pytest.mark.parametrize("word", ["sebelas"]) +def test_id_lex_attrs_capitals(word): + assert like_num(word) + assert like_num(word.upper()) diff --git a/TTS/Kokoro/.venv/Lib/site-packages/spacy/tests/lang/is/__init__.py b/TTS/Kokoro/.venv/Lib/site-packages/spacy/tests/lang/is/__init__.py new file mode 100644 index 0000000000000000000000000000000000000000..e69de29bb2d1d6434b8b29ae775ad8c2e48c5391 diff --git a/TTS/Kokoro/.venv/Lib/site-packages/spacy/tests/lang/is/__pycache__/__init__.cpython-312.pyc b/TTS/Kokoro/.venv/Lib/site-packages/spacy/tests/lang/is/__pycache__/__init__.cpython-312.pyc new file mode 100644 index 0000000000000000000000000000000000000000..4f3aa18587a67fc464b384d8740c6955bcc5ad8d Binary files /dev/null and b/TTS/Kokoro/.venv/Lib/site-packages/spacy/tests/lang/is/__pycache__/__init__.cpython-312.pyc differ diff --git a/TTS/Kokoro/.venv/Lib/site-packages/spacy/tests/lang/is/__pycache__/test_text.cpython-312.pyc b/TTS/Kokoro/.venv/Lib/site-packages/spacy/tests/lang/is/__pycache__/test_text.cpython-312.pyc new file mode 100644 index 0000000000000000000000000000000000000000..68054b0f3d1652cdc7a51ad4d14cb6f9eabda0d7 Binary files /dev/null and b/TTS/Kokoro/.venv/Lib/site-packages/spacy/tests/lang/is/__pycache__/test_text.cpython-312.pyc differ diff --git a/TTS/Kokoro/.venv/Lib/site-packages/spacy/tests/lang/is/__pycache__/test_tokenizer.cpython-312.pyc b/TTS/Kokoro/.venv/Lib/site-packages/spacy/tests/lang/is/__pycache__/test_tokenizer.cpython-312.pyc new file mode 100644 index 0000000000000000000000000000000000000000..dce0f25b312c84063ad120e7b02b53e6ac483bd3 Binary files /dev/null and b/TTS/Kokoro/.venv/Lib/site-packages/spacy/tests/lang/is/__pycache__/test_tokenizer.cpython-312.pyc differ diff --git a/TTS/Kokoro/.venv/Lib/site-packages/spacy/tests/lang/is/test_text.py b/TTS/Kokoro/.venv/Lib/site-packages/spacy/tests/lang/is/test_text.py new file mode 100644 index 0000000000000000000000000000000000000000..912116a62c40a0df51816aa6cebe39eeaaa4bea8 --- /dev/null +++ b/TTS/Kokoro/.venv/Lib/site-packages/spacy/tests/lang/is/test_text.py @@ -0,0 +1,26 @@ +import pytest + + +def test_long_text(is_tokenizer): + # Excerpt: European Convention on Human Rights + text = """ +hafa í huga, að yfirlýsing þessi hefur það markmið að tryggja +almenna og raunhæfa viðurkenningu og vernd þeirra réttinda, +sem þar er lýst; +hafa í huga, að markmið Evrópuráðs er að koma á nánari einingu +aðildarríkjanna og að ein af leiðunum að því marki er sú, að +mannréttindi og mannfrelsi séu í heiðri höfð og efld; +lýsa á ný eindreginni trú sinni á það mannfrelsi, sem er undirstaða +réttlætis og friðar í heiminum og best er tryggt, annars vegar með +virku, lýðræðislegu stjórnarfari og, hins vegar, almennum skilningi +og varðveislu þeirra mannréttinda, sem eru grundvöllur frelsisins; +""" + tokens = is_tokenizer(text) + assert len(tokens) == 120 + + +@pytest.mark.xfail +def test_ordinal_number(is_tokenizer): + text = "10. desember 1948" + tokens = is_tokenizer(text) + assert len(tokens) == 3 diff --git a/TTS/Kokoro/.venv/Lib/site-packages/spacy/tests/lang/is/test_tokenizer.py b/TTS/Kokoro/.venv/Lib/site-packages/spacy/tests/lang/is/test_tokenizer.py new file mode 100644 index 0000000000000000000000000000000000000000..208ab170b25e8baa46fdffc031ff2a8dcd198230 --- /dev/null +++ b/TTS/Kokoro/.venv/Lib/site-packages/spacy/tests/lang/is/test_tokenizer.py @@ -0,0 +1,30 @@ +import pytest + +IS_BASIC_TOKENIZATION_TESTS = [ + ( + "Enginn maður skal sæta pyndingum eða ómannlegri eða " + "vanvirðandi meðferð eða refsingu. ", + [ + "Enginn", + "maður", + "skal", + "sæta", + "pyndingum", + "eða", + "ómannlegri", + "eða", + "vanvirðandi", + "meðferð", + "eða", + "refsingu", + ".", + ], + ), +] + + +@pytest.mark.parametrize("text,expected_tokens", IS_BASIC_TOKENIZATION_TESTS) +def test_is_tokenizer_basic(is_tokenizer, text, expected_tokens): + tokens = is_tokenizer(text) + token_list = [token.text for token in tokens if not token.is_space] + assert expected_tokens == token_list diff --git a/TTS/Kokoro/.venv/Lib/site-packages/spacy/tests/lang/it/__init__.py b/TTS/Kokoro/.venv/Lib/site-packages/spacy/tests/lang/it/__init__.py new file mode 100644 index 0000000000000000000000000000000000000000..e69de29bb2d1d6434b8b29ae775ad8c2e48c5391 diff --git a/TTS/Kokoro/.venv/Lib/site-packages/spacy/tests/lang/it/__pycache__/__init__.cpython-312.pyc b/TTS/Kokoro/.venv/Lib/site-packages/spacy/tests/lang/it/__pycache__/__init__.cpython-312.pyc new file mode 100644 index 0000000000000000000000000000000000000000..869676ffdc010125e5cb217c2d3e7de4311a81e0 Binary files /dev/null and b/TTS/Kokoro/.venv/Lib/site-packages/spacy/tests/lang/it/__pycache__/__init__.cpython-312.pyc differ diff --git a/TTS/Kokoro/.venv/Lib/site-packages/spacy/tests/lang/it/__pycache__/test_noun_chunks.cpython-312.pyc b/TTS/Kokoro/.venv/Lib/site-packages/spacy/tests/lang/it/__pycache__/test_noun_chunks.cpython-312.pyc new file mode 100644 index 0000000000000000000000000000000000000000..13ac6087f7482b980e05609ad6d984e1206699e4 Binary files /dev/null and b/TTS/Kokoro/.venv/Lib/site-packages/spacy/tests/lang/it/__pycache__/test_noun_chunks.cpython-312.pyc differ diff --git a/TTS/Kokoro/.venv/Lib/site-packages/spacy/tests/lang/it/__pycache__/test_prefix_suffix_infix.cpython-312.pyc b/TTS/Kokoro/.venv/Lib/site-packages/spacy/tests/lang/it/__pycache__/test_prefix_suffix_infix.cpython-312.pyc new file mode 100644 index 0000000000000000000000000000000000000000..f941934a35d10ace6bc36330004b6e329fe18691 Binary files /dev/null and b/TTS/Kokoro/.venv/Lib/site-packages/spacy/tests/lang/it/__pycache__/test_prefix_suffix_infix.cpython-312.pyc differ diff --git a/TTS/Kokoro/.venv/Lib/site-packages/spacy/tests/lang/it/__pycache__/test_stopwords.cpython-312.pyc b/TTS/Kokoro/.venv/Lib/site-packages/spacy/tests/lang/it/__pycache__/test_stopwords.cpython-312.pyc new file mode 100644 index 0000000000000000000000000000000000000000..e5afac03bf1de03555961aece7abdb41f6e9c38d Binary files /dev/null and b/TTS/Kokoro/.venv/Lib/site-packages/spacy/tests/lang/it/__pycache__/test_stopwords.cpython-312.pyc differ diff --git a/TTS/Kokoro/.venv/Lib/site-packages/spacy/tests/lang/it/__pycache__/test_text.cpython-312.pyc b/TTS/Kokoro/.venv/Lib/site-packages/spacy/tests/lang/it/__pycache__/test_text.cpython-312.pyc new file mode 100644 index 0000000000000000000000000000000000000000..d4833f2a6393841da89abc294612159fe2fe48c7 Binary files /dev/null and b/TTS/Kokoro/.venv/Lib/site-packages/spacy/tests/lang/it/__pycache__/test_text.cpython-312.pyc differ diff --git a/TTS/Kokoro/.venv/Lib/site-packages/spacy/tests/lang/it/test_noun_chunks.py b/TTS/Kokoro/.venv/Lib/site-packages/spacy/tests/lang/it/test_noun_chunks.py new file mode 100644 index 0000000000000000000000000000000000000000..aeb6e62c63a20ae933ce2b12a319ed8d412467da --- /dev/null +++ b/TTS/Kokoro/.venv/Lib/site-packages/spacy/tests/lang/it/test_noun_chunks.py @@ -0,0 +1,222 @@ +import pytest + +from spacy.tokens import Doc + + +# fmt: off +@pytest.mark.parametrize( + "words,heads,deps,pos,chunk_offsets", + [ + # determiner + noun + # un pollo -> un pollo + ( + ["un", "pollo"], + [1, 1], + ["det", "ROOT"], + ["DET", "NOUN"], + [(0,2)], + ), + # two determiners + noun + # il mio cane -> il mio cane + ( + ["il", "mio", "cane"], + [2, 2, 2], + ["det", "det:poss", "ROOT"], + ["DET", "DET", "NOUN"], + [(0,3)], + ), + # two determiners, one is after noun. rare usage but still testing + # il cane mio-> il cane mio + ( + ["il", "cane", "mio"], + [1, 1, 1], + ["det", "ROOT", "det:poss"], + ["DET", "NOUN", "DET"], + [(0,3)], + ), + # relative pronoun + # È molto bello il vestito che hai acquistat -> il vestito, che the dress that you bought is very pretty. + ( + ["È", "molto", "bello", "il", "vestito", "che", "hai", "acquistato"], + [2, 2, 2, 4, 2, 7, 7, 4], + ['cop', 'advmod', 'ROOT', 'det', 'nsubj', 'obj', 'aux', 'acl:relcl'], + ['AUX', 'ADV', 'ADJ', 'DET', 'NOUN', 'PRON', 'AUX', 'VERB'], + [(3,5), (5,6)] + ), + # relative subclause + # il computer che hai comprato -> il computer, che the computer that you bought + ( + ['il', 'computer', 'che', 'hai', 'comprato'], + [1, 1, 4, 4, 1], + ['det', 'ROOT', 'nsubj', 'aux', 'acl:relcl'], + ['DET', 'NOUN', 'PRON', 'AUX', 'VERB'], + [(0,2), (2,3)] + ), + # det + noun + adj + # Una macchina grande -> Una macchina grande + ( + ["Una", "macchina", "grande"], + [1, 1, 1], + ["det", "ROOT", "amod"], + ["DET", "NOUN", "ADJ"], + [(0,3)], + ), + # noun + adj plural + # mucche bianche + ( + ["mucche", "bianche"], + [0, 0], + ["ROOT", "amod"], + ["NOUN", "ADJ"], + [(0,2)], + ), + # det + adj + noun + # Una grande macchina -> Una grande macchina + ( + ['Una', 'grande', 'macchina'], + [2, 2, 2], + ["det", "amod", "ROOT"], + ["DET", "ADJ", "NOUN"], + [(0,3)] + ), + # det + adj + noun, det with apostrophe + # un'importante associazione -> un'importante associazione + ( + ["Un'", 'importante', 'associazione'], + [2, 2, 2], + ["det", "amod", "ROOT"], + ["DET", "ADJ", "NOUN"], + [(0,3)] + ), + # multiple adjectives + # Un cane piccolo e marrone -> Un cane piccolo e marrone + ( + ["Un", "cane", "piccolo", "e", "marrone"], + [1, 1, 1, 4, 2], + ["det", "ROOT", "amod", "cc", "conj"], + ["DET", "NOUN", "ADJ", "CCONJ", "ADJ"], + [(0,5)] + ), + # determiner, adjective, compound created by flat + # le Nazioni Unite -> le Nazioni Unite + ( + ["le", "Nazioni", "Unite"], + [1, 1, 1], + ["det", "ROOT", "flat:name"], + ["DET", "PROPN", "PROPN"], + [(0,3)] + ), + # one determiner + one noun + one adjective qualified by an adverb + # alcuni contadini molto ricchi -> alcuni contadini molto ricchi some very rich farmers + ( + ['alcuni', 'contadini', 'molto', 'ricchi'], + [1, 1, 3, 1], + ['det', 'ROOT', 'advmod', 'amod'], + ['DET', 'NOUN', 'ADV', 'ADJ'], + [(0,4)] + ), + # Two NPs conjuncted + # Ho un cane e un gatto -> un cane, un gatto + ( + ['Ho', 'un', 'cane', 'e', 'un', 'gatto'], + [0, 2, 0, 5, 5, 0], + ['ROOT', 'det', 'obj', 'cc', 'det', 'conj'], + ['VERB', 'DET', 'NOUN', 'CCONJ', 'DET', 'NOUN'], + [(1,3), (4,6)] + + ), + # Two NPs together + # lo scrittore brasiliano Aníbal Machado -> lo scrittore brasiliano, Aníbal Machado + ( + ['lo', 'scrittore', 'brasiliano', 'Aníbal', 'Machado'], + [1, 1, 1, 1, 3], + ['det', 'ROOT', 'amod', 'nmod', 'flat:name'], + ['DET', 'NOUN', 'ADJ', 'PROPN', 'PROPN'], + [(0, 3), (3, 5)] + ), + # Noun compound, person name and titles + # Dom Pedro II -> Dom Pedro II + ( + ["Dom", "Pedro", "II"], + [0, 0, 0], + ["ROOT", "flat:name", "flat:name"], + ["PROPN", "PROPN", "PROPN"], + [(0,3)] + ), + # Noun compound created by flat + # gli Stati Uniti + ( + ["gli", "Stati", "Uniti"], + [1, 1, 1], + ["det", "ROOT", "flat:name"], + ["DET", "PROPN", "PROPN"], + [(0,3)] + ), + # nmod relation between NPs + # la distruzione della città -> la distruzione, città + ( + ['la', 'distruzione', 'della', 'città'], + [1, 1, 3, 1], + ['det', 'ROOT', 'case', 'nmod'], + ['DET', 'NOUN', 'ADP', 'NOUN'], + [(0,2), (3,4)] + ), + # Compounding by nmod, several NPs chained together + # la prima fabbrica di droga del governo -> la prima fabbrica, droga, governo + ( + ["la", "prima", "fabbrica", "di", "droga", "del", "governo"], + [2, 2, 2, 4, 2, 6, 2], + ['det', 'amod', 'ROOT', 'case', 'nmod', 'case', 'nmod'], + ['DET', 'ADJ', 'NOUN', 'ADP', 'NOUN', 'ADP', 'NOUN'], + [(0, 3), (4, 5), (6, 7)] + ), + # several NPs + # Traduzione del rapporto di Susana -> Traduzione, rapporto, Susana + ( + ['Traduzione', 'del', 'rapporto', 'di', 'Susana'], + [0, 2, 0, 4, 2], + ['ROOT', 'case', 'nmod', 'case', 'nmod'], + ['NOUN', 'ADP', 'NOUN', 'ADP', 'PROPN'], + [(0,1), (2,3), (4,5)] + + ), + # Several NPs + # Il gatto grasso di Susana e la sua amica -> Il gatto grasso, Susana, sua amica + ( + ['Il', 'gatto', 'grasso', 'di', 'Susana', 'e', 'la', 'sua', 'amica'], + [1, 1, 1, 4, 1, 8, 8, 8, 1], + ['det', 'ROOT', 'amod', 'case', 'nmod', 'cc', 'det', 'det:poss', 'conj'], + ['DET', 'NOUN', 'ADJ', 'ADP', 'PROPN', 'CCONJ', 'DET', 'DET', 'NOUN'], + [(0,3), (4,5), (6,9)] + ), + # Passive subject + # La nuova spesa è alimentata dal grande conto in banca di Clinton -> Le nuova spesa, grande conto, banca, Clinton + ( + ['La', 'nuova', 'spesa', 'è', 'alimentata', 'dal', 'grande', 'conto', 'in', 'banca', 'di', 'Clinton'], + [2, 2, 4, 4, 4, 7, 7, 4, 9, 7, 11, 9], + ['det', 'amod', 'nsubj:pass', 'aux:pass', 'ROOT', 'case', 'amod', 'obl:agent', 'case', 'nmod', 'case', 'nmod'], + ['DET', 'ADJ', 'NOUN', 'AUX', 'VERB', 'ADP', 'ADJ', 'NOUN', 'ADP', 'NOUN', 'ADP', 'PROPN'], + [(0, 3), (6, 8), (9, 10), (11,12)] + ), + # Misc + # Ma mentre questo prestito possa ora sembrare gestibile, un improvviso cambiamento delle circostanze potrebbe portare a problemi di debiti -> questo prestiti, un provisso cambiento, circostanze, problemi, debiti + ( + ['Ma', 'mentre', 'questo', 'prestito', 'possa', 'ora', 'sembrare', 'gestibile', ',', 'un', 'improvviso', 'cambiamento', 'delle', 'circostanze', 'potrebbe', 'portare', 'a', 'problemi', 'di', 'debitii'], + [15, 6, 3, 6, 6, 6, 15, 6, 6, 11, 11, 15, 13, 11, 15, 15, 17, 15, 19, 17], + ['cc', 'mark', 'det', 'nsubj', 'aux', 'advmod', 'advcl', 'xcomp', 'punct', 'det', 'amod', 'nsubj', 'case', 'nmod', 'aux', 'ROOT', 'case', 'obl', 'case', 'nmod'], + ['CCONJ', 'SCONJ', 'DET', 'NOUN', 'AUX', 'ADV', 'VERB', 'ADJ', 'PUNCT', 'DET', 'ADJ', 'NOUN', 'ADP', 'NOUN', 'AUX', 'VERB', 'ADP', 'NOUN', 'ADP', 'NOUN'], + [(2,4), (9,12), (13,14), (17,18), (19,20)] + ) + ], +) +# fmt: on +def test_it_noun_chunks(it_vocab, words, heads, deps, pos, chunk_offsets): + doc = Doc(it_vocab, words=words, heads=heads, deps=deps, pos=pos) + assert [(c.start, c.end) for c in doc.noun_chunks] == chunk_offsets + + +def test_noun_chunks_is_parsed_it(it_tokenizer): + """Test that noun_chunks raises Value Error for 'it' language if Doc is not parsed.""" + doc = it_tokenizer("Sei andato a Oxford") + with pytest.raises(ValueError): + list(doc.noun_chunks) diff --git a/TTS/Kokoro/.venv/Lib/site-packages/spacy/tests/lang/it/test_prefix_suffix_infix.py b/TTS/Kokoro/.venv/Lib/site-packages/spacy/tests/lang/it/test_prefix_suffix_infix.py new file mode 100644 index 0000000000000000000000000000000000000000..3c2d7e871102aa74e651d8382e65adf9f123a596 --- /dev/null +++ b/TTS/Kokoro/.venv/Lib/site-packages/spacy/tests/lang/it/test_prefix_suffix_infix.py @@ -0,0 +1,11 @@ +import pytest + + +@pytest.mark.parametrize( + "text,expected_tokens", [("c'è", ["c'", "è"]), ("l'ha", ["l'", "ha"])] +) +def test_contractions(it_tokenizer, text, expected_tokens): + """Test that the contractions are split into two tokens""" + tokens = it_tokenizer(text) + assert len(tokens) == 2 + assert [t.text for t in tokens] == expected_tokens diff --git a/TTS/Kokoro/.venv/Lib/site-packages/spacy/tests/lang/it/test_stopwords.py b/TTS/Kokoro/.venv/Lib/site-packages/spacy/tests/lang/it/test_stopwords.py new file mode 100644 index 0000000000000000000000000000000000000000..3709e7a6d56430c0426618fcd2f588a112bd89e8 --- /dev/null +++ b/TTS/Kokoro/.venv/Lib/site-packages/spacy/tests/lang/it/test_stopwords.py @@ -0,0 +1,17 @@ +import pytest + + +@pytest.mark.parametrize( + "word", ["un", "lo", "dell", "dall", "si", "ti", "mi", "quest", "quel", "quello"] +) +def test_stopwords_basic(it_tokenizer, word): + tok = it_tokenizer(word)[0] + assert tok.is_stop + + +@pytest.mark.parametrize( + "word", ["quest'uomo", "l'ho", "un'amica", "dell'olio", "s'arrende", "m'ascolti"] +) +def test_stopwords_elided(it_tokenizer, word): + tok = it_tokenizer(word)[0] + assert tok.is_stop diff --git a/TTS/Kokoro/.venv/Lib/site-packages/spacy/tests/lang/it/test_text.py b/TTS/Kokoro/.venv/Lib/site-packages/spacy/tests/lang/it/test_text.py new file mode 100644 index 0000000000000000000000000000000000000000..51f173113f322deac2ef21065a7c0e8513e98681 --- /dev/null +++ b/TTS/Kokoro/.venv/Lib/site-packages/spacy/tests/lang/it/test_text.py @@ -0,0 +1,14 @@ +import pytest + + +@pytest.mark.issue(2822) +def test_issue2822(it_tokenizer): + """Test that the abbreviation of poco is kept as one word.""" + doc = it_tokenizer("Vuoi un po' di zucchero?") + assert len(doc) == 6 + assert doc[0].text == "Vuoi" + assert doc[1].text == "un" + assert doc[2].text == "po'" + assert doc[3].text == "di" + assert doc[4].text == "zucchero" + assert doc[5].text == "?" diff --git a/TTS/Kokoro/.venv/Lib/site-packages/spacy/tests/lang/ja/__init__.py b/TTS/Kokoro/.venv/Lib/site-packages/spacy/tests/lang/ja/__init__.py new file mode 100644 index 0000000000000000000000000000000000000000..e69de29bb2d1d6434b8b29ae775ad8c2e48c5391 diff --git a/TTS/Kokoro/.venv/Lib/site-packages/spacy/tests/lang/ja/__pycache__/__init__.cpython-312.pyc b/TTS/Kokoro/.venv/Lib/site-packages/spacy/tests/lang/ja/__pycache__/__init__.cpython-312.pyc new file mode 100644 index 0000000000000000000000000000000000000000..9697dd4bb1b6e1542423223d041fced9308515b7 Binary files /dev/null and b/TTS/Kokoro/.venv/Lib/site-packages/spacy/tests/lang/ja/__pycache__/__init__.cpython-312.pyc differ diff --git a/TTS/Kokoro/.venv/Lib/site-packages/spacy/tests/lang/ja/__pycache__/test_lemmatization.cpython-312.pyc b/TTS/Kokoro/.venv/Lib/site-packages/spacy/tests/lang/ja/__pycache__/test_lemmatization.cpython-312.pyc new file mode 100644 index 0000000000000000000000000000000000000000..891caa36b554293b63d095e9d588bd0becf80ca5 Binary files /dev/null and b/TTS/Kokoro/.venv/Lib/site-packages/spacy/tests/lang/ja/__pycache__/test_lemmatization.cpython-312.pyc differ diff --git a/TTS/Kokoro/.venv/Lib/site-packages/spacy/tests/lang/ja/__pycache__/test_morphologizer_factory.cpython-312.pyc b/TTS/Kokoro/.venv/Lib/site-packages/spacy/tests/lang/ja/__pycache__/test_morphologizer_factory.cpython-312.pyc new file mode 100644 index 0000000000000000000000000000000000000000..b76f812d92c17c1c1958a6961a8c196713dc9277 Binary files /dev/null and b/TTS/Kokoro/.venv/Lib/site-packages/spacy/tests/lang/ja/__pycache__/test_morphologizer_factory.cpython-312.pyc differ diff --git a/TTS/Kokoro/.venv/Lib/site-packages/spacy/tests/lang/ja/__pycache__/test_serialize.cpython-312.pyc b/TTS/Kokoro/.venv/Lib/site-packages/spacy/tests/lang/ja/__pycache__/test_serialize.cpython-312.pyc new file mode 100644 index 0000000000000000000000000000000000000000..5d98135a2c9c06b2af309d2c6bb4c0a66355f963 Binary files /dev/null and b/TTS/Kokoro/.venv/Lib/site-packages/spacy/tests/lang/ja/__pycache__/test_serialize.cpython-312.pyc differ diff --git a/TTS/Kokoro/.venv/Lib/site-packages/spacy/tests/lang/ja/__pycache__/test_tokenizer.cpython-312.pyc b/TTS/Kokoro/.venv/Lib/site-packages/spacy/tests/lang/ja/__pycache__/test_tokenizer.cpython-312.pyc new file mode 100644 index 0000000000000000000000000000000000000000..a003bd1d698a8161137975402bfa6a6d1c3c9680 Binary files /dev/null and b/TTS/Kokoro/.venv/Lib/site-packages/spacy/tests/lang/ja/__pycache__/test_tokenizer.cpython-312.pyc differ diff --git a/TTS/Kokoro/.venv/Lib/site-packages/spacy/tests/lang/ja/test_lemmatization.py b/TTS/Kokoro/.venv/Lib/site-packages/spacy/tests/lang/ja/test_lemmatization.py new file mode 100644 index 0000000000000000000000000000000000000000..de502a250a75858fbc331c69c3b0f8cab75fdefe --- /dev/null +++ b/TTS/Kokoro/.venv/Lib/site-packages/spacy/tests/lang/ja/test_lemmatization.py @@ -0,0 +1,30 @@ +import pytest + + +@pytest.mark.parametrize( + "word,lemma", + [ + ("新しく", "新しい"), + ("赤く", "赤い"), + ("すごく", "すごい"), + ("いただきました", "いただく"), + ("なった", "なる"), + ], +) +def test_ja_lemmatizer_assigns(ja_tokenizer, word, lemma): + test_lemma = ja_tokenizer(word)[0].lemma_ + assert test_lemma == lemma + + +@pytest.mark.parametrize( + "word,norm", + [ + ("SUMMER", "サマー"), + ("食べ物", "食べ物"), + ("綜合", "総合"), + ("コンピュータ", "コンピューター"), + ], +) +def test_ja_lemmatizer_norm(ja_tokenizer, word, norm): + test_norm = ja_tokenizer(word)[0].norm_ + assert test_norm == norm diff --git a/TTS/Kokoro/.venv/Lib/site-packages/spacy/tests/lang/ja/test_morphologizer_factory.py b/TTS/Kokoro/.venv/Lib/site-packages/spacy/tests/lang/ja/test_morphologizer_factory.py new file mode 100644 index 0000000000000000000000000000000000000000..71bdedc5489b627911890ef2cb87517338d12ca7 --- /dev/null +++ b/TTS/Kokoro/.venv/Lib/site-packages/spacy/tests/lang/ja/test_morphologizer_factory.py @@ -0,0 +1,10 @@ +import pytest + +from spacy.lang.ja import Japanese + + +def test_ja_morphologizer_factory(): + pytest.importorskip("sudachipy") + nlp = Japanese() + morphologizer = nlp.add_pipe("morphologizer") + assert morphologizer.cfg["extend"] is True diff --git a/TTS/Kokoro/.venv/Lib/site-packages/spacy/tests/lang/ja/test_serialize.py b/TTS/Kokoro/.venv/Lib/site-packages/spacy/tests/lang/ja/test_serialize.py new file mode 100644 index 0000000000000000000000000000000000000000..3120392e84b583a496fdc69bf79269ba3ed67975 --- /dev/null +++ b/TTS/Kokoro/.venv/Lib/site-packages/spacy/tests/lang/ja/test_serialize.py @@ -0,0 +1,42 @@ +import pickle + +from spacy.lang.ja import Japanese + +from ...util import make_tempdir + + +def test_ja_tokenizer_serialize(ja_tokenizer): + tokenizer_bytes = ja_tokenizer.to_bytes() + nlp = Japanese() + nlp.tokenizer.from_bytes(tokenizer_bytes) + assert tokenizer_bytes == nlp.tokenizer.to_bytes() + assert nlp.tokenizer.split_mode is None + + with make_tempdir() as d: + file_path = d / "tokenizer" + ja_tokenizer.to_disk(file_path) + nlp = Japanese() + nlp.tokenizer.from_disk(file_path) + assert tokenizer_bytes == nlp.tokenizer.to_bytes() + assert nlp.tokenizer.split_mode is None + + # split mode is (de)serialized correctly + nlp = Japanese.from_config({"nlp": {"tokenizer": {"split_mode": "B"}}}) + nlp_r = Japanese() + nlp_bytes = nlp.to_bytes() + nlp_r.from_bytes(nlp_bytes) + assert nlp_bytes == nlp_r.to_bytes() + assert nlp_r.tokenizer.split_mode == "B" + + with make_tempdir() as d: + nlp.to_disk(d) + nlp_r = Japanese() + nlp_r.from_disk(d) + assert nlp_bytes == nlp_r.to_bytes() + assert nlp_r.tokenizer.split_mode == "B" + + +def test_ja_tokenizer_pickle(ja_tokenizer): + b = pickle.dumps(ja_tokenizer) + ja_tokenizer_re = pickle.loads(b) + assert ja_tokenizer.to_bytes() == ja_tokenizer_re.to_bytes() diff --git a/TTS/Kokoro/.venv/Lib/site-packages/spacy/tests/lang/ja/test_tokenizer.py b/TTS/Kokoro/.venv/Lib/site-packages/spacy/tests/lang/ja/test_tokenizer.py new file mode 100644 index 0000000000000000000000000000000000000000..e4f5a4de64491b9a350c9757e8d8560851abfe53 --- /dev/null +++ b/TTS/Kokoro/.venv/Lib/site-packages/spacy/tests/lang/ja/test_tokenizer.py @@ -0,0 +1,173 @@ +import pytest + +from spacy.lang.ja import DetailedToken, Japanese + +from ...tokenizer.test_naughty_strings import NAUGHTY_STRINGS + +# fmt: off +TOKENIZER_TESTS = [ + ("日本語だよ", ['日本', '語', 'だ', 'よ']), + ("東京タワーの近くに住んでいます。", ['東京', 'タワー', 'の', '近く', 'に', '住ん', 'で', 'い', 'ます', '。']), + ("吾輩は猫である。", ['吾輩', 'は', '猫', 'で', 'ある', '。']), + ("月に代わって、お仕置きよ!", ['月', 'に', '代わっ', 'て', '、', 'お', '仕置き', 'よ', '!']), + ("すもももももももものうち", ['すもも', 'も', 'もも', 'も', 'もも', 'の', 'うち']) +] + +TAG_TESTS = [ + ("日本語だよ", ['名詞-固有名詞-地名-国', '名詞-普通名詞-一般', '助動詞', '助詞-終助詞']), + ("東京タワーの近くに住んでいます。", ['名詞-固有名詞-地名-一般', '名詞-普通名詞-一般', '助詞-格助詞', '名詞-普通名詞-副詞可能', '助詞-格助詞', '動詞-一般', '助詞-接続助詞', '動詞-非自立可能', '助動詞', '補助記号-句点']), + ("吾輩は猫である。", ['代名詞', '助詞-係助詞', '名詞-普通名詞-一般', '助動詞', '動詞-非自立可能', '補助記号-句点']), + ("月に代わって、お仕置きよ!", ['名詞-普通名詞-助数詞可能', '助詞-格助詞', '動詞-一般', '助詞-接続助詞', '補助記号-読点', '接頭辞', '名詞-普通名詞-一般', '助詞-終助詞', '補助記号-句点']), + ("すもももももももものうち", ['名詞-普通名詞-一般', '助詞-係助詞', '名詞-普通名詞-一般', '助詞-係助詞', '名詞-普通名詞-一般', '助詞-格助詞', '名詞-普通名詞-副詞可能']) +] + +POS_TESTS = [ + ('日本語だよ', ['PROPN', 'NOUN', 'AUX', 'PART']), + ('東京タワーの近くに住んでいます。', ['PROPN', 'NOUN', 'ADP', 'NOUN', 'ADP', 'VERB', 'SCONJ', 'AUX', 'AUX', 'PUNCT']), + ('吾輩は猫である。', ['PRON', 'ADP', 'NOUN', 'AUX', 'AUX', 'PUNCT']), + ('月に代わって、お仕置きよ!', ['NOUN', 'ADP', 'VERB', 'SCONJ', 'PUNCT', 'NOUN', 'NOUN', 'PART', 'PUNCT']), + ('すもももももももものうち', ['NOUN', 'ADP', 'NOUN', 'ADP', 'NOUN', 'ADP', 'NOUN']) +] + +SENTENCE_TESTS = [ + ("あれ。これ。", ["あれ。", "これ。"]), + ("「伝染るんです。」という漫画があります。", ["「伝染るんです。」という漫画があります。"]), +] + +tokens1 = [ + DetailedToken(surface="委員", tag="名詞-普通名詞-一般", inf="", lemma="委員", norm="委員", reading="イイン", sub_tokens=None), + DetailedToken(surface="会", tag="名詞-普通名詞-一般", inf="", lemma="会", norm="会", reading="カイ", sub_tokens=None), +] +tokens2 = [ + DetailedToken(surface="選挙", tag="名詞-普通名詞-サ変可能", inf="", lemma="選挙", norm="選挙", reading="センキョ", sub_tokens=None), + DetailedToken(surface="管理", tag="名詞-普通名詞-サ変可能", inf="", lemma="管理", norm="管理", reading="カンリ", sub_tokens=None), + DetailedToken(surface="委員", tag="名詞-普通名詞-一般", inf="", lemma="委員", norm="委員", reading="イイン", sub_tokens=None), + DetailedToken(surface="会", tag="名詞-普通名詞-一般", inf="", lemma="会", norm="会", reading="カイ", sub_tokens=None), +] +tokens3 = [ + DetailedToken(surface="選挙", tag="名詞-普通名詞-サ変可能", inf="", lemma="選挙", norm="選挙", reading="センキョ", sub_tokens=None), + DetailedToken(surface="管理", tag="名詞-普通名詞-サ変可能", inf="", lemma="管理", norm="管理", reading="カンリ", sub_tokens=None), + DetailedToken(surface="委員会", tag="名詞-普通名詞-一般", inf="", lemma="委員会", norm="委員会", reading="イインカイ", sub_tokens=None), +] +SUB_TOKEN_TESTS = [ + ("選挙管理委員会", [None, None, [tokens1]], [[tokens2, tokens3]]) +] +# fmt: on + + +@pytest.mark.issue(2901) +def test_issue2901(): + """Test that `nlp` doesn't fail.""" + try: + nlp = Japanese() + except ImportError: + pytest.skip() + + doc = nlp("pythonが大好きです") + assert doc + + +@pytest.mark.parametrize("text,expected_tokens", TOKENIZER_TESTS) +def test_ja_tokenizer(ja_tokenizer, text, expected_tokens): + tokens = [token.text for token in ja_tokenizer(text)] + assert tokens == expected_tokens + + +@pytest.mark.parametrize("text,expected_tags", TAG_TESTS) +def test_ja_tokenizer_tags(ja_tokenizer, text, expected_tags): + tags = [token.tag_ for token in ja_tokenizer(text)] + assert tags == expected_tags + + +@pytest.mark.parametrize("text,expected_pos", POS_TESTS) +def test_ja_tokenizer_pos(ja_tokenizer, text, expected_pos): + pos = [token.pos_ for token in ja_tokenizer(text)] + assert pos == expected_pos + + +@pytest.mark.skip(reason="sentence segmentation in tokenizer is buggy") +@pytest.mark.parametrize("text,expected_sents", SENTENCE_TESTS) +def test_ja_tokenizer_sents(ja_tokenizer, text, expected_sents): + sents = [str(sent) for sent in ja_tokenizer(text).sents] + assert sents == expected_sents + + +def test_ja_tokenizer_extra_spaces(ja_tokenizer): + # note: three spaces after "I" + tokens = ja_tokenizer("I like cheese.") + assert tokens[1].orth_ == " " + + +@pytest.mark.parametrize("text", NAUGHTY_STRINGS) +def test_ja_tokenizer_naughty_strings(ja_tokenizer, text): + tokens = ja_tokenizer(text) + assert tokens.text_with_ws == text + + +@pytest.mark.parametrize( + "text,len_a,len_b,len_c", + [ + ("選挙管理委員会", 4, 3, 1), + ("客室乗務員", 3, 2, 1), + ("労働者協同組合", 4, 3, 1), + ("機能性食品", 3, 2, 1), + ], +) +def test_ja_tokenizer_split_modes(ja_tokenizer, text, len_a, len_b, len_c): + nlp_a = Japanese.from_config({"nlp": {"tokenizer": {"split_mode": "A"}}}) + nlp_b = Japanese.from_config({"nlp": {"tokenizer": {"split_mode": "B"}}}) + nlp_c = Japanese.from_config({"nlp": {"tokenizer": {"split_mode": "C"}}}) + + assert len(ja_tokenizer(text)) == len_a + assert len(nlp_a(text)) == len_a + assert len(nlp_b(text)) == len_b + assert len(nlp_c(text)) == len_c + + +@pytest.mark.parametrize("text,sub_tokens_list_b,sub_tokens_list_c", SUB_TOKEN_TESTS) +def test_ja_tokenizer_sub_tokens( + ja_tokenizer, text, sub_tokens_list_b, sub_tokens_list_c +): + nlp_a = Japanese.from_config({"nlp": {"tokenizer": {"split_mode": "A"}}}) + nlp_b = Japanese.from_config({"nlp": {"tokenizer": {"split_mode": "B"}}}) + nlp_c = Japanese.from_config({"nlp": {"tokenizer": {"split_mode": "C"}}}) + + assert ja_tokenizer(text).user_data.get("sub_tokens") is None + assert nlp_a(text).user_data.get("sub_tokens") is None + assert nlp_b(text).user_data["sub_tokens"] == sub_tokens_list_b + assert nlp_c(text).user_data["sub_tokens"] == sub_tokens_list_c + + +@pytest.mark.parametrize( + "text,inflections,reading_forms", + [ + ( + "取ってつけた", + ( + ["五段-ラ行;連用形-促音便"], + [], + ["下一段-カ行;連用形-一般"], + ["助動詞-タ;終止形-一般"], + ), + (["トッ"], ["テ"], ["ツケ"], ["タ"]), + ), + ("2=3", ([], [], []), (["ニ"], ["_"], ["サン"])), + ], +) +def test_ja_tokenizer_inflections_reading_forms( + ja_tokenizer, text, inflections, reading_forms +): + tokens = ja_tokenizer(text) + test_inflections = [tt.morph.get("Inflection") for tt in tokens] + assert test_inflections == list(inflections) + test_readings = [tt.morph.get("Reading") for tt in tokens] + assert test_readings == list(reading_forms) + + +def test_ja_tokenizer_emptyish_texts(ja_tokenizer): + doc = ja_tokenizer("") + assert len(doc) == 0 + doc = ja_tokenizer(" ") + assert len(doc) == 1 + doc = ja_tokenizer("\n\n\n \t\t \n\n\n") + assert len(doc) == 1 diff --git a/TTS/Kokoro/.venv/Lib/site-packages/spacy/tests/lang/kmr/__init__.py b/TTS/Kokoro/.venv/Lib/site-packages/spacy/tests/lang/kmr/__init__.py new file mode 100644 index 0000000000000000000000000000000000000000..e69de29bb2d1d6434b8b29ae775ad8c2e48c5391 diff --git a/TTS/Kokoro/.venv/Lib/site-packages/spacy/tests/lang/kmr/__pycache__/__init__.cpython-312.pyc b/TTS/Kokoro/.venv/Lib/site-packages/spacy/tests/lang/kmr/__pycache__/__init__.cpython-312.pyc new file mode 100644 index 0000000000000000000000000000000000000000..fbd43eef333638fa9d5c7c69a0da596a077a2b13 Binary files /dev/null and b/TTS/Kokoro/.venv/Lib/site-packages/spacy/tests/lang/kmr/__pycache__/__init__.cpython-312.pyc differ diff --git a/TTS/Kokoro/.venv/Lib/site-packages/spacy/tests/lang/kmr/__pycache__/test_text.cpython-312.pyc b/TTS/Kokoro/.venv/Lib/site-packages/spacy/tests/lang/kmr/__pycache__/test_text.cpython-312.pyc new file mode 100644 index 0000000000000000000000000000000000000000..0db917ab5008d4669b8a2d24c86cc186154aa3d1 Binary files /dev/null and b/TTS/Kokoro/.venv/Lib/site-packages/spacy/tests/lang/kmr/__pycache__/test_text.cpython-312.pyc differ diff --git a/TTS/Kokoro/.venv/Lib/site-packages/spacy/tests/lang/kmr/test_text.py b/TTS/Kokoro/.venv/Lib/site-packages/spacy/tests/lang/kmr/test_text.py new file mode 100644 index 0000000000000000000000000000000000000000..e341f49f81f4e59d2bd7d95bf32e1a83ee859211 --- /dev/null +++ b/TTS/Kokoro/.venv/Lib/site-packages/spacy/tests/lang/kmr/test_text.py @@ -0,0 +1,27 @@ +import pytest + +from spacy.lang.kmr.lex_attrs import like_num + + +@pytest.mark.parametrize( + "word", + [ + "yekem", + "duyemîn", + "100em", + "dehem", + "sedemîn", + "34em", + "30yem", + "20emîn", + "50yemîn", + ], +) +def test_kmr_lex_attrs_like_number_for_ordinal(word): + assert like_num(word) + + +@pytest.mark.parametrize("word", ["deh"]) +def test_kmr_lex_attrs_capitals(word): + assert like_num(word) + assert like_num(word.upper()) diff --git a/TTS/Kokoro/.venv/Lib/site-packages/spacy/tests/lang/ko/__init__.py b/TTS/Kokoro/.venv/Lib/site-packages/spacy/tests/lang/ko/__init__.py new file mode 100644 index 0000000000000000000000000000000000000000..e69de29bb2d1d6434b8b29ae775ad8c2e48c5391 diff --git a/TTS/Kokoro/.venv/Lib/site-packages/spacy/tests/lang/ko/__pycache__/__init__.cpython-312.pyc b/TTS/Kokoro/.venv/Lib/site-packages/spacy/tests/lang/ko/__pycache__/__init__.cpython-312.pyc new file mode 100644 index 0000000000000000000000000000000000000000..74f5a73f8dfe1b456abdbc231f98e0f3f251ec6f Binary files /dev/null and b/TTS/Kokoro/.venv/Lib/site-packages/spacy/tests/lang/ko/__pycache__/__init__.cpython-312.pyc differ diff --git a/TTS/Kokoro/.venv/Lib/site-packages/spacy/tests/lang/ko/__pycache__/test_lemmatization.cpython-312.pyc b/TTS/Kokoro/.venv/Lib/site-packages/spacy/tests/lang/ko/__pycache__/test_lemmatization.cpython-312.pyc new file mode 100644 index 0000000000000000000000000000000000000000..0be27e45543c1a1963a555051d2dbb04983ee169 Binary files /dev/null and b/TTS/Kokoro/.venv/Lib/site-packages/spacy/tests/lang/ko/__pycache__/test_lemmatization.cpython-312.pyc differ diff --git a/TTS/Kokoro/.venv/Lib/site-packages/spacy/tests/lang/ko/__pycache__/test_serialize.cpython-312.pyc b/TTS/Kokoro/.venv/Lib/site-packages/spacy/tests/lang/ko/__pycache__/test_serialize.cpython-312.pyc new file mode 100644 index 0000000000000000000000000000000000000000..653ddb9589bd9b6d31c2f4447e7b68d65348a2b6 Binary files /dev/null and b/TTS/Kokoro/.venv/Lib/site-packages/spacy/tests/lang/ko/__pycache__/test_serialize.cpython-312.pyc differ diff --git a/TTS/Kokoro/.venv/Lib/site-packages/spacy/tests/lang/ko/__pycache__/test_tokenizer.cpython-312.pyc b/TTS/Kokoro/.venv/Lib/site-packages/spacy/tests/lang/ko/__pycache__/test_tokenizer.cpython-312.pyc new file mode 100644 index 0000000000000000000000000000000000000000..ac7f3ec01439e019f3ea9bbc4396ff5fda91df2e Binary files /dev/null and b/TTS/Kokoro/.venv/Lib/site-packages/spacy/tests/lang/ko/__pycache__/test_tokenizer.cpython-312.pyc differ diff --git a/TTS/Kokoro/.venv/Lib/site-packages/spacy/tests/lang/ko/test_lemmatization.py b/TTS/Kokoro/.venv/Lib/site-packages/spacy/tests/lang/ko/test_lemmatization.py new file mode 100644 index 0000000000000000000000000000000000000000..708d1e7dfda28ffca0abe17648f5b1f8c6cc1c53 --- /dev/null +++ b/TTS/Kokoro/.venv/Lib/site-packages/spacy/tests/lang/ko/test_lemmatization.py @@ -0,0 +1,16 @@ +import pytest + + +@pytest.mark.parametrize( + "word,lemma", + [ + ("새로운", "새롭"), + ("빨간", "빨갛"), + ("클수록", "크"), + ("뭡니까", "뭣"), + ("됐다", "되"), + ], +) +def test_ko_lemmatizer_assigns(ko_tokenizer, word, lemma): + test_lemma = ko_tokenizer(word)[0].lemma_ + assert test_lemma == lemma diff --git a/TTS/Kokoro/.venv/Lib/site-packages/spacy/tests/lang/ko/test_serialize.py b/TTS/Kokoro/.venv/Lib/site-packages/spacy/tests/lang/ko/test_serialize.py new file mode 100644 index 0000000000000000000000000000000000000000..a56897f64df68c8b04e5cd55d2a9a7aca02cae59 --- /dev/null +++ b/TTS/Kokoro/.venv/Lib/site-packages/spacy/tests/lang/ko/test_serialize.py @@ -0,0 +1,25 @@ +import pickle + +from spacy.lang.ko import Korean + +from ...util import make_tempdir + + +def test_ko_tokenizer_serialize(ko_tokenizer): + tokenizer_bytes = ko_tokenizer.to_bytes() + nlp = Korean() + nlp.tokenizer.from_bytes(tokenizer_bytes) + assert tokenizer_bytes == nlp.tokenizer.to_bytes() + + with make_tempdir() as d: + file_path = d / "tokenizer" + ko_tokenizer.to_disk(file_path) + nlp = Korean() + nlp.tokenizer.from_disk(file_path) + assert tokenizer_bytes == nlp.tokenizer.to_bytes() + + +def test_ko_tokenizer_pickle(ko_tokenizer): + b = pickle.dumps(ko_tokenizer) + ko_tokenizer_re = pickle.loads(b) + assert ko_tokenizer.to_bytes() == ko_tokenizer_re.to_bytes() diff --git a/TTS/Kokoro/.venv/Lib/site-packages/spacy/tests/lang/ko/test_tokenizer.py b/TTS/Kokoro/.venv/Lib/site-packages/spacy/tests/lang/ko/test_tokenizer.py new file mode 100644 index 0000000000000000000000000000000000000000..8059987513b48902c988ef14ae71221305035822 --- /dev/null +++ b/TTS/Kokoro/.venv/Lib/site-packages/spacy/tests/lang/ko/test_tokenizer.py @@ -0,0 +1,75 @@ +import pytest + +# fmt: off +TOKENIZER_TESTS = [("서울 타워 근처에 살고 있습니다.", "서울 타워 근처 에 살 고 있 습니다 ."), + ("영등포구에 있는 맛집 좀 알려주세요.", "영등포구 에 있 는 맛집 좀 알려 주 세요 ."), + ("10$ 할인코드를 적용할까요?", "10 $ 할인 코드 를 적용 할까요 ?")] + +TAG_TESTS = [("서울 타워 근처에 살고 있습니다.", + "NNP NNG NNG JKB VV EC VX EF SF"), + ("영등포구에 있는 맛집 좀 알려주세요.", + "NNP JKB VV ETM NNG MAG VV VX EP SF")] + +FULL_TAG_TESTS = [("영등포구에 있는 맛집 좀 알려주세요.", + "NNP JKB VV ETM NNG MAG VV+EC VX EP+EF SF")] + +POS_TESTS = [("서울 타워 근처에 살고 있습니다.", + "PROPN NOUN NOUN ADP VERB X AUX X PUNCT"), + ("영등포구에 있는 맛집 좀 알려주세요.", + "PROPN ADP VERB X NOUN ADV VERB AUX X PUNCT")] +# fmt: on + + +@pytest.mark.parametrize("text,expected_tokens", TOKENIZER_TESTS) +def test_ko_tokenizer(ko_tokenizer, text, expected_tokens): + tokens = [token.text for token in ko_tokenizer(text)] + assert tokens == expected_tokens.split() + + +@pytest.mark.parametrize("text,expected_tags", TAG_TESTS) +def test_ko_tokenizer_tags(ko_tokenizer, text, expected_tags): + tags = [token.tag_ for token in ko_tokenizer(text)] + assert tags == expected_tags.split() + + +@pytest.mark.parametrize("text,expected_tags", FULL_TAG_TESTS) +def test_ko_tokenizer_full_tags(ko_tokenizer, text, expected_tags): + tags = ko_tokenizer(text).user_data["full_tags"] + assert tags == expected_tags.split() + + +@pytest.mark.parametrize("text,expected_pos", POS_TESTS) +def test_ko_tokenizer_pos(ko_tokenizer, text, expected_pos): + pos = [token.pos_ for token in ko_tokenizer(text)] + assert pos == expected_pos.split() + + +def test_ko_empty_doc(ko_tokenizer): + tokens = ko_tokenizer("") + assert len(tokens) == 0 + + +@pytest.mark.issue(10535) +def test_ko_tokenizer_unknown_tag(ko_tokenizer): + tokens = ko_tokenizer("미닛 리피터") + assert tokens[1].pos_ == "X" + + +# fmt: off +SPACY_TOKENIZER_TESTS = [ + ("있다.", "있다 ."), + ("'예'는", "' 예 ' 는"), + ("부 (富) 는", "부 ( 富 ) 는"), + ("부(富)는", "부 ( 富 ) 는"), + ("1982~1983.", "1982 ~ 1983 ."), + ("사과·배·복숭아·수박은 모두 과일이다.", "사과 · 배 · 복숭아 · 수박은 모두 과일이다 ."), + ("그렇구나~", "그렇구나~"), + ("『9시 반의 당구』,", "『 9시 반의 당구 』 ,"), +] +# fmt: on + + +@pytest.mark.parametrize("text,expected_tokens", SPACY_TOKENIZER_TESTS) +def test_ko_spacy_tokenizer(ko_tokenizer_tokenizer, text, expected_tokens): + tokens = [token.text for token in ko_tokenizer_tokenizer(text)] + assert tokens == expected_tokens.split() diff --git a/TTS/Kokoro/.venv/Lib/site-packages/spacy/tests/lang/ky/__init__.py b/TTS/Kokoro/.venv/Lib/site-packages/spacy/tests/lang/ky/__init__.py new file mode 100644 index 0000000000000000000000000000000000000000..e69de29bb2d1d6434b8b29ae775ad8c2e48c5391 diff --git a/TTS/Kokoro/.venv/Lib/site-packages/spacy/tests/lang/ky/__pycache__/__init__.cpython-312.pyc b/TTS/Kokoro/.venv/Lib/site-packages/spacy/tests/lang/ky/__pycache__/__init__.cpython-312.pyc new file mode 100644 index 0000000000000000000000000000000000000000..1c5d868886169e2fbf469aadf8bebe99a4703732 Binary files /dev/null and b/TTS/Kokoro/.venv/Lib/site-packages/spacy/tests/lang/ky/__pycache__/__init__.cpython-312.pyc differ diff --git a/TTS/Kokoro/.venv/Lib/site-packages/spacy/tests/lang/ky/__pycache__/test_tokenizer.cpython-312.pyc b/TTS/Kokoro/.venv/Lib/site-packages/spacy/tests/lang/ky/__pycache__/test_tokenizer.cpython-312.pyc new file mode 100644 index 0000000000000000000000000000000000000000..44b984612191bc30c7e8209708cc9ce91f5e7fb0 Binary files /dev/null and b/TTS/Kokoro/.venv/Lib/site-packages/spacy/tests/lang/ky/__pycache__/test_tokenizer.cpython-312.pyc differ diff --git a/TTS/Kokoro/.venv/Lib/site-packages/spacy/tests/lang/ky/test_tokenizer.py b/TTS/Kokoro/.venv/Lib/site-packages/spacy/tests/lang/ky/test_tokenizer.py new file mode 100644 index 0000000000000000000000000000000000000000..1ee668f7588e60cf554252d265f167dce65ff5f5 --- /dev/null +++ b/TTS/Kokoro/.venv/Lib/site-packages/spacy/tests/lang/ky/test_tokenizer.py @@ -0,0 +1,85 @@ +import pytest + +INFIX_HYPHEN_TESTS = [ + ("Бала-чака жакшыбы?", "Бала-чака жакшыбы ?".split()), + ("Кыз-келиндер кийими.", "Кыз-келиндер кийими .".split()), +] + +PUNC_INSIDE_WORDS_TESTS = [ + ( + "Пассажир саны - 2,13 млн — киши/күнүнө (2010), 783,9 млн. киши/жылына.", + "Пассажир саны - 2,13 млн — киши / күнүнө ( 2010 ) ," + " 783,9 млн. киши / жылына .".split(), + ), + ('То"кой', 'То " кой'.split()), +] + +MIXED_ORDINAL_NUMS_TESTS = [("Эртең 22-январь...", "Эртең 22 - январь ...".split())] + +ABBREV_TESTS = [ + ("Маселе б-ча эртең келет", "Маселе б-ча эртең келет".split()), + ("Ахунбаев көч. турат.", "Ахунбаев көч. турат .".split()), + ("«3-жылы (б.з.ч.) туулган", "« 3 - жылы ( б.з.ч. ) туулган".split()), + ("Жүгөрү ж.б. дандар колдонулат", "Жүгөрү ж.б. дандар колдонулат".split()), + ("3-4 кк. курулган.", "3 - 4 кк. курулган .".split()), +] + +NAME_ABBREV_TESTS = [ + ("М.Жумаш", "М.Жумаш".split()), + ("М.жумаш", "М.жумаш".split()), + ("м.Жумаш", "м . Жумаш".split()), + ("Жумаш М.Н.", "Жумаш М.Н.".split()), + ("Жумаш.", "Жумаш .".split()), +] + +TYPOS_IN_PUNC_TESTS = [ + ("«3-жылда , туулган", "« 3 - жылда , туулган".split()), + ("«3-жылда,туулган", "« 3 - жылда , туулган".split()), + ("«3-жылда,туулган.", "« 3 - жылда , туулган .".split()), + ("Ал иштейт(качан?)", "Ал иштейт ( качан ? )".split()), + ("Ал (качан?)иштейт", "Ал ( качан ?) иштейт".split()), # "?)" => "?)" or "? )" +] + +LONG_TEXTS_TESTS = [ + ( + "Алыскы өлкөлөргө аздыр-көптүр татаалыраак жүрүштөргө чыккандар " + "азыраак: ал бир топ кымбат жана логистика маселесинин айынан " + "кыйла татаал. Мисалы, январдагы майрамдарда Мароккого үчүнчү " + "категориядагы маршрутка (100 чакырымдан кем эмес) барып " + "келгенге аракет кылдык.", + "Алыскы өлкөлөргө аздыр-көптүр татаалыраак жүрүштөргө чыккандар " + "азыраак : ал бир топ кымбат жана логистика маселесинин айынан " + "кыйла татаал . Мисалы , январдагы майрамдарда Мароккого үчүнчү " + "категориядагы маршрутка ( 100 чакырымдан кем эмес ) барып " + "келгенге аракет кылдык .".split(), + ) +] + +TESTCASES = ( + INFIX_HYPHEN_TESTS + + PUNC_INSIDE_WORDS_TESTS + + MIXED_ORDINAL_NUMS_TESTS + + ABBREV_TESTS + + NAME_ABBREV_TESTS + + LONG_TEXTS_TESTS + + TYPOS_IN_PUNC_TESTS +) + +NORM_TESTCASES = [ + ( + "ит, мышык ж.б.у.с. үй жаныбарлары.", + ["ит", ",", "мышык", "жана башка ушул сыяктуу", "үй", "жаныбарлары", "."], + ) +] + + +@pytest.mark.parametrize("text,expected_tokens", TESTCASES) +def test_ky_tokenizer_handles_testcases(ky_tokenizer, text, expected_tokens): + tokens = [token.text for token in ky_tokenizer(text) if not token.is_space] + assert expected_tokens == tokens + + +@pytest.mark.parametrize("text,norms", NORM_TESTCASES) +def test_ky_tokenizer_handles_norm_exceptions(ky_tokenizer, text, norms): + tokens = ky_tokenizer(text) + assert [token.norm_ for token in tokens] == norms diff --git a/TTS/Kokoro/.venv/Lib/site-packages/spacy/tests/lang/la/__init__.py b/TTS/Kokoro/.venv/Lib/site-packages/spacy/tests/lang/la/__init__.py new file mode 100644 index 0000000000000000000000000000000000000000..e69de29bb2d1d6434b8b29ae775ad8c2e48c5391 diff --git a/TTS/Kokoro/.venv/Lib/site-packages/spacy/tests/lang/la/__pycache__/__init__.cpython-312.pyc b/TTS/Kokoro/.venv/Lib/site-packages/spacy/tests/lang/la/__pycache__/__init__.cpython-312.pyc new file mode 100644 index 0000000000000000000000000000000000000000..89f1ebbbc053c01cfbf4091a318fa5d27c21a9f2 Binary files /dev/null and b/TTS/Kokoro/.venv/Lib/site-packages/spacy/tests/lang/la/__pycache__/__init__.cpython-312.pyc differ diff --git a/TTS/Kokoro/.venv/Lib/site-packages/spacy/tests/lang/la/__pycache__/test_exception.cpython-312.pyc b/TTS/Kokoro/.venv/Lib/site-packages/spacy/tests/lang/la/__pycache__/test_exception.cpython-312.pyc new file mode 100644 index 0000000000000000000000000000000000000000..758be1eac2be4b744137171af13f152ab249cd6e Binary files /dev/null and b/TTS/Kokoro/.venv/Lib/site-packages/spacy/tests/lang/la/__pycache__/test_exception.cpython-312.pyc differ diff --git a/TTS/Kokoro/.venv/Lib/site-packages/spacy/tests/lang/la/__pycache__/test_noun_chunks.cpython-312.pyc b/TTS/Kokoro/.venv/Lib/site-packages/spacy/tests/lang/la/__pycache__/test_noun_chunks.cpython-312.pyc new file mode 100644 index 0000000000000000000000000000000000000000..cfaa3f6cd7b0cd01f00cb2bdadcd9ed388f76136 Binary files /dev/null and b/TTS/Kokoro/.venv/Lib/site-packages/spacy/tests/lang/la/__pycache__/test_noun_chunks.cpython-312.pyc differ diff --git a/TTS/Kokoro/.venv/Lib/site-packages/spacy/tests/lang/la/__pycache__/test_text.cpython-312.pyc b/TTS/Kokoro/.venv/Lib/site-packages/spacy/tests/lang/la/__pycache__/test_text.cpython-312.pyc new file mode 100644 index 0000000000000000000000000000000000000000..29a57f9e04b27bf53b8ce3c7b09399c7aec68116 Binary files /dev/null and b/TTS/Kokoro/.venv/Lib/site-packages/spacy/tests/lang/la/__pycache__/test_text.cpython-312.pyc differ diff --git a/TTS/Kokoro/.venv/Lib/site-packages/spacy/tests/lang/la/test_exception.py b/TTS/Kokoro/.venv/Lib/site-packages/spacy/tests/lang/la/test_exception.py new file mode 100644 index 0000000000000000000000000000000000000000..45482ca5bc34d266949ca22ba0235fa8efccc581 --- /dev/null +++ b/TTS/Kokoro/.venv/Lib/site-packages/spacy/tests/lang/la/test_exception.py @@ -0,0 +1,8 @@ +import pytest + + +def test_la_tokenizer_handles_exc_in_text(la_tokenizer): + text = "scio te omnia facturum, ut nobiscum quam primum sis" + tokens = la_tokenizer(text) + assert len(tokens) == 11 + assert tokens[6].text == "nobis" diff --git a/TTS/Kokoro/.venv/Lib/site-packages/spacy/tests/lang/la/test_noun_chunks.py b/TTS/Kokoro/.venv/Lib/site-packages/spacy/tests/lang/la/test_noun_chunks.py new file mode 100644 index 0000000000000000000000000000000000000000..283cf4870671374f52957d7f7494a6cf7188fd24 --- /dev/null +++ b/TTS/Kokoro/.venv/Lib/site-packages/spacy/tests/lang/la/test_noun_chunks.py @@ -0,0 +1,53 @@ +import pytest + +from spacy.tokens import Doc + + +def test_noun_chunks_is_parsed(la_tokenizer): + """Test that noun_chunks raises Value Error for 'la' language if Doc is not parsed. + To check this test, we're constructing a Doc + with a new Vocab here and forcing is_parsed to 'False' + to make sure the noun chunks don't run. + """ + doc = la_tokenizer("Haec est sententia.") + with pytest.raises(ValueError): + list(doc.noun_chunks) + + +LA_NP_TEST_EXAMPLES = [ + ( + "Haec narrantur a poetis de Perseo.", + ["DET", "VERB", "ADP", "NOUN", "ADP", "PROPN", "PUNCT"], + ["nsubj:pass", "ROOT", "case", "obl", "case", "obl", "punct"], + [1, 0, -1, -1, -3, -1, -5], + ["poetis", "Perseo"], + ), + ( + "Perseus autem in sinu matris dormiebat.", + ["NOUN", "ADV", "ADP", "NOUN", "NOUN", "VERB", "PUNCT"], + ["nsubj", "discourse", "case", "obl", "nmod", "ROOT", "punct"], + [5, 4, 3, -1, -1, 0, -1], + ["Perseus", "sinu matris"], + ), +] + + +@pytest.mark.parametrize( + "text,pos,deps,heads,expected_noun_chunks", LA_NP_TEST_EXAMPLES +) +def test_la_noun_chunks(la_tokenizer, text, pos, deps, heads, expected_noun_chunks): + tokens = la_tokenizer(text) + + assert len(heads) == len(pos) + doc = Doc( + tokens.vocab, + words=[t.text for t in tokens], + heads=[head + i for i, head in enumerate(heads)], + deps=deps, + pos=pos, + ) + + noun_chunks = list(doc.noun_chunks) + assert len(noun_chunks) == len(expected_noun_chunks) + for i, np in enumerate(noun_chunks): + assert np.text == expected_noun_chunks[i] diff --git a/TTS/Kokoro/.venv/Lib/site-packages/spacy/tests/lang/la/test_text.py b/TTS/Kokoro/.venv/Lib/site-packages/spacy/tests/lang/la/test_text.py new file mode 100644 index 0000000000000000000000000000000000000000..67b015f093491c9fc6463c1c8a670e50cb139796 --- /dev/null +++ b/TTS/Kokoro/.venv/Lib/site-packages/spacy/tests/lang/la/test_text.py @@ -0,0 +1,36 @@ +import pytest + +from spacy.lang.la.lex_attrs import like_num + + +@pytest.mark.parametrize( + "text,match", + [ + ("IIII", True), + ("VI", True), + ("vi", True), + ("IV", True), + ("iv", True), + ("IX", True), + ("ix", True), + ("MMXXII", True), + ("0", True), + ("1", True), + ("quattuor", True), + ("decem", True), + ("tertius", True), + ("canis", False), + ("MMXX11", False), + (",", False), + ], +) +def test_lex_attrs_like_number(la_tokenizer, text, match): + tokens = la_tokenizer(text) + assert len(tokens) == 1 + assert tokens[0].like_num == match + + +@pytest.mark.parametrize("word", ["quinque"]) +def test_la_lex_attrs_capitals(word): + assert like_num(word) + assert like_num(word.upper()) diff --git a/TTS/Kokoro/.venv/Lib/site-packages/spacy/tests/lang/lb/__init__.py b/TTS/Kokoro/.venv/Lib/site-packages/spacy/tests/lang/lb/__init__.py new file mode 100644 index 0000000000000000000000000000000000000000..e69de29bb2d1d6434b8b29ae775ad8c2e48c5391 diff --git a/TTS/Kokoro/.venv/Lib/site-packages/spacy/tests/lang/lb/__pycache__/__init__.cpython-312.pyc b/TTS/Kokoro/.venv/Lib/site-packages/spacy/tests/lang/lb/__pycache__/__init__.cpython-312.pyc new file mode 100644 index 0000000000000000000000000000000000000000..e9dffa7927bd07e2b2624c9d17598e93e5b8a2b8 Binary files /dev/null and b/TTS/Kokoro/.venv/Lib/site-packages/spacy/tests/lang/lb/__pycache__/__init__.cpython-312.pyc differ diff --git a/TTS/Kokoro/.venv/Lib/site-packages/spacy/tests/lang/lb/__pycache__/test_exceptions.cpython-312.pyc b/TTS/Kokoro/.venv/Lib/site-packages/spacy/tests/lang/lb/__pycache__/test_exceptions.cpython-312.pyc new file mode 100644 index 0000000000000000000000000000000000000000..62eaf8cd2ba815fe637e5025ab441e5574603e59 Binary files /dev/null and b/TTS/Kokoro/.venv/Lib/site-packages/spacy/tests/lang/lb/__pycache__/test_exceptions.cpython-312.pyc differ diff --git a/TTS/Kokoro/.venv/Lib/site-packages/spacy/tests/lang/lb/__pycache__/test_prefix_suffix_infix.cpython-312.pyc b/TTS/Kokoro/.venv/Lib/site-packages/spacy/tests/lang/lb/__pycache__/test_prefix_suffix_infix.cpython-312.pyc new file mode 100644 index 0000000000000000000000000000000000000000..ad2bd01195c7689b61008c222f6e9c52c360ef9f Binary files /dev/null and b/TTS/Kokoro/.venv/Lib/site-packages/spacy/tests/lang/lb/__pycache__/test_prefix_suffix_infix.cpython-312.pyc differ diff --git a/TTS/Kokoro/.venv/Lib/site-packages/spacy/tests/lang/lb/__pycache__/test_text.cpython-312.pyc b/TTS/Kokoro/.venv/Lib/site-packages/spacy/tests/lang/lb/__pycache__/test_text.cpython-312.pyc new file mode 100644 index 0000000000000000000000000000000000000000..f6ebc32c62ef812aa7365106f67b50d77cfecb6d Binary files /dev/null and b/TTS/Kokoro/.venv/Lib/site-packages/spacy/tests/lang/lb/__pycache__/test_text.cpython-312.pyc differ diff --git a/TTS/Kokoro/.venv/Lib/site-packages/spacy/tests/lang/lb/test_exceptions.py b/TTS/Kokoro/.venv/Lib/site-packages/spacy/tests/lang/lb/test_exceptions.py new file mode 100644 index 0000000000000000000000000000000000000000..846b5e8d24ffc820d20f86275c528afa87dd39ea --- /dev/null +++ b/TTS/Kokoro/.venv/Lib/site-packages/spacy/tests/lang/lb/test_exceptions.py @@ -0,0 +1,20 @@ +import pytest + + +@pytest.mark.parametrize("text", ["z.B.", "Jan."]) +def test_lb_tokenizer_handles_abbr(lb_tokenizer, text): + tokens = lb_tokenizer(text) + assert len(tokens) == 1 + + +@pytest.mark.parametrize("text", ["d'Saach", "d'Kanner", "d’Welt", "d’Suen"]) +def test_lb_tokenizer_splits_contractions(lb_tokenizer, text): + tokens = lb_tokenizer(text) + assert len(tokens) == 2 + + +def test_lb_tokenizer_handles_exc_in_text(lb_tokenizer): + text = "Mee 't ass net evident, d'Liewen." + tokens = lb_tokenizer(text) + assert len(tokens) == 9 + assert tokens[1].text == "'t" diff --git a/TTS/Kokoro/.venv/Lib/site-packages/spacy/tests/lang/lb/test_prefix_suffix_infix.py b/TTS/Kokoro/.venv/Lib/site-packages/spacy/tests/lang/lb/test_prefix_suffix_infix.py new file mode 100644 index 0000000000000000000000000000000000000000..23c9ff388af4a86eab202b0ff7e54832192738d0 --- /dev/null +++ b/TTS/Kokoro/.venv/Lib/site-packages/spacy/tests/lang/lb/test_prefix_suffix_infix.py @@ -0,0 +1,19 @@ +import pytest + + +@pytest.mark.parametrize("text,length", [("z.B.", 1), ("zb.", 2), ("(z.B.", 2)]) +def test_lb_tokenizer_splits_prefix_interact(lb_tokenizer, text, length): + tokens = lb_tokenizer(text) + assert len(tokens) == length + + +@pytest.mark.parametrize("text", ["z.B.)"]) +def test_lb_tokenizer_splits_suffix_interact(lb_tokenizer, text): + tokens = lb_tokenizer(text) + assert len(tokens) == 2 + + +@pytest.mark.parametrize("text", ["(z.B.)"]) +def test_lb_tokenizer_splits_even_wrap_interact(lb_tokenizer, text): + tokens = lb_tokenizer(text) + assert len(tokens) == 3 diff --git a/TTS/Kokoro/.venv/Lib/site-packages/spacy/tests/lang/lb/test_text.py b/TTS/Kokoro/.venv/Lib/site-packages/spacy/tests/lang/lb/test_text.py new file mode 100644 index 0000000000000000000000000000000000000000..679ea4dc38c532e177830c53a803aaec680d82fe --- /dev/null +++ b/TTS/Kokoro/.venv/Lib/site-packages/spacy/tests/lang/lb/test_text.py @@ -0,0 +1,21 @@ +import pytest + + +def test_lb_tokenizer_handles_long_text(lb_tokenizer): + text = """Den Nordwand an d'Sonn An der Zäit hunn sech den Nordwand an d'Sonn gestridden, wie vun hinnen zwee wuel méi staark wier, wéi e Wanderer, deen an ee waarme Mantel agepak war, iwwert de Wee koum. Si goufen sech eens, dass deejéinege fir de Stäerkste gëlle sollt, deen de Wanderer forcéiere géif, säi Mantel auszedoen. Den Nordwand huet mat aller Force geblosen, awer wat e méi geblosen huet, wat de Wanderer sech méi a säi Mantel agewéckelt huet. Um Enn huet den Nordwand säi Kampf opginn. Dunn huet d'Sonn d'Loft mat hire frëndleche Strale gewiermt, a schonn no kuerzer Zäit huet de Wanderer säi Mantel ausgedoen. Do huet den Nordwand missen zouginn, dass d'Sonn vun hinnen zwee de Stäerkste wier.""" + + tokens = lb_tokenizer(text) + assert len(tokens) == 142 + + +@pytest.mark.parametrize( + "text,length", + [ + ("»Wat ass mat mir geschitt?«, huet hie geduecht.", 13), + ("“Dëst fréi Opstoen”, denkt hien, “mécht ee ganz duercherneen. ", 15), + ("Am Grand-Duché ass d'Liewen schéin, mee 't gëtt ze vill Autoen.", 14), + ], +) +def test_lb_tokenizer_handles_examples(lb_tokenizer, text, length): + tokens = lb_tokenizer(text) + assert len(tokens) == length diff --git a/TTS/Kokoro/.venv/Lib/site-packages/spacy/tests/lang/lg/__init__.py b/TTS/Kokoro/.venv/Lib/site-packages/spacy/tests/lang/lg/__init__.py new file mode 100644 index 0000000000000000000000000000000000000000..e69de29bb2d1d6434b8b29ae775ad8c2e48c5391 diff --git a/TTS/Kokoro/.venv/Lib/site-packages/spacy/tests/lang/lg/__pycache__/__init__.cpython-312.pyc b/TTS/Kokoro/.venv/Lib/site-packages/spacy/tests/lang/lg/__pycache__/__init__.cpython-312.pyc new file mode 100644 index 0000000000000000000000000000000000000000..33be229bfa1ecff76a2fd12e3bfa4ffc587a339d Binary files /dev/null and b/TTS/Kokoro/.venv/Lib/site-packages/spacy/tests/lang/lg/__pycache__/__init__.cpython-312.pyc differ diff --git a/TTS/Kokoro/.venv/Lib/site-packages/spacy/tests/lang/lg/__pycache__/test_tokenizer.cpython-312.pyc b/TTS/Kokoro/.venv/Lib/site-packages/spacy/tests/lang/lg/__pycache__/test_tokenizer.cpython-312.pyc new file mode 100644 index 0000000000000000000000000000000000000000..855ca8d232c432b0f2952a5ea337d75a74ccfcf2 Binary files /dev/null and b/TTS/Kokoro/.venv/Lib/site-packages/spacy/tests/lang/lg/__pycache__/test_tokenizer.cpython-312.pyc differ diff --git a/TTS/Kokoro/.venv/Lib/site-packages/spacy/tests/lang/lg/test_tokenizer.py b/TTS/Kokoro/.venv/Lib/site-packages/spacy/tests/lang/lg/test_tokenizer.py new file mode 100644 index 0000000000000000000000000000000000000000..efef6f134e9a95cd0e3bc5d9e2ea946fcdf7e954 --- /dev/null +++ b/TTS/Kokoro/.venv/Lib/site-packages/spacy/tests/lang/lg/test_tokenizer.py @@ -0,0 +1,15 @@ +import pytest + +LG_BASIC_TOKENIZATION_TESTS = [ + ( + "Abooluganda ab’emmamba ababiri", + ["Abooluganda", "ab’emmamba", "ababiri"], + ), +] + + +@pytest.mark.parametrize("text,expected_tokens", LG_BASIC_TOKENIZATION_TESTS) +def test_lg_tokenizer_basic(lg_tokenizer, text, expected_tokens): + tokens = lg_tokenizer(text) + token_list = [token.text for token in tokens if not token.is_space] + assert expected_tokens == token_list diff --git a/TTS/Kokoro/.venv/Lib/site-packages/spacy/tests/lang/lt/__init__.py b/TTS/Kokoro/.venv/Lib/site-packages/spacy/tests/lang/lt/__init__.py new file mode 100644 index 0000000000000000000000000000000000000000..e69de29bb2d1d6434b8b29ae775ad8c2e48c5391 diff --git a/TTS/Kokoro/.venv/Lib/site-packages/spacy/tests/lang/lt/__pycache__/__init__.cpython-312.pyc b/TTS/Kokoro/.venv/Lib/site-packages/spacy/tests/lang/lt/__pycache__/__init__.cpython-312.pyc new file mode 100644 index 0000000000000000000000000000000000000000..66198f07ef9c44a03e06534779fdf3b1ff86a633 Binary files /dev/null and b/TTS/Kokoro/.venv/Lib/site-packages/spacy/tests/lang/lt/__pycache__/__init__.cpython-312.pyc differ diff --git a/TTS/Kokoro/.venv/Lib/site-packages/spacy/tests/lang/lt/__pycache__/test_text.cpython-312.pyc b/TTS/Kokoro/.venv/Lib/site-packages/spacy/tests/lang/lt/__pycache__/test_text.cpython-312.pyc new file mode 100644 index 0000000000000000000000000000000000000000..3f94743190bd70c9f0b11a9d54c089efb926eb70 Binary files /dev/null and b/TTS/Kokoro/.venv/Lib/site-packages/spacy/tests/lang/lt/__pycache__/test_text.cpython-312.pyc differ diff --git a/TTS/Kokoro/.venv/Lib/site-packages/spacy/tests/lang/lt/test_text.py b/TTS/Kokoro/.venv/Lib/site-packages/spacy/tests/lang/lt/test_text.py new file mode 100644 index 0000000000000000000000000000000000000000..82c861daf5932eef8c939dcc31d6888f295e35ae --- /dev/null +++ b/TTS/Kokoro/.venv/Lib/site-packages/spacy/tests/lang/lt/test_text.py @@ -0,0 +1,53 @@ +import pytest + + +def test_lt_tokenizer_handles_long_text(lt_tokenizer): + text = """Tokios sausros kriterijus atitinka pirmadienį atlikti skaičiavimai, palyginus faktinį ir žemiausią vidutinį daugiametį vandens lygį. Nustatyta, kad iš 48 šalies vandens matavimo stočių 28-iose stotyse vandens lygis yra žemesnis arba lygus žemiausiam vidutiniam daugiamečiam šiltojo laikotarpio vandens lygiui.""" + tokens = lt_tokenizer(text) + assert len(tokens) == 42 + + +@pytest.mark.parametrize( + "text,length", + [ + ( + "177R Parodų rūmai–Ozo g. nuo vasario 18 d. bus skelbiamas interneto tinklalapyje.", + 17, + ), + ( + "ISM universiteto doc. dr. Ieva Augutytė-Kvedaravičienė pastebi, kad tyrimais nustatyti elgesio pokyčiai.", + 18, + ), + ], +) +def test_lt_tokenizer_handles_punct_abbrev(lt_tokenizer, text, length): + tokens = lt_tokenizer(text) + assert len(tokens) == length + + +@pytest.mark.parametrize("text", ["km.", "pvz.", "biol."]) +def test_lt_tokenizer_abbrev_exceptions(lt_tokenizer, text): + tokens = lt_tokenizer(text) + assert len(tokens) == 2 + + +@pytest.mark.parametrize( + "text,match", + [ + ("10", True), + ("1", True), + ("10,000", True), + ("10,00", True), + ("999.0", True), + ("vienas", True), + ("du", True), + ("milijardas", True), + ("šuo", False), + (",", False), + ("1/2", True), + ], +) +def test_lt_lex_attrs_like_number(lt_tokenizer, text, match): + tokens = lt_tokenizer(text) + assert len(tokens) == 1 + assert tokens[0].like_num == match diff --git a/TTS/Kokoro/.venv/Lib/site-packages/spacy/tests/lang/lv/__init__.py b/TTS/Kokoro/.venv/Lib/site-packages/spacy/tests/lang/lv/__init__.py new file mode 100644 index 0000000000000000000000000000000000000000..e69de29bb2d1d6434b8b29ae775ad8c2e48c5391 diff --git a/TTS/Kokoro/.venv/Lib/site-packages/spacy/tests/lang/lv/__pycache__/__init__.cpython-312.pyc b/TTS/Kokoro/.venv/Lib/site-packages/spacy/tests/lang/lv/__pycache__/__init__.cpython-312.pyc new file mode 100644 index 0000000000000000000000000000000000000000..4a56e71345591a508b26f23d5d94c2890f06270a Binary files /dev/null and b/TTS/Kokoro/.venv/Lib/site-packages/spacy/tests/lang/lv/__pycache__/__init__.cpython-312.pyc differ diff --git a/TTS/Kokoro/.venv/Lib/site-packages/spacy/tests/lang/lv/__pycache__/test_text.cpython-312.pyc b/TTS/Kokoro/.venv/Lib/site-packages/spacy/tests/lang/lv/__pycache__/test_text.cpython-312.pyc new file mode 100644 index 0000000000000000000000000000000000000000..d34ed5121b52573e651aff6229ccf1d96d444f7b Binary files /dev/null and b/TTS/Kokoro/.venv/Lib/site-packages/spacy/tests/lang/lv/__pycache__/test_text.cpython-312.pyc differ diff --git a/TTS/Kokoro/.venv/Lib/site-packages/spacy/tests/lang/lv/__pycache__/test_tokenizer.cpython-312.pyc b/TTS/Kokoro/.venv/Lib/site-packages/spacy/tests/lang/lv/__pycache__/test_tokenizer.cpython-312.pyc new file mode 100644 index 0000000000000000000000000000000000000000..f1c835612d511a7533350fe1f8a386fc18916f7f Binary files /dev/null and b/TTS/Kokoro/.venv/Lib/site-packages/spacy/tests/lang/lv/__pycache__/test_tokenizer.cpython-312.pyc differ diff --git a/TTS/Kokoro/.venv/Lib/site-packages/spacy/tests/lang/lv/test_text.py b/TTS/Kokoro/.venv/Lib/site-packages/spacy/tests/lang/lv/test_text.py new file mode 100644 index 0000000000000000000000000000000000000000..265b86c02f04857640a8372e896026f399d2fd0c --- /dev/null +++ b/TTS/Kokoro/.venv/Lib/site-packages/spacy/tests/lang/lv/test_text.py @@ -0,0 +1,27 @@ +import pytest + + +def test_long_text(lv_tokenizer): + # Excerpt: European Convention on Human Rights + text = """ +Ievērodamas, ka šī deklarācija paredz nodrošināt vispārēju un +efektīvu tajā pasludināto tiesību atzīšanu un ievērošanu; +Ievērodamas, ka Eiropas Padomes mērķis ir panākt lielāku vienotību +tās dalībvalstu starpā un ka viens no līdzekļiem, kā šo mērķi +sasniegt, ir cilvēka tiesību un pamatbrīvību ievērošana un turpmāka +īstenošana; +No jauna apliecinādamas patiesu pārliecību, ka šīs pamatbrīvības +ir taisnīguma un miera pamats visā pasaulē un ka tās vislabāk var +nodrošināt patiess demokrātisks politisks režīms no vienas puses un +vispārējo cilvēktiesību, uz kurām tās pamatojas, kopīga izpratne un +ievērošana no otras puses; +""" + tokens = lv_tokenizer(text) + assert len(tokens) == 109 + + +@pytest.mark.xfail +def test_ordinal_number(lv_tokenizer): + text = "10. decembrī" + tokens = lv_tokenizer(text) + assert len(tokens) == 2 diff --git a/TTS/Kokoro/.venv/Lib/site-packages/spacy/tests/lang/lv/test_tokenizer.py b/TTS/Kokoro/.venv/Lib/site-packages/spacy/tests/lang/lv/test_tokenizer.py new file mode 100644 index 0000000000000000000000000000000000000000..959f582042d2a25acddcb9d8d8bee99e2742655d --- /dev/null +++ b/TTS/Kokoro/.venv/Lib/site-packages/spacy/tests/lang/lv/test_tokenizer.py @@ -0,0 +1,30 @@ +import pytest + +LV_BASIC_TOKENIZATION_TESTS = [ + ( + "Nevienu nedrīkst spīdzināt vai cietsirdīgi vai pazemojoši ar viņu " + "apieties vai sodīt.", + [ + "Nevienu", + "nedrīkst", + "spīdzināt", + "vai", + "cietsirdīgi", + "vai", + "pazemojoši", + "ar", + "viņu", + "apieties", + "vai", + "sodīt", + ".", + ], + ), +] + + +@pytest.mark.parametrize("text,expected_tokens", LV_BASIC_TOKENIZATION_TESTS) +def test_lv_tokenizer_basic(lv_tokenizer, text, expected_tokens): + tokens = lv_tokenizer(text) + token_list = [token.text for token in tokens if not token.is_space] + assert expected_tokens == token_list diff --git a/TTS/Kokoro/.venv/Lib/site-packages/spacy/tests/lang/mk/__init__.py b/TTS/Kokoro/.venv/Lib/site-packages/spacy/tests/lang/mk/__init__.py new file mode 100644 index 0000000000000000000000000000000000000000..e69de29bb2d1d6434b8b29ae775ad8c2e48c5391 diff --git a/TTS/Kokoro/.venv/Lib/site-packages/spacy/tests/lang/mk/__pycache__/__init__.cpython-312.pyc b/TTS/Kokoro/.venv/Lib/site-packages/spacy/tests/lang/mk/__pycache__/__init__.cpython-312.pyc new file mode 100644 index 0000000000000000000000000000000000000000..d0c870cd91dd5227aa517766a3e9c05fae4cc82b Binary files /dev/null and b/TTS/Kokoro/.venv/Lib/site-packages/spacy/tests/lang/mk/__pycache__/__init__.cpython-312.pyc differ diff --git a/TTS/Kokoro/.venv/Lib/site-packages/spacy/tests/lang/mk/__pycache__/test_text.cpython-312.pyc b/TTS/Kokoro/.venv/Lib/site-packages/spacy/tests/lang/mk/__pycache__/test_text.cpython-312.pyc new file mode 100644 index 0000000000000000000000000000000000000000..96de2ced1854911084f31f9b8d7b63c2fec7ff9d Binary files /dev/null and b/TTS/Kokoro/.venv/Lib/site-packages/spacy/tests/lang/mk/__pycache__/test_text.cpython-312.pyc differ diff --git a/TTS/Kokoro/.venv/Lib/site-packages/spacy/tests/lang/mk/test_text.py b/TTS/Kokoro/.venv/Lib/site-packages/spacy/tests/lang/mk/test_text.py new file mode 100644 index 0000000000000000000000000000000000000000..79ad9439eb9b9961a029ecd287b1e8618a96c88f --- /dev/null +++ b/TTS/Kokoro/.venv/Lib/site-packages/spacy/tests/lang/mk/test_text.py @@ -0,0 +1,78 @@ +import pytest + +from spacy.lang.mk.lex_attrs import like_num + + +def test_tokenizer_handles_long_text(mk_tokenizer): + text = """ + Во организациските работи или на нашите собранија со членството, никој од нас не зборуваше за + организацијата и идеологијата. Работна беше нашата работа, а не идеолошка. Што се однесува до социјализмот на + Делчев, неговата дејност зборува сама за себе - спротивно. Во суштина, водачите си имаа свои основни погледи и + свои разбирања за положбата и работите, коишто стоеја пред нив и ги завршуваа со голема упорност, настојчивост и + насоченост. Значи, идеологија имаше, само што нивната идеологија имаше своја оригиналност. Македонија денеска, + чиста рожба на животот и положбата во Македонија, кои му служеа како база на неговите побуди, беше дејност која + имаше потреба од ум за да си најде своја смисла. Таквата идеологија и заемното дејство на умот и срцето му + помогнаа на Делчев да не се занесе по патот на својата идеологија... Во суштина, Организацијата и нејзините + водачи имаа свои разбирања за работите и положбата во идеен поглед, но тоа беше врската, животот и положбата во + Македонија и го внесуваа во својата идеологија гласот на своето срце, и на крај, прибегнуваа до умот, + за да најдат смисла или да ѝ дадат. Тоа содејство и заемен сооднос на умот и срцето му помогнаа на Делчев да ја + држи својата идеологија во сообразност со положбата на работите... Водачите навистина направија една жртва + бидејќи на населението не му зборуваа за своите мисли и идеи. Тие се одрекоа од секаква субјективност во своите + мисли. Целта беше да не се зголемуваат целите и задачите како и преданоста во работата. Населението не можеше да + ги разбере овие идеи... + """ + tokens = mk_tokenizer(text) + assert len(tokens) == 297 + + +@pytest.mark.parametrize( + "word,match", + [ + ("10", True), + ("1", True), + ("10.000", True), + ("1000", True), + ("бројка", False), + ("999,0", True), + ("еден", True), + ("два", True), + ("цифра", False), + ("десет", True), + ("сто", True), + ("број", False), + ("илјада", True), + ("илјади", True), + ("милион", True), + (",", False), + ("милијарда", True), + ("билион", True), + ], +) +def test_mk_lex_attrs_like_number(mk_tokenizer, word, match): + tokens = mk_tokenizer(word) + assert len(tokens) == 1 + assert tokens[0].like_num == match + + +@pytest.mark.parametrize("word", ["двесте", "два-три", "пет-шест"]) +def test_mk_lex_attrs_capitals(word): + assert like_num(word) + assert like_num(word.upper()) + + +@pytest.mark.parametrize( + "word", + [ + "првиот", + "втора", + "четврт", + "четвртата", + "петти", + "петто", + "стоти", + "шеесетите", + "седумдесетите", + ], +) +def test_mk_lex_attrs_like_number_for_ordinal(word): + assert like_num(word) diff --git a/TTS/Kokoro/.venv/Lib/site-packages/spacy/tests/lang/ml/__init__.py b/TTS/Kokoro/.venv/Lib/site-packages/spacy/tests/lang/ml/__init__.py new file mode 100644 index 0000000000000000000000000000000000000000..e69de29bb2d1d6434b8b29ae775ad8c2e48c5391 diff --git a/TTS/Kokoro/.venv/Lib/site-packages/spacy/tests/lang/ml/__pycache__/__init__.cpython-312.pyc b/TTS/Kokoro/.venv/Lib/site-packages/spacy/tests/lang/ml/__pycache__/__init__.cpython-312.pyc new file mode 100644 index 0000000000000000000000000000000000000000..a987117fd5dc5776b08f4539004272389f463682 Binary files /dev/null and b/TTS/Kokoro/.venv/Lib/site-packages/spacy/tests/lang/ml/__pycache__/__init__.cpython-312.pyc differ diff --git a/TTS/Kokoro/.venv/Lib/site-packages/spacy/tests/lang/ml/__pycache__/test_text.cpython-312.pyc b/TTS/Kokoro/.venv/Lib/site-packages/spacy/tests/lang/ml/__pycache__/test_text.cpython-312.pyc new file mode 100644 index 0000000000000000000000000000000000000000..163292735c9d22db4b940a6b59943ef0f58e2b6b Binary files /dev/null and b/TTS/Kokoro/.venv/Lib/site-packages/spacy/tests/lang/ml/__pycache__/test_text.cpython-312.pyc differ diff --git a/TTS/Kokoro/.venv/Lib/site-packages/spacy/tests/lang/ml/test_text.py b/TTS/Kokoro/.venv/Lib/site-packages/spacy/tests/lang/ml/test_text.py new file mode 100644 index 0000000000000000000000000000000000000000..c8e59d1683babca22f146db7f71c7ae82d243d6d --- /dev/null +++ b/TTS/Kokoro/.venv/Lib/site-packages/spacy/tests/lang/ml/test_text.py @@ -0,0 +1,22 @@ +import pytest + + +def test_ml_tokenizer_handles_long_text(ml_tokenizer): + text = """അനാവശ്യമായി കണ്ണിലും മൂക്കിലും വായിലും സ്പർശിക്കാതിരിക്കുക""" + tokens = ml_tokenizer(text) + assert len(tokens) == 5 + + +@pytest.mark.parametrize( + "text,length", + [ + ( + "എന്നാൽ അച്ചടിയുടെ ആവിർഭാവം ലിപിയിൽ കാര്യമായ മാറ്റങ്ങൾ വരുത്തിയത് കൂട്ടക്ഷരങ്ങളെ അണുഅക്ഷരങ്ങളായി പിരിച്ചുകൊണ്ടായിരുന്നു", + 10, + ), + ("പരമ്പരാഗതമായി മലയാളം ഇടത്തുനിന്ന് വലത്തോട്ടാണ് എഴുതുന്നത്", 5), + ], +) +def test_ml_tokenizer_handles_cnts(ml_tokenizer, text, length): + tokens = ml_tokenizer(text) + assert len(tokens) == length diff --git a/TTS/Kokoro/.venv/Lib/site-packages/spacy/tests/lang/ms/__init__.py b/TTS/Kokoro/.venv/Lib/site-packages/spacy/tests/lang/ms/__init__.py new file mode 100644 index 0000000000000000000000000000000000000000..e69de29bb2d1d6434b8b29ae775ad8c2e48c5391 diff --git a/TTS/Kokoro/.venv/Lib/site-packages/spacy/tests/lang/ms/__pycache__/__init__.cpython-312.pyc b/TTS/Kokoro/.venv/Lib/site-packages/spacy/tests/lang/ms/__pycache__/__init__.cpython-312.pyc new file mode 100644 index 0000000000000000000000000000000000000000..94347f17f26f2e40d84c72a96a0e326363601bf3 Binary files /dev/null and b/TTS/Kokoro/.venv/Lib/site-packages/spacy/tests/lang/ms/__pycache__/__init__.cpython-312.pyc differ diff --git a/TTS/Kokoro/.venv/Lib/site-packages/spacy/tests/lang/ms/__pycache__/test_noun_chunks.cpython-312.pyc b/TTS/Kokoro/.venv/Lib/site-packages/spacy/tests/lang/ms/__pycache__/test_noun_chunks.cpython-312.pyc new file mode 100644 index 0000000000000000000000000000000000000000..5028a8549e786b196a8ad88a8f51f2961c073735 Binary files /dev/null and b/TTS/Kokoro/.venv/Lib/site-packages/spacy/tests/lang/ms/__pycache__/test_noun_chunks.cpython-312.pyc differ diff --git a/TTS/Kokoro/.venv/Lib/site-packages/spacy/tests/lang/ms/__pycache__/test_prefix_suffix_infix.cpython-312.pyc b/TTS/Kokoro/.venv/Lib/site-packages/spacy/tests/lang/ms/__pycache__/test_prefix_suffix_infix.cpython-312.pyc new file mode 100644 index 0000000000000000000000000000000000000000..bfd978929a093d266a1cfffd55f22b8297fd08c7 Binary files /dev/null and b/TTS/Kokoro/.venv/Lib/site-packages/spacy/tests/lang/ms/__pycache__/test_prefix_suffix_infix.cpython-312.pyc differ diff --git a/TTS/Kokoro/.venv/Lib/site-packages/spacy/tests/lang/ms/__pycache__/test_text.cpython-312.pyc b/TTS/Kokoro/.venv/Lib/site-packages/spacy/tests/lang/ms/__pycache__/test_text.cpython-312.pyc new file mode 100644 index 0000000000000000000000000000000000000000..47ffc2aec63ded2488bcb1fd41ba03ecd2c0f5b3 Binary files /dev/null and b/TTS/Kokoro/.venv/Lib/site-packages/spacy/tests/lang/ms/__pycache__/test_text.cpython-312.pyc differ diff --git a/TTS/Kokoro/.venv/Lib/site-packages/spacy/tests/lang/ms/test_noun_chunks.py b/TTS/Kokoro/.venv/Lib/site-packages/spacy/tests/lang/ms/test_noun_chunks.py new file mode 100644 index 0000000000000000000000000000000000000000..cfd10bab5ad50199ae8b90b41058390d96d9502f --- /dev/null +++ b/TTS/Kokoro/.venv/Lib/site-packages/spacy/tests/lang/ms/test_noun_chunks.py @@ -0,0 +1,8 @@ +import pytest + + +def test_noun_chunks_is_parsed_ms(ms_tokenizer): + """Test that noun_chunks raises Value Error for 'ms' language if Doc is not parsed.""" + doc = ms_tokenizer("sebelas") + with pytest.raises(ValueError): + list(doc.noun_chunks) diff --git a/TTS/Kokoro/.venv/Lib/site-packages/spacy/tests/lang/ms/test_prefix_suffix_infix.py b/TTS/Kokoro/.venv/Lib/site-packages/spacy/tests/lang/ms/test_prefix_suffix_infix.py new file mode 100644 index 0000000000000000000000000000000000000000..20f07a96c58748ea8b4a76f4bbae581497b5d9b4 --- /dev/null +++ b/TTS/Kokoro/.venv/Lib/site-packages/spacy/tests/lang/ms/test_prefix_suffix_infix.py @@ -0,0 +1,112 @@ +import pytest + + +@pytest.mark.parametrize("text", ["(Ma'arif)"]) +def test_ms_tokenizer_splits_no_special(id_tokenizer, text): + tokens = id_tokenizer(text) + assert len(tokens) == 3 + + +@pytest.mark.parametrize("text", ["Ma'arif"]) +def test_ms_tokenizer_splits_no_punct(id_tokenizer, text): + tokens = id_tokenizer(text) + assert len(tokens) == 1 + + +@pytest.mark.parametrize("text", ["(Ma'arif"]) +def test_ms_tokenizer_splits_prefix_punct(id_tokenizer, text): + tokens = id_tokenizer(text) + assert len(tokens) == 2 + + +@pytest.mark.parametrize("text", ["Ma'arif)"]) +def test_ms_tokenizer_splits_suffix_punct(id_tokenizer, text): + tokens = id_tokenizer(text) + assert len(tokens) == 2 + + +@pytest.mark.parametrize("text", ["(Ma'arif)"]) +def test_ms_tokenizer_splits_even_wrap(id_tokenizer, text): + tokens = id_tokenizer(text) + assert len(tokens) == 3 + + +@pytest.mark.parametrize("text", ["(Ma'arif?)"]) +def test_tokenizer_splits_uneven_wrap(id_tokenizer, text): + tokens = id_tokenizer(text) + assert len(tokens) == 4 + + +@pytest.mark.parametrize("text,length", [("S.Kom.", 1), ("SKom.", 2), ("(S.Kom.", 2)]) +def test_ms_tokenizer_splits_prefix_interact(id_tokenizer, text, length): + tokens = id_tokenizer(text) + assert len(tokens) == length + + +@pytest.mark.parametrize("text", ["S.Kom.)"]) +def test_ms_tokenizer_splits_suffix_interact(id_tokenizer, text): + tokens = id_tokenizer(text) + assert len(tokens) == 2 + + +@pytest.mark.parametrize("text", ["(S.Kom.)"]) +def test_ms_tokenizer_splits_even_wrap_interact(id_tokenizer, text): + tokens = id_tokenizer(text) + assert len(tokens) == 3 + + +@pytest.mark.parametrize("text", ["(S.Kom.?)"]) +def test_ms_tokenizer_splits_uneven_wrap_interact(id_tokenizer, text): + tokens = id_tokenizer(text) + assert len(tokens) == 4 + + +@pytest.mark.parametrize( + "text,length", + [("kerana", 1), ("Mahathir-Anwar", 3), ("Tun Dr. Ismail-Abdul Rahman", 6)], +) +def test_my_tokenizer_splits_hyphens(ms_tokenizer, text, length): + tokens = ms_tokenizer(text) + assert len(tokens) == length + + +@pytest.mark.parametrize("text", ["0.1-13.5", "0.0-0.1", "103.27-300"]) +def test_ms_tokenizer_splits_numeric_range(id_tokenizer, text): + tokens = id_tokenizer(text) + assert len(tokens) == 3 + + +@pytest.mark.parametrize("text", ["ini.Sani", "Halo.Malaysia"]) +def test_ms_tokenizer_splits_period_infix(id_tokenizer, text): + tokens = id_tokenizer(text) + assert len(tokens) == 3 + + +@pytest.mark.parametrize("text", ["Halo,Malaysia", "satu,dua"]) +def test_ms_tokenizer_splits_comma_infix(id_tokenizer, text): + tokens = id_tokenizer(text) + assert len(tokens) == 3 + assert tokens[0].text == text.split(",")[0] + assert tokens[1].text == "," + assert tokens[2].text == text.split(",")[1] + + +@pytest.mark.parametrize("text", ["halo...Malaysia", "dia...pergi"]) +def test_ms_tokenizer_splits_ellipsis_infix(id_tokenizer, text): + tokens = id_tokenizer(text) + assert len(tokens) == 3 + + +def test_ms_tokenizer_splits_double_hyphen_infix(id_tokenizer): + tokens = id_tokenizer("Arsene Wenger--pengurus Arsenal--mengadakan sidang media.") + assert len(tokens) == 10 + assert tokens[0].text == "Arsene" + assert tokens[1].text == "Wenger" + assert tokens[2].text == "--" + assert tokens[3].text == "pengurus" + assert tokens[4].text == "Arsenal" + assert tokens[5].text == "--" + assert tokens[6].text == "mengadakan" + assert tokens[7].text == "sidang" + assert tokens[8].text == "media" + assert tokens[9].text == "." diff --git a/TTS/Kokoro/.venv/Lib/site-packages/spacy/tests/lang/ms/test_text.py b/TTS/Kokoro/.venv/Lib/site-packages/spacy/tests/lang/ms/test_text.py new file mode 100644 index 0000000000000000000000000000000000000000..e80dbc64e6f6d654b36ec3ee4dac566fcc6abe79 --- /dev/null +++ b/TTS/Kokoro/.venv/Lib/site-packages/spacy/tests/lang/ms/test_text.py @@ -0,0 +1,9 @@ +import pytest + +from spacy.lang.ms.lex_attrs import like_num + + +@pytest.mark.parametrize("word", ["sebelas"]) +def test_ms_lex_attrs_capitals(word): + assert like_num(word) + assert like_num(word.upper()) diff --git a/TTS/Kokoro/.venv/Lib/site-packages/spacy/tests/lang/nb/__init__.py b/TTS/Kokoro/.venv/Lib/site-packages/spacy/tests/lang/nb/__init__.py new file mode 100644 index 0000000000000000000000000000000000000000..e69de29bb2d1d6434b8b29ae775ad8c2e48c5391 diff --git a/TTS/Kokoro/.venv/Lib/site-packages/spacy/tests/lang/nb/__pycache__/__init__.cpython-312.pyc b/TTS/Kokoro/.venv/Lib/site-packages/spacy/tests/lang/nb/__pycache__/__init__.cpython-312.pyc new file mode 100644 index 0000000000000000000000000000000000000000..f9db4ef38c50c52a837389cff116295f9b719956 Binary files /dev/null and b/TTS/Kokoro/.venv/Lib/site-packages/spacy/tests/lang/nb/__pycache__/__init__.cpython-312.pyc differ diff --git a/TTS/Kokoro/.venv/Lib/site-packages/spacy/tests/lang/nb/__pycache__/test_noun_chunks.cpython-312.pyc b/TTS/Kokoro/.venv/Lib/site-packages/spacy/tests/lang/nb/__pycache__/test_noun_chunks.cpython-312.pyc new file mode 100644 index 0000000000000000000000000000000000000000..fa83bc6810bb55726b5da7412375314da1c34293 Binary files /dev/null and b/TTS/Kokoro/.venv/Lib/site-packages/spacy/tests/lang/nb/__pycache__/test_noun_chunks.cpython-312.pyc differ diff --git a/TTS/Kokoro/.venv/Lib/site-packages/spacy/tests/lang/nb/__pycache__/test_tokenizer.cpython-312.pyc b/TTS/Kokoro/.venv/Lib/site-packages/spacy/tests/lang/nb/__pycache__/test_tokenizer.cpython-312.pyc new file mode 100644 index 0000000000000000000000000000000000000000..51491b08349f5e5a91f32d4a31a3156afc84097b Binary files /dev/null and b/TTS/Kokoro/.venv/Lib/site-packages/spacy/tests/lang/nb/__pycache__/test_tokenizer.cpython-312.pyc differ diff --git a/TTS/Kokoro/.venv/Lib/site-packages/spacy/tests/lang/nb/test_noun_chunks.py b/TTS/Kokoro/.venv/Lib/site-packages/spacy/tests/lang/nb/test_noun_chunks.py new file mode 100644 index 0000000000000000000000000000000000000000..d9b62031149e01906491b3ae22abc4d87ff64264 --- /dev/null +++ b/TTS/Kokoro/.venv/Lib/site-packages/spacy/tests/lang/nb/test_noun_chunks.py @@ -0,0 +1,8 @@ +import pytest + + +def test_noun_chunks_is_parsed_nb(nb_tokenizer): + """Test that noun_chunks raises Value Error for 'nb' language if Doc is not parsed.""" + doc = nb_tokenizer("Smørsausen brukes bl.a. til") + with pytest.raises(ValueError): + list(doc.noun_chunks) diff --git a/TTS/Kokoro/.venv/Lib/site-packages/spacy/tests/lang/nb/test_tokenizer.py b/TTS/Kokoro/.venv/Lib/site-packages/spacy/tests/lang/nb/test_tokenizer.py new file mode 100644 index 0000000000000000000000000000000000000000..e6d57f19b86e4f19df864ac0053b1126c79789b6 --- /dev/null +++ b/TTS/Kokoro/.venv/Lib/site-packages/spacy/tests/lang/nb/test_tokenizer.py @@ -0,0 +1,19 @@ +import pytest + +NB_TOKEN_EXCEPTION_TESTS = [ + ( + "Smørsausen brukes bl.a. til fisk", + ["Smørsausen", "brukes", "bl.a.", "til", "fisk"], + ), + ( + "Jeg kommer først kl. 13 pga. diverse forsinkelser", + ["Jeg", "kommer", "først", "kl.", "13", "pga.", "diverse", "forsinkelser"], + ), +] + + +@pytest.mark.parametrize("text,expected_tokens", NB_TOKEN_EXCEPTION_TESTS) +def test_nb_tokenizer_handles_exception_cases(nb_tokenizer, text, expected_tokens): + tokens = nb_tokenizer(text) + token_list = [token.text for token in tokens if not token.is_space] + assert expected_tokens == token_list diff --git a/TTS/Kokoro/.venv/Lib/site-packages/spacy/tests/lang/ne/__init__.py b/TTS/Kokoro/.venv/Lib/site-packages/spacy/tests/lang/ne/__init__.py new file mode 100644 index 0000000000000000000000000000000000000000..e69de29bb2d1d6434b8b29ae775ad8c2e48c5391 diff --git a/TTS/Kokoro/.venv/Lib/site-packages/spacy/tests/lang/ne/__pycache__/__init__.cpython-312.pyc b/TTS/Kokoro/.venv/Lib/site-packages/spacy/tests/lang/ne/__pycache__/__init__.cpython-312.pyc new file mode 100644 index 0000000000000000000000000000000000000000..320f7c9a12717d9820e2a916f39b4b4a2c00c3ce Binary files /dev/null and b/TTS/Kokoro/.venv/Lib/site-packages/spacy/tests/lang/ne/__pycache__/__init__.cpython-312.pyc differ diff --git a/TTS/Kokoro/.venv/Lib/site-packages/spacy/tests/lang/ne/__pycache__/test_text.cpython-312.pyc b/TTS/Kokoro/.venv/Lib/site-packages/spacy/tests/lang/ne/__pycache__/test_text.cpython-312.pyc new file mode 100644 index 0000000000000000000000000000000000000000..2c340beb289887ad8f62e0686b231852e2f67995 Binary files /dev/null and b/TTS/Kokoro/.venv/Lib/site-packages/spacy/tests/lang/ne/__pycache__/test_text.cpython-312.pyc differ diff --git a/TTS/Kokoro/.venv/Lib/site-packages/spacy/tests/lang/ne/test_text.py b/TTS/Kokoro/.venv/Lib/site-packages/spacy/tests/lang/ne/test_text.py new file mode 100644 index 0000000000000000000000000000000000000000..e8a6c2e984517a2e91b890280e9fcc895eeae8fb --- /dev/null +++ b/TTS/Kokoro/.venv/Lib/site-packages/spacy/tests/lang/ne/test_text.py @@ -0,0 +1,15 @@ +import pytest + + +def test_ne_tokenizer_handlers_long_text(ne_tokenizer): + text = """मैले पाएको सर्टिफिकेटलाई म त बोक्रो सम्झन्छु र अभ्यास तब सुरु भयो, जब मैले कलेज पार गरेँ र जीवनको पढाइ सुरु गरेँ ।""" + tokens = ne_tokenizer(text) + assert len(tokens) == 24 + + +@pytest.mark.parametrize( + "text,length", [("समय जान कति पनि बेर लाग्दैन ।", 7), ("म ठूलो हुँदै थिएँ ।", 5)] +) +def test_ne_tokenizer_handles_cnts(ne_tokenizer, text, length): + tokens = ne_tokenizer(text) + assert len(tokens) == length diff --git a/TTS/Kokoro/.venv/Lib/site-packages/spacy/tests/lang/nl/__init__.py b/TTS/Kokoro/.venv/Lib/site-packages/spacy/tests/lang/nl/__init__.py new file mode 100644 index 0000000000000000000000000000000000000000..e69de29bb2d1d6434b8b29ae775ad8c2e48c5391 diff --git a/TTS/Kokoro/.venv/Lib/site-packages/spacy/tests/lang/nl/__pycache__/__init__.cpython-312.pyc b/TTS/Kokoro/.venv/Lib/site-packages/spacy/tests/lang/nl/__pycache__/__init__.cpython-312.pyc new file mode 100644 index 0000000000000000000000000000000000000000..503f6b21939e3840e3c6e63ec4d0df04b67db637 Binary files /dev/null and b/TTS/Kokoro/.venv/Lib/site-packages/spacy/tests/lang/nl/__pycache__/__init__.cpython-312.pyc differ diff --git a/TTS/Kokoro/.venv/Lib/site-packages/spacy/tests/lang/nl/__pycache__/test_noun_chunks.cpython-312.pyc b/TTS/Kokoro/.venv/Lib/site-packages/spacy/tests/lang/nl/__pycache__/test_noun_chunks.cpython-312.pyc new file mode 100644 index 0000000000000000000000000000000000000000..b09632c760ae59320947d1067e93be6badc55834 Binary files /dev/null and b/TTS/Kokoro/.venv/Lib/site-packages/spacy/tests/lang/nl/__pycache__/test_noun_chunks.cpython-312.pyc differ diff --git a/TTS/Kokoro/.venv/Lib/site-packages/spacy/tests/lang/nl/__pycache__/test_text.cpython-312.pyc b/TTS/Kokoro/.venv/Lib/site-packages/spacy/tests/lang/nl/__pycache__/test_text.cpython-312.pyc new file mode 100644 index 0000000000000000000000000000000000000000..1a099cffb2f299bb11b0d5d5fcc03b848141db70 Binary files /dev/null and b/TTS/Kokoro/.venv/Lib/site-packages/spacy/tests/lang/nl/__pycache__/test_text.cpython-312.pyc differ diff --git a/TTS/Kokoro/.venv/Lib/site-packages/spacy/tests/lang/nl/test_noun_chunks.py b/TTS/Kokoro/.venv/Lib/site-packages/spacy/tests/lang/nl/test_noun_chunks.py new file mode 100644 index 0000000000000000000000000000000000000000..990cad2d3034d4269e6bca8352ea62a54bf6b693 --- /dev/null +++ b/TTS/Kokoro/.venv/Lib/site-packages/spacy/tests/lang/nl/test_noun_chunks.py @@ -0,0 +1,226 @@ +import pytest + +from spacy.tokens import Doc +from spacy.util import filter_spans + + +@pytest.fixture +def nl_sample(nl_vocab): + # TEXT : + # Haar vriend lacht luid. We kregen alweer ruzie toen we de supermarkt ingingen. + # Aan het begin van de supermarkt is al het fruit en de groentes. Uiteindelijk hebben we dan ook + # geen avondeten gekocht. + words = [ + "Haar", + "vriend", + "lacht", + "luid", + ".", + "We", + "kregen", + "alweer", + "ruzie", + "toen", + "we", + "de", + "supermarkt", + "ingingen", + ".", + "Aan", + "het", + "begin", + "van", + "de", + "supermarkt", + "is", + "al", + "het", + "fruit", + "en", + "de", + "groentes", + ".", + "Uiteindelijk", + "hebben", + "we", + "dan", + "ook", + "geen", + "avondeten", + "gekocht", + ".", + ] + heads = [ + 1, + 2, + 2, + 2, + 2, + 6, + 6, + 6, + 6, + 13, + 13, + 12, + 13, + 6, + 6, + 17, + 17, + 24, + 20, + 20, + 17, + 24, + 24, + 24, + 24, + 27, + 27, + 24, + 24, + 36, + 36, + 36, + 36, + 36, + 35, + 36, + 36, + 36, + ] + deps = [ + "nmod:poss", + "nsubj", + "ROOT", + "advmod", + "punct", + "nsubj", + "ROOT", + "advmod", + "obj", + "mark", + "nsubj", + "det", + "obj", + "advcl", + "punct", + "case", + "det", + "obl", + "case", + "det", + "nmod", + "cop", + "advmod", + "det", + "ROOT", + "cc", + "det", + "conj", + "punct", + "advmod", + "aux", + "nsubj", + "advmod", + "advmod", + "det", + "obj", + "ROOT", + "punct", + ] + pos = [ + "PRON", + "NOUN", + "VERB", + "ADJ", + "PUNCT", + "PRON", + "VERB", + "ADV", + "NOUN", + "SCONJ", + "PRON", + "DET", + "NOUN", + "NOUN", + "PUNCT", + "ADP", + "DET", + "NOUN", + "ADP", + "DET", + "NOUN", + "AUX", + "ADV", + "DET", + "NOUN", + "CCONJ", + "DET", + "NOUN", + "PUNCT", + "ADJ", + "AUX", + "PRON", + "ADV", + "ADV", + "DET", + "NOUN", + "VERB", + "PUNCT", + ] + return Doc(nl_vocab, words=words, heads=heads, deps=deps, pos=pos) + + +@pytest.fixture +def nl_reference_chunking(): + # Using frog https://github.com/LanguageMachines/frog/ we obtain the following NOUN-PHRASES: + return [ + "haar vriend", + "we", + "ruzie", + "we", + "de supermarkt", + "het begin", + "de supermarkt", + "het fruit", + "de groentes", + "we", + "geen avondeten", + ] + + +def test_need_dep(nl_tokenizer): + """ + Test that noun_chunks raises Value Error for 'nl' language if Doc is not parsed. + """ + txt = "Haar vriend lacht luid." + doc = nl_tokenizer(txt) + + with pytest.raises(ValueError): + list(doc.noun_chunks) + + +def test_chunking(nl_sample, nl_reference_chunking): + """ + Test the noun chunks of a sample text. Uses a sample. + The sample text simulates a Doc object as would be produced by nl_core_news_md. + """ + chunks = [s.text.lower() for s in nl_sample.noun_chunks] + assert chunks == nl_reference_chunking + + +@pytest.mark.issue(10846) +def test_no_overlapping_chunks(nl_vocab): + # fmt: off + doc = Doc( + nl_vocab, + words=["Dit", "programma", "wordt", "beschouwd", "als", "'s", "werelds", "eerste", "computerprogramma"], + deps=["det", "nsubj:pass", "aux:pass", "ROOT", "mark", "det", "fixed", "amod", "xcomp"], + heads=[1, 3, 3, 3, 8, 8, 5, 8, 3], + pos=["DET", "NOUN", "AUX", "VERB", "SCONJ", "DET", "NOUN", "ADJ", "NOUN"], + ) + # fmt: on + chunks = list(doc.noun_chunks) + assert filter_spans(chunks) == chunks diff --git a/TTS/Kokoro/.venv/Lib/site-packages/spacy/tests/lang/nl/test_text.py b/TTS/Kokoro/.venv/Lib/site-packages/spacy/tests/lang/nl/test_text.py new file mode 100644 index 0000000000000000000000000000000000000000..d6a9866bc12f2ce687ba7102a1dc1a31011ecbec --- /dev/null +++ b/TTS/Kokoro/.venv/Lib/site-packages/spacy/tests/lang/nl/test_text.py @@ -0,0 +1,25 @@ +import pytest + +from spacy.lang.nl.lex_attrs import like_num + + +@pytest.mark.parametrize("word", ["elf", "elfde"]) +def test_nl_lex_attrs_capitals(word): + assert like_num(word) + assert like_num(word.upper()) + + +@pytest.mark.parametrize( + "text,num_tokens", + [ + ( + "De aftredende minister-president benadrukte al dat zijn partij inhoudelijk weinig gemeen heeft met de groenen.", + 16, + ), + ("Hij is sociaal-cultureel werker.", 5), + ("Er staan een aantal dure auto's in de garage.", 10), + ], +) +def test_tokenizer_doesnt_split_hyphens(nl_tokenizer, text, num_tokens): + tokens = nl_tokenizer(text) + assert len(tokens) == num_tokens diff --git a/TTS/Kokoro/.venv/Lib/site-packages/spacy/tests/lang/nn/__init__.py b/TTS/Kokoro/.venv/Lib/site-packages/spacy/tests/lang/nn/__init__.py new file mode 100644 index 0000000000000000000000000000000000000000..e69de29bb2d1d6434b8b29ae775ad8c2e48c5391 diff --git a/TTS/Kokoro/.venv/Lib/site-packages/spacy/tests/lang/nn/__pycache__/__init__.cpython-312.pyc b/TTS/Kokoro/.venv/Lib/site-packages/spacy/tests/lang/nn/__pycache__/__init__.cpython-312.pyc new file mode 100644 index 0000000000000000000000000000000000000000..9b309ce4f08a25bee036652ffa0b41f584f52c7c Binary files /dev/null and b/TTS/Kokoro/.venv/Lib/site-packages/spacy/tests/lang/nn/__pycache__/__init__.cpython-312.pyc differ diff --git a/TTS/Kokoro/.venv/Lib/site-packages/spacy/tests/lang/nn/__pycache__/test_tokenizer.cpython-312.pyc b/TTS/Kokoro/.venv/Lib/site-packages/spacy/tests/lang/nn/__pycache__/test_tokenizer.cpython-312.pyc new file mode 100644 index 0000000000000000000000000000000000000000..b2c3838c2bbf30beeac93f0e8e70b1e906a9f375 Binary files /dev/null and b/TTS/Kokoro/.venv/Lib/site-packages/spacy/tests/lang/nn/__pycache__/test_tokenizer.cpython-312.pyc differ diff --git a/TTS/Kokoro/.venv/Lib/site-packages/spacy/tests/lang/nn/test_tokenizer.py b/TTS/Kokoro/.venv/Lib/site-packages/spacy/tests/lang/nn/test_tokenizer.py new file mode 100644 index 0000000000000000000000000000000000000000..195fa9a557462b7172b158ca27cbd345579cd0c2 --- /dev/null +++ b/TTS/Kokoro/.venv/Lib/site-packages/spacy/tests/lang/nn/test_tokenizer.py @@ -0,0 +1,38 @@ +import pytest + +# examples taken from Omsetjingsminne frå Nynorsk pressekontor 2022 (https://www.nb.no/sprakbanken/en/resource-catalogue/oai-nb-no-sbr-80/) +# fmt: off +NN_TOKEN_EXCEPTION_TESTS = [ + ( + "Målet til direktoratet er at alle skal bli tilbydd jobb i politiet så raskt som mogleg i 2014.", + [ + "Målet", "til", "direktoratet", "er", "at", "alle", "skal", "bli", "tilbydd", "jobb", "i", "politiet", "så", "raskt", "som", "mogleg", "i", "2014", ".", + ], + ), + ( + "Han ønskjer ikkje at staten skal vere med på å finansiere slik undervisning, men dette er rektor på skulen ueinig i.", + [ + "Han", "ønskjer", "ikkje", "at", "staten", "skal", "vere", "med", "på", "å", "finansiere", "slik", "undervisning", ",", "men", "dette", "er", "rektor", "på", "skulen", "ueinig", "i", ".", + ], + ), + ( + "Ifølgje China Daily vart det 8.848 meter høge fjellet flytta 3 centimeter sørvestover under jordskjelvet, som vart målt til 7,8.", + [ + "Ifølgje", "China", "Daily", "vart", "det", "8.848", "meter", "høge", "fjellet", "flytta", "3", "centimeter", "sørvestover", "under", "jordskjelvet", ",", "som", "vart", "målt", "til", "7,8", ".", + ], + ), + ( + "Brukssesongen er frå nov. til mai, med ein topp i mars.", + [ + "Brukssesongen", "er", "frå", "nov.", "til", "mai", ",", "med", "ein", "topp", "i", "mars", ".", + ], + ), +] +# fmt: on + + +@pytest.mark.parametrize("text,expected_tokens", NN_TOKEN_EXCEPTION_TESTS) +def test_nn_tokenizer_handles_exception_cases(nn_tokenizer, text, expected_tokens): + tokens = nn_tokenizer(text) + token_list = [token.text for token in tokens if not token.is_space] + assert expected_tokens == token_list diff --git a/TTS/Kokoro/.venv/Lib/site-packages/spacy/tests/lang/pl/__init__.py b/TTS/Kokoro/.venv/Lib/site-packages/spacy/tests/lang/pl/__init__.py new file mode 100644 index 0000000000000000000000000000000000000000..e69de29bb2d1d6434b8b29ae775ad8c2e48c5391 diff --git a/TTS/Kokoro/.venv/Lib/site-packages/spacy/tests/lang/pl/__pycache__/__init__.cpython-312.pyc b/TTS/Kokoro/.venv/Lib/site-packages/spacy/tests/lang/pl/__pycache__/__init__.cpython-312.pyc new file mode 100644 index 0000000000000000000000000000000000000000..6e621a2aad0a3d686a4699ec69f1bf92c04d17d1 Binary files /dev/null and b/TTS/Kokoro/.venv/Lib/site-packages/spacy/tests/lang/pl/__pycache__/__init__.cpython-312.pyc differ diff --git a/TTS/Kokoro/.venv/Lib/site-packages/spacy/tests/lang/pl/__pycache__/test_text.cpython-312.pyc b/TTS/Kokoro/.venv/Lib/site-packages/spacy/tests/lang/pl/__pycache__/test_text.cpython-312.pyc new file mode 100644 index 0000000000000000000000000000000000000000..f24e66f3622d302fa9baef8a9a513479338da737 Binary files /dev/null and b/TTS/Kokoro/.venv/Lib/site-packages/spacy/tests/lang/pl/__pycache__/test_text.cpython-312.pyc differ diff --git a/TTS/Kokoro/.venv/Lib/site-packages/spacy/tests/lang/pl/__pycache__/test_tokenizer.cpython-312.pyc b/TTS/Kokoro/.venv/Lib/site-packages/spacy/tests/lang/pl/__pycache__/test_tokenizer.cpython-312.pyc new file mode 100644 index 0000000000000000000000000000000000000000..3f8603a16b289dda694970f6329d14ba3a65ec5b Binary files /dev/null and b/TTS/Kokoro/.venv/Lib/site-packages/spacy/tests/lang/pl/__pycache__/test_tokenizer.cpython-312.pyc differ diff --git a/TTS/Kokoro/.venv/Lib/site-packages/spacy/tests/lang/pl/test_text.py b/TTS/Kokoro/.venv/Lib/site-packages/spacy/tests/lang/pl/test_text.py new file mode 100644 index 0000000000000000000000000000000000000000..0dd53cef8a6f23e2fcee2e1354e3fd9a4ea55ffc --- /dev/null +++ b/TTS/Kokoro/.venv/Lib/site-packages/spacy/tests/lang/pl/test_text.py @@ -0,0 +1,24 @@ +"""Words like numbers are recognized correctly.""" + +import pytest + + +@pytest.mark.parametrize( + "text,match", + [ + ("10", True), + ("1", True), + ("10,000", True), + ("10,00", True), + ("jeden", True), + ("dwa", True), + ("milion", True), + ("pies", False), + (",", False), + ("1/2", True), + ], +) +def test_lex_attrs_like_number(pl_tokenizer, text, match): + tokens = pl_tokenizer(text) + assert len(tokens) == 1 + assert tokens[0].like_num == match diff --git a/TTS/Kokoro/.venv/Lib/site-packages/spacy/tests/lang/pl/test_tokenizer.py b/TTS/Kokoro/.venv/Lib/site-packages/spacy/tests/lang/pl/test_tokenizer.py new file mode 100644 index 0000000000000000000000000000000000000000..99e80a1371073a4bd4e6a0e05697b8b64ef8881d --- /dev/null +++ b/TTS/Kokoro/.venv/Lib/site-packages/spacy/tests/lang/pl/test_tokenizer.py @@ -0,0 +1,23 @@ +import pytest + +DOT_TESTS = [ + ("tel.", ["tel", "."]), + ("0 zł 99 gr", ["0", "zł", "99", "gr"]), +] + +HYPHEN_TESTS = [ + ("cztero-", ["cztero-"]), + ("jedno-", ["jedno-"]), + ("dwu-", ["dwu-"]), + ("trzy-", ["trzy-"]), +] + + +TESTCASES = DOT_TESTS + HYPHEN_TESTS + + +@pytest.mark.parametrize("text,expected_tokens", TESTCASES) +def test_tokenizer_handles_testcases(pl_tokenizer, text, expected_tokens): + tokens = pl_tokenizer(text) + token_list = [token.text for token in tokens if not token.is_space] + assert expected_tokens == token_list diff --git a/TTS/Kokoro/.venv/Lib/site-packages/spacy/tests/lang/pt/__init__.py b/TTS/Kokoro/.venv/Lib/site-packages/spacy/tests/lang/pt/__init__.py new file mode 100644 index 0000000000000000000000000000000000000000..e69de29bb2d1d6434b8b29ae775ad8c2e48c5391 diff --git a/TTS/Kokoro/.venv/Lib/site-packages/spacy/tests/lang/pt/__pycache__/__init__.cpython-312.pyc b/TTS/Kokoro/.venv/Lib/site-packages/spacy/tests/lang/pt/__pycache__/__init__.cpython-312.pyc new file mode 100644 index 0000000000000000000000000000000000000000..08aa5941876c1c01992ff688a97fe5d0f044b9cf Binary files /dev/null and b/TTS/Kokoro/.venv/Lib/site-packages/spacy/tests/lang/pt/__pycache__/__init__.cpython-312.pyc differ diff --git a/TTS/Kokoro/.venv/Lib/site-packages/spacy/tests/lang/pt/__pycache__/test_noun_chunks.cpython-312.pyc b/TTS/Kokoro/.venv/Lib/site-packages/spacy/tests/lang/pt/__pycache__/test_noun_chunks.cpython-312.pyc new file mode 100644 index 0000000000000000000000000000000000000000..c12d144f355beb4458969c333557bf2274a54b44 Binary files /dev/null and b/TTS/Kokoro/.venv/Lib/site-packages/spacy/tests/lang/pt/__pycache__/test_noun_chunks.cpython-312.pyc differ diff --git a/TTS/Kokoro/.venv/Lib/site-packages/spacy/tests/lang/pt/__pycache__/test_text.cpython-312.pyc b/TTS/Kokoro/.venv/Lib/site-packages/spacy/tests/lang/pt/__pycache__/test_text.cpython-312.pyc new file mode 100644 index 0000000000000000000000000000000000000000..11f6f819cbead8ab2db631bbb35f25b456cca6ea Binary files /dev/null and b/TTS/Kokoro/.venv/Lib/site-packages/spacy/tests/lang/pt/__pycache__/test_text.cpython-312.pyc differ diff --git a/TTS/Kokoro/.venv/Lib/site-packages/spacy/tests/lang/pt/test_noun_chunks.py b/TTS/Kokoro/.venv/Lib/site-packages/spacy/tests/lang/pt/test_noun_chunks.py new file mode 100644 index 0000000000000000000000000000000000000000..336ac7a435911b6aecff3b2d448773f2656e6d3b --- /dev/null +++ b/TTS/Kokoro/.venv/Lib/site-packages/spacy/tests/lang/pt/test_noun_chunks.py @@ -0,0 +1,222 @@ +import pytest + +from spacy.tokens import Doc + + +# fmt: off +@pytest.mark.parametrize( + "words,heads,deps,pos,chunk_offsets", + [ + # determiner + noun + # um cachorro -> um cachorro + ( + ["um", "cachorro"], + [1, 1], + ["det", "ROOT"], + ["DET", "NOUN"], + [(0, 2)], + ), + # two determiners + noun + # meu o pai -> meu o pai + ( + ["meu", "o", "pai"], + [2, 2, 2], + ["det", "det", "ROOT"], + ["DET", "DET", "NOUN"], + [(0, 3)], + ), + # two determiners + noun + # todos essos caros -> todos essos caros + ( + ["todos", "essos", "caros"], + [2, 2, 2], + ["det", "det", "ROOT"], + ["DET", "DET", "NOUN"], + [(0, 3)], + ), + # two determiners, one is after noun + # um irmão meu -> um irmão meu + ( + ["um", "irmão", "meu"], + [1, 1, 1], + ["det", "ROOT", "det"], + ["DET", "NOUN", "DET"], + [(0, 3)], + ), + # two determiners + noun + # o meu pai -> o meu pai + ( + ["o", "meu", "pai"], + [2, 2, 2], + ["det","det", "ROOT"], + ["DET", "DET", "NOUN"], + [(0, 3)], + ), + # relative pronoun + # A bicicleta essa está estragada -> A bicicleta + ( + ['A', 'bicicleta', 'essa', 'está', 'estragada'], + [1, 4, 1, 4, 4], + ['det', 'nsubj', 'det', 'cop', 'ROOT'], + ['DET', 'NOUN', 'PRON', 'AUX', 'ADJ'], + [(0,2)] + ), + # relative subclause + # o computador que comprou -> o computador + ( + ['o', 'computador', 'que', 'comprou'], + [1, 1, 3, 1], + ['det', 'ROOT', 'nsubj', 'acl:relcl'], + ['DET', 'NOUN', 'PRON', 'VERB'], + [(0, 2), (2, 3)] + ), + # det + noun + adj + # O cachorro marrom -> O cachorro marrom + ( + ["O", "cachorro", "marrom"], + [1, 1, 1], + ["det", "ROOT", "amod"], + ["DET", "NOUN", "ADJ"], + [(0, 3)], + ), + # det + noun + adj plural + # As calças baratas -> As calças baratas + ( + ["As", "calças", "baratas"], + [1, 1, 1], + ["det", "ROOT", "amod"], + ["DET", "NOUN", "ADJ"], + [(0, 3)], + ), + # det + adj + noun + # Uma boa ideia -> Uma boa ideia + ( + ['uma', 'boa', 'ideia'], + [2, 2, 2], + ["det", "amod", "ROOT"], + ["DET", "ADJ", "NOUN"], + [(0,3)] + ), + # multiple adjectives + # Uma garota esperta e inteligente -> Uma garota esperta e inteligente + ( + ["Uma", "garota", "esperta", "e", "inteligente"], + [1, 1, 1, 4, 2], + ["det", "ROOT", "amod", "cc", "conj"], + ["DET", "NOUN", "ADJ", "CCONJ", "ADJ"], + [(0,5)] + ), + # determiner, adjective, compound created by flat + # a grande São Paolo -> a grande São Paolo + ( + ["a", "grande", "São", "Paolo"], + [2, 2, 2, 2], + ["det", "amod", "ROOT", "flat:name"], + ["DET", "ADJ", "PROPN", "PROPN"], + [(0,4)] + ), + # one determiner + one noun + one adjective qualified by an adverb + # alguns fazendeiros muito ricos -> alguns fazendeiros muito ricos + ( + ['alguns', 'fazendeiros', 'muito', 'ricos'], + [1, 1, 3, 1], + ['det', 'ROOT', 'advmod', 'amod'], + ['DET', 'NOUN', 'ADV', 'ADJ'], + [(0,4)] + ), + # Two NPs conjuncted + # Eu tenho um cachorro e um gato -> Eu, um cacharo, um gato + ( + ["Eu", "tenho", "um", "cachorro", "e", "um", "gato"], + [1, 1, 3, 1, 6, 6, 3], + ['nsubj', 'ROOT', 'det', 'obj', 'cc', 'det', 'conj'], + ['PRON', 'VERB', 'DET', 'NOUN', 'CCONJ', 'DET', 'NOUN'], + [(0,1), (2,4), (5,7)] + + ), + # Two NPs together + # o escritor brasileiro Aníbal Machado -> o escritor brasileiro, Aníbal Machado + ( + ['o', 'escritor', 'brasileiro', 'Aníbal', 'Machado'], + [1, 1, 1, 1, 3], + ['det', 'ROOT', 'amod', 'appos', 'flat:name'], + ['DET', 'NOUN', 'ADJ', 'PROPN', 'PROPN'], + [(0, 3), (3, 5)] + ), + # Noun compound, person name and titles + # Dom Pedro II -> Dom Pedro II + ( + ["Dom", "Pedro", "II"], + [0, 0, 0], + ["ROOT", "flat:name", "flat:name"], + ["PROPN", "PROPN", "PROPN"], + [(0,3)] + ), + # Noun compound created by flat + # os Estados Unidos -> os Estados Unidos + ( + ["os", "Estados", "Unidos"], + [1, 1, 1], + ["det", "ROOT", "flat:name"], + ["DET", "PROPN", "PROPN"], + [(0,3)] + ), + # nmod relation between NPs + # a destruição da cidade -> a destruição, cidade + ( + ['a', 'destruição', 'da', 'cidade'], + [1, 1, 3, 1], + ['det', 'ROOT', 'case', 'nmod'], + ['DET', 'NOUN', 'ADP', 'NOUN'], + [(0,2), (3,4)] + ), + # Compounding by nmod, several NPs chained together + # a primeira fábrica de medicamentos do governo -> a primeira fábrica, medicamentos, governo + ( + ["a", "primeira", "fábrica", "de", "medicamentos", "do", "governo"], + [2, 2, 2, 4, 2, 6, 2], + ['det', 'amod', 'ROOT', 'case', 'nmod', 'case', 'nmod'], + ['DET', 'ADJ', 'NOUN', 'ADP', 'NOUN', 'ADP', 'NOUN'], + [(0, 3), (4, 5), (6, 7)] + ), + # several NPs + # Tradução da reportagem de Susana -> Tradução, reportagem, Susana + ( + ['Tradução', 'da', 'reportagem', 'de', 'Susana'], + [0, 2, 0, 4, 2], + ['ROOT', 'case', 'nmod', 'case', 'nmod'], + ['NOUN', 'ADP', 'NOUN', 'ADP', 'PROPN'], + [(0,1), (2,3), (4,5)] + + ), + # Several NPs + # O gato gordo da Susana e seu amigo -> O gato gordo, Susana, seu amigo + ( + ['O', 'gato', 'gordo', 'da', 'Susana', 'e', 'seu', 'amigo'], + [1, 1, 1, 4, 1, 7, 7, 1], + ['det', 'ROOT', 'amod', 'case', 'nmod', 'cc', 'det', 'conj'], + ['DET', 'NOUN', 'ADJ', 'ADP', 'PROPN', 'CCONJ', 'DET', 'NOUN'], + [(0,3), (4,5), (6,8)] + ), + # Passive subject + # Os novos gastos são alimentados pela grande conta bancária de Clinton -> Os novos gastos, grande conta bancária, Clinton + ( + ['Os', 'novos', 'gastos', 'são', 'alimentados', 'pela', 'grande', 'conta', 'bancária', 'de', 'Clinton'], + [2, 2, 4, 4, 4, 7, 7, 4, 7, 10, 7], + ['det', 'amod', 'nsubj:pass', 'aux:pass', 'ROOT', 'case', 'amod', 'obl:agent', 'amod', 'case', 'nmod'], + ['DET', 'ADJ', 'NOUN', 'AUX', 'VERB', 'ADP', 'ADJ', 'NOUN', 'ADJ', 'ADP', 'PROPN'], + [(0, 3), (6, 9), (10, 11)] + ) + ], +) +# fmt: on +def test_pt_noun_chunks(pt_vocab, words, heads, deps, pos, chunk_offsets): + doc = Doc(pt_vocab, words=words, heads=heads, deps=deps, pos=pos) + assert [(c.start, c.end) for c in doc.noun_chunks] == chunk_offsets + + +def test_noun_chunks_is_parsed_pt(pt_tokenizer): + """Test that noun_chunks raises Value Error for 'pt' language if Doc is not parsed.""" + doc = pt_tokenizer("en Oxford este verano") + with pytest.raises(ValueError): + list(doc.noun_chunks) diff --git a/TTS/Kokoro/.venv/Lib/site-packages/spacy/tests/lang/pt/test_text.py b/TTS/Kokoro/.venv/Lib/site-packages/spacy/tests/lang/pt/test_text.py new file mode 100644 index 0000000000000000000000000000000000000000..1ceef378f35a72283ba39d53ed57113bd8cb9166 --- /dev/null +++ b/TTS/Kokoro/.venv/Lib/site-packages/spacy/tests/lang/pt/test_text.py @@ -0,0 +1,9 @@ +import pytest + +from spacy.lang.pt.lex_attrs import like_num + + +@pytest.mark.parametrize("word", ["onze", "quadragésimo"]) +def test_pt_lex_attrs_capitals(word): + assert like_num(word) + assert like_num(word.upper()) diff --git a/TTS/Kokoro/.venv/Lib/site-packages/spacy/tests/lang/ro/__init__.py b/TTS/Kokoro/.venv/Lib/site-packages/spacy/tests/lang/ro/__init__.py new file mode 100644 index 0000000000000000000000000000000000000000..e69de29bb2d1d6434b8b29ae775ad8c2e48c5391 diff --git a/TTS/Kokoro/.venv/Lib/site-packages/spacy/tests/lang/ro/__pycache__/__init__.cpython-312.pyc b/TTS/Kokoro/.venv/Lib/site-packages/spacy/tests/lang/ro/__pycache__/__init__.cpython-312.pyc new file mode 100644 index 0000000000000000000000000000000000000000..ad37e552f0c508124d45b349ea25384549ebaafe Binary files /dev/null and b/TTS/Kokoro/.venv/Lib/site-packages/spacy/tests/lang/ro/__pycache__/__init__.cpython-312.pyc differ diff --git a/TTS/Kokoro/.venv/Lib/site-packages/spacy/tests/lang/ro/__pycache__/test_tokenizer.cpython-312.pyc b/TTS/Kokoro/.venv/Lib/site-packages/spacy/tests/lang/ro/__pycache__/test_tokenizer.cpython-312.pyc new file mode 100644 index 0000000000000000000000000000000000000000..e84d6fb647dc0d68f3afee8b819ddcf3bee8ae2d Binary files /dev/null and b/TTS/Kokoro/.venv/Lib/site-packages/spacy/tests/lang/ro/__pycache__/test_tokenizer.cpython-312.pyc differ diff --git a/TTS/Kokoro/.venv/Lib/site-packages/spacy/tests/lang/ro/test_tokenizer.py b/TTS/Kokoro/.venv/Lib/site-packages/spacy/tests/lang/ro/test_tokenizer.py new file mode 100644 index 0000000000000000000000000000000000000000..a9befd054418273cb792d9db9e21de392418fe56 --- /dev/null +++ b/TTS/Kokoro/.venv/Lib/site-packages/spacy/tests/lang/ro/test_tokenizer.py @@ -0,0 +1,21 @@ +import pytest + +TEST_CASES = [ + ( + "Adresa este str. Principală nr. 5.", + ["Adresa", "este", "str.", "Principală", "nr.", "5", "."], + ), + ("Teste, etc.", ["Teste", ",", "etc."]), + ("Lista, ș.a.m.d.", ["Lista", ",", "ș.a.m.d."]), + ("Și d.p.d.v. al...", ["Și", "d.p.d.v.", "al", "..."]), + # number tests + ("Clasa a 4-a.", ["Clasa", "a", "4-a", "."]), + ("Al 12-lea ceas.", ["Al", "12-lea", "ceas", "."]), +] + + +@pytest.mark.parametrize("text,expected_tokens", TEST_CASES) +def test_ro_tokenizer_handles_testcases(ro_tokenizer, text, expected_tokens): + tokens = ro_tokenizer(text) + token_list = [token.text for token in tokens if not token.is_space] + assert expected_tokens == token_list diff --git a/TTS/Kokoro/.venv/Lib/site-packages/spacy/tests/lang/ru/__init__.py b/TTS/Kokoro/.venv/Lib/site-packages/spacy/tests/lang/ru/__init__.py new file mode 100644 index 0000000000000000000000000000000000000000..e69de29bb2d1d6434b8b29ae775ad8c2e48c5391 diff --git a/TTS/Kokoro/.venv/Lib/site-packages/spacy/tests/lang/ru/__pycache__/__init__.cpython-312.pyc b/TTS/Kokoro/.venv/Lib/site-packages/spacy/tests/lang/ru/__pycache__/__init__.cpython-312.pyc new file mode 100644 index 0000000000000000000000000000000000000000..c3bba56bff7c5189140e3a9b5cd91e4a8f1ecd53 Binary files /dev/null and b/TTS/Kokoro/.venv/Lib/site-packages/spacy/tests/lang/ru/__pycache__/__init__.cpython-312.pyc differ diff --git a/TTS/Kokoro/.venv/Lib/site-packages/spacy/tests/lang/ru/__pycache__/test_exceptions.cpython-312.pyc b/TTS/Kokoro/.venv/Lib/site-packages/spacy/tests/lang/ru/__pycache__/test_exceptions.cpython-312.pyc new file mode 100644 index 0000000000000000000000000000000000000000..3582c8bc1175a45c4f6e4a03b9288f035c6691bf Binary files /dev/null and b/TTS/Kokoro/.venv/Lib/site-packages/spacy/tests/lang/ru/__pycache__/test_exceptions.cpython-312.pyc differ diff --git a/TTS/Kokoro/.venv/Lib/site-packages/spacy/tests/lang/ru/__pycache__/test_lemmatizer.cpython-312.pyc b/TTS/Kokoro/.venv/Lib/site-packages/spacy/tests/lang/ru/__pycache__/test_lemmatizer.cpython-312.pyc new file mode 100644 index 0000000000000000000000000000000000000000..19b0d496cf89e2ad7cc490c51ae380a97a0ba662 Binary files /dev/null and b/TTS/Kokoro/.venv/Lib/site-packages/spacy/tests/lang/ru/__pycache__/test_lemmatizer.cpython-312.pyc differ diff --git a/TTS/Kokoro/.venv/Lib/site-packages/spacy/tests/lang/ru/__pycache__/test_text.cpython-312.pyc b/TTS/Kokoro/.venv/Lib/site-packages/spacy/tests/lang/ru/__pycache__/test_text.cpython-312.pyc new file mode 100644 index 0000000000000000000000000000000000000000..207d8ebed6678e85405a3e66bc02a125c31aed18 Binary files /dev/null and b/TTS/Kokoro/.venv/Lib/site-packages/spacy/tests/lang/ru/__pycache__/test_text.cpython-312.pyc differ diff --git a/TTS/Kokoro/.venv/Lib/site-packages/spacy/tests/lang/ru/__pycache__/test_tokenizer.cpython-312.pyc b/TTS/Kokoro/.venv/Lib/site-packages/spacy/tests/lang/ru/__pycache__/test_tokenizer.cpython-312.pyc new file mode 100644 index 0000000000000000000000000000000000000000..5137a972c5cfdf5026164d6a0ba088d54e08f082 Binary files /dev/null and b/TTS/Kokoro/.venv/Lib/site-packages/spacy/tests/lang/ru/__pycache__/test_tokenizer.cpython-312.pyc differ diff --git a/TTS/Kokoro/.venv/Lib/site-packages/spacy/tests/lang/ru/test_exceptions.py b/TTS/Kokoro/.venv/Lib/site-packages/spacy/tests/lang/ru/test_exceptions.py new file mode 100644 index 0000000000000000000000000000000000000000..6cf328aa26891f31078ad1a59428d0e3ce9f35bf --- /dev/null +++ b/TTS/Kokoro/.venv/Lib/site-packages/spacy/tests/lang/ru/test_exceptions.py @@ -0,0 +1,11 @@ +import pytest + + +@pytest.mark.parametrize( + "text,norms", + [("пн.", ["понедельник"]), ("пт.", ["пятница"]), ("дек.", ["декабрь"])], +) +def test_ru_tokenizer_abbrev_exceptions(ru_tokenizer, text, norms): + tokens = ru_tokenizer(text) + assert len(tokens) == 1 + assert [token.norm_ for token in tokens] == norms diff --git a/TTS/Kokoro/.venv/Lib/site-packages/spacy/tests/lang/ru/test_lemmatizer.py b/TTS/Kokoro/.venv/Lib/site-packages/spacy/tests/lang/ru/test_lemmatizer.py new file mode 100644 index 0000000000000000000000000000000000000000..cae8459114b1891625b9e905d35ee066c6c0e6a8 --- /dev/null +++ b/TTS/Kokoro/.venv/Lib/site-packages/spacy/tests/lang/ru/test_lemmatizer.py @@ -0,0 +1,109 @@ +import pytest + +from spacy.tokens import Doc + +pytestmark = pytest.mark.filterwarnings("ignore::DeprecationWarning") + + +def test_ru_doc_lemmatization(ru_lemmatizer): + words = ["мама", "мыла", "раму"] + pos = ["NOUN", "VERB", "NOUN"] + morphs = [ + "Animacy=Anim|Case=Nom|Gender=Fem|Number=Sing", + "Aspect=Imp|Gender=Fem|Mood=Ind|Number=Sing|Tense=Past|VerbForm=Fin|Voice=Act", + "Animacy=Anim|Case=Acc|Gender=Fem|Number=Sing", + ] + doc = Doc(ru_lemmatizer.vocab, words=words, pos=pos, morphs=morphs) + doc = ru_lemmatizer(doc) + lemmas = [token.lemma_ for token in doc] + assert lemmas == ["мама", "мыть", "рама"] + + +@pytest.mark.parametrize( + "text,lemmas", + [ + ("гвоздики", ["гвоздик", "гвоздика"]), + ("люди", ["человек"]), + ("реки", ["река"]), + ("кольцо", ["кольцо"]), + ("пепперони", ["пепперони"]), + ], +) +def test_ru_lemmatizer_noun_lemmas(ru_lemmatizer, text, lemmas): + doc = Doc(ru_lemmatizer.vocab, words=[text], pos=["NOUN"]) + result_lemmas = ru_lemmatizer.pymorphy2_lemmatize(doc[0]) + assert sorted(result_lemmas) == lemmas + + +@pytest.mark.parametrize( + "text,pos,morph,lemma", + [ + ("рой", "NOUN", "", "рой"), + ("рой", "VERB", "", "рыть"), + ("клей", "NOUN", "", "клей"), + ("клей", "VERB", "", "клеить"), + ("три", "NUM", "", "три"), + ("кос", "NOUN", "Number=Sing", "кос"), + ("кос", "NOUN", "Number=Plur", "коса"), + ("кос", "ADJ", "", "косой"), + ("потом", "NOUN", "", "пот"), + ("потом", "ADV", "", "потом"), + ], +) +def test_ru_lemmatizer_works_with_different_pos_homonyms( + ru_lemmatizer, text, pos, morph, lemma +): + doc = Doc(ru_lemmatizer.vocab, words=[text], pos=[pos], morphs=[morph]) + result_lemmas = ru_lemmatizer.pymorphy2_lemmatize(doc[0]) + assert result_lemmas == [lemma] + + +@pytest.mark.parametrize( + "text,morph,lemma", + [ + ("гвоздики", "Gender=Fem", "гвоздика"), + ("гвоздики", "Gender=Masc", "гвоздик"), + ("вина", "Gender=Fem", "вина"), + ("вина", "Gender=Neut", "вино"), + ], +) +def test_ru_lemmatizer_works_with_noun_homonyms(ru_lemmatizer, text, morph, lemma): + doc = Doc(ru_lemmatizer.vocab, words=[text], pos=["NOUN"], morphs=[morph]) + result_lemmas = ru_lemmatizer.pymorphy2_lemmatize(doc[0]) + assert result_lemmas == [lemma] + + +def test_ru_lemmatizer_punct(ru_lemmatizer): + doc = Doc(ru_lemmatizer.vocab, words=["«"], pos=["PUNCT"]) + assert ru_lemmatizer.pymorphy2_lemmatize(doc[0]) == ['"'] + doc = Doc(ru_lemmatizer.vocab, words=["»"], pos=["PUNCT"]) + assert ru_lemmatizer.pymorphy2_lemmatize(doc[0]) == ['"'] + + +def test_ru_doc_lookup_lemmatization(ru_lookup_lemmatizer): + assert ru_lookup_lemmatizer.mode == "pymorphy3_lookup" + words = ["мама", "мыла", "раму"] + pos = ["NOUN", "VERB", "NOUN"] + morphs = [ + "Animacy=Anim|Case=Nom|Gender=Fem|Number=Sing", + "Aspect=Imp|Gender=Fem|Mood=Ind|Number=Sing|Tense=Past|VerbForm=Fin|Voice=Act", + "Animacy=Anim|Case=Acc|Gender=Fem|Number=Sing", + ] + doc = Doc(ru_lookup_lemmatizer.vocab, words=words, pos=pos, morphs=morphs) + doc = ru_lookup_lemmatizer(doc) + lemmas = [token.lemma_ for token in doc] + assert lemmas == ["мама", "мыла", "раму"] + + +@pytest.mark.parametrize( + "word,lemma", + ( + ("бременем", "бремя"), + ("будешь", "быть"), + ("какая-то", "какой-то"), + ), +) +def test_ru_lookup_lemmatizer(ru_lookup_lemmatizer, word, lemma): + assert ru_lookup_lemmatizer.mode == "pymorphy3_lookup" + doc = Doc(ru_lookup_lemmatizer.vocab, words=[word]) + assert ru_lookup_lemmatizer(doc)[0].lemma_ == lemma diff --git a/TTS/Kokoro/.venv/Lib/site-packages/spacy/tests/lang/ru/test_text.py b/TTS/Kokoro/.venv/Lib/site-packages/spacy/tests/lang/ru/test_text.py new file mode 100644 index 0000000000000000000000000000000000000000..39516fe7502ce288d673558e74abdb06d176a474 --- /dev/null +++ b/TTS/Kokoro/.venv/Lib/site-packages/spacy/tests/lang/ru/test_text.py @@ -0,0 +1,9 @@ +import pytest + +from spacy.lang.ru.lex_attrs import like_num + + +@pytest.mark.parametrize("word", ["одиннадцать"]) +def test_ru_lex_attrs_capitals(word): + assert like_num(word) + assert like_num(word.upper()) diff --git a/TTS/Kokoro/.venv/Lib/site-packages/spacy/tests/lang/ru/test_tokenizer.py b/TTS/Kokoro/.venv/Lib/site-packages/spacy/tests/lang/ru/test_tokenizer.py new file mode 100644 index 0000000000000000000000000000000000000000..f8d7126741ebe986f57348f036b9a9be7a28145f --- /dev/null +++ b/TTS/Kokoro/.venv/Lib/site-packages/spacy/tests/lang/ru/test_tokenizer.py @@ -0,0 +1,158 @@ +from string import punctuation + +import pytest + +PUNCT_OPEN = ["(", "[", "{", "*"] +PUNCT_CLOSE = [")", "]", "}", "*"] +PUNCT_PAIRED = [("(", ")"), ("[", "]"), ("{", "}"), ("*", "*")] + + +@pytest.mark.parametrize("text", ["(", "((", "<"]) +def test_ru_tokenizer_handles_only_punct(ru_tokenizer, text): + tokens = ru_tokenizer(text) + assert len(tokens) == len(text) + + +@pytest.mark.parametrize("punct", PUNCT_OPEN) +@pytest.mark.parametrize("text", ["Привет"]) +def test_ru_tokenizer_splits_open_punct(ru_tokenizer, punct, text): + tokens = ru_tokenizer(punct + text) + assert len(tokens) == 2 + assert tokens[0].text == punct + assert tokens[1].text == text + + +@pytest.mark.parametrize("punct", PUNCT_CLOSE) +@pytest.mark.parametrize("text", ["Привет"]) +def test_ru_tokenizer_splits_close_punct(ru_tokenizer, punct, text): + tokens = ru_tokenizer(text + punct) + assert len(tokens) == 2 + assert tokens[0].text == text + assert tokens[1].text == punct + + +@pytest.mark.parametrize("punct", PUNCT_OPEN) +@pytest.mark.parametrize("punct_add", ["`"]) +@pytest.mark.parametrize("text", ["Привет"]) +def test_ru_tokenizer_splits_two_diff_open_punct(ru_tokenizer, punct, punct_add, text): + tokens = ru_tokenizer(punct + punct_add + text) + assert len(tokens) == 3 + assert tokens[0].text == punct + assert tokens[1].text == punct_add + assert tokens[2].text == text + + +@pytest.mark.parametrize("punct", PUNCT_CLOSE) +@pytest.mark.parametrize("punct_add", ["'"]) +@pytest.mark.parametrize("text", ["Привет"]) +def test_ru_tokenizer_splits_two_diff_close_punct(ru_tokenizer, punct, punct_add, text): + tokens = ru_tokenizer(text + punct + punct_add) + assert len(tokens) == 3 + assert tokens[0].text == text + assert tokens[1].text == punct + assert tokens[2].text == punct_add + + +@pytest.mark.parametrize("punct", PUNCT_OPEN) +@pytest.mark.parametrize("text", ["Привет"]) +def test_ru_tokenizer_splits_same_open_punct(ru_tokenizer, punct, text): + tokens = ru_tokenizer(punct + punct + punct + text) + assert len(tokens) == 4 + assert tokens[0].text == punct + assert tokens[3].text == text + + +@pytest.mark.parametrize("punct", PUNCT_CLOSE) +@pytest.mark.parametrize("text", ["Привет"]) +def test_ru_tokenizer_splits_same_close_punct(ru_tokenizer, punct, text): + tokens = ru_tokenizer(text + punct + punct + punct) + assert len(tokens) == 4 + assert tokens[0].text == text + assert tokens[1].text == punct + + +@pytest.mark.parametrize("text", ["'Тест"]) +def test_ru_tokenizer_splits_open_appostrophe(ru_tokenizer, text): + tokens = ru_tokenizer(text) + assert len(tokens) == 2 + assert tokens[0].text == "'" + + +@pytest.mark.parametrize("text", ["Тест''"]) +def test_ru_tokenizer_splits_double_end_quote(ru_tokenizer, text): + tokens = ru_tokenizer(text) + assert len(tokens) == 2 + tokens_punct = ru_tokenizer("''") + assert len(tokens_punct) == 1 + + +@pytest.mark.parametrize("punct_open,punct_close", PUNCT_PAIRED) +@pytest.mark.parametrize("text", ["Тест"]) +def test_ru_tokenizer_splits_open_close_punct( + ru_tokenizer, punct_open, punct_close, text +): + tokens = ru_tokenizer(punct_open + text + punct_close) + assert len(tokens) == 3 + assert tokens[0].text == punct_open + assert tokens[1].text == text + assert tokens[2].text == punct_close + + +@pytest.mark.parametrize("punct_open,punct_close", PUNCT_PAIRED) +@pytest.mark.parametrize("punct_open2,punct_close2", [("`", "'")]) +@pytest.mark.parametrize("text", ["Тест"]) +def test_ru_tokenizer_two_diff_punct( + ru_tokenizer, punct_open, punct_close, punct_open2, punct_close2, text +): + tokens = ru_tokenizer(punct_open2 + punct_open + text + punct_close + punct_close2) + assert len(tokens) == 5 + assert tokens[0].text == punct_open2 + assert tokens[1].text == punct_open + assert tokens[2].text == text + assert tokens[3].text == punct_close + assert tokens[4].text == punct_close2 + + +@pytest.mark.parametrize("text", ["Тест."]) +def test_ru_tokenizer_splits_trailing_dot(ru_tokenizer, text): + tokens = ru_tokenizer(text) + assert tokens[1].text == "." + + +def test_ru_tokenizer_splits_bracket_period(ru_tokenizer): + text = "(Раз, два, три, проверка)." + tokens = ru_tokenizer(text) + assert tokens[len(tokens) - 1].text == "." + + +@pytest.mark.parametrize( + "text", + [ + "рекоменду́я подда́ть жару́. Самого́ Баргамота", + "РЕКОМЕНДУ́Я ПОДДА́ТЬ ЖАРУ́. САМОГО́ БАРГАМОТА", + "рекоменду̍я подда̍ть жару̍.Самого̍ Баргамота", + "рекоменду̍я подда̍ть жару̍.'Самого̍ Баргамота", + "рекоменду̍я подда̍ть жару̍,самого̍ Баргамота", + "рекоменду̍я подда̍ть жару̍:самого̍ Баргамота", + "рекоменду̍я подда̍ть жару̍. самого̍ Баргамота", + "рекоменду̍я подда̍ть жару̍, самого̍ Баргамота", + "рекоменду̍я подда̍ть жару̍: самого̍ Баргамота", + "рекоменду̍я подда̍ть жару̍-самого̍ Баргамота", + ], +) +def test_ru_tokenizer_handles_final_diacritics(ru_tokenizer, text): + tokens = ru_tokenizer(text) + assert tokens[2].text in ("жару́", "ЖАРУ́", "жару̍") + assert tokens[3].text in punctuation + + +@pytest.mark.parametrize( + "text", + [ + "РЕКОМЕНДУ́Я ПОДДА́ТЬ ЖАРУ́.САМОГО́ БАРГАМОТА", + "рекоменду̍я подда̍ть жару́.самого́ Баргамота", + ], +) +def test_ru_tokenizer_handles_final_diacritic_and_period(ru_tokenizer, text): + tokens = ru_tokenizer(text) + assert tokens[2].text.lower() == "жару́.самого́" diff --git a/TTS/Kokoro/.venv/Lib/site-packages/spacy/tests/lang/sa/__init__.py b/TTS/Kokoro/.venv/Lib/site-packages/spacy/tests/lang/sa/__init__.py new file mode 100644 index 0000000000000000000000000000000000000000..e69de29bb2d1d6434b8b29ae775ad8c2e48c5391 diff --git a/TTS/Kokoro/.venv/Lib/site-packages/spacy/tests/lang/sa/__pycache__/__init__.cpython-312.pyc b/TTS/Kokoro/.venv/Lib/site-packages/spacy/tests/lang/sa/__pycache__/__init__.cpython-312.pyc new file mode 100644 index 0000000000000000000000000000000000000000..cff183d29c19cb0af003721544ff19b1bb0730b6 Binary files /dev/null and b/TTS/Kokoro/.venv/Lib/site-packages/spacy/tests/lang/sa/__pycache__/__init__.cpython-312.pyc differ diff --git a/TTS/Kokoro/.venv/Lib/site-packages/spacy/tests/lang/sa/__pycache__/test_text.cpython-312.pyc b/TTS/Kokoro/.venv/Lib/site-packages/spacy/tests/lang/sa/__pycache__/test_text.cpython-312.pyc new file mode 100644 index 0000000000000000000000000000000000000000..6a5742d13d37dbd867be6182e0d1a418a041e45d Binary files /dev/null and b/TTS/Kokoro/.venv/Lib/site-packages/spacy/tests/lang/sa/__pycache__/test_text.cpython-312.pyc differ diff --git a/TTS/Kokoro/.venv/Lib/site-packages/spacy/tests/lang/sa/test_text.py b/TTS/Kokoro/.venv/Lib/site-packages/spacy/tests/lang/sa/test_text.py new file mode 100644 index 0000000000000000000000000000000000000000..ae7b1d1efe10f00f4fad68a5369ccae3994c3ee1 --- /dev/null +++ b/TTS/Kokoro/.venv/Lib/site-packages/spacy/tests/lang/sa/test_text.py @@ -0,0 +1,42 @@ +import pytest + + +def test_sa_tokenizer_handles_long_text(sa_tokenizer): + text = """नानाविधानि दिव्यानि नानावर्णाकृतीनि च।।""" + tokens = sa_tokenizer(text) + assert len(tokens) == 6 + + +@pytest.mark.parametrize( + "text,length", + [ + ("श्री भगवानुवाच पश्य मे पार्थ रूपाणि शतशोऽथ सहस्रशः।", 9), + ("गुणान् सर्वान् स्वभावो मूर्ध्नि वर्तते ।", 6), + ], +) +def test_sa_tokenizer_handles_cnts(sa_tokenizer, text, length): + tokens = sa_tokenizer(text) + assert len(tokens) == length + + +@pytest.mark.parametrize( + "text,match", + [ + ("10", True), + ("1", True), + ("10.000", True), + ("1000", True), + ("999,0", True), + ("एकः ", True), + ("दश", True), + ("पञ्चदश", True), + ("चत्वारिंशत् ", True), + ("कूपे", False), + (",", False), + ("1/2", True), + ], +) +def test_lex_attrs_like_number(sa_tokenizer, text, match): + tokens = sa_tokenizer(text) + assert len(tokens) == 1 + assert tokens[0].like_num == match diff --git a/TTS/Kokoro/.venv/Lib/site-packages/spacy/tests/lang/sk/__init__.py b/TTS/Kokoro/.venv/Lib/site-packages/spacy/tests/lang/sk/__init__.py new file mode 100644 index 0000000000000000000000000000000000000000..e69de29bb2d1d6434b8b29ae775ad8c2e48c5391 diff --git a/TTS/Kokoro/.venv/Lib/site-packages/spacy/tests/lang/sk/__pycache__/__init__.cpython-312.pyc b/TTS/Kokoro/.venv/Lib/site-packages/spacy/tests/lang/sk/__pycache__/__init__.cpython-312.pyc new file mode 100644 index 0000000000000000000000000000000000000000..9fad184657cb1d099c7733ae0edf7deeda7d898a Binary files /dev/null and b/TTS/Kokoro/.venv/Lib/site-packages/spacy/tests/lang/sk/__pycache__/__init__.cpython-312.pyc differ diff --git a/TTS/Kokoro/.venv/Lib/site-packages/spacy/tests/lang/sk/__pycache__/test_text.cpython-312.pyc b/TTS/Kokoro/.venv/Lib/site-packages/spacy/tests/lang/sk/__pycache__/test_text.cpython-312.pyc new file mode 100644 index 0000000000000000000000000000000000000000..4fb8d2408edbd78d60ca8c5e55088b4facc46054 Binary files /dev/null and b/TTS/Kokoro/.venv/Lib/site-packages/spacy/tests/lang/sk/__pycache__/test_text.cpython-312.pyc differ diff --git a/TTS/Kokoro/.venv/Lib/site-packages/spacy/tests/lang/sk/__pycache__/test_tokenizer.cpython-312.pyc b/TTS/Kokoro/.venv/Lib/site-packages/spacy/tests/lang/sk/__pycache__/test_tokenizer.cpython-312.pyc new file mode 100644 index 0000000000000000000000000000000000000000..4e30012d174a134b10228cb0e652cb3d3d24b440 Binary files /dev/null and b/TTS/Kokoro/.venv/Lib/site-packages/spacy/tests/lang/sk/__pycache__/test_tokenizer.cpython-312.pyc differ diff --git a/TTS/Kokoro/.venv/Lib/site-packages/spacy/tests/lang/sk/test_text.py b/TTS/Kokoro/.venv/Lib/site-packages/spacy/tests/lang/sk/test_text.py new file mode 100644 index 0000000000000000000000000000000000000000..5ef4895bb0dde0e69d3317dde7e74e71162144b4 --- /dev/null +++ b/TTS/Kokoro/.venv/Lib/site-packages/spacy/tests/lang/sk/test_text.py @@ -0,0 +1,48 @@ +import pytest + + +def test_long_text(sk_tokenizer): + # Excerpt: European Convention on Human Rights + text = """ +majúc na zreteli, že cieľom tejto deklarácie je zabezpečiť všeobecné +a účinné uznávanie a dodržiavanie práv v nej vyhlásených; +majúc na zreteli, že cieľom Rady Európy je dosiahnutie väčšej +jednoty medzi jej členmi, a že jedným zo spôsobov, ktorým sa +má tento cieľ napĺňať, je ochrana a ďalší rozvoj ľudských práv +a základných slobôd; +znovu potvrdzujúc svoju hlbokú vieru v tie základné slobody, ktoré +sú základom spravodlivosti a mieru vo svete, a ktoré sú najlepšie +zachovávané na jednej strane účinnou politickou demokraciou +a na strane druhej spoločným poňatím a dodržiavaním ľudských +práv, od ktorých závisia; + """ + tokens = sk_tokenizer(text) + assert len(tokens) == 118 + + +@pytest.mark.parametrize( + "text,match", + [ + ("10", True), + ("1", True), + ("10,000", True), + ("10,00", True), + ("štyri", True), + ("devätnásť", True), + ("milión", True), + ("pes", False), + (",", False), + ("1/2", True), + ], +) +def test_lex_attrs_like_number(sk_tokenizer, text, match): + tokens = sk_tokenizer(text) + assert len(tokens) == 1 + assert tokens[0].like_num == match + + +@pytest.mark.xfail +def test_ordinal_number(sk_tokenizer): + text = "10. decembra 1948" + tokens = sk_tokenizer(text) + assert len(tokens) == 3 diff --git a/TTS/Kokoro/.venv/Lib/site-packages/spacy/tests/lang/sk/test_tokenizer.py b/TTS/Kokoro/.venv/Lib/site-packages/spacy/tests/lang/sk/test_tokenizer.py new file mode 100644 index 0000000000000000000000000000000000000000..6c3c8edad0c9215ad2e2df476deda71f0b99473f --- /dev/null +++ b/TTS/Kokoro/.venv/Lib/site-packages/spacy/tests/lang/sk/test_tokenizer.py @@ -0,0 +1,15 @@ +import pytest + +SK_BASIC_TOKENIZATION_TESTS = [ + ( + "Kedy sa narodil Andrej Kiska?", + ["Kedy", "sa", "narodil", "Andrej", "Kiska", "?"], + ), +] + + +@pytest.mark.parametrize("text,expected_tokens", SK_BASIC_TOKENIZATION_TESTS) +def test_sk_tokenizer_basic(sk_tokenizer, text, expected_tokens): + tokens = sk_tokenizer(text) + token_list = [token.text for token in tokens if not token.is_space] + assert expected_tokens == token_list diff --git a/TTS/Kokoro/.venv/Lib/site-packages/spacy/tests/lang/sl/__init__.py b/TTS/Kokoro/.venv/Lib/site-packages/spacy/tests/lang/sl/__init__.py new file mode 100644 index 0000000000000000000000000000000000000000..e69de29bb2d1d6434b8b29ae775ad8c2e48c5391 diff --git a/TTS/Kokoro/.venv/Lib/site-packages/spacy/tests/lang/sl/__pycache__/__init__.cpython-312.pyc b/TTS/Kokoro/.venv/Lib/site-packages/spacy/tests/lang/sl/__pycache__/__init__.cpython-312.pyc new file mode 100644 index 0000000000000000000000000000000000000000..6cd84eda2bd2e4e5b8b8dddae2aeaefc77241121 Binary files /dev/null and b/TTS/Kokoro/.venv/Lib/site-packages/spacy/tests/lang/sl/__pycache__/__init__.cpython-312.pyc differ diff --git a/TTS/Kokoro/.venv/Lib/site-packages/spacy/tests/lang/sl/__pycache__/test_text.cpython-312.pyc b/TTS/Kokoro/.venv/Lib/site-packages/spacy/tests/lang/sl/__pycache__/test_text.cpython-312.pyc new file mode 100644 index 0000000000000000000000000000000000000000..c40c2d8465f3e1c7c0cffab2f28549ec692cdccc Binary files /dev/null and b/TTS/Kokoro/.venv/Lib/site-packages/spacy/tests/lang/sl/__pycache__/test_text.cpython-312.pyc differ diff --git a/TTS/Kokoro/.venv/Lib/site-packages/spacy/tests/lang/sl/__pycache__/test_tokenizer.cpython-312.pyc b/TTS/Kokoro/.venv/Lib/site-packages/spacy/tests/lang/sl/__pycache__/test_tokenizer.cpython-312.pyc new file mode 100644 index 0000000000000000000000000000000000000000..7627cb587649e2fc09d27ffad5e637575f44749c Binary files /dev/null and b/TTS/Kokoro/.venv/Lib/site-packages/spacy/tests/lang/sl/__pycache__/test_tokenizer.cpython-312.pyc differ diff --git a/TTS/Kokoro/.venv/Lib/site-packages/spacy/tests/lang/sl/test_text.py b/TTS/Kokoro/.venv/Lib/site-packages/spacy/tests/lang/sl/test_text.py new file mode 100644 index 0000000000000000000000000000000000000000..072d6d594619f44bd790cd2997fc186a02271c4d --- /dev/null +++ b/TTS/Kokoro/.venv/Lib/site-packages/spacy/tests/lang/sl/test_text.py @@ -0,0 +1,26 @@ +import pytest + + +def test_long_text(sl_tokenizer): + # Excerpt: European Convention on Human Rights + text = """ +upoštevajoč, da si ta deklaracija prizadeva zagotoviti splošno in +učinkovito priznavanje in spoštovanje v njej razglašenih pravic, +upoštevajoč, da je cilj Sveta Evrope doseči večjo enotnost med +njegovimi članicami, in da je eden izmed načinov za zagotavljanje +tega cilja varstvo in nadaljnji razvoj človekovih pravic in temeljnih +svoboščin, +ponovno potrjujoč svojo globoko vero v temeljne svoboščine, na +katerih temeljita pravičnost in mir v svetu, in ki jih je mogoče najbolje +zavarovati na eni strani z dejansko politično demokracijo in na drugi +strani s skupnim razumevanjem in spoštovanjem človekovih pravic, +od katerih so te svoboščine odvisne, +""" + tokens = sl_tokenizer(text) + assert len(tokens) == 116 + + +def test_ordinal_number(sl_tokenizer): + text = "10. decembra 1948" + tokens = sl_tokenizer(text) + assert len(tokens) == 3 diff --git a/TTS/Kokoro/.venv/Lib/site-packages/spacy/tests/lang/sl/test_tokenizer.py b/TTS/Kokoro/.venv/Lib/site-packages/spacy/tests/lang/sl/test_tokenizer.py new file mode 100644 index 0000000000000000000000000000000000000000..3e687dc64127a246d696a23b2224fb7002cbe559 --- /dev/null +++ b/TTS/Kokoro/.venv/Lib/site-packages/spacy/tests/lang/sl/test_tokenizer.py @@ -0,0 +1,32 @@ +import pytest + +SL_BASIC_TOKENIZATION_TESTS = [ + ( + "Vsakdo ima pravico do spoštovanja njegovega zasebnega in " + "družinskega življenja, doma in dopisovanja.", + [ + "Vsakdo", + "ima", + "pravico", + "do", + "spoštovanja", + "njegovega", + "zasebnega", + "in", + "družinskega", + "življenja", + ",", + "doma", + "in", + "dopisovanja", + ".", + ], + ), +] + + +@pytest.mark.parametrize("text,expected_tokens", SL_BASIC_TOKENIZATION_TESTS) +def test_sl_tokenizer_basic(sl_tokenizer, text, expected_tokens): + tokens = sl_tokenizer(text) + token_list = [token.text for token in tokens if not token.is_space] + assert expected_tokens == token_list diff --git a/TTS/Kokoro/.venv/Lib/site-packages/spacy/tests/lang/sq/__init__.py b/TTS/Kokoro/.venv/Lib/site-packages/spacy/tests/lang/sq/__init__.py new file mode 100644 index 0000000000000000000000000000000000000000..e69de29bb2d1d6434b8b29ae775ad8c2e48c5391 diff --git a/TTS/Kokoro/.venv/Lib/site-packages/spacy/tests/lang/sq/__pycache__/__init__.cpython-312.pyc b/TTS/Kokoro/.venv/Lib/site-packages/spacy/tests/lang/sq/__pycache__/__init__.cpython-312.pyc new file mode 100644 index 0000000000000000000000000000000000000000..7dfe05ee21dbed442a9138533bd9f76c82e55ef8 Binary files /dev/null and b/TTS/Kokoro/.venv/Lib/site-packages/spacy/tests/lang/sq/__pycache__/__init__.cpython-312.pyc differ diff --git a/TTS/Kokoro/.venv/Lib/site-packages/spacy/tests/lang/sq/__pycache__/test_text.cpython-312.pyc b/TTS/Kokoro/.venv/Lib/site-packages/spacy/tests/lang/sq/__pycache__/test_text.cpython-312.pyc new file mode 100644 index 0000000000000000000000000000000000000000..4842d877a7b823a7dae3b00c088e91a44504068f Binary files /dev/null and b/TTS/Kokoro/.venv/Lib/site-packages/spacy/tests/lang/sq/__pycache__/test_text.cpython-312.pyc differ diff --git a/TTS/Kokoro/.venv/Lib/site-packages/spacy/tests/lang/sq/__pycache__/test_tokenizer.cpython-312.pyc b/TTS/Kokoro/.venv/Lib/site-packages/spacy/tests/lang/sq/__pycache__/test_tokenizer.cpython-312.pyc new file mode 100644 index 0000000000000000000000000000000000000000..ffaa27f2e4428156f6d72c1c5ed8ceea95369ad8 Binary files /dev/null and b/TTS/Kokoro/.venv/Lib/site-packages/spacy/tests/lang/sq/__pycache__/test_tokenizer.cpython-312.pyc differ diff --git a/TTS/Kokoro/.venv/Lib/site-packages/spacy/tests/lang/sq/test_text.py b/TTS/Kokoro/.venv/Lib/site-packages/spacy/tests/lang/sq/test_text.py new file mode 100644 index 0000000000000000000000000000000000000000..a949c4690226f4a65d120a7f4fd9f45e8977b374 --- /dev/null +++ b/TTS/Kokoro/.venv/Lib/site-packages/spacy/tests/lang/sq/test_text.py @@ -0,0 +1,25 @@ +import pytest + + +def test_long_text(sq_tokenizer): + # Excerpt: European Convention on Human Rights + text = """ +Qeveritë nënshkruese, anëtare të Këshillit të Evropës, +Duke pasur parasysh Deklaratën Universale të të Drejtave të +Njeriut, të shpallur nga Asambleja e Përgjithshme e Kombeve të +Bashkuara më 10 dhjetor 1948; +Duke pasur parasysh, se kjo Deklaratë ka për qëllim të sigurojë +njohjen dhe zbatimin universal dhe efektiv të të drejtave të +shpallura në të; +Duke pasur parasysh se qëllimi i Këshillit të Evropës është që të +realizojë një bashkim më të ngushtë midis anëtarëve të tij dhe +se një nga mjetet për të arritur këtë qëllim është mbrojtja dhe +zhvillimi i të drejtave të njeriut dhe i lirive themelore; +Duke ripohuar besimin e tyre të thellë në këto liri themelore që +përbëjnë themelet e drejtësisë dhe të paqes në botë, ruajtja e të +cilave mbështetet kryesisht mbi një regjim politik demokratik nga +njëra anë, dhe nga ana tjetër mbi një kuptim dhe respektim të +përbashkët të të drejtave të njeriut nga të cilat varen; +""" + tokens = sq_tokenizer(text) + assert len(tokens) == 182 diff --git a/TTS/Kokoro/.venv/Lib/site-packages/spacy/tests/lang/sq/test_tokenizer.py b/TTS/Kokoro/.venv/Lib/site-packages/spacy/tests/lang/sq/test_tokenizer.py new file mode 100644 index 0000000000000000000000000000000000000000..00563e03a31ac39317eb8efd6553348df5fcaa56 --- /dev/null +++ b/TTS/Kokoro/.venv/Lib/site-packages/spacy/tests/lang/sq/test_tokenizer.py @@ -0,0 +1,31 @@ +import pytest + +SQ_BASIC_TOKENIZATION_TESTS = [ + ( + "Askush nuk mund t’i nënshtrohet torturës ose dënimeve ose " + "trajtimeve çnjerëzore ose poshtëruese.", + [ + "Askush", + "nuk", + "mund", + "t’i", + "nënshtrohet", + "torturës", + "ose", + "dënimeve", + "ose", + "trajtimeve", + "çnjerëzore", + "ose", + "poshtëruese", + ".", + ], + ), +] + + +@pytest.mark.parametrize("text,expected_tokens", SQ_BASIC_TOKENIZATION_TESTS) +def test_sq_tokenizer_basic(sq_tokenizer, text, expected_tokens): + tokens = sq_tokenizer(text) + token_list = [token.text for token in tokens if not token.is_space] + assert expected_tokens == token_list diff --git a/TTS/Kokoro/.venv/Lib/site-packages/spacy/tests/lang/sr/__init__.py b/TTS/Kokoro/.venv/Lib/site-packages/spacy/tests/lang/sr/__init__.py new file mode 100644 index 0000000000000000000000000000000000000000..e69de29bb2d1d6434b8b29ae775ad8c2e48c5391 diff --git a/TTS/Kokoro/.venv/Lib/site-packages/spacy/tests/lang/sr/__pycache__/__init__.cpython-312.pyc b/TTS/Kokoro/.venv/Lib/site-packages/spacy/tests/lang/sr/__pycache__/__init__.cpython-312.pyc new file mode 100644 index 0000000000000000000000000000000000000000..80c670f1d7bbfd53d8321db973283d8dc60b038d Binary files /dev/null and b/TTS/Kokoro/.venv/Lib/site-packages/spacy/tests/lang/sr/__pycache__/__init__.cpython-312.pyc differ diff --git a/TTS/Kokoro/.venv/Lib/site-packages/spacy/tests/lang/sr/__pycache__/test_exceptions.cpython-312.pyc b/TTS/Kokoro/.venv/Lib/site-packages/spacy/tests/lang/sr/__pycache__/test_exceptions.cpython-312.pyc new file mode 100644 index 0000000000000000000000000000000000000000..70da4329386c98fef86b72b16c401b4b40500d57 Binary files /dev/null and b/TTS/Kokoro/.venv/Lib/site-packages/spacy/tests/lang/sr/__pycache__/test_exceptions.cpython-312.pyc differ diff --git a/TTS/Kokoro/.venv/Lib/site-packages/spacy/tests/lang/sr/__pycache__/test_tokenizer.cpython-312.pyc b/TTS/Kokoro/.venv/Lib/site-packages/spacy/tests/lang/sr/__pycache__/test_tokenizer.cpython-312.pyc new file mode 100644 index 0000000000000000000000000000000000000000..c5a9addba7213f07e89eca068fa302407cf77373 Binary files /dev/null and b/TTS/Kokoro/.venv/Lib/site-packages/spacy/tests/lang/sr/__pycache__/test_tokenizer.cpython-312.pyc differ diff --git a/TTS/Kokoro/.venv/Lib/site-packages/spacy/tests/lang/sr/test_exceptions.py b/TTS/Kokoro/.venv/Lib/site-packages/spacy/tests/lang/sr/test_exceptions.py new file mode 100644 index 0000000000000000000000000000000000000000..d24da3c1b3ae5d085414d7c67ec848657e259285 --- /dev/null +++ b/TTS/Kokoro/.venv/Lib/site-packages/spacy/tests/lang/sr/test_exceptions.py @@ -0,0 +1,16 @@ +import pytest + + +@pytest.mark.parametrize( + "text,norms,lemmas", + [ + ("о.г.", ["ове године"], ["ова година"]), + ("чет.", ["четвртак"], ["четвртак"]), + ("гђа", ["госпођа"], ["госпођа"]), + ("ил'", ["или"], ["или"]), + ], +) +def test_sr_tokenizer_abbrev_exceptions(sr_tokenizer, text, norms, lemmas): + tokens = sr_tokenizer(text) + assert len(tokens) == 1 + assert [token.norm_ for token in tokens] == norms diff --git a/TTS/Kokoro/.venv/Lib/site-packages/spacy/tests/lang/sr/test_tokenizer.py b/TTS/Kokoro/.venv/Lib/site-packages/spacy/tests/lang/sr/test_tokenizer.py new file mode 100644 index 0000000000000000000000000000000000000000..483319a317fa29b8f3b48949c33ce0dfbc31727e --- /dev/null +++ b/TTS/Kokoro/.venv/Lib/site-packages/spacy/tests/lang/sr/test_tokenizer.py @@ -0,0 +1,123 @@ +import pytest + +PUNCT_OPEN = ["(", "[", "{", "*"] +PUNCT_CLOSE = [")", "]", "}", "*"] +PUNCT_PAIRED = [("(", ")"), ("[", "]"), ("{", "}"), ("*", "*")] + + +@pytest.mark.parametrize("text", ["(", "((", "<"]) +def test_sr_tokenizer_handles_only_punct(sr_tokenizer, text): + tokens = sr_tokenizer(text) + assert len(tokens) == len(text) + + +@pytest.mark.parametrize("punct", PUNCT_OPEN) +@pytest.mark.parametrize("text", ["Здраво"]) +def test_sr_tokenizer_splits_open_punct(sr_tokenizer, punct, text): + tokens = sr_tokenizer(punct + text) + assert len(tokens) == 2 + assert tokens[0].text == punct + assert tokens[1].text == text + + +@pytest.mark.parametrize("punct", PUNCT_CLOSE) +@pytest.mark.parametrize("text", ["Здраво"]) +def test_sr_tokenizer_splits_close_punct(sr_tokenizer, punct, text): + tokens = sr_tokenizer(text + punct) + assert len(tokens) == 2 + assert tokens[0].text == text + assert tokens[1].text == punct + + +@pytest.mark.parametrize("punct", PUNCT_OPEN) +@pytest.mark.parametrize("punct_add", ["`"]) +@pytest.mark.parametrize("text", ["Ћао"]) +def test_sr_tokenizer_splits_two_diff_open_punct(sr_tokenizer, punct, punct_add, text): + tokens = sr_tokenizer(punct + punct_add + text) + assert len(tokens) == 3 + assert tokens[0].text == punct + assert tokens[1].text == punct_add + assert tokens[2].text == text + + +@pytest.mark.parametrize("punct", PUNCT_CLOSE) +@pytest.mark.parametrize("punct_add", ["'"]) +@pytest.mark.parametrize("text", ["Здраво"]) +def test_sr_tokenizer_splits_two_diff_close_punct(sr_tokenizer, punct, punct_add, text): + tokens = sr_tokenizer(text + punct + punct_add) + assert len(tokens) == 3 + assert tokens[0].text == text + assert tokens[1].text == punct + assert tokens[2].text == punct_add + + +@pytest.mark.parametrize("punct", PUNCT_OPEN) +@pytest.mark.parametrize("text", ["Здраво"]) +def test_sr_tokenizer_splits_same_open_punct(sr_tokenizer, punct, text): + tokens = sr_tokenizer(punct + punct + punct + text) + assert len(tokens) == 4 + assert tokens[0].text == punct + assert tokens[3].text == text + + +@pytest.mark.parametrize("punct", PUNCT_CLOSE) +@pytest.mark.parametrize("text", ["Здраво"]) +def test_sr_tokenizer_splits_same_close_punct(sr_tokenizer, punct, text): + tokens = sr_tokenizer(text + punct + punct + punct) + assert len(tokens) == 4 + assert tokens[0].text == text + assert tokens[1].text == punct + + +@pytest.mark.parametrize("text", ["'Тест"]) +def test_sr_tokenizer_splits_open_appostrophe(sr_tokenizer, text): + tokens = sr_tokenizer(text) + assert len(tokens) == 2 + assert tokens[0].text == "'" + + +@pytest.mark.parametrize("text", ["Тест''"]) +def test_sr_tokenizer_splits_double_end_quote(sr_tokenizer, text): + tokens = sr_tokenizer(text) + assert len(tokens) == 2 + tokens_punct = sr_tokenizer("''") + assert len(tokens_punct) == 1 + + +@pytest.mark.parametrize("punct_open,punct_close", PUNCT_PAIRED) +@pytest.mark.parametrize("text", ["Тест"]) +def test_sr_tokenizer_splits_open_close_punct( + sr_tokenizer, punct_open, punct_close, text +): + tokens = sr_tokenizer(punct_open + text + punct_close) + assert len(tokens) == 3 + assert tokens[0].text == punct_open + assert tokens[1].text == text + assert tokens[2].text == punct_close + + +@pytest.mark.parametrize("punct_open,punct_close", PUNCT_PAIRED) +@pytest.mark.parametrize("punct_open2,punct_close2", [("`", "'")]) +@pytest.mark.parametrize("text", ["Тест"]) +def test_sr_tokenizer_two_diff_punct( + sr_tokenizer, punct_open, punct_close, punct_open2, punct_close2, text +): + tokens = sr_tokenizer(punct_open2 + punct_open + text + punct_close + punct_close2) + assert len(tokens) == 5 + assert tokens[0].text == punct_open2 + assert tokens[1].text == punct_open + assert tokens[2].text == text + assert tokens[3].text == punct_close + assert tokens[4].text == punct_close2 + + +@pytest.mark.parametrize("text", ["Тест."]) +def test_sr_tokenizer_splits_trailing_dot(sr_tokenizer, text): + tokens = sr_tokenizer(text) + assert tokens[1].text == "." + + +def test_sr_tokenizer_splits_bracket_period(sr_tokenizer): + text = "(Један, два, три, четири, проба)." + tokens = sr_tokenizer(text) + assert tokens[len(tokens) - 1].text == "." diff --git a/TTS/Kokoro/.venv/Lib/site-packages/spacy/tests/lang/sv/__init__.py b/TTS/Kokoro/.venv/Lib/site-packages/spacy/tests/lang/sv/__init__.py new file mode 100644 index 0000000000000000000000000000000000000000..e69de29bb2d1d6434b8b29ae775ad8c2e48c5391 diff --git a/TTS/Kokoro/.venv/Lib/site-packages/spacy/tests/lang/sv/__pycache__/__init__.cpython-312.pyc b/TTS/Kokoro/.venv/Lib/site-packages/spacy/tests/lang/sv/__pycache__/__init__.cpython-312.pyc new file mode 100644 index 0000000000000000000000000000000000000000..e5c165d01336d91c102002c3a6b0146f667f3185 Binary files /dev/null and b/TTS/Kokoro/.venv/Lib/site-packages/spacy/tests/lang/sv/__pycache__/__init__.cpython-312.pyc differ diff --git a/TTS/Kokoro/.venv/Lib/site-packages/spacy/tests/lang/sv/__pycache__/test_exceptions.cpython-312.pyc b/TTS/Kokoro/.venv/Lib/site-packages/spacy/tests/lang/sv/__pycache__/test_exceptions.cpython-312.pyc new file mode 100644 index 0000000000000000000000000000000000000000..55b6c0884b39f2a975c2c63b5d9a5e94071658d5 Binary files /dev/null and b/TTS/Kokoro/.venv/Lib/site-packages/spacy/tests/lang/sv/__pycache__/test_exceptions.cpython-312.pyc differ diff --git a/TTS/Kokoro/.venv/Lib/site-packages/spacy/tests/lang/sv/__pycache__/test_lex_attrs.cpython-312.pyc b/TTS/Kokoro/.venv/Lib/site-packages/spacy/tests/lang/sv/__pycache__/test_lex_attrs.cpython-312.pyc new file mode 100644 index 0000000000000000000000000000000000000000..d7767c8b5fe2bb6a8382b3b14eb81cf0daeec911 Binary files /dev/null and b/TTS/Kokoro/.venv/Lib/site-packages/spacy/tests/lang/sv/__pycache__/test_lex_attrs.cpython-312.pyc differ diff --git a/TTS/Kokoro/.venv/Lib/site-packages/spacy/tests/lang/sv/__pycache__/test_noun_chunks.cpython-312.pyc b/TTS/Kokoro/.venv/Lib/site-packages/spacy/tests/lang/sv/__pycache__/test_noun_chunks.cpython-312.pyc new file mode 100644 index 0000000000000000000000000000000000000000..8cb55eb653ee070df7f9c84ed69c172f3ecdb068 Binary files /dev/null and b/TTS/Kokoro/.venv/Lib/site-packages/spacy/tests/lang/sv/__pycache__/test_noun_chunks.cpython-312.pyc differ diff --git a/TTS/Kokoro/.venv/Lib/site-packages/spacy/tests/lang/sv/__pycache__/test_prefix_suffix_infix.cpython-312.pyc b/TTS/Kokoro/.venv/Lib/site-packages/spacy/tests/lang/sv/__pycache__/test_prefix_suffix_infix.cpython-312.pyc new file mode 100644 index 0000000000000000000000000000000000000000..b5a1531b86ae5a28d2694d23ba169f768acdc526 Binary files /dev/null and b/TTS/Kokoro/.venv/Lib/site-packages/spacy/tests/lang/sv/__pycache__/test_prefix_suffix_infix.cpython-312.pyc differ diff --git a/TTS/Kokoro/.venv/Lib/site-packages/spacy/tests/lang/sv/__pycache__/test_text.cpython-312.pyc b/TTS/Kokoro/.venv/Lib/site-packages/spacy/tests/lang/sv/__pycache__/test_text.cpython-312.pyc new file mode 100644 index 0000000000000000000000000000000000000000..e682b0666d2f40e970694a1dd8c5e7d1b5228340 Binary files /dev/null and b/TTS/Kokoro/.venv/Lib/site-packages/spacy/tests/lang/sv/__pycache__/test_text.cpython-312.pyc differ diff --git a/TTS/Kokoro/.venv/Lib/site-packages/spacy/tests/lang/sv/__pycache__/test_tokenizer.cpython-312.pyc b/TTS/Kokoro/.venv/Lib/site-packages/spacy/tests/lang/sv/__pycache__/test_tokenizer.cpython-312.pyc new file mode 100644 index 0000000000000000000000000000000000000000..6d4c8ad1deca11a681e2173250aa8cb9e0b0fada Binary files /dev/null and b/TTS/Kokoro/.venv/Lib/site-packages/spacy/tests/lang/sv/__pycache__/test_tokenizer.cpython-312.pyc differ diff --git a/TTS/Kokoro/.venv/Lib/site-packages/spacy/tests/lang/sv/test_exceptions.py b/TTS/Kokoro/.venv/Lib/site-packages/spacy/tests/lang/sv/test_exceptions.py new file mode 100644 index 0000000000000000000000000000000000000000..163a7c0895fb9d0cfee3319c9251eee0a2046227 --- /dev/null +++ b/TTS/Kokoro/.venv/Lib/site-packages/spacy/tests/lang/sv/test_exceptions.py @@ -0,0 +1,77 @@ +import pytest + +SV_TOKEN_EXCEPTION_TESTS = [ + ( + "Smörsåsen används bl.a. till fisk", + ["Smörsåsen", "används", "bl.a.", "till", "fisk"], + ), + ( + "Jag kommer först kl. 13 p.g.a. diverse förseningar", + ["Jag", "kommer", "först", "kl.", "13", "p.g.a.", "diverse", "förseningar"], + ), + ( + "Anders I. tycker om ord med i i.", + ["Anders", "I.", "tycker", "om", "ord", "med", "i", "i", "."], + ), +] + + +@pytest.mark.issue(805) +@pytest.mark.parametrize( + "text,expected_tokens", + [ + ( + "Smörsåsen används bl.a. till fisk", + ["Smörsåsen", "används", "bl.a.", "till", "fisk"], + ), + ( + "Jag kommer först kl. 13 p.g.a. diverse förseningar", + ["Jag", "kommer", "först", "kl.", "13", "p.g.a.", "diverse", "förseningar"], + ), + ], +) +def test_issue805(sv_tokenizer, text, expected_tokens): + tokens = sv_tokenizer(text) + token_list = [token.text for token in tokens if not token.is_space] + assert expected_tokens == token_list + + +@pytest.mark.parametrize("text,expected_tokens", SV_TOKEN_EXCEPTION_TESTS) +def test_sv_tokenizer_handles_exception_cases(sv_tokenizer, text, expected_tokens): + tokens = sv_tokenizer(text) + token_list = [token.text for token in tokens if not token.is_space] + assert expected_tokens == token_list + + +@pytest.mark.parametrize("text", ["driveru", "hajaru", "Serru", "Fixaru"]) +def test_sv_tokenizer_handles_verb_exceptions(sv_tokenizer, text): + tokens = sv_tokenizer(text) + assert len(tokens) == 2 + assert tokens[1].text == "u" + + +@pytest.mark.parametrize("text", ["bl.a", "m.a.o.", "Jan.", "Dec.", "kr.", "osv."]) +def test_sv_tokenizer_handles_abbr(sv_tokenizer, text): + tokens = sv_tokenizer(text) + assert len(tokens) == 1 + + +@pytest.mark.parametrize("text", ["Jul.", "jul.", "sön.", "Sön."]) +def test_sv_tokenizer_handles_ambiguous_abbr(sv_tokenizer, text): + tokens = sv_tokenizer(text) + assert len(tokens) == 2 + + +def test_sv_tokenizer_handles_exc_in_text(sv_tokenizer): + text = "Det är bl.a. inte meningen" + tokens = sv_tokenizer(text) + assert len(tokens) == 5 + assert tokens[2].text == "bl.a." + + +def test_sv_tokenizer_handles_custom_base_exc(sv_tokenizer): + text = "Här är något du kan titta på." + tokens = sv_tokenizer(text) + assert len(tokens) == 8 + assert tokens[6].text == "på" + assert tokens[7].text == "." diff --git a/TTS/Kokoro/.venv/Lib/site-packages/spacy/tests/lang/sv/test_lex_attrs.py b/TTS/Kokoro/.venv/Lib/site-packages/spacy/tests/lang/sv/test_lex_attrs.py new file mode 100644 index 0000000000000000000000000000000000000000..d07928fd9ede49ee5d8f3d73d58e85e26283730e --- /dev/null +++ b/TTS/Kokoro/.venv/Lib/site-packages/spacy/tests/lang/sv/test_lex_attrs.py @@ -0,0 +1,31 @@ +import pytest + +from spacy.lang.sv.lex_attrs import like_num + + +@pytest.mark.parametrize( + "text,match", + [ + ("10", True), + ("1", True), + ("10.000", True), + ("10.00", True), + ("999,0", True), + ("en", True), + ("två", True), + ("miljard", True), + ("hund", False), + (",", False), + ("1/2", True), + ], +) +def test_lex_attrs_like_number(sv_tokenizer, text, match): + tokens = sv_tokenizer(text) + assert len(tokens) == 1 + assert tokens[0].like_num == match + + +@pytest.mark.parametrize("word", ["elva"]) +def test_sv_lex_attrs_capitals(word): + assert like_num(word) + assert like_num(word.upper()) diff --git a/TTS/Kokoro/.venv/Lib/site-packages/spacy/tests/lang/sv/test_noun_chunks.py b/TTS/Kokoro/.venv/Lib/site-packages/spacy/tests/lang/sv/test_noun_chunks.py new file mode 100644 index 0000000000000000000000000000000000000000..3a68648d54096a628a788b91efec964bf95aff50 --- /dev/null +++ b/TTS/Kokoro/.venv/Lib/site-packages/spacy/tests/lang/sv/test_noun_chunks.py @@ -0,0 +1,49 @@ +import pytest + +from spacy.tokens import Doc + + +def test_noun_chunks_is_parsed_sv(sv_tokenizer): + """Test that noun_chunks raises Value Error for 'sv' language if Doc is not parsed.""" + doc = sv_tokenizer("Studenten läste den bästa boken") + with pytest.raises(ValueError): + list(doc.noun_chunks) + + +SV_NP_TEST_EXAMPLES = [ + ( + "En student läste en bok", # A student read a book + ["DET", "NOUN", "VERB", "DET", "NOUN"], + ["det", "nsubj", "ROOT", "det", "dobj"], + [1, 2, 2, 4, 2], + ["En student", "en bok"], + ), + ( + "Studenten läste den bästa boken.", # The student read the best book + ["NOUN", "VERB", "DET", "ADJ", "NOUN", "PUNCT"], + ["nsubj", "ROOT", "det", "amod", "dobj", "punct"], + [1, 1, 4, 4, 1, 1], + ["Studenten", "den bästa boken"], + ), + ( + "De samvetslösa skurkarna hade stulit de största juvelerna på söndagen", # The remorseless crooks had stolen the largest jewels that sunday + ["DET", "ADJ", "NOUN", "VERB", "VERB", "DET", "ADJ", "NOUN", "ADP", "NOUN"], + ["det", "amod", "nsubj", "aux", "root", "det", "amod", "dobj", "case", "nmod"], + [2, 2, 4, 4, 4, 7, 7, 4, 9, 4], + ["De samvetslösa skurkarna", "de största juvelerna", "på söndagen"], + ), +] + + +@pytest.mark.parametrize( + "text,pos,deps,heads,expected_noun_chunks", SV_NP_TEST_EXAMPLES +) +def test_sv_noun_chunks(sv_tokenizer, text, pos, deps, heads, expected_noun_chunks): + tokens = sv_tokenizer(text) + assert len(heads) == len(pos) + words = [t.text for t in tokens] + doc = Doc(tokens.vocab, words=words, heads=heads, deps=deps, pos=pos) + noun_chunks = list(doc.noun_chunks) + assert len(noun_chunks) == len(expected_noun_chunks) + for i, np in enumerate(noun_chunks): + assert np.text == expected_noun_chunks[i] diff --git a/TTS/Kokoro/.venv/Lib/site-packages/spacy/tests/lang/sv/test_prefix_suffix_infix.py b/TTS/Kokoro/.venv/Lib/site-packages/spacy/tests/lang/sv/test_prefix_suffix_infix.py new file mode 100644 index 0000000000000000000000000000000000000000..8689f27066f7b9a42f826d595c0f603b20d568c1 --- /dev/null +++ b/TTS/Kokoro/.venv/Lib/site-packages/spacy/tests/lang/sv/test_prefix_suffix_infix.py @@ -0,0 +1,41 @@ +import pytest + + +@pytest.mark.parametrize("text", ["(under)"]) +def test_tokenizer_splits_no_special(sv_tokenizer, text): + tokens = sv_tokenizer(text) + assert len(tokens) == 3 + + +@pytest.mark.parametrize("text", ["gitta'r", "Björn's", "Lars'"]) +def test_tokenizer_handles_no_punct(sv_tokenizer, text): + tokens = sv_tokenizer(text) + assert len(tokens) == 1 + + +@pytest.mark.parametrize("text", ["svart.Gul", "Hej.Världen"]) +def test_tokenizer_splits_period_infix(sv_tokenizer, text): + tokens = sv_tokenizer(text) + assert len(tokens) == 3 + + +@pytest.mark.parametrize("text", ["Hej,Världen", "en,två"]) +def test_tokenizer_splits_comma_infix(sv_tokenizer, text): + tokens = sv_tokenizer(text) + assert len(tokens) == 3 + assert tokens[0].text == text.split(",")[0] + assert tokens[1].text == "," + assert tokens[2].text == text.split(",")[1] + + +@pytest.mark.parametrize("text", ["svart...Gul", "svart...gul"]) +def test_tokenizer_splits_ellipsis_infix(sv_tokenizer, text): + tokens = sv_tokenizer(text) + assert len(tokens) == 3 + + +@pytest.mark.issue(12311) +@pytest.mark.parametrize("text", ["99:e", "c:a", "EU:s", "Maj:t"]) +def test_sv_tokenizer_handles_colon(sv_tokenizer, text): + tokens = sv_tokenizer(text) + assert len(tokens) == 1 diff --git a/TTS/Kokoro/.venv/Lib/site-packages/spacy/tests/lang/sv/test_text.py b/TTS/Kokoro/.venv/Lib/site-packages/spacy/tests/lang/sv/test_text.py new file mode 100644 index 0000000000000000000000000000000000000000..42c9e03e7fc803a89bc4eba6214b2633b1f60420 --- /dev/null +++ b/TTS/Kokoro/.venv/Lib/site-packages/spacy/tests/lang/sv/test_text.py @@ -0,0 +1,14 @@ +def test_sv_tokenizer_handles_long_text(sv_tokenizer): + text = """Det var så härligt ute på landet. Det var sommar, majsen var gul, havren grön, +höet var uppställt i stackar nere vid den gröna ängen, och där gick storken på sina långa, +röda ben och snackade engelska, för det språket hade han lärt sig av sin mor. + +Runt om åkrar och äng låg den stora skogen, och mitt i skogen fanns djupa sjöar; jo, det var verkligen trevligt ute på landet!""" + tokens = sv_tokenizer(text) + assert len(tokens) == 86 + + +def test_sv_tokenizer_handles_trailing_dot_for_i_in_sentence(sv_tokenizer): + text = "Provar att tokenisera en mening med ord i." + tokens = sv_tokenizer(text) + assert len(tokens) == 9 diff --git a/TTS/Kokoro/.venv/Lib/site-packages/spacy/tests/lang/sv/test_tokenizer.py b/TTS/Kokoro/.venv/Lib/site-packages/spacy/tests/lang/sv/test_tokenizer.py new file mode 100644 index 0000000000000000000000000000000000000000..df0d7c49c4eaab1eff4abb55d2fab682bf803230 --- /dev/null +++ b/TTS/Kokoro/.venv/Lib/site-packages/spacy/tests/lang/sv/test_tokenizer.py @@ -0,0 +1,30 @@ +import pytest + +SV_TOKEN_EXCEPTION_TESTS = [ + ( + "Smörsåsen används bl.a. till fisk", + ["Smörsåsen", "används", "bl.a.", "till", "fisk"], + ), + ( + "Jag kommer först kl. 13 p.g.a. diverse förseningar", + ["Jag", "kommer", "först", "kl.", "13", "p.g.a.", "diverse", "förseningar"], + ), + ( + "Anders I. tycker om ord med i i.", + ["Anders", "I.", "tycker", "om", "ord", "med", "i", "i", "."], + ), +] + + +@pytest.mark.parametrize("text,expected_tokens", SV_TOKEN_EXCEPTION_TESTS) +def test_sv_tokenizer_handles_exception_cases(sv_tokenizer, text, expected_tokens): + tokens = sv_tokenizer(text) + token_list = [token.text for token in tokens if not token.is_space] + assert expected_tokens == token_list + + +@pytest.mark.parametrize("text", ["driveru", "hajaru", "Serru", "Fixaru"]) +def test_sv_tokenizer_handles_verb_exceptions(sv_tokenizer, text): + tokens = sv_tokenizer(text) + assert len(tokens) == 2 + assert tokens[1].text == "u" diff --git a/TTS/Kokoro/.venv/Lib/site-packages/spacy/tests/lang/ta/__init__.py b/TTS/Kokoro/.venv/Lib/site-packages/spacy/tests/lang/ta/__init__.py new file mode 100644 index 0000000000000000000000000000000000000000..e69de29bb2d1d6434b8b29ae775ad8c2e48c5391 diff --git a/TTS/Kokoro/.venv/Lib/site-packages/spacy/tests/lang/ta/__pycache__/__init__.cpython-312.pyc b/TTS/Kokoro/.venv/Lib/site-packages/spacy/tests/lang/ta/__pycache__/__init__.cpython-312.pyc new file mode 100644 index 0000000000000000000000000000000000000000..74687563651ecf22c29b591e22820977f9a3fea4 Binary files /dev/null and b/TTS/Kokoro/.venv/Lib/site-packages/spacy/tests/lang/ta/__pycache__/__init__.cpython-312.pyc differ diff --git a/TTS/Kokoro/.venv/Lib/site-packages/spacy/tests/lang/ta/__pycache__/test_text.cpython-312.pyc b/TTS/Kokoro/.venv/Lib/site-packages/spacy/tests/lang/ta/__pycache__/test_text.cpython-312.pyc new file mode 100644 index 0000000000000000000000000000000000000000..172b8570247d401b0e0ae821116464b6359fa9fc Binary files /dev/null and b/TTS/Kokoro/.venv/Lib/site-packages/spacy/tests/lang/ta/__pycache__/test_text.cpython-312.pyc differ diff --git a/TTS/Kokoro/.venv/Lib/site-packages/spacy/tests/lang/ta/__pycache__/test_tokenizer.cpython-312.pyc b/TTS/Kokoro/.venv/Lib/site-packages/spacy/tests/lang/ta/__pycache__/test_tokenizer.cpython-312.pyc new file mode 100644 index 0000000000000000000000000000000000000000..a752f70d40d25fbc40422769df6b466c89c3a37b Binary files /dev/null and b/TTS/Kokoro/.venv/Lib/site-packages/spacy/tests/lang/ta/__pycache__/test_tokenizer.cpython-312.pyc differ diff --git a/TTS/Kokoro/.venv/Lib/site-packages/spacy/tests/lang/ta/test_text.py b/TTS/Kokoro/.venv/Lib/site-packages/spacy/tests/lang/ta/test_text.py new file mode 100644 index 0000000000000000000000000000000000000000..dcae5e7180f05c98664f44e03b74172df520070f --- /dev/null +++ b/TTS/Kokoro/.venv/Lib/site-packages/spacy/tests/lang/ta/test_text.py @@ -0,0 +1,26 @@ +import pytest + +from spacy.lang.ta import Tamil + +# Wikipedia excerpt: https://en.wikipedia.org/wiki/Chennai (Tamil Language) +TAMIL_BASIC_TOKENIZER_SENTENCIZER_TEST_TEXT = """சென்னை (Chennai) தமிழ்நாட்டின் தலைநகரமும், இந்தியாவின் நான்காவது பெரிய நகரமும் ஆகும். 1996 ஆம் ஆண்டுக்கு முன்னர் இந்நகரம், மதராசு பட்டினம், மெட்ராஸ் (Madras) மற்றும் சென்னப்பட்டினம் என்றும் அழைக்கப்பட்டு வந்தது. சென்னை, வங்காள விரிகுடாவின் கரையில் அமைந்த துறைமுக நகரங்களுள் ஒன்று. சுமார் 10 மில்லியன் (ஒரு கோடி) மக்கள் வாழும் இந்நகரம், உலகின் 35 பெரிய மாநகரங்களுள் ஒன்று. 17ஆம் நூற்றாண்டில் ஆங்கிலேயர் சென்னையில் கால் பதித்தது முதல், சென்னை நகரம் ஒரு முக்கிய நகரமாக வளர்ந்து வந்திருக்கிறது. சென்னை தென்னிந்தியாவின் வாசலாகக் கருதப்படுகிறது. சென்னை நகரில் உள்ள மெரினா கடற்கரை உலகின் நீளமான கடற்கரைகளுள் ஒன்று. சென்னை கோலிவுட் (Kollywood) என அறியப்படும் தமிழ்த் திரைப்படத் துறையின் தாயகம் ஆகும். பல விளையாட்டு அரங்கங்கள் உள்ள சென்னையில் பல விளையாட்டுப் போட்டிகளும் நடைபெறுகின்றன.""" + + +@pytest.mark.parametrize( + "text, num_tokens", + [(TAMIL_BASIC_TOKENIZER_SENTENCIZER_TEST_TEXT, 23 + 90)], # Punctuation + rest +) +def test_long_text(ta_tokenizer, text, num_tokens): + tokens = ta_tokenizer(text) + assert len(tokens) == num_tokens + + +@pytest.mark.parametrize( + "text, num_sents", [(TAMIL_BASIC_TOKENIZER_SENTENCIZER_TEST_TEXT, 9)] +) +def test_ta_sentencizer(text, num_sents): + nlp = Tamil() + nlp.add_pipe("sentencizer") + + doc = nlp(text) + assert len(list(doc.sents)) == num_sents diff --git a/TTS/Kokoro/.venv/Lib/site-packages/spacy/tests/lang/ta/test_tokenizer.py b/TTS/Kokoro/.venv/Lib/site-packages/spacy/tests/lang/ta/test_tokenizer.py new file mode 100644 index 0000000000000000000000000000000000000000..5f045735ba1aac4b7a5ee19547902a5161cd075c --- /dev/null +++ b/TTS/Kokoro/.venv/Lib/site-packages/spacy/tests/lang/ta/test_tokenizer.py @@ -0,0 +1,189 @@ +import pytest + +from spacy.lang.ta import Tamil +from spacy.symbols import ORTH + +TA_BASIC_TOKENIZATION_TESTS = [ + ( + "கிறிஸ்துமஸ் மற்றும் இனிய புத்தாண்டு வாழ்த்துக்கள்", + ["கிறிஸ்துமஸ்", "மற்றும்", "இனிய", "புத்தாண்டு", "வாழ்த்துக்கள்"], + ), + ( + "எனக்கு என் குழந்தைப் பருவம் நினைவிருக்கிறது", + ["எனக்கு", "என்", "குழந்தைப்", "பருவம்", "நினைவிருக்கிறது"], + ), + ("உங்கள் பெயர் என்ன?", ["உங்கள்", "பெயர்", "என்ன", "?"]), + ( + "ஏறத்தாழ இலங்கைத் தமிழரில் மூன்றிலொரு பங்கினர் இலங்கையை விட்டு வெளியேறிப் பிற நாடுகளில் வாழ்கின்றனர்", + [ + "ஏறத்தாழ", + "இலங்கைத்", + "தமிழரில்", + "மூன்றிலொரு", + "பங்கினர்", + "இலங்கையை", + "விட்டு", + "வெளியேறிப்", + "பிற", + "நாடுகளில்", + "வாழ்கின்றனர்", + ], + ), + ( + "இந்த ஃபோனுடன் சுமார் ரூ.2,990 மதிப்புள்ள போட் ராக்கர்ஸ் நிறுவனத்தின் ஸ்போர்ட் புளூடூத் ஹெட்போன்ஸ் இலவசமாக வழங்கப்படவுள்ளது.", + [ + "இந்த", + "ஃபோனுடன்", + "சுமார்", + "ரூ.2,990", + "மதிப்புள்ள", + "போட்", + "ராக்கர்ஸ்", + "நிறுவனத்தின்", + "ஸ்போர்ட்", + "புளூடூத்", + "ஹெட்போன்ஸ்", + "இலவசமாக", + "வழங்கப்படவுள்ளது", + ".", + ], + ), + ( + "மட்டக்களப்பில் பல இடங்களில் வீட்டுத் திட்டங்களுக்கு இன்று அடிக்கல் நாட்டல்", + [ + "மட்டக்களப்பில்", + "பல", + "இடங்களில்", + "வீட்டுத்", + "திட்டங்களுக்கு", + "இன்று", + "அடிக்கல்", + "நாட்டல்", + ], + ), + ( + "ஐ போன்க்கு முகத்தை வைத்து அன்லாக் செய்யும் முறை மற்றும் விரலால் தொட்டு அன்லாக் செய்யும் முறையை வாட்ஸ் ஆப் நிறுவனம் இதற்கு முன் கண்டுபிடித்தது", + [ + "ஐ", + "போன்க்கு", + "முகத்தை", + "வைத்து", + "அன்லாக்", + "செய்யும்", + "முறை", + "மற்றும்", + "விரலால்", + "தொட்டு", + "அன்லாக்", + "செய்யும்", + "முறையை", + "வாட்ஸ்", + "ஆப்", + "நிறுவனம்", + "இதற்கு", + "முன்", + "கண்டுபிடித்தது", + ], + ), + ( + "இது ஒரு வாக்கியம்.", + [ + "இது", + "ஒரு", + "வாக்கியம்", + ".", + ], + ), + ( + "தன்னாட்சி கார்கள் காப்பீட்டு பொறுப்பை உற்பத்தியாளரிடம் மாற்றுகின்றன", + [ + "தன்னாட்சி", + "கார்கள்", + "காப்பீட்டு", + "பொறுப்பை", + "உற்பத்தியாளரிடம்", + "மாற்றுகின்றன", + ], + ), + ( + "நடைபாதை விநியோக ரோபோக்களை தடை செய்வதை சான் பிரான்சிஸ்கோ கருதுகிறது", + [ + "நடைபாதை", + "விநியோக", + "ரோபோக்களை", + "தடை", + "செய்வதை", + "சான்", + "பிரான்சிஸ்கோ", + "கருதுகிறது", + ], + ), + ( + "லண்டன் ஐக்கிய இராச்சியத்தில் ஒரு பெரிய நகரம்.", + [ + "லண்டன்", + "ஐக்கிய", + "இராச்சியத்தில்", + "ஒரு", + "பெரிய", + "நகரம்", + ".", + ], + ), + ( + "என்ன வேலை செய்கிறீர்கள்?", + [ + "என்ன", + "வேலை", + "செய்கிறீர்கள்", + "?", + ], + ), + ( + "எந்த கல்லூரியில் படிக்கிறாய்?", + [ + "எந்த", + "கல்லூரியில்", + "படிக்கிறாய்", + "?", + ], + ), +] + + +@pytest.mark.parametrize("text,expected_tokens", TA_BASIC_TOKENIZATION_TESTS) +def test_ta_tokenizer_basic(ta_tokenizer, text, expected_tokens): + tokens = ta_tokenizer(text) + token_list = [token.text for token in tokens] + assert expected_tokens == token_list + + +@pytest.mark.parametrize( + "text,expected_tokens", + [ + ( + "ஆப்பிள் நிறுவனம் யு.கே. தொடக்க நிறுவனத்தை ஒரு லட்சம் கோடிக்கு வாங்கப் பார்க்கிறது", + [ + "ஆப்பிள்", + "நிறுவனம்", + "யு.கே.", + "தொடக்க", + "நிறுவனத்தை", + "ஒரு", + "லட்சம்", + "கோடிக்கு", + "வாங்கப்", + "பார்க்கிறது", + ], + ) + ], +) +def test_ta_tokenizer_special_case(text, expected_tokens): + # Add a special rule to tokenize the initialism "யு.கே." (U.K., as + # in the country) as a single token. + nlp = Tamil() + nlp.tokenizer.add_special_case("யு.கே.", [{ORTH: "யு.கே."}]) + tokens = nlp(text) + + token_list = [token.text for token in tokens] + assert expected_tokens == token_list diff --git a/TTS/Kokoro/.venv/Lib/site-packages/spacy/tests/lang/test_attrs.py b/TTS/Kokoro/.venv/Lib/site-packages/spacy/tests/lang/test_attrs.py new file mode 100644 index 0000000000000000000000000000000000000000..452eb2c6e7fbada5eb163fda7b0f8e09141aacf1 --- /dev/null +++ b/TTS/Kokoro/.venv/Lib/site-packages/spacy/tests/lang/test_attrs.py @@ -0,0 +1,135 @@ +import pytest + +from spacy.attrs import ENT_IOB, IS_ALPHA, LEMMA, NORM, ORTH, intify_attrs +from spacy.lang.en.stop_words import STOP_WORDS +from spacy.lang.lex_attrs import ( + is_ascii, + is_currency, + is_punct, + is_stop, + like_url, + word_shape, +) + + +@pytest.mark.parametrize("word", ["the"]) +@pytest.mark.issue(1889) +def test_issue1889(word): + assert is_stop(word, STOP_WORDS) == is_stop(word.upper(), STOP_WORDS) + + +@pytest.mark.parametrize("text", ["dog"]) +def test_attrs_key(text): + assert intify_attrs({"ORTH": text}) == {ORTH: text} + assert intify_attrs({"NORM": text}) == {NORM: text} + assert intify_attrs({"lemma": text}, strings_map={text: 10}) == {LEMMA: 10} + + +@pytest.mark.parametrize("text", ["dog"]) +def test_attrs_idempotence(text): + int_attrs = intify_attrs({"lemma": text, "is_alpha": True}, strings_map={text: 10}) + assert intify_attrs(int_attrs) == {LEMMA: 10, IS_ALPHA: True} + + +@pytest.mark.parametrize("text", ["dog"]) +def test_attrs_do_deprecated(text): + int_attrs = intify_attrs( + {"F": text, "is_alpha": True}, strings_map={text: 10}, _do_deprecated=True + ) + assert int_attrs == {ORTH: 10, IS_ALPHA: True} + + +def test_attrs_ent_iob_intify(): + int_attrs = intify_attrs({"ENT_IOB": ""}) + assert int_attrs == {ENT_IOB: 0} + + int_attrs = intify_attrs({"ENT_IOB": "I"}) + assert int_attrs == {ENT_IOB: 1} + + int_attrs = intify_attrs({"ENT_IOB": "O"}) + assert int_attrs == {ENT_IOB: 2} + + int_attrs = intify_attrs({"ENT_IOB": "B"}) + assert int_attrs == {ENT_IOB: 3} + + int_attrs = intify_attrs({ENT_IOB: ""}) + assert int_attrs == {ENT_IOB: 0} + + int_attrs = intify_attrs({ENT_IOB: "I"}) + assert int_attrs == {ENT_IOB: 1} + + int_attrs = intify_attrs({ENT_IOB: "O"}) + assert int_attrs == {ENT_IOB: 2} + + int_attrs = intify_attrs({ENT_IOB: "B"}) + assert int_attrs == {ENT_IOB: 3} + + with pytest.raises(ValueError): + int_attrs = intify_attrs({"ENT_IOB": "XX"}) + + with pytest.raises(ValueError): + int_attrs = intify_attrs({ENT_IOB: "XX"}) + + +@pytest.mark.parametrize("text,match", [(",", True), (" ", False), ("a", False)]) +def test_lex_attrs_is_punct(text, match): + assert is_punct(text) == match + + +@pytest.mark.parametrize("text,match", [(",", True), ("£", False), ("♥", False)]) +def test_lex_attrs_is_ascii(text, match): + assert is_ascii(text) == match + + +@pytest.mark.parametrize( + "text,match", + [ + ("$", True), + ("£", True), + ("♥", False), + ("€", True), + ("¥", True), + ("¢", True), + ("a", False), + ("www.google.com", False), + ("dog", False), + ], +) +def test_lex_attrs_is_currency(text, match): + assert is_currency(text) == match + + +@pytest.mark.parametrize( + "text,match", + [ + ("www.google.com", True), + ("google.com", True), + ("sydney.com", True), + ("1abc2def.org", True), + ("http://stupid", True), + ("www.hi", True), + ("example.com/example", True), + ("dog", False), + ("1.2", False), + ("1.a", False), + ("hello.There", False), + ], +) +def test_lex_attrs_like_url(text, match): + assert like_url(text) == match + + +@pytest.mark.parametrize( + "text,shape", + [ + ("Nasa", "Xxxx"), + ("capitalized", "xxxx"), + ("999999999", "dddd"), + ("C3P0", "XdXd"), + (",", ","), + ("\n", "\n"), + ("``,-", "``,-"), + ], +) +def test_lex_attrs_word_shape(text, shape): + assert word_shape(text) == shape diff --git a/TTS/Kokoro/.venv/Lib/site-packages/spacy/tests/lang/test_initialize.py b/TTS/Kokoro/.venv/Lib/site-packages/spacy/tests/lang/test_initialize.py new file mode 100644 index 0000000000000000000000000000000000000000..d164c214c6c477628ae3e2945a99de1d2fd21a3f --- /dev/null +++ b/TTS/Kokoro/.venv/Lib/site-packages/spacy/tests/lang/test_initialize.py @@ -0,0 +1,24 @@ +import pytest + +from spacy.util import get_lang_class + +# fmt: off +# Only include languages with no external dependencies +# excluded: ja, ko, th, vi, zh +LANGUAGES = ["af", "am", "ar", "az", "bg", "bn", "ca", "cs", "da", "de", "el", + "en", "es", "et", "eu", "fa", "fi", "fr", "ga", "gu", "he", "hi", + "hr", "hu", "hy", "id", "is", "it", "kn", "ky", "lb", "lt", "lv", + "mk", "ml", "mr", "nb", "ne", "nl", "pl", "pt", "ro", "ru", "sa", + "si", "sk", "sl", "sq", "sr", "sv", "ta", "te", "ti", "tl", "tn", + "tr", "tt", "uk", "ur", "xx", "yo", "kmr"] +# fmt: on + + +@pytest.mark.parametrize("lang", LANGUAGES) +def test_lang_initialize(lang, capfd): + """Test that languages can be initialized.""" + nlp = get_lang_class(lang)() + # Check for stray print statements (see #3342) + doc = nlp("test") # noqa: F841 + captured = capfd.readouterr() + assert not captured.out diff --git a/TTS/Kokoro/.venv/Lib/site-packages/spacy/tests/lang/test_lemmatizers.py b/TTS/Kokoro/.venv/Lib/site-packages/spacy/tests/lang/test_lemmatizers.py new file mode 100644 index 0000000000000000000000000000000000000000..ce3c27d3ce6a9c63d3dee5450e0d8a9d1d28ba64 --- /dev/null +++ b/TTS/Kokoro/.venv/Lib/site-packages/spacy/tests/lang/test_lemmatizers.py @@ -0,0 +1,54 @@ +import pytest + +from spacy import registry +from spacy.lookups import Lookups +from spacy.util import get_lang_class + +# fmt: off +# Only include languages with no external dependencies +# excluded: ru, uk +# excluded for custom tables: es, pl +LANGUAGES = ["bn", "ca", "el", "en", "fa", "fr", "nb", "nl", "sv"] +# fmt: on + + +@pytest.mark.parametrize("lang", LANGUAGES) +def test_lemmatizer_initialize(lang, capfd): + @registry.misc("lemmatizer_init_lookups") + def lemmatizer_init_lookups(): + lookups = Lookups() + lookups.add_table("lemma_lookup", {"cope": "cope", "x": "y"}) + lookups.add_table("lemma_index", {"verb": ("cope", "cop")}) + lookups.add_table("lemma_exc", {"verb": {"coping": ("cope",)}}) + lookups.add_table("lemma_rules", {"verb": [["ing", ""]]}) + return lookups + + lang_cls = get_lang_class(lang) + # Test that languages can be initialized + nlp = lang_cls() + lemmatizer = nlp.add_pipe("lemmatizer", config={"mode": "lookup"}) + assert not lemmatizer.lookups.tables + nlp.config["initialize"]["components"]["lemmatizer"] = { + "lookups": {"@misc": "lemmatizer_init_lookups"} + } + with pytest.raises(ValueError): + nlp("x") + nlp.initialize() + assert lemmatizer.lookups.tables + doc = nlp("x") + # Check for stray print statements (see #3342) + captured = capfd.readouterr() + assert not captured.out + assert doc[0].lemma_ == "y" + + # Test initialization by calling .initialize() directly + nlp = lang_cls() + lemmatizer = nlp.add_pipe("lemmatizer", config={"mode": "lookup"}) + lemmatizer.initialize(lookups=lemmatizer_init_lookups()) + assert nlp("x")[0].lemma_ == "y" + + # Test lookups config format + for mode in ("rule", "lookup", "pos_lookup"): + required, optional = lemmatizer.get_lookups_config(mode) + assert isinstance(required, list) + assert isinstance(optional, list) diff --git a/TTS/Kokoro/.venv/Lib/site-packages/spacy/tests/lang/th/__init__.py b/TTS/Kokoro/.venv/Lib/site-packages/spacy/tests/lang/th/__init__.py new file mode 100644 index 0000000000000000000000000000000000000000..e69de29bb2d1d6434b8b29ae775ad8c2e48c5391 diff --git a/TTS/Kokoro/.venv/Lib/site-packages/spacy/tests/lang/th/__pycache__/__init__.cpython-312.pyc b/TTS/Kokoro/.venv/Lib/site-packages/spacy/tests/lang/th/__pycache__/__init__.cpython-312.pyc new file mode 100644 index 0000000000000000000000000000000000000000..fa9bcedc8f7934909351ce0ce344be9c3b717aca Binary files /dev/null and b/TTS/Kokoro/.venv/Lib/site-packages/spacy/tests/lang/th/__pycache__/__init__.cpython-312.pyc differ diff --git a/TTS/Kokoro/.venv/Lib/site-packages/spacy/tests/lang/th/__pycache__/test_serialize.cpython-312.pyc b/TTS/Kokoro/.venv/Lib/site-packages/spacy/tests/lang/th/__pycache__/test_serialize.cpython-312.pyc new file mode 100644 index 0000000000000000000000000000000000000000..155b439d25714358cab87a9d751f08a5ceb9a5b5 Binary files /dev/null and b/TTS/Kokoro/.venv/Lib/site-packages/spacy/tests/lang/th/__pycache__/test_serialize.cpython-312.pyc differ diff --git a/TTS/Kokoro/.venv/Lib/site-packages/spacy/tests/lang/th/__pycache__/test_tokenizer.cpython-312.pyc b/TTS/Kokoro/.venv/Lib/site-packages/spacy/tests/lang/th/__pycache__/test_tokenizer.cpython-312.pyc new file mode 100644 index 0000000000000000000000000000000000000000..c237a32cf7516f729de9cf25e15104fdc32bbd32 Binary files /dev/null and b/TTS/Kokoro/.venv/Lib/site-packages/spacy/tests/lang/th/__pycache__/test_tokenizer.cpython-312.pyc differ diff --git a/TTS/Kokoro/.venv/Lib/site-packages/spacy/tests/lang/th/test_serialize.py b/TTS/Kokoro/.venv/Lib/site-packages/spacy/tests/lang/th/test_serialize.py new file mode 100644 index 0000000000000000000000000000000000000000..c1000bc48611bb03fd88773ed79609902d6a190b --- /dev/null +++ b/TTS/Kokoro/.venv/Lib/site-packages/spacy/tests/lang/th/test_serialize.py @@ -0,0 +1,25 @@ +import pickle + +from spacy.lang.th import Thai + +from ...util import make_tempdir + + +def test_th_tokenizer_serialize(th_tokenizer): + tokenizer_bytes = th_tokenizer.to_bytes() + nlp = Thai() + nlp.tokenizer.from_bytes(tokenizer_bytes) + assert tokenizer_bytes == nlp.tokenizer.to_bytes() + + with make_tempdir() as d: + file_path = d / "tokenizer" + th_tokenizer.to_disk(file_path) + nlp = Thai() + nlp.tokenizer.from_disk(file_path) + assert tokenizer_bytes == nlp.tokenizer.to_bytes() + + +def test_th_tokenizer_pickle(th_tokenizer): + b = pickle.dumps(th_tokenizer) + th_tokenizer_re = pickle.loads(b) + assert th_tokenizer.to_bytes() == th_tokenizer_re.to_bytes() diff --git a/TTS/Kokoro/.venv/Lib/site-packages/spacy/tests/lang/th/test_tokenizer.py b/TTS/Kokoro/.venv/Lib/site-packages/spacy/tests/lang/th/test_tokenizer.py new file mode 100644 index 0000000000000000000000000000000000000000..ac5f700d62e28b307317b1ab6e72d2ae33f61655 --- /dev/null +++ b/TTS/Kokoro/.venv/Lib/site-packages/spacy/tests/lang/th/test_tokenizer.py @@ -0,0 +1,9 @@ +import pytest + + +@pytest.mark.parametrize( + "text,expected_tokens", [("คุณรักผมไหม", ["คุณ", "รัก", "ผม", "ไหม"])] +) +def test_th_tokenizer(th_tokenizer, text, expected_tokens): + tokens = [token.text for token in th_tokenizer(text)] + assert tokens == expected_tokens diff --git a/TTS/Kokoro/.venv/Lib/site-packages/spacy/tests/lang/ti/__init__.py b/TTS/Kokoro/.venv/Lib/site-packages/spacy/tests/lang/ti/__init__.py new file mode 100644 index 0000000000000000000000000000000000000000..e69de29bb2d1d6434b8b29ae775ad8c2e48c5391 diff --git a/TTS/Kokoro/.venv/Lib/site-packages/spacy/tests/lang/ti/__pycache__/__init__.cpython-312.pyc b/TTS/Kokoro/.venv/Lib/site-packages/spacy/tests/lang/ti/__pycache__/__init__.cpython-312.pyc new file mode 100644 index 0000000000000000000000000000000000000000..d9efc87892b3525c8ad168b8e1aa53201324f077 Binary files /dev/null and b/TTS/Kokoro/.venv/Lib/site-packages/spacy/tests/lang/ti/__pycache__/__init__.cpython-312.pyc differ diff --git a/TTS/Kokoro/.venv/Lib/site-packages/spacy/tests/lang/ti/__pycache__/test_exception.cpython-312.pyc b/TTS/Kokoro/.venv/Lib/site-packages/spacy/tests/lang/ti/__pycache__/test_exception.cpython-312.pyc new file mode 100644 index 0000000000000000000000000000000000000000..c0553f5eebb59d275908753ce02201cd316dcc5f Binary files /dev/null and b/TTS/Kokoro/.venv/Lib/site-packages/spacy/tests/lang/ti/__pycache__/test_exception.cpython-312.pyc differ diff --git a/TTS/Kokoro/.venv/Lib/site-packages/spacy/tests/lang/ti/__pycache__/test_text.cpython-312.pyc b/TTS/Kokoro/.venv/Lib/site-packages/spacy/tests/lang/ti/__pycache__/test_text.cpython-312.pyc new file mode 100644 index 0000000000000000000000000000000000000000..edcf45b44d39c5ac47bdc83b57d2d21dc65b12a9 Binary files /dev/null and b/TTS/Kokoro/.venv/Lib/site-packages/spacy/tests/lang/ti/__pycache__/test_text.cpython-312.pyc differ diff --git a/TTS/Kokoro/.venv/Lib/site-packages/spacy/tests/lang/ti/test_exception.py b/TTS/Kokoro/.venv/Lib/site-packages/spacy/tests/lang/ti/test_exception.py new file mode 100644 index 0000000000000000000000000000000000000000..e69de29bb2d1d6434b8b29ae775ad8c2e48c5391 diff --git a/TTS/Kokoro/.venv/Lib/site-packages/spacy/tests/lang/ti/test_text.py b/TTS/Kokoro/.venv/Lib/site-packages/spacy/tests/lang/ti/test_text.py new file mode 100644 index 0000000000000000000000000000000000000000..457dc4cdaef09defe036943fb5e6810d68c7b7c8 --- /dev/null +++ b/TTS/Kokoro/.venv/Lib/site-packages/spacy/tests/lang/ti/test_text.py @@ -0,0 +1,51 @@ +import pytest + + +def test_ti_tokenizer_handles_long_text(ti_tokenizer): + text = """ቻንስለር ጀርመን ኣንገላ መርከል ኣብታ ሃገር ቁጽሪ መትሓዝቲ ኮቪድ መዓልታዊ ክብረ መዝገብ ድሕሪ ምህራሙ- ጽኑዕ እገዳ ክግበር ጸዊዓ። + +መርከል ሎሚ ንታሕታዋይ ባይቶ ሃገራ ክትገልጽ ከላ፡ ኣብ ወሳኒ ምዕራፍ ቃልሲ ኢና ዘለና-ዳሕራዋይ ማዕበል ካብቲ ቀዳማይ ክገድድ ይኽእል`ዩ ኢላ። + +ትካል ምክልኻል ተላገብቲ ሕማማት ጀርመን፡ ኣብ ዝሓለፈ 24 ሰዓታት ኣብ ምልእቲ ጀርመር 590 ሰባት ብኮቪድ19 ምሟቶም ኣፍሊጡ`ሎ። + +ቻንስለር ኣንጀላ መርከል ኣብ እዋን በዓላት ልደት ስድራቤታት ክተኣኻኸባ ዝፍቀደለን`ኳ እንተኾነ ድሕሪኡ ኣብ ዘሎ ግዜ ግን እቲ እገዳታት ክትግበር ትደሊ።""" + tokens = ti_tokenizer(text) + + assert len(tokens) == 85 + + +@pytest.mark.parametrize( + "text,length", + [ + ("ቻንስለር ጀርመን ኣንገላ መርከል፧", 5), + ("“ስድራቤታት፧”", 4), + ("""ኣብ እዋን በዓላት ልደት ስድራቤታት ክተኣኻኸባ ዝፍቀደለን`ኳ እንተኾነ።""", 9), + ("ብግምት 10ኪ.ሜ. ጎይዩ።", 6), + ("ኣብ ዝሓለፈ 24 ሰዓታት...", 5), + ], +) +def test_ti_tokenizer_handles_cnts(ti_tokenizer, text, length): + tokens = ti_tokenizer(text) + assert len(tokens) == length + + +@pytest.mark.parametrize( + "text,match", + [ + ("10", True), + ("1", True), + ("10.000", True), + ("1000", True), + ("999,0", True), + ("ሓደ", True), + ("ክልተ", True), + ("ትሪልዮን", True), + ("ከልቢ", False), + (",", False), + ("1/2", True), + ], +) +def test_lex_attrs_like_number(ti_tokenizer, text, match): + tokens = ti_tokenizer(text) + assert len(tokens) == 1 + assert tokens[0].like_num == match diff --git a/TTS/Kokoro/.venv/Lib/site-packages/spacy/tests/lang/tl/__init__.py b/TTS/Kokoro/.venv/Lib/site-packages/spacy/tests/lang/tl/__init__.py new file mode 100644 index 0000000000000000000000000000000000000000..e69de29bb2d1d6434b8b29ae775ad8c2e48c5391 diff --git a/TTS/Kokoro/.venv/Lib/site-packages/spacy/tests/lang/tl/__pycache__/__init__.cpython-312.pyc b/TTS/Kokoro/.venv/Lib/site-packages/spacy/tests/lang/tl/__pycache__/__init__.cpython-312.pyc new file mode 100644 index 0000000000000000000000000000000000000000..dcccda387d34de00cf336716877593a967379363 Binary files /dev/null and b/TTS/Kokoro/.venv/Lib/site-packages/spacy/tests/lang/tl/__pycache__/__init__.cpython-312.pyc differ diff --git a/TTS/Kokoro/.venv/Lib/site-packages/spacy/tests/lang/tl/__pycache__/test_indices.cpython-312.pyc b/TTS/Kokoro/.venv/Lib/site-packages/spacy/tests/lang/tl/__pycache__/test_indices.cpython-312.pyc new file mode 100644 index 0000000000000000000000000000000000000000..60b013e68f624373866cd208f42696029e4f0435 Binary files /dev/null and b/TTS/Kokoro/.venv/Lib/site-packages/spacy/tests/lang/tl/__pycache__/test_indices.cpython-312.pyc differ diff --git a/TTS/Kokoro/.venv/Lib/site-packages/spacy/tests/lang/tl/__pycache__/test_punct.cpython-312.pyc b/TTS/Kokoro/.venv/Lib/site-packages/spacy/tests/lang/tl/__pycache__/test_punct.cpython-312.pyc new file mode 100644 index 0000000000000000000000000000000000000000..1f9a7f02c390028f87ee1f76cfa6b3dd50de8b8d Binary files /dev/null and b/TTS/Kokoro/.venv/Lib/site-packages/spacy/tests/lang/tl/__pycache__/test_punct.cpython-312.pyc differ diff --git a/TTS/Kokoro/.venv/Lib/site-packages/spacy/tests/lang/tl/__pycache__/test_text.cpython-312.pyc b/TTS/Kokoro/.venv/Lib/site-packages/spacy/tests/lang/tl/__pycache__/test_text.cpython-312.pyc new file mode 100644 index 0000000000000000000000000000000000000000..2366a148c902a1d07e24da554fd972a2d3e62930 Binary files /dev/null and b/TTS/Kokoro/.venv/Lib/site-packages/spacy/tests/lang/tl/__pycache__/test_text.cpython-312.pyc differ diff --git a/TTS/Kokoro/.venv/Lib/site-packages/spacy/tests/lang/tl/test_indices.py b/TTS/Kokoro/.venv/Lib/site-packages/spacy/tests/lang/tl/test_indices.py new file mode 100644 index 0000000000000000000000000000000000000000..c8e41c1added4364ae10a0ca06b9899eab463496 --- /dev/null +++ b/TTS/Kokoro/.venv/Lib/site-packages/spacy/tests/lang/tl/test_indices.py @@ -0,0 +1,8 @@ +def test_tl_simple_punct(tl_tokenizer): + text = "Sige, punta ka dito" + tokens = tl_tokenizer(text) + assert tokens[0].idx == 0 + assert tokens[1].idx == 4 + assert tokens[2].idx == 6 + assert tokens[3].idx == 12 + assert tokens[4].idx == 15 diff --git a/TTS/Kokoro/.venv/Lib/site-packages/spacy/tests/lang/tl/test_punct.py b/TTS/Kokoro/.venv/Lib/site-packages/spacy/tests/lang/tl/test_punct.py new file mode 100644 index 0000000000000000000000000000000000000000..095c219701c9940ca8cac4e78bd13bb99846ad4f --- /dev/null +++ b/TTS/Kokoro/.venv/Lib/site-packages/spacy/tests/lang/tl/test_punct.py @@ -0,0 +1,127 @@ +import pytest + +from spacy.lang.punctuation import TOKENIZER_PREFIXES +from spacy.util import compile_prefix_regex + +PUNCT_OPEN = ["(", "[", "{", "*"] +PUNCT_CLOSE = [")", "]", "}", "*"] +PUNCT_PAIRED = [("(", ")"), ("[", "]"), ("{", "}"), ("*", "*")] + + +@pytest.mark.parametrize("text", ["(", "((", "<"]) +def test_tl_tokenizer_handles_only_punct(tl_tokenizer, text): + tokens = tl_tokenizer(text) + assert len(tokens) == len(text) + + +@pytest.mark.parametrize("punct", PUNCT_OPEN) +@pytest.mark.parametrize("text", ["Mabuhay"]) +def test_tl_tokenizer_split_open_punct(tl_tokenizer, punct, text): + tokens = tl_tokenizer(punct + text) + assert len(tokens) == 2 + assert tokens[0].text == punct + assert tokens[1].text == text + + +@pytest.mark.parametrize("punct", PUNCT_CLOSE) +@pytest.mark.parametrize("text", ["Mabuhay"]) +def test_tl_tokenizer_splits_close_punct(tl_tokenizer, punct, text): + tokens = tl_tokenizer(text + punct) + assert len(tokens) == 2 + assert tokens[0].text == text + assert tokens[1].text == punct + + +@pytest.mark.parametrize("punct", PUNCT_OPEN) +@pytest.mark.parametrize("punct_add", ["`"]) +@pytest.mark.parametrize("text", ["Mabuhay"]) +def test_tl_tokenizer_splits_two_diff_open_punct(tl_tokenizer, punct, punct_add, text): + tokens = tl_tokenizer(punct + punct_add + text) + assert len(tokens) == 3 + assert tokens[0].text == punct + assert tokens[1].text == punct_add + assert tokens[2].text == text + + +@pytest.mark.parametrize("punct", PUNCT_CLOSE) +@pytest.mark.parametrize("punct_add", ["`"]) +@pytest.mark.parametrize("text", ["Mabuhay"]) +def test_tl_tokenizer_splits_two_diff_close_punct(tl_tokenizer, punct, punct_add, text): + tokens = tl_tokenizer(text + punct + punct_add) + assert len(tokens) == 3 + assert tokens[0].text == text + assert tokens[1].text == punct + assert tokens[2].text == punct_add + + +@pytest.mark.parametrize("punct", PUNCT_OPEN) +@pytest.mark.parametrize("text", ["Mabuhay"]) +def test_tl_tokenizer_splits_same_open_punct(tl_tokenizer, punct, text): + tokens = tl_tokenizer(punct + punct + punct + text) + assert len(tokens) == 4 + assert tokens[0].text == punct + assert tokens[3].text == text + + +@pytest.mark.parametrize("punct", PUNCT_CLOSE) +@pytest.mark.parametrize("text", ["Mabuhay"]) +def test_tl_tokenizer_splits_same_close_punct(tl_tokenizer, punct, text): + tokens = tl_tokenizer(text + punct + punct + punct) + assert len(tokens) == 4 + assert tokens[0].text == text + assert tokens[1].text == punct + + +@pytest.mark.parametrize("text", ["'Ang"]) +def test_tl_tokenizer_splits_open_apostrophe(tl_tokenizer, text): + tokens = tl_tokenizer(text) + assert len(tokens) == 2 + assert tokens[0].text == "'" + + +@pytest.mark.parametrize("text", ["Mabuhay''"]) +def test_tl_tokenizer_splits_double_end_quote(tl_tokenizer, text): + tokens = tl_tokenizer(text) + assert len(tokens) == 2 + tokens_punct = tl_tokenizer("''") + assert len(tokens_punct) == 1 + + +@pytest.mark.parametrize("punct_open,punct_close", PUNCT_PAIRED) +@pytest.mark.parametrize("text", ["Mabuhay"]) +def test_tl_tokenizer_splits_open_close_punct( + tl_tokenizer, punct_open, punct_close, text +): + tokens = tl_tokenizer(punct_open + text + punct_close) + assert len(tokens) == 3 + assert tokens[0].text == punct_open + assert tokens[1].text == text + assert tokens[2].text == punct_close + + +@pytest.mark.parametrize("punct_open,punct_close", PUNCT_PAIRED) +@pytest.mark.parametrize("punct_open2,punct_close2", [("`", "'")]) +@pytest.mark.parametrize("text", ["Mabuhay"]) +def test_tl_tokenizer_two_diff_punct( + tl_tokenizer, punct_open, punct_close, punct_open2, punct_close2, text +): + tokens = tl_tokenizer(punct_open2 + punct_open + text + punct_close + punct_close2) + assert len(tokens) == 5 + assert tokens[0].text == punct_open2 + assert tokens[1].text == punct_open + assert tokens[2].text == text + assert tokens[3].text == punct_close + assert tokens[4].text == punct_close2 + + +@pytest.mark.parametrize("text,punct", [("(sa'yo", "(")]) +def test_tl_tokenizer_splits_pre_punct_regex(text, punct): + tl_search_prefixes = compile_prefix_regex(TOKENIZER_PREFIXES).search + match = tl_search_prefixes(text) + assert match.group() == punct + + +def test_tl_tokenizer_splits_bracket_period(tl_tokenizer): + text = "(Dumating siya kahapon)." + tokens = tl_tokenizer(text) + assert tokens[len(tokens) - 1].text == "." diff --git a/TTS/Kokoro/.venv/Lib/site-packages/spacy/tests/lang/tl/test_text.py b/TTS/Kokoro/.venv/Lib/site-packages/spacy/tests/lang/tl/test_text.py new file mode 100644 index 0000000000000000000000000000000000000000..8409b18c3e4f2f9d769b7ac03bcc42e462c540ee --- /dev/null +++ b/TTS/Kokoro/.venv/Lib/site-packages/spacy/tests/lang/tl/test_text.py @@ -0,0 +1,74 @@ +import pytest + +from spacy.lang.tl.lex_attrs import like_num + +# https://github.com/explosion/spaCy/blob/master/spacy/tests/lang/en/test_text.py + + +def test_tl_tokenizer_handles_long_text(tl_tokenizer): + # Excerpt: "Sapagkat ang Pilosopiya ay Ginagawa" by Padre Roque Ferriols + text = """ + Tingin tayo nang tingin. Kailangan lamang nating dumilat at + marami tayong makikita. At ang pagtingin ay isang gawain na ako lamang ang + makagagawa, kung ako nga ang makakita. Kahit na napanood na ng aking + matalik na kaibigan ang isang sine, kailangan ko pa ring panoorin, kung + ako nga ang may gustong makakita. Kahit na gaano kadikit ang aming + pagkabuklod, hindi siya maaaring tumingin sa isang paraan na ako ang + nakakakita. Kung ako ang makakita, ako lamang ang makatitingin. + """ + tokens = tl_tokenizer(text) + assert len(tokens) == 97 + + +@pytest.mark.parametrize( + "text,length", + [ + ("Huwag mo nang itanong sa akin.", 7), + ("Nasubukan mo na bang hulihin ang hangin?", 8), + ("Hindi ba?", 3), + ("Nagbukas ang DFA ng 1,000 appointment slots para sa pasaporte.", 11), + ("'Wala raw pasok bukas kasi may bagyo!' sabi ni Micah.", 14), + ("'Ingat,' aniya. 'Maingay sila pag malayo at tahimik kung malapit.'", 17), + ], +) +def test_tl_tokenizer_handles_cnts(tl_tokenizer, text, length): + tokens = tl_tokenizer(text) + assert len(tokens) == length + + +@pytest.mark.parametrize( + "text,match", + [ + ("10", True), + ("isa", True), + ("dalawa", True), + ("tatlumpu", True), + pytest.param( + "isang daan", + True, + marks=pytest.mark.xfail(reason="Not yet implemented (means 100)"), + ), + pytest.param( + "kalahati", + True, + marks=pytest.mark.xfail(reason="Not yet implemented (means 1/2)"), + ), + pytest.param( + "isa't kalahati", + True, + marks=pytest.mark.xfail( + reason="Not yet implemented (means one-and-a-half)" + ), + ), + ], +) +def test_lex_attrs_like_number(tl_tokenizer, text, match): + tokens = tl_tokenizer(text) + assert all([token.like_num for token in tokens]) == match + + +@pytest.mark.xfail(reason="Not yet implemented, fails when capitalized.") +@pytest.mark.parametrize("word", ["isa", "dalawa", "tatlo"]) +def test_tl_lex_attrs_capitals(word): + assert like_num(word) + assert like_num(word.upper()) diff --git a/TTS/Kokoro/.venv/Lib/site-packages/spacy/tests/lang/tr/__init__.py b/TTS/Kokoro/.venv/Lib/site-packages/spacy/tests/lang/tr/__init__.py new file mode 100644 index 0000000000000000000000000000000000000000..e69de29bb2d1d6434b8b29ae775ad8c2e48c5391 diff --git a/TTS/Kokoro/.venv/Lib/site-packages/spacy/tests/lang/tr/__pycache__/__init__.cpython-312.pyc b/TTS/Kokoro/.venv/Lib/site-packages/spacy/tests/lang/tr/__pycache__/__init__.cpython-312.pyc new file mode 100644 index 0000000000000000000000000000000000000000..ce03f010e4a6d71ea2562f73126b3d4077c3ab4e Binary files /dev/null and b/TTS/Kokoro/.venv/Lib/site-packages/spacy/tests/lang/tr/__pycache__/__init__.cpython-312.pyc differ diff --git a/TTS/Kokoro/.venv/Lib/site-packages/spacy/tests/lang/tr/__pycache__/test_noun_chunks.cpython-312.pyc b/TTS/Kokoro/.venv/Lib/site-packages/spacy/tests/lang/tr/__pycache__/test_noun_chunks.cpython-312.pyc new file mode 100644 index 0000000000000000000000000000000000000000..eed4284949e43d4a40866053d136895117230390 Binary files /dev/null and b/TTS/Kokoro/.venv/Lib/site-packages/spacy/tests/lang/tr/__pycache__/test_noun_chunks.cpython-312.pyc differ diff --git a/TTS/Kokoro/.venv/Lib/site-packages/spacy/tests/lang/tr/__pycache__/test_parser.cpython-312.pyc b/TTS/Kokoro/.venv/Lib/site-packages/spacy/tests/lang/tr/__pycache__/test_parser.cpython-312.pyc new file mode 100644 index 0000000000000000000000000000000000000000..a1633eb659ec484612c19fef6a83909f7f785ef5 Binary files /dev/null and b/TTS/Kokoro/.venv/Lib/site-packages/spacy/tests/lang/tr/__pycache__/test_parser.cpython-312.pyc differ diff --git a/TTS/Kokoro/.venv/Lib/site-packages/spacy/tests/lang/tr/__pycache__/test_text.cpython-312.pyc b/TTS/Kokoro/.venv/Lib/site-packages/spacy/tests/lang/tr/__pycache__/test_text.cpython-312.pyc new file mode 100644 index 0000000000000000000000000000000000000000..549ef1b9f8f4bc5fe4ba82d98c386da8a8f9dd3e Binary files /dev/null and b/TTS/Kokoro/.venv/Lib/site-packages/spacy/tests/lang/tr/__pycache__/test_text.cpython-312.pyc differ diff --git a/TTS/Kokoro/.venv/Lib/site-packages/spacy/tests/lang/tr/__pycache__/test_tokenizer.cpython-312.pyc b/TTS/Kokoro/.venv/Lib/site-packages/spacy/tests/lang/tr/__pycache__/test_tokenizer.cpython-312.pyc new file mode 100644 index 0000000000000000000000000000000000000000..8d596e24b941ab20c92d92e2e3a479b200964f4c Binary files /dev/null and b/TTS/Kokoro/.venv/Lib/site-packages/spacy/tests/lang/tr/__pycache__/test_tokenizer.cpython-312.pyc differ diff --git a/TTS/Kokoro/.venv/Lib/site-packages/spacy/tests/lang/tr/test_noun_chunks.py b/TTS/Kokoro/.venv/Lib/site-packages/spacy/tests/lang/tr/test_noun_chunks.py new file mode 100644 index 0000000000000000000000000000000000000000..8b84c2dba1ecc3755dd5bb3bd78d7c2db480a111 --- /dev/null +++ b/TTS/Kokoro/.venv/Lib/site-packages/spacy/tests/lang/tr/test_noun_chunks.py @@ -0,0 +1,12 @@ +import pytest + + +def test_noun_chunks_is_parsed(tr_tokenizer): + """Test that noun_chunks raises Value Error for 'tr' language if Doc is not parsed. + To check this test, we're constructing a Doc + with a new Vocab here and forcing is_parsed to 'False' + to make sure the noun chunks don't run. + """ + doc = tr_tokenizer("Dün seni gördüm.") + with pytest.raises(ValueError): + list(doc.noun_chunks) diff --git a/TTS/Kokoro/.venv/Lib/site-packages/spacy/tests/lang/tr/test_parser.py b/TTS/Kokoro/.venv/Lib/site-packages/spacy/tests/lang/tr/test_parser.py new file mode 100644 index 0000000000000000000000000000000000000000..9e772eec8b390791f1e10c4dfc519fa69f032f65 --- /dev/null +++ b/TTS/Kokoro/.venv/Lib/site-packages/spacy/tests/lang/tr/test_parser.py @@ -0,0 +1,575 @@ +from spacy.tokens import Doc + + +def test_tr_noun_chunks_amod_simple(tr_tokenizer): + text = "sarı kedi" + heads = [1, 1] + deps = ["amod", "ROOT"] + pos = ["ADJ", "NOUN"] + tokens = tr_tokenizer(text) + doc = Doc( + tokens.vocab, words=[t.text for t in tokens], pos=pos, heads=heads, deps=deps + ) + chunks = list(doc.noun_chunks) + assert len(chunks) == 1 + assert chunks[0].text_with_ws == "sarı kedi " + + +def test_tr_noun_chunks_nmod_simple(tr_tokenizer): + text = "arkadaşımın kedisi" # my friend's cat + heads = [1, 1] + deps = ["nmod", "ROOT"] + pos = ["NOUN", "NOUN"] + tokens = tr_tokenizer(text) + doc = Doc( + tokens.vocab, words=[t.text for t in tokens], pos=pos, heads=heads, deps=deps + ) + chunks = list(doc.noun_chunks) + assert len(chunks) == 1 + assert chunks[0].text_with_ws == "arkadaşımın kedisi " + + +def test_tr_noun_chunks_determiner_simple(tr_tokenizer): + text = "O kedi" # that cat + heads = [1, 1] + deps = ["det", "ROOT"] + pos = ["DET", "NOUN"] + tokens = tr_tokenizer(text) + doc = Doc( + tokens.vocab, words=[t.text for t in tokens], pos=pos, heads=heads, deps=deps + ) + chunks = list(doc.noun_chunks) + assert len(chunks) == 1 + assert chunks[0].text_with_ws == "O kedi " + + +def test_tr_noun_chunks_nmod_amod(tr_tokenizer): + text = "okulun eski müdürü" + heads = [2, 2, 2] + deps = ["nmod", "amod", "ROOT"] + pos = ["NOUN", "ADJ", "NOUN"] + tokens = tr_tokenizer(text) + doc = Doc( + tokens.vocab, words=[t.text for t in tokens], pos=pos, heads=heads, deps=deps + ) + chunks = list(doc.noun_chunks) + assert len(chunks) == 1 + assert chunks[0].text_with_ws == "okulun eski müdürü " + + +def test_tr_noun_chunks_one_det_one_adj_simple(tr_tokenizer): + text = "O sarı kedi" + heads = [2, 2, 2] + deps = ["det", "amod", "ROOT"] + pos = ["DET", "ADJ", "NOUN"] + tokens = tr_tokenizer(text) + doc = Doc( + tokens.vocab, words=[t.text for t in tokens], pos=pos, heads=heads, deps=deps + ) + chunks = list(doc.noun_chunks) + assert len(chunks) == 1 + assert chunks[0].text_with_ws == "O sarı kedi " + + +def test_tr_noun_chunks_two_adjs_simple(tr_tokenizer): + text = "beyaz tombik kedi" + heads = [2, 2, 2] + deps = ["amod", "amod", "ROOT"] + pos = ["ADJ", "ADJ", "NOUN"] + tokens = tr_tokenizer(text) + doc = Doc( + tokens.vocab, words=[t.text for t in tokens], pos=pos, heads=heads, deps=deps + ) + chunks = list(doc.noun_chunks) + assert len(chunks) == 1 + assert chunks[0].text_with_ws == "beyaz tombik kedi " + + +def test_tr_noun_chunks_one_det_two_adjs_simple(tr_tokenizer): + text = "o beyaz tombik kedi" + heads = [3, 3, 3, 3] + deps = ["det", "amod", "amod", "ROOT"] + pos = ["DET", "ADJ", "ADJ", "NOUN"] + tokens = tr_tokenizer(text) + doc = Doc( + tokens.vocab, words=[t.text for t in tokens], pos=pos, heads=heads, deps=deps + ) + chunks = list(doc.noun_chunks) + assert len(chunks) == 1 + assert chunks[0].text_with_ws == "o beyaz tombik kedi " + + +def test_tr_noun_chunks_nmod_two(tr_tokenizer): + text = "kızın saçının rengi" + heads = [1, 2, 2] + deps = ["nmod", "nmod", "ROOT"] + pos = ["NOUN", "NOUN", "NOUN"] + tokens = tr_tokenizer(text) + doc = Doc( + tokens.vocab, words=[t.text for t in tokens], pos=pos, heads=heads, deps=deps + ) + chunks = list(doc.noun_chunks) + assert len(chunks) == 1 + assert chunks[0].text_with_ws == "kızın saçının rengi " + + +def test_tr_noun_chunks_chain_nmod_with_adj(tr_tokenizer): + text = "ev sahibinin tatlı köpeği" + heads = [1, 3, 3, 3] + deps = ["nmod", "nmod", "amod", "ROOT"] + pos = ["NOUN", "NOUN", "ADJ", "NOUN"] + tokens = tr_tokenizer(text) + doc = Doc( + tokens.vocab, words=[t.text for t in tokens], pos=pos, heads=heads, deps=deps + ) + chunks = list(doc.noun_chunks) + assert len(chunks) == 1 + assert chunks[0].text_with_ws == "ev sahibinin tatlı köpeği " + + +def test_tr_noun_chunks_chain_nmod_with_acl(tr_tokenizer): + text = "ev sahibinin gelen köpeği" + heads = [1, 3, 3, 3] + deps = ["nmod", "nmod", "acl", "ROOT"] + pos = ["NOUN", "NOUN", "VERB", "NOUN"] + tokens = tr_tokenizer(text) + doc = Doc( + tokens.vocab, words=[t.text for t in tokens], pos=pos, heads=heads, deps=deps + ) + chunks = list(doc.noun_chunks) + assert len(chunks) == 1 + assert chunks[0].text_with_ws == "ev sahibinin gelen köpeği " + + +def test_tr_noun_chunks_chain_nmod_head_with_amod_acl(tr_tokenizer): + text = "arabanın kırdığım sol aynası" + heads = [3, 3, 3, 3] + deps = ["nmod", "acl", "amod", "ROOT"] + pos = ["NOUN", "VERB", "ADJ", "NOUN"] + tokens = tr_tokenizer(text) + doc = Doc( + tokens.vocab, words=[t.text for t in tokens], pos=pos, heads=heads, deps=deps + ) + chunks = list(doc.noun_chunks) + assert len(chunks) == 1 + assert chunks[0].text_with_ws == "arabanın kırdığım sol aynası " + + +def test_tr_noun_chunks_nmod_three(tr_tokenizer): + text = "güney Afrika ülkelerinden Mozambik" + heads = [1, 2, 3, 3] + deps = ["nmod", "nmod", "nmod", "ROOT"] + pos = ["NOUN", "PROPN", "NOUN", "PROPN"] + tokens = tr_tokenizer(text) + doc = Doc( + tokens.vocab, words=[t.text for t in tokens], pos=pos, heads=heads, deps=deps + ) + chunks = list(doc.noun_chunks) + assert len(chunks) == 1 + assert chunks[0].text_with_ws == "güney Afrika ülkelerinden Mozambik " + + +def test_tr_noun_chunks_det_amod_nmod(tr_tokenizer): + text = "bazı eski oyun kuralları" + heads = [3, 3, 3, 3] + deps = ["det", "nmod", "nmod", "ROOT"] + pos = ["DET", "ADJ", "NOUN", "NOUN"] + tokens = tr_tokenizer(text) + doc = Doc( + tokens.vocab, words=[t.text for t in tokens], pos=pos, heads=heads, deps=deps + ) + chunks = list(doc.noun_chunks) + assert len(chunks) == 1 + assert chunks[0].text_with_ws == "bazı eski oyun kuralları " + + +def test_tr_noun_chunks_acl_simple(tr_tokenizer): + text = "bahçesi olan okul" + heads = [2, 0, 2] + deps = ["acl", "cop", "ROOT"] + pos = ["NOUN", "AUX", "NOUN"] + tokens = tr_tokenizer(text) + doc = Doc( + tokens.vocab, words=[t.text for t in tokens], pos=pos, heads=heads, deps=deps + ) + chunks = list(doc.noun_chunks) + assert len(chunks) == 1 + assert chunks[0].text_with_ws == "bahçesi olan okul " + + +def test_tr_noun_chunks_acl_verb(tr_tokenizer): + text = "sevdiğim sanatçılar" + heads = [1, 1] + deps = ["acl", "ROOT"] + pos = ["VERB", "NOUN"] + tokens = tr_tokenizer(text) + doc = Doc( + tokens.vocab, words=[t.text for t in tokens], pos=pos, heads=heads, deps=deps + ) + chunks = list(doc.noun_chunks) + assert len(chunks) == 1 + assert chunks[0].text_with_ws == "sevdiğim sanatçılar " + + +def test_tr_noun_chunks_acl_nmod(tr_tokenizer): + text = "en sevdiğim ses sanatçısı" + heads = [1, 3, 3, 3] + deps = ["advmod", "acl", "nmod", "ROOT"] + pos = ["ADV", "VERB", "NOUN", "NOUN"] + tokens = tr_tokenizer(text) + doc = Doc( + tokens.vocab, words=[t.text for t in tokens], pos=pos, heads=heads, deps=deps + ) + chunks = list(doc.noun_chunks) + assert len(chunks) == 1 + assert chunks[0].text_with_ws == "en sevdiğim ses sanatçısı " + + +def test_tr_noun_chunks_acl_nmod2(tr_tokenizer): + text = "bildiğim bir turizm şirketi" + heads = [3, 3, 3, 3] + deps = ["acl", "det", "nmod", "ROOT"] + pos = ["VERB", "DET", "NOUN", "NOUN"] + tokens = tr_tokenizer(text) + doc = Doc( + tokens.vocab, words=[t.text for t in tokens], pos=pos, heads=heads, deps=deps + ) + chunks = list(doc.noun_chunks) + assert len(chunks) == 1 + assert chunks[0].text_with_ws == "bildiğim bir turizm şirketi " + + +def test_tr_noun_chunks_np_recursive_nsubj_to_root(tr_tokenizer): + text = "Simge'nin okuduğu kitap" + heads = [1, 2, 2] + deps = ["nsubj", "acl", "ROOT"] + pos = ["PROPN", "VERB", "NOUN"] + tokens = tr_tokenizer(text) + doc = Doc( + tokens.vocab, words=[t.text for t in tokens], pos=pos, heads=heads, deps=deps + ) + chunks = list(doc.noun_chunks) + assert len(chunks) == 1 + assert chunks[0].text_with_ws == "Simge'nin okuduğu kitap " + + +def test_tr_noun_chunks_np_recursive_nsubj_attached_to_pron_root(tr_tokenizer): + text = "Simge'nin konuşabileceği birisi" + heads = [1, 2, 2] + deps = ["nsubj", "acl", "ROOT"] + pos = ["PROPN", "VERB", "PRON"] + tokens = tr_tokenizer(text) + doc = Doc( + tokens.vocab, words=[t.text for t in tokens], pos=pos, heads=heads, deps=deps + ) + chunks = list(doc.noun_chunks) + assert len(chunks) == 1 + assert chunks[0].text_with_ws == "Simge'nin konuşabileceği birisi " + + +def test_tr_noun_chunks_np_recursive_nsubj_in_subnp(tr_tokenizer): + text = "Simge'nin yarın gideceği yer" + heads = [2, 2, 3, 3] + deps = ["nsubj", "obl", "acl", "ROOT"] + pos = ["PROPN", "NOUN", "VERB", "NOUN"] + tokens = tr_tokenizer(text) + doc = Doc( + tokens.vocab, words=[t.text for t in tokens], pos=pos, heads=heads, deps=deps + ) + chunks = list(doc.noun_chunks) + assert len(chunks) == 1 + assert chunks[0].text_with_ws == "Simge'nin yarın gideceği yer " + + +def test_tr_noun_chunks_np_recursive_two_nmods(tr_tokenizer): + text = "ustanın kapısını degiştireceği çamasır makinası" + heads = [2, 2, 4, 4, 4] + deps = ["nsubj", "obj", "acl", "nmod", "ROOT"] + pos = ["NOUN", "NOUN", "VERB", "NOUN", "NOUN"] + tokens = tr_tokenizer(text) + doc = Doc( + tokens.vocab, words=[t.text for t in tokens], pos=pos, heads=heads, deps=deps + ) + chunks = list(doc.noun_chunks) + assert len(chunks) == 1 + assert chunks[0].text_with_ws == "ustanın kapısını degiştireceği çamasır makinası " + + +def test_tr_noun_chunks_np_recursive_four_nouns(tr_tokenizer): + text = "kızına piyano dersi verdiğim hanım" + heads = [3, 2, 3, 4, 4] + deps = ["obl", "nmod", "obj", "acl", "ROOT"] + pos = ["NOUN", "NOUN", "NOUN", "VERB", "NOUN"] + tokens = tr_tokenizer(text) + doc = Doc( + tokens.vocab, words=[t.text for t in tokens], pos=pos, heads=heads, deps=deps + ) + chunks = list(doc.noun_chunks) + assert len(chunks) == 1 + assert chunks[0].text_with_ws == "kızına piyano dersi verdiğim hanım " + + +def test_tr_noun_chunks_np_recursive_no_nmod(tr_tokenizer): + text = "içine birkaç çiçek konmuş olan bir vazo" + heads = [3, 2, 3, 6, 3, 6, 6] + deps = ["obl", "det", "nsubj", "acl", "aux", "det", "ROOT"] + pos = ["ADP", "DET", "NOUN", "VERB", "AUX", "DET", "NOUN"] + tokens = tr_tokenizer(text) + doc = Doc( + tokens.vocab, words=[t.text for t in tokens], pos=pos, heads=heads, deps=deps + ) + chunks = list(doc.noun_chunks) + assert len(chunks) == 1 + assert chunks[0].text_with_ws == "içine birkaç çiçek konmuş olan bir vazo " + + +def test_tr_noun_chunks_np_recursive_long_two_acls(tr_tokenizer): + text = "içine Simge'nin bahçesinden toplanmış birkaç çiçeğin konmuş olduğu bir vazo" + heads = [6, 2, 3, 5, 5, 6, 9, 6, 9, 9] + deps = ["obl", "nmod", "obl", "acl", "det", "nsubj", "acl", "aux", "det", "ROOT"] + pos = ["ADP", "PROPN", "NOUN", "VERB", "DET", "NOUN", "VERB", "AUX", "DET", "NOUN"] + tokens = tr_tokenizer(text) + doc = Doc( + tokens.vocab, words=[t.text for t in tokens], pos=pos, heads=heads, deps=deps + ) + chunks = list(doc.noun_chunks) + assert len(chunks) == 1 + assert ( + chunks[0].text_with_ws + == "içine Simge'nin bahçesinden toplanmış birkaç çiçeğin konmuş olduğu bir vazo " + ) + + +def test_tr_noun_chunks_two_nouns_in_nmod(tr_tokenizer): + text = "kız ve erkek çocuklar" + heads = [3, 2, 0, 3] + deps = ["nmod", "cc", "conj", "ROOT"] + pos = ["NOUN", "CCONJ", "NOUN", "NOUN"] + tokens = tr_tokenizer(text) + doc = Doc( + tokens.vocab, words=[t.text for t in tokens], pos=pos, heads=heads, deps=deps + ) + chunks = list(doc.noun_chunks) + assert len(chunks) == 1 + assert chunks[0].text_with_ws == "kız ve erkek çocuklar " + + +def test_tr_noun_chunks_two_nouns_in_nmod2(tr_tokenizer): + text = "tatlı ve gürbüz çocuklar" + heads = [3, 2, 0, 3] + deps = ["amod", "cc", "conj", "ROOT"] + pos = ["ADJ", "CCONJ", "NOUN", "NOUN"] + tokens = tr_tokenizer(text) + doc = Doc( + tokens.vocab, words=[t.text for t in tokens], pos=pos, heads=heads, deps=deps + ) + chunks = list(doc.noun_chunks) + assert len(chunks) == 1 + assert chunks[0].text_with_ws == "tatlı ve gürbüz çocuklar " + + +def test_tr_noun_chunks_conj_simple(tr_tokenizer): + text = "Sen ya da ben" + heads = [0, 3, 1, 0] + deps = ["ROOT", "cc", "fixed", "conj"] + pos = ["PRON", "CCONJ", "CCONJ", "PRON"] + tokens = tr_tokenizer(text) + doc = Doc( + tokens.vocab, words=[t.text for t in tokens], pos=pos, heads=heads, deps=deps + ) + chunks = list(doc.noun_chunks) + assert len(chunks) == 2 + assert chunks[0].text_with_ws == "ben " + assert chunks[1].text_with_ws == "Sen " + + +def test_tr_noun_chunks_conj_three(tr_tokenizer): + text = "sen, ben ve ondan" + heads = [0, 2, 0, 4, 0] + deps = ["ROOT", "punct", "conj", "cc", "conj"] + pos = ["PRON", "PUNCT", "PRON", "CCONJ", "PRON"] + tokens = tr_tokenizer(text) + doc = Doc( + tokens.vocab, words=[t.text for t in tokens], pos=pos, heads=heads, deps=deps + ) + chunks = list(doc.noun_chunks) + assert len(chunks) == 3 + assert chunks[0].text_with_ws == "ondan " + assert chunks[1].text_with_ws == "ben " + assert chunks[2].text_with_ws == "sen " + + +def test_tr_noun_chunks_conj_three2(tr_tokenizer): + text = "ben ya da sen ya da onlar" + heads = [0, 3, 1, 0, 6, 4, 3] + deps = ["ROOT", "cc", "fixed", "conj", "cc", "fixed", "conj"] + pos = ["PRON", "CCONJ", "CCONJ", "PRON", "CCONJ", "CCONJ", "PRON"] + tokens = tr_tokenizer(text) + doc = Doc( + tokens.vocab, words=[t.text for t in tokens], pos=pos, heads=heads, deps=deps + ) + chunks = list(doc.noun_chunks) + assert len(chunks) == 3 + assert chunks[0].text_with_ws == "onlar " + assert chunks[1].text_with_ws == "sen " + assert chunks[2].text_with_ws == "ben " + + +def test_tr_noun_chunks_conj_and_adj_phrase(tr_tokenizer): + text = "ben ve akıllı çocuk" + heads = [0, 3, 3, 0] + deps = ["ROOT", "cc", "amod", "conj"] + pos = ["PRON", "CCONJ", "ADJ", "NOUN"] + tokens = tr_tokenizer(text) + doc = Doc( + tokens.vocab, words=[t.text for t in tokens], pos=pos, heads=heads, deps=deps + ) + chunks = list(doc.noun_chunks) + assert len(chunks) == 2 + assert chunks[0].text_with_ws == "akıllı çocuk " + assert chunks[1].text_with_ws == "ben " + + +def test_tr_noun_chunks_conj_fixed_adj_phrase(tr_tokenizer): + text = "ben ya da akıllı çocuk" + heads = [0, 4, 1, 4, 0] + deps = ["ROOT", "cc", "fixed", "amod", "conj"] + pos = ["PRON", "CCONJ", "CCONJ", "ADJ", "NOUN"] + tokens = tr_tokenizer(text) + doc = Doc( + tokens.vocab, words=[t.text for t in tokens], pos=pos, heads=heads, deps=deps + ) + chunks = list(doc.noun_chunks) + assert len(chunks) == 2 + assert chunks[0].text_with_ws == "akıllı çocuk " + assert chunks[1].text_with_ws == "ben " + + +def test_tr_noun_chunks_conj_subject(tr_tokenizer): + text = "Sen ve ben iyi anlaşıyoruz" + heads = [4, 2, 0, 2, 4] + deps = ["nsubj", "cc", "conj", "adv", "ROOT"] + pos = ["PRON", "CCONJ", "PRON", "ADV", "VERB"] + tokens = tr_tokenizer(text) + doc = Doc( + tokens.vocab, words=[t.text for t in tokens], pos=pos, heads=heads, deps=deps + ) + chunks = list(doc.noun_chunks) + assert len(chunks) == 2 + assert chunks[0].text_with_ws == "ben " + assert chunks[1].text_with_ws == "Sen " + + +def test_tr_noun_chunks_conj_noun_head_verb(tr_tokenizer): + text = "Simge babasını görmüyormuş, annesini değil" + heads = [2, 2, 2, 4, 2, 4] + deps = ["nsubj", "obj", "ROOT", "punct", "conj", "aux"] + pos = ["PROPN", "NOUN", "VERB", "PUNCT", "NOUN", "AUX"] + tokens = tr_tokenizer(text) + doc = Doc( + tokens.vocab, words=[t.text for t in tokens], pos=pos, heads=heads, deps=deps + ) + chunks = list(doc.noun_chunks) + assert len(chunks) == 3 + assert chunks[0].text_with_ws == "annesini " + assert chunks[1].text_with_ws == "babasını " + assert chunks[2].text_with_ws == "Simge " + + +def test_tr_noun_chunks_flat_simple(tr_tokenizer): + text = "New York" + heads = [0, 0] + deps = ["ROOT", "flat"] + pos = ["PROPN", "PROPN"] + tokens = tr_tokenizer(text) + doc = Doc( + tokens.vocab, words=[t.text for t in tokens], pos=pos, heads=heads, deps=deps + ) + chunks = list(doc.noun_chunks) + assert len(chunks) == 1 + assert chunks[0].text_with_ws == "New York " + + +def test_tr_noun_chunks_flat_names_and_title(tr_tokenizer): + text = "Gazi Mustafa Kemal" + heads = [1, 1, 1] + deps = ["nmod", "ROOT", "flat"] + pos = ["PROPN", "PROPN", "PROPN"] + tokens = tr_tokenizer(text) + doc = Doc( + tokens.vocab, words=[t.text for t in tokens], pos=pos, heads=heads, deps=deps + ) + chunks = list(doc.noun_chunks) + assert len(chunks) == 1 + assert chunks[0].text_with_ws == "Gazi Mustafa Kemal " + + +def test_tr_noun_chunks_flat_names_and_title2(tr_tokenizer): + text = "Ahmet Vefik Paşa" + heads = [2, 0, 2] + deps = ["nmod", "flat", "ROOT"] + pos = ["PROPN", "PROPN", "PROPN"] + tokens = tr_tokenizer(text) + doc = Doc( + tokens.vocab, words=[t.text for t in tokens], pos=pos, heads=heads, deps=deps + ) + chunks = list(doc.noun_chunks) + assert len(chunks) == 1 + assert chunks[0].text_with_ws == "Ahmet Vefik Paşa " + + +def test_tr_noun_chunks_flat_name_lastname_and_title(tr_tokenizer): + text = "Cumhurbaşkanı Ahmet Necdet Sezer" + heads = [1, 1, 1, 1] + deps = ["nmod", "ROOT", "flat", "flat"] + pos = ["NOUN", "PROPN", "PROPN", "PROPN"] + tokens = tr_tokenizer(text) + doc = Doc( + tokens.vocab, words=[t.text for t in tokens], pos=pos, heads=heads, deps=deps + ) + chunks = list(doc.noun_chunks) + assert len(chunks) == 1 + assert chunks[0].text_with_ws == "Cumhurbaşkanı Ahmet Necdet Sezer " + + +def test_tr_noun_chunks_flat_in_nmod(tr_tokenizer): + text = "Ahmet Sezer adında bir ögrenci" + heads = [2, 0, 4, 4, 4] + deps = ["nmod", "flat", "nmod", "det", "ROOT"] + pos = ["PROPN", "PROPN", "NOUN", "DET", "NOUN"] + tokens = tr_tokenizer(text) + doc = Doc( + tokens.vocab, words=[t.text for t in tokens], pos=pos, heads=heads, deps=deps + ) + chunks = list(doc.noun_chunks) + assert len(chunks) == 1 + assert chunks[0].text_with_ws == "Ahmet Sezer adında bir ögrenci " + + +def test_tr_noun_chunks_flat_and_chain_nmod(tr_tokenizer): + text = "Batı Afrika ülkelerinden Sierra Leone" + heads = [1, 2, 3, 3, 3] + deps = ["nmod", "nmod", "nmod", "ROOT", "flat"] + pos = ["NOUN", "PROPN", "NOUN", "PROPN", "PROPN"] + tokens = tr_tokenizer(text) + doc = Doc( + tokens.vocab, words=[t.text for t in tokens], pos=pos, heads=heads, deps=deps + ) + chunks = list(doc.noun_chunks) + assert len(chunks) == 1 + assert chunks[0].text_with_ws == "Batı Afrika ülkelerinden Sierra Leone " + + +def test_tr_noun_chunks_two_flats_conjed(tr_tokenizer): + text = "New York ve Sierra Leone" + heads = [0, 0, 3, 0, 3] + deps = ["ROOT", "flat", "cc", "conj", "flat"] + pos = ["PROPN", "PROPN", "CCONJ", "PROPN", "PROPN"] + tokens = tr_tokenizer(text) + doc = Doc( + tokens.vocab, words=[t.text for t in tokens], pos=pos, heads=heads, deps=deps + ) + chunks = list(doc.noun_chunks) + assert len(chunks) == 2 + assert chunks[0].text_with_ws == "Sierra Leone " + assert chunks[1].text_with_ws == "New York " diff --git a/TTS/Kokoro/.venv/Lib/site-packages/spacy/tests/lang/tr/test_text.py b/TTS/Kokoro/.venv/Lib/site-packages/spacy/tests/lang/tr/test_text.py new file mode 100644 index 0000000000000000000000000000000000000000..6238e0f1827fd293a136f53aa9ab1fb5c7606e19 --- /dev/null +++ b/TTS/Kokoro/.venv/Lib/site-packages/spacy/tests/lang/tr/test_text.py @@ -0,0 +1,48 @@ +import pytest + +from spacy.lang.tr.lex_attrs import like_num + + +def test_tr_tokenizer_handles_long_text(tr_tokenizer): + text = """Pamuk nasıl ipliğe dönüştürülür? + +Sıkıştırılmış balyalar halindeki pamuk, iplik fabrikasına getirildiğinde hem +lifleri birbirine dolaşmıştır, hem de tarladan toplanırken araya bitkinin +parçaları karışmıştır. Üstelik balyalardaki pamuğun cinsi aynı olsa bile kalitesi +değişeceğinden, önce bütün balyaların birbirine karıştırılarak harmanlanması gerekir. + +Daha sonra pamuk yığınları, liflerin açılıp temizlenmesi için tek bir birim halinde +birleştirilmiş çeşitli makinelerden geçirilir.Bunlardan biri, dönen tokmaklarıyla +pamuğu dövüp kabartarak dağınık yumaklar haline getiren ve liflerin arasındaki yabancı +maddeleri temizleyen hallaç makinesidir. Daha sonra tarak makinesine giren pamuk demetleri, +herbirinin yüzeyinde yüzbinlerce incecik iğne bulunan döner silindirlerin arasından geçerek lif lif ayrılır +ve tül inceliğinde gevşek bir örtüye dönüşür. Ama bir sonraki makine bu lifleri dağınık +ve gevşek bir biçimde birbirine yaklaştırarak 2 cm eninde bir pamuk şeridi haline getirir.""" + tokens = tr_tokenizer(text) + assert len(tokens) == 146 + + +@pytest.mark.parametrize( + "word", + [ + "bir", + "iki", + "dört", + "altı", + "milyon", + "100", + "birinci", + "üçüncü", + "beşinci", + "100üncü", + "8inci", + ], +) +def test_tr_lex_attrs_like_number_cardinal_ordinal(word): + assert like_num(word) + + +@pytest.mark.parametrize("word", ["beş", "yedi", "yedinci", "birinci", "milyonuncu"]) +def test_tr_lex_attrs_capitals(word): + assert like_num(word) + assert like_num(word.upper()) diff --git a/TTS/Kokoro/.venv/Lib/site-packages/spacy/tests/lang/tr/test_tokenizer.py b/TTS/Kokoro/.venv/Lib/site-packages/spacy/tests/lang/tr/test_tokenizer.py new file mode 100644 index 0000000000000000000000000000000000000000..fa907b034992b50f1d22fda342472ca38387fc3b --- /dev/null +++ b/TTS/Kokoro/.venv/Lib/site-packages/spacy/tests/lang/tr/test_tokenizer.py @@ -0,0 +1,696 @@ +import pytest + +ABBREV_TESTS = [ + ("Dr. Murat Bey ile görüştüm.", ["Dr.", "Murat", "Bey", "ile", "görüştüm", "."]), + ("Dr.la görüştüm.", ["Dr.la", "görüştüm", "."]), + ("Dr.'la görüştüm.", ["Dr.'la", "görüştüm", "."]), + ("TBMM'de çalışıyormuş.", ["TBMM'de", "çalışıyormuş", "."]), + ( + "Hem İst. hem Ank. bu konuda gayet iyi durumda.", + ["Hem", "İst.", "hem", "Ank.", "bu", "konuda", "gayet", "iyi", "durumda", "."], + ), + ( + "Hem İst. hem Ank.'da yağış var.", + ["Hem", "İst.", "hem", "Ank.'da", "yağış", "var", "."], + ), + ("Dr.", ["Dr."]), + ("Yrd.Doç.", ["Yrd.Doç."]), + ("Prof.'un", ["Prof.'un"]), + ("Böl.'nde", ["Böl.'nde"]), +] + + +URL_TESTS = [ + ( + "Bizler de www.duygu.com.tr adında bir websitesi kurduk.", + [ + "Bizler", + "de", + "www.duygu.com.tr", + "adında", + "bir", + "websitesi", + "kurduk", + ".", + ], + ), + ( + "Bizler de https://www.duygu.com.tr adında bir websitesi kurduk.", + [ + "Bizler", + "de", + "https://www.duygu.com.tr", + "adında", + "bir", + "websitesi", + "kurduk", + ".", + ], + ), + ( + "Bizler de www.duygu.com.tr'dan satın aldık.", + ["Bizler", "de", "www.duygu.com.tr'dan", "satın", "aldık", "."], + ), + ( + "Bizler de https://www.duygu.com.tr'dan satın aldık.", + ["Bizler", "de", "https://www.duygu.com.tr'dan", "satın", "aldık", "."], + ), +] + + +NUMBER_TESTS = [ + ("Rakamla 6 yazılıydı.", ["Rakamla", "6", "yazılıydı", "."]), + ("Hava -4 dereceydi.", ["Hava", "-4", "dereceydi", "."]), + ( + "Hava sıcaklığı -4ten +6ya yükseldi.", + ["Hava", "sıcaklığı", "-4ten", "+6ya", "yükseldi", "."], + ), + ( + "Hava sıcaklığı -4'ten +6'ya yükseldi.", + ["Hava", "sıcaklığı", "-4'ten", "+6'ya", "yükseldi", "."], + ), + ("Yarışta 6. oldum.", ["Yarışta", "6.", "oldum", "."]), + ("Yarışta 438547745. oldum.", ["Yarışta", "438547745.", "oldum", "."]), + ("Kitap IV. Murat hakkında.", ["Kitap", "IV.", "Murat", "hakkında", "."]), + # ("Bana söylediği sayı 6.", ["Bana", "söylediği", "sayı", "6", "."]), + ("Saat 6'da buluşalım.", ["Saat", "6'da", "buluşalım", "."]), + ("Saat 6dan sonra buluşalım.", ["Saat", "6dan", "sonra", "buluşalım", "."]), + ("6.dan sonra saymadım.", ["6.dan", "sonra", "saymadım", "."]), + ("6.'dan sonra saymadım.", ["6.'dan", "sonra", "saymadım", "."]), + ("Saat 6'ydı.", ["Saat", "6'ydı", "."]), + ("5'te", ["5'te"]), + ("6'da", ["6'da"]), + ("9dan", ["9dan"]), + ("19'da", ["19'da"]), + ("VI'da", ["VI'da"]), + ("5.", ["5."]), + ("72.", ["72."]), + ("VI.", ["VI."]), + ("6.'dan", ["6.'dan"]), + ("19.'dan", ["19.'dan"]), + ("6.dan", ["6.dan"]), + ("16.dan", ["16.dan"]), + ("VI.'dan", ["VI.'dan"]), + ("VI.dan", ["VI.dan"]), + ("Hepsi 1994 yılında oldu.", ["Hepsi", "1994", "yılında", "oldu", "."]), + ("Hepsi 1994'te oldu.", ["Hepsi", "1994'te", "oldu", "."]), + ( + "2/3 tarihli faturayı bulamadım.", + ["2/3", "tarihli", "faturayı", "bulamadım", "."], + ), + ( + "2.3 tarihli faturayı bulamadım.", + ["2.3", "tarihli", "faturayı", "bulamadım", "."], + ), + ( + "2.3. tarihli faturayı bulamadım.", + ["2.3.", "tarihli", "faturayı", "bulamadım", "."], + ), + ( + "2/3/2020 tarihli faturayı bulamadm.", + ["2/3/2020", "tarihli", "faturayı", "bulamadm", "."], + ), + ( + "2/3/1987 tarihinden beri burda yaşıyorum.", + ["2/3/1987", "tarihinden", "beri", "burda", "yaşıyorum", "."], + ), + ( + "2-3-1987 tarihinden beri burdayım.", + ["2-3-1987", "tarihinden", "beri", "burdayım", "."], + ), + ( + "2.3.1987 tarihinden beri burdayım.", + ["2.3.1987", "tarihinden", "beri", "burdayım", "."], + ), + ( + "Bu olay 2005-2006 tarihleri arasında oldu.", + ["Bu", "olay", "2005", "-", "2006", "tarihleri", "arasında", "oldu", "."], + ), + ( + "Bu olay 4/12/2005-21/3/2006 tarihleri arasında oldu.", + [ + "Bu", + "olay", + "4/12/2005", + "-", + "21/3/2006", + "tarihleri", + "arasında", + "oldu", + ".", + ], + ), + ( + "Ek fıkra: 5/11/2003-4999/3 maddesine göre uygundur.", + [ + "Ek", + "fıkra", + ":", + "5/11/2003", + "-", + "4999/3", + "maddesine", + "göre", + "uygundur", + ".", + ], + ), + ( + "2/A alanları: 6831 sayılı Kanunun 2nci maddesinin birinci fıkrasının (A) bendine göre", + [ + "2/A", + "alanları", + ":", + "6831", + "sayılı", + "Kanunun", + "2nci", + "maddesinin", + "birinci", + "fıkrasının", + "(", + "A", + ")", + "bendine", + "göre", + ], + ), + ( + "ŞEHİTTEĞMENKALMAZ Cad. No: 2/311", + ["ŞEHİTTEĞMENKALMAZ", "Cad.", "No", ":", "2/311"], + ), + ( + "2-3-2025", + [ + "2-3-2025", + ], + ), + ("2/3/2025", ["2/3/2025"]), + ("Yıllardır 0.5 uç kullanıyorum.", ["Yıllardır", "0.5", "uç", "kullanıyorum", "."]), + ( + "Kan değerlerim 0.5-0.7 arasıydı.", + ["Kan", "değerlerim", "0.5", "-", "0.7", "arasıydı", "."], + ), + ("0.5", ["0.5"]), + ("1/2", ["1/2"]), + ("%1", ["%", "1"]), + ("%1lik", ["%", "1lik"]), + ("%1'lik", ["%", "1'lik"]), + ("%1lik dilim", ["%", "1lik", "dilim"]), + ("%1'lik dilim", ["%", "1'lik", "dilim"]), + ("%1.5", ["%", "1.5"]), + # ("%1-%2 arası büyüme bekleniyor.", ["%", "1", "-", "%", "2", "arası", "büyüme", "bekleniyor", "."]), + ( + "%1-2 arası büyüme bekliyoruz.", + ["%", "1", "-", "2", "arası", "büyüme", "bekliyoruz", "."], + ), + ( + "%11-12 arası büyüme bekliyoruz.", + ["%", "11", "-", "12", "arası", "büyüme", "bekliyoruz", "."], + ), + ("%1.5luk büyüme bekliyoruz.", ["%", "1.5luk", "büyüme", "bekliyoruz", "."]), + ( + "Saat 1-2 arası gelin lütfen.", + ["Saat", "1", "-", "2", "arası", "gelin", "lütfen", "."], + ), + ("Saat 15:30 gibi buluşalım.", ["Saat", "15:30", "gibi", "buluşalım", "."]), + ("Saat 15:30'da buluşalım.", ["Saat", "15:30'da", "buluşalım", "."]), + ("Saat 15.30'da buluşalım.", ["Saat", "15.30'da", "buluşalım", "."]), + ("Saat 15.30da buluşalım.", ["Saat", "15.30da", "buluşalım", "."]), + ("Saat 15 civarı buluşalım.", ["Saat", "15", "civarı", "buluşalım", "."]), + ("9’daki otobüse binsek mi?", ["9’daki", "otobüse", "binsek", "mi", "?"]), + ("Okulumuz 3-B şubesi", ["Okulumuz", "3-B", "şubesi"]), + ("Okulumuz 3/B şubesi", ["Okulumuz", "3/B", "şubesi"]), + ("Okulumuz 3B şubesi", ["Okulumuz", "3B", "şubesi"]), + ("Okulumuz 3b şubesi", ["Okulumuz", "3b", "şubesi"]), + ( + "Antonio Gaudí 20. yüzyılda, 1904-1914 yılları arasında on yıl süren bir reform süreci getirmiştir.", + [ + "Antonio", + "Gaudí", + "20.", + "yüzyılda", + ",", + "1904", + "-", + "1914", + "yılları", + "arasında", + "on", + "yıl", + "süren", + "bir", + "reform", + "süreci", + "getirmiştir", + ".", + ], + ), + ( + "Dizel yakıtın avro bölgesi ortalaması olan 1,165 avroya kıyasla litre başına 1,335 avroya mal olduğunu gösteriyor.", + [ + "Dizel", + "yakıtın", + "avro", + "bölgesi", + "ortalaması", + "olan", + "1,165", + "avroya", + "kıyasla", + "litre", + "başına", + "1,335", + "avroya", + "mal", + "olduğunu", + "gösteriyor", + ".", + ], + ), + ( + "Marcus Antonius M.Ö. 1 Ocak 49'da, Sezar'dan Vali'nin kendisini barış dostu ilan ettiği bir bildiri yayınlamıştır.", + [ + "Marcus", + "Antonius", + "M.Ö.", + "1", + "Ocak", + "49'da", + ",", + "Sezar'dan", + "Vali'nin", + "kendisini", + "barış", + "dostu", + "ilan", + "ettiği", + "bir", + "bildiri", + "yayınlamıştır", + ".", + ], + ), +] + + +PUNCT_TESTS = [ + ("Gitmedim dedim ya!", ["Gitmedim", "dedim", "ya", "!"]), + ("Gitmedim dedim ya!!", ["Gitmedim", "dedim", "ya", "!", "!"]), + ("Gitsek mi?", ["Gitsek", "mi", "?"]), + ("Gitsek mi??", ["Gitsek", "mi", "?", "?"]), + ("Gitsek mi?!?", ["Gitsek", "mi", "?", "!", "?"]), + ( + "Ankara - Antalya arası otobüs işliyor.", + ["Ankara", "-", "Antalya", "arası", "otobüs", "işliyor", "."], + ), + ( + "Ankara-Antalya arası otobüs işliyor.", + ["Ankara", "-", "Antalya", "arası", "otobüs", "işliyor", "."], + ), + ("Sen--ben, ya da onlar.", ["Sen", "--", "ben", ",", "ya", "da", "onlar", "."]), + ( + "Senden, benden, bizden şarkısını biliyor musun?", + ["Senden", ",", "benden", ",", "bizden", "şarkısını", "biliyor", "musun", "?"], + ), + ( + "Akif'le geldik, sonra da o ayrıldı.", + ["Akif'le", "geldik", ",", "sonra", "da", "o", "ayrıldı", "."], + ), + ("Bu adam ne dedi şimdi???", ["Bu", "adam", "ne", "dedi", "şimdi", "?", "?", "?"]), + ( + "Yok hasta olmuş, yok annesi hastaymış, bahaneler işte...", + [ + "Yok", + "hasta", + "olmuş", + ",", + "yok", + "annesi", + "hastaymış", + ",", + "bahaneler", + "işte", + "...", + ], + ), + ( + "Ankara'dan İstanbul'a ... bir aşk hikayesi.", + ["Ankara'dan", "İstanbul'a", "...", "bir", "aşk", "hikayesi", "."], + ), + ("Ahmet'te", ["Ahmet'te"]), + ("İstanbul'da", ["İstanbul'da"]), +] + +GENERAL_TESTS = [ + ( + "1914'teki Endurance seferinde, Sir Ernest Shackleton'ın kaptanlığını yaptığı İngiliz Endurance gemisi yirmi sekiz kişi ile Antarktika'yı geçmek üzere yelken açtı.", + [ + "1914'teki", + "Endurance", + "seferinde", + ",", + "Sir", + "Ernest", + "Shackleton'ın", + "kaptanlığını", + "yaptığı", + "İngiliz", + "Endurance", + "gemisi", + "yirmi", + "sekiz", + "kişi", + "ile", + "Antarktika'yı", + "geçmek", + "üzere", + "yelken", + "açtı", + ".", + ], + ), + ( + 'Danışılan "%100 Cospedal" olduğunu belirtti.', + ["Danışılan", '"', "%", "100", "Cospedal", '"', "olduğunu", "belirtti", "."], + ), + ( + "1976'da parkur artık kullanılmıyordu; 1990'da ise bir yangın, daha sonraları ahırlarla birlikte yıkılacak olan tahta tribünlerden geri kalanları da yok etmişti.", + [ + "1976'da", + "parkur", + "artık", + "kullanılmıyordu", + ";", + "1990'da", + "ise", + "bir", + "yangın", + ",", + "daha", + "sonraları", + "ahırlarla", + "birlikte", + "yıkılacak", + "olan", + "tahta", + "tribünlerden", + "geri", + "kalanları", + "da", + "yok", + "etmişti", + ".", + ], + ), + ( + "Dahiyane bir ameliyat ve zorlu bir rehabilitasyon sürecinden sonra, tamamen iyileştim.", + [ + "Dahiyane", + "bir", + "ameliyat", + "ve", + "zorlu", + "bir", + "rehabilitasyon", + "sürecinden", + "sonra", + ",", + "tamamen", + "iyileştim", + ".", + ], + ), + ( + "Yaklaşık iki hafta süren bireysel erken oy kullanma döneminin ardından 5,7 milyondan fazla Floridalı sandık başına gitti.", + [ + "Yaklaşık", + "iki", + "hafta", + "süren", + "bireysel", + "erken", + "oy", + "kullanma", + "döneminin", + "ardından", + "5,7", + "milyondan", + "fazla", + "Floridalı", + "sandık", + "başına", + "gitti", + ".", + ], + ), + ( + "Ancak, bu ABD Çevre Koruma Ajansı'nın dünyayı bu konularda uyarmasının ardından ortaya çıktı.", + [ + "Ancak", + ",", + "bu", + "ABD", + "Çevre", + "Koruma", + "Ajansı'nın", + "dünyayı", + "bu", + "konularda", + "uyarmasının", + "ardından", + "ortaya", + "çıktı", + ".", + ], + ), + ( + "Ortalama şansa ve 10.000 Sterlin değerinde tahvillere sahip bir yatırımcı yılda 125 Sterlin ikramiye kazanabilir.", + [ + "Ortalama", + "şansa", + "ve", + "10.000", + "Sterlin", + "değerinde", + "tahvillere", + "sahip", + "bir", + "yatırımcı", + "yılda", + "125", + "Sterlin", + "ikramiye", + "kazanabilir", + ".", + ], + ), + ( + "Granit adaları; Seyşeller ve Tioman ile Saint Helena gibi volkanik adaları kapsar.", + [ + "Granit", + "adaları", + ";", + "Seyşeller", + "ve", + "Tioman", + "ile", + "Saint", + "Helena", + "gibi", + "volkanik", + "adaları", + "kapsar", + ".", + ], + ), + ( + "Barış antlaşmasıyla İspanya, Amerika'ya Porto Riko, Guam ve Filipinler kolonilerini devretti.", + [ + "Barış", + "antlaşmasıyla", + "İspanya", + ",", + "Amerika'ya", + "Porto", + "Riko", + ",", + "Guam", + "ve", + "Filipinler", + "kolonilerini", + "devretti", + ".", + ], + ), + ( + "Makedonya'nın sınır bölgelerini güvence altına alan Philip, büyük bir Makedon ordusu kurdu ve uzun bir fetih seferi için Trakya'ya doğru yürüdü.", + [ + "Makedonya'nın", + "sınır", + "bölgelerini", + "güvence", + "altına", + "alan", + "Philip", + ",", + "büyük", + "bir", + "Makedon", + "ordusu", + "kurdu", + "ve", + "uzun", + "bir", + "fetih", + "seferi", + "için", + "Trakya'ya", + "doğru", + "yürüdü", + ".", + ], + ), + ( + "Fransız gazetesi Le Figaro'ya göre bu hükumet planı sayesinde 42 milyon Euro kazanç sağlanabilir ve elde edilen paranın 15.5 milyonu ulusal güvenlik için kullanılabilir.", + [ + "Fransız", + "gazetesi", + "Le", + "Figaro'ya", + "göre", + "bu", + "hükumet", + "planı", + "sayesinde", + "42", + "milyon", + "Euro", + "kazanç", + "sağlanabilir", + "ve", + "elde", + "edilen", + "paranın", + "15.5", + "milyonu", + "ulusal", + "güvenlik", + "için", + "kullanılabilir", + ".", + ], + ), + ( + "Ortalama şansa ve 10.000 Sterlin değerinde tahvillere sahip bir yatırımcı yılda 125 Sterlin ikramiye kazanabilir.", + [ + "Ortalama", + "şansa", + "ve", + "10.000", + "Sterlin", + "değerinde", + "tahvillere", + "sahip", + "bir", + "yatırımcı", + "yılda", + "125", + "Sterlin", + "ikramiye", + "kazanabilir", + ".", + ], + ), + ( + "3 Kasım Salı günü, Ankara Belediye Başkanı 2014'te hükümetle birlikte oluşturulan kentsel gelişim anlaşmasını askıya alma kararı verdi.", + [ + "3", + "Kasım", + "Salı", + "günü", + ",", + "Ankara", + "Belediye", + "Başkanı", + "2014'te", + "hükümetle", + "birlikte", + "oluşturulan", + "kentsel", + "gelişim", + "anlaşmasını", + "askıya", + "alma", + "kararı", + "verdi", + ".", + ], + ), + ( + "Stalin, Abakumov'u Beria'nın enerji bakanlıkları üzerindeki baskınlığına karşı MGB içinde kendi ağını kurmaya teşvik etmeye başlamıştı.", + [ + "Stalin", + ",", + "Abakumov'u", + "Beria'nın", + "enerji", + "bakanlıkları", + "üzerindeki", + "baskınlığına", + "karşı", + "MGB", + "içinde", + "kendi", + "ağını", + "kurmaya", + "teşvik", + "etmeye", + "başlamıştı", + ".", + ], + ), + ( + "Güney Avrupa'daki kazı alanlarının çoğunluğu gibi, bu bulgu M.Ö. 5. yüzyılın başlar", + [ + "Güney", + "Avrupa'daki", + "kazı", + "alanlarının", + "çoğunluğu", + "gibi", + ",", + "bu", + "bulgu", + "M.Ö.", + "5.", + "yüzyılın", + "başlar", + ], + ), + ( + "Sağlığın bozulması Hitchcock hayatının son yirmi yılında üretimini azalttı.", + [ + "Sağlığın", + "bozulması", + "Hitchcock", + "hayatının", + "son", + "yirmi", + "yılında", + "üretimini", + "azalttı", + ".", + ], + ), +] + + +TESTS = ABBREV_TESTS + URL_TESTS + NUMBER_TESTS + PUNCT_TESTS + GENERAL_TESTS + + +@pytest.mark.parametrize("text,expected_tokens", TESTS) +def test_tr_tokenizer_handles_allcases(tr_tokenizer, text, expected_tokens): + tokens = tr_tokenizer(text) + token_list = [token.text for token in tokens if not token.is_space] + assert expected_tokens == token_list diff --git a/TTS/Kokoro/.venv/Lib/site-packages/spacy/tests/lang/tt/__init__.py b/TTS/Kokoro/.venv/Lib/site-packages/spacy/tests/lang/tt/__init__.py new file mode 100644 index 0000000000000000000000000000000000000000..e69de29bb2d1d6434b8b29ae775ad8c2e48c5391 diff --git a/TTS/Kokoro/.venv/Lib/site-packages/spacy/tests/lang/tt/__pycache__/__init__.cpython-312.pyc b/TTS/Kokoro/.venv/Lib/site-packages/spacy/tests/lang/tt/__pycache__/__init__.cpython-312.pyc new file mode 100644 index 0000000000000000000000000000000000000000..d362d7e494bd2c3cbf0f8321da83bfcbae9bc00b Binary files /dev/null and b/TTS/Kokoro/.venv/Lib/site-packages/spacy/tests/lang/tt/__pycache__/__init__.cpython-312.pyc differ diff --git a/TTS/Kokoro/.venv/Lib/site-packages/spacy/tests/lang/tt/__pycache__/test_tokenizer.cpython-312.pyc b/TTS/Kokoro/.venv/Lib/site-packages/spacy/tests/lang/tt/__pycache__/test_tokenizer.cpython-312.pyc new file mode 100644 index 0000000000000000000000000000000000000000..731d57ad554d2597a668a86cd21e0c5763fc2db6 Binary files /dev/null and b/TTS/Kokoro/.venv/Lib/site-packages/spacy/tests/lang/tt/__pycache__/test_tokenizer.cpython-312.pyc differ diff --git a/TTS/Kokoro/.venv/Lib/site-packages/spacy/tests/lang/tt/test_tokenizer.py b/TTS/Kokoro/.venv/Lib/site-packages/spacy/tests/lang/tt/test_tokenizer.py new file mode 100644 index 0000000000000000000000000000000000000000..55c4fc0d0a0d44bb7916a2db4ce588237ed9746b --- /dev/null +++ b/TTS/Kokoro/.venv/Lib/site-packages/spacy/tests/lang/tt/test_tokenizer.py @@ -0,0 +1,83 @@ +import pytest + +INFIX_HYPHEN_TESTS = [ + ("Явым-төшем күләме.", "Явым-төшем күләме .".split()), + ("Хатын-кыз киеме.", "Хатын-кыз киеме .".split()), +] + +PUNC_INSIDE_WORDS_TESTS = [ + ( + "Пассаҗир саны - 2,13 млн — кеше/көндә (2010), 783,9 млн. кеше/елда.", + "Пассаҗир саны - 2,13 млн — кеше / көндә ( 2010 ) ," + " 783,9 млн. кеше / елда .".split(), + ), + ('Ту"кай', 'Ту " кай'.split()), +] + +MIXED_ORDINAL_NUMS_TESTS = [ + ("Иртәгә 22нче гыйнвар...", "Иртәгә 22нче гыйнвар ...".split()) +] + +ABBREV_TESTS = [ + ("«3 елда (б.э.к.) туган", "« 3 елда ( б.э.к. ) туган".split()), + ("тукымадан һ.б.ш. тегелгән.", "тукымадан һ.б.ш. тегелгән .".split()), +] + +NAME_ABBREV_TESTS = [ + ("Ә.Тукай", "Ә.Тукай".split()), + ("Ә.тукай", "Ә.тукай".split()), + ("ә.Тукай", "ә . Тукай".split()), + ("Миләүшә.", "Миләүшә .".split()), +] + +TYPOS_IN_PUNC_TESTS = [ + ("«3 елда , туган", "« 3 елда , туган".split()), + ("«3 елда,туган", "« 3 елда , туган".split()), + ("«3 елда,туган.", "« 3 елда , туган .".split()), + ("Ул эшли(кайчан?)", "Ул эшли ( кайчан ? )".split()), + ("Ул (кайчан?)эшли", "Ул ( кайчан ?) эшли".split()), # "?)" => "?)" or "? )" +] + +LONG_TEXTS_TESTS = [ + ( + "Иң борынгы кешеләр суыклар һәм салкын кышлар булмый торган җылы " + "якларда яшәгәннәр, шуңа күрә аларга кием кирәк булмаган.Йөз " + "меңнәрчә еллар үткән, борынгы кешеләр акрынлап Европа һәм Азиянең " + "салкын илләрендә дә яши башлаганнар. Алар кырыс һәм салкын " + "кышлардан саклану өчен кием-салым уйлап тапканнар - итәк.", + "Иң борынгы кешеләр суыклар һәм салкын кышлар булмый торган җылы " + "якларда яшәгәннәр , шуңа күрә аларга кием кирәк булмаган . Йөз " + "меңнәрчә еллар үткән , борынгы кешеләр акрынлап Европа һәм Азиянең " + "салкын илләрендә дә яши башлаганнар . Алар кырыс һәм салкын " + "кышлардан саклану өчен кием-салым уйлап тапканнар - итәк .".split(), + ) +] + +TESTCASES = ( + INFIX_HYPHEN_TESTS + + PUNC_INSIDE_WORDS_TESTS + + MIXED_ORDINAL_NUMS_TESTS + + ABBREV_TESTS + + NAME_ABBREV_TESTS + + LONG_TEXTS_TESTS + + TYPOS_IN_PUNC_TESTS +) + +NORM_TESTCASES = [ + ( + "тукымадан һ.б.ш. тегелгән.", + ["тукымадан", "һәм башка шундыйлар", "тегелгән", "."], + ) +] + + +@pytest.mark.parametrize("text,expected_tokens", TESTCASES) +def test_tt_tokenizer_handles_testcases(tt_tokenizer, text, expected_tokens): + tokens = [token.text for token in tt_tokenizer(text) if not token.is_space] + assert expected_tokens == tokens + + +@pytest.mark.parametrize("text,norms", NORM_TESTCASES) +def test_tt_tokenizer_handles_norm_exceptions(tt_tokenizer, text, norms): + tokens = tt_tokenizer(text) + assert [token.norm_ for token in tokens] == norms diff --git a/TTS/Kokoro/.venv/Lib/site-packages/spacy/tests/lang/uk/__init__.py b/TTS/Kokoro/.venv/Lib/site-packages/spacy/tests/lang/uk/__init__.py new file mode 100644 index 0000000000000000000000000000000000000000..e69de29bb2d1d6434b8b29ae775ad8c2e48c5391 diff --git a/TTS/Kokoro/.venv/Lib/site-packages/spacy/tests/lang/uk/__pycache__/__init__.cpython-312.pyc b/TTS/Kokoro/.venv/Lib/site-packages/spacy/tests/lang/uk/__pycache__/__init__.cpython-312.pyc new file mode 100644 index 0000000000000000000000000000000000000000..9260fd411e51d3dc6859ce8ef58c7d34e1d77575 Binary files /dev/null and b/TTS/Kokoro/.venv/Lib/site-packages/spacy/tests/lang/uk/__pycache__/__init__.cpython-312.pyc differ diff --git a/TTS/Kokoro/.venv/Lib/site-packages/spacy/tests/lang/uk/__pycache__/test_lemmatizer.cpython-312.pyc b/TTS/Kokoro/.venv/Lib/site-packages/spacy/tests/lang/uk/__pycache__/test_lemmatizer.cpython-312.pyc new file mode 100644 index 0000000000000000000000000000000000000000..73b26ebced111276b23ad79b34ce49d72930b784 Binary files /dev/null and b/TTS/Kokoro/.venv/Lib/site-packages/spacy/tests/lang/uk/__pycache__/test_lemmatizer.cpython-312.pyc differ diff --git a/TTS/Kokoro/.venv/Lib/site-packages/spacy/tests/lang/uk/__pycache__/test_tokenizer.cpython-312.pyc b/TTS/Kokoro/.venv/Lib/site-packages/spacy/tests/lang/uk/__pycache__/test_tokenizer.cpython-312.pyc new file mode 100644 index 0000000000000000000000000000000000000000..2d111d2ef0c16824c4ca90c9e3f5d62308dd105c Binary files /dev/null and b/TTS/Kokoro/.venv/Lib/site-packages/spacy/tests/lang/uk/__pycache__/test_tokenizer.cpython-312.pyc differ diff --git a/TTS/Kokoro/.venv/Lib/site-packages/spacy/tests/lang/uk/__pycache__/test_tokenizer_exc.cpython-312.pyc b/TTS/Kokoro/.venv/Lib/site-packages/spacy/tests/lang/uk/__pycache__/test_tokenizer_exc.cpython-312.pyc new file mode 100644 index 0000000000000000000000000000000000000000..96991d59c351176cc7d8d110ac01eaefe3a599d5 Binary files /dev/null and b/TTS/Kokoro/.venv/Lib/site-packages/spacy/tests/lang/uk/__pycache__/test_tokenizer_exc.cpython-312.pyc differ diff --git a/TTS/Kokoro/.venv/Lib/site-packages/spacy/tests/lang/uk/test_lemmatizer.py b/TTS/Kokoro/.venv/Lib/site-packages/spacy/tests/lang/uk/test_lemmatizer.py new file mode 100644 index 0000000000000000000000000000000000000000..49e9dda7254e619632be337bfed297d0630663ea --- /dev/null +++ b/TTS/Kokoro/.venv/Lib/site-packages/spacy/tests/lang/uk/test_lemmatizer.py @@ -0,0 +1,27 @@ +import pytest + +from spacy.tokens import Doc + +pytestmark = pytest.mark.filterwarnings("ignore::DeprecationWarning") + + +def test_uk_lemmatizer(uk_lemmatizer): + """Check that the default uk lemmatizer runs.""" + doc = Doc(uk_lemmatizer.vocab, words=["a", "b", "c"]) + assert uk_lemmatizer.mode == "pymorphy3" + uk_lemmatizer(doc) + assert [token.lemma for token in doc] + + +@pytest.mark.parametrize( + "word,lemma", + ( + ("якийсь", "якийсь"), + ("розповідають", "розповідати"), + ("розповіси", "розповісти"), + ), +) +def test_uk_lookup_lemmatizer(uk_lookup_lemmatizer, word, lemma): + assert uk_lookup_lemmatizer.mode == "pymorphy3_lookup" + doc = Doc(uk_lookup_lemmatizer.vocab, words=[word]) + assert uk_lookup_lemmatizer(doc)[0].lemma_ == lemma diff --git a/TTS/Kokoro/.venv/Lib/site-packages/spacy/tests/lang/uk/test_tokenizer.py b/TTS/Kokoro/.venv/Lib/site-packages/spacy/tests/lang/uk/test_tokenizer.py new file mode 100644 index 0000000000000000000000000000000000000000..2151f3a1caa692d3f0bfd5437957828cfd9a4b2b --- /dev/null +++ b/TTS/Kokoro/.venv/Lib/site-packages/spacy/tests/lang/uk/test_tokenizer.py @@ -0,0 +1,148 @@ +import pytest + +PUNCT_OPEN = ["(", "[", "{", "*"] +PUNCT_CLOSE = [")", "]", "}", "*"] +PUNCT_PAIRED = [("(", ")"), ("[", "]"), ("{", "}"), ("*", "*")] + + +@pytest.mark.parametrize("text", ["(", "((", "<"]) +def test_uk_tokenizer_handles_only_punct(uk_tokenizer, text): + tokens = uk_tokenizer(text) + assert len(tokens) == len(text) + + +@pytest.mark.parametrize("punct", PUNCT_OPEN) +@pytest.mark.parametrize( + "text", ["Привет", "Привіт", "Ґелґотати", "З'єднання", "Єдність", "їхні"] +) +def test_uk_tokenizer_splits_open_punct(uk_tokenizer, punct, text): + tokens = uk_tokenizer(punct + text) + assert len(tokens) == 2 + assert tokens[0].text == punct + assert tokens[1].text == text + + +@pytest.mark.parametrize("punct", PUNCT_CLOSE) +@pytest.mark.parametrize( + "text", ["Привет", "Привіт", "Ґелґотати", "З'єднання", "Єдність", "їхні"] +) +def test_uk_tokenizer_splits_close_punct(uk_tokenizer, punct, text): + tokens = uk_tokenizer(text + punct) + assert len(tokens) == 2 + assert tokens[0].text == text + assert tokens[1].text == punct + + +@pytest.mark.parametrize("punct", PUNCT_OPEN) +@pytest.mark.parametrize("punct_add", ["`"]) +@pytest.mark.parametrize( + "text", ["Привет", "Привіт", "Ґелґотати", "З'єднання", "Єдність", "їхні"] +) +def test_uk_tokenizer_splits_two_diff_open_punct(uk_tokenizer, punct, punct_add, text): + tokens = uk_tokenizer(punct + punct_add + text) + assert len(tokens) == 3 + assert tokens[0].text == punct + assert tokens[1].text == punct_add + assert tokens[2].text == text + + +@pytest.mark.parametrize("punct", PUNCT_CLOSE) +@pytest.mark.parametrize("punct_add", ["'"]) +@pytest.mark.parametrize( + "text", ["Привет", "Привіт", "Ґелґотати", "З'єднання", "Єдність", "їхні"] +) +def test_uk_tokenizer_splits_two_diff_close_punct(uk_tokenizer, punct, punct_add, text): + tokens = uk_tokenizer(text + punct + punct_add) + assert len(tokens) == 3 + assert tokens[0].text == text + assert tokens[1].text == punct + assert tokens[2].text == punct_add + + +@pytest.mark.parametrize("punct", PUNCT_OPEN) +@pytest.mark.parametrize( + "text", ["Привет", "Привіт", "Ґелґотати", "З'єднання", "Єдність", "їхні"] +) +def test_uk_tokenizer_splits_same_open_punct(uk_tokenizer, punct, text): + tokens = uk_tokenizer(punct + punct + punct + text) + assert len(tokens) == 4 + assert tokens[0].text == punct + assert tokens[3].text == text + + +@pytest.mark.parametrize("punct", PUNCT_CLOSE) +@pytest.mark.parametrize( + "text", ["Привет", "Привіт", "Ґелґотати", "З'єднання", "Єдність", "їхні"] +) +def test_uk_tokenizer_splits_same_close_punct(uk_tokenizer, punct, text): + tokens = uk_tokenizer(text + punct + punct + punct) + assert len(tokens) == 4 + assert tokens[0].text == text + assert tokens[1].text == punct + + +@pytest.mark.parametrize("text", ["'Тест"]) +def test_uk_tokenizer_splits_open_appostrophe(uk_tokenizer, text): + tokens = uk_tokenizer(text) + assert len(tokens) == 2 + assert tokens[0].text == "'" + + +@pytest.mark.parametrize("text", ["Тест''"]) +def test_uk_tokenizer_splits_double_end_quote(uk_tokenizer, text): + tokens = uk_tokenizer(text) + assert len(tokens) == 2 + tokens_punct = uk_tokenizer("''") + assert len(tokens_punct) == 1 + + +@pytest.mark.parametrize("punct_open,punct_close", PUNCT_PAIRED) +@pytest.mark.parametrize( + "text", ["Привет", "Привіт", "Ґелґотати", "З'єднання", "Єдність", "їхні"] +) +def test_uk_tokenizer_splits_open_close_punct( + uk_tokenizer, punct_open, punct_close, text +): + tokens = uk_tokenizer(punct_open + text + punct_close) + assert len(tokens) == 3 + assert tokens[0].text == punct_open + assert tokens[1].text == text + assert tokens[2].text == punct_close + + +@pytest.mark.parametrize("punct_open,punct_close", PUNCT_PAIRED) +@pytest.mark.parametrize("punct_open2,punct_close2", [("`", "'")]) +@pytest.mark.parametrize( + "text", ["Привет", "Привіт", "Ґелґотати", "З'єднання", "Єдність", "їхні"] +) +def test_uk_tokenizer_two_diff_punct( + uk_tokenizer, punct_open, punct_close, punct_open2, punct_close2, text +): + tokens = uk_tokenizer(punct_open2 + punct_open + text + punct_close + punct_close2) + assert len(tokens) == 5 + assert tokens[0].text == punct_open2 + assert tokens[1].text == punct_open + assert tokens[2].text == text + assert tokens[3].text == punct_close + assert tokens[4].text == punct_close2 + + +@pytest.mark.parametrize( + "text", ["Привет.", "Привіт.", "Ґелґотати.", "З'єднання.", "Єдність.", "їхні."] +) +def test_uk_tokenizer_splits_trailing_dot(uk_tokenizer, text): + tokens = uk_tokenizer(text) + assert tokens[1].text == "." + + +def test_uk_tokenizer_splits_bracket_period(uk_tokenizer): + text = "(Раз, два, три, проверка)." + tokens = uk_tokenizer(text) + assert tokens[len(tokens) - 1].text == "." + + +def test_uk_tokenizer_handles_final_diacritics(uk_tokenizer): + text = "Хлібі́в не було́. Хлібі́в не було́." + tokens = uk_tokenizer(text) + assert tokens[2].text == "було́" + assert tokens[3].text == "." diff --git a/TTS/Kokoro/.venv/Lib/site-packages/spacy/tests/lang/uk/test_tokenizer_exc.py b/TTS/Kokoro/.venv/Lib/site-packages/spacy/tests/lang/uk/test_tokenizer_exc.py new file mode 100644 index 0000000000000000000000000000000000000000..2e87071d5327c2b60fd31b4fe05e5b7272f0f570 --- /dev/null +++ b/TTS/Kokoro/.venv/Lib/site-packages/spacy/tests/lang/uk/test_tokenizer_exc.py @@ -0,0 +1,11 @@ +import pytest + + +@pytest.mark.parametrize( + "text,norms,lemmas", + [("ім.", ["імені"], ["ім'я"]), ("проф.", ["професор"], ["професор"])], +) +def test_uk_tokenizer_abbrev_exceptions(uk_tokenizer, text, norms, lemmas): + tokens = uk_tokenizer(text) + assert len(tokens) == 1 + assert [token.norm_ for token in tokens] == norms diff --git a/TTS/Kokoro/.venv/Lib/site-packages/spacy/tests/lang/ur/__init__.py b/TTS/Kokoro/.venv/Lib/site-packages/spacy/tests/lang/ur/__init__.py new file mode 100644 index 0000000000000000000000000000000000000000..e69de29bb2d1d6434b8b29ae775ad8c2e48c5391 diff --git a/TTS/Kokoro/.venv/Lib/site-packages/spacy/tests/lang/ur/__pycache__/__init__.cpython-312.pyc b/TTS/Kokoro/.venv/Lib/site-packages/spacy/tests/lang/ur/__pycache__/__init__.cpython-312.pyc new file mode 100644 index 0000000000000000000000000000000000000000..e7b3cfe8cc4fcc8d6ee07b5dca20f7fb9d85cdbf Binary files /dev/null and b/TTS/Kokoro/.venv/Lib/site-packages/spacy/tests/lang/ur/__pycache__/__init__.cpython-312.pyc differ diff --git a/TTS/Kokoro/.venv/Lib/site-packages/spacy/tests/lang/ur/__pycache__/test_prefix_suffix_infix.cpython-312.pyc b/TTS/Kokoro/.venv/Lib/site-packages/spacy/tests/lang/ur/__pycache__/test_prefix_suffix_infix.cpython-312.pyc new file mode 100644 index 0000000000000000000000000000000000000000..adc7cebc03beb583bea2a26ed63d643c50f1f84b Binary files /dev/null and b/TTS/Kokoro/.venv/Lib/site-packages/spacy/tests/lang/ur/__pycache__/test_prefix_suffix_infix.cpython-312.pyc differ diff --git a/TTS/Kokoro/.venv/Lib/site-packages/spacy/tests/lang/ur/__pycache__/test_text.cpython-312.pyc b/TTS/Kokoro/.venv/Lib/site-packages/spacy/tests/lang/ur/__pycache__/test_text.cpython-312.pyc new file mode 100644 index 0000000000000000000000000000000000000000..17156983eb9b55ea77b6942e005c1f863181e821 Binary files /dev/null and b/TTS/Kokoro/.venv/Lib/site-packages/spacy/tests/lang/ur/__pycache__/test_text.cpython-312.pyc differ diff --git a/TTS/Kokoro/.venv/Lib/site-packages/spacy/tests/lang/ur/test_prefix_suffix_infix.py b/TTS/Kokoro/.venv/Lib/site-packages/spacy/tests/lang/ur/test_prefix_suffix_infix.py new file mode 100644 index 0000000000000000000000000000000000000000..4c94bac5e9258113c77a5f1ecdfe9d55907db4d3 --- /dev/null +++ b/TTS/Kokoro/.venv/Lib/site-packages/spacy/tests/lang/ur/test_prefix_suffix_infix.py @@ -0,0 +1,8 @@ +import pytest + + +@pytest.mark.parametrize("text", ["ہےں۔", "کیا۔"]) +def test_contractions(ur_tokenizer, text): + """Test specific Urdu punctuation character""" + tokens = ur_tokenizer(text) + assert len(tokens) == 2 diff --git a/TTS/Kokoro/.venv/Lib/site-packages/spacy/tests/lang/ur/test_text.py b/TTS/Kokoro/.venv/Lib/site-packages/spacy/tests/lang/ur/test_text.py new file mode 100644 index 0000000000000000000000000000000000000000..f681ceb7e75f37ac37f9dae676757c3346db2233 --- /dev/null +++ b/TTS/Kokoro/.venv/Lib/site-packages/spacy/tests/lang/ur/test_text.py @@ -0,0 +1,13 @@ +import pytest + + +def test_ur_tokenizer_handles_long_text(ur_tokenizer): + text = """اصل میں، رسوا ہونے کی ہمیں کچھ عادت سی ہو گئی ہے۔""" + tokens = ur_tokenizer(text) + assert len(tokens) == 14 + + +@pytest.mark.parametrize("text,length", [("تحریر باسط حبیب", 3), ("میرا پاکستان", 2)]) +def test_ur_tokenizer_handles_cnts(ur_tokenizer, text, length): + tokens = ur_tokenizer(text) + assert len(tokens) == length diff --git a/TTS/Kokoro/.venv/Lib/site-packages/spacy/tests/lang/vi/__init__.py b/TTS/Kokoro/.venv/Lib/site-packages/spacy/tests/lang/vi/__init__.py new file mode 100644 index 0000000000000000000000000000000000000000..e69de29bb2d1d6434b8b29ae775ad8c2e48c5391 diff --git a/TTS/Kokoro/.venv/Lib/site-packages/spacy/tests/lang/vi/__pycache__/__init__.cpython-312.pyc b/TTS/Kokoro/.venv/Lib/site-packages/spacy/tests/lang/vi/__pycache__/__init__.cpython-312.pyc new file mode 100644 index 0000000000000000000000000000000000000000..611bbeb53a2b390e97b36d4b8224068926590e7e Binary files /dev/null and b/TTS/Kokoro/.venv/Lib/site-packages/spacy/tests/lang/vi/__pycache__/__init__.cpython-312.pyc differ diff --git a/TTS/Kokoro/.venv/Lib/site-packages/spacy/tests/lang/vi/__pycache__/test_serialize.cpython-312.pyc b/TTS/Kokoro/.venv/Lib/site-packages/spacy/tests/lang/vi/__pycache__/test_serialize.cpython-312.pyc new file mode 100644 index 0000000000000000000000000000000000000000..3afc2756b39ad35e94cbfceddd1acd801549eac9 Binary files /dev/null and b/TTS/Kokoro/.venv/Lib/site-packages/spacy/tests/lang/vi/__pycache__/test_serialize.cpython-312.pyc differ diff --git a/TTS/Kokoro/.venv/Lib/site-packages/spacy/tests/lang/vi/__pycache__/test_tokenizer.cpython-312.pyc b/TTS/Kokoro/.venv/Lib/site-packages/spacy/tests/lang/vi/__pycache__/test_tokenizer.cpython-312.pyc new file mode 100644 index 0000000000000000000000000000000000000000..391fe70a0c4fc7cf30bc5d193bb9ff97f1696e64 Binary files /dev/null and b/TTS/Kokoro/.venv/Lib/site-packages/spacy/tests/lang/vi/__pycache__/test_tokenizer.cpython-312.pyc differ diff --git a/TTS/Kokoro/.venv/Lib/site-packages/spacy/tests/lang/vi/test_serialize.py b/TTS/Kokoro/.venv/Lib/site-packages/spacy/tests/lang/vi/test_serialize.py new file mode 100644 index 0000000000000000000000000000000000000000..8b00f862de06dde5707c160c43ff35cb3b223e46 --- /dev/null +++ b/TTS/Kokoro/.venv/Lib/site-packages/spacy/tests/lang/vi/test_serialize.py @@ -0,0 +1,42 @@ +import pickle + +from spacy.lang.vi import Vietnamese + +from ...util import make_tempdir + + +def test_vi_tokenizer_serialize(vi_tokenizer): + tokenizer_bytes = vi_tokenizer.to_bytes() + nlp = Vietnamese() + nlp.tokenizer.from_bytes(tokenizer_bytes) + assert tokenizer_bytes == nlp.tokenizer.to_bytes() + assert nlp.tokenizer.use_pyvi is True + + with make_tempdir() as d: + file_path = d / "tokenizer" + vi_tokenizer.to_disk(file_path) + nlp = Vietnamese() + nlp.tokenizer.from_disk(file_path) + assert tokenizer_bytes == nlp.tokenizer.to_bytes() + assert nlp.tokenizer.use_pyvi is True + + # mode is (de)serialized correctly + nlp = Vietnamese.from_config({"nlp": {"tokenizer": {"use_pyvi": False}}}) + nlp_bytes = nlp.to_bytes() + nlp_r = Vietnamese() + nlp_r.from_bytes(nlp_bytes) + assert nlp_bytes == nlp_r.to_bytes() + assert nlp_r.tokenizer.use_pyvi is False + + with make_tempdir() as d: + nlp.to_disk(d) + nlp_r = Vietnamese() + nlp_r.from_disk(d) + assert nlp_bytes == nlp_r.to_bytes() + assert nlp_r.tokenizer.use_pyvi is False + + +def test_vi_tokenizer_pickle(vi_tokenizer): + b = pickle.dumps(vi_tokenizer) + vi_tokenizer_re = pickle.loads(b) + assert vi_tokenizer.to_bytes() == vi_tokenizer_re.to_bytes() diff --git a/TTS/Kokoro/.venv/Lib/site-packages/spacy/tests/lang/vi/test_tokenizer.py b/TTS/Kokoro/.venv/Lib/site-packages/spacy/tests/lang/vi/test_tokenizer.py new file mode 100644 index 0000000000000000000000000000000000000000..e556ffbe2b92f207c723bf2aec1ef5fd37415395 --- /dev/null +++ b/TTS/Kokoro/.venv/Lib/site-packages/spacy/tests/lang/vi/test_tokenizer.py @@ -0,0 +1,47 @@ +import pytest + +from spacy.lang.vi import Vietnamese + +from ...tokenizer.test_naughty_strings import NAUGHTY_STRINGS + +# fmt: off +TOKENIZER_TESTS = [ + ("Đây là một văn bản bằng tiếng Việt Sau đó, đây là một văn bản khác bằng ngôn ngữ này", ['Đây', 'là', 'một', 'văn bản', 'bằng', 'tiếng', 'Việt', 'Sau', 'đó', ',', 'đây', 'là', 'một', 'văn bản', 'khác', 'bằng', 'ngôn ngữ', 'này']), +] +# fmt: on + + +@pytest.mark.parametrize("text,expected_tokens", TOKENIZER_TESTS) +def test_vi_tokenizer(vi_tokenizer, text, expected_tokens): + tokens = [token.text for token in vi_tokenizer(text)] + assert tokens == expected_tokens + + +def test_vi_tokenizer_extra_spaces(vi_tokenizer): + # note: three spaces after "I" + tokens = vi_tokenizer("I like cheese.") + assert tokens[1].orth_ == " " + + +@pytest.mark.parametrize("text", NAUGHTY_STRINGS) +def test_vi_tokenizer_naughty_strings(vi_tokenizer, text): + tokens = vi_tokenizer(text) + assert tokens.text_with_ws == text + + +def test_vi_tokenizer_emptyish_texts(vi_tokenizer): + doc = vi_tokenizer("") + assert len(doc) == 0 + doc = vi_tokenizer(" ") + assert len(doc) == 1 + doc = vi_tokenizer("\n\n\n \t\t \n\n\n") + assert len(doc) == 1 + + +def test_vi_tokenizer_no_pyvi(): + """Test for whitespace tokenization without pyvi""" + nlp = Vietnamese.from_config({"nlp": {"tokenizer": {"use_pyvi": False}}}) + text = "Đây là một văn bản bằng tiếng Việt Sau đó, đây là một văn bản khác bằng ngôn ngữ này" + doc = nlp(text) + assert [t.text for t in doc if not t.is_space] == text.split() + assert doc[4].text == " " diff --git a/TTS/Kokoro/.venv/Lib/site-packages/spacy/tests/lang/xx/__init__.py b/TTS/Kokoro/.venv/Lib/site-packages/spacy/tests/lang/xx/__init__.py new file mode 100644 index 0000000000000000000000000000000000000000..e69de29bb2d1d6434b8b29ae775ad8c2e48c5391 diff --git a/TTS/Kokoro/.venv/Lib/site-packages/spacy/tests/lang/xx/__pycache__/__init__.cpython-312.pyc b/TTS/Kokoro/.venv/Lib/site-packages/spacy/tests/lang/xx/__pycache__/__init__.cpython-312.pyc new file mode 100644 index 0000000000000000000000000000000000000000..c9e6da22e20aa175bc34f3d1ee6164cabad4fe6b Binary files /dev/null and b/TTS/Kokoro/.venv/Lib/site-packages/spacy/tests/lang/xx/__pycache__/__init__.cpython-312.pyc differ diff --git a/TTS/Kokoro/.venv/Lib/site-packages/spacy/tests/lang/xx/__pycache__/test_text.cpython-312.pyc b/TTS/Kokoro/.venv/Lib/site-packages/spacy/tests/lang/xx/__pycache__/test_text.cpython-312.pyc new file mode 100644 index 0000000000000000000000000000000000000000..82797e7cefef1ce2cb592610fd5637f0ec705ba8 Binary files /dev/null and b/TTS/Kokoro/.venv/Lib/site-packages/spacy/tests/lang/xx/__pycache__/test_text.cpython-312.pyc differ diff --git a/TTS/Kokoro/.venv/Lib/site-packages/spacy/tests/lang/xx/__pycache__/test_tokenizer.cpython-312.pyc b/TTS/Kokoro/.venv/Lib/site-packages/spacy/tests/lang/xx/__pycache__/test_tokenizer.cpython-312.pyc new file mode 100644 index 0000000000000000000000000000000000000000..6353165933924093bf488ba40a477950dd6d0a28 Binary files /dev/null and b/TTS/Kokoro/.venv/Lib/site-packages/spacy/tests/lang/xx/__pycache__/test_tokenizer.cpython-312.pyc differ diff --git a/TTS/Kokoro/.venv/Lib/site-packages/spacy/tests/lang/xx/test_text.py b/TTS/Kokoro/.venv/Lib/site-packages/spacy/tests/lang/xx/test_text.py new file mode 100644 index 0000000000000000000000000000000000000000..42dea65bb473bf22e824d1e5f18d2f6181adc6ce --- /dev/null +++ b/TTS/Kokoro/.venv/Lib/site-packages/spacy/tests/lang/xx/test_text.py @@ -0,0 +1,24 @@ +import pytest + + +def test_long_text(xx_tokenizer): + # Excerpt: Text in Skolt Sami taken from https://www.samediggi.fi + text = """ +Säʹmmla lie Euroopp unioon oʹdinakai alggmeer. Säʹmmlai alggmeerstatus lij raʹvvjum Lääʹddjânnam vuâđđlääʹjjest. +Alggmeer kriteeʹr vuâđđâʹvve meeraikõskksaž tuâjjorganisaatio, ILO, suåppmõʹšše nââmar 169. +Suåppmõõžž mieʹldd jiõččvälddsaž jânnmin jälsteei meeraid ââʹnet alggmeeran, +ko sij puõlvvâʹvve naroodâst, kååʹtt jânnam välddmõõžž leʹbe aazztummuž leʹbe ânnʼjõž riikkraaʹji šõddâm ääiʹj jälste +jânnmest leʹbe tõn mäddtiõđlaž vuuʹdest, koozz jânnam kooll. Alggmeer ij leäkku mieʹrreei sââʹjest jiiʹjjes jälstemvuuʹdest. +Alggmeer âlgg jiõčč ââʹnned jiiʹjjes alggmeeran leʹbe leeʹd tõn miõlâst, što sij lie alggmeer. +Alggmeer lij õlggâm seeilted vuõiggâdvuõđlaž sââʹjest huõlǩâni obbnes leʹbe vueʹzzi jiiʹjjes sosiaalʼlaž, täälʼlaž, +kulttuurlaž da poliittlaž instituutioid. + +Säʹmmlai statuuzz ǩeeʹrjteš Lääʹddjânnam vuâđđläkka eeʹjj 1995. Säʹmmlain alggmeeran lij vuõiggâdvuõtt tuõʹllʼjed da +ooudâsviikkâd ǩiõlâz da kulttuurâz di tõõzz kuulli ääʹrbvuâlaž jieʹllemvueʹjjeez. Sääʹmǩiõl ââʹnnmest veʹrǧǧniiʹǩǩi +åʹrnn lij šiõttuum jiiʹjjes lääʹǩǩ. Säʹmmlain lij leämmaž eeʹjjest 1996 vueʹljeeʹl dommvuuʹdsteez ǩiõlâz da kulttuurâz kuõskki +vuâđđlääʹjj meâldlaž jiõččvaaldâšm. Säʹmmlai jiõččvaldšma kuulli tuâjaid håidd säʹmmlai vaalin vaʹlljääm parlameʹntt, +Sääʹmteʹǧǧ. +""" + + tokens = xx_tokenizer(text) + assert len(tokens) == 179 diff --git a/TTS/Kokoro/.venv/Lib/site-packages/spacy/tests/lang/xx/test_tokenizer.py b/TTS/Kokoro/.venv/Lib/site-packages/spacy/tests/lang/xx/test_tokenizer.py new file mode 100644 index 0000000000000000000000000000000000000000..8659ba8aaa08d1e65299791228856327781b0c6c --- /dev/null +++ b/TTS/Kokoro/.venv/Lib/site-packages/spacy/tests/lang/xx/test_tokenizer.py @@ -0,0 +1,25 @@ +import pytest + +XX_BASIC_TOKENIZATION_TESTS = [ + ( + "Lääʹddjânnmest lie nuʹtt 10 000 säʹmmliʹžžed. Seeʹst pâʹjjel", + [ + "Lääʹddjânnmest", + "lie", + "nuʹtt", + "10", + "000", + "säʹmmliʹžžed", + ".", + "Seeʹst", + "pâʹjjel", + ], + ), +] + + +@pytest.mark.parametrize("text,expected_tokens", XX_BASIC_TOKENIZATION_TESTS) +def test_xx_tokenizer_basic(xx_tokenizer, text, expected_tokens): + tokens = xx_tokenizer(text) + token_list = [token.text for token in tokens if not token.is_space] + assert expected_tokens == token_list diff --git a/TTS/Kokoro/.venv/Lib/site-packages/spacy/tests/lang/yo/__init__.py b/TTS/Kokoro/.venv/Lib/site-packages/spacy/tests/lang/yo/__init__.py new file mode 100644 index 0000000000000000000000000000000000000000..e69de29bb2d1d6434b8b29ae775ad8c2e48c5391 diff --git a/TTS/Kokoro/.venv/Lib/site-packages/spacy/tests/lang/yo/__pycache__/__init__.cpython-312.pyc b/TTS/Kokoro/.venv/Lib/site-packages/spacy/tests/lang/yo/__pycache__/__init__.cpython-312.pyc new file mode 100644 index 0000000000000000000000000000000000000000..4893d3424fe3e689682fc6eadf2fa597fed6c867 Binary files /dev/null and b/TTS/Kokoro/.venv/Lib/site-packages/spacy/tests/lang/yo/__pycache__/__init__.cpython-312.pyc differ diff --git a/TTS/Kokoro/.venv/Lib/site-packages/spacy/tests/lang/yo/__pycache__/test_text.cpython-312.pyc b/TTS/Kokoro/.venv/Lib/site-packages/spacy/tests/lang/yo/__pycache__/test_text.cpython-312.pyc new file mode 100644 index 0000000000000000000000000000000000000000..38365537a035831278c39db598ca16d575c7b761 Binary files /dev/null and b/TTS/Kokoro/.venv/Lib/site-packages/spacy/tests/lang/yo/__pycache__/test_text.cpython-312.pyc differ diff --git a/TTS/Kokoro/.venv/Lib/site-packages/spacy/tests/lang/yo/test_text.py b/TTS/Kokoro/.venv/Lib/site-packages/spacy/tests/lang/yo/test_text.py new file mode 100644 index 0000000000000000000000000000000000000000..f14fad844a38e9a8b8a89dcc657a27e0eed5639a --- /dev/null +++ b/TTS/Kokoro/.venv/Lib/site-packages/spacy/tests/lang/yo/test_text.py @@ -0,0 +1,30 @@ +import pytest + +from spacy.lang.yo.lex_attrs import like_num + + +def test_yo_tokenizer_handles_long_text(yo_tokenizer): + text = """Àwọn ọmọ ìlú tí wọ́n ń ṣàmúlò ayélujára ti bẹ̀rẹ̀ ìkọkúkọ sórí àwòrán ààrẹ Nkurunziza nínú ìfẹ̀hónúhàn pẹ̀lú àmì ìdámọ̀: Nkurunziza àti Burundi: + Ọmọ ilé ẹ̀kọ́ gíga ní ẹ̀wọ̀n fún kíkọ ìkọkúkọ sí orí àwòrán Ààrẹ . + Bí mo bá ṣe èyí ní Burundi , ó ṣe é ṣe kí a fi mí sí àtìmọ́lé + Ìjọba Burundi fi akẹ́kọ̀ọ́bìnrin sí àtìmọ́lé látàrí ẹ̀sùn ìkọkúkọ sí orí àwòrán ààrẹ. A túwíìtì àwòrán ìkọkúkọ wa ní ìbánikẹ́dùn ìṣẹ̀lẹ̀ náà. + Wọ́n ní kí a dán an wò, kí a kọ nǹkan sí orí àwòrán ààrẹ mo sì ṣe bẹ́ẹ̀. Mo ní ìgbóyà wípé ẹnikẹ́ni kò ní mú mi níbí. + Ìfòfinlíle mú àtakò""" + tokens = yo_tokenizer(text) + assert len(tokens) == 121 + + +@pytest.mark.parametrize( + "text,match", + [("ení", True), ("ogun", True), ("mewadinlogun", True), ("ten", False)], +) +def test_lex_attrs_like_number(yo_tokenizer, text, match): + tokens = yo_tokenizer(text) + assert len(tokens) == 1 + assert tokens[0].like_num == match + + +@pytest.mark.parametrize("word", ["eji", "ejila", "ogun", "aárùn"]) +def test_yo_lex_attrs_capitals(word): + assert like_num(word) + assert like_num(word.upper()) diff --git a/TTS/Kokoro/.venv/Lib/site-packages/spacy/tests/lang/zh/__init__.py b/TTS/Kokoro/.venv/Lib/site-packages/spacy/tests/lang/zh/__init__.py new file mode 100644 index 0000000000000000000000000000000000000000..e69de29bb2d1d6434b8b29ae775ad8c2e48c5391 diff --git a/TTS/Kokoro/.venv/Lib/site-packages/spacy/tests/lang/zh/__pycache__/__init__.cpython-312.pyc b/TTS/Kokoro/.venv/Lib/site-packages/spacy/tests/lang/zh/__pycache__/__init__.cpython-312.pyc new file mode 100644 index 0000000000000000000000000000000000000000..d87cd09bc50ff5aa8ec9148678a9d308efb3f7d1 Binary files /dev/null and b/TTS/Kokoro/.venv/Lib/site-packages/spacy/tests/lang/zh/__pycache__/__init__.cpython-312.pyc differ diff --git a/TTS/Kokoro/.venv/Lib/site-packages/spacy/tests/lang/zh/__pycache__/test_serialize.cpython-312.pyc b/TTS/Kokoro/.venv/Lib/site-packages/spacy/tests/lang/zh/__pycache__/test_serialize.cpython-312.pyc new file mode 100644 index 0000000000000000000000000000000000000000..0ecaeb2274ddeb3bb65e923d12445487ed4b0c92 Binary files /dev/null and b/TTS/Kokoro/.venv/Lib/site-packages/spacy/tests/lang/zh/__pycache__/test_serialize.cpython-312.pyc differ diff --git a/TTS/Kokoro/.venv/Lib/site-packages/spacy/tests/lang/zh/__pycache__/test_text.cpython-312.pyc b/TTS/Kokoro/.venv/Lib/site-packages/spacy/tests/lang/zh/__pycache__/test_text.cpython-312.pyc new file mode 100644 index 0000000000000000000000000000000000000000..020b2106009bf80c3a5099109960f4b5d3ff5411 Binary files /dev/null and b/TTS/Kokoro/.venv/Lib/site-packages/spacy/tests/lang/zh/__pycache__/test_text.cpython-312.pyc differ diff --git a/TTS/Kokoro/.venv/Lib/site-packages/spacy/tests/lang/zh/__pycache__/test_tokenizer.cpython-312.pyc b/TTS/Kokoro/.venv/Lib/site-packages/spacy/tests/lang/zh/__pycache__/test_tokenizer.cpython-312.pyc new file mode 100644 index 0000000000000000000000000000000000000000..91cb4c849f547abb38d201d20f935cbdf4a26913 Binary files /dev/null and b/TTS/Kokoro/.venv/Lib/site-packages/spacy/tests/lang/zh/__pycache__/test_tokenizer.cpython-312.pyc differ diff --git a/TTS/Kokoro/.venv/Lib/site-packages/spacy/tests/lang/zh/test_serialize.py b/TTS/Kokoro/.venv/Lib/site-packages/spacy/tests/lang/zh/test_serialize.py new file mode 100644 index 0000000000000000000000000000000000000000..20034448efe31dadcf0f8fb3f9a91037a896a2c2 --- /dev/null +++ b/TTS/Kokoro/.venv/Lib/site-packages/spacy/tests/lang/zh/test_serialize.py @@ -0,0 +1,47 @@ +import pytest + +from spacy.lang.zh import Chinese + +from ...util import make_tempdir + + +def zh_tokenizer_serialize(zh_tokenizer): + tokenizer_bytes = zh_tokenizer.to_bytes() + nlp = Chinese() + nlp.tokenizer.from_bytes(tokenizer_bytes) + assert tokenizer_bytes == nlp.tokenizer.to_bytes() + + with make_tempdir() as d: + file_path = d / "tokenizer" + zh_tokenizer.to_disk(file_path) + nlp = Chinese() + nlp.tokenizer.from_disk(file_path) + assert tokenizer_bytes == nlp.tokenizer.to_bytes() + + +def test_zh_tokenizer_serialize_char(zh_tokenizer_char): + zh_tokenizer_serialize(zh_tokenizer_char) + + +def test_zh_tokenizer_serialize_jieba(zh_tokenizer_jieba): + zh_tokenizer_serialize(zh_tokenizer_jieba) + + +@pytest.mark.slow +def test_zh_tokenizer_serialize_pkuseg_with_processors(zh_tokenizer_pkuseg): + config = { + "nlp": { + "tokenizer": { + "@tokenizers": "spacy.zh.ChineseTokenizer", + "segmenter": "pkuseg", + } + }, + "initialize": { + "tokenizer": { + "pkuseg_model": "medicine", + } + }, + } + nlp = Chinese.from_config(config) + nlp.initialize() + zh_tokenizer_serialize(nlp.tokenizer) diff --git a/TTS/Kokoro/.venv/Lib/site-packages/spacy/tests/lang/zh/test_text.py b/TTS/Kokoro/.venv/Lib/site-packages/spacy/tests/lang/zh/test_text.py new file mode 100644 index 0000000000000000000000000000000000000000..fcd1a6df3d83c672f4cb5ba74e9c53a8e65d4b36 --- /dev/null +++ b/TTS/Kokoro/.venv/Lib/site-packages/spacy/tests/lang/zh/test_text.py @@ -0,0 +1,21 @@ +import pytest + + +@pytest.mark.parametrize( + "text,match", + [ + ("10", True), + ("1", True), + ("999.0", True), + ("一", True), + ("二", True), + ("〇", True), + ("十一", True), + ("狗", False), + (",", False), + ], +) +def test_lex_attrs_like_number(zh_tokenizer_jieba, text, match): + tokens = zh_tokenizer_jieba(text) + assert len(tokens) == 1 + assert tokens[0].like_num == match diff --git a/TTS/Kokoro/.venv/Lib/site-packages/spacy/tests/lang/zh/test_tokenizer.py b/TTS/Kokoro/.venv/Lib/site-packages/spacy/tests/lang/zh/test_tokenizer.py new file mode 100644 index 0000000000000000000000000000000000000000..807e6bddc0315884133a2161b6b5472added363a --- /dev/null +++ b/TTS/Kokoro/.venv/Lib/site-packages/spacy/tests/lang/zh/test_tokenizer.py @@ -0,0 +1,78 @@ +import pytest +from thinc.api import ConfigValidationError + +from spacy.lang.zh import Chinese, _get_pkuseg_trie_data + +# fmt: off +TEXTS = ("作为语言而言,为世界使用人数最多的语言,目前世界有五分之一人口做为母语。",) +JIEBA_TOKENIZER_TESTS = [ + (TEXTS[0], + ['作为', '语言', '而言', ',', '为', '世界', '使用', '人', '数最多', + '的', '语言', ',', '目前', '世界', '有', '五分之一', '人口', '做', + '为', '母语', '。']), +] +PKUSEG_TOKENIZER_TESTS = [ + (TEXTS[0], + ['作为', '语言', '而言', ',', '为', '世界', '使用', '人数', '最多', + '的', '语言', ',', '目前', '世界', '有', '五分之一', '人口', '做为', + '母语', '。']), +] +# fmt: on + + +@pytest.mark.parametrize("text", TEXTS) +def test_zh_tokenizer_char(zh_tokenizer_char, text): + tokens = [token.text for token in zh_tokenizer_char(text)] + assert tokens == list(text) + + +@pytest.mark.parametrize("text,expected_tokens", JIEBA_TOKENIZER_TESTS) +def test_zh_tokenizer_jieba(zh_tokenizer_jieba, text, expected_tokens): + tokens = [token.text for token in zh_tokenizer_jieba(text)] + assert tokens == expected_tokens + + +@pytest.mark.parametrize("text,expected_tokens", PKUSEG_TOKENIZER_TESTS) +def test_zh_tokenizer_pkuseg(zh_tokenizer_pkuseg, text, expected_tokens): + tokens = [token.text for token in zh_tokenizer_pkuseg(text)] + assert tokens == expected_tokens + + +def test_zh_tokenizer_pkuseg_user_dict(zh_tokenizer_pkuseg, zh_tokenizer_char): + user_dict = _get_pkuseg_trie_data(zh_tokenizer_pkuseg.pkuseg_seg.preprocesser.trie) + zh_tokenizer_pkuseg.pkuseg_update_user_dict(["nonsense_asdf"]) + updated_user_dict = _get_pkuseg_trie_data( + zh_tokenizer_pkuseg.pkuseg_seg.preprocesser.trie + ) + assert len(user_dict) == len(updated_user_dict) - 1 + + # reset user dict + zh_tokenizer_pkuseg.pkuseg_update_user_dict([], reset=True) + reset_user_dict = _get_pkuseg_trie_data( + zh_tokenizer_pkuseg.pkuseg_seg.preprocesser.trie + ) + assert len(reset_user_dict) == 0 + + # warn if not relevant + with pytest.warns(UserWarning): + zh_tokenizer_char.pkuseg_update_user_dict(["nonsense_asdf"]) + + +def test_zh_extra_spaces(zh_tokenizer_char): + # note: three spaces after "I" + tokens = zh_tokenizer_char("I like cheese.") + assert tokens[1].orth_ == " " + + +def test_zh_unsupported_segmenter(): + config = {"nlp": {"tokenizer": {"segmenter": "unk"}}} + with pytest.raises(ConfigValidationError): + Chinese.from_config(config) + + +def test_zh_uninitialized_pkuseg(): + config = {"nlp": {"tokenizer": {"segmenter": "char"}}} + nlp = Chinese.from_config(config) + nlp.tokenizer.segmenter = "pkuseg" + with pytest.raises(ValueError): + nlp("test") diff --git a/TTS/Kokoro/.venv/Lib/site-packages/spacy/tests/matcher/__init__.py b/TTS/Kokoro/.venv/Lib/site-packages/spacy/tests/matcher/__init__.py new file mode 100644 index 0000000000000000000000000000000000000000..e69de29bb2d1d6434b8b29ae775ad8c2e48c5391 diff --git a/TTS/Kokoro/.venv/Lib/site-packages/spacy/tests/matcher/__pycache__/__init__.cpython-312.pyc b/TTS/Kokoro/.venv/Lib/site-packages/spacy/tests/matcher/__pycache__/__init__.cpython-312.pyc new file mode 100644 index 0000000000000000000000000000000000000000..f7622365c630ccb39e74720d1412101e05b3d8da Binary files /dev/null and b/TTS/Kokoro/.venv/Lib/site-packages/spacy/tests/matcher/__pycache__/__init__.cpython-312.pyc differ diff --git a/TTS/Kokoro/.venv/Lib/site-packages/spacy/tests/matcher/__pycache__/test_dependency_matcher.cpython-312.pyc b/TTS/Kokoro/.venv/Lib/site-packages/spacy/tests/matcher/__pycache__/test_dependency_matcher.cpython-312.pyc new file mode 100644 index 0000000000000000000000000000000000000000..c5352885e04aa27e8d4b1abf13d3272fe427d43f Binary files /dev/null and b/TTS/Kokoro/.venv/Lib/site-packages/spacy/tests/matcher/__pycache__/test_dependency_matcher.cpython-312.pyc differ diff --git a/TTS/Kokoro/.venv/Lib/site-packages/spacy/tests/matcher/__pycache__/test_levenshtein.cpython-312.pyc b/TTS/Kokoro/.venv/Lib/site-packages/spacy/tests/matcher/__pycache__/test_levenshtein.cpython-312.pyc new file mode 100644 index 0000000000000000000000000000000000000000..5dbbb4aed966426f4dc2d9dbe497a29d0677891f Binary files /dev/null and b/TTS/Kokoro/.venv/Lib/site-packages/spacy/tests/matcher/__pycache__/test_levenshtein.cpython-312.pyc differ diff --git a/TTS/Kokoro/.venv/Lib/site-packages/spacy/tests/matcher/__pycache__/test_matcher_api.cpython-312.pyc b/TTS/Kokoro/.venv/Lib/site-packages/spacy/tests/matcher/__pycache__/test_matcher_api.cpython-312.pyc new file mode 100644 index 0000000000000000000000000000000000000000..2226d0fca1e64f21f9116d7723110af3b4a25639 Binary files /dev/null and b/TTS/Kokoro/.venv/Lib/site-packages/spacy/tests/matcher/__pycache__/test_matcher_api.cpython-312.pyc differ diff --git a/TTS/Kokoro/.venv/Lib/site-packages/spacy/tests/matcher/__pycache__/test_matcher_logic.cpython-312.pyc b/TTS/Kokoro/.venv/Lib/site-packages/spacy/tests/matcher/__pycache__/test_matcher_logic.cpython-312.pyc new file mode 100644 index 0000000000000000000000000000000000000000..33392196f20428675ca83f92064fe58a16daecc7 Binary files /dev/null and b/TTS/Kokoro/.venv/Lib/site-packages/spacy/tests/matcher/__pycache__/test_matcher_logic.cpython-312.pyc differ diff --git a/TTS/Kokoro/.venv/Lib/site-packages/spacy/tests/matcher/__pycache__/test_pattern_validation.cpython-312.pyc b/TTS/Kokoro/.venv/Lib/site-packages/spacy/tests/matcher/__pycache__/test_pattern_validation.cpython-312.pyc new file mode 100644 index 0000000000000000000000000000000000000000..7a3ebec6d2b70ee36a6adcbee03e251ae4034b52 Binary files /dev/null and b/TTS/Kokoro/.venv/Lib/site-packages/spacy/tests/matcher/__pycache__/test_pattern_validation.cpython-312.pyc differ diff --git a/TTS/Kokoro/.venv/Lib/site-packages/spacy/tests/matcher/__pycache__/test_phrase_matcher.cpython-312.pyc b/TTS/Kokoro/.venv/Lib/site-packages/spacy/tests/matcher/__pycache__/test_phrase_matcher.cpython-312.pyc new file mode 100644 index 0000000000000000000000000000000000000000..af70a2d331e24fdad002795b21d4284db1ec9ddd Binary files /dev/null and b/TTS/Kokoro/.venv/Lib/site-packages/spacy/tests/matcher/__pycache__/test_phrase_matcher.cpython-312.pyc differ diff --git a/TTS/Kokoro/.venv/Lib/site-packages/spacy/tests/matcher/test_dependency_matcher.py b/TTS/Kokoro/.venv/Lib/site-packages/spacy/tests/matcher/test_dependency_matcher.py new file mode 100644 index 0000000000000000000000000000000000000000..630434d6f41bc6359ac36e7f646b16e56fa9ecf4 --- /dev/null +++ b/TTS/Kokoro/.venv/Lib/site-packages/spacy/tests/matcher/test_dependency_matcher.py @@ -0,0 +1,493 @@ +import copy +import pickle +import re + +import pytest +from mock import Mock + +from spacy.matcher import DependencyMatcher +from spacy.tokens import Doc, Token + +from ..doc.test_underscore import clean_underscore # noqa: F401 + + +@pytest.fixture +def doc(en_vocab): + words = ["The", "quick", "brown", "fox", "jumped", "over", "the", "lazy", "fox"] + heads = [3, 3, 3, 4, 4, 4, 8, 8, 5] + deps = ["det", "amod", "amod", "nsubj", "ROOT", "prep", "pobj", "det", "amod"] + return Doc(en_vocab, words=words, heads=heads, deps=deps) + + +@pytest.fixture +def patterns(en_vocab): + def is_brown_yellow(text): + return bool(re.compile(r"brown|yellow").match(text)) + + IS_BROWN_YELLOW = en_vocab.add_flag(is_brown_yellow) + + pattern1 = [ + {"RIGHT_ID": "fox", "RIGHT_ATTRS": {"ORTH": "fox"}}, + { + "LEFT_ID": "fox", + "REL_OP": ">", + "RIGHT_ID": "q", + "RIGHT_ATTRS": {"ORTH": "quick", "DEP": "amod"}, + }, + { + "LEFT_ID": "fox", + "REL_OP": ">", + "RIGHT_ID": "r", + "RIGHT_ATTRS": {IS_BROWN_YELLOW: True}, + }, + ] + + pattern2 = [ + {"RIGHT_ID": "jumped", "RIGHT_ATTRS": {"ORTH": "jumped"}}, + { + "LEFT_ID": "jumped", + "REL_OP": ">", + "RIGHT_ID": "fox1", + "RIGHT_ATTRS": {"ORTH": "fox"}, + }, + { + "LEFT_ID": "jumped", + "REL_OP": ".", + "RIGHT_ID": "over", + "RIGHT_ATTRS": {"ORTH": "over"}, + }, + ] + + pattern3 = [ + {"RIGHT_ID": "jumped", "RIGHT_ATTRS": {"ORTH": "jumped"}}, + { + "LEFT_ID": "jumped", + "REL_OP": ">", + "RIGHT_ID": "fox", + "RIGHT_ATTRS": {"ORTH": "fox"}, + }, + { + "LEFT_ID": "fox", + "REL_OP": ">>", + "RIGHT_ID": "r", + "RIGHT_ATTRS": {"ORTH": "brown"}, + }, + ] + + pattern4 = [ + {"RIGHT_ID": "jumped", "RIGHT_ATTRS": {"ORTH": "jumped"}}, + { + "LEFT_ID": "jumped", + "REL_OP": ">", + "RIGHT_ID": "fox", + "RIGHT_ATTRS": {"ORTH": "fox"}, + }, + ] + + pattern5 = [ + {"RIGHT_ID": "jumped", "RIGHT_ATTRS": {"ORTH": "jumped"}}, + { + "LEFT_ID": "jumped", + "REL_OP": ">>", + "RIGHT_ID": "fox", + "RIGHT_ATTRS": {"ORTH": "fox"}, + }, + ] + + return [pattern1, pattern2, pattern3, pattern4, pattern5] + + +@pytest.fixture +def dependency_matcher(en_vocab, patterns, doc): + matcher = DependencyMatcher(en_vocab) + mock = Mock() + for i in range(1, len(patterns) + 1): + if i == 1: + matcher.add("pattern1", [patterns[0]], on_match=mock) + else: + matcher.add("pattern" + str(i), [patterns[i - 1]]) + + return matcher + + +def test_dependency_matcher(dependency_matcher, doc, patterns): + assert len(dependency_matcher) == 5 + assert "pattern3" in dependency_matcher + assert dependency_matcher.get("pattern3") == (None, [patterns[2]]) + matches = dependency_matcher(doc) + assert len(matches) == 6 + assert matches[0][1] == [3, 1, 2] + assert matches[1][1] == [4, 3, 5] + assert matches[2][1] == [4, 3, 2] + assert matches[3][1] == [4, 3] + assert matches[4][1] == [4, 3] + assert matches[5][1] == [4, 8] + + span = doc[0:6] + matches = dependency_matcher(span) + assert len(matches) == 5 + assert matches[0][1] == [3, 1, 2] + assert matches[1][1] == [4, 3, 5] + assert matches[2][1] == [4, 3, 2] + assert matches[3][1] == [4, 3] + assert matches[4][1] == [4, 3] + + +def test_dependency_matcher_pickle(en_vocab, patterns, doc): + matcher = DependencyMatcher(en_vocab) + for i in range(1, len(patterns) + 1): + matcher.add("pattern" + str(i), [patterns[i - 1]]) + + matches = matcher(doc) + assert matches[0][1] == [3, 1, 2] + assert matches[1][1] == [4, 3, 5] + assert matches[2][1] == [4, 3, 2] + assert matches[3][1] == [4, 3] + assert matches[4][1] == [4, 3] + assert matches[5][1] == [4, 8] + + b = pickle.dumps(matcher) + matcher_r = pickle.loads(b) + + assert len(matcher) == len(matcher_r) + matches = matcher_r(doc) + assert matches[0][1] == [3, 1, 2] + assert matches[1][1] == [4, 3, 5] + assert matches[2][1] == [4, 3, 2] + assert matches[3][1] == [4, 3] + assert matches[4][1] == [4, 3] + assert matches[5][1] == [4, 8] + + +def test_dependency_matcher_pattern_validation(en_vocab): + pattern = [ + {"RIGHT_ID": "fox", "RIGHT_ATTRS": {"ORTH": "fox"}}, + { + "LEFT_ID": "fox", + "REL_OP": ">", + "RIGHT_ID": "q", + "RIGHT_ATTRS": {"ORTH": "quick", "DEP": "amod"}, + }, + { + "LEFT_ID": "fox", + "REL_OP": ">", + "RIGHT_ID": "r", + "RIGHT_ATTRS": {"ORTH": "brown"}, + }, + ] + + matcher = DependencyMatcher(en_vocab) + # original pattern is valid + matcher.add("FOUNDED", [pattern]) + # individual pattern not wrapped in a list + with pytest.raises(ValueError): + matcher.add("FOUNDED", pattern) + # no anchor node + with pytest.raises(ValueError): + matcher.add("FOUNDED", [pattern[1:]]) + # required keys missing + with pytest.raises(ValueError): + pattern2 = copy.deepcopy(pattern) + del pattern2[0]["RIGHT_ID"] + matcher.add("FOUNDED", [pattern2]) + with pytest.raises(ValueError): + pattern2 = copy.deepcopy(pattern) + del pattern2[1]["RIGHT_ID"] + matcher.add("FOUNDED", [pattern2]) + with pytest.raises(ValueError): + pattern2 = copy.deepcopy(pattern) + del pattern2[1]["RIGHT_ATTRS"] + matcher.add("FOUNDED", [pattern2]) + with pytest.raises(ValueError): + pattern2 = copy.deepcopy(pattern) + del pattern2[1]["LEFT_ID"] + matcher.add("FOUNDED", [pattern2]) + with pytest.raises(ValueError): + pattern2 = copy.deepcopy(pattern) + del pattern2[1]["REL_OP"] + matcher.add("FOUNDED", [pattern2]) + # invalid operator + with pytest.raises(ValueError): + pattern2 = copy.deepcopy(pattern) + pattern2[1]["REL_OP"] = "!!!" + matcher.add("FOUNDED", [pattern2]) + # duplicate node name + with pytest.raises(ValueError): + pattern2 = copy.deepcopy(pattern) + pattern2[1]["RIGHT_ID"] = "fox" + matcher.add("FOUNDED", [pattern2]) + # invalid key + with pytest.warns(UserWarning): + pattern2 = copy.deepcopy(pattern) + pattern2[1]["FOO"] = "BAR" + matcher.add("FOUNDED", [pattern2]) + + +def test_dependency_matcher_callback(en_vocab, doc): + pattern = [ + {"RIGHT_ID": "quick", "RIGHT_ATTRS": {"ORTH": "quick"}}, + ] + nomatch_pattern = [ + {"RIGHT_ID": "quick", "RIGHT_ATTRS": {"ORTH": "NOMATCH"}}, + ] + + matcher = DependencyMatcher(en_vocab) + mock = Mock() + matcher.add("pattern", [pattern], on_match=mock) + matcher.add("nomatch_pattern", [nomatch_pattern], on_match=mock) + matches = matcher(doc) + assert len(matches) == 1 + mock.assert_called_once_with(matcher, doc, 0, matches) + + # check that matches with and without callback are the same (#4590) + matcher2 = DependencyMatcher(en_vocab) + matcher2.add("pattern", [pattern]) + matches2 = matcher2(doc) + assert matches == matches2 + + +@pytest.mark.parametrize("op,num_matches", [(".", 8), (".*", 20), (";", 8), (";*", 20)]) +def test_dependency_matcher_precedence_ops(en_vocab, op, num_matches): + # two sentences to test that all matches are within the same sentence + doc = Doc( + en_vocab, + words=["a", "b", "c", "d", "e"] * 2, + heads=[0, 0, 0, 0, 0, 5, 5, 5, 5, 5], + deps=["dep"] * 10, + ) + match_count = 0 + for text in ["a", "b", "c", "d", "e"]: + pattern = [ + {"RIGHT_ID": "1", "RIGHT_ATTRS": {"ORTH": text}}, + {"LEFT_ID": "1", "REL_OP": op, "RIGHT_ID": "2", "RIGHT_ATTRS": {}}, + ] + matcher = DependencyMatcher(en_vocab) + matcher.add("A", [pattern]) + matches = matcher(doc) + match_count += len(matches) + for match in matches: + match_id, token_ids = match + # token_ids[0] op token_ids[1] + if op == ".": + assert token_ids[0] == token_ids[1] - 1 + elif op == ";": + assert token_ids[0] == token_ids[1] + 1 + elif op == ".*": + assert token_ids[0] < token_ids[1] + elif op == ";*": + assert token_ids[0] > token_ids[1] + # all tokens are within the same sentence + assert doc[token_ids[0]].sent == doc[token_ids[1]].sent + assert match_count == num_matches + + +@pytest.mark.parametrize( + "left,right,op,num_matches", + [ + ("fox", "jumped", "<", 1), + ("the", "lazy", "<", 0), + ("jumped", "jumped", "<", 0), + ("fox", "jumped", ">", 0), + ("fox", "lazy", ">", 1), + ("lazy", "lazy", ">", 0), + ("fox", "jumped", "<<", 2), + ("jumped", "fox", "<<", 0), + ("the", "fox", "<<", 2), + ("fox", "jumped", ">>", 0), + ("over", "the", ">>", 1), + ("fox", "the", ">>", 2), + ("fox", "jumped", ".", 1), + ("lazy", "fox", ".", 1), + ("the", "fox", ".", 0), + ("the", "the", ".", 0), + ("fox", "jumped", ";", 0), + ("lazy", "fox", ";", 0), + ("the", "fox", ";", 0), + ("the", "the", ";", 0), + ("quick", "fox", ".*", 2), + ("the", "fox", ".*", 3), + ("the", "the", ".*", 1), + ("fox", "jumped", ";*", 1), + ("quick", "fox", ";*", 0), + ("the", "fox", ";*", 1), + ("the", "the", ";*", 1), + ("quick", "brown", "$+", 1), + ("brown", "quick", "$+", 0), + ("brown", "brown", "$+", 0), + ("quick", "brown", "$-", 0), + ("brown", "quick", "$-", 1), + ("brown", "brown", "$-", 0), + ("the", "brown", "$++", 1), + ("brown", "the", "$++", 0), + ("brown", "brown", "$++", 0), + ("the", "brown", "$--", 0), + ("brown", "the", "$--", 1), + ("brown", "brown", "$--", 0), + ("over", "jumped", "<+", 0), + ("quick", "fox", "<+", 0), + ("the", "quick", "<+", 0), + ("brown", "fox", "<+", 1), + ("quick", "fox", "<++", 1), + ("quick", "over", "<++", 0), + ("over", "jumped", "<++", 0), + ("the", "fox", "<++", 2), + ("brown", "fox", "<-", 0), + ("fox", "over", "<-", 0), + ("the", "over", "<-", 0), + ("over", "jumped", "<-", 1), + ("brown", "fox", "<--", 0), + ("fox", "jumped", "<--", 0), + ("fox", "over", "<--", 1), + ("fox", "brown", ">+", 0), + ("over", "fox", ">+", 0), + ("over", "the", ">+", 0), + ("jumped", "over", ">+", 1), + ("jumped", "over", ">++", 1), + ("fox", "lazy", ">++", 0), + ("over", "the", ">++", 0), + ("jumped", "over", ">-", 0), + ("fox", "quick", ">-", 0), + ("brown", "quick", ">-", 0), + ("fox", "brown", ">-", 1), + ("brown", "fox", ">--", 0), + ("fox", "brown", ">--", 1), + ("jumped", "fox", ">--", 1), + ("fox", "the", ">--", 2), + ], +) +def test_dependency_matcher_ops(en_vocab, doc, left, right, op, num_matches): + right_id = right + if left == right: + right_id = right + "2" + pattern = [ + {"RIGHT_ID": left, "RIGHT_ATTRS": {"LOWER": left}}, + { + "LEFT_ID": left, + "REL_OP": op, + "RIGHT_ID": right_id, + "RIGHT_ATTRS": {"LOWER": right}, + }, + ] + + matcher = DependencyMatcher(en_vocab) + matcher.add("pattern", [pattern]) + matches = matcher(doc) + assert len(matches) == num_matches + + +def test_dependency_matcher_long_matches(en_vocab, doc): + pattern = [ + {"RIGHT_ID": "quick", "RIGHT_ATTRS": {"DEP": "amod", "OP": "+"}}, + ] + + matcher = DependencyMatcher(en_vocab) + with pytest.raises(ValueError): + matcher.add("pattern", [pattern]) + + +@pytest.mark.usefixtures("clean_underscore") +def test_dependency_matcher_span_user_data(en_tokenizer): + doc = en_tokenizer("a b c d e") + for token in doc: + token.head = doc[0] + token.dep_ = "a" + Token.set_extension("is_c", default=False) + doc[2]._.is_c = True + pattern = [ + {"RIGHT_ID": "c", "RIGHT_ATTRS": {"_": {"is_c": True}}}, + ] + matcher = DependencyMatcher(en_tokenizer.vocab) + matcher.add("C", [pattern]) + doc_matches = matcher(doc) + offset = 1 + span_matches = matcher(doc[offset:]) + for doc_match, span_match in zip(sorted(doc_matches), sorted(span_matches)): + assert doc_match[0] == span_match[0] + for doc_t_i, span_t_i in zip(doc_match[1], span_match[1]): + assert doc_t_i == span_t_i + offset + + +@pytest.mark.issue(9263) +def test_dependency_matcher_order_issue(en_tokenizer): + # issue from #9263 + doc = en_tokenizer("I like text") + doc[2].head = doc[1] + + # this matches on attrs but not rel op + pattern1 = [ + {"RIGHT_ID": "root", "RIGHT_ATTRS": {"ORTH": "like"}}, + { + "LEFT_ID": "root", + "RIGHT_ID": "r", + "RIGHT_ATTRS": {"ORTH": "text"}, + "REL_OP": "<", + }, + ] + + # this matches on rel op but not attrs + pattern2 = [ + {"RIGHT_ID": "root", "RIGHT_ATTRS": {"ORTH": "like"}}, + { + "LEFT_ID": "root", + "RIGHT_ID": "r", + "RIGHT_ATTRS": {"ORTH": "fish"}, + "REL_OP": ">", + }, + ] + + matcher = DependencyMatcher(en_tokenizer.vocab) + + # This should behave the same as the next pattern + matcher.add("check", [pattern1, pattern2]) + matches = matcher(doc) + + assert matches == [] + + # use a new matcher + matcher = DependencyMatcher(en_tokenizer.vocab) + # adding one at a time under same label gets a match + matcher.add("check", [pattern1]) + matcher.add("check", [pattern2]) + matches = matcher(doc) + + assert matches == [] + + +@pytest.mark.issue(9263) +def test_dependency_matcher_remove(en_tokenizer): + # issue from #9263 + doc = en_tokenizer("The red book") + doc[1].head = doc[2] + + # this matches + pattern1 = [ + {"RIGHT_ID": "root", "RIGHT_ATTRS": {"ORTH": "book"}}, + { + "LEFT_ID": "root", + "RIGHT_ID": "r", + "RIGHT_ATTRS": {"ORTH": "red"}, + "REL_OP": ">", + }, + ] + + # add and then remove it + matcher = DependencyMatcher(en_tokenizer.vocab) + matcher.add("check", [pattern1]) + matcher.remove("check") + + # this matches on rel op but not attrs + pattern2 = [ + {"RIGHT_ID": "root", "RIGHT_ATTRS": {"ORTH": "flag"}}, + { + "LEFT_ID": "root", + "RIGHT_ID": "r", + "RIGHT_ATTRS": {"ORTH": "blue"}, + "REL_OP": ">", + }, + ] + + # Adding this new pattern with the same label, which should not match + matcher.add("check", [pattern2]) + matches = matcher(doc) + + assert matches == [] diff --git a/TTS/Kokoro/.venv/Lib/site-packages/spacy/tests/matcher/test_levenshtein.py b/TTS/Kokoro/.venv/Lib/site-packages/spacy/tests/matcher/test_levenshtein.py new file mode 100644 index 0000000000000000000000000000000000000000..53683c2ef45c7a9377708dd1ca0411f78f19c623 --- /dev/null +++ b/TTS/Kokoro/.venv/Lib/site-packages/spacy/tests/matcher/test_levenshtein.py @@ -0,0 +1,74 @@ +import pytest + +from spacy.matcher import levenshtein +from spacy.matcher.levenshtein import levenshtein_compare + + +# empty string plus 10 random ASCII, 10 random unicode, and 2 random long tests +# from polyleven +@pytest.mark.parametrize( + "dist,a,b", + [ + (0, "", ""), + (4, "bbcb", "caba"), + (3, "abcb", "cacc"), + (3, "aa", "ccc"), + (1, "cca", "ccac"), + (1, "aba", "aa"), + (4, "bcbb", "abac"), + (3, "acbc", "bba"), + (3, "cbba", "a"), + (2, "bcc", "ba"), + (4, "aaa", "ccbb"), + (3, "うあい", "いいうい"), + (2, "あううい", "うあい"), + (3, "いういい", "うううあ"), + (2, "うい", "あいあ"), + (2, "いあい", "いう"), + (1, "いい", "あいい"), + (3, "あうあ", "いいああ"), + (4, "いあうう", "ううああ"), + (3, "いあいい", "ういああ"), + (3, "いいああ", "ううあう"), + ( + 166, + "TCTGGGCACGGATTCGTCAGATTCCATGTCCATATTTGAGGCTCTTGCAGGCAAAATTTGGGCATGTGAACTCCTTATAGTCCCCGTGC", + "ATATGGATTGGGGGCATTCAAAGATACGGTTTCCCTTTCTTCAGTTTCGCGCGGCGCACGTCCGGGTGCGAGCCAGTTCGTCTTACTCACATTGTCGACTTCACGAATCGCGCATGATGTGCTTAGCCTGTACTTACGAACGAACTTTCGGTCCAAATACATTCTATCAACACCGAGGTATCCGTGCCACACGCCGAAGCTCGACCGTGTTCGTTGAGAGGTGGAAATGGTAAAAGATGAACATAGTC", + ), + ( + 111, + "GGTTCGGCCGAATTCATAGAGCGTGGTAGTCGACGGTATCCCGCCTGGTAGGGGCCCCTTCTACCTAGCGGAAGTTTGTCAGTACTCTATAACACGAGGGCCTCTCACACCCTAGATCGTCCAGCCACTCGAAGATCGCAGCACCCTTACAGAAAGGCATTAATGTTTCTCCTAGCACTTGTGCAATGGTGAAGGAGTGATG", + "CGTAACACTTCGCGCTACTGGGCTGCAACGTCTTGGGCATACATGCAAGATTATCTAATGCAAGCTTGAGCCCCGCTTGCGGAATTTCCCTAATCGGGGTCCCTTCCTGTTACGATAAGGACGCGTGCACT", + ), + ], +) +def test_levenshtein(dist, a, b): + assert levenshtein(a, b) == dist + + +@pytest.mark.parametrize( + "a,b,fuzzy,expected", + [ + ("a", "a", 1, True), + ("a", "a", 0, True), + ("a", "a", -1, True), + ("a", "ab", 1, True), + ("a", "ab", 0, False), + ("a", "ab", -1, True), + ("ab", "ac", 1, True), + ("ab", "ac", -1, True), + ("abc", "cde", 4, True), + ("abc", "cde", -1, False), + ("abcdef", "cdefgh", 4, True), + ("abcdef", "cdefgh", 3, False), + ("abcdef", "cdefgh", -1, False), # default (2 for length 6) + ("abcdefgh", "cdefghijk", 5, True), + ("abcdefgh", "cdefghijk", 4, False), + ("abcdefgh", "cdefghijk", -1, False), # default (2) + ("abcdefgh", "cdefghijkl", 6, True), + ("abcdefgh", "cdefghijkl", 5, False), + ("abcdefgh", "cdefghijkl", -1, False), # default (2) + ], +) +def test_levenshtein_compare(a, b, fuzzy, expected): + assert levenshtein_compare(a, b, fuzzy) == expected diff --git a/TTS/Kokoro/.venv/Lib/site-packages/spacy/tests/matcher/test_matcher_api.py b/TTS/Kokoro/.venv/Lib/site-packages/spacy/tests/matcher/test_matcher_api.py new file mode 100644 index 0000000000000000000000000000000000000000..60c15951884362712ac94769a5a2cd39cbe49cd5 --- /dev/null +++ b/TTS/Kokoro/.venv/Lib/site-packages/spacy/tests/matcher/test_matcher_api.py @@ -0,0 +1,909 @@ +import pytest +from mock import Mock + +from spacy.matcher import Matcher +from spacy.tokens import Doc, Span, Token + +from ..doc.test_underscore import clean_underscore # noqa: F401 + + +@pytest.fixture +def matcher(en_vocab): + rules = { + "JS": [[{"ORTH": "JavaScript"}]], + "GoogleNow": [[{"ORTH": "Google"}, {"ORTH": "Now"}]], + "Java": [[{"LOWER": "java"}]], + } + matcher = Matcher(en_vocab) + for key, patterns in rules.items(): + matcher.add(key, patterns) + return matcher + + +def test_matcher_from_api_docs(en_vocab): + matcher = Matcher(en_vocab) + pattern = [{"ORTH": "test"}] + assert len(matcher) == 0 + matcher.add("Rule", [pattern]) + assert len(matcher) == 1 + matcher.remove("Rule") + assert "Rule" not in matcher + matcher.add("Rule", [pattern]) + assert "Rule" in matcher + on_match, patterns = matcher.get("Rule") + assert len(patterns[0]) + + +def test_matcher_empty_patterns_warns(en_vocab): + matcher = Matcher(en_vocab) + assert len(matcher) == 0 + doc = Doc(en_vocab, words=["This", "is", "quite", "something"]) + with pytest.warns(UserWarning): + matcher(doc) + assert len(doc.ents) == 0 + + +def test_matcher_from_usage_docs(en_vocab): + text = "Wow 😀 This is really cool! 😂 😂" + doc = Doc(en_vocab, words=text.split(" ")) + pos_emoji = ["😀", "😃", "😂", "🤣", "😊", "😍"] + pos_patterns = [[{"ORTH": emoji}] for emoji in pos_emoji] + + def label_sentiment(matcher, doc, i, matches): + match_id, start, end = matches[i] + if doc.vocab.strings[match_id] == "HAPPY": + doc.sentiment += 0.1 + span = doc[start:end] + with doc.retokenize() as retokenizer: + retokenizer.merge(span) + token = doc[start] + token.vocab[token.text].norm_ = "happy emoji" + + matcher = Matcher(en_vocab) + matcher.add("HAPPY", pos_patterns, on_match=label_sentiment) + matcher(doc) + assert doc.sentiment != 0 + assert doc[1].norm_ == "happy emoji" + + +def test_matcher_len_contains(matcher): + assert len(matcher) == 3 + matcher.add("TEST", [[{"ORTH": "test"}]]) + assert "TEST" in matcher + assert "TEST2" not in matcher + + +def test_matcher_add_new_api(en_vocab): + doc = Doc(en_vocab, words=["a", "b"]) + patterns = [[{"TEXT": "a"}], [{"TEXT": "a"}, {"TEXT": "b"}]] + matcher = Matcher(en_vocab) + on_match = Mock() + matcher = Matcher(en_vocab) + matcher.add("NEW_API", patterns) + assert len(matcher(doc)) == 2 + matcher = Matcher(en_vocab) + on_match = Mock() + matcher.add("NEW_API_CALLBACK", patterns, on_match=on_match) + assert len(matcher(doc)) == 2 + assert on_match.call_count == 2 + + +def test_matcher_no_match(matcher): + doc = Doc(matcher.vocab, words=["I", "like", "cheese", "."]) + assert matcher(doc) == [] + + +def test_matcher_match_start(matcher): + doc = Doc(matcher.vocab, words=["JavaScript", "is", "good"]) + assert matcher(doc) == [(matcher.vocab.strings["JS"], 0, 1)] + + +def test_matcher_match_end(matcher): + words = ["I", "like", "java"] + doc = Doc(matcher.vocab, words=words) + assert matcher(doc) == [(doc.vocab.strings["Java"], 2, 3)] + + +def test_matcher_match_middle(matcher): + words = ["I", "like", "Google", "Now", "best"] + doc = Doc(matcher.vocab, words=words) + assert matcher(doc) == [(doc.vocab.strings["GoogleNow"], 2, 4)] + + +def test_matcher_match_multi(matcher): + words = ["I", "like", "Google", "Now", "and", "java", "best"] + doc = Doc(matcher.vocab, words=words) + assert matcher(doc) == [ + (doc.vocab.strings["GoogleNow"], 2, 4), + (doc.vocab.strings["Java"], 5, 6), + ] + + +@pytest.mark.parametrize( + "rules,match_locs", + [ + ( + { + "GoogleNow": [[{"ORTH": {"FUZZY": "Google"}}, {"ORTH": "Now"}]], + }, + [(2, 4)], + ), + ( + { + "Java": [[{"LOWER": {"FUZZY": "java"}}]], + }, + [(5, 6)], + ), + ( + { + "JS": [[{"ORTH": {"FUZZY": "JavaScript"}}]], + "GoogleNow": [[{"ORTH": {"FUZZY": "Google"}}, {"ORTH": "Now"}]], + "Java": [[{"LOWER": {"FUZZY": "java"}}]], + }, + [(2, 4), (5, 6), (8, 9)], + ), + # only the second pattern matches (check that predicate keys used for + # caching don't collide) + ( + { + "A": [[{"ORTH": {"FUZZY": "Javascripts"}}]], + "B": [[{"ORTH": {"FUZZY5": "Javascripts"}}]], + }, + [(8, 9)], + ), + ], +) +def test_matcher_match_fuzzy(en_vocab, rules, match_locs): + words = ["They", "like", "Goggle", "Now", "and", "Jav", "but", "not", "JvvaScrpt"] + doc = Doc(en_vocab, words=words) + + matcher = Matcher(en_vocab) + for key, patterns in rules.items(): + matcher.add(key, patterns) + assert match_locs == [(start, end) for m_id, start, end in matcher(doc)] + + +@pytest.mark.parametrize("set_op", ["IN", "NOT_IN"]) +def test_matcher_match_fuzzy_set_op_longest(en_vocab, set_op): + rules = { + "GoogleNow": [[{"ORTH": {"FUZZY": {set_op: ["Google", "Now"]}}, "OP": "+"}]] + } + matcher = Matcher(en_vocab) + for key, patterns in rules.items(): + matcher.add(key, patterns, greedy="LONGEST") + + words = ["They", "like", "Goggle", "Noo"] + doc = Doc(en_vocab, words=words) + assert len(matcher(doc)) == 1 + + +def test_matcher_match_fuzzy_set_multiple(en_vocab): + rules = { + "GoogleNow": [ + [ + { + "ORTH": {"FUZZY": {"IN": ["Google", "Now"]}, "NOT_IN": ["Goggle"]}, + "OP": "+", + } + ] + ] + } + matcher = Matcher(en_vocab) + for key, patterns in rules.items(): + matcher.add(key, patterns, greedy="LONGEST") + + words = ["They", "like", "Goggle", "Noo"] + doc = Doc(matcher.vocab, words=words) + assert matcher(doc) == [ + (doc.vocab.strings["GoogleNow"], 3, 4), + ] + + +@pytest.mark.parametrize("fuzzyn", range(1, 10)) +def test_matcher_match_fuzzyn_all_insertions(en_vocab, fuzzyn): + matcher = Matcher(en_vocab) + matcher.add("GoogleNow", [[{"ORTH": {f"FUZZY{fuzzyn}": "GoogleNow"}}]]) + # words with increasing edit distance + words = ["GoogleNow" + "a" * i for i in range(0, 10)] + doc = Doc(en_vocab, words) + assert len(matcher(doc)) == fuzzyn + 1 + + +@pytest.mark.parametrize("fuzzyn", range(1, 6)) +def test_matcher_match_fuzzyn_various_edits(en_vocab, fuzzyn): + matcher = Matcher(en_vocab) + matcher.add("GoogleNow", [[{"ORTH": {f"FUZZY{fuzzyn}": "GoogleNow"}}]]) + # words with increasing edit distance of different edit types + words = [ + "GoogleNow", + "GoogleNuw", + "GoogleNuew", + "GoogleNoweee", + "GiggleNuw3", + "gouggle5New", + ] + doc = Doc(en_vocab, words) + assert len(matcher(doc)) == fuzzyn + 1 + + +@pytest.mark.parametrize("greedy", ["FIRST", "LONGEST"]) +@pytest.mark.parametrize("set_op", ["IN", "NOT_IN"]) +def test_matcher_match_fuzzyn_set_op_longest(en_vocab, greedy, set_op): + rules = { + "GoogleNow": [[{"ORTH": {"FUZZY2": {set_op: ["Google", "Now"]}}, "OP": "+"}]] + } + matcher = Matcher(en_vocab) + for key, patterns in rules.items(): + matcher.add(key, patterns, greedy=greedy) + + words = ["They", "like", "Goggle", "Noo"] + doc = Doc(matcher.vocab, words=words) + spans = matcher(doc, as_spans=True) + assert len(spans) == 1 + if set_op == "IN": + assert spans[0].text == "Goggle Noo" + else: + assert spans[0].text == "They like" + + +def test_matcher_match_fuzzyn_set_multiple(en_vocab): + rules = { + "GoogleNow": [ + [ + { + "ORTH": {"FUZZY1": {"IN": ["Google", "Now"]}, "NOT_IN": ["Goggle"]}, + "OP": "+", + } + ] + ] + } + matcher = Matcher(en_vocab) + for key, patterns in rules.items(): + matcher.add(key, patterns, greedy="LONGEST") + + words = ["They", "like", "Goggle", "Noo"] + doc = Doc(matcher.vocab, words=words) + assert matcher(doc) == [ + (doc.vocab.strings["GoogleNow"], 3, 4), + ] + + +def test_matcher_empty_dict(en_vocab): + """Test matcher allows empty token specs, meaning match on any token.""" + matcher = Matcher(en_vocab) + doc = Doc(matcher.vocab, words=["a", "b", "c"]) + matcher.add("A.C", [[{"ORTH": "a"}, {}, {"ORTH": "c"}]]) + matches = matcher(doc) + assert len(matches) == 1 + assert matches[0][1:] == (0, 3) + matcher = Matcher(en_vocab) + matcher.add("A.", [[{"ORTH": "a"}, {}]]) + matches = matcher(doc) + assert matches[0][1:] == (0, 2) + + +def test_matcher_operator_shadow(en_vocab): + matcher = Matcher(en_vocab) + doc = Doc(matcher.vocab, words=["a", "b", "c"]) + pattern = [{"ORTH": "a"}, {"IS_ALPHA": True, "OP": "+"}, {"ORTH": "c"}] + matcher.add("A.C", [pattern]) + matches = matcher(doc) + assert len(matches) == 1 + assert matches[0][1:] == (0, 3) + + +def test_matcher_match_zero(matcher): + words1 = 'He said , " some words " ...'.split() + words2 = 'He said , " some three words " ...'.split() + pattern1 = [ + {"ORTH": '"'}, + {"OP": "!", "IS_PUNCT": True}, + {"OP": "!", "IS_PUNCT": True}, + {"ORTH": '"'}, + ] + pattern2 = [ + {"ORTH": '"'}, + {"IS_PUNCT": True}, + {"IS_PUNCT": True}, + {"IS_PUNCT": True}, + {"ORTH": '"'}, + ] + matcher.add("Quote", [pattern1]) + doc = Doc(matcher.vocab, words=words1) + assert len(matcher(doc)) == 1 + doc = Doc(matcher.vocab, words=words2) + assert len(matcher(doc)) == 0 + matcher.add("Quote", [pattern2]) + assert len(matcher(doc)) == 0 + + +def test_matcher_match_zero_plus(matcher): + words = 'He said , " some words " ...'.split() + pattern = [{"ORTH": '"'}, {"OP": "*", "IS_PUNCT": False}, {"ORTH": '"'}] + matcher = Matcher(matcher.vocab) + matcher.add("Quote", [pattern]) + doc = Doc(matcher.vocab, words=words) + assert len(matcher(doc)) == 1 + + +def test_matcher_match_one_plus(matcher): + control = Matcher(matcher.vocab) + control.add("BasicPhilippe", [[{"ORTH": "Philippe"}]]) + doc = Doc(control.vocab, words=["Philippe", "Philippe"]) + m = control(doc) + assert len(m) == 2 + pattern = [{"ORTH": "Philippe"}, {"ORTH": "Philippe", "OP": "+"}] + matcher.add("KleenePhilippe", [pattern]) + m = matcher(doc) + assert len(m) == 1 + + +def test_matcher_any_token_operator(en_vocab): + """Test that patterns with "any token" {} work with operators.""" + matcher = Matcher(en_vocab) + matcher.add("TEST", [[{"ORTH": "test"}, {"OP": "*"}]]) + doc = Doc(en_vocab, words=["test", "hello", "world"]) + matches = [doc[start:end].text for _, start, end in matcher(doc)] + assert len(matches) == 3 + assert matches[0] == "test" + assert matches[1] == "test hello" + assert matches[2] == "test hello world" + + +@pytest.mark.usefixtures("clean_underscore") +def test_matcher_extension_attribute(en_vocab): + matcher = Matcher(en_vocab) + get_is_fruit = lambda token: token.text in ("apple", "banana") + Token.set_extension("is_fruit", getter=get_is_fruit, force=True) + pattern = [{"ORTH": "an"}, {"_": {"is_fruit": True}}] + matcher.add("HAVING_FRUIT", [pattern]) + doc = Doc(en_vocab, words=["an", "apple"]) + matches = matcher(doc) + assert len(matches) == 1 + doc = Doc(en_vocab, words=["an", "aardvark"]) + matches = matcher(doc) + assert len(matches) == 0 + + +def test_matcher_set_value(en_vocab): + matcher = Matcher(en_vocab) + pattern = [{"ORTH": {"IN": ["an", "a"]}}] + matcher.add("A_OR_AN", [pattern]) + doc = Doc(en_vocab, words=["an", "a", "apple"]) + matches = matcher(doc) + assert len(matches) == 2 + doc = Doc(en_vocab, words=["aardvark"]) + matches = matcher(doc) + assert len(matches) == 0 + + +def test_matcher_set_value_operator(en_vocab): + matcher = Matcher(en_vocab) + pattern = [{"ORTH": {"IN": ["a", "the"]}, "OP": "?"}, {"ORTH": "house"}] + matcher.add("DET_HOUSE", [pattern]) + doc = Doc(en_vocab, words=["In", "a", "house"]) + matches = matcher(doc) + assert len(matches) == 2 + doc = Doc(en_vocab, words=["my", "house"]) + matches = matcher(doc) + assert len(matches) == 1 + + +def test_matcher_subset_value_operator(en_vocab): + matcher = Matcher(en_vocab) + pattern = [{"MORPH": {"IS_SUBSET": ["Feat=Val", "Feat2=Val2"]}}] + matcher.add("M", [pattern]) + doc = Doc(en_vocab, words=["a", "b", "c"]) + assert len(matcher(doc)) == 3 + doc[0].set_morph("Feat=Val") + assert len(matcher(doc)) == 3 + doc[0].set_morph("Feat=Val|Feat2=Val2") + assert len(matcher(doc)) == 3 + doc[0].set_morph("Feat=Val|Feat2=Val2|Feat3=Val3") + assert len(matcher(doc)) == 2 + doc[0].set_morph("Feat=Val|Feat2=Val2|Feat3=Val3|Feat4=Val4") + assert len(matcher(doc)) == 2 + + # IS_SUBSET acts like "IN" for attrs other than MORPH + matcher = Matcher(en_vocab) + pattern = [{"TAG": {"IS_SUBSET": ["A", "B"]}}] + matcher.add("M", [pattern]) + doc = Doc(en_vocab, words=["a", "b", "c"]) + doc[0].tag_ = "A" + assert len(matcher(doc)) == 1 + + # IS_SUBSET with an empty list matches nothing + matcher = Matcher(en_vocab) + pattern = [{"TAG": {"IS_SUBSET": []}}] + matcher.add("M", [pattern]) + doc = Doc(en_vocab, words=["a", "b", "c"]) + doc[0].tag_ = "A" + assert len(matcher(doc)) == 0 + + # IS_SUBSET with a list value + Token.set_extension("ext", default=[]) + matcher = Matcher(en_vocab) + pattern = [{"_": {"ext": {"IS_SUBSET": ["A", "B"]}}}] + matcher.add("M", [pattern]) + doc = Doc(en_vocab, words=["a", "b", "c"]) + doc[0]._.ext = ["A"] + doc[1]._.ext = ["C", "D"] + assert len(matcher(doc)) == 2 + + +def test_matcher_superset_value_operator(en_vocab): + matcher = Matcher(en_vocab) + pattern = [{"MORPH": {"IS_SUPERSET": ["Feat=Val", "Feat2=Val2", "Feat3=Val3"]}}] + matcher.add("M", [pattern]) + doc = Doc(en_vocab, words=["a", "b", "c"]) + assert len(matcher(doc)) == 0 + doc[0].set_morph("Feat=Val|Feat2=Val2") + assert len(matcher(doc)) == 0 + doc[0].set_morph("Feat=Val|Feat2=Val2|Feat3=Val3") + assert len(matcher(doc)) == 1 + doc[0].set_morph("Feat=Val|Feat2=Val2|Feat3=Val3|Feat4=Val4") + assert len(matcher(doc)) == 1 + + # IS_SUPERSET with more than one value only matches for MORPH + matcher = Matcher(en_vocab) + pattern = [{"TAG": {"IS_SUPERSET": ["A", "B"]}}] + matcher.add("M", [pattern]) + doc = Doc(en_vocab, words=["a", "b", "c"]) + doc[0].tag_ = "A" + assert len(matcher(doc)) == 0 + + # IS_SUPERSET with one value is the same as == + matcher = Matcher(en_vocab) + pattern = [{"TAG": {"IS_SUPERSET": ["A"]}}] + matcher.add("M", [pattern]) + doc = Doc(en_vocab, words=["a", "b", "c"]) + doc[0].tag_ = "A" + assert len(matcher(doc)) == 1 + + # IS_SUPERSET with an empty value matches everything + matcher = Matcher(en_vocab) + pattern = [{"TAG": {"IS_SUPERSET": []}}] + matcher.add("M", [pattern]) + doc = Doc(en_vocab, words=["a", "b", "c"]) + doc[0].tag_ = "A" + assert len(matcher(doc)) == 3 + + # IS_SUPERSET with a list value + Token.set_extension("ext", default=[]) + matcher = Matcher(en_vocab) + pattern = [{"_": {"ext": {"IS_SUPERSET": ["A"]}}}] + matcher.add("M", [pattern]) + doc = Doc(en_vocab, words=["a", "b", "c"]) + doc[0]._.ext = ["A", "B"] + assert len(matcher(doc)) == 1 + + +def test_matcher_intersect_value_operator(en_vocab): + matcher = Matcher(en_vocab) + pattern = [{"MORPH": {"INTERSECTS": ["Feat=Val", "Feat2=Val2", "Feat3=Val3"]}}] + matcher.add("M", [pattern]) + doc = Doc(en_vocab, words=["a", "b", "c"]) + assert len(matcher(doc)) == 0 + doc[0].set_morph("Feat=Val") + assert len(matcher(doc)) == 1 + doc[0].set_morph("Feat=Val|Feat2=Val2") + assert len(matcher(doc)) == 1 + doc[0].set_morph("Feat=Val|Feat2=Val2|Feat3=Val3") + assert len(matcher(doc)) == 1 + doc[0].set_morph("Feat=Val|Feat2=Val2|Feat3=Val3|Feat4=Val4") + assert len(matcher(doc)) == 1 + + # INTERSECTS with a single value is the same as IN + matcher = Matcher(en_vocab) + pattern = [{"TAG": {"INTERSECTS": ["A", "B"]}}] + matcher.add("M", [pattern]) + doc = Doc(en_vocab, words=["a", "b", "c"]) + doc[0].tag_ = "A" + assert len(matcher(doc)) == 1 + + # INTERSECTS with an empty pattern list matches nothing + matcher = Matcher(en_vocab) + pattern = [{"TAG": {"INTERSECTS": []}}] + matcher.add("M", [pattern]) + doc = Doc(en_vocab, words=["a", "b", "c"]) + doc[0].tag_ = "A" + assert len(matcher(doc)) == 0 + + # INTERSECTS with a list value + Token.set_extension("ext", default=[]) + matcher = Matcher(en_vocab) + pattern = [{"_": {"ext": {"INTERSECTS": ["A", "C"]}}}] + matcher.add("M", [pattern]) + doc = Doc(en_vocab, words=["a", "b", "c"]) + doc[0]._.ext = ["A", "B"] + assert len(matcher(doc)) == 1 + + # INTERSECTS matches nothing for iterables that aren't all str or int + matcher = Matcher(en_vocab) + pattern = [{"_": {"ext": {"INTERSECTS": ["Abx", "C"]}}}] + matcher.add("M", [pattern]) + doc = Doc(en_vocab, words=["a", "b", "c"]) + doc[0]._.ext = [["Abx"], "B"] + assert len(matcher(doc)) == 0 + doc[0]._.ext = ["Abx", "B"] + assert len(matcher(doc)) == 1 + + # INTERSECTS with an empty pattern list matches nothing + matcher = Matcher(en_vocab) + pattern = [{"_": {"ext": {"INTERSECTS": []}}}] + matcher.add("M", [pattern]) + doc = Doc(en_vocab, words=["a", "b", "c"]) + doc[0]._.ext = ["A", "B"] + assert len(matcher(doc)) == 0 + + # INTERSECTS with an empty value matches nothing + matcher = Matcher(en_vocab) + pattern = [{"_": {"ext": {"INTERSECTS": ["A", "B"]}}}] + matcher.add("M", [pattern]) + doc = Doc(en_vocab, words=["a", "b", "c"]) + doc[0]._.ext = [] + assert len(matcher(doc)) == 0 + + +def test_matcher_morph_handling(en_vocab): + # order of features in pattern doesn't matter + matcher = Matcher(en_vocab) + pattern1 = [{"MORPH": {"IN": ["Feat1=Val1|Feat2=Val2"]}}] + pattern2 = [{"MORPH": {"IN": ["Feat2=Val2|Feat1=Val1"]}}] + matcher.add("M", [pattern1]) + matcher.add("N", [pattern2]) + doc = Doc(en_vocab, words=["a", "b", "c"]) + assert len(matcher(doc)) == 0 + + doc[0].set_morph("Feat2=Val2|Feat1=Val1") + assert len(matcher(doc)) == 2 + doc[0].set_morph("Feat1=Val1|Feat2=Val2") + assert len(matcher(doc)) == 2 + + # multiple values are split + matcher = Matcher(en_vocab) + pattern1 = [{"MORPH": {"IS_SUPERSET": ["Feat1=Val1", "Feat2=Val2"]}}] + pattern2 = [{"MORPH": {"IS_SUPERSET": ["Feat1=Val1", "Feat1=Val3", "Feat2=Val2"]}}] + matcher.add("M", [pattern1]) + matcher.add("N", [pattern2]) + doc = Doc(en_vocab, words=["a", "b", "c"]) + assert len(matcher(doc)) == 0 + + doc[0].set_morph("Feat2=Val2,Val3|Feat1=Val1") + assert len(matcher(doc)) == 1 + doc[0].set_morph("Feat1=Val1,Val3|Feat2=Val2") + assert len(matcher(doc)) == 2 + + +def test_matcher_regex(en_vocab): + matcher = Matcher(en_vocab) + pattern = [{"ORTH": {"REGEX": r"(?:a|an)"}}] + matcher.add("A_OR_AN", [pattern]) + doc = Doc(en_vocab, words=["an", "a", "hi"]) + matches = matcher(doc) + assert len(matches) == 2 + doc = Doc(en_vocab, words=["bye"]) + matches = matcher(doc) + assert len(matches) == 0 + + +def test_matcher_regex_set_in(en_vocab): + matcher = Matcher(en_vocab) + pattern = [{"ORTH": {"REGEX": {"IN": [r"(?:a)", r"(?:an)"]}}}] + matcher.add("A_OR_AN", [pattern]) + doc = Doc(en_vocab, words=["an", "a", "hi"]) + matches = matcher(doc) + assert len(matches) == 2 + doc = Doc(en_vocab, words=["bye"]) + matches = matcher(doc) + assert len(matches) == 0 + + +def test_matcher_regex_set_not_in(en_vocab): + matcher = Matcher(en_vocab) + pattern = [{"ORTH": {"REGEX": {"NOT_IN": [r"(?:a)", r"(?:an)"]}}}] + matcher.add("A_OR_AN", [pattern]) + doc = Doc(en_vocab, words=["an", "a", "hi"]) + matches = matcher(doc) + assert len(matches) == 1 + doc = Doc(en_vocab, words=["bye"]) + matches = matcher(doc) + assert len(matches) == 1 + + +def test_matcher_regex_shape(en_vocab): + matcher = Matcher(en_vocab) + pattern = [{"SHAPE": {"REGEX": r"^[^x]+$"}}] + matcher.add("NON_ALPHA", [pattern]) + doc = Doc(en_vocab, words=["99", "problems", "!"]) + matches = matcher(doc) + assert len(matches) == 2 + doc = Doc(en_vocab, words=["bye"]) + matches = matcher(doc) + assert len(matches) == 0 + + +@pytest.mark.parametrize( + "cmp, bad", + [ + ("==", ["a", "aaa"]), + ("!=", ["aa"]), + (">=", ["a"]), + ("<=", ["aaa"]), + (">", ["a", "aa"]), + ("<", ["aa", "aaa"]), + ], +) +def test_matcher_compare_length(en_vocab, cmp, bad): + matcher = Matcher(en_vocab) + pattern = [{"LENGTH": {cmp: 2}}] + matcher.add("LENGTH_COMPARE", [pattern]) + doc = Doc(en_vocab, words=["a", "aa", "aaa"]) + matches = matcher(doc) + assert len(matches) == len(doc) - len(bad) + doc = Doc(en_vocab, words=bad) + matches = matcher(doc) + assert len(matches) == 0 + + +def test_matcher_extension_set_membership(en_vocab): + matcher = Matcher(en_vocab) + get_reversed = lambda token: "".join(reversed(token.text)) + Token.set_extension("reversed", getter=get_reversed, force=True) + pattern = [{"_": {"reversed": {"IN": ["eyb", "ih"]}}}] + matcher.add("REVERSED", [pattern]) + doc = Doc(en_vocab, words=["hi", "bye", "hello"]) + matches = matcher(doc) + assert len(matches) == 2 + doc = Doc(en_vocab, words=["aardvark"]) + matches = matcher(doc) + assert len(matches) == 0 + + +def test_matcher_extension_in_set_predicate(en_vocab): + matcher = Matcher(en_vocab) + Token.set_extension("ext", default=[]) + pattern = [{"_": {"ext": {"IN": ["A", "C"]}}}] + matcher.add("M", [pattern]) + doc = Doc(en_vocab, words=["a", "b", "c"]) + + # The IN predicate expects an exact match between the + # extension value and one of the pattern's values. + doc[0]._.ext = ["A", "B"] + assert len(matcher(doc)) == 0 + + doc[0]._.ext = ["A"] + assert len(matcher(doc)) == 0 + + doc[0]._.ext = "A" + assert len(matcher(doc)) == 1 + + +def test_matcher_basic_check(en_vocab): + matcher = Matcher(en_vocab) + # Potential mistake: pass in pattern instead of list of patterns + pattern = [{"TEXT": "hello"}, {"TEXT": "world"}] + with pytest.raises(ValueError): + matcher.add("TEST", pattern) + + +def test_attr_pipeline_checks(en_vocab): + doc1 = Doc(en_vocab, words=["Test"]) + doc1[0].dep_ = "ROOT" + doc2 = Doc(en_vocab, words=["Test"]) + doc2[0].tag_ = "TAG" + doc2[0].pos_ = "X" + doc2[0].set_morph("Feat=Val") + doc2[0].lemma_ = "LEMMA" + doc3 = Doc(en_vocab, words=["Test"]) + # DEP requires DEP + matcher = Matcher(en_vocab) + matcher.add("TEST", [[{"DEP": "a"}]]) + matcher(doc1) + with pytest.raises(ValueError): + matcher(doc2) + with pytest.raises(ValueError): + matcher(doc3) + # errors can be suppressed if desired + matcher(doc2, allow_missing=True) + matcher(doc3, allow_missing=True) + # TAG, POS, LEMMA require those values + for attr in ("TAG", "POS", "LEMMA"): + matcher = Matcher(en_vocab) + matcher.add("TEST", [[{attr: "a"}]]) + matcher(doc2) + with pytest.raises(ValueError): + matcher(doc1) + with pytest.raises(ValueError): + matcher(doc3) + # TEXT/ORTH only require tokens + matcher = Matcher(en_vocab) + matcher.add("TEST", [[{"ORTH": "a"}]]) + matcher(doc1) + matcher(doc2) + matcher(doc3) + matcher = Matcher(en_vocab) + matcher.add("TEST", [[{"TEXT": "a"}]]) + matcher(doc1) + matcher(doc2) + matcher(doc3) + + +@pytest.mark.parametrize( + "pattern,text", + [ + ([{"IS_ALPHA": True}], "a"), + ([{"IS_ASCII": True}], "a"), + ([{"IS_DIGIT": True}], "1"), + ([{"IS_LOWER": True}], "a"), + ([{"IS_UPPER": True}], "A"), + ([{"IS_TITLE": True}], "Aaaa"), + ([{"IS_PUNCT": True}], "."), + ([{"IS_SPACE": True}], "\n"), + ([{"IS_BRACKET": True}], "["), + ([{"IS_QUOTE": True}], '"'), + ([{"IS_LEFT_PUNCT": True}], "``"), + ([{"IS_RIGHT_PUNCT": True}], "''"), + ([{"IS_STOP": True}], "the"), + ([{"SPACY": True}], "the"), + ([{"LIKE_NUM": True}], "1"), + ([{"LIKE_URL": True}], "http://example.com"), + ([{"LIKE_EMAIL": True}], "mail@example.com"), + ], +) +def test_matcher_schema_token_attributes(en_vocab, pattern, text): + matcher = Matcher(en_vocab) + doc = Doc(en_vocab, words=text.split(" ")) + matcher.add("Rule", [pattern]) + assert len(matcher) == 1 + matches = matcher(doc) + assert len(matches) == 1 + + +@pytest.mark.filterwarnings("ignore:\\[W036") +def test_matcher_valid_callback(en_vocab): + """Test that on_match can only be None or callable.""" + matcher = Matcher(en_vocab) + with pytest.raises(ValueError): + matcher.add("TEST", [[{"TEXT": "test"}]], on_match=[]) + matcher(Doc(en_vocab, words=["test"])) + + +def test_matcher_callback(en_vocab): + mock = Mock() + matcher = Matcher(en_vocab) + pattern = [{"ORTH": "test"}] + matcher.add("Rule", [pattern], on_match=mock) + doc = Doc(en_vocab, words=["This", "is", "a", "test", "."]) + matches = matcher(doc) + mock.assert_called_once_with(matcher, doc, 0, matches) + + +def test_matcher_callback_with_alignments(en_vocab): + mock = Mock() + matcher = Matcher(en_vocab) + pattern = [{"ORTH": "test"}] + matcher.add("Rule", [pattern], on_match=mock) + doc = Doc(en_vocab, words=["This", "is", "a", "test", "."]) + matches = matcher(doc, with_alignments=True) + mock.assert_called_once_with(matcher, doc, 0, matches) + + +def test_matcher_span(matcher): + text = "JavaScript is good but Java is better" + doc = Doc(matcher.vocab, words=text.split()) + span_js = doc[:3] + span_java = doc[4:] + assert len(matcher(doc)) == 2 + assert len(matcher(span_js)) == 1 + assert len(matcher(span_java)) == 1 + + +def test_matcher_as_spans(matcher): + """Test the new as_spans=True API.""" + text = "JavaScript is good but Java is better" + doc = Doc(matcher.vocab, words=text.split()) + matches = matcher(doc, as_spans=True) + assert len(matches) == 2 + assert isinstance(matches[0], Span) + assert matches[0].text == "JavaScript" + assert matches[0].label_ == "JS" + assert isinstance(matches[1], Span) + assert matches[1].text == "Java" + assert matches[1].label_ == "Java" + + matches = matcher(doc[1:], as_spans=True) + assert len(matches) == 1 + assert isinstance(matches[0], Span) + assert matches[0].text == "Java" + assert matches[0].label_ == "Java" + + +def test_matcher_deprecated(matcher): + doc = Doc(matcher.vocab, words=["hello", "world"]) + with pytest.warns(DeprecationWarning) as record: + for _ in matcher.pipe([doc]): + pass + assert record.list + assert "spaCy v3.0" in str(record.list[0].message) + + +def test_matcher_remove_zero_operator(en_vocab): + matcher = Matcher(en_vocab) + pattern = [{"OP": "!"}] + matcher.add("Rule", [pattern]) + doc = Doc(en_vocab, words=["This", "is", "a", "test", "."]) + matches = matcher(doc) + assert len(matches) == 0 + assert "Rule" in matcher + matcher.remove("Rule") + assert "Rule" not in matcher + + +def test_matcher_no_zero_length(en_vocab): + doc = Doc(en_vocab, words=["a", "b"], tags=["A", "B"]) + matcher = Matcher(en_vocab) + matcher.add("TEST", [[{"TAG": "C", "OP": "?"}]]) + assert len(matcher(doc)) == 0 + + +def test_matcher_ent_iob_key(en_vocab): + """Test that patterns with ent_iob works correctly.""" + matcher = Matcher(en_vocab) + matcher.add("Rule", [[{"ENT_IOB": "I"}]]) + doc1 = Doc(en_vocab, words=["I", "visited", "New", "York", "and", "California"]) + doc1.ents = [Span(doc1, 2, 4, label="GPE"), Span(doc1, 5, 6, label="GPE")] + doc2 = Doc(en_vocab, words=["I", "visited", "my", "friend", "Alicia"]) + doc2.ents = [Span(doc2, 4, 5, label="PERSON")] + matches1 = [doc1[start:end].text for _, start, end in matcher(doc1)] + matches2 = [doc2[start:end].text for _, start, end in matcher(doc2)] + assert len(matches1) == 1 + assert matches1[0] == "York" + assert len(matches2) == 0 + + matcher = Matcher(en_vocab) # Test iob pattern with operators + matcher.add("Rule", [[{"ENT_IOB": "I", "OP": "+"}]]) + doc = Doc( + en_vocab, words=["I", "visited", "my", "friend", "Anna", "Maria", "Esperanza"] + ) + doc.ents = [Span(doc, 4, 7, label="PERSON")] + matches = [doc[start:end].text for _, start, end in matcher(doc)] + assert len(matches) == 3 + assert matches[0] == "Maria" + assert matches[1] == "Maria Esperanza" + assert matches[2] == "Esperanza" + + +def test_matcher_min_max_operator(en_vocab): + # Exactly n matches {n} + doc = Doc( + en_vocab, + words=["foo", "bar", "foo", "foo", "bar", "foo", "foo", "foo", "bar", "bar"], + ) + matcher = Matcher(en_vocab) + pattern = [{"ORTH": "foo", "OP": "{3}"}] + matcher.add("TEST", [pattern]) + + matches1 = [doc[start:end].text for _, start, end in matcher(doc)] + assert len(matches1) == 1 + + # At least n matches {n,} + matcher = Matcher(en_vocab) + pattern = [{"ORTH": "foo", "OP": "{2,}"}] + matcher.add("TEST", [pattern]) + matches2 = [doc[start:end].text for _, start, end in matcher(doc)] + assert len(matches2) == 4 + + # At most m matches {,m} + matcher = Matcher(en_vocab) + pattern = [{"ORTH": "foo", "OP": "{,2}"}] + matcher.add("TEST", [pattern]) + matches3 = [doc[start:end].text for _, start, end in matcher(doc)] + assert len(matches3) == 9 + + # At least n matches and most m matches {n,m} + matcher = Matcher(en_vocab) + pattern = [{"ORTH": "foo", "OP": "{2,3}"}] + matcher.add("TEST", [pattern]) + matches4 = [doc[start:end].text for _, start, end in matcher(doc)] + assert len(matches4) == 4 diff --git a/TTS/Kokoro/.venv/Lib/site-packages/spacy/tests/matcher/test_matcher_logic.py b/TTS/Kokoro/.venv/Lib/site-packages/spacy/tests/matcher/test_matcher_logic.py new file mode 100644 index 0000000000000000000000000000000000000000..c1f34b2f351a874e93d0a90610880892e9349893 --- /dev/null +++ b/TTS/Kokoro/.venv/Lib/site-packages/spacy/tests/matcher/test_matcher_logic.py @@ -0,0 +1,788 @@ +import re + +import pytest + +from spacy.attrs import IS_PUNCT, LOWER, ORTH +from spacy.errors import MatchPatternError +from spacy.lang.en import English +from spacy.lang.lex_attrs import LEX_ATTRS +from spacy.matcher import Matcher +from spacy.tokens import Doc, Span, Token +from spacy.vocab import Vocab + +pattern1 = [{"ORTH": "A"}, {"ORTH": "A", "OP": "*"}] +pattern2 = [{"ORTH": "A", "OP": "*"}, {"ORTH": "A"}] +pattern3 = [{"ORTH": "A"}, {"ORTH": "A"}] +pattern4 = [{"ORTH": "B"}, {"ORTH": "A", "OP": "*"}, {"ORTH": "B"}] +pattern5 = [{"ORTH": "B", "OP": "*"}, {"ORTH": "A", "OP": "*"}, {"ORTH": "B"}] + +re_pattern1 = "AA*" +re_pattern2 = "A*A" +re_pattern3 = "AA" +re_pattern4 = "BA*B" +re_pattern5 = "B*A*B" + +longest1 = "A A A A A" +longest2 = "A A A A A" +longest3 = "A A" +longest4 = "B A A A A A B" # "FIRST" would be "B B" +longest5 = "B B A A A A A B" + + +@pytest.fixture +def text(): + return "(BBAAAAAB)." + + +@pytest.fixture +def doc(en_tokenizer, text): + doc = en_tokenizer(" ".join(text)) + return doc + + +@pytest.mark.issue(118) +@pytest.mark.parametrize( + "patterns", + [ + [[{"LOWER": "celtics"}], [{"LOWER": "boston"}, {"LOWER": "celtics"}]], + [[{"LOWER": "boston"}, {"LOWER": "celtics"}], [{"LOWER": "celtics"}]], + ], +) +def test_issue118(en_tokenizer, patterns): + """Test a bug that arose from having overlapping matches""" + text = ( + "how many points did lebron james score against the boston celtics last night" + ) + doc = en_tokenizer(text) + ORG = doc.vocab.strings["ORG"] + matcher = Matcher(doc.vocab) + matcher.add("BostonCeltics", patterns) + assert len(list(doc.ents)) == 0 + matches = [(ORG, start, end) for _, start, end in matcher(doc)] + assert matches == [(ORG, 9, 11), (ORG, 10, 11)] + doc.ents = matches[:1] + ents = list(doc.ents) + assert len(ents) == 1 + assert ents[0].label == ORG + assert ents[0].start == 9 + assert ents[0].end == 11 + + +@pytest.mark.issue(118) +@pytest.mark.parametrize( + "patterns", + [ + [[{"LOWER": "boston"}], [{"LOWER": "boston"}, {"LOWER": "celtics"}]], + [[{"LOWER": "boston"}, {"LOWER": "celtics"}], [{"LOWER": "boston"}]], + ], +) +def test_issue118_prefix_reorder(en_tokenizer, patterns): + """Test a bug that arose from having overlapping matches""" + text = ( + "how many points did lebron james score against the boston celtics last night" + ) + doc = en_tokenizer(text) + ORG = doc.vocab.strings["ORG"] + matcher = Matcher(doc.vocab) + matcher.add("BostonCeltics", patterns) + assert len(list(doc.ents)) == 0 + matches = [(ORG, start, end) for _, start, end in matcher(doc)] + doc.ents += tuple(matches)[1:] + assert matches == [(ORG, 9, 10), (ORG, 9, 11)] + ents = doc.ents + assert len(ents) == 1 + assert ents[0].label == ORG + assert ents[0].start == 9 + assert ents[0].end == 11 + + +@pytest.mark.issue(242) +def test_issue242(en_tokenizer): + """Test overlapping multi-word phrases.""" + text = "There are different food safety standards in different countries." + patterns = [ + [{"LOWER": "food"}, {"LOWER": "safety"}], + [{"LOWER": "safety"}, {"LOWER": "standards"}], + ] + doc = en_tokenizer(text) + matcher = Matcher(doc.vocab) + matcher.add("FOOD", patterns) + matches = [(ent_type, start, end) for ent_type, start, end in matcher(doc)] + match1, match2 = matches + assert match1[1] == 3 + assert match1[2] == 5 + assert match2[1] == 4 + assert match2[2] == 6 + with pytest.raises(ValueError): + # One token can only be part of one entity, so test that the matches + # can't be added as entities + doc.ents += tuple(matches) + + +@pytest.mark.issue(587) +def test_issue587(en_tokenizer): + """Test that Matcher doesn't segfault on particular input""" + doc = en_tokenizer("a b; c") + matcher = Matcher(doc.vocab) + matcher.add("TEST1", [[{ORTH: "a"}, {ORTH: "b"}]]) + matches = matcher(doc) + assert len(matches) == 1 + matcher.add("TEST2", [[{ORTH: "a"}, {ORTH: "b"}, {IS_PUNCT: True}, {ORTH: "c"}]]) + matches = matcher(doc) + assert len(matches) == 2 + matcher.add("TEST3", [[{ORTH: "a"}, {ORTH: "b"}, {IS_PUNCT: True}, {ORTH: "d"}]]) + matches = matcher(doc) + assert len(matches) == 2 + + +@pytest.mark.issue(588) +def test_issue588(en_vocab): + """Test if empty specs still cause an error when adding patterns""" + matcher = Matcher(en_vocab) + with pytest.raises(ValueError): + matcher.add("TEST", [[]]) + + +@pytest.mark.issue(590) +def test_issue590(en_vocab): + """Test overlapping matches""" + doc = Doc(en_vocab, words=["n", "=", "1", ";", "a", ":", "5", "%"]) + matcher = Matcher(en_vocab) + matcher.add( + "ab", [[{"IS_ALPHA": True}, {"ORTH": ":"}, {"LIKE_NUM": True}, {"ORTH": "%"}]] + ) + matcher.add("ab", [[{"IS_ALPHA": True}, {"ORTH": "="}, {"LIKE_NUM": True}]]) + matches = matcher(doc) + assert len(matches) == 2 + + +@pytest.mark.issue(615) +def test_issue615(en_tokenizer): + def merge_phrases(matcher, doc, i, matches): + """Merge a phrase. We have to be careful here because we'll change the + token indices. To avoid problems, merge all the phrases once we're called + on the last match.""" + if i != len(matches) - 1: + return None + spans = [Span(doc, start, end, label=label) for label, start, end in matches] + with doc.retokenize() as retokenizer: + for span in spans: + tag = "NNP" if span.label_ else span.root.tag_ + attrs = {"tag": tag, "lemma": span.text} + retokenizer.merge(span, attrs=attrs) + doc.ents = doc.ents + (span,) + + text = "The golf club is broken" + pattern = [{"ORTH": "golf"}, {"ORTH": "club"}] + label = "Sport_Equipment" + doc = en_tokenizer(text) + matcher = Matcher(doc.vocab) + matcher.add(label, [pattern], on_match=merge_phrases) + matcher(doc) + entities = list(doc.ents) + assert entities != [] + assert entities[0].label != 0 + + +@pytest.mark.issue(850) +def test_issue850(): + """The variable-length pattern matches the succeeding token. Check we + handle the ambiguity correctly.""" + vocab = Vocab(lex_attr_getters={LOWER: lambda string: string.lower()}) + matcher = Matcher(vocab) + pattern = [{"LOWER": "bob"}, {"OP": "*"}, {"LOWER": "frank"}] + matcher.add("FarAway", [pattern]) + doc = Doc(matcher.vocab, words=["bob", "and", "and", "frank"]) + match = matcher(doc) + assert len(match) == 1 + ent_id, start, end = match[0] + assert start == 0 + assert end == 4 + + +@pytest.mark.issue(850) +def test_issue850_basic(): + """Test Matcher matches with '*' operator and Boolean flag""" + vocab = Vocab(lex_attr_getters={LOWER: lambda string: string.lower()}) + matcher = Matcher(vocab) + pattern = [{"LOWER": "bob"}, {"OP": "*", "LOWER": "and"}, {"LOWER": "frank"}] + matcher.add("FarAway", [pattern]) + doc = Doc(matcher.vocab, words=["bob", "and", "and", "frank"]) + match = matcher(doc) + assert len(match) == 1 + ent_id, start, end = match[0] + assert start == 0 + assert end == 4 + + +@pytest.mark.issue(1434) +def test_issue1434(): + """Test matches occur when optional element at end of short doc.""" + pattern = [{"ORTH": "Hello"}, {"IS_ALPHA": True, "OP": "?"}] + vocab = Vocab(lex_attr_getters=LEX_ATTRS) + hello_world = Doc(vocab, words=["Hello", "World"]) + hello = Doc(vocab, words=["Hello"]) + matcher = Matcher(vocab) + matcher.add("MyMatcher", [pattern]) + matches = matcher(hello_world) + assert matches + matches = matcher(hello) + assert matches + + +@pytest.mark.parametrize( + "string,start,end", + [ + ("a", 0, 1), + ("a b", 0, 2), + ("a c", 0, 1), + ("a b c", 0, 2), + ("a b b c", 0, 3), + ("a b b", 0, 3), + ], +) +@pytest.mark.issue(1450) +def test_issue1450(string, start, end): + """Test matcher works when patterns end with * operator.""" + pattern = [{"ORTH": "a"}, {"ORTH": "b", "OP": "*"}] + matcher = Matcher(Vocab()) + matcher.add("TSTEND", [pattern]) + doc = Doc(Vocab(), words=string.split()) + matches = matcher(doc) + if start is None or end is None: + assert matches == [] + assert matches[-1][1] == start + assert matches[-1][2] == end + + +@pytest.mark.issue(1945) +def test_issue1945(): + """Test regression in Matcher introduced in v2.0.6.""" + matcher = Matcher(Vocab()) + matcher.add("MWE", [[{"orth": "a"}, {"orth": "a"}]]) + doc = Doc(matcher.vocab, words=["a", "a", "a"]) + matches = matcher(doc) # we should see two overlapping matches here + assert len(matches) == 2 + assert matches[0][1:] == (0, 2) + assert matches[1][1:] == (1, 3) + + +@pytest.mark.issue(1971) +def test_issue1971(en_vocab): + # Possibly related to #2675 and #2671? + matcher = Matcher(en_vocab) + pattern = [ + {"ORTH": "Doe"}, + {"ORTH": "!", "OP": "?"}, + {"_": {"optional": True}, "OP": "?"}, + {"ORTH": "!", "OP": "?"}, + ] + Token.set_extension("optional", default=False) + matcher.add("TEST", [pattern]) + doc = Doc(en_vocab, words=["Hello", "John", "Doe", "!"]) + # We could also assert length 1 here, but this is more conclusive, because + # the real problem here is that it returns a duplicate match for a match_id + # that's not actually in the vocab! + matches = matcher(doc) + assert all([match_id in en_vocab.strings for match_id, start, end in matches]) + + +@pytest.mark.issue(1971) +def test_issue_1971_2(en_vocab): + matcher = Matcher(en_vocab) + pattern1 = [{"ORTH": "EUR", "LOWER": {"IN": ["eur"]}}, {"LIKE_NUM": True}] + pattern2 = [{"LIKE_NUM": True}, {"ORTH": "EUR"}] # {"IN": ["EUR"]}}] + doc = Doc(en_vocab, words=["EUR", "10", "is", "10", "EUR"]) + matcher.add("TEST1", [pattern1, pattern2]) + matches = matcher(doc) + assert len(matches) == 2 + + +@pytest.mark.issue(1971) +def test_issue_1971_3(en_vocab): + """Test that pattern matches correctly for multiple extension attributes.""" + Token.set_extension("a", default=1, force=True) + Token.set_extension("b", default=2, force=True) + doc = Doc(en_vocab, words=["hello", "world"]) + matcher = Matcher(en_vocab) + matcher.add("A", [[{"_": {"a": 1}}]]) + matcher.add("B", [[{"_": {"b": 2}}]]) + matches = sorted((en_vocab.strings[m_id], s, e) for m_id, s, e in matcher(doc)) + assert len(matches) == 4 + assert matches == sorted([("A", 0, 1), ("A", 1, 2), ("B", 0, 1), ("B", 1, 2)]) + + +@pytest.mark.issue(1971) +def test_issue_1971_4(en_vocab): + """Test that pattern matches correctly with multiple extension attribute + values on a single token. + """ + Token.set_extension("ext_a", default="str_a", force=True) + Token.set_extension("ext_b", default="str_b", force=True) + matcher = Matcher(en_vocab) + doc = Doc(en_vocab, words=["this", "is", "text"]) + pattern = [{"_": {"ext_a": "str_a", "ext_b": "str_b"}}] * 3 + matcher.add("TEST", [pattern]) + matches = matcher(doc) + # Uncommenting this caused a segmentation fault + assert len(matches) == 1 + assert matches[0] == (en_vocab.strings["TEST"], 0, 3) + + +@pytest.mark.issue(2464) +def test_issue2464(en_vocab): + """Test problem with successive ?. This is the same bug, so putting it here.""" + matcher = Matcher(en_vocab) + doc = Doc(en_vocab, words=["a", "b"]) + matcher.add("4", [[{"OP": "?"}, {"OP": "?"}]]) + matches = matcher(doc) + assert len(matches) == 3 + + +@pytest.mark.issue(2569) +def test_issue2569(en_tokenizer): + """Test that operator + is greedy.""" + doc = en_tokenizer("It is May 15, 1993.") + doc.ents = [Span(doc, 2, 6, label=doc.vocab.strings["DATE"])] + matcher = Matcher(doc.vocab) + matcher.add("RULE", [[{"ENT_TYPE": "DATE", "OP": "+"}]]) + matched = [doc[start:end] for _, start, end in matcher(doc)] + matched = sorted(matched, key=len, reverse=True) + assert len(matched) == 10 + assert len(matched[0]) == 4 + assert matched[0].text == "May 15, 1993" + + +@pytest.mark.issue(2671) +def test_issue2671(): + """Ensure the correct entity ID is returned for matches with quantifiers. + See also #2675 + """ + nlp = English() + matcher = Matcher(nlp.vocab) + pattern_id = "test_pattern" + pattern = [ + {"LOWER": "high"}, + {"IS_PUNCT": True, "OP": "?"}, + {"LOWER": "adrenaline"}, + ] + matcher.add(pattern_id, [pattern]) + doc1 = nlp("This is a high-adrenaline situation.") + doc2 = nlp("This is a high adrenaline situation.") + matches1 = matcher(doc1) + for match_id, start, end in matches1: + assert nlp.vocab.strings[match_id] == pattern_id + matches2 = matcher(doc2) + for match_id, start, end in matches2: + assert nlp.vocab.strings[match_id] == pattern_id + + +@pytest.mark.issue(3009) +def test_issue3009(en_vocab): + """Test problem with matcher quantifiers""" + patterns = [ + [{"ORTH": "has"}, {"LOWER": "to"}, {"LOWER": "do"}, {"TAG": "IN"}], + [ + {"ORTH": "has"}, + {"IS_ASCII": True, "IS_PUNCT": False, "OP": "*"}, + {"LOWER": "to"}, + {"LOWER": "do"}, + {"TAG": "IN"}, + ], + [ + {"ORTH": "has"}, + {"IS_ASCII": True, "IS_PUNCT": False, "OP": "?"}, + {"LOWER": "to"}, + {"LOWER": "do"}, + {"TAG": "IN"}, + ], + ] + words = ["also", "has", "to", "do", "with"] + tags = ["RB", "VBZ", "TO", "VB", "IN"] + pos = ["ADV", "VERB", "ADP", "VERB", "ADP"] + doc = Doc(en_vocab, words=words, tags=tags, pos=pos) + matcher = Matcher(en_vocab) + for i, pattern in enumerate(patterns): + matcher.add(str(i), [pattern]) + matches = matcher(doc) + assert matches + + +@pytest.mark.issue(3328) +def test_issue3328(en_vocab): + doc = Doc(en_vocab, words=["Hello", ",", "how", "are", "you", "doing", "?"]) + matcher = Matcher(en_vocab) + patterns = [ + [{"LOWER": {"IN": ["hello", "how"]}}], + [{"LOWER": {"IN": ["you", "doing"]}}], + ] + matcher.add("TEST", patterns) + matches = matcher(doc) + assert len(matches) == 4 + matched_texts = [doc[start:end].text for _, start, end in matches] + assert matched_texts == ["Hello", "how", "you", "doing"] + + +@pytest.mark.issue(3549) +def test_issue3549(en_vocab): + """Test that match pattern validation doesn't raise on empty errors.""" + matcher = Matcher(en_vocab, validate=True) + pattern = [{"LOWER": "hello"}, {"LOWER": "world"}] + matcher.add("GOOD", [pattern]) + with pytest.raises(MatchPatternError): + matcher.add("BAD", [[{"X": "Y"}]]) + + +@pytest.mark.skip("Matching currently only works on strings and integers") +@pytest.mark.issue(3555) +def test_issue3555(en_vocab): + """Test that custom extensions with default None don't break matcher.""" + Token.set_extension("issue3555", default=None) + matcher = Matcher(en_vocab) + pattern = [{"ORTH": "have"}, {"_": {"issue3555": True}}] + matcher.add("TEST", [pattern]) + doc = Doc(en_vocab, words=["have", "apple"]) + matcher(doc) + + +@pytest.mark.issue(3839) +def test_issue3839(en_vocab): + """Test that match IDs returned by the matcher are correct, are in the string""" + doc = Doc(en_vocab, words=["terrific", "group", "of", "people"]) + matcher = Matcher(en_vocab) + match_id = "PATTERN" + pattern1 = [{"LOWER": "terrific"}, {"OP": "?"}, {"LOWER": "group"}] + pattern2 = [{"LOWER": "terrific"}, {"OP": "?"}, {"OP": "?"}, {"LOWER": "group"}] + matcher.add(match_id, [pattern1]) + matches = matcher(doc) + assert matches[0][0] == en_vocab.strings[match_id] + matcher = Matcher(en_vocab) + matcher.add(match_id, [pattern2]) + matches = matcher(doc) + assert matches[0][0] == en_vocab.strings[match_id] + + +@pytest.mark.issue(3879) +def test_issue3879(en_vocab): + doc = Doc(en_vocab, words=["This", "is", "a", "test", "."]) + assert len(doc) == 5 + pattern = [{"ORTH": "This", "OP": "?"}, {"OP": "?"}, {"ORTH": "test"}] + matcher = Matcher(en_vocab) + matcher.add("TEST", [pattern]) + assert len(matcher(doc)) == 2 # fails because of a FP match 'is a test' + + +@pytest.mark.issue(3951) +def test_issue3951(en_vocab): + """Test that combinations of optional rules are matched correctly.""" + matcher = Matcher(en_vocab) + pattern = [ + {"LOWER": "hello"}, + {"LOWER": "this", "OP": "?"}, + {"OP": "?"}, + {"LOWER": "world"}, + ] + matcher.add("TEST", [pattern]) + doc = Doc(en_vocab, words=["Hello", "my", "new", "world"]) + matches = matcher(doc) + assert len(matches) == 0 + + +@pytest.mark.issue(4120) +def test_issue4120(en_vocab): + """Test that matches without a final {OP: ?} token are returned.""" + matcher = Matcher(en_vocab) + matcher.add("TEST", [[{"ORTH": "a"}, {"OP": "?"}]]) + doc1 = Doc(en_vocab, words=["a"]) + assert len(matcher(doc1)) == 1 # works + doc2 = Doc(en_vocab, words=["a", "b", "c"]) + assert len(matcher(doc2)) == 2 # fixed + matcher = Matcher(en_vocab) + matcher.add("TEST", [[{"ORTH": "a"}, {"OP": "?"}, {"ORTH": "b"}]]) + doc3 = Doc(en_vocab, words=["a", "b", "b", "c"]) + assert len(matcher(doc3)) == 2 # works + matcher = Matcher(en_vocab) + matcher.add("TEST", [[{"ORTH": "a"}, {"OP": "?"}, {"ORTH": "b", "OP": "?"}]]) + doc4 = Doc(en_vocab, words=["a", "b", "b", "c"]) + assert len(matcher(doc4)) == 3 # fixed + + +@pytest.mark.parametrize( + "pattern,re_pattern", + [ + (pattern1, re_pattern1), + (pattern2, re_pattern2), + (pattern3, re_pattern3), + (pattern4, re_pattern4), + (pattern5, re_pattern5), + ], +) +def test_greedy_matching_first(doc, text, pattern, re_pattern): + """Test that the greedy matching behavior "FIRST" is consistent with + other re implementations.""" + matcher = Matcher(doc.vocab) + matcher.add(re_pattern, [pattern], greedy="FIRST") + matches = matcher(doc) + re_matches = [m.span() for m in re.finditer(re_pattern, text)] + for (key, m_s, m_e), (re_s, re_e) in zip(matches, re_matches): + # matching the string, not the exact position + assert doc[m_s:m_e].text == doc[re_s:re_e].text + + +@pytest.mark.parametrize( + "pattern,longest", + [ + (pattern1, longest1), + (pattern2, longest2), + (pattern3, longest3), + (pattern4, longest4), + (pattern5, longest5), + ], +) +def test_greedy_matching_longest(doc, text, pattern, longest): + """Test the "LONGEST" greedy matching behavior""" + matcher = Matcher(doc.vocab) + matcher.add("RULE", [pattern], greedy="LONGEST") + matches = matcher(doc) + for key, s, e in matches: + assert doc[s:e].text == longest + + +def test_greedy_matching_longest_first(en_tokenizer): + """Test that "LONGEST" matching prefers the first of two equally long matches""" + doc = en_tokenizer(" ".join("CCC")) + matcher = Matcher(doc.vocab) + pattern = [{"ORTH": "C"}, {"ORTH": "C"}] + matcher.add("RULE", [pattern], greedy="LONGEST") + matches = matcher(doc) + # out of 0-2 and 1-3, the first should be picked + assert len(matches) == 1 + assert matches[0][1] == 0 + assert matches[0][2] == 2 + + +def test_invalid_greediness(doc, text): + matcher = Matcher(doc.vocab) + with pytest.raises(ValueError): + matcher.add("RULE", [pattern1], greedy="GREEDY") + + +@pytest.mark.parametrize( + "pattern,re_pattern", + [ + (pattern1, re_pattern1), + (pattern2, re_pattern2), + (pattern3, re_pattern3), + (pattern4, re_pattern4), + (pattern5, re_pattern5), + ], +) +def test_match_consuming(doc, text, pattern, re_pattern): + """Test that matcher.__call__ consumes tokens on a match similar to + re.findall.""" + matcher = Matcher(doc.vocab) + matcher.add(re_pattern, [pattern], greedy="FIRST") + matches = matcher(doc) + re_matches = [m.span() for m in re.finditer(re_pattern, text)] + assert len(matches) == len(re_matches) + + +def test_operator_combos(en_vocab): + cases = [ + ("aaab", "a a a b", True), + ("aaab", "a+ b", True), + ("aaab", "a+ a+ b", True), + ("aaab", "a+ a+ a b", True), + ("aaab", "a+ a+ a+ b", True), + ("aaab", "a+ a a b", True), + ("aaab", "a+ a a", True), + ("aaab", "a+", True), + ("aaa", "a+ b", False), + ("aaa", "a+ a+ b", False), + ("aaa", "a+ a+ a+ b", False), + ("aaa", "a+ a b", False), + ("aaa", "a+ a a b", False), + ("aaab", "a+ a a", True), + ("aaab", "a+", True), + ("aaab", "a+ a b", True), + ] + for string, pattern_str, result in cases: + matcher = Matcher(en_vocab) + doc = Doc(matcher.vocab, words=list(string)) + pattern = [] + for part in pattern_str.split(): + if part.endswith("+"): + pattern.append({"ORTH": part[0], "OP": "+"}) + else: + pattern.append({"ORTH": part}) + matcher.add("PATTERN", [pattern]) + matches = matcher(doc) + if result: + assert matches, (string, pattern_str) + else: + assert not matches, (string, pattern_str) + + +@pytest.mark.issue(1450) +def test_matcher_end_zero_plus(en_vocab): + """Test matcher works when patterns end with * operator. (issue 1450)""" + matcher = Matcher(en_vocab) + pattern = [{"ORTH": "a"}, {"ORTH": "b", "OP": "*"}] + matcher.add("TSTEND", [pattern]) + nlp = lambda string: Doc(matcher.vocab, words=string.split()) + assert len(matcher(nlp("a"))) == 1 + assert len(matcher(nlp("a b"))) == 2 + assert len(matcher(nlp("a c"))) == 1 + assert len(matcher(nlp("a b c"))) == 2 + assert len(matcher(nlp("a b b c"))) == 3 + assert len(matcher(nlp("a b b"))) == 3 + + +def test_matcher_sets_return_correct_tokens(en_vocab): + matcher = Matcher(en_vocab) + patterns = [ + [{"LOWER": {"IN": ["zero"]}}], + [{"LOWER": {"IN": ["one"]}}], + [{"LOWER": {"IN": ["two"]}}], + ] + matcher.add("TEST", patterns) + doc = Doc(en_vocab, words="zero one two three".split()) + matches = matcher(doc) + texts = [Span(doc, s, e, label=L).text for L, s, e in matches] + assert texts == ["zero", "one", "two"] + + +@pytest.mark.filterwarnings("ignore:\\[W036") +def test_matcher_remove(): + nlp = English() + matcher = Matcher(nlp.vocab) + text = "This is a test case." + + pattern = [{"ORTH": "test"}, {"OP": "?"}] + assert len(matcher) == 0 + matcher.add("Rule", [pattern]) + assert "Rule" in matcher + + # should give two matches + results1 = matcher(nlp(text)) + assert len(results1) == 2 + + # removing once should work + matcher.remove("Rule") + + # should not return any maches anymore + results2 = matcher(nlp(text)) + assert len(results2) == 0 + + # removing again should throw an error + with pytest.raises(ValueError): + matcher.remove("Rule") + + +def test_matcher_with_alignments_greedy_longest(en_vocab): + cases = [ + ("aaab", "a* b", [0, 0, 0, 1]), + ("baab", "b a* b", [0, 1, 1, 2]), + ("aaab", "a a a b", [0, 1, 2, 3]), + ("aaab", "a+ b", [0, 0, 0, 1]), + ("aaba", "a+ b a+", [0, 0, 1, 2]), + ("aabaa", "a+ b a+", [0, 0, 1, 2, 2]), + ("aaba", "a+ b a*", [0, 0, 1, 2]), + ("aaaa", "a*", [0, 0, 0, 0]), + ("baab", "b a* b b*", [0, 1, 1, 2]), + ("aabb", "a* b* a*", [0, 0, 1, 1]), + ("aaab", "a+ a+ a b", [0, 1, 2, 3]), + ("aaab", "a+ a+ a+ b", [0, 1, 2, 3]), + ("aaab", "a+ a a b", [0, 1, 2, 3]), + ("aaab", "a+ a a", [0, 1, 2]), + ("aaab", "a+ a a?", [0, 1, 2]), + ("aaaa", "a a a a a?", [0, 1, 2, 3]), + ("aaab", "a+ a b", [0, 0, 1, 2]), + ("aaab", "a+ a+ b", [0, 0, 1, 2]), + ("aaab", "a{2,} b", [0, 0, 0, 1]), + ("aaab", "a{,3} b", [0, 0, 0, 1]), + ("aaab", "a{2} b", [0, 0, 1]), + ("aaab", "a{2,3} b", [0, 0, 0, 1]), + ] + for string, pattern_str, result in cases: + matcher = Matcher(en_vocab) + doc = Doc(matcher.vocab, words=list(string)) + pattern = [] + for part in pattern_str.split(): + if part.endswith("+"): + pattern.append({"ORTH": part[0], "OP": "+"}) + elif part.endswith("*"): + pattern.append({"ORTH": part[0], "OP": "*"}) + elif part.endswith("?"): + pattern.append({"ORTH": part[0], "OP": "?"}) + elif part.endswith("}"): + pattern.append({"ORTH": part[0], "OP": part[1:]}) + else: + pattern.append({"ORTH": part}) + matcher.add("PATTERN", [pattern], greedy="LONGEST") + matches = matcher(doc, with_alignments=True) + n_matches = len(matches) + + _, s, e, expected = matches[0] + + assert expected == result, (string, pattern_str, s, e, n_matches) + + +def test_matcher_with_alignments_non_greedy(en_vocab): + cases = [ + (0, "aaab", "a* b", [[0, 1], [0, 0, 1], [0, 0, 0, 1], [1]]), + (1, "baab", "b a* b", [[0, 1, 1, 2]]), + (2, "aaab", "a a a b", [[0, 1, 2, 3]]), + (3, "aaab", "a+ b", [[0, 1], [0, 0, 1], [0, 0, 0, 1]]), + (4, "aaba", "a+ b a+", [[0, 1, 2], [0, 0, 1, 2]]), + ( + 5, + "aabaa", + "a+ b a+", + [[0, 1, 2], [0, 0, 1, 2], [0, 0, 1, 2, 2], [0, 1, 2, 2]], + ), + (6, "aaba", "a+ b a*", [[0, 1], [0, 0, 1], [0, 0, 1, 2], [0, 1, 2]]), + (7, "aaaa", "a*", [[0], [0, 0], [0, 0, 0], [0, 0, 0, 0]]), + (8, "baab", "b a* b b*", [[0, 1, 1, 2]]), + ( + 9, + "aabb", + "a* b* a*", + [[1], [2], [2, 2], [0, 1], [0, 0, 1], [0, 0, 1, 1], [0, 1, 1], [1, 1]], + ), + (10, "aaab", "a+ a+ a b", [[0, 1, 2, 3]]), + (11, "aaab", "a+ a+ a+ b", [[0, 1, 2, 3]]), + (12, "aaab", "a+ a a b", [[0, 1, 2, 3]]), + (13, "aaab", "a+ a a", [[0, 1, 2]]), + (14, "aaab", "a+ a a?", [[0, 1], [0, 1, 2]]), + (15, "aaaa", "a a a a a?", [[0, 1, 2, 3]]), + (16, "aaab", "a+ a b", [[0, 1, 2], [0, 0, 1, 2]]), + (17, "aaab", "a+ a+ b", [[0, 1, 2], [0, 0, 1, 2]]), + (18, "aaab", "a{2,} b", [[0, 0, 1], [0, 0, 0, 1]]), + (19, "aaab", "a{3} b", [[0, 0, 0, 1]]), + (20, "aaab", "a{2} b", [[0, 0, 1]]), + (21, "aaab", "a{2,3} b", [[0, 0, 1], [0, 0, 0, 1]]), + ] + for case_id, string, pattern_str, results in cases: + matcher = Matcher(en_vocab) + doc = Doc(matcher.vocab, words=list(string)) + pattern = [] + for part in pattern_str.split(): + if part.endswith("+"): + pattern.append({"ORTH": part[0], "OP": "+"}) + elif part.endswith("*"): + pattern.append({"ORTH": part[0], "OP": "*"}) + elif part.endswith("?"): + pattern.append({"ORTH": part[0], "OP": "?"}) + elif part.endswith("}"): + pattern.append({"ORTH": part[0], "OP": part[1:]}) + else: + pattern.append({"ORTH": part}) + + matcher.add("PATTERN", [pattern]) + matches = matcher(doc, with_alignments=True) + n_matches = len(matches) + + for _, s, e, expected in matches: + assert expected in results, (case_id, string, pattern_str, s, e, n_matches) + assert len(expected) == e - s diff --git a/TTS/Kokoro/.venv/Lib/site-packages/spacy/tests/matcher/test_pattern_validation.py b/TTS/Kokoro/.venv/Lib/site-packages/spacy/tests/matcher/test_pattern_validation.py new file mode 100644 index 0000000000000000000000000000000000000000..a160d6c13d27e7d3f6f437b159adf7cb4817ac37 --- /dev/null +++ b/TTS/Kokoro/.venv/Lib/site-packages/spacy/tests/matcher/test_pattern_validation.py @@ -0,0 +1,86 @@ +import pytest + +from spacy.errors import MatchPatternError +from spacy.matcher import Matcher +from spacy.schemas import validate_token_pattern + +# (pattern, num errors with validation, num errors identified with minimal +# checks) +TEST_PATTERNS = [ + # Bad patterns flagged in all cases + ([{"XX": "foo"}], 1, 1), + ([{"IS_ALPHA": {"==": True}}, {"LIKE_NUM": None}], 2, 1), + ([{"IS_PUNCT": True, "OP": "$"}], 1, 1), + ([{"_": "foo"}], 1, 1), + ('[{"TEXT": "foo"}, {"LOWER": "bar"}]', 1, 1), + ([{"ENT_IOB": "foo"}], 1, 1), + ([1, 2, 3], 3, 1), + ([{"TEXT": "foo", "OP": "{,}"}], 1, 1), + ([{"TEXT": "foo", "OP": "{,4}4"}], 1, 1), + ([{"TEXT": "foo", "OP": "{a,3}"}], 1, 1), + ([{"TEXT": "foo", "OP": "{a}"}], 1, 1), + ([{"TEXT": "foo", "OP": "{,a}"}], 1, 1), + ([{"TEXT": "foo", "OP": "{1,2,3}"}], 1, 1), + ([{"TEXT": "foo", "OP": "{1, 3}"}], 1, 1), + ([{"TEXT": "foo", "OP": "{-2}"}], 1, 1), + # Bad patterns flagged outside of Matcher + ([{"_": {"foo": "bar", "baz": {"IN": "foo"}}}], 2, 0), # prev: (1, 0) + # Bad patterns not flagged with minimal checks + ([{"LENGTH": "2", "TEXT": 2}, {"LOWER": "test"}], 2, 0), + ([{"LENGTH": {"IN": [1, 2, "3"]}}, {"POS": {"IN": "VERB"}}], 4, 0), # prev: (2, 0) + ([{"LENGTH": {"VALUE": 5}}], 2, 0), # prev: (1, 0) + ([{"TEXT": {"VALUE": "foo"}}], 2, 0), # prev: (1, 0) + ([{"IS_DIGIT": -1}], 1, 0), + ([{"ORTH": -1}], 1, 0), + ([{"ENT_ID": -1}], 1, 0), + ([{"ENT_KB_ID": -1}], 1, 0), + # Good patterns + ([{"TEXT": "foo"}, {"LOWER": "bar"}], 0, 0), + ([{"LEMMA": {"IN": ["love", "like"]}}, {"POS": "DET", "OP": "?"}], 0, 0), + ([{"LIKE_NUM": True, "LENGTH": {">=": 5}}], 0, 0), + ([{"LENGTH": 2}], 0, 0), + ([{"LOWER": {"REGEX": "^X", "NOT_IN": ["XXX", "XY"]}}], 0, 0), + ([{"NORM": "a"}, {"POS": {"IN": ["NOUN"]}}], 0, 0), + ([{"_": {"foo": {"NOT_IN": ["bar", "baz"]}, "a": 5, "b": {">": 10}}}], 0, 0), + ([{"orth": "foo"}], 0, 0), # prev: xfail + ([{"IS_SENT_START": True}], 0, 0), + ([{"SENT_START": True}], 0, 0), + ([{"ENT_ID": "STRING"}], 0, 0), + ([{"ENT_KB_ID": "STRING"}], 0, 0), + ([{"TEXT": "ha", "OP": "{3}"}], 0, 0), +] + + +@pytest.mark.parametrize( + "pattern", + [[{"XX": "y"}], [{"LENGTH": "2"}], [{"TEXT": {"IN": 5}}], [{"text": {"in": 6}}]], +) +def test_matcher_pattern_validation(en_vocab, pattern): + matcher = Matcher(en_vocab, validate=True) + with pytest.raises(MatchPatternError): + matcher.add("TEST", [pattern]) + + +@pytest.mark.parametrize("pattern,n_errors,_", TEST_PATTERNS) +def test_pattern_validation(pattern, n_errors, _): + errors = validate_token_pattern(pattern) + assert len(errors) == n_errors + + +@pytest.mark.parametrize("pattern,n_errors,n_min_errors", TEST_PATTERNS) +def test_minimal_pattern_validation(en_vocab, pattern, n_errors, n_min_errors): + matcher = Matcher(en_vocab) + if n_min_errors > 0: + with pytest.raises(ValueError): + matcher.add("TEST", [pattern]) + elif n_errors == 0: + matcher.add("TEST", [pattern]) + + +def test_pattern_errors(en_vocab): + matcher = Matcher(en_vocab) + # normalize "regex" to upper like "text" + matcher.add("TEST1", [[{"text": {"regex": "regex"}}]]) + # error if subpattern attribute isn't recognized and processed + with pytest.raises(MatchPatternError): + matcher.add("TEST2", [[{"TEXT": {"XX": "xx"}}]]) diff --git a/TTS/Kokoro/.venv/Lib/site-packages/spacy/tests/matcher/test_phrase_matcher.py b/TTS/Kokoro/.venv/Lib/site-packages/spacy/tests/matcher/test_phrase_matcher.py new file mode 100644 index 0000000000000000000000000000000000000000..fd096fecaa9d81f63831e513ee604d2cff023504 --- /dev/null +++ b/TTS/Kokoro/.venv/Lib/site-packages/spacy/tests/matcher/test_phrase_matcher.py @@ -0,0 +1,509 @@ +import warnings + +import pytest +import srsly +from mock import Mock + +from spacy.lang.en import English +from spacy.matcher import Matcher, PhraseMatcher +from spacy.tokens import Doc, Span +from spacy.vocab import Vocab + +from ..util import make_tempdir + + +@pytest.mark.issue(3248) +def test_issue3248_1(): + """Test that the PhraseMatcher correctly reports its number of rules, not + total number of patterns.""" + nlp = English() + matcher = PhraseMatcher(nlp.vocab) + matcher.add("TEST1", [nlp("a"), nlp("b"), nlp("c")]) + matcher.add("TEST2", [nlp("d")]) + assert len(matcher) == 2 + + +@pytest.mark.issue(3331) +def test_issue3331(en_vocab): + """Test that duplicate patterns for different rules result in multiple + matches, one per rule. + """ + matcher = PhraseMatcher(en_vocab) + matcher.add("A", [Doc(en_vocab, words=["Barack", "Obama"])]) + matcher.add("B", [Doc(en_vocab, words=["Barack", "Obama"])]) + doc = Doc(en_vocab, words=["Barack", "Obama", "lifts", "America"]) + matches = matcher(doc) + assert len(matches) == 2 + match_ids = [en_vocab.strings[matches[0][0]], en_vocab.strings[matches[1][0]]] + assert sorted(match_ids) == ["A", "B"] + + +@pytest.mark.issue(3972) +def test_issue3972(en_vocab): + """Test that the PhraseMatcher returns duplicates for duplicate match IDs.""" + matcher = PhraseMatcher(en_vocab) + matcher.add("A", [Doc(en_vocab, words=["New", "York"])]) + matcher.add("B", [Doc(en_vocab, words=["New", "York"])]) + doc = Doc(en_vocab, words=["I", "live", "in", "New", "York"]) + matches = matcher(doc) + + assert len(matches) == 2 + + # We should have a match for each of the two rules + found_ids = [en_vocab.strings[ent_id] for (ent_id, _, _) in matches] + assert "A" in found_ids + assert "B" in found_ids + + +@pytest.mark.issue(4002) +def test_issue4002(en_vocab): + """Test that the PhraseMatcher can match on overwritten NORM attributes.""" + matcher = PhraseMatcher(en_vocab, attr="NORM") + pattern1 = Doc(en_vocab, words=["c", "d"]) + assert [t.norm_ for t in pattern1] == ["c", "d"] + matcher.add("TEST", [pattern1]) + doc = Doc(en_vocab, words=["a", "b", "c", "d"]) + assert [t.norm_ for t in doc] == ["a", "b", "c", "d"] + matches = matcher(doc) + assert len(matches) == 1 + matcher = PhraseMatcher(en_vocab, attr="NORM") + pattern2 = Doc(en_vocab, words=["1", "2"]) + pattern2[0].norm_ = "c" + pattern2[1].norm_ = "d" + assert [t.norm_ for t in pattern2] == ["c", "d"] + matcher.add("TEST", [pattern2]) + matches = matcher(doc) + assert len(matches) == 1 + + +@pytest.mark.issue(4373) +def test_issue4373(): + """Test that PhraseMatcher.vocab can be accessed (like Matcher.vocab).""" + matcher = Matcher(Vocab()) + assert isinstance(matcher.vocab, Vocab) + matcher = PhraseMatcher(Vocab()) + assert isinstance(matcher.vocab, Vocab) + + +@pytest.mark.issue(4651) +def test_issue4651_with_phrase_matcher_attr(): + """Test that the EntityRuler PhraseMatcher is deserialized correctly using + the method from_disk when the EntityRuler argument phrase_matcher_attr is + specified. + """ + text = "Spacy is a python library for nlp" + nlp = English() + patterns = [{"label": "PYTHON_LIB", "pattern": "spacy", "id": "spaCy"}] + ruler = nlp.add_pipe("entity_ruler", config={"phrase_matcher_attr": "LOWER"}) + ruler.add_patterns(patterns) + doc = nlp(text) + res = [(ent.text, ent.label_, ent.ent_id_) for ent in doc.ents] + nlp_reloaded = English() + with make_tempdir() as d: + file_path = d / "entityruler" + ruler.to_disk(file_path) + nlp_reloaded.add_pipe("entity_ruler").from_disk(file_path) + doc_reloaded = nlp_reloaded(text) + res_reloaded = [(ent.text, ent.label_, ent.ent_id_) for ent in doc_reloaded.ents] + assert res == res_reloaded + + +@pytest.mark.issue(6839) +def test_issue6839(en_vocab): + """Ensure that PhraseMatcher accepts Span as input""" + # fmt: off + words = ["I", "like", "Spans", "and", "Docs", "in", "my", "input", ",", "and", "nothing", "else", "."] + # fmt: on + doc = Doc(en_vocab, words=words) + span = doc[:8] + pattern = Doc(en_vocab, words=["Spans", "and", "Docs"]) + matcher = PhraseMatcher(en_vocab) + matcher.add("SPACY", [pattern]) + matches = matcher(span) + assert matches + + +@pytest.mark.issue(10643) +def test_issue10643(en_vocab): + """Ensure overlapping terms can be removed from PhraseMatcher""" + + # fmt: off + words = ["Only", "save", "out", "the", "binary", "data", "for", "the", "individual", "components", "."] + # fmt: on + doc = Doc(en_vocab, words=words) + terms = { + "0": Doc(en_vocab, words=["binary"]), + "1": Doc(en_vocab, words=["binary", "data"]), + } + matcher = PhraseMatcher(en_vocab) + for match_id, term in terms.items(): + matcher.add(match_id, [term]) + + matches = matcher(doc) + assert matches == [(en_vocab.strings["0"], 4, 5), (en_vocab.strings["1"], 4, 6)] + + matcher.remove("0") + assert len(matcher) == 1 + new_matches = matcher(doc) + assert new_matches == [(en_vocab.strings["1"], 4, 6)] + + matcher.remove("1") + assert len(matcher) == 0 + no_matches = matcher(doc) + assert not no_matches + + +def test_matcher_phrase_matcher(en_vocab): + doc = Doc(en_vocab, words=["I", "like", "Google", "Now", "best"]) + # intermediate phrase + pattern = Doc(en_vocab, words=["Google", "Now"]) + matcher = PhraseMatcher(en_vocab) + matcher.add("COMPANY", [pattern]) + assert len(matcher(doc)) == 1 + # initial token + pattern = Doc(en_vocab, words=["I"]) + matcher = PhraseMatcher(en_vocab) + matcher.add("I", [pattern]) + assert len(matcher(doc)) == 1 + # initial phrase + pattern = Doc(en_vocab, words=["I", "like"]) + matcher = PhraseMatcher(en_vocab) + matcher.add("ILIKE", [pattern]) + assert len(matcher(doc)) == 1 + # final token + pattern = Doc(en_vocab, words=["best"]) + matcher = PhraseMatcher(en_vocab) + matcher.add("BEST", [pattern]) + assert len(matcher(doc)) == 1 + # final phrase + pattern = Doc(en_vocab, words=["Now", "best"]) + matcher = PhraseMatcher(en_vocab) + matcher.add("NOWBEST", [pattern]) + assert len(matcher(doc)) == 1 + + +def test_phrase_matcher_length(en_vocab): + matcher = PhraseMatcher(en_vocab) + assert len(matcher) == 0 + matcher.add("TEST", [Doc(en_vocab, words=["test"])]) + assert len(matcher) == 1 + matcher.add("TEST2", [Doc(en_vocab, words=["test2"])]) + assert len(matcher) == 2 + + +def test_phrase_matcher_contains(en_vocab): + matcher = PhraseMatcher(en_vocab) + matcher.add("TEST", [Doc(en_vocab, words=["test"])]) + assert "TEST" in matcher + assert "TEST2" not in matcher + + +def test_phrase_matcher_add_new_api(en_vocab): + doc = Doc(en_vocab, words=["a", "b"]) + patterns = [Doc(en_vocab, words=["a"]), Doc(en_vocab, words=["a", "b"])] + matcher = PhraseMatcher(en_vocab) + matcher.add("OLD_API", None, *patterns) + assert len(matcher(doc)) == 2 + matcher = PhraseMatcher(en_vocab) + on_match = Mock() + matcher.add("OLD_API_CALLBACK", on_match, *patterns) + assert len(matcher(doc)) == 2 + assert on_match.call_count == 2 + # New API: add(key: str, patterns: List[List[dict]], on_match: Callable) + matcher = PhraseMatcher(en_vocab) + matcher.add("NEW_API", patterns) + assert len(matcher(doc)) == 2 + matcher = PhraseMatcher(en_vocab) + on_match = Mock() + matcher.add("NEW_API_CALLBACK", patterns, on_match=on_match) + assert len(matcher(doc)) == 2 + assert on_match.call_count == 2 + + +def test_phrase_matcher_repeated_add(en_vocab): + matcher = PhraseMatcher(en_vocab) + # match ID only gets added once + matcher.add("TEST", [Doc(en_vocab, words=["like"])]) + matcher.add("TEST", [Doc(en_vocab, words=["like"])]) + matcher.add("TEST", [Doc(en_vocab, words=["like"])]) + matcher.add("TEST", [Doc(en_vocab, words=["like"])]) + doc = Doc(en_vocab, words=["I", "like", "Google", "Now", "best"]) + assert "TEST" in matcher + assert "TEST2" not in matcher + assert len(matcher(doc)) == 1 + + +def test_phrase_matcher_remove(en_vocab): + matcher = PhraseMatcher(en_vocab) + matcher.add("TEST1", [Doc(en_vocab, words=["like"])]) + matcher.add("TEST2", [Doc(en_vocab, words=["best"])]) + doc = Doc(en_vocab, words=["I", "like", "Google", "Now", "best"]) + assert "TEST1" in matcher + assert "TEST2" in matcher + assert "TEST3" not in matcher + assert len(matcher(doc)) == 2 + matcher.remove("TEST1") + assert "TEST1" not in matcher + assert "TEST2" in matcher + assert "TEST3" not in matcher + assert len(matcher(doc)) == 1 + matcher.remove("TEST2") + assert "TEST1" not in matcher + assert "TEST2" not in matcher + assert "TEST3" not in matcher + assert len(matcher(doc)) == 0 + with pytest.raises(KeyError): + matcher.remove("TEST3") + assert "TEST1" not in matcher + assert "TEST2" not in matcher + assert "TEST3" not in matcher + assert len(matcher(doc)) == 0 + + +def test_phrase_matcher_overlapping_with_remove(en_vocab): + matcher = PhraseMatcher(en_vocab) + matcher.add("TEST", [Doc(en_vocab, words=["like"])]) + # TEST2 is added alongside TEST + matcher.add("TEST2", [Doc(en_vocab, words=["like"])]) + doc = Doc(en_vocab, words=["I", "like", "Google", "Now", "best"]) + assert "TEST" in matcher + assert len(matcher) == 2 + assert len(matcher(doc)) == 2 + # removing TEST does not remove the entry for TEST2 + matcher.remove("TEST") + assert "TEST" not in matcher + assert len(matcher) == 1 + assert len(matcher(doc)) == 1 + assert matcher(doc)[0][0] == en_vocab.strings["TEST2"] + # removing TEST2 removes all + matcher.remove("TEST2") + assert "TEST2" not in matcher + assert len(matcher) == 0 + assert len(matcher(doc)) == 0 + + +def test_phrase_matcher_string_attrs(en_vocab): + words1 = ["I", "like", "cats"] + pos1 = ["PRON", "VERB", "NOUN"] + words2 = ["Yes", ",", "you", "hate", "dogs", "very", "much"] + pos2 = ["INTJ", "PUNCT", "PRON", "VERB", "NOUN", "ADV", "ADV"] + pattern = Doc(en_vocab, words=words1, pos=pos1) + matcher = PhraseMatcher(en_vocab, attr="POS") + matcher.add("TEST", [pattern]) + doc = Doc(en_vocab, words=words2, pos=pos2) + matches = matcher(doc) + assert len(matches) == 1 + match_id, start, end = matches[0] + assert match_id == en_vocab.strings["TEST"] + assert start == 2 + assert end == 5 + + +def test_phrase_matcher_string_attrs_negative(en_vocab): + """Test that token with the control codes as ORTH are *not* matched.""" + words1 = ["I", "like", "cats"] + pos1 = ["PRON", "VERB", "NOUN"] + words2 = ["matcher:POS-PRON", "matcher:POS-VERB", "matcher:POS-NOUN"] + pos2 = ["X", "X", "X"] + pattern = Doc(en_vocab, words=words1, pos=pos1) + matcher = PhraseMatcher(en_vocab, attr="POS") + matcher.add("TEST", [pattern]) + doc = Doc(en_vocab, words=words2, pos=pos2) + matches = matcher(doc) + assert len(matches) == 0 + + +def test_phrase_matcher_bool_attrs(en_vocab): + words1 = ["Hello", "world", "!"] + words2 = ["No", "problem", ",", "he", "said", "."] + pattern = Doc(en_vocab, words=words1) + matcher = PhraseMatcher(en_vocab, attr="IS_PUNCT") + matcher.add("TEST", [pattern]) + doc = Doc(en_vocab, words=words2) + matches = matcher(doc) + assert len(matches) == 2 + match_id1, start1, end1 = matches[0] + match_id2, start2, end2 = matches[1] + assert match_id1 == en_vocab.strings["TEST"] + assert match_id2 == en_vocab.strings["TEST"] + assert start1 == 0 + assert end1 == 3 + assert start2 == 3 + assert end2 == 6 + + +def test_phrase_matcher_validation(en_vocab): + doc1 = Doc(en_vocab, words=["Test"]) + doc1[0].dep_ = "ROOT" + doc2 = Doc(en_vocab, words=["Test"]) + doc2[0].tag_ = "TAG" + doc2[0].pos_ = "X" + doc2[0].set_morph("Feat=Val") + doc3 = Doc(en_vocab, words=["Test"]) + matcher = PhraseMatcher(en_vocab, validate=True) + with pytest.warns(UserWarning): + matcher.add("TEST1", [doc1]) + with pytest.warns(UserWarning): + matcher.add("TEST2", [doc2]) + with warnings.catch_warnings(): + warnings.simplefilter("error") + matcher.add("TEST3", [doc3]) + matcher = PhraseMatcher(en_vocab, attr="POS", validate=True) + with warnings.catch_warnings(): + warnings.simplefilter("error") + matcher.add("TEST4", [doc2]) + + +def test_attr_validation(en_vocab): + with pytest.raises(ValueError): + PhraseMatcher(en_vocab, attr="UNSUPPORTED") + + +def test_attr_pipeline_checks(en_vocab): + doc1 = Doc(en_vocab, words=["Test"]) + doc1[0].dep_ = "ROOT" + doc2 = Doc(en_vocab, words=["Test"]) + doc2[0].tag_ = "TAG" + doc2[0].pos_ = "X" + doc2[0].set_morph("Feat=Val") + doc2[0].lemma_ = "LEMMA" + doc3 = Doc(en_vocab, words=["Test"]) + # DEP requires DEP + matcher = PhraseMatcher(en_vocab, attr="DEP") + matcher.add("TEST1", [doc1]) + with pytest.raises(ValueError): + matcher.add("TEST2", [doc2]) + with pytest.raises(ValueError): + matcher.add("TEST3", [doc3]) + # TAG, POS, LEMMA require those values + for attr in ("TAG", "POS", "LEMMA"): + matcher = PhraseMatcher(en_vocab, attr=attr) + matcher.add("TEST2", [doc2]) + with pytest.raises(ValueError): + matcher.add("TEST1", [doc1]) + with pytest.raises(ValueError): + matcher.add("TEST3", [doc3]) + # TEXT/ORTH only require tokens + matcher = PhraseMatcher(en_vocab, attr="ORTH") + matcher.add("TEST3", [doc3]) + matcher = PhraseMatcher(en_vocab, attr="TEXT") + matcher.add("TEST3", [doc3]) + + +def test_phrase_matcher_callback(en_vocab): + mock = Mock() + doc = Doc(en_vocab, words=["I", "like", "Google", "Now", "best"]) + pattern = Doc(en_vocab, words=["Google", "Now"]) + matcher = PhraseMatcher(en_vocab) + matcher.add("COMPANY", [pattern], on_match=mock) + matches = matcher(doc) + mock.assert_called_once_with(matcher, doc, 0, matches) + + +def test_phrase_matcher_remove_overlapping_patterns(en_vocab): + matcher = PhraseMatcher(en_vocab) + pattern1 = Doc(en_vocab, words=["this"]) + pattern2 = Doc(en_vocab, words=["this", "is"]) + pattern3 = Doc(en_vocab, words=["this", "is", "a"]) + pattern4 = Doc(en_vocab, words=["this", "is", "a", "word"]) + matcher.add("THIS", [pattern1, pattern2, pattern3, pattern4]) + matcher.remove("THIS") + + +def test_phrase_matcher_basic_check(en_vocab): + matcher = PhraseMatcher(en_vocab) + # Potential mistake: pass in pattern instead of list of patterns + pattern = Doc(en_vocab, words=["hello", "world"]) + with pytest.raises(ValueError): + matcher.add("TEST", pattern) + + +def test_phrase_matcher_pickle(en_vocab): + matcher = PhraseMatcher(en_vocab) + mock = Mock() + matcher.add("TEST", [Doc(en_vocab, words=["test"])]) + matcher.add("TEST2", [Doc(en_vocab, words=["test2"])], on_match=mock) + doc = Doc(en_vocab, words=["these", "are", "tests", ":", "test", "test2"]) + assert len(matcher) == 2 + + b = srsly.pickle_dumps(matcher) + matcher_unpickled = srsly.pickle_loads(b) + + # call after pickling to avoid recursion error related to mock + matches = matcher(doc) + matches_unpickled = matcher_unpickled(doc) + + assert len(matcher) == len(matcher_unpickled) + assert matches == matches_unpickled + + # clunky way to vaguely check that callback is unpickled + (vocab, docs, callbacks, attr) = matcher_unpickled.__reduce__()[1] + assert isinstance(callbacks.get("TEST2"), Mock) + + +def test_phrase_matcher_as_spans(en_vocab): + """Test the new as_spans=True API.""" + matcher = PhraseMatcher(en_vocab) + matcher.add("A", [Doc(en_vocab, words=["hello", "world"])]) + matcher.add("B", [Doc(en_vocab, words=["test"])]) + doc = Doc(en_vocab, words=["...", "hello", "world", "this", "is", "a", "test"]) + matches = matcher(doc, as_spans=True) + assert len(matches) == 2 + assert isinstance(matches[0], Span) + assert matches[0].text == "hello world" + assert matches[0].label_ == "A" + assert isinstance(matches[1], Span) + assert matches[1].text == "test" + assert matches[1].label_ == "B" + + +def test_phrase_matcher_deprecated(en_vocab): + matcher = PhraseMatcher(en_vocab) + matcher.add("TEST", [Doc(en_vocab, words=["helllo"])]) + doc = Doc(en_vocab, words=["hello", "world"]) + with pytest.warns(DeprecationWarning) as record: + for _ in matcher.pipe([doc]): + pass + assert record.list + assert "spaCy v3.0" in str(record.list[0].message) + + +@pytest.mark.parametrize("attr", ["SENT_START", "IS_SENT_START"]) +def test_phrase_matcher_sent_start(en_vocab, attr): + _ = PhraseMatcher(en_vocab, attr=attr) # noqa: F841 + + +def test_span_in_phrasematcher(en_vocab): + """Ensure that PhraseMatcher accepts Span and Doc as input""" + # fmt: off + words = ["I", "like", "Spans", "and", "Docs", "in", "my", "input", ",", "and", "nothing", "else", "."] + # fmt: on + doc = Doc(en_vocab, words=words) + span = doc[:8] + pattern = Doc(en_vocab, words=["Spans", "and", "Docs"]) + matcher = PhraseMatcher(en_vocab) + matcher.add("SPACY", [pattern]) + matches_doc = matcher(doc) + matches_span = matcher(span) + assert len(matches_doc) == 1 + assert len(matches_span) == 1 + + +def test_span_v_doc_in_phrasematcher(en_vocab): + """Ensure that PhraseMatcher only returns matches in input Span and not in entire Doc""" + # fmt: off + words = [ + "I", "like", "Spans", "and", "Docs", "in", "my", "input", ",", "Spans", + "and", "Docs", "in", "my", "matchers", "," "and", "Spans", "and", "Docs", + "everywhere", "." + ] + # fmt: on + doc = Doc(en_vocab, words=words) + span = doc[9:15] # second clause + pattern = Doc(en_vocab, words=["Spans", "and", "Docs"]) + matcher = PhraseMatcher(en_vocab) + matcher.add("SPACY", [pattern]) + matches_doc = matcher(doc) + matches_span = matcher(span) + assert len(matches_doc) == 3 + assert len(matches_span) == 1 diff --git a/TTS/Kokoro/.venv/Lib/site-packages/spacy/tests/morphology/__init__.py b/TTS/Kokoro/.venv/Lib/site-packages/spacy/tests/morphology/__init__.py new file mode 100644 index 0000000000000000000000000000000000000000..e69de29bb2d1d6434b8b29ae775ad8c2e48c5391 diff --git a/TTS/Kokoro/.venv/Lib/site-packages/spacy/tests/morphology/__pycache__/__init__.cpython-312.pyc b/TTS/Kokoro/.venv/Lib/site-packages/spacy/tests/morphology/__pycache__/__init__.cpython-312.pyc new file mode 100644 index 0000000000000000000000000000000000000000..a6c2eba28df737bbd19427a3c5c1e95b4771e31e Binary files /dev/null and b/TTS/Kokoro/.venv/Lib/site-packages/spacy/tests/morphology/__pycache__/__init__.cpython-312.pyc differ diff --git a/TTS/Kokoro/.venv/Lib/site-packages/spacy/tests/morphology/__pycache__/test_morph_converters.cpython-312.pyc b/TTS/Kokoro/.venv/Lib/site-packages/spacy/tests/morphology/__pycache__/test_morph_converters.cpython-312.pyc new file mode 100644 index 0000000000000000000000000000000000000000..af6e712b49e4fde0001c89434ec5ac2e29fe4efe Binary files /dev/null and b/TTS/Kokoro/.venv/Lib/site-packages/spacy/tests/morphology/__pycache__/test_morph_converters.cpython-312.pyc differ diff --git a/TTS/Kokoro/.venv/Lib/site-packages/spacy/tests/morphology/__pycache__/test_morph_features.cpython-312.pyc b/TTS/Kokoro/.venv/Lib/site-packages/spacy/tests/morphology/__pycache__/test_morph_features.cpython-312.pyc new file mode 100644 index 0000000000000000000000000000000000000000..6fa34afbfc179386ff45439cd48ce3a64894a8ed Binary files /dev/null and b/TTS/Kokoro/.venv/Lib/site-packages/spacy/tests/morphology/__pycache__/test_morph_features.cpython-312.pyc differ diff --git a/TTS/Kokoro/.venv/Lib/site-packages/spacy/tests/morphology/__pycache__/test_morph_pickle.cpython-312.pyc b/TTS/Kokoro/.venv/Lib/site-packages/spacy/tests/morphology/__pycache__/test_morph_pickle.cpython-312.pyc new file mode 100644 index 0000000000000000000000000000000000000000..6e43b2cec222a84f936e978a911e59ce083d505a Binary files /dev/null and b/TTS/Kokoro/.venv/Lib/site-packages/spacy/tests/morphology/__pycache__/test_morph_pickle.cpython-312.pyc differ diff --git a/TTS/Kokoro/.venv/Lib/site-packages/spacy/tests/morphology/test_morph_converters.py b/TTS/Kokoro/.venv/Lib/site-packages/spacy/tests/morphology/test_morph_converters.py new file mode 100644 index 0000000000000000000000000000000000000000..0c5bda8130093dde2f3bd86271b5ec6c2861f33d --- /dev/null +++ b/TTS/Kokoro/.venv/Lib/site-packages/spacy/tests/morphology/test_morph_converters.py @@ -0,0 +1,21 @@ +from spacy.morphology import Morphology + + +def test_feats_converters(): + feats = "Case=dat,gen|Number=sing" + feats_dict = {"Case": "dat,gen", "Number": "sing"} + + # simple conversions + assert Morphology.dict_to_feats(feats_dict) == feats + assert Morphology.feats_to_dict(feats) == feats_dict + + # roundtrips + assert Morphology.dict_to_feats(Morphology.feats_to_dict(feats)) == feats + assert Morphology.feats_to_dict(Morphology.dict_to_feats(feats_dict)) == feats_dict + + # unsorted input is normalized + unsorted_feats = "Number=sing|Case=gen,dat" + unsorted_feats_dict = {"Case": "gen,dat", "Number": "sing"} + assert Morphology.feats_to_dict(unsorted_feats) == feats_dict + assert Morphology.dict_to_feats(unsorted_feats_dict) == feats + assert Morphology.dict_to_feats(Morphology.feats_to_dict(unsorted_feats)) == feats diff --git a/TTS/Kokoro/.venv/Lib/site-packages/spacy/tests/morphology/test_morph_features.py b/TTS/Kokoro/.venv/Lib/site-packages/spacy/tests/morphology/test_morph_features.py new file mode 100644 index 0000000000000000000000000000000000000000..92bf6afc58597c261bad5a0494c51f5861fdfc3d --- /dev/null +++ b/TTS/Kokoro/.venv/Lib/site-packages/spacy/tests/morphology/test_morph_features.py @@ -0,0 +1,50 @@ +import pytest + +from spacy.morphology import Morphology +from spacy.strings import StringStore, get_string_id + + +@pytest.fixture +def morphology(): + return Morphology(StringStore()) + + +def test_init(morphology): + pass + + +def test_add_morphology_with_string_names(morphology): + morphology.add({"Case": "gen", "Number": "sing"}) + + +def test_add_morphology_with_int_ids(morphology): + morphology.strings.add("Case") + morphology.strings.add("gen") + morphology.strings.add("Number") + morphology.strings.add("sing") + morphology.add( + { + get_string_id("Case"): get_string_id("gen"), + get_string_id("Number"): get_string_id("sing"), + } + ) + + +def test_add_morphology_with_mix_strings_and_ints(morphology): + morphology.strings.add("PunctSide") + morphology.strings.add("ini") + morphology.add( + {get_string_id("PunctSide"): get_string_id("ini"), "VerbType": "aux"} + ) + + +def test_morphology_tags_hash_distinctly(morphology): + tag1 = morphology.add({"PunctSide": "ini", "VerbType": "aux"}) + tag2 = morphology.add({"Case": "gen", "Number": "sing"}) + assert tag1 != tag2 + + +def test_morphology_tags_hash_independent_of_order(morphology): + tag1 = morphology.add({"Case": "gen", "Number": "sing"}) + tag2 = morphology.add({"Number": "sing", "Case": "gen"}) + assert tag1 == tag2 diff --git a/TTS/Kokoro/.venv/Lib/site-packages/spacy/tests/morphology/test_morph_pickle.py b/TTS/Kokoro/.venv/Lib/site-packages/spacy/tests/morphology/test_morph_pickle.py new file mode 100644 index 0000000000000000000000000000000000000000..c390b456174d67beaf237a66e0d4f4fe39df23be --- /dev/null +++ b/TTS/Kokoro/.venv/Lib/site-packages/spacy/tests/morphology/test_morph_pickle.py @@ -0,0 +1,23 @@ +import pickle + +import pytest + +from spacy.morphology import Morphology +from spacy.strings import StringStore + + +@pytest.fixture +def morphology(): + morphology = Morphology(StringStore()) + morphology.add("Feat1=Val1|Feat2=Val2") + morphology.add("Feat3=Val3|Feat4=Val4") + return morphology + + +def test_morphology_pickle_roundtrip(morphology): + b = pickle.dumps(morphology) + reloaded_morphology = pickle.loads(b) + feat = reloaded_morphology.get(morphology.strings["Feat1=Val1|Feat2=Val2"]) + assert feat == "Feat1=Val1|Feat2=Val2" + feat = reloaded_morphology.get(morphology.strings["Feat3=Val3|Feat4=Val4"]) + assert feat == "Feat3=Val3|Feat4=Val4" diff --git a/TTS/Kokoro/.venv/Lib/site-packages/spacy/tests/package/__init__.py b/TTS/Kokoro/.venv/Lib/site-packages/spacy/tests/package/__init__.py new file mode 100644 index 0000000000000000000000000000000000000000..e69de29bb2d1d6434b8b29ae775ad8c2e48c5391 diff --git a/TTS/Kokoro/.venv/Lib/site-packages/spacy/tests/package/__pycache__/__init__.cpython-312.pyc b/TTS/Kokoro/.venv/Lib/site-packages/spacy/tests/package/__pycache__/__init__.cpython-312.pyc new file mode 100644 index 0000000000000000000000000000000000000000..3383b1732cfda8e519f176bf040d5fd6af77ce34 Binary files /dev/null and b/TTS/Kokoro/.venv/Lib/site-packages/spacy/tests/package/__pycache__/__init__.cpython-312.pyc differ diff --git a/TTS/Kokoro/.venv/Lib/site-packages/spacy/tests/package/__pycache__/test_requirements.cpython-312.pyc b/TTS/Kokoro/.venv/Lib/site-packages/spacy/tests/package/__pycache__/test_requirements.cpython-312.pyc new file mode 100644 index 0000000000000000000000000000000000000000..f1ec9e4956f5f488818ba21066c8caa6903f5905 Binary files /dev/null and b/TTS/Kokoro/.venv/Lib/site-packages/spacy/tests/package/__pycache__/test_requirements.cpython-312.pyc differ diff --git a/TTS/Kokoro/.venv/Lib/site-packages/spacy/tests/package/pyproject.toml b/TTS/Kokoro/.venv/Lib/site-packages/spacy/tests/package/pyproject.toml new file mode 100644 index 0000000000000000000000000000000000000000..4baf3859b21c03f6ce93342df808e7de94d99d1c --- /dev/null +++ b/TTS/Kokoro/.venv/Lib/site-packages/spacy/tests/package/pyproject.toml @@ -0,0 +1,66 @@ +[build-system] +requires = [ + "setuptools", + "cython>=3.0,<4.0", + "cymem>=2.0.2,<2.1.0", + "preshed>=3.0.2,<3.1.0", + "murmurhash>=0.28.0,<1.1.0", + "thinc>=8.3.4,<8.4.0", + "numpy>=2.0.0,<3.0.0" +] +build-backend = "setuptools.build_meta" + +[tool.cibuildwheel] +build = "*" +skip = "cp39* *-win32 *i686* cp3??t-* *cp310-win_arm64" +test-skip = "" + +archs = ["native"] + +build-frontend = "default" +config-settings = {} +dependency-versions = "pinned" +environment = { PIP_CONSTRAINT = "build-constraints.txt" } + +environment-pass = [] +build-verbosity = 0 + +before-all = "curl https://sh.rustup.rs -sSf | sh -s -- -y --profile minimal --default-toolchain stable" +before-build = "pip install -r requirements.txt && python setup.py clean" +repair-wheel-command = "" + +test-command = "" +before-test = "" +test-requires = [] +test-extras = [] + +container-engine = "docker" + +manylinux-x86_64-image = "manylinux2014" +manylinux-i686-image = "manylinux2014" +manylinux-aarch64-image = "manylinux2014" +manylinux-ppc64le-image = "manylinux2014" +manylinux-s390x-image = "manylinux2014" +manylinux-pypy_x86_64-image = "manylinux2014" +manylinux-pypy_i686-image = "manylinux2014" +manylinux-pypy_aarch64-image = "manylinux2014" + +musllinux-x86_64-image = "musllinux_1_2" +musllinux-i686-image = "musllinux_1_2" +musllinux-aarch64-image = "musllinux_1_2" +musllinux-ppc64le-image = "musllinux_1_2" +musllinux-s390x-image = "musllinux_1_2" + +[tool.cibuildwheel.linux] +repair-wheel-command = "auditwheel repair -w {dest_dir} {wheel}" + +[tool.cibuildwheel.macos] +repair-wheel-command = "delocate-wheel --require-archs {delocate_archs} -w {dest_dir} -v {wheel}" + +[tool.cibuildwheel.windows] + +[tool.cibuildwheel.pyodide] + + +[tool.isort] +profile = "black" diff --git a/TTS/Kokoro/.venv/Lib/site-packages/spacy/tests/package/requirements.txt b/TTS/Kokoro/.venv/Lib/site-packages/spacy/tests/package/requirements.txt new file mode 100644 index 0000000000000000000000000000000000000000..c2c981d32a702275d76ed1b19d89ecb681e05665 --- /dev/null +++ b/TTS/Kokoro/.venv/Lib/site-packages/spacy/tests/package/requirements.txt @@ -0,0 +1,38 @@ +# Our libraries +spacy-legacy>=3.0.11,<3.1.0 +spacy-loggers>=1.0.0,<2.0.0 +cymem>=2.0.2,<2.1.0 +preshed>=3.0.2,<3.1.0 +thinc>=8.3.4,<8.4.0 +ml_datasets>=0.2.0,<0.3.0 +murmurhash>=0.28.0,<1.1.0 +wasabi>=0.9.1,<1.2.0 +srsly>=2.4.3,<3.0.0 +catalogue>=2.0.6,<2.1.0 +typer-slim>=0.3.0,<1.0.0 +weasel>=0.4.2,<0.5.0 +# Third party dependencies +numpy>=2.0.0,<3.0.0 +requests>=2.13.0,<3.0.0 +tqdm>=4.38.0,<5.0.0 +pydantic>=1.7.4,!=1.8,!=1.8.1,<3.0.0 +jinja2 +# Official Python utilities +setuptools +packaging>=20.0 +# Development dependencies +pre-commit>=2.13.0 +cython>=3.0,<4.0 +pytest>=5.2.0,!=7.1.0 +pytest-timeout>=1.3.0,<2.0.0 +mock>=2.0.0,<3.0.0 +flake8>=3.8.0,<6.0.0 +hypothesis>=3.27.0,<7.0.0 +mypy>=1.5.0,<1.6.0; platform_machine != "aarch64" and python_version >= "3.8" +types-mock>=0.1.1 +types-setuptools>=57.0.0 +types-requests +types-setuptools>=57.0.0 +black>=25.0.0 +cython-lint>=0.15.0 +isort>=5.0,<6.0 diff --git a/TTS/Kokoro/.venv/Lib/site-packages/spacy/tests/package/setup.cfg b/TTS/Kokoro/.venv/Lib/site-packages/spacy/tests/package/setup.cfg new file mode 100644 index 0000000000000000000000000000000000000000..b01bca4a65dcd8c6564a988474acfa2bc2130182 --- /dev/null +++ b/TTS/Kokoro/.venv/Lib/site-packages/spacy/tests/package/setup.cfg @@ -0,0 +1,152 @@ +[metadata] +description = Industrial-strength Natural Language Processing (NLP) in Python +url = https://spacy.io +author = Explosion +author_email = contact@explosion.ai +license = MIT +long_description = file: README.md +long_description_content_type = text/markdown +classifiers = + Development Status :: 5 - Production/Stable + Environment :: Console + Intended Audience :: Developers + Intended Audience :: Science/Research + License :: OSI Approved :: MIT License + Operating System :: POSIX :: Linux + Operating System :: MacOS :: MacOS X + Operating System :: Microsoft :: Windows + Programming Language :: Cython + Programming Language :: Python :: 3 + Programming Language :: Python :: 3.9 + Programming Language :: Python :: 3.10 + Programming Language :: Python :: 3.11 + Programming Language :: Python :: 3.12 + Programming Language :: Python :: 3.13 + Topic :: Scientific/Engineering +project_urls = + Release notes = https://github.com/explosion/spaCy/releases + Source = https://github.com/explosion/spaCy + +[options] +zip_safe = false +include_package_data = true +python_requires = >=3.9,<3.15 +# NOTE: This section is superseded by pyproject.toml and will be removed in +# spaCy v4 +setup_requires = + cython>=3.0,<4.0 + numpy>=2.0.0,<3.0.0; python_version < "3.9" + numpy>=2.0.0,<3.0.0; python_version >= "3.9" + # We also need our Cython packages here to compile against + cymem>=2.0.2,<2.1.0 + preshed>=3.0.2,<3.1.0 + murmurhash>=0.28.0,<1.1.0 + thinc>=8.3.4,<8.4.0 +install_requires = + # Our libraries + spacy-legacy>=3.0.11,<3.1.0 + spacy-loggers>=1.0.0,<2.0.0 + murmurhash>=0.28.0,<1.1.0 + cymem>=2.0.2,<2.1.0 + preshed>=3.0.2,<3.1.0 + thinc>=8.3.4,<8.4.0 + wasabi>=0.9.1,<1.2.0 + srsly>=2.4.3,<3.0.0 + catalogue>=2.0.6,<2.1.0 + weasel>=0.4.2,<0.5.0 + # Third-party dependencies + typer-slim>=0.3.0,<1.0.0 + tqdm>=4.38.0,<5.0.0 + numpy>=1.15.0; python_version < "3.9" + numpy>=1.19.0; python_version >= "3.9" + requests>=2.13.0,<3.0.0 + pydantic>=1.7.4,!=1.8,!=1.8.1,<3.0.0 + jinja2 + # Official Python utilities + setuptools + packaging>=20.0 + +[options.entry_points] +console_scripts = + spacy = spacy.cli:setup_cli + +[options.extras_require] +lookups = + spacy_lookups_data>=1.0.3,<1.1.0 +transformers = + spacy_transformers>=1.1.2,<1.4.0 +cuda = + cupy>=5.0.0b4,<13.0.0 +cuda80 = + cupy-cuda80>=5.0.0b4,<13.0.0 +cuda90 = + cupy-cuda90>=5.0.0b4,<13.0.0 +cuda91 = + cupy-cuda91>=5.0.0b4,<13.0.0 +cuda92 = + cupy-cuda92>=5.0.0b4,<13.0.0 +cuda100 = + cupy-cuda100>=5.0.0b4,<13.0.0 +cuda101 = + cupy-cuda101>=5.0.0b4,<13.0.0 +cuda102 = + cupy-cuda102>=5.0.0b4,<13.0.0 +cuda110 = + cupy-cuda110>=5.0.0b4,<13.0.0 +cuda111 = + cupy-cuda111>=5.0.0b4,<13.0.0 +cuda112 = + cupy-cuda112>=5.0.0b4,<13.0.0 +cuda113 = + cupy-cuda113>=5.0.0b4,<13.0.0 +cuda114 = + cupy-cuda114>=5.0.0b4,<13.0.0 +cuda115 = + cupy-cuda115>=5.0.0b4,<13.0.0 +cuda116 = + cupy-cuda116>=5.0.0b4,<13.0.0 +cuda117 = + cupy-cuda117>=5.0.0b4,<13.0.0 +cuda11x = + cupy-cuda11x>=11.0.0,<13.0.0 +cuda12x = + cupy-cuda12x>=11.5.0,<13.0.0 +cuda-autodetect = + cupy-wheel>=11.0.0,<13.0.0 +apple = + thinc-apple-ops>=1.0.0,<2.0.0 +# Language tokenizers with external dependencies +ja = + sudachipy>=0.5.2,!=0.6.1 + sudachidict_core>=20211220 +ko = + natto-py>=0.9.0 +th = + pythainlp>=2.0 + +[bdist_wheel] +universal = false + +[sdist] +formats = gztar + +[flake8] +ignore = E203, E266, E501, E731, W503, E741, F541 +max-line-length = 80 +select = B,C,E,F,W,T4,B9 +exclude = + .env, + .git, + __pycache__, + _tokenizer_exceptions_list.py, + +[tool:pytest] +markers = + slow: mark a test as slow + issue: reference specific issue + +[mypy] +ignore_missing_imports = True +no_implicit_optional = True +plugins = pydantic.mypy, thinc.mypy +allow_redefinition = True diff --git a/TTS/Kokoro/.venv/Lib/site-packages/spacy/tests/package/test_requirements.py b/TTS/Kokoro/.venv/Lib/site-packages/spacy/tests/package/test_requirements.py new file mode 100644 index 0000000000000000000000000000000000000000..3e75b503e94f0a79c39f7947aa0a01d705ffcc1b --- /dev/null +++ b/TTS/Kokoro/.venv/Lib/site-packages/spacy/tests/package/test_requirements.py @@ -0,0 +1,96 @@ +import re +from pathlib import Path + + +def test_build_dependencies(): + # Check that library requirements are pinned exactly the same across different setup files. + libs_ignore_requirements = [ + "numpy", + "pytest", + "pytest-timeout", + "mock", + "flake8", + "hypothesis", + "pre-commit", + "cython-lint", + "black", + "isort", + "mypy", + "types-dataclasses", + "types-mock", + "types-requests", + "types-setuptools", + ] + # ignore language-specific packages that shouldn't be installed by all + libs_ignore_setup = [ + "numpy", + "fugashi", + "natto-py", + "pythainlp", + "sudachipy", + "sudachidict_core", + "spacy-pkuseg", + "thinc-apple-ops", + ] + + # check requirements.txt + req_dict = {} + + root_dir = Path(__file__).parent + req_file = root_dir / "requirements.txt" + with req_file.open() as f: + lines = f.readlines() + for line in lines: + line = line.strip() + if not line.startswith("#"): + lib, v = _parse_req(line) + if lib and lib not in libs_ignore_requirements: + req_dict[lib] = v + # check setup.cfg and compare to requirements.txt + # also fails when there are missing or additional libs + setup_file = root_dir / "setup.cfg" + with setup_file.open() as f: + lines = f.readlines() + + setup_keys = set() + for line in lines: + line = line.strip() + if not line.startswith("#"): + lib, v = _parse_req(line) + if lib and not lib.startswith("cupy") and lib not in libs_ignore_setup: + req_v = req_dict.get(lib, None) + assert ( + req_v is not None + ), "{} in setup.cfg but not in requirements.txt".format(lib) + assert (lib + v) == (lib + req_v), ( + "{} has different version in setup.cfg and in requirements.txt: " + "{} and {} respectively".format(lib, v, req_v) + ) + setup_keys.add(lib) + assert sorted(setup_keys) == sorted( + req_dict.keys() + ) # if fail: requirements.txt contains a lib not in setup.cfg + + # check pyproject.toml and compare the versions of the libs to requirements.txt + # does not fail when there are missing or additional libs + toml_file = root_dir / "pyproject.toml" + with toml_file.open() as f: + lines = f.readlines() + for line in lines: + line = line.strip().strip(",").strip('"') + if not line.startswith("#"): + lib, v = _parse_req(line) + if lib and lib not in libs_ignore_requirements: + req_v = req_dict.get(lib, None) + assert (lib + v) == (lib + req_v), ( + "{} has different version in pyproject.toml and in requirements.txt: " + "{} and {} respectively".format(lib, v, req_v) + ) + + +def _parse_req(line): + lib = re.match(r"^[a-z0-9\-]*", line).group(0) + v = line.replace(lib, "").strip() + if not re.match(r"^[<>=][<>=].*", v): + return None, None + return lib, v diff --git a/TTS/Kokoro/.venv/Lib/site-packages/spacy/tests/parser/__init__.py b/TTS/Kokoro/.venv/Lib/site-packages/spacy/tests/parser/__init__.py new file mode 100644 index 0000000000000000000000000000000000000000..e69de29bb2d1d6434b8b29ae775ad8c2e48c5391 diff --git a/TTS/Kokoro/.venv/Lib/site-packages/spacy/tests/parser/__pycache__/__init__.cpython-312.pyc b/TTS/Kokoro/.venv/Lib/site-packages/spacy/tests/parser/__pycache__/__init__.cpython-312.pyc new file mode 100644 index 0000000000000000000000000000000000000000..13cd179ecf4f2691acbb15e2e7a4b55dae303a21 Binary files /dev/null and b/TTS/Kokoro/.venv/Lib/site-packages/spacy/tests/parser/__pycache__/__init__.cpython-312.pyc differ diff --git a/TTS/Kokoro/.venv/Lib/site-packages/spacy/tests/parser/__pycache__/test_add_label.cpython-312.pyc b/TTS/Kokoro/.venv/Lib/site-packages/spacy/tests/parser/__pycache__/test_add_label.cpython-312.pyc new file mode 100644 index 0000000000000000000000000000000000000000..e041ee2467af8306e1374bea21db987e05a270a8 Binary files /dev/null and b/TTS/Kokoro/.venv/Lib/site-packages/spacy/tests/parser/__pycache__/test_add_label.cpython-312.pyc differ diff --git a/TTS/Kokoro/.venv/Lib/site-packages/spacy/tests/parser/__pycache__/test_arc_eager_oracle.cpython-312.pyc b/TTS/Kokoro/.venv/Lib/site-packages/spacy/tests/parser/__pycache__/test_arc_eager_oracle.cpython-312.pyc new file mode 100644 index 0000000000000000000000000000000000000000..54c19127fb836bdba005602bf9f006c23ae2503d Binary files /dev/null and b/TTS/Kokoro/.venv/Lib/site-packages/spacy/tests/parser/__pycache__/test_arc_eager_oracle.cpython-312.pyc differ diff --git a/TTS/Kokoro/.venv/Lib/site-packages/spacy/tests/parser/__pycache__/test_ner.cpython-312.pyc b/TTS/Kokoro/.venv/Lib/site-packages/spacy/tests/parser/__pycache__/test_ner.cpython-312.pyc new file mode 100644 index 0000000000000000000000000000000000000000..0610d74008e307456bac35a3ee6f70158f2d5cc9 Binary files /dev/null and b/TTS/Kokoro/.venv/Lib/site-packages/spacy/tests/parser/__pycache__/test_ner.cpython-312.pyc differ diff --git a/TTS/Kokoro/.venv/Lib/site-packages/spacy/tests/parser/__pycache__/test_neural_parser.cpython-312.pyc b/TTS/Kokoro/.venv/Lib/site-packages/spacy/tests/parser/__pycache__/test_neural_parser.cpython-312.pyc new file mode 100644 index 0000000000000000000000000000000000000000..edaf4f157a86c76d232d8df8be774d0736de29ed Binary files /dev/null and b/TTS/Kokoro/.venv/Lib/site-packages/spacy/tests/parser/__pycache__/test_neural_parser.cpython-312.pyc differ diff --git a/TTS/Kokoro/.venv/Lib/site-packages/spacy/tests/parser/__pycache__/test_nn_beam.cpython-312.pyc b/TTS/Kokoro/.venv/Lib/site-packages/spacy/tests/parser/__pycache__/test_nn_beam.cpython-312.pyc new file mode 100644 index 0000000000000000000000000000000000000000..e41d4cc9390308e3480ccce73494e30ef07fc93b Binary files /dev/null and b/TTS/Kokoro/.venv/Lib/site-packages/spacy/tests/parser/__pycache__/test_nn_beam.cpython-312.pyc differ diff --git a/TTS/Kokoro/.venv/Lib/site-packages/spacy/tests/parser/__pycache__/test_nonproj.cpython-312.pyc b/TTS/Kokoro/.venv/Lib/site-packages/spacy/tests/parser/__pycache__/test_nonproj.cpython-312.pyc new file mode 100644 index 0000000000000000000000000000000000000000..09becf54d66b91ee7ae185dc56ded1e3153c94bb Binary files /dev/null and b/TTS/Kokoro/.venv/Lib/site-packages/spacy/tests/parser/__pycache__/test_nonproj.cpython-312.pyc differ diff --git a/TTS/Kokoro/.venv/Lib/site-packages/spacy/tests/parser/__pycache__/test_parse.cpython-312.pyc b/TTS/Kokoro/.venv/Lib/site-packages/spacy/tests/parser/__pycache__/test_parse.cpython-312.pyc new file mode 100644 index 0000000000000000000000000000000000000000..35add9804fcc590720bdf007d479e9b7f4544e00 Binary files /dev/null and b/TTS/Kokoro/.venv/Lib/site-packages/spacy/tests/parser/__pycache__/test_parse.cpython-312.pyc differ diff --git a/TTS/Kokoro/.venv/Lib/site-packages/spacy/tests/parser/__pycache__/test_parse_navigate.cpython-312.pyc b/TTS/Kokoro/.venv/Lib/site-packages/spacy/tests/parser/__pycache__/test_parse_navigate.cpython-312.pyc new file mode 100644 index 0000000000000000000000000000000000000000..3cba737c846402b71aaed3d582a4e2ab6ebaf2b6 Binary files /dev/null and b/TTS/Kokoro/.venv/Lib/site-packages/spacy/tests/parser/__pycache__/test_parse_navigate.cpython-312.pyc differ diff --git a/TTS/Kokoro/.venv/Lib/site-packages/spacy/tests/parser/__pycache__/test_preset_sbd.cpython-312.pyc b/TTS/Kokoro/.venv/Lib/site-packages/spacy/tests/parser/__pycache__/test_preset_sbd.cpython-312.pyc new file mode 100644 index 0000000000000000000000000000000000000000..4f30f982c63a1c1534ee78cacf3ae2616bd1ef0e Binary files /dev/null and b/TTS/Kokoro/.venv/Lib/site-packages/spacy/tests/parser/__pycache__/test_preset_sbd.cpython-312.pyc differ diff --git a/TTS/Kokoro/.venv/Lib/site-packages/spacy/tests/parser/__pycache__/test_space_attachment.cpython-312.pyc b/TTS/Kokoro/.venv/Lib/site-packages/spacy/tests/parser/__pycache__/test_space_attachment.cpython-312.pyc new file mode 100644 index 0000000000000000000000000000000000000000..dbe138d328933d1ed95f844898fefda9291eeff0 Binary files /dev/null and b/TTS/Kokoro/.venv/Lib/site-packages/spacy/tests/parser/__pycache__/test_space_attachment.cpython-312.pyc differ diff --git a/TTS/Kokoro/.venv/Lib/site-packages/spacy/tests/parser/__pycache__/test_state.cpython-312.pyc b/TTS/Kokoro/.venv/Lib/site-packages/spacy/tests/parser/__pycache__/test_state.cpython-312.pyc new file mode 100644 index 0000000000000000000000000000000000000000..3f9f02ffdc00d04ad37cec0d62c7c0b9472f2218 Binary files /dev/null and b/TTS/Kokoro/.venv/Lib/site-packages/spacy/tests/parser/__pycache__/test_state.cpython-312.pyc differ diff --git a/TTS/Kokoro/.venv/Lib/site-packages/spacy/tests/parser/test_add_label.py b/TTS/Kokoro/.venv/Lib/site-packages/spacy/tests/parser/test_add_label.py new file mode 100644 index 0000000000000000000000000000000000000000..749ee3df3aaa52e4b6fc74699031b9b199d71b53 --- /dev/null +++ b/TTS/Kokoro/.venv/Lib/site-packages/spacy/tests/parser/test_add_label.py @@ -0,0 +1,159 @@ +import pytest +from thinc.api import Adam, fix_random_seed + +from spacy import registry +from spacy.attrs import NORM +from spacy.language import Language +from spacy.pipeline import DependencyParser, EntityRecognizer +from spacy.pipeline.dep_parser import DEFAULT_PARSER_MODEL +from spacy.pipeline.ner import DEFAULT_NER_MODEL +from spacy.tokens import Doc +from spacy.training import Example +from spacy.vocab import Vocab + + +@pytest.fixture +def vocab(): + return Vocab(lex_attr_getters={NORM: lambda s: s}) + + +@pytest.fixture +def parser(vocab): + cfg = {"model": DEFAULT_PARSER_MODEL} + model = registry.resolve(cfg, validate=True)["model"] + parser = DependencyParser(vocab, model) + return parser + + +def test_init_parser(parser): + pass + + +def _train_parser(parser): + fix_random_seed(1) + parser.add_label("left") + parser.initialize(lambda: [_parser_example(parser)]) + sgd = Adam(0.001) + + for i in range(5): + losses = {} + doc = Doc(parser.vocab, words=["a", "b", "c", "d"]) + gold = {"heads": [1, 1, 3, 3], "deps": ["left", "ROOT", "left", "ROOT"]} + example = Example.from_dict(doc, gold) + parser.update([example], sgd=sgd, losses=losses) + return parser + + +def _parser_example(parser): + doc = Doc(parser.vocab, words=["a", "b", "c", "d"]) + gold = {"heads": [1, 1, 3, 3], "deps": ["right", "ROOT", "left", "ROOT"]} + return Example.from_dict(doc, gold) + + +def _ner_example(ner): + doc = Doc( + ner.vocab, + words=["Joe", "loves", "visiting", "London", "during", "the", "weekend"], + ) + gold = {"entities": [(0, 3, "PERSON"), (19, 25, "LOC")]} + return Example.from_dict(doc, gold) + + +def test_add_label(parser): + parser = _train_parser(parser) + parser.add_label("right") + sgd = Adam(0.001) + for i in range(100): + losses = {} + parser.update([_parser_example(parser)], sgd=sgd, losses=losses) + doc = Doc(parser.vocab, words=["a", "b", "c", "d"]) + doc = parser(doc) + assert doc[0].dep_ == "right" + assert doc[2].dep_ == "left" + + +def test_add_label_deserializes_correctly(): + cfg = {"model": DEFAULT_NER_MODEL} + model = registry.resolve(cfg, validate=True)["model"] + ner1 = EntityRecognizer(Vocab(), model) + ner1.add_label("C") + ner1.add_label("B") + ner1.add_label("A") + ner1.initialize(lambda: [_ner_example(ner1)]) + ner2 = EntityRecognizer(Vocab(), model) + + # the second model needs to be resized before we can call from_bytes + ner2.model.attrs["resize_output"](ner2.model, ner1.moves.n_moves) + ner2.from_bytes(ner1.to_bytes()) + assert ner1.moves.n_moves == ner2.moves.n_moves + for i in range(ner1.moves.n_moves): + assert ner1.moves.get_class_name(i) == ner2.moves.get_class_name(i) + + +@pytest.mark.parametrize( + "pipe_cls,n_moves,model_config", + [ + (DependencyParser, 5, DEFAULT_PARSER_MODEL), + (EntityRecognizer, 4, DEFAULT_NER_MODEL), + ], +) +def test_add_label_get_label(pipe_cls, n_moves, model_config): + """Test that added labels are returned correctly. This test was added to + test for a bug in DependencyParser.labels that'd cause it to fail when + splitting the move names. + """ + labels = ["A", "B", "C"] + model = registry.resolve({"model": model_config}, validate=True)["model"] + pipe = pipe_cls(Vocab(), model) + for label in labels: + pipe.add_label(label) + assert len(pipe.move_names) == len(labels) * n_moves + pipe_labels = sorted(list(pipe.labels)) + assert pipe_labels == labels + + +def test_ner_labels_added_implicitly_on_predict(): + nlp = Language() + ner = nlp.add_pipe("ner") + for label in ["A", "B", "C"]: + ner.add_label(label) + nlp.initialize() + doc = Doc(nlp.vocab, words=["hello", "world"], ents=["B-D", "O"]) + ner(doc) + assert [t.ent_type_ for t in doc] == ["D", ""] + assert "D" in ner.labels + + +def test_ner_labels_added_implicitly_on_beam_parse(): + nlp = Language() + ner = nlp.add_pipe("beam_ner") + for label in ["A", "B", "C"]: + ner.add_label(label) + nlp.initialize() + doc = Doc(nlp.vocab, words=["hello", "world"], ents=["B-D", "O"]) + ner.beam_parse([doc], beam_width=32) + assert "D" in ner.labels + + +def test_ner_labels_added_implicitly_on_greedy_parse(): + nlp = Language() + ner = nlp.add_pipe("beam_ner") + for label in ["A", "B", "C"]: + ner.add_label(label) + nlp.initialize() + doc = Doc(nlp.vocab, words=["hello", "world"], ents=["B-D", "O"]) + ner.greedy_parse([doc]) + assert "D" in ner.labels + + +def test_ner_labels_added_implicitly_on_update(): + nlp = Language() + ner = nlp.add_pipe("ner") + for label in ["A", "B", "C"]: + ner.add_label(label) + nlp.initialize() + doc = Doc(nlp.vocab, words=["hello", "world"], ents=["B-D", "O"]) + example = Example(nlp.make_doc(doc.text), doc) + assert "D" not in ner.labels + nlp.update([example]) + assert "D" in ner.labels diff --git a/TTS/Kokoro/.venv/Lib/site-packages/spacy/tests/parser/test_arc_eager_oracle.py b/TTS/Kokoro/.venv/Lib/site-packages/spacy/tests/parser/test_arc_eager_oracle.py new file mode 100644 index 0000000000000000000000000000000000000000..cdb7085009d1dc0672d4d933d9c2d629056dc425 --- /dev/null +++ b/TTS/Kokoro/.venv/Lib/site-packages/spacy/tests/parser/test_arc_eager_oracle.py @@ -0,0 +1,294 @@ +import pytest + +from spacy import registry +from spacy.pipeline import DependencyParser +from spacy.pipeline._parser_internals.arc_eager import ArcEager +from spacy.pipeline._parser_internals.nonproj import projectivize +from spacy.pipeline.dep_parser import DEFAULT_PARSER_MODEL +from spacy.tokens import Doc +from spacy.training import Example +from spacy.vocab import Vocab + + +def get_sequence_costs(M, words, heads, deps, transitions): + doc = Doc(Vocab(), words=words) + example = Example.from_dict(doc, {"heads": heads, "deps": deps}) + states, golds, _ = M.init_gold_batch([example]) + state = states[0] + gold = golds[0] + cost_history = [] + for gold_action in transitions: + gold.update(state) + state_costs = {} + for i in range(M.n_moves): + name = M.class_name(i) + state_costs[name] = M.get_cost(state, gold, i) + M.transition(state, gold_action) + cost_history.append(state_costs) + return state, cost_history + + +@pytest.fixture +def vocab(): + return Vocab() + + +@pytest.fixture +def arc_eager(vocab): + moves = ArcEager(vocab.strings, ArcEager.get_actions()) + moves.add_action(2, "left") + moves.add_action(3, "right") + return moves + + +@pytest.mark.issue(7056) +def test_issue7056(): + """Test that the Unshift transition works properly, and doesn't cause + sentence segmentation errors.""" + vocab = Vocab() + ae = ArcEager( + vocab.strings, ArcEager.get_actions(left_labels=["amod"], right_labels=["pobj"]) + ) + doc = Doc(vocab, words="Severe pain , after trauma".split()) + state = ae.init_batch([doc])[0] + ae.apply_transition(state, "S") + ae.apply_transition(state, "L-amod") + ae.apply_transition(state, "S") + ae.apply_transition(state, "S") + ae.apply_transition(state, "S") + ae.apply_transition(state, "R-pobj") + ae.apply_transition(state, "D") + ae.apply_transition(state, "D") + ae.apply_transition(state, "D") + assert not state.eol() + + +def test_oracle_four_words(arc_eager, vocab): + words = ["a", "b", "c", "d"] + heads = [1, 1, 3, 3] + deps = ["left", "ROOT", "left", "ROOT"] + for dep in deps: + arc_eager.add_action(2, dep) # Left + arc_eager.add_action(3, dep) # Right + actions = ["S", "L-left", "B-ROOT", "S", "D", "S", "L-left", "S", "D"] + state, cost_history = get_sequence_costs(arc_eager, words, heads, deps, actions) + expected_gold = [ + ["S"], + ["B-ROOT", "L-left"], + ["B-ROOT"], + ["S"], + ["D"], + ["S"], + ["L-left"], + ["S"], + ["D"], + ] + assert state.is_final() + for i, state_costs in enumerate(cost_history): + # Check gold moves is 0 cost + golds = [act for act, cost in state_costs.items() if cost < 1] + assert golds == expected_gold[i], (i, golds, expected_gold[i]) + + +annot_tuples = [ + (0, "When", "WRB", 11, "advmod", "O"), + (1, "Walter", "NNP", 2, "compound", "B-PERSON"), + (2, "Rodgers", "NNP", 11, "nsubj", "L-PERSON"), + (3, ",", ",", 2, "punct", "O"), + (4, "our", "PRP$", 6, "poss", "O"), + (5, "embedded", "VBN", 6, "amod", "O"), + (6, "reporter", "NN", 2, "appos", "O"), + (7, "with", "IN", 6, "prep", "O"), + (8, "the", "DT", 10, "det", "B-ORG"), + (9, "3rd", "NNP", 10, "compound", "I-ORG"), + (10, "Cavalry", "NNP", 7, "pobj", "L-ORG"), + (11, "says", "VBZ", 44, "advcl", "O"), + (12, "three", "CD", 13, "nummod", "U-CARDINAL"), + (13, "battalions", "NNS", 16, "nsubj", "O"), + (14, "of", "IN", 13, "prep", "O"), + (15, "troops", "NNS", 14, "pobj", "O"), + (16, "are", "VBP", 11, "ccomp", "O"), + (17, "on", "IN", 16, "prep", "O"), + (18, "the", "DT", 19, "det", "O"), + (19, "ground", "NN", 17, "pobj", "O"), + (20, ",", ",", 17, "punct", "O"), + (21, "inside", "IN", 17, "prep", "O"), + (22, "Baghdad", "NNP", 21, "pobj", "U-GPE"), + (23, "itself", "PRP", 22, "appos", "O"), + (24, ",", ",", 16, "punct", "O"), + (25, "have", "VBP", 26, "aux", "O"), + (26, "taken", "VBN", 16, "dep", "O"), + (27, "up", "RP", 26, "prt", "O"), + (28, "positions", "NNS", 26, "dobj", "O"), + (29, "they", "PRP", 31, "nsubj", "O"), + (30, "'re", "VBP", 31, "aux", "O"), + (31, "going", "VBG", 26, "parataxis", "O"), + (32, "to", "TO", 33, "aux", "O"), + (33, "spend", "VB", 31, "xcomp", "O"), + (34, "the", "DT", 35, "det", "B-TIME"), + (35, "night", "NN", 33, "dobj", "L-TIME"), + (36, "there", "RB", 33, "advmod", "O"), + (37, "presumably", "RB", 33, "advmod", "O"), + (38, ",", ",", 44, "punct", "O"), + (39, "how", "WRB", 40, "advmod", "O"), + (40, "many", "JJ", 41, "amod", "O"), + (41, "soldiers", "NNS", 44, "pobj", "O"), + (42, "are", "VBP", 44, "aux", "O"), + (43, "we", "PRP", 44, "nsubj", "O"), + (44, "talking", "VBG", 44, "ROOT", "O"), + (45, "about", "IN", 44, "prep", "O"), + (46, "right", "RB", 47, "advmod", "O"), + (47, "now", "RB", 44, "advmod", "O"), + (48, "?", ".", 44, "punct", "O"), +] + + +def test_get_oracle_actions(): + ids, words, tags, heads, deps, ents = [], [], [], [], [], [] + for id_, word, tag, head, dep, ent in annot_tuples: + ids.append(id_) + words.append(word) + tags.append(tag) + heads.append(head) + deps.append(dep) + ents.append(ent) + doc = Doc(Vocab(), words=[t[1] for t in annot_tuples]) + cfg = {"model": DEFAULT_PARSER_MODEL} + model = registry.resolve(cfg, validate=True)["model"] + parser = DependencyParser(doc.vocab, model) + parser.moves.add_action(0, "") + parser.moves.add_action(1, "") + parser.moves.add_action(1, "") + parser.moves.add_action(4, "ROOT") + heads, deps = projectivize(heads, deps) + for i, (head, dep) in enumerate(zip(heads, deps)): + if head > i: + parser.moves.add_action(2, dep) + elif head < i: + parser.moves.add_action(3, dep) + example = Example.from_dict( + doc, {"words": words, "tags": tags, "heads": heads, "deps": deps} + ) + parser.moves.get_oracle_sequence(example) + + +def test_oracle_dev_sentence(vocab, arc_eager): + words_deps_heads = """ + Rolls-Royce nn Inc. + Motor nn Inc. + Cars nn Inc. + Inc. nsubj said + said ROOT said + it nsubj expects + expects ccomp said + its poss sales + U.S. nn sales + sales nsubj steady + to aux steady + remain cop steady + steady xcomp expects + at prep steady + about quantmod 1,200 + 1,200 num cars + cars pobj at + in prep steady + 1990 pobj in + . punct said + """ + expected_transitions = [ + "S", # Shift "Rolls-Royce" + "S", # Shift 'Motor' + "S", # Shift 'Cars' + "L-nn", # Attach 'Cars' to 'Inc.' + "L-nn", # Attach 'Motor' to 'Inc.' + "L-nn", # Attach 'Rolls-Royce' to 'Inc.' + "S", # Shift "Inc." + "L-nsubj", # Attach 'Inc.' to 'said' + "S", # Shift 'said' + "S", # Shift 'it' + "L-nsubj", # Attach 'it.' to 'expects' + "R-ccomp", # Attach 'expects' to 'said' + "S", # Shift 'its' + "S", # Shift 'U.S.' + "L-nn", # Attach 'U.S.' to 'sales' + "L-poss", # Attach 'its' to 'sales' + "S", # Shift 'sales' + "S", # Shift 'to' + "S", # Shift 'remain' + "L-cop", # Attach 'remain' to 'steady' + "L-aux", # Attach 'to' to 'steady' + "L-nsubj", # Attach 'sales' to 'steady' + "R-xcomp", # Attach 'steady' to 'expects' + "R-prep", # Attach 'at' to 'steady' + "S", # Shift 'about' + "L-quantmod", # Attach "about" to "1,200" + "S", # Shift "1,200" + "L-num", # Attach "1,200" to "cars" + "R-pobj", # Attach "cars" to "at" + "D", # Reduce "cars" + "D", # Reduce "at" + "R-prep", # Attach "in" to "steady" + "R-pobj", # Attach "1990" to "in" + "D", # Reduce "1990" + "D", # Reduce "in" + "D", # Reduce "steady" + "D", # Reduce "expects" + "R-punct", # Attach "." to "said" + "D", # Reduce "." + "D", # Reduce "said" + ] + + gold_words = [] + gold_deps = [] + gold_heads = [] + for line in words_deps_heads.strip().split("\n"): + line = line.strip() + if not line: + continue + word, dep, head = line.split() + gold_words.append(word) + gold_deps.append(dep) + gold_heads.append(head) + gold_heads = [gold_words.index(head) for head in gold_heads] + for dep in gold_deps: + arc_eager.add_action(2, dep) # Left + arc_eager.add_action(3, dep) # Right + doc = Doc(Vocab(), words=gold_words) + example = Example.from_dict(doc, {"heads": gold_heads, "deps": gold_deps}) + ae_oracle_actions = arc_eager.get_oracle_sequence(example, _debug=False) + ae_oracle_actions = [arc_eager.get_class_name(i) for i in ae_oracle_actions] + assert ae_oracle_actions == expected_transitions + + +def test_oracle_bad_tokenization(vocab, arc_eager): + words_deps_heads = """ + [catalase] dep is + : punct is + that nsubj is + is root is + bad comp is + """ + + gold_words = [] + gold_deps = [] + gold_heads = [] + for line in words_deps_heads.strip().split("\n"): + line = line.strip() + if not line: + continue + word, dep, head = line.split() + gold_words.append(word) + gold_deps.append(dep) + gold_heads.append(head) + gold_heads = [gold_words.index(head) for head in gold_heads] + for dep in gold_deps: + arc_eager.add_action(2, dep) # Left + arc_eager.add_action(3, dep) # Right + reference = Doc(Vocab(), words=gold_words, deps=gold_deps, heads=gold_heads) + predicted = Doc( + reference.vocab, words=["[", "catalase", "]", ":", "that", "is", "bad"] + ) + example = Example(predicted=predicted, reference=reference) + ae_oracle_actions = arc_eager.get_oracle_sequence(example, _debug=False) + ae_oracle_actions = [arc_eager.get_class_name(i) for i in ae_oracle_actions] + assert ae_oracle_actions diff --git a/TTS/Kokoro/.venv/Lib/site-packages/spacy/tests/parser/test_ner.py b/TTS/Kokoro/.venv/Lib/site-packages/spacy/tests/parser/test_ner.py new file mode 100644 index 0000000000000000000000000000000000000000..b7b6fb59f15bdcae6c5fefa9cd4d2707f74ba4d1 --- /dev/null +++ b/TTS/Kokoro/.venv/Lib/site-packages/spacy/tests/parser/test_ner.py @@ -0,0 +1,828 @@ +import logging +import random + +import pytest +from numpy.testing import assert_equal + +from spacy import registry, util +from spacy.attrs import ENT_IOB +from spacy.lang.en import English +from spacy.lang.it import Italian +from spacy.language import Language +from spacy.lookups import Lookups +from spacy.pipeline import EntityRecognizer +from spacy.pipeline._parser_internals.ner import BiluoPushDown +from spacy.pipeline.ner import DEFAULT_NER_MODEL +from spacy.tokens import Doc, Span +from spacy.training import Example, iob_to_biluo, split_bilu_label +from spacy.vocab import Vocab + +from ..util import make_tempdir + +TRAIN_DATA = [ + ("Who is Shaka Khan?", {"entities": [(7, 17, "PERSON")]}), + ("I like London and Berlin.", {"entities": [(7, 13, "LOC"), (18, 24, "LOC")]}), +] + + +@pytest.fixture +def neg_key(): + return "non_entities" + + +@pytest.fixture +def vocab(): + return Vocab() + + +@pytest.fixture +def doc(vocab): + return Doc(vocab, words=["Casey", "went", "to", "New", "York", "."]) + + +@pytest.fixture +def entity_annots(doc): + casey = doc[0:1] + ny = doc[3:5] + return [ + (casey.start_char, casey.end_char, "PERSON"), + (ny.start_char, ny.end_char, "GPE"), + ] + + +@pytest.fixture +def entity_types(entity_annots): + return sorted(set([label for (s, e, label) in entity_annots])) + + +@pytest.fixture +def tsys(vocab, entity_types): + actions = BiluoPushDown.get_actions(entity_types=entity_types) + return BiluoPushDown(vocab.strings, actions) + + +@pytest.mark.parametrize("label", ["U-JOB-NAME"]) +@pytest.mark.issue(1967) +def test_issue1967(label): + nlp = Language() + config = {} + ner = nlp.create_pipe("ner", config=config) + example = Example.from_dict( + Doc(ner.vocab, words=["word"]), + { + "ids": [0], + "words": ["word"], + "tags": ["tag"], + "heads": [0], + "deps": ["dep"], + "entities": [label], + }, + ) + assert "JOB-NAME" in ner.moves.get_actions(examples=[example])[1] + + +@pytest.mark.issue(2179) +def test_issue2179(): + """Test that spurious 'extra_labels' aren't created when initializing NER.""" + nlp = Italian() + ner = nlp.add_pipe("ner") + ner.add_label("CITIZENSHIP") + nlp.initialize() + nlp2 = Italian() + nlp2.add_pipe("ner") + assert len(nlp2.get_pipe("ner").labels) == 0 + model = nlp2.get_pipe("ner").model + model.attrs["resize_output"](model, nlp.get_pipe("ner").moves.n_moves) + nlp2.from_bytes(nlp.to_bytes()) + assert "extra_labels" not in nlp2.get_pipe("ner").cfg + assert nlp2.get_pipe("ner").labels == ("CITIZENSHIP",) + + +@pytest.mark.issue(2385) +def test_issue2385(): + """Test that IOB tags are correctly converted to BILUO tags.""" + # fix bug in labels with a 'b' character + tags1 = ("B-BRAWLER", "I-BRAWLER", "I-BRAWLER") + assert iob_to_biluo(tags1) == ["B-BRAWLER", "I-BRAWLER", "L-BRAWLER"] + # maintain support for iob1 format + tags2 = ("I-ORG", "I-ORG", "B-ORG") + assert iob_to_biluo(tags2) == ["B-ORG", "L-ORG", "U-ORG"] + # maintain support for iob2 format + tags3 = ("B-PERSON", "I-PERSON", "B-PERSON") + assert iob_to_biluo(tags3) == ["B-PERSON", "L-PERSON", "U-PERSON"] + # ensure it works with hyphens in the name + tags4 = ("B-MULTI-PERSON", "I-MULTI-PERSON", "B-MULTI-PERSON") + assert iob_to_biluo(tags4) == ["B-MULTI-PERSON", "L-MULTI-PERSON", "U-MULTI-PERSON"] + + +@pytest.mark.issue(2800) +def test_issue2800(): + """Test issue that arises when too many labels are added to NER model. + Used to cause segfault. + """ + nlp = English() + train_data = [] + train_data.extend( + [Example.from_dict(nlp.make_doc("One sentence"), {"entities": []})] + ) + entity_types = [str(i) for i in range(1000)] + ner = nlp.add_pipe("ner") + for entity_type in list(entity_types): + ner.add_label(entity_type) + optimizer = nlp.initialize() + for i in range(20): + losses = {} + random.shuffle(train_data) + for example in train_data: + nlp.update([example], sgd=optimizer, losses=losses, drop=0.5) + + +@pytest.mark.issue(3209) +def test_issue3209(): + """Test issue that occurred in spaCy nightly where NER labels were being + mapped to classes incorrectly after loading the model, when the labels + were added using ner.add_label(). + """ + nlp = English() + ner = nlp.add_pipe("ner") + ner.add_label("ANIMAL") + nlp.initialize() + move_names = ["O", "B-ANIMAL", "I-ANIMAL", "L-ANIMAL", "U-ANIMAL"] + assert ner.move_names == move_names + nlp2 = English() + ner2 = nlp2.add_pipe("ner") + model = ner2.model + model.attrs["resize_output"](model, ner.moves.n_moves) + nlp2.from_bytes(nlp.to_bytes()) + assert ner2.move_names == move_names + + +def test_labels_from_BILUO(): + """Test that labels are inferred correctly when there's a - in label.""" + nlp = English() + ner = nlp.add_pipe("ner") + ner.add_label("LARGE-ANIMAL") + nlp.initialize() + move_names = [ + "O", + "B-LARGE-ANIMAL", + "I-LARGE-ANIMAL", + "L-LARGE-ANIMAL", + "U-LARGE-ANIMAL", + ] + labels = {"LARGE-ANIMAL"} + assert ner.move_names == move_names + assert set(ner.labels) == labels + + +@pytest.mark.issue(4267) +def test_issue4267(): + """Test that running an entity_ruler after ner gives consistent results""" + nlp = English() + ner = nlp.add_pipe("ner") + ner.add_label("PEOPLE") + nlp.initialize() + assert "ner" in nlp.pipe_names + # assert that we have correct IOB annotations + doc1 = nlp("hi") + assert doc1.has_annotation("ENT_IOB") + for token in doc1: + assert token.ent_iob == 2 + # add entity ruler and run again + patterns = [{"label": "SOFTWARE", "pattern": "spacy"}] + ruler = nlp.add_pipe("entity_ruler") + ruler.add_patterns(patterns) + assert "entity_ruler" in nlp.pipe_names + assert "ner" in nlp.pipe_names + # assert that we still have correct IOB annotations + doc2 = nlp("hi") + assert doc2.has_annotation("ENT_IOB") + for token in doc2: + assert token.ent_iob == 2 + + +@pytest.mark.issue(4313) +def test_issue4313(): + """This should not crash or exit with some strange error code""" + beam_width = 16 + beam_density = 0.0001 + nlp = English() + config = { + "beam_width": beam_width, + "beam_density": beam_density, + } + ner = nlp.add_pipe("beam_ner", config=config) + ner.add_label("SOME_LABEL") + nlp.initialize() + # add a new label to the doc + doc = nlp("What do you think about Apple ?") + assert len(ner.labels) == 1 + assert "SOME_LABEL" in ner.labels + apple_ent = Span(doc, 5, 6, label="MY_ORG") + doc.ents = list(doc.ents) + [apple_ent] + + # ensure the beam_parse still works with the new label + docs = [doc] + ner.beam_parse(docs, drop=0.0, beam_width=beam_width, beam_density=beam_density) + assert len(ner.labels) == 2 + assert "MY_ORG" in ner.labels + + +def test_get_oracle_moves(tsys, doc, entity_annots): + example = Example.from_dict(doc, {"entities": entity_annots}) + act_classes = tsys.get_oracle_sequence(example, _debug=False) + names = [tsys.get_class_name(act) for act in act_classes] + assert names == ["U-PERSON", "O", "O", "B-GPE", "L-GPE", "O"] + + +def test_negative_samples_two_word_input(tsys, vocab, neg_key): + """Test that we don't get stuck in a two word input when we have a negative + span. This could happen if we don't have the right check on the B action. + """ + tsys.cfg["neg_key"] = neg_key + doc = Doc(vocab, words=["A", "B"]) + entity_annots = [None, None] + example = Example.from_dict(doc, {"entities": entity_annots}) + # These mean that the oracle sequence shouldn't have O for the first + # word, and it shouldn't analyse it as B-PERSON, L-PERSON + example.y.spans[neg_key] = [ + Span(example.y, 0, 1, label="O"), + Span(example.y, 0, 2, label="PERSON"), + ] + act_classes = tsys.get_oracle_sequence(example) + names = [tsys.get_class_name(act) for act in act_classes] + assert names + assert names[0] != "O" + assert names[0] != "B-PERSON" + assert names[1] != "L-PERSON" + + +def test_negative_samples_three_word_input(tsys, vocab, neg_key): + """Test that we exclude a 2-word entity correctly using a negative example.""" + tsys.cfg["neg_key"] = neg_key + doc = Doc(vocab, words=["A", "B", "C"]) + entity_annots = [None, None, None] + example = Example.from_dict(doc, {"entities": entity_annots}) + # These mean that the oracle sequence shouldn't have O for the first + # word, and it shouldn't analyse it as B-PERSON, L-PERSON + example.y.spans[neg_key] = [ + Span(example.y, 0, 1, label="O"), + Span(example.y, 0, 2, label="PERSON"), + ] + act_classes = tsys.get_oracle_sequence(example) + names = [tsys.get_class_name(act) for act in act_classes] + assert names + assert names[0] != "O" + assert names[1] != "B-PERSON" + + +def test_negative_samples_U_entity(tsys, vocab, neg_key): + """Test that we exclude a 2-word entity correctly using a negative example.""" + tsys.cfg["neg_key"] = neg_key + doc = Doc(vocab, words=["A"]) + entity_annots = [None] + example = Example.from_dict(doc, {"entities": entity_annots}) + # These mean that the oracle sequence shouldn't have O for the first + # word, and it shouldn't analyse it as B-PERSON, L-PERSON + example.y.spans[neg_key] = [ + Span(example.y, 0, 1, label="O"), + Span(example.y, 0, 1, label="PERSON"), + ] + act_classes = tsys.get_oracle_sequence(example) + names = [tsys.get_class_name(act) for act in act_classes] + assert names + assert names[0] != "O" + assert names[0] != "U-PERSON" + + +def test_negative_sample_key_is_in_config(vocab, entity_types): + actions = BiluoPushDown.get_actions(entity_types=entity_types) + tsys = BiluoPushDown(vocab.strings, actions, incorrect_spans_key="non_entities") + assert tsys.cfg["neg_key"] == "non_entities" + + +# We can't easily represent this on a Doc object. Not sure what the best solution +# would be, but I don't think it's an important use case? +@pytest.mark.skip(reason="No longer supported") +def test_oracle_moves_missing_B(en_vocab): + words = ["B", "52", "Bomber"] + biluo_tags = [None, None, "L-PRODUCT"] + + doc = Doc(en_vocab, words=words) + example = Example.from_dict(doc, {"words": words, "entities": biluo_tags}) + + moves = BiluoPushDown(en_vocab.strings) + move_types = ("M", "B", "I", "L", "U", "O") + for tag in biluo_tags: + if tag is None: + continue + elif tag == "O": + moves.add_action(move_types.index("O"), "") + else: + action, label = split_bilu_label(tag) + moves.add_action(move_types.index("B"), label) + moves.add_action(move_types.index("I"), label) + moves.add_action(move_types.index("L"), label) + moves.add_action(move_types.index("U"), label) + moves.get_oracle_sequence(example) + + +# We can't easily represent this on a Doc object. Not sure what the best solution +# would be, but I don't think it's an important use case? +@pytest.mark.skip(reason="No longer supported") +def test_oracle_moves_whitespace(en_vocab): + words = ["production", "\n", "of", "Northrop", "\n", "Corp.", "\n", "'s", "radar"] + biluo_tags = ["O", "O", "O", "B-ORG", None, "I-ORG", "L-ORG", "O", "O"] + + doc = Doc(en_vocab, words=words) + example = Example.from_dict(doc, {"entities": biluo_tags}) + + moves = BiluoPushDown(en_vocab.strings) + move_types = ("M", "B", "I", "L", "U", "O") + for tag in biluo_tags: + if tag is None: + continue + elif tag == "O": + moves.add_action(move_types.index("O"), "") + else: + action, label = split_bilu_label(tag) + moves.add_action(move_types.index(action), label) + moves.get_oracle_sequence(example) + + +def test_accept_blocked_token(): + """Test succesful blocking of tokens to be in an entity.""" + # 1. test normal behaviour + nlp1 = English() + doc1 = nlp1("I live in New York") + config = {} + ner1 = nlp1.create_pipe("ner", config=config) + assert [token.ent_iob_ for token in doc1] == ["", "", "", "", ""] + assert [token.ent_type_ for token in doc1] == ["", "", "", "", ""] + + # Add the OUT action + ner1.moves.add_action(5, "") + ner1.add_label("GPE") + # Get into the state just before "New" + state1 = ner1.moves.init_batch([doc1])[0] + ner1.moves.apply_transition(state1, "O") + ner1.moves.apply_transition(state1, "O") + ner1.moves.apply_transition(state1, "O") + # Check that B-GPE is valid. + assert ner1.moves.is_valid(state1, "B-GPE") + + # 2. test blocking behaviour + nlp2 = English() + doc2 = nlp2("I live in New York") + config = {} + ner2 = nlp2.create_pipe("ner", config=config) + + # set "New York" to a blocked entity + doc2.set_ents([], blocked=[doc2[3:5]], default="unmodified") + assert [token.ent_iob_ for token in doc2] == ["", "", "", "B", "B"] + assert [token.ent_type_ for token in doc2] == ["", "", "", "", ""] + + # Check that B-GPE is now invalid. + ner2.moves.add_action(4, "") + ner2.moves.add_action(5, "") + ner2.add_label("GPE") + state2 = ner2.moves.init_batch([doc2])[0] + ner2.moves.apply_transition(state2, "O") + ner2.moves.apply_transition(state2, "O") + ner2.moves.apply_transition(state2, "O") + # we can only use U- for "New" + assert not ner2.moves.is_valid(state2, "B-GPE") + assert ner2.moves.is_valid(state2, "U-") + ner2.moves.apply_transition(state2, "U-") + # we can only use U- for "York" + assert not ner2.moves.is_valid(state2, "B-GPE") + assert ner2.moves.is_valid(state2, "U-") + + +def test_train_empty(): + """Test that training an empty text does not throw errors.""" + train_data = [ + ("Who is Shaka Khan?", {"entities": [(7, 17, "PERSON")]}), + ("", {"entities": []}), + ] + + nlp = English() + train_examples = [] + for t in train_data: + train_examples.append(Example.from_dict(nlp.make_doc(t[0]), t[1])) + ner = nlp.add_pipe("ner", last=True) + ner.add_label("PERSON") + nlp.initialize() + for itn in range(2): + losses = {} + batches = util.minibatch(train_examples, size=8) + for batch in batches: + nlp.update(batch, losses=losses) + + +def test_train_negative_deprecated(): + """Test that the deprecated negative entity format raises a custom error.""" + train_data = [ + ("Who is Shaka Khan?", {"entities": [(7, 17, "!PERSON")]}), + ] + + nlp = English() + train_examples = [] + for t in train_data: + train_examples.append(Example.from_dict(nlp.make_doc(t[0]), t[1])) + ner = nlp.add_pipe("ner", last=True) + ner.add_label("PERSON") + nlp.initialize() + for itn in range(2): + losses = {} + batches = util.minibatch(train_examples, size=8) + for batch in batches: + with pytest.raises(ValueError): + nlp.update(batch, losses=losses) + + +def test_overwrite_token(): + nlp = English() + nlp.add_pipe("ner") + nlp.initialize() + # The untrained NER will predict O for each token + doc = nlp("I live in New York") + assert [token.ent_iob_ for token in doc] == ["O", "O", "O", "O", "O"] + assert [token.ent_type_ for token in doc] == ["", "", "", "", ""] + # Check that a new ner can overwrite O + config = {} + ner2 = nlp.create_pipe("ner", config=config) + ner2.moves.add_action(5, "") + ner2.add_label("GPE") + state = ner2.moves.init_batch([doc])[0] + assert ner2.moves.is_valid(state, "B-GPE") + assert ner2.moves.is_valid(state, "U-GPE") + ner2.moves.apply_transition(state, "B-GPE") + assert ner2.moves.is_valid(state, "I-GPE") + assert ner2.moves.is_valid(state, "L-GPE") + + +def test_empty_ner(): + nlp = English() + ner = nlp.add_pipe("ner") + ner.add_label("MY_LABEL") + nlp.initialize() + doc = nlp("John is watching the news about Croatia's elections") + # if this goes wrong, the initialization of the parser's upper layer is probably broken + result = ["O", "O", "O", "O", "O", "O", "O", "O", "O"] + assert [token.ent_iob_ for token in doc] == result + + +def test_ruler_before_ner(): + """Test that an NER works after an entity_ruler: the second can add annotations""" + nlp = English() + + # 1 : Entity Ruler - should set "this" to B and everything else to empty + patterns = [{"label": "THING", "pattern": "This"}] + ruler = nlp.add_pipe("entity_ruler") + + # 2: untrained NER - should set everything else to O + untrained_ner = nlp.add_pipe("ner") + untrained_ner.add_label("MY_LABEL") + nlp.initialize() + ruler.add_patterns(patterns) + doc = nlp("This is Antti Korhonen speaking in Finland") + expected_iobs = ["B", "O", "O", "O", "O", "O", "O"] + expected_types = ["THING", "", "", "", "", "", ""] + assert [token.ent_iob_ for token in doc] == expected_iobs + assert [token.ent_type_ for token in doc] == expected_types + + +def test_ner_constructor(en_vocab): + config = { + "update_with_oracle_cut_size": 100, + } + cfg = {"model": DEFAULT_NER_MODEL} + model = registry.resolve(cfg, validate=True)["model"] + EntityRecognizer(en_vocab, model, **config) + EntityRecognizer(en_vocab, model) + + +def test_ner_before_ruler(): + """Test that an entity_ruler works after an NER: the second can overwrite O annotations""" + nlp = English() + + # 1: untrained NER - should set everything to O + untrained_ner = nlp.add_pipe("ner", name="uner") + untrained_ner.add_label("MY_LABEL") + nlp.initialize() + + # 2 : Entity Ruler - should set "this" to B and keep everything else O + patterns = [{"label": "THING", "pattern": "This"}] + ruler = nlp.add_pipe("entity_ruler") + ruler.add_patterns(patterns) + + doc = nlp("This is Antti Korhonen speaking in Finland") + expected_iobs = ["B", "O", "O", "O", "O", "O", "O"] + expected_types = ["THING", "", "", "", "", "", ""] + assert [token.ent_iob_ for token in doc] == expected_iobs + assert [token.ent_type_ for token in doc] == expected_types + + +def test_block_ner(): + """Test functionality for blocking tokens so they can't be in a named entity""" + # block "Antti L Korhonen" from being a named entity + nlp = English() + nlp.add_pipe("blocker", config={"start": 2, "end": 5}) + untrained_ner = nlp.add_pipe("ner") + untrained_ner.add_label("MY_LABEL") + nlp.initialize() + doc = nlp("This is Antti L Korhonen speaking in Finland") + expected_iobs = ["O", "O", "B", "B", "B", "O", "O", "O"] + expected_types = ["", "", "", "", "", "", "", ""] + assert [token.ent_iob_ for token in doc] == expected_iobs + assert [token.ent_type_ for token in doc] == expected_types + + +@pytest.mark.parametrize("use_upper", [True, False]) +def test_overfitting_IO(use_upper): + # Simple test to try and quickly overfit the NER component + nlp = English() + ner = nlp.add_pipe("ner", config={"model": {"use_upper": use_upper}}) + train_examples = [] + for text, annotations in TRAIN_DATA: + train_examples.append(Example.from_dict(nlp.make_doc(text), annotations)) + for ent in annotations.get("entities"): + ner.add_label(ent[2]) + optimizer = nlp.initialize() + + for i in range(50): + losses = {} + nlp.update(train_examples, sgd=optimizer, losses=losses) + assert losses["ner"] < 0.00001 + + # test the trained model + test_text = "I like London." + doc = nlp(test_text) + ents = doc.ents + assert len(ents) == 1 + assert ents[0].text == "London" + assert ents[0].label_ == "LOC" + + # Also test the results are still the same after IO + with make_tempdir() as tmp_dir: + nlp.to_disk(tmp_dir) + nlp2 = util.load_model_from_path(tmp_dir) + doc2 = nlp2(test_text) + ents2 = doc2.ents + assert len(ents2) == 1 + assert ents2[0].text == "London" + assert ents2[0].label_ == "LOC" + # Ensure that the predictions are still the same, even after adding a new label + ner2 = nlp2.get_pipe("ner") + assert ner2.model.attrs["has_upper"] == use_upper + ner2.add_label("RANDOM_NEW_LABEL") + doc3 = nlp2(test_text) + ents3 = doc3.ents + assert len(ents3) == 1 + assert ents3[0].text == "London" + assert ents3[0].label_ == "LOC" + + # Make sure that running pipe twice, or comparing to call, always amounts to the same predictions + texts = [ + "Just a sentence.", + "Then one more sentence about London.", + "Here is another one.", + "I like London.", + ] + batch_deps_1 = [doc.to_array([ENT_IOB]) for doc in nlp.pipe(texts)] + batch_deps_2 = [doc.to_array([ENT_IOB]) for doc in nlp.pipe(texts)] + no_batch_deps = [doc.to_array([ENT_IOB]) for doc in [nlp(text) for text in texts]] + assert_equal(batch_deps_1, batch_deps_2) + assert_equal(batch_deps_1, no_batch_deps) + + # test that kb_id is preserved + test_text = "I like London and London." + doc = nlp.make_doc(test_text) + doc.ents = [Span(doc, 2, 3, label="LOC", kb_id=1234)] + ents = doc.ents + assert len(ents) == 1 + assert ents[0].text == "London" + assert ents[0].label_ == "LOC" + assert ents[0].kb_id == 1234 + doc = nlp.get_pipe("ner")(doc) + ents = doc.ents + assert len(ents) == 2 + assert ents[0].text == "London" + assert ents[0].label_ == "LOC" + assert ents[0].kb_id == 1234 + # ent added by ner has kb_id == 0 + assert ents[1].text == "London" + assert ents[1].label_ == "LOC" + assert ents[1].kb_id == 0 + + +def test_beam_ner_scores(): + # Test that we can get confidence values out of the beam_ner pipe + beam_width = 16 + beam_density = 0.0001 + nlp = English() + config = { + "beam_width": beam_width, + "beam_density": beam_density, + } + ner = nlp.add_pipe("beam_ner", config=config) + train_examples = [] + for text, annotations in TRAIN_DATA: + train_examples.append(Example.from_dict(nlp.make_doc(text), annotations)) + for ent in annotations.get("entities"): + ner.add_label(ent[2]) + optimizer = nlp.initialize() + + # update once + losses = {} + nlp.update(train_examples, sgd=optimizer, losses=losses) + + # test the scores from the beam + test_text = "I like London." + doc = nlp.make_doc(test_text) + docs = [doc] + beams = ner.predict(docs) + entity_scores = ner.scored_ents(beams)[0] + + for j in range(len(doc)): + for label in ner.labels: + score = entity_scores[(j, j + 1, label)] + eps = 0.00001 + assert 0 - eps <= score <= 1 + eps + + +def test_beam_overfitting_IO(neg_key): + # Simple test to try and quickly overfit the Beam NER component + nlp = English() + beam_width = 16 + beam_density = 0.0001 + config = { + "beam_width": beam_width, + "beam_density": beam_density, + "incorrect_spans_key": neg_key, + } + ner = nlp.add_pipe("beam_ner", config=config) + train_examples = [] + for text, annotations in TRAIN_DATA: + train_examples.append(Example.from_dict(nlp.make_doc(text), annotations)) + for ent in annotations.get("entities"): + ner.add_label(ent[2]) + optimizer = nlp.initialize() + + # run overfitting + for i in range(50): + losses = {} + nlp.update(train_examples, sgd=optimizer, losses=losses) + assert losses["beam_ner"] < 0.0001 + + # test the scores from the beam + test_text = "I like London" + docs = [nlp.make_doc(test_text)] + beams = ner.predict(docs) + entity_scores = ner.scored_ents(beams)[0] + assert entity_scores[(2, 3, "LOC")] == 1.0 + assert entity_scores[(2, 3, "PERSON")] == 0.0 + assert len(nlp(test_text).ents) == 1 + + # Also test the results are still the same after IO + with make_tempdir() as tmp_dir: + nlp.to_disk(tmp_dir) + nlp2 = util.load_model_from_path(tmp_dir) + docs2 = [nlp2.make_doc(test_text)] + ner2 = nlp2.get_pipe("beam_ner") + beams2 = ner2.predict(docs2) + entity_scores2 = ner2.scored_ents(beams2)[0] + assert entity_scores2[(2, 3, "LOC")] == 1.0 + assert entity_scores2[(2, 3, "PERSON")] == 0.0 + + # Try to unlearn the entity by using negative annotations + neg_doc = nlp.make_doc(test_text) + neg_ex = Example(neg_doc, neg_doc) + neg_ex.reference.spans[neg_key] = [Span(neg_doc, 2, 3, "LOC")] + neg_train_examples = [neg_ex] + + for i in range(20): + losses = {} + nlp.update(neg_train_examples, sgd=optimizer, losses=losses) + + # test the "untrained" model + assert len(nlp(test_text).ents) == 0 + + +def test_neg_annotation(neg_key): + """Check that the NER update works with a negative annotation that is a different label of the correct one, + or partly overlapping, etc""" + nlp = English() + beam_width = 16 + beam_density = 0.0001 + config = { + "beam_width": beam_width, + "beam_density": beam_density, + "incorrect_spans_key": neg_key, + } + ner = nlp.add_pipe("beam_ner", config=config) + train_text = "Who is Shaka Khan?" + neg_doc = nlp.make_doc(train_text) + ner.add_label("PERSON") + ner.add_label("ORG") + example = Example.from_dict(neg_doc, {"entities": [(7, 17, "PERSON")]}) + example.reference.spans[neg_key] = [ + Span(example.reference, 2, 4, "ORG"), + Span(example.reference, 2, 3, "PERSON"), + Span(example.reference, 1, 4, "PERSON"), + ] + + optimizer = nlp.initialize() + for i in range(2): + losses = {} + nlp.update([example], sgd=optimizer, losses=losses) + + +def test_neg_annotation_conflict(neg_key): + # Check that NER raises for a negative annotation that is THE SAME as a correct one + nlp = English() + beam_width = 16 + beam_density = 0.0001 + config = { + "beam_width": beam_width, + "beam_density": beam_density, + "incorrect_spans_key": neg_key, + } + ner = nlp.add_pipe("beam_ner", config=config) + train_text = "Who is Shaka Khan?" + neg_doc = nlp.make_doc(train_text) + ner.add_label("PERSON") + ner.add_label("LOC") + example = Example.from_dict(neg_doc, {"entities": [(7, 17, "PERSON")]}) + example.reference.spans[neg_key] = [Span(example.reference, 2, 4, "PERSON")] + assert len(example.reference.ents) == 1 + assert example.reference.ents[0].text == "Shaka Khan" + assert example.reference.ents[0].label_ == "PERSON" + assert len(example.reference.spans[neg_key]) == 1 + assert example.reference.spans[neg_key][0].text == "Shaka Khan" + assert example.reference.spans[neg_key][0].label_ == "PERSON" + + optimizer = nlp.initialize() + for i in range(2): + losses = {} + with pytest.raises(ValueError): + nlp.update([example], sgd=optimizer, losses=losses) + + +def test_beam_valid_parse(neg_key): + """Regression test for previously flakey behaviour""" + nlp = English() + beam_width = 16 + beam_density = 0.0001 + config = { + "beam_width": beam_width, + "beam_density": beam_density, + "incorrect_spans_key": neg_key, + } + nlp.add_pipe("beam_ner", config=config) + # fmt: off + tokens = ['FEDERAL', 'NATIONAL', 'MORTGAGE', 'ASSOCIATION', '(', 'Fannie', 'Mae', '):', 'Posted', 'yields', 'on', '30', 'year', 'mortgage', 'commitments', 'for', 'delivery', 'within', '30', 'days', '(', 'priced', 'at', 'par', ')', '9.75', '%', ',', 'standard', 'conventional', 'fixed', '-', 'rate', 'mortgages', ';', '8.70', '%', ',', '6/2', 'rate', 'capped', 'one', '-', 'year', 'adjustable', 'rate', 'mortgages', '.', 'Source', ':', 'Telerate', 'Systems', 'Inc.'] + iob = ['B-ORG', 'I-ORG', 'I-ORG', 'L-ORG', 'O', 'B-ORG', 'L-ORG', 'O', 'O', 'O', 'O', 'B-DATE', 'L-DATE', 'O', 'O', 'O', 'O', 'O', 'B-DATE', 'L-DATE', 'O', 'O', 'O', 'O', 'O', 'B-PERCENT', 'L-PERCENT', 'O', 'O', 'O', 'O', 'O', 'O', 'O', 'O', 'B-PERCENT', 'L-PERCENT', 'O', 'U-CARDINAL', 'O', 'O', 'B-DATE', 'I-DATE', 'L-DATE', 'O', 'O', 'O', 'O', 'O', 'O', 'O', 'O', 'O'] + # fmt: on + + doc = Doc(nlp.vocab, words=tokens) + example = Example.from_dict(doc, {"ner": iob}) + neg_span = Span(example.reference, 50, 53, "ORG") + example.reference.spans[neg_key] = [neg_span] + + optimizer = nlp.initialize() + + for i in range(5): + losses = {} + nlp.update([example], sgd=optimizer, losses=losses) + assert "beam_ner" in losses + + +def test_ner_warns_no_lookups(caplog): + nlp = English() + assert nlp.lang in util.LEXEME_NORM_LANGS + nlp.vocab.lookups = Lookups() + assert not len(nlp.vocab.lookups) + nlp.add_pipe("ner") + with caplog.at_level(logging.DEBUG): + nlp.initialize() + assert "W033" in caplog.text + caplog.clear() + nlp.vocab.lookups.add_table("lexeme_norm") + nlp.vocab.lookups.get_table("lexeme_norm")["a"] = "A" + with caplog.at_level(logging.DEBUG): + nlp.initialize() + assert "W033" not in caplog.text + + +@Language.factory("blocker") +class BlockerComponent1: + def __init__(self, nlp, start, end, name="my_blocker"): + self.start = start + self.end = end + self.name = name + + def __call__(self, doc): + doc.set_ents([], blocked=[doc[self.start : self.end]], default="unmodified") + return doc diff --git a/TTS/Kokoro/.venv/Lib/site-packages/spacy/tests/parser/test_neural_parser.py b/TTS/Kokoro/.venv/Lib/site-packages/spacy/tests/parser/test_neural_parser.py new file mode 100644 index 0000000000000000000000000000000000000000..9b3d9a14368c7297102ff2871d4bd44496516717 --- /dev/null +++ b/TTS/Kokoro/.venv/Lib/site-packages/spacy/tests/parser/test_neural_parser.py @@ -0,0 +1,110 @@ +import pytest +from thinc.api import Model + +from spacy import registry +from spacy.pipeline._parser_internals.arc_eager import ArcEager +from spacy.pipeline.dep_parser import DEFAULT_PARSER_MODEL +from spacy.pipeline.tok2vec import DEFAULT_TOK2VEC_MODEL +from spacy.pipeline.transition_parser import Parser +from spacy.tokens.doc import Doc +from spacy.training import Example +from spacy.vocab import Vocab + + +@pytest.fixture +def vocab(): + return Vocab() + + +@pytest.fixture +def arc_eager(vocab): + actions = ArcEager.get_actions(left_labels=["L"], right_labels=["R"]) + return ArcEager(vocab.strings, actions) + + +@pytest.fixture +def tok2vec(): + cfg = {"model": DEFAULT_TOK2VEC_MODEL} + tok2vec = registry.resolve(cfg, validate=True)["model"] + tok2vec.initialize() + return tok2vec + + +@pytest.fixture +def parser(vocab, arc_eager): + config = { + "learn_tokens": False, + "min_action_freq": 30, + "update_with_oracle_cut_size": 100, + } + cfg = {"model": DEFAULT_PARSER_MODEL} + model = registry.resolve(cfg, validate=True)["model"] + return Parser(vocab, model, moves=arc_eager, **config) + + +@pytest.fixture +def model(arc_eager, tok2vec, vocab): + cfg = {"model": DEFAULT_PARSER_MODEL} + model = registry.resolve(cfg, validate=True)["model"] + model.attrs["resize_output"](model, arc_eager.n_moves) + model.initialize() + return model + + +@pytest.fixture +def doc(vocab): + return Doc(vocab, words=["a", "b", "c"]) + + +@pytest.fixture +def gold(doc): + return {"heads": [1, 1, 1], "deps": ["L", "ROOT", "R"]} + + +def test_can_init_nn_parser(parser): + assert isinstance(parser.model, Model) + + +def test_build_model(parser, vocab): + config = { + "learn_tokens": False, + "min_action_freq": 0, + "update_with_oracle_cut_size": 100, + } + cfg = {"model": DEFAULT_PARSER_MODEL} + model = registry.resolve(cfg, validate=True)["model"] + parser.model = Parser(vocab, model=model, moves=parser.moves, **config).model + assert parser.model is not None + + +def test_predict_doc(parser, tok2vec, model, doc): + doc.tensor = tok2vec.predict([doc])[0] + parser.model = model + parser(doc) + + +def test_update_doc(parser, model, doc, gold): + parser.model = model + + def optimize(key, weights, gradient): + weights -= 0.001 * gradient + return weights, gradient + + example = Example.from_dict(doc, gold) + parser.update([example], sgd=optimize) + + +@pytest.mark.skip(reason="No longer supported") +def test_predict_doc_beam(parser, model, doc): + parser.model = model + parser(doc, beam_width=32, beam_density=0.001) + + +@pytest.mark.skip(reason="No longer supported") +def test_update_doc_beam(parser, model, doc, gold): + parser.model = model + + def optimize(weights, gradient, key=None): + weights -= 0.001 * gradient + + parser.update_beam((doc, gold), sgd=optimize) diff --git a/TTS/Kokoro/.venv/Lib/site-packages/spacy/tests/parser/test_nn_beam.py b/TTS/Kokoro/.venv/Lib/site-packages/spacy/tests/parser/test_nn_beam.py new file mode 100644 index 0000000000000000000000000000000000000000..bd5173adcd566957a60b3cc41acf03b5809932af --- /dev/null +++ b/TTS/Kokoro/.venv/Lib/site-packages/spacy/tests/parser/test_nn_beam.py @@ -0,0 +1,143 @@ +import hypothesis +import hypothesis.strategies +import numpy +import pytest +from thinc.tests.strategies import ndarrays_of_shape + +from spacy.language import Language +from spacy.pipeline._parser_internals._beam_utils import BeamBatch +from spacy.pipeline._parser_internals.arc_eager import ArcEager +from spacy.pipeline._parser_internals.stateclass import StateClass +from spacy.tokens import Doc +from spacy.training import Example +from spacy.vocab import Vocab + + +@pytest.fixture(scope="module") +def vocab(): + return Vocab() + + +@pytest.fixture(scope="module") +def moves(vocab): + aeager = ArcEager(vocab.strings, {}) + aeager.add_action(0, "") + aeager.add_action(1, "") + aeager.add_action(2, "nsubj") + aeager.add_action(2, "punct") + aeager.add_action(2, "aux") + aeager.add_action(2, "nsubjpass") + aeager.add_action(3, "dobj") + aeager.add_action(2, "aux") + aeager.add_action(4, "ROOT") + return aeager + + +@pytest.fixture(scope="module") +def docs(vocab): + return [ + Doc( + vocab, + words=["Rats", "bite", "things"], + heads=[1, 1, 1], + deps=["nsubj", "ROOT", "dobj"], + sent_starts=[True, False, False], + ) + ] + + +@pytest.fixture(scope="module") +def examples(docs): + return [Example(doc, doc.copy()) for doc in docs] + + +@pytest.fixture +def states(docs): + return [StateClass(doc) for doc in docs] + + +@pytest.fixture +def tokvecs(docs, vector_size): + output = [] + for doc in docs: + vec = numpy.random.uniform(-0.1, 0.1, (len(doc), vector_size)) + output.append(numpy.asarray(vec)) + return output + + +@pytest.fixture(scope="module") +def batch_size(docs): + return len(docs) + + +@pytest.fixture(scope="module") +def beam_width(): + return 4 + + +@pytest.fixture(params=[0.0, 0.5, 1.0]) +def beam_density(request): + return request.param + + +@pytest.fixture +def vector_size(): + return 6 + + +@pytest.fixture +def beam(moves, examples, beam_width): + states, golds, _ = moves.init_gold_batch(examples) + return BeamBatch(moves, states, golds, width=beam_width, density=0.0) + + +@pytest.fixture +def scores(moves, batch_size, beam_width): + return numpy.asarray( + numpy.concatenate( + [ + numpy.random.uniform(-0.1, 0.1, (beam_width, moves.n_moves)) + for _ in range(batch_size) + ] + ), + dtype="float32", + ) + + +def test_create_beam(beam): + pass + + +def test_beam_advance(beam, scores): + beam.advance(scores) + + +def test_beam_advance_too_few_scores(beam, scores): + n_state = sum(len(beam) for beam in beam) + scores = scores[:n_state] + with pytest.raises(IndexError): + beam.advance(scores[:-1]) + + +def test_beam_parse(examples, beam_width): + nlp = Language() + parser = nlp.add_pipe("beam_parser") + parser.cfg["beam_width"] = beam_width + parser.add_label("nsubj") + parser.initialize(lambda: examples) + doc = nlp.make_doc("Australia is a country") + parser(doc) + + +@hypothesis.given(hyp=hypothesis.strategies.data()) +def test_beam_density(moves, examples, beam_width, hyp): + beam_density = float(hyp.draw(hypothesis.strategies.floats(0.0, 1.0, width=32))) + states, golds, _ = moves.init_gold_batch(examples) + beam = BeamBatch(moves, states, golds, width=beam_width, density=beam_density) + n_state = sum(len(beam) for beam in beam) + scores = hyp.draw(ndarrays_of_shape((n_state, moves.n_moves))) + beam.advance(scores) + for b in beam: + beam_probs = b.probs + assert b.min_density == beam_density + assert beam_probs[-1] >= beam_probs[0] * beam_density diff --git a/TTS/Kokoro/.venv/Lib/site-packages/spacy/tests/parser/test_nonproj.py b/TTS/Kokoro/.venv/Lib/site-packages/spacy/tests/parser/test_nonproj.py new file mode 100644 index 0000000000000000000000000000000000000000..393a8f9b7da151f62f1312dc23b8ac4e4c659dd5 --- /dev/null +++ b/TTS/Kokoro/.venv/Lib/site-packages/spacy/tests/parser/test_nonproj.py @@ -0,0 +1,154 @@ +import pytest + +from spacy.pipeline._parser_internals import nonproj +from spacy.pipeline._parser_internals.nonproj import ( + ancestors, + contains_cycle, + is_nonproj_arc, + is_nonproj_tree, +) +from spacy.tokens import Doc + + +@pytest.fixture +def tree(): + return [1, 2, 2, 4, 5, 2, 2] + + +@pytest.fixture +def cyclic_tree(): + return [1, 2, 2, 4, 5, 3, 2] + + +@pytest.fixture +def partial_tree(): + return [1, 2, 2, 4, 5, None, 7, 4, 2] + + +@pytest.fixture +def nonproj_tree(): + return [1, 2, 2, 4, 5, 2, 7, 4, 2] + + +@pytest.fixture +def proj_tree(): + return [1, 2, 2, 4, 5, 2, 7, 5, 2] + + +@pytest.fixture +def multirooted_tree(): + return [3, 2, 0, 3, 3, 7, 7, 3, 7, 10, 7, 10, 11, 12, 18, 16, 18, 17, 12, 3] + + +def test_parser_ancestors(tree, cyclic_tree, partial_tree, multirooted_tree): + assert [a for a in ancestors(3, tree)] == [4, 5, 2] + assert [a for a in ancestors(3, cyclic_tree)] == [4, 5, 3, 4, 5, 3, 4] + assert [a for a in ancestors(3, partial_tree)] == [4, 5, None] + assert [a for a in ancestors(17, multirooted_tree)] == [] + + +def test_parser_contains_cycle(tree, cyclic_tree, partial_tree, multirooted_tree): + assert contains_cycle(tree) is None + assert contains_cycle(cyclic_tree) == {3, 4, 5} + assert contains_cycle(partial_tree) is None + assert contains_cycle(multirooted_tree) is None + + +def test_parser_is_nonproj_arc( + cyclic_tree, nonproj_tree, partial_tree, multirooted_tree +): + assert is_nonproj_arc(0, nonproj_tree) is False + assert is_nonproj_arc(1, nonproj_tree) is False + assert is_nonproj_arc(2, nonproj_tree) is False + assert is_nonproj_arc(3, nonproj_tree) is False + assert is_nonproj_arc(4, nonproj_tree) is False + assert is_nonproj_arc(5, nonproj_tree) is False + assert is_nonproj_arc(6, nonproj_tree) is False + assert is_nonproj_arc(7, nonproj_tree) is True + assert is_nonproj_arc(8, nonproj_tree) is False + assert is_nonproj_arc(7, partial_tree) is False + assert is_nonproj_arc(17, multirooted_tree) is False + assert is_nonproj_arc(16, multirooted_tree) is True + with pytest.raises( + ValueError, match=r"Found cycle in dependency graph: \[1, 2, 2, 4, 5, 3, 2\]" + ): + is_nonproj_arc(6, cyclic_tree) + + +def test_parser_is_nonproj_tree( + proj_tree, cyclic_tree, nonproj_tree, partial_tree, multirooted_tree +): + assert is_nonproj_tree(proj_tree) is False + assert is_nonproj_tree(nonproj_tree) is True + assert is_nonproj_tree(partial_tree) is False + assert is_nonproj_tree(multirooted_tree) is True + with pytest.raises( + ValueError, match=r"Found cycle in dependency graph: \[1, 2, 2, 4, 5, 3, 2\]" + ): + is_nonproj_tree(cyclic_tree) + + +def test_parser_pseudoprojectivity(en_vocab): + def deprojectivize(proj_heads, deco_labels): + words = ["whatever "] * len(proj_heads) + doc = Doc(en_vocab, words=words, deps=deco_labels, heads=proj_heads) + nonproj.deprojectivize(doc) + return [t.head.i for t in doc], [token.dep_ for token in doc] + + # fmt: off + tree = [1, 2, 2] + nonproj_tree = [1, 2, 2, 4, 5, 2, 7, 4, 2] + nonproj_tree2 = [9, 1, 3, 1, 5, 6, 9, 8, 6, 1, 6, 12, 13, 10, 1] + cyclic_tree = [1, 2, 2, 4, 5, 3, 2] + labels = ["det", "nsubj", "root", "det", "dobj", "aux", "nsubj", "acl", "punct"] + labels2 = ["advmod", "root", "det", "nsubj", "advmod", "det", "dobj", "det", "nmod", "aux", "nmod", "advmod", "det", "amod", "punct"] + cyclic_labels = ["det", "nsubj", "root", "det", "dobj", "aux", "punct"] + # fmt: on + assert nonproj.decompose("X||Y") == ("X", "Y") + assert nonproj.decompose("X") == ("X", "") + assert nonproj.is_decorated("X||Y") is True + assert nonproj.is_decorated("X") is False + nonproj._lift(0, tree) + assert tree == [2, 2, 2] + assert nonproj.get_smallest_nonproj_arc_slow(nonproj_tree) == 7 + assert nonproj.get_smallest_nonproj_arc_slow(nonproj_tree2) == 10 + # fmt: off + proj_heads, deco_labels = nonproj.projectivize(nonproj_tree, labels) + with pytest.raises(ValueError, match=r'Found cycle in dependency graph: \[1, 2, 2, 4, 5, 3, 2\]'): + nonproj.projectivize(cyclic_tree, cyclic_labels) + assert proj_heads == [1, 2, 2, 4, 5, 2, 7, 5, 2] + assert deco_labels == ["det", "nsubj", "root", "det", "dobj", "aux", + "nsubj", "acl||dobj", "punct"] + deproj_heads, undeco_labels = deprojectivize(proj_heads, deco_labels) + assert deproj_heads == nonproj_tree + assert undeco_labels == labels + proj_heads, deco_labels = nonproj.projectivize(nonproj_tree2, labels2) + assert proj_heads == [1, 1, 3, 1, 5, 6, 9, 8, 6, 1, 9, 12, 13, 10, 1] + assert deco_labels == ["advmod||aux", "root", "det", "nsubj", "advmod", + "det", "dobj", "det", "nmod", "aux", "nmod||dobj", + "advmod", "det", "amod", "punct"] + deproj_heads, undeco_labels = deprojectivize(proj_heads, deco_labels) + assert deproj_heads == nonproj_tree2 + assert undeco_labels == labels2 + # if decoration is wrong such that there is no head with the desired label + # the structure is kept and the label is undecorated + proj_heads = [1, 2, 2, 4, 5, 2, 7, 5, 2] + deco_labels = ["det", "nsubj", "root", "det", "dobj", "aux", "nsubj", + "acl||iobj", "punct"] + deproj_heads, undeco_labels = deprojectivize(proj_heads, deco_labels) + assert deproj_heads == proj_heads + assert undeco_labels == ["det", "nsubj", "root", "det", "dobj", "aux", + "nsubj", "acl", "punct"] + # if there are two potential new heads, the first one is chosen even if + # it's wrong + proj_heads = [1, 1, 3, 1, 5, 6, 9, 8, 6, 1, 9, 12, 13, 10, 1] + deco_labels = ["advmod||aux", "root", "det", "aux", "advmod", "det", + "dobj", "det", "nmod", "aux", "nmod||dobj", "advmod", + "det", "amod", "punct"] + + deproj_heads, undeco_labels = deprojectivize(proj_heads, deco_labels) + assert deproj_heads == [3, 1, 3, 1, 5, 6, 9, 8, 6, 1, 6, 12, 13, 10, 1] + assert undeco_labels == ["advmod", "root", "det", "aux", "advmod", "det", + "dobj", "det", "nmod", "aux", "nmod", "advmod", + "det", "amod", "punct"] + # fmt: on diff --git a/TTS/Kokoro/.venv/Lib/site-packages/spacy/tests/parser/test_parse.py b/TTS/Kokoro/.venv/Lib/site-packages/spacy/tests/parser/test_parse.py new file mode 100644 index 0000000000000000000000000000000000000000..4794a52ed312b61d96a146255c6df64e196a8190 --- /dev/null +++ b/TTS/Kokoro/.venv/Lib/site-packages/spacy/tests/parser/test_parse.py @@ -0,0 +1,544 @@ +import pytest +from numpy.testing import assert_equal +from thinc.api import Adam + +from spacy import registry, util +from spacy.attrs import DEP, NORM +from spacy.lang.en import English +from spacy.pipeline import DependencyParser +from spacy.pipeline.dep_parser import DEFAULT_PARSER_MODEL +from spacy.pipeline.tok2vec import DEFAULT_TOK2VEC_MODEL +from spacy.tokens import Doc +from spacy.training import Example +from spacy.vocab import Vocab + +from ..util import apply_transition_sequence, make_tempdir + +TRAIN_DATA = [ + ( + "They trade mortgage-backed securities.", + { + "heads": [1, 1, 4, 4, 5, 1, 1], + "deps": ["nsubj", "ROOT", "compound", "punct", "nmod", "dobj", "punct"], + }, + ), + ( + "I like London and Berlin.", + { + "heads": [1, 1, 1, 2, 2, 1], + "deps": ["nsubj", "ROOT", "dobj", "cc", "conj", "punct"], + }, + ), +] + + +CONFLICTING_DATA = [ + ( + "I like London and Berlin.", + { + "heads": [1, 1, 1, 2, 2, 1], + "deps": ["nsubj", "ROOT", "dobj", "cc", "conj", "punct"], + }, + ), + ( + "I like London and Berlin.", + { + "heads": [0, 0, 0, 0, 0, 0], + "deps": ["ROOT", "nsubj", "nsubj", "cc", "conj", "punct"], + }, + ), +] + +PARTIAL_DATA = [ + ( + "I like London.", + { + "heads": [1, 1, 1, None], + "deps": ["nsubj", "ROOT", "dobj", None], + }, + ), +] + +eps = 0.1 + + +@pytest.fixture +def vocab(): + return Vocab(lex_attr_getters={NORM: lambda s: s}) + + +@pytest.fixture +def parser(vocab): + vocab.strings.add("ROOT") + cfg = {"model": DEFAULT_PARSER_MODEL} + model = registry.resolve(cfg, validate=True)["model"] + parser = DependencyParser(vocab, model) + parser.cfg["token_vector_width"] = 4 + parser.cfg["hidden_width"] = 32 + # parser.add_label('right') + parser.add_label("left") + parser.initialize(lambda: [_parser_example(parser)]) + sgd = Adam(0.001) + + for i in range(10): + losses = {} + doc = Doc(vocab, words=["a", "b", "c", "d"]) + example = Example.from_dict( + doc, {"heads": [1, 1, 3, 3], "deps": ["left", "ROOT", "left", "ROOT"]} + ) + parser.update([example], sgd=sgd, losses=losses) + return parser + + +def _parser_example(parser): + doc = Doc(parser.vocab, words=["a", "b", "c", "d"]) + gold = {"heads": [1, 1, 3, 3], "deps": ["right", "ROOT", "left", "ROOT"]} + return Example.from_dict(doc, gold) + + +@pytest.mark.issue(2772) +def test_issue2772(en_vocab): + """Test that deprojectivization doesn't mess up sentence boundaries.""" + # fmt: off + words = ["When", "we", "write", "or", "communicate", "virtually", ",", "we", "can", "hide", "our", "true", "feelings", "."] + # fmt: on + # A tree with a non-projective (i.e. crossing) arc + # The arcs (0, 4) and (2, 9) cross. + heads = [4, 2, 9, 2, 2, 4, 9, 9, 9, 9, 12, 12, 9, 9] + deps = ["dep"] * len(heads) + doc = Doc(en_vocab, words=words, heads=heads, deps=deps) + assert doc[1].is_sent_start is False + + +@pytest.mark.issue(3830) +def test_issue3830_no_subtok(): + """Test that the parser doesn't have subtok label if not learn_tokens""" + config = { + "learn_tokens": False, + } + model = registry.resolve({"model": DEFAULT_PARSER_MODEL}, validate=True)["model"] + parser = DependencyParser(Vocab(), model, **config) + parser.add_label("nsubj") + assert "subtok" not in parser.labels + parser.initialize(lambda: [_parser_example(parser)]) + assert "subtok" not in parser.labels + + +@pytest.mark.issue(3830) +def test_issue3830_with_subtok(): + """Test that the parser does have subtok label if learn_tokens=True.""" + config = { + "learn_tokens": True, + } + model = registry.resolve({"model": DEFAULT_PARSER_MODEL}, validate=True)["model"] + parser = DependencyParser(Vocab(), model, **config) + parser.add_label("nsubj") + assert "subtok" not in parser.labels + parser.initialize(lambda: [_parser_example(parser)]) + assert "subtok" in parser.labels + + +@pytest.mark.issue(7716) +@pytest.mark.xfail(reason="Not fixed yet") +def test_partial_annotation(parser): + doc = Doc(parser.vocab, words=["a", "b", "c", "d"]) + doc[2].is_sent_start = False + # Note that if the following line is used, then doc[2].is_sent_start == False + # doc[3].is_sent_start = False + + doc = parser(doc) + assert doc[2].is_sent_start == False + + +def test_parser_root(en_vocab): + words = ["i", "do", "n't", "have", "other", "assistance"] + heads = [3, 3, 3, 3, 5, 3] + deps = ["nsubj", "aux", "neg", "ROOT", "amod", "dobj"] + doc = Doc(en_vocab, words=words, heads=heads, deps=deps) + for t in doc: + assert t.dep != 0, t.text + + +@pytest.mark.skip( + reason="The step_through API was removed (but should be brought back)" +) +@pytest.mark.parametrize("words", [["Hello"]]) +def test_parser_parse_one_word_sentence(en_vocab, en_parser, words): + doc = Doc(en_vocab, words=words, heads=[0], deps=["ROOT"]) + assert len(doc) == 1 + with en_parser.step_through(doc) as _: # noqa: F841 + pass + assert doc[0].dep != 0 + + +@pytest.mark.skip( + reason="The step_through API was removed (but should be brought back)" +) +def test_parser_initial(en_vocab, en_parser): + words = ["I", "ate", "the", "pizza", "with", "anchovies", "."] + transition = ["L-nsubj", "S", "L-det"] + doc = Doc(en_vocab, words=words) + apply_transition_sequence(en_parser, doc, transition) + assert doc[0].head.i == 1 + assert doc[1].head.i == 1 + assert doc[2].head.i == 3 + assert doc[3].head.i == 3 + + +def test_parser_parse_subtrees(en_vocab, en_parser): + words = ["The", "four", "wheels", "on", "the", "bus", "turned", "quickly"] + heads = [2, 2, 6, 2, 5, 3, 6, 6] + deps = ["dep"] * len(heads) + doc = Doc(en_vocab, words=words, heads=heads, deps=deps) + assert len(list(doc[2].lefts)) == 2 + assert len(list(doc[2].rights)) == 1 + assert len(list(doc[2].children)) == 3 + assert len(list(doc[5].lefts)) == 1 + assert len(list(doc[5].rights)) == 0 + assert len(list(doc[5].children)) == 1 + assert len(list(doc[2].subtree)) == 6 + + +def test_parser_merge_pp(en_vocab): + words = ["A", "phrase", "with", "another", "phrase", "occurs"] + heads = [1, 5, 1, 4, 2, 5] + deps = ["det", "nsubj", "prep", "det", "pobj", "ROOT"] + pos = ["DET", "NOUN", "ADP", "DET", "NOUN", "VERB"] + doc = Doc(en_vocab, words=words, deps=deps, heads=heads, pos=pos) + with doc.retokenize() as retokenizer: + for np in doc.noun_chunks: + retokenizer.merge(np, attrs={"lemma": np.lemma_}) + assert doc[0].text == "A phrase" + assert doc[1].text == "with" + assert doc[2].text == "another phrase" + assert doc[3].text == "occurs" + + +@pytest.mark.skip( + reason="The step_through API was removed (but should be brought back)" +) +def test_parser_arc_eager_finalize_state(en_vocab, en_parser): + words = ["a", "b", "c", "d", "e"] + # right branching + transition = ["R-nsubj", "D", "R-nsubj", "R-nsubj", "D", "R-ROOT"] + tokens = Doc(en_vocab, words=words) + apply_transition_sequence(en_parser, tokens, transition) + + assert tokens[0].n_lefts == 0 + assert tokens[0].n_rights == 2 + assert tokens[0].left_edge.i == 0 + assert tokens[0].right_edge.i == 4 + assert tokens[0].head.i == 0 + + assert tokens[1].n_lefts == 0 + assert tokens[1].n_rights == 0 + assert tokens[1].left_edge.i == 1 + assert tokens[1].right_edge.i == 1 + assert tokens[1].head.i == 0 + + assert tokens[2].n_lefts == 0 + assert tokens[2].n_rights == 2 + assert tokens[2].left_edge.i == 2 + assert tokens[2].right_edge.i == 4 + assert tokens[2].head.i == 0 + + assert tokens[3].n_lefts == 0 + assert tokens[3].n_rights == 0 + assert tokens[3].left_edge.i == 3 + assert tokens[3].right_edge.i == 3 + assert tokens[3].head.i == 2 + + assert tokens[4].n_lefts == 0 + assert tokens[4].n_rights == 0 + assert tokens[4].left_edge.i == 4 + assert tokens[4].right_edge.i == 4 + assert tokens[4].head.i == 2 + + # left branching + transition = ["S", "S", "S", "L-nsubj", "L-nsubj", "L-nsubj", "L-nsubj"] + tokens = Doc(en_vocab, words=words) + apply_transition_sequence(en_parser, tokens, transition) + + assert tokens[0].n_lefts == 0 + assert tokens[0].n_rights == 0 + assert tokens[0].left_edge.i == 0 + assert tokens[0].right_edge.i == 0 + assert tokens[0].head.i == 4 + + assert tokens[1].n_lefts == 0 + assert tokens[1].n_rights == 0 + assert tokens[1].left_edge.i == 1 + assert tokens[1].right_edge.i == 1 + assert tokens[1].head.i == 4 + + assert tokens[2].n_lefts == 0 + assert tokens[2].n_rights == 0 + assert tokens[2].left_edge.i == 2 + assert tokens[2].right_edge.i == 2 + assert tokens[2].head.i == 4 + + assert tokens[3].n_lefts == 0 + assert tokens[3].n_rights == 0 + assert tokens[3].left_edge.i == 3 + assert tokens[3].right_edge.i == 3 + assert tokens[3].head.i == 4 + + assert tokens[4].n_lefts == 4 + assert tokens[4].n_rights == 0 + assert tokens[4].left_edge.i == 0 + assert tokens[4].right_edge.i == 4 + assert tokens[4].head.i == 4 + + +def test_parser_set_sent_starts(en_vocab): + # fmt: off + words = ['Ein', 'Satz', '.', 'Außerdem', 'ist', 'Zimmer', 'davon', 'überzeugt', ',', 'dass', 'auch', 'epige-', '\n', 'netische', 'Mechanismen', 'eine', 'Rolle', 'spielen', ',', 'also', 'Vorgänge', ',', 'die', '\n', 'sich', 'darauf', 'auswirken', ',', 'welche', 'Gene', 'abgelesen', 'werden', 'und', '\n', 'welche', 'nicht', '.', '\n'] + heads = [1, 1, 1, 30, 4, 4, 7, 4, 7, 17, 14, 14, 11, 14, 17, 16, 17, 6, 17, 20, 11, 20, 26, 22, 26, 26, 20, 26, 29, 31, 31, 25, 31, 32, 17, 4, 4, 36] + deps = ['nk', 'ROOT', 'punct', 'mo', 'ROOT', 'sb', 'op', 'pd', 'punct', 'cp', 'mo', 'nk', '', 'nk', 'sb', 'nk', 'oa', 're', 'punct', 'mo', 'app', 'punct', 'sb', '', 'oa', 'op', 'rc', 'punct', 'nk', 'sb', 'oc', 're', 'cd', '', 'oa', 'ng', 'punct', ''] + # fmt: on + doc = Doc(en_vocab, words=words, deps=deps, heads=heads) + for i in range(len(words)): + if i == 0 or i == 3: + assert doc[i].is_sent_start is True + else: + assert doc[i].is_sent_start is False + for sent in doc.sents: + for token in sent: + assert token.head in sent + + +def test_parser_constructor(en_vocab): + config = { + "learn_tokens": False, + "min_action_freq": 30, + "update_with_oracle_cut_size": 100, + } + cfg = {"model": DEFAULT_PARSER_MODEL} + model = registry.resolve(cfg, validate=True)["model"] + DependencyParser(en_vocab, model, **config) + DependencyParser(en_vocab, model) + + +@pytest.mark.parametrize("pipe_name", ["parser", "beam_parser"]) +def test_incomplete_data(pipe_name): + # Test that the parser works with incomplete information + nlp = English() + parser = nlp.add_pipe(pipe_name) + train_examples = [] + for text, annotations in PARTIAL_DATA: + train_examples.append(Example.from_dict(nlp.make_doc(text), annotations)) + for dep in annotations.get("deps", []): + if dep is not None: + parser.add_label(dep) + optimizer = nlp.initialize(get_examples=lambda: train_examples) + for i in range(150): + losses = {} + nlp.update(train_examples, sgd=optimizer, losses=losses) + assert losses[pipe_name] < 0.0001 + + # test the trained model + test_text = "I like securities." + doc = nlp(test_text) + assert doc[0].dep_ == "nsubj" + assert doc[2].dep_ == "dobj" + assert doc[0].head.i == 1 + assert doc[2].head.i == 1 + + +@pytest.mark.parametrize("pipe_name", ["parser", "beam_parser"]) +def test_overfitting_IO(pipe_name): + # Simple test to try and quickly overfit the dependency parser (normal or beam) + nlp = English() + parser = nlp.add_pipe(pipe_name) + train_examples = [] + for text, annotations in TRAIN_DATA: + train_examples.append(Example.from_dict(nlp.make_doc(text), annotations)) + for dep in annotations.get("deps", []): + parser.add_label(dep) + optimizer = nlp.initialize() + # run overfitting + for i in range(200): + losses = {} + nlp.update(train_examples, sgd=optimizer, losses=losses) + assert losses[pipe_name] < 0.0001 + # test the trained model + test_text = "I like securities." + doc = nlp(test_text) + assert doc[0].dep_ == "nsubj" + assert doc[2].dep_ == "dobj" + assert doc[3].dep_ == "punct" + assert doc[0].head.i == 1 + assert doc[2].head.i == 1 + assert doc[3].head.i == 1 + # Also test the results are still the same after IO + with make_tempdir() as tmp_dir: + nlp.to_disk(tmp_dir) + nlp2 = util.load_model_from_path(tmp_dir) + doc2 = nlp2(test_text) + assert doc2[0].dep_ == "nsubj" + assert doc2[2].dep_ == "dobj" + assert doc2[3].dep_ == "punct" + assert doc2[0].head.i == 1 + assert doc2[2].head.i == 1 + assert doc2[3].head.i == 1 + + # Make sure that running pipe twice, or comparing to call, always amounts to the same predictions + texts = [ + "Just a sentence.", + "Then one more sentence about London.", + "Here is another one.", + "I like London.", + ] + batch_deps_1 = [doc.to_array([DEP]) for doc in nlp.pipe(texts)] + batch_deps_2 = [doc.to_array([DEP]) for doc in nlp.pipe(texts)] + no_batch_deps = [doc.to_array([DEP]) for doc in [nlp(text) for text in texts]] + assert_equal(batch_deps_1, batch_deps_2) + assert_equal(batch_deps_1, no_batch_deps) + + +# fmt: off +@pytest.mark.slow +@pytest.mark.parametrize("pipe_name", ["parser", "beam_parser"]) +@pytest.mark.parametrize( + "parser_config", + [ + # TransitionBasedParser V1 + ({"@architectures": "spacy.TransitionBasedParser.v1", "tok2vec": DEFAULT_TOK2VEC_MODEL, "state_type": "parser", "extra_state_tokens": False, "hidden_width": 64, "maxout_pieces": 2, "use_upper": True}), + # TransitionBasedParser V2 + ({"@architectures": "spacy.TransitionBasedParser.v2", "tok2vec": DEFAULT_TOK2VEC_MODEL, "state_type": "parser", "extra_state_tokens": False, "hidden_width": 64, "maxout_pieces": 2, "use_upper": True}), + ], +) +# fmt: on +def test_parser_configs(pipe_name, parser_config): + pipe_config = {"model": parser_config} + nlp = English() + parser = nlp.add_pipe(pipe_name, config=pipe_config) + train_examples = [] + for text, annotations in TRAIN_DATA: + train_examples.append(Example.from_dict(nlp.make_doc(text), annotations)) + for dep in annotations.get("deps", []): + parser.add_label(dep) + optimizer = nlp.initialize() + for i in range(5): + losses = {} + nlp.update(train_examples, sgd=optimizer, losses=losses) + + +def test_beam_parser_scores(): + # Test that we can get confidence values out of the beam_parser pipe + beam_width = 16 + beam_density = 0.0001 + nlp = English() + config = { + "beam_width": beam_width, + "beam_density": beam_density, + } + parser = nlp.add_pipe("beam_parser", config=config) + train_examples = [] + for text, annotations in CONFLICTING_DATA: + train_examples.append(Example.from_dict(nlp.make_doc(text), annotations)) + for dep in annotations.get("deps", []): + parser.add_label(dep) + optimizer = nlp.initialize() + + # update a bit with conflicting data + for i in range(10): + losses = {} + nlp.update(train_examples, sgd=optimizer, losses=losses) + + # test the scores from the beam + test_text = "I like securities." + doc = nlp.make_doc(test_text) + docs = [doc] + beams = parser.predict(docs) + head_scores, label_scores = parser.scored_parses(beams) + + for j in range(len(doc)): + for label in parser.labels: + label_score = label_scores[0][(j, label)] + assert 0 - eps <= label_score <= 1 + eps + for i in range(len(doc)): + head_score = head_scores[0][(j, i)] + assert 0 - eps <= head_score <= 1 + eps + + +def test_beam_overfitting_IO(): + # Simple test to try and quickly overfit the Beam dependency parser + nlp = English() + beam_width = 16 + beam_density = 0.0001 + config = { + "beam_width": beam_width, + "beam_density": beam_density, + } + parser = nlp.add_pipe("beam_parser", config=config) + train_examples = [] + for text, annotations in TRAIN_DATA: + train_examples.append(Example.from_dict(nlp.make_doc(text), annotations)) + for dep in annotations.get("deps", []): + parser.add_label(dep) + optimizer = nlp.initialize() + # run overfitting + for i in range(150): + losses = {} + nlp.update(train_examples, sgd=optimizer, losses=losses) + assert losses["beam_parser"] < 0.0001 + # test the scores from the beam + test_text = "I like securities." + docs = [nlp.make_doc(test_text)] + beams = parser.predict(docs) + head_scores, label_scores = parser.scored_parses(beams) + # we only processed one document + head_scores = head_scores[0] + label_scores = label_scores[0] + # test label annotations: 0=nsubj, 2=dobj, 3=punct + assert label_scores[(0, "nsubj")] == pytest.approx(1.0, abs=eps) + assert label_scores[(0, "dobj")] == pytest.approx(0.0, abs=eps) + assert label_scores[(0, "punct")] == pytest.approx(0.0, abs=eps) + assert label_scores[(2, "nsubj")] == pytest.approx(0.0, abs=eps) + assert label_scores[(2, "dobj")] == pytest.approx(1.0, abs=eps) + assert label_scores[(2, "punct")] == pytest.approx(0.0, abs=eps) + assert label_scores[(3, "nsubj")] == pytest.approx(0.0, abs=eps) + assert label_scores[(3, "dobj")] == pytest.approx(0.0, abs=eps) + assert label_scores[(3, "punct")] == pytest.approx(1.0, abs=eps) + # test head annotations: the root is token at index 1 + assert head_scores[(0, 0)] == pytest.approx(0.0, abs=eps) + assert head_scores[(0, 1)] == pytest.approx(1.0, abs=eps) + assert head_scores[(0, 2)] == pytest.approx(0.0, abs=eps) + assert head_scores[(2, 0)] == pytest.approx(0.0, abs=eps) + assert head_scores[(2, 1)] == pytest.approx(1.0, abs=eps) + assert head_scores[(2, 2)] == pytest.approx(0.0, abs=eps) + assert head_scores[(3, 0)] == pytest.approx(0.0, abs=eps) + assert head_scores[(3, 1)] == pytest.approx(1.0, abs=eps) + assert head_scores[(3, 2)] == pytest.approx(0.0, abs=eps) + + # Also test the results are still the same after IO + with make_tempdir() as tmp_dir: + nlp.to_disk(tmp_dir) + nlp2 = util.load_model_from_path(tmp_dir) + docs2 = [nlp2.make_doc(test_text)] + parser2 = nlp2.get_pipe("beam_parser") + beams2 = parser2.predict(docs2) + head_scores2, label_scores2 = parser2.scored_parses(beams2) + # we only processed one document + head_scores2 = head_scores2[0] + label_scores2 = label_scores2[0] + # check the results again + assert label_scores2[(0, "nsubj")] == pytest.approx(1.0, abs=eps) + assert label_scores2[(0, "dobj")] == pytest.approx(0.0, abs=eps) + assert label_scores2[(0, "punct")] == pytest.approx(0.0, abs=eps) + assert label_scores2[(2, "nsubj")] == pytest.approx(0.0, abs=eps) + assert label_scores2[(2, "dobj")] == pytest.approx(1.0, abs=eps) + assert label_scores2[(2, "punct")] == pytest.approx(0.0, abs=eps) + assert label_scores2[(3, "nsubj")] == pytest.approx(0.0, abs=eps) + assert label_scores2[(3, "dobj")] == pytest.approx(0.0, abs=eps) + assert label_scores2[(3, "punct")] == pytest.approx(1.0, abs=eps) + assert head_scores2[(0, 0)] == pytest.approx(0.0, abs=eps) + assert head_scores2[(0, 1)] == pytest.approx(1.0, abs=eps) + assert head_scores2[(0, 2)] == pytest.approx(0.0, abs=eps) + assert head_scores2[(2, 0)] == pytest.approx(0.0, abs=eps) + assert head_scores2[(2, 1)] == pytest.approx(1.0, abs=eps) + assert head_scores2[(2, 2)] == pytest.approx(0.0, abs=eps) + assert head_scores2[(3, 0)] == pytest.approx(0.0, abs=eps) + assert head_scores2[(3, 1)] == pytest.approx(1.0, abs=eps) + assert head_scores2[(3, 2)] == pytest.approx(0.0, abs=eps) diff --git a/TTS/Kokoro/.venv/Lib/site-packages/spacy/tests/parser/test_parse_navigate.py b/TTS/Kokoro/.venv/Lib/site-packages/spacy/tests/parser/test_parse_navigate.py new file mode 100644 index 0000000000000000000000000000000000000000..849bce1f4750eebe840fc973708f9dea74cd4852 --- /dev/null +++ b/TTS/Kokoro/.venv/Lib/site-packages/spacy/tests/parser/test_parse_navigate.py @@ -0,0 +1,126 @@ +import pytest + +from spacy.tokens import Doc + + +@pytest.fixture +def words(): + # fmt: off + return [ + "\n", "It", "was", "a", "bright", "cold", "day", "in", "April", ",", + "and", "the", "clocks", "were", "striking", "thirteen", ".", "\n", + "Winston", "Smith", ",", "his", "chin", "nuzzled", "into", "his", + "breast", "in", "an", "effort", "to", "escape", "the", "\n", "vile", + "wind", ",", "slipped", "quickly", "through", "the", "glass", "doors", + "of", "Victory", "Mansions", ",", "\n", "though", "not", "quickly", + "enough", "to", "prevent", "a", "swirl", "of", "gritty", "dust", + "from", "entering", "\n", "along", "with", "him", ".", "\n\n", "The", + "hallway", "smelt", "of", "boiled", "cabbage", "and", "old", "rag", + "mats", ".", "At", "one", "end", "of", "it", "a", "\n", "coloured", + "poster", ",", "too", "large", "for", "indoor", "display", ",", "had", + "been", "tacked", "to", "the", "wall", ".", "\n", "It", "depicted", + "simply", "an", "enormous", "face", ",", "more", "than", "a", "metre", + "wide", ":", "the", "face", "of", "a", "\n", "man", "of", "about", + "forty", "-", "five", ",", "with", "a", "heavy", "black", "moustache", + "and", "ruggedly", "handsome", "\n", "features", ".", "Winston", "made", + "for", "the", "stairs", ".", "It", "was", "no", "use", "trying", "the", + "lift", ".", "Even", "at", "\n", "the", "best", "of", "times", "it", + "was", "seldom", "working", ",", "and", "at", "present", "the", + "electric", "current", "\n", "was", "cut", "off", "during", "daylight", + "hours", ".", "It", "was", "part", "of", "the", "economy", "drive", + "in", "\n", "preparation", "for", "Hate", "Week", ".", "The", "flat", + "was", "seven", "flights", "up", ",", "and", "Winston", ",", "who", + "\n", "was", "thirty", "-", "nine", "and", "had", "a", "varicose", + "ulcer", "above", "his", "right", "ankle", ",", "went", "slowly", ",", + "\n", "resting", "several", "times", "on", "the", "way", ".", "On", + "each", "landing", ",", "opposite", "the", "lift", "-", "shaft", ",", + "\n", "the", "poster", "with", "the", "enormous", "face", "gazed", + "from", "the", "wall", ".", "It", "was", "one", "of", "those", "\n", + "pictures", "which", "are", "so", "contrived", "that", "the", "eyes", + "follow", "you", "about", "when", "you", "move", ".", "\n", "BIG", + "BROTHER", "IS", "WATCHING", "YOU", ",", "the", "caption", "beneath", + "it", "ran", ".", "\n", ] + # fmt: on + + +@pytest.fixture +def heads(): + # fmt: off + return [ + 1, 2, 2, 6, 6, 6, 2, 6, 7, 2, 2, 12, 14, 14, 2, 14, 14, 16, 19, 23, 23, + 22, 23, 23, 23, 26, 24, 23, 29, 27, 31, 29, 35, 32, 35, 31, 23, 23, 37, + 37, 42, 42, 39, 42, 45, 43, 37, 46, 37, 50, 51, 37, 53, 51, 55, 53, 55, + 58, 56, 53, 59, 60, 60, 62, 63, 23, 65, 68, 69, 69, 69, 72, 70, 72, 76, + 76, 72, 69, 96, 80, 78, 80, 81, 86, 83, 86, 96, 96, 89, 96, 89, 92, 90, + 96, 96, 96, 96, 96, 99, 97, 96, 100, 103, 103, 103, 107, 107, 103, 107, + 111, 111, 112, 113, 107, 103, 116, 136, 116, 120, 118, 117, 120, 125, + 125, 125, 121, 116, 116, 131, 131, 131, 127, 131, 134, 131, 134, 136, + 136, 139, 139, 139, 142, 140, 139, 145, 145, 147, 145, 147, 150, 148, + 145, 153, 162, 153, 156, 162, 156, 157, 162, 162, 162, 162, 162, 162, + 172, 165, 169, 169, 172, 169, 172, 162, 172, 172, 176, 174, 172, 179, + 179, 179, 180, 183, 181, 179, 184, 185, 185, 187, 190, 188, 179, 193, + 194, 194, 196, 194, 196, 194, 194, 218, 200, 204, 202, 200, 207, 207, + 204, 204, 204, 212, 212, 209, 212, 216, 216, 213, 200, 194, 218, 218, + 220, 218, 224, 222, 222, 227, 225, 218, 246, 231, 229, 246, 246, 237, + 237, 237, 233, 246, 238, 241, 246, 241, 245, 245, 242, 246, 246, 249, + 247, 246, 252, 252, 252, 253, 257, 255, 254, 259, 257, 261, 259, 265, + 264, 265, 261, 265, 265, 270, 270, 267, 252, 271, 274, 275, 275, 276, + 283, 283, 280, 283, 280, 281, 283, 283, 284] + # fmt: on + + +def test_parser_parse_navigate_consistency(en_vocab, words, heads): + doc = Doc(en_vocab, words=words, heads=heads, deps=["dep"] * len(heads)) + for head in doc: + for child in head.lefts: + assert child.head == head + for child in head.rights: + assert child.head == head + + +def test_parser_parse_navigate_child_consistency(en_vocab, words, heads): + doc = Doc(en_vocab, words=words, heads=heads, deps=["dep"] * len(heads)) + lefts = {} + rights = {} + for head in doc: + assert head.i not in lefts + lefts[head.i] = set() + for left in head.lefts: + lefts[head.i].add(left.i) + assert head.i not in rights + rights[head.i] = set() + for right in head.rights: + rights[head.i].add(right.i) + for head in doc: + assert head.n_rights == len(rights[head.i]) + assert head.n_lefts == len(lefts[head.i]) + for child in doc: + if child.i < child.head.i: + assert child.i in lefts[child.head.i] + assert child.i not in rights[child.head.i] + lefts[child.head.i].remove(child.i) + elif child.i > child.head.i: + assert child.i in rights[child.head.i] + assert child.i not in lefts[child.head.i] + rights[child.head.i].remove(child.i) + for head_index, children in lefts.items(): + assert not children + for head_index, children in rights.items(): + assert not children + + +def test_parser_parse_navigate_edges(en_vocab, words, heads): + doc = Doc(en_vocab, words=words, heads=heads, deps=["dep"] * len(heads)) + for token in doc: + subtree = list(token.subtree) + debug = "\t".join((token.text, token.left_edge.text, subtree[0].text)) + assert token.left_edge == subtree[0], debug + debug = "\t".join( + ( + token.text, + token.right_edge.text, + subtree[-1].text, + token.right_edge.head.text, + ) + ) + assert token.right_edge == subtree[-1], debug diff --git a/TTS/Kokoro/.venv/Lib/site-packages/spacy/tests/parser/test_preset_sbd.py b/TTS/Kokoro/.venv/Lib/site-packages/spacy/tests/parser/test_preset_sbd.py new file mode 100644 index 0000000000000000000000000000000000000000..1993f566eb05254ea0f5741e94bdd73b14613053 --- /dev/null +++ b/TTS/Kokoro/.venv/Lib/site-packages/spacy/tests/parser/test_preset_sbd.py @@ -0,0 +1,88 @@ +import pytest +from thinc.api import Adam + +from spacy import registry +from spacy.attrs import NORM +from spacy.pipeline import DependencyParser +from spacy.pipeline.dep_parser import DEFAULT_PARSER_MODEL +from spacy.tokens import Doc +from spacy.training import Example +from spacy.vocab import Vocab + + +@pytest.fixture +def vocab(): + return Vocab(lex_attr_getters={NORM: lambda s: s}) + + +def _parser_example(parser): + doc = Doc(parser.vocab, words=["a", "b", "c", "d"]) + gold = {"heads": [1, 1, 3, 3], "deps": ["right", "ROOT", "left", "ROOT"]} + return Example.from_dict(doc, gold) + + +@pytest.fixture +def parser(vocab): + vocab.strings.add("ROOT") + cfg = {"model": DEFAULT_PARSER_MODEL} + model = registry.resolve(cfg, validate=True)["model"] + parser = DependencyParser(vocab, model) + parser.cfg["token_vector_width"] = 4 + parser.cfg["hidden_width"] = 32 + # parser.add_label('right') + parser.add_label("left") + parser.initialize(lambda: [_parser_example(parser)]) + sgd = Adam(0.001) + + for i in range(10): + losses = {} + doc = Doc(vocab, words=["a", "b", "c", "d"]) + example = Example.from_dict( + doc, {"heads": [1, 1, 3, 3], "deps": ["left", "ROOT", "left", "ROOT"]} + ) + parser.update([example], sgd=sgd, losses=losses) + return parser + + +def test_no_sentences(parser): + doc = Doc(parser.vocab, words=["a", "b", "c", "d"]) + doc = parser(doc) + assert len(list(doc.sents)) >= 1 + + +def test_sents_1(parser): + doc = Doc(parser.vocab, words=["a", "b", "c", "d"]) + doc[2].sent_start = True + doc = parser(doc) + assert len(list(doc.sents)) >= 2 + doc = Doc(parser.vocab, words=["a", "b", "c", "d"]) + doc[1].sent_start = False + doc[2].sent_start = True + doc[3].sent_start = False + doc = parser(doc) + assert len(list(doc.sents)) == 2 + + +def test_sents_1_2(parser): + doc = Doc(parser.vocab, words=["a", "b", "c", "d"]) + doc[1].sent_start = True + doc[2].sent_start = True + doc = parser(doc) + assert len(list(doc.sents)) >= 3 + + +def test_sents_1_3(parser): + doc = Doc(parser.vocab, words=["a", "b", "c", "d"]) + doc[0].is_sent_start = True + doc[1].is_sent_start = True + doc[2].is_sent_start = None + doc[3].is_sent_start = True + doc = parser(doc) + assert len(list(doc.sents)) >= 3 + doc = Doc(parser.vocab, words=["a", "b", "c", "d"]) + doc[0].is_sent_start = True + doc[1].is_sent_start = True + doc[2].is_sent_start = False + doc[3].is_sent_start = True + doc = parser(doc) + assert len(list(doc.sents)) == 3 diff --git a/TTS/Kokoro/.venv/Lib/site-packages/spacy/tests/parser/test_space_attachment.py b/TTS/Kokoro/.venv/Lib/site-packages/spacy/tests/parser/test_space_attachment.py new file mode 100644 index 0000000000000000000000000000000000000000..01b322b93315a16e46a6ccfdff2dc2fab45eeae1 --- /dev/null +++ b/TTS/Kokoro/.venv/Lib/site-packages/spacy/tests/parser/test_space_attachment.py @@ -0,0 +1,79 @@ +import pytest + +from spacy.tokens import Doc + +from ..util import apply_transition_sequence + + +def test_parser_space_attachment(en_vocab): + # fmt: off + words = ["This", "is", "a", "test", ".", "\n", "To", "ensure", " ", "spaces", "are", "attached", "well", "."] + heads = [1, 1, 3, 1, 1, 4, 7, 11, 7, 11, 11, 11, 11, 11] + # fmt: on + deps = ["dep"] * len(heads) + doc = Doc(en_vocab, words=words, heads=heads, deps=deps) + for sent in doc.sents: + if len(sent) == 1: + assert not sent[-1].is_space + + +def test_parser_sentence_space(en_vocab): + # fmt: off + words = ["I", "look", "forward", "to", "using", "Thingamajig", ".", " ", "I", "'ve", "been", "told", "it", "will", "make", "my", "life", "easier", "..."] + heads = [1, 1, 1, 1, 3, 4, 1, 6, 11, 11, 11, 11, 14, 14, 11, 16, 17, 14, 11] + deps = ["nsubj", "ROOT", "advmod", "prep", "pcomp", "dobj", "punct", "", + "nsubjpass", "aux", "auxpass", "ROOT", "nsubj", "aux", "ccomp", + "poss", "nsubj", "ccomp", "punct"] + # fmt: on + doc = Doc(en_vocab, words=words, heads=heads, deps=deps) + assert len(list(doc.sents)) == 2 + + +@pytest.mark.skip( + reason="The step_through API was removed (but should be brought back)" +) +def test_parser_space_attachment_leading(en_vocab, en_parser): + words = ["\t", "\n", "This", "is", "a", "sentence", "."] + heads = [1, 2, 2, 4, 2, 2] + doc = Doc(en_vocab, words=words, heads=heads) + assert doc[0].is_space + assert doc[1].is_space + assert doc[2].text == "This" + with en_parser.step_through(doc) as stepwise: + pass + assert doc[0].head.i == 2 + assert doc[1].head.i == 2 + assert stepwise.stack == set([2]) + + +@pytest.mark.skip( + reason="The step_through API was removed (but should be brought back)" +) +def test_parser_space_attachment_intermediate_trailing(en_vocab, en_parser): + words = ["This", "is", "\t", "a", "\t\n", "\n", "sentence", ".", "\n\n", "\n"] + heads = [1, 1, 1, 5, 3, 1, 1, 6] + transition = ["L-nsubj", "S", "L-det", "R-attr", "D", "R-punct"] + doc = Doc(en_vocab, words=words, heads=heads) + assert doc[2].is_space + assert doc[4].is_space + assert doc[5].is_space + assert doc[8].is_space + assert doc[9].is_space + apply_transition_sequence(en_parser, doc, transition) + for token in doc: + assert token.dep != 0 or token.is_space + assert [token.head.i for token in doc] == [1, 1, 1, 6, 3, 3, 1, 1, 7, 7] + + +@pytest.mark.parametrize("text,length", [(["\n"], 1), (["\n", "\t", "\n\n", "\t"], 4)]) +@pytest.mark.skip( + reason="The step_through API was removed (but should be brought back)" +) +def test_parser_space_attachment_space(en_parser, text, length): + doc = Doc(en_parser.vocab, words=text) + assert len(doc) == length + with en_parser.step_through(doc) as _: # noqa: F841 + pass + assert doc[0].is_space + for token in doc: + assert token.head.i == length - 1 diff --git a/TTS/Kokoro/.venv/Lib/site-packages/spacy/tests/parser/test_state.py b/TTS/Kokoro/.venv/Lib/site-packages/spacy/tests/parser/test_state.py new file mode 100644 index 0000000000000000000000000000000000000000..594a7d272f05042b93fe14416613d8525e458e5c --- /dev/null +++ b/TTS/Kokoro/.venv/Lib/site-packages/spacy/tests/parser/test_state.py @@ -0,0 +1,79 @@ +import pytest + +from spacy.pipeline._parser_internals.stateclass import StateClass +from spacy.tokens.doc import Doc +from spacy.vocab import Vocab + + +@pytest.fixture +def vocab(): + return Vocab() + + +@pytest.fixture +def doc(vocab): + return Doc(vocab, words=["a", "b", "c", "d"]) + + +def test_init_state(doc): + state = StateClass(doc) + assert state.stack == [] + assert state.queue == list(range(len(doc))) + assert not state.is_final() + assert state.buffer_length() == 4 + + +def test_push_pop(doc): + state = StateClass(doc) + state.push() + assert state.buffer_length() == 3 + assert state.stack == [0] + assert 0 not in state.queue + state.push() + assert state.stack == [1, 0] + assert 1 not in state.queue + assert state.buffer_length() == 2 + state.pop() + assert state.stack == [0] + assert 1 not in state.queue + + +def test_stack_depth(doc): + state = StateClass(doc) + assert state.stack_depth() == 0 + assert state.buffer_length() == len(doc) + state.push() + assert state.buffer_length() == 3 + assert state.stack_depth() == 1 + + +def test_H(doc): + state = StateClass(doc) + assert state.H(0) == -1 + state.add_arc(1, 0, 0) + assert state.arcs == [{"head": 1, "child": 0, "label": 0}] + assert state.H(0) == 1 + state.add_arc(3, 1, 0) + assert state.H(1) == 3 + + +def test_L(doc): + state = StateClass(doc) + assert state.L(2, 1) == -1 + state.add_arc(2, 1, 0) + assert state.arcs == [{"head": 2, "child": 1, "label": 0}] + assert state.L(2, 1) == 1 + state.add_arc(2, 0, 0) + assert state.L(2, 1) == 0 + assert state.n_L(2) == 2 + + +def test_R(doc): + state = StateClass(doc) + assert state.R(0, 1) == -1 + state.add_arc(0, 1, 0) + assert state.arcs == [{"head": 0, "child": 1, "label": 0}] + assert state.R(0, 1) == 1 + state.add_arc(0, 2, 0) + assert state.R(0, 1) == 2 + assert state.n_R(0) == 2 diff --git a/TTS/Kokoro/.venv/Lib/site-packages/spacy/tests/pipeline/__init__.py b/TTS/Kokoro/.venv/Lib/site-packages/spacy/tests/pipeline/__init__.py new file mode 100644 index 0000000000000000000000000000000000000000..e69de29bb2d1d6434b8b29ae775ad8c2e48c5391 diff --git a/TTS/Kokoro/.venv/Lib/site-packages/spacy/tests/pipeline/__pycache__/__init__.cpython-312.pyc b/TTS/Kokoro/.venv/Lib/site-packages/spacy/tests/pipeline/__pycache__/__init__.cpython-312.pyc new file mode 100644 index 0000000000000000000000000000000000000000..41493ac222a9738ef6dfcd3a39c1a2155e9fda6b Binary files /dev/null and b/TTS/Kokoro/.venv/Lib/site-packages/spacy/tests/pipeline/__pycache__/__init__.cpython-312.pyc differ diff --git a/TTS/Kokoro/.venv/Lib/site-packages/spacy/tests/pipeline/__pycache__/test_analysis.cpython-312.pyc b/TTS/Kokoro/.venv/Lib/site-packages/spacy/tests/pipeline/__pycache__/test_analysis.cpython-312.pyc new file mode 100644 index 0000000000000000000000000000000000000000..92ca7d725f20e0cd40940e93658002ff2178ce0c Binary files /dev/null and b/TTS/Kokoro/.venv/Lib/site-packages/spacy/tests/pipeline/__pycache__/test_analysis.cpython-312.pyc differ diff --git a/TTS/Kokoro/.venv/Lib/site-packages/spacy/tests/pipeline/__pycache__/test_annotates_on_update.cpython-312.pyc b/TTS/Kokoro/.venv/Lib/site-packages/spacy/tests/pipeline/__pycache__/test_annotates_on_update.cpython-312.pyc new file mode 100644 index 0000000000000000000000000000000000000000..b6ad150ce86ddcf293873e700a8571f4d2288d5d Binary files /dev/null and b/TTS/Kokoro/.venv/Lib/site-packages/spacy/tests/pipeline/__pycache__/test_annotates_on_update.cpython-312.pyc differ diff --git a/TTS/Kokoro/.venv/Lib/site-packages/spacy/tests/pipeline/__pycache__/test_attributeruler.cpython-312.pyc b/TTS/Kokoro/.venv/Lib/site-packages/spacy/tests/pipeline/__pycache__/test_attributeruler.cpython-312.pyc new file mode 100644 index 0000000000000000000000000000000000000000..3d1cb1af075cdcbfdb4b99c344661161a6e75abf Binary files /dev/null and b/TTS/Kokoro/.venv/Lib/site-packages/spacy/tests/pipeline/__pycache__/test_attributeruler.cpython-312.pyc differ diff --git a/TTS/Kokoro/.venv/Lib/site-packages/spacy/tests/pipeline/__pycache__/test_edit_tree_lemmatizer.cpython-312.pyc b/TTS/Kokoro/.venv/Lib/site-packages/spacy/tests/pipeline/__pycache__/test_edit_tree_lemmatizer.cpython-312.pyc new file mode 100644 index 0000000000000000000000000000000000000000..23b05928d8b197e7239a34d64168b1f9356a882a Binary files /dev/null and b/TTS/Kokoro/.venv/Lib/site-packages/spacy/tests/pipeline/__pycache__/test_edit_tree_lemmatizer.cpython-312.pyc differ diff --git a/TTS/Kokoro/.venv/Lib/site-packages/spacy/tests/pipeline/__pycache__/test_entity_linker.cpython-312.pyc b/TTS/Kokoro/.venv/Lib/site-packages/spacy/tests/pipeline/__pycache__/test_entity_linker.cpython-312.pyc new file mode 100644 index 0000000000000000000000000000000000000000..8afddc16faeb1f09eaf016f4515360f2e268b635 Binary files /dev/null and b/TTS/Kokoro/.venv/Lib/site-packages/spacy/tests/pipeline/__pycache__/test_entity_linker.cpython-312.pyc differ diff --git a/TTS/Kokoro/.venv/Lib/site-packages/spacy/tests/pipeline/__pycache__/test_entity_ruler.cpython-312.pyc b/TTS/Kokoro/.venv/Lib/site-packages/spacy/tests/pipeline/__pycache__/test_entity_ruler.cpython-312.pyc new file mode 100644 index 0000000000000000000000000000000000000000..9a3bbbf2fbe92796f1c370d1fdd4b00a4bf7a6d4 Binary files /dev/null and b/TTS/Kokoro/.venv/Lib/site-packages/spacy/tests/pipeline/__pycache__/test_entity_ruler.cpython-312.pyc differ diff --git a/TTS/Kokoro/.venv/Lib/site-packages/spacy/tests/pipeline/__pycache__/test_functions.cpython-312.pyc b/TTS/Kokoro/.venv/Lib/site-packages/spacy/tests/pipeline/__pycache__/test_functions.cpython-312.pyc new file mode 100644 index 0000000000000000000000000000000000000000..e8c0b2a65ea9c54a20ad9e17b4a081fdccae99d2 Binary files /dev/null and b/TTS/Kokoro/.venv/Lib/site-packages/spacy/tests/pipeline/__pycache__/test_functions.cpython-312.pyc differ diff --git a/TTS/Kokoro/.venv/Lib/site-packages/spacy/tests/pipeline/__pycache__/test_initialize.cpython-312.pyc b/TTS/Kokoro/.venv/Lib/site-packages/spacy/tests/pipeline/__pycache__/test_initialize.cpython-312.pyc new file mode 100644 index 0000000000000000000000000000000000000000..70028406a7c07d81ee7d56e245fda339a105602c Binary files /dev/null and b/TTS/Kokoro/.venv/Lib/site-packages/spacy/tests/pipeline/__pycache__/test_initialize.cpython-312.pyc differ diff --git a/TTS/Kokoro/.venv/Lib/site-packages/spacy/tests/pipeline/__pycache__/test_lemmatizer.cpython-312.pyc b/TTS/Kokoro/.venv/Lib/site-packages/spacy/tests/pipeline/__pycache__/test_lemmatizer.cpython-312.pyc new file mode 100644 index 0000000000000000000000000000000000000000..3fb50da3bc909e5550bb801a55f90a0f0b19977b Binary files /dev/null and b/TTS/Kokoro/.venv/Lib/site-packages/spacy/tests/pipeline/__pycache__/test_lemmatizer.cpython-312.pyc differ diff --git a/TTS/Kokoro/.venv/Lib/site-packages/spacy/tests/pipeline/__pycache__/test_models.cpython-312.pyc b/TTS/Kokoro/.venv/Lib/site-packages/spacy/tests/pipeline/__pycache__/test_models.cpython-312.pyc new file mode 100644 index 0000000000000000000000000000000000000000..fe806bdf60ebee52fe5adff7e62f6ce5659eead5 Binary files /dev/null and b/TTS/Kokoro/.venv/Lib/site-packages/spacy/tests/pipeline/__pycache__/test_models.cpython-312.pyc differ diff --git a/TTS/Kokoro/.venv/Lib/site-packages/spacy/tests/pipeline/__pycache__/test_morphologizer.cpython-312.pyc b/TTS/Kokoro/.venv/Lib/site-packages/spacy/tests/pipeline/__pycache__/test_morphologizer.cpython-312.pyc new file mode 100644 index 0000000000000000000000000000000000000000..eeca0640c1449a436f4be89214b5a4105749d670 Binary files /dev/null and b/TTS/Kokoro/.venv/Lib/site-packages/spacy/tests/pipeline/__pycache__/test_morphologizer.cpython-312.pyc differ diff --git a/TTS/Kokoro/.venv/Lib/site-packages/spacy/tests/pipeline/__pycache__/test_pipe_factories.cpython-312.pyc b/TTS/Kokoro/.venv/Lib/site-packages/spacy/tests/pipeline/__pycache__/test_pipe_factories.cpython-312.pyc new file mode 100644 index 0000000000000000000000000000000000000000..234237adcceb1237b7d7e61413734c73087ea580 Binary files /dev/null and b/TTS/Kokoro/.venv/Lib/site-packages/spacy/tests/pipeline/__pycache__/test_pipe_factories.cpython-312.pyc differ diff --git a/TTS/Kokoro/.venv/Lib/site-packages/spacy/tests/pipeline/__pycache__/test_pipe_methods.cpython-312.pyc b/TTS/Kokoro/.venv/Lib/site-packages/spacy/tests/pipeline/__pycache__/test_pipe_methods.cpython-312.pyc new file mode 100644 index 0000000000000000000000000000000000000000..4ec79341aff1370fd51a5c713d8b87edac3fcf0a Binary files /dev/null and b/TTS/Kokoro/.venv/Lib/site-packages/spacy/tests/pipeline/__pycache__/test_pipe_methods.cpython-312.pyc differ diff --git a/TTS/Kokoro/.venv/Lib/site-packages/spacy/tests/pipeline/__pycache__/test_sentencizer.cpython-312.pyc b/TTS/Kokoro/.venv/Lib/site-packages/spacy/tests/pipeline/__pycache__/test_sentencizer.cpython-312.pyc new file mode 100644 index 0000000000000000000000000000000000000000..39b9df4ac6147bc6d39046428ef21bd2c1056c78 Binary files /dev/null and b/TTS/Kokoro/.venv/Lib/site-packages/spacy/tests/pipeline/__pycache__/test_sentencizer.cpython-312.pyc differ diff --git a/TTS/Kokoro/.venv/Lib/site-packages/spacy/tests/pipeline/__pycache__/test_senter.cpython-312.pyc b/TTS/Kokoro/.venv/Lib/site-packages/spacy/tests/pipeline/__pycache__/test_senter.cpython-312.pyc new file mode 100644 index 0000000000000000000000000000000000000000..17b2b1860c49297afd5b86e1aa1e4eda9d809da6 Binary files /dev/null and b/TTS/Kokoro/.venv/Lib/site-packages/spacy/tests/pipeline/__pycache__/test_senter.cpython-312.pyc differ diff --git a/TTS/Kokoro/.venv/Lib/site-packages/spacy/tests/pipeline/__pycache__/test_span_finder.cpython-312.pyc b/TTS/Kokoro/.venv/Lib/site-packages/spacy/tests/pipeline/__pycache__/test_span_finder.cpython-312.pyc new file mode 100644 index 0000000000000000000000000000000000000000..459eef911b8c56588110c509a121af1dac134ab7 Binary files /dev/null and b/TTS/Kokoro/.venv/Lib/site-packages/spacy/tests/pipeline/__pycache__/test_span_finder.cpython-312.pyc differ diff --git a/TTS/Kokoro/.venv/Lib/site-packages/spacy/tests/pipeline/__pycache__/test_span_ruler.cpython-312.pyc b/TTS/Kokoro/.venv/Lib/site-packages/spacy/tests/pipeline/__pycache__/test_span_ruler.cpython-312.pyc new file mode 100644 index 0000000000000000000000000000000000000000..31bf7405ab692ef2df5c92293369041305408e40 Binary files /dev/null and b/TTS/Kokoro/.venv/Lib/site-packages/spacy/tests/pipeline/__pycache__/test_span_ruler.cpython-312.pyc differ diff --git a/TTS/Kokoro/.venv/Lib/site-packages/spacy/tests/pipeline/__pycache__/test_spancat.cpython-312.pyc b/TTS/Kokoro/.venv/Lib/site-packages/spacy/tests/pipeline/__pycache__/test_spancat.cpython-312.pyc new file mode 100644 index 0000000000000000000000000000000000000000..33b8c890fc9afca4e902ed6d5718af7975501f5e Binary files /dev/null and b/TTS/Kokoro/.venv/Lib/site-packages/spacy/tests/pipeline/__pycache__/test_spancat.cpython-312.pyc differ diff --git a/TTS/Kokoro/.venv/Lib/site-packages/spacy/tests/pipeline/__pycache__/test_tagger.cpython-312.pyc b/TTS/Kokoro/.venv/Lib/site-packages/spacy/tests/pipeline/__pycache__/test_tagger.cpython-312.pyc new file mode 100644 index 0000000000000000000000000000000000000000..3e29cd7d9de6958904f9816b564b7c49c85ea4ff Binary files /dev/null and b/TTS/Kokoro/.venv/Lib/site-packages/spacy/tests/pipeline/__pycache__/test_tagger.cpython-312.pyc differ diff --git a/TTS/Kokoro/.venv/Lib/site-packages/spacy/tests/pipeline/__pycache__/test_textcat.cpython-312.pyc b/TTS/Kokoro/.venv/Lib/site-packages/spacy/tests/pipeline/__pycache__/test_textcat.cpython-312.pyc new file mode 100644 index 0000000000000000000000000000000000000000..7fee1028a488b4cc22228d4b2cbef34e4f75a15f Binary files /dev/null and b/TTS/Kokoro/.venv/Lib/site-packages/spacy/tests/pipeline/__pycache__/test_textcat.cpython-312.pyc differ diff --git a/TTS/Kokoro/.venv/Lib/site-packages/spacy/tests/pipeline/__pycache__/test_tok2vec.cpython-312.pyc b/TTS/Kokoro/.venv/Lib/site-packages/spacy/tests/pipeline/__pycache__/test_tok2vec.cpython-312.pyc new file mode 100644 index 0000000000000000000000000000000000000000..295f0a19430f89e547e6509af283e215b457b37c Binary files /dev/null and b/TTS/Kokoro/.venv/Lib/site-packages/spacy/tests/pipeline/__pycache__/test_tok2vec.cpython-312.pyc differ diff --git a/TTS/Kokoro/.venv/Lib/site-packages/spacy/tests/pipeline/test_analysis.py b/TTS/Kokoro/.venv/Lib/site-packages/spacy/tests/pipeline/test_analysis.py new file mode 100644 index 0000000000000000000000000000000000000000..72464b4ab5e298e7b84e8a28356f7b2a23a68ca2 --- /dev/null +++ b/TTS/Kokoro/.venv/Lib/site-packages/spacy/tests/pipeline/test_analysis.py @@ -0,0 +1,115 @@ +import pytest +from mock import Mock + +from spacy.language import Language +from spacy.pipe_analysis import get_attr_info, validate_attrs + + +def test_component_decorator_assigns(): + @Language.component("c1", assigns=["token.tag", "doc.tensor"]) + def test_component1(doc): + return doc + + @Language.component( + "c2", requires=["token.tag", "token.pos"], assigns=["token.lemma", "doc.tensor"] + ) + def test_component2(doc): + return doc + + @Language.component( + "c3", requires=["token.lemma"], assigns=["token._.custom_lemma"] + ) + def test_component3(doc): + return doc + + assert Language.has_factory("c1") + assert Language.has_factory("c2") + assert Language.has_factory("c3") + + nlp = Language() + nlp.add_pipe("c1") + nlp.add_pipe("c2") + problems = nlp.analyze_pipes()["problems"] + assert problems["c2"] == ["token.pos"] + nlp.add_pipe("c3") + assert get_attr_info(nlp, "doc.tensor")["assigns"] == ["c1", "c2"] + nlp.add_pipe("c1", name="c4") + test_component4_meta = nlp.get_pipe_meta("c1") + assert test_component4_meta.factory == "c1" + assert nlp.pipe_names == ["c1", "c2", "c3", "c4"] + assert not Language.has_factory("c4") + assert nlp.pipe_factories["c1"] == "c1" + assert nlp.pipe_factories["c4"] == "c1" + assert get_attr_info(nlp, "doc.tensor")["assigns"] == ["c1", "c2", "c4"] + assert get_attr_info(nlp, "token.pos")["requires"] == ["c2"] + assert nlp("hello world") + + +def test_component_factories_class_func(): + """Test that class components can implement a from_nlp classmethod that + gives them access to the nlp object and config via the factory.""" + + class TestComponent5: + def __call__(self, doc): + return doc + + mock = Mock() + mock.return_value = TestComponent5() + + def test_componen5_factory(nlp, foo: str = "bar", name="c5"): + return mock(nlp, foo=foo) + + Language.factory("c5", func=test_componen5_factory) + assert Language.has_factory("c5") + nlp = Language() + nlp.add_pipe("c5", config={"foo": "bar"}) + assert nlp("hello world") + mock.assert_called_once_with(nlp, foo="bar") + + +def test_analysis_validate_attrs_valid(): + attrs = ["doc.sents", "doc.ents", "token.tag", "token._.xyz", "span._.xyz"] + assert validate_attrs(attrs) + for attr in attrs: + assert validate_attrs([attr]) + with pytest.raises(ValueError): + validate_attrs(["doc.sents", "doc.xyz"]) + + +@pytest.mark.parametrize( + "attr", + [ + "doc", + "doc_ents", + "doc.xyz", + "token.xyz", + "token.tag_", + "token.tag.xyz", + "token._.xyz.abc", + "span.label", + ], +) +def test_analysis_validate_attrs_invalid(attr): + with pytest.raises(ValueError): + validate_attrs([attr]) + + +def test_analysis_validate_attrs_remove_pipe(): + """Test that attributes are validated correctly on remove.""" + + @Language.component("pipe_analysis_c6", assigns=["token.tag"]) + def c1(doc): + return doc + + @Language.component("pipe_analysis_c7", requires=["token.pos"]) + def c2(doc): + return doc + + nlp = Language() + nlp.add_pipe("pipe_analysis_c6") + nlp.add_pipe("pipe_analysis_c7") + problems = nlp.analyze_pipes()["problems"] + assert problems["pipe_analysis_c7"] == ["token.pos"] + nlp.remove_pipe("pipe_analysis_c7") + problems = nlp.analyze_pipes()["problems"] + assert all(p == [] for p in problems.values()) diff --git a/TTS/Kokoro/.venv/Lib/site-packages/spacy/tests/pipeline/test_annotates_on_update.py b/TTS/Kokoro/.venv/Lib/site-packages/spacy/tests/pipeline/test_annotates_on_update.py new file mode 100644 index 0000000000000000000000000000000000000000..9f261fdda1bfdc0c829dd70c673fef65bb343095 --- /dev/null +++ b/TTS/Kokoro/.venv/Lib/site-packages/spacy/tests/pipeline/test_annotates_on_update.py @@ -0,0 +1,113 @@ +from typing import Callable, Iterable, Iterator + +import pytest +from thinc.api import Config + +from spacy.lang.en import English +from spacy.language import Language +from spacy.training import Example +from spacy.training.loop import train +from spacy.util import load_model_from_config, registry + + +@pytest.fixture +def config_str(): + return """ + [nlp] + lang = "en" + pipeline = ["sentencizer","assert_sents"] + disabled = [] + before_creation = null + after_creation = null + after_pipeline_creation = null + batch_size = 1000 + tokenizer = {"@tokenizers":"spacy.Tokenizer.v1"} + + [components] + + [components.assert_sents] + factory = "assert_sents" + + [components.sentencizer] + factory = "sentencizer" + punct_chars = null + + [training] + dev_corpus = "corpora.dev" + train_corpus = "corpora.train" + annotating_components = ["sentencizer"] + max_steps = 2 + + [corpora] + + [corpora.dev] + @readers = "unannotated_corpus" + + [corpora.train] + @readers = "unannotated_corpus" + """ + + +def test_annotates_on_update(): + # The custom component checks for sentence annotation + @Language.factory("assert_sents", default_config={}) + def assert_sents(nlp, name): + return AssertSents(name) + + class AssertSents: + def __init__(self, name, **cfg): + self.name = name + pass + + def __call__(self, doc): + if not doc.has_annotation("SENT_START"): + raise ValueError("No sents") + return doc + + def update(self, examples, *, drop=0.0, sgd=None, losses=None): + for example in examples: + if not example.predicted.has_annotation("SENT_START"): + raise ValueError("No sents") + return {} + + nlp = English() + nlp.add_pipe("sentencizer") + nlp.add_pipe("assert_sents") + + # When the pipeline runs, annotations are set + nlp("This is a sentence.") + + examples = [] + for text in ["a a", "b b", "c c"]: + examples.append(Example(nlp.make_doc(text), nlp(text))) + + for example in examples: + assert not example.predicted.has_annotation("SENT_START") + + # If updating without setting annotations, assert_sents will raise an error + with pytest.raises(ValueError): + nlp.update(examples) + + # Updating while setting annotations for the sentencizer succeeds + nlp.update(examples, annotates=["sentencizer"]) + + +def test_annotating_components_from_config(config_str): + @registry.readers("unannotated_corpus") + def create_unannotated_corpus() -> Callable[[Language], Iterable[Example]]: + return UnannotatedCorpus() + + class UnannotatedCorpus: + def __call__(self, nlp: Language) -> Iterator[Example]: + for text in ["a a", "b b", "c c"]: + doc = nlp.make_doc(text) + yield Example(doc, doc) + + orig_config = Config().from_str(config_str) + nlp = load_model_from_config(orig_config, auto_fill=True, validate=True) + assert nlp.config["training"]["annotating_components"] == ["sentencizer"] + train(nlp) + + nlp.config["training"]["annotating_components"] = [] + with pytest.raises(ValueError): + train(nlp) diff --git a/TTS/Kokoro/.venv/Lib/site-packages/spacy/tests/pipeline/test_attributeruler.py b/TTS/Kokoro/.venv/Lib/site-packages/spacy/tests/pipeline/test_attributeruler.py new file mode 100644 index 0000000000000000000000000000000000000000..d48f5fc96fe16eb721ddf8425149108c8b87397b --- /dev/null +++ b/TTS/Kokoro/.venv/Lib/site-packages/spacy/tests/pipeline/test_attributeruler.py @@ -0,0 +1,294 @@ +import numpy +import pytest + +from spacy import registry, util +from spacy.lang.en import English +from spacy.pipeline import AttributeRuler +from spacy.tokens import Doc +from spacy.training import Example + +from ..util import make_tempdir + + +@pytest.fixture +def nlp(): + return English() + + +@pytest.fixture +def pattern_dicts(): + return [ + { + "patterns": [[{"ORTH": "a"}], [{"ORTH": "irrelevant"}]], + "attrs": {"LEMMA": "the", "MORPH": "Case=Nom|Number=Plur"}, + }, + # one pattern sets the lemma + {"patterns": [[{"ORTH": "test"}]], "attrs": {"LEMMA": "cat"}}, + # another pattern sets the morphology + { + "patterns": [[{"ORTH": "test"}]], + "attrs": {"MORPH": "Case=Nom|Number=Sing"}, + "index": 0, + }, + ] + + +@pytest.fixture +def tag_map(): + return { + ".": {"POS": "PUNCT", "PunctType": "peri"}, + ",": {"POS": "PUNCT", "PunctType": "comm"}, + } + + +@pytest.fixture +def morph_rules(): + return {"DT": {"the": {"POS": "DET", "LEMMA": "a", "Case": "Nom"}}} + + +def check_tag_map(ruler): + doc = Doc( + ruler.vocab, + words=["This", "is", "a", "test", "."], + tags=["DT", "VBZ", "DT", "NN", "."], + ) + doc = ruler(doc) + for i in range(len(doc)): + if i == 4: + assert doc[i].pos_ == "PUNCT" + assert str(doc[i].morph) == "PunctType=peri" + else: + assert doc[i].pos_ == "" + assert str(doc[i].morph) == "" + + +def check_morph_rules(ruler): + doc = Doc( + ruler.vocab, + words=["This", "is", "the", "test", "."], + tags=["DT", "VBZ", "DT", "NN", "."], + ) + doc = ruler(doc) + for i in range(len(doc)): + if i != 2: + assert doc[i].pos_ == "" + assert str(doc[i].morph) == "" + else: + assert doc[2].pos_ == "DET" + assert doc[2].lemma_ == "a" + assert str(doc[2].morph) == "Case=Nom" + + +def test_attributeruler_init(nlp, pattern_dicts): + a = nlp.add_pipe("attribute_ruler") + for p in pattern_dicts: + a.add(**p) + doc = nlp("This is a test.") + assert doc[2].lemma_ == "the" + assert str(doc[2].morph) == "Case=Nom|Number=Plur" + assert doc[3].lemma_ == "cat" + assert str(doc[3].morph) == "Case=Nom|Number=Sing" + assert doc.has_annotation("LEMMA") + assert doc.has_annotation("MORPH") + + +def test_attributeruler_init_patterns(nlp, pattern_dicts): + # initialize with patterns + ruler = nlp.add_pipe("attribute_ruler") + ruler.initialize(lambda: [], patterns=pattern_dicts) + doc = nlp("This is a test.") + assert doc[2].lemma_ == "the" + assert str(doc[2].morph) == "Case=Nom|Number=Plur" + assert doc[3].lemma_ == "cat" + assert str(doc[3].morph) == "Case=Nom|Number=Sing" + assert doc.has_annotation("LEMMA") + assert doc.has_annotation("MORPH") + nlp.remove_pipe("attribute_ruler") + + # initialize with patterns from misc registry + @registry.misc("attribute_ruler_patterns") + def attribute_ruler_patterns(): + return [ + { + "patterns": [[{"ORTH": "a"}], [{"ORTH": "irrelevant"}]], + "attrs": {"LEMMA": "the", "MORPH": "Case=Nom|Number=Plur"}, + }, + # one pattern sets the lemma + {"patterns": [[{"ORTH": "test"}]], "attrs": {"LEMMA": "cat"}}, + # another pattern sets the morphology + { + "patterns": [[{"ORTH": "test"}]], + "attrs": {"MORPH": "Case=Nom|Number=Sing"}, + "index": 0, + }, + ] + + nlp.config["initialize"]["components"]["attribute_ruler"] = { + "patterns": {"@misc": "attribute_ruler_patterns"} + } + nlp.add_pipe("attribute_ruler") + nlp.initialize() + doc = nlp("This is a test.") + assert doc[2].lemma_ == "the" + assert str(doc[2].morph) == "Case=Nom|Number=Plur" + assert doc[3].lemma_ == "cat" + assert str(doc[3].morph) == "Case=Nom|Number=Sing" + assert doc.has_annotation("LEMMA") + assert doc.has_annotation("MORPH") + + +def test_attributeruler_init_clear(nlp, pattern_dicts): + """Test that initialization clears patterns.""" + ruler = nlp.add_pipe("attribute_ruler") + assert not len(ruler.matcher) + ruler.add_patterns(pattern_dicts) + assert len(ruler.matcher) + ruler.initialize(lambda: []) + assert not len(ruler.matcher) + + +def test_attributeruler_score(nlp, pattern_dicts): + # initialize with patterns + ruler = nlp.add_pipe("attribute_ruler") + ruler.initialize(lambda: [], patterns=pattern_dicts) + doc = nlp("This is a test.") + assert doc[2].lemma_ == "the" + assert str(doc[2].morph) == "Case=Nom|Number=Plur" + assert doc[3].lemma_ == "cat" + assert str(doc[3].morph) == "Case=Nom|Number=Sing" + doc = nlp.make_doc("This is a test.") + dev_examples = [Example.from_dict(doc, {"lemmas": ["this", "is", "a", "cat", "."]})] + scores = nlp.evaluate(dev_examples) + # "cat" is the only correct lemma + assert scores["lemma_acc"] == pytest.approx(0.2) + # no morphs are set + assert scores["morph_acc"] is None + nlp.remove_pipe("attribute_ruler") + + # test with custom scorer + @registry.misc("weird_scorer.v1") + def make_weird_scorer(): + def weird_scorer(examples, weird_score, **kwargs): + return {"weird_score": weird_score} + + return weird_scorer + + ruler = nlp.add_pipe( + "attribute_ruler", config={"scorer": {"@misc": "weird_scorer.v1"}} + ) + ruler.initialize(lambda: [], patterns=pattern_dicts) + scores = nlp.evaluate(dev_examples, scorer_cfg={"weird_score": 0.12345}) + assert scores["weird_score"] == 0.12345 + assert "token_acc" in scores + assert "lemma_acc" not in scores + scores = nlp.evaluate(dev_examples, scorer_cfg={"weird_score": 0.23456}) + assert scores["weird_score"] == 0.23456 + + +def test_attributeruler_rule_order(nlp): + a = AttributeRuler(nlp.vocab) + patterns = [ + {"patterns": [[{"TAG": "VBZ"}]], "attrs": {"POS": "VERB"}}, + {"patterns": [[{"TAG": "VBZ"}]], "attrs": {"POS": "NOUN"}}, + ] + a.add_patterns(patterns) + doc = Doc( + nlp.vocab, + words=["This", "is", "a", "test", "."], + tags=["DT", "VBZ", "DT", "NN", "."], + ) + doc = a(doc) + assert doc[1].pos_ == "NOUN" + + +def test_attributeruler_tag_map(nlp, tag_map): + ruler = AttributeRuler(nlp.vocab) + ruler.load_from_tag_map(tag_map) + check_tag_map(ruler) + + +def test_attributeruler_tag_map_initialize(nlp, tag_map): + ruler = nlp.add_pipe("attribute_ruler") + ruler.initialize(lambda: [], tag_map=tag_map) + check_tag_map(ruler) + + +def test_attributeruler_morph_rules(nlp, morph_rules): + ruler = AttributeRuler(nlp.vocab) + ruler.load_from_morph_rules(morph_rules) + check_morph_rules(ruler) + + +def test_attributeruler_morph_rules_initialize(nlp, morph_rules): + ruler = nlp.add_pipe("attribute_ruler") + ruler.initialize(lambda: [], morph_rules=morph_rules) + check_morph_rules(ruler) + + +def test_attributeruler_indices(nlp): + a = nlp.add_pipe("attribute_ruler") + a.add( + [[{"ORTH": "a"}, {"ORTH": "test"}]], + {"LEMMA": "the", "MORPH": "Case=Nom|Number=Plur"}, + index=0, + ) + a.add( + [[{"ORTH": "This"}, {"ORTH": "is"}]], + {"LEMMA": "was", "MORPH": "Case=Nom|Number=Sing"}, + index=1, + ) + a.add([[{"ORTH": "a"}, {"ORTH": "test"}]], {"LEMMA": "cat"}, index=-1) + + text = "This is a test." + doc = nlp(text) + for i in range(len(doc)): + if i == 1: + assert doc[i].lemma_ == "was" + assert str(doc[i].morph) == "Case=Nom|Number=Sing" + elif i == 2: + assert doc[i].lemma_ == "the" + assert str(doc[i].morph) == "Case=Nom|Number=Plur" + elif i == 3: + assert doc[i].lemma_ == "cat" + else: + assert str(doc[i].morph) == "" + # raises an error when trying to modify a token outside of the match + a.add([[{"ORTH": "a"}, {"ORTH": "test"}]], {"LEMMA": "cat"}, index=2) + with pytest.raises(ValueError): + doc = nlp(text) + # raises an error when trying to modify a token outside of the match + a.add([[{"ORTH": "a"}, {"ORTH": "test"}]], {"LEMMA": "cat"}, index=10) + with pytest.raises(ValueError): + doc = nlp(text) + + +def test_attributeruler_patterns_prop(nlp, pattern_dicts): + a = nlp.add_pipe("attribute_ruler") + a.add_patterns(pattern_dicts) + for p1, p2 in zip(pattern_dicts, a.patterns): + assert p1["patterns"] == p2["patterns"] + assert p1["attrs"] == p2["attrs"] + if p1.get("index"): + assert p1["index"] == p2["index"] + + +def test_attributeruler_serialize(nlp, pattern_dicts): + a = nlp.add_pipe("attribute_ruler") + a.add_patterns(pattern_dicts) + text = "This is a test." + attrs = ["ORTH", "LEMMA", "MORPH"] + doc = nlp(text) + # bytes roundtrip + a_reloaded = AttributeRuler(nlp.vocab).from_bytes(a.to_bytes()) + assert a.to_bytes() == a_reloaded.to_bytes() + doc1 = a_reloaded(nlp.make_doc(text)) + numpy.array_equal(doc.to_array(attrs), doc1.to_array(attrs)) + assert a.patterns == a_reloaded.patterns + # disk roundtrip + with make_tempdir() as tmp_dir: + nlp.to_disk(tmp_dir) + nlp2 = util.load_model_from_path(tmp_dir) + doc2 = nlp2(text) + assert nlp2.get_pipe("attribute_ruler").to_bytes() == a.to_bytes() + assert numpy.array_equal(doc.to_array(attrs), doc2.to_array(attrs)) + assert a.patterns == nlp2.get_pipe("attribute_ruler").patterns diff --git a/TTS/Kokoro/.venv/Lib/site-packages/spacy/tests/pipeline/test_edit_tree_lemmatizer.py b/TTS/Kokoro/.venv/Lib/site-packages/spacy/tests/pipeline/test_edit_tree_lemmatizer.py new file mode 100644 index 0000000000000000000000000000000000000000..16a1805997408d9608354c65f550a1da818109fe --- /dev/null +++ b/TTS/Kokoro/.venv/Lib/site-packages/spacy/tests/pipeline/test_edit_tree_lemmatizer.py @@ -0,0 +1,333 @@ +import pickle + +import hypothesis.strategies as st +import pytest +from hypothesis import given + +from spacy import util +from spacy.lang.en import English +from spacy.language import Language +from spacy.pipeline._edit_tree_internals.edit_trees import EditTrees +from spacy.strings import StringStore +from spacy.training import Example +from spacy.util import make_tempdir + +TRAIN_DATA = [ + ("She likes green eggs", {"lemmas": ["she", "like", "green", "egg"]}), + ("Eat blue ham", {"lemmas": ["eat", "blue", "ham"]}), +] + +PARTIAL_DATA = [ + # partial annotation + ("She likes green eggs", {"lemmas": ["", "like", "green", ""]}), + # misaligned partial annotation + ( + "He hates green eggs", + { + "words": ["He", "hat", "es", "green", "eggs"], + "lemmas": ["", "hat", "e", "green", ""], + }, + ), +] + + +def test_initialize_examples(): + nlp = Language() + lemmatizer = nlp.add_pipe("trainable_lemmatizer") + train_examples = [] + for t in TRAIN_DATA: + train_examples.append(Example.from_dict(nlp.make_doc(t[0]), t[1])) + # you shouldn't really call this more than once, but for testing it should be fine + nlp.initialize(get_examples=lambda: train_examples) + with pytest.raises(TypeError): + nlp.initialize(get_examples=lambda: None) + with pytest.raises(TypeError): + nlp.initialize(get_examples=lambda: train_examples[0]) + with pytest.raises(TypeError): + nlp.initialize(get_examples=lambda: []) + with pytest.raises(TypeError): + nlp.initialize(get_examples=train_examples) + + +def test_initialize_from_labels(): + nlp = Language() + lemmatizer = nlp.add_pipe("trainable_lemmatizer") + lemmatizer.min_tree_freq = 1 + train_examples = [] + for t in TRAIN_DATA: + train_examples.append(Example.from_dict(nlp.make_doc(t[0]), t[1])) + nlp.initialize(get_examples=lambda: train_examples) + + nlp2 = Language() + lemmatizer2 = nlp2.add_pipe("trainable_lemmatizer") + lemmatizer2.initialize( + # We want to check that the strings in replacement nodes are + # added to the string store. Avoid that they get added through + # the examples. + get_examples=lambda: train_examples[:1], + labels=lemmatizer.label_data, + ) + assert lemmatizer2.tree2label == {1: 0, 3: 1, 4: 2, 6: 3} + assert lemmatizer2.label_data == { + "trees": [ + {"orig": "S", "subst": "s"}, + { + "prefix_len": 1, + "suffix_len": 0, + "prefix_tree": 0, + "suffix_tree": 4294967295, + }, + {"orig": "s", "subst": ""}, + { + "prefix_len": 0, + "suffix_len": 1, + "prefix_tree": 4294967295, + "suffix_tree": 2, + }, + { + "prefix_len": 0, + "suffix_len": 0, + "prefix_tree": 4294967295, + "suffix_tree": 4294967295, + }, + {"orig": "E", "subst": "e"}, + { + "prefix_len": 1, + "suffix_len": 0, + "prefix_tree": 5, + "suffix_tree": 4294967295, + }, + ], + "labels": (1, 3, 4, 6), + } + + +@pytest.mark.parametrize("top_k", (1, 5, 30)) +def test_no_data(top_k): + # Test that the lemmatizer provides a nice error when there's no tagging data / labels + TEXTCAT_DATA = [ + ("I'm so happy.", {"cats": {"POSITIVE": 1.0, "NEGATIVE": 0.0}}), + ("I'm so angry", {"cats": {"POSITIVE": 0.0, "NEGATIVE": 1.0}}), + ] + nlp = English() + nlp.add_pipe("trainable_lemmatizer", config={"top_k": top_k}) + nlp.add_pipe("textcat") + + train_examples = [] + for t in TEXTCAT_DATA: + train_examples.append(Example.from_dict(nlp.make_doc(t[0]), t[1])) + + with pytest.raises(ValueError): + nlp.initialize(get_examples=lambda: train_examples) + + +@pytest.mark.parametrize("top_k", (1, 5, 30)) +def test_incomplete_data(top_k): + # Test that the lemmatizer works with incomplete information + nlp = English() + lemmatizer = nlp.add_pipe("trainable_lemmatizer", config={"top_k": top_k}) + lemmatizer.min_tree_freq = 1 + train_examples = [] + for t in PARTIAL_DATA: + train_examples.append(Example.from_dict(nlp.make_doc(t[0]), t[1])) + optimizer = nlp.initialize(get_examples=lambda: train_examples) + for i in range(50): + losses = {} + nlp.update(train_examples, sgd=optimizer, losses=losses) + assert losses["trainable_lemmatizer"] < 0.00001 + + # test the trained model + test_text = "She likes blue eggs" + doc = nlp(test_text) + assert doc[1].lemma_ == "like" + assert doc[2].lemma_ == "blue" + + # Check that incomplete annotations are ignored. + scores, _ = lemmatizer.model([eg.predicted for eg in train_examples], is_train=True) + _, dX = lemmatizer.get_loss(train_examples, scores) + xp = lemmatizer.model.ops.xp + + # Missing annotations. + assert xp.count_nonzero(dX[0][0]) == 0 + assert xp.count_nonzero(dX[0][3]) == 0 + assert xp.count_nonzero(dX[1][0]) == 0 + assert xp.count_nonzero(dX[1][3]) == 0 + + # Misaligned annotations. + assert xp.count_nonzero(dX[1][1]) == 0 + + +@pytest.mark.parametrize("top_k", (1, 5, 30)) +def test_overfitting_IO(top_k): + nlp = English() + lemmatizer = nlp.add_pipe("trainable_lemmatizer", config={"top_k": top_k}) + lemmatizer.min_tree_freq = 1 + train_examples = [] + for t in TRAIN_DATA: + train_examples.append(Example.from_dict(nlp.make_doc(t[0]), t[1])) + + optimizer = nlp.initialize(get_examples=lambda: train_examples) + + for i in range(50): + losses = {} + nlp.update(train_examples, sgd=optimizer, losses=losses) + assert losses["trainable_lemmatizer"] < 0.00001 + + test_text = "She likes blue eggs" + doc = nlp(test_text) + assert doc[0].lemma_ == "she" + assert doc[1].lemma_ == "like" + assert doc[2].lemma_ == "blue" + assert doc[3].lemma_ == "egg" + + # Check model after a {to,from}_disk roundtrip + with util.make_tempdir() as tmp_dir: + nlp.to_disk(tmp_dir) + nlp2 = util.load_model_from_path(tmp_dir) + doc2 = nlp2(test_text) + assert doc2[0].lemma_ == "she" + assert doc2[1].lemma_ == "like" + assert doc2[2].lemma_ == "blue" + assert doc2[3].lemma_ == "egg" + + # Check model after a {to,from}_bytes roundtrip + nlp_bytes = nlp.to_bytes() + nlp3 = English() + nlp3.add_pipe("trainable_lemmatizer", config={"top_k": top_k}) + nlp3.from_bytes(nlp_bytes) + doc3 = nlp3(test_text) + assert doc3[0].lemma_ == "she" + assert doc3[1].lemma_ == "like" + assert doc3[2].lemma_ == "blue" + assert doc3[3].lemma_ == "egg" + + # Check model after a pickle roundtrip. + nlp_bytes = pickle.dumps(nlp) + nlp4 = pickle.loads(nlp_bytes) + doc4 = nlp4(test_text) + assert doc4[0].lemma_ == "she" + assert doc4[1].lemma_ == "like" + assert doc4[2].lemma_ == "blue" + assert doc4[3].lemma_ == "egg" + + +def test_lemmatizer_requires_labels(): + nlp = English() + nlp.add_pipe("trainable_lemmatizer") + with pytest.raises(ValueError): + nlp.initialize() + + +def test_lemmatizer_label_data(): + nlp = English() + lemmatizer = nlp.add_pipe("trainable_lemmatizer") + lemmatizer.min_tree_freq = 1 + train_examples = [] + for t in TRAIN_DATA: + train_examples.append(Example.from_dict(nlp.make_doc(t[0]), t[1])) + + nlp.initialize(get_examples=lambda: train_examples) + + nlp2 = English() + lemmatizer2 = nlp2.add_pipe("trainable_lemmatizer") + lemmatizer2.initialize( + get_examples=lambda: train_examples, labels=lemmatizer.label_data + ) + + # Verify that the labels and trees are the same. + assert lemmatizer.labels == lemmatizer2.labels + assert lemmatizer.trees.to_bytes() == lemmatizer2.trees.to_bytes() + + +def test_dutch(): + strings = StringStore() + trees = EditTrees(strings) + tree = trees.add("deelt", "delen") + assert trees.tree_to_str(tree) == "(m 0 3 () (m 0 2 (s '' 'l') (s 'lt' 'n')))" + + tree = trees.add("gedeeld", "delen") + assert ( + trees.tree_to_str(tree) == "(m 2 3 (s 'ge' '') (m 0 2 (s '' 'l') (s 'ld' 'n')))" + ) + + +def test_from_to_bytes(): + strings = StringStore() + trees = EditTrees(strings) + trees.add("deelt", "delen") + trees.add("gedeeld", "delen") + + b = trees.to_bytes() + + trees2 = EditTrees(strings) + trees2.from_bytes(b) + + # Verify that the nodes did not change. + assert len(trees) == len(trees2) + for i in range(len(trees)): + assert trees.tree_to_str(i) == trees2.tree_to_str(i) + + # Reinserting the same trees should not add new nodes. + trees2.add("deelt", "delen") + trees2.add("gedeeld", "delen") + assert len(trees) == len(trees2) + + +def test_from_to_disk(): + strings = StringStore() + trees = EditTrees(strings) + trees.add("deelt", "delen") + trees.add("gedeeld", "delen") + + trees2 = EditTrees(strings) + with make_tempdir() as temp_dir: + trees_file = temp_dir / "edit_trees.bin" + trees.to_disk(trees_file) + trees2 = trees2.from_disk(trees_file) + + # Verify that the nodes did not change. + assert len(trees) == len(trees2) + for i in range(len(trees)): + assert trees.tree_to_str(i) == trees2.tree_to_str(i) + + # Reinserting the same trees should not add new nodes. + trees2.add("deelt", "delen") + trees2.add("gedeeld", "delen") + assert len(trees) == len(trees2) + + +@given(st.text(), st.text()) +def test_roundtrip(form, lemma): + strings = StringStore() + trees = EditTrees(strings) + tree = trees.add(form, lemma) + assert trees.apply(tree, form) == lemma + + +@given(st.text(alphabet="ab"), st.text(alphabet="ab")) +def test_roundtrip_small_alphabet(form, lemma): + # Test with small alphabets to have more overlap. + strings = StringStore() + trees = EditTrees(strings) + tree = trees.add(form, lemma) + assert trees.apply(tree, form) == lemma + + +def test_unapplicable_trees(): + strings = StringStore() + trees = EditTrees(strings) + tree3 = trees.add("deelt", "delen") + + # Replacement fails. + assert trees.apply(tree3, "deeld") == None + + # Suffix + prefix are too large. + assert trees.apply(tree3, "de") == None + + +def test_empty_strings(): + strings = StringStore() + trees = EditTrees(strings) + no_change = trees.add("xyz", "xyz") + empty = trees.add("", "") + assert no_change == empty diff --git a/TTS/Kokoro/.venv/Lib/site-packages/spacy/tests/pipeline/test_entity_linker.py b/TTS/Kokoro/.venv/Lib/site-packages/spacy/tests/pipeline/test_entity_linker.py new file mode 100644 index 0000000000000000000000000000000000000000..28a0882651a19ba830a6f66d8ecc4408da0e1af0 --- /dev/null +++ b/TTS/Kokoro/.venv/Lib/site-packages/spacy/tests/pipeline/test_entity_linker.py @@ -0,0 +1,1312 @@ +from typing import Any, Callable, Dict, Iterable, Tuple + +import pytest +from numpy.testing import assert_equal + +from spacy import Language, registry, util +from spacy.attrs import ENT_KB_ID +from spacy.compat import pickle +from spacy.kb import Candidate, InMemoryLookupKB, KnowledgeBase, get_candidates +from spacy.lang.en import English +from spacy.ml import load_kb +from spacy.ml.models.entity_linker import build_span_maker +from spacy.pipeline import EntityLinker +from spacy.pipeline.legacy import EntityLinker_v1 +from spacy.pipeline.tok2vec import DEFAULT_TOK2VEC_MODEL +from spacy.scorer import Scorer +from spacy.tests.util import make_tempdir +from spacy.tokens import Doc, Span +from spacy.training import Example +from spacy.util import ensure_path +from spacy.vocab import Vocab + + +@pytest.fixture +def nlp(): + return English() + + +def assert_almost_equal(a, b): + delta = 0.0001 + assert a - delta <= b <= a + delta + + +@pytest.mark.issue(4674) +def test_issue4674(): + """Test that setting entities with overlapping identifiers does not mess up IO""" + nlp = English() + kb = InMemoryLookupKB(nlp.vocab, entity_vector_length=3) + vector1 = [0.9, 1.1, 1.01] + vector2 = [1.8, 2.25, 2.01] + with pytest.warns(UserWarning): + kb.set_entities( + entity_list=["Q1", "Q1"], + freq_list=[32, 111], + vector_list=[vector1, vector2], + ) + assert kb.get_size_entities() == 1 + # dumping to file & loading back in + with make_tempdir() as d: + dir_path = ensure_path(d) + if not dir_path.exists(): + dir_path.mkdir() + file_path = dir_path / "kb" + kb.to_disk(str(file_path)) + kb2 = InMemoryLookupKB(nlp.vocab, entity_vector_length=3) + kb2.from_disk(str(file_path)) + assert kb2.get_size_entities() == 1 + + +@pytest.mark.issue(6730) +def test_issue6730(en_vocab): + """Ensure that the KB does not accept empty strings, but otherwise IO works fine.""" + from spacy.kb.kb_in_memory import InMemoryLookupKB + + kb = InMemoryLookupKB(en_vocab, entity_vector_length=3) + kb.add_entity(entity="1", freq=148, entity_vector=[1, 2, 3]) + + with pytest.raises(ValueError): + kb.add_alias(alias="", entities=["1"], probabilities=[0.4]) + assert kb.contains_alias("") is False + + kb.add_alias(alias="x", entities=["1"], probabilities=[0.2]) + kb.add_alias(alias="y", entities=["1"], probabilities=[0.1]) + + with make_tempdir() as tmp_dir: + kb.to_disk(tmp_dir) + kb.from_disk(tmp_dir) + assert kb.get_size_aliases() == 2 + assert set(kb.get_alias_strings()) == {"x", "y"} + + +@pytest.mark.issue(7065) +def test_issue7065(): + text = "Kathleen Battle sang in Mahler 's Symphony No. 8 at the Cincinnati Symphony Orchestra 's May Festival." + nlp = English() + nlp.add_pipe("sentencizer") + ruler = nlp.add_pipe("entity_ruler") + patterns = [ + { + "label": "THING", + "pattern": [ + {"LOWER": "symphony"}, + {"LOWER": "no"}, + {"LOWER": "."}, + {"LOWER": "8"}, + ], + } + ] + ruler.add_patterns(patterns) + + doc = nlp(text) + sentences = [s for s in doc.sents] + assert len(sentences) == 2 + sent0 = sentences[0] + ent = doc.ents[0] + assert ent.start < sent0.end < ent.end + assert sentences.index(ent.sent) == 0 + + +@pytest.mark.issue(7065) +@pytest.mark.parametrize("entity_in_first_sentence", [True, False]) +def test_sentence_crossing_ents(entity_in_first_sentence: bool): + """Tests if NEL crashes if entities cross sentence boundaries and the first associated sentence doesn't have an + entity. + entity_in_prior_sentence (bool): Whether to include an entity in the first sentence associated with the + sentence-crossing entity. + """ + # Test that the NEL doesn't crash when an entity crosses a sentence boundary + nlp = English() + vector_length = 3 + text = "Mahler 's Symphony No. 8 was beautiful." + entities = [(10, 24, "WORK")] + links = {(10, 24): {"Q7304": 0.0, "Q270853": 1.0}} + if entity_in_first_sentence: + entities.append((0, 6, "PERSON")) + links[(0, 6)] = {"Q7304": 1.0, "Q270853": 0.0} + sent_starts = [1, -1, 0, 0, 0, 1, 0, 0, 0] + doc = nlp(text) + example = Example.from_dict( + doc, {"entities": entities, "links": links, "sent_starts": sent_starts} + ) + train_examples = [example] + + def create_kb(vocab): + # create artificial KB + mykb = InMemoryLookupKB(vocab, entity_vector_length=vector_length) + mykb.add_entity(entity="Q270853", freq=12, entity_vector=[9, 1, -7]) + mykb.add_alias( + alias="No. 8", + entities=["Q270853"], + probabilities=[1.0], + ) + mykb.add_entity(entity="Q7304", freq=12, entity_vector=[6, -4, 3]) + mykb.add_alias( + alias="Mahler", + entities=["Q7304"], + probabilities=[1.0], + ) + return mykb + + # Create the Entity Linker component and add it to the pipeline + entity_linker = nlp.add_pipe("entity_linker", last=True) + entity_linker.set_kb(create_kb) # type: ignore + # train the NEL pipe + optimizer = nlp.initialize(get_examples=lambda: train_examples) + for i in range(2): + nlp.update(train_examples, sgd=optimizer) + + # This shouldn't crash. + entity_linker.predict([example.reference]) # type: ignore + + +def test_no_entities(): + # Test that having no entities doesn't crash the model + TRAIN_DATA = [ + ( + "The sky is blue.", + { + "sent_starts": [1, 0, 0, 0, 0], + }, + ) + ] + nlp = English() + vector_length = 3 + train_examples = [] + for text, annotation in TRAIN_DATA: + doc = nlp(text) + train_examples.append(Example.from_dict(doc, annotation)) + + def create_kb(vocab): + # create artificial KB + mykb = InMemoryLookupKB(vocab, entity_vector_length=vector_length) + mykb.add_entity(entity="Q2146908", freq=12, entity_vector=[6, -4, 3]) + mykb.add_alias("Russ Cochran", ["Q2146908"], [0.9]) + return mykb + + # Create and train the Entity Linker + entity_linker = nlp.add_pipe("entity_linker", last=True) + entity_linker.set_kb(create_kb) + optimizer = nlp.initialize(get_examples=lambda: train_examples) + for i in range(2): + losses = {} + nlp.update(train_examples, sgd=optimizer, losses=losses) + + # adding additional components that are required for the entity_linker + nlp.add_pipe("sentencizer", first=True) + + # this will run the pipeline on the examples and shouldn't crash + nlp.evaluate(train_examples) + + +def test_partial_links(): + # Test that having some entities on the doc without gold links, doesn't crash + TRAIN_DATA = [ + ( + "Russ Cochran his reprints include EC Comics.", + { + "links": {(0, 12): {"Q2146908": 1.0}}, + "entities": [(0, 12, "PERSON")], + "sent_starts": [1, -1, 0, 0, 0, 0, 0, 0], + }, + ) + ] + nlp = English() + vector_length = 3 + train_examples = [] + for text, annotation in TRAIN_DATA: + doc = nlp(text) + train_examples.append(Example.from_dict(doc, annotation)) + + def create_kb(vocab): + # create artificial KB + mykb = InMemoryLookupKB(vocab, entity_vector_length=vector_length) + mykb.add_entity(entity="Q2146908", freq=12, entity_vector=[6, -4, 3]) + mykb.add_alias("Russ Cochran", ["Q2146908"], [0.9]) + return mykb + + # Create and train the Entity Linker + entity_linker = nlp.add_pipe("entity_linker", last=True) + entity_linker.set_kb(create_kb) + optimizer = nlp.initialize(get_examples=lambda: train_examples) + for i in range(2): + losses = {} + nlp.update(train_examples, sgd=optimizer, losses=losses) + + # adding additional components that are required for the entity_linker + nlp.add_pipe("sentencizer", first=True) + patterns = [ + {"label": "PERSON", "pattern": [{"LOWER": "russ"}, {"LOWER": "cochran"}]}, + {"label": "ORG", "pattern": [{"LOWER": "ec"}, {"LOWER": "comics"}]}, + ] + ruler = nlp.add_pipe("entity_ruler", before="entity_linker") + ruler.add_patterns(patterns) + + # this will run the pipeline on the examples and shouldn't crash + results = nlp.evaluate(train_examples) + assert "PERSON" in results["ents_per_type"] + assert "PERSON" in results["nel_f_per_type"] + assert "ORG" in results["ents_per_type"] + assert "ORG" not in results["nel_f_per_type"] + + +def test_kb_valid_entities(nlp): + """Test the valid construction of a KB with 3 entities and two aliases""" + mykb = InMemoryLookupKB(nlp.vocab, entity_vector_length=3) + + # adding entities + mykb.add_entity(entity="Q1", freq=19, entity_vector=[8, 4, 3]) + mykb.add_entity(entity="Q2", freq=5, entity_vector=[2, 1, 0]) + mykb.add_entity(entity="Q3", freq=25, entity_vector=[-1, -6, 5]) + + # adding aliases + mykb.add_alias(alias="douglas", entities=["Q2", "Q3"], probabilities=[0.8, 0.2]) + mykb.add_alias(alias="adam", entities=["Q2"], probabilities=[0.9]) + + # test the size of the corresponding KB + assert mykb.get_size_entities() == 3 + assert mykb.get_size_aliases() == 2 + + # test retrieval of the entity vectors + assert mykb.get_vector("Q1") == [8, 4, 3] + assert mykb.get_vector("Q2") == [2, 1, 0] + assert mykb.get_vector("Q3") == [-1, -6, 5] + + # test retrieval of prior probabilities + assert_almost_equal(mykb.get_prior_prob(entity="Q2", alias="douglas"), 0.8) + assert_almost_equal(mykb.get_prior_prob(entity="Q3", alias="douglas"), 0.2) + assert_almost_equal(mykb.get_prior_prob(entity="Q342", alias="douglas"), 0.0) + assert_almost_equal(mykb.get_prior_prob(entity="Q3", alias="douglassssss"), 0.0) + + +def test_kb_invalid_entities(nlp): + """Test the invalid construction of a KB with an alias linked to a non-existing entity""" + mykb = InMemoryLookupKB(nlp.vocab, entity_vector_length=1) + + # adding entities + mykb.add_entity(entity="Q1", freq=19, entity_vector=[1]) + mykb.add_entity(entity="Q2", freq=5, entity_vector=[2]) + mykb.add_entity(entity="Q3", freq=25, entity_vector=[3]) + + # adding aliases - should fail because one of the given IDs is not valid + with pytest.raises(ValueError): + mykb.add_alias( + alias="douglas", entities=["Q2", "Q342"], probabilities=[0.8, 0.2] + ) + + +def test_kb_invalid_probabilities(nlp): + """Test the invalid construction of a KB with wrong prior probabilities""" + mykb = InMemoryLookupKB(nlp.vocab, entity_vector_length=1) + + # adding entities + mykb.add_entity(entity="Q1", freq=19, entity_vector=[1]) + mykb.add_entity(entity="Q2", freq=5, entity_vector=[2]) + mykb.add_entity(entity="Q3", freq=25, entity_vector=[3]) + + # adding aliases - should fail because the sum of the probabilities exceeds 1 + with pytest.raises(ValueError): + mykb.add_alias(alias="douglas", entities=["Q2", "Q3"], probabilities=[0.8, 0.4]) + + +def test_kb_invalid_combination(nlp): + """Test the invalid construction of a KB with non-matching entity and probability lists""" + mykb = InMemoryLookupKB(nlp.vocab, entity_vector_length=1) + + # adding entities + mykb.add_entity(entity="Q1", freq=19, entity_vector=[1]) + mykb.add_entity(entity="Q2", freq=5, entity_vector=[2]) + mykb.add_entity(entity="Q3", freq=25, entity_vector=[3]) + + # adding aliases - should fail because the entities and probabilities vectors are not of equal length + with pytest.raises(ValueError): + mykb.add_alias( + alias="douglas", entities=["Q2", "Q3"], probabilities=[0.3, 0.4, 0.1] + ) + + +def test_kb_invalid_entity_vector(nlp): + """Test the invalid construction of a KB with non-matching entity vector lengths""" + mykb = InMemoryLookupKB(nlp.vocab, entity_vector_length=3) + + # adding entities + mykb.add_entity(entity="Q1", freq=19, entity_vector=[1, 2, 3]) + + # this should fail because the kb's expected entity vector length is 3 + with pytest.raises(ValueError): + mykb.add_entity(entity="Q2", freq=5, entity_vector=[2]) + + +def test_kb_default(nlp): + """Test that the default (empty) KB is loaded upon construction""" + entity_linker = nlp.add_pipe("entity_linker", config={}) + assert len(entity_linker.kb) == 0 + with pytest.raises(ValueError, match="E139"): + # this raises an error because the KB is empty + entity_linker.validate_kb() + assert entity_linker.kb.get_size_entities() == 0 + assert entity_linker.kb.get_size_aliases() == 0 + # 64 is the default value from pipeline.entity_linker + assert entity_linker.kb.entity_vector_length == 64 + + +def test_kb_custom_length(nlp): + """Test that the default (empty) KB can be configured with a custom entity length""" + entity_linker = nlp.add_pipe("entity_linker", config={"entity_vector_length": 35}) + assert len(entity_linker.kb) == 0 + assert entity_linker.kb.get_size_entities() == 0 + assert entity_linker.kb.get_size_aliases() == 0 + assert entity_linker.kb.entity_vector_length == 35 + + +def test_kb_initialize_empty(nlp): + """Test that the EL can't initialize without examples""" + entity_linker = nlp.add_pipe("entity_linker") + with pytest.raises(TypeError): + entity_linker.initialize(lambda: []) + + +def test_kb_serialize(nlp): + """Test serialization of the KB""" + mykb = InMemoryLookupKB(nlp.vocab, entity_vector_length=1) + with make_tempdir() as d: + # normal read-write behaviour + mykb.to_disk(d / "kb") + mykb.from_disk(d / "kb") + mykb.to_disk(d / "new" / "kb") + mykb.from_disk(d / "new" / "kb") + # allow overwriting an existing file + mykb.to_disk(d / "kb") + with pytest.raises(ValueError): + # can not read from an unknown file + mykb.from_disk(d / "unknown" / "kb") + + +@pytest.mark.issue(9137) +def test_kb_serialize_2(nlp): + v = [5, 6, 7, 8] + kb1 = InMemoryLookupKB(vocab=nlp.vocab, entity_vector_length=4) + kb1.set_entities(["E1"], [1], [v]) + assert kb1.get_vector("E1") == v + with make_tempdir() as d: + kb1.to_disk(d / "kb") + kb2 = InMemoryLookupKB(vocab=nlp.vocab, entity_vector_length=4) + kb2.from_disk(d / "kb") + assert kb2.get_vector("E1") == v + + +def test_kb_set_entities(nlp): + """Test that set_entities entirely overwrites the previous set of entities""" + v = [5, 6, 7, 8] + v1 = [1, 1, 1, 0] + v2 = [2, 2, 2, 3] + kb1 = InMemoryLookupKB(vocab=nlp.vocab, entity_vector_length=4) + kb1.set_entities(["E0"], [1], [v]) + assert kb1.get_entity_strings() == ["E0"] + kb1.set_entities(["E1", "E2"], [1, 9], [v1, v2]) + assert set(kb1.get_entity_strings()) == {"E1", "E2"} + assert kb1.get_vector("E1") == v1 + assert kb1.get_vector("E2") == v2 + with make_tempdir() as d: + kb1.to_disk(d / "kb") + kb2 = InMemoryLookupKB(vocab=nlp.vocab, entity_vector_length=4) + kb2.from_disk(d / "kb") + assert set(kb2.get_entity_strings()) == {"E1", "E2"} + assert kb2.get_vector("E1") == v1 + assert kb2.get_vector("E2") == v2 + + +def test_kb_serialize_vocab(nlp): + """Test serialization of the KB and custom strings""" + entity = "MyFunnyID" + assert entity not in nlp.vocab.strings + mykb = InMemoryLookupKB(nlp.vocab, entity_vector_length=1) + assert not mykb.contains_entity(entity) + mykb.add_entity(entity, freq=342, entity_vector=[3]) + assert mykb.contains_entity(entity) + assert entity in mykb.vocab.strings + with make_tempdir() as d: + # normal read-write behaviour + mykb.to_disk(d / "kb") + mykb_new = InMemoryLookupKB(Vocab(), entity_vector_length=1) + mykb_new.from_disk(d / "kb") + assert entity in mykb_new.vocab.strings + + +def test_candidate_generation(nlp): + """Test correct candidate generation""" + mykb = InMemoryLookupKB(nlp.vocab, entity_vector_length=1) + doc = nlp("douglas adam Adam shrubbery") + + douglas_ent = doc[0:1] + adam_ent = doc[1:2] + Adam_ent = doc[2:3] + shrubbery_ent = doc[3:4] + + # adding entities + mykb.add_entity(entity="Q1", freq=27, entity_vector=[1]) + mykb.add_entity(entity="Q2", freq=12, entity_vector=[2]) + mykb.add_entity(entity="Q3", freq=5, entity_vector=[3]) + + # adding aliases + mykb.add_alias(alias="douglas", entities=["Q2", "Q3"], probabilities=[0.8, 0.1]) + mykb.add_alias(alias="adam", entities=["Q2"], probabilities=[0.9]) + + # test the size of the relevant candidates + assert len(get_candidates(mykb, douglas_ent)) == 2 + assert len(get_candidates(mykb, adam_ent)) == 1 + assert len(get_candidates(mykb, Adam_ent)) == 0 # default case sensitive + assert len(get_candidates(mykb, shrubbery_ent)) == 0 + + # test the content of the candidates + assert get_candidates(mykb, adam_ent)[0].entity_ == "Q2" + assert get_candidates(mykb, adam_ent)[0].alias_ == "adam" + assert_almost_equal(get_candidates(mykb, adam_ent)[0].entity_freq, 12) + assert_almost_equal(get_candidates(mykb, adam_ent)[0].prior_prob, 0.9) + + +def test_el_pipe_configuration(nlp): + """Test correct candidate generation as part of the EL pipe""" + nlp.add_pipe("sentencizer") + pattern = {"label": "PERSON", "pattern": [{"LOWER": "douglas"}]} + ruler = nlp.add_pipe("entity_ruler") + ruler.add_patterns([pattern]) + + def create_kb(vocab): + kb = InMemoryLookupKB(vocab, entity_vector_length=1) + kb.add_entity(entity="Q2", freq=12, entity_vector=[2]) + kb.add_entity(entity="Q3", freq=5, entity_vector=[3]) + kb.add_alias(alias="douglas", entities=["Q2", "Q3"], probabilities=[0.8, 0.1]) + return kb + + # run an EL pipe without a trained context encoder, to check the candidate generation step only + entity_linker = nlp.add_pipe("entity_linker", config={"incl_context": False}) + entity_linker.set_kb(create_kb) + # With the default get_candidates function, matching is case-sensitive + text = "Douglas and douglas are not the same." + doc = nlp(text) + assert doc[0].ent_kb_id_ == "NIL" + assert doc[1].ent_kb_id_ == "" + assert doc[2].ent_kb_id_ == "Q2" + + def get_lowercased_candidates(kb, span): + return kb.get_alias_candidates(span.text.lower()) + + def get_lowercased_candidates_batch(kb, spans): + return [get_lowercased_candidates(kb, span) for span in spans] + + @registry.misc("spacy.LowercaseCandidateGenerator.v1") + def create_candidates() -> ( + Callable[[InMemoryLookupKB, "Span"], Iterable[Candidate]] + ): + return get_lowercased_candidates + + @registry.misc("spacy.LowercaseCandidateBatchGenerator.v1") + def create_candidates_batch() -> ( + Callable[[InMemoryLookupKB, Iterable["Span"]], Iterable[Iterable[Candidate]]] + ): + return get_lowercased_candidates_batch + + # replace the pipe with a new one with with a different candidate generator + entity_linker = nlp.replace_pipe( + "entity_linker", + "entity_linker", + config={ + "incl_context": False, + "get_candidates": {"@misc": "spacy.LowercaseCandidateGenerator.v1"}, + "get_candidates_batch": { + "@misc": "spacy.LowercaseCandidateBatchGenerator.v1" + }, + }, + ) + entity_linker.set_kb(create_kb) + doc = nlp(text) + assert doc[0].ent_kb_id_ == "Q2" + assert doc[1].ent_kb_id_ == "" + assert doc[2].ent_kb_id_ == "Q2" + + +def test_nel_nsents(nlp): + """Test that n_sents can be set through the configuration""" + entity_linker = nlp.add_pipe("entity_linker", config={}) + assert entity_linker.n_sents == 0 + entity_linker = nlp.replace_pipe( + "entity_linker", "entity_linker", config={"n_sents": 2} + ) + assert entity_linker.n_sents == 2 + + +def test_vocab_serialization(nlp): + """Test that string information is retained across storage""" + mykb = InMemoryLookupKB(nlp.vocab, entity_vector_length=1) + + # adding entities + mykb.add_entity(entity="Q1", freq=27, entity_vector=[1]) + q2_hash = mykb.add_entity(entity="Q2", freq=12, entity_vector=[2]) + mykb.add_entity(entity="Q3", freq=5, entity_vector=[3]) + + # adding aliases + mykb.add_alias(alias="douglas", entities=["Q2", "Q3"], probabilities=[0.4, 0.1]) + adam_hash = mykb.add_alias(alias="adam", entities=["Q2"], probabilities=[0.9]) + + candidates = mykb.get_alias_candidates("adam") + assert len(candidates) == 1 + assert candidates[0].entity == q2_hash + assert candidates[0].entity_ == "Q2" + assert candidates[0].alias == adam_hash + assert candidates[0].alias_ == "adam" + + with make_tempdir() as d: + mykb.to_disk(d / "kb") + kb_new_vocab = InMemoryLookupKB(Vocab(), entity_vector_length=1) + kb_new_vocab.from_disk(d / "kb") + + candidates = kb_new_vocab.get_alias_candidates("adam") + assert len(candidates) == 1 + assert candidates[0].entity == q2_hash + assert candidates[0].entity_ == "Q2" + assert candidates[0].alias == adam_hash + assert candidates[0].alias_ == "adam" + + assert kb_new_vocab.get_vector("Q2") == [2] + assert_almost_equal(kb_new_vocab.get_prior_prob("Q2", "douglas"), 0.4) + + +def test_append_alias(nlp): + """Test that we can append additional alias-entity pairs""" + mykb = InMemoryLookupKB(nlp.vocab, entity_vector_length=1) + + # adding entities + mykb.add_entity(entity="Q1", freq=27, entity_vector=[1]) + mykb.add_entity(entity="Q2", freq=12, entity_vector=[2]) + mykb.add_entity(entity="Q3", freq=5, entity_vector=[3]) + + # adding aliases + mykb.add_alias(alias="douglas", entities=["Q2", "Q3"], probabilities=[0.4, 0.1]) + mykb.add_alias(alias="adam", entities=["Q2"], probabilities=[0.9]) + + # test the size of the relevant candidates + assert len(mykb.get_alias_candidates("douglas")) == 2 + + # append an alias + mykb.append_alias(alias="douglas", entity="Q1", prior_prob=0.2) + + # test the size of the relevant candidates has been incremented + assert len(mykb.get_alias_candidates("douglas")) == 3 + + # append the same alias-entity pair again should not work (will throw a warning) + with pytest.warns(UserWarning): + mykb.append_alias(alias="douglas", entity="Q1", prior_prob=0.3) + + # test the size of the relevant candidates remained unchanged + assert len(mykb.get_alias_candidates("douglas")) == 3 + + +@pytest.mark.filterwarnings("ignore:\\[W036") +def test_append_invalid_alias(nlp): + """Test that append an alias will throw an error if prior probs are exceeding 1""" + mykb = InMemoryLookupKB(nlp.vocab, entity_vector_length=1) + + # adding entities + mykb.add_entity(entity="Q1", freq=27, entity_vector=[1]) + mykb.add_entity(entity="Q2", freq=12, entity_vector=[2]) + mykb.add_entity(entity="Q3", freq=5, entity_vector=[3]) + + # adding aliases + mykb.add_alias(alias="douglas", entities=["Q2", "Q3"], probabilities=[0.8, 0.1]) + mykb.add_alias(alias="adam", entities=["Q2"], probabilities=[0.9]) + + # append an alias - should fail because the entities and probabilities vectors are not of equal length + with pytest.raises(ValueError): + mykb.append_alias(alias="douglas", entity="Q1", prior_prob=0.2) + + +@pytest.mark.filterwarnings("ignore:\\[W036") +def test_preserving_links_asdoc(nlp): + """Test that Span.as_doc preserves the existing entity links""" + vector_length = 1 + + def create_kb(vocab): + mykb = InMemoryLookupKB(vocab, entity_vector_length=vector_length) + # adding entities + mykb.add_entity(entity="Q1", freq=19, entity_vector=[1]) + mykb.add_entity(entity="Q2", freq=8, entity_vector=[1]) + # adding aliases + mykb.add_alias(alias="Boston", entities=["Q1"], probabilities=[0.7]) + mykb.add_alias(alias="Denver", entities=["Q2"], probabilities=[0.6]) + return mykb + + # set up pipeline with NER (Entity Ruler) and NEL (prior probability only, model not trained) + nlp.add_pipe("sentencizer") + patterns = [ + {"label": "GPE", "pattern": "Boston"}, + {"label": "GPE", "pattern": "Denver"}, + ] + ruler = nlp.add_pipe("entity_ruler") + ruler.add_patterns(patterns) + config = {"incl_prior": False} + entity_linker = nlp.add_pipe("entity_linker", config=config, last=True) + entity_linker.set_kb(create_kb) + nlp.initialize() + assert entity_linker.model.get_dim("nO") == vector_length + + # test whether the entity links are preserved by the `as_doc()` function + text = "She lives in Boston. He lives in Denver." + doc = nlp(text) + for ent in doc.ents: + orig_text = ent.text + orig_kb_id = ent.kb_id_ + sent_doc = ent.sent.as_doc() + for s_ent in sent_doc.ents: + if s_ent.text == orig_text: + assert s_ent.kb_id_ == orig_kb_id + + +def test_preserving_links_ents(nlp): + """Test that doc.ents preserves KB annotations""" + text = "She lives in Boston. He lives in Denver." + doc = nlp(text) + assert len(list(doc.ents)) == 0 + + boston_ent = Span(doc, 3, 4, label="LOC", kb_id="Q1") + doc.ents = [boston_ent] + assert len(list(doc.ents)) == 1 + assert list(doc.ents)[0].label_ == "LOC" + assert list(doc.ents)[0].kb_id_ == "Q1" + + +def test_preserving_links_ents_2(nlp): + """Test that doc.ents preserves KB annotations""" + text = "She lives in Boston. He lives in Denver." + doc = nlp(text) + assert len(list(doc.ents)) == 0 + + loc = doc.vocab.strings.add("LOC") + q1 = doc.vocab.strings.add("Q1") + + doc.ents = [(loc, q1, 3, 4)] + assert len(list(doc.ents)) == 1 + assert list(doc.ents)[0].label_ == "LOC" + assert list(doc.ents)[0].kb_id_ == "Q1" + + +# fmt: off +TRAIN_DATA = [ + ("Russ Cochran captured his first major title with his son as caddie.", + {"links": {(0, 12): {"Q7381115": 0.0, "Q2146908": 1.0}}, + "entities": [(0, 12, "PERSON")], + "sent_starts": [1, -1, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0]}), + ("Russ Cochran his reprints include EC Comics.", + {"links": {(0, 12): {"Q7381115": 1.0, "Q2146908": 0.0}}, + "entities": [(0, 12, "PERSON"), (34, 43, "ART")], + "sent_starts": [1, -1, 0, 0, 0, 0, 0, 0]}), + ("Russ Cochran has been publishing comic art.", + {"links": {(0, 12): {"Q7381115": 1.0, "Q2146908": 0.0}}, + "entities": [(0, 12, "PERSON")], + "sent_starts": [1, -1, 0, 0, 0, 0, 0, 0]}), + ("Russ Cochran was a member of University of Kentucky's golf team.", + {"links": {(0, 12): {"Q7381115": 0.0, "Q2146908": 1.0}}, + "entities": [(0, 12, "PERSON"), (43, 51, "LOC")], + "sent_starts": [1, -1, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0]}), + # having a blank instance shouldn't break things + ("The weather is nice today.", + {"links": {}, "entities": [], + "sent_starts": [1, -1, 0, 0, 0, 0]}) +] +GOLD_entities = ["Q2146908", "Q7381115", "Q7381115", "Q2146908"] +# fmt: on + + +def test_overfitting_IO_gold_entities(): + # Simple test to try and quickly overfit the NEL component - ensuring the ML models work correctly + nlp = English() + vector_length = 3 + assert "Q2146908" not in nlp.vocab.strings + + # Convert the texts to docs to make sure we have doc.ents set for the training examples + train_examples = [] + for text, annotation in TRAIN_DATA: + doc = nlp(text) + train_examples.append(Example.from_dict(doc, annotation)) + + def create_kb(vocab): + # create artificial KB - assign same prior weight to the two russ cochran's + # Q2146908 (Russ Cochran): American golfer + # Q7381115 (Russ Cochran): publisher + mykb = InMemoryLookupKB(vocab, entity_vector_length=vector_length) + mykb.add_entity(entity="Q2146908", freq=12, entity_vector=[6, -4, 3]) + mykb.add_entity(entity="Q7381115", freq=12, entity_vector=[9, 1, -7]) + mykb.add_alias( + alias="Russ Cochran", + entities=["Q2146908", "Q7381115"], + probabilities=[0.5, 0.5], + ) + return mykb + + # Create the Entity Linker component and add it to the pipeline + entity_linker = nlp.add_pipe( + "entity_linker", last=True, config={"use_gold_ents": True} + ) + assert isinstance(entity_linker, EntityLinker) + entity_linker.set_kb(create_kb) + assert "Q2146908" in entity_linker.vocab.strings + assert "Q2146908" in entity_linker.kb.vocab.strings + + # train the NEL pipe + optimizer = nlp.initialize(get_examples=lambda: train_examples) + assert entity_linker.model.get_dim("nO") == vector_length + assert entity_linker.model.get_dim("nO") == entity_linker.kb.entity_vector_length + + for i in range(50): + losses = {} + nlp.update(train_examples, sgd=optimizer, losses=losses) + assert losses["entity_linker"] < 0.001 + + # adding additional components that are required for the entity_linker + nlp.add_pipe("sentencizer", first=True) + + # Add a custom component to recognize "Russ Cochran" as an entity for the example training data + patterns = [ + {"label": "PERSON", "pattern": [{"LOWER": "russ"}, {"LOWER": "cochran"}]} + ] + ruler = nlp.add_pipe("entity_ruler", before="entity_linker") + ruler.add_patterns(patterns) + + # test the trained model + predictions = [] + for text, annotation in TRAIN_DATA: + doc = nlp(text) + for ent in doc.ents: + predictions.append(ent.kb_id_) + assert predictions == GOLD_entities + + # Also test the results are still the same after IO + with make_tempdir() as tmp_dir: + nlp.to_disk(tmp_dir) + nlp2 = util.load_model_from_path(tmp_dir) + assert nlp2.pipe_names == nlp.pipe_names + assert "Q2146908" in nlp2.vocab.strings + entity_linker2 = nlp2.get_pipe("entity_linker") + assert "Q2146908" in entity_linker2.vocab.strings + assert "Q2146908" in entity_linker2.kb.vocab.strings + predictions = [] + for text, annotation in TRAIN_DATA: + doc2 = nlp2(text) + for ent in doc2.ents: + predictions.append(ent.kb_id_) + assert predictions == GOLD_entities + + # Make sure that running pipe twice, or comparing to call, always amounts to the same predictions + texts = [ + "Russ Cochran captured his first major title with his son as caddie.", + "Russ Cochran his reprints include EC Comics.", + "Russ Cochran has been publishing comic art.", + "Russ Cochran was a member of University of Kentucky's golf team.", + ] + batch_deps_1 = [doc.to_array([ENT_KB_ID]) for doc in nlp.pipe(texts)] + batch_deps_2 = [doc.to_array([ENT_KB_ID]) for doc in nlp.pipe(texts)] + no_batch_deps = [doc.to_array([ENT_KB_ID]) for doc in [nlp(text) for text in texts]] + assert_equal(batch_deps_1, batch_deps_2) + assert_equal(batch_deps_1, no_batch_deps) + + eval = nlp.evaluate(train_examples) + assert "nel_macro_p" in eval + assert "nel_macro_r" in eval + assert "nel_macro_f" in eval + assert "nel_micro_p" in eval + assert "nel_micro_r" in eval + assert "nel_micro_f" in eval + assert "nel_f_per_type" in eval + assert "PERSON" in eval["nel_f_per_type"] + + assert eval["nel_macro_f"] > 0 + assert eval["nel_micro_f"] > 0 + + +def test_overfitting_IO_with_ner(): + # Simple test to try and overfit the NER and NEL component in combination - ensuring the ML models work correctly + nlp = English() + vector_length = 3 + assert "Q2146908" not in nlp.vocab.strings + + # Convert the texts to docs to make sure we have doc.ents set for the training examples + train_examples = [] + for text, annotation in TRAIN_DATA: + doc = nlp(text) + train_examples.append(Example.from_dict(doc, annotation)) + + def create_kb(vocab): + # create artificial KB - assign same prior weight to the two russ cochran's + # Q2146908 (Russ Cochran): American golfer + # Q7381115 (Russ Cochran): publisher + mykb = InMemoryLookupKB(vocab, entity_vector_length=vector_length) + mykb.add_entity(entity="Q2146908", freq=12, entity_vector=[6, -4, 3]) + mykb.add_entity(entity="Q7381115", freq=12, entity_vector=[9, 1, -7]) + mykb.add_alias( + alias="Russ Cochran", + entities=["Q2146908", "Q7381115"], + probabilities=[0.5, 0.5], + ) + return mykb + + # Create the NER and EL components and add them to the pipeline + ner = nlp.add_pipe("ner", first=True) + entity_linker = nlp.add_pipe( + "entity_linker", last=True, config={"use_gold_ents": False} + ) + entity_linker.set_kb(create_kb) + + train_examples = [] + for text, annotations in TRAIN_DATA: + train_examples.append(Example.from_dict(nlp.make_doc(text), annotations)) + for ent in annotations.get("entities"): + ner.add_label(ent[2]) + optimizer = nlp.initialize() + + # train the NER and NEL pipes + for i in range(50): + losses = {} + nlp.update(train_examples, sgd=optimizer, losses=losses) + assert losses["ner"] < 0.001 + assert losses["entity_linker"] < 0.001 + + # adding additional components that are required for the entity_linker + nlp.add_pipe("sentencizer", first=True) + + # test the trained model + test_text = "Russ Cochran captured his first major title with his son as caddie." + doc = nlp(test_text) + ents = doc.ents + assert len(ents) == 1 + assert ents[0].text == "Russ Cochran" + assert ents[0].label_ == "PERSON" + assert ents[0].kb_id_ != "NIL" + + # TODO: below assert is still flaky - EL doesn't properly overfit quite yet + # assert ents[0].kb_id_ == "Q2146908" + + # Also test the results are still the same after IO + with make_tempdir() as tmp_dir: + nlp.to_disk(tmp_dir) + nlp2 = util.load_model_from_path(tmp_dir) + assert nlp2.pipe_names == nlp.pipe_names + doc2 = nlp2(test_text) + ents2 = doc2.ents + assert len(ents2) == 1 + assert ents2[0].text == "Russ Cochran" + assert ents2[0].label_ == "PERSON" + assert ents2[0].kb_id_ != "NIL" + + eval = nlp.evaluate(train_examples) + assert "nel_macro_f" in eval + assert "nel_micro_f" in eval + assert "ents_f" in eval + assert "nel_f_per_type" in eval + assert "ents_per_type" in eval + assert "PERSON" in eval["nel_f_per_type"] + assert "PERSON" in eval["ents_per_type"] + + assert eval["nel_macro_f"] > 0 + assert eval["nel_micro_f"] > 0 + assert eval["ents_f"] > 0 + + +def test_kb_serialization(): + # Test that the KB can be used in a pipeline with a different vocab + vector_length = 3 + with make_tempdir() as tmp_dir: + kb_dir = tmp_dir / "kb" + nlp1 = English() + assert "Q2146908" not in nlp1.vocab.strings + mykb = InMemoryLookupKB(nlp1.vocab, entity_vector_length=vector_length) + mykb.add_entity(entity="Q2146908", freq=12, entity_vector=[6, -4, 3]) + mykb.add_alias(alias="Russ Cochran", entities=["Q2146908"], probabilities=[0.8]) + assert "Q2146908" in nlp1.vocab.strings + mykb.to_disk(kb_dir) + + nlp2 = English() + assert "RandomWord" not in nlp2.vocab.strings + nlp2.vocab.strings.add("RandomWord") + assert "RandomWord" in nlp2.vocab.strings + assert "Q2146908" not in nlp2.vocab.strings + + # Create the Entity Linker component with the KB from file, and check the final vocab + entity_linker = nlp2.add_pipe("entity_linker", last=True) + entity_linker.set_kb(load_kb(kb_dir)) + assert "Q2146908" in nlp2.vocab.strings + assert "RandomWord" in nlp2.vocab.strings + + +@pytest.mark.xfail(reason="Needs fixing") +def test_kb_pickle(): + # Test that the KB can be pickled + nlp = English() + kb_1 = InMemoryLookupKB(nlp.vocab, entity_vector_length=3) + kb_1.add_entity(entity="Q2146908", freq=12, entity_vector=[6, -4, 3]) + assert not kb_1.contains_alias("Russ Cochran") + kb_1.add_alias(alias="Russ Cochran", entities=["Q2146908"], probabilities=[0.8]) + assert kb_1.contains_alias("Russ Cochran") + data = pickle.dumps(kb_1) + kb_2 = pickle.loads(data) + assert kb_2.contains_alias("Russ Cochran") + + +@pytest.mark.xfail(reason="Needs fixing") +def test_nel_pickle(): + # Test that a pipeline with an EL component can be pickled + def create_kb(vocab): + kb = InMemoryLookupKB(vocab, entity_vector_length=3) + kb.add_entity(entity="Q2146908", freq=12, entity_vector=[6, -4, 3]) + kb.add_alias(alias="Russ Cochran", entities=["Q2146908"], probabilities=[0.8]) + return kb + + nlp_1 = English() + nlp_1.add_pipe("ner") + entity_linker_1 = nlp_1.add_pipe("entity_linker", last=True) + entity_linker_1.set_kb(create_kb) + assert nlp_1.pipe_names == ["ner", "entity_linker"] + assert entity_linker_1.kb.contains_alias("Russ Cochran") + + data = pickle.dumps(nlp_1) + nlp_2 = pickle.loads(data) + assert nlp_2.pipe_names == ["ner", "entity_linker"] + entity_linker_2 = nlp_2.get_pipe("entity_linker") + assert entity_linker_2.kb.contains_alias("Russ Cochran") + + +def test_kb_to_bytes(): + # Test that the KB's to_bytes method works correctly + nlp = English() + kb_1 = InMemoryLookupKB(nlp.vocab, entity_vector_length=3) + kb_1.add_entity(entity="Q2146908", freq=12, entity_vector=[6, -4, 3]) + kb_1.add_entity(entity="Q66", freq=9, entity_vector=[1, 2, 3]) + kb_1.add_alias(alias="Russ Cochran", entities=["Q2146908"], probabilities=[0.8]) + kb_1.add_alias(alias="Boeing", entities=["Q66"], probabilities=[0.5]) + kb_1.add_alias( + alias="Randomness", entities=["Q66", "Q2146908"], probabilities=[0.1, 0.2] + ) + assert kb_1.contains_alias("Russ Cochran") + kb_bytes = kb_1.to_bytes() + kb_2 = InMemoryLookupKB(nlp.vocab, entity_vector_length=3) + assert not kb_2.contains_alias("Russ Cochran") + kb_2 = kb_2.from_bytes(kb_bytes) + # check that both KBs are exactly the same + assert kb_1.get_size_entities() == kb_2.get_size_entities() + assert kb_1.entity_vector_length == kb_2.entity_vector_length + assert kb_1.get_entity_strings() == kb_2.get_entity_strings() + assert kb_1.get_vector("Q2146908") == kb_2.get_vector("Q2146908") + assert kb_1.get_vector("Q66") == kb_2.get_vector("Q66") + assert kb_2.contains_alias("Russ Cochran") + assert kb_1.get_size_aliases() == kb_2.get_size_aliases() + assert kb_1.get_alias_strings() == kb_2.get_alias_strings() + assert len(kb_1.get_alias_candidates("Russ Cochran")) == len( + kb_2.get_alias_candidates("Russ Cochran") + ) + assert len(kb_1.get_alias_candidates("Randomness")) == len( + kb_2.get_alias_candidates("Randomness") + ) + + +def test_nel_to_bytes(): + # Test that a pipeline with an EL component can be converted to bytes + def create_kb(vocab): + kb = InMemoryLookupKB(vocab, entity_vector_length=3) + kb.add_entity(entity="Q2146908", freq=12, entity_vector=[6, -4, 3]) + kb.add_alias(alias="Russ Cochran", entities=["Q2146908"], probabilities=[0.8]) + return kb + + nlp_1 = English() + nlp_1.add_pipe("ner") + entity_linker_1 = nlp_1.add_pipe("entity_linker", last=True) + entity_linker_1.set_kb(create_kb) + assert entity_linker_1.kb.contains_alias("Russ Cochran") + assert nlp_1.pipe_names == ["ner", "entity_linker"] + + nlp_bytes = nlp_1.to_bytes() + nlp_2 = English() + nlp_2.add_pipe("ner") + nlp_2.add_pipe("entity_linker", last=True) + assert nlp_2.pipe_names == ["ner", "entity_linker"] + assert not nlp_2.get_pipe("entity_linker").kb.contains_alias("Russ Cochran") + nlp_2 = nlp_2.from_bytes(nlp_bytes) + kb_2 = nlp_2.get_pipe("entity_linker").kb + assert kb_2.contains_alias("Russ Cochran") + assert kb_2.get_vector("Q2146908") == [6, -4, 3] + assert_almost_equal( + kb_2.get_prior_prob(entity="Q2146908", alias="Russ Cochran"), 0.8 + ) + + +def test_scorer_links(): + train_examples = [] + nlp = English() + ref1 = nlp("Julia lives in London happily.") + ref1.ents = [ + Span(ref1, 0, 1, label="PERSON", kb_id="Q2"), + Span(ref1, 3, 4, label="LOC", kb_id="Q3"), + ] + pred1 = nlp("Julia lives in London happily.") + pred1.ents = [ + Span(pred1, 0, 1, label="PERSON", kb_id="Q70"), + Span(pred1, 3, 4, label="LOC", kb_id="Q3"), + ] + train_examples.append(Example(pred1, ref1)) + + ref2 = nlp("She loves London.") + ref2.ents = [ + Span(ref2, 0, 1, label="PERSON", kb_id="Q2"), + Span(ref2, 2, 3, label="LOC", kb_id="Q13"), + ] + pred2 = nlp("She loves London.") + pred2.ents = [ + Span(pred2, 0, 1, label="PERSON", kb_id="Q2"), + Span(pred2, 2, 3, label="LOC", kb_id="NIL"), + ] + train_examples.append(Example(pred2, ref2)) + + ref3 = nlp("London is great.") + ref3.ents = [Span(ref3, 0, 1, label="LOC", kb_id="NIL")] + pred3 = nlp("London is great.") + pred3.ents = [Span(pred3, 0, 1, label="LOC", kb_id="NIL")] + train_examples.append(Example(pred3, ref3)) + + scores = Scorer().score_links(train_examples, negative_labels=["NIL"]) + assert scores["nel_f_per_type"]["PERSON"]["p"] == 1 / 2 + assert scores["nel_f_per_type"]["PERSON"]["r"] == 1 / 2 + assert scores["nel_f_per_type"]["LOC"]["p"] == 1 / 1 + assert scores["nel_f_per_type"]["LOC"]["r"] == 1 / 2 + + assert scores["nel_micro_p"] == 2 / 3 + assert scores["nel_micro_r"] == 2 / 4 + + +# fmt: off +@pytest.mark.parametrize( + "name,config", + [ + ("entity_linker", {"@architectures": "spacy.EntityLinker.v1", "tok2vec": DEFAULT_TOK2VEC_MODEL}), + ("entity_linker", {"@architectures": "spacy.EntityLinker.v2", "tok2vec": DEFAULT_TOK2VEC_MODEL}), + ], +) +# fmt: on +def test_legacy_architectures(name, config): + # Ensure that the legacy architectures still work + vector_length = 3 + nlp = English() + + train_examples = [] + for text, annotation in TRAIN_DATA: + doc = nlp.make_doc(text) + train_examples.append(Example.from_dict(doc, annotation)) + + def create_kb(vocab): + mykb = InMemoryLookupKB(vocab, entity_vector_length=vector_length) + mykb.add_entity(entity="Q2146908", freq=12, entity_vector=[6, -4, 3]) + mykb.add_entity(entity="Q7381115", freq=12, entity_vector=[9, 1, -7]) + mykb.add_alias( + alias="Russ Cochran", + entities=["Q2146908", "Q7381115"], + probabilities=[0.5, 0.5], + ) + return mykb + + entity_linker = nlp.add_pipe(name, config={"model": config}) + if config["@architectures"] == "spacy.EntityLinker.v1": + assert isinstance(entity_linker, EntityLinker_v1) + else: + assert isinstance(entity_linker, EntityLinker) + entity_linker.set_kb(create_kb) + optimizer = nlp.initialize(get_examples=lambda: train_examples) + + for i in range(2): + losses = {} + nlp.update(train_examples, sgd=optimizer, losses=losses) + + +@pytest.mark.parametrize( + "patterns", + [ + # perfect case + [{"label": "CHARACTER", "pattern": "Kirby"}], + # typo for false negative + [{"label": "PERSON", "pattern": "Korby"}], + # random stuff for false positive + [{"label": "IS", "pattern": "is"}, {"label": "COLOR", "pattern": "pink"}], + ], +) +def test_no_gold_ents(patterns): + # test that annotating components work + TRAIN_DATA = [ + ( + "Kirby is pink", + { + "links": {(0, 5): {"Q613241": 1.0}}, + "entities": [(0, 5, "CHARACTER")], + "sent_starts": [1, 0, 0], + }, + ) + ] + nlp = English() + vector_length = 3 + train_examples = [] + for text, annotation in TRAIN_DATA: + doc = nlp(text) + train_examples.append(Example.from_dict(doc, annotation)) + + # Create a ruler to mark entities + ruler = nlp.add_pipe("entity_ruler") + ruler.add_patterns(patterns) + + # Apply ruler to examples. In a real pipeline this would be an annotating component. + for eg in train_examples: + eg.predicted = ruler(eg.predicted) + + # Entity ruler is no longer needed (initialization below wipes out the + # patterns and causes warnings) + nlp.remove_pipe("entity_ruler") + + def create_kb(vocab): + # create artificial KB + mykb = InMemoryLookupKB(vocab, entity_vector_length=vector_length) + mykb.add_entity(entity="Q613241", freq=12, entity_vector=[6, -4, 3]) + mykb.add_alias("Kirby", ["Q613241"], [0.9]) + # Placeholder + mykb.add_entity(entity="pink", freq=12, entity_vector=[7, 2, -5]) + mykb.add_alias("pink", ["pink"], [0.9]) + return mykb + + # Create and train the Entity Linker + entity_linker = nlp.add_pipe( + "entity_linker", config={"use_gold_ents": False}, last=True + ) + entity_linker.set_kb(create_kb) + assert entity_linker.use_gold_ents is False + + optimizer = nlp.initialize(get_examples=lambda: train_examples) + for i in range(2): + losses = {} + nlp.update(train_examples, sgd=optimizer, losses=losses) + + # adding additional components that are required for the entity_linker + nlp.add_pipe("sentencizer", first=True) + + # this will run the pipeline on the examples and shouldn't crash + nlp.evaluate(train_examples) + + +@pytest.mark.issue(9575) +def test_tokenization_mismatch(): + nlp = English() + # include a matching entity so that update isn't skipped + doc1 = Doc( + nlp.vocab, + words=["Kirby", "123456"], + spaces=[True, False], + ents=["B-CHARACTER", "B-CARDINAL"], + ) + doc2 = Doc( + nlp.vocab, + words=["Kirby", "123", "456"], + spaces=[True, False, False], + ents=["B-CHARACTER", "B-CARDINAL", "B-CARDINAL"], + ) + + eg = Example(doc1, doc2) + train_examples = [eg] + vector_length = 3 + + def create_kb(vocab): + # create placeholder KB + mykb = InMemoryLookupKB(vocab, entity_vector_length=vector_length) + mykb.add_entity(entity="Q613241", freq=12, entity_vector=[6, -4, 3]) + mykb.add_alias("Kirby", ["Q613241"], [0.9]) + return mykb + + entity_linker = nlp.add_pipe("entity_linker", last=True) + entity_linker.set_kb(create_kb) + + optimizer = nlp.initialize(get_examples=lambda: train_examples) + for i in range(2): + losses = {} + nlp.update(train_examples, sgd=optimizer, losses=losses) + + nlp.add_pipe("sentencizer", first=True) + nlp.evaluate(train_examples) + + +def test_abstract_kb_instantiation(): + """Test whether instantiation of abstract KB base class fails.""" + with pytest.raises(TypeError): + KnowledgeBase(None, 3) + + +# fmt: off +@pytest.mark.parametrize( + "meet_threshold,config", + [ + (False, {"@architectures": "spacy.EntityLinker.v2", "tok2vec": DEFAULT_TOK2VEC_MODEL}), + (True, {"@architectures": "spacy.EntityLinker.v2", "tok2vec": DEFAULT_TOK2VEC_MODEL}), + ], +) +# fmt: on +def test_threshold(meet_threshold: bool, config: Dict[str, Any]): + """Tests abstention threshold. + meet_threshold (bool): Whether to configure NEL setup so that confidence threshold is met. + config (Dict[str, Any]): NEL architecture config. + """ + nlp = English() + nlp.add_pipe("sentencizer") + text = "Mahler's Symphony No. 8 was beautiful." + entities = [(0, 6, "PERSON")] + links = {(0, 6): {"Q7304": 1.0}} + sent_starts = [1, -1, 0, 0, 0, 0, 0, 0, 0] + entity_id = "Q7304" + doc = nlp(text) + train_examples = [ + Example.from_dict( + doc, {"entities": entities, "links": links, "sent_starts": sent_starts} + ) + ] + + def create_kb(vocab): + # create artificial KB + mykb = InMemoryLookupKB(vocab, entity_vector_length=3) + mykb.add_entity(entity=entity_id, freq=12, entity_vector=[6, -4, 3]) + mykb.add_alias( + alias="Mahler", + entities=[entity_id], + probabilities=[1 if meet_threshold else 0.01], + ) + return mykb + + # Create the Entity Linker component and add it to the pipeline + entity_linker = nlp.add_pipe( + "entity_linker", + last=True, + config={"threshold": 0.99, "model": config}, + ) + entity_linker.set_kb(create_kb) # type: ignore + nlp.initialize(get_examples=lambda: train_examples) + + # Add a custom rule-based component to mimick NER + ruler = nlp.add_pipe("entity_ruler", before="entity_linker") + ruler.add_patterns([{"label": "PERSON", "pattern": [{"LOWER": "mahler"}]}]) # type: ignore + doc = nlp(text) + + assert len(doc.ents) == 1 + assert doc.ents[0].kb_id_ == entity_id if meet_threshold else EntityLinker.NIL + + +def test_span_maker_forward_with_empty(): + """The forward pass of the span maker may have a doc with no entities.""" + nlp = English() + doc1 = nlp("a b c") + ent = doc1[0:1] + ent.label_ = "X" + doc1.ents = [ent] + # no entities + doc2 = nlp("x y z") + + # just to get a model + span_maker = build_span_maker() + span_maker([doc1, doc2], False) diff --git a/TTS/Kokoro/.venv/Lib/site-packages/spacy/tests/pipeline/test_entity_ruler.py b/TTS/Kokoro/.venv/Lib/site-packages/spacy/tests/pipeline/test_entity_ruler.py new file mode 100644 index 0000000000000000000000000000000000000000..8cabaeae6053772cdddc424921d3eefe86db7008 --- /dev/null +++ b/TTS/Kokoro/.venv/Lib/site-packages/spacy/tests/pipeline/test_entity_ruler.py @@ -0,0 +1,682 @@ +import pytest +from thinc.api import NumpyOps, get_current_ops + +from spacy import registry +from spacy.errors import MatchPatternError +from spacy.lang.en import English +from spacy.language import Language +from spacy.pipeline import EntityRecognizer, EntityRuler, SpanRuler, merge_entities +from spacy.pipeline.ner import DEFAULT_NER_MODEL +from spacy.tests.util import make_tempdir +from spacy.tokens import Doc, Span + +ENTITY_RULERS = ["entity_ruler", "future_entity_ruler"] + + +@pytest.fixture +def nlp(): + return Language() + + +@pytest.fixture +@registry.misc("entity_ruler_patterns") +def patterns(): + return [ + {"label": "HELLO", "pattern": "hello world"}, + {"label": "BYE", "pattern": [{"LOWER": "bye"}, {"LOWER": "bye"}]}, + {"label": "HELLO", "pattern": [{"ORTH": "HELLO"}]}, + {"label": "COMPLEX", "pattern": [{"ORTH": "foo", "OP": "*"}]}, + {"label": "TECH_ORG", "pattern": "Apple", "id": "a1"}, + {"label": "TECH_ORG", "pattern": "Microsoft", "id": "a2"}, + ] + + +@Language.component("add_ent") +def add_ent_component(doc): + doc.ents = [Span(doc, 0, 3, label="ORG")] + return doc + + +@pytest.mark.issue(3345) +@pytest.mark.parametrize("entity_ruler_factory", ENTITY_RULERS) +def test_issue3345(entity_ruler_factory): + """Test case where preset entity crosses sentence boundary.""" + nlp = English() + doc = Doc(nlp.vocab, words=["I", "live", "in", "New", "York"]) + doc[4].is_sent_start = True + ruler = nlp.add_pipe(entity_ruler_factory, name="entity_ruler") + ruler.add_patterns([{"label": "GPE", "pattern": "New York"}]) + cfg = {"model": DEFAULT_NER_MODEL} + model = registry.resolve(cfg, validate=True)["model"] + ner = EntityRecognizer(doc.vocab, model) + # Add the OUT action. I wouldn't have thought this would be necessary... + ner.moves.add_action(5, "") + ner.add_label("GPE") + doc = ruler(doc) + # Get into the state just before "New" + state = ner.moves.init_batch([doc])[0] + ner.moves.apply_transition(state, "O") + ner.moves.apply_transition(state, "O") + ner.moves.apply_transition(state, "O") + # Check that B-GPE is valid. + assert ner.moves.is_valid(state, "B-GPE") + + +@pytest.mark.issue(4849) +@pytest.mark.parametrize("entity_ruler_factory", ENTITY_RULERS) +def test_issue4849(entity_ruler_factory): + nlp = English() + patterns = [ + {"label": "PERSON", "pattern": "joe biden", "id": "joe-biden"}, + {"label": "PERSON", "pattern": "bernie sanders", "id": "bernie-sanders"}, + ] + ruler = nlp.add_pipe( + entity_ruler_factory, + name="entity_ruler", + config={"phrase_matcher_attr": "LOWER"}, + ) + ruler.add_patterns(patterns) + text = """ + The left is starting to take aim at Democratic front-runner Joe Biden. + Sen. Bernie Sanders joined in her criticism: "There is no 'middle ground' when it comes to climate policy." + """ + # USING 1 PROCESS + count_ents = 0 + for doc in nlp.pipe([text], n_process=1): + count_ents += len([ent for ent in doc.ents if ent.ent_id > 0]) + assert count_ents == 2 + # USING 2 PROCESSES + if isinstance(get_current_ops, NumpyOps): + count_ents = 0 + for doc in nlp.pipe([text], n_process=2): + count_ents += len([ent for ent in doc.ents if ent.ent_id > 0]) + assert count_ents == 2 + + +@pytest.mark.issue(5918) +@pytest.mark.parametrize("entity_ruler_factory", ENTITY_RULERS) +def test_issue5918(entity_ruler_factory): + # Test edge case when merging entities. + nlp = English() + ruler = nlp.add_pipe(entity_ruler_factory, name="entity_ruler") + patterns = [ + {"label": "ORG", "pattern": "Digicon Inc"}, + {"label": "ORG", "pattern": "Rotan Mosle Inc's"}, + {"label": "ORG", "pattern": "Rotan Mosle Technology Partners Ltd"}, + ] + ruler.add_patterns(patterns) + + text = """ + Digicon Inc said it has completed the previously-announced disposition + of its computer systems division to an investment group led by + Rotan Mosle Inc's Rotan Mosle Technology Partners Ltd affiliate. + """ + doc = nlp(text) + assert len(doc.ents) == 3 + # make it so that the third span's head is within the entity (ent_iob=I) + # bug #5918 would wrongly transfer that I to the full entity, resulting in 2 instead of 3 final ents. + # TODO: test for logging here + # with pytest.warns(UserWarning): + # doc[29].head = doc[33] + doc = merge_entities(doc) + assert len(doc.ents) == 3 + + +@pytest.mark.issue(8168) +@pytest.mark.parametrize("entity_ruler_factory", ENTITY_RULERS) +def test_issue8168(entity_ruler_factory): + nlp = English() + ruler = nlp.add_pipe(entity_ruler_factory, name="entity_ruler") + patterns = [ + {"label": "ORG", "pattern": "Apple"}, + { + "label": "GPE", + "pattern": [{"LOWER": "san"}, {"LOWER": "francisco"}], + "id": "san-francisco", + }, + { + "label": "GPE", + "pattern": [{"LOWER": "san"}, {"LOWER": "fran"}], + "id": "san-francisco", + }, + ] + ruler.add_patterns(patterns) + doc = nlp("San Francisco San Fran") + assert all(t.ent_id_ == "san-francisco" for t in doc) + + +@pytest.mark.issue(8216) +@pytest.mark.parametrize("entity_ruler_factory", ENTITY_RULERS) +def test_entity_ruler_fix8216(nlp, patterns, entity_ruler_factory): + """Test that patterns don't get added excessively.""" + ruler = nlp.add_pipe( + entity_ruler_factory, name="entity_ruler", config={"validate": True} + ) + ruler.add_patterns(patterns) + pattern_count = sum(len(mm) for mm in ruler.matcher._patterns.values()) + assert pattern_count > 0 + ruler.add_patterns([]) + after_count = sum(len(mm) for mm in ruler.matcher._patterns.values()) + assert after_count == pattern_count + + +@pytest.mark.parametrize("entity_ruler_factory", ENTITY_RULERS) +def test_entity_ruler_init(nlp, patterns, entity_ruler_factory): + ruler = nlp.add_pipe(entity_ruler_factory, name="entity_ruler") + ruler.add_patterns(patterns) + assert len(ruler) == len(patterns) + assert len(ruler.labels) == 4 + assert "HELLO" in ruler + assert "BYE" in ruler + nlp.remove_pipe("entity_ruler") + ruler = nlp.add_pipe(entity_ruler_factory, name="entity_ruler") + ruler.add_patterns(patterns) + doc = nlp("hello world bye bye") + assert len(doc.ents) == 2 + assert doc.ents[0].label_ == "HELLO" + assert doc.ents[1].label_ == "BYE" + + +@pytest.mark.parametrize("entity_ruler_factory", ENTITY_RULERS) +def test_entity_ruler_no_patterns_warns(nlp, entity_ruler_factory): + ruler = nlp.add_pipe(entity_ruler_factory, name="entity_ruler") + assert len(ruler) == 0 + assert len(ruler.labels) == 0 + nlp.remove_pipe("entity_ruler") + nlp.add_pipe(entity_ruler_factory, name="entity_ruler") + assert nlp.pipe_names == ["entity_ruler"] + with pytest.warns(UserWarning): + doc = nlp("hello world bye bye") + assert len(doc.ents) == 0 + + +@pytest.mark.parametrize("entity_ruler_factory", ENTITY_RULERS) +def test_entity_ruler_init_patterns(nlp, patterns, entity_ruler_factory): + # initialize with patterns + ruler = nlp.add_pipe(entity_ruler_factory, name="entity_ruler") + assert len(ruler.labels) == 0 + ruler.initialize(lambda: [], patterns=patterns) + assert len(ruler.labels) == 4 + doc = nlp("hello world bye bye") + assert doc.ents[0].label_ == "HELLO" + assert doc.ents[1].label_ == "BYE" + nlp.remove_pipe("entity_ruler") + # initialize with patterns from misc registry + nlp.config["initialize"]["components"]["entity_ruler"] = { + "patterns": {"@misc": "entity_ruler_patterns"} + } + ruler = nlp.add_pipe(entity_ruler_factory, name="entity_ruler") + assert len(ruler.labels) == 0 + nlp.initialize() + assert len(ruler.labels) == 4 + doc = nlp("hello world bye bye") + assert doc.ents[0].label_ == "HELLO" + assert doc.ents[1].label_ == "BYE" + + +@pytest.mark.parametrize("entity_ruler_factory", ENTITY_RULERS) +def test_entity_ruler_init_clear(nlp, patterns, entity_ruler_factory): + """Test that initialization clears patterns.""" + ruler = nlp.add_pipe(entity_ruler_factory, name="entity_ruler") + ruler.add_patterns(patterns) + assert len(ruler.labels) == 4 + ruler.initialize(lambda: []) + assert len(ruler.labels) == 0 + + +@pytest.mark.parametrize("entity_ruler_factory", ENTITY_RULERS) +def test_entity_ruler_clear(nlp, patterns, entity_ruler_factory): + """Test that initialization clears patterns.""" + ruler = nlp.add_pipe(entity_ruler_factory, name="entity_ruler") + ruler.add_patterns(patterns) + assert len(ruler.labels) == 4 + doc = nlp("hello world") + assert len(doc.ents) == 1 + ruler.clear() + assert len(ruler.labels) == 0 + with pytest.warns(UserWarning): + doc = nlp("hello world") + assert len(doc.ents) == 0 + + +@pytest.mark.parametrize("entity_ruler_factory", ENTITY_RULERS) +def test_entity_ruler_existing(nlp, patterns, entity_ruler_factory): + ruler = nlp.add_pipe(entity_ruler_factory, name="entity_ruler") + ruler.add_patterns(patterns) + nlp.add_pipe("add_ent", before="entity_ruler") + doc = nlp("OH HELLO WORLD bye bye") + assert len(doc.ents) == 2 + assert doc.ents[0].label_ == "ORG" + assert doc.ents[1].label_ == "BYE" + + +@pytest.mark.parametrize("entity_ruler_factory", ENTITY_RULERS) +def test_entity_ruler_existing_overwrite(nlp, patterns, entity_ruler_factory): + ruler = nlp.add_pipe( + entity_ruler_factory, name="entity_ruler", config={"overwrite_ents": True} + ) + ruler.add_patterns(patterns) + nlp.add_pipe("add_ent", before="entity_ruler") + doc = nlp("OH HELLO WORLD bye bye") + assert len(doc.ents) == 2 + assert doc.ents[0].label_ == "HELLO" + assert doc.ents[0].text == "HELLO" + assert doc.ents[1].label_ == "BYE" + + +@pytest.mark.parametrize("entity_ruler_factory", ENTITY_RULERS) +def test_entity_ruler_existing_complex(nlp, patterns, entity_ruler_factory): + ruler = nlp.add_pipe( + entity_ruler_factory, name="entity_ruler", config={"overwrite_ents": True} + ) + ruler.add_patterns(patterns) + nlp.add_pipe("add_ent", before="entity_ruler") + doc = nlp("foo foo bye bye") + assert len(doc.ents) == 2 + assert doc.ents[0].label_ == "COMPLEX" + assert doc.ents[1].label_ == "BYE" + assert len(doc.ents[0]) == 2 + assert len(doc.ents[1]) == 2 + + +@pytest.mark.parametrize("entity_ruler_factory", ENTITY_RULERS) +def test_entity_ruler_entity_id(nlp, patterns, entity_ruler_factory): + ruler = nlp.add_pipe( + entity_ruler_factory, name="entity_ruler", config={"overwrite_ents": True} + ) + ruler.add_patterns(patterns) + doc = nlp("Apple is a technology company") + assert len(doc.ents) == 1 + assert doc.ents[0].label_ == "TECH_ORG" + assert doc.ents[0].ent_id_ == "a1" + + +@pytest.mark.parametrize("entity_ruler_factory", ENTITY_RULERS) +def test_entity_ruler_cfg_ent_id_sep(nlp, patterns, entity_ruler_factory): + config = {"overwrite_ents": True, "ent_id_sep": "**"} + ruler = nlp.add_pipe(entity_ruler_factory, name="entity_ruler", config=config) + ruler.add_patterns(patterns) + doc = nlp("Apple is a technology company") + if isinstance(ruler, EntityRuler): + assert "TECH_ORG**a1" in ruler.phrase_patterns + assert len(doc.ents) == 1 + assert doc.ents[0].label_ == "TECH_ORG" + assert doc.ents[0].ent_id_ == "a1" + + +@pytest.mark.parametrize("entity_ruler_factory", ENTITY_RULERS) +def test_entity_ruler_serialize_bytes(nlp, patterns, entity_ruler_factory): + ruler = EntityRuler(nlp, patterns=patterns) + assert len(ruler) == len(patterns) + assert len(ruler.labels) == 4 + ruler_bytes = ruler.to_bytes() + new_ruler = EntityRuler(nlp) + assert len(new_ruler) == 0 + assert len(new_ruler.labels) == 0 + new_ruler = new_ruler.from_bytes(ruler_bytes) + assert len(new_ruler) == len(patterns) + assert len(new_ruler.labels) == 4 + assert len(new_ruler.patterns) == len(ruler.patterns) + for pattern in ruler.patterns: + assert pattern in new_ruler.patterns + assert sorted(new_ruler.labels) == sorted(ruler.labels) + + +@pytest.mark.parametrize("entity_ruler_factory", ENTITY_RULERS) +def test_entity_ruler_serialize_phrase_matcher_attr_bytes( + nlp, patterns, entity_ruler_factory +): + ruler = EntityRuler(nlp, phrase_matcher_attr="LOWER", patterns=patterns) + assert len(ruler) == len(patterns) + assert len(ruler.labels) == 4 + ruler_bytes = ruler.to_bytes() + new_ruler = EntityRuler(nlp) + assert len(new_ruler) == 0 + assert len(new_ruler.labels) == 0 + assert new_ruler.phrase_matcher_attr is None + new_ruler = new_ruler.from_bytes(ruler_bytes) + assert len(new_ruler) == len(patterns) + assert len(new_ruler.labels) == 4 + assert new_ruler.phrase_matcher_attr == "LOWER" + + +@pytest.mark.parametrize("entity_ruler_factory", ENTITY_RULERS) +def test_entity_ruler_validate(nlp, entity_ruler_factory): + ruler = nlp.add_pipe(entity_ruler_factory, name="entity_ruler") + validated_ruler = EntityRuler(nlp, validate=True) + + valid_pattern = {"label": "HELLO", "pattern": [{"LOWER": "HELLO"}]} + invalid_pattern = {"label": "HELLO", "pattern": [{"ASDF": "HELLO"}]} + + # invalid pattern raises error without validate + with pytest.raises(ValueError): + ruler.add_patterns([invalid_pattern]) + + # valid pattern is added without errors with validate + validated_ruler.add_patterns([valid_pattern]) + + # invalid pattern raises error with validate + with pytest.raises(MatchPatternError): + validated_ruler.add_patterns([invalid_pattern]) + + +@pytest.mark.parametrize("entity_ruler_factory", ENTITY_RULERS) +def test_entity_ruler_properties(nlp, patterns, entity_ruler_factory): + ruler = EntityRuler(nlp, patterns=patterns, overwrite_ents=True) + assert sorted(ruler.labels) == sorted(["HELLO", "BYE", "COMPLEX", "TECH_ORG"]) + assert sorted(ruler.ent_ids) == ["a1", "a2"] + + +@pytest.mark.parametrize("entity_ruler_factory", ENTITY_RULERS) +def test_entity_ruler_overlapping_spans(nlp, entity_ruler_factory): + ruler = nlp.add_pipe(entity_ruler_factory, name="entity_ruler") + patterns = [ + {"label": "FOOBAR", "pattern": "foo bar"}, + {"label": "BARBAZ", "pattern": "bar baz"}, + ] + ruler.add_patterns(patterns) + doc = nlp("foo bar baz") + assert len(doc.ents) == 1 + assert doc.ents[0].label_ == "FOOBAR" + + +@pytest.mark.parametrize("entity_ruler_factory", ENTITY_RULERS) +def test_entity_ruler_fuzzy_pipe(nlp, entity_ruler_factory): + ruler = nlp.add_pipe(entity_ruler_factory, name="entity_ruler") + patterns = [{"label": "HELLO", "pattern": [{"LOWER": {"FUZZY": "hello"}}]}] + ruler.add_patterns(patterns) + doc = nlp("helloo") + assert len(doc.ents) == 1 + assert doc.ents[0].label_ == "HELLO" + + +@pytest.mark.parametrize("entity_ruler_factory", ENTITY_RULERS) +def test_entity_ruler_fuzzy(nlp, entity_ruler_factory): + ruler = nlp.add_pipe(entity_ruler_factory, name="entity_ruler") + patterns = [{"label": "HELLO", "pattern": [{"LOWER": {"FUZZY": "hello"}}]}] + ruler.add_patterns(patterns) + doc = nlp("helloo") + assert len(doc.ents) == 1 + assert doc.ents[0].label_ == "HELLO" + + +@pytest.mark.parametrize("entity_ruler_factory", ENTITY_RULERS) +def test_entity_ruler_fuzzy_disabled(nlp, entity_ruler_factory): + @registry.misc("test_fuzzy_compare_disabled") + def make_test_fuzzy_compare_disabled(): + return lambda x, y, z: False + + ruler = nlp.add_pipe( + entity_ruler_factory, + name="entity_ruler", + config={"matcher_fuzzy_compare": {"@misc": "test_fuzzy_compare_disabled"}}, + ) + patterns = [{"label": "HELLO", "pattern": [{"LOWER": {"FUZZY": "hello"}}]}] + ruler.add_patterns(patterns) + doc = nlp("helloo") + assert len(doc.ents) == 0 + + +@pytest.mark.parametrize("n_process", [1, 2]) +@pytest.mark.parametrize("entity_ruler_factory", ENTITY_RULERS) +def test_entity_ruler_multiprocessing(nlp, n_process, entity_ruler_factory): + if isinstance(get_current_ops, NumpyOps) or n_process < 2: + texts = ["I enjoy eating Pizza Hut pizza."] + + patterns = [{"label": "FASTFOOD", "pattern": "Pizza Hut", "id": "1234"}] + + ruler = nlp.add_pipe(entity_ruler_factory, name="entity_ruler") + ruler.add_patterns(patterns) + + for doc in nlp.pipe(texts, n_process=2): + for ent in doc.ents: + assert ent.ent_id_ == "1234" + + +@pytest.mark.parametrize("entity_ruler_factory", ENTITY_RULERS) +def test_entity_ruler_serialize_jsonl(nlp, patterns, entity_ruler_factory): + ruler = nlp.add_pipe(entity_ruler_factory, name="entity_ruler") + ruler.add_patterns(patterns) + with make_tempdir() as d: + ruler.to_disk(d / "test_ruler.jsonl") + ruler.from_disk(d / "test_ruler.jsonl") # read from an existing jsonl file + with pytest.raises(ValueError): + ruler.from_disk(d / "non_existing.jsonl") # read from a bad jsonl file + + +@pytest.mark.parametrize("entity_ruler_factory", ENTITY_RULERS) +def test_entity_ruler_serialize_dir(nlp, patterns, entity_ruler_factory): + ruler = nlp.add_pipe(entity_ruler_factory, name="entity_ruler") + ruler.add_patterns(patterns) + with make_tempdir() as d: + ruler.to_disk(d / "test_ruler") + ruler.from_disk(d / "test_ruler") # read from an existing directory + with pytest.raises(ValueError): + ruler.from_disk(d / "non_existing_dir") # read from a bad directory + + +@pytest.mark.parametrize("entity_ruler_factory", ENTITY_RULERS) +def test_entity_ruler_remove_basic(nlp, entity_ruler_factory): + ruler = nlp.add_pipe(entity_ruler_factory, name="entity_ruler") + patterns = [ + {"label": "PERSON", "pattern": "Dina", "id": "dina"}, + {"label": "ORG", "pattern": "ACME", "id": "acme"}, + {"label": "ORG", "pattern": "ACM"}, + ] + ruler.add_patterns(patterns) + doc = nlp("Dina went to school") + assert len(ruler.patterns) == 3 + assert len(doc.ents) == 1 + if isinstance(ruler, EntityRuler): + assert "PERSON||dina" in ruler.phrase_matcher + assert doc.ents[0].label_ == "PERSON" + assert doc.ents[0].text == "Dina" + if isinstance(ruler, EntityRuler): + ruler.remove("dina") + else: + ruler.remove_by_id("dina") + doc = nlp("Dina went to school") + assert len(doc.ents) == 0 + if isinstance(ruler, EntityRuler): + assert "PERSON||dina" not in ruler.phrase_matcher + assert len(ruler.patterns) == 2 + + +@pytest.mark.parametrize("entity_ruler_factory", ENTITY_RULERS) +def test_entity_ruler_remove_same_id_multiple_patterns(nlp, entity_ruler_factory): + ruler = nlp.add_pipe(entity_ruler_factory, name="entity_ruler") + patterns = [ + {"label": "PERSON", "pattern": "Dina", "id": "dina"}, + {"label": "ORG", "pattern": "DinaCorp", "id": "dina"}, + {"label": "ORG", "pattern": "ACME", "id": "acme"}, + ] + ruler.add_patterns(patterns) + doc = nlp("Dina founded DinaCorp and ACME.") + assert len(ruler.patterns) == 3 + if isinstance(ruler, EntityRuler): + assert "PERSON||dina" in ruler.phrase_matcher + assert "ORG||dina" in ruler.phrase_matcher + assert len(doc.ents) == 3 + if isinstance(ruler, EntityRuler): + ruler.remove("dina") + else: + ruler.remove_by_id("dina") + doc = nlp("Dina founded DinaCorp and ACME.") + assert len(ruler.patterns) == 1 + if isinstance(ruler, EntityRuler): + assert "PERSON||dina" not in ruler.phrase_matcher + assert "ORG||dina" not in ruler.phrase_matcher + assert len(doc.ents) == 1 + + +@pytest.mark.parametrize("entity_ruler_factory", ENTITY_RULERS) +def test_entity_ruler_remove_nonexisting_pattern(nlp, entity_ruler_factory): + ruler = nlp.add_pipe(entity_ruler_factory, name="entity_ruler") + patterns = [ + {"label": "PERSON", "pattern": "Dina", "id": "dina"}, + {"label": "ORG", "pattern": "ACME", "id": "acme"}, + {"label": "ORG", "pattern": "ACM"}, + ] + ruler.add_patterns(patterns) + assert len(ruler.patterns) == 3 + with pytest.raises(ValueError): + ruler.remove("nepattern") + if isinstance(ruler, SpanRuler): + with pytest.raises(ValueError): + ruler.remove_by_id("nepattern") + + +@pytest.mark.parametrize("entity_ruler_factory", ENTITY_RULERS) +def test_entity_ruler_remove_several_patterns(nlp, entity_ruler_factory): + ruler = nlp.add_pipe(entity_ruler_factory, name="entity_ruler") + patterns = [ + {"label": "PERSON", "pattern": "Dina", "id": "dina"}, + {"label": "ORG", "pattern": "ACME", "id": "acme"}, + {"label": "ORG", "pattern": "ACM"}, + ] + ruler.add_patterns(patterns) + doc = nlp("Dina founded her company ACME.") + assert len(ruler.patterns) == 3 + assert len(doc.ents) == 2 + assert doc.ents[0].label_ == "PERSON" + assert doc.ents[0].text == "Dina" + assert doc.ents[1].label_ == "ORG" + assert doc.ents[1].text == "ACME" + if isinstance(ruler, EntityRuler): + ruler.remove("dina") + else: + ruler.remove_by_id("dina") + doc = nlp("Dina founded her company ACME") + assert len(ruler.patterns) == 2 + assert len(doc.ents) == 1 + assert doc.ents[0].label_ == "ORG" + assert doc.ents[0].text == "ACME" + if isinstance(ruler, EntityRuler): + ruler.remove("acme") + else: + ruler.remove_by_id("acme") + doc = nlp("Dina founded her company ACME") + assert len(ruler.patterns) == 1 + assert len(doc.ents) == 0 + + +@pytest.mark.parametrize("entity_ruler_factory", ENTITY_RULERS) +def test_entity_ruler_remove_patterns_in_a_row(nlp, entity_ruler_factory): + ruler = nlp.add_pipe(entity_ruler_factory, name="entity_ruler") + patterns = [ + {"label": "PERSON", "pattern": "Dina", "id": "dina"}, + {"label": "ORG", "pattern": "ACME", "id": "acme"}, + {"label": "DATE", "pattern": "her birthday", "id": "bday"}, + {"label": "ORG", "pattern": "ACM"}, + ] + ruler.add_patterns(patterns) + doc = nlp("Dina founded her company ACME on her birthday") + assert len(doc.ents) == 3 + assert doc.ents[0].label_ == "PERSON" + assert doc.ents[0].text == "Dina" + assert doc.ents[1].label_ == "ORG" + assert doc.ents[1].text == "ACME" + assert doc.ents[2].label_ == "DATE" + assert doc.ents[2].text == "her birthday" + if isinstance(ruler, EntityRuler): + ruler.remove("dina") + ruler.remove("acme") + ruler.remove("bday") + else: + ruler.remove_by_id("dina") + ruler.remove_by_id("acme") + ruler.remove_by_id("bday") + doc = nlp("Dina went to school") + assert len(doc.ents) == 0 + + +@pytest.mark.parametrize("entity_ruler_factory", ENTITY_RULERS) +def test_entity_ruler_remove_all_patterns(nlp, entity_ruler_factory): + ruler = nlp.add_pipe(entity_ruler_factory, name="entity_ruler") + patterns = [ + {"label": "PERSON", "pattern": "Dina", "id": "dina"}, + {"label": "ORG", "pattern": "ACME", "id": "acme"}, + {"label": "DATE", "pattern": "her birthday", "id": "bday"}, + ] + ruler.add_patterns(patterns) + assert len(ruler.patterns) == 3 + if isinstance(ruler, EntityRuler): + ruler.remove("dina") + else: + ruler.remove_by_id("dina") + assert len(ruler.patterns) == 2 + if isinstance(ruler, EntityRuler): + ruler.remove("acme") + else: + ruler.remove_by_id("acme") + assert len(ruler.patterns) == 1 + if isinstance(ruler, EntityRuler): + ruler.remove("bday") + else: + ruler.remove_by_id("bday") + assert len(ruler.patterns) == 0 + with pytest.warns(UserWarning): + doc = nlp("Dina founded her company ACME on her birthday") + assert len(doc.ents) == 0 + + +@pytest.mark.parametrize("entity_ruler_factory", ENTITY_RULERS) +def test_entity_ruler_remove_and_add(nlp, entity_ruler_factory): + ruler = nlp.add_pipe(entity_ruler_factory, name="entity_ruler") + patterns = [{"label": "DATE", "pattern": "last time"}] + ruler.add_patterns(patterns) + doc = ruler( + nlp.make_doc("I saw him last time we met, this time he brought some flowers") + ) + assert len(ruler.patterns) == 1 + assert len(doc.ents) == 1 + assert doc.ents[0].label_ == "DATE" + assert doc.ents[0].text == "last time" + patterns1 = [{"label": "DATE", "pattern": "this time", "id": "ttime"}] + ruler.add_patterns(patterns1) + doc = ruler( + nlp.make_doc("I saw him last time we met, this time he brought some flowers") + ) + assert len(ruler.patterns) == 2 + assert len(doc.ents) == 2 + assert doc.ents[0].label_ == "DATE" + assert doc.ents[0].text == "last time" + assert doc.ents[1].label_ == "DATE" + assert doc.ents[1].text == "this time" + if isinstance(ruler, EntityRuler): + ruler.remove("ttime") + else: + ruler.remove_by_id("ttime") + doc = ruler( + nlp.make_doc("I saw him last time we met, this time he brought some flowers") + ) + assert len(ruler.patterns) == 1 + assert len(doc.ents) == 1 + assert doc.ents[0].label_ == "DATE" + assert doc.ents[0].text == "last time" + ruler.add_patterns(patterns1) + doc = ruler( + nlp.make_doc("I saw him last time we met, this time he brought some flowers") + ) + assert len(ruler.patterns) == 2 + assert len(doc.ents) == 2 + patterns2 = [{"label": "DATE", "pattern": "another time", "id": "ttime"}] + ruler.add_patterns(patterns2) + doc = ruler( + nlp.make_doc( + "I saw him last time we met, this time he brought some flowers, another time some chocolate." + ) + ) + assert len(ruler.patterns) == 3 + assert len(doc.ents) == 3 + if isinstance(ruler, EntityRuler): + ruler.remove("ttime") + else: + ruler.remove_by_id("ttime") + doc = ruler( + nlp.make_doc( + "I saw him last time we met, this time he brought some flowers, another time some chocolate." + ) + ) + assert len(ruler.patterns) == 1 + assert len(doc.ents) == 1 diff --git a/TTS/Kokoro/.venv/Lib/site-packages/spacy/tests/pipeline/test_functions.py b/TTS/Kokoro/.venv/Lib/site-packages/spacy/tests/pipeline/test_functions.py new file mode 100644 index 0000000000000000000000000000000000000000..4d5fe7c5394bc9f9204ec376e6c30e39c91606ac --- /dev/null +++ b/TTS/Kokoro/.venv/Lib/site-packages/spacy/tests/pipeline/test_functions.py @@ -0,0 +1,102 @@ +import pytest + +from spacy.language import Language +from spacy.pipeline.functions import merge_subtokens +from spacy.tokens import Doc, Span + +from ..doc.test_underscore import clean_underscore # noqa: F401 + + +@pytest.fixture +def doc(en_vocab): + # fmt: off + words = ["This", "is", "a", "sentence", ".", "This", "is", "another", "sentence", ".", "And", "a", "third", "."] + heads = [1, 1, 3, 1, 1, 6, 6, 8, 6, 6, 11, 12, 13, 13] + deps = ["nsubj", "ROOT", "subtok", "attr", "punct", "nsubj", "ROOT", + "subtok", "attr", "punct", "subtok", "subtok", "subtok", "ROOT"] + # fmt: on + return Doc(en_vocab, words=words, heads=heads, deps=deps) + + +@pytest.fixture +def doc2(en_vocab): + words = ["I", "like", "New", "York", "in", "Autumn", "."] + heads = [1, 1, 3, 1, 1, 4, 1] + tags = ["PRP", "IN", "NNP", "NNP", "IN", "NNP", "."] + pos = ["PRON", "VERB", "PROPN", "PROPN", "ADP", "PROPN", "PUNCT"] + deps = ["ROOT", "prep", "compound", "pobj", "prep", "pobj", "punct"] + doc = Doc(en_vocab, words=words, heads=heads, tags=tags, pos=pos, deps=deps) + doc.ents = [Span(doc, 2, 4, label="GPE")] + return doc + + +def test_merge_subtokens(doc): + doc = merge_subtokens(doc) + # Doc doesn't have spaces, so the result is "And a third ." + # fmt: off + assert [t.text for t in doc] == ["This", "is", "a sentence", ".", "This", "is", "another sentence", ".", "And a third ."] + # fmt: on + + +def test_factories_merge_noun_chunks(doc2): + assert len(doc2) == 7 + nlp = Language() + merge_noun_chunks = nlp.create_pipe("merge_noun_chunks") + merge_noun_chunks(doc2) + assert len(doc2) == 6 + assert doc2[2].text == "New York" + + +def test_factories_merge_ents(doc2): + assert len(doc2) == 7 + assert len(list(doc2.ents)) == 1 + nlp = Language() + merge_entities = nlp.create_pipe("merge_entities") + merge_entities(doc2) + assert len(doc2) == 6 + assert len(list(doc2.ents)) == 1 + assert doc2[2].text == "New York" + + +def test_token_splitter(): + nlp = Language() + config = {"min_length": 20, "split_length": 5} + token_splitter = nlp.add_pipe("token_splitter", config=config) + doc = nlp("aaaaabbbbbcccccdddd e f g") + assert [t.text for t in doc] == ["aaaaabbbbbcccccdddd", "e", "f", "g"] + doc = nlp("aaaaabbbbbcccccdddddeeeeeff g h i") + assert [t.text for t in doc] == [ + "aaaaa", + "bbbbb", + "ccccc", + "ddddd", + "eeeee", + "ff", + "g", + "h", + "i", + ] + assert all(len(t.text) <= token_splitter.split_length for t in doc) + + +@pytest.mark.usefixtures("clean_underscore") +def test_factories_doc_cleaner(): + nlp = Language() + nlp.add_pipe("doc_cleaner") + doc = nlp.make_doc("text") + doc.tensor = [1, 2, 3] + doc = nlp(doc) + assert doc.tensor is None + + nlp = Language() + nlp.add_pipe("doc_cleaner", config={"silent": False}) + with pytest.warns(UserWarning): + doc = nlp("text") + + Doc.set_extension("test_attr", default=-1) + nlp = Language() + nlp.add_pipe("doc_cleaner", config={"attrs": {"_.test_attr": 0}}) + doc = nlp.make_doc("text") + doc._.test_attr = 100 + doc = nlp(doc) + assert doc._.test_attr == 0 diff --git a/TTS/Kokoro/.venv/Lib/site-packages/spacy/tests/pipeline/test_initialize.py b/TTS/Kokoro/.venv/Lib/site-packages/spacy/tests/pipeline/test_initialize.py new file mode 100644 index 0000000000000000000000000000000000000000..165c2cc0637468ca931537a7b4fa917a1277b704 --- /dev/null +++ b/TTS/Kokoro/.venv/Lib/site-packages/spacy/tests/pipeline/test_initialize.py @@ -0,0 +1,75 @@ +import pytest + +try: + from pydantic.v1 import StrictBool +except ImportError: + from pydantic import StrictBool # type: ignore + +from thinc.api import ConfigValidationError + +from spacy.lang.en import English +from spacy.language import Language +from spacy.training import Example + + +def test_initialize_arguments(): + name = "test_initialize_arguments" + + class CustomTokenizer: + def __init__(self, tokenizer): + self.tokenizer = tokenizer + self.from_initialize = None + + def __call__(self, text): + return self.tokenizer(text) + + def initialize(self, get_examples, nlp, custom: int): + self.from_initialize = custom + + class Component: + def __init__(self): + self.from_initialize = None + + def initialize( + self, get_examples, nlp, custom1: str, custom2: StrictBool = False + ): + self.from_initialize = (custom1, custom2) + + Language.factory(name, func=lambda nlp, name: Component()) + + nlp = English() + nlp.tokenizer = CustomTokenizer(nlp.tokenizer) + example = Example.from_dict(nlp("x"), {}) + get_examples = lambda: [example] + nlp.add_pipe(name) + # The settings here will typically come from the [initialize] block + init_cfg = {"tokenizer": {"custom": 1}, "components": {name: {}}} + nlp.config["initialize"].update(init_cfg) + with pytest.raises(ConfigValidationError) as e: + # Empty config for component, no required custom1 argument + nlp.initialize(get_examples) + errors = e.value.errors + assert len(errors) == 1 + assert errors[0]["loc"] == ("custom1",) + assert errors[0]["type"] == "value_error.missing" + init_cfg = { + "tokenizer": {"custom": 1}, + "components": {name: {"custom1": "x", "custom2": 1}}, + } + nlp.config["initialize"].update(init_cfg) + with pytest.raises(ConfigValidationError) as e: + # Wrong type of custom 2 + nlp.initialize(get_examples) + errors = e.value.errors + assert len(errors) == 1 + assert errors[0]["loc"] == ("custom2",) + assert errors[0]["type"] == "value_error.strictbool" + init_cfg = { + "tokenizer": {"custom": 1}, + "components": {name: {"custom1": "x"}}, + } + nlp.config["initialize"].update(init_cfg) + nlp.initialize(get_examples) + assert nlp.tokenizer.from_initialize == 1 + pipe = nlp.get_pipe(name) + assert pipe.from_initialize == ("x", False) diff --git a/TTS/Kokoro/.venv/Lib/site-packages/spacy/tests/pipeline/test_lemmatizer.py b/TTS/Kokoro/.venv/Lib/site-packages/spacy/tests/pipeline/test_lemmatizer.py new file mode 100644 index 0000000000000000000000000000000000000000..68ec9702da6e49341dc5ca14f552141258698c6f --- /dev/null +++ b/TTS/Kokoro/.venv/Lib/site-packages/spacy/tests/pipeline/test_lemmatizer.py @@ -0,0 +1,115 @@ +import pickle + +import pytest + +from spacy import registry, util +from spacy.lang.en import English +from spacy.lookups import Lookups + +from ..util import make_tempdir + + +@pytest.fixture +def nlp(): + @registry.misc("cope_lookups") + def cope_lookups(): + lookups = Lookups() + lookups.add_table("lemma_lookup", {"cope": "cope", "coped": "cope"}) + lookups.add_table("lemma_index", {"verb": ("cope", "cop")}) + lookups.add_table("lemma_exc", {"verb": {"coping": ("cope",)}}) + lookups.add_table("lemma_rules", {"verb": [["ing", ""]]}) + return lookups + + nlp = English() + nlp.config["initialize"]["components"]["lemmatizer"] = { + "lookups": {"@misc": "cope_lookups"} + } + return nlp + + +def test_lemmatizer_init(nlp): + lemmatizer = nlp.add_pipe("lemmatizer", config={"mode": "lookup"}) + assert isinstance(lemmatizer.lookups, Lookups) + assert not lemmatizer.lookups.tables + assert lemmatizer.mode == "lookup" + with pytest.raises(ValueError): + nlp("test") + nlp.initialize() + assert lemmatizer.lookups.tables + assert nlp("cope")[0].lemma_ == "cope" + assert nlp("coped")[0].lemma_ == "cope" + # replace any tables from spacy-lookups-data + lemmatizer.lookups = Lookups() + # lookup with no tables sets text as lemma + assert nlp("cope")[0].lemma_ == "cope" + assert nlp("coped")[0].lemma_ == "coped" + nlp.remove_pipe("lemmatizer") + lemmatizer = nlp.add_pipe("lemmatizer", config={"mode": "lookup"}) + with pytest.raises(ValueError): + # Can't initialize without required tables + lemmatizer.initialize(lookups=Lookups()) + lookups = Lookups() + lookups.add_table("lemma_lookup", {}) + lemmatizer.initialize(lookups=lookups) + + +def test_lemmatizer_config(nlp): + lemmatizer = nlp.add_pipe("lemmatizer", config={"mode": "rule"}) + nlp.initialize() + + # warning if no POS assigned + doc = nlp.make_doc("coping") + with pytest.warns(UserWarning): + doc = lemmatizer(doc) + # warns once by default + doc = lemmatizer(doc) + + # works with POS + doc = nlp.make_doc("coping") + assert doc[0].lemma_ == "" + doc[0].pos_ = "VERB" + doc = lemmatizer(doc) + doc = lemmatizer(doc) + assert doc[0].text == "coping" + assert doc[0].lemma_ == "cope" + + doc = nlp.make_doc("coping") + doc[0].pos_ = "VERB" + assert doc[0].lemma_ == "" + doc = lemmatizer(doc) + assert doc[0].text == "coping" + assert doc[0].lemma_ == "cope" + + +def test_lemmatizer_serialize(nlp): + lemmatizer = nlp.add_pipe("lemmatizer", config={"mode": "rule"}) + nlp.initialize() + + def cope_lookups(): + lookups = Lookups() + lookups.add_table("lemma_lookup", {"cope": "cope", "coped": "cope"}) + lookups.add_table("lemma_index", {"verb": ("cope", "cop")}) + lookups.add_table("lemma_exc", {"verb": {"coping": ("cope",)}}) + lookups.add_table("lemma_rules", {"verb": [["ing", ""]]}) + return lookups + + nlp2 = English() + lemmatizer2 = nlp2.add_pipe("lemmatizer", config={"mode": "rule"}) + lemmatizer2.initialize(lookups=cope_lookups()) + lemmatizer2.from_bytes(lemmatizer.to_bytes()) + assert lemmatizer.to_bytes() == lemmatizer2.to_bytes() + assert lemmatizer.lookups.tables == lemmatizer2.lookups.tables + + # Also test the results are still the same after IO + with make_tempdir() as tmp_dir: + nlp.to_disk(tmp_dir) + nlp2 = util.load_model_from_path(tmp_dir) + doc2 = nlp2.make_doc("coping") + doc2[0].pos_ = "VERB" + assert doc2[0].lemma_ == "" + doc2 = lemmatizer2(doc2) + assert doc2[0].text == "coping" + assert doc2[0].lemma_ == "cope" + + # Make sure that lemmatizer cache can be pickled + pickle.dumps(lemmatizer2) diff --git a/TTS/Kokoro/.venv/Lib/site-packages/spacy/tests/pipeline/test_models.py b/TTS/Kokoro/.venv/Lib/site-packages/spacy/tests/pipeline/test_models.py new file mode 100644 index 0000000000000000000000000000000000000000..9abdc6ef739f0ff3a9562bfbd8d9221fcf3ee077 --- /dev/null +++ b/TTS/Kokoro/.venv/Lib/site-packages/spacy/tests/pipeline/test_models.py @@ -0,0 +1,108 @@ +from typing import List + +import numpy +import pytest +from numpy.testing import assert_almost_equal +from thinc.api import Model, data_validation, get_current_ops +from thinc.types import Array2d, Ragged + +from spacy.lang.en import English +from spacy.ml import FeatureExtractor, StaticVectors +from spacy.ml._character_embed import CharacterEmbed +from spacy.tokens import Doc +from spacy.vocab import Vocab + +OPS = get_current_ops() + +texts = ["These are 4 words", "Here just three"] +l0 = [[1, 2], [3, 4], [5, 6], [7, 8]] +l1 = [[9, 8], [7, 6], [5, 4]] +list_floats = [OPS.xp.asarray(l0, dtype="f"), OPS.xp.asarray(l1, dtype="f")] +list_ints = [OPS.xp.asarray(l0, dtype="i"), OPS.xp.asarray(l1, dtype="i")] +array = OPS.xp.asarray(l1, dtype="f") +ragged = Ragged(array, OPS.xp.asarray([2, 1], dtype="i")) + + +def get_docs(): + vocab = Vocab() + for t in texts: + for word in t.split(): + hash_id = vocab.strings.add(word) + vector = numpy.random.uniform(-1, 1, (7,)) + vocab.set_vector(hash_id, vector) + docs = [English(vocab)(t) for t in texts] + return docs + + +# Test components with a model of type Model[List[Doc], List[Floats2d]] +@pytest.mark.parametrize("name", ["tagger", "tok2vec", "morphologizer", "senter"]) +def test_components_batching_list(name): + nlp = English() + proc = nlp.create_pipe(name) + util_batch_unbatch_docs_list(proc.model, get_docs(), list_floats) + + +# Test components with a model of type Model[List[Doc], Floats2d] +@pytest.mark.parametrize("name", ["textcat"]) +def test_components_batching_array(name): + nlp = English() + proc = nlp.create_pipe(name) + util_batch_unbatch_docs_array(proc.model, get_docs(), array) + + +LAYERS = [ + (CharacterEmbed(nM=5, nC=3), get_docs(), list_floats), + (FeatureExtractor([100, 200]), get_docs(), list_ints), + (StaticVectors(), get_docs(), ragged), +] + + +@pytest.mark.parametrize("model,in_data,out_data", LAYERS) +def test_layers_batching_all(model, in_data, out_data): + # In = List[Doc] + if isinstance(in_data, list) and isinstance(in_data[0], Doc): + if isinstance(out_data, OPS.xp.ndarray) and out_data.ndim == 2: + util_batch_unbatch_docs_array(model, in_data, out_data) + elif ( + isinstance(out_data, list) + and isinstance(out_data[0], OPS.xp.ndarray) + and out_data[0].ndim == 2 + ): + util_batch_unbatch_docs_list(model, in_data, out_data) + elif isinstance(out_data, Ragged): + util_batch_unbatch_docs_ragged(model, in_data, out_data) + + +def util_batch_unbatch_docs_list( + model: Model[List[Doc], List[Array2d]], in_data: List[Doc], out_data: List[Array2d] +): + with data_validation(True): + model.initialize(in_data, out_data) + Y_batched = model.predict(in_data) + Y_not_batched = [model.predict([u])[0] for u in in_data] + for i in range(len(Y_batched)): + assert_almost_equal( + OPS.to_numpy(Y_batched[i]), OPS.to_numpy(Y_not_batched[i]), decimal=4 + ) + + +def util_batch_unbatch_docs_array( + model: Model[List[Doc], Array2d], in_data: List[Doc], out_data: Array2d +): + with data_validation(True): + model.initialize(in_data, out_data) + Y_batched = model.predict(in_data).tolist() + Y_not_batched = [model.predict([u])[0].tolist() for u in in_data] + assert_almost_equal(Y_batched, Y_not_batched, decimal=4) + + +def util_batch_unbatch_docs_ragged( + model: Model[List[Doc], Ragged], in_data: List[Doc], out_data: Ragged +): + with data_validation(True): + model.initialize(in_data, out_data) + Y_batched = model.predict(in_data).data.tolist() + Y_not_batched = [] + for u in in_data: + Y_not_batched.extend(model.predict([u]).data.tolist()) + assert_almost_equal(Y_batched, Y_not_batched, decimal=4) diff --git a/TTS/Kokoro/.venv/Lib/site-packages/spacy/tests/pipeline/test_morphologizer.py b/TTS/Kokoro/.venv/Lib/site-packages/spacy/tests/pipeline/test_morphologizer.py new file mode 100644 index 0000000000000000000000000000000000000000..647a65da56fe035c24ce0dc79a25b3411cbd50e6 --- /dev/null +++ b/TTS/Kokoro/.venv/Lib/site-packages/spacy/tests/pipeline/test_morphologizer.py @@ -0,0 +1,226 @@ +import pytest +from numpy.testing import assert_almost_equal, assert_equal +from thinc.api import get_current_ops + +from spacy import util +from spacy.attrs import MORPH +from spacy.lang.en import English +from spacy.language import Language +from spacy.morphology import Morphology +from spacy.tests.util import make_tempdir +from spacy.tokens import Doc +from spacy.training import Example + + +def test_label_types(): + nlp = Language() + morphologizer = nlp.add_pipe("morphologizer") + morphologizer.add_label("Feat=A") + with pytest.raises(ValueError): + morphologizer.add_label(9) + + +TAGS = ["Feat=N", "Feat=V", "Feat=J"] + +TRAIN_DATA = [ + ( + "I like green eggs", + { + "morphs": ["Feat=N", "Feat=V", "Feat=J", "Feat=N"], + "pos": ["NOUN", "VERB", "ADJ", "NOUN"], + }, + ), + # test combinations of morph+POS + ("Eat blue ham", {"morphs": ["Feat=V", "", ""], "pos": ["", "ADJ", ""]}), +] + + +def test_label_smoothing(): + nlp = Language() + morph_no_ls = nlp.add_pipe("morphologizer", "no_label_smoothing") + morph_ls = nlp.add_pipe( + "morphologizer", "label_smoothing", config=dict(label_smoothing=0.05) + ) + train_examples = [] + losses = {} + for tag in TAGS: + morph_no_ls.add_label(tag) + morph_ls.add_label(tag) + for t in TRAIN_DATA: + train_examples.append(Example.from_dict(nlp.make_doc(t[0]), t[1])) + + nlp.initialize(get_examples=lambda: train_examples) + tag_scores, bp_tag_scores = morph_ls.model.begin_update( + [eg.predicted for eg in train_examples] + ) + ops = get_current_ops() + no_ls_grads = ops.to_numpy(morph_no_ls.get_loss(train_examples, tag_scores)[1][0]) + ls_grads = ops.to_numpy(morph_ls.get_loss(train_examples, tag_scores)[1][0]) + assert_almost_equal(ls_grads / no_ls_grads, 0.94285715) + + +def test_no_label(): + nlp = Language() + nlp.add_pipe("morphologizer") + with pytest.raises(ValueError): + nlp.initialize() + + +def test_implicit_label(): + nlp = Language() + nlp.add_pipe("morphologizer") + train_examples = [] + for t in TRAIN_DATA: + train_examples.append(Example.from_dict(nlp.make_doc(t[0]), t[1])) + nlp.initialize(get_examples=lambda: train_examples) + + +def test_no_resize(): + nlp = Language() + morphologizer = nlp.add_pipe("morphologizer") + morphologizer.add_label("POS" + Morphology.FIELD_SEP + "NOUN") + morphologizer.add_label("POS" + Morphology.FIELD_SEP + "VERB") + nlp.initialize() + # this throws an error because the morphologizer can't be resized after initialization + with pytest.raises(ValueError): + morphologizer.add_label("POS" + Morphology.FIELD_SEP + "ADJ") + + +def test_initialize_examples(): + nlp = Language() + morphologizer = nlp.add_pipe("morphologizer") + morphologizer.add_label("POS" + Morphology.FIELD_SEP + "NOUN") + train_examples = [] + for t in TRAIN_DATA: + train_examples.append(Example.from_dict(nlp.make_doc(t[0]), t[1])) + # you shouldn't really call this more than once, but for testing it should be fine + nlp.initialize() + nlp.initialize(get_examples=lambda: train_examples) + with pytest.raises(TypeError): + nlp.initialize(get_examples=lambda: None) + with pytest.raises(TypeError): + nlp.initialize(get_examples=train_examples) + + +def test_overfitting_IO(): + # Simple test to try and quickly overfit the morphologizer - ensuring the ML models work correctly + nlp = English() + nlp.add_pipe("morphologizer") + train_examples = [] + for inst in TRAIN_DATA: + train_examples.append(Example.from_dict(nlp.make_doc(inst[0]), inst[1])) + optimizer = nlp.initialize(get_examples=lambda: train_examples) + + for i in range(50): + losses = {} + nlp.update(train_examples, sgd=optimizer, losses=losses) + assert losses["morphologizer"] < 0.00001 + + # test the trained model + test_text = "I like blue ham" + doc = nlp(test_text) + gold_morphs = ["Feat=N", "Feat=V", "", ""] + gold_pos_tags = ["NOUN", "VERB", "ADJ", ""] + assert [str(t.morph) for t in doc] == gold_morphs + assert [t.pos_ for t in doc] == gold_pos_tags + + # Also test the results are still the same after IO + with make_tempdir() as tmp_dir: + nlp.to_disk(tmp_dir) + nlp2 = util.load_model_from_path(tmp_dir) + doc2 = nlp2(test_text) + assert [str(t.morph) for t in doc2] == gold_morphs + assert [t.pos_ for t in doc2] == gold_pos_tags + + # Make sure that running pipe twice, or comparing to call, always amounts to the same predictions + texts = [ + "Just a sentence.", + "Then one more sentence about London.", + "Here is another one.", + "I like London.", + ] + batch_deps_1 = [doc.to_array([MORPH]) for doc in nlp.pipe(texts)] + batch_deps_2 = [doc.to_array([MORPH]) for doc in nlp.pipe(texts)] + no_batch_deps = [doc.to_array([MORPH]) for doc in [nlp(text) for text in texts]] + assert_equal(batch_deps_1, batch_deps_2) + assert_equal(batch_deps_1, no_batch_deps) + + # Test without POS + nlp.remove_pipe("morphologizer") + nlp.add_pipe("morphologizer") + for example in train_examples: + for token in example.reference: + token.pos_ = "" + optimizer = nlp.initialize(get_examples=lambda: train_examples) + for i in range(50): + losses = {} + nlp.update(train_examples, sgd=optimizer, losses=losses) + assert losses["morphologizer"] < 0.00001 + + # Test the trained model + test_text = "I like blue ham" + doc = nlp(test_text) + gold_morphs = ["Feat=N", "Feat=V", "", ""] + gold_pos_tags = ["", "", "", ""] + assert [str(t.morph) for t in doc] == gold_morphs + assert [t.pos_ for t in doc] == gold_pos_tags + + # Test overwrite+extend settings + # (note that "" is unset, "_" is set and empty) + morphs = ["Feat=V", "Feat=N", "_"] + doc = Doc(nlp.vocab, words=["blue", "ham", "like"], morphs=morphs) + orig_morphs = [str(t.morph) for t in doc] + orig_pos_tags = [t.pos_ for t in doc] + morphologizer = nlp.get_pipe("morphologizer") + + # don't overwrite or extend + morphologizer.cfg["overwrite"] = False + doc = morphologizer(doc) + assert [str(t.morph) for t in doc] == orig_morphs + assert [t.pos_ for t in doc] == orig_pos_tags + + # overwrite and extend + morphologizer.cfg["overwrite"] = True + morphologizer.cfg["extend"] = True + doc = Doc(nlp.vocab, words=["I", "like"], morphs=["Feat=A|That=A|This=A", ""]) + doc = morphologizer(doc) + assert [str(t.morph) for t in doc] == ["Feat=N|That=A|This=A", "Feat=V"] + + # extend without overwriting + morphologizer.cfg["overwrite"] = False + morphologizer.cfg["extend"] = True + doc = Doc(nlp.vocab, words=["I", "like"], morphs=["Feat=A|That=A|This=A", "That=B"]) + doc = morphologizer(doc) + assert [str(t.morph) for t in doc] == ["Feat=A|That=A|This=A", "Feat=V|That=B"] + + # overwrite without extending + morphologizer.cfg["overwrite"] = True + morphologizer.cfg["extend"] = False + doc = Doc(nlp.vocab, words=["I", "like"], morphs=["Feat=A|That=A|This=A", ""]) + doc = morphologizer(doc) + assert [str(t.morph) for t in doc] == ["Feat=N", "Feat=V"] + + # Test with unset morph and partial POS + nlp.remove_pipe("morphologizer") + nlp.add_pipe("morphologizer") + for example in train_examples: + for token in example.reference: + if token.text == "ham": + token.pos_ = "NOUN" + else: + token.pos_ = "" + token.set_morph(None) + optimizer = nlp.initialize(get_examples=lambda: train_examples) + assert nlp.get_pipe("morphologizer").labels is not None + for i in range(50): + losses = {} + nlp.update(train_examples, sgd=optimizer, losses=losses) + assert losses["morphologizer"] < 0.00001 + + # Test the trained model + test_text = "I like blue ham" + doc = nlp(test_text) + gold_morphs = ["", "", "", ""] + gold_pos_tags = ["NOUN", "NOUN", "NOUN", "NOUN"] + assert [str(t.morph) for t in doc] == gold_morphs + assert [t.pos_ for t in doc] == gold_pos_tags diff --git a/TTS/Kokoro/.venv/Lib/site-packages/spacy/tests/pipeline/test_pipe_factories.py b/TTS/Kokoro/.venv/Lib/site-packages/spacy/tests/pipeline/test_pipe_factories.py new file mode 100644 index 0000000000000000000000000000000000000000..259b8786415046ad4c43a7b46b07a0b5a01a975d --- /dev/null +++ b/TTS/Kokoro/.venv/Lib/site-packages/spacy/tests/pipeline/test_pipe_factories.py @@ -0,0 +1,596 @@ +import pytest + +try: + from pydantic.v1 import StrictInt, StrictStr +except ImportError: + from pydantic import StrictInt, StrictStr # type: ignore + +from thinc.api import ConfigValidationError, Linear, Model + +import spacy +from spacy.lang.de import German +from spacy.lang.en import English +from spacy.language import Language +from spacy.pipeline.tok2vec import DEFAULT_TOK2VEC_MODEL +from spacy.tokens import Doc +from spacy.util import SimpleFrozenDict, combine_score_weights, registry + +from ..util import make_tempdir + + +@pytest.mark.issue(5137) +def test_issue5137(): + factory_name = "test_issue5137" + pipe_name = "my_component" + + @Language.factory(factory_name) + class MyComponent: + def __init__(self, nlp, name=pipe_name, categories="all_categories"): + self.nlp = nlp + self.categories = categories + self.name = name + + def __call__(self, doc): + pass + + def to_disk(self, path, **kwargs): + pass + + def from_disk(self, path, **cfg): + pass + + nlp = English() + my_component = nlp.add_pipe(factory_name, name=pipe_name) + assert my_component.categories == "all_categories" + with make_tempdir() as tmpdir: + nlp.to_disk(tmpdir) + overrides = {"components": {pipe_name: {"categories": "my_categories"}}} + nlp2 = spacy.load(tmpdir, config=overrides) + assert nlp2.get_pipe(pipe_name).categories == "my_categories" + + +def test_pipe_function_component(): + name = "test_component" + + @Language.component(name) + def component(doc: Doc) -> Doc: + return doc + + assert name in registry.factories + nlp = Language() + with pytest.raises(ValueError): + nlp.add_pipe(component) + nlp.add_pipe(name) + assert name in nlp.pipe_names + assert nlp.pipe_factories[name] == name + assert Language.get_factory_meta(name) + assert nlp.get_pipe_meta(name) + pipe = nlp.get_pipe(name) + assert pipe == component + pipe = nlp.create_pipe(name) + assert pipe == component + + +def test_pipe_class_component_init(): + name1 = "test_class_component1" + name2 = "test_class_component2" + + @Language.factory(name1) + class Component1: + def __init__(self, nlp: Language, name: str): + self.nlp = nlp + + def __call__(self, doc: Doc) -> Doc: + return doc + + class Component2: + def __init__(self, nlp: Language, name: str): + self.nlp = nlp + + def __call__(self, doc: Doc) -> Doc: + return doc + + @Language.factory(name2) + def factory(nlp: Language, name=name2): + return Component2(nlp, name) + + nlp = Language() + for name, Component in [(name1, Component1), (name2, Component2)]: + assert name in registry.factories + with pytest.raises(ValueError): + nlp.add_pipe(Component(nlp, name)) + nlp.add_pipe(name) + assert name in nlp.pipe_names + assert nlp.pipe_factories[name] == name + assert Language.get_factory_meta(name) + assert nlp.get_pipe_meta(name) + pipe = nlp.get_pipe(name) + assert isinstance(pipe, Component) + assert isinstance(pipe.nlp, Language) + pipe = nlp.create_pipe(name) + assert isinstance(pipe, Component) + assert isinstance(pipe.nlp, Language) + + +def test_pipe_class_component_config(): + name = "test_class_component_config" + + @Language.factory(name) + class Component: + def __init__( + self, nlp: Language, name: str, value1: StrictInt, value2: StrictStr + ): + self.nlp = nlp + self.value1 = value1 + self.value2 = value2 + self.is_base = True + self.name = name + + def __call__(self, doc: Doc) -> Doc: + return doc + + @English.factory(name) + class ComponentEN: + def __init__( + self, nlp: Language, name: str, value1: StrictInt, value2: StrictStr + ): + self.nlp = nlp + self.value1 = value1 + self.value2 = value2 + self.is_base = False + + def __call__(self, doc: Doc) -> Doc: + return doc + + nlp = Language() + with pytest.raises(ConfigValidationError): # no config provided + nlp.add_pipe(name) + with pytest.raises(ConfigValidationError): # invalid config + nlp.add_pipe(name, config={"value1": "10", "value2": "hello"}) + with pytest.warns(UserWarning): + nlp.add_pipe( + name, config={"value1": 10, "value2": "hello", "name": "wrong_name"} + ) + pipe = nlp.get_pipe(name) + assert isinstance(pipe.nlp, Language) + assert pipe.value1 == 10 + assert pipe.value2 == "hello" + assert pipe.is_base is True + assert pipe.name == name + + nlp_en = English() + with pytest.raises(ConfigValidationError): # invalid config + nlp_en.add_pipe(name, config={"value1": "10", "value2": "hello"}) + nlp_en.add_pipe(name, config={"value1": 10, "value2": "hello"}) + pipe = nlp_en.get_pipe(name) + assert isinstance(pipe.nlp, English) + assert pipe.value1 == 10 + assert pipe.value2 == "hello" + assert pipe.is_base is False + + +def test_pipe_class_component_defaults(): + name = "test_class_component_defaults" + + @Language.factory(name) + class Component: + def __init__( + self, + nlp: Language, + name: str, + value1: StrictInt = StrictInt(10), + value2: StrictStr = StrictStr("hello"), + ): + self.nlp = nlp + self.value1 = value1 + self.value2 = value2 + + def __call__(self, doc: Doc) -> Doc: + return doc + + nlp = Language() + nlp.add_pipe(name) + pipe = nlp.get_pipe(name) + assert isinstance(pipe.nlp, Language) + assert pipe.value1 == 10 + assert pipe.value2 == "hello" + + +def test_pipe_class_component_model(): + name = "test_class_component_model" + default_config = { + "model": { + "@architectures": "spacy.TextCatEnsemble.v2", + "tok2vec": DEFAULT_TOK2VEC_MODEL, + "linear_model": { + "@architectures": "spacy.TextCatBOW.v3", + "exclusive_classes": False, + "ngram_size": 1, + "no_output_layer": False, + }, + }, + "value1": 10, + } + + @Language.factory(name, default_config=default_config) + class Component: + def __init__(self, nlp: Language, model: Model, name: str, value1: StrictInt): + self.nlp = nlp + self.model = model + self.value1 = value1 + self.name = name + + def __call__(self, doc: Doc) -> Doc: + return doc + + nlp = Language() + nlp.add_pipe(name) + pipe = nlp.get_pipe(name) + assert isinstance(pipe.nlp, Language) + assert pipe.value1 == 10 + assert isinstance(pipe.model, Model) + + +def test_pipe_class_component_model_custom(): + name = "test_class_component_model_custom" + arch = f"{name}.arch" + default_config = {"value1": 1, "model": {"@architectures": arch, "nO": 0, "nI": 0}} + + @Language.factory(name, default_config=default_config) + class Component: + def __init__( + self, + nlp: Language, + model: Model, + name: str, + value1: StrictInt = StrictInt(10), + ): + self.nlp = nlp + self.model = model + self.value1 = value1 + self.name = name + + def __call__(self, doc: Doc) -> Doc: + return doc + + @registry.architectures(arch) + def make_custom_arch(nO: StrictInt, nI: StrictInt): + return Linear(nO, nI) + + nlp = Language() + config = {"value1": 20, "model": {"@architectures": arch, "nO": 1, "nI": 2}} + nlp.add_pipe(name, config=config) + pipe = nlp.get_pipe(name) + assert isinstance(pipe.nlp, Language) + assert pipe.value1 == 20 + assert isinstance(pipe.model, Model) + assert pipe.model.name == "linear" + + nlp = Language() + with pytest.raises(ConfigValidationError): + config = {"value1": "20", "model": {"@architectures": arch, "nO": 1, "nI": 2}} + nlp.add_pipe(name, config=config) + with pytest.raises(ConfigValidationError): + config = {"value1": 20, "model": {"@architectures": arch, "nO": 1.0, "nI": 2.0}} + nlp.add_pipe(name, config=config) + + +def test_pipe_factories_wrong_formats(): + with pytest.raises(ValueError): + # Decorator is not called + @Language.component + def component(foo: int, bar: str): ... + + with pytest.raises(ValueError): + # Decorator is not called + @Language.factory + def factory1(foo: int, bar: str): ... + + with pytest.raises(ValueError): + # Factory function is missing "nlp" and "name" arguments + @Language.factory("test_pipe_factories_missing_args") + def factory2(foo: int, bar: str): ... + + +def test_pipe_factory_meta_config_cleanup(): + """Test that component-specific meta and config entries are represented + correctly and cleaned up when pipes are removed, replaced or renamed.""" + nlp = Language() + nlp.add_pipe("ner", name="ner_component") + nlp.add_pipe("textcat") + assert nlp.get_factory_meta("ner") + assert nlp.get_pipe_meta("ner_component") + assert nlp.get_pipe_config("ner_component") + assert nlp.get_factory_meta("textcat") + assert nlp.get_pipe_meta("textcat") + assert nlp.get_pipe_config("textcat") + nlp.rename_pipe("textcat", "tc") + assert nlp.get_pipe_meta("tc") + assert nlp.get_pipe_config("tc") + with pytest.raises(ValueError): + nlp.remove_pipe("ner") + nlp.remove_pipe("ner_component") + assert "ner_component" not in nlp._pipe_meta + assert "ner_component" not in nlp._pipe_configs + with pytest.raises(ValueError): + nlp.replace_pipe("textcat", "parser") + nlp.replace_pipe("tc", "parser") + assert nlp.get_factory_meta("parser") + assert nlp.get_pipe_meta("tc").factory == "parser" + + +def test_pipe_factories_empty_dict_default(): + """Test that default config values can be empty dicts and that no config + validation error is raised.""" + # TODO: fix this + name = "test_pipe_factories_empty_dict_default" + + @Language.factory(name, default_config={"foo": {}}) + def factory(nlp: Language, name: str, foo: dict): ... + + nlp = Language() + nlp.create_pipe(name) + + +def test_pipe_factories_language_specific(): + """Test that language sub-classes can have their own factories, with + fallbacks to the base factories.""" + name1 = "specific_component1" + name2 = "specific_component2" + Language.component(name1, func=lambda: "base") + English.component(name1, func=lambda: "en") + German.component(name2, func=lambda: "de") + + assert Language.has_factory(name1) + assert not Language.has_factory(name2) + assert English.has_factory(name1) + assert not English.has_factory(name2) + assert German.has_factory(name1) + assert German.has_factory(name2) + + nlp = Language() + assert nlp.create_pipe(name1)() == "base" + with pytest.raises(ValueError): + nlp.create_pipe(name2) + nlp_en = English() + assert nlp_en.create_pipe(name1)() == "en" + with pytest.raises(ValueError): + nlp_en.create_pipe(name2) + nlp_de = German() + assert nlp_de.create_pipe(name1)() == "base" + assert nlp_de.create_pipe(name2)() == "de" + + +def test_language_factories_invalid(): + """Test that assigning directly to Language.factories is now invalid and + raises a custom error.""" + assert isinstance(Language.factories, SimpleFrozenDict) + with pytest.raises(NotImplementedError): + Language.factories["foo"] = "bar" + nlp = Language() + assert isinstance(nlp.factories, SimpleFrozenDict) + assert len(nlp.factories) + with pytest.raises(NotImplementedError): + nlp.factories["foo"] = "bar" + + +@pytest.mark.parametrize( + "weights,override,expected", + [ + ([{"a": 1.0}, {"b": 1.0}, {"c": 1.0}], {}, {"a": 0.33, "b": 0.33, "c": 0.33}), + ([{"a": 1.0}, {"b": 50}, {"c": 100}], {}, {"a": 0.01, "b": 0.33, "c": 0.66}), + ( + [{"a": 0.7, "b": 0.3}, {"c": 1.0}, {"d": 0.5, "e": 0.5}], + {}, + {"a": 0.23, "b": 0.1, "c": 0.33, "d": 0.17, "e": 0.17}, + ), + ( + [{"a": 100, "b": 300}, {"c": 50, "d": 50}], + {}, + {"a": 0.2, "b": 0.6, "c": 0.1, "d": 0.1}, + ), + ([{"a": 0.5, "b": 0.5}, {"b": 1.0}], {}, {"a": 0.33, "b": 0.67}), + ([{"a": 0.5, "b": 0.0}], {}, {"a": 1.0, "b": 0.0}), + ([{"a": 0.5, "b": 0.5}, {"b": 1.0}], {"a": 0.0}, {"a": 0.0, "b": 1.0}), + ([{"a": 0.0, "b": 0.0}, {"c": 0.0}], {}, {"a": 0.0, "b": 0.0, "c": 0.0}), + ([{"a": 0.0, "b": 0.0}, {"c": 1.0}], {}, {"a": 0.0, "b": 0.0, "c": 1.0}), + ( + [{"a": 0.0, "b": 0.0}, {"c": 0.0}], + {"c": 0.2}, + {"a": 0.0, "b": 0.0, "c": 1.0}, + ), + ( + [{"a": 0.5, "b": 0.5, "c": 1.0, "d": 1.0}], + {"a": 0.0, "b": 0.0}, + {"a": 0.0, "b": 0.0, "c": 0.5, "d": 0.5}, + ), + ( + [{"a": 0.5, "b": 0.5, "c": 1.0, "d": 1.0}], + {"a": 0.0, "b": 0.0, "f": 0.0}, + {"a": 0.0, "b": 0.0, "c": 0.5, "d": 0.5, "f": 0.0}, + ), + ], +) +def test_language_factories_combine_score_weights(weights, override, expected): + result = combine_score_weights(weights, override) + assert sum(result.values()) in (0.99, 1.0, 0.0) + assert result == expected + + +def test_language_factories_scores(): + name = "test_language_factories_scores" + func = lambda nlp, name: lambda doc: doc + weights1 = {"a1": 0.5, "a2": 0.5} + weights2 = {"b1": 0.2, "b2": 0.7, "b3": 0.1} + Language.factory(f"{name}1", default_score_weights=weights1, func=func) + Language.factory(f"{name}2", default_score_weights=weights2, func=func) + meta1 = Language.get_factory_meta(f"{name}1") + assert meta1.default_score_weights == weights1 + meta2 = Language.get_factory_meta(f"{name}2") + assert meta2.default_score_weights == weights2 + nlp = Language() + nlp._config["training"]["score_weights"] = {} + nlp.add_pipe(f"{name}1") + nlp.add_pipe(f"{name}2") + cfg = nlp.config["training"] + expected_weights = {"a1": 0.25, "a2": 0.25, "b1": 0.1, "b2": 0.35, "b3": 0.05} + assert cfg["score_weights"] == expected_weights + # Test with custom defaults + config = nlp.config.copy() + config["training"]["score_weights"]["a1"] = 0.0 + config["training"]["score_weights"]["b3"] = 1.3 + nlp = English.from_config(config) + score_weights = nlp.config["training"]["score_weights"] + expected = {"a1": 0.0, "a2": 0.12, "b1": 0.05, "b2": 0.17, "b3": 0.65} + assert score_weights == expected + # Test with null values + config = nlp.config.copy() + config["training"]["score_weights"]["a1"] = None + nlp = English.from_config(config) + score_weights = nlp.config["training"]["score_weights"] + expected = {"a1": None, "a2": 0.12, "b1": 0.05, "b2": 0.17, "b3": 0.66} + assert score_weights == expected + + +def test_pipe_factories_from_source(): + """Test adding components from a source model.""" + source_nlp = English() + source_nlp.add_pipe("tagger", name="my_tagger") + nlp = English() + with pytest.raises(ValueError): + nlp.add_pipe("my_tagger", source="en_core_web_sm") + nlp.add_pipe("my_tagger", source=source_nlp) + assert "my_tagger" in nlp.pipe_names + with pytest.raises(KeyError): + nlp.add_pipe("custom", source=source_nlp) + + +def test_pipe_factories_from_source_language_subclass(): + class CustomEnglishDefaults(English.Defaults): + stop_words = set(["custom", "stop"]) + + @registry.languages("custom_en") + class CustomEnglish(English): + lang = "custom_en" + Defaults = CustomEnglishDefaults + + source_nlp = English() + source_nlp.add_pipe("tagger") + + # custom subclass + nlp = CustomEnglish() + nlp.add_pipe("tagger", source=source_nlp) + assert "tagger" in nlp.pipe_names + + # non-subclass + nlp = German() + nlp.add_pipe("tagger", source=source_nlp) + assert "tagger" in nlp.pipe_names + + # mismatched vectors + nlp = English() + nlp.vocab.vectors.resize((1, 4)) + nlp.vocab.vectors.add("cat", vector=[1, 2, 3, 4]) + with pytest.warns(UserWarning): + nlp.add_pipe("tagger", source=source_nlp) + + +def test_pipe_factories_from_source_custom(): + """Test adding components from a source model with custom components.""" + name = "test_pipe_factories_from_source_custom" + + @Language.factory(name, default_config={"arg": "hello"}) + def test_factory(nlp, name, arg: str): + return lambda doc: doc + + source_nlp = English() + source_nlp.add_pipe("tagger") + source_nlp.add_pipe(name, config={"arg": "world"}) + nlp = English() + nlp.add_pipe(name, source=source_nlp) + assert name in nlp.pipe_names + assert nlp.get_pipe_meta(name).default_config["arg"] == "hello" + config = nlp.config["components"][name] + assert config["factory"] == name + assert config["arg"] == "world" + + +def test_pipe_factories_from_source_config(): + name = "test_pipe_factories_from_source_config" + + @Language.factory(name, default_config={"arg": "hello"}) + def test_factory(nlp, name, arg: str): + return lambda doc: doc + + source_nlp = English() + source_nlp.add_pipe("tagger") + source_nlp.add_pipe(name, name="yolo", config={"arg": "world"}) + dest_nlp_cfg = {"lang": "en", "pipeline": ["parser", "custom"]} + with make_tempdir() as tempdir: + source_nlp.to_disk(tempdir) + dest_components_cfg = { + "parser": {"factory": "parser"}, + "custom": {"source": str(tempdir), "component": "yolo"}, + } + dest_config = {"nlp": dest_nlp_cfg, "components": dest_components_cfg} + nlp = English.from_config(dest_config) + assert nlp.pipe_names == ["parser", "custom"] + assert nlp.pipe_factories == {"parser": "parser", "custom": name} + meta = nlp.get_pipe_meta("custom") + assert meta.factory == name + assert meta.default_config["arg"] == "hello" + config = nlp.config["components"]["custom"] + assert config["factory"] == name + assert config["arg"] == "world" + + +class PipeFactoriesIdempotent: + def __init__(self, nlp, name): ... + + def __call__(self, doc): ... + + +@pytest.mark.parametrize( + "i,func,func2", + [ + (0, lambda nlp, name: lambda doc: doc, lambda doc: doc), + (1, PipeFactoriesIdempotent, PipeFactoriesIdempotent(None, None)), + ], +) +def test_pipe_factories_decorator_idempotent(i, func, func2): + """Check that decorator can be run multiple times if the function is the + same. This is especially relevant for live reloading because we don't + want spaCy to raise an error if a module registering components is reloaded. + """ + name = f"test_pipe_factories_decorator_idempotent_{i}" + for i in range(5): + Language.factory(name, func=func) + nlp = Language() + nlp.add_pipe(name) + Language.factory(name, func=func) + # Make sure it also works for component decorator, which creates the + # factory function + name2 = f"{name}2" + for i in range(5): + Language.component(name2, func=func2) + nlp = Language() + nlp.add_pipe(name) + Language.component(name2, func=func2) + + +def test_pipe_factories_config_excludes_nlp(): + """Test that the extra values we temporarily add to component config + blocks/functions are removed and not copied around. + """ + name = "test_pipe_factories_config_excludes_nlp" + func = lambda nlp, name: lambda doc: doc + Language.factory(name, func=func) + config = { + "nlp": {"lang": "en", "pipeline": [name]}, + "components": {name: {"factory": name}}, + } + nlp = English.from_config(config) + assert nlp.pipe_names == [name] + pipe_cfg = nlp.get_pipe_config(name) + pipe_cfg == {"factory": name} + assert nlp._pipe_configs[name] == {"factory": name} diff --git a/TTS/Kokoro/.venv/Lib/site-packages/spacy/tests/pipeline/test_pipe_methods.py b/TTS/Kokoro/.venv/Lib/site-packages/spacy/tests/pipeline/test_pipe_methods.py new file mode 100644 index 0000000000000000000000000000000000000000..6ca11a0b1defdf7f095c86f841ce7c9eaf8526ab --- /dev/null +++ b/TTS/Kokoro/.venv/Lib/site-packages/spacy/tests/pipeline/test_pipe_methods.py @@ -0,0 +1,677 @@ +import gc + +import numpy +import pytest +from thinc.api import get_current_ops + +import spacy +from spacy.lang.en import English +from spacy.lang.en.syntax_iterators import noun_chunks +from spacy.language import Language +from spacy.pipeline import TrainablePipe +from spacy.tokens import Doc +from spacy.training import Example +from spacy.util import SimpleFrozenList, get_arg_names, make_tempdir +from spacy.vocab import Vocab + + +@pytest.fixture +def nlp(): + return Language() + + +@Language.component("new_pipe") +def new_pipe(doc): + return doc + + +@Language.component("other_pipe") +def other_pipe(doc): + return doc + + +@pytest.mark.issue(1506) +def test_issue1506(): + def string_generator(): + for _ in range(10001): + yield "It's sentence produced by that bug." + for _ in range(10001): + yield "I erase some hbdsaj lemmas." + for _ in range(10001): + yield "I erase lemmas." + for _ in range(10001): + yield "It's sentence produced by that bug." + for _ in range(10001): + yield "It's sentence produced by that bug." + + nlp = English() + for i, d in enumerate(nlp.pipe(string_generator())): + # We should run cleanup more than one time to actually cleanup data. + # In first run — clean up only mark strings as «not hitted». + if i == 10000 or i == 20000 or i == 30000: + gc.collect() + for t in d: + str(t.lemma_) + + +@pytest.mark.issue(1654) +def test_issue1654(): + nlp = Language(Vocab()) + assert not nlp.pipeline + + @Language.component("component") + def component(doc): + return doc + + nlp.add_pipe("component", name="1") + nlp.add_pipe("component", name="2", after="1") + nlp.add_pipe("component", name="3", after="2") + assert nlp.pipe_names == ["1", "2", "3"] + nlp2 = Language(Vocab()) + assert not nlp2.pipeline + nlp2.add_pipe("component", name="3") + nlp2.add_pipe("component", name="2", before="3") + nlp2.add_pipe("component", name="1", before="2") + assert nlp2.pipe_names == ["1", "2", "3"] + + +@pytest.mark.issue(3880) +def test_issue3880(): + """Test that `nlp.pipe()` works when an empty string ends the batch. + + Fixed in v7.0.5 of Thinc. + """ + texts = ["hello", "world", "", ""] + nlp = English() + nlp.add_pipe("parser").add_label("dep") + nlp.add_pipe("ner").add_label("PERSON") + nlp.add_pipe("tagger").add_label("NN") + nlp.initialize() + for doc in nlp.pipe(texts): + pass + + +@pytest.mark.issue(5082) +def test_issue5082(): + # Ensure the 'merge_entities' pipeline does something sensible for the vectors of the merged tokens + nlp = English() + vocab = nlp.vocab + array1 = numpy.asarray([0.1, 0.5, 0.8], dtype=numpy.float32) + array2 = numpy.asarray([-0.2, -0.6, -0.9], dtype=numpy.float32) + array3 = numpy.asarray([0.3, -0.1, 0.7], dtype=numpy.float32) + array4 = numpy.asarray([0.5, 0, 0.3], dtype=numpy.float32) + array34 = numpy.asarray([0.4, -0.05, 0.5], dtype=numpy.float32) + vocab.set_vector("I", array1) + vocab.set_vector("like", array2) + vocab.set_vector("David", array3) + vocab.set_vector("Bowie", array4) + text = "I like David Bowie" + patterns = [ + {"label": "PERSON", "pattern": [{"LOWER": "david"}, {"LOWER": "bowie"}]} + ] + ruler = nlp.add_pipe("entity_ruler") + ruler.add_patterns(patterns) + parsed_vectors_1 = [t.vector for t in nlp(text)] + assert len(parsed_vectors_1) == 4 + ops = get_current_ops() + numpy.testing.assert_array_equal(ops.to_numpy(parsed_vectors_1[0]), array1) + numpy.testing.assert_array_equal(ops.to_numpy(parsed_vectors_1[1]), array2) + numpy.testing.assert_array_equal(ops.to_numpy(parsed_vectors_1[2]), array3) + numpy.testing.assert_array_equal(ops.to_numpy(parsed_vectors_1[3]), array4) + nlp.add_pipe("merge_entities") + parsed_vectors_2 = [t.vector for t in nlp(text)] + assert len(parsed_vectors_2) == 3 + numpy.testing.assert_array_equal(ops.to_numpy(parsed_vectors_2[0]), array1) + numpy.testing.assert_array_equal(ops.to_numpy(parsed_vectors_2[1]), array2) + numpy.testing.assert_array_equal(ops.to_numpy(parsed_vectors_2[2]), array34) + + +@pytest.mark.issue(5458) +def test_issue5458(): + # Test that the noun chuncker does not generate overlapping spans + # fmt: off + words = ["In", "an", "era", "where", "markets", "have", "brought", "prosperity", "and", "empowerment", "."] + vocab = Vocab(strings=words) + deps = ["ROOT", "det", "pobj", "advmod", "nsubj", "aux", "relcl", "dobj", "cc", "conj", "punct"] + pos = ["ADP", "DET", "NOUN", "ADV", "NOUN", "AUX", "VERB", "NOUN", "CCONJ", "NOUN", "PUNCT"] + heads = [0, 2, 0, 9, 6, 6, 2, 6, 7, 7, 0] + # fmt: on + en_doc = Doc(vocab, words=words, pos=pos, heads=heads, deps=deps) + en_doc.noun_chunks_iterator = noun_chunks + + # if there are overlapping spans, this will fail with an E102 error "Can't merge non-disjoint spans" + nlp = English() + merge_nps = nlp.create_pipe("merge_noun_chunks") + merge_nps(en_doc) + + +def test_multiple_predictions(): + class DummyPipe(TrainablePipe): + def __init__(self): + self.model = "dummy_model" + + def predict(self, docs): + return ([1, 2, 3], [4, 5, 6]) + + def set_annotations(self, docs, scores): + return docs + + nlp = Language() + doc = nlp.make_doc("foo") + dummy_pipe = DummyPipe() + dummy_pipe(doc) + + +def test_add_pipe_no_name(nlp): + nlp.add_pipe("new_pipe") + assert "new_pipe" in nlp.pipe_names + + +def test_add_pipe_duplicate_name(nlp): + nlp.add_pipe("new_pipe", name="duplicate_name") + with pytest.raises(ValueError): + nlp.add_pipe("new_pipe", name="duplicate_name") + + +@pytest.mark.parametrize("name", ["parser"]) +def test_add_pipe_first(nlp, name): + nlp.add_pipe("new_pipe", name=name, first=True) + assert nlp.pipeline[0][0] == name + + +@pytest.mark.parametrize("name1,name2", [("parser", "lambda_pipe")]) +def test_add_pipe_last(nlp, name1, name2): + Language.component("new_pipe2", func=lambda doc: doc) + nlp.add_pipe("new_pipe2", name=name2) + nlp.add_pipe("new_pipe", name=name1, last=True) + assert nlp.pipeline[0][0] != name1 + assert nlp.pipeline[-1][0] == name1 + + +def test_cant_add_pipe_first_and_last(nlp): + with pytest.raises(ValueError): + nlp.add_pipe("new_pipe", first=True, last=True) + + +@pytest.mark.parametrize("name", ["test_get_pipe"]) +def test_get_pipe(nlp, name): + with pytest.raises(KeyError): + nlp.get_pipe(name) + nlp.add_pipe("new_pipe", name=name) + assert nlp.get_pipe(name) == new_pipe + + +@pytest.mark.parametrize( + "name,replacement,invalid_replacement", + [("test_replace_pipe", "other_pipe", lambda doc: doc)], +) +def test_replace_pipe(nlp, name, replacement, invalid_replacement): + with pytest.raises(ValueError): + nlp.replace_pipe(name, new_pipe) + nlp.add_pipe("new_pipe", name=name) + with pytest.raises(ValueError): + nlp.replace_pipe(name, invalid_replacement) + nlp.replace_pipe(name, replacement) + assert nlp.get_pipe(name) == nlp.create_pipe(replacement) + + +def test_replace_last_pipe(nlp): + nlp.add_pipe("sentencizer") + nlp.add_pipe("ner") + assert nlp.pipe_names == ["sentencizer", "ner"] + nlp.replace_pipe("ner", "ner") + assert nlp.pipe_names == ["sentencizer", "ner"] + + +def test_replace_pipe_config(nlp): + nlp.add_pipe("entity_linker") + nlp.add_pipe("sentencizer") + assert nlp.get_pipe("entity_linker").incl_prior is True + nlp.replace_pipe("entity_linker", "entity_linker", config={"incl_prior": False}) + assert nlp.get_pipe("entity_linker").incl_prior is False + + +@pytest.mark.parametrize("old_name,new_name", [("old_pipe", "new_pipe")]) +def test_rename_pipe(nlp, old_name, new_name): + with pytest.raises(ValueError): + nlp.rename_pipe(old_name, new_name) + nlp.add_pipe("new_pipe", name=old_name) + nlp.rename_pipe(old_name, new_name) + assert nlp.pipeline[0][0] == new_name + + +@pytest.mark.parametrize("name", ["my_component"]) +def test_remove_pipe(nlp, name): + with pytest.raises(ValueError): + nlp.remove_pipe(name) + nlp.add_pipe("new_pipe", name=name) + assert len(nlp.pipeline) == 1 + removed_name, removed_component = nlp.remove_pipe(name) + assert not len(nlp.pipeline) + assert removed_name == name + assert removed_component == new_pipe + + +@pytest.mark.parametrize("name", ["my_component"]) +def test_disable_pipes_method(nlp, name): + nlp.add_pipe("new_pipe", name=name) + assert nlp.has_pipe(name) + disabled = nlp.select_pipes(disable=name) + assert not nlp.has_pipe(name) + disabled.restore() + + +@pytest.mark.parametrize("name", ["my_component"]) +def test_enable_pipes_method(nlp, name): + nlp.add_pipe("new_pipe", name=name) + assert nlp.has_pipe(name) + disabled = nlp.select_pipes(enable=[]) + assert not nlp.has_pipe(name) + disabled.restore() + + +@pytest.mark.parametrize("name", ["my_component"]) +def test_disable_pipes_context(nlp, name): + """Test that an enabled component stays enabled after running the context manager.""" + nlp.add_pipe("new_pipe", name=name) + assert nlp.has_pipe(name) + with nlp.select_pipes(disable=name): + assert not nlp.has_pipe(name) + assert nlp.has_pipe(name) + + +@pytest.mark.parametrize("name", ["my_component"]) +def test_disable_pipes_context_restore(nlp, name): + """Test that a disabled component stays disabled after running the context manager.""" + nlp.add_pipe("new_pipe", name=name) + assert nlp.has_pipe(name) + nlp.disable_pipe(name) + assert not nlp.has_pipe(name) + with nlp.select_pipes(disable=name): + assert not nlp.has_pipe(name) + assert not nlp.has_pipe(name) + + +def test_select_pipes_list_arg(nlp): + for name in ["c1", "c2", "c3"]: + nlp.add_pipe("new_pipe", name=name) + assert nlp.has_pipe(name) + with nlp.select_pipes(disable=["c1", "c2"]): + assert not nlp.has_pipe("c1") + assert not nlp.has_pipe("c2") + assert nlp.has_pipe("c3") + with nlp.select_pipes(enable="c3"): + assert not nlp.has_pipe("c1") + assert not nlp.has_pipe("c2") + assert nlp.has_pipe("c3") + with nlp.select_pipes(enable=["c1", "c2"], disable="c3"): + assert nlp.has_pipe("c1") + assert nlp.has_pipe("c2") + assert not nlp.has_pipe("c3") + with nlp.select_pipes(enable=[]): + assert not nlp.has_pipe("c1") + assert not nlp.has_pipe("c2") + assert not nlp.has_pipe("c3") + with nlp.select_pipes(enable=["c1", "c2", "c3"], disable=[]): + assert nlp.has_pipe("c1") + assert nlp.has_pipe("c2") + assert nlp.has_pipe("c3") + with nlp.select_pipes(disable=["c1", "c2", "c3"], enable=[]): + assert not nlp.has_pipe("c1") + assert not nlp.has_pipe("c2") + assert not nlp.has_pipe("c3") + + +def test_select_pipes_errors(nlp): + for name in ["c1", "c2", "c3"]: + nlp.add_pipe("new_pipe", name=name) + assert nlp.has_pipe(name) + + with pytest.raises(ValueError): + nlp.select_pipes() + + with pytest.raises(ValueError): + nlp.select_pipes(enable=["c1", "c2"], disable=["c1"]) + + with pytest.raises(ValueError): + nlp.select_pipes(enable=["c1", "c2"], disable=[]) + + with pytest.raises(ValueError): + nlp.select_pipes(enable=[], disable=["c3"]) + + disabled = nlp.select_pipes(disable=["c2"]) + nlp.remove_pipe("c2") + with pytest.raises(ValueError): + disabled.restore() + + +@pytest.mark.parametrize("n_pipes", [100]) +def test_add_lots_of_pipes(nlp, n_pipes): + Language.component("n_pipes", func=lambda doc: doc) + for i in range(n_pipes): + nlp.add_pipe("n_pipes", name=f"pipe_{i}") + assert len(nlp.pipe_names) == n_pipes + + +@pytest.mark.parametrize("component", [lambda doc: doc, {"hello": "world"}]) +def test_raise_for_invalid_components(nlp, component): + with pytest.raises(ValueError): + nlp.add_pipe(component) + + +@pytest.mark.parametrize("component", ["ner", "tagger", "parser", "textcat"]) +def test_pipe_base_class_add_label(nlp, component): + label = "TEST" + pipe = nlp.create_pipe(component) + pipe.add_label(label) + if component == "tagger": + # Tagger always has the default coarse-grained label scheme + assert label in pipe.labels + else: + assert pipe.labels == (label,) + + +def test_pipe_labels(nlp): + input_labels = { + "ner": ["PERSON", "ORG", "GPE"], + "textcat": ["POSITIVE", "NEGATIVE"], + } + for name, labels in input_labels.items(): + nlp.add_pipe(name) + pipe = nlp.get_pipe(name) + for label in labels: + pipe.add_label(label) + assert len(pipe.labels) == len(labels) + + assert len(nlp.pipe_labels) == len(input_labels) + for name, labels in nlp.pipe_labels.items(): + assert sorted(input_labels[name]) == sorted(labels) + + +def test_add_pipe_before_after(): + """Test that before/after works with strings and ints.""" + nlp = Language() + nlp.add_pipe("ner") + with pytest.raises(ValueError): + nlp.add_pipe("textcat", before="parser") + nlp.add_pipe("textcat", before="ner") + assert nlp.pipe_names == ["textcat", "ner"] + with pytest.raises(ValueError): + nlp.add_pipe("parser", before=3) + with pytest.raises(ValueError): + nlp.add_pipe("parser", after=3) + nlp.add_pipe("parser", after=0) + assert nlp.pipe_names == ["textcat", "parser", "ner"] + nlp.add_pipe("tagger", before=2) + assert nlp.pipe_names == ["textcat", "parser", "tagger", "ner"] + with pytest.raises(ValueError): + nlp.add_pipe("entity_ruler", after=1, first=True) + with pytest.raises(ValueError): + nlp.add_pipe("entity_ruler", before="ner", after=2) + with pytest.raises(ValueError): + nlp.add_pipe("entity_ruler", before=True) + with pytest.raises(ValueError): + nlp.add_pipe("entity_ruler", first=False) + + +def test_disable_enable_pipes(): + name = "test_disable_enable_pipes" + results = {} + + def make_component(name): + results[name] = "" + + def component(doc): + nonlocal results + results[name] = doc.text + return doc + + return component + + c1 = Language.component(f"{name}1", func=make_component(f"{name}1")) + c2 = Language.component(f"{name}2", func=make_component(f"{name}2")) + + nlp = Language() + nlp.add_pipe(f"{name}1") + nlp.add_pipe(f"{name}2") + assert results[f"{name}1"] == "" + assert results[f"{name}2"] == "" + assert nlp.pipeline == [(f"{name}1", c1), (f"{name}2", c2)] + assert nlp.pipe_names == [f"{name}1", f"{name}2"] + nlp.disable_pipe(f"{name}1") + assert nlp.disabled == [f"{name}1"] + assert nlp.component_names == [f"{name}1", f"{name}2"] + assert nlp.pipe_names == [f"{name}2"] + assert nlp.config["nlp"]["disabled"] == [f"{name}1"] + nlp("hello") + assert results[f"{name}1"] == "" # didn't run + assert results[f"{name}2"] == "hello" # ran + nlp.enable_pipe(f"{name}1") + assert nlp.disabled == [] + assert nlp.pipe_names == [f"{name}1", f"{name}2"] + assert nlp.config["nlp"]["disabled"] == [] + nlp("world") + assert results[f"{name}1"] == "world" + assert results[f"{name}2"] == "world" + nlp.disable_pipe(f"{name}2") + nlp.remove_pipe(f"{name}2") + assert nlp.components == [(f"{name}1", c1)] + assert nlp.pipeline == [(f"{name}1", c1)] + assert nlp.component_names == [f"{name}1"] + assert nlp.pipe_names == [f"{name}1"] + assert nlp.disabled == [] + assert nlp.config["nlp"]["disabled"] == [] + nlp.rename_pipe(f"{name}1", name) + assert nlp.components == [(name, c1)] + assert nlp.component_names == [name] + nlp("!") + assert results[f"{name}1"] == "!" + assert results[f"{name}2"] == "world" + with pytest.raises(ValueError): + nlp.disable_pipe(f"{name}2") + nlp.disable_pipe(name) + assert nlp.component_names == [name] + assert nlp.pipe_names == [] + assert nlp.config["nlp"]["disabled"] == [name] + nlp("?") + assert results[f"{name}1"] == "!" + + +def test_pipe_methods_frozen(): + """Test that spaCy raises custom error messages if "frozen" properties are + accessed. We still want to use a list here to not break backwards + compatibility, but users should see an error if they're trying to append + to nlp.pipeline etc.""" + nlp = Language() + ner = nlp.add_pipe("ner") + assert nlp.pipe_names == ["ner"] + for prop in [ + nlp.pipeline, + nlp.pipe_names, + nlp.components, + nlp.component_names, + nlp.disabled, + nlp.factory_names, + ]: + assert isinstance(prop, list) + assert isinstance(prop, SimpleFrozenList) + with pytest.raises(NotImplementedError): + nlp.pipeline.append(("ner2", ner)) + with pytest.raises(NotImplementedError): + nlp.pipe_names.pop() + with pytest.raises(NotImplementedError): + nlp.components.sort() + with pytest.raises(NotImplementedError): + nlp.component_names.clear() + + +@pytest.mark.parametrize( + "pipe", ["tagger", "parser", "ner", "textcat", "morphologizer"] +) +def test_pipe_label_data_exports_labels(pipe): + nlp = Language() + pipe = nlp.add_pipe(pipe) + # Make sure pipe has pipe labels + assert getattr(pipe, "label_data", None) is not None + # Make sure pipe can be initialized with labels + initialize = getattr(pipe, "initialize", None) + assert initialize is not None + assert "labels" in get_arg_names(initialize) + + +@pytest.mark.parametrize("pipe", ["senter", "entity_linker"]) +def test_pipe_label_data_no_labels(pipe): + nlp = Language() + pipe = nlp.add_pipe(pipe) + assert getattr(pipe, "label_data", None) is None + initialize = getattr(pipe, "initialize", None) + if initialize is not None: + assert "labels" not in get_arg_names(initialize) + + +def test_pipe_methods_initialize(): + """Test that the [initialize] config reflects the components correctly.""" + nlp = Language() + nlp.add_pipe("tagger") + assert "tagger" not in nlp.config["initialize"]["components"] + nlp.config["initialize"]["components"]["tagger"] = {"labels": ["hello"]} + assert nlp.config["initialize"]["components"]["tagger"] == {"labels": ["hello"]} + nlp.remove_pipe("tagger") + assert "tagger" not in nlp.config["initialize"]["components"] + nlp.add_pipe("tagger") + assert "tagger" not in nlp.config["initialize"]["components"] + nlp.config["initialize"]["components"]["tagger"] = {"labels": ["hello"]} + nlp.rename_pipe("tagger", "my_tagger") + assert "tagger" not in nlp.config["initialize"]["components"] + assert nlp.config["initialize"]["components"]["my_tagger"] == {"labels": ["hello"]} + nlp.config["initialize"]["components"]["test"] = {"foo": "bar"} + nlp.add_pipe("ner", name="test") + assert "test" in nlp.config["initialize"]["components"] + nlp.remove_pipe("test") + assert "test" not in nlp.config["initialize"]["components"] + + +def test_update_with_annotates(): + name = "test_with_annotates" + results = {} + + def make_component(name): + results[name] = "" + + def component(doc): + nonlocal results + results[name] += doc.text + return doc + + return component + + Language.component(f"{name}1", func=make_component(f"{name}1")) + Language.component(f"{name}2", func=make_component(f"{name}2")) + + components = set([f"{name}1", f"{name}2"]) + + nlp = English() + texts = ["a", "bb", "ccc"] + examples = [] + for text in texts: + examples.append(Example(nlp.make_doc(text), nlp.make_doc(text))) + + for components_to_annotate in [ + [], + [f"{name}1"], + [f"{name}1", f"{name}2"], + [f"{name}2", f"{name}1"], + ]: + for key in results: + results[key] = "" + nlp = English(vocab=nlp.vocab) + nlp.add_pipe(f"{name}1") + nlp.add_pipe(f"{name}2") + nlp.update(examples, annotates=components_to_annotate) + for component in components_to_annotate: + assert results[component] == "".join(eg.predicted.text for eg in examples) + for component in components - set(components_to_annotate): + assert results[component] == "" + + +@pytest.mark.issue(11443) +def test_enable_disable_conflict_with_config(): + """Test conflict between enable/disable w.r.t. `nlp.disabled` set in the config.""" + nlp = English() + nlp.add_pipe("tagger") + nlp.add_pipe("senter") + nlp.add_pipe("sentencizer") + + with make_tempdir() as tmp_dir: + nlp.to_disk(tmp_dir) + # Expected to succeed, as config and arguments do not conflict. + assert spacy.load( + tmp_dir, enable=["tagger"], config={"nlp": {"disabled": ["senter"]}} + ).disabled == ["senter", "sentencizer"] + # Expected to succeed without warning due to the lack of a conflicting config option. + spacy.load(tmp_dir, enable=["tagger"]) + # Expected to fail due to conflict between enable and disabled. + with pytest.raises(ValueError): + spacy.load( + tmp_dir, + enable=["senter"], + config={"nlp": {"disabled": ["senter", "tagger"]}}, + ) + + +def test_load_disable_enable(): + """Tests spacy.load() with dis-/enabling components.""" + + base_nlp = English() + for pipe in ("sentencizer", "tagger", "parser"): + base_nlp.add_pipe(pipe) + + with make_tempdir() as tmp_dir: + base_nlp.to_disk(tmp_dir) + to_disable = ["parser", "tagger"] + to_enable = ["tagger", "parser"] + single_str = "tagger" + + # Setting only `disable`. + nlp = spacy.load(tmp_dir, disable=to_disable) + assert all([comp_name in nlp.disabled for comp_name in to_disable]) + + # Setting only `enable`. + nlp = spacy.load(tmp_dir, enable=to_enable) + assert all( + [ + (comp_name in nlp.disabled) is (comp_name not in to_enable) + for comp_name in nlp.component_names + ] + ) + + # Loading with a string representing one component + nlp = spacy.load(tmp_dir, exclude=single_str) + assert single_str not in nlp.component_names + + nlp = spacy.load(tmp_dir, disable=single_str) + assert single_str in nlp.component_names + assert single_str not in nlp.pipe_names + assert nlp._disabled == {single_str} + assert nlp.disabled == [single_str] + + # Testing consistent enable/disable combination. + nlp = spacy.load( + tmp_dir, + enable=to_enable, + disable=[ + comp_name + for comp_name in nlp.component_names + if comp_name not in to_enable + ], + ) + assert all( + [ + (comp_name in nlp.disabled) is (comp_name not in to_enable) + for comp_name in nlp.component_names + ] + ) + + # Inconsistent enable/disable combination. + with pytest.raises(ValueError): + spacy.load(tmp_dir, enable=to_enable, disable=["parser"]) diff --git a/TTS/Kokoro/.venv/Lib/site-packages/spacy/tests/pipeline/test_sentencizer.py b/TTS/Kokoro/.venv/Lib/site-packages/spacy/tests/pipeline/test_sentencizer.py new file mode 100644 index 0000000000000000000000000000000000000000..33461a011e221079ed28ea93368233a97b608fff --- /dev/null +++ b/TTS/Kokoro/.venv/Lib/site-packages/spacy/tests/pipeline/test_sentencizer.py @@ -0,0 +1,153 @@ +import pytest + +import spacy +from spacy.lang.en import English +from spacy.pipeline import Sentencizer +from spacy.tokens import Doc + + +def test_sentencizer(en_vocab): + doc = Doc(en_vocab, words=["Hello", "!", "This", "is", "a", "test", "."]) + sentencizer = Sentencizer(punct_chars=None) + doc = sentencizer(doc) + assert doc.has_annotation("SENT_START") + sent_starts = [t.is_sent_start for t in doc] + sent_ends = [t.is_sent_end for t in doc] + assert sent_starts == [True, False, True, False, False, False, False] + assert sent_ends == [False, True, False, False, False, False, True] + assert len(list(doc.sents)) == 2 + + +def test_sentencizer_pipe(): + texts = ["Hello! This is a test.", "Hi! This is a test."] + nlp = English() + nlp.add_pipe("sentencizer") + for doc in nlp.pipe(texts): + assert doc.has_annotation("SENT_START") + sent_starts = [t.is_sent_start for t in doc] + assert sent_starts == [True, False, True, False, False, False, False] + assert len(list(doc.sents)) == 2 + for ex in nlp.pipe(texts): + doc = ex.doc + assert doc.has_annotation("SENT_START") + sent_starts = [t.is_sent_start for t in doc] + assert sent_starts == [True, False, True, False, False, False, False] + assert len(list(doc.sents)) == 2 + + +def test_sentencizer_empty_docs(): + one_empty_text = [""] + many_empty_texts = ["", "", ""] + some_empty_texts = ["hi", "", "This is a test. Here are two sentences.", ""] + nlp = English() + nlp.add_pipe("sentencizer") + for texts in [one_empty_text, many_empty_texts, some_empty_texts]: + for doc in nlp.pipe(texts): + assert doc.has_annotation("SENT_START") + sent_starts = [t.is_sent_start for t in doc] + if len(doc) == 0: + assert sent_starts == [] + else: + assert len(sent_starts) > 0 + + +@pytest.mark.parametrize( + "words,sent_starts,sent_ends,n_sents", + [ + # The expected result here is that the duplicate punctuation gets merged + # onto the same sentence and no one-token sentence is created for them. + ( + ["Hello", "!", ".", "Test", ".", ".", "ok"], + [True, False, False, True, False, False, True], + [False, False, True, False, False, True, True], + 3, + ), + # We also want to make sure ¡ and ¿ aren't treated as sentence end + # markers, even though they're punctuation + ( + ["¡", "Buen", "día", "!", "Hola", ",", "¿", "qué", "tal", "?"], + [True, False, False, False, True, False, False, False, False, False], + [False, False, False, True, False, False, False, False, False, True], + 2, + ), + # The Token.is_punct check ensures that quotes are handled as well + ( + ['"', "Nice", "!", '"', "I", "am", "happy", "."], + [True, False, False, False, True, False, False, False], + [False, False, False, True, False, False, False, True], + 2, + ), + ], +) +def test_sentencizer_complex(en_vocab, words, sent_starts, sent_ends, n_sents): + doc = Doc(en_vocab, words=words) + sentencizer = Sentencizer(punct_chars=None) + doc = sentencizer(doc) + assert doc.has_annotation("SENT_START") + assert [t.is_sent_start for t in doc] == sent_starts + assert [t.is_sent_end for t in doc] == sent_ends + assert len(list(doc.sents)) == n_sents + + +@pytest.mark.parametrize( + "punct_chars,words,sent_starts,sent_ends,n_sents", + [ + ( + ["~", "?"], + ["Hello", "world", "~", "A", ".", "B", "."], + [True, False, False, True, False, False, False], + [False, False, True, False, False, False, True], + 2, + ), + # Even thought it's not common, the punct_chars should be able to + # handle any tokens + ( + [".", "ö"], + ["Hello", ".", "Test", "ö", "Ok", "."], + [True, False, True, False, True, False], + [False, True, False, True, False, True], + 3, + ), + ], +) +def test_sentencizer_custom_punct( + en_vocab, punct_chars, words, sent_starts, sent_ends, n_sents +): + doc = Doc(en_vocab, words=words) + sentencizer = Sentencizer(punct_chars=punct_chars) + doc = sentencizer(doc) + assert doc.has_annotation("SENT_START") + assert [t.is_sent_start for t in doc] == sent_starts + assert [t.is_sent_end for t in doc] == sent_ends + assert len(list(doc.sents)) == n_sents + + +def test_sentencizer_serialize_bytes(en_vocab): + punct_chars = [".", "~", "+"] + sentencizer = Sentencizer(punct_chars=punct_chars) + assert sentencizer.punct_chars == set(punct_chars) + bytes_data = sentencizer.to_bytes() + new_sentencizer = Sentencizer(punct_chars=None).from_bytes(bytes_data) + assert new_sentencizer.punct_chars == set(punct_chars) + + +@pytest.mark.parametrize( + # fmt: off + "lang,text", + [ + ('bn', 'বাংলা ভাষা (বাঙলা, বাঙ্গলা, তথা বাঙ্গালা নামগুলোতেও পরিচিত) একটি ইন্দো-আর্য ভাষা, যা দক্ষিণ এশিয়ার বাঙালি জাতির প্রধান কথ্য ও লেখ্য ভাষা। মাতৃভাষীর সংখ্যায় বাংলা ইন্দো-ইউরোপীয় ভাষা পরিবারের চতুর্থ ও বিশ্বের ষষ্ঠ বৃহত্তম ভাষা।[৫] মোট ব্যবহারকারীর সংখ্যা অনুসারে বাংলা বিশ্বের সপ্তম বৃহত্তম ভাষা। বাংলা সার্বভৌম ভাষাভিত্তিক জাতিরাষ্ট্র বাংলাদেশের একমাত্র রাষ্ট্রভাষা তথা সরকারি ভাষা[৬] এবং ভারতের পশ্চিমবঙ্গ, ত্রিপুরা, আসামের বরাক উপত্যকার সরকারি ভাষা। বঙ্গোপসাগরে অবস্থিত আন্দামান দ্বীপপুঞ্জের প্রধান কথ্য ভাষা বাংলা। এছাড়া ভারতের ঝাড়খণ্ড, বিহার, মেঘালয়, মিজোরাম, উড়িষ্যা রাজ্যগুলোতে উল্লেখযোগ্য পরিমাণে বাংলাভাষী জনগণ রয়েছে। ভারতে হিন্দির পরেই সর্বাধিক প্রচলিত ভাষা বাংলা।[৭][৮] এছাড়াও মধ্য প্রাচ্য, আমেরিকা ও ইউরোপে উল্লেখযোগ্য পরিমাণে বাংলাভাষী অভিবাসী রয়েছে।[৯] সারা বিশ্বে সব মিলিয়ে ২৬ কোটির অধিক লোক দৈনন্দিন জীবনে বাংলা ব্যবহার করে।[২] বাংলাদেশের জাতীয় সঙ্গীত এবং ভারতের জাতীয় সঙ্গীত ও স্তোত্র বাংলাতে রচিত।'), + ('de', 'Die deutsche Sprache bzw. Deutsch ([dɔʏ̯t͡ʃ]; abgekürzt dt. oder dtsch.) ist eine westgermanische Sprache. Ihr Sprachraum umfasst Deutschland, Österreich, die Deutschschweiz, Liechtenstein, Luxemburg, Ostbelgien, Südtirol, das Elsass und Lothringen sowie Nordschleswig. Außerdem ist sie eine Minderheitensprache in einigen europäischen und außereuropäischen Ländern, z. B. in Rumänien und Südafrika, sowie Nationalsprache im afrikanischen Namibia.'), + ('hi', 'हिन्दी विश्व की एक प्रमुख भाषा है एवं भारत की राजभाषा है। केन्द्रीय स्तर पर भारत में दूसरी आधिकारिक भाषा अंग्रेजी है। यह हिंदुस्तानी भाषा की एक मानकीकृत रूप है जिसमें संस्कृत के तत्सम तथा तद्भव शब्दों का प्रयोग अधिक है और अरबी-फ़ारसी शब्द कम हैं। हिंदी संवैधानिक रूप से भारत की राजभाषा और भारत की सबसे अधिक बोली और समझी जाने वाली भाषा है। हालाँकि, हिन्दी भारत की राष्ट्रभाषा नहीं है,[3] क्योंकि भारत के संविधान में कोई भी भाषा को ऐसा दर्जा नहीं दिया गया था।[4][5] चीनी के बाद यह विश्व में सबसे अधिक बोली जाने वाली भाषा भी है। विश्व आर्थिक मंच की गणना के अनुसार यह विश्व की दस शक्तिशाली भाषाओं में से एक है।[6]'), + ('kn', 'ದ್ರಾವಿಡ ಭಾಷೆಗಳಲ್ಲಿ ಪ್ರಾಮುಖ್ಯವುಳ್ಳ ಭಾಷೆಯೂ ಭಾರತದ ಪುರಾತನವಾದ ಭಾಷೆಗಳಲ್ಲಿ ಒಂದೂ ಆಗಿರುವ ಕನ್ನಡ ಭಾಷೆಯನ್ನು ಅದರ ವಿವಿಧ ರೂಪಗಳಲ್ಲಿ ಸುಮಾರು ೪೫ ದಶಲಕ್ಷ ಜನರು ಆಡು ನುಡಿಯಾಗಿ ಬಳಸುತ್ತಲಿದ್ದಾರೆ. ಕನ್ನಡ ಕರ್ನಾಟಕ ರಾಜ್ಯದ ಆಡಳಿತ ಭಾಷೆ.[೧೧] ಜಗತ್ತಿನಲ್ಲಿ ಅತ್ಯಂತ ಹೆಚ್ಚು ಮಂದಿ ಮಾತನಾಡುವ ಭಾಷೆಯೆಂಬ ನೆಲೆಯಲ್ಲಿ ಇಪ್ಪತೊಂಬತ್ತನೆಯ ಸ್ಥಾನ ಕನ್ನಡಕ್ಕಿದೆ. ೨೦೧೧ರ ಜನಗಣತಿಯ ಪ್ರಕಾರ ಜಗತ್ತಿನಲ್ಲಿ ೬.೪ ಕೋಟಿ ಜನಗಳು ಕನ್ನಡ ಮಾತನಾಡುತ್ತಾರೆ ಎಂದು ತಿಳಿದುಬಂದಿದೆ. ಇವರಲ್ಲಿ ೫.೫ ಕೋಟಿ ಜನಗಳ ಮಾತೃಭಾಷೆ ಕನ್ನಡವಾಗಿದೆ. ಬ್ರಾಹ್ಮಿ ಲಿಪಿಯಿಂದ ರೂಪುಗೊಂಡ ಕನ್ನಡ ಲಿಪಿಯನ್ನು ಉಪಯೋಗಿಸಿ ಕನ್ನಡ ಭಾಷೆಯನ್ನು ಬರೆಯಲಾಗುತ್ತದೆ. ಕನ್ನಡ ಬರಹದ ಮಾದರಿಗಳಿಗೆ ಸಾವಿರದ ಐನೂರು ವರುಷಗಳ ಚರಿತ್ರೆಯಿದೆ. ಕ್ರಿ.ಶ. ಆರನೆಯ ಶತಮಾನದ ಪಶ್ಚಿಮ ಗಂಗ ಸಾಮ್ರಾಜ್ಯದ ಕಾಲದಲ್ಲಿ [೧೨] ಮತ್ತು ಒಂಬತ್ತನೆಯ ಶತಮಾನದ ರಾಷ್ಟ್ರಕೂಟ ಸಾಮ್ರಾಜ್ಯದ ಕಾಲದಲ್ಲಿ ಹಳಗನ್ನಡ ಸಾಹಿತ್ಯ ಅತ್ಯಂತ ಹೆಚ್ಚಿನ ರಾಜಾಶ್ರಯ ಪಡೆಯಿತು.[೧೩][೧೪] ಅದಲ್ಲದೆ ಸಾವಿರ ವರುಷಗಳ ಸಾಹಿತ್ಯ ಪರಂಪರೆ ಕನ್ನಡಕ್ಕಿದೆ.[೧೫]ವಿನೋಬಾ ಭಾವೆ ಕನ್ನಡ ಲಿಪಿಯನ್ನು ಲಿಪಿಗಳ ರಾಣಿಯೆಂದು ಹೊಗಳಿದ್ದಾರೆ.[ಸೂಕ್ತ ಉಲ್ಲೇಖನ ಬೇಕು]'), + ('si', 'ශ්‍රී ලංකාවේ ප්‍රධාන ජාතිය වන සිංහල ජනයාගේ මව් බස සිංහල වෙයි. අද වන විට මිලියන 20 කට අධික සිංහල සහ මිලියන 3කට අධික සිංහල නොවන ජනගහනයක් සිංහල භාෂාව භාවිත කරති. සිංහල‍ ඉන්දු-යුරෝපීය භාෂාවල උප ගණයක් වන ඉන්දු-ආර්ය භාෂා ගණයට අයිති වන අතර මාල දිවයින භාවිත කරන දිවෙහි භාෂාව සිංහලයෙන් පැවත එන්නකි. සිංහල ශ්‍රී ලංකාවේ නිල භාෂාවයි .'), + ('ta', 'தமிழ் மொழி (Tamil language) தமிழர்களினதும், தமிழ் பேசும் பலரதும் தாய்மொழி ஆகும். தமிழ் திராவிட மொழிக் குடும்பத்தின் முதன்மையான மொழிகளில் ஒன்றும் செம்மொழியும் ஆகும். இந்தியா, இலங்கை, மலேசியா, சிங்கப்பூர் ஆகிய நாடுகளில் அதிக அளவிலும், ஐக்கிய அரபு அமீரகம், தென்னாப்பிரிக்கா, மொரிசியசு, பிஜி, ரீயூனியன், டிரினிடாட் போன்ற நாடுகளில் சிறிய அளவிலும் தமிழ் பேசப்படுகிறது. 1997ஆம் ஆண்டுப் புள்ளி விவரப்படி உலகம் முழுவதிலும் 8 கோடி (80 மில்லியன்) மக்களால் பேசப்படும் தமிழ்[13], ஒரு மொழியைத் தாய்மொழியாகக் கொண்டு பேசும் மக்களின் எண்ணிக்கை அடிப்படையில் பதினெட்டாவது இடத்தில் உள்ளது.[14] இணையத்தில் அதிகம் பயன்படுத்தப்படும் இந்திய மொழிகளில் தமிழ் முதன்மையாக உள்ளதாக 2017 ஆவது ஆண்டில் நடைபெற்ற கூகுள் கணக்கெடுப்பில் தெரிய வந்தது.[15]'), + ('te', 'ఆంధ్ర ప్రదేశ్, తెలంగాణ రాష్ట్రాల అధికార భాష తెలుగు. భారత దేశంలో తెలుగు మాతృభాషగా మాట్లాడే 8.7 కోట్ల (2001) జనాభాతో [1] ప్రాంతీయ భాషలలో మొదటి స్థానంలో ఉంది. ప్రపంచంలోని ప్రజలు అత్యధికముగా మాట్లాడే భాషలలో 15 స్థానములోనూ, భారత దేశములో హిందీ, తర్వాత స్థానములోనూ నిలుస్తుంది. పాతవైన ప్రపంచ భాష గణాంకాల (ఎథ్నోలాగ్) ప్రకారం ప్రపంచవ్యాప్తంగా 7.4 కోట్లు మందికి మాతృభాషగా ఉంది.[2] మొదటి భాషగా మాట్లాడతారు. అతి ప్రాచీన దేశ భాషలలో సంస్కృతము తమిళముతో బాటు తెలుగు భాషను 2008 అక్టోబరు 31న భారత ప్రభుత్వము గుర్తించింది.'), + ('ur', 'اُردُو لشکری زبان[8] (یا جدید معیاری اردو) برصغیر کی معیاری زبانوں میں سے ایک ہے۔ یہ پاکستان کی قومی اور رابطہ عامہ کی زبان ہے، جبکہ بھارت کی چھے ریاستوں کی دفتری زبان کا درجہ رکھتی ہے۔ آئین ہند کے مطابق اسے 22 دفتری شناخت زبانوں میں شامل کیا جاچکا ہے۔ 2001ء کی مردم شماری کے مطابق اردو کو بطور مادری زبان بھارت میں 5.01% فیصد لوگ بولتے ہیں اور اس لحاظ سے یہ بھارت کی چھٹی بڑی زبان ہے جبکہ پاکستان میں اسے بطور مادری زبان 7.59% فیصد لوگ استعمال کرتے ہیں، یہ پاکستان کی پانچویں بڑی زبان ہے۔ اردو تاریخی طور پر ہندوستان کی مسلم آبادی سے جڑی ہے۔[حوالہ درکار] بعض ذخیرہ الفاظ کے علاوہ یہ زبان معیاری ہندی سے قابل فہم ہے جو اس خطے کی ہندوؤں سے منسوب ہے۔[حوالہ درکار] زبانِ اردو کو پہچان و ترقی اس وقت ملی جب برطانوی دور میں انگریز حکمرانوں نے اسے فارسی کی بجائے انگریزی کے ساتھ شمالی ہندوستان کے علاقوں اور جموں و کشمیر میں اسے سنہ 1846ء اور پنجاب میں سنہ 1849ء میں بطور دفتری زبان نافذ کیا۔ اس کے علاوہ خلیجی، یورپی، ایشیائی اور امریکی علاقوں میں اردو بولنے والوں کی ایک بڑی تعداد آباد ہے جو بنیادی طور پر جنوبی ایشیاء سے کوچ کرنے والے اہلِ اردو ہیں۔ 1999ء کے اعداد وشمار کے مطابق اردو زبان کے مجموعی متکلمین کی تعداد دس کروڑ ساٹھ لاکھ کے لگ بھگ تھی۔ اس لحاظ سے یہ دنیا کی نویں بڑی زبان ہے۔'), + ], + # fmt: on +) +def test_sentencizer_across_scripts(lang, text): + nlp = spacy.blank(lang) + nlp.add_pipe("sentencizer") + doc = nlp(text) + assert len(list(doc.sents)) > 1 diff --git a/TTS/Kokoro/.venv/Lib/site-packages/spacy/tests/pipeline/test_senter.py b/TTS/Kokoro/.venv/Lib/site-packages/spacy/tests/pipeline/test_senter.py new file mode 100644 index 0000000000000000000000000000000000000000..3d0c49370dfa533ec629691a5912a6c4de555ae1 --- /dev/null +++ b/TTS/Kokoro/.venv/Lib/site-packages/spacy/tests/pipeline/test_senter.py @@ -0,0 +1,103 @@ +import pytest +from numpy.testing import assert_equal + +from spacy import util +from spacy.attrs import SENT_START +from spacy.lang.en import English +from spacy.language import Language +from spacy.tests.util import make_tempdir +from spacy.training import Example + + +def test_label_types(): + nlp = Language() + senter = nlp.add_pipe("senter") + with pytest.raises(NotImplementedError): + senter.add_label("A") + + +SENT_STARTS = [0] * 14 +SENT_STARTS[0] = 1 +SENT_STARTS[5] = 1 +SENT_STARTS[9] = 1 + +TRAIN_DATA = [ + ( + "I like green eggs. Eat blue ham. I like purple eggs.", + {"sent_starts": SENT_STARTS}, + ), + ( + "She likes purple eggs. They hate ham. You like yellow eggs.", + {"sent_starts": SENT_STARTS}, + ), +] + + +def test_initialize_examples(): + nlp = Language() + nlp.add_pipe("senter") + train_examples = [] + for t in TRAIN_DATA: + train_examples.append(Example.from_dict(nlp.make_doc(t[0]), t[1])) + # you shouldn't really call this more than once, but for testing it should be fine + nlp.initialize() + nlp.initialize(get_examples=lambda: train_examples) + with pytest.raises(TypeError): + nlp.initialize(get_examples=lambda: None) + with pytest.raises(TypeError): + nlp.initialize(get_examples=train_examples) + + +def test_overfitting_IO(): + # Simple test to try and quickly overfit the senter - ensuring the ML models work correctly + nlp = English() + train_examples = [] + for t in TRAIN_DATA: + train_examples.append(Example.from_dict(nlp.make_doc(t[0]), t[1])) + # add some cases where SENT_START == -1 + train_examples[0].reference[10].is_sent_start = False + train_examples[1].reference[1].is_sent_start = False + train_examples[1].reference[11].is_sent_start = False + + nlp.add_pipe("senter") + optimizer = nlp.initialize() + + for i in range(200): + losses = {} + nlp.update(train_examples, sgd=optimizer, losses=losses) + assert losses["senter"] < 0.001 + + # test the trained model + test_text = TRAIN_DATA[0][0] + doc = nlp(test_text) + gold_sent_starts = [0] * 14 + gold_sent_starts[0] = 1 + gold_sent_starts[5] = 1 + gold_sent_starts[9] = 1 + assert [int(t.is_sent_start) for t in doc] == gold_sent_starts + + # Also test the results are still the same after IO + with make_tempdir() as tmp_dir: + nlp.to_disk(tmp_dir) + nlp2 = util.load_model_from_path(tmp_dir) + doc2 = nlp2(test_text) + assert [int(t.is_sent_start) for t in doc2] == gold_sent_starts + + # Make sure that running pipe twice, or comparing to call, always amounts to the same predictions + texts = [ + "Just a sentence.", + "Then one more sentence about London.", + "Here is another one.", + "I like London.", + ] + batch_deps_1 = [doc.to_array([SENT_START]) for doc in nlp.pipe(texts)] + batch_deps_2 = [doc.to_array([SENT_START]) for doc in nlp.pipe(texts)] + no_batch_deps = [ + doc.to_array([SENT_START]) for doc in [nlp(text) for text in texts] + ] + assert_equal(batch_deps_1, batch_deps_2) + assert_equal(batch_deps_1, no_batch_deps) + + # test internal pipe labels vs. Language.pipe_labels with hidden labels + assert nlp.get_pipe("senter").labels == ("I", "S") + assert "senter" not in nlp.pipe_labels diff --git a/TTS/Kokoro/.venv/Lib/site-packages/spacy/tests/pipeline/test_span_finder.py b/TTS/Kokoro/.venv/Lib/site-packages/spacy/tests/pipeline/test_span_finder.py new file mode 100644 index 0000000000000000000000000000000000000000..18a4d61a6a0f91bfb15d3ca1969b08c7c4bb03b8 --- /dev/null +++ b/TTS/Kokoro/.venv/Lib/site-packages/spacy/tests/pipeline/test_span_finder.py @@ -0,0 +1,240 @@ +import pytest +from thinc.api import Config + +from spacy import util +from spacy.lang.en import English +from spacy.language import Language +from spacy.pipeline.span_finder import span_finder_default_config +from spacy.tokens import Doc +from spacy.training import Example +from spacy.util import fix_random_seed, make_tempdir, registry + +SPANS_KEY = "pytest" +TRAIN_DATA = [ + ("Who is Shaka Khan?", {"spans": {SPANS_KEY: [(7, 17)]}}), + ( + "I like London and Berlin.", + {"spans": {SPANS_KEY: [(7, 13), (18, 24)]}}, + ), +] + +TRAIN_DATA_OVERLAPPING = [ + ("Who is Shaka Khan?", {"spans": {SPANS_KEY: [(7, 17)]}}), + ( + "I like London and Berlin", + {"spans": {SPANS_KEY: [(7, 13), (18, 24), (7, 24)]}}, + ), + ("", {"spans": {SPANS_KEY: []}}), +] + + +def make_examples(nlp, data=TRAIN_DATA): + train_examples = [] + for t in data: + eg = Example.from_dict(nlp.make_doc(t[0]), t[1]) + train_examples.append(eg) + return train_examples + + +@pytest.mark.parametrize( + "tokens_predicted, tokens_reference, reference_truths", + [ + ( + ["Mon", ".", "-", "June", "16"], + ["Mon.", "-", "June", "16"], + [(0, 0), (0, 0), (0, 0), (1, 1), (0, 0)], + ), + ( + ["Mon.", "-", "J", "une", "16"], + ["Mon.", "-", "June", "16"], + [(0, 0), (0, 0), (1, 0), (0, 1), (0, 0)], + ), + ( + ["Mon", ".", "-", "June", "16"], + ["Mon.", "-", "June", "1", "6"], + [(0, 0), (0, 0), (0, 0), (1, 1), (0, 0)], + ), + ( + ["Mon.", "-J", "un", "e 16"], + ["Mon.", "-", "June", "16"], + [(0, 0), (0, 0), (0, 0), (0, 0)], + ), + pytest.param( + ["Mon.-June", "16"], + ["Mon.", "-", "June", "16"], + [(0, 1), (0, 0)], + ), + pytest.param( + ["Mon.-", "June", "16"], + ["Mon.", "-", "J", "une", "16"], + [(0, 0), (1, 1), (0, 0)], + ), + pytest.param( + ["Mon.-", "June 16"], + ["Mon.", "-", "June", "16"], + [(0, 0), (1, 0)], + ), + ], +) +def test_loss_alignment_example(tokens_predicted, tokens_reference, reference_truths): + nlp = Language() + predicted = Doc( + nlp.vocab, words=tokens_predicted, spaces=[False] * len(tokens_predicted) + ) + reference = Doc( + nlp.vocab, words=tokens_reference, spaces=[False] * len(tokens_reference) + ) + example = Example(predicted, reference) + example.reference.spans[SPANS_KEY] = [example.reference.char_span(5, 9)] + span_finder = nlp.add_pipe("span_finder", config={"spans_key": SPANS_KEY}) + nlp.initialize() + ops = span_finder.model.ops + if predicted.text != reference.text: + with pytest.raises( + ValueError, match="must match between reference and predicted" + ): + span_finder._get_aligned_truth_scores([example], ops) + return + truth_scores, masks = span_finder._get_aligned_truth_scores([example], ops) + assert len(truth_scores) == len(tokens_predicted) + ops.xp.testing.assert_array_equal(truth_scores, ops.xp.asarray(reference_truths)) + + +def test_span_finder_model(): + nlp = Language() + + docs = [nlp("This is an example."), nlp("This is the second example.")] + docs[0].spans[SPANS_KEY] = [docs[0][3:4]] + docs[1].spans[SPANS_KEY] = [docs[1][3:5]] + + total_tokens = 0 + for doc in docs: + total_tokens += len(doc) + + config = Config().from_str(span_finder_default_config).interpolate() + model = registry.resolve(config)["model"] + + model.initialize(X=docs) + predictions = model.predict(docs) + + assert len(predictions) == total_tokens + assert len(predictions[0]) == 2 + + +def test_span_finder_component(): + nlp = Language() + + docs = [nlp("This is an example."), nlp("This is the second example.")] + docs[0].spans[SPANS_KEY] = [docs[0][3:4]] + docs[1].spans[SPANS_KEY] = [docs[1][3:5]] + + span_finder = nlp.add_pipe("span_finder", config={"spans_key": SPANS_KEY}) + nlp.initialize() + docs = list(span_finder.pipe(docs)) + + assert SPANS_KEY in docs[0].spans + + +@pytest.mark.parametrize( + "min_length, max_length, span_count", + [(0, 0, 0), (None, None, 8), (2, None, 6), (None, 1, 2), (2, 3, 2)], +) +def test_set_annotations_span_lengths(min_length, max_length, span_count): + nlp = Language() + doc = nlp("Me and Jenny goes together like peas and carrots.") + if min_length == 0 and max_length == 0: + with pytest.raises(ValueError, match="Both 'min_length' and 'max_length'"): + span_finder = nlp.add_pipe( + "span_finder", + config={ + "max_length": max_length, + "min_length": min_length, + "spans_key": SPANS_KEY, + }, + ) + return + span_finder = nlp.add_pipe( + "span_finder", + config={ + "max_length": max_length, + "min_length": min_length, + "spans_key": SPANS_KEY, + }, + ) + nlp.initialize() + # Starts [Me, Jenny, peas] + # Ends [Jenny, peas, carrots] + scores = [ + (1, 0), + (0, 0), + (1, 1), + (0, 0), + (0, 0), + (0, 0), + (1, 1), + (0, 0), + (0, 1), + (0, 0), + ] + span_finder.set_annotations([doc], scores) + + assert doc.spans[SPANS_KEY] + assert len(doc.spans[SPANS_KEY]) == span_count + + # Assert below will fail when max_length is set to 0 + if max_length is None: + max_length = float("inf") + if min_length is None: + min_length = 1 + + assert all(min_length <= len(span) <= max_length for span in doc.spans[SPANS_KEY]) + + +def test_overfitting_IO(): + # Simple test to try and quickly overfit the span_finder component - ensuring the ML models work correctly + fix_random_seed(0) + nlp = English() + span_finder = nlp.add_pipe("span_finder", config={"spans_key": SPANS_KEY}) + train_examples = make_examples(nlp) + optimizer = nlp.initialize(get_examples=lambda: train_examples) + assert span_finder.model.get_dim("nO") == 2 + + for i in range(50): + losses = {} + nlp.update(train_examples, sgd=optimizer, losses=losses) + assert losses["span_finder"] < 0.001 + + # test the trained model + test_text = "I like London and Berlin" + doc = nlp(test_text) + spans = doc.spans[SPANS_KEY] + assert len(spans) == 3 + assert set([span.text for span in spans]) == { + "London", + "Berlin", + "London and Berlin", + } + + # Also test the results are still the same after IO + with make_tempdir() as tmp_dir: + nlp.to_disk(tmp_dir) + nlp2 = util.load_model_from_path(tmp_dir) + doc2 = nlp2(test_text) + spans2 = doc2.spans[SPANS_KEY] + assert len(spans2) == 3 + assert set([span.text for span in spans2]) == { + "London", + "Berlin", + "London and Berlin", + } + + # Test scoring + scores = nlp.evaluate(train_examples) + assert f"spans_{SPANS_KEY}_f" in scores + # It's not perfect 1.0 F1 because it's designed to overgenerate for now. + assert scores[f"spans_{SPANS_KEY}_p"] == 0.75 + assert scores[f"spans_{SPANS_KEY}_r"] == 1.0 + + # also test that the spancat works for just a single entity in a sentence + doc = nlp("London") + assert len(doc.spans[SPANS_KEY]) == 1 diff --git a/TTS/Kokoro/.venv/Lib/site-packages/spacy/tests/pipeline/test_span_ruler.py b/TTS/Kokoro/.venv/Lib/site-packages/spacy/tests/pipeline/test_span_ruler.py new file mode 100644 index 0000000000000000000000000000000000000000..3c1cc0454b32eaef53ee2c5bb04e48e24eb5c005 --- /dev/null +++ b/TTS/Kokoro/.venv/Lib/site-packages/spacy/tests/pipeline/test_span_ruler.py @@ -0,0 +1,464 @@ +import pytest +from thinc.api import NumpyOps, get_current_ops + +import spacy +from spacy import registry +from spacy.errors import MatchPatternError +from spacy.tests.util import make_tempdir +from spacy.tokens import Span +from spacy.training import Example + + +@pytest.fixture +@registry.misc("span_ruler_patterns") +def patterns(): + return [ + {"label": "HELLO", "pattern": "hello world", "id": "hello1"}, + {"label": "BYE", "pattern": [{"LOWER": "bye"}, {"LOWER": "bye"}]}, + {"label": "HELLO", "pattern": [{"ORTH": "HELLO"}], "id": "hello2"}, + {"label": "COMPLEX", "pattern": [{"ORTH": "foo", "OP": "*"}]}, + {"label": "TECH_ORG", "pattern": "Apple"}, + {"label": "TECH_ORG", "pattern": "Microsoft"}, + ] + + +@pytest.fixture +def overlapping_patterns(): + return [ + {"label": "FOOBAR", "pattern": "foo bar"}, + {"label": "BARBAZ", "pattern": "bar baz"}, + ] + + +@pytest.fixture +def person_org_patterns(): + return [ + {"label": "PERSON", "pattern": "Dina"}, + {"label": "ORG", "pattern": "ACME"}, + {"label": "ORG", "pattern": "ACM"}, + ] + + +@pytest.fixture +def person_org_date_patterns(person_org_patterns): + return person_org_patterns + [{"label": "DATE", "pattern": "June 14th"}] + + +def test_span_ruler_add_empty(patterns): + """Test that patterns don't get added excessively.""" + nlp = spacy.blank("xx") + ruler = nlp.add_pipe("span_ruler", config={"validate": True}) + ruler.add_patterns(patterns) + pattern_count = sum(len(mm) for mm in ruler.matcher._patterns.values()) + assert pattern_count > 0 + ruler.add_patterns([]) + after_count = sum(len(mm) for mm in ruler.matcher._patterns.values()) + assert after_count == pattern_count + + +def test_span_ruler_init(patterns): + nlp = spacy.blank("xx") + ruler = nlp.add_pipe("span_ruler") + ruler.add_patterns(patterns) + assert len(ruler) == len(patterns) + assert len(ruler.labels) == 4 + assert "HELLO" in ruler + assert "BYE" in ruler + doc = nlp("hello world bye bye") + assert len(doc.spans["ruler"]) == 2 + assert doc.spans["ruler"][0].label_ == "HELLO" + assert doc.spans["ruler"][0].id_ == "hello1" + assert doc.spans["ruler"][1].label_ == "BYE" + assert doc.spans["ruler"][1].id_ == "" + + +def test_span_ruler_no_patterns_warns(): + nlp = spacy.blank("xx") + ruler = nlp.add_pipe("span_ruler") + assert len(ruler) == 0 + assert len(ruler.labels) == 0 + assert nlp.pipe_names == ["span_ruler"] + with pytest.warns(UserWarning): + doc = nlp("hello world bye bye") + assert len(doc.spans["ruler"]) == 0 + + +def test_span_ruler_init_patterns(patterns): + # initialize with patterns + nlp = spacy.blank("xx") + ruler = nlp.add_pipe("span_ruler") + assert len(ruler.labels) == 0 + ruler.initialize(lambda: [], patterns=patterns) + assert len(ruler.labels) == 4 + doc = nlp("hello world bye bye") + assert doc.spans["ruler"][0].label_ == "HELLO" + assert doc.spans["ruler"][1].label_ == "BYE" + nlp.remove_pipe("span_ruler") + # initialize with patterns from misc registry + nlp.config["initialize"]["components"]["span_ruler"] = { + "patterns": {"@misc": "span_ruler_patterns"} + } + ruler = nlp.add_pipe("span_ruler") + assert len(ruler.labels) == 0 + nlp.initialize() + assert len(ruler.labels) == 4 + doc = nlp("hello world bye bye") + assert doc.spans["ruler"][0].label_ == "HELLO" + assert doc.spans["ruler"][1].label_ == "BYE" + + +def test_span_ruler_init_clear(patterns): + """Test that initialization clears patterns.""" + nlp = spacy.blank("xx") + ruler = nlp.add_pipe("span_ruler") + ruler.add_patterns(patterns) + assert len(ruler.labels) == 4 + ruler.initialize(lambda: []) + assert len(ruler.labels) == 0 + + +def test_span_ruler_clear(patterns): + nlp = spacy.blank("xx") + ruler = nlp.add_pipe("span_ruler") + ruler.add_patterns(patterns) + assert len(ruler.labels) == 4 + doc = nlp("hello world") + assert len(doc.spans["ruler"]) == 1 + ruler.clear() + assert len(ruler.labels) == 0 + with pytest.warns(UserWarning): + doc = nlp("hello world") + assert len(doc.spans["ruler"]) == 0 + + +def test_span_ruler_existing(patterns): + nlp = spacy.blank("xx") + ruler = nlp.add_pipe("span_ruler", config={"overwrite": False}) + ruler.add_patterns(patterns) + doc = nlp.make_doc("OH HELLO WORLD bye bye") + doc.spans["ruler"] = [doc[0:2]] + doc = nlp(doc) + assert len(doc.spans["ruler"]) == 3 + assert doc.spans["ruler"][0] == doc[0:2] + assert doc.spans["ruler"][1].label_ == "HELLO" + assert doc.spans["ruler"][1].id_ == "hello2" + assert doc.spans["ruler"][2].label_ == "BYE" + assert doc.spans["ruler"][2].id_ == "" + + +def test_span_ruler_existing_overwrite(patterns): + nlp = spacy.blank("xx") + ruler = nlp.add_pipe("span_ruler", config={"overwrite": True}) + ruler.add_patterns(patterns) + doc = nlp.make_doc("OH HELLO WORLD bye bye") + doc.spans["ruler"] = [doc[0:2]] + doc = nlp(doc) + assert len(doc.spans["ruler"]) == 2 + assert doc.spans["ruler"][0].label_ == "HELLO" + assert doc.spans["ruler"][0].text == "HELLO" + assert doc.spans["ruler"][1].label_ == "BYE" + + +def test_span_ruler_serialize_bytes(patterns): + nlp = spacy.blank("xx") + ruler = nlp.add_pipe("span_ruler") + ruler.add_patterns(patterns) + assert len(ruler) == len(patterns) + assert len(ruler.labels) == 4 + ruler_bytes = ruler.to_bytes() + new_nlp = spacy.blank("xx") + new_ruler = new_nlp.add_pipe("span_ruler") + assert len(new_ruler) == 0 + assert len(new_ruler.labels) == 0 + new_ruler = new_ruler.from_bytes(ruler_bytes) + assert len(new_ruler) == len(patterns) + assert len(new_ruler.labels) == 4 + assert len(new_ruler.patterns) == len(ruler.patterns) + for pattern in ruler.patterns: + assert pattern in new_ruler.patterns + assert sorted(new_ruler.labels) == sorted(ruler.labels) + + +def test_span_ruler_validate(): + nlp = spacy.blank("xx") + ruler = nlp.add_pipe("span_ruler") + validated_ruler = nlp.add_pipe( + "span_ruler", name="validated_span_ruler", config={"validate": True} + ) + + valid_pattern = {"label": "HELLO", "pattern": [{"LOWER": "HELLO"}]} + invalid_pattern = {"label": "HELLO", "pattern": [{"ASDF": "HELLO"}]} + + # invalid pattern raises error without validate + with pytest.raises(ValueError): + ruler.add_patterns([invalid_pattern]) + + # valid pattern is added without errors with validate + validated_ruler.add_patterns([valid_pattern]) + + # invalid pattern raises error with validate + with pytest.raises(MatchPatternError): + validated_ruler.add_patterns([invalid_pattern]) + + +def test_span_ruler_properties(patterns): + nlp = spacy.blank("xx") + ruler = nlp.add_pipe("span_ruler", config={"overwrite": True}) + ruler.add_patterns(patterns) + assert sorted(ruler.labels) == sorted(set([p["label"] for p in patterns])) + + +def test_span_ruler_overlapping_spans(overlapping_patterns): + nlp = spacy.blank("xx") + ruler = nlp.add_pipe("span_ruler") + ruler.add_patterns(overlapping_patterns) + doc = ruler(nlp.make_doc("foo bar baz")) + assert len(doc.spans["ruler"]) == 2 + assert doc.spans["ruler"][0].label_ == "FOOBAR" + assert doc.spans["ruler"][1].label_ == "BARBAZ" + + +def test_span_ruler_scorer(overlapping_patterns): + nlp = spacy.blank("xx") + ruler = nlp.add_pipe("span_ruler") + ruler.add_patterns(overlapping_patterns) + text = "foo bar baz" + pred_doc = ruler(nlp.make_doc(text)) + assert len(pred_doc.spans["ruler"]) == 2 + assert pred_doc.spans["ruler"][0].label_ == "FOOBAR" + assert pred_doc.spans["ruler"][1].label_ == "BARBAZ" + + ref_doc = nlp.make_doc(text) + ref_doc.spans["ruler"] = [Span(ref_doc, 0, 2, label="FOOBAR")] + scores = nlp.evaluate([Example(pred_doc, ref_doc)]) + assert scores["spans_ruler_p"] == 0.5 + assert scores["spans_ruler_r"] == 1.0 + + +@pytest.mark.parametrize("n_process", [1, 2]) +def test_span_ruler_multiprocessing(n_process): + if isinstance(get_current_ops, NumpyOps) or n_process < 2: + texts = ["I enjoy eating Pizza Hut pizza."] + + patterns = [{"label": "FASTFOOD", "pattern": "Pizza Hut"}] + + nlp = spacy.blank("xx") + ruler = nlp.add_pipe("span_ruler") + ruler.add_patterns(patterns) + + for doc in nlp.pipe(texts, n_process=2): + for ent in doc.spans["ruler"]: + assert ent.label_ == "FASTFOOD" + + +def test_span_ruler_serialize_dir(patterns): + nlp = spacy.blank("xx") + ruler = nlp.add_pipe("span_ruler") + ruler.add_patterns(patterns) + with make_tempdir() as d: + ruler.to_disk(d / "test_ruler") + ruler.from_disk(d / "test_ruler") # read from an existing directory + with pytest.raises(ValueError): + ruler.from_disk(d / "non_existing_dir") # read from a bad directory + + +def test_span_ruler_remove_basic(person_org_patterns): + nlp = spacy.blank("xx") + ruler = nlp.add_pipe("span_ruler") + ruler.add_patterns(person_org_patterns) + doc = ruler(nlp.make_doc("Dina went to school")) + assert len(ruler.patterns) == 3 + assert len(doc.spans["ruler"]) == 1 + assert doc.spans["ruler"][0].label_ == "PERSON" + assert doc.spans["ruler"][0].text == "Dina" + ruler.remove("PERSON") + doc = ruler(nlp.make_doc("Dina went to school")) + assert len(doc.spans["ruler"]) == 0 + assert len(ruler.patterns) == 2 + + +def test_span_ruler_remove_nonexisting_pattern(person_org_patterns): + nlp = spacy.blank("xx") + ruler = nlp.add_pipe("span_ruler") + ruler.add_patterns(person_org_patterns) + assert len(ruler.patterns) == 3 + with pytest.raises(ValueError): + ruler.remove("NE") + with pytest.raises(ValueError): + ruler.remove_by_id("NE") + + +def test_span_ruler_remove_several_patterns(person_org_patterns): + nlp = spacy.blank("xx") + ruler = nlp.add_pipe("span_ruler") + ruler.add_patterns(person_org_patterns) + doc = ruler(nlp.make_doc("Dina founded the company ACME.")) + assert len(ruler.patterns) == 3 + assert len(doc.spans["ruler"]) == 2 + assert doc.spans["ruler"][0].label_ == "PERSON" + assert doc.spans["ruler"][0].text == "Dina" + assert doc.spans["ruler"][1].label_ == "ORG" + assert doc.spans["ruler"][1].text == "ACME" + ruler.remove("PERSON") + doc = ruler(nlp.make_doc("Dina founded the company ACME")) + assert len(ruler.patterns) == 2 + assert len(doc.spans["ruler"]) == 1 + assert doc.spans["ruler"][0].label_ == "ORG" + assert doc.spans["ruler"][0].text == "ACME" + ruler.remove("ORG") + with pytest.warns(UserWarning): + doc = ruler(nlp.make_doc("Dina founded the company ACME")) + assert len(ruler.patterns) == 0 + assert len(doc.spans["ruler"]) == 0 + + +def test_span_ruler_remove_patterns_in_a_row(person_org_date_patterns): + nlp = spacy.blank("xx") + ruler = nlp.add_pipe("span_ruler") + ruler.add_patterns(person_org_date_patterns) + doc = ruler(nlp.make_doc("Dina founded the company ACME on June 14th")) + assert len(doc.spans["ruler"]) == 3 + assert doc.spans["ruler"][0].label_ == "PERSON" + assert doc.spans["ruler"][0].text == "Dina" + assert doc.spans["ruler"][1].label_ == "ORG" + assert doc.spans["ruler"][1].text == "ACME" + assert doc.spans["ruler"][2].label_ == "DATE" + assert doc.spans["ruler"][2].text == "June 14th" + ruler.remove("ORG") + ruler.remove("DATE") + doc = ruler(nlp.make_doc("Dina went to school")) + assert len(doc.spans["ruler"]) == 1 + + +def test_span_ruler_remove_all_patterns(person_org_date_patterns): + nlp = spacy.blank("xx") + ruler = nlp.add_pipe("span_ruler") + ruler.add_patterns(person_org_date_patterns) + assert len(ruler.patterns) == 4 + ruler.remove("PERSON") + assert len(ruler.patterns) == 3 + ruler.remove("ORG") + assert len(ruler.patterns) == 1 + ruler.remove("DATE") + assert len(ruler.patterns) == 0 + with pytest.warns(UserWarning): + doc = ruler(nlp.make_doc("Dina founded the company ACME on June 14th")) + assert len(doc.spans["ruler"]) == 0 + + +def test_span_ruler_remove_and_add(): + nlp = spacy.blank("xx") + ruler = nlp.add_pipe("span_ruler") + patterns1 = [{"label": "DATE1", "pattern": "last time"}] + ruler.add_patterns(patterns1) + doc = ruler( + nlp.make_doc("I saw him last time we met, this time he brought some flowers") + ) + assert len(ruler.patterns) == 1 + assert len(doc.spans["ruler"]) == 1 + assert doc.spans["ruler"][0].label_ == "DATE1" + assert doc.spans["ruler"][0].text == "last time" + patterns2 = [{"label": "DATE2", "pattern": "this time"}] + ruler.add_patterns(patterns2) + doc = ruler( + nlp.make_doc("I saw him last time we met, this time he brought some flowers") + ) + assert len(ruler.patterns) == 2 + assert len(doc.spans["ruler"]) == 2 + assert doc.spans["ruler"][0].label_ == "DATE1" + assert doc.spans["ruler"][0].text == "last time" + assert doc.spans["ruler"][1].label_ == "DATE2" + assert doc.spans["ruler"][1].text == "this time" + ruler.remove("DATE1") + doc = ruler( + nlp.make_doc("I saw him last time we met, this time he brought some flowers") + ) + assert len(ruler.patterns) == 1 + assert len(doc.spans["ruler"]) == 1 + assert doc.spans["ruler"][0].label_ == "DATE2" + assert doc.spans["ruler"][0].text == "this time" + ruler.add_patterns(patterns1) + doc = ruler( + nlp.make_doc("I saw him last time we met, this time he brought some flowers") + ) + assert len(ruler.patterns) == 2 + assert len(doc.spans["ruler"]) == 2 + patterns3 = [{"label": "DATE3", "pattern": "another time"}] + ruler.add_patterns(patterns3) + doc = ruler( + nlp.make_doc( + "I saw him last time we met, this time he brought some flowers, another time some chocolate." + ) + ) + assert len(ruler.patterns) == 3 + assert len(doc.spans["ruler"]) == 3 + ruler.remove("DATE3") + doc = ruler( + nlp.make_doc( + "I saw him last time we met, this time he brought some flowers, another time some chocolate." + ) + ) + assert len(ruler.patterns) == 2 + assert len(doc.spans["ruler"]) == 2 + + +def test_span_ruler_spans_filter(overlapping_patterns): + nlp = spacy.blank("xx") + ruler = nlp.add_pipe( + "span_ruler", + config={"spans_filter": {"@misc": "spacy.first_longest_spans_filter.v1"}}, + ) + ruler.add_patterns(overlapping_patterns) + doc = ruler(nlp.make_doc("foo bar baz")) + assert len(doc.spans["ruler"]) == 1 + assert doc.spans["ruler"][0].label_ == "FOOBAR" + + +def test_span_ruler_ents_default_filter(overlapping_patterns): + nlp = spacy.blank("xx") + ruler = nlp.add_pipe("span_ruler", config={"annotate_ents": True}) + ruler.add_patterns(overlapping_patterns) + doc = ruler(nlp.make_doc("foo bar baz")) + assert len(doc.ents) == 1 + assert doc.ents[0].label_ == "FOOBAR" + + +def test_span_ruler_ents_overwrite_filter(overlapping_patterns): + nlp = spacy.blank("xx") + ruler = nlp.add_pipe( + "span_ruler", + config={ + "annotate_ents": True, + "overwrite": False, + "ents_filter": {"@misc": "spacy.prioritize_new_ents_filter.v1"}, + }, + ) + ruler.add_patterns(overlapping_patterns) + # overlapping ents are clobbered, non-overlapping ents are preserved + doc = nlp.make_doc("foo bar baz a b c") + doc.ents = [Span(doc, 1, 3, label="BARBAZ"), Span(doc, 3, 6, label="ABC")] + doc = ruler(doc) + assert len(doc.ents) == 2 + assert doc.ents[0].label_ == "FOOBAR" + assert doc.ents[1].label_ == "ABC" + + +def test_span_ruler_ents_bad_filter(overlapping_patterns): + @registry.misc("test_pass_through_filter") + def make_pass_through_filter(): + def pass_through_filter(spans1, spans2): + return spans1 + spans2 + + return pass_through_filter + + nlp = spacy.blank("xx") + ruler = nlp.add_pipe( + "span_ruler", + config={ + "annotate_ents": True, + "ents_filter": {"@misc": "test_pass_through_filter"}, + }, + ) + ruler.add_patterns(overlapping_patterns) + with pytest.raises(ValueError): + ruler(nlp.make_doc("foo bar baz")) diff --git a/TTS/Kokoro/.venv/Lib/site-packages/spacy/tests/pipeline/test_spancat.py b/TTS/Kokoro/.venv/Lib/site-packages/spacy/tests/pipeline/test_spancat.py new file mode 100644 index 0000000000000000000000000000000000000000..28179cf8d2d9b3dc3ba6a0d3eee6f4848eac208c --- /dev/null +++ b/TTS/Kokoro/.venv/Lib/site-packages/spacy/tests/pipeline/test_spancat.py @@ -0,0 +1,612 @@ +import numpy +import pytest +from numpy.testing import assert_almost_equal, assert_array_equal +from thinc.api import NumpyOps, Ragged, get_current_ops + +from spacy import util +from spacy.lang.en import English +from spacy.language import Language +from spacy.tokens import SpanGroup +from spacy.tokens._dict_proxies import SpanGroups +from spacy.training import Example +from spacy.util import fix_random_seed, make_tempdir, registry + +OPS = get_current_ops() + +SPAN_KEY = "labeled_spans" + +SPANCAT_COMPONENTS = ["spancat", "spancat_singlelabel"] + +TRAIN_DATA = [ + ("Who is Shaka Khan?", {"spans": {SPAN_KEY: [(7, 17, "PERSON")]}}), + ( + "I like London and Berlin.", + {"spans": {SPAN_KEY: [(7, 13, "LOC"), (18, 24, "LOC")]}}, + ), +] + +TRAIN_DATA_OVERLAPPING = [ + ("Who is Shaka Khan?", {"spans": {SPAN_KEY: [(7, 17, "PERSON")]}}), + ( + "I like London and Berlin", + {"spans": {SPAN_KEY: [(7, 13, "LOC"), (18, 24, "LOC"), (7, 24, "DOUBLE_LOC")]}}, + ), + ("", {"spans": {SPAN_KEY: []}}), +] + + +def make_examples(nlp, data=TRAIN_DATA): + train_examples = [] + for t in data: + eg = Example.from_dict(nlp.make_doc(t[0]), t[1]) + train_examples.append(eg) + return train_examples + + +@pytest.mark.parametrize("name", SPANCAT_COMPONENTS) +def test_no_label(name): + nlp = Language() + nlp.add_pipe(name, config={"spans_key": SPAN_KEY}) + with pytest.raises(ValueError): + nlp.initialize() + + +@pytest.mark.parametrize("name", SPANCAT_COMPONENTS) +def test_no_resize(name): + nlp = Language() + spancat = nlp.add_pipe(name, config={"spans_key": SPAN_KEY}) + spancat.add_label("Thing") + spancat.add_label("Phrase") + assert spancat.labels == ("Thing", "Phrase") + nlp.initialize() + assert spancat.model.get_dim("nO") == spancat._n_labels + # this throws an error because the spancat can't be resized after initialization + with pytest.raises(ValueError): + spancat.add_label("Stuff") + + +@pytest.mark.parametrize("name", SPANCAT_COMPONENTS) +def test_implicit_labels(name): + nlp = Language() + spancat = nlp.add_pipe(name, config={"spans_key": SPAN_KEY}) + assert len(spancat.labels) == 0 + train_examples = make_examples(nlp) + nlp.initialize(get_examples=lambda: train_examples) + assert spancat.labels == ("PERSON", "LOC") + + +@pytest.mark.parametrize("name", SPANCAT_COMPONENTS) +def test_explicit_labels(name): + nlp = Language() + spancat = nlp.add_pipe(name, config={"spans_key": SPAN_KEY}) + assert len(spancat.labels) == 0 + spancat.add_label("PERSON") + spancat.add_label("LOC") + nlp.initialize() + assert spancat.labels == ("PERSON", "LOC") + + +# TODO figure out why this is flaky +@pytest.mark.skip(reason="Test is unreliable for unknown reason") +def test_doc_gc(): + # If the Doc object is garbage collected, the spans won't be functional afterwards + nlp = Language() + spancat = nlp.add_pipe("spancat", config={"spans_key": SPAN_KEY}) + spancat.add_label("PERSON") + nlp.initialize() + texts = [ + "Just a sentence.", + "I like London and Berlin", + "I like Berlin", + "I eat ham.", + ] + all_spans = [doc.spans for doc in nlp.pipe(texts)] + for text, spangroups in zip(texts, all_spans): + assert isinstance(spangroups, SpanGroups) + for key, spangroup in spangroups.items(): + assert isinstance(spangroup, SpanGroup) + # XXX This fails with length 0 sometimes + assert len(spangroup) > 0 + with pytest.raises(RuntimeError): + spangroup[0] + + +@pytest.mark.parametrize( + "max_positive,nr_results", [(None, 4), (1, 2), (2, 3), (3, 4), (4, 4)] +) +def test_make_spangroup_multilabel(max_positive, nr_results): + fix_random_seed(0) + nlp = Language() + spancat = nlp.add_pipe( + "spancat", + config={"spans_key": SPAN_KEY, "threshold": 0.5, "max_positive": max_positive}, + ) + doc = nlp.make_doc("Greater London") + ngram_suggester = registry.misc.get("spacy.ngram_suggester.v1")(sizes=[1, 2]) + indices = ngram_suggester([doc])[0].dataXd + assert_array_equal(OPS.to_numpy(indices), numpy.asarray([[0, 1], [1, 2], [0, 2]])) + labels = ["Thing", "City", "Person", "GreatCity"] + for label in labels: + spancat.add_label(label) + scores = numpy.asarray( + [[0.2, 0.4, 0.3, 0.1], [0.1, 0.6, 0.2, 0.4], [0.8, 0.7, 0.3, 0.9]], dtype="f" + ) + spangroup = spancat._make_span_group_multilabel(doc, indices, scores) + assert len(spangroup) == nr_results + + # first span is always the second token "London" + assert spangroup[0].text == "London" + assert spangroup[0].label_ == "City" + assert_almost_equal(0.6, spangroup.attrs["scores"][0], 5) + + # second span depends on the number of positives that were allowed + assert spangroup[1].text == "Greater London" + if max_positive == 1: + assert spangroup[1].label_ == "GreatCity" + assert_almost_equal(0.9, spangroup.attrs["scores"][1], 5) + else: + assert spangroup[1].label_ == "Thing" + assert_almost_equal(0.8, spangroup.attrs["scores"][1], 5) + + if nr_results > 2: + assert spangroup[2].text == "Greater London" + if max_positive == 2: + assert spangroup[2].label_ == "GreatCity" + assert_almost_equal(0.9, spangroup.attrs["scores"][2], 5) + else: + assert spangroup[2].label_ == "City" + assert_almost_equal(0.7, spangroup.attrs["scores"][2], 5) + + assert spangroup[-1].text == "Greater London" + assert spangroup[-1].label_ == "GreatCity" + assert_almost_equal(0.9, spangroup.attrs["scores"][-1], 5) + + +@pytest.mark.parametrize( + "threshold,allow_overlap,nr_results", + [(0.05, True, 3), (0.05, False, 1), (0.5, True, 2), (0.5, False, 1)], +) +def test_make_spangroup_singlelabel(threshold, allow_overlap, nr_results): + fix_random_seed(0) + nlp = Language() + spancat = nlp.add_pipe( + "spancat", + config={ + "spans_key": SPAN_KEY, + "threshold": threshold, + "max_positive": 1, + }, + ) + doc = nlp.make_doc("Greater London") + ngram_suggester = registry.misc.get("spacy.ngram_suggester.v1")(sizes=[1, 2]) + indices = ngram_suggester([doc])[0].dataXd + assert_array_equal(OPS.to_numpy(indices), numpy.asarray([[0, 1], [1, 2], [0, 2]])) + labels = ["Thing", "City", "Person", "GreatCity"] + for label in labels: + spancat.add_label(label) + scores = numpy.asarray( + [[0.2, 0.4, 0.3, 0.1], [0.1, 0.6, 0.2, 0.4], [0.8, 0.7, 0.3, 0.9]], dtype="f" + ) + spangroup = spancat._make_span_group_singlelabel( + doc, indices, scores, allow_overlap + ) + if threshold > 0.4: + if allow_overlap: + assert spangroup[0].text == "London" + assert spangroup[0].label_ == "City" + assert_almost_equal(0.6, spangroup.attrs["scores"][0], 5) + assert spangroup[1].text == "Greater London" + assert spangroup[1].label_ == "GreatCity" + assert spangroup.attrs["scores"][1] == 0.9 + assert_almost_equal(0.9, spangroup.attrs["scores"][1], 5) + else: + assert spangroup[0].text == "Greater London" + assert spangroup[0].label_ == "GreatCity" + assert spangroup.attrs["scores"][0] == 0.9 + else: + if allow_overlap: + assert spangroup[0].text == "Greater" + assert spangroup[0].label_ == "City" + assert spangroup[1].text == "London" + assert spangroup[1].label_ == "City" + assert spangroup[2].text == "Greater London" + assert spangroup[2].label_ == "GreatCity" + else: + assert spangroup[0].text == "Greater London" + + +def test_make_spangroup_negative_label(): + fix_random_seed(0) + nlp_single = Language() + nlp_multi = Language() + spancat_single = nlp_single.add_pipe( + "spancat", + config={ + "spans_key": SPAN_KEY, + "threshold": 0.1, + "max_positive": 1, + }, + ) + spancat_multi = nlp_multi.add_pipe( + "spancat", + config={ + "spans_key": SPAN_KEY, + "threshold": 0.1, + "max_positive": 2, + }, + ) + spancat_single.add_negative_label = True + spancat_multi.add_negative_label = True + doc = nlp_single.make_doc("Greater London") + labels = ["Thing", "City", "Person", "GreatCity"] + for label in labels: + spancat_multi.add_label(label) + spancat_single.add_label(label) + ngram_suggester = registry.misc.get("spacy.ngram_suggester.v1")(sizes=[1, 2]) + indices = ngram_suggester([doc])[0].dataXd + assert_array_equal(OPS.to_numpy(indices), numpy.asarray([[0, 1], [1, 2], [0, 2]])) + scores = numpy.asarray( + [ + [0.2, 0.4, 0.3, 0.1, 0.1], + [0.1, 0.6, 0.2, 0.4, 0.9], + [0.8, 0.7, 0.3, 0.9, 0.1], + ], + dtype="f", + ) + spangroup_multi = spancat_multi._make_span_group_multilabel(doc, indices, scores) + spangroup_single = spancat_single._make_span_group_singlelabel(doc, indices, scores) + assert len(spangroup_single) == 2 + assert spangroup_single[0].text == "Greater" + assert spangroup_single[0].label_ == "City" + assert_almost_equal(0.4, spangroup_single.attrs["scores"][0], 5) + assert spangroup_single[1].text == "Greater London" + assert spangroup_single[1].label_ == "GreatCity" + assert spangroup_single.attrs["scores"][1] == 0.9 + assert_almost_equal(0.9, spangroup_single.attrs["scores"][1], 5) + + assert len(spangroup_multi) == 6 + assert spangroup_multi[0].text == "Greater" + assert spangroup_multi[0].label_ == "City" + assert_almost_equal(0.4, spangroup_multi.attrs["scores"][0], 5) + assert spangroup_multi[1].text == "Greater" + assert spangroup_multi[1].label_ == "Person" + assert_almost_equal(0.3, spangroup_multi.attrs["scores"][1], 5) + assert spangroup_multi[2].text == "London" + assert spangroup_multi[2].label_ == "City" + assert_almost_equal(0.6, spangroup_multi.attrs["scores"][2], 5) + assert spangroup_multi[3].text == "London" + assert spangroup_multi[3].label_ == "GreatCity" + assert_almost_equal(0.4, spangroup_multi.attrs["scores"][3], 5) + assert spangroup_multi[4].text == "Greater London" + assert spangroup_multi[4].label_ == "Thing" + assert spangroup_multi[4].text == "Greater London" + assert_almost_equal(0.8, spangroup_multi.attrs["scores"][4], 5) + assert spangroup_multi[5].text == "Greater London" + assert spangroup_multi[5].label_ == "GreatCity" + assert_almost_equal(0.9, spangroup_multi.attrs["scores"][5], 5) + + +def test_ngram_suggester(en_tokenizer): + # test different n-gram lengths + for size in [1, 2, 3]: + ngram_suggester = registry.misc.get("spacy.ngram_suggester.v1")(sizes=[size]) + docs = [ + en_tokenizer(text) + for text in [ + "a", + "a b", + "a b c", + "a b c d", + "a b c d e", + "a " * 100, + ] + ] + ngrams = ngram_suggester(docs) + # span sizes are correct + for s in ngrams.data: + assert s[1] - s[0] == size + # spans are within docs + offset = 0 + for i, doc in enumerate(docs): + spans = ngrams.dataXd[offset : offset + ngrams.lengths[i]] + spans_set = set() + for span in spans: + assert 0 <= span[0] < len(doc) + assert 0 < span[1] <= len(doc) + spans_set.add((int(span[0]), int(span[1]))) + # spans are unique + assert spans.shape[0] == len(spans_set) + offset += ngrams.lengths[i] + # the number of spans is correct + assert_array_equal( + OPS.to_numpy(ngrams.lengths), + [max(0, len(doc) - (size - 1)) for doc in docs], + ) + + # test 1-3-gram suggestions + ngram_suggester = registry.misc.get("spacy.ngram_suggester.v1")(sizes=[1, 2, 3]) + docs = [ + en_tokenizer(text) for text in ["a", "a b", "a b c", "a b c d", "a b c d e"] + ] + ngrams = ngram_suggester(docs) + assert_array_equal(OPS.to_numpy(ngrams.lengths), [1, 3, 6, 9, 12]) + assert_array_equal( + OPS.to_numpy(ngrams.data), + [ + # doc 0 + [0, 1], + # doc 1 + [0, 1], + [1, 2], + [0, 2], + # doc 2 + [0, 1], + [1, 2], + [2, 3], + [0, 2], + [1, 3], + [0, 3], + # doc 3 + [0, 1], + [1, 2], + [2, 3], + [3, 4], + [0, 2], + [1, 3], + [2, 4], + [0, 3], + [1, 4], + # doc 4 + [0, 1], + [1, 2], + [2, 3], + [3, 4], + [4, 5], + [0, 2], + [1, 3], + [2, 4], + [3, 5], + [0, 3], + [1, 4], + [2, 5], + ], + ) + + # test some empty docs + ngram_suggester = registry.misc.get("spacy.ngram_suggester.v1")(sizes=[1]) + docs = [en_tokenizer(text) for text in ["", "a", ""]] + ngrams = ngram_suggester(docs) + assert_array_equal(OPS.to_numpy(ngrams.lengths), [len(doc) for doc in docs]) + + # test all empty docs + ngram_suggester = registry.misc.get("spacy.ngram_suggester.v1")(sizes=[1]) + docs = [en_tokenizer(text) for text in ["", "", ""]] + ngrams = ngram_suggester(docs) + assert_array_equal(OPS.to_numpy(ngrams.lengths), [len(doc) for doc in docs]) + + +def test_ngram_sizes(en_tokenizer): + # test that the range suggester works well + size_suggester = registry.misc.get("spacy.ngram_suggester.v1")(sizes=[1, 2, 3]) + suggester_factory = registry.misc.get("spacy.ngram_range_suggester.v1") + range_suggester = suggester_factory(min_size=1, max_size=3) + docs = [ + en_tokenizer(text) for text in ["a", "a b", "a b c", "a b c d", "a b c d e"] + ] + ngrams_1 = size_suggester(docs) + ngrams_2 = range_suggester(docs) + assert_array_equal(OPS.to_numpy(ngrams_1.lengths), [1, 3, 6, 9, 12]) + assert_array_equal(OPS.to_numpy(ngrams_1.lengths), OPS.to_numpy(ngrams_2.lengths)) + assert_array_equal(OPS.to_numpy(ngrams_1.data), OPS.to_numpy(ngrams_2.data)) + + # one more variation + suggester_factory = registry.misc.get("spacy.ngram_range_suggester.v1") + range_suggester = suggester_factory(min_size=2, max_size=4) + ngrams_3 = range_suggester(docs) + assert_array_equal(OPS.to_numpy(ngrams_3.lengths), [0, 1, 3, 6, 9]) + + +def test_preset_spans_suggester(): + nlp = Language() + docs = [nlp("This is an example."), nlp("This is the second example.")] + docs[0].spans[SPAN_KEY] = [docs[0][3:4]] + docs[1].spans[SPAN_KEY] = [docs[1][0:4], docs[1][3:5]] + suggester = registry.misc.get("spacy.preset_spans_suggester.v1")(spans_key=SPAN_KEY) + candidates = suggester(docs) + assert type(candidates) == Ragged + assert len(candidates) == 2 + assert list(candidates.dataXd[0]) == [3, 4] + assert list(candidates.dataXd[1]) == [0, 4] + assert list(candidates.dataXd[2]) == [3, 5] + assert list(candidates.lengths) == [1, 2] + + +def test_overfitting_IO(): + # Simple test to try and quickly overfit the spancat component - ensuring the ML models work correctly + fix_random_seed(0) + nlp = English() + spancat = nlp.add_pipe("spancat", config={"spans_key": SPAN_KEY}) + train_examples = make_examples(nlp) + optimizer = nlp.initialize(get_examples=lambda: train_examples) + assert spancat.model.get_dim("nO") == 2 + assert set(spancat.labels) == {"LOC", "PERSON"} + + for i in range(50): + losses = {} + nlp.update(train_examples, sgd=optimizer, losses=losses) + assert losses["spancat"] < 0.01 + + # test the trained model + test_text = "I like London and Berlin" + doc = nlp(test_text) + assert doc.spans[spancat.key] == doc.spans[SPAN_KEY] + spans = doc.spans[SPAN_KEY] + assert len(spans) == 2 + assert len(spans.attrs["scores"]) == 2 + assert min(spans.attrs["scores"]) > 0.8 + assert set([span.text for span in spans]) == {"London", "Berlin"} + assert set([span.label_ for span in spans]) == {"LOC"} + + # Also test the results are still the same after IO + with make_tempdir() as tmp_dir: + nlp.to_disk(tmp_dir) + nlp2 = util.load_model_from_path(tmp_dir) + doc2 = nlp2(test_text) + spans2 = doc2.spans[SPAN_KEY] + assert len(spans2) == 2 + assert len(spans2.attrs["scores"]) == 2 + assert min(spans2.attrs["scores"]) > 0.8 + assert set([span.text for span in spans2]) == {"London", "Berlin"} + assert set([span.label_ for span in spans2]) == {"LOC"} + + # Test scoring + scores = nlp.evaluate(train_examples) + assert f"spans_{SPAN_KEY}_f" in scores + assert scores[f"spans_{SPAN_KEY}_p"] == 1.0 + assert scores[f"spans_{SPAN_KEY}_r"] == 1.0 + assert scores[f"spans_{SPAN_KEY}_f"] == 1.0 + + # also test that the spancat works for just a single entity in a sentence + doc = nlp("London") + assert len(doc.spans[spancat.key]) == 1 + + +def test_overfitting_IO_overlapping(): + # Test for overfitting on overlapping entities + fix_random_seed(0) + nlp = English() + spancat = nlp.add_pipe("spancat", config={"spans_key": SPAN_KEY}) + + train_examples = make_examples(nlp, data=TRAIN_DATA_OVERLAPPING) + optimizer = nlp.initialize(get_examples=lambda: train_examples) + assert spancat.model.get_dim("nO") == 3 + assert set(spancat.labels) == {"PERSON", "LOC", "DOUBLE_LOC"} + + for i in range(50): + losses = {} + nlp.update(train_examples, sgd=optimizer, losses=losses) + assert losses["spancat"] < 0.01 + + # test the trained model + test_text = "I like London and Berlin" + doc = nlp(test_text) + spans = doc.spans[SPAN_KEY] + assert len(spans) == 3 + assert len(spans.attrs["scores"]) == 3 + assert min(spans.attrs["scores"]) > 0.9 + assert set([span.text for span in spans]) == { + "London", + "Berlin", + "London and Berlin", + } + assert set([span.label_ for span in spans]) == {"LOC", "DOUBLE_LOC"} + + # Also test the results are still the same after IO + with make_tempdir() as tmp_dir: + nlp.to_disk(tmp_dir) + nlp2 = util.load_model_from_path(tmp_dir) + doc2 = nlp2(test_text) + spans2 = doc2.spans[SPAN_KEY] + assert len(spans2) == 3 + assert len(spans2.attrs["scores"]) == 3 + assert min(spans2.attrs["scores"]) > 0.9 + assert set([span.text for span in spans2]) == { + "London", + "Berlin", + "London and Berlin", + } + assert set([span.label_ for span in spans2]) == {"LOC", "DOUBLE_LOC"} + + +@pytest.mark.parametrize("name", SPANCAT_COMPONENTS) +def test_zero_suggestions(name): + # Test with a suggester that can return 0 suggestions + @registry.misc("test_mixed_zero_suggester") + def make_mixed_zero_suggester(): + def mixed_zero_suggester(docs, *, ops=None): + if ops is None: + ops = get_current_ops() + spans = [] + lengths = [] + for doc in docs: + if len(doc) > 0 and len(doc) % 2 == 0: + spans.append((0, 1)) + lengths.append(1) + else: + lengths.append(0) + spans = ops.asarray2i(spans) + lengths_array = ops.asarray1i(lengths) + if len(spans) > 0: + output = Ragged(ops.xp.vstack(spans), lengths_array) + else: + output = Ragged(ops.xp.zeros((0, 0), dtype="i"), lengths_array) + return output + + return mixed_zero_suggester + + fix_random_seed(0) + nlp = English() + spancat = nlp.add_pipe( + name, + config={ + "suggester": {"@misc": "test_mixed_zero_suggester"}, + "spans_key": SPAN_KEY, + }, + ) + train_examples = make_examples(nlp) + optimizer = nlp.initialize(get_examples=lambda: train_examples) + assert spancat.model.get_dim("nO") == spancat._n_labels + assert set(spancat.labels) == {"LOC", "PERSON"} + + nlp.update(train_examples, sgd=optimizer) + # empty doc + nlp("") + # single doc with zero suggestions + nlp("one") + # single doc with one suggestion + nlp("two two") + # batch with mixed zero/one suggestions + list(nlp.pipe(["one", "two two", "three three three", "", "four four four four"])) + # batch with no suggestions + list(nlp.pipe(["", "one", "three three three"])) + + +@pytest.mark.parametrize("name", SPANCAT_COMPONENTS) +def test_set_candidates(name): + nlp = Language() + spancat = nlp.add_pipe(name, config={"spans_key": SPAN_KEY}) + train_examples = make_examples(nlp) + nlp.initialize(get_examples=lambda: train_examples) + texts = [ + "Just a sentence.", + "I like London and Berlin", + "I like Berlin", + "I eat ham.", + ] + + docs = [nlp(text) for text in texts] + spancat.set_candidates(docs) + + assert len(docs) == len(texts) + assert type(docs[0].spans["candidates"]) == SpanGroup + assert len(docs[0].spans["candidates"]) == 9 + assert docs[0].spans["candidates"][0].text == "Just" + assert docs[0].spans["candidates"][4].text == "Just a" + + +@pytest.mark.parametrize("name", SPANCAT_COMPONENTS) +@pytest.mark.parametrize("n_process", [1, 2]) +def test_spancat_multiprocessing(name, n_process): + if isinstance(get_current_ops, NumpyOps) or n_process < 2: + nlp = Language() + spancat = nlp.add_pipe(name, config={"spans_key": SPAN_KEY}) + train_examples = make_examples(nlp) + nlp.initialize(get_examples=lambda: train_examples) + texts = [ + "Just a sentence.", + "I like London and Berlin", + "I like Berlin", + "I eat ham.", + ] + docs = list(nlp.pipe(texts, n_process=n_process)) + assert len(docs) == len(texts) diff --git a/TTS/Kokoro/.venv/Lib/site-packages/spacy/tests/pipeline/test_tagger.py b/TTS/Kokoro/.venv/Lib/site-packages/spacy/tests/pipeline/test_tagger.py new file mode 100644 index 0000000000000000000000000000000000000000..727feadb1962aadb3ead5c5f2c56c1334871e3d4 --- /dev/null +++ b/TTS/Kokoro/.venv/Lib/site-packages/spacy/tests/pipeline/test_tagger.py @@ -0,0 +1,242 @@ +import pytest +from numpy.testing import assert_almost_equal, assert_equal +from thinc.api import compounding, get_current_ops + +from spacy import util +from spacy.attrs import TAG +from spacy.lang.en import English +from spacy.language import Language +from spacy.training import Example + +from ..util import make_tempdir + + +@pytest.mark.issue(4348) +def test_issue4348(): + """Test that training the tagger with empty data, doesn't throw errors""" + nlp = English() + example = Example.from_dict(nlp.make_doc(""), {"tags": []}) + TRAIN_DATA = [example, example] + tagger = nlp.add_pipe("tagger") + tagger.add_label("A") + optimizer = nlp.initialize() + for i in range(5): + losses = {} + batches = util.minibatch(TRAIN_DATA, size=compounding(4.0, 32.0, 1.001)) + for batch in batches: + nlp.update(batch, sgd=optimizer, losses=losses) + + +def test_label_types(): + nlp = Language() + tagger = nlp.add_pipe("tagger") + tagger.add_label("A") + with pytest.raises(ValueError): + tagger.add_label(9) + + +def test_tagger_initialize_tag_map(): + """Test that Tagger.initialize() without gold tuples does not clobber + the tag map.""" + nlp = Language() + tagger = nlp.add_pipe("tagger") + orig_tag_count = len(tagger.labels) + tagger.add_label("A") + nlp.initialize() + assert orig_tag_count + 1 == len(nlp.get_pipe("tagger").labels) + + +TAGS = ("N", "V", "J") + +TRAIN_DATA = [ + ("I like green eggs", {"tags": ["N", "V", "J", "N"]}), + ("Eat blue ham", {"tags": ["V", "J", "N"]}), +] + +PARTIAL_DATA = [ + # partial annotation + ("I like green eggs", {"tags": ["", "V", "J", ""]}), + # misaligned partial annotation + ( + "He hates green eggs", + { + "words": ["He", "hate", "s", "green", "eggs"], + "tags": ["", "V", "S", "J", ""], + }, + ), +] + + +def test_label_smoothing(): + nlp = Language() + tagger_no_ls = nlp.add_pipe("tagger", "no_label_smoothing") + tagger_ls = nlp.add_pipe( + "tagger", "label_smoothing", config=dict(label_smoothing=0.05) + ) + train_examples = [] + losses = {} + for tag in TAGS: + tagger_no_ls.add_label(tag) + tagger_ls.add_label(tag) + for t in TRAIN_DATA: + train_examples.append(Example.from_dict(nlp.make_doc(t[0]), t[1])) + + nlp.initialize(get_examples=lambda: train_examples) + tag_scores, bp_tag_scores = tagger_ls.model.begin_update( + [eg.predicted for eg in train_examples] + ) + ops = get_current_ops() + no_ls_grads = ops.to_numpy(tagger_no_ls.get_loss(train_examples, tag_scores)[1][0]) + ls_grads = ops.to_numpy(tagger_ls.get_loss(train_examples, tag_scores)[1][0]) + assert_almost_equal(ls_grads / no_ls_grads, 0.925) + + +def test_no_label(): + nlp = Language() + nlp.add_pipe("tagger") + with pytest.raises(ValueError): + nlp.initialize() + + +def test_no_resize(): + nlp = Language() + tagger = nlp.add_pipe("tagger") + tagger.add_label("N") + tagger.add_label("V") + assert tagger.labels == ("N", "V") + nlp.initialize() + assert tagger.model.get_dim("nO") == 2 + # this throws an error because the tagger can't be resized after initialization + with pytest.raises(ValueError): + tagger.add_label("J") + + +def test_implicit_label(): + nlp = Language() + nlp.add_pipe("tagger") + train_examples = [] + for t in TRAIN_DATA: + train_examples.append(Example.from_dict(nlp.make_doc(t[0]), t[1])) + nlp.initialize(get_examples=lambda: train_examples) + + +def test_initialize_examples(): + nlp = Language() + tagger = nlp.add_pipe("tagger") + train_examples = [] + for tag in TAGS: + tagger.add_label(tag) + for t in TRAIN_DATA: + train_examples.append(Example.from_dict(nlp.make_doc(t[0]), t[1])) + # you shouldn't really call this more than once, but for testing it should be fine + nlp.initialize() + nlp.initialize(get_examples=lambda: train_examples) + with pytest.raises(TypeError): + nlp.initialize(get_examples=lambda: None) + with pytest.raises(TypeError): + nlp.initialize(get_examples=lambda: train_examples[0]) + with pytest.raises(TypeError): + nlp.initialize(get_examples=lambda: []) + with pytest.raises(TypeError): + nlp.initialize(get_examples=train_examples) + + +def test_no_data(): + # Test that the tagger provides a nice error when there's no tagging data / labels + TEXTCAT_DATA = [ + ("I'm so happy.", {"cats": {"POSITIVE": 1.0, "NEGATIVE": 0.0}}), + ("I'm so angry", {"cats": {"POSITIVE": 0.0, "NEGATIVE": 1.0}}), + ] + nlp = English() + nlp.add_pipe("tagger") + nlp.add_pipe("textcat") + train_examples = [] + for t in TEXTCAT_DATA: + train_examples.append(Example.from_dict(nlp.make_doc(t[0]), t[1])) + with pytest.raises(ValueError): + nlp.initialize(get_examples=lambda: train_examples) + + +def test_incomplete_data(): + # Test that the tagger works with incomplete information + nlp = English() + nlp.add_pipe("tagger") + train_examples = [] + for t in PARTIAL_DATA: + train_examples.append(Example.from_dict(nlp.make_doc(t[0]), t[1])) + optimizer = nlp.initialize(get_examples=lambda: train_examples) + for i in range(50): + losses = {} + nlp.update(train_examples, sgd=optimizer, losses=losses) + assert losses["tagger"] < 0.00001 + + # test the trained model + test_text = "I like blue eggs" + doc = nlp(test_text) + assert doc[1].tag_ == "V" + assert doc[2].tag_ == "J" + + +def test_overfitting_IO(): + # Simple test to try and quickly overfit the tagger - ensuring the ML models work correctly + nlp = English() + tagger = nlp.add_pipe("tagger") + train_examples = [] + for t in TRAIN_DATA: + train_examples.append(Example.from_dict(nlp.make_doc(t[0]), t[1])) + optimizer = nlp.initialize(get_examples=lambda: train_examples) + assert tagger.model.get_dim("nO") == len(TAGS) + + for i in range(50): + losses = {} + nlp.update(train_examples, sgd=optimizer, losses=losses) + assert losses["tagger"] < 0.00001 + + # test the trained model + test_text = "I like blue eggs" + doc = nlp(test_text) + assert doc[0].tag_ == "N" + assert doc[1].tag_ == "V" + assert doc[2].tag_ == "J" + assert doc[3].tag_ == "N" + + # Also test the results are still the same after IO + with make_tempdir() as tmp_dir: + nlp.to_disk(tmp_dir) + nlp2 = util.load_model_from_path(tmp_dir) + doc2 = nlp2(test_text) + assert doc2[0].tag_ == "N" + assert doc2[1].tag_ == "V" + assert doc2[2].tag_ == "J" + assert doc2[3].tag_ == "N" + + # Make sure that running pipe twice, or comparing to call, always amounts to the same predictions + texts = [ + "Just a sentence.", + "I like green eggs.", + "Here is another one.", + "I eat ham.", + ] + batch_deps_1 = [doc.to_array([TAG]) for doc in nlp.pipe(texts)] + batch_deps_2 = [doc.to_array([TAG]) for doc in nlp.pipe(texts)] + no_batch_deps = [doc.to_array([TAG]) for doc in [nlp(text) for text in texts]] + assert_equal(batch_deps_1, batch_deps_2) + assert_equal(batch_deps_1, no_batch_deps) + + # Try to unlearn the first 'N' tag with negative annotation + neg_ex = Example.from_dict(nlp.make_doc(test_text), {"tags": ["!N", "V", "J", "N"]}) + + for i in range(20): + losses = {} + nlp.update([neg_ex], sgd=optimizer, losses=losses) + + # test the "untrained" tag + doc3 = nlp(test_text) + assert doc3[0].tag_ != "N" + + +def test_tagger_requires_labels(): + nlp = English() + nlp.add_pipe("tagger") + with pytest.raises(ValueError): + nlp.initialize() diff --git a/TTS/Kokoro/.venv/Lib/site-packages/spacy/tests/pipeline/test_textcat.py b/TTS/Kokoro/.venv/Lib/site-packages/spacy/tests/pipeline/test_textcat.py new file mode 100644 index 0000000000000000000000000000000000000000..a0c76c3f661c1753bbc701d85bb0879ee6215803 --- /dev/null +++ b/TTS/Kokoro/.venv/Lib/site-packages/spacy/tests/pipeline/test_textcat.py @@ -0,0 +1,973 @@ +import random + +import numpy.random +import pytest +from numpy.testing import assert_almost_equal +from thinc.api import Config, compounding, fix_random_seed, get_current_ops +from wasabi import msg + +import spacy +from spacy import util +from spacy.cli.evaluate import print_prf_per_type, print_textcats_auc_per_cat +from spacy.lang.en import English +from spacy.language import Language +from spacy.pipeline import TextCategorizer +from spacy.pipeline.textcat import ( + single_label_bow_config, + single_label_cnn_config, + single_label_default_config, +) +from spacy.pipeline.textcat_multilabel import ( + multi_label_bow_config, + multi_label_cnn_config, + multi_label_default_config, +) +from spacy.pipeline.tok2vec import DEFAULT_TOK2VEC_MODEL +from spacy.scorer import Scorer +from spacy.tokens import Doc, DocBin +from spacy.training import Example +from spacy.training.initialize import init_nlp + +# Ensure that the architecture gets added to the registry. +from ..tok2vec import build_lazy_init_tok2vec as _ +from ..util import make_tempdir + +TRAIN_DATA_SINGLE_LABEL = [ + ("I'm so happy.", {"cats": {"POSITIVE": 1.0, "NEGATIVE": 0.0}}), + ("I'm so angry", {"cats": {"POSITIVE": 0.0, "NEGATIVE": 1.0}}), +] + +TRAIN_DATA_MULTI_LABEL = [ + ("I'm angry and confused", {"cats": {"ANGRY": 1.0, "CONFUSED": 1.0, "HAPPY": 0.0}}), + ("I'm confused but happy", {"cats": {"ANGRY": 0.0, "CONFUSED": 1.0, "HAPPY": 1.0}}), +] + +lazy_init_model_config = """ +[model] +@architectures = "test.LazyInitTok2Vec.v1" +width = 96 +""" +LAZY_INIT_TOK2VEC_MODEL = Config().from_str(lazy_init_model_config)["model"] + + +def make_get_examples_single_label(nlp): + train_examples = [] + for t in TRAIN_DATA_SINGLE_LABEL: + train_examples.append(Example.from_dict(nlp.make_doc(t[0]), t[1])) + + def get_examples(): + return train_examples + + return get_examples + + +def make_get_examples_multi_label(nlp): + train_examples = [] + for t in TRAIN_DATA_MULTI_LABEL: + train_examples.append(Example.from_dict(nlp.make_doc(t[0]), t[1])) + + def get_examples(): + return train_examples + + return get_examples + + +@pytest.mark.issue(3611) +def test_issue3611(): + """Test whether adding n-grams in the textcat works even when n > token length of some docs""" + unique_classes = ["offensive", "inoffensive"] + x_train = [ + "This is an offensive text", + "This is the second offensive text", + "inoff", + ] + y_train = ["offensive", "offensive", "inoffensive"] + nlp = spacy.blank("en") + # preparing the data + train_data = [] + for text, train_instance in zip(x_train, y_train): + cat_dict = {label: label == train_instance for label in unique_classes} + train_data.append(Example.from_dict(nlp.make_doc(text), {"cats": cat_dict})) + # add a text categorizer component + model = { + "@architectures": "spacy.TextCatBOW.v1", + "exclusive_classes": True, + "ngram_size": 2, + "no_output_layer": False, + } + textcat = nlp.add_pipe("textcat", config={"model": model}, last=True) + for label in unique_classes: + textcat.add_label(label) + # training the network + with nlp.select_pipes(enable="textcat"): + optimizer = nlp.initialize() + for i in range(3): + losses = {} + batches = util.minibatch(train_data, size=compounding(4.0, 32.0, 1.001)) + + for batch in batches: + nlp.update(examples=batch, sgd=optimizer, drop=0.1, losses=losses) + + +@pytest.mark.issue(4030) +def test_issue4030(): + """Test whether textcat works fine with empty doc""" + unique_classes = ["offensive", "inoffensive"] + x_train = [ + "This is an offensive text", + "This is the second offensive text", + "inoff", + ] + y_train = ["offensive", "offensive", "inoffensive"] + nlp = spacy.blank("en") + # preparing the data + train_data = [] + for text, train_instance in zip(x_train, y_train): + cat_dict = {label: label == train_instance for label in unique_classes} + train_data.append(Example.from_dict(nlp.make_doc(text), {"cats": cat_dict})) + # add a text categorizer component + model = { + "@architectures": "spacy.TextCatBOW.v1", + "exclusive_classes": True, + "ngram_size": 2, + "no_output_layer": False, + } + textcat = nlp.add_pipe("textcat", config={"model": model}, last=True) + for label in unique_classes: + textcat.add_label(label) + # training the network + with nlp.select_pipes(enable="textcat"): + optimizer = nlp.initialize() + for i in range(3): + losses = {} + batches = util.minibatch(train_data, size=compounding(4.0, 32.0, 1.001)) + + for batch in batches: + nlp.update(examples=batch, sgd=optimizer, drop=0.1, losses=losses) + # processing of an empty doc should result in 0.0 for all categories + doc = nlp("") + assert doc.cats["offensive"] == 0.0 + assert doc.cats["inoffensive"] == 0.0 + + +@pytest.mark.parametrize( + "textcat_config", + [ + single_label_default_config, + single_label_bow_config, + single_label_cnn_config, + multi_label_default_config, + multi_label_bow_config, + multi_label_cnn_config, + ], +) +@pytest.mark.issue(5551) +def test_issue5551(textcat_config): + """Test that after fixing the random seed, the results of the pipeline are truly identical""" + component = "textcat" + + pipe_cfg = Config().from_str(textcat_config) + results = [] + for i in range(3): + fix_random_seed(0) + nlp = English() + text = "Once hot, form ping-pong-ball-sized balls of the mixture, each weighing roughly 25 g." + annots = {"cats": {"Labe1": 1.0, "Label2": 0.0, "Label3": 0.0}} + pipe = nlp.add_pipe(component, config=pipe_cfg, last=True) + for label in set(annots["cats"]): + pipe.add_label(label) + # Train + nlp.initialize() + doc = nlp.make_doc(text) + nlp.update([Example.from_dict(doc, annots)]) + # Store the result of each iteration + result = pipe.model.predict([doc]) + results.append(result[0]) + # All results should be the same because of the fixed seed + assert len(results) == 3 + ops = get_current_ops() + assert_almost_equal(ops.to_numpy(results[0]), ops.to_numpy(results[1]), decimal=5) + assert_almost_equal(ops.to_numpy(results[0]), ops.to_numpy(results[2]), decimal=5) + + +CONFIG_ISSUE_6908 = """ +[paths] +train = "TRAIN_PLACEHOLDER" +raw = null +init_tok2vec = null +vectors = null + +[system] +seed = 0 +gpu_allocator = null + +[nlp] +lang = "en" +pipeline = ["textcat"] +tokenizer = {"@tokenizers":"spacy.Tokenizer.v1"} +disabled = [] +before_creation = null +after_creation = null +after_pipeline_creation = null +batch_size = 1000 + +[components] + +[components.textcat] +factory = "TEXTCAT_PLACEHOLDER" + +[corpora] + +[corpora.train] +@readers = "spacy.Corpus.v1" +path = ${paths:train} + +[corpora.dev] +@readers = "spacy.Corpus.v1" +path = ${paths:train} + + +[training] +train_corpus = "corpora.train" +dev_corpus = "corpora.dev" +seed = ${system.seed} +gpu_allocator = ${system.gpu_allocator} +frozen_components = [] +before_to_disk = null + +[pretraining] + +[initialize] +vectors = ${paths.vectors} +init_tok2vec = ${paths.init_tok2vec} +vocab_data = null +lookups = null +before_init = null +after_init = null + +[initialize.components] + +[initialize.components.textcat] +labels = ['label1', 'label2'] + +[initialize.tokenizer] +""" + + +@pytest.mark.parametrize( + "component_name", + ["textcat", "textcat_multilabel"], +) +@pytest.mark.issue(6908) +def test_issue6908(component_name): + """Test initializing textcat with labels in a list""" + + def create_data(out_file): + nlp = spacy.blank("en") + doc = nlp.make_doc("Some text") + doc.cats = {"label1": 0, "label2": 1} + out_data = DocBin(docs=[doc]).to_bytes() + with out_file.open("wb") as file_: + file_.write(out_data) + + with make_tempdir() as tmp_path: + train_path = tmp_path / "train.spacy" + create_data(train_path) + config_str = CONFIG_ISSUE_6908.replace("TEXTCAT_PLACEHOLDER", component_name) + config_str = config_str.replace("TRAIN_PLACEHOLDER", train_path.as_posix()) + config = util.load_config_from_str(config_str) + init_nlp(config) + + +@pytest.mark.issue(7019) +def test_issue7019(): + scores = {"LABEL_A": 0.39829102, "LABEL_B": 0.938298329382, "LABEL_C": None} + print_textcats_auc_per_cat(msg, scores) + scores = { + "LABEL_A": {"p": 0.3420302, "r": 0.3929020, "f": 0.49823928932}, + "LABEL_B": {"p": None, "r": None, "f": None}, + } + print_prf_per_type(msg, scores, name="foo", type="bar") + + +@pytest.mark.issue(9904) +def test_issue9904(): + nlp = Language() + textcat = nlp.add_pipe("textcat") + get_examples = make_get_examples_single_label(nlp) + nlp.initialize(get_examples) + + examples = get_examples() + scores = textcat.predict([eg.predicted for eg in examples]) + + loss = textcat.get_loss(examples, scores)[0] + loss_double_bs = textcat.get_loss(examples * 2, scores.repeat(2, axis=0))[0] + assert loss == pytest.approx(loss_double_bs) + + +@pytest.mark.skip(reason="Test is flakey when run with others") +def test_simple_train(): + nlp = Language() + textcat = nlp.add_pipe("textcat") + textcat.add_label("answer") + nlp.initialize() + for i in range(5): + for text, answer in [ + ("aaaa", 1.0), + ("bbbb", 0), + ("aa", 1.0), + ("bbbbbbbbb", 0.0), + ("aaaaaa", 1), + ]: + nlp.update((text, {"cats": {"answer": answer}})) + doc = nlp("aaa") + assert "answer" in doc.cats + assert doc.cats["answer"] >= 0.5 + + +@pytest.mark.skip(reason="Test is flakey when run with others") +def test_textcat_learns_multilabel(): + random.seed(5) + numpy.random.seed(5) + docs = [] + nlp = Language() + letters = ["a", "b", "c"] + for w1 in letters: + for w2 in letters: + cats = {letter: float(w2 == letter) for letter in letters} + docs.append((Doc(nlp.vocab, words=["d"] * 3 + [w1, w2] + ["d"] * 3), cats)) + random.shuffle(docs) + textcat = TextCategorizer(nlp.vocab, width=8) + for letter in letters: + textcat.add_label(letter) + optimizer = textcat.initialize(lambda: []) + for i in range(30): + losses = {} + examples = [Example.from_dict(doc, {"cats": cats}) for doc, cat in docs] + textcat.update(examples, sgd=optimizer, losses=losses) + random.shuffle(docs) + for w1 in letters: + for w2 in letters: + doc = Doc(nlp.vocab, words=["d"] * 3 + [w1, w2] + ["d"] * 3) + truth = {letter: w2 == letter for letter in letters} + textcat(doc) + for cat, score in doc.cats.items(): + if not truth[cat]: + assert score < 0.5 + else: + assert score > 0.5 + + +@pytest.mark.parametrize("name", ["textcat", "textcat_multilabel"]) +def test_label_types(name): + nlp = Language() + textcat = nlp.add_pipe(name) + textcat.add_label("answer") + with pytest.raises(ValueError): + textcat.add_label(9) + # textcat requires at least two labels + if name == "textcat": + with pytest.raises(ValueError): + nlp.initialize() + else: + nlp.initialize() + + +@pytest.mark.parametrize( + "name,get_examples", + [ + ("textcat", make_get_examples_single_label), + ("textcat_multilabel", make_get_examples_multi_label), + ], +) +def test_invalid_label_value(name, get_examples): + nlp = Language() + textcat = nlp.add_pipe(name) + example_getter = get_examples(nlp) + + def invalid_examples(): + # make one example with an invalid score + examples = example_getter() + ref = examples[0].reference + key = list(ref.cats.keys())[0] + ref.cats[key] = 2.0 + return examples + + with pytest.raises(ValueError): + nlp.initialize(get_examples=invalid_examples) + + +@pytest.mark.parametrize("name", ["textcat", "textcat_multilabel"]) +def test_no_label(name): + nlp = Language() + nlp.add_pipe(name) + with pytest.raises(ValueError): + nlp.initialize() + + +@pytest.mark.parametrize( + "name,get_examples", + [ + ("textcat", make_get_examples_single_label), + ("textcat_multilabel", make_get_examples_multi_label), + ], +) +def test_implicit_label(name, get_examples): + nlp = Language() + nlp.add_pipe(name) + nlp.initialize(get_examples=get_examples(nlp)) + + +# fmt: off +@pytest.mark.slow +@pytest.mark.parametrize( + "name,textcat_config", + [ + # BOW V1 + ("textcat", {"@architectures": "spacy.TextCatBOW.v1", "exclusive_classes": True, "no_output_layer": False, "ngram_size": 3}), + ("textcat", {"@architectures": "spacy.TextCatBOW.v1", "exclusive_classes": True, "no_output_layer": True, "ngram_size": 3}), + ("textcat_multilabel", {"@architectures": "spacy.TextCatBOW.v1", "exclusive_classes": False, "no_output_layer": False, "ngram_size": 3}), + ("textcat_multilabel", {"@architectures": "spacy.TextCatBOW.v1", "exclusive_classes": False, "no_output_layer": True, "ngram_size": 3}), + # ENSEMBLE V1 + ("textcat", {"@architectures": "spacy.TextCatEnsemble.v1", "exclusive_classes": False, "pretrained_vectors": None, "width": 64, "embed_size": 2000, "conv_depth": 2, "window_size": 1, "ngram_size": 1, "dropout": None}), + ("textcat_multilabel", {"@architectures": "spacy.TextCatEnsemble.v1", "exclusive_classes": False, "pretrained_vectors": None, "width": 64, "embed_size": 2000, "conv_depth": 2, "window_size": 1, "ngram_size": 1, "dropout": None}), + # ENSEMBLE V2 + ("textcat", {"@architectures": "spacy.TextCatEnsemble.v2", "tok2vec": DEFAULT_TOK2VEC_MODEL, "linear_model": {"@architectures": "spacy.TextCatBOW.v1", "exclusive_classes": True, "no_output_layer": False, "ngram_size": 3}}), + ("textcat", {"@architectures": "spacy.TextCatEnsemble.v2", "tok2vec": DEFAULT_TOK2VEC_MODEL, "linear_model": {"@architectures": "spacy.TextCatBOW.v1", "exclusive_classes": True, "no_output_layer": True, "ngram_size": 3}}), + ("textcat_multilabel", {"@architectures": "spacy.TextCatEnsemble.v2", "tok2vec": DEFAULT_TOK2VEC_MODEL, "linear_model": {"@architectures": "spacy.TextCatBOW.v1", "exclusive_classes": False, "no_output_layer": False, "ngram_size": 3}}), + ("textcat_multilabel", {"@architectures": "spacy.TextCatEnsemble.v2", "tok2vec": DEFAULT_TOK2VEC_MODEL, "linear_model": {"@architectures": "spacy.TextCatBOW.v1", "exclusive_classes": False, "no_output_layer": True, "ngram_size": 3}}), + # CNN + ("textcat", {"@architectures": "spacy.TextCatCNN.v1", "tok2vec": DEFAULT_TOK2VEC_MODEL, "exclusive_classes": True}), + ("textcat_multilabel", {"@architectures": "spacy.TextCatCNN.v1", "tok2vec": DEFAULT_TOK2VEC_MODEL, "exclusive_classes": False}), + ], +) +# fmt: on +def test_no_resize(name, textcat_config): + """The old textcat architectures weren't resizable""" + nlp = Language() + pipe_config = {"model": textcat_config} + textcat = nlp.add_pipe(name, config=pipe_config) + textcat.add_label("POSITIVE") + textcat.add_label("NEGATIVE") + nlp.initialize() + assert textcat.model.maybe_get_dim("nO") in [2, None] + # this throws an error because the textcat can't be resized after initialization + with pytest.raises(ValueError): + textcat.add_label("NEUTRAL") + + +# fmt: off +@pytest.mark.parametrize( + "name,textcat_config", + [ + # BOW V3 + ("textcat", {"@architectures": "spacy.TextCatBOW.v3", "exclusive_classes": True, "no_output_layer": False, "ngram_size": 3}), + ("textcat", {"@architectures": "spacy.TextCatBOW.v3", "exclusive_classes": True, "no_output_layer": True, "ngram_size": 3}), + ("textcat_multilabel", {"@architectures": "spacy.TextCatBOW.v3", "exclusive_classes": False, "no_output_layer": False, "ngram_size": 3}), + ("textcat_multilabel", {"@architectures": "spacy.TextCatBOW.v3", "exclusive_classes": False, "no_output_layer": True, "ngram_size": 3}), + # CNN + ("textcat", {"@architectures": "spacy.TextCatReduce.v1", "tok2vec": DEFAULT_TOK2VEC_MODEL, "exclusive_classes": True, "use_reduce_first": True, "use_reduce_last": True, "use_reduce_max": True, "use_reduce_mean": True}), + ("textcat_multilabel", {"@architectures": "spacy.TextCatReduce.v1", "tok2vec": DEFAULT_TOK2VEC_MODEL, "exclusive_classes": False, "use_reduce_first": True, "use_reduce_last": True, "use_reduce_max": True, "use_reduce_mean": True}), + ], +) +# fmt: on +def test_resize(name, textcat_config): + """The new textcat architectures are resizable""" + nlp = Language() + pipe_config = {"model": textcat_config} + textcat = nlp.add_pipe(name, config=pipe_config) + textcat.add_label("POSITIVE") + textcat.add_label("NEGATIVE") + assert textcat.model.maybe_get_dim("nO") in [2, None] + nlp.initialize() + assert textcat.model.maybe_get_dim("nO") in [2, None] + textcat.add_label("NEUTRAL") + assert textcat.model.maybe_get_dim("nO") in [3, None] + + +# fmt: off +@pytest.mark.parametrize( + "name,textcat_config", + [ + # BOW v3 + ("textcat", {"@architectures": "spacy.TextCatBOW.v3", "exclusive_classes": True, "no_output_layer": False, "ngram_size": 3}), + ("textcat", {"@architectures": "spacy.TextCatBOW.v3", "exclusive_classes": True, "no_output_layer": True, "ngram_size": 3}), + ("textcat_multilabel", {"@architectures": "spacy.TextCatBOW.v3", "exclusive_classes": False, "no_output_layer": False, "ngram_size": 3}), + ("textcat_multilabel", {"@architectures": "spacy.TextCatBOW.v3", "exclusive_classes": False, "no_output_layer": True, "ngram_size": 3}), + # REDUCE + ("textcat", {"@architectures": "spacy.TextCatReduce.v1", "tok2vec": DEFAULT_TOK2VEC_MODEL, "exclusive_classes": True, "use_reduce_first": True, "use_reduce_last": True, "use_reduce_max": True, "use_reduce_mean": True}), + ("textcat_multilabel", {"@architectures": "spacy.TextCatReduce.v1", "tok2vec": DEFAULT_TOK2VEC_MODEL, "exclusive_classes": False, "use_reduce_first": True, "use_reduce_last": True, "use_reduce_max": True, "use_reduce_mean": True}), + ], +) +# fmt: on +def test_resize_same_results(name, textcat_config): + # Ensure that the resized textcat classifiers still produce the same results for old labels + fix_random_seed(0) + nlp = English() + pipe_config = {"model": textcat_config} + textcat = nlp.add_pipe(name, config=pipe_config) + + train_examples = [] + for text, annotations in TRAIN_DATA_SINGLE_LABEL: + train_examples.append(Example.from_dict(nlp.make_doc(text), annotations)) + optimizer = nlp.initialize(get_examples=lambda: train_examples) + assert textcat.model.maybe_get_dim("nO") in [2, None] + + for i in range(5): + losses = {} + nlp.update(train_examples, sgd=optimizer, losses=losses) + + # test the trained model before resizing + test_text = "I am happy." + doc = nlp(test_text) + assert len(doc.cats) == 2 + pos_pred = doc.cats["POSITIVE"] + neg_pred = doc.cats["NEGATIVE"] + + # test the trained model again after resizing + textcat.add_label("NEUTRAL") + doc = nlp(test_text) + assert len(doc.cats) == 3 + assert doc.cats["POSITIVE"] == pos_pred + assert doc.cats["NEGATIVE"] == neg_pred + assert doc.cats["NEUTRAL"] <= 1 + + for i in range(5): + losses = {} + nlp.update(train_examples, sgd=optimizer, losses=losses) + + # test the trained model again after training further with new label + doc = nlp(test_text) + assert len(doc.cats) == 3 + assert doc.cats["POSITIVE"] != pos_pred + assert doc.cats["NEGATIVE"] != neg_pred + for cat in doc.cats: + assert doc.cats[cat] <= 1 + + +def test_error_with_multi_labels(): + nlp = Language() + nlp.add_pipe("textcat") + train_examples = [] + for text, annotations in TRAIN_DATA_MULTI_LABEL: + train_examples.append(Example.from_dict(nlp.make_doc(text), annotations)) + with pytest.raises(ValueError): + nlp.initialize(get_examples=lambda: train_examples) + + +# fmt: off +@pytest.mark.parametrize( + "name,textcat_config", + [ + # ENSEMBLE V2 + ("textcat_multilabel", {"@architectures": "spacy.TextCatEnsemble.v2", "tok2vec": LAZY_INIT_TOK2VEC_MODEL, "linear_model": {"@architectures": "spacy.TextCatBOW.v3", "exclusive_classes": False, "ngram_size": 1, "no_output_layer": False}}), + ("textcat", {"@architectures": "spacy.TextCatEnsemble.v2", "tok2vec": LAZY_INIT_TOK2VEC_MODEL, "linear_model": {"@architectures": "spacy.TextCatBOW.v3", "exclusive_classes": True, "ngram_size": 5, "no_output_layer": False}}), + # PARAMETRIC ATTENTION V1 + ("textcat", {"@architectures": "spacy.TextCatParametricAttention.v1", "tok2vec": LAZY_INIT_TOK2VEC_MODEL, "exclusive_classes": True}), + ("textcat_multilabel", {"@architectures": "spacy.TextCatParametricAttention.v1", "tok2vec": LAZY_INIT_TOK2VEC_MODEL, "exclusive_classes": False}), + # REDUCE + ("textcat", {"@architectures": "spacy.TextCatReduce.v1", "tok2vec": LAZY_INIT_TOK2VEC_MODEL, "exclusive_classes": True, "use_reduce_first": True, "use_reduce_last": True, "use_reduce_max": True, "use_reduce_mean": True}), + ("textcat_multilabel", {"@architectures": "spacy.TextCatReduce.v1", "tok2vec": LAZY_INIT_TOK2VEC_MODEL, "exclusive_classes": False, "use_reduce_first": True, "use_reduce_last": True, "use_reduce_max": True, "use_reduce_mean": True}), + ], +) +# fmt: on +def test_tok2vec_lazy_init(name, textcat_config): + # Check that we can properly initialize and use a textcat model using + # a lazily-initialized tok2vec. + nlp = English() + pipe_config = {"model": textcat_config} + textcat = nlp.add_pipe(name, config=pipe_config) + textcat.add_label("POSITIVE") + textcat.add_label("NEGATIVE") + nlp.initialize() + nlp.pipe(["This is a test."]) + + +@pytest.mark.parametrize( + "name,get_examples, train_data", + [ + ("textcat", make_get_examples_single_label, TRAIN_DATA_SINGLE_LABEL), + ("textcat_multilabel", make_get_examples_multi_label, TRAIN_DATA_MULTI_LABEL), + ], +) +def test_initialize_examples(name, get_examples, train_data): + nlp = Language() + textcat = nlp.add_pipe(name) + for text, annotations in train_data: + for label, value in annotations.get("cats").items(): + textcat.add_label(label) + # you shouldn't really call this more than once, but for testing it should be fine + nlp.initialize() + nlp.initialize(get_examples=get_examples(nlp)) + with pytest.raises(TypeError): + nlp.initialize(get_examples=lambda: None) + with pytest.raises(TypeError): + nlp.initialize(get_examples=get_examples()) + + +def test_overfitting_IO(): + # Simple test to try and quickly overfit the single-label textcat component - ensuring the ML models work correctly + fix_random_seed(0) + nlp = English() + textcat = nlp.add_pipe("textcat") + + train_examples = [] + for text, annotations in TRAIN_DATA_SINGLE_LABEL: + train_examples.append(Example.from_dict(nlp.make_doc(text), annotations)) + optimizer = nlp.initialize(get_examples=lambda: train_examples) + assert textcat.model.get_dim("nO") == 2 + + for i in range(50): + losses = {} + nlp.update(train_examples, sgd=optimizer, losses=losses) + assert losses["textcat"] < 0.01 + + # test the trained model + test_text = "I am happy." + doc = nlp(test_text) + cats = doc.cats + assert cats["POSITIVE"] > 0.9 + assert cats["POSITIVE"] + cats["NEGATIVE"] == pytest.approx(1.0, 0.001) + + # Also test the results are still the same after IO + with make_tempdir() as tmp_dir: + nlp.to_disk(tmp_dir) + nlp2 = util.load_model_from_path(tmp_dir) + doc2 = nlp2(test_text) + cats2 = doc2.cats + assert cats2["POSITIVE"] > 0.9 + assert cats2["POSITIVE"] + cats2["NEGATIVE"] == pytest.approx(1.0, 0.001) + + # Test scoring + scores = nlp.evaluate(train_examples) + assert scores["cats_micro_f"] == 1.0 + assert scores["cats_macro_f"] == 1.0 + assert scores["cats_macro_auc"] == 1.0 + assert scores["cats_score"] == 1.0 + assert "cats_score_desc" in scores + + # Make sure that running pipe twice, or comparing to call, always amounts to the same predictions + texts = ["Just a sentence.", "I like green eggs.", "I am happy.", "I eat ham."] + batch_cats_1 = [doc.cats for doc in nlp.pipe(texts)] + batch_cats_2 = [doc.cats for doc in nlp.pipe(texts)] + no_batch_cats = [doc.cats for doc in [nlp(text) for text in texts]] + for cats_1, cats_2 in zip(batch_cats_1, batch_cats_2): + for cat in cats_1: + assert_almost_equal(cats_1[cat], cats_2[cat], decimal=5) + for cats_1, cats_2 in zip(batch_cats_1, no_batch_cats): + for cat in cats_1: + assert_almost_equal(cats_1[cat], cats_2[cat], decimal=5) + + +def test_overfitting_IO_multi(): + # Simple test to try and quickly overfit the multi-label textcat component - ensuring the ML models work correctly + fix_random_seed(0) + nlp = English() + textcat = nlp.add_pipe("textcat_multilabel") + + train_examples = [] + for text, annotations in TRAIN_DATA_MULTI_LABEL: + train_examples.append(Example.from_dict(nlp.make_doc(text), annotations)) + optimizer = nlp.initialize(get_examples=lambda: train_examples) + assert textcat.model.get_dim("nO") == 3 + + for i in range(100): + losses = {} + nlp.update(train_examples, sgd=optimizer, losses=losses) + assert losses["textcat_multilabel"] < 0.01 + + # test the trained model + test_text = "I am confused but happy." + doc = nlp(test_text) + cats = doc.cats + assert cats["HAPPY"] > 0.9 + assert cats["CONFUSED"] > 0.9 + + # Also test the results are still the same after IO + with make_tempdir() as tmp_dir: + nlp.to_disk(tmp_dir) + nlp2 = util.load_model_from_path(tmp_dir) + doc2 = nlp2(test_text) + cats2 = doc2.cats + assert cats2["HAPPY"] > 0.9 + assert cats2["CONFUSED"] > 0.9 + + # Test scoring + scores = nlp.evaluate(train_examples) + assert scores["cats_micro_f"] == 1.0 + assert scores["cats_macro_f"] == 1.0 + assert "cats_score_desc" in scores + + # Make sure that running pipe twice, or comparing to call, always amounts to the same predictions + texts = ["Just a sentence.", "I like green eggs.", "I am happy.", "I eat ham."] + batch_deps_1 = [doc.cats for doc in nlp.pipe(texts)] + batch_deps_2 = [doc.cats for doc in nlp.pipe(texts)] + no_batch_deps = [doc.cats for doc in [nlp(text) for text in texts]] + for cats_1, cats_2 in zip(batch_deps_1, batch_deps_2): + for cat in cats_1: + assert_almost_equal(cats_1[cat], cats_2[cat], decimal=5) + for cats_1, cats_2 in zip(batch_deps_1, no_batch_deps): + for cat in cats_1: + assert_almost_equal(cats_1[cat], cats_2[cat], decimal=5) + + +# fmt: off +@pytest.mark.slow +@pytest.mark.parametrize( + "name,train_data,textcat_config", + [ + # BOW V1 + ("textcat_multilabel", TRAIN_DATA_MULTI_LABEL, {"@architectures": "spacy.TextCatBOW.v1", "exclusive_classes": False, "ngram_size": 1, "no_output_layer": False}), + ("textcat", TRAIN_DATA_SINGLE_LABEL, {"@architectures": "spacy.TextCatBOW.v1", "exclusive_classes": True, "ngram_size": 4, "no_output_layer": False}), + # ENSEMBLE V1 + ("textcat_multilabel", TRAIN_DATA_MULTI_LABEL, {"@architectures": "spacy.TextCatEnsemble.v1", "exclusive_classes": False, "pretrained_vectors": None, "width": 64, "embed_size": 2000, "conv_depth": 2, "window_size": 1, "ngram_size": 1, "dropout": None}), + ("textcat", TRAIN_DATA_SINGLE_LABEL, {"@architectures": "spacy.TextCatEnsemble.v1", "exclusive_classes": False, "pretrained_vectors": None, "width": 64, "embed_size": 2000, "conv_depth": 2, "window_size": 1, "ngram_size": 1, "dropout": None}), + # CNN V1 + ("textcat", TRAIN_DATA_SINGLE_LABEL, {"@architectures": "spacy.TextCatCNN.v1", "tok2vec": DEFAULT_TOK2VEC_MODEL, "exclusive_classes": True}), + ("textcat_multilabel", TRAIN_DATA_MULTI_LABEL, {"@architectures": "spacy.TextCatCNN.v1", "tok2vec": DEFAULT_TOK2VEC_MODEL, "exclusive_classes": False}), + # BOW V2 + ("textcat_multilabel", TRAIN_DATA_MULTI_LABEL, {"@architectures": "spacy.TextCatBOW.v2", "exclusive_classes": False, "ngram_size": 1, "no_output_layer": False}), + ("textcat", TRAIN_DATA_SINGLE_LABEL, {"@architectures": "spacy.TextCatBOW.v2", "exclusive_classes": True, "ngram_size": 4, "no_output_layer": False}), + ("textcat_multilabel", TRAIN_DATA_MULTI_LABEL, {"@architectures": "spacy.TextCatBOW.v2", "exclusive_classes": False, "ngram_size": 3, "no_output_layer": True}), + ("textcat", TRAIN_DATA_SINGLE_LABEL, {"@architectures": "spacy.TextCatBOW.v2", "exclusive_classes": True, "ngram_size": 2, "no_output_layer": True}), + # BOW V3 + ("textcat_multilabel", TRAIN_DATA_MULTI_LABEL, {"@architectures": "spacy.TextCatBOW.v3", "exclusive_classes": False, "ngram_size": 1, "no_output_layer": False}), + ("textcat", TRAIN_DATA_SINGLE_LABEL, {"@architectures": "spacy.TextCatBOW.v3", "exclusive_classes": True, "ngram_size": 4, "no_output_layer": False}), + ("textcat_multilabel", TRAIN_DATA_MULTI_LABEL, {"@architectures": "spacy.TextCatBOW.v3", "exclusive_classes": False, "ngram_size": 3, "no_output_layer": True}), + ("textcat", TRAIN_DATA_SINGLE_LABEL, {"@architectures": "spacy.TextCatBOW.v3", "exclusive_classes": True, "ngram_size": 2, "no_output_layer": True}), + # ENSEMBLE V2 + ("textcat_multilabel", TRAIN_DATA_MULTI_LABEL, {"@architectures": "spacy.TextCatEnsemble.v2", "tok2vec": DEFAULT_TOK2VEC_MODEL, "linear_model": {"@architectures": "spacy.TextCatBOW.v3", "exclusive_classes": False, "ngram_size": 1, "no_output_layer": False}}), + ("textcat", TRAIN_DATA_SINGLE_LABEL, {"@architectures": "spacy.TextCatEnsemble.v2", "tok2vec": DEFAULT_TOK2VEC_MODEL, "linear_model": {"@architectures": "spacy.TextCatBOW.v3", "exclusive_classes": True, "ngram_size": 5, "no_output_layer": False}}), + # CNN V2 (legacy) + ("textcat", TRAIN_DATA_SINGLE_LABEL, {"@architectures": "spacy.TextCatCNN.v2", "tok2vec": DEFAULT_TOK2VEC_MODEL, "exclusive_classes": True}), + ("textcat_multilabel", TRAIN_DATA_MULTI_LABEL, {"@architectures": "spacy.TextCatCNN.v2", "tok2vec": DEFAULT_TOK2VEC_MODEL, "exclusive_classes": False}), + # PARAMETRIC ATTENTION V1 + ("textcat", TRAIN_DATA_SINGLE_LABEL, {"@architectures": "spacy.TextCatParametricAttention.v1", "tok2vec": DEFAULT_TOK2VEC_MODEL, "exclusive_classes": True}), + ("textcat_multilabel", TRAIN_DATA_MULTI_LABEL, {"@architectures": "spacy.TextCatParametricAttention.v1", "tok2vec": DEFAULT_TOK2VEC_MODEL, "exclusive_classes": False}), + # REDUCE V1 + ("textcat", TRAIN_DATA_SINGLE_LABEL, {"@architectures": "spacy.TextCatReduce.v1", "tok2vec": DEFAULT_TOK2VEC_MODEL, "exclusive_classes": True, "use_reduce_first": True, "use_reduce_last": True, "use_reduce_max": True, "use_reduce_mean": True}), + ("textcat_multilabel", TRAIN_DATA_MULTI_LABEL, {"@architectures": "spacy.TextCatReduce.v1", "tok2vec": DEFAULT_TOK2VEC_MODEL, "exclusive_classes": False, "use_reduce_first": True, "use_reduce_last": True, "use_reduce_max": True, "use_reduce_mean": True}), + ], +) +# fmt: on +def test_textcat_configs(name, train_data, textcat_config): + pipe_config = {"model": textcat_config} + nlp = English() + textcat = nlp.add_pipe(name, config=pipe_config) + train_examples = [] + for text, annotations in train_data: + train_examples.append(Example.from_dict(nlp.make_doc(text), annotations)) + for label, value in annotations.get("cats").items(): + textcat.add_label(label) + optimizer = nlp.initialize() + for i in range(5): + losses = {} + nlp.update(train_examples, sgd=optimizer, losses=losses) + + +def test_positive_class(): + nlp = English() + textcat = nlp.add_pipe("textcat") + get_examples = make_get_examples_single_label(nlp) + textcat.initialize(get_examples, labels=["POS", "NEG"], positive_label="POS") + assert textcat.labels == ("POS", "NEG") + assert textcat.cfg["positive_label"] == "POS" + + textcat_multilabel = nlp.add_pipe("textcat_multilabel") + get_examples = make_get_examples_multi_label(nlp) + with pytest.raises(TypeError): + textcat_multilabel.initialize( + get_examples, labels=["POS", "NEG"], positive_label="POS" + ) + textcat_multilabel.initialize(get_examples, labels=["FICTION", "DRAMA"]) + assert textcat_multilabel.labels == ("FICTION", "DRAMA") + assert "positive_label" not in textcat_multilabel.cfg + + +def test_positive_class_not_present(): + nlp = English() + textcat = nlp.add_pipe("textcat") + get_examples = make_get_examples_single_label(nlp) + with pytest.raises(ValueError): + textcat.initialize(get_examples, labels=["SOME", "THING"], positive_label="POS") + + +def test_positive_class_not_binary(): + nlp = English() + textcat = nlp.add_pipe("textcat") + get_examples = make_get_examples_multi_label(nlp) + with pytest.raises(ValueError): + textcat.initialize( + get_examples, labels=["SOME", "THING", "POS"], positive_label="POS" + ) + + +def test_textcat_evaluation(): + train_examples = [] + nlp = English() + ref1 = nlp("one") + ref1.cats = {"winter": 1.0, "summer": 1.0, "spring": 1.0, "autumn": 1.0} + pred1 = nlp("one") + pred1.cats = {"winter": 1.0, "summer": 0.0, "spring": 1.0, "autumn": 1.0} + train_examples.append(Example(pred1, ref1)) + + ref2 = nlp("two") + ref2.cats = {"winter": 0.0, "summer": 0.0, "spring": 1.0, "autumn": 1.0} + pred2 = nlp("two") + pred2.cats = {"winter": 1.0, "summer": 0.0, "spring": 0.0, "autumn": 1.0} + train_examples.append(Example(pred2, ref2)) + + scores = Scorer().score_cats( + train_examples, "cats", labels=["winter", "summer", "spring", "autumn"] + ) + assert scores["cats_f_per_type"]["winter"]["p"] == 1 / 2 + assert scores["cats_f_per_type"]["winter"]["r"] == 1 / 1 + assert scores["cats_f_per_type"]["summer"]["p"] == 0 + assert scores["cats_f_per_type"]["summer"]["r"] == 0 / 1 + assert scores["cats_f_per_type"]["spring"]["p"] == 1 / 1 + assert scores["cats_f_per_type"]["spring"]["r"] == 1 / 2 + assert scores["cats_f_per_type"]["autumn"]["p"] == 2 / 2 + assert scores["cats_f_per_type"]["autumn"]["r"] == 2 / 2 + + assert scores["cats_micro_p"] == 4 / 5 + assert scores["cats_micro_r"] == 4 / 6 + + +@pytest.mark.parametrize( + "multi_label,spring_p", + [(True, 1 / 1), (False, 1 / 2)], +) +def test_textcat_eval_missing(multi_label: bool, spring_p: float): + """ + multi-label: the missing 'spring' in gold_doc_2 doesn't incur a penalty + exclusive labels: the missing 'spring' in gold_doc_2 is interpreted as 0.0""" + train_examples = [] + nlp = English() + + ref1 = nlp("one") + ref1.cats = {"winter": 0.0, "summer": 0.0, "autumn": 0.0, "spring": 1.0} + pred1 = nlp("one") + pred1.cats = {"winter": 0.0, "summer": 0.0, "autumn": 0.0, "spring": 1.0} + train_examples.append(Example(ref1, pred1)) + + ref2 = nlp("two") + # reference 'spring' is missing, pred 'spring' is 1 + ref2.cats = {"winter": 0.0, "summer": 0.0, "autumn": 1.0} + pred2 = nlp("two") + pred2.cats = {"winter": 0.0, "summer": 0.0, "autumn": 0.0, "spring": 1.0} + train_examples.append(Example(pred2, ref2)) + + scores = Scorer().score_cats( + train_examples, + "cats", + labels=["winter", "summer", "spring", "autumn"], + multi_label=multi_label, + ) + assert scores["cats_f_per_type"]["spring"]["p"] == spring_p + assert scores["cats_f_per_type"]["spring"]["r"] == 1 / 1 + + +@pytest.mark.parametrize( + "multi_label,expected_loss", + [(True, 0), (False, 0.125)], +) +def test_textcat_loss(multi_label: bool, expected_loss: float): + """ + multi-label: the missing 'spring' in gold_doc_2 doesn't incur an increase in loss + exclusive labels: the missing 'spring' in gold_doc_2 is interpreted as 0.0 and adds to the loss + """ + train_examples = [] + nlp = English() + + doc1 = nlp("one") + cats1 = {"winter": 0.0, "summer": 0.0, "autumn": 0.0, "spring": 1.0} + train_examples.append(Example.from_dict(doc1, {"cats": cats1})) + + doc2 = nlp("two") + cats2 = {"winter": 0.0, "summer": 0.0, "autumn": 1.0} + train_examples.append(Example.from_dict(doc2, {"cats": cats2})) + + if multi_label: + textcat = nlp.add_pipe("textcat_multilabel") + else: + textcat = nlp.add_pipe("textcat") + assert isinstance(textcat, TextCategorizer) + textcat.initialize(lambda: train_examples) + scores = textcat.model.ops.asarray( + [[0.0, 0.0, 0.0, 1.0], [0.0, 0.0, 1.0, 1.0]], dtype="f" # type: ignore + ) + loss, d_scores = textcat.get_loss(train_examples, scores) + assert loss == expected_loss + + +def test_textcat_multilabel_threshold(): + # Ensure the scorer can be called with a different threshold + nlp = English() + nlp.add_pipe("textcat_multilabel") + + train_examples = [] + for text, annotations in TRAIN_DATA_SINGLE_LABEL: + train_examples.append(Example.from_dict(nlp.make_doc(text), annotations)) + nlp.initialize(get_examples=lambda: train_examples) + + # score the model (it's not actually trained but that doesn't matter) + scores = nlp.evaluate(train_examples) + assert 0 <= scores["cats_score"] <= 1 + + scores = nlp.evaluate(train_examples, scorer_cfg={"threshold": 1.0}) + assert scores["cats_f_per_type"]["POSITIVE"]["r"] == 0 + + scores = nlp.evaluate(train_examples, scorer_cfg={"threshold": 0}) + macro_f = scores["cats_score"] + assert scores["cats_f_per_type"]["POSITIVE"]["r"] == 1.0 + + scores = nlp.evaluate( + train_examples, scorer_cfg={"threshold": 0, "positive_label": "POSITIVE"} + ) + pos_f = scores["cats_score"] + assert scores["cats_f_per_type"]["POSITIVE"]["r"] == 1.0 + assert pos_f >= macro_f + + +def test_textcat_multi_threshold(): + # Ensure the scorer can be called with a different threshold + nlp = English() + nlp.add_pipe("textcat_multilabel") + + train_examples = [] + for text, annotations in TRAIN_DATA_SINGLE_LABEL: + train_examples.append(Example.from_dict(nlp.make_doc(text), annotations)) + nlp.initialize(get_examples=lambda: train_examples) + + # score the model (it's not actually trained but that doesn't matter) + scores = nlp.evaluate(train_examples) + assert 0 <= scores["cats_score"] <= 1 + + scores = nlp.evaluate(train_examples, scorer_cfg={"threshold": 1.0}) + assert scores["cats_f_per_type"]["POSITIVE"]["r"] == 0 + + scores = nlp.evaluate(train_examples, scorer_cfg={"threshold": 0}) + assert scores["cats_f_per_type"]["POSITIVE"]["r"] == 1.0 + + +@pytest.mark.parametrize( + "component_name,scorer", + [ + ("textcat", "spacy.textcat_scorer.v1"), + ("textcat_multilabel", "spacy.textcat_multilabel_scorer.v1"), + ], +) +def test_textcat_legacy_scorers(component_name, scorer): + """Check that legacy scorers are registered and produce the expected score + keys.""" + nlp = English() + nlp.add_pipe(component_name, config={"scorer": {"@scorers": scorer}}) + + train_examples = [] + for text, annotations in TRAIN_DATA_SINGLE_LABEL: + train_examples.append(Example.from_dict(nlp.make_doc(text), annotations)) + nlp.initialize(get_examples=lambda: train_examples) + + # score the model (it's not actually trained but that doesn't matter) + scores = nlp.evaluate(train_examples) + assert 0 <= scores["cats_score"] <= 1 diff --git a/TTS/Kokoro/.venv/Lib/site-packages/spacy/tests/pipeline/test_tok2vec.py b/TTS/Kokoro/.venv/Lib/site-packages/spacy/tests/pipeline/test_tok2vec.py new file mode 100644 index 0000000000000000000000000000000000000000..eb3c9783ddf3f62e3bc587819cf47baf5c72b34e --- /dev/null +++ b/TTS/Kokoro/.venv/Lib/site-packages/spacy/tests/pipeline/test_tok2vec.py @@ -0,0 +1,615 @@ +import pytest +from numpy.testing import assert_array_equal +from thinc.api import Config, get_current_ops + +from spacy import util +from spacy.lang.en import English +from spacy.ml.models.tok2vec import ( + MaxoutWindowEncoder, + MultiHashEmbed, + build_Tok2Vec_model, +) +from spacy.pipeline.tok2vec import Tok2Vec, Tok2VecListener +from spacy.tokens import Doc +from spacy.training import Example +from spacy.util import registry +from spacy.vocab import Vocab + +from ..util import add_vecs_to_vocab, get_batch, make_tempdir + + +def test_empty_doc(): + width = 128 + embed_size = 2000 + vocab = Vocab() + doc = Doc(vocab, words=[]) + tok2vec = build_Tok2Vec_model( + MultiHashEmbed( + width=width, + rows=[embed_size, embed_size, embed_size, embed_size], + include_static_vectors=False, + attrs=["NORM", "PREFIX", "SUFFIX", "SHAPE"], + ), + MaxoutWindowEncoder(width=width, depth=4, window_size=1, maxout_pieces=3), + ) + tok2vec.initialize() + vectors, backprop = tok2vec.begin_update([doc]) + assert len(vectors) == 1 + assert vectors[0].shape == (0, width) + + +@pytest.mark.parametrize( + "batch_size,width,embed_size", [[1, 128, 2000], [2, 128, 2000], [3, 8, 63]] +) +def test_tok2vec_batch_sizes(batch_size, width, embed_size): + batch = get_batch(batch_size) + tok2vec = build_Tok2Vec_model( + MultiHashEmbed( + width=width, + rows=[embed_size] * 4, + include_static_vectors=False, + attrs=["NORM", "PREFIX", "SUFFIX", "SHAPE"], + ), + MaxoutWindowEncoder(width=width, depth=4, window_size=1, maxout_pieces=3), + ) + tok2vec.initialize() + vectors, backprop = tok2vec.begin_update(batch) + assert len(vectors) == len(batch) + for doc_vec, doc in zip(vectors, batch): + assert doc_vec.shape == (len(doc), width) + + +@pytest.mark.slow +@pytest.mark.parametrize("width", [8]) +@pytest.mark.parametrize( + "embed_arch,embed_config", + # fmt: off + [ + ("spacy.MultiHashEmbed.v1", {"rows": [100, 100], "attrs": ["SHAPE", "LOWER"], "include_static_vectors": False}), + ("spacy.MultiHashEmbed.v1", {"rows": [100, 20], "attrs": ["ORTH", "PREFIX"], "include_static_vectors": False}), + ("spacy.CharacterEmbed.v1", {"rows": 100, "nM": 64, "nC": 8, "include_static_vectors": False}), + ("spacy.CharacterEmbed.v1", {"rows": 100, "nM": 16, "nC": 2, "include_static_vectors": False}), + ], + # fmt: on +) +@pytest.mark.parametrize( + "tok2vec_arch,encode_arch,encode_config", + # fmt: off + [ + ("spacy.Tok2Vec.v1", "spacy.MaxoutWindowEncoder.v1", {"window_size": 1, "maxout_pieces": 3, "depth": 2}), + ("spacy.Tok2Vec.v2", "spacy.MaxoutWindowEncoder.v2", {"window_size": 1, "maxout_pieces": 3, "depth": 2}), + ("spacy.Tok2Vec.v1", "spacy.MishWindowEncoder.v1", {"window_size": 1, "depth": 6}), + ("spacy.Tok2Vec.v2", "spacy.MishWindowEncoder.v2", {"window_size": 1, "depth": 6}), + ], + # fmt: on +) +def test_tok2vec_configs( + width, tok2vec_arch, embed_arch, embed_config, encode_arch, encode_config +): + embed = registry.get("architectures", embed_arch) + encode = registry.get("architectures", encode_arch) + tok2vec_model = registry.get("architectures", tok2vec_arch) + + embed_config["width"] = width + encode_config["width"] = width + docs = get_batch(3) + tok2vec = tok2vec_model(embed(**embed_config), encode(**encode_config)) + tok2vec.initialize(docs) + vectors, backprop = tok2vec.begin_update(docs) + assert len(vectors) == len(docs) + assert vectors[0].shape == (len(docs[0]), width) + backprop(vectors) + + +def test_init_tok2vec(): + # Simple test to initialize the default tok2vec + nlp = English() + tok2vec = nlp.add_pipe("tok2vec") + assert tok2vec.listeners == [] + nlp.initialize() + assert tok2vec.model.get_dim("nO") + + +cfg_string = """ + [nlp] + lang = "en" + pipeline = ["tok2vec","tagger"] + + [components] + + [components.tagger] + factory = "tagger" + + [components.tagger.model] + @architectures = "spacy.Tagger.v2" + nO = null + + [components.tagger.model.tok2vec] + @architectures = "spacy.Tok2VecListener.v1" + width = ${components.tok2vec.model.encode.width} + + [components.tok2vec] + factory = "tok2vec" + + [components.tok2vec.model] + @architectures = "spacy.Tok2Vec.v2" + + [components.tok2vec.model.embed] + @architectures = "spacy.MultiHashEmbed.v1" + width = ${components.tok2vec.model.encode.width} + rows = [2000, 1000, 1000, 1000] + attrs = ["NORM", "PREFIX", "SUFFIX", "SHAPE"] + include_static_vectors = false + + [components.tok2vec.model.encode] + @architectures = "spacy.MaxoutWindowEncoder.v2" + width = 96 + depth = 4 + window_size = 1 + maxout_pieces = 3 + """ + +TRAIN_DATA = [ + ( + "I like green eggs", + {"tags": ["N", "V", "J", "N"], "cats": {"preference": 1.0, "imperative": 0.0}}, + ), + ( + "Eat blue ham", + {"tags": ["V", "J", "N"], "cats": {"preference": 0.0, "imperative": 1.0}}, + ), +] + + +@pytest.mark.parametrize("with_vectors", (False, True)) +def test_tok2vec_listener(with_vectors): + orig_config = Config().from_str(cfg_string) + orig_config["components"]["tok2vec"]["model"]["embed"][ + "include_static_vectors" + ] = with_vectors + nlp = util.load_model_from_config(orig_config, auto_fill=True, validate=True) + + if with_vectors: + ops = get_current_ops() + vectors = [ + ("apple", ops.asarray([1, 2, 3])), + ("orange", ops.asarray([-1, -2, -3])), + ("and", ops.asarray([-1, -1, -1])), + ("juice", ops.asarray([5, 5, 10])), + ("pie", ops.asarray([7, 6.3, 8.9])), + ] + add_vecs_to_vocab(nlp.vocab, vectors) + + assert nlp.pipe_names == ["tok2vec", "tagger"] + tagger = nlp.get_pipe("tagger") + tok2vec = nlp.get_pipe("tok2vec") + tagger_tok2vec = tagger.model.get_ref("tok2vec") + assert isinstance(tok2vec, Tok2Vec) + assert isinstance(tagger_tok2vec, Tok2VecListener) + train_examples = [] + for t in TRAIN_DATA: + train_examples.append(Example.from_dict(nlp.make_doc(t[0]), t[1])) + for tag in t[1]["tags"]: + tagger.add_label(tag) + + # Check that the Tok2Vec component finds its listeners + optimizer = nlp.initialize(lambda: train_examples) + assert tok2vec.listeners == [tagger_tok2vec] + + for i in range(5): + losses = {} + nlp.update(train_examples, sgd=optimizer, losses=losses) + + doc = nlp("Running the pipeline as a whole.") + doc_tensor = tagger_tok2vec.predict([doc])[0] + ops = get_current_ops() + assert_array_equal(ops.to_numpy(doc.tensor), ops.to_numpy(doc_tensor)) + + # test with empty doc + doc = nlp("") + + # TODO: should this warn or error? + nlp.select_pipes(disable="tok2vec") + assert nlp.pipe_names == ["tagger"] + nlp("Running the pipeline with the Tok2Vec component disabled.") + + +def test_tok2vec_listener_callback(): + orig_config = Config().from_str(cfg_string) + nlp = util.load_model_from_config(orig_config, auto_fill=True, validate=True) + assert nlp.pipe_names == ["tok2vec", "tagger"] + tagger = nlp.get_pipe("tagger") + tok2vec = nlp.get_pipe("tok2vec") + docs = [nlp.make_doc("A random sentence")] + tok2vec.model.initialize(X=docs) + gold_array = [[1.0 for tag in ["V", "Z"]] for word in docs] + label_sample = [tagger.model.ops.asarray(gold_array, dtype="float32")] + tagger.model.initialize(X=docs, Y=label_sample) + docs = [nlp.make_doc("Another entirely random sentence")] + tok2vec.update([Example.from_dict(x, {}) for x in docs]) + Y, get_dX = tagger.model.begin_update(docs) + # assure that the backprop call works (and doesn't hit a 'None' callback) + assert get_dX(Y) is not None + + +def test_tok2vec_listener_overfitting(): + """Test that a pipeline with a listener properly overfits, even if 'tok2vec' is in the annotating components""" + orig_config = Config().from_str(cfg_string) + nlp = util.load_model_from_config(orig_config, auto_fill=True, validate=True) + train_examples = [] + for t in TRAIN_DATA: + train_examples.append(Example.from_dict(nlp.make_doc(t[0]), t[1])) + optimizer = nlp.initialize(get_examples=lambda: train_examples) + + for i in range(50): + losses = {} + nlp.update(train_examples, sgd=optimizer, losses=losses, annotates=["tok2vec"]) + assert losses["tagger"] < 0.00001 + + # test the trained model + test_text = "I like blue eggs" + doc = nlp(test_text) + assert doc[0].tag_ == "N" + assert doc[1].tag_ == "V" + assert doc[2].tag_ == "J" + assert doc[3].tag_ == "N" + + # Also test the results are still the same after IO + with make_tempdir() as tmp_dir: + nlp.to_disk(tmp_dir) + nlp2 = util.load_model_from_path(tmp_dir) + doc2 = nlp2(test_text) + assert doc2[0].tag_ == "N" + assert doc2[1].tag_ == "V" + assert doc2[2].tag_ == "J" + assert doc2[3].tag_ == "N" + + +def test_tok2vec_frozen_not_annotating(): + """Test that a pipeline with a frozen tok2vec raises an error when the tok2vec is not annotating""" + orig_config = Config().from_str(cfg_string) + nlp = util.load_model_from_config(orig_config, auto_fill=True, validate=True) + train_examples = [] + for t in TRAIN_DATA: + train_examples.append(Example.from_dict(nlp.make_doc(t[0]), t[1])) + optimizer = nlp.initialize(get_examples=lambda: train_examples) + + for i in range(2): + losses = {} + with pytest.raises( + ValueError, match=r"the tok2vec embedding layer is not updated" + ): + nlp.update( + train_examples, sgd=optimizer, losses=losses, exclude=["tok2vec"] + ) + + +def test_tok2vec_frozen_overfitting(): + """Test that a pipeline with a frozen & annotating tok2vec can still overfit""" + orig_config = Config().from_str(cfg_string) + nlp = util.load_model_from_config(orig_config, auto_fill=True, validate=True) + train_examples = [] + for t in TRAIN_DATA: + train_examples.append(Example.from_dict(nlp.make_doc(t[0]), t[1])) + optimizer = nlp.initialize(get_examples=lambda: train_examples) + + for i in range(100): + losses = {} + nlp.update( + train_examples, + sgd=optimizer, + losses=losses, + exclude=["tok2vec"], + annotates=["tok2vec"], + ) + assert losses["tagger"] < 0.0001 + + # test the trained model + test_text = "I like blue eggs" + doc = nlp(test_text) + assert doc[0].tag_ == "N" + assert doc[1].tag_ == "V" + assert doc[2].tag_ == "J" + assert doc[3].tag_ == "N" + + # Also test the results are still the same after IO + with make_tempdir() as tmp_dir: + nlp.to_disk(tmp_dir) + nlp2 = util.load_model_from_path(tmp_dir) + doc2 = nlp2(test_text) + assert doc2[0].tag_ == "N" + assert doc2[1].tag_ == "V" + assert doc2[2].tag_ == "J" + assert doc2[3].tag_ == "N" + + +def test_replace_listeners(): + orig_config = Config().from_str(cfg_string) + nlp = util.load_model_from_config(orig_config, auto_fill=True, validate=True) + examples = [Example.from_dict(nlp.make_doc("x y"), {"tags": ["V", "Z"]})] + nlp.initialize(lambda: examples) + tok2vec = nlp.get_pipe("tok2vec") + tagger = nlp.get_pipe("tagger") + assert isinstance(tagger.model.layers[0], Tok2VecListener) + assert tok2vec.listener_map["tagger"][0] == tagger.model.layers[0] + assert ( + nlp.config["components"]["tok2vec"]["model"]["@architectures"] + == "spacy.Tok2Vec.v2" + ) + assert ( + nlp.config["components"]["tagger"]["model"]["tok2vec"]["@architectures"] + == "spacy.Tok2VecListener.v1" + ) + nlp.replace_listeners("tok2vec", "tagger", ["model.tok2vec"]) + assert not isinstance(tagger.model.layers[0], Tok2VecListener) + t2v_cfg = nlp.config["components"]["tok2vec"]["model"] + assert t2v_cfg["@architectures"] == "spacy.Tok2Vec.v2" + assert nlp.config["components"]["tagger"]["model"]["tok2vec"] == t2v_cfg + with pytest.raises(ValueError): + nlp.replace_listeners("invalid", "tagger", ["model.tok2vec"]) + with pytest.raises(ValueError): + nlp.replace_listeners("tok2vec", "parser", ["model.tok2vec"]) + with pytest.raises(ValueError): + nlp.replace_listeners("tok2vec", "tagger", ["model.yolo"]) + with pytest.raises(ValueError): + nlp.replace_listeners("tok2vec", "tagger", ["model.tok2vec", "model.yolo"]) + # attempt training with the new pipeline + optimizer = nlp.initialize(lambda: examples) + for i in range(2): + losses = {} + nlp.update(examples, sgd=optimizer, losses=losses) + assert losses["tok2vec"] == 0.0 + assert losses["tagger"] > 0.0 + + +cfg_string_multi = """ + [nlp] + lang = "en" + pipeline = ["tok2vec","tagger", "ner"] + + [components] + + [components.tagger] + factory = "tagger" + + [components.tagger.model] + @architectures = "spacy.Tagger.v2" + nO = null + + [components.tagger.model.tok2vec] + @architectures = "spacy.Tok2VecListener.v1" + width = ${components.tok2vec.model.encode.width} + + [components.ner] + factory = "ner" + + [components.ner.model] + @architectures = "spacy.TransitionBasedParser.v2" + + [components.ner.model.tok2vec] + @architectures = "spacy.Tok2VecListener.v1" + width = ${components.tok2vec.model.encode.width} + + [components.tok2vec] + factory = "tok2vec" + + [components.tok2vec.model] + @architectures = "spacy.Tok2Vec.v2" + + [components.tok2vec.model.embed] + @architectures = "spacy.MultiHashEmbed.v1" + width = ${components.tok2vec.model.encode.width} + rows = [2000, 1000, 1000, 1000] + attrs = ["NORM", "PREFIX", "SUFFIX", "SHAPE"] + include_static_vectors = false + + [components.tok2vec.model.encode] + @architectures = "spacy.MaxoutWindowEncoder.v2" + width = 96 + depth = 4 + window_size = 1 + maxout_pieces = 3 + """ + + +def test_replace_listeners_from_config(): + orig_config = Config().from_str(cfg_string_multi) + nlp = util.load_model_from_config(orig_config, auto_fill=True) + annots = {"tags": ["V", "Z"], "entities": [(0, 1, "A"), (1, 2, "B")]} + examples = [Example.from_dict(nlp.make_doc("x y"), annots)] + nlp.initialize(lambda: examples) + tok2vec = nlp.get_pipe("tok2vec") + tagger = nlp.get_pipe("tagger") + ner = nlp.get_pipe("ner") + assert tok2vec.listening_components == ["tagger", "ner"] + assert any(isinstance(node, Tok2VecListener) for node in ner.model.walk()) + assert any(isinstance(node, Tok2VecListener) for node in tagger.model.walk()) + with make_tempdir() as dir_path: + nlp.to_disk(dir_path) + base_model = str(dir_path) + new_config = { + "nlp": { + "lang": "en", + "pipeline": ["tok2vec", "tagger2", "ner3", "tagger4"], + }, + "components": { + "tok2vec": {"source": base_model}, + "tagger2": { + "source": base_model, + "component": "tagger", + "replace_listeners": ["model.tok2vec"], + }, + "ner3": { + "source": base_model, + "component": "ner", + }, + "tagger4": { + "source": base_model, + "component": "tagger", + }, + }, + } + new_nlp = util.load_model_from_config(new_config, auto_fill=True) + new_nlp.initialize(lambda: examples) + tok2vec = new_nlp.get_pipe("tok2vec") + tagger = new_nlp.get_pipe("tagger2") + ner = new_nlp.get_pipe("ner3") + assert "ner" not in new_nlp.pipe_names + assert "tagger" not in new_nlp.pipe_names + assert tok2vec.listening_components == ["ner3", "tagger4"] + assert any(isinstance(node, Tok2VecListener) for node in ner.model.walk()) + assert not any(isinstance(node, Tok2VecListener) for node in tagger.model.walk()) + t2v_cfg = new_nlp.config["components"]["tok2vec"]["model"] + assert t2v_cfg["@architectures"] == "spacy.Tok2Vec.v2" + assert new_nlp.config["components"]["tagger2"]["model"]["tok2vec"] == t2v_cfg + assert ( + new_nlp.config["components"]["ner3"]["model"]["tok2vec"]["@architectures"] + == "spacy.Tok2VecListener.v1" + ) + assert ( + new_nlp.config["components"]["tagger4"]["model"]["tok2vec"]["@architectures"] + == "spacy.Tok2VecListener.v1" + ) + + +cfg_string_multi_textcat = """ + [nlp] + lang = "en" + pipeline = ["tok2vec","textcat_multilabel","tagger"] + + [components] + + [components.textcat_multilabel] + factory = "textcat_multilabel" + + [components.textcat_multilabel.model] + @architectures = "spacy.TextCatEnsemble.v2" + nO = null + + [components.textcat_multilabel.model.tok2vec] + @architectures = "spacy.Tok2VecListener.v1" + width = ${components.tok2vec.model.encode.width} + + [components.textcat_multilabel.model.linear_model] + @architectures = "spacy.TextCatBOW.v1" + exclusive_classes = false + ngram_size = 1 + no_output_layer = false + + [components.tagger] + factory = "tagger" + + [components.tagger.model] + @architectures = "spacy.Tagger.v2" + nO = null + + [components.tagger.model.tok2vec] + @architectures = "spacy.Tok2VecListener.v1" + width = ${components.tok2vec.model.encode.width} + + [components.tok2vec] + factory = "tok2vec" + + [components.tok2vec.model] + @architectures = "spacy.Tok2Vec.v2" + + [components.tok2vec.model.embed] + @architectures = "spacy.MultiHashEmbed.v1" + width = ${components.tok2vec.model.encode.width} + rows = [2000, 1000, 1000, 1000] + attrs = ["NORM", "PREFIX", "SUFFIX", "SHAPE"] + include_static_vectors = false + + [components.tok2vec.model.encode] + @architectures = "spacy.MaxoutWindowEncoder.v2" + width = 96 + depth = 4 + window_size = 1 + maxout_pieces = 3 + """ + + +def test_tok2vec_listeners_textcat(): + orig_config = Config().from_str(cfg_string_multi_textcat) + nlp = util.load_model_from_config(orig_config, auto_fill=True, validate=True) + assert nlp.pipe_names == ["tok2vec", "textcat_multilabel", "tagger"] + tagger = nlp.get_pipe("tagger") + textcat = nlp.get_pipe("textcat_multilabel") + tok2vec = nlp.get_pipe("tok2vec") + tagger_tok2vec = tagger.model.get_ref("tok2vec") + textcat_tok2vec = textcat.model.get_ref("tok2vec") + assert isinstance(tok2vec, Tok2Vec) + assert isinstance(tagger_tok2vec, Tok2VecListener) + assert isinstance(textcat_tok2vec, Tok2VecListener) + train_examples = [] + for t in TRAIN_DATA: + train_examples.append(Example.from_dict(nlp.make_doc(t[0]), t[1])) + + optimizer = nlp.initialize(lambda: train_examples) + for i in range(50): + losses = {} + nlp.update(train_examples, sgd=optimizer, losses=losses) + + docs = list(nlp.pipe(["Eat blue ham", "I like green eggs"])) + cats0 = docs[0].cats + assert cats0["preference"] < 0.1 + assert cats0["imperative"] > 0.9 + cats1 = docs[1].cats + assert cats1["preference"] > 0.1 + assert cats1["imperative"] < 0.9 + assert [t.tag_ for t in docs[0]] == ["V", "J", "N"] + assert [t.tag_ for t in docs[1]] == ["N", "V", "J", "N"] + + +def test_tok2vec_listener_source_link_name(): + """The component's internal name and the tok2vec listener map correspond + to the most recently modified pipeline. + """ + orig_config = Config().from_str(cfg_string_multi) + nlp1 = util.load_model_from_config(orig_config, auto_fill=True, validate=True) + assert nlp1.get_pipe("tok2vec").listening_components == ["tagger", "ner"] + + nlp2 = English() + nlp2.add_pipe("tok2vec", source=nlp1) + nlp2.add_pipe("tagger", name="tagger2", source=nlp1) + + # there is no way to have the component have the right name for both + # pipelines, right now the most recently modified pipeline is prioritized + assert nlp1.get_pipe("tagger").name == nlp2.get_pipe("tagger2").name == "tagger2" + + # there is no way to have the tok2vec have the right listener map for both + # pipelines, right now the most recently modified pipeline is prioritized + assert nlp2.get_pipe("tok2vec").listening_components == ["tagger2"] + nlp2.add_pipe("ner", name="ner3", source=nlp1) + assert nlp2.get_pipe("tok2vec").listening_components == ["tagger2", "ner3"] + nlp2.remove_pipe("ner3") + assert nlp2.get_pipe("tok2vec").listening_components == ["tagger2"] + nlp2.remove_pipe("tagger2") + assert nlp2.get_pipe("tok2vec").listening_components == [] + + # at this point the tok2vec component corresponds to nlp2 + assert nlp1.get_pipe("tok2vec").listening_components == [] + + # modifying the nlp1 pipeline syncs the tok2vec listener map back to nlp1 + nlp1.add_pipe("sentencizer") + assert nlp1.get_pipe("tok2vec").listening_components == ["tagger", "ner"] + + # modifying nlp2 syncs it back to nlp2 + nlp2.add_pipe("sentencizer") + assert nlp1.get_pipe("tok2vec").listening_components == [] + + +def test_tok2vec_listener_source_replace_listeners(): + orig_config = Config().from_str(cfg_string_multi) + nlp1 = util.load_model_from_config(orig_config, auto_fill=True, validate=True) + assert nlp1.get_pipe("tok2vec").listening_components == ["tagger", "ner"] + nlp1.replace_listeners("tok2vec", "tagger", ["model.tok2vec"]) + assert nlp1.get_pipe("tok2vec").listening_components == ["ner"] + + nlp2 = English() + nlp2.add_pipe("tok2vec", source=nlp1) + assert nlp2.get_pipe("tok2vec").listening_components == [] + nlp2.add_pipe("tagger", source=nlp1) + assert nlp2.get_pipe("tok2vec").listening_components == [] + nlp2.add_pipe("ner", name="ner2", source=nlp1) + assert nlp2.get_pipe("tok2vec").listening_components == ["ner2"] diff --git a/TTS/Kokoro/.venv/Lib/site-packages/spacy/tests/serialize/__init__.py b/TTS/Kokoro/.venv/Lib/site-packages/spacy/tests/serialize/__init__.py new file mode 100644 index 0000000000000000000000000000000000000000..e69de29bb2d1d6434b8b29ae775ad8c2e48c5391 diff --git a/TTS/Kokoro/.venv/Lib/site-packages/spacy/tests/serialize/__pycache__/__init__.cpython-312.pyc b/TTS/Kokoro/.venv/Lib/site-packages/spacy/tests/serialize/__pycache__/__init__.cpython-312.pyc new file mode 100644 index 0000000000000000000000000000000000000000..039c2efd6a22b752445cf5648fce4d5e32599be7 Binary files /dev/null and b/TTS/Kokoro/.venv/Lib/site-packages/spacy/tests/serialize/__pycache__/__init__.cpython-312.pyc differ diff --git a/TTS/Kokoro/.venv/Lib/site-packages/spacy/tests/serialize/__pycache__/test_resource_warning.cpython-312.pyc b/TTS/Kokoro/.venv/Lib/site-packages/spacy/tests/serialize/__pycache__/test_resource_warning.cpython-312.pyc new file mode 100644 index 0000000000000000000000000000000000000000..1ed4ba60cbf2c03a27167f208e4c69c52b44fb3a Binary files /dev/null and b/TTS/Kokoro/.venv/Lib/site-packages/spacy/tests/serialize/__pycache__/test_resource_warning.cpython-312.pyc differ diff --git a/TTS/Kokoro/.venv/Lib/site-packages/spacy/tests/serialize/__pycache__/test_serialize_config.cpython-312.pyc b/TTS/Kokoro/.venv/Lib/site-packages/spacy/tests/serialize/__pycache__/test_serialize_config.cpython-312.pyc new file mode 100644 index 0000000000000000000000000000000000000000..33ad0a51e2b13a184a55691624787a4bc63535f7 Binary files /dev/null and b/TTS/Kokoro/.venv/Lib/site-packages/spacy/tests/serialize/__pycache__/test_serialize_config.cpython-312.pyc differ diff --git a/TTS/Kokoro/.venv/Lib/site-packages/spacy/tests/serialize/__pycache__/test_serialize_doc.cpython-312.pyc b/TTS/Kokoro/.venv/Lib/site-packages/spacy/tests/serialize/__pycache__/test_serialize_doc.cpython-312.pyc new file mode 100644 index 0000000000000000000000000000000000000000..be1474d82f5ffc424564e04ca96c39b0e6952360 Binary files /dev/null and b/TTS/Kokoro/.venv/Lib/site-packages/spacy/tests/serialize/__pycache__/test_serialize_doc.cpython-312.pyc differ diff --git a/TTS/Kokoro/.venv/Lib/site-packages/spacy/tests/serialize/__pycache__/test_serialize_docbin.cpython-312.pyc b/TTS/Kokoro/.venv/Lib/site-packages/spacy/tests/serialize/__pycache__/test_serialize_docbin.cpython-312.pyc new file mode 100644 index 0000000000000000000000000000000000000000..4efa6a7a561e69c6f9ac00042702133e0b7e3a70 Binary files /dev/null and b/TTS/Kokoro/.venv/Lib/site-packages/spacy/tests/serialize/__pycache__/test_serialize_docbin.cpython-312.pyc differ diff --git a/TTS/Kokoro/.venv/Lib/site-packages/spacy/tests/serialize/__pycache__/test_serialize_extension_attrs.cpython-312.pyc b/TTS/Kokoro/.venv/Lib/site-packages/spacy/tests/serialize/__pycache__/test_serialize_extension_attrs.cpython-312.pyc new file mode 100644 index 0000000000000000000000000000000000000000..60b62ff3eef412d84108d215ca30e9355a323f76 Binary files /dev/null and b/TTS/Kokoro/.venv/Lib/site-packages/spacy/tests/serialize/__pycache__/test_serialize_extension_attrs.cpython-312.pyc differ diff --git a/TTS/Kokoro/.venv/Lib/site-packages/spacy/tests/serialize/__pycache__/test_serialize_kb.cpython-312.pyc b/TTS/Kokoro/.venv/Lib/site-packages/spacy/tests/serialize/__pycache__/test_serialize_kb.cpython-312.pyc new file mode 100644 index 0000000000000000000000000000000000000000..231c5120fcb901ff1296862c8dac33d4276a364d Binary files /dev/null and b/TTS/Kokoro/.venv/Lib/site-packages/spacy/tests/serialize/__pycache__/test_serialize_kb.cpython-312.pyc differ diff --git a/TTS/Kokoro/.venv/Lib/site-packages/spacy/tests/serialize/__pycache__/test_serialize_language.cpython-312.pyc b/TTS/Kokoro/.venv/Lib/site-packages/spacy/tests/serialize/__pycache__/test_serialize_language.cpython-312.pyc new file mode 100644 index 0000000000000000000000000000000000000000..93e5669520e3016222c8a2c68624ff089c7ce239 Binary files /dev/null and b/TTS/Kokoro/.venv/Lib/site-packages/spacy/tests/serialize/__pycache__/test_serialize_language.cpython-312.pyc differ diff --git a/TTS/Kokoro/.venv/Lib/site-packages/spacy/tests/serialize/__pycache__/test_serialize_pipeline.cpython-312.pyc b/TTS/Kokoro/.venv/Lib/site-packages/spacy/tests/serialize/__pycache__/test_serialize_pipeline.cpython-312.pyc new file mode 100644 index 0000000000000000000000000000000000000000..1953b32ff638a47195a6407e52f49ef39b86f14b Binary files /dev/null and b/TTS/Kokoro/.venv/Lib/site-packages/spacy/tests/serialize/__pycache__/test_serialize_pipeline.cpython-312.pyc differ diff --git a/TTS/Kokoro/.venv/Lib/site-packages/spacy/tests/serialize/__pycache__/test_serialize_span_groups.cpython-312.pyc b/TTS/Kokoro/.venv/Lib/site-packages/spacy/tests/serialize/__pycache__/test_serialize_span_groups.cpython-312.pyc new file mode 100644 index 0000000000000000000000000000000000000000..ded9e7fe074468b3c8479a4fcea6b038d0b0a86a Binary files /dev/null and b/TTS/Kokoro/.venv/Lib/site-packages/spacy/tests/serialize/__pycache__/test_serialize_span_groups.cpython-312.pyc differ diff --git a/TTS/Kokoro/.venv/Lib/site-packages/spacy/tests/serialize/__pycache__/test_serialize_tokenizer.cpython-312.pyc b/TTS/Kokoro/.venv/Lib/site-packages/spacy/tests/serialize/__pycache__/test_serialize_tokenizer.cpython-312.pyc new file mode 100644 index 0000000000000000000000000000000000000000..c0184f6853bcaa8d3e6763d921cf56b02c68d64e Binary files /dev/null and b/TTS/Kokoro/.venv/Lib/site-packages/spacy/tests/serialize/__pycache__/test_serialize_tokenizer.cpython-312.pyc differ diff --git a/TTS/Kokoro/.venv/Lib/site-packages/spacy/tests/serialize/__pycache__/test_serialize_vocab_strings.cpython-312.pyc b/TTS/Kokoro/.venv/Lib/site-packages/spacy/tests/serialize/__pycache__/test_serialize_vocab_strings.cpython-312.pyc new file mode 100644 index 0000000000000000000000000000000000000000..b0d8ccf04cbcef8492d08e4bb549940c42e8aa37 Binary files /dev/null and b/TTS/Kokoro/.venv/Lib/site-packages/spacy/tests/serialize/__pycache__/test_serialize_vocab_strings.cpython-312.pyc differ diff --git a/TTS/Kokoro/.venv/Lib/site-packages/spacy/tests/serialize/test_resource_warning.py b/TTS/Kokoro/.venv/Lib/site-packages/spacy/tests/serialize/test_resource_warning.py new file mode 100644 index 0000000000000000000000000000000000000000..e83b2c26294f49027603bb9539b5dbaec26446ac --- /dev/null +++ b/TTS/Kokoro/.venv/Lib/site-packages/spacy/tests/serialize/test_resource_warning.py @@ -0,0 +1,150 @@ +import warnings +from unittest import TestCase + +import pytest +import srsly +from numpy import zeros + +from spacy.kb.kb_in_memory import InMemoryLookupKB, Writer +from spacy.language import Language +from spacy.pipeline import TrainablePipe +from spacy.vectors import Vectors +from spacy.vocab import Vocab + +from ..util import make_tempdir + + +def nlp(): + return Language() + + +def vectors(): + data = zeros((3, 1), dtype="f") + keys = ["cat", "dog", "rat"] + return Vectors(data=data, keys=keys) + + +def custom_pipe(): + # create dummy pipe partially implementing interface -- only want to test to_disk + class SerializableDummy: + def __init__(self, **cfg): + if cfg: + self.cfg = cfg + else: + self.cfg = None + super(SerializableDummy, self).__init__() + + def to_bytes(self, exclude=tuple(), disable=None, **kwargs): + return srsly.msgpack_dumps({"dummy": srsly.json_dumps(None)}) + + def from_bytes(self, bytes_data, exclude): + return self + + def to_disk(self, path, exclude=tuple(), **kwargs): + pass + + def from_disk(self, path, exclude=tuple(), **kwargs): + return self + + class MyPipe(TrainablePipe): + def __init__(self, vocab, model=True, **cfg): + if cfg: + self.cfg = cfg + else: + self.cfg = None + self.model = SerializableDummy() + self.vocab = vocab + + return MyPipe(Vocab()) + + +def tagger(): + nlp = Language() + tagger = nlp.add_pipe("tagger") + # need to add model for two reasons: + # 1. no model leads to error in serialization, + # 2. the affected line is the one for model serialization + tagger.add_label("A") + nlp.initialize() + return tagger + + +def entity_linker(): + nlp = Language() + + def create_kb(vocab): + kb = InMemoryLookupKB(vocab, entity_vector_length=1) + kb.add_entity("test", 0.0, zeros((1,), dtype="f")) + return kb + + entity_linker = nlp.add_pipe("entity_linker") + entity_linker.set_kb(create_kb) + # need to add model for two reasons: + # 1. no model leads to error in serialization, + # 2. the affected line is the one for model serialization + nlp.initialize() + return entity_linker + + +objects_to_test = ( + [nlp, vectors, custom_pipe, tagger, entity_linker], + ["nlp", "vectors", "custom_pipe", "tagger", "entity_linker"], +) + + +def write_obj_and_catch_warnings(obj): + with make_tempdir() as d: + with warnings.catch_warnings(record=True) as warnings_list: + warnings.filterwarnings("always", category=ResourceWarning) + obj.to_disk(d) + # in python3.5 it seems that deprecation warnings are not filtered by filterwarnings + return list(filter(lambda x: isinstance(x, ResourceWarning), warnings_list)) + + +@pytest.mark.parametrize("obj_factory", objects_to_test[0], ids=objects_to_test[1]) +def test_to_disk_resource_warning(obj_factory): + obj = obj_factory() + warnings_list = write_obj_and_catch_warnings(obj) + assert len(warnings_list) == 0 + + +def test_writer_with_path_py35(): + writer = None + with make_tempdir() as d: + path = d / "test" + try: + writer = Writer(path) + except Exception as e: + pytest.fail(str(e)) + finally: + if writer: + writer.close() + + +def test_save_and_load_knowledge_base(): + nlp = Language() + kb = InMemoryLookupKB(nlp.vocab, entity_vector_length=1) + with make_tempdir() as d: + path = d / "kb" + try: + kb.to_disk(path) + except Exception as e: + pytest.fail(str(e)) + + try: + kb_loaded = InMemoryLookupKB(nlp.vocab, entity_vector_length=1) + kb_loaded.from_disk(path) + except Exception as e: + pytest.fail(str(e)) + + +class TestToDiskResourceWarningUnittest(TestCase): + def test_resource_warning(self): + items = [x() for x in objects_to_test[0]] + names = objects_to_test[1] + scenarios = zip(items, names) + + for item, name in scenarios: + with self.subTest(msg=name): + warnings_list = write_obj_and_catch_warnings(item) + self.assertEqual(len(warnings_list), 0) diff --git a/TTS/Kokoro/.venv/Lib/site-packages/spacy/tests/serialize/test_serialize_config.py b/TTS/Kokoro/.venv/Lib/site-packages/spacy/tests/serialize/test_serialize_config.py new file mode 100644 index 0000000000000000000000000000000000000000..15efe4184859267a64782395cf79ed87c0b7e099 --- /dev/null +++ b/TTS/Kokoro/.venv/Lib/site-packages/spacy/tests/serialize/test_serialize_config.py @@ -0,0 +1,574 @@ +import pytest +from catalogue import RegistryError +from thinc.api import Config, ConfigValidationError + +import spacy +from spacy.lang.de import German +from spacy.lang.en import English +from spacy.language import DEFAULT_CONFIG, DEFAULT_CONFIG_PRETRAIN_PATH, Language +from spacy.ml.models import ( + MaxoutWindowEncoder, + MultiHashEmbed, + build_tb_parser_model, + build_Tok2Vec_model, +) +from spacy.schemas import ConfigSchema, ConfigSchemaPretrain +from spacy.training import Example +from spacy.util import ( + load_config, + load_config_from_str, + load_model_from_config, + registry, +) + +from ..util import make_tempdir + +nlp_config_string = """ +[paths] +train = null +dev = null + +[corpora] + +[corpora.train] +@readers = "spacy.Corpus.v1" +path = ${paths.train} + +[corpora.dev] +@readers = "spacy.Corpus.v1" +path = ${paths.dev} + +[training] + +[training.batcher] +@batchers = "spacy.batch_by_words.v1" +size = 666 + +[nlp] +lang = "en" +pipeline = ["tok2vec", "tagger"] + +[components] + +[components.tok2vec] +factory = "tok2vec" + +[components.tok2vec.model] +@architectures = "spacy.HashEmbedCNN.v1" +pretrained_vectors = null +width = 342 +depth = 4 +window_size = 1 +embed_size = 2000 +maxout_pieces = 3 +subword_features = true + +[components.tagger] +factory = "tagger" + +[components.tagger.model] +@architectures = "spacy.Tagger.v2" + +[components.tagger.model.tok2vec] +@architectures = "spacy.Tok2VecListener.v1" +width = ${components.tok2vec.model.width} +""" + +pretrain_config_string = """ +[paths] +train = null +dev = null + +[corpora] + +[corpora.train] +@readers = "spacy.Corpus.v1" +path = ${paths.train} + +[corpora.dev] +@readers = "spacy.Corpus.v1" +path = ${paths.dev} + +[training] + +[training.batcher] +@batchers = "spacy.batch_by_words.v1" +size = 666 + +[nlp] +lang = "en" +pipeline = ["tok2vec", "tagger"] + +[components] + +[components.tok2vec] +factory = "tok2vec" + +[components.tok2vec.model] +@architectures = "spacy.HashEmbedCNN.v1" +pretrained_vectors = null +width = 342 +depth = 4 +window_size = 1 +embed_size = 2000 +maxout_pieces = 3 +subword_features = true + +[components.tagger] +factory = "tagger" + +[components.tagger.model] +@architectures = "spacy.Tagger.v2" + +[components.tagger.model.tok2vec] +@architectures = "spacy.Tok2VecListener.v1" +width = ${components.tok2vec.model.width} + +[pretraining] +""" + + +parser_config_string_upper = """ +[model] +@architectures = "spacy.TransitionBasedParser.v2" +state_type = "parser" +extra_state_tokens = false +hidden_width = 66 +maxout_pieces = 2 +use_upper = true + +[model.tok2vec] +@architectures = "spacy.HashEmbedCNN.v1" +pretrained_vectors = null +width = 333 +depth = 4 +embed_size = 5555 +window_size = 1 +maxout_pieces = 7 +subword_features = false +""" + + +parser_config_string_no_upper = """ +[model] +@architectures = "spacy.TransitionBasedParser.v2" +state_type = "parser" +extra_state_tokens = false +hidden_width = 66 +maxout_pieces = 2 +use_upper = false + +[model.tok2vec] +@architectures = "spacy.HashEmbedCNN.v1" +pretrained_vectors = null +width = 333 +depth = 4 +embed_size = 5555 +window_size = 1 +maxout_pieces = 7 +subword_features = false +""" + + +@registry.architectures("my_test_parser") +def my_parser(): + tok2vec = build_Tok2Vec_model( + MultiHashEmbed( + width=321, + attrs=["LOWER", "SHAPE"], + rows=[5432, 5432], + include_static_vectors=False, + ), + MaxoutWindowEncoder(width=321, window_size=3, maxout_pieces=4, depth=2), + ) + parser = build_tb_parser_model( + tok2vec=tok2vec, + state_type="parser", + extra_state_tokens=True, + hidden_width=65, + maxout_pieces=5, + use_upper=True, + ) + return parser + + +@pytest.mark.issue(8190) +def test_issue8190(): + """Test that config overrides are not lost after load is complete.""" + source_cfg = { + "nlp": { + "lang": "en", + }, + "custom": {"key": "value"}, + } + source_nlp = English.from_config(source_cfg) + with make_tempdir() as dir_path: + # We need to create a loadable source pipeline + source_path = dir_path / "test_model" + source_nlp.to_disk(source_path) + nlp = spacy.load(source_path, config={"custom": {"key": "updated_value"}}) + + assert nlp.config["custom"]["key"] == "updated_value" + + +def test_create_nlp_from_config(): + config = Config().from_str(nlp_config_string) + with pytest.raises(ConfigValidationError): + load_model_from_config(config, auto_fill=False) + nlp = load_model_from_config(config, auto_fill=True) + assert nlp.config["training"]["batcher"]["size"] == 666 + assert len(nlp.config["training"]) > 1 + assert nlp.pipe_names == ["tok2vec", "tagger"] + assert len(nlp.config["components"]) == 2 + assert len(nlp.config["nlp"]["pipeline"]) == 2 + nlp.remove_pipe("tagger") + assert len(nlp.config["components"]) == 1 + assert len(nlp.config["nlp"]["pipeline"]) == 1 + with pytest.raises(ValueError): + bad_cfg = {"yolo": {}} + load_model_from_config(Config(bad_cfg), auto_fill=True) + with pytest.raises(ValueError): + bad_cfg = {"pipeline": {"foo": "bar"}} + load_model_from_config(Config(bad_cfg), auto_fill=True) + + +def test_create_nlp_from_pretraining_config(): + """Test that the default pretraining config validates properly""" + config = Config().from_str(pretrain_config_string) + pretrain_config = load_config(DEFAULT_CONFIG_PRETRAIN_PATH) + filled = config.merge(pretrain_config) + registry.resolve(filled["pretraining"], schema=ConfigSchemaPretrain) + + +def test_create_nlp_from_config_multiple_instances(): + """Test that the nlp object is created correctly for a config with multiple + instances of the same component.""" + config = Config().from_str(nlp_config_string) + config["components"] = { + "t2v": config["components"]["tok2vec"], + "tagger1": config["components"]["tagger"], + "tagger2": config["components"]["tagger"], + } + config["nlp"]["pipeline"] = list(config["components"].keys()) + nlp = load_model_from_config(config, auto_fill=True) + assert nlp.pipe_names == ["t2v", "tagger1", "tagger2"] + assert nlp.get_pipe_meta("t2v").factory == "tok2vec" + assert nlp.get_pipe_meta("tagger1").factory == "tagger" + assert nlp.get_pipe_meta("tagger2").factory == "tagger" + pipeline_config = nlp.config["components"] + assert len(pipeline_config) == 3 + assert list(pipeline_config.keys()) == ["t2v", "tagger1", "tagger2"] + assert nlp.config["nlp"]["pipeline"] == ["t2v", "tagger1", "tagger2"] + + +def test_serialize_nlp(): + """Create a custom nlp pipeline from config and ensure it serializes it correctly""" + nlp_config = Config().from_str(nlp_config_string) + nlp = load_model_from_config(nlp_config, auto_fill=True) + nlp.get_pipe("tagger").add_label("A") + nlp.initialize() + assert "tok2vec" in nlp.pipe_names + assert "tagger" in nlp.pipe_names + assert "parser" not in nlp.pipe_names + assert nlp.get_pipe("tagger").model.get_ref("tok2vec").get_dim("nO") == 342 + + with make_tempdir() as d: + nlp.to_disk(d) + nlp2 = spacy.load(d) + assert "tok2vec" in nlp2.pipe_names + assert "tagger" in nlp2.pipe_names + assert "parser" not in nlp2.pipe_names + assert nlp2.get_pipe("tagger").model.get_ref("tok2vec").get_dim("nO") == 342 + + +def test_serialize_custom_nlp(): + """Create a custom nlp pipeline and ensure it serializes it correctly""" + nlp = English() + parser_cfg = dict() + parser_cfg["model"] = {"@architectures": "my_test_parser"} + nlp.add_pipe("parser", config=parser_cfg) + nlp.initialize() + + with make_tempdir() as d: + nlp.to_disk(d) + nlp2 = spacy.load(d) + model = nlp2.get_pipe("parser").model + model.get_ref("tok2vec") + # check that we have the correct settings, not the default ones + assert model.get_ref("upper").get_dim("nI") == 65 + assert model.get_ref("lower").get_dim("nI") == 65 + + +@pytest.mark.parametrize( + "parser_config_string", [parser_config_string_upper, parser_config_string_no_upper] +) +def test_serialize_parser(parser_config_string): + """Create a non-default parser config to check nlp serializes it correctly""" + nlp = English() + model_config = Config().from_str(parser_config_string) + parser = nlp.add_pipe("parser", config=model_config) + parser.add_label("nsubj") + nlp.initialize() + + with make_tempdir() as d: + nlp.to_disk(d) + nlp2 = spacy.load(d) + model = nlp2.get_pipe("parser").model + model.get_ref("tok2vec") + # check that we have the correct settings, not the default ones + if model.attrs["has_upper"]: + assert model.get_ref("upper").get_dim("nI") == 66 + assert model.get_ref("lower").get_dim("nI") == 66 + + +def test_config_nlp_roundtrip(): + """Test that a config produced by the nlp object passes training config + validation.""" + nlp = English() + nlp.add_pipe("entity_ruler") + nlp.add_pipe("ner") + new_nlp = load_model_from_config(nlp.config, auto_fill=False) + assert new_nlp.config == nlp.config + assert new_nlp.pipe_names == nlp.pipe_names + assert new_nlp._pipe_configs == nlp._pipe_configs + assert new_nlp._pipe_meta == nlp._pipe_meta + assert new_nlp._factory_meta == nlp._factory_meta + + +def test_config_nlp_roundtrip_bytes_disk(): + """Test that the config is serialized correctly and not interpolated + by mistake.""" + nlp = English() + nlp_bytes = nlp.to_bytes() + new_nlp = English().from_bytes(nlp_bytes) + assert new_nlp.config == nlp.config + nlp = English() + with make_tempdir() as d: + nlp.to_disk(d) + new_nlp = spacy.load(d) + assert new_nlp.config == nlp.config + + +def test_serialize_config_language_specific(): + """Test that config serialization works as expected with language-specific + factories.""" + name = "test_serialize_config_language_specific" + + @English.factory(name, default_config={"foo": 20}) + def custom_factory(nlp: Language, name: str, foo: int): + return lambda doc: doc + + nlp = Language() + assert not nlp.has_factory(name) + nlp = English() + assert nlp.has_factory(name) + nlp.add_pipe(name, config={"foo": 100}, name="bar") + pipe_config = nlp.config["components"]["bar"] + assert pipe_config["foo"] == 100 + assert pipe_config["factory"] == name + + with make_tempdir() as d: + nlp.to_disk(d) + nlp2 = spacy.load(d) + assert nlp2.has_factory(name) + assert nlp2.pipe_names == ["bar"] + assert nlp2.get_pipe_meta("bar").factory == name + pipe_config = nlp2.config["components"]["bar"] + assert pipe_config["foo"] == 100 + assert pipe_config["factory"] == name + + config = Config().from_str(nlp2.config.to_str()) + config["nlp"]["lang"] = "de" + with pytest.raises(ValueError): + # German doesn't have a factory, only English does + load_model_from_config(config) + + +def test_serialize_config_missing_pipes(): + config = Config().from_str(nlp_config_string) + config["components"].pop("tok2vec") + assert "tok2vec" in config["nlp"]["pipeline"] + assert "tok2vec" not in config["components"] + with pytest.raises(ValueError): + load_model_from_config(config, auto_fill=True) + + +def test_config_overrides(): + overrides_nested = {"nlp": {"lang": "de", "pipeline": ["tagger"]}} + overrides_dot = {"nlp.lang": "de", "nlp.pipeline": ["tagger"]} + # load_model from config with overrides passed directly to Config + config = Config().from_str(nlp_config_string, overrides=overrides_dot) + nlp = load_model_from_config(config, auto_fill=True) + assert isinstance(nlp, German) + assert nlp.pipe_names == ["tagger"] + # Serialized roundtrip with config passed in + base_config = Config().from_str(nlp_config_string) + base_nlp = load_model_from_config(base_config, auto_fill=True) + assert isinstance(base_nlp, English) + assert base_nlp.pipe_names == ["tok2vec", "tagger"] + with make_tempdir() as d: + base_nlp.to_disk(d) + nlp = spacy.load(d, config=overrides_nested) + assert isinstance(nlp, German) + assert nlp.pipe_names == ["tagger"] + with make_tempdir() as d: + base_nlp.to_disk(d) + nlp = spacy.load(d, config=overrides_dot) + assert isinstance(nlp, German) + assert nlp.pipe_names == ["tagger"] + with make_tempdir() as d: + base_nlp.to_disk(d) + nlp = spacy.load(d) + assert isinstance(nlp, English) + assert nlp.pipe_names == ["tok2vec", "tagger"] + + +@pytest.mark.filterwarnings("ignore:\\[W036") +def test_config_overrides_registered_functions(): + nlp = spacy.blank("en") + nlp.add_pipe("attribute_ruler") + with make_tempdir() as d: + nlp.to_disk(d) + nlp_re1 = spacy.load( + d, + config={ + "components": { + "attribute_ruler": { + "scorer": {"@scorers": "spacy.tagger_scorer.v1"} + } + } + }, + ) + assert ( + nlp_re1.config["components"]["attribute_ruler"]["scorer"]["@scorers"] + == "spacy.tagger_scorer.v1" + ) + + @registry.misc("test_some_other_key") + def misc_some_other_key(): + return "some_other_key" + + nlp_re2 = spacy.load( + d, + config={ + "components": { + "attribute_ruler": { + "scorer": { + "@scorers": "spacy.overlapping_labeled_spans_scorer.v1", + "spans_key": {"@misc": "test_some_other_key"}, + } + } + } + }, + ) + assert nlp_re2.config["components"]["attribute_ruler"]["scorer"][ + "spans_key" + ] == {"@misc": "test_some_other_key"} + # run dummy evaluation (will return None scores) in order to test that + # the spans_key value in the nested override is working as intended in + # the config + example = Example.from_dict(nlp_re2.make_doc("a b c"), {}) + scores = nlp_re2.evaluate([example]) + assert "spans_some_other_key_f" in scores + + +def test_config_interpolation(): + config = Config().from_str(nlp_config_string, interpolate=False) + assert config["corpora"]["train"]["path"] == "${paths.train}" + interpolated = config.interpolate() + assert interpolated["corpora"]["train"]["path"] is None + nlp = English.from_config(config) + assert nlp.config["corpora"]["train"]["path"] == "${paths.train}" + # Ensure that variables are preserved in nlp config + width = "${components.tok2vec.model.width}" + assert config["components"]["tagger"]["model"]["tok2vec"]["width"] == width + assert nlp.config["components"]["tagger"]["model"]["tok2vec"]["width"] == width + interpolated2 = nlp.config.interpolate() + assert interpolated2["corpora"]["train"]["path"] is None + assert interpolated2["components"]["tagger"]["model"]["tok2vec"]["width"] == 342 + nlp2 = English.from_config(interpolated) + assert nlp2.config["corpora"]["train"]["path"] is None + assert nlp2.config["components"]["tagger"]["model"]["tok2vec"]["width"] == 342 + + +def test_config_optional_sections(): + config = Config().from_str(nlp_config_string) + config = DEFAULT_CONFIG.merge(config) + assert "pretraining" not in config + filled = registry.fill(config, schema=ConfigSchema, validate=False) + # Make sure that optional "pretraining" block doesn't default to None, + # which would (rightly) cause error because it'd result in a top-level + # key that's not a section (dict). Note that the following roundtrip is + # also how Config.interpolate works under the hood. + new_config = Config().from_str(filled.to_str()) + assert new_config["pretraining"] == {} + + +def test_config_auto_fill_extra_fields(): + config = Config({"nlp": {"lang": "en"}, "training": {}}) + assert load_model_from_config(config, auto_fill=True) + config = Config({"nlp": {"lang": "en"}, "training": {"extra": "hello"}}) + nlp = load_model_from_config(config, auto_fill=True, validate=False) + assert "extra" not in nlp.config["training"] + # Make sure the config generated is valid + load_model_from_config(nlp.config) + + +@pytest.mark.parametrize( + "parser_config_string", [parser_config_string_upper, parser_config_string_no_upper] +) +def test_config_validate_literal(parser_config_string): + nlp = English() + config = Config().from_str(parser_config_string) + config["model"]["state_type"] = "nonsense" + with pytest.raises(ConfigValidationError): + nlp.add_pipe("parser", config=config) + config["model"]["state_type"] = "ner" + nlp.add_pipe("parser", config=config) + + +def test_config_only_resolve_relevant_blocks(): + """Test that only the relevant blocks are resolved in the different methods + and that invalid blocks are ignored if needed. For instance, the [initialize] + shouldn't be resolved at runtime. + """ + nlp = English() + config = nlp.config + config["training"]["before_to_disk"] = {"@misc": "nonexistent"} + config["initialize"]["lookups"] = {"@misc": "nonexistent"} + # This shouldn't resolve [training] or [initialize] + nlp = load_model_from_config(config, auto_fill=True) + # This will raise for nonexistent value + with pytest.raises(RegistryError): + nlp.initialize() + nlp.config["initialize"]["lookups"] = None + nlp.initialize() + + +def test_hyphen_in_config(): + hyphen_config_str = """ + [nlp] + lang = "en" + pipeline = ["my_punctual_component"] + + [components] + + [components.my_punctual_component] + factory = "my_punctual_component" + punctuation = ["?","-"] + """ + + @spacy.Language.factory("my_punctual_component") + class MyPunctualComponent(object): + name = "my_punctual_component" + + def __init__( + self, + nlp, + name, + punctuation, + ): + self.punctuation = punctuation + + nlp = English.from_config(load_config_from_str(hyphen_config_str)) + assert nlp.get_pipe("my_punctual_component").punctuation == ["?", "-"] diff --git a/TTS/Kokoro/.venv/Lib/site-packages/spacy/tests/serialize/test_serialize_doc.py b/TTS/Kokoro/.venv/Lib/site-packages/spacy/tests/serialize/test_serialize_doc.py new file mode 100644 index 0000000000000000000000000000000000000000..2dcf3058877478ac5d531ffcc39a8deb0897e3f5 --- /dev/null +++ b/TTS/Kokoro/.venv/Lib/site-packages/spacy/tests/serialize/test_serialize_doc.py @@ -0,0 +1,225 @@ +import copy +import pickle + +import numpy +import pytest + +from spacy.attrs import DEP, HEAD +from spacy.lang.en import English +from spacy.language import Language +from spacy.matcher import Matcher, PhraseMatcher +from spacy.tokens import Doc +from spacy.vectors import Vectors +from spacy.vocab import Vocab + +from ..util import make_tempdir + + +@pytest.mark.issue(1727) +def test_issue1727(): + """Test that models with no pretrained vectors can be deserialized + correctly after vectors are added.""" + nlp = Language(Vocab()) + data = numpy.ones((3, 300), dtype="f") + vectors = Vectors(data=data, keys=["I", "am", "Matt"]) + tagger = nlp.create_pipe("tagger") + tagger.add_label("PRP") + assert tagger.cfg.get("pretrained_dims", 0) == 0 + tagger.vocab.vectors = vectors + with make_tempdir() as path: + tagger.to_disk(path) + tagger = nlp.create_pipe("tagger").from_disk(path) + assert tagger.cfg.get("pretrained_dims", 0) == 0 + + +@pytest.mark.issue(1799) +def test_issue1799(): + """Test sentence boundaries are deserialized correctly, even for + non-projective sentences.""" + heads_deps = numpy.asarray( + [ + [1, 397], + [4, 436], + [2, 426], + [1, 402], + [0, 8206900633647566924], + [18446744073709551615, 440], + [18446744073709551614, 442], + ], + dtype="uint64", + ) + doc = Doc(Vocab(), words="Just what I was looking for .".split()) + doc.vocab.strings.add("ROOT") + doc = doc.from_array([HEAD, DEP], heads_deps) + assert len(list(doc.sents)) == 1 + + +@pytest.mark.issue(1834) +def test_issue1834(): + """Test that sentence boundaries & parse/tag flags are not lost + during serialization.""" + words = ["This", "is", "a", "first", "sentence", ".", "And", "another", "one"] + doc = Doc(Vocab(), words=words) + doc[6].is_sent_start = True + new_doc = Doc(doc.vocab).from_bytes(doc.to_bytes()) + assert new_doc[6].sent_start + assert not new_doc.has_annotation("DEP") + assert not new_doc.has_annotation("TAG") + doc = Doc( + Vocab(), + words=words, + tags=["TAG"] * len(words), + heads=[0, 0, 0, 0, 0, 0, 6, 6, 6], + deps=["dep"] * len(words), + ) + new_doc = Doc(doc.vocab).from_bytes(doc.to_bytes()) + assert new_doc[6].sent_start + assert new_doc.has_annotation("DEP") + assert new_doc.has_annotation("TAG") + + +@pytest.mark.issue(1883) +def test_issue1883(): + matcher = Matcher(Vocab()) + matcher.add("pat1", [[{"orth": "hello"}]]) + doc = Doc(matcher.vocab, words=["hello"]) + assert len(matcher(doc)) == 1 + new_matcher = copy.deepcopy(matcher) + new_doc = Doc(new_matcher.vocab, words=["hello"]) + assert len(new_matcher(new_doc)) == 1 + + +@pytest.mark.issue(2564) +def test_issue2564(): + """Test the tagger sets has_annotation("TAG") correctly when used via Language.pipe.""" + nlp = Language() + tagger = nlp.add_pipe("tagger") + tagger.add_label("A") + nlp.initialize() + doc = nlp("hello world") + assert doc.has_annotation("TAG") + docs = nlp.pipe(["hello", "world"]) + piped_doc = next(docs) + assert piped_doc.has_annotation("TAG") + + +@pytest.mark.issue(3248) +def test_issue3248_2(): + """Test that the PhraseMatcher can be pickled correctly.""" + nlp = English() + matcher = PhraseMatcher(nlp.vocab) + matcher.add("TEST1", [nlp("a"), nlp("b"), nlp("c")]) + matcher.add("TEST2", [nlp("d")]) + data = pickle.dumps(matcher) + new_matcher = pickle.loads(data) + assert len(new_matcher) == len(matcher) + + +@pytest.mark.issue(3289) +def test_issue3289(): + """Test that Language.to_bytes handles serializing a pipeline component + with an uninitialized model.""" + nlp = English() + nlp.add_pipe("textcat") + bytes_data = nlp.to_bytes() + new_nlp = English() + new_nlp.add_pipe("textcat") + new_nlp.from_bytes(bytes_data) + + +@pytest.mark.issue(3468) +def test_issue3468(): + """Test that sentence boundaries are set correctly so Doc.has_annotation("SENT_START") can + be restored after serialization.""" + nlp = English() + nlp.add_pipe("sentencizer") + doc = nlp("Hello world") + assert doc[0].is_sent_start + assert doc.has_annotation("SENT_START") + assert len(list(doc.sents)) == 1 + doc_bytes = doc.to_bytes() + new_doc = Doc(nlp.vocab).from_bytes(doc_bytes) + assert new_doc[0].is_sent_start + assert new_doc.has_annotation("SENT_START") + assert len(list(new_doc.sents)) == 1 + + +@pytest.mark.issue(3959) +def test_issue3959(): + """Ensure that a modified pos attribute is serialized correctly.""" + nlp = English() + doc = nlp( + "displaCy uses JavaScript, SVG and CSS to show you how computers understand language" + ) + assert doc[0].pos_ == "" + doc[0].pos_ = "NOUN" + assert doc[0].pos_ == "NOUN" + # usually this is already True when starting from proper models instead of blank English + with make_tempdir() as tmp_dir: + file_path = tmp_dir / "my_doc" + doc.to_disk(file_path) + doc2 = nlp("") + doc2.from_disk(file_path) + assert doc2[0].pos_ == "NOUN" + + +def test_serialize_empty_doc(en_vocab): + doc = Doc(en_vocab) + data = doc.to_bytes() + doc2 = Doc(en_vocab) + doc2.from_bytes(data) + assert len(doc) == len(doc2) + for token1, token2 in zip(doc, doc2): + assert token1.text == token2.text + + +def test_serialize_doc_roundtrip_bytes(en_vocab): + doc = Doc(en_vocab, words=["hello", "world"]) + doc.cats = {"A": 0.5} + doc_b = doc.to_bytes() + new_doc = Doc(en_vocab).from_bytes(doc_b) + assert new_doc.to_bytes() == doc_b + + +def test_serialize_doc_roundtrip_disk(en_vocab): + doc = Doc(en_vocab, words=["hello", "world"]) + with make_tempdir() as d: + file_path = d / "doc" + doc.to_disk(file_path) + doc_d = Doc(en_vocab).from_disk(file_path) + assert doc.to_bytes() == doc_d.to_bytes() + + +def test_serialize_doc_roundtrip_disk_str_path(en_vocab): + doc = Doc(en_vocab, words=["hello", "world"]) + with make_tempdir() as d: + file_path = d / "doc" + file_path = str(file_path) + doc.to_disk(file_path) + doc_d = Doc(en_vocab).from_disk(file_path) + assert doc.to_bytes() == doc_d.to_bytes() + + +def test_serialize_doc_exclude(en_vocab): + doc = Doc(en_vocab, words=["hello", "world"]) + doc.user_data["foo"] = "bar" + new_doc = Doc(en_vocab).from_bytes(doc.to_bytes()) + assert new_doc.user_data["foo"] == "bar" + new_doc = Doc(en_vocab).from_bytes(doc.to_bytes(), exclude=["user_data"]) + assert not new_doc.user_data + new_doc = Doc(en_vocab).from_bytes(doc.to_bytes(exclude=["user_data"])) + assert not new_doc.user_data + + +def test_serialize_doc_span_groups(en_vocab): + doc = Doc(en_vocab, words=["hello", "world", "!"]) + span = doc[0:2] + span.label_ = "test_serialize_doc_span_groups_label" + span.id_ = "test_serialize_doc_span_groups_id" + span.kb_id_ = "test_serialize_doc_span_groups_kb_id" + doc.spans["content"] = [span] + new_doc = Doc(en_vocab).from_bytes(doc.to_bytes()) + assert len(new_doc.spans["content"]) == 1 + assert new_doc.spans["content"][0].label_ == "test_serialize_doc_span_groups_label" + assert new_doc.spans["content"][0].id_ == "test_serialize_doc_span_groups_id" + assert new_doc.spans["content"][0].kb_id_ == "test_serialize_doc_span_groups_kb_id" diff --git a/TTS/Kokoro/.venv/Lib/site-packages/spacy/tests/serialize/test_serialize_docbin.py b/TTS/Kokoro/.venv/Lib/site-packages/spacy/tests/serialize/test_serialize_docbin.py new file mode 100644 index 0000000000000000000000000000000000000000..3168a1d87d1443cd01793946c902dd1b1340d3df --- /dev/null +++ b/TTS/Kokoro/.venv/Lib/site-packages/spacy/tests/serialize/test_serialize_docbin.py @@ -0,0 +1,113 @@ +import pytest + +import spacy +from spacy.lang.en import English +from spacy.tokens import Doc, DocBin +from spacy.tokens.underscore import Underscore + + +@pytest.mark.issue(4367) +def test_issue4367(): + """Test that docbin init goes well""" + DocBin() + DocBin(attrs=["LEMMA"]) + DocBin(attrs=["LEMMA", "ENT_IOB", "ENT_TYPE"]) + + +@pytest.mark.issue(4528) +def test_issue4528(en_vocab): + """Test that user_data is correctly serialized in DocBin.""" + doc = Doc(en_vocab, words=["hello", "world"]) + doc.user_data["foo"] = "bar" + # This is how extension attribute values are stored in the user data + doc.user_data[("._.", "foo", None, None)] = "bar" + doc_bin = DocBin(store_user_data=True) + doc_bin.add(doc) + doc_bin_bytes = doc_bin.to_bytes() + new_doc_bin = DocBin(store_user_data=True).from_bytes(doc_bin_bytes) + new_doc = list(new_doc_bin.get_docs(en_vocab))[0] + assert new_doc.user_data["foo"] == "bar" + assert new_doc.user_data[("._.", "foo", None, None)] == "bar" + + +@pytest.mark.issue(5141) +def test_issue5141(en_vocab): + """Ensure an empty DocBin does not crash on serialization""" + doc_bin = DocBin(attrs=["DEP", "HEAD"]) + assert list(doc_bin.get_docs(en_vocab)) == [] + doc_bin_bytes = doc_bin.to_bytes() + doc_bin_2 = DocBin().from_bytes(doc_bin_bytes) + assert list(doc_bin_2.get_docs(en_vocab)) == [] + + +def test_serialize_doc_bin(): + doc_bin = DocBin( + attrs=["LEMMA", "ENT_IOB", "ENT_TYPE", "NORM", "ENT_ID"], store_user_data=True + ) + texts = ["Some text", "Lots of texts...", "..."] + cats = {"A": 0.5} + nlp = English() + for doc in nlp.pipe(texts): + doc.cats = cats + span = doc[0:2] + span.label_ = "UNUSUAL_SPAN_LABEL" + span.id_ = "UNUSUAL_SPAN_ID" + span.kb_id_ = "UNUSUAL_SPAN_KB_ID" + doc.spans["start"] = [span] + doc[0].norm_ = "UNUSUAL_TOKEN_NORM" + doc[0].ent_id_ = "UNUSUAL_TOKEN_ENT_ID" + doc_bin.add(doc) + bytes_data = doc_bin.to_bytes() + + # Deserialize later, e.g. in a new process + nlp = spacy.blank("en") + doc_bin = DocBin().from_bytes(bytes_data) + reloaded_docs = list(doc_bin.get_docs(nlp.vocab)) + for i, doc in enumerate(reloaded_docs): + assert doc.text == texts[i] + assert doc.cats == cats + assert len(doc.spans) == 1 + assert doc.spans["start"][0].label_ == "UNUSUAL_SPAN_LABEL" + assert doc.spans["start"][0].id_ == "UNUSUAL_SPAN_ID" + assert doc.spans["start"][0].kb_id_ == "UNUSUAL_SPAN_KB_ID" + assert doc[0].norm_ == "UNUSUAL_TOKEN_NORM" + assert doc[0].ent_id_ == "UNUSUAL_TOKEN_ENT_ID" + + +def test_serialize_doc_bin_unknown_spaces(en_vocab): + doc1 = Doc(en_vocab, words=["that", "'s"]) + assert doc1.has_unknown_spaces + assert doc1.text == "that 's " + doc2 = Doc(en_vocab, words=["that", "'s"], spaces=[False, False]) + assert not doc2.has_unknown_spaces + assert doc2.text == "that's" + + doc_bin = DocBin().from_bytes(DocBin(docs=[doc1, doc2]).to_bytes()) + re_doc1, re_doc2 = doc_bin.get_docs(en_vocab) + assert re_doc1.has_unknown_spaces + assert re_doc1.text == "that 's " + assert not re_doc2.has_unknown_spaces + assert re_doc2.text == "that's" + + +@pytest.mark.parametrize( + "writer_flag,reader_flag,reader_value", + [ + (True, True, "bar"), + (True, False, "bar"), + (False, True, "nothing"), + (False, False, "nothing"), + ], +) +def test_serialize_custom_extension(en_vocab, writer_flag, reader_flag, reader_value): + """Test that custom extensions are correctly serialized in DocBin.""" + Doc.set_extension("foo", default="nothing") + doc = Doc(en_vocab, words=["hello", "world"]) + doc._.foo = "bar" + doc_bin_1 = DocBin(store_user_data=writer_flag) + doc_bin_1.add(doc) + doc_bin_bytes = doc_bin_1.to_bytes() + doc_bin_2 = DocBin(store_user_data=reader_flag).from_bytes(doc_bin_bytes) + doc_2 = list(doc_bin_2.get_docs(en_vocab))[0] + assert doc_2._.foo == reader_value + Underscore.doc_extensions = {} diff --git a/TTS/Kokoro/.venv/Lib/site-packages/spacy/tests/serialize/test_serialize_extension_attrs.py b/TTS/Kokoro/.venv/Lib/site-packages/spacy/tests/serialize/test_serialize_extension_attrs.py new file mode 100644 index 0000000000000000000000000000000000000000..323b43f95e226b2e2eaf349e73dfa2d921ff7452 --- /dev/null +++ b/TTS/Kokoro/.venv/Lib/site-packages/spacy/tests/serialize/test_serialize_extension_attrs.py @@ -0,0 +1,35 @@ +import pytest + +from spacy.tokens import Doc, Token +from spacy.vocab import Vocab + + +@pytest.fixture +def doc_w_attrs(en_tokenizer): + Doc.set_extension("_test_attr", default=False) + Doc.set_extension("_test_prop", getter=lambda doc: len(doc.text)) + Doc.set_extension("_test_method", method=lambda doc, arg: f"{len(doc.text)}{arg}") + doc = en_tokenizer("This is a test.") + doc._._test_attr = "test" + + Token.set_extension("_test_token", default="t0") + doc[1]._._test_token = "t1" + + yield doc + + Doc.remove_extension("_test_attr") + Doc.remove_extension("_test_prop") + Doc.remove_extension("_test_method") + Token.remove_extension("_test_token") + + +def test_serialize_ext_attrs_from_bytes(doc_w_attrs): + doc_b = doc_w_attrs.to_bytes() + doc = Doc(Vocab()).from_bytes(doc_b) + assert doc._.has("_test_attr") + assert doc._._test_attr == "test" + assert doc._._test_prop == len(doc.text) + assert doc._._test_method("test") == f"{len(doc.text)}test" + assert doc[0]._._test_token == "t0" + assert doc[1]._._test_token == "t1" + assert doc[2]._._test_token == "t0" diff --git a/TTS/Kokoro/.venv/Lib/site-packages/spacy/tests/serialize/test_serialize_kb.py b/TTS/Kokoro/.venv/Lib/site-packages/spacy/tests/serialize/test_serialize_kb.py new file mode 100644 index 0000000000000000000000000000000000000000..855ec666f05fbcb44800fc5e49c02be7f0c21351 --- /dev/null +++ b/TTS/Kokoro/.venv/Lib/site-packages/spacy/tests/serialize/test_serialize_kb.py @@ -0,0 +1,197 @@ +from pathlib import Path +from typing import Any, Callable, Dict, Iterable + +import srsly +from numpy import zeros +from thinc.api import Config + +from spacy import Errors, util +from spacy.kb.kb_in_memory import InMemoryLookupKB +from spacy.util import SimpleFrozenList, ensure_path, load_model_from_config, registry +from spacy.vocab import Vocab + +from ..util import make_tempdir + + +def test_serialize_kb_disk(en_vocab): + # baseline assertions + kb1 = _get_dummy_kb(en_vocab) + _check_kb(kb1) + + # dumping to file & loading back in + with make_tempdir() as d: + dir_path = ensure_path(d) + if not dir_path.exists(): + dir_path.mkdir() + file_path = dir_path / "kb" + kb1.to_disk(str(file_path)) + kb2 = InMemoryLookupKB(vocab=en_vocab, entity_vector_length=3) + kb2.from_disk(str(file_path)) + + # final assertions + _check_kb(kb2) + + +def _get_dummy_kb(vocab): + kb = InMemoryLookupKB(vocab, entity_vector_length=3) + kb.add_entity(entity="Q53", freq=33, entity_vector=[0, 5, 3]) + kb.add_entity(entity="Q17", freq=2, entity_vector=[7, 1, 0]) + kb.add_entity(entity="Q007", freq=7, entity_vector=[0, 0, 7]) + kb.add_entity(entity="Q44", freq=342, entity_vector=[4, 4, 4]) + + kb.add_alias(alias="double07", entities=["Q17", "Q007"], probabilities=[0.1, 0.9]) + kb.add_alias( + alias="guy", + entities=["Q53", "Q007", "Q17", "Q44"], + probabilities=[0.3, 0.3, 0.2, 0.1], + ) + kb.add_alias(alias="random", entities=["Q007"], probabilities=[1.0]) + + return kb + + +def _check_kb(kb): + # check entities + assert kb.get_size_entities() == 4 + for entity_string in ["Q53", "Q17", "Q007", "Q44"]: + assert entity_string in kb.get_entity_strings() + for entity_string in ["", "Q0"]: + assert entity_string not in kb.get_entity_strings() + + # check aliases + assert kb.get_size_aliases() == 3 + for alias_string in ["double07", "guy", "random"]: + assert alias_string in kb.get_alias_strings() + for alias_string in ["nothingness", "", "randomnoise"]: + assert alias_string not in kb.get_alias_strings() + + # check candidates & probabilities + candidates = sorted(kb.get_alias_candidates("double07"), key=lambda x: x.entity_) + assert len(candidates) == 2 + + assert candidates[0].entity_ == "Q007" + assert 6.999 < candidates[0].entity_freq < 7.01 + assert candidates[0].entity_vector == [0, 0, 7] + assert candidates[0].alias_ == "double07" + assert 0.899 < candidates[0].prior_prob < 0.901 + + assert candidates[1].entity_ == "Q17" + assert 1.99 < candidates[1].entity_freq < 2.01 + assert candidates[1].entity_vector == [7, 1, 0] + assert candidates[1].alias_ == "double07" + assert 0.099 < candidates[1].prior_prob < 0.101 + + +def test_serialize_subclassed_kb(): + """Check that IO of a custom KB works fine as part of an EL pipe.""" + + config_string = """ + [nlp] + lang = "en" + pipeline = ["entity_linker"] + + [components] + + [components.entity_linker] + factory = "entity_linker" + + [components.entity_linker.generate_empty_kb] + @misc = "kb_test.CustomEmptyKB.v1" + + [initialize] + + [initialize.components] + + [initialize.components.entity_linker] + + [initialize.components.entity_linker.kb_loader] + @misc = "kb_test.CustomKB.v1" + entity_vector_length = 342 + custom_field = 666 + """ + + class SubInMemoryLookupKB(InMemoryLookupKB): + def __init__(self, vocab, entity_vector_length, custom_field): + super().__init__(vocab, entity_vector_length) + self.custom_field = custom_field + + def to_disk(self, path, exclude: Iterable[str] = SimpleFrozenList()): + """We overwrite InMemoryLookupKB.to_disk() to ensure that self.custom_field is stored as well.""" + path = ensure_path(path) + if not path.exists(): + path.mkdir(parents=True) + if not path.is_dir(): + raise ValueError(Errors.E928.format(loc=path)) + + def serialize_custom_fields(file_path: Path) -> None: + srsly.write_json(file_path, {"custom_field": self.custom_field}) + + serialize = { + "contents": lambda p: self.write_contents(p), + "strings.json": lambda p: self.vocab.strings.to_disk(p), + "custom_fields": lambda p: serialize_custom_fields(p), + } + util.to_disk(path, serialize, exclude) + + def from_disk(self, path, exclude: Iterable[str] = SimpleFrozenList()): + """We overwrite InMemoryLookupKB.from_disk() to ensure that self.custom_field is loaded as well.""" + path = ensure_path(path) + if not path.exists(): + raise ValueError(Errors.E929.format(loc=path)) + if not path.is_dir(): + raise ValueError(Errors.E928.format(loc=path)) + + def deserialize_custom_fields(file_path: Path) -> None: + self.custom_field = srsly.read_json(file_path)["custom_field"] + + deserialize: Dict[str, Callable[[Any], Any]] = { + "contents": lambda p: self.read_contents(p), + "strings.json": lambda p: self.vocab.strings.from_disk(p), + "custom_fields": lambda p: deserialize_custom_fields(p), + } + util.from_disk(path, deserialize, exclude) + + @registry.misc("kb_test.CustomEmptyKB.v1") + def empty_custom_kb() -> Callable[[Vocab, int], SubInMemoryLookupKB]: + def empty_kb_factory(vocab: Vocab, entity_vector_length: int): + return SubInMemoryLookupKB( + vocab=vocab, + entity_vector_length=entity_vector_length, + custom_field=0, + ) + + return empty_kb_factory + + @registry.misc("kb_test.CustomKB.v1") + def custom_kb( + entity_vector_length: int, custom_field: int + ) -> Callable[[Vocab], SubInMemoryLookupKB]: + def custom_kb_factory(vocab): + kb = SubInMemoryLookupKB( + vocab=vocab, + entity_vector_length=entity_vector_length, + custom_field=custom_field, + ) + kb.add_entity("random_entity", 0.0, zeros(entity_vector_length)) + return kb + + return custom_kb_factory + + config = Config().from_str(config_string) + nlp = load_model_from_config(config, auto_fill=True) + nlp.initialize() + + entity_linker = nlp.get_pipe("entity_linker") + assert type(entity_linker.kb) == SubInMemoryLookupKB + assert entity_linker.kb.entity_vector_length == 342 + assert entity_linker.kb.custom_field == 666 + + # Make sure the custom KB is serialized correctly + with make_tempdir() as tmp_dir: + nlp.to_disk(tmp_dir) + nlp2 = util.load_model_from_path(tmp_dir) + entity_linker2 = nlp2.get_pipe("entity_linker") + # After IO, the KB is the standard one + assert type(entity_linker2.kb) == SubInMemoryLookupKB + assert entity_linker2.kb.entity_vector_length == 342 + assert entity_linker2.kb.custom_field == 666 diff --git a/TTS/Kokoro/.venv/Lib/site-packages/spacy/tests/serialize/test_serialize_language.py b/TTS/Kokoro/.venv/Lib/site-packages/spacy/tests/serialize/test_serialize_language.py new file mode 100644 index 0000000000000000000000000000000000000000..aabede9ed2f7c38c815a85373bae1d590712ee39 --- /dev/null +++ b/TTS/Kokoro/.venv/Lib/site-packages/spacy/tests/serialize/test_serialize_language.py @@ -0,0 +1,135 @@ +import pickle +import re + +import pytest + +from spacy.lang.en import English +from spacy.lang.it import Italian +from spacy.language import Language +from spacy.tokenizer import Tokenizer +from spacy.training import Example +from spacy.util import load_config_from_str + +from ..util import make_tempdir + + +@pytest.fixture +def meta_data(): + return { + "name": "name-in-fixture", + "version": "version-in-fixture", + "description": "description-in-fixture", + "author": "author-in-fixture", + "email": "email-in-fixture", + "url": "url-in-fixture", + "license": "license-in-fixture", + "vectors": {"width": 0, "vectors": 0, "keys": 0, "name": None}, + } + + +@pytest.mark.issue(2482) +def test_issue2482(): + """Test we can serialize and deserialize a blank NER or parser model.""" + nlp = Italian() + nlp.add_pipe("ner") + b = nlp.to_bytes() + Italian().from_bytes(b) + + +CONFIG_ISSUE_6950 = """ +[nlp] +lang = "en" +pipeline = ["tok2vec", "tagger"] + +[components] + +[components.tok2vec] +factory = "tok2vec" + +[components.tok2vec.model] +@architectures = "spacy.Tok2Vec.v1" + +[components.tok2vec.model.embed] +@architectures = "spacy.MultiHashEmbed.v1" +width = ${components.tok2vec.model.encode:width} +attrs = ["NORM","PREFIX","SUFFIX","SHAPE"] +rows = [5000,2500,2500,2500] +include_static_vectors = false + +[components.tok2vec.model.encode] +@architectures = "spacy.MaxoutWindowEncoder.v1" +width = 96 +depth = 4 +window_size = 1 +maxout_pieces = 3 + +[components.ner] +factory = "ner" + +[components.tagger] +factory = "tagger" + +[components.tagger.model] +@architectures = "spacy.Tagger.v2" +nO = null + +[components.tagger.model.tok2vec] +@architectures = "spacy.Tok2VecListener.v1" +width = ${components.tok2vec.model.encode:width} +upstream = "*" +""" + + +@pytest.mark.issue(6950) +def test_issue6950(): + """Test that the nlp object with initialized tok2vec with listeners pickles + correctly (and doesn't have lambdas). + """ + nlp = English.from_config(load_config_from_str(CONFIG_ISSUE_6950)) + nlp.initialize(lambda: [Example.from_dict(nlp.make_doc("hello"), {"tags": ["V"]})]) + pickle.dumps(nlp) + nlp("hello") + pickle.dumps(nlp) + + +def test_serialize_language_meta_disk(meta_data): + language = Language(meta=meta_data) + with make_tempdir() as d: + language.to_disk(d) + new_language = Language().from_disk(d) + assert new_language.meta == language.meta + + +def test_serialize_with_custom_tokenizer(): + """Test that serialization with custom tokenizer works without token_match. + See: https://support.prodi.gy/t/how-to-save-a-custom-tokenizer/661/2 + """ + prefix_re = re.compile(r"""1/|2/|:[0-9][0-9][A-K]:|:[0-9][0-9]:""") + suffix_re = re.compile(r"""""") + infix_re = re.compile(r"""[~]""") + + def custom_tokenizer(nlp): + return Tokenizer( + nlp.vocab, + {}, + prefix_search=prefix_re.search, + suffix_search=suffix_re.search, + infix_finditer=infix_re.finditer, + ) + + nlp = Language() + nlp.tokenizer = custom_tokenizer(nlp) + with make_tempdir() as d: + nlp.to_disk(d) + + +def test_serialize_language_exclude(meta_data): + name = "name-in-fixture" + nlp = Language(meta=meta_data) + assert nlp.meta["name"] == name + new_nlp = Language().from_bytes(nlp.to_bytes()) + assert new_nlp.meta["name"] == name + new_nlp = Language().from_bytes(nlp.to_bytes(), exclude=["meta"]) + assert not new_nlp.meta["name"] == name + new_nlp = Language().from_bytes(nlp.to_bytes(exclude=["meta"])) + assert not new_nlp.meta["name"] == name diff --git a/TTS/Kokoro/.venv/Lib/site-packages/spacy/tests/serialize/test_serialize_pipeline.py b/TTS/Kokoro/.venv/Lib/site-packages/spacy/tests/serialize/test_serialize_pipeline.py new file mode 100644 index 0000000000000000000000000000000000000000..cf0772356312c53d81eddd5b4f73370c3ee76a17 --- /dev/null +++ b/TTS/Kokoro/.venv/Lib/site-packages/spacy/tests/serialize/test_serialize_pipeline.py @@ -0,0 +1,477 @@ +import pickle + +import pytest +import srsly +from thinc.api import Linear + +import spacy +from spacy import Vocab, load, registry +from spacy.lang.en import English +from spacy.language import Language +from spacy.pipeline import ( + DependencyParser, + EntityRecognizer, + EntityRuler, + SentenceRecognizer, + Tagger, + TextCategorizer, + TrainablePipe, +) +from spacy.pipeline.dep_parser import DEFAULT_PARSER_MODEL +from spacy.pipeline.senter import DEFAULT_SENTER_MODEL +from spacy.pipeline.tagger import DEFAULT_TAGGER_MODEL +from spacy.pipeline.textcat import DEFAULT_SINGLE_TEXTCAT_MODEL +from spacy.tokens import Span +from spacy.util import ensure_path, load_model + +from ..util import make_tempdir + +test_parsers = [DependencyParser, EntityRecognizer] + + +@pytest.fixture +def parser(en_vocab): + config = { + "learn_tokens": False, + "min_action_freq": 30, + "update_with_oracle_cut_size": 100, + "beam_width": 1, + "beam_update_prob": 1.0, + "beam_density": 0.0, + } + cfg = {"model": DEFAULT_PARSER_MODEL} + model = registry.resolve(cfg, validate=True)["model"] + parser = DependencyParser(en_vocab, model, **config) + parser.add_label("nsubj") + return parser + + +@pytest.fixture +def blank_parser(en_vocab): + config = { + "learn_tokens": False, + "min_action_freq": 30, + "update_with_oracle_cut_size": 100, + "beam_width": 1, + "beam_update_prob": 1.0, + "beam_density": 0.0, + } + cfg = {"model": DEFAULT_PARSER_MODEL} + model = registry.resolve(cfg, validate=True)["model"] + parser = DependencyParser(en_vocab, model, **config) + return parser + + +@pytest.fixture +def taggers(en_vocab): + cfg = {"model": DEFAULT_TAGGER_MODEL} + model = registry.resolve(cfg, validate=True)["model"] + tagger1 = Tagger(en_vocab, model) + tagger2 = Tagger(en_vocab, model) + return tagger1, tagger2 + + +@pytest.mark.issue(3456) +def test_issue3456(): + # this crashed because of a padding error in layer.ops.unflatten in thinc + nlp = English() + tagger = nlp.add_pipe("tagger") + tagger.add_label("A") + nlp.initialize() + list(nlp.pipe(["hi", ""])) + + +@pytest.mark.issue(3526) +def test_issue_3526_1(en_vocab): + patterns = [ + {"label": "HELLO", "pattern": "hello world"}, + {"label": "BYE", "pattern": [{"LOWER": "bye"}, {"LOWER": "bye"}]}, + {"label": "HELLO", "pattern": [{"ORTH": "HELLO"}]}, + {"label": "COMPLEX", "pattern": [{"ORTH": "foo", "OP": "*"}]}, + {"label": "TECH_ORG", "pattern": "Apple", "id": "a1"}, + ] + nlp = Language(vocab=en_vocab) + ruler = EntityRuler(nlp, patterns=patterns, overwrite_ents=True) + ruler_bytes = ruler.to_bytes() + assert len(ruler) == len(patterns) + assert len(ruler.labels) == 4 + assert ruler.overwrite + new_ruler = EntityRuler(nlp) + new_ruler = new_ruler.from_bytes(ruler_bytes) + assert len(new_ruler) == len(ruler) + assert len(new_ruler.labels) == 4 + assert new_ruler.overwrite == ruler.overwrite + assert new_ruler.ent_id_sep == ruler.ent_id_sep + + +@pytest.mark.issue(3526) +def test_issue_3526_2(en_vocab): + patterns = [ + {"label": "HELLO", "pattern": "hello world"}, + {"label": "BYE", "pattern": [{"LOWER": "bye"}, {"LOWER": "bye"}]}, + {"label": "HELLO", "pattern": [{"ORTH": "HELLO"}]}, + {"label": "COMPLEX", "pattern": [{"ORTH": "foo", "OP": "*"}]}, + {"label": "TECH_ORG", "pattern": "Apple", "id": "a1"}, + ] + nlp = Language(vocab=en_vocab) + ruler = EntityRuler(nlp, patterns=patterns, overwrite_ents=True) + bytes_old_style = srsly.msgpack_dumps(ruler.patterns) + new_ruler = EntityRuler(nlp) + new_ruler = new_ruler.from_bytes(bytes_old_style) + assert len(new_ruler) == len(ruler) + for pattern in ruler.patterns: + assert pattern in new_ruler.patterns + assert new_ruler.overwrite is not ruler.overwrite + + +@pytest.mark.issue(3526) +def test_issue_3526_3(en_vocab): + patterns = [ + {"label": "HELLO", "pattern": "hello world"}, + {"label": "BYE", "pattern": [{"LOWER": "bye"}, {"LOWER": "bye"}]}, + {"label": "HELLO", "pattern": [{"ORTH": "HELLO"}]}, + {"label": "COMPLEX", "pattern": [{"ORTH": "foo", "OP": "*"}]}, + {"label": "TECH_ORG", "pattern": "Apple", "id": "a1"}, + ] + nlp = Language(vocab=en_vocab) + ruler = EntityRuler(nlp, patterns=patterns, overwrite_ents=True) + with make_tempdir() as tmpdir: + out_file = tmpdir / "entity_ruler" + srsly.write_jsonl(out_file.with_suffix(".jsonl"), ruler.patterns) + new_ruler = EntityRuler(nlp).from_disk(out_file) + for pattern in ruler.patterns: + assert pattern in new_ruler.patterns + assert len(new_ruler) == len(ruler) + assert new_ruler.overwrite is not ruler.overwrite + + +@pytest.mark.issue(3526) +def test_issue_3526_4(en_vocab): + nlp = Language(vocab=en_vocab) + patterns = [{"label": "ORG", "pattern": "Apple"}] + config = {"overwrite_ents": True} + ruler = nlp.add_pipe("entity_ruler", config=config) + ruler.add_patterns(patterns) + with make_tempdir() as tmpdir: + nlp.to_disk(tmpdir) + ruler = nlp.get_pipe("entity_ruler") + assert ruler.patterns == [{"label": "ORG", "pattern": "Apple"}] + assert ruler.overwrite is True + nlp2 = load(tmpdir) + new_ruler = nlp2.get_pipe("entity_ruler") + assert new_ruler.patterns == [{"label": "ORG", "pattern": "Apple"}] + assert new_ruler.overwrite is True + + +@pytest.mark.issue(4042) +def test_issue4042(): + """Test that serialization of an EntityRuler before NER works fine.""" + nlp = English() + # add ner pipe + ner = nlp.add_pipe("ner") + ner.add_label("SOME_LABEL") + nlp.initialize() + # Add entity ruler + patterns = [ + {"label": "MY_ORG", "pattern": "Apple"}, + {"label": "MY_GPE", "pattern": [{"lower": "san"}, {"lower": "francisco"}]}, + ] + # works fine with "after" + ruler = nlp.add_pipe("entity_ruler", before="ner") + ruler.add_patterns(patterns) + doc1 = nlp("What do you think about Apple ?") + assert doc1.ents[0].label_ == "MY_ORG" + + with make_tempdir() as d: + output_dir = ensure_path(d) + if not output_dir.exists(): + output_dir.mkdir() + nlp.to_disk(output_dir) + nlp2 = load_model(output_dir) + doc2 = nlp2("What do you think about Apple ?") + assert doc2.ents[0].label_ == "MY_ORG" + + +@pytest.mark.issue(4042) +def test_issue4042_bug2(): + """ + Test that serialization of an NER works fine when new labels were added. + This is the second bug of two bugs underlying the issue 4042. + """ + nlp1 = English() + # add ner pipe + ner1 = nlp1.add_pipe("ner") + ner1.add_label("SOME_LABEL") + nlp1.initialize() + # add a new label to the doc + doc1 = nlp1("What do you think about Apple ?") + assert len(ner1.labels) == 1 + assert "SOME_LABEL" in ner1.labels + apple_ent = Span(doc1, 5, 6, label="MY_ORG") + doc1.ents = list(doc1.ents) + [apple_ent] + # Add the label explicitly. Previously we didn't require this. + ner1.add_label("MY_ORG") + ner1(doc1) + assert len(ner1.labels) == 2 + assert "SOME_LABEL" in ner1.labels + assert "MY_ORG" in ner1.labels + with make_tempdir() as d: + # assert IO goes fine + output_dir = ensure_path(d) + if not output_dir.exists(): + output_dir.mkdir() + ner1.to_disk(output_dir) + config = {} + ner2 = nlp1.create_pipe("ner", config=config) + ner2.from_disk(output_dir) + assert len(ner2.labels) == 2 + + +@pytest.mark.issue(4725) +def test_issue4725_1(): + """Ensure the pickling of the NER goes well""" + vocab = Vocab(vectors_name="test_vocab_add_vector") + nlp = English(vocab=vocab) + config = { + "update_with_oracle_cut_size": 111, + } + ner = nlp.create_pipe("ner", config=config) + with make_tempdir() as tmp_path: + with (tmp_path / "ner.pkl").open("wb") as file_: + pickle.dump(ner, file_) + assert ner.cfg["update_with_oracle_cut_size"] == 111 + + with (tmp_path / "ner.pkl").open("rb") as file_: + ner2 = pickle.load(file_) + assert ner2.cfg["update_with_oracle_cut_size"] == 111 + + +@pytest.mark.parametrize("Parser", test_parsers) +def test_serialize_parser_roundtrip_bytes(en_vocab, Parser): + cfg = {"model": DEFAULT_PARSER_MODEL} + model = registry.resolve(cfg, validate=True)["model"] + parser = Parser(en_vocab, model) + new_parser = Parser(en_vocab, model) + new_parser = new_parser.from_bytes(parser.to_bytes(exclude=["vocab"])) + bytes_2 = new_parser.to_bytes(exclude=["vocab"]) + bytes_3 = parser.to_bytes(exclude=["vocab"]) + assert len(bytes_2) == len(bytes_3) + assert bytes_2 == bytes_3 + + +@pytest.mark.parametrize("Parser", test_parsers) +def test_serialize_parser_strings(Parser): + vocab1 = Vocab() + label = "FunnyLabel" + assert label not in vocab1.strings + cfg = {"model": DEFAULT_PARSER_MODEL} + model = registry.resolve(cfg, validate=True)["model"] + parser1 = Parser(vocab1, model) + parser1.add_label(label) + assert label in parser1.vocab.strings + vocab2 = Vocab() + assert label not in vocab2.strings + parser2 = Parser(vocab2, model) + parser2 = parser2.from_bytes(parser1.to_bytes(exclude=["vocab"])) + assert label in parser2.vocab.strings + + +@pytest.mark.parametrize("Parser", test_parsers) +def test_serialize_parser_roundtrip_disk(en_vocab, Parser): + cfg = {"model": DEFAULT_PARSER_MODEL} + model = registry.resolve(cfg, validate=True)["model"] + parser = Parser(en_vocab, model) + with make_tempdir() as d: + file_path = d / "parser" + parser.to_disk(file_path) + parser_d = Parser(en_vocab, model) + parser_d = parser_d.from_disk(file_path) + parser_bytes = parser.to_bytes(exclude=["model", "vocab"]) + parser_d_bytes = parser_d.to_bytes(exclude=["model", "vocab"]) + assert len(parser_bytes) == len(parser_d_bytes) + assert parser_bytes == parser_d_bytes + + +def test_to_from_bytes(parser, blank_parser): + assert parser.model is not True + assert blank_parser.model is not True + assert blank_parser.moves.n_moves != parser.moves.n_moves + bytes_data = parser.to_bytes(exclude=["vocab"]) + # the blank parser needs to be resized before we can call from_bytes + blank_parser.model.attrs["resize_output"](blank_parser.model, parser.moves.n_moves) + blank_parser.from_bytes(bytes_data) + assert blank_parser.model is not True + assert blank_parser.moves.n_moves == parser.moves.n_moves + + +def test_serialize_tagger_roundtrip_bytes(en_vocab, taggers): + tagger1 = taggers[0] + tagger1_b = tagger1.to_bytes() + tagger1 = tagger1.from_bytes(tagger1_b) + assert tagger1.to_bytes() == tagger1_b + cfg = {"model": DEFAULT_TAGGER_MODEL} + model = registry.resolve(cfg, validate=True)["model"] + new_tagger1 = Tagger(en_vocab, model).from_bytes(tagger1_b) + new_tagger1_b = new_tagger1.to_bytes() + assert len(new_tagger1_b) == len(tagger1_b) + assert new_tagger1_b == tagger1_b + + +def test_serialize_tagger_roundtrip_disk(en_vocab, taggers): + tagger1, tagger2 = taggers + with make_tempdir() as d: + file_path1 = d / "tagger1" + file_path2 = d / "tagger2" + tagger1.to_disk(file_path1) + tagger2.to_disk(file_path2) + cfg = {"model": DEFAULT_TAGGER_MODEL} + model = registry.resolve(cfg, validate=True)["model"] + tagger1_d = Tagger(en_vocab, model).from_disk(file_path1) + tagger2_d = Tagger(en_vocab, model).from_disk(file_path2) + assert tagger1_d.to_bytes() == tagger2_d.to_bytes() + + +def test_serialize_tagger_strings(en_vocab, de_vocab, taggers): + label = "SomeWeirdLabel" + assert label not in en_vocab.strings + assert label not in de_vocab.strings + tagger = taggers[0] + assert label not in tagger.vocab.strings + with make_tempdir() as d: + # check that custom labels are serialized as part of the component's strings.jsonl + tagger.add_label(label) + assert label in tagger.vocab.strings + file_path = d / "tagger1" + tagger.to_disk(file_path) + # ensure that the custom strings are loaded back in when using the tagger in another pipeline + cfg = {"model": DEFAULT_TAGGER_MODEL} + model = registry.resolve(cfg, validate=True)["model"] + tagger2 = Tagger(de_vocab, model).from_disk(file_path) + assert label in tagger2.vocab.strings + + +@pytest.mark.issue(1105) +def test_serialize_textcat_empty(en_vocab): + # See issue #1105 + cfg = {"model": DEFAULT_SINGLE_TEXTCAT_MODEL} + model = registry.resolve(cfg, validate=True)["model"] + textcat = TextCategorizer(en_vocab, model, threshold=0.5) + textcat.to_bytes(exclude=["vocab"]) + + +@pytest.mark.parametrize("Parser", test_parsers) +def test_serialize_pipe_exclude(en_vocab, Parser): + cfg = {"model": DEFAULT_PARSER_MODEL} + model = registry.resolve(cfg, validate=True)["model"] + + def get_new_parser(): + new_parser = Parser(en_vocab, model) + return new_parser + + parser = Parser(en_vocab, model) + parser.cfg["foo"] = "bar" + new_parser = get_new_parser().from_bytes(parser.to_bytes(exclude=["vocab"])) + assert "foo" in new_parser.cfg + new_parser = get_new_parser().from_bytes( + parser.to_bytes(exclude=["vocab"]), exclude=["cfg"] + ) + assert "foo" not in new_parser.cfg + new_parser = get_new_parser().from_bytes( + parser.to_bytes(exclude=["cfg"]), exclude=["vocab"] + ) + assert "foo" not in new_parser.cfg + + +def test_serialize_sentencerecognizer(en_vocab): + cfg = {"model": DEFAULT_SENTER_MODEL} + model = registry.resolve(cfg, validate=True)["model"] + sr = SentenceRecognizer(en_vocab, model) + sr_b = sr.to_bytes() + sr_d = SentenceRecognizer(en_vocab, model).from_bytes(sr_b) + assert sr.to_bytes() == sr_d.to_bytes() + + +def test_serialize_pipeline_disable_enable(): + nlp = English() + nlp.add_pipe("ner") + nlp.add_pipe("tagger") + nlp.disable_pipe("tagger") + assert nlp.config["nlp"]["disabled"] == ["tagger"] + config = nlp.config.copy() + nlp2 = English.from_config(config) + assert nlp2.pipe_names == ["ner"] + assert nlp2.component_names == ["ner", "tagger"] + assert nlp2.disabled == ["tagger"] + assert nlp2.config["nlp"]["disabled"] == ["tagger"] + with make_tempdir() as d: + nlp2.to_disk(d) + nlp3 = spacy.load(d) + assert nlp3.pipe_names == ["ner"] + assert nlp3.component_names == ["ner", "tagger"] + with make_tempdir() as d: + nlp3.to_disk(d) + nlp4 = spacy.load(d, disable=["ner"]) + assert nlp4.pipe_names == [] + assert nlp4.component_names == ["ner", "tagger"] + assert nlp4.disabled == ["ner", "tagger"] + with make_tempdir() as d: + nlp.to_disk(d) + nlp5 = spacy.load(d, exclude=["tagger"]) + assert nlp5.pipe_names == ["ner"] + assert nlp5.component_names == ["ner"] + assert nlp5.disabled == [] + + +def test_serialize_custom_trainable_pipe(): + class BadCustomPipe1(TrainablePipe): + def __init__(self, vocab): + pass + + class BadCustomPipe2(TrainablePipe): + def __init__(self, vocab): + self.vocab = vocab + self.model = None + + class CustomPipe(TrainablePipe): + def __init__(self, vocab, model): + self.vocab = vocab + self.model = model + + pipe = BadCustomPipe1(Vocab()) + with pytest.raises(ValueError): + pipe.to_bytes() + with make_tempdir() as d: + with pytest.raises(ValueError): + pipe.to_disk(d) + pipe = BadCustomPipe2(Vocab()) + with pytest.raises(ValueError): + pipe.to_bytes() + with make_tempdir() as d: + with pytest.raises(ValueError): + pipe.to_disk(d) + pipe = CustomPipe(Vocab(), Linear()) + pipe_bytes = pipe.to_bytes() + new_pipe = CustomPipe(Vocab(), Linear()).from_bytes(pipe_bytes) + assert new_pipe.to_bytes() == pipe_bytes + with make_tempdir() as d: + pipe.to_disk(d) + new_pipe = CustomPipe(Vocab(), Linear()).from_disk(d) + assert new_pipe.to_bytes() == pipe_bytes + + +def test_load_without_strings(): + nlp = spacy.blank("en") + orig_strings_length = len(nlp.vocab.strings) + word = "unlikely_word_" * 20 + nlp.vocab.strings.add(word) + assert len(nlp.vocab.strings) == orig_strings_length + 1 + with make_tempdir() as d: + nlp.to_disk(d) + # reload with strings + reloaded_nlp = load(d) + assert len(nlp.vocab.strings) == len(reloaded_nlp.vocab.strings) + assert word in reloaded_nlp.vocab.strings + # reload without strings + reloaded_nlp = load(d, exclude=["strings"]) + assert orig_strings_length == len(reloaded_nlp.vocab.strings) + assert word not in reloaded_nlp.vocab.strings diff --git a/TTS/Kokoro/.venv/Lib/site-packages/spacy/tests/serialize/test_serialize_span_groups.py b/TTS/Kokoro/.venv/Lib/site-packages/spacy/tests/serialize/test_serialize_span_groups.py new file mode 100644 index 0000000000000000000000000000000000000000..1b345c683410b937828b64fba486a3084ec48ff7 --- /dev/null +++ b/TTS/Kokoro/.venv/Lib/site-packages/spacy/tests/serialize/test_serialize_span_groups.py @@ -0,0 +1,161 @@ +import pytest + +from spacy.tokens import Span, SpanGroup +from spacy.tokens._dict_proxies import SpanGroups + + +@pytest.mark.issue(10685) +def test_issue10685(en_tokenizer): + """Test `SpanGroups` de/serialization""" + # Start with a Doc with no SpanGroups + doc = en_tokenizer("Will it blend?") + + # Test empty `SpanGroups` de/serialization: + assert len(doc.spans) == 0 + doc.spans.from_bytes(doc.spans.to_bytes()) + assert len(doc.spans) == 0 + + # Test non-empty `SpanGroups` de/serialization: + doc.spans["test"] = SpanGroup(doc, name="test", spans=[doc[0:1]]) + doc.spans["test2"] = SpanGroup(doc, name="test", spans=[doc[1:2]]) + + def assert_spangroups(): + assert len(doc.spans) == 2 + assert doc.spans["test"].name == "test" + assert doc.spans["test2"].name == "test" + assert list(doc.spans["test"]) == [doc[0:1]] + assert list(doc.spans["test2"]) == [doc[1:2]] + + # Sanity check the currently-expected behavior + assert_spangroups() + + # Now test serialization/deserialization: + doc.spans.from_bytes(doc.spans.to_bytes()) + + assert_spangroups() + + +def test_span_groups_serialization_mismatches(en_tokenizer): + """Test the serialization of multiple mismatching `SpanGroups` keys and `SpanGroup.name`s""" + doc = en_tokenizer("How now, brown cow?") + # Some variety: + # 1 SpanGroup where its name matches its key + # 2 SpanGroups that have the same name--which is not a key + # 2 SpanGroups that have the same name--which is a key + # 1 SpanGroup that is a value for 2 different keys (where its name is a key) + # 1 SpanGroup that is a value for 2 different keys (where its name is not a key) + groups = doc.spans + groups["key1"] = SpanGroup(doc, name="key1", spans=[doc[0:1], doc[1:2]]) + groups["key2"] = SpanGroup(doc, name="too", spans=[doc[3:4], doc[4:5]]) + groups["key3"] = SpanGroup(doc, name="too", spans=[doc[1:2], doc[0:1]]) + groups["key4"] = SpanGroup(doc, name="key4", spans=[doc[0:1]]) + groups["key5"] = SpanGroup(doc, name="key4", spans=[doc[0:1]]) + sg6 = SpanGroup(doc, name="key6", spans=[doc[0:1]]) + groups["key6"] = sg6 + groups["key7"] = sg6 + sg8 = SpanGroup(doc, name="also", spans=[doc[1:2]]) + groups["key8"] = sg8 + groups["key9"] = sg8 + + regroups = SpanGroups(doc).from_bytes(groups.to_bytes()) + + # Assert regroups == groups + assert regroups.keys() == groups.keys() + for key, regroup in regroups.items(): + # Assert regroup == groups[key] + assert regroup.name == groups[key].name + assert list(regroup) == list(groups[key]) + + +@pytest.mark.parametrize( + "spans_bytes,doc_text,expected_spangroups,expected_warning", + # The bytestrings below were generated from an earlier version of spaCy + # that serialized `SpanGroups` as a list of SpanGroup bytes (via SpanGroups.to_bytes). + # Comments preceding the bytestrings indicate from what Doc they were created. + [ + # Empty SpanGroups: + (b"\x90", "", {}, False), + # doc = nlp("Will it blend?") + # doc.spans['test'] = SpanGroup(doc, name='test', spans=[doc[0:1]]) + ( + b"\x91\xc4C\x83\xa4name\xa4test\xa5attrs\x80\xa5spans\x91\xc4(\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x01\x00\x00\x00\x00\x00\x00\x00\x04", + "Will it blend?", + {"test": {"name": "test", "spans": [(0, 1)]}}, + False, + ), + # doc = nlp("Will it blend?") + # doc.spans['test'] = SpanGroup(doc, name='test', spans=[doc[0:1]]) + # doc.spans['test2'] = SpanGroup(doc, name='test', spans=[doc[1:2]]) + ( + b"\x92\xc4C\x83\xa4name\xa4test\xa5attrs\x80\xa5spans\x91\xc4(\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x01\x00\x00\x00\x00\x00\x00\x00\x04\xc4C\x83\xa4name\xa4test\xa5attrs\x80\xa5spans\x91\xc4(\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x01\x00\x00\x00\x02\x00\x00\x00\x05\x00\x00\x00\x07", + "Will it blend?", + # We expect only 1 SpanGroup to be in doc.spans in this example + # because there are 2 `SpanGroup`s that have the same .name. See #10685. + {"test": {"name": "test", "spans": [(1, 2)]}}, + True, + ), + # doc = nlp('How now, brown cow?') + # doc.spans['key1'] = SpanGroup(doc, name='key1', spans=[doc[0:1], doc[1:2]]) + # doc.spans['key2'] = SpanGroup(doc, name='too', spans=[doc[3:4], doc[4:5]]) + # doc.spans['key3'] = SpanGroup(doc, name='too', spans=[doc[1:2], doc[0:1]]) + # doc.spans['key4'] = SpanGroup(doc, name='key4', spans=[doc[0:1]]) + # doc.spans['key5'] = SpanGroup(doc, name='key4', spans=[doc[0:1]]) + ( + b"\x95\xc4m\x83\xa4name\xa4key1\xa5attrs\x80\xa5spans\x92\xc4(\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x01\x00\x00\x00\x00\x00\x00\x00\x03\xc4(\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x01\x00\x00\x00\x02\x00\x00\x00\x04\x00\x00\x00\x07\xc4l\x83\xa4name\xa3too\xa5attrs\x80\xa5spans\x92\xc4(\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x03\x00\x00\x00\x04\x00\x00\x00\t\x00\x00\x00\x0e\xc4(\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x04\x00\x00\x00\x05\x00\x00\x00\x0f\x00\x00\x00\x12\xc4l\x83\xa4name\xa3too\xa5attrs\x80\xa5spans\x92\xc4(\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x01\x00\x00\x00\x02\x00\x00\x00\x04\x00\x00\x00\x07\xc4(\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x01\x00\x00\x00\x00\x00\x00\x00\x03\xc4C\x83\xa4name\xa4key4\xa5attrs\x80\xa5spans\x91\xc4(\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x01\x00\x00\x00\x00\x00\x00\x00\x03\xc4C\x83\xa4name\xa4key4\xa5attrs\x80\xa5spans\x91\xc4(\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x01\x00\x00\x00\x00\x00\x00\x00\x03", + "How now, brown cow?", + { + "key1": {"name": "key1", "spans": [(0, 1), (1, 2)]}, + "too": {"name": "too", "spans": [(1, 2), (0, 1)]}, + "key4": {"name": "key4", "spans": [(0, 1)]}, + }, + True, + ), + ], +) +def test_deserialize_span_groups_compat( + en_tokenizer, spans_bytes, doc_text, expected_spangroups, expected_warning +): + """Test backwards-compatibility of `SpanGroups` deserialization. + This uses serializations (bytes) from a prior version of spaCy (before 3.3.1). + + spans_bytes (bytes): Serialized `SpanGroups` object. + doc_text (str): Doc text. + expected_spangroups (dict): + Dict mapping every expected (after deserialization) `SpanGroups` key + to a SpanGroup's "args", where a SpanGroup's args are given as a dict: + {"name": span_group.name, + "spans": [(span0.start, span0.end), ...]} + expected_warning (bool): Whether a warning is to be expected from .from_bytes() + --i.e. if more than 1 SpanGroup has the same .name within the `SpanGroups`. + """ + doc = en_tokenizer(doc_text) + + if expected_warning: + with pytest.warns(UserWarning): + doc.spans.from_bytes(spans_bytes) + else: + # TODO: explicitly check for lack of a warning + doc.spans.from_bytes(spans_bytes) + + assert doc.spans.keys() == expected_spangroups.keys() + for name, spangroup_args in expected_spangroups.items(): + assert doc.spans[name].name == spangroup_args["name"] + spans = [Span(doc, start, end) for start, end in spangroup_args["spans"]] + assert list(doc.spans[name]) == spans + + +def test_span_groups_serialization(en_tokenizer): + doc = en_tokenizer("0 1 2 3 4 5 6") + span_groups = SpanGroups(doc) + spans = [doc[0:2], doc[1:3]] + sg1 = SpanGroup(doc, spans=spans) + span_groups["key1"] = sg1 + span_groups["key2"] = sg1 + span_groups["key3"] = [] + reloaded_span_groups = SpanGroups(doc).from_bytes(span_groups.to_bytes()) + assert span_groups.keys() == reloaded_span_groups.keys() + for key, value in span_groups.items(): + assert all( + span == reloaded_span + for span, reloaded_span in zip(span_groups[key], reloaded_span_groups[key]) + ) diff --git a/TTS/Kokoro/.venv/Lib/site-packages/spacy/tests/serialize/test_serialize_tokenizer.py b/TTS/Kokoro/.venv/Lib/site-packages/spacy/tests/serialize/test_serialize_tokenizer.py new file mode 100644 index 0000000000000000000000000000000000000000..015a8b546c916e3c44b4b6243f183193ad257c9e --- /dev/null +++ b/TTS/Kokoro/.venv/Lib/site-packages/spacy/tests/serialize/test_serialize_tokenizer.py @@ -0,0 +1,149 @@ +import pickle +import re + +import pytest + +from spacy.attrs import ENT_IOB, ENT_TYPE +from spacy.lang.en import English +from spacy.tokenizer import Tokenizer +from spacy.tokens import Doc +from spacy.util import ( + compile_infix_regex, + compile_prefix_regex, + compile_suffix_regex, + get_lang_class, + load_model, +) + +from ..util import assert_packed_msg_equal, make_tempdir + + +def load_tokenizer(b): + tok = get_lang_class("en")().tokenizer + tok.from_bytes(b) + return tok + + +@pytest.mark.issue(2833) +def test_issue2833(en_vocab): + """Test that a custom error is raised if a token or span is pickled.""" + doc = Doc(en_vocab, words=["Hello", "world"]) + with pytest.raises(NotImplementedError): + pickle.dumps(doc[0]) + with pytest.raises(NotImplementedError): + pickle.dumps(doc[0:2]) + + +@pytest.mark.issue(3012) +def test_issue3012(en_vocab): + """Test that the is_tagged attribute doesn't get overwritten when we from_array + without tag information.""" + words = ["This", "is", "10", "%", "."] + tags = ["DT", "VBZ", "CD", "NN", "."] + pos = ["DET", "VERB", "NUM", "NOUN", "PUNCT"] + ents = ["O", "O", "B-PERCENT", "I-PERCENT", "O"] + doc = Doc(en_vocab, words=words, tags=tags, pos=pos, ents=ents) + assert doc.has_annotation("TAG") + expected = ("10", "NUM", "CD", "PERCENT") + assert (doc[2].text, doc[2].pos_, doc[2].tag_, doc[2].ent_type_) == expected + header = [ENT_IOB, ENT_TYPE] + ent_array = doc.to_array(header) + doc.from_array(header, ent_array) + assert (doc[2].text, doc[2].pos_, doc[2].tag_, doc[2].ent_type_) == expected + # Serializing then deserializing + doc_bytes = doc.to_bytes() + doc2 = Doc(en_vocab).from_bytes(doc_bytes) + assert (doc2[2].text, doc2[2].pos_, doc2[2].tag_, doc2[2].ent_type_) == expected + + +@pytest.mark.issue(4190) +def test_issue4190(): + def customize_tokenizer(nlp): + prefix_re = compile_prefix_regex(nlp.Defaults.prefixes) + suffix_re = compile_suffix_regex(nlp.Defaults.suffixes) + infix_re = compile_infix_regex(nlp.Defaults.infixes) + # Remove all exceptions where a single letter is followed by a period (e.g. 'h.') + exceptions = { + k: v + for k, v in dict(nlp.Defaults.tokenizer_exceptions).items() + if not (len(k) == 2 and k[1] == ".") + } + new_tokenizer = Tokenizer( + nlp.vocab, + exceptions, + prefix_search=prefix_re.search, + suffix_search=suffix_re.search, + infix_finditer=infix_re.finditer, + token_match=nlp.tokenizer.token_match, + faster_heuristics=False, + ) + nlp.tokenizer = new_tokenizer + + test_string = "Test c." + # Load default language + nlp_1 = English() + doc_1a = nlp_1(test_string) + result_1a = [token.text for token in doc_1a] # noqa: F841 + # Modify tokenizer + customize_tokenizer(nlp_1) + doc_1b = nlp_1(test_string) + result_1b = [token.text for token in doc_1b] + # Save and Reload + with make_tempdir() as model_dir: + nlp_1.to_disk(model_dir) + nlp_2 = load_model(model_dir) + # This should be the modified tokenizer + doc_2 = nlp_2(test_string) + result_2 = [token.text for token in doc_2] + assert result_1b == result_2 + assert nlp_2.tokenizer.faster_heuristics is False + + +def test_serialize_custom_tokenizer(en_vocab, en_tokenizer): + """Test that custom tokenizer with not all functions defined or empty + properties can be serialized and deserialized correctly (see #2494, + #4991).""" + tokenizer = Tokenizer(en_vocab, suffix_search=en_tokenizer.suffix_search) + tokenizer_bytes = tokenizer.to_bytes() + Tokenizer(en_vocab).from_bytes(tokenizer_bytes) + + # test that empty/unset values are set correctly on deserialization + tokenizer = get_lang_class("en")().tokenizer + tokenizer.token_match = re.compile("test").match + assert tokenizer.rules != {} + assert tokenizer.token_match is not None + assert tokenizer.url_match is not None + assert tokenizer.prefix_search is not None + assert tokenizer.infix_finditer is not None + tokenizer.from_bytes(tokenizer_bytes) + assert tokenizer.rules == {} + assert tokenizer.token_match is None + assert tokenizer.url_match is None + assert tokenizer.prefix_search is None + assert tokenizer.infix_finditer is None + + tokenizer = Tokenizer(en_vocab, rules={"ABC.": [{"ORTH": "ABC"}, {"ORTH": "."}]}) + tokenizer.rules = {} + tokenizer_bytes = tokenizer.to_bytes() + tokenizer_reloaded = Tokenizer(en_vocab).from_bytes(tokenizer_bytes) + assert tokenizer_reloaded.rules == {} + + +@pytest.mark.parametrize("text", ["I💜you", "they’re", "“hello”"]) +def test_serialize_tokenizer_roundtrip_bytes(en_tokenizer, text): + tokenizer = en_tokenizer + new_tokenizer = load_tokenizer(tokenizer.to_bytes()) + assert_packed_msg_equal(new_tokenizer.to_bytes(), tokenizer.to_bytes()) + assert new_tokenizer.to_bytes() == tokenizer.to_bytes() + doc1 = tokenizer(text) + doc2 = new_tokenizer(text) + assert [token.text for token in doc1] == [token.text for token in doc2] + + +def test_serialize_tokenizer_roundtrip_disk(en_tokenizer): + tokenizer = en_tokenizer + with make_tempdir() as d: + file_path = d / "tokenizer" + tokenizer.to_disk(file_path) + tokenizer_d = en_tokenizer.from_disk(file_path) + assert tokenizer.to_bytes() == tokenizer_d.to_bytes() diff --git a/TTS/Kokoro/.venv/Lib/site-packages/spacy/tests/serialize/test_serialize_vocab_strings.py b/TTS/Kokoro/.venv/Lib/site-packages/spacy/tests/serialize/test_serialize_vocab_strings.py new file mode 100644 index 0000000000000000000000000000000000000000..cf29d8fb8b90c399bc567ba1952d3b15fbb2ecb2 --- /dev/null +++ b/TTS/Kokoro/.venv/Lib/site-packages/spacy/tests/serialize/test_serialize_vocab_strings.py @@ -0,0 +1,195 @@ +import pickle + +import pytest +from thinc.api import get_current_ops + +import spacy +from spacy.lang.en import English +from spacy.strings import StringStore +from spacy.tokens import Doc +from spacy.util import ensure_path, load_model +from spacy.vectors import Vectors +from spacy.vocab import Vocab + +from ..util import make_tempdir + +test_strings = [([], []), (["rats", "are", "cute"], ["i", "like", "rats"])] +test_strings_attrs = [(["rats", "are", "cute"], "Hello")] + + +@pytest.mark.issue(599) +def test_issue599(en_vocab): + doc = Doc(en_vocab) + doc2 = Doc(doc.vocab) + doc2.from_bytes(doc.to_bytes()) + assert doc2.has_annotation("DEP") + + +@pytest.mark.issue(4054) +def test_issue4054(en_vocab): + """Test that a new blank model can be made with a vocab from file, + and that serialization does not drop the language at any point.""" + nlp1 = English() + vocab1 = nlp1.vocab + with make_tempdir() as d: + vocab_dir = ensure_path(d / "vocab") + if not vocab_dir.exists(): + vocab_dir.mkdir() + vocab1.to_disk(vocab_dir) + vocab2 = Vocab().from_disk(vocab_dir) + nlp2 = spacy.blank("en", vocab=vocab2) + nlp_dir = ensure_path(d / "nlp") + if not nlp_dir.exists(): + nlp_dir.mkdir() + nlp2.to_disk(nlp_dir) + nlp3 = load_model(nlp_dir) + assert nlp3.lang == "en" + + +@pytest.mark.issue(4133) +def test_issue4133(en_vocab): + nlp = English() + vocab_bytes = nlp.vocab.to_bytes() + words = ["Apple", "is", "looking", "at", "buying", "a", "startup"] + pos = ["NOUN", "VERB", "ADP", "VERB", "PROPN", "NOUN", "ADP"] + doc = Doc(en_vocab, words=words) + for i, token in enumerate(doc): + token.pos_ = pos[i] + # usually this is already True when starting from proper models instead of blank English + doc_bytes = doc.to_bytes() + vocab = Vocab() + vocab = vocab.from_bytes(vocab_bytes) + doc = Doc(vocab).from_bytes(doc_bytes) + actual = [] + for token in doc: + actual.append(token.pos_) + assert actual == pos + + +@pytest.mark.parametrize("text", ["rat"]) +def test_serialize_vocab(en_vocab, text): + text_hash = en_vocab.strings.add(text) + vocab_bytes = en_vocab.to_bytes(exclude=["lookups"]) + new_vocab = Vocab().from_bytes(vocab_bytes) + assert new_vocab.strings[text_hash] == text + assert new_vocab.to_bytes(exclude=["lookups"]) == vocab_bytes + + +@pytest.mark.parametrize("strings1,strings2", test_strings) +def test_serialize_vocab_roundtrip_bytes(strings1, strings2): + vocab1 = Vocab(strings=strings1) + vocab2 = Vocab(strings=strings2) + vocab1_b = vocab1.to_bytes() + vocab2_b = vocab2.to_bytes() + if strings1 == strings2: + assert vocab1_b == vocab2_b + else: + assert vocab1_b != vocab2_b + vocab1 = vocab1.from_bytes(vocab1_b) + assert vocab1.to_bytes() == vocab1_b + new_vocab1 = Vocab().from_bytes(vocab1_b) + assert new_vocab1.to_bytes() == vocab1_b + assert len(new_vocab1.strings) == len(strings1) + assert sorted([s for s in new_vocab1.strings]) == sorted(strings1) + + +@pytest.mark.parametrize("strings1,strings2", test_strings) +def test_serialize_vocab_roundtrip_disk(strings1, strings2): + vocab1 = Vocab(strings=strings1) + vocab2 = Vocab(strings=strings2) + with make_tempdir() as d: + file_path1 = d / "vocab1" + file_path2 = d / "vocab2" + vocab1.to_disk(file_path1) + vocab2.to_disk(file_path2) + vocab1_d = Vocab().from_disk(file_path1) + vocab2_d = Vocab().from_disk(file_path2) + # check strings rather than lexemes, which are only reloaded on demand + assert set(strings1) == set([s for s in vocab1_d.strings]) + assert set(strings2) == set([s for s in vocab2_d.strings]) + if set(strings1) == set(strings2): + assert [s for s in vocab1_d.strings] == [s for s in vocab2_d.strings] + else: + assert [s for s in vocab1_d.strings] != [s for s in vocab2_d.strings] + + +@pytest.mark.parametrize("strings,lex_attr", test_strings_attrs) +def test_serialize_vocab_lex_attrs_bytes(strings, lex_attr): + vocab1 = Vocab(strings=strings) + vocab2 = Vocab() + vocab1[strings[0]].norm_ = lex_attr + assert vocab1[strings[0]].norm_ == lex_attr + assert vocab2[strings[0]].norm_ != lex_attr + vocab2 = vocab2.from_bytes(vocab1.to_bytes()) + assert vocab2[strings[0]].norm_ == lex_attr + + +@pytest.mark.parametrize("strings,lex_attr", test_strings_attrs) +def test_deserialize_vocab_seen_entries(strings, lex_attr): + # Reported in #2153 + vocab = Vocab(strings=strings) + vocab.from_bytes(vocab.to_bytes()) + assert len(vocab.strings) == len(strings) + + +@pytest.mark.parametrize("strings,lex_attr", test_strings_attrs) +def test_serialize_vocab_lex_attrs_disk(strings, lex_attr): + vocab1 = Vocab(strings=strings) + vocab2 = Vocab() + vocab1[strings[0]].norm_ = lex_attr + assert vocab1[strings[0]].norm_ == lex_attr + assert vocab2[strings[0]].norm_ != lex_attr + with make_tempdir() as d: + file_path = d / "vocab" + vocab1.to_disk(file_path) + vocab2 = vocab2.from_disk(file_path) + assert vocab2[strings[0]].norm_ == lex_attr + + +@pytest.mark.parametrize("strings1,strings2", test_strings) +def test_serialize_stringstore_roundtrip_bytes(strings1, strings2): + sstore1 = StringStore(strings=strings1) + sstore2 = StringStore(strings=strings2) + sstore1_b = sstore1.to_bytes() + sstore2_b = sstore2.to_bytes() + if set(strings1) == set(strings2): + assert sstore1_b == sstore2_b + else: + assert sstore1_b != sstore2_b + sstore1 = sstore1.from_bytes(sstore1_b) + assert sstore1.to_bytes() == sstore1_b + new_sstore1 = StringStore().from_bytes(sstore1_b) + assert new_sstore1.to_bytes() == sstore1_b + assert set(new_sstore1) == set(strings1) + + +@pytest.mark.parametrize("strings1,strings2", test_strings) +def test_serialize_stringstore_roundtrip_disk(strings1, strings2): + sstore1 = StringStore(strings=strings1) + sstore2 = StringStore(strings=strings2) + with make_tempdir() as d: + file_path1 = d / "strings1" + file_path2 = d / "strings2" + sstore1.to_disk(file_path1) + sstore2.to_disk(file_path2) + sstore1_d = StringStore().from_disk(file_path1) + sstore2_d = StringStore().from_disk(file_path2) + assert set(sstore1_d) == set(sstore1) + assert set(sstore2_d) == set(sstore2) + if set(strings1) == set(strings2): + assert set(sstore1_d) == set(sstore2_d) + else: + assert set(sstore1_d) != set(sstore2_d) + + +@pytest.mark.parametrize("strings,lex_attr", test_strings_attrs) +def test_pickle_vocab(strings, lex_attr): + vocab = Vocab(strings=strings) + ops = get_current_ops() + vectors = Vectors(data=ops.xp.zeros((10, 10)), mode="floret", hash_count=1) + vocab.vectors = vectors + vocab[strings[0]].norm_ = lex_attr + vocab_pickled = pickle.dumps(vocab) + vocab_unpickled = pickle.loads(vocab_pickled) + assert vocab.to_bytes() == vocab_unpickled.to_bytes() + assert vocab_unpickled.vectors.mode == "floret" diff --git a/TTS/Kokoro/.venv/Lib/site-packages/spacy/tests/tokenizer/__init__.py b/TTS/Kokoro/.venv/Lib/site-packages/spacy/tests/tokenizer/__init__.py new file mode 100644 index 0000000000000000000000000000000000000000..e69de29bb2d1d6434b8b29ae775ad8c2e48c5391 diff --git a/TTS/Kokoro/.venv/Lib/site-packages/spacy/tests/tokenizer/__pycache__/__init__.cpython-312.pyc b/TTS/Kokoro/.venv/Lib/site-packages/spacy/tests/tokenizer/__pycache__/__init__.cpython-312.pyc new file mode 100644 index 0000000000000000000000000000000000000000..c266517cafde4b4b469e21cb015d7be93910f164 Binary files /dev/null and b/TTS/Kokoro/.venv/Lib/site-packages/spacy/tests/tokenizer/__pycache__/__init__.cpython-312.pyc differ diff --git a/TTS/Kokoro/.venv/Lib/site-packages/spacy/tests/tokenizer/__pycache__/test_exceptions.cpython-312.pyc b/TTS/Kokoro/.venv/Lib/site-packages/spacy/tests/tokenizer/__pycache__/test_exceptions.cpython-312.pyc new file mode 100644 index 0000000000000000000000000000000000000000..ecf18034cf3682394863977982c71710c3d29539 Binary files /dev/null and b/TTS/Kokoro/.venv/Lib/site-packages/spacy/tests/tokenizer/__pycache__/test_exceptions.cpython-312.pyc differ diff --git a/TTS/Kokoro/.venv/Lib/site-packages/spacy/tests/tokenizer/__pycache__/test_explain.cpython-312.pyc b/TTS/Kokoro/.venv/Lib/site-packages/spacy/tests/tokenizer/__pycache__/test_explain.cpython-312.pyc new file mode 100644 index 0000000000000000000000000000000000000000..e44713f7bd3b631798ca6157a4781fbd5f36f72a Binary files /dev/null and b/TTS/Kokoro/.venv/Lib/site-packages/spacy/tests/tokenizer/__pycache__/test_explain.cpython-312.pyc differ diff --git a/TTS/Kokoro/.venv/Lib/site-packages/spacy/tests/tokenizer/__pycache__/test_naughty_strings.cpython-312.pyc b/TTS/Kokoro/.venv/Lib/site-packages/spacy/tests/tokenizer/__pycache__/test_naughty_strings.cpython-312.pyc new file mode 100644 index 0000000000000000000000000000000000000000..4611579f7339e970986e77779801359edaba8bb5 Binary files /dev/null and b/TTS/Kokoro/.venv/Lib/site-packages/spacy/tests/tokenizer/__pycache__/test_naughty_strings.cpython-312.pyc differ diff --git a/TTS/Kokoro/.venv/Lib/site-packages/spacy/tests/tokenizer/__pycache__/test_tokenizer.cpython-312.pyc b/TTS/Kokoro/.venv/Lib/site-packages/spacy/tests/tokenizer/__pycache__/test_tokenizer.cpython-312.pyc new file mode 100644 index 0000000000000000000000000000000000000000..0c55064b22d81332bd2ef5d30d04ff706e6cccc1 Binary files /dev/null and b/TTS/Kokoro/.venv/Lib/site-packages/spacy/tests/tokenizer/__pycache__/test_tokenizer.cpython-312.pyc differ diff --git a/TTS/Kokoro/.venv/Lib/site-packages/spacy/tests/tokenizer/__pycache__/test_urls.cpython-312.pyc b/TTS/Kokoro/.venv/Lib/site-packages/spacy/tests/tokenizer/__pycache__/test_urls.cpython-312.pyc new file mode 100644 index 0000000000000000000000000000000000000000..0b0a9da1497e333755543e4d91b50c2efa152c73 Binary files /dev/null and b/TTS/Kokoro/.venv/Lib/site-packages/spacy/tests/tokenizer/__pycache__/test_urls.cpython-312.pyc differ diff --git a/TTS/Kokoro/.venv/Lib/site-packages/spacy/tests/tokenizer/__pycache__/test_whitespace.cpython-312.pyc b/TTS/Kokoro/.venv/Lib/site-packages/spacy/tests/tokenizer/__pycache__/test_whitespace.cpython-312.pyc new file mode 100644 index 0000000000000000000000000000000000000000..6d8043d036d01161d0a9f38f5ec3a77432ad9ebf Binary files /dev/null and b/TTS/Kokoro/.venv/Lib/site-packages/spacy/tests/tokenizer/__pycache__/test_whitespace.cpython-312.pyc differ diff --git a/TTS/Kokoro/.venv/Lib/site-packages/spacy/tests/tokenizer/sun.txt b/TTS/Kokoro/.venv/Lib/site-packages/spacy/tests/tokenizer/sun.txt new file mode 100644 index 0000000000000000000000000000000000000000..82e97dcc0e8c6b7298841c0b4ce36d64cdc309fc --- /dev/null +++ b/TTS/Kokoro/.venv/Lib/site-packages/spacy/tests/tokenizer/sun.txt @@ -0,0 +1,4 @@ +The Sun is the star at the center of the Solar System. It is almost perfectly spherical and consists of hot plasma interwoven with magnetic fields.[12][13] It has a diameter of about 1,392,684 km (865,374 mi),[5] around 109 times that of Earth, and its mass (1.989×1030 kilograms, approximately 330,000 times the mass of Earth) accounts for about 99.86% of the total mass of the Solar System.[14] Chemically, about three quarters of the Sun's mass consists of hydrogen, while the rest is mostly helium. The remaining 1.69% (equal to 5,600 times the mass of Earth) consists of heavier elements, including oxygen, carbon, neon and iron, among others.[15] + +The Sun formed about 4.567 billion[a][16] years ago from the gravitational collapse of a region within a large molecular cloud. Most of the matter gathered in the center, while the rest flattened into an orbiting disk that would become the Solar System. The central mass became increasingly hot and dense, eventually initiating thermonuclear fusion in its core. It is thought that almost all stars form by this process. The Sun is a G-type main-sequence star (G2V) based on spectral class and it is informally designated as a yellow dwarf because its visible radiation is most intense in the yellow-green portion of the spectrum, and although it is actually white in color, from the surface of the Earth it may appear yellow because of atmospheric scattering of blue light.[17] In the spectral class label, G2 indicates its surface temperature, of approximately 5778 K (5505 °C), and V indicates that the Sun, like most stars, is a main-sequence star, and thus generates its energy by nuclear fusion of hydrogen nuclei into helium. In its core, the Sun fuses about 620 million metric tons of hydrogen each second.[18][19] +Once regarded by astronomers as a small and relatively insignificant star, the Sun is now thought to be brighter than about 85% of the stars in the Milky Way, most of which are red dwarfs.[20][21] The absolute magnitude of the Sun is +4.83; however, as the star closest to Earth, the Sun is by far the brightest object in the sky with an apparent magnitude of −26.74.[22][23] This is about 13 billion times brighter than the next brightest star, Sirius, with an apparent magnitude of −1.46. The Sun's hot corona continuously expands in space creating the solar wind, a stream of charged particles that extends to the heliopause at roughly 100 astronomical units. The bubble in the interstellar medium formed by the solar wind, the heliosphere, is the largest continuous structure in the Solar System.[24][25] diff --git a/TTS/Kokoro/.venv/Lib/site-packages/spacy/tests/tokenizer/test_exceptions.py b/TTS/Kokoro/.venv/Lib/site-packages/spacy/tests/tokenizer/test_exceptions.py new file mode 100644 index 0000000000000000000000000000000000000000..3da1342b3017d62e283437fa8d32e46449c79d96 --- /dev/null +++ b/TTS/Kokoro/.venv/Lib/site-packages/spacy/tests/tokenizer/test_exceptions.py @@ -0,0 +1,54 @@ +import sys + +import pytest + + +def test_tokenizer_handles_emoticons(tokenizer): + # Tweebo challenge (CMU) + text = ( + """:o :/ :'( >:o (: :) >.< XD -__- o.O ;D :-) @_@ :P 8D :1 >:( :D =| :> ....""" + ) + tokens = tokenizer(text) + assert tokens[0].text == ":o" + assert tokens[1].text == ":/" + assert tokens[2].text == ":'(" + assert tokens[3].text == ">:o" + assert tokens[4].text == "(:" + assert tokens[5].text == ":)" + assert tokens[6].text == ">.<" + assert tokens[7].text == "XD" + assert tokens[8].text == "-__-" + assert tokens[9].text == "o.O" + assert tokens[10].text == ";D" + assert tokens[11].text == ":-)" + assert tokens[12].text == "@_@" + assert tokens[13].text == ":P" + assert tokens[14].text == "8D" + assert tokens[15].text == ":1" + assert tokens[16].text == ">:(" + assert tokens[17].text == ":D" + assert tokens[18].text == "=|" + assert tokens[19].text == ":>" + assert tokens[20].text == "...." + + +@pytest.mark.parametrize("text,length", [("108)", 2), ("XDN", 1)]) +def test_tokenizer_excludes_false_pos_emoticons(tokenizer, text, length): + tokens = tokenizer(text) + assert len(tokens) == length + + +@pytest.mark.parametrize( + "text,length", [("can you still dunk?🍕🍔😵LOL", 8), ("i💙you", 3), ("🤘🤘yay!", 4)] +) +def test_tokenizer_handles_emoji(tokenizer, text, length): + # These break on narrow unicode builds, e.g. Windows + if sys.maxunicode >= 1114111: + tokens = tokenizer(text) + assert len(tokens) == length + + +def test_tokenizer_degree(tokenizer): + for u in "cfkCFK": + assert [t.text for t in tokenizer(f"°{u}.")] == ["°", f"{u}", "."] + assert [t[1] for t in tokenizer.explain(f"°{u}.")] == ["°", f"{u}", "."] diff --git a/TTS/Kokoro/.venv/Lib/site-packages/spacy/tests/tokenizer/test_explain.py b/TTS/Kokoro/.venv/Lib/site-packages/spacy/tests/tokenizer/test_explain.py new file mode 100644 index 0000000000000000000000000000000000000000..c3868f5fcac543599e08c48fe6a555aad475f814 --- /dev/null +++ b/TTS/Kokoro/.venv/Lib/site-packages/spacy/tests/tokenizer/test_explain.py @@ -0,0 +1,145 @@ +import re +import string + +import hypothesis +import hypothesis.strategies +import pytest + +import spacy +from spacy.tokenizer import Tokenizer +from spacy.util import get_lang_class + +# Only include languages with no external dependencies +# "is" seems to confuse importlib, so we're also excluding it for now +# excluded: ja, ru, th, uk, vi, zh, is +LANGUAGES = [ + pytest.param("fr", marks=pytest.mark.slow()), + pytest.param("af", marks=pytest.mark.slow()), + pytest.param("ar", marks=pytest.mark.slow()), + pytest.param("bg", marks=pytest.mark.slow()), + "bn", + pytest.param("bo", marks=pytest.mark.slow()), + pytest.param("ca", marks=pytest.mark.slow()), + pytest.param("cs", marks=pytest.mark.slow()), + pytest.param("da", marks=pytest.mark.slow()), + pytest.param("de", marks=pytest.mark.slow()), + "el", + "en", + pytest.param("es", marks=pytest.mark.slow()), + pytest.param("et", marks=pytest.mark.slow()), + pytest.param("fa", marks=pytest.mark.slow()), + pytest.param("fi", marks=pytest.mark.slow()), + "fr", + pytest.param("ga", marks=pytest.mark.slow()), + pytest.param("he", marks=pytest.mark.slow()), + pytest.param("hi", marks=pytest.mark.slow()), + pytest.param("hr", marks=pytest.mark.slow()), + "hu", + pytest.param("id", marks=pytest.mark.slow()), + pytest.param("it", marks=pytest.mark.slow()), + pytest.param("kn", marks=pytest.mark.slow()), + pytest.param("lb", marks=pytest.mark.slow()), + pytest.param("lt", marks=pytest.mark.slow()), + pytest.param("lv", marks=pytest.mark.slow()), + pytest.param("nb", marks=pytest.mark.slow()), + pytest.param("nl", marks=pytest.mark.slow()), + "pl", + pytest.param("pt", marks=pytest.mark.slow()), + pytest.param("ro", marks=pytest.mark.slow()), + pytest.param("si", marks=pytest.mark.slow()), + pytest.param("sk", marks=pytest.mark.slow()), + pytest.param("sl", marks=pytest.mark.slow()), + pytest.param("sq", marks=pytest.mark.slow()), + pytest.param("sr", marks=pytest.mark.slow()), + pytest.param("sv", marks=pytest.mark.slow()), + pytest.param("ta", marks=pytest.mark.slow()), + pytest.param("te", marks=pytest.mark.slow()), + pytest.param("tl", marks=pytest.mark.slow()), + pytest.param("tr", marks=pytest.mark.slow()), + pytest.param("tt", marks=pytest.mark.slow()), + pytest.param("ur", marks=pytest.mark.slow()), + pytest.param("kmr", marks=pytest.mark.slow()), +] + + +@pytest.mark.parametrize("lang", LANGUAGES) +def test_tokenizer_explain(lang): + tokenizer = get_lang_class(lang)().tokenizer + examples = pytest.importorskip(f"spacy.lang.{lang}.examples") + for sentence in examples.sentences: + tokens = [t.text for t in tokenizer(sentence) if not t.is_space] + debug_tokens = [t[1] for t in tokenizer.explain(sentence)] + assert tokens == debug_tokens + + +def test_tokenizer_explain_special_matcher(en_vocab): + suffix_re = re.compile(r"[\.]$") + infix_re = re.compile(r"[/]") + rules = {"a.": [{"ORTH": "a."}]} + tokenizer = Tokenizer( + en_vocab, + rules=rules, + suffix_search=suffix_re.search, + infix_finditer=infix_re.finditer, + ) + tokens = [t.text for t in tokenizer("a/a.")] + explain_tokens = [t[1] for t in tokenizer.explain("a/a.")] + assert tokens == explain_tokens + + +def test_tokenizer_explain_special_matcher_whitespace(en_vocab): + rules = {":]": [{"ORTH": ":]"}]} + tokenizer = Tokenizer( + en_vocab, + rules=rules, + ) + text = ": ]" + tokens = [t.text for t in tokenizer(text)] + explain_tokens = [t[1] for t in tokenizer.explain(text)] + assert tokens == explain_tokens + + +@hypothesis.strategies.composite +def sentence_strategy(draw: hypothesis.strategies.DrawFn, max_n_words: int = 4) -> str: + """ + Composite strategy for fuzzily generating sentence with varying interpunctation. + + draw (hypothesis.strategies.DrawFn): Protocol for drawing function allowing to fuzzily pick from hypothesis' + strategies. + max_n_words (int): Max. number of words in generated sentence. + RETURNS (str): Fuzzily generated sentence. + """ + + punctuation_and_space_regex = "|".join( + [*[re.escape(p) for p in string.punctuation], r"\s"] + ) + sentence = [ + [ + draw(hypothesis.strategies.text(min_size=1)), + draw(hypothesis.strategies.from_regex(punctuation_and_space_regex)), + ] + for _ in range( + draw(hypothesis.strategies.integers(min_value=2, max_value=max_n_words)) + ) + ] + + return " ".join([token for token_pair in sentence for token in token_pair]) + + +@pytest.mark.xfail +@pytest.mark.parametrize("lang", LANGUAGES) +@hypothesis.given(sentence=sentence_strategy()) +def test_tokenizer_explain_fuzzy(lang: str, sentence: str) -> None: + """ + Tests whether output of tokenizer.explain() matches tokenizer output. Input generated by hypothesis. + lang (str): Language to test. + text (str): Fuzzily generated sentence to tokenize. + """ + + tokenizer: Tokenizer = spacy.blank(lang).tokenizer + # Tokenizer.explain is not intended to handle whitespace or control + # characters in the same way as Tokenizer + sentence = re.sub(r"\s+", " ", sentence).strip() + tokens = [t.text for t in tokenizer(sentence)] + debug_tokens = [t[1] for t in tokenizer.explain(sentence)] + assert tokens == debug_tokens, f"{tokens}, {debug_tokens}, {sentence}" diff --git a/TTS/Kokoro/.venv/Lib/site-packages/spacy/tests/tokenizer/test_naughty_strings.py b/TTS/Kokoro/.venv/Lib/site-packages/spacy/tests/tokenizer/test_naughty_strings.py new file mode 100644 index 0000000000000000000000000000000000000000..e1da8efa0c0e1f06af8dcb9b8f19c396e07bd37f --- /dev/null +++ b/TTS/Kokoro/.venv/Lib/site-packages/spacy/tests/tokenizer/test_naughty_strings.py @@ -0,0 +1,115 @@ +import pytest + +# Examples taken from the "Big List of Naughty Strings" +# https://github.com/minimaxir/big-list-of-naughty-strings + + +NAUGHTY_STRINGS = [ + # ASCII punctuation + r",./;'[]\-=", + r'<>?:"{}|_+', + r'!@#$%^&*()`~"', + # Unicode additional control characters, byte order marks + r"­؀؁؂؃؄؅؜۝܏᠎​‌‍‎‏‪", + r"￾", + # Unicode Symbols + r"Ω≈ç√∫˜µ≤≥÷", + r"åß∂ƒ©˙∆˚¬…æ", + "œ∑´®†¥¨ˆøπ“‘", + r"¡™£¢∞§¶•ªº–≠", + r"¸˛Ç◊ı˜Â¯˘¿", + r"ÅÍÎÏ˝ÓÔÒÚÆ☃", + r"Œ„´‰ˇÁ¨ˆØ∏”’", + r"`⁄€‹›fifl‡°·‚—±", + r"⅛⅜⅝⅞", + r"ЁЂЃЄЅІЇЈЉЊЋЌЍЎЏАБВГДЕЖЗИЙКЛМНОПРСТУФХЦЧШЩЪЫЬЭЮЯабвгдежзийклмнопрстуфхцчшщъыьэюя", + r"٠١٢٣٤٥٦٧٨٩", + # Unicode Subscript/Superscript/Accents + r"⁰⁴⁵", + r"₀₁₂", + r"⁰⁴⁵₀₁₂", + r"ด้้้้้็็็็็้้้้้็็็็็้้้้้้้้็็็็็้้้้้็็็็็้้้้้้้้็็็็็้้้้้็็็็็้้้้้้้้็็็็็้้้้้็็็็ ด้้้้้็็็็็้้้้้็็็็็้้้้้้้้็็็็็้้้้้็็็็็้้้้้้้้็็็็็้้้้้็็็็็้้้้้้้้็็็็็้้้้้็็็็ ด้้้้้็็็็็้้้้้็็็็็้้้้้้้้็็็็็้้้้้็็็็็้้้้้้้้็็็็็้้้้้็็็็็้้้้้้้้็็็็็้้้้้็็็็", + r" ̄ ̄", + # Two-Byte Characters + r"田中さんにあげて下さい", + r"パーティーへ行かないか", + r"和製漢語", + r"部落格", + r"사회과학원 어학연구소", + r"찦차를 타고 온 펲시맨과 쑛다리 똠방각하", + r"社會科學院語學研究所", + r"울란바토르", + r"𠜎𠜱𠝹𠱓𠱸𠲖𠳏", + # Japanese Emoticons + r"ヽ༼ຈل͜ຈ༽ノ ヽ༼ຈل͜ຈ༽ノ", + r"(。◕ ∀ ◕。)", + r"`ィ(´∀`∩", + r"__ロ(,_,*)", + r"・( ̄∀ ̄)・:*:", + r"゚・✿ヾ╲(。◕‿◕。)╱✿・゚", + r",。・:*:・゜’( ☻ ω ☻ )。・:*:・゜’", + r"(╯°□°)╯︵ ┻━┻)" "(ノಥ益ಥ)ノ ┻━┻", + r"┬─┬ノ( º _ ºノ)", + r"( ͡° ͜ʖ ͡°)", + # Emoji + r"😍", + r"👩🏽", + r"👾 🙇 💁 🙅 🙆 🙋 🙎 🙍", + r"🐵 🙈 🙉 🙊", + r"❤️ 💔 💌 💕 💞 💓 💗 💖 💘 💝 💟 💜 💛 💚 💙", + r"✋🏿 💪🏿 👐🏿 🙌🏿 👏🏿 🙏🏿", + r"🚾 🆒 🆓 🆕 🆖 🆗 🆙 🏧", + r"0️⃣ 1️⃣ 2️⃣ 3️⃣ 4️⃣ 5️⃣ 6️⃣ 7️⃣ 8️⃣ 9️⃣ 🔟", + # Regional Indicator Symbols + r"🇺🇸🇷🇺🇸 🇦🇫🇦🇲🇸", + r"🇺🇸🇷🇺🇸🇦🇫🇦🇲", + r"🇺🇸🇷🇺🇸🇦", + # Unicode Numbers + r"123", + r"١٢٣", + # Right-To-Left Strings + r"ثم نفس سقطت وبالتحديد،, جزيرتي باستخدام أن دنو. إذ هنا؟ الستار وتنصيب كان. أهّل ايطاليا، بريطانيا-فرنسا قد أخذ. سليمان، إتفاقية بين ما, يذكر الحدود أي بعد, معاملة بولندا، الإطلاق عل إيو.", + r"إيو.", + r"בְּרֵאשִׁית, בָּרָא אֱלֹהִים, אֵת הַשָּׁמַיִם, וְאֵת הָאָרֶץ", + r"הָיְתָהtestالصفحات التّحول", + r"﷽", + r"ﷺ", + r"مُنَاقَشَةُ سُبُلِ اِسْتِخْدَامِ اللُّغَةِ فِي النُّظُمِ الْقَائِمَةِ وَفِيم يَخُصَّ التَّطْبِيقَاتُ الْحاسُوبِيَّةُ،", + # Trick Unicode + r"‪‪test‪", + r"‫test", + r"
test
", + r"test⁠test", + r"⁦test⁧", + # Zalgo Text + r"Ṱ̺̺̕o͞ ̷i̲̬͇̪͙n̝̗͕v̟̜̘̦͟o̶̙̰̠kè͚̮̺̪̹̱̤ ̖t̝͕̳̣̻̪͞h̼͓̲̦̳̘̲e͇̣̰̦̬͎ ̢̼̻̱̘h͚͎͙̜̣̲ͅi̦̲̣̰̤v̻͍e̺̭̳̪̰-m̢iͅn̖̺̞̲̯̰d̵̼̟͙̩̼̘̳ ̞̥̱̳̭r̛̗̘e͙p͠r̼̞̻̭̗e̺̠̣͟s̘͇̳͍̝͉e͉̥̯̞̲͚̬͜ǹ̬͎͎̟̖͇̤t͍̬̤͓̼̭͘ͅi̪̱n͠g̴͉ ͏͉ͅc̬̟h͡a̫̻̯͘o̫̟̖͍̙̝͉s̗̦̲.̨̹͈̣", + r"̡͓̞ͅI̗̘̦͝n͇͇͙v̮̫ok̲̫̙͈i̖͙̭̹̠̞n̡̻̮̣̺g̲͈͙̭͙̬͎ ̰t͔̦h̞̲e̢̤ ͍̬̲͖f̴̘͕̣è͖ẹ̥̩l͖͔͚i͓͚̦͠n͖͍̗͓̳̮g͍ ̨o͚̪͡f̘̣̬ ̖̘͖̟͙̮c҉͔̫͖͓͇͖ͅh̵̤̣͚͔á̗̼͕ͅo̼̣̥s̱͈̺̖̦̻͢.̛̖̞̠̫̰", + r"̗̺͖̹̯͓Ṯ̤͍̥͇͈h̲́e͏͓̼̗̙̼̣͔ ͇̜̱̠͓͍ͅN͕͠e̗̱z̘̝̜̺͙p̤̺̹͍̯͚e̠̻̠͜r̨̤͍̺̖͔̖̖d̠̟̭̬̝͟i̦͖̩͓͔̤a̠̗̬͉̙n͚͜ ̻̞̰͚ͅh̵͉i̳̞v̢͇ḙ͎͟-҉̭̩̼͔m̤̭̫i͕͇̝̦n̗͙ḍ̟ ̯̲͕͞ǫ̟̯̰̲͙̻̝f ̪̰̰̗̖̭̘͘c̦͍̲̞͍̩̙ḥ͚a̮͎̟̙͜ơ̩̹͎s̤.̝̝ ҉Z̡̖̜͖̰̣͉̜a͖̰͙̬͡l̲̫̳͍̩g̡̟̼̱͚̞̬ͅo̗͜.̟", + r"̦H̬̤̗̤͝e͜ ̜̥̝̻͍̟́w̕h̖̯͓o̝͙̖͎̱̮ ҉̺̙̞̟͈W̷̼̭a̺̪͍į͈͕̭͙̯̜t̶̼̮s̘͙͖̕ ̠̫̠B̻͍͙͉̳ͅe̵h̵̬͇̫͙i̹͓̳̳̮͎̫̕n͟d̴̪̜̖ ̰͉̩͇͙̲͞ͅT͖̼͓̪͢h͏͓̮̻e̬̝̟ͅ ̤̹̝W͙̞̝͔͇͝ͅa͏͓͔̹̼̣l̴͔̰̤̟͔ḽ̫.͕", + r"Z̮̞̠͙͔ͅḀ̗̞͈̻̗Ḷ͙͎̯̹̞͓G̻O̭̗̮", + # Unicode Upsidedown + r"˙ɐnbᴉlɐ ɐuƃɐɯ ǝɹolop ʇǝ ǝɹoqɐl ʇn ʇunpᴉpᴉɔuᴉ ɹodɯǝʇ poɯsnᴉǝ op pǝs 'ʇᴉlǝ ƃuᴉɔsᴉdᴉpɐ ɹnʇǝʇɔǝsuoɔ 'ʇǝɯɐ ʇᴉs ɹolop ɯnsdᴉ ɯǝɹo˥", + r"00˙Ɩ$-", + # Unicode font + r"The quick brown fox jumps over the lazy dog", + r"𝐓𝐡𝐞 𝐪𝐮𝐢𝐜𝐤 𝐛𝐫𝐨𝐰𝐧 𝐟𝐨𝐱 𝐣𝐮𝐦𝐩𝐬 𝐨𝐯𝐞𝐫 𝐭𝐡𝐞 𝐥𝐚𝐳𝐲 𝐝𝐨𝐠", + r"𝕿𝖍𝖊 𝖖𝖚𝖎𝖈𝖐 𝖇𝖗𝖔𝖜𝖓 𝖋𝖔𝖝 𝖏𝖚𝖒𝖕𝖘 𝖔𝖛𝖊𝖗 𝖙𝖍𝖊 𝖑𝖆𝖟𝖞 𝖉𝖔𝖌", + r"𝑻𝒉𝒆 𝒒𝒖𝒊𝒄𝒌 𝒃𝒓𝒐𝒘𝒏 𝒇𝒐𝒙 𝒋𝒖𝒎𝒑𝒔 𝒐𝒗𝒆𝒓 𝒕𝒉𝒆 𝒍𝒂𝒛𝒚 𝒅𝒐𝒈", + r"𝓣𝓱𝓮 𝓺𝓾𝓲𝓬𝓴 𝓫𝓻𝓸𝔀𝓷 𝓯𝓸𝔁 𝓳𝓾𝓶𝓹𝓼 𝓸𝓿𝓮𝓻 𝓽𝓱𝓮 𝓵𝓪𝔃𝔂 𝓭𝓸𝓰", + r"𝕋𝕙𝕖 𝕢𝕦𝕚𝕔𝕜 𝕓𝕣𝕠𝕨𝕟 𝕗𝕠𝕩 𝕛𝕦𝕞𝕡𝕤 𝕠𝕧𝕖𝕣 𝕥𝕙𝕖 𝕝𝕒𝕫𝕪 𝕕𝕠𝕘", + r"𝚃𝚑𝚎 𝚚𝚞𝚒𝚌𝚔 𝚋𝚛𝚘𝚠𝚗 𝚏𝚘𝚡 𝚓𝚞𝚖𝚙𝚜 𝚘𝚟𝚎𝚛 𝚝𝚑𝚎 𝚕𝚊𝚣𝚢 𝚍𝚘𝚐", + r"⒯⒣⒠ ⒬⒰⒤⒞⒦ ⒝⒭⒪⒲⒩ ⒡⒪⒳ ⒥⒰⒨⒫⒮ ⒪⒱⒠⒭ ⒯⒣⒠ ⒧⒜⒵⒴ ⒟⒪⒢", + # File paths + r"../../../../../../../../../../../etc/passwd%00", + r"../../../../../../../../../../../etc/hosts", + # iOS Vulnerabilities + r"Powerلُلُصّبُلُلصّبُررً ॣ ॣh ॣ ॣ冗", + r"🏳0🌈️", +] + + +@pytest.mark.slow +@pytest.mark.parametrize("text", NAUGHTY_STRINGS) +def test_tokenizer_naughty_strings(tokenizer, text): + tokens = tokenizer(text) + assert tokens.text_with_ws == text diff --git a/TTS/Kokoro/.venv/Lib/site-packages/spacy/tests/tokenizer/test_tokenizer.py b/TTS/Kokoro/.venv/Lib/site-packages/spacy/tests/tokenizer/test_tokenizer.py new file mode 100644 index 0000000000000000000000000000000000000000..ca712120db2830fbb8ff41f4312946e3a198c82c --- /dev/null +++ b/TTS/Kokoro/.venv/Lib/site-packages/spacy/tests/tokenizer/test_tokenizer.py @@ -0,0 +1,557 @@ +import re + +import numpy +import pytest + +from spacy.lang.de import German +from spacy.lang.en import English +from spacy.symbols import ORTH +from spacy.tokenizer import Tokenizer +from spacy.tokens import Doc +from spacy.training import Example +from spacy.util import ( + compile_infix_regex, + compile_prefix_regex, + compile_suffix_regex, + ensure_path, +) +from spacy.vocab import Vocab + + +@pytest.mark.issue(743) +def test_issue743(): + doc = Doc(Vocab(), ["hello", "world"]) + token = doc[0] + s = set([token]) + items = list(s) + assert items[0] is token + + +@pytest.mark.issue(801) +@pytest.mark.skip( + reason="Can not be fixed unless with variable-width lookbehinds, cf. PR #3218" +) +@pytest.mark.parametrize( + "text,tokens", + [ + ('"deserve,"--and', ['"', "deserve", ',"--', "and"]), + ("exception;--exclusive", ["exception", ";--", "exclusive"]), + ("day.--Is", ["day", ".--", "Is"]), + ("refinement:--just", ["refinement", ":--", "just"]), + ("memories?--To", ["memories", "?--", "To"]), + ("Useful.=--Therefore", ["Useful", ".=--", "Therefore"]), + ("=Hope.=--Pandora", ["=", "Hope", ".=--", "Pandora"]), + ], +) +def test_issue801(en_tokenizer, text, tokens): + """Test that special characters + hyphens are split correctly.""" + doc = en_tokenizer(text) + assert len(doc) == len(tokens) + assert [t.text for t in doc] == tokens + + +@pytest.mark.issue(1061) +def test_issue1061(): + """Test special-case works after tokenizing. Was caching problem.""" + text = "I like _MATH_ even _MATH_ when _MATH_, except when _MATH_ is _MATH_! but not _MATH_." + tokenizer = English().tokenizer + doc = tokenizer(text) + assert "MATH" in [w.text for w in doc] + assert "_MATH_" not in [w.text for w in doc] + + tokenizer.add_special_case("_MATH_", [{ORTH: "_MATH_"}]) + doc = tokenizer(text) + assert "_MATH_" in [w.text for w in doc] + assert "MATH" not in [w.text for w in doc] + + # For sanity, check it works when pipeline is clean. + tokenizer = English().tokenizer + tokenizer.add_special_case("_MATH_", [{ORTH: "_MATH_"}]) + doc = tokenizer(text) + assert "_MATH_" in [w.text for w in doc] + assert "MATH" not in [w.text for w in doc] + + +@pytest.mark.issue(1963) +def test_issue1963(en_tokenizer): + """Test that doc.merge() resizes doc.tensor""" + doc = en_tokenizer("a b c d") + doc.tensor = numpy.ones((len(doc), 128), dtype="f") + with doc.retokenize() as retokenizer: + retokenizer.merge(doc[0:2]) + assert len(doc) == 3 + assert doc.tensor.shape == (3, 128) + + +@pytest.mark.skip( + reason="Can not be fixed without variable-width look-behind (which we don't want)" +) +@pytest.mark.issue(1235) +def test_issue1235(): + """Test that g is not split of if preceded by a number and a letter""" + nlp = English() + testwords = "e2g 2g 52g" + doc = nlp(testwords) + assert len(doc) == 5 + assert doc[0].text == "e2g" + assert doc[1].text == "2" + assert doc[2].text == "g" + assert doc[3].text == "52" + assert doc[4].text == "g" + + +@pytest.mark.issue(1242) +def test_issue1242(): + nlp = English() + doc = nlp("") + assert len(doc) == 0 + docs = list(nlp.pipe(["", "hello"])) + assert len(docs[0]) == 0 + assert len(docs[1]) == 1 + + +@pytest.mark.issue(1257) +def test_issue1257(): + """Test that tokens compare correctly.""" + doc1 = Doc(Vocab(), words=["a", "b", "c"]) + doc2 = Doc(Vocab(), words=["a", "c", "e"]) + assert doc1[0] != doc2[0] + assert not doc1[0] == doc2[0] + + +@pytest.mark.issue(1375) +def test_issue1375(): + """Test that token.nbor() raises IndexError for out-of-bounds access.""" + doc = Doc(Vocab(), words=["0", "1", "2"]) + with pytest.raises(IndexError): + assert doc[0].nbor(-1) + assert doc[1].nbor(-1).text == "0" + with pytest.raises(IndexError): + assert doc[2].nbor(1) + assert doc[1].nbor(1).text == "2" + + +@pytest.mark.issue(1488) +def test_issue1488(): + """Test that tokenizer can parse DOT inside non-whitespace separators""" + prefix_re = re.compile(r"""[\[\("']""") + suffix_re = re.compile(r"""[\]\)"']""") + infix_re = re.compile(r"""[-~\.]""") + simple_url_re = re.compile(r"""^https?://""") + + def my_tokenizer(nlp): + return Tokenizer( + nlp.vocab, + {}, + prefix_search=prefix_re.search, + suffix_search=suffix_re.search, + infix_finditer=infix_re.finditer, + token_match=simple_url_re.match, + ) + + nlp = English() + nlp.tokenizer = my_tokenizer(nlp) + doc = nlp("This is a test.") + for token in doc: + assert token.text + + +@pytest.mark.issue(1494) +def test_issue1494(): + """Test if infix_finditer works correctly""" + infix_re = re.compile(r"""[^a-z]""") + test_cases = [ + ("token 123test", ["token", "1", "2", "3", "test"]), + ("token 1test", ["token", "1test"]), + ("hello...test", ["hello", ".", ".", ".", "test"]), + ] + + def new_tokenizer(nlp): + return Tokenizer(nlp.vocab, {}, infix_finditer=infix_re.finditer) + + nlp = English() + nlp.tokenizer = new_tokenizer(nlp) + for text, expected in test_cases: + assert [token.text for token in nlp(text)] == expected + + +@pytest.mark.skip( + reason="Can not be fixed without iterative looping between prefix/suffix and infix" +) +@pytest.mark.issue(2070) +def test_issue2070(): + """Test that checks that a dot followed by a quote is handled + appropriately. + """ + # Problem: The dot is now properly split off, but the prefix/suffix rules + # are not applied again afterwards. This means that the quote will still be + # attached to the remaining token. + nlp = English() + doc = nlp('First sentence."A quoted sentence" he said ...') + assert len(doc) == 11 + + +@pytest.mark.issue(2926) +def test_issue2926(fr_tokenizer): + """Test that the tokenizer correctly splits tokens separated by a slash (/) + ending in a digit. + """ + doc = fr_tokenizer("Learn html5/css3/javascript/jquery") + assert len(doc) == 8 + assert doc[0].text == "Learn" + assert doc[1].text == "html5" + assert doc[2].text == "/" + assert doc[3].text == "css3" + assert doc[4].text == "/" + assert doc[5].text == "javascript" + assert doc[6].text == "/" + assert doc[7].text == "jquery" + + +@pytest.mark.parametrize( + "text", + [ + "ABLEItemColumn IAcceptance Limits of ErrorIn-Service Limits of ErrorColumn IIColumn IIIColumn IVColumn VComputed VolumeUnder Registration of\xa0VolumeOver Registration of\xa0VolumeUnder Registration of\xa0VolumeOver Registration of\xa0VolumeCubic FeetCubic FeetCubic FeetCubic FeetCubic Feet1Up to 10.0100.0050.0100.005220.0200.0100.0200.010350.0360.0180.0360.0184100.0500.0250.0500.0255Over 100.5% of computed volume0.25% of computed volume0.5% of computed volume0.25% of computed volume TABLE ItemColumn IAcceptance Limits of ErrorIn-Service Limits of ErrorColumn IIColumn IIIColumn IVColumn VComputed VolumeUnder Registration of\xa0VolumeOver Registration of\xa0VolumeUnder Registration of\xa0VolumeOver Registration of\xa0VolumeCubic FeetCubic FeetCubic FeetCubic FeetCubic Feet1Up to 10.0100.0050.0100.005220.0200.0100.0200.010350.0360.0180.0360.0184100.0500.0250.0500.0255Over 100.5% of computed volume0.25% of computed volume0.5% of computed volume0.25% of computed volume ItemColumn IAcceptance Limits of ErrorIn-Service Limits of ErrorColumn IIColumn IIIColumn IVColumn VComputed VolumeUnder Registration of\xa0VolumeOver Registration of\xa0VolumeUnder Registration of\xa0VolumeOver Registration of\xa0VolumeCubic FeetCubic FeetCubic FeetCubic FeetCubic Feet1Up to 10.0100.0050.0100.005220.0200.0100.0200.010350.0360.0180.0360.0184100.0500.0250.0500.0255Over 100.5% of computed volume0.25% of computed volume0.5% of computed volume0.25% of computed volume", + "oow.jspsearch.eventoracleopenworldsearch.technologyoraclesolarissearch.technologystoragesearch.technologylinuxsearch.technologyserverssearch.technologyvirtualizationsearch.technologyengineeredsystemspcodewwmkmppscem:", + ], +) +@pytest.mark.issue(2626) +def test_issue2626_2835(en_tokenizer, text): + """Check that sentence doesn't cause an infinite loop in the tokenizer.""" + doc = en_tokenizer(text) + assert doc + + +@pytest.mark.issue(2656) +def test_issue2656(en_tokenizer): + """Test that tokenizer correctly splits off punctuation after numbers with + decimal points. + """ + doc = en_tokenizer("I went for 40.3, and got home by 10.0.") + assert len(doc) == 11 + assert doc[0].text == "I" + assert doc[1].text == "went" + assert doc[2].text == "for" + assert doc[3].text == "40.3" + assert doc[4].text == "," + assert doc[5].text == "and" + assert doc[6].text == "got" + assert doc[7].text == "home" + assert doc[8].text == "by" + assert doc[9].text == "10.0" + assert doc[10].text == "." + + +@pytest.mark.issue(2754) +def test_issue2754(en_tokenizer): + """Test that words like 'a' and 'a.m.' don't get exceptional norm values.""" + a = en_tokenizer("a") + assert a[0].norm_ == "a" + am = en_tokenizer("am") + assert am[0].norm_ == "am" + + +@pytest.mark.issue(3002) +def test_issue3002(): + """Test that the tokenizer doesn't hang on a long list of dots""" + nlp = German() + doc = nlp( + "880.794.982.218.444.893.023.439.794.626.120.190.780.624.990.275.671 ist eine lange Zahl" + ) + assert len(doc) == 5 + + +@pytest.mark.skip(reason="default suffix rules avoid one upper-case letter before dot") +@pytest.mark.issue(3449) +def test_issue3449(): + nlp = English() + nlp.add_pipe("sentencizer") + text1 = "He gave the ball to I. Do you want to go to the movies with I?" + text2 = "He gave the ball to I. Do you want to go to the movies with I?" + text3 = "He gave the ball to I.\nDo you want to go to the movies with I?" + t1 = nlp(text1) + t2 = nlp(text2) + t3 = nlp(text3) + assert t1[5].text == "I" + assert t2[5].text == "I" + assert t3[5].text == "I" + + +@pytest.mark.parametrize( + "text,words", [("A'B C", ["A", "'", "B", "C"]), ("A-B", ["A-B"])] +) +def test_gold_misaligned(en_tokenizer, text, words): + doc = en_tokenizer(text) + Example.from_dict(doc, {"words": words}) + + +def test_tokenizer_handles_no_word(tokenizer): + tokens = tokenizer("") + assert len(tokens) == 0 + + +@pytest.mark.parametrize("text", ["lorem"]) +def test_tokenizer_handles_single_word(tokenizer, text): + tokens = tokenizer(text) + assert tokens[0].text == text + + +def test_tokenizer_handles_punct(tokenizer): + text = "Lorem, ipsum." + tokens = tokenizer(text) + assert len(tokens) == 4 + assert tokens[0].text == "Lorem" + assert tokens[1].text == "," + assert tokens[2].text == "ipsum" + assert tokens[1].text != "Lorem" + + +def test_tokenizer_handles_punct_braces(tokenizer): + text = "Lorem, (ipsum)." + tokens = tokenizer(text) + assert len(tokens) == 6 + + +def test_tokenizer_handles_digits(tokenizer): + exceptions = ["hu", "bn"] + text = "Lorem ipsum: 1984." + tokens = tokenizer(text) + + if tokens[0].lang_ not in exceptions: + assert len(tokens) == 5 + assert tokens[0].text == "Lorem" + assert tokens[3].text == "1984" + + +@pytest.mark.parametrize( + "text", + ["google.com", "python.org", "spacy.io", "explosion.ai", "http://www.google.com"], +) +def test_tokenizer_keep_urls(tokenizer, text): + tokens = tokenizer(text) + assert len(tokens) == 1 + + +@pytest.mark.parametrize("text", ["NASDAQ:GOOG"]) +def test_tokenizer_colons(tokenizer, text): + tokens = tokenizer(text) + assert len(tokens) == 3 + + +@pytest.mark.parametrize( + "text", ["hello123@example.com", "hi+there@gmail.it", "matt@explosion.ai"] +) +def test_tokenizer_keeps_email(tokenizer, text): + tokens = tokenizer(text) + assert len(tokens) == 1 + + +def test_tokenizer_handles_long_text(tokenizer): + text = """Lorem ipsum dolor sit amet, consectetur adipiscing elit + +Cras egestas orci non porttitor maximus. +Maecenas quis odio id dolor rhoncus dignissim. Curabitur sed velit at orci ultrices sagittis. Nulla commodo euismod arcu eget vulputate. + +Phasellus tincidunt, augue quis porta finibus, massa sapien consectetur augue, non lacinia enim nibh eget ipsum. Vestibulum in bibendum mauris. + +"Nullam porta fringilla enim, a dictum orci consequat in." Mauris nec malesuada justo.""" + + tokens = tokenizer(text) + assert len(tokens) > 5 + + +@pytest.mark.parametrize("file_name", ["sun.txt"]) +def test_tokenizer_handle_text_from_file(tokenizer, file_name): + loc = ensure_path(__file__).parent / file_name + with loc.open("r", encoding="utf8") as infile: + text = infile.read() + assert len(text) != 0 + tokens = tokenizer(text) + assert len(tokens) > 100 + + +def test_tokenizer_suspected_freeing_strings(tokenizer): + text1 = "Lorem dolor sit amet, consectetur adipiscing elit." + text2 = "Lorem ipsum dolor sit amet, consectetur adipiscing elit." + tokens1 = tokenizer(text1) + tokens2 = tokenizer(text2) + assert tokens1[0].text == "Lorem" + assert tokens2[0].text == "Lorem" + + +@pytest.mark.parametrize("text,tokens", [("lorem", [{"orth": "lo"}, {"orth": "rem"}])]) +def test_tokenizer_add_special_case(tokenizer, text, tokens): + tokenizer.add_special_case(text, tokens) + doc = tokenizer(text) + assert doc[0].text == tokens[0]["orth"] + assert doc[1].text == tokens[1]["orth"] + + +@pytest.mark.parametrize( + "text,tokens", + [ + ("lorem", [{"orth": "lo"}, {"orth": "re"}]), + ("lorem", [{"orth": "lo", "tag": "A"}, {"orth": "rem"}]), + ], +) +def test_tokenizer_validate_special_case(tokenizer, text, tokens): + with pytest.raises(ValueError): + tokenizer.add_special_case(text, tokens) + + +@pytest.mark.parametrize( + "text,tokens", [("lorem", [{"orth": "lo", "norm": "LO"}, {"orth": "rem"}])] +) +def test_tokenizer_add_special_case_tag(text, tokens): + vocab = Vocab() + tokenizer = Tokenizer(vocab, {}, None, None, None) + tokenizer.add_special_case(text, tokens) + doc = tokenizer(text) + assert doc[0].text == tokens[0]["orth"] + assert doc[0].norm_ == tokens[0]["norm"] + assert doc[1].text == tokens[1]["orth"] + + +def test_tokenizer_special_cases_with_affixes(tokenizer): + text = '(((_SPECIAL_ A/B, A/B-A/B")' + tokenizer.add_special_case("_SPECIAL_", [{"orth": "_SPECIAL_"}]) + tokenizer.add_special_case("A/B", [{"orth": "A/B"}]) + doc = tokenizer(text) + assert [token.text for token in doc] == [ + "(", + "(", + "(", + "_SPECIAL_", + "A/B", + ",", + "A/B", + "-", + "A/B", + '"', + ")", + ] + + +def test_tokenizer_special_cases_with_affixes_preserve_spacy(): + tokenizer = English().tokenizer + # reset all special cases + tokenizer.rules = {} + + # in-place modification (only merges) + text = "''a'' " + tokenizer.add_special_case("''", [{"ORTH": "''"}]) + assert tokenizer(text).text == text + + # not in-place (splits and merges) + tokenizer.add_special_case("ab", [{"ORTH": "a"}, {"ORTH": "b"}]) + text = "ab ab ab ''ab ab'' ab'' ''ab" + assert tokenizer(text).text == text + + +def test_tokenizer_special_cases_with_period(tokenizer): + text = "_SPECIAL_." + tokenizer.add_special_case("_SPECIAL_", [{"orth": "_SPECIAL_"}]) + doc = tokenizer(text) + assert [token.text for token in doc] == ["_SPECIAL_", "."] + + +def test_tokenizer_special_cases_idx(tokenizer): + text = "the _ID'X_" + tokenizer.add_special_case("_ID'X_", [{"orth": "_ID"}, {"orth": "'X_"}]) + doc = tokenizer(text) + assert doc[1].idx == 4 + assert doc[2].idx == 7 + + +def test_tokenizer_special_cases_spaces(tokenizer): + assert [t.text for t in tokenizer("a b c")] == ["a", "b", "c"] + tokenizer.add_special_case("a b c", [{"ORTH": "a b c"}]) + assert [t.text for t in tokenizer("a b c")] == ["a b c"] + + +def test_tokenizer_flush_cache(en_vocab): + suffix_re = re.compile(r"[\.]$") + tokenizer = Tokenizer( + en_vocab, + suffix_search=suffix_re.search, + ) + assert [t.text for t in tokenizer("a.")] == ["a", "."] + tokenizer.suffix_search = None + assert [t.text for t in tokenizer("a.")] == ["a."] + + +def test_tokenizer_flush_specials(en_vocab): + suffix_re = re.compile(r"[\.]$") + rules = {"a a": [{"ORTH": "a a"}]} + tokenizer1 = Tokenizer( + en_vocab, + suffix_search=suffix_re.search, + rules=rules, + ) + assert [t.text for t in tokenizer1("a a.")] == ["a a", "."] + tokenizer1.rules = {} + assert [t.text for t in tokenizer1("a a.")] == ["a", "a", "."] + + +def test_tokenizer_prefix_suffix_overlap_lookbehind(en_vocab): + # the prefix and suffix matches overlap in the suffix lookbehind + prefixes = ["a(?=.)"] + suffixes = [r"(?<=\w)\.", r"(?<=a)\d+\."] + prefix_re = compile_prefix_regex(prefixes) + suffix_re = compile_suffix_regex(suffixes) + tokenizer = Tokenizer( + en_vocab, + prefix_search=prefix_re.search, + suffix_search=suffix_re.search, + ) + tokens = [t.text for t in tokenizer("a10.")] + assert tokens == ["a", "10", "."] + explain_tokens = [t[1] for t in tokenizer.explain("a10.")] + assert tokens == explain_tokens + + +def test_tokenizer_infix_prefix(en_vocab): + # the prefix and suffix matches overlap in the suffix lookbehind + infixes = ["±"] + suffixes = ["%"] + infix_re = compile_infix_regex(infixes) + suffix_re = compile_suffix_regex(suffixes) + tokenizer = Tokenizer( + en_vocab, + infix_finditer=infix_re.finditer, + suffix_search=suffix_re.search, + ) + tokens = [t.text for t in tokenizer("±10%")] + assert tokens == ["±10", "%"] + explain_tokens = [t[1] for t in tokenizer.explain("±10%")] + assert tokens == explain_tokens + + +@pytest.mark.issue(10086) +def test_issue10086(en_tokenizer): + """Test special case works when part of infix substring.""" + text = "No--don't see" + + # without heuristics: do n't + en_tokenizer.faster_heuristics = False + doc = en_tokenizer(text) + assert "n't" in [w.text for w in doc] + assert "do" in [w.text for w in doc] + + # with (default) heuristics: don't + en_tokenizer.faster_heuristics = True + doc = en_tokenizer(text) + assert "don't" in [w.text for w in doc] + + +def test_tokenizer_initial_special_case_explain(en_vocab): + tokenizer = Tokenizer( + en_vocab, + token_match=re.compile("^id$").match, + rules={ + "id": [{"ORTH": "i"}, {"ORTH": "d"}], + }, + ) + tokens = [t.text for t in tokenizer("id")] + explain_tokens = [t[1] for t in tokenizer.explain("id")] + assert tokens == explain_tokens diff --git a/TTS/Kokoro/.venv/Lib/site-packages/spacy/tests/tokenizer/test_urls.py b/TTS/Kokoro/.venv/Lib/site-packages/spacy/tests/tokenizer/test_urls.py new file mode 100644 index 0000000000000000000000000000000000000000..3d809b4d820b6139b3178923f2134d39daf32ec9 --- /dev/null +++ b/TTS/Kokoro/.venv/Lib/site-packages/spacy/tests/tokenizer/test_urls.py @@ -0,0 +1,205 @@ +import pytest + +from spacy.lang.tokenizer_exceptions import BASE_EXCEPTIONS + +URLS_BASIC = [ + "http://www.nytimes.com/2016/04/20/us/politics/new-york-primary-preview.html?hp&action=click&pgtype=Homepage&clickSource=story-heading&module=a-lede-package-region®ion=top-news&WT.nav=top-news&_r=0", + "www.red-stars.com", + "mailto:foo.bar@baz.com", +] + +URLS_FULL = URLS_BASIC + [ + "mailto:foo-bar@baz-co.com", + "mailto:foo-bar@baz-co.com?subject=hi", + "www.google.com?q=google", + "http://foo.com/blah_(wikipedia)#cite-1", +] + +# URL SHOULD_MATCH and SHOULD_NOT_MATCH patterns courtesy of https://mathiasbynens.be/demo/url-regex +URLS_SHOULD_MATCH = [ + "http://foo.com/blah_blah", + "http://BlahBlah.com/Blah_Blah", + "http://foo.com/blah_blah/", + "http://www.example.com/wpstyle/?p=364", + "https://www.example.com/foo/?bar=baz&inga=42&quux", + "http://userid:password@example.com:8080", + "http://userid:password@example.com:8080/", + "http://userid@example.com", + "http://userid@example.com/", + "http://userid@example.com:8080", + "http://userid@example.com:8080/", + "http://userid:password@example.com", + "http://userid:password@example.com/", + "http://142.42.1.1/", + "http://142.42.1.1:8080/", + "http://foo.com/blah_(wikipedia)#cite-1", + "http://foo.com/blah_(wikipedia)_blah#cite-1", + "http://foo.com/unicode_(✪)_in_parens", + "http://foo.com/(something)?after=parens", + "http://code.google.com/events/#&product=browser", + "http://j.mp", + "ftp://foo.bar/baz", + "http://foo.bar/?q=Test%20URL-encoded%20stuff", + "http://-.~_!$&'()*+,;=:%40:80%2f::::::@example.com", + "http://1337.net", + "http://a.b-c.de", + "http://223.255.255.254", + "http://a.b--c.de/", # this is a legit domain name see: https://gist.github.com/dperini/729294 comment on 9/9/2014 + "ssh://login@server.com:12345/repository.git", + "svn+ssh://user@ssh.yourdomain.com/path", + pytest.param( + "chrome://extensions/?id=mhjfbmdgcfjbbpaeojofohoefgiehjai", + marks=pytest.mark.xfail(), + ), + pytest.param( + "chrome-extension://mhjfbmdgcfjbbpaeojofohoefgiehjai", marks=pytest.mark.xfail() + ), + "http://foo.com/blah_blah_(wikipedia)", + "http://foo.com/blah_blah_(wikipedia)_(again)", + "http://www.foo.co.uk", + "http://www.foo.co.uk/", + "http://www.foo.co.uk/blah/blah", + "http://⌘.ws", + "http://⌘.ws/", + "http://☺.damowmow.com/", + "http://✪df.ws/123", + "http://➡.ws/䨹", + "http://مثال.إختبار", + "http://例子.测试", + "http://उदाहरण.परीक्षा", +] + +URLS_SHOULD_NOT_MATCH = [ + "http://", + "http://.", + "http://..", + "http://../", + "http://?", + "http://??", + "http://??/", + "http://#", + "http://##", + "http://##/", + "http://foo.bar?q=Spaces should be encoded", + "//", + "//a", + "///a", + "///", + "http:///a", + "rdar://1234", + "h://test", + "http:// shouldfail.com", + ":// should fail", + "http://foo.bar/foo(bar)baz quux", + "http://-error-.invalid/", + "http://a.b-.co", + "http://0.0.0.0", + "http://10.1.1.0", + "http://10.1.1.255", + "http://224.1.1.1", + "http://123.123.123", + "http://3628126748", + "http://.www.foo.bar/", + "http://.www.foo.bar./", + "http://10.1.1.1", + "NASDAQ:GOOG", + "http://-a.b.co", + pytest.param("foo.com", marks=pytest.mark.xfail()), + "http://1.1.1.1.1", + "http://www.foo.bar./", +] + + +# Punctuation we want to check is split away before the URL +PREFIXES = ["(", '"', ">"] + + +# Punctuation we want to check is split away after the URL +SUFFIXES = ['"', ":", ">"] + + +@pytest.mark.parametrize("url", URLS_SHOULD_MATCH) +def test_should_match(en_tokenizer, url): + assert en_tokenizer.url_match(url) is not None + + +@pytest.mark.parametrize("url", URLS_SHOULD_NOT_MATCH) +def test_should_not_match(en_tokenizer, url): + assert en_tokenizer.url_match(url) is None + + +@pytest.mark.parametrize("url", URLS_BASIC) +def test_tokenizer_handles_simple_url(tokenizer, url): + tokens = tokenizer(url) + assert len(tokens) == 1 + assert tokens[0].text == url + + +@pytest.mark.parametrize("url", URLS_BASIC) +def test_tokenizer_handles_simple_surround_url(tokenizer, url): + tokens = tokenizer("(" + url + ")") + assert len(tokens) == 3 + assert tokens[0].text == "(" + assert tokens[1].text == url + assert tokens[2].text == ")" + + +@pytest.mark.slow +@pytest.mark.parametrize("prefix", PREFIXES) +@pytest.mark.parametrize("url", URLS_FULL) +def test_tokenizer_handles_prefixed_url(tokenizer, prefix, url): + tokens = tokenizer(prefix + url) + assert len(tokens) == 2 + assert tokens[0].text == prefix + assert tokens[1].text == url + + +@pytest.mark.slow +@pytest.mark.parametrize("suffix", SUFFIXES) +@pytest.mark.parametrize("url", URLS_FULL) +def test_tokenizer_handles_suffixed_url(tokenizer, url, suffix): + tokens = tokenizer(url + suffix) + assert len(tokens) == 2 + assert tokens[0].text == url + assert tokens[1].text == suffix + + +@pytest.mark.slow +@pytest.mark.parametrize("prefix", PREFIXES) +@pytest.mark.parametrize("suffix", SUFFIXES) +@pytest.mark.parametrize("url", URLS_FULL) +def test_tokenizer_handles_surround_url(tokenizer, prefix, suffix, url): + tokens = tokenizer(prefix + url + suffix) + assert len(tokens) == 3 + assert tokens[0].text == prefix + assert tokens[1].text == url + assert tokens[2].text == suffix + + +@pytest.mark.slow +@pytest.mark.parametrize("prefix1", PREFIXES) +@pytest.mark.parametrize("prefix2", PREFIXES) +@pytest.mark.parametrize("url", URLS_FULL) +def test_tokenizer_handles_two_prefix_url(tokenizer, prefix1, prefix2, url): + tokens = tokenizer(prefix1 + prefix2 + url) + assert len(tokens) == 3 + assert tokens[0].text == prefix1 + assert tokens[1].text == prefix2 + assert tokens[2].text == url + + +@pytest.mark.slow +@pytest.mark.parametrize("suffix1", SUFFIXES) +@pytest.mark.parametrize("suffix2", SUFFIXES) +@pytest.mark.parametrize("url", URLS_FULL) +def test_tokenizer_handles_two_suffix_url(tokenizer, suffix1, suffix2, url): + tokens = tokenizer(url + suffix1 + suffix2) + if suffix1 + suffix2 in BASE_EXCEPTIONS: + assert len(tokens) == 2 + assert tokens[0].text == url + assert tokens[1].text == suffix1 + suffix2 + else: + assert len(tokens) == 3 + assert tokens[0].text == url + assert tokens[1].text == suffix1 + assert tokens[2].text == suffix2 diff --git a/TTS/Kokoro/.venv/Lib/site-packages/spacy/tests/tokenizer/test_whitespace.py b/TTS/Kokoro/.venv/Lib/site-packages/spacy/tests/tokenizer/test_whitespace.py new file mode 100644 index 0000000000000000000000000000000000000000..00ed1b05cd4d6352971910d324bd1732b54a8cb1 --- /dev/null +++ b/TTS/Kokoro/.venv/Lib/site-packages/spacy/tests/tokenizer/test_whitespace.py @@ -0,0 +1,45 @@ +import pytest + + +@pytest.mark.parametrize("text", ["lorem ipsum"]) +def test_tokenizer_splits_single_space(tokenizer, text): + tokens = tokenizer(text) + assert len(tokens) == 2 + + +@pytest.mark.parametrize("text", ["lorem ipsum"]) +def test_tokenizer_splits_double_space(tokenizer, text): + tokens = tokenizer(text) + assert len(tokens) == 3 + assert tokens[1].text == " " + + +@pytest.mark.parametrize("text", ["lorem ipsum "]) +def test_tokenizer_handles_double_trailing_ws(tokenizer, text): + tokens = tokenizer(text) + assert repr(tokens.text_with_ws) == repr(text) + + +@pytest.mark.parametrize("text", ["lorem\nipsum"]) +def test_tokenizer_splits_newline(tokenizer, text): + tokens = tokenizer(text) + assert len(tokens) == 3 + assert tokens[1].text == "\n" + + +@pytest.mark.parametrize("text", ["lorem \nipsum"]) +def test_tokenizer_splits_newline_space(tokenizer, text): + tokens = tokenizer(text) + assert len(tokens) == 3 + + +@pytest.mark.parametrize("text", ["lorem \nipsum"]) +def test_tokenizer_splits_newline_double_space(tokenizer, text): + tokens = tokenizer(text) + assert len(tokens) == 3 + + +@pytest.mark.parametrize("text", ["lorem \n ipsum"]) +def test_tokenizer_splits_newline_space_wrap(tokenizer, text): + tokens = tokenizer(text) + assert len(tokens) == 3 diff --git a/TTS/Kokoro/.venv/Lib/site-packages/spacy/tests/training/__init__.py b/TTS/Kokoro/.venv/Lib/site-packages/spacy/tests/training/__init__.py new file mode 100644 index 0000000000000000000000000000000000000000..e69de29bb2d1d6434b8b29ae775ad8c2e48c5391 diff --git a/TTS/Kokoro/.venv/Lib/site-packages/spacy/tests/training/__pycache__/__init__.cpython-312.pyc b/TTS/Kokoro/.venv/Lib/site-packages/spacy/tests/training/__pycache__/__init__.cpython-312.pyc new file mode 100644 index 0000000000000000000000000000000000000000..d3ff81140c0198507fe432890891e007a21aff7d Binary files /dev/null and b/TTS/Kokoro/.venv/Lib/site-packages/spacy/tests/training/__pycache__/__init__.cpython-312.pyc differ diff --git a/TTS/Kokoro/.venv/Lib/site-packages/spacy/tests/training/__pycache__/test_augmenters.cpython-312.pyc b/TTS/Kokoro/.venv/Lib/site-packages/spacy/tests/training/__pycache__/test_augmenters.cpython-312.pyc new file mode 100644 index 0000000000000000000000000000000000000000..ce797c18577fac1ac7a64b1e77deb07dae34eb5a Binary files /dev/null and b/TTS/Kokoro/.venv/Lib/site-packages/spacy/tests/training/__pycache__/test_augmenters.cpython-312.pyc differ diff --git a/TTS/Kokoro/.venv/Lib/site-packages/spacy/tests/training/__pycache__/test_corpus.cpython-312.pyc b/TTS/Kokoro/.venv/Lib/site-packages/spacy/tests/training/__pycache__/test_corpus.cpython-312.pyc new file mode 100644 index 0000000000000000000000000000000000000000..b41a39b10fd7e013ce33ca5a47f0a3dec586f063 Binary files /dev/null and b/TTS/Kokoro/.venv/Lib/site-packages/spacy/tests/training/__pycache__/test_corpus.cpython-312.pyc differ diff --git a/TTS/Kokoro/.venv/Lib/site-packages/spacy/tests/training/__pycache__/test_logger.cpython-312.pyc b/TTS/Kokoro/.venv/Lib/site-packages/spacy/tests/training/__pycache__/test_logger.cpython-312.pyc new file mode 100644 index 0000000000000000000000000000000000000000..979352bdf7e6fc0f0637fcc3f8b6d83d20789480 Binary files /dev/null and b/TTS/Kokoro/.venv/Lib/site-packages/spacy/tests/training/__pycache__/test_logger.cpython-312.pyc differ diff --git a/TTS/Kokoro/.venv/Lib/site-packages/spacy/tests/training/__pycache__/test_new_example.cpython-312.pyc b/TTS/Kokoro/.venv/Lib/site-packages/spacy/tests/training/__pycache__/test_new_example.cpython-312.pyc new file mode 100644 index 0000000000000000000000000000000000000000..c0b32cffb7f112f50c51ed1166b84c80df0ecd59 Binary files /dev/null and b/TTS/Kokoro/.venv/Lib/site-packages/spacy/tests/training/__pycache__/test_new_example.cpython-312.pyc differ diff --git a/TTS/Kokoro/.venv/Lib/site-packages/spacy/tests/training/__pycache__/test_pretraining.cpython-312.pyc b/TTS/Kokoro/.venv/Lib/site-packages/spacy/tests/training/__pycache__/test_pretraining.cpython-312.pyc new file mode 100644 index 0000000000000000000000000000000000000000..a0e8b1f83e022e5cfcd8ad6219a74549630efe90 Binary files /dev/null and b/TTS/Kokoro/.venv/Lib/site-packages/spacy/tests/training/__pycache__/test_pretraining.cpython-312.pyc differ diff --git a/TTS/Kokoro/.venv/Lib/site-packages/spacy/tests/training/__pycache__/test_readers.cpython-312.pyc b/TTS/Kokoro/.venv/Lib/site-packages/spacy/tests/training/__pycache__/test_readers.cpython-312.pyc new file mode 100644 index 0000000000000000000000000000000000000000..8d95338f9d7772bb63c78593a38b4066eaa5edea Binary files /dev/null and b/TTS/Kokoro/.venv/Lib/site-packages/spacy/tests/training/__pycache__/test_readers.cpython-312.pyc differ diff --git a/TTS/Kokoro/.venv/Lib/site-packages/spacy/tests/training/__pycache__/test_rehearse.cpython-312.pyc b/TTS/Kokoro/.venv/Lib/site-packages/spacy/tests/training/__pycache__/test_rehearse.cpython-312.pyc new file mode 100644 index 0000000000000000000000000000000000000000..a86618572d816336bbb4029d8de2a7d3b4e41162 Binary files /dev/null and b/TTS/Kokoro/.venv/Lib/site-packages/spacy/tests/training/__pycache__/test_rehearse.cpython-312.pyc differ diff --git a/TTS/Kokoro/.venv/Lib/site-packages/spacy/tests/training/__pycache__/test_training.cpython-312.pyc b/TTS/Kokoro/.venv/Lib/site-packages/spacy/tests/training/__pycache__/test_training.cpython-312.pyc new file mode 100644 index 0000000000000000000000000000000000000000..bae206e74a78105d6c8cd81170a314205c9cdf73 Binary files /dev/null and b/TTS/Kokoro/.venv/Lib/site-packages/spacy/tests/training/__pycache__/test_training.cpython-312.pyc differ diff --git a/TTS/Kokoro/.venv/Lib/site-packages/spacy/tests/training/test_augmenters.py b/TTS/Kokoro/.venv/Lib/site-packages/spacy/tests/training/test_augmenters.py new file mode 100644 index 0000000000000000000000000000000000000000..903883647c1ae130301d6893716d0418f86463aa --- /dev/null +++ b/TTS/Kokoro/.venv/Lib/site-packages/spacy/tests/training/test_augmenters.py @@ -0,0 +1,245 @@ +import random +from contextlib import contextmanager + +import pytest + +from spacy.lang.en import English +from spacy.pipeline._parser_internals.nonproj import contains_cycle +from spacy.tokens import Doc, DocBin, Span +from spacy.training import Corpus, Example +from spacy.training.augment import ( + create_lower_casing_augmenter, + create_orth_variants_augmenter, + make_whitespace_variant, +) + +from ..util import make_tempdir + + +@contextmanager +def make_docbin(docs, name="roundtrip.spacy"): + with make_tempdir() as tmpdir: + output_file = tmpdir / name + DocBin(docs=docs).to_disk(output_file) + yield output_file + + +@pytest.fixture +def nlp(): + return English() + + +@pytest.fixture +def doc(nlp): + # fmt: off + words = ["Sarah", "'s", "sister", "flew", "to", "Silicon", "Valley", "via", "London", "."] + tags = ["NNP", "POS", "NN", "VBD", "IN", "NNP", "NNP", "IN", "NNP", "."] + pos = ["PROPN", "PART", "NOUN", "VERB", "ADP", "PROPN", "PROPN", "ADP", "PROPN", "PUNCT"] + ents = ["B-PERSON", "I-PERSON", "O", "", "O", "B-LOC", "I-LOC", "O", "B-GPE", "O"] + cats = {"TRAVEL": 1.0, "BAKING": 0.0} + # fmt: on + doc = Doc(nlp.vocab, words=words, tags=tags, pos=pos, ents=ents) + doc.cats = cats + return doc + + +@pytest.mark.filterwarnings("ignore::UserWarning") +def test_make_orth_variants(nlp): + single = [ + {"tags": ["NFP"], "variants": ["…", "..."]}, + {"tags": [":"], "variants": ["-", "—", "–", "--", "---", "——"]}, + ] + # fmt: off + words = ["\n\n", "A", "\t", "B", "a", "b", "…", "...", "-", "—", "–", "--", "---", "——"] + tags = ["_SP", "NN", "\t", "NN", "NN", "NN", "NFP", "NFP", ":", ":", ":", ":", ":", ":"] + # fmt: on + spaces = [True] * len(words) + spaces[0] = False + spaces[2] = False + doc = Doc(nlp.vocab, words=words, spaces=spaces, tags=tags) + augmenter = create_orth_variants_augmenter( + level=0.2, lower=0.5, orth_variants={"single": single} + ) + with make_docbin([doc] * 10) as output_file: + reader = Corpus(output_file, augmenter=augmenter) + # Due to randomness, only test that it works without errors + list(reader(nlp)) + + # check that the following settings lowercase everything + augmenter = create_orth_variants_augmenter( + level=1.0, lower=1.0, orth_variants={"single": single} + ) + with make_docbin([doc] * 10) as output_file: + reader = Corpus(output_file, augmenter=augmenter) + for example in reader(nlp): + for token in example.reference: + assert token.text == token.text.lower() + + # check that lowercasing is applied without tags + doc = Doc(nlp.vocab, words=words, spaces=[True] * len(words)) + augmenter = create_orth_variants_augmenter( + level=1.0, lower=1.0, orth_variants={"single": single} + ) + with make_docbin([doc] * 10) as output_file: + reader = Corpus(output_file, augmenter=augmenter) + for example in reader(nlp): + for ex_token, doc_token in zip(example.reference, doc): + assert ex_token.text == doc_token.text.lower() + + # check that no lowercasing is applied with lower=0.0 + doc = Doc(nlp.vocab, words=words, spaces=[True] * len(words)) + augmenter = create_orth_variants_augmenter( + level=1.0, lower=0.0, orth_variants={"single": single} + ) + with make_docbin([doc] * 10) as output_file: + reader = Corpus(output_file, augmenter=augmenter) + for example in reader(nlp): + for ex_token, doc_token in zip(example.reference, doc): + assert ex_token.text == doc_token.text + + +def test_lowercase_augmenter(nlp, doc): + augmenter = create_lower_casing_augmenter(level=1.0) + with make_docbin([doc]) as output_file: + reader = Corpus(output_file, augmenter=augmenter) + corpus = list(reader(nlp)) + eg = corpus[0] + assert eg.reference.text == doc.text.lower() + assert eg.predicted.text == doc.text.lower() + ents = [(e.start, e.end, e.label) for e in doc.ents] + assert [(e.start, e.end, e.label) for e in eg.reference.ents] == ents + for ref_ent, orig_ent in zip(eg.reference.ents, doc.ents): + assert ref_ent.text == orig_ent.text.lower() + assert [t.ent_iob for t in doc] == [t.ent_iob for t in eg.reference] + assert [t.pos_ for t in eg.reference] == [t.pos_ for t in doc] + + # check that augmentation works when lowercasing leads to different + # predicted tokenization + words = ["A", "B", "CCC."] + doc = Doc(nlp.vocab, words=words) + with make_docbin([doc]) as output_file: + reader = Corpus(output_file, augmenter=augmenter) + corpus = list(reader(nlp)) + eg = corpus[0] + assert eg.reference.text == doc.text.lower() + assert eg.predicted.text == doc.text.lower() + assert [t.text for t in eg.reference] == [t.lower() for t in words] + assert [t.text for t in eg.predicted] == [ + t.text for t in nlp.make_doc(doc.text.lower()) + ] + + +@pytest.mark.filterwarnings("ignore::UserWarning") +def test_custom_data_augmentation(nlp, doc): + def create_spongebob_augmenter(randomize: bool = False): + def augment(nlp, example): + text = example.text + if randomize: + ch = [c.lower() if random.random() < 0.5 else c.upper() for c in text] + else: + ch = [c.lower() if i % 2 else c.upper() for i, c in enumerate(text)] + example_dict = example.to_dict() + doc = nlp.make_doc("".join(ch)) + example_dict["token_annotation"]["ORTH"] = [t.text for t in doc] + yield example + yield example.from_dict(doc, example_dict) + + return augment + + with make_docbin([doc]) as output_file: + reader = Corpus(output_file, augmenter=create_spongebob_augmenter()) + corpus = list(reader(nlp)) + orig_text = "Sarah 's sister flew to Silicon Valley via London . " + augmented = "SaRaH 's sIsTeR FlEw tO SiLiCoN VaLlEy vIa lOnDoN . " + assert corpus[0].text == orig_text + assert corpus[0].reference.text == orig_text + assert corpus[0].predicted.text == orig_text + assert corpus[1].text == augmented + assert corpus[1].reference.text == augmented + assert corpus[1].predicted.text == augmented + ents = [(e.start, e.end, e.label) for e in doc.ents] + assert [(e.start, e.end, e.label) for e in corpus[0].reference.ents] == ents + assert [(e.start, e.end, e.label) for e in corpus[1].reference.ents] == ents + + +def test_make_whitespace_variant(nlp): + # fmt: off + text = "They flew to New York City.\nThen they drove to Washington, D.C." + words = ["They", "flew", "to", "New", "York", "City", ".", "\n", "Then", "they", "drove", "to", "Washington", ",", "D.C."] + spaces = [True, True, True, True, True, False, False, False, True, True, True, True, False, True, False] + tags = ["PRP", "VBD", "IN", "NNP", "NNP", "NNP", ".", "_SP", "RB", "PRP", "VBD", "IN", "NNP", ",", "NNP"] + lemmas = ["they", "fly", "to", "New", "York", "City", ".", "\n", "then", "they", "drive", "to", "Washington", ",", "D.C."] + heads = [1, 1, 1, 4, 5, 2, 1, 10, 10, 10, 10, 10, 11, 12, 12] + deps = ["nsubj", "ROOT", "prep", "compound", "compound", "pobj", "punct", "dep", "advmod", "nsubj", "ROOT", "prep", "pobj", "punct", "appos"] + ents = ["O", "", "O", "B-GPE", "I-GPE", "I-GPE", "O", "O", "O", "O", "O", "O", "B-GPE", "O", "B-GPE"] + # fmt: on + doc = Doc( + nlp.vocab, + words=words, + spaces=spaces, + tags=tags, + lemmas=lemmas, + heads=heads, + deps=deps, + ents=ents, + ) + assert doc.text == text + example = Example(nlp.make_doc(text), doc) + # whitespace is only added internally in entity spans + mod_ex = make_whitespace_variant(nlp, example, " ", 3) + assert mod_ex.reference.ents[0].text == "New York City" + mod_ex = make_whitespace_variant(nlp, example, " ", 4) + assert mod_ex.reference.ents[0].text == "New York City" + mod_ex = make_whitespace_variant(nlp, example, " ", 5) + assert mod_ex.reference.ents[0].text == "New York City" + mod_ex = make_whitespace_variant(nlp, example, " ", 6) + assert mod_ex.reference.ents[0].text == "New York City" + # add a space at every possible position + for i in range(len(doc) + 1): + mod_ex = make_whitespace_variant(nlp, example, " ", i) + assert mod_ex.reference[i].is_space + # adds annotation when the doc contains at least partial annotation + assert [t.tag_ for t in mod_ex.reference] == tags[:i] + ["_SP"] + tags[i:] + assert [t.lemma_ for t in mod_ex.reference] == lemmas[:i] + [" "] + lemmas[i:] + assert [t.dep_ for t in mod_ex.reference] == deps[:i] + ["dep"] + deps[i:] + # does not add partial annotation if doc does not contain this feature + assert not mod_ex.reference.has_annotation("POS") + assert not mod_ex.reference.has_annotation("MORPH") + # produces well-formed trees + assert not contains_cycle([t.head.i for t in mod_ex.reference]) + assert len(list(doc.sents)) == 2 + if i == 0: + assert mod_ex.reference[i].head.i == 1 + else: + assert mod_ex.reference[i].head.i == i - 1 + # adding another space also produces well-formed trees + for j in (3, 8, 10): + mod_ex2 = make_whitespace_variant(nlp, mod_ex, "\t\t\n", j) + assert not contains_cycle([t.head.i for t in mod_ex2.reference]) + assert len(list(doc.sents)) == 2 + assert mod_ex2.reference[j].head.i == j - 1 + # entities are well-formed + assert len(doc.ents) == len(mod_ex.reference.ents) + # there is one token with missing entity information + assert any(t.ent_iob == 0 for t in mod_ex.reference) + for ent in mod_ex.reference.ents: + assert not ent[0].is_space + assert not ent[-1].is_space + + # no modifications if: + # partial dependencies + example.reference[0].dep_ = "" + mod_ex = make_whitespace_variant(nlp, example, " ", 5) + assert mod_ex.text == example.reference.text + example.reference[0].dep_ = "nsubj" # reset + + # spans + example.reference.spans["spans"] = [example.reference[0:5]] + mod_ex = make_whitespace_variant(nlp, example, " ", 5) + assert mod_ex.text == example.reference.text + del example.reference.spans["spans"] # reset + + # links + example.reference.ents = [Span(doc, 0, 2, label="ENT", kb_id="Q123")] + mod_ex = make_whitespace_variant(nlp, example, " ", 5) + assert mod_ex.text == example.reference.text diff --git a/TTS/Kokoro/.venv/Lib/site-packages/spacy/tests/training/test_corpus.py b/TTS/Kokoro/.venv/Lib/site-packages/spacy/tests/training/test_corpus.py new file mode 100644 index 0000000000000000000000000000000000000000..b0a62821fc6827df1fdaacdbff62bb7e1efafa34 --- /dev/null +++ b/TTS/Kokoro/.venv/Lib/site-packages/spacy/tests/training/test_corpus.py @@ -0,0 +1,79 @@ +import tempfile +from contextlib import contextmanager +from pathlib import Path +from typing import IO, Generator, Iterable, List, TextIO, Tuple + +import pytest + +from spacy.lang.en import English +from spacy.training import Example, PlainTextCorpus +from spacy.util import make_tempdir + +# Intentional newlines to check that they are skipped. +PLAIN_TEXT_DOC = """ + +This is a doc. It contains two sentences. +This is another doc. + +A third doc. + +""" + +PLAIN_TEXT_DOC_TOKENIZED = [ + [ + "This", + "is", + "a", + "doc", + ".", + "It", + "contains", + "two", + "sentences", + ".", + ], + ["This", "is", "another", "doc", "."], + ["A", "third", "doc", "."], +] + + +@pytest.mark.parametrize("min_length", [0, 5]) +@pytest.mark.parametrize("max_length", [0, 5]) +def test_plain_text_reader(min_length, max_length): + nlp = English() + with _string_to_tmp_file(PLAIN_TEXT_DOC) as file_path: + corpus = PlainTextCorpus( + file_path, min_length=min_length, max_length=max_length + ) + + check = [ + doc + for doc in PLAIN_TEXT_DOC_TOKENIZED + if len(doc) >= min_length and (max_length == 0 or len(doc) <= max_length) + ] + reference, predicted = _examples_to_tokens(corpus(nlp)) + + assert reference == check + assert predicted == check + + +@contextmanager +def _string_to_tmp_file(s: str) -> Generator[Path, None, None]: + with make_tempdir() as d: + file_path = Path(d) / "string.txt" + with open(file_path, "w", encoding="utf-8") as f: + f.write(s) + yield file_path + + +def _examples_to_tokens( + examples: Iterable[Example], +) -> Tuple[List[List[str]], List[List[str]]]: + reference = [] + predicted = [] + + for eg in examples: + reference.append([t.text for t in eg.reference]) + predicted.append([t.text for t in eg.predicted]) + + return reference, predicted diff --git a/TTS/Kokoro/.venv/Lib/site-packages/spacy/tests/training/test_logger.py b/TTS/Kokoro/.venv/Lib/site-packages/spacy/tests/training/test_logger.py new file mode 100644 index 0000000000000000000000000000000000000000..9d92cf3acc7d0479c755cf6ecf6cc12c0fc1a98e --- /dev/null +++ b/TTS/Kokoro/.venv/Lib/site-packages/spacy/tests/training/test_logger.py @@ -0,0 +1,30 @@ +import pytest + +import spacy +from spacy.training import loggers + + +@pytest.fixture() +def nlp(): + nlp = spacy.blank("en") + nlp.add_pipe("ner") + return nlp + + +@pytest.fixture() +def info(): + return { + "losses": {"ner": 100}, + "other_scores": {"ENTS_F": 0.85, "ENTS_P": 0.90, "ENTS_R": 0.80}, + "epoch": 100, + "step": 125, + "score": 85, + } + + +def test_console_logger(nlp, info): + console_logger = loggers.console_logger( + progress_bar=True, console_output=True, output_file=None + ) + log_step, finalize = console_logger(nlp) + log_step(info) diff --git a/TTS/Kokoro/.venv/Lib/site-packages/spacy/tests/training/test_new_example.py b/TTS/Kokoro/.venv/Lib/site-packages/spacy/tests/training/test_new_example.py new file mode 100644 index 0000000000000000000000000000000000000000..40681cbbf0d6bbd87f490b3474f52f9af6a401bf --- /dev/null +++ b/TTS/Kokoro/.venv/Lib/site-packages/spacy/tests/training/test_new_example.py @@ -0,0 +1,472 @@ +import pytest + +from spacy.tokens import Doc +from spacy.training.example import Example +from spacy.util import to_ternary_int +from spacy.vocab import Vocab + + +def test_Example_init_requires_doc_objects(): + vocab = Vocab() + with pytest.raises(TypeError): + Example(None, None) + with pytest.raises(TypeError): + Example(Doc(vocab, words=["hi"]), None) + with pytest.raises(TypeError): + Example(None, Doc(vocab, words=["hi"])) + + +def test_Example_from_dict_basic(): + example = Example.from_dict( + Doc(Vocab(), words=["hello", "world"]), {"words": ["hello", "world"]} + ) + assert isinstance(example.x, Doc) + assert isinstance(example.y, Doc) + + +@pytest.mark.parametrize( + "annots", [{"words": ["ice", "cream"], "weirdannots": ["something", "such"]}] +) +def test_Example_from_dict_invalid(annots): + vocab = Vocab() + predicted = Doc(vocab, words=annots["words"]) + with pytest.raises(KeyError): + Example.from_dict(predicted, annots) + + +@pytest.mark.parametrize( + "pred_words", [["ice", "cream"], ["icecream"], ["i", "ce", "cream"]] +) +@pytest.mark.parametrize("annots", [{"words": ["icecream"], "tags": ["NN"]}]) +def test_Example_from_dict_with_tags(pred_words, annots): + vocab = Vocab() + predicted = Doc(vocab, words=pred_words) + example = Example.from_dict(predicted, annots) + for i, token in enumerate(example.reference): + assert token.tag_ == annots["tags"][i] + aligned_tags = example.get_aligned("TAG", as_string=True) + assert aligned_tags == ["NN" for _ in predicted] + + +@pytest.mark.filterwarnings("ignore::UserWarning") +def test_aligned_tags(): + pred_words = ["Apply", "some", "sunscreen", "unless", "you", "can", "not"] + gold_words = ["Apply", "some", "sun", "screen", "unless", "you", "cannot"] + gold_tags = ["VERB", "DET", "NOUN", "NOUN", "SCONJ", "PRON", "VERB"] + annots = {"words": gold_words, "tags": gold_tags} + vocab = Vocab() + predicted = Doc(vocab, words=pred_words) + example1 = Example.from_dict(predicted, annots) + aligned_tags1 = example1.get_aligned("TAG", as_string=True) + assert aligned_tags1 == ["VERB", "DET", "NOUN", "SCONJ", "PRON", "VERB", "VERB"] + # ensure that to_dict works correctly + example2 = Example.from_dict(predicted, example1.to_dict()) + aligned_tags2 = example2.get_aligned("TAG", as_string=True) + assert aligned_tags2 == ["VERB", "DET", "NOUN", "SCONJ", "PRON", "VERB", "VERB"] + + +def test_aligned_tags_multi(): + pred_words = ["Applysome", "sunscreen", "unless", "you", "can", "not"] + gold_words = ["Apply", "somesun", "screen", "unless", "you", "cannot"] + gold_tags = ["VERB", "DET", "NOUN", "SCONJ", "PRON", "VERB"] + annots = {"words": gold_words, "tags": gold_tags} + vocab = Vocab() + predicted = Doc(vocab, words=pred_words) + example = Example.from_dict(predicted, annots) + aligned_tags = example.get_aligned("TAG", as_string=True) + assert aligned_tags == [None, None, "SCONJ", "PRON", "VERB", "VERB"] + + +@pytest.mark.parametrize( + "annots", + [ + { + "words": ["I", "like", "London", "and", "Berlin", "."], + "deps": ["nsubj", "ROOT", "dobj", "cc", "conj", "punct"], + "heads": [1, 1, 1, 2, 2, 1], + } + ], +) +def test_Example_from_dict_with_parse(annots): + vocab = Vocab() + predicted = Doc(vocab, words=annots["words"]) + example = Example.from_dict(predicted, annots) + for i, token in enumerate(example.reference): + assert token.dep_ == annots["deps"][i] + assert token.head.i == annots["heads"][i] + + +@pytest.mark.parametrize( + "annots", + [ + { + "words": ["Sarah", "'s", "sister", "flew"], + "morphs": [ + "NounType=prop|Number=sing", + "Poss=yes", + "Number=sing", + "Tense=past|VerbForm=fin", + ], + } + ], +) +def test_Example_from_dict_with_morphology(annots): + vocab = Vocab() + predicted = Doc(vocab, words=annots["words"]) + example = Example.from_dict(predicted, annots) + for i, token in enumerate(example.reference): + assert str(token.morph) == annots["morphs"][i] + + +@pytest.mark.parametrize( + "annots", + [ + { + "words": ["This", "is", "one", "sentence", "this", "is", "another"], + "sent_starts": [1, False, 0, None, True, -1, -5.7], + } + ], +) +def test_Example_from_dict_with_sent_start(annots): + vocab = Vocab() + predicted = Doc(vocab, words=annots["words"]) + example = Example.from_dict(predicted, annots) + assert len(list(example.reference.sents)) == 2 + for i, token in enumerate(example.reference): + if to_ternary_int(annots["sent_starts"][i]) == 1: + assert token.is_sent_start is True + elif to_ternary_int(annots["sent_starts"][i]) == 0: + assert token.is_sent_start is None + else: + assert token.is_sent_start is False + + +@pytest.mark.parametrize( + "annots", + [ + { + "words": ["This", "is", "a", "sentence"], + "cats": {"cat1": 1.0, "cat2": 0.0, "cat3": 0.5}, + } + ], +) +def test_Example_from_dict_with_cats(annots): + vocab = Vocab() + predicted = Doc(vocab, words=annots["words"]) + example = Example.from_dict(predicted, annots) + assert len(list(example.reference.cats)) == 3 + assert example.reference.cats["cat1"] == 1.0 + assert example.reference.cats["cat2"] == 0.0 + assert example.reference.cats["cat3"] == 0.5 + + +@pytest.mark.parametrize( + "annots", + [ + { + "words": ["I", "like", "New", "York", "and", "Berlin", "."], + "entities": [(7, 15, "LOC"), (20, 26, "LOC")], + } + ], +) +def test_Example_from_dict_with_entities(annots): + vocab = Vocab() + predicted = Doc(vocab, words=annots["words"]) + example = Example.from_dict(predicted, annots) + assert len(list(example.reference.ents)) == 2 + # fmt: off + assert [example.reference[i].ent_iob_ for i in range(7)] == ["O", "O", "B", "I", "O", "B", "O"] + assert example.get_aligned("ENT_IOB") == [2, 2, 3, 1, 2, 3, 2] + # fmt: on + assert example.reference[2].ent_type_ == "LOC" + assert example.reference[3].ent_type_ == "LOC" + assert example.reference[5].ent_type_ == "LOC" + + +def test_Example_from_dict_with_empty_entities(): + annots = { + "words": ["I", "like", "New", "York", "and", "Berlin", "."], + "entities": [], + } + vocab = Vocab() + predicted = Doc(vocab, words=annots["words"]) + example = Example.from_dict(predicted, annots) + # entities as empty list sets everything to O + assert example.reference.has_annotation("ENT_IOB") + assert len(list(example.reference.ents)) == 0 + assert all(token.ent_iob_ == "O" for token in example.reference) + # various unset/missing entities leaves entities unset + annots["entities"] = None + example = Example.from_dict(predicted, annots) + assert not example.reference.has_annotation("ENT_IOB") + annots.pop("entities", None) + example = Example.from_dict(predicted, annots) + assert not example.reference.has_annotation("ENT_IOB") + + +@pytest.mark.parametrize( + "annots", + [ + { + "words": ["I", "like", "New", "York", "and", "Berlin", "."], + "entities": [ + (0, 4, "LOC"), + (21, 27, "LOC"), + ], # not aligned to token boundaries + } + ], +) +def test_Example_from_dict_with_entities_invalid(annots): + vocab = Vocab() + predicted = Doc(vocab, words=annots["words"]) + with pytest.warns(UserWarning): + example = Example.from_dict(predicted, annots) + assert len(list(example.reference.ents)) == 0 + + +@pytest.mark.parametrize( + "annots", + [ + { + "words": ["I", "like", "New", "York", "and", "Berlin", "."], + "entities": [ + (7, 15, "LOC"), + (11, 15, "LOC"), + (20, 26, "LOC"), + ], # overlapping + } + ], +) +def test_Example_from_dict_with_entities_overlapping(annots): + vocab = Vocab() + predicted = Doc(vocab, words=annots["words"]) + with pytest.raises(ValueError): + Example.from_dict(predicted, annots) + + +@pytest.mark.parametrize( + "annots", + [ + { + "words": ["I", "like", "New", "York", "and", "Berlin", "."], + "spans": { + "cities": [(7, 15, "LOC"), (20, 26, "LOC")], + "people": [(0, 1, "PERSON")], + }, + } + ], +) +def test_Example_from_dict_with_spans(annots): + vocab = Vocab() + predicted = Doc(vocab, words=annots["words"]) + example = Example.from_dict(predicted, annots) + assert len(list(example.reference.ents)) == 0 + assert len(list(example.reference.spans["cities"])) == 2 + assert len(list(example.reference.spans["people"])) == 1 + for span in example.reference.spans["cities"]: + assert span.label_ == "LOC" + for span in example.reference.spans["people"]: + assert span.label_ == "PERSON" + + +@pytest.mark.parametrize( + "annots", + [ + { + "words": ["I", "like", "New", "York", "and", "Berlin", "."], + "spans": { + "cities": [(7, 15, "LOC"), (11, 15, "LOC"), (20, 26, "LOC")], + "people": [(0, 1, "PERSON")], + }, + } + ], +) +def test_Example_from_dict_with_spans_overlapping(annots): + vocab = Vocab() + predicted = Doc(vocab, words=annots["words"]) + example = Example.from_dict(predicted, annots) + assert len(list(example.reference.ents)) == 0 + assert len(list(example.reference.spans["cities"])) == 3 + assert len(list(example.reference.spans["people"])) == 1 + for span in example.reference.spans["cities"]: + assert span.label_ == "LOC" + for span in example.reference.spans["people"]: + assert span.label_ == "PERSON" + + +@pytest.mark.parametrize( + "annots", + [ + { + "words": ["I", "like", "New", "York", "and", "Berlin", "."], + "spans": [(0, 1, "PERSON")], + }, + { + "words": ["I", "like", "New", "York", "and", "Berlin", "."], + "spans": {"cities": (7, 15, "LOC")}, + }, + { + "words": ["I", "like", "New", "York", "and", "Berlin", "."], + "spans": {"cities": [7, 11]}, + }, + { + "words": ["I", "like", "New", "York", "and", "Berlin", "."], + "spans": {"cities": [[7]]}, + }, + ], +) +def test_Example_from_dict_with_spans_invalid(annots): + vocab = Vocab() + predicted = Doc(vocab, words=annots["words"]) + with pytest.raises(ValueError): + Example.from_dict(predicted, annots) + + +@pytest.mark.parametrize( + "annots", + [ + { + "words": ["I", "like", "New", "York", "and", "Berlin", "."], + "entities": [(7, 15, "LOC"), (20, 26, "LOC")], + "links": { + (7, 15): {"Q60": 1.0, "Q64": 0.0}, + (20, 26): {"Q60": 0.0, "Q64": 1.0}, + }, + } + ], +) +def test_Example_from_dict_with_links(annots): + vocab = Vocab() + predicted = Doc(vocab, words=annots["words"]) + example = Example.from_dict(predicted, annots) + assert example.reference[0].ent_kb_id_ == "" + assert example.reference[1].ent_kb_id_ == "" + assert example.reference[2].ent_kb_id_ == "Q60" + assert example.reference[3].ent_kb_id_ == "Q60" + assert example.reference[4].ent_kb_id_ == "" + assert example.reference[5].ent_kb_id_ == "Q64" + assert example.reference[6].ent_kb_id_ == "" + + +@pytest.mark.parametrize( + "annots", + [ + { + "words": ["I", "like", "New", "York", "and", "Berlin", "."], + "links": {(7, 14): {"Q7381115": 1.0, "Q2146908": 0.0}}, + } + ], +) +def test_Example_from_dict_with_links_invalid(annots): + vocab = Vocab() + predicted = Doc(vocab, words=annots["words"]) + with pytest.raises(ValueError): + Example.from_dict(predicted, annots) + + +def test_Example_from_dict_sentences(): + vocab = Vocab() + predicted = Doc(vocab, words=["One", "sentence", ".", "one", "more"]) + annots = {"sent_starts": [1, 0, 0, 1, 0]} + ex = Example.from_dict(predicted, annots) + assert len(list(ex.reference.sents)) == 2 + + # this currently throws an error - bug or feature? + # predicted = Doc(vocab, words=["One", "sentence", "not", "one", "more"]) + # annots = {"sent_starts": [1, 0, 0, 0, 0]} + # ex = Example.from_dict(predicted, annots) + # assert len(list(ex.reference.sents)) == 1 + + predicted = Doc(vocab, words=["One", "sentence", "not", "one", "more"]) + annots = {"sent_starts": [1, -1, 0, 0, 0]} + ex = Example.from_dict(predicted, annots) + assert len(list(ex.reference.sents)) == 1 + + +def test_Example_missing_deps(): + vocab = Vocab() + words = ["I", "like", "London", "and", "Berlin", "."] + deps = ["nsubj", "ROOT", "dobj", "cc", "conj", "punct"] + heads = [1, 1, 1, 2, 2, 1] + annots_head_only = {"words": words, "heads": heads} + annots_head_dep = {"words": words, "heads": heads, "deps": deps} + predicted = Doc(vocab, words=words) + + # when not providing deps, the head information is considered to be missing + # in this case, the token's heads refer to themselves + example_1 = Example.from_dict(predicted, annots_head_only) + assert [t.head.i for t in example_1.reference] == [0, 1, 2, 3, 4, 5] + + # when providing deps, the head information is actually used + example_2 = Example.from_dict(predicted, annots_head_dep) + assert [t.head.i for t in example_2.reference] == heads + + +def test_Example_missing_heads(): + vocab = Vocab() + words = ["I", "like", "London", "and", "Berlin", "."] + deps = ["nsubj", "ROOT", "dobj", None, "conj", "punct"] + heads = [1, 1, 1, None, 2, 1] + annots = {"words": words, "heads": heads, "deps": deps} + predicted = Doc(vocab, words=words) + + example = Example.from_dict(predicted, annots) + parsed_heads = [t.head.i for t in example.reference] + assert parsed_heads[0] == heads[0] + assert parsed_heads[1] == heads[1] + assert parsed_heads[2] == heads[2] + assert parsed_heads[4] == heads[4] + assert parsed_heads[5] == heads[5] + expected = [True, True, True, False, True, True] + assert [t.has_head() for t in example.reference] == expected + # Ensure that the missing head doesn't create an artificial new sentence start + expected = [True, False, False, False, False, False] + assert example.get_aligned_sent_starts() == expected + + +def test_Example_aligned_whitespace(en_vocab): + words = ["a", " ", "b"] + tags = ["A", "SPACE", "B"] + predicted = Doc(en_vocab, words=words) + reference = Doc(en_vocab, words=words, tags=tags) + + example = Example(predicted, reference) + assert example.get_aligned("TAG", as_string=True) == tags + + +@pytest.mark.issue("11260") +def test_issue11260(): + annots = { + "words": ["I", "like", "New", "York", "."], + "spans": { + "cities": [(7, 15, "LOC", "")], + "people": [(0, 1, "PERSON", "")], + }, + } + vocab = Vocab() + predicted = Doc(vocab, words=annots["words"]) + example = Example.from_dict(predicted, annots) + assert len(example.reference.spans["cities"]) == 1 + assert len(example.reference.spans["people"]) == 1 + + output_dict = example.to_dict() + assert "spans" in output_dict["doc_annotation"] + assert output_dict["doc_annotation"]["spans"]["cities"] == annots["spans"]["cities"] + assert output_dict["doc_annotation"]["spans"]["people"] == annots["spans"]["people"] + + output_example = Example.from_dict(predicted, output_dict) + + assert len(output_example.reference.spans["cities"]) == len( + example.reference.spans["cities"] + ) + assert len(output_example.reference.spans["people"]) == len( + example.reference.spans["people"] + ) + for span in example.reference.spans["cities"]: + assert span.label_ == "LOC" + assert span.text == "New York" + assert span.start_char == 7 + for span in example.reference.spans["people"]: + assert span.label_ == "PERSON" + assert span.text == "I" + assert span.start_char == 0 diff --git a/TTS/Kokoro/.venv/Lib/site-packages/spacy/tests/training/test_pretraining.py b/TTS/Kokoro/.venv/Lib/site-packages/spacy/tests/training/test_pretraining.py new file mode 100644 index 0000000000000000000000000000000000000000..250202a90210dd865c22b870009611b9567a96c8 --- /dev/null +++ b/TTS/Kokoro/.venv/Lib/site-packages/spacy/tests/training/test_pretraining.py @@ -0,0 +1,382 @@ +from pathlib import Path + +import numpy as np +import pytest +import srsly +from thinc.api import Config, get_current_ops + +from spacy import util +from spacy.lang.en import English +from spacy.language import DEFAULT_CONFIG_PATH, DEFAULT_CONFIG_PRETRAIN_PATH +from spacy.ml.models.multi_task import create_pretrain_vectors +from spacy.tokens import Doc, DocBin +from spacy.training.initialize import init_nlp +from spacy.training.loop import train +from spacy.training.pretrain import pretrain +from spacy.vectors import Vectors +from spacy.vocab import Vocab + +from ..util import make_tempdir + +pretrain_string_listener = """ +[nlp] +lang = "en" +pipeline = ["tok2vec", "tagger"] + +[components] + +[components.tok2vec] +factory = "tok2vec" + +[components.tok2vec.model] +@architectures = "spacy.HashEmbedCNN.v1" +pretrained_vectors = null +width = 342 +depth = 4 +window_size = 1 +embed_size = 2000 +maxout_pieces = 3 +subword_features = true + +[components.tagger] +factory = "tagger" + +[components.tagger.model] +@architectures = "spacy.Tagger.v2" + +[components.tagger.model.tok2vec] +@architectures = "spacy.Tok2VecListener.v1" +width = ${components.tok2vec.model.width} + +[pretraining] +max_epochs = 5 + +[training] +max_epochs = 5 +""" + +pretrain_string_internal = """ +[nlp] +lang = "en" +pipeline = ["tagger"] + +[components] + +[components.tagger] +factory = "tagger" + +[components.tagger.model] +@architectures = "spacy.Tagger.v2" + +[components.tagger.model.tok2vec] +@architectures = "spacy.HashEmbedCNN.v1" +pretrained_vectors = null +width = 342 +depth = 4 +window_size = 1 +embed_size = 2000 +maxout_pieces = 3 +subword_features = true + +[pretraining] +max_epochs = 5 + +[training] +max_epochs = 5 +""" + + +pretrain_string_vectors = """ +[nlp] +lang = "en" +pipeline = ["tok2vec", "tagger"] + +[components] + +[components.tok2vec] +factory = "tok2vec" + +[components.tok2vec.model] +@architectures = "spacy.HashEmbedCNN.v1" +pretrained_vectors = null +width = 342 +depth = 4 +window_size = 1 +embed_size = 2000 +maxout_pieces = 3 +subword_features = true + +[components.tagger] +factory = "tagger" + +[components.tagger.model] +@architectures = "spacy.Tagger.v2" + +[components.tagger.model.tok2vec] +@architectures = "spacy.Tok2VecListener.v1" +width = ${components.tok2vec.model.width} + +[pretraining] +max_epochs = 5 + +[pretraining.objective] +@architectures = spacy.PretrainVectors.v1 +maxout_pieces = 3 +hidden_size = 300 +loss = cosine + +[training] +max_epochs = 5 +""" + +CHAR_OBJECTIVES = [ + {}, + {"@architectures": "spacy.PretrainCharacters.v1"}, + { + "@architectures": "spacy.PretrainCharacters.v1", + "maxout_pieces": 5, + "hidden_size": 42, + "n_characters": 2, + }, +] + +VECTOR_OBJECTIVES = [ + { + "@architectures": "spacy.PretrainVectors.v1", + "maxout_pieces": 3, + "hidden_size": 300, + "loss": "cosine", + }, + { + "@architectures": "spacy.PretrainVectors.v1", + "maxout_pieces": 2, + "hidden_size": 200, + "loss": "L2", + }, +] + + +def test_pretraining_default(): + """Test that pretraining defaults to a character objective""" + config = Config().from_str(pretrain_string_internal) + nlp = util.load_model_from_config(config, auto_fill=True, validate=False) + filled = nlp.config + pretrain_config = util.load_config(DEFAULT_CONFIG_PRETRAIN_PATH) + filled = pretrain_config.merge(filled) + assert "PretrainCharacters" in filled["pretraining"]["objective"]["@architectures"] + + +@pytest.mark.parametrize("objective", CHAR_OBJECTIVES) +@pytest.mark.parametrize("skip_last", (True, False)) +def test_pretraining_tok2vec_characters(objective, skip_last): + """Test that pretraining works with the character objective""" + config = Config().from_str(pretrain_string_listener) + config["pretraining"]["objective"] = objective + nlp = util.load_model_from_config(config, auto_fill=True, validate=False) + filled = nlp.config + pretrain_config = util.load_config(DEFAULT_CONFIG_PRETRAIN_PATH) + filled = pretrain_config.merge(filled) + with make_tempdir() as tmp_dir: + file_path = write_sample_jsonl(tmp_dir) + filled["paths"]["raw_text"] = file_path + filled = filled.interpolate() + assert filled["pretraining"]["component"] == "tok2vec" + pretrain(filled, tmp_dir, skip_last=skip_last) + assert Path(tmp_dir / "model0.bin").exists() + assert Path(tmp_dir / "model4.bin").exists() + assert not Path(tmp_dir / "model5.bin").exists() + if skip_last: + assert not Path(tmp_dir / "model-last.bin").exists() + else: + assert Path(tmp_dir / "model-last.bin").exists() + + +@pytest.mark.parametrize("objective", VECTOR_OBJECTIVES) +def test_pretraining_tok2vec_vectors_fail(objective): + """Test that pretraining doesn't works with the vectors objective if there are no static vectors""" + config = Config().from_str(pretrain_string_listener) + config["pretraining"]["objective"] = objective + nlp = util.load_model_from_config(config, auto_fill=True, validate=False) + filled = nlp.config + pretrain_config = util.load_config(DEFAULT_CONFIG_PRETRAIN_PATH) + filled = pretrain_config.merge(filled) + with make_tempdir() as tmp_dir: + file_path = write_sample_jsonl(tmp_dir) + filled["paths"]["raw_text"] = file_path + filled = filled.interpolate() + assert filled["initialize"]["vectors"] is None + with pytest.raises(ValueError): + pretrain(filled, tmp_dir) + + +@pytest.mark.parametrize("objective", VECTOR_OBJECTIVES) +def test_pretraining_tok2vec_vectors(objective): + """Test that pretraining works with the vectors objective and static vectors defined""" + config = Config().from_str(pretrain_string_listener) + config["pretraining"]["objective"] = objective + nlp = util.load_model_from_config(config, auto_fill=True, validate=False) + filled = nlp.config + pretrain_config = util.load_config(DEFAULT_CONFIG_PRETRAIN_PATH) + filled = pretrain_config.merge(filled) + with make_tempdir() as tmp_dir: + file_path = write_sample_jsonl(tmp_dir) + filled["paths"]["raw_text"] = file_path + nlp_path = write_vectors_model(tmp_dir) + filled["initialize"]["vectors"] = nlp_path + filled = filled.interpolate() + pretrain(filled, tmp_dir) + + +@pytest.mark.parametrize("config", [pretrain_string_internal, pretrain_string_listener]) +def test_pretraining_tagger_tok2vec(config): + """Test pretraining of the tagger's tok2vec layer (via a listener)""" + config = Config().from_str(pretrain_string_listener) + nlp = util.load_model_from_config(config, auto_fill=True, validate=False) + filled = nlp.config + pretrain_config = util.load_config(DEFAULT_CONFIG_PRETRAIN_PATH) + filled = pretrain_config.merge(filled) + with make_tempdir() as tmp_dir: + file_path = write_sample_jsonl(tmp_dir) + filled["paths"]["raw_text"] = file_path + filled["pretraining"]["component"] = "tagger" + filled["pretraining"]["layer"] = "tok2vec" + filled = filled.interpolate() + pretrain(filled, tmp_dir) + assert Path(tmp_dir / "model0.bin").exists() + assert Path(tmp_dir / "model4.bin").exists() + assert Path(tmp_dir / "model-last.bin").exists() + assert not Path(tmp_dir / "model5.bin").exists() + + +def test_pretraining_tagger(): + """Test pretraining of the tagger itself will throw an error (not an appropriate tok2vec layer)""" + config = Config().from_str(pretrain_string_internal) + nlp = util.load_model_from_config(config, auto_fill=True, validate=False) + filled = nlp.config + pretrain_config = util.load_config(DEFAULT_CONFIG_PRETRAIN_PATH) + filled = pretrain_config.merge(filled) + with make_tempdir() as tmp_dir: + file_path = write_sample_jsonl(tmp_dir) + filled["paths"]["raw_text"] = file_path + filled["pretraining"]["component"] = "tagger" + filled = filled.interpolate() + with pytest.raises(ValueError): + pretrain(filled, tmp_dir) + + +# Try to debug segfault on windows +def test_pretraining_training(): + """Test that training can use a pretrained Tok2Vec model""" + config = Config().from_str(pretrain_string_internal) + nlp = util.load_model_from_config(config, auto_fill=True, validate=False) + filled = nlp.config + pretrain_config = util.load_config(DEFAULT_CONFIG_PRETRAIN_PATH) + filled = pretrain_config.merge(filled) + train_config = util.load_config(DEFAULT_CONFIG_PATH) + filled = train_config.merge(filled) + with make_tempdir() as tmp_dir: + pretrain_dir = tmp_dir / "pretrain" + pretrain_dir.mkdir() + file_path = write_sample_jsonl(pretrain_dir) + filled["paths"]["raw_text"] = file_path + filled["pretraining"]["component"] = "tagger" + filled["pretraining"]["layer"] = "tok2vec" + train_dir = tmp_dir / "train" + train_dir.mkdir() + train_path, dev_path = write_sample_training(train_dir) + filled["paths"]["train"] = train_path + filled["paths"]["dev"] = dev_path + filled = filled.interpolate() + P = filled["pretraining"] + nlp_base = init_nlp(filled) + model_base = ( + nlp_base.get_pipe(P["component"]).model.get_ref(P["layer"]).get_ref("embed") + ) + embed_base = None + for node in model_base.walk(): + if node.name == "hashembed": + embed_base = node + pretrain(filled, pretrain_dir) + pretrained_model = Path(pretrain_dir / "model3.bin") + assert pretrained_model.exists() + filled["initialize"]["init_tok2vec"] = str(pretrained_model) + nlp = init_nlp(filled) + model = nlp.get_pipe(P["component"]).model.get_ref(P["layer"]).get_ref("embed") + embed = None + for node in model.walk(): + if node.name == "hashembed": + embed = node + # ensure that the tok2vec weights are actually changed by the pretraining + assert np.any(np.not_equal(embed.get_param("E"), embed_base.get_param("E"))) + train(nlp, train_dir) + + +def write_sample_jsonl(tmp_dir): + data = [ + { + "meta": {"id": "1"}, + "text": "This is the best TV you'll ever buy!", + "cats": {"pos": 1, "neg": 0}, + }, + { + "meta": {"id": "2"}, + "text": "I wouldn't buy this again.", + "cats": {"pos": 0, "neg": 1}, + }, + ] + file_path = f"{tmp_dir}/text.jsonl" + srsly.write_jsonl(file_path, data) + return file_path + + +def write_sample_training(tmp_dir): + words = ["The", "players", "start", "."] + tags = ["DT", "NN", "VBZ", "."] + doc = Doc(English().vocab, words=words, tags=tags) + doc_bin = DocBin() + doc_bin.add(doc) + train_path = f"{tmp_dir}/train.spacy" + dev_path = f"{tmp_dir}/dev.spacy" + doc_bin.to_disk(train_path) + doc_bin.to_disk(dev_path) + return train_path, dev_path + + +def write_vectors_model(tmp_dir): + import numpy + + vocab = Vocab() + vector_data = { + "dog": numpy.random.uniform(-1, 1, (300,)), + "cat": numpy.random.uniform(-1, 1, (300,)), + "orange": numpy.random.uniform(-1, 1, (300,)), + } + for word, vector in vector_data.items(): + vocab.set_vector(word, vector) + nlp_path = tmp_dir / "vectors_model" + nlp = English(vocab) + nlp.to_disk(nlp_path) + return str(nlp_path) + + +def test_pretrain_default_vectors(): + nlp = English() + nlp.add_pipe("tok2vec") + nlp.initialize() + + # default vectors are supported + nlp.vocab.vectors = Vectors(shape=(10, 10)) + create_pretrain_vectors(1, 1, "cosine")(nlp.vocab, nlp.get_pipe("tok2vec").model) + + # floret vectors are supported + nlp.vocab.vectors = Vectors( + data=get_current_ops().xp.zeros((10, 10)), mode="floret", hash_count=1 + ) + create_pretrain_vectors(1, 1, "cosine")(nlp.vocab, nlp.get_pipe("tok2vec").model) + + # error for no vectors + with pytest.raises(ValueError, match="E875"): + nlp.vocab.vectors = Vectors() + create_pretrain_vectors(1, 1, "cosine")( + nlp.vocab, nlp.get_pipe("tok2vec").model + ) diff --git a/TTS/Kokoro/.venv/Lib/site-packages/spacy/tests/training/test_readers.py b/TTS/Kokoro/.venv/Lib/site-packages/spacy/tests/training/test_readers.py new file mode 100644 index 0000000000000000000000000000000000000000..74eb73d86ffbfcee7e48e56bd7d038afb5d9d87e --- /dev/null +++ b/TTS/Kokoro/.venv/Lib/site-packages/spacy/tests/training/test_readers.py @@ -0,0 +1,122 @@ +from typing import Callable, Dict, Iterable + +import pytest +from thinc.api import Config, fix_random_seed + +from spacy import Language +from spacy.schemas import ConfigSchemaTraining +from spacy.training import Example +from spacy.util import load_model_from_config, registry, resolve_dot_names + + +def test_readers(): + config_string = """ + [training] + + [corpora] + @readers = "myreader.v1" + + [nlp] + lang = "en" + pipeline = ["tok2vec", "textcat"] + + [components] + + [components.tok2vec] + factory = "tok2vec" + + [components.textcat] + factory = "textcat" + """ + + @registry.readers("myreader.v1") + def myreader() -> Dict[str, Callable[[Language], Iterable[Example]]]: + annots = {"cats": {"POS": 1.0, "NEG": 0.0}} + + def reader(nlp: Language): + doc = nlp.make_doc(f"This is an example") + return [Example.from_dict(doc, annots)] + + return {"train": reader, "dev": reader, "extra": reader, "something": reader} + + config = Config().from_str(config_string) + nlp = load_model_from_config(config, auto_fill=True) + T = registry.resolve( + nlp.config.interpolate()["training"], schema=ConfigSchemaTraining + ) + dot_names = [T["train_corpus"], T["dev_corpus"]] + train_corpus, dev_corpus = resolve_dot_names(nlp.config, dot_names) + assert isinstance(train_corpus, Callable) + optimizer = T["optimizer"] + # simulate a training loop + nlp.initialize(lambda: train_corpus(nlp), sgd=optimizer) + for example in train_corpus(nlp): + nlp.update([example], sgd=optimizer) + scores = nlp.evaluate(list(dev_corpus(nlp))) + assert scores["cats_macro_auc"] == 0.0 + # ensure the pipeline runs + doc = nlp("Quick test") + assert doc.cats + corpora = {"corpora": nlp.config.interpolate()["corpora"]} + extra_corpus = registry.resolve(corpora)["corpora"]["extra"] + assert isinstance(extra_corpus, Callable) + + +@pytest.mark.slow +@pytest.mark.parametrize( + "reader,additional_config", + [ + ("ml_datasets.imdb_sentiment.v1", {"train_limit": 10, "dev_limit": 10}), + ("ml_datasets.dbpedia.v1", {"train_limit": 10, "dev_limit": 10}), + ("ml_datasets.cmu_movies.v1", {"limit": 10, "freq_cutoff": 200, "split": 0.8}), + ], +) +def test_cat_readers(reader, additional_config): + nlp_config_string = """ + [training] + seed = 0 + + [training.score_weights] + cats_macro_auc = 1.0 + + [corpora] + @readers = "PLACEHOLDER" + + [nlp] + lang = "en" + pipeline = ["tok2vec", "textcat_multilabel"] + + [components] + + [components.tok2vec] + factory = "tok2vec" + + [components.textcat_multilabel] + factory = "textcat_multilabel" + """ + config = Config().from_str(nlp_config_string) + fix_random_seed(config["training"]["seed"]) + config["corpora"]["@readers"] = reader + config["corpora"].update(additional_config) + nlp = load_model_from_config(config, auto_fill=True) + T = registry.resolve(nlp.config["training"], schema=ConfigSchemaTraining) + dot_names = [T["train_corpus"], T["dev_corpus"]] + train_corpus, dev_corpus = resolve_dot_names(nlp.config, dot_names) + optimizer = T["optimizer"] + # simulate a training loop + nlp.initialize(lambda: train_corpus(nlp), sgd=optimizer) + for example in train_corpus(nlp): + assert example.y.cats + # this shouldn't fail if each training example has at least one positive label + assert sorted(list(set(example.y.cats.values()))) == [0.0, 1.0] + nlp.update([example], sgd=optimizer) + # simulate performance benchmark on dev corpus + dev_examples = list(dev_corpus(nlp)) + for example in dev_examples: + # this shouldn't fail if each dev example has at least one positive label + assert sorted(list(set(example.y.cats.values()))) == [0.0, 1.0] + scores = nlp.evaluate(dev_examples) + assert scores["cats_score"] + # ensure the pipeline runs + doc = nlp("Quick test") + assert doc.cats diff --git a/TTS/Kokoro/.venv/Lib/site-packages/spacy/tests/training/test_rehearse.py b/TTS/Kokoro/.venv/Lib/site-packages/spacy/tests/training/test_rehearse.py new file mode 100644 index 0000000000000000000000000000000000000000..b94c71f3ed41192475bbbf857b6a4acb8c9af6be --- /dev/null +++ b/TTS/Kokoro/.venv/Lib/site-packages/spacy/tests/training/test_rehearse.py @@ -0,0 +1,211 @@ +from typing import List + +import pytest + +import spacy +from spacy.training import Example + +TRAIN_DATA = [ + ( + "Who is Kofi Annan?", + { + "entities": [(7, 18, "PERSON")], + "tags": ["PRON", "AUX", "PROPN", "PRON", "PUNCT"], + "heads": [1, 1, 3, 1, 1], + "deps": ["attr", "ROOT", "compound", "nsubj", "punct"], + "morphs": [ + "", + "Mood=Ind|Number=Sing|Person=3|Tense=Pres|VerbForm=Fin", + "Number=Sing", + "Number=Sing", + "PunctType=Peri", + ], + "cats": {"question": 1.0}, + }, + ), + ( + "Who is Steve Jobs?", + { + "entities": [(7, 17, "PERSON")], + "tags": ["PRON", "AUX", "PROPN", "PRON", "PUNCT"], + "heads": [1, 1, 3, 1, 1], + "deps": ["attr", "ROOT", "compound", "nsubj", "punct"], + "morphs": [ + "", + "Mood=Ind|Number=Sing|Person=3|Tense=Pres|VerbForm=Fin", + "Number=Sing", + "Number=Sing", + "PunctType=Peri", + ], + "cats": {"question": 1.0}, + }, + ), + ( + "Bob is a nice person.", + { + "entities": [(0, 3, "PERSON")], + "tags": ["PROPN", "AUX", "DET", "ADJ", "NOUN", "PUNCT"], + "heads": [1, 1, 4, 4, 1, 1], + "deps": ["nsubj", "ROOT", "det", "amod", "attr", "punct"], + "morphs": [ + "Number=Sing", + "Mood=Ind|Number=Sing|Person=3|Tense=Pres|VerbForm=Fin", + "Definite=Ind|PronType=Art", + "Degree=Pos", + "Number=Sing", + "PunctType=Peri", + ], + "cats": {"statement": 1.0}, + }, + ), + ( + "Hi Anil, how are you?", + { + "entities": [(3, 7, "PERSON")], + "tags": ["INTJ", "PROPN", "PUNCT", "ADV", "AUX", "PRON", "PUNCT"], + "deps": ["intj", "npadvmod", "punct", "advmod", "ROOT", "nsubj", "punct"], + "heads": [4, 0, 4, 4, 4, 4, 4], + "morphs": [ + "", + "Number=Sing", + "PunctType=Comm", + "", + "Mood=Ind|Tense=Pres|VerbForm=Fin", + "Case=Nom|Person=2|PronType=Prs", + "PunctType=Peri", + ], + "cats": {"greeting": 1.0, "question": 1.0}, + }, + ), + ( + "I like London and Berlin.", + { + "entities": [(7, 13, "LOC"), (18, 24, "LOC")], + "tags": ["PROPN", "VERB", "PROPN", "CCONJ", "PROPN", "PUNCT"], + "deps": ["nsubj", "ROOT", "dobj", "cc", "conj", "punct"], + "heads": [1, 1, 1, 2, 2, 1], + "morphs": [ + "Case=Nom|Number=Sing|Person=1|PronType=Prs", + "Tense=Pres|VerbForm=Fin", + "Number=Sing", + "ConjType=Cmp", + "Number=Sing", + "PunctType=Peri", + ], + "cats": {"statement": 1.0}, + }, + ), +] + +REHEARSE_DATA = [ + ( + "Hi Anil", + { + "entities": [(3, 7, "PERSON")], + "tags": ["INTJ", "PROPN"], + "deps": ["ROOT", "npadvmod"], + "heads": [0, 0], + "morphs": ["", "Number=Sing"], + "cats": {"greeting": 1.0}, + }, + ), + ( + "Hi Ravish, how you doing?", + { + "entities": [(3, 9, "PERSON")], + "tags": ["INTJ", "PROPN", "PUNCT", "ADV", "AUX", "PRON", "PUNCT"], + "deps": ["intj", "ROOT", "punct", "advmod", "nsubj", "advcl", "punct"], + "heads": [1, 1, 1, 5, 5, 1, 1], + "morphs": [ + "", + "VerbForm=Inf", + "PunctType=Comm", + "", + "Case=Nom|Person=2|PronType=Prs", + "Aspect=Prog|Tense=Pres|VerbForm=Part", + "PunctType=Peri", + ], + "cats": {"greeting": 1.0, "question": 1.0}, + }, + ), + # UTENSIL new label + ( + "Natasha bought new forks.", + { + "entities": [(0, 7, "PERSON"), (19, 24, "UTENSIL")], + "tags": ["PROPN", "VERB", "ADJ", "NOUN", "PUNCT"], + "deps": ["nsubj", "ROOT", "amod", "dobj", "punct"], + "heads": [1, 1, 3, 1, 1], + "morphs": [ + "Number=Sing", + "Tense=Past|VerbForm=Fin", + "Degree=Pos", + "Number=Plur", + "PunctType=Peri", + ], + "cats": {"statement": 1.0}, + }, + ), +] + + +def _add_ner_label(ner, data): + for _, annotations in data: + for ent in annotations["entities"]: + ner.add_label(ent[2]) + + +def _add_tagger_label(tagger, data): + for _, annotations in data: + for tag in annotations["tags"]: + tagger.add_label(tag) + + +def _add_parser_label(parser, data): + for _, annotations in data: + for dep in annotations["deps"]: + parser.add_label(dep) + + +def _add_textcat_label(textcat, data): + for _, annotations in data: + for cat in annotations["cats"]: + textcat.add_label(cat) + + +def _optimize(nlp, component: str, data: List, rehearse: bool): + """Run either train or rehearse.""" + pipe = nlp.get_pipe(component) + if component == "ner": + _add_ner_label(pipe, data) + elif component == "tagger": + _add_tagger_label(pipe, data) + elif component == "parser": + _add_parser_label(pipe, data) + elif component == "textcat_multilabel": + _add_textcat_label(pipe, data) + else: + raise NotImplementedError + + if rehearse: + optimizer = nlp.resume_training() + else: + optimizer = nlp.initialize() + + for _ in range(5): + for text, annotation in data: + doc = nlp.make_doc(text) + example = Example.from_dict(doc, annotation) + if rehearse: + nlp.rehearse([example], sgd=optimizer) + else: + nlp.update([example], sgd=optimizer) + return nlp + + +@pytest.mark.parametrize("component", ["ner", "tagger", "parser", "textcat_multilabel"]) +def test_rehearse(component): + nlp = spacy.blank("en") + nlp.add_pipe(component) + nlp = _optimize(nlp, component, TRAIN_DATA, False) + _optimize(nlp, component, REHEARSE_DATA, True) diff --git a/TTS/Kokoro/.venv/Lib/site-packages/spacy/tests/training/test_training.py b/TTS/Kokoro/.venv/Lib/site-packages/spacy/tests/training/test_training.py new file mode 100644 index 0000000000000000000000000000000000000000..3f01df6d4426a0c45016e12ef1de482c9e3f392c --- /dev/null +++ b/TTS/Kokoro/.venv/Lib/site-packages/spacy/tests/training/test_training.py @@ -0,0 +1,1164 @@ +import random + +import numpy +import pytest +import srsly +from thinc.api import Adam, compounding + +import spacy +from spacy.lang.en import English +from spacy.tokens import Doc, DocBin +from spacy.training import ( + Alignment, + Corpus, + Example, + biluo_tags_to_offsets, + biluo_tags_to_spans, + docs_to_json, + iob_to_biluo, + offsets_to_biluo_tags, +) +from spacy.training.align import get_alignments +from spacy.training.alignment_array import AlignmentArray +from spacy.training.converters import json_to_docs +from spacy.training.loop import train_while_improving +from spacy.util import ( + get_words_and_spaces, + load_config_from_str, + load_model_from_path, + minibatch, +) + +from ..util import make_tempdir + + +@pytest.fixture +def doc(): + nlp = English() # make sure we get a new vocab every time + # fmt: off + words = ["Sarah", "'s", "sister", "flew", "to", "Silicon", "Valley", "via", "London", "."] + tags = ["NNP", "POS", "NN", "VBD", "IN", "NNP", "NNP", "IN", "NNP", "."] + pos = ["PROPN", "PART", "NOUN", "VERB", "ADP", "PROPN", "PROPN", "ADP", "PROPN", "PUNCT"] + morphs = ["NounType=prop|Number=sing", "Poss=yes", "Number=sing", "Tense=past|VerbForm=fin", + "", "NounType=prop|Number=sing", "NounType=prop|Number=sing", "", + "NounType=prop|Number=sing", "PunctType=peri"] + # head of '.' is intentionally nonprojective for testing + heads = [2, 0, 3, 3, 3, 6, 4, 3, 7, 5] + deps = ["poss", "case", "nsubj", "ROOT", "prep", "compound", "pobj", "prep", "pobj", "punct"] + lemmas = ["Sarah", "'s", "sister", "fly", "to", "Silicon", "Valley", "via", "London", "."] + ents = ["O"] * len(words) + ents[0] = "B-PERSON" + ents[1] = "I-PERSON" + ents[5] = "B-LOC" + ents[6] = "I-LOC" + ents[8] = "B-GPE" + cats = {"TRAVEL": 1.0, "BAKING": 0.0} + # fmt: on + doc = Doc( + nlp.vocab, + words=words, + tags=tags, + pos=pos, + morphs=morphs, + heads=heads, + deps=deps, + lemmas=lemmas, + ents=ents, + ) + doc.cats = cats + return doc + + +@pytest.fixture() +def merged_dict(): + return { + "ids": [1, 2, 3, 4, 5, 6, 7], + "words": ["Hi", "there", "everyone", "It", "is", "just", "me"], + "spaces": [True, True, True, True, True, True, False], + "tags": ["INTJ", "ADV", "PRON", "PRON", "AUX", "ADV", "PRON"], + "sent_starts": [1, 0, 0, 1, 0, 0, 0], + } + + +@pytest.fixture +def vocab(): + nlp = English() + return nlp.vocab + + +@pytest.mark.issue(999) +def test_issue999(): + """Test that adding entities and resuming training works passably OK. + There are two issues here: + 1) We have to re-add labels. This isn't very nice. + 2) There's no way to set the learning rate for the weight update, so we + end up out-of-scale, causing it to learn too fast. + """ + TRAIN_DATA = [ + ["hey", []], + ["howdy", []], + ["hey there", []], + ["hello", []], + ["hi", []], + ["i'm looking for a place to eat", []], + ["i'm looking for a place in the north of town", [(31, 36, "LOCATION")]], + ["show me chinese restaurants", [(8, 15, "CUISINE")]], + ["show me chines restaurants", [(8, 14, "CUISINE")]], + ] + nlp = English() + ner = nlp.add_pipe("ner") + for _, offsets in TRAIN_DATA: + for start, end, label in offsets: + ner.add_label(label) + nlp.initialize() + for itn in range(20): + random.shuffle(TRAIN_DATA) + for raw_text, entity_offsets in TRAIN_DATA: + example = Example.from_dict( + nlp.make_doc(raw_text), {"entities": entity_offsets} + ) + nlp.update([example]) + + with make_tempdir() as model_dir: + nlp.to_disk(model_dir) + nlp2 = load_model_from_path(model_dir) + + for raw_text, entity_offsets in TRAIN_DATA: + doc = nlp2(raw_text) + ents = {(ent.start_char, ent.end_char): ent.label_ for ent in doc.ents} + for start, end, label in entity_offsets: + if (start, end) in ents: + assert ents[(start, end)] == label + break + else: + if entity_offsets: + raise Exception(ents) + + +@pytest.mark.issue(4402) +def test_issue4402(): + json_data = { + "id": 0, + "paragraphs": [ + { + "raw": "How should I cook bacon in an oven?\nI've heard of people cooking bacon in an oven.", + "sentences": [ + { + "tokens": [ + {"id": 0, "orth": "How", "ner": "O"}, + {"id": 1, "orth": "should", "ner": "O"}, + {"id": 2, "orth": "I", "ner": "O"}, + {"id": 3, "orth": "cook", "ner": "O"}, + {"id": 4, "orth": "bacon", "ner": "O"}, + {"id": 5, "orth": "in", "ner": "O"}, + {"id": 6, "orth": "an", "ner": "O"}, + {"id": 7, "orth": "oven", "ner": "O"}, + {"id": 8, "orth": "?", "ner": "O"}, + ], + "brackets": [], + }, + { + "tokens": [ + {"id": 9, "orth": "\n", "ner": "O"}, + {"id": 10, "orth": "I", "ner": "O"}, + {"id": 11, "orth": "'ve", "ner": "O"}, + {"id": 12, "orth": "heard", "ner": "O"}, + {"id": 13, "orth": "of", "ner": "O"}, + {"id": 14, "orth": "people", "ner": "O"}, + {"id": 15, "orth": "cooking", "ner": "O"}, + {"id": 16, "orth": "bacon", "ner": "O"}, + {"id": 17, "orth": "in", "ner": "O"}, + {"id": 18, "orth": "an", "ner": "O"}, + {"id": 19, "orth": "oven", "ner": "O"}, + {"id": 20, "orth": ".", "ner": "O"}, + ], + "brackets": [], + }, + ], + "cats": [ + {"label": "baking", "value": 1.0}, + {"label": "not_baking", "value": 0.0}, + ], + }, + { + "raw": "What is the difference between white and brown eggs?\n", + "sentences": [ + { + "tokens": [ + {"id": 0, "orth": "What", "ner": "O"}, + {"id": 1, "orth": "is", "ner": "O"}, + {"id": 2, "orth": "the", "ner": "O"}, + {"id": 3, "orth": "difference", "ner": "O"}, + {"id": 4, "orth": "between", "ner": "O"}, + {"id": 5, "orth": "white", "ner": "O"}, + {"id": 6, "orth": "and", "ner": "O"}, + {"id": 7, "orth": "brown", "ner": "O"}, + {"id": 8, "orth": "eggs", "ner": "O"}, + {"id": 9, "orth": "?", "ner": "O"}, + ], + "brackets": [], + }, + {"tokens": [{"id": 10, "orth": "\n", "ner": "O"}], "brackets": []}, + ], + "cats": [ + {"label": "baking", "value": 0.0}, + {"label": "not_baking", "value": 1.0}, + ], + }, + ], + } + nlp = English() + attrs = ["ORTH", "SENT_START", "ENT_IOB", "ENT_TYPE"] + with make_tempdir() as tmpdir: + output_file = tmpdir / "test4402.spacy" + docs = json_to_docs([json_data]) + data = DocBin(docs=docs, attrs=attrs).to_bytes() + with output_file.open("wb") as file_: + file_.write(data) + reader = Corpus(output_file) + train_data = list(reader(nlp)) + assert len(train_data) == 2 + + split_train_data = [] + for eg in train_data: + split_train_data.extend(eg.split_sents()) + assert len(split_train_data) == 4 + + +CONFIG_7029 = """ +[nlp] +lang = "en" +pipeline = ["tok2vec", "tagger"] + +[components] + +[components.tok2vec] +factory = "tok2vec" + +[components.tok2vec.model] +@architectures = "spacy.Tok2Vec.v1" + +[components.tok2vec.model.embed] +@architectures = "spacy.MultiHashEmbed.v1" +width = ${components.tok2vec.model.encode:width} +attrs = ["NORM","PREFIX","SUFFIX","SHAPE"] +rows = [5000,2500,2500,2500] +include_static_vectors = false + +[components.tok2vec.model.encode] +@architectures = "spacy.MaxoutWindowEncoder.v1" +width = 96 +depth = 4 +window_size = 1 +maxout_pieces = 3 + +[components.tagger] +factory = "tagger" + +[components.tagger.model] +@architectures = "spacy.Tagger.v2" +nO = null + +[components.tagger.model.tok2vec] +@architectures = "spacy.Tok2VecListener.v1" +width = ${components.tok2vec.model.encode:width} +upstream = "*" +""" + + +@pytest.mark.issue(7029) +def test_issue7029(): + """Test that an empty document doesn't mess up an entire batch.""" + TRAIN_DATA = [ + ("I like green eggs", {"tags": ["N", "V", "J", "N"]}), + ("Eat blue ham", {"tags": ["V", "J", "N"]}), + ] + nlp = English.from_config(load_config_from_str(CONFIG_7029)) + train_examples = [] + for t in TRAIN_DATA: + train_examples.append(Example.from_dict(nlp.make_doc(t[0]), t[1])) + optimizer = nlp.initialize(get_examples=lambda: train_examples) + for i in range(50): + losses = {} + nlp.update(train_examples, sgd=optimizer, losses=losses) + texts = ["first", "second", "third", "fourth", "and", "then", "some", ""] + docs1 = list(nlp.pipe(texts, batch_size=1)) + docs2 = list(nlp.pipe(texts, batch_size=4)) + assert [doc[0].tag_ for doc in docs1[:-1]] == [doc[0].tag_ for doc in docs2[:-1]] + + +def test_gold_biluo_U(en_vocab): + words = ["I", "flew", "to", "London", "."] + spaces = [True, True, True, False, True] + doc = Doc(en_vocab, words=words, spaces=spaces) + entities = [(len("I flew to "), len("I flew to London"), "LOC")] + tags = offsets_to_biluo_tags(doc, entities) + assert tags == ["O", "O", "O", "U-LOC", "O"] + + +def test_gold_biluo_BL(en_vocab): + words = ["I", "flew", "to", "San", "Francisco", "."] + spaces = [True, True, True, True, False, True] + doc = Doc(en_vocab, words=words, spaces=spaces) + entities = [(len("I flew to "), len("I flew to San Francisco"), "LOC")] + tags = offsets_to_biluo_tags(doc, entities) + assert tags == ["O", "O", "O", "B-LOC", "L-LOC", "O"] + + +def test_gold_biluo_BIL(en_vocab): + words = ["I", "flew", "to", "San", "Francisco", "Valley", "."] + spaces = [True, True, True, True, True, False, True] + doc = Doc(en_vocab, words=words, spaces=spaces) + entities = [(len("I flew to "), len("I flew to San Francisco Valley"), "LOC")] + tags = offsets_to_biluo_tags(doc, entities) + assert tags == ["O", "O", "O", "B-LOC", "I-LOC", "L-LOC", "O"] + + +def test_gold_biluo_overlap(en_vocab): + words = ["I", "flew", "to", "San", "Francisco", "Valley", "."] + spaces = [True, True, True, True, True, False, True] + doc = Doc(en_vocab, words=words, spaces=spaces) + entities = [ + (len("I flew to "), len("I flew to San Francisco Valley"), "LOC"), + (len("I flew to "), len("I flew to San Francisco"), "LOC"), + ] + with pytest.raises(ValueError): + offsets_to_biluo_tags(doc, entities) + + +def test_gold_biluo_misalign(en_vocab): + words = ["I", "flew", "to", "San", "Francisco", "Valley."] + spaces = [True, True, True, True, True, False] + doc = Doc(en_vocab, words=words, spaces=spaces) + entities = [(len("I flew to "), len("I flew to San Francisco Valley"), "LOC")] + with pytest.warns(UserWarning): + tags = offsets_to_biluo_tags(doc, entities) + assert tags == ["O", "O", "O", "-", "-", "-"] + + +def test_example_constructor(en_vocab): + words = ["I", "like", "stuff"] + tags = ["NOUN", "VERB", "NOUN"] + tag_ids = [en_vocab.strings.add(tag) for tag in tags] + predicted = Doc(en_vocab, words=words) + reference = Doc(en_vocab, words=words) + reference = reference.from_array("TAG", numpy.array(tag_ids, dtype="uint64")) + example = Example(predicted, reference) + tags = example.get_aligned("TAG", as_string=True) + assert tags == ["NOUN", "VERB", "NOUN"] + + +def test_example_from_dict_tags(en_vocab): + words = ["I", "like", "stuff"] + tags = ["NOUN", "VERB", "NOUN"] + predicted = Doc(en_vocab, words=words) + example = Example.from_dict(predicted, {"TAGS": tags}) + tags = example.get_aligned("TAG", as_string=True) + assert tags == ["NOUN", "VERB", "NOUN"] + + +def test_example_from_dict_no_ner(en_vocab): + words = ["a", "b", "c", "d"] + spaces = [True, True, False, True] + predicted = Doc(en_vocab, words=words, spaces=spaces) + example = Example.from_dict(predicted, {"words": words}) + ner_tags = example.get_aligned_ner() + assert ner_tags == [None, None, None, None] + + +def test_example_from_dict_some_ner(en_vocab): + words = ["a", "b", "c", "d"] + spaces = [True, True, False, True] + predicted = Doc(en_vocab, words=words, spaces=spaces) + example = Example.from_dict( + predicted, {"words": words, "entities": ["U-LOC", None, None, None]} + ) + ner_tags = example.get_aligned_ner() + assert ner_tags == ["U-LOC", None, None, None] + + +@pytest.mark.filterwarnings("ignore::UserWarning") +def test_json_to_docs_no_ner(en_vocab): + data = [ + { + "id": 1, + "paragraphs": [ + { + "sentences": [ + { + "tokens": [ + {"dep": "nn", "head": 1, "tag": "NNP", "orth": "Ms."}, + { + "dep": "nsubj", + "head": 1, + "tag": "NNP", + "orth": "Haag", + }, + { + "dep": "ROOT", + "head": 0, + "tag": "VBZ", + "orth": "plays", + }, + { + "dep": "dobj", + "head": -1, + "tag": "NNP", + "orth": "Elianti", + }, + {"dep": "punct", "head": -2, "tag": ".", "orth": "."}, + ] + } + ] + } + ], + } + ] + docs = list(json_to_docs(data)) + assert len(docs) == 1 + for doc in docs: + assert not doc.has_annotation("ENT_IOB") + for token in doc: + assert token.ent_iob == 0 + eg = Example( + Doc( + doc.vocab, + words=[w.text for w in doc], + spaces=[bool(w.whitespace_) for w in doc], + ), + doc, + ) + ner_tags = eg.get_aligned_ner() + assert ner_tags == [None, None, None, None, None] + + +def test_split_sentences(en_vocab): + # fmt: off + words = ["I", "flew", "to", "San Francisco Valley", "had", "loads of fun"] + gold_words = ["I", "flew", "to", "San", "Francisco", "Valley", "had", "loads", "of", "fun"] + sent_starts = [True, False, False, False, False, False, True, False, False, False] + # fmt: on + doc = Doc(en_vocab, words=words) + example = Example.from_dict(doc, {"words": gold_words, "sent_starts": sent_starts}) + assert example.text == "I flew to San Francisco Valley had loads of fun " + split_examples = example.split_sents() + assert len(split_examples) == 2 + assert split_examples[0].text == "I flew to San Francisco Valley " + assert split_examples[1].text == "had loads of fun " + # fmt: off + words = ["I", "flew", "to", "San", "Francisco", "Valley", "had", "loads", "of fun"] + gold_words = ["I", "flew", "to", "San Francisco", "Valley", "had", "loads of", "fun"] + sent_starts = [True, False, False, False, False, True, False, False] + # fmt: on + doc = Doc(en_vocab, words=words) + example = Example.from_dict(doc, {"words": gold_words, "sent_starts": sent_starts}) + assert example.text == "I flew to San Francisco Valley had loads of fun " + split_examples = example.split_sents() + assert len(split_examples) == 2 + assert split_examples[0].text == "I flew to San Francisco Valley " + assert split_examples[1].text == "had loads of fun " + + +def test_gold_biluo_one_to_many(en_vocab, en_tokenizer): + words = ["Mr and ", "Mrs Smith", "flew to", "San Francisco Valley", "."] + spaces = [True, True, True, False, False] + doc = Doc(en_vocab, words=words, spaces=spaces) + prefix = "Mr and Mrs Smith flew to " + entities = [(len(prefix), len(prefix + "San Francisco Valley"), "LOC")] + gold_words = ["Mr and Mrs Smith", "flew", "to", "San", "Francisco", "Valley", "."] + example = Example.from_dict(doc, {"words": gold_words, "entities": entities}) + ner_tags = example.get_aligned_ner() + assert ner_tags == ["O", "O", "O", "U-LOC", "O"] + + entities = [ + (len("Mr and "), len("Mr and Mrs Smith"), "PERSON"), # "Mrs Smith" is a PERSON + (len(prefix), len(prefix + "San Francisco Valley"), "LOC"), + ] + # fmt: off + gold_words = ["Mr and", "Mrs", "Smith", "flew", "to", "San", "Francisco", "Valley", "."] + # fmt: on + example = Example.from_dict(doc, {"words": gold_words, "entities": entities}) + ner_tags = example.get_aligned_ner() + assert ner_tags == ["O", "U-PERSON", "O", "U-LOC", "O"] + + entities = [ + (len("Mr and "), len("Mr and Mrs"), "PERSON"), # "Mrs" is a Person + (len(prefix), len(prefix + "San Francisco Valley"), "LOC"), + ] + # fmt: off + gold_words = ["Mr and", "Mrs", "Smith", "flew", "to", "San", "Francisco", "Valley", "."] + # fmt: on + example = Example.from_dict(doc, {"words": gold_words, "entities": entities}) + ner_tags = example.get_aligned_ner() + assert ner_tags == ["O", None, "O", "U-LOC", "O"] + + +def test_gold_biluo_many_to_one(en_vocab, en_tokenizer): + words = ["Mr and", "Mrs", "Smith", "flew", "to", "San", "Francisco", "Valley", "."] + spaces = [True, True, True, True, True, True, True, False, False] + doc = Doc(en_vocab, words=words, spaces=spaces) + prefix = "Mr and Mrs Smith flew to " + entities = [(len(prefix), len(prefix + "San Francisco Valley"), "LOC")] + gold_words = ["Mr and Mrs Smith", "flew to", "San Francisco Valley", "."] + example = Example.from_dict(doc, {"words": gold_words, "entities": entities}) + ner_tags = example.get_aligned_ner() + assert ner_tags == ["O", "O", "O", "O", "O", "B-LOC", "I-LOC", "L-LOC", "O"] + + entities = [ + (len("Mr and "), len("Mr and Mrs Smith"), "PERSON"), # "Mrs Smith" is a PERSON + (len(prefix), len(prefix + "San Francisco Valley"), "LOC"), + ] + gold_words = ["Mr and", "Mrs Smith", "flew to", "San Francisco Valley", "."] + example = Example.from_dict(doc, {"words": gold_words, "entities": entities}) + ner_tags = example.get_aligned_ner() + expected = ["O", "B-PERSON", "L-PERSON", "O", "O", "B-LOC", "I-LOC", "L-LOC", "O"] + assert ner_tags == expected + + +def test_gold_biluo_misaligned(en_vocab, en_tokenizer): + words = ["Mr and Mrs", "Smith", "flew", "to", "San Francisco", "Valley", "."] + spaces = [True, True, True, True, True, False, False] + doc = Doc(en_vocab, words=words, spaces=spaces) + prefix = "Mr and Mrs Smith flew to " + entities = [(len(prefix), len(prefix + "San Francisco Valley"), "LOC")] + gold_words = ["Mr", "and Mrs Smith", "flew to", "San", "Francisco Valley", "."] + example = Example.from_dict(doc, {"words": gold_words, "entities": entities}) + ner_tags = example.get_aligned_ner() + assert ner_tags == ["O", "O", "O", "O", "B-LOC", "L-LOC", "O"] + + entities = [ + (len("Mr and "), len("Mr and Mrs Smith"), "PERSON"), # "Mrs Smith" is a PERSON + (len(prefix), len(prefix + "San Francisco Valley"), "LOC"), + ] + gold_words = ["Mr and", "Mrs Smith", "flew to", "San", "Francisco Valley", "."] + example = Example.from_dict(doc, {"words": gold_words, "entities": entities}) + ner_tags = example.get_aligned_ner() + assert ner_tags == [None, None, "O", "O", "B-LOC", "L-LOC", "O"] + + +def test_gold_biluo_additional_whitespace(en_vocab, en_tokenizer): + # additional whitespace tokens in GoldParse words + words, spaces = get_words_and_spaces( + ["I", "flew", "to", "San Francisco", "Valley", "."], + "I flew to San Francisco Valley.", + ) + doc = Doc(en_vocab, words=words, spaces=spaces) + prefix = "I flew to " + entities = [(len(prefix), len(prefix + "San Francisco Valley"), "LOC")] + gold_words = ["I", "flew", " ", "to", "San Francisco Valley", "."] + gold_spaces = [True, True, False, True, False, False] + example = Example.from_dict( + doc, {"words": gold_words, "spaces": gold_spaces, "entities": entities} + ) + ner_tags = example.get_aligned_ner() + assert ner_tags == ["O", "O", "O", "O", "B-LOC", "L-LOC", "O"] + + +def test_gold_biluo_4791(en_vocab, en_tokenizer): + doc = en_tokenizer("I'll return the A54 amount") + gold_words = ["I", "'ll", "return", "the", "A", "54", "amount"] + gold_spaces = [False, True, True, True, False, True, False] + entities = [(16, 19, "MONEY")] + example = Example.from_dict( + doc, {"words": gold_words, "spaces": gold_spaces, "entities": entities} + ) + ner_tags = example.get_aligned_ner() + assert ner_tags == ["O", "O", "O", "O", "U-MONEY", "O"] + + doc = en_tokenizer("I'll return the $54 amount") + gold_words = ["I", "'ll", "return", "the", "$", "54", "amount"] + gold_spaces = [False, True, True, True, False, True, False] + entities = [(16, 19, "MONEY")] + example = Example.from_dict( + doc, {"words": gold_words, "spaces": gold_spaces, "entities": entities} + ) + ner_tags = example.get_aligned_ner() + assert ner_tags == ["O", "O", "O", "O", "B-MONEY", "L-MONEY", "O"] + + +def test_roundtrip_offsets_biluo_conversion(en_tokenizer): + text = "I flew to Silicon Valley via London." + biluo_tags = ["O", "O", "O", "B-LOC", "L-LOC", "O", "U-GPE", "O"] + offsets = [(10, 24, "LOC"), (29, 35, "GPE")] + doc = en_tokenizer(text) + biluo_tags_converted = offsets_to_biluo_tags(doc, offsets) + assert biluo_tags_converted == biluo_tags + offsets_converted = biluo_tags_to_offsets(doc, biluo_tags) + offsets_converted = [ent for ent in offsets if ent[2]] + assert offsets_converted == offsets + + +def test_biluo_spans(en_tokenizer): + doc = en_tokenizer("I flew to Silicon Valley via London.") + biluo_tags = ["O", "O", "O", "B-LOC", "L-LOC", "O", "U-GPE", "O"] + spans = biluo_tags_to_spans(doc, biluo_tags) + spans = [span for span in spans if span.label_] + assert len(spans) == 2 + assert spans[0].text == "Silicon Valley" + assert spans[0].label_ == "LOC" + assert spans[1].text == "London" + assert spans[1].label_ == "GPE" + + +def test_aligned_spans_y2x(en_vocab, en_tokenizer): + words = ["Mr and Mrs Smith", "flew", "to", "San Francisco Valley", "."] + spaces = [True, True, True, False, False] + doc = Doc(en_vocab, words=words, spaces=spaces) + prefix = "Mr and Mrs Smith flew to " + entities = [ + (0, len("Mr and Mrs Smith"), "PERSON"), + (len(prefix), len(prefix + "San Francisco Valley"), "LOC"), + ] + # fmt: off + tokens_ref = ["Mr", "and", "Mrs", "Smith", "flew", "to", "San", "Francisco", "Valley", "."] + # fmt: on + example = Example.from_dict(doc, {"words": tokens_ref, "entities": entities}) + ents_ref = example.reference.ents + assert [(ent.start, ent.end) for ent in ents_ref] == [(0, 4), (6, 9)] + ents_y2x = example.get_aligned_spans_y2x(ents_ref) + assert [(ent.start, ent.end) for ent in ents_y2x] == [(0, 1), (3, 4)] + + +def test_aligned_spans_x2y(en_vocab, en_tokenizer): + text = "Mr and Mrs Smith flew to San Francisco Valley" + nlp = English() + patterns = [ + {"label": "PERSON", "pattern": "Mr and Mrs Smith"}, + {"label": "LOC", "pattern": "San Francisco Valley"}, + ] + ruler = nlp.add_pipe("entity_ruler") + ruler.add_patterns(patterns) + doc = nlp(text) + assert [(ent.start, ent.end) for ent in doc.ents] == [(0, 4), (6, 9)] + prefix = "Mr and Mrs Smith flew to " + entities = [ + (0, len("Mr and Mrs Smith"), "PERSON"), + (len(prefix), len(prefix + "San Francisco Valley"), "LOC"), + ] + tokens_ref = ["Mr and Mrs", "Smith", "flew", "to", "San Francisco", "Valley"] + example = Example.from_dict(doc, {"words": tokens_ref, "entities": entities}) + assert [(ent.start, ent.end) for ent in example.reference.ents] == [(0, 2), (4, 6)] + # Ensure that 'get_aligned_spans_x2y' has the aligned entities correct + ents_pred = example.predicted.ents + assert [(ent.start, ent.end) for ent in ents_pred] == [(0, 4), (6, 9)] + ents_x2y = example.get_aligned_spans_x2y(ents_pred) + assert [(ent.start, ent.end) for ent in ents_x2y] == [(0, 2), (4, 6)] + + +def test_aligned_spans_y2x_overlap(en_vocab, en_tokenizer): + text = "I flew to San Francisco Valley" + nlp = English() + doc = nlp(text) + # the reference doc has overlapping spans + gold_doc = nlp.make_doc(text) + spans = [] + prefix = "I flew to " + spans.append( + gold_doc.char_span(len(prefix), len(prefix + "San Francisco"), label="CITY") + ) + spans.append( + gold_doc.char_span( + len(prefix), len(prefix + "San Francisco Valley"), label="VALLEY" + ) + ) + spans_key = "overlap_ents" + gold_doc.spans[spans_key] = spans + example = Example(doc, gold_doc) + spans_gold = example.reference.spans[spans_key] + assert [(ent.start, ent.end) for ent in spans_gold] == [(3, 5), (3, 6)] + + # Ensure that 'get_aligned_spans_y2x' has the aligned entities correct + spans_y2x_no_overlap = example.get_aligned_spans_y2x( + spans_gold, allow_overlap=False + ) + assert [(ent.start, ent.end) for ent in spans_y2x_no_overlap] == [(3, 5)] + spans_y2x_overlap = example.get_aligned_spans_y2x(spans_gold, allow_overlap=True) + assert [(ent.start, ent.end) for ent in spans_y2x_overlap] == [(3, 5), (3, 6)] + + +def test_gold_ner_missing_tags(en_tokenizer): + doc = en_tokenizer("I flew to Silicon Valley via London.") + biluo_tags = [None, "O", "O", "B-LOC", "L-LOC", "O", "U-GPE", "O"] + example = Example.from_dict(doc, {"entities": biluo_tags}) + assert example.get_aligned("ENT_IOB") == [0, 2, 2, 3, 1, 2, 3, 2] + + +def test_projectivize(en_tokenizer): + doc = en_tokenizer("He pretty quickly walks away") + heads = [3, 2, 3, 3, 2] + deps = ["dep"] * len(heads) + example = Example.from_dict(doc, {"heads": heads, "deps": deps}) + proj_heads, proj_labels = example.get_aligned_parse(projectivize=True) + nonproj_heads, nonproj_labels = example.get_aligned_parse(projectivize=False) + assert proj_heads == [3, 2, 3, 3, 3] + assert nonproj_heads == [3, 2, 3, 3, 2] + + # Test single token documents + doc = en_tokenizer("Conrail") + heads = [0] + deps = ["dep"] + example = Example.from_dict(doc, {"heads": heads, "deps": deps}) + proj_heads, proj_labels = example.get_aligned_parse(projectivize=True) + assert proj_heads == heads + assert proj_labels == deps + + # Test documents with no alignments + doc_a = Doc( + doc.vocab, words=["Double-Jointed"], spaces=[False], deps=["ROOT"], heads=[0] + ) + doc_b = Doc( + doc.vocab, + words=["Double", "-", "Jointed"], + spaces=[True, True, True], + deps=["amod", "punct", "ROOT"], + heads=[2, 2, 2], + ) + example = Example(doc_a, doc_b) + proj_heads, proj_deps = example.get_aligned_parse(projectivize=True) + assert proj_heads == [None] + assert proj_deps == [None] + + +def test_iob_to_biluo(): + good_iob = ["O", "O", "B-LOC", "I-LOC", "O", "B-PERSON"] + good_biluo = ["O", "O", "B-LOC", "L-LOC", "O", "U-PERSON"] + bad_iob = ["O", "O", '"', "B-LOC", "I-LOC"] + converted_biluo = iob_to_biluo(good_iob) + assert good_biluo == converted_biluo + with pytest.raises(ValueError): + iob_to_biluo(bad_iob) + + +def test_roundtrip_docs_to_docbin(doc): + text = doc.text + idx = [t.idx for t in doc] + tags = [t.tag_ for t in doc] + pos = [t.pos_ for t in doc] + morphs = [str(t.morph) for t in doc] + lemmas = [t.lemma_ for t in doc] + deps = [t.dep_ for t in doc] + heads = [t.head.i for t in doc] + cats = doc.cats + ents = [(e.start_char, e.end_char, e.label_) for e in doc.ents] + # roundtrip to DocBin + with make_tempdir() as tmpdir: + # use a separate vocab to test that all labels are added + reloaded_nlp = English() + json_file = tmpdir / "roundtrip.json" + srsly.write_json(json_file, [docs_to_json(doc)]) + output_file = tmpdir / "roundtrip.spacy" + DocBin(docs=[doc]).to_disk(output_file) + reader = Corpus(output_file) + reloaded_examples = list(reader(reloaded_nlp)) + assert len(doc) == sum(len(eg) for eg in reloaded_examples) + reloaded_example = reloaded_examples[0] + assert text == reloaded_example.reference.text + assert idx == [t.idx for t in reloaded_example.reference] + assert tags == [t.tag_ for t in reloaded_example.reference] + assert pos == [t.pos_ for t in reloaded_example.reference] + assert morphs == [str(t.morph) for t in reloaded_example.reference] + assert lemmas == [t.lemma_ for t in reloaded_example.reference] + assert deps == [t.dep_ for t in reloaded_example.reference] + assert heads == [t.head.i for t in reloaded_example.reference] + assert ents == [ + (e.start_char, e.end_char, e.label_) for e in reloaded_example.reference.ents + ] + assert "TRAVEL" in reloaded_example.reference.cats + assert "BAKING" in reloaded_example.reference.cats + assert cats["TRAVEL"] == reloaded_example.reference.cats["TRAVEL"] + assert cats["BAKING"] == reloaded_example.reference.cats["BAKING"] + + +def test_docbin_user_data_serialized(doc): + doc.user_data["check"] = True + nlp = English() + + with make_tempdir() as tmpdir: + output_file = tmpdir / "userdata.spacy" + DocBin(docs=[doc], store_user_data=True).to_disk(output_file) + reloaded_docs = DocBin().from_disk(output_file).get_docs(nlp.vocab) + reloaded_doc = list(reloaded_docs)[0] + + assert reloaded_doc.user_data["check"] == True + + +def test_docbin_user_data_not_serialized(doc): + # this isn't serializable, but that shouldn't cause an error + doc.user_data["check"] = set() + nlp = English() + + with make_tempdir() as tmpdir: + output_file = tmpdir / "userdata.spacy" + DocBin(docs=[doc], store_user_data=False).to_disk(output_file) + reloaded_docs = DocBin().from_disk(output_file).get_docs(nlp.vocab) + reloaded_doc = list(reloaded_docs)[0] + + assert "check" not in reloaded_doc.user_data + + +@pytest.mark.parametrize( + "tokens_a,tokens_b,expected", + [ + (["a", "b", "c"], ["ab", "c"], ([[0], [0], [1]], [[0, 1], [2]])), + ( + ["a", "b", '"', "c"], + ['ab"', "c"], + ([[0], [0], [0], [1]], [[0, 1, 2], [3]]), + ), + (["a", "bc"], ["ab", "c"], ([[0], [0, 1]], [[0, 1], [1]])), + ( + ["ab", "c", "d"], + ["a", "b", "cd"], + ([[0, 1], [2], [2]], [[0], [0], [1, 2]]), + ), + ( + ["a", "b", "cd"], + ["a", "b", "c", "d"], + ([[0], [1], [2, 3]], [[0], [1], [2], [2]]), + ), + ([" ", "a"], ["a"], ([[], [0]], [[1]])), + ( + ["a", "''", "'", ","], + ["a'", "''", ","], + ([[0], [0, 1], [1], [2]], [[0, 1], [1, 2], [3]]), + ), + ], +) +def test_align(tokens_a, tokens_b, expected): # noqa + a2b, b2a = get_alignments(tokens_a, tokens_b) + assert (a2b, b2a) == expected # noqa + # check symmetry + a2b, b2a = get_alignments(tokens_b, tokens_a) # noqa + assert (b2a, a2b) == expected # noqa + + +def test_goldparse_startswith_space(en_tokenizer): + text = " a" + doc = en_tokenizer(text) + gold_words = ["a"] + entities = ["U-DATE"] + deps = ["ROOT"] + heads = [0] + example = Example.from_dict( + doc, {"words": gold_words, "entities": entities, "deps": deps, "heads": heads} + ) + ner_tags = example.get_aligned_ner() + assert ner_tags == ["O", "U-DATE"] + assert example.get_aligned("DEP", as_string=True) == [None, "ROOT"] + + +def test_goldparse_endswith_space(en_tokenizer): + text = "a\n" + doc = en_tokenizer(text) + gold_words = ["a"] + entities = ["U-DATE"] + deps = ["ROOT"] + heads = [0] + example = Example.from_dict( + doc, {"words": gold_words, "entities": entities, "deps": deps, "heads": heads} + ) + ner_tags = example.get_aligned_ner() + assert ner_tags == ["U-DATE", "O"] + assert example.get_aligned("DEP", as_string=True) == ["ROOT", None] + + +def test_gold_constructor(): + """Test that the Example constructor works fine""" + nlp = English() + doc = nlp("This is a sentence") + example = Example.from_dict(doc, {"cats": {"cat1": 1.0, "cat2": 0.0}}) + assert example.get_aligned("ORTH", as_string=True) == [ + "This", + "is", + "a", + "sentence", + ] + assert example.reference.cats["cat1"] + assert not example.reference.cats["cat2"] + + +def test_tuple_format_implicit(): + """Test tuple format""" + + train_data = [ + ("Uber blew through $1 million a week", {"entities": [(0, 4, "ORG")]}), + ( + "Spotify steps up Asia expansion", + {"entities": [(0, 7, "ORG"), (17, 21, "LOC")]}, + ), + ("Google rebrands its business apps", {"entities": [(0, 6, "ORG")]}), + ] + + _train_tuples(train_data) + + +def test_tuple_format_implicit_invalid(): + """Test that an error is thrown for an implicit invalid field""" + train_data = [ + ("Uber blew through $1 million a week", {"frumble": [(0, 4, "ORG")]}), + ( + "Spotify steps up Asia expansion", + {"entities": [(0, 7, "ORG"), (17, 21, "LOC")]}, + ), + ("Google rebrands its business apps", {"entities": [(0, 6, "ORG")]}), + ] + with pytest.raises(KeyError): + _train_tuples(train_data) + + +def _train_tuples(train_data): + nlp = English() + ner = nlp.add_pipe("ner") + ner.add_label("ORG") + ner.add_label("LOC") + train_examples = [] + for t in train_data: + train_examples.append(Example.from_dict(nlp.make_doc(t[0]), t[1])) + optimizer = nlp.initialize() + for i in range(5): + losses = {} + batches = minibatch(train_examples, size=compounding(4.0, 32.0, 1.001)) + for batch in batches: + nlp.update(batch, sgd=optimizer, losses=losses) + + +def test_split_sents(merged_dict): + nlp = English() + example = Example.from_dict( + Doc(nlp.vocab, words=merged_dict["words"], spaces=merged_dict["spaces"]), + merged_dict, + ) + assert example.text == "Hi there everyone It is just me" + split_examples = example.split_sents() + assert len(split_examples) == 2 + assert split_examples[0].text == "Hi there everyone " + assert split_examples[1].text == "It is just me" + token_annotation_1 = split_examples[0].to_dict()["token_annotation"] + assert token_annotation_1["ORTH"] == ["Hi", "there", "everyone"] + assert token_annotation_1["TAG"] == ["INTJ", "ADV", "PRON"] + assert token_annotation_1["SENT_START"] == [1, 0, 0] + token_annotation_2 = split_examples[1].to_dict()["token_annotation"] + assert token_annotation_2["ORTH"] == ["It", "is", "just", "me"] + assert token_annotation_2["TAG"] == ["PRON", "AUX", "ADV", "PRON"] + assert token_annotation_2["SENT_START"] == [1, 0, 0, 0] + + +def test_alignment(): + other_tokens = ["i", "listened", "to", "obama", "'", "s", "podcasts", "."] + spacy_tokens = ["i", "listened", "to", "obama", "'s", "podcasts", "."] + align = Alignment.from_strings(other_tokens, spacy_tokens) + assert list(align.x2y.lengths) == [1, 1, 1, 1, 1, 1, 1, 1] + assert list(align.x2y.data) == [0, 1, 2, 3, 4, 4, 5, 6] + assert list(align.y2x.lengths) == [1, 1, 1, 1, 2, 1, 1] + assert list(align.y2x.data) == [0, 1, 2, 3, 4, 5, 6, 7] + + +def test_alignment_array(): + a = AlignmentArray([[0, 1, 2], [3], [], [4, 5, 6, 7], [8, 9]]) + assert list(a.data) == [0, 1, 2, 3, 4, 5, 6, 7, 8, 9] + assert list(a.lengths) == [3, 1, 0, 4, 2] + assert list(a[3]) == [4, 5, 6, 7] + assert list(a[2]) == [] + assert list(a[-2]) == [4, 5, 6, 7] + assert list(a[1:4]) == [3, 4, 5, 6, 7] + assert list(a[1:]) == [3, 4, 5, 6, 7, 8, 9] + assert list(a[:3]) == [0, 1, 2, 3] + assert list(a[:]) == list(a.data) + assert list(a[0:0]) == [] + assert list(a[3:3]) == [] + assert list(a[-1:-1]) == [] + with pytest.raises(ValueError, match=r"only supports slicing with a step of 1"): + a[:4:-1] + with pytest.raises( + ValueError, match=r"only supports indexing using an int or a slice" + ): + a[[0, 1, 3]] + + a = AlignmentArray([[], [1, 2, 3], [4, 5]]) + assert list(a[0]) == [] + assert list(a[0:1]) == [] + assert list(a[2]) == [4, 5] + assert list(a[0:2]) == [1, 2, 3] + + a = AlignmentArray([[1, 2, 3], [4, 5], []]) + assert list(a[-1]) == [] + assert list(a[-2:]) == [4, 5] + + +def test_alignment_case_insensitive(): + other_tokens = ["I", "listened", "to", "obama", "'", "s", "podcasts", "."] + spacy_tokens = ["i", "listened", "to", "Obama", "'s", "PODCASTS", "."] + align = Alignment.from_strings(other_tokens, spacy_tokens) + assert list(align.x2y.lengths) == [1, 1, 1, 1, 1, 1, 1, 1] + assert list(align.x2y.data) == [0, 1, 2, 3, 4, 4, 5, 6] + assert list(align.y2x.lengths) == [1, 1, 1, 1, 2, 1, 1] + assert list(align.y2x.data) == [0, 1, 2, 3, 4, 5, 6, 7] + + +def test_alignment_complex(): + other_tokens = ["i listened to", "obama", "'", "s", "podcasts", "."] + spacy_tokens = ["i", "listened", "to", "obama", "'s", "podcasts."] + align = Alignment.from_strings(other_tokens, spacy_tokens) + assert list(align.x2y.lengths) == [3, 1, 1, 1, 1, 1] + assert list(align.x2y.data) == [0, 1, 2, 3, 4, 4, 5, 5] + assert list(align.y2x.lengths) == [1, 1, 1, 1, 2, 2] + assert list(align.y2x.data) == [0, 0, 0, 1, 2, 3, 4, 5] + + +def test_alignment_complex_example(en_vocab): + other_tokens = ["i listened to", "obama", "'", "s", "podcasts", "."] + spacy_tokens = ["i", "listened", "to", "obama", "'s", "podcasts."] + predicted = Doc( + en_vocab, words=other_tokens, spaces=[True, False, False, True, False, False] + ) + reference = Doc( + en_vocab, words=spacy_tokens, spaces=[True, True, True, False, True, False] + ) + assert predicted.text == "i listened to obama's podcasts." + assert reference.text == "i listened to obama's podcasts." + example = Example(predicted, reference) + align = example.alignment + assert list(align.x2y.lengths) == [3, 1, 1, 1, 1, 1] + assert list(align.x2y.data) == [0, 1, 2, 3, 4, 4, 5, 5] + assert list(align.y2x.lengths) == [1, 1, 1, 1, 2, 2] + assert list(align.y2x.data) == [0, 0, 0, 1, 2, 3, 4, 5] + + +def test_alignment_different_texts(): + other_tokens = ["she", "listened", "to", "obama", "'s", "podcasts", "."] + spacy_tokens = ["i", "listened", "to", "obama", "'s", "podcasts", "."] + with pytest.raises(ValueError): + Alignment.from_strings(other_tokens, spacy_tokens) + + +def test_alignment_spaces(en_vocab): + # single leading whitespace + other_tokens = [" ", "i listened to", "obama", "'", "s", "podcasts", "."] + spacy_tokens = ["i", "listened", "to", "obama", "'s", "podcasts."] + align = Alignment.from_strings(other_tokens, spacy_tokens) + assert list(align.x2y.lengths) == [0, 3, 1, 1, 1, 1, 1] + assert list(align.x2y.data) == [0, 1, 2, 3, 4, 4, 5, 5] + assert list(align.y2x.lengths) == [1, 1, 1, 1, 2, 2] + assert list(align.y2x.data) == [1, 1, 1, 2, 3, 4, 5, 6] + + # multiple leading whitespace tokens + other_tokens = [" ", " ", "i listened to", "obama", "'", "s", "podcasts", "."] + spacy_tokens = ["i", "listened", "to", "obama", "'s", "podcasts."] + align = Alignment.from_strings(other_tokens, spacy_tokens) + assert list(align.x2y.lengths) == [0, 0, 3, 1, 1, 1, 1, 1] + assert list(align.x2y.data) == [0, 1, 2, 3, 4, 4, 5, 5] + assert list(align.y2x.lengths) == [1, 1, 1, 1, 2, 2] + assert list(align.y2x.data) == [2, 2, 2, 3, 4, 5, 6, 7] + + # both with leading whitespace, not identical + other_tokens = [" ", " ", "i listened to", "obama", "'", "s", "podcasts", "."] + spacy_tokens = [" ", "i", "listened", "to", "obama", "'s", "podcasts."] + align = Alignment.from_strings(other_tokens, spacy_tokens) + assert list(align.x2y.lengths) == [1, 0, 3, 1, 1, 1, 1, 1] + assert list(align.x2y.data) == [0, 1, 2, 3, 4, 5, 5, 6, 6] + assert list(align.y2x.lengths) == [1, 1, 1, 1, 1, 2, 2] + assert list(align.y2x.data) == [0, 2, 2, 2, 3, 4, 5, 6, 7] + + # same leading whitespace, different tokenization + other_tokens = [" ", " ", "i listened to", "obama", "'", "s", "podcasts", "."] + spacy_tokens = [" ", "i", "listened", "to", "obama", "'s", "podcasts."] + align = Alignment.from_strings(other_tokens, spacy_tokens) + assert list(align.x2y.lengths) == [1, 1, 3, 1, 1, 1, 1, 1] + assert list(align.x2y.data) == [0, 0, 1, 2, 3, 4, 5, 5, 6, 6] + assert list(align.y2x.lengths) == [2, 1, 1, 1, 1, 2, 2] + assert list(align.y2x.data) == [0, 1, 2, 2, 2, 3, 4, 5, 6, 7] + + # only one with trailing whitespace + other_tokens = ["i listened to", "obama", "'", "s", "podcasts", ".", " "] + spacy_tokens = ["i", "listened", "to", "obama", "'s", "podcasts."] + align = Alignment.from_strings(other_tokens, spacy_tokens) + assert list(align.x2y.lengths) == [3, 1, 1, 1, 1, 1, 0] + assert list(align.x2y.data) == [0, 1, 2, 3, 4, 4, 5, 5] + assert list(align.y2x.lengths) == [1, 1, 1, 1, 2, 2] + assert list(align.y2x.data) == [0, 0, 0, 1, 2, 3, 4, 5] + + # different trailing whitespace + other_tokens = ["i listened to", "obama", "'", "s", "podcasts", ".", " ", " "] + spacy_tokens = ["i", "listened", "to", "obama", "'s", "podcasts.", " "] + align = Alignment.from_strings(other_tokens, spacy_tokens) + assert list(align.x2y.lengths) == [3, 1, 1, 1, 1, 1, 1, 0] + assert list(align.x2y.data) == [0, 1, 2, 3, 4, 4, 5, 5, 6] + assert list(align.y2x.lengths) == [1, 1, 1, 1, 2, 2, 1] + assert list(align.y2x.data) == [0, 0, 0, 1, 2, 3, 4, 5, 6] + + # same trailing whitespace, different tokenization + other_tokens = ["i listened to", "obama", "'", "s", "podcasts", ".", " ", " "] + spacy_tokens = ["i", "listened", "to", "obama", "'s", "podcasts.", " "] + align = Alignment.from_strings(other_tokens, spacy_tokens) + assert list(align.x2y.lengths) == [3, 1, 1, 1, 1, 1, 1, 1] + assert list(align.x2y.data) == [0, 1, 2, 3, 4, 4, 5, 5, 6, 6] + assert list(align.y2x.lengths) == [1, 1, 1, 1, 2, 2, 2] + assert list(align.y2x.data) == [0, 0, 0, 1, 2, 3, 4, 5, 6, 7] + + # differing whitespace is allowed + other_tokens = ["a", " \n ", "b", "c"] + spacy_tokens = ["a", "b", " ", "c"] + align = Alignment.from_strings(other_tokens, spacy_tokens) + assert list(align.x2y.data) == [0, 1, 3] + assert list(align.y2x.data) == [0, 2, 3] + + # other differences in whitespace are allowed + other_tokens = [" ", "a"] + spacy_tokens = [" ", "a", " "] + align = Alignment.from_strings(other_tokens, spacy_tokens) + + other_tokens = ["a", " "] + spacy_tokens = ["a", " "] + align = Alignment.from_strings(other_tokens, spacy_tokens) + + +def test_retokenized_docs(doc): + a = doc.to_array(["TAG"]) + doc1 = Doc(doc.vocab, words=[t.text for t in doc]).from_array(["TAG"], a) + doc2 = Doc(doc.vocab, words=[t.text for t in doc]).from_array(["TAG"], a) + example = Example(doc1, doc2) + # fmt: off + expected1 = ["Sarah", "'s", "sister", "flew", "to", "Silicon", "Valley", "via", "London", "."] + expected2 = [None, "sister", "flew", "to", None, "via", "London", "."] + # fmt: on + assert example.get_aligned("ORTH", as_string=True) == expected1 + with doc1.retokenize() as retokenizer: + retokenizer.merge(doc1[0:2]) + retokenizer.merge(doc1[5:7]) + assert example.get_aligned("ORTH", as_string=True) == expected2 + + +def test_training_before_update(doc): + def before_update(nlp, args): + assert args["step"] == 0 + assert args["epoch"] == 1 + + # Raise an error here as the rest of the loop + # will not run to completion due to uninitialized + # models. + raise ValueError("ran_before_update") + + def generate_batch(): + yield 1, [Example(doc, doc)] + + nlp = spacy.blank("en") + nlp.add_pipe("tagger") + optimizer = Adam() + generator = train_while_improving( + nlp, + optimizer, + generate_batch(), + lambda: None, + dropout=0.1, + eval_frequency=100, + accumulate_gradient=10, + patience=10, + max_steps=100, + exclude=[], + annotating_components=[], + before_update=before_update, + ) + + with pytest.raises(ValueError, match="ran_before_update"): + for _ in generator: + pass diff --git a/TTS/Kokoro/.venv/Lib/site-packages/spacy/tests/vocab_vectors/__init__.py b/TTS/Kokoro/.venv/Lib/site-packages/spacy/tests/vocab_vectors/__init__.py new file mode 100644 index 0000000000000000000000000000000000000000..e69de29bb2d1d6434b8b29ae775ad8c2e48c5391 diff --git a/TTS/Kokoro/.venv/Lib/site-packages/spacy/tests/vocab_vectors/__pycache__/__init__.cpython-312.pyc b/TTS/Kokoro/.venv/Lib/site-packages/spacy/tests/vocab_vectors/__pycache__/__init__.cpython-312.pyc new file mode 100644 index 0000000000000000000000000000000000000000..11fb06994532bd9a762d13661eebc61978737134 Binary files /dev/null and b/TTS/Kokoro/.venv/Lib/site-packages/spacy/tests/vocab_vectors/__pycache__/__init__.cpython-312.pyc differ diff --git a/TTS/Kokoro/.venv/Lib/site-packages/spacy/tests/vocab_vectors/__pycache__/test_lexeme.cpython-312.pyc b/TTS/Kokoro/.venv/Lib/site-packages/spacy/tests/vocab_vectors/__pycache__/test_lexeme.cpython-312.pyc new file mode 100644 index 0000000000000000000000000000000000000000..fede3fb7497dd679f7ed8dd9b7b7d783db20575a Binary files /dev/null and b/TTS/Kokoro/.venv/Lib/site-packages/spacy/tests/vocab_vectors/__pycache__/test_lexeme.cpython-312.pyc differ diff --git a/TTS/Kokoro/.venv/Lib/site-packages/spacy/tests/vocab_vectors/__pycache__/test_lookups.cpython-312.pyc b/TTS/Kokoro/.venv/Lib/site-packages/spacy/tests/vocab_vectors/__pycache__/test_lookups.cpython-312.pyc new file mode 100644 index 0000000000000000000000000000000000000000..9cb256435841f866f8344da6795e1ff88baedf7b Binary files /dev/null and b/TTS/Kokoro/.venv/Lib/site-packages/spacy/tests/vocab_vectors/__pycache__/test_lookups.cpython-312.pyc differ diff --git a/TTS/Kokoro/.venv/Lib/site-packages/spacy/tests/vocab_vectors/__pycache__/test_memory_zone.cpython-312.pyc b/TTS/Kokoro/.venv/Lib/site-packages/spacy/tests/vocab_vectors/__pycache__/test_memory_zone.cpython-312.pyc new file mode 100644 index 0000000000000000000000000000000000000000..a8698937beeedafd4c9d1b30acdb0d0f824d6764 Binary files /dev/null and b/TTS/Kokoro/.venv/Lib/site-packages/spacy/tests/vocab_vectors/__pycache__/test_memory_zone.cpython-312.pyc differ diff --git a/TTS/Kokoro/.venv/Lib/site-packages/spacy/tests/vocab_vectors/__pycache__/test_similarity.cpython-312.pyc b/TTS/Kokoro/.venv/Lib/site-packages/spacy/tests/vocab_vectors/__pycache__/test_similarity.cpython-312.pyc new file mode 100644 index 0000000000000000000000000000000000000000..1010d4d64f7288fbc3775ab0cea70d313a058a9a Binary files /dev/null and b/TTS/Kokoro/.venv/Lib/site-packages/spacy/tests/vocab_vectors/__pycache__/test_similarity.cpython-312.pyc differ diff --git a/TTS/Kokoro/.venv/Lib/site-packages/spacy/tests/vocab_vectors/__pycache__/test_stringstore.cpython-312.pyc b/TTS/Kokoro/.venv/Lib/site-packages/spacy/tests/vocab_vectors/__pycache__/test_stringstore.cpython-312.pyc new file mode 100644 index 0000000000000000000000000000000000000000..ae9e2faef7c93308c7f2edf38432ba661142435c Binary files /dev/null and b/TTS/Kokoro/.venv/Lib/site-packages/spacy/tests/vocab_vectors/__pycache__/test_stringstore.cpython-312.pyc differ diff --git a/TTS/Kokoro/.venv/Lib/site-packages/spacy/tests/vocab_vectors/__pycache__/test_vectors.cpython-312.pyc b/TTS/Kokoro/.venv/Lib/site-packages/spacy/tests/vocab_vectors/__pycache__/test_vectors.cpython-312.pyc new file mode 100644 index 0000000000000000000000000000000000000000..11173e8bf2dc715ac51bd0e6550e924b887d9b4e Binary files /dev/null and b/TTS/Kokoro/.venv/Lib/site-packages/spacy/tests/vocab_vectors/__pycache__/test_vectors.cpython-312.pyc differ diff --git a/TTS/Kokoro/.venv/Lib/site-packages/spacy/tests/vocab_vectors/__pycache__/test_vocab_api.cpython-312.pyc b/TTS/Kokoro/.venv/Lib/site-packages/spacy/tests/vocab_vectors/__pycache__/test_vocab_api.cpython-312.pyc new file mode 100644 index 0000000000000000000000000000000000000000..a319e1b8ba7861bdc273acf2bc108cef958a67a2 Binary files /dev/null and b/TTS/Kokoro/.venv/Lib/site-packages/spacy/tests/vocab_vectors/__pycache__/test_vocab_api.cpython-312.pyc differ diff --git a/TTS/Kokoro/.venv/Lib/site-packages/spacy/tests/vocab_vectors/test_lexeme.py b/TTS/Kokoro/.venv/Lib/site-packages/spacy/tests/vocab_vectors/test_lexeme.py new file mode 100644 index 0000000000000000000000000000000000000000..169f6c171e29993c7edae862853b8a42cd2773c3 --- /dev/null +++ b/TTS/Kokoro/.venv/Lib/site-packages/spacy/tests/vocab_vectors/test_lexeme.py @@ -0,0 +1,84 @@ +import numpy +import pytest + +from spacy.attrs import IS_ALPHA, IS_DIGIT +from spacy.lookups import Lookups +from spacy.tokens import Doc +from spacy.util import OOV_RANK +from spacy.vocab import Vocab + + +@pytest.mark.issue(361) +@pytest.mark.parametrize("text1,text2", [("cat", "dog")]) +def test_issue361(en_vocab, text1, text2): + """Test Issue #361: Equality of lexemes""" + assert en_vocab[text1] == en_vocab[text1] + assert en_vocab[text1] != en_vocab[text2] + + +@pytest.mark.issue(600) +def test_issue600(): + vocab = Vocab(tag_map={"NN": {"pos": "NOUN"}}) + doc = Doc(vocab, words=["hello"]) + doc[0].tag_ = "NN" + + +@pytest.mark.parametrize("text1,prob1,text2,prob2", [("NOUN", -1, "opera", -2)]) +def test_vocab_lexeme_lt(en_vocab, text1, text2, prob1, prob2): + """More frequent is l.t. less frequent""" + lex1 = en_vocab[text1] + lex1.prob = prob1 + lex2 = en_vocab[text2] + lex2.prob = prob2 + + assert lex1 < lex2 + assert lex2 > lex1 + + +@pytest.mark.parametrize("text1,text2", [("phantom", "opera")]) +def test_vocab_lexeme_hash(en_vocab, text1, text2): + """Test that lexemes are hashable.""" + lex1 = en_vocab[text1] + lex2 = en_vocab[text2] + lexes = {lex1: lex1, lex2: lex2} + assert lexes[lex1].orth_ == text1 + assert lexes[lex2].orth_ == text2 + + +def test_vocab_lexeme_is_alpha(en_vocab): + assert en_vocab["the"].flags & (1 << IS_ALPHA) + assert not en_vocab["1999"].flags & (1 << IS_ALPHA) + assert not en_vocab["hello1"].flags & (1 << IS_ALPHA) + + +def test_vocab_lexeme_is_digit(en_vocab): + assert not en_vocab["the"].flags & (1 << IS_DIGIT) + assert en_vocab["1999"].flags & (1 << IS_DIGIT) + assert not en_vocab["hello1"].flags & (1 << IS_DIGIT) + + +def test_vocab_lexeme_add_flag_auto_id(en_vocab): + is_len4 = en_vocab.add_flag(lambda string: len(string) == 4) + assert en_vocab["1999"].check_flag(is_len4) is True + assert en_vocab["1999"].check_flag(IS_DIGIT) is True + assert en_vocab["199"].check_flag(is_len4) is False + assert en_vocab["199"].check_flag(IS_DIGIT) is True + assert en_vocab["the"].check_flag(is_len4) is False + assert en_vocab["dogs"].check_flag(is_len4) is True + + +def test_vocab_lexeme_add_flag_provided_id(en_vocab): + is_len4 = en_vocab.add_flag(lambda string: len(string) == 4, flag_id=IS_DIGIT) + assert en_vocab["1999"].check_flag(is_len4) is True + assert en_vocab["199"].check_flag(is_len4) is False + assert en_vocab["199"].check_flag(IS_DIGIT) is False + assert en_vocab["the"].check_flag(is_len4) is False + assert en_vocab["dogs"].check_flag(is_len4) is True + en_vocab.add_flag(lambda string: string.isdigit(), flag_id=IS_DIGIT) + + +def test_vocab_lexeme_oov_rank(en_vocab): + """Test that default rank is OOV_RANK.""" + lex = en_vocab["word"] + assert OOV_RANK == numpy.iinfo(numpy.uint64).max + assert lex.rank == OOV_RANK diff --git a/TTS/Kokoro/.venv/Lib/site-packages/spacy/tests/vocab_vectors/test_lookups.py b/TTS/Kokoro/.venv/Lib/site-packages/spacy/tests/vocab_vectors/test_lookups.py new file mode 100644 index 0000000000000000000000000000000000000000..85e576a55136ebd902dd1d0252e12da73e42344d --- /dev/null +++ b/TTS/Kokoro/.venv/Lib/site-packages/spacy/tests/vocab_vectors/test_lookups.py @@ -0,0 +1,142 @@ +import pytest + +from spacy.lookups import Lookups, Table +from spacy.strings import get_string_id +from spacy.vocab import Vocab + +from ..util import make_tempdir + + +def test_lookups_api(): + table_name = "test" + data = {"foo": "bar", "hello": "world"} + lookups = Lookups() + lookups.add_table(table_name, data) + assert len(lookups) == 1 + assert table_name in lookups + assert lookups.has_table(table_name) + table = lookups.get_table(table_name) + assert table.name == table_name + assert len(table) == 2 + assert table["hello"] == "world" + table["a"] = "b" + assert table["a"] == "b" + table = lookups.get_table(table_name) + assert len(table) == 3 + with pytest.raises(KeyError): + lookups.get_table("xyz") + with pytest.raises(ValueError): + lookups.add_table(table_name) + table = lookups.remove_table(table_name) + assert table.name == table_name + assert len(lookups) == 0 + assert table_name not in lookups + with pytest.raises(KeyError): + lookups.get_table(table_name) + + +def test_table_api(): + table = Table(name="table") + assert table.name == "table" + assert len(table) == 0 + assert "abc" not in table + data = {"foo": "bar", "hello": "world"} + table = Table(name="table", data=data) + assert len(table) == len(data) + assert "foo" in table + assert get_string_id("foo") in table + assert table["foo"] == "bar" + assert table[get_string_id("foo")] == "bar" + assert table.get("foo") == "bar" + assert table.get("abc") is None + table["abc"] = 123 + assert table["abc"] == 123 + assert table[get_string_id("abc")] == 123 + table.set("def", 456) + assert table["def"] == 456 + assert table[get_string_id("def")] == 456 + + +def test_table_api_to_from_bytes(): + data = {"foo": "bar", "hello": "world", "abc": 123} + table = Table(name="table", data=data) + table_bytes = table.to_bytes() + new_table = Table().from_bytes(table_bytes) + assert new_table.name == "table" + assert len(new_table) == 3 + assert new_table["foo"] == "bar" + assert new_table[get_string_id("foo")] == "bar" + new_table2 = Table(data={"def": 456}) + new_table2.from_bytes(table_bytes) + assert len(new_table2) == 3 + assert "def" not in new_table2 + + +def test_lookups_to_from_bytes(): + lookups = Lookups() + lookups.add_table("table1", {"foo": "bar", "hello": "world"}) + lookups.add_table("table2", {"a": 1, "b": 2, "c": 3}) + lookups_bytes = lookups.to_bytes() + new_lookups = Lookups() + new_lookups.from_bytes(lookups_bytes) + assert len(new_lookups) == 2 + assert "table1" in new_lookups + assert "table2" in new_lookups + table1 = new_lookups.get_table("table1") + assert len(table1) == 2 + assert table1["foo"] == "bar" + table2 = new_lookups.get_table("table2") + assert len(table2) == 3 + assert table2["b"] == 2 + assert new_lookups.to_bytes() == lookups_bytes + + +def test_lookups_to_from_disk(): + lookups = Lookups() + lookups.add_table("table1", {"foo": "bar", "hello": "world"}) + lookups.add_table("table2", {"a": 1, "b": 2, "c": 3}) + with make_tempdir() as tmpdir: + lookups.to_disk(tmpdir) + new_lookups = Lookups() + new_lookups.from_disk(tmpdir) + assert len(new_lookups) == 2 + assert "table1" in new_lookups + assert "table2" in new_lookups + table1 = new_lookups.get_table("table1") + assert len(table1) == 2 + assert table1["foo"] == "bar" + table2 = new_lookups.get_table("table2") + assert len(table2) == 3 + assert table2["b"] == 2 + + +def test_lookups_to_from_bytes_via_vocab(): + table_name = "test" + vocab = Vocab() + vocab.lookups.add_table(table_name, {"foo": "bar", "hello": "world"}) + assert table_name in vocab.lookups + vocab_bytes = vocab.to_bytes() + new_vocab = Vocab() + new_vocab.from_bytes(vocab_bytes) + assert len(new_vocab.lookups) == len(vocab.lookups) + assert table_name in new_vocab.lookups + table = new_vocab.lookups.get_table(table_name) + assert len(table) == 2 + assert table["hello"] == "world" + assert new_vocab.to_bytes() == vocab_bytes + + +def test_lookups_to_from_disk_via_vocab(): + table_name = "test" + vocab = Vocab() + vocab.lookups.add_table(table_name, {"foo": "bar", "hello": "world"}) + assert table_name in vocab.lookups + with make_tempdir() as tmpdir: + vocab.to_disk(tmpdir) + new_vocab = Vocab() + new_vocab.from_disk(tmpdir) + assert len(new_vocab.lookups) == len(vocab.lookups) + assert table_name in new_vocab.lookups + table = new_vocab.lookups.get_table(table_name) + assert len(table) == 2 + assert table["hello"] == "world" diff --git a/TTS/Kokoro/.venv/Lib/site-packages/spacy/tests/vocab_vectors/test_memory_zone.py b/TTS/Kokoro/.venv/Lib/site-packages/spacy/tests/vocab_vectors/test_memory_zone.py new file mode 100644 index 0000000000000000000000000000000000000000..2c9fc4f7740d4378ef35dd864f97cf9cf146d497 --- /dev/null +++ b/TTS/Kokoro/.venv/Lib/site-packages/spacy/tests/vocab_vectors/test_memory_zone.py @@ -0,0 +1,36 @@ +from spacy.vocab import Vocab + + +def test_memory_zone_no_insertion(): + vocab = Vocab() + with vocab.memory_zone(): + pass + lex = vocab["horse"] + assert lex.text == "horse" + + +def test_memory_zone_insertion(): + vocab = Vocab() + _ = vocab["dog"] + assert "dog" in vocab + assert "horse" not in vocab + with vocab.memory_zone(): + lex = vocab["horse"] + assert lex.text == "horse" + assert "dog" in vocab + assert "horse" not in vocab + + +def test_memory_zone_redundant_insertion(): + """Test that if we insert an already-existing word while + in the memory zone, it stays persistent""" + vocab = Vocab() + _ = vocab["dog"] + assert "dog" in vocab + assert "horse" not in vocab + with vocab.memory_zone(): + lex = vocab["horse"] + assert lex.text == "horse" + _ = vocab["dog"] + assert "dog" in vocab + assert "horse" not in vocab diff --git a/TTS/Kokoro/.venv/Lib/site-packages/spacy/tests/vocab_vectors/test_similarity.py b/TTS/Kokoro/.venv/Lib/site-packages/spacy/tests/vocab_vectors/test_similarity.py new file mode 100644 index 0000000000000000000000000000000000000000..77a1c9fca6234a9f9afa6758ebdb8113f6c75f12 --- /dev/null +++ b/TTS/Kokoro/.venv/Lib/site-packages/spacy/tests/vocab_vectors/test_similarity.py @@ -0,0 +1,111 @@ +import numpy +import pytest + +from spacy.tokens import Doc +from spacy.vocab import Vocab + +from ..util import add_vecs_to_vocab, get_cosine + + +@pytest.fixture +def vectors(): + return [("apple", [1, 2, 3]), ("orange", [-1, -2, -3])] + + +@pytest.fixture() +def vocab(en_vocab, vectors): + add_vecs_to_vocab(en_vocab, vectors) + return en_vocab + + +@pytest.mark.issue(2219) +def test_issue2219(en_vocab): + """Test if indexing issue still occurs during Token-Token similarity""" + vectors = [("a", [1, 2, 3]), ("letter", [4, 5, 6])] + add_vecs_to_vocab(en_vocab, vectors) + [(word1, vec1), (word2, vec2)] = vectors + doc = Doc(en_vocab, words=[word1, word2]) + assert doc[0].similarity(doc[1]) == doc[1].similarity(doc[0]) + + +def test_vectors_similarity_LL(vocab, vectors): + [(word1, vec1), (word2, vec2)] = vectors + lex1 = vocab[word1] + lex2 = vocab[word2] + assert lex1.has_vector + assert lex2.has_vector + assert lex1.vector_norm != 0 + assert lex2.vector_norm != 0 + assert lex1.vector[0] != lex2.vector[0] and lex1.vector[1] != lex2.vector[1] + assert isinstance(lex1.similarity(lex2), float) + assert numpy.isclose(lex1.similarity(lex2), get_cosine(vec1, vec2)) + assert numpy.isclose(lex2.similarity(lex2), lex1.similarity(lex1)) + + +def test_vectors_similarity_TT(vocab, vectors): + [(word1, vec1), (word2, vec2)] = vectors + doc = Doc(vocab, words=[word1, word2]) + assert doc[0].has_vector + assert doc[1].has_vector + assert doc[0].vector_norm != 0 + assert doc[1].vector_norm != 0 + assert doc[0].vector[0] != doc[1].vector[0] and doc[0].vector[1] != doc[1].vector[1] + assert isinstance(doc[0].similarity(doc[1]), float) + assert numpy.isclose(doc[0].similarity(doc[1]), get_cosine(vec1, vec2)) + assert numpy.isclose(doc[1].similarity(doc[0]), doc[0].similarity(doc[1])) + + +def test_vectors_similarity_SS(vocab, vectors): + [(word1, vec1), (word2, vec2)] = vectors + doc = Doc(vocab, words=[word1, word2]) + assert isinstance(doc[0:1].similarity(doc[0:2]), float) + assert doc[0:1].similarity(doc[0:2]) == doc[0:2].similarity(doc[0:1]) + + +def test_vectors_similarity_DD(vocab, vectors): + [(word1, vec1), (word2, vec2)] = vectors + doc1 = Doc(vocab, words=[word1, word2]) + doc2 = Doc(vocab, words=[word2, word1]) + assert isinstance(doc1.similarity(doc2), float) + assert doc1.similarity(doc2) == doc2.similarity(doc1) + + +def test_vectors_similarity_TD(vocab, vectors): + [(word1, vec1), (word2, vec2)] = vectors + doc = Doc(vocab, words=[word1, word2]) + assert isinstance(doc.similarity(doc[0]), float) + assert isinstance(doc[0].similarity(doc), float) + assert doc.similarity(doc[0]) == doc[0].similarity(doc) + + +def test_vectors_similarity_TS(vocab, vectors): + [(word1, vec1), (word2, vec2)] = vectors + doc = Doc(vocab, words=[word1, word2]) + assert isinstance(doc[:2].similarity(doc[0]), float) + assert isinstance(doc[0].similarity(doc[:2]), float) + assert doc[:2].similarity(doc[0]) == doc[0].similarity(doc[:2]) + + +def test_vectors_similarity_DS(vocab, vectors): + [(word1, vec1), (word2, vec2)] = vectors + doc = Doc(vocab, words=[word1, word2]) + assert isinstance(doc.similarity(doc[:2]), float) + assert doc.similarity(doc[:2]) == doc[:2].similarity(doc) + + +def test_vectors_similarity_no_vectors(): + vocab = Vocab() + doc1 = Doc(vocab, words=["a", "b"]) + doc2 = Doc(vocab, words=["c", "d", "e"]) + with pytest.warns(UserWarning): + doc1.similarity(doc2) + with pytest.warns(UserWarning): + doc1.similarity(doc2[1]) + with pytest.warns(UserWarning): + doc1.similarity(doc2[:2]) + with pytest.warns(UserWarning): + doc2.similarity(doc1) + with pytest.warns(UserWarning): + doc2[1].similarity(doc1) + with pytest.warns(UserWarning): + doc2[:2].similarity(doc1) diff --git a/TTS/Kokoro/.venv/Lib/site-packages/spacy/tests/vocab_vectors/test_stringstore.py b/TTS/Kokoro/.venv/Lib/site-packages/spacy/tests/vocab_vectors/test_stringstore.py new file mode 100644 index 0000000000000000000000000000000000000000..28c60c9f1b5551317b67c6a528917480f047ea98 --- /dev/null +++ b/TTS/Kokoro/.venv/Lib/site-packages/spacy/tests/vocab_vectors/test_stringstore.py @@ -0,0 +1,98 @@ +import pytest + +from spacy.strings import StringStore + + +@pytest.fixture +def stringstore(): + return StringStore() + + +def test_string_hash(stringstore): + """Test that string hashing is stable across platforms""" + assert stringstore.add("apple") == 8566208034543834098 + heart = "\U0001f499" + h = stringstore.add(heart) + assert h == 11841826740069053588 + + +def test_stringstore_from_api_docs(stringstore): + apple_hash = stringstore.add("apple") + assert apple_hash == 8566208034543834098 + assert stringstore[apple_hash] == "apple" + assert "apple" in stringstore + assert "cherry" not in stringstore + stringstore.add("orange") + all_strings = [s for s in stringstore] + assert all_strings == ["apple", "orange"] + banana_hash = stringstore.add("banana") + assert len(stringstore) == 3 + assert banana_hash == 2525716904149915114 + assert stringstore[banana_hash] == "banana" + assert stringstore["banana"] == banana_hash + + +@pytest.mark.parametrize("text1,text2,text3", [(b"Hello", b"goodbye", b"hello")]) +def test_stringstore_save_bytes(stringstore, text1, text2, text3): + key = stringstore.add(text1) + assert stringstore[text1] == key + assert stringstore[text2] != key + assert stringstore[text3] != key + + +@pytest.mark.parametrize("text1,text2,text3", [("Hello", "goodbye", "hello")]) +def test_stringstore_save_unicode(stringstore, text1, text2, text3): + key = stringstore.add(text1) + assert stringstore[text1] == key + assert stringstore[text2] != key + assert stringstore[text3] != key + + +@pytest.mark.parametrize("text", [b"A"]) +def test_stringstore_retrieve_id(stringstore, text): + key = stringstore.add(text) + assert len(stringstore) == 1 + assert stringstore[key] == text.decode("utf8") + with pytest.raises(KeyError): + stringstore[20000] + + +@pytest.mark.parametrize("text1,text2", [(b"0123456789", b"A")]) +def test_stringstore_med_string(stringstore, text1, text2): + store = stringstore.add(text1) + assert stringstore[store] == text1.decode("utf8") + stringstore.add(text2) + assert stringstore[text1] == store + + +def test_stringstore_long_string(stringstore): + text = "INFORMATIVE](http://www.google.com/search?as_q=RedditMonkey&hl=en&num=50&btnG=Google+Search&as_epq=&as_oq=&as_eq=&lr=&as_ft=i&as_filetype=&as_qdr=all&as_nlo=&as_nhi=&as_occt=any&as_dt=i&as_sitesearch=&as_rights=&safe=off" + store = stringstore.add(text) + assert stringstore[store] == text + + +@pytest.mark.parametrize("factor", [254, 255, 256]) +def test_stringstore_multiply(stringstore, factor): + text = "a" * factor + store = stringstore.add(text) + assert stringstore[store] == text + + +def test_stringstore_massive_strings(stringstore): + text = "a" * 511 + store = stringstore.add(text) + assert stringstore[store] == text + text2 = "z" * 512 + store = stringstore.add(text2) + assert stringstore[store] == text2 + text3 = "1" * 513 + store = stringstore.add(text3) + assert stringstore[store] == text3 + + +@pytest.mark.parametrize("text", ["qqqqq"]) +def test_stringstore_to_bytes(stringstore, text): + store = stringstore.add(text) + serialized = stringstore.to_bytes() + new_stringstore = StringStore().from_bytes(serialized) + assert new_stringstore[store] == text diff --git a/TTS/Kokoro/.venv/Lib/site-packages/spacy/tests/vocab_vectors/test_vectors.py b/TTS/Kokoro/.venv/Lib/site-packages/spacy/tests/vocab_vectors/test_vectors.py new file mode 100644 index 0000000000000000000000000000000000000000..cc7273e493efedb472106e1c2f5e8933af115abc --- /dev/null +++ b/TTS/Kokoro/.venv/Lib/site-packages/spacy/tests/vocab_vectors/test_vectors.py @@ -0,0 +1,678 @@ +import numpy +import pytest +from numpy.testing import assert_allclose, assert_almost_equal, assert_equal +from thinc.api import NumpyOps, get_current_ops + +from spacy.lang.en import English +from spacy.strings import hash_string # type: ignore +from spacy.tokenizer import Tokenizer +from spacy.tokens import Doc +from spacy.training.initialize import convert_vectors +from spacy.vectors import Vectors +from spacy.vocab import Vocab + +from ..util import add_vecs_to_vocab, get_cosine, make_tempdir + +OPS = get_current_ops() + + +@pytest.fixture +def strings(): + return ["apple", "orange"] + + +@pytest.fixture +def vectors(): + return [ + ("apple", OPS.asarray([1, 2, 3])), + ("orange", OPS.asarray([-1, -2, -3])), + ("and", OPS.asarray([-1, -1, -1])), + ("juice", OPS.asarray([5, 5, 10])), + ("pie", OPS.asarray([7, 6.3, 8.9])), + ] + + +@pytest.fixture +def data(): + return numpy.asarray([[0.0, 1.0, 2.0], [3.0, -2.0, 4.0]], dtype="f") + + +@pytest.fixture +def most_similar_vectors_data(): + return numpy.asarray( + [[0.0, 1.0, 2.0], [1.0, -2.0, 4.0], [1.0, 1.0, -1.0], [2.0, 3.0, 1.0]], + dtype="f", + ) + + +@pytest.fixture +def most_similar_vectors_keys(): + return ["a", "b", "c", "d"] + + +@pytest.fixture +def resize_data(): + return numpy.asarray([[0.0, 1.0], [2.0, 3.0]], dtype="f") + + +@pytest.fixture() +def vocab(en_vocab, vectors): + add_vecs_to_vocab(en_vocab, vectors) + return en_vocab + + +@pytest.fixture() +def tokenizer_v(vocab): + return Tokenizer(vocab, {}, None, None, None) + + +@pytest.mark.issue(1518) +def test_issue1518(): + """Test vectors.resize() works.""" + vectors = Vectors(shape=(10, 10)) + vectors.add("hello", row=2) + vectors.resize((5, 9)) + + +@pytest.mark.issue(1539) +def test_issue1539(): + """Ensure vectors.resize() doesn't try to modify dictionary during iteration.""" + v = Vectors(shape=(10, 10), keys=[5, 3, 98, 100]) + v.resize((100, 100)) + + +@pytest.mark.issue(1807) +def test_issue1807(): + """Test vocab.set_vector also adds the word to the vocab.""" + vocab = Vocab(vectors_name="test_issue1807") + assert "hello" not in vocab + vocab.set_vector("hello", numpy.ones((50,), dtype="f")) + assert "hello" in vocab + + +@pytest.mark.issue(2871) +def test_issue2871(): + """Test that vectors recover the correct key for spaCy reserved words.""" + words = ["dog", "cat", "SUFFIX"] + vocab = Vocab(vectors_name="test_issue2871") + vocab.vectors.resize(shape=(3, 10)) + vector_data = numpy.zeros((3, 10), dtype="f") + for word in words: + _ = vocab[word] # noqa: F841 + vocab.set_vector(word, vector_data[0]) + vocab.vectors.name = "dummy_vectors" + assert vocab["dog"].rank == 0 + assert vocab["cat"].rank == 1 + assert vocab["SUFFIX"].rank == 2 + assert vocab.vectors.find(key="dog") == 0 + assert vocab.vectors.find(key="cat") == 1 + assert vocab.vectors.find(key="SUFFIX") == 2 + + +@pytest.mark.issue(3412) +def test_issue3412(): + data = numpy.asarray([[0, 0, 0], [1, 2, 3], [9, 8, 7]], dtype="f") + vectors = Vectors(data=data, keys=["A", "B", "C"]) + keys, best_rows, scores = vectors.most_similar( + numpy.asarray([[9, 8, 7], [0, 0, 0]], dtype="f") + ) + assert best_rows[0] == 2 + + +@pytest.mark.issue(4725) +def test_issue4725_2(): + if isinstance(get_current_ops, NumpyOps): + # ensures that this runs correctly and doesn't hang or crash because of the global vectors + # if it does crash, it's usually because of calling 'spawn' for multiprocessing (e.g. on Windows), + # or because of issues with pickling the NER (cf test_issue4725_1) + vocab = Vocab(vectors_name="test_vocab_add_vector") + data = numpy.ndarray((5, 3), dtype="f") + data[0] = 1.0 + data[1] = 2.0 + vocab.set_vector("cat", data[0]) + vocab.set_vector("dog", data[1]) + nlp = English(vocab=vocab) + nlp.add_pipe("ner") + nlp.initialize() + docs = ["Kurt is in London."] * 10 + for _ in nlp.pipe(docs, batch_size=2, n_process=2): + pass + + +def test_init_vectors_with_resize_shape(strings, resize_data): + v = Vectors(shape=(len(strings), 3)) + v.resize(shape=resize_data.shape) + assert v.shape == resize_data.shape + assert v.shape != (len(strings), 3) + + +def test_init_vectors_with_resize_data(data, resize_data): + v = Vectors(data=data) + v.resize(shape=resize_data.shape) + assert v.shape == resize_data.shape + assert v.shape != data.shape + + +def test_get_vector_resize(strings, data): + strings = [hash_string(s) for s in strings] + + # decrease vector dimension (truncate) + v = Vectors(data=data) + resized_dim = v.shape[1] - 1 + v.resize(shape=(v.shape[0], resized_dim)) + for i, string in enumerate(strings): + v.add(string, row=i) + + assert list(v[strings[0]]) == list(data[0, :resized_dim]) + assert list(v[strings[1]]) == list(data[1, :resized_dim]) + + # increase vector dimension (pad with zeros) + v = Vectors(data=data) + resized_dim = v.shape[1] + 1 + v.resize(shape=(v.shape[0], resized_dim)) + for i, string in enumerate(strings): + v.add(string, row=i) + + assert list(v[strings[0]]) == list(data[0]) + [0] + assert list(v[strings[1]]) == list(data[1]) + [0] + + +def test_init_vectors_with_data(strings, data): + v = Vectors(data=data) + assert v.shape == data.shape + + +def test_init_vectors_with_shape(strings): + v = Vectors(shape=(len(strings), 3)) + assert v.shape == (len(strings), 3) + assert v.is_full is False + + +def test_get_vector(strings, data): + v = Vectors(data=data) + strings = [hash_string(s) for s in strings] + for i, string in enumerate(strings): + v.add(string, row=i) + assert list(v[strings[0]]) == list(data[0]) + assert list(v[strings[0]]) != list(data[1]) + assert list(v[strings[1]]) != list(data[0]) + + +def test_set_vector(strings, data): + orig = data.copy() + v = Vectors(data=data) + strings = [hash_string(s) for s in strings] + for i, string in enumerate(strings): + v.add(string, row=i) + assert list(v[strings[0]]) == list(orig[0]) + assert list(v[strings[0]]) != list(orig[1]) + v[strings[0]] = data[1] + assert list(v[strings[0]]) == list(orig[1]) + assert list(v[strings[0]]) != list(orig[0]) + + +def test_vectors_most_similar(most_similar_vectors_data, most_similar_vectors_keys): + v = Vectors(data=most_similar_vectors_data, keys=most_similar_vectors_keys) + _, best_rows, _ = v.most_similar(v.data, batch_size=2, n=2, sort=True) + assert all(row[0] == i for i, row in enumerate(best_rows)) + + with pytest.raises(ValueError): + v.most_similar(v.data, batch_size=2, n=10, sort=True) + + +def test_vectors_most_similar_identical(): + """Test that most similar identical vectors are assigned a score of 1.0.""" + data = numpy.asarray([[4, 2, 2, 2], [4, 2, 2, 2], [1, 1, 1, 1]], dtype="f") + v = Vectors(data=data, keys=["A", "B", "C"]) + keys, _, scores = v.most_similar(numpy.asarray([[4, 2, 2, 2]], dtype="f")) + assert scores[0][0] == 1.0 # not 1.0000002 + data = numpy.asarray([[1, 2, 3], [1, 2, 3], [1, 1, 1]], dtype="f") + v = Vectors(data=data, keys=["A", "B", "C"]) + keys, _, scores = v.most_similar(numpy.asarray([[1, 2, 3]], dtype="f")) + assert scores[0][0] == 1.0 # not 0.9999999 + + +@pytest.mark.parametrize("text", ["apple and orange"]) +def test_vectors_token_vector(tokenizer_v, vectors, text): + doc = tokenizer_v(text) + assert vectors[0][0] == doc[0].text + assert all([a == b for a, b in zip(vectors[0][1], doc[0].vector)]) + assert vectors[1][0] == doc[2].text + assert all([a == b for a, b in zip(vectors[1][1], doc[2].vector)]) + + +@pytest.mark.parametrize("text", ["apple", "orange"]) +def test_vectors_lexeme_vector(vocab, text): + lex = vocab[text] + assert list(lex.vector) + assert lex.vector_norm + + +@pytest.mark.parametrize("text", [["apple", "and", "orange"]]) +def test_vectors_doc_vector(vocab, text): + doc = Doc(vocab, words=text) + assert list(doc.vector) + assert doc.vector_norm + + +@pytest.mark.parametrize("text", [["apple", "and", "orange"]]) +def test_vectors_span_vector(vocab, text): + span = Doc(vocab, words=text)[0:2] + assert list(span.vector) + assert span.vector_norm + + +@pytest.mark.parametrize("text", ["apple orange"]) +def test_vectors_token_token_similarity(tokenizer_v, text): + doc = tokenizer_v(text) + assert doc[0].similarity(doc[1]) == doc[1].similarity(doc[0]) + assert -1.0 < doc[0].similarity(doc[1]) < 1.0 + + +@pytest.mark.parametrize("text1,text2", [("apple", "orange")]) +def test_vectors_token_lexeme_similarity(tokenizer_v, vocab, text1, text2): + token = tokenizer_v(text1) + lex = vocab[text2] + assert token.similarity(lex) == lex.similarity(token) + assert -1.0 < token.similarity(lex) < 1.0 + + +@pytest.mark.parametrize("text", [["apple", "orange", "juice"]]) +def test_vectors_token_span_similarity(vocab, text): + doc = Doc(vocab, words=text) + assert doc[0].similarity(doc[1:3]) == doc[1:3].similarity(doc[0]) + assert -1.0 < doc[0].similarity(doc[1:3]) < 1.0 + + +@pytest.mark.parametrize("text", [["apple", "orange", "juice"]]) +def test_vectors_token_doc_similarity(vocab, text): + doc = Doc(vocab, words=text) + assert doc[0].similarity(doc) == doc.similarity(doc[0]) + assert -1.0 < doc[0].similarity(doc) < 1.0 + + +@pytest.mark.parametrize("text", [["apple", "orange", "juice"]]) +def test_vectors_lexeme_span_similarity(vocab, text): + doc = Doc(vocab, words=text) + lex = vocab[text[0]] + assert lex.similarity(doc[1:3]) == doc[1:3].similarity(lex) + assert -1.0 < doc.similarity(doc[1:3]) < 1.0 + + +@pytest.mark.parametrize("text1,text2", [("apple", "orange")]) +def test_vectors_lexeme_lexeme_similarity(vocab, text1, text2): + lex1 = vocab[text1] + lex2 = vocab[text2] + assert lex1.similarity(lex2) == lex2.similarity(lex1) + assert -1.0 < lex1.similarity(lex2) < 1.0 + + +@pytest.mark.parametrize("text", [["apple", "orange", "juice"]]) +def test_vectors_lexeme_doc_similarity(vocab, text): + doc = Doc(vocab, words=text) + lex = vocab[text[0]] + assert lex.similarity(doc) == doc.similarity(lex) + assert -1.0 < lex.similarity(doc) < 1.0 + + +@pytest.mark.parametrize("text", [["apple", "orange", "juice"]]) +def test_vectors_span_span_similarity(vocab, text): + doc = Doc(vocab, words=text) + assert doc[0:2].similarity(doc[1:3]) == doc[1:3].similarity(doc[0:2]) + assert -1.0 < doc[0:2].similarity(doc[1:3]) < 1.0 + + +@pytest.mark.parametrize("text", [["apple", "orange", "juice"]]) +def test_vectors_span_doc_similarity(vocab, text): + doc = Doc(vocab, words=text) + assert doc[0:2].similarity(doc) == doc.similarity(doc[0:2]) + assert -1.0 < doc[0:2].similarity(doc) < 1.0 + + +@pytest.mark.parametrize( + "text1,text2", [(["apple", "and", "apple", "pie"], ["orange", "juice"])] +) +def test_vectors_doc_doc_similarity(vocab, text1, text2): + doc1 = Doc(vocab, words=text1) + doc2 = Doc(vocab, words=text2) + assert doc1.similarity(doc2) == doc2.similarity(doc1) + assert -1.0 < doc1.similarity(doc2) < 1.0 + + +def test_vocab_add_vector(): + vocab = Vocab(vectors_name="test_vocab_add_vector") + data = OPS.xp.ndarray((5, 3), dtype="f") + data[0] = 1.0 + data[1] = 2.0 + vocab.set_vector("cat", data[0]) + vocab.set_vector("dog", data[1]) + cat = vocab["cat"] + assert list(cat.vector) == [1.0, 1.0, 1.0] + dog = vocab["dog"] + assert list(dog.vector) == [2.0, 2.0, 2.0] + + with pytest.raises(ValueError): + vocab.vectors.add(vocab["hamster"].orth, row=1000000) + + +def test_vocab_prune_vectors(): + vocab = Vocab(vectors_name="test_vocab_prune_vectors") + _ = vocab["cat"] # noqa: F841 + _ = vocab["dog"] # noqa: F841 + _ = vocab["kitten"] # noqa: F841 + data = OPS.xp.ndarray((5, 3), dtype="f") + data[0] = OPS.asarray([1.0, 1.2, 1.1]) + data[1] = OPS.asarray([0.3, 1.3, 1.0]) + data[2] = OPS.asarray([0.9, 1.22, 1.05]) + vocab.set_vector("cat", data[0]) + vocab.set_vector("dog", data[1]) + vocab.set_vector("kitten", data[2]) + + remap = vocab.prune_vectors(2, batch_size=2) + assert list(remap.keys()) == ["kitten"] + neighbour, similarity = list(remap.values())[0] + assert neighbour == "cat", remap + cosine = get_cosine(data[0], data[2]) + assert_allclose(float(similarity), cosine, atol=1e-4, rtol=1e-3) + + +def test_vectors_serialize(): + data = OPS.asarray([[4, 2, 2, 2], [4, 2, 2, 2], [1, 1, 1, 1]], dtype="f") + v = Vectors(data=data, keys=["A", "B", "C"]) + b = v.to_bytes() + v_r = Vectors() + v_r.from_bytes(b) + assert_equal(OPS.to_numpy(v.data), OPS.to_numpy(v_r.data)) + assert v.key2row == v_r.key2row + v.resize((5, 4)) + v_r.resize((5, 4)) + row = v.add("D", vector=OPS.asarray([1, 2, 3, 4], dtype="f")) + row_r = v_r.add("D", vector=OPS.asarray([1, 2, 3, 4], dtype="f")) + assert row == row_r + assert_equal(OPS.to_numpy(v.data), OPS.to_numpy(v_r.data)) + assert v.is_full == v_r.is_full + with make_tempdir() as d: + v.to_disk(d) + v_r.from_disk(d) + assert_equal(OPS.to_numpy(v.data), OPS.to_numpy(v_r.data)) + assert v.key2row == v_r.key2row + v.resize((5, 4)) + v_r.resize((5, 4)) + row = v.add("D", vector=OPS.asarray([10, 20, 30, 40], dtype="f")) + row_r = v_r.add("D", vector=OPS.asarray([10, 20, 30, 40], dtype="f")) + assert row == row_r + assert_equal(OPS.to_numpy(v.data), OPS.to_numpy(v_r.data)) + assert v.attr == v_r.attr + + +def test_vector_is_oov(): + vocab = Vocab(vectors_name="test_vocab_is_oov") + data = OPS.xp.ndarray((5, 3), dtype="f") + data[0] = 1.0 + data[1] = 2.0 + vocab.set_vector("cat", data[0]) + vocab.set_vector("dog", data[1]) + assert vocab["cat"].is_oov is False + assert vocab["dog"].is_oov is False + assert vocab["hamster"].is_oov is True + + +def test_init_vectors_unset(): + v = Vectors(shape=(10, 10)) + assert v.is_full is False + assert v.shape == (10, 10) + + with pytest.raises(ValueError): + v = Vectors(shape=(10, 10), mode="floret") + + v = Vectors(data=OPS.xp.zeros((10, 10)), mode="floret", hash_count=1) + assert v.is_full is True + + +def test_vectors_clear(): + data = OPS.asarray([[4, 2, 2, 2], [4, 2, 2, 2], [1, 1, 1, 1]], dtype="f") + v = Vectors(data=data, keys=["A", "B", "C"]) + assert v.is_full is True + assert hash_string("A") in v + v.clear() + # no keys + assert v.key2row == {} + assert list(v) == [] + assert v.is_full is False + assert "A" not in v + with pytest.raises(KeyError): + v["A"] + + +def test_vectors_get_batch(): + data = OPS.asarray([[4, 2, 2, 2], [4, 2, 2, 2], [1, 1, 1, 1]], dtype="f") + v = Vectors(data=data, keys=["A", "B", "C"]) + # check with mixed int/str keys + words = ["C", "B", "A", v.strings["B"]] + rows = v.find(keys=words) + vecs = OPS.as_contig(v.data[rows]) + assert_equal(OPS.to_numpy(vecs), OPS.to_numpy(v.get_batch(words))) + + +def test_vectors_deduplicate(): + data = OPS.asarray([[1, 1], [2, 2], [3, 4], [1, 1], [3, 4]], dtype="f") + v = Vectors(data=data, keys=["a1", "b1", "c1", "a2", "c2"]) + vocab = Vocab() + vocab.vectors = v + # duplicate vectors do not use the same keys + assert ( + vocab.vectors.key2row[v.strings["a1"]] != vocab.vectors.key2row[v.strings["a2"]] + ) + assert ( + vocab.vectors.key2row[v.strings["c1"]] != vocab.vectors.key2row[v.strings["c2"]] + ) + vocab.deduplicate_vectors() + # there are three unique vectors + assert vocab.vectors.shape[0] == 3 + # the uniqued data is the same as the deduplicated data + assert_equal( + numpy.unique(OPS.to_numpy(vocab.vectors.data), axis=0), + OPS.to_numpy(vocab.vectors.data), + ) + # duplicate vectors use the same keys now + assert ( + vocab.vectors.key2row[v.strings["a1"]] == vocab.vectors.key2row[v.strings["a2"]] + ) + assert ( + vocab.vectors.key2row[v.strings["c1"]] == vocab.vectors.key2row[v.strings["c2"]] + ) + # deduplicating again makes no changes + vocab_b = vocab.to_bytes() + vocab.deduplicate_vectors() + assert vocab_b == vocab.to_bytes() + + +@pytest.fixture() +def floret_vectors_hashvec_str(): + """The full hashvec table from floret with the settings: + bucket 10, dim 10, minn 2, maxn 3, hash count 2, hash seed 2166136261, + bow <, eow >""" + return """10 10 2 3 2 2166136261 < > +0 -2.2611 3.9302 2.6676 -11.233 0.093715 -10.52 -9.6463 -0.11853 2.101 -0.10145 +1 -3.12 -1.7981 10.7 -6.171 4.4527 10.967 9.073 6.2056 -6.1199 -2.0402 +2 9.5689 5.6721 -8.4832 -1.2249 2.1871 -3.0264 -2.391 -5.3308 -3.2847 -4.0382 +3 3.6268 4.2759 -1.7007 1.5002 5.5266 1.8716 -12.063 0.26314 2.7645 2.4929 +4 -11.683 -7.7068 2.1102 2.214 7.2202 0.69799 3.2173 -5.382 -2.0838 5.0314 +5 -4.3024 8.0241 2.0714 -1.0174 -0.28369 1.7622 7.8797 -1.7795 6.7541 5.6703 +6 8.3574 -5.225 8.6529 8.5605 -8.9465 3.767 -5.4636 -1.4635 -0.98947 -0.58025 +7 -10.01 3.3894 -4.4487 1.1669 -11.904 6.5158 4.3681 0.79913 -6.9131 -8.687 +8 -5.4576 7.1019 -8.8259 1.7189 4.955 -8.9157 -3.8905 -0.60086 -2.1233 5.892 +9 8.0678 -4.4142 3.6236 4.5889 -2.7611 2.4455 0.67096 -4.2822 2.0875 4.6274 +""" + + +@pytest.fixture() +def floret_vectors_vec_str(): + """The top 10 rows from floret with the settings above, to verify + that the spacy floret vectors are equivalent to the fasttext static + vectors.""" + return """10 10 +, -5.7814 2.6918 0.57029 -3.6985 -2.7079 1.4406 1.0084 1.7463 -3.8625 -3.0565 +. 3.8016 -1.759 0.59118 3.3044 -0.72975 0.45221 -2.1412 -3.8933 -2.1238 -0.47409 +der 0.08224 2.6601 -1.173 1.1549 -0.42821 -0.097268 -2.5589 -1.609 -0.16968 0.84687 +die -2.8781 0.082576 1.9286 -0.33279 0.79488 3.36 3.5609 -0.64328 -2.4152 0.17266 +und 2.1558 1.8606 -1.382 0.45424 -0.65889 1.2706 0.5929 -2.0592 -2.6949 -1.6015 +" -1.1242 1.4588 -1.6263 1.0382 -2.7609 -0.99794 -0.83478 -1.5711 -1.2137 1.0239 +in -0.87635 2.0958 4.0018 -2.2473 -1.2429 2.3474 1.8846 0.46521 -0.506 -0.26653 +von -0.10589 1.196 1.1143 -0.40907 -1.0848 -0.054756 -2.5016 -1.0381 -0.41598 0.36982 +( 0.59263 2.1856 0.67346 1.0769 1.0701 1.2151 1.718 -3.0441 2.7291 3.719 +) 0.13812 3.3267 1.657 0.34729 -3.5459 0.72372 0.63034 -1.6145 1.2733 0.37798 +""" + + +def test_floret_vectors(floret_vectors_vec_str, floret_vectors_hashvec_str): + nlp = English() + nlp_plain = English() + # load both vec and hashvec tables + with make_tempdir() as tmpdir: + p = tmpdir / "test.hashvec" + with open(p, "w") as fileh: + fileh.write(floret_vectors_hashvec_str) + convert_vectors(nlp, p, truncate=0, prune=-1, mode="floret") + p = tmpdir / "test.vec" + with open(p, "w") as fileh: + fileh.write(floret_vectors_vec_str) + convert_vectors(nlp_plain, p, truncate=0, prune=-1) + + word = "der" + # ngrams: full padded word + padded 2-grams + padded 3-grams + ngrams = nlp.vocab.vectors._get_ngrams(word) + assert ngrams == ["", "", ""] + # rows: 2 rows per ngram + rows = OPS.xp.asarray( + [ + h % nlp.vocab.vectors.shape[0] + for ngram in ngrams + for h in nlp.vocab.vectors._get_ngram_hashes(ngram) + ], + dtype="uint32", + ) + assert_equal( + OPS.to_numpy(rows), + numpy.asarray([5, 6, 7, 5, 8, 2, 8, 9, 3, 3, 4, 6, 7, 3, 0, 2]), + ) + assert len(rows) == len(ngrams) * nlp.vocab.vectors.hash_count + # all vectors are equivalent for plain static table vs. hash ngrams + for word in nlp_plain.vocab.vectors: + word = nlp_plain.vocab.strings.as_string(word) + assert_almost_equal( + nlp.vocab[word].vector, nlp_plain.vocab[word].vector, decimal=3 + ) + + # every word has a vector + assert nlp.vocab[word * 5].has_vector + + # n_keys is -1 for floret + assert nlp_plain.vocab.vectors.n_keys > 0 + assert nlp.vocab.vectors.n_keys == -1 + + # check that single and batched vector lookups are identical + words = [s for s in nlp_plain.vocab.vectors] + single_vecs = OPS.to_numpy(OPS.asarray([nlp.vocab[word].vector for word in words])) + batch_vecs = OPS.to_numpy(nlp.vocab.vectors.get_batch(words)) + assert_equal(single_vecs, batch_vecs) + + # an empty key returns 0s + assert_equal( + OPS.to_numpy(nlp.vocab[""].vector), + numpy.zeros((nlp.vocab.vectors.shape[0],)), + ) + # an empty batch returns 0s + assert_equal( + OPS.to_numpy(nlp.vocab.vectors.get_batch([""])), + numpy.zeros((1, nlp.vocab.vectors.shape[0])), + ) + # an empty key within a batch returns 0s + assert_equal( + OPS.to_numpy(nlp.vocab.vectors.get_batch(["a", "", "b"])[1]), + numpy.zeros((nlp.vocab.vectors.shape[0],)), + ) + + # the loaded ngram vector table cannot be modified + # except for clear: warning, then return without modifications + vector = list(range(nlp.vocab.vectors.shape[1])) + orig_bytes = nlp.vocab.vectors.to_bytes(exclude=["strings"]) + with pytest.warns(UserWarning): + nlp.vocab.set_vector("the", vector) + assert orig_bytes == nlp.vocab.vectors.to_bytes(exclude=["strings"]) + with pytest.warns(UserWarning): + nlp.vocab[word].vector = vector + assert orig_bytes == nlp.vocab.vectors.to_bytes(exclude=["strings"]) + with pytest.warns(UserWarning): + nlp.vocab.vectors.add("the", row=6) + assert orig_bytes == nlp.vocab.vectors.to_bytes(exclude=["strings"]) + with pytest.warns(UserWarning): + nlp.vocab.vectors.resize(shape=(100, 10)) + assert orig_bytes == nlp.vocab.vectors.to_bytes(exclude=["strings"]) + with pytest.raises(ValueError): + nlp.vocab.vectors.clear() + + # data and settings are serialized correctly + with make_tempdir() as d: + nlp.vocab.to_disk(d) + vocab_r = Vocab() + vocab_r.from_disk(d) + assert nlp.vocab.vectors.to_bytes() == vocab_r.vectors.to_bytes() + assert_equal( + OPS.to_numpy(nlp.vocab.vectors.data), OPS.to_numpy(vocab_r.vectors.data) + ) + assert_equal(nlp.vocab.vectors._get_cfg(), vocab_r.vectors._get_cfg()) + assert_almost_equal( + OPS.to_numpy(nlp.vocab[word].vector), + OPS.to_numpy(vocab_r[word].vector), + decimal=6, + ) + + +def test_equality(): + vectors1 = Vectors(shape=(10, 10)) + vectors2 = Vectors(shape=(10, 8)) + + assert vectors1 != vectors2 + + vectors2 = Vectors(shape=(10, 10)) + assert vectors1 == vectors2 + + vectors1.add("hello", row=2) + assert vectors1 != vectors2 + + vectors2.add("hello", row=2) + assert vectors1 == vectors2 + + vectors1.resize((5, 9)) + vectors2.resize((5, 9)) + assert vectors1 == vectors2 + + +def test_vectors_attr(): + data = numpy.asarray([[0, 0, 0], [1, 2, 3], [9, 8, 7]], dtype="f") + # default ORTH + nlp = English() + nlp.vocab.vectors = Vectors(data=data, keys=["A", "B", "C"]) + assert nlp.vocab.strings["A"] in nlp.vocab.vectors.key2row + assert nlp.vocab.strings["a"] not in nlp.vocab.vectors.key2row + assert nlp.vocab["A"].has_vector is True + assert nlp.vocab["a"].has_vector is False + assert nlp("A")[0].has_vector is True + assert nlp("a")[0].has_vector is False + + # custom LOWER + nlp = English() + nlp.vocab.vectors = Vectors(data=data, keys=["a", "b", "c"], attr="LOWER") + assert nlp.vocab.strings["A"] not in nlp.vocab.vectors.key2row + assert nlp.vocab.strings["a"] in nlp.vocab.vectors.key2row + assert nlp.vocab["A"].has_vector is True + assert nlp.vocab["a"].has_vector is True + assert nlp("A")[0].has_vector is True + assert nlp("a")[0].has_vector is True + # add a new vectors entry + assert nlp.vocab["D"].has_vector is False + assert nlp.vocab["d"].has_vector is False + nlp.vocab.set_vector("D", numpy.asarray([4, 5, 6])) + assert nlp.vocab["D"].has_vector is True + assert nlp.vocab["d"].has_vector is True diff --git a/TTS/Kokoro/.venv/Lib/site-packages/spacy/tests/vocab_vectors/test_vocab_api.py b/TTS/Kokoro/.venv/Lib/site-packages/spacy/tests/vocab_vectors/test_vocab_api.py new file mode 100644 index 0000000000000000000000000000000000000000..b08c9baa394bc468bc43f132b8836ca88189c2c2 --- /dev/null +++ b/TTS/Kokoro/.venv/Lib/site-packages/spacy/tests/vocab_vectors/test_vocab_api.py @@ -0,0 +1,83 @@ +import os + +import pytest + +from spacy.attrs import IS_ALPHA, LEMMA, ORTH +from spacy.lang.en import English +from spacy.parts_of_speech import NOUN, VERB +from spacy.vocab import Vocab + +from ..util import make_tempdir + + +@pytest.mark.issue(1868) +def test_issue1868(): + """Test Vocab.__contains__ works with int keys.""" + vocab = Vocab() + lex = vocab["hello"] + assert lex.orth in vocab + assert lex.orth_ in vocab + assert "some string" not in vocab + int_id = vocab.strings.add("some string") + assert int_id not in vocab + + +@pytest.mark.parametrize( + "text1,text2", [("Hello", "bye"), ("Hello", "hello"), ("Hello", "Hello,")] +) +def test_vocab_api_neq(en_vocab, text1, text2): + assert en_vocab[text1].orth != en_vocab[text2].orth + + +@pytest.mark.parametrize("text", "Hello") +def test_vocab_api_eq(en_vocab, text): + lex = en_vocab[text] + assert en_vocab[text].orth == lex.orth + + +@pytest.mark.parametrize("text", ["example"]) +def test_vocab_api_shape_attr(en_vocab, text): + lex = en_vocab[text] + assert lex.orth != lex.shape + + +@pytest.mark.parametrize( + "string,symbol", + [ + ("IS_ALPHA", IS_ALPHA), + ("NOUN", NOUN), + ("VERB", VERB), + ("LEMMA", LEMMA), + ("ORTH", ORTH), + ], +) +def test_vocab_api_symbols(en_vocab, string, symbol): + assert en_vocab.strings[string] == symbol + + +@pytest.mark.parametrize("text", "Hello") +def test_vocab_api_contains(en_vocab, text): + _ = en_vocab[text] # noqa: F841 + assert text in en_vocab + assert "LKsdjvlsakdvlaksdvlkasjdvljasdlkfvm" not in en_vocab + + +def test_vocab_writing_system(en_vocab): + assert en_vocab.writing_system["direction"] == "ltr" + assert en_vocab.writing_system["has_case"] is True + + +def test_to_disk(): + nlp = English() + with make_tempdir() as d: + nlp.vocab.to_disk(d) + assert "vectors" in os.listdir(d) + assert "lookups.bin" in os.listdir(d) + + +def test_to_disk_exclude(): + nlp = English() + with make_tempdir() as d: + nlp.vocab.to_disk(d, exclude=("vectors", "lookups")) + assert "vectors" not in os.listdir(d) + assert "lookups.bin" not in os.listdir(d) diff --git a/TTS/Kokoro/.venv/Lib/site-packages/spacy/tokens/__pycache__/__init__.cpython-312.pyc b/TTS/Kokoro/.venv/Lib/site-packages/spacy/tokens/__pycache__/__init__.cpython-312.pyc new file mode 100644 index 0000000000000000000000000000000000000000..e8af1659e26c05da087b6ca76a982483ef3bec17 Binary files /dev/null and b/TTS/Kokoro/.venv/Lib/site-packages/spacy/tokens/__pycache__/__init__.cpython-312.pyc differ diff --git a/TTS/Kokoro/.venv/Lib/site-packages/spacy/tokens/__pycache__/_dict_proxies.cpython-312.pyc b/TTS/Kokoro/.venv/Lib/site-packages/spacy/tokens/__pycache__/_dict_proxies.cpython-312.pyc new file mode 100644 index 0000000000000000000000000000000000000000..58cfdb7c2f1c3c67eff36c3477ee3e8981109806 Binary files /dev/null and b/TTS/Kokoro/.venv/Lib/site-packages/spacy/tokens/__pycache__/_dict_proxies.cpython-312.pyc differ diff --git a/TTS/Kokoro/.venv/Lib/site-packages/spacy/tokens/__pycache__/_serialize.cpython-312.pyc b/TTS/Kokoro/.venv/Lib/site-packages/spacy/tokens/__pycache__/_serialize.cpython-312.pyc new file mode 100644 index 0000000000000000000000000000000000000000..360c16ca00cf34ca6750d1b6af1fdce28558024a Binary files /dev/null and b/TTS/Kokoro/.venv/Lib/site-packages/spacy/tokens/__pycache__/_serialize.cpython-312.pyc differ diff --git a/TTS/Kokoro/.venv/Lib/site-packages/spacy/tokens/__pycache__/underscore.cpython-312.pyc b/TTS/Kokoro/.venv/Lib/site-packages/spacy/tokens/__pycache__/underscore.cpython-312.pyc new file mode 100644 index 0000000000000000000000000000000000000000..b8ba4637313a9ea4eee2a1b0e3c532aa39b0a489 Binary files /dev/null and b/TTS/Kokoro/.venv/Lib/site-packages/spacy/tokens/__pycache__/underscore.cpython-312.pyc differ diff --git a/TTS/Kokoro/.venv/Lib/site-packages/spacy/training/__pycache__/__init__.cpython-312.pyc b/TTS/Kokoro/.venv/Lib/site-packages/spacy/training/__pycache__/__init__.cpython-312.pyc new file mode 100644 index 0000000000000000000000000000000000000000..72d18386323ed2b54cc281b63701fe9fbb64b5df Binary files /dev/null and b/TTS/Kokoro/.venv/Lib/site-packages/spacy/training/__pycache__/__init__.cpython-312.pyc differ diff --git a/TTS/Kokoro/.venv/Lib/site-packages/spacy/training/__pycache__/alignment.cpython-312.pyc b/TTS/Kokoro/.venv/Lib/site-packages/spacy/training/__pycache__/alignment.cpython-312.pyc new file mode 100644 index 0000000000000000000000000000000000000000..d6b9761073aa68d4a590fb06b0c7f3e9318a3775 Binary files /dev/null and b/TTS/Kokoro/.venv/Lib/site-packages/spacy/training/__pycache__/alignment.cpython-312.pyc differ diff --git a/TTS/Kokoro/.venv/Lib/site-packages/spacy/training/__pycache__/augment.cpython-312.pyc b/TTS/Kokoro/.venv/Lib/site-packages/spacy/training/__pycache__/augment.cpython-312.pyc new file mode 100644 index 0000000000000000000000000000000000000000..5674b2c6ea0b76ad2b1dc35d7a8e52de01fbe4b2 Binary files /dev/null and b/TTS/Kokoro/.venv/Lib/site-packages/spacy/training/__pycache__/augment.cpython-312.pyc differ diff --git a/TTS/Kokoro/.venv/Lib/site-packages/spacy/training/__pycache__/batchers.cpython-312.pyc b/TTS/Kokoro/.venv/Lib/site-packages/spacy/training/__pycache__/batchers.cpython-312.pyc new file mode 100644 index 0000000000000000000000000000000000000000..cd87c1c5d76aee17f3a6a039c7cd1836270867b8 Binary files /dev/null and b/TTS/Kokoro/.venv/Lib/site-packages/spacy/training/__pycache__/batchers.cpython-312.pyc differ diff --git a/TTS/Kokoro/.venv/Lib/site-packages/spacy/training/__pycache__/callbacks.cpython-312.pyc b/TTS/Kokoro/.venv/Lib/site-packages/spacy/training/__pycache__/callbacks.cpython-312.pyc new file mode 100644 index 0000000000000000000000000000000000000000..e24fea69927272604fdbf6fa0d17089131d94a24 Binary files /dev/null and b/TTS/Kokoro/.venv/Lib/site-packages/spacy/training/__pycache__/callbacks.cpython-312.pyc differ diff --git a/TTS/Kokoro/.venv/Lib/site-packages/spacy/training/__pycache__/corpus.cpython-312.pyc b/TTS/Kokoro/.venv/Lib/site-packages/spacy/training/__pycache__/corpus.cpython-312.pyc new file mode 100644 index 0000000000000000000000000000000000000000..68bf85039cdfe2c50a979febb11b55ad8581bc49 Binary files /dev/null and b/TTS/Kokoro/.venv/Lib/site-packages/spacy/training/__pycache__/corpus.cpython-312.pyc differ diff --git a/TTS/Kokoro/.venv/Lib/site-packages/spacy/training/__pycache__/initialize.cpython-312.pyc b/TTS/Kokoro/.venv/Lib/site-packages/spacy/training/__pycache__/initialize.cpython-312.pyc new file mode 100644 index 0000000000000000000000000000000000000000..86763695721554f752cc0f2b7a341ec0296e711e Binary files /dev/null and b/TTS/Kokoro/.venv/Lib/site-packages/spacy/training/__pycache__/initialize.cpython-312.pyc differ diff --git a/TTS/Kokoro/.venv/Lib/site-packages/spacy/training/__pycache__/iob_utils.cpython-312.pyc b/TTS/Kokoro/.venv/Lib/site-packages/spacy/training/__pycache__/iob_utils.cpython-312.pyc new file mode 100644 index 0000000000000000000000000000000000000000..f7a2a850a813d063f836b69e0d15a2d19dc99c8d Binary files /dev/null and b/TTS/Kokoro/.venv/Lib/site-packages/spacy/training/__pycache__/iob_utils.cpython-312.pyc differ diff --git a/TTS/Kokoro/.venv/Lib/site-packages/spacy/training/__pycache__/loggers.cpython-312.pyc b/TTS/Kokoro/.venv/Lib/site-packages/spacy/training/__pycache__/loggers.cpython-312.pyc new file mode 100644 index 0000000000000000000000000000000000000000..ed55b03733e2b07f6e40f9994f5c0a506a95ec0b Binary files /dev/null and b/TTS/Kokoro/.venv/Lib/site-packages/spacy/training/__pycache__/loggers.cpython-312.pyc differ diff --git a/TTS/Kokoro/.venv/Lib/site-packages/spacy/training/__pycache__/loop.cpython-312.pyc b/TTS/Kokoro/.venv/Lib/site-packages/spacy/training/__pycache__/loop.cpython-312.pyc new file mode 100644 index 0000000000000000000000000000000000000000..402e3e97163642493b5a2ba5572b5d014e1e17d3 Binary files /dev/null and b/TTS/Kokoro/.venv/Lib/site-packages/spacy/training/__pycache__/loop.cpython-312.pyc differ diff --git a/TTS/Kokoro/.venv/Lib/site-packages/spacy/training/__pycache__/pretrain.cpython-312.pyc b/TTS/Kokoro/.venv/Lib/site-packages/spacy/training/__pycache__/pretrain.cpython-312.pyc new file mode 100644 index 0000000000000000000000000000000000000000..acfff4e1d948851e8c5988b856da62bf39820d72 Binary files /dev/null and b/TTS/Kokoro/.venv/Lib/site-packages/spacy/training/__pycache__/pretrain.cpython-312.pyc differ diff --git a/TTS/Kokoro/.venv/Lib/site-packages/spacy/training/converters/__init__.py b/TTS/Kokoro/.venv/Lib/site-packages/spacy/training/converters/__init__.py new file mode 100644 index 0000000000000000000000000000000000000000..59ed3d4464d10340ca67c4f565b696a591b434f9 --- /dev/null +++ b/TTS/Kokoro/.venv/Lib/site-packages/spacy/training/converters/__init__.py @@ -0,0 +1,4 @@ +from .conll_ner_to_docs import conll_ner_to_docs # noqa: F401 +from .conllu_to_docs import conllu_to_docs # noqa: F401 +from .iob_to_docs import iob_to_docs # noqa: F401 +from .json_to_docs import json_to_docs # noqa: F401 diff --git a/TTS/Kokoro/.venv/Lib/site-packages/spacy/training/converters/__pycache__/__init__.cpython-312.pyc b/TTS/Kokoro/.venv/Lib/site-packages/spacy/training/converters/__pycache__/__init__.cpython-312.pyc new file mode 100644 index 0000000000000000000000000000000000000000..55dd53c63fbfd793c42d57881c5d8dc47ef52ef0 Binary files /dev/null and b/TTS/Kokoro/.venv/Lib/site-packages/spacy/training/converters/__pycache__/__init__.cpython-312.pyc differ diff --git a/TTS/Kokoro/.venv/Lib/site-packages/spacy/training/converters/__pycache__/conll_ner_to_docs.cpython-312.pyc b/TTS/Kokoro/.venv/Lib/site-packages/spacy/training/converters/__pycache__/conll_ner_to_docs.cpython-312.pyc new file mode 100644 index 0000000000000000000000000000000000000000..c59b812addbd3e3e71a2c113c9abb7608bd5af60 Binary files /dev/null and b/TTS/Kokoro/.venv/Lib/site-packages/spacy/training/converters/__pycache__/conll_ner_to_docs.cpython-312.pyc differ diff --git a/TTS/Kokoro/.venv/Lib/site-packages/spacy/training/converters/__pycache__/conllu_to_docs.cpython-312.pyc b/TTS/Kokoro/.venv/Lib/site-packages/spacy/training/converters/__pycache__/conllu_to_docs.cpython-312.pyc new file mode 100644 index 0000000000000000000000000000000000000000..c02df3d52585a1ab78b7c5b48cfd751c8b401948 Binary files /dev/null and b/TTS/Kokoro/.venv/Lib/site-packages/spacy/training/converters/__pycache__/conllu_to_docs.cpython-312.pyc differ diff --git a/TTS/Kokoro/.venv/Lib/site-packages/spacy/training/converters/__pycache__/iob_to_docs.cpython-312.pyc b/TTS/Kokoro/.venv/Lib/site-packages/spacy/training/converters/__pycache__/iob_to_docs.cpython-312.pyc new file mode 100644 index 0000000000000000000000000000000000000000..98b4565169c186a1fa81afb5f4ecd05400fc8f78 Binary files /dev/null and b/TTS/Kokoro/.venv/Lib/site-packages/spacy/training/converters/__pycache__/iob_to_docs.cpython-312.pyc differ diff --git a/TTS/Kokoro/.venv/Lib/site-packages/spacy/training/converters/__pycache__/json_to_docs.cpython-312.pyc b/TTS/Kokoro/.venv/Lib/site-packages/spacy/training/converters/__pycache__/json_to_docs.cpython-312.pyc new file mode 100644 index 0000000000000000000000000000000000000000..d85a82d2e8d48f6d6b2cc3eb6d13c39e68666f00 Binary files /dev/null and b/TTS/Kokoro/.venv/Lib/site-packages/spacy/training/converters/__pycache__/json_to_docs.cpython-312.pyc differ diff --git a/TTS/Kokoro/.venv/Lib/site-packages/spacy/training/converters/conll_ner_to_docs.py b/TTS/Kokoro/.venv/Lib/site-packages/spacy/training/converters/conll_ner_to_docs.py new file mode 100644 index 0000000000000000000000000000000000000000..f0ac2d4334869261697dabf25a319c51da9e11be --- /dev/null +++ b/TTS/Kokoro/.venv/Lib/site-packages/spacy/training/converters/conll_ner_to_docs.py @@ -0,0 +1,171 @@ +from wasabi import Printer + +from ...errors import Errors +from ...tokens import Doc, Span +from ...training import iob_to_biluo +from ...util import get_lang_class, load_model +from .. import tags_to_entities + + +def conll_ner_to_docs( + input_data, n_sents=10, seg_sents=False, model=None, no_print=False, **kwargs +): + """ + Convert files in the CoNLL-2003 NER format and similar + whitespace-separated columns into Doc objects. + + The first column is the tokens, the final column is the IOB tags. If an + additional second column is present, the second column is the tags. + + Sentences are separated with whitespace and documents can be separated + using the line "-DOCSTART- -X- O O". + + Sample format: + + -DOCSTART- -X- O O + + I O + like O + London B-GPE + and O + New B-GPE + York I-GPE + City I-GPE + . O + + """ + msg = Printer(no_print=no_print) + doc_delimiter = "-DOCSTART- -X- O O" + # check for existing delimiters, which should be preserved + if "\n\n" in input_data and seg_sents: + msg.warn( + "Sentence boundaries found, automatic sentence segmentation with " + "`-s` disabled." + ) + seg_sents = False + if doc_delimiter in input_data and n_sents: + msg.warn( + "Document delimiters found, automatic document segmentation with " + "`-n` disabled." + ) + n_sents = 0 + # do document segmentation with existing sentences + if "\n\n" in input_data and doc_delimiter not in input_data and n_sents: + n_sents_info(msg, n_sents) + input_data = segment_docs(input_data, n_sents, doc_delimiter) + # do sentence segmentation with existing documents + if "\n\n" not in input_data and doc_delimiter in input_data and seg_sents: + input_data = segment_sents_and_docs(input_data, 0, "", model=model, msg=msg) + # do both sentence segmentation and document segmentation according + # to options + if "\n\n" not in input_data and doc_delimiter not in input_data: + # sentence segmentation required for document segmentation + if n_sents > 0 and not seg_sents: + msg.warn( + f"No sentence boundaries found to use with option `-n {n_sents}`. " + f"Use `-s` to automatically segment sentences or `-n 0` " + f"to disable." + ) + else: + n_sents_info(msg, n_sents) + input_data = segment_sents_and_docs( + input_data, n_sents, doc_delimiter, model=model, msg=msg + ) + # provide warnings for problematic data + if "\n\n" not in input_data: + msg.warn( + "No sentence boundaries found. Use `-s` to automatically segment " + "sentences." + ) + if doc_delimiter not in input_data: + msg.warn( + "No document delimiters found. Use `-n` to automatically group " + "sentences into documents." + ) + + if model: + nlp = load_model(model) + else: + nlp = get_lang_class("xx")() + for conll_doc in input_data.strip().split(doc_delimiter): + conll_doc = conll_doc.strip() + if not conll_doc: + continue + words = [] + sent_starts = [] + pos_tags = [] + biluo_tags = [] + for conll_sent in conll_doc.split("\n\n"): + conll_sent = conll_sent.strip() + if not conll_sent: + continue + lines = [line.strip() for line in conll_sent.split("\n") if line.strip()] + cols = list(zip(*[line.split() for line in lines])) + if len(cols) < 2: + raise ValueError(Errors.E903) + length = len(cols[0]) + words.extend(cols[0]) + sent_starts.extend([True] + [False] * (length - 1)) + biluo_tags.extend(iob_to_biluo(cols[-1])) + pos_tags.extend(cols[1] if len(cols) > 2 else ["-"] * length) + + doc = Doc(nlp.vocab, words=words) + for i, token in enumerate(doc): + token.tag_ = pos_tags[i] + token.is_sent_start = sent_starts[i] + entities = tags_to_entities(biluo_tags) + doc.ents = [Span(doc, start=s, end=e + 1, label=L) for L, s, e in entities] + yield doc + + +def segment_sents_and_docs(doc, n_sents, doc_delimiter, model=None, msg=None): + sentencizer = None + if model: + nlp = load_model(model) + if "parser" in nlp.pipe_names: + msg.info(f"Segmenting sentences with parser from model '{model}'.") + for name, proc in nlp.pipeline: + if "parser" in getattr(proc, "listening_components", []): + nlp.replace_listeners(name, "parser", ["model.tok2vec"]) + sentencizer = nlp.get_pipe("parser") + if not sentencizer: + msg.info( + "Segmenting sentences with sentencizer. (Use `-b model` for " + "improved parser-based sentence segmentation.)" + ) + nlp = get_lang_class("xx")() + sentencizer = nlp.create_pipe("sentencizer") + lines = doc.strip().split("\n") + words = [line.strip().split()[0] for line in lines] + nlpdoc = Doc(nlp.vocab, words=words) + sentencizer(nlpdoc) + lines_with_segs = [] + sent_count = 0 + for i, token in enumerate(nlpdoc): + if token.is_sent_start: + if n_sents and sent_count % n_sents == 0: + lines_with_segs.append(doc_delimiter) + lines_with_segs.append("") + sent_count += 1 + lines_with_segs.append(lines[i]) + return "\n".join(lines_with_segs) + + +def segment_docs(input_data, n_sents, doc_delimiter): + sent_delimiter = "\n\n" + sents = input_data.split(sent_delimiter) + docs = [sents[i : i + n_sents] for i in range(0, len(sents), n_sents)] + input_data = "" + for doc in docs: + input_data += sent_delimiter + doc_delimiter + input_data += sent_delimiter.join(doc) + return input_data + + +def n_sents_info(msg, n_sents): + msg.info(f"Grouping every {n_sents} sentences into a document.") + if n_sents == 1: + msg.warn( + "To generate better training data, you may want to group " + "sentences into documents with `-n 10`." + ) diff --git a/TTS/Kokoro/.venv/Lib/site-packages/spacy/training/converters/conllu_to_docs.py b/TTS/Kokoro/.venv/Lib/site-packages/spacy/training/converters/conllu_to_docs.py new file mode 100644 index 0000000000000000000000000000000000000000..33f4e186890167ba2a99014853324832168eb281 --- /dev/null +++ b/TTS/Kokoro/.venv/Lib/site-packages/spacy/training/converters/conllu_to_docs.py @@ -0,0 +1,306 @@ +import re + +from wasabi import Printer + +from ...tokens import Doc, Span, Token +from ...training import biluo_tags_to_spans, iob_to_biluo +from ...vocab import Vocab +from .conll_ner_to_docs import n_sents_info + + +def conllu_to_docs( + input_data, + n_sents=10, + append_morphology=False, + ner_map=None, + merge_subtokens=False, + no_print=False, + **_ +): + """ + Convert conllu files into JSON format for use with train cli. + append_morphology parameter enables appending morphology to tags, which is + useful for languages such as Spanish, where UD tags are not so rich. + + Extract NER tags if available and convert them so that they follow + BILUO and the Wikipedia scheme + """ + MISC_NER_PATTERN = "^((?:name|NE)=)?([BILU])-([A-Z_]+)|O$" + msg = Printer(no_print=no_print) + n_sents_info(msg, n_sents) + sent_docs = read_conllx( + input_data, + append_morphology=append_morphology, + ner_tag_pattern=MISC_NER_PATTERN, + ner_map=ner_map, + merge_subtokens=merge_subtokens, + ) + sent_docs_to_merge = [] + for sent_doc in sent_docs: + sent_docs_to_merge.append(sent_doc) + if len(sent_docs_to_merge) % n_sents == 0: + yield Doc.from_docs(sent_docs_to_merge) + sent_docs_to_merge = [] + if sent_docs_to_merge: + yield Doc.from_docs(sent_docs_to_merge) + + +def has_ner(input_data, ner_tag_pattern): + """ + Check the MISC column for NER tags. + """ + for sent in input_data.strip().split("\n\n"): + lines = sent.strip().split("\n") + if lines: + while lines[0].startswith("#"): + lines.pop(0) + for line in lines: + parts = line.split("\t") + id_, word, lemma, pos, tag, morph, head, dep, _1, misc = parts + for misc_part in misc.split("|"): + if re.match(ner_tag_pattern, misc_part): + return True + return False + + +def read_conllx( + input_data, + append_morphology=False, + merge_subtokens=False, + ner_tag_pattern="", + ner_map=None, +): + """Yield docs, one for each sentence""" + vocab = Vocab() # need vocab to make a minimal Doc + set_ents = has_ner(input_data, ner_tag_pattern) + for sent in input_data.strip().split("\n\n"): + lines = sent.strip().split("\n") + if lines: + while lines[0].startswith("#"): + lines.pop(0) + doc = conllu_sentence_to_doc( + vocab, + lines, + ner_tag_pattern, + merge_subtokens=merge_subtokens, + append_morphology=append_morphology, + ner_map=ner_map, + set_ents=set_ents, + ) + yield doc + + +def get_entities(lines, tag_pattern, ner_map=None): + """Find entities in the MISC column according to the pattern and map to + final entity type with `ner_map` if mapping present. Entity tag is 'O' if + the pattern is not matched. + + lines (str): CONLL-U lines for one sentences + tag_pattern (str): Regex pattern for entity tag + ner_map (dict): Map old NER tag names to new ones, '' maps to O. + RETURNS (list): List of BILUO entity tags + """ + miscs = [] + for line in lines: + parts = line.split("\t") + id_, word, lemma, pos, tag, morph, head, dep, _1, misc = parts + if "-" in id_ or "." in id_: + continue + miscs.append(misc) + + iob = [] + for misc in miscs: + iob_tag = "O" + for misc_part in misc.split("|"): + tag_match = re.match(tag_pattern, misc_part) + if tag_match: + prefix = tag_match.group(2) + suffix = tag_match.group(3) + if prefix and suffix: + iob_tag = prefix + "-" + suffix + if ner_map: + suffix = ner_map.get(suffix, suffix) + if suffix == "": + iob_tag = "O" + else: + iob_tag = prefix + "-" + suffix + break + iob.append(iob_tag) + return iob_to_biluo(iob) + + +def conllu_sentence_to_doc( + vocab, + lines, + ner_tag_pattern, + merge_subtokens=False, + append_morphology=False, + ner_map=None, + set_ents=False, +): + """Create an Example from the lines for one CoNLL-U sentence, merging + subtokens and appending morphology to tags if required. + + lines (str): The non-comment lines for a CoNLL-U sentence + ner_tag_pattern (str): The regex pattern for matching NER in MISC col + RETURNS (Example): An example containing the annotation + """ + # create a Doc with each subtoken as its own token + # if merging subtokens, each subtoken orth is the merged subtoken form + if not Token.has_extension("merged_orth"): + Token.set_extension("merged_orth", default="") + if not Token.has_extension("merged_lemma"): + Token.set_extension("merged_lemma", default="") + if not Token.has_extension("merged_morph"): + Token.set_extension("merged_morph", default="") + if not Token.has_extension("merged_spaceafter"): + Token.set_extension("merged_spaceafter", default="") + words, spaces, tags, poses, morphs, lemmas = [], [], [], [], [], [] + heads, deps = [], [] + subtok_word = "" + in_subtok = False + for i in range(len(lines)): + line = lines[i] + parts = line.split("\t") + id_, word, lemma, pos, tag, morph, head, dep, _1, misc = parts + if "." in id_: + continue + if "-" in id_: + in_subtok = True + if "-" in id_: + in_subtok = True + subtok_word = word + subtok_start, subtok_end = id_.split("-") + subtok_spaceafter = "SpaceAfter=No" not in misc + continue + if merge_subtokens and in_subtok: + words.append(subtok_word) + else: + words.append(word) + if in_subtok: + if id_ == subtok_end: + spaces.append(subtok_spaceafter) + else: + spaces.append(False) + elif "SpaceAfter=No" in misc: + spaces.append(False) + else: + spaces.append(True) + if in_subtok and id_ == subtok_end: + subtok_word = "" + in_subtok = False + id_ = int(id_) - 1 + head = (int(head) - 1) if head not in ("0", "_") else id_ + tag = pos if tag == "_" else tag + pos = pos if pos != "_" else "" + morph = morph if morph != "_" else "" + dep = "ROOT" if dep == "root" else dep + lemmas.append(lemma) + poses.append(pos) + tags.append(tag) + morphs.append(morph) + heads.append(head) + deps.append(dep) + + doc = Doc( + vocab, + words=words, + spaces=spaces, + tags=tags, + pos=poses, + deps=deps, + lemmas=lemmas, + morphs=morphs, + heads=heads, + ) + for i in range(len(doc)): + doc[i]._.merged_orth = words[i] + doc[i]._.merged_morph = morphs[i] + doc[i]._.merged_lemma = lemmas[i] + doc[i]._.merged_spaceafter = spaces[i] + ents = None + if set_ents: + ents = get_entities(lines, ner_tag_pattern, ner_map) + doc.ents = biluo_tags_to_spans(doc, ents) + + if merge_subtokens: + doc = merge_conllu_subtokens(lines, doc) + + # create final Doc from custom Doc annotation + words, spaces, tags, morphs, lemmas, poses = [], [], [], [], [], [] + heads, deps = [], [] + for i, t in enumerate(doc): + words.append(t._.merged_orth) + lemmas.append(t._.merged_lemma) + spaces.append(t._.merged_spaceafter) + morphs.append(t._.merged_morph) + if append_morphology and t._.merged_morph: + tags.append(t.tag_ + "__" + t._.merged_morph) + else: + tags.append(t.tag_) + poses.append(t.pos_) + heads.append(t.head.i) + deps.append(t.dep_) + + doc_x = Doc( + vocab, + words=words, + spaces=spaces, + tags=tags, + morphs=morphs, + lemmas=lemmas, + pos=poses, + deps=deps, + heads=heads, + ) + if set_ents: + doc_x.ents = [ + Span(doc_x, ent.start, ent.end, label=ent.label) for ent in doc.ents + ] + + return doc_x + + +def merge_conllu_subtokens(lines, doc): + # identify and process all subtoken spans to prepare attrs for merging + subtok_spans = [] + for line in lines: + parts = line.split("\t") + id_, word, lemma, pos, tag, morph, head, dep, _1, misc = parts + if "-" in id_: + subtok_start, subtok_end = id_.split("-") + subtok_span = doc[int(subtok_start) - 1 : int(subtok_end)] + subtok_spans.append(subtok_span) + # create merged tag, morph, and lemma values + tags = [] + morphs = {} + lemmas = [] + for token in subtok_span: + tags.append(token.tag_) + lemmas.append(token.lemma_) + if token._.merged_morph: + for feature in token._.merged_morph.split("|"): + field, values = feature.split("=", 1) + if field not in morphs: + morphs[field] = set() + for value in values.split(","): + morphs[field].add(value) + # create merged features for each morph field + for field, values in morphs.items(): + morphs[field] = field + "=" + ",".join(sorted(values)) + # set the same attrs on all subtok tokens so that whatever head the + # retokenizer chooses, the final attrs are available on that token + for token in subtok_span: + token._.merged_orth = token.orth_ + token._.merged_lemma = " ".join(lemmas) + token.tag_ = "_".join(tags) + token._.merged_morph = "|".join(sorted(morphs.values())) + token._.merged_spaceafter = ( + True if subtok_span[-1].whitespace_ else False + ) + + with doc.retokenize() as retokenizer: + for span in subtok_spans: + retokenizer.merge(span) + + return doc diff --git a/TTS/Kokoro/.venv/Lib/site-packages/spacy/training/converters/iob_to_docs.py b/TTS/Kokoro/.venv/Lib/site-packages/spacy/training/converters/iob_to_docs.py new file mode 100644 index 0000000000000000000000000000000000000000..73f8c2428905527b7d13f9e517265fdf7b854c6d --- /dev/null +++ b/TTS/Kokoro/.venv/Lib/site-packages/spacy/training/converters/iob_to_docs.py @@ -0,0 +1,62 @@ +from wasabi import Printer + +from ...errors import Errors +from ...tokens import Doc, Span +from ...training import iob_to_biluo, tags_to_entities +from ...util import minibatch +from ...vocab import Vocab +from .conll_ner_to_docs import n_sents_info + + +def iob_to_docs(input_data, n_sents=10, no_print=False, *args, **kwargs): + """ + Convert IOB files with one sentence per line and tags separated with '|' + into Doc objects so they can be saved. IOB and IOB2 are accepted. + + Sample formats: + + I|O like|O London|I-GPE and|O New|B-GPE York|I-GPE City|I-GPE .|O + I|O like|O London|B-GPE and|O New|B-GPE York|I-GPE City|I-GPE .|O + I|PRP|O like|VBP|O London|NNP|I-GPE and|CC|O New|NNP|B-GPE York|NNP|I-GPE City|NNP|I-GPE .|.|O + I|PRP|O like|VBP|O London|NNP|B-GPE and|CC|O New|NNP|B-GPE York|NNP|I-GPE City|NNP|I-GPE .|.|O + """ + vocab = Vocab() # need vocab to make a minimal Doc + msg = Printer(no_print=no_print) + if n_sents > 0: + n_sents_info(msg, n_sents) + yield from read_iob(input_data.split("\n"), vocab, n_sents) + + +def read_iob(raw_sents, vocab, n_sents): + for group in minibatch(raw_sents, size=n_sents): + tokens = [] + words = [] + tags = [] + iob = [] + sent_starts = [] + for line in group: + if not line.strip(): + continue + sent_tokens = [t.split("|") for t in line.split()] + if len(sent_tokens[0]) == 3: + sent_words, sent_tags, sent_iob = zip(*sent_tokens) + elif len(sent_tokens[0]) == 2: + sent_words, sent_iob = zip(*sent_tokens) + sent_tags = ["-"] * len(sent_words) + else: + raise ValueError(Errors.E902) + words.extend(sent_words) + tags.extend(sent_tags) + iob.extend(sent_iob) + tokens.extend(sent_tokens) + sent_starts.append(True) + sent_starts.extend([False for _ in sent_words[1:]]) + doc = Doc(vocab, words=words) + for i, tag in enumerate(tags): + doc[i].tag_ = tag + for i, sent_start in enumerate(sent_starts): + doc[i].is_sent_start = sent_start + biluo = iob_to_biluo(iob) + entities = tags_to_entities(biluo) + doc.ents = [Span(doc, start=s, end=e + 1, label=L) for (L, s, e) in entities] + yield doc diff --git a/TTS/Kokoro/.venv/Lib/site-packages/spacy/training/converters/json_to_docs.py b/TTS/Kokoro/.venv/Lib/site-packages/spacy/training/converters/json_to_docs.py new file mode 100644 index 0000000000000000000000000000000000000000..08ee63304d1f55f7c075b590c4e65126a0db6fb9 --- /dev/null +++ b/TTS/Kokoro/.venv/Lib/site-packages/spacy/training/converters/json_to_docs.py @@ -0,0 +1,24 @@ +import srsly + +from ...lang.xx import MultiLanguage +from ...util import load_model +from ..example import ( + _fix_legacy_dict_data, + _parse_example_dict_data, + annotations_to_doc, +) +from ..gold_io import json_iterate, json_to_annotations + + +def json_to_docs(input_data, model=None, **kwargs): + nlp = load_model(model) if model is not None else MultiLanguage() + if not isinstance(input_data, bytes): + if not isinstance(input_data, str): + input_data = srsly.json_dumps(input_data) + input_data = input_data.encode("utf8") + for json_doc in json_iterate(input_data): + for json_para in json_to_annotations(json_doc): + example_dict = _fix_legacy_dict_data(json_para) + tok_dict, doc_dict = _parse_example_dict_data(example_dict) + doc = annotations_to_doc(nlp.vocab, tok_dict, doc_dict) + yield doc diff --git a/TTS/Kokoro/.venv/Lib/site-packages/spacy_curated_transformers-0.3.1.dist-info/licenses/LICENSE b/TTS/Kokoro/.venv/Lib/site-packages/spacy_curated_transformers-0.3.1.dist-info/licenses/LICENSE new file mode 100644 index 0000000000000000000000000000000000000000..343b5417ecc47d5de2e3905a88765c0e9a0228f8 --- /dev/null +++ b/TTS/Kokoro/.venv/Lib/site-packages/spacy_curated_transformers-0.3.1.dist-info/licenses/LICENSE @@ -0,0 +1,21 @@ +The MIT License (MIT) + +Copyright (C) 2021-2023 ExplosionAI GmbH + +Permission is hereby granted, free of charge, to any person obtaining a copy +of this software and associated documentation files (the "Software"), to deal +in the Software without restriction, including without limitation the rights +to use, copy, modify, merge, publish, distribute, sublicense, and/or sell +copies of the Software, and to permit persons to whom the Software is +furnished to do so, subject to the following conditions: + +The above copyright notice and this permission notice shall be included in +all copies or substantial portions of the Software. + +THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR +IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY, +FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE +AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER +LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, +OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN +THE SOFTWARE. diff --git a/TTS/Kokoro/.venv/Lib/site-packages/spacy_curated_transformers/__pycache__/__init__.cpython-312.pyc b/TTS/Kokoro/.venv/Lib/site-packages/spacy_curated_transformers/__pycache__/__init__.cpython-312.pyc new file mode 100644 index 0000000000000000000000000000000000000000..4f1764612254572d8216d92adaf67902f695e353 Binary files /dev/null and b/TTS/Kokoro/.venv/Lib/site-packages/spacy_curated_transformers/__pycache__/__init__.cpython-312.pyc differ diff --git a/TTS/Kokoro/.venv/Lib/site-packages/spacy_curated_transformers/__pycache__/_compat.cpython-312.pyc b/TTS/Kokoro/.venv/Lib/site-packages/spacy_curated_transformers/__pycache__/_compat.cpython-312.pyc new file mode 100644 index 0000000000000000000000000000000000000000..024666ffc2be0e3aaea0f233107beff23bb67d11 Binary files /dev/null and b/TTS/Kokoro/.venv/Lib/site-packages/spacy_curated_transformers/__pycache__/_compat.cpython-312.pyc differ diff --git a/TTS/Kokoro/.venv/Lib/site-packages/spacy_curated_transformers/__pycache__/util.cpython-312.pyc b/TTS/Kokoro/.venv/Lib/site-packages/spacy_curated_transformers/__pycache__/util.cpython-312.pyc new file mode 100644 index 0000000000000000000000000000000000000000..9b9e4552c0a3fb1a6e16780d26906f7e323b0909 Binary files /dev/null and b/TTS/Kokoro/.venv/Lib/site-packages/spacy_curated_transformers/__pycache__/util.cpython-312.pyc differ diff --git a/TTS/Kokoro/.venv/Lib/site-packages/spacy_curated_transformers/cli/__init__.py b/TTS/Kokoro/.venv/Lib/site-packages/spacy_curated_transformers/cli/__init__.py new file mode 100644 index 0000000000000000000000000000000000000000..e69de29bb2d1d6434b8b29ae775ad8c2e48c5391 diff --git a/TTS/Kokoro/.venv/Lib/site-packages/spacy_curated_transformers/cli/__pycache__/__init__.cpython-312.pyc b/TTS/Kokoro/.venv/Lib/site-packages/spacy_curated_transformers/cli/__pycache__/__init__.cpython-312.pyc new file mode 100644 index 0000000000000000000000000000000000000000..27eb2345f401bc898d2ce45e2fc5e009c176b780 Binary files /dev/null and b/TTS/Kokoro/.venv/Lib/site-packages/spacy_curated_transformers/cli/__pycache__/__init__.cpython-312.pyc differ diff --git a/TTS/Kokoro/.venv/Lib/site-packages/spacy_curated_transformers/cli/__pycache__/debug_pieces.cpython-312.pyc b/TTS/Kokoro/.venv/Lib/site-packages/spacy_curated_transformers/cli/__pycache__/debug_pieces.cpython-312.pyc new file mode 100644 index 0000000000000000000000000000000000000000..814dd5532bb3020af1f57a73bb2dc22bc348d936 Binary files /dev/null and b/TTS/Kokoro/.venv/Lib/site-packages/spacy_curated_transformers/cli/__pycache__/debug_pieces.cpython-312.pyc differ diff --git a/TTS/Kokoro/.venv/Lib/site-packages/spacy_curated_transformers/cli/__pycache__/fill_config_transformer.cpython-312.pyc b/TTS/Kokoro/.venv/Lib/site-packages/spacy_curated_transformers/cli/__pycache__/fill_config_transformer.cpython-312.pyc new file mode 100644 index 0000000000000000000000000000000000000000..5b7ff850f53052e4d18d11fc519148d3c12e8c1b Binary files /dev/null and b/TTS/Kokoro/.venv/Lib/site-packages/spacy_curated_transformers/cli/__pycache__/fill_config_transformer.cpython-312.pyc differ diff --git a/TTS/Kokoro/.venv/Lib/site-packages/spacy_curated_transformers/cli/debug_pieces.py b/TTS/Kokoro/.venv/Lib/site-packages/spacy_curated_transformers/cli/debug_pieces.py new file mode 100644 index 0000000000000000000000000000000000000000..6c0d460196ae1d12630ff8471214865e521abf70 --- /dev/null +++ b/TTS/Kokoro/.venv/Lib/site-packages/spacy_curated_transformers/cli/debug_pieces.py @@ -0,0 +1,114 @@ +from pathlib import Path +from typing import Any, Dict, List, Optional, cast + +import numpy +from spacy import util +from spacy.cli._util import ( + debug_cli, + import_code, + parse_config_overrides, + show_validation_error, +) +from spacy.schemas import ConfigSchemaTraining +from spacy.tokens import Doc +from spacy.util import registry, resolve_dot_names +from typer import Argument as Arg +from typer import Context +from typer import Option as Opt +from wasabi import Printer, msg + +from ..pipeline.transformer import CuratedTransformer +from ..tokenization.types import Tok2PiecesModelT + + +@debug_cli.command( + "pieces", + context_settings={"allow_extra_args": True, "ignore_unknown_options": True}, +) +def debug_pieces_cli( + # fmt: off + ctx: Context, # This is only used to read additional arguments + config_path: Path = Arg(..., help="Path to config file", exists=True, allow_dash=True), + code_path: Optional[Path] = Opt(None, "--code-path", "--code", "-c", help="Path to Python file with additional code (registered functions) to be imported"), + transformer_name: Optional[str] = Opt(None, "--name", "-n", help="Name of the transformer pipe to gather piece statistics for (default: first transformer pipe)."), + # fmt: on +): + """ + Analyze word- or sentencepiece statistics. + DOCS: https://spacy.io/api/cli#debug-pieces + """ + overrides = parse_config_overrides(ctx.args) + import_code(code_path) + debug_pieces( + config_path, + config_overrides=overrides, + transformer_name=transformer_name, + ) + + +def debug_pieces( + config_path: Path, + *, + config_overrides: Dict[str, Any] = {}, + transformer_name: Optional[str] = None, +): + msg = Printer() + + with show_validation_error(config_path): + cfg = util.load_config(config_path, overrides=config_overrides) + nlp = util.load_model_from_config(cfg, auto_fill=True) + config = nlp.config.interpolate() + T = registry.resolve(config["training"], schema=ConfigSchemaTraining) + + dot_names = [T["train_corpus"], T["dev_corpus"]] + train_corpus, dev_corpus = resolve_dot_names(config, dot_names) + + nlp.initialize(lambda: train_corpus(nlp)) + + if transformer_name is None: + transformers = [ + pipe for _, pipe in nlp.pipeline if isinstance(pipe, CuratedTransformer) + ] + if not transformers: + msg.fail("Pipeline does not contain transformer", exits=1) + transformer_pipe = transformers[0] + else: + # We have to dance a bit around that MyPy cannot infer that we are + # exiting if the invariants don't hold and that get_pipe returns + # Callable. + try: + transformer_pipe_callable = nlp.get_pipe(transformer_name) + except KeyError: + transformer_pipe_callable = None + msg.fail( + f"Pipeline does not contain a pipe named '{transformer_name}'", exits=1 + ) + if not isinstance(transformer_pipe_callable, CuratedTransformer): + msg.fail(f"Pipe named '{transformer_name}' is not a transformer", exits=1) + transformer_pipe = cast(CuratedTransformer, transformer_pipe_callable) + + piece_encoder = transformer_pipe.model.get_ref("piece_encoder") + msg.info(f"Found piece encoder: {piece_encoder.name}") + + train_docs = [eg.predicted for eg in train_corpus(nlp)] + dev_docs = [eg.predicted for eg in dev_corpus(nlp)] + + msg.divider(f"Training corpus statistics") + print_piece_stats(piece_encoder, train_docs) + msg.divider(f"Development corpus statistics") + print_piece_stats(piece_encoder, dev_docs) + + +def print_piece_stats(piece_encoder: Tok2PiecesModelT, docs: List[Doc]): + docs_pieces = piece_encoder.predict(docs) + + lens = [] + for doc_pieces in docs_pieces: + doc_piece_lens = doc_pieces.lengths + lens.extend(doc_piece_lens.tolist()) + + lens_xp = numpy.array(lens) + + msg.text(f"Median token length: {numpy.median(lens_xp)}") + msg.text(f"Mean token length: {numpy.mean(lens_xp):.2f}") + msg.text(f"Token length range: [{lens_xp.min()}, {lens_xp.max()}]") diff --git a/TTS/Kokoro/.venv/Lib/site-packages/spacy_curated_transformers/cli/fill_config_transformer.py b/TTS/Kokoro/.venv/Lib/site-packages/spacy_curated_transformers/cli/fill_config_transformer.py new file mode 100644 index 0000000000000000000000000000000000000000..d8c58e4bb31c246beff22c110e712d57d1a7a0f2 --- /dev/null +++ b/TTS/Kokoro/.venv/Lib/site-packages/spacy_curated_transformers/cli/fill_config_transformer.py @@ -0,0 +1,480 @@ +import json +import sys +from enum import Enum +from pathlib import Path +from typing import Any, Dict, Optional, Tuple + +from confection import Config +from spacy import util +from spacy.cli._util import import_code, init_cli, parse_config_overrides +from spacy.cli.init_config import save_config +from typer import Argument as Arg +from typer import Context +from typer import Option as Opt +from wasabi import Printer + +from .._compat import has_hf_transformers, has_huggingface_hub + + +@init_cli.command( + "fill-curated-transformer", + context_settings={"allow_extra_args": True, "ignore_unknown_options": False}, +) +def init_fill_curated_transformer_cli( + # fmt: off + ctx: Context, # This is only used to read additional arguments + base_path: Path = Arg(..., help="Path to the base config file to fill", exists=True, allow_dash=True, dir_okay=False), + output_path: Path = Arg("-", help="Path to output .cfg file or '-' for stdout (default: stdout)", exists=False, allow_dash=True), + model_name: Optional[str] = Opt(None, "--model-name", "-m", help="Name of the Hugging Face model. If not provided, the model name will be read in from the encoder loader config"), + model_revision: Optional[str] = Opt(None, "--model-revision", "-r", help="Revision of the Hugging Face model (default: 'main')."), + transformer_name: Optional[str] = Opt(None, "--pipe-name", "-n", help="Name of the transformer pipe whose config is to be filled (default: first transformer pipe)."), + code_path: Optional[Path] = Opt(None, "--code-path", "--code", "-c", help="Path to Python file with additional code (registered functions) to be imported"), + # fmt: on +): + """ + Fill Curated Transformer parameters from HF Hub. + + DOCS: https://spacy.io/api/cli#init-fill-curated-transformer + """ + overrides = parse_config_overrides(ctx.args) + import_code(code_path) + init_fill_config_curated_transformer( + base_path, + output_path, + cli_model_name=model_name, + cli_model_revision=model_revision, + cli_transformer_name=transformer_name, + config_overrides=overrides, + ) + + +CURATED_TRANSFORMER_TO_HF_MODEL_TYPE: Dict[str, str] = { + "AlbertTransformer": "albert", + "BertTransformer": "bert", + "CamembertTransformer": "camembert", + "RobertaTransformer": "roberta", + "XlmrTransformer": "xlm-roberta", +} + +HF_MODEL_TYPE_TO_EXAMPLE_MODELS: Dict[str, str] = { + "albert": "albert-base-v2", + "bert": "bert-base-cased", + "camembert": "camembert/camembert-base", + "roberta": "roberta-base", + "xlm-roberta": "xlm-roberta-base", +} + + +class HfParamSource(Enum): + MODEL_CONFIG = 1 + TOKENIZER_CONFIG = 2 + + +# Entrypoint parameters that are common to all curated transformer models. +COMMON_ENTRYPOINT_PARAMS: Dict[str, HfParamSource] = { + "attention_probs_dropout_prob": HfParamSource.MODEL_CONFIG, + "hidden_act": HfParamSource.MODEL_CONFIG, + "hidden_dropout_prob": HfParamSource.MODEL_CONFIG, + "hidden_width": HfParamSource.MODEL_CONFIG, + "intermediate_width": HfParamSource.MODEL_CONFIG, + "layer_norm_eps": HfParamSource.MODEL_CONFIG, + "max_position_embeddings": HfParamSource.MODEL_CONFIG, + "num_attention_heads": HfParamSource.MODEL_CONFIG, + "num_hidden_layers": HfParamSource.MODEL_CONFIG, + "padding_idx": HfParamSource.MODEL_CONFIG, + "type_vocab_size": HfParamSource.MODEL_CONFIG, + "vocab_size": HfParamSource.MODEL_CONFIG, + "model_max_length": HfParamSource.TOKENIZER_CONFIG, +} + +MODEL_SPECIFIC_ENTRYPOINT_PARAMS: Dict[str, Dict[str, HfParamSource]] = { + "albert": { + "embedding_width": HfParamSource.MODEL_CONFIG, + "num_hidden_groups": HfParamSource.MODEL_CONFIG, + } +} + +ENTRYPOINT_PARAMS_TO_HF_CONFIG_KEYS: Dict[str, str] = { + "hidden_width": "hidden_size", + "intermediate_width": "intermediate_size", + "padding_idx": "pad_token_id", + "embedding_width": "embedding_size", +} + + +class ModelSource(Enum): + CliArgument = 1 + Loader = 2 + + +def init_fill_config_curated_transformer( + config_path: Path, + output_path: Path, + cli_model_name: Optional[str], + cli_model_revision: Optional[str], + cli_transformer_name: Optional[str], + config_overrides: Dict[str, Any], +): + msg = Printer() + _validate_hf_packages(msg) + + config = util.load_config(config_path, overrides=config_overrides) + + transformer_name = _resolve_curated_trf_pipe_name(msg, config, cli_transformer_name) + model_src = _resolve_model_source(msg, cli_model_name, cli_model_revision) + model_name, model_revision = _resolve_model_name_and_revision( + msg, config, model_src, cli_model_name, cli_model_revision, transformer_name + ) + + hf_model_type = _lookup_hf_model_type_for_curated_architecture( + msg, config, transformer_name + ) + hf_config = _get_hf_model_config(msg, model_name, model_revision) + _validate_hf_model_type(msg, hf_config, hf_model_type, transformer_name) + + params_to_fill = COMMON_ENTRYPOINT_PARAMS.copy() + params_to_fill.update(MODEL_SPECIFIC_ENTRYPOINT_PARAMS.get(hf_model_type, {})) + hf_tokenizer = _load_hf_tokenizer(model_name, model_revision, msg) + + filled_params = _fill_parameters(msg, params_to_fill, hf_config, hf_tokenizer) + + # Update transformer model config with the filled params. + trf_config = config["components"][transformer_name]["model"] + trf_config.update(filled_params) + + if model_src == ModelSource.CliArgument: + # Overwrite the encoder and piecer loader configs. + _save_encoder_loader_config( + msg, config, transformer_name, model_name, model_revision + ) + _save_piecer_loader_config( + msg, config, transformer_name, model_name, model_revision, overwrite=True + ) + else: + # Only fill in the piecer loader config if it's not present. + _save_piecer_loader_config( + msg, config, transformer_name, model_name, model_revision, overwrite=False + ) + + is_stdout = str(output_path) == "-" + if is_stdout: + msg.info(title="\n\nOutput:") + save_config(config, output_path, is_stdout=is_stdout, silent=is_stdout) + + +def _validate_hf_packages(msg: Printer): + if not has_huggingface_hub or not has_hf_transformers: + msg.fail( + "This command requires the `huggingface-hub` and `transformers` packages to be installed", + exits=1, + ) + + +def _resolve_model_source( + msg: Printer, + cli_model_name: Optional[str], + cli_model_revision: Optional[str], +) -> ModelSource: + if cli_model_name is None and cli_model_revision is not None: + msg.fail( + "The model revision command-line argument must be accompanied by the model name argument", + exits=1, + ) + + if cli_model_name is None: + return ModelSource.Loader + else: + return ModelSource.CliArgument + + +def _resolve_curated_trf_pipe_name( + msg: Printer, config: Config, cli_transformer_name: Optional[str] +) -> str: + if cli_transformer_name is None: + components = config["components"] + transformers = [ + name + for name, config in components.items() + if config["factory"] == "curated_transformer" + ] + if not transformers: + msg.fail( + "Pipeline config does not contain a Curated Transformer component", + exits=1, + ) + transformer_name = transformers[0] + else: + transformer_name = cli_transformer_name + msg.info(f"Updating config for Curated Transformer pipe '{transformer_name}'") + return transformer_name + + +def _resolve_model_name_and_revision( + msg: Printer, + config: Config, + model_src: ModelSource, + cli_model_name: Optional[str], + cli_model_revision: Optional[str], + transformer_name: str, +) -> Tuple[str, str]: + try: + loader_config = config["initialize"]["components"][transformer_name][ + "encoder_loader" + ] + assert "HFTransformerEncoderLoader" in loader_config["@model_loaders"] + except (KeyError, AssertionError): + loader_config = None + + if model_src == ModelSource.CliArgument: + assert cli_model_name is not None + + model_name = cli_model_name + model_revision = ( + cli_model_revision if cli_model_revision is not None else "main" + ) + if cli_model_revision is None: + msg.warn("Using default model revision") + msg.info( + title=f"Using provided Hugging Face model name and {'default ' if cli_model_revision is None else ''}revision:", + text=f"{model_name} ({model_revision})", + ) + else: + msg.info(f"Looking up Hugging Face model name and revision in loader config...") + if loader_config is None or loader_config.get("name") is None: # type: ignore + msg.fail( + "Pipeline config does not have a valid model loader configuration " + f"for the '{transformer_name}' Curated Transformer component. You can " + "provide the '--model-name' and '--model-revision' command-line " + "arguments to automatically fill in the loader configuration.", + exits=1, + ) + assert loader_config is not None + + model_name = loader_config["name"] + model_revision = loader_config.get("revision", "main") + msg.info( + title="Using loader Hugging Face model name and revision:", + text=f"{model_name} ({model_revision})", + ) + + return model_name, model_revision + + +def _lookup_hf_model_type_for_curated_architecture( + msg: Printer, config: Config, transformer_name: str +) -> str: + try: + transformer = config["components"][transformer_name]["model"] + trf_arch_splits = transformer["@architectures"].split(".") + assert len(trf_arch_splits) == 3 and trf_arch_splits[-2].endswith("Transformer") + curated_arch = trf_arch_splits[-2] + except (KeyError, AssertionError): + msg.fail( + "Pipeline config does not have a valid model architecture for " + f"the '{transformer_name}' Curated Transformer component", + exits=1, + ) + + hf_model_type = CURATED_TRANSFORMER_TO_HF_MODEL_TYPE.get(curated_arch) + if hf_model_type is None: + msg.fail( + "Missing Hugging Face model type for Curated Transformer " + f"model architecture '{curated_arch}'", + exits=1, + ) + assert hf_model_type is not None + return hf_model_type + + +def _validate_hf_model_type( + msg: Printer, + hf_config: Dict[str, Any], + expected_model_type: str, + transformer_name: str, +): + incoming_hf_model_type = hf_config["model_type"] + if incoming_hf_model_type != expected_model_type: + hf_model_type_to_curated_arch = { + v: k for k, v in CURATED_TRANSFORMER_TO_HF_MODEL_TYPE.items() + } + + if incoming_hf_model_type not in CURATED_TRANSFORMER_TO_HF_MODEL_TYPE.values(): + msg.fail( + f"Hugging Face model of type '{incoming_hf_model_type}' cannot be loaded into " + f"Curated Transformer pipe '{transformer_name}' of type '{expected_model_type}' - " + "It is not supported by `spacy-curated-transformers`. The " + f"`{hf_model_type_to_curated_arch[expected_model_type]}` architecture " + f"expects a Hugging Face model of type '{expected_model_type}'.", + exits=1, + ) + else: + expected_arch = hf_model_type_to_curated_arch[incoming_hf_model_type] + msg.fail( + f"Hugging Face model of type '{incoming_hf_model_type}' cannot be loaded into " + f"Curated Transformer pipe '{transformer_name}' of type '{expected_model_type}' - " + f"Change the 'components.{transformer_name}.model.@architectures' entrypoint " + f"to use the '{expected_arch}' architecture. Alternatively, use a different " + f"model with the current architecuture, e.g: '{HF_MODEL_TYPE_TO_EXAMPLE_MODELS[expected_model_type]}'.", + exits=1, + ) + + +def _fill_parameters( + msg: Printer, + params_to_fill: Dict[str, HfParamSource], + hf_config: Dict[str, Any], + hf_tokenizer: Any, +) -> Dict[str, Any]: + filled_params = {} + for param_name, source in params_to_fill.items(): + hf_key = ENTRYPOINT_PARAMS_TO_HF_CONFIG_KEYS.get(param_name, param_name) + if source == HfParamSource.MODEL_CONFIG: + value = hf_config.get(hf_key) + if value is None: + msg.fail( + f"Hugging Face model config has a missing key '{hf_key}'", exits=1 + ) + elif source == HfParamSource.TOKENIZER_CONFIG: + value = getattr(hf_tokenizer, hf_key, None) + if value is None: + msg.fail( + f"Hugging Face tokenizer config has a missing key '{hf_key}'", + exits=1, + ) + assert value is not None + filled_params[param_name] = value + + msg.info(title="Filled-in model parameters:") + msg.table(filled_params) + + return dict(sorted(filled_params.items(), key=lambda item: item[0])) + + +def _create_intermediate_configs(config: Config, dot_path: str): + splits = dot_path.split(".") + current = config + while splits: + name = splits[0] + if name not in current: + current[name] = {} + current = current[name] + splits = splits[1:] + + +def _save_encoder_loader_config( + msg: Printer, + config: Config, + transformer_name: str, + model_name: str, + model_revision: str, +): + _create_intermediate_configs( + config, f"initialize.components.{transformer_name}.encoder_loader" + ) + inner = config["initialize"]["components"][transformer_name]["encoder_loader"] + if inner: + msg.warn(f"Overwriting transformer encoder loader config") + inner.clear() + + inner.update( + { + "@model_loaders": "spacy-curated-transformers.HFTransformerEncoderLoader.v1", + "name": model_name, + "revision": model_revision, + } + ) + + +def _save_piecer_loader_config( + msg: Printer, + config: Config, + transformer_name: str, + model_name: str, + model_revision: str, + *, + overwrite: bool, +): + _create_intermediate_configs( + config, f"initialize.components.{transformer_name}.piecer_loader" + ) + inner = config["initialize"]["components"][transformer_name]["piecer_loader"] + if inner: + if overwrite: + msg.warn(f"Overwriting piece encoder loader config") + inner.clear() + else: + arch = inner.get("@model_loaders") + if ( + arch == "spacy-curated-transformers.HFPieceEncoderLoader.v1" + and inner["name"] == model_name + and inner.get("revision", "main") == model_revision + ): + return + + msg.warn( + f"Existing piece encoder loader might not be compatible with model '{model_name}'" + ) + return + + inner.update( + { + "@model_loaders": "spacy-curated-transformers.HFPieceEncoderLoader.v1", + "name": model_name, + "revision": model_revision, + } + ) + + +def _get_hf_model_config(msg: Printer, name: str, revision: str) -> Dict[str, Any]: + from huggingface_hub import hf_hub_download + + try: + config_path = hf_hub_download( + repo_id=name, filename="config.json", revision=revision + ) + except BaseException as e: + msg.fail( + f"Couldn't fetch the model configuration for model name '{name}' " + f"(revision: {revision}). Ensure that the model name and revision " + "are correct." + ) + msg.fail(f"Exception: {e}", exits=1) + + with open(config_path, encoding="utf-8") as f: + return json.load(f) + + +def _load_hf_tokenizer(model_name: str, model_revision: str, msg: Printer) -> Any: + # The entry point params that we need to fetch from the upstream HF tokenizer + # are not consistently serialized across all available models. So, we'll just + # load the tokenizer using the `transformers` library and directly read the params + # from the instance. + from transformers import AutoTokenizer + + try: + hf_tokenizer = AutoTokenizer.from_pretrained( + model_name, revision=model_revision + ) + + # The `model_max_length` value can sometimes be set to a very large integer + # if the model doesn't have an upperbound on its input length. Saving this + # as-is to the config will raise an error during serialization. So, we'll + # try to look up the correct value manually. If we don't find one, fallback + # to a smaller (large) value that can be serialized correctly. + # cf: https://github.com/huggingface/transformers/blob/224da5df6956340a5c680e5b57b4914d4d7298b6/src/transformers/tokenization_utils_base.py#L104 + if hf_tokenizer.model_max_length == int(1e30): + hf_tokenizer.model_max_length = 2147483647 + if getattr(hf_tokenizer, "max_model_input_sizes", None) is not None: + model_name_splits = model_name.split("/") + if len(model_name_splits) != 0: + model_name = model_name_splits[-1] + model_max_length = hf_tokenizer.max_model_input_sizes.get(model_name) + if model_max_length is not None: + hf_tokenizer.model_max_length = model_max_length + except BaseException as e: + msg.fail( + f"Couldn't load Hugging Face tokenizer '{model_name}' ('{model_revision}') - Error:\n{e}", + exits=1, + ) + + return hf_tokenizer diff --git a/TTS/Kokoro/.venv/Lib/site-packages/spacy_curated_transformers/models/__init__.py b/TTS/Kokoro/.venv/Lib/site-packages/spacy_curated_transformers/models/__init__.py new file mode 100644 index 0000000000000000000000000000000000000000..e7a9a69dc509cd6fdda280b5095bac24834b953e --- /dev/null +++ b/TTS/Kokoro/.venv/Lib/site-packages/spacy_curated_transformers/models/__init__.py @@ -0,0 +1,11 @@ +from .architectures import ( + build_albert_transformer_model_v1, + build_bert_transformer_model_v1, + build_camembert_transformer_model_v1, + build_pytorch_checkpoint_loader_v1, + build_roberta_transformer_model_v1, + build_xlmr_transformer_model_v1, +) +from .hf_loader import build_hf_transformer_encoder_loader_v1 +from .scalar_weight import build_scalar_weight_v1 +from .with_strided_spans import build_with_strided_spans_v1 diff --git a/TTS/Kokoro/.venv/Lib/site-packages/spacy_curated_transformers/models/__pycache__/__init__.cpython-312.pyc b/TTS/Kokoro/.venv/Lib/site-packages/spacy_curated_transformers/models/__pycache__/__init__.cpython-312.pyc new file mode 100644 index 0000000000000000000000000000000000000000..934098d2a7b53d3dd6b6b4b07a0f227429600629 Binary files /dev/null and b/TTS/Kokoro/.venv/Lib/site-packages/spacy_curated_transformers/models/__pycache__/__init__.cpython-312.pyc differ diff --git a/TTS/Kokoro/.venv/Lib/site-packages/spacy_curated_transformers/models/__pycache__/architectures.cpython-312.pyc b/TTS/Kokoro/.venv/Lib/site-packages/spacy_curated_transformers/models/__pycache__/architectures.cpython-312.pyc new file mode 100644 index 0000000000000000000000000000000000000000..0e17fd56f3d63e528cd283c45c2b2a745c5ab48e Binary files /dev/null and b/TTS/Kokoro/.venv/Lib/site-packages/spacy_curated_transformers/models/__pycache__/architectures.cpython-312.pyc differ diff --git a/TTS/Kokoro/.venv/Lib/site-packages/spacy_curated_transformers/models/__pycache__/hf_loader.cpython-312.pyc b/TTS/Kokoro/.venv/Lib/site-packages/spacy_curated_transformers/models/__pycache__/hf_loader.cpython-312.pyc new file mode 100644 index 0000000000000000000000000000000000000000..ace6256e304cb8ae1183e553664b93c7ebe5b479 Binary files /dev/null and b/TTS/Kokoro/.venv/Lib/site-packages/spacy_curated_transformers/models/__pycache__/hf_loader.cpython-312.pyc differ diff --git a/TTS/Kokoro/.venv/Lib/site-packages/spacy_curated_transformers/models/__pycache__/listeners.cpython-312.pyc b/TTS/Kokoro/.venv/Lib/site-packages/spacy_curated_transformers/models/__pycache__/listeners.cpython-312.pyc new file mode 100644 index 0000000000000000000000000000000000000000..85cbf63212e163c375c99460757f214ee1f58e53 Binary files /dev/null and b/TTS/Kokoro/.venv/Lib/site-packages/spacy_curated_transformers/models/__pycache__/listeners.cpython-312.pyc differ diff --git a/TTS/Kokoro/.venv/Lib/site-packages/spacy_curated_transformers/models/__pycache__/output.cpython-312.pyc b/TTS/Kokoro/.venv/Lib/site-packages/spacy_curated_transformers/models/__pycache__/output.cpython-312.pyc new file mode 100644 index 0000000000000000000000000000000000000000..7c5efcfa1cd988de4c5000f023ce46571d9bac8c Binary files /dev/null and b/TTS/Kokoro/.venv/Lib/site-packages/spacy_curated_transformers/models/__pycache__/output.cpython-312.pyc differ diff --git a/TTS/Kokoro/.venv/Lib/site-packages/spacy_curated_transformers/models/__pycache__/pooling.cpython-312.pyc b/TTS/Kokoro/.venv/Lib/site-packages/spacy_curated_transformers/models/__pycache__/pooling.cpython-312.pyc new file mode 100644 index 0000000000000000000000000000000000000000..3cded7d1bf053854ebcca54e026b7bb8f29206ac Binary files /dev/null and b/TTS/Kokoro/.venv/Lib/site-packages/spacy_curated_transformers/models/__pycache__/pooling.cpython-312.pyc differ diff --git a/TTS/Kokoro/.venv/Lib/site-packages/spacy_curated_transformers/models/__pycache__/remove_eos_bos.cpython-312.pyc b/TTS/Kokoro/.venv/Lib/site-packages/spacy_curated_transformers/models/__pycache__/remove_eos_bos.cpython-312.pyc new file mode 100644 index 0000000000000000000000000000000000000000..541c8c6cfb620ee6ffd9c19f6475654c38a81032 Binary files /dev/null and b/TTS/Kokoro/.venv/Lib/site-packages/spacy_curated_transformers/models/__pycache__/remove_eos_bos.cpython-312.pyc differ diff --git a/TTS/Kokoro/.venv/Lib/site-packages/spacy_curated_transformers/models/__pycache__/scalar_weight.cpython-312.pyc b/TTS/Kokoro/.venv/Lib/site-packages/spacy_curated_transformers/models/__pycache__/scalar_weight.cpython-312.pyc new file mode 100644 index 0000000000000000000000000000000000000000..d25e3c16c37e7018442ed182470c8eb34bddbb90 Binary files /dev/null and b/TTS/Kokoro/.venv/Lib/site-packages/spacy_curated_transformers/models/__pycache__/scalar_weight.cpython-312.pyc differ diff --git a/TTS/Kokoro/.venv/Lib/site-packages/spacy_curated_transformers/models/__pycache__/types.cpython-312.pyc b/TTS/Kokoro/.venv/Lib/site-packages/spacy_curated_transformers/models/__pycache__/types.cpython-312.pyc new file mode 100644 index 0000000000000000000000000000000000000000..66eb82139303555977843bdb55ec6f442041864f Binary files /dev/null and b/TTS/Kokoro/.venv/Lib/site-packages/spacy_curated_transformers/models/__pycache__/types.cpython-312.pyc differ diff --git a/TTS/Kokoro/.venv/Lib/site-packages/spacy_curated_transformers/models/__pycache__/with_non_ws_tokens.cpython-312.pyc b/TTS/Kokoro/.venv/Lib/site-packages/spacy_curated_transformers/models/__pycache__/with_non_ws_tokens.cpython-312.pyc new file mode 100644 index 0000000000000000000000000000000000000000..593cf3a2b918997e725c3dd5c2e95d152f170883 Binary files /dev/null and b/TTS/Kokoro/.venv/Lib/site-packages/spacy_curated_transformers/models/__pycache__/with_non_ws_tokens.cpython-312.pyc differ diff --git a/TTS/Kokoro/.venv/Lib/site-packages/spacy_curated_transformers/models/__pycache__/with_strided_spans.cpython-312.pyc b/TTS/Kokoro/.venv/Lib/site-packages/spacy_curated_transformers/models/__pycache__/with_strided_spans.cpython-312.pyc new file mode 100644 index 0000000000000000000000000000000000000000..392043c3a03b42fbf330c7c870d1448c908ba92f Binary files /dev/null and b/TTS/Kokoro/.venv/Lib/site-packages/spacy_curated_transformers/models/__pycache__/with_strided_spans.cpython-312.pyc differ diff --git a/TTS/Kokoro/.venv/Lib/site-packages/spacy_curated_transformers/models/architectures.py b/TTS/Kokoro/.venv/Lib/site-packages/spacy_curated_transformers/models/architectures.py new file mode 100644 index 0000000000000000000000000000000000000000..6ab1215fe2350ae74e039dc0cef185c738a60050 --- /dev/null +++ b/TTS/Kokoro/.venv/Lib/site-packages/spacy_curated_transformers/models/architectures.py @@ -0,0 +1,808 @@ +from functools import partial +from pathlib import Path +from typing import Any, Callable, List, Optional, Tuple, Union, cast + +import torch +from curated_transformers.models.albert import AlbertConfig, AlbertEncoder +from curated_transformers.models.bert import BertConfig, BertEncoder +from curated_transformers.models.curated_transformer import ( + CuratedEncoderT, + CuratedTransformer, +) +from curated_transformers.models.hf_util import convert_pretrained_model_for_encoder +from curated_transformers.models.output import PyTorchTransformerOutput +from curated_transformers.models.roberta import RobertaConfig, RobertaEncoder +from spacy.tokens import Doc +from spacy.util import SimpleFrozenDict +from thinc.api import ( + Model, + PyTorchWrapper_v2, + TorchScriptWrapper_v1, + get_torch_default_device, + torch2xp, + xp2torch, +) +from thinc.layers import chain +from thinc.model import Model +from thinc.shims.pytorch_grad_scaler import PyTorchGradScaler +from thinc.types import ArgsKwargs, Floats2d, Ints1d + +from ..tokenization.types import Tok2PiecesModelT +from .listeners import ( + WrappedTransformerAndListener, + replace_listener_callback, + replace_listener_cfg_callback, +) +from .output import TransformerModelOutput +from .remove_eos_bos import remove_bos_eos +from .types import ( + SpanExtractorModelT, + TorchTransformerInT, + TorchTransformerModelT, + TorchTransformerOutT, + TransformerBackpropT, + TransformerInT, + TransformerListenerModelT, + TransformerModelT, + TransformerOutT, + WrappedTransformerAndListenerModelT, +) +from .with_non_ws_tokens import with_non_ws_tokens + + +def build_albert_transformer_model_v1( + *, + vocab_size: int, + with_spans: Callable[ + [TorchTransformerModelT], + SpanExtractorModelT, + ], + piece_encoder: Tok2PiecesModelT, + attention_probs_dropout_prob: float = 0.0, + embedding_width: int = 128, + hidden_act: str = "gelu_new", + hidden_dropout_prob: float = 0.0, + hidden_width: int = 768, + intermediate_width: int = 3072, + layer_norm_eps: float = 1e-12, + max_position_embeddings: int = 512, + model_max_length: int = 512, + num_attention_heads: int = 12, + num_hidden_groups: int = 1, + num_hidden_layers: int = 12, + padding_idx: int = 0, + type_vocab_size: int = 2, + torchscript: bool = False, + mixed_precision: bool = False, + grad_scaler_config: dict = SimpleFrozenDict(), + wrapped_listener: Optional[TransformerListenerModelT] = None, +) -> Union[TransformerModelT, WrappedTransformerAndListenerModelT]: + """Construct an ALBERT transformer model. + + vocab_size (int): + Vocabulary size. + with_spans (Callable): + Callback that constructs a span generator model. + piece_encoder (Model) + The piece encoder to segment input tokens. + attention_probs_dropout_prob (float): + Dropout probabilty of the self-attention layers. + embedding_width (int): + Width of the embedding representations. + hidden_act (str): + Activation used by the point-wise feed-forward layers. + hidden_dropout_prob (float): + Dropout probabilty of the point-wise feed-forward and + embedding layers. + hidden_width (int): + Width of the final representations. + intermediate_width (int): + Width of the intermediate projection layer in the + point-wise feed-forward layer. + layer_norm_eps (float): + Epsilon for layer normalization. + max_position_embeddings (int): + Maximum length of position embeddings. + model_max_length (int): + Maximum length of model inputs. + num_attention_heads (int): + Number of self-attention heads. + num_hidden_groups (int): + Number of layer groups whose constituents share parameters. + num_hidden_layers (int): + Number of hidden layers. + padding_idx (int): + Index of the padding meta-token. + type_vocab_size (int): + Type vocabulary size. + torchscript (bool): + Set to `True` when loading TorchScript models, `False` otherwise. + mixed_precision (bool): + Use mixed-precision training. + grad_scaler_config (dict): + Configuration passed to the PyTorch gradient scaler. + wrapped_listener (Optional[TransformerListenerModelT]): + Optional listener to wrap. Only used when replacing listeners + in downstream components. + """ + config = AlbertConfig( + embedding_width=embedding_width, + hidden_width=hidden_width, + intermediate_width=intermediate_width, + num_attention_heads=num_attention_heads, + num_hidden_groups=num_hidden_groups, + num_hidden_layers=num_hidden_layers, + attention_probs_dropout_prob=attention_probs_dropout_prob, + hidden_dropout_prob=hidden_dropout_prob, + hidden_act=hidden_act, + vocab_size=vocab_size, + type_vocab_size=type_vocab_size, + max_position_embeddings=max_position_embeddings, + model_max_length=model_max_length, + layer_norm_eps=layer_norm_eps, + padding_idx=padding_idx, + ) + + if torchscript: + transformer = _torchscript_encoder( + model_max_length=model_max_length, padding_idx=padding_idx + ) + else: + encoder = AlbertEncoder(config) + transformer = _pytorch_encoder( + encoder, + hidden_width=hidden_width, + mixed_precision=mixed_precision, + grad_scaler_config=grad_scaler_config, + ) + + return build_transformer_or_listener_wrapper_v1( + with_spans=with_spans, + piece_encoder=piece_encoder, + transformer=transformer, + wrapped_listener=wrapped_listener, + ) + + +def build_bert_transformer_model_v1( + *, + vocab_size: int, + with_spans: Callable[ + [TorchTransformerModelT], + SpanExtractorModelT, + ], + piece_encoder: Tok2PiecesModelT, + attention_probs_dropout_prob: float = 0.1, + hidden_act: str = "gelu", + hidden_dropout_prob: float = 0.1, + hidden_width: int = 768, + intermediate_width: int = 3072, + layer_norm_eps: float = 1e-12, + max_position_embeddings: int = 512, + model_max_length: int = 512, + num_attention_heads: int = 12, + num_hidden_layers: int = 12, + padding_idx: int = 0, + type_vocab_size: int = 2, + torchscript: bool = False, + mixed_precision: bool = False, + grad_scaler_config: dict = SimpleFrozenDict(), + wrapped_listener: Optional[TransformerListenerModelT] = None, +) -> Union[TransformerModelT, WrappedTransformerAndListenerModelT]: + """Construct a BERT transformer model. + + vocab_size (int): + Vocabulary size. + with_spans (Callable): + Callback that constructs a span generator model. + piece_encoder (Model) + The piece encoder to segment input tokens. + attention_probs_dropout_prob (float): + Dropout probabilty of the self-attention layers. + hidden_act (str): + Activation used by the point-wise feed-forward layers. + hidden_dropout_prob (float): + Dropout probabilty of the point-wise feed-forward and + embedding layers. + hidden_width (int): + Width of the final representations. + intermediate_width (int): + Width of the intermediate projection layer in the + point-wise feed-forward layer. + layer_norm_eps (float): + Epsilon for layer normalization. + max_position_embeddings (int): + Maximum length of position embeddings. + model_max_length (int): + Maximum length of model inputs. + num_attention_heads (int): + Number of self-attention heads. + num_hidden_layers (int): + Number of hidden layers. + padding_idx (int): + Index of the padding meta-token. + type_vocab_size (int): + Type vocabulary size. + torchscript (bool): + Set to `True` when loading TorchScript models, `False` otherwise. + mixed_precision (bool): + Use mixed-precision training. + grad_scaler_config (dict): + Configuration passed to the PyTorch gradient scaler. + wrapped_listener (Optional[TransformerListenerModelT]): + Optional listener to wrap. Only used when replacing listeners + in downstream components. + """ + config = BertConfig( + embedding_width=hidden_width, + hidden_width=hidden_width, + intermediate_width=intermediate_width, + num_attention_heads=num_attention_heads, + num_hidden_layers=num_hidden_layers, + attention_probs_dropout_prob=attention_probs_dropout_prob, + hidden_dropout_prob=hidden_dropout_prob, + hidden_act=hidden_act, + vocab_size=vocab_size, + type_vocab_size=type_vocab_size, + max_position_embeddings=max_position_embeddings, + model_max_length=model_max_length, + layer_norm_eps=layer_norm_eps, + padding_idx=padding_idx, + ) + + if torchscript: + transformer = _torchscript_encoder( + model_max_length=model_max_length, padding_idx=padding_idx + ) + else: + encoder = BertEncoder(config) + transformer = _pytorch_encoder( + encoder, + hidden_width=hidden_width, + mixed_precision=mixed_precision, + grad_scaler_config=grad_scaler_config, + ) + + return build_transformer_or_listener_wrapper_v1( + with_spans=with_spans, + piece_encoder=piece_encoder, + transformer=transformer, + wrapped_listener=wrapped_listener, + ) + + +def build_camembert_transformer_model_v1( + *, + vocab_size: int, + with_spans: Callable[ + [TorchTransformerModelT], + SpanExtractorModelT, + ], + piece_encoder: Tok2PiecesModelT, + attention_probs_dropout_prob: float = 0.1, + hidden_act: str = "gelu", + hidden_dropout_prob: float = 0.1, + hidden_width: int = 768, + intermediate_width: int = 3072, + layer_norm_eps: float = 1e-5, + max_position_embeddings: int = 514, + model_max_length: int = 512, + num_attention_heads: int = 12, + num_hidden_layers: int = 12, + padding_idx: int = 1, + type_vocab_size: int = 1, + mixed_precision: bool = False, + torchscript=False, + grad_scaler_config: dict = SimpleFrozenDict(), + wrapped_listener: Optional[TransformerListenerModelT] = None, +) -> Union[TransformerModelT, WrappedTransformerAndListenerModelT]: + """Construct a CamemBERT transformer model. + + vocab_size (int): + Vocabulary size. + with_spans (Callable): + Callback that constructs a span generator model. + piece_encoder (Model) + The piece encoder to segment input tokens. + attention_probs_dropout_prob (float): + Dropout probabilty of the self-attention layers. + hidden_act (str): + Activation used by the point-wise feed-forward layers. + hidden_dropout_prob (float): + Dropout probabilty of the point-wise feed-forward and + embedding layers. + hidden_width (int): + Width of the final representations. + intermediate_width (int): + Width of the intermediate projection layer in the + point-wise feed-forward layer. + layer_norm_eps (float): + Epsilon for layer normalization. + max_position_embeddings (int): + Maximum length of position embeddings. + model_max_length (int): + Maximum length of model inputs. + num_attention_heads (int): + Number of self-attention heads. + num_hidden_layers (int): + Number of hidden layers. + padding_idx (int): + Index of the padding meta-token. + type_vocab_size (int): + Type vocabulary size. + torchscript (bool): + Set to `True` when loading TorchScript models, `False` otherwise. + mixed_precision (bool): + Use mixed-precision training. + grad_scaler_config (dict): + Configuration passed to the PyTorch gradient scaler. + wrapped_listener (Optional[TransformerListenerModelT]): + Optional listener to wrap. Only used when replacing listeners + in downstream components. + """ + config = RobertaConfig( + embedding_width=hidden_width, + hidden_width=hidden_width, + intermediate_width=intermediate_width, + num_attention_heads=num_attention_heads, + num_hidden_layers=num_hidden_layers, + attention_probs_dropout_prob=attention_probs_dropout_prob, + hidden_dropout_prob=hidden_dropout_prob, + hidden_act=hidden_act, + vocab_size=vocab_size, + type_vocab_size=type_vocab_size, + max_position_embeddings=max_position_embeddings, + model_max_length=model_max_length, + layer_norm_eps=layer_norm_eps, + padding_idx=padding_idx, + ) + + if torchscript: + transformer = _torchscript_encoder( + model_max_length=model_max_length, padding_idx=padding_idx + ) + else: + encoder = RobertaEncoder(config) + transformer = _pytorch_encoder( + encoder, + hidden_width=hidden_width, + mixed_precision=mixed_precision, + grad_scaler_config=grad_scaler_config, + ) + + return build_transformer_or_listener_wrapper_v1( + with_spans=with_spans, + piece_encoder=piece_encoder, + transformer=transformer, + wrapped_listener=wrapped_listener, + ) + + +def build_roberta_transformer_model_v1( + *, + vocab_size: int, + with_spans: Callable[ + [TorchTransformerModelT], + SpanExtractorModelT, + ], + piece_encoder: Tok2PiecesModelT, + attention_probs_dropout_prob: float = 0.1, + hidden_act: str = "gelu", + hidden_dropout_prob: float = 0.1, + hidden_width: int = 768, + intermediate_width: int = 3072, + layer_norm_eps: float = 1e-5, + max_position_embeddings: int = 514, + model_max_length: int = 512, + num_attention_heads: int = 12, + num_hidden_layers: int = 12, + padding_idx: int = 1, + type_vocab_size: int = 1, + torchscript: bool = False, + mixed_precision: bool = False, + grad_scaler_config: dict = SimpleFrozenDict(), + wrapped_listener: Optional[TransformerListenerModelT] = None, +) -> Union[TransformerModelT, WrappedTransformerAndListenerModelT]: + """Construct a RoBERTa transformer model. + + vocab_size (int): + Vocabulary size. + with_spans (Callable): + Callback that constructs a span generator model. + piece_encoder (Model) + The piece encoder to segment input tokens. + attention_probs_dropout_prob (float): + Dropout probabilty of the self-attention layers. + hidden_act (str): + Activation used by the point-wise feed-forward layers. + hidden_dropout_prob (float): + Dropout probabilty of the point-wise feed-forward and + embedding layers. + hidden_width (int): + Width of the final representations. + intermediate_width (int): + Width of the intermediate projection layer in the + point-wise feed-forward layer. + layer_norm_eps (float): + Epsilon for layer normalization. + max_position_embeddings (int): + Maximum length of position embeddings. + model_max_length (int): + Maximum length of model inputs. + num_attention_heads (int): + Number of self-attention heads. + num_hidden_layers (int): + Number of hidden layers. + padding_idx (int): + Index of the padding meta-token. + type_vocab_size (int): + Type vocabulary size. + torchscript (bool): + Set to `True` when loading TorchScript models, `False` otherwise. + mixed_precision (bool): + Use mixed-precision training. + grad_scaler_config (dict): + Configuration passed to the PyTorch gradient scaler. + wrapped_listener (Optional[TransformerListenerModelT]): + Optional listener to wrap. Only used when replacing listeners + in downstream components. + """ + config = RobertaConfig( + embedding_width=hidden_width, + hidden_width=hidden_width, + intermediate_width=intermediate_width, + num_attention_heads=num_attention_heads, + num_hidden_layers=num_hidden_layers, + attention_probs_dropout_prob=attention_probs_dropout_prob, + hidden_dropout_prob=hidden_dropout_prob, + hidden_act=hidden_act, + vocab_size=vocab_size, + type_vocab_size=type_vocab_size, + max_position_embeddings=max_position_embeddings, + model_max_length=model_max_length, + layer_norm_eps=layer_norm_eps, + padding_idx=padding_idx, + ) + + if torchscript: + transformer = _torchscript_encoder( + model_max_length=model_max_length, padding_idx=padding_idx + ) + else: + encoder = RobertaEncoder(config) + transformer = _pytorch_encoder( + encoder, + hidden_width=hidden_width, + mixed_precision=mixed_precision, + grad_scaler_config=grad_scaler_config, + ) + + return build_transformer_or_listener_wrapper_v1( + with_spans=with_spans, + piece_encoder=piece_encoder, + transformer=transformer, + wrapped_listener=wrapped_listener, + ) + + +def build_xlmr_transformer_model_v1( + *, + vocab_size: int, + with_spans: Callable[ + [TorchTransformerModelT], + SpanExtractorModelT, + ], + piece_encoder: Tok2PiecesModelT, + attention_probs_dropout_prob: float = 0.1, + hidden_act: str = "gelu", + hidden_dropout_prob: float = 0.1, + hidden_width: int = 768, + intermediate_width: int = 3072, + layer_norm_eps: float = 1e-5, + max_position_embeddings: int = 514, + model_max_length: int = 512, + num_attention_heads: int = 12, + num_hidden_layers: int = 12, + padding_idx: int = 1, + type_vocab_size: int = 1, + torchscript: bool = False, + mixed_precision: bool = False, + grad_scaler_config: dict = SimpleFrozenDict(), + wrapped_listener: Optional[TransformerListenerModelT] = None, +) -> Union[TransformerModelT, WrappedTransformerAndListenerModelT]: + """Construct a XLM-RoBERTa transformer model. + + vocab_size (int): + Vocabulary size. + with_spans (Callable): + Callback that constructs a span generator model. + piece_encoder (Model) + The piece encoder to segment input tokens. + attention_probs_dropout_prob (float): + Dropout probabilty of the self-attention layers. + hidden_act (str): + Activation used by the point-wise feed-forward layers. + hidden_dropout_prob (float): + Dropout probabilty of the point-wise feed-forward and + embedding layers. + hidden_width (int): + Width of the final representations. + intermediate_width (int): + Width of the intermediate projection layer in the + point-wise feed-forward layer. + layer_norm_eps (float): + Epsilon for layer normalization. + max_position_embeddings (int): + Maximum length of position embeddings. + model_max_length (int): + Maximum length of model inputs. + num_attention_heads (int): + Number of self-attention heads. + num_hidden_layers (int): + Number of hidden layers. + padding_idx (int): + Index of the padding meta-token. + type_vocab_size (int): + Type vocabulary size. + torchscript (bool): + Set to `True` when loading TorchScript models, `False` otherwise. + mixed_precision (bool): + Use mixed-precision training. + grad_scaler_config (dict): + Configuration passed to the PyTorch gradient scaler. + wrapped_listener (Optional[TransformerListenerModelT]): + Optional listener to wrap. Only used when replacing listeners + in downstream components. + """ + config = RobertaConfig( + embedding_width=hidden_width, + hidden_width=hidden_width, + intermediate_width=intermediate_width, + num_attention_heads=num_attention_heads, + num_hidden_layers=num_hidden_layers, + attention_probs_dropout_prob=attention_probs_dropout_prob, + hidden_dropout_prob=hidden_dropout_prob, + hidden_act=hidden_act, + vocab_size=vocab_size, + type_vocab_size=type_vocab_size, + max_position_embeddings=max_position_embeddings, + model_max_length=model_max_length, + layer_norm_eps=layer_norm_eps, + padding_idx=padding_idx, + ) + + if torchscript: + transformer = _torchscript_encoder( + model_max_length=model_max_length, padding_idx=padding_idx + ) + else: + encoder = RobertaEncoder(config) + transformer = _pytorch_encoder( + encoder, + hidden_width=hidden_width, + mixed_precision=mixed_precision, + grad_scaler_config=grad_scaler_config, + ) + + return build_transformer_or_listener_wrapper_v1( + with_spans=with_spans, + piece_encoder=piece_encoder, + transformer=transformer, + wrapped_listener=wrapped_listener, + ) + + +def build_transformer_or_listener_wrapper_v1( + *, + with_spans: Callable[ + [TorchTransformerModelT], + SpanExtractorModelT, + ], + transformer: TorchTransformerModelT, + piece_encoder: Tok2PiecesModelT, + wrapped_listener: Optional[TransformerListenerModelT], +) -> Union[TransformerModelT, WrappedTransformerAndListenerModelT]: + thinc_transformer = build_transformer_model_v1( + with_spans=with_spans, transformer=transformer, piece_encoder=piece_encoder + ) + if wrapped_listener is not None: + return WrappedTransformerAndListener(thinc_transformer, wrapped_listener) + else: + return thinc_transformer + + +def build_transformer_model_v1( + *, + with_spans: Callable[ + [TorchTransformerModelT], + SpanExtractorModelT, + ], + transformer: TorchTransformerModelT, + piece_encoder: Tok2PiecesModelT, +) -> TransformerModelT: + # FIXME: do we want to make `remove_bos_eos` configurable as well or + # is it always the same post-processing? + layers = [ + with_non_ws_tokens( + chain(piece_encoder, with_spans(transformer), remove_bos_eos()) + ) + ] + refs = { + "piece_encoder": piece_encoder, + "transformer": transformer, + } + return Model( + "transformer_model", + transformer_model_forward, + init=transformer_model_init, + layers=layers, + refs=refs, # type: ignore + attrs={ + "replace_listener": replace_listener_callback, + "replace_listener_cfg": replace_listener_cfg_callback, + }, + dims={"nO": transformer.get_dim("nO")}, + ) + + +def transformer_model_forward( + model: TransformerModelT, docs: TransformerInT, is_train: bool +) -> Tuple[TransformerOutT, TransformerBackpropT]: + Y, backprop_layer = model.layers[0](docs, is_train=is_train) + + def backprop(dY): + backprop_layer(dY) + + # Return empty list for backprop, since we cannot backprop into piece + # identifiers. + return [] + + return Y, backprop + + +def transformer_model_init( + model: TransformerModelT, X: Optional[TransformerInT] = None, Y=None +) -> Model: + model.layers[0].initialize(X, Y) + return model + + +def _pytorch_encoder( + encoder: CuratedEncoderT, + hidden_width: int, + *, + mixed_precision: bool = False, + grad_scaler_config: dict = SimpleFrozenDict(), +) -> TorchTransformerModelT: + if isinstance(grad_scaler_config, SimpleFrozenDict): + # Create a new, mutable dict instance. + grad_scaler_config = {} + + if "enabled" not in grad_scaler_config: + grad_scaler_config["enabled"] = mixed_precision + + model = PyTorchWrapper_v2( + CuratedTransformer(encoder), + convert_inputs=partial( + _convert_inputs, + max_model_seq_len=encoder.max_seq_len, + padding_idx=encoder.padding_idx, + ), + convert_outputs=_convert_outputs, + mixed_precision=mixed_precision, + grad_scaler=PyTorchGradScaler(**grad_scaler_config), + ) + model.set_dim("nO", hidden_width) + + # This attribute is set by the parent Pipe instance before each forward pass. + model.attrs["_all_layer_outputs"] = True + + return model + + +def _torchscript_encoder(*, model_max_length: int, padding_idx: int) -> Model: + return TorchScriptWrapper_v1( + convert_inputs=partial( + _convert_inputs, + max_model_seq_len=model_max_length, + padding_idx=padding_idx, + ), + convert_outputs=_convert_outputs, + ) + + +def _convert_inputs( + model: Model, + X: TorchTransformerInT, + is_train: bool, + *, + max_model_seq_len: int, + padding_idx: int, +) -> Tuple[ArgsKwargs, Callable[[Any], List[Ints1d]]]: + ops = model.ops + max_seq_len = max(x.size for x in X) + if max_seq_len > max_model_seq_len: + raise ValueError( + "At least one sequence in the transformer's input has a length " + f"of {max_seq_len}, which is larger than the model's maximum sequence " + f"length of {max_model_seq_len} tokens" + ) + + # Transform the list of strided spans to a padded array. + Xt = ops.xp.full((len(X), max_seq_len), padding_idx) + for i in range(len(X)): + span = X[i] + span_len = span.shape[0] + Xt[i, :span_len] = span + Xt = xp2torch(Xt) + + def convert_from_torch_backward(d_inputs: Any): + # No gradients for the inputs. + return [ops.alloc1f(x.shape[0]) for x in X] + + output = ArgsKwargs(args=(Xt,), kwargs={}) + return output, convert_from_torch_backward + + +def _convert_outputs( + model: Model, + inputs_outputs: Tuple[TorchTransformerInT, PyTorchTransformerOutput], + is_train: bool, +) -> Tuple[TorchTransformerOutT, Callable[[List[List[Floats2d]]], ArgsKwargs]]: + model_inputs, model_outputs = inputs_outputs + ops = model.ops + all_layer_outputs: bool = model.attrs["_all_layer_outputs"] + + # Strip the outputs for the padding timesteps + # while preserving all the outputs (and their order). + input_lens = [x.shape[0] for x in model_inputs] + if all_layer_outputs: + Yt = [ + [output[i, :len, :] for output in model_outputs.all_outputs] + for i, len in enumerate(input_lens) + ] + else: + Yt = [ + [model_outputs.all_outputs[-1][i, :len, :]] + for i, len in enumerate(input_lens) + ] + + Y = [ + [cast(Floats2d, torch2xp(layer, ops=ops)) for layer in output] for output in Yt + ] + output = TransformerModelOutput(outputs=Y, last_layer_only=not all_layer_outputs) + + def convert_for_torch_backward(dY: List[List[Floats2d]]): + Yt_flat = [y for inner in Yt for y in inner] + dYt_flat = [xp2torch(y) for inner in dY for y in inner] + assert len(Yt_flat) == len(dYt_flat) + + return ArgsKwargs( + args=(Yt_flat,), + kwargs={"grad_tensors": dYt_flat}, + ) + + return output, convert_for_torch_backward + + +def build_pytorch_checkpoint_loader_v1(*, path: Path) -> Callable[ + [TorchTransformerModelT, Optional[List[Doc]], Optional[List[Doc]]], + TorchTransformerModelT, +]: + """Construct a callback that initializes a supported transformer + model with weights from a PyTorch checkpoint. + + path (Path): + Path to the PyTorch checkpoint. + """ + + def load(model, X=None, Y=None): + encoder = model.shims[0]._model + device = get_torch_default_device() + params = torch.load(path, map_location=device) + params = convert_pretrained_model_for_encoder(encoder, params) + encoder.load_state_dict(params) + encoder.to(device) + return model + + return load diff --git a/TTS/Kokoro/.venv/Lib/site-packages/spacy_curated_transformers/models/hf_loader.py b/TTS/Kokoro/.venv/Lib/site-packages/spacy_curated_transformers/models/hf_loader.py new file mode 100644 index 0000000000000000000000000000000000000000..fd211f5dcec99062e8742232068133c1880c4fbf --- /dev/null +++ b/TTS/Kokoro/.venv/Lib/site-packages/spacy_curated_transformers/models/hf_loader.py @@ -0,0 +1,41 @@ +from typing import Callable, List, Optional + +from curated_transformers.models.hf_util import convert_hf_pretrained_model_parameters +from spacy.tokens import Doc + +from .._compat import has_hf_transformers, transformers +from .types import TorchTransformerModelT + + +def build_hf_transformer_encoder_loader_v1( + *, + name: str, + revision: str = "main", +) -> Callable[ + [TorchTransformerModelT, Optional[List[Doc]], Optional[List[Doc]]], + TorchTransformerModelT, +]: + """Construct a callback that initializes a supported transformer + model with weights from a corresponding HuggingFace model. + + name (str): + Name of the HuggingFace model. + revision (str): + Name of the model revision/branch. + """ + + def load(model, X=None, Y=None): + if not has_hf_transformers: + raise ValueError( + "`HFTransformerEncoderLoader` requires the Hugging Face `transformers` package to be installed" + ) + + encoder = model.shims[0]._model + + hf_model = transformers.AutoModel.from_pretrained(name, revision=revision) + params = convert_hf_pretrained_model_parameters(hf_model) + encoder.load_state_dict(params) + + return model + + return load diff --git a/TTS/Kokoro/.venv/Lib/site-packages/spacy_curated_transformers/models/listeners.py b/TTS/Kokoro/.venv/Lib/site-packages/spacy_curated_transformers/models/listeners.py new file mode 100644 index 0000000000000000000000000000000000000000..7f4fba8a1e12383ee10195bfe3fd0d6f316aeb27 --- /dev/null +++ b/TTS/Kokoro/.venv/Lib/site-packages/spacy_curated_transformers/models/listeners.py @@ -0,0 +1,662 @@ +from typing import Any, Callable, Iterable, List, Optional, Tuple + +from spacy import Errors as SpacyErrors +from spacy.tokens import Doc +from thinc.api import Model, deserialize_attr, serialize_attr +from thinc.types import Floats2d, Ragged + +from .output import TransformerModelOutput +from .pooling import with_ragged_last_layer, with_ragged_layers +from .types import ( + PoolingModelT, + ScalarWeightModelT, + ScalarWeightOutT, + TransformerListenerModelT, + TransformerModelT, + WithRaggedLastLayerModelT, + WithRaggedLayersModelT, + WrappedTransformerAndListenerBackpropT, + WrappedTransformerAndListenerInT, + WrappedTransformerAndListenerModelT, + WrappedTransformerAndListenerOutT, +) + + +def build_transformer_layers_listener_v1( + layers: int, + width: int, + pooling: PoolingModelT, + upstream: str = "*", + grad_factor: float = 1.0, +) -> TransformerListenerModelT: + """Construct a listener layer that communicates with one or more upstream Transformer + components. This layer extracts the output of all transformer layers and performs + pooling over the individual pieces of each Doc token, returning their corresponding + representations. + + layers (int): + The the number of layers produced by the upstream transformer component, + excluding the embedding layer. + width (int): + The width of the vectors produced by the upstream transformer component. + pooling (PoolingModelT): + Model that is used to perform pooling over the piece representations. + upstream (str): + A string to identify the 'upstream' Transformer component + to communicate with. The upstream name should either be the wildcard + string '*', or the name of the Transformer component. + + In almost all cases, the wildcard string will suffice as there'll only be one + upstream Transformer component. But in certain situations, e.g: you have disjoint + datasets for certain tasks, or you'd like to use a pre-trained pipeline but a + downstream task requires its own token representations, you could end up with + more than one Transformer component in the pipeline. + grad_factor (float): + Factor to multiply gradients with. + """ + model: TransformerListenerModelT = Model( + name="transformer_layers_listener", + forward=transformer_layers_listener_forward, + dims={"nO": width}, + layers=[with_ragged_layers(pooling)], + attrs={ + "grad_factor": grad_factor, + "layers": layers + 1, + }, + refs={"pooling": pooling}, + ) + ListenerStateUtils.init_state( + model, upstream_name=upstream, requires_all_layer_outputs=True + ) + return model + + +def build_last_transformer_layer_listener_v1( + width: int, + pooling: PoolingModelT, + upstream: str = "*", + grad_factor: float = 1.0, +) -> TransformerListenerModelT: + """Construct a listener layer that communicates with one or more upstream Transformer + components. This layer extracts the output of the last transformer layer and performs + pooling over the individual pieces of each Doc token, returning their corresponding + representations. + + width (int): + The width of the vectors produced by the upstream transformer component. + pooling (Model): + Model that is used to perform pooling over the piece representations. + upstream (str): + A string to identify the 'upstream' Transformer component + to communicate with. The upstream name should either be the wildcard + string '*', or the name of the Transformer component. + + In almost all cases, the wildcard string will suffice as there'll only be one + upstream Transformer component. But in certain situations, e.g: you have disjoint + datasets for certain tasks, or you'd like to use a pre-trained pipeline but a + downstream task requires its own token representations, you could end up with + more than one Transformer component in the pipeline. + grad_factor (float): + Factor to multiply gradients with. + """ + model: TransformerListenerModelT = Model( + name="last_transformer_layer_listener", + forward=last_transformer_layer_listener_forward, + dims={"nO": width}, + layers=[with_ragged_last_layer(pooling)], + attrs={"grad_factor": grad_factor}, + refs={"pooling": pooling}, + ) + ListenerStateUtils.init_state( + model, upstream_name=upstream, requires_all_layer_outputs=False + ) + return model + + +def build_scalar_weighting_listener_v1( + width: int, + weighting: ScalarWeightModelT, + pooling: PoolingModelT, + upstream: str = "*", + grad_factor: float = 1.0, +) -> TransformerListenerModelT: + """Construct a listener layer that communicates with one or more upstream Transformer + components. This layer calculates a weighted representation of all transformer layer + outputs and performs pooling over the individual pieces of each Doc token, returning + their corresponding representations. + + Requires its upstream Transformer components to return all layer outputs from + their models. + + width (int): + The width of the vectors produced by the upstream transformer component. + weighting (Model): + Model that is used to perform the weighting of the different layer outputs. + pooling (Model): + Model that is used to perform pooling over the piece representations. + upstream (str): + A string to identify the 'upstream' Transformer component + to communicate with. The upstream name should either be the wildcard + string '*', or the name of the Transformer component. + + In almost all cases, the wildcard string will suffice as there'll only be one + upstream Transformer component. But in certain situations, e.g: you have disjoint + datasets for certain tasks, or you'd like to use a pre-trained pipeline but a + downstream task requires its own token representations, you could end up with + more than one Transformer component in the pipeline. + grad_factor (float): + Factor to multiply gradients with. + """ + model: TransformerListenerModelT = Model( + name="scalar_weighting_listener", + forward=scalar_weighting_listener_forward, + dims={"nO": width}, + layers=[weighting, with_ragged_last_layer(pooling)], + attrs={ + "grad_factor": grad_factor, + }, + ) + ListenerStateUtils.init_state( + model, upstream_name=upstream, requires_all_layer_outputs=True + ) + return model + + +# We need to store the listener state in the attributes dict of the listener model. +# This custom class is used to ensure that this state is not serialized to disk. +class _ListenerNonPersistentState: + batch_id: Optional[int] = None + outputs: Optional[TransformerModelOutput] = None + backprop: Optional[Callable[[List[List[Ragged]], Tuple[int]], Any]] = None + + +@serialize_attr.register(_ListenerNonPersistentState) +def serialize_listener_non_persistent_state( + _, value: _ListenerNonPersistentState, name: str, model +) -> bytes: + return bytes() + + +@deserialize_attr.register(_ListenerNonPersistentState) +def deserialize_listener_non_persistent_state( + _, value: bytes, name: str, model +) -> _ListenerNonPersistentState: + return _ListenerNonPersistentState() + + +class ListenerStateUtils: + """This class provides helper functions to manage the internal state of + `Model`s that act as listeners of the `Transformer` pipe.""" + + SENTINEL = "_TRANSFORMER_LISTENER" + USE_DOC_ANNOTATIONS_FOR_PREDICTION = "_USE_DOC_ANNOTATIONS_FOR_PREDICTION" + REQUIRES_ALL_LAYER_OUTPUTS = "_REQUIRES_ALL_LAYER_OUTPUTS" + + @classmethod + def is_listener(cls, model: Model) -> bool: + return cls.SENTINEL in model.attrs + + @classmethod + def init_state( + cls, + listener: TransformerListenerModelT, + *, + upstream_name: str = "*", + requires_all_layer_outputs: bool + ): + """Initialize the listener model.""" + listener.attrs["_upstream_name"] = upstream_name + listener.attrs[cls.SENTINEL] = True + listener.attrs[cls.USE_DOC_ANNOTATIONS_FOR_PREDICTION] = True + listener.attrs[cls.REQUIRES_ALL_LAYER_OUTPUTS] = requires_all_layer_outputs + listener.attrs["_state"] = _ListenerNonPersistentState() + + @classmethod + def use_doc_annotations_for_prediction( + cls, listener: TransformerListenerModelT + ) -> bool: + """If True, the listener will perform its operations on the transformer output + annotations stored on the Doc objects. Otherwise, it will perform its operations + on the outputs that were stored directly in it using `TransformerListener.receive`. + """ + return listener.attrs[cls.USE_DOC_ANNOTATIONS_FOR_PREDICTION] + + @classmethod + def set_use_doc_annotations_for_prediction( + cls, listener: TransformerListenerModelT, new_value: bool + ): + listener.attrs[cls.USE_DOC_ANNOTATIONS_FOR_PREDICTION] = new_value + + @classmethod + def requires_all_layer_outputs(cls, model: Model) -> bool: + return model.attrs[cls.REQUIRES_ALL_LAYER_OUTPUTS] + + @classmethod + def get_upstream_name(cls, listener: TransformerListenerModelT) -> str: + return listener.attrs["_upstream_name"] + + @staticmethod + def get_batch_id(listener: TransformerListenerModelT) -> Optional[int]: + state: _ListenerNonPersistentState = listener.attrs["_state"] + return state.batch_id + + @staticmethod + def get_output( + listener: TransformerListenerModelT, + ) -> Optional[TransformerModelOutput]: + state: _ListenerNonPersistentState = listener.attrs["_state"] + return state.outputs + + @staticmethod + def get_backprop( + listener: TransformerListenerModelT, + ) -> Optional[Callable[[List[List[Ragged]], Tuple[int]], Any]]: + state: _ListenerNonPersistentState = listener.attrs["_state"] + return state.backprop + + @staticmethod + def calculate_batch_id(inputs: Iterable[Doc]) -> int: + """Calculate a content-sensitive hash of the batch of documents, to check + whether the next batch of documents is unexpected. + """ + return sum(sum(token.orth for token in doc) for doc in inputs) + + @staticmethod + def receive( + listener: TransformerListenerModelT, + batch_id: int, + outputs: TransformerModelOutput, + backprop: Callable[[List[List[Ragged]], Tuple[int]], Any], + ) -> None: + """Store a batch of training predictions and a backprop callback in the listener. + The predictions and callback are produced by the upstream Transformer component, + and later will be used when the listener's component's model is called. + """ + state: _ListenerNonPersistentState = listener.attrs["_state"] + state.batch_id = batch_id + state.outputs = outputs + state.backprop = backprop + + @classmethod + def verify_inputs( + cls, listener: TransformerListenerModelT, inputs: Iterable[Doc] + ) -> bool: + """Check that the batch of Doc objects matches the ones we have a + prediction for. + """ + expected_batch_id = cls.get_batch_id(listener) + outputs = cls.get_output(listener) + + if expected_batch_id is None and outputs is None: + raise ValueError(SpacyErrors.E954) + else: + batch_id = cls.calculate_batch_id(inputs) + if expected_batch_id != batch_id: + raise ValueError( + SpacyErrors.E953.format(id1=expected_batch_id, id2=batch_id) + ) + else: + return True + + @staticmethod + def clear_state( + listener: TransformerListenerModelT, + ): + state: _ListenerNonPersistentState = listener.attrs["_state"] + state.batch_id = None + state.outputs = None + state.backprop = None + + +def transformer_layers_listener_forward( + model: TransformerListenerModelT, docs: Iterable[Doc], is_train: bool +) -> Tuple[List[List[Floats2d]], Callable[[Any], Any]]: + pooling: WithRaggedLayersModelT = model.layers[0] + grad_factor: float = model.attrs["grad_factor"] + n_layers: int = model.attrs["layers"] + + _outputs = ListenerStateUtils.get_output(model) + _backprop = ListenerStateUtils.get_backprop(model) + + if is_train: + assert _outputs is not None + if _outputs.last_layer_only: + raise ValueError + ( + "`TransformerLayersListener` requires the upstream transformer pipe to output " + "all hidden layer outputs. This can be enabled by setting the pipe's " + "`all_layer_outputs` parameter to `True` in the pipeline config" + ) + + ListenerStateUtils.verify_inputs(model, docs) + + Y, backprop_pooling = pooling(_outputs.all_outputs, is_train) + + def backprop(dY): + dX = backprop_pooling(dY) + + if grad_factor != 1.0: + for dX_doc in dX: + for dX_layer in dX_doc: + dX_layer.data *= grad_factor + + outputs_to_backprop = tuple(i for i in range(0, _outputs.num_outputs)) + dX = _backprop(dX, outputs_to_backprop=outputs_to_backprop) + + ListenerStateUtils.clear_state(model) + return dX + + return Y, backprop + + else: + if ListenerStateUtils.use_doc_annotations_for_prediction(model): + width = model.get_dim("nO") + + no_trf_data = [doc._.trf_data is None for doc in docs] + if any(no_trf_data): + assert all(no_trf_data) + return [ + [model.ops.alloc2f(len(doc), width) for _ in range(n_layers)] + for doc in docs + ], lambda dY: [] + + if any(doc._.trf_data.last_layer_only for doc in docs): + raise ValueError( + "`TransformerLayersListener` requires the upstream transformer pipe to output " + "all hidden layer outputs. This can be enabled by setting the pipe's " + "`all_layer_outputs` parameter to `True` in the pipeline config" + ) + + return pooling.predict(docs), lambda dY: [] + else: + assert _outputs is not None + ListenerStateUtils.verify_inputs(model, docs) + outputs: Tuple[List[List[Floats2d]], Callable[[Any], Any]] = ( + pooling.predict(_outputs.all_outputs), + lambda dY: [], + ) + ListenerStateUtils.clear_state(model) + return outputs + + +def last_transformer_layer_listener_forward( + model: TransformerListenerModelT, docs: Iterable[Doc], is_train: bool +) -> Tuple[List[Floats2d], Callable[[Any], Any]]: + pooling: WithRaggedLastLayerModelT = model.layers[0] + grad_factor: float = model.attrs["grad_factor"] + + _outputs = ListenerStateUtils.get_output(model) + _backprop = ListenerStateUtils.get_backprop(model) + + if is_train: + assert _outputs is not None + ListenerStateUtils.verify_inputs(model, docs) + + Y, backprop_pooling = pooling(_outputs.last_hidden_layer_states, is_train) + + def backprop(dY): + dX_pooling = backprop_pooling(dY) + if grad_factor != 1.0: + for dx in dX_pooling: + dx.data *= grad_factor + dX = _backprop([[d] for d in dX_pooling], outputs_to_backprop=(-1,)) + ListenerStateUtils.clear_state(model) + + return dX + + return Y, backprop + else: + if ListenerStateUtils.use_doc_annotations_for_prediction(model): + width = model.get_dim("nO") + + no_trf_data = [doc._.trf_data is None for doc in docs] + if any(no_trf_data): + assert all(no_trf_data) + return [ + model.ops.alloc2f(len(doc), width) for doc in docs + ], lambda dY: [] + + return pooling.predict(docs), lambda dY: [] + else: + assert _outputs is not None + ListenerStateUtils.verify_inputs(model, docs) + outputs: Tuple[List[Floats2d], Callable[[Any], Any]] = ( + pooling.predict(_outputs.last_hidden_layer_states), + lambda dY: [], + ) + ListenerStateUtils.clear_state(model) + return outputs + + +def scalar_weighting_listener_forward( + model: TransformerListenerModelT, docs: Iterable[Doc], is_train: bool +) -> Tuple[List[Floats2d], Callable[[Any], Any]]: + weighting: ScalarWeightModelT = model.layers[0] + pooling: WithRaggedLastLayerModelT = model.layers[1] + grad_factor: float = model.attrs["grad_factor"] + + _outputs = ListenerStateUtils.get_output(model) + _backprop = ListenerStateUtils.get_backprop(model) + + if is_train: + assert _outputs is not None + if _outputs.last_layer_only: + raise ValueError( + "`ScalarWeightingListener` requires the upstream transformer pipe to output " + "all hidden layer outputs. This can be enabled by setting the pipe's " + "`all_layer_outputs` parameter to `True` in the pipeline config" + ) + + ListenerStateUtils.verify_inputs(model, docs) + + Y_weighting: ScalarWeightOutT = [] + weighting_inputs = _outputs.all_outputs + outputs_to_backprop = tuple(i for i in range(_outputs.num_outputs)) + + Y_weighting, backprop_weighting = weighting(weighting_inputs, is_train) + Y, backprop_pooling = pooling(Y_weighting, is_train) + + def backprop(dYs): + dX_pooling = backprop_pooling(dYs) + dX_weighting = backprop_weighting(dX_pooling) + + if grad_factor != 1.0: + for dx_inner in dX_weighting: + for dx in dx_inner: + dx.data *= grad_factor + + dX = _backprop(dX_weighting, outputs_to_backprop=outputs_to_backprop) + ListenerStateUtils.clear_state(model) + return dX + + return Y, backprop + else: + if ListenerStateUtils.use_doc_annotations_for_prediction(model): + width = model.get_dim("nO") + + no_trf_data = [doc._.trf_data is None for doc in docs] + if any(no_trf_data): + assert all(no_trf_data) + return [ + model.ops.alloc2f(len(doc), width) for doc in docs + ], lambda dY: [] + + if any(doc._.trf_data.last_layer_only for doc in docs): + raise ValueError( + "`ScalarWeightingListener` requires the upstream transformer pipe to output " + "all hidden layer outputs. This can be enabled by setting the pipe's " + "`all_layer_outputs` parameter to `True` in the pipeline config" + ) + + Y_weighting = weighting.predict( + [doc._.trf_data.all_outputs for doc in docs] + ) + Y = pooling.predict(Y_weighting) + + return Y, lambda dX: [] + else: + assert _outputs is not None + ListenerStateUtils.verify_inputs(model, docs) + Y_weighting = weighting.predict(_outputs.all_outputs) + outputs: Tuple[List[Floats2d], Callable[[Any], Any]] = ( + pooling.predict(Y_weighting), + lambda dY: [], + ) + ListenerStateUtils.clear_state(model) + return outputs + + +class WrappedTransformerAndListener(WrappedTransformerAndListenerModelT): + """Wraps a transformer model and a compatible listener. Exclusively used when replacing + listeners of a shared transformer pipeline.""" + + name = "wrapped_transformer_and_listener" + + def __init__( + self, + transformer: TransformerModelT, + listener: TransformerListenerModelT, + frozen: bool = False, + ) -> None: + """ + transformer (TransformerModelT): + Transformer model to wrap. + listener (TransformerListenerModelT): + Listener model to wrap. + frozen (bool): + If the transformer is frozen. + """ + Model.__init__( + self, + name=self.name, + init=wrapped_transformer_and_listener_init, + forward=wrapped_transformer_and_listener_forward, + dims={"nO": listener.get_dim("nO")}, + layers=[transformer, listener], + ) + + # Ensure that the transformer returns the required outputs. + transformer.attrs["_all_layer_outputs"] = ( + ListenerStateUtils.requires_all_layer_outputs(listener) + ) + + # Freeze the embedded transformer if the source pipe was frozen. + transformer.attrs["_frozen"] = frozen + + # Remove the marker from the wrapped listener so that it doesn't + # get registered to any upstream transformer pipes. + assert ListenerStateUtils.SENTINEL in listener.attrs + del listener.attrs[ListenerStateUtils.SENTINEL] + + # Ensure that the listener directly reads from the last batch of transformer + # outputs stored on it during prediction. If we don't do this, the wrapped + # listener will end up using the annotations of the last upstream transformer + # pipe that set the `trf_data` annotation on the Doc object. + assert ListenerStateUtils.use_doc_annotations_for_prediction(listener) + ListenerStateUtils.set_use_doc_annotations_for_prediction(listener, False) + + @property + def frozen_transformer(self) -> bool: + return self.layers[0].attrs["_frozen"] + + @frozen_transformer.setter + def frozen_transformer(self, value: bool): + self.layers[0].attrs["_frozen"] = value + + +def wrapped_transformer_and_listener_init(model: WrappedTransformerAndListener, X, Y): + transformer: TransformerModelT = model.layers[0] + listener: TransformerListenerModelT = model.layers[1] + + transformer.init(X=X, Y=Y) + listener.init(X=X, Y=Y) + + +def wrapped_transformer_and_listener_forward( + model: WrappedTransformerAndListener, + docs: WrappedTransformerAndListenerInT, + is_train: bool, +) -> Tuple[WrappedTransformerAndListenerOutT, WrappedTransformerAndListenerBackpropT]: + transformer: TransformerModelT = model.layers[0] + listener: TransformerListenerModelT = model.layers[1] + frozen: bool = transformer.attrs["_frozen"] + ops = model.ops + + # Follows the same process as `Transformer.update()`. + if frozen or not is_train: + outputs = transformer.predict(docs) + bp_outputs = None + d_outputs = None + else: + outputs, bp_outputs = transformer(docs, is_train) + d_outputs = [ + [Ragged(ops.alloc_f(t2v.dataXd.shape), t2v.lengths) for t2v in doc_layers] + for doc_layers in outputs.all_outputs + ] + + def backprop( + one_d_outputs: List[List[Ragged]], outputs_to_backprop: Tuple[int, ...] + ) -> Any: + nonlocal d_outputs + nonlocal frozen + + if frozen: + return [] + + assert bp_outputs is not None + assert d_outputs is not None + for i in range(len(one_d_outputs)): + for j in outputs_to_backprop: + d_outputs[i][j].data += one_d_outputs[i][j].data + + d_docs = bp_outputs(d_outputs) + return d_docs + + # Set the output directly on the listener so that it can use them for both + # training/backprop and prediction. + ListenerStateUtils.receive( + listener, + batch_id=ListenerStateUtils.calculate_batch_id(docs), + outputs=outputs, + backprop=backprop, + ) + listener_outputs, bp_listener_outputs = listener(docs, is_train) + return listener_outputs, bp_listener_outputs + + +def replace_listener_callback( + copied_trf_model: TransformerModelT, + trf_listener: TransformerListenerModelT, + trf_pipe: Any, +): + # To avoid cyclic imports. + from ..pipeline.transformer import CuratedTransformer + + assert isinstance(trf_pipe, CuratedTransformer) + assert ListenerStateUtils.is_listener(trf_listener) + + copied_trf_listener = trf_listener.copy() + wrapper = WrappedTransformerAndListener( + transformer=copied_trf_model, + listener=copied_trf_listener, + frozen=trf_pipe.frozen, + ) + return wrapper + + +def replace_listener_cfg_callback(trf_model_cfg, trf_listener_model_cfg): + result = trf_model_cfg.copy() + + trf_model_cfg_arch = trf_model_cfg["@architectures"].split(".") + assert len(trf_model_cfg_arch) == 3 and trf_model_cfg_arch[-2].endswith( + "Transformer" + ) + trf_listener_model_cfg_arch = trf_listener_model_cfg["@architectures"].split(".") + assert len(trf_listener_model_cfg_arch) == 3 and trf_listener_model_cfg_arch[ + -2 + ].endswith("Listener") + + # The transformer model entrypoint should have a `wrapped_listener` parameter + # that we can use to append the listener's config. + result["wrapped_listener"] = trf_listener_model_cfg + return result diff --git a/TTS/Kokoro/.venv/Lib/site-packages/spacy_curated_transformers/models/output.py b/TTS/Kokoro/.venv/Lib/site-packages/spacy_curated_transformers/models/output.py new file mode 100644 index 0000000000000000000000000000000000000000..47fffae79e6520883728494d26ef51be46c38bda --- /dev/null +++ b/TTS/Kokoro/.venv/Lib/site-packages/spacy_curated_transformers/models/output.py @@ -0,0 +1,116 @@ +from dataclasses import dataclass +from typing import Any, Dict, Generic, List, Optional, TypeVar + +import srsly +from thinc.types import Floats2d, Ragged + +TrfOutputT = TypeVar("TrfOutputT", Floats2d, Ragged) + + +@dataclass +class TransformerModelOutput(Generic[TrfOutputT]): + """Wrapper for PyTorchTransformerOutput consumed by downstream non-PyTorch components. + Also acts as the accumulator for the outputs of subsequent models in the Transformer pipeline. + """ + + # Non-padded, un-stacked versions of the outputs. + # The outer list tracks Docs and the inner list + # tracks the embedding + hidden layer outputs of each Doc. + # + # The inner-most element is a Floats2d when returned by + # the PyTorchWrapper transformer model, which are subsequently + # converted to Ragged by the models that follow. + all_outputs: List[List[TrfOutputT]] + + # Set to True if only the last hidden layer's outputs are preserved. + last_layer_only: bool + + def __init__( + self, *, outputs: List[List[TrfOutputT]], last_layer_only: bool + ) -> None: + self.all_outputs = outputs + self.last_layer_only = last_layer_only + + @property + def embedding_layers(self) -> List[TrfOutputT]: + if self.last_layer_only: + return [] + else: + return [y[0] for y in self.all_outputs] + + @property + def last_hidden_layer_states(self) -> List[TrfOutputT]: + return [y[-1] for y in self.all_outputs] + + @property + def all_hidden_layer_states(self) -> List[List[TrfOutputT]]: + return [y[1:] for y in self.all_outputs] + + @property + def num_outputs(self) -> int: + return len(self.all_outputs[0]) + + +@dataclass +class DocTransformerOutput: + """Stored on Doc instances. Each Ragged element corresponds to a layer in + original TransformerModelOutput, containing representations of piece identifiers.""" + + all_outputs: List[Ragged] + + # Set to True if only the last hidden layer's outputs are preserved. + last_layer_only: bool + + def __init__(self, *, all_outputs: List[Ragged], last_layer_only: bool) -> None: + self.all_outputs = all_outputs + self.last_layer_only = last_layer_only + + @property + def embedding_layer(self) -> Optional[Ragged]: + if self.last_layer_only: + return None + else: + return self.all_outputs[0] + + @property + def last_hidden_layer_state(self) -> Ragged: + return self.all_outputs[-1] + + @property + def all_hidden_layer_states(self) -> List[Ragged]: + return self.all_outputs[1:] + + @property + def num_outputs(self) -> int: + return len(self.all_outputs) + + def from_dict(self, msg: Dict[str, Any]) -> "DocTransformerOutput": + self.all_outputs = [ + Ragged(dataXd, lengths) for (dataXd, lengths) in msg["all_outputs"] + ] + self.last_layer_only = msg["last_layer_only"] + return self + + def to_dict(self) -> Dict[str, Any]: + return { + "all_outputs": [ + (layer.dataXd, layer.lengths) for layer in self.all_outputs + ], + "last_layer_only": self.last_layer_only, + } + + +@srsly.msgpack_encoders("doc_transformer_output") +def serialize_transformer_data(obj: DocTransformerOutput, chain=None): + if isinstance(obj, DocTransformerOutput): + return {"__doc_transformer_output__": obj.to_dict()} + return obj if chain is None else chain(obj) + + +@srsly.msgpack_decoders("doc_transformer_output") +def deserialize_transformer_data(obj, chain=None): + if "__doc_transformer_output__" in obj: + return DocTransformerOutput(all_outputs=[], last_layer_only=False).from_dict( + obj["__doc_transformer_output__"] + ) + return obj if chain is None else chain(obj) diff --git a/TTS/Kokoro/.venv/Lib/site-packages/spacy_curated_transformers/models/pooling.py b/TTS/Kokoro/.venv/Lib/site-packages/spacy_curated_transformers/models/pooling.py new file mode 100644 index 0000000000000000000000000000000000000000..9f80153718b937a6dc407a1bde9db20794451c57 --- /dev/null +++ b/TTS/Kokoro/.venv/Lib/site-packages/spacy_curated_transformers/models/pooling.py @@ -0,0 +1,131 @@ +from typing import List, Union + +import numpy +from spacy.tokens import Doc +from thinc.api import Model +from thinc.types import Ragged + +from .types import PoolingModelT, WithRaggedLastLayerModelT, WithRaggedLayersModelT + + +def with_ragged_layers( + pooling: PoolingModelT, +) -> WithRaggedLayersModelT: + """Concatenate all Docs and layers into a Ragged for pooling.""" + return Model("with_ragged_layers", with_ragged_layers_forward, layers=[pooling]) + + +def with_ragged_layers_forward( + model: WithRaggedLayersModelT, + X: Union[List[Doc], List[List[Ragged]]], + is_train: bool, +): + pooling: PoolingModelT = model.layers[0] + xp = model.ops.xp + + datas = [] + lens = [] + doc_layer_counts = [] + doc_token_counts = [] + for X_doc in X: + X_doc_layers = X_doc._.trf_data.all_outputs if isinstance(X_doc, Doc) else X_doc + for X_layer in X_doc_layers: + datas.append(X_layer.dataXd) + lens.append(X_layer.lengths) + doc_layer_counts.append(len(X_doc_layers)) + doc_token_counts.append(len(X_doc_layers[0].lengths)) + + X_flat = Ragged(xp.concatenate(datas, axis=0), xp.concatenate(lens, axis=0)) + Y_pooled, pooling_backprop = pooling(X_flat, is_train) + + # This array is placed in CPU memory intentionally --- CuPy split (used + # below) does not support indices in device memory. + doc_layer_lens = numpy.asarray( + [ + doc_layer * doc_len + for doc_layer, doc_len in zip(doc_layer_counts, doc_token_counts) + ] + ) + Y = [ + xp.split(doc_array, doc_layer) + for (doc_array, doc_layer) in zip( + xp.split(Y_pooled, numpy.cumsum(doc_layer_lens)[:-1]), + doc_layer_counts, + ) + ] + + def backprop(dY): + dY_pooled_flat = xp.concatenate( + [dY_layer for dY_doc in dY for dY_layer in dY_doc] + ) + dY_flat = pooling_backprop(dY_pooled_flat).dataXd + + dY = [] + for X_doc in X: + dY_layer = [] + + X_doc_layers = ( + X_doc._.trf_data.all_outputs if isinstance(X_doc, Doc) else X_doc + ) + for X_layer in X_doc_layers: + doc_unpooled_len = X_layer.dataXd.shape[0] + dY_layer.append(Ragged(dY_flat[:doc_unpooled_len], X_layer.lengths)) + dY_flat = dY_flat[doc_unpooled_len:] + + dY.append(dY_layer) + + return dY + + return Y, backprop + + +def with_ragged_last_layer( + pooling: PoolingModelT, +) -> WithRaggedLastLayerModelT: + """Concatenate the last layers for all Docs into a Ragged for pooling.""" + return Model( + "with_ragged_last_layer", with_ragged_last_layer_forward, layers=[pooling] + ) + + +def with_ragged_last_layer_forward( + model: WithRaggedLastLayerModelT, X: Union[List[Doc], List[Ragged]], is_train: bool +): + pooling: PoolingModelT = model.layers[0] + xp = model.ops.xp + + datas = [] + lens = [] + doc_lens = [] + for X_doc in X: + X_doc_layer = ( + X_doc._.trf_data.last_hidden_layer_state + if isinstance(X_doc, Doc) + else X_doc + ) + datas.append(X_doc_layer.dataXd) + lens.append(X_doc_layer.lengths) + doc_lens.append(len(X_doc_layer.lengths)) + + X_flat = Ragged(xp.concatenate(datas, axis=0), xp.concatenate(lens, axis=0)) + Y_pooled, pooling_backprop = pooling(X_flat, is_train) + Y = xp.split(Y_pooled, numpy.cumsum(doc_lens)[:-1]) + + def backprop(dY): + dY_pooled_flat = xp.concatenate(dY) + dY_flat = pooling_backprop(dY_pooled_flat).dataXd + + dY = [] + for X_doc in X: + X_doc_layer = ( + X_doc._.trf_data.last_hidden_layer_states + if isinstance(X_doc, Doc) + else X_doc + ) + doc_unpooled_len = X_doc_layer.dataXd.shape[0] + dY.append(Ragged(dY_flat[:doc_unpooled_len], X_doc_layer.lengths)) + dY_flat = dY_flat[doc_unpooled_len:] + + return dY + + return Y, backprop diff --git a/TTS/Kokoro/.venv/Lib/site-packages/spacy_curated_transformers/models/remove_eos_bos.py b/TTS/Kokoro/.venv/Lib/site-packages/spacy_curated_transformers/models/remove_eos_bos.py new file mode 100644 index 0000000000000000000000000000000000000000..92a11e248cb11dc3efc62849c5b3fa305508cba2 --- /dev/null +++ b/TTS/Kokoro/.venv/Lib/site-packages/spacy_curated_transformers/models/remove_eos_bos.py @@ -0,0 +1,65 @@ +from typing import List, Tuple, cast + +from thinc.api import Model, Ragged + +from .output import TransformerModelOutput +from .types import ( + RaggedInOutT, + SentMarkerRemoverBackpropT, + SentMarkerRemoverInOutT, + SentMarkerRemoverModelT, +) + + +def remove_bos_eos() -> SentMarkerRemoverModelT: + """Strips the BOS/EOS piece identifiers from the transformer output.""" + return Model("remove_bos_eos", remove_bos_eos_forward) + + +def remove_bos_eos_forward( + model: Model, X: SentMarkerRemoverInOutT, is_train: bool +) -> Tuple[SentMarkerRemoverInOutT, SentMarkerRemoverBackpropT]: + if not isinstance(X, TransformerModelOutput): + raise ValueError( + f"Model '{model.name}' received an unexpected input of type '{type(X)}'. " + "It can only wrap/be chained with models whose outputs are of type " + "`TransformerModelOutput` (in almost all cases, models of type `TorchTransformerModelT`)" + ) + + X.all_outputs = [[Xr[1:-1] for Xr in inner] for inner in X.all_outputs] + + def backprop(dY: RaggedInOutT) -> RaggedInOutT: + # Pass-through dY, but add zero gradient for the special bos/eos + # tokens. + + def _apply_to_layer(input: List[Ragged], output: List[Ragged]): + for dYr in input: + dim0 = dYr.dataXd.shape[0] + 2 + + data = model.ops.xp.empty((dim0,) + dYr.dataXd.shape[1:], dtype="f") + data[[0, -1]] = 0.0 + data[1:-1] = dYr.dataXd + + lengths = model.ops.alloc1i(dYr.lengths.shape[0] + 2, zeros=False) + lengths[[0, -1]] = 1 + lengths[1:-1] = dYr.lengths + output.append(Ragged(data, lengths=lengths)) + + def _apply_to_layers(input: List[List[Ragged]], output: List[List[Ragged]]): + for inner_dY in input: + inner_dX: List[Ragged] = [] + _apply_to_layer(inner_dY, inner_dX) + output.append(inner_dX) + + if isinstance(dY[0], list): + nested_list = cast(List[List[Ragged]], dY) + dX_nested: List[List[Ragged]] = [] + _apply_to_layers(nested_list, dX_nested) + return dX_nested + else: + flat_list = cast(List[Ragged], dY) + dX_flat: List[Ragged] = [] + _apply_to_layer(flat_list, dX_flat) + return dX_flat + + return X, backprop diff --git a/TTS/Kokoro/.venv/Lib/site-packages/spacy_curated_transformers/models/scalar_weight.py b/TTS/Kokoro/.venv/Lib/site-packages/spacy_curated_transformers/models/scalar_weight.py new file mode 100644 index 0000000000000000000000000000000000000000..8a3d529a6c191ca978f3d2636aefae5ee2379cea --- /dev/null +++ b/TTS/Kokoro/.venv/Lib/site-packages/spacy_curated_transformers/models/scalar_weight.py @@ -0,0 +1,137 @@ +from typing import Callable, List, Tuple, cast + +from curated_transformers.models.scalar_weight import ScalarWeight +from spacy.util import SimpleFrozenDict +from thinc.layers.pytorchwrapper import PyTorchWrapper_v2 +from thinc.model import Model +from thinc.shims.pytorch_grad_scaler import PyTorchGradScaler +from thinc.types import ArgsKwargs, Ragged +from thinc.util import torch2xp, xp2torch +from torch import Tensor + +from ..util import all_equal +from .types import ScalarWeightInT, ScalarWeightModelT, ScalarWeightOutT + + +def build_scalar_weight_v1( + *, + num_layers: int, + dropout_prob: float = 0.1, + mixed_precision: bool = False, + grad_scaler_config: dict = SimpleFrozenDict(), +) -> ScalarWeightModelT: + """Construct a model that accepts a list of transformer layer + outputs and returns a weighted representation of the same. + + num_layers (int): + Number of transformer hidden layers. + dropout_prob (float): + Dropout probability. + mixed_precision (bool): + Use mixed-precision training. + grad_scaler_config (dict): + Configuration passed to the PyTorch gradient scaler. + """ + if isinstance(grad_scaler_config, SimpleFrozenDict): + # Create a new, mutable dict instance. + grad_scaler_config = {} + + if "enabled" not in grad_scaler_config: + grad_scaler_config["enabled"] = mixed_precision + + # Increment number of layers by one to include the embedding layer. + scalar_weighting_layer = ScalarWeight( + num_layers=num_layers + 1, dropout_prob=dropout_prob + ) + + model = PyTorchWrapper_v2( + scalar_weighting_layer, + convert_inputs=_convert_inputs, + convert_outputs=_convert_outputs, + mixed_precision=mixed_precision, + grad_scaler=PyTorchGradScaler(**grad_scaler_config), + ) + + return model + + +def _convert_inputs( + model: Model, X: ScalarWeightInT, is_train: bool = False +) -> Tuple[ArgsKwargs, Callable[[ArgsKwargs], List[Ragged]]]: + ops = model.ops + + batch_size = len(X) + seq_lens = [x[0].data.shape[0] for x in X] + max_seq_len = max(seq_lens) + num_layers = [len(x) for x in X] + if not all_equal(num_layers): + raise ValueError( + "Input passed to the `ScalarWeight` model do not have the same number " + f"layers. Distinct layer counts: {set(num_layers)}" + ) + layer_widths = [layer.data.shape[1] for x in X for layer in x] + if not all_equal(layer_widths): + raise ValueError( + "Input passed to the `ScalarWeight` model do not have the same width. " + f"Distinct widths: {set(layer_widths)}" + ) + + # [batch_size, max_seq_len, num_layers, layer_width] + Xops = ops.alloc4f(batch_size, max_seq_len, num_layers[0], layer_widths[0]) + for doc_idx, layers in enumerate(X): + seq_len = seq_lens[doc_idx] + for layer_idx, data in enumerate(layers): + Xops[doc_idx, :seq_len, layer_idx, :] = data.dataXd # type: ignore + Xt = xp2torch(Xops, requires_grad=True) + + def convert_from_torch_backward(d_inputs: ArgsKwargs): + # [batch, seq, num_layers, layer_width] + dt_inputs: Tensor = cast(Tensor, d_inputs.args[0]) + + dX = [] + for doc_idx in range(dt_inputs.shape[0]): + seq_len = seq_lens[doc_idx] + lengths = X[doc_idx][0].lengths + dX_layers = [] + for layer_idx in range(dt_inputs.shape[2]): + dX_layer = dt_inputs[doc_idx, :seq_len, layer_idx, :] + dX_layers.append( + Ragged(data=torch2xp(dX_layer, ops=ops), lengths=lengths) + ) + dX.append(dX_layers) + return dX + + output = ArgsKwargs(args=(Xt,), kwargs={}) + return output, convert_from_torch_backward + + +def _convert_outputs( + model: Model, inputs_outputs: Tuple[ScalarWeightInT, Tensor], is_train: bool +) -> Tuple[ScalarWeightOutT, Callable[[List[Ragged]], ArgsKwargs]]: + ops = model.ops + X, Yt = inputs_outputs + + Y = [] + for doc_idx in range(len(X)): + seq_len = X[doc_idx][0].data.shape[0] + lengths = X[doc_idx][0].lengths + # [batch, seq, width] + Y_layer = Yt[doc_idx, :seq_len, :] # type: ignore + Y.append(Ragged(torch2xp(Y_layer, ops=model.ops), lengths=lengths)) + + def convert_for_torch_backward(dY: List[Ragged]) -> ArgsKwargs: + max_seq_len = max(y.data.shape[0] for y in dY) + width = dY[0].data.shape[1] + + dYt_ops = ops.alloc3f(len(dY), max_seq_len, width) + for doc_idx in range(len(dY)): + seq_len = dY[doc_idx].data.shape[0] + dYt_ops[doc_idx, :seq_len, :] = dY[doc_idx].dataXd # type: ignore + + dYt = xp2torch(dYt_ops) + return ArgsKwargs( + args=(Yt,), + kwargs={"grad_tensors": dYt}, + ) + + return Y, convert_for_torch_backward diff --git a/TTS/Kokoro/.venv/Lib/site-packages/spacy_curated_transformers/models/types.py b/TTS/Kokoro/.venv/Lib/site-packages/spacy_curated_transformers/models/types.py new file mode 100644 index 0000000000000000000000000000000000000000..0b4b7bab291901cff4cb9748d66775dfcaf010ba --- /dev/null +++ b/TTS/Kokoro/.venv/Lib/site-packages/spacy_curated_transformers/models/types.py @@ -0,0 +1,62 @@ +from typing import Any, Callable, Iterable, List, Union + +from spacy.tokens.doc import Doc +from thinc.model import Model +from thinc.types import Floats2d, Ints1d, Ragged + +from .output import TransformerModelOutput + +PoolingModelT = Model[Ragged, Floats2d] +TransformerListenerModelT = Model[List[Doc], List[Floats2d]] + +WithRaggedLayersInT = Union[Iterable[Doc], Iterable[Iterable[Ragged]]] +WithRaggedLayersOutT = List[List[Floats2d]] # Doc -> Layer -> Representation +WithRaggedLayersModelT = Model[WithRaggedLayersInT, WithRaggedLayersOutT] + +WithRaggedLastLayerInT = Union[Iterable[Doc], Iterable[Ragged]] +WithRaggedLastLayerOutT = List[Floats2d] # Doc -> Last Layer Representation +WithRaggedLastLayerModelT = Model[WithRaggedLastLayerInT, WithRaggedLastLayerOutT] + + +WsTokenAdapterInT = List[Doc] +WsTokenAdapterOutT = TransformerModelOutput +WsTokenAdapterBackpropT = Callable[[List[List[Ragged]]], Any] +WsTokenAdapterModelT = Model[WsTokenAdapterInT, WsTokenAdapterOutT] + +# In case of a single list, each element corresponds to a single document/span. +# For nested lists, each inner list corresponds to a single document/span. +RaggedInOutT = Union[List[Ragged], List[List[Ragged]]] +Floats2dInOutT = Union[List[Floats2d], List[List[Floats2d]]] + +SpanExtractorInT = List[Ragged] +SpanExtractorOutT = TransformerModelOutput +SpanExtractorBackpropT = Callable[[RaggedInOutT], RaggedInOutT] +SpanExtractorModelT = Model[SpanExtractorInT, SpanExtractorOutT] + +# Inner PyTorch transformer. +TorchTransformerInT = List[Ints1d] +TorchTransformerOutT = TransformerModelOutput +TorchTransformerModelT = Model[TorchTransformerInT, TorchTransformerOutT] + +SentMarkerRemoverInOutT = TransformerModelOutput +SentMarkerRemoverBackpropT = Callable[[RaggedInOutT], RaggedInOutT] +SentMarkerRemoverModelT = Model[SentMarkerRemoverInOutT, SentMarkerRemoverInOutT] + +# Wrapper that includes the various pre- and post-processing layers such +# as the piece encoder, adapter, etc. +TransformerInT = List[Doc] +TransformerOutT = TransformerModelOutput +TransformerBackpropT = Callable[[List[List[Floats2d]]], Any] +TransformerModelT = Model[TransformerInT, TransformerOutT] + +ScalarWeightInT = List[List[Ragged]] # Doc -> Layer -> Representation +ScalarWeightOutT = List[Ragged] # Doc -> Weighted Representation +ScalarWeightModelT = Model[ScalarWeightInT, ScalarWeightOutT] + +# Only used when replacing listeners. +WrappedTransformerAndListenerInT = List[Doc] +WrappedTransformerAndListenerOutT = List[Floats2d] +WrappedTransformerAndListenerBackpropT = Callable[[List[List[Floats2d]]], Any] +WrappedTransformerAndListenerModelT = Model[ + WrappedTransformerAndListenerInT, WrappedTransformerAndListenerOutT +] diff --git a/TTS/Kokoro/.venv/Lib/site-packages/spacy_curated_transformers/models/with_non_ws_tokens.py b/TTS/Kokoro/.venv/Lib/site-packages/spacy_curated_transformers/models/with_non_ws_tokens.py new file mode 100644 index 0000000000000000000000000000000000000000..cdfee3140adeb765c2b114e793e70d6f69839e10 --- /dev/null +++ b/TTS/Kokoro/.venv/Lib/site-packages/spacy_curated_transformers/models/with_non_ws_tokens.py @@ -0,0 +1,253 @@ +from collections import Counter +from dataclasses import dataclass +from typing import Any, Iterator, List, Optional, Tuple, cast + +from spacy.tokens import Doc +from thinc.api import Model, Ragged + +from ..tokenization.types import Tok2PiecesInT +from .types import ( + WsTokenAdapterBackpropT, + WsTokenAdapterInT, + WsTokenAdapterModelT, + WsTokenAdapterOutT, +) + + +@dataclass +class TokenAlignment: + # The piece offset of the token within the doc with whitespace tokens. + ws_piece_offset: int + + # The piece offset of the token within the doc without whitespace tokens. + # Whitespace tokens have None as their offset, since they are not + # represented in piece sequences without whitespace. + no_ws_piece_offset: Optional[int] + + # The length of this sequence in pieces. + n_pieces: int + + @property + def is_whitespace(self) -> bool: + return self.no_ws_piece_offset is None + + +@dataclass +class Alignment: + # Token alignments. + tokens: List[TokenAlignment] + + # The length of the document in pieces with whitespace tokens. + ws_n_pieces: int + + # The length of the document in pieces without whitespace tokens. + no_ws_n_pieces: int + + @property + def has_no_whitespace(self) -> bool: + return self.ws_n_pieces == self.no_ws_n_pieces + + def __iter__(self) -> Iterator[TokenAlignment]: + return iter(self.tokens) + + +def with_non_ws_tokens( + layer: Model[Tok2PiecesInT, WsTokenAdapterOutT] +) -> WsTokenAdapterModelT: + """Removes non-whitespace tokens from the input before + passing it to the inner model.""" + return Model( + "with_non_ws_tokens", + with_non_ws_tokens_forward, + init=with_non_ws_tokens_init, + layers=[layer], + ) + + +def with_non_ws_tokens_forward( + model: Model, X: WsTokenAdapterInT, is_train: bool +) -> Tuple[WsTokenAdapterOutT, WsTokenAdapterBackpropT]: + inner: Model[Tok2PiecesInT, WsTokenAdapterOutT] = model.layers[0] + # The transformer doesn't expect whitespace tokens, so at some stage + # they need to be removed before we pass the IDs in, as encoded by + # the tokenizer. + # Previous implementations did this as a wrapper around the whole + # process: we removed the whitespace token IDs, encoded with the + # transformer, and then recalculated the output arrays, inserting + # empty rows for the whitespace tokens. + # This was expensive, and the output manipulation is actually unnecessary. + # The pooling layers which consume these representations actually support + # lengths 0, for tokens in the document that don't correspond to any + # wordpieces. We therefore just need to have 0-length entries in + # our ragged array. + # Here's a reminder of how the ragged representation works. + # So let's say we have: + # "We went to Timbuktu" + # And this is wordpieced like: + # [["We"], ["went"], ["to"], ["Tim", "buktu"]] + # We'll have a ragged with regions of lengths [1, 1, 1, 2] + # -- it's basically a nested list with the arrays concatenated. + # If we have a whitespace token, we won't have any wordpiece + # corresponding to it. This means we'll end up with a 0-length + # alignment. This is fine -- the pooling operations all handle + # 0-length ragged entries. + # Instead of all this recalculation, what we've done instead is + # update the tokenizers to make sure they insert the 0-length + # entry for the whitespace tokens. + # This lets us make this operation a noop. We leave the function + # here however, so that the models trained previously still load + # correctly. We need to remove this in future when we retrain. + Y, backprop = inner(X, is_train=is_train) + return Y, backprop + + +def with_non_ws_tokens_init( + model: WsTokenAdapterModelT, + X: Optional[WsTokenAdapterInT] = None, + Y: Optional[WsTokenAdapterInT] = None, +) -> None: + # Deprecated + model.layers[0].initialize(X=_filter_tokens(X)[0] if X is not None else None, Y=Y) + + +def _create_alignments( + model: Model, output: WsTokenAdapterOutT, ws_counts: List[Counter] +) -> List[Alignment]: + """Create an alignment between whitespace and non-whitespace sequences.""" + # Deprecated + alignments = [] + for doc_output, doc_ws_counts in zip(output.all_outputs, ws_counts): + doc_alignments = [] + no_ws_offset = 0 + ws_offset = 0 + pieces_lens = model.ops.to_numpy(doc_output[0].lengths).tolist() + for idx, pieces_len in enumerate(pieces_lens): + # Whitespace tokens that preceded a token. + n_ws = doc_ws_counts[idx] + for i in range(ws_offset, ws_offset + n_ws): + doc_alignments.append( + TokenAlignment( + ws_piece_offset=i, no_ws_piece_offset=None, n_pieces=1 + ) + ) + ws_offset += n_ws + + # The token itself. + doc_alignments.append( + TokenAlignment( + n_pieces=pieces_len, + no_ws_piece_offset=no_ws_offset, + ws_piece_offset=ws_offset, + ) + ) + + no_ws_offset += pieces_len + ws_offset += pieces_len + + # There can be spaces after the last non-whitespace token. + n_ws = doc_ws_counts[len(pieces_lens)] + for i in range(ws_offset, ws_offset + n_ws): + doc_alignments.append( + TokenAlignment(ws_piece_offset=i, no_ws_piece_offset=None, n_pieces=1) + ) + ws_offset += n_ws + + # Add the doc alignment. + alignments.append( + Alignment( + tokens=doc_alignments, + no_ws_n_pieces=no_ws_offset, + ws_n_pieces=ws_offset, + ) + ) + + return alignments + + +def _filter_tokens(docs: List[Doc]) -> Tuple[Tok2PiecesInT, List[Counter]]: + """Filter out whitespace tokens. Returns the non-whitespace tokens + and a mapping from the (non-whitespace) token offset to the number + of whitespaces that preceded the token.""" + # Deprecated + tokens = [] + ws_counts = [] + for doc in docs: + doc_tokens = [] + doc_ws_counts: Counter = Counter() + offset = 0 + for token in doc: + if token.is_space: + doc_ws_counts[offset] += 1 + continue + doc_tokens.append(token) + offset += 1 + tokens.append(doc_tokens) + ws_counts.append(doc_ws_counts) + + return tokens, ws_counts + + +def _add_whitespace_tokens( + model: Model, Y_no_ws: WsTokenAdapterOutT, alignments: List[Alignment] +): + """Add stub representations for whitespace tokens.""" + # Deprecated + for Y_doc, doc_alignment in zip(Y_no_ws.all_outputs, alignments): + if doc_alignment.has_no_whitespace: + continue + + hidden_width = Y_doc[0].dataXd.shape[1] + for layer_idx, layer in enumerate(Y_doc): + lengths = [] + new_layer = model.ops.alloc2f(doc_alignment.ws_n_pieces, hidden_width) + + for alignment in doc_alignment: + if not alignment.is_whitespace: + assert alignment.no_ws_piece_offset is not None + new_layer[ + alignment.ws_piece_offset : alignment.ws_piece_offset + + alignment.n_pieces, + :, + ] = layer.dataXd[ + alignment.no_ws_piece_offset : alignment.no_ws_piece_offset + + alignment.n_pieces, + :, + ] + lengths.append(alignment.n_pieces) + + Y_doc[layer_idx] = Ragged(new_layer, lengths=model.ops.asarray1i(lengths)) + + +def _remove_whitespace_tokens( + model: Model, dY: List[List[Ragged]], alignments: List[Alignment] +): + """Remove representations for whitespace tokens.""" + # Deprecated + for dY_doc, doc_alignment in zip(dY, alignments): + if doc_alignment.has_no_whitespace: + continue + + hidden_width = cast(Tuple[int, ...], dY_doc[0].dataXd.shape)[1] + for layer_idx, layer in enumerate(dY_doc): + new_layer = model.ops.alloc2f(doc_alignment.no_ws_n_pieces, hidden_width) + lengths = [] + + for alignment in doc_alignment: + if alignment.is_whitespace: + continue + + assert alignment.no_ws_piece_offset is not None + # Extra type ignore to accomodate two MyPy versions :(. + new_layer[ # type: ignore + alignment.no_ws_piece_offset : alignment.no_ws_piece_offset + + alignment.n_pieces, # type: ignore + :, + ] = layer.dataXd[ # type: ignore + alignment.ws_piece_offset : alignment.ws_piece_offset + + alignment.n_pieces, + :, + ] + + lengths.append(alignment.n_pieces) + + dY_doc[layer_idx] = Ragged(new_layer, lengths=model.ops.asarray1i(lengths)) diff --git a/TTS/Kokoro/.venv/Lib/site-packages/spacy_curated_transformers/models/with_strided_spans.py b/TTS/Kokoro/.venv/Lib/site-packages/spacy_curated_transformers/models/with_strided_spans.py new file mode 100644 index 0000000000000000000000000000000000000000..5daea2f6974efa13895e70a1770a133264b48653 --- /dev/null +++ b/TTS/Kokoro/.venv/Lib/site-packages/spacy_curated_transformers/models/with_strided_spans.py @@ -0,0 +1,331 @@ +from functools import partial +from typing import Any, Callable, Iterable, List, Optional, Tuple, Union, cast + +from thinc.model import Model +from thinc.types import Floats2d, Ints1d, Ragged + +from .output import TransformerModelOutput +from .types import ( + Floats2dInOutT, + RaggedInOutT, + SpanExtractorBackpropT, + SpanExtractorInT, + SpanExtractorModelT, + SpanExtractorOutT, + TorchTransformerInT, + TorchTransformerModelT, + TorchTransformerOutT, +) + + +def build_with_strided_spans_v1( + stride: int = 96, window: int = 128, batch_size: int = 384 +) -> Callable[[TorchTransformerModelT, int, int], SpanExtractorModelT]: + """Construct a model that can be used to convert a list of ragged + piece identifiers to strided spans and vice-versa. + + stride (int): + The stride of the span generator. + window (int): + The (maximum) size of each span. + batch_size (int): + The maximum number of spans that are processed + by the transformer model at a time. + """ + return partial( + with_strided_spans, stride=stride, window=window, batch_size=batch_size + ) + + +def with_strided_spans( + trf_model: TorchTransformerModelT, + *, + stride: int = 96, + window: int = 128, + batch_size: int = 384, +) -> Model[List[Ragged], TransformerModelOutput]: + if not (window // 2 <= stride <= window): + raise ValueError( + f"Span extractor stride ({stride}) must be within [window_size / 2, " + f"window_size] ([{window // 2}, {window}])" + ) + + if batch_size <= 0: + raise ValueError("Span extractor batch size must be greater than zero") + + attrs = { + "stride": stride, + "window": window, + "batch_size": batch_size, + } + return Model( + "with_strided_spans", + with_strided_spans_forward, + init=with_strided_spans_init, + layers=[trf_model], + attrs=attrs, + ) + + +def with_strided_spans_init( + model: SpanExtractorModelT, + X: Optional[SpanExtractorInT], + Y: Optional[SpanExtractorInT], +): + stride: int = model.attrs["stride"] + window: int = model.attrs["window"] + + X_spans = ( + _ragged_to_strided_arrays(X, stride=stride, window=window)[0] + if X is not None + else None + ) + Y_spans = ( + _ragged_to_strided_arrays(Y, stride=stride, window=window)[0] + if Y is not None + else None + ) + model.layers[0].initialize(X=X_spans, Y=Y_spans) + + +def with_strided_spans_forward( + model: SpanExtractorModelT, + X: SpanExtractorInT, + is_train: bool, +) -> Tuple[SpanExtractorOutT, SpanExtractorBackpropT]: + transformer: TorchTransformerModelT = model.layers[0] + stride: int = model.attrs["stride"] + window: int = model.attrs["window"] + batch_size: int = model.attrs["batch_size"] + + spans, doc_lens = _ragged_to_strided_arrays(Xlr=X, stride=stride, window=window) + # Calculate once and use for all layer outputs. + doc_len_sums = [int(x.sum()) for x in doc_lens] + + backprops = [] + outputs = [] + for batch in _split_spans(spans, batch_size): + output, bp = transformer(cast(TorchTransformerInT, batch), is_train=is_train) + if not isinstance(output, TransformerModelOutput): + raise ValueError( + f"Model '{model.name}' received an unexpected input of type '{type(output)}'. " + "It can only wrap/be chained with models whose outputs are of type " + "`TransformerModelOutput` (in almost all cases, models of type `TorchTransformerModelT`)" + ) + + outputs.append(output) + backprops.append(bp) + + trf_output = _unsplit_outputs(outputs) + + # Suppose we have: + # + # A B C D E F G H I + # <---> stride + # <-----> window + # + # D is part of both the current and the next window. To + # ensure that there is no drift in representations, we + # average them in both representations. + _apply_to_overlaps( + trf_output.all_outputs, + doc_len_sums, + stride=stride, + window=window, + func=_average_arrays, + ) + + model_output = _strided_arrays_to_ragged( + model, trf_output.all_outputs, doc_lens, doc_len_sums, stride=stride + ) + trf_output.all_outputs = cast(List[List[Ragged]], model_output) + + def backprop(dY: RaggedInOutT): + dY_spans, dY_lengths = _ragged_to_strided_arrays( + dY, stride=stride, window=window + ) + # Calculate once and use for all layer outputs. + dY_length_sums = [int(x.sum()) for x in dY_lengths] + + # Both overlaps will have dY. However, the proper gradient is 0.5 * dY + # since we averaged the overlaps in the forward pass. + _apply_to_overlaps( + dY_spans, + dY_length_sums, + stride=stride, + window=window, + func=_normalize_gradients, + ) + + dXlf = [] + split_dY_spans = list(_split_spans(dY_spans, batch_size)) + assert len(split_dY_spans) == len(backprops) + for dY_batch, bp_trf in zip(split_dY_spans, backprops): + dXlf_batch = bp_trf(dY_batch) + dXlf.extend(dXlf_batch) + + return _strided_arrays_to_ragged( + model, dXlf, dY_lengths, dY_length_sums, stride=stride + ) + + return trf_output, backprop + + +def _split_spans(spans: Floats2dInOutT, batch_size: int) -> Iterable[Floats2dInOutT]: + while len(spans): + batch = spans[:batch_size] + yield batch + spans = spans[batch_size:] + + +def _unsplit_outputs(outputs: List[TorchTransformerOutT]) -> TorchTransformerOutT: + last_layer_only = outputs[0].last_layer_only + merged = TransformerModelOutput( + outputs=cast( + List[List[Floats2d]], + [inner for outer in outputs for inner in outer.all_outputs], + ), + last_layer_only=last_layer_only, + ) + return merged + + +def _apply_to_overlaps( + Xlf: Floats2dInOutT, + len_sums: List[int], + *, + stride: int, + window: int, + func: Callable[[Any, Any], None], +): + """Applies a function to overlapping windows, modifying the arrays + in Xlf in-place.""" + + def _apply_to_layer(input: Union[Tuple[Floats2d, ...], List[Floats2d]]): + for doc_len in len_sums: + prev_overlap = None + while doc_len != 0: + overlap = min(window - stride, doc_len) + if prev_overlap is not None: + cur_overlap = input[0][:overlap] + prev_overlap = prev_overlap[-overlap:] + func(prev_overlap, cur_overlap) + prev_overlap = input[0][-overlap:] + + doc_len -= min(stride, doc_len) + input = input[1:] + + def _apply_to_layers(input: List[List[Floats2d]]): + # We need to transpose the input since the overlaps happen between + # each layer of each span, i.e., span 1 layer 1 overlaps with span 2 layer 1, etc. + transposed = list(zip(*input)) + for x in transposed: + _apply_to_layer(x) + + # Nothing to do if there is no overlap. + if window - stride == 0: + return + + if isinstance(Xlf[0], list): + nested_list = cast(List[List[Floats2d]], Xlf) + _apply_to_layers(nested_list) + else: + flat_tuple = cast(Tuple[Floats2d, ...], Xlf) + _apply_to_layer(flat_tuple) + + +def _average_arrays(array1, array2): + array1 += array2 + array1 /= 2.0 + array2[:] = array1 + + +def _normalize_gradients(array1, array2): + array1 *= 0.5 + array2 *= 0.5 + + +def _ragged_to_strided_arrays( + Xlr: RaggedInOutT, *, stride: int, window: int +) -> Tuple[Floats2dInOutT, List[Ints1d]]: + """Convert the per-Doc Ragged sequences to an array of sub-sequences that span + all the input documents.""" + + def _apply_to_layer( + input: Union[Tuple[Ragged, ...], List[Ragged]], output: List[Floats2d] + ): + for Xr in input: + data = cast(Floats2d, Xr.dataXd) + while data.shape[0] != 0: + output.append(data[:window]) + data = data[stride:] + + def _apply_to_layers(input: List[List[Ragged]]): + # Transpose input to reconstruct strides across all documents. + transposed = list(zip(*Xlr)) + spans: List[List[Floats2d]] = [[] for _ in range(len(transposed))] + lens = [x.lengths for x in transposed[0]] + for x, y in zip(transposed, spans): + _apply_to_layer(x, y) + + # Normalize sequences as lists. + spans = [[y for y in x] for x in zip(*spans)] + return spans, lens + + if isinstance(Xlr[0], list): + # Gradients in the backward pass. + # Shape of spans: (span, layer) + nested_list = cast(List[List[Ragged]], Xlr) + return _apply_to_layers(nested_list) + else: + # Inputs in the forward pass. + flat_list = cast(List[Ragged], Xlr) + spans: List[Floats2d] = [] + lens = [x.lengths for x in flat_list] + _apply_to_layer(flat_list, spans) + return spans, lens + + +def _strided_arrays_to_ragged( + model: Model, + Xlf: Floats2dInOutT, + lens: List[Ints1d], + len_sums: List[int], + *, + stride: int, +) -> RaggedInOutT: + """Inverse operation of _ragged_to_strided_arrays.""" + + def _apply_to_layer( + input: Union[Tuple[Floats2d, ...], List[Floats2d]], output: List[Ragged] + ): + for doc_len, Xr_lens in zip(len_sums, lens): + arrs = [] + while doc_len != 0: + arr = input[0][: min(stride, doc_len)] + arrs.append(arr) + doc_len -= arr.shape[0] + input = input[1:] + output.append(Ragged(model.ops.flatten(arrs), lengths=Xr_lens)) + + def _apply_to_layers(input: List[List[Floats2d]]): + # Transpose input to reconstruct strides across all documents. + transposed = list(zip(*input)) + Xlr: List[List[Ragged]] = [[] for _ in range(len(transposed))] + for x, y in zip(transposed, Xlr): + _apply_to_layer(x, y) + + # Normalize sequences as lists. + Xlr = [[y for y in x] for x in zip(*Xlr)] + return Xlr + + if isinstance(Xlf[0], list): + # Transformer output in forward pass. + nested_list = cast(List[List[Floats2d]], Xlf) + return _apply_to_layers(nested_list) + else: + # Gradient from torch in backward pass. + flat_tuple = cast(Tuple[Floats2d, ...], Xlf) + Xlr: List[Ragged] = [] + _apply_to_layer(flat_tuple, Xlr) + return Xlr diff --git a/TTS/Kokoro/.venv/Lib/site-packages/spacy_curated_transformers/pipeline/__init__.py b/TTS/Kokoro/.venv/Lib/site-packages/spacy_curated_transformers/pipeline/__init__.py new file mode 100644 index 0000000000000000000000000000000000000000..9ac3c35f5d6bd3ccfa3b354be4f62148291e2d25 --- /dev/null +++ b/TTS/Kokoro/.venv/Lib/site-packages/spacy_curated_transformers/pipeline/__init__.py @@ -0,0 +1 @@ +from .transformer import CuratedTransformer diff --git a/TTS/Kokoro/.venv/Lib/site-packages/spacy_curated_transformers/pipeline/__pycache__/__init__.cpython-312.pyc b/TTS/Kokoro/.venv/Lib/site-packages/spacy_curated_transformers/pipeline/__pycache__/__init__.cpython-312.pyc new file mode 100644 index 0000000000000000000000000000000000000000..3efef68f4e6d97437b1a0cb013dbb2ce01f45496 Binary files /dev/null and b/TTS/Kokoro/.venv/Lib/site-packages/spacy_curated_transformers/pipeline/__pycache__/__init__.cpython-312.pyc differ diff --git a/TTS/Kokoro/.venv/Lib/site-packages/spacy_curated_transformers/pipeline/__pycache__/transformer.cpython-312.pyc b/TTS/Kokoro/.venv/Lib/site-packages/spacy_curated_transformers/pipeline/__pycache__/transformer.cpython-312.pyc new file mode 100644 index 0000000000000000000000000000000000000000..5cd593b013bf92f9561ad6b13067d596ac0a7952 Binary files /dev/null and b/TTS/Kokoro/.venv/Lib/site-packages/spacy_curated_transformers/pipeline/__pycache__/transformer.cpython-312.pyc differ diff --git a/TTS/Kokoro/.venv/Lib/site-packages/spacy_curated_transformers/pipeline/transformer.py b/TTS/Kokoro/.venv/Lib/site-packages/spacy_curated_transformers/pipeline/transformer.py new file mode 100644 index 0000000000000000000000000000000000000000..361536c48ee40ddd63da74aed81bfa908ecf5b82 --- /dev/null +++ b/TTS/Kokoro/.venv/Lib/site-packages/spacy_curated_transformers/pipeline/transformer.py @@ -0,0 +1,461 @@ +from itertools import islice +from typing import ( + Any, + Callable, + Dict, + Iterable, + Iterator, + List, + Optional, + Sequence, + Tuple, +) + +from spacy import Errors as SpacyErrors +from spacy import Language, Vocab +from spacy.pipeline import TrainablePipe +from spacy.tokens import Doc +from spacy.training import Example, validate_examples, validate_get_examples +from spacy.util import minibatch +from thinc.api import Config, Optimizer, set_dropout_rate +from thinc.model import Model +from thinc.types import Ragged + +from ..models.listeners import ListenerStateUtils +from ..models.output import DocTransformerOutput, TransformerModelOutput +from ..models.types import TransformerListenerModelT + +DEFAULT_CONFIG_STR = """ + [transformer] + + [transformer.model] + @architectures = "spacy-curated-transformers.XlmrTransformer.v1" + vocab_size = 250002 + + [transformer.model.piece_encoder] + @architectures = "spacy-curated-transformers.XlmrSentencepieceEncoder.v1" + + [transformer.model.with_spans] + @architectures = "spacy-curated-transformers.WithStridedSpans.v1" +""" + + +DEFAULT_CONFIG = Config().from_str(DEFAULT_CONFIG_STR) +DOC_EXT_ATTR = "trf_data" + + +@Language.factory( + "curated_transformer", + assigns=["doc._.trf_data"], + default_config=DEFAULT_CONFIG["transformer"], +) +def make_transformer( + nlp: Language, + name: str, + model: Model, + *, + frozen: bool = False, + all_layer_outputs: bool = False, +) -> "CuratedTransformer": + """Construct a CuratedTransformer component, which lets you plug a pre-trained + transformer model into spaCy so you can use it in your pipeline. One or + more subsequent spaCy components can use the transformer outputs as features + in its model, with gradients backpropagated to the single shared weights. + + nlp (Language): + The pipeline. + name (str): + The component instance name. + model (Model): + One of the supported pre-trained transformer models. + frozen (bool): + If `True`, the model's weights are frozen and no backpropagation is performed. + all_layer_outputs (bool): + If `True`, the model returns the outputs of all the layers. Otherwise, only the + output of the last layer is returned. This must be set to `True` if any of the pipe's + downstream listeners require the outputs of all transformer layers. + """ + return CuratedTransformer( + nlp.vocab, + model, + name=name, + frozen=frozen, + all_layer_outputs=all_layer_outputs, + ) + + +class CuratedTransformer(TrainablePipe): + """spaCy pipeline component that provides access to a pre-trained transformer + model from. Downstream components are connected to this pip using transformer + listener layers. This works similarly to spaCy's Transformer component and + TransformerListener sublayer. + + The activations from the transformer are saved in the doc._.trf_data extension + attribute. + """ + + def __init__( + self, + vocab: Vocab, + model: Model, + *, + name: str = "transformer", + frozen: bool = False, + all_layer_outputs: bool = False, + ) -> None: + """ + vocab (Vocab): + The shared vocabulary. + model (Model): + One of the supported pre-trained transformer models. + name (str): + The component instance name. + frozen (bool): + If `True`, the model's weights are frozen and no backpropagation is performed. + all_layer_outputs (bool): + If `True`, the model returns the outputs of all the layers. Otherwise, only the + output of the last layer is returned. This must be set to `True` if any of the pipe's + downstream listeners require the outputs of all transformer layers. + """ + self.vocab = vocab + self.model = model + self.name = name + self.listener_map: Dict[str, List[TransformerListenerModelT]] = {} + self.cfg: Dict[str, Any] = {} + + _install_extensions() + self.frozen = frozen + self.all_layer_outputs = all_layer_outputs + self._set_model_all_layer_outputs(all_layer_outputs) + + @property + def listeners(self) -> List[TransformerListenerModelT]: + """ + RETURNS (List[TransformerListenerModelT]): + The listener models listening to this component. Usually internals. + """ + return [m for c in self.listening_components for m in self.listener_map[c]] + + @property + def listening_components(self) -> List[str]: + """ + RETURNS (List[str]): + The downstream components listening to this component. Usually internals. + """ + return list(self.listener_map.keys()) + + def add_listener( + self, listener: TransformerListenerModelT, component_name: str + ) -> None: + """Add a listener for a downstream component. Usually internals.""" + if not ListenerStateUtils.is_listener(listener): + raise ValueError( + f"Attempting to register a model ('{listener.name}') with the transformer pipe" + "that isn't a transformer listener" + ) + + self.listener_map.setdefault(component_name, []) + if listener not in self.listener_map[component_name]: + self.listener_map[component_name].append(listener) + + def remove_listener( + self, listener: TransformerListenerModelT, component_name: str + ) -> bool: + """Remove a listener for a downstream component. Usually internals. + + RETURNS (bool): + `True` if successful, `False` otherwise. + """ + if component_name in self.listener_map: + if listener in self.listener_map[component_name]: + self.listener_map[component_name].remove(listener) + # If no listeners are left, remove entry + if not self.listener_map[component_name]: + del self.listener_map[component_name] + return True + return False + + def find_listeners(self, component: Any) -> None: + """Walk over a model of a processing component, looking for layers that + are transformer listeners that have an upstream_name that matches + this component. Listeners can also set their upstream_name attribute to + the wildcard string '*' to match any `Transformer`. + You're unlikely to ever need multiple `Transformer` components, so it's + fine to leave your listeners upstream_name on '*'. + """ + names = ("*", self.name) + if isinstance(getattr(component, "model", None), Model): + for node in component.model.walk(): + if ( + ListenerStateUtils.is_listener(node) + and ListenerStateUtils.get_upstream_name(node) in names + ): + self.add_listener(node, component.name) + + def pipe(self, stream: Iterable[Doc], *, batch_size: int = 128) -> Iterator[Doc]: + """Apply the pipe to a stream of documents. This usually happens under + the hood when the nlp object is called on a text and all components are + applied to the Doc. + + stream (Iterable[Doc]): + A stream of documents. + batch_size (int): + The number of documents to buffer. + + YIELDS (Doc): + Processed documents in order. + """ + _install_extensions() + for batch in minibatch(stream, batch_size): + preds = self.predict(batch) + self.set_annotations(batch, preds) + yield from batch + + def predict(self, docs: Iterable[Doc]) -> TransformerModelOutput: + """Apply the pipeline's model to a batch of docs, without modifying them. + + docs (Iterable[Doc]): + The documents to predict. + + RETURNS (TransformerModelOutput): + The extracted features of each document. + """ + _install_extensions() + if not any(len(doc) for doc in docs): + # Handle cases where there are no tokens in any docs. + width = self.model.get_dim("nO") + return TransformerModelOutput( + outputs=[ + [ + Ragged( + data=self.model.ops.alloc2f(0, width), + lengths=self.model.ops.alloc1i(0), + ) + ] + for _ in docs + ], + last_layer_only=True, + ) + + # To ensure that the model's internal state is always consistent with the pipe's. + self._set_model_all_layer_outputs(self.all_layer_outputs) + return self.model.predict(docs) + + def set_annotations( + self, docs: Sequence[Doc], trf_output: TransformerModelOutput + ) -> None: + """Assign the extracted features to the Doc objects. By default, a + DocTransformerOutput object is written to the doc._.trf_data attribute. + + docs (Iterable[Doc]): + The documents to modify. + trf_output (TransformerModelOutput): + The outputs of the transformer model. + """ + for doc, tokvecs in zip(docs, trf_output.all_outputs): + doc._.trf_data = DocTransformerOutput( + all_outputs=tokvecs, last_layer_only=trf_output.last_layer_only + ) + + def update( + self, + examples: Iterable[Example], + *, + drop: float = 0.0, + sgd: Optional[Optimizer] = None, + losses: Optional[Dict[str, float]] = None, + ) -> Dict[str, float]: + """Prepare for an update to the transformer. + + Like the `Tok2Vec` component, the `Transformer` component is unusual + in that it does not receive "gold standard" annotations to calculate + a weight update. The optimal output of the transformer data is unknown; + it's a hidden layer inside the network that is updated by backpropagating + from output layers. + + The `Transformer` component therefore does not perform a weight update + during its own `update` method. Instead, it runs its transformer model + and communicates the output and the backpropagation callback to any + downstream components that have been connected to it via the + transformer listener sublayer. If there are multiple listeners, the last + layer will actually backprop to the transformer and call the optimizer, + while the others simply increment the gradients. + + examples (Iterable[Example]): + A batch of Example objects. Only the `predicted` doc object is used, + the reference doc is ignored. + drop (float): + The dropout rate. + sgd (thinc.api.Optimizer): + The optimizer. + losses (Dict[str, float]): + Optional record of the loss during training. Updated using the component + name as the key. + + RETURNS (Dict[str, float]): + The updated losses dictionary. + """ + if losses is None: + losses = {} + validate_examples(examples, "Transformer.update") + docs = [eg.predicted for eg in examples] + set_dropout_rate(self.model, drop) + losses.setdefault(self.name, 0.0) + + # To ensure that the model's internal state is always consistent with the pipe's. + self._set_model_all_layer_outputs(self.all_layer_outputs) + + outputs, accum_func, backprop_func = self._create_backprops( + docs, losses, sgd=sgd + ) + + batch_id = ListenerStateUtils.calculate_batch_id(docs) + for listener in self.listeners[:-1]: + ListenerStateUtils.receive(listener, batch_id, outputs, accum_func) + if self.listeners: + ListenerStateUtils.receive( + self.listeners[-1], batch_id, outputs, backprop_func + ) + return losses + + def get_loss(self, examples: Iterable[Example], scores: Any) -> None: + """A noop function, for compatibility with the Pipe API. See the `update` + method for an explanation of the loss mechanics of the component. + """ + pass + + def initialize( + self, + get_examples: Callable[[], Iterable[Example]], + *, + nlp: Optional[Language] = None, + encoder_loader: Optional[Callable] = None, + piecer_loader: Optional[Callable] = None, + ): + """Initialize the pipe for training, using data examples if available. + + get_examples (Callable[[], Iterable[Example]]): + Optional function that returns gold-standard Example objects. + nlp (Language): + The current nlp object. + encoder_loader (Optional[Callable]): + Initialization callback for the transformer model. + piecer_loader (Optional[Callable]): + Initialization callback for the input piece encoder. + """ + validate_get_examples(get_examples, "Transformer.initialize") + + if encoder_loader: + self.model.get_ref("transformer").init = encoder_loader # type: ignore + if piecer_loader: + self.model.get_ref("piece_encoder").init = piecer_loader # type: ignore + + doc_sample = [] + for example in islice(get_examples(), 10): + doc_sample.append(example.x) + assert doc_sample, SpacyErrors.E923.format(name=self.name) + self.model.initialize(X=doc_sample) + + def add_label(self, label: Any): + raise NotImplementedError + + def finish_update(self, sgd: Optimizer) -> None: + """Update parameters using the current parameter gradients. + The Optimizer instance contains the functionality to perform + the stochastic gradient descent. + + This method is a noop when the pipe is frozen. + + sgd (thinc.api.Optimizer): The optimizer. + + DOCS: https://spacy.io/api/pipe#finish_update + """ + if not self.frozen: + self.model.finish_update(sgd) + + def _create_backprops( + self, + docs: Iterable[Doc], + losses: Dict[str, float], + *, + sgd: Optional[Optimizer] = None, + ) -> Tuple[TransformerModelOutput, Callable, Callable]: + ops = self.model.ops + # Accumulate the pipe's loss on the GPU at first. + cum_loss = ops.xp.full(1, losses[self.name]) + + if self.frozen: + # Ensures that the inner torch model is executed in a `no_grad` context. + outputs = self.model.predict(docs) + bp_outputs = None + else: + outputs, bp_outputs = self.model.begin_update(docs) + + # We'll use this as a buffer for loss accumulation over individual gradients. + d_outputs = [ + [Ragged(ops.alloc_f(t2v.dataXd.shape), t2v.lengths) for t2v in doc_layers] + for doc_layers in outputs.all_outputs + ] + + # The loss of the transformer is calculated in a different manner than that of the + # tok2vec component. Instead of updating the loss value with each downstream component's + # gradient, we accumulate the gradients and and update it just once. This reduces the overhead + # of launching the associated kernels on the GPU as this operation would otherwise be + # performed on a per-document, per-layer basis. The resultant loss value, while potentially + # (slightly) different, still communicates the same information as before w.r.t the training + # progress: how large were the gradients of the downstream components in this step compared + # to the previous steps. + + def accumulate_gradient( + one_d_outputs: List[List[Ragged]], outputs_to_backprop: Tuple[int, ...] + ) -> None: + """Accumulate transformer loss and gradient. This is passed as a callback + to all but the last listener. Only the last one does the backprop. + + `outputs_to_backprop` is a tuple of indices indicating to which layers/outputs + the gradients are to be propagated. + """ + nonlocal d_outputs + for i in range(len(one_d_outputs)): + for j in outputs_to_backprop: + d_outputs[i][j].data += one_d_outputs[i][j].data + + def update_loss(): + """Reduce the gradient buffer and update the losses dict.""" + nonlocal cum_loss + for i in range(len(d_outputs)): + for j in range(len(d_outputs[i])): + cum_loss += (d_outputs[i][j].data ** 2).sum() + losses[self.name] = float(cum_loss) + + def backprop( + one_d_outputs: List[List[Ragged]], outputs_to_backprop: Tuple[int, ...] + ) -> Any: + """Callback to actually do the backprop. Passed to last listener.""" + nonlocal d_outputs + assert bp_outputs is not None + accumulate_gradient(one_d_outputs, outputs_to_backprop=outputs_to_backprop) + update_loss() + d_docs = bp_outputs(d_outputs) + if sgd is not None: + self.finish_update(sgd) + return d_docs + + def backprop_noop( + one_d_outputs: List[List[Ragged]], outputs_to_backprop: Tuple[int, ...] + ) -> Any: + accumulate_gradient(one_d_outputs, outputs_to_backprop=outputs_to_backprop) + update_loss() + if sgd is not None: + self.finish_update(sgd) + return [] + + return outputs, accumulate_gradient, backprop_noop if self.frozen else backprop + + def _set_model_all_layer_outputs(self, new_value: bool): + self.model.get_ref("transformer").attrs["_all_layer_outputs"] = new_value + + +def _install_extensions() -> None: + if not Doc.has_extension(DOC_EXT_ATTR): + Doc.set_extension(DOC_EXT_ATTR, default=None) diff --git a/TTS/Kokoro/.venv/Lib/site-packages/spacy_curated_transformers/tests/__init__.py b/TTS/Kokoro/.venv/Lib/site-packages/spacy_curated_transformers/tests/__init__.py new file mode 100644 index 0000000000000000000000000000000000000000..e69de29bb2d1d6434b8b29ae775ad8c2e48c5391 diff --git a/TTS/Kokoro/.venv/Lib/site-packages/spacy_curated_transformers/tests/__pycache__/__init__.cpython-312.pyc b/TTS/Kokoro/.venv/Lib/site-packages/spacy_curated_transformers/tests/__pycache__/__init__.cpython-312.pyc new file mode 100644 index 0000000000000000000000000000000000000000..fe7adfda0502ce6479bf97ea79b6094a27d5c23f Binary files /dev/null and b/TTS/Kokoro/.venv/Lib/site-packages/spacy_curated_transformers/tests/__pycache__/__init__.cpython-312.pyc differ diff --git a/TTS/Kokoro/.venv/Lib/site-packages/spacy_curated_transformers/tests/__pycache__/conftest.cpython-312.pyc b/TTS/Kokoro/.venv/Lib/site-packages/spacy_curated_transformers/tests/__pycache__/conftest.cpython-312.pyc new file mode 100644 index 0000000000000000000000000000000000000000..5a41ea9177134a1bbf75798f60de8f49dfc5c714 Binary files /dev/null and b/TTS/Kokoro/.venv/Lib/site-packages/spacy_curated_transformers/tests/__pycache__/conftest.cpython-312.pyc differ diff --git a/TTS/Kokoro/.venv/Lib/site-packages/spacy_curated_transformers/tests/__pycache__/enable_gpu.cpython-312.pyc b/TTS/Kokoro/.venv/Lib/site-packages/spacy_curated_transformers/tests/__pycache__/enable_gpu.cpython-312.pyc new file mode 100644 index 0000000000000000000000000000000000000000..89bded9c58d2d7200039d8333b9b82a294c6831e Binary files /dev/null and b/TTS/Kokoro/.venv/Lib/site-packages/spacy_curated_transformers/tests/__pycache__/enable_gpu.cpython-312.pyc differ diff --git a/TTS/Kokoro/.venv/Lib/site-packages/spacy_curated_transformers/tests/__pycache__/test_cli_app.cpython-312.pyc b/TTS/Kokoro/.venv/Lib/site-packages/spacy_curated_transformers/tests/__pycache__/test_cli_app.cpython-312.pyc new file mode 100644 index 0000000000000000000000000000000000000000..f80228e5fc8a546ba9fc7871b8ed069d5fc7a355 Binary files /dev/null and b/TTS/Kokoro/.venv/Lib/site-packages/spacy_curated_transformers/tests/__pycache__/test_cli_app.cpython-312.pyc differ diff --git a/TTS/Kokoro/.venv/Lib/site-packages/spacy_curated_transformers/tests/__pycache__/test_registry.cpython-312.pyc b/TTS/Kokoro/.venv/Lib/site-packages/spacy_curated_transformers/tests/__pycache__/test_registry.cpython-312.pyc new file mode 100644 index 0000000000000000000000000000000000000000..dc663181d9f5130c304cf91ec39c5f5b08d04726 Binary files /dev/null and b/TTS/Kokoro/.venv/Lib/site-packages/spacy_curated_transformers/tests/__pycache__/test_registry.cpython-312.pyc differ diff --git a/TTS/Kokoro/.venv/Lib/site-packages/spacy_curated_transformers/tests/__pycache__/test_torchscript_wrapper.cpython-312.pyc b/TTS/Kokoro/.venv/Lib/site-packages/spacy_curated_transformers/tests/__pycache__/test_torchscript_wrapper.cpython-312.pyc new file mode 100644 index 0000000000000000000000000000000000000000..049fedd115092e3b63bc57dec1b708892ccbf654 Binary files /dev/null and b/TTS/Kokoro/.venv/Lib/site-packages/spacy_curated_transformers/tests/__pycache__/test_torchscript_wrapper.cpython-312.pyc differ diff --git a/TTS/Kokoro/.venv/Lib/site-packages/spacy_curated_transformers/tests/__pycache__/util.cpython-312.pyc b/TTS/Kokoro/.venv/Lib/site-packages/spacy_curated_transformers/tests/__pycache__/util.cpython-312.pyc new file mode 100644 index 0000000000000000000000000000000000000000..c056400fcb39cd6a417ee2a28bf50308f07f7c63 Binary files /dev/null and b/TTS/Kokoro/.venv/Lib/site-packages/spacy_curated_transformers/tests/__pycache__/util.cpython-312.pyc differ diff --git a/TTS/Kokoro/.venv/Lib/site-packages/spacy_curated_transformers/tests/conftest.py b/TTS/Kokoro/.venv/Lib/site-packages/spacy_curated_transformers/tests/conftest.py new file mode 100644 index 0000000000000000000000000000000000000000..8084b41080a8ee53fcc1e1bb8b228c74b5609457 --- /dev/null +++ b/TTS/Kokoro/.venv/Lib/site-packages/spacy_curated_transformers/tests/conftest.py @@ -0,0 +1,79 @@ +from pathlib import Path + +import pytest +import spacy + +from spacy_curated_transformers.tokenization.wordpiece_encoder import ( + build_wordpiece_encoder_v1, +) +from spacy_curated_transformers.util import registry + + +def pytest_addoption(parser): + try: + parser.addoption("--slow", action="store_true", help="include slow tests") + # Options are already added, e.g. if conftest is copied in a build pipeline + # and runs twice + except ValueError: + pass + + +def pytest_configure(config): + config.addinivalue_line("markers", "slow: include slow tests") + + +def pytest_runtest_setup(item): + def getopt(opt): + # When using 'pytest --pyargs spacy' to test an installed copy of + # spacy, pytest skips running our pytest_addoption() hook. Later, when + # we call getoption(), pytest raises an error, because it doesn't + # recognize the option we're asking about. To avoid this, we need to + # pass a default value. We default to False, i.e., we act like all the + # options weren't given. + return item.config.getoption(f"--{opt}", False) + + # Integration of boolean flags + for opt in ["slow"]: + if opt in item.keywords and not getopt(opt): + pytest.skip(f"need --{opt} option to run") + + +@pytest.fixture +def test_dir(request): + return Path(request.fspath).parent + + +@pytest.fixture +def sample_docs_with_spaces(): + nlp = spacy.blank("en") + doc1 = nlp.make_doc("I saw a girl with a telescope.") + doc2 = nlp.make_doc("Today we will eat poké bowl. ") + return [doc1, doc2] + + +@pytest.fixture +def sample_docs(): + nlp = spacy.blank("en") + doc1 = nlp.make_doc("I saw a girl with a telescope.") + doc2 = nlp.make_doc("Today we will eat poké bowl.") + return [doc1, doc2] + + +@pytest.fixture +def sentencepiece_toy_model_path(): + return Path(__file__).parent / "tokenization" / "toy.model" + + +@pytest.fixture +def wordpiece_toy_model_path(): + return Path(__file__).parent / "tokenization" / "toy.wordpieces" + + +@pytest.fixture +def wordpiece_toy_encoder(wordpiece_toy_model_path): + encoder = build_wordpiece_encoder_v1() + encoder.init = registry.model_loaders.get( + "spacy-curated-transformers.WordpieceLoader.v1" + )(path=wordpiece_toy_model_path) + encoder.initialize() + return encoder diff --git a/TTS/Kokoro/.venv/Lib/site-packages/spacy_curated_transformers/tests/enable_gpu.py b/TTS/Kokoro/.venv/Lib/site-packages/spacy_curated_transformers/tests/enable_gpu.py new file mode 100644 index 0000000000000000000000000000000000000000..3d4fded10fddcb5590f4e2a2320bcfa1726fa1ac --- /dev/null +++ b/TTS/Kokoro/.venv/Lib/site-packages/spacy_curated_transformers/tests/enable_gpu.py @@ -0,0 +1,3 @@ +from spacy import require_gpu + +require_gpu() diff --git a/TTS/Kokoro/.venv/Lib/site-packages/spacy_curated_transformers/tests/models/__init__.py b/TTS/Kokoro/.venv/Lib/site-packages/spacy_curated_transformers/tests/models/__init__.py new file mode 100644 index 0000000000000000000000000000000000000000..e69de29bb2d1d6434b8b29ae775ad8c2e48c5391 diff --git a/TTS/Kokoro/.venv/Lib/site-packages/spacy_curated_transformers/tests/models/__pycache__/__init__.cpython-312.pyc b/TTS/Kokoro/.venv/Lib/site-packages/spacy_curated_transformers/tests/models/__pycache__/__init__.cpython-312.pyc new file mode 100644 index 0000000000000000000000000000000000000000..5c151938ef28e4b9d860b119c01164673522ad7c Binary files /dev/null and b/TTS/Kokoro/.venv/Lib/site-packages/spacy_curated_transformers/tests/models/__pycache__/__init__.cpython-312.pyc differ diff --git a/TTS/Kokoro/.venv/Lib/site-packages/spacy_curated_transformers/tests/models/__pycache__/test_hf_model.cpython-312.pyc b/TTS/Kokoro/.venv/Lib/site-packages/spacy_curated_transformers/tests/models/__pycache__/test_hf_model.cpython-312.pyc new file mode 100644 index 0000000000000000000000000000000000000000..dc3333f56e8adfe4419ed971c36c331d0fdf26cb Binary files /dev/null and b/TTS/Kokoro/.venv/Lib/site-packages/spacy_curated_transformers/tests/models/__pycache__/test_hf_model.cpython-312.pyc differ diff --git a/TTS/Kokoro/.venv/Lib/site-packages/spacy_curated_transformers/tests/models/__pycache__/test_listeners.cpython-312.pyc b/TTS/Kokoro/.venv/Lib/site-packages/spacy_curated_transformers/tests/models/__pycache__/test_listeners.cpython-312.pyc new file mode 100644 index 0000000000000000000000000000000000000000..a4eaf5c32684a5e144f62d4f5fb8a9dcf78e132e Binary files /dev/null and b/TTS/Kokoro/.venv/Lib/site-packages/spacy_curated_transformers/tests/models/__pycache__/test_listeners.cpython-312.pyc differ diff --git a/TTS/Kokoro/.venv/Lib/site-packages/spacy_curated_transformers/tests/models/__pycache__/test_pooling.cpython-312.pyc b/TTS/Kokoro/.venv/Lib/site-packages/spacy_curated_transformers/tests/models/__pycache__/test_pooling.cpython-312.pyc new file mode 100644 index 0000000000000000000000000000000000000000..a5f72267349a1acb721967fd46bd3d655fa71fc2 Binary files /dev/null and b/TTS/Kokoro/.venv/Lib/site-packages/spacy_curated_transformers/tests/models/__pycache__/test_pooling.cpython-312.pyc differ diff --git a/TTS/Kokoro/.venv/Lib/site-packages/spacy_curated_transformers/tests/models/__pycache__/test_scalar_weight.cpython-312.pyc b/TTS/Kokoro/.venv/Lib/site-packages/spacy_curated_transformers/tests/models/__pycache__/test_scalar_weight.cpython-312.pyc new file mode 100644 index 0000000000000000000000000000000000000000..6053e2fa220afa62efce5d81147c08ea3e37814c Binary files /dev/null and b/TTS/Kokoro/.venv/Lib/site-packages/spacy_curated_transformers/tests/models/__pycache__/test_scalar_weight.cpython-312.pyc differ diff --git a/TTS/Kokoro/.venv/Lib/site-packages/spacy_curated_transformers/tests/models/__pycache__/test_transformer_model.cpython-312.pyc b/TTS/Kokoro/.venv/Lib/site-packages/spacy_curated_transformers/tests/models/__pycache__/test_transformer_model.cpython-312.pyc new file mode 100644 index 0000000000000000000000000000000000000000..36bac72601d2d041ff1bf0c59ce1ddd489e6117f Binary files /dev/null and b/TTS/Kokoro/.venv/Lib/site-packages/spacy_curated_transformers/tests/models/__pycache__/test_transformer_model.cpython-312.pyc differ diff --git a/TTS/Kokoro/.venv/Lib/site-packages/spacy_curated_transformers/tests/models/__pycache__/test_with_non_ws_tokens.cpython-312.pyc b/TTS/Kokoro/.venv/Lib/site-packages/spacy_curated_transformers/tests/models/__pycache__/test_with_non_ws_tokens.cpython-312.pyc new file mode 100644 index 0000000000000000000000000000000000000000..c683c44c101cc7939c7f7fbfd682c128c62997fc Binary files /dev/null and b/TTS/Kokoro/.venv/Lib/site-packages/spacy_curated_transformers/tests/models/__pycache__/test_with_non_ws_tokens.cpython-312.pyc differ diff --git a/TTS/Kokoro/.venv/Lib/site-packages/spacy_curated_transformers/tests/models/__pycache__/test_with_strided_spans.cpython-312.pyc b/TTS/Kokoro/.venv/Lib/site-packages/spacy_curated_transformers/tests/models/__pycache__/test_with_strided_spans.cpython-312.pyc new file mode 100644 index 0000000000000000000000000000000000000000..5e1f45f017eb796abc4be26bfe85d098019c08f0 Binary files /dev/null and b/TTS/Kokoro/.venv/Lib/site-packages/spacy_curated_transformers/tests/models/__pycache__/test_with_strided_spans.cpython-312.pyc differ diff --git a/TTS/Kokoro/.venv/Lib/site-packages/spacy_curated_transformers/tests/models/test_hf_model.py b/TTS/Kokoro/.venv/Lib/site-packages/spacy_curated_transformers/tests/models/test_hf_model.py new file mode 100644 index 0000000000000000000000000000000000000000..f414c05e359d4f8004a2518f5bbd8ced57ecff0e --- /dev/null +++ b/TTS/Kokoro/.venv/Lib/site-packages/spacy_curated_transformers/tests/models/test_hf_model.py @@ -0,0 +1,106 @@ +from dataclasses import dataclass +from typing import Callable + +import pytest +from curated_transformers.models.albert import AlbertEncoder +from curated_transformers.models.albert.config import AlbertConfig +from curated_transformers.models.attention import AttentionMask +from curated_transformers.models.bert import BertConfig, BertEncoder +from curated_transformers.models.roberta.config import RobertaConfig +from curated_transformers.models.roberta.encoder import RobertaEncoder +from thinc.api import get_torch_default_device +from torch.nn import Module + +from spacy_curated_transformers._compat import has_hf_transformers, transformers +from spacy_curated_transformers.models.architectures import _pytorch_encoder +from spacy_curated_transformers.models.hf_loader import ( + build_hf_transformer_encoder_loader_v1, +) + +from ..util import torch_assertclose + + +@dataclass +class ModelConfig: + config: BertConfig + encoder: Callable[[BertConfig], Module] + hf_model_name: str + hidden_width: int + + +TEST_MODELS = [ + ModelConfig( + AlbertConfig(vocab_size=30000), + AlbertEncoder, + "albert-base-v2", + hidden_width=768, + ), + ModelConfig( + BertConfig(vocab_size=28996), BertEncoder, "bert-base-cased", hidden_width=768 + ), + ModelConfig(RobertaConfig(), RobertaEncoder, "roberta-base", hidden_width=768), + ModelConfig( + RobertaConfig(vocab_size=250002), + RobertaEncoder, + "xlm-roberta-base", + hidden_width=768, + ), +] + + +def encoder_from_config(config: ModelConfig): + encoder = config.encoder(config.config) + model = _pytorch_encoder(encoder, config.hidden_width) + model.init = build_hf_transformer_encoder_loader_v1(name=config.hf_model_name) + return model + + +@pytest.mark.slow +@pytest.mark.skipif(not has_hf_transformers, reason="requires huggingface transformers") +@pytest.mark.parametrize("model_config", TEST_MODELS) +def test_hf_load_weights(model_config): + model = encoder_from_config(model_config) + assert model + + +@pytest.mark.slow +@pytest.mark.skipif(not has_hf_transformers, reason="requires huggingface transformers") +@pytest.mark.parametrize("model_config", TEST_MODELS) +def test_model_against_hf_transformers(model_config): + torch_device = get_torch_default_device() + + model = encoder_from_config(model_config) + model.initialize() + encoder = model.shims[0]._model + encoder.eval() + hf_encoder = transformers.AutoModel.from_pretrained(model_config.hf_model_name).to( + torch_device + ) + hf_encoder.eval() + + hf_tokenizer = transformers.AutoTokenizer.from_pretrained( + model_config.hf_model_name + ) + tokenization = hf_tokenizer( + ["This is a test.", "Let's match outputs"], padding=True, return_tensors="pt" + ).to(torch_device) + X = tokenization["input_ids"] + attention_mask = tokenization["attention_mask"] + + # Test with the tokenizer's attention mask + Y_encoder = encoder( + X, attention_mask=AttentionMask(bool_mask=attention_mask.bool()) + ) + Y_hf_encoder = hf_encoder(X, attention_mask=attention_mask) + + torch_assertclose( + Y_encoder.last_hidden_layer_states, + Y_hf_encoder.last_hidden_state, + ) + + # Try to infer the attention mask from padding. + Y_encoder = encoder(X) + torch_assertclose( + Y_encoder.last_hidden_layer_states, + Y_hf_encoder.last_hidden_state, + ) diff --git a/TTS/Kokoro/.venv/Lib/site-packages/spacy_curated_transformers/tests/models/test_listeners.py b/TTS/Kokoro/.venv/Lib/site-packages/spacy_curated_transformers/tests/models/test_listeners.py new file mode 100644 index 0000000000000000000000000000000000000000..dc4f5198ea1d74bf91620176023b5ec962539bf8 --- /dev/null +++ b/TTS/Kokoro/.venv/Lib/site-packages/spacy_curated_transformers/tests/models/test_listeners.py @@ -0,0 +1,89 @@ +import pytest +from spacy import util +from spacy.training import Example +from thinc.api import Config, reduce_mean + +from spacy_curated_transformers._compat import has_hf_transformers +from spacy_curated_transformers.models.listeners import ( + build_transformer_layers_listener_v1, +) + +cfg_string_transformer_layers_listener = """ + # TransformerLayersListener + + [nlp] + lang = "en" + pipeline = ["transformer"] + + [components] + + [components.transformer] + factory = "curated_transformer" + all_layer_outputs = True + + [components.transformer.model] + @architectures = "spacy-curated-transformers.BertTransformer.v1" + vocab_size = 28996 + num_hidden_layers = 2 + hidden_width = 60 + piece_encoder = {"@architectures":"spacy-curated-transformers.BertWordpieceEncoder.v1"} + with_spans = {"@architectures":"spacy-curated-transformers.WithStridedSpans.v1"} + + [initialize] + + [initialize.components] + + [initialize.components.transformer] + + [initialize.components.transformer.piecer_loader] + @model_loaders = "spacy-curated-transformers.HFPieceEncoderLoader.v1" + name = "bert-base-cased" +""" + + +@pytest.mark.skipif(not has_hf_transformers, reason="requires huggingface transformers") +def test_transformer_layers_listener(): + config = Config().from_str(cfg_string_transformer_layers_listener) + nlp = util.load_model_from_config(config, auto_fill=True, validate=True) + + transformer = nlp.get_pipe("transformer") + listener = build_transformer_layers_listener_v1( + layers=2, width=60, pooling=reduce_mean() + ) + + docs = [ + nlp.make_doc("Let's test a transformer."), + nlp.make_doc("Can it handle more than one doc?"), + ] + examples = [Example.from_dict(doc, {}) for doc in docs] + + nlp.initialize(lambda: examples) + transformer.add_listener(listener, "test") + + # Check prediction. + transformer.pipe(docs) + Y = listener.predict(docs) + + hidden_size = 60 + layers = 3 # embed + hidden layers + + assert len(Y) == 2 + assert len(Y[0]) == layers + assert len(Y[1]) == layers + assert Y[0][-1].shape == (len(docs[0]), hidden_size) + assert Y[1][-1].shape == (len(docs[1]), hidden_size) + + # Check update. + + transformer.update(examples) + Y, backprop = listener.begin_update(docs) + assert len(Y) == 2 + assert len(Y[0]) == layers + assert len(Y[1]) == layers + assert Y[0][-1].shape == (len(docs[0]), hidden_size) + assert Y[1][-1].shape == (len(docs[1]), hidden_size) + + dY_doc0 = listener.ops.alloc2f(len(docs[0]), 60) + dY_doc1 = listener.ops.alloc2f(len(docs[1]), 60) + + backprop([layers * [dY_doc0], layers * [dY_doc1]]) diff --git a/TTS/Kokoro/.venv/Lib/site-packages/spacy_curated_transformers/tests/models/test_pooling.py b/TTS/Kokoro/.venv/Lib/site-packages/spacy_curated_transformers/tests/models/test_pooling.py new file mode 100644 index 0000000000000000000000000000000000000000..27fbdd3a588be5998e358bd3d3d699b2c6c41d72 --- /dev/null +++ b/TTS/Kokoro/.venv/Lib/site-packages/spacy_curated_transformers/tests/models/test_pooling.py @@ -0,0 +1,142 @@ +from thinc.api import NumpyOps, Ragged, reduce_sum +from thinc.util import convert_recursive, is_cupy_array + +from spacy_curated_transformers.models.pooling import ( + with_ragged_last_layer, + with_ragged_layers, +) + + +def test_with_ragged_last_layer(): + pooler = with_ragged_last_layer(reduce_sum()) + ops = pooler.ops + + docs = [ + Ragged(ops.asarray1f([1.0, 2.0, 3.0]), lengths=ops.asarray1i([1, 2])), + Ragged(ops.asarray1f([4.0, 5.0, 6.0]), lengths=ops.asarray1i([2, 1])), + Ragged(ops.asarray1f([]), lengths=ops.asarray1i([])), + ] + + Y, backprop = pooler(docs, is_train=True) + + for y, y_h in zip( + Y, + [ + ops.asarray2f([[1.0], [5.0]]), + ops.asarray2f([[9.0], [6.0]]), + ops.asarray2f([]).reshape(0, 1), + ], + ): + ops.xp.testing.assert_array_equal(y, y_h) + + dX = backprop( + [ + ops.asarray2f([[1.0], [-1.0]]), + ops.asarray2f([[-1.0], [1.0]]), + ops.asarray2f([]).reshape(0, 1), + ], + ) + + assert len(dX) == 3 + + ops.xp.testing.assert_array_equal( + dX[0].dataXd, ops.asarray2f([[1.0], [-1.0], [-1.0]]) + ) + ops.xp.testing.assert_array_equal(dX[0].lengths, ops.asarray1i([1, 2])) + + ops.xp.testing.assert_array_equal( + dX[1].dataXd, ops.asarray2f([[-1.0], [-1.0], [1.0]]) + ) + ops.xp.testing.assert_array_equal(dX[1].lengths, ops.asarray1i([2, 1])) + + ops.xp.testing.assert_array_equal(dX[2].dataXd, ops.asarray2f([]).reshape(0, 1)) + ops.xp.testing.assert_array_equal(dX[2].lengths, ops.asarray1i([])) + + +def test_with_ragged_layers(): + pooler = with_ragged_layers(reduce_sum()) + ops = pooler.ops + numpy = NumpyOps().xp + + docs = [ + [ + Ragged(ops.asarray1f([1.0, 2.0, 3.0]), lengths=ops.asarray1i([1, 2])), + Ragged(ops.asarray1f([3.0, 2.0, 1.0]), lengths=ops.asarray1i([1, 2])), + ], + [ + Ragged(ops.asarray1f([4.0, 5.0, 6.0]), lengths=ops.asarray1i([2, 1])), + Ragged(ops.asarray1f([6.0, 5.0, 4.0]), lengths=ops.asarray1i([2, 1])), + ], + [ + Ragged(ops.asarray1f([]), lengths=ops.asarray1i([])), + Ragged(ops.asarray1f([]), lengths=ops.asarray1i([])), + ], + ] + + Y, backprop = pooler(docs, is_train=True) + # Since cupy balks at comparing sequences that mix CPU lists and GPU arrays, + # we'll need to convert them to numpy (CPU) arrays first. + Y = convert_recursive(is_cupy_array, lambda a: a.get(), Y) + + numpy.testing.assert_equal( + Y, + [ + [ + numpy.array([[1.0], [5.0]]), + numpy.array([[3.0], [3.0]]), + ], + [ + numpy.array([[9.0], [6.0]]), + numpy.array([[11.0], [4.0]]), + ], + [ + numpy.array([]).reshape(0, 1), + numpy.array([]).reshape(0, 1), + ], + ], + ) + + dX = backprop( + [ + [ + ops.asarray2f([[1.0], [-1.0]]), + ops.asarray2f([[2.0], [-2.0]]), + ], + [ + ops.asarray2f([[-1.0], [1.0]]), + ops.asarray2f([[-2.0], [2.0]]), + ], + [ + ops.asarray2f([]).reshape(0, 1), + ops.asarray2f([]).reshape(0, 1), + ], + ], + ) + + assert len(dX) == 3 + + assert len(dX[0]) == 2 + ops.xp.testing.assert_array_equal( + dX[0][0].dataXd, ops.asarray2f([[1.0], [-1.0], [-1.0]]) + ) + ops.xp.testing.assert_array_equal(dX[0][0].lengths, ops.asarray1i([1, 2])) + ops.xp.testing.assert_array_equal( + dX[0][1].dataXd, ops.asarray2f([[2.0], [-2.0], [-2.0]]) + ) + ops.xp.testing.assert_array_equal(dX[0][1].lengths, ops.asarray1i([1, 2])) + + assert len(dX[1]) == 2 + ops.xp.testing.assert_array_equal( + dX[1][0].dataXd, ops.asarray2f([[-1.0], [-1.0], [1.0]]) + ) + ops.xp.testing.assert_array_equal( + dX[1][1].dataXd, ops.asarray2f([[-2.0], [-2.0], [2.0]]) + ) + ops.xp.testing.assert_array_equal(dX[1][0].lengths, ops.asarray1i([2, 1])) + ops.xp.testing.assert_array_equal(dX[1][1].lengths, ops.asarray1i([2, 1])) + + assert len(dX[2]) == 2 + ops.xp.testing.assert_array_equal(dX[2][0].dataXd, ops.asarray2f([]).reshape(0, 1)) + ops.xp.testing.assert_array_equal(dX[2][1].dataXd, ops.asarray2f([]).reshape(0, 1)) + ops.xp.testing.assert_array_equal(dX[2][0].lengths, ops.asarray1i([])) + ops.xp.testing.assert_array_equal(dX[2][1].lengths, ops.asarray1i([])) diff --git a/TTS/Kokoro/.venv/Lib/site-packages/spacy_curated_transformers/tests/models/test_scalar_weight.py b/TTS/Kokoro/.venv/Lib/site-packages/spacy_curated_transformers/tests/models/test_scalar_weight.py new file mode 100644 index 0000000000000000000000000000000000000000..8fbeeb55edf11f2ebcb8507934b6adbd90d0793f --- /dev/null +++ b/TTS/Kokoro/.venv/Lib/site-packages/spacy_curated_transformers/tests/models/test_scalar_weight.py @@ -0,0 +1,55 @@ +import torch +from thinc.api import Ragged, get_current_ops + +from spacy_curated_transformers.models.scalar_weight import build_scalar_weight_v1 + + +def test_scalar_weight_model(): + ops = get_current_ops() + model = build_scalar_weight_v1(num_layers=2, dropout_prob=0.0) + + with torch.no_grad(): + model.shims[0]._model.layer_weights[0] = 1 + model.shims[0]._model.layer_weights[1] = 1 + model.shims[0]._model.layer_weights[2] = 1 + + zeros = ops.alloc2f(15, 2) + ones = ops.alloc2f(15, 2) + 1 + + lens = ops.asarray1i([1, 2, 3, 4, 5]) + X = [ + [ + Ragged(ones.copy(), lens.copy()), + Ragged(zeros.copy(), lens.copy()), + Ragged(ones.copy(), lens.copy()), + ] + ] + Y = ops.alloc2f(15, 2) + (1.0 / 3.0) * 2 + + Yh, backprop = model(X, is_train=True) + assert len(Yh) == 1 + ops.xp.testing.assert_array_equal( + Yh[0].dataXd, + Y, + ) + ops.xp.testing.assert_array_equal( + Yh[0].lengths, + lens, + ) + + dX = backprop( + [Ragged(ones.copy(), lengths=lens.copy())], + ) + dX_expected = ops.alloc2f(15, 2) + (1.0 / 3.0) + + assert len(dX) == 1 + assert len(dX[0]) == 3 + for dX_layer in dX[0]: + ops.xp.testing.assert_array_equal( + dX_layer.dataXd, + dX_expected, + ) + ops.xp.testing.assert_array_equal( + dX_layer.lengths, + lens, + ) diff --git a/TTS/Kokoro/.venv/Lib/site-packages/spacy_curated_transformers/tests/models/test_transformer_model.py b/TTS/Kokoro/.venv/Lib/site-packages/spacy_curated_transformers/tests/models/test_transformer_model.py new file mode 100644 index 0000000000000000000000000000000000000000..69f9f8fa101c115496daf843c15e76c6058483d8 --- /dev/null +++ b/TTS/Kokoro/.venv/Lib/site-packages/spacy_curated_transformers/tests/models/test_transformer_model.py @@ -0,0 +1,176 @@ +import pytest +from curated_tokenizers import SentencePieceProcessor +from thinc.api import CupyOps, NumpyOps, Ragged, registry +from thinc.compat import has_cupy + +from spacy_curated_transformers._compat import has_hf_transformers, has_huggingface_hub +from spacy_curated_transformers.models.architectures import ( + build_albert_transformer_model_v1, + build_bert_transformer_model_v1, + build_roberta_transformer_model_v1, + build_xlmr_transformer_model_v1, +) +from spacy_curated_transformers.models.hf_loader import ( + build_hf_transformer_encoder_loader_v1, +) +from spacy_curated_transformers.models.output import TransformerModelOutput +from spacy_curated_transformers.models.with_strided_spans import ( + build_with_strided_spans_v1, +) +from spacy_curated_transformers.tokenization import ( + build_bert_wordpiece_encoder_v1, + build_byte_bpe_encoder_v1, + build_hf_piece_encoder_loader_v1, + build_sentencepiece_encoder_v1, + build_xlmr_sentencepiece_encoder_v1, +) + +OPS = [NumpyOps()] +if has_cupy: + OPS.append(CupyOps()) + + +@pytest.fixture +def toy_model(sentencepiece_toy_model_path): + return SentencePieceProcessor.from_file(sentencepiece_toy_model_path) + + +@pytest.mark.slow +@pytest.mark.skipif(not has_hf_transformers, reason="requires huggingface transformers") +@pytest.mark.parametrize("stride,window", [(2, 4), (96, 128)]) +@pytest.mark.parametrize("hf_model", [("xlm-roberta-base", 768, 250002)]) +def test_xlmr_model(sample_docs, stride, window, hf_model): + hf_model_name, hidden_width, vocab_size = hf_model + with_spans = build_with_strided_spans_v1(stride=stride, window=window) + model = build_xlmr_transformer_model_v1( + piece_encoder=build_xlmr_sentencepiece_encoder_v1(), + with_spans=with_spans, + vocab_size=vocab_size, + hidden_width=hidden_width, + ) + model.get_ref("transformer").init = build_hf_transformer_encoder_loader_v1( + name=hf_model_name + ) + model.get_ref("piece_encoder").init = build_hf_piece_encoder_loader_v1( + name=hf_model_name + ) + model.initialize(X=sample_docs) + Y, backprop = model(sample_docs, is_train=False) + assert isinstance(Y, TransformerModelOutput) + num_ouputs = Y.num_outputs + Y = Y.last_hidden_layer_states + assert len(Y) == 2 + model.ops.xp.testing.assert_array_equal(Y[0].lengths, [1, 1, 1, 1, 1, 1, 2, 2]) + assert Y[0].dataXd.shape == (10, hidden_width) + model.ops.xp.testing.assert_array_equal(Y[1].lengths, [1, 1, 1, 1, 2, 1, 2]) + assert Y[1].dataXd.shape == (9, hidden_width) + + # Backprop zeros to verify that backprop doesn't fail. + dY = [ + [ + Ragged( + model.ops.alloc2f(10, 768), + lengths=model.ops.asarray1i([1, 1, 1, 1, 1, 1, 2, 2]), + ) + for _ in range(num_ouputs) + ], + [ + Ragged( + model.ops.alloc2f(9, 768), + lengths=model.ops.asarray1i([1, 1, 1, 1, 2, 1, 2]), + ) + for _ in range(num_ouputs) + ], + ] + assert backprop(dY) == [] + + +@pytest.mark.slow +@pytest.mark.skipif(not has_hf_transformers, reason="requires huggingface transformers") +@pytest.mark.parametrize("stride,window", [(2, 4), (96, 128)]) +@pytest.mark.parametrize("hf_model", [("xlm-roberta-base", 768, 250002)]) +def test_input_with_spaces(sample_docs_with_spaces, stride, window, hf_model): + hidden_width = 768 + with_spans = build_with_strided_spans_v1(stride=stride, window=window) + model = build_xlmr_transformer_model_v1( + piece_encoder=build_xlmr_sentencepiece_encoder_v1(), + with_spans=with_spans, + vocab_size=250005, + hidden_width=hidden_width, + num_hidden_layers=1, + ) + model.get_ref("piece_encoder").init = build_hf_piece_encoder_loader_v1( + name="xlm-roberta-base" + ) + model.initialize(X=sample_docs_with_spaces) + Y, backprop = model(sample_docs_with_spaces, is_train=False) + assert isinstance(Y, TransformerModelOutput) + num_ouputs = Y.num_outputs + Y = Y.last_hidden_layer_states + assert len(Y) == 2 + model.ops.xp.testing.assert_array_equal(Y[0].lengths, [1, 1, 1, 1, 0, 1, 1, 2, 2]) + assert Y[0].dataXd.shape == (10, hidden_width) + model.ops.xp.testing.assert_array_equal( + Y[1].lengths, [1, 1, 0, 1, 1, 0, 2, 1, 2, 0] + ) + assert Y[1].dataXd.shape == (9, hidden_width) + + # Backprop zeros to verify that backprop doesn't fail. + dY = [ + [ + Ragged( + model.ops.alloc2f(10, 768), + lengths=model.ops.asarray1i([1, 1, 1, 1, 0, 1, 1, 2, 2]), + ) + for _ in range(num_ouputs) + ], + [ + Ragged( + model.ops.alloc2f(9, 768), + lengths=model.ops.asarray1i([1, 1, 0, 1, 1, 0, 2, 1, 2, 0]), + ) + for _ in range(num_ouputs) + ], + ] + assert backprop(dY) == [] + + +@pytest.mark.slow +@pytest.mark.skipif(not has_huggingface_hub, reason="requires huggingface hub") +@pytest.mark.parametrize( + "test_config", + [ + ( + "albert-base-v2", + build_albert_transformer_model_v1, + build_sentencepiece_encoder_v1(), + 30000, + ), + ( + "bert-base-cased", + build_bert_transformer_model_v1, + build_bert_wordpiece_encoder_v1(), + 28996, + ), + ( + "roberta-base", + build_roberta_transformer_model_v1, + build_byte_bpe_encoder_v1(), + 50265, + ), + ], +) +def test_pytorch_checkpoint_loader(test_config): + from huggingface_hub import hf_hub_download + + model_name, model_factory, piece_encoder, vocab_size = test_config + + checkpoint_path = hf_hub_download(repo_id=model_name, filename="pytorch_model.bin") + with_spans = build_with_strided_spans_v1(stride=96, window=128) + model = model_factory( + piece_encoder=piece_encoder, vocab_size=vocab_size, with_spans=with_spans + ) + model.get_ref("transformer").init = registry.model_loaders.get( + "spacy-curated-transformers.PyTorchCheckpointLoader.v1" + )(path=checkpoint_path) + model.initialize() diff --git a/TTS/Kokoro/.venv/Lib/site-packages/spacy_curated_transformers/tests/models/test_with_non_ws_tokens.py b/TTS/Kokoro/.venv/Lib/site-packages/spacy_curated_transformers/tests/models/test_with_non_ws_tokens.py new file mode 100644 index 0000000000000000000000000000000000000000..9eee1db1e6352cfe9d8ccce7be4c69e29da478c2 --- /dev/null +++ b/TTS/Kokoro/.venv/Lib/site-packages/spacy_curated_transformers/tests/models/test_with_non_ws_tokens.py @@ -0,0 +1,116 @@ +from typing import List + +import pytest +from thinc.api import Model, chain +from thinc.types import Floats2d, Ragged + +from spacy_curated_transformers.models.output import TransformerModelOutput +from spacy_curated_transformers.models.remove_eos_bos import remove_bos_eos +from spacy_curated_transformers.models.with_non_ws_tokens import with_non_ws_tokens + + +def _mock_transformer() -> Model[List[Floats2d], TransformerModelOutput]: + def forward(model: Model, X: List[Floats2d], is_train: bool): + def backprop(dY): + model.attrs["last_dY"] = dY + return dY + + return ( + TransformerModelOutput( + outputs=[ + [ + Ragged( + model.ops.xp.ones((x.dataXd.shape[0], 2)), lengths=x.lengths + ) + ] + for x in X + ], + last_layer_only=False, + ), + backprop, + ) + + return Model("mock_transformer", forward) + + +@pytest.mark.xfail(reason="Removed need for non_ws_tokens") +def test_with_non_ws_tokens(sample_docs_with_spaces, wordpiece_toy_encoder): + mock_transformer = _mock_transformer() + model = with_non_ws_tokens( + chain(wordpiece_toy_encoder, mock_transformer, remove_bos_eos()) + ) + model.initialize() + Y, backprop = model(sample_docs_with_spaces, is_train=True) + + yl0 = Y.all_outputs[0][0] + y1_check = model.ops.xp.ones((15, 2)) + y1_check[6, :] = 0.0 + model.ops.xp.testing.assert_array_equal(yl0.dataXd, y1_check) + + yl1 = Y.all_outputs[1][0] + y2_check = model.ops.xp.ones((17, 2)) + y2_check[4, :] = 0.0 + y2_check[8, :] = 0.0 + y2_check[16, :] = 0.0 + model.ops.xp.testing.assert_array_equal(yl1.dataXd, y2_check) + + dY = [ + [ + Ragged( + model.ops.xp.arange(float(yl0.dataXd.size)).reshape(yl0.dataXd.shape), + lengths=yl0.lengths, + ) + ], + [ + Ragged( + model.ops.xp.arange(float(yl1.dataXd.size)).reshape(yl1.dataXd.shape), + lengths=yl1.lengths, + ) + ], + ] + + backprop(dY) + + transformer_dY = mock_transformer.attrs["last_dY"] + model.ops.xp.testing.assert_array_equal( + transformer_dY[0][0].dataXd, + [ + [0.0, 0.0], + [0.0, 1.0], + [2.0, 3.0], + [4.0, 5.0], + [6.0, 7.0], + [8.0, 9.0], + [10.0, 11.0], + [14.0, 15.0], + [16.0, 17.0], + [18.0, 19.0], + [20.0, 21.0], + [22.0, 23.0], + [24.0, 25.0], + [26.0, 27.0], + [28.0, 29.0], + [0.0, 0.0], + ], + ) + model.ops.xp.testing.assert_array_equal( + transformer_dY[1][0].dataXd, + [ + [0.0, 0.0], + [0.0, 1.0], + [2.0, 3.0], + [4.0, 5.0], + [6.0, 7.0], + [10.0, 11.0], + [12.0, 13.0], + [14.0, 15.0], + [18.0, 19.0], + [20.0, 21.0], + [22.0, 23.0], + [24.0, 25.0], + [26.0, 27.0], + [28.0, 29.0], + [30.0, 31.0], + [0.0, 0.0], + ], + ) diff --git a/TTS/Kokoro/.venv/Lib/site-packages/spacy_curated_transformers/tests/models/test_with_strided_spans.py b/TTS/Kokoro/.venv/Lib/site-packages/spacy_curated_transformers/tests/models/test_with_strided_spans.py new file mode 100644 index 0000000000000000000000000000000000000000..1c0a5540a9e0740c673283e2566eff66884addb1 --- /dev/null +++ b/TTS/Kokoro/.venv/Lib/site-packages/spacy_curated_transformers/tests/models/test_with_strided_spans.py @@ -0,0 +1,140 @@ +from typing import List + +import pytest +from thinc.api import Model, Ragged, chain, get_current_ops, with_array +from thinc.types import Floats2d + +from spacy_curated_transformers.models.output import TransformerModelOutput +from spacy_curated_transformers.models.with_strided_spans import with_strided_spans + + +def relu_activation() -> Model[Floats2d, Floats2d]: + def forward(model: Model, X: Floats2d, is_train: bool): + Y = model.ops.relu(X) + + def backprop(dY: Floats2d) -> Floats2d: + return dY * model.ops.backprop_relu(dY, Y) + + return Y, backprop + + return Model("relu_activation", forward) + + +def _add_range() -> Model[Floats2d, Floats2d]: + """Add range [0, X.size).""" + + def forward(model: Model, X: Floats2d, is_train: bool): + adds = model.ops.xp.arange(X.size).reshape(X.shape) + return X + adds, lambda x: x + + return Model("add_range", forward) + + +def _mock_transformer() -> Model[List[Floats2d], TransformerModelOutput]: + def forward(model: Model, X: List[Floats2d], is_train: bool): + return ( + TransformerModelOutput(outputs=[[x] for x in X], last_layer_only=True), + lambda x: x, + ) + + return Model("mock_transformer", forward) + + +@pytest.mark.parametrize("batch_size", [1, 2, 3, 5]) +def test_with_strided_spans(batch_size): + ops = get_current_ops() + trf = chain(with_array(relu_activation()), _mock_transformer()) + model = with_strided_spans(trf, stride=4, window=4, batch_size=batch_size) + + zeros = ops.alloc2f(15, 5) + ones = ops.alloc2f(15, 5) + 1 + fives = ops.alloc2f(15, 5) + 5 + + lengths1 = ops.asarray1i([1, 2, 3, 4, 5]) + lengths2 = ops.asarray1i([5, 4, 3, 2, 1]) + + X = [ + Ragged(fives.copy(), lengths=lengths1), + Ragged(-fives, lengths=lengths2), + Ragged(fives.copy(), lengths=lengths1.copy()), + Ragged(-fives, lengths=lengths2.copy()), + ] + model.initialize(X) + + Y, backprop = model(X, is_train=True) + Y = Y.all_outputs + assert len(Y) == len(X) + + dX = backprop( + [ + Ragged(ones.copy(), lengths=lengths1), + Ragged(ones.copy(), lengths=lengths2), + Ragged(ones.copy(), lengths=lengths1.copy()), + Ragged(ones.copy(), lengths=lengths2.copy()), + ] + ) + + for i in [0, 2]: + ops.xp.testing.assert_array_equal(Y[i][0].data, fives) + ops.xp.testing.assert_array_equal(Y[i][0].lengths, lengths1) + ops.xp.testing.assert_array_equal(dX[i].data, ones) + ops.xp.testing.assert_array_equal(dX[i].lengths, lengths1) + for i in [1, 3]: + ops.xp.testing.assert_array_equal(Y[i][0].data, zeros) + ops.xp.testing.assert_array_equal(Y[i][0].lengths, lengths2) + ops.xp.testing.assert_array_equal(dX[i].data, zeros) + ops.xp.testing.assert_array_equal(dX[i].lengths, lengths2) + + +def test_with_strided_spans_averaging(): + ops = get_current_ops() + stateful = chain(with_array(_add_range()), _mock_transformer()) + model = with_strided_spans(stateful, stride=2, window=4) + + data = ops.xp.zeros((6, 2)) + lengths = ops.asarray1i([3, 3]) + X = [Ragged(data, lengths=lengths)] + + model.initialize(X) + + Y, backprop = model(X, is_train=False) + + ops.xp.testing.assert_array_equal( + Y.all_outputs[0][0].dataXd, + [[0.0, 1.0], [2.0, 3.0], [6.0, 7.0], [8.0, 9.0], [14.0, 15.0], [16.0, 17.0]], + ) + + ones = data + 1 + dX = backprop( + [ + Ragged(ones.copy(), lengths=lengths), + ] + ) + ops.xp.testing.assert_array_equal( + dX[0].dataXd, + [ + [1.0, 1.0], + [1.0, 1.0], + [0.25, 0.25], + [0.25, 0.25], + [0.25, 0.25], + [0.25, 0.25], + ], + ) + ops.xp.testing.assert_array_equal(dX[0].lengths, lengths) + + +def test_incorrect_strides_are_rejected(): + relu = with_array(relu_activation()) + with pytest.raises(ValueError): + with_strided_spans(relu, stride=2, window=6) + with pytest.raises(ValueError): + with_strided_spans(relu, stride=4, window=3) + + +def test_batch_sizes_are_rejected(): + relu = with_array(relu_activation()) + with pytest.raises(ValueError): + with_strided_spans(relu, batch_size=-1) + with pytest.raises(ValueError): + with_strided_spans(relu, batch_size=0) diff --git a/TTS/Kokoro/.venv/Lib/site-packages/spacy_curated_transformers/tests/pipeline/__init__.py b/TTS/Kokoro/.venv/Lib/site-packages/spacy_curated_transformers/tests/pipeline/__init__.py new file mode 100644 index 0000000000000000000000000000000000000000..e69de29bb2d1d6434b8b29ae775ad8c2e48c5391 diff --git a/TTS/Kokoro/.venv/Lib/site-packages/spacy_curated_transformers/tests/pipeline/__pycache__/__init__.cpython-312.pyc b/TTS/Kokoro/.venv/Lib/site-packages/spacy_curated_transformers/tests/pipeline/__pycache__/__init__.cpython-312.pyc new file mode 100644 index 0000000000000000000000000000000000000000..ac89f7b99e77f102d5fba5a341440df933723de1 Binary files /dev/null and b/TTS/Kokoro/.venv/Lib/site-packages/spacy_curated_transformers/tests/pipeline/__pycache__/__init__.cpython-312.pyc differ diff --git a/TTS/Kokoro/.venv/Lib/site-packages/spacy_curated_transformers/tests/pipeline/__pycache__/test_transformer.cpython-312.pyc b/TTS/Kokoro/.venv/Lib/site-packages/spacy_curated_transformers/tests/pipeline/__pycache__/test_transformer.cpython-312.pyc new file mode 100644 index 0000000000000000000000000000000000000000..c2c132e188e90f17c93188069b3815d2e2c105cb Binary files /dev/null and b/TTS/Kokoro/.venv/Lib/site-packages/spacy_curated_transformers/tests/pipeline/__pycache__/test_transformer.cpython-312.pyc differ diff --git a/TTS/Kokoro/.venv/Lib/site-packages/spacy_curated_transformers/tests/pipeline/test_transformer.py b/TTS/Kokoro/.venv/Lib/site-packages/spacy_curated_transformers/tests/pipeline/test_transformer.py new file mode 100644 index 0000000000000000000000000000000000000000..70ab676c51f9cebf3916fc35c7e05f1a4952b915 --- /dev/null +++ b/TTS/Kokoro/.venv/Lib/site-packages/spacy_curated_transformers/tests/pipeline/test_transformer.py @@ -0,0 +1,781 @@ +import multiprocessing +from functools import partial +from typing import Any, Dict + +import numpy +import pytest +import spacy +import torch +from spacy import Config, util +from spacy.language import Language +from spacy.tokens import Doc +from spacy.training import Example +from spacy.training.initialize import init_nlp +from spacy.training.loop import train +from spacy.util import registry as spacy_registry +from thinc.api import CupyOps, get_current_ops +from thinc.backends import get_array_ops +from thinc.model import Model + +from spacy_curated_transformers._compat import has_hf_transformers, transformers +from spacy_curated_transformers.models.architectures import ( + build_bert_transformer_model_v1, + build_camembert_transformer_model_v1, + build_roberta_transformer_model_v1, + build_xlmr_transformer_model_v1, +) +from spacy_curated_transformers.models.hf_loader import ( + build_hf_transformer_encoder_loader_v1, +) +from spacy_curated_transformers.models.listeners import ( + ListenerStateUtils, + WrappedTransformerAndListener, +) +from spacy_curated_transformers.models.with_strided_spans import ( + build_with_strided_spans_v1, +) +from spacy_curated_transformers.pipeline.transformer import ( + DEFAULT_CONFIG, + CuratedTransformer, + make_transformer, +) +from spacy_curated_transformers.tokenization import ( + build_bert_wordpiece_encoder_v1, + build_byte_bpe_encoder_v1, + build_camembert_sentencepiece_encoder_v1, + build_hf_piece_encoder_loader_v1, + build_xlmr_sentencepiece_encoder_v1, +) +from spacy_curated_transformers.tokenization.sentencepiece_encoder import ( + build_sentencepiece_encoder_loader_v1, +) +from spacy_curated_transformers.util import create_gradual_transformer_unfreezing + +from ..util import make_tempdir, torch_assertclose, xp_assert_array_equal + +# Torch currently interacts badly with the fork method: +# https://github.com/pytorch/pytorch/issues/17199 +multiprocessing.set_start_method("spawn") + +cfg_string_last_layer_listener = """ + # LastTransformerLayerListener + + [nlp] + lang = "en" + pipeline = ["transformer","tagger"] + + [components] + + [components.tagger] + factory = "tagger" + + [components.tagger.model] + @architectures = "spacy.Tagger.v2" + nO = null + + [components.tagger.model.tok2vec] + @architectures = "spacy-curated-transformers.LastTransformerLayerListener.v1" + width = ${components.transformer.model.hidden_width} + pooling = {"@layers":"reduce_mean.v1"} + + [components.transformer] + factory = "curated_transformer" + all_layer_outputs = False + + [components.transformer.model] + @architectures = "spacy-curated-transformers.BertTransformer.v1" + vocab_size = 28996 + num_hidden_layers = 1 + hidden_width = 60 + piece_encoder = {"@architectures":"spacy-curated-transformers.BertWordpieceEncoder.v1"} + with_spans = {"@architectures":"spacy-curated-transformers.WithStridedSpans.v1"} + + [initialize] + + [initialize.components] + + [initialize.components.transformer] + + [initialize.components.transformer.piecer_loader] + @model_loaders = "spacy-curated-transformers.HFPieceEncoderLoader.v1" + name = "bert-base-cased" +""" + +cfg_string_scalar_weighting_layer_listener = """ + # ScalarWeightingListener + + [nlp] + lang = "en" + pipeline = ["transformer","tagger"] + + [components] + + [components.tagger] + factory = "tagger" + + [components.tagger.model] + @architectures = "spacy.Tagger.v2" + nO = null + + [components.tagger.model.tok2vec] + @architectures = "spacy-curated-transformers.ScalarWeightingListener.v1" + width = ${components.transformer.model.hidden_width} + pooling = {"@layers":"reduce_mean.v1"} + + [components.tagger.model.tok2vec.weighting] + @architectures = "spacy-curated-transformers.ScalarWeight.v1" + num_layers = ${components.transformer.model.num_hidden_layers} + + [components.transformer] + factory = "curated_transformer" + all_layer_outputs = True + + [components.transformer.model] + @architectures = "spacy-curated-transformers.BertTransformer.v1" + vocab_size = 28996 + num_hidden_layers = 1 + hidden_width = 60 + piece_encoder = {"@architectures":"spacy-curated-transformers.BertWordpieceEncoder.v1"} + with_spans = {"@architectures":"spacy-curated-transformers.WithStridedSpans.v1"} + + [initialize] + + [initialize.components] + + [initialize.components.transformer] + + [initialize.components.transformer.piecer_loader] + @model_loaders = "spacy-curated-transformers.HFPieceEncoderLoader.v1" + name = "bert-base-cased" +""" + +TRAIN_DATA = [ + ( + "I like green eggs", + {"tags": ["N", "V", "J", "N"], "cats": {"preference": 1.0, "imperative": 0.0}}, + ), + ( + "Eat blue ham", + {"tags": ["V", "J", "N"], "cats": {"preference": 0.0, "imperative": 1.0}}, + ), +] + + +def create_tagger(cfg_string): + config = Config().from_str(cfg_string) + nlp = util.load_model_from_config(config, auto_fill=True, validate=True) + + tagger = nlp.get_pipe("tagger") + + train_examples = [] + for t in TRAIN_DATA: + train_examples.append(Example.from_dict(nlp.make_doc(t[0]), t[1])) + for tag in t[1]["tags"]: + tagger.add_label(tag) + + nlp.initialize(lambda: train_examples) + + return nlp + + +def create_and_train_tagger(cfg_string): + nlp = create_tagger(cfg_string) + + train_examples = [] + for t in TRAIN_DATA: + train_examples.append(Example.from_dict(nlp.make_doc(t[0]), t[1])) + + optimizer = nlp.create_optimizer() + + for _ in range(10): + losses = {} + nlp.update(train_examples, sgd=optimizer, losses=losses) + + return nlp + + +def evaluate_tagger_on_train_data(model): + docs = list(model.pipe(["Eat blue ham", "I like green eggs"])) + assert [t.tag_ for t in docs[0]] == ["V", "J", "N"] + assert [t.tag_ for t in docs[1]] == ["N", "V", "J", "N"] + + +def test_default_pipe_config_can_be_constructed(): + nlp = spacy.blank("en") + nlp.add_pipe("curated_transformer", config={"model": {"vocab_size": 32}}) + + +@pytest.mark.slow +@pytest.mark.skipif(not has_hf_transformers, reason="requires huggingface transformers") +@pytest.mark.parametrize( + "cfg_string", + [cfg_string_last_layer_listener, cfg_string_scalar_weighting_layer_listener], +) +def test_tagger(cfg_string): + model = create_and_train_tagger(cfg_string) + evaluate_tagger_on_train_data(model) + + +@pytest.mark.slow +@pytest.mark.skipif(not has_hf_transformers, reason="requires huggingface transformers") +@pytest.mark.parametrize( + "cfg_string", + [cfg_string_last_layer_listener, cfg_string_scalar_weighting_layer_listener], +) +@pytest.mark.skipif( + isinstance(get_current_ops(), CupyOps), + reason="multiprocessing and GPU support are incompatible", +) +def test_tagger_multiprocessing(cfg_string): + model = create_tagger(cfg_string) + for _ in model.pipe(["This is a test..."] * 100, n_process=2): + pass + + +def _hf_tokenize_per_token(tokenizer, docs, *, roberta=False): + if roberta: + hf_encoding = [ + tokenizer( + [ + doc[idx - 1].whitespace_ + token.text if idx > 0 else token.text + for idx, token in enumerate(doc) + ] + ) + for doc in docs + ] + else: + hf_encoding = [tokenizer([token.text for token in doc]) for doc in docs] + ids = [] + lens = [] + bos_id = ( + tokenizer.bos_token_id + if tokenizer.bos_token_id is not None + else tokenizer.cls_token_id + ) + eos_id = ( + tokenizer.eos_token_id + if tokenizer.eos_token_id is not None + else tokenizer.sep_token_id + ) + for i in range(len(hf_encoding)): + doc_ids = [id for e in hf_encoding[i]["input_ids"] for id in e[1:-1]] + ids.append([bos_id] + doc_ids + [eos_id]) + lens.append(len(ids[-1])) + + torch_ids = torch.full( + (len(ids), max(lens)), tokenizer.pad_token_id, dtype=torch.int + ) + for i in range(len(ids)): + torch_ids[i][: len(ids[i])] = torch.tensor(ids[i]) + + attention_mask = torch_ids.ne(tokenizer.pad_token_id) + + return torch_ids, attention_mask, lens + + +@pytest.mark.slow +@pytest.mark.skipif(not has_hf_transformers, reason="requires huggingface transformers") +def test_bert_transformer_pipe_against_hf(): + nlp = spacy.blank("en") + model = build_bert_transformer_model_v1( + piece_encoder=build_bert_wordpiece_encoder_v1(), + with_spans=build_with_strided_spans_v1(), + vocab_size=28996, + ) + model.get_ref("transformer").init = build_hf_transformer_encoder_loader_v1( + name="bert-base-cased" + ) + model.get_ref("piece_encoder").init = build_hf_piece_encoder_loader_v1( + name="bert-base-cased" + ) + model.initialize() + pipe = make_transformer(nlp, "transformer", model) + + hf_tokenizer = transformers.AutoTokenizer.from_pretrained("bert-base-cased") + hf_model = transformers.AutoModel.from_pretrained("bert-base-cased") + + docs = [ + nlp.make_doc("I saw a girl with a telescope."), + nlp.make_doc("Today we will eat poké bowl."), + ] + + hf_ids, attention_mask, lens = _hf_tokenize_per_token(hf_tokenizer, docs) + hf_encoding = hf_model(hf_ids, attention_mask=attention_mask) + docs = list(pipe.pipe(docs)) + + for doc, hf_doc_encoding, encoding_len in zip( + docs, hf_encoding.last_hidden_state, lens + ): + torch_assertclose( + hf_doc_encoding[:encoding_len][1:-1], + torch.tensor(doc._.trf_data.last_hidden_layer_state.dataXd), + ) + + +@pytest.mark.slow +@pytest.mark.skipif(not has_hf_transformers, reason="requires huggingface transformers") +def test_camembert_transformer_pipe_against_hf(): + nlp = spacy.blank("fr") + model = build_camembert_transformer_model_v1( + piece_encoder=build_camembert_sentencepiece_encoder_v1(), + with_spans=build_with_strided_spans_v1(), + vocab_size=32005, + ) + model.get_ref("transformer").init = build_hf_transformer_encoder_loader_v1( + name="camembert-base" + ) + model.get_ref("piece_encoder").init = build_hf_piece_encoder_loader_v1( + name="camembert-base" + ) + model.initialize() + pipe = make_transformer(nlp, "transformer", model) + + hf_tokenizer = transformers.AutoTokenizer.from_pretrained("camembert-base") + hf_model = transformers.AutoModel.from_pretrained("camembert-base") + + docs = [ + nlp.make_doc("J'ai vu une fille avec un télescope."), + nlp.make_doc("Aujourd'hui, nous allons manger un poké bowl."), + ] + + hf_ids, attention_mask, lens = _hf_tokenize_per_token(hf_tokenizer, docs) + hf_encoding = hf_model(hf_ids, attention_mask=attention_mask) + docs = list(pipe.pipe(docs)) + + for doc, hf_doc_encoding, encoding_len in zip( + docs, hf_encoding.last_hidden_state, lens + ): + torch_assertclose( + hf_doc_encoding[:encoding_len][1:-1], + torch.tensor(doc._.trf_data.last_hidden_layer_state.dataXd), + ) + + +@pytest.mark.slow +@pytest.mark.skipif(not has_hf_transformers, reason="requires huggingface transformers") +def test_roberta_transformer_pipe_against_hf(): + nlp = spacy.blank("en") + model = build_roberta_transformer_model_v1( + piece_encoder=build_byte_bpe_encoder_v1(), + with_spans=build_with_strided_spans_v1(), + vocab_size=50265, + ) + model.get_ref("transformer").init = build_hf_transformer_encoder_loader_v1( + name="roberta-base" + ) + model.get_ref("piece_encoder").init = build_hf_piece_encoder_loader_v1( + name="roberta-base" + ) + model.initialize() + pipe = make_transformer(nlp, "transformer", model) + + hf_tokenizer = transformers.AutoTokenizer.from_pretrained("roberta-base") + hf_model = transformers.AutoModel.from_pretrained("roberta-base") + + docs = [ + nlp.make_doc("I saw a girl with a telescope."), + nlp.make_doc("Today we will eat poké bowl."), + ] + + hf_ids, attention_mask, lens = _hf_tokenize_per_token( + hf_tokenizer, docs, roberta=True + ) + hf_encoding = hf_model(hf_ids, attention_mask=attention_mask) + docs = list(pipe.pipe(docs)) + + for doc, hf_doc_encoding, encoding_len in zip( + docs, hf_encoding.last_hidden_state, lens + ): + torch_assertclose( + hf_doc_encoding[:encoding_len][1:-1], + torch.tensor(doc._.trf_data.last_hidden_layer_state.dataXd), + ) + + +def test_empty_input(sentencepiece_toy_model_path): + nlp = spacy.blank("en") + model = build_xlmr_transformer_model_v1( + piece_encoder=build_xlmr_sentencepiece_encoder_v1(), + with_spans=build_with_strided_spans_v1(), + num_hidden_layers=2, + vocab_size=1000, + hidden_width=12, + ) + + model.get_ref("piece_encoder").init = build_sentencepiece_encoder_loader_v1( + path=sentencepiece_toy_model_path + ) + model.initialize() + pipe = make_transformer(nlp, "transformer", model) + pipe(nlp.make_doc("")) + + +@pytest.mark.slow +@pytest.mark.skipif(not has_hf_transformers, reason="requires huggingface transformers") +def test_xlmr_transformer_pipe_against_hf(): + nlp = spacy.blank("en") + model = build_xlmr_transformer_model_v1( + piece_encoder=build_xlmr_sentencepiece_encoder_v1(), + with_spans=build_with_strided_spans_v1(), + vocab_size=250002, + ) + model.get_ref("transformer").init = build_hf_transformer_encoder_loader_v1( + name="xlm-roberta-base" + ) + model.get_ref("piece_encoder").init = build_hf_piece_encoder_loader_v1( + name="xlm-roberta-base" + ) + model.initialize() + pipe = make_transformer(nlp, "transformer", model) + + hf_tokenizer = transformers.AutoTokenizer.from_pretrained("xlm-roberta-base") + hf_model = transformers.AutoModel.from_pretrained("xlm-roberta-base") + + docs = [ + nlp.make_doc("I saw a girl with a telescope."), + nlp.make_doc("Today we will eat poké bowl."), + ] + + hf_ids, attention_mask, lens = _hf_tokenize_per_token(hf_tokenizer, docs) + hf_encoding = hf_model(hf_ids, attention_mask=attention_mask) + docs = list(pipe.pipe(docs)) + + for doc, hf_doc_encoding, encoding_len in zip( + docs, hf_encoding.last_hidden_state, lens + ): + torch_assertclose( + hf_doc_encoding[:encoding_len][1:-1], + torch.tensor(doc._.trf_data.last_hidden_layer_state.dataXd), + atol=1e-3, + rtol=1e-3, + ) + + +@pytest.mark.slow +@pytest.mark.skipif(not has_hf_transformers, reason="requires huggingface transformers") +def test_frozen_transformer_pipe(): + config = Config().from_str(cfg_string_scalar_weighting_layer_listener) + nlp = util.load_model_from_config(config, auto_fill=True, validate=True) + tagger = nlp.get_pipe("tagger") + transformer = nlp.get_pipe("transformer") + transformer.frozen = True + + train_examples = [] + for t in TRAIN_DATA: + train_examples.append(Example.from_dict(nlp.make_doc(t[0]), t[1])) + for tag in t[1]["tags"]: + tagger.add_label(tag) + + optimizer = nlp.initialize(lambda: train_examples) + + def get_transformer_params_sorted(): + params = transformer.model.get_ref("transformer").shims[0]._model.state_dict() + return list(sorted(params.items())) + + transformer_init_params = [ + (k, v.clone()) for k, v in get_transformer_params_sorted() + ] + + for i in range(5): + losses = {} + nlp.update(train_examples, sgd=optimizer, losses=losses) + + transformer_trained_params = get_transformer_params_sorted() + for (old_param, old_vec), (new_param, new_vec) in zip( + transformer_init_params, transformer_trained_params + ): + assert old_param == new_param + torch_assertclose( + old_vec, + new_vec, + ) + + +@pytest.mark.slow +@pytest.mark.skipif(not has_hf_transformers, reason="requires huggingface transformers") +def test_transformer_pipe_outputs(): + nlp = spacy.blank("en") + model = build_xlmr_transformer_model_v1( + piece_encoder=build_xlmr_sentencepiece_encoder_v1(), + with_spans=build_with_strided_spans_v1(), + vocab_size=250002, + ) + model.get_ref("transformer").init = build_hf_transformer_encoder_loader_v1( + name="xlm-roberta-base" + ) + model.get_ref("piece_encoder").init = build_hf_piece_encoder_loader_v1( + name="xlm-roberta-base" + ) + model.initialize() + pipe = make_transformer(nlp, "transformer", model, all_layer_outputs=False) + + docs = [ + nlp.make_doc("I saw a girl with a telescope."), + nlp.make_doc("Today we will eat poké bowl."), + ] + docs = list(pipe.pipe(docs)) + assert all([doc._.trf_data.last_layer_only for doc in docs]) == True + assert all([len(doc._.trf_data.all_outputs) == 1 for doc in docs]) == True + + serialized = [doc.to_bytes() for doc in docs] + deserialized = [Doc(nlp.vocab).from_bytes(doc_bytes) for doc_bytes in serialized] + for doc, doc_deserialized in zip(docs, deserialized): + _assert_doc_model_output_equal(doc, doc_deserialized) + + pipe = make_transformer(nlp, "transformer", model, all_layer_outputs=True) + docs = list(pipe.pipe(docs)) + assert all([not doc._.trf_data.last_layer_only for doc in docs]) == True + assert all([len(doc._.trf_data.all_outputs) == 12 + 1 for doc in docs]) == True + + serialized = [doc.to_bytes() for doc in docs] + deserialized = [Doc(nlp.vocab).from_bytes(doc_bytes) for doc_bytes in serialized] + for doc, doc_deserialized in zip(docs, deserialized): + _assert_doc_model_output_equal(doc, doc_deserialized) + + +cfg_string_gradual_unfreezing = ( + cfg_string_last_layer_listener + + """ + [corpora] + + [corpora.train] + @readers = "spacy.Corpus.v1" + path = "toy-en-corpus.spacy" + max_length = 500 + gold_preproc = false + limit = 0 + + [corpora.dev] + @readers = "spacy.Corpus.v1" + path = "toy-en-corpus.spacy" + max_length = 500 + gold_preproc = false + limit = 0 + + [training] + train_corpus = "corpora.train" + dev_corpus = "corpora.dev" + seed = 1 + gpu_allocator = "pytorch" + dropout = 0.1 + accumulate_gradient = 3 + patience = 5000 + max_epochs = 1 + max_steps = 6 + eval_frequency = 10 + + [training.batcher] + @batchers = "spacy.batch_by_padded.v1" + discard_oversize = False + get_length = null + size = 1 + buffer = 256 +""" +) + + +@pytest.mark.slow +@pytest.mark.skipif(not has_hf_transformers, reason="requires huggingface transformers") +def test_gradual_transformer_unfreezing(test_dir): + def wrapped_callback(): + def inner( + nlp: Language, + args: Dict[str, Any], + gradual_unfreezing_callback, + unfreeze_step, + ): + current_step = args["step"] + gradual_unfreezing_callback(nlp, args) + + transformer = nlp.get_pipe("transformer") + if current_step < unfreeze_step: + assert transformer.frozen == True + else: + assert transformer.frozen == False + + return partial( + inner, + gradual_unfreezing_callback=create_gradual_transformer_unfreezing({"*": 3}), + unfreeze_step=3, + ) + + spacy_registry.callbacks.register( + "test_gradual_unfreezing_callback", + func=wrapped_callback, + ) + + config = Config().from_str(cfg_string_gradual_unfreezing, interpolate=False) + config["corpora"]["train"]["path"] = str(test_dir / "toy-en-corpus.spacy") + config["corpora"]["dev"]["path"] = str(test_dir / "toy-en-corpus.spacy") + config["training"]["before_update"] = { + "@callbacks": "test_gradual_unfreezing_callback" + } + nlp = util.load_model_from_config(config, auto_fill=True, validate=True) + + nlp = init_nlp(config) + train(nlp) + assert nlp.get_pipe("transformer").frozen == False + + with pytest.raises(ValueError): + create_gradual_transformer_unfreezing({"transformer": 5, "*": 4}) + + +@pytest.mark.skipif(not has_hf_transformers, reason="requires huggingface transformers") +@pytest.mark.parametrize( + ["cfg_string", "listener_name", "listener_entrypoint"], + [ + ( + cfg_string_last_layer_listener, + "last_transformer_layer_listener", + "spacy-curated-transformers.LastTransformerLayerListener.v1", + ), + ( + cfg_string_scalar_weighting_layer_listener, + "scalar_weighting_listener", + "spacy-curated-transformers.ScalarWeightingListener.v1", + ), + ], +) +def test_replace_listeners(cfg_string, listener_name, listener_entrypoint): + orig_config = Config().from_str(cfg_string) + nlp = util.load_model_from_config(orig_config, auto_fill=True, validate=True) + text = "This is awesome" + examples = [Example.from_dict(nlp.make_doc(text), {"tags": ["A", "B", "C"]})] + optimizer = nlp.initialize(lambda: examples) + + # verify correct configuration with transformer listener + transformer = nlp.get_pipe("transformer") + tagger = nlp.get_pipe("tagger") + + tagger_tok2vec = tagger.model.get_ref("tok2vec") + + assert ListenerStateUtils.is_listener(tagger_tok2vec) + assert transformer.listener_map["tagger"][0] == tagger_tok2vec + assert isinstance(transformer.model, Model) + assert transformer.model.name == "transformer_model" + assert ( + nlp.config["components"]["transformer"]["model"]["@architectures"] + == "spacy-curated-transformers.BertTransformer.v1" + ) + assert ( + nlp.config["components"]["tagger"]["model"]["tok2vec"]["@architectures"] + == listener_entrypoint + ) + + # train pipe before replacing listeners + for i in range(5): + losses = {} + nlp.update(examples, sgd=optimizer, losses=losses) + doc = nlp(text) + + preds = [t.tag_ for t in doc] + doc_tensor = tagger_tok2vec.predict([doc]) + + # replace listener and verify predictions are still the same + transformer.frozen = True + nlp.replace_listeners("transformer", "tagger", ["model.tok2vec"]) + tagger = nlp.get_pipe("tagger") + tagger_tok2vec = tagger.model.get_ref("tok2vec") + assert isinstance(tagger_tok2vec, WrappedTransformerAndListener) + assert tagger_tok2vec.frozen_transformer + assert tagger_tok2vec.layers[0].name == "transformer_model" + assert tagger_tok2vec.layers[1].name == listener_name + assert ( + nlp.config["components"]["tagger"]["model"]["tok2vec"]["@architectures"] + == "spacy-curated-transformers.BertTransformer.v1" + ) + assert ( + nlp.config["components"]["tagger"]["model"]["tok2vec"]["wrapped_listener"][ + "@architectures" + ] + == listener_entrypoint + ) + doc2 = nlp(text) + assert preds == [t.tag_ for t in doc2] + pred_tensor = tagger_tok2vec.predict([doc2]) + xp_assert_array_equal(doc_tensor, pred_tensor) + + optimizer = nlp.resume_training() + trf_output_frozen = tagger_tok2vec.layers[0].predict([doc2]) + for i in range(5): + losses = {} + nlp.update(examples, sgd=optimizer, losses=losses) + assert losses["tagger"] > 0.0 + trf_output_frozen_after_update = tagger_tok2vec.layers[0].predict([doc2]) + + for x, y in zip( + trf_output_frozen.all_outputs, trf_output_frozen_after_update.all_outputs + ): + for x1, y1 in zip(x, y): + xp_assert_array_equal(x1.dataXd, y1.dataXd) + + tagger_tok2vec.frozen_transformer = False + trf_output = tagger_tok2vec.layers[0].predict([doc2]) + # attempt training with the new pipeline + for i in range(5): + losses = {} + nlp.update(examples, sgd=optimizer, losses=losses) + assert losses["tagger"] > 0.0 + trained_trf_output = tagger_tok2vec.layers[0].predict([doc2]) + + for x, y in zip(trf_output.all_outputs, trained_trf_output.all_outputs): + for x1, y1 in zip(x, y): + assert not numpy.array_equal(x1.dataXd, y1.dataXd) + + # ensure IO goes OK + doc_tensor_trained = tagger_tok2vec.predict([doc]) + + with make_tempdir() as d: + file_path = d / "trained_nlp" + nlp.to_disk(file_path) + nlp2 = util.load_model_from_path(file_path) + doc3 = nlp2(text) + tagger2 = nlp2.get_pipe("tagger") + tagger_tok2vec2 = tagger2.model.get_ref("tok2vec") + pred_tensor = tagger_tok2vec2.predict([doc3]) + xp_assert_array_equal(doc_tensor_trained, pred_tensor) + + +def test_transformer_add_pipe(): + config = Config().from_str(cfg_string_last_layer_listener) + nlp = util.load_model_from_config(config, auto_fill=True, validate=True) + nlp.remove_pipe("transformer") + + nlp = util.load_model_from_config( + Config().from_str(nlp.config.to_str()), auto_fill=True, validate=True + ) + transformer = nlp.add_pipe("curated_transformer") + assert isinstance(transformer, CuratedTransformer) + assert ( + nlp.config["components"]["curated_transformer"]["model"]["vocab_size"] + == DEFAULT_CONFIG["transformer"]["model"]["vocab_size"] + ) + assert ( + nlp.config["components"]["curated_transformer"]["model"]["@architectures"] + == DEFAULT_CONFIG["transformer"]["model"]["@architectures"] + ) + assert ( + nlp.config["components"]["curated_transformer"]["model"]["piece_encoder"][ + "@architectures" + ] + == DEFAULT_CONFIG["transformer"]["model"]["piece_encoder"]["@architectures"] + ) + assert ( + nlp.config["components"]["curated_transformer"]["model"]["with_spans"][ + "@architectures" + ] + == DEFAULT_CONFIG["transformer"]["model"]["with_spans"]["@architectures"] + ) + + +def _assert_doc_model_output_equal(doc1: Doc, doc2: Doc): + output1 = doc1._.trf_data + output2 = doc2._.trf_data + + assert output1.last_layer_only == output2.last_layer_only + assert len(output1.all_outputs) == len(output2.all_outputs) + + for layer1, layer2 in zip(output1.all_outputs, output2.all_outputs): + ops = get_array_ops(layer1.dataXd) + ops.xp.testing.assert_allclose(layer1.dataXd, layer2.dataXd) + ops.xp.testing.assert_array_equal(layer1.lengths, layer2.lengths) diff --git a/TTS/Kokoro/.venv/Lib/site-packages/spacy_curated_transformers/tests/pipeline/toy-en-corpus.spacy b/TTS/Kokoro/.venv/Lib/site-packages/spacy_curated_transformers/tests/pipeline/toy-en-corpus.spacy new file mode 100644 index 0000000000000000000000000000000000000000..9a771be712ce2b4b83c1e9137d12b48534630f79 Binary files /dev/null and b/TTS/Kokoro/.venv/Lib/site-packages/spacy_curated_transformers/tests/pipeline/toy-en-corpus.spacy differ diff --git a/TTS/Kokoro/.venv/Lib/site-packages/spacy_curated_transformers/tests/test_cli_app.py b/TTS/Kokoro/.venv/Lib/site-packages/spacy_curated_transformers/tests/test_cli_app.py new file mode 100644 index 0000000000000000000000000000000000000000..c02e173231609ad8ce06edecaab7e018b557614a --- /dev/null +++ b/TTS/Kokoro/.venv/Lib/site-packages/spacy_curated_transformers/tests/test_cli_app.py @@ -0,0 +1,347 @@ +import re + +import pytest +import spacy +from spacy.cli import app +from typer.testing import CliRunner + +import spacy_curated_transformers.cli.debug_pieces +import spacy_curated_transformers.cli.fill_config_transformer +from spacy_curated_transformers._compat import has_hf_transformers, has_huggingface_hub + +from .util import make_tempdir + + +def test_debug_pieces(): + result = CliRunner().invoke(app, ["debug", "pieces", "--help"]) + assert result.exit_code == 0 + + +# fmt: off +FILL_TRANSFORMER_CONFIG_STRS_AND_OUTPUTS = [ +# TODO: add albert testing model +( +""" +[nlp] +lang = "en" +pipeline = ["transformer"] +[components] +[components.transformer] +factory = "curated_transformer" +[components.transformer.model] +@architectures = "spacy-curated-transformers.BertTransformer.v1" +piece_encoder = {"@architectures":"spacy-curated-transformers.BertWordpieceEncoder.v1"} +[components.transformer.model.with_spans] +@architectures = "spacy-curated-transformers.WithStridedSpans.v1" +""", + +""" +[nlp] +lang = "en" +pipeline = ["transformer"] + +[components] + +[components.transformer] +factory = "curated_transformer" + +[components.transformer.model] +@architectures = "spacy-curated-transformers.BertTransformer.v1" +piece_encoder = {"@architectures":"spacy-curated-transformers.BertWordpieceEncoder.v1"} +with_spans = {"@architectures":"spacy-curated-transformers.WithStridedSpans.v1"} +attention_probs_dropout_prob = 0.1 +hidden_act = "gelu" +hidden_dropout_prob = 0.1 +hidden_width = 32 +intermediate_width = 37 +layer_norm_eps = 0.0 +max_position_embeddings = 512 +model_max_length = 512 +num_attention_heads = 4 +num_hidden_layers = 5 +padding_idx = 0 +type_vocab_size = 16 +vocab_size = 1124 + +[initialize] + +[initialize.components] + +[initialize.components.transformer] + +[initialize.components.transformer.encoder_loader] +@model_loaders = "spacy-curated-transformers.HFTransformerEncoderLoader.v1" +name = "hf-internal-testing/tiny-random-bert" +revision = "main" + +[initialize.components.transformer.piecer_loader] +@model_loaders = "spacy-curated-transformers.HFPieceEncoderLoader.v1" +name = "hf-internal-testing/tiny-random-bert" +revision = "main" +""", + +["--model-name", "hf-internal-testing/tiny-random-bert", "--model-revision", "main"], +), + +( +""" +[nlp] +lang = "en" +pipeline = ["transformer"] +[components] +[components.transformer] +factory = "curated_transformer" +[components.transformer.model] +@architectures = "spacy-curated-transformers.CamembertTransformer.v1" +piece_encoder = {"@architectures":"spacy-curated-transformers.ByteBpeEncoder.v1"} +[components.transformer.model.with_spans] +@architectures = "spacy-curated-transformers.WithStridedSpans.v1" +""", + +""" +[nlp] +lang = "en" +pipeline = ["transformer"] + +[components] + +[components.transformer] +factory = "curated_transformer" + +[components.transformer.model] +@architectures = "spacy-curated-transformers.CamembertTransformer.v1" +piece_encoder = {"@architectures":"spacy-curated-transformers.ByteBpeEncoder.v1"} +with_spans = {"@architectures":"spacy-curated-transformers.WithStridedSpans.v1"} +attention_probs_dropout_prob = 0.1 +hidden_act = "gelu" +hidden_dropout_prob = 0.1 +hidden_width = 32 +intermediate_width = 37 +layer_norm_eps = 0.0 +max_position_embeddings = 512 +model_max_length = 512 +num_attention_heads = 4 +num_hidden_layers = 5 +padding_idx = 1 +type_vocab_size = 16 +vocab_size = 1000 + +[initialize] + +[initialize.components] + +[initialize.components.transformer] + +[initialize.components.transformer.encoder_loader] +@model_loaders = "spacy-curated-transformers.HFTransformerEncoderLoader.v1" +name = "hf-internal-testing/tiny-random-camembert" +revision = "main" + +[initialize.components.transformer.piecer_loader] +@model_loaders = "spacy-curated-transformers.HFPieceEncoderLoader.v1" +name = "hf-internal-testing/tiny-random-camembert" +revision = "main" +""", + +["--model-name", "hf-internal-testing/tiny-random-camembert", "--model-revision", "main"], +), + +( +""" +[nlp] +lang = "en" +pipeline = ["transformer"] +[components] +[components.transformer] +factory = "curated_transformer" +[components.transformer.model] +@architectures = "spacy-curated-transformers.RobertaTransformer.v1" +piece_encoder = {"@architectures":"spacy-curated-transformers.ByteBpeEncoder.v1"} +[components.transformer.model.with_spans] +@architectures = "spacy-curated-transformers.WithStridedSpans.v1" +[initialize] +[initialize.components] +[initialize.components.transformer] +[initialize.components.transformer.encoder_loader] +@model_loaders = "spacy-curated-transformers.HFTransformerEncoderLoader.v1" +name = "hf-internal-testing/tiny-random-roberta" +[initialize.components.transformer.piecer_loader] +@model_loaders = "spacy-curated-transformers.ByteBpeLoader.v1" +vocab_path = "/tmp/1" +merges_path = "/tmp/2" +""", + +""" +[nlp] +lang = "en" +pipeline = ["transformer"] + +[components] + +[components.transformer] +factory = "curated_transformer" + +[components.transformer.model] +@architectures = "spacy-curated-transformers.RobertaTransformer.v1" +piece_encoder = {"@architectures":"spacy-curated-transformers.ByteBpeEncoder.v1"} +with_spans = {"@architectures":"spacy-curated-transformers.WithStridedSpans.v1"} +attention_probs_dropout_prob = 0.1 +hidden_act = "gelu" +hidden_dropout_prob = 0.1 +hidden_width = 32 +intermediate_width = 37 +layer_norm_eps = 0.0 +max_position_embeddings = 512 +model_max_length = 512 +num_attention_heads = 4 +num_hidden_layers = 5 +padding_idx = 1 +type_vocab_size = 16 +vocab_size = 1000 + +[initialize] + +[initialize.components] + +[initialize.components.transformer] + +[initialize.components.transformer.encoder_loader] +@model_loaders = "spacy-curated-transformers.HFTransformerEncoderLoader.v1" +name = "hf-internal-testing/tiny-random-roberta" +revision = "main" + +[initialize.components.transformer.piecer_loader] +@model_loaders = "spacy-curated-transformers.HFPieceEncoderLoader.v1" +name = "hf-internal-testing/tiny-random-roberta" +revision = "main" +""", + +["--model-name", "hf-internal-testing/tiny-random-roberta", "--model-revision", "main"], +), + +( +""" +[nlp] +lang = "en" +pipeline = ["transformer"] +[components] +[components.transformer] +factory = "curated_transformer" +[components.transformer.model] +@architectures = "spacy-curated-transformers.XlmrTransformer.v1" +piece_encoder = {"@architectures":"spacy-curated-transformers.XlmrSentencepieceEncoder.v1"} +[components.transformer.model.with_spans] +@architectures = "spacy-curated-transformers.WithStridedSpans.v1" +[initialize] +[initialize.components] +[initialize.components.transformer] +[initialize.components.transformer.encoder_loader] +@model_loaders = "spacy-curated-transformers.HFTransformerEncoderLoader.v1" +name = "explosion-testing/xlm-roberta-test" +revision = "main" +[initialize.components.transformer.piecer_loader] +@model_loaders = "spacy-curated-transformers.HFPieceEncoderLoader.v1" +name = "explosion-testing/xlm-roberta-test" +revision = "main" +""", + +""" +[nlp] +lang = "en" +pipeline = ["transformer"] + +[components] + +[components.transformer] +factory = "curated_transformer" + +[components.transformer.model] +@architectures = "spacy-curated-transformers.XlmrTransformer.v1" +attention_probs_dropout_prob = 0.1 +hidden_act = "gelu" +hidden_dropout_prob = 0.1 +hidden_width = 32 +intermediate_width = 37 +layer_norm_eps = 0.00001 +max_position_embeddings = 512 +model_max_length = 2147483647 +num_attention_heads = 4 +num_hidden_layers = 5 +padding_idx = 1 +type_vocab_size = 16 +vocab_size = 1024 +piece_encoder = {"@architectures":"spacy-curated-transformers.XlmrSentencepieceEncoder.v1"} +with_spans = {"@architectures":"spacy-curated-transformers.WithStridedSpans.v1"} + +[initialize] + +[initialize.components] + +[initialize.components.transformer] + +[initialize.components.transformer.encoder_loader] +@model_loaders = "spacy-curated-transformers.HFTransformerEncoderLoader.v1" +name = "explosion-testing/xlm-roberta-test" +revision = "main" + +[initialize.components.transformer.piecer_loader] +@model_loaders = "spacy-curated-transformers.HFPieceEncoderLoader.v1" +name = "explosion-testing/xlm-roberta-test" +revision = "main" +""", + +[], +), +] +# fmt: on + + +@pytest.mark.slow +@pytest.mark.skipif(not has_huggingface_hub, reason="requires Hugging Face Hub") +@pytest.mark.skipif( + not has_hf_transformers, reason="requires Hugging Face transformers" +) +@pytest.mark.parametrize( + "config, output, extra_args", FILL_TRANSFORMER_CONFIG_STRS_AND_OUTPUTS +) +def test_fill_config_transformer(config, output, extra_args): + with make_tempdir() as d: + file_path = d / "test_conf" + output_path = d / "output_conf" + with open(file_path, "w", encoding="utf8") as f: + f.writelines([config]) + + args = [ + "init", + "fill-curated-transformer", + str(file_path), + str(output_path), + ] + extra_args + print(" ".join(args)) + result = CliRunner().invoke(app, args) + try: + assert result.exit_code == 0 + except AssertionError: + if result.exception is not None: + raise result.exception + else: + raise ValueError( + f"Curated Transformer fill config failed! Stderr: \n{result.stderr}" + ) + filled_config = spacy.util.load_config(output_path) + expected_config = spacy.util.load_config_from_str(output) + assert filled_config == expected_config + + +@pytest.mark.slow +@pytest.mark.skipif(not has_huggingface_hub, reason="requires Hugging Face Hub") +@pytest.mark.skipif( + not has_hf_transformers, reason="requires Hugging Face transformers" +) +@pytest.mark.parametrize( + "config", [output for _, output, _ in FILL_TRANSFORMER_CONFIG_STRS_AND_OUTPUTS] +) +def test_validate_test_filled_configs(config): + config = spacy.util.load_config_from_str(config, interpolate=True) + nlp = spacy.util.load_model_from_config(config, validate=True, auto_fill=True) + nlp.initialize() diff --git a/TTS/Kokoro/.venv/Lib/site-packages/spacy_curated_transformers/tests/test_registry.py b/TTS/Kokoro/.venv/Lib/site-packages/spacy_curated_transformers/tests/test_registry.py new file mode 100644 index 0000000000000000000000000000000000000000..c281f19b1494c597e12b140a0292f52e2df8b762 --- /dev/null +++ b/TTS/Kokoro/.venv/Lib/site-packages/spacy_curated_transformers/tests/test_registry.py @@ -0,0 +1,68 @@ +import pytest +from spacy.util import registry as spacy_registry + +from spacy_curated_transformers.util import registry + + +@pytest.mark.parametrize( + "model_name", + [ + "spacy-curated-transformers.AlbertTransformer.v1", + "spacy-curated-transformers.BertTransformer.v1", + "spacy-curated-transformers.CamembertTransformer.v1", + "spacy-curated-transformers.RobertaTransformer.v1", + "spacy-curated-transformers.XlmrTransformer.v1", + "spacy-curated-transformers.WithStridedSpans.v1", + "spacy-curated-transformers.ScalarWeight.v1", + "spacy-curated-transformers.TransformerLayersListener.v1", + "spacy-curated-transformers.LastTransformerLayerListener.v1", + "spacy-curated-transformers.ScalarWeightingListener.v1", + ], +) +def test_model_from_registry(model_name): + # Can't be constructed, since all models have mandatory arguments. + spacy_registry.architectures.get(model_name) + + +@pytest.mark.parametrize( + "encoder_name", + [ + "spacy-curated-transformers.BertWordpieceEncoder.v1", + "spacy-curated-transformers.ByteBpeEncoder.v1", + "spacy-curated-transformers.CamembertSentencepieceEncoder.v1", + "spacy-curated-transformers.CharEncoder.v1", + "spacy-curated-transformers.SentencepieceEncoder.v1", + "spacy-curated-transformers.WordpieceEncoder.v1", + "spacy-curated-transformers.XlmrSentencepieceEncoder.v1", + ], +) +def test_tokenizer_encoder_from_registry(encoder_name): + spacy_registry.architectures.get(encoder_name)() + + +@pytest.mark.parametrize( + "loader_name", + [ + "spacy-curated-transformers.ByteBpeLoader.v1", + "spacy-curated-transformers.CharEncoderLoader.v1", + "spacy-curated-transformers.HFTransformerEncoderLoader.v1", + "spacy-curated-transformers.HFPieceEncoderLoader.v1", + "spacy-curated-transformers.PyTorchCheckpointLoader.v1", + "spacy-curated-transformers.SentencepieceLoader.v1", + "spacy-curated-transformers.WordpieceLoader.v1", + ], +) +def test_model_loaders_from_registry(loader_name): + # Can't be constructed, since most loaders have mandatory arguments. + registry.model_loaders.get(loader_name) + + +@pytest.mark.parametrize( + "callback_name", + [ + "spacy-curated-transformers.gradual_transformer_unfreezing.v1", + ], +) +def test_callbacks_from_registry(callback_name): + # Can't be constructed, since all callbacks have mandatory arguments. + spacy_registry.callbacks.get(callback_name) diff --git a/TTS/Kokoro/.venv/Lib/site-packages/spacy_curated_transformers/tests/test_torchscript_wrapper.py b/TTS/Kokoro/.venv/Lib/site-packages/spacy_curated_transformers/tests/test_torchscript_wrapper.py new file mode 100644 index 0000000000000000000000000000000000000000..c1f3faeaaea3211e95ae195280b3fd2496a44761 --- /dev/null +++ b/TTS/Kokoro/.venv/Lib/site-packages/spacy_curated_transformers/tests/test_torchscript_wrapper.py @@ -0,0 +1,28 @@ +import numpy +import pytest +from thinc.api import get_array_module +from thinc.layers import ( + PyTorchWrapper_v2, + TorchScriptWrapper_v1, + pytorch_to_torchscript_wrapper, +) +from torch.nn import Linear + + +@pytest.mark.parametrize("nN,nI,nO", [(2, 3, 4)]) +def test_pytorch_script(nN, nI, nO): + model = PyTorchWrapper_v2(Linear(nI, nO)).initialize() + + script_model = pytorch_to_torchscript_wrapper(model) + + X = numpy.random.randn(nN, nI).astype("f") + Y = model.predict(X) + Y_script = script_model.predict(X) + xp = get_array_module(Y) + xp.testing.assert_array_equal(Y, Y_script) + + serialized = script_model.to_bytes() + script_model2 = TorchScriptWrapper_v1() + script_model2.from_bytes(serialized) + + xp.testing.assert_array_equal(Y, script_model2.predict(X)) diff --git a/TTS/Kokoro/.venv/Lib/site-packages/spacy_curated_transformers/tests/tokenization/__init__.py b/TTS/Kokoro/.venv/Lib/site-packages/spacy_curated_transformers/tests/tokenization/__init__.py new file mode 100644 index 0000000000000000000000000000000000000000..e69de29bb2d1d6434b8b29ae775ad8c2e48c5391 diff --git a/TTS/Kokoro/.venv/Lib/site-packages/spacy_curated_transformers/tests/tokenization/__pycache__/__init__.cpython-312.pyc b/TTS/Kokoro/.venv/Lib/site-packages/spacy_curated_transformers/tests/tokenization/__pycache__/__init__.cpython-312.pyc new file mode 100644 index 0000000000000000000000000000000000000000..f56d65404153441db8d3a4a9120e291d04108c15 Binary files /dev/null and b/TTS/Kokoro/.venv/Lib/site-packages/spacy_curated_transformers/tests/tokenization/__pycache__/__init__.cpython-312.pyc differ diff --git a/TTS/Kokoro/.venv/Lib/site-packages/spacy_curated_transformers/tests/tokenization/__pycache__/test_bbpe_encoder.cpython-312.pyc b/TTS/Kokoro/.venv/Lib/site-packages/spacy_curated_transformers/tests/tokenization/__pycache__/test_bbpe_encoder.cpython-312.pyc new file mode 100644 index 0000000000000000000000000000000000000000..c7031a4b7dd3f6c713ba6ba48b14939df5f6df91 Binary files /dev/null and b/TTS/Kokoro/.venv/Lib/site-packages/spacy_curated_transformers/tests/tokenization/__pycache__/test_bbpe_encoder.cpython-312.pyc differ diff --git a/TTS/Kokoro/.venv/Lib/site-packages/spacy_curated_transformers/tests/tokenization/__pycache__/test_char_encoder.cpython-312.pyc b/TTS/Kokoro/.venv/Lib/site-packages/spacy_curated_transformers/tests/tokenization/__pycache__/test_char_encoder.cpython-312.pyc new file mode 100644 index 0000000000000000000000000000000000000000..220d72862faa91d06a0831053f19853696d39193 Binary files /dev/null and b/TTS/Kokoro/.venv/Lib/site-packages/spacy_curated_transformers/tests/tokenization/__pycache__/test_char_encoder.cpython-312.pyc differ diff --git a/TTS/Kokoro/.venv/Lib/site-packages/spacy_curated_transformers/tests/tokenization/__pycache__/test_sentencepiece_encoder.cpython-312.pyc b/TTS/Kokoro/.venv/Lib/site-packages/spacy_curated_transformers/tests/tokenization/__pycache__/test_sentencepiece_encoder.cpython-312.pyc new file mode 100644 index 0000000000000000000000000000000000000000..96c1e3ac0bf646bcb6a8301684c119473df5ea24 Binary files /dev/null and b/TTS/Kokoro/.venv/Lib/site-packages/spacy_curated_transformers/tests/tokenization/__pycache__/test_sentencepiece_encoder.cpython-312.pyc differ diff --git a/TTS/Kokoro/.venv/Lib/site-packages/spacy_curated_transformers/tests/tokenization/__pycache__/test_wordpiece_encoder.cpython-312.pyc b/TTS/Kokoro/.venv/Lib/site-packages/spacy_curated_transformers/tests/tokenization/__pycache__/test_wordpiece_encoder.cpython-312.pyc new file mode 100644 index 0000000000000000000000000000000000000000..217a817b5d995a061854b2600ad6faca65869655 Binary files /dev/null and b/TTS/Kokoro/.venv/Lib/site-packages/spacy_curated_transformers/tests/tokenization/__pycache__/test_wordpiece_encoder.cpython-312.pyc differ diff --git a/TTS/Kokoro/.venv/Lib/site-packages/spacy_curated_transformers/tests/tokenization/__pycache__/test_xlmr_adapter.cpython-312.pyc b/TTS/Kokoro/.venv/Lib/site-packages/spacy_curated_transformers/tests/tokenization/__pycache__/test_xlmr_adapter.cpython-312.pyc new file mode 100644 index 0000000000000000000000000000000000000000..9fdd617f960cc0d07ea6dab2e16a2b5e65d432ad Binary files /dev/null and b/TTS/Kokoro/.venv/Lib/site-packages/spacy_curated_transformers/tests/tokenization/__pycache__/test_xlmr_adapter.cpython-312.pyc differ diff --git a/TTS/Kokoro/.venv/Lib/site-packages/spacy_curated_transformers/tests/tokenization/test_bbpe_encoder.py b/TTS/Kokoro/.venv/Lib/site-packages/spacy_curated_transformers/tests/tokenization/test_bbpe_encoder.py new file mode 100644 index 0000000000000000000000000000000000000000..e4c7e497e4c71d1b80aac4e142c78c1095b8106e --- /dev/null +++ b/TTS/Kokoro/.venv/Lib/site-packages/spacy_curated_transformers/tests/tokenization/test_bbpe_encoder.py @@ -0,0 +1,123 @@ +import pytest +from spacy.attrs import IS_SPACE +from spacy.tokens import Doc +from spacy.vocab import Vocab +from thinc.api import Ragged, get_current_ops, registry + +from spacy_curated_transformers._compat import has_hf_transformers +from spacy_curated_transformers.tokenization.bbpe_encoder import ( + build_byte_bpe_encoder_v1, +) +from spacy_curated_transformers.tokenization.hf_loader import ( + build_hf_piece_encoder_loader_v1, +) + + +@pytest.fixture +def toy_encoder(test_dir): + encoder = build_byte_bpe_encoder_v1() + encoder.init = registry.model_loaders.get( + "spacy-curated-transformers.ByteBpeLoader.v1" + )(vocab_path=test_dir / "toy-vocab.json", merges_path=test_dir / "toy-merges.txt") + encoder.initialize() + return encoder + + +@pytest.mark.slow +@pytest.mark.skipif(not has_hf_transformers, reason="requires huggingface transformers") +def test_bbpe_encoder_hf_model(sample_docs): + encoder = build_byte_bpe_encoder_v1() + encoder.init = build_hf_piece_encoder_loader_v1(name="roberta-base") + encoder.initialize() + encoding = encoder.predict(sample_docs) + _check_roberta_base_encoder(encoding) + + +def test_bbpe_encoder(toy_encoder, sample_docs): + encoding = toy_encoder.predict(sample_docs) + _check_toy_encoder(encoding) + + +def test_serialize(toy_encoder): + encoder_bytes = toy_encoder.to_bytes() + toy_encoder2 = build_byte_bpe_encoder_v1() + toy_encoder2.from_bytes(encoder_bytes) + assert ( + toy_encoder.attrs["byte_bpe_processor"].vocab + == toy_encoder2.attrs["byte_bpe_processor"].vocab + ) + assert ( + toy_encoder.attrs["byte_bpe_processor"].merges + == toy_encoder2.attrs["byte_bpe_processor"].merges + ) + + +@pytest.mark.parametrize( + "strings", + [["a", "b", "c"], ["a", " ", "c"], ["cat", "sat", "mat"], [" "], [" ", "hi"]], +) +def test_bbpe_whitespace_encoding(toy_encoder, strings): + doc = Doc( + Vocab(lex_attr_getters={IS_SPACE: lambda w: int(w.isspace())}), words=strings + ) + encoding = toy_encoder.predict([doc]) + # Strip bos and eos markers + doc_encoding = encoding[0][1:-1] + for i, token in enumerate(doc): + if token.is_space: + assert doc_encoding.lengths[i] == 0 + else: + assert doc_encoding.lengths[i] >= 1 + + +@pytest.mark.slow +@pytest.mark.skipif(not has_hf_transformers, reason="requires huggingface transformers") +def test_serialize_hf_model(sample_docs): + encoder = build_byte_bpe_encoder_v1() + encoder.init = build_hf_piece_encoder_loader_v1(name="roberta-base") + encoder.initialize() + encoder_bytes = encoder.to_bytes() + encoder2 = build_byte_bpe_encoder_v1() + encoder2.from_bytes(encoder_bytes) + encoding = encoder2.predict(sample_docs) + _check_roberta_base_encoder(encoding) + + +def _check_toy_encoder(encoding): + assert isinstance(encoding, list) + assert len(encoding) == 2 + + assert isinstance(encoding[0], Ragged) + ops = get_current_ops() + ops.xp.testing.assert_array_equal( + encoding[0].lengths, [1, 1, 1, 1, 3, 1, 1, 6, 1, 1] + ) + ops.xp.testing.assert_array_equal( + encoding[0].dataXd, + [0, 44, 997, 262, 305, 334, 79, 342, 262, 388, 79, 302, 70, 472, 72, 17, 2], + ) + + ops.xp.testing.assert_array_equal(encoding[1].lengths, [1, 3, 1, 1, 2, 4, 3, 1, 1]) + ops.xp.testing.assert_array_equal( + encoding[1].dataXd, + [0, 55, 841, 321, 362, 579, 324, 294, 291, 494, 131, 106, 270, 307, 79, 17, 2], + ) + + +def _check_roberta_base_encoder(encoding): + assert isinstance(encoding, list) + assert len(encoding) == 2 + + assert isinstance(encoding[0], Ragged) + ops = get_current_ops() + ops.xp.testing.assert_array_equal( + encoding[0].lengths, [1, 1, 1, 1, 1, 1, 1, 1, 1, 1] + ) + ops.xp.testing.assert_array_equal( + encoding[0].dataXd, [0, 100, 794, 10, 1816, 19, 10, 27608, 4, 2] + ) + + ops.xp.testing.assert_array_equal(encoding[1].lengths, [1, 1, 1, 1, 1, 2, 1, 1, 1]) + ops.xp.testing.assert_array_equal( + encoding[1].dataXd, [0, 5625, 52, 40, 3529, 181, 48344, 5749, 4, 2] + ) diff --git a/TTS/Kokoro/.venv/Lib/site-packages/spacy_curated_transformers/tests/tokenization/test_char_encoder.py b/TTS/Kokoro/.venv/Lib/site-packages/spacy_curated_transformers/tests/tokenization/test_char_encoder.py new file mode 100644 index 0000000000000000000000000000000000000000..4d05f44965d1b77766bff296e2c8778b9752397a --- /dev/null +++ b/TTS/Kokoro/.venv/Lib/site-packages/spacy_curated_transformers/tests/tokenization/test_char_encoder.py @@ -0,0 +1,113 @@ +import pytest +import spacy +from thinc.api import Ragged, get_current_ops + +from spacy_curated_transformers._compat import ( + has_fugashi, + has_hf_transformers, + has_sudachi, +) +from spacy_curated_transformers.tokenization.char_encoder import ( + build_char_encoder_loader_v1, + build_char_encoder_v1, +) +from spacy_curated_transformers.tokenization.hf_loader import ( + build_hf_piece_encoder_loader_v1, +) +from spacy_curated_transformers.tokenization.wordpiece_encoder import ( + build_wordpiece_encoder_v1, +) +from spacy_curated_transformers.util import registry + + +def test_char_encoder(test_dir): + ops = get_current_ops() + encoder = build_char_encoder_v1() + encoder.init = build_char_encoder_loader_v1(path=test_dir / "toy-chars.txt") + encoder.initialize() + + nlp = spacy.blank("nl") + sample_docs = [nlp.make_doc("Zeeën van tijd."), nlp.make_doc("Geïnd geld")] + + encoding = encoder.predict(sample_docs) + + assert isinstance(encoding, list) + assert len(encoding) == 2 + + assert isinstance(encoding[0], Ragged) + ops.xp.testing.assert_array_equal(encoding[0].lengths, [1, 5, 3, 4, 1, 1]) + ops.xp.testing.assert_array_equal( + encoding[0].dataXd, [2, 56, 9, 9, 57, 18, 26, 5, 18, 24, 13, 14, 8, 1, 3] + ) + + assert isinstance(encoding[1], Ragged) + ops.xp.testing.assert_array_equal(encoding[1].lengths, [1, 5, 4, 1]) + ops.xp.testing.assert_array_equal( + encoding[1].dataXd, [2, 37, 9, 1, 18, 8, 11, 9, 16, 8, 3] + ) + + +@pytest.mark.slow +@pytest.mark.skipif(not has_hf_transformers, reason="requires huggingface transformers") +@pytest.mark.skipif(not has_fugashi, reason="requires fugashi") +@pytest.mark.skipif(not has_sudachi, reason="requires SudachiPy and SudachiDict-core") +def test_char_encoder_hf_model(): + ops = get_current_ops() + encoder = build_char_encoder_v1() + encoder.init = registry.model_loaders.get( + "spacy-curated-transformers.HFPieceEncoderLoader.v1" + )(name="cl-tohoku/bert-base-japanese-char-v2") + encoder.initialize() + + nlp = spacy.blank("ja") + sample_docs = [nlp.make_doc("日本語だよ"), nlp.make_doc("吾輩は猫である。")] + + encoding = encoder.predict(sample_docs) + + assert isinstance(encoding, list) + assert len(encoding) == 2 + + assert isinstance(encoding[0], Ragged) + ops.xp.testing.assert_array_equal(encoding[0].lengths, [1, 2, 1, 1, 1, 1]) + ops.xp.testing.assert_array_equal( + encoding[0].dataXd, [2, 2719, 2828, 4923, 882, 922, 3] + ) + + ops.xp.testing.assert_array_equal(encoding[1].lengths, [1, 2, 1, 1, 1, 2, 1, 1]) + ops.xp.testing.assert_array_equal( + encoding[1].dataXd, [2, 1583, 5159, 897, 3574, 889, 852, 925, 829, 3] + ) + + +@pytest.mark.slow +@pytest.mark.skipif(not has_hf_transformers, reason="requires huggingface transformers") +@pytest.mark.skipif(not has_fugashi, reason="requires fugashi") +@pytest.mark.skipif(not has_sudachi, reason="requires SudachiPy and SudachiDict-core") +def test_hf_loader_rejects_incorrect_encoder(): + encoder = build_wordpiece_encoder_v1() + encoder.init = build_hf_piece_encoder_loader_v1( + name="cl-tohoku/bert-base-japanese-char-v2" + ) + with pytest.raises(ValueError, match="incompatible piece encoder"): + encoder.initialize() + + +@pytest.mark.slow +@pytest.mark.skipif(not has_hf_transformers, reason="requires huggingface transformers") +@pytest.mark.skipif(not has_fugashi, reason="requires fugashi") +@pytest.mark.skipif(not has_sudachi, reason="requires SudachiPy and SudachiDict-core") +def test_hf_loader_rejects_incorrect_model(): + encoder = build_char_encoder_v1() + encoder.init = build_hf_piece_encoder_loader_v1( + name="cl-tohoku/bert-base-japanese-v2" + ) + with pytest.raises(ValueError, match="only support character subword"): + encoder.initialize() + + +@pytest.mark.slow +def test_loader_rejects_incorrect_encoder(test_dir): + encoder = build_wordpiece_encoder_v1() + encoder.init = build_char_encoder_loader_v1(path=test_dir / "toy-chars.txt") + with pytest.raises(ValueError, match="incompatible model"): + encoder.initialize() diff --git a/TTS/Kokoro/.venv/Lib/site-packages/spacy_curated_transformers/tests/tokenization/test_sentencepiece_encoder.py b/TTS/Kokoro/.venv/Lib/site-packages/spacy_curated_transformers/tests/tokenization/test_sentencepiece_encoder.py new file mode 100644 index 0000000000000000000000000000000000000000..c8087849beb2fdc984a6d454848557095429840c --- /dev/null +++ b/TTS/Kokoro/.venv/Lib/site-packages/spacy_curated_transformers/tests/tokenization/test_sentencepiece_encoder.py @@ -0,0 +1,103 @@ +import pytest +from spacy.attrs import IS_SPACE +from spacy.tokens import Doc +from spacy.vocab import Vocab +from thinc.api import Ragged, get_current_ops, registry + +from spacy_curated_transformers._compat import has_hf_transformers +from spacy_curated_transformers.tokenization.hf_loader import ( + build_hf_piece_encoder_loader_v1, +) +from spacy_curated_transformers.tokenization.sentencepiece_encoder import ( + build_sentencepiece_encoder_v1, +) + + +@pytest.fixture +def toy_encoder(sentencepiece_toy_model_path): + encoder = build_sentencepiece_encoder_v1() + encoder.init = registry.model_loaders.get( + "spacy-curated-transformers.SentencepieceLoader.v1" + )(path=sentencepiece_toy_model_path) + encoder.initialize() + return encoder + + +def test_sentencepiece_encoder(toy_encoder, sample_docs): + encoding = toy_encoder.predict(sample_docs) + _check_toy_encoder(encoding) + + +@pytest.mark.parametrize( + "strings", + [["a", "b", "c"], ["a", " ", "c"], ["cat", "sat", "mat"], [" "], [" ", "hi"]], +) +def test_sp_whitespace_encoding(toy_encoder, strings): + doc = Doc( + Vocab(lex_attr_getters={IS_SPACE: lambda w: int(w.isspace())}), words=strings + ) + encoding = toy_encoder.predict([doc]) + # Strip bos and eos markers + doc_encoding = encoding[0][1:-1] + for i, token in enumerate(doc): + if token.is_space: + assert doc_encoding.lengths[i] == 0 + else: + assert doc_encoding.lengths[i] >= 1 + + +@pytest.mark.slow +@pytest.mark.skipif(not has_hf_transformers, reason="requires huggingface transformers") +def test_sentencepiece_encoder_hf_model(sample_docs): + encoder = build_sentencepiece_encoder_v1() + encoder.init = build_hf_piece_encoder_loader_v1(name="xlm-roberta-base") + encoder.initialize() + + encoding = encoder.predict(sample_docs) + + assert isinstance(encoding, list) + assert len(encoding) == 2 + + assert isinstance(encoding[0], Ragged) + ops = get_current_ops() + ops.xp.testing.assert_array_equal( + encoding[0].lengths, [1, 1, 1, 1, 1, 1, 1, 2, 2, 1] + ) + ops.xp.testing.assert_array_equal( + encoding[0].dataXd, [1, 86, 24123, 9, 23039, 677, 9, 5500, 70819, 5, 4, 2] + ) + + ops.xp.testing.assert_array_equal(encoding[1].lengths, [1, 1, 1, 1, 1, 2, 1, 2, 1]) + ops.xp.testing.assert_array_equal( + encoding[1].dataXd, [1, 38395, 641, 1220, 73202, 159, 7663, 120323, 5, 4, 2] + ) + + +def test_serialize(toy_encoder, sample_docs): + encoder_bytes = toy_encoder.to_bytes() + encoder2 = build_sentencepiece_encoder_v1() + encoder2.from_bytes(encoder_bytes) + encoding = encoder2.predict(sample_docs) + _check_toy_encoder(encoding) + + +def _check_toy_encoder(encoding): + assert isinstance(encoding, list) + assert len(encoding) == 2 + + assert isinstance(encoding[0], Ragged) + ops = get_current_ops() + ops.xp.testing.assert_array_equal( + encoding[0].lengths, [1, 1, 1, 1, 1, 1, 1, 6, 2, 1] + ) + ops.xp.testing.assert_array_equal( + encoding[0].dataXd, + [1, 8, 465, 10, 947, 41, 10, 170, 168, 110, 28, 20, 143, 7, 4, 2], + ) + + assert isinstance(encoding[1], Ragged) + ops.xp.testing.assert_array_equal(encoding[1].lengths, [1, 2, 1, 1, 1, 4, 3, 2, 1]) + ops.xp.testing.assert_array_equal( + encoding[1].dataXd, + [1, 483, 546, 112, 171, 567, 62, 20, 45, 0, 84, 115, 27, 7, 4, 2], + ) diff --git a/TTS/Kokoro/.venv/Lib/site-packages/spacy_curated_transformers/tests/tokenization/test_wordpiece_encoder.py b/TTS/Kokoro/.venv/Lib/site-packages/spacy_curated_transformers/tests/tokenization/test_wordpiece_encoder.py new file mode 100644 index 0000000000000000000000000000000000000000..7b45ce2c297b265919682a6632c0eb5df26ea6eb --- /dev/null +++ b/TTS/Kokoro/.venv/Lib/site-packages/spacy_curated_transformers/tests/tokenization/test_wordpiece_encoder.py @@ -0,0 +1,255 @@ +from tempfile import TemporaryDirectory + +import pytest +import spacy +from spacy.attrs import IS_SPACE +from spacy.tokens import Doc +from spacy.vocab import Vocab +from thinc.api import Ragged, get_current_ops + +from spacy_curated_transformers._compat import has_hf_transformers, transformers +from spacy_curated_transformers.tokenization.hf_loader import ( + build_hf_piece_encoder_loader_v1, +) +from spacy_curated_transformers.tokenization.wordpiece_encoder import ( + _bert_preprocess, + build_bert_wordpiece_encoder_v1, + build_wordpiece_encoder_loader_v1, + build_wordpiece_encoder_v1, +) + + +def test_wordpiece_encoder_local_model(wordpiece_toy_encoder, sample_docs): + encoding = wordpiece_toy_encoder.predict(sample_docs) + _check_toy_encoder(encoding) + + +@pytest.mark.slow +@pytest.mark.skipif(not has_hf_transformers, reason="requires huggingface transformers") +def test_wordpiece_encoder_hf_model(sample_docs): + ops = get_current_ops() + encoder = build_wordpiece_encoder_v1() + encoder.init = build_hf_piece_encoder_loader_v1(name="bert-base-cased") + encoder.initialize() + + encoding = encoder.predict(sample_docs) + + assert isinstance(encoding, list) + assert len(encoding) == 2 + + assert isinstance(encoding[0], Ragged) + ops.xp.testing.assert_array_equal( + encoding[0].lengths, [1, 1, 1, 1, 1, 1, 1, 1, 1, 1] + ) + ops.xp.testing.assert_array_equal( + encoding[0].dataXd, [101, 146, 1486, 170, 1873, 1114, 170, 16737, 119, 102] + ) + + ops.xp.testing.assert_array_equal(encoding[1].lengths, [1, 1, 1, 1, 1, 3, 1, 1, 1]) + ops.xp.testing.assert_array_equal( + encoding[1].dataXd, + [101, 3570, 1195, 1209, 3940, 185, 5926, 2744, 7329, 119, 102], + ) + + +@pytest.mark.slow +@pytest.mark.skipif(not has_hf_transformers, reason="requires huggingface transformers") +def test_wordpiece_encoder_hf_model_uncased(sample_docs): + ops = get_current_ops() + encoder = build_wordpiece_encoder_v1() + encoder.init = build_hf_piece_encoder_loader_v1(name="bert-base-uncased") + encoder.initialize() + + encoding = encoder.predict(sample_docs) + + assert isinstance(encoding, list) + assert len(encoding) == 2 + + assert isinstance(encoding[0], Ragged) + ops.xp.testing.assert_array_equal( + encoding[0].lengths, [1, 1, 1, 1, 1, 1, 1, 1, 1, 1] + ) + ops.xp.testing.assert_array_equal( + encoding[0].dataXd, [101, 1045, 2387, 1037, 2611, 2007, 1037, 12772, 1012, 102] + ) + + ops.xp.testing.assert_array_equal(encoding[1].lengths, [1, 1, 1, 1, 1, 1, 1, 1, 1]) + ops.xp.testing.assert_array_equal( + encoding[1].dataXd, [101, 2651, 2057, 2097, 4521, 26202, 4605, 1012, 102] + ) + + +@pytest.mark.slow +@pytest.mark.skipif(not has_hf_transformers, reason="requires huggingface transformers") +def test_wordpiece_encoder_hf_model_german(): + ops = get_current_ops() + encoder = build_bert_wordpiece_encoder_v1() + encoder.init = build_hf_piece_encoder_loader_v1(name="bert-base-german-cased") + encoder.initialize() + + nlp = spacy.blank("de") + sample_docs = [ + nlp.make_doc("Wir sehen ein AWO-Mitarbeiter."), + nlp.make_doc("Die Mw.-St. beträgt 19 Prozent."), + ] + + encoding = encoder.predict(sample_docs) + + assert isinstance(encoding, list) + assert len(encoding) == 2 + + assert isinstance(encoding[0], Ragged) + ops.xp.testing.assert_array_equal(encoding[0].lengths, [1, 1, 1, 1, 5, 1, 1]) + ops.xp.testing.assert_array_equal( + encoding[0].dataXd, [3, 655, 2265, 39, 32, 26939, 26962, 26935, 2153, 26914, 4] + ) + + ops.xp.testing.assert_array_equal(encoding[1].lengths, [1, 1, 5, 1, 1, 1, 1, 1, 1]) + ops.xp.testing.assert_array_equal( + encoding[1].dataXd, + [3, 125, 56, 26915, 26914, 26935, 130, 26914, 4490, 141, 1028, 26914, 4], + ) + + +@pytest.mark.slow +@pytest.mark.skipif(not has_hf_transformers, reason="requires huggingface transformers") +def test_wordpiece_encoder_loader(sample_docs): + ops = get_current_ops() + encoder = build_wordpiece_encoder_v1() + hf_tokenizer = transformers.AutoTokenizer.from_pretrained("bert-base-cased") + with TemporaryDirectory() as d: + vocab_path = hf_tokenizer.save_vocabulary(d)[0] + encoder.init = build_wordpiece_encoder_loader_v1(path=vocab_path) + encoder.initialize() + + encoding = encoder.predict(sample_docs) + + assert isinstance(encoding, list) + assert len(encoding) == 2 + + assert isinstance(encoding[0], Ragged) + ops.xp.testing.assert_array_equal( + encoding[0].lengths, [1, 1, 1, 1, 1, 1, 1, 1, 1, 1] + ) + ops.xp.testing.assert_array_equal( + encoding[0].dataXd, [101, 146, 1486, 170, 1873, 1114, 170, 16737, 119, 102] + ) + + ops.xp.testing.assert_array_equal(encoding[1].lengths, [1, 1, 1, 1, 1, 3, 1, 1, 1]) + ops.xp.testing.assert_array_equal( + encoding[1].dataXd, + [101, 3570, 1195, 1209, 3940, 185, 5926, 2744, 7329, 119, 102], + ) + + +@pytest.mark.slow +@pytest.mark.skipif(not has_hf_transformers, reason="requires huggingface transformers") +def test_wordpiece_encoder_loader_uncased(sample_docs): + ops = get_current_ops() + encoder = build_wordpiece_encoder_v1() + hf_tokenizer = transformers.AutoTokenizer.from_pretrained("bert-base-uncased") + with TemporaryDirectory() as d: + vocab_path = hf_tokenizer.save_vocabulary(d)[0] + encoder.init = build_wordpiece_encoder_loader_v1( + path=vocab_path, lowercase=True, strip_accents=True + ) + encoder.initialize() + + encoding = encoder.predict(sample_docs) + + assert isinstance(encoding, list) + assert len(encoding) == 2 + + assert isinstance(encoding[0], Ragged) + ops.xp.testing.assert_array_equal( + encoding[0].lengths, [1, 1, 1, 1, 1, 1, 1, 1, 1, 1] + ) + ops.xp.testing.assert_array_equal( + encoding[0].dataXd, [101, 1045, 2387, 1037, 2611, 2007, 1037, 12772, 1012, 102] + ) + + ops.xp.testing.assert_array_equal(encoding[1].lengths, [1, 1, 1, 1, 1, 1, 1, 1, 1]) + ops.xp.testing.assert_array_equal( + encoding[1].dataXd, [101, 2651, 2057, 2097, 4521, 26202, 4605, 1012, 102] + ) + + +def test_serialize(wordpiece_toy_encoder): + encoder_bytes = wordpiece_toy_encoder.to_bytes() + toy_encoder2 = build_wordpiece_encoder_v1() + toy_encoder2.from_bytes(encoder_bytes) + assert ( + wordpiece_toy_encoder.attrs["wordpiece_processor"].to_list() + == toy_encoder2.attrs["wordpiece_processor"].to_list() + ) + + +@pytest.mark.slow +@pytest.mark.skipif(not has_hf_transformers, reason="requires huggingface transformers") +def test_serialize_hf_model(): + encoder = build_wordpiece_encoder_v1() + encoder.init = build_hf_piece_encoder_loader_v1(name="bert-base-cased") + encoder.initialize() + encoder_bytes = encoder.to_bytes() + encoder2 = build_wordpiece_encoder_v1() + encoder2.from_bytes(encoder_bytes) + assert ( + encoder.attrs["wordpiece_processor"].to_list() + == encoder2.attrs["wordpiece_processor"].to_list() + ) + + +def test_bert_preprocess(): + assert _bert_preprocess("AWO-Mitarbeiter") == ["AWO", "-", "Mitarbeiter"] + assert _bert_preprocess("-Mitarbeiter") == ["-", "Mitarbeiter"] + assert _bert_preprocess("AWO-") == ["AWO", "-"] + assert _bert_preprocess("-") == ["-"] + assert _bert_preprocess("") == [] + assert _bert_preprocess("Mw.-St.") == ["Mw", ".", "-", "St", "."] + + +@pytest.fixture +def encoder(): + encoder = build_wordpiece_encoder_v1() + encoder.init = build_hf_piece_encoder_loader_v1(name="bert-base-cased") + encoder.initialize() + return encoder + + +@pytest.mark.parametrize( + "strings", + [["a", "b", "c"], ["a", " ", "c"], ["cat", "sat", "mat"], [" "], [" ", "hi"]], +) +def test_wp_whitespace_encoding(wordpiece_toy_encoder, strings): + doc = Doc( + Vocab(lex_attr_getters={IS_SPACE: lambda w: int(w.isspace())}), words=strings + ) + encoding = wordpiece_toy_encoder.predict([doc]) + # Strip bos and eos markers + doc_encoding = encoding[0][1:-1] + for i, token in enumerate(doc): + if token.is_space: + assert doc_encoding.lengths[i] == 0 + else: + assert doc_encoding.lengths[i] >= 1 + + +def _check_toy_encoder(encoding): + ops = get_current_ops() + assert isinstance(encoding, list) + assert len(encoding) == 2 + + assert isinstance(encoding[0], Ragged) + ops.xp.testing.assert_array_equal( + encoding[0].lengths, [1, 1, 1, 1, 3, 1, 1, 5, 1, 1] + ) + ops.xp.testing.assert_array_equal( + encoding[0].dataXd, + [2, 41, 818, 61, 67, 193, 88, 204, 61, 251, 909, 682, 102, 95, 17, 3], + ) + + ops.xp.testing.assert_array_equal(encoding[1].lengths, [1, 3, 1, 1, 2, 3, 3, 1, 1]) + ops.xp.testing.assert_array_equal( + encoding[1].dataXd, + [2, 824, 98, 189, 311, 417, 65, 155, 503, 99, 1, 416, 117, 88, 17, 3], + ) diff --git a/TTS/Kokoro/.venv/Lib/site-packages/spacy_curated_transformers/tests/tokenization/test_xlmr_adapter.py b/TTS/Kokoro/.venv/Lib/site-packages/spacy_curated_transformers/tests/tokenization/test_xlmr_adapter.py new file mode 100644 index 0000000000000000000000000000000000000000..38eee473778798eaeaaeb9c439ca0950187dcdd9 --- /dev/null +++ b/TTS/Kokoro/.venv/Lib/site-packages/spacy_curated_transformers/tests/tokenization/test_xlmr_adapter.py @@ -0,0 +1,135 @@ +from typing import List + +import pytest +from curated_tokenizers import SentencePieceProcessor +from thinc.api import Model, NumpyOps, Ragged, chain, get_current_ops +from thinc.util import convert_recursive, is_cupy_array + +from spacy_curated_transformers._compat import has_hf_transformers, transformers +from spacy_curated_transformers.models.output import TransformerModelOutput +from spacy_curated_transformers.models.remove_eos_bos import remove_bos_eos +from spacy_curated_transformers.tokenization.hf_loader import ( + build_hf_piece_encoder_loader_v1, +) +from spacy_curated_transformers.tokenization.sentencepiece_adapters import ( + build_xlmr_adapter, +) +from spacy_curated_transformers.tokenization.sentencepiece_encoder import ( + build_sentencepiece_encoder_v1, + build_xlmr_sentencepiece_encoder_v1, +) +from spacy_curated_transformers.tokenization.wordpiece_encoder import ( + build_wordpiece_encoder_v1, +) + + +@pytest.fixture +def toy_model(sentencepiece_toy_model_path): + return SentencePieceProcessor.from_file(str(sentencepiece_toy_model_path)) + + +@pytest.fixture +def toy_encoder(toy_model): + encoder = build_xlmr_sentencepiece_encoder_v1() + encoder.get_ref("encoder").attrs["sentencepiece_processor"] = toy_model + return encoder + + +@pytest.fixture +def empty_encoder(): + return build_xlmr_sentencepiece_encoder_v1() + + +def _mock_transformer() -> Model[List[Ragged], TransformerModelOutput]: + def forward(model: Model, X: List[Ragged], is_train: bool): + return ( + TransformerModelOutput(outputs=[[x] for x in X], last_layer_only=True), + lambda x: x, + ) + + return Model("mock_transformer", forward) + + +def test_sentencepiece_encoder(toy_encoder, sample_docs): + encoding = toy_encoder.predict(sample_docs) + _check_encoder(encoding) + + +def test_serialize(toy_encoder, empty_encoder, sample_docs): + encoder_bytes = toy_encoder.to_bytes() + encoder2 = empty_encoder + encoder2.from_bytes(encoder_bytes) + encoding = encoder2.predict(sample_docs) + _check_encoder(encoding) + + +def _compare_model_hf_output(ops, Y, Y_hf): + numpy = NumpyOps().xp + # Get inputs, removing BOS/EOS from every token. + Y_hf = [numpy.array(e[1:-1]) for e in Y_hf["input_ids"]] + + # Since cupy balks at comparing sequences that mix CPU lists and GPU arrays, + # we'll need to convert them to numpy (CPU) arrays first. + Y = convert_recursive( + is_cupy_array, lambda a: a.get(), ops.unflatten(Y.dataXd, Y.lengths) + ) + numpy.testing.assert_equal(Y, Y_hf) + + +@pytest.mark.slow +@pytest.mark.skipif(not has_hf_transformers, reason="requires huggingface transformers") +def test_sentencepiece_encoder_against_hf(sample_docs): + ops = get_current_ops() + + hf_tokenizer = transformers.AutoTokenizer.from_pretrained("xlm-roberta-base") + encoder = build_sentencepiece_encoder_v1() + encoder.init = build_hf_piece_encoder_loader_v1(name="xlm-roberta-base") + encoder.initialize() + model = chain(encoder, build_xlmr_adapter(), _mock_transformer(), remove_bos_eos()) + + encoding = model.predict(sample_docs) + hf_encoding = hf_tokenizer([token.text for token in sample_docs[0]]) + _compare_model_hf_output(ops, encoding.all_outputs[0][0], hf_encoding) + + hf_encoding = hf_tokenizer([token.text for token in sample_docs[1]]) + _compare_model_hf_output(ops, encoding.all_outputs[1][0], hf_encoding) + + +@pytest.mark.slow +@pytest.mark.skipif(not has_hf_transformers, reason="requires huggingface transformers") +def test_wordpiece_encoder_against_hf(sample_docs): + ops = get_current_ops() + encoder = build_wordpiece_encoder_v1() + encoder.init = build_hf_piece_encoder_loader_v1(name="bert-base-cased") + encoder.initialize() + hf_tokenizer = transformers.AutoTokenizer.from_pretrained("bert-base-cased") + model = chain(encoder, _mock_transformer(), remove_bos_eos()) + + encoding = model.predict(sample_docs) + hf_encoding = hf_tokenizer([token.text for token in sample_docs[0]]) + _compare_model_hf_output(ops, encoding.all_outputs[0][0], hf_encoding) + + hf_encoding = hf_tokenizer([token.text for token in sample_docs[1]]) + _compare_model_hf_output(ops, encoding.all_outputs[1][0], hf_encoding) + + +def _check_encoder(encoding): + assert isinstance(encoding, list) + assert len(encoding) == 2 + + assert isinstance(encoding[0], Ragged) + ops = get_current_ops() + ops.xp.testing.assert_array_equal( + encoding[0].lengths, [1, 1, 1, 1, 1, 1, 1, 6, 2, 1] + ) + ops.xp.testing.assert_array_equal( + encoding[0].dataXd, + [0, 9, 466, 11, 948, 42, 11, 171, 169, 111, 29, 21, 144, 8, 5, 2], + ) + + assert isinstance(encoding[1], Ragged) + ops.xp.testing.assert_array_equal(encoding[1].lengths, [1, 2, 1, 1, 1, 4, 3, 2, 1]) + ops.xp.testing.assert_array_equal( + encoding[1].dataXd, + [0, 484, 547, 113, 172, 568, 63, 21, 46, 3, 85, 116, 28, 8, 5, 2], + ) diff --git a/TTS/Kokoro/.venv/Lib/site-packages/spacy_curated_transformers/tests/tokenization/toy-chars.txt b/TTS/Kokoro/.venv/Lib/site-packages/spacy_curated_transformers/tests/tokenization/toy-chars.txt new file mode 100644 index 0000000000000000000000000000000000000000..bc1d9ce29d4435118385ce6fe468c1cacb5e2adb --- /dev/null +++ b/TTS/Kokoro/.venv/Lib/site-packages/spacy_curated_transformers/tests/tokenization/toy-chars.txt @@ -0,0 +1,58 @@ +[PAD] +[UNK] +[CLS] +[SEP] +[MASK] +a +b +c +d +e +f +g +h +i +j +k +l +m +n +o +p +q +r +s +t +u +v +w +x +y +z +A +B +C +D +E +F +G +H +I +J +K +L +M +N +O +P +Q +R +S +T +U +V +W +X +Y +Z +ë diff --git a/TTS/Kokoro/.venv/Lib/site-packages/spacy_curated_transformers/tests/tokenization/toy-merges.txt b/TTS/Kokoro/.venv/Lib/site-packages/spacy_curated_transformers/tests/tokenization/toy-merges.txt new file mode 100644 index 0000000000000000000000000000000000000000..21bfa21cb5382d6379ab04e82a56c5ffaaf062fc --- /dev/null +++ b/TTS/Kokoro/.venv/Lib/site-packages/spacy_curated_transformers/tests/tokenization/toy-merges.txt @@ -0,0 +1,741 @@ +#version: 0.2 - Trained by `huggingface/tokenizers` +Ġ t +h e +Ġ a +č Ċ +i n +Ġ s +Ġ w +Ġt he +Ġ o +r e +Ġ b +Ġ m +o u +e d +Ġ I +n d +h a +i t +Ġ f +e r +Ġt o +in g +i s +e n +Ġ c +o r +o n +Ġo f +Ġ d +a s +Ġa nd +Ġ p +Ġ n +l l +a t +a r +a n +Ġ in +Ġ l +Ġ h +Ġb e +o m +e s +o t +u t +Ġ g +Ġ ha +o w +Ġ he +ha t +Ġw as +Ġ " +l d +Ġt h +g h +i d +l e +Ġ it +Ġo n +c h +Ġ T +a y +Ġs t +e t +Ġ e +c e +Ġ y +en t +Ġ re +l y +v e +Ġm e +s e +gh t +i r +Ġt hat +o o +it h +Ġa s +a l +i m +Ġ r +Ġw ith +Ġm y +ou ld +Ġn ot +s t +a d +Ġ S +i on +Ġ u +c t +he r +Ġy ou +Ġf or +Ġ is +k e +ĠT he +i ght +Ġa n +Ġa t +u r +Ġw e +Ġw h +a m +i c +Ġb ut +. . +Ġo r +t er +a c +i f +. " +r o +v er +Ġs u +Ġha d +Ġs o +Ġth is +ou t +om e +p p +q u +Ġ A +Ġw ould +Ġ P +re d +ar d +Ġt e +Ġh is +Ġs h +Ġs e +Ġb y +Ġ W +Ġ H +r a +in e +Ġa b +Ġf r +Ġha ve +Ġon e +Ġs a +Ġf e +Ġl i +Ġh im +e ct +Ġ R +k ed +ir t +Ġ k +at ion +he n +h ing +Ġa ll +Ġg o +ĠS h +' t +i ll +ar t +c u +Ġo ut +es s +Ġthe y +Ġd o +Ġ if +Ġn o +o re +Ġn e +ow n +Ġ K +Ġu p +ĠR ed +ĠSh irt +am e +a in +a ll +Ġthe re +Ġw or +Ġfr om +Ġ B +oo l +Ġd e +Ġan y +Ġab out +Ġ M +Ġthe m +Ġsa id +e m +on g +Ġwh i +an t +Ġr o +r i +u d +ou nd +ll ow +u n +cu p +a k +Ġwe re +Ġh ou +Ġli ke +a ke +u s +in d +i l +Ġ C +o s +Ġa re +cup ine +i g +or cupine +o p +ch ool +Ġf a +Ġ j +ĠP orcupine +oo d +, " +i ve +u l +Ġs chool +y o +Ġs p +' s +b le +Ġc an +ac k +Ġc om +Ġe x +Ġa l +ac her +u m +an g +o k +Ġw hen +Ġwh o +t her +Ġa f +.. .. +u st +Ġm an +Ġg et +Ġt r +er s +Ġl e +Ġu n +Ġro om +a g +Ġs ome +ha n +Ġc on +on e +Ġwhi ch +w n +Ġ G +Ġ O +Ġs ay +ou gh +Ġd id +? " +Ġ v +is t +c i +Ġp ro +Ġbe c +es t +l f +Ġte acher +a u +Ġp r +v en +b er +Ġt w +ĠI f +as s +Ġbe en +Ġk n +ou s +Ġhou se +Ġw hat +re s +Ġc ould +- - +Ġ qu +ou ght +Ġ N +Ġa g +Ġin t +ĠH e +a nd +he d +Ġwor k +Ġw r +at e +Ġsu ch +Ġfe llow +w e +Ġs he +re e +j ect +id e +l o +ent s +a p +Ġm ore +Ġst ud +Ġa m +Ġa pp +p t +Ġ Y +it e +is h +as t +i e +Ġt im +nd er +i ce +ĠI t +Ġw ill +Ġl oo +ĠP ro +Ġo ther +Ġb o +l own +Ġm ay +en ber +Ġp o +ut enber +Ġsh ould +utenber g +c k +e p +w ay +Ġd ay +Ġp l +r y +it y +or t +Ġhe r +ĠC lown +Ġtim e +Ġw ay +Ġo ld +ver y +Ġof f +as h +ur n +a re +n t +Ġ F +Ġ Ġ +Ġb ack +ĠG utenberg +u re +Ġt han +t h +v ing +he re +in k +Ġthe ir +Ġon ly +Ġr ight +Ġc o +Ġgo ing +Ġth ought +a ch +Ġpr in +Ġstud ents +all y +ĠPro ject +a ble +t e +ar y +Ġas ked +ĠK i +Ġtw o +e l +Ġn ight +at ed +Ġm ake +ot her +se lf +Ġaf ter +ĠO n +ĠKi yo +u b +Ġ D +Ġa c +Ġb r +an ce +Ġg r +Ġhe ad +ĠT h +ad e +Ġu s +Ġse e +Ġkn ow +Ġd on +Ġh ow +o se +v ed +Ġc l +Ġre s +ĠB ut +p l +! " +Ġm ight +Ġf o +ic k +ci p +Ġprin cip +a red +Ġa d +Ġc ome +Ġst art +, -- +Ġ E +Ġb l +Ġm at +om et +Ġth ree +Ġyou r +Ġprincip al +h i +Ġm ade +Ġd own +Ġp art +an s +Ġe ven +it t +Ġd is +Ġbe t +Ġapp e +g e +u ch +Ġo ver +Ġm o +Ġc ou +Ġl et +al k +ig n +o g +t m +Ġa r +Ġs omet +or y +im p +i ed +l ed +Ġw ant +Ġint o +u ll +Ġp re +Ġth ink +Ġm uch +Ġto ld +Ġfa ce +e ver +f f +t hing +Ġthe n +Ġf ir +Ġre t +.... .. +en ce +ar k +ĠThe n +Ġse em +Ġde c +c o +l ing +Ġ L +Ġbe g +Ġha s +au se +ĠTh is +a ce +Ġ 1 +Ġw at +Ġo ur +Ġo wn +ing s +Ġh ot +ok yo +res s +Ġag ain +Ġsomet hing +Ġt ake +re at +Ġc ame +Ġre m +s o +Ġs ha +ĠI n +Ġf ar +ĠT okyo +n er +t y +Ġ ke +it ion +is e +Ġc all +Ġg ood +ĠW hen +e red +g er +Ġ en +Ġin c +ad y +ak ing +Ġfir st +a b +f ore +m p +Ġw ent +or m +at her +Ġl ong +Ġte ll +Ġbet ter +' m +e re +i re +p ect +Ġa way +Ġto wn +Ġst r +Ġsu re +Ġj ust +Ġ ent +Ġs m +at h +Ġbe fore +pp ed +qu ash +Ġk ind +Ġloo ked +i z +n ot +Ġc ha +Ġn ow +Ġhe ard +b ard +e ll +m ent +r ow +er m +Ġhe re +Ġu nder +ĠThe y +ĠW hat +Ġbo ard +i ly +Ġw here +Ġto o +Ġbe ing +Ġwith out +ĠS quash +Ġan s +ĠH ub +Ġwr ong +i ous +l ess +Ġs ame +Ġon ce +ct ion +Ġwe ll +Ġman y +ĠN o +ĠY ou +Ġret urn +ĠHub bard +n g +w ard +in ce +Ġc op +as e +ĠA nd +Ġbec ause +Ġmat ter +o d +p e +p ed +or d +Ġp e +Ġp ers +Ġha nd +ĠA s +Ġpl ace +Ġlet ter +Ġs c +it ed +Ġl au +Ġh o +Ġy en +oo k +Ġr a +Ġmy self +Ġloo k +Ġday s +c ed +f t +l t +x t +is ed +ar s +ĠS o +ĠThe re +Ġsh ow +Ġany thing +ri ed +Ġsp e +Ġsay ing +p er +y ing +Ġt alk +Ġs w +Ġs er +is ha +Ġd es +Ġha ving +id d +Ġaf f +Ġv o +c ess +r on +v es +Ġs at +Ġs et +Ġo p +at ing +an k +Ġe very +Ġne ver +ĠK og +Ġwhi le +os s +Ġcl ass +h o +h y +Ġ very +Ġha r +Ġne w +ri b +Ġle ft +ap er +Ġfo llow +Ġseem ed +ĠKog a +a ir +i es +l ic +s ide +t ed +t ing +t ain +Ġ imp +Ġm ust +Ġth r +Ġteacher s +Ġad d +Ġpers on +' re +a id +a ve +Ġ ( +Ġb ad +en ed +Ġbe l +le ct +ĠM r +Ġcom p +f ul +i x +Ġs en +Ġc are +Ġin d +Ġth ose +ĠT o +Ġy e +if e +Ġtr ans +hi le +Ġwat ch +n a +y a +Ġ U +Ġ [ +in ed +Ġs al +Ġw om +Ġthe se +Ġf ound +Ġd ang +Ġd ist +Ġre g +if f +Ġfe lt +ation s +ĠM ad +Ġbec ame +Ġwork s +Ġstart ed +Ġcou nt +T hat +d ay +i red +l i +Ġm idd +Ġto ok +Ġc he +on s +on t +Ġha lf +ce pt +Ġat t +Ġso on +ĠW e +Ġup on +Ġthr ough +Ġsal ary +Y ou +b od +u e +Ġ J +Ġm ind +Ġp ass +ar ly +ot t +Ġg ive +Ġit s +Ġre f +Ġnot hing +ad ger +ur p +ic ul +Ġsa w +Ġcan not +ag e diff --git a/TTS/Kokoro/.venv/Lib/site-packages/spacy_curated_transformers/tests/tokenization/toy-vocab.json b/TTS/Kokoro/.venv/Lib/site-packages/spacy_curated_transformers/tests/tokenization/toy-vocab.json new file mode 100644 index 0000000000000000000000000000000000000000..e8e0b848fa20b0ae24d3b7a0c9d305af23b4e30a --- /dev/null +++ b/TTS/Kokoro/.venv/Lib/site-packages/spacy_curated_transformers/tests/tokenization/toy-vocab.json @@ -0,0 +1,1002 @@ +{ + "": 0, + "": 1, + "": 2, + "": 3, + "!": 4, + "\"": 5, + "#": 6, + "$": 7, + "%": 8, + "&": 9, + "'": 10, + "(": 11, + ")": 12, + "*": 13, + "+": 14, + ",": 15, + "-": 16, + ".": 17, + "/": 18, + "0": 19, + "1": 20, + "2": 21, + "3": 22, + "4": 23, + "5": 24, + "6": 25, + "7": 26, + "8": 27, + "9": 28, + ":": 29, + ";": 30, + "<": 31, + "=": 32, + ">": 33, + "?": 34, + "@": 35, + "A": 36, + "B": 37, + "C": 38, + "D": 39, + "E": 40, + "F": 41, + "G": 42, + "H": 43, + "I": 44, + "J": 45, + "K": 46, + "L": 47, + "M": 48, + "N": 49, + "O": 50, + "P": 51, + "Q": 52, + "R": 53, + "S": 54, + "T": 55, + "U": 56, + "V": 57, + "W": 58, + "X": 59, + "Y": 60, + "Z": 61, + "[": 62, + "\\": 63, + "]": 64, + "^": 65, + "_": 66, + "`": 67, + "a": 68, + "b": 69, + "c": 70, + "d": 71, + "e": 72, + "f": 73, + "g": 74, + "h": 75, + "i": 76, + "j": 77, + "k": 78, + "l": 79, + "m": 80, + "n": 81, + "o": 82, + "p": 83, + "q": 84, + "r": 85, + "s": 86, + "t": 87, + "u": 88, + "v": 89, + "w": 90, + "x": 91, + "y": 92, + "z": 93, + "{": 94, + "|": 95, + "}": 96, + "~": 97, + "¡": 98, + "¢": 99, + "£": 100, + "¤": 101, + "¥": 102, + "¦": 103, + "§": 104, + "¨": 105, + "©": 106, + "ª": 107, + "«": 108, + "¬": 109, + "®": 110, + "¯": 111, + "°": 112, + "±": 113, + "²": 114, + "³": 115, + "´": 116, + "µ": 117, + "¶": 118, + "·": 119, + "¸": 120, + "¹": 121, + "º": 122, + "»": 123, + "¼": 124, + "½": 125, + "¾": 126, + "¿": 127, + "À": 128, + "Á": 129, + "Â": 130, + "Ã": 131, + "Ä": 132, + "Å": 133, + "Æ": 134, + "Ç": 135, + "È": 136, + "É": 137, + "Ê": 138, + "Ë": 139, + "Ì": 140, + "Í": 141, + "Î": 142, + "Ï": 143, + "Ð": 144, + "Ñ": 145, + "Ò": 146, + "Ó": 147, + "Ô": 148, + "Õ": 149, + "Ö": 150, + "×": 151, + "Ø": 152, + "Ù": 153, + "Ú": 154, + "Û": 155, + "Ü": 156, + "Ý": 157, + "Þ": 158, + "ß": 159, + "à": 160, + "á": 161, + "â": 162, + "ã": 163, + "ä": 164, + "å": 165, + "æ": 166, + "ç": 167, + "è": 168, + "é": 169, + "ê": 170, + "ë": 171, + "ì": 172, + "í": 173, + "î": 174, + "ï": 175, + "ð": 176, + "ñ": 177, + "ò": 178, + "ó": 179, + "ô": 180, + "õ": 181, + "ö": 182, + "÷": 183, + "ø": 184, + "ù": 185, + "ú": 186, + "û": 187, + "ü": 188, + "ý": 189, + "þ": 190, + "ÿ": 191, + "Ā": 192, + "ā": 193, + "Ă": 194, + "ă": 195, + "Ą": 196, + "ą": 197, + "Ć": 198, + "ć": 199, + "Ĉ": 200, + "ĉ": 201, + "Ċ": 202, + "ċ": 203, + "Č": 204, + "č": 205, + "Ď": 206, + "ď": 207, + "Đ": 208, + "đ": 209, + "Ē": 210, + "ē": 211, + "Ĕ": 212, + "ĕ": 213, + "Ė": 214, + "ė": 215, + "Ę": 216, + "ę": 217, + "Ě": 218, + "ě": 219, + "Ĝ": 220, + "ĝ": 221, + "Ğ": 222, + "ğ": 223, + "Ġ": 224, + "ġ": 225, + "Ģ": 226, + "ģ": 227, + "Ĥ": 228, + "ĥ": 229, + "Ħ": 230, + "ħ": 231, + "Ĩ": 232, + "ĩ": 233, + "Ī": 234, + "ī": 235, + "Ĭ": 236, + "ĭ": 237, + "Į": 238, + "į": 239, + "İ": 240, + "ı": 241, + "IJ": 242, + "ij": 243, + "Ĵ": 244, + "ĵ": 245, + "Ķ": 246, + "ķ": 247, + "ĸ": 248, + "Ĺ": 249, + "ĺ": 250, + "Ļ": 251, + "ļ": 252, + "Ľ": 253, + "ľ": 254, + "Ŀ": 255, + "ŀ": 256, + "Ł": 257, + "ł": 258, + "Ń": 259, + "Ġt": 260, + "he": 261, + "Ġa": 262, + "čĊ": 263, + "in": 264, + "Ġs": 265, + "Ġw": 266, + "Ġthe": 267, + "Ġo": 268, + "re": 269, + "Ġb": 270, + "Ġm": 271, + "ou": 272, + "ed": 273, + "ĠI": 274, + "nd": 275, + "ha": 276, + "it": 277, + "Ġf": 278, + "er": 279, + "Ġto": 280, + "ing": 281, + "is": 282, + "en": 283, + "Ġc": 284, + "or": 285, + "on": 286, + "Ġof": 287, + "Ġd": 288, + "as": 289, + "Ġand": 290, + "Ġp": 291, + "Ġn": 292, + "ll": 293, + "at": 294, + "ar": 295, + "an": 296, + "Ġin": 297, + "Ġl": 298, + "Ġh": 299, + "Ġbe": 300, + "om": 301, + "es": 302, + "ot": 303, + "ut": 304, + "Ġg": 305, + "Ġha": 306, + "ow": 307, + "Ġhe": 308, + "hat": 309, + "Ġwas": 310, + "Ġ\"": 311, + "ld": 312, + "Ġth": 313, + "gh": 314, + "id": 315, + "le": 316, + "Ġit": 317, + "Ġon": 318, + "ch": 319, + "ĠT": 320, + "ay": 321, + "Ġst": 322, + "et": 323, + "Ġe": 324, + "ce": 325, + "Ġy": 326, + "ent": 327, + "Ġre": 328, + "ly": 329, + "ve": 330, + "Ġme": 331, + "se": 332, + "ght": 333, + "ir": 334, + "Ġthat": 335, + "oo": 336, + "ith": 337, + "Ġas": 338, + "al": 339, + "im": 340, + "Ġr": 341, + "Ġwith": 342, + "Ġmy": 343, + "ould": 344, + "Ġnot": 345, + "st": 346, + "ad": 347, + "ĠS": 348, + "ion": 349, + "Ġu": 350, + "ct": 351, + "her": 352, + "Ġyou": 353, + "Ġfor": 354, + "Ġis": 355, + "ke": 356, + "ĠThe": 357, + "ight": 358, + "Ġan": 359, + "Ġat": 360, + "ur": 361, + "Ġwe": 362, + "Ġwh": 363, + "am": 364, + "ic": 365, + "Ġbut": 366, + "..": 367, + "Ġor": 368, + "ter": 369, + "ac": 370, + "if": 371, + ".\"": 372, + "ro": 373, + "ver": 374, + "Ġsu": 375, + "Ġhad": 376, + "Ġso": 377, + "Ġthis": 378, + "out": 379, + "ome": 380, + "pp": 381, + "qu": 382, + "ĠA": 383, + "Ġwould": 384, + "ĠP": 385, + "red": 386, + "ard": 387, + "Ġte": 388, + "Ġhis": 389, + "Ġsh": 390, + "Ġse": 391, + "Ġby": 392, + "ĠW": 393, + "ĠH": 394, + "ra": 395, + "ine": 396, + "Ġab": 397, + "Ġfr": 398, + "Ġhave": 399, + "Ġone": 400, + "Ġsa": 401, + "Ġfe": 402, + "Ġli": 403, + "Ġhim": 404, + "ect": 405, + "ĠR": 406, + "ked": 407, + "irt": 408, + "Ġk": 409, + "ation": 410, + "hen": 411, + "hing": 412, + "Ġall": 413, + "Ġgo": 414, + "ĠSh": 415, + "'t": 416, + "ill": 417, + "art": 418, + "cu": 419, + "Ġout": 420, + "ess": 421, + "Ġthey": 422, + "Ġdo": 423, + "Ġif": 424, + "Ġno": 425, + "ore": 426, + "Ġne": 427, + "own": 428, + "ĠK": 429, + "Ġup": 430, + "ĠRed": 431, + "ĠShirt": 432, + "ame": 433, + "ain": 434, + "all": 435, + "Ġthere": 436, + "Ġwor": 437, + "Ġfrom": 438, + "ĠB": 439, + "ool": 440, + "Ġde": 441, + "Ġany": 442, + "Ġabout": 443, + "ĠM": 444, + "Ġthem": 445, + "Ġsaid": 446, + "em": 447, + "ong": 448, + "Ġwhi": 449, + "ant": 450, + "Ġro": 451, + "ri": 452, + "ud": 453, + "ound": 454, + "llow": 455, + "un": 456, + "cup": 457, + "ak": 458, + "Ġwere": 459, + "Ġhou": 460, + "Ġlike": 461, + "ake": 462, + "us": 463, + "ind": 464, + "il": 465, + "ĠC": 466, + "os": 467, + "Ġare": 468, + "cupine": 469, + "ig": 470, + "orcupine": 471, + "op": 472, + "chool": 473, + "Ġfa": 474, + "Ġj": 475, + "ĠPorcupine": 476, + "ood": 477, + ",\"": 478, + "ive": 479, + "ul": 480, + "Ġschool": 481, + "yo": 482, + "Ġsp": 483, + "'s": 484, + "ble": 485, + "Ġcan": 486, + "ack": 487, + "Ġcom": 488, + "Ġex": 489, + "Ġal": 490, + "acher": 491, + "um": 492, + "ang": 493, + "ok": 494, + "Ġwhen": 495, + "Ġwho": 496, + "ther": 497, + "Ġaf": 498, + "....": 499, + "ust": 500, + "Ġman": 501, + "Ġget": 502, + "Ġtr": 503, + "ers": 504, + "Ġle": 505, + "Ġun": 506, + "Ġroom": 507, + "ag": 508, + "Ġsome": 509, + "han": 510, + "Ġcon": 511, + "one": 512, + "Ġwhich": 513, + "wn": 514, + "ĠG": 515, + "ĠO": 516, + "Ġsay": 517, + "ough": 518, + "Ġdid": 519, + "?\"": 520, + "Ġv": 521, + "ist": 522, + "ci": 523, + "Ġpro": 524, + "Ġbec": 525, + "est": 526, + "lf": 527, + "Ġteacher": 528, + "au": 529, + "Ġpr": 530, + "ven": 531, + "ber": 532, + "Ġtw": 533, + "ĠIf": 534, + "ass": 535, + "Ġbeen": 536, + "Ġkn": 537, + "ous": 538, + "Ġhouse": 539, + "Ġwhat": 540, + "res": 541, + "Ġcould": 542, + "--": 543, + "Ġqu": 544, + "ought": 545, + "ĠN": 546, + "Ġag": 547, + "Ġint": 548, + "ĠHe": 549, + "and": 550, + "hed": 551, + "Ġwork": 552, + "Ġwr": 553, + "ate": 554, + "Ġsuch": 555, + "Ġfellow": 556, + "we": 557, + "Ġshe": 558, + "ree": 559, + "ject": 560, + "ide": 561, + "lo": 562, + "ents": 563, + "ap": 564, + "Ġmore": 565, + "Ġstud": 566, + "Ġam": 567, + "Ġapp": 568, + "pt": 569, + "ĠY": 570, + "ite": 571, + "ish": 572, + "ast": 573, + "ie": 574, + "Ġtim": 575, + "nder": 576, + "ice": 577, + "ĠIt": 578, + "Ġwill": 579, + "Ġloo": 580, + "ĠPro": 581, + "Ġother": 582, + "Ġbo": 583, + "lown": 584, + "Ġmay": 585, + "enber": 586, + "Ġpo": 587, + "utenber": 588, + "Ġshould": 589, + "utenberg": 590, + "ck": 591, + "ep": 592, + "way": 593, + "Ġday": 594, + "Ġpl": 595, + "ry": 596, + "ity": 597, + "ort": 598, + "Ġher": 599, + "ĠClown": 600, + "Ġtime": 601, + "Ġway": 602, + "Ġold": 603, + "very": 604, + "Ġoff": 605, + "ash": 606, + "urn": 607, + "are": 608, + "nt": 609, + "ĠF": 610, + "ĠĠ": 611, + "Ġback": 612, + "ĠGutenberg": 613, + "ure": 614, + "Ġthan": 615, + "th": 616, + "ving": 617, + "here": 618, + "ink": 619, + "Ġtheir": 620, + "Ġonly": 621, + "Ġright": 622, + "Ġco": 623, + "Ġgoing": 624, + "Ġthought": 625, + "ach": 626, + "Ġprin": 627, + "Ġstudents": 628, + "ally": 629, + "ĠProject": 630, + "able": 631, + "te": 632, + "ary": 633, + "Ġasked": 634, + "ĠKi": 635, + "Ġtwo": 636, + "el": 637, + "Ġnight": 638, + "ated": 639, + "Ġmake": 640, + "other": 641, + "self": 642, + "Ġafter": 643, + "ĠOn": 644, + "ĠKiyo": 645, + "ub": 646, + "ĠD": 647, + "Ġac": 648, + "Ġbr": 649, + "ance": 650, + "Ġgr": 651, + "Ġhead": 652, + "ĠTh": 653, + "ade": 654, + "Ġus": 655, + "Ġsee": 656, + "Ġknow": 657, + "Ġdon": 658, + "Ġhow": 659, + "ose": 660, + "ved": 661, + "Ġcl": 662, + "Ġres": 663, + "ĠBut": 664, + "pl": 665, + "!\"": 666, + "Ġmight": 667, + "Ġfo": 668, + "ick": 669, + "cip": 670, + "Ġprincip": 671, + "ared": 672, + "Ġad": 673, + "Ġcome": 674, + "Ġstart": 675, + ",--": 676, + "ĠE": 677, + "Ġbl": 678, + "Ġmat": 679, + "omet": 680, + "Ġthree": 681, + "Ġyour": 682, + "Ġprincipal": 683, + "hi": 684, + "Ġmade": 685, + "Ġdown": 686, + "Ġpart": 687, + "ans": 688, + "Ġeven": 689, + "itt": 690, + "Ġdis": 691, + "Ġbet": 692, + "Ġappe": 693, + "ge": 694, + "uch": 695, + "Ġover": 696, + "Ġmo": 697, + "Ġcou": 698, + "Ġlet": 699, + "alk": 700, + "ign": 701, + "og": 702, + "tm": 703, + "Ġar": 704, + "Ġsomet": 705, + "ory": 706, + "imp": 707, + "ied": 708, + "led": 709, + "Ġwant": 710, + "Ġinto": 711, + "ull": 712, + "Ġpre": 713, + "Ġthink": 714, + "Ġmuch": 715, + "Ġtold": 716, + "Ġface": 717, + "ever": 718, + "ff": 719, + "thing": 720, + "Ġthen": 721, + "Ġfir": 722, + "Ġret": 723, + "......": 724, + "ence": 725, + "ark": 726, + "ĠThen": 727, + "Ġseem": 728, + "Ġdec": 729, + "co": 730, + "ling": 731, + "ĠL": 732, + "Ġbeg": 733, + "Ġhas": 734, + "ause": 735, + "ĠThis": 736, + "ace": 737, + "Ġ1": 738, + "Ġwat": 739, + "Ġour": 740, + "Ġown": 741, + "ings": 742, + "Ġhot": 743, + "okyo": 744, + "ress": 745, + "Ġagain": 746, + "Ġsomething": 747, + "Ġtake": 748, + "reat": 749, + "Ġcame": 750, + "Ġrem": 751, + "so": 752, + "Ġsha": 753, + "ĠIn": 754, + "Ġfar": 755, + "ĠTokyo": 756, + "ner": 757, + "ty": 758, + "Ġke": 759, + "ition": 760, + "ise": 761, + "Ġcall": 762, + "Ġgood": 763, + "ĠWhen": 764, + "ered": 765, + "ger": 766, + "Ġen": 767, + "Ġinc": 768, + "ady": 769, + "aking": 770, + "Ġfirst": 771, + "ab": 772, + "fore": 773, + "mp": 774, + "Ġwent": 775, + "orm": 776, + "ather": 777, + "Ġlong": 778, + "Ġtell": 779, + "Ġbetter": 780, + "'m": 781, + "ere": 782, + "ire": 783, + "pect": 784, + "Ġaway": 785, + "Ġtown": 786, + "Ġstr": 787, + "Ġsure": 788, + "Ġjust": 789, + "Ġent": 790, + "Ġsm": 791, + "ath": 792, + "Ġbefore": 793, + "pped": 794, + "quash": 795, + "Ġkind": 796, + "Ġlooked": 797, + "iz": 798, + "not": 799, + "Ġcha": 800, + "Ġnow": 801, + "Ġheard": 802, + "bard": 803, + "ell": 804, + "ment": 805, + "row": 806, + "erm": 807, + "Ġhere": 808, + "Ġunder": 809, + "ĠThey": 810, + "ĠWhat": 811, + "Ġboard": 812, + "ily": 813, + "Ġwhere": 814, + "Ġtoo": 815, + "Ġbeing": 816, + "Ġwithout": 817, + "ĠSquash": 818, + "Ġans": 819, + "ĠHub": 820, + "Ġwrong": 821, + "ious": 822, + "less": 823, + "Ġsame": 824, + "Ġonce": 825, + "ction": 826, + "Ġwell": 827, + "Ġmany": 828, + "ĠNo": 829, + "ĠYou": 830, + "Ġreturn": 831, + "ĠHubbard": 832, + "ng": 833, + "ward": 834, + "ince": 835, + "Ġcop": 836, + "ase": 837, + "ĠAnd": 838, + "Ġbecause": 839, + "Ġmatter": 840, + "od": 841, + "pe": 842, + "ped": 843, + "ord": 844, + "Ġpe": 845, + "Ġpers": 846, + "Ġhand": 847, + "ĠAs": 848, + "Ġplace": 849, + "Ġletter": 850, + "Ġsc": 851, + "ited": 852, + "Ġlau": 853, + "Ġho": 854, + "Ġyen": 855, + "ook": 856, + "Ġra": 857, + "Ġmyself": 858, + "Ġlook": 859, + "Ġdays": 860, + "ced": 861, + "ft": 862, + "lt": 863, + "xt": 864, + "ised": 865, + "ars": 866, + "ĠSo": 867, + "ĠThere": 868, + "Ġshow": 869, + "Ġanything": 870, + "ried": 871, + "Ġspe": 872, + "Ġsaying": 873, + "per": 874, + "ying": 875, + "Ġtalk": 876, + "Ġsw": 877, + "Ġser": 878, + "isha": 879, + "Ġdes": 880, + "Ġhaving": 881, + "idd": 882, + "Ġaff": 883, + "Ġvo": 884, + "cess": 885, + "ron": 886, + "ves": 887, + "Ġsat": 888, + "Ġset": 889, + "Ġop": 890, + "ating": 891, + "ank": 892, + "Ġevery": 893, + "Ġnever": 894, + "ĠKog": 895, + "Ġwhile": 896, + "oss": 897, + "Ġclass": 898, + "ho": 899, + "hy": 900, + "Ġvery": 901, + "Ġhar": 902, + "Ġnew": 903, + "rib": 904, + "Ġleft": 905, + "aper": 906, + "Ġfollow": 907, + "Ġseemed": 908, + "ĠKoga": 909, + "air": 910, + "ies": 911, + "lic": 912, + "side": 913, + "ted": 914, + "ting": 915, + "tain": 916, + "Ġimp": 917, + "Ġmust": 918, + "Ġthr": 919, + "Ġteachers": 920, + "Ġadd": 921, + "Ġperson": 922, + "'re": 923, + "aid": 924, + "ave": 925, + "Ġ(": 926, + "Ġbad": 927, + "ened": 928, + "Ġbel": 929, + "lect": 930, + "ĠMr": 931, + "Ġcomp": 932, + "ful": 933, + "ix": 934, + "Ġsen": 935, + "Ġcare": 936, + "Ġind": 937, + "Ġthose": 938, + "ĠTo": 939, + "Ġye": 940, + "ife": 941, + "Ġtrans": 942, + "hile": 943, + "Ġwatch": 944, + "na": 945, + "ya": 946, + "ĠU": 947, + "Ġ[": 948, + "ined": 949, + "Ġsal": 950, + "Ġwom": 951, + "Ġthese": 952, + "Ġfound": 953, + "Ġdang": 954, + "Ġdist": 955, + "Ġreg": 956, + "iff": 957, + "Ġfelt": 958, + "ations": 959, + "ĠMad": 960, + "Ġbecame": 961, + "Ġworks": 962, + "Ġstarted": 963, + "Ġcount": 964, + "That": 965, + "day": 966, + "ired": 967, + "li": 968, + "Ġmidd": 969, + "Ġtook": 970, + "Ġche": 971, + "ons": 972, + "ont": 973, + "Ġhalf": 974, + "cept": 975, + "Ġatt": 976, + "Ġsoon": 977, + "ĠWe": 978, + "Ġupon": 979, + "Ġthrough": 980, + "Ġsalary": 981, + "You": 982, + "bod": 983, + "ue": 984, + "ĠJ": 985, + "Ġmind": 986, + "Ġpass": 987, + "arly": 988, + "ott": 989, + "Ġgive": 990, + "Ġits": 991, + "Ġref": 992, + "Ġnothing": 993, + "adger": 994, + "urp": 995, + "icul": 996, + "Ġsaw": 997, + "Ġcannot": 998, + "age": 999 +} diff --git a/TTS/Kokoro/.venv/Lib/site-packages/spacy_curated_transformers/tests/tokenization/toy.wordpieces b/TTS/Kokoro/.venv/Lib/site-packages/spacy_curated_transformers/tests/tokenization/toy.wordpieces new file mode 100644 index 0000000000000000000000000000000000000000..9c406323575718caf810ba61e1a6d76384fe59dd --- /dev/null +++ b/TTS/Kokoro/.venv/Lib/site-packages/spacy_curated_transformers/tests/tokenization/toy.wordpieces @@ -0,0 +1,1000 @@ +[PAD] +[UNK] +[CLS] +[SEP] +[MASK] +! +" +# +$ +% +' +( +) +* ++ +, +- +. +/ +0 +1 +2 +3 +4 +5 +6 +7 +8 +9 +: +; +? +@ +A +B +C +D +E +F +G +H +I +J +K +L +M +N +O +P +Q +R +S +T +U +V +W +X +Y +Z +[ +] +a +b +c +d +e +f +g +h +i +j +k +l +m +n +o +p +q +r +s +t +u +v +w +x +y +z +##o +##l +##i +##c +##t +##a +##n +##r +##e +##q +##u +##d +##k +##s +##m +##p +##h +##f +##v +##R +##A +##N +##S +##L +##T +##E +##D +##g +##y +##b +##w +##O +##I +##j +##H +##C +##z +##0 +##x +##8 +##7 +##1 +##U +##P +##3 +##B +##6 +##Y +##4 +##5 +##9 +##X +##Q +##G +##2 +##M +##V +##J +##F +##W +##K +##he +the +##in +##ed +##er +##ou +##nd +##at +to +##ing +##or +##en +##on +##as +##ar +of +th +and +##is +##an +##it +##re +##ll +##es +in +##om +be +##ot +##ut +##ow +was +##ad +##ld +##ch +##gh +it +##et +on +##id +##le +he +##ay +st +##ce +##ly +##ir +me +##ent +##al +##se +that +##ght +##ve +##oo +as +##ith +with +not +my +##ould +wh +##ion +for +##her +you +##ct +The +##im +is +re +##st +##ight +ha +an +##ter +##ur +##ke +##am +at +or +but +##ic +##ac +sh +su +##ro +##ard +##ell +had +this +so +##ver +##ome +##pp +would +##out +##ee +his +li +by +##ine +ab +fr +te +have +one +sa +##ra +##ect +him +##ere +##ked +##irt +##ation +all +##hing +Sh +go +##all +out +do +no +##art +if +##hen +##cu +they +##ess +##ill +up +Red +ne +##ain +##own +Shirt +wor +there +from +##ool +##ore +##ame +any +about +them +said +##mp +de +##ong +ro +##est +##qu +whi +##ant +##ri +##ak +##ud +like +##ound +##un +##cup +Th +hou +were +we +##ake +##us +##ind +##ang +##il +##cupine +Por +are +Porcupine +##chool +##ig +##os +##op +##ish +sp +##ood +##ul +school +##ive +##yo +can +see +##ble +##ff +##ack +ex +com +If +al +##acher +who +when +##ok +##ther +man +##ers +teacher +con +##ust +get +le +##ag +##ree +room +un +##ate +fa +kn +tr +##wn +Wh +some +##ci +which +pr +##one +did +say +##ough +bec +##ap +pro +fell +##au +He +day +se +##ist +##ven +##ber +##ast +house +tw +##ass +been +qu +##ous +##nder +could +ag +##ought +am +she +wr +##el +##hed +work +Pro +##ment +##fter +such +fellow +ch +en +##ject +##res +what +It +##ol +stud +more +app +tim +##ite +bo +will +##ie +her +loo +##ear +cl +other +may +##lown +##enber +int +##utenber +should +##utenberg +##ck +##are +night +pl +##ice +way +##sel +Clown +##og +##ry +##ort +##ity +##way +time +off +old +##and +##ents +##ash +##ide +##um +##urn +Gutenberg +back +##ade +Project +##ure +than +only +right +##th +##ving +their +##ink +going +##ose +##ance +But +bl +co +thought +prin +students +br +##ach +##ated +You +gr +##here +head +##ally +Ki +On +res +##able +##ary +asked +two +##pl +##ence +after +don +how +make +us +##pt +##other +know +##self +Kiyo +ac +##ub +po +di +##ved +Then +This +mat +might +##ick +##cip +princip +ad +come +##if +start +No +down +made +part +three +##omet +##alk +your +principal +even +##uch +##oun +##ans +bet +ar +dis +fo +fir +let +over +##te +##itt +What +mo +sw +somet +##ory +want +##led +think +##ign +pre +##ull +face +much +##ered +told +str +into +ret +wat +##ling +##thing +then +##ark +seem +When +fl +##ise +dec +has +tm +take +beg +That +##ause +appear +##ount +In +Tok +hot +our +own +##ied +##ge +##ings +again +##ress +something +Tokyo +came +good +##ace +##reat +rem +##aking +far +##ty +call +##ition +inc +##ner +##ger +##ather +town +##ady +first +long +sm +tell +went +##ab +##fore +They +better +away +just +##ile +##pect +##orm +sure +##eep +kind +##our +##ath +before +##pped +##quash +looked +ever +now +under +##iz +##ever +heard +board +And +Hub +here +##od +##row +##bard +##erm +too +being +wrong +Squash +well +where +yen +##ily +##not +##sw +##ase +without +hand +answ +many +because +Hubbard +cop +same +##ious +once +return +As +So +##ery +There +matter +pers +sc +talk +##eet +##ward +##ince +##ord +##ank +##ction +place +letter +ho +lau +op +ra +##co +##ft +##ited +##ook +myself +temp +days +look +aff +ser +##ced +##ep +##xt +##ised +show +anything +##ried +cons +saying +des +sat +##oy +##less +##ared +##llow +##idd +having +Kog +set +##cess +##ted +##ron +##ves +##ating +ins +never +while +##ange +##oss +class +every +imp +sl +very +##ip +##ting +##air +new +##rib +left +##aper +##elt +follow +seemed +Koga +Mr +dang +must +pe +sim +##ies +##tain +##ump +thr +teachers +add +person +bad +ind +##aid +##ave +##per +##ened +bel +##lect +##age +watch +We +sen +##ix +##ng +##ful +these +those +##alf +trans +Mad +count +dist +found +felt +sal +wom +##ock +##so +##ying +ref +reg +##ations +comp +became +works +started +Bad +che +half +midd +##az +##na +##ined +took +##cept +soon +upon +##ult +quite +through +salary +St +care +gl +give +hard +mind +nat +pass +paper +vo +##end +##ue +##bod +##ons +##ott +its +nothing +##urp +saw +cannot +began +Badger +##body +She +To +elect +gu +keep +red +tra +##act +##ning +##ont +##arly +##ither +still +next +hour +comm +##oney +prov +##ribut +ge +got +lo +round +san +turn +##lic +##aw +##eed +##ys +##onna +##ason +supp +fellows +called +boarding +copy +Madonna +middle +Well +cr +cle +full +money +ob +per +put +ple +sle +year +##ik +##em +##fer +##ishing +##oth +hel +heart +read +##ura +##ical +agree +diff +appeared +underst +consid +##ronic +woman +electronic +geish +How +eas +fight +find +home +##onder +##ept +meet +resign +answered +country +Say +Yes +ed +eff +fee +feet +ll +##les +##ouble +things +##ished +##iter +stra +##ired +mean +##ention +form +reason +##osition +##ople +While +brother +acc +##erms +Ar +bed +dra +fool +pay +since +##get +##ense +##iss +stay +story +rep +front +One +##ressed +##cond +voice +help +After +Is +My +ap +bu +end +hon +litt +mon +mar +making +terms +##opp +##ire +##ness +##ew +##fe +##TE +##gg +thing +##ided +##amed +##rap +does +spr +become +second +ent +dire +##itten +decl +##ably +dango +people +little +Found +ey +line +lady +six +tak +wonder +##igh +##ple +##iting +##ently +why +requ +atte +##ung +written +affair +straight +Foundation +Jap +Not diff --git a/TTS/Kokoro/.venv/Lib/site-packages/spacy_curated_transformers/tests/util.py b/TTS/Kokoro/.venv/Lib/site-packages/spacy_curated_transformers/tests/util.py new file mode 100644 index 0000000000000000000000000000000000000000..b98b64dc3577edf0f79daa5f581e5c3ad4cf98bf --- /dev/null +++ b/TTS/Kokoro/.venv/Lib/site-packages/spacy_curated_transformers/tests/util.py @@ -0,0 +1,38 @@ +import contextlib +import shutil +import tempfile +from pathlib import Path + +import torch +from thinc.api import NumpyOps + + +@contextlib.contextmanager +def make_tempdir(): + d = Path(tempfile.mkdtemp()) + yield d + shutil.rmtree(str(d)) + + +# Wrapper around torch.testing.assert_close with custom tolerances. +def torch_assertclose( + a: torch.Tensor, b: torch.Tensor, *, atol: float = 1e-05, rtol: float = 1e-05 +): + torch.testing.assert_close( + a, + b, + atol=atol, + rtol=rtol, + ) + + +def xp_assert_array_equal(a, b): + # Always convert to CPU since Cupy will strangely complain + # about requiring a Numpy conversion before calling assert_array_close. + if not isinstance(a, list): + a = [a] + if not isinstance(b, list): + b = [b] + ops = NumpyOps() + for x, y in zip(a, b): + ops.xp.testing.assert_array_equal(ops.asarray(x), ops.asarray(y)) diff --git a/TTS/Kokoro/.venv/Lib/site-packages/spacy_curated_transformers/tokenization/__init__.py b/TTS/Kokoro/.venv/Lib/site-packages/spacy_curated_transformers/tokenization/__init__.py new file mode 100644 index 0000000000000000000000000000000000000000..71b39fd6e5fc97a2f2cd7ff03f69baf8b04638cd --- /dev/null +++ b/TTS/Kokoro/.venv/Lib/site-packages/spacy_curated_transformers/tokenization/__init__.py @@ -0,0 +1,14 @@ +from .bbpe_encoder import build_byte_bpe_encoder_loader_v1, build_byte_bpe_encoder_v1 +from .char_encoder import build_char_encoder_loader_v1, build_char_encoder_v1 +from .hf_loader import build_hf_piece_encoder_loader_v1 +from .sentencepiece_encoder import ( + build_camembert_sentencepiece_encoder_v1, + build_sentencepiece_encoder_loader_v1, + build_sentencepiece_encoder_v1, + build_xlmr_sentencepiece_encoder_v1, +) +from .wordpiece_encoder import ( + build_bert_wordpiece_encoder_v1, + build_wordpiece_encoder_loader_v1, + build_wordpiece_encoder_v1, +) diff --git a/TTS/Kokoro/.venv/Lib/site-packages/spacy_curated_transformers/tokenization/__pycache__/__init__.cpython-312.pyc b/TTS/Kokoro/.venv/Lib/site-packages/spacy_curated_transformers/tokenization/__pycache__/__init__.cpython-312.pyc new file mode 100644 index 0000000000000000000000000000000000000000..3b104ebd3641fc492f07fe2306f26067ec713642 Binary files /dev/null and b/TTS/Kokoro/.venv/Lib/site-packages/spacy_curated_transformers/tokenization/__pycache__/__init__.cpython-312.pyc differ diff --git a/TTS/Kokoro/.venv/Lib/site-packages/spacy_curated_transformers/tokenization/__pycache__/bbpe_encoder.cpython-312.pyc b/TTS/Kokoro/.venv/Lib/site-packages/spacy_curated_transformers/tokenization/__pycache__/bbpe_encoder.cpython-312.pyc new file mode 100644 index 0000000000000000000000000000000000000000..a6b92fe98bac2af955e1a20ae4d7903690152d2f Binary files /dev/null and b/TTS/Kokoro/.venv/Lib/site-packages/spacy_curated_transformers/tokenization/__pycache__/bbpe_encoder.cpython-312.pyc differ diff --git a/TTS/Kokoro/.venv/Lib/site-packages/spacy_curated_transformers/tokenization/__pycache__/char_encoder.cpython-312.pyc b/TTS/Kokoro/.venv/Lib/site-packages/spacy_curated_transformers/tokenization/__pycache__/char_encoder.cpython-312.pyc new file mode 100644 index 0000000000000000000000000000000000000000..e325e7c8133aa0f9664c05b3813dea524c7a98f6 Binary files /dev/null and b/TTS/Kokoro/.venv/Lib/site-packages/spacy_curated_transformers/tokenization/__pycache__/char_encoder.cpython-312.pyc differ diff --git a/TTS/Kokoro/.venv/Lib/site-packages/spacy_curated_transformers/tokenization/__pycache__/hf_loader.cpython-312.pyc b/TTS/Kokoro/.venv/Lib/site-packages/spacy_curated_transformers/tokenization/__pycache__/hf_loader.cpython-312.pyc new file mode 100644 index 0000000000000000000000000000000000000000..3253c3e6b3bcb4db193fd67e893207f499528dba Binary files /dev/null and b/TTS/Kokoro/.venv/Lib/site-packages/spacy_curated_transformers/tokenization/__pycache__/hf_loader.cpython-312.pyc differ diff --git a/TTS/Kokoro/.venv/Lib/site-packages/spacy_curated_transformers/tokenization/__pycache__/sentencepiece_adapters.cpython-312.pyc b/TTS/Kokoro/.venv/Lib/site-packages/spacy_curated_transformers/tokenization/__pycache__/sentencepiece_adapters.cpython-312.pyc new file mode 100644 index 0000000000000000000000000000000000000000..05a1d59f37b1993bbdd15bd88153bf05b7fc5632 Binary files /dev/null and b/TTS/Kokoro/.venv/Lib/site-packages/spacy_curated_transformers/tokenization/__pycache__/sentencepiece_adapters.cpython-312.pyc differ diff --git a/TTS/Kokoro/.venv/Lib/site-packages/spacy_curated_transformers/tokenization/__pycache__/sentencepiece_encoder.cpython-312.pyc b/TTS/Kokoro/.venv/Lib/site-packages/spacy_curated_transformers/tokenization/__pycache__/sentencepiece_encoder.cpython-312.pyc new file mode 100644 index 0000000000000000000000000000000000000000..53bb09fa4615c5a033cd1bf8457f919f11f5c51f Binary files /dev/null and b/TTS/Kokoro/.venv/Lib/site-packages/spacy_curated_transformers/tokenization/__pycache__/sentencepiece_encoder.cpython-312.pyc differ diff --git a/TTS/Kokoro/.venv/Lib/site-packages/spacy_curated_transformers/tokenization/__pycache__/types.cpython-312.pyc b/TTS/Kokoro/.venv/Lib/site-packages/spacy_curated_transformers/tokenization/__pycache__/types.cpython-312.pyc new file mode 100644 index 0000000000000000000000000000000000000000..e47e817684ca21e4cb68e39ec8fe59d28f026859 Binary files /dev/null and b/TTS/Kokoro/.venv/Lib/site-packages/spacy_curated_transformers/tokenization/__pycache__/types.cpython-312.pyc differ diff --git a/TTS/Kokoro/.venv/Lib/site-packages/spacy_curated_transformers/tokenization/__pycache__/wordpiece_encoder.cpython-312.pyc b/TTS/Kokoro/.venv/Lib/site-packages/spacy_curated_transformers/tokenization/__pycache__/wordpiece_encoder.cpython-312.pyc new file mode 100644 index 0000000000000000000000000000000000000000..9091523ced63b4713981a71344debe836c6a9651 Binary files /dev/null and b/TTS/Kokoro/.venv/Lib/site-packages/spacy_curated_transformers/tokenization/__pycache__/wordpiece_encoder.cpython-312.pyc differ diff --git a/TTS/Kokoro/.venv/Lib/site-packages/spacy_curated_transformers/tokenization/bbpe_encoder.py b/TTS/Kokoro/.venv/Lib/site-packages/spacy_curated_transformers/tokenization/bbpe_encoder.py new file mode 100644 index 0000000000000000000000000000000000000000..b6ed43f7a8d3cc33f018048f20d3780890359292 --- /dev/null +++ b/TTS/Kokoro/.venv/Lib/site-packages/spacy_curated_transformers/tokenization/bbpe_encoder.py @@ -0,0 +1,124 @@ +from pathlib import Path +from typing import Callable, Optional, Tuple + +import srsly +from curated_tokenizers import ByteBPEProcessor +from thinc.api import Model, Ragged, deserialize_attr, serialize_attr + +from .types import Tok2PiecesBackpropT, Tok2PiecesInT, Tok2PiecesModelT, Tok2PiecesOutT + + +@serialize_attr.register(ByteBPEProcessor) +def serialize_byte_bpe_processor(_, value: ByteBPEProcessor, name: str, model) -> bytes: + data = {"merges": value.merges, "vocab": value.vocab} + return srsly.msgpack_dumps(data) + + +@deserialize_attr.register(ByteBPEProcessor) +def deserialize_byte_bpe_processor( + _, value: bytes, name: str, model +) -> ByteBPEProcessor: + data = srsly.msgpack_loads(value) + return ByteBPEProcessor(data["vocab"], data["merges"]) + + +def build_byte_bpe_encoder_v1() -> Tok2PiecesModelT: + """Construct a Byte-BPE piece encoder model that accepts a list + of token sequences or documents and returns a corresponding list + of piece identifiers. + + This model must be separately initialized using an appropriate + loader. + """ + return Model( + "byte_bpe_encoder", + forward=byte_bpe_encoder_forward, + attrs={ + "byte_bpe_processor": ByteBPEProcessor({}, []), + "unk_piece": "", + "bos_piece": "", + "eos_piece": "", + }, + ) + + +def byte_bpe_encoder_forward( + model: Model, X: Tok2PiecesInT, is_train: bool +) -> Tuple[Tok2PiecesOutT, Tok2PiecesBackpropT]: + bbp: ByteBPEProcessor = model.attrs["byte_bpe_processor"] + bos_piece: str = model.attrs["bos_piece"] + eos_piece: str = model.attrs["eos_piece"] + unk_piece: str = model.attrs["unk_piece"] + bos_id = bbp.piece_id(bos_piece) + if bos_id is None: + raise ValueError( + "Byte-BPE piece encoder vocabulary doesn't contain 'BOS' piece" + ) + eos_id = bbp.piece_id(eos_piece) + if eos_id is None: + raise ValueError( + "Byte-BPE piece encoder vocabulary doesn't contain 'EOS' piece" + ) + unk_id = bbp.piece_id(unk_piece) + if unk_id is None: + raise ValueError( + "Byte-BPE piece encoder vocabulary doesn't contain 'UNK' piece" + ) + + pieces = [] + for doc in X: + # TODO: check whether as single bos/eos per doc is what we want. + # The issue is that we probably do not have sentence + # boundaries yet, since they are predicted by a pipe. + doc_pieces = [bos_id] + lens = [1] + + for idx, token in enumerate(doc): + if token.is_space: + piece_ids = [] + else: + # GPT-2/RoBERTa tokenization preserves preceding space character. + if idx > 0: + text = doc[idx - 1].whitespace_ + token.text + else: + text = token.text + + piece_ids = bbp.encode_as_ids(text) + + doc_pieces.extend(piece_ids) + lens.append(len(piece_ids)) + + doc_pieces.append(eos_id) + lens.append(1) + pieces.append( + Ragged( + model.ops.asarray1i(doc_pieces), + model.ops.asarray1i(lens), + ) + ) + + return pieces, lambda dY: [] + + +def build_byte_bpe_encoder_loader_v1( + *, vocab_path: Path, merges_path: Path +) -> Callable[ + [Tok2PiecesModelT, Optional[Tok2PiecesInT], Optional[Tok2PiecesInT]], + Tok2PiecesModelT, +]: + """Construct a callback that initializes a Byte-BPE piece encoder + model. + + vocab_path (Path): + Path to the vocabulary file. + merges_path (Path): + Path to the merges file. + """ + + def load(model, X=None, Y=None): + model.attrs["byte_bpe_processor"] = ByteBPEProcessor.load_from_files( + vocab=vocab_path, merges=merges_path + ) + return model + + return load diff --git a/TTS/Kokoro/.venv/Lib/site-packages/spacy_curated_transformers/tokenization/char_encoder.py b/TTS/Kokoro/.venv/Lib/site-packages/spacy_curated_transformers/tokenization/char_encoder.py new file mode 100644 index 0000000000000000000000000000000000000000..9b0bf082423dce5efd271c32d5a1352569fb1d61 --- /dev/null +++ b/TTS/Kokoro/.venv/Lib/site-packages/spacy_curated_transformers/tokenization/char_encoder.py @@ -0,0 +1,128 @@ +import unicodedata +from pathlib import Path +from typing import Callable, Dict, Optional, OrderedDict, Tuple + +from thinc.api import Model, Ragged + +from .types import Tok2PiecesBackpropT, Tok2PiecesInT, Tok2PiecesModelT, Tok2PiecesOutT + + +def build_char_encoder_v1() -> Tok2PiecesModelT: + """Construct a character piece encoder model that accepts a list + of token sequences or documents and returns a corresponding list + of piece identifiers. + + This model must be separately initialized using an appropriate + loader. + + normalize (str): + Unicode normalization to apply before encoding a token. Defaults to + "NFKC". + """ + return Model( + "char_encoder", + forward=char_encoder_forward, + attrs={ + "bos_piece": "[CLS]", + "eos_piece": "[SEP]", + "unk_piece": "[UNK]", + "normalize": "NFKC", + "vocab": None, + }, + ) + + +def char_encoder_forward( + model: Model, X: Tok2PiecesInT, is_train: bool +) -> Tuple[Tok2PiecesOutT, Tok2PiecesBackpropT]: + """Construct a character piece encoder model that accepts a list + of token sequences or documents and returns a corresponding list + of piece identifiers. + + This model must be separately initialized using an appropriate + loader. + """ + vocab: Optional[Dict[str, int]] = model.attrs["vocab"] + if vocab is None: + raise ValueError( + "Character piece encoder vocabulary is not available. Use a loader " + "to initialize the encoder." + ) + + bos_piece: str = model.attrs["bos_piece"] + eos_piece: str = model.attrs["eos_piece"] + unk_piece: str = model.attrs["unk_piece"] + normalize: Optional[str] = model.attrs["normalize"] + bos_id = vocab[bos_piece] + eos_id = vocab[eos_piece] + unk_id = vocab[unk_piece] + + pieces = [] + for doc in X: + doc_pieces = [bos_id] + lens = [1] + + for token in doc: + text = ( + unicodedata.normalize(normalize, token.text) + if normalize is not None + else token.text + ) + # Most encoders will mark a full token as unknown. The character + # encoder behaves differently, only replacing unknown characters + # by the unk id. + piece_ids = [vocab.get(char, unk_id) for char in text] + doc_pieces.extend(piece_ids) + lens.append(len(piece_ids)) + + doc_pieces.append(eos_id) + lens.append(1) + pieces.append( + Ragged(model.ops.asarray1i(doc_pieces), model.ops.asarray1i(lens)) + ) + + return pieces, lambda dY: [] + + +def build_char_encoder_loader_v1( + *, + path: Path, + bos_piece: str = "[CLS]", + eos_piece: str = "[SEP]", + unk_piece: str = "[UNK]", + normalize: Optional[str] = "NFKC", +) -> Callable[ + [Tok2PiecesModelT, Optional[Tok2PiecesInT], Optional[Tok2PiecesInT]], + Tok2PiecesModelT, +]: + """Construct a callback that initializes a character piece encoder + model. + + path (Path): + Path to the serialized character model. + """ + + def load(model, X=None, Y=None): + if model.name != "char_encoder": + raise ValueError( + "Attempting to use the `CharEncoderLoader` piece encoder loader with an " + f"incompatible model ('{model.name}'). It can only be used with the " + "`CharEncoder` piece encoder" + ) + + model.attrs["bos_piece"] = bos_piece + model.attrs["eos_piece"] = eos_piece + model.attrs["unk_piece"] = unk_piece + model.attrs["normalize"] = normalize + + vocab = OrderedDict() + with open(path, encoding="utf-8") as f: + for char in f: + char = char.rstrip("\r\n") + if normalize is not None: + char = unicodedata.normalize(normalize, char) + vocab[char] = len(vocab) + model.attrs["vocab"] = vocab + return model + + return load diff --git a/TTS/Kokoro/.venv/Lib/site-packages/spacy_curated_transformers/tokenization/hf_loader.py b/TTS/Kokoro/.venv/Lib/site-packages/spacy_curated_transformers/tokenization/hf_loader.py new file mode 100644 index 0000000000000000000000000000000000000000..ad9a520c31185ae908227f7f4f44782ad694b0a4 --- /dev/null +++ b/TTS/Kokoro/.venv/Lib/site-packages/spacy_curated_transformers/tokenization/hf_loader.py @@ -0,0 +1,160 @@ +import json +from typing import Callable, Optional + +from .._compat import has_hf_transformers, transformers +from .bbpe_encoder import ByteBPEProcessor +from .sentencepiece_encoder import SentencePieceProcessor +from .types import Tok2PiecesInT, Tok2PiecesModelT +from .wordpiece_encoder import WordPieceProcessor + +if has_hf_transformers: + SUPPORTED_TOKENIZERS = ( + transformers.BertTokenizerFast, + transformers.RobertaTokenizerFast, + transformers.XLMRobertaTokenizerFast, + transformers.CamembertTokenizerFast, + transformers.BertJapaneseTokenizer, + ) +else: + SUPPORTED_TOKENIZERS = () # type: ignore + + +class _HFPieceEncoderLoader: + """This was formerly an inline function. However, only proper objects + can be pickled.""" + + def __init__(self, *, name: str, revision: str): + self.name = name + self.revision = revision + + def __call__(self, model, X=None, Y=None): + if not has_hf_transformers: + raise ValueError( + "`HFPieceEncoderLoader` requires the Hugging Face `transformers` package to be installed" + ) + + tokenizer = transformers.AutoTokenizer.from_pretrained( + self.name, revision=self.revision + ) + return _convert_encoder(model, tokenizer) + + +def build_hf_piece_encoder_loader_v1(*, name: str, revision: str = "main") -> Callable[ + [Tok2PiecesModelT, Optional[Tok2PiecesInT], Optional[Tok2PiecesInT]], + Tok2PiecesModelT, +]: + """Construct a callback that initializes a HuggingFace piece encoder + model. Used in conjunction with the HuggingFace model loader. + + name (str): + Name of the HuggingFace model. + revision (str): + Name of the model revision/branch. + """ + return _HFPieceEncoderLoader(name=name, revision=revision) + + +def _convert_encoder( + model: Tok2PiecesModelT, tokenizer: "transformers.PreTrainedTokenizerBase" +) -> Tok2PiecesModelT: + if isinstance(tokenizer, transformers.BertTokenizerFast): + return _convert_wordpiece_encoder(model, tokenizer) + elif isinstance(tokenizer, transformers.RobertaTokenizerFast): + return _convert_byte_bpe_encoder(model, tokenizer) + elif isinstance( + tokenizer, + (transformers.XLMRobertaTokenizerFast, transformers.CamembertTokenizerFast), + ): + return _convert_sentencepiece_encoder(model, tokenizer) # type: ignore + elif isinstance(tokenizer, transformers.BertJapaneseTokenizer): + return _convert_bert_japanese_encoder(model, tokenizer) + else: + raise ValueError( + "Attempting to load an unsupported Hugging Face tokenizer " + f"({type(tokenizer)}). Currently supported tokenizers: {SUPPORTED_TOKENIZERS}" + ) + + +def _convert_byte_bpe_encoder( + model: Tok2PiecesModelT, + tokenizer: "transformers.RobertaTokenizerFast", +) -> Tok2PiecesModelT: + # Seems like we cannot get the vocab file name for a RoBERTa vocabulary? And + # neither the merges from the fast tokenizer. So we'll get them from the + # JSON serialization. + serialized = tokenizer.backend_tokenizer.to_str(True) # type: ignore + deserialized = json.loads(serialized) + vocab_merges = deserialized["model"] + merges = [tuple(merge.split(" ")) for merge in vocab_merges["merges"]] + model.attrs["byte_bpe_processor"] = ByteBPEProcessor(vocab_merges["vocab"], merges) + model.attrs["bos_piece"] = tokenizer.bos_token # type: ignore + model.attrs["eos_piece"] = tokenizer.eos_token # type: ignore + model.attrs["unk_piece"] = tokenizer.unk_token # type: ignore + + return model + + +def _convert_sentencepiece_encoder( + model: Tok2PiecesModelT, + tokenizer: "transformers.RobertaTokenizerFast", +) -> Tok2PiecesModelT: + model.get_ref("encoder").attrs[ + "sentencepiece_processor" + ] = SentencePieceProcessor.from_file( + tokenizer.vocab_file # type: ignore + ) + return model + + +def _convert_wordpiece_encoder( + model: Tok2PiecesModelT, tokenizer: "transformers.BertTokenizerFast" +) -> Tok2PiecesModelT: + # Seems like we cannot get the vocab file name for a BERT vocabulary? So, + # instead, copy the vocabulary. + vocab = [None] * tokenizer.vocab_size # type: ignore + for piece, idx in tokenizer.vocab.items(): # type: ignore + vocab[idx] = piece + + strip_accents = tokenizer.backend_tokenizer.normalizer.strip_accents # type: ignore + lowercase = tokenizer.do_lower_case # type: ignore + model.attrs["wordpiece_processor"] = WordPieceProcessor(vocab) + model.attrs["bos_piece"] = tokenizer.cls_token # type: ignore + model.attrs["eos_piece"] = tokenizer.sep_token # type: ignore + model.attrs["unk_piece"] = tokenizer.unk_token # type: ignore + model.attrs["lowercase"] = lowercase + + # Huggingface BERT also strips accents when lowercasing is enabled + # and accent stripping is not defined. + model.attrs["strip_accents"] = strip_accents or ( + strip_accents is not False and lowercase + ) + + return model + + +def _convert_bert_japanese_encoder( + model: Tok2PiecesModelT, tokenizer: "transformers.BertJapaneseTokenizer" +) -> Tok2PiecesModelT: + if not isinstance( + tokenizer.subword_tokenizer, + transformers.models.bert_japanese.CharacterTokenizer, + ): + raise ValueError( + "Japanese BERT models currently only support character subword encoding" + ) + if model.name != "char_encoder": + raise ValueError( + f"Attempting to initialize an incompatible piece encoder ('{model.name}') " + "with the Hugging Face Japanese BERT tokenizer. It can only be used with the " + "`CharEncoder` piece encoder" + ) + + model.attrs["bos_piece"] = tokenizer.cls_token + model.attrs["eos_piece"] = tokenizer.sep_token + model.attrs["unk_piece"] = tokenizer.unk_token + model.attrs["normalize"] = ( + "NFKC" if tokenizer.subword_tokenizer.normalize_text else None + ) + model.attrs["vocab"] = tokenizer.vocab.copy() + + return model diff --git a/TTS/Kokoro/.venv/Lib/site-packages/spacy_curated_transformers/tokenization/sentencepiece_adapters.py b/TTS/Kokoro/.venv/Lib/site-packages/spacy_curated_transformers/tokenization/sentencepiece_adapters.py new file mode 100644 index 0000000000000000000000000000000000000000..6ca8216ffef798121ff9ce7f6ecfb47756a069e3 --- /dev/null +++ b/TTS/Kokoro/.venv/Lib/site-packages/spacy_curated_transformers/tokenization/sentencepiece_adapters.py @@ -0,0 +1,95 @@ +from functools import lru_cache +from typing import Tuple + +from thinc.api import Model, Ragged + +from .types import PieceAdapterBackpropT, PieceAdapterInOutT, PieceAdapterModelT + +_FAIRSEQ_OFFSET = 1 +_CAMEMBERT_FAIRSEQ_OFFSET = 4 +_FAIRSEQ_BOS = 0 +_FAIRSEQ_EOS = 2 +_FAIRSEQ_UNK = 3 + +_SPP_BOS = 1 +_SPP_EOS = 2 +_SPP_UNK = 0 + + +def _update_to_fairseq(piece_id: int): + if piece_id == _SPP_UNK: + return _FAIRSEQ_UNK + elif piece_id == _SPP_BOS: + return _FAIRSEQ_BOS + elif piece_id == _SPP_EOS: + return _FAIRSEQ_EOS + else: + return piece_id + _FAIRSEQ_OFFSET + + +@lru_cache(maxsize=128) +def _update_to_fairseq_vectorized(xp): + return xp.vectorize(_update_to_fairseq) + + +def build_xlmr_adapter() -> PieceAdapterModelT: + """Align the original fairseq vocab used by pre-trained HF transformer + models with the sentencepiece vocabulary.""" + + return Model( + "xlmr_adapter", + forward=xlmr_adapter_forward, + ) + + +def xlmr_adapter_forward( + model: Model, X: PieceAdapterInOutT, is_train: bool +) -> Tuple[PieceAdapterInOutT, PieceAdapterBackpropT]: + update_to_fairseq = _update_to_fairseq_vectorized(model.ops.xp) + X_xlmr = [] + for tokens_pieces in X: + X_xlmr.append( + Ragged( + data=update_to_fairseq(tokens_pieces.dataXd), + lengths=tokens_pieces.lengths, + ) + ) + + return X_xlmr, lambda dY: [] + + +def _camembert_update_to_fairseq(piece_id: int) -> int: + if piece_id == _SPP_UNK: + return _FAIRSEQ_UNK + else: + return piece_id + _CAMEMBERT_FAIRSEQ_OFFSET + + +@lru_cache(maxsize=128) +def _camembert_update_to_fairseq_vectorized(xp): + return xp.vectorize(_camembert_update_to_fairseq) + + +def build_camembert_adapter() -> PieceAdapterModelT: + """Align the original fairseq vocab used by pre-trained Camembert + HF transformer model with the sentencepiece vocabulary.""" + return Model( + "camembert_adapter", + forward=camembert_adapter_forward, + ) + + +def camembert_adapter_forward( + model: Model, X: PieceAdapterInOutT, is_train: bool +) -> Tuple[PieceAdapterInOutT, PieceAdapterBackpropT]: + update_to_fairseq = _camembert_update_to_fairseq_vectorized(model.ops.xp) + X_xlmr = [] + for tokens_pieces in X: + X_xlmr.append( + Ragged( + data=update_to_fairseq(tokens_pieces.dataXd), + lengths=tokens_pieces.lengths, + ) + ) + + return X_xlmr, lambda dY: [] diff --git a/TTS/Kokoro/.venv/Lib/site-packages/spacy_curated_transformers/tokenization/sentencepiece_encoder.py b/TTS/Kokoro/.venv/Lib/site-packages/spacy_curated_transformers/tokenization/sentencepiece_encoder.py new file mode 100644 index 0000000000000000000000000000000000000000..f26dbf5b74d91253d08fa5cf21ac3b365c65fc92 --- /dev/null +++ b/TTS/Kokoro/.venv/Lib/site-packages/spacy_curated_transformers/tokenization/sentencepiece_encoder.py @@ -0,0 +1,123 @@ +from pathlib import Path +from typing import Callable, Optional, Tuple + +from curated_tokenizers import SentencePieceProcessor +from thinc.api import Model, Ragged, chain, deserialize_attr, serialize_attr + +from .sentencepiece_adapters import build_camembert_adapter, build_xlmr_adapter +from .types import Tok2PiecesBackpropT, Tok2PiecesInT, Tok2PiecesModelT, Tok2PiecesOutT + + +@serialize_attr.register(SentencePieceProcessor) +def serialize_sentencepiece_processor( + _, value: SentencePieceProcessor, name: str, model +) -> bytes: + return value.to_protobuf() + + +@deserialize_attr.register(SentencePieceProcessor) +def deserialize_my_custom_class( + _, value: bytes, name: str, model +) -> SentencePieceProcessor: + return SentencePieceProcessor.from_protobuf(value) + + +def build_camembert_sentencepiece_encoder_v1() -> Tok2PiecesModelT: + """Construct a SentencePiece piece encoder model that accepts a list + of token sequences or documents and returns a corresponding list + of piece identifiers with CamemBERT post-processing applied. + + This model must be separately initialized using an appropriate + loader. + """ + encoder = build_sentencepiece_encoder_v1() + model = chain(encoder, build_camembert_adapter()) + model.set_ref("encoder", encoder) + return model + + +def build_sentencepiece_encoder_v1() -> Tok2PiecesModelT: + """Construct a SentencePiece piece encoder model that accepts a list + of token sequences or documents and returns a corresponding list + of piece identifiers. + + This model must be separately initialized using an appropriate + loader. + """ + model: Tok2PiecesModelT = Model( + "sentencepiece_encoder", + forward=sentencepiece_encoder_forward, + attrs={"sentencepiece_processor": SentencePieceProcessor()}, + ) + model.set_ref("encoder", model) + return model + + +def build_xlmr_sentencepiece_encoder_v1() -> Tok2PiecesModelT: + """Construct a SentencePiece piece encoder model that accepts a list + of token sequences or documents and returns a corresponding list + of piece identifiers with XLM-RoBERTa post-processing applied. + + This model must be separately initialized using an appropriate + loader. + """ + encoder = build_sentencepiece_encoder_v1() + model = chain(encoder, build_xlmr_adapter()) + model.set_ref("encoder", encoder) + return model + + +def sentencepiece_encoder_forward( + model: Model, X: Tok2PiecesInT, is_train: bool +) -> Tuple[Tok2PiecesOutT, Tok2PiecesBackpropT]: + spp: SentencePieceProcessor = model.attrs["sentencepiece_processor"] + + pieces = [] + for doc in X: + # TODO: check whether as single bos/eos per doc is what we want. + # The issue is that we probably do not have sentence + # boundaries yet, since they are predicted by a pipe. + doc_pieces = [spp.bos_id()] + lens = [1] + + for token in doc: + if token.is_space: + # This seems to actually be the default, but we rely on this behaviour + # (empty array returned for whitespace tokens), so we handle it as a + # condition like we do for the other encoders. + piece_ids = [] + else: + piece_ids = spp.encode_as_ids(token.text) + doc_pieces.extend(piece_ids) + lens.append(len(piece_ids)) + + doc_pieces.append(spp.eos_id()) + lens.append(1) + pieces.append( + Ragged( + model.ops.asarray1i(doc_pieces), + model.ops.asarray1i(lens), + ) + ) + + return pieces, lambda dY: [] + + +def build_sentencepiece_encoder_loader_v1(*, path: Path) -> Callable[ + [Tok2PiecesModelT, Optional[Tok2PiecesInT], Optional[Tok2PiecesInT]], + Tok2PiecesModelT, +]: + """Construct a callback that initializes a SentencePiece piece encoder + model. + + path (Path): + Path to the serialized SentencePiece model. + """ + + def load(model, X=None, Y=None): + model.attrs["sentencepiece_processor"] = SentencePieceProcessor.from_file( + str(path) + ) + return model + + return load diff --git a/TTS/Kokoro/.venv/Lib/site-packages/spacy_curated_transformers/tokenization/types.py b/TTS/Kokoro/.venv/Lib/site-packages/spacy_curated_transformers/tokenization/types.py new file mode 100644 index 0000000000000000000000000000000000000000..a0bce221b30ddeacf106b76281d9e6ebfdcfdf94 --- /dev/null +++ b/TTS/Kokoro/.venv/Lib/site-packages/spacy_curated_transformers/tokenization/types.py @@ -0,0 +1,17 @@ +from typing import Any, Callable, List, TypeVar + +from spacy.tokens.doc import Doc +from spacy.tokens.token import Token +from thinc.model import Model +from thinc.types import Ragged + +TokenSequenceT = TypeVar("TokenSequenceT", Doc, List[Token]) + +Tok2PiecesInT = List[TokenSequenceT] +Tok2PiecesOutT = List[Ragged] +Tok2PiecesBackpropT = Callable[[Any], Any] +Tok2PiecesModelT = Model[Tok2PiecesInT, Tok2PiecesOutT] + +PieceAdapterInOutT = List[Ragged] +PieceAdapterBackpropT = Callable[[Any], Any] +PieceAdapterModelT = Model[PieceAdapterInOutT, PieceAdapterInOutT] diff --git a/TTS/Kokoro/.venv/Lib/site-packages/spacy_curated_transformers/tokenization/wordpiece_encoder.py b/TTS/Kokoro/.venv/Lib/site-packages/spacy_curated_transformers/tokenization/wordpiece_encoder.py new file mode 100644 index 0000000000000000000000000000000000000000..903dcd524575c7622dc5b78f06f6b5b0a6c31e71 --- /dev/null +++ b/TTS/Kokoro/.venv/Lib/site-packages/spacy_curated_transformers/tokenization/wordpiece_encoder.py @@ -0,0 +1,192 @@ +import unicodedata +from pathlib import Path +from typing import Callable, List, Optional, Tuple + +from curated_tokenizers import WordPieceProcessor +from thinc.api import Model, Ragged, deserialize_attr, serialize_attr + +from .types import Tok2PiecesBackpropT, Tok2PiecesInT, Tok2PiecesModelT, Tok2PiecesOutT + + +@serialize_attr.register(WordPieceProcessor) +def serialize_sentencepiece_processor( + _, value: WordPieceProcessor, name: str, model +) -> bytes: + return "\n".join(value.to_list()).encode("utf8") + + +@deserialize_attr.register(WordPieceProcessor) +def deserialize_my_custom_class( + _, value: bytes, name: str, model +) -> WordPieceProcessor: + return WordPieceProcessor(value.decode("utf8").split("\n")) + + +def build_bert_wordpiece_encoder_v1() -> Tok2PiecesModelT: + """Construct a WordPiece piece encoder model that accepts a list + of token sequences or documents and returns a corresponding list + of piece identifiers. This encoder also splits each token + on punctuation characters, as expected by most BERT models. + + This model must be separately initialized using an appropriate + loader. + """ + return Model( + "wordpiece_encoder", + forward=wordpiece_encoder_forward, + attrs={ + "wordpiece_processor": WordPieceProcessor([]), + "unk_piece": "[UNK]", + "bos_piece": "[CLS]", + "eos_piece": "[SEP]", + "lowercase": False, + "preprocess": _bert_preprocess, + "strip_accents": False, + }, + ) + + +def build_wordpiece_encoder_v1() -> Tok2PiecesModelT: + """Construct a WordPiece piece encoder model that accepts a list + of token sequences or documents and returns a corresponding list + of piece identifiers. + + This model must be separately initialized using an appropriate + loader. + """ + return Model( + "wordpiece_encoder", + forward=wordpiece_encoder_forward, + attrs={ + "wordpiece_processor": WordPieceProcessor([]), + "unk_piece": "[UNK]", + "bos_piece": "[CLS]", + "eos_piece": "[SEP]", + "lowercase": False, + "preprocess": lambda t: [t], + "strip_accents": False, + }, + ) + + +def wordpiece_encoder_forward( + model: Model, X: Tok2PiecesInT, is_train: bool +) -> Tuple[Tok2PiecesOutT, Tok2PiecesBackpropT]: + wpp: WordPieceProcessor = model.attrs["wordpiece_processor"] + bos_piece: str = model.attrs["bos_piece"] + eos_piece: str = model.attrs["eos_piece"] + unk_piece: str = model.attrs["unk_piece"] + lowercase: bool = model.attrs["lowercase"] + preprocess: Callable[[str], str] = model.attrs["preprocess"] + strip_accents: bool = model.attrs["strip_accents"] + bos_id = wpp.get_initial(bos_piece) + eos_id = wpp.get_initial(eos_piece) + unk_id = wpp.get_initial(unk_piece) + + pieces = [] + for doc in X: + # TODO: check whether as single bos/eos per doc is what we want. + # The issue is that we probably do not have sentence + # boundaries yet, since they are predicted by a pipe. + doc_pieces = [bos_id] + lens = [1] + + for token in doc: + if token.is_space: + piece_ids = [] + else: + text = token.lower_ if lowercase else token.text + if strip_accents: + text = _strip_accents(text) + + piece_ids = [ + unk_id if token_id == -1 else token_id + for t in preprocess(text) + for token_id in wpp.encode(t)[0] + ] + + doc_pieces.extend(piece_ids) + lens.append(len(piece_ids)) + + doc_pieces.append(eos_id) + lens.append(1) + pieces.append( + Ragged( + model.ops.asarray1i(doc_pieces), + model.ops.asarray1i(lens), + ) + ) + + return pieces, lambda dY: [] + + +def build_wordpiece_encoder_loader_v1( + *, + path: Path, + bos_piece="[CLS]", + eos_piece="[SEP]", + unk_piece="[UNK]", + lowercase: bool = False, + strip_accents: bool = False, +) -> Callable[ + [Tok2PiecesModelT, Optional[Tok2PiecesInT], Optional[Tok2PiecesInT]], + Tok2PiecesModelT, +]: + """Construct a callback that initializes a WordPiece piece encoder + model. + + path (Path): + Path to the serialized WordPiece model. + """ + + def load(model, X=None, Y=None): + model.attrs["wordpiece_processor"] = WordPieceProcessor.from_file(str(path)) + model.attrs["bos_piece"] = bos_piece + model.attrs["eos_piece"] = eos_piece + model.attrs["unk_piece"] = unk_piece + model.attrs["lowercase"] = lowercase + model.attrs["strip_accents"] = strip_accents + return model + + return load + + +def _bert_preprocess(token: str) -> List[str]: + """Split a token on punctuation characters. For instance, + 'AWO-Mitarbeiter' is split into ['AWO', '-', 'Mitarbeiter']""" + tokens = [] + in_word = False + while token: + char = token[0] + token = token[1:] + if _is_bert_punctuation(char): + tokens.append([char]) + in_word = False + else: + if in_word: + tokens[-1].append(char) + else: + tokens.append([char]) + in_word = True + return ["".join(t) for t in tokens] + + +def _is_bert_punctuation(char: str) -> bool: + """Checks whether `char` is a punctuation character.""" + # ASCII punctuation from HF tranformers, since we need to split + # in the same way. + cp = ord(char) + if ( + (cp >= 33 and cp <= 47) + or (cp >= 58 and cp <= 64) + or (cp >= 91 and cp <= 96) + or (cp >= 123 and cp <= 126) + ): + return True + + return unicodedata.category(char).startswith("P") + + +def _strip_accents(token: str) -> str: + token = unicodedata.normalize("NFD", token) + return "".join([char for char in token if unicodedata.category(char) != "Mn"]) diff --git a/TTS/Kokoro/.venv/Lib/site-packages/spacy_legacy/__pycache__/__init__.cpython-312.pyc b/TTS/Kokoro/.venv/Lib/site-packages/spacy_legacy/__pycache__/__init__.cpython-312.pyc new file mode 100644 index 0000000000000000000000000000000000000000..6daed19dababeb98ed8c252a5837190883b999d5 Binary files /dev/null and b/TTS/Kokoro/.venv/Lib/site-packages/spacy_legacy/__pycache__/__init__.cpython-312.pyc differ diff --git a/TTS/Kokoro/.venv/Lib/site-packages/spacy_legacy/__pycache__/loggers.cpython-312.pyc b/TTS/Kokoro/.venv/Lib/site-packages/spacy_legacy/__pycache__/loggers.cpython-312.pyc new file mode 100644 index 0000000000000000000000000000000000000000..85e3d78696397214873b402e44ebd636f48218f5 Binary files /dev/null and b/TTS/Kokoro/.venv/Lib/site-packages/spacy_legacy/__pycache__/loggers.cpython-312.pyc differ diff --git a/TTS/Kokoro/.venv/Lib/site-packages/spacy_legacy/__pycache__/scorers.cpython-312.pyc b/TTS/Kokoro/.venv/Lib/site-packages/spacy_legacy/__pycache__/scorers.cpython-312.pyc new file mode 100644 index 0000000000000000000000000000000000000000..7de25a9cc6b1e5bcccd4b25a44036d5db68c33e4 Binary files /dev/null and b/TTS/Kokoro/.venv/Lib/site-packages/spacy_legacy/__pycache__/scorers.cpython-312.pyc differ diff --git a/TTS/Kokoro/.venv/Lib/site-packages/spacy_legacy/architectures/__init__.py b/TTS/Kokoro/.venv/Lib/site-packages/spacy_legacy/architectures/__init__.py new file mode 100644 index 0000000000000000000000000000000000000000..e69de29bb2d1d6434b8b29ae775ad8c2e48c5391 diff --git a/TTS/Kokoro/.venv/Lib/site-packages/spacy_legacy/architectures/__pycache__/__init__.cpython-312.pyc b/TTS/Kokoro/.venv/Lib/site-packages/spacy_legacy/architectures/__pycache__/__init__.cpython-312.pyc new file mode 100644 index 0000000000000000000000000000000000000000..375d0ad55f1fe4f2ec99fee54b55efd82bdf7b02 Binary files /dev/null and b/TTS/Kokoro/.venv/Lib/site-packages/spacy_legacy/architectures/__pycache__/__init__.cpython-312.pyc differ diff --git a/TTS/Kokoro/.venv/Lib/site-packages/spacy_legacy/architectures/__pycache__/entity_linker.cpython-312.pyc b/TTS/Kokoro/.venv/Lib/site-packages/spacy_legacy/architectures/__pycache__/entity_linker.cpython-312.pyc new file mode 100644 index 0000000000000000000000000000000000000000..9e21c8cbd2af27517ef91a45576bced01ac03121 Binary files /dev/null and b/TTS/Kokoro/.venv/Lib/site-packages/spacy_legacy/architectures/__pycache__/entity_linker.cpython-312.pyc differ diff --git a/TTS/Kokoro/.venv/Lib/site-packages/spacy_legacy/architectures/__pycache__/parser.cpython-312.pyc b/TTS/Kokoro/.venv/Lib/site-packages/spacy_legacy/architectures/__pycache__/parser.cpython-312.pyc new file mode 100644 index 0000000000000000000000000000000000000000..5eb1b5c435be6c88b1572f5d64711870c79c0cd8 Binary files /dev/null and b/TTS/Kokoro/.venv/Lib/site-packages/spacy_legacy/architectures/__pycache__/parser.cpython-312.pyc differ diff --git a/TTS/Kokoro/.venv/Lib/site-packages/spacy_legacy/architectures/__pycache__/tagger.cpython-312.pyc b/TTS/Kokoro/.venv/Lib/site-packages/spacy_legacy/architectures/__pycache__/tagger.cpython-312.pyc new file mode 100644 index 0000000000000000000000000000000000000000..18c761a68c088a5b41ea9489d7164760db10be95 Binary files /dev/null and b/TTS/Kokoro/.venv/Lib/site-packages/spacy_legacy/architectures/__pycache__/tagger.cpython-312.pyc differ diff --git a/TTS/Kokoro/.venv/Lib/site-packages/spacy_legacy/architectures/__pycache__/textcat.cpython-312.pyc b/TTS/Kokoro/.venv/Lib/site-packages/spacy_legacy/architectures/__pycache__/textcat.cpython-312.pyc new file mode 100644 index 0000000000000000000000000000000000000000..ec4b0581770285cc3d09181aa2f23e248e2d47ca Binary files /dev/null and b/TTS/Kokoro/.venv/Lib/site-packages/spacy_legacy/architectures/__pycache__/textcat.cpython-312.pyc differ diff --git a/TTS/Kokoro/.venv/Lib/site-packages/spacy_legacy/architectures/__pycache__/tok2vec.cpython-312.pyc b/TTS/Kokoro/.venv/Lib/site-packages/spacy_legacy/architectures/__pycache__/tok2vec.cpython-312.pyc new file mode 100644 index 0000000000000000000000000000000000000000..5980f7f4a141a8fe348581de5c3afa6c5e280a89 Binary files /dev/null and b/TTS/Kokoro/.venv/Lib/site-packages/spacy_legacy/architectures/__pycache__/tok2vec.cpython-312.pyc differ diff --git a/TTS/Kokoro/.venv/Lib/site-packages/spacy_legacy/architectures/entity_linker.py b/TTS/Kokoro/.venv/Lib/site-packages/spacy_legacy/architectures/entity_linker.py new file mode 100644 index 0000000000000000000000000000000000000000..de1de1b73335ea481348efa88ec6fa1ba08ac8b6 --- /dev/null +++ b/TTS/Kokoro/.venv/Lib/site-packages/spacy_legacy/architectures/entity_linker.py @@ -0,0 +1,34 @@ +from typing import Optional, List +from thinc.types import Floats2d +from thinc.api import Model + +from spacy.util import registry +from spacy.tokens import Doc + + +def EntityLinker_v1( + tok2vec: Model, nO: Optional[int] = None +) -> Model[List[Doc], Floats2d]: + chain = registry.get("layers", "chain.v1") + clone = registry.get("layers", "clone.v1") + with Model.define_operators({">>": chain, "**": clone}): + token_width = tok2vec.maybe_get_dim("nO") + + Linear = registry.get("layers", "Linear.v1") + output_layer = Linear(nO=nO, nI=token_width) + + list2ragged = registry.get("layers", "list2ragged.v1") + reduce_mean = registry.get("layers", "reduce_mean.v1") + residual = registry.get("layers", "residual.v1") + Maxout = registry.get("layers", "Maxout.v1") + + model = ( + tok2vec + >> list2ragged() + >> reduce_mean() + >> residual(Maxout(nO=token_width, nI=token_width, nP=2, dropout=0.0)) # type: ignore[arg-type] + >> output_layer + ) + model.set_ref("output_layer", output_layer) + model.set_ref("tok2vec", tok2vec) + return model diff --git a/TTS/Kokoro/.venv/Lib/site-packages/spacy_legacy/architectures/parser.py b/TTS/Kokoro/.venv/Lib/site-packages/spacy_legacy/architectures/parser.py new file mode 100644 index 0000000000000000000000000000000000000000..0506b4d29cd0330612c44be3a8cd8b9852680b62 --- /dev/null +++ b/TTS/Kokoro/.venv/Lib/site-packages/spacy_legacy/architectures/parser.py @@ -0,0 +1,90 @@ +from typing import Optional, List +from thinc.types import Floats2d +from thinc.api import Model, zero_init, use_ops + +from spacy.tokens import Doc +from spacy.compat import Literal +from spacy.errors import Errors +from spacy.util import registry + + +def TransitionBasedParser_v1( + tok2vec: Model[List[Doc], List[Floats2d]], + state_type: Literal["parser", "ner"], + extra_state_tokens: bool, + hidden_width: int, + maxout_pieces: int, + use_upper: bool = True, + nO: Optional[int] = None, +) -> Model: + + chain = registry.get("layers", "chain.v1") + list2array = registry.get("layers", "list2array.v1") + Linear = registry.get("layers", "Linear.v1") + TransitionModel = registry.get("layers", "spacy.TransitionModel.v1") + PrecomputableAffine = registry.get("layers", "spacy.PrecomputableAffine.v1") + + if state_type == "parser": + nr_feature_tokens = 13 if extra_state_tokens else 8 + elif state_type == "ner": + nr_feature_tokens = 6 if extra_state_tokens else 3 + else: + raise ValueError(Errors.E917.format(value=state_type)) + t2v_width = tok2vec.get_dim("nO") if tok2vec.has_dim("nO") else None + tok2vec = chain(tok2vec, list2array(), Linear(hidden_width, t2v_width)) + tok2vec.set_dim("nO", hidden_width) + lower = PrecomputableAffine( + nO=hidden_width if use_upper else nO, + nF=nr_feature_tokens, + nI=tok2vec.get_dim("nO"), + nP=maxout_pieces, + ) + if use_upper: + with use_ops("numpy"): + # Initialize weights at zero, as it's a classification layer. + upper = Linear(nO=nO, init_W=zero_init) + else: + upper = None + return TransitionModel(tok2vec, lower, upper, resize_output=resize_output_v1) + + +def resize_output_v1(model, new_nO): + Linear = registry.get("layers", "Linear.v1") + + lower = model.get_ref("lower") + upper = model.get_ref("upper") + if not model.attrs["has_upper"]: + if lower.has_dim("nO") is None: + lower.set_dim("nO", new_nO) + return + elif upper.has_dim("nO") is None: + upper.set_dim("nO", new_nO) + return + elif new_nO == upper.get_dim("nO"): + return + smaller = upper + nI = None + if smaller.has_dim("nI"): + nI = smaller.get_dim("nI") + with use_ops("numpy"): + larger = Linear(nO=new_nO, nI=nI) + larger.init = smaller.init + # it could be that the model is not initialized yet, then skip this bit + if nI: + larger_W = larger.ops.alloc2f(new_nO, nI) + larger_b = larger.ops.alloc1f(new_nO) + smaller_W = smaller.get_param("W") + smaller_b = smaller.get_param("b") + # Weights are stored in (nr_out, nr_in) format, so we're basically + # just adding rows here. + if smaller.has_dim("nO"): + larger_W[: smaller.get_dim("nO")] = smaller_W + larger_b[: smaller.get_dim("nO")] = smaller_b + for i in range(smaller.get_dim("nO"), new_nO): + model.attrs["unseen_classes"].add(i) + + larger.set_param("W", larger_W) + larger.set_param("b", larger_b) + model._layers[-1] = larger + model.set_ref("upper", larger) + return model diff --git a/TTS/Kokoro/.venv/Lib/site-packages/spacy_legacy/architectures/tagger.py b/TTS/Kokoro/.venv/Lib/site-packages/spacy_legacy/architectures/tagger.py new file mode 100644 index 0000000000000000000000000000000000000000..ae421f026f43fcfa265ed85b9c1b54c1538aced0 --- /dev/null +++ b/TTS/Kokoro/.venv/Lib/site-packages/spacy_legacy/architectures/tagger.py @@ -0,0 +1,31 @@ +from typing import Optional, List +from thinc.api import Model +from thinc.types import Floats2d + +from spacy.util import registry +from spacy.tokens import Doc + + +def Tagger_v1( + tok2vec: Model[List[Doc], List[Floats2d]], nO: Optional[int] = None +) -> Model[List[Doc], List[Floats2d]]: + """Build a tagger model, using a provided token-to-vector component. The tagger + model simply adds a linear layer with softmax activation to predict scores + given the token vectors. + + tok2vec (Model[List[Doc], List[Floats2d]]): The token-to-vector subnetwork. + nO (int or None): The number of tags to output. Inferred from the data if None. + """ + # TODO: glorot_uniform_init seems to work a bit better than zero_init here?! + chain = registry.get("layers", "chain.v1") + softmax = registry.get("layers", "Softmax.v1") + with_array = registry.get("layers", "with_array.v1") + zero_init = registry.get("initializers", "zero_init.v1") + + t2v_width = tok2vec.get_dim("nO") if tok2vec.has_dim("nO") else None + output_layer = softmax(nO, t2v_width, init_W=zero_init()) + model = chain(tok2vec, with_array(output_layer)) # type: ignore + model.set_ref("tok2vec", tok2vec) + model.set_ref("softmax", output_layer) + model.set_ref("output_layer", output_layer) + return model diff --git a/TTS/Kokoro/.venv/Lib/site-packages/spacy_legacy/architectures/textcat.py b/TTS/Kokoro/.venv/Lib/site-packages/spacy_legacy/architectures/textcat.py new file mode 100644 index 0000000000000000000000000000000000000000..08aa3cec792274887ce4ecc610282958d28ad428 --- /dev/null +++ b/TTS/Kokoro/.venv/Lib/site-packages/spacy_legacy/architectures/textcat.py @@ -0,0 +1,178 @@ +from typing import Optional, List +from thinc.types import Floats2d +from thinc.api import Model, with_cpu +from spacy.attrs import ID, ORTH, PREFIX, SUFFIX, SHAPE, LOWER +from spacy.util import registry +from spacy.tokens import Doc + + +def TextCatCNN_v1( + tok2vec: Model, exclusive_classes: bool, nO: Optional[int] = None +) -> Model[List[Doc], Floats2d]: + """ + Build a simple CNN text classifier, given a token-to-vector model as inputs. + If exclusive_classes=True, a softmax non-linearity is applied, so that the + outputs sum to 1. If exclusive_classes=False, a logistic non-linearity + is applied instead, so that outputs are in the range [0, 1]. + """ + chain = registry.get("layers", "chain.v1") + reduce_mean = registry.get("layers", "reduce_mean.v1") + Logistic = registry.get("layers", "Logistic.v1") + Softmax = registry.get("layers", "Softmax.v1") + Linear = registry.get("layers", "Linear.v1") + list2ragged = registry.get("layers", "list2ragged.v1") + + with Model.define_operators({">>": chain}): + cnn = tok2vec >> list2ragged() >> reduce_mean() + if exclusive_classes: + output_layer = Softmax(nO=nO, nI=tok2vec.maybe_get_dim("nO")) + model = cnn >> output_layer + model.set_ref("output_layer", output_layer) + else: + linear_layer = Linear(nO=nO, nI=tok2vec.maybe_get_dim("nO")) + model = cnn >> linear_layer >> Logistic() + model.set_ref("output_layer", linear_layer) + model.set_ref("tok2vec", tok2vec) + model.set_dim("nO", nO) + model.attrs["multi_label"] = not exclusive_classes + return model + + +def TextCatBOW_v1( + exclusive_classes: bool, + ngram_size: int, + no_output_layer: bool, + nO: Optional[int] = None, +) -> Model[List[Doc], Floats2d]: + chain = registry.get("layers", "chain.v1") + Logistic = registry.get("layers", "Logistic.v1") + SparseLinear = registry.get("layers", "SparseLinear.v1") + softmax_activation = registry.get("layers", "softmax_activation.v1") + extract_ngrams = registry.get("layers", "spacy.extract_ngrams.v1") + + with Model.define_operators({">>": chain}): + sparse_linear = SparseLinear(nO) + model = extract_ngrams(ngram_size, attr=ORTH) >> sparse_linear + model = with_cpu(model, model.ops) + if not no_output_layer: + output_layer = softmax_activation() if exclusive_classes else Logistic() + model = model >> with_cpu(output_layer, output_layer.ops) + model.set_ref("output_layer", sparse_linear) + model.attrs["multi_label"] = not exclusive_classes + return model + + +def TextCatEnsemble_v1( + width: int, + embed_size: int, + pretrained_vectors: Optional[bool], + exclusive_classes: bool, + ngram_size: int, + window_size: int, + conv_depth: int, + dropout: Optional[float], + nO: Optional[int] = None, +) -> Model: + # Don't document this yet, I'm not sure it's right. + HashEmbed = registry.get("layers", "HashEmbed.v1") + FeatureExtractor = registry.get("layers", "spacy.FeatureExtractor.v1") + Maxout = registry.get("layers", "Maxout.v1") + StaticVectors = registry.get("layers", "spacy.StaticVectors.v1") + Softmax = registry.get("layers", "Softmax.v1") + Linear = registry.get("layers", "Linear.v1") + ParametricAttention = registry.get("layers", "ParametricAttention.v1") + Dropout = registry.get("layers", "Dropout.v1") + Logistic = registry.get("layers", "Logistic.v1") + build_bow_text_classifier = registry.get("architectures", "spacy.TextCatBOW.v1") + list2ragged = registry.get("layers", "list2ragged.v1") + chain = registry.get("layers", "chain.v1") + concatenate = registry.get("layers", "concatenate.v1") + clone = registry.get("layers", "clone.v1") + reduce_sum = registry.get("layers", "reduce_sum.v1") + with_array = registry.get("layers", "with_array.v1") + uniqued = registry.get("layers", "uniqued.v1") + residual = registry.get("layers", "residual.v1") + expand_window = registry.get("layers", "expand_window.v1") + + cols = [ORTH, LOWER, PREFIX, SUFFIX, SHAPE, ID] + with Model.define_operators({">>": chain, "|": concatenate, "**": clone}): + lower = HashEmbed( + nO=width, nV=embed_size, column=cols.index(LOWER), dropout=dropout, seed=10 + ) + prefix = HashEmbed( + nO=width // 2, + nV=embed_size, + column=cols.index(PREFIX), + dropout=dropout, + seed=11, + ) + suffix = HashEmbed( + nO=width // 2, + nV=embed_size, + column=cols.index(SUFFIX), + dropout=dropout, + seed=12, + ) + shape = HashEmbed( + nO=width // 2, + nV=embed_size, + column=cols.index(SHAPE), + dropout=dropout, + seed=13, + ) + width_nI = sum(layer.get_dim("nO") for layer in [lower, prefix, suffix, shape]) + trained_vectors = FeatureExtractor(cols) >> with_array( + uniqued( + (lower | prefix | suffix | shape) + >> Maxout(nO=width, nI=width_nI, normalize=True), + column=cols.index(ORTH), + ) + ) + if pretrained_vectors: + static_vectors = StaticVectors(width) + vector_layer = trained_vectors | static_vectors + vectors_width = width * 2 + else: + vector_layer = trained_vectors + vectors_width = width + tok2vec = vector_layer >> with_array( + Maxout(width, vectors_width, normalize=True) + >> residual( + ( + expand_window(window_size=window_size) + >> Maxout( + nO=width, nI=width * ((window_size * 2) + 1), normalize=True + ) + ) + ) + ** conv_depth, + pad=conv_depth, + ) + cnn_model = ( + tok2vec + >> list2ragged() + >> ParametricAttention(width) + >> reduce_sum() + >> residual(Maxout(nO=width, nI=width)) + >> Linear(nO=nO, nI=width) + >> Dropout(0.0) + ) + + linear_model = build_bow_text_classifier( + nO=nO, + ngram_size=ngram_size, + exclusive_classes=exclusive_classes, + no_output_layer=False, + ) + nO_double = nO * 2 if nO else None + if exclusive_classes: + output_layer = Softmax(nO=nO, nI=nO_double) + else: + output_layer = Linear(nO=nO, nI=nO_double) >> Dropout(0.0) >> Logistic() + model = (linear_model | cnn_model) >> output_layer + model.set_ref("tok2vec", tok2vec) + if model.has_dim("nO") is not False: + model.set_dim("nO", nO) + model.set_ref("output_layer", linear_model.get_ref("output_layer")) + model.attrs["multi_label"] = not exclusive_classes + return model diff --git a/TTS/Kokoro/.venv/Lib/site-packages/spacy_legacy/architectures/tok2vec.py b/TTS/Kokoro/.venv/Lib/site-packages/spacy_legacy/architectures/tok2vec.py new file mode 100644 index 0000000000000000000000000000000000000000..ce9184f131b218cf1c82b59dc2646fc7e45268b9 --- /dev/null +++ b/TTS/Kokoro/.venv/Lib/site-packages/spacy_legacy/architectures/tok2vec.py @@ -0,0 +1,314 @@ +from typing import List, Optional, Union +from thinc.api import Model +from thinc.types import Floats2d +from spacy.attrs import intify_attr +from spacy.errors import Errors +from spacy.tokens import Doc +from spacy.util import registry + + +def Tok2Vec_v1( + embed: Model[List[Doc], List[Floats2d]], + encode: Model[Floats2d, Floats2d], +) -> Model[List[Doc], List[Floats2d]]: + """Construct a tok2vec model out of embedding and encoding subnetworks. + See https://explosion.ai/blog/deep-learning-formula-nlp + + embed (Model[List[Doc], List[Floats2d]]): Embed tokens into context-independent + word vector representations. + encode (Model[List[Floats2d], List[Floats2d]]): Encode context into the + embeddings, using an architecture such as a CNN, BiLSTM or transformer. + """ + chain = registry.get("layers", "chain.v1") + with_array = registry.get("layers", "with_array.v1") + receptive_field = encode.attrs.get("receptive_field", 0) + tok2vec = chain(embed, with_array(encode, pad=receptive_field)) + tok2vec.set_dim("nO", encode.get_dim("nO")) + tok2vec.set_ref("embed", embed) + tok2vec.set_ref("encode", encode) + return tok2vec + + +def MaxoutWindowEncoder_v1( + width: int, window_size: int, maxout_pieces: int, depth: int +) -> Model[Floats2d, Floats2d]: + """Encode context using convolutions with maxout activation, layer + normalization and residual connections. + + width (int): The input and output width. These are required to be the same, + to allow residual connections. This value will be determined by the + width of the inputs. Recommended values are between 64 and 300. + window_size (int): The number of words to concatenate around each token + to construct the convolution. Recommended value is 1. + maxout_pieces (int): The number of maxout pieces to use. Recommended + values are 2 or 3. + depth (int): The number of convolutional layers. Recommended value is 4. + """ + Maxout = registry.get("layers", "Maxout.v1") + chain = registry.get("layers", "chain.v1") + expand_window = registry.get("layers", "expand_window.v1") + clone = registry.get("layers", "clone.v1") + residual = registry.get("layers", "residual.v1") + cnn = chain( + expand_window(window_size=window_size), + Maxout( + nO=width, + nI=width * ((window_size * 2) + 1), + nP=maxout_pieces, + dropout=0.0, + normalize=True, + ), + ) + model = clone(residual(cnn), depth) + model.set_dim("nO", width) + model.attrs["receptive_field"] = window_size * depth + return model + + +def MishWindowEncoder_v1( + width: int, window_size: int, depth: int +) -> Model[Floats2d, Floats2d]: + """Encode context using convolutions with mish activation, layer + normalization and residual connections. + + width (int): The input and output width. These are required to be the same, + to allow residual connections. This value will be determined by the + width of the inputs. Recommended values are between 64 and 300. + window_size (int): The number of words to concatenate around each token + to construct the convolution. Recommended value is 1. + depth (int): The number of convolutional layers. Recommended value is 4. + """ + Mish = registry.get("layers", "Mish.v1") + chain = registry.get("layers", "chain.v1") + expand_window = registry.get("layers", "expand_window.v1") + clone = registry.get("layers", "clone.v1") + residual = registry.get("layers", "residual.v1") + cnn = chain( + expand_window(window_size=window_size), + Mish(nO=width, nI=width * ((window_size * 2) + 1), dropout=0.0, normalize=True), + ) + model = clone(residual(cnn), depth) + model.set_dim("nO", width) + return model + + +def HashEmbedCNN_v1( + *, + width: int, + depth: int, + embed_size: int, + window_size: int, + maxout_pieces: int, + subword_features: bool, + pretrained_vectors: Optional[bool], +) -> Model[List[Doc], List[Floats2d]]: + """Build spaCy's 'standard' tok2vec layer, which uses hash embedding + with subword features and a CNN with layer-normalized maxout. + + width (int): The width of the input and output. These are required to be the + same, so that residual connections can be used. Recommended values are + 96, 128 or 300. + depth (int): The number of convolutional layers to use. Recommended values + are between 2 and 8. + window_size (int): The number of tokens on either side to concatenate during + the convolutions. The receptive field of the CNN will be + depth * (window_size * 2 + 1), so a 4-layer network with window_size of + 2 will be sensitive to 17 words at a time. Recommended value is 1. + embed_size (int): The number of rows in the hash embedding tables. This can + be surprisingly small, due to the use of the hash embeddings. Recommended + values are between 2000 and 10000. + maxout_pieces (int): The number of pieces to use in the maxout non-linearity. + If 1, the Mish non-linearity is used instead. Recommended values are 1-3. + subword_features (bool): Whether to also embed subword features, specifically + the prefix, suffix and word shape. This is recommended for alphabetic + languages like English, but not if single-character tokens are used for + a language such as Chinese. + pretrained_vectors (bool): Whether to also use static vectors. + """ + build_Tok2Vec_model = registry.get("architectures", "spacy.Tok2Vec.v2") + MultiHashEmbed = registry.get("architectures", "spacy.MultiHashEmbed.v1") + MaxoutWindowEncoder = registry.get("architectures", "spacy.MaxoutWindowEncoder.v2") + if subword_features: + attrs = ["NORM", "PREFIX", "SUFFIX", "SHAPE"] + row_sizes = [embed_size, embed_size // 2, embed_size // 2, embed_size // 2] + else: + attrs = ["NORM"] + row_sizes = [embed_size] + return build_Tok2Vec_model( + embed=MultiHashEmbed( + width=width, + rows=row_sizes, + attrs=attrs, + include_static_vectors=bool(pretrained_vectors), + ), + encode=MaxoutWindowEncoder( + width=width, + depth=depth, + window_size=window_size, + maxout_pieces=maxout_pieces, + ), + ) + + +def MultiHashEmbed_v1( + width: int, + attrs: List[Union[str, int]], + rows: List[int], + include_static_vectors: bool, +) -> Model[List[Doc], List[Floats2d]]: + """Construct an embedding layer that separately embeds a number of lexical + attributes using hash embedding, concatenates the results, and passes it + through a feed-forward subnetwork to build a mixed representation. + + The features used can be configured with the 'attrs' argument. The suggested + attributes are NORM, PREFIX, SUFFIX and SHAPE. This lets the model take into + account some subword information, without constructing a fully character-based + representation. If pretrained vectors are available, they can be included in + the representation as well, with the vectors table will be kept static + (i.e. it's not updated). + + The `width` parameter specifies the output width of the layer and the widths + of all embedding tables. If static vectors are included, a learned linear + layer is used to map the vectors to the specified width before concatenating + it with the other embedding outputs. A single Maxout layer is then used to + reduce the concatenated vectors to the final width. + + The `rows` parameter controls the number of rows used by the `HashEmbed` + tables. The HashEmbed layer needs surprisingly few rows, due to its use of + the hashing trick. Generally between 2000 and 10000 rows is sufficient, + even for very large vocabularies. A number of rows must be specified for each + table, so the `rows` list must be of the same length as the `attrs` parameter. + + width (int): The output width. Also used as the width of the embedding tables. + Recommended values are between 64 and 300. + attrs (list of attr IDs): The token attributes to embed. A separate + embedding table will be constructed for each attribute. + rows (List[int]): The number of rows in the embedding tables. Must have the + same length as attrs. + include_static_vectors (bool): Whether to also use static word vectors. + Requires a vectors table to be loaded in the Doc objects' vocab. + """ + HashEmbed = registry.get("layers", "HashEmbed.v1") + FeatureExtractor = registry.get("layers", "spacy.FeatureExtractor.v1") + Maxout = registry.get("layers", "Maxout.v1") + StaticVectors = registry.get("layers", "spacy.StaticVectors.v1") + chain = registry.get("layers", "chain.v1") + concatenate = registry.get("layers", "concatenate.v1") + list2ragged = registry.get("layers", "list2ragged.v1") + with_array = registry.get("layers", "with_array.v1") + ragged2list = registry.get("layers", "ragged2list.v1") + if len(rows) != len(attrs): + raise ValueError(f"Mismatched lengths: {len(rows)} vs {len(attrs)}") + seed = 7 + + def make_hash_embed(index): + nonlocal seed + seed += 1 + return HashEmbed(width, rows[index], column=index, seed=seed, dropout=0.0) + + embeddings = [make_hash_embed(i) for i in range(len(attrs))] + concat_size = width * (len(embeddings) + include_static_vectors) + if include_static_vectors: + model = chain( + concatenate( + chain( + FeatureExtractor(attrs), + list2ragged(), + with_array(concatenate(*embeddings)), + ), + StaticVectors(width, dropout=0.0), + ), + with_array(Maxout(width, concat_size, nP=3, dropout=0.0, normalize=True)), + ragged2list(), + ) + else: + model = chain( + FeatureExtractor(list(attrs)), + list2ragged(), + with_array(concatenate(*embeddings)), + with_array(Maxout(width, concat_size, nP=3, dropout=0.0, normalize=True)), + ragged2list(), + ) + return model + + +def CharacterEmbed_v1( + width: int, + rows: int, + nM: int, + nC: int, + include_static_vectors: bool, + feature: Union[int, str] = "LOWER", +) -> Model[List[Doc], List[Floats2d]]: + """Construct an embedded representation based on character embeddings, using + a feed-forward network. A fixed number of UTF-8 byte characters are used for + each word, taken from the beginning and end of the word equally. Padding is + used in the centre for words that are too short. + + For instance, let's say nC=4, and the word is "jumping". The characters + used will be jung (two from the start, two from the end). If we had nC=8, + the characters would be "jumpping": 4 from the start, 4 from the end. This + ensures that the final character is always in the last position, instead + of being in an arbitrary position depending on the word length. + + The characters are embedded in a embedding table with a given number of rows, + and the vectors concatenated. A hash-embedded vector of the LOWER of the word is + also concatenated on, and the result is then passed through a feed-forward + network to construct a single vector to represent the information. + + feature (int or str): An attribute to embed, to concatenate with the characters. + width (int): The width of the output vector and the feature embedding. + rows (int): The number of rows in the LOWER hash embedding table. + nM (int): The dimensionality of the character embeddings. Recommended values + are between 16 and 64. + nC (int): The number of UTF-8 bytes to embed per word. Recommended values + are between 3 and 8, although it may depend on the length of words in the + language. + include_static_vectors (bool): Whether to also use static word vectors. + Requires a vectors table to be loaded in the Doc objects' vocab. + """ + CharEmbed = registry.get("layers", "spacy.CharEmbed.v1") + FeatureExtractor = registry.get("layers", "spacy.FeatureExtractor.v1") + Maxout = registry.get("layers", "Maxout.v1") + HashEmbed = registry.get("layers", "HashEmbed.v1") + StaticVectors = registry.get("layers", "spacy.StaticVectors.v1") + chain = registry.get("layers", "chain.v1") + concatenate = registry.get("layers", "concatenate.v1") + list2ragged = registry.get("layers", "list2ragged.v1") + with_array = registry.get("layers", "with_array.v1") + ragged2list = registry.get("layers", "ragged2list.v1") + feature = intify_attr(feature) + if feature is None: + raise ValueError(Errors.E911(feat=feature)) + if include_static_vectors: + model = chain( + concatenate( + chain(CharEmbed(nM=nM, nC=nC), list2ragged()), + chain( + FeatureExtractor([feature]), + list2ragged(), + with_array(HashEmbed(nO=width, nV=rows, column=0, seed=5)), + ), + StaticVectors(width, dropout=0.0), + ), + with_array( + Maxout(width, nM * nC + (2 * width), nP=3, normalize=True, dropout=0.0) + ), + ragged2list(), + ) + else: + model = chain( + concatenate( + chain(CharEmbed(nM=nM, nC=nC), list2ragged()), + chain( + FeatureExtractor([feature]), + list2ragged(), + with_array(HashEmbed(nO=width, nV=rows, column=0, seed=5)), + ), + ), + with_array( + Maxout(width, nM * nC + width, nP=3, normalize=True, dropout=0.0) + ), + ragged2list(), + ) + return model diff --git a/TTS/Kokoro/.venv/Lib/site-packages/spacy_legacy/components/__init__.py b/TTS/Kokoro/.venv/Lib/site-packages/spacy_legacy/components/__init__.py new file mode 100644 index 0000000000000000000000000000000000000000..e69de29bb2d1d6434b8b29ae775ad8c2e48c5391 diff --git a/TTS/Kokoro/.venv/Lib/site-packages/spacy_legacy/components/__pycache__/__init__.cpython-312.pyc b/TTS/Kokoro/.venv/Lib/site-packages/spacy_legacy/components/__pycache__/__init__.cpython-312.pyc new file mode 100644 index 0000000000000000000000000000000000000000..d8991af8a2e4134b69d61edf5dc447dc09a94944 Binary files /dev/null and b/TTS/Kokoro/.venv/Lib/site-packages/spacy_legacy/components/__pycache__/__init__.cpython-312.pyc differ diff --git a/TTS/Kokoro/.venv/Lib/site-packages/spacy_legacy/components/__pycache__/entity_linker.cpython-312.pyc b/TTS/Kokoro/.venv/Lib/site-packages/spacy_legacy/components/__pycache__/entity_linker.cpython-312.pyc new file mode 100644 index 0000000000000000000000000000000000000000..fb754422c88f84906c957a4fc8fe0b159963f8c5 Binary files /dev/null and b/TTS/Kokoro/.venv/Lib/site-packages/spacy_legacy/components/__pycache__/entity_linker.cpython-312.pyc differ diff --git a/TTS/Kokoro/.venv/Lib/site-packages/spacy_legacy/components/entity_linker.py b/TTS/Kokoro/.venv/Lib/site-packages/spacy_legacy/components/entity_linker.py new file mode 100644 index 0000000000000000000000000000000000000000..40a4b3353cfeb839971959b8fbd722712f826678 --- /dev/null +++ b/TTS/Kokoro/.venv/Lib/site-packages/spacy_legacy/components/entity_linker.py @@ -0,0 +1,422 @@ +# This file is present to provide a prior version of the EntityLinker component +# for backwards compatability. For details see #9669. + +from typing import Optional, Iterable, Callable, Dict, Union, List, Any +from thinc.types import Floats2d +from pathlib import Path +from itertools import islice +import srsly +import random +from thinc.api import CosineDistance, Model, Optimizer +from thinc.api import set_dropout_rate +import warnings + +from spacy.kb import KnowledgeBase, Candidate +from spacy.ml import empty_kb +from spacy.tokens import Doc, Span +from spacy.pipeline.pipe import deserialize_config +from spacy.pipeline.trainable_pipe import TrainablePipe +from spacy.language import Language +from spacy.vocab import Vocab +from spacy.training import Example, validate_examples, validate_get_examples +from spacy.errors import Errors, Warnings +from spacy.util import SimpleFrozenList +from spacy import util +from spacy.scorer import Scorer + +# See #9050 +BACKWARD_OVERWRITE = True + + +def entity_linker_score(examples, **kwargs): + return Scorer.score_links(examples, negative_labels=[EntityLinker_v1.NIL], **kwargs) + + +class EntityLinker_v1(TrainablePipe): + """Pipeline component for named entity linking. + + DOCS: https://spacy.io/api/entitylinker + """ + + NIL = "NIL" # string used to refer to a non-existing link + + def __init__( + self, + vocab: Vocab, + model: Model, + name: str = "entity_linker", + *, + labels_discard: Iterable[str], + n_sents: int, + incl_prior: bool, + incl_context: bool, + entity_vector_length: int, + get_candidates: Callable[[KnowledgeBase, Span], Iterable[Candidate]], + overwrite: bool = BACKWARD_OVERWRITE, + scorer: Optional[Callable] = entity_linker_score, + ) -> None: + """Initialize an entity linker. + + vocab (Vocab): The shared vocabulary. + model (thinc.api.Model): The Thinc Model powering the pipeline component. + name (str): The component instance name, used to add entries to the + losses during training. + labels_discard (Iterable[str]): NER labels that will automatically get a "NIL" prediction. + n_sents (int): The number of neighbouring sentences to take into account. + incl_prior (bool): Whether or not to include prior probabilities from the KB in the model. + incl_context (bool): Whether or not to include the local context in the model. + entity_vector_length (int): Size of encoding vectors in the KB. + get_candidates (Callable[[KnowledgeBase, Span], Iterable[Candidate]]): Function that + produces a list of candidates, given a certain knowledge base and a textual mention. + scorer (Optional[Callable]): The scoring method. Defaults to Scorer.score_links. + DOCS: https://spacy.io/api/entitylinker#init + """ + self.vocab = vocab + self.model = model + self.name = name + self.labels_discard = list(labels_discard) + self.n_sents = n_sents + self.incl_prior = incl_prior + self.incl_context = incl_context + self.get_candidates = get_candidates + self.cfg: Dict[str, Any] = {"overwrite": overwrite} + self.distance = CosineDistance(normalize=False) + # how many neighbour sentences to take into account + # create an empty KB by default. If you want to load a predefined one, specify it in 'initialize'. + self.kb = empty_kb(entity_vector_length)(self.vocab) + self.scorer = scorer + + def set_kb(self, kb_loader: Callable[[Vocab], KnowledgeBase]): + """Define the KB of this pipe by providing a function that will + create it using this object's vocab.""" + if not callable(kb_loader): + raise ValueError(Errors.E885.format(arg_type=type(kb_loader))) + + self.kb = kb_loader(self.vocab) + + def validate_kb(self) -> None: + # Raise an error if the knowledge base is not initialized. + if self.kb is None: + raise ValueError(Errors.E1018.format(name=self.name)) + if len(self.kb) == 0: + raise ValueError(Errors.E139.format(name=self.name)) + + def initialize( + self, + get_examples: Callable[[], Iterable[Example]], + *, + nlp: Optional[Language] = None, + kb_loader: Optional[Callable[[Vocab], KnowledgeBase]] = None, + ): + """Initialize the pipe for training, using a representative set + of data examples. + + get_examples (Callable[[], Iterable[Example]]): Function that + returns a representative sample of gold-standard Example objects. + nlp (Language): The current nlp object the component is part of. + kb_loader (Callable[[Vocab], KnowledgeBase]): A function that creates an InMemoryLookupKB from a Vocab instance. + Note that providing this argument, will overwrite all data accumulated in the current KB. + Use this only when loading a KB as-such from file. + + DOCS: https://spacy.io/api/entitylinker#initialize + """ + validate_get_examples(get_examples, "EntityLinker_v1.initialize") + if kb_loader is not None: + self.set_kb(kb_loader) + self.validate_kb() + nO = self.kb.entity_vector_length + doc_sample = [] + vector_sample = [] + for example in islice(get_examples(), 10): + doc_sample.append(example.x) + vector_sample.append(self.model.ops.alloc1f(nO)) + assert len(doc_sample) > 0, Errors.E923.format(name=self.name) + assert len(vector_sample) > 0, Errors.E923.format(name=self.name) + self.model.initialize( + X=doc_sample, Y=self.model.ops.asarray(vector_sample, dtype="float32") + ) + + def update( + self, + examples: Iterable[Example], + *, + drop: float = 0.0, + sgd: Optional[Optimizer] = None, + losses: Optional[Dict[str, float]] = None, + ) -> Dict[str, float]: + """Learn from a batch of documents and gold-standard information, + updating the pipe's model. Delegates to predict and get_loss. + + examples (Iterable[Example]): A batch of Example objects. + drop (float): The dropout rate. + sgd (thinc.api.Optimizer): The optimizer. + losses (Dict[str, float]): Optional record of the loss during training. + Updated using the component name as the key. + RETURNS (Dict[str, float]): The updated losses dictionary. + + DOCS: https://spacy.io/api/entitylinker#update + """ + self.validate_kb() + if losses is None: + losses = {} + losses.setdefault(self.name, 0.0) + if not examples: + return losses + validate_examples(examples, "EntityLinker_v1.update") + sentence_docs = [] + for eg in examples: + sentences = [s for s in eg.reference.sents] + kb_ids = eg.get_aligned("ENT_KB_ID", as_string=True) + for ent in eg.reference.ents: + # KB ID of the first token is the same as the whole span + kb_id = kb_ids[ent.start] + if kb_id: + try: + # find the sentence in the list of sentences. + sent_index = sentences.index(ent.sent) + except AttributeError: + # Catch the exception when ent.sent is None and provide a user-friendly warning + raise RuntimeError(Errors.E030) from None + # get n previous sentences, if there are any + start_sentence = max(0, sent_index - self.n_sents) + # get n posterior sentences, or as many < n as there are + end_sentence = min(len(sentences) - 1, sent_index + self.n_sents) + # get token positions + start_token = sentences[start_sentence].start + end_token = sentences[end_sentence].end + # append that span as a doc to training + sent_doc = eg.predicted[start_token:end_token].as_doc() + sentence_docs.append(sent_doc) + set_dropout_rate(self.model, drop) + if not sentence_docs: + warnings.warn(Warnings.W093.format(name="Entity Linker")) + return losses + sentence_encodings, bp_context = self.model.begin_update(sentence_docs) + loss, d_scores = self.get_loss( + sentence_encodings=sentence_encodings, examples=examples + ) + bp_context(d_scores) + if sgd is not None: + self.finish_update(sgd) + losses[self.name] += loss + return losses + + def get_loss(self, examples: Iterable[Example], sentence_encodings: Floats2d): + validate_examples(examples, "EntityLinker_v1.get_loss") + entity_encodings = [] + for eg in examples: + kb_ids = eg.get_aligned("ENT_KB_ID", as_string=True) + for ent in eg.reference.ents: + kb_id = kb_ids[ent.start] + if kb_id: + entity_encoding = self.kb.get_vector(kb_id) + entity_encodings.append(entity_encoding) + entity_encodings = self.model.ops.asarray2f(entity_encodings) + if sentence_encodings.shape != entity_encodings.shape: + err = Errors.E147.format( + method="get_loss", msg="gold entities do not match up" + ) + raise RuntimeError(err) + gradients = self.distance.get_grad(sentence_encodings, entity_encodings) + loss = self.distance.get_loss(sentence_encodings, entity_encodings) + loss = loss / len(entity_encodings) + return float(loss), gradients + + def predict(self, docs: Iterable[Doc]) -> List[str]: + """Apply the pipeline's model to a batch of docs, without modifying them. + Returns the KB IDs for each entity in each doc, including NIL if there is + no prediction. + + docs (Iterable[Doc]): The documents to predict. + RETURNS (List[str]): The models prediction for each document. + + DOCS: https://spacy.io/api/entitylinker#predict + """ + self.validate_kb() + entity_count = 0 + final_kb_ids: List[str] = [] + if not docs: + return final_kb_ids + if isinstance(docs, Doc): + docs = [docs] + for i, doc in enumerate(docs): + sentences = [s for s in doc.sents] + if len(doc) > 0: + # Looping through each entity (TODO: rewrite) + for ent in doc.ents: + sent = ent.sent + sent_index = sentences.index(sent) + assert sent_index >= 0 + # get n_neighbour sentences, clipped to the length of the document + start_sentence = max(0, sent_index - self.n_sents) + end_sentence = min(len(sentences) - 1, sent_index + self.n_sents) + start_token = sentences[start_sentence].start + end_token = sentences[end_sentence].end + sent_doc = doc[start_token:end_token].as_doc() + # currently, the context is the same for each entity in a sentence (should be refined) + xp = self.model.ops.xp + if self.incl_context: + sentence_encoding = self.model.predict([sent_doc])[0] + sentence_encoding_t = sentence_encoding.T + sentence_norm = xp.linalg.norm(sentence_encoding_t) + entity_count += 1 + if ent.label_ in self.labels_discard: + # ignoring this entity - setting to NIL + final_kb_ids.append(self.NIL) + else: + candidates = list(self.get_candidates(self.kb, ent)) + if not candidates: + # no prediction possible for this entity - setting to NIL + final_kb_ids.append(self.NIL) + elif len(candidates) == 1: + # shortcut for efficiency reasons: take the 1 candidate + final_kb_ids.append(candidates[0].entity_) + else: + random.shuffle(candidates) + # set all prior probabilities to 0 if incl_prior=False + prior_probs = xp.asarray([c.prior_prob for c in candidates]) + if not self.incl_prior: + prior_probs = xp.asarray([0.0 for _ in candidates]) + scores = prior_probs + # add in similarity from the context + if self.incl_context: + entity_encodings = xp.asarray( + [c.entity_vector for c in candidates] + ) + entity_norm = xp.linalg.norm(entity_encodings, axis=1) + if len(entity_encodings) != len(prior_probs): + raise RuntimeError( + Errors.E147.format( + method="predict", + msg="vectors not of equal length", + ) + ) + # cosine similarity + sims = xp.dot(entity_encodings, sentence_encoding_t) / ( + sentence_norm * entity_norm + ) + if sims.shape != prior_probs.shape: + raise ValueError(Errors.E161) + scores = prior_probs + sims - (prior_probs * sims) + best_index = scores.argmax().item() + best_candidate = candidates[best_index] + final_kb_ids.append(best_candidate.entity_) + if not (len(final_kb_ids) == entity_count): + err = Errors.E147.format( + method="predict", msg="result variables not of equal length" + ) + raise RuntimeError(err) + return final_kb_ids + + def set_annotations(self, docs: Iterable[Doc], kb_ids: List[str]) -> None: + """Modify a batch of documents, using pre-computed scores. + + docs (Iterable[Doc]): The documents to modify. + kb_ids (List[str]): The IDs to set, produced by EntityLinker.predict. + + DOCS: https://spacy.io/api/entitylinker#set_annotations + """ + count_ents = len([ent for doc in docs for ent in doc.ents]) + if count_ents != len(kb_ids): + raise ValueError(Errors.E148.format(ents=count_ents, ids=len(kb_ids))) + i = 0 + overwrite = self.cfg["overwrite"] + for doc in docs: + for ent in doc.ents: + kb_id = kb_ids[i] + i += 1 + for token in ent: + if token.ent_kb_id == 0 or overwrite: + token.ent_kb_id_ = kb_id + + def to_bytes(self, *, exclude=tuple()): + """Serialize the pipe to a bytestring. + + exclude (Iterable[str]): String names of serialization fields to exclude. + RETURNS (bytes): The serialized object. + + DOCS: https://spacy.io/api/entitylinker#to_bytes + """ + self._validate_serialization_attrs() + serialize = {} + if hasattr(self, "cfg") and self.cfg is not None: + serialize["cfg"] = lambda: srsly.json_dumps(self.cfg) + serialize["vocab"] = lambda: self.vocab.to_bytes(exclude=exclude) + serialize["kb"] = self.kb.to_bytes + serialize["model"] = self.model.to_bytes + return util.to_bytes(serialize, exclude) + + def from_bytes(self, bytes_data, *, exclude=tuple()): + """Load the pipe from a bytestring. + + exclude (Iterable[str]): String names of serialization fields to exclude. + RETURNS (TrainablePipe): The loaded object. + + DOCS: https://spacy.io/api/entitylinker#from_bytes + """ + self._validate_serialization_attrs() + + def load_model(b): + try: + self.model.from_bytes(b) + except AttributeError: + raise ValueError(Errors.E149) from None + + deserialize = {} + if hasattr(self, "cfg") and self.cfg is not None: + deserialize["cfg"] = lambda b: self.cfg.update(srsly.json_loads(b)) + deserialize["vocab"] = lambda b: self.vocab.from_bytes(b, exclude=exclude) + deserialize["kb"] = lambda b: self.kb.from_bytes(b) + deserialize["model"] = load_model + util.from_bytes(bytes_data, deserialize, exclude) + return self + + def to_disk( + self, path: Union[str, Path], *, exclude: Iterable[str] = SimpleFrozenList() + ) -> None: + """Serialize the pipe to disk. + + path (str / Path): Path to a directory. + exclude (Iterable[str]): String names of serialization fields to exclude. + + DOCS: https://spacy.io/api/entitylinker#to_disk + """ + serialize = {} + serialize["vocab"] = lambda p: self.vocab.to_disk(p, exclude=exclude) + serialize["cfg"] = lambda p: srsly.write_json(p, self.cfg) + serialize["kb"] = lambda p: self.kb.to_disk(p) + serialize["model"] = lambda p: self.model.to_disk(p) + util.to_disk(path, serialize, exclude) + + def from_disk( + self, path: Union[str, Path], *, exclude: Iterable[str] = SimpleFrozenList() + ) -> "EntityLinker_v1": + """Load the pipe from disk. Modifies the object in place and returns it. + + path (str / Path): Path to a directory. + exclude (Iterable[str]): String names of serialization fields to exclude. + RETURNS (EntityLinker): The modified EntityLinker object. + + DOCS: https://spacy.io/api/entitylinker#from_disk + """ + + def load_model(p): + try: + with p.open("rb") as infile: + self.model.from_bytes(infile.read()) + except AttributeError: + raise ValueError(Errors.E149) from None + + deserialize: Dict[str, Callable[[Any], Any]] = {} + deserialize["cfg"] = lambda p: self.cfg.update(deserialize_config(p)) + deserialize["vocab"] = lambda p: self.vocab.from_disk(p, exclude=exclude) + deserialize["kb"] = lambda p: self.kb.from_disk(p) + deserialize["model"] = load_model + util.from_disk(path, deserialize, exclude) + return self + + def rehearse(self, examples, *, sgd=None, losses=None, **config): + raise NotImplementedError + + def add_label(self, label): + raise NotImplementedError diff --git a/TTS/Kokoro/.venv/Lib/site-packages/spacy_legacy/layers/__init__.py b/TTS/Kokoro/.venv/Lib/site-packages/spacy_legacy/layers/__init__.py new file mode 100644 index 0000000000000000000000000000000000000000..e69de29bb2d1d6434b8b29ae775ad8c2e48c5391 diff --git a/TTS/Kokoro/.venv/Lib/site-packages/spacy_legacy/layers/__pycache__/__init__.cpython-312.pyc b/TTS/Kokoro/.venv/Lib/site-packages/spacy_legacy/layers/__pycache__/__init__.cpython-312.pyc new file mode 100644 index 0000000000000000000000000000000000000000..01ba7699ddeb730eb3ddae899d9f579b9c4363d9 Binary files /dev/null and b/TTS/Kokoro/.venv/Lib/site-packages/spacy_legacy/layers/__pycache__/__init__.cpython-312.pyc differ diff --git a/TTS/Kokoro/.venv/Lib/site-packages/spacy_legacy/layers/__pycache__/staticvectors_v1.cpython-312.pyc b/TTS/Kokoro/.venv/Lib/site-packages/spacy_legacy/layers/__pycache__/staticvectors_v1.cpython-312.pyc new file mode 100644 index 0000000000000000000000000000000000000000..43added9ce4508cf4b58e9d35f3d9e07dcc2ca43 Binary files /dev/null and b/TTS/Kokoro/.venv/Lib/site-packages/spacy_legacy/layers/__pycache__/staticvectors_v1.cpython-312.pyc differ diff --git a/TTS/Kokoro/.venv/Lib/site-packages/spacy_legacy/layers/staticvectors_v1.py b/TTS/Kokoro/.venv/Lib/site-packages/spacy_legacy/layers/staticvectors_v1.py new file mode 100644 index 0000000000000000000000000000000000000000..478bc3a4ac6edaf89a92bc18c4a8e268336bdf80 --- /dev/null +++ b/TTS/Kokoro/.venv/Lib/site-packages/spacy_legacy/layers/staticvectors_v1.py @@ -0,0 +1,97 @@ +from typing import List, Tuple, Callable, Optional, cast +from thinc.util import partial +from thinc.types import Ragged, Floats2d, Floats1d +from thinc.api import Model, Ops +from thinc.initializers import glorot_uniform_init +from spacy.tokens import Doc +from spacy.errors import Errors +from spacy.util import registry + + +def StaticVectors_v1( + nO: Optional[int] = None, + nM: Optional[int] = None, + *, + dropout: Optional[float] = None, + init_W: Callable = glorot_uniform_init, + key_attr: str = "ORTH" +) -> Model[List[Doc], Ragged]: + """Embed Doc objects with their vocab's vectors table, applying a learned + linear projection to control the dimensionality. If a dropout rate is + specified, the dropout is applied per dimension over the whole batch. + """ + return Model( + "static_vectors", + forward, + init=partial(init, init_W), + params={"W": None}, + attrs={"key_attr": key_attr, "dropout_rate": dropout}, + dims={"nO": nO, "nM": nM}, + ) + + +def forward( + model: Model[List[Doc], Ragged], docs: List[Doc], is_train: bool +) -> Tuple[Ragged, Callable]: + if not sum(len(doc) for doc in docs): + return _handle_empty(model.ops, model.get_dim("nO")) + key_attr = model.attrs["key_attr"] + W = cast(Floats2d, model.ops.as_contig(model.get_param("W"))) + V = cast(Floats2d, docs[0].vocab.vectors.data) + rows = model.ops.flatten( + [doc.vocab.vectors.find(keys=doc.to_array(key_attr)) for doc in docs] + ) + try: + vectors_data = model.ops.gemm(model.ops.as_contig(V[rows]), W, trans2=True) + except ValueError: + raise RuntimeError(Errors.E896) + output = Ragged( + vectors_data, model.ops.asarray([len(doc) for doc in docs], dtype="i") + ) + mask = None + if is_train: + mask = _get_drop_mask(model.ops, W.shape[0], model.attrs.get("dropout_rate")) + if mask is not None: + output.data *= mask + + def backprop(d_output: Ragged) -> List[Doc]: + if mask is not None: + d_output.data *= mask + model.inc_grad( + "W", + model.ops.gemm(d_output.data, model.ops.as_contig(V[rows]), trans1=True), + ) + return [] + + return output, backprop + + +def init( + init_W: Callable, + model: Model[List[Doc], Ragged], + X: Optional[List[Doc]] = None, + Y: Optional[Ragged] = None, +) -> Model[List[Doc], Ragged]: + nM = model.get_dim("nM") if model.has_dim("nM") else None + nO = model.get_dim("nO") if model.has_dim("nO") else None + if X is not None and len(X): + nM = X[0].vocab.vectors.data.shape[1] + if Y is not None: + nO = Y.data.shape[1] + + if nM is None: + raise ValueError(Errors.E905) + if nO is None: + raise ValueError(Errors.E904) + model.set_dim("nM", nM) + model.set_dim("nO", nO) + model.set_param("W", init_W(model.ops, (nO, nM))) + return model + + +def _handle_empty(ops: Ops, nO: int): + return Ragged(ops.alloc2f(0, nO), ops.alloc1i(0)), lambda d_ragged: [] + + +def _get_drop_mask(ops: Ops, nO: int, rate: Optional[float]) -> Optional[Floats1d]: + return ops.get_dropout_mask((nO,), rate) if rate is not None else None diff --git a/TTS/Kokoro/.venv/Lib/site-packages/spacy_legacy/tests/__init__.py b/TTS/Kokoro/.venv/Lib/site-packages/spacy_legacy/tests/__init__.py new file mode 100644 index 0000000000000000000000000000000000000000..e69de29bb2d1d6434b8b29ae775ad8c2e48c5391 diff --git a/TTS/Kokoro/.venv/Lib/site-packages/spacy_legacy/tests/__pycache__/__init__.cpython-312.pyc b/TTS/Kokoro/.venv/Lib/site-packages/spacy_legacy/tests/__pycache__/__init__.cpython-312.pyc new file mode 100644 index 0000000000000000000000000000000000000000..27473a817dabda5bc82ec70ca07d98507cd6b25a Binary files /dev/null and b/TTS/Kokoro/.venv/Lib/site-packages/spacy_legacy/tests/__pycache__/__init__.cpython-312.pyc differ diff --git a/TTS/Kokoro/.venv/Lib/site-packages/spacy_legacy/tests/__pycache__/test_layer.cpython-312.pyc b/TTS/Kokoro/.venv/Lib/site-packages/spacy_legacy/tests/__pycache__/test_layer.cpython-312.pyc new file mode 100644 index 0000000000000000000000000000000000000000..7dce7ac7f5b7bc30093f651fd98bf467611929b4 Binary files /dev/null and b/TTS/Kokoro/.venv/Lib/site-packages/spacy_legacy/tests/__pycache__/test_layer.cpython-312.pyc differ diff --git a/TTS/Kokoro/.venv/Lib/site-packages/spacy_legacy/tests/__pycache__/test_legacy.cpython-312.pyc b/TTS/Kokoro/.venv/Lib/site-packages/spacy_legacy/tests/__pycache__/test_legacy.cpython-312.pyc new file mode 100644 index 0000000000000000000000000000000000000000..d34aa2b4d0bfeaeff049c805874af83d31a88557 Binary files /dev/null and b/TTS/Kokoro/.venv/Lib/site-packages/spacy_legacy/tests/__pycache__/test_legacy.cpython-312.pyc differ diff --git a/TTS/Kokoro/.venv/Lib/site-packages/spacy_legacy/tests/__pycache__/test_logger.cpython-312.pyc b/TTS/Kokoro/.venv/Lib/site-packages/spacy_legacy/tests/__pycache__/test_logger.cpython-312.pyc new file mode 100644 index 0000000000000000000000000000000000000000..203a994d49c04e6c666c022318652dfe48176d88 Binary files /dev/null and b/TTS/Kokoro/.venv/Lib/site-packages/spacy_legacy/tests/__pycache__/test_logger.cpython-312.pyc differ diff --git a/TTS/Kokoro/.venv/Lib/site-packages/spacy_legacy/tests/__pycache__/test_scorers.cpython-312.pyc b/TTS/Kokoro/.venv/Lib/site-packages/spacy_legacy/tests/__pycache__/test_scorers.cpython-312.pyc new file mode 100644 index 0000000000000000000000000000000000000000..4f6a74a95a4c3ca7817643d0360b2dce10d161d2 Binary files /dev/null and b/TTS/Kokoro/.venv/Lib/site-packages/spacy_legacy/tests/__pycache__/test_scorers.cpython-312.pyc differ diff --git a/TTS/Kokoro/.venv/Lib/site-packages/spacy_legacy/tests/parser/__init__.py b/TTS/Kokoro/.venv/Lib/site-packages/spacy_legacy/tests/parser/__init__.py new file mode 100644 index 0000000000000000000000000000000000000000..e69de29bb2d1d6434b8b29ae775ad8c2e48c5391 diff --git a/TTS/Kokoro/.venv/Lib/site-packages/spacy_legacy/tests/parser/__pycache__/__init__.cpython-312.pyc b/TTS/Kokoro/.venv/Lib/site-packages/spacy_legacy/tests/parser/__pycache__/__init__.cpython-312.pyc new file mode 100644 index 0000000000000000000000000000000000000000..bb733956a9a4fc9bcee5a921750069a39e3e1b60 Binary files /dev/null and b/TTS/Kokoro/.venv/Lib/site-packages/spacy_legacy/tests/parser/__pycache__/__init__.cpython-312.pyc differ diff --git a/TTS/Kokoro/.venv/Lib/site-packages/spacy_legacy/tests/parser/__pycache__/test_parser.cpython-312.pyc b/TTS/Kokoro/.venv/Lib/site-packages/spacy_legacy/tests/parser/__pycache__/test_parser.cpython-312.pyc new file mode 100644 index 0000000000000000000000000000000000000000..048805309e98ae41db1bc328997e30cdf48ea784 Binary files /dev/null and b/TTS/Kokoro/.venv/Lib/site-packages/spacy_legacy/tests/parser/__pycache__/test_parser.cpython-312.pyc differ diff --git a/TTS/Kokoro/.venv/Lib/site-packages/spacy_legacy/tests/parser/test_parser.py b/TTS/Kokoro/.venv/Lib/site-packages/spacy_legacy/tests/parser/test_parser.py new file mode 100644 index 0000000000000000000000000000000000000000..3e672ec9c7018aebe8fcdbfc539d90fe06a9f416 --- /dev/null +++ b/TTS/Kokoro/.venv/Lib/site-packages/spacy_legacy/tests/parser/test_parser.py @@ -0,0 +1,65 @@ +import pytest +from spacy.lang.en import English +from spacy.training import Example +from thinc.api import Config + +default_tok2vec_config = """ +[model] +@architectures = "spacy-legacy.HashEmbedCNN.v1" +pretrained_vectors = null +width = 96 +depth = 4 +embed_size = 2000 +window_size = 1 +maxout_pieces = 3 +subword_features = true +""" +DEFAULT_TOK2VEC_MODEL = Config().from_str(default_tok2vec_config)["model"] + +TRAIN_DATA = [ + ( + "They trade mortgage-backed securities.", + { + "heads": [1, 1, 4, 4, 5, 1, 1], + "deps": ["nsubj", "ROOT", "compound", "punct", "nmod", "dobj", "punct"], + }, + ), + ( + "I like London and Berlin.", + { + "heads": [1, 1, 1, 2, 2, 1], + "deps": ["nsubj", "ROOT", "dobj", "cc", "conj", "punct"], + }, + ), +] + + +@pytest.mark.parametrize( + "parser_config", + [ + { + "@architectures": "spacy-legacy.TransitionBasedParser.v1", + "state_type": "parser", + "extra_state_tokens": False, + "hidden_width": 66, + "maxout_pieces": 2, + "use_upper": True, + "tok2vec": DEFAULT_TOK2VEC_MODEL, + } + ], +) +def test_parser(parser_config): + pipe_config = {"model": parser_config} + nlp = English() + parser = nlp.add_pipe("parser", config=pipe_config) + train_examples = [] + for text, annotations in TRAIN_DATA: + train_examples.append(Example.from_dict(nlp.make_doc(text), annotations)) + for dep in annotations.get("deps", []): + if dep is not None: + parser.add_label(dep) + optimizer = nlp.initialize(get_examples=lambda: train_examples) + for i in range(150): + losses = {} + nlp.update(train_examples, sgd=optimizer, losses=losses) + assert losses["parser"] < 0.0001 diff --git a/TTS/Kokoro/.venv/Lib/site-packages/spacy_legacy/tests/pipeline/__init__.py b/TTS/Kokoro/.venv/Lib/site-packages/spacy_legacy/tests/pipeline/__init__.py new file mode 100644 index 0000000000000000000000000000000000000000..e69de29bb2d1d6434b8b29ae775ad8c2e48c5391 diff --git a/TTS/Kokoro/.venv/Lib/site-packages/spacy_legacy/tests/pipeline/__pycache__/test_tagger.cpython-312.pyc b/TTS/Kokoro/.venv/Lib/site-packages/spacy_legacy/tests/pipeline/__pycache__/test_tagger.cpython-312.pyc new file mode 100644 index 0000000000000000000000000000000000000000..9b800bb3b2be1427cb3cf277068a7a34ef936453 Binary files /dev/null and b/TTS/Kokoro/.venv/Lib/site-packages/spacy_legacy/tests/pipeline/__pycache__/test_tagger.cpython-312.pyc differ diff --git a/TTS/Kokoro/.venv/Lib/site-packages/spacy_legacy/tests/pipeline/__pycache__/test_textcat.cpython-312.pyc b/TTS/Kokoro/.venv/Lib/site-packages/spacy_legacy/tests/pipeline/__pycache__/test_textcat.cpython-312.pyc new file mode 100644 index 0000000000000000000000000000000000000000..9921144c6161571ca3f57cb310ad9ca70430da49 Binary files /dev/null and b/TTS/Kokoro/.venv/Lib/site-packages/spacy_legacy/tests/pipeline/__pycache__/test_textcat.cpython-312.pyc differ diff --git a/TTS/Kokoro/.venv/Lib/site-packages/spacy_legacy/tests/pipeline/test_tagger.py b/TTS/Kokoro/.venv/Lib/site-packages/spacy_legacy/tests/pipeline/test_tagger.py new file mode 100644 index 0000000000000000000000000000000000000000..300bc9bee7f4f4635e956af657481b7473ebb1f2 --- /dev/null +++ b/TTS/Kokoro/.venv/Lib/site-packages/spacy_legacy/tests/pipeline/test_tagger.py @@ -0,0 +1,60 @@ +import pytest +from spacy.training import Example +from spacy.lang.en import English +from thinc.api import Config + + +default_tok2vec_config = """ +[model] +@architectures = "spacy-legacy.HashEmbedCNN.v1" +pretrained_vectors = null +width = 96 +depth = 4 +embed_size = 2000 +window_size = 1 +maxout_pieces = 3 +subword_features = true +""" +DEFAULT_TOK2VEC_MODEL = Config().from_str(default_tok2vec_config)["model"] + + +TAGS = ("N", "V", "J") + +TRAIN_DATA = [ + ("I like green eggs", {"tags": ["N", "V", "J", "N"]}), + ("Eat blue ham", {"tags": ["V", "J", "N"]}), +] + + +@pytest.mark.parametrize( + "tagger_config", + [ + { + "@architectures": "spacy-legacy.Tagger.v1", + "tok2vec": DEFAULT_TOK2VEC_MODEL, + } + ], +) +def test_overfitting_IO(tagger_config): + # Simple test to try and quickly overfit the tagger - ensuring the ML models work correctly + pipe_config = {"model": tagger_config} + nlp = English() + tagger = nlp.add_pipe("tagger", config=pipe_config) + train_examples = [] + for t in TRAIN_DATA: + train_examples.append(Example.from_dict(nlp.make_doc(t[0]), t[1])) + optimizer = nlp.initialize(get_examples=lambda: train_examples) + assert tagger.model.get_dim("nO") == len(TAGS) + + for i in range(50): + losses = {} + nlp.update(train_examples, sgd=optimizer, losses=losses) + assert losses["tagger"] < 0.00001 + + # test the trained model + test_text = "I like blue eggs" + doc = nlp(test_text) + assert doc[0].tag_ == "N" + assert doc[1].tag_ == "V" + assert doc[2].tag_ == "J" + assert doc[3].tag_ == "N" diff --git a/TTS/Kokoro/.venv/Lib/site-packages/spacy_legacy/tests/pipeline/test_textcat.py b/TTS/Kokoro/.venv/Lib/site-packages/spacy_legacy/tests/pipeline/test_textcat.py new file mode 100644 index 0000000000000000000000000000000000000000..cc9e0151c67a62399e56b8088610ccfce6090084 --- /dev/null +++ b/TTS/Kokoro/.venv/Lib/site-packages/spacy_legacy/tests/pipeline/test_textcat.py @@ -0,0 +1,55 @@ +import pytest +from spacy.lang.en import English +from spacy.training import Example +from thinc.api import Config + +default_tok2vec_config = """ +[model] +@architectures = "spacy-legacy.HashEmbedCNN.v1" +pretrained_vectors = null +width = 96 +depth = 4 +embed_size = 2000 +window_size = 1 +maxout_pieces = 3 +subword_features = true +""" +DEFAULT_TOK2VEC_MODEL = Config().from_str(default_tok2vec_config)["model"] + + +TRAIN_DATA_SINGLE_LABEL = [ + ("I'm so happy.", {"cats": {"POSITIVE": 1.0, "NEGATIVE": 0.0}}), + ("I'm so angry", {"cats": {"POSITIVE": 0.0, "NEGATIVE": 1.0}}), +] + +TRAIN_DATA_MULTI_LABEL = [ + ("I'm angry and confused", {"cats": {"ANGRY": 1.0, "CONFUSED": 1.0, "HAPPY": 0.0}}), + ("I'm confused but happy", {"cats": {"ANGRY": 0.0, "CONFUSED": 1.0, "HAPPY": 1.0}}), +] + +# fmt: off +@pytest.mark.parametrize( + "name,train_data,textcat_config", + [ + ("textcat", TRAIN_DATA_SINGLE_LABEL, {"@architectures": "spacy-legacy.TextCatCNN.v1", "exclusive_classes": True, "tok2vec": DEFAULT_TOK2VEC_MODEL}), + ("textcat_multilabel", TRAIN_DATA_MULTI_LABEL, {"@architectures": "spacy-legacy.TextCatCNN.v1", "exclusive_classes": False, "tok2vec": DEFAULT_TOK2VEC_MODEL}), + ("textcat", TRAIN_DATA_SINGLE_LABEL, {"@architectures": "spacy-legacy.TextCatBOW.v1", "exclusive_classes": False,"ngram_size": 2, "no_output_layer": True}), + ("textcat_multilabel", TRAIN_DATA_MULTI_LABEL, {"@architectures": "spacy-legacy.TextCatBOW.v1", "exclusive_classes": True,"ngram_size": 3, "no_output_layer": True}), + ("textcat", TRAIN_DATA_SINGLE_LABEL, {"@architectures": "spacy-legacy.TextCatEnsemble.v1", "width": 32, "embed_size":16, "exclusive_classes": True,"ngram_size":2,"window_size":4,"conv_depth":1,"pretrained_vectors":False,"dropout":0.1}), + ("textcat_multilabel", TRAIN_DATA_MULTI_LABEL, {"@architectures": "spacy-legacy.TextCatEnsemble.v1", "width": 32, "embed_size":16, "exclusive_classes": False,"ngram_size":3,"window_size":6,"conv_depth":2,"pretrained_vectors":False,"dropout":0.2}), + ], +) +# fmt: on +def test_textcat(name, train_data, textcat_config): + pipe_config = {"model": textcat_config} + nlp = English() + textcat = nlp.add_pipe(name, config=pipe_config) + train_examples = [] + for text, annotations in train_data: + train_examples.append(Example.from_dict(nlp.make_doc(text), annotations)) + for label, value in annotations.get("cats").items(): + textcat.add_label(label) + optimizer = nlp.initialize() + for i in range(5): + losses = {} + nlp.update(train_examples, sgd=optimizer, losses=losses) diff --git a/TTS/Kokoro/.venv/Lib/site-packages/spacy_legacy/tests/pipeline/test_tok2vec.py b/TTS/Kokoro/.venv/Lib/site-packages/spacy_legacy/tests/pipeline/test_tok2vec.py new file mode 100644 index 0000000000000000000000000000000000000000..f3fae66dd089ec8926a9726a745d47bf63a5d0b5 --- /dev/null +++ b/TTS/Kokoro/.venv/Lib/site-packages/spacy_legacy/tests/pipeline/test_tok2vec.py @@ -0,0 +1,31 @@ +import pytest +from spacy.tests import util +from spacy_legacy.architectures.tok2vec import Tok2Vec_v1, MultiHashEmbed_v1, CharacterEmbed_v1 +from spacy_legacy.architectures.tok2vec import MaxoutWindowEncoder_v1 +from spacy_legacy.architectures.tok2vec import MishWindowEncoder_v1 +from spacy_legacy.architectures.tok2vec import HashEmbedCNN_v1 + + +@pytest.mark.parametrize( + "width,embed_arch,embed_config,encode_arch,encode_config", + # fmt: off + [ + (8, MultiHashEmbed_v1, {"rows": [100, 100], "attrs": ["SHAPE", "LOWER"], "include_static_vectors": False}, MaxoutWindowEncoder_v1, {"window_size": 1, "maxout_pieces": 3, "depth": 2}), + (8, MultiHashEmbed_v1, {"rows": [100, 20], "attrs": ["ORTH", "PREFIX"], "include_static_vectors": False}, MishWindowEncoder_v1, {"window_size": 1, "depth": 6}), + (8, CharacterEmbed_v1, {"rows": 100, "nM": 64, "nC": 8, "include_static_vectors": False}, MaxoutWindowEncoder_v1, {"window_size": 1, "maxout_pieces": 3, "depth": 3}), + (8, CharacterEmbed_v1, {"rows": 100, "nM": 16, "nC": 2, "include_static_vectors": False}, MishWindowEncoder_v1, {"window_size": 1, "depth": 3}), + (8, HashEmbedCNN_v1, {"depth":2,"embed_size":2,"window_size":4,"maxout_pieces":2,"subword_features":True,"pretrained_vectors":False}, MaxoutWindowEncoder_v1, {"window_size": 1, "maxout_pieces": 3, "depth": 2}), + (8, HashEmbedCNN_v1, {"depth":2,"embed_size":2,"window_size":4,"maxout_pieces":2,"subword_features":True,"pretrained_vectors":False}, MishWindowEncoder_v1, {"window_size": 1, "depth": 3}), + ], + # fmt: on +) +def test_tok2vec(width, embed_arch, embed_config, encode_arch, encode_config): + embed_config["width"] = width + encode_config["width"] = width + docs = util.get_batch(3) + tok2vec = Tok2Vec_v1(embed_arch(**embed_config), encode_arch(**encode_config)) + tok2vec.initialize(docs) + vectors, backprop = tok2vec.begin_update(docs) + assert len(vectors) == len(docs) + assert vectors[0].shape == (len(docs[0]), width) + backprop(vectors) diff --git a/TTS/Kokoro/.venv/Lib/site-packages/spacy_legacy/tests/test_layer.py b/TTS/Kokoro/.venv/Lib/site-packages/spacy_legacy/tests/test_layer.py new file mode 100644 index 0000000000000000000000000000000000000000..6fe2cd952d2371a44bcd755af25c8ddeb706012a --- /dev/null +++ b/TTS/Kokoro/.venv/Lib/site-packages/spacy_legacy/tests/test_layer.py @@ -0,0 +1,19 @@ +import pytest +from spacy.lang.en import English +from spacy_legacy.layers.staticvectors_v1 import StaticVectors_v1 + + +@pytest.mark.parametrize( + "model_func,kwargs", [(StaticVectors_v1, {"nO": 128, "nM": 300})] +) +def test_static_vector_v1(model_func, kwargs): + nlp = English() + model = model_func(**kwargs).initialize() + # Test that the layer can be called successfully with 0, 1 and 2 empty docs. + for n_docs in range(3): + docs = [nlp("") for _ in range(n_docs)] + # Test predict + model.predict(docs) + # Test backprop + output, backprop = model.begin_update(docs) + backprop(output) diff --git a/TTS/Kokoro/.venv/Lib/site-packages/spacy_legacy/tests/test_legacy.py b/TTS/Kokoro/.venv/Lib/site-packages/spacy_legacy/tests/test_legacy.py new file mode 100644 index 0000000000000000000000000000000000000000..72629b910ace9c9f9bab1b90d39dbc5e043409b7 --- /dev/null +++ b/TTS/Kokoro/.venv/Lib/site-packages/spacy_legacy/tests/test_legacy.py @@ -0,0 +1,30 @@ +import pytest +from spacy import registry + +PACKAGES = ["spacy", "spacy-legacy"] +FUNCTIONS = [ + ("architectures", "CharacterEmbed.v1"), + ("architectures", "HashEmbedCNN.v1"), + ("architectures", "MaxoutWindowEncoder.v1"), + ("architectures", "MishWindowEncoder.v1"), + ("architectures", "MultiHashEmbed.v1"), + ("architectures", "Tagger.v1"), + ("architectures", "TextCatBOW.v1"), + ("architectures", "TextCatCNN.v1"), + ("architectures", "TextCatEnsemble.v1"), + ("architectures", "Tok2Vec.v1"), + ("layers", "StaticVectors.v1"), + ("loggers", "ConsoleLogger.v1"), + ("loggers", "ConsoleLogger.v2"), + ("loggers", "WandbLogger.v1"), + ("scorers", "textcat_multilabel_scorer.v1"), + ("scorers", "textcat_scorer.v1"), +] + + +@pytest.mark.parametrize("package", PACKAGES) +@pytest.mark.parametrize("reg_name,name", FUNCTIONS) +def test_registry(package, reg_name, name): + func_name = f"{package}.{name}" + assert registry.has(reg_name, func_name) + assert registry.get(reg_name, func_name) diff --git a/TTS/Kokoro/.venv/Lib/site-packages/spacy_legacy/tests/test_logger.py b/TTS/Kokoro/.venv/Lib/site-packages/spacy_legacy/tests/test_logger.py new file mode 100644 index 0000000000000000000000000000000000000000..335c3a674153eef959b686c3dfdc45eed635af6c --- /dev/null +++ b/TTS/Kokoro/.venv/Lib/site-packages/spacy_legacy/tests/test_logger.py @@ -0,0 +1,6 @@ +import pytest +from spacy_legacy.loggers import wandb_logger_v1 + + +def test_logger(): + wandb_logger_v1("test", []) diff --git a/TTS/Kokoro/.venv/Lib/site-packages/spacy_legacy/tests/test_scorers.py b/TTS/Kokoro/.venv/Lib/site-packages/spacy_legacy/tests/test_scorers.py new file mode 100644 index 0000000000000000000000000000000000000000..d1205b2f37536a3cd3d2907d3b0e6a003cc4f079 --- /dev/null +++ b/TTS/Kokoro/.venv/Lib/site-packages/spacy_legacy/tests/test_scorers.py @@ -0,0 +1,36 @@ +import spacy +from spacy.training import Example +from spacy_legacy.scorers import score_cats_v1 + + +def test_score_cats_v1(): + nlp = spacy.blank("en") + ref = nlp("one") + ref.cats = {"winter": 1.0, "summer": 0.0, "spring": 0.0, "autumn": 0.0} + pred = nlp("one") + pred.cats = {"winter": 0.35, "summer": 0.25, "spring": 0.2, "autumn": 0.2} + + # with the previous threshold of 0.5 provided in the default textcat config, + # this example is counted as incorrect even though winter should be the + # "positive" prediction + scores = score_cats_v1( + [Example(pred, ref)], + "cats", + labels=["winter", "summer", "spring", "autumn"], + multi_label=False, + threshold=0.5, + ) + assert scores["cats_micro_f"] == 0.0 + + # with no provided threshold, the score is correct + # (note that cats_score is incorrectly 0.25 because there are no examples + # for the other labels and the default F-score for nothing with PRFScore is + # 0.0 rather than undefined) + scores = score_cats_v1( + [Example(pred, ref)], + "cats", + labels=["winter", "summer", "spring", "autumn"], + multi_label=False, + threshold=None, + ) + assert scores["cats_micro_f"] == 1.0